From c5c48cbccf624fd3a66885aab7e2822b4ea882a6 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Tue, 22 Sep 2009 20:43:29 +0200 Subject: [PATCH 001/235] Staging: rt3090: disable HAS_ATE option Disable ATE debugging functionality. This makes rt3090 match other Ralink drivers and V2.2.0.0 vendor version. Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt3090/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rt3090/config.mk b/drivers/staging/rt3090/config.mk index 4c90c4060d10..15ca07ba1b24 100644 --- a/drivers/staging/rt3090/config.mk +++ b/drivers/staging/rt3090/config.mk @@ -1,5 +1,5 @@ # Support ATE function -HAS_ATE=y +HAS_ATE=n # Support 28xx QA ATE function HAS_28xx_QA=n -- GitLab From 8b44a41e344209a5be8e521e32e581ceb126b323 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Tue, 22 Sep 2009 20:43:39 +0200 Subject: [PATCH 002/235] Staging: rt3090: disable HAS_ANTENNA_DIVERSITY_SUPPORT option This makes rt3090 match other Ralink drivers and V2.2.0.0 vendor version. Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt3090/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rt3090/config.mk b/drivers/staging/rt3090/config.mk index 15ca07ba1b24..db4057121031 100644 --- a/drivers/staging/rt3090/config.mk +++ b/drivers/staging/rt3090/config.mk @@ -84,7 +84,7 @@ HAS_AUTO_CH_SELECT_ENHANCE=n HAS_BG_FT_SUPPORT=n #Support Antenna Diversity -HAS_ANTENNA_DIVERSITY_SUPPORT=y +HAS_ANTENNA_DIVERSITY_SUPPORT=n ################################################# WFLAGS := -DAGGREGATION_SUPPORT -DPIGGYBACK_SUPPORT -DWMM_SUPPORT -DLINUX -Wall -Wstrict-prototypes -Wno-trigraphs -Wpointer-sign -- GitLab From ee8e96c0413279e49e79f1dc5eec05af46df20b2 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Tue, 22 Sep 2009 20:43:50 +0200 Subject: [PATCH 003/235] Staging: rt3090: remove private debugging ioctls This makes rt3090 match other Ralink drivers. Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt3090/oid.h | 12 - drivers/staging/rt3090/sta_ioctl.c | 799 ----------------------------- 2 files changed, 811 deletions(-) diff --git a/drivers/staging/rt3090/oid.h b/drivers/staging/rt3090/oid.h index 29a43401095e..a375da89a3a6 100644 --- a/drivers/staging/rt3090/oid.h +++ b/drivers/staging/rt3090/oid.h @@ -679,18 +679,6 @@ typedef struct _NDIS_802_11_CAPABILITY #define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x01) // Sync. with AP for wsc upnp daemon #define RTPRIV_IOCTL_SET (SIOCIWFIRSTPRIV + 0x02) -#ifdef DBG -#define RTPRIV_IOCTL_BBP (SIOCIWFIRSTPRIV + 0x03) -#define RTPRIV_IOCTL_MAC (SIOCIWFIRSTPRIV + 0x05) - -#ifdef RTMP_RF_RW_SUPPORT -// TODO: shiang, Need to reassign the oid number. ArchTeam use (SIOCIWFIRSTPRIV + 0x19) for this oid -#define RTPRIV_IOCTL_RF (SIOCIWFIRSTPRIV + 0x13) // edit by johnli, fix read rf register problem -#endif // RTMP_RF_RW_SUPPORT // - -#define RTPRIV_IOCTL_E2P (SIOCIWFIRSTPRIV + 0x07) -#endif // DBG // - #ifdef RALINK_ATE #ifdef RALINK_28xx_QA #define RTPRIV_IOCTL_ATE (SIOCIWFIRSTPRIV + 0x08) diff --git a/drivers/staging/rt3090/sta_ioctl.c b/drivers/staging/rt3090/sta_ioctl.c index b8ab84a0469b..8f54cca89d15 100644 --- a/drivers/staging/rt3090/sta_ioctl.c +++ b/drivers/staging/rt3090/sta_ioctl.c @@ -101,23 +101,6 @@ struct iw_priv_args privtab[] = { IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "adhocEntry" }, /* --- sub-ioctls relations --- */ -#ifdef DBG -{ RTPRIV_IOCTL_BBP, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, - "bbp"}, -{ RTPRIV_IOCTL_MAC, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | 1024, - "mac"}, -#ifdef RTMP_RF_RW_SUPPORT -{ RTPRIV_IOCTL_RF, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, - "rf"}, -#endif // RTMP_RF_RW_SUPPORT // -{ RTPRIV_IOCTL_E2P, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | 1024, - "e2p"}, -#endif /* DBG */ - { RTPRIV_IOCTL_STATISTICS, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "stat"}, @@ -204,18 +187,6 @@ INT Set_Wpa_Support( IN PSTRING arg); #endif // WPA_SUPPLICANT_SUPPORT // -#ifdef DBG - -VOID RTMPIoctlMAC( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq); - -VOID RTMPIoctlE2PROM( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq); -#endif // DBG // - - NDIS_STATUS RTMPWPANoneAddKeyProc( IN PRTMP_ADAPTER pAd, IN PVOID pBuf); @@ -2917,142 +2888,6 @@ int rt_ioctl_siwpmksa(struct net_device *dev, } #endif // #if WIRELESS_EXT > 17 -#ifdef DBG -static int -rt_private_ioctl_bbp(struct net_device *dev, struct iw_request_info *info, - struct iw_point *wrq, char *extra) - { - PSTRING this_char; - PSTRING value = NULL; - UCHAR regBBP = 0; -// CHAR arg[255]={0}; - UINT32 bbpId; - UINT32 bbpValue; - BOOLEAN bIsPrintAllBBP = FALSE; - INT Status = 0; - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - - - memset(extra, 0x00, IW_PRIV_SIZE_MASK); - - if (wrq->length > 1) //No parameters. - { - sprintf(extra, "\n"); - - //Parsing Read or Write - this_char = wrq->pointer; - DBGPRINT(RT_DEBUG_TRACE, ("this_char=%s\n", this_char)); - if (!*this_char) - goto next; - - if ((value = rtstrchr(this_char, '=')) != NULL) - *value++ = 0; - - if (!value || !*value) - { //Read - DBGPRINT(RT_DEBUG_TRACE, ("this_char=%s, value=%s\n", this_char, value)); - if (sscanf(this_char, "%d", &(bbpId)) == 1) - { - if (bbpId <= MAX_BBP_ID) - { -#ifdef RALINK_ATE - if (ATE_ON(pAdapter)) - { - ATE_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); - } - else -#endif // RALINK_ATE // - { - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); - } - sprintf(extra+strlen(extra), "R%02d[0x%02X]:%02X\n", bbpId, bbpId, regBBP); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - DBGPRINT(RT_DEBUG_TRACE, ("msg=%s\n", extra)); - } - else - {//Invalid parametes, so default printk all bbp - bIsPrintAllBBP = TRUE; - goto next; - } - } - else - { //Invalid parametes, so default printk all bbp - bIsPrintAllBBP = TRUE; - goto next; - } - } - else - { //Write - if ((sscanf(this_char, "%d", &(bbpId)) == 1) && (sscanf(value, "%x", &(bbpValue)) == 1)) - { - if (bbpId <= MAX_BBP_ID) - { -#ifdef RALINK_ATE - if (ATE_ON(pAdapter)) - { - ATE_BBP_IO_WRITE8_BY_REG_ID(pAdapter, bbpId, bbpValue); - /* read it back for showing */ - ATE_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); - } - else -#endif // RALINK_ATE // - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, bbpId, bbpValue); - /* read it back for showing */ - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); - } - sprintf(extra+strlen(extra), "R%02d[0x%02X]:%02X\n", bbpId, bbpId, regBBP); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - DBGPRINT(RT_DEBUG_TRACE, ("msg=%s\n", extra)); - } - else - {//Invalid parametes, so default printk all bbp - bIsPrintAllBBP = TRUE; - goto next; - } - } - else - { //Invalid parametes, so default printk all bbp - bIsPrintAllBBP = TRUE; - goto next; - } - } - } - else - bIsPrintAllBBP = TRUE; - -next: - if (bIsPrintAllBBP) - { - memset(extra, 0x00, IW_PRIV_SIZE_MASK); - sprintf(extra, "\n"); - for (bbpId = 0; bbpId <= MAX_BBP_ID; bbpId++) - { - if (strlen(extra) >= (IW_PRIV_SIZE_MASK - 20)) - break; -#ifdef RALINK_ATE - if (ATE_ON(pAdapter)) - { - ATE_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); - } - else -#endif // RALINK_ATE // - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); - sprintf(extra+strlen(extra), "R%02d[0x%02X]:%02X ", bbpId, bbpId, regBBP); - if (bbpId%5 == 4) - sprintf(extra+strlen(extra), "%03d = %02X\n", bbpId, regBBP); // edit by johnli, change display format - } - - wrq->length = strlen(extra) + 1; // 1: size of '\0' - DBGPRINT(RT_DEBUG_TRACE, ("wrq->length = %d\n", wrq->length)); - } - - DBGPRINT(RT_DEBUG_TRACE, ("<==rt_private_ioctl_bbp\n\n")); - - return Status; -} -#endif // DBG // - int rt_ioctl_siwrate(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -3246,11 +3081,7 @@ static const iw_handler rt_priv_handlers[] = { (iw_handler) NULL, /* + 0x00 */ (iw_handler) NULL, /* + 0x01 */ (iw_handler) rt_ioctl_setparam, /* + 0x02 */ -#ifdef DBG - (iw_handler) rt_private_ioctl_bbp, /* + 0x03 */ -#else (iw_handler) NULL, /* + 0x03 */ -#endif (iw_handler) NULL, /* + 0x04 */ (iw_handler) NULL, /* + 0x05 */ (iw_handler) NULL, /* + 0x06 */ @@ -5773,20 +5604,6 @@ INT rt28xx_sta_ioctl( case RTPRIV_IOCTL_GSITESURVEY: RTMPIoctlGetSiteSurvey(pAd, wrq); break; -#ifdef DBG - case RTPRIV_IOCTL_MAC: - RTMPIoctlMAC(pAd, wrq); - break; - case RTPRIV_IOCTL_E2P: - RTMPIoctlE2PROM(pAd, wrq); - break; -#ifdef RTMP_RF_RW_SUPPORT - case RTPRIV_IOCTL_RF: - RTMPIoctlRF(pAd, wrq); - break; -#endif // RTMP_RF_RW_SUPPORT // -#endif // DBG // - case SIOCETHTOOL: break; default: @@ -6700,622 +6517,6 @@ INT Set_Wpa_Support( } #endif // WPA_SUPPLICANT_SUPPORT // -#ifdef DBG -/* - ========================================================================== - Description: - Read / Write MAC - Arguments: - pAdapter Pointer to our adapter - wrq Pointer to the ioctl argument - - Return Value: - None - - Note: - Usage: - 1.) iwpriv ra0 mac 0 ==> read MAC where Addr=0x0 - 2.) iwpriv ra0 mac 0=12 ==> write MAC where Addr=0x0, value=12 - ========================================================================== -*/ -VOID RTMPIoctlMAC( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq) -{ - PSTRING this_char; - PSTRING value; - INT j = 0, k = 0; - STRING msg[1024]; - STRING arg[255]; - ULONG macAddr = 0; - UCHAR temp[16]; - STRING temp2[16]; - UINT32 macValue = 0; - INT Status; - BOOLEAN bIsPrintAllMAC = FALSE; - - - memset(msg, 0x00, 1024); - if (wrq->u.data.length > 1) //No parameters. - { - Status = copy_from_user(arg, wrq->u.data.pointer, (wrq->u.data.length > 255) ? 255 : wrq->u.data.length); - sprintf(msg, "\n"); - - //Parsing Read or Write - this_char = arg; - if (!*this_char) - goto next; - - if ((value = rtstrchr(this_char, '=')) != NULL) - *value++ = 0; - - if (!value || !*value) - { //Read - // Sanity check - if(strlen(this_char) > 4) - goto next; - - j = strlen(this_char); - while(j-- > 0) - { - if(this_char[j] > 'f' || this_char[j] < '0') - return; - } - - // Mac Addr - k = j = strlen(this_char); - while(j-- > 0) - { - this_char[4-k+j] = this_char[j]; - } - - while(k < 4) - this_char[3-k++]='0'; - this_char[4]='\0'; - - if(strlen(this_char) == 4) - { - AtoH(this_char, temp, 2); - macAddr = *temp*256 + temp[1]; - if (macAddr < 0xFFFF) - { - RTMP_IO_READ32(pAdapter, macAddr, &macValue); - DBGPRINT(RT_DEBUG_TRACE, ("MacAddr=%lx, MacValue=%x\n", macAddr, macValue)); - sprintf(msg+strlen(msg), "[0x%08lX]:%08X ", macAddr , macValue); - } - else - {//Invalid parametes, so default printk all mac - bIsPrintAllMAC = TRUE; - goto next; - } - } - } - else - { //Write - memcpy(&temp2, value, strlen(value)); - temp2[strlen(value)] = '\0'; - - // Sanity check - if((strlen(this_char) > 4) || strlen(temp2) > 8) - goto next; - - j = strlen(this_char); - while(j-- > 0) - { - if(this_char[j] > 'f' || this_char[j] < '0') - return; - } - - j = strlen(temp2); - while(j-- > 0) - { - if(temp2[j] > 'f' || temp2[j] < '0') - return; - } - - //MAC Addr - k = j = strlen(this_char); - while(j-- > 0) - { - this_char[4-k+j] = this_char[j]; - } - - while(k < 4) - this_char[3-k++]='0'; - this_char[4]='\0'; - - //MAC value - k = j = strlen(temp2); - while(j-- > 0) - { - temp2[8-k+j] = temp2[j]; - } - - while(k < 8) - temp2[7-k++]='0'; - temp2[8]='\0'; - - { - AtoH(this_char, temp, 2); - macAddr = *temp*256 + temp[1]; - - AtoH(temp2, temp, 4); - macValue = *temp*256*256*256 + temp[1]*256*256 + temp[2]*256 + temp[3]; - - // debug mode - if (macAddr == (HW_DEBUG_SETTING_BASE + 4)) - { - // 0x2bf4: byte0 non-zero: enable R17 tuning, 0: disable R17 tuning - if (macValue & 0x000000ff) - { - pAdapter->BbpTuning.bEnable = TRUE; - DBGPRINT(RT_DEBUG_TRACE,("turn on R17 tuning\n")); - } - else - { - UCHAR R66; - pAdapter->BbpTuning.bEnable = FALSE; - R66 = 0x26 + GET_LNA_GAIN(pAdapter); -#ifdef RALINK_ATE - if (ATE_ON(pAdapter)) - { - ATE_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R66, (0x26 + GET_LNA_GAIN(pAdapter))); - } - else -#endif // RALINK_ATE // - - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R66, (0x26 + GET_LNA_GAIN(pAdapter))); - DBGPRINT(RT_DEBUG_TRACE,("turn off R17 tuning, restore to 0x%02x\n", R66)); - } - return; - } - - DBGPRINT(RT_DEBUG_TRACE, ("MacAddr=%02lx, MacValue=0x%x\n", macAddr, macValue)); - - RTMP_IO_WRITE32(pAdapter, macAddr, macValue); - sprintf(msg+strlen(msg), "[0x%08lX]:%08X ", macAddr, macValue); - } - } - } - else - bIsPrintAllMAC = TRUE; -next: - if (bIsPrintAllMAC) - { - struct file *file_w; - PSTRING fileName = "MacDump.txt"; - mm_segment_t orig_fs; - - orig_fs = get_fs(); - set_fs(KERNEL_DS); - - // open file - file_w = filp_open(fileName, O_WRONLY|O_CREAT, 0); - if (IS_ERR(file_w)) - { - DBGPRINT(RT_DEBUG_TRACE, ("-->2) %s: Error %ld opening %s\n", __FUNCTION__, -PTR_ERR(file_w), fileName)); - } - else - { - if (file_w->f_op && file_w->f_op->write) - { - file_w->f_pos = 0; - macAddr = 0x1000; - - while (macAddr <= 0x1800) - { - RTMP_IO_READ32(pAdapter, macAddr, &macValue); - sprintf(msg, "%08lx = %08X\n", macAddr, macValue); - - // write data to file - file_w->f_op->write(file_w, msg, strlen(msg), &file_w->f_pos); - - printk("%s", msg); - macAddr += 4; - } - sprintf(msg, "\nDump all MAC values to %s\n", fileName); - } - filp_close(file_w, NULL); - } - set_fs(orig_fs); - } - if(strlen(msg) == 1) - sprintf(msg+strlen(msg), "===>Error command format!"); - - // Copy the information into the user buffer - wrq->u.data.length = strlen(msg); - Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length); - - DBGPRINT(RT_DEBUG_TRACE, ("<==RTMPIoctlMAC\n\n")); -} - -/* - ========================================================================== - Description: - Read / Write E2PROM - Arguments: - pAdapter Pointer to our adapter - wrq Pointer to the ioctl argument - - Return Value: - None - - Note: - Usage: - 1.) iwpriv ra0 e2p 0 ==> read E2PROM where Addr=0x0 - 2.) iwpriv ra0 e2p 0=1234 ==> write E2PROM where Addr=0x0, value=1234 - ========================================================================== -*/ -VOID RTMPIoctlE2PROM( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq) -{ - PSTRING this_char; - PSTRING value; - INT j = 0, k = 0; - STRING msg[1024]; - STRING arg[255]; - USHORT eepAddr = 0; - UCHAR temp[16]; - STRING temp2[16]; - USHORT eepValue; - int Status; - BOOLEAN bIsPrintAllE2P = FALSE; - - - memset(msg, 0x00, 1024); - if (wrq->u.data.length > 1) //No parameters. - { - Status = copy_from_user(arg, wrq->u.data.pointer, (wrq->u.data.length > 255) ? 255 : wrq->u.data.length); - sprintf(msg, "\n"); - - //Parsing Read or Write - this_char = arg; - - - if (!*this_char) - goto next; - - if ((value = rtstrchr(this_char, '=')) != NULL) - *value++ = 0; - - if (!value || !*value) - { //Read - - // Sanity check - if(strlen(this_char) > 4) - goto next; - - j = strlen(this_char); - while(j-- > 0) - { - if(this_char[j] > 'f' || this_char[j] < '0') - return; - } - - // E2PROM addr - k = j = strlen(this_char); - while(j-- > 0) - { - this_char[4-k+j] = this_char[j]; - } - - while(k < 4) - this_char[3-k++]='0'; - this_char[4]='\0'; - - if(strlen(this_char) == 4) - { - AtoH(this_char, temp, 2); - eepAddr = *temp*256 + temp[1]; - if (eepAddr < 0xFFFF) - { - RT28xx_EEPROM_READ16(pAdapter, eepAddr, eepValue); - sprintf(msg+strlen(msg), "[0x%04X]:0x%04X ", eepAddr , eepValue); - } - else - {//Invalid parametes, so default printk all bbp - bIsPrintAllE2P = TRUE; - goto next; - } - } - } - else - { //Write - memcpy(&temp2, value, strlen(value)); - temp2[strlen(value)] = '\0'; - - // Sanity check - if((strlen(this_char) > 4) || strlen(temp2) > 8) - goto next; - - j = strlen(this_char); - while(j-- > 0) - { - if(this_char[j] > 'f' || this_char[j] < '0') - return; - } - j = strlen(temp2); - while(j-- > 0) - { - if(temp2[j] > 'f' || temp2[j] < '0') - return; - } - - //MAC Addr - k = j = strlen(this_char); - while(j-- > 0) - { - this_char[4-k+j] = this_char[j]; - } - - while(k < 4) - this_char[3-k++]='0'; - this_char[4]='\0'; - - //MAC value - k = j = strlen(temp2); - while(j-- > 0) - { - temp2[4-k+j] = temp2[j]; - } - - while(k < 4) - temp2[3-k++]='0'; - temp2[4]='\0'; - - AtoH(this_char, temp, 2); - eepAddr = *temp*256 + temp[1]; - - AtoH(temp2, temp, 2); - eepValue = *temp*256 + temp[1]; - - RT28xx_EEPROM_WRITE16(pAdapter, eepAddr, eepValue); - sprintf(msg+strlen(msg), "[0x%02X]:%02X ", eepAddr, eepValue); - } - } - else - bIsPrintAllE2P = TRUE; -next: - if (bIsPrintAllE2P) - { - struct file *file_w; - PSTRING fileName = "EEPROMDump.txt"; - mm_segment_t orig_fs; - - orig_fs = get_fs(); - set_fs(KERNEL_DS); - - // open file - file_w = filp_open(fileName, O_WRONLY|O_CREAT, 0); - if (IS_ERR(file_w)) - { - DBGPRINT(RT_DEBUG_TRACE, ("-->2) %s: Error %ld opening %s\n", __FUNCTION__, -PTR_ERR(file_w), fileName)); - } - else - { - if (file_w->f_op && file_w->f_op->write) - { - file_w->f_pos = 0; - eepAddr = 0x00; - - while (eepAddr <= 0xFE) - { - RT28xx_EEPROM_READ16(pAdapter, eepAddr, eepValue); - sprintf(msg, "%08x = %04x\n", eepAddr , eepValue); - - // write data to file - file_w->f_op->write(file_w, msg, strlen(msg), &file_w->f_pos); - - printk("%s", msg); - eepAddr += 2; - } - sprintf(msg, "\nDump all EEPROM values to %s\n", fileName); - } - filp_close(file_w, NULL); - } - set_fs(orig_fs); - } - if(strlen(msg) == 1) - sprintf(msg+strlen(msg), "===>Error command format!"); - - - // Copy the information into the user buffer - wrq->u.data.length = strlen(msg); - Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length); - - DBGPRINT(RT_DEBUG_TRACE, ("<==RTMPIoctlE2PROM\n")); -} - - -#ifdef RT30xx -/* - ========================================================================== - Description: - Read / Write RF register -Arguments: - pAdapter Pointer to our adapter - wrq Pointer to the ioctl argument - - Return Value: - None - - Note: - Usage: - 1.) iwpriv ra0 rf ==> read all RF registers - 2.) iwpriv ra0 rf 1 ==> read RF where RegID=1 - 3.) iwpriv ra0 rf 1=10 ==> write RF R1=0x10 - ========================================================================== -*/ -VOID RTMPIoctlRF( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq) -{ - CHAR *this_char; - CHAR *value; - UCHAR regRF = 0; - STRING msg[2048]; - CHAR arg[255]; - INT rfId; - LONG rfValue; - int Status; - BOOLEAN bIsPrintAllRF = FALSE; - - - memset(msg, 0x00, 2048); - if (wrq->u.data.length > 1) //No parameters. - { - Status = copy_from_user(arg, wrq->u.data.pointer, (wrq->u.data.length > 255) ? 255 : wrq->u.data.length); - sprintf(msg, "\n"); - - //Parsing Read or Write - this_char = arg; - if (!*this_char) - goto next; - - if ((value = strchr(this_char, '=')) != NULL) - *value++ = 0; - - if (!value || !*value) - { //Read - if (sscanf((PSTRING) this_char, "%d", &(rfId)) == 1) - { - if (rfId <= 31) - { -#ifdef RALINK_ATE - /* - In RT2860 ATE mode, we do not load 8051 firmware. - We must access RF directly. - For RT2870 ATE mode, ATE_RF_IO_WRITE8(/READ8)_BY_REG_ID are redefined. - */ - if (ATE_ON(pAdapter)) - { - ATE_RF_IO_READ8_BY_REG_ID(pAdapter, rfId, ®RF); - } - else -#endif // RALINK_ATE // - // according to Andy, Gary, David require. - // the command rf shall read rf register directly for dubug. - // BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); - RT30xxReadRFRegister(pAdapter, rfId, ®RF); - - sprintf(msg+strlen(msg), "R%02d[0x%02x]:%02X ", rfId, rfId, regRF); - } - else - {//Invalid parametes, so default printk all RF - bIsPrintAllRF = TRUE; - goto next; - } - } - else - { //Invalid parametes, so default printk all RF - bIsPrintAllRF = TRUE; - goto next; - } - } - else - { //Write - if ((sscanf((PSTRING) this_char, "%d", &(rfId)) == 1) && (sscanf((PSTRING) value, "%lx", &(rfValue)) == 1)) - { - if (rfId <= 31) - { -#ifdef RALINK_ATE - /* - In RT2860 ATE mode, we do not load 8051 firmware. - We must access RF directly. - For RT2870 ATE mode, ATE_RF_IO_WRITE8(/READ8)_BY_REG_ID are redefined. - */ - if (ATE_ON(pAdapter)) - { - ATE_RF_IO_READ8_BY_REG_ID(pAdapter, rfId, ®RF); - ATE_RF_IO_WRITE8_BY_REG_ID(pAdapter, (UCHAR)rfId,(UCHAR) rfValue); - //Read it back for showing - ATE_RF_IO_READ8_BY_REG_ID(pAdapter, rfId, ®RF); - sprintf(msg+strlen(msg), "R%02d[0x%02X]:%02X\n", rfId, rfId, regRF); - } - else -#endif // RALINK_ATE // - { - // according to Andy, Gary, David require. - // the command RF shall read/write RF register directly for dubug. - //BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); - //BBP_IO_WRITE8_BY_REG_ID(pAdapter, (UCHAR)bbpId,(UCHAR) bbpValue); - RT30xxReadRFRegister(pAdapter, rfId, ®RF); - RT30xxWriteRFRegister(pAdapter, (UCHAR)rfId,(UCHAR) rfValue); - //Read it back for showing - //BBP_IO_READ8_BY_REG_ID(pAdapter, bbpId, ®BBP); - RT30xxReadRFRegister(pAdapter, rfId, ®RF); - sprintf(msg+strlen(msg), "R%02d[0x%02X]:%02X\n", rfId, rfId, regRF); - } - } - else - {//Invalid parametes, so default printk all RF - bIsPrintAllRF = TRUE; - } - } - else - { //Invalid parametes, so default printk all RF - bIsPrintAllRF = TRUE; - } - } - } - else - bIsPrintAllRF = TRUE; -next: - if (bIsPrintAllRF) - { - memset(msg, 0x00, 2048); - sprintf(msg, "\n"); - for (rfId = 0; rfId <= 31; rfId++) - { -#ifdef RALINK_ATE - /* - In RT2860 ATE mode, we do not load 8051 firmware. - We must access RF directly. - For RT2870 ATE mode, ATE_RF_IO_WRITE8(/READ8)_BY_REG_ID are redefined. - */ - if (ATE_ON(pAdapter)) - { - ATE_RF_IO_READ8_BY_REG_ID(pAdapter, rfId, ®RF); - } - else -#endif // RALINK_ATE // - - // according to Andy, Gary, David require. - // the command RF shall read/write RF register directly for dubug. - RT30xxReadRFRegister(pAdapter, rfId, ®RF); - sprintf(msg+strlen(msg), "%03d = %02X\n", rfId, regRF); - } - // Copy the information into the user buffer - DBGPRINT(RT_DEBUG_TRACE, ("strlen(msg)=%d\n", (UINT32)strlen(msg))); - wrq->u.data.length = strlen(msg); - if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length)) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s: copy_to_user() fail\n", __FUNCTION__)); - } - } - else - { - if(strlen(msg) == 1) - sprintf(msg+strlen(msg), "===>Error command format!"); - - DBGPRINT(RT_DEBUG_TRACE, ("copy to user [msg=%s]\n", msg)); - // Copy the information into the user buffer - DBGPRINT(RT_DEBUG_TRACE, ("strlen(msg) =%d\n", (UINT32)strlen(msg))); - - // Copy the information into the user buffer - wrq->u.data.length = strlen(msg); - Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length); - } - - DBGPRINT(RT_DEBUG_TRACE, ("<==RTMPIoctlRF\n\n")); -} -#endif // RT30xx // -#endif // DBG // - - - - INT Set_TGnWifiTest_Proc( IN PRTMP_ADAPTER pAd, IN PSTRING arg) -- GitLab From 3441d25f03a078d493777f165194f8623ec2750f Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Tue, 22 Sep 2009 20:43:59 +0200 Subject: [PATCH 004/235] Staging: rt3090: remove private ioctls This makes rt3090 match other Ralink drivers. Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt3090/oid.h | 117 -- drivers/staging/rt3090/sta_ioctl.c | 2285 +--------------------------- 2 files changed, 2 insertions(+), 2400 deletions(-) diff --git a/drivers/staging/rt3090/oid.h b/drivers/staging/rt3090/oid.h index a375da89a3a6..25927c1322e3 100644 --- a/drivers/staging/rt3090/oid.h +++ b/drivers/staging/rt3090/oid.h @@ -98,143 +98,26 @@ #define OID_GET_SET_TOGGLE 0x8000 #define OID_GET_SET_FROM_UI 0x4000 -#define OID_802_11_NETWORK_TYPES_SUPPORTED 0x0103 -#define OID_802_11_NETWORK_TYPE_IN_USE 0x0104 -#define OID_802_11_RSSI_TRIGGER 0x0107 -#define RT_OID_802_11_RSSI 0x0108 //rt2860 only , kathy -#define RT_OID_802_11_RSSI_1 0x0109 //rt2860 only , kathy -#define RT_OID_802_11_RSSI_2 0x010A //rt2860 only , kathy -#define OID_802_11_NUMBER_OF_ANTENNAS 0x010B -#define OID_802_11_RX_ANTENNA_SELECTED 0x010C -#define OID_802_11_TX_ANTENNA_SELECTED 0x010D -#define OID_802_11_SUPPORTED_RATES 0x010E #define OID_802_11_ADD_WEP 0x0112 -#define OID_802_11_REMOVE_WEP 0x0113 #define OID_802_11_DISASSOCIATE 0x0114 -#define OID_802_11_PRIVACY_FILTER 0x0118 -#define OID_802_11_ASSOCIATION_INFORMATION 0x011E -#define OID_802_11_TEST 0x011F - - -#define RT_OID_802_11_COUNTRY_REGION 0x0507 #define OID_802_11_BSSID_LIST_SCAN 0x0508 #define OID_802_11_SSID 0x0509 #define OID_802_11_BSSID 0x050A -#define RT_OID_802_11_RADIO 0x050B -#define RT_OID_802_11_PHY_MODE 0x050C -#define RT_OID_802_11_STA_CONFIG 0x050D -#define OID_802_11_DESIRED_RATES 0x050E -#define RT_OID_802_11_PREAMBLE 0x050F -#define OID_802_11_WEP_STATUS 0x0510 -#define OID_802_11_AUTHENTICATION_MODE 0x0511 -#define OID_802_11_INFRASTRUCTURE_MODE 0x0512 -#define RT_OID_802_11_RESET_COUNTERS 0x0513 -#define OID_802_11_RTS_THRESHOLD 0x0514 -#define OID_802_11_FRAGMENTATION_THRESHOLD 0x0515 -#define OID_802_11_POWER_MODE 0x0516 -#define OID_802_11_TX_POWER_LEVEL 0x0517 -#define RT_OID_802_11_ADD_WPA 0x0518 -#define OID_802_11_REMOVE_KEY 0x0519 -#define OID_802_11_ADD_KEY 0x0520 -#define OID_802_11_CONFIGURATION 0x0521 -#define OID_802_11_TX_PACKET_BURST 0x0522 -#define RT_OID_802_11_QUERY_NOISE_LEVEL 0x0523 -#define RT_OID_802_11_EXTRA_INFO 0x0524 -#ifdef DBG -#define RT_OID_802_11_HARDWARE_REGISTER 0x0525 -#endif -#define OID_802_11_ENCRYPTION_STATUS OID_802_11_WEP_STATUS -#define OID_802_11_DEAUTHENTICATION 0x0526 -#define OID_802_11_DROP_UNENCRYPTED 0x0527 #define OID_802_11_MIC_FAILURE_REPORT_FRAME 0x0528 -#define OID_802_11_EAP_METHOD 0x0529 - -// For 802.1x daemin using to require current driver configuration -#define OID_802_11_RADIUS_QUERY_SETTING 0x0540 #define RT_OID_DEVICE_NAME 0x0607 #define RT_OID_VERSION_INFO 0x0608 -#define OID_802_11_BSSID_LIST 0x0609 -#define OID_802_3_CURRENT_ADDRESS 0x060A #define OID_GEN_MEDIA_CONNECT_STATUS 0x060B -#define RT_OID_802_11_QUERY_LINK_STATUS 0x060C -#define OID_802_11_RSSI 0x060D -#define OID_802_11_STATISTICS 0x060E #define OID_GEN_RCV_OK 0x060F #define OID_GEN_RCV_NO_BUFFER 0x0610 -#define RT_OID_802_11_QUERY_EEPROM_VERSION 0x0611 -#define RT_OID_802_11_QUERY_FIRMWARE_VERSION 0x0612 -#define RT_OID_802_11_QUERY_LAST_RX_RATE 0x0613 -#define RT_OID_802_11_TX_POWER_LEVEL_1 0x0614 -#define RT_OID_802_11_QUERY_PIDVID 0x0615 //for WPA_SUPPLICANT_SUPPORT #define OID_SET_COUNTERMEASURES 0x0616 -#define OID_802_11_SET_IEEE8021X 0x0617 -#define OID_802_11_SET_IEEE8021X_REQUIRE_KEY 0x0618 -#define OID_802_11_PMKID 0x0620 #define RT_OID_WPA_SUPPLICANT_SUPPORT 0x0621 #define RT_OID_WE_VERSION_COMPILED 0x0622 #define RT_OID_NEW_DRIVER 0x0623 -#define RT_OID_802_11_SNR_0 0x0630 -#define RT_OID_802_11_SNR_1 0x0631 -#define RT_OID_802_11_QUERY_LAST_TX_RATE 0x0632 -#define RT_OID_802_11_QUERY_HT_PHYMODE 0x0633 -#define RT_OID_802_11_SET_HT_PHYMODE 0x0634 -#define OID_802_11_RELOAD_DEFAULTS 0x0635 -#define RT_OID_802_11_QUERY_APSD_SETTING 0x0636 -#define RT_OID_802_11_SET_APSD_SETTING 0x0637 -#define RT_OID_802_11_QUERY_APSD_PSM 0x0638 -#define RT_OID_802_11_SET_APSD_PSM 0x0639 -#define RT_OID_802_11_QUERY_DLS 0x063A -#define RT_OID_802_11_SET_DLS 0x063B -#define RT_OID_802_11_QUERY_DLS_PARAM 0x063C -#define RT_OID_802_11_SET_DLS_PARAM 0x063D -#define RT_OID_802_11_QUERY_WMM 0x063E -#define RT_OID_802_11_SET_WMM 0x063F -#define RT_OID_802_11_QUERY_IMME_BA_CAP 0x0640 -#define RT_OID_802_11_SET_IMME_BA_CAP 0x0641 -#define RT_OID_802_11_QUERY_BATABLE 0x0642 -#define RT_OID_802_11_ADD_IMME_BA 0x0643 -#define RT_OID_802_11_TEAR_IMME_BA 0x0644 #define RT_OID_DRIVER_DEVICE_NAME 0x0645 -#define RT_OID_802_11_QUERY_DAT_HT_PHYMODE 0x0646 #define RT_OID_QUERY_MULTIPLE_CARD_SUPPORT 0x0647 -#define OID_802_11_SET_PSPXLINK_MODE 0x0648 -/*+++ add by woody +++*/ -#define OID_802_11_SET_PASSPHRASE 0x0649 -// Ralink defined OIDs -// Dennis Lee move to platform specific - -#define RT_OID_802_11_BSSID (OID_GET_SET_TOGGLE | OID_802_11_BSSID) -#define RT_OID_802_11_SSID (OID_GET_SET_TOGGLE | OID_802_11_SSID) -#define RT_OID_802_11_INFRASTRUCTURE_MODE (OID_GET_SET_TOGGLE | OID_802_11_INFRASTRUCTURE_MODE) -#define RT_OID_802_11_ADD_WEP (OID_GET_SET_TOGGLE | OID_802_11_ADD_WEP) -#define RT_OID_802_11_ADD_KEY (OID_GET_SET_TOGGLE | OID_802_11_ADD_KEY) -#define RT_OID_802_11_REMOVE_WEP (OID_GET_SET_TOGGLE | OID_802_11_REMOVE_WEP) -#define RT_OID_802_11_REMOVE_KEY (OID_GET_SET_TOGGLE | OID_802_11_REMOVE_KEY) -#define RT_OID_802_11_DISASSOCIATE (OID_GET_SET_TOGGLE | OID_802_11_DISASSOCIATE) -#define RT_OID_802_11_AUTHENTICATION_MODE (OID_GET_SET_TOGGLE | OID_802_11_AUTHENTICATION_MODE) -#define RT_OID_802_11_PRIVACY_FILTER (OID_GET_SET_TOGGLE | OID_802_11_PRIVACY_FILTER) -#define RT_OID_802_11_BSSID_LIST_SCAN (OID_GET_SET_TOGGLE | OID_802_11_BSSID_LIST_SCAN) -#define RT_OID_802_11_WEP_STATUS (OID_GET_SET_TOGGLE | OID_802_11_WEP_STATUS) -#define RT_OID_802_11_RELOAD_DEFAULTS (OID_GET_SET_TOGGLE | OID_802_11_RELOAD_DEFAULTS) -#define RT_OID_802_11_NETWORK_TYPE_IN_USE (OID_GET_SET_TOGGLE | OID_802_11_NETWORK_TYPE_IN_USE) -#define RT_OID_802_11_TX_POWER_LEVEL (OID_GET_SET_TOGGLE | OID_802_11_TX_POWER_LEVEL) -#define RT_OID_802_11_RSSI_TRIGGER (OID_GET_SET_TOGGLE | OID_802_11_RSSI_TRIGGER) -#define RT_OID_802_11_FRAGMENTATION_THRESHOLD (OID_GET_SET_TOGGLE | OID_802_11_FRAGMENTATION_THRESHOLD) -#define RT_OID_802_11_RTS_THRESHOLD (OID_GET_SET_TOGGLE | OID_802_11_RTS_THRESHOLD) -#define RT_OID_802_11_RX_ANTENNA_SELECTED (OID_GET_SET_TOGGLE | OID_802_11_RX_ANTENNA_SELECTED) -#define RT_OID_802_11_TX_ANTENNA_SELECTED (OID_GET_SET_TOGGLE | OID_802_11_TX_ANTENNA_SELECTED) -#define RT_OID_802_11_SUPPORTED_RATES (OID_GET_SET_TOGGLE | OID_802_11_SUPPORTED_RATES) -#define RT_OID_802_11_DESIRED_RATES (OID_GET_SET_TOGGLE | OID_802_11_DESIRED_RATES) -#define RT_OID_802_11_CONFIGURATION (OID_GET_SET_TOGGLE | OID_802_11_CONFIGURATION) -#define RT_OID_802_11_POWER_MODE (OID_GET_SET_TOGGLE | OID_802_11_POWER_MODE) -#define RT_OID_802_11_SET_PSPXLINK_MODE (OID_GET_SET_TOGGLE | OID_802_11_SET_PSPXLINK_MODE) -#define RT_OID_802_11_EAP_METHOD (OID_GET_SET_TOGGLE | OID_802_11_EAP_METHOD) -#define RT_OID_802_11_SET_PASSPHRASE (OID_GET_SET_TOGGLE | OID_802_11_SET_PASSPHRASE) - - typedef enum _NDIS_802_11_STATUS_TYPE { diff --git a/drivers/staging/rt3090/sta_ioctl.c b/drivers/staging/rt3090/sta_ioctl.c index 8f54cca89d15..e419fb1d5ee4 100644 --- a/drivers/staging/rt3090/sta_ioctl.c +++ b/drivers/staging/rt3090/sta_ioctl.c @@ -3119,2279 +3119,6 @@ const struct iw_handler_def rt28xx_iw_handler_def = #endif }; -INT RTMPSetInformation( - IN PRTMP_ADAPTER pAd, - IN OUT struct ifreq *rq, - IN INT cmd) -{ - struct iwreq *wrq = (struct iwreq *) rq; - NDIS_802_11_SSID Ssid; - NDIS_802_11_MAC_ADDRESS Bssid; - RT_802_11_PHY_MODE PhyMode; - RT_802_11_STA_CONFIG StaConfig; - NDIS_802_11_RATES aryRates; - RT_802_11_PREAMBLE Preamble; - NDIS_802_11_WEP_STATUS WepStatus; - NDIS_802_11_AUTHENTICATION_MODE AuthMode = Ndis802_11AuthModeMax; - NDIS_802_11_NETWORK_INFRASTRUCTURE BssType; - NDIS_802_11_RTS_THRESHOLD RtsThresh; - NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh; - NDIS_802_11_POWER_MODE PowerMode; - PNDIS_802_11_KEY pKey = NULL; - PNDIS_802_11_WEP pWepKey =NULL; - PNDIS_802_11_REMOVE_KEY pRemoveKey = NULL; - NDIS_802_11_CONFIGURATION Config, *pConfig = NULL; - NDIS_802_11_NETWORK_TYPE NetType; - ULONG Now; - UINT KeyIdx = 0; - INT Status = NDIS_STATUS_SUCCESS, MaxPhyMode = PHY_11G; - ULONG PowerTemp; - BOOLEAN RadioState; - BOOLEAN StateMachineTouched = FALSE; - PNDIS_802_11_PASSPHRASE ppassphrase = NULL; -#ifdef DOT11_N_SUPPORT - OID_SET_HT_PHYMODE HT_PhyMode; //11n ,kathy -#endif // DOT11_N_SUPPORT // -#ifdef WPA_SUPPLICANT_SUPPORT - PNDIS_802_11_PMKID pPmkId = NULL; - BOOLEAN IEEE8021xState = FALSE; - BOOLEAN IEEE8021x_required_keys = FALSE; - UCHAR wpa_supplicant_enable = 0; -#endif // WPA_SUPPLICANT_SUPPORT // - -#ifdef SNMP_SUPPORT - TX_RTY_CFG_STRUC tx_rty_cfg; - ULONG ShortRetryLimit, LongRetryLimit; - UCHAR ctmp; -#endif // SNMP_SUPPORT // - - - - -#ifdef DOT11_N_SUPPORT - MaxPhyMode = PHY_11N_5G; -#endif // DOT11_N_SUPPORT // - - DBGPRINT(RT_DEBUG_TRACE, ("-->RTMPSetInformation(), 0x%08x\n", cmd&0x7FFF)); - switch(cmd & 0x7FFF) { - case RT_OID_802_11_COUNTRY_REGION: - if (wrq->u.data.length < sizeof(UCHAR)) - Status = -EINVAL; - // Only avaliable when EEPROM not programming - else if (!(pAd->CommonCfg.CountryRegion & 0x80) && !(pAd->CommonCfg.CountryRegionForABand & 0x80)) - { - ULONG Country; - UCHAR TmpPhy; - - Status = copy_from_user(&Country, wrq->u.data.pointer, wrq->u.data.length); - pAd->CommonCfg.CountryRegion = (UCHAR)(Country & 0x000000FF); - pAd->CommonCfg.CountryRegionForABand = (UCHAR)((Country >> 8) & 0x000000FF); - TmpPhy = pAd->CommonCfg.PhyMode; - pAd->CommonCfg.PhyMode = 0xff; - // Build all corresponding channel information - RTMPSetPhyMode(pAd, TmpPhy); -#ifdef DOT11_N_SUPPORT - SetCommonHT(pAd); -#endif // DOT11_N_SUPPORT // - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_COUNTRY_REGION (A:%d B/G:%d)\n", pAd->CommonCfg.CountryRegionForABand, - pAd->CommonCfg.CountryRegion)); - } - break; - case OID_802_11_BSSID_LIST_SCAN: - Now = jiffies; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_BSSID_LIST_SCAN, TxCnt = %d \n", pAd->RalinkCounters.LastOneSecTotalTxCount)); - - if (MONITOR_ON(pAd)) - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! Driver is in Monitor Mode now !!!\n")); - break; - } - - //Benson add 20080527, when radio off, sta don't need to scan - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) - break; - - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! Driver is scanning now !!!\n")); - pAd->StaCfg.bScanReqIsFromWebUI = TRUE; - Status = NDIS_STATUS_SUCCESS; - break; - } - - if (pAd->RalinkCounters.LastOneSecTotalTxCount > 100) - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! Link UP, ignore this set::OID_802_11_BSSID_LIST_SCAN\n")); - Status = NDIS_STATUS_SUCCESS; - pAd->StaCfg.ScanCnt = 99; // Prevent auto scan triggered by this OID - break; - } - - if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) && - ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) && - (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED)) - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! Link UP, Port Not Secured! ignore this set::OID_802_11_BSSID_LIST_SCAN\n")); - Status = NDIS_STATUS_SUCCESS; - pAd->StaCfg.ScanCnt = 99; // Prevent auto scan triggered by this OID - break; - } - - - if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { - RTMP_MLME_RESET_STATE_MACHINE(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); - } - - // tell CNTL state machine to call NdisMSetInformationComplete() after completing - // this request, because this request is initiated by NDIS. - pAd->MlmeAux.CurrReqIsFromNdis = FALSE; - // Reset allowed scan retries - pAd->StaCfg.ScanCnt = 0; - pAd->StaCfg.LastScanTime = Now; - - pAd->StaCfg.bScanReqIsFromWebUI = TRUE; - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); - MlmeEnqueue(pAd, - MLME_CNTL_STATE_MACHINE, - OID_802_11_BSSID_LIST_SCAN, - 0, - NULL); - - Status = NDIS_STATUS_SUCCESS; - StateMachineTouched = TRUE; - break; - case OID_802_11_SSID: - if (wrq->u.data.length != sizeof(NDIS_802_11_SSID)) - Status = -EINVAL; - else - { - PSTRING pSsidString = NULL; - Status = copy_from_user(&Ssid, wrq->u.data.pointer, wrq->u.data.length); - - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SSID (Len=%d,Ssid=%s)\n", Ssid.SsidLength, Ssid.Ssid)); - if (Ssid.SsidLength > MAX_LEN_OF_SSID) - Status = -EINVAL; - else - { - if (Ssid.SsidLength == 0) - { - Set_SSID_Proc(pAd, ""); - } - else - { - pSsidString = (PSTRING)kmalloc(MAX_LEN_OF_SSID+1, MEM_ALLOC_FLAG); - if (pSsidString) - { - NdisZeroMemory(pSsidString, MAX_LEN_OF_SSID+1); - NdisMoveMemory(pSsidString, Ssid.Ssid, Ssid.SsidLength); - Set_SSID_Proc(pAd, pSsidString); - kfree(pSsidString); - } - else - Status = -ENOMEM; - } - } - } - break; - case OID_802_11_SET_PASSPHRASE: - ppassphrase= kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); - - if(ppassphrase== NULL) - { - Status = -ENOMEM; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SET_PASSPHRASE, Failed!!\n")); - break; - } - else - { - Status = copy_from_user(ppassphrase, wrq->u.data.pointer, wrq->u.data.length); - - if (Status) - { - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SET_PASSPHRASE, Failed (length mismatch)!!\n")); - } - else - { - if(ppassphrase->KeyLength < 8 || ppassphrase->KeyLength > 64) - { - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SET_PASSPHRASE, Failed (len less than 8 or greater than 64)!!\n")); - } - else - { - // set key passphrase and length - NdisZeroMemory(pAd->StaCfg.WpaPassPhrase, 64); - NdisMoveMemory(pAd->StaCfg.WpaPassPhrase, &ppassphrase->KeyMaterial, ppassphrase->KeyLength); - pAd->StaCfg.WpaPassPhraseLen = ppassphrase->KeyLength; - hex_dump("pAd->StaCfg.WpaPassPhrase", pAd->StaCfg.WpaPassPhrase, 64); - printk("WpaPassPhrase=%s\n",pAd->StaCfg.WpaPassPhrase); - } - } - } - kfree(ppassphrase); - break; - - case OID_802_11_BSSID: - if (wrq->u.data.length != sizeof(NDIS_802_11_MAC_ADDRESS)) - Status = -EINVAL; - else - { - Status = copy_from_user(&Bssid, wrq->u.data.pointer, wrq->u.data.length); - - // tell CNTL state machine to call NdisMSetInformationComplete() after completing - // this request, because this request is initiated by NDIS. - pAd->MlmeAux.CurrReqIsFromNdis = FALSE; - - // Prevent to connect AP again in STAMlmePeriodicExec - pAd->MlmeAux.AutoReconnectSsidLen= 32; - - // Reset allowed scan retries - pAd->StaCfg.ScanCnt = 0; - - if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { - RTMP_MLME_RESET_STATE_MACHINE(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); - } - MlmeEnqueue(pAd, - MLME_CNTL_STATE_MACHINE, - OID_802_11_BSSID, - sizeof(NDIS_802_11_MAC_ADDRESS), - (VOID *)&Bssid); - Status = NDIS_STATUS_SUCCESS; - StateMachineTouched = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", - Bssid[0], Bssid[1], Bssid[2], Bssid[3], Bssid[4], Bssid[5])); - } - break; - case RT_OID_802_11_RADIO: - if (wrq->u.data.length != sizeof(BOOLEAN)) - Status = -EINVAL; - else - { - Status = copy_from_user(&RadioState, wrq->u.data.pointer, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_RADIO (=%d)\n", RadioState)); - if (pAd->StaCfg.bSwRadio != RadioState) - { - pAd->StaCfg.bSwRadio = RadioState; - if (pAd->StaCfg.bRadio != (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio)) - { - pAd->StaCfg.bRadio = (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio); - if (pAd->StaCfg.bRadio == TRUE) - { - MlmeRadioOn(pAd); - // Update extra information - pAd->ExtraInfo = EXTRA_INFO_CLEAR; - } - else - { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - { - if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { - RTMP_MLME_RESET_STATE_MACHINE(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); - } - } - - MlmeRadioOff(pAd); - // Update extra information - pAd->ExtraInfo = SW_RADIO_OFF; - } - } - } - } - break; - case RT_OID_802_11_PHY_MODE: - if (wrq->u.data.length != sizeof(RT_802_11_PHY_MODE)) - Status = -EINVAL; - else - { - Status = copy_from_user(&PhyMode, wrq->u.data.pointer, wrq->u.data.length); - if (PhyMode <= MaxPhyMode) - { - RTMPSetPhyMode(pAd, PhyMode); -#ifdef DOT11_N_SUPPORT - SetCommonHT(pAd); -#endif // DOT11_N_SUPPORT // - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_PHY_MODE (=%d)\n", PhyMode)); - } - break; - case RT_OID_802_11_STA_CONFIG: - if (wrq->u.data.length != sizeof(RT_802_11_STA_CONFIG)) - Status = -EINVAL; - else - { - UINT32 Value; - - Status = copy_from_user(&StaConfig, wrq->u.data.pointer, wrq->u.data.length); - pAd->CommonCfg.bEnableTxBurst = StaConfig.EnableTxBurst; - pAd->CommonCfg.UseBGProtection = StaConfig.UseBGProtection; - pAd->CommonCfg.bUseShortSlotTime = 1; // 2003-10-30 always SHORT SLOT capable - if ((pAd->CommonCfg.PhyMode != StaConfig.AdhocMode) && - (StaConfig.AdhocMode <= MaxPhyMode)) - { - // allow dynamic change of "USE OFDM rate or not" in ADHOC mode - // if setting changed, need to reset current TX rate as well as BEACON frame format - if (pAd->StaCfg.BssType == BSS_ADHOC) - { - pAd->CommonCfg.PhyMode = StaConfig.AdhocMode; - RTMPSetPhyMode(pAd, PhyMode); - MlmeUpdateTxRates(pAd, FALSE, 0); - MakeIbssBeacon(pAd); // re-build BEACON frame - AsicEnableIbssSync(pAd); // copy to on-chip memory - } - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_STA_CONFIG (Burst=%d, Protection=%ld,ShortSlot=%d\n", - pAd->CommonCfg.bEnableTxBurst, - pAd->CommonCfg.UseBGProtection, - pAd->CommonCfg.bUseShortSlotTime)); - - if (pAd->CommonCfg.PSPXlink) - Value = PSPXLINK; - else - Value = STANORMAL; - RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, Value); - Value = 0; - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value &= (~0x80); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - } - break; - case OID_802_11_DESIRED_RATES: - if (wrq->u.data.length != sizeof(NDIS_802_11_RATES)) - Status = -EINVAL; - else - { - Status = copy_from_user(&aryRates, wrq->u.data.pointer, wrq->u.data.length); - NdisZeroMemory(pAd->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES); - NdisMoveMemory(pAd->CommonCfg.DesireRate, &aryRates, sizeof(NDIS_802_11_RATES)); - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_DESIRED_RATES (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n", - pAd->CommonCfg.DesireRate[0],pAd->CommonCfg.DesireRate[1], - pAd->CommonCfg.DesireRate[2],pAd->CommonCfg.DesireRate[3], - pAd->CommonCfg.DesireRate[4],pAd->CommonCfg.DesireRate[5], - pAd->CommonCfg.DesireRate[6],pAd->CommonCfg.DesireRate[7] )); - // Changing DesiredRate may affect the MAX TX rate we used to TX frames out - MlmeUpdateTxRates(pAd, FALSE, 0); - } - break; - case RT_OID_802_11_PREAMBLE: - if (wrq->u.data.length != sizeof(RT_802_11_PREAMBLE)) - Status = -EINVAL; - else - { - Status = copy_from_user(&Preamble, wrq->u.data.pointer, wrq->u.data.length); - if (Preamble == Rt802_11PreambleShort) - { - pAd->CommonCfg.TxPreamble = Preamble; - MlmeSetTxPreamble(pAd, Rt802_11PreambleShort); - } - else if ((Preamble == Rt802_11PreambleLong) || (Preamble == Rt802_11PreambleAuto)) - { - // if user wants AUTO, initialize to LONG here, then change according to AP's - // capability upon association. - pAd->CommonCfg.TxPreamble = Preamble; - MlmeSetTxPreamble(pAd, Rt802_11PreambleLong); - } - else - { - Status = -EINVAL; - break; - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_PREAMBLE (=%d)\n", Preamble)); - } - break; - case OID_802_11_WEP_STATUS: - if (wrq->u.data.length != sizeof(NDIS_802_11_WEP_STATUS)) - Status = -EINVAL; - else - { - Status = copy_from_user(&WepStatus, wrq->u.data.pointer, wrq->u.data.length); - // Since TKIP, AES, WEP are all supported. It should not have any invalid setting - if (WepStatus <= Ndis802_11Encryption3KeyAbsent) - { - if (pAd->StaCfg.WepStatus != WepStatus) - { - // Config has changed - pAd->bConfigChanged = TRUE; - } - pAd->StaCfg.WepStatus = WepStatus; - pAd->StaCfg.OrigWepStatus = WepStatus; - pAd->StaCfg.PairCipher = WepStatus; - pAd->StaCfg.GroupCipher = WepStatus; - } - else - { - Status = -EINVAL; - break; - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_WEP_STATUS (=%d)\n",WepStatus)); - } - break; - case OID_802_11_AUTHENTICATION_MODE: - if (wrq->u.data.length != sizeof(NDIS_802_11_AUTHENTICATION_MODE)) - Status = -EINVAL; - else - { - Status = copy_from_user(&AuthMode, wrq->u.data.pointer, wrq->u.data.length); - if (AuthMode > Ndis802_11AuthModeMax) - { - Status = -EINVAL; - break; - } - else - { - if (pAd->StaCfg.AuthMode != AuthMode) - { - // Config has changed - pAd->bConfigChanged = TRUE; - } - pAd->StaCfg.AuthMode = AuthMode; - } - pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_AUTHENTICATION_MODE (=%d) \n",pAd->StaCfg.AuthMode)); - } - break; - case OID_802_11_INFRASTRUCTURE_MODE: - if (wrq->u.data.length != sizeof(NDIS_802_11_NETWORK_INFRASTRUCTURE)) - Status = -EINVAL; - else - { - Status = copy_from_user(&BssType, wrq->u.data.pointer, wrq->u.data.length); - - if (BssType == Ndis802_11IBSS) - Set_NetworkType_Proc(pAd, "Adhoc"); - else if (BssType == Ndis802_11Infrastructure) - Set_NetworkType_Proc(pAd, "Infra"); - else if (BssType == Ndis802_11Monitor) - Set_NetworkType_Proc(pAd, "Monitor"); - else - { - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_INFRASTRUCTURE_MODE (unknown)\n")); - } - } - break; - case OID_802_11_REMOVE_WEP: - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_WEP\n")); - if (wrq->u.data.length != sizeof(NDIS_802_11_KEY_INDEX)) - { - Status = -EINVAL; - } - else - { - KeyIdx = *(NDIS_802_11_KEY_INDEX *) wrq->u.data.pointer; - - if (KeyIdx & 0x80000000) - { - // Should never set default bit when remove key - Status = -EINVAL; - } - else - { - KeyIdx = KeyIdx & 0x0fffffff; - if (KeyIdx >= 4){ - Status = -EINVAL; - } - else - { - pAd->SharedKey[BSS0][KeyIdx].KeyLen = 0; - pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE; - AsicRemoveSharedKeyEntry(pAd, 0, (UCHAR)KeyIdx); - } - } - } - break; - case RT_OID_802_11_RESET_COUNTERS: - NdisZeroMemory(&pAd->WlanCounters, sizeof(COUNTER_802_11)); - NdisZeroMemory(&pAd->Counters8023, sizeof(COUNTER_802_3)); - NdisZeroMemory(&pAd->RalinkCounters, sizeof(COUNTER_RALINK)); - pAd->Counters8023.RxNoBuffer = 0; - pAd->Counters8023.GoodReceives = 0; - pAd->Counters8023.RxNoBuffer = 0; - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_RESET_COUNTERS \n")); - break; - case OID_802_11_RTS_THRESHOLD: - if (wrq->u.data.length != sizeof(NDIS_802_11_RTS_THRESHOLD)) - Status = -EINVAL; - else - { - Status = copy_from_user(&RtsThresh, wrq->u.data.pointer, wrq->u.data.length); - if (RtsThresh > MAX_RTS_THRESHOLD) - Status = -EINVAL; - else - pAd->CommonCfg.RtsThreshold = (USHORT)RtsThresh; - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_RTS_THRESHOLD (=%ld)\n",RtsThresh)); - break; - case OID_802_11_FRAGMENTATION_THRESHOLD: - if (wrq->u.data.length != sizeof(NDIS_802_11_FRAGMENTATION_THRESHOLD)) - Status = -EINVAL; - else - { - Status = copy_from_user(&FragThresh, wrq->u.data.pointer, wrq->u.data.length); - pAd->CommonCfg.bUseZeroToDisableFragment = FALSE; - if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD) - { - if (FragThresh == 0) - { - pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD; - pAd->CommonCfg.bUseZeroToDisableFragment = TRUE; - } - else - Status = -EINVAL; - } - else - pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh; - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_FRAGMENTATION_THRESHOLD (=%ld) \n",FragThresh)); - break; - case OID_802_11_POWER_MODE: - if (wrq->u.data.length != sizeof(NDIS_802_11_POWER_MODE)) - Status = -EINVAL; - else - { - Status = copy_from_user(&PowerMode, wrq->u.data.pointer, wrq->u.data.length); - if (PowerMode == Ndis802_11PowerModeCAM) - Set_PSMode_Proc(pAd, "CAM"); - else if (PowerMode == Ndis802_11PowerModeMAX_PSP) - Set_PSMode_Proc(pAd, "Max_PSP"); - else if (PowerMode == Ndis802_11PowerModeFast_PSP) - Set_PSMode_Proc(pAd, "Fast_PSP"); - else if (PowerMode == Ndis802_11PowerModeLegacy_PSP) - Set_PSMode_Proc(pAd, "Legacy_PSP"); - else - Status = -EINVAL; - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_POWER_MODE (=%d)\n",PowerMode)); - break; - case RT_OID_802_11_TX_POWER_LEVEL_1: - if (wrq->u.data.length < sizeof(ULONG)) - Status = -EINVAL; - else - { - Status = copy_from_user(&PowerTemp, wrq->u.data.pointer, wrq->u.data.length); - if (PowerTemp > 100) - PowerTemp = 0xffffffff; // AUTO - pAd->CommonCfg.TxPowerDefault = PowerTemp; //keep current setting. - pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault; - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_TX_POWER_LEVEL_1 (=%ld)\n", pAd->CommonCfg.TxPowerPercentage)); - } - break; - case OID_802_11_NETWORK_TYPE_IN_USE: - if (wrq->u.data.length != sizeof(NDIS_802_11_NETWORK_TYPE)) - Status = -EINVAL; - else - { - Status = copy_from_user(&NetType, wrq->u.data.pointer, wrq->u.data.length); - - if (NetType == Ndis802_11DS) - RTMPSetPhyMode(pAd, PHY_11B); - else if (NetType == Ndis802_11OFDM24) - RTMPSetPhyMode(pAd, PHY_11BG_MIXED); - else if (NetType == Ndis802_11OFDM5) - RTMPSetPhyMode(pAd, PHY_11A); - else - Status = -EINVAL; -#ifdef DOT11_N_SUPPORT - if (Status == NDIS_STATUS_SUCCESS) - SetCommonHT(pAd); -#endif // DOT11_N_SUPPORT // - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_NETWORK_TYPE_IN_USE (=%d)\n",NetType)); - } - break; - // For WPA PSK PMK key - case RT_OID_802_11_ADD_WPA: - pKey = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); - if(pKey == NULL) - { - Status = -ENOMEM; - break; - } - - Status = copy_from_user(pKey, wrq->u.data.pointer, wrq->u.data.length); - if (pKey->Length != wrq->u.data.length) - { - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_WPA, Failed!!\n")); - } - else - { - if ((pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPAPSK) && - (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPA2PSK) && - (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPANone) ) - { - Status = -EOPNOTSUPP; - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_WPA, Failed!! [AuthMode != WPAPSK/WPA2PSK/WPANONE]\n")); - } - else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) ) // Only for WPA PSK mode - { - NdisMoveMemory(pAd->StaCfg.PMK, &pKey->KeyMaterial, pKey->KeyLength); - // Use RaConfig as PSK agent. - // Start STA supplicant state machine - if (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPANone) - pAd->StaCfg.WpaState = SS_START; - - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_WPA (id=0x%x, Len=%d-byte)\n", pKey->KeyIndex, pKey->KeyLength)); - } - else - { - pAd->StaCfg.WpaState = SS_NOTUSE; - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_WPA (id=0x%x, Len=%d-byte)\n", pKey->KeyIndex, pKey->KeyLength)); - } - } - kfree(pKey); - break; - case OID_802_11_REMOVE_KEY: - pRemoveKey = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); - if(pRemoveKey == NULL) - { - Status = -ENOMEM; - break; - } - - Status = copy_from_user(pRemoveKey, wrq->u.data.pointer, wrq->u.data.length); - if (pRemoveKey->Length != wrq->u.data.length) - { - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY, Failed!!\n")); - } - else - { - if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - { - RTMPWPARemoveKeyProc(pAd, pRemoveKey); - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY, Remove WPA Key!!\n")); - } - else - { - KeyIdx = pRemoveKey->KeyIndex; - - if (KeyIdx & 0x80000000) - { - // Should never set default bit when remove key - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY, Failed!!(Should never set default bit when remove key)\n")); - } - else - { - KeyIdx = KeyIdx & 0x0fffffff; - if (KeyIdx > 3) - { - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY, Failed!!(KeyId[%d] out of range)\n", KeyIdx)); - } - else - { - pAd->SharedKey[BSS0][KeyIdx].KeyLen = 0; - pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE; - AsicRemoveSharedKeyEntry(pAd, 0, (UCHAR)KeyIdx); - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_REMOVE_KEY (id=0x%x, Len=%d-byte)\n", pRemoveKey->KeyIndex, pRemoveKey->Length)); - } - } - } - } - kfree(pRemoveKey); - break; - // New for WPA - case OID_802_11_ADD_KEY: - pKey = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); - if(pKey == NULL) - { - Status = -ENOMEM; - break; - } - Status = copy_from_user(pKey, wrq->u.data.pointer, wrq->u.data.length); - if (pKey->Length != wrq->u.data.length) - { - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_KEY, Failed!!\n")); - } - else - { - RTMPAddKey(pAd, pKey); - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_KEY (id=0x%x, Len=%d-byte)\n", pKey->KeyIndex, pKey->KeyLength)); - } - kfree(pKey); - break; - case OID_802_11_CONFIGURATION: - if (wrq->u.data.length != sizeof(NDIS_802_11_CONFIGURATION)) - Status = -EINVAL; - else - { - Status = copy_from_user(&Config, wrq->u.data.pointer, wrq->u.data.length); - pConfig = &Config; - - if ((pConfig->BeaconPeriod >= 20) && (pConfig->BeaconPeriod <=400)) - pAd->CommonCfg.BeaconPeriod = (USHORT) pConfig->BeaconPeriod; - - pAd->StaActive.AtimWin = (USHORT) pConfig->ATIMWindow; - MAP_KHZ_TO_CHANNEL_ID(pConfig->DSConfig, pAd->CommonCfg.Channel); - // - // Save the channel on MlmeAux for CntlOidRTBssidProc used. - // - pAd->MlmeAux.Channel = pAd->CommonCfg.Channel; - - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_CONFIGURATION (BeacnPeriod=%ld,AtimW=%ld,Ch=%d)\n", - pConfig->BeaconPeriod, pConfig->ATIMWindow, pAd->CommonCfg.Channel)); - // Config has changed - pAd->bConfigChanged = TRUE; - } - break; -#ifdef DOT11_N_SUPPORT - case RT_OID_802_11_SET_HT_PHYMODE: - if (wrq->u.data.length != sizeof(OID_SET_HT_PHYMODE)) - Status = -EINVAL; - else - { - POID_SET_HT_PHYMODE pHTPhyMode = &HT_PhyMode; - - Status = copy_from_user(&HT_PhyMode, wrq->u.data.pointer, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Set::pHTPhyMode (PhyMode = %d,TransmitNo = %d, HtMode = %d, ExtOffset = %d , MCS = %d, BW = %d, STBC = %d, SHORTGI = %d) \n", - pHTPhyMode->PhyMode, pHTPhyMode->TransmitNo,pHTPhyMode->HtMode,pHTPhyMode->ExtOffset, - pHTPhyMode->MCS, pHTPhyMode->BW, pHTPhyMode->STBC, pHTPhyMode->SHORTGI)); - if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) - RTMPSetHT(pAd, pHTPhyMode); - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_HT_PHYMODE(MCS=%d,BW=%d,SGI=%d,STBC=%d)\n", - pAd->StaCfg.HTPhyMode.field.MCS, pAd->StaCfg.HTPhyMode.field.BW, pAd->StaCfg.HTPhyMode.field.ShortGI, - pAd->StaCfg.HTPhyMode.field.STBC)); - break; -#endif // DOT11_N_SUPPORT // - case RT_OID_802_11_SET_APSD_SETTING: - if (wrq->u.data.length != sizeof(ULONG)) - Status = -EINVAL; - else - { - ULONG apsd ; - Status = copy_from_user(&apsd, wrq->u.data.pointer, wrq->u.data.length); - - /*------------------------------------------------------------------- - |B31~B7 | B6~B5 | B4 | B3 | B2 | B1 | B0 | - --------------------------------------------------------------------- - | Rsvd | Max SP Len | AC_VO | AC_VI | AC_BK | AC_BE | APSD Capable | - ---------------------------------------------------------------------*/ - pAd->CommonCfg.bAPSDCapable = (apsd & 0x00000001) ? TRUE : FALSE; - pAd->CommonCfg.bAPSDAC_BE = ((apsd & 0x00000002) >> 1) ? TRUE : FALSE; - pAd->CommonCfg.bAPSDAC_BK = ((apsd & 0x00000004) >> 2) ? TRUE : FALSE; - pAd->CommonCfg.bAPSDAC_VI = ((apsd & 0x00000008) >> 3) ? TRUE : FALSE; - pAd->CommonCfg.bAPSDAC_VO = ((apsd & 0x00000010) >> 4) ? TRUE : FALSE; - pAd->CommonCfg.MaxSPLength = (UCHAR)((apsd & 0x00000060) >> 5); - - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_APSD_SETTING (apsd=0x%lx, APSDCap=%d, [BE,BK,VI,VO]=[%d/%d/%d/%d], MaxSPLen=%d)\n", apsd, pAd->CommonCfg.bAPSDCapable, - pAd->CommonCfg.bAPSDAC_BE, pAd->CommonCfg.bAPSDAC_BK, pAd->CommonCfg.bAPSDAC_VI, pAd->CommonCfg.bAPSDAC_VO, pAd->CommonCfg.MaxSPLength)); - } - break; - - case RT_OID_802_11_SET_APSD_PSM: - if (wrq->u.data.length != sizeof(ULONG)) - Status = -EINVAL; - else - { - // Driver needs to notify AP when PSM changes - Status = copy_from_user(&pAd->CommonCfg.bAPSDForcePowerSave, wrq->u.data.pointer, wrq->u.data.length); - if (pAd->CommonCfg.bAPSDForcePowerSave != pAd->StaCfg.Psm) - { - RTMP_SET_PSM_BIT(pAd, pAd->CommonCfg.bAPSDForcePowerSave); - RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, TRUE); - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_APSD_PSM (bAPSDForcePowerSave:%d)\n", pAd->CommonCfg.bAPSDForcePowerSave)); - } - break; -#ifdef QOS_DLS_SUPPORT - case RT_OID_802_11_SET_DLS: - if (wrq->u.data.length != sizeof(ULONG)) - Status = -EINVAL; - else - { - BOOLEAN oldvalue = pAd->CommonCfg.bDLSCapable; - Status = copy_from_user(&pAd->CommonCfg.bDLSCapable, wrq->u.data.pointer, wrq->u.data.length); - if (oldvalue && !pAd->CommonCfg.bDLSCapable) - { - int i; - // tear down local dls table entry - for (i=0; iStaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH)) - { - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - pAd->StaCfg.DLSEntry[i].Valid = FALSE; - RTMPSendDLSTearDownFrame(pAd, pAd->StaCfg.DLSEntry[i].MacAddr); - } - } - - // tear down peer dls table entry - for (i=MAX_NUM_OF_INIT_DLS_ENTRY; iStaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH)) - { - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - pAd->StaCfg.DLSEntry[i].Valid = FALSE; - RTMPSendDLSTearDownFrame(pAd, pAd->StaCfg.DLSEntry[i].MacAddr); - } - } - } - - DBGPRINT(RT_DEBUG_TRACE,("Set::RT_OID_802_11_SET_DLS (=%d)\n", pAd->CommonCfg.bDLSCapable)); - } - break; - - case RT_OID_802_11_SET_DLS_PARAM: - if (wrq->u.data.length != sizeof(RT_802_11_DLS_UI)) - Status = -EINVAL; - else - { - RT_802_11_DLS Dls; - - NdisZeroMemory(&Dls, sizeof(RT_802_11_DLS)); - RTMPMoveMemory(&Dls, wrq->u.data.pointer, sizeof(RT_802_11_DLS_UI)); - MlmeEnqueue(pAd, - MLME_CNTL_STATE_MACHINE, - RT_OID_802_11_SET_DLS_PARAM, - sizeof(RT_802_11_DLS), - &Dls); - DBGPRINT(RT_DEBUG_TRACE,("Set::RT_OID_802_11_SET_DLS_PARAM \n")); - } - break; -#endif // QOS_DLS_SUPPORT // - case RT_OID_802_11_SET_WMM: - if (wrq->u.data.length != sizeof(BOOLEAN)) - Status = -EINVAL; - else - { - Status = copy_from_user(&pAd->CommonCfg.bWmmCapable, wrq->u.data.pointer, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_SET_WMM (=%d) \n", pAd->CommonCfg.bWmmCapable)); - } - break; - - case OID_802_11_DISASSOCIATE: - // - // Set NdisRadioStateOff to TRUE, instead of called MlmeRadioOff. - // Later on, NDIS_802_11_BSSID_LIST_EX->NumberOfItems should be 0 - // when query OID_802_11_BSSID_LIST. - // - // TRUE: NumberOfItems will set to 0. - // FALSE: NumberOfItems no change. - // - pAd->CommonCfg.NdisRadioStateOff = TRUE; - // Set to immediately send the media disconnect event - pAd->MlmeAux.CurrReqIsFromNdis = TRUE; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_DISASSOCIATE \n")); - - - if (INFRA_ON(pAd)) - { - if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { - RTMP_MLME_RESET_STATE_MACHINE(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); - } - - MlmeEnqueue(pAd, - MLME_CNTL_STATE_MACHINE, - OID_802_11_DISASSOCIATE, - 0, - NULL); - - StateMachineTouched = TRUE; - } - break; - -#ifdef DOT11_N_SUPPORT - case RT_OID_802_11_SET_IMME_BA_CAP: - if (wrq->u.data.length != sizeof(OID_BACAP_STRUC)) - Status = -EINVAL; - else - { - OID_BACAP_STRUC Orde ; - Status = copy_from_user(&Orde, wrq->u.data.pointer, wrq->u.data.length); - if (Orde.Policy > BA_NOTUSE) - { - Status = NDIS_STATUS_INVALID_DATA; - } - else if (Orde.Policy == BA_NOTUSE) - { - pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE; - pAd->CommonCfg.BACapability.field.MpduDensity = Orde.MpduDensity; - pAd->CommonCfg.DesiredHtPhy.MpduDensity = Orde.MpduDensity; - pAd->CommonCfg.DesiredHtPhy.AmsduEnable = Orde.AmsduEnable; - pAd->CommonCfg.DesiredHtPhy.AmsduSize= Orde.AmsduSize; - pAd->CommonCfg.DesiredHtPhy.MimoPs= Orde.MMPSmode; - pAd->CommonCfg.BACapability.field.MMPSmode = Orde.MMPSmode; - // UPdata to HT IE - pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = Orde.MMPSmode; - pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = Orde.AmsduSize; - pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = Orde.MpduDensity; - } - else - { - pAd->CommonCfg.BACapability.field.AutoBA = Orde.AutoBA; - pAd->CommonCfg.BACapability.field.Policy = IMMED_BA; // we only support immediate BA. - pAd->CommonCfg.BACapability.field.MpduDensity = Orde.MpduDensity; - pAd->CommonCfg.DesiredHtPhy.MpduDensity = Orde.MpduDensity; - pAd->CommonCfg.DesiredHtPhy.AmsduEnable = Orde.AmsduEnable; - pAd->CommonCfg.DesiredHtPhy.AmsduSize= Orde.AmsduSize; - pAd->CommonCfg.DesiredHtPhy.MimoPs = Orde.MMPSmode; - pAd->CommonCfg.BACapability.field.MMPSmode = Orde.MMPSmode; - - // UPdata to HT IE - pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = Orde.MMPSmode; - pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = Orde.AmsduSize; - pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = Orde.MpduDensity; - - if (pAd->CommonCfg.BACapability.field.RxBAWinLimit > MAX_RX_REORDERBUF) - pAd->CommonCfg.BACapability.field.RxBAWinLimit = MAX_RX_REORDERBUF; - - } - - pAd->CommonCfg.REGBACapability.word = pAd->CommonCfg.BACapability.word; - DBGPRINT(RT_DEBUG_TRACE, ("Set::(Orde.AutoBA = %d) (Policy=%d)(ReBAWinLimit=%d)(TxBAWinLimit=%d)(AutoMode=%d)\n",Orde.AutoBA, pAd->CommonCfg.BACapability.field.Policy, - pAd->CommonCfg.BACapability.field.RxBAWinLimit,pAd->CommonCfg.BACapability.field.TxBAWinLimit, pAd->CommonCfg.BACapability.field.AutoBA)); - DBGPRINT(RT_DEBUG_TRACE, ("Set::(MimoPs = %d)(AmsduEnable = %d) (AmsduSize=%d)(MpduDensity=%d)\n",pAd->CommonCfg.DesiredHtPhy.MimoPs, pAd->CommonCfg.DesiredHtPhy.AmsduEnable, - pAd->CommonCfg.DesiredHtPhy.AmsduSize, pAd->CommonCfg.DesiredHtPhy.MpduDensity)); - } - - break; - case RT_OID_802_11_ADD_IMME_BA: - DBGPRINT(RT_DEBUG_TRACE, (" Set :: RT_OID_802_11_ADD_IMME_BA \n")); - if (wrq->u.data.length != sizeof(OID_ADD_BA_ENTRY)) - Status = -EINVAL; - else - { - UCHAR index; - OID_ADD_BA_ENTRY BA; - MAC_TABLE_ENTRY *pEntry; - - Status = copy_from_user(&BA, wrq->u.data.pointer, wrq->u.data.length); - if (BA.TID > 15) - { - Status = NDIS_STATUS_INVALID_DATA; - break; - } - else - { - //BATableInsertEntry - //As ad-hoc mode, BA pair is not limited to only BSSID. so add via OID. - index = BA.TID; - // in ad hoc mode, when adding BA pair, we should insert this entry into MACEntry too - pEntry = MacTableLookup(pAd, BA.MACAddr); - if (!pEntry) - { - DBGPRINT(RT_DEBUG_TRACE, ("RT_OID_802_11_ADD_IMME_BA. break on no connection.----:%x:%x\n", BA.MACAddr[4], BA.MACAddr[5])); - break; - } - if (BA.IsRecipient == FALSE) - { - if (pEntry->bIAmBadAtheros == TRUE) - pAd->CommonCfg.BACapability.field.RxBAWinLimit = 0x10; - - BAOriSessionSetUp(pAd, pEntry, index, 0, 100, TRUE); - } - else - { - //BATableInsertEntry(pAd, pEntry->Aid, BA.MACAddr, 0, 0xffff, BA.TID, BA.nMSDU, BA.IsRecipient); - } - - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_802_11_ADD_IMME_BA. Rec = %d. Mac = %x:%x:%x:%x:%x:%x . \n", - BA.IsRecipient, BA.MACAddr[0], BA.MACAddr[1], BA.MACAddr[2], BA.MACAddr[2] - , BA.MACAddr[4], BA.MACAddr[5])); - } - } - break; - - case RT_OID_802_11_TEAR_IMME_BA: - DBGPRINT(RT_DEBUG_TRACE, ("Set :: RT_OID_802_11_TEAR_IMME_BA \n")); - if (wrq->u.data.length != sizeof(OID_ADD_BA_ENTRY)) - Status = -EINVAL; - else - { - POID_ADD_BA_ENTRY pBA; - MAC_TABLE_ENTRY *pEntry; - - pBA = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); - - if (pBA == NULL) - { - DBGPRINT(RT_DEBUG_TRACE, ("Set :: RT_OID_802_11_TEAR_IMME_BA kmalloc() can't allocate enough memory\n")); - Status = NDIS_STATUS_FAILURE; - } - else - { - Status = copy_from_user(pBA, wrq->u.data.pointer, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Set :: RT_OID_802_11_TEAR_IMME_BA(TID=%d, bAllTid=%d)\n", pBA->TID, pBA->bAllTid)); - - if (!pBA->bAllTid && (pBA->TID > NUM_OF_TID)) - { - Status = NDIS_STATUS_INVALID_DATA; - break; - } - - if (pBA->IsRecipient == FALSE) - { - pEntry = MacTableLookup(pAd, pBA->MACAddr); - DBGPRINT(RT_DEBUG_TRACE, (" pBA->IsRecipient == FALSE\n")); - if (pEntry) - { - DBGPRINT(RT_DEBUG_TRACE, (" pBA->pEntry\n")); - BAOriSessionTearDown(pAd, pEntry->Aid, pBA->TID, FALSE, TRUE); - } - else - DBGPRINT(RT_DEBUG_TRACE, ("Set :: Not found pEntry \n")); - } - else - { - pEntry = MacTableLookup(pAd, pBA->MACAddr); - if (pEntry) - { - BARecSessionTearDown( pAd, (UCHAR)pEntry->Aid, pBA->TID, TRUE); - } - else - DBGPRINT(RT_DEBUG_TRACE, ("Set :: Not found pEntry \n")); - } - kfree(pBA); - } - } - break; -#endif // DOT11_N_SUPPORT // - - // For WPA_SUPPLICANT to set static wep key - case OID_802_11_ADD_WEP: - pWepKey = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); - - if(pWepKey == NULL) - { - Status = -ENOMEM; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP, Failed!!\n")); - break; - } - Status = copy_from_user(pWepKey, wrq->u.data.pointer, wrq->u.data.length); - if (Status) - { - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP, Failed (length mismatch)!!\n")); - } - else - { - KeyIdx = pWepKey->KeyIndex & 0x0fffffff; - // KeyIdx must be 0 ~ 3 - if (KeyIdx > 4) - { - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP, Failed (KeyIdx must be smaller than 4)!!\n")); - } - else - { - UCHAR CipherAlg = 0; - PUCHAR Key; - - // set key material and key length - NdisZeroMemory(pAd->SharedKey[BSS0][KeyIdx].Key, 16); - pAd->SharedKey[BSS0][KeyIdx].KeyLen = (UCHAR) pWepKey->KeyLength; - NdisMoveMemory(pAd->SharedKey[BSS0][KeyIdx].Key, &pWepKey->KeyMaterial, pWepKey->KeyLength); - - switch(pWepKey->KeyLength) - { - case 5: - CipherAlg = CIPHER_WEP64; - break; - case 13: - CipherAlg = CIPHER_WEP128; - break; - default: - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP, only support CIPHER_WEP64(len:5) & CIPHER_WEP128(len:13)!!\n")); - Status = -EINVAL; - break; - } - pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CipherAlg; - - // Default key for tx (shared key) - if (pWepKey->KeyIndex & 0x80000000) - { -#ifdef WPA_SUPPLICANT_SUPPORT - // set key material and key length - NdisZeroMemory(pAd->StaCfg.DesireSharedKey[KeyIdx].Key, 16); - pAd->StaCfg.DesireSharedKey[KeyIdx].KeyLen = (UCHAR) pWepKey->KeyLength; - NdisMoveMemory(pAd->StaCfg.DesireSharedKey[KeyIdx].Key, &pWepKey->KeyMaterial, pWepKey->KeyLength); - pAd->StaCfg.DesireSharedKeyId = KeyIdx; - pAd->StaCfg.DesireSharedKey[KeyIdx].CipherAlg = CipherAlg; -#endif // WPA_SUPPLICANT_SUPPORT // - pAd->StaCfg.DefaultKeyId = (UCHAR) KeyIdx; - } - -#ifdef WPA_SUPPLICANT_SUPPORT - if ((pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) && - (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA)) - { - Key = pWepKey->KeyMaterial; - - // Set Group key material to Asic - AsicAddSharedKeyEntry(pAd, BSS0, KeyIdx, CipherAlg, Key, NULL, NULL); - - // Update WCID attribute table and IVEIV table for this group key table - RTMPAddWcidAttributeEntry(pAd, BSS0, KeyIdx, CipherAlg, NULL); - - STA_PORT_SECURED(pAd); - - // Indicate Connected for GUI - pAd->IndicateMediaState = NdisMediaStateConnected; - } - else if (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED) -#endif // WPA_SUPPLICANT_SUPPORT - { - Key = pAd->SharedKey[BSS0][KeyIdx].Key; - - // Set key material and cipherAlg to Asic - AsicAddSharedKeyEntry(pAd, BSS0, KeyIdx, CipherAlg, Key, NULL, NULL); - - if (pWepKey->KeyIndex & 0x80000000) - { - PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[BSSID_WCID]; - // Assign group key info - RTMPAddWcidAttributeEntry(pAd, BSS0, KeyIdx, CipherAlg, NULL); - // Assign pairwise key info - RTMPAddWcidAttributeEntry(pAd, BSS0, KeyIdx, CipherAlg, pEntry); - } - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_ADD_WEP (id=0x%x, Len=%d-byte), %s\n", pWepKey->KeyIndex, pWepKey->KeyLength, (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED) ? "Port Secured":"Port NOT Secured")); - } - } - kfree(pWepKey); - break; -#ifdef WPA_SUPPLICANT_SUPPORT - case OID_SET_COUNTERMEASURES: - if (wrq->u.data.length != sizeof(int)) - Status = -EINVAL; - else - { - int enabled = 0; - Status = copy_from_user(&enabled, wrq->u.data.pointer, wrq->u.data.length); - if (enabled == 1) - pAd->StaCfg.bBlockAssoc = TRUE; - else - // WPA MIC error should block association attempt for 60 seconds - pAd->StaCfg.bBlockAssoc = FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_SET_COUNTERMEASURES bBlockAssoc=%s\n", pAd->StaCfg.bBlockAssoc ? "TRUE":"FALSE")); - } - break; - case RT_OID_WPA_SUPPLICANT_SUPPORT: - if (wrq->u.data.length != sizeof(UCHAR)) - Status = -EINVAL; - else - { - Status = copy_from_user(&wpa_supplicant_enable, wrq->u.data.pointer, wrq->u.data.length); - pAd->StaCfg.WpaSupplicantUP = wpa_supplicant_enable; - DBGPRINT(RT_DEBUG_TRACE, ("Set::RT_OID_WPA_SUPPLICANT_SUPPORT (=%d)\n", pAd->StaCfg.WpaSupplicantUP)); - } - break; - case OID_802_11_DEAUTHENTICATION: - if (wrq->u.data.length != sizeof(MLME_DEAUTH_REQ_STRUCT)) - Status = -EINVAL; - else - { - MLME_DEAUTH_REQ_STRUCT *pInfo; - MLME_QUEUE_ELEM *MsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); - if (MsgElem == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s():alloc memory failed!\n", __FUNCTION__)); - return -EINVAL; - } - - pInfo = (MLME_DEAUTH_REQ_STRUCT *) MsgElem->Msg; - Status = copy_from_user(pInfo, wrq->u.data.pointer, wrq->u.data.length); - MlmeDeauthReqAction(pAd, MsgElem); - kfree(MsgElem); - - if (INFRA_ON(pAd)) - { - LinkDown(pAd, FALSE); - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - } - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_DEAUTHENTICATION (Reason=%d)\n", pInfo->Reason)); - } - break; - case OID_802_11_DROP_UNENCRYPTED: - if (wrq->u.data.length != sizeof(int)) - Status = -EINVAL; - else - { - int enabled = 0; - Status = copy_from_user(&enabled, wrq->u.data.pointer, wrq->u.data.length); - if (enabled == 1) - pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - else - pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - NdisAcquireSpinLock(&pAd->MacTabLock); - pAd->MacTab.Content[BSSID_WCID].PortSecured = pAd->StaCfg.PortSecured; - NdisReleaseSpinLock(&pAd->MacTabLock); - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_DROP_UNENCRYPTED (=%d)\n", enabled)); - } - break; - case OID_802_11_SET_IEEE8021X: - if (wrq->u.data.length != sizeof(BOOLEAN)) - Status = -EINVAL; - else - { - Status = copy_from_user(&IEEE8021xState, wrq->u.data.pointer, wrq->u.data.length); - pAd->StaCfg.IEEE8021X = IEEE8021xState; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SET_IEEE8021X (=%d)\n", IEEE8021xState)); - } - break; - case OID_802_11_SET_IEEE8021X_REQUIRE_KEY: - if (wrq->u.data.length != sizeof(BOOLEAN)) - Status = -EINVAL; - else - { - Status = copy_from_user(&IEEE8021x_required_keys, wrq->u.data.pointer, wrq->u.data.length); - pAd->StaCfg.IEEE8021x_required_keys = IEEE8021x_required_keys; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SET_IEEE8021X_REQUIRE_KEY (%d)\n", IEEE8021x_required_keys)); - } - break; - case OID_802_11_PMKID: - pPmkId = kmalloc(wrq->u.data.length, MEM_ALLOC_FLAG); - - if(pPmkId == NULL) { - Status = -ENOMEM; - break; - } - Status = copy_from_user(pPmkId, wrq->u.data.pointer, wrq->u.data.length); - - // check the PMKID information - if (pPmkId->BSSIDInfoCount == 0) - NdisZeroMemory(pAd->StaCfg.SavedPMK, sizeof(BSSID_INFO)*PMKID_NO); - else - { - PBSSID_INFO pBssIdInfo; - UINT BssIdx; - UINT CachedIdx; - - for (BssIdx = 0; BssIdx < pPmkId->BSSIDInfoCount; BssIdx++) - { - // point to the indexed BSSID_INFO structure - pBssIdInfo = (PBSSID_INFO) ((PUCHAR) pPmkId + 2 * sizeof(UINT) + BssIdx * sizeof(BSSID_INFO)); - // Find the entry in the saved data base. - for (CachedIdx = 0; CachedIdx < pAd->StaCfg.SavedPMKNum; CachedIdx++) - { - // compare the BSSID - if (NdisEqualMemory(pBssIdInfo->BSSID, pAd->StaCfg.SavedPMK[CachedIdx].BSSID, sizeof(NDIS_802_11_MAC_ADDRESS))) - break; - } - - // Found, replace it - if (CachedIdx < PMKID_NO) - { - DBGPRINT(RT_DEBUG_OFF, ("Update OID_802_11_PMKID, idx = %d\n", CachedIdx)); - NdisMoveMemory(&pAd->StaCfg.SavedPMK[CachedIdx], pBssIdInfo, sizeof(BSSID_INFO)); - pAd->StaCfg.SavedPMKNum++; - } - // Not found, replace the last one - else - { - // Randomly replace one - CachedIdx = (pBssIdInfo->BSSID[5] % PMKID_NO); - DBGPRINT(RT_DEBUG_OFF, ("Update OID_802_11_PMKID, idx = %d\n", CachedIdx)); - NdisMoveMemory(&pAd->StaCfg.SavedPMK[CachedIdx], pBssIdInfo, sizeof(BSSID_INFO)); - } - } - } - if(pPmkId) - kfree(pPmkId); - break; -#endif // WPA_SUPPLICANT_SUPPORT // - - - -#ifdef SNMP_SUPPORT - case OID_802_11_SHORTRETRYLIMIT: - if (wrq->u.data.length != sizeof(ULONG)) - Status = -EINVAL; - else - { - Status = copy_from_user(&ShortRetryLimit, wrq->u.data.pointer, wrq->u.data.length); - RTMP_IO_READ32(pAd, TX_RTY_CFG, &tx_rty_cfg.word); - tx_rty_cfg.field.ShortRtyLimit = ShortRetryLimit; - RTMP_IO_WRITE32(pAd, TX_RTY_CFG, tx_rty_cfg.word); - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_SHORTRETRYLIMIT (tx_rty_cfg.field.ShortRetryLimit=%d, ShortRetryLimit=%ld)\n", tx_rty_cfg.field.ShortRtyLimit, ShortRetryLimit)); - } - break; - - case OID_802_11_LONGRETRYLIMIT: - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_LONGRETRYLIMIT \n")); - if (wrq->u.data.length != sizeof(ULONG)) - Status = -EINVAL; - else - { - Status = copy_from_user(&LongRetryLimit, wrq->u.data.pointer, wrq->u.data.length); - RTMP_IO_READ32(pAd, TX_RTY_CFG, &tx_rty_cfg.word); - tx_rty_cfg.field.LongRtyLimit = LongRetryLimit; - RTMP_IO_WRITE32(pAd, TX_RTY_CFG, tx_rty_cfg.word); - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_LONGRETRYLIMIT (tx_rty_cfg.field.LongRetryLimit= %d,LongRetryLimit=%ld)\n", tx_rty_cfg.field.LongRtyLimit, LongRetryLimit)); - } - break; - - case OID_802_11_WEPDEFAULTKEYVALUE: - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_WEPDEFAULTKEYVALUE\n")); - pKey = kmalloc(wrq->u.data.length, GFP_KERNEL); - Status = copy_from_user(pKey, wrq->u.data.pointer, wrq->u.data.length); - //pKey = &WepKey; - - if ( pKey->Length != wrq->u.data.length) - { - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_WEPDEFAULTKEYVALUE, Failed!!\n")); - } - KeyIdx = pKey->KeyIndex & 0x0fffffff; - DBGPRINT(RT_DEBUG_TRACE,("pKey->KeyIndex =%d, pKey->KeyLength=%d\n", pKey->KeyIndex, pKey->KeyLength)); - - // it is a shared key - if (KeyIdx > 4) - Status = -EINVAL; - else - { - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].KeyLen = (UCHAR) pKey->KeyLength; - NdisMoveMemory(&pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].Key, &pKey->KeyMaterial, pKey->KeyLength); - if (pKey->KeyIndex & 0x80000000) - { - // Default key for tx (shared key) - pAd->StaCfg.DefaultKeyId = (UCHAR) KeyIdx; - } - //RestartAPIsRequired = TRUE; - } - break; - - - case OID_802_11_WEPDEFAULTKEYID: - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_WEPDEFAULTKEYID \n")); - - if (wrq->u.data.length != sizeof(UCHAR)) - Status = -EINVAL; - else - Status = copy_from_user(&pAd->StaCfg.DefaultKeyId, wrq->u.data.pointer, wrq->u.data.length); - - break; - - - case OID_802_11_CURRENTCHANNEL: - DBGPRINT(RT_DEBUG_TRACE, ("Set::OID_802_11_CURRENTCHANNEL \n")); - if (wrq->u.data.length != sizeof(UCHAR)) - Status = -EINVAL; - else - { - Status = copy_from_user(&ctmp, wrq->u.data.pointer, wrq->u.data.length); - sprintf((PSTRING)&ctmp,"%d", ctmp); - Set_Channel_Proc(pAd, (PSTRING)&ctmp); - } - break; -#endif - - - - case RT_OID_802_11_SET_PSPXLINK_MODE: - if (wrq->u.data.length != sizeof(BOOLEAN)) - Status = -EINVAL; - else - { - Status = copy_from_user(&pAd->CommonCfg.PSPXlink, wrq->u.data.pointer, wrq->u.data.length); - /*if (pAd->CommonCfg.PSPXlink) - RX_FILTER_SET_FLAG(pAd, fRX_FILTER_ACCEPT_PROMISCUOUS)*/ - DBGPRINT(RT_DEBUG_TRACE,("Set::RT_OID_802_11_SET_PSPXLINK_MODE(=%d) \n", pAd->CommonCfg.PSPXlink)); - } - break; - - - default: - DBGPRINT(RT_DEBUG_TRACE, ("Set::unknown IOCTL's subcmd = 0x%08x\n", cmd)); - Status = -EOPNOTSUPP; - break; - } - - - return Status; -} - -INT RTMPQueryInformation( - IN PRTMP_ADAPTER pAd, - IN OUT struct ifreq *rq, - IN INT cmd) -{ - struct iwreq *wrq = (struct iwreq *) rq; - NDIS_802_11_BSSID_LIST_EX *pBssidList = NULL; - PNDIS_WLAN_BSSID_EX pBss; - NDIS_802_11_SSID Ssid; - NDIS_802_11_CONFIGURATION *pConfiguration = NULL; - RT_802_11_LINK_STATUS *pLinkStatus = NULL; - RT_802_11_STA_CONFIG *pStaConfig = NULL; - NDIS_802_11_STATISTICS *pStatistics = NULL; - NDIS_802_11_RTS_THRESHOLD RtsThresh; - NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh; - NDIS_802_11_POWER_MODE PowerMode; - NDIS_802_11_NETWORK_INFRASTRUCTURE BssType; - RT_802_11_PREAMBLE PreamType; - NDIS_802_11_AUTHENTICATION_MODE AuthMode; - NDIS_802_11_WEP_STATUS WepStatus; - NDIS_MEDIA_STATE MediaState; - ULONG BssBufSize, ulInfo=0, NetworkTypeList[4], apsd = 0; - USHORT BssLen = 0; - PUCHAR pBuf = NULL, pPtr; - INT Status = NDIS_STATUS_SUCCESS; - UINT we_version_compiled; - UCHAR i, Padding = 0; - BOOLEAN RadioState; - STRING driverVersion[8]; - OID_SET_HT_PHYMODE *pHTPhyMode = NULL; - - -#ifdef SNMP_SUPPORT - //for snmp, kathy - DefaultKeyIdxValue *pKeyIdxValue; - INT valueLen; - TX_RTY_CFG_STRUC tx_rty_cfg; - ULONG ShortRetryLimit, LongRetryLimit; - UCHAR tmp[64]; -#endif //SNMP - - switch(cmd) - { - case RT_OID_DEVICE_NAME: - wrq->u.data.length = sizeof(pAd->nickname); - Status = copy_to_user(wrq->u.data.pointer, pAd->nickname, wrq->u.data.length); - break; - case RT_OID_VERSION_INFO: - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_VERSION_INFO \n")); - wrq->u.data.length = 8*sizeof(CHAR); - sprintf(&driverVersion[0], "%s", STA_DRIVER_VERSION); - driverVersion[7] = '\0'; - if (copy_to_user(wrq->u.data.pointer, &driverVersion[0], wrq->u.data.length)) - { - Status = -EFAULT; - } - break; - - case OID_802_11_BSSID_LIST: - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - { - /* - * Still scanning, indicate the caller should try again. - */ - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_BSSID_LIST (Still scanning)\n")); - return -EAGAIN; - } - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_BSSID_LIST (%d BSS returned)\n",pAd->ScanTab.BssNr)); - pAd->StaCfg.bScanReqIsFromWebUI = FALSE; - // Claculate total buffer size required - BssBufSize = sizeof(ULONG); - - for (i = 0; i < pAd->ScanTab.BssNr; i++) - { - // Align pointer to 4 bytes boundary. - //Padding = 4 - (pAdapter->ScanTab.BssEntry[i].VarIELen & 0x0003); - //if (Padding == 4) - // Padding = 0; - BssBufSize += (sizeof(NDIS_WLAN_BSSID_EX) - 1 + sizeof(NDIS_802_11_FIXED_IEs) + pAd->ScanTab.BssEntry[i].VarIELen + Padding); - } - - // For safety issue, we add 256 bytes just in case - BssBufSize += 256; - // Allocate the same size as passed from higher layer - pBuf = kmalloc(BssBufSize, MEM_ALLOC_FLAG); - if(pBuf == NULL) - { - Status = -ENOMEM; - break; - } - // Init 802_11_BSSID_LIST_EX structure - NdisZeroMemory(pBuf, BssBufSize); - pBssidList = (PNDIS_802_11_BSSID_LIST_EX) pBuf; - pBssidList->NumberOfItems = pAd->ScanTab.BssNr; - - // Calculate total buffer length - BssLen = 4; // Consist of NumberOfItems - // Point to start of NDIS_WLAN_BSSID_EX - // pPtr = pBuf + sizeof(ULONG); - pPtr = (PUCHAR) &pBssidList->Bssid[0]; - for (i = 0; i < pAd->ScanTab.BssNr; i++) - { - pBss = (PNDIS_WLAN_BSSID_EX) pPtr; - NdisMoveMemory(&pBss->MacAddress, &pAd->ScanTab.BssEntry[i].Bssid, MAC_ADDR_LEN); - if ((pAd->ScanTab.BssEntry[i].Hidden == 1) && (pAd->StaCfg.bShowHiddenSSID == FALSE)) - { - // - // We must return this SSID during 4way handshaking, otherwise Aegis will failed to parse WPA infomation - // and then failed to send EAPOl farame. - // - if ((pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) && (pAd->StaCfg.PortSecured != WPA_802_1X_PORT_SECURED)) - { - pBss->Ssid.SsidLength = pAd->ScanTab.BssEntry[i].SsidLen; - NdisMoveMemory(pBss->Ssid.Ssid, pAd->ScanTab.BssEntry[i].Ssid, pAd->ScanTab.BssEntry[i].SsidLen); - } - else - pBss->Ssid.SsidLength = 0; - } - else - { - pBss->Ssid.SsidLength = pAd->ScanTab.BssEntry[i].SsidLen; - NdisMoveMemory(pBss->Ssid.Ssid, pAd->ScanTab.BssEntry[i].Ssid, pAd->ScanTab.BssEntry[i].SsidLen); - } - pBss->Privacy = pAd->ScanTab.BssEntry[i].Privacy; - pBss->Rssi = pAd->ScanTab.BssEntry[i].Rssi - pAd->BbpRssiToDbmDelta; - pBss->NetworkTypeInUse = NetworkTypeInUseSanity(&pAd->ScanTab.BssEntry[i]); - pBss->Configuration.Length = sizeof(NDIS_802_11_CONFIGURATION); - pBss->Configuration.BeaconPeriod = pAd->ScanTab.BssEntry[i].BeaconPeriod; - pBss->Configuration.ATIMWindow = pAd->ScanTab.BssEntry[i].AtimWin; - - MAP_CHANNEL_ID_TO_KHZ(pAd->ScanTab.BssEntry[i].Channel, pBss->Configuration.DSConfig); - - if (pAd->ScanTab.BssEntry[i].BssType == BSS_INFRA) - pBss->InfrastructureMode = Ndis802_11Infrastructure; - else - pBss->InfrastructureMode = Ndis802_11IBSS; - - NdisMoveMemory(pBss->SupportedRates, pAd->ScanTab.BssEntry[i].SupRate, pAd->ScanTab.BssEntry[i].SupRateLen); - NdisMoveMemory(pBss->SupportedRates + pAd->ScanTab.BssEntry[i].SupRateLen, - pAd->ScanTab.BssEntry[i].ExtRate, - pAd->ScanTab.BssEntry[i].ExtRateLen); - - if (pAd->ScanTab.BssEntry[i].VarIELen == 0) - { - pBss->IELength = sizeof(NDIS_802_11_FIXED_IEs); - NdisMoveMemory(pBss->IEs, &pAd->ScanTab.BssEntry[i].FixIEs, sizeof(NDIS_802_11_FIXED_IEs)); - pPtr = pPtr + sizeof(NDIS_WLAN_BSSID_EX) - 1 + sizeof(NDIS_802_11_FIXED_IEs); - } - else - { - pBss->IELength = (ULONG)(sizeof(NDIS_802_11_FIXED_IEs) + pAd->ScanTab.BssEntry[i].VarIELen); - pPtr = pPtr + sizeof(NDIS_WLAN_BSSID_EX) - 1 + sizeof(NDIS_802_11_FIXED_IEs); - NdisMoveMemory(pBss->IEs, &pAd->ScanTab.BssEntry[i].FixIEs, sizeof(NDIS_802_11_FIXED_IEs)); - NdisMoveMemory(pBss->IEs + sizeof(NDIS_802_11_FIXED_IEs), pAd->ScanTab.BssEntry[i].VarIEs, pAd->ScanTab.BssEntry[i].VarIELen); - pPtr += pAd->ScanTab.BssEntry[i].VarIELen; - } - pBss->Length = (ULONG)(sizeof(NDIS_WLAN_BSSID_EX) - 1 + sizeof(NDIS_802_11_FIXED_IEs) + pAd->ScanTab.BssEntry[i].VarIELen + Padding); - -#if WIRELESS_EXT < 17 - if ((BssLen + pBss->Length) < wrq->u.data.length) - BssLen += pBss->Length; - else - { - pBssidList->NumberOfItems = i; - break; - } -#else - BssLen += pBss->Length; -#endif - } - -#if WIRELESS_EXT < 17 - wrq->u.data.length = BssLen; -#else - if (BssLen > wrq->u.data.length) - { - kfree(pBssidList); - return -E2BIG; - } - else - wrq->u.data.length = BssLen; -#endif - Status = copy_to_user(wrq->u.data.pointer, pBssidList, BssLen); - kfree(pBssidList); - break; - case OID_802_3_CURRENT_ADDRESS: - wrq->u.data.length = MAC_ADDR_LEN; - Status = copy_to_user(wrq->u.data.pointer, &pAd->CurrentAddress, wrq->u.data.length); - break; - case OID_GEN_MEDIA_CONNECT_STATUS: - if (pAd->IndicateMediaState == NdisMediaStateConnected) - MediaState = NdisMediaStateConnected; - else - MediaState = NdisMediaStateDisconnected; - - wrq->u.data.length = sizeof(NDIS_MEDIA_STATE); - Status = copy_to_user(wrq->u.data.pointer, &MediaState, wrq->u.data.length); - break; - case OID_802_11_BSSID: - if (INFRA_ON(pAd) || ADHOC_ON(pAd)) - { - Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.Bssid, sizeof(NDIS_802_11_MAC_ADDRESS)); - - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_BSSID(=EMPTY)\n")); - Status = -ENOTCONN; - } - break; - case OID_802_11_SSID: - NdisZeroMemory(&Ssid, sizeof(NDIS_802_11_SSID)); - NdisZeroMemory(Ssid.Ssid, MAX_LEN_OF_SSID); - Ssid.SsidLength = pAd->CommonCfg.SsidLen; - memcpy(Ssid.Ssid, pAd->CommonCfg.Ssid, Ssid.SsidLength); - wrq->u.data.length = sizeof(NDIS_802_11_SSID); - Status = copy_to_user(wrq->u.data.pointer, &Ssid, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_SSID (Len=%d, ssid=%s)\n", Ssid.SsidLength,Ssid.Ssid)); - break; - case RT_OID_802_11_QUERY_LINK_STATUS: - pLinkStatus = (RT_802_11_LINK_STATUS *) kmalloc(sizeof(RT_802_11_LINK_STATUS), MEM_ALLOC_FLAG); - if (pLinkStatus) - { - pLinkStatus->CurrTxRate = RateIdTo500Kbps[pAd->CommonCfg.TxRate]; // unit : 500 kbps - pLinkStatus->ChannelQuality = pAd->Mlme.ChannelQuality; - pLinkStatus->RxByteCount = pAd->RalinkCounters.ReceivedByteCount; - pLinkStatus->TxByteCount = pAd->RalinkCounters.TransmittedByteCount; - pLinkStatus->CentralChannel = pAd->CommonCfg.CentralChannel; - wrq->u.data.length = sizeof(RT_802_11_LINK_STATUS); - Status = copy_to_user(wrq->u.data.pointer, pLinkStatus, wrq->u.data.length); - kfree(pLinkStatus); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_LINK_STATUS\n")); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_LINK_STATUS(kmalloc failed)\n")); - Status = -EFAULT; - } - break; - case OID_802_11_CONFIGURATION: - pConfiguration = (NDIS_802_11_CONFIGURATION *) kmalloc(sizeof(NDIS_802_11_CONFIGURATION), MEM_ALLOC_FLAG); - if (pConfiguration) - { - pConfiguration->Length = sizeof(NDIS_802_11_CONFIGURATION); - pConfiguration->BeaconPeriod = pAd->CommonCfg.BeaconPeriod; - pConfiguration->ATIMWindow = pAd->StaActive.AtimWin; - MAP_CHANNEL_ID_TO_KHZ(pAd->CommonCfg.Channel, pConfiguration->DSConfig); - wrq->u.data.length = sizeof(NDIS_802_11_CONFIGURATION); - Status = copy_to_user(wrq->u.data.pointer, pConfiguration, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_CONFIGURATION(BeaconPeriod=%ld,AtimW=%ld,Channel=%d) \n", - pConfiguration->BeaconPeriod, pConfiguration->ATIMWindow, pAd->CommonCfg.Channel)); - kfree(pConfiguration); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_CONFIGURATION(kmalloc failed)\n")); - Status = -EFAULT; - } - break; - case RT_OID_802_11_SNR_0: - if ((pAd->StaCfg.LastSNR0 > 0)) - { - ulInfo = ((0xeb - pAd->StaCfg.LastSNR0) * 3) / 16 ; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_SNR_0(0x=%lx)\n", ulInfo)); - } - else - Status = -EFAULT; - break; - case RT_OID_802_11_SNR_1: - if ((pAd->Antenna.field.RxPath > 1) && - (pAd->StaCfg.LastSNR1 > 0)) - { - ulInfo = ((0xeb - pAd->StaCfg.LastSNR1) * 3) / 16 ; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE,("Query::RT_OID_802_11_SNR_1(0x=%lx)\n",ulInfo)); - } - else - Status = -EFAULT; - DBGPRINT(RT_DEBUG_TRACE,("Query::RT_OID_802_11_SNR_1(pAd->StaCfg.LastSNR1=%d)\n",pAd->StaCfg.LastSNR1)); - break; - case OID_802_11_RSSI_TRIGGER: - ulInfo = pAd->StaCfg.RssiSample.LastRssi0 - pAd->BbpRssiToDbmDelta; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_RSSI_TRIGGER(=%ld)\n", ulInfo)); - break; - case OID_802_11_RSSI: - case RT_OID_802_11_RSSI: - ulInfo = pAd->StaCfg.RssiSample.LastRssi0; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - break; - case RT_OID_802_11_RSSI_1: - ulInfo = pAd->StaCfg.RssiSample.LastRssi1; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - break; - case RT_OID_802_11_RSSI_2: - ulInfo = pAd->StaCfg.RssiSample.LastRssi2; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - break; - case OID_802_11_STATISTICS: - pStatistics = (NDIS_802_11_STATISTICS *) kmalloc(sizeof(NDIS_802_11_STATISTICS), MEM_ALLOC_FLAG); - if (pStatistics) - { - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_STATISTICS \n")); - // add the most up-to-date h/w raw counters into software counters - NICUpdateRawCounters(pAd); - - // Sanity check for calculation of sucessful count - if (pAd->WlanCounters.TransmittedFragmentCount.QuadPart < pAd->WlanCounters.RetryCount.QuadPart) - pAd->WlanCounters.TransmittedFragmentCount.QuadPart = pAd->WlanCounters.RetryCount.QuadPart; - - pStatistics->TransmittedFragmentCount.QuadPart = pAd->WlanCounters.TransmittedFragmentCount.QuadPart; - pStatistics->MulticastTransmittedFrameCount.QuadPart = pAd->WlanCounters.MulticastTransmittedFrameCount.QuadPart; - pStatistics->FailedCount.QuadPart = pAd->WlanCounters.FailedCount.QuadPart; - pStatistics->RetryCount.QuadPart = pAd->WlanCounters.RetryCount.QuadPart; - pStatistics->MultipleRetryCount.QuadPart = pAd->WlanCounters.MultipleRetryCount.QuadPart; - pStatistics->RTSSuccessCount.QuadPart = pAd->WlanCounters.RTSSuccessCount.QuadPart; - pStatistics->RTSFailureCount.QuadPart = pAd->WlanCounters.RTSFailureCount.QuadPart; - pStatistics->ACKFailureCount.QuadPart = pAd->WlanCounters.ACKFailureCount.QuadPart; - pStatistics->FrameDuplicateCount.QuadPart = pAd->WlanCounters.FrameDuplicateCount.QuadPart; - pStatistics->ReceivedFragmentCount.QuadPart = pAd->WlanCounters.ReceivedFragmentCount.QuadPart; - pStatistics->MulticastReceivedFrameCount.QuadPart = pAd->WlanCounters.MulticastReceivedFrameCount.QuadPart; -#ifdef DBG - pStatistics->FCSErrorCount = pAd->RalinkCounters.RealFcsErrCount; -#else - pStatistics->FCSErrorCount.QuadPart = pAd->WlanCounters.FCSErrorCount.QuadPart; - pStatistics->FrameDuplicateCount.u.LowPart = pAd->WlanCounters.FrameDuplicateCount.u.LowPart / 100; -#endif - wrq->u.data.length = sizeof(NDIS_802_11_STATISTICS); - Status = copy_to_user(wrq->u.data.pointer, pStatistics, wrq->u.data.length); - kfree(pStatistics); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_STATISTICS(kmalloc failed)\n")); - Status = -EFAULT; - } - break; - case OID_GEN_RCV_OK: - ulInfo = pAd->Counters8023.GoodReceives; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - break; - case OID_GEN_RCV_NO_BUFFER: - ulInfo = pAd->Counters8023.RxNoBuffer; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - break; - case RT_OID_802_11_PHY_MODE: - ulInfo = (ULONG)pAd->CommonCfg.PhyMode; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_PHY_MODE (=%ld)\n", ulInfo)); - break; - case RT_OID_802_11_STA_CONFIG: - pStaConfig = (RT_802_11_STA_CONFIG *) kmalloc(sizeof(RT_802_11_STA_CONFIG), MEM_ALLOC_FLAG); - if (pStaConfig) - { - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_STA_CONFIG\n")); - pStaConfig->EnableTxBurst = pAd->CommonCfg.bEnableTxBurst; - pStaConfig->EnableTurboRate = 0; - pStaConfig->UseBGProtection = pAd->CommonCfg.UseBGProtection; - pStaConfig->UseShortSlotTime = pAd->CommonCfg.bUseShortSlotTime; - //pStaConfig->AdhocMode = pAd->StaCfg.AdhocMode; - pStaConfig->HwRadioStatus = (pAd->StaCfg.bHwRadio == TRUE) ? 1 : 0; - pStaConfig->Rsv1 = 0; - pStaConfig->SystemErrorBitmap = pAd->SystemErrorBitmap; - wrq->u.data.length = sizeof(RT_802_11_STA_CONFIG); - Status = copy_to_user(wrq->u.data.pointer, pStaConfig, wrq->u.data.length); - kfree(pStaConfig); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_STA_CONFIG(kmalloc failed)\n")); - Status = -EFAULT; - } - break; - case OID_802_11_RTS_THRESHOLD: - RtsThresh = pAd->CommonCfg.RtsThreshold; - wrq->u.data.length = sizeof(RtsThresh); - Status = copy_to_user(wrq->u.data.pointer, &RtsThresh, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_RTS_THRESHOLD(=%ld)\n", RtsThresh)); - break; - case OID_802_11_FRAGMENTATION_THRESHOLD: - FragThresh = pAd->CommonCfg.FragmentThreshold; - if (pAd->CommonCfg.bUseZeroToDisableFragment == TRUE) - FragThresh = 0; - wrq->u.data.length = sizeof(FragThresh); - Status = copy_to_user(wrq->u.data.pointer, &FragThresh, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_FRAGMENTATION_THRESHOLD(=%ld)\n", FragThresh)); - break; - case OID_802_11_POWER_MODE: - PowerMode = pAd->StaCfg.WindowsPowerMode; - wrq->u.data.length = sizeof(PowerMode); - Status = copy_to_user(wrq->u.data.pointer, &PowerMode, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_POWER_MODE(=%d)\n", PowerMode)); - break; - case RT_OID_802_11_RADIO: - RadioState = (BOOLEAN) pAd->StaCfg.bSwRadio; - wrq->u.data.length = sizeof(RadioState); - Status = copy_to_user(wrq->u.data.pointer, &RadioState, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_RADIO (=%d)\n", RadioState)); - break; - case OID_802_11_INFRASTRUCTURE_MODE: - if (pAd->StaCfg.BssType == BSS_ADHOC) - BssType = Ndis802_11IBSS; - else if (pAd->StaCfg.BssType == BSS_INFRA) - BssType = Ndis802_11Infrastructure; - else if (pAd->StaCfg.BssType == BSS_MONITOR) - BssType = Ndis802_11Monitor; - else - BssType = Ndis802_11AutoUnknown; - - wrq->u.data.length = sizeof(BssType); - Status = copy_to_user(wrq->u.data.pointer, &BssType, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_INFRASTRUCTURE_MODE(=%d)\n", BssType)); - break; - case RT_OID_802_11_PREAMBLE: - PreamType = pAd->CommonCfg.TxPreamble; - wrq->u.data.length = sizeof(PreamType); - Status = copy_to_user(wrq->u.data.pointer, &PreamType, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_PREAMBLE(=%d)\n", PreamType)); - break; - case OID_802_11_AUTHENTICATION_MODE: - AuthMode = pAd->StaCfg.AuthMode; - wrq->u.data.length = sizeof(AuthMode); - Status = copy_to_user(wrq->u.data.pointer, &AuthMode, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_AUTHENTICATION_MODE(=%d)\n", AuthMode)); - break; - case OID_802_11_WEP_STATUS: - WepStatus = pAd->StaCfg.WepStatus; - wrq->u.data.length = sizeof(WepStatus); - Status = copy_to_user(wrq->u.data.pointer, &WepStatus, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_WEP_STATUS(=%d)\n", WepStatus)); - break; - case OID_802_11_TX_POWER_LEVEL: - wrq->u.data.length = sizeof(ULONG); - Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.TxPower, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_TX_POWER_LEVEL %x\n",pAd->CommonCfg.TxPower)); - break; - case RT_OID_802_11_TX_POWER_LEVEL_1: - wrq->u.data.length = sizeof(ULONG); - Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.TxPowerPercentage, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_TX_POWER_LEVEL_1 (=%ld)\n", pAd->CommonCfg.TxPowerPercentage)); - break; - case OID_802_11_NETWORK_TYPES_SUPPORTED: - if ((pAd->RfIcType == RFIC_2850) || (pAd->RfIcType == RFIC_2750) || (pAd->RfIcType == RFIC_3052)) - { - NetworkTypeList[0] = 3; // NumberOfItems = 3 - NetworkTypeList[1] = Ndis802_11DS; // NetworkType[1] = 11b - NetworkTypeList[2] = Ndis802_11OFDM24; // NetworkType[2] = 11g - NetworkTypeList[3] = Ndis802_11OFDM5; // NetworkType[3] = 11a - wrq->u.data.length = 16; - Status = copy_to_user(wrq->u.data.pointer, &NetworkTypeList[0], wrq->u.data.length); - } - else - { - NetworkTypeList[0] = 2; // NumberOfItems = 2 - NetworkTypeList[1] = Ndis802_11DS; // NetworkType[1] = 11b - NetworkTypeList[2] = Ndis802_11OFDM24; // NetworkType[2] = 11g - wrq->u.data.length = 12; - Status = copy_to_user(wrq->u.data.pointer, &NetworkTypeList[0], wrq->u.data.length); - } - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_NETWORK_TYPES_SUPPORTED\n")); - break; - case OID_802_11_NETWORK_TYPE_IN_USE: - wrq->u.data.length = sizeof(ULONG); - if (pAd->CommonCfg.PhyMode == PHY_11A) - ulInfo = Ndis802_11OFDM5; - else if ((pAd->CommonCfg.PhyMode == PHY_11BG_MIXED) || (pAd->CommonCfg.PhyMode == PHY_11G)) - ulInfo = Ndis802_11OFDM24; - else - ulInfo = Ndis802_11DS; - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - break; - case RT_OID_802_11_QUERY_LAST_RX_RATE: - ulInfo = (ULONG)pAd->LastRxRate; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_LAST_RX_RATE (=%ld)\n", ulInfo)); - break; - case RT_OID_802_11_QUERY_LAST_TX_RATE: - //ulInfo = (ULONG)pAd->LastTxRate; - ulInfo = (ULONG)pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word; - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_LAST_TX_RATE (=%lx)\n", ulInfo)); - break; - case RT_OID_802_11_QUERY_EEPROM_VERSION: - wrq->u.data.length = sizeof(ULONG); - Status = copy_to_user(wrq->u.data.pointer, &pAd->EepromVersion, wrq->u.data.length); - break; - case RT_OID_802_11_QUERY_FIRMWARE_VERSION: - wrq->u.data.length = sizeof(ULONG); - Status = copy_to_user(wrq->u.data.pointer, &pAd->FirmwareVersion, wrq->u.data.length); - break; - case RT_OID_802_11_QUERY_NOISE_LEVEL: - wrq->u.data.length = sizeof(UCHAR); - Status = copy_to_user(wrq->u.data.pointer, &pAd->BbpWriteLatch[66], wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_NOISE_LEVEL (=%d)\n", pAd->BbpWriteLatch[66])); - break; - case RT_OID_802_11_EXTRA_INFO: - wrq->u.data.length = sizeof(ULONG); - Status = copy_to_user(wrq->u.data.pointer, &pAd->ExtraInfo, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_EXTRA_INFO (=%ld)\n", pAd->ExtraInfo)); - break; - case RT_OID_WE_VERSION_COMPILED: - wrq->u.data.length = sizeof(UINT); - we_version_compiled = WIRELESS_EXT; - Status = copy_to_user(wrq->u.data.pointer, &we_version_compiled, wrq->u.data.length); - break; - case RT_OID_802_11_QUERY_APSD_SETTING: - apsd = (pAd->CommonCfg.bAPSDCapable | (pAd->CommonCfg.bAPSDAC_BE << 1) | (pAd->CommonCfg.bAPSDAC_BK << 2) - | (pAd->CommonCfg.bAPSDAC_VI << 3) | (pAd->CommonCfg.bAPSDAC_VO << 4) | (pAd->CommonCfg.MaxSPLength << 5)); - - wrq->u.data.length = sizeof(ULONG); - Status = copy_to_user(wrq->u.data.pointer, &apsd, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_APSD_SETTING (=0x%lx,APSDCap=%d,AC_BE=%d,AC_BK=%d,AC_VI=%d,AC_VO=%d,MAXSPLen=%d)\n", - apsd,pAd->CommonCfg.bAPSDCapable,pAd->CommonCfg.bAPSDAC_BE,pAd->CommonCfg.bAPSDAC_BK,pAd->CommonCfg.bAPSDAC_VI,pAd->CommonCfg.bAPSDAC_VO,pAd->CommonCfg.MaxSPLength)); - break; - case RT_OID_802_11_QUERY_APSD_PSM: - wrq->u.data.length = sizeof(ULONG); - Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.bAPSDForcePowerSave, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_APSD_PSM (=%d)\n", pAd->CommonCfg.bAPSDForcePowerSave)); - break; - case RT_OID_802_11_QUERY_WMM: - wrq->u.data.length = sizeof(BOOLEAN); - Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.bWmmCapable, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_WMM (=%d)\n", pAd->CommonCfg.bWmmCapable)); - break; -#ifdef WPA_SUPPLICANT_SUPPORT - case RT_OID_NEW_DRIVER: - { - UCHAR enabled = 1; - wrq->u.data.length = sizeof(UCHAR); - Status = copy_to_user(wrq->u.data.pointer, &enabled, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_NEW_DRIVER (=%d)\n", enabled)); - } - break; - case RT_OID_WPA_SUPPLICANT_SUPPORT: - wrq->u.data.length = sizeof(UCHAR); - Status = copy_to_user(wrq->u.data.pointer, &pAd->StaCfg.WpaSupplicantUP, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_WPA_SUPPLICANT_SUPPORT (=%d)\n", pAd->StaCfg.WpaSupplicantUP)); - break; -#endif // WPA_SUPPLICANT_SUPPORT // - - case RT_OID_DRIVER_DEVICE_NAME: - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_DRIVER_DEVICE_NAME \n")); - wrq->u.data.length = 16; - if (copy_to_user(wrq->u.data.pointer, pAd->StaCfg.dev_name, wrq->u.data.length)) - { - Status = -EFAULT; - } - break; - case RT_OID_802_11_QUERY_HT_PHYMODE: - pHTPhyMode = (OID_SET_HT_PHYMODE *) kmalloc(sizeof(OID_SET_HT_PHYMODE), MEM_ALLOC_FLAG); - if (pHTPhyMode) - { - pHTPhyMode->PhyMode = pAd->CommonCfg.PhyMode; - pHTPhyMode->HtMode = (UCHAR)pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE; - pHTPhyMode->BW = (UCHAR)pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.BW; - pHTPhyMode->MCS= (UCHAR)pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MCS; - pHTPhyMode->SHORTGI= (UCHAR)pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.ShortGI; - pHTPhyMode->STBC= (UCHAR)pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.STBC; - - pHTPhyMode->ExtOffset = ((pAd->CommonCfg.CentralChannel < pAd->CommonCfg.Channel) ? (EXTCHA_BELOW) : (EXTCHA_ABOVE)); - wrq->u.data.length = sizeof(OID_SET_HT_PHYMODE); - if (copy_to_user(wrq->u.data.pointer, pHTPhyMode, wrq->u.data.length)) - { - Status = -EFAULT; - } - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_HT_PHYMODE (PhyMode = %d, MCS =%d, BW = %d, STBC = %d, ExtOffset=%d)\n", - pHTPhyMode->HtMode, pHTPhyMode->MCS, pHTPhyMode->BW, pHTPhyMode->STBC, pHTPhyMode->ExtOffset)); - DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateTxRates (.word = %x )\n", pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word)); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_STA_CONFIG(kmalloc failed)\n")); - Status = -EFAULT; - } - break; - case RT_OID_802_11_COUNTRY_REGION: - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_COUNTRY_REGION \n")); - wrq->u.data.length = sizeof(ulInfo); - ulInfo = pAd->CommonCfg.CountryRegionForABand; - ulInfo = (ulInfo << 8)|(pAd->CommonCfg.CountryRegion); - if (copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length)) - { - Status = -EFAULT; - } - break; - case RT_OID_802_11_QUERY_DAT_HT_PHYMODE: - pHTPhyMode = (OID_SET_HT_PHYMODE *) kmalloc(sizeof(OID_SET_HT_PHYMODE), MEM_ALLOC_FLAG); - if (pHTPhyMode) - { - pHTPhyMode->PhyMode = pAd->CommonCfg.PhyMode; - pHTPhyMode->HtMode = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.HTMODE; - pHTPhyMode->BW = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.BW; - pHTPhyMode->MCS= (UCHAR)pAd->StaCfg.DesiredTransmitSetting.field.MCS; - pHTPhyMode->SHORTGI= (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.ShortGI; - pHTPhyMode->STBC= (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.STBC; - - wrq->u.data.length = sizeof(OID_SET_HT_PHYMODE); - if (copy_to_user(wrq->u.data.pointer, pHTPhyMode, wrq->u.data.length)) - { - Status = -EFAULT; - } - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_HT_PHYMODE (PhyMode = %d, MCS =%d, BW = %d, STBC = %d, ExtOffset=%d)\n", - pHTPhyMode->HtMode, pHTPhyMode->MCS, pHTPhyMode->BW, pHTPhyMode->STBC, pHTPhyMode->ExtOffset)); - DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateTxRates (.word = %x )\n", pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word)); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_STA_CONFIG(kmalloc failed)\n")); - Status = -EFAULT; - } - break; - case RT_OID_QUERY_MULTIPLE_CARD_SUPPORT: - wrq->u.data.length = sizeof(UCHAR); - i = 0; -#ifdef MULTIPLE_CARD_SUPPORT - i = 1; -#endif // MULTIPLE_CARD_SUPPORT // - if (copy_to_user(wrq->u.data.pointer, &i, wrq->u.data.length)) - { - Status = -EFAULT; - } - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_QUERY_MULTIPLE_CARD_SUPPORT(=%d) \n", i)); - break; -#ifdef SNMP_SUPPORT - case RT_OID_802_11_MAC_ADDRESS: - wrq->u.data.length = MAC_ADDR_LEN; - Status = copy_to_user(wrq->u.data.pointer, &pAd->CurrentAddress, wrq->u.data.length); - break; - - case RT_OID_802_11_MANUFACTUREROUI: - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_MANUFACTUREROUI \n")); - wrq->u.data.length = ManufacturerOUI_LEN; - Status = copy_to_user(wrq->u.data.pointer, &pAd->CurrentAddress, wrq->u.data.length); - break; - - case RT_OID_802_11_MANUFACTURERNAME: - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_MANUFACTURERNAME \n")); - wrq->u.data.length = strlen(ManufacturerNAME); - Status = copy_to_user(wrq->u.data.pointer, ManufacturerNAME, wrq->u.data.length); - break; - - case RT_OID_802_11_RESOURCETYPEIDNAME: - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_RESOURCETYPEIDNAME \n")); - wrq->u.data.length = strlen(ResourceTypeIdName); - Status = copy_to_user(wrq->u.data.pointer, ResourceTypeIdName, wrq->u.data.length); - break; - - case RT_OID_802_11_PRIVACYOPTIONIMPLEMENTED: - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_PRIVACYOPTIONIMPLEMENTED \n")); - ulInfo = 1; // 1 is support wep else 2 is not support. - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - break; - - case RT_OID_802_11_POWERMANAGEMENTMODE: - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_POWERMANAGEMENTMODE \n")); - if (pAd->StaCfg.Psm == PSMP_ACTION) - ulInfo = 1; // 1 is power active else 2 is power save. - else - ulInfo = 2; - - wrq->u.data.length = sizeof(ulInfo); - Status = copy_to_user(wrq->u.data.pointer, &ulInfo, wrq->u.data.length); - break; - - case OID_802_11_WEPDEFAULTKEYVALUE: - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_WEPDEFAULTKEYVALUE \n")); - //KeyIdxValue.KeyIdx = pAd->PortCfg.MBSSID[pAd->IoctlIF].DefaultKeyId; - pKeyIdxValue = wrq->u.data.pointer; - DBGPRINT(RT_DEBUG_TRACE,("KeyIdxValue.KeyIdx = %d, \n",pKeyIdxValue->KeyIdx)); - valueLen = pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].KeyLen; - NdisMoveMemory(pKeyIdxValue->Value, - &pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].Key, - valueLen); - pKeyIdxValue->Value[valueLen]='\0'; - - wrq->u.data.length = sizeof(DefaultKeyIdxValue); - - Status = copy_to_user(wrq->u.data.pointer, pKeyIdxValue, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE,("DefaultKeyId = %d, total len = %d, str len=%d, KeyValue= %02x %02x %02x %02x \n", - pAd->StaCfg.DefaultKeyId, - wrq->u.data.length, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].KeyLen, - pAd->SharedKey[BSS0][0].Key[0], - pAd->SharedKey[BSS0][1].Key[0], - pAd->SharedKey[BSS0][2].Key[0], - pAd->SharedKey[BSS0][3].Key[0])); - break; - - case OID_802_11_WEPDEFAULTKEYID: - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_WEPDEFAULTKEYID \n")); - wrq->u.data.length = sizeof(UCHAR); - Status = copy_to_user(wrq->u.data.pointer, &pAd->StaCfg.DefaultKeyId, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("DefaultKeyId =%d \n", pAd->StaCfg.DefaultKeyId)); - break; - - case RT_OID_802_11_WEPKEYMAPPINGLENGTH: - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_WEPKEYMAPPINGLENGTH \n")); - wrq->u.data.length = sizeof(UCHAR); - Status = copy_to_user(wrq->u.data.pointer, - &pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].KeyLen, - wrq->u.data.length); - break; - - case OID_802_11_SHORTRETRYLIMIT: - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_SHORTRETRYLIMIT \n")); - wrq->u.data.length = sizeof(ULONG); - RTMP_IO_READ32(pAd, TX_RTY_CFG, &tx_rty_cfg.word); - ShortRetryLimit = tx_rty_cfg.field.ShortRtyLimit; - DBGPRINT(RT_DEBUG_TRACE, ("ShortRetryLimit =%ld, tx_rty_cfg.field.ShortRetryLimit=%d\n", ShortRetryLimit, tx_rty_cfg.field.ShortRtyLimit)); - Status = copy_to_user(wrq->u.data.pointer, &ShortRetryLimit, wrq->u.data.length); - break; - - case OID_802_11_LONGRETRYLIMIT: - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_LONGRETRYLIMIT \n")); - wrq->u.data.length = sizeof(ULONG); - RTMP_IO_READ32(pAd, TX_RTY_CFG, &tx_rty_cfg.word); - LongRetryLimit = tx_rty_cfg.field.LongRtyLimit; - DBGPRINT(RT_DEBUG_TRACE, ("LongRetryLimit =%ld, tx_rty_cfg.field.LongRtyLimit=%d\n", LongRetryLimit, tx_rty_cfg.field.LongRtyLimit)); - Status = copy_to_user(wrq->u.data.pointer, &LongRetryLimit, wrq->u.data.length); - break; - - case RT_OID_802_11_PRODUCTID: - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_PRODUCTID \n")); - -#ifdef RTMP_MAC_PCI - { - - USHORT device_id; - if (((POS_COOKIE)pAd->OS_Cookie)->pci_dev != NULL) - pci_read_config_word(((POS_COOKIE)pAd->OS_Cookie)->pci_dev, PCI_DEVICE_ID, &device_id); - else - DBGPRINT(RT_DEBUG_TRACE, (" pci_dev = NULL\n")); - sprintf((PSTRING)tmp, "%04x %04x\n", NIC_PCI_VENDOR_ID, device_id); - } -#endif // RTMP_MAC_PCI // - wrq->u.data.length = strlen((PSTRING)tmp); - Status = copy_to_user(wrq->u.data.pointer, tmp, wrq->u.data.length); - break; - - case RT_OID_802_11_MANUFACTUREID: - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_MANUFACTUREID \n")); - wrq->u.data.length = strlen(ManufacturerNAME); - Status = copy_to_user(wrq->u.data.pointer, ManufacturerNAME, wrq->u.data.length); - break; - - case OID_802_11_CURRENTCHANNEL: - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_CURRENTCHANNEL \n")); - wrq->u.data.length = sizeof(UCHAR); - DBGPRINT(RT_DEBUG_TRACE, ("sizeof UCHAR=%d, channel=%d \n", sizeof(UCHAR), pAd->CommonCfg.Channel)); - Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.Channel, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Status=%d\n", Status)); - break; -#endif //SNMP_SUPPORT - - case OID_802_11_BUILD_CHANNEL_EX: - { - UCHAR value; - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_BUILD_CHANNEL_EX \n")); - wrq->u.data.length = sizeof(UCHAR); -#ifdef EXT_BUILD_CHANNEL_LIST - DBGPRINT(RT_DEBUG_TRACE, ("Support EXT_BUILD_CHANNEL_LIST.\n")); - value = 1; -#else - DBGPRINT(RT_DEBUG_TRACE, ("Doesn't support EXT_BUILD_CHANNEL_LIST.\n")); - value = 0; -#endif // EXT_BUILD_CHANNEL_LIST // - Status = copy_to_user(wrq->u.data.pointer, &value, 1); - DBGPRINT(RT_DEBUG_TRACE, ("Status=%d\n", Status)); - } - break; - - case OID_802_11_GET_CH_LIST: - { - PRT_CHANNEL_LIST_INFO pChListBuf; - - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_GET_CH_LIST \n")); - if (pAd->ChannelListNum == 0) - { - wrq->u.data.length = 0; - break; - } - - pChListBuf = (RT_CHANNEL_LIST_INFO *) kmalloc(sizeof(RT_CHANNEL_LIST_INFO), MEM_ALLOC_FLAG); - if (pChListBuf == NULL) - { - wrq->u.data.length = 0; - break; - } - - pChListBuf->ChannelListNum = pAd->ChannelListNum; - for (i = 0; i < pChListBuf->ChannelListNum; i++) - pChListBuf->ChannelList[i] = pAd->ChannelList[i].Channel; - - wrq->u.data.length = sizeof(RT_CHANNEL_LIST_INFO); - Status = copy_to_user(wrq->u.data.pointer, pChListBuf, sizeof(RT_CHANNEL_LIST_INFO)); - DBGPRINT(RT_DEBUG_TRACE, ("Status=%d\n", Status)); - - if (pChListBuf) - kfree(pChListBuf); - } - break; - - case OID_802_11_GET_COUNTRY_CODE: - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_GET_COUNTRY_CODE \n")); - wrq->u.data.length = 2; - Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.CountryCode, 2); - DBGPRINT(RT_DEBUG_TRACE, ("Status=%d\n", Status)); - break; - - case OID_802_11_GET_CHANNEL_GEOGRAPHY: - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_GET_CHANNEL_GEOGRAPHY \n")); - wrq->u.data.length = 1; - Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.Geography, 1); - DBGPRINT(RT_DEBUG_TRACE, ("Status=%d\n", Status)); - break; - - -#ifdef QOS_DLS_SUPPORT - case RT_OID_802_11_QUERY_DLS: - wrq->u.data.length = sizeof(BOOLEAN); - Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.bDLSCapable, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_DLS(=%d)\n", pAd->CommonCfg.bDLSCapable)); - break; - - case RT_OID_802_11_QUERY_DLS_PARAM: - { - PRT_802_11_DLS_INFO pDlsInfo = kmalloc(sizeof(RT_802_11_DLS_INFO), GFP_ATOMIC); - if (pDlsInfo == NULL) - break; - - for (i=0; iEntry[i], &pAd->StaCfg.DLSEntry[i], sizeof(RT_802_11_DLS_UI)); - } - - pDlsInfo->num = MAX_NUM_OF_DLS_ENTRY; - wrq->u.data.length = sizeof(RT_802_11_DLS_INFO); - Status = copy_to_user(wrq->u.data.pointer, pDlsInfo, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::RT_OID_802_11_QUERY_DLS_PARAM\n")); - - if (pDlsInfo) - kfree(pDlsInfo); - } - break; -#endif // QOS_DLS_SUPPORT // - - case OID_802_11_SET_PSPXLINK_MODE: - wrq->u.data.length = sizeof(BOOLEAN); - Status = copy_to_user(wrq->u.data.pointer, &pAd->CommonCfg.PSPXlink, wrq->u.data.length); - DBGPRINT(RT_DEBUG_TRACE, ("Query::OID_802_11_SET_PSPXLINK_MODE(=%d)\n", pAd->CommonCfg.PSPXlink)); - break; - - - default: - DBGPRINT(RT_DEBUG_TRACE, ("Query::unknown IOCTL's subcmd = 0x%08x\n", cmd)); - Status = -EOPNOTSUPP; - break; - } - return Status; -} - INT rt28xx_sta_ioctl( IN struct net_device *net_dev, IN OUT struct ifreq *rq, @@ -5402,8 +3129,6 @@ INT rt28xx_sta_ioctl( struct iwreq *wrq = (struct iwreq *) rq; BOOLEAN StateMachineTouched = FALSE; INT Status = NDIS_STATUS_SUCCESS; - USHORT subcmd; - pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev); if (pAd == NULL) @@ -5576,15 +3301,9 @@ INT rt28xx_sta_ioctl( case SIOCGIWRANGE: //Get range of parameters case SIOCGIWRETRY: //get retry limits and lifetime case SIOCSIWRETRY: //set retry limits and lifetime - Status = -EOPNOTSUPP; - break; case RT_PRIV_IOCTL: - case RT_PRIV_IOCTL_EXT: - subcmd = wrq->u.data.flags; - if( subcmd & OID_GET_SET_TOGGLE) - Status = RTMPSetInformation(pAd, rq, subcmd); - else - Status = RTMPQueryInformation(pAd, rq, subcmd); + case RT_PRIV_IOCTL_EXT: + Status = -EOPNOTSUPP; break; case SIOCGIWPRIV: if (wrq->u.data.pointer) -- GitLab From ca97b8388838ee9ea4b4bad04948f8f7f8a607a3 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Tue, 22 Sep 2009 20:44:07 +0200 Subject: [PATCH 005/235] Staging: rt28x0: updates from vendor's V2.1.0.0 drivers Port changes from: * 2009_0420_RT2860_Linux_STA_V2.1.0.0 * 2009_0302_RT2870_Linux_STA_v2.1.0.0 * 2009_0525_RT3070_Linux_STA_v2.1.1.0 to in-kernel drivers. From the RT2860 driver release note: [2.1.0.0] 1. New generation schema for multiple OS porting 2. Fixed Ad-hoc ping failed in noisy environment. (Probe Response has too many retry packet then cause "not enough space in MgmtRing") 3. Fixed WPA(2)PSK issue when group cipher of AP is WEP40 or WEP104. 4. Modified iwpriv ra0 get_site_survey: In scan list result: Security shows "NONE" when AP is OPEN/NONE, shows "WEP" when AP is OPEN/WEP or SHARED/WEP, shows "WPAPSK(WPA2PSK)/TKIP(AES)" when AP is WPAPSK(WPA2PSK)/TKIP(AES) shows "WPA(WPA2)/TKIP(AES)" when AP is WPA(WPA2)/TKIP(AES) 5. Support kthread. 6. Add New A band channel list region 15 contains the whole channels in the A band region 4 and the new CE channel 167,169,171,173 7. Add New IEEE802.11r functionality. 8. Fixed WPA2-Enterprise failed when AP reboot or turn off then turn on. 9. Fixed STA cannot connect to 11B only AP when the setting of is PHY_11GN. From the RT2870 driver release note: [V2.1.0.0] 1. New generation schema for multiple OS porting. 2. Fixed Ad-hoc ping failed in noisy environment. (Probe Response has too many retry packet then cause "not enough space in MgmtRing"). 3. Fixed WPS failed with D-Link DIR-628 in 5GHz. 4. Change FastRoaming in DAT file to AutoRoaming. 5. Support kthread. 6. Add New A band channel list region 15 contains the whole channels in the A band region and the new CE channel 167,169,171,173. 7. New IEEE802.11r functionality. From the RT3070 driver release note: Version V2.1.1.0 1. Linux kernel 2.6.29 support. 2. Fix eFuse write from BIN file bug. Version 2.1.0.0 1. New generation schema for multiple OS porting 2. Fixed Ad-hoc ping failed in noisy environment. 3. Modified iwpriv ra0 get_site_survey: 4. Change FastRoaming in DAT file to AutoRoaming. 5. Support kthread. 6. New IEEE802.11r functionality. Tested with RT2860 and RT3070 chipsets. Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/2860_main_dev.c | 1319 --- drivers/staging/rt2860/Makefile | 26 +- drivers/staging/rt2860/aironet.h | 210 - drivers/staging/rt2860/ap.h | 12 +- drivers/staging/rt2860/chip/mac_pci.h | 365 + drivers/staging/rt2860/chip/mac_usb.h | 365 + drivers/staging/rt2860/chip/rt2860.h | 56 + drivers/staging/rt2860/chip/rt2870.h | 47 + drivers/staging/rt2860/chip/rt3070.h | 68 + drivers/staging/rt2860/chip/rt30xx.h | 48 + .../rt2860/{rt28xx.h => chip/rtmp_mac.h} | 952 +- drivers/staging/rt2860/chip/rtmp_phy.h | 405 + drivers/staging/rt2860/chips/rt3070.c | 185 + drivers/staging/rt2860/chips/rt30xx.c | 525 + drivers/staging/rt2860/chlist.h | 1223 +- .../staging/rt2860/common/2860_rtmp_init.c | 897 -- drivers/staging/rt2860/common/action.c | 12 +- drivers/staging/rt2860/common/ba_action.c | 147 +- .../rt2860/common/{md5.c => cmm_aes.c} | 1327 ++- drivers/staging/rt2860/common/cmm_asic.c | 2531 +++++ drivers/staging/rt2860/common/cmm_cfg.c | 290 + drivers/staging/rt2860/common/cmm_data.c | 906 +- drivers/staging/rt2860/common/cmm_data_pci.c | 1153 ++ .../common/cmm_data_usb.c} | 256 +- drivers/staging/rt2860/common/cmm_info.c | 820 +- drivers/staging/rt2860/common/cmm_mac_pci.c | 1504 +++ drivers/staging/rt2860/common/cmm_mac_usb.c | 1216 ++ drivers/staging/rt2860/common/cmm_profile.c | 1736 +++ drivers/staging/rt2860/common/cmm_sanity.c | 233 +- drivers/staging/rt2860/common/cmm_sync.c | 70 +- .../rt2860/common/{rtmp_tkip.c => cmm_tkip.c} | 720 +- .../rt2860/common/{rtmp_wep.c => cmm_wep.c} | 22 +- drivers/staging/rt2860/common/cmm_wpa.c | 3346 +++++- drivers/staging/rt2860/common/crypt_hmac.c | 194 + drivers/staging/rt2860/common/crypt_md5.c | 352 + drivers/staging/rt2860/common/crypt_sha2.c | 535 + drivers/staging/rt2860/common/dfs.c | 66 +- drivers/staging/rt2860/common/ee_efuse.c | 1525 +++ drivers/staging/rt2860/common/ee_prom.c | 270 + drivers/staging/rt2860/common/eeprom.c | 1460 +-- drivers/staging/rt2860/common/firmware.h | 2 +- drivers/staging/rt2860/common/firmware_3070.h | 517 + drivers/staging/rt2860/common/mlme.c | 9868 ++++++----------- drivers/staging/rt2860/common/rt_channel.c | 1280 +++ drivers/staging/rt2860/common/rt_rf.c | 194 + drivers/staging/rt2860/common/rtmp_init.c | 1963 ++-- drivers/staging/rt2860/common/rtmp_mcu.c | 233 + drivers/staging/rt2860/common/rtmp_timer.c | 323 + drivers/staging/rt2860/common/spectrum.c | 460 +- drivers/staging/rt2860/config.mk | 241 - drivers/staging/rt2860/crypt_hmac.h | 82 + drivers/staging/rt2860/crypt_md5.h | 80 + drivers/staging/rt2860/crypt_sha2.h | 109 + drivers/staging/rt2860/dfs.h | 32 +- drivers/staging/rt2860/eeprom.h | 93 + drivers/staging/rt2860/iface/rtmp_pci.h | 83 + drivers/staging/rt2860/iface/rtmp_usb.h | 200 + drivers/staging/rt2860/md5.h | 107 - drivers/staging/rt2860/mlme.h | 89 +- drivers/staging/rt2860/oid.h | 135 +- drivers/staging/rt2860/pci_main_dev.c | 873 ++ drivers/staging/rt2860/rt2860.h | 333 - drivers/staging/rt2860/rt_config.h | 32 +- drivers/staging/rt2860/rt_linux.c | 615 +- drivers/staging/rt2860/rt_linux.h | 972 +- drivers/staging/rt2860/rt_main_dev.c | 750 +- drivers/staging/rt2860/rt_pci_rbus.c | 877 ++ drivers/staging/rt2860/rt_profile.c | 1839 +-- drivers/staging/rt2860/rt_usb.c | 828 ++ drivers/staging/rt2860/rtmp.h | 2894 ++--- drivers/staging/rt2860/rtmp_chip.h | 265 + drivers/staging/rt2860/rtmp_def.h | 289 +- drivers/staging/rt2860/rtmp_dot11.h | 102 + drivers/staging/rt2860/rtmp_iface.h | 84 + drivers/staging/rt2860/rtmp_mcu.h | 55 + drivers/staging/rt2860/rtmp_os.h | 98 + drivers/staging/rt2860/rtmp_timer.h | 156 + drivers/staging/rt2860/rtmp_type.h | 55 +- drivers/staging/rt2860/rtusb_io.h | 189 + drivers/staging/rt2860/spectrum.h | 169 +- drivers/staging/rt2860/spectrum_def.h | 148 +- drivers/staging/rt2860/sta/aironet.c | 1312 --- drivers/staging/rt2860/sta/assoc.c | 327 +- drivers/staging/rt2860/sta/auth.c | 138 +- drivers/staging/rt2860/sta/auth_rsp.c | 16 +- drivers/staging/rt2860/sta/connect.c | 637 +- drivers/staging/rt2860/sta/rtmp_data.c | 257 +- drivers/staging/rt2860/sta/sanity.c | 44 +- drivers/staging/rt2860/sta/sync.c | 398 +- drivers/staging/rt2860/sta/wpa.c | 1994 +--- drivers/staging/rt2860/sta_ioctl.c | 761 +- drivers/staging/rt2860/usb_main_dev.c | 897 ++ drivers/staging/rt2860/wpa.h | 104 +- drivers/staging/rt2870/2870_main_dev.c | 1530 --- drivers/staging/rt2870/Makefile | 32 +- drivers/staging/rt2870/chips/rt3070.c | 1 + drivers/staging/rt2870/chips/rt30xx.c | 1 + .../staging/rt2870/common/2870_rtmp_init.c | 1730 --- drivers/staging/rt2870/common/acction.c | 1 + drivers/staging/rt2870/common/cmm_aes.c | 1 + drivers/staging/rt2870/common/cmm_asic.c | 1 + drivers/staging/rt2870/common/cmm_cfg.c | 1 + drivers/staging/rt2870/common/cmm_data_usb.c | 1 + drivers/staging/rt2870/common/cmm_mac_usb.c | 1 + drivers/staging/rt2870/common/cmm_profile.c | 1 + drivers/staging/rt2870/common/cmm_tkip.c | 1 + drivers/staging/rt2870/common/cmm_wep.c | 1 + drivers/staging/rt2870/common/crypt_hmac.c | 1 + drivers/staging/rt2870/common/crypt_md5.c | 1 + drivers/staging/rt2870/common/crypt_sha2.c | 1 + drivers/staging/rt2870/common/ee_efuse.c | 1 + drivers/staging/rt2870/common/rt_channel.c | 1 + drivers/staging/rt2870/common/rt_rf.c | 1 + drivers/staging/rt2870/common/rtmp_mcu.c | 1 + drivers/staging/rt2870/common/rtmp_timer.c | 1 + drivers/staging/rt2870/common/rtusb_bulk.c | 37 +- drivers/staging/rt2870/common/rtusb_data.c | 55 + drivers/staging/rt2870/common/rtusb_io.c | 465 +- drivers/staging/rt2870/rt2870.h | 583 - drivers/staging/rt2870/rt_usb.c | 1 + drivers/staging/rt2870/usb_main_dev.c | 1 + drivers/staging/rt3070/firmware.h | 2 +- 122 files changed, 35729 insertions(+), 30719 deletions(-) delete mode 100644 drivers/staging/rt2860/2860_main_dev.c delete mode 100644 drivers/staging/rt2860/aironet.h create mode 100644 drivers/staging/rt2860/chip/mac_pci.h create mode 100644 drivers/staging/rt2860/chip/mac_usb.h create mode 100644 drivers/staging/rt2860/chip/rt2860.h create mode 100644 drivers/staging/rt2860/chip/rt2870.h create mode 100644 drivers/staging/rt2860/chip/rt3070.h create mode 100644 drivers/staging/rt2860/chip/rt30xx.h rename drivers/staging/rt2860/{rt28xx.h => chip/rtmp_mac.h} (70%) create mode 100644 drivers/staging/rt2860/chip/rtmp_phy.h create mode 100644 drivers/staging/rt2860/chips/rt3070.c create mode 100644 drivers/staging/rt2860/chips/rt30xx.c delete mode 100644 drivers/staging/rt2860/common/2860_rtmp_init.c rename drivers/staging/rt2860/common/{md5.c => cmm_aes.c} (53%) create mode 100644 drivers/staging/rt2860/common/cmm_asic.c create mode 100644 drivers/staging/rt2860/common/cmm_cfg.c create mode 100644 drivers/staging/rt2860/common/cmm_data_pci.c rename drivers/staging/{rt2870/common/cmm_data_2870.c => rt2860/common/cmm_data_usb.c} (85%) create mode 100644 drivers/staging/rt2860/common/cmm_mac_pci.c create mode 100644 drivers/staging/rt2860/common/cmm_mac_usb.c create mode 100644 drivers/staging/rt2860/common/cmm_profile.c rename drivers/staging/rt2860/common/{rtmp_tkip.c => cmm_tkip.c} (56%) rename drivers/staging/rt2860/common/{rtmp_wep.c => cmm_wep.c} (97%) create mode 100644 drivers/staging/rt2860/common/crypt_hmac.c create mode 100644 drivers/staging/rt2860/common/crypt_md5.c create mode 100644 drivers/staging/rt2860/common/crypt_sha2.c create mode 100644 drivers/staging/rt2860/common/ee_efuse.c create mode 100644 drivers/staging/rt2860/common/ee_prom.c create mode 100644 drivers/staging/rt2860/common/firmware_3070.h create mode 100644 drivers/staging/rt2860/common/rt_channel.c create mode 100644 drivers/staging/rt2860/common/rt_rf.c create mode 100644 drivers/staging/rt2860/common/rtmp_mcu.c create mode 100644 drivers/staging/rt2860/common/rtmp_timer.c delete mode 100644 drivers/staging/rt2860/config.mk create mode 100644 drivers/staging/rt2860/crypt_hmac.h create mode 100644 drivers/staging/rt2860/crypt_md5.h create mode 100644 drivers/staging/rt2860/crypt_sha2.h create mode 100644 drivers/staging/rt2860/eeprom.h create mode 100644 drivers/staging/rt2860/iface/rtmp_pci.h create mode 100644 drivers/staging/rt2860/iface/rtmp_usb.h delete mode 100644 drivers/staging/rt2860/md5.h create mode 100644 drivers/staging/rt2860/pci_main_dev.c delete mode 100644 drivers/staging/rt2860/rt2860.h create mode 100644 drivers/staging/rt2860/rt_pci_rbus.c create mode 100644 drivers/staging/rt2860/rt_usb.c create mode 100644 drivers/staging/rt2860/rtmp_chip.h create mode 100644 drivers/staging/rt2860/rtmp_dot11.h create mode 100644 drivers/staging/rt2860/rtmp_iface.h create mode 100644 drivers/staging/rt2860/rtmp_mcu.h create mode 100644 drivers/staging/rt2860/rtmp_os.h create mode 100644 drivers/staging/rt2860/rtmp_timer.h create mode 100644 drivers/staging/rt2860/rtusb_io.h delete mode 100644 drivers/staging/rt2860/sta/aironet.c create mode 100644 drivers/staging/rt2860/usb_main_dev.c delete mode 100644 drivers/staging/rt2870/2870_main_dev.c create mode 100644 drivers/staging/rt2870/chips/rt3070.c create mode 100644 drivers/staging/rt2870/chips/rt30xx.c delete mode 100644 drivers/staging/rt2870/common/2870_rtmp_init.c create mode 100644 drivers/staging/rt2870/common/acction.c create mode 100644 drivers/staging/rt2870/common/cmm_aes.c create mode 100644 drivers/staging/rt2870/common/cmm_asic.c create mode 100644 drivers/staging/rt2870/common/cmm_cfg.c create mode 100644 drivers/staging/rt2870/common/cmm_data_usb.c create mode 100644 drivers/staging/rt2870/common/cmm_mac_usb.c create mode 100644 drivers/staging/rt2870/common/cmm_profile.c create mode 100644 drivers/staging/rt2870/common/cmm_tkip.c create mode 100644 drivers/staging/rt2870/common/cmm_wep.c create mode 100644 drivers/staging/rt2870/common/crypt_hmac.c create mode 100644 drivers/staging/rt2870/common/crypt_md5.c create mode 100644 drivers/staging/rt2870/common/crypt_sha2.c create mode 100644 drivers/staging/rt2870/common/ee_efuse.c create mode 100644 drivers/staging/rt2870/common/rt_channel.c create mode 100644 drivers/staging/rt2870/common/rt_rf.c create mode 100644 drivers/staging/rt2870/common/rtmp_mcu.c create mode 100644 drivers/staging/rt2870/common/rtmp_timer.c delete mode 100644 drivers/staging/rt2870/rt2870.h create mode 100644 drivers/staging/rt2870/rt_usb.c create mode 100644 drivers/staging/rt2870/usb_main_dev.c diff --git a/drivers/staging/rt2860/2860_main_dev.c b/drivers/staging/rt2860/2860_main_dev.c deleted file mode 100644 index c2f02963f91c..000000000000 --- a/drivers/staging/rt2860/2860_main_dev.c +++ /dev/null @@ -1,1319 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - 2870_main_dev.c - - Abstract: - Create and register network interface. - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#include "rt_config.h" - -extern INT __devinit rt28xx_probe(IN void *_dev_p, IN void *_dev_id_p, - IN UINT argc, OUT PRTMP_ADAPTER *ppAd); - -static void rx_done_tasklet(unsigned long data); -static void mgmt_dma_done_tasklet(unsigned long data); -static void ac0_dma_done_tasklet(unsigned long data); -static void ac1_dma_done_tasklet(unsigned long data); -static void ac2_dma_done_tasklet(unsigned long data); -static void ac3_dma_done_tasklet(unsigned long data); -static void hcca_dma_done_tasklet(unsigned long data); -static void fifo_statistic_full_tasklet(unsigned long data); - - -/*---------------------------------------------------------------------*/ -/* Symbol & Macro Definitions */ -/*---------------------------------------------------------------------*/ -#define RT2860_INT_RX_DLY (1<<0) // bit 0 -#define RT2860_INT_TX_DLY (1<<1) // bit 1 -#define RT2860_INT_RX_DONE (1<<2) // bit 2 -#define RT2860_INT_AC0_DMA_DONE (1<<3) // bit 3 -#define RT2860_INT_AC1_DMA_DONE (1<<4) // bit 4 -#define RT2860_INT_AC2_DMA_DONE (1<<5) // bit 5 -#define RT2860_INT_AC3_DMA_DONE (1<<6) // bit 6 -#define RT2860_INT_HCCA_DMA_DONE (1<<7) // bit 7 -#define RT2860_INT_MGMT_DONE (1<<8) // bit 8 - -#define INT_RX RT2860_INT_RX_DONE - -#define INT_AC0_DLY (RT2860_INT_AC0_DMA_DONE) //| RT2860_INT_TX_DLY) -#define INT_AC1_DLY (RT2860_INT_AC1_DMA_DONE) //| RT2860_INT_TX_DLY) -#define INT_AC2_DLY (RT2860_INT_AC2_DMA_DONE) //| RT2860_INT_TX_DLY) -#define INT_AC3_DLY (RT2860_INT_AC3_DMA_DONE) //| RT2860_INT_TX_DLY) -#define INT_HCCA_DLY (RT2860_INT_HCCA_DMA_DONE) //| RT2860_INT_TX_DLY) -#define INT_MGMT_DLY RT2860_INT_MGMT_DONE - -/*---------------------------------------------------------------------*/ -/* Prototypes of Functions Used */ -/*---------------------------------------------------------------------*/ -/* function declarations */ -static INT __devinit rt2860_init_one (struct pci_dev *pci_dev, const struct pci_device_id *ent); -static VOID __devexit rt2860_remove_one(struct pci_dev *pci_dev); -static INT __devinit rt2860_probe(struct pci_dev *pci_dev, const struct pci_device_id *ent); -void init_thread_task(PRTMP_ADAPTER pAd); -static void __exit rt2860_cleanup_module(void); -static int __init rt2860_init_module(void); - -#ifdef CONFIG_PM -static int rt2860_suspend(struct pci_dev *pci_dev, pm_message_t state); -static int rt2860_resume(struct pci_dev *pci_dev); -#endif // CONFIG_PM // - - -// -// Ralink PCI device table, include all supported chipsets -// -static struct pci_device_id rt2860_pci_tbl[] __devinitdata = -{ - {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2860_PCI_DEVICE_ID)}, //RT28602.4G - {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2860_PCIe_DEVICE_ID)}, - {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2760_PCI_DEVICE_ID)}, - {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2790_PCIe_DEVICE_ID)}, - {PCI_DEVICE(VEN_AWT_PCI_VENDOR_ID, VEN_AWT_PCIe_DEVICE_ID)}, - {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7708)}, - {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7728)}, - {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7758)}, - {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7727)}, - {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7738)}, - {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7748)}, - {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7768)}, - {0,} // terminate list -}; - -MODULE_DEVICE_TABLE(pci, rt2860_pci_tbl); -MODULE_LICENSE("GPL"); -#ifdef MODULE_VERSION -MODULE_VERSION(STA_DRIVER_VERSION); -#endif - -// -// Our PCI driver structure -// -static struct pci_driver rt2860_driver = -{ - name: "rt2860", - id_table: rt2860_pci_tbl, - probe: rt2860_init_one, - remove: __devexit_p(rt2860_remove_one), - -#ifdef CONFIG_PM - suspend: rt2860_suspend, - resume: rt2860_resume, -#endif -}; - - -#ifdef CONFIG_PM - -VOID RT2860RejectPendingPackets( - IN PRTMP_ADAPTER pAd) -{ - // clear PS packets - // clear TxSw packets -} - -static int rt2860_suspend( - struct pci_dev *pci_dev, - pm_message_t state) -{ - struct net_device *net_dev = pci_get_drvdata(pci_dev); - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)NULL; - INT32 retval; - - - DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_suspend()\n")); - - if (net_dev == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("net_dev == NULL!\n")); - } - else - { - pAd = net_dev->ml_priv; - - /* we can not use IFF_UP because ra0 down but ra1 up */ - /* and 1 suspend/resume function for 1 module, not for each interface */ - /* so Linux will call suspend/resume function once */ - if (VIRTUAL_IF_NUM(pAd) > 0) - { - // avoid users do suspend after interface is down - - // stop interface - netif_carrier_off(net_dev); - netif_stop_queue(net_dev); - - // mark device as removed from system and therefore no longer available - netif_device_detach(net_dev); - - // mark halt flag - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - - // take down the device - rt28xx_close((PNET_DEV)net_dev); - - RT_MOD_DEC_USE_COUNT(); - } - } - - // reference to http://vovo2000.com/type-lab/linux/kernel-api/linux-kernel-api.html - // enable device to generate PME# when suspended - // pci_choose_state(): Choose the power state of a PCI device to be suspended - retval = pci_enable_wake(pci_dev, pci_choose_state(pci_dev, state), 1); - // save the PCI configuration space of a device before suspending - pci_save_state(pci_dev); - // disable PCI device after use - pci_disable_device(pci_dev); - - retval = pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)); - - DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_suspend()\n")); - return retval; -} - -static int rt2860_resume( - struct pci_dev *pci_dev) -{ - struct net_device *net_dev = pci_get_drvdata(pci_dev); - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)NULL; - INT32 retval; - - - // set the power state of a PCI device - // PCI has 4 power states, DO (normal) ~ D3(less power) - // in include/linux/pci.h, you can find that - // #define PCI_D0 ((pci_power_t __force) 0) - // #define PCI_D1 ((pci_power_t __force) 1) - // #define PCI_D2 ((pci_power_t __force) 2) - // #define PCI_D3hot ((pci_power_t __force) 3) - // #define PCI_D3cold ((pci_power_t __force) 4) - // #define PCI_UNKNOWN ((pci_power_t __force) 5) - // #define PCI_POWER_ERROR ((pci_power_t __force) -1) - retval = pci_set_power_state(pci_dev, PCI_D0); - - // restore the saved state of a PCI device - pci_restore_state(pci_dev); - - // initialize device before it's used by a driver - if (pci_enable_device(pci_dev)) - { - printk("pci enable fail!\n"); - return 0; - } - - DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_resume()\n")); - - if (net_dev == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("net_dev == NULL!\n")); - } - else - pAd = net_dev->ml_priv; - - if (pAd != NULL) - { - /* we can not use IFF_UP because ra0 down but ra1 up */ - /* and 1 suspend/resume function for 1 module, not for each interface */ - /* so Linux will call suspend/resume function once */ - if (VIRTUAL_IF_NUM(pAd) > 0) - { - // mark device as attached from system and restart if needed - netif_device_attach(net_dev); - - if (rt28xx_open((PNET_DEV)net_dev) != 0) - { - // open fail - DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_resume()\n")); - return 0; - } - - // increase MODULE use count - RT_MOD_INC_USE_COUNT(); - - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - - netif_start_queue(net_dev); - netif_carrier_on(net_dev); - netif_wake_queue(net_dev); - } - } - - DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_resume()\n")); - return 0; -} -#endif // CONFIG_PM // - - -static INT __init rt2860_init_module(VOID) -{ - return pci_register_driver(&rt2860_driver); -} - - -// -// Driver module unload function -// -static VOID __exit rt2860_cleanup_module(VOID) -{ - pci_unregister_driver(&rt2860_driver); -} - -module_init(rt2860_init_module); -module_exit(rt2860_cleanup_module); - - -static INT __devinit rt2860_init_one ( - IN struct pci_dev *pci_dev, - IN const struct pci_device_id *ent) -{ - INT rc; - - DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_init_one\n")); - - // wake up and enable device - if (pci_enable_device (pci_dev)) - { - rc = -EIO; - } - else - { - rc = rt2860_probe(pci_dev, ent); - } - - DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_init_one\n")); - return rc; -} - - -static VOID __devexit rt2860_remove_one( - IN struct pci_dev *pci_dev) -{ - struct net_device *net_dev = pci_get_drvdata(pci_dev); - RTMP_ADAPTER *pAd = net_dev->ml_priv; - - DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_remove_one\n")); - - if (pAd != NULL) - { - // Unregister network device - unregister_netdev(net_dev); - - // Unmap CSR base address - iounmap((char *)(net_dev->base_addr)); - - RTMPFreeAdapter(pAd); - - // release memory region - release_mem_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); - } - else - { - // Unregister network device - unregister_netdev(net_dev); - - // Unmap CSR base address - iounmap((char *)(net_dev->base_addr)); - - // release memory region - release_mem_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); - } - - // Free pre-allocated net_device memory - free_netdev(net_dev); -} - -// -// PCI device probe & initialization function -// -static INT __devinit rt2860_probe( - IN struct pci_dev *pci_dev, - IN const struct pci_device_id *ent) -{ - PRTMP_ADAPTER pAd; - INT rv = 0; - - rv = (INT)rt28xx_probe((void *)pci_dev, (void *)ent, 0, &pAd); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE); - return rv; -} - - -void init_thread_task(IN PRTMP_ADAPTER pAd) -{ - POS_COOKIE pObj; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - tasklet_init(&pObj->rx_done_task, rx_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->mgmt_dma_done_task, mgmt_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac0_dma_done_task, ac0_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac1_dma_done_task, ac1_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac2_dma_done_task, ac2_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac3_dma_done_task, ac3_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->hcca_dma_done_task, hcca_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->tbtt_task, tbtt_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->fifo_statistic_full_task, fifo_statistic_full_tasklet, (unsigned long)pAd); -} - -void kill_thread_task(IN PRTMP_ADAPTER pAd) -{ - POS_COOKIE pObj; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - tasklet_kill(&pObj->rx_done_task); - tasklet_kill(&pObj->mgmt_dma_done_task); - tasklet_kill(&pObj->ac0_dma_done_task); - tasklet_kill(&pObj->ac1_dma_done_task); - tasklet_kill(&pObj->ac2_dma_done_task); - tasklet_kill(&pObj->ac3_dma_done_task); - tasklet_kill(&pObj->hcca_dma_done_task); - tasklet_kill(&pObj->tbtt_task); - tasklet_kill(&pObj->fifo_statistic_full_task); -} - - -static void rt2860_int_enable(PRTMP_ADAPTER pAd, unsigned int mode) -{ - u32 regValue; - - pAd->int_disable_mask &= ~(mode); - regValue = pAd->int_enable_reg & ~(pAd->int_disable_mask); - RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); // 1:enable - - if (regValue != 0) - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE); -} - - -static void rt2860_int_disable(PRTMP_ADAPTER pAd, unsigned int mode) -{ - u32 regValue; - - pAd->int_disable_mask |= mode; - regValue = pAd->int_enable_reg & ~(pAd->int_disable_mask); - RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); // 0: disable - - if (regValue == 0) - { - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE); - } -} - -static void mgmt_dma_done_tasklet(unsigned long data) -{ - unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - IntSource.word = 0; - IntSource.field.MgmtDmaDone = 1; - pAd->int_pending &= ~INT_MGMT_DLY; - - RTMPHandleMgmtRingDmaDoneInterrupt(pAd); - - // if you use RTMP_SEM_LOCK, sometimes kernel will hang up, no any - // bug report output - RTMP_INT_LOCK(&pAd->irq_lock, flags); - /* - * double check to avoid lose of interrupts - */ - if (pAd->int_pending & INT_MGMT_DLY) - { - tasklet_hi_schedule(&pObj->mgmt_dma_done_task); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - return; - } - - /* enable TxDataInt again */ - rt2860_int_enable(pAd, INT_MGMT_DLY); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); -} - -static void rx_done_tasklet(unsigned long data) -{ - unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - BOOLEAN bReschedule = 0; - POS_COOKIE pObj; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - pAd->int_pending &= ~(INT_RX); - - bReschedule = STARxDoneInterruptHandle(pAd, 0); - - RTMP_INT_LOCK(&pAd->irq_lock, flags); - /* - * double check to avoid rotting packet - */ - if (pAd->int_pending & INT_RX || bReschedule) - { - tasklet_hi_schedule(&pObj->rx_done_task); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - return; - } - - /* enable RxINT again */ - rt2860_int_enable(pAd, INT_RX); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - -} - -void fifo_statistic_full_tasklet(unsigned long data) -{ - unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - POS_COOKIE pObj; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - pAd->int_pending &= ~(FifoStaFullInt); - NICUpdateFifoStaCounters(pAd); - - RTMP_INT_LOCK(&pAd->irq_lock, flags); - /* - * double check to avoid rotting packet - */ - if (pAd->int_pending & FifoStaFullInt) - { - tasklet_hi_schedule(&pObj->fifo_statistic_full_task); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - return; - } - - /* enable RxINT again */ - - rt2860_int_enable(pAd, FifoStaFullInt); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - -} - -static void hcca_dma_done_tasklet(unsigned long data) -{ - unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - - IntSource.word = 0; - IntSource.field.HccaDmaDone = 1; - pAd->int_pending &= ~INT_HCCA_DLY; - - RTMPHandleTxRingDmaDoneInterrupt(pAd, IntSource); - - RTMP_INT_LOCK(&pAd->irq_lock, flags); - /* - * double check to avoid lose of interrupts - */ - if (pAd->int_pending & INT_HCCA_DLY) - { - tasklet_hi_schedule(&pObj->hcca_dma_done_task); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - return; - } - - /* enable TxDataInt again */ - rt2860_int_enable(pAd, INT_HCCA_DLY); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); -} - -static void ac3_dma_done_tasklet(unsigned long data) -{ - unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; - BOOLEAN bReschedule = 0; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - IntSource.word = 0; - IntSource.field.Ac3DmaDone = 1; - pAd->int_pending &= ~INT_AC3_DLY; - - bReschedule = RTMPHandleTxRingDmaDoneInterrupt(pAd, IntSource); - - RTMP_INT_LOCK(&pAd->irq_lock, flags); - /* - * double check to avoid lose of interrupts - */ - if ((pAd->int_pending & INT_AC3_DLY) || bReschedule) - { - tasklet_hi_schedule(&pObj->ac3_dma_done_task); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - return; - } - - /* enable TxDataInt again */ - rt2860_int_enable(pAd, INT_AC3_DLY); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); -} - -static void ac2_dma_done_tasklet(unsigned long data) -{ - unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; - BOOLEAN bReschedule = 0; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - IntSource.word = 0; - IntSource.field.Ac2DmaDone = 1; - pAd->int_pending &= ~INT_AC2_DLY; - - bReschedule = RTMPHandleTxRingDmaDoneInterrupt(pAd, IntSource); - - RTMP_INT_LOCK(&pAd->irq_lock, flags); - - /* - * double check to avoid lose of interrupts - */ - if ((pAd->int_pending & INT_AC2_DLY) || bReschedule) - { - tasklet_hi_schedule(&pObj->ac2_dma_done_task); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - return; - } - - /* enable TxDataInt again */ - rt2860_int_enable(pAd, INT_AC2_DLY); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); -} - -static void ac1_dma_done_tasklet(unsigned long data) -{ - unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; - BOOLEAN bReschedule = 0; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - IntSource.word = 0; - IntSource.field.Ac1DmaDone = 1; - pAd->int_pending &= ~INT_AC1_DLY; - - bReschedule = RTMPHandleTxRingDmaDoneInterrupt(pAd, IntSource); - - RTMP_INT_LOCK(&pAd->irq_lock, flags); - /* - * double check to avoid lose of interrupts - */ - if ((pAd->int_pending & INT_AC1_DLY) || bReschedule) - { - tasklet_hi_schedule(&pObj->ac1_dma_done_task); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - return; - } - - /* enable TxDataInt again */ - rt2860_int_enable(pAd, INT_AC1_DLY); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); -} - -static void ac0_dma_done_tasklet(unsigned long data) -{ - unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; - BOOLEAN bReschedule = 0; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - IntSource.word = 0; - IntSource.field.Ac0DmaDone = 1; - pAd->int_pending &= ~INT_AC0_DLY; - - bReschedule = RTMPHandleTxRingDmaDoneInterrupt(pAd, IntSource); - - RTMP_INT_LOCK(&pAd->irq_lock, flags); - /* - * double check to avoid lose of interrupts - */ - if ((pAd->int_pending & INT_AC0_DLY) || bReschedule) - { - tasklet_hi_schedule(&pObj->ac0_dma_done_task); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - return; - } - - /* enable TxDataInt again */ - rt2860_int_enable(pAd, INT_AC0_DLY); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); -} - - -int print_int_count; - -IRQ_HANDLE_TYPE -rt2860_interrupt(int irq, void *dev_instance) -{ - struct net_device *net_dev = (struct net_device *) dev_instance; - PRTMP_ADAPTER pAd = net_dev->ml_priv; - INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; - BOOLEAN bOldValue; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - - /* Note 03312008: we can not return here before - RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IntSource.word); - RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, IntSource.word); - Or kernel will panic after ifconfig ra0 down sometimes */ - - - // - // Inital the Interrupt source. - // - IntSource.word = 0x00000000L; -// McuIntSource.word = 0x00000000L; - - // - // Get the interrupt sources & saved to local variable - // - //RTMP_IO_READ32(pAd, where, &McuIntSource.word); - //RTMP_IO_WRITE32(pAd, , McuIntSource.word); - - // - // Flag fOP_STATUS_DOZE On, means ASIC put to sleep, elase means ASICK WakeUp - // And at the same time, clock maybe turned off that say there is no DMA service. - // when ASIC get to sleep. - // To prevent system hang on power saving. - // We need to check it before handle the INT_SOURCE_CSR, ASIC must be wake up. - // - // RT2661 => when ASIC is sleeping, MAC register cannot be read and written. - // RT2860 => when ASIC is sleeping, MAC register can be read and written. - - bOldValue = pAd->bPCIclkOff; - pAd->bPCIclkOff = FALSE; - { - RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IntSource.word); - RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, IntSource.word); // write 1 to clear - } - pAd->bPCIclkOff = bOldValue; - - // Do nothing if Reset in progress - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) - { - return IRQ_HANDLED; - } - - // - // Handle interrupt, walk through all bits - // Should start from highest priority interrupt - // The priority can be adjust by altering processing if statement - // - - // If required spinlock, each interrupt service routine has to acquire - // and release itself. - // - - // Do nothing if NIC doesn't exist - if (IntSource.word == 0xffffffff) - { - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_HALT_IN_PROGRESS); - printk("snowpin - IntSource.word == 0xffffffff\n"); - return IRQ_HANDLED; - } - - if (IntSource.word & TxCoherent) - { - DBGPRINT(RT_DEBUG_ERROR, (">>>TxCoherent<<<\n")); - RTMPHandleRxCoherentInterrupt(pAd); - } - - if (IntSource.word & RxCoherent) - { - DBGPRINT(RT_DEBUG_ERROR, (">>>RxCoherent<<<\n")); - RTMPHandleRxCoherentInterrupt(pAd); - } - - if (IntSource.word & FifoStaFullInt) - { -#if 1 - if ((pAd->int_disable_mask & FifoStaFullInt) == 0) - { - /* mask FifoStaFullInt */ - rt2860_int_disable(pAd, FifoStaFullInt); - tasklet_hi_schedule(&pObj->fifo_statistic_full_task); - } - pAd->int_pending |= FifoStaFullInt; -#else - NICUpdateFifoStaCounters(pAd); -#endif - } - - if (IntSource.word & INT_MGMT_DLY) - { - if ((pAd->int_disable_mask & INT_MGMT_DLY) ==0 ) - { - rt2860_int_disable(pAd, INT_MGMT_DLY); - tasklet_hi_schedule(&pObj->mgmt_dma_done_task); - } - pAd->int_pending |= INT_MGMT_DLY ; - } - - if (IntSource.word & INT_RX) - { - if ((pAd->int_disable_mask & INT_RX) == 0) - { - /* mask RxINT */ - rt2860_int_disable(pAd, INT_RX); - tasklet_hi_schedule(&pObj->rx_done_task); - } - pAd->int_pending |= INT_RX; - } - - if (IntSource.word & INT_HCCA_DLY) - { - - if ((pAd->int_disable_mask & INT_HCCA_DLY) == 0) - { - /* mask TxDataInt */ - rt2860_int_disable(pAd, INT_HCCA_DLY); - tasklet_hi_schedule(&pObj->hcca_dma_done_task); - } - pAd->int_pending |= INT_HCCA_DLY; - } - - if (IntSource.word & INT_AC3_DLY) - { - - if ((pAd->int_disable_mask & INT_AC3_DLY) == 0) - { - /* mask TxDataInt */ - rt2860_int_disable(pAd, INT_AC3_DLY); - tasklet_hi_schedule(&pObj->ac3_dma_done_task); - } - pAd->int_pending |= INT_AC3_DLY; - } - - if (IntSource.word & INT_AC2_DLY) - { - - if ((pAd->int_disable_mask & INT_AC2_DLY) == 0) - { - /* mask TxDataInt */ - rt2860_int_disable(pAd, INT_AC2_DLY); - tasklet_hi_schedule(&pObj->ac2_dma_done_task); - } - pAd->int_pending |= INT_AC2_DLY; - } - - if (IntSource.word & INT_AC1_DLY) - { - - pAd->int_pending |= INT_AC1_DLY; - - if ((pAd->int_disable_mask & INT_AC1_DLY) == 0) - { - /* mask TxDataInt */ - rt2860_int_disable(pAd, INT_AC1_DLY); - tasklet_hi_schedule(&pObj->ac1_dma_done_task); - } - - } - - if (IntSource.word & INT_AC0_DLY) - { - pAd->int_pending |= INT_AC0_DLY; - - if ((pAd->int_disable_mask & INT_AC0_DLY) == 0) - { - /* mask TxDataInt */ - rt2860_int_disable(pAd, INT_AC0_DLY); - tasklet_hi_schedule(&pObj->ac0_dma_done_task); - } - - } - - if (IntSource.word & PreTBTTInt) - { - RTMPHandlePreTBTTInterrupt(pAd); - } - - if (IntSource.word & TBTTInt) - { - RTMPHandleTBTTInterrupt(pAd); - } - - if (IntSource.word & AutoWakeupInt) - RTMPHandleTwakeupInterrupt(pAd); - - return IRQ_HANDLED; -} - -/* -======================================================================== -Routine Description: - Check the chipset vendor/product ID. - -Arguments: - _dev_p Point to the PCI or USB device - -Return Value: - TRUE Check ok - FALSE Check fail - -Note: -======================================================================== -*/ -BOOLEAN RT28XXChipsetCheck( - IN void *_dev_p) -{ - /* always TRUE */ - return TRUE; -} - - -/* -======================================================================== -Routine Description: - Init net device structure. - -Arguments: - _dev_p Point to the PCI or USB device - *net_dev Point to the net device - *pAd the raxx interface data pointer - -Return Value: - TRUE Init ok - FALSE Init fail - -Note: -======================================================================== -*/ -BOOLEAN RT28XXNetDevInit( - IN void *_dev_p, - IN struct net_device *net_dev, - IN RTMP_ADAPTER *pAd) -{ - struct pci_dev *pci_dev = (struct pci_dev *)_dev_p; - const CHAR *print_name; - ULONG csr_addr; - - - print_name = pci_dev ? pci_name(pci_dev) : "rt2860"; - - net_dev->base_addr = 0; - net_dev->irq = 0; - - if (pci_request_regions(pci_dev, print_name)) - goto err_out_free_netdev; - - // interrupt IRQ number - net_dev->irq = pci_dev->irq; - - // map physical address to virtual address for accessing register - csr_addr = (unsigned long) ioremap(pci_resource_start(pci_dev, 0), - pci_resource_len(pci_dev, 0)); - - if (!csr_addr) - { - DBGPRINT(RT_DEBUG_ERROR, - ("ioremap failed for device %s, region 0x%lX @ 0x%lX\n", - print_name, (ULONG)pci_resource_len(pci_dev, 0), - (ULONG)pci_resource_start(pci_dev, 0))); - goto err_out_free_res; - } - - // Save CSR virtual address and irq to device structure - net_dev->base_addr = csr_addr; - pAd->CSRBaseAddress = (PUCHAR)net_dev->base_addr; - - // Set DMA master - pci_set_master(pci_dev); - - net_dev->priv_flags = INT_MAIN; - - DBGPRINT(RT_DEBUG_TRACE, ("%s: at 0x%lx, VA 0x%lx, IRQ %d. \n", - net_dev->name, (ULONG)pci_resource_start(pci_dev, 0), - (ULONG)csr_addr, pci_dev->irq)); - return TRUE; - - - /* --------------------------- ERROR HANDLE --------------------------- */ -err_out_free_res: - pci_release_regions(pci_dev); -err_out_free_netdev: - /* free netdev in caller, not here */ - return FALSE; -} - - -/* -======================================================================== -Routine Description: - Init net device structure. - -Arguments: - _dev_p Point to the PCI or USB device - *pAd the raxx interface data pointer - -Return Value: - TRUE Config ok - FALSE Config fail - -Note: -======================================================================== -*/ -BOOLEAN RT28XXProbePostConfig( - IN void *_dev_p, - IN RTMP_ADAPTER *pAd, - IN INT32 argc) -{ - /* no use */ - return TRUE; -} - - -/* -======================================================================== -Routine Description: - Disable DMA. - -Arguments: - *pAd the raxx interface data pointer - -Return Value: - None - -Note: -======================================================================== -*/ -VOID RT28XXDMADisable( - IN RTMP_ADAPTER *pAd) -{ - WPDMA_GLO_CFG_STRUC GloCfg; - - - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); - GloCfg.word &= 0xff0; - GloCfg.field.EnTXWriteBackDDONE =1; - RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); -} - - -/* -======================================================================== -Routine Description: - Enable DMA. - -Arguments: - *pAd the raxx interface data pointer - -Return Value: - None - -Note: -======================================================================== -*/ -VOID RT28XXDMAEnable( - IN RTMP_ADAPTER *pAd) -{ - WPDMA_GLO_CFG_STRUC GloCfg; - int i = 0; - - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x4); - do - { - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); - if ((GloCfg.field.TxDMABusy == 0) && (GloCfg.field.RxDMABusy == 0)) - break; - - DBGPRINT(RT_DEBUG_TRACE, ("==> DMABusy\n")); - RTMPusecDelay(1000); - i++; - }while ( i <200); - - RTMPusecDelay(50); - - GloCfg.field.EnTXWriteBackDDONE = 1; - GloCfg.field.WPDMABurstSIZE = 2; - GloCfg.field.EnableRxDMA = 1; - GloCfg.field.EnableTxDMA = 1; - - DBGPRINT(RT_DEBUG_TRACE, ("<== WRITE DMA offset 0x208 = 0x%x\n", GloCfg.word)); - RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); - -} - -/* -======================================================================== -Routine Description: - Write Beacon buffer to Asic. - -Arguments: - *pAd the raxx interface data pointer - -Return Value: - None - -Note: -======================================================================== -*/ -VOID RT28xx_UpdateBeaconToAsic( - IN RTMP_ADAPTER *pAd, - IN INT apidx, - IN ULONG FrameLen, - IN ULONG UpdatePos) -{ - ULONG CapInfoPos = 0; - UCHAR *ptr, *ptr_update, *ptr_capinfo; - UINT i; - BOOLEAN bBcnReq = FALSE; - UCHAR bcn_idx = 0; - - { - DBGPRINT(RT_DEBUG_ERROR, ("%s() : No valid Interface be found.\n", __func__)); - return; - } - - if (bBcnReq == FALSE) - { - /* when the ra interface is down, do not send its beacon frame */ - /* clear all zero */ - for(i=0; iBeaconOffset[bcn_idx] + i, 0x00); - } - else - { - ptr = (PUCHAR)&pAd->BeaconTxWI; - - for (i=0; iBeaconOffset[bcn_idx] + i, longptr); - ptr += 4; - } - - // Update CapabilityInfo in Beacon - for (i = CapInfoPos; i < (CapInfoPos+2); i++) - { - RTMP_IO_WRITE8(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, *ptr_capinfo); - ptr_capinfo ++; - } - - if (FrameLen > UpdatePos) - { - for (i= UpdatePos; i< (FrameLen); i++) - { - RTMP_IO_WRITE8(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, *ptr_update); - ptr_update ++; - } - } - - } - -} - -VOID RTMPInitPCIeLinkCtrlValue( - IN PRTMP_ADAPTER pAd) -{ -} - -VOID RTMPFindHostPCIDev( - IN PRTMP_ADAPTER pAd) -{ -} - -/* - ======================================================================== - - Routine Description: - - Arguments: - Level = RESTORE_HALT : Restore PCI host and Ralink PCIe Link Control field to its default value. - Level = Other Value : Restore from dot11 power save or radio off status. And force PCI host Link Control fields to 0x1 - - ======================================================================== -*/ -VOID RTMPPCIeLinkCtrlValueRestore( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level) -{ -} - -/* - ======================================================================== - - Routine Description: - - Arguments: - Max : limit Host PCI and Ralink PCIe device's LINK CONTROL field's value. - Because now frequently set our device to mode 1 or mode 3 will cause problem. - - ======================================================================== -*/ -VOID RTMPPCIeLinkCtrlSetting( - IN PRTMP_ADAPTER pAd, - IN USHORT Max) -{ -} - -VOID rt2860_stop(struct net_device *net_dev) -{ - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)NULL; - if (net_dev == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("net_dev == NULL!\n")); - } - else - pAd = net_dev->ml_priv; - - if (pAd != NULL) - { - // stop interface - netif_carrier_off(net_dev); - netif_stop_queue(net_dev); - - // mark device as removed from system and therefore no longer available - netif_device_detach(net_dev); - - // mark halt flag - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - - // take down the device - rt28xx_close((PNET_DEV)net_dev); - RT_MOD_DEC_USE_COUNT(); - } - return; -} - -/* - * invaild or writeback cache - * and convert virtual address to physical address - */ -dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, int sd_idx, int direction) -{ - PRTMP_ADAPTER pAd; - POS_COOKIE pObj; - - /* - ------ Porting Information ------ - > For Tx Alloc: - mgmt packets => sd_idx = 0 - SwIdx: pAd->MgmtRing.TxCpuIdx - pTxD : pAd->MgmtRing.Cell[SwIdx].AllocVa; - - data packets => sd_idx = 1 - TxIdx : pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx - QueIdx: pTxBlk->QueIdx - pTxD : pAd->TxRing[pTxBlk->QueIdx].Cell[TxIdx].AllocVa; - - > For Rx Alloc: - sd_idx = -1 - */ - - pAd = (PRTMP_ADAPTER)handle; - pObj = (POS_COOKIE)pAd->OS_Cookie; - - if (sd_idx == 1) - { - PTX_BLK pTxBlk; - pTxBlk = (PTX_BLK)ptr; - return pci_map_single(pObj->pci_dev, pTxBlk->pSrcBufData, pTxBlk->SrcBufLen, direction); - } - else - { - return pci_map_single(pObj->pci_dev, ptr, size, direction); - } - -} - -void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int direction) -{ - PRTMP_ADAPTER pAd; - POS_COOKIE pObj; - - pAd=(PRTMP_ADAPTER)handle; - pObj = (POS_COOKIE)pAd->OS_Cookie; - - pci_unmap_single(pObj->pci_dev, dma_addr, size, direction); - -} - diff --git a/drivers/staging/rt2860/Makefile b/drivers/staging/rt2860/Makefile index c9fe92583d7e..4404ddb63572 100644 --- a/drivers/staging/rt2860/Makefile +++ b/drivers/staging/rt2860/Makefile @@ -2,26 +2,33 @@ obj-$(CONFIG_RT2860) += rt2860sta.o # TODO: all of these should be removed EXTRA_CFLAGS += -DLINUX -DAGGREGATION_SUPPORT -DPIGGYBACK_SUPPORT -DWMM_SUPPORT -EXTRA_CFLAGS += -DRT2860 +EXTRA_CFLAGS += -DRTMP_MAC_PCI -DRTMP_PCI_SUPPORT -DRT2860 EXTRA_CFLAGS += -DDBG rt2860sta-objs := \ - common/md5.o \ + common/crypt_md5.o \ + common/crypt_sha2.o \ + common/crypt_hmac.o \ common/mlme.o \ - common/rtmp_wep.o \ + common/cmm_wep.o \ common/action.o \ common/cmm_data.o \ common/rtmp_init.o \ - common/rtmp_tkip.o \ + common/cmm_tkip.o \ + common/cmm_aes.o \ common/cmm_sync.o \ common/eeprom.o \ common/cmm_sanity.o \ common/cmm_info.o \ + common/cmm_cfg.o \ common/cmm_wpa.o \ common/dfs.o \ common/spectrum.o \ + common/rtmp_timer.o \ + common/rt_channel.o \ + common/cmm_profile.o \ + common/cmm_asic.o \ sta/assoc.o \ - sta/aironet.o \ sta/auth.o \ sta/auth_rsp.o \ sta/sync.o \ @@ -34,6 +41,9 @@ rt2860sta-objs := \ rt_main_dev.o \ sta_ioctl.o \ common/ba_action.o \ - common/2860_rtmp_init.o \ - 2860_main_dev.o \ - common/cmm_data_2860.o + pci_main_dev.o \ + rt_pci_rbus.o \ + common/cmm_mac_pci.o \ + common/cmm_data_pci.o \ + common/ee_prom.o \ + common/rtmp_mcu.o diff --git a/drivers/staging/rt2860/aironet.h b/drivers/staging/rt2860/aironet.h deleted file mode 100644 index 1e07b19b8cdc..000000000000 --- a/drivers/staging/rt2860/aironet.h +++ /dev/null @@ -1,210 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - aironet.h - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Name Date Modification logs - Paul Lin 04-06-15 Initial -*/ - -#ifndef __AIRONET_H__ -#define __AIRONET_H__ - -// Measurement Type definition -#define MSRN_TYPE_UNUSED 0 -#define MSRN_TYPE_CHANNEL_LOAD_REQ 1 -#define MSRN_TYPE_NOISE_HIST_REQ 2 -#define MSRN_TYPE_BEACON_REQ 3 -#define MSRN_TYPE_FRAME_REQ 4 - -// Scan Mode in Beacon Request -#define MSRN_SCAN_MODE_PASSIVE 0 -#define MSRN_SCAN_MODE_ACTIVE 1 -#define MSRN_SCAN_MODE_BEACON_TABLE 2 - -// PHY type definition for Aironet beacon report, CCX 2 table 36-9 -#define PHY_FH 1 -#define PHY_DSS 2 -#define PHY_UNUSED 3 -#define PHY_OFDM 4 -#define PHY_HR_DSS 5 -#define PHY_ERP 6 - -// RPI table in dBm -#define RPI_0 0 // Power <= -87 -#define RPI_1 1 // -87 < Power <= -82 -#define RPI_2 2 // -82 < Power <= -77 -#define RPI_3 3 // -77 < Power <= -72 -#define RPI_4 4 // -72 < Power <= -67 -#define RPI_5 5 // -67 < Power <= -62 -#define RPI_6 6 // -62 < Power <= -57 -#define RPI_7 7 // -57 < Power - -// Cisco Aironet IAPP definetions -#define AIRONET_IAPP_TYPE 0x32 -#define AIRONET_IAPP_SUBTYPE_REQUEST 0x01 -#define AIRONET_IAPP_SUBTYPE_REPORT 0x81 - -// Measurement Request detail format -typedef struct _MEASUREMENT_REQUEST { - UCHAR Channel; - UCHAR ScanMode; // Use only in beacon request, other requests did not use this field - USHORT Duration; -} MEASUREMENT_REQUEST, *PMEASUREMENT_REQUEST; - -// Beacon Measurement Report -// All these field might change to UCHAR, because we didn't do anything to these report. -// We copy all these beacons and report to CCX 2 AP. -typedef struct _BEACON_REPORT { - UCHAR Channel; - UCHAR Spare; - USHORT Duration; - UCHAR PhyType; // Definiation is listed above table 36-9 - UCHAR RxPower; - UCHAR BSSID[6]; - UCHAR ParentTSF[4]; - UCHAR TargetTSF[8]; - USHORT BeaconInterval; - USHORT CapabilityInfo; -} BEACON_REPORT, *PBEACON_REPORT; - -// Frame Measurement Report (Optional) -typedef struct _FRAME_REPORT { - UCHAR Channel; - UCHAR Spare; - USHORT Duration; - UCHAR TA; - UCHAR BSSID[6]; - UCHAR RSSI; - UCHAR Count; -} FRAME_REPORT, *PFRAME_REPORT; - -#pragma pack(1) -// Channel Load Report -typedef struct _CHANNEL_LOAD_REPORT { - UCHAR Channel; - UCHAR Spare; - USHORT Duration; - UCHAR CCABusy; -} CHANNEL_LOAD_REPORT, *PCHANNEL_LOAD_REPORT; -#pragma pack() - -// Nosie Histogram Report -typedef struct _NOISE_HIST_REPORT { - UCHAR Channel; - UCHAR Spare; - USHORT Duration; - UCHAR Density[8]; -} NOISE_HIST_REPORT, *PNOISE_HIST_REPORT; - -// Radio Management Capability element -typedef struct _RADIO_MANAGEMENT_CAPABILITY { - UCHAR Eid; // TODO: Why the Eid is 1 byte, not normal 2 bytes??? - UCHAR Length; - UCHAR AironetOui[3]; // AIronet OUI (00 40 96) - UCHAR Type; // Type / Version - USHORT Status; // swap16 required -} RADIO_MANAGEMENT_CAPABILITY, *PRADIO_MANAGEMENT_CAPABILITY; - -// Measurement Mode Bit definition -typedef struct _MEASUREMENT_MODE { - UCHAR Rsvd:4; - UCHAR Report:1; - UCHAR NotUsed:1; - UCHAR Enable:1; - UCHAR Parallel:1; -} MEASUREMENT_MODE, *PMEASUREMENT_MODE; - -// Measurement Request element, This is little endian mode -typedef struct _MEASUREMENT_REQUEST_ELEMENT { - USHORT Eid; - USHORT Length; // swap16 required - USHORT Token; // non-zero unique token - UCHAR Mode; // Measurement Mode - UCHAR Type; // Measurement type -} MEASUREMENT_REQUEST_ELEMENT, *PMEASUREMENT_REQUEST_ELEMENT; - -// Measurement Report element, This is little endian mode -typedef struct _MEASUREMENT_REPORT_ELEMENT { - USHORT Eid; - USHORT Length; // swap16 required - USHORT Token; // non-zero unique token - UCHAR Mode; // Measurement Mode - UCHAR Type; // Measurement type -} MEASUREMENT_REPORT_ELEMENT, *PMEASUREMENT_REPORT_ELEMENT; - -// Cisco Aironet IAPP Frame Header, Network byte order used -typedef struct _AIRONET_IAPP_HEADER { - UCHAR CiscoSnapHeader[8]; // 8 bytes Cisco snap header - USHORT Length; // IAPP ID & length, remember to swap16 in LE system - UCHAR Type; // IAPP type - UCHAR SubType; // IAPP subtype - UCHAR DA[6]; // Destination MAC address - UCHAR SA[6]; // Source MAC address - USHORT Token; // Dialog token, no need to swap16 since it is for yoken usage only -} AIRONET_IAPP_HEADER, *PAIRONET_IAPP_HEADER; - -// Radio Measurement Request frame -typedef struct _AIRONET_RM_REQUEST_FRAME { - AIRONET_IAPP_HEADER IAPP; // Common header - UCHAR Delay; // Activation Delay - UCHAR Offset; // Measurement offset -} AIRONET_RM_REQUEST_FRAME, *PAIRONET_RM_REQUEST_FRAME; - -// Radio Measurement Report frame -typedef struct _AIRONET_RM_REPORT_FRAME { - AIRONET_IAPP_HEADER IAPP; // Common header -} AIRONET_RM_REPORT_FRAME, *PAIRONET_RM_REPORT_FRAME; - -// Saved element request actions which will saved in StaCfg. -typedef struct _RM_REQUEST_ACTION { - MEASUREMENT_REQUEST_ELEMENT ReqElem; // Saved request element - MEASUREMENT_REQUEST Measurement; // Saved measurement within the request element -} RM_REQUEST_ACTION, *PRM_REQUEST_ACTION; - -// CCX administration control -typedef union _CCX_CONTROL { - struct { - UINT32 Enable:1; // Enable CCX2 - UINT32 LeapEnable:1; // Enable LEAP at CCX2 - UINT32 RMEnable:1; // Radio Measurement Enable - UINT32 DCRMEnable:1; // Non serving channel Radio Measurement enable - UINT32 QOSEnable:1; // Enable QOS for CCX 2.0 support - UINT32 FastRoamEnable:1; // Enable fast roaming - UINT32 Rsvd:2; // Not used - UINT32 dBmToRoam:8; // the condition to roam when receiving Rssi less than this value. It's negative value. - UINT32 TuLimit:16; // Limit for different channel scan - } field; - UINT32 word; -} CCX_CONTROL, *PCCX_CONTROL; - -#endif // __AIRONET_H__ diff --git a/drivers/staging/rt2860/ap.h b/drivers/staging/rt2860/ap.h index fcdb35847b10..6c58ce8ef951 100644 --- a/drivers/staging/rt2860/ap.h +++ b/drivers/staging/rt2860/ap.h @@ -40,22 +40,24 @@ #ifndef __AP_H__ #define __AP_H__ -// ap_mlme.c +// ap_wpa.c +VOID WpaStateMachineInit( + IN PRTMP_ADAPTER pAd, + IN STATE_MACHINE *Sm, + OUT STATE_MACHINE_FUNC Trans[]); -#ifdef RT2870 +#ifdef RTMP_MAC_USB VOID BeaconUpdateExec( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); -#endif // RT2870 // +#endif // RTMP_MAC_USB // VOID RTMPSetPiggyBack( IN PRTMP_ADAPTER pAd, IN BOOLEAN bPiggyBack); -// ap.c - VOID MacTableReset( IN PRTMP_ADAPTER pAd); diff --git a/drivers/staging/rt2860/chip/mac_pci.h b/drivers/staging/rt2860/chip/mac_pci.h new file mode 100644 index 000000000000..9ca9c3602d69 --- /dev/null +++ b/drivers/staging/rt2860/chip/mac_pci.h @@ -0,0 +1,365 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + mac_pci.h + + Abstract: + + Revision History: + Who When What + --------- ---------- ---------------------------------------------- + */ + +#ifndef __MAC_PCI_H__ +#define __MAC_PCI_H__ + +#include "../rtmp_type.h" +#include "rtmp_mac.h" +#include "rtmp_phy.h" +#include "../rtmp_iface.h" +#include "../rtmp_dot11.h" + + +// +// Device ID & Vendor ID related definitions, +// NOTE: you should not add the new VendorID/DeviceID here unless you not sure it belongs to what chip. +// +#define NIC_PCI_VENDOR_ID 0x1814 +#define PCIBUS_INTEL_VENDOR 0x8086 + +#if !defined(PCI_CAP_ID_EXP) +#define PCI_CAP_ID_EXP 0x10 +#endif +#if !defined(PCI_EXP_LNKCTL) +#define PCI_EXP_LNKCTL 0x10 +#endif +#if !defined(PCI_CLASS_BRIDGE_PCI) +#define PCI_CLASS_BRIDGE_PCI 0x0604 +#endif + + + + + +#define TXINFO_SIZE 0 +#define RTMP_PKT_TAIL_PADDING 0 +#define fRTMP_ADAPTER_NEED_STOP_TX 0 + +#define AUX_CTRL 0x10c + +// +// TX descriptor format, Tx ring, Mgmt Ring +// +typedef struct PACKED _TXD_STRUC { + // Word 0 + UINT32 SDPtr0; + // Word 1 + UINT32 SDLen1:14; + UINT32 LastSec1:1; + UINT32 Burst:1; + UINT32 SDLen0:14; + UINT32 LastSec0:1; + UINT32 DMADONE:1; + //Word2 + UINT32 SDPtr1; + //Word3 + UINT32 rsv2:24; + UINT32 WIV:1; // Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition + UINT32 QSEL:2; // select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA + UINT32 rsv:2; + UINT32 TCO:1; // + UINT32 UCO:1; // + UINT32 ICO:1; // +} TXD_STRUC, *PTXD_STRUC; + + +// +// Rx descriptor format, Rx Ring +// +typedef struct PACKED _RXD_STRUC{ + // Word 0 + UINT32 SDP0; + // Word 1 + UINT32 SDL1:14; + UINT32 Rsv:2; + UINT32 SDL0:14; + UINT32 LS0:1; + UINT32 DDONE:1; + // Word 2 + UINT32 SDP1; + // Word 3 + UINT32 BA:1; + UINT32 DATA:1; + UINT32 NULLDATA:1; + UINT32 FRAG:1; + UINT32 U2M:1; // 1: this RX frame is unicast to me + UINT32 Mcast:1; // 1: this is a multicast frame + UINT32 Bcast:1; // 1: this is a broadcast frame + UINT32 MyBss:1; // 1: this frame belongs to the same BSSID + UINT32 Crc:1; // 1: CRC error + UINT32 CipherErr:2; // 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid + UINT32 AMSDU:1; // rx with 802.3 header, not 802.11 header. + UINT32 HTC:1; + UINT32 RSSI:1; + UINT32 L2PAD:1; + UINT32 AMPDU:1; + UINT32 Decrypted:1; // this frame is being decrypted. + UINT32 PlcpSignal:1; // To be moved + UINT32 PlcpRssil:1;// To be moved + UINT32 Rsv1:13; +} RXD_STRUC, *PRXD_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC; + + +/* ----------------- EEPROM Related MACRO ----------------- */ + +// 8051 firmware image for RT2860 - base address = 0x4000 +#define FIRMWARE_IMAGE_BASE 0x2000 +#define MAX_FIRMWARE_IMAGE_SIZE 0x2000 // 8kbyte + + +/* ----------------- Frimware Related MACRO ----------------- */ +#define RTMP_WRITE_FIRMWARE(_pAd, _pFwImage, _FwLen) \ + do{ \ + ULONG _i, _firm; \ + RTMP_IO_WRITE32(_pAd, PBF_SYS_CTRL, 0x10000); \ + \ + for(_i=0; _i<_FwLen; _i+=4) \ + { \ + _firm = _pFwImage[_i] + \ + (_pFwImage[_i+3] << 24) + \ + (_pFwImage[_i+2] << 16) + \ + (_pFwImage[_i+1] << 8); \ + RTMP_IO_WRITE32(_pAd, FIRMWARE_IMAGE_BASE + _i, _firm); \ + } \ + RTMP_IO_WRITE32(_pAd, PBF_SYS_CTRL, 0x00000); \ + RTMP_IO_WRITE32(_pAd, PBF_SYS_CTRL, 0x00001); \ + \ + /* initialize BBP R/W access agent */ \ + RTMP_IO_WRITE32(_pAd, H2M_BBP_AGENT, 0); \ + RTMP_IO_WRITE32(_pAd, H2M_MAILBOX_CSR, 0); \ + }while(0) + + +/* ----------------- TX Related MACRO ----------------- */ +#define RTMP_START_DEQUEUE(pAd, QueIdx, irqFlags) do{}while(0) +#define RTMP_STOP_DEQUEUE(pAd, QueIdx, irqFlags) do{}while(0) + + +#define RTMP_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, freeNum, pPacket) \ + ((freeNum) >= (ULONG)(pTxBlk->TotalFragNum + RTMP_GET_PACKET_FRAGMENTS(pPacket) + 3)) /* rough estimate we will use 3 more descriptor. */ +#define RTMP_RELEASE_DESC_RESOURCE(pAd, QueIdx) \ + do{}while(0) + +#define NEED_QUEUE_BACK_FOR_AGG(pAd, QueIdx, freeNum, _TxFrameType) \ + (((freeNum != (TX_RING_SIZE-1)) && (pAd->TxSwQueue[QueIdx].Number == 0)) || (freeNum<3)) + //(((freeNum) != (TX_RING_SIZE-1)) && (pAd->TxSwQueue[QueIdx].Number == 1 /*0*/)) + + +#define HAL_KickOutMgmtTx(_pAd, _QueIdx, _pPacket, _pSrcBufVA, _SrcBufLen) \ + RtmpPCIMgmtKickOut(_pAd, _QueIdx, _pPacket, _pSrcBufVA, _SrcBufLen) + +#define HAL_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) \ + /* RtmpPCI_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber)*/ + +#define HAL_WriteTxResource(pAd, pTxBlk,bIsLast, pFreeNumber) \ + RtmpPCI_WriteSingleTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) + +#define HAL_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber) \ + RtmpPCI_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber) + +#define HAL_WriteMultiTxResource(pAd, pTxBlk,frameNum, pFreeNumber) \ + RtmpPCI_WriteMultiTxResource(pAd, pTxBlk, frameNum, pFreeNumber) + +#define HAL_FinalWriteTxResource(_pAd, _pTxBlk, _TotalMPDUSize, _FirstTxIdx) \ + RtmpPCI_FinalWriteTxResource(_pAd, _pTxBlk, _TotalMPDUSize, _FirstTxIdx) + +#define HAL_LastTxIdx(_pAd, _QueIdx,_LastTxIdx) \ + /*RtmpPCIDataLastTxIdx(_pAd, _QueIdx,_LastTxIdx)*/ + +#define HAL_KickOutTx(_pAd, _pTxBlk, _QueIdx) \ + RTMP_IO_WRITE32((_pAd), TX_CTX_IDX0+((_QueIdx)*0x10), (_pAd)->TxRing[(_QueIdx)].TxCpuIdx) +/* RtmpPCIDataKickOut(_pAd, _pTxBlk, _QueIdx)*/ + +#define HAL_KickOutNullFrameTx(_pAd, _QueIdx, _pNullFrame, _frameLen) \ + MiniportMMRequest(_pAd, _QueIdx, _pNullFrame, _frameLen) + +#define GET_TXRING_FREENO(_pAd, _QueIdx) \ + (_pAd->TxRing[_QueIdx].TxSwFreeIdx > _pAd->TxRing[_QueIdx].TxCpuIdx) ? \ + (_pAd->TxRing[_QueIdx].TxSwFreeIdx - _pAd->TxRing[_QueIdx].TxCpuIdx - 1) \ + : \ + (_pAd->TxRing[_QueIdx].TxSwFreeIdx + TX_RING_SIZE - _pAd->TxRing[_QueIdx].TxCpuIdx - 1); + + +#define GET_MGMTRING_FREENO(_pAd) \ + (_pAd->MgmtRing.TxSwFreeIdx > _pAd->MgmtRing.TxCpuIdx) ? \ + (_pAd->MgmtRing.TxSwFreeIdx - _pAd->MgmtRing.TxCpuIdx - 1) \ + : \ + (_pAd->MgmtRing.TxSwFreeIdx + MGMT_RING_SIZE - _pAd->MgmtRing.TxCpuIdx - 1); + + +/* ----------------- RX Related MACRO ----------------- */ + + +/* ----------------- ASIC Related MACRO ----------------- */ +// reset MAC of a station entry to 0x000000000000 +#define RTMP_STA_ENTRY_MAC_RESET(pAd, Wcid) \ + AsicDelWcidTab(pAd, Wcid); + +// add this entry into ASIC RX WCID search table +#define RTMP_STA_ENTRY_ADD(pAd, pEntry) \ + AsicUpdateRxWCIDTable(pAd, pEntry->Aid, pEntry->Addr); + +// add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet +// Set MAC register value according operation mode +#define RTMP_UPDATE_PROTECT(pAd) \ + AsicUpdateProtect(pAd, 0, (ALLN_SETPROTECT), TRUE, 0); +// end johnli + +// remove Pair-wise key material from ASIC +#define RTMP_STA_ENTRY_KEY_DEL(pAd, BssIdx, Wcid) \ + AsicRemovePairwiseKeyEntry(pAd, BssIdx, (UCHAR)Wcid); + +// add Client security information into ASIC WCID table and IVEIV table +#define RTMP_STA_SECURITY_INFO_ADD(pAd, apidx, KeyID, pEntry) \ + RTMPAddWcidAttributeEntry(pAd, apidx, KeyID, \ + pAd->SharedKey[apidx][KeyID].CipherAlg, pEntry); + +#define RTMP_SECURITY_KEY_ADD(pAd, apidx, KeyID, pEntry) \ + { /* update pairwise key information to ASIC Shared Key Table */ \ + AsicAddSharedKeyEntry(pAd, apidx, KeyID, \ + pAd->SharedKey[apidx][KeyID].CipherAlg, \ + pAd->SharedKey[apidx][KeyID].Key, \ + pAd->SharedKey[apidx][KeyID].TxMic, \ + pAd->SharedKey[apidx][KeyID].RxMic); \ + /* update ASIC WCID attribute table and IVEIV table */ \ + RTMPAddWcidAttributeEntry(pAd, apidx, KeyID, \ + pAd->SharedKey[apidx][KeyID].CipherAlg, \ + pEntry); } + + +// Insert the BA bitmap to ASIC for the Wcid entry +#define RTMP_ADD_BA_SESSION_TO_ASIC(_pAd, _Aid, _TID) \ + do{ \ + UINT32 _Value = 0, _Offset; \ + _Offset = MAC_WCID_BASE + (_Aid) * HW_WCID_ENTRY_SIZE + 4; \ + RTMP_IO_READ32((_pAd), _Offset, &_Value);\ + _Value |= (0x10000<<(_TID)); \ + RTMP_IO_WRITE32((_pAd), _Offset, _Value);\ + }while(0) + + +// Remove the BA bitmap from ASIC for the Wcid entry +// bitmap field starts at 0x10000 in ASIC WCID table +#define RTMP_DEL_BA_SESSION_FROM_ASIC(_pAd, _Wcid, _TID) \ + do{ \ + UINT32 _Value = 0, _Offset; \ + _Offset = MAC_WCID_BASE + (_Wcid) * HW_WCID_ENTRY_SIZE + 4; \ + RTMP_IO_READ32((_pAd), _Offset, &_Value); \ + _Value &= (~(0x10000 << (_TID))); \ + RTMP_IO_WRITE32((_pAd), _Offset, _Value); \ + }while(0) + + +/* ----------------- Interface Related MACRO ----------------- */ + +// +// Enable & Disable NIC interrupt via writing interrupt mask register +// Since it use ADAPTER structure, it have to be put after structure definition. +// +#define RTMP_ASIC_INTERRUPT_DISABLE(_pAd) \ + do{ \ + RTMP_IO_WRITE32((_pAd), INT_MASK_CSR, 0x0); /* 0: disable */ \ + RTMP_CLEAR_FLAG((_pAd), fRTMP_ADAPTER_INTERRUPT_ACTIVE); \ + }while(0) + +#define RTMP_ASIC_INTERRUPT_ENABLE(_pAd)\ + do{ \ + RTMP_IO_WRITE32((_pAd), INT_MASK_CSR, (_pAd)->int_enable_reg /*DELAYINTMASK*/); /* 1:enable */ \ + RTMP_SET_FLAG((_pAd), fRTMP_ADAPTER_INTERRUPT_ACTIVE); \ + }while(0) + + +#define RTMP_IRQ_INIT(pAd) \ + { pAd->int_enable_reg = ((DELAYINTMASK) | \ + (RxINT|TxDataInt|TxMgmtInt)) & ~(0x03); \ + pAd->int_disable_mask = 0; \ + pAd->int_pending = 0; } + +#define RTMP_IRQ_ENABLE(pAd) \ + { /* clear garbage ints */ \ + RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, 0xffffffff);\ + RTMP_ASIC_INTERRUPT_ENABLE(pAd); } + + +/* ----------------- MLME Related MACRO ----------------- */ +#define RTMP_MLME_HANDLER(pAd) MlmeHandler(pAd) + +#define RTMP_MLME_PRE_SANITY_CHECK(pAd) + +#define RTMP_MLME_STA_QUICK_RSP_WAKE_UP(pAd) \ + RTMPSetTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, 100); + +#define RTMP_MLME_RESET_STATE_MACHINE(pAd) \ + MlmeRestartStateMachine(pAd) + +#define RTMP_HANDLE_COUNTER_MEASURE(_pAd, _pEntry)\ + HandleCounterMeasure(_pAd, _pEntry) + +/* ----------------- Power Save Related MACRO ----------------- */ +#define RTMP_PS_POLL_ENQUEUE(pAd) EnqueuePsPoll(pAd) + + +// For RTMPPCIePowerLinkCtrlRestore () function +#define RESTORE_HALT 1 +#define RESTORE_WAKEUP 2 +#define RESTORE_CLOSE 3 + +#define PowerSafeCID 1 +#define PowerRadioOffCID 2 +#define PowerWakeCID 3 +#define CID0MASK 0x000000ff +#define CID1MASK 0x0000ff00 +#define CID2MASK 0x00ff0000 +#define CID3MASK 0xff000000 + + +#define RTMP_STA_FORCE_WAKEUP(pAd, bFromTx) \ + RT28xxPciStaAsicForceWakeup(pAd, bFromTx); + +#define RTMP_STA_SLEEP_THEN_AUTO_WAKEUP(pAd, TbttNumToNextWakeUp) \ + RT28xxPciStaAsicSleepThenAutoWakeup(pAd, TbttNumToNextWakeUp); + +#define RTMP_SET_PSM_BIT(_pAd, _val) \ + MlmeSetPsmBit(_pAd, _val); + +#define RTMP_MLME_RADIO_ON(pAd) \ + RT28xxPciMlmeRadioOn(pAd); + +#define RTMP_MLME_RADIO_OFF(pAd) \ + RT28xxPciMlmeRadioOFF(pAd); + +#endif //__MAC_PCI_H__ // diff --git a/drivers/staging/rt2860/chip/mac_usb.h b/drivers/staging/rt2860/chip/mac_usb.h new file mode 100644 index 000000000000..5a8588377425 --- /dev/null +++ b/drivers/staging/rt2860/chip/mac_usb.h @@ -0,0 +1,365 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + mac_usb.h + + Abstract: + + Revision History: + Who When What + --------- ---------- ---------------------------------------------- + */ + +#ifndef __MAC_USB_H__ +#define __MAC_USB_H__ + +#include "../rtmp_type.h" +#include "rtmp_mac.h" +#include "rtmp_phy.h" +#include "../rtmp_iface.h" +#include "../rtmp_dot11.h" + + +#define USB_CYC_CFG 0x02a4 + +#define BEACON_RING_SIZE 2 +#define MGMTPIPEIDX 0 // EP6 is highest priority + +#define RTMP_PKT_TAIL_PADDING 11 // 3(max 4 byte padding) + 4 (last packet padding) + 4 (MaxBulkOutsize align padding) + +#define fRTMP_ADAPTER_NEED_STOP_TX \ + (fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_HALT_IN_PROGRESS | \ + fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_BULKOUT_RESET | \ + fRTMP_ADAPTER_RADIO_OFF | fRTMP_ADAPTER_REMOVE_IN_PROGRESS) + +// +// RXINFO appends at the end of each rx packet. +// +#define RXINFO_SIZE 4 +#define RT2870_RXDMALEN_FIELD_SIZE 4 + +typedef struct PACKED _RXINFO_STRUC { + UINT32 BA:1; + UINT32 DATA:1; + UINT32 NULLDATA:1; + UINT32 FRAG:1; + UINT32 U2M:1; // 1: this RX frame is unicast to me + UINT32 Mcast:1; // 1: this is a multicast frame + UINT32 Bcast:1; // 1: this is a broadcast frame + UINT32 MyBss:1; // 1: this frame belongs to the same BSSID + UINT32 Crc:1; // 1: CRC error + UINT32 CipherErr:2; // 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid + UINT32 AMSDU:1; // rx with 802.3 header, not 802.11 header. + UINT32 HTC:1; + UINT32 RSSI:1; + UINT32 L2PAD:1; + UINT32 AMPDU:1; // To be moved + UINT32 Decrypted:1; + UINT32 PlcpRssil:1; + UINT32 CipherAlg:1; + UINT32 LastAMSDU:1; + UINT32 PlcpSignal:12; +} RXINFO_STRUC, *PRXINFO_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC; + + +// +// TXINFO +// +#define TXINFO_SIZE 4 + +typedef struct _TXINFO_STRUC { + // Word 0 + UINT32 USBDMATxPktLen:16; //used ONLY in USB bulk Aggregation, Total byte counts of all sub-frame. + UINT32 rsv:8; + UINT32 WIV:1; // Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition + UINT32 QSEL:2; // select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA + UINT32 SwUseLastRound:1; // Software use. + UINT32 rsv2:2; // Software use. + UINT32 USBDMANextVLD:1; //used ONLY in USB bulk Aggregation, NextValid + UINT32 USBDMATxburst:1;//used ONLY in USB bulk Aggre. Force USB DMA transmit frame from current selected endpoint +} TXINFO_STRUC, *PTXINFO_STRUC; + + +// +// Management ring buffer format +// +typedef struct _MGMT_STRUC { + BOOLEAN Valid; + PUCHAR pBuffer; + ULONG Length; +} MGMT_STRUC, *PMGMT_STRUC; + + +//////////////////////////////////////////////////////////////////////////// +// The TX_BUFFER structure forms the transmitted USB packet to the device +//////////////////////////////////////////////////////////////////////////// +typedef struct __TX_BUFFER{ + union{ + UCHAR WirelessPacket[TX_BUFFER_NORMSIZE]; + HEADER_802_11 NullFrame; + PSPOLL_FRAME PsPollPacket; + RTS_FRAME RTSFrame; + }field; + UCHAR Aggregation[4]; //Buffer for save Aggregation size. +} TX_BUFFER, *PTX_BUFFER; + +typedef struct __HTTX_BUFFER{ + union{ + UCHAR WirelessPacket[MAX_TXBULK_SIZE]; + HEADER_802_11 NullFrame; + PSPOLL_FRAME PsPollPacket; + RTS_FRAME RTSFrame; + }field; + UCHAR Aggregation[4]; //Buffer for save Aggregation size. +} HTTX_BUFFER, *PHTTX_BUFFER; + + +// used to track driver-generated write irps +typedef struct _TX_CONTEXT +{ + PVOID pAd; //Initialized in MiniportInitialize + PURB pUrb; //Initialized in MiniportInitialize + PIRP pIrp; //used to cancel pending bulk out. + //Initialized in MiniportInitialize + PTX_BUFFER TransferBuffer; //Initialized in MiniportInitialize + ULONG BulkOutSize; + UCHAR BulkOutPipeId; + UCHAR SelfIdx; + BOOLEAN InUse; + BOOLEAN bWaitingBulkOut; // at least one packet is in this TxContext, ready for making IRP anytime. + BOOLEAN bFullForBulkOut; // all tx buffer are full , so waiting for tx bulkout. + BOOLEAN IRPPending; + BOOLEAN LastOne; + BOOLEAN bAggregatible; + UCHAR Header_802_3[LENGTH_802_3]; + UCHAR Rsv[2]; + ULONG DataOffset; + UINT TxRate; + dma_addr_t data_dma; // urb dma on linux + +} TX_CONTEXT, *PTX_CONTEXT, **PPTX_CONTEXT; + + +// used to track driver-generated write irps +typedef struct _HT_TX_CONTEXT +{ + PVOID pAd; //Initialized in MiniportInitialize + PURB pUrb; //Initialized in MiniportInitialize + PIRP pIrp; //used to cancel pending bulk out. + //Initialized in MiniportInitialize + PHTTX_BUFFER TransferBuffer; //Initialized in MiniportInitialize + ULONG BulkOutSize; // Indicate the total bulk-out size in bytes in one bulk-transmission + UCHAR BulkOutPipeId; + BOOLEAN IRPPending; + BOOLEAN LastOne; + BOOLEAN bCurWriting; + BOOLEAN bRingEmpty; + BOOLEAN bCopySavePad; + UCHAR SavedPad[8]; + UCHAR Header_802_3[LENGTH_802_3]; + ULONG CurWritePosition; // Indicate the buffer offset which packet will be inserted start from. + ULONG CurWriteRealPos; // Indicate the buffer offset which packet now are writing to. + ULONG NextBulkOutPosition; // Indicate the buffer start offset of a bulk-transmission + ULONG ENextBulkOutPosition; // Indicate the buffer end offset of a bulk-transmission + UINT TxRate; + dma_addr_t data_dma; // urb dma on linux +} HT_TX_CONTEXT, *PHT_TX_CONTEXT, **PPHT_TX_CONTEXT; + + +// +// Structure to keep track of receive packets and buffers to indicate +// receive data to the protocol. +// +typedef struct _RX_CONTEXT +{ + PUCHAR TransferBuffer; + PVOID pAd; + PIRP pIrp;//used to cancel pending bulk in. + PURB pUrb; + //These 2 Boolean shouldn't both be 1 at the same time. + ULONG BulkInOffset; // number of packets waiting for reordering . +// BOOLEAN ReorderInUse; // At least one packet in this buffer are in reordering buffer and wait for receive indication + BOOLEAN bRxHandling; // Notify this packet is being process now. + BOOLEAN InUse; // USB Hardware Occupied. Wait for USB HW to put packet. + BOOLEAN Readable; // Receive Complete back. OK for driver to indicate receiving packet. + BOOLEAN IRPPending; // TODO: To be removed + atomic_t IrpLock; + NDIS_SPIN_LOCK RxContextLock; + dma_addr_t data_dma; // urb dma on linux +} RX_CONTEXT, *PRX_CONTEXT; + + + +/****************************************************************************** + + USB Frimware Related MACRO + +******************************************************************************/ +// 8051 firmware image for usb - use last-half base address = 0x3000 +#define FIRMWARE_IMAGE_BASE 0x3000 +#define MAX_FIRMWARE_IMAGE_SIZE 0x1000 // 4kbyte + +#define RTMP_WRITE_FIRMWARE(_pAd, _pFwImage, _FwLen) \ + RTUSBFirmwareWrite(_pAd, _pFwImage, _FwLen) + + + +/****************************************************************************** + + USB TX Related MACRO + +******************************************************************************/ +#define RTMP_START_DEQUEUE(pAd, QueIdx, irqFlags) \ + do{ \ + RTMP_IRQ_LOCK(&pAd->DeQueueLock[QueIdx], irqFlags); \ + if (pAd->DeQueueRunning[QueIdx]) \ + { \ + RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags);\ + DBGPRINT(RT_DEBUG_OFF, ("DeQueueRunning[%d]= TRUE!\n", QueIdx)); \ + continue; \ + } \ + else \ + { \ + pAd->DeQueueRunning[QueIdx] = TRUE; \ + RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags);\ + } \ + }while(0) + +#define RTMP_STOP_DEQUEUE(pAd, QueIdx, irqFlags) \ + do{ \ + RTMP_IRQ_LOCK(&pAd->DeQueueLock[QueIdx], irqFlags); \ + pAd->DeQueueRunning[QueIdx] = FALSE; \ + RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags); \ + }while(0) + +#define RTMP_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, freeNum, pPacket) \ + (RTUSBFreeDescriptorRequest(pAd, pTxBlk->QueIdx, (pTxBlk->TotalFrameLen + GET_OS_PKT_LEN(pPacket))) == NDIS_STATUS_SUCCESS) + +#define RTMP_RELEASE_DESC_RESOURCE(pAd, QueIdx) \ + do{}while(0) + +#define NEED_QUEUE_BACK_FOR_AGG(_pAd, _QueIdx, _freeNum, _TxFrameType) \ + ((_TxFrameType == TX_RALINK_FRAME) && (RTUSBNeedQueueBackForAgg(_pAd, _QueIdx))) + +#define HAL_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) \ + RtmpUSB_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) + +#define HAL_WriteTxResource(pAd, pTxBlk,bIsLast, pFreeNumber) \ + RtmpUSB_WriteSingleTxResource(pAd, pTxBlk,bIsLast, pFreeNumber) + +#define HAL_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber) \ + RtmpUSB_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber) + +#define HAL_WriteMultiTxResource(pAd, pTxBlk,frameNum, pFreeNumber) \ + RtmpUSB_WriteMultiTxResource(pAd, pTxBlk,frameNum, pFreeNumber) + +#define HAL_FinalWriteTxResource(pAd, pTxBlk, totalMPDUSize, TxIdx) \ + RtmpUSB_FinalWriteTxResource(pAd, pTxBlk, totalMPDUSize, TxIdx) + +#define HAL_LastTxIdx(pAd, QueIdx,TxIdx) \ + /*RtmpUSBDataLastTxIdx(pAd, QueIdx,TxIdx)*/ + +#define HAL_KickOutTx(pAd, pTxBlk, QueIdx) \ + RtmpUSBDataKickOut(pAd, pTxBlk, QueIdx) + +#define HAL_KickOutMgmtTx(pAd, QueIdx, pPacket, pSrcBufVA, SrcBufLen) \ + RtmpUSBMgmtKickOut(pAd, QueIdx, pPacket, pSrcBufVA, SrcBufLen) + +#define HAL_KickOutNullFrameTx(_pAd, _QueIdx, _pNullFrame, _frameLen) \ + RtmpUSBNullFrameKickOut(_pAd, _QueIdx, _pNullFrame, _frameLen) + +#define GET_TXRING_FREENO(_pAd, _QueIdx) (_QueIdx) //(_pAd->TxRing[_QueIdx].TxSwFreeIdx) +#define GET_MGMTRING_FREENO(_pAd) (_pAd->MgmtRing.TxSwFreeIdx) + + +/* ----------------- RX Related MACRO ----------------- */ + + +/* + * Device Hardware Interface Related MACRO + */ +#define RTMP_IRQ_INIT(pAd) do{}while(0) +#define RTMP_IRQ_ENABLE(pAd) do{}while(0) + + +/* + * MLME Related MACRO + */ +#define RTMP_MLME_HANDLER(pAd) RTUSBMlmeUp(pAd) + +#define RTMP_MLME_PRE_SANITY_CHECK(pAd) \ + { if ((pAd->CommonCfg.bHardwareRadio == TRUE) && \ + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && \ + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS))) { \ + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_CHECK_GPIO, NULL, 0); } } + +#define RTMP_MLME_STA_QUICK_RSP_WAKE_UP(pAd) \ + { RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_QKERIODIC_EXECUT, NULL, 0); \ + RTUSBMlmeUp(pAd); } + +#define RTMP_MLME_RESET_STATE_MACHINE(pAd) \ + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_RESET_CONF, 0, NULL); \ + RTUSBMlmeUp(pAd); + +#define RTMP_HANDLE_COUNTER_MEASURE(_pAd, _pEntry) \ + { RTUSBEnqueueInternalCmd(_pAd, CMDTHREAD_802_11_COUNTER_MEASURE, _pEntry, sizeof(MAC_TABLE_ENTRY)); \ + RTUSBMlmeUp(_pAd); \ + } + + +/* + * Power Save Related MACRO + */ +#define RTMP_PS_POLL_ENQUEUE(pAd) \ + { RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_PSPOLL); \ + RTUSBKickBulkOut(pAd); } + +#define RTMP_STA_FORCE_WAKEUP(_pAd, bFromTx) \ + RT28xxUsbStaAsicForceWakeup(_pAd, bFromTx); + +#define RTMP_STA_SLEEP_THEN_AUTO_WAKEUP(pAd, TbttNumToNextWakeUp) \ + RT28xxUsbStaAsicSleepThenAutoWakeup(pAd, TbttNumToNextWakeUp); + +#define RTMP_SET_PSM_BIT(_pAd, _val) \ + {\ + if ((_pAd)->StaCfg.WindowsPowerMode == Ndis802_11PowerModeFast_PSP) \ + MlmeSetPsmBit(_pAd, _val);\ + else \ + { \ + USHORT _psm_val; \ + _psm_val = _val; \ + RTUSBEnqueueInternalCmd(_pAd, CMDTHREAD_SET_PSM_BIT, &(_psm_val), sizeof(USHORT)); \ + }\ + } + +#define RTMP_MLME_RADIO_ON(pAd) \ + RT28xxUsbMlmeRadioOn(pAd); + +#define RTMP_MLME_RADIO_OFF(pAd) \ + RT28xxUsbMlmeRadioOFF(pAd); + +#endif //__MAC_USB_H__ // diff --git a/drivers/staging/rt2860/chip/rt2860.h b/drivers/staging/rt2860/chip/rt2860.h new file mode 100644 index 000000000000..2989d09556bc --- /dev/null +++ b/drivers/staging/rt2860/chip/rt2860.h @@ -0,0 +1,56 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + */ + +#ifndef __RT2860_H__ +#define __RT2860_H__ + +#include "mac_pci.h" + +#ifndef RTMP_PCI_SUPPORT +#error "For RT2860, you should define the compile flag -DRTMP_PCI_SUPPORT" +#endif + +#ifndef RTMP_MAC_PCI +#error "For RT2880, you should define the compile flag -DRTMP_MAC_PCI" +#endif + +// +// Device ID & Vendor ID, these values should match EEPROM value +// +#define NIC2860_PCI_DEVICE_ID 0x0601 +#define NIC2860_PCIe_DEVICE_ID 0x0681 +#define NIC2760_PCI_DEVICE_ID 0x0701 // 1T/2R Cardbus ??? +#define NIC2790_PCIe_DEVICE_ID 0x0781 // 1T/2R miniCard + + +#define VEN_AWT_PCIe_DEVICE_ID 0x1059 +#define VEN_AWT_PCI_VENDOR_ID 0x1A3B + +#define EDIMAX_PCI_VENDOR_ID 0x1432 + + +#endif //__RT2860_H__ // diff --git a/drivers/staging/rt2860/chip/rt2870.h b/drivers/staging/rt2860/chip/rt2870.h new file mode 100644 index 000000000000..a9309253b20f --- /dev/null +++ b/drivers/staging/rt2860/chip/rt2870.h @@ -0,0 +1,47 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + */ +#ifndef __RT2870_H__ +#define __RT2870_H__ + +#ifdef RT2870 + +#ifndef RTMP_USB_SUPPORT +#error "For RT2870, you should define the compile flag -DRTMP_USB_SUPPORT" +#endif + +#ifndef RTMP_MAC_USB +#error "For RT2870, you should define the compile flag -DRTMP_MAC_USB" +#endif + +#include "../rtmp_type.h" +#include "mac_usb.h" + + +//#define RTMP_CHIP_NAME "RT2870" + +#endif // RT2870 // +#endif //__RT2870_H__ // diff --git a/drivers/staging/rt2860/chip/rt3070.h b/drivers/staging/rt2860/chip/rt3070.h new file mode 100644 index 000000000000..87df99ad929a --- /dev/null +++ b/drivers/staging/rt2860/chip/rt3070.h @@ -0,0 +1,68 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + rt3070.h + + Abstract: + + Revision History: + Who When What + --------- ---------- ---------------------------------------------- + */ + +#ifndef __RT3070_H__ +#define __RT3070_H__ + +#ifdef RT3070 + + +#ifndef RTMP_USB_SUPPORT +#error "For RT3070, you should define the compile flag -DRTMP_USB_SUPPORT" +#endif + +#ifndef RTMP_MAC_USB +#error "For RT3070, you should define the compile flag -DRTMP_MAC_USB" +#endif + +#ifndef RTMP_RF_RW_SUPPORT +#error "For RT3070, you should define the compile flag -DRTMP_RF_RW_SUPPORT" +#endif + +#ifndef RT30xx +#error "For RT3070, you should define the compile flag -DRT30xx" +#endif + +#include "mac_usb.h" +#include "rt30xx.h" + +// +// Device ID & Vendor ID, these values should match EEPROM value +// + +#endif // RT3070 // + +#endif //__RT3070_H__ // diff --git a/drivers/staging/rt2860/chip/rt30xx.h b/drivers/staging/rt2860/chip/rt30xx.h new file mode 100644 index 000000000000..70971a062607 --- /dev/null +++ b/drivers/staging/rt2860/chip/rt30xx.h @@ -0,0 +1,48 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + rt30xx.h + + Abstract: + + Revision History: + Who When What + --------- ---------- ---------------------------------------------- + */ + +#ifndef __RT30XX_H__ +#define __RT30XX_H__ + +#ifdef RT30xx + + +extern REG_PAIR RT30xx_RFRegTable[]; +extern UCHAR NUM_RF_REG_PARMS; + +#endif // RT30xx // + +#endif //__RT30XX_H__ // diff --git a/drivers/staging/rt2860/rt28xx.h b/drivers/staging/rt2860/chip/rtmp_mac.h similarity index 70% rename from drivers/staging/rt2860/rt28xx.h rename to drivers/staging/rt2860/chip/rtmp_mac.h index c08525002cc2..3ddb0bf03c6f 100644 --- a/drivers/staging/rt2860/rt28xx.h +++ b/drivers/staging/rt2860/chip/rtmp_mac.h @@ -25,60 +25,142 @@ ************************************************************************* Module Name: - rt28xx.h + rtmp_mac.h Abstract: - RT28xx ASIC related definition & structures + Ralink Wireless Chip MAC related definition & structures Revision History: Who When What -------- ---------- ---------------------------------------------- - Jan Lee Jan-3-2006 created for RT2860c */ -#ifndef __RT28XX_H__ -#define __RT28XX_H__ +#ifndef __RTMP_MAC_H__ +#define __RTMP_MAC_H__ + + + +// ================================================================================= +// TX / RX ring descriptor format +// ================================================================================= + +// the first 24-byte in TXD is called TXINFO and will be DMAed to MAC block through TXFIFO. +// MAC block use this TXINFO to control the transmission behavior of this frame. +#define FIFO_MGMT 0 +#define FIFO_HCCA 1 +#define FIFO_EDCA 2 // -// PCI registers - base address 0x0000 +// TXD Wireless Information format for Tx ring and Mgmt Ring // -#define PCI_CFG 0x0000 -#define PCI_EECTRL 0x0004 -#define PCI_MCUCTRL 0x0008 +//txop : for txop mode +// 0:txop for the MPDU frame will be handles by ASIC by register +// 1/2/3:the MPDU frame is send after PIFS/backoff/SIFS +typedef struct PACKED _TXWI_STRUC { + // Word 0 + // ex: 00 03 00 40 means txop = 3, PHYMODE = 1 + UINT32 FRAG:1; // 1 to inform TKIP engine this is a fragment. + UINT32 MIMOps:1; // the remote peer is in dynamic MIMO-PS mode + UINT32 CFACK:1; + UINT32 TS:1; + + UINT32 AMPDU:1; + UINT32 MpduDensity:3; + UINT32 txop:2; //FOR "THIS" frame. 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs only when previous frame exchange is successful. + UINT32 rsv:6; -typedef int NTSTATUS; + UINT32 MCS:7; + UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz + UINT32 ShortGI:1; + UINT32 STBC:2; // 1: STBC support MCS =0-7, 2,3 : RESERVE + UINT32 Ifs:1; // +// UINT32 rsv2:2; //channel bandwidth 20MHz or 40 MHz + UINT32 rsv2:1; + UINT32 TxBF:1; // 3*3 + UINT32 PHYMODE:2; + // Word1 + // ex: 1c ff 38 00 means ACK=0, BAWinSize=7, MPDUtotalByteCount = 0x38 + UINT32 ACK:1; + UINT32 NSEQ:1; + UINT32 BAWinSize:6; + UINT32 WirelessCliID:8; + UINT32 MPDUtotalByteCount:12; + UINT32 PacketId:4; + //Word2 + UINT32 IV; + //Word3 + UINT32 EIV; +} TXWI_STRUC, *PTXWI_STRUC; + + +// +// RXWI wireless information format, in PBF. invisible in driver. +// +typedef struct PACKED _RXWI_STRUC { + // Word 0 + UINT32 WirelessCliID:8; + UINT32 KeyIndex:2; + UINT32 BSSID:3; + UINT32 UDF:3; + UINT32 MPDUtotalByteCount:12; + UINT32 TID:4; + // Word 1 + UINT32 FRAG:4; + UINT32 SEQUENCE:12; + UINT32 MCS:7; + UINT32 BW:1; + UINT32 ShortGI:1; + UINT32 STBC:2; + UINT32 rsv:3; + UINT32 PHYMODE:2; // 1: this RX frame is unicast to me + //Word2 + UINT32 RSSI0:8; + UINT32 RSSI1:8; + UINT32 RSSI2:8; + UINT32 rsv1:8; + //Word3 + UINT32 SNR0:8; + UINT32 SNR1:8; + UINT32 FOFFSET:8; // RT35xx + UINT32 rsv2:8; + /*UINT32 rsv2:16;*/ +} RXWI_STRUC, *PRXWI_STRUC; + + +// ================================================================================= +// Register format +// ================================================================================= -#define OPT_14 0x114 // // SCH/DMA registers - base address 0x0200 // // INT_SOURCE_CSR: Interrupt source register. Write one to clear corresponding bit // -#define DMA_CSR0 0x200 -#define INT_SOURCE_CSR 0x200 +#define DMA_CSR0 0x200 +#define INT_SOURCE_CSR 0x200 typedef union _INT_SOURCE_CSR_STRUC { struct { UINT32 RxDelayINT:1; UINT32 TxDelayINT:1; UINT32 RxDone:1; UINT32 Ac0DmaDone:1;//4 - UINT32 Ac1DmaDone:1; - UINT32 Ac2DmaDone:1; - UINT32 Ac3DmaDone:1; - UINT32 HccaDmaDone:1; // bit7 - UINT32 MgmtDmaDone:1; - UINT32 MCUCommandINT:1;//bit 9 - UINT32 RxTxCoherent:1; - UINT32 TBTTInt:1; - UINT32 PreTBTT:1; - UINT32 TXFifoStatusInt:1;//FIFO Statistics is full, sw should read 0x171c - UINT32 AutoWakeup:1;//bit14 - UINT32 GPTimer:1; - UINT32 RxCoherent:1;//bit16 - UINT32 TxCoherent:1; - UINT32 :14; + UINT32 Ac1DmaDone:1; + UINT32 Ac2DmaDone:1; + UINT32 Ac3DmaDone:1; + UINT32 HccaDmaDone:1; // bit7 + UINT32 MgmtDmaDone:1; + UINT32 MCUCommandINT:1;//bit 9 + UINT32 RxTxCoherent:1; + UINT32 TBTTInt:1; + UINT32 PreTBTT:1; + UINT32 TXFifoStatusInt:1;//FIFO Statistics is full, sw should read 0x171c + UINT32 AutoWakeup:1;//bit14 + UINT32 GPTimer:1; + UINT32 RxCoherent:1;//bit16 + UINT32 TxCoherent:1; + UINT32 :14; } field; UINT32 word; } INT_SOURCE_CSR_STRUC, *PINT_SOURCE_CSR_STRUC; @@ -93,64 +175,62 @@ typedef union _INT_MASK_CSR_STRUC { UINT32 TxDelay:1; UINT32 RxDone:1; UINT32 Ac0DmaDone:1; - UINT32 Ac1DmaDone:1; - UINT32 Ac2DmaDone:1; - UINT32 Ac3DmaDone:1; - UINT32 HccaDmaDone:1; - UINT32 MgmtDmaDone:1; - UINT32 MCUCommandINT:1; - UINT32 :20; - UINT32 RxCoherent:1; - UINT32 TxCoherent:1; + UINT32 Ac1DmaDone:1; + UINT32 Ac2DmaDone:1; + UINT32 Ac3DmaDone:1; + UINT32 HccaDmaDone:1; + UINT32 MgmtDmaDone:1; + UINT32 MCUCommandINT:1; + UINT32 :20; + UINT32 RxCoherent:1; + UINT32 TxCoherent:1; } field; UINT32 word; } INT_MASK_CSR_STRUC, *PINT_MASK_CSR_STRUC; -#define WPDMA_GLO_CFG 0x208 +#define WPDMA_GLO_CFG 0x208 typedef union _WPDMA_GLO_CFG_STRUC { struct { UINT32 EnableTxDMA:1; UINT32 TxDMABusy:1; UINT32 EnableRxDMA:1; UINT32 RxDMABusy:1; - UINT32 WPDMABurstSIZE:2; - UINT32 EnTXWriteBackDDONE:1; - UINT32 BigEndian:1; - UINT32 RXHdrScater:8; - UINT32 HDR_SEG_LEN:16; + UINT32 WPDMABurstSIZE:2; + UINT32 EnTXWriteBackDDONE:1; + UINT32 BigEndian:1; + UINT32 RXHdrScater:8; + UINT32 HDR_SEG_LEN:16; } field; UINT32 word; } WPDMA_GLO_CFG_STRUC, *PWPDMA_GLO_CFG_STRUC; -#define WPDMA_RST_IDX 0x20c +#define WPDMA_RST_IDX 0x20c typedef union _WPDMA_RST_IDX_STRUC { struct { UINT32 RST_DTX_IDX0:1; UINT32 RST_DTX_IDX1:1; UINT32 RST_DTX_IDX2:1; UINT32 RST_DTX_IDX3:1; - UINT32 RST_DTX_IDX4:1; - UINT32 RST_DTX_IDX5:1; - UINT32 rsv:10; - UINT32 RST_DRX_IDX0:1; - UINT32 :15; + UINT32 RST_DTX_IDX4:1; + UINT32 RST_DTX_IDX5:1; + UINT32 rsv:10; + UINT32 RST_DRX_IDX0:1; + UINT32 :15; } field; UINT32 word; } WPDMA_RST_IDX_STRUC, *PWPDMA_RST_IDX_STRUC; - #define DELAY_INT_CFG 0x0210 typedef union _DELAY_INT_CFG_STRUC { struct { UINT32 RXMAX_PTIME:8; - UINT32 RXMAX_PINT:7; - UINT32 RXDLY_INT_EN:1; - UINT32 TXMAX_PTIME:8; - UINT32 TXMAX_PINT:7; - UINT32 TXDLY_INT_EN:1; + UINT32 RXMAX_PINT:7; + UINT32 RXDLY_INT_EN:1; + UINT32 TXMAX_PTIME:8; + UINT32 TXMAX_PINT:7; + UINT32 TXDLY_INT_EN:1; } field; UINT32 word; } DELAY_INT_CFG_STRUC, *PDELAY_INT_CFG_STRUC; - #define WMM_AIFSN_CFG 0x0214 typedef union _AIFSN_CSR_STRUC { struct { @@ -162,7 +242,6 @@ typedef union _AIFSN_CSR_STRUC { } field; UINT32 word; } AIFSN_CSR_STRUC, *PAIFSN_CSR_STRUC; - // // CWMIN_CSR: CWmin for each EDCA AC // @@ -193,6 +272,7 @@ typedef union _CWMAX_CSR_STRUC { UINT32 word; } CWMAX_CSR_STRUC, *PCWMAX_CSR_STRUC; + // // AC_TXOP_CSR0: AC_BK/AC_BE TXOP register // @@ -217,6 +297,7 @@ typedef union _AC_TXOP_CSR1_STRUC { UINT32 word; } AC_TXOP_CSR1_STRUC, *PAC_TXOP_CSR1_STRUC; + #define RINGREG_DIFF 0x10 #define GPIO_CTRL_CFG 0x0228 //MAC_CSR13 #define MCU_CMD_CFG 0x022c @@ -224,40 +305,41 @@ typedef union _AC_TXOP_CSR1_STRUC { #define TX_MAX_CNT0 0x0234 #define TX_CTX_IDX0 0x0238 #define TX_DTX_IDX0 0x023c -#define TX_BASE_PTR1 0x0240 //AC_BE base address +#define TX_BASE_PTR1 0x0240 //AC_BE base address #define TX_MAX_CNT1 0x0244 #define TX_CTX_IDX1 0x0248 #define TX_DTX_IDX1 0x024c -#define TX_BASE_PTR2 0x0250 //AC_VI base address +#define TX_BASE_PTR2 0x0250 //AC_VI base address #define TX_MAX_CNT2 0x0254 #define TX_CTX_IDX2 0x0258 #define TX_DTX_IDX2 0x025c -#define TX_BASE_PTR3 0x0260 //AC_VO base address +#define TX_BASE_PTR3 0x0260 //AC_VO base address #define TX_MAX_CNT3 0x0264 #define TX_CTX_IDX3 0x0268 #define TX_DTX_IDX3 0x026c -#define TX_BASE_PTR4 0x0270 //HCCA base address +#define TX_BASE_PTR4 0x0270 //HCCA base address #define TX_MAX_CNT4 0x0274 #define TX_CTX_IDX4 0x0278 #define TX_DTX_IDX4 0x027c -#define TX_BASE_PTR5 0x0280 //MGMT base address +#define TX_BASE_PTR5 0x0280 //MGMT base address #define TX_MAX_CNT5 0x0284 #define TX_CTX_IDX5 0x0288 #define TX_DTX_IDX5 0x028c #define TX_MGMTMAX_CNT TX_MAX_CNT5 #define TX_MGMTCTX_IDX TX_CTX_IDX5 #define TX_MGMTDTX_IDX TX_DTX_IDX5 -#define RX_BASE_PTR 0x0290 //RX base address +#define RX_BASE_PTR 0x0290 //RX base address #define RX_MAX_CNT 0x0294 #define RX_CRX_IDX 0x0298 #define RX_DRX_IDX 0x029c -#define USB_DMA_CFG 0x02a0 + +#define USB_DMA_CFG 0x02a0 typedef union _USB_DMA_CFG_STRUC { struct { UINT32 RxBulkAggTOut:8; //Rx Bulk Aggregation TimeOut in unit of 33ns UINT32 RxBulkAggLmt:8; //Rx Bulk Aggregation Limit in unit of 256 bytes - UINT32 phyclear:1; //phy watch dog enable. write 1 + UINT32 phyclear:1; //phy watch dog enable. write 1 UINT32 rsv:2; UINT32 TxClear:1; //Clear USB DMA TX path UINT32 TxopHalt:1; //Halt TXOP count down when TX buffer is full. @@ -266,54 +348,44 @@ typedef union _USB_DMA_CFG_STRUC { UINT32 TxBulkEn:1; //Enable USB DMA Tx UINT32 EpoutValid:6; //OUT endpoint data valid UINT32 RxBusy:1; //USB DMA RX FSM busy - UINT32 TxBusy:1; //USB DMA TX FSM busy + UINT32 TxBusy:1; //USB DMA TX FSM busy } field; UINT32 word; } USB_DMA_CFG_STRUC, *PUSB_DMA_CFG_STRUC; + // // 3 PBF registers // // // Most are for debug. Driver doesn't touch PBF register. -#define PBF_SYS_CTRL 0x0400 -#define PBF_CFG 0x0408 -#define PBF_MAX_PCNT 0x040C -#define PBF_CTRL 0x0410 -#define PBF_INT_STA 0x0414 -#define PBF_INT_ENA 0x0418 -#define TXRXQ_PCNT 0x0438 -#define PBF_DBG 0x043c -#define PBF_CAP_CTRL 0x0440 - +#define PBF_SYS_CTRL 0x0400 +#define PBF_CFG 0x0408 +#define PBF_MAX_PCNT 0x040C +#define PBF_CTRL 0x0410 +#define PBF_INT_STA 0x0414 +#define PBF_INT_ENA 0x0418 +#define TXRXQ_PCNT 0x0438 +#define PBF_DBG 0x043c +#define PBF_CAP_CTRL 0x0440 + +#ifdef RT30xx +#ifdef RTMP_EFUSE_SUPPORT // eFuse registers -#define EFUSE_CTRL 0x0580 -#define EFUSE_DATA0 0x0590 -#define EFUSE_DATA1 0x0594 -#define EFUSE_DATA2 0x0598 -#define EFUSE_DATA3 0x059c -#define EFUSE_USAGE_MAP_START 0x2d0 -#define EFUSE_USAGE_MAP_END 0x2fc -#define EFUSE_TAG 0x2fe -#define EFUSE_USAGE_MAP_SIZE 45 - -typedef union _EFUSE_CTRL_STRUC { - struct { - UINT32 EFSROM_AOUT:6; - UINT32 EFSROM_MODE:2; - UINT32 EFSROM_LDO_OFF_TIME:6; - UINT32 EFSROM_LDO_ON_TIME:2; - UINT32 EFSROM_AIN:10; - UINT32 RESERVED:4; - UINT32 EFSROM_KICK:1; - UINT32 SEL_EFUSE:1; - } field; - UINT32 word; -} EFUSE_CTRL_STRUC, *PEFUSE_CTRL_STRUC; - -#define LDO_CFG0 0x05d4 +#define EFUSE_CTRL 0x0580 +#define EFUSE_DATA0 0x0590 +#define EFUSE_DATA1 0x0594 +#define EFUSE_DATA2 0x0598 +#define EFUSE_DATA3 0x059c +#endif // RTMP_EFUSE_SUPPORT // +#endif // RT30xx // + +#define OSC_CTRL 0x5a4 +#define PCIE_PHY_TX_ATTENUATION_CTRL 0x05C8 +#define LDO_CFG0 0x05d4 #define GPIO_SWITCH 0x05dc + // // 4 MAC registers // @@ -328,10 +400,9 @@ typedef union _ASIC_VER_ID_STRUC { } field; UINT32 word; } ASIC_VER_ID_STRUC, *PASIC_VER_ID_STRUC; - #define MAC_SYS_CTRL 0x1004 //MAC_CSR1 -#define MAC_ADDR_DW0 0x1008 // MAC ADDR DW0 -#define MAC_ADDR_DW1 0x100c // MAC ADDR DW1 +#define MAC_ADDR_DW0 0x1008 // MAC ADDR DW0 +#define MAC_ADDR_DW1 0x100c // MAC ADDR DW1 // // MAC_CSR2: STA MAC register 0 // @@ -358,8 +429,8 @@ typedef union _MAC_DW1_STRUC { UINT32 word; } MAC_DW1_STRUC, *PMAC_DW1_STRUC; -#define MAC_BSSID_DW0 0x1010 // MAC BSSID DW0 -#define MAC_BSSID_DW1 0x1014 // MAC BSSID DW1 +#define MAC_BSSID_DW0 0x1010 // MAC BSSID DW0 +#define MAC_BSSID_DW1 0x1014 // MAC BSSID DW1 // // MAC_CSR5: BSSID register 1 @@ -368,7 +439,7 @@ typedef union _MAC_CSR5_STRUC { struct { UCHAR Byte4; // BSSID byte 4 UCHAR Byte5; // BSSID byte 5 - USHORT BssIdMask:2; // 0: one BSSID, 10: 4 BSSID, 01: 2 BSSID , 11: 8BSSID + USHORT BssIdMask:2; // 0: one BSSID, 10: 4 BSSID, 01: 2 BSSID , 11: 8BSSID USHORT MBssBcnNum:3; USHORT Rsvd:11; } field; @@ -376,7 +447,7 @@ typedef union _MAC_CSR5_STRUC { } MAC_CSR5_STRUC, *PMAC_CSR5_STRUC; #define MAX_LEN_CFG 0x1018 // rt2860b max 16k bytes. bit12:13 Maximum PSDU length (power factor) 0:2^13, 1:2^14, 2:2^15, 3:2^16 -#define BBP_CSR_CFG 0x101c // +#define BBP_CSR_CFG 0x101c // // // BBP_CSR_CFG: BBP serial control register // @@ -392,8 +463,7 @@ typedef union _BBP_CSR_CFG_STRUC { } field; UINT32 word; } BBP_CSR_CFG_STRUC, *PBBP_CSR_CFG_STRUC; - -#define RF_CSR_CFG0 0x1020 +#define RF_CSR_CFG0 0x1020 // // RF_CSR_CFG: RF control register // @@ -407,8 +477,7 @@ typedef union _RF_CSR_CFG0_STRUC { } field; UINT32 word; } RF_CSR_CFG0_STRUC, *PRF_CSR_CFG0_STRUC; - -#define RF_CSR_CFG1 0x1024 +#define RF_CSR_CFG1 0x1024 typedef union _RF_CSR_CFG1_STRUC { struct { UINT32 RegIdAndContent:24; // Register value to program into BBP @@ -417,8 +486,7 @@ typedef union _RF_CSR_CFG1_STRUC { } field; UINT32 word; } RF_CSR_CFG1_STRUC, *PRF_CSR_CFG1_STRUC; - -#define RF_CSR_CFG2 0x1028 // +#define RF_CSR_CFG2 0x1028 // typedef union _RF_CSR_CFG2_STRUC { struct { UINT32 RegIdAndContent:24; // Register value to program into BBP @@ -426,8 +494,7 @@ typedef union _RF_CSR_CFG2_STRUC { } field; UINT32 word; } RF_CSR_CFG2_STRUC, *PRF_CSR_CFG2_STRUC; - -#define LED_CFG 0x102c // MAC_CSR14 +#define LED_CFG 0x102c // MAC_CSR14 typedef union _LED_CFG_STRUC { struct { UINT32 OnPeriod:8; // blinking on period unit 1ms @@ -442,7 +509,6 @@ typedef union _LED_CFG_STRUC { } field; UINT32 word; } LED_CFG_STRUC, *PLED_CFG_STRUC; - // // 4.2 MAC TIMING configuration registers (offset:0x1100) // @@ -461,7 +527,7 @@ typedef union _IFS_SLOT_CFG_STRUC { #define BKOFF_SLOT_CFG 0x1104 // mac_csr9 last 8 bits #define NAV_TIME_CFG 0x1108 // NAV (MAC_CSR15) -#define CH_TIME_CFG 0x110C // Count as channel busy +#define CH_TIME_CFG 0x110C // Count as channel busy #define PBF_LIFE_TIMER 0x1110 //TX/RX MPDU timestamp timer (free run)Unit: 1us #define BCN_TIME_CFG 0x1114 // TXRX_CSR9 @@ -483,15 +549,14 @@ typedef union _BCN_TIME_CFG_STRUC { } field; UINT32 word; } BCN_TIME_CFG_STRUC, *PBCN_TIME_CFG_STRUC; - -#define TBTT_SYNC_CFG 0x1118 // txrx_csr10 -#define TSF_TIMER_DW0 0x111C // Local TSF timer lsb 32 bits. Read-only -#define TSF_TIMER_DW1 0x1120 // msb 32 bits. Read-only. -#define TBTT_TIMER 0x1124 // TImer remains till next TBTT. Read-only. TXRX_CSR14 -#define INT_TIMER_CFG 0x1128 // -#define INT_TIMER_EN 0x112c // GP-timer and pre-tbtt Int enable -#define CH_IDLE_STA 0x1130 // channel idle time -#define CH_BUSY_STA 0x1134 // channle busy time +#define TBTT_SYNC_CFG 0x1118 // txrx_csr10 +#define TSF_TIMER_DW0 0x111C // Local TSF timer lsb 32 bits. Read-only +#define TSF_TIMER_DW1 0x1120 // msb 32 bits. Read-only. +#define TBTT_TIMER 0x1124 // TImer remains till next TBTT. Read-only. TXRX_CSR14 +#define INT_TIMER_CFG 0x1128 // +#define INT_TIMER_EN 0x112c // GP-timer and pre-tbtt Int enable +#define CH_IDLE_STA 0x1130 // channel idle time +#define CH_BUSY_STA 0x1134 // channle busy time // // 4.2 MAC POWER configuration registers (offset:0x1200) // @@ -510,7 +575,6 @@ typedef union _AUTO_WAKEUP_STRUC { } field; UINT32 word; } AUTO_WAKEUP_STRUC, *PAUTO_WAKEUP_STRUC; - // // 4.3 MAC TX configuration registers (offset:0x1300) // @@ -554,7 +618,6 @@ typedef union _TX_RTS_CFG_STRUC { } field; UINT32 word; } TX_RTS_CFG_STRUC, *PTX_RTS_CFG_STRUC; - #define TX_TIMEOUT_CFG 0x1348 typedef union _TX_TIMEOUT_CFG_STRUC { struct { @@ -566,7 +629,6 @@ typedef union _TX_TIMEOUT_CFG_STRUC { } field; UINT32 word; } TX_TIMEOUT_CFG_STRUC, *PTX_TIMEOUT_CFG_STRUC; - #define TX_RTY_CFG 0x134c typedef union PACKED _TX_RTY_CFG_STRUC { struct { @@ -580,7 +642,6 @@ typedef union PACKED _TX_RTY_CFG_STRUC { } field; UINT32 word; } TX_RTY_CFG_STRUC, *PTX_RTY_CFG_STRUC; - #define TX_LINK_CFG 0x1350 typedef union PACKED _TX_LINK_CFG_STRUC { struct PACKED { @@ -596,7 +657,6 @@ typedef union PACKED _TX_LINK_CFG_STRUC { } field; UINT32 word; } TX_LINK_CFG_STRUC, *PTX_LINK_CFG_STRUC; - #define HT_FBK_CFG0 0x1354 typedef union PACKED _HT_FBK_CFG0_STRUC { struct { @@ -611,7 +671,6 @@ typedef union PACKED _HT_FBK_CFG0_STRUC { } field; UINT32 word; } HT_FBK_CFG0_STRUC, *PHT_FBK_CFG0_STRUC; - #define HT_FBK_CFG1 0x1358 typedef union _HT_FBK_CFG1_STRUC { struct { @@ -626,7 +685,6 @@ typedef union _HT_FBK_CFG1_STRUC { } field; UINT32 word; } HT_FBK_CFG1_STRUC, *PHT_FBK_CFG1_STRUC; - #define LG_FBK_CFG0 0x135c typedef union _LG_FBK_CFG0_STRUC { struct { @@ -641,7 +699,6 @@ typedef union _LG_FBK_CFG0_STRUC { } field; UINT32 word; } LG_FBK_CFG0_STRUC, *PLG_FBK_CFG0_STRUC; - #define LG_FBK_CFG1 0x1360 typedef union _LG_FBK_CFG1_STRUC { struct { @@ -654,6 +711,7 @@ typedef union _LG_FBK_CFG1_STRUC { UINT32 word; } LG_FBK_CFG1_STRUC, *PLG_FBK_CFG1_STRUC; + //======================================================= //================ Protection Paramater================================ //======================================================= @@ -770,7 +828,6 @@ typedef union _RX_STA_CNT2_STRUC { } field; UINT32 word; } RX_STA_CNT2_STRUC, *PRX_STA_CNT2_STRUC; - #define TX_STA_CNT0 0x170C // // // STA_CSR3: TX Beacon count @@ -782,7 +839,6 @@ typedef union _TX_STA_CNT0_STRUC { } field; UINT32 word; } TX_STA_CNT0_STRUC, *PTX_STA_CNT0_STRUC; - #define TX_STA_CNT1 0x1710 // // // TX_STA_CNT1: TX tx count @@ -794,7 +850,6 @@ typedef union _TX_STA_CNT1_STRUC { } field; UINT32 word; } TX_STA_CNT1_STRUC, *PTX_STA_CNT1_STRUC; - #define TX_STA_CNT2 0x1714 // // // TX_STA_CNT2: TX tx count @@ -806,18 +861,17 @@ typedef union _TX_STA_CNT2_STRUC { } field; UINT32 word; } TX_STA_CNT2_STRUC, *PTX_STA_CNT2_STRUC; - #define TX_STA_FIFO 0x1718 // // // TX_STA_FIFO_STRUC: TX Result for specific PID status fifo register // typedef union PACKED _TX_STA_FIFO_STRUC { struct { - UINT32 bValid:1; // 1:This register contains a valid TX result - UINT32 PidType:4; - UINT32 TxSuccess:1; // Tx No retry success - UINT32 TxAggre:1; // Tx Retry Success - UINT32 TxAckRequired:1; // Tx fail + UINT32 bValid:1; // 1:This register contains a valid TX result + UINT32 PidType:4; + UINT32 TxSuccess:1; // Tx No retry success + UINT32 TxAggre:1; // Tx Retry Success + UINT32 TxAckRequired:1; // Tx fail UINT32 wcid:8; //wireless client index // UINT32 SuccessRate:16; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16. UINT32 SuccessRate:13; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16. @@ -826,7 +880,6 @@ typedef union PACKED _TX_STA_FIFO_STRUC { } field; UINT32 word; } TX_STA_FIFO_STRUC, *PTX_STA_FIFO_STRUC; - // Debug counter #define TX_AGG_CNT 0x171c typedef union _TX_AGG_CNT_STRUC { @@ -836,7 +889,6 @@ typedef union _TX_AGG_CNT_STRUC { } field; UINT32 word; } TX_AGG_CNT_STRUC, *PTX_AGG_CNT_STRUC; - // Debug counter #define TX_AGG_CNT0 0x1720 typedef union _TX_AGG_CNT0_STRUC { @@ -846,7 +898,6 @@ typedef union _TX_AGG_CNT0_STRUC { } field; UINT32 word; } TX_AGG_CNT0_STRUC, *PTX_AGG_CNT0_STRUC; - // Debug counter #define TX_AGG_CNT1 0x1724 typedef union _TX_AGG_CNT1_STRUC { @@ -856,7 +907,6 @@ typedef union _TX_AGG_CNT1_STRUC { } field; UINT32 word; } TX_AGG_CNT1_STRUC, *PTX_AGG_CNT1_STRUC; - #define TX_AGG_CNT2 0x1728 typedef union _TX_AGG_CNT2_STRUC { struct { @@ -865,7 +915,6 @@ typedef union _TX_AGG_CNT2_STRUC { } field; UINT32 word; } TX_AGG_CNT2_STRUC, *PTX_AGG_CNT2_STRUC; - // Debug counter #define TX_AGG_CNT3 0x172c typedef union _TX_AGG_CNT3_STRUC { @@ -875,7 +924,6 @@ typedef union _TX_AGG_CNT3_STRUC { } field; UINT32 word; } TX_AGG_CNT3_STRUC, *PTX_AGG_CNT3_STRUC; - // Debug counter #define TX_AGG_CNT4 0x1730 typedef union _TX_AGG_CNT4_STRUC { @@ -885,7 +933,6 @@ typedef union _TX_AGG_CNT4_STRUC { } field; UINT32 word; } TX_AGG_CNT4_STRUC, *PTX_AGG_CNT4_STRUC; - #define TX_AGG_CNT5 0x1734 typedef union _TX_AGG_CNT5_STRUC { struct { @@ -894,7 +941,6 @@ typedef union _TX_AGG_CNT5_STRUC { } field; UINT32 word; } TX_AGG_CNT5_STRUC, *PTX_AGG_CNT5_STRUC; - #define TX_AGG_CNT6 0x1738 typedef union _TX_AGG_CNT6_STRUC { struct { @@ -903,7 +949,6 @@ typedef union _TX_AGG_CNT6_STRUC { } field; UINT32 word; } TX_AGG_CNT6_STRUC, *PTX_AGG_CNT6_STRUC; - #define TX_AGG_CNT7 0x173c typedef union _TX_AGG_CNT7_STRUC { struct { @@ -912,7 +957,6 @@ typedef union _TX_AGG_CNT7_STRUC { } field; UINT32 word; } TX_AGG_CNT7_STRUC, *PTX_AGG_CNT7_STRUC; - #define MPDU_DENSITY_CNT 0x1740 typedef union _MPDU_DEN_CNT_STRUC { struct { @@ -921,7 +965,6 @@ typedef union _MPDU_DEN_CNT_STRUC { } field; UINT32 word; } MPDU_DEN_CNT_STRUC, *PMPDU_DEN_CNT_STRUC; - // // TXRX control registers - base address 0x3000 // @@ -940,13 +983,14 @@ typedef union _MPDU_DEN_CNT_STRUC { #define HW_IVEIV_ENTRY_SIZE 8 #define MAC_WCID_ATTRIBUTE_BASE 0x6800 // 4-byte * 256-entry = -byte #define HW_WCID_ATTRI_SIZE 4 -#define WCID_RESERVED 0x6bfc +#define WCID_RESERVED 0x6bfc #define SHARED_KEY_TABLE_BASE 0x6c00 // 32-byte * 16-entry = 512-byte #define SHARED_KEY_MODE_BASE 0x7000 // 32-byte * 16-entry = 512-byte #define HW_SHARED_KEY_MODE_SIZE 4 #define SHAREDKEYTABLE 0 #define PAIRWISEKEYTABLE 1 + typedef union _SHAREDKEY_MODE_STRUC { struct { UINT32 Bss0Key0CipherAlg:3; @@ -968,7 +1012,6 @@ typedef union _SHAREDKEY_MODE_STRUC { } field; UINT32 word; } SHAREDKEY_MODE_STRUC, *PSHAREDKEY_MODE_STRUC; - // 64-entry for pairwise key table typedef struct _HW_WCID_ENTRY { // 8-byte per entry UCHAR Address[6]; @@ -976,260 +1019,6 @@ typedef struct _HW_WCID_ENTRY { // 8-byte per entry } HW_WCID_ENTRY, PHW_WCID_ENTRY; - -// -// Other on-chip shared memory space, base = 0x2000 -// - -// CIS space - base address = 0x2000 -#define HW_CIS_BASE 0x2000 - -// Carrier-sense CTS frame base address. It's where mac stores carrier-sense frame for carrier-sense function. -#define HW_CS_CTS_BASE 0x7700 -// DFS CTS frame base address. It's where mac stores CTS frame for DFS. -#define HW_DFS_CTS_BASE 0x7780 -#define HW_CTS_FRAME_SIZE 0x80 - -// 2004-11-08 john - since NULL frame won't be that long (256 byte). We steal 16 tail bytes -// to save debugging settings -#define HW_DEBUG_SETTING_BASE 0x77f0 // 0x77f0~0x77ff total 16 bytes -#define HW_DEBUG_SETTING_BASE2 0x7770 // 0x77f0~0x77ff total 16 bytes - -// In order to support maximum 8 MBSS and its maximum length is 512 for each beacon -// Three section discontinue memory segments will be used. -// 1. The original region for BCN 0~3 -// 2. Extract memory from FCE table for BCN 4~5 -// 3. Extract memory from Pair-wise key table for BCN 6~7 -// It occupied those memory of wcid 238~253 for BCN 6 -// and wcid 222~237 for BCN 7 -#define HW_BEACON_MAX_SIZE 0x1000 /* unit: byte */ -#define HW_BEACON_BASE0 0x7800 -#define HW_BEACON_BASE1 0x7A00 -#define HW_BEACON_BASE2 0x7C00 -#define HW_BEACON_BASE3 0x7E00 -#define HW_BEACON_BASE4 0x7200 -#define HW_BEACON_BASE5 0x7400 -#define HW_BEACON_BASE6 0x5DC0 -#define HW_BEACON_BASE7 0x5BC0 - -#define HW_BEACON_MAX_COUNT 8 -#define HW_BEACON_OFFSET 0x0200 -#define HW_BEACON_CONTENT_LEN (HW_BEACON_OFFSET - TXWI_SIZE) - -// HOST-MCU shared memory - base address = 0x2100 -#define HOST_CMD_CSR 0x404 -#define H2M_MAILBOX_CSR 0x7010 -#define H2M_MAILBOX_CID 0x7014 -#define H2M_MAILBOX_STATUS 0x701c -#define H2M_INT_SRC 0x7024 -#define H2M_BBP_AGENT 0x7028 -#define M2H_CMD_DONE_CSR 0x000c -#define MCU_TXOP_ARRAY_BASE 0x000c // TODO: to be provided by Albert -#define MCU_TXOP_ENTRY_SIZE 32 // TODO: to be provided by Albert -#define MAX_NUM_OF_TXOP_ENTRY 16 // TODO: must be same with 8051 firmware -#define MCU_MBOX_VERSION 0x01 // TODO: to be confirmed by Albert -#define MCU_MBOX_VERSION_OFFSET 5 // TODO: to be provided by Albert - -// -// Host DMA registers - base address 0x200 . TX0-3=EDCAQid0-3, TX4=HCCA, TX5=MGMT, -// -// -// DMA RING DESCRIPTOR -// -#define E2PROM_CSR 0x0004 -#define IO_CNTL_CSR 0x77d0 - -#ifdef RT2860 -// 8051 firmware image for RT2860 - base address = 0x4000 -#define FIRMWARE_IMAGE_BASE 0x2000 -#define MAX_FIRMWARE_IMAGE_SIZE 0x2000 // 8kbyte -#endif -#ifdef RT2870 -// 8051 firmware image for usb - use last-half base address = 0x3000 -#define FIRMWARE_IMAGE_BASE 0x3000 -#define MAX_FIRMWARE_IMAGE_SIZE 0x1000 // 4kbyte -#endif // RT2870 // - -// ================================================================ -// Tx / Rx / Mgmt ring descriptor definition -// ================================================================ - -// the following PID values are used to mark outgoing frame type in TXD->PID so that -// proper TX statistics can be collected based on these categories -// b3-2 of PID field - -#define PID_MGMT 0x05 -#define PID_BEACON 0x0c -#define PID_DATA_NORMALUCAST 0x02 -#define PID_DATA_AMPDU 0x04 -#define PID_DATA_NO_ACK 0x08 -#define PID_DATA_NOT_NORM_ACK 0x03 -// value domain of pTxD->HostQId (4-bit: 0~15) -#define QID_AC_BK 1 // meet ACI definition in 802.11e -#define QID_AC_BE 0 // meet ACI definition in 802.11e -#define QID_AC_VI 2 -#define QID_AC_VO 3 -#define QID_HCCA 4 -#define NUM_OF_TX_RING 5 -#define QID_MGMT 13 -#define QID_RX 14 -#define QID_OTHER 15 - - -// ------------------------------------------------------ -// BBP & RF definition -// ------------------------------------------------------ -#define BUSY 1 -#define IDLE 0 - -#define RF_R00 0 -#define RF_R01 1 -#define RF_R02 2 -#define RF_R03 3 -#define RF_R04 4 -#define RF_R05 5 -#define RF_R06 6 -#define RF_R07 7 -#define RF_R08 8 -#define RF_R09 9 -#define RF_R10 10 -#define RF_R11 11 -#define RF_R12 12 -#define RF_R13 13 -#define RF_R14 14 -#define RF_R15 15 -#define RF_R16 16 -#define RF_R17 17 -#define RF_R18 18 -#define RF_R19 19 -#define RF_R20 20 -#define RF_R21 21 -#define RF_R22 22 -#define RF_R23 23 -#define RF_R24 24 -#define RF_R25 25 -#define RF_R26 26 -#define RF_R27 27 -#define RF_R28 28 -#define RF_R29 29 -#define RF_R30 30 -#define RF_R31 31 - -#define BBP_R0 0 // version -#define BBP_R1 1 // TSSI -#define BBP_R2 2 // TX configure -#define BBP_R3 3 -#define BBP_R4 4 -#define BBP_R5 5 -#define BBP_R6 6 -#define BBP_R14 14 // RX configure -#define BBP_R16 16 -#define BBP_R17 17 // RX sensibility -#define BBP_R18 18 -#define BBP_R21 21 -#define BBP_R22 22 -#define BBP_R24 24 -#define BBP_R25 25 -#define BBP_R31 31 -#define BBP_R49 49 //TSSI -#define BBP_R50 50 -#define BBP_R51 51 -#define BBP_R52 52 -#define BBP_R55 55 -#define BBP_R62 62 // Rx SQ0 Threshold HIGH -#define BBP_R63 63 -#define BBP_R64 64 -#define BBP_R65 65 -#define BBP_R66 66 -#define BBP_R67 67 -#define BBP_R68 68 -#define BBP_R69 69 -#define BBP_R70 70 // Rx AGC SQ CCK Xcorr threshold -#define BBP_R73 73 -#define BBP_R75 75 -#define BBP_R77 77 -#define BBP_R79 79 -#define BBP_R80 80 -#define BBP_R81 81 -#define BBP_R82 82 -#define BBP_R83 83 -#define BBP_R84 84 -#define BBP_R86 86 -#define BBP_R91 91 -#define BBP_R92 92 -#define BBP_R94 94 // Tx Gain Control -#define BBP_R103 103 -#define BBP_R105 105 -#define BBP_R113 113 -#define BBP_R114 114 -#define BBP_R115 115 -#define BBP_R116 116 -#define BBP_R117 117 -#define BBP_R118 118 -#define BBP_R119 119 -#define BBP_R120 120 -#define BBP_R121 121 -#define BBP_R122 122 -#define BBP_R123 123 -#define BBP_R138 138 // add by johnli, RF power sequence setup, ADC dynamic on/off control - - -#define BBPR94_DEFAULT 0x06 // Add 1 value will gain 1db - -#define RSSI_FOR_VERY_LOW_SENSIBILITY -35 -#define RSSI_FOR_LOW_SENSIBILITY -58 -#define RSSI_FOR_MID_LOW_SENSIBILITY -80 -#define RSSI_FOR_MID_SENSIBILITY -90 - -//------------------------------------------------------------------------- -// EEPROM definition -//------------------------------------------------------------------------- -#define EEDO 0x08 -#define EEDI 0x04 -#define EECS 0x02 -#define EESK 0x01 -#define EERL 0x80 - -#define EEPROM_WRITE_OPCODE 0x05 -#define EEPROM_READ_OPCODE 0x06 -#define EEPROM_EWDS_OPCODE 0x10 -#define EEPROM_EWEN_OPCODE 0x13 - -#define NUM_EEPROM_BBP_PARMS 19 // Include NIC Config 0, 1, CR, TX ALC step, BBPs -#define NUM_EEPROM_TX_G_PARMS 7 -#define EEPROM_NIC1_OFFSET 0x34 // The address is from NIC config 0, not BBP register ID -#define EEPROM_NIC2_OFFSET 0x36 // The address is from NIC config 0, not BBP register ID -#define EEPROM_BBP_BASE_OFFSET 0xf0 // The address is from NIC config 0, not BBP register ID -#define EEPROM_G_TX_PWR_OFFSET 0x52 -#define EEPROM_G_TX2_PWR_OFFSET 0x60 -#define EEPROM_LED1_OFFSET 0x3c -#define EEPROM_LED2_OFFSET 0x3e -#define EEPROM_LED3_OFFSET 0x40 -#define EEPROM_LNA_OFFSET 0x44 -#define EEPROM_RSSI_BG_OFFSET 0x46 -#define EEPROM_RSSI_A_OFFSET 0x4a -#define EEPROM_DEFINE_MAX_TXPWR 0x4e -#define EEPROM_TXPOWER_BYRATE_20MHZ_2_4G 0xde // 20MHZ 2.4G tx power. -#define EEPROM_TXPOWER_BYRATE_40MHZ_2_4G 0xee // 40MHZ 2.4G tx power. -#define EEPROM_TXPOWER_BYRATE_20MHZ_5G 0xfa // 20MHZ 5G tx power. -#define EEPROM_TXPOWER_BYRATE_40MHZ_5G 0x10a // 40MHZ 5G tx power. -#define EEPROM_A_TX_PWR_OFFSET 0x78 -#define EEPROM_A_TX2_PWR_OFFSET 0xa6 -#define EEPROM_VERSION_OFFSET 0x02 -#define EEPROM_FREQ_OFFSET 0x3a -#define EEPROM_TXPOWER_BYRATE 0xde // 20MHZ power. -#define EEPROM_TXPOWER_DELTA 0x50 // 20MHZ AND 40 MHZ use different power. This is delta in 40MHZ. -#define VALID_EEPROM_VERSION 1 - -// PairKeyMode definition -#define PKMODE_NONE 0 -#define PKMODE_WEP64 1 -#define PKMODE_WEP128 2 -#define PKMODE_TKIP 3 -#define PKMODE_AES 4 -#define PKMODE_CKIP64 5 -#define PKMODE_CKIP128 6 -#define PKMODE_TKIP_NO_MIC 7 // MIC appended by driver: not a valid value in hardware key table - // ================================================================================= // WCID format // ================================================================================= @@ -1259,148 +1048,6 @@ typedef struct _MAC_ATTRIBUTE_STRUC { UINT32 rsv:22; } MAC_ATTRIBUTE_STRUC, *PMAC_ATTRIBUTE_STRUC; -// ================================================================================= -// TX / RX ring descriptor format -// ================================================================================= - -// the first 24-byte in TXD is called TXINFO and will be DMAed to MAC block through TXFIFO. -// MAC block use this TXINFO to control the transmission behavior of this frame. -#define FIFO_MGMT 0 -#define FIFO_HCCA 1 -#define FIFO_EDCA 2 - -// -// TX descriptor format, Tx ring, Mgmt Ring -// -typedef struct PACKED _TXD_STRUC { - // Word 0 - UINT32 SDPtr0; - // Word 1 - UINT32 SDLen1:14; - UINT32 LastSec1:1; - UINT32 Burst:1; - UINT32 SDLen0:14; - UINT32 LastSec0:1; - UINT32 DMADONE:1; - //Word2 - UINT32 SDPtr1; - //Word3 - UINT32 rsv2:24; - UINT32 WIV:1; // Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition - UINT32 QSEL:2; // select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA - UINT32 rsv:2; - UINT32 TCO:1; // - UINT32 UCO:1; // - UINT32 ICO:1; // -} TXD_STRUC, *PTXD_STRUC; - -// -// TXD Wireless Information format for Tx ring and Mgmt Ring -// -//txop : for txop mode -// 0:txop for the MPDU frame will be handles by ASIC by register -// 1/2/3:the MPDU frame is send after PIFS/backoff/SIFS -typedef struct PACKED _TXWI_STRUC { - // Word 0 - UINT32 FRAG:1; // 1 to inform TKIP engine this is a fragment. - UINT32 MIMOps:1; // the remote peer is in dynamic MIMO-PS mode - UINT32 CFACK:1; - UINT32 TS:1; - - UINT32 AMPDU:1; - UINT32 MpduDensity:3; - UINT32 txop:2; //FOR "THIS" frame. 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs only when previous frame exchange is successful. - UINT32 rsv:6; - - UINT32 MCS:7; - UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz - UINT32 ShortGI:1; - UINT32 STBC:2; // 1: STBC support MCS =0-7, 2,3 : RESERVE - UINT32 Ifs:1; // - UINT32 rsv2:1; - UINT32 TxBF:1; // 3*3 - UINT32 PHYMODE:2; - // Word 1 - UINT32 ACK:1; - UINT32 NSEQ:1; - UINT32 BAWinSize:6; - UINT32 WirelessCliID:8; - UINT32 MPDUtotalByteCount:12; - UINT32 PacketId:4; - //Word2 - UINT32 IV; - //Word3 - UINT32 EIV; -} TXWI_STRUC, *PTXWI_STRUC; - -// -// Rx descriptor format, Rx Ring -// -#ifdef RT2860 -typedef struct PACKED _RXD_STRUC { - // Word 0 - UINT32 SDP0; - // Word 1 - UINT32 SDL1:14; - UINT32 Rsv:2; - UINT32 SDL0:14; - UINT32 LS0:1; - UINT32 DDONE:1; - // Word 2 - UINT32 SDP1; - // Word 3 - UINT32 BA:1; - UINT32 DATA:1; - UINT32 NULLDATA:1; - UINT32 FRAG:1; - UINT32 U2M:1; // 1: this RX frame is unicast to me - UINT32 Mcast:1; // 1: this is a multicast frame - UINT32 Bcast:1; // 1: this is a broadcast frame - UINT32 MyBss:1; // 1: this frame belongs to the same BSSID - UINT32 Crc:1; // 1: CRC error - UINT32 CipherErr:2; // 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid - UINT32 AMSDU:1; // rx with 802.3 header, not 802.11 header. - UINT32 HTC:1; - UINT32 RSSI:1; - UINT32 L2PAD:1; - UINT32 AMPDU:1; - UINT32 Decrypted:1; // this frame is being decrypted. - UINT32 PlcpSignal:1; // To be moved - UINT32 PlcpRssil:1;// To be moved - UINT32 Rsv1:13; -} RXD_STRUC, *PRXD_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC; -#endif /* RT2860 */ - -// -// RXWI wireless information format, in PBF. invisible in driver. -// -typedef struct PACKED _RXWI_STRUC { - // Word 0 - UINT32 WirelessCliID:8; - UINT32 KeyIndex:2; - UINT32 BSSID:3; - UINT32 UDF:3; - UINT32 MPDUtotalByteCount:12; - UINT32 TID:4; - // Word 1 - UINT32 FRAG:4; - UINT32 SEQUENCE:12; - UINT32 MCS:7; - UINT32 BW:1; - UINT32 ShortGI:1; - UINT32 STBC:2; - UINT32 rsv:3; - UINT32 PHYMODE:2; // 1: this RX frame is unicast to me - //Word2 - UINT32 RSSI0:8; - UINT32 RSSI1:8; - UINT32 RSSI2:8; - UINT32 rsv1:8; - //Word3 - UINT32 SNR0:8; - UINT32 SNR1:8; - UINT32 rsv2:16; -} RXWI_STRUC, *PRXWI_STRUC; // ================================================================================= // HOST-MCU communication data structure @@ -1432,22 +1079,6 @@ typedef union _M2H_CMD_DONE_STRUC { UINT32 word; } M2H_CMD_DONE_STRUC, *PM2H_CMD_DONE_STRUC; -// -// MCU_LEDCS: MCU LED Control Setting. -// -typedef union _MCU_LEDCS_STRUC { - struct { - UCHAR LedMode:7; - UCHAR Polarity:1; - } field; - UCHAR word; -} MCU_LEDCS_STRUC, *PMCU_LEDCS_STRUC; - -// ================================================================================= -// Register format -// ================================================================================= - - //NAV_TIME_CFG :NAV typedef union _NAV_TIME_CFG_STRUC { @@ -1461,6 +1092,7 @@ typedef union _NAV_TIME_CFG_STRUC { UINT32 word; } NAV_TIME_CFG_STRUC, *PNAV_TIME_CFG_STRUC; + // // RX_FILTR_CFG: /RX configuration register // @@ -1484,14 +1116,17 @@ typedef union _RX_FILTR_CFG_STRUC { UINT32 DropRts:1; // Drop Ps-Poll UINT32 DropPsPoll:1; // Drop Ps-Poll UINT32 DropBA:1; // - UINT32 DropBAR:1; // + UINT32 DropBAR:1; // - UINT32 DropRsvCntlType:1; + UINT32 DropRsvCntlType:1; UINT32 :15; } field; UINT32 word; } RX_FILTR_CFG_STRUC, *PRX_FILTR_CFG_STRUC; + + + // // PHY_CSR4: RF serial control register // @@ -1506,6 +1141,7 @@ typedef union _PHY_CSR4_STRUC { UINT32 word; } PHY_CSR4_STRUC, *PPHY_CSR4_STRUC; + // // SEC_CSR5: shared key table security mode register // @@ -1531,6 +1167,7 @@ typedef union _SEC_CSR5_STRUC { UINT32 word; } SEC_CSR5_STRUC, *PSEC_CSR5_STRUC; + // // HOST_CMD_CSR: For HOST to interrupt embedded processor // @@ -1542,6 +1179,7 @@ typedef union _HOST_CMD_CSR_STRUC { UINT32 word; } HOST_CMD_CSR_STRUC, *PHOST_CMD_CSR_STRUC; + // // AIFSN_CSR: AIFSN for each EDCA AC // @@ -1565,87 +1203,6 @@ typedef union _E2PROM_CSR_STRUC { UINT32 word; } E2PROM_CSR_STRUC, *PE2PROM_CSR_STRUC; -// ------------------------------------------------------------------- -// E2PROM data layout -// ------------------------------------------------------------------- - -// -// EEPROM antenna select format -// -typedef union _EEPROM_ANTENNA_STRUC { - struct { - USHORT RxPath:4; // 1: 1R, 2: 2R, 3: 3R - USHORT TxPath:4; // 1: 1T, 2: 2T - USHORT RfIcType:4; // see E2PROM document - USHORT Rsv:4; - } field; - USHORT word; -} EEPROM_ANTENNA_STRUC, *PEEPROM_ANTENNA_STRUC; - -typedef union _EEPROM_NIC_CINFIG2_STRUC { - struct { - USHORT HardwareRadioControl:1; // 1:enable, 0:disable - USHORT DynamicTxAgcControl:1; // - USHORT ExternalLNAForG:1; // - USHORT ExternalLNAForA:1; // external LNA enable for 2.4G - USHORT CardbusAcceleration:1; // !!! NOTE: 0 - enable, 1 - disable - USHORT BW40MSidebandForG:1; - USHORT BW40MSidebandForA:1; - USHORT EnableWPSPBC:1; // WPS PBC Control bit - USHORT BW40MAvailForG:1; // 0:enable, 1:disable - USHORT BW40MAvailForA:1; // 0:enable, 1:disable - USHORT Rsv1:1; // must be 0 - USHORT AntDiversity:1; // Antenna diversity - USHORT Rsv2:3; // must be 0 - USHORT DACTestBit:1; // control if driver should patch the DAC issue - } field; - USHORT word; -} EEPROM_NIC_CONFIG2_STRUC, *PEEPROM_NIC_CONFIG2_STRUC; - -// -// TX_PWR Value valid range 0xFA(-6) ~ 0x24(36) -// -typedef union _EEPROM_TX_PWR_STRUC { - struct { - CHAR Byte0; // Low Byte - CHAR Byte1; // High Byte - } field; - USHORT word; -} EEPROM_TX_PWR_STRUC, *PEEPROM_TX_PWR_STRUC; - -typedef union _EEPROM_VERSION_STRUC { - struct { - UCHAR FaeReleaseNumber; // Low Byte - UCHAR Version; // High Byte - } field; - USHORT word; -} EEPROM_VERSION_STRUC, *PEEPROM_VERSION_STRUC; - -typedef union _EEPROM_LED_STRUC { - struct { - USHORT PolarityRDY_G:1; // Polarity RDY_G setting. - USHORT PolarityRDY_A:1; // Polarity RDY_A setting. - USHORT PolarityACT:1; // Polarity ACT setting. - USHORT PolarityGPIO_0:1; // Polarity GPIO#0 setting. - USHORT PolarityGPIO_1:1; // Polarity GPIO#1 setting. - USHORT PolarityGPIO_2:1; // Polarity GPIO#2 setting. - USHORT PolarityGPIO_3:1; // Polarity GPIO#3 setting. - USHORT PolarityGPIO_4:1; // Polarity GPIO#4 setting. - USHORT LedMode:5; // Led mode. - USHORT Rsvd:3; // Reserved - } field; - USHORT word; -} EEPROM_LED_STRUC, *PEEPROM_LED_STRUC; - -typedef union _EEPROM_TXPOWER_DELTA_STRUC { - struct { - UCHAR DeltaValue:6; // Tx Power dalta value (MAX=4) - UCHAR Type:1; // 1: plus the delta value, 0: minus the delta value - UCHAR TxPowerEnable:1;// Enable - } field; - UCHAR value; -} EEPROM_TXPOWER_DELTA_STRUC, *PEEPROM_TXPOWER_DELTA_STRUC; - // // QOS_CSR0: TXOP holder address0 register // @@ -1685,4 +1242,93 @@ typedef union _RF_CSR_CFG_STRUC { UINT word; } RF_CSR_CFG_STRUC, *PRF_CSR_CFG_STRUC; -#endif // __RT28XX_H__ + +// +// Other on-chip shared memory space, base = 0x2000 +// + +// CIS space - base address = 0x2000 +#define HW_CIS_BASE 0x2000 + +// Carrier-sense CTS frame base address. It's where mac stores carrier-sense frame for carrier-sense function. +#define HW_CS_CTS_BASE 0x7700 +// DFS CTS frame base address. It's where mac stores CTS frame for DFS. +#define HW_DFS_CTS_BASE 0x7780 +#define HW_CTS_FRAME_SIZE 0x80 + +// 2004-11-08 john - since NULL frame won't be that long (256 byte). We steal 16 tail bytes +// to save debugging settings +#define HW_DEBUG_SETTING_BASE 0x77f0 // 0x77f0~0x77ff total 16 bytes +#define HW_DEBUG_SETTING_BASE2 0x7770 // 0x77f0~0x77ff total 16 bytes + +// In order to support maximum 8 MBSS and its maximum length is 512 for each beacon +// Three section discontinue memory segments will be used. +// 1. The original region for BCN 0~3 +// 2. Extract memory from FCE table for BCN 4~5 +// 3. Extract memory from Pair-wise key table for BCN 6~7 +// It occupied those memory of wcid 238~253 for BCN 6 +// and wcid 222~237 for BCN 7 +#define HW_BEACON_MAX_SIZE 0x1000 /* unit: byte */ +#define HW_BEACON_BASE0 0x7800 +#define HW_BEACON_BASE1 0x7A00 +#define HW_BEACON_BASE2 0x7C00 +#define HW_BEACON_BASE3 0x7E00 +#define HW_BEACON_BASE4 0x7200 +#define HW_BEACON_BASE5 0x7400 +#define HW_BEACON_BASE6 0x5DC0 +#define HW_BEACON_BASE7 0x5BC0 + +#define HW_BEACON_MAX_COUNT 8 +#define HW_BEACON_OFFSET 0x0200 +#define HW_BEACON_CONTENT_LEN (HW_BEACON_OFFSET - TXWI_SIZE) + +// HOST-MCU shared memory - base address = 0x2100 +#define HOST_CMD_CSR 0x404 +#define H2M_MAILBOX_CSR 0x7010 +#define H2M_MAILBOX_CID 0x7014 +#define H2M_MAILBOX_STATUS 0x701c +#define H2M_INT_SRC 0x7024 +#define H2M_BBP_AGENT 0x7028 +#define M2H_CMD_DONE_CSR 0x000c +#define MCU_TXOP_ARRAY_BASE 0x000c // TODO: to be provided by Albert +#define MCU_TXOP_ENTRY_SIZE 32 // TODO: to be provided by Albert +#define MAX_NUM_OF_TXOP_ENTRY 16 // TODO: must be same with 8051 firmware +#define MCU_MBOX_VERSION 0x01 // TODO: to be confirmed by Albert +#define MCU_MBOX_VERSION_OFFSET 5 // TODO: to be provided by Albert + +// +// Host DMA registers - base address 0x200 . TX0-3=EDCAQid0-3, TX4=HCCA, TX5=MGMT, +// +// +// DMA RING DESCRIPTOR +// +#define E2PROM_CSR 0x0004 +#define IO_CNTL_CSR 0x77d0 + + + +// ================================================================ +// Tx / Rx / Mgmt ring descriptor definition +// ================================================================ + +// the following PID values are used to mark outgoing frame type in TXD->PID so that +// proper TX statistics can be collected based on these categories +// b3-2 of PID field - +#define PID_MGMT 0x05 +#define PID_BEACON 0x0c +#define PID_DATA_NORMALUCAST 0x02 +#define PID_DATA_AMPDU 0x04 +#define PID_DATA_NO_ACK 0x08 +#define PID_DATA_NOT_NORM_ACK 0x03 +// value domain of pTxD->HostQId (4-bit: 0~15) +#define QID_AC_BK 1 // meet ACI definition in 802.11e +#define QID_AC_BE 0 // meet ACI definition in 802.11e +#define QID_AC_VI 2 +#define QID_AC_VO 3 +#define QID_HCCA 4 +#define NUM_OF_TX_RING 4 +#define QID_MGMT 13 +#define QID_RX 14 +#define QID_OTHER 15 + +#endif // __RTMP_MAC_H__ // diff --git a/drivers/staging/rt2860/chip/rtmp_phy.h b/drivers/staging/rt2860/chip/rtmp_phy.h new file mode 100644 index 000000000000..b3326c603cc2 --- /dev/null +++ b/drivers/staging/rt2860/chip/rtmp_phy.h @@ -0,0 +1,405 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + rtmp_phy.h + + Abstract: + Ralink Wireless Chip PHY(BBP/RF) related definition & structures + + Revision History: + Who When What + -------- ---------- ---------------------------------------------- +*/ + +#ifndef __RTMP_PHY_H__ +#define __RTMP_PHY_H__ + + +/* + RF sections +*/ +#define RF_R00 0 +#define RF_R01 1 +#define RF_R02 2 +#define RF_R03 3 +#define RF_R04 4 +#define RF_R05 5 +#define RF_R06 6 +#define RF_R07 7 +#define RF_R08 8 +#define RF_R09 9 +#define RF_R10 10 +#define RF_R11 11 +#define RF_R12 12 +#define RF_R13 13 +#define RF_R14 14 +#define RF_R15 15 +#define RF_R16 16 +#define RF_R17 17 +#define RF_R18 18 +#define RF_R19 19 +#define RF_R20 20 +#define RF_R21 21 +#define RF_R22 22 +#define RF_R23 23 +#define RF_R24 24 +#define RF_R25 25 +#define RF_R26 26 +#define RF_R27 27 +#define RF_R28 28 +#define RF_R29 29 +#define RF_R30 30 +#define RF_R31 31 + + +// value domain of pAd->RfIcType +#define RFIC_2820 1 // 2.4G 2T3R +#define RFIC_2850 2 // 2.4G/5G 2T3R +#define RFIC_2720 3 // 2.4G 1T2R +#define RFIC_2750 4 // 2.4G/5G 1T2R +#define RFIC_3020 5 // 2.4G 1T1R +#define RFIC_2020 6 // 2.4G B/G +#define RFIC_3021 7 // 2.4G 1T2R +#define RFIC_3022 8 // 2.4G 2T2R +#define RFIC_3052 9 // 2.4G/5G 2T2R + +/* + BBP sections +*/ +#define BBP_R0 0 // version +#define BBP_R1 1 // TSSI +#define BBP_R2 2 // TX configure +#define BBP_R3 3 +#define BBP_R4 4 +#define BBP_R5 5 +#define BBP_R6 6 +#define BBP_R14 14 // RX configure +#define BBP_R16 16 +#define BBP_R17 17 // RX sensibility +#define BBP_R18 18 +#define BBP_R21 21 +#define BBP_R22 22 +#define BBP_R24 24 +#define BBP_R25 25 +#define BBP_R26 26 +#define BBP_R27 27 +#define BBP_R31 31 +#define BBP_R49 49 //TSSI +#define BBP_R50 50 +#define BBP_R51 51 +#define BBP_R52 52 +#define BBP_R55 55 +#define BBP_R62 62 // Rx SQ0 Threshold HIGH +#define BBP_R63 63 +#define BBP_R64 64 +#define BBP_R65 65 +#define BBP_R66 66 +#define BBP_R67 67 +#define BBP_R68 68 +#define BBP_R69 69 +#define BBP_R70 70 // Rx AGC SQ CCK Xcorr threshold +#define BBP_R73 73 +#define BBP_R75 75 +#define BBP_R77 77 +#define BBP_R78 78 +#define BBP_R79 79 +#define BBP_R80 80 +#define BBP_R81 81 +#define BBP_R82 82 +#define BBP_R83 83 +#define BBP_R84 84 +#define BBP_R86 86 +#define BBP_R91 91 +#define BBP_R92 92 +#define BBP_R94 94 // Tx Gain Control +#define BBP_R103 103 +#define BBP_R105 105 +#define BBP_R106 106 +#define BBP_R113 113 +#define BBP_R114 114 +#define BBP_R115 115 +#define BBP_R116 116 +#define BBP_R117 117 +#define BBP_R118 118 +#define BBP_R119 119 +#define BBP_R120 120 +#define BBP_R121 121 +#define BBP_R122 122 +#define BBP_R123 123 +#ifdef RT30xx +#define BBP_R138 138 // add by johnli, RF power sequence setup, ADC dynamic on/off control +#endif // RT30xx // + +#define BBPR94_DEFAULT 0x06 // Add 1 value will gain 1db + +// +// BBP & RF are using indirect access. Before write any value into it. +// We have to make sure there is no outstanding command pending via checking busy bit. +// +#define MAX_BUSY_COUNT 100 // Number of retry before failing access BBP & RF indirect register + +//#define PHY_TR_SWITCH_TIME 5 // usec + +//#define BBP_R17_LOW_SENSIBILITY 0x50 +//#define BBP_R17_MID_SENSIBILITY 0x41 +//#define BBP_R17_DYNAMIC_UP_BOUND 0x40 + +#define RSSI_FOR_VERY_LOW_SENSIBILITY -35 +#define RSSI_FOR_LOW_SENSIBILITY -58 +#define RSSI_FOR_MID_LOW_SENSIBILITY -80 +#define RSSI_FOR_MID_SENSIBILITY -90 + +/***************************************************************************** + RF register Read/Write marco definition + *****************************************************************************/ +#ifdef RTMP_MAC_PCI +#define RTMP_RF_IO_WRITE32(_A, _V) \ +{ \ + if ((_A)->bPCIclkOff == FALSE) \ + { \ + PHY_CSR4_STRUC _value; \ + ULONG _busyCnt = 0; \ + \ + do { \ + RTMP_IO_READ32((_A), RF_CSR_CFG0, &_value.word); \ + if (_value.field.Busy == IDLE) \ + break; \ + _busyCnt++; \ + }while (_busyCnt < MAX_BUSY_COUNT); \ + if(_busyCnt < MAX_BUSY_COUNT) \ + { \ + RTMP_IO_WRITE32((_A), RF_CSR_CFG0, (_V)); \ + } \ + } \ +} +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB +#define RTMP_RF_IO_WRITE32(_A, _V) RTUSBWriteRFRegister(_A, _V) +#endif // RTMP_MAC_USB // + +#ifdef RT30xx +#define RTMP_RF_IO_READ8_BY_REG_ID(_A, _I, _pV) RT30xxReadRFRegister(_A, _I, _pV) +#define RTMP_RF_IO_WRITE8_BY_REG_ID(_A, _I, _V) RT30xxWriteRFRegister(_A, _I, _V) +#endif // RT30xx // + +/***************************************************************************** + BBP register Read/Write marco definitions. + we read/write the bbp value by register's ID. + Generate PER to test BA + *****************************************************************************/ +#ifdef RTMP_MAC_PCI +/* + basic marco for BBP read operation. + _pAd: the data structure pointer of RTMP_ADAPTER + _bbpID : the bbp register ID + _pV: data pointer used to save the value of queried bbp register. + _bViaMCU: if we need access the bbp via the MCU. +*/ +#define RTMP_BBP_IO_READ8(_pAd, _bbpID, _pV, _bViaMCU) \ + do{ \ + BBP_CSR_CFG_STRUC BbpCsr; \ + int _busyCnt, _secCnt, _regID; \ + \ + _regID = ((_bViaMCU) == TRUE ? H2M_BBP_AGENT : BBP_CSR_CFG); \ + for (_busyCnt=0; _busyCntBbpWriteLatch[_bbpID]; \ + if ((_bViaMCU) == TRUE) \ + { \ + RTMP_IO_READ32(_pAd, _regID, &BbpCsr.word); \ + BbpCsr.field.Busy = 0; \ + RTMP_IO_WRITE32(_pAd, _regID, BbpCsr.word); \ + } \ + } \ + }while(0) + +/* + This marco used for the BBP read operation which didn't need via MCU. +*/ +#define BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \ + RTMP_BBP_IO_READ8((_A), (_I), (_pV), FALSE) + +/* + This marco used for the BBP read operation which need via MCU. + But for some chipset which didn't have mcu (e.g., RBUS based chipset), we + will use this function too and didn't access the bbp register via the MCU. +*/ +#define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \ + do{ \ + if ((_A)->bPCIclkOff == FALSE) \ + { \ + if ((_A)->infType == RTMP_DEV_INF_RBUS) \ + RTMP_BBP_IO_READ8((_A), (_I), (_pV), FALSE); \ + else \ + RTMP_BBP_IO_READ8((_A), (_I), (_pV), TRUE); \ + } \ + }while(0) + + +/* + basic marco for BBP write operation. + _pAd: the data structure pointer of RTMP_ADAPTER + _bbpID : the bbp register ID + _pV: data used to save the value of queried bbp register. + _bViaMCU: if we need access the bbp via the MCU. +*/ +#define RTMP_BBP_IO_WRITE8(_pAd, _bbpID, _pV, _bViaMCU) \ + do{ \ + BBP_CSR_CFG_STRUC BbpCsr; \ + int _busyCnt, _regID; \ + \ + _regID = ((_bViaMCU) == TRUE ? H2M_BBP_AGENT : BBP_CSR_CFG); \ + for (_busyCnt=0; _busyCntOpMode == OPMODE_AP) \ + RTMPusecDelay(1000); \ + } \ + (_pAd)->BbpWriteLatch[_bbpID] = _pV; \ + break; \ + } \ + if (_busyCnt == MAX_BUSY_COUNT) \ + { \ + DBGPRINT_ERR(("BBP write R%d fail\n", _bbpID)); \ + if((_bViaMCU) == TRUE) \ + { \ + RTMP_IO_READ32(_pAd, H2M_BBP_AGENT, &BbpCsr.word); \ + BbpCsr.field.Busy = 0; \ + RTMP_IO_WRITE32(_pAd, H2M_BBP_AGENT, BbpCsr.word); \ + } \ + } \ + }while(0) + + +/* + This marco used for the BBP write operation which didn't need via MCU. +*/ +#define BBP_IO_WRITE8_BY_REG_ID(_A, _I, _pV) \ + RTMP_BBP_IO_WRITE8((_A), (_I), (_pV), FALSE) + +/* + This marco used for the BBP write operation which need via MCU. + But for some chipset which didn't have mcu (e.g., RBUS based chipset), we + will use this function too and didn't access the bbp register via the MCU. +*/ +#define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _pV) \ + do{ \ + if ((_A)->bPCIclkOff == FALSE) \ + { \ + if ((_A)->infType == RTMP_DEV_INF_RBUS) \ + RTMP_BBP_IO_WRITE8((_A), (_I), (_pV), FALSE); \ + else \ + RTMP_BBP_IO_WRITE8((_A), (_I), (_pV), TRUE); \ + } \ + }while(0) + +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB +#define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) RTUSBReadBBPRegister(_A, _I, _pV) +#define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) RTUSBWriteBBPRegister(_A, _I, _V) + +#define BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) RTUSBWriteBBPRegister(_A, _I, _V) +#define BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) RTUSBReadBBPRegister(_A, _I, _pV) +#endif // RTMP_MAC_USB // + +#ifdef RT30xx +#define RTMP_ASIC_MMPS_DISABLE(_pAd) \ + do{ \ + UCHAR _bbpData; \ + UINT32 _macData; \ + /* disable MMPS BBP control register */ \ + RTMP_BBP_IO_READ8_BY_REG_ID(_pAd, BBP_R3, &_bbpData); \ + _bbpData &= ~(0x04); /*bit 2*/ \ + RTMP_BBP_IO_WRITE8_BY_REG_ID(_pAd, BBP_R3, _bbpData); \ + \ + /* disable MMPS MAC control register */ \ + RTMP_IO_READ32(_pAd, 0x1210, &_macData); \ + _macData &= ~(0x09); /*bit 0, 3*/ \ + RTMP_IO_WRITE32(_pAd, 0x1210, _macData); \ + }while(0) + + +#define RTMP_ASIC_MMPS_ENABLE(_pAd) \ + do{ \ + UCHAR _bbpData; \ + UINT32 _macData; \ + /* enable MMPS BBP control register */ \ + RTMP_BBP_IO_READ8_BY_REG_ID(_pAd, BBP_R3, &_bbpData); \ + _bbpData |= (0x04); /*bit 2*/ \ + RTMP_BBP_IO_WRITE8_BY_REG_ID(_pAd, BBP_R3, _bbpData); \ + \ + /* enable MMPS MAC control register */ \ + RTMP_IO_READ32(_pAd, 0x1210, &_macData); \ + _macData |= (0x09); /*bit 0, 3*/ \ + RTMP_IO_WRITE32(_pAd, 0x1210, _macData); \ + }while(0) + +#endif // RT30xx // + +#endif // __RTMP_PHY_H__ // diff --git a/drivers/staging/rt2860/chips/rt3070.c b/drivers/staging/rt2860/chips/rt3070.c new file mode 100644 index 000000000000..5a3e668601ab --- /dev/null +++ b/drivers/staging/rt2860/chips/rt3070.c @@ -0,0 +1,185 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + rt3070.c + + Abstract: + Specific funcitons and variables for RT3070 + + Revision History: + Who When What + -------- ---------- ---------------------------------------------- +*/ + +#ifdef RT3070 + +#include "../rt_config.h" + + +#ifndef RTMP_RF_RW_SUPPORT +#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" +#endif // RTMP_RF_RW_SUPPORT // + + +VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd) +{ + INT i; + UCHAR RFValue; + + // Driver must read EEPROM to get RfIcType before initial RF registers + // Initialize RF register to default value + if (IS_RT3070(pAd) || IS_RT3071(pAd)) + { + // Init RF calibration + // Driver should toggle RF R30 bit7 before init RF registers + UINT32 RfReg = 0; + UINT32 data; + + RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg); + RfReg |= 0x80; + RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); + RTMPusecDelay(1000); + RfReg &= 0x7F; + RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); + + // Initialize RF register to default value + for (i = 0; i < NUM_RF_REG_PARMS; i++) + { + RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value); + } + + // add by johnli + if (IS_RT3070(pAd)) + { + // + // The DAC issue(LDO_CFG0) has been fixed in RT3070(F). + // The voltage raising patch is no longer needed for RT3070(F) + // + if ((pAd->MACVersion & 0xffff) < 0x0201) + { + // Update MAC 0x05D4 from 01xxxxxx to 0Dxxxxxx (voltage 1.2V to 1.35V) for RT3070 to improve yield rate + RTUSBReadMACRegister(pAd, LDO_CFG0, &data); + data = ((data & 0xF0FFFFFF) | 0x0D000000); + RTUSBWriteMACRegister(pAd, LDO_CFG0, data); + } + } + else if (IS_RT3071(pAd)) + { + // Driver should set RF R6 bit6 on before init RF registers + RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RfReg); + RfReg |= 0x40; + RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg); + + // init R31 + RT30xxWriteRFRegister(pAd, RF_R31, 0x14); + + // RT3071 version E has fixed this issue + if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211)) + { + // patch tx EVM issue temporarily + RTUSBReadMACRegister(pAd, LDO_CFG0, &data); + data = ((data & 0xE0FFFFFF) | 0x0D000000); + RTUSBWriteMACRegister(pAd, LDO_CFG0, data); + } + else + { + RTMP_IO_READ32(pAd, LDO_CFG0, &data); + data = ((data & 0xE0FFFFFF) | 0x01000000); + RTMP_IO_WRITE32(pAd, LDO_CFG0, data); + } + + // patch LNA_PE_G1 failed issue + RTUSBReadMACRegister(pAd, GPIO_SWITCH, &data); + data &= ~(0x20); + RTUSBWriteMACRegister(pAd, GPIO_SWITCH, data); + } + + //For RF filter Calibration + RTMPFilterCalibration(pAd); + + // Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration() + // + // TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F). + // Raising RF voltage is no longer needed for RT3070(F) + // + if ((IS_RT3070(pAd)) && ((pAd->MACVersion & 0xffff) < 0x0201)) + { + RT30xxWriteRFRegister(pAd, RF_R27, 0x3); + } + else if ((IS_RT3071(pAd)) && ((pAd->MACVersion & 0xffff) < 0x0211)) + { + RT30xxWriteRFRegister(pAd, RF_R27, 0x3); + } + + // set led open drain enable + RTUSBReadMACRegister(pAd, OPT_14, &data); + data |= 0x01; + RTUSBWriteMACRegister(pAd, OPT_14, data); + + // move from RT30xxLoadRFNormalModeSetup because it's needed for both RT3070 and RT3071 + // TX_LO1_en, RF R17 register Bit 3 to 0 + RT30xxReadRFRegister(pAd, RF_R17, &RFValue); + RFValue &= (~0x08); + // to fix rx long range issue + if (pAd->NicConfig2.field.ExternalLNAForG == 0) + { + if ((IS_RT3071(pAd) && ((pAd->MACVersion & 0xffff) >= 0x0211)) || IS_RT3070(pAd)) + { + RFValue |= 0x20; + } + } + // set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h + if (pAd->TxMixerGain24G >= 1) + { + RFValue &= (~0x7); // clean bit [2:0] + RFValue |= pAd->TxMixerGain24G; + } + RT30xxWriteRFRegister(pAd, RF_R17, RFValue); + + if (IS_RT3071(pAd)) + { + // add by johnli, RF power sequence setup, load RF normal operation-mode setup + RT30xxLoadRFNormalModeSetup(pAd); + } + else if (IS_RT3070(pAd)) + { + /* add by johnli, reset RF_R27 when interface down & up to fix throughput problem*/ + // LDORF_VC, RF R27 register Bit 2 to 0 + RT30xxReadRFRegister(pAd, RF_R27, &RFValue); + // TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F). + // Raising RF voltage is no longer needed for RT3070(F) + if ((pAd->MACVersion & 0xffff) < 0x0201) + RFValue = (RFValue & (~0x77)) | 0x3; + else + RFValue = (RFValue & (~0x77)); + RT30xxWriteRFRegister(pAd, RF_R27, RFValue); + /* end johnli */ + } + } + +} +#endif // RT3070 // diff --git a/drivers/staging/rt2860/chips/rt30xx.c b/drivers/staging/rt2860/chips/rt30xx.c new file mode 100644 index 000000000000..fe7d8ec5c011 --- /dev/null +++ b/drivers/staging/rt2860/chips/rt30xx.c @@ -0,0 +1,525 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + rt30xx.c + + Abstract: + Specific funcitons and variables for RT30xx. + + Revision History: + Who When What + -------- ---------- ---------------------------------------------- +*/ + + +#ifdef RT30xx + + +#ifndef RTMP_RF_RW_SUPPORT +#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" +#endif // RTMP_RF_RW_SUPPORT // + +#include "../rt_config.h" + + +// +// RF register initialization set +// +REG_PAIR RT30xx_RFRegTable[] = { + {RF_R04, 0x40}, + {RF_R05, 0x03}, + {RF_R06, 0x02}, + {RF_R07, 0x70}, + {RF_R09, 0x0F}, + {RF_R10, 0x41}, + {RF_R11, 0x21}, + {RF_R12, 0x7B}, + {RF_R14, 0x90}, + {RF_R15, 0x58}, + {RF_R16, 0xB3}, + {RF_R17, 0x92}, + {RF_R18, 0x2C}, + {RF_R19, 0x02}, + {RF_R20, 0xBA}, + {RF_R21, 0xDB}, + {RF_R24, 0x16}, + {RF_R25, 0x01}, + {RF_R29, 0x1F}, +}; + +UCHAR NUM_RF_REG_PARMS = (sizeof(RT30xx_RFRegTable) / sizeof(REG_PAIR)); + + + +// Antenna divesity use GPIO3 and EESK pin for control +// Antenna and EEPROM access are both using EESK pin, +// Therefor we should avoid accessing EESK at the same time +// Then restore antenna after EEPROM access +// The original name of this function is AsicSetRxAnt(), now change to +//VOID AsicSetRxAnt( +VOID RT30xxSetRxAnt( + IN PRTMP_ADAPTER pAd, + IN UCHAR Ant) +{ + UINT32 Value; + UINT32 x; + + if ((pAd->EepromAccess) || + (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) || + (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) || + (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) || + (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) + { + return; + } + + // the antenna selection is through firmware and MAC register(GPIO3) + if (Ant == 0) + { + // Main antenna + AsicSendCommandToMcu(pAd, 0x73, 0xFF, 0x1, 0x0); + + RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value); + Value &= ~(0x0808); + RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value); + DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to main antenna\n")); + } + else + { + // Aux antenna + AsicSendCommandToMcu(pAd, 0x73, 0xFF, 0x0, 0x0); + RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value); + Value &= ~(0x0808); + Value |= 0x08; + RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value); + DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to aux antenna\n")); + } +} + + +/* + ======================================================================== + + Routine Description: + For RF filter calibration purpose + + Arguments: + pAd Pointer to our adapter + + Return Value: + None + + IRQL = PASSIVE_LEVEL + + ======================================================================== +*/ +VOID RTMPFilterCalibration( + IN PRTMP_ADAPTER pAd) +{ + UCHAR R55x = 0, value, FilterTarget = 0x1E, BBPValue=0; + UINT loop = 0, count = 0, loopcnt = 0, ReTry = 0; + UCHAR RF_R24_Value = 0; + + // Give bbp filter initial value + pAd->Mlme.CaliBW20RfR24 = 0x1F; + pAd->Mlme.CaliBW40RfR24 = 0x2F; //Bit[5] must be 1 for BW 40 + + do + { + if (loop == 1) //BandWidth = 40 MHz + { + // Write 0x27 to RF_R24 to program filter + RF_R24_Value = 0x27; + RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); + if (IS_RT3090(pAd) || IS_RT3572(pAd)|| IS_RT3390(pAd)) + FilterTarget = 0x15; + else + FilterTarget = 0x19; + + // when calibrate BW40, BBP mask must set to BW40. + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); + BBPValue&= (~0x18); + BBPValue|= (0x10); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); + + // set to BW40 + RT30xxReadRFRegister(pAd, RF_R31, &value); + value |= 0x20; + RT30xxWriteRFRegister(pAd, RF_R31, value); + } + else //BandWidth = 20 MHz + { + // Write 0x07 to RF_R24 to program filter + RF_R24_Value = 0x07; + RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); + if (IS_RT3090(pAd) || IS_RT3572(pAd)|| IS_RT3390(pAd)) + FilterTarget = 0x13; + else + FilterTarget = 0x16; + + // set to BW20 + RT30xxReadRFRegister(pAd, RF_R31, &value); + value &= (~0x20); + RT30xxWriteRFRegister(pAd, RF_R31, value); + } + + // Write 0x01 to RF_R22 to enable baseband loopback mode + RT30xxReadRFRegister(pAd, RF_R22, &value); + value |= 0x01; + RT30xxWriteRFRegister(pAd, RF_R22, value); + + // Write 0x00 to BBP_R24 to set power & frequency of passband test tone + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0); + + do + { + // Write 0x90 to BBP_R25 to transmit test tone + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90); + + RTMPusecDelay(1000); + // Read BBP_R55[6:0] for received power, set R55x = BBP_R55[6:0] + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value); + R55x = value & 0xFF; + + } while ((ReTry++ < 100) && (R55x == 0)); + + // Write 0x06 to BBP_R24 to set power & frequency of stopband test tone + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0x06); + + while(TRUE) + { + // Write 0x90 to BBP_R25 to transmit test tone + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90); + + //We need to wait for calibration + RTMPusecDelay(1000); + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value); + value &= 0xFF; + if ((R55x - value) < FilterTarget) + { + RF_R24_Value ++; + } + else if ((R55x - value) == FilterTarget) + { + RF_R24_Value ++; + count ++; + } + else + { + break; + } + + // prevent infinite loop cause driver hang. + if (loopcnt++ > 100) + { + DBGPRINT(RT_DEBUG_ERROR, ("RTMPFilterCalibration - can't find a valid value, loopcnt=%d stop calibrating", loopcnt)); + break; + } + + // Write RF_R24 to program filter + RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); + } + + if (count > 0) + { + RF_R24_Value = RF_R24_Value - ((count) ? (1) : (0)); + } + + // Store for future usage + if (loopcnt < 100) + { + if (loop++ == 0) + { + //BandWidth = 20 MHz + pAd->Mlme.CaliBW20RfR24 = (UCHAR)RF_R24_Value; + } + else + { + //BandWidth = 40 MHz + pAd->Mlme.CaliBW40RfR24 = (UCHAR)RF_R24_Value; + break; + } + } + else + break; + + RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); + + // reset count + count = 0; + } while(TRUE); + + // + // Set back to initial state + // + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0); + + RT30xxReadRFRegister(pAd, RF_R22, &value); + value &= ~(0x01); + RT30xxWriteRFRegister(pAd, RF_R22, value); + + // set BBP back to BW20 + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); + BBPValue&= (~0x18); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); + + DBGPRINT(RT_DEBUG_TRACE, ("RTMPFilterCalibration - CaliBW20RfR24=0x%x, CaliBW40RfR24=0x%x\n", pAd->Mlme.CaliBW20RfR24, pAd->Mlme.CaliBW40RfR24)); +} + + +// add by johnli, RF power sequence setup +/* + ========================================================================== + Description: + + Load RF normal operation-mode setup + + ========================================================================== + */ +VOID RT30xxLoadRFNormalModeSetup( + IN PRTMP_ADAPTER pAd) +{ + UCHAR RFValue; + + // RX0_PD & TX0_PD, RF R1 register Bit 2 & Bit 3 to 0 and RF_BLOCK_en,RX1_PD & TX1_PD, Bit0, Bit 4 & Bit5 to 1 + RT30xxReadRFRegister(pAd, RF_R01, &RFValue); + RFValue = (RFValue & (~0x0C)) | 0x31; + RT30xxWriteRFRegister(pAd, RF_R01, RFValue); + + // TX_LO2_en, RF R15 register Bit 3 to 0 + RT30xxReadRFRegister(pAd, RF_R15, &RFValue); + RFValue &= (~0x08); + RT30xxWriteRFRegister(pAd, RF_R15, RFValue); + + /* move to NICInitRT30xxRFRegisters + // TX_LO1_en, RF R17 register Bit 3 to 0 + RT30xxReadRFRegister(pAd, RF_R17, &RFValue); + RFValue &= (~0x08); + // to fix rx long range issue + if (((pAd->MACVersion & 0xffff) >= 0x0211) && (pAd->NicConfig2.field.ExternalLNAForG == 0)) + { + RFValue |= 0x20; + } + // set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h + if (pAd->TxMixerGain24G >= 2) + { + RFValue &= (~0x7); // clean bit [2:0] + RFValue |= pAd->TxMixerGain24G; + } + RT30xxWriteRFRegister(pAd, RF_R17, RFValue); + */ + + // RX_LO1_en, RF R20 register Bit 3 to 0 + RT30xxReadRFRegister(pAd, RF_R20, &RFValue); + RFValue &= (~0x08); + RT30xxWriteRFRegister(pAd, RF_R20, RFValue); + + // RX_LO2_en, RF R21 register Bit 3 to 0 + RT30xxReadRFRegister(pAd, RF_R21, &RFValue); + RFValue &= (~0x08); + RT30xxWriteRFRegister(pAd, RF_R21, RFValue); + + /* add by johnli, reset RF_R27 when interface down & up to fix throughput problem*/ + // LDORF_VC, RF R27 register Bit 2 to 0 + RT30xxReadRFRegister(pAd, RF_R27, &RFValue); + // TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F). + // Raising RF voltage is no longer needed for RT3070(F) + if (IS_RT3090(pAd)) // RT309x and RT3071/72 + { + if ((pAd->MACVersion & 0xffff) < 0x0211) + RFValue = (RFValue & (~0x77)) | 0x3; + else + RFValue = (RFValue & (~0x77)); + RT30xxWriteRFRegister(pAd, RF_R27, RFValue); + } + /* end johnli */ +} + +/* + ========================================================================== + Description: + + Load RF sleep-mode setup + + ========================================================================== + */ +VOID RT30xxLoadRFSleepModeSetup( + IN PRTMP_ADAPTER pAd) +{ + UCHAR RFValue; + UINT32 MACValue; + + +#ifdef RTMP_MAC_USB + if(!IS_RT3572(pAd)) +#endif // RTMP_MAC_USB // + { + // RF_BLOCK_en. RF R1 register Bit 0 to 0 + RT30xxReadRFRegister(pAd, RF_R01, &RFValue); + RFValue &= (~0x01); + RT30xxWriteRFRegister(pAd, RF_R01, RFValue); + + // VCO_IC, RF R7 register Bit 4 & Bit 5 to 0 + RT30xxReadRFRegister(pAd, RF_R07, &RFValue); + RFValue &= (~0x30); + RT30xxWriteRFRegister(pAd, RF_R07, RFValue); + + // Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 0 + RT30xxReadRFRegister(pAd, RF_R09, &RFValue); + RFValue &= (~0x0E); + RT30xxWriteRFRegister(pAd, RF_R09, RFValue); + + // RX_CTB_en, RF R21 register Bit 7 to 0 + RT30xxReadRFRegister(pAd, RF_R21, &RFValue); + RFValue &= (~0x80); + RT30xxWriteRFRegister(pAd, RF_R21, RFValue); + } + + if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72 + IS_RT3572(pAd) || + (IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) + { +#ifdef RTMP_MAC_USB + if (!IS_RT3572(pAd)) +#endif // RTMP_MAC_USB // + { + RT30xxReadRFRegister(pAd, RF_R27, &RFValue); + RFValue |= 0x77; + RT30xxWriteRFRegister(pAd, RF_R27, RFValue); + } + + RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue); + MACValue |= 0x1D000000; + RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue); + } +} + +/* + ========================================================================== + Description: + + Reverse RF sleep-mode setup + + ========================================================================== + */ +VOID RT30xxReverseRFSleepModeSetup( + IN PRTMP_ADAPTER pAd) +{ + UCHAR RFValue; + UINT32 MACValue; + +#ifdef RTMP_MAC_USB + if(!IS_RT3572(pAd)) +#endif // RTMP_MAC_USB // + { + // RF_BLOCK_en, RF R1 register Bit 0 to 1 + RT30xxReadRFRegister(pAd, RF_R01, &RFValue); + RFValue |= 0x01; + RT30xxWriteRFRegister(pAd, RF_R01, RFValue); + + // VCO_IC, RF R7 register Bit 4 & Bit 5 to 1 + RT30xxReadRFRegister(pAd, RF_R07, &RFValue); + RFValue |= 0x30; + RT30xxWriteRFRegister(pAd, RF_R07, RFValue); + + // Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 1 + RT30xxReadRFRegister(pAd, RF_R09, &RFValue); + RFValue |= 0x0E; + RT30xxWriteRFRegister(pAd, RF_R09, RFValue); + + // RX_CTB_en, RF R21 register Bit 7 to 1 + RT30xxReadRFRegister(pAd, RF_R21, &RFValue); + RFValue |= 0x80; + RT30xxWriteRFRegister(pAd, RF_R21, RFValue); + } + + if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72 + IS_RT3572(pAd) || + IS_RT3390(pAd) || + (IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) + { +#ifdef RTMP_MAC_USB + if (!IS_RT3572(pAd)) +#endif // RTMP_MAC_USB // + { + RT30xxReadRFRegister(pAd, RF_R27, &RFValue); + if ((pAd->MACVersion & 0xffff) < 0x0211) + RFValue = (RFValue & (~0x77)) | 0x3; + else + RFValue = (RFValue & (~0x77)); + RT30xxWriteRFRegister(pAd, RF_R27, RFValue); + } + + // RT3071 version E has fixed this issue + if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211)) + { + // patch tx EVM issue temporarily + RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue); + MACValue = ((MACValue & 0xE0FFFFFF) | 0x0D000000); + RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue); + } + else + { + RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue); + MACValue = ((MACValue & 0xE0FFFFFF) | 0x01000000); + RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue); + } + } + + if(IS_RT3572(pAd)) + RT30xxWriteRFRegister(pAd, RF_R08, 0x80); +} +// end johnli + +VOID RT30xxHaltAction( + IN PRTMP_ADAPTER pAd) +{ + UINT32 TxPinCfg = 0x00050F0F; + + // + // Turn off LNA_PE or TRSW_POL + // + if (IS_RT3070(pAd) || IS_RT3071(pAd) || IS_RT3572(pAd)) + { + if ((IS_RT3071(pAd) || IS_RT3572(pAd)) +#ifdef RTMP_EFUSE_SUPPORT + && (pAd->bUseEfuse) +#endif // RTMP_EFUSE_SUPPORT // + ) + { + TxPinCfg &= 0xFFFBF0F0; // bit18 off + } + else + { + TxPinCfg &= 0xFFFFF0F0; + } + + RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg); + } +} + +#endif // RT30xx // diff --git a/drivers/staging/rt2860/chlist.h b/drivers/staging/rt2860/chlist.h index f49a35c95de6..9ce915415462 100644 --- a/drivers/staging/rt2860/chlist.h +++ b/drivers/staging/rt2860/chlist.h @@ -64,1182 +64,65 @@ typedef struct _CH_REGION { CH_DESP ChDesp[10]; } CH_REGION, *PCH_REGION; -static CH_REGION ChRegion[] = -{ - { // Antigua and Berbuda - "AG", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Argentina - "AR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Aruba - "AW", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Australia - "AU", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Austria - "AT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, TRUE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Bahamas - "BS", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Barbados - "BB", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Bermuda - "BM", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Brazil - "BR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 24, BOTH, FALSE}, // 5G, ch 100~140 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Belgium - "BE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 18, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 18, IDOR, FALSE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // Bulgaria - "BG", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, ODOR, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Canada - "CA", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Cayman IsLands - "KY", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Chile - "CL", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 20, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 20, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 5, 20, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // China - "CN", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Colombia - "CO", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Costa Rica - "CR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Cyprus - "CY", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Czech_Republic - "CZ", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // Denmark - "DK", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Dominican Republic - "DO", - CE, - { - { 1, 0, 20, BOTH, FALSE}, // 2.4 G, ch 0 - { 149, 4, 20, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Equador - "EC", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 100, 11, 27, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // El Salvador - "SV", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 30, BOTH, TRUE}, // 5G, ch 52~64 - { 149, 4, 36, BOTH, TRUE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Finland - "FI", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // France - "FR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // Germany - "DE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Greece - "GR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, ODOR, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Guam - "GU", - CE, - { - { 1, 11, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Guatemala - "GT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Haiti - "HT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Honduras - "HN", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Hong Kong - "HK", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, FALSE}, // 5G, ch 52~64 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Hungary - "HU", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // Iceland - "IS", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // India - "IN", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 149, 4, 24, IDOR, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Indonesia - "ID", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Ireland - "IE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, ODOR, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Israel - "IL", - CE, - { - { 1, 3, 20, IDOR, FALSE}, // 2.4 G, ch 1~3 - { 4, 6, 20, BOTH, FALSE}, // 2.4 G, ch 4~9 - { 10, 4, 20, IDOR, FALSE}, // 2.4 G, ch 10~13 - { 0}, // end - } - }, - - { // Italy - "IT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, ODOR, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Japan - "JP", - JAP, - { - { 1, 14, 20, BOTH, FALSE}, // 2.4 G, ch 1~14 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 0}, // end - } - }, - - { // Jordan - "JO", - CE, - { - { 1, 13, 20, IDOR, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 149, 4, 23, IDOR, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Latvia - "LV", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Liechtenstein - "LI", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Lithuania - "LT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Luxemburg - "LU", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Malaysia - "MY", - CE, - { - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 5, 20, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Malta - "MT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Marocco - "MA", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 24, IDOR, FALSE}, // 5G, ch 36~48 - { 0}, // end - } - }, - - { // Mexico - "MX", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 5, 30, IDOR, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Netherlands - "NL", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // New Zealand - "NZ", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 24, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Norway - "NO", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 24, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Peru - "PE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Portugal - "PT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Poland - "PL", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Romania - "RO", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Russia - "RU", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 149, 4, 20, IDOR, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Saudi Arabia - "SA", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 23, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Serbia_and_Montenegro - "CS", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 0}, // end - } - }, - - { // Singapore - "SG", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 20, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Slovakia - "SK", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Slovenia - "SI", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // South Africa - "ZA", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // South Korea - "KR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 20, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 20, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 8, 20, BOTH, FALSE}, // 5G, ch 100~128 - { 149, 4, 20, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Spain - "ES", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 17, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Sweden - "SE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Switzerland - "CH", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, TRUE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // Taiwan - "TW", - CE, - { - { 1, 11, 30, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 52, 4, 23, IDOR, FALSE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // Turkey - "TR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // UK - "GB", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 52~64 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Ukraine - "UA", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 0}, // end - } - }, - - { // United_Arab_Emirates - "AE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 0}, // end - } - }, - - { // United_States - "US", - CE, - { - { 1, 11, 30, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 36, 4, 17, IDOR, FALSE}, // 5G, ch 52~64 - { 52, 4, 24, BOTH, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Venezuela - "VE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Default - "", - CE, - { - { 1, 11, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 36, 4, 20, BOTH, FALSE}, // 5G, ch 52~64 - { 52, 4, 20, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 20, BOTH, FALSE}, // 5G, ch 100~140 - { 149, 5, 20, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, -}; - -static inline PCH_REGION GetChRegion( - IN PUCHAR CntryCode) -{ - INT loop = 0; - PCH_REGION pChRegion = NULL; - - while (strcmp(ChRegion[loop].CountReg, "") != 0) - { - if (strncmp(ChRegion[loop].CountReg, CntryCode, 2) == 0) - { - pChRegion = &ChRegion[loop]; - break; - } - loop++; - } - - if (pChRegion == NULL) - pChRegion = &ChRegion[loop]; - return pChRegion; -} - -static inline VOID ChBandCheck( - IN UCHAR PhyMode, - OUT PUCHAR pChType) -{ - switch(PhyMode) - { - case PHY_11A: - case PHY_11AN_MIXED: - *pChType = BAND_5G; - break; - case PHY_11ABG_MIXED: - case PHY_11AGN_MIXED: - case PHY_11ABGN_MIXED: - *pChType = BAND_BOTH; - break; - - default: - *pChType = BAND_24G; - break; - } -} - -static inline UCHAR FillChList( - IN PRTMP_ADAPTER pAd, - IN PCH_DESP pChDesp, - IN UCHAR Offset, - IN UCHAR increment) -{ - INT i, j, l; - UCHAR channel; - - j = Offset; - for (i = 0; i < pChDesp->NumOfCh; i++) - { - channel = pChDesp->FirstChannel + i * increment; - for (l=0; lTxPower[l].Channel) - { - pAd->ChannelList[j].Power = pAd->TxPower[l].Power; - pAd->ChannelList[j].Power2 = pAd->TxPower[l].Power2; - break; - } - } - if (l == MAX_NUM_OF_CHANNELS) - continue; - - pAd->ChannelList[j].Channel = pChDesp->FirstChannel + i * increment; - pAd->ChannelList[j].MaxTxPwr = pChDesp->MaxTxPwr; - pAd->ChannelList[j].DfsReq = pChDesp->DfsReq; - j++; - } - pAd->ChannelListNum = j; - - return j; -} - -static inline VOID CreateChList( - IN PRTMP_ADAPTER pAd, - IN PCH_REGION pChRegion, - IN UCHAR Geography) -{ - INT i; - UCHAR offset = 0; - PCH_DESP pChDesp; - UCHAR ChType; - UCHAR increment; - - if (pChRegion == NULL) - return; - - ChBandCheck(pAd->CommonCfg.PhyMode, &ChType); - - for (i=0; i<10; i++) - { - pChDesp = &pChRegion->ChDesp[i]; - if (pChDesp->FirstChannel == 0) - break; - - if (ChType == BAND_5G) - { - if (pChDesp->FirstChannel <= 14) - continue; - } - else if (ChType == BAND_24G) - { - if (pChDesp->FirstChannel > 14) - continue; - } - - if ((pChDesp->Geography == BOTH) - || (pChDesp->Geography == Geography)) - { - if (pChDesp->FirstChannel > 14) - increment = 4; - else - increment = 1; - offset = FillChList(pAd, pChDesp, offset, increment); - } - } -} - -static inline VOID BuildChannelListEx( - IN PRTMP_ADAPTER pAd) -{ - PCH_REGION pChReg; - - pChReg = GetChRegion(pAd->CommonCfg.CountryCode); - CreateChList(pAd, pChReg, pAd->CommonCfg.Geography); -} - -static inline VOID BuildBeaconChList( +extern CH_REGION ChRegion[]; + +typedef struct _CH_FREQ_MAP_{ + UINT16 channel; + UINT16 freqKHz; +}CH_FREQ_MAP; + +extern CH_FREQ_MAP CH_HZ_ID_MAP[]; +extern int CH_HZ_ID_MAP_NUM; + + +#define MAP_CHANNEL_ID_TO_KHZ(_ch, _khz) \ + do{ \ + int _chIdx; \ + for (_chIdx = 0; _chIdx < CH_HZ_ID_MAP_NUM; _chIdx++)\ + { \ + if ((_ch) == CH_HZ_ID_MAP[_chIdx].channel) \ + { \ + (_khz) = CH_HZ_ID_MAP[_chIdx].freqKHz * 1000; \ + break; \ + } \ + } \ + if (_chIdx == CH_HZ_ID_MAP_NUM) \ + (_khz) = 2412000; \ + }while(0) + +#define MAP_KHZ_TO_CHANNEL_ID(_khz, _ch) \ + do{ \ + int _chIdx; \ + for (_chIdx = 0; _chIdx < CH_HZ_ID_MAP_NUM; _chIdx++)\ + { \ + if ((_khz) == CH_HZ_ID_MAP[_chIdx].freqKHz) \ + { \ + (_ch) = CH_HZ_ID_MAP[_chIdx].channel; \ + break; \ + } \ + } \ + if (_chIdx == CH_HZ_ID_MAP_NUM) \ + (_ch) = 1; \ + }while(0) + + +VOID BuildChannelListEx( + IN PRTMP_ADAPTER pAd); + +VOID BuildBeaconChList( IN PRTMP_ADAPTER pAd, OUT PUCHAR pBuf, - OUT PULONG pBufLen) -{ - INT i; - ULONG TmpLen; - PCH_REGION pChRegion; - PCH_DESP pChDesp; - UCHAR ChType; - - pChRegion = GetChRegion(pAd->CommonCfg.CountryCode); - - if (pChRegion == NULL) - return; - - ChBandCheck(pAd->CommonCfg.PhyMode, &ChType); - *pBufLen = 0; - - for (i=0; i<10; i++) - { - pChDesp = &pChRegion->ChDesp[i]; - if (pChDesp->FirstChannel == 0) - break; - - if (ChType == BAND_5G) - { - if (pChDesp->FirstChannel <= 14) - continue; - } - else if (ChType == BAND_24G) - { - if (pChDesp->FirstChannel > 14) - continue; - } - - if ((pChDesp->Geography == BOTH) - || (pChDesp->Geography == pAd->CommonCfg.Geography)) - { - MakeOutgoingFrame(pBuf + *pBufLen, &TmpLen, - 1, &pChDesp->FirstChannel, - 1, &pChDesp->NumOfCh, - 1, &pChDesp->MaxTxPwr, - END_OF_ARGS); - *pBufLen += TmpLen; - } - } -} - -static inline BOOLEAN IsValidChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR channel) - -{ - INT i; - - for (i = 0; i < pAd->ChannelListNum; i++) - { - if (pAd->ChannelList[i].Channel == channel) - break; - } - - if (i == pAd->ChannelListNum) - return FALSE; - else - return TRUE; -} - - -static inline UCHAR GetExtCh( - IN UCHAR Channel, - IN UCHAR Direction) -{ - CHAR ExtCh; - - if (Direction == EXTCHA_ABOVE) - ExtCh = Channel + 4; - else - ExtCh = (Channel - 4) > 0 ? (Channel - 4) : 0; - - return ExtCh; -} - - -static inline VOID N_ChannelCheck( - IN PRTMP_ADAPTER pAd) -{ - //UCHAR ChannelNum = pAd->ChannelListNum; - UCHAR Channel = pAd->CommonCfg.Channel; - - if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)) - { - if (Channel > 14) - { - if ((Channel == 36) || (Channel == 44) || (Channel == 52) || (Channel == 60) || (Channel == 100) || (Channel == 108) || - (Channel == 116) || (Channel == 124) || (Channel == 132) || (Channel == 149) || (Channel == 157)) - { - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE; - } - else if ((Channel == 40) || (Channel == 48) || (Channel == 56) || (Channel == 64) || (Channel == 104) || (Channel == 112) || - (Channel == 120) || (Channel == 128) || (Channel == 136) || (Channel == 153) || (Channel == 161)) - { - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW; - } - else - { - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - } - } - else - { - do - { - UCHAR ExtCh; - UCHAR Dir = pAd->CommonCfg.RegTransmitSetting.field.EXTCHA; - ExtCh = GetExtCh(Channel, Dir); - if (IsValidChannel(pAd, ExtCh)) - break; - - Dir = (Dir == EXTCHA_ABOVE) ? EXTCHA_BELOW : EXTCHA_ABOVE; - ExtCh = GetExtCh(Channel, Dir); - if (IsValidChannel(pAd, ExtCh)) - { - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = Dir; - break; - } - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - } while(FALSE); - - if (Channel == 14) - { - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - //pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_NONE; // We didn't set the ExtCh as NONE due to it'll set in RTMPSetHT() - } - } - } - - -} + OUT PULONG pBufLen); +VOID N_ChannelCheck( + IN PRTMP_ADAPTER pAd); -static inline VOID N_SetCenCh( - IN PRTMP_ADAPTER pAd) -{ - if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40) - { - if (pAd->CommonCfg.RegTransmitSetting.field.EXTCHA == EXTCHA_ABOVE) - { - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel + 2; - } - else - { - if (pAd->CommonCfg.Channel == 14) - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel - 1; - else - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel - 2; - } - } - else - { - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; - } -} +VOID N_SetCenCh( + IN PRTMP_ADAPTER pAd); -static inline UINT8 GetCuntryMaxTxPwr( +UINT8 GetCuntryMaxTxPwr( IN PRTMP_ADAPTER pAd, - IN UINT8 channel) -{ - int i; - for (i = 0; i < pAd->ChannelListNum; i++) - { - if (pAd->ChannelList[i].Channel == channel) - break; - } + IN UINT8 channel); - if (i == pAd->ChannelListNum) - return 0xff; - else - return pAd->ChannelList[i].MaxTxPwr; -} #endif // __CHLIST_H__ diff --git a/drivers/staging/rt2860/common/2860_rtmp_init.c b/drivers/staging/rt2860/common/2860_rtmp_init.c deleted file mode 100644 index 0bc0fb99d2e4..000000000000 --- a/drivers/staging/rt2860/common/2860_rtmp_init.c +++ /dev/null @@ -1,897 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - 2860_rtmp_init.c - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Paul Lin 2002-08-01 created - John Chang 2004-08-20 RT2561/2661 use scatter-gather scheme - Jan Lee 2006-09-15 RT2860. Change for 802.11n , EEPROM, Led, BA, HT. -*/ -#include "../rt_config.h" - - - - -/* - ======================================================================== - - Routine Description: - Allocate DMA memory blocks for send, receive - - Arguments: - Adapter Pointer to our adapter - - Return Value: - NDIS_STATUS_SUCCESS - NDIS_STATUS_FAILURE - NDIS_STATUS_RESOURCES - - IRQL = PASSIVE_LEVEL - - Note: - - ======================================================================== -*/ -NDIS_STATUS RTMPAllocTxRxRingMemory( - IN PRTMP_ADAPTER pAd) -{ - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - ULONG RingBasePaHigh; - ULONG RingBasePaLow; - PVOID RingBaseVa; - INT index, num; - PTXD_STRUC pTxD; - PRXD_STRUC pRxD; - ULONG ErrorValue = 0; - PRTMP_TX_RING pTxRing; - PRTMP_DMABUF pDmaBuf; - PNDIS_PACKET pPacket; - - DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPAllocTxRxRingMemory\n")); - do - { - // - // Allocate all ring descriptors, include TxD, RxD, MgmtD. - // Although each size is different, to prevent cacheline and alignment - // issue, I intentional set them all to 64 bytes. - // - for (num=0; numTxDescRing[num].AllocSize = TX_RING_SIZE * TXD_SIZE; - RTMP_AllocateTxDescMemory( - pAd, - num, - pAd->TxDescRing[num].AllocSize, - FALSE, - &pAd->TxDescRing[num].AllocVa, - &pAd->TxDescRing[num].AllocPa); - - if (pAd->TxDescRing[num].AllocVa == NULL) - { - ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; - DBGPRINT_ERR(("Failed to allocate a big buffer\n")); - Status = NDIS_STATUS_RESOURCES; - break; - } - - // Zero init this memory block - NdisZeroMemory(pAd->TxDescRing[num].AllocVa, pAd->TxDescRing[num].AllocSize); - - // Save PA & VA for further operation - RingBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->TxDescRing[num].AllocPa); - RingBasePaLow = RTMP_GetPhysicalAddressLow (pAd->TxDescRing[num].AllocPa); - RingBaseVa = pAd->TxDescRing[num].AllocVa; - - // - // Allocate all 1st TXBuf's memory for this TxRing - // - pAd->TxBufSpace[num].AllocSize = TX_RING_SIZE * TX_DMA_1ST_BUFFER_SIZE; - RTMP_AllocateFirstTxBuffer( - pAd, - num, - pAd->TxBufSpace[num].AllocSize, - FALSE, - &pAd->TxBufSpace[num].AllocVa, - &pAd->TxBufSpace[num].AllocPa); - - if (pAd->TxBufSpace[num].AllocVa == NULL) - { - ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; - DBGPRINT_ERR(("Failed to allocate a big buffer\n")); - Status = NDIS_STATUS_RESOURCES; - break; - } - - // Zero init this memory block - NdisZeroMemory(pAd->TxBufSpace[num].AllocVa, pAd->TxBufSpace[num].AllocSize); - - // Save PA & VA for further operation - BufBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->TxBufSpace[num].AllocPa); - BufBasePaLow = RTMP_GetPhysicalAddressLow (pAd->TxBufSpace[num].AllocPa); - BufBaseVa = pAd->TxBufSpace[num].AllocVa; - - // - // Initialize Tx Ring Descriptor and associated buffer memory - // - pTxRing = &pAd->TxRing[num]; - for (index = 0; index < TX_RING_SIZE; index++) - { - pTxRing->Cell[index].pNdisPacket = NULL; - pTxRing->Cell[index].pNextNdisPacket = NULL; - // Init Tx Ring Size, Va, Pa variables - pTxRing->Cell[index].AllocSize = TXD_SIZE; - pTxRing->Cell[index].AllocVa = RingBaseVa; - RTMP_SetPhysicalAddressHigh(pTxRing->Cell[index].AllocPa, RingBasePaHigh); - RTMP_SetPhysicalAddressLow (pTxRing->Cell[index].AllocPa, RingBasePaLow); - - // Setup Tx Buffer size & address. only 802.11 header will store in this space - pDmaBuf = &pTxRing->Cell[index].DmaBuf; - pDmaBuf->AllocSize = TX_DMA_1ST_BUFFER_SIZE; - pDmaBuf->AllocVa = BufBaseVa; - RTMP_SetPhysicalAddressHigh(pDmaBuf->AllocPa, BufBasePaHigh); - RTMP_SetPhysicalAddressLow(pDmaBuf->AllocPa, BufBasePaLow); - - // link the pre-allocated TxBuf to TXD - pTxD = (PTXD_STRUC) pTxRing->Cell[index].AllocVa; - pTxD->SDPtr0 = BufBasePaLow; - // advance to next ring descriptor address - pTxD->DMADONE = 1; - RingBasePaLow += TXD_SIZE; - RingBaseVa = (PUCHAR) RingBaseVa + TXD_SIZE; - - // advance to next TxBuf address - BufBasePaLow += TX_DMA_1ST_BUFFER_SIZE; - BufBaseVa = (PUCHAR) BufBaseVa + TX_DMA_1ST_BUFFER_SIZE; - } - DBGPRINT(RT_DEBUG_TRACE, ("TxRing[%d]: total %d entry allocated\n", num, index)); - } - if (Status == NDIS_STATUS_RESOURCES) - break; - - // - // Allocate MGMT ring descriptor's memory except Tx ring which allocated eariler - // - pAd->MgmtDescRing.AllocSize = MGMT_RING_SIZE * TXD_SIZE; - RTMP_AllocateMgmtDescMemory( - pAd, - pAd->MgmtDescRing.AllocSize, - FALSE, - &pAd->MgmtDescRing.AllocVa, - &pAd->MgmtDescRing.AllocPa); - - if (pAd->MgmtDescRing.AllocVa == NULL) - { - ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; - DBGPRINT_ERR(("Failed to allocate a big buffer\n")); - Status = NDIS_STATUS_RESOURCES; - break; - } - - // Zero init this memory block - NdisZeroMemory(pAd->MgmtDescRing.AllocVa, pAd->MgmtDescRing.AllocSize); - - // Save PA & VA for further operation - RingBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->MgmtDescRing.AllocPa); - RingBasePaLow = RTMP_GetPhysicalAddressLow (pAd->MgmtDescRing.AllocPa); - RingBaseVa = pAd->MgmtDescRing.AllocVa; - - // - // Initialize MGMT Ring and associated buffer memory - // - for (index = 0; index < MGMT_RING_SIZE; index++) - { - pAd->MgmtRing.Cell[index].pNdisPacket = NULL; - pAd->MgmtRing.Cell[index].pNextNdisPacket = NULL; - // Init MGMT Ring Size, Va, Pa variables - pAd->MgmtRing.Cell[index].AllocSize = TXD_SIZE; - pAd->MgmtRing.Cell[index].AllocVa = RingBaseVa; - RTMP_SetPhysicalAddressHigh(pAd->MgmtRing.Cell[index].AllocPa, RingBasePaHigh); - RTMP_SetPhysicalAddressLow (pAd->MgmtRing.Cell[index].AllocPa, RingBasePaLow); - - // Offset to next ring descriptor address - RingBasePaLow += TXD_SIZE; - RingBaseVa = (PUCHAR) RingBaseVa + TXD_SIZE; - - // link the pre-allocated TxBuf to TXD - pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[index].AllocVa; - pTxD->DMADONE = 1; - - // no pre-allocated buffer required in MgmtRing for scatter-gather case - } - DBGPRINT(RT_DEBUG_TRACE, ("MGMT Ring: total %d entry allocated\n", index)); - - // - // Allocate RX ring descriptor's memory except Tx ring which allocated eariler - // - pAd->RxDescRing.AllocSize = RX_RING_SIZE * RXD_SIZE; - RTMP_AllocateRxDescMemory( - pAd, - pAd->RxDescRing.AllocSize, - FALSE, - &pAd->RxDescRing.AllocVa, - &pAd->RxDescRing.AllocPa); - - if (pAd->RxDescRing.AllocVa == NULL) - { - ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; - DBGPRINT_ERR(("Failed to allocate a big buffer\n")); - Status = NDIS_STATUS_RESOURCES; - break; - } - - // Zero init this memory block - NdisZeroMemory(pAd->RxDescRing.AllocVa, pAd->RxDescRing.AllocSize); - - - printk("RX DESC %p size = %ld\n", pAd->RxDescRing.AllocVa, - pAd->RxDescRing.AllocSize); - - // Save PA & VA for further operation - RingBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->RxDescRing.AllocPa); - RingBasePaLow = RTMP_GetPhysicalAddressLow (pAd->RxDescRing.AllocPa); - RingBaseVa = pAd->RxDescRing.AllocVa; - - // - // Initialize Rx Ring and associated buffer memory - // - for (index = 0; index < RX_RING_SIZE; index++) - { - // Init RX Ring Size, Va, Pa variables - pAd->RxRing.Cell[index].AllocSize = RXD_SIZE; - pAd->RxRing.Cell[index].AllocVa = RingBaseVa; - RTMP_SetPhysicalAddressHigh(pAd->RxRing.Cell[index].AllocPa, RingBasePaHigh); - RTMP_SetPhysicalAddressLow (pAd->RxRing.Cell[index].AllocPa, RingBasePaLow); - - // Offset to next ring descriptor address - RingBasePaLow += RXD_SIZE; - RingBaseVa = (PUCHAR) RingBaseVa + RXD_SIZE; - - // Setup Rx associated Buffer size & allocate share memory - pDmaBuf = &pAd->RxRing.Cell[index].DmaBuf; - pDmaBuf->AllocSize = RX_BUFFER_AGGRESIZE; - pPacket = RTMP_AllocateRxPacketBuffer( - pAd, - pDmaBuf->AllocSize, - FALSE, - &pDmaBuf->AllocVa, - &pDmaBuf->AllocPa); - - /* keep allocated rx packet */ - pAd->RxRing.Cell[index].pNdisPacket = pPacket; - - // Error handling - if (pDmaBuf->AllocVa == NULL) - { - ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; - DBGPRINT_ERR(("Failed to allocate RxRing's 1st buffer\n")); - Status = NDIS_STATUS_RESOURCES; - break; - } - - // Zero init this memory block - NdisZeroMemory(pDmaBuf->AllocVa, pDmaBuf->AllocSize); - - // Write RxD buffer address & allocated buffer length - pRxD = (PRXD_STRUC) pAd->RxRing.Cell[index].AllocVa; - pRxD->SDP0 = RTMP_GetPhysicalAddressLow(pDmaBuf->AllocPa); - pRxD->DDONE = 0; - } - - DBGPRINT(RT_DEBUG_TRACE, ("Rx Ring: total %d entry allocated\n", index)); - - } while (FALSE); - - - NdisZeroMemory(&pAd->FragFrame, sizeof(FRAGMENT_FRAME)); - pAd->FragFrame.pFragPacket = RTMP_AllocateFragPacketBuffer(pAd, RX_BUFFER_NORMSIZE); - - if (pAd->FragFrame.pFragPacket == NULL) - { - Status = NDIS_STATUS_RESOURCES; - } - - if (Status != NDIS_STATUS_SUCCESS) - { - // Log error inforamtion - NdisWriteErrorLogEntry( - pAd->AdapterHandle, - NDIS_ERROR_CODE_OUT_OF_RESOURCES, - 1, - ErrorValue); - } - - DBGPRINT_S(Status, ("<-- RTMPAllocTxRxRingMemory, Status=%x\n", Status)); - return Status; -} - - -/* - ======================================================================== - - Routine Description: - Initialize transmit data structures - - Arguments: - Adapter Pointer to our adapter - - Return Value: - None - - IRQL = PASSIVE_LEVEL - - Note: - Initialize all transmit releated private buffer, include those define - in RTMP_ADAPTER structure and all private data structures. - - ======================================================================== -*/ -VOID NICInitTxRxRingAndBacklogQueue( - IN PRTMP_ADAPTER pAd) -{ - //WPDMA_GLO_CFG_STRUC GloCfg; - int i; - - DBGPRINT(RT_DEBUG_TRACE, ("<--> NICInitTxRxRingAndBacklogQueue\n")); - - // Initialize all transmit related software queues - InitializeQueueHeader(&pAd->TxSwQueue[QID_AC_BE]); - InitializeQueueHeader(&pAd->TxSwQueue[QID_AC_BK]); - InitializeQueueHeader(&pAd->TxSwQueue[QID_AC_VI]); - InitializeQueueHeader(&pAd->TxSwQueue[QID_AC_VO]); - InitializeQueueHeader(&pAd->TxSwQueue[QID_HCCA]); - - // Init RX Ring index pointer - pAd->RxRing.RxSwReadIdx = 0; - pAd->RxRing.RxCpuIdx = RX_RING_SIZE - 1; - - // Init TX rings index pointer - for (i=0; iTxRing[i].TxSwFreeIdx = 0; - pAd->TxRing[i].TxCpuIdx = 0; - } - - // init MGMT ring index pointer - pAd->MgmtRing.TxSwFreeIdx = 0; - pAd->MgmtRing.TxCpuIdx = 0; - - pAd->PrivateInfo.TxRingFullCnt = 0; -} - - -/* - ======================================================================== - - Routine Description: - Reset NIC Asics. Call after rest DMA. So reset TX_CTX_IDX to zero. - - Arguments: - Adapter Pointer to our adapter - - Return Value: - None - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - Note: - Reset NIC to initial state AS IS system boot up time. - - ======================================================================== -*/ -VOID RTMPRingCleanUp( - IN PRTMP_ADAPTER pAd, - IN UCHAR RingType) -{ - PTXD_STRUC pTxD; - PRXD_STRUC pRxD; - PQUEUE_ENTRY pEntry; - PNDIS_PACKET pPacket; - int i; - PRTMP_TX_RING pTxRing; - unsigned long IrqFlags; - - DBGPRINT(RT_DEBUG_TRACE,("RTMPRingCleanUp(RingIdx=%d, Pending-NDIS=%ld)\n", RingType, pAd->RalinkCounters.PendingNdisPacketCount)); - switch (RingType) - { - case QID_AC_BK: - case QID_AC_BE: - case QID_AC_VI: - case QID_AC_VO: - case QID_HCCA: - RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); - pTxRing = &pAd->TxRing[RingType]; - - // We have to clean all descriptors in case some error happened with reset - for (i=0; iCell[i].AllocVa; - - pPacket = (PNDIS_PACKET) pTxRing->Cell[i].pNdisPacket; - // release scatter-and-gather NDIS_PACKET - if (pPacket) - { - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - pTxRing->Cell[i].pNdisPacket = NULL; - } - - pPacket = (PNDIS_PACKET) pTxRing->Cell[i].pNextNdisPacket; - // release scatter-and-gather NDIS_PACKET - if (pPacket) - { - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - pTxRing->Cell[i].pNextNdisPacket = NULL; - } - } - - RTMP_IO_READ32(pAd, TX_DTX_IDX0 + RingType * 0x10, &pTxRing->TxDmaIdx); - pTxRing->TxSwFreeIdx = pTxRing->TxDmaIdx; - pTxRing->TxCpuIdx = pTxRing->TxDmaIdx; - RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + RingType * 0x10, pTxRing->TxCpuIdx); - - RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); - RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); - while (pAd->TxSwQueue[RingType].Head != NULL) - { - pEntry = RemoveHeadQueue(&pAd->TxSwQueue[RingType]); - pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - DBGPRINT(RT_DEBUG_TRACE,("Release 1 NDIS packet from s/w backlog queue\n")); - } - RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); - break; - - case QID_MGMT: - // We have to clean all descriptors in case some error happened with reset - NdisAcquireSpinLock(&pAd->MgmtRingLock); - - for (i=0; iMgmtRing.Cell[i].AllocVa; - - pPacket = (PNDIS_PACKET) pAd->MgmtRing.Cell[i].pNdisPacket; - // rlease scatter-and-gather NDIS_PACKET - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - } - pAd->MgmtRing.Cell[i].pNdisPacket = NULL; - - pPacket = (PNDIS_PACKET) pAd->MgmtRing.Cell[i].pNextNdisPacket; - // release scatter-and-gather NDIS_PACKET - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - } - pAd->MgmtRing.Cell[i].pNextNdisPacket = NULL; - - } - - RTMP_IO_READ32(pAd, TX_MGMTDTX_IDX, &pAd->MgmtRing.TxDmaIdx); - pAd->MgmtRing.TxSwFreeIdx = pAd->MgmtRing.TxDmaIdx; - pAd->MgmtRing.TxCpuIdx = pAd->MgmtRing.TxDmaIdx; - RTMP_IO_WRITE32(pAd, TX_MGMTCTX_IDX, pAd->MgmtRing.TxCpuIdx); - - NdisReleaseSpinLock(&pAd->MgmtRingLock); - pAd->RalinkCounters.MgmtRingFullCount = 0; - break; - - case QID_RX: - // We have to clean all descriptors in case some error happened with reset - NdisAcquireSpinLock(&pAd->RxRingLock); - - for (i=0; iRxRing.Cell[i].AllocVa; - pRxD->DDONE = 0 ; - } - - RTMP_IO_READ32(pAd, RX_DRX_IDX, &pAd->RxRing.RxDmaIdx); - pAd->RxRing.RxSwReadIdx = pAd->RxRing.RxDmaIdx; - pAd->RxRing.RxCpuIdx = ((pAd->RxRing.RxDmaIdx == 0) ? (RX_RING_SIZE-1) : (pAd->RxRing.RxDmaIdx-1)); - RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RxCpuIdx); - - NdisReleaseSpinLock(&pAd->RxRingLock); - break; - - default: - break; - } -} - - -NDIS_STATUS AdapterBlockAllocateMemory( - IN PVOID handle, - OUT PVOID *ppAd) -{ - PPCI_DEV pci_dev; - dma_addr_t *phy_addr; - POS_COOKIE pObj = (POS_COOKIE) handle; - - pci_dev = pObj->pci_dev; - phy_addr = &pObj->pAd_pa; - - *ppAd = (PVOID)vmalloc(sizeof(RTMP_ADAPTER)); //pci_alloc_consistent(pci_dev, sizeof(RTMP_ADAPTER), phy_addr); - - if (*ppAd) - { - NdisZeroMemory(*ppAd, sizeof(RTMP_ADAPTER)); - ((PRTMP_ADAPTER)*ppAd)->OS_Cookie = handle; - return (NDIS_STATUS_SUCCESS); - } else { - return (NDIS_STATUS_FAILURE); - } -} - - -void RTMP_AllocateTxDescMemory( - IN PRTMP_ADAPTER pAd, - IN UINT Index, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) -{ - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; - - *VirtualAddress = (PVOID)PCI_ALLOC_CONSISTENT(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); - -} - -void RTMP_AllocateMgmtDescMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) -{ - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; - - *VirtualAddress = (PVOID)PCI_ALLOC_CONSISTENT(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); - -} - -void RTMP_AllocateRxDescMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) -{ - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; - - *VirtualAddress = (PVOID)PCI_ALLOC_CONSISTENT(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); - -} - -void RTMP_FreeRxDescMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN PVOID VirtualAddress, - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress) -{ - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; - - PCI_FREE_CONSISTENT(pObj->pci_dev, Length, VirtualAddress, PhysicalAddress); -} - - -void RTMP_AllocateFirstTxBuffer( - IN PRTMP_ADAPTER pAd, - IN UINT Index, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) -{ - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; - - *VirtualAddress = (PVOID)PCI_ALLOC_CONSISTENT(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); -} - -/* - * FUNCTION: Allocate a common buffer for DMA - * ARGUMENTS: - * AdapterHandle: AdapterHandle - * Length: Number of bytes to allocate - * Cached: Whether or not the memory can be cached - * VirtualAddress: Pointer to memory is returned here - * PhysicalAddress: Physical address corresponding to virtual address - */ - -void RTMP_AllocateSharedMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) -{ - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; - - *VirtualAddress = (PVOID)PCI_ALLOC_CONSISTENT(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); -} - -VOID RTMPFreeTxRxRingMemory( - IN PRTMP_ADAPTER pAd) -{ - int index, num , j; - PRTMP_TX_RING pTxRing; - PTXD_STRUC pTxD; - PNDIS_PACKET pPacket; - unsigned int IrqFlags; - - POS_COOKIE pObj =(POS_COOKIE) pAd->OS_Cookie; - - DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPFreeTxRxRingMemory\n")); - - // Free TxSwQueue Packet - for (index=0; index irq_lock, IrqFlags); - pQueue = &pAd->TxSwQueue[index]; - while (pQueue->Head) - { - pEntry = RemoveHeadQueue(pQueue); - pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - } - RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); - } - - // Free Tx Ring Packet - for (index=0;index< NUM_OF_TX_RING;index++) - { - pTxRing = &pAd->TxRing[index]; - - for (j=0; j< TX_RING_SIZE; j++) - { - pTxD = (PTXD_STRUC) (pTxRing->Cell[j].AllocVa); - pPacket = pTxRing->Cell[j].pNdisPacket; - - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - //Always assign pNdisPacket as NULL after clear - pTxRing->Cell[j].pNdisPacket = NULL; - - pPacket = pTxRing->Cell[j].pNextNdisPacket; - - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - //Always assign pNextNdisPacket as NULL after clear - pTxRing->Cell[pTxRing->TxSwFreeIdx].pNextNdisPacket = NULL; - - } - } - - for (index = RX_RING_SIZE - 1 ; index >= 0; index--) - { - if ((pAd->RxRing.Cell[index].DmaBuf.AllocVa) && (pAd->RxRing.Cell[index].pNdisPacket)) - { - PCI_UNMAP_SINGLE(pObj->pci_dev, pAd->RxRing.Cell[index].DmaBuf.AllocPa, pAd->RxRing.Cell[index].DmaBuf.AllocSize, PCI_DMA_FROMDEVICE); - RELEASE_NDIS_PACKET(pAd, pAd->RxRing.Cell[index].pNdisPacket, NDIS_STATUS_SUCCESS); - } - } - NdisZeroMemory(pAd->RxRing.Cell, RX_RING_SIZE * sizeof(RTMP_DMACB)); - - if (pAd->RxDescRing.AllocVa) - { - PCI_FREE_CONSISTENT(pObj->pci_dev, pAd->RxDescRing.AllocSize, pAd->RxDescRing.AllocVa, pAd->RxDescRing.AllocPa); - } - NdisZeroMemory(&pAd->RxDescRing, sizeof(RTMP_DMABUF)); - - if (pAd->MgmtDescRing.AllocVa) - { - PCI_FREE_CONSISTENT(pObj->pci_dev, pAd->MgmtDescRing.AllocSize, pAd->MgmtDescRing.AllocVa, pAd->MgmtDescRing.AllocPa); - } - NdisZeroMemory(&pAd->MgmtDescRing, sizeof(RTMP_DMABUF)); - - for (num = 0; num < NUM_OF_TX_RING; num++) - { - if (pAd->TxBufSpace[num].AllocVa) - { - PCI_FREE_CONSISTENT(pObj->pci_dev, pAd->TxBufSpace[num].AllocSize, pAd->TxBufSpace[num].AllocVa, pAd->TxBufSpace[num].AllocPa); - } - NdisZeroMemory(&pAd->TxBufSpace[num], sizeof(RTMP_DMABUF)); - - if (pAd->TxDescRing[num].AllocVa) - { - PCI_FREE_CONSISTENT(pObj->pci_dev, pAd->TxDescRing[num].AllocSize, pAd->TxDescRing[num].AllocVa, pAd->TxDescRing[num].AllocPa); - } - NdisZeroMemory(&pAd->TxDescRing[num], sizeof(RTMP_DMABUF)); - } - - if (pAd->FragFrame.pFragPacket) - RELEASE_NDIS_PACKET(pAd, pAd->FragFrame.pFragPacket, NDIS_STATUS_SUCCESS); - - DBGPRINT(RT_DEBUG_TRACE, ("<-- RTMPFreeTxRxRingMemory\n")); -} - - -/* - * FUNCTION: Allocate a packet buffer for DMA - * ARGUMENTS: - * AdapterHandle: AdapterHandle - * Length: Number of bytes to allocate - * Cached: Whether or not the memory can be cached - * VirtualAddress: Pointer to memory is returned here - * PhysicalAddress: Physical address corresponding to virtual address - * Notes: - * Cached is ignored: always cached memory - */ -PNDIS_PACKET RTMP_AllocateRxPacketBuffer( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) -{ - PNDIS_PACKET pkt; - - pkt = RTPKT_TO_OSPKT(DEV_ALLOC_SKB(Length)); - - if (pkt == NULL) { - DBGPRINT(RT_DEBUG_ERROR, ("can't allocate rx %ld size packet\n",Length)); - } - - if (pkt) { - RTMP_SET_PACKET_SOURCE(pkt, PKTSRC_NDIS); - *VirtualAddress = (PVOID) RTPKT_TO_OSPKT(pkt)->data; - *PhysicalAddress = PCI_MAP_SINGLE(pAd, *VirtualAddress, Length, -1, PCI_DMA_FROMDEVICE); - } else { - *VirtualAddress = (PVOID) NULL; - *PhysicalAddress = (NDIS_PHYSICAL_ADDRESS) NULL; - } - - return (PNDIS_PACKET) pkt; -} - - -VOID Invalid_Remaining_Packet( - IN PRTMP_ADAPTER pAd, - IN ULONG VirtualAddress) -{ - NDIS_PHYSICAL_ADDRESS PhysicalAddress; - - PhysicalAddress = PCI_MAP_SINGLE(pAd, (void *)(VirtualAddress+1600), RX_BUFFER_NORMSIZE-1600, -1, PCI_DMA_FROMDEVICE); -} - -PNDIS_PACKET GetPacketFromRxRing( - IN PRTMP_ADAPTER pAd, - OUT PRT28XX_RXD_STRUC pSaveRxD, - OUT BOOLEAN *pbReschedule, - IN OUT UINT32 *pRxPending) -{ - PRXD_STRUC pRxD; - PNDIS_PACKET pRxPacket = NULL; - PNDIS_PACKET pNewPacket; - PVOID AllocVa; - NDIS_PHYSICAL_ADDRESS AllocPa; - BOOLEAN bReschedule = FALSE; - - RTMP_SEM_LOCK(&pAd->RxRingLock); - - if (*pRxPending == 0) - { - // Get how may packets had been received - RTMP_IO_READ32(pAd, RX_DRX_IDX , &pAd->RxRing.RxDmaIdx); - - if (pAd->RxRing.RxSwReadIdx == pAd->RxRing.RxDmaIdx) - { - // no more rx packets - bReschedule = FALSE; - goto done; - } - - // get rx pending count - if (pAd->RxRing.RxDmaIdx > pAd->RxRing.RxSwReadIdx) - *pRxPending = pAd->RxRing.RxDmaIdx - pAd->RxRing.RxSwReadIdx; - else - *pRxPending = pAd->RxRing.RxDmaIdx + RX_RING_SIZE - pAd->RxRing.RxSwReadIdx; - - } - - // Point to Rx indexed rx ring descriptor - pRxD = (PRXD_STRUC) pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx].AllocVa; - - if (pRxD->DDONE == 0) - { - *pRxPending = 0; - // DMAIndx had done but DDONE bit not ready - bReschedule = TRUE; - goto done; - } - - - // return rx descriptor - NdisMoveMemory(pSaveRxD, pRxD, RXD_SIZE); - - pNewPacket = RTMP_AllocateRxPacketBuffer(pAd, RX_BUFFER_AGGRESIZE, FALSE, &AllocVa, &AllocPa); - - if (pNewPacket) - { - // unmap the rx buffer - PCI_UNMAP_SINGLE(pAd, pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx].DmaBuf.AllocPa, - pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx].DmaBuf.AllocSize, PCI_DMA_FROMDEVICE); - pRxPacket = pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx].pNdisPacket; - - pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx].DmaBuf.AllocSize = RX_BUFFER_AGGRESIZE; - pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx].pNdisPacket = (PNDIS_PACKET) pNewPacket; - pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx].DmaBuf.AllocVa = AllocVa; - pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx].DmaBuf.AllocPa = AllocPa; - /* update SDP0 to new buffer of rx packet */ - pRxD->SDP0 = AllocPa; - } - else - { - //printk("No Rx Buffer\n"); - pRxPacket = NULL; - bReschedule = TRUE; - } - - pRxD->DDONE = 0; - - // had handled one rx packet - *pRxPending = *pRxPending - 1; - - // update rx descriptor and kick rx - INC_RING_INDEX(pAd->RxRing.RxSwReadIdx, RX_RING_SIZE); - - pAd->RxRing.RxCpuIdx = (pAd->RxRing.RxSwReadIdx == 0) ? (RX_RING_SIZE-1) : (pAd->RxRing.RxSwReadIdx-1); - RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RxCpuIdx); - -done: - RTMP_SEM_UNLOCK(&pAd->RxRingLock); - *pbReschedule = bReschedule; - return pRxPacket; -} -/* End of 2860_rtmp_init.c */ - diff --git a/drivers/staging/rt2860/common/action.c b/drivers/staging/rt2860/common/action.c index 256cb67e0594..5593966f0a94 100644 --- a/drivers/staging/rt2860/common/action.c +++ b/drivers/staging/rt2860/common/action.c @@ -150,7 +150,9 @@ VOID MlmeADDBAAction( MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(FRAME_ADDBA_REQ), &Frame, END_OF_ARGS); - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); + + MiniportMMRequest(pAd, (MGMT_USE_QUEUE_FLAG | MapUserPriorityToAccessCategory[pInfo->TID]), pOutBuffer, FrameLen); + MlmeFreeMemory(pAd, pOutBuffer); DBGPRINT(RT_DEBUG_TRACE, ("BA - Send ADDBA request. StartSeq = %x, FrameLen = %ld. BufSize = %d\n", Frame.BaStartSeq.field.StartSeq, FrameLen, Frame.BaParm.BufSize)); @@ -527,9 +529,13 @@ VOID SendRefreshBAR( MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(FRAME_BAR), &FrameBar, END_OF_ARGS); + //if (!(CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_RALINK_CHIPSET))) + if (1) // Now we always send BAR. + { + //MiniportMMRequestUnlock(pAd, 0, pOutBuffer, FrameLen); + MiniportMMRequest(pAd, (MGMT_USE_QUEUE_FLAG | MapUserPriorityToAccessCategory[TID]), pOutBuffer, FrameLen); - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); - + } MlmeFreeMemory(pAd, pOutBuffer); } } diff --git a/drivers/staging/rt2860/common/ba_action.c b/drivers/staging/rt2860/common/ba_action.c index b7bbe99d4d57..ff4dce6786fd 100644 --- a/drivers/staging/rt2860/common/ba_action.c +++ b/drivers/staging/rt2860/common/ba_action.c @@ -35,8 +35,8 @@ #define ORI_BA_SESSION_TIMEOUT (2000) // ms #define REC_BA_SESSION_IDLE_TIMEOUT (1000) // ms -#define REORDERING_PACKET_TIMEOUT ((100 * HZ)/1000) // system ticks -- 100 ms -#define MAX_REORDERING_PACKET_TIMEOUT ((3000 * HZ)/1000) // system ticks -- 100 ms +#define REORDERING_PACKET_TIMEOUT ((100 * OS_HZ)/1000) // system ticks -- 100 ms +#define MAX_REORDERING_PACKET_TIMEOUT ((3000 * OS_HZ)/1000) // system ticks -- 100 ms #define RESET_RCV_SEQ (0xFFFF) @@ -460,6 +460,8 @@ void ba_flush_reordering_timeout_mpdus( pBAEntry->LastIndSeq = Sequence; } + DBGPRINT(RT_DEBUG_OFF, ("%x, flush one!\n", pBAEntry->LastIndSeq)); + } } @@ -493,7 +495,7 @@ VOID BAOriSessionSetUp( { // try again after 3 secs DelayTime = 3000; -// printk("DeCline BA from Peer\n"); +// DBGPRINT(RT_DEBUG_TRACE, ("DeCline BA from Peer\n")); // return; } @@ -531,11 +533,6 @@ VOID BAOriSessionSetUp( pBAEntry->TimeOutValue = TimeOut; pBAEntry->pAdapter = pAd; - DBGPRINT(RT_DEBUG_TRACE,("Send AddBA to %02x:%02x:%02x:%02x:%02x:%02x Tid:%d isForced:%d Wcid:%d\n" - ,pEntry->Addr[0],pEntry->Addr[1],pEntry->Addr[2] - ,pEntry->Addr[3],pEntry->Addr[4],pEntry->Addr[5] - ,TID,isForced,pEntry->Aid)); - if (!(pEntry->TXBAbitmap & (1<ORIBATimer, GET_TIMER_FUNCTION(BAOriSessionSetupTimeout), pBAEntry, FALSE); @@ -573,6 +570,8 @@ VOID BAOriSessionAdd( pBAEntry->TimeOutValue = pFrame->TimeOutValue; pBAEntry->ORI_BA_Status = Originator_Done; + pAd->BATable.numDoneOriginator ++; + // reset sequence number pBAEntry->Sequence = BA_ORI_INIT_SEQ; // Set Bitmap flag. @@ -668,7 +667,7 @@ BOOLEAN BARecSessionAdd( // initial sequence number pBAEntry->LastIndSeq = RESET_RCV_SEQ; //pFrame->BaStartSeq.field.StartSeq; - printk("Start Seq = %08x\n", pFrame->BaStartSeq.field.StartSeq); + DBGPRINT(RT_DEBUG_OFF, ("Start Seq = %08x\n", pFrame->BaStartSeq.field.StartSeq)); if (pEntry->RXBAbitmap & (1<BADeclineBitmap &= ~(1<Aid, TID); + RTMP_ADD_BA_SESSION_TO_ASIC(pAd, pEntry->Aid, TID); DBGPRINT(RT_DEBUG_TRACE,("MACEntry[%d]RXBAbitmap = 0x%x. BARecWcidArray=%d\n", pEntry->Aid, pEntry->RXBAbitmap, pEntry->BARecWcidArray[TID])); @@ -713,8 +712,8 @@ BA_REC_ENTRY *BATableAllocRecEntry( if (pAd->BATable.numAsRecipient >= MAX_BARECI_SESSION) { - printk("BA Recipeint Session (%ld) > %d\n", pAd->BATable.numAsRecipient, - MAX_BARECI_SESSION); + DBGPRINT(RT_DEBUG_OFF, ("BA Recipeint Session (%ld) > %d\n", + pAd->BATable.numAsRecipient, MAX_BARECI_SESSION)); goto done; } @@ -794,6 +793,7 @@ VOID BATableFreeOriEntry( NdisAcquireSpinLock(&pAd->BATabLock); if (pBAEntry->ORI_BA_Status == Originator_Done) { + pAd->BATable.numDoneOriginator -= 1; pEntry->TXBAbitmap &= (~(1<<(pBAEntry->TID) )); DBGPRINT(RT_DEBUG_TRACE, ("BATableFreeOriEntry numAsOriginator= %ld\n", pAd->BATable.numAsRecipient)); // Erase Bitmap flag. @@ -867,9 +867,8 @@ VOID BAOriSessionTearDown( // force send specified TID DelBA MLME_DELBA_REQ_STRUCT DelbaReq; MLME_QUEUE_ELEM *Elem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); - if (Elem == NULL) - return; - + if (Elem != NULL) + { NdisZeroMemory(&DelbaReq, sizeof(DelbaReq)); NdisZeroMemory(Elem, sizeof(MLME_QUEUE_ELEM)); @@ -877,15 +876,15 @@ VOID BAOriSessionTearDown( DelbaReq.Wcid = Wcid; DelbaReq.TID = TID; DelbaReq.Initiator = ORIGINATOR; -#if 1 Elem->MsgLen = sizeof(DelbaReq); NdisMoveMemory(Elem->Msg, &DelbaReq, sizeof(DelbaReq)); MlmeDELBAAction(pAd, Elem); kfree(Elem); -#else - MlmeEnqueue(pAd, ACTION_STATE_MACHINE, MT2_MLME_ORI_DELBA_CATE, sizeof(MLME_DELBA_REQ_STRUCT), (PVOID)&DelbaReq); - RT28XX_MLME_HANDLER(pAd); -#endif + } + else + { + DBGPRINT(RT_DEBUG_ERROR, ("%s(bForceSend):alloc memory failed!\n", __func__)); + } } return; @@ -902,9 +901,8 @@ VOID BAOriSessionTearDown( { MLME_DELBA_REQ_STRUCT DelbaReq; MLME_QUEUE_ELEM *Elem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); - if (Elem == NULL) - return; - + if (Elem != NULL) + { NdisZeroMemory(&DelbaReq, sizeof(DelbaReq)); NdisZeroMemory(Elem, sizeof(MLME_QUEUE_ELEM)); @@ -912,15 +910,16 @@ VOID BAOriSessionTearDown( DelbaReq.Wcid = Wcid; DelbaReq.TID = pBAEntry->TID; DelbaReq.Initiator = ORIGINATOR; -#if 1 Elem->MsgLen = sizeof(DelbaReq); NdisMoveMemory(Elem->Msg, &DelbaReq, sizeof(DelbaReq)); MlmeDELBAAction(pAd, Elem); kfree(Elem); -#else - MlmeEnqueue(pAd, ACTION_STATE_MACHINE, MT2_MLME_ORI_DELBA_CATE, sizeof(MLME_DELBA_REQ_STRUCT), (PVOID)&DelbaReq); - RT28XX_MLME_HANDLER(pAd); -#endif + } + else + { + DBGPRINT(RT_DEBUG_ERROR, ("%s():alloc memory failed!\n", __func__)); + return; + } } RTMPCancelTimer(&pBAEntry->ORIBATimer, &Cancelled); BATableFreeOriEntry(pAd, Idx); @@ -964,7 +963,6 @@ VOID BARecSessionTearDown( { MLME_DELBA_REQ_STRUCT DelbaReq; BOOLEAN Cancelled; - MLME_QUEUE_ELEM *Elem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); //ULONG offset; //UINT32 VALUE; @@ -975,6 +973,9 @@ VOID BARecSessionTearDown( // if (bPassive == FALSE) { + MLME_QUEUE_ELEM *Elem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); + if (Elem != NULL) + { NdisZeroMemory(&DelbaReq, sizeof(DelbaReq)); NdisZeroMemory(Elem, sizeof(MLME_QUEUE_ELEM)); @@ -982,15 +983,16 @@ VOID BARecSessionTearDown( DelbaReq.Wcid = Wcid; DelbaReq.TID = TID; DelbaReq.Initiator = RECIPIENT; -#if 1 Elem->MsgLen = sizeof(DelbaReq); NdisMoveMemory(Elem->Msg, &DelbaReq, sizeof(DelbaReq)); MlmeDELBAAction(pAd, Elem); kfree(Elem); -#else - MlmeEnqueue(pAd, ACTION_STATE_MACHINE, MT2_MLME_ORI_DELBA_CATE, sizeof(MLME_DELBA_REQ_STRUCT), (PVOID)&DelbaReq); - RT28XX_MLME_HANDLER(pAd); -#endif + } + else + { + DBGPRINT(RT_DEBUG_ERROR, ("%s():alloc memory failed!\n", __func__)); + return; + } } @@ -1009,7 +1011,7 @@ VOID BARecSessionTearDown( pAd->MacTab.Content[Wcid].RXBAbitmap &= (~(1<<(pBAEntry->TID))); pAd->MacTab.Content[Wcid].BARecWcidArray[TID] = 0; - RT28XX_DEL_BA_SESSION_FROM_ASIC(pAd, Wcid, TID); + RTMP_DEL_BA_SESSION_FROM_ASIC(pAd, Wcid, TID); NdisReleaseSpinLock(&pAd->BATabLock); @@ -1061,9 +1063,12 @@ VOID BAOriSessionSetupTimeout( pAd = pBAEntry->pAdapter; + { // Do nothing if monitor mode is on if (MONITOR_ON(pAd)) return; + } + pEntry = &pAd->MacTab.Content[pBAEntry->Wcid]; @@ -1079,12 +1084,9 @@ VOID BAOriSessionSetupTimeout( AddbaReq.TimeOutValue = 0; AddbaReq.Token = pBAEntry->Token; MlmeEnqueue(pAd, ACTION_STATE_MACHINE, MT2_MLME_ADD_BA_CATE, sizeof(MLME_ADDBA_REQ_STRUCT), (PVOID)&AddbaReq); - RT28XX_MLME_HANDLER(pAd); - DBGPRINT(RT_DEBUG_TRACE,("BA Ori Session Timeout(%d) to %02x:%02x:%02x:%02x:%02x:%02x Tid:%d Wcid:%d\n" - ,pBAEntry->Token - ,pEntry->Addr[0],pEntry->Addr[1],pEntry->Addr[2] - ,pEntry->Addr[3],pEntry->Addr[4],pEntry->Addr[5] - ,pBAEntry->TID,pEntry->Aid)); + RTMP_MLME_HANDLER(pAd); + DBGPRINT(RT_DEBUG_TRACE,("BA Ori Session Timeout(%d) : Send ADD BA again\n", pBAEntry->Token)); + pBAEntry->Token++; RTMPSetTimer(&pBAEntry->ORIBATimer, ORI_BA_SESSION_TIMEOUT); } @@ -1131,7 +1133,7 @@ VOID BARecSessionIdleTimeout( pAd = pBAEntry->pAdapter; // flush all pending reordering mpdus ba_refresh_reordering_mpdus(pAd, pBAEntry); - printk("%ld: REC BA session Timeout\n", Now32); + DBGPRINT(RT_DEBUG_OFF, ("%ld: REC BA session Timeout\n", Now32)); } } } @@ -1174,7 +1176,7 @@ VOID PeerAddBAReqAction( if ((pAd->CommonCfg.bBADecline == FALSE) && IS_HT_STA(pMacEntry)) { pAddreqFrame = (PFRAME_ADDBA_REQ)(&Elem->Msg[0]); - printk("Rcv Wcid(%d) AddBAReq\n", Elem->Wcid); + DBGPRINT(RT_DEBUG_OFF, ("Rcv Wcid(%d) AddBAReq\n", Elem->Wcid)); if (BARecSessionAdd(pAd, &pAd->MacTab.Content[Elem->Wcid], pAddreqFrame)) Status = 0; else @@ -1367,7 +1369,7 @@ BOOLEAN CntlEnqueueForRecv( if (SEQ_SMALLER(pBAEntry->LastIndSeq, pFrame->BAStartingSeq.field.StartSeq, MAXSEQ)) { - //printk("BAR Seq = %x, LastIndSeq = %x\n", pFrame->BAStartingSeq.field.StartSeq, pBAEntry->LastIndSeq); + //DBGPRINT(RT_DEBUG_TRACE, ("BAR Seq = %x, LastIndSeq = %x\n", pFrame->BAStartingSeq.field.StartSeq, pBAEntry->LastIndSeq)); ba_indicate_reordering_mpdus_le_seq(pAd, pBAEntry, pFrame->BAStartingSeq.field.StartSeq); pBAEntry->LastIndSeq = (pFrame->BAStartingSeq.field.StartSeq == 0) ? MAXSEQ :(pFrame->BAStartingSeq.field.StartSeq -1); } @@ -1388,8 +1390,6 @@ VOID SendPSMPAction( //ULONG Idx; FRAME_PSMP_ACTION Frame; ULONG FrameLen; - UCHAR bbpdata=0; - UINT32 macdata; NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory if (NStatus != NDIS_STATUS_SUCCESS) @@ -1405,48 +1405,26 @@ VOID SendPSMPAction( switch (Psmp) { case MMPS_ENABLE: - if (IS_RT3090(pAd)) +#ifdef RT30xx + if (IS_RT30xx(pAd) + &&(pAd->Antenna.field.RxPath>1||pAd->Antenna.field.TxPath>1)) { - // disable MMPS BBP control register - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &bbpdata); - bbpdata &= ~(0x04); //bit 2 - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, bbpdata); - - // disable MMPS MAC control register - RTMP_IO_READ32(pAd, 0x1210, &macdata); - macdata &= ~(0x09); //bit 0, 3 - RTMP_IO_WRITE32(pAd, 0x1210, macdata); + RTMP_ASIC_MMPS_DISABLE(pAd); } +#endif // RT30xx // Frame.Psmp = 0; break; case MMPS_DYNAMIC: - if (IS_RT3090(pAd)) - { - // enable MMPS BBP control register - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &bbpdata); - bbpdata |= 0x04; //bit 2 - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, bbpdata); - - // enable MMPS MAC control register - RTMP_IO_READ32(pAd, 0x1210, &macdata); - macdata |= 0x09; //bit 0, 3 - RTMP_IO_WRITE32(pAd, 0x1210, macdata); - } Frame.Psmp = 3; break; case MMPS_STATIC: - if (IS_RT3090(pAd)) +#ifdef RT30xx + if (IS_RT30xx(pAd) + &&(pAd->Antenna.field.RxPath>1||pAd->Antenna.field.TxPath>1)) { - // enable MMPS BBP control register - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &bbpdata); - bbpdata |= 0x04; //bit 2 - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, bbpdata); - - // enable MMPS MAC control register - RTMP_IO_READ32(pAd, 0x1210, &macdata); - macdata |= 0x09; //bit 0, 3 - RTMP_IO_WRITE32(pAd, 0x1210, macdata); + RTMP_ASIC_MMPS_ENABLE(pAd); } +#endif // RT30xx // Frame.Psmp = 1; break; } @@ -1504,20 +1482,22 @@ void convert_reordering_packet_to_preAMSDU_or_802_3_packet( ASSERT(pRxBlk->pRxPacket); pRxPkt = RTPKT_TO_OSPKT(pRxBlk->pRxPacket); - RTPKT_TO_OSPKT(pRxPkt)->dev = get_netdev_from_bssid(pAd, FromWhichBSSID); - RTPKT_TO_OSPKT(pRxPkt)->data = pRxBlk->pData; - RTPKT_TO_OSPKT(pRxPkt)->len = pRxBlk->DataSize; - RTPKT_TO_OSPKT(pRxPkt)->tail = RTPKT_TO_OSPKT(pRxPkt)->data + RTPKT_TO_OSPKT(pRxPkt)->len; + SET_OS_PKT_NETDEV(pRxPkt, get_netdev_from_bssid(pAd, FromWhichBSSID)); + SET_OS_PKT_DATAPTR(pRxPkt, pRxBlk->pData); + SET_OS_PKT_LEN(pRxPkt, pRxBlk->DataSize); + SET_OS_PKT_DATATAIL(pRxPkt, pRxBlk->pData, pRxBlk->DataSize); // // copy 802.3 header, if necessary // if (!RX_BLK_TEST_FLAG(pRxBlk, fRX_AMSDU)) { + { #ifdef LINUX NdisMoveMemory(skb_push(pRxPkt, LENGTH_802_3), Header802_3, LENGTH_802_3); #endif } + } } @@ -1550,7 +1530,8 @@ static VOID ba_enqueue_reordering_packet( UINT16 Sequence = (UINT16) pRxBlk->pHeader->Sequence; mpdu_blk = ba_mpdu_blk_alloc(pAd); - if (mpdu_blk != NULL) + if ((mpdu_blk != NULL) && + (!RX_BLK_TEST_FLAG(pRxBlk, fRX_EAP))) { // Write RxD buffer address & allocated buffer length NdisAcquireSpinLock(&pBAEntry->RxReRingLock); diff --git a/drivers/staging/rt2860/common/md5.c b/drivers/staging/rt2860/common/cmm_aes.c similarity index 53% rename from drivers/staging/rt2860/common/md5.c rename to drivers/staging/rt2860/common/cmm_aes.c index ad883ca2ffc8..2c311b166784 100644 --- a/drivers/staging/rt2860/common/md5.c +++ b/drivers/staging/rt2860/common/cmm_aes.c @@ -24,673 +24,644 @@ * * ************************************************************************* - Module Name: - md5.c + Module Name: + cmm_aes.c Abstract: Revision History: Who When What -------- ---------- ---------------------------------------------- - Name Date Modification logs - jan 10-28-03 Initial - Rita 11-23-04 Modify MD5 and SHA-1 - Rita 10-14-05 Modify SHA-1 in big-endian platform - */ -#include "../rt_config.h" - -/** - * md5_mac: - * @key: pointer to the key used for MAC generation - * @key_len: length of the key in bytes - * @data: pointer to the data area for which the MAC is generated - * @data_len: length of the data in bytes - * @mac: pointer to the buffer holding space for the MAC; the buffer should - * have space for 128-bit (16 bytes) MD5 hash value - * - * md5_mac() determines the message authentication code by using secure hash - * MD5(key | data | key). - */ -void md5_mac(u8 *key, size_t key_len, u8 *data, size_t data_len, u8 *mac) -{ - MD5_CTX context; + Paul Wu 02-25-02 Initial +*/ - MD5Init(&context); - MD5Update(&context, key, key_len); - MD5Update(&context, data, data_len); - MD5Update(&context, key, key_len); - MD5Final(mac, &context); -} +#include "../rt_config.h" -/** - * hmac_md5: - * @key: pointer to the key used for MAC generation - * @key_len: length of the key in bytes - * @data: pointer to the data area for which the MAC is generated - * @data_len: length of the data in bytes - * @mac: pointer to the buffer holding space for the MAC; the buffer should - * have space for 128-bit (16 bytes) MD5 hash value - * - * hmac_md5() determines the message authentication code using HMAC-MD5. - * This implementation is based on the sample code presented in RFC 2104. - */ -void hmac_md5(u8 *key, size_t key_len, u8 *data, size_t data_len, u8 *mac) + +typedef struct { - MD5_CTX context; - u8 k_ipad[65]; /* inner padding - key XORd with ipad */ - u8 k_opad[65]; /* outer padding - key XORd with opad */ - u8 tk[16]; - int i; + UINT32 erk[64]; /* encryption round keys */ + UINT32 drk[64]; /* decryption round keys */ + int nr; /* number of rounds */ +} +aes_context; - //assert(key != NULL && data != NULL && mac != NULL); +/*****************************/ +/******** SBOX Table *********/ +/*****************************/ - /* if key is longer than 64 bytes reset it to key = MD5(key) */ - if (key_len > 64) { - MD5_CTX ttcontext; +UCHAR SboxTable[256] = +{ + 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, + 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, + 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, + 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, + 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, + 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, + 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, + 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, + 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, + 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, + 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, + 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, + 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, + 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, + 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, + 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, + 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, + 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, + 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, + 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, + 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, + 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, + 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, + 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, + 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, + 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, + 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, + 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, + 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, + 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, + 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, + 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 +}; - MD5Init(&ttcontext); - MD5Update(&ttcontext, key, key_len); - MD5Final(tk, &ttcontext); - //key=(PUCHAR)ttcontext.buf; - key = tk; - key_len = 16; - } +VOID xor_32( + IN PUCHAR a, + IN PUCHAR b, + OUT PUCHAR out) +{ + INT i; - /* the HMAC_MD5 transform looks like: - * - * MD5(K XOR opad, MD5(K XOR ipad, text)) - * - * where K is an n byte key - * ipad is the byte 0x36 repeated 64 times - * opad is the byte 0x5c repeated 64 times - * and text is the data being protected */ - - /* start out by storing key in pads */ - NdisZeroMemory(k_ipad, sizeof(k_ipad)); - NdisZeroMemory(k_opad, sizeof(k_opad)); - //assert(key_len < sizeof(k_ipad)); - NdisMoveMemory(k_ipad, key, key_len); - NdisMoveMemory(k_opad, key, key_len); - - /* XOR key with ipad and opad values */ - for (i = 0; i < 64; i++) { - k_ipad[i] ^= 0x36; - k_opad[i] ^= 0x5c; + for (i=0;i<4; i++) + { + out[i] = a[i] ^ b[i]; } - - /* perform inner MD5 */ - MD5Init(&context); /* init context for 1st pass */ - MD5Update(&context, k_ipad, 64); /* start with inner pad */ - MD5Update(&context, data, data_len); /* then text of datagram */ - MD5Final(mac, &context); /* finish up 1st pass */ - - /* perform outer MD5 */ - MD5Init(&context); /* init context for 2nd pass */ - MD5Update(&context, k_opad, 64); /* start with outer pad */ - MD5Update(&context, mac, 16); /* then results of 1st hash */ - MD5Final(mac, &context); /* finish up 2nd pass */ } -#define byteReverse(buf, len) /* Nothing */ - -/* ========================== MD5 implementation =========================== */ -// four base functions for MD5 -#define MD5_F1(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define MD5_F2(x, y, z) (((x) & (z)) | ((y) & (~z))) -#define MD5_F3(x, y, z) ((x) ^ (y) ^ (z)) -#define MD5_F4(x, y, z) ((y) ^ ((x) | (~z))) -#define CYCLIC_LEFT_SHIFT(w, s) (((w) << (s)) | ((w) >> (32-(s)))) - -#define MD5Step(f, w, x, y, z, data, t, s) \ - ( w += f(x, y, z) + data + t, w = (CYCLIC_LEFT_SHIFT(w, s)) & 0xffffffff, w += x ) - - -/* - * Function Description: - * Initiate MD5 Context satisfied in RFC 1321 - * - * Arguments: - * pCtx Pointer to MD5 context - * - * Return Value: - * None - */ -VOID MD5Init(MD5_CTX *pCtx) +VOID xor_128( + IN PUCHAR a, + IN PUCHAR b, + OUT PUCHAR out) { - pCtx->Buf[0]=0x67452301; - pCtx->Buf[1]=0xefcdab89; - pCtx->Buf[2]=0x98badcfe; - pCtx->Buf[3]=0x10325476; + INT i; - pCtx->LenInBitCount[0]=0; - pCtx->LenInBitCount[1]=0; + for (i=0;i<16; i++) + { + out[i] = a[i] ^ b[i]; + } } - -/* - * Function Description: - * Update MD5 Context, allow of an arrary of octets as the next portion - * of the message - * - * Arguments: - * pCtx Pointer to MD5 context - * pData Pointer to input data - * LenInBytes The length of input data (unit: byte) - * - * Return Value: - * None - * - * Note: - * Called after MD5Init or MD5Update(itself) - */ -VOID MD5Update(MD5_CTX *pCtx, UCHAR *pData, UINT32 LenInBytes) +UCHAR RTMPCkipSbox( + IN UCHAR a) { - - UINT32 TfTimes; - UINT32 temp; - unsigned int i; - - temp = pCtx->LenInBitCount[0]; - - pCtx->LenInBitCount[0] = (UINT32) (pCtx->LenInBitCount[0] + (LenInBytes << 3)); - - if (pCtx->LenInBitCount[0] < temp) - pCtx->LenInBitCount[1]++; //carry in - - pCtx->LenInBitCount[1] += LenInBytes >> 29; - - // mod 64 bytes - temp = (temp >> 3) & 0x3f; - - // process lacks of 64-byte data - if (temp) - { - UCHAR *pAds = (UCHAR *) pCtx->Input + temp; - - if ((temp+LenInBytes) < 64) - { - NdisMoveMemory(pAds, (UCHAR *)pData, LenInBytes); - return; - } - - NdisMoveMemory(pAds, (UCHAR *)pData, 64-temp); - byteReverse(pCtx->Input, 16); - MD5Transform(pCtx->Buf, (UINT32 *)pCtx->Input); - - pData += 64-temp; - LenInBytes -= 64-temp; - } // end of if (temp) - - - TfTimes = (LenInBytes >> 6); - - for (i=TfTimes; i>0; i--) - { - NdisMoveMemory(pCtx->Input, (UCHAR *)pData, 64); - byteReverse(pCtx->Input, 16); - MD5Transform(pCtx->Buf, (UINT32 *)pCtx->Input); - pData += 64; - LenInBytes -= 64; - } // end of for - - // buffering lacks of 64-byte data - if(LenInBytes) - NdisMoveMemory(pCtx->Input, (UCHAR *)pData, LenInBytes); - + return SboxTable[(int)a]; } - -/* - * Function Description: - * Append padding bits and length of original message in the tail - * The message digest has to be completed in the end - * - * Arguments: - * Digest Output of Digest-Message for MD5 - * pCtx Pointer to MD5 context - * - * Return Value: - * None - * - * Note: - * Called after MD5Update - */ -VOID MD5Final(UCHAR Digest[16], MD5_CTX *pCtx) +VOID next_key( + IN PUCHAR key, + IN INT round) { - UCHAR Remainder; - UCHAR PadLenInBytes; - UCHAR *pAppend=0; - unsigned int i; - - Remainder = (UCHAR)((pCtx->LenInBitCount[0] >> 3) & 0x3f); - - PadLenInBytes = (Remainder < 56) ? (56-Remainder) : (120-Remainder); - - pAppend = (UCHAR *)pCtx->Input + Remainder; - - // padding bits without crossing block(64-byte based) boundary - if (Remainder < 56) - { - *pAppend = 0x80; - PadLenInBytes --; - - NdisZeroMemory((UCHAR *)pCtx->Input + Remainder+1, PadLenInBytes); - - // add data-length field, from low to high - for (i=0; i<4; i++) - { - pCtx->Input[56+i] = (UCHAR)((pCtx->LenInBitCount[0] >> (i << 3)) & 0xff); - pCtx->Input[60+i] = (UCHAR)((pCtx->LenInBitCount[1] >> (i << 3)) & 0xff); - } - - byteReverse(pCtx->Input, 16); - MD5Transform(pCtx->Buf, (UINT32 *)pCtx->Input); - } // end of if - - // padding bits with crossing block(64-byte based) boundary - else - { - // the first block === - *pAppend = 0x80; - PadLenInBytes --; - - NdisZeroMemory((UCHAR *)pCtx->Input + Remainder+1, (64-Remainder-1)); - PadLenInBytes -= (64 - Remainder - 1); - - byteReverse(pCtx->Input, 16); - MD5Transform(pCtx->Buf, (UINT32 *)pCtx->Input); - - - // the second block === - NdisZeroMemory((UCHAR *)pCtx->Input, PadLenInBytes); + UCHAR rcon; + UCHAR sbox_key[4]; + UCHAR rcon_table[12] = + { + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, + 0x1b, 0x36, 0x36, 0x36 + }; - // add data-length field - for (i=0; i<4; i++) - { - pCtx->Input[56+i] = (UCHAR)((pCtx->LenInBitCount[0] >> (i << 3)) & 0xff); - pCtx->Input[60+i] = (UCHAR)((pCtx->LenInBitCount[1] >> (i << 3)) & 0xff); - } + sbox_key[0] = RTMPCkipSbox(key[13]); + sbox_key[1] = RTMPCkipSbox(key[14]); + sbox_key[2] = RTMPCkipSbox(key[15]); + sbox_key[3] = RTMPCkipSbox(key[12]); - byteReverse(pCtx->Input, 16); - MD5Transform(pCtx->Buf, (UINT32 *)pCtx->Input); - } // end of else + rcon = rcon_table[round]; + xor_32(&key[0], sbox_key, &key[0]); + key[0] = key[0] ^ rcon; - NdisMoveMemory((UCHAR *)Digest, (UINT32 *)pCtx->Buf, 16); // output - byteReverse((UCHAR *)Digest, 4); - NdisZeroMemory(pCtx, sizeof(pCtx)); // memory free + xor_32(&key[4], &key[0], &key[4]); + xor_32(&key[8], &key[4], &key[8]); + xor_32(&key[12], &key[8], &key[12]); } - -/* - * Function Description: - * The central algorithm of MD5, consists of four rounds and sixteen - * steps per round - * - * Arguments: - * Buf Buffers of four states (output: 16 bytes) - * Mes Input data (input: 64 bytes) - * - * Return Value: - * None - * - * Note: - * Called by MD5Update or MD5Final - */ -VOID MD5Transform(UINT32 Buf[4], UINT32 Mes[16]) +VOID byte_sub( + IN PUCHAR in, + OUT PUCHAR out) { - UINT32 Reg[4], Temp; - unsigned int i; + INT i; - static UCHAR LShiftVal[16] = - { - 7, 12, 17, 22, - 5, 9 , 14, 20, - 4, 11, 16, 23, - 6, 10, 15, 21, - }; + for (i=0; i< 16; i++) + { + out[i] = RTMPCkipSbox(in[i]); + } +} +/************************************/ +/* bitwise_xor() */ +/* A 128 bit, bitwise exclusive or */ +/************************************/ - // [equal to 4294967296*abs(sin(index))] - static UINT32 MD5Table[64] = +void bitwise_xor(unsigned char *ina, unsigned char *inb, unsigned char *out) +{ + int i; + for (i=0; i<16; i++) { - 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, - 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, - 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, - 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, - - 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, - 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, - 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, - 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, - - 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, - 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, - 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, - 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, - - 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, - 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, - 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, - 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 - }; + out[i] = ina[i] ^ inb[i]; + } +} +VOID shift_row( + IN PUCHAR in, + OUT PUCHAR out) +{ + out[0] = in[0]; + out[1] = in[5]; + out[2] = in[10]; + out[3] = in[15]; + out[4] = in[4]; + out[5] = in[9]; + out[6] = in[14]; + out[7] = in[3]; + out[8] = in[8]; + out[9] = in[13]; + out[10] = in[2]; + out[11] = in[7]; + out[12] = in[12]; + out[13] = in[1]; + out[14] = in[6]; + out[15] = in[11]; +} - for (i=0; i<4; i++) - Reg[i]=Buf[i]; +VOID mix_column( + IN PUCHAR in, + OUT PUCHAR out) +{ + INT i; + UCHAR add1b[4]; + UCHAR add1bf7[4]; + UCHAR rotl[4]; + UCHAR swap_halfs[4]; + UCHAR andf7[4]; + UCHAR rotr[4]; + UCHAR temp[4]; + UCHAR tempb[4]; + + for (i=0 ; i<4; i++) + { + if ((in[i] & 0x80)== 0x80) + add1b[i] = 0x1b; + else + add1b[i] = 0x00; + } + swap_halfs[0] = in[2]; /* Swap halfs */ + swap_halfs[1] = in[3]; + swap_halfs[2] = in[0]; + swap_halfs[3] = in[1]; - // 64 steps in MD5 algorithm - for (i=0; i<16; i++) - { - MD5Step(MD5_F1, Reg[0], Reg[1], Reg[2], Reg[3], Mes[i], - MD5Table[i], LShiftVal[i & 0x3]); - - // one-word right shift - Temp = Reg[3]; - Reg[3] = Reg[2]; - Reg[2] = Reg[1]; - Reg[1] = Reg[0]; - Reg[0] = Temp; - } - for (i=16; i<32; i++) - { - MD5Step(MD5_F2, Reg[0], Reg[1], Reg[2], Reg[3], Mes[(5*(i & 0xf)+1) & 0xf], - MD5Table[i], LShiftVal[(0x1 << 2)+(i & 0x3)]); - - // one-word right shift - Temp = Reg[3]; - Reg[3] = Reg[2]; - Reg[2] = Reg[1]; - Reg[1] = Reg[0]; - Reg[0] = Temp; - } - for (i=32; i<48; i++) - { - MD5Step(MD5_F3, Reg[0], Reg[1], Reg[2], Reg[3], Mes[(3*(i & 0xf)+5) & 0xf], - MD5Table[i], LShiftVal[(0x1 << 3)+(i & 0x3)]); - - // one-word right shift - Temp = Reg[3]; - Reg[3] = Reg[2]; - Reg[2] = Reg[1]; - Reg[1] = Reg[0]; - Reg[0] = Temp; - } - for (i=48; i<64; i++) - { - MD5Step(MD5_F4, Reg[0], Reg[1], Reg[2], Reg[3], Mes[(7*(i & 0xf)) & 0xf], - MD5Table[i], LShiftVal[(0x3 << 2)+(i & 0x3)]); - - // one-word right shift - Temp = Reg[3]; - Reg[3] = Reg[2]; - Reg[2] = Reg[1]; - Reg[1] = Reg[0]; - Reg[0] = Temp; - } + rotl[0] = in[3]; /* Rotate left 8 bits */ + rotl[1] = in[0]; + rotl[2] = in[1]; + rotl[3] = in[2]; + andf7[0] = in[0] & 0x7f; + andf7[1] = in[1] & 0x7f; + andf7[2] = in[2] & 0x7f; + andf7[3] = in[3] & 0x7f; - // (temporary)output - for (i=0; i<4; i++) - Buf[i] += Reg[i]; + for (i = 3; i>0; i--) /* logical shift left 1 bit */ + { + andf7[i] = andf7[i] << 1; + if ((andf7[i-1] & 0x80) == 0x80) + { + andf7[i] = (andf7[i] | 0x01); + } + } + andf7[0] = andf7[0] << 1; + andf7[0] = andf7[0] & 0xfe; -} + xor_32(add1b, andf7, add1bf7); + xor_32(in, add1bf7, rotr); + temp[0] = rotr[0]; /* Rotate right 8 bits */ + rotr[0] = rotr[1]; + rotr[1] = rotr[2]; + rotr[2] = rotr[3]; + rotr[3] = temp[0]; -/* ========================= SHA-1 implementation ========================== */ -// four base functions for SHA-1 -#define SHA1_F1(b, c, d) (((b) & (c)) | ((~b) & (d))) -#define SHA1_F2(b, c, d) ((b) ^ (c) ^ (d)) -#define SHA1_F3(b, c, d) (((b) & (c)) | ((b) & (d)) | ((c) & (d))) + xor_32(add1bf7, rotr, temp); + xor_32(swap_halfs, rotl,tempb); + xor_32(temp, tempb, out); +} -#define SHA1Step(f, a, b, c, d, e, w, k) \ - ( e += ( f(b, c, d) + w + k + CYCLIC_LEFT_SHIFT(a, 5)) & 0xffffffff, \ - b = CYCLIC_LEFT_SHIFT(b, 30) ) +/************************************************/ +/* construct_mic_header1() */ +/* Builds the first MIC header block from */ +/* header fields. */ +/************************************************/ -//Initiate SHA-1 Context satisfied in RFC 3174 -VOID SHAInit(SHA_CTX *pCtx) +void construct_mic_header1( + unsigned char *mic_header1, + int header_length, + unsigned char *mpdu) { - pCtx->Buf[0]=0x67452301; - pCtx->Buf[1]=0xefcdab89; - pCtx->Buf[2]=0x98badcfe; - pCtx->Buf[3]=0x10325476; - pCtx->Buf[4]=0xc3d2e1f0; - - pCtx->LenInBitCount[0]=0; - pCtx->LenInBitCount[1]=0; + mic_header1[0] = (unsigned char)((header_length - 2) / 256); + mic_header1[1] = (unsigned char)((header_length - 2) % 256); + mic_header1[2] = mpdu[0] & 0xcf; /* Mute CF poll & CF ack bits */ + mic_header1[3] = mpdu[1] & 0xc7; /* Mute retry, more data and pwr mgt bits */ + mic_header1[4] = mpdu[4]; /* A1 */ + mic_header1[5] = mpdu[5]; + mic_header1[6] = mpdu[6]; + mic_header1[7] = mpdu[7]; + mic_header1[8] = mpdu[8]; + mic_header1[9] = mpdu[9]; + mic_header1[10] = mpdu[10]; /* A2 */ + mic_header1[11] = mpdu[11]; + mic_header1[12] = mpdu[12]; + mic_header1[13] = mpdu[13]; + mic_header1[14] = mpdu[14]; + mic_header1[15] = mpdu[15]; } -/* - * Function Description: - * Update SHA-1 Context, allow of an arrary of octets as the next - * portion of the message - * - * Arguments: - * pCtx Pointer to SHA-1 context - * pData Pointer to input data - * LenInBytes The length of input data (unit: byte) - * - * Return Value: - * error indicate more than pow(2,64) bits of data - * - * Note: - * Called after SHAInit or SHAUpdate(itself) - */ -UCHAR SHAUpdate(SHA_CTX *pCtx, UCHAR *pData, UINT32 LenInBytes) +/************************************************/ +/* construct_mic_header2() */ +/* Builds the last MIC header block from */ +/* header fields. */ +/************************************************/ + +void construct_mic_header2( + unsigned char *mic_header2, + unsigned char *mpdu, + int a4_exists, + int qc_exists) { - UINT32 TfTimes; - UINT32 temp1,temp2; - unsigned int i; - UCHAR err=1; - - temp1 = pCtx->LenInBitCount[0]; - temp2 = pCtx->LenInBitCount[1]; + int i; - pCtx->LenInBitCount[0] = (UINT32) (pCtx->LenInBitCount[0] + (LenInBytes << 3)); - if (pCtx->LenInBitCount[0] < temp1) - pCtx->LenInBitCount[1]++; //carry in + for (i = 0; i<16; i++) mic_header2[i]=0x00; + mic_header2[0] = mpdu[16]; /* A3 */ + mic_header2[1] = mpdu[17]; + mic_header2[2] = mpdu[18]; + mic_header2[3] = mpdu[19]; + mic_header2[4] = mpdu[20]; + mic_header2[5] = mpdu[21]; - pCtx->LenInBitCount[1] = (UINT32) (pCtx->LenInBitCount[1] +(LenInBytes >> 29)); - if (pCtx->LenInBitCount[1] < temp2) - return (err); //check total length of original data + // In Sequence Control field, mute sequence numer bits (12-bit) + mic_header2[6] = mpdu[22] & 0x0f; /* SC */ + mic_header2[7] = 0x00; /* mpdu[23]; */ + if ((!qc_exists) & a4_exists) + { + for (i=0;i<6;i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ - // mod 64 bytes - temp1 = (temp1 >> 3) & 0x3f; - - // process lacks of 64-byte data - if (temp1) - { - UCHAR *pAds = (UCHAR *) pCtx->Input + temp1; - - if ((temp1+LenInBytes) < 64) - { - NdisMoveMemory(pAds, (UCHAR *)pData, LenInBytes); - return (0); - } - - NdisMoveMemory(pAds, (UCHAR *)pData, 64-temp1); - byteReverse((UCHAR *)pCtx->Input, 16); - - NdisZeroMemory((UCHAR *)pCtx->Input + 64, 16); - SHATransform(pCtx->Buf, (UINT32 *)pCtx->Input); - - pData += 64-temp1; - LenInBytes -= 64-temp1; - } // end of if (temp1) + } + if (qc_exists && (!a4_exists)) + { + mic_header2[8] = mpdu[24] & 0x0f; /* mute bits 15 - 4 */ + mic_header2[9] = mpdu[25] & 0x00; + } - TfTimes = (LenInBytes >> 6); + if (qc_exists && a4_exists) + { + for (i=0;i<6;i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ - for (i=TfTimes; i>0; i--) - { - NdisMoveMemory(pCtx->Input, (UCHAR *)pData, 64); - byteReverse((UCHAR *)pCtx->Input, 16); + mic_header2[14] = mpdu[30] & 0x0f; + mic_header2[15] = mpdu[31] & 0x00; + } +} - NdisZeroMemory((UCHAR *)pCtx->Input + 64, 16); - SHATransform(pCtx->Buf, (UINT32 *)pCtx->Input); - pData += 64; - LenInBytes -= 64; - } // end of for - // buffering lacks of 64-byte data - if(LenInBytes) - NdisMoveMemory(pCtx->Input, (UCHAR *)pData, LenInBytes); +/************************************************/ +/* construct_mic_iv() */ +/* Builds the MIC IV from header fields and PN */ +/************************************************/ - return (0); +void construct_mic_iv( + unsigned char *mic_iv, + int qc_exists, + int a4_exists, + unsigned char *mpdu, + unsigned int payload_length, + unsigned char *pn_vector) +{ + int i; + + mic_iv[0] = 0x59; + if (qc_exists && a4_exists) + mic_iv[1] = mpdu[30] & 0x0f; /* QoS_TC */ + if (qc_exists && !a4_exists) + mic_iv[1] = mpdu[24] & 0x0f; /* mute bits 7-4 */ + if (!qc_exists) + mic_iv[1] = 0x00; + for (i = 2; i < 8; i++) + mic_iv[i] = mpdu[i + 8]; /* mic_iv[2:7] = A2[0:5] = mpdu[10:15] */ +#ifdef CONSISTENT_PN_ORDER + for (i = 8; i < 14; i++) + mic_iv[i] = pn_vector[i - 8]; /* mic_iv[8:13] = PN[0:5] */ +#else + for (i = 8; i < 14; i++) + mic_iv[i] = pn_vector[13 - i]; /* mic_iv[8:13] = PN[5:0] */ +#endif + i = (payload_length / 256); + i = (payload_length % 256); + mic_iv[14] = (unsigned char) (payload_length / 256); + mic_iv[15] = (unsigned char) (payload_length % 256); } -// Append padding bits and length of original message in the tail -// The message digest has to be completed in the end -VOID SHAFinal(SHA_CTX *pCtx, UCHAR Digest[20]) +/****************************************/ +/* aes128k128d() */ +/* Performs a 128 bit AES encrypt with */ +/* 128 bit data. */ +/****************************************/ +void aes128k128d(unsigned char *key, unsigned char *data, unsigned char *ciphertext) { - UCHAR Remainder; - UCHAR PadLenInBytes; - UCHAR *pAppend=0; - unsigned int i; - - Remainder = (UCHAR)((pCtx->LenInBitCount[0] >> 3) & 0x3f); - - pAppend = (UCHAR *)pCtx->Input + Remainder; - - PadLenInBytes = (Remainder < 56) ? (56-Remainder) : (120-Remainder); - - // padding bits without crossing block(64-byte based) boundary - if (Remainder < 56) - { - *pAppend = 0x80; - PadLenInBytes --; - - NdisZeroMemory((UCHAR *)pCtx->Input + Remainder+1, PadLenInBytes); - - // add data-length field, from high to low - for (i=0; i<4; i++) - { - pCtx->Input[56+i] = (UCHAR)((pCtx->LenInBitCount[1] >> ((3-i) << 3)) & 0xff); - pCtx->Input[60+i] = (UCHAR)((pCtx->LenInBitCount[0] >> ((3-i) << 3)) & 0xff); - } - - byteReverse((UCHAR *)pCtx->Input, 16); - NdisZeroMemory((UCHAR *)pCtx->Input + 64, 14); - SHATransform(pCtx->Buf, (UINT32 *)pCtx->Input); - } // end of if - - // padding bits with crossing block(64-byte based) boundary - else - { - // the first block === - *pAppend = 0x80; - PadLenInBytes --; - - NdisZeroMemory((UCHAR *)pCtx->Input + Remainder+1, (64-Remainder-1)); - PadLenInBytes -= (64 - Remainder - 1); - - byteReverse((UCHAR *)pCtx->Input, 16); - NdisZeroMemory((UCHAR *)pCtx->Input + 64, 16); - SHATransform(pCtx->Buf, (UINT32 *)pCtx->Input); - + int round; + int i; + unsigned char intermediatea[16]; + unsigned char intermediateb[16]; + unsigned char round_key[16]; - // the second block === - NdisZeroMemory((UCHAR *)pCtx->Input, PadLenInBytes); + for(i=0; i<16; i++) round_key[i] = key[i]; - // add data-length field - for (i=0; i<4; i++) - { - pCtx->Input[56+i] = (UCHAR)((pCtx->LenInBitCount[1] >> ((3-i) << 3)) & 0xff); - pCtx->Input[60+i] = (UCHAR)((pCtx->LenInBitCount[0] >> ((3-i) << 3)) & 0xff); - } + for (round = 0; round < 11; round++) + { + if (round == 0) + { + xor_128(round_key, data, ciphertext); + next_key(round_key, round); + } + else if (round == 10) + { + byte_sub(ciphertext, intermediatea); + shift_row(intermediatea, intermediateb); + xor_128(intermediateb, round_key, ciphertext); + } + else /* 1 - 9 */ + { + byte_sub(ciphertext, intermediatea); + shift_row(intermediatea, intermediateb); + mix_column(&intermediateb[0], &intermediatea[0]); + mix_column(&intermediateb[4], &intermediatea[4]); + mix_column(&intermediateb[8], &intermediatea[8]); + mix_column(&intermediateb[12], &intermediatea[12]); + xor_128(intermediatea, round_key, ciphertext); + next_key(round_key, round); + } + } - byteReverse((UCHAR *)pCtx->Input, 16); - NdisZeroMemory((UCHAR *)pCtx->Input + 64, 16); - SHATransform(pCtx->Buf, (UINT32 *)pCtx->Input); - } // end of else +} +void construct_ctr_preload( + unsigned char *ctr_preload, + int a4_exists, + int qc_exists, + unsigned char *mpdu, + unsigned char *pn_vector, + int c) +{ - //Output, bytereverse - for (i=0; i<20; i++) - { - Digest [i] = (UCHAR)(pCtx->Buf[i>>2] >> 8*(3-(i & 0x3))); - } + int i = 0; + for (i=0; i<16; i++) ctr_preload[i] = 0x00; + i = 0; + + ctr_preload[0] = 0x01; /* flag */ + if (qc_exists && a4_exists) ctr_preload[1] = mpdu[30] & 0x0f; /* QoC_Control */ + if (qc_exists && !a4_exists) ctr_preload[1] = mpdu[24] & 0x0f; + + for (i = 2; i < 8; i++) + ctr_preload[i] = mpdu[i + 8]; /* ctr_preload[2:7] = A2[0:5] = mpdu[10:15] */ +#ifdef CONSISTENT_PN_ORDER + for (i = 8; i < 14; i++) + ctr_preload[i] = pn_vector[i - 8]; /* ctr_preload[8:13] = PN[0:5] */ +#else + for (i = 8; i < 14; i++) + ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */ +#endif + ctr_preload[14] = (unsigned char) (c / 256); // Ctr + ctr_preload[15] = (unsigned char) (c % 256); - NdisZeroMemory(pCtx, sizeof(pCtx)); // memory free } - -// The central algorithm of SHA-1, consists of four rounds and -// twenty steps per round -VOID SHATransform(UINT32 Buf[5], UINT32 Mes[20]) +BOOLEAN RTMPSoftDecryptAES( + IN PRTMP_ADAPTER pAd, + IN PUCHAR pData, + IN ULONG DataByteCnt, + IN PCIPHER_KEY pWpaKey) { - UINT32 Reg[5],Temp; - unsigned int i; - UINT32 W[80]; + UCHAR KeyID; + UINT HeaderLen; + UCHAR PN[6]; + UINT payload_len; + UINT num_blocks; + UINT payload_remainder; + USHORT fc; + UCHAR fc0; + UCHAR fc1; + UINT frame_type; + UINT frame_subtype; + UINT from_ds; + UINT to_ds; + INT a4_exists; + INT qc_exists; + UCHAR aes_out[16]; + int payload_index; + UINT i; + UCHAR ctr_preload[16]; + UCHAR chain_buffer[16]; + UCHAR padded_buffer[16]; + UCHAR mic_iv[16]; + UCHAR mic_header1[16]; + UCHAR mic_header2[16]; + UCHAR MIC[8]; + UCHAR TrailMIC[8]; + + + fc0 = *pData; + fc1 = *(pData + 1); + + fc = *((PUSHORT)pData); + + frame_type = ((fc0 >> 2) & 0x03); + frame_subtype = ((fc0 >> 4) & 0x0f); + + from_ds = (fc1 & 0x2) >> 1; + to_ds = (fc1 & 0x1); + + a4_exists = (from_ds & to_ds); + qc_exists = ((frame_subtype == 0x08) || /* Assumed QoS subtypes */ + (frame_subtype == 0x09) || /* Likely to change. */ + (frame_subtype == 0x0a) || + (frame_subtype == 0x0b) + ); + + HeaderLen = 24; + if (a4_exists) + HeaderLen += 6; + + KeyID = *((PUCHAR)(pData+ HeaderLen + 3)); + KeyID = KeyID >> 6; + + if (pWpaKey[KeyID].KeyLen == 0) + { + DBGPRINT(RT_DEBUG_TRACE, ("RTMPSoftDecryptAES failed!(KeyID[%d] Length can not be 0)\n", KeyID)); + return FALSE; + } - static UINT32 SHA1Table[4] = { 0x5a827999, 0x6ed9eba1, - 0x8f1bbcdc, 0xca62c1d6 }; + PN[0] = *(pData+ HeaderLen); + PN[1] = *(pData+ HeaderLen + 1); + PN[2] = *(pData+ HeaderLen + 4); + PN[3] = *(pData+ HeaderLen + 5); + PN[4] = *(pData+ HeaderLen + 6); + PN[5] = *(pData+ HeaderLen + 7); - Reg[0]=Buf[0]; - Reg[1]=Buf[1]; - Reg[2]=Buf[2]; - Reg[3]=Buf[3]; - Reg[4]=Buf[4]; + payload_len = DataByteCnt - HeaderLen - 8 - 8; // 8 bytes for CCMP header , 8 bytes for MIC + payload_remainder = (payload_len) % 16; + num_blocks = (payload_len) / 16; - //the first octet of a word is stored in the 0th element, bytereverse - for(i = 0; i < 16; i++) - { - W[i] = (Mes[i] >> 24) & 0xff; - W[i] |= (Mes[i] >> 8 ) & 0xff00; - W[i] |= (Mes[i] << 8 ) & 0xff0000; - W[i] |= (Mes[i] << 24) & 0xff000000; - } - for (i = 0; i < 64; i++) - W[16+i] = CYCLIC_LEFT_SHIFT(W[i] ^ W[2+i] ^ W[8+i] ^ W[13+i], 1); + // Find start of payload + payload_index = HeaderLen + 8; //IV+EIV + for (i=0; i< num_blocks; i++) + { + construct_ctr_preload(ctr_preload, + a4_exists, + qc_exists, + pData, + PN, + i+1 ); + + aes128k128d(pWpaKey[KeyID].Key, ctr_preload, aes_out); + + bitwise_xor(aes_out, pData + payload_index, chain_buffer); + NdisMoveMemory(pData + payload_index - 8, chain_buffer, 16); + payload_index += 16; + } - // 80 steps in SHA-1 algorithm - for (i=0; i<80; i++) - { - if (i<20) - SHA1Step(SHA1_F1, Reg[0], Reg[1], Reg[2], Reg[3], Reg[4], - W[i], SHA1Table[0]); + // + // If there is a short final block, then pad it + // encrypt it and copy the unpadded part back + // + if (payload_remainder > 0) + { + construct_ctr_preload(ctr_preload, + a4_exists, + qc_exists, + pData, + PN, + num_blocks + 1); - else if (i>=20 && i<40) - SHA1Step(SHA1_F2, Reg[0], Reg[1], Reg[2], Reg[3], Reg[4], - W[i], SHA1Table[1]); + NdisZeroMemory(padded_buffer, 16); + NdisMoveMemory(padded_buffer, pData + payload_index, payload_remainder); - else if (i>=40 && i<60) - SHA1Step(SHA1_F3, Reg[0], Reg[1], Reg[2], Reg[3], Reg[4], - W[i], SHA1Table[2]); + aes128k128d(pWpaKey[KeyID].Key, ctr_preload, aes_out); - else - SHA1Step(SHA1_F2, Reg[0], Reg[1], Reg[2], Reg[3], Reg[4], - W[i], SHA1Table[3]); + bitwise_xor(aes_out, padded_buffer, chain_buffer); + NdisMoveMemory(pData + payload_index - 8, chain_buffer, payload_remainder); + payload_index += payload_remainder; + } + // + // Descrypt the MIC + // + construct_ctr_preload(ctr_preload, + a4_exists, + qc_exists, + pData, + PN, + 0); + NdisZeroMemory(padded_buffer, 16); + NdisMoveMemory(padded_buffer, pData + payload_index, 8); + + aes128k128d(pWpaKey[KeyID].Key, ctr_preload, aes_out); + + bitwise_xor(aes_out, padded_buffer, chain_buffer); + + NdisMoveMemory(TrailMIC, chain_buffer, 8); + + + // + // Calculate MIC + // + + //Force the protected frame bit on + *(pData + 1) = *(pData + 1) | 0x40; + + // Find start of payload + // Because the CCMP header has been removed + payload_index = HeaderLen; + + construct_mic_iv( + mic_iv, + qc_exists, + a4_exists, + pData, + payload_len, + PN); + + construct_mic_header1( + mic_header1, + HeaderLen, + pData); + + construct_mic_header2( + mic_header2, + pData, + a4_exists, + qc_exists); + + aes128k128d(pWpaKey[KeyID].Key, mic_iv, aes_out); + bitwise_xor(aes_out, mic_header1, chain_buffer); + aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); + bitwise_xor(aes_out, mic_header2, chain_buffer); + aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); + + // iterate through each 16 byte payload block + for (i = 0; i < num_blocks; i++) + { + bitwise_xor(aes_out, pData + payload_index, chain_buffer); + payload_index += 16; + aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); + } - // one-word right shift - Temp = Reg[4]; - Reg[4] = Reg[3]; - Reg[3] = Reg[2]; - Reg[2] = Reg[1]; - Reg[1] = Reg[0]; - Reg[0] = Temp; + // Add on the final payload block if it needs padding + if (payload_remainder > 0) + { + NdisZeroMemory(padded_buffer, 16); + NdisMoveMemory(padded_buffer, pData + payload_index, payload_remainder); - } // end of for-loop + bitwise_xor(aes_out, padded_buffer, chain_buffer); + aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); + } + // aes_out contains padded mic, discard most significant + // 8 bytes to generate 64 bit MIC + for (i = 0 ; i < 8; i++) MIC[i] = aes_out[i]; - // (temporary)output - for (i=0; i<5; i++) - Buf[i] += Reg[i]; + if (!NdisEqualMemory(MIC, TrailMIC, 8)) + { + DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptAES, MIC Error !\n")); //MIC error. + return FALSE; + } -} + return TRUE; +} /* ========================= AES En/Decryption ========================== */ +#ifndef uint8 +#define uint8 unsigned char +#endif + +#ifndef uint32 +#define uint32 unsigned int +#endif /* forward S-box */ static uint32 FSb[256] = @@ -976,9 +947,8 @@ static uint32 KT3[256]; (b)[(i) + 3] = (uint8) ( (n) ); \ } -/* AES key scheduling routine */ -int rtmp_aes_set_key( aes_context *ctx, uint8 *key, int nbits ) +int rt_aes_set_key( aes_context *ctx, uint8 *key, int nbits ) { int i; uint32 *RK, *SK; @@ -991,7 +961,7 @@ int rtmp_aes_set_key( aes_context *ctx, uint8 *key, int nbits ) default : return( 1 ); } - RK = ctx->erk; + RK = (uint32 *) ctx->erk; for( i = 0; i < (nbits >> 5); i++ ) { @@ -1078,7 +1048,7 @@ int rtmp_aes_set_key( aes_context *ctx, uint8 *key, int nbits ) KT_init = 0; } - SK = ctx->drk; + SK = (uint32 *) ctx->drk; *SK++ = *RK++; *SK++ = *RK++; @@ -1122,11 +1092,11 @@ int rtmp_aes_set_key( aes_context *ctx, uint8 *key, int nbits ) /* AES 128-bit block encryption routine */ -void rtmp_aes_encrypt(aes_context *ctx, uint8 input[16], uint8 output[16] ) +void rt_aes_encrypt(aes_context *ctx, uint8 input[16], uint8 output[16] ) { uint32 *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3; - RK = ctx->erk; + RK = (uint32 *) ctx->erk; GET_UINT32( X0, input, 0 ); X0 ^= RK[0]; GET_UINT32( X1, input, 4 ); X1 ^= RK[1]; GET_UINT32( X2, input, 8 ); X2 ^= RK[2]; @@ -1211,11 +1181,11 @@ void rtmp_aes_encrypt(aes_context *ctx, uint8 input[16], uint8 output[16] ) /* AES 128-bit block decryption routine */ -void rtmp_aes_decrypt( aes_context *ctx, uint8 input[16], uint8 output[16] ) +void rt_aes_decrypt( aes_context *ctx, uint8 input[16], uint8 output[16] ) { uint32 *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3; - RK = ctx->drk; + RK = (uint32 *) ctx->drk; GET_UINT32( X0, input, 0 ); X0 ^= RK[0]; GET_UINT32( X1, input, 4 ); X1 ^= RK[1]; @@ -1299,117 +1269,136 @@ void rtmp_aes_decrypt( aes_context *ctx, uint8 input[16], uint8 output[16] ) PUT_UINT32( X3, output, 12 ); } +/* + ========================================================================== + Description: + ENCRYPT AES GTK before sending in EAPOL frame. + AES GTK length = 128 bit, so fix blocks for aes-key-wrap as 2 in this function. + This function references to RFC 3394 for aes key wrap algorithm. + Return: + ========================================================================== +*/ +VOID AES_GTK_KEY_WRAP( + IN UCHAR *key, + IN UCHAR *plaintext, + IN UINT32 p_len, + OUT UCHAR *ciphertext) +{ + UCHAR A[8], BIN[16], BOUT[16]; + UCHAR R[512]; + INT num_blocks = p_len/8; // unit:64bits + INT i, j; + aes_context aesctx; + UCHAR xor; + + rt_aes_set_key(&aesctx, key, 128); + + // Init IA + for (i = 0; i < 8; i++) + A[i] = 0xa6; + + //Input plaintext + for (i = 0; i < num_blocks; i++) + { + for (j = 0 ; j < 8; j++) + R[8 * (i + 1) + j] = plaintext[8 * i + j]; + } + + // Key Mix + for (j = 0; j < 6; j++) + { + for(i = 1; i <= num_blocks; i++) + { + //phase 1 + NdisMoveMemory(BIN, A, 8); + NdisMoveMemory(&BIN[8], &R[8 * i], 8); + rt_aes_encrypt(&aesctx, BIN, BOUT); + + NdisMoveMemory(A, &BOUT[0], 8); + xor = num_blocks * j + i; + A[7] = BOUT[7] ^ xor; + NdisMoveMemory(&R[8 * i], &BOUT[8], 8); + } + } + + // Output ciphertext + NdisMoveMemory(ciphertext, A, 8); + + for (i = 1; i <= num_blocks; i++) + { + for (j = 0 ; j < 8; j++) + ciphertext[8 * i + j] = R[8 * i + j]; + } +} + /* ======================================================================== Routine Description: - SHA1 function + Misc function to decrypt AES body Arguments: Return Value: Note: + This function references to RFC 3394 for aes key unwrap algorithm. ======================================================================== */ -VOID HMAC_SHA1( - IN UCHAR *text, - IN UINT text_len, +VOID AES_GTK_KEY_UNWRAP( IN UCHAR *key, - IN UINT key_len, - IN UCHAR *digest) + OUT UCHAR *plaintext, + IN UINT32 c_len, + IN UCHAR *ciphertext) + { - SHA_CTX context; - UCHAR k_ipad[65]; /* inner padding - key XORd with ipad */ - UCHAR k_opad[65]; /* outer padding - key XORd with opad */ - INT i; + UCHAR A[8], BIN[16], BOUT[16]; + UCHAR xor; + INT i, j; + aes_context aesctx; + UCHAR *R; + INT num_blocks = c_len/8; // unit:64bits - // if key is longer than 64 bytes reset it to key=SHA1(key) - if (key_len > 64) - { - SHA_CTX tctx; - SHAInit(&tctx); - SHAUpdate(&tctx, key, key_len); - SHAFinal(&tctx, key); - key_len = 20; - } - NdisZeroMemory(k_ipad, sizeof(k_ipad)); - NdisZeroMemory(k_opad, sizeof(k_opad)); - NdisMoveMemory(k_ipad, key, key_len); - NdisMoveMemory(k_opad, key, key_len); - // XOR key with ipad and opad values - for (i = 0; i < 64; i++) + os_alloc_mem(NULL, (PUCHAR *)&R, 512); + + if (R == NULL) + { + DBGPRINT(RT_DEBUG_ERROR, ("!!!AES_GTK_KEY_UNWRAP: no memory!!!\n")); + return; + } /* End of if */ + + // Initialize + NdisMoveMemory(A, ciphertext, 8); + //Input plaintext + for(i = 0; i < (c_len-8); i++) { - k_ipad[i] ^= 0x36; - k_opad[i] ^= 0x5c; + R[ i] = ciphertext[i + 8]; } - // perform inner SHA1 - SHAInit(&context); /* init context for 1st pass */ - SHAUpdate(&context, k_ipad, 64); /* start with inner pad */ - SHAUpdate(&context, text, text_len); /* then text of datagram */ - SHAFinal(&context, digest); /* finish up 1st pass */ - - //perform outer SHA1 - SHAInit(&context); /* init context for 2nd pass */ - SHAUpdate(&context, k_opad, 64); /* start with outer pad */ - SHAUpdate(&context, digest, 20); /* then results of 1st hash */ - SHAFinal(&context, digest); /* finish up 2nd pass */ - -} - -/* -* F(P, S, c, i) = U1 xor U2 xor ... Uc -* U1 = PRF(P, S || Int(i)) -* U2 = PRF(P, U1) -* Uc = PRF(P, Uc-1) -*/ - -void F(char *password, unsigned char *ssid, int ssidlength, int iterations, int count, unsigned char *output) -{ - unsigned char digest[36], digest1[SHA_DIGEST_LEN]; - int i, j; - - /* U1 = PRF(P, S || int(i)) */ - memcpy(digest, ssid, ssidlength); - digest[ssidlength] = (unsigned char)((count>>24) & 0xff); - digest[ssidlength+1] = (unsigned char)((count>>16) & 0xff); - digest[ssidlength+2] = (unsigned char)((count>>8) & 0xff); - digest[ssidlength+3] = (unsigned char)(count & 0xff); - HMAC_SHA1(digest, ssidlength+4, (unsigned char*) password, (int) strlen(password), digest1); // for WPA update + rt_aes_set_key(&aesctx, key, 128); - /* output = U1 */ - memcpy(output, digest1, SHA_DIGEST_LEN); + for(j = 5; j >= 0; j--) + { + for(i = (num_blocks-1); i > 0; i--) + { + xor = (num_blocks -1 )* j + i; + NdisMoveMemory(BIN, A, 8); + BIN[7] = A[7] ^ xor; + NdisMoveMemory(&BIN[8], &R[(i-1)*8], 8); + rt_aes_decrypt(&aesctx, BIN, BOUT); + NdisMoveMemory(A, &BOUT[0], 8); + NdisMoveMemory(&R[(i-1)*8], &BOUT[8], 8); + } + } - for (i = 1; i < iterations; i++) - { - /* Un = PRF(P, Un-1) */ - HMAC_SHA1(digest1, SHA_DIGEST_LEN, (unsigned char*) password, (int) strlen(password), digest); // for WPA update - memcpy(digest1, digest, SHA_DIGEST_LEN); + // OUTPUT + for(i = 0; i < c_len; i++) + { + plaintext[i] = R[i]; + } - /* output = output xor Un */ - for (j = 0; j < SHA_DIGEST_LEN; j++) - { - output[j] ^= digest[j]; - } - } -} -/* -* password - ascii string up to 63 characters in length -* ssid - octet string up to 32 octets -* ssidlength - length of ssid in octets -* output must be 40 octets in length and outputs 256 bits of key -*/ -int PasswordHash(char *password, unsigned char *ssid, int ssidlength, unsigned char *output) -{ - if ((strlen(password) > 63) || (ssidlength > 32)) - return 0; - F(password, ssid, ssidlength, 4096, 1, output); - F(password, ssid, ssidlength, 4096, 2, &output[SHA_DIGEST_LEN]); - return 1; + os_free_mem(NULL, R); } - - diff --git a/drivers/staging/rt2860/common/cmm_asic.c b/drivers/staging/rt2860/common/cmm_asic.c new file mode 100644 index 000000000000..83ed07b45bdd --- /dev/null +++ b/drivers/staging/rt2860/common/cmm_asic.c @@ -0,0 +1,2531 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + cmm_asic.c + + Abstract: + Functions used to communicate with ASIC + + Revision History: + Who When What + -------- ---------- ---------------------------------------------- +*/ + +#include "../rt_config.h" + + +// Reset the RFIC setting to new series +RTMP_RF_REGS RF2850RegTable[] = { +// ch R1 R2 R3(TX0~4=0) R4 + {1, 0x98402ecc, 0x984c0786, 0x9816b455, 0x9800510b}, + {2, 0x98402ecc, 0x984c0786, 0x98168a55, 0x9800519f}, + {3, 0x98402ecc, 0x984c078a, 0x98168a55, 0x9800518b}, + {4, 0x98402ecc, 0x984c078a, 0x98168a55, 0x9800519f}, + {5, 0x98402ecc, 0x984c078e, 0x98168a55, 0x9800518b}, + {6, 0x98402ecc, 0x984c078e, 0x98168a55, 0x9800519f}, + {7, 0x98402ecc, 0x984c0792, 0x98168a55, 0x9800518b}, + {8, 0x98402ecc, 0x984c0792, 0x98168a55, 0x9800519f}, + {9, 0x98402ecc, 0x984c0796, 0x98168a55, 0x9800518b}, + {10, 0x98402ecc, 0x984c0796, 0x98168a55, 0x9800519f}, + {11, 0x98402ecc, 0x984c079a, 0x98168a55, 0x9800518b}, + {12, 0x98402ecc, 0x984c079a, 0x98168a55, 0x9800519f}, + {13, 0x98402ecc, 0x984c079e, 0x98168a55, 0x9800518b}, + {14, 0x98402ecc, 0x984c07a2, 0x98168a55, 0x98005193}, + + // 802.11 UNI / HyperLan 2 + {36, 0x98402ecc, 0x984c099a, 0x98158a55, 0x980ed1a3}, + {38, 0x98402ecc, 0x984c099e, 0x98158a55, 0x980ed193}, + {40, 0x98402ec8, 0x984c0682, 0x98158a55, 0x980ed183}, + {44, 0x98402ec8, 0x984c0682, 0x98158a55, 0x980ed1a3}, + {46, 0x98402ec8, 0x984c0686, 0x98158a55, 0x980ed18b}, + {48, 0x98402ec8, 0x984c0686, 0x98158a55, 0x980ed19b}, + {52, 0x98402ec8, 0x984c068a, 0x98158a55, 0x980ed193}, + {54, 0x98402ec8, 0x984c068a, 0x98158a55, 0x980ed1a3}, + {56, 0x98402ec8, 0x984c068e, 0x98158a55, 0x980ed18b}, + {60, 0x98402ec8, 0x984c0692, 0x98158a55, 0x980ed183}, + {62, 0x98402ec8, 0x984c0692, 0x98158a55, 0x980ed193}, + {64, 0x98402ec8, 0x984c0692, 0x98158a55, 0x980ed1a3}, // Plugfest#4, Day4, change RFR3 left4th 9->5. + + // 802.11 HyperLan 2 + {100, 0x98402ec8, 0x984c06b2, 0x98178a55, 0x980ed783}, + + // 2008.04.30 modified + // The system team has AN to improve the EVM value + // for channel 102 to 108 for the RT2850/RT2750 dual band solution. + {102, 0x98402ec8, 0x985c06b2, 0x98578a55, 0x980ed793}, + {104, 0x98402ec8, 0x985c06b2, 0x98578a55, 0x980ed1a3}, + {108, 0x98402ecc, 0x985c0a32, 0x98578a55, 0x980ed193}, + + {110, 0x98402ecc, 0x984c0a36, 0x98178a55, 0x980ed183}, + {112, 0x98402ecc, 0x984c0a36, 0x98178a55, 0x980ed19b}, + {116, 0x98402ecc, 0x984c0a3a, 0x98178a55, 0x980ed1a3}, + {118, 0x98402ecc, 0x984c0a3e, 0x98178a55, 0x980ed193}, + {120, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed183}, + {124, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed193}, + {126, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed15b}, // 0x980ed1bb->0x980ed15b required by Rory 20070927 + {128, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed1a3}, + {132, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed18b}, + {134, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed193}, + {136, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed19b}, + {140, 0x98402ec4, 0x984c038a, 0x98178a55, 0x980ed183}, + + // 802.11 UNII + {149, 0x98402ec4, 0x984c038a, 0x98178a55, 0x980ed1a7}, + {151, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed187}, + {153, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed18f}, + {157, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed19f}, + {159, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed1a7}, + {161, 0x98402ec4, 0x984c0392, 0x98178a55, 0x980ed187}, + {165, 0x98402ec4, 0x984c0392, 0x98178a55, 0x980ed197}, + {167, 0x98402ec4, 0x984c03d2, 0x98179855, 0x9815531f}, + {169, 0x98402ec4, 0x984c03d2, 0x98179855, 0x98155327}, + {171, 0x98402ec4, 0x984c03d6, 0x98179855, 0x98155307}, + {173, 0x98402ec4, 0x984c03d6, 0x98179855, 0x9815530f}, + + // Japan + {184, 0x95002ccc, 0x9500491e, 0x9509be55, 0x950c0a0b}, + {188, 0x95002ccc, 0x95004922, 0x9509be55, 0x950c0a13}, + {192, 0x95002ccc, 0x95004926, 0x9509be55, 0x950c0a1b}, + {196, 0x95002ccc, 0x9500492a, 0x9509be55, 0x950c0a23}, + {208, 0x95002ccc, 0x9500493a, 0x9509be55, 0x950c0a13}, + {212, 0x95002ccc, 0x9500493e, 0x9509be55, 0x950c0a1b}, + {216, 0x95002ccc, 0x95004982, 0x9509be55, 0x950c0a23}, + + // still lack of MMAC(Japan) ch 34,38,42,46 +}; +UCHAR NUM_OF_2850_CHNL = (sizeof(RF2850RegTable) / sizeof(RTMP_RF_REGS)); + +FREQUENCY_ITEM FreqItems3020[] = +{ + /**************************************************/ + // ISM : 2.4 to 2.483 GHz // + /**************************************************/ + // 11g + /**************************************************/ + //-CH---N-------R---K----------- + {1, 241, 2, 2}, + {2, 241, 2, 7}, + {3, 242, 2, 2}, + {4, 242, 2, 7}, + {5, 243, 2, 2}, + {6, 243, 2, 7}, + {7, 244, 2, 2}, + {8, 244, 2, 7}, + {9, 245, 2, 2}, + {10, 245, 2, 7}, + {11, 246, 2, 2}, + {12, 246, 2, 7}, + {13, 247, 2, 2}, + {14, 248, 2, 4}, +}; +UCHAR NUM_OF_3020_CHNL = (sizeof(FreqItems3020) / sizeof(FREQUENCY_ITEM)); + + +VOID AsicUpdateAutoFallBackTable( + IN PRTMP_ADAPTER pAd, + IN PUCHAR pRateTable) +{ + UCHAR i; + HT_FBK_CFG0_STRUC HtCfg0; + HT_FBK_CFG1_STRUC HtCfg1; + LG_FBK_CFG0_STRUC LgCfg0; + LG_FBK_CFG1_STRUC LgCfg1; + PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate; + + // set to initial value + HtCfg0.word = 0x65432100; + HtCfg1.word = 0xedcba988; + LgCfg0.word = 0xedcba988; + LgCfg1.word = 0x00002100; + + pNextTxRate = (PRTMP_TX_RATE_SWITCH)pRateTable+1; + for (i = 1; i < *((PUCHAR) pRateTable); i++) + { + pCurrTxRate = (PRTMP_TX_RATE_SWITCH)pRateTable+1+i; + switch (pCurrTxRate->Mode) + { + case 0: //CCK + break; + case 1: //OFDM + { + switch(pCurrTxRate->CurrMCS) + { + case 0: + LgCfg0.field.OFDMMCS0FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; + break; + case 1: + LgCfg0.field.OFDMMCS1FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; + break; + case 2: + LgCfg0.field.OFDMMCS2FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; + break; + case 3: + LgCfg0.field.OFDMMCS3FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; + break; + case 4: + LgCfg0.field.OFDMMCS4FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; + break; + case 5: + LgCfg0.field.OFDMMCS5FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; + break; + case 6: + LgCfg0.field.OFDMMCS6FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; + break; + case 7: + LgCfg0.field.OFDMMCS7FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; + break; + } + } + break; + case 2: //HT-MIX + case 3: //HT-GF + { + if ((pNextTxRate->Mode >= MODE_HTMIX) && (pCurrTxRate->CurrMCS != pNextTxRate->CurrMCS)) + { + switch(pCurrTxRate->CurrMCS) + { + case 0: + HtCfg0.field.HTMCS0FBK = pNextTxRate->CurrMCS; + break; + case 1: + HtCfg0.field.HTMCS1FBK = pNextTxRate->CurrMCS; + break; + case 2: + HtCfg0.field.HTMCS2FBK = pNextTxRate->CurrMCS; + break; + case 3: + HtCfg0.field.HTMCS3FBK = pNextTxRate->CurrMCS; + break; + case 4: + HtCfg0.field.HTMCS4FBK = pNextTxRate->CurrMCS; + break; + case 5: + HtCfg0.field.HTMCS5FBK = pNextTxRate->CurrMCS; + break; + case 6: + HtCfg0.field.HTMCS6FBK = pNextTxRate->CurrMCS; + break; + case 7: + HtCfg0.field.HTMCS7FBK = pNextTxRate->CurrMCS; + break; + case 8: + HtCfg1.field.HTMCS8FBK = pNextTxRate->CurrMCS; + break; + case 9: + HtCfg1.field.HTMCS9FBK = pNextTxRate->CurrMCS; + break; + case 10: + HtCfg1.field.HTMCS10FBK = pNextTxRate->CurrMCS; + break; + case 11: + HtCfg1.field.HTMCS11FBK = pNextTxRate->CurrMCS; + break; + case 12: + HtCfg1.field.HTMCS12FBK = pNextTxRate->CurrMCS; + break; + case 13: + HtCfg1.field.HTMCS13FBK = pNextTxRate->CurrMCS; + break; + case 14: + HtCfg1.field.HTMCS14FBK = pNextTxRate->CurrMCS; + break; + case 15: + HtCfg1.field.HTMCS15FBK = pNextTxRate->CurrMCS; + break; + default: + DBGPRINT(RT_DEBUG_ERROR, ("AsicUpdateAutoFallBackTable: not support CurrMCS=%d\n", pCurrTxRate->CurrMCS)); + } + } + } + break; + } + + pNextTxRate = pCurrTxRate; + } + + RTMP_IO_WRITE32(pAd, HT_FBK_CFG0, HtCfg0.word); + RTMP_IO_WRITE32(pAd, HT_FBK_CFG1, HtCfg1.word); + RTMP_IO_WRITE32(pAd, LG_FBK_CFG0, LgCfg0.word); + RTMP_IO_WRITE32(pAd, LG_FBK_CFG1, LgCfg1.word); +} + +/* + ======================================================================== + + Routine Description: + Set MAC register value according operation mode. + OperationMode AND bNonGFExist are for MM and GF Proteciton. + If MM or GF mask is not set, those passing argument doesn't not take effect. + + Operation mode meaning: + = 0 : Pure HT, no preotection. + = 0x01; there may be non-HT devices in both the control and extension channel, protection is optional in BSS. + = 0x10: No Transmission in 40M is protected. + = 0x11: Transmission in both 40M and 20M shall be protected + if (bNonGFExist) + we should choose not to use GF. But still set correct ASIC registers. + ======================================================================== +*/ +VOID AsicUpdateProtect( + IN PRTMP_ADAPTER pAd, + IN USHORT OperationMode, + IN UCHAR SetMask, + IN BOOLEAN bDisableBGProtect, + IN BOOLEAN bNonGFExist) +{ + PROT_CFG_STRUC ProtCfg, ProtCfg4; + UINT32 Protect[6]; + USHORT offset; + UCHAR i; + UINT32 MacReg = 0; + + + if (!(pAd->CommonCfg.bHTProtect) && (OperationMode != 8)) + { + return; + } + + if (pAd->BATable.numDoneOriginator) + { + // + // enable the RTS/CTS to avoid channel collision + // + SetMask = ALLN_SETPROTECT; + OperationMode = 8; + } + + // Config ASIC RTS threshold register + RTMP_IO_READ32(pAd, TX_RTS_CFG, &MacReg); + MacReg &= 0xFF0000FF; + // If the user want disable RtsThreshold and enable Amsdu/Ralink-Aggregation, set the RtsThreshold as 4096 + if (( + (pAd->CommonCfg.BACapability.field.AmsduEnable) || + (pAd->CommonCfg.bAggregationCapable == TRUE)) + && pAd->CommonCfg.RtsThreshold == MAX_RTS_THRESHOLD) + { + MacReg |= (0x1000 << 8); + } + else + { + MacReg |= (pAd->CommonCfg.RtsThreshold << 8); + } + + RTMP_IO_WRITE32(pAd, TX_RTS_CFG, MacReg); + + // Initial common protection settings + RTMPZeroMemory(Protect, sizeof(Protect)); + ProtCfg4.word = 0; + ProtCfg.word = 0; + ProtCfg.field.TxopAllowGF40 = 1; + ProtCfg.field.TxopAllowGF20 = 1; + ProtCfg.field.TxopAllowMM40 = 1; + ProtCfg.field.TxopAllowMM20 = 1; + ProtCfg.field.TxopAllowOfdm = 1; + ProtCfg.field.TxopAllowCck = 1; + ProtCfg.field.RTSThEn = 1; + ProtCfg.field.ProtectNav = ASIC_SHORTNAV; + + // update PHY mode and rate + if (pAd->CommonCfg.Channel > 14) + ProtCfg.field.ProtectRate = 0x4000; + ProtCfg.field.ProtectRate |= pAd->CommonCfg.RtsRate; + + // Handle legacy(B/G) protection + if (bDisableBGProtect) + { + //ProtCfg.field.ProtectRate = pAd->CommonCfg.RtsRate; + ProtCfg.field.ProtectCtrl = 0; + Protect[0] = ProtCfg.word; + Protect[1] = ProtCfg.word; + pAd->FlgCtsEnabled = 0; /* CTS-self is not used */ + } + else + { + //ProtCfg.field.ProtectRate = pAd->CommonCfg.RtsRate; + ProtCfg.field.ProtectCtrl = 0; // CCK do not need to be protected + Protect[0] = ProtCfg.word; + ProtCfg.field.ProtectCtrl = ASIC_CTS; // OFDM needs using CCK to protect + Protect[1] = ProtCfg.word; + pAd->FlgCtsEnabled = 1; /* CTS-self is used */ + } + + // Decide HT frame protection. + if ((SetMask & ALLN_SETPROTECT) != 0) + { + switch(OperationMode) + { + case 0x0: + // NO PROTECT + // 1.All STAs in the BSS are 20/40 MHz HT + // 2. in ai 20/40MHz BSS + // 3. all STAs are 20MHz in a 20MHz BSS + // Pure HT. no protection. + + // MM20_PROT_CFG + // Reserved (31:27) + // PROT_TXOP(25:20) -- 010111 + // PROT_NAV(19:18) -- 01 (Short NAV protection) + // PROT_CTRL(17:16) -- 00 (None) + // PROT_RATE(15:0) -- 0x4004 (OFDM 24M) + Protect[2] = 0x01744004; + + // MM40_PROT_CFG + // Reserved (31:27) + // PROT_TXOP(25:20) -- 111111 + // PROT_NAV(19:18) -- 01 (Short NAV protection) + // PROT_CTRL(17:16) -- 00 (None) + // PROT_RATE(15:0) -- 0x4084 (duplicate OFDM 24M) + Protect[3] = 0x03f44084; + + // CF20_PROT_CFG + // Reserved (31:27) + // PROT_TXOP(25:20) -- 010111 + // PROT_NAV(19:18) -- 01 (Short NAV protection) + // PROT_CTRL(17:16) -- 00 (None) + // PROT_RATE(15:0) -- 0x4004 (OFDM 24M) + Protect[4] = 0x01744004; + + // CF40_PROT_CFG + // Reserved (31:27) + // PROT_TXOP(25:20) -- 111111 + // PROT_NAV(19:18) -- 01 (Short NAV protection) + // PROT_CTRL(17:16) -- 00 (None) + // PROT_RATE(15:0) -- 0x4084 (duplicate OFDM 24M) + Protect[5] = 0x03f44084; + + if (bNonGFExist) + { + // PROT_NAV(19:18) -- 01 (Short NAV protectiion) + // PROT_CTRL(17:16) -- 01 (RTS/CTS) + Protect[4] = 0x01754004; + Protect[5] = 0x03f54084; + } + pAd->CommonCfg.IOTestParm.bRTSLongProtOn = FALSE; + break; + + case 1: + // This is "HT non-member protection mode." + // If there may be non-HT STAs my BSS + ProtCfg.word = 0x01744004; // PROT_CTRL(17:16) : 0 (None) + ProtCfg4.word = 0x03f44084; // duplicaet legacy 24M. BW set 1. + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_BG_PROTECTION_INUSED)) + { + ProtCfg.word = 0x01740003; //ERP use Protection bit is set, use protection rate at Clause 18.. + ProtCfg4.word = 0x03f40003; // Don't duplicate RTS/CTS in CCK mode. 0x03f40083; + } + //Assign Protection method for 20&40 MHz packets + ProtCfg.field.ProtectCtrl = ASIC_RTS; + ProtCfg.field.ProtectNav = ASIC_SHORTNAV; + ProtCfg4.field.ProtectCtrl = ASIC_RTS; + ProtCfg4.field.ProtectNav = ASIC_SHORTNAV; + Protect[2] = ProtCfg.word; + Protect[3] = ProtCfg4.word; + Protect[4] = ProtCfg.word; + Protect[5] = ProtCfg4.word; + pAd->CommonCfg.IOTestParm.bRTSLongProtOn = TRUE; + break; + + case 2: + // If only HT STAs are in BSS. at least one is 20MHz. Only protect 40MHz packets + ProtCfg.word = 0x01744004; // PROT_CTRL(17:16) : 0 (None) + ProtCfg4.word = 0x03f44084; // duplicaet legacy 24M. BW set 1. + + //Assign Protection method for 40MHz packets + ProtCfg4.field.ProtectCtrl = ASIC_RTS; + ProtCfg4.field.ProtectNav = ASIC_SHORTNAV; + Protect[2] = ProtCfg.word; + Protect[3] = ProtCfg4.word; + if (bNonGFExist) + { + ProtCfg.field.ProtectCtrl = ASIC_RTS; + ProtCfg.field.ProtectNav = ASIC_SHORTNAV; + } + Protect[4] = ProtCfg.word; + Protect[5] = ProtCfg4.word; + + pAd->CommonCfg.IOTestParm.bRTSLongProtOn = FALSE; + break; + + case 3: + // HT mixed mode. PROTECT ALL! + // Assign Rate + ProtCfg.word = 0x01744004; //duplicaet legacy 24M. BW set 1. + ProtCfg4.word = 0x03f44084; + // both 20MHz and 40MHz are protected. Whether use RTS or CTS-to-self depends on the + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_BG_PROTECTION_INUSED)) + { + ProtCfg.word = 0x01740003; //ERP use Protection bit is set, use protection rate at Clause 18.. + ProtCfg4.word = 0x03f40003; // Don't duplicate RTS/CTS in CCK mode. 0x03f40083 + } + //Assign Protection method for 20&40 MHz packets + ProtCfg.field.ProtectCtrl = ASIC_RTS; + ProtCfg.field.ProtectNav = ASIC_SHORTNAV; + ProtCfg4.field.ProtectCtrl = ASIC_RTS; + ProtCfg4.field.ProtectNav = ASIC_SHORTNAV; + Protect[2] = ProtCfg.word; + Protect[3] = ProtCfg4.word; + Protect[4] = ProtCfg.word; + Protect[5] = ProtCfg4.word; + pAd->CommonCfg.IOTestParm.bRTSLongProtOn = TRUE; + break; + + case 8: + // Special on for Atheros problem n chip. + Protect[2] = 0x01754004; + Protect[3] = 0x03f54084; + Protect[4] = 0x01754004; + Protect[5] = 0x03f54084; + pAd->CommonCfg.IOTestParm.bRTSLongProtOn = TRUE; + break; + } + } + + offset = CCK_PROT_CFG; + for (i = 0;i < 6;i++) + { + if ((SetMask & (1<< i))) + { + RTMP_IO_WRITE32(pAd, offset + i*4, Protect[i]); + } +} +} + + +/* + ========================================================================== + Description: + + IRQL = PASSIVE_LEVEL + IRQL = DISPATCH_LEVEL + + ========================================================================== + */ +VOID AsicSwitchChannel( + IN PRTMP_ADAPTER pAd, + IN UCHAR Channel, + IN BOOLEAN bScan) +{ + ULONG R2 = 0, R3 = DEFAULT_RF_TX_POWER, R4 = 0; + CHAR TxPwer = 0, TxPwer2 = DEFAULT_RF_TX_POWER; //Bbp94 = BBPR94_DEFAULT, TxPwer2 = DEFAULT_RF_TX_POWER; + UCHAR index; + UINT32 Value = 0; //BbpReg, Value; + RTMP_RF_REGS *RFRegTable; + UCHAR RFValue; + + RFValue = 0; + // Search Tx power value + // We can't use ChannelList to search channel, since some central channl's txpowr doesn't list + // in ChannelList, so use TxPower array instead. + // + for (index = 0; index < MAX_NUM_OF_CHANNELS; index++) + { + if (Channel == pAd->TxPower[index].Channel) + { + TxPwer = pAd->TxPower[index].Power; + TxPwer2 = pAd->TxPower[index].Power2; + break; + } + } + + if (index == MAX_NUM_OF_CHANNELS) + { + DBGPRINT(RT_DEBUG_ERROR, ("AsicSwitchChannel: Can't find the Channel#%d \n", Channel)); + } + +#ifdef RT30xx + // The RF programming sequence is difference between 3xxx and 2xxx + if ((IS_RT3070(pAd) || IS_RT3090(pAd)||IS_RT3390(pAd)) && ((pAd->RfIcType == RFIC_3020) || (pAd->RfIcType == RFIC_2020) || + (pAd->RfIcType == RFIC_3021) || (pAd->RfIcType == RFIC_3022))) + { + /* modify by WY for Read RF Reg. error */ + + for (index = 0; index < NUM_OF_3020_CHNL; index++) + { + if (Channel == FreqItems3020[index].Channel) + { + // Programming channel parameters + RT30xxWriteRFRegister(pAd, RF_R02, FreqItems3020[index].N); + RT30xxWriteRFRegister(pAd, RF_R03, FreqItems3020[index].K); + RT30xxReadRFRegister(pAd, RF_R06, &RFValue); + RFValue = (RFValue & 0xFC) | FreqItems3020[index].R; + RT30xxWriteRFRegister(pAd, RF_R06, RFValue); + + // Set Tx0 Power + RT30xxReadRFRegister(pAd, RF_R12, &RFValue); + RFValue = (RFValue & 0xE0) | TxPwer; + RT30xxWriteRFRegister(pAd, RF_R12, RFValue); + + // Set Tx1 Power + RT30xxReadRFRegister(pAd, RF_R13, &RFValue); + RFValue = (RFValue & 0xE0) | TxPwer2; + RT30xxWriteRFRegister(pAd, RF_R13, RFValue); + + // Tx/Rx Stream setting + RT30xxReadRFRegister(pAd, RF_R01, &RFValue); + //if (IS_RT3090(pAd)) + // RFValue |= 0x01; // Enable RF block. + RFValue &= 0x03; //clear bit[7~2] + if (pAd->Antenna.field.TxPath == 1) + RFValue |= 0xA0; + else if (pAd->Antenna.field.TxPath == 2) + RFValue |= 0x80; + if (pAd->Antenna.field.RxPath == 1) + RFValue |= 0x50; + else if (pAd->Antenna.field.RxPath == 2) + RFValue |= 0x40; + RT30xxWriteRFRegister(pAd, RF_R01, RFValue); + + // Set RF offset + RT30xxReadRFRegister(pAd, RF_R23, &RFValue); + RFValue = (RFValue & 0x80) | pAd->RfFreqOffset; + RT30xxWriteRFRegister(pAd, RF_R23, RFValue); + + // Set BW + if (!bScan && (pAd->CommonCfg.BBPCurrentBW == BW_40)) + { + RFValue = pAd->Mlme.CaliBW40RfR24; + //DISABLE_11N_CHECK(pAd); + } + else + { + RFValue = pAd->Mlme.CaliBW20RfR24; + } + RT30xxWriteRFRegister(pAd, RF_R24, RFValue); + RT30xxWriteRFRegister(pAd, RF_R31, RFValue); + + // Enable RF tuning + RT30xxReadRFRegister(pAd, RF_R07, &RFValue); + RFValue = RFValue | 0x1; + RT30xxWriteRFRegister(pAd, RF_R07, RFValue); + + // latch channel for future usage. + pAd->LatchRfRegs.Channel = Channel; + + DBGPRINT(RT_DEBUG_TRACE, ("SwitchChannel#%d(RF=%d, Pwr0=%d, Pwr1=%d, %dT), N=0x%02X, K=0x%02X, R=0x%02X\n", + Channel, + pAd->RfIcType, + TxPwer, + TxPwer2, + pAd->Antenna.field.TxPath, + FreqItems3020[index].N, + FreqItems3020[index].K, + FreqItems3020[index].R)); + + break; + } + } + } + else +#endif // RT30xx // + { + RFRegTable = RF2850RegTable; + switch (pAd->RfIcType) + { + case RFIC_2820: + case RFIC_2850: + case RFIC_2720: + case RFIC_2750: + + for (index = 0; index < NUM_OF_2850_CHNL; index++) + { + if (Channel == RFRegTable[index].Channel) + { + R2 = RFRegTable[index].R2; + if (pAd->Antenna.field.TxPath == 1) + { + R2 |= 0x4000; // If TXpath is 1, bit 14 = 1; + } + + if (pAd->Antenna.field.RxPath == 2) + { + R2 |= 0x40; // write 1 to off Rxpath. + } + else if (pAd->Antenna.field.RxPath == 1) + { + R2 |= 0x20040; // write 1 to off RxPath + } + + if (Channel > 14) + { + // initialize R3, R4 + R3 = (RFRegTable[index].R3 & 0xffffc1ff); + R4 = (RFRegTable[index].R4 & (~0x001f87c0)) | (pAd->RfFreqOffset << 15); + + // 5G band power range: 0xF9~0X0F, TX0 Reg3 bit9/TX1 Reg4 bit6="0" means the TX power reduce 7dB + // R3 + if ((TxPwer >= -7) && (TxPwer < 0)) + { + TxPwer = (7+TxPwer); + TxPwer = (TxPwer > 0xF) ? (0xF) : (TxPwer); + R3 |= (TxPwer << 10); + DBGPRINT(RT_DEBUG_ERROR, ("AsicSwitchChannel: TxPwer=%d \n", TxPwer)); + } + else + { + TxPwer = (TxPwer > 0xF) ? (0xF) : (TxPwer); + R3 |= (TxPwer << 10) | (1 << 9); + } + + // R4 + if ((TxPwer2 >= -7) && (TxPwer2 < 0)) + { + TxPwer2 = (7+TxPwer2); + TxPwer2 = (TxPwer2 > 0xF) ? (0xF) : (TxPwer2); + R4 |= (TxPwer2 << 7); + DBGPRINT(RT_DEBUG_ERROR, ("AsicSwitchChannel: TxPwer2=%d \n", TxPwer2)); + } + else + { + TxPwer2 = (TxPwer2 > 0xF) ? (0xF) : (TxPwer2); + R4 |= (TxPwer2 << 7) | (1 << 6); + } + } + else + { + R3 = (RFRegTable[index].R3 & 0xffffc1ff) | (TxPwer << 9); // set TX power0 + R4 = (RFRegTable[index].R4 & (~0x001f87c0)) | (pAd->RfFreqOffset << 15) | (TxPwer2 <<6);// Set freq Offset & TxPwr1 + } + + // Based on BBP current mode before changing RF channel. + if (!bScan && (pAd->CommonCfg.BBPCurrentBW == BW_40)) + { + R4 |=0x200000; + } + + // Update variables + pAd->LatchRfRegs.Channel = Channel; + pAd->LatchRfRegs.R1 = RFRegTable[index].R1; + pAd->LatchRfRegs.R2 = R2; + pAd->LatchRfRegs.R3 = R3; + pAd->LatchRfRegs.R4 = R4; + + // Set RF value 1's set R3[bit2] = [0] + RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R1); + RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R2); + RTMP_RF_IO_WRITE32(pAd, (pAd->LatchRfRegs.R3 & (~0x04))); + RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R4); + + RTMPusecDelay(200); + + // Set RF value 2's set R3[bit2] = [1] + RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R1); + RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R2); + RTMP_RF_IO_WRITE32(pAd, (pAd->LatchRfRegs.R3 | 0x04)); + RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R4); + + RTMPusecDelay(200); + + // Set RF value 3's set R3[bit2] = [0] + RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R1); + RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R2); + RTMP_RF_IO_WRITE32(pAd, (pAd->LatchRfRegs.R3 & (~0x04))); + RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R4); + + break; + } + } + break; + + default: + break; + } + + DBGPRINT(RT_DEBUG_TRACE, ("SwitchChannel#%d(RF=%d, Pwr0=%lu, Pwr1=%lu, %dT) to , R1=0x%08lx, R2=0x%08lx, R3=0x%08lx, R4=0x%08lx\n", + Channel, + pAd->RfIcType, + (R3 & 0x00003e00) >> 9, + (R4 & 0x000007c0) >> 6, + pAd->Antenna.field.TxPath, + pAd->LatchRfRegs.R1, + pAd->LatchRfRegs.R2, + pAd->LatchRfRegs.R3, + pAd->LatchRfRegs.R4)); + } + + // Change BBP setting during siwtch from a->g, g->a + if (Channel <= 14) + { + ULONG TxPinCfg = 0x00050F0A;//Gary 2007/08/09 0x050A0A + + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R62, (0x37 - GET_LNA_GAIN(pAd))); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R63, (0x37 - GET_LNA_GAIN(pAd))); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R64, (0x37 - GET_LNA_GAIN(pAd))); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R86, 0);//(0x44 - GET_LNA_GAIN(pAd))); // According the Rory's suggestion to solve the middle range issue. + //RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0x62); + + // Rx High power VGA offset for LNA select + if (pAd->NicConfig2.field.ExternalLNAForG) + { + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0x62); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x46); + } + else + { + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0x84); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x50); + } + + // 5G band selection PIN, bit1 and bit2 are complement + RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value); + Value &= (~0x6); + Value |= (0x04); + RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); + + // Turn off unused PA or LNA when only 1T or 1R + if (pAd->Antenna.field.TxPath == 1) + { + TxPinCfg &= 0xFFFFFFF3; + } + if (pAd->Antenna.field.RxPath == 1) + { + TxPinCfg &= 0xFFFFF3FF; + } + + + RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg); + + } + else + { + ULONG TxPinCfg = 0x00050F05;//Gary 2007/8/9 0x050505 + + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R62, (0x37 - GET_LNA_GAIN(pAd))); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R63, (0x37 - GET_LNA_GAIN(pAd))); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R64, (0x37 - GET_LNA_GAIN(pAd))); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R86, 0);//(0x44 - GET_LNA_GAIN(pAd))); // According the Rory's suggestion to solve the middle range issue. + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0xF2); + + // Rx High power VGA offset for LNA select + if (pAd->NicConfig2.field.ExternalLNAForA) + { + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x46); + } + else + { + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x50); + } + + // 5G band selection PIN, bit1 and bit2 are complement + RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value); + Value &= (~0x6); + Value |= (0x02); + RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); + + // Turn off unused PA or LNA when only 1T or 1R + if (pAd->Antenna.field.TxPath == 1) + { + TxPinCfg &= 0xFFFFFFF3; + } + if (pAd->Antenna.field.RxPath == 1) + { + TxPinCfg &= 0xFFFFF3FF; + } + + + RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg); + + } + + // R66 should be set according to Channel and use 20MHz when scanning + //RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, (0x2E + GET_LNA_GAIN(pAd))); + if (bScan) + RTMPSetAGCInitValue(pAd, BW_20); + else + RTMPSetAGCInitValue(pAd, pAd->CommonCfg.BBPCurrentBW); + + // + // On 11A, We should delay and wait RF/BBP to be stable + // and the appropriate time should be 1000 micro seconds + // 2005/06/05 - On 11G, We also need this delay time. Otherwise it's difficult to pass the WHQL. + // + RTMPusecDelay(1000); +} + +VOID AsicResetBBPAgent( +IN PRTMP_ADAPTER pAd) +{ + BBP_CSR_CFG_STRUC BbpCsr; + DBGPRINT(RT_DEBUG_ERROR, ("Reset BBP Agent busy bit.!! \n")); + // Still need to find why BBP agent keeps busy, but in fact, hardware still function ok. Now clear busy first. + RTMP_IO_READ32(pAd, H2M_BBP_AGENT, &BbpCsr.word); + BbpCsr.field.Busy = 0; + RTMP_IO_WRITE32(pAd, H2M_BBP_AGENT, BbpCsr.word); +} + +/* + ========================================================================== + Description: + This function is required for 2421 only, and should not be used during + site survey. It's only required after NIC decided to stay at a channel + for a longer period. + When this function is called, it's always after AsicSwitchChannel(). + + IRQL = PASSIVE_LEVEL + IRQL = DISPATCH_LEVEL + + ========================================================================== + */ +VOID AsicLockChannel( + IN PRTMP_ADAPTER pAd, + IN UCHAR Channel) +{ +} + +VOID AsicRfTuningExec( + IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3) +{ +} + +/* + ========================================================================== + Description: + Gives CCK TX rate 2 more dB TX power. + This routine works only in LINK UP in INFRASTRUCTURE mode. + + calculate desired Tx power in RF R3.Tx0~5, should consider - + 0. if current radio is a noisy environment (pAd->DrsCounters.fNoisyEnvironment) + 1. TxPowerPercentage + 2. auto calibration based on TSSI feedback + 3. extra 2 db for CCK + 4. -10 db upon very-short distance (AvgRSSI >= -40db) to AP + + NOTE: Since this routine requires the value of (pAd->DrsCounters.fNoisyEnvironment), + it should be called AFTER MlmeDynamicTxRatSwitching() + ========================================================================== + */ +VOID AsicAdjustTxPower( + IN PRTMP_ADAPTER pAd) +{ + INT i, j; + CHAR DeltaPwr = 0; + BOOLEAN bAutoTxAgc = FALSE; + UCHAR TssiRef, *pTssiMinusBoundary, *pTssiPlusBoundary, TxAgcStep; + UCHAR BbpR1 = 0, BbpR49 = 0, idx; + PCHAR pTxAgcCompensate; + ULONG TxPwr[5]; + CHAR Value; + CHAR Rssi = -127; + + + + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) || +#ifdef RTMP_MAC_PCI + (pAd->bPCIclkOff == TRUE) || +#endif // RTMP_MAC_PCI // + RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF) || + RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) + return; + + Rssi = RTMPMaxRssi(pAd, + pAd->StaCfg.RssiSample.AvgRssi0, + pAd->StaCfg.RssiSample.AvgRssi1, + pAd->StaCfg.RssiSample.AvgRssi2); + + if (pAd->CommonCfg.BBPCurrentBW == BW_40) + { + if (pAd->CommonCfg.CentralChannel > 14) + { + TxPwr[0] = pAd->Tx40MPwrCfgABand[0]; + TxPwr[1] = pAd->Tx40MPwrCfgABand[1]; + TxPwr[2] = pAd->Tx40MPwrCfgABand[2]; + TxPwr[3] = pAd->Tx40MPwrCfgABand[3]; + TxPwr[4] = pAd->Tx40MPwrCfgABand[4]; + } + else + { + TxPwr[0] = pAd->Tx40MPwrCfgGBand[0]; + TxPwr[1] = pAd->Tx40MPwrCfgGBand[1]; + TxPwr[2] = pAd->Tx40MPwrCfgGBand[2]; + TxPwr[3] = pAd->Tx40MPwrCfgGBand[3]; + TxPwr[4] = pAd->Tx40MPwrCfgGBand[4]; + } + } + else + { + if (pAd->CommonCfg.Channel > 14) + { + TxPwr[0] = pAd->Tx20MPwrCfgABand[0]; + TxPwr[1] = pAd->Tx20MPwrCfgABand[1]; + TxPwr[2] = pAd->Tx20MPwrCfgABand[2]; + TxPwr[3] = pAd->Tx20MPwrCfgABand[3]; + TxPwr[4] = pAd->Tx20MPwrCfgABand[4]; + } + else + { + TxPwr[0] = pAd->Tx20MPwrCfgGBand[0]; + TxPwr[1] = pAd->Tx20MPwrCfgGBand[1]; + TxPwr[2] = pAd->Tx20MPwrCfgGBand[2]; + TxPwr[3] = pAd->Tx20MPwrCfgGBand[3]; + TxPwr[4] = pAd->Tx20MPwrCfgGBand[4]; + } + } + + // TX power compensation for temperature variation based on TSSI. try every 4 second + if (pAd->Mlme.OneSecPeriodicRound % 4 == 0) + { + if (pAd->CommonCfg.Channel <= 14) + { + /* bg channel */ + bAutoTxAgc = pAd->bAutoTxAgcG; + TssiRef = pAd->TssiRefG; + pTssiMinusBoundary = &pAd->TssiMinusBoundaryG[0]; + pTssiPlusBoundary = &pAd->TssiPlusBoundaryG[0]; + TxAgcStep = pAd->TxAgcStepG; + pTxAgcCompensate = &pAd->TxAgcCompensateG; + } + else + { + /* a channel */ + bAutoTxAgc = pAd->bAutoTxAgcA; + TssiRef = pAd->TssiRefA; + pTssiMinusBoundary = &pAd->TssiMinusBoundaryA[0]; + pTssiPlusBoundary = &pAd->TssiPlusBoundaryA[0]; + TxAgcStep = pAd->TxAgcStepA; + pTxAgcCompensate = &pAd->TxAgcCompensateA; + } + + if (bAutoTxAgc) + { + /* BbpR1 is unsigned char */ + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R49, &BbpR49); + + /* (p) TssiPlusBoundaryG[0] = 0 = (m) TssiMinusBoundaryG[0] */ + /* compensate: +4 +3 +2 +1 0 -1 -2 -3 -4 * steps */ + /* step value is defined in pAd->TxAgcStepG for tx power value */ + + /* [4]+1+[4] p4 p3 p2 p1 o1 m1 m2 m3 m4 */ + /* ex: 0x00 0x15 0x25 0x45 0x88 0xA0 0xB5 0xD0 0xF0 + above value are examined in mass factory production */ + /* [4] [3] [2] [1] [0] [1] [2] [3] [4] */ + + /* plus (+) is 0x00 ~ 0x45, minus (-) is 0xa0 ~ 0xf0 */ + /* if value is between p1 ~ o1 or o1 ~ s1, no need to adjust tx power */ + /* if value is 0xa5, tx power will be -= TxAgcStep*(2-1) */ + + if (BbpR49 > pTssiMinusBoundary[1]) + { + // Reading is larger than the reference value + // check for how large we need to decrease the Tx power + for (idx = 1; idx < 5; idx++) + { + if (BbpR49 <= pTssiMinusBoundary[idx]) // Found the range + break; + } + // The index is the step we should decrease, idx = 0 means there is nothing to compensate +// if (R3 > (ULONG) (TxAgcStep * (idx-1))) + *pTxAgcCompensate = -(TxAgcStep * (idx-1)); +// else +// *pTxAgcCompensate = -((UCHAR)R3); + + DeltaPwr += (*pTxAgcCompensate); + DBGPRINT(RT_DEBUG_TRACE, ("-- Tx Power, BBP R1=%x, TssiRef=%x, TxAgcStep=%x, step = -%d\n", + BbpR49, TssiRef, TxAgcStep, idx-1)); + } + else if (BbpR49 < pTssiPlusBoundary[1]) + { + // Reading is smaller than the reference value + // check for how large we need to increase the Tx power + for (idx = 1; idx < 5; idx++) + { + if (BbpR49 >= pTssiPlusBoundary[idx]) // Found the range + break; + } + // The index is the step we should increase, idx = 0 means there is nothing to compensate + *pTxAgcCompensate = TxAgcStep * (idx-1); + DeltaPwr += (*pTxAgcCompensate); + DBGPRINT(RT_DEBUG_TRACE, ("++ Tx Power, BBP R1=%x, TssiRef=%x, TxAgcStep=%x, step = +%d\n", + BbpR49, TssiRef, TxAgcStep, idx-1)); + } + else + { + *pTxAgcCompensate = 0; + DBGPRINT(RT_DEBUG_TRACE, (" Tx Power, BBP R49=%x, TssiRef=%x, TxAgcStep=%x, step = +%d\n", + BbpR49, TssiRef, TxAgcStep, 0)); + } + } + } + else + { + if (pAd->CommonCfg.Channel <= 14) + { + bAutoTxAgc = pAd->bAutoTxAgcG; + pTxAgcCompensate = &pAd->TxAgcCompensateG; + } + else + { + bAutoTxAgc = pAd->bAutoTxAgcA; + pTxAgcCompensate = &pAd->TxAgcCompensateA; + } + + if (bAutoTxAgc) + DeltaPwr += (*pTxAgcCompensate); + } + + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &BbpR1); + BbpR1 &= 0xFC; + + + /* calculate delta power based on the percentage specified from UI */ + // E2PROM setting is calibrated for maximum TX power (i.e. 100%) + // We lower TX power here according to the percentage specified from UI + if (pAd->CommonCfg.TxPowerPercentage == 0xffffffff) // AUTO TX POWER control + { + { + // to patch high power issue with some APs, like Belkin N1. + if (Rssi > -35) + { + BbpR1 |= 0x02; // DeltaPwr -= 12; + } + else if (Rssi > -40) + { + BbpR1 |= 0x01; // DeltaPwr -= 6; + } + else + ; + } + } + else if (pAd->CommonCfg.TxPowerPercentage > 90) // 91 ~ 100% & AUTO, treat as 100% in terms of mW + ; + else if (pAd->CommonCfg.TxPowerPercentage > 60) // 61 ~ 90%, treat as 75% in terms of mW // DeltaPwr -= 1; + { + DeltaPwr -= 1; + } + else if (pAd->CommonCfg.TxPowerPercentage > 30) // 31 ~ 60%, treat as 50% in terms of mW // DeltaPwr -= 3; + { + DeltaPwr -= 3; + } + else if (pAd->CommonCfg.TxPowerPercentage > 15) // 16 ~ 30%, treat as 25% in terms of mW // DeltaPwr -= 6; + { + BbpR1 |= 0x01; + } + else if (pAd->CommonCfg.TxPowerPercentage > 9) // 10 ~ 15%, treat as 12.5% in terms of mW // DeltaPwr -= 9; + { + BbpR1 |= 0x01; + DeltaPwr -= 3; + } + else // 0 ~ 9 %, treat as MIN(~3%) in terms of mW // DeltaPwr -= 12; + { + BbpR1 |= 0x02; + } + + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R1, BbpR1); + + /* reset different new tx power for different TX rate */ + for(i=0; i<5; i++) + { + if (TxPwr[i] != 0xffffffff) + { + for (j=0; j<8; j++) + { + Value = (CHAR)((TxPwr[i] >> j*4) & 0x0F); /* 0 ~ 15 */ + + if ((Value + DeltaPwr) < 0) + { + Value = 0; /* min */ + } + else if ((Value + DeltaPwr) > 0xF) + { + Value = 0xF; /* max */ + } + else + { + Value += DeltaPwr; /* temperature compensation */ + } + + /* fill new value to CSR offset */ + TxPwr[i] = (TxPwr[i] & ~(0x0000000F << j*4)) | (Value << j*4); + } + + /* write tx power value to CSR */ + /* TX_PWR_CFG_0 (8 tx rate) for TX power for OFDM 12M/18M + TX power for OFDM 6M/9M + TX power for CCK5.5M/11M + TX power for CCK1M/2M */ + /* TX_PWR_CFG_1 ~ TX_PWR_CFG_4 */ + RTMP_IO_WRITE32(pAd, TX_PWR_CFG_0 + i*4, TxPwr[i]); + } + } + + +} + + +/* + ========================================================================== + Description: + put PHY to sleep here, and set next wakeup timer. PHY doesn't not wakeup + automatically. Instead, MCU will issue a TwakeUpInterrupt to host after + the wakeup timer timeout. Driver has to issue a separate command to wake + PHY up. + + IRQL = DISPATCH_LEVEL + + ========================================================================== + */ +VOID AsicSleepThenAutoWakeup( + IN PRTMP_ADAPTER pAd, + IN USHORT TbttNumToNextWakeUp) +{ + RTMP_STA_SLEEP_THEN_AUTO_WAKEUP(pAd, TbttNumToNextWakeUp); +} + +/* + ========================================================================== + Description: + AsicForceWakeup() is used whenever manual wakeup is required + AsicForceSleep() should only be used when not in INFRA BSS. When + in INFRA BSS, we should use AsicSleepThenAutoWakeup() instead. + ========================================================================== + */ +VOID AsicForceSleep( + IN PRTMP_ADAPTER pAd) +{ + +} + +/* + ========================================================================== + Description: + AsicForceWakeup() is used whenever Twakeup timer (set via AsicSleepThenAutoWakeup) + expired. + + IRQL = PASSIVE_LEVEL + IRQL = DISPATCH_LEVEL + ========================================================================== + */ +VOID AsicForceWakeup( + IN PRTMP_ADAPTER pAd, + IN BOOLEAN bFromTx) +{ + DBGPRINT(RT_DEBUG_INFO, ("--> AsicForceWakeup \n")); + RTMP_STA_FORCE_WAKEUP(pAd, bFromTx); +} + + +/* + ========================================================================== + Description: + Set My BSSID + + IRQL = DISPATCH_LEVEL + + ========================================================================== + */ +VOID AsicSetBssid( + IN PRTMP_ADAPTER pAd, + IN PUCHAR pBssid) +{ + ULONG Addr4; + DBGPRINT(RT_DEBUG_TRACE, ("==============> AsicSetBssid %x:%x:%x:%x:%x:%x\n", + pBssid[0],pBssid[1],pBssid[2],pBssid[3], pBssid[4],pBssid[5])); + + Addr4 = (ULONG)(pBssid[0]) | + (ULONG)(pBssid[1] << 8) | + (ULONG)(pBssid[2] << 16) | + (ULONG)(pBssid[3] << 24); + RTMP_IO_WRITE32(pAd, MAC_BSSID_DW0, Addr4); + + Addr4 = 0; + // always one BSSID in STA mode + Addr4 = (ULONG)(pBssid[4]) | (ULONG)(pBssid[5] << 8); + + RTMP_IO_WRITE32(pAd, MAC_BSSID_DW1, Addr4); +} + +VOID AsicSetMcastWC( + IN PRTMP_ADAPTER pAd) +{ + MAC_TABLE_ENTRY *pEntry = &pAd->MacTab.Content[MCAST_WCID]; + USHORT offset; + + pEntry->Sst = SST_ASSOC; + pEntry->Aid = MCAST_WCID; // Softap supports 1 BSSID and use WCID=0 as multicast Wcid index + pEntry->PsMode = PWR_ACTIVE; + pEntry->CurrTxRate = pAd->CommonCfg.MlmeRate; + offset = MAC_WCID_BASE + BSS0Mcast_WCID * HW_WCID_ENTRY_SIZE; +} + +/* + ========================================================================== + Description: + + IRQL = DISPATCH_LEVEL + + ========================================================================== + */ +VOID AsicDelWcidTab( + IN PRTMP_ADAPTER pAd, + IN UCHAR Wcid) +{ + ULONG Addr0 = 0x0, Addr1 = 0x0; + ULONG offset; + + DBGPRINT(RT_DEBUG_TRACE, ("AsicDelWcidTab==>Wcid = 0x%x\n",Wcid)); + offset = MAC_WCID_BASE + Wcid * HW_WCID_ENTRY_SIZE; + RTMP_IO_WRITE32(pAd, offset, Addr0); + offset += 4; + RTMP_IO_WRITE32(pAd, offset, Addr1); +} + +/* + ========================================================================== + Description: + + IRQL = DISPATCH_LEVEL + + ========================================================================== + */ +VOID AsicEnableRDG( + IN PRTMP_ADAPTER pAd) +{ + TX_LINK_CFG_STRUC TxLinkCfg; + UINT32 Data = 0; + + RTMP_IO_READ32(pAd, TX_LINK_CFG, &TxLinkCfg.word); + TxLinkCfg.field.TxRDGEn = 1; + RTMP_IO_WRITE32(pAd, TX_LINK_CFG, TxLinkCfg.word); + + RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &Data); + Data &= 0xFFFFFF00; + Data |= 0x80; + RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Data); + + //OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); +} + +/* + ========================================================================== + Description: + + IRQL = DISPATCH_LEVEL + + ========================================================================== + */ +VOID AsicDisableRDG( + IN PRTMP_ADAPTER pAd) +{ + TX_LINK_CFG_STRUC TxLinkCfg; + UINT32 Data = 0; + + + RTMP_IO_READ32(pAd, TX_LINK_CFG, &TxLinkCfg.word); + TxLinkCfg.field.TxRDGEn = 0; + RTMP_IO_WRITE32(pAd, TX_LINK_CFG, TxLinkCfg.word); + + RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &Data); + + Data &= 0xFFFFFF00; + //Data |= 0x20; +#ifndef WIFI_TEST + //if ( pAd->CommonCfg.bEnableTxBurst ) + // Data |= 0x60; // for performance issue not set the TXOP to 0 +#endif + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_DYNAMIC_BE_TXOP_ACTIVE) + && (pAd->MacTab.fAnyStationMIMOPSDynamic == FALSE) + ) + { + // For CWC test, change txop from 0x30 to 0x20 in TxBurst mode + if (pAd->CommonCfg.bEnableTxBurst) + Data |= 0x20; + } + RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Data); +} + +/* + ========================================================================== + Description: + + IRQL = PASSIVE_LEVEL + IRQL = DISPATCH_LEVEL + + ========================================================================== + */ +VOID AsicDisableSync( + IN PRTMP_ADAPTER pAd) +{ + BCN_TIME_CFG_STRUC csr; + + DBGPRINT(RT_DEBUG_TRACE, ("--->Disable TSF synchronization\n")); + + // 2003-12-20 disable TSF and TBTT while NIC in power-saving have side effect + // that NIC will never wakes up because TSF stops and no more + // TBTT interrupts + pAd->TbttTickCount = 0; + RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr.word); + csr.field.bBeaconGen = 0; + csr.field.bTBTTEnable = 0; + csr.field.TsfSyncMode = 0; + csr.field.bTsfTicking = 0; + RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr.word); + +} + +/* + ========================================================================== + Description: + + IRQL = DISPATCH_LEVEL + + ========================================================================== + */ +VOID AsicEnableBssSync( + IN PRTMP_ADAPTER pAd) +{ + BCN_TIME_CFG_STRUC csr; + + DBGPRINT(RT_DEBUG_TRACE, ("--->AsicEnableBssSync(INFRA mode)\n")); + + RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr.word); +// RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, 0x00000000); + { + csr.field.BeaconInterval = pAd->CommonCfg.BeaconPeriod << 4; // ASIC register in units of 1/16 TU + csr.field.bTsfTicking = 1; + csr.field.TsfSyncMode = 1; // sync TSF in INFRASTRUCTURE mode + csr.field.bBeaconGen = 0; // do NOT generate BEACON + csr.field.bTBTTEnable = 1; + } + RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr.word); +} + +/* + ========================================================================== + Description: + Note: + BEACON frame in shared memory should be built ok before this routine + can be called. Otherwise, a garbage frame maybe transmitted out every + Beacon period. + + IRQL = DISPATCH_LEVEL + + ========================================================================== + */ +VOID AsicEnableIbssSync( + IN PRTMP_ADAPTER pAd) +{ + BCN_TIME_CFG_STRUC csr9; + PUCHAR ptr; + UINT i; + + DBGPRINT(RT_DEBUG_TRACE, ("--->AsicEnableIbssSync(ADHOC mode. MPDUtotalByteCount = %d)\n", pAd->BeaconTxWI.MPDUtotalByteCount)); + + RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr9.word); + csr9.field.bBeaconGen = 0; + csr9.field.bTBTTEnable = 0; + csr9.field.bTsfTicking = 0; + RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr9.word); + +#ifdef RTMP_MAC_PCI + // move BEACON TXD and frame content to on-chip memory + ptr = (PUCHAR)&pAd->BeaconTxWI; + for (i=0; iBeaconBuf; + for (i=0; i< pAd->BeaconTxWI.MPDUtotalByteCount; i+=4) + { + UINT32 longptr = *ptr + (*(ptr+1)<<8) + (*(ptr+2)<<16) + (*(ptr+3)<<24); + RTMP_IO_WRITE32(pAd, HW_BEACON_BASE0 + TXWI_SIZE + i, longptr); + ptr +=4; + } +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB + // move BEACON TXD and frame content to on-chip memory + ptr = (PUCHAR)&pAd->BeaconTxWI; + for (i=0; iBeaconBuf; + for (i=0; i< pAd->BeaconTxWI.MPDUtotalByteCount; i+=2) + { + //UINT32 longptr = *ptr + (*(ptr+1)<<8) + (*(ptr+2)<<16) + (*(ptr+3)<<24); + //RTMP_IO_WRITE32(pAd, HW_BEACON_BASE0 + TXWI_SIZE + i, longptr); + RTUSBMultiWrite(pAd, HW_BEACON_BASE0 + TXWI_SIZE + i, ptr, 2); + ptr +=2; + } +#endif // RTMP_MAC_USB // + + // + // For Wi-Fi faily generated beacons between participating stations. + // Set TBTT phase adaptive adjustment step to 8us (default 16us) + // don't change settings 2006-5- by Jerry + //RTMP_IO_WRITE32(pAd, TBTT_SYNC_CFG, 0x00001010); + + // start sending BEACON + csr9.field.BeaconInterval = pAd->CommonCfg.BeaconPeriod << 4; // ASIC register in units of 1/16 TU + csr9.field.bTsfTicking = 1; + csr9.field.TsfSyncMode = 2; // sync TSF in IBSS mode + csr9.field.bTBTTEnable = 1; + csr9.field.bBeaconGen = 1; + RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr9.word); +} + +/* + ========================================================================== + Description: + + IRQL = PASSIVE_LEVEL + IRQL = DISPATCH_LEVEL + + ========================================================================== + */ +VOID AsicSetEdcaParm( + IN PRTMP_ADAPTER pAd, + IN PEDCA_PARM pEdcaParm) +{ + EDCA_AC_CFG_STRUC Ac0Cfg, Ac1Cfg, Ac2Cfg, Ac3Cfg; + AC_TXOP_CSR0_STRUC csr0; + AC_TXOP_CSR1_STRUC csr1; + AIFSN_CSR_STRUC AifsnCsr; + CWMIN_CSR_STRUC CwminCsr; + CWMAX_CSR_STRUC CwmaxCsr; + int i; + + Ac0Cfg.word = 0; + Ac1Cfg.word = 0; + Ac2Cfg.word = 0; + Ac3Cfg.word = 0; + if ((pEdcaParm == NULL) || (pEdcaParm->bValid == FALSE)) + { + DBGPRINT(RT_DEBUG_TRACE,("AsicSetEdcaParm\n")); + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_WMM_INUSED); + for (i=0; iMacTab.Content[i].ValidAsCLI || pAd->MacTab.Content[i].ValidAsApCli) + CLIENT_STATUS_CLEAR_FLAG(&pAd->MacTab.Content[i], fCLIENT_STATUS_WMM_CAPABLE); + } + + //======================================================== + // MAC Register has a copy . + //======================================================== +//#ifndef WIFI_TEST + if( pAd->CommonCfg.bEnableTxBurst ) + { + // For CWC test, change txop from 0x30 to 0x20 in TxBurst mode + Ac0Cfg.field.AcTxop = 0x20; // Suggest by John for TxBurst in HT Mode + } + else + Ac0Cfg.field.AcTxop = 0; // QID_AC_BE +//#else +// Ac0Cfg.field.AcTxop = 0; // QID_AC_BE +//#endif + Ac0Cfg.field.Cwmin = CW_MIN_IN_BITS; + Ac0Cfg.field.Cwmax = CW_MAX_IN_BITS; + Ac0Cfg.field.Aifsn = 2; + RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Ac0Cfg.word); + + Ac1Cfg.field.AcTxop = 0; // QID_AC_BK + Ac1Cfg.field.Cwmin = CW_MIN_IN_BITS; + Ac1Cfg.field.Cwmax = CW_MAX_IN_BITS; + Ac1Cfg.field.Aifsn = 2; + RTMP_IO_WRITE32(pAd, EDCA_AC1_CFG, Ac1Cfg.word); + + if (pAd->CommonCfg.PhyMode == PHY_11B) + { + Ac2Cfg.field.AcTxop = 192; // AC_VI: 192*32us ~= 6ms + Ac3Cfg.field.AcTxop = 96; // AC_VO: 96*32us ~= 3ms + } + else + { + Ac2Cfg.field.AcTxop = 96; // AC_VI: 96*32us ~= 3ms + Ac3Cfg.field.AcTxop = 48; // AC_VO: 48*32us ~= 1.5ms + } + Ac2Cfg.field.Cwmin = CW_MIN_IN_BITS; + Ac2Cfg.field.Cwmax = CW_MAX_IN_BITS; + Ac2Cfg.field.Aifsn = 2; + RTMP_IO_WRITE32(pAd, EDCA_AC2_CFG, Ac2Cfg.word); + Ac3Cfg.field.Cwmin = CW_MIN_IN_BITS; + Ac3Cfg.field.Cwmax = CW_MAX_IN_BITS; + Ac3Cfg.field.Aifsn = 2; + RTMP_IO_WRITE32(pAd, EDCA_AC3_CFG, Ac3Cfg.word); + + //======================================================== + // DMA Register has a copy too. + //======================================================== + csr0.field.Ac0Txop = 0; // QID_AC_BE + csr0.field.Ac1Txop = 0; // QID_AC_BK + RTMP_IO_WRITE32(pAd, WMM_TXOP0_CFG, csr0.word); + if (pAd->CommonCfg.PhyMode == PHY_11B) + { + csr1.field.Ac2Txop = 192; // AC_VI: 192*32us ~= 6ms + csr1.field.Ac3Txop = 96; // AC_VO: 96*32us ~= 3ms + } + else + { + csr1.field.Ac2Txop = 96; // AC_VI: 96*32us ~= 3ms + csr1.field.Ac3Txop = 48; // AC_VO: 48*32us ~= 1.5ms + } + RTMP_IO_WRITE32(pAd, WMM_TXOP1_CFG, csr1.word); + + CwminCsr.word = 0; + CwminCsr.field.Cwmin0 = CW_MIN_IN_BITS; + CwminCsr.field.Cwmin1 = CW_MIN_IN_BITS; + CwminCsr.field.Cwmin2 = CW_MIN_IN_BITS; + CwminCsr.field.Cwmin3 = CW_MIN_IN_BITS; + RTMP_IO_WRITE32(pAd, WMM_CWMIN_CFG, CwminCsr.word); + + CwmaxCsr.word = 0; + CwmaxCsr.field.Cwmax0 = CW_MAX_IN_BITS; + CwmaxCsr.field.Cwmax1 = CW_MAX_IN_BITS; + CwmaxCsr.field.Cwmax2 = CW_MAX_IN_BITS; + CwmaxCsr.field.Cwmax3 = CW_MAX_IN_BITS; + RTMP_IO_WRITE32(pAd, WMM_CWMAX_CFG, CwmaxCsr.word); + + RTMP_IO_WRITE32(pAd, WMM_AIFSN_CFG, 0x00002222); + + NdisZeroMemory(&pAd->CommonCfg.APEdcaParm, sizeof(EDCA_PARM)); + } + else + { + OPSTATUS_SET_FLAG(pAd, fOP_STATUS_WMM_INUSED); + //======================================================== + // MAC Register has a copy. + //======================================================== + // + // Modify Cwmin/Cwmax/Txop on queue[QID_AC_VI], Recommend by Jerry 2005/07/27 + // To degrade our VIDO Queue's throughput for WiFi WMM S3T07 Issue. + // + //pEdcaParm->Txop[QID_AC_VI] = pEdcaParm->Txop[QID_AC_VI] * 7 / 10; // rt2860c need this + + Ac0Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BE]; + Ac0Cfg.field.Cwmin= pEdcaParm->Cwmin[QID_AC_BE]; + Ac0Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_BE]; + Ac0Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BE]; //+1; + + Ac1Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BK]; + Ac1Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_BK]; //+2; + Ac1Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_BK]; + Ac1Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BK]; //+1; + + Ac2Cfg.field.AcTxop = (pEdcaParm->Txop[QID_AC_VI] * 6) / 10; + if(pAd->Antenna.field.TxPath == 1) + { + Ac2Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_VI] + 1; + Ac2Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_VI] + 1; + } + else + { + Ac2Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_VI]; + Ac2Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_VI]; + } + Ac2Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_VI] + 1; +#ifdef RTMP_MAC_USB + Ac2Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_VI] + 3; +#endif // RTMP_MAC_USB // + + { + // Tuning for Wi-Fi WMM S06 + if (pAd->CommonCfg.bWiFiTest && + pEdcaParm->Aifsn[QID_AC_VI] == 10) + Ac2Cfg.field.Aifsn -= 1; + + // Tuning for TGn Wi-Fi 5.2.32 + // STA TestBed changes in this item: conexant legacy sta ==> broadcom 11n sta + if (STA_TGN_WIFI_ON(pAd) && + pEdcaParm->Aifsn[QID_AC_VI] == 10) + { + Ac0Cfg.field.Aifsn = 3; + Ac2Cfg.field.AcTxop = 5; + } +#ifdef RT30xx + if (pAd->RfIcType == RFIC_3020 || pAd->RfIcType == RFIC_2020) + { + // Tuning for WiFi WMM S3-T07: connexant legacy sta ==> broadcom 11n sta. + Ac2Cfg.field.Aifsn = 5; + } +#endif // RT30xx // + } + + Ac3Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_VO]; + Ac3Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_VO]; + Ac3Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_VO]; + Ac3Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_VO]; + +//#ifdef WIFI_TEST + if (pAd->CommonCfg.bWiFiTest) + { + if (Ac3Cfg.field.AcTxop == 102) + { + Ac0Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BE] ? pEdcaParm->Txop[QID_AC_BE] : 10; + Ac0Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BE]-1; /* AIFSN must >= 1 */ + Ac1Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BK]; + Ac1Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BK]; + Ac2Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_VI]; + } /* End of if */ + } +//#endif // WIFI_TEST // + + RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Ac0Cfg.word); + RTMP_IO_WRITE32(pAd, EDCA_AC1_CFG, Ac1Cfg.word); + RTMP_IO_WRITE32(pAd, EDCA_AC2_CFG, Ac2Cfg.word); + RTMP_IO_WRITE32(pAd, EDCA_AC3_CFG, Ac3Cfg.word); + + + //======================================================== + // DMA Register has a copy too. + //======================================================== + csr0.field.Ac0Txop = Ac0Cfg.field.AcTxop; + csr0.field.Ac1Txop = Ac1Cfg.field.AcTxop; + RTMP_IO_WRITE32(pAd, WMM_TXOP0_CFG, csr0.word); + + csr1.field.Ac2Txop = Ac2Cfg.field.AcTxop; + csr1.field.Ac3Txop = Ac3Cfg.field.AcTxop; + RTMP_IO_WRITE32(pAd, WMM_TXOP1_CFG, csr1.word); + + CwminCsr.word = 0; + CwminCsr.field.Cwmin0 = pEdcaParm->Cwmin[QID_AC_BE]; + CwminCsr.field.Cwmin1 = pEdcaParm->Cwmin[QID_AC_BK]; + CwminCsr.field.Cwmin2 = pEdcaParm->Cwmin[QID_AC_VI]; + CwminCsr.field.Cwmin3 = pEdcaParm->Cwmin[QID_AC_VO] - 1; //for TGn wifi test + RTMP_IO_WRITE32(pAd, WMM_CWMIN_CFG, CwminCsr.word); + + CwmaxCsr.word = 0; + CwmaxCsr.field.Cwmax0 = pEdcaParm->Cwmax[QID_AC_BE]; + CwmaxCsr.field.Cwmax1 = pEdcaParm->Cwmax[QID_AC_BK]; + CwmaxCsr.field.Cwmax2 = pEdcaParm->Cwmax[QID_AC_VI]; + CwmaxCsr.field.Cwmax3 = pEdcaParm->Cwmax[QID_AC_VO]; + RTMP_IO_WRITE32(pAd, WMM_CWMAX_CFG, CwmaxCsr.word); + + AifsnCsr.word = 0; + AifsnCsr.field.Aifsn0 = Ac0Cfg.field.Aifsn; //pEdcaParm->Aifsn[QID_AC_BE]; + AifsnCsr.field.Aifsn1 = Ac1Cfg.field.Aifsn; //pEdcaParm->Aifsn[QID_AC_BK]; + AifsnCsr.field.Aifsn2 = Ac2Cfg.field.Aifsn; //pEdcaParm->Aifsn[QID_AC_VI]; + + { + // Tuning for Wi-Fi WMM S06 + if (pAd->CommonCfg.bWiFiTest && + pEdcaParm->Aifsn[QID_AC_VI] == 10) + AifsnCsr.field.Aifsn2 = Ac2Cfg.field.Aifsn - 4; + + // Tuning for TGn Wi-Fi 5.2.32 + // STA TestBed changes in this item: connexant legacy sta ==> broadcom 11n sta + if (STA_TGN_WIFI_ON(pAd) && + pEdcaParm->Aifsn[QID_AC_VI] == 10) + { + AifsnCsr.field.Aifsn0 = 3; + AifsnCsr.field.Aifsn2 = 7; + } + + if (INFRA_ON(pAd)) + CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[BSSID_WCID], fCLIENT_STATUS_WMM_CAPABLE); + } + + { + AifsnCsr.field.Aifsn3 = Ac3Cfg.field.Aifsn - 1; //pEdcaParm->Aifsn[QID_AC_VO]; //for TGn wifi test +#ifdef RT30xx + // TODO: Shiang, this modification also suitable for RT3052/RT3050 ??? + if (pAd->RfIcType == RFIC_3020 || pAd->RfIcType == RFIC_2020) + { + AifsnCsr.field.Aifsn2 = 0x2; //pEdcaParm->Aifsn[QID_AC_VI]; //for WiFi WMM S4-T04. + } +#endif // RT30xx // + } + RTMP_IO_WRITE32(pAd, WMM_AIFSN_CFG, AifsnCsr.word); + + NdisMoveMemory(&pAd->CommonCfg.APEdcaParm, pEdcaParm, sizeof(EDCA_PARM)); + if (!ADHOC_ON(pAd)) + { + DBGPRINT(RT_DEBUG_TRACE,("EDCA [#%d]: AIFSN CWmin CWmax TXOP(us) ACM\n", pEdcaParm->EdcaUpdateCount)); + DBGPRINT(RT_DEBUG_TRACE,(" AC_BE %2d %2d %2d %4d %d\n", + pEdcaParm->Aifsn[0], + pEdcaParm->Cwmin[0], + pEdcaParm->Cwmax[0], + pEdcaParm->Txop[0]<<5, + pEdcaParm->bACM[0])); + DBGPRINT(RT_DEBUG_TRACE,(" AC_BK %2d %2d %2d %4d %d\n", + pEdcaParm->Aifsn[1], + pEdcaParm->Cwmin[1], + pEdcaParm->Cwmax[1], + pEdcaParm->Txop[1]<<5, + pEdcaParm->bACM[1])); + DBGPRINT(RT_DEBUG_TRACE,(" AC_VI %2d %2d %2d %4d %d\n", + pEdcaParm->Aifsn[2], + pEdcaParm->Cwmin[2], + pEdcaParm->Cwmax[2], + pEdcaParm->Txop[2]<<5, + pEdcaParm->bACM[2])); + DBGPRINT(RT_DEBUG_TRACE,(" AC_VO %2d %2d %2d %4d %d\n", + pEdcaParm->Aifsn[3], + pEdcaParm->Cwmin[3], + pEdcaParm->Cwmax[3], + pEdcaParm->Txop[3]<<5, + pEdcaParm->bACM[3])); + } + } + +} + +/* + ========================================================================== + Description: + + IRQL = PASSIVE_LEVEL + IRQL = DISPATCH_LEVEL + + ========================================================================== + */ +VOID AsicSetSlotTime( + IN PRTMP_ADAPTER pAd, + IN BOOLEAN bUseShortSlotTime) +{ + ULONG SlotTime; + UINT32 RegValue = 0; + + if (pAd->CommonCfg.Channel > 14) + bUseShortSlotTime = TRUE; + + if (bUseShortSlotTime && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED)) + return; + else if ((!bUseShortSlotTime) && (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED))) + return; + + if (bUseShortSlotTime) + OPSTATUS_SET_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED); + else + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED); + + SlotTime = (bUseShortSlotTime)? 9 : 20; + + { + // force using short SLOT time for FAE to demo performance when TxBurst is ON + if (((pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) && (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED))) + || ((pAd->StaActive.SupportedPhyInfo.bHtEnable == TRUE) && (pAd->CommonCfg.BACapability.field.Policy == BA_NOTUSE)) + ) + { + // In this case, we will think it is doing Wi-Fi test + // And we will not set to short slot when bEnableTxBurst is TRUE. + } + else if (pAd->CommonCfg.bEnableTxBurst) + { + OPSTATUS_SET_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED); + SlotTime = 9; + } + } + + // + // For some reasons, always set it to short slot time. + // + // ToDo: Should consider capability with 11B + // + { + if (pAd->StaCfg.BssType == BSS_ADHOC) + { + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED); + SlotTime = 20; + } + } + + RTMP_IO_READ32(pAd, BKOFF_SLOT_CFG, &RegValue); + RegValue = RegValue & 0xFFFFFF00; + + RegValue |= SlotTime; + + RTMP_IO_WRITE32(pAd, BKOFF_SLOT_CFG, RegValue); +} + +/* + ======================================================================== + Description: + Add Shared key information into ASIC. + Update shared key, TxMic and RxMic to Asic Shared key table + Update its cipherAlg to Asic Shared key Mode. + + Return: + ======================================================================== +*/ +VOID AsicAddSharedKeyEntry( + IN PRTMP_ADAPTER pAd, + IN UCHAR BssIndex, + IN UCHAR KeyIdx, + IN UCHAR CipherAlg, + IN PUCHAR pKey, + IN PUCHAR pTxMic, + IN PUCHAR pRxMic) +{ + ULONG offset; //, csr0; + SHAREDKEY_MODE_STRUC csr1; +#ifdef RTMP_MAC_PCI + INT i; +#endif // RTMP_MAC_PCI // + + DBGPRINT(RT_DEBUG_TRACE, ("AsicAddSharedKeyEntry BssIndex=%d, KeyIdx=%d\n", BssIndex,KeyIdx)); +//============================================================================================ + + DBGPRINT(RT_DEBUG_TRACE,("AsicAddSharedKeyEntry: %s key #%d\n", CipherName[CipherAlg], BssIndex*4 + KeyIdx)); + DBGPRINT_RAW(RT_DEBUG_TRACE, (" Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", + pKey[0],pKey[1],pKey[2],pKey[3],pKey[4],pKey[5],pKey[6],pKey[7],pKey[8],pKey[9],pKey[10],pKey[11],pKey[12],pKey[13],pKey[14],pKey[15])); + if (pRxMic) + { + DBGPRINT_RAW(RT_DEBUG_TRACE, (" Rx MIC Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", + pRxMic[0],pRxMic[1],pRxMic[2],pRxMic[3],pRxMic[4],pRxMic[5],pRxMic[6],pRxMic[7])); + } + if (pTxMic) + { + DBGPRINT_RAW(RT_DEBUG_TRACE, (" Tx MIC Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", + pTxMic[0],pTxMic[1],pTxMic[2],pTxMic[3],pTxMic[4],pTxMic[5],pTxMic[6],pTxMic[7])); + } +//============================================================================================ + // + // fill key material - key + TX MIC + RX MIC + // +#ifdef RTMP_MAC_PCI + offset = SHARED_KEY_TABLE_BASE + (4*BssIndex + KeyIdx)*HW_KEY_ENTRY_SIZE; + for (i=0; iKey; +// ULONG KeyLen = pCipherKey->KeyLen; + PUCHAR pTxMic = pCipherKey->TxMic; + PUCHAR pRxMic = pCipherKey->RxMic; + PUCHAR pTxtsc = pCipherKey->TxTsc; + UCHAR CipherAlg = pCipherKey->CipherAlg; + SHAREDKEY_MODE_STRUC csr1; +#ifdef RTMP_MAC_PCI + UCHAR i; +#endif // RTMP_MAC_PCI // + +// ASSERT(KeyLen <= MAX_LEN_OF_PEER_KEY); + + DBGPRINT(RT_DEBUG_TRACE, ("==> AsicAddKeyEntry\n")); + // + // 1.) decide key table offset + // + if (bUsePairewiseKeyTable) + offset = PAIRWISE_KEY_TABLE_BASE + (WCID * HW_KEY_ENTRY_SIZE); + else + offset = SHARED_KEY_TABLE_BASE + (4 * BssIndex + KeyIdx) * HW_KEY_ENTRY_SIZE; + + // + // 2.) Set Key to Asic + // + //for (i = 0; i < KeyLen; i++) +#ifdef RTMP_MAC_PCI + for (i = 0; i < MAX_LEN_OF_PEER_KEY; i++) + { + RTMP_IO_WRITE8(pAd, offset + i, pKey[i]); + } + offset += MAX_LEN_OF_PEER_KEY; + + // + // 3.) Set MIC key if available + // + if (pTxMic) + { + for (i = 0; i < 8; i++) + { + RTMP_IO_WRITE8(pAd, offset + i, pTxMic[i]); + } + } + offset += LEN_TKIP_TXMICK; + + if (pRxMic) + { + for (i = 0; i < 8; i++) + { + RTMP_IO_WRITE8(pAd, offset + i, pRxMic[i]); + } + } +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB + RTUSBMultiWrite(pAd, offset, pKey, MAX_LEN_OF_PEER_KEY); + offset += MAX_LEN_OF_PEER_KEY; + + // + // 3.) Set MIC key if available + // + if (pTxMic) + { + RTUSBMultiWrite(pAd, offset, pTxMic, 8); + } + offset += LEN_TKIP_TXMICK; + + if (pRxMic) + { + RTUSBMultiWrite(pAd, offset, pRxMic, 8); + } +#endif // RTMP_MAC_USB // + + // + // 4.) Modify IV/EIV if needs + // This will force Asic to use this key ID by setting IV. + // + if (bTxKey) + { +#ifdef RTMP_MAC_PCI + offset = MAC_IVEIV_TABLE_BASE + (WCID * HW_IVEIV_ENTRY_SIZE); + // + // Write IV + // + RTMP_IO_WRITE8(pAd, offset, pTxtsc[1]); + RTMP_IO_WRITE8(pAd, offset + 1, ((pTxtsc[1] | 0x20) & 0x7f)); + RTMP_IO_WRITE8(pAd, offset + 2, pTxtsc[0]); + + IV4 = (KeyIdx << 6); + if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) ||(CipherAlg == CIPHER_AES)) + IV4 |= 0x20; // turn on extension bit means EIV existence + + RTMP_IO_WRITE8(pAd, offset + 3, IV4); + + // + // Write EIV + // + offset += 4; + for (i = 0; i < 4; i++) + { + RTMP_IO_WRITE8(pAd, offset + i, pTxtsc[i + 2]); + } +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB + UINT32 tmpVal; + + // + // Write IV + // + IV4 = (KeyIdx << 6); + if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) ||(CipherAlg == CIPHER_AES)) + IV4 |= 0x20; // turn on extension bit means EIV existence + + tmpVal = pTxtsc[1] + (((pTxtsc[1] | 0x20) & 0x7f) << 8) + (pTxtsc[0] << 16) + (IV4 << 24); + RTMP_IO_WRITE32(pAd, offset, tmpVal); + + // + // Write EIV + // + offset += 4; + RTMP_IO_WRITE32(pAd, offset, *(PUINT32)&pCipherKey->TxTsc[2]); +#endif // RTMP_MAC_USB // + + AsicUpdateWCIDAttribute(pAd, WCID, BssIndex, CipherAlg, bUsePairewiseKeyTable); + } + + if (!bUsePairewiseKeyTable) + { + // + // Only update the shared key security mode + // + RTMP_IO_READ32(pAd, SHARED_KEY_MODE_BASE + 4 * (BssIndex / 2), &csr1.word); + if ((BssIndex % 2) == 0) + { + if (KeyIdx == 0) + csr1.field.Bss0Key0CipherAlg = CipherAlg; + else if (KeyIdx == 1) + csr1.field.Bss0Key1CipherAlg = CipherAlg; + else if (KeyIdx == 2) + csr1.field.Bss0Key2CipherAlg = CipherAlg; + else + csr1.field.Bss0Key3CipherAlg = CipherAlg; + } + else + { + if (KeyIdx == 0) + csr1.field.Bss1Key0CipherAlg = CipherAlg; + else if (KeyIdx == 1) + csr1.field.Bss1Key1CipherAlg = CipherAlg; + else if (KeyIdx == 2) + csr1.field.Bss1Key2CipherAlg = CipherAlg; + else + csr1.field.Bss1Key3CipherAlg = CipherAlg; + } + RTMP_IO_WRITE32(pAd, SHARED_KEY_MODE_BASE + 4 * (BssIndex / 2), csr1.word); + } + + DBGPRINT(RT_DEBUG_TRACE, ("<== AsicAddKeyEntry\n")); +} + + +/* + ======================================================================== + Description: + Add Pair-wise key material into ASIC. + Update pairwise key, TxMic and RxMic to Asic Pair-wise key table + + Return: + ======================================================================== +*/ +VOID AsicAddPairwiseKeyEntry( + IN PRTMP_ADAPTER pAd, + IN PUCHAR pAddr, + IN UCHAR WCID, + IN CIPHER_KEY *pCipherKey) +{ + INT i; + ULONG offset; + PUCHAR pKey = pCipherKey->Key; + PUCHAR pTxMic = pCipherKey->TxMic; + PUCHAR pRxMic = pCipherKey->RxMic; +#ifdef DBG + UCHAR CipherAlg = pCipherKey->CipherAlg; +#endif // DBG // + + // EKEY + offset = PAIRWISE_KEY_TABLE_BASE + (WCID * HW_KEY_ENTRY_SIZE); +#ifdef RTMP_MAC_PCI + for (i=0; iKey[0], MAX_LEN_OF_PEER_KEY); +#endif // RTMP_MAC_USB // + for (i=0; iTxMic[0], 8); +#endif // RTMP_MAC_USB // + } + offset += 8; + if (pRxMic) + { +#ifdef RTMP_MAC_PCI + for (i=0; i<8; i++) + { + RTMP_IO_WRITE8(pAd, offset+i, pRxMic[i]); + } +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB + RTUSBMultiWrite(pAd, offset, &pCipherKey->RxMic[0], 8); +#endif // RTMP_MAC_USB // + } + + DBGPRINT(RT_DEBUG_TRACE,("AsicAddPairwiseKeyEntry: WCID #%d Alg=%s\n",WCID, CipherName[CipherAlg])); + DBGPRINT(RT_DEBUG_TRACE,(" Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", + pKey[0],pKey[1],pKey[2],pKey[3],pKey[4],pKey[5],pKey[6],pKey[7],pKey[8],pKey[9],pKey[10],pKey[11],pKey[12],pKey[13],pKey[14],pKey[15])); + if (pRxMic) + { + DBGPRINT(RT_DEBUG_TRACE, (" Rx MIC Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", + pRxMic[0],pRxMic[1],pRxMic[2],pRxMic[3],pRxMic[4],pRxMic[5],pRxMic[6],pRxMic[7])); + } + if (pTxMic) + { + DBGPRINT(RT_DEBUG_TRACE, (" Tx MIC Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", + pTxMic[0],pTxMic[1],pTxMic[2],pTxMic[3],pTxMic[4],pTxMic[5],pTxMic[6],pTxMic[7])); + } +} +/* + ======================================================================== + Description: + Remove Pair-wise key material from ASIC. + + Return: + ======================================================================== +*/ +VOID AsicRemovePairwiseKeyEntry( + IN PRTMP_ADAPTER pAd, + IN UCHAR BssIdx, + IN UCHAR Wcid) +{ + ULONG WCIDAttri; + USHORT offset; + + // re-set the entry's WCID attribute as OPEN-NONE. + offset = MAC_WCID_ATTRIBUTE_BASE + (Wcid * HW_WCID_ATTRI_SIZE); + WCIDAttri = (BssIdx<<4) | PAIRWISEKEYTABLE; + RTMP_IO_WRITE32(pAd, offset, WCIDAttri); +} + +BOOLEAN AsicSendCommandToMcu( + IN PRTMP_ADAPTER pAd, + IN UCHAR Command, + IN UCHAR Token, + IN UCHAR Arg0, + IN UCHAR Arg1) +{ + + if (pAd->chipOps.sendCommandToMcu) + pAd->chipOps.sendCommandToMcu(pAd, Command, Token, Arg0, Arg1); + + return TRUE; +} + + +VOID AsicSetRxAnt( + IN PRTMP_ADAPTER pAd, + IN UCHAR Ant) +{ +#ifdef RT30xx + /* RT3572 ATE need not to do this. */ + RT30xxSetRxAnt(pAd, Ant); +#endif // RT30xx // +} + + +VOID AsicTurnOffRFClk( + IN PRTMP_ADAPTER pAd, + IN UCHAR Channel) +{ + if (pAd->chipOps.AsicRfTurnOff) + { + pAd->chipOps.AsicRfTurnOff(pAd); + } + else + { + // RF R2 bit 18 = 0 + UINT32 R1 = 0, R2 = 0, R3 = 0; + UCHAR index; + RTMP_RF_REGS *RFRegTable; + + RFRegTable = RF2850RegTable; + + switch (pAd->RfIcType) + { + case RFIC_2820: + case RFIC_2850: + case RFIC_2720: + case RFIC_2750: + + for (index = 0; index < NUM_OF_2850_CHNL; index++) + { + if (Channel == RFRegTable[index].Channel) + { + R1 = RFRegTable[index].R1 & 0xffffdfff; + R2 = RFRegTable[index].R2 & 0xfffbffff; + R3 = RFRegTable[index].R3 & 0xfff3ffff; + + RTMP_RF_IO_WRITE32(pAd, R1); + RTMP_RF_IO_WRITE32(pAd, R2); + + // Program R1b13 to 1, R3/b18,19 to 0, R2b18 to 0. + // Set RF R2 bit18=0, R3 bit[18:19]=0 + //if (pAd->StaCfg.bRadio == FALSE) + if (1) + { + RTMP_RF_IO_WRITE32(pAd, R3); + + DBGPRINT(RT_DEBUG_TRACE, ("AsicTurnOffRFClk#%d(RF=%d, ) , R2=0x%08x, R3 = 0x%08x \n", + Channel, pAd->RfIcType, R2, R3)); + } + else + DBGPRINT(RT_DEBUG_TRACE, ("AsicTurnOffRFClk#%d(RF=%d, ) , R2=0x%08x \n", + Channel, pAd->RfIcType, R2)); + break; + } + } + break; + + default: + break; + } + } +} + + +VOID AsicTurnOnRFClk( + IN PRTMP_ADAPTER pAd, + IN UCHAR Channel) +{ + // RF R2 bit 18 = 0 + UINT32 R1 = 0, R2 = 0, R3 = 0; + UCHAR index; + RTMP_RF_REGS *RFRegTable; + + + RFRegTable = RF2850RegTable; + + switch (pAd->RfIcType) + { + case RFIC_2820: + case RFIC_2850: + case RFIC_2720: + case RFIC_2750: + + for (index = 0; index < NUM_OF_2850_CHNL; index++) + { + if (Channel == RFRegTable[index].Channel) + { + R3 = pAd->LatchRfRegs.R3; + R3 &= 0xfff3ffff; + R3 |= 0x00080000; + RTMP_RF_IO_WRITE32(pAd, R3); + + R1 = RFRegTable[index].R1; + RTMP_RF_IO_WRITE32(pAd, R1); + + R2 = RFRegTable[index].R2; + if (pAd->Antenna.field.TxPath == 1) + { + R2 |= 0x4000; // If TXpath is 1, bit 14 = 1; + } + + if (pAd->Antenna.field.RxPath == 2) + { + R2 |= 0x40; // write 1 to off Rxpath. + } + else if (pAd->Antenna.field.RxPath == 1) + { + R2 |= 0x20040; // write 1 to off RxPath + } + RTMP_RF_IO_WRITE32(pAd, R2); + + break; + } + } + break; + + default: + break; + } + + DBGPRINT(RT_DEBUG_TRACE, ("AsicTurnOnRFClk#%d(RF=%d, ) , R2=0x%08x\n", + Channel, + pAd->RfIcType, + R2)); +} diff --git a/drivers/staging/rt2860/common/cmm_cfg.c b/drivers/staging/rt2860/common/cmm_cfg.c new file mode 100644 index 000000000000..c1cf2bf4680d --- /dev/null +++ b/drivers/staging/rt2860/common/cmm_cfg.c @@ -0,0 +1,290 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + cmm_cfg.c + + Abstract: + Ralink WiFi Driver configuration related subroutines + + Revision History: + Who When What + --------- ---------- ---------------------------------------------- +*/ + + + +#include "../rt_config.h" + + +char* GetPhyMode( + int Mode) +{ + switch(Mode) + { + case MODE_CCK: + return "CCK"; + + case MODE_OFDM: + return "OFDM"; + case MODE_HTMIX: + return "HTMIX"; + + case MODE_HTGREENFIELD: + return "GREEN"; + default: + return "N/A"; + } +} + + +char* GetBW( + int BW) +{ + switch(BW) + { + case BW_10: + return "10M"; + + case BW_20: + return "20M"; + case BW_40: + return "40M"; + default: + return "N/A"; + } +} + + +/* + ========================================================================== + Description: + Set Country Region to pAd->CommonCfg.CountryRegion. + This command will not work, if the field of CountryRegion in eeprom is programmed. + + Return: + TRUE if all parameters are OK, FALSE otherwise + ========================================================================== +*/ +INT RT_CfgSetCountryRegion( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg, + IN INT band) +{ + LONG region, regionMax; + UCHAR *pCountryRegion; + + region = simple_strtol(arg, 0, 10); + + if (band == BAND_24G) + { + pCountryRegion = &pAd->CommonCfg.CountryRegion; + regionMax = REGION_MAXIMUM_BG_BAND; + } + else + { + pCountryRegion = &pAd->CommonCfg.CountryRegionForABand; + regionMax = REGION_MAXIMUM_A_BAND; + } + + // TODO: Is it neccesay for following check??? + // Country can be set only when EEPROM not programmed + if (*pCountryRegion & 0x80) + { + DBGPRINT(RT_DEBUG_ERROR, ("CfgSetCountryRegion():CountryRegion in eeprom was programmed\n")); + return FALSE; + } + + if((region >= 0) && (region <= REGION_MAXIMUM_BG_BAND)) + { + *pCountryRegion= (UCHAR) region; + } + else if ((region == REGION_31_BG_BAND) && (band == BAND_24G)) + { + *pCountryRegion = (UCHAR) region; + } + else + { + DBGPRINT(RT_DEBUG_ERROR, ("CfgSetCountryRegion():region(%ld) out of range!\n", region)); + return FALSE; + } + + return TRUE; + +} + + +/* + ========================================================================== + Description: + Set Wireless Mode + Return: + TRUE if all parameters are OK, FALSE otherwise + ========================================================================== +*/ +INT RT_CfgSetWirelessMode( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg) +{ + INT MaxPhyMode = PHY_11G; + LONG WirelessMode; + + MaxPhyMode = PHY_11N_5G; + + WirelessMode = simple_strtol(arg, 0, 10); + if (WirelessMode <= MaxPhyMode) + { + pAd->CommonCfg.PhyMode = WirelessMode; + return TRUE; + } + + return FALSE; + +} + + +INT RT_CfgSetShortSlot( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg) +{ + LONG ShortSlot; + + ShortSlot = simple_strtol(arg, 0, 10); + + if (ShortSlot == 1) + pAd->CommonCfg.bUseShortSlotTime = TRUE; + else if (ShortSlot == 0) + pAd->CommonCfg.bUseShortSlotTime = FALSE; + else + return FALSE; //Invalid argument + + return TRUE; +} + + +/* + ========================================================================== + Description: + Set WEP KEY base on KeyIdx + Return: + TRUE if all parameters are OK, FALSE otherwise + ========================================================================== +*/ +INT RT_CfgSetWepKey( + IN PRTMP_ADAPTER pAd, + IN PSTRING keyString, + IN CIPHER_KEY *pSharedKey, + IN INT keyIdx) +{ + INT KeyLen; + INT i; + UCHAR CipherAlg = CIPHER_NONE; + BOOLEAN bKeyIsHex = FALSE; + + // TODO: Shall we do memset for the original key info?? + memset(pSharedKey, 0, sizeof(CIPHER_KEY)); + KeyLen = strlen(keyString); + switch (KeyLen) + { + case 5: //wep 40 Ascii type + case 13: //wep 104 Ascii type + bKeyIsHex = FALSE; + pSharedKey->KeyLen = KeyLen; + NdisMoveMemory(pSharedKey->Key, keyString, KeyLen); + break; + + case 10: //wep 40 Hex type + case 26: //wep 104 Hex type + for(i=0; i < KeyLen; i++) + { + if( !isxdigit(*(keyString+i)) ) + return FALSE; //Not Hex value; + } + bKeyIsHex = TRUE; + pSharedKey->KeyLen = KeyLen/2 ; + AtoH(keyString, pSharedKey->Key, pSharedKey->KeyLen); + break; + + default: //Invalid argument + DBGPRINT(RT_DEBUG_TRACE, ("RT_CfgSetWepKey(keyIdx=%d):Invalid argument (arg=%s)\n", keyIdx, keyString)); + return FALSE; + } + + pSharedKey->CipherAlg = ((KeyLen % 5) ? CIPHER_WEP128 : CIPHER_WEP64); + DBGPRINT(RT_DEBUG_TRACE, ("RT_CfgSetWepKey:(KeyIdx=%d,type=%s, Alg=%s)\n", + keyIdx, (bKeyIsHex == FALSE ? "Ascii" : "Hex"), CipherName[CipherAlg])); + + return TRUE; +} + + +/* + ========================================================================== + Description: + Set WPA PSK key + + Arguments: + pAdapter Pointer to our adapter + keyString WPA pre-shared key string + pHashStr String used for password hash function + hashStrLen Lenght of the hash string + pPMKBuf Output buffer of WPAPSK key + + Return: + TRUE if all parameters are OK, FALSE otherwise + ========================================================================== +*/ +INT RT_CfgSetWPAPSKKey( + IN RTMP_ADAPTER *pAd, + IN PSTRING keyString, + IN UCHAR *pHashStr, + IN INT hashStrLen, + OUT PUCHAR pPMKBuf) +{ + int keyLen; + UCHAR keyMaterial[40]; + + keyLen = strlen(keyString); + if ((keyLen < 8) || (keyLen > 64)) + { + DBGPRINT(RT_DEBUG_TRACE, ("WPAPSK Key length(%d) error, required 8 ~ 64 characters!(keyStr=%s)\n", + keyLen, keyString)); + return FALSE; + } + + memset(pPMKBuf, 0, 32); + if (keyLen == 64) + { + AtoH(keyString, pPMKBuf, 32); + } + else + { + PasswordHash(keyString, pHashStr, hashStrLen, keyMaterial); + NdisMoveMemory(pPMKBuf, keyMaterial, 32); + } + + return TRUE; +} diff --git a/drivers/staging/rt2860/common/cmm_data.c b/drivers/staging/rt2860/common/cmm_data.c index 774fabb0be40..36969134696b 100644 --- a/drivers/staging/rt2860/common/cmm_data.c +++ b/drivers/staging/rt2860/common/cmm_data.c @@ -25,9 +25,8 @@ ************************************************************************* */ -#include "../rt_config.h" -#define MAX_TX_IN_TBTT (16) +#include "../rt_config.h" UCHAR SNAP_802_1H[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; @@ -67,6 +66,7 @@ UCHAR RxwiMCSToOfdmRate[12] = { char* MCSToMbps[] = {"1Mbps","2Mbps","5.5Mbps","11Mbps","06Mbps","09Mbps","12Mbps","18Mbps","24Mbps","36Mbps","48Mbps","54Mbps","MM-0","MM-1","MM-2","MM-3","MM-4","MM-5","MM-6","MM-7","MM-8","MM-9","MM-10","MM-11","MM-12","MM-13","MM-14","MM-15","MM-32","ee1","ee2","ee3"}; UCHAR default_cwmin[]={CW_MIN_IN_BITS, CW_MIN_IN_BITS, CW_MIN_IN_BITS-1, CW_MIN_IN_BITS-2}; +//UCHAR default_cwmax[]={CW_MAX_IN_BITS, CW_MAX_IN_BITS, CW_MIN_IN_BITS, CW_MIN_IN_BITS-1}; UCHAR default_sta_aifsn[]={3,7,2,2}; UCHAR MapUserPriorityToAccessCategory[8] = {QID_AC_BE, QID_AC_BK, QID_AC_BK, QID_AC_BE, QID_AC_VI, QID_AC_VI, QID_AC_VO, QID_AC_VO}; @@ -105,28 +105,38 @@ NDIS_STATUS MiniportMMRequest( PNDIS_PACKET pPacket; NDIS_STATUS Status = NDIS_STATUS_SUCCESS; ULONG FreeNum; -#ifdef RT2860 + UCHAR rtmpHwHdr[TXINFO_SIZE + TXWI_SIZE]; //RTMP_HW_HDR_LEN]; +#ifdef RTMP_MAC_PCI unsigned long IrqFlags = 0; -#endif UCHAR IrqState; - UCHAR rtmpHwHdr[TXINFO_SIZE + TXWI_SIZE]; //RTMP_HW_HDR_LEN]; +#endif // RTMP_MAC_PCI // + BOOLEAN bUseDataQ = FALSE; + int retryCnt = 0; ASSERT(Length <= MGMT_DMA_BUFFER_SIZE); - QueIdx=3; + if ((QueIdx & MGMT_USE_QUEUE_FLAG) == MGMT_USE_QUEUE_FLAG) + { + bUseDataQ = TRUE; + QueIdx &= (~MGMT_USE_QUEUE_FLAG); + } +#ifdef RTMP_MAC_PCI // 2860C use Tx Ring - IrqState = pAd->irq_disabled; - -#ifdef RT2860 - if ((pAd->MACVersion == 0x28600100) && (!IrqState)) + if (pAd->MACVersion == 0x28600100) + { + QueIdx = (bUseDataQ ==TRUE ? QueIdx : 3); + bUseDataQ = TRUE; + } + if (bUseDataQ && (!IrqState)) RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); -#endif +#endif // RTMP_MAC_PCI // + do { // Reset is in progress, stop immediately - if ( RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS) || + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS) || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)|| !RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_START_UP)) { @@ -136,13 +146,16 @@ NDIS_STATUS MiniportMMRequest( // Check Free priority queue // Since we use PBF Queue2 for management frame. Its corresponding DMA ring should be using TxRing. - - // 2860C use Tx Ring - if (pAd->MACVersion == 0x28600100) +#ifdef RTMP_MAC_PCI + if (bUseDataQ) { + retryCnt = MAX_DATAMM_RETRY; + // free Tx(QueIdx) resources + RTMPFreeTXDUponTxDmaDone(pAd, QueIdx); FreeNum = GET_TXRING_FREENO(pAd, QueIdx); } else +#endif // RTMP_MAC_PCI // { FreeNum = GET_MGMTRING_FREENO(pAd); } @@ -162,96 +175,51 @@ NDIS_STATUS MiniportMMRequest( //pAd->CommonCfg.MlmeRate = RATE_2; +#ifdef RTMP_MAC_PCI + if (bUseDataQ) + { + Status = MlmeDataHardTransmit(pAd, QueIdx, pPacket); + retryCnt--; + } + else +#endif // RTMP_MAC_PCI // Status = MlmeHardTransmit(pAd, QueIdx, pPacket); - if (Status != NDIS_STATUS_SUCCESS) + if (Status == NDIS_STATUS_SUCCESS) + retryCnt = 0; + else RTMPFreeNdisPacket(pAd, pPacket); } else { pAd->RalinkCounters.MgmtRingFullCount++; +#ifdef RTMP_MAC_PCI + if (bUseDataQ) + { + retryCnt--; + DBGPRINT(RT_DEBUG_TRACE, ("retryCnt %d\n", retryCnt)); + if (retryCnt == 0) + { + DBGPRINT(RT_DEBUG_ERROR, ("Qidx(%d), not enough space in DataRing, MgmtRingFullCount=%ld!\n", + QueIdx, pAd->RalinkCounters.MgmtRingFullCount)); + } + } +#endif // RTMP_MAC_PCI // DBGPRINT(RT_DEBUG_ERROR, ("Qidx(%d), not enough space in MgmtRing, MgmtRingFullCount=%ld!\n", QueIdx, pAd->RalinkCounters.MgmtRingFullCount)); } + } while (retryCnt > 0); - } while (FALSE); -#ifdef RT2860 - // 2860C use Tx Ring - if ((pAd->MACVersion == 0x28600100) && (!IrqState)) +#ifdef RTMP_MAC_PCI + if (bUseDataQ && (!IrqState)) RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); -#endif +#endif // RTMP_MAC_PCI // + return Status; } -#ifdef RT2860 -NDIS_STATUS MiniportMMRequestUnlock( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PUCHAR pData, - IN UINT Length) -{ - PNDIS_PACKET pPacket; - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - ULONG FreeNum; - TXWI_STRUC TXWI; - ULONG SW_TX_IDX; - PTXD_STRUC pTxD; - - QueIdx = 3; - ASSERT(Length <= MGMT_DMA_BUFFER_SIZE); - - do - { - // Reset is in progress, stop immediately - if ( RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)|| - !RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_START_UP)) - { - Status = NDIS_STATUS_FAILURE; - break; - } - - // Check Free priority queue - // Since we use PBF Queue2 for management frame. Its corresponding DMA ring should be using TxRing. - // 2860C use Tx Ring - if (pAd->MACVersion == 0x28600100) - { - FreeNum = GET_TXRING_FREENO(pAd, QueIdx); - SW_TX_IDX = pAd->TxRing[QueIdx].TxCpuIdx; - pTxD = (PTXD_STRUC) pAd->TxRing[QueIdx].Cell[SW_TX_IDX].AllocVa; - } - else - { - FreeNum = GET_MGMTRING_FREENO(pAd); - SW_TX_IDX = pAd->MgmtRing.TxCpuIdx; - pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[SW_TX_IDX].AllocVa; - } - if ((FreeNum > 0)) - { - NdisZeroMemory(&TXWI, TXWI_SIZE); - Status = RTMPAllocateNdisPacket(pAd, &pPacket, (PUCHAR)&TXWI, TXWI_SIZE, pData, Length); - if (Status != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_WARN, ("MiniportMMRequest (error:: can't allocate NDIS PACKET)\n")); - break; - } - - Status = MlmeHardTransmit(pAd, QueIdx, pPacket); - if (Status != NDIS_STATUS_SUCCESS) - RTMPFreeNdisPacket(pAd, pPacket); - } - else - { - pAd->RalinkCounters.MgmtRingFullCount++; - DBGPRINT(RT_DEBUG_ERROR, ("Qidx(%d), not enough space in MgmtRing\n", QueIdx)); - } - - } while (FALSE); - return Status; -} -#endif /* ======================================================================== @@ -281,204 +249,34 @@ NDIS_STATUS MlmeHardTransmit( IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx, IN PNDIS_PACKET pPacket) -{ - if (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) - { - return NDIS_STATUS_FAILURE; - } - -#ifdef RT2860 - if ( pAd->MACVersion == 0x28600100 ) - return MlmeHardTransmitTxRing(pAd,QueIdx,pPacket); - else -#endif - return MlmeHardTransmitMgmtRing(pAd,QueIdx,pPacket); - -} - -#ifdef RT2860 -NDIS_STATUS MlmeHardTransmitTxRing( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket) { PACKET_INFO PacketInfo; PUCHAR pSrcBufVA; UINT SrcBufLen; - PTXD_STRUC pTxD; PHEADER_802_11 pHeader_802_11; - BOOLEAN bAckRequired, bInsertTimestamp; - ULONG SrcBufPA; - UCHAR MlmeRate; - ULONG SwIdx = pAd->TxRing[QueIdx].TxCpuIdx; - PTXWI_STRUC pFirstTxWI; - ULONG FreeNum; - MAC_TABLE_ENTRY *pMacEntry = NULL; - - RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); - - if (pSrcBufVA == NULL) - { - // The buffer shouldn't be NULL - return NDIS_STATUS_FAILURE; - } - - // Make sure MGMT ring resource won't be used by other threads - //NdisAcquireSpinLock(&pAd->TxRingLock); - - FreeNum = GET_TXRING_FREENO(pAd, QueIdx); - - if (FreeNum == 0) + if ((pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) + ) { - //NdisReleaseSpinLock(&pAd->TxRingLock); return NDIS_STATUS_FAILURE; } - SwIdx = pAd->TxRing[QueIdx].TxCpuIdx; - - pTxD = (PTXD_STRUC) pAd->TxRing[QueIdx].Cell[SwIdx].AllocVa; - - if (pAd->TxRing[QueIdx].Cell[SwIdx].pNdisPacket) - { - printk("MlmeHardTransmit Error\n"); + RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); + if (pSrcBufVA == NULL) return NDIS_STATUS_FAILURE; - } - // outgoing frame always wakeup PHY to prevent frame lost - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - AsicForceWakeup(pAd, FROM_TX); + pHeader_802_11 = (PHEADER_802_11) (pSrcBufVA + TXINFO_SIZE + TXWI_SIZE); - pFirstTxWI =(PTXWI_STRUC)pSrcBufVA; - pHeader_802_11 = (PHEADER_802_11) (pSrcBufVA + TXWI_SIZE); - if (pHeader_802_11->Addr1[0] & 0x01) - { - MlmeRate = pAd->CommonCfg.BasicMlmeRate; - } - else - { - MlmeRate = pAd->CommonCfg.MlmeRate; - } - - if ((pHeader_802_11->FC.Type == BTYPE_DATA) && - (pHeader_802_11->FC.SubType == SUBTYPE_QOS_NULL)) - { - pMacEntry = MacTableLookup(pAd, pHeader_802_11->Addr1); - } - - // Verify Mlme rate for a / g bands. - if ((pAd->LatchRfRegs.Channel > 14) && (MlmeRate < RATE_6)) // 11A band - MlmeRate = RATE_6; - - // - // Should not be hard code to set PwrMgmt to 0 (PWR_ACTIVE) - // Snice it's been set to 0 while on MgtMacHeaderInit - // By the way this will cause frame to be send on PWR_SAVE failed. - // - // - // In WMM-UAPSD, mlme frame should be set psm as power saving but probe request frame - - // Data-Null packets alse pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD - if (pHeader_802_11->FC.Type != BTYPE_DATA) - { - if ((pHeader_802_11->FC.SubType == SUBTYPE_PROBE_REQ) || !(pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable)) - { - pHeader_802_11->FC.PwrMgmt = PWR_ACTIVE; - } - else - { - pHeader_802_11->FC.PwrMgmt = pAd->CommonCfg.bAPSDForcePowerSave; - } - } - - bInsertTimestamp = FALSE; - if (pHeader_802_11->FC.Type == BTYPE_CNTL) // must be PS-POLL - { - bAckRequired = FALSE; - } - else // BTYPE_MGMT or BTYPE_DATA(must be NULL frame) - { - if (pHeader_802_11->Addr1[0] & 0x01) // MULTICAST, BROADCAST - { - bAckRequired = FALSE; - pHeader_802_11->Duration = 0; - } - else - { - bAckRequired = TRUE; - pHeader_802_11->Duration = RTMPCalcDuration(pAd, MlmeRate, 14); - if (pHeader_802_11->FC.SubType == SUBTYPE_PROBE_RSP) - { - bInsertTimestamp = TRUE; - } - } - } - pHeader_802_11->Sequence = pAd->Sequence++; - if (pAd->Sequence > 0xfff) - pAd->Sequence = 0; - // Before radar detection done, mgmt frame can not be sent but probe req - // Because we need to use probe req to trigger driver to send probe req in passive scan - if ((pHeader_802_11->FC.SubType != SUBTYPE_PROBE_REQ) - && (pAd->CommonCfg.bIEEE80211H == 1) - && (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE)) - { - DBGPRINT(RT_DEBUG_ERROR,("MlmeHardTransmit --> radar detect not in normal mode !!!\n")); - return (NDIS_STATUS_FAILURE); - } - - // - // fill scatter-and-gather buffer list into TXD. Internally created NDIS PACKET - // should always has only one ohysical buffer, and the whole frame size equals - // to the first scatter buffer size - // - - // Initialize TX Descriptor - // For inter-frame gap, the number is for this frame and next frame - // For MLME rate, we will fix as 2Mb to match other vendor's implement - -// management frame doesn't need encryption. so use RESERVED_WCID no matter u are sending to specific wcid or not. - // Only beacon use Nseq=TRUE. So here we use Nseq=FALSE. - if (pMacEntry == NULL) - { - RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, bInsertTimestamp, FALSE, bAckRequired, FALSE, - 0, RESERVED_WCID, (SrcBufLen - TXWI_SIZE), PID_MGMT, 0, (UCHAR)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); - } +#ifdef RTMP_MAC_PCI + if ( pAd->MACVersion == 0x28600100 ) + return MlmeHardTransmitTxRing(pAd,QueIdx,pPacket); else - { - RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, - bInsertTimestamp, FALSE, bAckRequired, FALSE, - 0, pMacEntry->Aid, (SrcBufLen - TXWI_SIZE), - pMacEntry->MaxHTPhyMode.field.MCS, 0, - (UCHAR)pMacEntry->MaxHTPhyMode.field.MCS, - IFS_BACKOFF, FALSE, &pMacEntry->MaxHTPhyMode); - } - - pAd->TxRing[QueIdx].Cell[SwIdx].pNdisPacket = pPacket; - pAd->TxRing[QueIdx].Cell[SwIdx].pNextNdisPacket = NULL; - - SrcBufPA = PCI_MAP_SINGLE(pAd, pSrcBufVA, SrcBufLen, 0, PCI_DMA_TODEVICE); - - - RTMPWriteTxDescriptor(pAd, pTxD, TRUE, FIFO_EDCA); - pTxD->LastSec0 = 1; - pTxD->LastSec1 = 1; - pTxD->SDLen0 = SrcBufLen; - pTxD->SDLen1 = 0; - pTxD->SDPtr0 = SrcBufPA; - pTxD->DMADONE = 0; - - pAd->RalinkCounters.KickTxCount++; - pAd->RalinkCounters.OneSecTxDoneCount++; - - // Increase TX_CTX_IDX, but write to register later. - INC_RING_INDEX(pAd->TxRing[QueIdx].TxCpuIdx, TX_RING_SIZE); - - RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + QueIdx*0x10, pAd->TxRing[QueIdx].TxCpuIdx); +#endif // RTMP_MAC_PCI // + return MlmeHardTransmitMgmtRing(pAd,QueIdx,pPacket); - return NDIS_STATUS_SUCCESS; } -#endif /* RT2860 */ + NDIS_STATUS MlmeHardTransmitMgmtRing( IN PRTMP_ADAPTER pAd, @@ -493,25 +291,24 @@ NDIS_STATUS MlmeHardTransmitMgmtRing( UCHAR MlmeRate; PTXWI_STRUC pFirstTxWI; MAC_TABLE_ENTRY *pMacEntry = NULL; + UCHAR PID; RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); - RTMP_SEM_LOCK(&pAd->MgmtRingLock); - + // Make sure MGMT ring resource won't be used by other threads + RTMP_SEM_LOCK(&pAd->MgmtRingLock); if (pSrcBufVA == NULL) { + // The buffer shouldn't be NULL RTMP_SEM_UNLOCK(&pAd->MgmtRingLock); return NDIS_STATUS_FAILURE; } + { // outgoing frame always wakeup PHY to prevent frame lost if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) -#ifdef RT2860 - AsicForceWakeup(pAd, FROM_TX); -#endif -#ifdef RT2870 AsicForceWakeup(pAd, TRUE); -#endif + } pFirstTxWI = (PTXWI_STRUC)(pSrcBufVA + TXINFO_SIZE); pHeader_802_11 = (PHEADER_802_11) (pSrcBufVA + TXINFO_SIZE + TXWI_SIZE); //TXWI_SIZE); @@ -553,19 +350,28 @@ NDIS_STATUS MlmeHardTransmitMgmtRing( // Snice it's been set to 0 while on MgtMacHeaderInit // By the way this will cause frame to be send on PWR_SAVE failed. // - // pHeader_802_11->FC.PwrMgmt = 0; // (pAd->StaCfg.Psm == PWR_SAVE); + pHeader_802_11->FC.PwrMgmt = PWR_ACTIVE; // (pAd->StaCfg.Psm == PWR_SAVE); + // // In WMM-UAPSD, mlme frame should be set psm as power saving but probe request frame - // Data-Null packets alse pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD - if ((pHeader_802_11->FC.Type != BTYPE_DATA) && (pHeader_802_11->FC.Type != BTYPE_CNTL)) +// if ((pHeader_802_11->FC.Type != BTYPE_DATA) && (pHeader_802_11->FC.Type != BTYPE_CNTL)) { - if ((pAd->StaCfg.Psm == PWR_SAVE) && - (pHeader_802_11->FC.SubType == SUBTYPE_ACTION)) + if ((pHeader_802_11->FC.SubType == SUBTYPE_ACTION) || + ((pHeader_802_11->FC.Type == BTYPE_DATA) && + ((pHeader_802_11->FC.SubType == SUBTYPE_QOS_NULL) || + (pHeader_802_11->FC.SubType == SUBTYPE_NULL_FUNC)))) + { + if (pAd->StaCfg.Psm == PWR_SAVE) pHeader_802_11->FC.PwrMgmt = PWR_SAVE; else - pHeader_802_11->FC.PwrMgmt = PWR_ACTIVE; + pHeader_802_11->FC.PwrMgmt = pAd->CommonCfg.bAPSDForcePowerSave; } + } + + + + bInsertTimestamp = FALSE; if (pHeader_802_11->FC.Type == BTYPE_CNTL) // must be PS-POLL @@ -579,6 +385,9 @@ NDIS_STATUS MlmeHardTransmitMgmtRing( } else // BTYPE_MGMT or BTYPE_DATA(must be NULL frame) { + //pAd->Sequence++; + //pHeader_802_11->Sequence = pAd->Sequence; + if (pHeader_802_11->Addr1[0] & 0x01) // MULTICAST, BROADCAST { bAckRequired = FALSE; @@ -588,9 +397,14 @@ NDIS_STATUS MlmeHardTransmitMgmtRing( { bAckRequired = TRUE; pHeader_802_11->Duration = RTMPCalcDuration(pAd, MlmeRate, 14); - if (pHeader_802_11->FC.SubType == SUBTYPE_PROBE_RSP) + if ((pHeader_802_11->FC.SubType == SUBTYPE_PROBE_RSP) && (pHeader_802_11->FC.Type == BTYPE_MGMT)) { bInsertTimestamp = TRUE; + bAckRequired = FALSE; // Disable ACK to prevent retry 0x1f for Probe Response + } + else if ((pHeader_802_11->FC.SubType == SUBTYPE_PROBE_REQ) && (pHeader_802_11->FC.Type == BTYPE_MGMT)) + { + bAckRequired = FALSE; // Disable ACK to prevent retry 0x1f for Probe Request } } } @@ -606,28 +420,35 @@ NDIS_STATUS MlmeHardTransmitMgmtRing( && (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE)) { DBGPRINT(RT_DEBUG_ERROR,("MlmeHardTransmit --> radar detect not in normal mode !!!\n")); +// if (!IrqState) RTMP_SEM_UNLOCK(&pAd->MgmtRingLock); return (NDIS_STATUS_FAILURE); } + // // fill scatter-and-gather buffer list into TXD. Internally created NDIS PACKET - // should always has only one ohysical buffer, and the whole frame size equals + // should always has only one physical buffer, and the whole frame size equals // to the first scatter buffer size // // Initialize TX Descriptor // For inter-frame gap, the number is for this frame and next frame // For MLME rate, we will fix as 2Mb to match other vendor's implement +// pAd->CommonCfg.MlmeTransmit.field.MODE = 1; // management frame doesn't need encryption. so use RESERVED_WCID no matter u are sending to specific wcid or not. + PID = PID_MGMT; + + if (pMacEntry == NULL) { RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, bInsertTimestamp, FALSE, bAckRequired, FALSE, - 0, RESERVED_WCID, (SrcBufLen - TXINFO_SIZE - TXWI_SIZE), PID_MGMT, 0, (UCHAR)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); + 0, RESERVED_WCID, (SrcBufLen - TXINFO_SIZE - TXWI_SIZE), PID, 0, (UCHAR)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); } else { + /* dont use low rate to send QoS Null data frame */ RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, bInsertTimestamp, FALSE, bAckRequired, FALSE, 0, pMacEntry->Aid, (SrcBufLen - TXINFO_SIZE - TXWI_SIZE), @@ -640,6 +461,7 @@ NDIS_STATUS MlmeHardTransmitMgmtRing( HAL_KickOutMgmtTx(pAd, QueIdx, pPacket, pSrcBufVA, SrcBufLen); // Make sure to release MGMT ring resource +// if (!IrqState) RTMP_SEM_UNLOCK(&pAd->MgmtRingLock); return NDIS_STATUS_SUCCESS; } @@ -737,10 +559,6 @@ static UCHAR TxPktClassification( bHTRate = TRUE; if (RTMP_GET_PACKET_MOREDATA(pPacket) || (pMacEntry->PsMode == PWR_SAVE)) TxFrameType = TX_LEGACY_FRAME; -#ifdef UAPSD_AP_SUPPORT - else if (RTMP_GET_PACKET_EOSP(pPacket)) - TxFrameType = TX_LEGACY_FRAME; -#endif // UAPSD_AP_SUPPORT // else if((pMacEntry->TXBAbitmap & (1<<(RTMP_GET_PACKET_UP(pPacket)))) != 0) return TX_AMPDU_FRAME; else if(CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_AMSDU_INUSED)) @@ -799,12 +617,6 @@ BOOLEAN RTMP_FillTxBlkInfo( { pTxBlk->pMacEntry = NULL; { -#ifdef MCAST_RATE_SPECIFIC - PUCHAR pDA = GET_OS_PKT_DATAPTR(pPacket); - if (((*pDA & 0x01) == 0x01) && (*pDA != 0xff)) - pTxBlk->pTransmit = &pAd->CommonCfg.MCastPhyMode; - else -#endif // MCAST_RATE_SPECIFIC // pTxBlk->pTransmit = &pAd->MacTab.Content[MCAST_WCID].HTPhyMode; } @@ -832,16 +644,25 @@ BOOLEAN RTMP_FillTxBlkInfo( else TX_BLK_SET_FLAG(pTxBlk, fTX_bAckRequired); + if ((pAd->OpMode == OPMODE_STA) && + (ADHOC_ON(pAd)) && + (RX_FILTER_TEST_FLAG(pAd, fRX_FILTER_ACCEPT_PROMISCUOUS))) { + if(pAd->CommonCfg.PSPXlink) + TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bAckRequired); + } + + { + { + // If support WMM, enable it. -#ifdef RT2860 - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED)) -#endif -#ifdef RT2870 if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_WMM_CAPABLE)) -#endif TX_BLK_SET_FLAG(pTxBlk, fTX_bWMM); + +// if (pAd->StaCfg.bAutoTxRateSwitch) +// TX_BLK_SET_FLAG(pTxBlk, fTX_AutoRateSwitch); + } } if (pTxBlk->TxFrameType == TX_LEGACY_FRAME) @@ -871,12 +692,6 @@ BOOLEAN RTMP_FillTxBlkInfo( { TX_BLK_SET_FLAG(pTxBlk, fTX_bMoreData); } -#ifdef UAPSD_AP_SUPPORT - if (RTMP_GET_PACKET_EOSP(pPacket)) - { - TX_BLK_SET_FLAG(pTxBlk, fTX_bWMM_UAPSD_EOSP); - } -#endif // UAPSD_AP_SUPPORT // } else if (pTxBlk->TxFrameType == TX_FRAG_FRAME) { @@ -896,7 +711,7 @@ BOOLEAN CanDoAggregateTransmit( IN TX_BLK *pTxBlk) { - //printk("Check if can do aggregation! TxFrameType=%d!\n", pTxBlk->TxFrameType); + //DBGPRINT(RT_DEBUG_TRACE, ("Check if can do aggregation! TxFrameType=%d!\n", pTxBlk->TxFrameType)); if (RTMP_GET_PACKET_WCID(pPacket) == MCAST_WCID) return FALSE; @@ -922,6 +737,7 @@ BOOLEAN CanDoAggregateTransmit( return TRUE; else return FALSE; + } @@ -970,7 +786,6 @@ VOID RTMPDeQueuePacket( if (QIdx == NUM_OF_TX_RING) { sQIdx = 0; -//PS packets use HCCA queue when dequeue from PS unicast queue (WiFi WPA2 MA9_DT1 for Marvell B STA) eQIdx = 3; // 4 ACs, start from 0. } else @@ -982,7 +797,7 @@ VOID RTMPDeQueuePacket( { Count=0; - RT28XX_START_DEQUEUE(pAd, QueIdx, IrqFlags); + RTMP_START_DEQUEUE(pAd, QueIdx, IrqFlags); while (1) @@ -993,7 +808,7 @@ VOID RTMPDeQueuePacket( fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)))) { - RT28XX_STOP_DEQUEUE(pAd, QueIdx, IrqFlags); + RTMP_STOP_DEQUEUE(pAd, QueIdx, IrqFlags); return; } @@ -1006,7 +821,8 @@ VOID RTMPDeQueuePacket( DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, IrqFlags); break; } -#ifdef RT2860 + +#ifdef RTMP_MAC_PCI FreeNumber[QueIdx] = GET_TXRING_FREENO(pAd, QueIdx); @@ -1016,7 +832,8 @@ VOID RTMPDeQueuePacket( RTMPFreeTXDUponTxDmaDone(pAd, QueIdx); FreeNumber[QueIdx] = GET_TXRING_FREENO(pAd, QueIdx); } -#endif /* RT2860 */ +#endif // RTMP_MAC_PCI // + // probe the Queue Head pQueue = &pAd->TxSwQueue[QueIdx]; if ((pEntry = pQueue->Head) == NULL) @@ -1027,12 +844,14 @@ VOID RTMPDeQueuePacket( pTxBlk = &TxBlk; NdisZeroMemory((PUCHAR)pTxBlk, sizeof(TX_BLK)); + //InitializeQueueHeader(&pTxBlk->TxPacketList); // Didn't need it because we already memzero it. pTxBlk->QueIdx = QueIdx; - pPacket = QUEUE_ENTRY_TO_PKT(pEntry); + pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); + // Early check to make sure we have enoguh Tx Resource. - hasTxDesc = RT28XX_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, FreeNumber[QueIdx], pPacket); + hasTxDesc = RTMP_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, FreeNumber[QueIdx], pPacket); if (!hasTxDesc) { pAd->PrivateInfo.TxRingFullCnt++; @@ -1065,16 +884,16 @@ VOID RTMPDeQueuePacket( break; // For TX_AMSDU_FRAME/TX_RALINK_FRAME, Need to check if next pakcet can do aggregation. - pPacket = QUEUE_ENTRY_TO_PKT(pEntry); + pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); FreeNumber[QueIdx] = GET_TXRING_FREENO(pAd, QueIdx); - hasTxDesc = RT28XX_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, FreeNumber[QueIdx], pPacket); + hasTxDesc = RTMP_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, FreeNumber[QueIdx], pPacket); if ((hasTxDesc == FALSE) || (CanDoAggregateTransmit(pAd, pPacket, pTxBlk) == FALSE)) break; //Remove the packet from the TxSwQueue and insert into pTxBlk pEntry = RemoveHeadQueue(pQueue); ASSERT(pEntry); - pPacket = QUEUE_ENTRY_TO_PKT(pEntry); + pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); pTxBlk->TotalFrameNum++; pTxBlk->TotalFragNum += RTMP_GET_PACKET_FRAGMENTS(pPacket); // The real fragment number maybe vary pTxBlk->TotalFrameLen += GET_OS_PKT_LEN(pPacket); @@ -1085,29 +904,29 @@ VOID RTMPDeQueuePacket( pTxBlk->TxFrameType = TX_LEGACY_FRAME; } -#ifdef RT2870 +#ifdef RTMP_MAC_USB DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, IrqFlags); -#endif // RT2870 // - +#endif // RTMP_MAC_USB // Count += pTxBlk->TxPacketList.Number; // Do HardTransmit now. Status = STAHardTransmit(pAd, pTxBlk, QueIdx); -#ifdef RT2860 +#ifdef RTMP_MAC_PCI DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, IrqFlags); // static rate also need NICUpdateFifoStaCounters() function. //if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) NICUpdateFifoStaCounters(pAd); -#endif +#endif // RTMP_MAC_PCI // + } - RT28XX_STOP_DEQUEUE(pAd, QueIdx, IrqFlags); + RTMP_STOP_DEQUEUE(pAd, QueIdx, IrqFlags); -#ifdef RT2870 +#ifdef RTMP_MAC_USB if (!hasTxDesc) RTUSBKickBulkOut(pAd); -#endif // RT2870 // +#endif // RTMP_MAC_USB // } } @@ -1243,9 +1062,16 @@ VOID RTMPWriteTxWI( pTxWI->NSEQ = NSeq; // John tune the performace with Intel Client in 20 MHz performance BASize = pAd->CommonCfg.TxBASize; - + if (pAd->MACVersion == 0x28720200) + { + if( BASize >13 ) + BASize =13; + } + else + { if( BASize >7 ) BASize =7; + } pTxWI->BAWinSize = BASize; pTxWI->ShortGI = pTransmit->field.ShortGI; pTxWI->STBC = pTransmit->field.STBC; @@ -1387,7 +1213,7 @@ VOID RTMPWriteTxWI_Cache( IN OUT PTXWI_STRUC pTxWI, IN TX_BLK *pTxBlk) { - PHTTRANSMIT_SETTING pTransmit; + PHTTRANSMIT_SETTING /*pTxHTPhyMode,*/ pTransmit; PMAC_TABLE_ENTRY pMacEntry; // @@ -1396,6 +1222,9 @@ VOID RTMPWriteTxWI_Cache( pMacEntry = pTxBlk->pMacEntry; pTransmit = pTxBlk->pTransmit; + //if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) + //if (RTMPCheckEntryEnableAutoRateSwitch(pAd, pMacEntry)) + //if (TX_BLK_TEST_FLAG(pTxBlk, fTX_AutoRateSwitch)) if (pMacEntry->bAutoTxRateSwitch) { pTxWI->txop = IFS_HTTXOP; @@ -1440,53 +1269,6 @@ VOID RTMPWriteTxWI_Cache( } -/* - ======================================================================== - - Routine Description: - Calculates the duration which is required to transmit out frames - with given size and specified rate. - - Arguments: - pTxD Pointer to transmit descriptor - Ack Setting for Ack requirement bit - Fragment Setting for Fragment bit - RetryMode Setting for retry mode - Ifs Setting for IFS gap - Rate Setting for transmit rate - Service Setting for service - Length Frame length - TxPreamble Short or Long preamble when using CCK rates - QueIdx - 0-3, according to 802.11e/d4.4 June/2003 - - Return Value: - None - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - ======================================================================== -*/ -VOID RTMPWriteTxDescriptor( - IN PRTMP_ADAPTER pAd, - IN PTXD_STRUC pTxD, - IN BOOLEAN bWIV, - IN UCHAR QueueSEL) -{ - // - // Always use Long preamble before verifiation short preamble functionality works well. - // Todo: remove the following line if short preamble functionality works - // - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); - - pTxD->WIV = (bWIV) ? 1: 0; - pTxD->QSEL= (QueueSEL); - if (pAd->bGenOneHCCA == TRUE) - pTxD->QSEL= FIFO_HCCA; - pTxD->DMADONE = 0; -} - - // should be called only when - // 1. MEADIA_CONNECTED // 2. AGGREGATION_IN_USED @@ -1582,12 +1364,14 @@ PQUEUE_HEADER RTMPCheckTxSwQueue( { ULONG Number; + // 2004-11-15 to be removed. test aggregation only +// if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED)) && (*pNumber < 2)) +// return NULL; Number = pAd->TxSwQueue[QID_AC_BK].Number + pAd->TxSwQueue[QID_AC_BE].Number + pAd->TxSwQueue[QID_AC_VI].Number - + pAd->TxSwQueue[QID_AC_VO].Number - + pAd->TxSwQueue[QID_HCCA].Number; + + pAd->TxSwQueue[QID_AC_VO].Number; if (pAd->TxSwQueue[QID_AC_VO].Head != NULL) { @@ -1609,11 +1393,6 @@ PQUEUE_HEADER RTMPCheckTxSwQueue( *pQueIdx = QID_AC_BK; return (&pAd->TxSwQueue[QID_AC_BK]); } - else if (pAd->TxSwQueue[QID_HCCA].Head != NULL) - { - *pQueIdx = QID_HCCA; - return (&pAd->TxSwQueue[QID_HCCA]); - } // No packet pending in Tx Sw queue *pQueIdx = QID_AC_BK; @@ -1621,277 +1400,6 @@ PQUEUE_HEADER RTMPCheckTxSwQueue( return (NULL); } -#ifdef RT2860 -BOOLEAN RTMPFreeTXDUponTxDmaDone( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx) -{ - PRTMP_TX_RING pTxRing; - PTXD_STRUC pTxD; - PNDIS_PACKET pPacket; - UCHAR FREE = 0; - TXD_STRUC TxD, *pOriTxD; - //ULONG IrqFlags; - BOOLEAN bReschedule = FALSE; - - - ASSERT(QueIdx < NUM_OF_TX_RING); - pTxRing = &pAd->TxRing[QueIdx]; - - RTMP_IO_READ32(pAd, TX_DTX_IDX0 + QueIdx * RINGREG_DIFF, &pTxRing->TxDmaIdx); - while (pTxRing->TxSwFreeIdx != pTxRing->TxDmaIdx) - { - // static rate also need NICUpdateFifoStaCounters() function. - //if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) - NICUpdateFifoStaCounters(pAd); - - /* Note : If (pAd->ate.bQATxStart == TRUE), we will never reach here. */ - FREE++; - pTxD = (PTXD_STRUC) (pTxRing->Cell[pTxRing->TxSwFreeIdx].AllocVa); - pOriTxD = pTxD; - NdisMoveMemory(&TxD, pTxD, sizeof(TXD_STRUC)); - pTxD = &TxD; - - pTxD->DMADONE = 0; - -/*====================================================================*/ - { - pPacket = pTxRing->Cell[pTxRing->TxSwFreeIdx].pNdisPacket; - if (pPacket) - { -#ifdef CONFIG_5VT_ENHANCE - if (RTMP_GET_PACKET_5VT(pPacket)) - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, 16, PCI_DMA_TODEVICE); - else -#endif // CONFIG_5VT_ENHANCE // - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - //Always assign pNdisPacket as NULL after clear - pTxRing->Cell[pTxRing->TxSwFreeIdx].pNdisPacket = NULL; - - pPacket = pTxRing->Cell[pTxRing->TxSwFreeIdx].pNextNdisPacket; - - ASSERT(pPacket == NULL); - if (pPacket) - { -#ifdef CONFIG_5VT_ENHANCE - if (RTMP_GET_PACKET_5VT(pPacket)) - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, 16, PCI_DMA_TODEVICE); - else -#endif // CONFIG_5VT_ENHANCE // - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - //Always assign pNextNdisPacket as NULL after clear - pTxRing->Cell[pTxRing->TxSwFreeIdx].pNextNdisPacket = NULL; - } -/*====================================================================*/ - - pAd->RalinkCounters.TransmittedByteCount += (pTxD->SDLen1 + pTxD->SDLen0); - pAd->RalinkCounters.OneSecDmaDoneCount[QueIdx] ++; - INC_RING_INDEX(pTxRing->TxSwFreeIdx, TX_RING_SIZE); - /* get tx_tdx_idx again */ - RTMP_IO_READ32(pAd, TX_DTX_IDX0 + QueIdx * RINGREG_DIFF , &pTxRing->TxDmaIdx); - - NdisMoveMemory(pOriTxD, pTxD, sizeof(TXD_STRUC)); - } - - - return bReschedule; - -} - - -/* - ======================================================================== - - Routine Description: - Process TX Rings DMA Done interrupt, running in DPC level - - Arguments: - Adapter Pointer to our adapter - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - ======================================================================== -*/ -BOOLEAN RTMPHandleTxRingDmaDoneInterrupt( - IN PRTMP_ADAPTER pAd, - IN INT_SOURCE_CSR_STRUC TxRingBitmap) -{ - unsigned long IrqFlags; - BOOLEAN bReschedule = FALSE; - - // Make sure Tx ring resource won't be used by other threads - - RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); - - if (TxRingBitmap.field.Ac0DmaDone) - bReschedule = RTMPFreeTXDUponTxDmaDone(pAd, QID_AC_BE); - - if (TxRingBitmap.field.HccaDmaDone) - bReschedule |= RTMPFreeTXDUponTxDmaDone(pAd, QID_HCCA); - - if (TxRingBitmap.field.Ac3DmaDone) - bReschedule |= RTMPFreeTXDUponTxDmaDone(pAd, QID_AC_VO); - - if (TxRingBitmap.field.Ac2DmaDone) - bReschedule |= RTMPFreeTXDUponTxDmaDone(pAd, QID_AC_VI); - - if (TxRingBitmap.field.Ac1DmaDone) - bReschedule |= RTMPFreeTXDUponTxDmaDone(pAd, QID_AC_BK); - - // Make sure to release Tx ring resource - RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); - - // Dequeue outgoing frames from TxSwQueue[] and process it - RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); - - return bReschedule; -} - - -/* - ======================================================================== - - Routine Description: - Process MGMT ring DMA done interrupt, running in DPC level - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPHandleMgmtRingDmaDoneInterrupt( - IN PRTMP_ADAPTER pAd) -{ - PTXD_STRUC pTxD; - PNDIS_PACKET pPacket; - UCHAR FREE = 0; - PRTMP_MGMT_RING pMgmtRing = &pAd->MgmtRing; - - NdisAcquireSpinLock(&pAd->MgmtRingLock); - - RTMP_IO_READ32(pAd, TX_MGMTDTX_IDX, &pMgmtRing->TxDmaIdx); - while (pMgmtRing->TxSwFreeIdx!= pMgmtRing->TxDmaIdx) - { - FREE++; - pTxD = (PTXD_STRUC) (pMgmtRing->Cell[pAd->MgmtRing.TxSwFreeIdx].AllocVa); - pTxD->DMADONE = 0; - pPacket = pMgmtRing->Cell[pMgmtRing->TxSwFreeIdx].pNdisPacket; - - - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - pMgmtRing->Cell[pMgmtRing->TxSwFreeIdx].pNdisPacket = NULL; - - pPacket = pMgmtRing->Cell[pMgmtRing->TxSwFreeIdx].pNextNdisPacket; - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - pMgmtRing->Cell[pMgmtRing->TxSwFreeIdx].pNextNdisPacket = NULL; - INC_RING_INDEX(pMgmtRing->TxSwFreeIdx, MGMT_RING_SIZE); - } - NdisReleaseSpinLock(&pAd->MgmtRingLock); - -} - - -/* - ======================================================================== - - Routine Description: - Arguments: - Adapter Pointer to our adapter. Dequeue all power safe delayed braodcast frames after beacon. - - IRQL = DISPATCH_LEVEL - - ======================================================================== -*/ -VOID RTMPHandleTBTTInterrupt( - IN PRTMP_ADAPTER pAd) -{ - { - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - } - } -} - - -/* - ======================================================================== - - Routine Description: - Arguments: - Adapter Pointer to our adapter. Rewrite beacon content before next send-out. - - IRQL = DISPATCH_LEVEL - - ======================================================================== -*/ -VOID RTMPHandlePreTBTTInterrupt( - IN PRTMP_ADAPTER pAd) -{ - { - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("RTMPHandlePreTBTTInterrupt...\n")); - } - } - - -} - -VOID RTMPHandleRxCoherentInterrupt( - IN PRTMP_ADAPTER pAd) -{ - WPDMA_GLO_CFG_STRUC GloCfg; - - if (pAd == NULL) - { - DBGPRINT(RT_DEBUG_TRACE, ("====> pAd is NULL, return.\n")); - return; - } - - DBGPRINT(RT_DEBUG_TRACE, ("==> RTMPHandleRxCoherentInterrupt \n")); - - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG , &GloCfg.word); - - GloCfg.field.EnTXWriteBackDDONE = 0; - GloCfg.field.EnableRxDMA = 0; - GloCfg.field.EnableTxDMA = 0; - RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); - - RTMPRingCleanUp(pAd, QID_AC_BE); - RTMPRingCleanUp(pAd, QID_AC_BK); - RTMPRingCleanUp(pAd, QID_AC_VI); - RTMPRingCleanUp(pAd, QID_AC_VO); - RTMPRingCleanUp(pAd, QID_HCCA); - RTMPRingCleanUp(pAd, QID_MGMT); - RTMPRingCleanUp(pAd, QID_RX); - - RTMPEnableRxTx(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("<== RTMPHandleRxCoherentInterrupt \n")); -} -#endif /* RT2860 */ /* ======================================================================== @@ -1922,9 +1430,11 @@ VOID RTMPSuspendMsduTransmission( RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R66, &pAd->BbpTuning.R66CurrentValue); // set BBP_R66 to 0x30/0x40 when scanning (AsicSwitchChannel will set R66 according to channel when scanning) + //RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, (0x26 + GET_LNA_GAIN(pAd))); RTMPSetAGCInitValue(pAd, BW_20); RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); + //RTMP_IO_WRITE32(pAd, TX_CNTL_CSR, 0x000f0000); // abort all TX rings } @@ -1949,8 +1459,11 @@ VOID RTMPSuspendMsduTransmission( VOID RTMPResumeMsduTransmission( IN PRTMP_ADAPTER pAd) { +// UCHAR IrqState; + DBGPRINT(RT_DEBUG_TRACE,("SCAN done, resume MSDU transmission ...\n")); + // After finish BSS_SCAN_IN_PROGRESS, we need to restore Current R66 value // R66 should not be 0 if (pAd->BbpTuning.R66CurrentValue == 0) @@ -1962,6 +1475,11 @@ VOID RTMPResumeMsduTransmission( RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, pAd->BbpTuning.R66CurrentValue); RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); +// sample, for IRQ LOCK to SEM LOCK +// IrqState = pAd->irq_disabled; +// if (IrqState) +// RTMPDeQueuePacket(pAd, TRUE, NUM_OF_TX_RING, MAX_TX_PROCESS); +// else RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); } @@ -1990,7 +1508,9 @@ UINT deaggregate_AMSDU_announce( nMSDU++; + //hex_dump("subheader", pData, 64); pAMSDUsubheader = (PHEADER_802_3)pData; + //pData += LENGTH_802_3; PayloadSize = pAMSDUsubheader->Octet[1] + (pAMSDUsubheader->Octet[0]<<8); SubFrameSize = PayloadSize + LENGTH_802_3; @@ -2000,6 +1520,8 @@ UINT deaggregate_AMSDU_announce( break; } + //DBGPRINT(RT_DEBUG_TRACE,("%d subframe: Size = %d\n", nMSDU, PayloadSize)); + pPayload = pData + LENGTH_802_3; pDA = pData; pSA = pData + MAC_ADDR_LEN; @@ -2009,15 +1531,17 @@ UINT deaggregate_AMSDU_announce( if ((Header802_3[12] == 0x88) && (Header802_3[13] == 0x8E) ) { - // avoid local heap overflow, use dyanamic allocation + /* avoid local heap overflow, use dyanamic allocation */ MLME_QUEUE_ELEM *Elem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); - if (Elem == NULL) - return; + if (Elem != NULL) + { memmove(Elem->Msg+(LENGTH_802_11 + LENGTH_802_1_H), pPayload, PayloadSize); Elem->MsgLen = LENGTH_802_11 + LENGTH_802_1_H + PayloadSize; - WpaEAPOLKeyAction(pAd, Elem); + //WpaEAPOLKeyAction(pAd, Elem); + REPORT_MGMT_FRAME_TO_MLME(pAd, BSSID_WCID, Elem->Msg, Elem->MsgLen, 0, 0, 0, 0); kfree(Elem); } + } { if (pRemovedLLCSNAP) @@ -2121,6 +1645,8 @@ MAC_TABLE_ENTRY *MacTableInsertEntry( UCHAR HashIdx; int i, FirstWcid; MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry; +// USHORT offset; +// ULONG addr; // if FULL, return if (pAd->MacTab.Size >= MAX_LEN_OF_MAC_TABLE) @@ -2183,22 +1709,15 @@ MAC_TABLE_ENTRY *MacTableInsertEntry( pEntry->AuthMode = pAd->StaCfg.AuthMode; pEntry->WepStatus = pAd->StaCfg.WepStatus; pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; -#ifdef RT2860 +#ifdef RTMP_MAC_PCI AsicRemovePairwiseKeyEntry(pAd, pEntry->apidx, (UCHAR)i); -#endif +#endif // RTMP_MAC_PCI // } } pEntry->GTKState = REKEY_NEGOTIATING; pEntry->PairwiseKey.KeyLen = 0; pEntry->PairwiseKey.CipherAlg = CIPHER_NONE; - -#ifdef RT2860 - if ((pAd->OpMode == OPMODE_STA) && - (pAd->StaCfg.BssType == BSS_ADHOC)) - pEntry->PortSecured = WPA_802_1X_PORT_SECURED; - else -#endif pEntry->PortSecured = WPA_802_1X_PORT_NOT_SECURED; pEntry->PMKID_CacheIdx = ENTRY_NOT_FOUND; @@ -2210,13 +1729,14 @@ MAC_TABLE_ENTRY *MacTableInsertEntry( pEntry->PsMode = PWR_ACTIVE; pEntry->PsQIdleCount = 0; pEntry->NoDataIdleCount = 0; + pEntry->AssocDeadLine = MAC_TABLE_ASSOC_TIMEOUT; pEntry->ContinueTxFailCnt = 0; InitializeQueueHeader(&pEntry->PsQueue); pAd->MacTab.Size ++; // Add this entry into ASIC RX WCID search table - RT28XX_STA_ENTRY_ADD(pAd, pEntry); + RTMP_STA_ENTRY_ADD(pAd, pEntry); @@ -2260,6 +1780,8 @@ BOOLEAN MacTableDeleteEntry( USHORT HashIdx; MAC_TABLE_ENTRY *pEntry, *pPrevEntry, *pProbeEntry; BOOLEAN Cancelled; + //USHORT offset; // unused variable + //UCHAR j; // unused variable if (wcid >= MAX_LEN_OF_MAC_TABLE) return FALSE; @@ -2267,6 +1789,7 @@ BOOLEAN MacTableDeleteEntry( NdisAcquireSpinLock(&pAd->MacTabLock); HashIdx = MAC_ADDR_HASH_INDEX(pAddr); + //pEntry = pAd->MacTab.Hash[HashIdx]; pEntry = &pAd->MacTab.Content[wcid]; if (pEntry && (pEntry->ValidAsCLI || pEntry->ValidAsApCli || pEntry->ValidAsWDS || pEntry->ValidAsMesh @@ -2276,7 +1799,7 @@ BOOLEAN MacTableDeleteEntry( { // Delete this entry from ASIC on-chip WCID Table - RT28XX_STA_ENTRY_MAC_RESET(pAd, wcid); + RTMP_STA_ENTRY_MAC_RESET(pAd, wcid); // free resources of BA BASessionTearDownALL(pAd, pEntry->Aid); @@ -2308,7 +1831,7 @@ BOOLEAN MacTableDeleteEntry( // not found !!! ASSERT(pProbeEntry != NULL); - RT28XX_STA_ENTRY_KEY_DEL(pAd, BSS0, wcid); + RTMP_STA_ENTRY_KEY_DEL(pAd, BSS0, wcid); if (pEntry->EnqueueEapolStartTimerRunning != EAPOL_START_DISABLE) @@ -2324,7 +1847,7 @@ BOOLEAN MacTableDeleteEntry( } else { - printk("\n%s: Impossible Wcid = %d !!!!!\n", __func__, wcid); + DBGPRINT(RT_DEBUG_OFF, ("\n%s: Impossible Wcid = %d !!!!!\n", __func__, wcid)); } } @@ -2334,13 +1857,8 @@ BOOLEAN MacTableDeleteEntry( if (pAd->MacTab.Size == 0) { pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode = 0; -#ifdef RT2860 - AsicUpdateProtect(pAd, 0 /*pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode*/, (ALLN_SETPROTECT), TRUE, 0 /*pAd->MacTab.fAnyStationNonGF*/); -#else - // edit by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet - // Set MAC register value according operation mode - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_UPDATE_PROTECT, NULL, 0); -#endif + //AsicUpdateProtect(pAd, 0 /*pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode*/, (ALLN_SETPROTECT), TRUE, 0 /*pAd->MacTab.fAnyStationNonGF*/); + RTMP_UPDATE_PROTECT(pAd); // edit by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet } return TRUE; @@ -2362,24 +1880,25 @@ VOID MacTableReset( DBGPRINT(RT_DEBUG_TRACE, ("MacTableReset\n")); //NdisAcquireSpinLock(&pAd->MacTabLock); + for (i=1; iMacTab.Content[i].ValidAsCLI == TRUE) { + + // free resources of BA BASessionTearDownALL(pAd, i); pAd->MacTab.Content[i].ValidAsCLI = FALSE; - - -#ifdef RT2870 +#ifdef RTMP_MAC_USB NdisZeroMemory(pAd->MacTab.Content[i].Addr, 6); - RT28XX_STA_ENTRY_MAC_RESET(pAd, i); -#endif // RT2870 // + RTMP_STA_ENTRY_MAC_RESET(pAd, i); +#endif // RTMP_MAC_USB // //AsicDelWcidTab(pAd, i); } @@ -2544,7 +2063,7 @@ BOOLEAN RTMPCheckEtherType( RTMP_SET_PACKET_SPECIFIC(pPacket, 0); // get Ethernet protocol field - TypeLen = (pSrcBuf[12] << 8) + pSrcBuf[13]; + TypeLen = (pSrcBuf[12] << 8) | pSrcBuf[13]; pSrcBuf += LENGTH_802_3; // Skip the Ethernet Header. @@ -2558,7 +2077,7 @@ BOOLEAN RTMPCheckEtherType( */ if (pSrcBuf[0] == 0xAA && pSrcBuf[1] == 0xAA && pSrcBuf[2] == 0x03) { - Sniff2BytesFromNdisBuffer(pSrcBuf, 6, &Byte0, &Byte1); + Sniff2BytesFromNdisBuffer((PNDIS_BUFFER)pSrcBuf, 6, &Byte0, &Byte1); RTMP_SET_PACKET_LLCSNAP(pPacket, 1); TypeLen = (USHORT)((Byte0 << 8) + Byte1); pSrcBuf += 8; // Skip this LLC/SNAP header @@ -2584,7 +2103,7 @@ BOOLEAN RTMPCheckEtherType( Frame Check Sequence (4-bytes) */ RTMP_SET_PACKET_VLAN(pPacket, 1); - Sniff2BytesFromNdisBuffer(pSrcBuf, 2, &Byte0, &Byte1); + Sniff2BytesFromNdisBuffer((PNDIS_BUFFER)pSrcBuf, 2, &Byte0, &Byte1); TypeLen = (USHORT)((Byte0 << 8) + Byte1); pSrcBuf += 4; // Skip the VLAN Header. @@ -2600,8 +2119,8 @@ BOOLEAN RTMPCheckEtherType( ASSERT((pktLen > 34)); // 14 for ethernet header, 20 for IP header pSrcBuf += 20; // Skip the IP header - srcPort = OS_NTOHS(*((UINT16 *)pSrcBuf)); - dstPort = OS_NTOHS(*((UINT16 *)(pSrcBuf +2))); + srcPort = OS_NTOHS(get_unaligned((PUINT16)(pSrcBuf))); + dstPort = OS_NTOHS(get_unaligned((PUINT16)(pSrcBuf+2))); if ((srcPort==0x44 && dstPort==0x43) || (srcPort==0x43 && dstPort==0x44)) { //It's a BOOTP/DHCP packet @@ -2692,7 +2211,7 @@ VOID Indicate_Legacy_Packet( STATS_INC_RX_PACKETS(pAd, FromWhichBSSID); -#ifdef RT2870 +#ifdef RTMP_MAC_USB if (pAd->CommonCfg.bDisableReordering == 0) { PBA_REC_ENTRY pBAEntry; @@ -2701,7 +2220,7 @@ VOID Indicate_Legacy_Packet( UCHAR TID = pRxBlk->pRxWI->TID; USHORT Idx; -#define REORDERING_PACKET_TIMEOUT ((100 * HZ)/1000) // system ticks -- 100 ms +#define REORDERING_PACKET_TIMEOUT ((100 * OS_HZ)/1000) // system ticks -- 100 ms if (Wcid < MAX_LEN_OF_MAC_TABLE) { @@ -2715,14 +2234,15 @@ VOID Indicate_Legacy_Packet( RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+(REORDERING_PACKET_TIMEOUT))) ) { - printk("Indicate_Legacy_Packet():flush reordering_timeout_mpdus! RxWI->Flags=%d, pRxWI.TID=%d, RxD->AMPDU=%d!\n", pRxBlk->Flags, pRxBlk->pRxWI->TID, pRxBlk->RxD.AMPDU); + DBGPRINT(RT_DEBUG_OFF, ("Indicate_Legacy_Packet():flush reordering_timeout_mpdus! RxWI->Flags=%d, pRxWI.TID=%d, RxD->AMPDU=%d!\n", + pRxBlk->Flags, pRxBlk->pRxWI->TID, pRxBlk->RxD.AMPDU)); hex_dump("Dump the legacy Packet:", GET_OS_PKT_DATAPTR(pRxBlk->pRxPacket), 64); ba_flush_reordering_timeout_mpdus(pAd, pBAEntry, Now32); } } } } -#endif // RT2870 // +#endif // RTMP_MAC_USB // wlan_802_11_to_802_3_packet(pAd, pRxBlk, Header802_3, FromWhichBSSID); diff --git a/drivers/staging/rt2860/common/cmm_data_pci.c b/drivers/staging/rt2860/common/cmm_data_pci.c new file mode 100644 index 000000000000..d808e7d7767d --- /dev/null +++ b/drivers/staging/rt2860/common/cmm_data_pci.c @@ -0,0 +1,1153 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + */ + +/* + All functions in this file must be PCI-depended, or you should out your function + in other files. + +*/ +#include "../rt_config.h" + + +USHORT RtmpPCI_WriteTxResource( + IN PRTMP_ADAPTER pAd, + IN TX_BLK *pTxBlk, + IN BOOLEAN bIsLast, + OUT USHORT *FreeNumber) +{ + + UCHAR *pDMAHeaderBufVA; + USHORT TxIdx, RetTxIdx; + PTXD_STRUC pTxD; + UINT32 BufBasePaLow; + PRTMP_TX_RING pTxRing; + USHORT hwHeaderLen; + + // + // get Tx Ring Resource + // + pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; + TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; + pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; + BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); + + // copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer + if (pTxBlk->TxFrameType == TX_AMSDU_FRAME) + { + //hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD; + hwHeaderLen = pTxBlk->MpduHeaderLen - LENGTH_AMSDU_SUBFRAMEHEAD + pTxBlk->HdrPadLen + LENGTH_AMSDU_SUBFRAMEHEAD; + } + else + { + //hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); + hwHeaderLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; + } + NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, TXINFO_SIZE + TXWI_SIZE + hwHeaderLen); + + pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket; + pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; + + // + // build Tx Descriptor + // + + pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; + NdisZeroMemory(pTxD, TXD_SIZE); + + pTxD->SDPtr0 = BufBasePaLow; + pTxD->SDLen0 = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; // include padding + pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE); + pTxD->SDLen1 = pTxBlk->SrcBufLen; + pTxD->LastSec0 = 0; + pTxD->LastSec1 = (bIsLast) ? 1 : 0; + + RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); + + RetTxIdx = TxIdx; + // + // Update Tx index + // + INC_RING_INDEX(TxIdx, TX_RING_SIZE); + pTxRing->TxCpuIdx = TxIdx; + + *FreeNumber -= 1; + + return RetTxIdx; +} + + +USHORT RtmpPCI_WriteSingleTxResource( + IN PRTMP_ADAPTER pAd, + IN TX_BLK *pTxBlk, + IN BOOLEAN bIsLast, + OUT USHORT *FreeNumber) +{ + + UCHAR *pDMAHeaderBufVA; + USHORT TxIdx, RetTxIdx; + PTXD_STRUC pTxD; + UINT32 BufBasePaLow; + PRTMP_TX_RING pTxRing; + USHORT hwHeaderLen; + + // + // get Tx Ring Resource + // + pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; + TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; + pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; + BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); + + // copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer + //hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); + hwHeaderLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; + + NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, TXINFO_SIZE + TXWI_SIZE + hwHeaderLen); + + pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket; + pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; + + // + // build Tx Descriptor + // + pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; + NdisZeroMemory(pTxD, TXD_SIZE); + + pTxD->SDPtr0 = BufBasePaLow; + pTxD->SDLen0 = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; // include padding + pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE);; + pTxD->SDLen1 = pTxBlk->SrcBufLen; + pTxD->LastSec0 = 0; + pTxD->LastSec1 = (bIsLast) ? 1 : 0; + + RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); + + RetTxIdx = TxIdx; + // + // Update Tx index + // + INC_RING_INDEX(TxIdx, TX_RING_SIZE); + pTxRing->TxCpuIdx = TxIdx; + + *FreeNumber -= 1; + + return RetTxIdx; +} + + +USHORT RtmpPCI_WriteMultiTxResource( + IN PRTMP_ADAPTER pAd, + IN TX_BLK *pTxBlk, + IN UCHAR frameNum, + OUT USHORT *FreeNumber) +{ + BOOLEAN bIsLast; + UCHAR *pDMAHeaderBufVA; + USHORT TxIdx, RetTxIdx; + PTXD_STRUC pTxD; + UINT32 BufBasePaLow; + PRTMP_TX_RING pTxRing; + USHORT hwHdrLen; + UINT32 firstDMALen; + + bIsLast = ((frameNum == (pTxBlk->TotalFrameNum - 1)) ? 1 : 0); + + // + // get Tx Ring Resource + // + pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; + TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; + pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; + BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); + + if (frameNum == 0) + { + // copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer + if (pTxBlk->TxFrameType == TX_AMSDU_FRAME) + //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD; + hwHdrLen = pTxBlk->MpduHeaderLen - LENGTH_AMSDU_SUBFRAMEHEAD + pTxBlk->HdrPadLen + LENGTH_AMSDU_SUBFRAMEHEAD; + else if (pTxBlk->TxFrameType == TX_RALINK_FRAME) + //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_ARALINK_HEADER_FIELD, 4)+LENGTH_ARALINK_HEADER_FIELD; + hwHdrLen = pTxBlk->MpduHeaderLen - LENGTH_ARALINK_HEADER_FIELD + pTxBlk->HdrPadLen + LENGTH_ARALINK_HEADER_FIELD; + else + //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); + hwHdrLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; + + firstDMALen = TXINFO_SIZE + TXWI_SIZE + hwHdrLen; + } + else + { + firstDMALen = pTxBlk->MpduHeaderLen; + } + + NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, firstDMALen); + + pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket; + pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; + + // + // build Tx Descriptor + // + pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; + NdisZeroMemory(pTxD, TXD_SIZE); + + pTxD->SDPtr0 = BufBasePaLow; + pTxD->SDLen0 = firstDMALen; // include padding + pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE);; + pTxD->SDLen1 = pTxBlk->SrcBufLen; + pTxD->LastSec0 = 0; + pTxD->LastSec1 = (bIsLast) ? 1 : 0; + + RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); + + + RetTxIdx = TxIdx; + // + // Update Tx index + // + INC_RING_INDEX(TxIdx, TX_RING_SIZE); + pTxRing->TxCpuIdx = TxIdx; + + *FreeNumber -= 1; + + return RetTxIdx; + +} + + +VOID RtmpPCI_FinalWriteTxResource( + IN PRTMP_ADAPTER pAd, + IN TX_BLK *pTxBlk, + IN USHORT totalMPDUSize, + IN USHORT FirstTxIdx) +{ + + PTXWI_STRUC pTxWI; + PRTMP_TX_RING pTxRing; + + // + // get Tx Ring Resource + // + pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; + pTxWI = (PTXWI_STRUC) pTxRing->Cell[FirstTxIdx].DmaBuf.AllocVa; + pTxWI->MPDUtotalByteCount = totalMPDUSize; + +} + + +VOID RtmpPCIDataLastTxIdx( + IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, + IN USHORT LastTxIdx) +{ + PTXD_STRUC pTxD; + PRTMP_TX_RING pTxRing; + + // + // get Tx Ring Resource + // + pTxRing = &pAd->TxRing[QueIdx]; + + // + // build Tx Descriptor + // + pTxD = (PTXD_STRUC) pTxRing->Cell[LastTxIdx].AllocVa; + + pTxD->LastSec1 = 1; + + +} + + +USHORT RtmpPCI_WriteFragTxResource( + IN PRTMP_ADAPTER pAd, + IN TX_BLK *pTxBlk, + IN UCHAR fragNum, + OUT USHORT *FreeNumber) +{ + UCHAR *pDMAHeaderBufVA; + USHORT TxIdx, RetTxIdx; + PTXD_STRUC pTxD; + UINT32 BufBasePaLow; + PRTMP_TX_RING pTxRing; + USHORT hwHeaderLen; + UINT32 firstDMALen; + + // + // Get Tx Ring Resource + // + pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; + TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; + pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; + BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); + + // + // Copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer + // + //hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); + hwHeaderLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; + + firstDMALen = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; + NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, firstDMALen); + + + // + // Build Tx Descriptor + // + pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; + NdisZeroMemory(pTxD, TXD_SIZE); + + if (fragNum == pTxBlk->TotalFragNum) + { + pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket; + pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; + } + + pTxD->SDPtr0 = BufBasePaLow; + pTxD->SDLen0 = firstDMALen; // include padding + pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE); + pTxD->SDLen1 = pTxBlk->SrcBufLen; + pTxD->LastSec0 = 0; + pTxD->LastSec1 = 1; + + RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); + + + RetTxIdx = TxIdx; + pTxBlk->Priv += pTxBlk->SrcBufLen; + + // + // Update Tx index + // + INC_RING_INDEX(TxIdx, TX_RING_SIZE); + pTxRing->TxCpuIdx = TxIdx; + + *FreeNumber -= 1; + + return RetTxIdx; + +} + + +/* + Must be run in Interrupt context + This function handle PCI specific TxDesc and cpu index update and kick the packet out. + */ +int RtmpPCIMgmtKickOut( + IN RTMP_ADAPTER *pAd, + IN UCHAR QueIdx, + IN PNDIS_PACKET pPacket, + IN PUCHAR pSrcBufVA, + IN UINT SrcBufLen) +{ + PTXD_STRUC pTxD; + ULONG SwIdx = pAd->MgmtRing.TxCpuIdx; + + pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[SwIdx].AllocVa; + + pAd->MgmtRing.Cell[SwIdx].pNdisPacket = pPacket; + pAd->MgmtRing.Cell[SwIdx].pNextNdisPacket = NULL; + + RTMPWriteTxDescriptor(pAd, pTxD, TRUE, FIFO_MGMT); + pTxD->LastSec0 = 1; + pTxD->LastSec1 = 1; + pTxD->DMADONE = 0; + pTxD->SDLen1 = 0; + pTxD->SDPtr0 = PCI_MAP_SINGLE(pAd, pSrcBufVA, SrcBufLen, 0, PCI_DMA_TODEVICE); + pTxD->SDLen0 = SrcBufLen; + + +//================================================================== +/* DBGPRINT_RAW(RT_DEBUG_TRACE, ("MLMEHardTransmit\n")); + for (i = 0; i < (TXWI_SIZE+24); i++) + { + + DBGPRINT_RAW(RT_DEBUG_TRACE, ("%x:", *(pSrcBufVA+i))); + if ( i%4 == 3) + DBGPRINT_RAW(RT_DEBUG_TRACE, (" :: ")); + if ( i%16 == 15) + DBGPRINT_RAW(RT_DEBUG_TRACE, ("\n ")); + } + DBGPRINT_RAW(RT_DEBUG_TRACE, ("\n "));*/ +//======================================================================= + + pAd->RalinkCounters.KickTxCount++; + pAd->RalinkCounters.OneSecTxDoneCount++; + + // Increase TX_CTX_IDX, but write to register later. + INC_RING_INDEX(pAd->MgmtRing.TxCpuIdx, MGMT_RING_SIZE); + + RTMP_IO_WRITE32(pAd, TX_MGMTCTX_IDX, pAd->MgmtRing.TxCpuIdx); + + return 0; +} + + +/* + ======================================================================== + + Routine Description: + Check Rx descriptor, return NDIS_STATUS_FAILURE if any error dound + + Arguments: + pRxD Pointer to the Rx descriptor + + Return Value: + NDIS_STATUS_SUCCESS No err + NDIS_STATUS_FAILURE Error + + Note: + + ======================================================================== +*/ +NDIS_STATUS RTMPCheckRxError( + IN PRTMP_ADAPTER pAd, + IN PHEADER_802_11 pHeader, + IN PRXWI_STRUC pRxWI, + IN PRT28XX_RXD_STRUC pRxD) +{ + PCIPHER_KEY pWpaKey; + INT dBm; + + // Phy errors & CRC errors + if (/*(pRxD->PhyErr) ||*/ (pRxD->Crc)) + { + // Check RSSI for Noise Hist statistic collection. + dBm = (INT) (pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta; + if (dBm <= -87) + pAd->StaCfg.RPIDensity[0] += 1; + else if (dBm <= -82) + pAd->StaCfg.RPIDensity[1] += 1; + else if (dBm <= -77) + pAd->StaCfg.RPIDensity[2] += 1; + else if (dBm <= -72) + pAd->StaCfg.RPIDensity[3] += 1; + else if (dBm <= -67) + pAd->StaCfg.RPIDensity[4] += 1; + else if (dBm <= -62) + pAd->StaCfg.RPIDensity[5] += 1; + else if (dBm <= -57) + pAd->StaCfg.RPIDensity[6] += 1; + else if (dBm > -57) + pAd->StaCfg.RPIDensity[7] += 1; + + return(NDIS_STATUS_FAILURE); + } + + // Add Rx size to channel load counter, we should ignore error counts + pAd->StaCfg.CLBusyBytes += (pRxD->SDL0 + 14); + + // Drop ToDs promiscous frame, it is opened due to CCX 2 channel load statistics + if (pHeader != NULL) + { + if (pHeader->FC.ToDs) + { + return(NDIS_STATUS_FAILURE); + } + } + + // Drop not U2M frames, cant's drop here because we will drop beacon in this case + // I am kind of doubting the U2M bit operation + // if (pRxD->U2M == 0) + // return(NDIS_STATUS_FAILURE); + + // drop decyption fail frame + if (pRxD->CipherErr) + { + if (pRxD->CipherErr == 2) + {DBGPRINT_RAW(RT_DEBUG_TRACE,("pRxD ERROR: ICV ok but MICErr "));} + else if (pRxD->CipherErr == 1) + {DBGPRINT_RAW(RT_DEBUG_TRACE,("pRxD ERROR: ICV Err "));} + else if (pRxD->CipherErr == 3) + DBGPRINT_RAW(RT_DEBUG_TRACE,("pRxD ERROR: Key not valid ")); + + if (((pRxD->CipherErr & 1) == 1) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) + RTMPSendWirelessEvent(pAd, IW_ICV_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); + + DBGPRINT_RAW(RT_DEBUG_TRACE,(" %d (len=%d, Mcast=%d, MyBss=%d, Wcid=%d, KeyId=%d)\n", + pRxD->CipherErr, + pRxD->SDL0, + pRxD->Mcast | pRxD->Bcast, + pRxD->MyBss, + pRxWI->WirelessCliID, +// CipherName[pRxD->CipherAlg], + pRxWI->KeyIndex)); + + // + // MIC Error + // + if (pRxD->CipherErr == 2) + { + pWpaKey = &pAd->SharedKey[BSS0][pRxWI->KeyIndex]; + if (pAd->StaCfg.WpaSupplicantUP) + WpaSendMicFailureToWpaSupplicant(pAd, + (pWpaKey->Type == PAIRWISEKEY) ? TRUE:FALSE); + else + RTMPReportMicError(pAd, pWpaKey); + + if (((pRxD->CipherErr & 2) == 2) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) + RTMPSendWirelessEvent(pAd, IW_MIC_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); + + DBGPRINT_RAW(RT_DEBUG_ERROR,("Rx MIC Value error\n")); + } + + if (pHeader == NULL) + return(NDIS_STATUS_SUCCESS); + /*if ((pRxD->CipherAlg == CIPHER_AES) && + (pHeader->Sequence == pAd->FragFrame.Sequence)) + { + // + // Acceptable since the First FragFrame no CipherErr problem. + // + return(NDIS_STATUS_SUCCESS); + }*/ + + return(NDIS_STATUS_FAILURE); + } + + return(NDIS_STATUS_SUCCESS); +} + + +BOOLEAN RTMPFreeTXDUponTxDmaDone( + IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx) +{ + PRTMP_TX_RING pTxRing; + PTXD_STRUC pTxD; + PNDIS_PACKET pPacket; + UCHAR FREE = 0; + TXD_STRUC TxD, *pOriTxD; + //ULONG IrqFlags; + BOOLEAN bReschedule = FALSE; + + + ASSERT(QueIdx < NUM_OF_TX_RING); + pTxRing = &pAd->TxRing[QueIdx]; + + RTMP_IO_READ32(pAd, TX_DTX_IDX0 + QueIdx * RINGREG_DIFF, &pTxRing->TxDmaIdx); + while (pTxRing->TxSwFreeIdx != pTxRing->TxDmaIdx) + { +// RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); + + // static rate also need NICUpdateFifoStaCounters() function. + //if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) + NICUpdateFifoStaCounters(pAd); + + /* Note : If (pAd->ate.bQATxStart == TRUE), we will never reach here. */ + FREE++; + pTxD = (PTXD_STRUC) (pTxRing->Cell[pTxRing->TxSwFreeIdx].AllocVa); + pOriTxD = pTxD; + NdisMoveMemory(&TxD, pTxD, sizeof(TXD_STRUC)); + pTxD = &TxD; + + pTxD->DMADONE = 0; + + + { + pPacket = pTxRing->Cell[pTxRing->TxSwFreeIdx].pNdisPacket; + if (pPacket) + { + PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); + RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); + } + //Always assign pNdisPacket as NULL after clear + pTxRing->Cell[pTxRing->TxSwFreeIdx].pNdisPacket = NULL; + + pPacket = pTxRing->Cell[pTxRing->TxSwFreeIdx].pNextNdisPacket; + + ASSERT(pPacket == NULL); + if (pPacket) + { + PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); + RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); + } + //Always assign pNextNdisPacket as NULL after clear + pTxRing->Cell[pTxRing->TxSwFreeIdx].pNextNdisPacket = NULL; + } + + pAd->RalinkCounters.TransmittedByteCount += (pTxD->SDLen1 + pTxD->SDLen0); + pAd->RalinkCounters.OneSecDmaDoneCount[QueIdx] ++; + INC_RING_INDEX(pTxRing->TxSwFreeIdx, TX_RING_SIZE); + /* get tx_tdx_idx again */ + RTMP_IO_READ32(pAd, TX_DTX_IDX0 + QueIdx * RINGREG_DIFF , &pTxRing->TxDmaIdx); + NdisMoveMemory(pOriTxD, pTxD, sizeof(TXD_STRUC)); + +// RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); + } + + + return bReschedule; + +} + + +/* + ======================================================================== + + Routine Description: + Process TX Rings DMA Done interrupt, running in DPC level + + Arguments: + Adapter Pointer to our adapter + + Return Value: + None + + IRQL = DISPATCH_LEVEL + + ======================================================================== +*/ +BOOLEAN RTMPHandleTxRingDmaDoneInterrupt( + IN PRTMP_ADAPTER pAd, + IN INT_SOURCE_CSR_STRUC TxRingBitmap) +{ +// UCHAR Count = 0; + unsigned long IrqFlags; + BOOLEAN bReschedule = FALSE; + + // Make sure Tx ring resource won't be used by other threads + //NdisAcquireSpinLock(&pAd->TxRingLock); + + RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); + + if (TxRingBitmap.field.Ac0DmaDone) + bReschedule = RTMPFreeTXDUponTxDmaDone(pAd, QID_AC_BE); + + if (TxRingBitmap.field.HccaDmaDone) + bReschedule |= RTMPFreeTXDUponTxDmaDone(pAd, QID_HCCA); + + if (TxRingBitmap.field.Ac3DmaDone) + bReschedule |= RTMPFreeTXDUponTxDmaDone(pAd, QID_AC_VO); + + if (TxRingBitmap.field.Ac2DmaDone) + bReschedule |= RTMPFreeTXDUponTxDmaDone(pAd, QID_AC_VI); + + if (TxRingBitmap.field.Ac1DmaDone) + bReschedule |= RTMPFreeTXDUponTxDmaDone(pAd, QID_AC_BK); + + // Make sure to release Tx ring resource + //NdisReleaseSpinLock(&pAd->TxRingLock); + RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); + + // Dequeue outgoing frames from TxSwQueue[] and process it + RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); + + return bReschedule; +} + + +/* + ======================================================================== + + Routine Description: + Process MGMT ring DMA done interrupt, running in DPC level + + Arguments: + pAd Pointer to our adapter + + Return Value: + None + + IRQL = DISPATCH_LEVEL + + Note: + + ======================================================================== +*/ +VOID RTMPHandleMgmtRingDmaDoneInterrupt( + IN PRTMP_ADAPTER pAd) +{ + PTXD_STRUC pTxD; + PNDIS_PACKET pPacket; +// int i; + UCHAR FREE = 0; + PRTMP_MGMT_RING pMgmtRing = &pAd->MgmtRing; + + NdisAcquireSpinLock(&pAd->MgmtRingLock); + + RTMP_IO_READ32(pAd, TX_MGMTDTX_IDX, &pMgmtRing->TxDmaIdx); + while (pMgmtRing->TxSwFreeIdx!= pMgmtRing->TxDmaIdx) + { + FREE++; + pTxD = (PTXD_STRUC) (pMgmtRing->Cell[pAd->MgmtRing.TxSwFreeIdx].AllocVa); + pTxD->DMADONE = 0; + pPacket = pMgmtRing->Cell[pMgmtRing->TxSwFreeIdx].pNdisPacket; + + + if (pPacket) + { + PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, PCI_DMA_TODEVICE); + RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); + } + pMgmtRing->Cell[pMgmtRing->TxSwFreeIdx].pNdisPacket = NULL; + + pPacket = pMgmtRing->Cell[pMgmtRing->TxSwFreeIdx].pNextNdisPacket; + if (pPacket) + { + PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); + RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); + } + pMgmtRing->Cell[pMgmtRing->TxSwFreeIdx].pNextNdisPacket = NULL; + INC_RING_INDEX(pMgmtRing->TxSwFreeIdx, MGMT_RING_SIZE); + + } + NdisReleaseSpinLock(&pAd->MgmtRingLock); + +} + + +/* + ======================================================================== + + Routine Description: + Arguments: + Adapter Pointer to our adapter. Dequeue all power safe delayed braodcast frames after beacon. + + IRQL = DISPATCH_LEVEL + + ======================================================================== +*/ +VOID RTMPHandleTBTTInterrupt( + IN PRTMP_ADAPTER pAd) +{ + { + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) + { + } + } +} + + +/* + ======================================================================== + + Routine Description: + Arguments: + pAd Pointer to our adapter. Rewrite beacon content before next send-out. + + IRQL = DISPATCH_LEVEL + + ======================================================================== +*/ +VOID RTMPHandlePreTBTTInterrupt( + IN PRTMP_ADAPTER pAd) +{ + { + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) + { + DBGPRINT(RT_DEBUG_TRACE, ("RTMPHandlePreTBTTInterrupt...\n")); + } + } + + +} + +VOID RTMPHandleRxCoherentInterrupt( + IN PRTMP_ADAPTER pAd) +{ + WPDMA_GLO_CFG_STRUC GloCfg; + + if (pAd == NULL) + { + DBGPRINT(RT_DEBUG_TRACE, ("====> pAd is NULL, return.\n")); + return; + } + + DBGPRINT(RT_DEBUG_TRACE, ("==> RTMPHandleRxCoherentInterrupt \n")); + + RTMP_IO_READ32(pAd, WPDMA_GLO_CFG , &GloCfg.word); + + GloCfg.field.EnTXWriteBackDDONE = 0; + GloCfg.field.EnableRxDMA = 0; + GloCfg.field.EnableTxDMA = 0; + RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); + + RTMPRingCleanUp(pAd, QID_AC_BE); + RTMPRingCleanUp(pAd, QID_AC_BK); + RTMPRingCleanUp(pAd, QID_AC_VI); + RTMPRingCleanUp(pAd, QID_AC_VO); + RTMPRingCleanUp(pAd, QID_HCCA); + RTMPRingCleanUp(pAd, QID_MGMT); + RTMPRingCleanUp(pAd, QID_RX); + + RTMPEnableRxTx(pAd); + + DBGPRINT(RT_DEBUG_TRACE, ("<== RTMPHandleRxCoherentInterrupt \n")); +} + +PNDIS_PACKET GetPacketFromRxRing( + IN PRTMP_ADAPTER pAd, + OUT PRT28XX_RXD_STRUC pSaveRxD, + OUT BOOLEAN *pbReschedule, + IN OUT UINT32 *pRxPending) +{ + PRXD_STRUC pRxD; + PNDIS_PACKET pRxPacket = NULL; + PNDIS_PACKET pNewPacket; + PVOID AllocVa; + NDIS_PHYSICAL_ADDRESS AllocPa; + BOOLEAN bReschedule = FALSE; + RTMP_DMACB *pRxCell; + + RTMP_SEM_LOCK(&pAd->RxRingLock); + + if (*pRxPending == 0) + { + // Get how may packets had been received + RTMP_IO_READ32(pAd, RX_DRX_IDX , &pAd->RxRing.RxDmaIdx); + + if (pAd->RxRing.RxSwReadIdx == pAd->RxRing.RxDmaIdx) + { + // no more rx packets + bReschedule = FALSE; + goto done; + } + + // get rx pending count + if (pAd->RxRing.RxDmaIdx > pAd->RxRing.RxSwReadIdx) + *pRxPending = pAd->RxRing.RxDmaIdx - pAd->RxRing.RxSwReadIdx; + else + *pRxPending = pAd->RxRing.RxDmaIdx + RX_RING_SIZE - pAd->RxRing.RxSwReadIdx; + + } + + pRxCell = &pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx]; + + // Point to Rx indexed rx ring descriptor + pRxD = (PRXD_STRUC) pRxCell->AllocVa; + + if (pRxD->DDONE == 0) + { + *pRxPending = 0; + // DMAIndx had done but DDONE bit not ready + bReschedule = TRUE; + goto done; + } + + + // return rx descriptor + NdisMoveMemory(pSaveRxD, pRxD, RXD_SIZE); + + pNewPacket = RTMP_AllocateRxPacketBuffer(pAd, RX_BUFFER_AGGRESIZE, FALSE, &AllocVa, &AllocPa); + + if (pNewPacket) + { + // unmap the rx buffer + PCI_UNMAP_SINGLE(pAd, pRxCell->DmaBuf.AllocPa, + pRxCell->DmaBuf.AllocSize, PCI_DMA_FROMDEVICE); + pRxPacket = pRxCell->pNdisPacket; + + pRxCell->DmaBuf.AllocSize = RX_BUFFER_AGGRESIZE; + pRxCell->pNdisPacket = (PNDIS_PACKET) pNewPacket; + pRxCell->DmaBuf.AllocVa = AllocVa; + pRxCell->DmaBuf.AllocPa = AllocPa; + /* update SDP0 to new buffer of rx packet */ + pRxD->SDP0 = AllocPa; + } + else + { + //DBGPRINT(RT_DEBUG_TRACE,("No Rx Buffer\n")); + pRxPacket = NULL; + bReschedule = TRUE; + } + + pRxD->DDONE = 0; + + // had handled one rx packet + *pRxPending = *pRxPending - 1; + + // update rx descriptor and kick rx + INC_RING_INDEX(pAd->RxRing.RxSwReadIdx, RX_RING_SIZE); + + pAd->RxRing.RxCpuIdx = (pAd->RxRing.RxSwReadIdx == 0) ? (RX_RING_SIZE-1) : (pAd->RxRing.RxSwReadIdx-1); + RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RxCpuIdx); + +done: + RTMP_SEM_UNLOCK(&pAd->RxRingLock); + *pbReschedule = bReschedule; + return pRxPacket; +} + + +NDIS_STATUS MlmeHardTransmitTxRing( + IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, + IN PNDIS_PACKET pPacket) +{ + PACKET_INFO PacketInfo; + PUCHAR pSrcBufVA; + UINT SrcBufLen; + PTXD_STRUC pTxD; + PHEADER_802_11 pHeader_802_11; + BOOLEAN bAckRequired, bInsertTimestamp; + ULONG SrcBufPA; + //UCHAR TxBufIdx; + UCHAR MlmeRate; + ULONG SwIdx = pAd->TxRing[QueIdx].TxCpuIdx; + PTXWI_STRUC pFirstTxWI; + //ULONG i; + //HTTRANSMIT_SETTING MlmeTransmit; //Rate for this MGMT frame. + ULONG FreeNum; + MAC_TABLE_ENTRY *pMacEntry = NULL; + + + RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); + + + if (pSrcBufVA == NULL) + { + // The buffer shouldn't be NULL + return NDIS_STATUS_FAILURE; + } + + // Make sure MGMT ring resource won't be used by other threads + //NdisAcquireSpinLock(&pAd->TxRingLock); + + FreeNum = GET_TXRING_FREENO(pAd, QueIdx); + + if (FreeNum == 0) + { + //NdisReleaseSpinLock(&pAd->TxRingLock); + return NDIS_STATUS_FAILURE; + } + + SwIdx = pAd->TxRing[QueIdx].TxCpuIdx; + + pTxD = (PTXD_STRUC) pAd->TxRing[QueIdx].Cell[SwIdx].AllocVa; + + if (pAd->TxRing[QueIdx].Cell[SwIdx].pNdisPacket) + { + DBGPRINT(RT_DEBUG_OFF, ("MlmeHardTransmit Error\n")); + //NdisReleaseSpinLock(&pAd->TxRingLock); + return NDIS_STATUS_FAILURE; + } + + { + // outgoing frame always wakeup PHY to prevent frame lost + // if (pAd->StaCfg.Psm == PWR_SAVE) + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) + AsicForceWakeup(pAd, TRUE); + } + pFirstTxWI =(PTXWI_STRUC)pSrcBufVA; + + pHeader_802_11 = (PHEADER_802_11) (pSrcBufVA + TXWI_SIZE); + if (pHeader_802_11->Addr1[0] & 0x01) + { + MlmeRate = pAd->CommonCfg.BasicMlmeRate; + } + else + { + MlmeRate = pAd->CommonCfg.MlmeRate; + } + + if ((pHeader_802_11->FC.Type == BTYPE_DATA) && + (pHeader_802_11->FC.SubType == SUBTYPE_QOS_NULL)) + { + pMacEntry = MacTableLookup(pAd, pHeader_802_11->Addr1); + } + + // Verify Mlme rate for a / g bands. + if ((pAd->LatchRfRegs.Channel > 14) && (MlmeRate < RATE_6)) // 11A band + MlmeRate = RATE_6; + + // + // Should not be hard code to set PwrMgmt to 0 (PWR_ACTIVE) + // Snice it's been set to 0 while on MgtMacHeaderInit + // By the way this will cause frame to be send on PWR_SAVE failed. + // + // + // In WMM-UAPSD, mlme frame should be set psm as power saving but probe request frame + // Data-Null packets alse pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD + if (pHeader_802_11->FC.Type != BTYPE_DATA) + { + if ((pHeader_802_11->FC.SubType == SUBTYPE_PROBE_REQ) || !(pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable)) + { + pHeader_802_11->FC.PwrMgmt = PWR_ACTIVE; + } + else + { + pHeader_802_11->FC.PwrMgmt = pAd->CommonCfg.bAPSDForcePowerSave; + } + } + + bInsertTimestamp = FALSE; + if (pHeader_802_11->FC.Type == BTYPE_CNTL) // must be PS-POLL + { + bAckRequired = FALSE; + } + else // BTYPE_MGMT or BTYPE_DATA(must be NULL frame) + { + if (pHeader_802_11->Addr1[0] & 0x01) // MULTICAST, BROADCAST + { + bAckRequired = FALSE; + pHeader_802_11->Duration = 0; + } + else + { + bAckRequired = TRUE; + pHeader_802_11->Duration = RTMPCalcDuration(pAd, MlmeRate, 14); + if (pHeader_802_11->FC.SubType == SUBTYPE_PROBE_RSP) + { + bInsertTimestamp = TRUE; + } + } + } + pHeader_802_11->Sequence = pAd->Sequence++; + if (pAd->Sequence > 0xfff) + pAd->Sequence = 0; + // Before radar detection done, mgmt frame can not be sent but probe req + // Because we need to use probe req to trigger driver to send probe req in passive scan + if ((pHeader_802_11->FC.SubType != SUBTYPE_PROBE_REQ) + && (pAd->CommonCfg.bIEEE80211H == 1) + && (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE)) + { + DBGPRINT(RT_DEBUG_ERROR,("MlmeHardTransmit --> radar detect not in normal mode !!!\n")); + //NdisReleaseSpinLock(&pAd->TxRingLock); + return (NDIS_STATUS_FAILURE); + } + + // + // fill scatter-and-gather buffer list into TXD. Internally created NDIS PACKET + // should always has only one ohysical buffer, and the whole frame size equals + // to the first scatter buffer size + // + + // Initialize TX Descriptor + // For inter-frame gap, the number is for this frame and next frame + // For MLME rate, we will fix as 2Mb to match other vendor's implement +// pAd->CommonCfg.MlmeTransmit.field.MODE = 1; + +// management frame doesn't need encryption. so use RESERVED_WCID no matter u are sending to specific wcid or not. + // Only beacon use Nseq=TRUE. So here we use Nseq=FALSE. + if (pMacEntry == NULL) + { + RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, bInsertTimestamp, FALSE, bAckRequired, FALSE, + 0, RESERVED_WCID, (SrcBufLen - TXWI_SIZE), PID_MGMT, 0, (UCHAR)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); + } + else + { + RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, + bInsertTimestamp, FALSE, bAckRequired, FALSE, + 0, pMacEntry->Aid, (SrcBufLen - TXWI_SIZE), + pMacEntry->MaxHTPhyMode.field.MCS, 0, + (UCHAR)pMacEntry->MaxHTPhyMode.field.MCS, + IFS_BACKOFF, FALSE, &pMacEntry->MaxHTPhyMode); + } + + pAd->TxRing[QueIdx].Cell[SwIdx].pNdisPacket = pPacket; + pAd->TxRing[QueIdx].Cell[SwIdx].pNextNdisPacket = NULL; +// pFirstTxWI->MPDUtotalByteCount = SrcBufLen - TXWI_SIZE; + SrcBufPA = PCI_MAP_SINGLE(pAd, pSrcBufVA, SrcBufLen, 0, PCI_DMA_TODEVICE); + + + RTMPWriteTxDescriptor(pAd, pTxD, TRUE, FIFO_EDCA); + pTxD->LastSec0 = 1; + pTxD->LastSec1 = 1; + pTxD->SDLen0 = SrcBufLen; + pTxD->SDLen1 = 0; + pTxD->SDPtr0 = SrcBufPA; + pTxD->DMADONE = 0; + + + pAd->RalinkCounters.KickTxCount++; + pAd->RalinkCounters.OneSecTxDoneCount++; + + // Increase TX_CTX_IDX, but write to register later. + INC_RING_INDEX(pAd->TxRing[QueIdx].TxCpuIdx, TX_RING_SIZE); + + RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + QueIdx*0x10, pAd->TxRing[QueIdx].TxCpuIdx); + + // Make sure to release MGMT ring resource +// NdisReleaseSpinLock(&pAd->TxRingLock); + + return NDIS_STATUS_SUCCESS; +} + + +NDIS_STATUS MlmeDataHardTransmit( + IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, + IN PNDIS_PACKET pPacket) +{ + if ((pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) + ) + { + return NDIS_STATUS_FAILURE; + } + + return MlmeHardTransmitTxRing(pAd,QueIdx,pPacket); +} + + +/* + ======================================================================== + + Routine Description: + Calculates the duration which is required to transmit out frames + with given size and specified rate. + + Arguments: + pTxD Pointer to transmit descriptor + Ack Setting for Ack requirement bit + Fragment Setting for Fragment bit + RetryMode Setting for retry mode + Ifs Setting for IFS gap + Rate Setting for transmit rate + Service Setting for service + Length Frame length + TxPreamble Short or Long preamble when using CCK rates + QueIdx - 0-3, according to 802.11e/d4.4 June/2003 + + Return Value: + None + + IRQL = PASSIVE_LEVEL + IRQL = DISPATCH_LEVEL + + ======================================================================== +*/ +VOID RTMPWriteTxDescriptor( + IN PRTMP_ADAPTER pAd, + IN PTXD_STRUC pTxD, + IN BOOLEAN bWIV, + IN UCHAR QueueSEL) +{ + // + // Always use Long preamble before verifiation short preamble functionality works well. + // Todo: remove the following line if short preamble functionality works + // + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); + + pTxD->WIV = (bWIV) ? 1: 0; + pTxD->QSEL= (QueueSEL); + //RT2860c?? fixed using EDCA queue for test... We doubt Queue1 has problem. 2006-09-26 Jan + //pTxD->QSEL= FIFO_EDCA; + if (pAd->bGenOneHCCA == TRUE) + pTxD->QSEL= FIFO_HCCA; + pTxD->DMADONE = 0; +} diff --git a/drivers/staging/rt2870/common/cmm_data_2870.c b/drivers/staging/rt2860/common/cmm_data_usb.c similarity index 85% rename from drivers/staging/rt2870/common/cmm_data_2870.c rename to drivers/staging/rt2860/common/cmm_data_usb.c index 3b63a48310f0..bd6f9d8de9b8 100644 --- a/drivers/staging/rt2870/common/cmm_data_2870.c +++ b/drivers/staging/rt2860/common/cmm_data_usb.c @@ -24,12 +24,17 @@ * * ************************************************************************* */ + /* All functions in this file must be USB-depended, or you should out your function in other files. */ -#include "../rt_config.h" + +#ifdef RTMP_MAC_USB + + +#include "../rt_config.h" /* @@ -41,7 +46,7 @@ static inline NDIS_STATUS RtmpUSBCanDoWrite( IN RTMP_ADAPTER *pAd, IN UCHAR QueIdx, - IN HT_TX_CONTEXT *pHTTXContext) + IN HT_TX_CONTEXT *pHTTXContext) { NDIS_STATUS canWrite = NDIS_STATUS_RESOURCES; @@ -292,7 +297,6 @@ USHORT RtmpUSB_WriteSingleTxResource( pTxBlk->Priv = (TXINFO_SIZE + USBDMApktLen); // For TxInfo, the length of USBDMApktLen = TXWI_SIZE + 802.11 header + payload - //PS packets use HCCA queue when dequeue from PS unicast queue (WiFi WPA2 MA9_DT1 for Marvell B STA) RTMPWriteTxInfo(pAd, pTxInfo, (USHORT)(USBDMApktLen), FALSE, FIFO_EDCA, FALSE /*NextValid*/, FALSE); if ((pHTTXContext->CurWritePosition + 3906 + pTxBlk->Priv) > MAX_TXBULK_LIMIT) @@ -583,11 +587,11 @@ VOID RtmpUSBDataKickOut( This function handle RT2870 specific TxDesc and cpu index update and kick the packet out. */ int RtmpUSBMgmtKickOut( - IN RTMP_ADAPTER *pAd, - IN UCHAR QueIdx, + IN RTMP_ADAPTER *pAd, + IN UCHAR QueIdx, IN PNDIS_PACKET pPacket, IN PUCHAR pSrcBufVA, - IN UINT SrcBufLen) + IN UINT SrcBufLen) { PTXINFO_STRUC pTxInfo; ULONG BulkOutSize; @@ -679,6 +683,7 @@ VOID RtmpUSBNullFrameKickOut( pTxWI = (PTXWI_STRUC)&pWirelessPkt[TXINFO_SIZE]; RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0, BSSID_WCID, (sizeof(HEADER_802_11)), 0, 0, (UCHAR)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_HTTXOP, FALSE, &pAd->CommonCfg.MlmeTransmit); + RTMPMoveMemory(&pWirelessPkt[TXWI_SIZE+TXINFO_SIZE], &pAd->NullFrame, sizeof(HEADER_802_11)); pAd->NullContext.BulkOutSize = TXINFO_SIZE + TXWI_SIZE + sizeof(pAd->NullFrame) + 4; @@ -693,6 +698,109 @@ VOID RtmpUSBNullFrameKickOut( } + +/* +======================================================================== +Routine Description: + Get a received packet. + +Arguments: + pAd device control block + pSaveRxD receive descriptor information + *pbReschedule need reschedule flag + *pRxPending pending received packet flag + +Return Value: + the recieved packet + +Note: +======================================================================== +*/ +PNDIS_PACKET GetPacketFromRxRing( + IN PRTMP_ADAPTER pAd, + OUT PRT28XX_RXD_STRUC pSaveRxD, + OUT BOOLEAN *pbReschedule, + IN OUT UINT32 *pRxPending) +{ + PRX_CONTEXT pRxContext; + PNDIS_PACKET pSkb; + PUCHAR pData; + ULONG ThisFrameLen; + ULONG RxBufferLength; + PRXWI_STRUC pRxWI; + + pRxContext = &pAd->RxContext[pAd->NextRxBulkInReadIndex]; + if ((pRxContext->Readable == FALSE) || (pRxContext->InUse == TRUE)) + return NULL; + + RxBufferLength = pRxContext->BulkInOffset - pAd->ReadPosition; + if (RxBufferLength < (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXWI_STRUC) + sizeof(RXINFO_STRUC))) + { + goto label_null; + } + + pData = &pRxContext->TransferBuffer[pAd->ReadPosition]; /* 4KB */ + // The RXDMA field is 4 bytes, now just use the first 2 bytes. The Length including the (RXWI + MSDU + Padding) + ThisFrameLen = *pData + (*(pData+1)<<8); + if (ThisFrameLen == 0) + { + DBGPRINT(RT_DEBUG_TRACE, ("BIRIdx(%d): RXDMALen is zero.[%ld], BulkInBufLen = %ld)\n", + pAd->NextRxBulkInReadIndex, ThisFrameLen, pRxContext->BulkInOffset)); + goto label_null; + } + if ((ThisFrameLen&0x3) != 0) + { + DBGPRINT(RT_DEBUG_ERROR, ("BIRIdx(%d): RXDMALen not multiple of 4.[%ld], BulkInBufLen = %ld)\n", + pAd->NextRxBulkInReadIndex, ThisFrameLen, pRxContext->BulkInOffset)); + goto label_null; + } + + if ((ThisFrameLen + 8)> RxBufferLength) // 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC)) + { + DBGPRINT(RT_DEBUG_TRACE,("BIRIdx(%d):FrameLen(0x%lx) outranges. BulkInLen=0x%lx, remaining RxBufLen=0x%lx, ReadPos=0x%lx\n", + pAd->NextRxBulkInReadIndex, ThisFrameLen, pRxContext->BulkInOffset, RxBufferLength, pAd->ReadPosition)); + + // error frame. finish this loop + goto label_null; + } + + // skip USB frame length field + pData += RT2870_RXDMALEN_FIELD_SIZE; + pRxWI = (PRXWI_STRUC)pData; + if (pRxWI->MPDUtotalByteCount > ThisFrameLen) + { + DBGPRINT(RT_DEBUG_ERROR, ("%s():pRxWIMPDUtotalByteCount(%d) large than RxDMALen(%ld)\n", + __FUNCTION__, pRxWI->MPDUtotalByteCount, ThisFrameLen)); + goto label_null; + } + + // allocate a rx packet + pSkb = dev_alloc_skb(ThisFrameLen); + if (pSkb == NULL) + { + DBGPRINT(RT_DEBUG_ERROR,("%s():Cannot Allocate sk buffer for this Bulk-In buffer!\n", __FUNCTION__)); + goto label_null; + } + + // copy the rx packet + memcpy(skb_put(pSkb, ThisFrameLen), pData, ThisFrameLen); + RTPKT_TO_OSPKT(pSkb)->dev = get_netdev_from_bssid(pAd, BSS0); + RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pSkb), PKTSRC_NDIS); + + // copy RxD + *pSaveRxD = *(PRXINFO_STRUC)(pData + ThisFrameLen); + + // update next packet read position. + pAd->ReadPosition += (ThisFrameLen + RT2870_RXDMALEN_FIELD_SIZE + RXINFO_SIZE); // 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC)) + + return pSkb; + +label_null: + + return NULL; +} + + /* ======================================================================== @@ -775,6 +883,11 @@ NDIS_STATUS RTMPCheckRxError( if (pRxINFO->Decrypted && pRxINFO->CipherErr) { + if (((pRxINFO->CipherErr & 1) == 1) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) + RTMPSendWirelessEvent(pAd, IW_ICV_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); + + if (((pRxINFO->CipherErr & 2) == 2) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) + RTMPSendWirelessEvent(pAd, IW_MIC_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); // // MIC Error // @@ -801,14 +914,32 @@ NDIS_STATUS RTMPCheckRxError( return(NDIS_STATUS_SUCCESS); } +VOID RtmpUsbStaAsicForceWakeupTimeout( + IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3) +{ + RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; + + + if (pAd && pAd->Mlme.AutoWakeupTimerRunning) + { + AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02); + + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); + pAd->Mlme.AutoWakeupTimerRunning = FALSE; + } +} + VOID RT28xxUsbStaAsicForceWakeup( IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) { - AUTO_WAKEUP_STRUC AutoWakeupCfg; + BOOLEAN Canceled; - AutoWakeupCfg.word = 0; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); + if (pAd->Mlme.AutoWakeupTimerRunning) + RTMPCancelTimer(&pAd->Mlme.AutoWakeupTimer, &Canceled); AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02); @@ -819,19 +950,14 @@ VOID RT28xxUsbStaAsicSleepThenAutoWakeup( IN PRTMP_ADAPTER pAd, IN USHORT TbttNumToNextWakeUp) { - AUTO_WAKEUP_STRUC AutoWakeupCfg; + // we have decided to SLEEP, so at least do it for a BEACON period. if (TbttNumToNextWakeUp == 0) TbttNumToNextWakeUp = 1; - AutoWakeupCfg.word = 0; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - - AutoWakeupCfg.field.NumofSleepingTbtt = TbttNumToNextWakeUp - 1; - AutoWakeupCfg.field.EnableAutoWakeup = 1; - AutoWakeupCfg.field.AutoLeadTime = 5; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); + RTMPSetTimer(&pAd->Mlme.AutoWakeupTimer, AUTO_WAKEUP_TIMEOUT); + pAd->Mlme.AutoWakeupTimerRunning = TRUE; AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02); // send POWER-SAVE command to MCU. Timeout 40us. @@ -839,98 +965,4 @@ VOID RT28xxUsbStaAsicSleepThenAutoWakeup( } -VOID RT28xxUsbMlmeRadioOn( - IN PRTMP_ADAPTER pAd) -{ - DBGPRINT(RT_DEBUG_TRACE,("RT28xxUsbMlmeRadioOn()\n")); - - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) - return; - - AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02); - RTMPusecDelay(10000); - - NICResetFromError(pAd); - - // Enable Tx/Rx - RTMPEnableRxTx(pAd); - -#ifdef RT3070 - if (IS_RT3071(pAd)) - { - RT30xxReverseRFSleepModeSetup(pAd); - } -#endif // RT3070 // - - // Clear Radio off flag - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - - RTUSBBulkReceive(pAd); - - // Set LED - RTMPSetLED(pAd, LED_RADIO_ON); -} - -VOID RT28xxUsbMlmeRadioOFF( - IN PRTMP_ADAPTER pAd) -{ - WPDMA_GLO_CFG_STRUC GloCfg; - UINT32 Value, i; - - DBGPRINT(RT_DEBUG_TRACE,("RT28xxUsbMlmeRadioOFF()\n")); - - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) - return; - - // Set LED - RTMPSetLED(pAd, LED_RADIO_OFF); - // Set Radio off flag - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - - { - // Link down first if any association exists - if (INFRA_ON(pAd) || ADHOC_ON(pAd)) - LinkDown(pAd, FALSE); - RTMPusecDelay(10000); - - //========================================== - // Clean up old bss table - BssTableInit(&pAd->ScanTab); - } - - if (pAd->CommonCfg.BBPCurrentBW == BW_40) - { - // Must using 40MHz. - AsicTurnOffRFClk(pAd, pAd->CommonCfg.CentralChannel); - } - else - { - // Must using 20MHz. - AsicTurnOffRFClk(pAd, pAd->CommonCfg.Channel); - } - - // Disable Tx/Rx DMA - RTUSBReadMACRegister(pAd, WPDMA_GLO_CFG, &GloCfg.word); // disable DMA - GloCfg.field.EnableTxDMA = 0; - GloCfg.field.EnableRxDMA = 0; - RTUSBWriteMACRegister(pAd, WPDMA_GLO_CFG, GloCfg.word); // abort all TX rings - - // Waiting for DMA idle - i = 0; - do - { - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); - if ((GloCfg.field.TxDMABusy == 0) && (GloCfg.field.RxDMABusy == 0)) - break; - - RTMPusecDelay(1000); - }while (i++ < 100); - - // Disable MAC Tx/Rx - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value &= (0xfffffff3); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - - AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02); -} - +#endif // RTMP_MAC_USB // diff --git a/drivers/staging/rt2860/common/cmm_info.c b/drivers/staging/rt2860/common/cmm_info.c index 019cc4474ce8..49e9bdfad3da 100644 --- a/drivers/staging/rt2860/common/cmm_info.c +++ b/drivers/staging/rt2860/common/cmm_info.c @@ -23,154 +23,154 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * * ************************************************************************* -*/ + */ #include #include "../rt_config.h" INT Show_SSID_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_WirelessMode_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_TxBurst_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_TxPreamble_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_TxPower_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_Channel_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_BGProtection_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_RTSThreshold_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_FragThreshold_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_HtBw_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_HtMcs_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_HtGi_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_HtOpMode_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_HtExtcha_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_HtMpduDensity_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_HtBaWinSize_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_HtRdg_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_HtAmsdu_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_HtAutoBa_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_CountryRegion_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_CountryRegionABand_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_CountryCode_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); #ifdef AGGREGATION_SUPPORT INT Show_PktAggregate_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); #endif // AGGREGATION_SUPPORT // #ifdef WMM_SUPPORT INT Show_WmmCapable_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); #endif // WMM_SUPPORT // INT Show_IEEE80211H_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_NetworkType_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_AuthMode_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_EncrypType_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_DefaultKeyID_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_Key1_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_Key2_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_Key3_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_Key4_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); INT Show_WPAPSK_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf); + OUT PSTRING pBuf); static struct { - CHAR *name; - INT (*show_proc)(PRTMP_ADAPTER pAdapter, PUCHAR arg); + PSTRING name; + INT (*show_proc)(PRTMP_ADAPTER pAdapter, PSTRING arg); } *PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC, RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC[] = { {"SSID", Show_SSID_Proc}, {"WirelessMode", Show_WirelessMode_Proc}, @@ -224,8 +224,9 @@ static struct { */ INT Set_DriverVersion_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { + DBGPRINT(RT_DEBUG_TRACE, ("Driver version-%s\n", STA_DRIVER_VERSION)); return TRUE; @@ -242,32 +243,14 @@ INT Set_DriverVersion_Proc( */ INT Set_CountryRegion_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { - ULONG region; + int retval; - region = simple_strtol(arg, 0, 10); - // Country can be set only when EEPROM not programmed - if (pAd->CommonCfg.CountryRegion & 0x80) - { - DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegion_Proc::parameter of CountryRegion in eeprom is programmed \n")); + retval = RT_CfgSetCountryRegion(pAd, arg, BAND_24G); + if (retval == FALSE) return FALSE; - } - - if((region >= 0) && (region <= REGION_MAXIMUM_BG_BAND)) - { - pAd->CommonCfg.CountryRegion = (UCHAR) region; - } - else if (region == REGION_31_BG_BAND) - { - pAd->CommonCfg.CountryRegion = (UCHAR) region; - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegion_Proc::parameters out of range\n")); - return FALSE; - } // if set country region, driver needs to be reset BuildChannelList(pAd); @@ -288,28 +271,14 @@ INT Set_CountryRegion_Proc( */ INT Set_CountryRegionABand_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { - ULONG region; - - region = simple_strtol(arg, 0, 10); + int retval; - // Country can be set only when EEPROM not programmed - if (pAd->CommonCfg.CountryRegionForABand & 0x80) - { - DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegionABand_Proc::parameter of CountryRegion in eeprom is programmed \n")); - return FALSE; - } - if((region >= 0) && (region <= REGION_MAXIMUM_A_BAND)) - { - pAd->CommonCfg.CountryRegionForABand = (UCHAR) region; - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegionABand_Proc::parameters out of range\n")); + retval = RT_CfgSetCountryRegion(pAd, arg, BAND_5G); + if (retval == FALSE) return FALSE; - } // if set country region, driver needs to be reset BuildChannelList(pAd); @@ -329,22 +298,17 @@ INT Set_CountryRegionABand_Proc( */ INT Set_WirelessMode_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { - ULONG WirelessMode; INT success = TRUE; - WirelessMode = simple_strtol(arg, 0, 10); - + success = RT_CfgSetWirelessMode(pAd, arg); + if (success) { - INT MaxPhyMode = PHY_11G; - - MaxPhyMode = PHY_11N_5G; - - if (WirelessMode <= MaxPhyMode) { - RTMPSetPhyMode(pAd, WirelessMode); + LONG WirelessMode = pAd->CommonCfg.PhyMode; + RTMPSetPhyMode(pAd, WirelessMode); if (WirelessMode >= PHY_11ABGN_MIXED) { pAd->CommonCfg.BACapability.field.AutoBA = TRUE; @@ -364,17 +328,10 @@ INT Set_WirelessMode_Proc( AsicEnableIbssSync(pAd); // copy to on-chip memory } } - else - { - success = FALSE; - } - } // it is needed to set SSID to take effect - if (success == TRUE) - { SetCommonHT(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("Set_WirelessMode_Proc::(=%ld)\n", WirelessMode)); + DBGPRINT(RT_DEBUG_TRACE, ("Set_WirelessMode_Proc::(=%d)\n", pAd->CommonCfg.PhyMode)); } else { @@ -394,7 +351,7 @@ INT Set_WirelessMode_Proc( */ INT Set_Channel_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { INT success = TRUE; UCHAR Channel; @@ -451,24 +408,18 @@ INT Set_Channel_Proc( */ INT Set_ShortSlot_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { - ULONG ShortSlot; - - ShortSlot = simple_strtol(arg, 0, 10); - - if (ShortSlot == 1) - pAd->CommonCfg.bUseShortSlotTime = TRUE; - else if (ShortSlot == 0) - pAd->CommonCfg.bUseShortSlotTime = FALSE; - else - return FALSE; //Invalid argument + int retval; + retval = RT_CfgSetShortSlot(pAd, arg); + if (retval == TRUE) DBGPRINT(RT_DEBUG_TRACE, ("Set_ShortSlot_Proc::(ShortSlot=%d)\n", pAd->CommonCfg.bUseShortSlotTime)); - return TRUE; + return retval; } + /* ========================================================================== Description: @@ -479,12 +430,12 @@ INT Set_ShortSlot_Proc( */ INT Set_TxPower_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { - ULONG TxPower; + LONG TxPower; INT success = FALSE; - TxPower = (ULONG) simple_strtol(arg, 0, 10); + TxPower = simple_strtol(arg, 0, 10); if (TxPower <= 100) { { @@ -511,7 +462,7 @@ INT Set_TxPower_Proc( */ INT Set_BGProtection_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { switch (simple_strtol(arg, 0, 10)) { @@ -544,7 +495,7 @@ INT Set_BGProtection_Proc( */ INT Set_TxPreamble_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { RT_802_11_PREAMBLE Preamble; @@ -585,7 +536,7 @@ INT Set_TxPreamble_Proc( */ INT Set_RTSThreshold_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { NDIS_802_11_RTS_THRESHOLD RtsThresh; @@ -613,7 +564,7 @@ INT Set_RTSThreshold_Proc( */ INT Set_FragThreshold_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh; @@ -657,9 +608,9 @@ INT Set_FragThreshold_Proc( */ INT Set_TxBurst_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { - ULONG TxBurst; + LONG TxBurst; TxBurst = simple_strtol(arg, 0, 10); if (TxBurst == 1) @@ -685,9 +636,9 @@ INT Set_TxBurst_Proc( */ INT Set_PktAggregate_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { - ULONG aggre; + LONG aggre; aggre = simple_strtol(arg, 0, 10); @@ -716,9 +667,9 @@ INT Set_PktAggregate_Proc( */ INT Set_IEEE80211H_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { - ULONG ieee80211h; + LONG ieee80211h; ieee80211h = simple_strtol(arg, 0, 10); @@ -746,7 +697,7 @@ INT Set_IEEE80211H_Proc( */ INT Set_Debug_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { DBGPRINT(RT_DEBUG_TRACE, ("==> Set_Debug_Proc *******************\n")); @@ -761,10 +712,11 @@ INT Set_Debug_Proc( INT Show_DescInfo_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { -#ifdef RT2860 +#ifdef RTMP_MAC_PCI INT i, QueIdx=0; +// ULONG RegValue; PRT28XX_RXD_STRUC pRxD; PTXD_STRUC pTxD; PRTMP_TX_RING pTxRing = &pAd->TxRing[QueIdx]; @@ -774,27 +726,28 @@ INT Show_DescInfo_Proc( for(i=0;iCell[i].AllocVa; - printk("Desc #%d\n",i); - hex_dump("Tx Descriptor", (char *)pTxD, 16); - printk("pTxD->DMADONE = %x\n", pTxD->DMADONE); + DBGPRINT(RT_DEBUG_OFF, ("Desc #%d\n",i)); + hex_dump("Tx Descriptor", (PUCHAR)pTxD, 16); + DBGPRINT(RT_DEBUG_OFF, ("pTxD->DMADONE = %x\n", pTxD->DMADONE)); } - printk("---------------------------------------------------\n"); + DBGPRINT(RT_DEBUG_OFF, ("---------------------------------------------------\n")); for(i=0;iCell[i].AllocVa; - printk("Desc #%d\n",i); - hex_dump("Mgmt Descriptor", (char *)pTxD, 16); - printk("pMgmt->DMADONE = %x\n", pTxD->DMADONE); + DBGPRINT(RT_DEBUG_OFF, ("Desc #%d\n",i)); + hex_dump("Mgmt Descriptor", (PUCHAR)pTxD, 16); + DBGPRINT(RT_DEBUG_OFF, ("pMgmt->DMADONE = %x\n", pTxD->DMADONE)); } - printk("---------------------------------------------------\n"); + DBGPRINT(RT_DEBUG_OFF, ("---------------------------------------------------\n")); for(i=0;iCell[i].AllocVa; - printk("Desc #%d\n",i); - hex_dump("Rx Descriptor", (char *)pRxD, 16); - printk("pRxD->DDONE = %x\n", pRxD->DDONE); + DBGPRINT(RT_DEBUG_OFF, ("Desc #%d\n",i)); + hex_dump("Rx Descriptor", (PUCHAR)pRxD, 16); + DBGPRINT(RT_DEBUG_OFF, ("pRxD->DDONE = %x\n", pRxD->DDONE)); } -#endif /* RT2860 */ +#endif // RTMP_MAC_PCI // + return TRUE; } @@ -813,8 +766,11 @@ INT Show_DescInfo_Proc( */ INT Set_ResetStatCounter_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { + //UCHAR i; + //MAC_TABLE_ENTRY *pEntry; + DBGPRINT(RT_DEBUG_TRACE, ("==>Set_ResetStatCounter_Proc\n")); // add the most up-to-date h/w raw counters into software counters @@ -824,9 +780,33 @@ INT Set_ResetStatCounter_Proc( NdisZeroMemory(&pAd->Counters8023, sizeof(COUNTER_802_3)); NdisZeroMemory(&pAd->RalinkCounters, sizeof(COUNTER_RALINK)); + // Reset HotSpot counter + + return TRUE; } +/* + ======================================================================== + + Routine Description: + Add WPA key process. + In Adhoc WPANONE, bPairwise = 0; KeyIdx = 0; + + Arguments: + pAd Pointer to our adapter + pBuf Pointer to the where the key stored + + Return Value: + NDIS_SUCCESS Add key successfully + + IRQL = DISPATCH_LEVEL + + Note: + + ======================================================================== +*/ + BOOLEAN RTMPCheckStrPrintAble( IN CHAR *pInPutStr, IN UCHAR strLen) @@ -1100,7 +1080,7 @@ VOID RTMPWPARemoveAllKeys( UCHAR i; DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus)); - + RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); // For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after // Link up. And it will be replaced if user changed it. if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA) @@ -1122,9 +1102,33 @@ VOID RTMPWPARemoveAllKeys( AsicRemoveSharedKeyEntry(pAd, BSS0, i); } - + RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); } + +/* + ======================================================================== + + Routine Description: + As STA's BSSID is a WC too, it uses shared key table. + This function write correct unicast TX key to ASIC WCID. + And we still make a copy in our MacTab.Content[BSSID_WCID].PairwiseKey. + Caller guarantee TKIP/AES always has keyidx = 0. (pairwise key) + Caller guarantee WEP calls this function when set Txkey, default key index=0~3. + + Arguments: + pAd Pointer to our adapter + pKey Pointer to the where the key stored + + Return Value: + NDIS_SUCCESS Add key successfully + + IRQL = DISPATCH_LEVEL + + Note: + + ======================================================================== +*/ /* ======================================================================== Routine Description: @@ -1147,6 +1151,11 @@ VOID RTMPSetPhyMode( INT i; // the selected phymode must be supported by the RF IC encoded in E2PROM + // if no change, do nothing + /* bug fix + if (pAd->CommonCfg.PhyMode == phymode) + return; + */ pAd->CommonCfg.PhyMode = (UCHAR)phymode; DBGPRINT(RT_DEBUG_TRACE,("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", pAd->CommonCfg.PhyMode, pAd->CommonCfg.Channel)); @@ -1466,7 +1475,10 @@ VOID RTMPSetHT( } AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm); + { RTMPSetIndividualHT(pAd, 0); + } + } /* @@ -1657,12 +1669,8 @@ VOID RTMPAddWcidAttributeEntry( // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists. // 2. In Infra mode, the AID:1 MUST be wcid of infra STA. // the AID:2~ assign to mesh link entry. - if (pEntry && ADHOC_ON(pAd)) + if (pEntry) Wcid = pEntry->Aid; - else if (pEntry && INFRA_ON(pAd)) - { - Wcid = BSSID_WCID; - } else Wcid = MCAST_WCID; } @@ -1697,12 +1705,12 @@ VOID RTMPAddWcidAttributeEntry( } // For key index and ext IV bit, so only need to update the position(offset+3). -#ifdef RT2860 +#ifdef RTMP_MAC_PCI RTMP_IO_WRITE8(pAd, offset+3, IVEIV); -#endif -#ifdef RT2870 +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB RTUSBMultiWrite_OneByte(pAd, offset+3, &IVEIV); -#endif // RT2870 // +#endif // RTMP_MAC_USB // DBGPRINT(RT_DEBUG_TRACE,("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",Wcid, KeyIdx, CipherName[CipherAlg])); DBGPRINT(RT_DEBUG_TRACE,(" WCIDAttri = 0x%x \n", WCIDAttri)); @@ -1723,7 +1731,7 @@ Arguments: Note: ========================================================================== */ -CHAR *GetEncryptType(CHAR enc) +PSTRING GetEncryptType(CHAR enc) { if(enc == Ndis802_11WEPDisabled) return "NONE"; @@ -1739,7 +1747,7 @@ CHAR *GetEncryptType(CHAR enc) return "UNKNOW"; } -CHAR *GetAuthMode(CHAR auth) +PSTRING GetAuthMode(CHAR auth) { if(auth == Ndis802_11AuthModeOpen) return "OPEN"; @@ -1783,71 +1791,133 @@ CHAR *GetAuthMode(CHAR auth) 3.) UI needs to prepare at least 4096bytes to get the results ========================================================================== */ -#define LINE_LEN (4+33+20+8+10+9+7+3) // Channel+SSID+Bssid+WepStatus+AuthMode+Signal+WiressMode+NetworkType -VOID RTMPIoctlGetSiteSurvey( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq) +#define LINE_LEN (4+33+20+23+9+7+7+3) // Channel+SSID+Bssid+Security+Signal+WiressMode+ExtCh+NetworkType +VOID RTMPCommSiteSurveyData( + IN PSTRING msg, + IN PBSS_ENTRY pBss) { - CHAR *msg; - INT i=0; - INT WaitCnt; - INT Status=0; - CHAR Ssid[MAX_LEN_OF_SSID +1]; - INT Rssi = 0, max_len = LINE_LEN; + INT Rssi = 0; UINT Rssi_Quality = 0; NDIS_802_11_NETWORK_TYPE wireless_mode; + CHAR Ssid[MAX_LEN_OF_SSID +1]; + STRING SecurityStr[32] = {0}; + NDIS_802_11_ENCRYPTION_STATUS ap_cipher = Ndis802_11EncryptionDisabled; + NDIS_802_11_AUTHENTICATION_MODE ap_auth_mode = Ndis802_11AuthModeOpen; - os_alloc_mem(NULL, (PUCHAR *)&msg, sizeof(CHAR)*((MAX_LEN_OF_BSS_TABLE)*max_len)); - - if (msg == NULL) - { - DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - msg memory alloc fail.\n")); - return; - } - - memset(msg, 0 ,(MAX_LEN_OF_BSS_TABLE)*max_len ); memset(Ssid, 0 ,(MAX_LEN_OF_SSID +1)); - sprintf(msg,"%s","\n"); - sprintf(msg+strlen(msg),"%-4s%-33s%-20s%-8s%-10s%-9s%-7s%-3s\n", - "Ch", "SSID", "BSSID", "Enc", "Auth", "Siganl(%)", "W-Mode", " NT"); - - WaitCnt = 0; - pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE; - - while ((ScanRunning(pAdapter) == TRUE) && (WaitCnt++ < 200)) - OS_WAIT(500); - - for(i=0; iScanTab.BssNr ;i++) - { - if( pAdapter->ScanTab.BssEntry[i].Channel==0) - break; - - if((strlen(msg)+max_len ) >= IW_SCAN_MAX_DATA) - break; //Channel - sprintf(msg+strlen(msg),"%-4d", pAdapter->ScanTab.BssEntry[i].Channel); + sprintf(msg+strlen(msg),"%-4d", pBss->Channel); //SSID - memcpy(Ssid, pAdapter->ScanTab.BssEntry[i].Ssid, pAdapter->ScanTab.BssEntry[i].SsidLen); - Ssid[pAdapter->ScanTab.BssEntry[i].SsidLen] = '\0'; + memcpy(Ssid, pBss->Ssid, pBss->SsidLen); + Ssid[pBss->SsidLen] = '\0'; sprintf(msg+strlen(msg),"%-33s", Ssid); //BSSID sprintf(msg+strlen(msg),"%02x:%02x:%02x:%02x:%02x:%02x ", - pAdapter->ScanTab.BssEntry[i].Bssid[0], - pAdapter->ScanTab.BssEntry[i].Bssid[1], - pAdapter->ScanTab.BssEntry[i].Bssid[2], - pAdapter->ScanTab.BssEntry[i].Bssid[3], - pAdapter->ScanTab.BssEntry[i].Bssid[4], - pAdapter->ScanTab.BssEntry[i].Bssid[5]); - //Encryption Type - sprintf(msg+strlen(msg),"%-8s",GetEncryptType(pAdapter->ScanTab.BssEntry[i].WepStatus)); - //Authentication Mode - if (pAdapter->ScanTab.BssEntry[i].WepStatus == Ndis802_11WEPEnabled) - sprintf(msg+strlen(msg),"%-10s", "UNKNOW"); + pBss->Bssid[0], + pBss->Bssid[1], + pBss->Bssid[2], + pBss->Bssid[3], + pBss->Bssid[4], + pBss->Bssid[5]); + + //Security + if ((Ndis802_11AuthModeWPA <= pBss->AuthMode) && + (pBss->AuthMode <= Ndis802_11AuthModeWPA1PSKWPA2PSK)) + { + if (pBss->AuthModeAux == Ndis802_11AuthModeWPANone) + { + ap_auth_mode = pBss->AuthMode; + if (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled) + ap_cipher = pBss->WPA.PairCipher; + else + ap_cipher = Ndis802_11Encryption4Enabled; + } + else if (pBss->AuthModeAux == Ndis802_11AuthModeOpen) + { + ap_auth_mode = pBss->AuthMode; + if ((ap_auth_mode == Ndis802_11AuthModeWPA) || + (ap_auth_mode == Ndis802_11AuthModeWPAPSK)) + { + if (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled) + ap_cipher = pBss->WPA.PairCipher; + else + ap_cipher = Ndis802_11Encryption4Enabled; + } + else if ((ap_auth_mode == Ndis802_11AuthModeWPA2) || + (ap_auth_mode == Ndis802_11AuthModeWPA2PSK)) + { + if (pBss->WPA2.PairCipherAux == Ndis802_11WEPDisabled) + ap_cipher = pBss->WPA2.PairCipher; + else + ap_cipher = Ndis802_11Encryption4Enabled; + } + } + else if ((pBss->AuthMode == Ndis802_11AuthModeWPAPSK) || + (pBss->AuthMode == Ndis802_11AuthModeWPA2PSK)) + { + if ((pBss->AuthModeAux == Ndis802_11AuthModeWPAPSK) || + (pBss->AuthModeAux == Ndis802_11AuthModeWPA2PSK)) + ap_auth_mode = Ndis802_11AuthModeWPA1PSKWPA2PSK; + else + ap_auth_mode = pBss->AuthMode; + + if (pBss->WPA.PairCipher != pBss->WPA2.PairCipher) + ap_cipher = Ndis802_11Encryption4Enabled; + else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && + (pBss->WPA.PairCipherAux != pBss->WPA2.PairCipherAux)) + ap_cipher = Ndis802_11Encryption4Enabled; + else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && + (pBss->WPA.PairCipherAux == pBss->WPA2.PairCipherAux) && + (pBss->WPA.PairCipherAux != Ndis802_11WEPDisabled)) + ap_cipher = Ndis802_11Encryption4Enabled; + else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && + (pBss->WPA.PairCipherAux == pBss->WPA2.PairCipherAux) && + (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled)) + ap_cipher = pBss->WPA.PairCipher; + } + else if ((pBss->AuthMode == Ndis802_11AuthModeWPA) || + (pBss->AuthMode == Ndis802_11AuthModeWPA2)) + { + if ((pBss->AuthModeAux == Ndis802_11AuthModeWPA) || + (pBss->AuthMode == Ndis802_11AuthModeWPA2)) + ap_auth_mode = Ndis802_11AuthModeWPA1WPA2; + else + ap_auth_mode = pBss->AuthMode; + + if (pBss->WPA.PairCipher != pBss->WPA2.PairCipher) + ap_cipher = Ndis802_11Encryption4Enabled; + else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && + (pBss->WPA.PairCipherAux != pBss->WPA2.PairCipherAux)) + ap_cipher = Ndis802_11Encryption4Enabled; + else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && + (pBss->WPA.PairCipherAux == pBss->WPA2.PairCipherAux) && + (pBss->WPA.PairCipherAux != Ndis802_11WEPDisabled)) + ap_cipher = Ndis802_11Encryption4Enabled; + else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && + (pBss->WPA.PairCipherAux == pBss->WPA2.PairCipherAux) && + (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled)) + ap_cipher = pBss->WPA.PairCipher; + } + + sprintf(SecurityStr, "%s/%s", GetAuthMode((CHAR)ap_auth_mode), GetEncryptType((CHAR)ap_cipher)); + } + else + { + ap_auth_mode = pBss->AuthMode; + ap_cipher = pBss->WepStatus; + if (ap_cipher == Ndis802_11WEPDisabled) + sprintf(SecurityStr, "NONE"); + else if (ap_cipher == Ndis802_11WEPEnabled) + sprintf(SecurityStr, "WEP"); else - sprintf(msg+strlen(msg),"%-10s",GetAuthMode(pAdapter->ScanTab.BssEntry[i].AuthMode)); + sprintf(SecurityStr, "%s/%s", GetAuthMode((CHAR)ap_auth_mode), GetEncryptType((CHAR)ap_cipher)); + } + + sprintf(msg+strlen(msg), "%-23s", SecurityStr); + // Rssi - Rssi = (INT)pAdapter->ScanTab.BssEntry[i].Rssi; + Rssi = (INT)pBss->Rssi; if (Rssi >= -50) Rssi_Quality = 100; else if (Rssi >= -80) // between -50 ~ -80dbm @@ -1858,7 +1928,7 @@ VOID RTMPIoctlGetSiteSurvey( Rssi_Quality = 0; sprintf(msg+strlen(msg),"%-9d", Rssi_Quality); // Wireless Mode - wireless_mode = NetworkTypeInUseSanity(&pAdapter->ScanTab.BssEntry[i]); + wireless_mode = NetworkTypeInUseSanity(pBss); if (wireless_mode == Ndis802_11FH || wireless_mode == Ndis802_11DS) sprintf(msg+strlen(msg),"%-7s", "11b"); @@ -1872,13 +1942,79 @@ VOID RTMPIoctlGetSiteSurvey( sprintf(msg+strlen(msg),"%-7s", "11b/g/n"); else sprintf(msg+strlen(msg),"%-7s", "unknow"); + + // Ext Channel + if (pBss->AddHtInfoLen > 0) + { + if (pBss->AddHtInfo.AddHtInfo.ExtChanOffset == EXTCHA_ABOVE) + sprintf(msg+strlen(msg),"%-7s", " ABOVE"); + else if (pBss->AddHtInfo.AddHtInfo.ExtChanOffset == EXTCHA_BELOW) + sprintf(msg+strlen(msg),"%-7s", " BELOW"); + else + sprintf(msg+strlen(msg),"%-7s", " NONE"); + } + else + { + sprintf(msg+strlen(msg),"%-7s", " NONE"); + } + //Network Type - if (pAdapter->ScanTab.BssEntry[i].BssType == BSS_ADHOC) + if (pBss->BssType == BSS_ADHOC) sprintf(msg+strlen(msg),"%-3s", " Ad"); else sprintf(msg+strlen(msg),"%-3s", " In"); sprintf(msg+strlen(msg),"\n"); + + return; +} + +VOID RTMPIoctlGetSiteSurvey( + IN PRTMP_ADAPTER pAdapter, + IN struct iwreq *wrq) +{ + PSTRING msg; + INT i=0; + INT WaitCnt; + INT Status=0; + INT max_len = LINE_LEN; + PBSS_ENTRY pBss; + + + os_alloc_mem(NULL, (PUCHAR *)&msg, sizeof(CHAR)*((MAX_LEN_OF_BSS_TABLE)*max_len)); + + if (msg == NULL) + { + DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - msg memory alloc fail.\n")); + return; + } + + memset(msg, 0 ,(MAX_LEN_OF_BSS_TABLE)*max_len ); + sprintf(msg,"%s","\n"); + sprintf(msg+strlen(msg),"%-4s%-33s%-20s%-23s%-9s%-7s%-7s%-3s\n", + "Ch", "SSID", "BSSID", "Security", "Siganl(%)", "W-Mode", " ExtCH"," NT"); + + + + WaitCnt = 0; + pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE; + while ((ScanRunning(pAdapter) == TRUE) && (WaitCnt++ < 200)) + OS_WAIT(500); + + for(i=0; iScanTab.BssNr ;i++) + { + pBss = &pAdapter->ScanTab.BssEntry[i]; + + if( pBss->Channel==0) + break; + + if((strlen(msg)+max_len ) >= IW_SCAN_MAX_DATA) + break; + + + RTMPCommSiteSurveyData(msg, pBss); + + } pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE; @@ -1933,7 +2069,12 @@ VOID RTMPIoctlGetMacTable( DBGPRINT(RT_DEBUG_TRACE, ("%s: copy_to_user() fail\n", __func__)); } - msg = (CHAR *) kmalloc(sizeof(CHAR)*(MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN), MEM_ALLOC_FLAG); + msg = kmalloc(sizeof(CHAR)*(MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN), MEM_ALLOC_FLAG); + if (msg == NULL) + { + DBGPRINT(RT_DEBUG_ERROR, ("%s():Alloc memory failed\n", __func__)); + return; + } memset(msg, 0 ,MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN ); sprintf(msg,"%s","\n"); sprintf(msg+strlen(msg),"%-14s%-4s%-4s%-10s%-10s%-10s%-6s%-6s\n", @@ -1968,12 +2109,14 @@ VOID RTMPIoctlGetMacTable( kfree(msg); } + INT Set_BASetup_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { UCHAR mac[6], tid; - char *token, sepValue[] = ":", DASH = '-'; + PSTRING token; + STRING sepValue[] = ":", DASH = '-'; INT i; MAC_TABLE_ENTRY *pEntry; @@ -1982,6 +2125,7 @@ INT Set_BASetup_Proc( =>The six 2 digit hex-decimal number previous are the Mac address, =>The seventh decimal number is the tid value. */ + //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg)); if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format. return FALSE; @@ -1989,7 +2133,7 @@ INT Set_BASetup_Proc( token = strchr(arg, DASH); if ((token != NULL) && (strlen(token)>1)) { - tid = simple_strtol((token+1), 0, 10); + tid = (UCHAR) simple_strtol((token+1), 0, 10); if (tid > 15) return FALSE; @@ -1998,18 +2142,18 @@ INT Set_BASetup_Proc( { if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1)))) return FALSE; - AtoH(token, (PUCHAR)(&mac[i]), 1); + AtoH(token, (&mac[i]), 1); } if(i != 6) return FALSE; - printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x\n", mac[0], mac[1], - mac[2], mac[3], mac[4], mac[5], tid); + DBGPRINT(RT_DEBUG_OFF, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x\n", + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], tid)); - pEntry = MacTableLookup(pAd, mac); + pEntry = MacTableLookup(pAd, (PUCHAR) mac); if (pEntry) { - printk("\nSetup BA Session: Tid = %d\n", tid); + DBGPRINT(RT_DEBUG_OFF, ("\nSetup BA Session: Tid = %d\n", tid)); BAOriSessionSetUp(pAd, pEntry, tid, 0, 100, TRUE); } @@ -2022,7 +2166,7 @@ INT Set_BASetup_Proc( INT Set_BADecline_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG bBADecline; @@ -2048,13 +2192,15 @@ INT Set_BADecline_Proc( INT Set_BAOriTearDown_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { UCHAR mac[6], tid; - char *token, sepValue[] = ":", DASH = '-'; + PSTRING token; + STRING sepValue[] = ":", DASH = '-'; INT i; MAC_TABLE_ENTRY *pEntry; + //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg)); /* The BAOriTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d, =>The six 2 digit hex-decimal number previous are the Mac address, @@ -2075,18 +2221,18 @@ INT Set_BAOriTearDown_Proc( { if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1)))) return FALSE; - AtoH(token, (PUCHAR)(&mac[i]), 1); + AtoH(token, (&mac[i]), 1); } if(i != 6) return FALSE; - printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1], - mac[2], mac[3], mac[4], mac[5], tid); + DBGPRINT(RT_DEBUG_OFF, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], tid)); - pEntry = MacTableLookup(pAd, mac); + pEntry = MacTableLookup(pAd, (PUCHAR) mac); if (pEntry) { - printk("\nTear down Ori BA Session: Tid = %d\n", tid); + DBGPRINT(RT_DEBUG_OFF, ("\nTear down Ori BA Session: Tid = %d\n", tid)); BAOriSessionTearDown(pAd, pEntry->Aid, tid, FALSE, TRUE); } @@ -2099,14 +2245,15 @@ INT Set_BAOriTearDown_Proc( INT Set_BARecTearDown_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { UCHAR mac[6], tid; - char *token, sepValue[] = ":", DASH = '-'; + PSTRING token; + STRING sepValue[] = ":", DASH = '-'; INT i; MAC_TABLE_ENTRY *pEntry; - //printk("\n%s\n", arg); + //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg)); /* The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d, =>The six 2 digit hex-decimal number previous are the Mac address, @@ -2127,18 +2274,18 @@ INT Set_BARecTearDown_Proc( { if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1)))) return FALSE; - AtoH(token, (PUCHAR)(&mac[i]), 1); + AtoH(token, (&mac[i]), 1); } if(i != 6) return FALSE; - printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1], - mac[2], mac[3], mac[4], mac[5], tid); + DBGPRINT(RT_DEBUG_OFF, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], tid)); - pEntry = MacTableLookup(pAd, mac); + pEntry = MacTableLookup(pAd, (PUCHAR) mac); if (pEntry) { - printk("\nTear down Rec BA Session: Tid = %d\n", tid); + DBGPRINT(RT_DEBUG_OFF, ("\nTear down Rec BA Session: Tid = %d\n", tid)); BARecSessionTearDown(pAd, pEntry->Aid, tid, FALSE); } @@ -2151,7 +2298,7 @@ INT Set_BARecTearDown_Proc( INT Set_HtBw_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG HtBw; @@ -2172,7 +2319,7 @@ INT Set_HtBw_Proc( INT Set_HtMcs_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG HtMcs, Mcs_tmp; BOOLEAN bAutoRate = FALSE; @@ -2226,7 +2373,7 @@ INT Set_HtMcs_Proc( INT Set_HtGi_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG HtGi; @@ -2249,7 +2396,7 @@ INT Set_HtGi_Proc( INT Set_HtTxBASize_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { UCHAR Size; @@ -2265,10 +2412,32 @@ INT Set_HtTxBASize_Proc( return TRUE; } +INT Set_HtDisallowTKIP_Proc( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg) +{ + ULONG Value; + + Value = simple_strtol(arg, 0, 10); + + if (Value == 1) + { + pAd->CommonCfg.HT_DisallowTKIP = TRUE; + } + else + { + pAd->CommonCfg.HT_DisallowTKIP = FALSE; + } + + DBGPRINT(RT_DEBUG_TRACE, ("Set_HtDisallowTKIP_Proc ::%s\n", + (pAd->CommonCfg.HT_DisallowTKIP == TRUE) ? "enabled" : "disabled")); + + return TRUE; +} INT Set_HtOpMode_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG Value; @@ -2292,7 +2461,7 @@ INT Set_HtOpMode_Proc( INT Set_HtStbc_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG Value; @@ -2315,7 +2484,7 @@ INT Set_HtStbc_Proc( INT Set_HtHtc_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG Value; @@ -2335,7 +2504,7 @@ INT Set_HtHtc_Proc( INT Set_HtExtcha_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG Value; @@ -2358,7 +2527,7 @@ INT Set_HtExtcha_Proc( INT Set_HtMpduDensity_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG Value; @@ -2378,7 +2547,7 @@ INT Set_HtMpduDensity_Proc( INT Set_HtBaWinSize_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG Value; @@ -2405,7 +2574,7 @@ INT Set_HtBaWinSize_Proc( INT Set_HtRdg_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG Value; @@ -2430,7 +2599,7 @@ INT Set_HtRdg_Proc( INT Set_HtLinkAdapt_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG Value; @@ -2452,7 +2621,7 @@ INT Set_HtLinkAdapt_Proc( INT Set_HtAmsdu_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG Value; @@ -2473,7 +2642,7 @@ INT Set_HtAmsdu_Proc( INT Set_HtAutoBa_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG Value; @@ -2504,7 +2673,7 @@ INT Set_HtAutoBa_Proc( INT Set_HtProtect_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG Value; @@ -2523,14 +2692,15 @@ INT Set_HtProtect_Proc( INT Set_SendPSMPAction_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { UCHAR mac[6], mode; - char *token, sepValue[] = ":", DASH = '-'; + PSTRING token; + STRING sepValue[] = ":", DASH = '-'; INT i; MAC_TABLE_ENTRY *pEntry; - //printk("\n%s\n", arg); + //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg)); /* The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d, =>The six 2 digit hex-decimal number previous are the Mac address, @@ -2551,18 +2721,18 @@ INT Set_SendPSMPAction_Proc( { if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1)))) return FALSE; - AtoH(token, (PUCHAR)(&mac[i]), 1); + AtoH(token, (&mac[i]), 1); } if(i != 6) return FALSE; - printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1], - mac[2], mac[3], mac[4], mac[5], mode); + DBGPRINT(RT_DEBUG_OFF, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], mode)); pEntry = MacTableLookup(pAd, mac); if (pEntry) { - printk("\nSendPSMPAction MIPS mode = %d\n", mode); + DBGPRINT(RT_DEBUG_OFF, ("\nSendPSMPAction MIPS mode = %d\n", mode)); SendPSMPAction(pAd, pEntry->Aid, mode); } @@ -2576,7 +2746,7 @@ INT Set_SendPSMPAction_Proc( INT Set_HtMIMOPSmode_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG Value; @@ -2597,7 +2767,7 @@ INT Set_HtMIMOPSmode_Proc( INT Set_ForceShortGI_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG Value; @@ -2620,7 +2790,7 @@ INT Set_ForceShortGI_Proc( INT Set_ForceGF_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG Value; @@ -2641,7 +2811,7 @@ INT Set_ForceGF_Proc( INT Set_HtMimoPs_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { ULONG Value; @@ -2682,7 +2852,7 @@ INT SetCommonHT( INT Set_FixedTxMode_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { UCHAR fix_tx_mode = FIXED_TXMODE_HT; @@ -2702,8 +2872,57 @@ INT Set_FixedTxMode_Proc( return TRUE; } +#if defined(RT305x)||defined(RT3070) +INT Set_HiPower_Proc( + IN PRTMP_ADAPTER pAdapter, + IN PSTRING arg) +{ + pAdapter->CommonCfg.HighPowerPatchDisabled = !(simple_strtol(arg, 0, 10)); + + if (pAdapter->CommonCfg.HighPowerPatchDisabled != 0) + { + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R82, 0x62); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R67, 0x20); +#ifdef RT3070 + if ((IS_RT3070(pAdapter) && ((pAdapter->MACVersion & 0xffff) < 0x0201))) +#endif // RT3070 // + RT30xxWriteRFRegister(pAdapter, RF_R27, 0x23); + } + return TRUE; +} +#endif + +INT Set_LongRetryLimit_Proc( + IN PRTMP_ADAPTER pAdapter, + IN PSTRING arg) +{ + TX_RTY_CFG_STRUC tx_rty_cfg; + UCHAR LongRetryLimit = (UCHAR)simple_strtol(arg, 0, 10); + + RTMP_IO_READ32(pAdapter, TX_RTY_CFG, &tx_rty_cfg.word); + tx_rty_cfg.field.LongRtyLimit = LongRetryLimit; + RTMP_IO_WRITE32(pAdapter, TX_RTY_CFG, tx_rty_cfg.word); + DBGPRINT(RT_DEBUG_TRACE, ("IF Set_LongRetryLimit_Proc::(tx_rty_cfg=0x%x)\n", tx_rty_cfg.word)); + return TRUE; +} + +INT Set_ShortRetryLimit_Proc( + IN PRTMP_ADAPTER pAdapter, + IN PSTRING arg) +{ + TX_RTY_CFG_STRUC tx_rty_cfg; + UCHAR ShortRetryLimit = (UCHAR)simple_strtol(arg, 0, 10); + + RTMP_IO_READ32(pAdapter, TX_RTY_CFG, &tx_rty_cfg.word); + tx_rty_cfg.field.ShortRtyLimit = ShortRetryLimit; + RTMP_IO_WRITE32(pAdapter, TX_RTY_CFG, tx_rty_cfg.word); + DBGPRINT(RT_DEBUG_TRACE, ("IF Set_ShortRetryLimit_Proc::(tx_rty_cfg=0x%x)\n", tx_rty_cfg.word)); + return TRUE; +} + + ///////////////////////////////////////////////////////////////////////// -PCHAR RTMPGetRalinkAuthModeStr( +PSTRING RTMPGetRalinkAuthModeStr( IN NDIS_802_11_AUTHENTICATION_MODE authMode) { switch(authMode) @@ -2731,14 +2950,11 @@ PCHAR RTMPGetRalinkAuthModeStr( } } -PCHAR RTMPGetRalinkEncryModeStr( +PSTRING RTMPGetRalinkEncryModeStr( IN USHORT encryMode) { switch(encryMode) { -#if defined(RT2860) || defined(RT30xx) - default: -#endif case Ndis802_11WEPDisabled: return "NONE"; case Ndis802_11WEPEnabled: @@ -2749,17 +2965,15 @@ PCHAR RTMPGetRalinkEncryModeStr( return "AES"; case Ndis802_11Encryption4Enabled: return "TKIPAES"; -#if !defined(RT2860) && !defined(RT30xx) default: return "UNKNOW"; -#endif } } INT RTMPShowCfgValue( IN PRTMP_ADAPTER pAd, - IN PUCHAR pName, - IN PUCHAR pBuf) + IN PSTRING pName, + IN PSTRING pBuf) { INT Status = 0; @@ -2785,7 +2999,7 @@ INT RTMPShowCfgValue( INT Show_SSID_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { sprintf(pBuf, "\t%s", pAd->CommonCfg.Ssid); return 0; @@ -2793,7 +3007,7 @@ INT Show_SSID_Proc( INT Show_WirelessMode_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { switch(pAd->CommonCfg.PhyMode) { @@ -2843,7 +3057,7 @@ INT Show_WirelessMode_Proc( INT Show_TxBurst_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { sprintf(pBuf, "\t%s", pAd->CommonCfg.bEnableTxBurst ? "TRUE":"FALSE"); return 0; @@ -2851,7 +3065,7 @@ INT Show_TxBurst_Proc( INT Show_TxPreamble_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { switch(pAd->CommonCfg.TxPreamble) { @@ -2874,7 +3088,7 @@ INT Show_TxPreamble_Proc( INT Show_TxPower_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { sprintf(pBuf, "\t%lu", pAd->CommonCfg.TxPowerPercentage); return 0; @@ -2882,7 +3096,7 @@ INT Show_TxPower_Proc( INT Show_Channel_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { sprintf(pBuf, "\t%d", pAd->CommonCfg.Channel); return 0; @@ -2890,7 +3104,7 @@ INT Show_Channel_Proc( INT Show_BGProtection_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { switch(pAd->CommonCfg.UseBGProtection) { @@ -2912,7 +3126,7 @@ INT Show_BGProtection_Proc( INT Show_RTSThreshold_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { sprintf(pBuf, "\t%u", pAd->CommonCfg.RtsThreshold); return 0; @@ -2920,7 +3134,7 @@ INT Show_RTSThreshold_Proc( INT Show_FragThreshold_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { sprintf(pBuf, "\t%u", pAd->CommonCfg.FragmentThreshold); return 0; @@ -2928,7 +3142,7 @@ INT Show_FragThreshold_Proc( INT Show_HtBw_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40) { @@ -2943,7 +3157,7 @@ INT Show_HtBw_Proc( INT Show_HtMcs_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { sprintf(pBuf, "\t%u", pAd->StaCfg.DesiredTransmitSetting.field.MCS); return 0; @@ -2951,7 +3165,7 @@ INT Show_HtMcs_Proc( INT Show_HtGi_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { switch(pAd->CommonCfg.RegTransmitSetting.field.ShortGI) { @@ -2970,7 +3184,7 @@ INT Show_HtGi_Proc( INT Show_HtOpMode_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { switch(pAd->CommonCfg.RegTransmitSetting.field.HTMODE) { @@ -2989,7 +3203,7 @@ INT Show_HtOpMode_Proc( INT Show_HtExtcha_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { switch(pAd->CommonCfg.RegTransmitSetting.field.EXTCHA) { @@ -3009,7 +3223,7 @@ INT Show_HtExtcha_Proc( INT Show_HtMpduDensity_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.MpduDensity); return 0; @@ -3017,7 +3231,7 @@ INT Show_HtMpduDensity_Proc( INT Show_HtBaWinSize_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.RxBAWinLimit); return 0; @@ -3025,7 +3239,7 @@ INT Show_HtBaWinSize_Proc( INT Show_HtRdg_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { sprintf(pBuf, "\t%s", pAd->CommonCfg.bRdg ? "TRUE":"FALSE"); return 0; @@ -3033,7 +3247,7 @@ INT Show_HtRdg_Proc( INT Show_HtAmsdu_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AmsduEnable ? "TRUE":"FALSE"); return 0; @@ -3041,7 +3255,7 @@ INT Show_HtAmsdu_Proc( INT Show_HtAutoBa_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AutoBA ? "TRUE":"FALSE"); return 0; @@ -3049,7 +3263,7 @@ INT Show_HtAutoBa_Proc( INT Show_CountryRegion_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegion); return 0; @@ -3057,7 +3271,7 @@ INT Show_CountryRegion_Proc( INT Show_CountryRegionABand_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegionForABand); return 0; @@ -3065,7 +3279,7 @@ INT Show_CountryRegionABand_Proc( INT Show_CountryCode_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { sprintf(pBuf, "\t%s", pAd->CommonCfg.CountryCode); return 0; @@ -3074,7 +3288,7 @@ INT Show_CountryCode_Proc( #ifdef AGGREGATION_SUPPORT INT Show_PktAggregate_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { sprintf(pBuf, "\t%s", pAd->CommonCfg.bAggregationCapable ? "TRUE":"FALSE"); return 0; @@ -3084,7 +3298,7 @@ INT Show_PktAggregate_Proc( #ifdef WMM_SUPPORT INT Show_WmmCapable_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { sprintf(pBuf, "\t%s", pAd->CommonCfg.bWmmCapable ? "TRUE":"FALSE"); @@ -3094,7 +3308,7 @@ INT Show_WmmCapable_Proc( INT Show_IEEE80211H_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { sprintf(pBuf, "\t%s", pAd->CommonCfg.bIEEE80211H ? "TRUE":"FALSE"); return 0; @@ -3102,7 +3316,7 @@ INT Show_IEEE80211H_Proc( INT Show_NetworkType_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { switch(pAd->StaCfg.BssType) { @@ -3125,9 +3339,11 @@ INT Show_NetworkType_Proc( return 0; } + + INT Show_AuthMode_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { NDIS_802_11_AUTHENTICATION_MODE AuthMode = Ndis802_11AuthModeOpen; @@ -3144,7 +3360,7 @@ INT Show_AuthMode_Proc( INT Show_EncrypType_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { NDIS_802_11_WEP_STATUS WepStatus = Ndis802_11WEPDisabled; @@ -3161,7 +3377,7 @@ INT Show_EncrypType_Proc( INT Show_DefaultKeyID_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { UCHAR DefaultKeyId = 0; @@ -3175,7 +3391,7 @@ INT Show_DefaultKeyID_Proc( INT Show_WepKey_Proc( IN PRTMP_ADAPTER pAd, IN INT KeyIdx, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { UCHAR Key[16] = {0}, KeyLength = 0; INT index = BSS0; @@ -3184,7 +3400,7 @@ INT Show_WepKey_Proc( NdisMoveMemory(Key, pAd->SharedKey[index][KeyIdx].Key, KeyLength); //check key string is ASCII or not - if (RTMPCheckStrPrintAble(Key, KeyLength)) + if (RTMPCheckStrPrintAble((PCHAR)Key, KeyLength)) sprintf(pBuf, "\t%s", Key); else { @@ -3198,7 +3414,7 @@ INT Show_WepKey_Proc( INT Show_Key1_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { Show_WepKey_Proc(pAd, 0, pBuf); return 0; @@ -3206,7 +3422,7 @@ INT Show_Key1_Proc( INT Show_Key2_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { Show_WepKey_Proc(pAd, 1, pBuf); return 0; @@ -3214,7 +3430,7 @@ INT Show_Key2_Proc( INT Show_Key3_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { Show_WepKey_Proc(pAd, 2, pBuf); return 0; @@ -3222,7 +3438,7 @@ INT Show_Key3_Proc( INT Show_Key4_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { Show_WepKey_Proc(pAd, 3, pBuf); return 0; @@ -3230,7 +3446,7 @@ INT Show_Key4_Proc( INT Show_WPAPSK_Proc( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf) + OUT PSTRING pBuf) { INT idx; UCHAR PMK[32] = {0}; diff --git a/drivers/staging/rt2860/common/cmm_mac_pci.c b/drivers/staging/rt2860/common/cmm_mac_pci.c new file mode 100644 index 000000000000..5aa6944d1180 --- /dev/null +++ b/drivers/staging/rt2860/common/cmm_mac_pci.c @@ -0,0 +1,1504 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* +*/ + + +#ifdef RTMP_MAC_PCI +#include "../rt_config.h" + + +/* + ======================================================================== + + Routine Description: + Allocate DMA memory blocks for send, receive + + Arguments: + Adapter Pointer to our adapter + + Return Value: + NDIS_STATUS_SUCCESS + NDIS_STATUS_FAILURE + NDIS_STATUS_RESOURCES + + IRQL = PASSIVE_LEVEL + + Note: + + ======================================================================== +*/ +NDIS_STATUS RTMPAllocTxRxRingMemory( + IN PRTMP_ADAPTER pAd) +{ + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + ULONG RingBasePaHigh; + ULONG RingBasePaLow; + PVOID RingBaseVa; + INT index, num; + PTXD_STRUC pTxD; + PRXD_STRUC pRxD; + ULONG ErrorValue = 0; + PRTMP_TX_RING pTxRing; + PRTMP_DMABUF pDmaBuf; + PNDIS_PACKET pPacket; +// PRTMP_REORDERBUF pReorderBuf; + + DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPAllocTxRxRingMemory\n")); + do + { + // + // Allocate all ring descriptors, include TxD, RxD, MgmtD. + // Although each size is different, to prevent cacheline and alignment + // issue, I intentional set them all to 64 bytes. + // + for (num=0; numTxDescRing[num].AllocSize = TX_RING_SIZE * TXD_SIZE; + RTMP_AllocateTxDescMemory( + pAd, + num, + pAd->TxDescRing[num].AllocSize, + FALSE, + &pAd->TxDescRing[num].AllocVa, + &pAd->TxDescRing[num].AllocPa); + + if (pAd->TxDescRing[num].AllocVa == NULL) + { + ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; + DBGPRINT_ERR(("Failed to allocate a big buffer\n")); + Status = NDIS_STATUS_RESOURCES; + break; + } + + // Zero init this memory block + NdisZeroMemory(pAd->TxDescRing[num].AllocVa, pAd->TxDescRing[num].AllocSize); + + // Save PA & VA for further operation + RingBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->TxDescRing[num].AllocPa); + RingBasePaLow = RTMP_GetPhysicalAddressLow (pAd->TxDescRing[num].AllocPa); + RingBaseVa = pAd->TxDescRing[num].AllocVa; + + // + // Allocate all 1st TXBuf's memory for this TxRing + // + pAd->TxBufSpace[num].AllocSize = TX_RING_SIZE * TX_DMA_1ST_BUFFER_SIZE; + RTMP_AllocateFirstTxBuffer( + pAd, + num, + pAd->TxBufSpace[num].AllocSize, + FALSE, + &pAd->TxBufSpace[num].AllocVa, + &pAd->TxBufSpace[num].AllocPa); + + if (pAd->TxBufSpace[num].AllocVa == NULL) + { + ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; + DBGPRINT_ERR(("Failed to allocate a big buffer\n")); + Status = NDIS_STATUS_RESOURCES; + break; + } + + // Zero init this memory block + NdisZeroMemory(pAd->TxBufSpace[num].AllocVa, pAd->TxBufSpace[num].AllocSize); + + // Save PA & VA for further operation + BufBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->TxBufSpace[num].AllocPa); + BufBasePaLow = RTMP_GetPhysicalAddressLow (pAd->TxBufSpace[num].AllocPa); + BufBaseVa = pAd->TxBufSpace[num].AllocVa; + + // + // Initialize Tx Ring Descriptor and associated buffer memory + // + pTxRing = &pAd->TxRing[num]; + for (index = 0; index < TX_RING_SIZE; index++) + { + pTxRing->Cell[index].pNdisPacket = NULL; + pTxRing->Cell[index].pNextNdisPacket = NULL; + // Init Tx Ring Size, Va, Pa variables + pTxRing->Cell[index].AllocSize = TXD_SIZE; + pTxRing->Cell[index].AllocVa = RingBaseVa; + RTMP_SetPhysicalAddressHigh(pTxRing->Cell[index].AllocPa, RingBasePaHigh); + RTMP_SetPhysicalAddressLow (pTxRing->Cell[index].AllocPa, RingBasePaLow); + + // Setup Tx Buffer size & address. only 802.11 header will store in this space + pDmaBuf = &pTxRing->Cell[index].DmaBuf; + pDmaBuf->AllocSize = TX_DMA_1ST_BUFFER_SIZE; + pDmaBuf->AllocVa = BufBaseVa; + RTMP_SetPhysicalAddressHigh(pDmaBuf->AllocPa, BufBasePaHigh); + RTMP_SetPhysicalAddressLow(pDmaBuf->AllocPa, BufBasePaLow); + + // link the pre-allocated TxBuf to TXD + pTxD = (PTXD_STRUC) pTxRing->Cell[index].AllocVa; + pTxD->SDPtr0 = BufBasePaLow; + // advance to next ring descriptor address + pTxD->DMADONE = 1; + RingBasePaLow += TXD_SIZE; + RingBaseVa = (PUCHAR) RingBaseVa + TXD_SIZE; + + // advance to next TxBuf address + BufBasePaLow += TX_DMA_1ST_BUFFER_SIZE; + BufBaseVa = (PUCHAR) BufBaseVa + TX_DMA_1ST_BUFFER_SIZE; + } + DBGPRINT(RT_DEBUG_TRACE, ("TxRing[%d]: total %d entry allocated\n", num, index)); + } + if (Status == NDIS_STATUS_RESOURCES) + break; + + // + // Allocate MGMT ring descriptor's memory except Tx ring which allocated eariler + // + pAd->MgmtDescRing.AllocSize = MGMT_RING_SIZE * TXD_SIZE; + RTMP_AllocateMgmtDescMemory( + pAd, + pAd->MgmtDescRing.AllocSize, + FALSE, + &pAd->MgmtDescRing.AllocVa, + &pAd->MgmtDescRing.AllocPa); + + if (pAd->MgmtDescRing.AllocVa == NULL) + { + ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; + DBGPRINT_ERR(("Failed to allocate a big buffer\n")); + Status = NDIS_STATUS_RESOURCES; + break; + } + + // Zero init this memory block + NdisZeroMemory(pAd->MgmtDescRing.AllocVa, pAd->MgmtDescRing.AllocSize); + + // Save PA & VA for further operation + RingBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->MgmtDescRing.AllocPa); + RingBasePaLow = RTMP_GetPhysicalAddressLow (pAd->MgmtDescRing.AllocPa); + RingBaseVa = pAd->MgmtDescRing.AllocVa; + + // + // Initialize MGMT Ring and associated buffer memory + // + for (index = 0; index < MGMT_RING_SIZE; index++) + { + pAd->MgmtRing.Cell[index].pNdisPacket = NULL; + pAd->MgmtRing.Cell[index].pNextNdisPacket = NULL; + // Init MGMT Ring Size, Va, Pa variables + pAd->MgmtRing.Cell[index].AllocSize = TXD_SIZE; + pAd->MgmtRing.Cell[index].AllocVa = RingBaseVa; + RTMP_SetPhysicalAddressHigh(pAd->MgmtRing.Cell[index].AllocPa, RingBasePaHigh); + RTMP_SetPhysicalAddressLow (pAd->MgmtRing.Cell[index].AllocPa, RingBasePaLow); + + // Offset to next ring descriptor address + RingBasePaLow += TXD_SIZE; + RingBaseVa = (PUCHAR) RingBaseVa + TXD_SIZE; + + // link the pre-allocated TxBuf to TXD + pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[index].AllocVa; + pTxD->DMADONE = 1; + + // no pre-allocated buffer required in MgmtRing for scatter-gather case + } + DBGPRINT(RT_DEBUG_TRACE, ("MGMT Ring: total %d entry allocated\n", index)); + + // + // Allocate RX ring descriptor's memory except Tx ring which allocated eariler + // + pAd->RxDescRing.AllocSize = RX_RING_SIZE * RXD_SIZE; + RTMP_AllocateRxDescMemory( + pAd, + pAd->RxDescRing.AllocSize, + FALSE, + &pAd->RxDescRing.AllocVa, + &pAd->RxDescRing.AllocPa); + + if (pAd->RxDescRing.AllocVa == NULL) + { + ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; + DBGPRINT_ERR(("Failed to allocate a big buffer\n")); + Status = NDIS_STATUS_RESOURCES; + break; + } + + // Zero init this memory block + NdisZeroMemory(pAd->RxDescRing.AllocVa, pAd->RxDescRing.AllocSize); + + + DBGPRINT(RT_DEBUG_OFF, + ("RX DESC %p size = %ld\n", pAd->RxDescRing.AllocVa, pAd->RxDescRing.AllocSize)); + + // Save PA & VA for further operation + RingBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->RxDescRing.AllocPa); + RingBasePaLow = RTMP_GetPhysicalAddressLow (pAd->RxDescRing.AllocPa); + RingBaseVa = pAd->RxDescRing.AllocVa; + + // + // Initialize Rx Ring and associated buffer memory + // + for (index = 0; index < RX_RING_SIZE; index++) + { + // Init RX Ring Size, Va, Pa variables + pAd->RxRing.Cell[index].AllocSize = RXD_SIZE; + pAd->RxRing.Cell[index].AllocVa = RingBaseVa; + RTMP_SetPhysicalAddressHigh(pAd->RxRing.Cell[index].AllocPa, RingBasePaHigh); + RTMP_SetPhysicalAddressLow (pAd->RxRing.Cell[index].AllocPa, RingBasePaLow); + + //NdisZeroMemory(RingBaseVa, RXD_SIZE); + + // Offset to next ring descriptor address + RingBasePaLow += RXD_SIZE; + RingBaseVa = (PUCHAR) RingBaseVa + RXD_SIZE; + + // Setup Rx associated Buffer size & allocate share memory + pDmaBuf = &pAd->RxRing.Cell[index].DmaBuf; + pDmaBuf->AllocSize = RX_BUFFER_AGGRESIZE; + pPacket = RTMP_AllocateRxPacketBuffer( + pAd, + pDmaBuf->AllocSize, + FALSE, + &pDmaBuf->AllocVa, + &pDmaBuf->AllocPa); + + /* keep allocated rx packet */ + pAd->RxRing.Cell[index].pNdisPacket = pPacket; + + // Error handling + if (pDmaBuf->AllocVa == NULL) + { + ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; + DBGPRINT_ERR(("Failed to allocate RxRing's 1st buffer\n")); + Status = NDIS_STATUS_RESOURCES; + break; + } + + // Zero init this memory block + NdisZeroMemory(pDmaBuf->AllocVa, pDmaBuf->AllocSize); + + // Write RxD buffer address & allocated buffer length + pRxD = (PRXD_STRUC) pAd->RxRing.Cell[index].AllocVa; + pRxD->SDP0 = RTMP_GetPhysicalAddressLow(pDmaBuf->AllocPa); + pRxD->DDONE = 0; + + } + + DBGPRINT(RT_DEBUG_TRACE, ("Rx Ring: total %d entry allocated\n", index)); + + } while (FALSE); + + + NdisZeroMemory(&pAd->FragFrame, sizeof(FRAGMENT_FRAME)); + pAd->FragFrame.pFragPacket = RTMP_AllocateFragPacketBuffer(pAd, RX_BUFFER_NORMSIZE); + + if (pAd->FragFrame.pFragPacket == NULL) + { + Status = NDIS_STATUS_RESOURCES; + } + + if (Status != NDIS_STATUS_SUCCESS) + { + // Log error inforamtion + NdisWriteErrorLogEntry( + pAd->AdapterHandle, + NDIS_ERROR_CODE_OUT_OF_RESOURCES, + 1, + ErrorValue); + } + + // Following code segment get from original func:NICInitTxRxRingAndBacklogQueue(), now should integrate it to here. + { + DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitTxRxRingAndBacklogQueue\n")); + +/* + // Disable DMA. + RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); + GloCfg.word &= 0xff0; + GloCfg.field.EnTXWriteBackDDONE =1; + RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); +*/ + + // Initialize all transmit related software queues + for(index = 0; index < NUM_OF_TX_RING; index++) + { + InitializeQueueHeader(&pAd->TxSwQueue[index]); + // Init TX rings index pointer + pAd->TxRing[index].TxSwFreeIdx = 0; + pAd->TxRing[index].TxCpuIdx = 0; + //RTMP_IO_WRITE32(pAd, (TX_CTX_IDX0 + i * 0x10) , pAd->TxRing[i].TX_CTX_IDX); + } + + // Init RX Ring index pointer + pAd->RxRing.RxSwReadIdx = 0; + pAd->RxRing.RxCpuIdx = RX_RING_SIZE - 1; + //RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RX_CRX_IDX0); + + + // init MGMT ring index pointer + pAd->MgmtRing.TxSwFreeIdx = 0; + pAd->MgmtRing.TxCpuIdx = 0; + + pAd->PrivateInfo.TxRingFullCnt = 0; + + DBGPRINT(RT_DEBUG_TRACE, ("<-- NICInitTxRxRingAndBacklogQueue\n")); + } + + DBGPRINT_S(Status, ("<-- RTMPAllocTxRxRingMemory, Status=%x\n", Status)); + return Status; +} + + + + +/* + ======================================================================== + + Routine Description: + Reset NIC Asics. Call after rest DMA. So reset TX_CTX_IDX to zero. + + Arguments: + Adapter Pointer to our adapter + + Return Value: + None + + IRQL = PASSIVE_LEVEL + IRQL = DISPATCH_LEVEL + + Note: + Reset NIC to initial state AS IS system boot up time. + + ======================================================================== +*/ +VOID RTMPRingCleanUp( + IN PRTMP_ADAPTER pAd, + IN UCHAR RingType) +{ + PTXD_STRUC pTxD; + PRXD_STRUC pRxD; + PQUEUE_ENTRY pEntry; + PNDIS_PACKET pPacket; + int i; + PRTMP_TX_RING pTxRing; + unsigned long IrqFlags; + //UINT32 RxSwReadIdx; + + + DBGPRINT(RT_DEBUG_TRACE,("RTMPRingCleanUp(RingIdx=%d, Pending-NDIS=%ld)\n", RingType, pAd->RalinkCounters.PendingNdisPacketCount)); + switch (RingType) + { + case QID_AC_BK: + case QID_AC_BE: + case QID_AC_VI: + case QID_AC_VO: + case QID_HCCA: + + pTxRing = &pAd->TxRing[RingType]; + + RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); + // We have to clean all descriptors in case some error happened with reset + for (i=0; iCell[i].AllocVa; + + pPacket = (PNDIS_PACKET) pTxRing->Cell[i].pNdisPacket; + // release scatter-and-gather NDIS_PACKET + if (pPacket) + { + RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); + pTxRing->Cell[i].pNdisPacket = NULL; + } + + pPacket = (PNDIS_PACKET) pTxRing->Cell[i].pNextNdisPacket; + // release scatter-and-gather NDIS_PACKET + if (pPacket) + { + RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); + pTxRing->Cell[i].pNextNdisPacket = NULL; + } + } + + RTMP_IO_READ32(pAd, TX_DTX_IDX0 + RingType * 0x10, &pTxRing->TxDmaIdx); + pTxRing->TxSwFreeIdx = pTxRing->TxDmaIdx; + pTxRing->TxCpuIdx = pTxRing->TxDmaIdx; + RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + RingType * 0x10, pTxRing->TxCpuIdx); + + RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); + + RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); + while (pAd->TxSwQueue[RingType].Head != NULL) + { + pEntry = RemoveHeadQueue(&pAd->TxSwQueue[RingType]); + pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); + RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); + DBGPRINT(RT_DEBUG_TRACE,("Release 1 NDIS packet from s/w backlog queue\n")); + } + RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); + break; + + case QID_MGMT: + // We have to clean all descriptors in case some error happened with reset + NdisAcquireSpinLock(&pAd->MgmtRingLock); + + for (i=0; iMgmtRing.Cell[i].AllocVa; + + pPacket = (PNDIS_PACKET) pAd->MgmtRing.Cell[i].pNdisPacket; + // rlease scatter-and-gather NDIS_PACKET + if (pPacket) + { + PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, PCI_DMA_TODEVICE); + RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); + } + pAd->MgmtRing.Cell[i].pNdisPacket = NULL; + + pPacket = (PNDIS_PACKET) pAd->MgmtRing.Cell[i].pNextNdisPacket; + // release scatter-and-gather NDIS_PACKET + if (pPacket) + { + PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); + RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); + } + pAd->MgmtRing.Cell[i].pNextNdisPacket = NULL; + + } + + RTMP_IO_READ32(pAd, TX_MGMTDTX_IDX, &pAd->MgmtRing.TxDmaIdx); + pAd->MgmtRing.TxSwFreeIdx = pAd->MgmtRing.TxDmaIdx; + pAd->MgmtRing.TxCpuIdx = pAd->MgmtRing.TxDmaIdx; + RTMP_IO_WRITE32(pAd, TX_MGMTCTX_IDX, pAd->MgmtRing.TxCpuIdx); + + NdisReleaseSpinLock(&pAd->MgmtRingLock); + pAd->RalinkCounters.MgmtRingFullCount = 0; + break; + + case QID_RX: + // We have to clean all descriptors in case some error happened with reset + NdisAcquireSpinLock(&pAd->RxRingLock); + + for (i=0; iRxRing.Cell[i].AllocVa; + pRxD->DDONE = 0 ; + } + + RTMP_IO_READ32(pAd, RX_DRX_IDX, &pAd->RxRing.RxDmaIdx); + pAd->RxRing.RxSwReadIdx = pAd->RxRing.RxDmaIdx; + pAd->RxRing.RxCpuIdx = ((pAd->RxRing.RxDmaIdx == 0) ? (RX_RING_SIZE-1) : (pAd->RxRing.RxDmaIdx-1)); + RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RxCpuIdx); + + NdisReleaseSpinLock(&pAd->RxRingLock); + break; + + default: + break; + } +} + + +VOID RTMPFreeTxRxRingMemory( + IN PRTMP_ADAPTER pAd) +{ + int index, num , j; + PRTMP_TX_RING pTxRing; + PTXD_STRUC pTxD; + PNDIS_PACKET pPacket; + unsigned int IrqFlags; + + //POS_COOKIE pObj =(POS_COOKIE) pAd->OS_Cookie; + + DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPFreeTxRxRingMemory\n")); + + // Free TxSwQueue Packet + for (index=0; index irq_lock, IrqFlags); + pQueue = &pAd->TxSwQueue[index]; + while (pQueue->Head) + { + pEntry = RemoveHeadQueue(pQueue); + pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); + RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); + } + RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); + } + + // Free Tx Ring Packet + for (index=0;index< NUM_OF_TX_RING;index++) + { + pTxRing = &pAd->TxRing[index]; + + for (j=0; j< TX_RING_SIZE; j++) + { + pTxD = (PTXD_STRUC) (pTxRing->Cell[j].AllocVa); + pPacket = pTxRing->Cell[j].pNdisPacket; + + if (pPacket) + { + PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, PCI_DMA_TODEVICE); + RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); + } + //Always assign pNdisPacket as NULL after clear + pTxRing->Cell[j].pNdisPacket = NULL; + + pPacket = pTxRing->Cell[j].pNextNdisPacket; + + if (pPacket) + { + PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); + RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); + } + //Always assign pNextNdisPacket as NULL after clear + pTxRing->Cell[pTxRing->TxSwFreeIdx].pNextNdisPacket = NULL; + + } + } + + for (index = RX_RING_SIZE - 1 ; index >= 0; index--) + { + if ((pAd->RxRing.Cell[index].DmaBuf.AllocVa) && (pAd->RxRing.Cell[index].pNdisPacket)) + { + PCI_UNMAP_SINGLE(pAd, pAd->RxRing.Cell[index].DmaBuf.AllocPa, pAd->RxRing.Cell[index].DmaBuf.AllocSize, PCI_DMA_FROMDEVICE); + RELEASE_NDIS_PACKET(pAd, pAd->RxRing.Cell[index].pNdisPacket, NDIS_STATUS_SUCCESS); + } + } + NdisZeroMemory(pAd->RxRing.Cell, RX_RING_SIZE * sizeof(RTMP_DMACB)); + + if (pAd->RxDescRing.AllocVa) + { + RTMP_FreeDescMemory(pAd, pAd->RxDescRing.AllocSize, pAd->RxDescRing.AllocVa, pAd->RxDescRing.AllocPa); + } + NdisZeroMemory(&pAd->RxDescRing, sizeof(RTMP_DMABUF)); + + if (pAd->MgmtDescRing.AllocVa) + { + RTMP_FreeDescMemory(pAd, pAd->MgmtDescRing.AllocSize, pAd->MgmtDescRing.AllocVa, pAd->MgmtDescRing.AllocPa); + } + NdisZeroMemory(&pAd->MgmtDescRing, sizeof(RTMP_DMABUF)); + + for (num = 0; num < NUM_OF_TX_RING; num++) + { + if (pAd->TxBufSpace[num].AllocVa) + { + RTMP_FreeFirstTxBuffer(pAd, pAd->TxBufSpace[num].AllocSize, FALSE, pAd->TxBufSpace[num].AllocVa, pAd->TxBufSpace[num].AllocPa); + } + NdisZeroMemory(&pAd->TxBufSpace[num], sizeof(RTMP_DMABUF)); + + if (pAd->TxDescRing[num].AllocVa) + { + RTMP_FreeDescMemory(pAd, pAd->TxDescRing[num].AllocSize, pAd->TxDescRing[num].AllocVa, pAd->TxDescRing[num].AllocPa); + } + NdisZeroMemory(&pAd->TxDescRing[num], sizeof(RTMP_DMABUF)); + } + + if (pAd->FragFrame.pFragPacket) + RELEASE_NDIS_PACKET(pAd, pAd->FragFrame.pFragPacket, NDIS_STATUS_SUCCESS); + + DBGPRINT(RT_DEBUG_TRACE, ("<-- RTMPFreeTxRxRingMemory\n")); +} + + +/*************************************************************************** + * + * register related procedures. + * + **************************************************************************/ +/* +======================================================================== +Routine Description: + Disable DMA. + +Arguments: + *pAd the raxx interface data pointer + +Return Value: + None + +Note: +======================================================================== +*/ +VOID RT28XXDMADisable( + IN RTMP_ADAPTER *pAd) +{ + WPDMA_GLO_CFG_STRUC GloCfg; + + + RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); + GloCfg.word &= 0xff0; + GloCfg.field.EnTXWriteBackDDONE =1; + RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); +} + + +/* +======================================================================== +Routine Description: + Enable DMA. + +Arguments: + *pAd the raxx interface data pointer + +Return Value: + None + +Note: +======================================================================== +*/ +VOID RT28XXDMAEnable( + IN RTMP_ADAPTER *pAd) +{ + WPDMA_GLO_CFG_STRUC GloCfg; + int i = 0; + + RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x4); + do + { + RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); + if ((GloCfg.field.TxDMABusy == 0) && (GloCfg.field.RxDMABusy == 0)) + break; + + DBGPRINT(RT_DEBUG_TRACE, ("==> DMABusy\n")); + RTMPusecDelay(1000); + i++; + }while ( i <200); + + RTMPusecDelay(50); + + GloCfg.field.EnTXWriteBackDDONE = 1; + GloCfg.field.WPDMABurstSIZE = 2; + GloCfg.field.EnableRxDMA = 1; + GloCfg.field.EnableTxDMA = 1; + + DBGPRINT(RT_DEBUG_TRACE, ("<== WRITE DMA offset 0x208 = 0x%x\n", GloCfg.word)); + RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); + +} + + +BOOLEAN AsicCheckCommanOk( + IN PRTMP_ADAPTER pAd, + IN UCHAR Command) +{ + UINT32 CmdStatus = 0, CID = 0, i; + UINT32 ThisCIDMask = 0; + + i = 0; + do + { + RTMP_IO_READ32(pAd, H2M_MAILBOX_CID, &CID); + // Find where the command is. Because this is randomly specified by firmware. + if ((CID & CID0MASK) == Command) + { + ThisCIDMask = CID0MASK; + break; + } + else if ((((CID & CID1MASK)>>8) & 0xff) == Command) + { + ThisCIDMask = CID1MASK; + break; + } + else if ((((CID & CID2MASK)>>16) & 0xff) == Command) + { + ThisCIDMask = CID2MASK; + break; + } + else if ((((CID & CID3MASK)>>24) & 0xff) == Command) + { + ThisCIDMask = CID3MASK; + break; + } + + RTMPusecDelay(100); + i++; + }while (i < 200); + + // Get CommandStatus Value + RTMP_IO_READ32(pAd, H2M_MAILBOX_STATUS, &CmdStatus); + + // This command's status is at the same position as command. So AND command position's bitmask to read status. + if (i < 200) + { + // If Status is 1, the comamnd is success. + if (((CmdStatus & ThisCIDMask) == 0x1) || ((CmdStatus & ThisCIDMask) == 0x100) + || ((CmdStatus & ThisCIDMask) == 0x10000) || ((CmdStatus & ThisCIDMask) == 0x1000000)) + { + DBGPRINT(RT_DEBUG_TRACE, ("--> AsicCheckCommanOk CID = 0x%x, CmdStatus= 0x%x \n", CID, CmdStatus)); + RTMP_IO_WRITE32(pAd, H2M_MAILBOX_STATUS, 0xffffffff); + RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CID, 0xffffffff); + return TRUE; + } + DBGPRINT(RT_DEBUG_TRACE, ("--> AsicCheckCommanFail1 CID = 0x%x, CmdStatus= 0x%x \n", CID, CmdStatus)); + } + else + { + DBGPRINT(RT_DEBUG_TRACE, ("--> AsicCheckCommanFail2 Timeout Command = %d, CmdStatus= 0x%x \n", Command, CmdStatus)); + } + // Clear Command and Status. + RTMP_IO_WRITE32(pAd, H2M_MAILBOX_STATUS, 0xffffffff); + RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CID, 0xffffffff); + + return FALSE; +} + + +/* +======================================================================== +Routine Description: + Write Beacon buffer to Asic. + +Arguments: + *pAd the raxx interface data pointer + +Return Value: + None + +Note: +======================================================================== +*/ +VOID RT28xx_UpdateBeaconToAsic( + IN RTMP_ADAPTER *pAd, + IN INT apidx, + IN ULONG FrameLen, + IN ULONG UpdatePos) +{ + ULONG CapInfoPos = 0; + UCHAR *ptr, *ptr_update, *ptr_capinfo; + UINT i; + BOOLEAN bBcnReq = FALSE; + UCHAR bcn_idx = 0; + + + { + DBGPRINT(RT_DEBUG_ERROR, ("%s() : No valid Interface be found.\n", __func__)); + return; + } + + //if ((pAd->WdsTab.Mode == WDS_BRIDGE_MODE) + // || ((pAd->ApCfg.MBSSID[apidx].MSSIDDev == NULL) + // || !(pAd->ApCfg.MBSSID[apidx].MSSIDDev->flags & IFF_UP)) + // ) + if (bBcnReq == FALSE) + { + /* when the ra interface is down, do not send its beacon frame */ + /* clear all zero */ + for(i=0; iBeaconOffset[bcn_idx] + i, 0x00); + } + else + { + ptr = (PUCHAR)&pAd->BeaconTxWI; + for (i=0; iBeaconOffset[bcn_idx] + i, longptr); + ptr += 4; + } + + // Update CapabilityInfo in Beacon + for (i = CapInfoPos; i < (CapInfoPos+2); i++) + { + RTMP_IO_WRITE8(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, *ptr_capinfo); + ptr_capinfo ++; + } + + if (FrameLen > UpdatePos) + { + for (i= UpdatePos; i< (FrameLen); i++) + { + RTMP_IO_WRITE8(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, *ptr_update); + ptr_update ++; + } + } + + } + +} + + +VOID RT28xxPciStaAsicForceWakeup( + IN PRTMP_ADAPTER pAd, + IN BOOLEAN bFromTx) +{ + AUTO_WAKEUP_STRUC AutoWakeupCfg; + + if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) + return; + + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WAKEUP_NOW)) + { + DBGPRINT(RT_DEBUG_TRACE, ("waking up now!\n")); + return; + } + + OPSTATUS_SET_FLAG(pAd, fOP_STATUS_WAKEUP_NOW); + +#ifdef RTMP_PCI_SUPPORT + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + { + // Support PCIe Advance Power Save + if (bFromTx == TRUE) + { + pAd->Mlme.bPsPollTimerRunning = FALSE; + RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); + RTMPusecDelay(3000); + DBGPRINT(RT_DEBUG_TRACE, ("=======AsicForceWakeup===bFromTx\n")); + } + + AutoWakeupCfg.word = 0; + RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); + + if (RT28xxPciAsicRadioOn(pAd, DOT11POWERSAVE)) + { + { + // end johnli + // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. + if (INFRA_ON(pAd) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) + && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) + { + // Must using 40MHz. + AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); + AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); + } + else + { + // Must using 20MHz. + AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); + AsicLockChannel(pAd, pAd->CommonCfg.Channel); + } + } + } + } + else +#endif // RTMP_PCI_SUPPORT // + { + // PCI, 2860-PCIe + AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02); + AutoWakeupCfg.word = 0; + RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); + } + + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_WAKEUP_NOW); + DBGPRINT(RT_DEBUG_TRACE, ("<=======RT28xxPciStaAsicForceWakeup\n")); +} + + +VOID RT28xxPciStaAsicSleepThenAutoWakeup( + IN PRTMP_ADAPTER pAd, + IN USHORT TbttNumToNextWakeUp) +{ + BOOLEAN brc; + + if (pAd->StaCfg.bRadio == FALSE) + { + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); + return; + } + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + { + ULONG Now = 0; + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WAKEUP_NOW)) + { + DBGPRINT(RT_DEBUG_TRACE, ("waking up now!\n")); + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); + return; + } + + NdisGetSystemUpTime(&Now); + // If last send NULL fram time is too close to this receiving beacon (within 8ms), don't go to sleep for this DTM. + // Because Some AP can't queuing outgoing frames immediately. + if (((pAd->Mlme.LastSendNULLpsmTime + 8) >= Now) && (pAd->Mlme.LastSendNULLpsmTime <= Now)) + { + DBGPRINT(RT_DEBUG_TRACE, ("Now = %lu, LastSendNULLpsmTime=%lu : RxCountSinceLastNULL = %lu. \n", Now, pAd->Mlme.LastSendNULLpsmTime, pAd->RalinkCounters.RxCountSinceLastNULL)); + return; + } + else if ((pAd->RalinkCounters.RxCountSinceLastNULL > 0) && ((pAd->Mlme.LastSendNULLpsmTime + pAd->CommonCfg.BeaconPeriod) >= Now)) + { + DBGPRINT(RT_DEBUG_TRACE, ("Now = %lu, LastSendNULLpsmTime=%lu: RxCountSinceLastNULL = %lu > 0 \n", Now, pAd->Mlme.LastSendNULLpsmTime, pAd->RalinkCounters.RxCountSinceLastNULL)); + return; + } + + brc = RT28xxPciAsicRadioOff(pAd, DOT11POWERSAVE, TbttNumToNextWakeUp); + if (brc==TRUE) + OPSTATUS_SET_FLAG(pAd, fOP_STATUS_DOZE); + } + else + { + AUTO_WAKEUP_STRUC AutoWakeupCfg; + // we have decided to SLEEP, so at least do it for a BEACON period. + if (TbttNumToNextWakeUp == 0) + TbttNumToNextWakeUp = 1; + + //RTMP_IO_WRITE32(pAd, INT_MASK_CSR, AutoWakeupInt); + + AutoWakeupCfg.word = 0; + RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); + AutoWakeupCfg.field.NumofSleepingTbtt = TbttNumToNextWakeUp - 1; + AutoWakeupCfg.field.EnableAutoWakeup = 1; + AutoWakeupCfg.field.AutoLeadTime = 5; + RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); + AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x00); // send POWER-SAVE command to MCU. Timeout 40us. + OPSTATUS_SET_FLAG(pAd, fOP_STATUS_DOZE); + DBGPRINT(RT_DEBUG_TRACE, ("<-- %s, TbttNumToNextWakeUp=%d \n", __func__, TbttNumToNextWakeUp)); + } + +} + +#ifdef RTMP_PCI_SUPPORT +VOID PsPollWakeExec( + IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3) +{ + RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; + unsigned long flags; + + DBGPRINT(RT_DEBUG_TRACE,("-->PsPollWakeExec \n")); + RTMP_INT_LOCK(&pAd->irq_lock, flags); + if (pAd->Mlme.bPsPollTimerRunning) + { + RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); + } + pAd->Mlme.bPsPollTimerRunning = FALSE; + RTMP_INT_UNLOCK(&pAd->irq_lock, flags); +} + +VOID RadioOnExec( + IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3) +{ + RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; + RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + WPDMA_GLO_CFG_STRUC DmaCfg; + BOOLEAN Cancelled; + + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) + { + DBGPRINT(RT_DEBUG_TRACE,("-->RadioOnExec() return on fOP_STATUS_DOZE == TRUE; \n")); + RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); + return; + } + + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) + { + DBGPRINT(RT_DEBUG_TRACE,("-->RadioOnExec() return on SCAN_IN_PROGRESS; \n")); + RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); + return; + } + pAd->Mlme.bPsPollTimerRunning = FALSE; + RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); + if (pAd->StaCfg.bRadio == TRUE) + { + pAd->bPCIclkOff = FALSE; + RTMPRingCleanUp(pAd, QID_AC_BK); + RTMPRingCleanUp(pAd, QID_AC_BE); + RTMPRingCleanUp(pAd, QID_AC_VI); + RTMPRingCleanUp(pAd, QID_AC_VO); + RTMPRingCleanUp(pAd, QID_HCCA); + RTMPRingCleanUp(pAd, QID_MGMT); + RTMPRingCleanUp(pAd, QID_RX); + + // 2. Send wake up command. + AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x02); + // 2-1. wait command ok. + AsicCheckCommanOk(pAd, PowerWakeCID); + + // When PCI clock is off, don't want to service interrupt. So when back to clock on, enable interrupt. + //RTMP_IO_WRITE32(pAd, INT_MASK_CSR, (DELAYINTMASK|RxINT)); + RTMP_ASIC_INTERRUPT_ENABLE(pAd); + + // 3. Enable Tx DMA. + RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &DmaCfg.word); + DmaCfg.field.EnableTxDMA = 1; + RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, DmaCfg.word); + + // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. + if (INFRA_ON(pAd) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) + && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) + { + // Must using 40MHz. + AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); + AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); + } + else + { + // Must using 20MHz. + AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); + AsicLockChannel(pAd, pAd->CommonCfg.Channel); + } + + if (pChipOps->AsicReverseRfFromSleepMode) + pChipOps->AsicReverseRfFromSleepMode(pAd); + + // Clear Radio off flag + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); + + // Set LED + RTMPSetLED(pAd, LED_RADIO_ON); + + if (pAd->StaCfg.Psm == PWR_ACTIVE) + { + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, pAd->StaCfg.BBPR3); + } + } + else + { + RT28xxPciAsicRadioOff(pAd, GUIRADIO_OFF, 0); + } +} +#endif // RTMP_PCI_SUPPORT // + + +/* + ========================================================================== + Description: + This routine sends command to firmware and turn our chip to wake up mode from power save mode. + Both RadioOn and .11 power save function needs to call this routine. + Input: + Level = GUIRADIO_OFF : call this function is from Radio Off to Radio On. Need to restore PCI host value. + Level = other value : normal wake up function. + + ========================================================================== + */ +BOOLEAN RT28xxPciAsicRadioOn( + IN PRTMP_ADAPTER pAd, + IN UCHAR Level) +{ + //WPDMA_GLO_CFG_STRUC DmaCfg; + BOOLEAN Cancelled; + //UINT32 MACValue; + + if (pAd->OpMode == OPMODE_AP && Level==DOT11POWERSAVE) + return FALSE; + +#ifdef RTMP_PCI_SUPPORT + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + { + pAd->Mlme.bPsPollTimerRunning = FALSE; + RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); + if ((Level == GUIRADIO_OFF) || (Level == GUI_IDLE_POWER_SAVE)) + { + DBGPRINT(RT_DEBUG_TRACE, ("RT28xxPciAsicRadioOn ()\n")); + // 1. Set PCI Link Control in Configuration Space. + RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); + RTMPusecDelay(6000); + } + } +#endif // RTMP_PCI_SUPPORT // + + pAd->bPCIclkOff = FALSE; + // 2. Send wake up command. + AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x02); + pAd->bPCIclkOff = FALSE; + // 2-1. wait command ok. + AsicCheckCommanOk(pAd, PowerWakeCID); + RTMP_ASIC_INTERRUPT_ENABLE(pAd); + + + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); + if (Level == GUI_IDLE_POWER_SAVE) + { + { + // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. + { + if (INFRA_ON(pAd) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) + && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) + { + // Must using 40MHz. + AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); + AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); + } + else + { + // Must using 20MHz. + AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); + AsicLockChannel(pAd, pAd->CommonCfg.Channel); + } + } + + } + } + return TRUE; + +} + + +/* + ========================================================================== + Description: + This routine sends command to firmware and turn our chip to power save mode. + Both RadioOff and .11 power save function needs to call this routine. + Input: + Level = GUIRADIO_OFF : GUI Radio Off mode + Level = DOT11POWERSAVE : 802.11 power save mode + Level = RTMP_HALT : When Disable device. + + ========================================================================== + */ +BOOLEAN RT28xxPciAsicRadioOff( + IN PRTMP_ADAPTER pAd, + IN UCHAR Level, + IN USHORT TbttNumToNextWakeUp) +{ + WPDMA_GLO_CFG_STRUC DmaCfg; + UCHAR i, tempBBP_R3 = 0; + BOOLEAN brc = FALSE, Cancelled; + UINT32 TbTTTime = 0; + UINT32 PsPollTime = 0/*, MACValue*/; + ULONG BeaconPeriodTime; + UINT32 RxDmaIdx, RxCpuIdx; + DBGPRINT(RT_DEBUG_TRACE, ("AsicRadioOff ===> Lv= %d, TxCpuIdx = %d, TxDmaIdx = %d. RxCpuIdx = %d, RxDmaIdx = %d.\n", Level,pAd->TxRing[0].TxCpuIdx, pAd->TxRing[0].TxDmaIdx, pAd->RxRing.RxCpuIdx, pAd->RxRing.RxDmaIdx)); + + if (pAd->OpMode == OPMODE_AP && Level==DOT11POWERSAVE) + return FALSE; + + // Check Rx DMA busy status, if more than half is occupied, give up this radio off. + RTMP_IO_READ32(pAd, RX_DRX_IDX , &RxDmaIdx); + RTMP_IO_READ32(pAd, RX_CRX_IDX , &RxCpuIdx); + if ((RxDmaIdx > RxCpuIdx) && ((RxDmaIdx - RxCpuIdx) > RX_RING_SIZE/3)) + { + DBGPRINT(RT_DEBUG_TRACE, ("AsicRadioOff ===> return1. RxDmaIdx = %d , RxCpuIdx = %d. \n", RxDmaIdx, RxCpuIdx)); + return FALSE; + } + else if ((RxCpuIdx >= RxDmaIdx) && ((RxCpuIdx - RxDmaIdx) < RX_RING_SIZE/3)) + { + DBGPRINT(RT_DEBUG_TRACE, ("AsicRadioOff ===> return2. RxCpuIdx = %d. RxDmaIdx = %d , \n", RxCpuIdx, RxDmaIdx)); + return FALSE; + } + + // Once go into this function, disable tx because don't want too many packets in queue to prevent HW stops. + pAd->bPCIclkOffDisableTx = TRUE; + + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE) && pAd->OpMode == OPMODE_STA) + { + printk("==>fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE\n"); + RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); + RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); + + if (Level == DOT11POWERSAVE) + { + RTMP_IO_READ32(pAd, TBTT_TIMER, &TbTTTime); + TbTTTime &= 0x1ffff; + // 00. check if need to do sleep in this DTIM period. If next beacon will arrive within 30ms , ...doesn't necessarily sleep. + // TbTTTime uint = 64us, LEAD_TIME unit = 1024us, PsPollTime unit = 1ms + if (((64*TbTTTime) <((LEAD_TIME*1024) + 40000)) && (TbttNumToNextWakeUp == 0)) + { + DBGPRINT(RT_DEBUG_TRACE, ("TbTTTime = 0x%x , give up this sleep. \n", TbTTTime)); + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); + pAd->bPCIclkOffDisableTx = FALSE; + return FALSE; + } + else + { + PsPollTime = (64*TbTTTime- LEAD_TIME*1024)/1000; + PsPollTime -= 3; + + BeaconPeriodTime = pAd->CommonCfg.BeaconPeriod*102/100; + if (TbttNumToNextWakeUp > 0) + PsPollTime += ((TbttNumToNextWakeUp -1) * BeaconPeriodTime); + + pAd->Mlme.bPsPollTimerRunning = TRUE; + RTMPSetTimer(&pAd->Mlme.PsPollTimer, PsPollTime); + } + } + } + + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); + + // Set to 1R. + if (pAd->Antenna.field.RxPath > 1 && pAd->OpMode == OPMODE_STA) + { + tempBBP_R3 = (pAd->StaCfg.BBPR3 & 0xE7); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, tempBBP_R3); + } + + // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. + if ((INFRA_ON(pAd) || pAd->OpMode == OPMODE_AP) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) + && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) + { + // Must using 40MHz. + AsicTurnOffRFClk(pAd, pAd->CommonCfg.CentralChannel); + } + else + { + // Must using 20MHz. + AsicTurnOffRFClk(pAd, pAd->CommonCfg.Channel); + } + + if (Level != RTMP_HALT) + { + // Change Interrupt bitmask. + // When PCI clock is off, don't want to service interrupt. + RTMP_IO_WRITE32(pAd, INT_MASK_CSR, AutoWakeupInt); + } + else + { + RTMP_ASIC_INTERRUPT_DISABLE(pAd); + } + + + RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RxCpuIdx); + // 2. Send Sleep command + RTMP_IO_WRITE32(pAd, H2M_MAILBOX_STATUS, 0xffffffff); + RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CID, 0xffffffff); + // send POWER-SAVE command to MCU. high-byte = 1 save power as much as possible. high byte = 0 save less power + AsicSendCommandToMcu(pAd, 0x30, PowerSafeCID, 0xff, 0x1); + // 2-1. Wait command success + // Status = 1 : success, Status = 2, already sleep, Status = 3, Maybe MAC is busy so can't finish this task. + brc = AsicCheckCommanOk(pAd, PowerSafeCID); + + // 3. After 0x30 command is ok, send radio off command. lowbyte = 0 for power safe. + // If 0x30 command is not ok this time, we can ignore 0x35 command. It will make sure not cause firmware'r problem. + if ((Level == DOT11POWERSAVE) && (brc == TRUE)) + { + AsicSendCommandToMcu(pAd, 0x35, PowerRadioOffCID, 0, 0x00); // lowbyte = 0 means to do power safe, NOT turn off radio. + // 3-1. Wait command success + AsicCheckCommanOk(pAd, PowerRadioOffCID); + } + else if (brc == TRUE) + { + AsicSendCommandToMcu(pAd, 0x35, PowerRadioOffCID, 1, 0x00); // lowbyte = 0 means to do power safe, NOT turn off radio. + // 3-1. Wait command success + AsicCheckCommanOk(pAd, PowerRadioOffCID); + } + + // 1. Wait DMA not busy + i = 0; + do + { + RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &DmaCfg.word); + if ((DmaCfg.field.RxDMABusy == 0) && (DmaCfg.field.TxDMABusy == 0)) + break; + RTMPusecDelay(20); + i++; + }while(i < 50); + + /* + if (i >= 50) + { + pAd->CheckDmaBusyCount++; + DBGPRINT(RT_DEBUG_TRACE, ("DMA Rx keeps busy. return on AsicRadioOff () CheckDmaBusyCount = %d \n", pAd->CheckDmaBusyCount)); + } + else + { + pAd->CheckDmaBusyCount = 0; + } + */ + + if (Level == DOT11POWERSAVE) + { + AUTO_WAKEUP_STRUC AutoWakeupCfg; + //RTMPSetTimer(&pAd->Mlme.PsPollTimer, 90); + + // we have decided to SLEEP, so at least do it for a BEACON period. + if (TbttNumToNextWakeUp == 0) + TbttNumToNextWakeUp = 1; + + AutoWakeupCfg.word = 0; + RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); + + // 1. Set auto wake up timer. + AutoWakeupCfg.field.NumofSleepingTbtt = TbttNumToNextWakeUp - 1; + AutoWakeupCfg.field.EnableAutoWakeup = 1; + AutoWakeupCfg.field.AutoLeadTime = LEAD_TIME; + RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); + } + +#ifdef RTMP_PCI_SUPPORT + // 4-1. If it's to disable our device. Need to restore PCI Configuration Space to its original value. + if (Level == RTMP_HALT && pAd->OpMode == OPMODE_STA) + { + if ((brc == TRUE) && (i < 50)) + RTMPPCIeLinkCtrlSetting(pAd, 1); + } + // 4. Set PCI configuration Space Link Comtrol fields. Only Radio Off needs to call this function + else if (pAd->OpMode == OPMODE_STA) + { + if ((brc == TRUE) && (i < 50)) + RTMPPCIeLinkCtrlSetting(pAd, 3); + } +#endif // RTMP_PCI_SUPPORT // + + pAd->bPCIclkOffDisableTx = FALSE; + return TRUE; +} + + + + +VOID RT28xxPciMlmeRadioOn( + IN PRTMP_ADAPTER pAd) +{ + if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) + return; + + DBGPRINT(RT_DEBUG_TRACE,("%s===>\n", __func__)); + + if ((pAd->OpMode == OPMODE_AP) || + ((pAd->OpMode == OPMODE_STA) && (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)))) + { + if (pAd->OpMode == OPMODE_AP) + RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); + + //NICResetFromError(pAd); + + RTMPRingCleanUp(pAd, QID_AC_BK); + RTMPRingCleanUp(pAd, QID_AC_BE); + RTMPRingCleanUp(pAd, QID_AC_VI); + RTMPRingCleanUp(pAd, QID_AC_VO); + RTMPRingCleanUp(pAd, QID_HCCA); + RTMPRingCleanUp(pAd, QID_MGMT); + RTMPRingCleanUp(pAd, QID_RX); + + if (pAd->OpMode == OPMODE_STA) + { + AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02); + RTMPusecDelay(10000); + } + + // Enable Tx/Rx + RTMPEnableRxTx(pAd); + + // Clear Radio off flag + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); + + // Set LED + RTMPSetLED(pAd, LED_RADIO_ON); + } + +#ifdef RTMP_PCI_SUPPORT + if ((pAd->OpMode == OPMODE_STA) && + (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))) + { + BOOLEAN Cancelled; + + RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); + + pAd->Mlme.bPsPollTimerRunning = FALSE; + RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); + RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); + RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); + } +#endif // RTMP_PCI_SUPPORT // +} + + +VOID RT28xxPciMlmeRadioOFF( + IN PRTMP_ADAPTER pAd) +{ + BOOLEAN brc=TRUE; + + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) + return; + + // Link down first if any association exists + if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) + { + if (INFRA_ON(pAd) || ADHOC_ON(pAd)) + { + MLME_DISASSOC_REQ_STRUCT DisReq; + MLME_QUEUE_ELEM *pMsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); + + if (pMsgElem) + { + COPY_MAC_ADDR(&DisReq.Addr, pAd->CommonCfg.Bssid); + DisReq.Reason = REASON_DISASSOC_STA_LEAVING; + + pMsgElem->Machine = ASSOC_STATE_MACHINE; + pMsgElem->MsgType = MT2_MLME_DISASSOC_REQ; + pMsgElem->MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT); + NdisMoveMemory(pMsgElem->Msg, &DisReq, sizeof(MLME_DISASSOC_REQ_STRUCT)); + + MlmeDisassocReqAction(pAd, pMsgElem); + kfree(pMsgElem); + + RTMPusecDelay(1000); + } + } + } + + DBGPRINT(RT_DEBUG_TRACE,("%s===>\n", __func__)); + + // Set Radio off flag + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); + + { + BOOLEAN Cancelled; + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) + { + RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &Cancelled); + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); + } + + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + { + BOOLEAN Cancelled; + pAd->Mlme.bPsPollTimerRunning = FALSE; + RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); + RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); + } + + // Link down first if any association exists + if (INFRA_ON(pAd) || ADHOC_ON(pAd)) + LinkDown(pAd, FALSE); + RTMPusecDelay(10000); + //========================================== + // Clean up old bss table + BssTableInit(&pAd->ScanTab); + + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + { + RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); + return; + } + } + + // Set LED + RTMPSetLED(pAd, LED_RADIO_OFF); + + if (pAd->OpMode == OPMODE_AP) + brc=RT28xxPciAsicRadioOff(pAd, GUIRADIO_OFF, 0); + + if (brc==FALSE) + { + DBGPRINT(RT_DEBUG_ERROR,("%s call RT28xxPciAsicRadioOff fail !!\n", __func__)); + } + + + if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE) && + (pAd->OpMode == OPMODE_STA)) + AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02); +} + +#endif // RTMP_MAC_PCI // diff --git a/drivers/staging/rt2860/common/cmm_mac_usb.c b/drivers/staging/rt2860/common/cmm_mac_usb.c new file mode 100644 index 000000000000..ad8c60176472 --- /dev/null +++ b/drivers/staging/rt2860/common/cmm_mac_usb.c @@ -0,0 +1,1216 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* +*/ + +#ifdef RTMP_MAC_USB + + +#include "../rt_config.h" + + +/* +======================================================================== +Routine Description: + Initialize receive data structures. + +Arguments: + pAd Pointer to our adapter + +Return Value: + NDIS_STATUS_SUCCESS + NDIS_STATUS_RESOURCES + +Note: + Initialize all receive releated private buffer, include those define + in RTMP_ADAPTER structure and all private data structures. The mahor + work is to allocate buffer for each packet and chain buffer to + NDIS packet descriptor. +======================================================================== +*/ +NDIS_STATUS NICInitRecv( + IN PRTMP_ADAPTER pAd) +{ + UCHAR i; + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + + + DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitRecv\n")); + pObj = pObj; + + //InterlockedExchange(&pAd->PendingRx, 0); + pAd->PendingRx = 0; + pAd->NextRxBulkInReadIndex = 0; // Next Rx Read index + pAd->NextRxBulkInIndex = 0 ; //RX_RING_SIZE -1; // Rx Bulk pointer + pAd->NextRxBulkInPosition = 0; + + for (i = 0; i < (RX_RING_SIZE); i++) + { + PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); + + //Allocate URB + pRxContext->pUrb = RTUSB_ALLOC_URB(0); + if (pRxContext->pUrb == NULL) + { + Status = NDIS_STATUS_RESOURCES; + goto out1; + } + + // Allocate transfer buffer + pRxContext->TransferBuffer = RTUSB_URB_ALLOC_BUFFER(pObj->pUsb_Dev, MAX_RXBULK_SIZE, &pRxContext->data_dma); + if (pRxContext->TransferBuffer == NULL) + { + Status = NDIS_STATUS_RESOURCES; + goto out1; + } + + NdisZeroMemory(pRxContext->TransferBuffer, MAX_RXBULK_SIZE); + + pRxContext->pAd = pAd; + pRxContext->pIrp = NULL; + pRxContext->InUse = FALSE; + pRxContext->IRPPending = FALSE; + pRxContext->Readable = FALSE; + //pRxContext->ReorderInUse = FALSE; + pRxContext->bRxHandling = FALSE; + pRxContext->BulkInOffset = 0; + } + + DBGPRINT(RT_DEBUG_TRACE, ("<-- NICInitRecv(Status=%d)\n", Status)); + return Status; + +out1: + for (i = 0; i < (RX_RING_SIZE); i++) + { + PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); + + if (NULL != pRxContext->TransferBuffer) + { + RTUSB_URB_FREE_BUFFER(pObj->pUsb_Dev, MAX_RXBULK_SIZE, + pRxContext->TransferBuffer, pRxContext->data_dma); + pRxContext->TransferBuffer = NULL; + } + + if (NULL != pRxContext->pUrb) + { + RTUSB_UNLINK_URB(pRxContext->pUrb); + RTUSB_FREE_URB(pRxContext->pUrb); + pRxContext->pUrb = NULL; + } + } + + return Status; +} + + +/* +======================================================================== +Routine Description: + Initialize transmit data structures. + +Arguments: + pAd Pointer to our adapter + +Return Value: + NDIS_STATUS_SUCCESS + NDIS_STATUS_RESOURCES + +Note: +======================================================================== +*/ +NDIS_STATUS NICInitTransmit( + IN PRTMP_ADAPTER pAd) +{ +#define LM_USB_ALLOC(pObj, Context, TB_Type, BufferSize, Status, msg1, err1, msg2, err2) \ + Context->pUrb = RTUSB_ALLOC_URB(0); \ + if (Context->pUrb == NULL) { \ + DBGPRINT(RT_DEBUG_ERROR, msg1); \ + Status = NDIS_STATUS_RESOURCES; \ + goto err1; } \ + \ + Context->TransferBuffer = \ + (TB_Type)RTUSB_URB_ALLOC_BUFFER(pObj->pUsb_Dev, BufferSize, &Context->data_dma); \ + if (Context->TransferBuffer == NULL) { \ + DBGPRINT(RT_DEBUG_ERROR, msg2); \ + Status = NDIS_STATUS_RESOURCES; \ + goto err2; } + +#define LM_URB_FREE(pObj, Context, BufferSize) \ + if (NULL != Context->pUrb) { \ + RTUSB_UNLINK_URB(Context->pUrb); \ + RTUSB_FREE_URB(Context->pUrb); \ + Context->pUrb = NULL; } \ + if (NULL != Context->TransferBuffer) { \ + RTUSB_URB_FREE_BUFFER(pObj->pUsb_Dev, BufferSize, \ + Context->TransferBuffer, \ + Context->data_dma); \ + Context->TransferBuffer = NULL; } + + UCHAR i, acidx; + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + PTX_CONTEXT pNullContext = &(pAd->NullContext); + PTX_CONTEXT pPsPollContext = &(pAd->PsPollContext); + PTX_CONTEXT pRTSContext = &(pAd->RTSContext); + PTX_CONTEXT pMLMEContext = NULL; +// PHT_TX_CONTEXT pHTTXContext = NULL; + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + PVOID RingBaseVa; +// RTMP_TX_RING *pTxRing; + RTMP_MGMT_RING *pMgmtRing; + + DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitTransmit\n")); + pObj = pObj; + + // Init 4 set of Tx parameters + for(acidx = 0; acidx < NUM_OF_TX_RING; acidx++) + { + // Initialize all Transmit releated queues + InitializeQueueHeader(&pAd->TxSwQueue[acidx]); + + // Next Local tx ring pointer waiting for buck out + pAd->NextBulkOutIndex[acidx] = acidx; + pAd->BulkOutPending[acidx] = FALSE; // Buck Out control flag + //pAd->DataBulkDoneIdx[acidx] = 0; + } + + //pAd->NextMLMEIndex = 0; + //pAd->PushMgmtIndex = 0; + //pAd->PopMgmtIndex = 0; + //InterlockedExchange(&pAd->MgmtQueueSize, 0); + //InterlockedExchange(&pAd->TxCount, 0); + + //pAd->PrioRingFirstIndex = 0; + //pAd->PrioRingTxCnt = 0; + + do + { + // + // TX_RING_SIZE, 4 ACs + // + for(acidx=0; acidx<4; acidx++) + { + PHT_TX_CONTEXT pHTTXContext = &(pAd->TxContext[acidx]); + + NdisZeroMemory(pHTTXContext, sizeof(HT_TX_CONTEXT)); + //Allocate URB + LM_USB_ALLOC(pObj, pHTTXContext, PHTTX_BUFFER, sizeof(HTTX_BUFFER), Status, + ("<-- ERROR in Alloc TX TxContext[%d] urb!! \n", acidx), + done, + ("<-- ERROR in Alloc TX TxContext[%d] HTTX_BUFFER !! \n", acidx), + out1); + + NdisZeroMemory(pHTTXContext->TransferBuffer->Aggregation, 4); + pHTTXContext->pAd = pAd; + pHTTXContext->pIrp = NULL; + pHTTXContext->IRPPending = FALSE; + pHTTXContext->NextBulkOutPosition = 0; + pHTTXContext->ENextBulkOutPosition = 0; + pHTTXContext->CurWritePosition = 0; + pHTTXContext->CurWriteRealPos = 0; + pHTTXContext->BulkOutSize = 0; + pHTTXContext->BulkOutPipeId = acidx; + pHTTXContext->bRingEmpty = TRUE; + pHTTXContext->bCopySavePad = FALSE; + pAd->BulkOutPending[acidx] = FALSE; + } + + + // + // MGMT_RING_SIZE + // + + // Allocate MGMT ring descriptor's memory + pAd->MgmtDescRing.AllocSize = MGMT_RING_SIZE * sizeof(TX_CONTEXT); + os_alloc_mem(pAd, (PUCHAR *)(&pAd->MgmtDescRing.AllocVa), pAd->MgmtDescRing.AllocSize); + if (pAd->MgmtDescRing.AllocVa == NULL) + { + DBGPRINT_ERR(("Failed to allocate a big buffer for MgmtDescRing!\n")); + Status = NDIS_STATUS_RESOURCES; + goto out1; + } + NdisZeroMemory(pAd->MgmtDescRing.AllocVa, pAd->MgmtDescRing.AllocSize); + RingBaseVa = pAd->MgmtDescRing.AllocVa; + + // Initialize MGMT Ring and associated buffer memory + pMgmtRing = &pAd->MgmtRing; + for (i = 0; i < MGMT_RING_SIZE; i++) + { + // link the pre-allocated Mgmt buffer to MgmtRing.Cell + pMgmtRing->Cell[i].AllocSize = sizeof(TX_CONTEXT); + pMgmtRing->Cell[i].AllocVa = RingBaseVa; + pMgmtRing->Cell[i].pNdisPacket = NULL; + pMgmtRing->Cell[i].pNextNdisPacket = NULL; + + //Allocate URB for MLMEContext + pMLMEContext = (PTX_CONTEXT) pAd->MgmtRing.Cell[i].AllocVa; + pMLMEContext->pUrb = RTUSB_ALLOC_URB(0); + if (pMLMEContext->pUrb == NULL) + { + DBGPRINT(RT_DEBUG_ERROR, ("<-- ERROR in Alloc TX MLMEContext[%d] urb!! \n", i)); + Status = NDIS_STATUS_RESOURCES; + goto out2; + } + pMLMEContext->pAd = pAd; + pMLMEContext->pIrp = NULL; + pMLMEContext->TransferBuffer = NULL; + pMLMEContext->InUse = FALSE; + pMLMEContext->IRPPending = FALSE; + pMLMEContext->bWaitingBulkOut = FALSE; + pMLMEContext->BulkOutSize = 0; + pMLMEContext->SelfIdx = i; + + // Offset to next ring descriptor address + RingBaseVa = (PUCHAR) RingBaseVa + sizeof(TX_CONTEXT); + } + DBGPRINT(RT_DEBUG_TRACE, ("MGMT Ring: total %d entry allocated\n", i)); + + //pAd->MgmtRing.TxSwFreeIdx = (MGMT_RING_SIZE - 1); + pAd->MgmtRing.TxSwFreeIdx = MGMT_RING_SIZE; + pAd->MgmtRing.TxCpuIdx = 0; + pAd->MgmtRing.TxDmaIdx = 0; + + // + // BEACON_RING_SIZE + // + for(i=0; iBeaconContext[i]); + + + NdisZeroMemory(pBeaconContext, sizeof(TX_CONTEXT)); + + //Allocate URB + LM_USB_ALLOC(pObj, pBeaconContext, PTX_BUFFER, sizeof(TX_BUFFER), Status, + ("<-- ERROR in Alloc TX BeaconContext[%d] urb!! \n", i), + out2, + ("<-- ERROR in Alloc TX BeaconContext[%d] TX_BUFFER !! \n", i), + out3); + + pBeaconContext->pAd = pAd; + pBeaconContext->pIrp = NULL; + pBeaconContext->InUse = FALSE; + pBeaconContext->IRPPending = FALSE; + } + + // + // NullContext + // + NdisZeroMemory(pNullContext, sizeof(TX_CONTEXT)); + + //Allocate URB + LM_USB_ALLOC(pObj, pNullContext, PTX_BUFFER, sizeof(TX_BUFFER), Status, + ("<-- ERROR in Alloc TX NullContext urb!! \n"), + out3, + ("<-- ERROR in Alloc TX NullContext TX_BUFFER !! \n"), + out4); + + pNullContext->pAd = pAd; + pNullContext->pIrp = NULL; + pNullContext->InUse = FALSE; + pNullContext->IRPPending = FALSE; + + // + // RTSContext + // + NdisZeroMemory(pRTSContext, sizeof(TX_CONTEXT)); + + //Allocate URB + LM_USB_ALLOC(pObj, pRTSContext, PTX_BUFFER, sizeof(TX_BUFFER), Status, + ("<-- ERROR in Alloc TX RTSContext urb!! \n"), + out4, + ("<-- ERROR in Alloc TX RTSContext TX_BUFFER !! \n"), + out5); + + pRTSContext->pAd = pAd; + pRTSContext->pIrp = NULL; + pRTSContext->InUse = FALSE; + pRTSContext->IRPPending = FALSE; + + // + // PsPollContext + // + //NdisZeroMemory(pPsPollContext, sizeof(TX_CONTEXT)); + //Allocate URB + LM_USB_ALLOC(pObj, pPsPollContext, PTX_BUFFER, sizeof(TX_BUFFER), Status, + ("<-- ERROR in Alloc TX PsPollContext urb!! \n"), + out5, + ("<-- ERROR in Alloc TX PsPollContext TX_BUFFER !! \n"), + out6); + + pPsPollContext->pAd = pAd; + pPsPollContext->pIrp = NULL; + pPsPollContext->InUse = FALSE; + pPsPollContext->IRPPending = FALSE; + pPsPollContext->bAggregatible = FALSE; + pPsPollContext->LastOne = TRUE; + + } while (FALSE); + + +done: + DBGPRINT(RT_DEBUG_TRACE, ("<-- NICInitTransmit(Status=%d)\n", Status)); + + return Status; + + /* --------------------------- ERROR HANDLE --------------------------- */ +out6: + LM_URB_FREE(pObj, pPsPollContext, sizeof(TX_BUFFER)); + +out5: + LM_URB_FREE(pObj, pRTSContext, sizeof(TX_BUFFER)); + +out4: + LM_URB_FREE(pObj, pNullContext, sizeof(TX_BUFFER)); + +out3: + for(i=0; iBeaconContext[i]); + if (pBeaconContext) + LM_URB_FREE(pObj, pBeaconContext, sizeof(TX_BUFFER)); + } + +out2: + if (pAd->MgmtDescRing.AllocVa) + { + pMgmtRing = &pAd->MgmtRing; + for(i=0; iMgmtRing.Cell[i].AllocVa; + if (pMLMEContext) + LM_URB_FREE(pObj, pMLMEContext, sizeof(TX_BUFFER)); + } + os_free_mem(pAd, pAd->MgmtDescRing.AllocVa); + pAd->MgmtDescRing.AllocVa = NULL; + } + +out1: + for (acidx = 0; acidx < 4; acidx++) + { + PHT_TX_CONTEXT pTxContext = &(pAd->TxContext[acidx]); + if (pTxContext) + LM_URB_FREE(pObj, pTxContext, sizeof(HTTX_BUFFER)); + } + + // Here we didn't have any pre-allocated memory need to free. + + return Status; +} + + +/* +======================================================================== +Routine Description: + Allocate DMA memory blocks for send, receive. + +Arguments: + pAd Pointer to our adapter + +Return Value: + NDIS_STATUS_SUCCESS + NDIS_STATUS_FAILURE + NDIS_STATUS_RESOURCES + +Note: +======================================================================== +*/ +NDIS_STATUS RTMPAllocTxRxRingMemory( + IN PRTMP_ADAPTER pAd) +{ +// COUNTER_802_11 pCounter = &pAd->WlanCounters; + NDIS_STATUS Status; + INT num; + + + DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPAllocTxRxRingMemory\n")); + + + do + { + // Init the CmdQ and CmdQLock + NdisAllocateSpinLock(&pAd->CmdQLock); + NdisAcquireSpinLock(&pAd->CmdQLock); + RTUSBInitializeCmdQ(&pAd->CmdQ); + NdisReleaseSpinLock(&pAd->CmdQLock); + + + NdisAllocateSpinLock(&pAd->MLMEBulkOutLock); + //NdisAllocateSpinLock(&pAd->MLMEWaitQueueLock); + NdisAllocateSpinLock(&pAd->BulkOutLock[0]); + NdisAllocateSpinLock(&pAd->BulkOutLock[1]); + NdisAllocateSpinLock(&pAd->BulkOutLock[2]); + NdisAllocateSpinLock(&pAd->BulkOutLock[3]); + NdisAllocateSpinLock(&pAd->BulkOutLock[4]); + NdisAllocateSpinLock(&pAd->BulkOutLock[5]); + NdisAllocateSpinLock(&pAd->BulkInLock); + + for (num = 0; num < NUM_OF_TX_RING; num++) + { + NdisAllocateSpinLock(&pAd->TxContextQueueLock[num]); + } + + +// NdisAllocateSpinLock(&pAd->MemLock); // Not used in RT28XX + +// NdisAllocateSpinLock(&pAd->MacTabLock); // init it in UserCfgInit() +// NdisAllocateSpinLock(&pAd->BATabLock); // init it in BATableInit() + +// for(num=0; numBATable.BARecEntry[num].RxReRingLock); +// } + + // + // Init Mac Table + // +// MacTableInitialize(pAd); + + // + // Init send data structures and related parameters + // + Status = NICInitTransmit(pAd); + if (Status != NDIS_STATUS_SUCCESS) + break; + + // + // Init receive data structures and related parameters + // + Status = NICInitRecv(pAd); + if (Status != NDIS_STATUS_SUCCESS) + break; + + pAd->PendingIoCount = 1; + + } while (FALSE); + + NdisZeroMemory(&pAd->FragFrame, sizeof(FRAGMENT_FRAME)); + pAd->FragFrame.pFragPacket = RTMP_AllocateFragPacketBuffer(pAd, RX_BUFFER_NORMSIZE); + + if (pAd->FragFrame.pFragPacket == NULL) + { + Status = NDIS_STATUS_RESOURCES; + } + + DBGPRINT_S(Status, ("<-- RTMPAllocTxRxRingMemory, Status=%x\n", Status)); + return Status; +} + + +/* +======================================================================== +Routine Description: + Calls USB_InterfaceStop and frees memory allocated for the URBs + calls NdisMDeregisterDevice and frees the memory + allocated in VNetInitialize for the Adapter Object + +Arguments: + *pAd the raxx interface data pointer + +Return Value: + None + +Note: +======================================================================== +*/ +VOID RTMPFreeTxRxRingMemory( + IN PRTMP_ADAPTER pAd) +{ +#define LM_URB_FREE(pObj, Context, BufferSize) \ + if (NULL != Context->pUrb) { \ + RTUSB_UNLINK_URB(Context->pUrb); \ + RTUSB_FREE_URB(Context->pUrb); \ + Context->pUrb = NULL; } \ + if (NULL != Context->TransferBuffer) { \ + RTUSB_URB_FREE_BUFFER(pObj->pUsb_Dev, BufferSize, \ + Context->TransferBuffer, \ + Context->data_dma); \ + Context->TransferBuffer = NULL; } + + + UINT i, acidx; + PTX_CONTEXT pNullContext = &pAd->NullContext; + PTX_CONTEXT pPsPollContext = &pAd->PsPollContext; + PTX_CONTEXT pRTSContext = &pAd->RTSContext; +// PHT_TX_CONTEXT pHTTXContext; + //PRTMP_REORDERBUF pReorderBuf; + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; +// RTMP_TX_RING *pTxRing; + + DBGPRINT(RT_DEBUG_ERROR, ("---> RTMPFreeTxRxRingMemory\n")); + pObj = pObj; + + // Free all resources for the RECEIVE buffer queue. + for(i=0; i<(RX_RING_SIZE); i++) + { + PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); + if (pRxContext) + LM_URB_FREE(pObj, pRxContext, MAX_RXBULK_SIZE); + } + + // Free PsPoll frame resource + LM_URB_FREE(pObj, pPsPollContext, sizeof(TX_BUFFER)); + + // Free NULL frame resource + LM_URB_FREE(pObj, pNullContext, sizeof(TX_BUFFER)); + + // Free RTS frame resource + LM_URB_FREE(pObj, pRTSContext, sizeof(TX_BUFFER)); + + + // Free beacon frame resource + for(i=0; iBeaconContext[i]); + if (pBeaconContext) + LM_URB_FREE(pObj, pBeaconContext, sizeof(TX_BUFFER)); + } + + + // Free mgmt frame resource + for(i = 0; i < MGMT_RING_SIZE; i++) + { + PTX_CONTEXT pMLMEContext = (PTX_CONTEXT)pAd->MgmtRing.Cell[i].AllocVa; + //LM_URB_FREE(pObj, pMLMEContext, sizeof(TX_BUFFER)); + if (NULL != pAd->MgmtRing.Cell[i].pNdisPacket) + { + RTMPFreeNdisPacket(pAd, pAd->MgmtRing.Cell[i].pNdisPacket); + pAd->MgmtRing.Cell[i].pNdisPacket = NULL; + pMLMEContext->TransferBuffer = NULL; + } + + if (pMLMEContext) + { + if (NULL != pMLMEContext->pUrb) + { + RTUSB_UNLINK_URB(pMLMEContext->pUrb); + RTUSB_FREE_URB(pMLMEContext->pUrb); + pMLMEContext->pUrb = NULL; + } + } + } + if (pAd->MgmtDescRing.AllocVa) + os_free_mem(pAd, pAd->MgmtDescRing.AllocVa); + + + // Free Tx frame resource + for (acidx = 0; acidx < 4; acidx++) + { + PHT_TX_CONTEXT pHTTXContext = &(pAd->TxContext[acidx]); + if (pHTTXContext) + LM_URB_FREE(pObj, pHTTXContext, sizeof(HTTX_BUFFER)); + } + + if (pAd->FragFrame.pFragPacket) + RELEASE_NDIS_PACKET(pAd, pAd->FragFrame.pFragPacket, NDIS_STATUS_SUCCESS); + + for(i=0; i<6; i++) + { + NdisFreeSpinLock(&pAd->BulkOutLock[i]); + } + + NdisFreeSpinLock(&pAd->BulkInLock); + NdisFreeSpinLock(&pAd->MLMEBulkOutLock); + + NdisFreeSpinLock(&pAd->CmdQLock); + // Clear all pending bulk-out request flags. + RTUSB_CLEAR_BULK_FLAG(pAd, 0xffffffff); + +// NdisFreeSpinLock(&pAd->MacTabLock); + +// for(i=0; iBATable.BARecEntry[i].RxReRingLock); +// } + + DBGPRINT(RT_DEBUG_ERROR, ("<--- RTMPFreeTxRxRingMemory\n")); +} + + +/* +======================================================================== +Routine Description: + Write WLAN MAC address to USB 2870. + +Arguments: + pAd Pointer to our adapter + +Return Value: + NDIS_STATUS_SUCCESS + +Note: +======================================================================== +*/ +NDIS_STATUS RTUSBWriteHWMACAddress( + IN PRTMP_ADAPTER pAd) +{ + MAC_DW0_STRUC StaMacReg0; + MAC_DW1_STRUC StaMacReg1; + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + LARGE_INTEGER NOW; + + + // initialize the random number generator + RTMP_GetCurrentSystemTime(&NOW); + + if (pAd->bLocalAdminMAC != TRUE) + { + pAd->CurrentAddress[0] = pAd->PermanentAddress[0]; + pAd->CurrentAddress[1] = pAd->PermanentAddress[1]; + pAd->CurrentAddress[2] = pAd->PermanentAddress[2]; + pAd->CurrentAddress[3] = pAd->PermanentAddress[3]; + pAd->CurrentAddress[4] = pAd->PermanentAddress[4]; + pAd->CurrentAddress[5] = pAd->PermanentAddress[5]; + } + // Write New MAC address to MAC_CSR2 & MAC_CSR3 & let ASIC know our new MAC + StaMacReg0.field.Byte0 = pAd->CurrentAddress[0]; + StaMacReg0.field.Byte1 = pAd->CurrentAddress[1]; + StaMacReg0.field.Byte2 = pAd->CurrentAddress[2]; + StaMacReg0.field.Byte3 = pAd->CurrentAddress[3]; + StaMacReg1.field.Byte4 = pAd->CurrentAddress[4]; + StaMacReg1.field.Byte5 = pAd->CurrentAddress[5]; + StaMacReg1.field.U2MeMask = 0xff; + DBGPRINT_RAW(RT_DEBUG_TRACE, ("Local MAC = %02x:%02x:%02x:%02x:%02x:%02x\n", + pAd->CurrentAddress[0], pAd->CurrentAddress[1], pAd->CurrentAddress[2], + pAd->CurrentAddress[3], pAd->CurrentAddress[4], pAd->CurrentAddress[5])); + + RTUSBWriteMACRegister(pAd, MAC_ADDR_DW0, StaMacReg0.word); + RTUSBWriteMACRegister(pAd, MAC_ADDR_DW1, StaMacReg1.word); + return Status; +} + + +/* +======================================================================== +Routine Description: + Disable DMA. + +Arguments: + *pAd the raxx interface data pointer + +Return Value: + None + +Note: +======================================================================== +*/ +VOID RT28XXDMADisable( + IN RTMP_ADAPTER *pAd) +{ + // no use +} + + +/* +======================================================================== +Routine Description: + Enable DMA. + +Arguments: + *pAd the raxx interface data pointer + +Return Value: + None + +Note: +======================================================================== +*/ +VOID RT28XXDMAEnable( + IN RTMP_ADAPTER *pAd) +{ + WPDMA_GLO_CFG_STRUC GloCfg; + USB_DMA_CFG_STRUC UsbCfg; + int i = 0; + + + RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x4); + do + { + RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); + if ((GloCfg.field.TxDMABusy == 0) && (GloCfg.field.RxDMABusy == 0)) + break; + + DBGPRINT(RT_DEBUG_TRACE, ("==> DMABusy\n")); + RTMPusecDelay(1000); + i++; + }while ( i <200); + + + RTMPusecDelay(50); + GloCfg.field.EnTXWriteBackDDONE = 1; + GloCfg.field.EnableRxDMA = 1; + GloCfg.field.EnableTxDMA = 1; + DBGPRINT(RT_DEBUG_TRACE, ("<== WRITE DMA offset 0x208 = 0x%x\n", GloCfg.word)); + RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); + + UsbCfg.word = 0; + UsbCfg.field.phyclear = 0; + /* usb version is 1.1,do not use bulk in aggregation */ + if (pAd->BulkInMaxPacketSize == 512) + UsbCfg.field.RxBulkAggEn = 1; + /* for last packet, PBF might use more than limited, so minus 2 to prevent from error */ + UsbCfg.field.RxBulkAggLmt = (MAX_RXBULK_SIZE /1024)-3; + UsbCfg.field.RxBulkAggTOut = 0x80; /* 2006-10-18 */ + UsbCfg.field.RxBulkEn = 1; + UsbCfg.field.TxBulkEn = 1; + + RTUSBWriteMACRegister(pAd, USB_DMA_CFG, UsbCfg.word); + +} + +/******************************************************************** + * + * 2870 Beacon Update Related functions. + * + ********************************************************************/ + +/* +======================================================================== +Routine Description: + Write Beacon buffer to Asic. + +Arguments: + *pAd the raxx interface data pointer + +Return Value: + None + +Note: +======================================================================== +*/ +VOID RT28xx_UpdateBeaconToAsic( + IN RTMP_ADAPTER *pAd, + IN INT apidx, + IN ULONG FrameLen, + IN ULONG UpdatePos) +{ + PUCHAR pBeaconFrame = NULL; + UCHAR *ptr; + UINT i, padding; + BEACON_SYNC_STRUCT *pBeaconSync = pAd->CommonCfg.pBeaconSync; + UINT32 longValue; +// USHORT shortValue; + BOOLEAN bBcnReq = FALSE; + UCHAR bcn_idx = 0; + + + if (pBeaconFrame == NULL) + { + DBGPRINT(RT_DEBUG_ERROR,("pBeaconFrame is NULL!\n")); + return; + } + + if (pBeaconSync == NULL) + { + DBGPRINT(RT_DEBUG_ERROR,("pBeaconSync is NULL!\n")); + return; + } + + //if ((pAd->WdsTab.Mode == WDS_BRIDGE_MODE) || + // ((pAd->ApCfg.MBSSID[apidx].MSSIDDev == NULL) || !(pAd->ApCfg.MBSSID[apidx].MSSIDDev->flags & IFF_UP)) + // ) + if (bBcnReq == FALSE) + { + /* when the ra interface is down, do not send its beacon frame */ + /* clear all zero */ + for(i=0; iBeaconOffset[bcn_idx] + i, 0x00); + } + pBeaconSync->BeaconBitMap &= (~(BEACON_BITMAP_MASK & (1 << bcn_idx))); + NdisZeroMemory(pBeaconSync->BeaconTxWI[bcn_idx], TXWI_SIZE); + } + else + { + ptr = (PUCHAR)&pAd->BeaconTxWI; + if (NdisEqualMemory(pBeaconSync->BeaconTxWI[bcn_idx], &pAd->BeaconTxWI, TXWI_SIZE) == FALSE) + { // If BeaconTxWI changed, we need to rewrite the TxWI for the Beacon frames. + pBeaconSync->BeaconBitMap &= (~(BEACON_BITMAP_MASK & (1 << bcn_idx))); + NdisMoveMemory(pBeaconSync->BeaconTxWI[bcn_idx], &pAd->BeaconTxWI, TXWI_SIZE); + } + + if ((pBeaconSync->BeaconBitMap & (1 << bcn_idx)) != (1 << bcn_idx)) + { + for (i=0; iBeaconOffset[bcn_idx] + i, longValue); + ptr += 4; + } + } + + ptr = pBeaconSync->BeaconBuf[bcn_idx]; + padding = (FrameLen & 0x01); + NdisZeroMemory((PUCHAR)(pBeaconFrame + FrameLen), padding); + FrameLen += padding; + for (i = 0 ; i < FrameLen /*HW_BEACON_OFFSET*/; i += 2) + { + if (NdisEqualMemory(ptr, pBeaconFrame, 2) == FALSE) + { + NdisMoveMemory(ptr, pBeaconFrame, 2); + //shortValue = *ptr + (*(ptr+1)<<8); + //RTMP_IO_WRITE8(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, shortValue); + RTUSBMultiWrite(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, ptr, 2); + } + ptr +=2; + pBeaconFrame += 2; + } + + pBeaconSync->BeaconBitMap |= (1 << bcn_idx); + + // For AP interface, set the DtimBitOn so that we can send Bcast/Mcast frame out after this beacon frame. +} + +} + + +VOID RTUSBBssBeaconStop( + IN RTMP_ADAPTER *pAd) +{ + BEACON_SYNC_STRUCT *pBeaconSync; + int i, offset; + BOOLEAN Cancelled = TRUE; + + pBeaconSync = pAd->CommonCfg.pBeaconSync; + if (pBeaconSync && pBeaconSync->EnableBeacon) + { + INT NumOfBcn; + + { + NumOfBcn = MAX_MESH_NUM; + } + + RTMPCancelTimer(&pAd->CommonCfg.BeaconUpdateTimer, &Cancelled); + + for(i=0; iBeaconBuf[i], HW_BEACON_OFFSET); + NdisZeroMemory(pBeaconSync->BeaconTxWI[i], TXWI_SIZE); + + for (offset=0; offsetBeaconOffset[i] + offset, 0x00); + + pBeaconSync->CapabilityInfoLocationInBeacon[i] = 0; + pBeaconSync->TimIELocationInBeacon[i] = 0; + } + pBeaconSync->BeaconBitMap = 0; + pBeaconSync->DtimBitOn = 0; + } +} + + +VOID RTUSBBssBeaconStart( + IN RTMP_ADAPTER *pAd) +{ + int apidx; + BEACON_SYNC_STRUCT *pBeaconSync; +// LARGE_INTEGER tsfTime, deltaTime; + + pBeaconSync = pAd->CommonCfg.pBeaconSync; + if (pBeaconSync && pBeaconSync->EnableBeacon) + { + INT NumOfBcn; + + { + NumOfBcn = MAX_MESH_NUM; + } + + for(apidx=0; apidxBeaconBuf[apidx], HW_BEACON_OFFSET); + pBeaconSync->CapabilityInfoLocationInBeacon[apidx] = CapabilityInfoLocationInBeacon; + pBeaconSync->TimIELocationInBeacon[apidx] = TimIELocationInBeacon; + NdisZeroMemory(pBeaconSync->BeaconTxWI[apidx], TXWI_SIZE); + } + pBeaconSync->BeaconBitMap = 0; + pBeaconSync->DtimBitOn = 0; + pAd->CommonCfg.BeaconUpdateTimer.Repeat = TRUE; + + pAd->CommonCfg.BeaconAdjust = 0; + pAd->CommonCfg.BeaconFactor = 0xffffffff / (pAd->CommonCfg.BeaconPeriod << 10); + pAd->CommonCfg.BeaconRemain = (0xffffffff % (pAd->CommonCfg.BeaconPeriod << 10)) + 1; + DBGPRINT(RT_DEBUG_TRACE, ("RTUSBBssBeaconStart:BeaconFactor=%d, BeaconRemain=%d!\n", + pAd->CommonCfg.BeaconFactor, pAd->CommonCfg.BeaconRemain)); + RTMPSetTimer(&pAd->CommonCfg.BeaconUpdateTimer, 10 /*pAd->CommonCfg.BeaconPeriod*/); + + } +} + + +VOID RTUSBBssBeaconInit( + IN RTMP_ADAPTER *pAd) +{ + BEACON_SYNC_STRUCT *pBeaconSync; + int i; + + os_alloc_mem(pAd, (PUCHAR *)(&pAd->CommonCfg.pBeaconSync), sizeof(BEACON_SYNC_STRUCT)); + //NdisAllocMemory(pAd->CommonCfg.pBeaconSync, sizeof(BEACON_SYNC_STRUCT), MEM_ALLOC_FLAG); + if (pAd->CommonCfg.pBeaconSync) + { + pBeaconSync = pAd->CommonCfg.pBeaconSync; + NdisZeroMemory(pBeaconSync, sizeof(BEACON_SYNC_STRUCT)); + for(i=0; i < HW_BEACON_MAX_COUNT; i++) + { + NdisZeroMemory(pBeaconSync->BeaconBuf[i], HW_BEACON_OFFSET); + pBeaconSync->CapabilityInfoLocationInBeacon[i] = 0; + pBeaconSync->TimIELocationInBeacon[i] = 0; + NdisZeroMemory(pBeaconSync->BeaconTxWI[i], TXWI_SIZE); + } + pBeaconSync->BeaconBitMap = 0; + + //RTMPInitTimer(pAd, &pAd->CommonCfg.BeaconUpdateTimer, GET_TIMER_FUNCTION(BeaconUpdateExec), pAd, TRUE); + pBeaconSync->EnableBeacon = TRUE; + } +} + + +VOID RTUSBBssBeaconExit( + IN RTMP_ADAPTER *pAd) +{ + BEACON_SYNC_STRUCT *pBeaconSync; + BOOLEAN Cancelled = TRUE; + int i; + + if (pAd->CommonCfg.pBeaconSync) + { + pBeaconSync = pAd->CommonCfg.pBeaconSync; + pBeaconSync->EnableBeacon = FALSE; + RTMPCancelTimer(&pAd->CommonCfg.BeaconUpdateTimer, &Cancelled); + pBeaconSync->BeaconBitMap = 0; + + for(i=0; iBeaconBuf[i], HW_BEACON_OFFSET); + pBeaconSync->CapabilityInfoLocationInBeacon[i] = 0; + pBeaconSync->TimIELocationInBeacon[i] = 0; + NdisZeroMemory(pBeaconSync->BeaconTxWI[i], TXWI_SIZE); + } + + os_free_mem(pAd, pAd->CommonCfg.pBeaconSync); + pAd->CommonCfg.pBeaconSync = NULL; + } +} + + +/* + ======================================================================== + Routine Description: + For device work as AP mode but didn't have TBTT interrupt event, we need a mechanism + to update the beacon context in each Beacon interval. Here we use a periodical timer + to simulate the TBTT interrupt to handle the beacon context update. + + Arguments: + SystemSpecific1 - Not used. + FunctionContext - Pointer to our Adapter context. + SystemSpecific2 - Not used. + SystemSpecific3 - Not used. + + Return Value: + None + + ======================================================================== +*/ +VOID BeaconUpdateExec( + IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3) +{ + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)FunctionContext; + LARGE_INTEGER tsfTime_a;//, tsfTime_b, deltaTime_exp, deltaTime_ab; + UINT32 delta, delta2MS, period2US, remain, remain_low, remain_high; +// BOOLEAN positive; + + if (pAd->CommonCfg.IsUpdateBeacon==TRUE) + { + ReSyncBeaconTime(pAd); + + + } + + RTMP_IO_READ32(pAd, TSF_TIMER_DW0, &tsfTime_a.u.LowPart); + RTMP_IO_READ32(pAd, TSF_TIMER_DW1, &tsfTime_a.u.HighPart); + + + //positive=getDeltaTime(tsfTime_a, expectedTime, &deltaTime_exp); + period2US = (pAd->CommonCfg.BeaconPeriod << 10); + remain_high = pAd->CommonCfg.BeaconRemain * tsfTime_a.u.HighPart; + remain_low = tsfTime_a.u.LowPart % (pAd->CommonCfg.BeaconPeriod << 10); + remain = (remain_high + remain_low)%(pAd->CommonCfg.BeaconPeriod << 10); + delta = (pAd->CommonCfg.BeaconPeriod << 10) - remain; + + delta2MS = (delta>>10); + if (delta2MS > 150) + { + pAd->CommonCfg.BeaconUpdateTimer.TimerValue = 100; + pAd->CommonCfg.IsUpdateBeacon=FALSE; + } + else + { + pAd->CommonCfg.BeaconUpdateTimer.TimerValue = delta2MS + 10; + pAd->CommonCfg.IsUpdateBeacon=TRUE; + } + +} + + +/******************************************************************** + * + * 2870 Radio on/off Related functions. + * + ********************************************************************/ +VOID RT28xxUsbMlmeRadioOn( + IN PRTMP_ADAPTER pAd) +{ + RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + + DBGPRINT(RT_DEBUG_TRACE,("RT28xxUsbMlmeRadioOn()\n")); + + if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) + return; + + { + AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02); + RTMPusecDelay(10000); + } + //NICResetFromError(pAd); + + // Enable Tx/Rx + RTMPEnableRxTx(pAd); + + if (pChipOps->AsicReverseRfFromSleepMode) + pChipOps->AsicReverseRfFromSleepMode(pAd); + + // Clear Radio off flag + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); + + RTUSBBulkReceive(pAd); + + // Set LED + RTMPSetLED(pAd, LED_RADIO_ON); +} + + +VOID RT28xxUsbMlmeRadioOFF( + IN PRTMP_ADAPTER pAd) +{ + WPDMA_GLO_CFG_STRUC GloCfg; + UINT32 Value, i; + + DBGPRINT(RT_DEBUG_TRACE,("RT28xxUsbMlmeRadioOFF()\n")); + + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) + return; + + // Clear PMKID cache. + pAd->StaCfg.SavedPMKNum = 0; + RTMPZeroMemory(pAd->StaCfg.SavedPMK, (PMKID_NO * sizeof(BSSID_INFO))); + + // Link down first if any association exists + if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) + { + if (INFRA_ON(pAd) || ADHOC_ON(pAd)) + { + MLME_DISASSOC_REQ_STRUCT DisReq; + MLME_QUEUE_ELEM *pMsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); + + if (pMsgElem) + { + COPY_MAC_ADDR(&DisReq.Addr, pAd->CommonCfg.Bssid); + DisReq.Reason = REASON_DISASSOC_STA_LEAVING; + + pMsgElem->Machine = ASSOC_STATE_MACHINE; + pMsgElem->MsgType = MT2_MLME_DISASSOC_REQ; + pMsgElem->MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT); + NdisMoveMemory(pMsgElem->Msg, &DisReq, sizeof(MLME_DISASSOC_REQ_STRUCT)); + + MlmeDisassocReqAction(pAd, pMsgElem); + kfree(pMsgElem); + + RTMPusecDelay(1000); + } + } + } + + // Set Radio off flag + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); + + { + // Link down first if any association exists + if (INFRA_ON(pAd) || ADHOC_ON(pAd)) + LinkDown(pAd, FALSE); + RTMPusecDelay(10000); + + //========================================== + // Clean up old bss table + BssTableInit(&pAd->ScanTab); + } + + // Set LED + RTMPSetLED(pAd, LED_RADIO_OFF); + + + if (pAd->CommonCfg.BBPCurrentBW == BW_40) + { + // Must using 40MHz. + AsicTurnOffRFClk(pAd, pAd->CommonCfg.CentralChannel); + } + else + { + // Must using 20MHz. + AsicTurnOffRFClk(pAd, pAd->CommonCfg.Channel); + } + + // Disable Tx/Rx DMA + RTUSBReadMACRegister(pAd, WPDMA_GLO_CFG, &GloCfg.word); // disable DMA + GloCfg.field.EnableTxDMA = 0; + GloCfg.field.EnableRxDMA = 0; + RTUSBWriteMACRegister(pAd, WPDMA_GLO_CFG, GloCfg.word); // abort all TX rings + + // Waiting for DMA idle + i = 0; + do + { + RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); + if ((GloCfg.field.TxDMABusy == 0) && (GloCfg.field.RxDMABusy == 0)) + break; + + RTMPusecDelay(1000); + }while (i++ < 100); + + // Disable MAC Tx/Rx + RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); + Value &= (0xfffffff3); + RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); + + { + AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02); + } +} + +#endif // RTMP_MAC_USB // diff --git a/drivers/staging/rt2860/common/cmm_profile.c b/drivers/staging/rt2860/common/cmm_profile.c new file mode 100644 index 000000000000..2d28524c1392 --- /dev/null +++ b/drivers/staging/rt2860/common/cmm_profile.c @@ -0,0 +1,1736 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* +*/ + +#include "../rt_config.h" + + +#define ETH_MAC_ADDR_STR_LEN 17 // in format of xx:xx:xx:xx:xx:xx + +// We assume the s1 is a sting, s2 is a memory space with 6 bytes. and content of s1 will be changed. +BOOLEAN rtstrmactohex(PSTRING s1, PSTRING s2) +{ + int i = 0; + PSTRING ptokS = s1, ptokE = s1; + + if (strlen(s1) != ETH_MAC_ADDR_STR_LEN) + return FALSE; + + while((*ptokS) != '\0') + { + if((ptokE = strchr(ptokS, ':')) != NULL) + *ptokE++ = '\0'; + if ((strlen(ptokS) != 2) || (!isxdigit(*ptokS)) || (!isxdigit(*(ptokS+1)))) + break; // fail + AtoH(ptokS, (PUCHAR)&s2[i++], 1); + ptokS = ptokE; + if (i == 6) + break; // parsing finished + } + + return ( i == 6 ? TRUE : FALSE); + +} + + +// we assume the s1 and s2 both are strings. +BOOLEAN rtstrcasecmp(PSTRING s1, PSTRING s2) +{ + PSTRING p1 = s1, p2 = s2; + + if (strlen(s1) != strlen(s2)) + return FALSE; + + while(*p1 != '\0') + { + if((*p1 != *p2) && ((*p1 ^ *p2) != 0x20)) + return FALSE; + p1++; + p2++; + } + + return TRUE; +} + +// we assume the s1 (buffer) and s2 (key) both are strings. +PSTRING rtstrstruncasecmp(PSTRING s1, PSTRING s2) +{ + INT l1, l2, i; + char temp1, temp2; + + l2 = strlen(s2); + if (!l2) + return (char *) s1; + + l1 = strlen(s1); + + while (l1 >= l2) + { + l1--; + + for(i=0; i= l2) + { + l1--; + if (!memcmp(s1,s2,l2)) + return s1; + s1++; + } + + return NULL; +} + +/** + * rstrtok - Split a string into tokens + * @s: The string to be searched + * @ct: The characters to search for + * * WARNING: strtok is deprecated, use strsep instead. However strsep is not compatible with old architecture. + */ +PSTRING __rstrtok; +PSTRING rstrtok(PSTRING s,const PSTRING ct) +{ + PSTRING sbegin, send; + + sbegin = s ? s : __rstrtok; + if (!sbegin) + { + return NULL; + } + + sbegin += strspn(sbegin,ct); + if (*sbegin == '\0') + { + __rstrtok = NULL; + return( NULL ); + } + + send = strpbrk( sbegin, ct); + if (send && *send != '\0') + *send++ = '\0'; + + __rstrtok = send; + + return (sbegin); +} + +/** + * delimitcnt - return the count of a given delimiter in a given string. + * @s: The string to be searched. + * @ct: The delimiter to search for. + * Notice : We suppose the delimiter is a single-char string(for example : ";"). + */ +INT delimitcnt(PSTRING s,PSTRING ct) +{ + INT count = 0; + /* point to the beginning of the line */ + PSTRING token = s; + + for ( ;; ) + { + token = strpbrk(token, ct); /* search for delimiters */ + + if ( token == NULL ) + { + /* advanced to the terminating null character */ + break; + } + /* skip the delimiter */ + ++token; + + /* + * Print the found text: use len with %.*s to specify field width. + */ + + /* accumulate delimiter count */ + ++count; + } + return count; +} + +/* + * converts the Internet host address from the standard numbers-and-dots notation + * into binary data. + * returns nonzero if the address is valid, zero if not. + */ +int rtinet_aton(PSTRING cp, unsigned int *addr) +{ + unsigned int val; + int base, n; + STRING c; + unsigned int parts[4]; + unsigned int *pp = parts; + + for (;;) + { + /* + * Collect number up to ``.''. + * Values are specified as for C: + * 0x=hex, 0=octal, other=decimal. + */ + val = 0; + base = 10; + if (*cp == '0') + { + if (*++cp == 'x' || *cp == 'X') + base = 16, cp++; + else + base = 8; + } + while ((c = *cp) != '\0') + { + if (isdigit((unsigned char) c)) + { + val = (val * base) + (c - '0'); + cp++; + continue; + } + if (base == 16 && isxdigit((unsigned char) c)) + { + val = (val << 4) + + (c + 10 - (islower((unsigned char) c) ? 'a' : 'A')); + cp++; + continue; + } + break; + } + if (*cp == '.') + { + /* + * Internet format: a.b.c.d a.b.c (with c treated as 16-bits) + * a.b (with b treated as 24 bits) + */ + if (pp >= parts + 3 || val > 0xff) + return 0; + *pp++ = val, cp++; + } + else + break; + } + + /* + * Check for trailing junk. + */ + while (*cp) + if (!isspace((unsigned char) *cp++)) + return 0; + + /* + * Concoct the address according to the number of parts specified. + */ + n = pp - parts + 1; + switch (n) + { + + case 1: /* a -- 32 bits */ + break; + + case 2: /* a.b -- 8.24 bits */ + if (val > 0xffffff) + return 0; + val |= parts[0] << 24; + break; + + case 3: /* a.b.c -- 8.8.16 bits */ + if (val > 0xffff) + return 0; + val |= (parts[0] << 24) | (parts[1] << 16); + break; + + case 4: /* a.b.c.d -- 8.8.8.8 bits */ + if (val > 0xff) + return 0; + val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); + break; + } + + *addr = htonl(val); + return 1; + +} + +/* + ======================================================================== + + Routine Description: + Find key section for Get key parameter. + + Arguments: + buffer Pointer to the buffer to start find the key section + section the key of the secion to be find + + Return Value: + NULL Fail + Others Success + ======================================================================== +*/ +PSTRING RTMPFindSection( + IN PSTRING buffer) +{ + STRING temp_buf[32]; + PSTRING ptr; + + strcpy(temp_buf, "Default"); + + if((ptr = rtstrstr(buffer, temp_buf)) != NULL) + return (ptr+strlen("\n")); + else + return NULL; +} + +/* + ======================================================================== + + Routine Description: + Get key parameter. + + Arguments: + key Pointer to key string + dest Pointer to destination + destsize The datasize of the destination + buffer Pointer to the buffer to start find the key + bTrimSpace Set true if you want to strip the space character of the result pattern + + Return Value: + TRUE Success + FALSE Fail + + Note: + This routine get the value with the matched key (case case-sensitive) + For SSID and security key related parameters, we SHALL NOT trim the space(' ') character. + ======================================================================== +*/ +INT RTMPGetKeyParameter( + IN PSTRING key, + OUT PSTRING dest, + IN INT destsize, + IN PSTRING buffer, + IN BOOLEAN bTrimSpace) +{ + PSTRING pMemBuf, temp_buf1 = NULL, temp_buf2 = NULL; + PSTRING start_ptr, end_ptr; + PSTRING ptr; + PSTRING offset = NULL; + INT len, keyLen; + + + keyLen = strlen(key); + os_alloc_mem(NULL, (PUCHAR *)&pMemBuf, MAX_PARAM_BUFFER_SIZE * 2); + if (pMemBuf == NULL) + return (FALSE); + + memset(pMemBuf, 0, MAX_PARAM_BUFFER_SIZE * 2); + temp_buf1 = pMemBuf; + temp_buf2 = (PSTRING)(pMemBuf + MAX_PARAM_BUFFER_SIZE); + + + //find section + if((offset = RTMPFindSection(buffer)) == NULL) + { + os_free_mem(NULL, (PUCHAR)pMemBuf); + return (FALSE); + } + + strcpy(temp_buf1, "\n"); + strcat(temp_buf1, key); + strcat(temp_buf1, "="); + + //search key + if((start_ptr=rtstrstr(offset, temp_buf1)) == NULL) + { + os_free_mem(NULL, (PUCHAR)pMemBuf); + return (FALSE); + } + + start_ptr += strlen("\n"); + if((end_ptr = rtstrstr(start_ptr, "\n"))==NULL) + end_ptr = start_ptr+strlen(start_ptr); + + if (end_ptr= 1 ) && (KeyIdx <= 4)) + pAd->StaCfg.DefaultKeyId = (UCHAR) (KeyIdx - 1); + else + pAd->StaCfg.DefaultKeyId = 0; + + DBGPRINT(RT_DEBUG_TRACE, ("DefaultKeyID(0~3)=%d\n", pAd->StaCfg.DefaultKeyId)); + } + } + + + for (idx = 0; idx < 4; idx++) + { + sprintf(tok_str, "Key%dType", idx + 1); + //Key1Type + if (RTMPGetKeyParameter(tok_str, tmpbuf, 128, buffer, TRUE)) + { + for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++) + { + /* + do sanity check for KeyType length; + or in station mode, the KeyType length > 1, + the code will overwrite the stack of caller + (RTMPSetProfileParameters) and cause srcbuf = NULL + */ + if (i < MAX_MBSSID_NUM) + KeyType[i] = simple_strtol(macptr, 0, 10); + } + + { + sprintf(tok_str, "Key%dStr", idx + 1); + if (RTMPGetKeyParameter(tok_str, tmpbuf, 128, buffer, FALSE)) + { + rtmp_parse_key_buffer_from_file(pAd, tmpbuf, KeyType[BSS0], BSS0, idx); + } + } + } + } +} + + + +static void rtmp_read_sta_wmm_parms_from_file(IN PRTMP_ADAPTER pAd, char *tmpbuf, char *buffer) +{ + PSTRING macptr; + INT i=0; + BOOLEAN bWmmEnable = FALSE; + + //WmmCapable + if(RTMPGetKeyParameter("WmmCapable", tmpbuf, 32, buffer, TRUE)) + { + if(simple_strtol(tmpbuf, 0, 10) != 0) //Enable + { + pAd->CommonCfg.bWmmCapable = TRUE; + bWmmEnable = TRUE; + } + else //Disable + { + pAd->CommonCfg.bWmmCapable = FALSE; + } + + DBGPRINT(RT_DEBUG_TRACE, ("WmmCapable=%d\n", pAd->CommonCfg.bWmmCapable)); + } + + + //AckPolicy for AC_BK, AC_BE, AC_VI, AC_VO + if(RTMPGetKeyParameter("AckPolicy", tmpbuf, 32, buffer, TRUE)) + { + for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++) + { + pAd->CommonCfg.AckPolicy[i] = (UCHAR)simple_strtol(macptr, 0, 10); + + DBGPRINT(RT_DEBUG_TRACE, ("AckPolicy[%d]=%d\n", i, pAd->CommonCfg.AckPolicy[i])); + } + } + + if (bWmmEnable) + { + //APSDCapable + if(RTMPGetKeyParameter("APSDCapable", tmpbuf, 10, buffer, TRUE)) + { + if(simple_strtol(tmpbuf, 0, 10) != 0) //Enable + pAd->CommonCfg.bAPSDCapable = TRUE; + else + pAd->CommonCfg.bAPSDCapable = FALSE; + + DBGPRINT(RT_DEBUG_TRACE, ("APSDCapable=%d\n", pAd->CommonCfg.bAPSDCapable)); + } + + //MaxSPLength + if(RTMPGetKeyParameter("MaxSPLength", tmpbuf, 10, buffer, TRUE)) + { + pAd->CommonCfg.MaxSPLength = simple_strtol(tmpbuf, 0, 10); + + DBGPRINT(RT_DEBUG_TRACE, ("MaxSPLength=%d\n", pAd->CommonCfg.MaxSPLength)); + } + + //APSDAC for AC_BE, AC_BK, AC_VI, AC_VO + if(RTMPGetKeyParameter("APSDAC", tmpbuf, 32, buffer, TRUE)) + { + BOOLEAN apsd_ac[4]; + + for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++) + { + apsd_ac[i] = (BOOLEAN)simple_strtol(macptr, 0, 10); + + DBGPRINT(RT_DEBUG_TRACE, ("APSDAC%d %d\n", i, apsd_ac[i])); + } + + pAd->CommonCfg.bAPSDAC_BE = apsd_ac[0]; + pAd->CommonCfg.bAPSDAC_BK = apsd_ac[1]; + pAd->CommonCfg.bAPSDAC_VI = apsd_ac[2]; + pAd->CommonCfg.bAPSDAC_VO = apsd_ac[3]; + + pAd->CommonCfg.bACMAPSDTr[0] = apsd_ac[0]; + pAd->CommonCfg.bACMAPSDTr[1] = apsd_ac[1]; + pAd->CommonCfg.bACMAPSDTr[2] = apsd_ac[2]; + pAd->CommonCfg.bACMAPSDTr[3] = apsd_ac[3]; + } + } + +} + + +static void HTParametersHook( + IN PRTMP_ADAPTER pAd, + IN PSTRING pValueStr, + IN PSTRING pInput) +{ + + long Value; + + if (RTMPGetKeyParameter("HT_PROTECT", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + if (Value == 0) + { + pAd->CommonCfg.bHTProtect = FALSE; + } + else + { + pAd->CommonCfg.bHTProtect = TRUE; + } + DBGPRINT(RT_DEBUG_TRACE, ("HT: Protection = %s\n", (Value==0) ? "Disable" : "Enable")); + } + + if (RTMPGetKeyParameter("HT_MIMOPSEnable", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + if (Value == 0) + { + pAd->CommonCfg.bMIMOPSEnable = FALSE; + } + else + { + pAd->CommonCfg.bMIMOPSEnable = TRUE; + } + DBGPRINT(RT_DEBUG_TRACE, ("HT: MIMOPSEnable = %s\n", (Value==0) ? "Disable" : "Enable")); + } + + + if (RTMPGetKeyParameter("HT_MIMOPSMode", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + if (Value > MMPS_ENABLE) + { + pAd->CommonCfg.BACapability.field.MMPSmode = MMPS_ENABLE; + } + else + { + //TODO: add mimo power saving mechanism + pAd->CommonCfg.BACapability.field.MMPSmode = MMPS_ENABLE; + //pAd->CommonCfg.BACapability.field.MMPSmode = Value; + } + DBGPRINT(RT_DEBUG_TRACE, ("HT: MIMOPS Mode = %d\n", (INT) Value)); + } + + if (RTMPGetKeyParameter("HT_BADecline", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + if (Value == 0) + { + pAd->CommonCfg.bBADecline = FALSE; + } + else + { + pAd->CommonCfg.bBADecline = TRUE; + } + DBGPRINT(RT_DEBUG_TRACE, ("HT: BA Decline = %s\n", (Value==0) ? "Disable" : "Enable")); + } + + + if (RTMPGetKeyParameter("HT_DisableReordering", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + if (Value == 0) + { + pAd->CommonCfg.bDisableReordering = FALSE; + } + else + { + pAd->CommonCfg.bDisableReordering = TRUE; + } + DBGPRINT(RT_DEBUG_TRACE, ("HT: DisableReordering = %s\n", (Value==0) ? "Disable" : "Enable")); + } + + if (RTMPGetKeyParameter("HT_AutoBA", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + if (Value == 0) + { + pAd->CommonCfg.BACapability.field.AutoBA = FALSE; + pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE; + } + else + { + pAd->CommonCfg.BACapability.field.AutoBA = TRUE; + pAd->CommonCfg.BACapability.field.Policy = IMMED_BA; + } + pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA; + DBGPRINT(RT_DEBUG_TRACE, ("HT: Auto BA = %s\n", (Value==0) ? "Disable" : "Enable")); + } + + // Tx_+HTC frame + if (RTMPGetKeyParameter("HT_HTC", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + if (Value == 0) + { + pAd->HTCEnable = FALSE; + } + else + { + pAd->HTCEnable = TRUE; + } + DBGPRINT(RT_DEBUG_TRACE, ("HT: Tx +HTC frame = %s\n", (Value==0) ? "Disable" : "Enable")); + } + + // Enable HT Link Adaptation Control + if (RTMPGetKeyParameter("HT_LinkAdapt", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + if (Value == 0) + { + pAd->bLinkAdapt = FALSE; + } + else + { + pAd->HTCEnable = TRUE; + pAd->bLinkAdapt = TRUE; + } + DBGPRINT(RT_DEBUG_TRACE, ("HT: Link Adaptation Control = %s\n", (Value==0) ? "Disable" : "Enable(+HTC)")); + } + + // Reverse Direction Mechanism + if (RTMPGetKeyParameter("HT_RDG", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + if (Value == 0) + { + pAd->CommonCfg.bRdg = FALSE; + } + else + { + pAd->HTCEnable = TRUE; + pAd->CommonCfg.bRdg = TRUE; + } + DBGPRINT(RT_DEBUG_TRACE, ("HT: RDG = %s\n", (Value==0) ? "Disable" : "Enable(+HTC)")); + } + + + + + // Tx A-MSUD ? + if (RTMPGetKeyParameter("HT_AMSDU", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + if (Value == 0) + { + pAd->CommonCfg.BACapability.field.AmsduEnable = FALSE; + } + else + { + pAd->CommonCfg.BACapability.field.AmsduEnable = TRUE; + } + DBGPRINT(RT_DEBUG_TRACE, ("HT: Tx A-MSDU = %s\n", (Value==0) ? "Disable" : "Enable")); + } + + // MPDU Density + if (RTMPGetKeyParameter("HT_MpduDensity", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + if (Value <=7 && Value >= 0) + { + pAd->CommonCfg.BACapability.field.MpduDensity = Value; + DBGPRINT(RT_DEBUG_TRACE, ("HT: MPDU Density = %d\n", (INT) Value)); + } + else + { + pAd->CommonCfg.BACapability.field.MpduDensity = 4; + DBGPRINT(RT_DEBUG_TRACE, ("HT: MPDU Density = %d (Default)\n", 4)); + } + } + + // Max Rx BA Window Size + if (RTMPGetKeyParameter("HT_BAWinSize", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + + if (Value >=1 && Value <= 64) + { + pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = Value; + pAd->CommonCfg.BACapability.field.RxBAWinLimit = Value; + DBGPRINT(RT_DEBUG_TRACE, ("HT: BA Windw Size = %d\n", (INT) Value)); + } + else + { + pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = 64; + pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64; + DBGPRINT(RT_DEBUG_TRACE, ("HT: BA Windw Size = 64 (Defualt)\n")); + } + + } + + // Guard Interval + if (RTMPGetKeyParameter("HT_GI", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + + if (Value == GI_400) + { + pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_400; + } + else + { + pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_800; + } + + DBGPRINT(RT_DEBUG_TRACE, ("HT: Guard Interval = %s\n", (Value==GI_400) ? "400" : "800" )); + } + + // HT Operation Mode : Mixed Mode , Green Field + if (RTMPGetKeyParameter("HT_OpMode", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + + if (Value == HTMODE_GF) + { + + pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_GF; + } + else + { + pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_MM; + } + + DBGPRINT(RT_DEBUG_TRACE, ("HT: Operate Mode = %s\n", (Value==HTMODE_GF) ? "Green Field" : "Mixed Mode" )); + } + + // Fixed Tx mode : CCK, OFDM + if (RTMPGetKeyParameter("FixedTxMode", pValueStr, 25, pInput, TRUE)) + { + UCHAR fix_tx_mode; + + { + fix_tx_mode = FIXED_TXMODE_HT; + + if (strcmp(pValueStr, "OFDM") == 0 || strcmp(pValueStr, "ofdm") == 0) + { + fix_tx_mode = FIXED_TXMODE_OFDM; + } + else if (strcmp(pValueStr, "CCK") == 0 || strcmp(pValueStr, "cck") == 0) + { + fix_tx_mode = FIXED_TXMODE_CCK; + } + else if (strcmp(pValueStr, "HT") == 0 || strcmp(pValueStr, "ht") == 0) + { + fix_tx_mode = FIXED_TXMODE_HT; + } + else + { + Value = simple_strtol(pValueStr, 0, 10); + // 1 : CCK + // 2 : OFDM + // otherwise : HT + if (Value == FIXED_TXMODE_CCK || Value == FIXED_TXMODE_OFDM) + fix_tx_mode = Value; + else + fix_tx_mode = FIXED_TXMODE_HT; + } + + pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode = fix_tx_mode; + DBGPRINT(RT_DEBUG_TRACE, ("Fixed Tx Mode = %d\n", fix_tx_mode)); + + } + } + + + // Channel Width + if (RTMPGetKeyParameter("HT_BW", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + + if (Value == BW_40) + { + pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40; + } + else + { + pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; + } + + DBGPRINT(RT_DEBUG_TRACE, ("HT: Channel Width = %s\n", (Value==BW_40) ? "40 MHz" : "20 MHz" )); + } + + if (RTMPGetKeyParameter("HT_EXTCHA", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + + if (Value == 0) + { + + pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW; + } + else + { + pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE; + } + + DBGPRINT(RT_DEBUG_TRACE, ("HT: Ext Channel = %s\n", (Value==0) ? "BELOW" : "ABOVE" )); + } + + // MSC + if (RTMPGetKeyParameter("HT_MCS", pValueStr, 50, pInput, TRUE)) + { + { + Value = simple_strtol(pValueStr, 0, 10); + +// if ((Value >= 0 && Value <= 15) || (Value == 32)) + if ((Value >= 0 && Value <= 23) || (Value == 32)) // 3*3 + { + pAd->StaCfg.DesiredTransmitSetting.field.MCS = Value; + pAd->StaCfg.bAutoTxRateSwitch = FALSE; + DBGPRINT(RT_DEBUG_TRACE, ("HT: MCS = %d\n", pAd->StaCfg.DesiredTransmitSetting.field.MCS)); + } + else + { + pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; + pAd->StaCfg.bAutoTxRateSwitch = TRUE; + DBGPRINT(RT_DEBUG_TRACE, ("HT: MCS = AUTO\n")); + } + } + } + + // STBC + if (RTMPGetKeyParameter("HT_STBC", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + if (Value == STBC_USE) + { + pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_USE; + } + else + { + pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_NONE; + } + DBGPRINT(RT_DEBUG_TRACE, ("HT: STBC = %d\n", pAd->CommonCfg.RegTransmitSetting.field.STBC)); + } + + // 40_Mhz_Intolerant + if (RTMPGetKeyParameter("HT_40MHZ_INTOLERANT", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + if (Value == 0) + { + pAd->CommonCfg.bForty_Mhz_Intolerant = FALSE; + } + else + { + pAd->CommonCfg.bForty_Mhz_Intolerant = TRUE; + } + DBGPRINT(RT_DEBUG_TRACE, ("HT: 40MHZ INTOLERANT = %d\n", pAd->CommonCfg.bForty_Mhz_Intolerant)); + } + //HT_TxStream + if(RTMPGetKeyParameter("HT_TxStream", pValueStr, 10, pInput, TRUE)) + { + switch (simple_strtol(pValueStr, 0, 10)) + { + case 1: + pAd->CommonCfg.TxStream = 1; + break; + case 2: + pAd->CommonCfg.TxStream = 2; + break; + case 3: // 3*3 + default: + pAd->CommonCfg.TxStream = 3; + + if (pAd->MACVersion < RALINK_2883_VERSION) + pAd->CommonCfg.TxStream = 2; // only 2 tx streams for RT2860 series + break; + } + DBGPRINT(RT_DEBUG_TRACE, ("HT: Tx Stream = %d\n", pAd->CommonCfg.TxStream)); + } + //HT_RxStream + if(RTMPGetKeyParameter("HT_RxStream", pValueStr, 10, pInput, TRUE)) + { + switch (simple_strtol(pValueStr, 0, 10)) + { + case 1: + pAd->CommonCfg.RxStream = 1; + break; + case 2: + pAd->CommonCfg.RxStream = 2; + break; + case 3: + default: + pAd->CommonCfg.RxStream = 3; + + if (pAd->MACVersion < RALINK_2883_VERSION) + pAd->CommonCfg.RxStream = 2; // only 2 rx streams for RT2860 series + break; + } + DBGPRINT(RT_DEBUG_TRACE, ("HT: Rx Stream = %d\n", pAd->CommonCfg.RxStream)); + } + //2008/11/05: KH add to support Antenna power-saving of AP<-- + //Green AP + if(RTMPGetKeyParameter("GreenAP", pValueStr, 10, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + if (Value == 0) + { + pAd->CommonCfg.bGreenAPEnable = FALSE; + } + else + { + pAd->CommonCfg.bGreenAPEnable = TRUE; + } + DBGPRINT(RT_DEBUG_TRACE, ("HT: Green AP= %d\n", pAd->CommonCfg.bGreenAPEnable)); + } + + // HT_DisallowTKIP + if (RTMPGetKeyParameter("HT_DisallowTKIP", pValueStr, 25, pInput, TRUE)) + { + Value = simple_strtol(pValueStr, 0, 10); + + if (Value == 1) + { + pAd->CommonCfg.HT_DisallowTKIP = TRUE; + } + else + { + pAd->CommonCfg.HT_DisallowTKIP = FALSE; + } + + DBGPRINT(RT_DEBUG_TRACE, ("HT: Disallow TKIP mode = %s\n", (pAd->CommonCfg.HT_DisallowTKIP == TRUE) ? "ON" : "OFF" )); + } + + + //2008/11/05:KH add to support Antenna power-saving of AP--> +} + + +NDIS_STATUS RTMPSetProfileParameters( + IN RTMP_ADAPTER *pAd, + IN PSTRING pBuffer) +{ + PSTRING tmpbuf; + ULONG RtsThresh; + ULONG FragThresh; + PSTRING macptr; + INT i = 0, retval; + tmpbuf = kmalloc(MAX_PARAM_BUFFER_SIZE, MEM_ALLOC_FLAG); + if(tmpbuf == NULL) + return NDIS_STATUS_FAILURE; + + do + { + // set file parameter to portcfg + //CountryRegion + if(RTMPGetKeyParameter("CountryRegion", tmpbuf, 25, pBuffer, TRUE)) + { + retval = RT_CfgSetCountryRegion(pAd, tmpbuf, BAND_24G); + DBGPRINT(RT_DEBUG_TRACE, ("CountryRegion=%d\n", pAd->CommonCfg.CountryRegion)); + } + //CountryRegionABand + if(RTMPGetKeyParameter("CountryRegionABand", tmpbuf, 25, pBuffer, TRUE)) + { + retval = RT_CfgSetCountryRegion(pAd, tmpbuf, BAND_5G); + DBGPRINT(RT_DEBUG_TRACE, ("CountryRegionABand=%d\n", pAd->CommonCfg.CountryRegionForABand)); + } +#ifdef RTMP_EFUSE_SUPPORT +#ifdef RT30xx + //EfuseBufferMode + if(RTMPGetKeyParameter("EfuseBufferMode", tmpbuf, 25, pBuffer, TRUE)) + { + pAd->bEEPROMFile = (UCHAR) simple_strtol(tmpbuf, 0, 10); + DBGPRINT(RT_DEBUG_TRACE, ("EfuseBufferMode=%d\n", pAd->bUseEfuse)); + } +#endif // RT30xx // +#endif // RTMP_EFUSE_SUPPORT // + //CountryCode + if(RTMPGetKeyParameter("CountryCode", tmpbuf, 25, pBuffer, TRUE)) + { + NdisMoveMemory(pAd->CommonCfg.CountryCode, tmpbuf , 2); + if (strlen((PSTRING) pAd->CommonCfg.CountryCode) != 0) + { + pAd->CommonCfg.bCountryFlag = TRUE; + } + DBGPRINT(RT_DEBUG_TRACE, ("CountryCode=%s\n", pAd->CommonCfg.CountryCode)); + } + //ChannelGeography + if(RTMPGetKeyParameter("ChannelGeography", tmpbuf, 25, pBuffer, TRUE)) + { + UCHAR Geography = (UCHAR) simple_strtol(tmpbuf, 0, 10); + if (Geography <= BOTH) + { + pAd->CommonCfg.Geography = Geography; + pAd->CommonCfg.CountryCode[2] = + (pAd->CommonCfg.Geography == BOTH) ? ' ' : ((pAd->CommonCfg.Geography == IDOR) ? 'I' : 'O'); + DBGPRINT(RT_DEBUG_TRACE, ("ChannelGeography=%d\n", pAd->CommonCfg.Geography)); + } + } + else + { + pAd->CommonCfg.Geography = BOTH; + pAd->CommonCfg.CountryCode[2] = ' '; + } + + { + //SSID + if (RTMPGetKeyParameter("SSID", tmpbuf, 256, pBuffer, FALSE)) + { + if (strlen(tmpbuf) <= 32) + { + pAd->CommonCfg.SsidLen = (UCHAR) strlen(tmpbuf); + NdisZeroMemory(pAd->CommonCfg.Ssid, NDIS_802_11_LENGTH_SSID); + NdisMoveMemory(pAd->CommonCfg.Ssid, tmpbuf, pAd->CommonCfg.SsidLen); + pAd->MlmeAux.AutoReconnectSsidLen = pAd->CommonCfg.SsidLen; + NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, NDIS_802_11_LENGTH_SSID); + NdisMoveMemory(pAd->MlmeAux.AutoReconnectSsid, tmpbuf, pAd->MlmeAux.AutoReconnectSsidLen); + pAd->MlmeAux.SsidLen = pAd->CommonCfg.SsidLen; + NdisZeroMemory(pAd->MlmeAux.Ssid, NDIS_802_11_LENGTH_SSID); + NdisMoveMemory(pAd->MlmeAux.Ssid, tmpbuf, pAd->MlmeAux.SsidLen); + DBGPRINT(RT_DEBUG_TRACE, ("%s::(SSID=%s)\n", __func__, tmpbuf)); + } + } + } + + { + //NetworkType + if (RTMPGetKeyParameter("NetworkType", tmpbuf, 25, pBuffer, TRUE)) + { + pAd->bConfigChanged = TRUE; + if (strcmp(tmpbuf, "Adhoc") == 0) + pAd->StaCfg.BssType = BSS_ADHOC; + else //Default Infrastructure mode + pAd->StaCfg.BssType = BSS_INFRA; + // Reset Ralink supplicant to not use, it will be set to start when UI set PMK key + pAd->StaCfg.WpaState = SS_NOTUSE; + DBGPRINT(RT_DEBUG_TRACE, ("%s::(NetworkType=%d)\n", __func__, pAd->StaCfg.BssType)); + } + } + //Channel + if(RTMPGetKeyParameter("Channel", tmpbuf, 10, pBuffer, TRUE)) + { + pAd->CommonCfg.Channel = (UCHAR) simple_strtol(tmpbuf, 0, 10); + DBGPRINT(RT_DEBUG_TRACE, ("Channel=%d\n", pAd->CommonCfg.Channel)); + } + //WirelessMode + if(RTMPGetKeyParameter("WirelessMode", tmpbuf, 10, pBuffer, TRUE)) + { + RT_CfgSetWirelessMode(pAd, tmpbuf); + DBGPRINT(RT_DEBUG_TRACE, ("PhyMode=%d\n", pAd->CommonCfg.PhyMode)); + } + //BasicRate + if(RTMPGetKeyParameter("BasicRate", tmpbuf, 10, pBuffer, TRUE)) + { + pAd->CommonCfg.BasicRateBitmap = (ULONG) simple_strtol(tmpbuf, 0, 10); + DBGPRINT(RT_DEBUG_TRACE, ("BasicRate=%ld\n", pAd->CommonCfg.BasicRateBitmap)); + } + //BeaconPeriod + if(RTMPGetKeyParameter("BeaconPeriod", tmpbuf, 10, pBuffer, TRUE)) + { + pAd->CommonCfg.BeaconPeriod = (USHORT) simple_strtol(tmpbuf, 0, 10); + DBGPRINT(RT_DEBUG_TRACE, ("BeaconPeriod=%d\n", pAd->CommonCfg.BeaconPeriod)); + } + //TxPower + if(RTMPGetKeyParameter("TxPower", tmpbuf, 10, pBuffer, TRUE)) + { + pAd->CommonCfg.TxPowerPercentage = (ULONG) simple_strtol(tmpbuf, 0, 10); + pAd->CommonCfg.TxPowerDefault = pAd->CommonCfg.TxPowerPercentage; + DBGPRINT(RT_DEBUG_TRACE, ("TxPower=%ld\n", pAd->CommonCfg.TxPowerPercentage)); + } + //BGProtection + if(RTMPGetKeyParameter("BGProtection", tmpbuf, 10, pBuffer, TRUE)) + { + //#if 0 //#ifndef WIFI_TEST + // pAd->CommonCfg.UseBGProtection = 2;// disable b/g protection for throughput test + //#else + switch (simple_strtol(tmpbuf, 0, 10)) + { + case 1: //Always On + pAd->CommonCfg.UseBGProtection = 1; + break; + case 2: //Always OFF + pAd->CommonCfg.UseBGProtection = 2; + break; + case 0: //AUTO + default: + pAd->CommonCfg.UseBGProtection = 0; + break; + } + //#endif + DBGPRINT(RT_DEBUG_TRACE, ("BGProtection=%ld\n", pAd->CommonCfg.UseBGProtection)); + } + //OLBCDetection + if(RTMPGetKeyParameter("DisableOLBC", tmpbuf, 10, pBuffer, TRUE)) + { + switch (simple_strtol(tmpbuf, 0, 10)) + { + case 1: //disable OLBC Detection + pAd->CommonCfg.DisableOLBCDetect = 1; + break; + case 0: //enable OLBC Detection + pAd->CommonCfg.DisableOLBCDetect = 0; + break; + default: + pAd->CommonCfg.DisableOLBCDetect= 0; + break; + } + DBGPRINT(RT_DEBUG_TRACE, ("OLBCDetection=%ld\n", pAd->CommonCfg.DisableOLBCDetect)); + } + //TxPreamble + if(RTMPGetKeyParameter("TxPreamble", tmpbuf, 10, pBuffer, TRUE)) + { + switch (simple_strtol(tmpbuf, 0, 10)) + { + case Rt802_11PreambleShort: + pAd->CommonCfg.TxPreamble = Rt802_11PreambleShort; + break; + case Rt802_11PreambleLong: + default: + pAd->CommonCfg.TxPreamble = Rt802_11PreambleLong; + break; + } + DBGPRINT(RT_DEBUG_TRACE, ("TxPreamble=%ld\n", pAd->CommonCfg.TxPreamble)); + } + //RTSThreshold + if(RTMPGetKeyParameter("RTSThreshold", tmpbuf, 10, pBuffer, TRUE)) + { + RtsThresh = simple_strtol(tmpbuf, 0, 10); + if( (RtsThresh >= 1) && (RtsThresh <= MAX_RTS_THRESHOLD) ) + pAd->CommonCfg.RtsThreshold = (USHORT)RtsThresh; + else + pAd->CommonCfg.RtsThreshold = MAX_RTS_THRESHOLD; + + DBGPRINT(RT_DEBUG_TRACE, ("RTSThreshold=%d\n", pAd->CommonCfg.RtsThreshold)); + } + //FragThreshold + if(RTMPGetKeyParameter("FragThreshold", tmpbuf, 10, pBuffer, TRUE)) + { + FragThresh = simple_strtol(tmpbuf, 0, 10); + pAd->CommonCfg.bUseZeroToDisableFragment = FALSE; + + if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD) + { //illegal FragThresh so we set it to default + pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD; + pAd->CommonCfg.bUseZeroToDisableFragment = TRUE; + } + else if (FragThresh % 2 == 1) + { + // The length of each fragment shall always be an even number of octets, except for the last fragment + // of an MSDU or MMPDU, which may be either an even or an odd number of octets. + pAd->CommonCfg.FragmentThreshold = (USHORT)(FragThresh - 1); + } + else + { + pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh; + } + //pAd->CommonCfg.AllowFragSize = (pAd->CommonCfg.FragmentThreshold) - LENGTH_802_11 - LENGTH_CRC; + DBGPRINT(RT_DEBUG_TRACE, ("FragThreshold=%d\n", pAd->CommonCfg.FragmentThreshold)); + } + //TxBurst + if(RTMPGetKeyParameter("TxBurst", tmpbuf, 10, pBuffer, TRUE)) + { + //#ifdef WIFI_TEST + // pAd->CommonCfg.bEnableTxBurst = FALSE; + //#else + if(simple_strtol(tmpbuf, 0, 10) != 0) //Enable + pAd->CommonCfg.bEnableTxBurst = TRUE; + else //Disable + pAd->CommonCfg.bEnableTxBurst = FALSE; + //#endif + DBGPRINT(RT_DEBUG_TRACE, ("TxBurst=%d\n", pAd->CommonCfg.bEnableTxBurst)); + } + +#ifdef AGGREGATION_SUPPORT + //PktAggregate + if(RTMPGetKeyParameter("PktAggregate", tmpbuf, 10, pBuffer, TRUE)) + { + if(simple_strtol(tmpbuf, 0, 10) != 0) //Enable + pAd->CommonCfg.bAggregationCapable = TRUE; + else //Disable + pAd->CommonCfg.bAggregationCapable = FALSE; +#ifdef PIGGYBACK_SUPPORT + pAd->CommonCfg.bPiggyBackCapable = pAd->CommonCfg.bAggregationCapable; +#endif // PIGGYBACK_SUPPORT // + DBGPRINT(RT_DEBUG_TRACE, ("PktAggregate=%d\n", pAd->CommonCfg.bAggregationCapable)); + } +#else + pAd->CommonCfg.bAggregationCapable = FALSE; + pAd->CommonCfg.bPiggyBackCapable = FALSE; +#endif // AGGREGATION_SUPPORT // + + // WmmCapable + + rtmp_read_sta_wmm_parms_from_file(pAd, tmpbuf, pBuffer); + + //ShortSlot + if(RTMPGetKeyParameter("ShortSlot", tmpbuf, 10, pBuffer, TRUE)) + { + RT_CfgSetShortSlot(pAd, tmpbuf); + DBGPRINT(RT_DEBUG_TRACE, ("ShortSlot=%d\n", pAd->CommonCfg.bUseShortSlotTime)); + } + //IEEE80211H + if(RTMPGetKeyParameter("IEEE80211H", tmpbuf, 10, pBuffer, TRUE)) + { + for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++) + { + if(simple_strtol(macptr, 0, 10) != 0) //Enable + pAd->CommonCfg.bIEEE80211H = TRUE; + else //Disable + pAd->CommonCfg.bIEEE80211H = FALSE; + + DBGPRINT(RT_DEBUG_TRACE, ("IEEE80211H=%d\n", pAd->CommonCfg.bIEEE80211H)); + } + } + //CSPeriod + if(RTMPGetKeyParameter("CSPeriod", tmpbuf, 10, pBuffer, TRUE)) + { + if(simple_strtol(tmpbuf, 0, 10) != 0) + pAd->CommonCfg.RadarDetect.CSPeriod = simple_strtol(tmpbuf, 0, 10); + else + pAd->CommonCfg.RadarDetect.CSPeriod = 0; + + DBGPRINT(RT_DEBUG_TRACE, ("CSPeriod=%d\n", pAd->CommonCfg.RadarDetect.CSPeriod)); + } + + //RDRegion + if(RTMPGetKeyParameter("RDRegion", tmpbuf, 128, pBuffer, TRUE)) + { + RADAR_DETECT_STRUCT *pRadarDetect = &pAd->CommonCfg.RadarDetect; + if ((strncmp(tmpbuf, "JAP_W53", 7) == 0) || (strncmp(tmpbuf, "jap_w53", 7) == 0)) + { + pRadarDetect->RDDurRegion = JAP_W53; + pRadarDetect->DfsSessionTime = 15; + } + else if ((strncmp(tmpbuf, "JAP_W56", 7) == 0) || (strncmp(tmpbuf, "jap_w56", 7) == 0)) + { + pRadarDetect->RDDurRegion = JAP_W56; + pRadarDetect->DfsSessionTime = 13; + } + else if ((strncmp(tmpbuf, "JAP", 3) == 0) || (strncmp(tmpbuf, "jap", 3) == 0)) + { + pRadarDetect->RDDurRegion = JAP; + pRadarDetect->DfsSessionTime = 5; + } + else if ((strncmp(tmpbuf, "FCC", 3) == 0) || (strncmp(tmpbuf, "fcc", 3) == 0)) + { + pRadarDetect->RDDurRegion = FCC; + pRadarDetect->DfsSessionTime = 5; + } + else if ((strncmp(tmpbuf, "CE", 2) == 0) || (strncmp(tmpbuf, "ce", 2) == 0)) + { + pRadarDetect->RDDurRegion = CE; + pRadarDetect->DfsSessionTime = 13; + } + else + { + pRadarDetect->RDDurRegion = CE; + pRadarDetect->DfsSessionTime = 13; + } + + DBGPRINT(RT_DEBUG_TRACE, ("RDRegion=%d\n", pRadarDetect->RDDurRegion)); + } + else + { + pAd->CommonCfg.RadarDetect.RDDurRegion = CE; + pAd->CommonCfg.RadarDetect.DfsSessionTime = 13; + } + + //WirelessEvent + if(RTMPGetKeyParameter("WirelessEvent", tmpbuf, 10, pBuffer, TRUE)) + { + if(simple_strtol(tmpbuf, 0, 10) != 0) + pAd->CommonCfg.bWirelessEvent = simple_strtol(tmpbuf, 0, 10); + else + pAd->CommonCfg.bWirelessEvent = 0; // disable + DBGPRINT(RT_DEBUG_TRACE, ("WirelessEvent=%d\n", pAd->CommonCfg.bWirelessEvent)); + } + if(RTMPGetKeyParameter("WiFiTest", tmpbuf, 10, pBuffer, TRUE)) + { + if(simple_strtol(tmpbuf, 0, 10) != 0) + pAd->CommonCfg.bWiFiTest= simple_strtol(tmpbuf, 0, 10); + else + pAd->CommonCfg.bWiFiTest = 0; // disable + + DBGPRINT(RT_DEBUG_TRACE, ("WiFiTest=%d\n", pAd->CommonCfg.bWiFiTest)); + } + //AuthMode + if(RTMPGetKeyParameter("AuthMode", tmpbuf, 128, pBuffer, TRUE)) + { + { + if ((strcmp(tmpbuf, "WEPAUTO") == 0) || (strcmp(tmpbuf, "wepauto") == 0)) + pAd->StaCfg.AuthMode = Ndis802_11AuthModeAutoSwitch; + else if ((strcmp(tmpbuf, "SHARED") == 0) || (strcmp(tmpbuf, "shared") == 0)) + pAd->StaCfg.AuthMode = Ndis802_11AuthModeShared; + else if ((strcmp(tmpbuf, "WPAPSK") == 0) || (strcmp(tmpbuf, "wpapsk") == 0)) + pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPAPSK; + else if ((strcmp(tmpbuf, "WPANONE") == 0) || (strcmp(tmpbuf, "wpanone") == 0)) + pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPANone; + else if ((strcmp(tmpbuf, "WPA2PSK") == 0) || (strcmp(tmpbuf, "wpa2psk") == 0)) + pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPA2PSK; + else if ((strcmp(tmpbuf, "WPA") == 0) || (strcmp(tmpbuf, "wpa") == 0)) + pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPA; + else if ((strcmp(tmpbuf, "WPA2") == 0) || (strcmp(tmpbuf, "wpa2") == 0)) + pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPA2; + else + pAd->StaCfg.AuthMode = Ndis802_11AuthModeOpen; + + pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; + + DBGPRINT(RT_DEBUG_TRACE, ("%s::(AuthMode=%d)\n", __func__, pAd->StaCfg.AuthMode)); + } + } + //EncrypType + if(RTMPGetKeyParameter("EncrypType", tmpbuf, 128, pBuffer, TRUE)) + { + { + if ((strcmp(tmpbuf, "WEP") == 0) || (strcmp(tmpbuf, "wep") == 0)) + pAd->StaCfg.WepStatus = Ndis802_11WEPEnabled; + else if ((strcmp(tmpbuf, "TKIP") == 0) || (strcmp(tmpbuf, "tkip") == 0)) + pAd->StaCfg.WepStatus = Ndis802_11Encryption2Enabled; + else if ((strcmp(tmpbuf, "AES") == 0) || (strcmp(tmpbuf, "aes") == 0)) + pAd->StaCfg.WepStatus = Ndis802_11Encryption3Enabled; + else + pAd->StaCfg.WepStatus = Ndis802_11WEPDisabled; + + // Update all wepstatus related + pAd->StaCfg.PairCipher = pAd->StaCfg.WepStatus; + pAd->StaCfg.GroupCipher = pAd->StaCfg.WepStatus; + pAd->StaCfg.OrigWepStatus = pAd->StaCfg.WepStatus; + pAd->StaCfg.bMixCipher = FALSE; + + //RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, 0); + DBGPRINT(RT_DEBUG_TRACE, ("%s::(EncrypType=%d)\n", __func__, pAd->StaCfg.WepStatus)); + } + } + + { + if(RTMPGetKeyParameter("WPAPSK", tmpbuf, 512, pBuffer, FALSE)) + { + int ret = TRUE; + + tmpbuf[strlen(tmpbuf)] = '\0'; // make STA can process .$^& for WPAPSK input + + if ((pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPAPSK) && + (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPA2PSK) && + (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPANone) + ) + { + ret = FALSE; + } + else + { + ret = RT_CfgSetWPAPSKKey(pAd, tmpbuf, (PUCHAR)pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen, pAd->StaCfg.PMK); + } + + if (ret == TRUE) + { + RTMPZeroMemory(pAd->StaCfg.WpaPassPhrase, 64); + RTMPMoveMemory(pAd->StaCfg.WpaPassPhrase, tmpbuf, strlen(tmpbuf)); + pAd->StaCfg.WpaPassPhraseLen= strlen(tmpbuf); + + if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || + (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) + { + // Start STA supplicant state machine + pAd->StaCfg.WpaState = SS_START; + } + else if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) + { + pAd->StaCfg.WpaState = SS_NOTUSE; + } + DBGPRINT(RT_DEBUG_TRACE, ("%s::(WPAPSK=%s)\n", __func__, tmpbuf)); + } + } + } + + //DefaultKeyID, KeyType, KeyStr + rtmp_read_key_parms_from_file(pAd, tmpbuf, pBuffer); + + + //HSCounter + /*if(RTMPGetKeyParameter("HSCounter", tmpbuf, 10, pBuffer, TRUE)) + { + switch (simple_strtol(tmpbuf, 0, 10)) + { + case 1: //Enable + pAd->CommonCfg.bEnableHSCounter = TRUE; + break; + case 0: //Disable + default: + pAd->CommonCfg.bEnableHSCounter = FALSE; + break; + } + DBGPRINT(RT_DEBUG_TRACE, "HSCounter=%d\n", pAd->CommonCfg.bEnableHSCounter); + }*/ + + HTParametersHook(pAd, tmpbuf, pBuffer); + + { + //PSMode + if (RTMPGetKeyParameter("PSMode", tmpbuf, 10, pBuffer, TRUE)) + { + if (pAd->StaCfg.BssType == BSS_INFRA) + { + if ((strcmp(tmpbuf, "MAX_PSP") == 0) || (strcmp(tmpbuf, "max_psp") == 0)) + { + // do NOT turn on PSM bit here, wait until MlmeCheckForPsmChange() + // to exclude certain situations. + // MlmeSetPsm(pAd, PWR_SAVE); + OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); + if (pAd->StaCfg.bWindowsACCAMEnable == FALSE) + pAd->StaCfg.WindowsPowerMode = Ndis802_11PowerModeMAX_PSP; + pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeMAX_PSP; + pAd->StaCfg.DefaultListenCount = 5; + } + else if ((strcmp(tmpbuf, "Fast_PSP") == 0) || (strcmp(tmpbuf, "fast_psp") == 0) + || (strcmp(tmpbuf, "FAST_PSP") == 0)) + { + // do NOT turn on PSM bit here, wait until MlmeCheckForPsmChange() + // to exclude certain situations. + // RTMP_SET_PSM_BIT(pAd, PWR_SAVE); + OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); + if (pAd->StaCfg.bWindowsACCAMEnable == FALSE) + pAd->StaCfg.WindowsPowerMode = Ndis802_11PowerModeFast_PSP; + pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeFast_PSP; + pAd->StaCfg.DefaultListenCount = 3; + } + else if ((strcmp(tmpbuf, "Legacy_PSP") == 0) || (strcmp(tmpbuf, "legacy_psp") == 0) + || (strcmp(tmpbuf, "LEGACY_PSP") == 0)) + { + // do NOT turn on PSM bit here, wait until MlmeCheckForPsmChange() + // to exclude certain situations. + // RTMP_SET_PSM_BIT(pAd, PWR_SAVE); + OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); + if (pAd->StaCfg.bWindowsACCAMEnable == FALSE) + pAd->StaCfg.WindowsPowerMode = Ndis802_11PowerModeLegacy_PSP; + pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeLegacy_PSP; + pAd->StaCfg.DefaultListenCount = 3; + } + else + { //Default Ndis802_11PowerModeCAM + // clear PSM bit immediately + RTMP_SET_PSM_BIT(pAd, PWR_ACTIVE); + OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); + if (pAd->StaCfg.bWindowsACCAMEnable == FALSE) + pAd->StaCfg.WindowsPowerMode = Ndis802_11PowerModeCAM; + pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeCAM; + } + DBGPRINT(RT_DEBUG_TRACE, ("PSMode=%ld\n", pAd->StaCfg.WindowsPowerMode)); + } + } + // AutoRoaming by RSSI + if (RTMPGetKeyParameter("AutoRoaming", tmpbuf, 32, pBuffer, TRUE)) + { + if (simple_strtol(tmpbuf, 0, 10) == 0) + pAd->StaCfg.bAutoRoaming = FALSE; + else + pAd->StaCfg.bAutoRoaming = TRUE; + + DBGPRINT(RT_DEBUG_TRACE, ("AutoRoaming=%d\n", pAd->StaCfg.bAutoRoaming)); + } + // RoamThreshold + if (RTMPGetKeyParameter("RoamThreshold", tmpbuf, 32, pBuffer, TRUE)) + { + long lInfo = simple_strtol(tmpbuf, 0, 10); + + if (lInfo > 90 || lInfo < 60) + pAd->StaCfg.dBmToRoam = -70; + else + pAd->StaCfg.dBmToRoam = (CHAR)(-1)*lInfo; + + DBGPRINT(RT_DEBUG_TRACE, ("RoamThreshold=%d dBm\n", pAd->StaCfg.dBmToRoam)); + } + + if(RTMPGetKeyParameter("TGnWifiTest", tmpbuf, 10, pBuffer, TRUE)) + { + if(simple_strtol(tmpbuf, 0, 10) == 0) + pAd->StaCfg.bTGnWifiTest = FALSE; + else + pAd->StaCfg.bTGnWifiTest = TRUE; + DBGPRINT(RT_DEBUG_TRACE, ("TGnWifiTest=%d\n", pAd->StaCfg.bTGnWifiTest)); + } + + // Beacon Lost Time + if (RTMPGetKeyParameter("BeaconLostTime", tmpbuf, 32, pBuffer, TRUE)) + { + ULONG lInfo = (ULONG)simple_strtol(tmpbuf, 0, 10); + + if ((lInfo != 0) && (lInfo <= 60)) + pAd->StaCfg.BeaconLostTime = (lInfo * OS_HZ); + DBGPRINT(RT_DEBUG_TRACE, ("BeaconLostTime=%ld \n", pAd->StaCfg.BeaconLostTime)); + } + + + } + + + + + }while(0); + + + kfree(tmpbuf); + + return NDIS_STATUS_SUCCESS; + +} diff --git a/drivers/staging/rt2860/common/cmm_sanity.c b/drivers/staging/rt2860/common/cmm_sanity.c index 85855f7f38cb..457b6d8a3ce2 100644 --- a/drivers/staging/rt2860/common/cmm_sanity.c +++ b/drivers/staging/rt2860/common/cmm_sanity.c @@ -283,8 +283,8 @@ BOOLEAN PeerBeaconAndProbeRspSanity( OUT USHORT *LengthVIE, OUT PNDIS_802_11_VARIABLE_IEs pVIE) { - CHAR *Ptr; - CHAR TimLen; + UCHAR *Ptr; + UCHAR TimLen; PFRAME_802_11 pFrame; PEID_STRUCT pEid; UCHAR SubType; @@ -529,10 +529,9 @@ BOOLEAN PeerBeaconAndProbeRspSanity( case IE_TIM: if(INFRA_ON(pAd) && SubType == SUBTYPE_BEACON) { - GetTimBit((PUCHAR)pEid, pAd->StaActive.Aid, &TimLen, pBcastFlag, pDtimCount, pDtimPeriod, pMessageToMe); + GetTimBit((PCHAR)pEid, pAd->StaActive.Aid, &TimLen, pBcastFlag, pDtimCount, pDtimPeriod, pMessageToMe); } break; - case IE_CHANNEL_SWITCH_ANNOUNCEMENT: if(pEid->Len == 3) { @@ -545,6 +544,26 @@ BOOLEAN PeerBeaconAndProbeRspSanity( // Wifi WMM use the same IE vale, need to parse that too // case IE_WPA: case IE_VENDOR_SPECIFIC: + // Check Broadcom/Atheros 802.11n OUI version, for HT Capability IE. + // This HT IE is before IEEE draft set HT IE value.2006-09-28 by Jan. + /*if (NdisEqualMemory(pEid->Octet, BROADCOM_OUI, 3) && (pEid->Len >= 4)) + { + if ((pEid->Octet[3] == OUI_BROADCOM_HT) && (pEid->Len >= 30)) + { + { + NdisMoveMemory(pHtCapability, &pEid->Octet[4], sizeof(HT_CAPABILITY_IE)); + *pHtCapabilityLen = SIZE_HT_CAP_IE; // Nnow we only support 26 bytes. + } + } + if ((pEid->Octet[3] == OUI_BROADCOM_HT) && (pEid->Len >= 26)) + { + { + NdisMoveMemory(AddHtInfo, &pEid->Octet[4], sizeof(ADD_HT_INFO_IE)); + *AddHtInfoLen = SIZE_ADD_HT_INFO_IE; // Nnow we only support 26 bytes. + } + } + } + */ // Check the OUI version, filter out non-standard usage if (NdisEqualMemory(pEid->Octet, RALINK_OUI, 3) && (pEid->Len == 7)) { @@ -638,6 +657,8 @@ BOOLEAN PeerBeaconAndProbeRspSanity( pEdcaParm->Cwmax[QID_AC_VO] = CW_MAX_IN_BITS-1; pEdcaParm->Txop[QID_AC_VO] = 48; // AC_VO: 48*32us ~= 1.5ms } + + break; case IE_EXT_SUPP_RATES: @@ -718,7 +739,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity( if (Sanity != 0x7) { - DBGPRINT(RT_DEBUG_WARN, ("PeerBeaconAndProbeRspSanity - missing field, Sanity=0x%02x\n", Sanity)); + DBGPRINT(RT_DEBUG_LOUD, ("PeerBeaconAndProbeRspSanity - missing field, Sanity=0x%02x\n", Sanity)); return FALSE; } else @@ -755,8 +776,6 @@ BOOLEAN MlmeScanReqSanity( if ((*pBssType == BSS_INFRA || *pBssType == BSS_ADHOC || *pBssType == BSS_ANY) && (*pScanType == SCAN_ACTIVE || *pScanType == SCAN_PASSIVE - || *pScanType == SCAN_CISCO_PASSIVE || *pScanType == SCAN_CISCO_ACTIVE - || *pScanType == SCAN_CISCO_CHANNEL_LOAD || *pScanType == SCAN_CISCO_NOISE )) { return TRUE; @@ -837,8 +856,7 @@ BOOLEAN PeerAuthSanity( NdisMoveMemory(pSeq, &pFrame->Octet[2], 2); NdisMoveMemory(pStatus, &pFrame->Octet[4], 2); - if ((*pAlg == Ndis802_11AuthModeOpen) - ) + if (*pAlg == AUTH_MODE_OPEN) { if (*pSeq == 1 || *pSeq == 2) { @@ -850,7 +868,7 @@ BOOLEAN PeerAuthSanity( return FALSE; } } - else if (*pAlg == Ndis802_11AuthModeShared) + else if (*pAlg == AUTH_MODE_KEY) { if (*pSeq == 1 || *pSeq == 4) { @@ -897,7 +915,7 @@ BOOLEAN MlmeAuthReqSanity( *pTimeout = pInfo->Timeout; *pAlg = pInfo->Alg; - if (((*pAlg == Ndis802_11AuthModeShared) ||(*pAlg == Ndis802_11AuthModeOpen) + if (((*pAlg == AUTH_MODE_KEY) ||(*pAlg == AUTH_MODE_OPEN) ) && ((*pAddr & 0x01) == 0)) { @@ -1052,3 +1070,196 @@ NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity( return NetWorkType; } + +/* + ========================================================================== + Description: + Check the validity of the received EAPoL frame + Return: + TRUE if all parameters are OK, + FALSE otherwise + ========================================================================== + */ +BOOLEAN PeerWpaMessageSanity( + IN PRTMP_ADAPTER pAd, + IN PEAPOL_PACKET pMsg, + IN ULONG MsgLen, + IN UCHAR MsgType, + IN MAC_TABLE_ENTRY *pEntry) +{ + UCHAR mic[LEN_KEY_DESC_MIC], digest[80], KEYDATA[MAX_LEN_OF_RSNIE]; + BOOLEAN bReplayDiff = FALSE; + BOOLEAN bWPA2 = FALSE; + KEY_INFO EapolKeyInfo; + UCHAR GroupKeyIndex = 0; + + + NdisZeroMemory(mic, sizeof(mic)); + NdisZeroMemory(digest, sizeof(digest)); + NdisZeroMemory(KEYDATA, sizeof(KEYDATA)); + NdisZeroMemory((PUCHAR)&EapolKeyInfo, sizeof(EapolKeyInfo)); + + NdisMoveMemory((PUCHAR)&EapolKeyInfo, (PUCHAR)&pMsg->KeyDesc.KeyInfo, sizeof(KEY_INFO)); + + *((USHORT *)&EapolKeyInfo) = cpu2le16(*((USHORT *)&EapolKeyInfo)); + + // Choose WPA2 or not + if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) || (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) + bWPA2 = TRUE; + + // 0. Check MsgType + if ((MsgType > EAPOL_GROUP_MSG_2) || (MsgType < EAPOL_PAIR_MSG_1)) + { + DBGPRINT(RT_DEBUG_ERROR, ("The message type is invalid(%d)! \n", MsgType)); + return FALSE; + } + + // 1. Replay counter check + if (MsgType == EAPOL_PAIR_MSG_1 || MsgType == EAPOL_PAIR_MSG_3 || MsgType == EAPOL_GROUP_MSG_1) // For supplicant + { + // First validate replay counter, only accept message with larger replay counter. + // Let equal pass, some AP start with all zero replay counter + UCHAR ZeroReplay[LEN_KEY_DESC_REPLAY]; + + NdisZeroMemory(ZeroReplay, LEN_KEY_DESC_REPLAY); + if ((RTMPCompareMemory(pMsg->KeyDesc.ReplayCounter, pEntry->R_Counter, LEN_KEY_DESC_REPLAY) != 1) && + (RTMPCompareMemory(pMsg->KeyDesc.ReplayCounter, ZeroReplay, LEN_KEY_DESC_REPLAY) != 0)) + { + bReplayDiff = TRUE; + } + } + else if (MsgType == EAPOL_PAIR_MSG_2 || MsgType == EAPOL_PAIR_MSG_4 || MsgType == EAPOL_GROUP_MSG_2) // For authenticator + { + // check Replay Counter coresponds to MSG from authenticator, otherwise discard + if (!NdisEqualMemory(pMsg->KeyDesc.ReplayCounter, pEntry->R_Counter, LEN_KEY_DESC_REPLAY)) + { + bReplayDiff = TRUE; + } + } + + // Replay Counter different condition + if (bReplayDiff) + { + // send wireless event - for replay counter different + if (pAd->CommonCfg.bWirelessEvent) + RTMPSendWirelessEvent(pAd, IW_REPLAY_COUNTER_DIFF_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); + + if (MsgType < EAPOL_GROUP_MSG_1) + { + DBGPRINT(RT_DEBUG_ERROR, ("Replay Counter Different in pairwise msg %d of 4-way handshake!\n", MsgType)); + } + else + { + DBGPRINT(RT_DEBUG_ERROR, ("Replay Counter Different in group msg %d of 2-way handshake!\n", (MsgType - EAPOL_PAIR_MSG_4))); + } + + hex_dump("Receive replay counter ", pMsg->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); + hex_dump("Current replay counter ", pEntry->R_Counter, LEN_KEY_DESC_REPLAY); + return FALSE; + } + + // 2. Verify MIC except Pairwise Msg1 + if (MsgType != EAPOL_PAIR_MSG_1) + { + UCHAR rcvd_mic[LEN_KEY_DESC_MIC]; + + // Record the received MIC for check later + NdisMoveMemory(rcvd_mic, pMsg->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); + NdisZeroMemory(pMsg->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); + + if (EapolKeyInfo.KeyDescVer == DESC_TYPE_TKIP) // TKIP + { + HMAC_MD5(pEntry->PTK, LEN_EAP_MICK, (PUCHAR)pMsg, MsgLen, mic, MD5_DIGEST_SIZE); + } + else if (EapolKeyInfo.KeyDescVer == DESC_TYPE_AES) // AES + { + HMAC_SHA1(pEntry->PTK, LEN_EAP_MICK, (PUCHAR)pMsg, MsgLen, digest, SHA1_DIGEST_SIZE); + NdisMoveMemory(mic, digest, LEN_KEY_DESC_MIC); + } + + if (!NdisEqualMemory(rcvd_mic, mic, LEN_KEY_DESC_MIC)) + { + // send wireless event - for MIC different + if (pAd->CommonCfg.bWirelessEvent) + RTMPSendWirelessEvent(pAd, IW_MIC_DIFF_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); + + if (MsgType < EAPOL_GROUP_MSG_1) + { + DBGPRINT(RT_DEBUG_ERROR, ("MIC Different in pairwise msg %d of 4-way handshake!\n", MsgType)); + } + else + { + DBGPRINT(RT_DEBUG_ERROR, ("MIC Different in group msg %d of 2-way handshake!\n", (MsgType - EAPOL_PAIR_MSG_4))); + } + + hex_dump("Received MIC", rcvd_mic, LEN_KEY_DESC_MIC); + hex_dump("Desired MIC", mic, LEN_KEY_DESC_MIC); + + return FALSE; + } + } + + // 1. Decrypt the Key Data field if GTK is included. + // 2. Extract the context of the Key Data field if it exist. + // The field in pairwise_msg_2_WPA1(WPA2) & pairwise_msg_3_WPA1 is clear. + // The field in group_msg_1_WPA1(WPA2) & pairwise_msg_3_WPA2 is encrypted. + if (CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen) > 0) + { + // Decrypt this field + if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2) || (MsgType == EAPOL_GROUP_MSG_1)) + { + if( + (EapolKeyInfo.KeyDescVer == DESC_TYPE_AES)) + { + // AES + AES_GTK_KEY_UNWRAP(&pEntry->PTK[16], KEYDATA, + CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen), + pMsg->KeyDesc.KeyData); + } + else + { + INT i; + UCHAR Key[32]; + // Decrypt TKIP GTK + // Construct 32 bytes RC4 Key + NdisMoveMemory(Key, pMsg->KeyDesc.KeyIv, 16); + NdisMoveMemory(&Key[16], &pEntry->PTK[16], 16); + ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, Key, 32); + //discard first 256 bytes + for(i = 0; i < 256; i++) + ARCFOUR_BYTE(&pAd->PrivateInfo.WEPCONTEXT); + // Decrypt GTK. Becareful, there is no ICV to check the result is correct or not + ARCFOUR_DECRYPT(&pAd->PrivateInfo.WEPCONTEXT, KEYDATA, + pMsg->KeyDesc.KeyData, + CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen)); + } + + if (!bWPA2 && (MsgType == EAPOL_GROUP_MSG_1)) + GroupKeyIndex = EapolKeyInfo.KeyIndex; + + } + else if ((MsgType == EAPOL_PAIR_MSG_2) || (MsgType == EAPOL_PAIR_MSG_3 && !bWPA2)) + { + NdisMoveMemory(KEYDATA, pMsg->KeyDesc.KeyData, CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen)); + } + else + { + + return TRUE; + } + + // Parse Key Data field to + // 1. verify RSN IE for pairwise_msg_2_WPA1(WPA2) ,pairwise_msg_3_WPA1(WPA2) + // 2. verify KDE format for pairwise_msg_3_WPA2, group_msg_1_WPA2 + // 3. update shared key for pairwise_msg_3_WPA2, group_msg_1_WPA1(WPA2) + if (!RTMPParseEapolKeyData(pAd, KEYDATA, + CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen), + GroupKeyIndex, MsgType, bWPA2, pEntry)) + { + return FALSE; + } + } + + return TRUE; + +} diff --git a/drivers/staging/rt2860/common/cmm_sync.c b/drivers/staging/rt2860/common/cmm_sync.c index a6e1b6ddfe57..4cb507dbeca1 100644 --- a/drivers/staging/rt2860/common/cmm_sync.c +++ b/drivers/staging/rt2860/common/cmm_sync.c @@ -25,7 +25,7 @@ ************************************************************************* Module Name: - sync.c + cmm_sync.c Abstract: @@ -64,11 +64,16 @@ UCHAR A_BAND_REGION_3_CHANNEL_LIST[]={52, 56, 60, 64, 149, 153, 157, 161}; UCHAR A_BAND_REGION_4_CHANNEL_LIST[]={149, 153, 157, 161, 165}; UCHAR A_BAND_REGION_5_CHANNEL_LIST[]={149, 153, 157, 161}; UCHAR A_BAND_REGION_6_CHANNEL_LIST[]={36, 40, 44, 48}; -UCHAR A_BAND_REGION_7_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165}; +UCHAR A_BAND_REGION_7_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173}; UCHAR A_BAND_REGION_8_CHANNEL_LIST[]={52, 56, 60, 64}; UCHAR A_BAND_REGION_9_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165}; UCHAR A_BAND_REGION_10_CHANNEL_LIST[]={36, 40, 44, 48, 149, 153, 157, 161, 165}; UCHAR A_BAND_REGION_11_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 149, 153, 157, 161}; +UCHAR A_BAND_REGION_12_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}; +UCHAR A_BAND_REGION_13_CHANNEL_LIST[]={52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161}; +UCHAR A_BAND_REGION_14_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 136, 140, 149, 153, 157, 161, 165}; +UCHAR A_BAND_REGION_15_CHANNEL_LIST[]={149, 153, 157, 161, 165, 169, 173}; + //BaSizeArray follows the 802.11n definition as MaxRxFactor. 2^(13+factor) bytes. When factor =0, it's about Ba buffer size =8. UCHAR BaSizeArray[4] = {8,16,32,64}; @@ -200,7 +205,22 @@ VOID BuildChannelList( num = sizeof(A_BAND_REGION_11_CHANNEL_LIST)/sizeof(UCHAR); pChannelList = A_BAND_REGION_11_CHANNEL_LIST; break; - + case REGION_12_A_BAND: + num = sizeof(A_BAND_REGION_12_CHANNEL_LIST)/sizeof(UCHAR); + pChannelList = A_BAND_REGION_12_CHANNEL_LIST; + break; + case REGION_13_A_BAND: + num = sizeof(A_BAND_REGION_13_CHANNEL_LIST)/sizeof(UCHAR); + pChannelList = A_BAND_REGION_13_CHANNEL_LIST; + break; + case REGION_14_A_BAND: + num = sizeof(A_BAND_REGION_14_CHANNEL_LIST)/sizeof(UCHAR); + pChannelList = A_BAND_REGION_14_CHANNEL_LIST; + break; + case REGION_15_A_BAND: + num = sizeof(A_BAND_REGION_15_CHANNEL_LIST)/sizeof(UCHAR); + pChannelList = A_BAND_REGION_15_CHANNEL_LIST; + break; default: // Error. should never happen DBGPRINT(RT_DEBUG_WARN,("countryregion=%d not support", pAd->CommonCfg.CountryRegionForABand)); break; @@ -383,8 +403,11 @@ VOID ScanNextChannel( PHEADER_802_11 pHdr80211; UINT ScanTimeIn5gChannel = SHORT_CHANNEL_TIME; + { if (MONITOR_ON(pAd)) return; + } + if (pAd->MlmeAux.Channel == 0) { @@ -409,6 +432,19 @@ VOID ScanNextChannel( } { +#ifdef RT2860 + /* + If all peer Ad-hoc clients leave, driver would do LinkDown and LinkUp. + In LinkUp, CommonCfg.Ssid would copy SSID from MlmeAux. + To prevent SSID is zero or wrong in Beacon, need to recover MlmeAux.SSID here. + */ + if (ADHOC_ON(pAd)) + { + NdisZeroMemory(pAd->MlmeAux.Ssid, MAX_LEN_OF_SSID); + pAd->MlmeAux.SsidLen = pAd->CommonCfg.SsidLen; + NdisMoveMemory(pAd->MlmeAux.Ssid, pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen); + } +#endif // RT2860 // // // To prevent data lost. // Send an NULL data with turned PSM bit on to current associated AP before SCAN progress. @@ -438,29 +474,26 @@ VOID ScanNextChannel( MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_SCAN_CONF, 2, &Status); } + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); } -#ifdef RT2870 +#ifdef RTMP_MAC_USB else if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST) && (pAd->OpMode == OPMODE_STA)) { pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; MlmeCntlConfirm(pAd, MT2_SCAN_CONF, MLME_FAIL_NO_RESOURCE); } -#endif // RT2870 // +#endif // RTMP_MAC_USB // else { { // BBP and RF are not accessible in PS mode, we has to wake them up first if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) -#ifdef RT2860 - AsicForceWakeup(pAd, FROM_TX); -#endif -#ifdef RT2870 AsicForceWakeup(pAd, TRUE); -#endif + // leave PSM during scanning. otherwise we may lost ProbeRsp & BEACON if (pAd->StaCfg.Psm == PWR_SAVE) - MlmeSetPsmBit(pAd, PWR_ACTIVE); + RTMP_SET_PSM_BIT(pAd, PWR_ACTIVE); } AsicSwitchChannel(pAd, pAd->MlmeAux.Channel, TRUE); @@ -487,16 +520,6 @@ VOID ScanNextChannel( // Chnage the channel scan time for CISCO stuff based on its IAPP announcement if (ScanType == FAST_SCAN_ACTIVE) RTMPSetTimer(&pAd->MlmeAux.ScanTimer, FAST_ACTIVE_SCAN_TIME); - else if (((ScanType == SCAN_CISCO_ACTIVE) || - (ScanType == SCAN_CISCO_PASSIVE) || - (ScanType == SCAN_CISCO_CHANNEL_LOAD) || - (ScanType == SCAN_CISCO_NOISE)) && (pAd->OpMode == OPMODE_STA)) - { - if (pAd->StaCfg.CCXScanTime < 25) - RTMPSetTimer(&pAd->MlmeAux.ScanTimer, pAd->StaCfg.CCXScanTime * 2); - else - RTMPSetTimer(&pAd->MlmeAux.ScanTimer, pAd->StaCfg.CCXScanTime); - } else // must be SCAN_PASSIVE or SCAN_ACTIVE { if ((pAd->CommonCfg.PhyMode == PHY_11ABG_MIXED) @@ -512,8 +535,9 @@ VOID ScanNextChannel( RTMPSetTimer(&pAd->MlmeAux.ScanTimer, MAX_CHANNEL_TIME); } - if ((ScanType == SCAN_ACTIVE) || (ScanType == FAST_SCAN_ACTIVE) || - (ScanType == SCAN_CISCO_ACTIVE)) + if ((ScanType == SCAN_ACTIVE) + || (ScanType == FAST_SCAN_ACTIVE) + ) { NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory if (NStatus != NDIS_STATUS_SUCCESS) diff --git a/drivers/staging/rt2860/common/rtmp_tkip.c b/drivers/staging/rt2860/common/cmm_tkip.c similarity index 56% rename from drivers/staging/rt2860/common/rtmp_tkip.c rename to drivers/staging/rt2860/common/cmm_tkip.c index 4a7fda69f9b4..20423e16e0c0 100644 --- a/drivers/staging/rt2860/common/rtmp_tkip.c +++ b/drivers/staging/rt2860/common/cmm_tkip.c @@ -25,7 +25,7 @@ ************************************************************************* Module Name: - rtmp_tkip.c + cmm_tkip.c Abstract: @@ -35,7 +35,7 @@ Paul Wu 02-25-02 Initial */ -#include "../rt_config.h" +#include "../rt_config.h" // Rotation functions on 32 bit values #define ROL32( A, n ) \ @@ -114,74 +114,6 @@ UINT Tkip_Sbox_Upper[256] = 0x82,0x29,0x5A,0x1E,0x7B,0xA8,0x6D,0x2C }; -/*****************************/ -/******** SBOX Table *********/ -/*****************************/ - -UCHAR SboxTable[256] = -{ - 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, - 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, - 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, - 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, - 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, - 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, - 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, - 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, - 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, - 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, - 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, - 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, - 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, - 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, - 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, - 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, - 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, - 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, - 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, - 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, - 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, - 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, - 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, - 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, - 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, - 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, - 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, - 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, - 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, - 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, - 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, - 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 -}; - -VOID xor_32( - IN PUCHAR a, - IN PUCHAR b, - OUT PUCHAR out); - -VOID xor_128( - IN PUCHAR a, - IN PUCHAR b, - OUT PUCHAR out); - -VOID next_key( - IN PUCHAR key, - IN INT round); - -VOID byte_sub( - IN PUCHAR in, - OUT PUCHAR out); - -VOID shift_row( - IN PUCHAR in, - OUT PUCHAR out); - -VOID mix_column( - IN PUCHAR in, - OUT PUCHAR out); - -UCHAR RTMPCkipSbox( - IN UCHAR a); // // Expanded IV for TKIP function. // @@ -330,7 +262,7 @@ VOID RTMPTkipSetMICKey( */ VOID RTMPTkipAppendByte( IN PTKIP_KEY_INFO pTkip, - IN UCHAR uChar) + IN UCHAR uChar) { // Append the byte to our word-sized buffer pTkip->M |= (uChar << (8* pTkip->nBytesInM)); @@ -464,6 +396,7 @@ VOID RTMPInitTkipEngine( tkipIv.IV16.field.rc2 = *pTSC; tkipIv.IV16.field.CONTROL.field.ExtIV = 1; // 0: non-extended IV, 1: an extended IV tkipIv.IV16.field.CONTROL.field.KeyID = KeyId; +// tkipIv.IV32 = *(PULONG)(pTSC + 2); NdisMoveMemory(&tkipIv.IV32, (pTSC + 2), 4); // Copy IV *pIV16 = tkipIv.IV16.word; @@ -577,75 +510,6 @@ BOOLEAN RTMPTkipCompareMICValue( return (TRUE); } -/* - ======================================================================== - - Routine Description: - Compare MIC value of received MSDU - - Arguments: - pAd Pointer to our adapter - pLLC LLC header - pSrc Pointer to the received Plain text data - pDA Pointer to DA address - pSA Pointer to SA address - pMICKey pointer to MIC Key - Len the length of the received plain text data exclude MIC value - - Return Value: - TRUE MIC value matched - FALSE MIC value mismatched - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -BOOLEAN RTMPTkipCompareMICValueWithLLC( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pLLC, - IN PUCHAR pSrc, - IN PUCHAR pDA, - IN PUCHAR pSA, - IN PUCHAR pMICKey, - IN UINT Len) -{ - UCHAR OldMic[8]; - ULONG Priority = 0; - - // Init MIC value calculation - RTMPTkipSetMICKey(&pAd->PrivateInfo.Rx, pMICKey); - // DA - RTMPTkipAppend(&pAd->PrivateInfo.Rx, pDA, MAC_ADDR_LEN); - // SA - RTMPTkipAppend(&pAd->PrivateInfo.Rx, pSA, MAC_ADDR_LEN); - // Priority + 3 bytes of 0 - RTMPTkipAppend(&pAd->PrivateInfo.Rx, (PUCHAR)&Priority, 4); - - // Start with LLC header - RTMPTkipAppend(&pAd->PrivateInfo.Rx, pLLC, 8); - - // Calculate MIC value from plain text data - RTMPTkipAppend(&pAd->PrivateInfo.Rx, pSrc, Len); - - // Get MIC valude from received frame - NdisMoveMemory(OldMic, pSrc + Len, 8); - - // Get MIC value from decrypted plain data - RTMPTkipGetMIC(&pAd->PrivateInfo.Rx); - - // Move MIC value from MSDU, this steps should move to data path. - // Since the MIC value might cross MPDUs. - if(!NdisEqualMemory(pAd->PrivateInfo.Rx.MIC, OldMic, 8)) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("RTMPTkipCompareMICValueWithLLC(): TKIP MIC Error !\n")); //MIC error. - - - return (FALSE); - } - return (TRUE); -} /* ======================================================================== @@ -865,209 +729,6 @@ VOID RTMPTkipMixKey( } -/************************************************/ -/* construct_mic_header1() */ -/* Builds the first MIC header block from */ -/* header fields. */ -/************************************************/ - -void construct_mic_header1( - unsigned char *mic_header1, - int header_length, - unsigned char *mpdu) -{ - mic_header1[0] = (unsigned char)((header_length - 2) / 256); - mic_header1[1] = (unsigned char)((header_length - 2) % 256); - mic_header1[2] = mpdu[0] & 0xcf; /* Mute CF poll & CF ack bits */ - mic_header1[3] = mpdu[1] & 0xc7; /* Mute retry, more data and pwr mgt bits */ - mic_header1[4] = mpdu[4]; /* A1 */ - mic_header1[5] = mpdu[5]; - mic_header1[6] = mpdu[6]; - mic_header1[7] = mpdu[7]; - mic_header1[8] = mpdu[8]; - mic_header1[9] = mpdu[9]; - mic_header1[10] = mpdu[10]; /* A2 */ - mic_header1[11] = mpdu[11]; - mic_header1[12] = mpdu[12]; - mic_header1[13] = mpdu[13]; - mic_header1[14] = mpdu[14]; - mic_header1[15] = mpdu[15]; -} - -/************************************************/ -/* construct_mic_header2() */ -/* Builds the last MIC header block from */ -/* header fields. */ -/************************************************/ - -void construct_mic_header2( - unsigned char *mic_header2, - unsigned char *mpdu, - int a4_exists, - int qc_exists) -{ - int i; - - for (i = 0; i<16; i++) mic_header2[i]=0x00; - - mic_header2[0] = mpdu[16]; /* A3 */ - mic_header2[1] = mpdu[17]; - mic_header2[2] = mpdu[18]; - mic_header2[3] = mpdu[19]; - mic_header2[4] = mpdu[20]; - mic_header2[5] = mpdu[21]; - - // In Sequence Control field, mute sequence numer bits (12-bit) - mic_header2[6] = mpdu[22] & 0x0f; /* SC */ - mic_header2[7] = 0x00; /* mpdu[23]; */ - - if ((!qc_exists) & a4_exists) - { - for (i=0;i<6;i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ - - } - - if (qc_exists && (!a4_exists)) - { - mic_header2[8] = mpdu[24] & 0x0f; /* mute bits 15 - 4 */ - mic_header2[9] = mpdu[25] & 0x00; - } - - if (qc_exists && a4_exists) - { - for (i=0;i<6;i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ - - mic_header2[14] = mpdu[30] & 0x0f; - mic_header2[15] = mpdu[31] & 0x00; - } -} - - -/************************************************/ -/* construct_mic_iv() */ -/* Builds the MIC IV from header fields and PN */ -/************************************************/ - -void construct_mic_iv( - unsigned char *mic_iv, - int qc_exists, - int a4_exists, - unsigned char *mpdu, - unsigned int payload_length, - unsigned char *pn_vector) -{ - int i; - - mic_iv[0] = 0x59; - if (qc_exists && a4_exists) - mic_iv[1] = mpdu[30] & 0x0f; /* QoS_TC */ - if (qc_exists && !a4_exists) - mic_iv[1] = mpdu[24] & 0x0f; /* mute bits 7-4 */ - if (!qc_exists) - mic_iv[1] = 0x00; - for (i = 2; i < 8; i++) - mic_iv[i] = mpdu[i + 8]; /* mic_iv[2:7] = A2[0:5] = mpdu[10:15] */ -#ifdef CONSISTENT_PN_ORDER - for (i = 8; i < 14; i++) - mic_iv[i] = pn_vector[i - 8]; /* mic_iv[8:13] = PN[0:5] */ -#else - for (i = 8; i < 14; i++) - mic_iv[i] = pn_vector[13 - i]; /* mic_iv[8:13] = PN[5:0] */ -#endif - i = (payload_length / 256); - i = (payload_length % 256); - mic_iv[14] = (unsigned char) (payload_length / 256); - mic_iv[15] = (unsigned char) (payload_length % 256); - -} - - - -/************************************/ -/* bitwise_xor() */ -/* A 128 bit, bitwise exclusive or */ -/************************************/ - -void bitwise_xor(unsigned char *ina, unsigned char *inb, unsigned char *out) -{ - int i; - for (i=0; i<16; i++) - { - out[i] = ina[i] ^ inb[i]; - } -} - - -void aes128k128d(unsigned char *key, unsigned char *data, unsigned char *ciphertext) -{ - int round; - int i; - unsigned char intermediatea[16]; - unsigned char intermediateb[16]; - unsigned char round_key[16]; - - for(i=0; i<16; i++) round_key[i] = key[i]; - - for (round = 0; round < 11; round++) - { - if (round == 0) - { - xor_128(round_key, data, ciphertext); - next_key(round_key, round); - } - else if (round == 10) - { - byte_sub(ciphertext, intermediatea); - shift_row(intermediatea, intermediateb); - xor_128(intermediateb, round_key, ciphertext); - } - else /* 1 - 9 */ - { - byte_sub(ciphertext, intermediatea); - shift_row(intermediatea, intermediateb); - mix_column(&intermediateb[0], &intermediatea[0]); - mix_column(&intermediateb[4], &intermediatea[4]); - mix_column(&intermediateb[8], &intermediatea[8]); - mix_column(&intermediateb[12], &intermediatea[12]); - xor_128(intermediatea, round_key, ciphertext); - next_key(round_key, round); - } - } - -} - -void construct_ctr_preload( - unsigned char *ctr_preload, - int a4_exists, - int qc_exists, - unsigned char *mpdu, - unsigned char *pn_vector, - int c) -{ - - int i = 0; - for (i=0; i<16; i++) ctr_preload[i] = 0x00; - i = 0; - - ctr_preload[0] = 0x01; /* flag */ - if (qc_exists && a4_exists) ctr_preload[1] = mpdu[30] & 0x0f; /* QoC_Control */ - if (qc_exists && !a4_exists) ctr_preload[1] = mpdu[24] & 0x0f; - - for (i = 2; i < 8; i++) - ctr_preload[i] = mpdu[i + 8]; /* ctr_preload[2:7] = A2[0:5] = mpdu[10:15] */ -#ifdef CONSISTENT_PN_ORDER - for (i = 8; i < 14; i++) - ctr_preload[i] = pn_vector[i - 8]; /* ctr_preload[8:13] = PN[0:5] */ -#else - for (i = 8; i < 14; i++) - ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */ -#endif - ctr_preload[14] = (unsigned char) (c / 256); // Ctr - ctr_preload[15] = (unsigned char) (c % 256); - -} - - // // TRUE: Success! // FALSE: Decrypt Error! @@ -1102,12 +763,13 @@ BOOLEAN RTMPSoftDecryptTKIP( ULONG pnh;/* Most significant 32 bits of PN */ UINT num_blocks; UINT payload_remainder; - ARCFOURCONTEXT ArcFourContext; + ARCFOURCONTEXT ArcFourContext; UINT crc32 = 0; UINT trailfcs = 0; UCHAR MIC[8]; UCHAR TrailMIC[8]; + fc0 = *pData; fc1 = *(pData + 1); @@ -1211,376 +873,10 @@ BOOLEAN RTMPSoftDecryptTKIP( if (!NdisEqualMemory(MIC, TrailMIC, 8)) { DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptTKIP, WEP Data MIC Error !\n")); //MIC error. + //RTMPReportMicError(pAd, &pWpaKey[KeyID]); // marked by AlbertY @ 20060630 return (FALSE); } + //DBGPRINT(RT_DEBUG_TRACE, "RTMPSoftDecryptTKIP Decript done!!\n"); return TRUE; } - - - - -BOOLEAN RTMPSoftDecryptAES( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, - IN PCIPHER_KEY pWpaKey) -{ - UCHAR KeyID; - UINT HeaderLen; - UCHAR PN[6]; - UINT payload_len; - UINT num_blocks; - UINT payload_remainder; - USHORT fc; - UCHAR fc0; - UCHAR fc1; - UINT frame_type; - UINT frame_subtype; - UINT from_ds; - UINT to_ds; - INT a4_exists; - INT qc_exists; - UCHAR aes_out[16]; - int payload_index; - UINT i; - UCHAR ctr_preload[16]; - UCHAR chain_buffer[16]; - UCHAR padded_buffer[16]; - UCHAR mic_iv[16]; - UCHAR mic_header1[16]; - UCHAR mic_header2[16]; - UCHAR MIC[8]; - UCHAR TrailMIC[8]; - - fc0 = *pData; - fc1 = *(pData + 1); - - fc = *((PUSHORT)pData); - - frame_type = ((fc0 >> 2) & 0x03); - frame_subtype = ((fc0 >> 4) & 0x0f); - - from_ds = (fc1 & 0x2) >> 1; - to_ds = (fc1 & 0x1); - - a4_exists = (from_ds & to_ds); - qc_exists = ((frame_subtype == 0x08) || /* Assumed QoS subtypes */ - (frame_subtype == 0x09) || /* Likely to change. */ - (frame_subtype == 0x0a) || - (frame_subtype == 0x0b) - ); - - HeaderLen = 24; - if (a4_exists) - HeaderLen += 6; - - KeyID = *((PUCHAR)(pData+ HeaderLen + 3)); - KeyID = KeyID >> 6; - - if (pWpaKey[KeyID].KeyLen == 0) - { - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSoftDecryptAES failed!(KeyID[%d] Length can not be 0)\n", KeyID)); - return FALSE; - } - - PN[0] = *(pData+ HeaderLen); - PN[1] = *(pData+ HeaderLen + 1); - PN[2] = *(pData+ HeaderLen + 4); - PN[3] = *(pData+ HeaderLen + 5); - PN[4] = *(pData+ HeaderLen + 6); - PN[5] = *(pData+ HeaderLen + 7); - - payload_len = DataByteCnt - HeaderLen - 8 - 8; // 8 bytes for CCMP header , 8 bytes for MIC - payload_remainder = (payload_len) % 16; - num_blocks = (payload_len) / 16; - - - - // Find start of payload - payload_index = HeaderLen + 8; //IV+EIV - - for (i=0; i< num_blocks; i++) - { - construct_ctr_preload(ctr_preload, - a4_exists, - qc_exists, - pData, - PN, - i+1 ); - - aes128k128d(pWpaKey[KeyID].Key, ctr_preload, aes_out); - - bitwise_xor(aes_out, pData + payload_index, chain_buffer); - NdisMoveMemory(pData + payload_index - 8, chain_buffer, 16); - payload_index += 16; - } - - // - // If there is a short final block, then pad it - // encrypt it and copy the unpadded part back - // - if (payload_remainder > 0) - { - construct_ctr_preload(ctr_preload, - a4_exists, - qc_exists, - pData, - PN, - num_blocks + 1); - - NdisZeroMemory(padded_buffer, 16); - NdisMoveMemory(padded_buffer, pData + payload_index, payload_remainder); - - aes128k128d(pWpaKey[KeyID].Key, ctr_preload, aes_out); - - bitwise_xor(aes_out, padded_buffer, chain_buffer); - NdisMoveMemory(pData + payload_index - 8, chain_buffer, payload_remainder); - payload_index += payload_remainder; - } - - // - // Descrypt the MIC - // - construct_ctr_preload(ctr_preload, - a4_exists, - qc_exists, - pData, - PN, - 0); - NdisZeroMemory(padded_buffer, 16); - NdisMoveMemory(padded_buffer, pData + payload_index, 8); - - aes128k128d(pWpaKey[KeyID].Key, ctr_preload, aes_out); - - bitwise_xor(aes_out, padded_buffer, chain_buffer); - - NdisMoveMemory(TrailMIC, chain_buffer, 8); - - // - // Calculate MIC - // - - //Force the protected frame bit on - *(pData + 1) = *(pData + 1) | 0x40; - - // Find start of payload - // Because the CCMP header has been removed - payload_index = HeaderLen; - - construct_mic_iv( - mic_iv, - qc_exists, - a4_exists, - pData, - payload_len, - PN); - - construct_mic_header1( - mic_header1, - HeaderLen, - pData); - - construct_mic_header2( - mic_header2, - pData, - a4_exists, - qc_exists); - - aes128k128d(pWpaKey[KeyID].Key, mic_iv, aes_out); - bitwise_xor(aes_out, mic_header1, chain_buffer); - aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); - bitwise_xor(aes_out, mic_header2, chain_buffer); - aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); - - // iterate through each 16 byte payload block - for (i = 0; i < num_blocks; i++) - { - bitwise_xor(aes_out, pData + payload_index, chain_buffer); - payload_index += 16; - aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); - } - - // Add on the final payload block if it needs padding - if (payload_remainder > 0) - { - NdisZeroMemory(padded_buffer, 16); - NdisMoveMemory(padded_buffer, pData + payload_index, payload_remainder); - - bitwise_xor(aes_out, padded_buffer, chain_buffer); - aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); - } - // aes_out contains padded mic, discard most significant - // 8 bytes to generate 64 bit MIC - for (i = 0 ; i < 8; i++) MIC[i] = aes_out[i]; - - if (!NdisEqualMemory(MIC, TrailMIC, 8)) - { - DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptAES, MIC Error !\n")); //MIC error. - return FALSE; - } - - return TRUE; -} - -/****************************************/ -/* aes128k128d() */ -/* Performs a 128 bit AES encrypt with */ -/* 128 bit data. */ -/****************************************/ -VOID xor_128( - IN PUCHAR a, - IN PUCHAR b, - OUT PUCHAR out) -{ - INT i; - - for (i=0;i<16; i++) - { - out[i] = a[i] ^ b[i]; - } -} - -VOID next_key( - IN PUCHAR key, - IN INT round) -{ - UCHAR rcon; - UCHAR sbox_key[4]; - UCHAR rcon_table[12] = - { - 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, - 0x1b, 0x36, 0x36, 0x36 - }; - - sbox_key[0] = RTMPCkipSbox(key[13]); - sbox_key[1] = RTMPCkipSbox(key[14]); - sbox_key[2] = RTMPCkipSbox(key[15]); - sbox_key[3] = RTMPCkipSbox(key[12]); - - rcon = rcon_table[round]; - - xor_32(&key[0], sbox_key, &key[0]); - key[0] = key[0] ^ rcon; - - xor_32(&key[4], &key[0], &key[4]); - xor_32(&key[8], &key[4], &key[8]); - xor_32(&key[12], &key[8], &key[12]); -} - -VOID xor_32( - IN PUCHAR a, - IN PUCHAR b, - OUT PUCHAR out) -{ - INT i; - - for (i=0;i<4; i++) - { - out[i] = a[i] ^ b[i]; - } -} - -VOID byte_sub( - IN PUCHAR in, - OUT PUCHAR out) -{ - INT i; - - for (i=0; i< 16; i++) - { - out[i] = RTMPCkipSbox(in[i]); - } -} - -UCHAR RTMPCkipSbox( - IN UCHAR a) -{ - return SboxTable[(int)a]; -} - -VOID shift_row( - IN PUCHAR in, - OUT PUCHAR out) -{ - out[0] = in[0]; - out[1] = in[5]; - out[2] = in[10]; - out[3] = in[15]; - out[4] = in[4]; - out[5] = in[9]; - out[6] = in[14]; - out[7] = in[3]; - out[8] = in[8]; - out[9] = in[13]; - out[10] = in[2]; - out[11] = in[7]; - out[12] = in[12]; - out[13] = in[1]; - out[14] = in[6]; - out[15] = in[11]; -} - -VOID mix_column( - IN PUCHAR in, - OUT PUCHAR out) -{ - INT i; - UCHAR add1b[4]; - UCHAR add1bf7[4]; - UCHAR rotl[4]; - UCHAR swap_halfs[4]; - UCHAR andf7[4]; - UCHAR rotr[4]; - UCHAR temp[4]; - UCHAR tempb[4]; - - for (i=0 ; i<4; i++) - { - if ((in[i] & 0x80)== 0x80) - add1b[i] = 0x1b; - else - add1b[i] = 0x00; - } - - swap_halfs[0] = in[2]; /* Swap halfs */ - swap_halfs[1] = in[3]; - swap_halfs[2] = in[0]; - swap_halfs[3] = in[1]; - - rotl[0] = in[3]; /* Rotate left 8 bits */ - rotl[1] = in[0]; - rotl[2] = in[1]; - rotl[3] = in[2]; - - andf7[0] = in[0] & 0x7f; - andf7[1] = in[1] & 0x7f; - andf7[2] = in[2] & 0x7f; - andf7[3] = in[3] & 0x7f; - - for (i = 3; i>0; i--) /* logical shift left 1 bit */ - { - andf7[i] = andf7[i] << 1; - if ((andf7[i-1] & 0x80) == 0x80) - { - andf7[i] = (andf7[i] | 0x01); - } - } - andf7[0] = andf7[0] << 1; - andf7[0] = andf7[0] & 0xfe; - - xor_32(add1b, andf7, add1bf7); - - xor_32(in, add1bf7, rotr); - - temp[0] = rotr[0]; /* Rotate right 8 bits */ - rotr[0] = rotr[1]; - rotr[1] = rotr[2]; - rotr[2] = rotr[3]; - rotr[3] = temp[0]; - - xor_32(add1bf7, rotr, temp); - xor_32(swap_halfs, rotl,tempb); - xor_32(temp, tempb, out); -} - diff --git a/drivers/staging/rt2860/common/rtmp_wep.c b/drivers/staging/rt2860/common/cmm_wep.c similarity index 97% rename from drivers/staging/rt2860/common/rtmp_wep.c rename to drivers/staging/rt2860/common/cmm_wep.c index 8e833e7011bd..b13858d0a74a 100644 --- a/drivers/staging/rt2860/common/rtmp_wep.c +++ b/drivers/staging/rt2860/common/cmm_wep.c @@ -35,7 +35,7 @@ Paul Wu 10-28-02 Initial */ -#include "../rt_config.h" +#include "../rt_config.h" UINT FCSTAB_32[256] = { @@ -105,6 +105,15 @@ UINT FCSTAB_32[256] = 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d }; +/* +UCHAR WEPKEY[] = { + //IV + 0x00, 0x11, 0x22, + //WEP KEY + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC + }; + */ + /* ======================================================================== @@ -144,12 +153,6 @@ VOID RTMPInitWepEngine( pAd->PrivateInfo.FCSCRC32 = PPPINITFCS32; //Init crc32. - if (pAd->StaCfg.bCkipOn && (pAd->StaCfg.CkipFlag & 0x10) && (pAd->OpMode == OPMODE_STA)) - { - ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, pKey, KeyLen); //INIT SBOX, KEYLEN+3(IV) - NdisMoveMemory(pDest, pKey, 3); //Append Init Vector - } - else { NdisMoveMemory(WEPKEY + 3, pKey, KeyLen); @@ -215,7 +218,7 @@ VOID RTMPEncryptData( ======================================================================== */ BOOLEAN RTMPSoftDecryptWEP( - IN PRTMP_ADAPTER pAd, + IN PRTMP_ADAPTER pAd, IN PUCHAR pData, IN ULONG DataByteCnt, IN PCIPHER_KEY pGroupKey) @@ -229,7 +232,7 @@ BOOLEAN RTMPSoftDecryptWEP( //WEP KEY 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC }; - UCHAR *pPayload = (UCHAR *)pData + LENGTH_802_11; + UCHAR *pPayload = (UCHAR *)pData + LENGTH_802_11; ULONG payload_len = DataByteCnt - LENGTH_802_11; NdisMoveMemory(WEPKEY, pPayload, 3); //Get WEP IV @@ -494,4 +497,3 @@ VOID RTMPSetICV( ARCFOUR_ENCRYPT(&pAd->PrivateInfo.WEPCONTEXT, pDest, (PUCHAR) &pAd->PrivateInfo.FCSCRC32, 4); } - diff --git a/drivers/staging/rt2860/common/cmm_wpa.c b/drivers/staging/rt2860/common/cmm_wpa.c index 2de29fde2c40..5af78b841183 100644 --- a/drivers/staging/rt2860/common/cmm_wpa.c +++ b/drivers/staging/rt2860/common/cmm_wpa.c @@ -52,497 +52,2635 @@ UCHAR OUI_WPA2_CCMP[4] = {0x00, 0x0F, 0xAC, 0x04}; UCHAR OUI_WPA2_8021X_AKM[4] = {0x00, 0x0F, 0xAC, 0x01}; UCHAR OUI_WPA2_PSK_AKM[4] = {0x00, 0x0F, 0xAC, 0x02}; UCHAR OUI_WPA2_WEP104[4] = {0x00, 0x0F, 0xAC, 0x05}; -// MSA OUI -UCHAR OUI_MSA_8021X_AKM[4] = {0x00, 0x0F, 0xAC, 0x05}; // Not yet final - IEEE 802.11s-D1.06 -UCHAR OUI_MSA_PSK_AKM[4] = {0x00, 0x0F, 0xAC, 0x06}; // Not yet final - IEEE 802.11s-D1.06 + + + +static VOID ConstructEapolKeyData( + IN PMAC_TABLE_ENTRY pEntry, + IN UCHAR GroupKeyWepStatus, + IN UCHAR keyDescVer, + IN UCHAR MsgType, + IN UCHAR DefaultKeyIdx, + IN UCHAR *GTK, + IN UCHAR *RSNIE, + IN UCHAR RSNIE_LEN, + OUT PEAPOL_PACKET pMsg); + +static VOID CalculateMIC( + IN UCHAR KeyDescVer, + IN UCHAR *PTK, + OUT PEAPOL_PACKET pMsg); + +static VOID WpaEAPPacketAction( + IN PRTMP_ADAPTER pAd, + IN MLME_QUEUE_ELEM *Elem); + +static VOID WpaEAPOLASFAlertAction( + IN PRTMP_ADAPTER pAd, + IN MLME_QUEUE_ELEM *Elem); + +static VOID WpaEAPOLLogoffAction( + IN PRTMP_ADAPTER pAd, + IN MLME_QUEUE_ELEM *Elem); + +static VOID WpaEAPOLStartAction( + IN PRTMP_ADAPTER pAd, + IN MLME_QUEUE_ELEM *Elem); + +static VOID WpaEAPOLKeyAction( + IN PRTMP_ADAPTER pAd, + IN MLME_QUEUE_ELEM *Elem); /* - ======================================================================== + ========================================================================== + Description: + association state machine init, including state transition and timer init + Parameters: + S - pointer to the association state machine + ========================================================================== + */ +VOID WpaStateMachineInit( + IN PRTMP_ADAPTER pAd, + IN STATE_MACHINE *S, + OUT STATE_MACHINE_FUNC Trans[]) +{ + StateMachineInit(S, (STATE_MACHINE_FUNC *)Trans, MAX_WPA_PTK_STATE, MAX_WPA_MSG, (STATE_MACHINE_FUNC)Drop, WPA_PTK, WPA_MACHINE_BASE); - Routine Description: - The pseudo-random function(PRF) that hashes various inputs to - derive a pseudo-random value. To add liveness to the pseudo-random - value, a nonce should be one of the inputs. + StateMachineSetAction(S, WPA_PTK, MT2_EAPPacket, (STATE_MACHINE_FUNC)WpaEAPPacketAction); + StateMachineSetAction(S, WPA_PTK, MT2_EAPOLStart, (STATE_MACHINE_FUNC)WpaEAPOLStartAction); + StateMachineSetAction(S, WPA_PTK, MT2_EAPOLLogoff, (STATE_MACHINE_FUNC)WpaEAPOLLogoffAction); + StateMachineSetAction(S, WPA_PTK, MT2_EAPOLKey, (STATE_MACHINE_FUNC)WpaEAPOLKeyAction); + StateMachineSetAction(S, WPA_PTK, MT2_EAPOLASFAlert, (STATE_MACHINE_FUNC)WpaEAPOLASFAlertAction); +} - It is used to generate PTK, GTK or some specific random value. +/* + ========================================================================== + Description: + this is state machine function. + When receiving EAP packets which is for 802.1x authentication use. + Not use in PSK case + Return: + ========================================================================== +*/ +VOID WpaEAPPacketAction( + IN PRTMP_ADAPTER pAd, + IN MLME_QUEUE_ELEM *Elem) +{ +} + +VOID WpaEAPOLASFAlertAction( + IN PRTMP_ADAPTER pAd, + IN MLME_QUEUE_ELEM *Elem) +{ +} + +VOID WpaEAPOLLogoffAction( + IN PRTMP_ADAPTER pAd, + IN MLME_QUEUE_ELEM *Elem) +{ +} + +/* + ========================================================================== + Description: + Start 4-way HS when rcv EAPOL_START which may create by our driver in assoc.c + Return: + ========================================================================== +*/ +VOID WpaEAPOLStartAction( + IN PRTMP_ADAPTER pAd, + IN MLME_QUEUE_ELEM *Elem) +{ + MAC_TABLE_ENTRY *pEntry; + PHEADER_802_11 pHeader; + + DBGPRINT(RT_DEBUG_TRACE, ("WpaEAPOLStartAction ===> \n")); + + pHeader = (PHEADER_802_11)Elem->Msg; + + //For normaol PSK, we enqueue an EAPOL-Start command to trigger the process. + if (Elem->MsgLen == 6) + pEntry = MacTableLookup(pAd, Elem->Msg); + else + { + pEntry = MacTableLookup(pAd, pHeader->Addr2); + } + + if (pEntry) + { + DBGPRINT(RT_DEBUG_TRACE, (" PortSecured(%d), WpaState(%d), AuthMode(%d), PMKID_CacheIdx(%d) \n", pEntry->PortSecured, pEntry->WpaState, pEntry->AuthMode, pEntry->PMKID_CacheIdx)); + + if ((pEntry->PortSecured == WPA_802_1X_PORT_NOT_SECURED) + && (pEntry->WpaState < AS_PTKSTART) + && ((pEntry->AuthMode == Ndis802_11AuthModeWPAPSK) || (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK) || ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) && (pEntry->PMKID_CacheIdx != ENTRY_NOT_FOUND)))) + { + pEntry->PrivacyFilter = Ndis802_11PrivFilter8021xWEP; + pEntry->WpaState = AS_INITPSK; + pEntry->PortSecured = WPA_802_1X_PORT_NOT_SECURED; + NdisZeroMemory(pEntry->R_Counter, sizeof(pEntry->R_Counter)); + pEntry->ReTryCounter = PEER_MSG1_RETRY_TIMER_CTR; + + WPAStart4WayHS(pAd, pEntry, PEER_MSG1_RETRY_EXEC_INTV); + } + } +} + +/* + ========================================================================== + Description: + This is state machine function. + When receiving EAPOL packets which is for 802.1x key management. + Use both in WPA, and WPAPSK case. + In this function, further dispatch to different functions according to the received packet. 3 categories are : + 1. normal 4-way pairwisekey and 2-way groupkey handshake + 2. MIC error (Countermeasures attack) report packet from STA. + 3. Request for pairwise/group key update from STA + Return: + ========================================================================== +*/ +VOID WpaEAPOLKeyAction( + IN PRTMP_ADAPTER pAd, + IN MLME_QUEUE_ELEM *Elem) +{ + MAC_TABLE_ENTRY *pEntry; + PHEADER_802_11 pHeader; + PEAPOL_PACKET pEapol_packet; + KEY_INFO peerKeyInfo; + + DBGPRINT(RT_DEBUG_TRACE, ("WpaEAPOLKeyAction ===>\n")); + + pHeader = (PHEADER_802_11)Elem->Msg; + pEapol_packet = (PEAPOL_PACKET)&Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; + + NdisZeroMemory((PUCHAR)&peerKeyInfo, sizeof(peerKeyInfo)); + NdisMoveMemory((PUCHAR)&peerKeyInfo, (PUCHAR)&pEapol_packet->KeyDesc.KeyInfo, sizeof(KEY_INFO)); + + hex_dump("Received Eapol frame", (unsigned char *)pEapol_packet, (Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H)); + + *((USHORT *)&peerKeyInfo) = cpu2le16(*((USHORT *)&peerKeyInfo)); + + do + { + pEntry = MacTableLookup(pAd, pHeader->Addr2); + + if (!pEntry || ((!pEntry->ValidAsCLI) && (!pEntry->ValidAsApCli))) + break; + + if (pEntry->AuthMode < Ndis802_11AuthModeWPA) + break; + + DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPoL-Key frame from STA %02X-%02X-%02X-%02X-%02X-%02X\n", PRINT_MAC(pEntry->Addr))); + + if (((pEapol_packet->ProVer != EAPOL_VER) && (pEapol_packet->ProVer != EAPOL_VER2)) || + ((pEapol_packet->KeyDesc.Type != WPA1_KEY_DESC) && (pEapol_packet->KeyDesc.Type != WPA2_KEY_DESC))) + { + DBGPRINT(RT_DEBUG_ERROR, ("Key descripter does not match with WPA rule\n")); + break; + } + + // The value 1 shall be used for all EAPOL-Key frames to and from a STA when + // neither the group nor pairwise ciphers are CCMP for Key Descriptor 1. + if ((pEntry->WepStatus == Ndis802_11Encryption2Enabled) && (peerKeyInfo.KeyDescVer != DESC_TYPE_TKIP)) + { + DBGPRINT(RT_DEBUG_ERROR, ("Key descripter version not match(TKIP) \n")); + break; + } + // The value 2 shall be used for all EAPOL-Key frames to and from a STA when + // either the pairwise or the group cipher is AES-CCMP for Key Descriptor 2. + else if ((pEntry->WepStatus == Ndis802_11Encryption3Enabled) && (peerKeyInfo.KeyDescVer != DESC_TYPE_AES)) + { + DBGPRINT(RT_DEBUG_ERROR, ("Key descripter version not match(AES) \n")); + break; + } + + // Check if this STA is in class 3 state and the WPA state is started + if ((pEntry->Sst == SST_ASSOC) && (pEntry->WpaState >= AS_INITPSK)) + { + // Check the Key Ack (bit 7) of the Key Information to determine the Authenticator + // or not. + // An EAPOL-Key frame that is sent by the Supplicant in response to an EAPOL- + // Key frame from the Authenticator must not have the Ack bit set. + if (peerKeyInfo.KeyAck == 1) + { + // The frame is snet by Authenticator. + // So the Supplicant side shall handle this. + + if ((peerKeyInfo.Secure == 0) && (peerKeyInfo.Request == 0) && + (peerKeyInfo.Error == 0) && (peerKeyInfo.KeyType == PAIRWISEKEY)) + { + // Process 1. the message 1 of 4-way HS in WPA or WPA2 + // EAPOL-Key(0,0,1,0,P,0,0,ANonce,0,DataKD_M1) + // 2. the message 3 of 4-way HS in WPA + // EAPOL-Key(0,1,1,1,P,0,KeyRSC,ANonce,MIC,DataKD_M3) + if (peerKeyInfo.KeyMic == 0) + PeerPairMsg1Action(pAd, pEntry, Elem); + else + PeerPairMsg3Action(pAd, pEntry, Elem); + } + else if ((peerKeyInfo.Secure == 1) && + (peerKeyInfo.KeyMic == 1) && + (peerKeyInfo.Request == 0) && + (peerKeyInfo.Error == 0)) + { + // Process 1. the message 3 of 4-way HS in WPA2 + // EAPOL-Key(1,1,1,1,P,0,KeyRSC,ANonce,MIC,DataKD_M3) + // 2. the message 1 of group KS in WPA or WPA2 + // EAPOL-Key(1,1,1,0,G,0,Key RSC,0, MIC,GTK[N]) + if (peerKeyInfo.KeyType == PAIRWISEKEY) + PeerPairMsg3Action(pAd, pEntry, Elem); + else + PeerGroupMsg1Action(pAd, pEntry, Elem); + } + } + else + { + // The frame is snet by Supplicant. + // So the Authenticator side shall handle this. + if ((peerKeyInfo.Request == 0) && + (peerKeyInfo.Error == 0) && + (peerKeyInfo.KeyMic == 1)) + { + if (peerKeyInfo.Secure == 0 && peerKeyInfo.KeyType == PAIRWISEKEY) + { + // EAPOL-Key(0,1,0,0,P,0,0,SNonce,MIC,Data) + // Process 1. message 2 of 4-way HS in WPA or WPA2 + // 2. message 4 of 4-way HS in WPA + if (CONV_ARRARY_TO_UINT16(pEapol_packet->KeyDesc.KeyDataLen) == 0) + { + PeerPairMsg4Action(pAd, pEntry, Elem); + } + else + { + PeerPairMsg2Action(pAd, pEntry, Elem); + } + } + else if (peerKeyInfo.Secure == 1 && peerKeyInfo.KeyType == PAIRWISEKEY) + { + // EAPOL-Key(1,1,0,0,P,0,0,0,MIC,0) + // Process message 4 of 4-way HS in WPA2 + PeerPairMsg4Action(pAd, pEntry, Elem); + } + else if (peerKeyInfo.Secure == 1 && peerKeyInfo.KeyType == GROUPKEY) + { + // EAPOL-Key(1,1,0,0,G,0,0,0,MIC,0) + // Process message 2 of Group key HS in WPA or WPA2 + PeerGroupMsg2Action(pAd, pEntry, &Elem->Msg[LENGTH_802_11], (Elem->MsgLen - LENGTH_802_11)); + } + } + } + } + }while(FALSE); +} + +/* + ======================================================================== + + Routine Description: + Copy frame from waiting queue into relative ring buffer and set + appropriate ASIC register to kick hardware encryption before really + sent out to air. Arguments: - UCHAR *key, - the key material for HMAC_SHA1 use - INT key_len - the length of key - UCHAR *prefix - a prefix label - INT prefix_len - the length of the label - UCHAR *data - a specific data with variable length - INT data_len - the length of a specific data - INT len - the output lenght + pAd Pointer to our adapter + PNDIS_PACKET Pointer to outgoing Ndis frame + NumberOfFrag Number of fragment required Return Value: - UCHAR *output - the calculated result + None Note: - 802.11i-2004 Annex H.3 ======================================================================== */ -VOID PRF( - IN UCHAR *key, - IN INT key_len, - IN UCHAR *prefix, - IN INT prefix_len, - IN UCHAR *data, - IN INT data_len, - OUT UCHAR *output, - IN INT len) +VOID RTMPToWirelessSta( + IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, + IN PUCHAR pHeader802_3, + IN UINT HdrLen, + IN PUCHAR pData, + IN UINT DataLen, + IN BOOLEAN bClearFrame) { - INT i; - UCHAR *input; - INT currentindex = 0; - INT total_len; + PNDIS_PACKET pPacket; + NDIS_STATUS Status; - // Allocate memory for input - os_alloc_mem(NULL, (PUCHAR *)&input, 1024); + if ((!pEntry) || ((!pEntry->ValidAsCLI) && (!pEntry->ValidAsApCli))) + return; - if (input == NULL) + do { + // build a NDIS packet + Status = RTMPAllocateNdisPacket(pAd, &pPacket, pHeader802_3, HdrLen, pData, DataLen); + if (Status != NDIS_STATUS_SUCCESS) + break; + + + if (bClearFrame) + RTMP_SET_PACKET_CLEAR_EAP_FRAME(pPacket, 1); + else + RTMP_SET_PACKET_CLEAR_EAP_FRAME(pPacket, 0); + { + RTMP_SET_PACKET_SOURCE(pPacket, PKTSRC_NDIS); + + RTMP_SET_PACKET_NET_DEVICE_MBSSID(pPacket, MAIN_MBSSID); // set a default value + if(pEntry->apidx != 0) + RTMP_SET_PACKET_NET_DEVICE_MBSSID(pPacket, pEntry->apidx); + + RTMP_SET_PACKET_WCID(pPacket, (UCHAR)pEntry->Aid); + RTMP_SET_PACKET_MOREDATA(pPacket, FALSE); + } + + { + // send out the packet + Status = STASendPacket(pAd, pPacket); + if (Status == NDIS_STATUS_SUCCESS) + { + UCHAR Index; + + // Dequeue one frame from TxSwQueue0..3 queue and process it + // There are three place calling dequeue for TX ring. + // 1. Here, right after queueing the frame. + // 2. At the end of TxRingTxDone service routine. + // 3. Upon NDIS call RTMPSendPackets + if((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS))) + { + for(Index = 0; Index < 5; Index ++) + if(pAd->TxSwQueue[Index].Number > 0) + RTMPDeQueuePacket(pAd, FALSE, Index, MAX_TX_PROCESS); + } + } + } + + } while (FALSE); +} + +/* + ========================================================================== + Description: + This is a function to initilize 4-way handshake + + Return: + + ========================================================================== +*/ +VOID WPAStart4WayHS( + IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY *pEntry, + IN ULONG TimeInterval) +{ + UCHAR Header802_3[14]; + EAPOL_PACKET EAPOLPKT; + PUINT8 pBssid = NULL; + UCHAR group_cipher = Ndis802_11WEPDisabled; + + DBGPRINT(RT_DEBUG_TRACE, ("===> WPAStart4WayHS\n")); + + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_HALT_IN_PROGRESS)) + { + DBGPRINT(RT_DEBUG_ERROR, ("[ERROR]WPAStart4WayHS : The interface is closed...\n")); + return; + } + + + if (pBssid == NULL) + { + DBGPRINT(RT_DEBUG_ERROR, ("[ERROR]WPAStart4WayHS : No corresponding Authenticator.\n")); + return; + } + + // Check the status + if ((pEntry->WpaState > AS_PTKSTART) || (pEntry->WpaState < AS_INITPMK)) { - DBGPRINT(RT_DEBUG_ERROR, ("!!!PRF: no memory!!!\n")); + DBGPRINT(RT_DEBUG_ERROR, ("[ERROR]WPAStart4WayHS : Not expect calling\n")); return; } - // Generate concatenation input - NdisMoveMemory(input, prefix, prefix_len); - // Concatenate a single octet containing 0 - input[prefix_len] = 0; + // Increment replay counter by 1 + ADD_ONE_To_64BIT_VAR(pEntry->R_Counter); - // Concatenate specific data - NdisMoveMemory(&input[prefix_len + 1], data, data_len); - total_len = prefix_len + 1 + data_len; + // Randomly generate ANonce + GenRandom(pAd, (UCHAR *)pBssid, pEntry->ANonce); - // Concatenate a single octet containing 0 - // This octet shall be update later - input[total_len] = 0; - total_len++; + // Construct EAPoL message - Pairwise Msg 1 + // EAPOL-Key(0,0,1,0,P,0,0,ANonce,0,DataKD_M1) + NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); + ConstructEapolMsg(pEntry, + group_cipher, + EAPOL_PAIR_MSG_1, + 0, // Default key index + pEntry->ANonce, + NULL, // TxRSC + NULL, // GTK + NULL, // RSNIE + 0, // RSNIE length + &EAPOLPKT); - // Iterate to calculate the result by hmac-sha-1 - // Then concatenate to last result - for (i = 0; i < (len + 19) / 20; i++) - { - HMAC_SHA1(input, total_len, key, key_len, &output[currentindex]); - currentindex += 20; - // update the last octet - input[total_len - 1]++; - } - os_free_mem(NULL, input); + // Make outgoing frame + MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pBssid, EAPOL); + RTMPToWirelessSta(pAd, pEntry, Header802_3, + LENGTH_802_3, (PUCHAR)&EAPOLPKT, + CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, + (pEntry->PortSecured == WPA_802_1X_PORT_SECURED) ? FALSE : TRUE); + + // Trigger Retry Timer + RTMPModTimer(&pEntry->RetryTimer, TimeInterval); + + // Update State + pEntry->WpaState = AS_PTKSTART; + + DBGPRINT(RT_DEBUG_TRACE, ("<=== WPAStart4WayHS: send Msg1 of 4-way \n")); + } /* ======================================================================== Routine Description: - It utilizes PRF-384 or PRF-512 to derive session-specific keys from a PMK. - It shall be called by 4-way handshake processing. + Process Pairwise key Msg-1 of 4-way handshaking and send Msg-2 Arguments: - pAd - pointer to our pAdapter context - PMK - pointer to PMK - ANonce - pointer to ANonce - AA - pointer to Authenticator Address - SNonce - pointer to SNonce - SA - pointer to Supplicant Address - len - indicate the length of PTK (octet) + pAd Pointer to our adapter + Elem Message body Return Value: - Output pointer to the PTK + None Note: - Refer to IEEE 802.11i-2004 8.5.1.2 ======================================================================== */ -VOID WpaCountPTK( - IN PRTMP_ADAPTER pAd, - IN UCHAR *PMK, - IN UCHAR *ANonce, - IN UCHAR *AA, - IN UCHAR *SNonce, - IN UCHAR *SA, - OUT UCHAR *output, - IN UINT len) +VOID PeerPairMsg1Action( + IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY *pEntry, + IN MLME_QUEUE_ELEM *Elem) { - UCHAR concatenation[76]; - UINT CurrPos = 0; - UCHAR temp[32]; - UCHAR Prefix[] = {'P', 'a', 'i', 'r', 'w', 'i', 's', 'e', ' ', 'k', 'e', 'y', ' ', - 'e', 'x', 'p', 'a', 'n', 's', 'i', 'o', 'n'}; + UCHAR PTK[80]; + UCHAR Header802_3[14]; + PEAPOL_PACKET pMsg1; + UINT MsgLen; + EAPOL_PACKET EAPOLPKT; + PUINT8 pCurrentAddr = NULL; + PUINT8 pmk_ptr = NULL; + UCHAR group_cipher = Ndis802_11WEPDisabled; + PUINT8 rsnie_ptr = NULL; + UCHAR rsnie_len = 0; + + DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg1Action \n")); + + if ((!pEntry) || ((!pEntry->ValidAsCLI) && (!pEntry->ValidAsApCli))) + return; - // initiate the concatenation input - NdisZeroMemory(temp, sizeof(temp)); - NdisZeroMemory(concatenation, 76); + if (Elem->MsgLen < (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) + return; - // Get smaller address - if (RTMPCompareMemory(SA, AA, 6) == 1) - NdisMoveMemory(concatenation, AA, 6); - else - NdisMoveMemory(concatenation, SA, 6); - CurrPos += 6; + { + pCurrentAddr = pAd->CurrentAddress; + pmk_ptr = pAd->StaCfg.PMK; + group_cipher = pAd->StaCfg.GroupCipher; + rsnie_ptr = pAd->StaCfg.RSN_IE; + rsnie_len = pAd->StaCfg.RSNIE_Len; + } - // Get larger address - if (RTMPCompareMemory(SA, AA, 6) == 1) - NdisMoveMemory(&concatenation[CurrPos], SA, 6); - else - NdisMoveMemory(&concatenation[CurrPos], AA, 6); + // Store the received frame + pMsg1 = (PEAPOL_PACKET) &Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; + MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; - // store the larger mac address for backward compatible of - // ralink proprietary STA-key issue - NdisMoveMemory(temp, &concatenation[CurrPos], MAC_ADDR_LEN); - CurrPos += 6; + // Sanity Check peer Pairwise message 1 - Replay Counter + if (PeerWpaMessageSanity(pAd, pMsg1, MsgLen, EAPOL_PAIR_MSG_1, pEntry) == FALSE) + return; - // Get smaller Nonce - if (RTMPCompareMemory(ANonce, SNonce, 32) == 0) - NdisMoveMemory(&concatenation[CurrPos], temp, 32); // patch for ralink proprietary STA-key issue - else if (RTMPCompareMemory(ANonce, SNonce, 32) == 1) - NdisMoveMemory(&concatenation[CurrPos], SNonce, 32); + // Store Replay counter, it will use to verify message 3 and construct message 2 + NdisMoveMemory(pEntry->R_Counter, pMsg1->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); + + // Store ANonce + NdisMoveMemory(pEntry->ANonce, pMsg1->KeyDesc.KeyNonce, LEN_KEY_DESC_NONCE); + + // Generate random SNonce + GenRandom(pAd, (UCHAR *)pCurrentAddr, pEntry->SNonce); + + { + // Calculate PTK(ANonce, SNonce) + WpaDerivePTK(pAd, + pmk_ptr, + pEntry->ANonce, + pEntry->Addr, + pEntry->SNonce, + pCurrentAddr, + PTK, + LEN_PTK); + + // Save key to PTK entry + NdisMoveMemory(pEntry->PTK, PTK, LEN_PTK); + } + + // Update WpaState + pEntry->WpaState = AS_PTKINIT_NEGOTIATING; + + // Construct EAPoL message - Pairwise Msg 2 + // EAPOL-Key(0,1,0,0,P,0,0,SNonce,MIC,DataKD_M2) + NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); + ConstructEapolMsg(pEntry, + group_cipher, + EAPOL_PAIR_MSG_2, + 0, // DefaultKeyIdx + pEntry->SNonce, + NULL, // TxRsc + NULL, // GTK + (UCHAR *)rsnie_ptr, + rsnie_len, + &EAPOLPKT); + + // Make outgoing frame + MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pCurrentAddr, EAPOL); + + RTMPToWirelessSta(pAd, pEntry, + Header802_3, sizeof(Header802_3), (PUCHAR)&EAPOLPKT, + CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, TRUE); + + DBGPRINT(RT_DEBUG_TRACE, ("<=== PeerPairMsg1Action: send Msg2 of 4-way \n")); +} + + +/* + ========================================================================== + Description: + When receiving the second packet of 4-way pairwisekey handshake. + Return: + ========================================================================== +*/ +VOID PeerPairMsg2Action( + IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY *pEntry, + IN MLME_QUEUE_ELEM *Elem) +{ + UCHAR PTK[80]; + BOOLEAN Cancelled; + PHEADER_802_11 pHeader; + EAPOL_PACKET EAPOLPKT; + PEAPOL_PACKET pMsg2; + UINT MsgLen; + UCHAR Header802_3[LENGTH_802_3]; + UCHAR TxTsc[6]; + PUINT8 pBssid = NULL; + PUINT8 pmk_ptr = NULL; + PUINT8 gtk_ptr = NULL; + UCHAR default_key = 0; + UCHAR group_cipher = Ndis802_11WEPDisabled; + PUINT8 rsnie_ptr = NULL; + UCHAR rsnie_len = 0; + + DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg2Action \n")); + + if ((!pEntry) || (!pEntry->ValidAsCLI)) + return; + + if (Elem->MsgLen < (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) + return; + + // check Entry in valid State + if (pEntry->WpaState < AS_PTKSTART) + return; + + + + // pointer to 802.11 header + pHeader = (PHEADER_802_11)Elem->Msg; + + // skip 802.11_header(24-byte) and LLC_header(8) + pMsg2 = (PEAPOL_PACKET)&Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; + MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; + + // Store SNonce + NdisMoveMemory(pEntry->SNonce, pMsg2->KeyDesc.KeyNonce, LEN_KEY_DESC_NONCE); + + { + // Derive PTK + WpaDerivePTK(pAd, + (UCHAR *)pmk_ptr, + pEntry->ANonce, // ANONCE + (UCHAR *)pBssid, + pEntry->SNonce, // SNONCE + pEntry->Addr, + PTK, + LEN_PTK); + + NdisMoveMemory(pEntry->PTK, PTK, LEN_PTK); + } + + // Sanity Check peer Pairwise message 2 - Replay Counter, MIC, RSNIE + if (PeerWpaMessageSanity(pAd, pMsg2, MsgLen, EAPOL_PAIR_MSG_2, pEntry) == FALSE) + return; + + do + { + // delete retry timer + RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); + + // Change state + pEntry->WpaState = AS_PTKINIT_NEGOTIATING; + + // Increment replay counter by 1 + ADD_ONE_To_64BIT_VAR(pEntry->R_Counter); + + // Construct EAPoL message - Pairwise Msg 3 + NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); + ConstructEapolMsg(pEntry, + group_cipher, + EAPOL_PAIR_MSG_3, + default_key, + pEntry->ANonce, + TxTsc, + (UCHAR *)gtk_ptr, + (UCHAR *)rsnie_ptr, + rsnie_len, + &EAPOLPKT); + + // Make outgoing frame + MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pBssid, EAPOL); + RTMPToWirelessSta(pAd, pEntry, Header802_3, LENGTH_802_3, + (PUCHAR)&EAPOLPKT, + CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, + (pEntry->PortSecured == WPA_802_1X_PORT_SECURED) ? FALSE : TRUE); + + pEntry->ReTryCounter = PEER_MSG3_RETRY_TIMER_CTR; + RTMPSetTimer(&pEntry->RetryTimer, PEER_MSG3_RETRY_EXEC_INTV); + + // Update State + pEntry->WpaState = AS_PTKINIT_NEGOTIATING; + }while(FALSE); + + DBGPRINT(RT_DEBUG_TRACE, ("<=== PeerPairMsg2Action: send Msg3 of 4-way \n")); +} + +/* + ======================================================================== + + Routine Description: + Process Pairwise key Msg 3 of 4-way handshaking and send Msg 4 + + Arguments: + pAd Pointer to our adapter + Elem Message body + + Return Value: + None + + Note: + + ======================================================================== +*/ +VOID PeerPairMsg3Action( + IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY *pEntry, + IN MLME_QUEUE_ELEM *Elem) +{ + PHEADER_802_11 pHeader; + UCHAR Header802_3[14]; + EAPOL_PACKET EAPOLPKT; + PEAPOL_PACKET pMsg3; + UINT MsgLen; + PUINT8 pCurrentAddr = NULL; + UCHAR group_cipher = Ndis802_11WEPDisabled; + + DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg3Action \n")); + + if ((!pEntry) || ((!pEntry->ValidAsCLI) && (!pEntry->ValidAsApCli))) + return; + + if (Elem->MsgLen < (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) + return; + + { + pCurrentAddr = pAd->CurrentAddress; + group_cipher = pAd->StaCfg.GroupCipher; + + } + + // Record 802.11 header & the received EAPOL packet Msg3 + pHeader = (PHEADER_802_11) Elem->Msg; + pMsg3 = (PEAPOL_PACKET) &Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; + MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; + + // Sanity Check peer Pairwise message 3 - Replay Counter, MIC, RSNIE + if (PeerWpaMessageSanity(pAd, pMsg3, MsgLen, EAPOL_PAIR_MSG_3, pEntry) == FALSE) + return; + + // Save Replay counter, it will use construct message 4 + NdisMoveMemory(pEntry->R_Counter, pMsg3->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); + + // Double check ANonce + if (!NdisEqualMemory(pEntry->ANonce, pMsg3->KeyDesc.KeyNonce, LEN_KEY_DESC_NONCE)) + { + return; + } + + // Construct EAPoL message - Pairwise Msg 4 + NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); + ConstructEapolMsg(pEntry, + group_cipher, + EAPOL_PAIR_MSG_4, + 0, // group key index not used in message 4 + NULL, // Nonce not used in message 4 + NULL, // TxRSC not used in message 4 + NULL, // GTK not used in message 4 + NULL, // RSN IE not used in message 4 + 0, + &EAPOLPKT); + + // Update WpaState + pEntry->WpaState = AS_PTKINITDONE; + + // Update pairwise key + { + PCIPHER_KEY pSharedKey; + + pSharedKey = &pAd->SharedKey[BSS0][0]; + + NdisMoveMemory(pAd->StaCfg.PTK, pEntry->PTK, LEN_PTK); + + // Prepare pair-wise key information into shared key table + NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); + pSharedKey->KeyLen = LEN_TKIP_EK; + NdisMoveMemory(pSharedKey->Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); + NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_RXMICK); + NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); + + // Decide its ChiperAlg + if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) + pSharedKey->CipherAlg = CIPHER_TKIP; + else if (pAd->StaCfg.PairCipher == Ndis802_11Encryption3Enabled) + pSharedKey->CipherAlg = CIPHER_AES; + else + pSharedKey->CipherAlg = CIPHER_NONE; + + // Update these related information to MAC_TABLE_ENTRY + pEntry = &pAd->MacTab.Content[BSSID_WCID]; + NdisMoveMemory(pEntry->PairwiseKey.Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); + NdisMoveMemory(pEntry->PairwiseKey.RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_RXMICK); + NdisMoveMemory(pEntry->PairwiseKey.TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); + pEntry->PairwiseKey.CipherAlg = pSharedKey->CipherAlg; + + // Update pairwise key information to ASIC Shared Key Table + AsicAddSharedKeyEntry(pAd, + BSS0, + 0, + pSharedKey->CipherAlg, + pSharedKey->Key, + pSharedKey->TxMic, + pSharedKey->RxMic); + + // Update ASIC WCID attribute table and IVEIV table + RTMPAddWcidAttributeEntry(pAd, + BSS0, + 0, + pSharedKey->CipherAlg, + pEntry); + + } + + // open 802.1x port control and privacy filter + if (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK || + pEntry->AuthMode == Ndis802_11AuthModeWPA2) + { + pEntry->PortSecured = WPA_802_1X_PORT_SECURED; + pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; + + STA_PORT_SECURED(pAd); + // Indicate Connected for GUI + pAd->IndicateMediaState = NdisMediaStateConnected; + DBGPRINT(RT_DEBUG_TRACE, ("PeerPairMsg3Action: AuthMode(%s) PairwiseCipher(%s) GroupCipher(%s) \n", + GetAuthMode(pEntry->AuthMode), + GetEncryptType(pEntry->WepStatus), + GetEncryptType(group_cipher))); + } + else + { + } + + // Init 802.3 header and send out + MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pCurrentAddr, EAPOL); + RTMPToWirelessSta(pAd, pEntry, + Header802_3, sizeof(Header802_3), + (PUCHAR)&EAPOLPKT, + CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, TRUE); + + DBGPRINT(RT_DEBUG_TRACE, ("<=== PeerPairMsg3Action: send Msg4 of 4-way \n")); +} + +/* + ========================================================================== + Description: + When receiving the last packet of 4-way pairwisekey handshake. + Initilize 2-way groupkey handshake following. + Return: + ========================================================================== +*/ +VOID PeerPairMsg4Action( + IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY *pEntry, + IN MLME_QUEUE_ELEM *Elem) +{ + PEAPOL_PACKET pMsg4; + PHEADER_802_11 pHeader; + UINT MsgLen; + BOOLEAN Cancelled; + UCHAR group_cipher = Ndis802_11WEPDisabled; + + DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg4Action\n")); + + do + { + if ((!pEntry) || (!pEntry->ValidAsCLI)) + break; + + if (Elem->MsgLen < (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2 ) ) + break; + + if (pEntry->WpaState < AS_PTKINIT_NEGOTIATING) + break; + + + // pointer to 802.11 header + pHeader = (PHEADER_802_11)Elem->Msg; + + // skip 802.11_header(24-byte) and LLC_header(8) + pMsg4 = (PEAPOL_PACKET)&Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; + MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; + + // Sanity Check peer Pairwise message 4 - Replay Counter, MIC + if (PeerWpaMessageSanity(pAd, pMsg4, MsgLen, EAPOL_PAIR_MSG_4, pEntry) == FALSE) + break; + + // 3. uses the MLME.SETKEYS.request to configure PTK into MAC + NdisZeroMemory(&pEntry->PairwiseKey, sizeof(CIPHER_KEY)); + + // reset IVEIV in Asic + AsicUpdateWCIDIVEIV(pAd, pEntry->Aid, 1, 0); + + pEntry->PairwiseKey.KeyLen = LEN_TKIP_EK; + NdisMoveMemory(pEntry->PairwiseKey.Key, &pEntry->PTK[32], LEN_TKIP_EK); + NdisMoveMemory(pEntry->PairwiseKey.RxMic, &pEntry->PTK[TKIP_AP_RXMICK_OFFSET], LEN_TKIP_RXMICK); + NdisMoveMemory(pEntry->PairwiseKey.TxMic, &pEntry->PTK[TKIP_AP_TXMICK_OFFSET], LEN_TKIP_TXMICK); + + // Set pairwise key to Asic + { + pEntry->PairwiseKey.CipherAlg = CIPHER_NONE; + if (pEntry->WepStatus == Ndis802_11Encryption2Enabled) + pEntry->PairwiseKey.CipherAlg = CIPHER_TKIP; + else if (pEntry->WepStatus == Ndis802_11Encryption3Enabled) + pEntry->PairwiseKey.CipherAlg = CIPHER_AES; + + // Add Pair-wise key to Asic + AsicAddPairwiseKeyEntry( + pAd, + pEntry->Addr, + (UCHAR)pEntry->Aid, + &pEntry->PairwiseKey); + + // update WCID attribute table and IVEIV table for this entry + RTMPAddWcidAttributeEntry( + pAd, + pEntry->apidx, + 0, + pEntry->PairwiseKey.CipherAlg, + pEntry); + } + + // 4. upgrade state + pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; + pEntry->WpaState = AS_PTKINITDONE; + pEntry->PortSecured = WPA_802_1X_PORT_SECURED; + + + if (pEntry->AuthMode == Ndis802_11AuthModeWPA2 || + pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK) + { + pEntry->GTKState = REKEY_ESTABLISHED; + RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); + + + // send wireless event - for set key done WPA2 + if (pAd->CommonCfg.bWirelessEvent) + RTMPSendWirelessEvent(pAd, IW_SET_KEY_DONE_WPA2_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); + + DBGPRINT(RT_DEBUG_OFF, ("AP SETKEYS DONE - WPA2, AuthMode(%d)=%s, WepStatus(%d)=%s, GroupWepStatus(%d)=%s\n\n", + pEntry->AuthMode, GetAuthMode(pEntry->AuthMode), + pEntry->WepStatus, GetEncryptType(pEntry->WepStatus), + group_cipher, + GetEncryptType(group_cipher))); + } + else + { + // 5. init Group 2-way handshake if necessary. + WPAStart2WayGroupHS(pAd, pEntry); + + pEntry->ReTryCounter = GROUP_MSG1_RETRY_TIMER_CTR; + RTMPModTimer(&pEntry->RetryTimer, PEER_MSG3_RETRY_EXEC_INTV); + } + }while(FALSE); + +} + +/* + ========================================================================== + Description: + This is a function to send the first packet of 2-way groupkey handshake + Return: + + ========================================================================== +*/ +VOID WPAStart2WayGroupHS( + IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY *pEntry) +{ + UCHAR Header802_3[14]; + UCHAR TxTsc[6]; + EAPOL_PACKET EAPOLPKT; + UCHAR group_cipher = Ndis802_11WEPDisabled; + UCHAR default_key = 0; + PUINT8 gnonce_ptr = NULL; + PUINT8 gtk_ptr = NULL; + PUINT8 pBssid = NULL; + + DBGPRINT(RT_DEBUG_TRACE, ("===> WPAStart2WayGroupHS\n")); + + if ((!pEntry) || (!pEntry->ValidAsCLI)) + return; + + + do + { + // Increment replay counter by 1 + ADD_ONE_To_64BIT_VAR(pEntry->R_Counter); + + // Construct EAPoL message - Group Msg 1 + NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); + ConstructEapolMsg(pEntry, + group_cipher, + EAPOL_GROUP_MSG_1, + default_key, + (UCHAR *)gnonce_ptr, + TxTsc, + (UCHAR *)gtk_ptr, + NULL, + 0, + &EAPOLPKT); + + // Make outgoing frame + MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pBssid, EAPOL); + RTMPToWirelessSta(pAd, pEntry, + Header802_3, LENGTH_802_3, + (PUCHAR)&EAPOLPKT, + CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, FALSE); + + + + }while (FALSE); + + DBGPRINT(RT_DEBUG_TRACE, ("<=== WPAStart2WayGroupHS : send out Group Message 1 \n")); + + return; +} + +/* + ======================================================================== + + Routine Description: + Process Group key 2-way handshaking + + Arguments: + pAd Pointer to our adapter + Elem Message body + + Return Value: + None + + Note: + + ======================================================================== +*/ +VOID PeerGroupMsg1Action( + IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY *pEntry, + IN MLME_QUEUE_ELEM *Elem) +{ + UCHAR Header802_3[14]; + EAPOL_PACKET EAPOLPKT; + PEAPOL_PACKET pGroup; + UINT MsgLen; + BOOLEAN Cancelled; + UCHAR default_key = 0; + UCHAR group_cipher = Ndis802_11WEPDisabled; + PUINT8 pCurrentAddr = NULL; + + DBGPRINT(RT_DEBUG_TRACE, ("===> PeerGroupMsg1Action \n")); + + if ((!pEntry) || ((!pEntry->ValidAsCLI) && (!pEntry->ValidAsApCli))) + return; + + { + pCurrentAddr = pAd->CurrentAddress; + group_cipher = pAd->StaCfg.GroupCipher; + default_key = pAd->StaCfg.DefaultKeyId; + } + + // Process Group Message 1 frame. skip 802.11 header(24) & LLC_SNAP header(8) + pGroup = (PEAPOL_PACKET) &Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; + MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; + + // Sanity Check peer group message 1 - Replay Counter, MIC, RSNIE + if (PeerWpaMessageSanity(pAd, pGroup, MsgLen, EAPOL_GROUP_MSG_1, pEntry) == FALSE) + return; + + // delete retry timer + RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); + + // Save Replay counter, it will use to construct message 2 + NdisMoveMemory(pEntry->R_Counter, pGroup->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); + + // Construct EAPoL message - Group Msg 2 + NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); + ConstructEapolMsg(pEntry, + group_cipher, + EAPOL_GROUP_MSG_2, + default_key, + NULL, // Nonce not used + NULL, // TxRSC not used + NULL, // GTK not used + NULL, // RSN IE not used + 0, + &EAPOLPKT); + + // open 802.1x port control and privacy filter + pEntry->PortSecured = WPA_802_1X_PORT_SECURED; + pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; + + STA_PORT_SECURED(pAd); + // Indicate Connected for GUI + pAd->IndicateMediaState = NdisMediaStateConnected; + + DBGPRINT(RT_DEBUG_TRACE, ("PeerGroupMsg1Action: AuthMode(%s) PairwiseCipher(%s) GroupCipher(%s) \n", + GetAuthMode(pEntry->AuthMode), + GetEncryptType(pEntry->WepStatus), + GetEncryptType(group_cipher))); + + // init header and Fill Packet and send Msg 2 to authenticator + MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pCurrentAddr, EAPOL); + RTMPToWirelessSta(pAd, pEntry, + Header802_3, sizeof(Header802_3), + (PUCHAR)&EAPOLPKT, + CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, FALSE); + + DBGPRINT(RT_DEBUG_TRACE, ("<=== PeerGroupMsg1Action: sned group message 2\n")); +} + +/* + ========================================================================== + Description: + When receiving the last packet of 2-way groupkey handshake. + Return: + ========================================================================== +*/ +VOID PeerGroupMsg2Action( + IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY *pEntry, + IN VOID *Msg, + IN UINT MsgLen) +{ + UINT Len; + PUCHAR pData; + BOOLEAN Cancelled; + PEAPOL_PACKET pMsg2; + UCHAR group_cipher = Ndis802_11WEPDisabled; + + DBGPRINT(RT_DEBUG_TRACE, ("===> PeerGroupMsg2Action \n")); + + do + { + if ((!pEntry) || (!pEntry->ValidAsCLI)) + break; + + if (MsgLen < (LENGTH_802_1_H + LENGTH_EAPOL_H + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) + break; + + if (pEntry->WpaState != AS_PTKINITDONE) + break; + + + pData = (PUCHAR)Msg; + pMsg2 = (PEAPOL_PACKET) (pData + LENGTH_802_1_H); + Len = MsgLen - LENGTH_802_1_H; + + // Sanity Check peer group message 2 - Replay Counter, MIC + if (PeerWpaMessageSanity(pAd, pMsg2, Len, EAPOL_GROUP_MSG_2, pEntry) == FALSE) + break; + + // 3. upgrade state + + RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); + pEntry->GTKState = REKEY_ESTABLISHED; + + if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) || (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) + { + // send wireless event - for set key done WPA2 + if (pAd->CommonCfg.bWirelessEvent) + RTMPSendWirelessEvent(pAd, IW_SET_KEY_DONE_WPA2_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); + + DBGPRINT(RT_DEBUG_OFF, ("AP SETKEYS DONE - WPA2, AuthMode(%d)=%s, WepStatus(%d)=%s, GroupWepStatus(%d)=%s\n\n", + pEntry->AuthMode, GetAuthMode(pEntry->AuthMode), + pEntry->WepStatus, GetEncryptType(pEntry->WepStatus), + group_cipher, GetEncryptType(group_cipher))); + } + else + { + // send wireless event - for set key done WPA + if (pAd->CommonCfg.bWirelessEvent) + RTMPSendWirelessEvent(pAd, IW_SET_KEY_DONE_WPA1_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); + + DBGPRINT(RT_DEBUG_OFF, ("AP SETKEYS DONE - WPA1, AuthMode(%d)=%s, WepStatus(%d)=%s, GroupWepStatus(%d)=%s\n\n", + pEntry->AuthMode, GetAuthMode(pEntry->AuthMode), + pEntry->WepStatus, GetEncryptType(pEntry->WepStatus), + group_cipher, GetEncryptType(group_cipher))); + } + }while(FALSE); +} + +/* + ======================================================================== + + Routine Description: + Classify WPA EAP message type + + Arguments: + EAPType Value of EAP message type + MsgType Internal Message definition for MLME state machine + + Return Value: + TRUE Found appropriate message type + FALSE No appropriate message type + + IRQL = DISPATCH_LEVEL + + Note: + All these constants are defined in wpa.h + For supplicant, there is only EAPOL Key message avaliable + + ======================================================================== +*/ +BOOLEAN WpaMsgTypeSubst( + IN UCHAR EAPType, + OUT INT *MsgType) +{ + switch (EAPType) + { + case EAPPacket: + *MsgType = MT2_EAPPacket; + break; + case EAPOLStart: + *MsgType = MT2_EAPOLStart; + break; + case EAPOLLogoff: + *MsgType = MT2_EAPOLLogoff; + break; + case EAPOLKey: + *MsgType = MT2_EAPOLKey; + break; + case EAPOLASFAlert: + *MsgType = MT2_EAPOLASFAlert; + break; + default: + return FALSE; + } + return TRUE; +} + +/* + ======================================================================== + + Routine Description: + The pseudo-random function(PRF) that hashes various inputs to + derive a pseudo-random value. To add liveness to the pseudo-random + value, a nonce should be one of the inputs. + + It is used to generate PTK, GTK or some specific random value. + + Arguments: + UCHAR *key, - the key material for HMAC_SHA1 use + INT key_len - the length of key + UCHAR *prefix - a prefix label + INT prefix_len - the length of the label + UCHAR *data - a specific data with variable length + INT data_len - the length of a specific data + INT len - the output lenght + + Return Value: + UCHAR *output - the calculated result + + Note: + 802.11i-2004 Annex H.3 + + ======================================================================== +*/ +VOID PRF( + IN UCHAR *key, + IN INT key_len, + IN UCHAR *prefix, + IN INT prefix_len, + IN UCHAR *data, + IN INT data_len, + OUT UCHAR *output, + IN INT len) +{ + INT i; + UCHAR *input; + INT currentindex = 0; + INT total_len; + + // Allocate memory for input + os_alloc_mem(NULL, (PUCHAR *)&input, 1024); + + if (input == NULL) + { + DBGPRINT(RT_DEBUG_ERROR, ("!!!PRF: no memory!!!\n")); + return; + } + + // Generate concatenation input + NdisMoveMemory(input, prefix, prefix_len); + + // Concatenate a single octet containing 0 + input[prefix_len] = 0; + + // Concatenate specific data + NdisMoveMemory(&input[prefix_len + 1], data, data_len); + total_len = prefix_len + 1 + data_len; + + // Concatenate a single octet containing 0 + // This octet shall be update later + input[total_len] = 0; + total_len++; + + // Iterate to calculate the result by hmac-sha-1 + // Then concatenate to last result + for (i = 0; i < (len + 19) / 20; i++) + { + HMAC_SHA1(key, key_len, input, total_len, &output[currentindex], SHA1_DIGEST_SIZE); + currentindex += 20; + + // update the last octet + input[total_len - 1]++; + } + os_free_mem(NULL, input); +} + +/* +* F(P, S, c, i) = U1 xor U2 xor ... Uc +* U1 = PRF(P, S || Int(i)) +* U2 = PRF(P, U1) +* Uc = PRF(P, Uc-1) +*/ + +static void F(char *password, unsigned char *ssid, int ssidlength, int iterations, int count, unsigned char *output) +{ + unsigned char digest[36], digest1[SHA1_DIGEST_SIZE]; + int i, j; + + /* U1 = PRF(P, S || int(i)) */ + memcpy(digest, ssid, ssidlength); + digest[ssidlength] = (unsigned char)((count>>24) & 0xff); + digest[ssidlength+1] = (unsigned char)((count>>16) & 0xff); + digest[ssidlength+2] = (unsigned char)((count>>8) & 0xff); + digest[ssidlength+3] = (unsigned char)(count & 0xff); + HMAC_SHA1((unsigned char*) password, (int) strlen(password), digest, ssidlength+4, digest1, SHA1_DIGEST_SIZE); // for WPA update + + /* output = U1 */ + memcpy(output, digest1, SHA1_DIGEST_SIZE); + + for (i = 1; i < iterations; i++) + { + /* Un = PRF(P, Un-1) */ + HMAC_SHA1((unsigned char*) password, (int) strlen(password), digest1, SHA1_DIGEST_SIZE, digest, SHA1_DIGEST_SIZE); // for WPA update + memcpy(digest1, digest, SHA1_DIGEST_SIZE); + + /* output = output xor Un */ + for (j = 0; j < SHA1_DIGEST_SIZE; j++) + { + output[j] ^= digest[j]; + } + } +} + +/* +* password - ascii string up to 63 characters in length +* ssid - octet string up to 32 octets +* ssidlength - length of ssid in octets +* output must be 40 octets in length and outputs 256 bits of key +*/ +int PasswordHash(PSTRING password, PUCHAR ssid, INT ssidlength, PUCHAR output) +{ + if ((strlen(password) > 63) || (ssidlength > 32)) + return 0; + + F(password, ssid, ssidlength, 4096, 1, output); + F(password, ssid, ssidlength, 4096, 2, &output[SHA1_DIGEST_SIZE]); + return 1; +} + + + +/* + ======================================================================== + + Routine Description: + It utilizes PRF-384 or PRF-512 to derive session-specific keys from a PMK. + It shall be called by 4-way handshake processing. + + Arguments: + pAd - pointer to our pAdapter context + PMK - pointer to PMK + ANonce - pointer to ANonce + AA - pointer to Authenticator Address + SNonce - pointer to SNonce + SA - pointer to Supplicant Address + len - indicate the length of PTK (octet) + + Return Value: + Output pointer to the PTK + + Note: + Refer to IEEE 802.11i-2004 8.5.1.2 + + ======================================================================== +*/ +VOID WpaDerivePTK( + IN PRTMP_ADAPTER pAd, + IN UCHAR *PMK, + IN UCHAR *ANonce, + IN UCHAR *AA, + IN UCHAR *SNonce, + IN UCHAR *SA, + OUT UCHAR *output, + IN UINT len) +{ + UCHAR concatenation[76]; + UINT CurrPos = 0; + UCHAR temp[32]; + UCHAR Prefix[] = {'P', 'a', 'i', 'r', 'w', 'i', 's', 'e', ' ', 'k', 'e', 'y', ' ', + 'e', 'x', 'p', 'a', 'n', 's', 'i', 'o', 'n'}; + + // initiate the concatenation input + NdisZeroMemory(temp, sizeof(temp)); + NdisZeroMemory(concatenation, 76); + + // Get smaller address + if (RTMPCompareMemory(SA, AA, 6) == 1) + NdisMoveMemory(concatenation, AA, 6); + else + NdisMoveMemory(concatenation, SA, 6); + CurrPos += 6; + + // Get larger address + if (RTMPCompareMemory(SA, AA, 6) == 1) + NdisMoveMemory(&concatenation[CurrPos], SA, 6); + else + NdisMoveMemory(&concatenation[CurrPos], AA, 6); + + // store the larger mac address for backward compatible of + // ralink proprietary STA-key issue + NdisMoveMemory(temp, &concatenation[CurrPos], MAC_ADDR_LEN); + CurrPos += 6; + + // Get smaller Nonce + if (RTMPCompareMemory(ANonce, SNonce, 32) == 0) + NdisMoveMemory(&concatenation[CurrPos], temp, 32); // patch for ralink proprietary STA-key issue + else if (RTMPCompareMemory(ANonce, SNonce, 32) == 1) + NdisMoveMemory(&concatenation[CurrPos], SNonce, 32); + else + NdisMoveMemory(&concatenation[CurrPos], ANonce, 32); + CurrPos += 32; + + // Get larger Nonce + if (RTMPCompareMemory(ANonce, SNonce, 32) == 0) + NdisMoveMemory(&concatenation[CurrPos], temp, 32); // patch for ralink proprietary STA-key issue + else if (RTMPCompareMemory(ANonce, SNonce, 32) == 1) + NdisMoveMemory(&concatenation[CurrPos], ANonce, 32); + else + NdisMoveMemory(&concatenation[CurrPos], SNonce, 32); + CurrPos += 32; + + hex_dump("concatenation=", concatenation, 76); + + // Use PRF to generate PTK + PRF(PMK, LEN_MASTER_KEY, Prefix, 22, concatenation, 76, output, len); + +} + +/* + ======================================================================== + + Routine Description: + Generate random number by software. + + Arguments: + pAd - pointer to our pAdapter context + macAddr - pointer to local MAC address + + Return Value: + + Note: + 802.1ii-2004 Annex H.5 + + ======================================================================== +*/ +VOID GenRandom( + IN PRTMP_ADAPTER pAd, + IN UCHAR *macAddr, + OUT UCHAR *random) +{ + INT i, curr; + UCHAR local[80], KeyCounter[32]; + UCHAR result[80]; + ULONG CurrentTime; + UCHAR prefix[] = {'I', 'n', 'i', 't', ' ', 'C', 'o', 'u', 'n', 't', 'e', 'r'}; + + // Zero the related information + NdisZeroMemory(result, 80); + NdisZeroMemory(local, 80); + NdisZeroMemory(KeyCounter, 32); + + for (i = 0; i < 32; i++) + { + // copy the local MAC address + COPY_MAC_ADDR(local, macAddr); + curr = MAC_ADDR_LEN; + + // concatenate the current time + NdisGetSystemUpTime(&CurrentTime); + NdisMoveMemory(&local[curr], &CurrentTime, sizeof(CurrentTime)); + curr += sizeof(CurrentTime); + + // concatenate the last result + NdisMoveMemory(&local[curr], result, 32); + curr += 32; + + // concatenate a variable + NdisMoveMemory(&local[curr], &i, 2); + curr += 2; + + // calculate the result + PRF(KeyCounter, 32, prefix,12, local, curr, result, 32); + } + + NdisMoveMemory(random, result, 32); +} + +/* + ======================================================================== + + Routine Description: + Build cipher suite in RSN-IE. + It only shall be called by RTMPMakeRSNIE. + + Arguments: + pAd - pointer to our pAdapter context + ElementID - indicate the WPA1 or WPA2 + WepStatus - indicate the encryption type + bMixCipher - a boolean to indicate the pairwise cipher and group + cipher are the same or not + + Return Value: + + Note: + + ======================================================================== +*/ +static VOID RTMPMakeRsnIeCipher( + IN PRTMP_ADAPTER pAd, + IN UCHAR ElementID, + IN UINT WepStatus, + IN BOOLEAN bMixCipher, + IN UCHAR FlexibleCipher, + OUT PUCHAR pRsnIe, + OUT UCHAR *rsn_len) +{ + UCHAR PairwiseCnt; + + *rsn_len = 0; + + // decide WPA2 or WPA1 + if (ElementID == Wpa2Ie) + { + RSNIE2 *pRsnie_cipher = (RSNIE2*)pRsnIe; + + // Assign the verson as 1 + pRsnie_cipher->version = 1; + + switch (WepStatus) + { + // TKIP mode + case Ndis802_11Encryption2Enabled: + NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_TKIP, 4); + pRsnie_cipher->ucount = 1; + NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_TKIP, 4); + *rsn_len = sizeof(RSNIE2); + break; + + // AES mode + case Ndis802_11Encryption3Enabled: + if (bMixCipher) + NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_TKIP, 4); + else + NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_CCMP, 4); + pRsnie_cipher->ucount = 1; + NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_CCMP, 4); + *rsn_len = sizeof(RSNIE2); + break; + + // TKIP-AES mix mode + case Ndis802_11Encryption4Enabled: + NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_TKIP, 4); + + PairwiseCnt = 1; + // Insert WPA2 TKIP as the first pairwise cipher + if (MIX_CIPHER_WPA2_TKIP_ON(FlexibleCipher)) + { + NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_TKIP, 4); + // Insert WPA2 AES as the secondary pairwise cipher + if (MIX_CIPHER_WPA2_AES_ON(FlexibleCipher)) + { + NdisMoveMemory(pRsnie_cipher->ucast[0].oui + 4, OUI_WPA2_CCMP, 4); + PairwiseCnt = 2; + } + } + else + { + // Insert WPA2 AES as the first pairwise cipher + NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_CCMP, 4); + } + + pRsnie_cipher->ucount = PairwiseCnt; + *rsn_len = sizeof(RSNIE2) + (4 * (PairwiseCnt - 1)); + break; + } + + if ((pAd->OpMode == OPMODE_STA) && + (pAd->StaCfg.GroupCipher != Ndis802_11Encryption2Enabled) && + (pAd->StaCfg.GroupCipher != Ndis802_11Encryption3Enabled)) + { + UINT GroupCipher = pAd->StaCfg.GroupCipher; + switch(GroupCipher) + { + case Ndis802_11GroupWEP40Enabled: + NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_WEP40, 4); + break; + case Ndis802_11GroupWEP104Enabled: + NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_WEP104, 4); + break; + } + } + + // swap for big-endian platform + pRsnie_cipher->version = cpu2le16(pRsnie_cipher->version); + pRsnie_cipher->ucount = cpu2le16(pRsnie_cipher->ucount); + } + else + { + RSNIE *pRsnie_cipher = (RSNIE*)pRsnIe; + + // Assign OUI and version + NdisMoveMemory(pRsnie_cipher->oui, OUI_WPA_VERSION, 4); + pRsnie_cipher->version = 1; + + switch (WepStatus) + { + // TKIP mode + case Ndis802_11Encryption2Enabled: + NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_TKIP, 4); + pRsnie_cipher->ucount = 1; + NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_TKIP, 4); + *rsn_len = sizeof(RSNIE); + break; + + // AES mode + case Ndis802_11Encryption3Enabled: + if (bMixCipher) + NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_TKIP, 4); + else + NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_CCMP, 4); + pRsnie_cipher->ucount = 1; + NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_CCMP, 4); + *rsn_len = sizeof(RSNIE); + break; + + // TKIP-AES mix mode + case Ndis802_11Encryption4Enabled: + NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_TKIP, 4); + + PairwiseCnt = 1; + // Insert WPA TKIP as the first pairwise cipher + if (MIX_CIPHER_WPA_TKIP_ON(FlexibleCipher)) + { + NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_TKIP, 4); + // Insert WPA AES as the secondary pairwise cipher + if (MIX_CIPHER_WPA_AES_ON(FlexibleCipher)) + { + NdisMoveMemory(pRsnie_cipher->ucast[0].oui + 4, OUI_WPA_CCMP, 4); + PairwiseCnt = 2; + } + } + else + { + // Insert WPA AES as the first pairwise cipher + NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_CCMP, 4); + } + + pRsnie_cipher->ucount = PairwiseCnt; + *rsn_len = sizeof(RSNIE) + (4 * (PairwiseCnt - 1)); + break; + } + + if ((pAd->OpMode == OPMODE_STA) && + (pAd->StaCfg.GroupCipher != Ndis802_11Encryption2Enabled) && + (pAd->StaCfg.GroupCipher != Ndis802_11Encryption3Enabled)) + { + UINT GroupCipher = pAd->StaCfg.GroupCipher; + switch(GroupCipher) + { + case Ndis802_11GroupWEP40Enabled: + NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_WEP40, 4); + break; + case Ndis802_11GroupWEP104Enabled: + NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_WEP104, 4); + break; + } + } + + // swap for big-endian platform + pRsnie_cipher->version = cpu2le16(pRsnie_cipher->version); + pRsnie_cipher->ucount = cpu2le16(pRsnie_cipher->ucount); + } +} + +/* + ======================================================================== + + Routine Description: + Build AKM suite in RSN-IE. + It only shall be called by RTMPMakeRSNIE. + + Arguments: + pAd - pointer to our pAdapter context + ElementID - indicate the WPA1 or WPA2 + AuthMode - indicate the authentication mode + apidx - indicate the interface index + + Return Value: + + Note: + + ======================================================================== +*/ +static VOID RTMPMakeRsnIeAKM( + IN PRTMP_ADAPTER pAd, + IN UCHAR ElementID, + IN UINT AuthMode, + IN UCHAR apidx, + OUT PUCHAR pRsnIe, + OUT UCHAR *rsn_len) +{ + RSNIE_AUTH *pRsnie_auth; + UCHAR AkmCnt = 1; // default as 1 + + pRsnie_auth = (RSNIE_AUTH*)(pRsnIe + (*rsn_len)); + + // decide WPA2 or WPA1 + if (ElementID == Wpa2Ie) + { + + switch (AuthMode) + { + case Ndis802_11AuthModeWPA2: + case Ndis802_11AuthModeWPA1WPA2: + NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA2_8021X_AKM, 4); + break; + + case Ndis802_11AuthModeWPA2PSK: + case Ndis802_11AuthModeWPA1PSKWPA2PSK: + NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA2_PSK_AKM, 4); + break; + default: + AkmCnt = 0; + break; + + } + } + else + { + switch (AuthMode) + { + case Ndis802_11AuthModeWPA: + case Ndis802_11AuthModeWPA1WPA2: + NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA_8021X_AKM, 4); + break; + + case Ndis802_11AuthModeWPAPSK: + case Ndis802_11AuthModeWPA1PSKWPA2PSK: + NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA_PSK_AKM, 4); + break; + + case Ndis802_11AuthModeWPANone: + NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA_NONE_AKM, 4); + break; + default: + AkmCnt = 0; + break; + } + } + + pRsnie_auth->acount = AkmCnt; + pRsnie_auth->acount = cpu2le16(pRsnie_auth->acount); + + // update current RSNIE length + (*rsn_len) += (sizeof(RSNIE_AUTH) + (4 * (AkmCnt - 1))); + +} + +/* + ======================================================================== + + Routine Description: + Build capability in RSN-IE. + It only shall be called by RTMPMakeRSNIE. + + Arguments: + pAd - pointer to our pAdapter context + ElementID - indicate the WPA1 or WPA2 + apidx - indicate the interface index + + Return Value: + + Note: + + ======================================================================== +*/ +static VOID RTMPMakeRsnIeCap( + IN PRTMP_ADAPTER pAd, + IN UCHAR ElementID, + IN UCHAR apidx, + OUT PUCHAR pRsnIe, + OUT UCHAR *rsn_len) +{ + RSN_CAPABILITIES *pRSN_Cap; + + // it could be ignored in WPA1 mode + if (ElementID == WpaIe) + return; + + pRSN_Cap = (RSN_CAPABILITIES*)(pRsnIe + (*rsn_len)); + + + pRSN_Cap->word = cpu2le16(pRSN_Cap->word); + + (*rsn_len) += sizeof(RSN_CAPABILITIES); // update current RSNIE length + +} + + +/* + ======================================================================== + + Routine Description: + Build RSN IE context. It is not included element-ID and length. + + Arguments: + pAd - pointer to our pAdapter context + AuthMode - indicate the authentication mode + WepStatus - indicate the encryption type + apidx - indicate the interface index + + Return Value: + + Note: + + ======================================================================== +*/ +VOID RTMPMakeRSNIE( + IN PRTMP_ADAPTER pAd, + IN UINT AuthMode, + IN UINT WepStatus, + IN UCHAR apidx) +{ + PUCHAR pRsnIe = NULL; // primary RSNIE + UCHAR *rsnielen_cur_p = 0; // the length of the primary RSNIE + UCHAR *rsnielen_ex_cur_p = 0; // the length of the secondary RSNIE + UCHAR PrimaryRsnie; + BOOLEAN bMixCipher = FALSE; // indicate the pairwise and group cipher are different + UCHAR p_offset; + WPA_MIX_PAIR_CIPHER FlexibleCipher = WPA_TKIPAES_WPA2_TKIPAES; // it provide the more flexible cipher combination in WPA-WPA2 and TKIPAES mode + + rsnielen_cur_p = NULL; + rsnielen_ex_cur_p = NULL; + + { + { + if (pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) + { + if (AuthMode < Ndis802_11AuthModeWPA) + return; + } + else + { + // Support WPAPSK or WPA2PSK in STA-Infra mode + // Support WPANone in STA-Adhoc mode + if ((AuthMode != Ndis802_11AuthModeWPAPSK) && + (AuthMode != Ndis802_11AuthModeWPA2PSK) && + (AuthMode != Ndis802_11AuthModeWPANone) + ) + return; + } + + DBGPRINT(RT_DEBUG_TRACE,("==> RTMPMakeRSNIE(STA)\n")); + + // Zero RSNIE context + pAd->StaCfg.RSNIE_Len = 0; + NdisZeroMemory(pAd->StaCfg.RSN_IE, MAX_LEN_OF_RSNIE); + + // Pointer to RSNIE + rsnielen_cur_p = &pAd->StaCfg.RSNIE_Len; + pRsnIe = pAd->StaCfg.RSN_IE; + + bMixCipher = pAd->StaCfg.bMixCipher; + } + } + + // indicate primary RSNIE as WPA or WPA2 + if ((AuthMode == Ndis802_11AuthModeWPA) || + (AuthMode == Ndis802_11AuthModeWPAPSK) || + (AuthMode == Ndis802_11AuthModeWPANone) || + (AuthMode == Ndis802_11AuthModeWPA1WPA2) || + (AuthMode == Ndis802_11AuthModeWPA1PSKWPA2PSK)) + PrimaryRsnie = WpaIe; else - NdisMoveMemory(&concatenation[CurrPos], ANonce, 32); - CurrPos += 32; + PrimaryRsnie = Wpa2Ie; - // Get larger Nonce - if (RTMPCompareMemory(ANonce, SNonce, 32) == 0) - NdisMoveMemory(&concatenation[CurrPos], temp, 32); // patch for ralink proprietary STA-key issue - else if (RTMPCompareMemory(ANonce, SNonce, 32) == 1) - NdisMoveMemory(&concatenation[CurrPos], ANonce, 32); + { + // Build the primary RSNIE + // 1. insert cipher suite + RTMPMakeRsnIeCipher(pAd, PrimaryRsnie, WepStatus, bMixCipher, FlexibleCipher, pRsnIe, &p_offset); + + // 2. insert AKM + RTMPMakeRsnIeAKM(pAd, PrimaryRsnie, AuthMode, apidx, pRsnIe, &p_offset); + + // 3. insert capability + RTMPMakeRsnIeCap(pAd, PrimaryRsnie, apidx, pRsnIe, &p_offset); + } + + // 4. update the RSNIE length + *rsnielen_cur_p = p_offset; + + hex_dump("The primary RSNIE", pRsnIe, (*rsnielen_cur_p)); + + +} + +/* + ========================================================================== + Description: + Check whether the received frame is EAP frame. + + Arguments: + pAd - pointer to our pAdapter context + pEntry - pointer to active entry + pData - the received frame + DataByteCount - the received frame's length + FromWhichBSSID - indicate the interface index + + Return: + TRUE - This frame is EAP frame + FALSE - otherwise + ========================================================================== +*/ +BOOLEAN RTMPCheckWPAframe( + IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, + IN PUCHAR pData, + IN ULONG DataByteCount, + IN UCHAR FromWhichBSSID) +{ + ULONG Body_len; + BOOLEAN Cancelled; + + + if(DataByteCount < (LENGTH_802_1_H + LENGTH_EAPOL_H)) + return FALSE; + + + // Skip LLC header + if (NdisEqualMemory(SNAP_802_1H, pData, 6) || + // Cisco 1200 AP may send packet with SNAP_BRIDGE_TUNNEL + NdisEqualMemory(SNAP_BRIDGE_TUNNEL, pData, 6)) + { + pData += 6; + } + // Skip 2-bytes EAPoL type + if (NdisEqualMemory(EAPOL, pData, 2)) + { + pData += 2; + } + else + return FALSE; + + switch (*(pData+1)) + { + case EAPPacket: + Body_len = (*(pData+2)<<8) | (*(pData+3)); + DBGPRINT(RT_DEBUG_TRACE, ("Receive EAP-Packet frame, TYPE = 0, Length = %ld\n", Body_len)); + break; + case EAPOLStart: + DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOL-Start frame, TYPE = 1 \n")); + if (pEntry->EnqueueEapolStartTimerRunning != EAPOL_START_DISABLE) + { + DBGPRINT(RT_DEBUG_TRACE, ("Cancel the EnqueueEapolStartTimerRunning \n")); + RTMPCancelTimer(&pEntry->EnqueueStartForPSKTimer, &Cancelled); + pEntry->EnqueueEapolStartTimerRunning = EAPOL_START_DISABLE; + } + break; + case EAPOLLogoff: + DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOLLogoff frame, TYPE = 2 \n")); + break; + case EAPOLKey: + Body_len = (*(pData+2)<<8) | (*(pData+3)); + DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOL-Key frame, TYPE = 3, Length = %ld\n", Body_len)); + break; + case EAPOLASFAlert: + DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOLASFAlert frame, TYPE = 4 \n")); + break; + default: + return FALSE; + + } + return TRUE; +} + +/* + ========================================================================== + Description: + Report the EAP message type + + Arguments: + msg - EAPOL_PAIR_MSG_1 + EAPOL_PAIR_MSG_2 + EAPOL_PAIR_MSG_3 + EAPOL_PAIR_MSG_4 + EAPOL_GROUP_MSG_1 + EAPOL_GROUP_MSG_2 + + Return: + message type string + + ========================================================================== +*/ +PSTRING GetEapolMsgType(CHAR msg) +{ + if(msg == EAPOL_PAIR_MSG_1) + return "Pairwise Message 1"; + else if(msg == EAPOL_PAIR_MSG_2) + return "Pairwise Message 2"; + else if(msg == EAPOL_PAIR_MSG_3) + return "Pairwise Message 3"; + else if(msg == EAPOL_PAIR_MSG_4) + return "Pairwise Message 4"; + else if(msg == EAPOL_GROUP_MSG_1) + return "Group Message 1"; + else if(msg == EAPOL_GROUP_MSG_2) + return "Group Message 2"; + else + return "Invalid Message"; +} + + +/* + ======================================================================== + + Routine Description: + Check Sanity RSN IE of EAPoL message + + Arguments: + + Return Value: + + + ======================================================================== +*/ +BOOLEAN RTMPCheckRSNIE( + IN PRTMP_ADAPTER pAd, + IN PUCHAR pData, + IN UCHAR DataLen, + IN MAC_TABLE_ENTRY *pEntry, + OUT UCHAR *Offset) +{ + PUCHAR pVIE; + UCHAR len; + PEID_STRUCT pEid; + BOOLEAN result = FALSE; + + pVIE = pData; + len = DataLen; + *Offset = 0; + + while (len > sizeof(RSNIE2)) + { + pEid = (PEID_STRUCT) pVIE; + // WPA RSN IE + if ((pEid->Eid == IE_WPA) && (NdisEqualMemory(pEid->Octet, WPA_OUI, 4))) + { + if ((pEntry->AuthMode == Ndis802_11AuthModeWPA || pEntry->AuthMode == Ndis802_11AuthModeWPAPSK) && + (NdisEqualMemory(pVIE, pEntry->RSN_IE, pEntry->RSNIE_Len)) && + (pEntry->RSNIE_Len == (pEid->Len + 2))) + { + result = TRUE; + } + + *Offset += (pEid->Len + 2); + } + // WPA2 RSN IE + else if ((pEid->Eid == IE_RSN) && (NdisEqualMemory(pEid->Octet + 2, RSN_OUI, 3))) + { + if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2 || pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK) && + (pEid->Eid == pEntry->RSN_IE[0]) && + ((pEid->Len + 2) >= pEntry->RSNIE_Len) && + (NdisEqualMemory(pEid->Octet, &pEntry->RSN_IE[2], pEntry->RSNIE_Len - 2))) + { + + result = TRUE; + } + + *Offset += (pEid->Len + 2); + } else - NdisMoveMemory(&concatenation[CurrPos], SNonce, 32); - CurrPos += 32; + { + break; + } - hex_dump("concatenation=", concatenation, 76); + pVIE += (pEid->Len + 2); + len -= (pEid->Len + 2); + } - // Use PRF to generate PTK - PRF(PMK, LEN_MASTER_KEY, Prefix, 22, concatenation, 76, output, len); -} + return result; + +} + +/* + ======================================================================== + + Routine Description: + Parse KEYDATA field. KEYDATA[] May contain 2 RSN IE and optionally GTK. + GTK is encaptulated in KDE format at p.83 802.11i D10 + + Arguments: + + Return Value: + + Note: + 802.11i D10 + + ======================================================================== +*/ +BOOLEAN RTMPParseEapolKeyData( + IN PRTMP_ADAPTER pAd, + IN PUCHAR pKeyData, + IN UCHAR KeyDataLen, + IN UCHAR GroupKeyIndex, + IN UCHAR MsgType, + IN BOOLEAN bWPA2, + IN MAC_TABLE_ENTRY *pEntry) +{ + PKDE_ENCAP pKDE = NULL; + PUCHAR pMyKeyData = pKeyData; + UCHAR KeyDataLength = KeyDataLen; + UCHAR GTKLEN = 0; + UCHAR DefaultIdx = 0; + UCHAR skip_offset; + + // Verify The RSN IE contained in pairewise_msg_2 && pairewise_msg_3 and skip it + if (MsgType == EAPOL_PAIR_MSG_2 || MsgType == EAPOL_PAIR_MSG_3) + { + // Check RSN IE whether it is WPA2/WPA2PSK + if (!RTMPCheckRSNIE(pAd, pKeyData, KeyDataLen, pEntry, &skip_offset)) + { + // send wireless event - for RSN IE different + if (pAd->CommonCfg.bWirelessEvent) + RTMPSendWirelessEvent(pAd, IW_RSNIE_DIFF_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); + + DBGPRINT(RT_DEBUG_ERROR, ("RSN_IE Different in msg %d of 4-way handshake!\n", MsgType)); + hex_dump("Receive RSN_IE ", pKeyData, KeyDataLen); + hex_dump("Desired RSN_IE ", pEntry->RSN_IE, pEntry->RSNIE_Len); + + return FALSE; + } + else + { + if (bWPA2 && MsgType == EAPOL_PAIR_MSG_3) + { + WpaShowAllsuite(pMyKeyData, skip_offset); + + // skip RSN IE + pMyKeyData += skip_offset; + KeyDataLength -= skip_offset; + DBGPRINT(RT_DEBUG_TRACE, ("RTMPParseEapolKeyData ==> WPA2/WPA2PSK RSN IE matched in Msg 3, Length(%d) \n", skip_offset)); + } + else + return TRUE; + } + } -/* - ======================================================================== + DBGPRINT(RT_DEBUG_TRACE,("RTMPParseEapolKeyData ==> KeyDataLength %d without RSN_IE \n", KeyDataLength)); + //hex_dump("remain data", pMyKeyData, KeyDataLength); - Routine Description: - Generate random number by software. - Arguments: - pAd - pointer to our pAdapter context - macAddr - pointer to local MAC address + // Parse EKD format in pairwise_msg_3_WPA2 && group_msg_1_WPA2 + if (bWPA2 && (MsgType == EAPOL_PAIR_MSG_3 || MsgType == EAPOL_GROUP_MSG_1)) + { + if (KeyDataLength >= 8) // KDE format exclude GTK length + { + pKDE = (PKDE_ENCAP) pMyKeyData; - Return Value: - Note: - 802.1ii-2004 Annex H.5 + DefaultIdx = pKDE->GTKEncap.Kid; - ======================================================================== -*/ -VOID GenRandom( - IN PRTMP_ADAPTER pAd, - IN UCHAR *macAddr, - OUT UCHAR *random) -{ - INT i, curr; - UCHAR local[80], KeyCounter[32]; - UCHAR result[80]; - ULONG CurrentTime; - UCHAR prefix[] = {'I', 'n', 'i', 't', ' ', 'C', 'o', 'u', 'n', 't', 'e', 'r'}; + // Sanity check - KED length + if (KeyDataLength < (pKDE->Len + 2)) + { + DBGPRINT(RT_DEBUG_ERROR, ("ERROR: The len from KDE is too short \n")); + return FALSE; + } - // Zero the related information - NdisZeroMemory(result, 80); - NdisZeroMemory(local, 80); - NdisZeroMemory(KeyCounter, 32); + // Get GTK length - refer to IEEE 802.11i-2004 p.82 + GTKLEN = pKDE->Len -6; + if (GTKLEN < LEN_AES_KEY) + { + DBGPRINT(RT_DEBUG_ERROR, ("ERROR: GTK Key length is too short (%d) \n", GTKLEN)); + return FALSE; + } - for (i = 0; i < 32; i++) + } + else { - // copy the local MAC address - COPY_MAC_ADDR(local, macAddr); - curr = MAC_ADDR_LEN; + DBGPRINT(RT_DEBUG_ERROR, ("ERROR: KDE format length is too short \n")); + return FALSE; + } - // concatenate the current time - NdisGetSystemUpTime(&CurrentTime); - NdisMoveMemory(&local[curr], &CurrentTime, sizeof(CurrentTime)); - curr += sizeof(CurrentTime); + DBGPRINT(RT_DEBUG_TRACE, ("GTK in KDE format ,DefaultKeyID=%d, KeyLen=%d \n", DefaultIdx, GTKLEN)); + // skip it + pMyKeyData += 8; + KeyDataLength -= 8; - // concatenate the last result - NdisMoveMemory(&local[curr], result, 32); - curr += 32; + } + else if (!bWPA2 && MsgType == EAPOL_GROUP_MSG_1) + { + DefaultIdx = GroupKeyIndex; + DBGPRINT(RT_DEBUG_TRACE, ("GTK DefaultKeyID=%d \n", DefaultIdx)); + } - // concatenate a variable - NdisMoveMemory(&local[curr], &i, 2); - curr += 2; + // Sanity check - shared key index must be 1 ~ 3 + if (DefaultIdx < 1 || DefaultIdx > 3) + { + DBGPRINT(RT_DEBUG_ERROR, ("ERROR: GTK Key index(%d) is invalid in %s %s \n", DefaultIdx, ((bWPA2) ? "WPA2" : "WPA"), GetEapolMsgType(MsgType))); + return FALSE; + } - // calculate the result - PRF(KeyCounter, 32, prefix,12, local, curr, result, 32); + { + PCIPHER_KEY pSharedKey; + + // set key material, TxMic and RxMic + NdisMoveMemory(pAd->StaCfg.GTK, pMyKeyData, 32); + pAd->StaCfg.DefaultKeyId = DefaultIdx; + + pSharedKey = &pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId]; + + // Prepare pair-wise key information into shared key table + NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); + pSharedKey->KeyLen = LEN_TKIP_EK; + NdisMoveMemory(pSharedKey->Key, pAd->StaCfg.GTK, LEN_TKIP_EK); + NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.GTK[16], LEN_TKIP_RXMICK); + NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.GTK[24], LEN_TKIP_TXMICK); + + // Update Shared Key CipherAlg + pSharedKey->CipherAlg = CIPHER_NONE; + if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption2Enabled) + pSharedKey->CipherAlg = CIPHER_TKIP; + else if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption3Enabled) + pSharedKey->CipherAlg = CIPHER_AES; + else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP40Enabled) + pSharedKey->CipherAlg = CIPHER_WEP64; + else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP104Enabled) + pSharedKey->CipherAlg = CIPHER_WEP128; + + + // Update group key information to ASIC Shared Key Table + AsicAddSharedKeyEntry(pAd, + BSS0, + pAd->StaCfg.DefaultKeyId, + pSharedKey->CipherAlg, + pSharedKey->Key, + pSharedKey->TxMic, + pSharedKey->RxMic); + + // Update ASIC WCID attribute table and IVEIV table + RTMPAddWcidAttributeEntry(pAd, + BSS0, + pAd->StaCfg.DefaultKeyId, + pSharedKey->CipherAlg, + NULL); } - NdisMoveMemory(random, result, 32); + return TRUE; + } + /* ======================================================================== Routine Description: - Build cipher suite in RSN-IE. - It only shall be called by RTMPMakeRSNIE. + Construct EAPoL message for WPA handshaking + Its format is below, + + +--------------------+ + | Protocol Version | 1 octet + +--------------------+ + | Protocol Type | 1 octet + +--------------------+ + | Body Length | 2 octets + +--------------------+ + | Descriptor Type | 1 octet + +--------------------+ + | Key Information | 2 octets + +--------------------+ + | Key Length | 1 octet + +--------------------+ + | Key Repaly Counter | 8 octets + +--------------------+ + | Key Nonce | 32 octets + +--------------------+ + | Key IV | 16 octets + +--------------------+ + | Key RSC | 8 octets + +--------------------+ + | Key ID or Reserved | 8 octets + +--------------------+ + | Key MIC | 16 octets + +--------------------+ + | Key Data Length | 2 octets + +--------------------+ + | Key Data | n octets + +--------------------+ + Arguments: - pAd - pointer to our pAdapter context - ElementID - indicate the WPA1 or WPA2 - WepStatus - indicate the encryption type - bMixCipher - a boolean to indicate the pairwise cipher and group - cipher are the same or not + pAd Pointer to our adapter Return Value: + None Note: ======================================================================== */ -static VOID RTMPInsertRsnIeCipher( - IN PRTMP_ADAPTER pAd, - IN UCHAR ElementID, - IN UINT WepStatus, - IN BOOLEAN bMixCipher, - IN UCHAR FlexibleCipher, - OUT PUCHAR pRsnIe, - OUT UCHAR *rsn_len) +VOID ConstructEapolMsg( + IN PMAC_TABLE_ENTRY pEntry, + IN UCHAR GroupKeyWepStatus, + IN UCHAR MsgType, + IN UCHAR DefaultKeyIdx, + IN UCHAR *KeyNonce, + IN UCHAR *TxRSC, + IN UCHAR *GTK, + IN UCHAR *RSNIE, + IN UCHAR RSNIE_Len, + OUT PEAPOL_PACKET pMsg) { - UCHAR PairwiseCnt; + BOOLEAN bWPA2 = FALSE; + UCHAR KeyDescVer; - *rsn_len = 0; + // Choose WPA2 or not + if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) || + (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) + bWPA2 = TRUE; - // decide WPA2 or WPA1 - if (ElementID == Wpa2Ie) - { - RSNIE2 *pRsnie_cipher = (RSNIE2*)pRsnIe; + // Init Packet and Fill header + pMsg->ProVer = EAPOL_VER; + pMsg->ProType = EAPOLKey; - // Assign the verson as 1 - pRsnie_cipher->version = 1; + // Default 95 bytes, the EAPoL-Key descriptor exclude Key-data field + SET_UINT16_TO_ARRARY(pMsg->Body_Len, LEN_EAPOL_KEY_MSG); - switch (WepStatus) - { - // TKIP mode - case Ndis802_11Encryption2Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_TKIP, 4); - pRsnie_cipher->ucount = 1; - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_TKIP, 4); - *rsn_len = sizeof(RSNIE2); - break; + // Fill in EAPoL descriptor + if (bWPA2) + pMsg->KeyDesc.Type = WPA2_KEY_DESC; + else + pMsg->KeyDesc.Type = WPA1_KEY_DESC; - // AES mode - case Ndis802_11Encryption3Enabled: - if (bMixCipher) - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_TKIP, 4); + // Key Descriptor Version (bits 0-2) specifies the key descriptor version type + { + // Fill in Key information, refer to IEEE Std 802.11i-2004 page 78 + // When either the pairwise or the group cipher is AES, the DESC_TYPE_AES(2) shall be used. + KeyDescVer = (((pEntry->WepStatus == Ndis802_11Encryption3Enabled) || + (GroupKeyWepStatus == Ndis802_11Encryption3Enabled)) ? (DESC_TYPE_AES) : (DESC_TYPE_TKIP)); + } + + pMsg->KeyDesc.KeyInfo.KeyDescVer = KeyDescVer; + + // Specify Key Type as Group(0) or Pairwise(1) + if (MsgType >= EAPOL_GROUP_MSG_1) + pMsg->KeyDesc.KeyInfo.KeyType = GROUPKEY; else - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_CCMP, 4); - pRsnie_cipher->ucount = 1; - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_CCMP, 4); - *rsn_len = sizeof(RSNIE2); - break; + pMsg->KeyDesc.KeyInfo.KeyType = PAIRWISEKEY; - // TKIP-AES mix mode - case Ndis802_11Encryption4Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_TKIP, 4); + // Specify Key Index, only group_msg1_WPA1 + if (!bWPA2 && (MsgType >= EAPOL_GROUP_MSG_1)) + pMsg->KeyDesc.KeyInfo.KeyIndex = DefaultKeyIdx; - PairwiseCnt = 1; - // Insert WPA2 TKIP as the first pairwise cipher - if (MIX_CIPHER_WPA2_TKIP_ON(FlexibleCipher)) - { - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_TKIP, 4); - // Insert WPA2 AES as the secondary pairwise cipher - if (MIX_CIPHER_WPA2_AES_ON(FlexibleCipher)) + if (MsgType == EAPOL_PAIR_MSG_3) + pMsg->KeyDesc.KeyInfo.Install = 1; + + if ((MsgType == EAPOL_PAIR_MSG_1) || (MsgType == EAPOL_PAIR_MSG_3) || (MsgType == EAPOL_GROUP_MSG_1)) + pMsg->KeyDesc.KeyInfo.KeyAck = 1; + + if (MsgType != EAPOL_PAIR_MSG_1) + pMsg->KeyDesc.KeyInfo.KeyMic = 1; + + if ((bWPA2 && (MsgType >= EAPOL_PAIR_MSG_3)) || + (!bWPA2 && (MsgType >= EAPOL_GROUP_MSG_1))) { - NdisMoveMemory(pRsnie_cipher->ucast[0].oui + 4, OUI_WPA2_CCMP, 4); - PairwiseCnt = 2; + pMsg->KeyDesc.KeyInfo.Secure = 1; } - } - else + + if (bWPA2 && ((MsgType == EAPOL_PAIR_MSG_3) || + (MsgType == EAPOL_GROUP_MSG_1))) { - // Insert WPA2 AES as the first pairwise cipher - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_CCMP, 4); + pMsg->KeyDesc.KeyInfo.EKD_DL = 1; } - pRsnie_cipher->ucount = PairwiseCnt; - *rsn_len = sizeof(RSNIE2) + (4 * (PairwiseCnt - 1)); - break; - } + // key Information element has done. + *(USHORT *)(&pMsg->KeyDesc.KeyInfo) = cpu2le16(*(USHORT *)(&pMsg->KeyDesc.KeyInfo)); - if ((pAd->OpMode == OPMODE_STA) && - (pAd->StaCfg.GroupCipher != Ndis802_11Encryption2Enabled) && - (pAd->StaCfg.GroupCipher != Ndis802_11Encryption3Enabled)) + // Fill in Key Length { - UINT GroupCipher = pAd->StaCfg.GroupCipher; - switch(GroupCipher) + if (MsgType >= EAPOL_GROUP_MSG_1) { - case Ndis802_11GroupWEP40Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_WEP40, 4); - break; - case Ndis802_11GroupWEP104Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_WEP104, 4); - break; - } - } - - // swap for big-endian platform - pRsnie_cipher->version = cpu2le16(pRsnie_cipher->version); - pRsnie_cipher->ucount = cpu2le16(pRsnie_cipher->ucount); + // the length of group key cipher + pMsg->KeyDesc.KeyLength[1] = ((GroupKeyWepStatus == Ndis802_11Encryption2Enabled) ? TKIP_GTK_LENGTH : LEN_AES_KEY); } else { - RSNIE *pRsnie_cipher = (RSNIE*)pRsnIe; - - // Assign OUI and version - NdisMoveMemory(pRsnie_cipher->oui, OUI_WPA_VERSION, 4); - pRsnie_cipher->version = 1; - - switch (WepStatus) - { - // TKIP mode - case Ndis802_11Encryption2Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_TKIP, 4); - pRsnie_cipher->ucount = 1; - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_TKIP, 4); - *rsn_len = sizeof(RSNIE); - break; + // the length of pairwise key cipher + pMsg->KeyDesc.KeyLength[1] = ((pEntry->WepStatus == Ndis802_11Encryption2Enabled) ? LEN_TKIP_KEY : LEN_AES_KEY); + } + } - // AES mode - case Ndis802_11Encryption3Enabled: - if (bMixCipher) - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_TKIP, 4); - else - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_CCMP, 4); - pRsnie_cipher->ucount = 1; - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_CCMP, 4); - *rsn_len = sizeof(RSNIE); - break; + // Fill in replay counter + NdisMoveMemory(pMsg->KeyDesc.ReplayCounter, pEntry->R_Counter, LEN_KEY_DESC_REPLAY); - // TKIP-AES mix mode - case Ndis802_11Encryption4Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_TKIP, 4); + // Fill Key Nonce field + // ANonce : pairwise_msg1 & pairwise_msg3 + // SNonce : pairwise_msg2 + // GNonce : group_msg1_wpa1 + if ((MsgType <= EAPOL_PAIR_MSG_3) || ((!bWPA2 && (MsgType == EAPOL_GROUP_MSG_1)))) + NdisMoveMemory(pMsg->KeyDesc.KeyNonce, KeyNonce, LEN_KEY_DESC_NONCE); - PairwiseCnt = 1; - // Insert WPA TKIP as the first pairwise cipher - if (MIX_CIPHER_WPA_TKIP_ON(FlexibleCipher)) - { - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_TKIP, 4); - // Insert WPA AES as the secondary pairwise cipher - if (MIX_CIPHER_WPA_AES_ON(FlexibleCipher)) + // Fill key IV - WPA2 as 0, WPA1 as random + if (!bWPA2 && (MsgType == EAPOL_GROUP_MSG_1)) { - NdisMoveMemory(pRsnie_cipher->ucast[0].oui + 4, OUI_WPA_CCMP, 4); - PairwiseCnt = 2; - } + // Suggest IV be random number plus some number, + NdisMoveMemory(pMsg->KeyDesc.KeyIv, &KeyNonce[16], LEN_KEY_DESC_IV); + pMsg->KeyDesc.KeyIv[15] += 2; } - else + + // Fill Key RSC field + // It contains the RSC for the GTK being installed. + if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2) || (MsgType == EAPOL_GROUP_MSG_1)) { - // Insert WPA AES as the first pairwise cipher - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_CCMP, 4); + NdisMoveMemory(pMsg->KeyDesc.KeyRsc, TxRSC, 6); } - pRsnie_cipher->ucount = PairwiseCnt; - *rsn_len = sizeof(RSNIE) + (4 * (PairwiseCnt - 1)); - break; - } - - if ((pAd->OpMode == OPMODE_STA) && - (pAd->StaCfg.GroupCipher != Ndis802_11Encryption2Enabled) && - (pAd->StaCfg.GroupCipher != Ndis802_11Encryption3Enabled)) - { - UINT GroupCipher = pAd->StaCfg.GroupCipher; - switch(GroupCipher) + // Clear Key MIC field for MIC calculation later + NdisZeroMemory(pMsg->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); + + ConstructEapolKeyData(pEntry, + GroupKeyWepStatus, + KeyDescVer, + MsgType, + DefaultKeyIdx, + GTK, + RSNIE, + RSNIE_Len, + pMsg); + + // Calculate MIC and fill in KeyMic Field except Pairwise Msg 1. + if (MsgType != EAPOL_PAIR_MSG_1) { - case Ndis802_11GroupWEP40Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_WEP40, 4); - break; - case Ndis802_11GroupWEP104Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_WEP104, 4); - break; - } + CalculateMIC(KeyDescVer, pEntry->PTK, pMsg); } - // swap for big-endian platform - pRsnie_cipher->version = cpu2le16(pRsnie_cipher->version); - pRsnie_cipher->ucount = cpu2le16(pRsnie_cipher->ucount); - } + DBGPRINT(RT_DEBUG_TRACE, ("===> ConstructEapolMsg for %s %s\n", ((bWPA2) ? "WPA2" : "WPA"), GetEapolMsgType(MsgType))); + DBGPRINT(RT_DEBUG_TRACE, (" Body length = %d \n", CONV_ARRARY_TO_UINT16(pMsg->Body_Len))); + DBGPRINT(RT_DEBUG_TRACE, (" Key length = %d \n", CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyLength))); + + } /* ======================================================================== Routine Description: - Build AKM suite in RSN-IE. - It only shall be called by RTMPMakeRSNIE. + Construct the Key Data field of EAPoL message Arguments: - pAd - pointer to our pAdapter context - ElementID - indicate the WPA1 or WPA2 - AuthMode - indicate the authentication mode - apidx - indicate the interface index + pAd Pointer to our adapter + Elem Message body Return Value: + None Note: ======================================================================== */ -static VOID RTMPInsertRsnIeAKM( - IN PRTMP_ADAPTER pAd, - IN UCHAR ElementID, - IN UINT AuthMode, - IN UCHAR apidx, - OUT PUCHAR pRsnIe, - OUT UCHAR *rsn_len) +VOID ConstructEapolKeyData( + IN PMAC_TABLE_ENTRY pEntry, + IN UCHAR GroupKeyWepStatus, + IN UCHAR keyDescVer, + IN UCHAR MsgType, + IN UCHAR DefaultKeyIdx, + IN UCHAR *GTK, + IN UCHAR *RSNIE, + IN UCHAR RSNIE_LEN, + OUT PEAPOL_PACKET pMsg) { - RSNIE_AUTH *pRsnie_auth; + UCHAR *mpool, *Key_Data, *Rc4GTK; + UCHAR ekey[(LEN_KEY_DESC_IV+LEN_EAP_EK)]; + ULONG data_offset; + BOOLEAN bWPA2Capable = FALSE; + PRTMP_ADAPTER pAd = pEntry->pAd; + BOOLEAN GTK_Included = FALSE; + + // Choose WPA2 or not + if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) || + (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) + bWPA2Capable = TRUE; + + if (MsgType == EAPOL_PAIR_MSG_1 || + MsgType == EAPOL_PAIR_MSG_4 || + MsgType == EAPOL_GROUP_MSG_2) + return; - pRsnie_auth = (RSNIE_AUTH*)(pRsnIe + (*rsn_len)); + // allocate memory pool + os_alloc_mem(NULL, (PUCHAR *)&mpool, 1500); - // decide WPA2 or WPA1 - if (ElementID == Wpa2Ie) + if (mpool == NULL) + return; + + /* Rc4GTK Len = 512 */ + Rc4GTK = (UCHAR *) ROUND_UP(mpool, 4); + /* Key_Data Len = 512 */ + Key_Data = (UCHAR *) ROUND_UP(Rc4GTK + 512, 4); + + NdisZeroMemory(Key_Data, 512); + SET_UINT16_TO_ARRARY(pMsg->KeyDesc.KeyDataLen, 0); + data_offset = 0; + + // Encapsulate RSNIE in pairwise_msg2 & pairwise_msg3 + if (RSNIE_LEN && ((MsgType == EAPOL_PAIR_MSG_2) || (MsgType == EAPOL_PAIR_MSG_3))) + { + PUINT8 pmkid_ptr = NULL; + UINT8 pmkid_len = 0; + + + RTMPInsertRSNIE(&Key_Data[data_offset], + &data_offset, + RSNIE, + RSNIE_LEN, + pmkid_ptr, + pmkid_len); + } + + + // Encapsulate KDE format in pairwise_msg3_WPA2 & group_msg1_WPA2 + if (bWPA2Capable && ((MsgType == EAPOL_PAIR_MSG_3) || (MsgType == EAPOL_GROUP_MSG_1))) + { + // Key Data Encapsulation (KDE) format - 802.11i-2004 Figure-43w and Table-20h + Key_Data[data_offset + 0] = 0xDD; + + if (GroupKeyWepStatus == Ndis802_11Encryption3Enabled) + { + Key_Data[data_offset + 1] = 0x16;// 4+2+16(OUI+DataType+DataField) + } + else + { + Key_Data[data_offset + 1] = 0x26;// 4+2+32(OUI+DataType+DataField) + } + + Key_Data[data_offset + 2] = 0x00; + Key_Data[data_offset + 3] = 0x0F; + Key_Data[data_offset + 4] = 0xAC; + Key_Data[data_offset + 5] = 0x01; + + // GTK KDE format - 802.11i-2004 Figure-43x + Key_Data[data_offset + 6] = (DefaultKeyIdx & 0x03); + Key_Data[data_offset + 7] = 0x00; // Reserved Byte + + data_offset += 8; + } + + + // Encapsulate GTK + // Only for pairwise_msg3_WPA2 and group_msg1 + if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2Capable) || (MsgType == EAPOL_GROUP_MSG_1)) + { + // Fill in GTK + if (GroupKeyWepStatus == Ndis802_11Encryption3Enabled) + { + NdisMoveMemory(&Key_Data[data_offset], GTK, LEN_AES_KEY); + data_offset += LEN_AES_KEY; + } + else + { + NdisMoveMemory(&Key_Data[data_offset], GTK, TKIP_GTK_LENGTH); + data_offset += TKIP_GTK_LENGTH; + } + + GTK_Included = TRUE; + } + + + // This whole key-data field shall be encrypted if a GTK is included. + // Encrypt the data material in key data field with KEK + if (GTK_Included) { - switch (AuthMode) - { - case Ndis802_11AuthModeWPA2: - case Ndis802_11AuthModeWPA1WPA2: - pRsnie_auth->acount = 1; - NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA2_8021X_AKM, 4); - break; + //hex_dump("GTK_Included", Key_Data, data_offset); - case Ndis802_11AuthModeWPA2PSK: - case Ndis802_11AuthModeWPA1PSKWPA2PSK: - pRsnie_auth->acount = 1; - NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA2_PSK_AKM, 4); - break; + if ( + (keyDescVer == DESC_TYPE_AES)) + { + UCHAR remainder = 0; + UCHAR pad_len = 0; + + // Key Descriptor Version 2 or 3: AES key wrap, defined in IETF RFC 3394, + // shall be used to encrypt the Key Data field using the KEK field from + // the derived PTK. + + // If the Key Data field uses the NIST AES key wrap, then the Key Data field + // shall be padded before encrypting if the key data length is less than 16 + // octets or if it is not a multiple of 8. The padding consists of appending + // a single octet 0xdd followed by zero or more 0x00 octets. + if ((remainder = data_offset & 0x07) != 0) + { + INT i; + + pad_len = (8 - remainder); + Key_Data[data_offset] = 0xDD; + for (i = 1; i < pad_len; i++) + Key_Data[data_offset + i] = 0; + + data_offset += pad_len; } + + AES_GTK_KEY_WRAP(&pEntry->PTK[16], Key_Data, data_offset, Rc4GTK); + // AES wrap function will grow 8 bytes in length + data_offset += 8; } else { - switch (AuthMode) - { - case Ndis802_11AuthModeWPA: - case Ndis802_11AuthModeWPA1WPA2: - pRsnie_auth->acount = 1; - NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA_8021X_AKM, 4); - break; - - case Ndis802_11AuthModeWPAPSK: - case Ndis802_11AuthModeWPA1PSKWPA2PSK: - pRsnie_auth->acount = 1; - NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA_PSK_AKM, 4); - break; + /* Key Descriptor Version 1: ARC4 is used to encrypt the Key Data field + using the KEK field from the derived PTK. */ + + // PREPARE Encrypted "Key DATA" field. (Encrypt GTK with RC4, usinf PTK[16]->[31] as Key, IV-field as IV) + // put TxTsc in Key RSC field + pAd->PrivateInfo.FCSCRC32 = PPPINITFCS32; //Init crc32. + + // ekey is the contanetion of IV-field, and PTK[16]->PTK[31] + NdisMoveMemory(ekey, pMsg->KeyDesc.KeyIv, LEN_KEY_DESC_IV); + NdisMoveMemory(&ekey[LEN_KEY_DESC_IV], &pEntry->PTK[16], LEN_EAP_EK); + ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, ekey, sizeof(ekey)); //INIT SBOX, KEYLEN+3(IV) + pAd->PrivateInfo.FCSCRC32 = RTMP_CALC_FCS32(pAd->PrivateInfo.FCSCRC32, Key_Data, data_offset); + WPAARCFOUR_ENCRYPT(&pAd->PrivateInfo.WEPCONTEXT, Rc4GTK, Key_Data, data_offset); + } - case Ndis802_11AuthModeWPANone: - pRsnie_auth->acount = 1; - NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA_NONE_AKM, 4); - break; + NdisMoveMemory(pMsg->KeyDesc.KeyData, Rc4GTK, data_offset); } + else + { + NdisMoveMemory(pMsg->KeyDesc.KeyData, Key_Data, data_offset); } - pRsnie_auth->acount = cpu2le16(pRsnie_auth->acount); + // Update key data length field and total body length + SET_UINT16_TO_ARRARY(pMsg->KeyDesc.KeyDataLen, data_offset); + INC_UINT16_TO_ARRARY(pMsg->Body_Len, data_offset); - (*rsn_len) += sizeof(RSNIE_AUTH); // update current RSNIE length + os_free_mem(NULL, mpool); } @@ -550,13 +2688,11 @@ static VOID RTMPInsertRsnIeAKM( ======================================================================== Routine Description: - Build capability in RSN-IE. - It only shall be called by RTMPMakeRSNIE. + Calcaulate MIC. It is used during 4-ways handsharking. Arguments: pAd - pointer to our pAdapter context - ElementID - indicate the WPA1 or WPA2 - apidx - indicate the interface index + PeerWepStatus - indicate the encryption type Return Value: @@ -564,273 +2700,413 @@ static VOID RTMPInsertRsnIeAKM( ======================================================================== */ -static VOID RTMPInsertRsnIeCap( - IN PRTMP_ADAPTER pAd, - IN UCHAR ElementID, - IN UCHAR apidx, - OUT PUCHAR pRsnIe, - OUT UCHAR *rsn_len) +static VOID CalculateMIC( + IN UCHAR KeyDescVer, + IN UCHAR *PTK, + OUT PEAPOL_PACKET pMsg) { - RSN_CAPABILITIES *pRSN_Cap; + UCHAR *OutBuffer; + ULONG FrameLen = 0; + UCHAR mic[LEN_KEY_DESC_MIC]; + UCHAR digest[80]; - // it could be ignored in WPA1 mode - if (ElementID == WpaIe) + // allocate memory for MIC calculation + os_alloc_mem(NULL, (PUCHAR *)&OutBuffer, 512); + + if (OutBuffer == NULL) + { + DBGPRINT(RT_DEBUG_ERROR, ("!!!CalculateMIC: no memory!!!\n")); return; + } - pRSN_Cap = (RSN_CAPABILITIES*)(pRsnIe + (*rsn_len)); + // make a frame for calculating MIC. + MakeOutgoingFrame(OutBuffer, &FrameLen, + CONV_ARRARY_TO_UINT16(pMsg->Body_Len) + 4, pMsg, + END_OF_ARGS); + NdisZeroMemory(mic, sizeof(mic)); - pRSN_Cap->word = cpu2le16(pRSN_Cap->word); + // Calculate MIC + if (KeyDescVer == DESC_TYPE_AES) + { + HMAC_SHA1(PTK, LEN_EAP_MICK, OutBuffer, FrameLen, digest, SHA1_DIGEST_SIZE); + NdisMoveMemory(mic, digest, LEN_KEY_DESC_MIC); + } + else + { + HMAC_MD5(PTK, LEN_EAP_MICK, OutBuffer, FrameLen, mic, MD5_DIGEST_SIZE); + } - (*rsn_len) += sizeof(RSN_CAPABILITIES); // update current RSNIE length + // store the calculated MIC + NdisMoveMemory(pMsg->KeyDesc.KeyMic, mic, LEN_KEY_DESC_MIC); + os_free_mem(NULL, OutBuffer); } - /* ======================================================================== Routine Description: - Build RSN IE context. It is not included element-ID and length. + Some received frames can't decrypt by Asic, so decrypt them by software. Arguments: pAd - pointer to our pAdapter context - AuthMode - indicate the authentication mode - WepStatus - indicate the encryption type - apidx - indicate the interface index + PeerWepStatus - indicate the encryption type Return Value: - - Note: + NDIS_STATUS_SUCCESS - decryption successful + NDIS_STATUS_FAILURE - decryption failure ======================================================================== */ -VOID RTMPMakeRSNIE( +NDIS_STATUS RTMPSoftDecryptBroadCastData( IN PRTMP_ADAPTER pAd, - IN UINT AuthMode, - IN UINT WepStatus, - IN UCHAR apidx) + IN RX_BLK *pRxBlk, + IN NDIS_802_11_ENCRYPTION_STATUS GroupCipher, + IN PCIPHER_KEY pShard_key) { - PUCHAR pRsnIe = NULL; // primary RSNIE - UCHAR *rsnielen_cur_p = 0; // the length of the primary RSNIE - UCHAR *rsnielen_ex_cur_p = 0; // the length of the secondary RSNIE - UCHAR PrimaryRsnie; - BOOLEAN bMixCipher = FALSE; // indicate the pairwise and group cipher are different - UCHAR p_offset; - WPA_MIX_PAIR_CIPHER FlexibleCipher = WPA_TKIPAES_WPA2_TKIPAES; // it provide the more flexible cipher combination in WPA-WPA2 and TKIPAES mode + PRXWI_STRUC pRxWI = pRxBlk->pRxWI; + - rsnielen_cur_p = NULL; - rsnielen_ex_cur_p = NULL; + // handle WEP decryption + if (GroupCipher == Ndis802_11Encryption1Enabled) { + if (RTMPSoftDecryptWEP(pAd, pRxBlk->pData, pRxWI->MPDUtotalByteCount, pShard_key)) { - if (pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) + + //Minus IV[4] & ICV[4] + pRxWI->MPDUtotalByteCount -= 8; + } + else { - if (AuthMode < Ndis802_11AuthModeWPA) - return; + DBGPRINT(RT_DEBUG_ERROR, ("ERROR : Software decrypt WEP data fails.\n")); + // give up this frame + return NDIS_STATUS_FAILURE; + } + } + // handle TKIP decryption + else if (GroupCipher == Ndis802_11Encryption2Enabled) + { + if (RTMPSoftDecryptTKIP(pAd, pRxBlk->pData, pRxWI->MPDUtotalByteCount, 0, pShard_key)) + { + + //Minus 8 bytes MIC, 8 bytes IV/EIV, 4 bytes ICV + pRxWI->MPDUtotalByteCount -= 20; } else { - // Support WPAPSK or WPA2PSK in STA-Infra mode - // Support WPANone in STA-Adhoc mode - if ((AuthMode != Ndis802_11AuthModeWPAPSK) && - (AuthMode != Ndis802_11AuthModeWPA2PSK) && - (AuthMode != Ndis802_11AuthModeWPANone) - ) - return; + DBGPRINT(RT_DEBUG_ERROR, ("ERROR : RTMPSoftDecryptTKIP Failed\n")); + // give up this frame + return NDIS_STATUS_FAILURE; } + } + // handle AES decryption + else if (GroupCipher == Ndis802_11Encryption3Enabled) + { + if (RTMPSoftDecryptAES(pAd, pRxBlk->pData, pRxWI->MPDUtotalByteCount , pShard_key)) + { - DBGPRINT(RT_DEBUG_TRACE,("==> RTMPMakeRSNIE(STA)\n")); + //8 bytes MIC, 8 bytes IV/EIV (CCMP Header) + pRxWI->MPDUtotalByteCount -= 16; + } + else + { + DBGPRINT(RT_DEBUG_ERROR, ("ERROR : RTMPSoftDecryptAES Failed\n")); + // give up this frame + return NDIS_STATUS_FAILURE; + } + } + else + { + // give up this frame + return NDIS_STATUS_FAILURE; + } - // Zero RSNIE context - pAd->StaCfg.RSNIE_Len = 0; - NdisZeroMemory(pAd->StaCfg.RSN_IE, MAX_LEN_OF_RSNIE); + return NDIS_STATUS_SUCCESS; - // Pointer to RSNIE - rsnielen_cur_p = &pAd->StaCfg.RSNIE_Len; - pRsnIe = pAd->StaCfg.RSN_IE; +} - bMixCipher = pAd->StaCfg.bMixCipher; - } + +PUINT8 GetSuiteFromRSNIE( + IN PUINT8 rsnie, + IN UINT rsnie_len, + IN UINT8 type, + OUT UINT8 *count) +{ + PEID_STRUCT pEid; + INT len; + PUINT8 pBuf; + INT offset = 0; + PRSNIE_AUTH pAkm; + UINT16 acount; + BOOLEAN isWPA2 = FALSE; + + pEid = (PEID_STRUCT)rsnie; + len = rsnie_len - 2; // exclude IE and length + pBuf = (PUINT8)&pEid->Octet[0]; + + + + // set default value + *count = 0; + + // Check length + if ((len <= 0) || (pEid->Len != len)) + { + DBGPRINT_ERR(("%s : The length is invalid\n", __func__)); + return NULL; } - // indicate primary RSNIE as WPA or WPA2 - if ((AuthMode == Ndis802_11AuthModeWPA) || - (AuthMode == Ndis802_11AuthModeWPAPSK) || - (AuthMode == Ndis802_11AuthModeWPANone) || - (AuthMode == Ndis802_11AuthModeWPA1WPA2) || - (AuthMode == Ndis802_11AuthModeWPA1PSKWPA2PSK)) - PrimaryRsnie = WpaIe; - else - PrimaryRsnie = Wpa2Ie; + // Check WPA or WPA2 + if (pEid->Eid == IE_WPA) + { + PRSNIE pRsnie = (PRSNIE)pBuf; + UINT16 ucount; + if (len < sizeof(RSNIE)) { - // Build the primary RSNIE - // 1. insert cipher suite - RTMPInsertRsnIeCipher(pAd, PrimaryRsnie, WepStatus, bMixCipher, FlexibleCipher, pRsnIe, &p_offset); + DBGPRINT_ERR(("%s : The length is too short for WPA\n", __func__)); + return NULL; + } - // 2. insert AKM - RTMPInsertRsnIeAKM(pAd, PrimaryRsnie, AuthMode, apidx, pRsnIe, &p_offset); + // Get the count of pairwise cipher + ucount = cpu2le16(pRsnie->ucount); + if (ucount > 2) + { + DBGPRINT_ERR(("%s : The count(%d) of pairwise cipher is invlaid\n", + __func__, ucount)); + return NULL; + } - // 3. insert capability - RTMPInsertRsnIeCap(pAd, PrimaryRsnie, apidx, pRsnIe, &p_offset); + // Get the group cipher + if (type == GROUP_SUITE) + { + *count = 1; + return pRsnie->mcast; + } + // Get the pairwise cipher suite + else if (type == PAIRWISE_SUITE) + { + DBGPRINT(RT_DEBUG_TRACE, ("%s : The count of pairwise cipher is %d\n", + __func__, ucount)); + *count = ucount; + return pRsnie->ucast[0].oui; } - // 4. update the RSNIE length - *rsnielen_cur_p = p_offset; + offset = sizeof(RSNIE) + (4 * (ucount - 1)); - hex_dump("The primary RSNIE", pRsnIe, (*rsnielen_cur_p)); + } + else if (pEid->Eid == IE_RSN) + { + PRSNIE2 pRsnie = (PRSNIE2)pBuf; + UINT16 ucount; + isWPA2 = TRUE; -} + if (len < sizeof(RSNIE2)) + { + DBGPRINT_ERR(("%s : The length is too short for WPA2\n", __func__)); + return NULL; + } -/* - ========================================================================== - Description: - Check whether the received frame is EAP frame. + // Get the count of pairwise cipher + ucount = cpu2le16(pRsnie->ucount); + if (ucount > 2) + { + DBGPRINT_ERR(("%s : The count(%d) of pairwise cipher is invlaid\n", + __func__, ucount)); + return NULL; + } - Arguments: - pAd - pointer to our pAdapter context - pEntry - pointer to active entry - pData - the received frame - DataByteCount - the received frame's length - FromWhichBSSID - indicate the interface index + // Get the group cipher + if (type == GROUP_SUITE) + { + *count = 1; + return pRsnie->mcast; + } + // Get the pairwise cipher suite + else if (type == PAIRWISE_SUITE) + { + DBGPRINT(RT_DEBUG_TRACE, ("%s : The count of pairwise cipher is %d\n", + __func__, ucount)); + *count = ucount; + return pRsnie->ucast[0].oui; + } - Return: - TRUE - This frame is EAP frame - FALSE - otherwise - ========================================================================== -*/ -BOOLEAN RTMPCheckWPAframe( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR pData, - IN ULONG DataByteCount, - IN UCHAR FromWhichBSSID) -{ - ULONG Body_len; - BOOLEAN Cancelled; + offset = sizeof(RSNIE2) + (4 * (ucount - 1)); + + } + else + { + DBGPRINT_ERR(("%s : Unknown IE (%d)\n", __func__, pEid->Eid)); + return NULL; + } + // skip group cipher and pairwise cipher suite + pBuf += offset; + len -= offset; - if(DataByteCount < (LENGTH_802_1_H + LENGTH_EAPOL_H)) - return FALSE; + if (len < sizeof(RSNIE_AUTH)) + { + DBGPRINT_ERR(("%s : The length of RSNIE is too short\n", __func__)); + return NULL; + } + // pointer to AKM count + pAkm = (PRSNIE_AUTH)pBuf; - // Skip LLC header - if (NdisEqualMemory(SNAP_802_1H, pData, 6) || - // Cisco 1200 AP may send packet with SNAP_BRIDGE_TUNNEL - NdisEqualMemory(SNAP_BRIDGE_TUNNEL, pData, 6)) + // Get the count of pairwise cipher + acount = cpu2le16(pAkm->acount); + if (acount > 2) { - pData += 6; + DBGPRINT_ERR(("%s : The count(%d) of AKM is invlaid\n", + __func__, acount)); + return NULL; } - // Skip 2-bytes EAPoL type - if (NdisEqualMemory(EAPOL, pData, 2)) + + // Get the AKM suite + if (type == AKM_SUITE) { - pData += 2; + DBGPRINT(RT_DEBUG_TRACE, ("%s : The count of AKM is %d\n", + __func__, acount)); + *count = acount; + return pAkm->auth[0].oui; } - else - return FALSE; + offset = sizeof(RSNIE_AUTH) + (4 * (acount - 1)); - switch (*(pData+1)) + pBuf += offset; + len -= offset; + + // The remaining length must larger than (RSN-Capability(2) + PMKID-Count(2) + PMKID(16~)) + if (len >= (sizeof(RSN_CAPABILITIES) + 2 + LEN_PMKID)) { - case EAPPacket: - Body_len = (*(pData+2)<<8) | (*(pData+3)); - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAP-Packet frame, TYPE = 0, Length = %ld\n", Body_len)); - break; - case EAPOLStart: - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOL-Start frame, TYPE = 1 \n")); - if (pEntry->EnqueueEapolStartTimerRunning != EAPOL_START_DISABLE) + // Skip RSN capability and PMKID-Count + pBuf += (sizeof(RSN_CAPABILITIES) + 2); + len -= (sizeof(RSN_CAPABILITIES) + 2); + + // Get PMKID + if (type == PMKID_LIST) { - DBGPRINT(RT_DEBUG_TRACE, ("Cancel the EnqueueEapolStartTimerRunning \n")); - RTMPCancelTimer(&pEntry->EnqueueStartForPSKTimer, &Cancelled); - pEntry->EnqueueEapolStartTimerRunning = EAPOL_START_DISABLE; + *count = 1; + return pBuf; } - break; - case EAPOLLogoff: - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOLLogoff frame, TYPE = 2 \n")); - break; - case EAPOLKey: - Body_len = (*(pData+2)<<8) | (*(pData+3)); - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOL-Key frame, TYPE = 3, Length = %ld\n", Body_len)); - break; - case EAPOLASFAlert: - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOLASFAlert frame, TYPE = 4 \n")); - break; - default: - return FALSE; - } - return TRUE; + else + { + DBGPRINT_ERR(("%s : it can't get any more information beyond AKM \n", __func__)); + return NULL; + } + + *count = 0; + //DBGPRINT_ERR(("%s : The type(%d) doesn't support \n", __func__, type)); + return NULL; + } -/* - ======================================================================== +VOID WpaShowAllsuite( + IN PUINT8 rsnie, + IN UINT rsnie_len) +{ + PUINT8 pSuite = NULL; + UINT8 count; - Routine Description: - Misc function to decrypt AES body + hex_dump("RSNIE", rsnie, rsnie_len); - Arguments: + // group cipher + if ((pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, GROUP_SUITE, &count)) != NULL) + { + hex_dump("group cipher", pSuite, 4*count); + } - Return Value: + // pairwise cipher + if ((pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, PAIRWISE_SUITE, &count)) != NULL) + { + hex_dump("pairwise cipher", pSuite, 4*count); + } - Note: - This function references to RFC 3394 for aes key unwrap algorithm. + // AKM + if ((pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, AKM_SUITE, &count)) != NULL) + { + hex_dump("AKM suite", pSuite, 4*count); + } - ======================================================================== -*/ -VOID AES_GTK_KEY_UNWRAP( - IN UCHAR *key, - OUT UCHAR *plaintext, - IN UCHAR c_len, - IN UCHAR *ciphertext) + // PMKID + if ((pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, PMKID_LIST, &count)) != NULL) + { + hex_dump("PMKID", pSuite, LEN_PMKID); + } -{ - UCHAR A[8], BIN[16], BOUT[16]; - UCHAR xor; - INT i, j; - aes_context aesctx; - UCHAR *R; - INT num_blocks = c_len/8; // unit:64bits +} +VOID RTMPInsertRSNIE( + IN PUCHAR pFrameBuf, + OUT PULONG pFrameLen, + IN PUINT8 rsnie_ptr, + IN UINT8 rsnie_len, + IN PUINT8 pmkid_ptr, + IN UINT8 pmkid_len) +{ + PUCHAR pTmpBuf; + ULONG TempLen = 0; + UINT8 extra_len = 0; + UINT16 pmk_count = 0; + UCHAR ie_num; + UINT8 total_len = 0; + UCHAR WPA2_OUI[3]={0x00,0x0F,0xAC}; + + pTmpBuf = pFrameBuf; + + /* PMKID-List Must larger than 0 and the multiple of 16. */ + if (pmkid_len > 0 && ((pmkid_len & 0x0f) == 0)) + { + extra_len = sizeof(UINT16) + pmkid_len; - os_alloc_mem(NULL, (PUCHAR *)&R, 512); + pmk_count = (pmkid_len >> 4); + pmk_count = cpu2le16(pmk_count); + } + else + { + DBGPRINT(RT_DEBUG_WARN, ("%s : The length is PMKID-List is invalid (%d), so don't insert it.\n", + __func__, pmkid_len)); + } - if (R == NULL) + if (rsnie_len != 0) { - DBGPRINT(RT_DEBUG_ERROR, ("!!!AES_GTK_KEY_UNWRAP: no memory!!!\n")); - return; - } /* End of if */ + ie_num = IE_WPA; + total_len = rsnie_len; - // Initialize - NdisMoveMemory(A, ciphertext, 8); - //Input plaintext - for(i = 0; i < (c_len-8); i++) + if (NdisEqualMemory(rsnie_ptr + 2, WPA2_OUI, sizeof(WPA2_OUI))) { - R[ i] = ciphertext[i + 8]; + ie_num = IE_RSN; + total_len += extra_len; } - rtmp_aes_set_key(&aesctx, key, 128); + /* construct RSNIE body */ + MakeOutgoingFrame(pTmpBuf, &TempLen, + 1, &ie_num, + 1, &total_len, + rsnie_len, rsnie_ptr, + END_OF_ARGS); + + pTmpBuf += TempLen; + *pFrameLen = *pFrameLen + TempLen; - for(j = 5; j >= 0; j--) + if (ie_num == IE_RSN) { - for(i = (num_blocks-1); i > 0; i--) + /* Insert PMKID-List field */ + if (extra_len > 0) { - xor = (num_blocks -1 )* j + i; - NdisMoveMemory(BIN, A, 8); - BIN[7] = A[7] ^ xor; - NdisMoveMemory(&BIN[8], &R[(i-1)*8], 8); - rtmp_aes_decrypt(&aesctx, BIN, BOUT); - NdisMoveMemory(A, &BOUT[0], 8); - NdisMoveMemory(&R[(i-1)*8], &BOUT[8], 8); + MakeOutgoingFrame(pTmpBuf, &TempLen, + 2, &pmk_count, + pmkid_len, pmkid_ptr, + END_OF_ARGS); + + pTmpBuf += TempLen; + *pFrameLen = *pFrameLen + TempLen; } } - - // OUTPUT - for(i = 0; i < c_len; i++) - { - plaintext[i] = R[i]; } - - os_free_mem(NULL, R); + return; } diff --git a/drivers/staging/rt2860/common/crypt_hmac.c b/drivers/staging/rt2860/common/crypt_hmac.c new file mode 100644 index 000000000000..02701a5e3280 --- /dev/null +++ b/drivers/staging/rt2860/common/crypt_hmac.c @@ -0,0 +1,194 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + *************************************************************************/ + +#include "../crypt_hmac.h" + + +#ifdef HMAC_SHA1_SUPPORT +/* +======================================================================== +Routine Description: + HMAC using SHA1 hash function + +Arguments: + key Secret key + key_len The length of the key in bytes + message Message context + message_len The length of message in bytes + macLen Request the length of message authentication code + +Return Value: + mac Message authentication code + +Note: + None +======================================================================== +*/ +VOID HMAC_SHA1 ( + IN const UINT8 Key[], + IN UINT KeyLen, + IN const UINT8 Message[], + IN UINT MessageLen, + OUT UINT8 MAC[], + IN UINT MACLen) +{ + SHA1_CTX_STRUC sha_ctx1; + SHA1_CTX_STRUC sha_ctx2; + UINT8 K0[SHA1_BLOCK_SIZE]; + UINT8 Digest[SHA1_DIGEST_SIZE]; + UINT index; + + NdisZeroMemory(&sha_ctx1, sizeof(SHA1_CTX_STRUC)); + NdisZeroMemory(&sha_ctx2, sizeof(SHA1_CTX_STRUC)); + /* + * If the length of K = B(Block size): K0 = K. + * If the length of K > B: hash K to obtain an L byte string, + * then append (B-L) zeros to create a B-byte string K0 (i.e., K0 = H(K) || 00...00). + * If the length of K < B: append zeros to the end of K to create a B-byte string K0 + */ + NdisZeroMemory(K0, SHA1_BLOCK_SIZE); + if (KeyLen <= SHA1_BLOCK_SIZE) + NdisMoveMemory(K0, Key, KeyLen); + else + RT_SHA1(Key, KeyLen, K0); + /* End of if */ + + /* Exclusive-Or K0 with ipad */ + /* ipad: Inner pad; the byte x¡¦36¡¦ repeated B times. */ + for (index = 0; index < SHA1_BLOCK_SIZE; index++) + K0[index] ^= 0x36; + /* End of for */ + + RT_SHA1_Init(&sha_ctx1); + /* H(K0^ipad) */ + SHA1_Append(&sha_ctx1, K0, sizeof(K0)); + /* H((K0^ipad)||text) */ + SHA1_Append(&sha_ctx1, Message, MessageLen); + SHA1_End(&sha_ctx1, Digest); + + /* Exclusive-Or K0 with opad and remove ipad */ + /* opad: Outer pad; the byte x¡¦5c¡¦ repeated B times. */ + for (index = 0; index < SHA1_BLOCK_SIZE; index++) + K0[index] ^= 0x36^0x5c; + /* End of for */ + + RT_SHA1_Init(&sha_ctx2); + /* H(K0^opad) */ + SHA1_Append(&sha_ctx2, K0, sizeof(K0)); + /* H( (K0^opad) || H((K0^ipad)||text) ) */ + SHA1_Append(&sha_ctx2, Digest, SHA1_DIGEST_SIZE); + SHA1_End(&sha_ctx2, Digest); + + if (MACLen > SHA1_DIGEST_SIZE) + NdisMoveMemory(MAC, Digest, SHA1_DIGEST_SIZE); + else + NdisMoveMemory(MAC, Digest, MACLen); +} /* End of HMAC_SHA1 */ +#endif /* HMAC_SHA1_SUPPORT */ + +#ifdef HMAC_MD5_SUPPORT +/* +======================================================================== +Routine Description: + HMAC using MD5 hash function + +Arguments: + key Secret key + key_len The length of the key in bytes + message Message context + message_len The length of message in bytes + macLen Request the length of message authentication code + +Return Value: + mac Message authentication code + +Note: + None +======================================================================== +*/ +VOID HMAC_MD5( + IN const UINT8 Key[], + IN UINT KeyLen, + IN const UINT8 Message[], + IN UINT MessageLen, + OUT UINT8 MAC[], + IN UINT MACLen) +{ + MD5_CTX_STRUC md5_ctx1; + MD5_CTX_STRUC md5_ctx2; + UINT8 K0[MD5_BLOCK_SIZE]; + UINT8 Digest[MD5_DIGEST_SIZE]; + UINT index; + + NdisZeroMemory(&md5_ctx1, sizeof(MD5_CTX_STRUC)); + NdisZeroMemory(&md5_ctx2, sizeof(MD5_CTX_STRUC)); + /* + * If the length of K = B(Block size): K0 = K. + * If the length of K > B: hash K to obtain an L byte string, + * then append (B-L) zeros to create a B-byte string K0 (i.e., K0 = H(K) || 00...00). + * If the length of K < B: append zeros to the end of K to create a B-byte string K0 + */ + NdisZeroMemory(K0, MD5_BLOCK_SIZE); + if (KeyLen <= MD5_BLOCK_SIZE) { + NdisMoveMemory(K0, Key, KeyLen); + } else { + RT_MD5(Key, KeyLen, K0); + } + + /* Exclusive-Or K0 with ipad */ + /* ipad: Inner pad; the byte x¡¦36¡¦ repeated B times. */ + for (index = 0; index < MD5_BLOCK_SIZE; index++) + K0[index] ^= 0x36; + /* End of for */ + + MD5_Init(&md5_ctx1); + /* H(K0^ipad) */ + MD5_Append(&md5_ctx1, K0, sizeof(K0)); + /* H((K0^ipad)||text) */ + MD5_Append(&md5_ctx1, Message, MessageLen); + MD5_End(&md5_ctx1, Digest); + + /* Exclusive-Or K0 with opad and remove ipad */ + /* opad: Outer pad; the byte x¡¦5c¡¦ repeated B times. */ + for (index = 0; index < MD5_BLOCK_SIZE; index++) + K0[index] ^= 0x36^0x5c; + /* End of for */ + + MD5_Init(&md5_ctx2); + /* H(K0^opad) */ + MD5_Append(&md5_ctx2, K0, sizeof(K0)); + /* H( (K0^opad) || H((K0^ipad)||text) ) */ + MD5_Append(&md5_ctx2, Digest, MD5_DIGEST_SIZE); + MD5_End(&md5_ctx2, Digest); + + if (MACLen > MD5_DIGEST_SIZE) + NdisMoveMemory(MAC, Digest, MD5_DIGEST_SIZE); + else + NdisMoveMemory(MAC, Digest, MACLen); +} /* End of HMAC_SHA256 */ +#endif /* HMAC_MD5_SUPPORT */ + +/* End of crypt_hmac.c */ diff --git a/drivers/staging/rt2860/common/crypt_md5.c b/drivers/staging/rt2860/common/crypt_md5.c new file mode 100644 index 000000000000..7c9ecfa8e5a2 --- /dev/null +++ b/drivers/staging/rt2860/common/crypt_md5.c @@ -0,0 +1,352 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + *************************************************************************/ + +#include "../crypt_md5.h" + +#ifdef MD5_SUPPORT +/* + * F, G, H and I are basic MD5 functions. + */ +#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define I(x, y, z) ((y) ^ ((x) | (~z))) + +#define ROTL(x,n,w) ((x << n) | (x >> (w - n))) +#define ROTL32(x,n) ROTL(x,n,32) /* 32 bits word */ + +#define ROUND1(a, b, c, d, x, s, ac) { \ + (a) += F((b),(c),(d)) + (x) + (UINT32)(ac); \ + (a) = ROTL32((a),(s)); \ + (a) += (b); \ +} +#define ROUND2(a, b, c, d, x, s, ac) { \ + (a) += G((b),(c),(d)) + (x) + (UINT32)(ac); \ + (a) = ROTL32((a),(s)); \ + (a) += (b); \ +} +#define ROUND3(a, b, c, d, x, s, ac) { \ + (a) += H((b),(c),(d)) + (x) + (UINT32)(ac); \ + (a) = ROTL32((a),(s)); \ + (a) += (b); \ +} +#define ROUND4(a, b, c, d, x, s, ac) { \ + (a) += I((b),(c),(d)) + (x) + (UINT32)(ac); \ + (a) = ROTL32((a),(s)); \ + (a) += (b); \ +} +static const UINT32 MD5_DefaultHashValue[4] = { + 0x67452301UL, 0xefcdab89UL, 0x98badcfeUL, 0x10325476UL +}; +#endif /* MD5_SUPPORT */ + + +#ifdef MD5_SUPPORT +/* +======================================================================== +Routine Description: + Initial Md5_CTX_STRUC + +Arguments: + pMD5_CTX Pointer to Md5_CTX_STRUC + +Return Value: + None + +Note: + None +======================================================================== +*/ +VOID MD5_Init ( + IN MD5_CTX_STRUC *pMD5_CTX) +{ + NdisMoveMemory(pMD5_CTX->HashValue, MD5_DefaultHashValue, + sizeof(MD5_DefaultHashValue)); + NdisZeroMemory(pMD5_CTX->Block, MD5_BLOCK_SIZE); + pMD5_CTX->BlockLen = 0; + pMD5_CTX->MessageLen = 0; +} /* End of MD5_Init */ + + +/* +======================================================================== +Routine Description: + MD5 computation for one block (512 bits) + +Arguments: + pMD5_CTX Pointer to Md5_CTX_STRUC + +Return Value: + None + +Note: + T[i] := floor(abs(sin(i + 1)) * (2 pow 32)), i is number of round +======================================================================== +*/ +VOID MD5_Hash ( + IN MD5_CTX_STRUC *pMD5_CTX) +{ + UINT32 X_i; + UINT32 X[16]; + UINT32 a,b,c,d; + + /* Prepare the message schedule, {X_i} */ + NdisMoveMemory(X, pMD5_CTX->Block, MD5_BLOCK_SIZE); + for (X_i = 0; X_i < 16; X_i++) + X[X_i] = cpu2le32(X[X_i]); /* Endian Swap */ + /* End of for */ + + /* MD5 hash computation */ + /* Initialize the working variables */ + a = pMD5_CTX->HashValue[0]; + b = pMD5_CTX->HashValue[1]; + c = pMD5_CTX->HashValue[2]; + d = pMD5_CTX->HashValue[3]; + + /* + * Round 1 + * Let [abcd k s i] denote the operation + * a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s) + */ + ROUND1(a, b, c, d, X[ 0], 7, 0xd76aa478); /* 1 */ + ROUND1(d, a, b, c, X[ 1], 12, 0xe8c7b756); /* 2 */ + ROUND1(c, d, a, b, X[ 2], 17, 0x242070db); /* 3 */ + ROUND1(b, c, d, a, X[ 3], 22, 0xc1bdceee); /* 4 */ + ROUND1(a, b, c, d, X[ 4], 7, 0xf57c0faf); /* 5 */ + ROUND1(d, a, b, c, X[ 5], 12, 0x4787c62a); /* 6 */ + ROUND1(c, d, a, b, X[ 6], 17, 0xa8304613); /* 7 */ + ROUND1(b, c, d, a, X[ 7], 22, 0xfd469501); /* 8 */ + ROUND1(a, b, c, d, X[ 8], 7, 0x698098d8); /* 9 */ + ROUND1(d, a, b, c, X[ 9], 12, 0x8b44f7af); /* 10 */ + ROUND1(c, d, a, b, X[10], 17, 0xffff5bb1); /* 11 */ + ROUND1(b, c, d, a, X[11], 22, 0x895cd7be); /* 12 */ + ROUND1(a, b, c, d, X[12], 7, 0x6b901122); /* 13 */ + ROUND1(d, a, b, c, X[13], 12, 0xfd987193); /* 14 */ + ROUND1(c, d, a, b, X[14], 17, 0xa679438e); /* 15 */ + ROUND1(b, c, d, a, X[15], 22, 0x49b40821); /* 16 */ + + /* + * Round 2 + * Let [abcd k s i] denote the operation + * a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s) + */ + ROUND2(a, b, c, d, X[ 1], 5, 0xf61e2562); /* 17 */ + ROUND2(d, a, b, c, X[ 6], 9, 0xc040b340); /* 18 */ + ROUND2(c, d, a, b, X[11], 14, 0x265e5a51); /* 19 */ + ROUND2(b, c, d, a, X[ 0], 20, 0xe9b6c7aa); /* 20 */ + ROUND2(a, b, c, d, X[ 5], 5, 0xd62f105d); /* 21 */ + ROUND2(d, a, b, c, X[10], 9, 0x2441453); /* 22 */ + ROUND2(c, d, a, b, X[15], 14, 0xd8a1e681); /* 23 */ + ROUND2(b, c, d, a, X[ 4], 20, 0xe7d3fbc8); /* 24 */ + ROUND2(a, b, c, d, X[ 9], 5, 0x21e1cde6); /* 25 */ + ROUND2(d, a, b, c, X[14], 9, 0xc33707d6); /* 26 */ + ROUND2(c, d, a, b, X[ 3], 14, 0xf4d50d87); /* 27 */ + ROUND2(b, c, d, a, X[ 8], 20, 0x455a14ed); /* 28 */ + ROUND2(a, b, c, d, X[13], 5, 0xa9e3e905); /* 29 */ + ROUND2(d, a, b, c, X[ 2], 9, 0xfcefa3f8); /* 30 */ + ROUND2(c, d, a, b, X[ 7], 14, 0x676f02d9); /* 31 */ + ROUND2(b, c, d, a, X[12], 20, 0x8d2a4c8a); /* 32 */ + + /* + * Round 3 + * Let [abcd k s t] denote the operation + * a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s) + */ + ROUND3(a, b, c, d, X[ 5], 4, 0xfffa3942); /* 33 */ + ROUND3(d, a, b, c, X[ 8], 11, 0x8771f681); /* 34 */ + ROUND3(c, d, a, b, X[11], 16, 0x6d9d6122); /* 35 */ + ROUND3(b, c, d, a, X[14], 23, 0xfde5380c); /* 36 */ + ROUND3(a, b, c, d, X[ 1], 4, 0xa4beea44); /* 37 */ + ROUND3(d, a, b, c, X[ 4], 11, 0x4bdecfa9); /* 38 */ + ROUND3(c, d, a, b, X[ 7], 16, 0xf6bb4b60); /* 39 */ + ROUND3(b, c, d, a, X[10], 23, 0xbebfbc70); /* 40 */ + ROUND3(a, b, c, d, X[13], 4, 0x289b7ec6); /* 41 */ + ROUND3(d, a, b, c, X[ 0], 11, 0xeaa127fa); /* 42 */ + ROUND3(c, d, a, b, X[ 3], 16, 0xd4ef3085); /* 43 */ + ROUND3(b, c, d, a, X[ 6], 23, 0x4881d05); /* 44 */ + ROUND3(a, b, c, d, X[ 9], 4, 0xd9d4d039); /* 45 */ + ROUND3(d, a, b, c, X[12], 11, 0xe6db99e5); /* 46 */ + ROUND3(c, d, a, b, X[15], 16, 0x1fa27cf8); /* 47 */ + ROUND3(b, c, d, a, X[ 2], 23, 0xc4ac5665); /* 48 */ + + /* + * Round 4 + * Let [abcd k s t] denote the operation + * a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s) + */ + ROUND4(a, b, c, d, X[ 0], 6, 0xf4292244); /* 49 */ + ROUND4(d, a, b, c, X[ 7], 10, 0x432aff97); /* 50 */ + ROUND4(c, d, a, b, X[14], 15, 0xab9423a7); /* 51 */ + ROUND4(b, c, d, a, X[ 5], 21, 0xfc93a039); /* 52 */ + ROUND4(a, b, c, d, X[12], 6, 0x655b59c3); /* 53 */ + ROUND4(d, a, b, c, X[ 3], 10, 0x8f0ccc92); /* 54 */ + ROUND4(c, d, a, b, X[10], 15, 0xffeff47d); /* 55 */ + ROUND4(b, c, d, a, X[ 1], 21, 0x85845dd1); /* 56 */ + ROUND4(a, b, c, d, X[ 8], 6, 0x6fa87e4f); /* 57 */ + ROUND4(d, a, b, c, X[15], 10, 0xfe2ce6e0); /* 58 */ + ROUND4(c, d, a, b, X[ 6], 15, 0xa3014314); /* 59 */ + ROUND4(b, c, d, a, X[13], 21, 0x4e0811a1); /* 60 */ + ROUND4(a, b, c, d, X[ 4], 6, 0xf7537e82); /* 61 */ + ROUND4(d, a, b, c, X[11], 10, 0xbd3af235); /* 62 */ + ROUND4(c, d, a, b, X[ 2], 15, 0x2ad7d2bb); /* 63 */ + ROUND4(b, c, d, a, X[ 9], 21, 0xeb86d391); /* 64 */ + + /* Compute the i^th intermediate hash value H^(i) */ + pMD5_CTX->HashValue[0] += a; + pMD5_CTX->HashValue[1] += b; + pMD5_CTX->HashValue[2] += c; + pMD5_CTX->HashValue[3] += d; + + NdisZeroMemory(pMD5_CTX->Block, MD5_BLOCK_SIZE); + pMD5_CTX->BlockLen = 0; +} /* End of MD5_Hash */ + + +/* +======================================================================== +Routine Description: + The message is appended to block. If block size > 64 bytes, the MD5_Hash +will be called. + +Arguments: + pMD5_CTX Pointer to MD5_CTX_STRUC + message Message context + messageLen The length of message in bytes + +Return Value: + None + +Note: + None +======================================================================== +*/ +VOID MD5_Append ( + IN MD5_CTX_STRUC *pMD5_CTX, + IN const UINT8 Message[], + IN UINT MessageLen) +{ + UINT appendLen = 0; + UINT diffLen = 0; + + while (appendLen != MessageLen) { + diffLen = MessageLen - appendLen; + if ((pMD5_CTX->BlockLen + diffLen) < MD5_BLOCK_SIZE) { + NdisMoveMemory(pMD5_CTX->Block + pMD5_CTX->BlockLen, + Message + appendLen, diffLen); + pMD5_CTX->BlockLen += diffLen; + appendLen += diffLen; + } + else + { + NdisMoveMemory(pMD5_CTX->Block + pMD5_CTX->BlockLen, + Message + appendLen, MD5_BLOCK_SIZE - pMD5_CTX->BlockLen); + appendLen += (MD5_BLOCK_SIZE - pMD5_CTX->BlockLen); + pMD5_CTX->BlockLen = MD5_BLOCK_SIZE; + MD5_Hash(pMD5_CTX); + } /* End of if */ + } /* End of while */ + pMD5_CTX->MessageLen += MessageLen; +} /* End of MD5_Append */ + + +/* +======================================================================== +Routine Description: + 1. Append bit 1 to end of the message + 2. Append the length of message in rightmost 64 bits + 3. Transform the Hash Value to digest message + +Arguments: + pMD5_CTX Pointer to MD5_CTX_STRUC + +Return Value: + digestMessage Digest message + +Note: + None +======================================================================== +*/ +VOID MD5_End ( + IN MD5_CTX_STRUC *pMD5_CTX, + OUT UINT8 DigestMessage[]) +{ + UINT index; + UINT64 message_length_bits; + + /* append 1 bits to end of the message */ + NdisFillMemory(pMD5_CTX->Block + pMD5_CTX->BlockLen, 1, 0x80); + + /* 55 = 64 - 8 - 1: append 1 bit(1 byte) and message length (8 bytes) */ + if (pMD5_CTX->BlockLen > 55) + MD5_Hash(pMD5_CTX); + /* End of if */ + + /* Append the length of message in rightmost 64 bits */ + message_length_bits = pMD5_CTX->MessageLen*8; + message_length_bits = cpu2le64(message_length_bits); + NdisMoveMemory(&pMD5_CTX->Block[56], &message_length_bits, 8); + MD5_Hash(pMD5_CTX); + + /* Return message digest, transform the UINT32 hash value to bytes */ + for (index = 0; index < 4;index++) + pMD5_CTX->HashValue[index] = cpu2le32(pMD5_CTX->HashValue[index]); + /* End of for */ + NdisMoveMemory(DigestMessage, pMD5_CTX->HashValue, MD5_DIGEST_SIZE); +} /* End of MD5_End */ + + +/* +======================================================================== +Routine Description: + MD5 algorithm + +Arguments: + message Message context + messageLen The length of message in bytes + +Return Value: + digestMessage Digest message + +Note: + None +======================================================================== +*/ +VOID RT_MD5 ( + IN const UINT8 Message[], + IN UINT MessageLen, + OUT UINT8 DigestMessage[]) +{ + MD5_CTX_STRUC md5_ctx; + + NdisZeroMemory(&md5_ctx, sizeof(MD5_CTX_STRUC)); + MD5_Init(&md5_ctx); + MD5_Append(&md5_ctx, Message, MessageLen); + MD5_End(&md5_ctx, DigestMessage); +} /* End of RT_MD5 */ + +#endif /* MD5_SUPPORT */ + +/* End of crypt_md5.c */ diff --git a/drivers/staging/rt2860/common/crypt_sha2.c b/drivers/staging/rt2860/common/crypt_sha2.c new file mode 100644 index 000000000000..cb3f7c27b622 --- /dev/null +++ b/drivers/staging/rt2860/common/crypt_sha2.c @@ -0,0 +1,535 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + *************************************************************************/ + +#include "../crypt_sha2.h" + +/* Basic operations */ +#define SHR(x,n) (x >> n) /* SHR(x)^n, right shift n bits , x is w-bit word, 0 <= n <= w */ +#define ROTR(x,n,w) ((x >> n) | (x << (w - n))) /* ROTR(x)^n, circular right shift n bits , x is w-bit word, 0 <= n <= w */ +#define ROTL(x,n,w) ((x << n) | (x >> (w - n))) /* ROTL(x)^n, circular left shift n bits , x is w-bit word, 0 <= n <= w */ +#define ROTR32(x,n) ROTR(x,n,32) /* 32 bits word */ +#define ROTL32(x,n) ROTL(x,n,32) /* 32 bits word */ + +/* Basic functions */ +#define Ch(x,y,z) ((x & y) ^ ((~x) & z)) +#define Maj(x,y,z) ((x & y) ^ (x & z) ^ (y & z)) +#define Parity(x,y,z) (x ^ y ^ z) + +#ifdef SHA1_SUPPORT +/* SHA1 constants */ +#define SHA1_MASK 0x0000000f +static const UINT32 SHA1_K[4] = { + 0x5a827999UL, 0x6ed9eba1UL, 0x8f1bbcdcUL, 0xca62c1d6UL +}; +static const UINT32 SHA1_DefaultHashValue[5] = { + 0x67452301UL, 0xefcdab89UL, 0x98badcfeUL, 0x10325476UL, 0xc3d2e1f0UL +}; +#endif /* SHA1_SUPPORT */ + + +#ifdef SHA256_SUPPORT +/* SHA256 functions */ +#define Zsigma_256_0(x) (ROTR32(x,2) ^ ROTR32(x,13) ^ ROTR32(x,22)) +#define Zsigma_256_1(x) (ROTR32(x,6) ^ ROTR32(x,11) ^ ROTR32(x,25)) +#define Sigma_256_0(x) (ROTR32(x,7) ^ ROTR32(x,18) ^ SHR(x,3)) +#define Sigma_256_1(x) (ROTR32(x,17) ^ ROTR32(x,19) ^ SHR(x,10)) +/* SHA256 constants */ +static const UINT32 SHA256_K[64] = { + 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, + 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, + 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL, + 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL, + 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL, + 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, + 0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, + 0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL, + 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL, + 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL, + 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, + 0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, + 0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL, + 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL, + 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL, + 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL +}; +static const UINT32 SHA256_DefaultHashValue[8] = { + 0x6a09e667UL, 0xbb67ae85UL, 0x3c6ef372UL, 0xa54ff53aUL, + 0x510e527fUL, 0x9b05688cUL, 0x1f83d9abUL, 0x5be0cd19UL +}; +#endif /* SHA256_SUPPORT */ + + +#ifdef SHA1_SUPPORT +/* +======================================================================== +Routine Description: + Initial SHA1_CTX_STRUC + +Arguments: + pSHA_CTX Pointer to SHA1_CTX_STRUC + +Return Value: + None + +Note: + None +======================================================================== +*/ +VOID RT_SHA1_Init ( + IN SHA1_CTX_STRUC *pSHA_CTX) +{ + NdisMoveMemory(pSHA_CTX->HashValue, SHA1_DefaultHashValue, + sizeof(SHA1_DefaultHashValue)); + NdisZeroMemory(pSHA_CTX->Block, SHA1_BLOCK_SIZE); + pSHA_CTX->MessageLen = 0; + pSHA_CTX->BlockLen = 0; +} /* End of RT_SHA1_Init */ + + +/* +======================================================================== +Routine Description: + SHA1 computation for one block (512 bits) + +Arguments: + pSHA_CTX Pointer to SHA1_CTX_STRUC + +Return Value: + None + +Note: + None +======================================================================== +*/ +VOID SHA1_Hash ( + IN SHA1_CTX_STRUC *pSHA_CTX) +{ + UINT32 W_i,t,s; + UINT32 W[16]; + UINT32 a,b,c,d,e,T,f_t = 0; + + /* Prepare the message schedule, {W_i}, 0 < t < 15 */ + NdisMoveMemory(W, pSHA_CTX->Block, SHA1_BLOCK_SIZE); + for (W_i = 0; W_i < 16; W_i++) + W[W_i] = cpu2be32(W[W_i]); /* Endian Swap */ + /* End of for */ + + /* SHA256 hash computation */ + /* Initialize the working variables */ + a = pSHA_CTX->HashValue[0]; + b = pSHA_CTX->HashValue[1]; + c = pSHA_CTX->HashValue[2]; + d = pSHA_CTX->HashValue[3]; + e = pSHA_CTX->HashValue[4]; + + /* 80 rounds */ + for (t = 0;t < 80;t++) { + s = t & SHA1_MASK; + if (t > 15) { /* Prepare the message schedule, {W_i}, 16 < t < 79 */ + W[s] = (W[(s+13) & SHA1_MASK]) ^ (W[(s+8) & SHA1_MASK]) ^ (W[(s+2) & SHA1_MASK]) ^ W[s]; + W[s] = ROTL32(W[s],1); + } /* End of if */ + switch (t / 20) { + case 0: + f_t = Ch(b,c,d); + break; + case 1: + f_t = Parity(b,c,d); + break; + case 2: + f_t = Maj(b,c,d); + break; + case 3: + f_t = Parity(b,c,d); + break; + } /* End of switch */ + T = ROTL32(a,5) + f_t + e + SHA1_K[t / 20] + W[s]; + e = d; + d = c; + c = ROTL32(b,30); + b = a; + a = T; + } /* End of for */ + + /* Compute the i^th intermediate hash value H^(i) */ + pSHA_CTX->HashValue[0] += a; + pSHA_CTX->HashValue[1] += b; + pSHA_CTX->HashValue[2] += c; + pSHA_CTX->HashValue[3] += d; + pSHA_CTX->HashValue[4] += e; + + NdisZeroMemory(pSHA_CTX->Block, SHA1_BLOCK_SIZE); + pSHA_CTX->BlockLen = 0; +} /* End of SHA1_Hash */ + + +/* +======================================================================== +Routine Description: + The message is appended to block. If block size > 64 bytes, the SHA1_Hash +will be called. + +Arguments: + pSHA_CTX Pointer to SHA1_CTX_STRUC + message Message context + messageLen The length of message in bytes + +Return Value: + None + +Note: + None +======================================================================== +*/ +VOID SHA1_Append ( + IN SHA1_CTX_STRUC *pSHA_CTX, + IN const UINT8 Message[], + IN UINT MessageLen) +{ + UINT appendLen = 0; + UINT diffLen = 0; + + while (appendLen != MessageLen) { + diffLen = MessageLen - appendLen; + if ((pSHA_CTX->BlockLen + diffLen) < SHA1_BLOCK_SIZE) { + NdisMoveMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, + Message + appendLen, diffLen); + pSHA_CTX->BlockLen += diffLen; + appendLen += diffLen; + } + else + { + NdisMoveMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, + Message + appendLen, SHA1_BLOCK_SIZE - pSHA_CTX->BlockLen); + appendLen += (SHA1_BLOCK_SIZE - pSHA_CTX->BlockLen); + pSHA_CTX->BlockLen = SHA1_BLOCK_SIZE; + SHA1_Hash(pSHA_CTX); + } /* End of if */ + } /* End of while */ + pSHA_CTX->MessageLen += MessageLen; +} /* End of SHA1_Append */ + + +/* +======================================================================== +Routine Description: + 1. Append bit 1 to end of the message + 2. Append the length of message in rightmost 64 bits + 3. Transform the Hash Value to digest message + +Arguments: + pSHA_CTX Pointer to SHA1_CTX_STRUC + +Return Value: + digestMessage Digest message + +Note: + None +======================================================================== +*/ +VOID SHA1_End ( + IN SHA1_CTX_STRUC *pSHA_CTX, + OUT UINT8 DigestMessage[]) +{ + UINT index; + UINT64 message_length_bits; + + /* Append bit 1 to end of the message */ + NdisFillMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, 1, 0x80); + + /* 55 = 64 - 8 - 1: append 1 bit(1 byte) and message length (8 bytes) */ + if (pSHA_CTX->BlockLen > 55) + SHA1_Hash(pSHA_CTX); + /* End of if */ + + /* Append the length of message in rightmost 64 bits */ + message_length_bits = pSHA_CTX->MessageLen*8; + message_length_bits = cpu2be64(message_length_bits); + NdisMoveMemory(&pSHA_CTX->Block[56], &message_length_bits, 8); + SHA1_Hash(pSHA_CTX); + + /* Return message digest, transform the UINT32 hash value to bytes */ + for (index = 0; index < 5;index++) + pSHA_CTX->HashValue[index] = cpu2be32(pSHA_CTX->HashValue[index]); + /* End of for */ + NdisMoveMemory(DigestMessage, pSHA_CTX->HashValue, SHA1_DIGEST_SIZE); +} /* End of SHA1_End */ + + +/* +======================================================================== +Routine Description: + SHA1 algorithm + +Arguments: + message Message context + messageLen The length of message in bytes + +Return Value: + digestMessage Digest message + +Note: + None +======================================================================== +*/ +VOID RT_SHA1 ( + IN const UINT8 Message[], + IN UINT MessageLen, + OUT UINT8 DigestMessage[]) +{ + + SHA1_CTX_STRUC sha_ctx; + + NdisZeroMemory(&sha_ctx, sizeof(SHA1_CTX_STRUC)); + RT_SHA1_Init(&sha_ctx); + SHA1_Append(&sha_ctx, Message, MessageLen); + SHA1_End(&sha_ctx, DigestMessage); +} /* End of RT_SHA1 */ +#endif /* SHA1_SUPPORT */ + + +#ifdef SHA256_SUPPORT +/* +======================================================================== +Routine Description: + Initial SHA256_CTX_STRUC + +Arguments: + pSHA_CTX Pointer to SHA256_CTX_STRUC + +Return Value: + None + +Note: + None +======================================================================== +*/ +VOID SHA256_Init ( + IN SHA256_CTX_STRUC *pSHA_CTX) +{ + NdisMoveMemory(pSHA_CTX->HashValue, SHA256_DefaultHashValue, + sizeof(SHA256_DefaultHashValue)); + NdisZeroMemory(pSHA_CTX->Block, SHA256_BLOCK_SIZE); + pSHA_CTX->MessageLen = 0; + pSHA_CTX->BlockLen = 0; +} /* End of SHA256_Init */ + + +/* +======================================================================== +Routine Description: + SHA256 computation for one block (512 bits) + +Arguments: + pSHA_CTX Pointer to SHA256_CTX_STRUC + +Return Value: + None + +Note: + None +======================================================================== +*/ +VOID SHA256_Hash ( + IN SHA256_CTX_STRUC *pSHA_CTX) +{ + UINT32 W_i,t; + UINT32 W[64]; + UINT32 a,b,c,d,e,f,g,h,T1,T2; + + /* Prepare the message schedule, {W_i}, 0 < t < 15 */ + NdisMoveMemory(W, pSHA_CTX->Block, SHA256_BLOCK_SIZE); + for (W_i = 0; W_i < 16; W_i++) + W[W_i] = cpu2be32(W[W_i]); /* Endian Swap */ + /* End of for */ + + /* SHA256 hash computation */ + /* Initialize the working variables */ + a = pSHA_CTX->HashValue[0]; + b = pSHA_CTX->HashValue[1]; + c = pSHA_CTX->HashValue[2]; + d = pSHA_CTX->HashValue[3]; + e = pSHA_CTX->HashValue[4]; + f = pSHA_CTX->HashValue[5]; + g = pSHA_CTX->HashValue[6]; + h = pSHA_CTX->HashValue[7]; + + /* 64 rounds */ + for (t = 0;t < 64;t++) { + if (t > 15) /* Prepare the message schedule, {W_i}, 16 < t < 63 */ + W[t] = Sigma_256_1(W[t-2]) + W[t-7] + Sigma_256_0(W[t-15]) + W[t-16]; + /* End of if */ + T1 = h + Zsigma_256_1(e) + Ch(e,f,g) + SHA256_K[t] + W[t]; + T2 = Zsigma_256_0(a) + Maj(a,b,c); + h = g; + g = f; + f = e; + e = d + T1; + d = c; + c = b; + b = a; + a = T1 + T2; + } /* End of for */ + + /* Compute the i^th intermediate hash value H^(i) */ + pSHA_CTX->HashValue[0] += a; + pSHA_CTX->HashValue[1] += b; + pSHA_CTX->HashValue[2] += c; + pSHA_CTX->HashValue[3] += d; + pSHA_CTX->HashValue[4] += e; + pSHA_CTX->HashValue[5] += f; + pSHA_CTX->HashValue[6] += g; + pSHA_CTX->HashValue[7] += h; + + NdisZeroMemory(pSHA_CTX->Block, SHA256_BLOCK_SIZE); + pSHA_CTX->BlockLen = 0; +} /* End of SHA256_Hash */ + + +/* +======================================================================== +Routine Description: + The message is appended to block. If block size > 64 bytes, the SHA256_Hash +will be called. + +Arguments: + pSHA_CTX Pointer to SHA256_CTX_STRUC + message Message context + messageLen The length of message in bytes + +Return Value: + None + +Note: + None +======================================================================== +*/ +VOID SHA256_Append ( + IN SHA256_CTX_STRUC *pSHA_CTX, + IN const UINT8 Message[], + IN UINT MessageLen) +{ + UINT appendLen = 0; + UINT diffLen = 0; + + while (appendLen != MessageLen) { + diffLen = MessageLen - appendLen; + if ((pSHA_CTX->BlockLen + diffLen) < SHA256_BLOCK_SIZE) { + NdisMoveMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, + Message + appendLen, diffLen); + pSHA_CTX->BlockLen += diffLen; + appendLen += diffLen; + } + else + { + NdisMoveMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, + Message + appendLen, SHA256_BLOCK_SIZE - pSHA_CTX->BlockLen); + appendLen += (SHA256_BLOCK_SIZE - pSHA_CTX->BlockLen); + pSHA_CTX->BlockLen = SHA256_BLOCK_SIZE; + SHA256_Hash(pSHA_CTX); + } /* End of if */ + } /* End of while */ + pSHA_CTX->MessageLen += MessageLen; +} /* End of SHA256_Append */ + + +/* +======================================================================== +Routine Description: + 1. Append bit 1 to end of the message + 2. Append the length of message in rightmost 64 bits + 3. Transform the Hash Value to digest message + +Arguments: + pSHA_CTX Pointer to SHA256_CTX_STRUC + +Return Value: + digestMessage Digest message + +Note: + None +======================================================================== +*/ +VOID SHA256_End ( + IN SHA256_CTX_STRUC *pSHA_CTX, + OUT UINT8 DigestMessage[]) +{ + UINT index; + UINT64 message_length_bits; + + /* Append bit 1 to end of the message */ + NdisFillMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, 1, 0x80); + + /* 55 = 64 - 8 - 1: append 1 bit(1 byte) and message length (8 bytes) */ + if (pSHA_CTX->BlockLen > 55) + SHA256_Hash(pSHA_CTX); + /* End of if */ + + /* Append the length of message in rightmost 64 bits */ + message_length_bits = pSHA_CTX->MessageLen*8; + message_length_bits = cpu2be64(message_length_bits); + NdisMoveMemory(&pSHA_CTX->Block[56], &message_length_bits, 8); + SHA256_Hash(pSHA_CTX); + + /* Return message digest, transform the UINT32 hash value to bytes */ + for (index = 0; index < 8;index++) + pSHA_CTX->HashValue[index] = cpu2be32(pSHA_CTX->HashValue[index]); + /* End of for */ + NdisMoveMemory(DigestMessage, pSHA_CTX->HashValue, SHA256_DIGEST_SIZE); +} /* End of SHA256_End */ + + +/* +======================================================================== +Routine Description: + SHA256 algorithm + +Arguments: + message Message context + messageLen The length of message in bytes + +Return Value: + digestMessage Digest message + +Note: + None +======================================================================== +*/ +VOID RT_SHA256 ( + IN const UINT8 Message[], + IN UINT MessageLen, + OUT UINT8 DigestMessage[]) +{ + SHA256_CTX_STRUC sha_ctx; + + NdisZeroMemory(&sha_ctx, sizeof(SHA256_CTX_STRUC)); + SHA256_Init(&sha_ctx); + SHA256_Append(&sha_ctx, Message, MessageLen); + SHA256_End(&sha_ctx, DigestMessage); +} /* End of RT_SHA256 */ +#endif /* SHA256_SUPPORT */ + +/* End of crypt_sha2.c */ diff --git a/drivers/staging/rt2860/common/dfs.c b/drivers/staging/rt2860/common/dfs.c index 23330f2661d9..7b3890f631ea 100644 --- a/drivers/staging/rt2860/common/dfs.c +++ b/drivers/staging/rt2860/common/dfs.c @@ -33,7 +33,6 @@ Revision History: Who When What -------- ---------- ---------------------------------------------- - Fonchi 03-12-2007 created */ #include "../rt_config.h" @@ -46,10 +45,15 @@ typedef struct _RADAR_DURATION_TABLE } RADAR_DURATION_TABLE, *PRADAR_DURATION_TABLE; -static UCHAR RdIdleTimeTable[MAX_RD_REGION][4] = + +UCHAR RdIdleTimeTable[MAX_RD_REGION][4] = { {9, 250, 250, 250}, // CE +#ifdef DFS_FCC_BW40_FIX + {1, 250, 250, 250}, // FCC +#else {4, 250, 250, 250}, // FCC +#endif {4, 250, 250, 250}, // JAP {15, 250, 250, 250}, // JAP_W53 {4, 250, 250, 250} // JAP_W56 @@ -80,11 +84,32 @@ VOID BbpRadarDetectionStart( RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 124, 0x28); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 125, 0xff); +#ifdef MERGE_ARCH_TEAM + if ((pAd->CommonCfg.RadarDetect.RDDurRegion == JAP) || (pAd->CommonCfg.RadarDetect.RDDurRegion == JAP_W53) || (pAd->CommonCfg.RadarDetect.RDDurRegion == JAP_W56)) + { + pAd->CommonCfg.RadarDetect.RDDurRegion = JAP; + pAd->CommonCfg.RadarDetect.RDDurRegion = JapRadarType(pAd); + if (pAd->CommonCfg.RadarDetect.RDDurRegion == JAP_W56) + { + pAd->CommonCfg.RadarDetect.DfsSessionTime = 13; + } + else if (pAd->CommonCfg.RadarDetect.RDDurRegion == JAP_W53) + { + pAd->CommonCfg.RadarDetect.DfsSessionTime = 15; + } + } +#endif // MERGE_ARCH_TEAM // + RadarPeriod = ((UINT)RdIdleTimeTable[pAd->CommonCfg.RadarDetect.RDDurRegion][0] + (UINT)pAd->CommonCfg.RadarDetect.DfsSessionTime) < 250 ? (RdIdleTimeTable[pAd->CommonCfg.RadarDetect.RDDurRegion][0] + pAd->CommonCfg.RadarDetect.DfsSessionTime) : 250; +#ifdef MERGE_ARCH_TEAM + + +#else // Original RT28xx source code. RTMP_IO_WRITE8(pAd, 0x7020, 0x1d); RTMP_IO_WRITE8(pAd, 0x7021, 0x40); +#endif // MERGE_ARCH_TEAM // RadarDetectionStart(pAd, 0, RadarPeriod); return; @@ -143,6 +168,17 @@ VOID RadarDetectionStart( CtsProtect = 0x03; break; + case JAP: + { + UCHAR RDDurRegion; + RDDurRegion = JapRadarType(pAd); + if (RDDurRegion == JAP_W56) + CtsProtect = 0x03; + else + CtsProtect = 0x02; + break; + } + case CE: case JAP_W53: default: @@ -210,7 +246,6 @@ BOOLEAN RadarChannelCheck( IN PRTMP_ADAPTER pAd, IN UCHAR Ch) { -#if 1 INT i; BOOLEAN result = FALSE; @@ -224,23 +259,6 @@ BOOLEAN RadarChannelCheck( } return result; -#else - INT i; - UCHAR Channel[15]={52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}; - - for (i=0; i<15; i++) - { - if (Ch == Channel[i]) - { - break; - } - } - - if (i != 15) - return TRUE; - else - return FALSE; -#endif } ULONG JapRadarType( @@ -399,11 +417,11 @@ VOID RadarDetectPeriodic( */ INT Set_ChMovingTime_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { UINT8 Value; - Value = simple_strtol(arg, 0, 10); + Value = (UINT8) simple_strtol(arg, 0, 10); pAd->CommonCfg.RadarDetect.ChMovingTime = Value; @@ -415,11 +433,11 @@ INT Set_ChMovingTime_Proc( INT Set_LongPulseRadarTh_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { UINT8 Value; - Value = simple_strtol(arg, 0, 10) > 10 ? 10 : simple_strtol(arg, 0, 10); + Value = (UINT8) simple_strtol(arg, 0, 10) > 10 ? 10 : simple_strtol(arg, 0, 10); pAd->CommonCfg.RadarDetect.LongPulseRadarTh = Value; diff --git a/drivers/staging/rt2860/common/ee_efuse.c b/drivers/staging/rt2860/common/ee_efuse.c new file mode 100644 index 000000000000..f52224441d23 --- /dev/null +++ b/drivers/staging/rt2860/common/ee_efuse.c @@ -0,0 +1,1525 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + ee_efuse.c + + Abstract: + Miniport generic portion header file + + Revision History: + Who When What + -------- ---------- ---------------------------------------------- +*/ + + +#include "../rt_config.h" + + + +#define EFUSE_USAGE_MAP_START 0x2d0 +#define EFUSE_USAGE_MAP_END 0x2fc +#define EFUSE_USAGE_MAP_SIZE 45 + + + +#define EFUSE_EEPROM_DEFULT_FILE "RT30xxEEPROM.bin" +#define MAX_EEPROM_BIN_FILE_SIZE 1024 + + + +#define EFUSE_TAG 0x2fe + +typedef union _EFUSE_CTRL_STRUC { + struct { + UINT32 EFSROM_AOUT:6; + UINT32 EFSROM_MODE:2; + UINT32 EFSROM_LDO_OFF_TIME:6; + UINT32 EFSROM_LDO_ON_TIME:2; + UINT32 EFSROM_AIN:10; + UINT32 RESERVED:4; + UINT32 EFSROM_KICK:1; + UINT32 SEL_EFUSE:1; + } field; + UINT32 word; +} EFUSE_CTRL_STRUC, *PEFUSE_CTRL_STRUC; + +static UCHAR eFuseReadRegisters( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN USHORT Length, + OUT USHORT* pData); + +static VOID eFuseReadPhysical( + IN PRTMP_ADAPTER pAd, + IN PUSHORT lpInBuffer, + IN ULONG nInBufferSize, + OUT PUSHORT lpOutBuffer, + IN ULONG nOutBufferSize); + +static VOID eFusePhysicalWriteRegisters( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN USHORT Length, + OUT USHORT* pData); + +static NTSTATUS eFuseWriteRegisters( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN USHORT Length, + IN USHORT* pData); + +static VOID eFuseWritePhysical( + IN PRTMP_ADAPTER pAd, + PUSHORT lpInBuffer, + ULONG nInBufferSize, + PUCHAR lpOutBuffer, + ULONG nOutBufferSize); + + +static NTSTATUS eFuseWriteRegistersFromBin( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN USHORT Length, + IN USHORT* pData); + + +/* +======================================================================== + + Routine Description: + + Arguments: + + Return Value: + + Note: + +======================================================================== +*/ +UCHAR eFuseReadRegisters( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN USHORT Length, + OUT USHORT* pData) +{ + EFUSE_CTRL_STRUC eFuseCtrlStruc; + int i; + USHORT efuseDataOffset; + UINT32 data; + + RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); + + //Step0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. + //Use the eeprom logical address and covert to address to block number + eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0; + + //Step1. Write EFSROM_MODE (0x580, bit7:bit6) to 0. + eFuseCtrlStruc.field.EFSROM_MODE = 0; + + //Step2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure. + eFuseCtrlStruc.field.EFSROM_KICK = 1; + + NdisMoveMemory(&data, &eFuseCtrlStruc, 4); + RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); + + //Step3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. + i = 0; + while(i < 500) + { + //rtmp.HwMemoryReadDword(EFUSE_CTRL, (DWORD *) &eFuseCtrlStruc, 4); + RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); + if(eFuseCtrlStruc.field.EFSROM_KICK == 0) + { + break; + } + RTMPusecDelay(2); + i++; + } + + //if EFSROM_AOUT is not found in physical address, write 0xffff + if (eFuseCtrlStruc.field.EFSROM_AOUT == 0x3f) + { + for(i=0; i> (8*(Offset & 0x3)); + + NdisMoveMemory(pData, &data, Length); + } + + return (UCHAR) eFuseCtrlStruc.field.EFSROM_AOUT; + +} + +/* +======================================================================== + + Routine Description: + + Arguments: + + Return Value: + + Note: + +======================================================================== +*/ +VOID eFusePhysicalReadRegisters( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN USHORT Length, + OUT USHORT* pData) +{ + EFUSE_CTRL_STRUC eFuseCtrlStruc; + int i; + USHORT efuseDataOffset; + UINT32 data; + + RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); + + //Step0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. + eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0; + + //Step1. Write EFSROM_MODE (0x580, bit7:bit6) to 1. + //Read in physical view + eFuseCtrlStruc.field.EFSROM_MODE = 1; + + //Step2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure. + eFuseCtrlStruc.field.EFSROM_KICK = 1; + + NdisMoveMemory(&data, &eFuseCtrlStruc, 4); + RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); + + //Step3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. + i = 0; + while(i < 500) + { + RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); + if(eFuseCtrlStruc.field.EFSROM_KICK == 0) + break; + RTMPusecDelay(2); + i++; + } + + //Step4. Read 16-byte of data from EFUSE_DATA0-3 (0x59C-0x590) + //Because the size of each EFUSE_DATA is 4 Bytes, the size of address of each is 2 bits. + //The previous 2 bits is the EFUSE_DATA number, the last 2 bits is used to decide which bytes + //Decide which EFUSE_DATA to read + //590:F E D C + //594:B A 9 8 + //598:7 6 5 4 + //59C:3 2 1 0 + efuseDataOffset = EFUSE_DATA3 - (Offset & 0xC) ; + + RTMP_IO_READ32(pAd, efuseDataOffset, &data); + + data = data >> (8*(Offset & 0x3)); + + NdisMoveMemory(pData, &data, Length); + +} + +/* +======================================================================== + + Routine Description: + + Arguments: + + Return Value: + + Note: + +======================================================================== +*/ +static VOID eFuseReadPhysical( + IN PRTMP_ADAPTER pAd, + IN PUSHORT lpInBuffer, + IN ULONG nInBufferSize, + OUT PUSHORT lpOutBuffer, + IN ULONG nOutBufferSize +) +{ + USHORT* pInBuf = (USHORT*)lpInBuffer; + USHORT* pOutBuf = (USHORT*)lpOutBuffer; + + USHORT Offset = pInBuf[0]; //addr + USHORT Length = pInBuf[1]; //length + int i; + + for(i=0; i> 2; + data = pData[0] & 0xffff; + //The offset should be 0x***10 or 0x***00 + if((Offset % 4) != 0) + { + eFuseDataBuffer[efuseDataOffset] = (eFuseDataBuffer[efuseDataOffset] & 0xffff) | (data << 16); + } + else + { + eFuseDataBuffer[efuseDataOffset] = (eFuseDataBuffer[efuseDataOffset] & 0xffff0000) | data; + } + + efuseDataOffset = EFUSE_DATA3; + for(i=0; i< 4; i++) + { + RTMP_IO_WRITE32(pAd, efuseDataOffset, eFuseDataBuffer[i]); + efuseDataOffset -= 4; + } + ///////////////////////////////////////////////////////////////// + + //Step1. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. + + RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); + + eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0; + + //Step2. Write EFSROM_MODE (0x580, bit7:bit6) to 3. + eFuseCtrlStruc.field.EFSROM_MODE = 3; + + //Step3. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical write procedure. + eFuseCtrlStruc.field.EFSROM_KICK = 1; + + NdisMoveMemory(&data, &eFuseCtrlStruc, 4); + RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); + + //Step4. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. It¡¦s done. + i = 0; + + while(i < 500) + { + RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); + + if(eFuseCtrlStruc.field.EFSROM_KICK == 0) + break; + + RTMPusecDelay(2); + i++; + } +} + +/* +======================================================================== + + Routine Description: + + Arguments: + + Return Value: + + Note: + +======================================================================== +*/ +static NTSTATUS eFuseWriteRegisters( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN USHORT Length, + IN USHORT* pData) +{ + USHORT i,Loop=0; + USHORT eFuseData; + USHORT LogicalAddress, BlkNum = 0xffff; + UCHAR EFSROM_AOUT; + + USHORT addr,tmpaddr, InBuf[3], tmpOffset; + USHORT buffer[8]; + BOOLEAN bWriteSuccess = TRUE; + + DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters Offset=%x, pData=%x\n", Offset, *pData)); + + //Step 0. find the entry in the mapping table + //The address of EEPROM is 2-bytes alignment. + //The last bit is used for alignment, so it must be 0. + tmpOffset = Offset & 0xfffe; + EFSROM_AOUT = eFuseReadRegisters(pAd, tmpOffset, 2, &eFuseData); + + if( EFSROM_AOUT == 0x3f) + { //find available logical address pointer + //the logical address does not exist, find an empty one + //from the first address of block 45=16*45=0x2d0 to the last address of block 47 + //==>48*16-3(reserved)=2FC + for (i=EFUSE_USAGE_MAP_START; i<=EFUSE_USAGE_MAP_END; i+=2) + { + //Retrive the logical block nubmer form each logical address pointer + //It will access two logical address pointer each time. + eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); + if( (LogicalAddress & 0xff) == 0) + {//Not used logical address pointer + BlkNum = i-EFUSE_USAGE_MAP_START; + break; + } + else if(( (LogicalAddress >> 8) & 0xff) == 0) + {//Not used logical address pointer + if (i != EFUSE_USAGE_MAP_END) + { + BlkNum = i-EFUSE_USAGE_MAP_START+1; + } + break; + } + } + } + else + { + BlkNum = EFSROM_AOUT; + } + + DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters BlkNum = %d \n", BlkNum)); + + if(BlkNum == 0xffff) + { + DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters: out of free E-fuse space!!!\n")); + return FALSE; + } + + //Step 1. Save data of this block which is pointed by the avaible logical address pointer + // read and save the original block data + for(i =0; i<8; i++) + { + addr = BlkNum * 0x10 ; + + InBuf[0] = addr+2*i; + InBuf[1] = 2; + InBuf[2] = 0x0; + + eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); + + buffer[i] = InBuf[2]; + } + + //Step 2. Update the data in buffer, and write the data to Efuse + buffer[ (Offset >> 1) % 8] = pData[0]; + + do + { Loop++; + //Step 3. Write the data to Efuse + if(!bWriteSuccess) + { + for(i =0; i<8; i++) + { + addr = BlkNum * 0x10 ; + + InBuf[0] = addr+2*i; + InBuf[1] = 2; + InBuf[2] = buffer[i]; + + eFuseWritePhysical(pAd, &InBuf[0], 6, NULL, 2); + } + } + else + { + addr = BlkNum * 0x10 ; + + InBuf[0] = addr+(Offset % 16); + InBuf[1] = 2; + InBuf[2] = pData[0]; + + eFuseWritePhysical(pAd, &InBuf[0], 6, NULL, 2); + } + + //Step 4. Write mapping table + addr = EFUSE_USAGE_MAP_START+BlkNum; + + tmpaddr = addr; + + if(addr % 2 != 0) + addr = addr -1; + InBuf[0] = addr; + InBuf[1] = 2; + + //convert the address from 10 to 8 bit ( bit7, 6 = parity and bit5 ~ 0 = bit9~4), and write to logical map entry + tmpOffset = Offset; + tmpOffset >>= 4; + tmpOffset |= ((~((tmpOffset & 0x01) ^ ( tmpOffset >> 1 & 0x01) ^ (tmpOffset >> 2 & 0x01) ^ (tmpOffset >> 3 & 0x01))) << 6) & 0x40; + tmpOffset |= ((~( (tmpOffset >> 2 & 0x01) ^ (tmpOffset >> 3 & 0x01) ^ (tmpOffset >> 4 & 0x01) ^ ( tmpOffset >> 5 & 0x01))) << 7) & 0x80; + + // write the logical address + if(tmpaddr%2 != 0) + InBuf[2] = tmpOffset<<8; + else + InBuf[2] = tmpOffset; + + eFuseWritePhysical(pAd,&InBuf[0], 6, NULL, 0); + + //Step 5. Compare data if not the same, invalidate the mapping entry, then re-write the data until E-fuse is exhausted + bWriteSuccess = TRUE; + for(i =0; i<8; i++) + { + addr = BlkNum * 0x10 ; + + InBuf[0] = addr+2*i; + InBuf[1] = 2; + InBuf[2] = 0x0; + + eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); + + if(buffer[i] != InBuf[2]) + { + bWriteSuccess = FALSE; + break; + } + } + + //Step 6. invlidate mapping entry and find a free mapping entry if not succeed + if (!bWriteSuccess) + { + DBGPRINT(RT_DEBUG_TRACE, ("Not bWriteSuccess BlkNum = %d\n", BlkNum)); + + // the offset of current mapping entry + addr = EFUSE_USAGE_MAP_START+BlkNum; + + //find a new mapping entry + BlkNum = 0xffff; + for (i=EFUSE_USAGE_MAP_START; i<=EFUSE_USAGE_MAP_END; i+=2) + { + eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); + if( (LogicalAddress & 0xff) == 0) + { + BlkNum = i-EFUSE_USAGE_MAP_START; + break; + } + else if(( (LogicalAddress >> 8) & 0xff) == 0) + { + if (i != EFUSE_USAGE_MAP_END) + { + BlkNum = i+1-EFUSE_USAGE_MAP_START; + } + break; + } + } + DBGPRINT(RT_DEBUG_TRACE, ("Not bWriteSuccess new BlkNum = %d\n", BlkNum)); + if(BlkNum == 0xffff) + { + DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters: out of free E-fuse space!!!\n")); + return FALSE; + } + + //invalidate the original mapping entry if new entry is not found + tmpaddr = addr; + + if(addr % 2 != 0) + addr = addr -1; + InBuf[0] = addr; + InBuf[1] = 2; + + eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); + + // write the logical address + if(tmpaddr%2 != 0) + { + // Invalidate the high byte + for (i=8; i<15; i++) + { + if( ( (InBuf[2] >> i) & 0x01) == 0) + { + InBuf[2] |= (0x1 <> i) & 0x01) == 0) + { + InBuf[2] |= (0x1 <bUseEfuse) + return FALSE; + for (i = EFUSE_USAGE_MAP_START; i <= EFUSE_USAGE_MAP_END; i+=2) + { + eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); + if( (LogicalAddress & 0xff) == 0) + { + efusefreenum= (UCHAR) (EFUSE_USAGE_MAP_END-i+1); + break; + } + else if(( (LogicalAddress >> 8) & 0xff) == 0) + { + efusefreenum = (UCHAR) (EFUSE_USAGE_MAP_END-i); + break; + } + + if(i == EFUSE_USAGE_MAP_END) + efusefreenum = 0; + } + printk("efuseFreeNumber is %d\n",efusefreenum); + return TRUE; +} + + +INT set_eFusedump_Proc( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg) +{ +USHORT InBuf[3]; + INT i=0; + if(!pAd->bUseEfuse) + return FALSE; + for(i =0; i0) + NdisMoveMemory(src, arg, strlen(arg)); + else + NdisMoveMemory(src, EFUSE_EEPROM_DEFULT_FILE, strlen(EFUSE_EEPROM_DEFULT_FILE)); + DBGPRINT(RT_DEBUG_TRACE, ("FileName=%s\n",src)); + + RtmpOSFSInfoChange(&osfsInfo, TRUE); + + srcf = RtmpOSFileOpen(src, O_RDONLY, 0); + if (IS_FILE_OPEN_ERR(srcf)) + { + DBGPRINT(RT_DEBUG_ERROR, ("--> Error opening file %s\n", src)); + retval = FALSE; + goto recoverFS; + } + else + { + // The object must have a read method + while(RtmpOSFileRead(srcf, &buffer[i], 1)==1) + { + i++; + if(i>MAX_EEPROM_BIN_FILE_SIZE) + { + DBGPRINT(RT_DEBUG_ERROR, ("--> Error reading file %s, file size too large[>%d]\n", src, MAX_EEPROM_BIN_FILE_SIZE)); + retval = FALSE; + goto closeFile; + } + } + + retval = RtmpOSFileClose(srcf); + if (retval) + DBGPRINT(RT_DEBUG_TRACE, ("--> Error closing file %s\n", src)); + } + + + RtmpOSFSInfoChange(&osfsInfo, FALSE); + + for(j=0;j48*16-3(reserved)=2FC + bAllocateNewBlk=TRUE; + for (i=EFUSE_USAGE_MAP_START; i<=EFUSE_USAGE_MAP_END; i+=2) + { + //Retrive the logical block nubmer form each logical address pointer + //It will access two logical address pointer each time. + eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); + if( (LogicalAddress & 0xff) == 0) + {//Not used logical address pointer + BlkNum = i-EFUSE_USAGE_MAP_START; + break; + } + else if(( (LogicalAddress >> 8) & 0xff) == 0) + {//Not used logical address pointer + if (i != EFUSE_USAGE_MAP_END) + { + BlkNum = i-EFUSE_USAGE_MAP_START+1; + } + break; + } + } + } + else + { + bAllocateNewBlk=FALSE; + BlkNum = EFSROM_AOUT; + } + + DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters BlkNum = %d \n", BlkNum)); + + if(BlkNum == 0xffff) + { + DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters: out of free E-fuse space!!!\n")); + return FALSE; + } + //Step 1.1.0 + //If the block is not existing in mapping table, create one + //and write down the 16-bytes data to the new block + if(bAllocateNewBlk) + { + DBGPRINT(RT_DEBUG_TRACE, ("Allocate New Blk\n")); + efuseDataOffset = EFUSE_DATA3; + for(i=0; i< 4; i++) + { + DBGPRINT(RT_DEBUG_TRACE, ("Allocate New Blk, Data%d=%04x%04x\n",3-i,pData[2*i+1],pData[2*i])); + tempbuffer=((pData[2*i+1]<<16)&0xffff0000)|pData[2*i]; + + + RTMP_IO_WRITE32(pAd, efuseDataOffset,tempbuffer); + efuseDataOffset -= 4; + + } + ///////////////////////////////////////////////////////////////// + + //Step1.1.1. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. + RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); + eFuseCtrlStruc.field.EFSROM_AIN = BlkNum* 0x10 ; + + //Step1.1.2. Write EFSROM_MODE (0x580, bit7:bit6) to 3. + eFuseCtrlStruc.field.EFSROM_MODE = 3; + + //Step1.1.3. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical write procedure. + eFuseCtrlStruc.field.EFSROM_KICK = 1; + + NdisMoveMemory(&data, &eFuseCtrlStruc, 4); + + RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); + + //Step1.1.4. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. It¡¦s done. + i = 0; + while(i < 100) + { + RTMP_IO_READ32(pAd, EFUSE_CTRL, (PUINT32) &eFuseCtrlStruc); + + if(eFuseCtrlStruc.field.EFSROM_KICK == 0) + break; + + RTMPusecDelay(2); + i++; + } + + } + else + { //Step1.2. + //If the same logical number is existing, check if the writting data and the data + //saving in this block are the same. + ///////////////////////////////////////////////////////////////// + //read current values of 16-byte block + RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); + + //Step1.2.0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. + eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0; + + //Step1.2.1. Write EFSROM_MODE (0x580, bit7:bit6) to 1. + eFuseCtrlStruc.field.EFSROM_MODE = 0; + + //Step1.2.2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure. + eFuseCtrlStruc.field.EFSROM_KICK = 1; + + NdisMoveMemory(&data, &eFuseCtrlStruc, 4); + RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); + + //Step1.2.3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. + i = 0; + while(i < 500) + { + RTMP_IO_READ32(pAd, EFUSE_CTRL, (PUINT32) &eFuseCtrlStruc); + + if(eFuseCtrlStruc.field.EFSROM_KICK == 0) + break; + RTMPusecDelay(2); + i++; + } + + //Step1.2.4. Read 16-byte of data from EFUSE_DATA0-3 (0x59C-0x590) + efuseDataOffset = EFUSE_DATA3; + for(i=0; i< 4; i++) + { + RTMP_IO_READ32(pAd, efuseDataOffset, (PUINT32) &buffer[i]); + efuseDataOffset -= 4; + } + //Step1.2.5. Check if the data of efuse and the writing data are the same. + for(i =0; i<4; i++) + { + tempbuffer=((pData[2*i+1]<<16)&0xffff0000)|pData[2*i]; + DBGPRINT(RT_DEBUG_TRACE, ("buffer[%d]=%x,pData[%d]=%x,pData[%d]=%x,tempbuffer=%x\n",i,buffer[i],2*i,pData[2*i],2*i+1,pData[2*i+1],tempbuffer)); + + if(((buffer[i]&0xffff0000)==(pData[2*i+1]<<16))&&((buffer[i]&0xffff)==pData[2*i])) + bNotWrite&=TRUE; + else + { + bNotWrite&=FALSE; + break; + } + } + if(!bNotWrite) + { + printk("The data is not the same\n"); + + for(i =0; i<8; i++) + { + addr = BlkNum * 0x10 ; + + InBuf[0] = addr+2*i; + InBuf[1] = 2; + InBuf[2] = pData[i]; + + eFuseWritePhysical(pAd, &InBuf[0], 6, NULL, 2); + } + + } + else + return TRUE; + } + + + + //Step 2. Write mapping table + addr = EFUSE_USAGE_MAP_START+BlkNum; + + tmpaddr = addr; + + if(addr % 2 != 0) + addr = addr -1; + InBuf[0] = addr; + InBuf[1] = 2; + + //convert the address from 10 to 8 bit ( bit7, 6 = parity and bit5 ~ 0 = bit9~4), and write to logical map entry + tmpOffset = Offset; + tmpOffset >>= 4; + tmpOffset |= ((~((tmpOffset & 0x01) ^ ( tmpOffset >> 1 & 0x01) ^ (tmpOffset >> 2 & 0x01) ^ (tmpOffset >> 3 & 0x01))) << 6) & 0x40; + tmpOffset |= ((~( (tmpOffset >> 2 & 0x01) ^ (tmpOffset >> 3 & 0x01) ^ (tmpOffset >> 4 & 0x01) ^ ( tmpOffset >> 5 & 0x01))) << 7) & 0x80; + + // write the logical address + if(tmpaddr%2 != 0) + InBuf[2] = tmpOffset<<8; + else + InBuf[2] = tmpOffset; + + eFuseWritePhysical(pAd,&InBuf[0], 6, NULL, 0); + + //Step 3. Compare data if not the same, invalidate the mapping entry, then re-write the data until E-fuse is exhausted + bWriteSuccess = TRUE; + for(i =0; i<8; i++) + { + addr = BlkNum * 0x10 ; + + InBuf[0] = addr+2*i; + InBuf[1] = 2; + InBuf[2] = 0x0; + + eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); + DBGPRINT(RT_DEBUG_TRACE, ("addr=%x, buffer[i]=%x,InBuf[2]=%x\n",InBuf[0],pData[i],InBuf[2])); + if(pData[i] != InBuf[2]) + { + bWriteSuccess = FALSE; + break; + } + } + + //Step 4. invlidate mapping entry and find a free mapping entry if not succeed + + if (!bWriteSuccess&&Loop<2) + { + DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegistersFromBin::Not bWriteSuccess BlkNum = %d\n", BlkNum)); + + // the offset of current mapping entry + addr = EFUSE_USAGE_MAP_START+BlkNum; + + //find a new mapping entry + BlkNum = 0xffff; + for (i=EFUSE_USAGE_MAP_START; i<=EFUSE_USAGE_MAP_END; i+=2) + { + eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); + if( (LogicalAddress & 0xff) == 0) + { + BlkNum = i-EFUSE_USAGE_MAP_START; + break; + } + else if(( (LogicalAddress >> 8) & 0xff) == 0) + { + if (i != EFUSE_USAGE_MAP_END) + { + BlkNum = i+1-EFUSE_USAGE_MAP_START; + } + break; + } + } + DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegistersFromBin::Not bWriteSuccess new BlkNum = %d\n", BlkNum)); + if(BlkNum == 0xffff) + { + DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegistersFromBin: out of free E-fuse space!!!\n")); + return FALSE; + } + + //invalidate the original mapping entry if new entry is not found + tmpaddr = addr; + + if(addr % 2 != 0) + addr = addr -1; + InBuf[0] = addr; + InBuf[1] = 2; + + eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); + + // write the logical address + if(tmpaddr%2 != 0) + { + // Invalidate the high byte + for (i=8; i<15; i++) + { + if( ( (InBuf[2] >> i) & 0x01) == 0) + { + InBuf[2] |= (0x1 <> i) & 0x01) == 0) + { + InBuf[2] |= (0x1 <bFroceEEPROMBuffer || pAd->bEEPROMFile) + { + DBGPRINT(RT_DEBUG_TRACE, ("Read from EEPROM Buffer\n")); + NdisMoveMemory(pValue, &(pAd->EEPROMImage[Offset]), 2); + } + else + eFuseReadRegisters(pAd, Offset, 2, pValue); + return (*pValue); +} + + +int rtmp_ee_efuse_write16( + IN RTMP_ADAPTER *pAd, + IN USHORT Offset, + IN USHORT data) +{ + if(pAd->bFroceEEPROMBuffer||pAd->bEEPROMFile) + { + DBGPRINT(RT_DEBUG_TRACE, ("Write to EEPROM Buffer\n")); + NdisMoveMemory(&(pAd->EEPROMImage[Offset]), &data, 2); + } + else + eFuseWriteRegisters(pAd, Offset, 2, &data); + return 0; +} + + +int RtmpEfuseSupportCheck( + IN RTMP_ADAPTER *pAd) +{ + USHORT value; + + if (IS_RT30xx(pAd)) + { + eFusePhysicalReadRegisters(pAd, EFUSE_TAG, 2, &value); + pAd->EFuseTag = (value & 0xff); + } + return 0; +} + +INT set_eFuseBufferModeWriteBack_Proc( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg) +{ + UINT Enable; + + + if(strlen(arg)>0) + { + Enable= simple_strtol(arg, 0, 16); + } + else + return FALSE; + if(Enable==1) + { + DBGPRINT(RT_DEBUG_TRACE, ("set_eFuseBufferMode_Proc:: Call WRITEEEPROMBUF")); + eFuseWriteEeeppromBuf(pAd); + } + else + return FALSE; + return TRUE; +} + + +/* + ======================================================================== + + Routine Description: + Load EEPROM from bin file for eFuse mode + + Arguments: + Adapter Pointer to our adapter + + Return Value: + NDIS_STATUS_SUCCESS firmware image load ok + NDIS_STATUS_FAILURE image not found + + IRQL = PASSIVE_LEVEL + + ======================================================================== +*/ +INT eFuseLoadEEPROM( + IN PRTMP_ADAPTER pAd) +{ + PSTRING src = NULL; + INT retval; + RTMP_OS_FD srcf; + RTMP_OS_FS_INFO osFSInfo; + + + src=EFUSE_BUFFER_PATH; + DBGPRINT(RT_DEBUG_TRACE, ("FileName=%s\n",src)); + + + RtmpOSFSInfoChange(&osFSInfo, TRUE); + + if (src && *src) + { + srcf = RtmpOSFileOpen(src, O_RDONLY, 0); + if (IS_FILE_OPEN_ERR(srcf)) + { + DBGPRINT(RT_DEBUG_ERROR, ("--> Error %ld opening %s\n", -PTR_ERR(srcf),src)); + return FALSE; + } + else + { + + memset(pAd->EEPROMImage, 0x00, MAX_EEPROM_BIN_FILE_SIZE); + + + retval =RtmpOSFileRead(srcf, (PSTRING)pAd->EEPROMImage, MAX_EEPROM_BIN_FILE_SIZE); + if (retval > 0) + { + RTMPSetProfileParameters(pAd, (PSTRING)pAd->EEPROMImage); + retval = NDIS_STATUS_SUCCESS; + } + else + DBGPRINT(RT_DEBUG_ERROR, ("Read file \"%s\" failed(errCode=%d)!\n", src, retval)); + + } + + + } + else + { + DBGPRINT(RT_DEBUG_ERROR, ("--> Error src or srcf is null\n")); + return FALSE; + + } + + retval=RtmpOSFileClose(srcf); + + if (retval) + { + DBGPRINT(RT_DEBUG_TRACE, ("--> Error %d closing %s\n", -retval, src)); + } + + + RtmpOSFSInfoChange(&osFSInfo, FALSE); + + return TRUE; +} + +INT eFuseWriteEeeppromBuf( + IN PRTMP_ADAPTER pAd) +{ + + PSTRING src = NULL; + INT retval; + RTMP_OS_FD srcf; + RTMP_OS_FS_INFO osFSInfo; + + + src=EFUSE_BUFFER_PATH; + DBGPRINT(RT_DEBUG_TRACE, ("FileName=%s\n",src)); + + RtmpOSFSInfoChange(&osFSInfo, TRUE); + + + + if (src && *src) + { + srcf = RtmpOSFileOpen(src, O_WRONLY|O_CREAT, 0); + + if (IS_FILE_OPEN_ERR(srcf)) + { + DBGPRINT(RT_DEBUG_ERROR, ("--> Error %ld opening %s\n", -PTR_ERR(srcf),src)); + return FALSE; + } + else + { +/* + // The object must have a read method + if (srcf->f_op && srcf->f_op->write) + { + // The object must have a read method + srcf->f_op->write(srcf, pAd->EEPROMImage, 1024, &srcf->f_pos); + + } + else + { + DBGPRINT(RT_DEBUG_ERROR, ("--> Error!! System doest not support read function\n")); + return FALSE; + } +*/ + + RtmpOSFileWrite(srcf, (PSTRING)pAd->EEPROMImage,MAX_EEPROM_BIN_FILE_SIZE); + + } + + + } + else + { + DBGPRINT(RT_DEBUG_ERROR, ("--> Error src or srcf is null\n")); + return FALSE; + + } + + retval=RtmpOSFileClose(srcf); + + if (retval) + { + DBGPRINT(RT_DEBUG_TRACE, ("--> Error %d closing %s\n", -retval, src)); + } + + RtmpOSFSInfoChange(&osFSInfo, FALSE); + return TRUE; +} + + +VOID eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, + PUINT EfuseFreeBlock) +{ + USHORT i; + USHORT LogicalAddress; + if(!pAd->bUseEfuse) + { + DBGPRINT(RT_DEBUG_TRACE,("eFuseGetFreeBlockCount Only supports efuse Mode\n")); + return ; + } + for (i = EFUSE_USAGE_MAP_START; i <= EFUSE_USAGE_MAP_END; i+=2) + { + eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); + if( (LogicalAddress & 0xff) == 0) + { + *EfuseFreeBlock= (UCHAR) (EFUSE_USAGE_MAP_END-i+1); + break; + } + else if(( (LogicalAddress >> 8) & 0xff) == 0) + { + *EfuseFreeBlock = (UCHAR) (EFUSE_USAGE_MAP_END-i); + break; + } + + if(i == EFUSE_USAGE_MAP_END) + *EfuseFreeBlock = 0; + } + DBGPRINT(RT_DEBUG_TRACE,("eFuseGetFreeBlockCount is 0x%x\n",*EfuseFreeBlock)); +} + +INT eFuse_init( + IN PRTMP_ADAPTER pAd) +{ + UINT EfuseFreeBlock=0; + DBGPRINT(RT_DEBUG_ERROR, ("NVM is Efuse and its size =%x[%x-%x] \n",EFUSE_USAGE_MAP_SIZE,EFUSE_USAGE_MAP_START,EFUSE_USAGE_MAP_END)); + eFuseGetFreeBlockCount(pAd, &EfuseFreeBlock); + //If the used block of efuse is less than 5. We assume the default value + // of this efuse is empty and change to the buffer mode in odrder to + //bring up interfaces successfully. + if(EfuseFreeBlock > (EFUSE_USAGE_MAP_END-5)) + { + DBGPRINT(RT_DEBUG_ERROR, ("NVM is Efuse and the information is too less to bring up interface. Force to use EEPROM Buffer Mode\n")); + pAd->bFroceEEPROMBuffer = TRUE; + eFuseLoadEEPROM(pAd); + } + else + pAd->bFroceEEPROMBuffer = FALSE; + DBGPRINT(RT_DEBUG_TRACE, ("NVM is Efuse and force to use EEPROM Buffer Mode=%x\n",pAd->bFroceEEPROMBuffer)); + + return 0; +} diff --git a/drivers/staging/rt2860/common/ee_prom.c b/drivers/staging/rt2860/common/ee_prom.c new file mode 100644 index 000000000000..9ebff8b9e568 --- /dev/null +++ b/drivers/staging/rt2860/common/ee_prom.c @@ -0,0 +1,270 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + ee_prom.c + + Abstract: + Miniport generic portion header file + + Revision History: + Who When What + -------- ---------- ---------------------------------------------- +*/ + + +#include "../rt_config.h" + + + +// IRQL = PASSIVE_LEVEL +static inline VOID RaiseClock( + IN PRTMP_ADAPTER pAd, + IN UINT32 *x) +{ + *x = *x | EESK; + RTMP_IO_WRITE32(pAd, E2PROM_CSR, *x); + RTMPusecDelay(1); // Max frequency = 1MHz in Spec. definition +} + +// IRQL = PASSIVE_LEVEL +static inline VOID LowerClock( + IN PRTMP_ADAPTER pAd, + IN UINT32 *x) +{ + *x = *x & ~EESK; + RTMP_IO_WRITE32(pAd, E2PROM_CSR, *x); + RTMPusecDelay(1); +} + +// IRQL = PASSIVE_LEVEL +static inline USHORT ShiftInBits( + IN PRTMP_ADAPTER pAd) +{ + UINT32 x,i; + USHORT data=0; + + RTMP_IO_READ32(pAd, E2PROM_CSR, &x); + + x &= ~( EEDO | EEDI); + + for(i=0; i<16; i++) + { + data = data << 1; + RaiseClock(pAd, &x); + + RTMP_IO_READ32(pAd, E2PROM_CSR, &x); + LowerClock(pAd, &x); //prevent read failed + + x &= ~(EEDI); + if(x & EEDO) + data |= 1; + } + + return data; +} + + +// IRQL = PASSIVE_LEVEL +static inline VOID ShiftOutBits( + IN PRTMP_ADAPTER pAd, + IN USHORT data, + IN USHORT count) +{ + UINT32 x,mask; + + mask = 0x01 << (count - 1); + RTMP_IO_READ32(pAd, E2PROM_CSR, &x); + + x &= ~(EEDO | EEDI); + + do + { + x &= ~EEDI; + if(data & mask) x |= EEDI; + + RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); + + RaiseClock(pAd, &x); + LowerClock(pAd, &x); + + mask = mask >> 1; + } while(mask); + + x &= ~EEDI; + RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); +} + + +// IRQL = PASSIVE_LEVEL +static inline VOID EEpromCleanup( + IN PRTMP_ADAPTER pAd) +{ + UINT32 x; + + RTMP_IO_READ32(pAd, E2PROM_CSR, &x); + + x &= ~(EECS | EEDI); + RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); + + RaiseClock(pAd, &x); + LowerClock(pAd, &x); +} + + +static inline VOID EWEN( + IN PRTMP_ADAPTER pAd) +{ + UINT32 x; + + // reset bits and set EECS + RTMP_IO_READ32(pAd, E2PROM_CSR, &x); + x &= ~(EEDI | EEDO | EESK); + x |= EECS; + RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); + + // kick a pulse + RaiseClock(pAd, &x); + LowerClock(pAd, &x); + + // output the read_opcode and six pulse in that order + ShiftOutBits(pAd, EEPROM_EWEN_OPCODE, 5); + ShiftOutBits(pAd, 0, 6); + + EEpromCleanup(pAd); +} + + +static inline VOID EWDS( + IN PRTMP_ADAPTER pAd) +{ + UINT32 x; + + // reset bits and set EECS + RTMP_IO_READ32(pAd, E2PROM_CSR, &x); + x &= ~(EEDI | EEDO | EESK); + x |= EECS; + RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); + + // kick a pulse + RaiseClock(pAd, &x); + LowerClock(pAd, &x); + + // output the read_opcode and six pulse in that order + ShiftOutBits(pAd, EEPROM_EWDS_OPCODE, 5); + ShiftOutBits(pAd, 0, 6); + + EEpromCleanup(pAd); +} + + +// IRQL = PASSIVE_LEVEL +int rtmp_ee_prom_read16( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + OUT USHORT *pValue) +{ + UINT32 x; + USHORT data; + + + Offset /= 2; + // reset bits and set EECS + RTMP_IO_READ32(pAd, E2PROM_CSR, &x); + x &= ~(EEDI | EEDO | EESK); + x |= EECS; + RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); + + // patch can not access e-Fuse issue + if (!(IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) + { + // kick a pulse + RaiseClock(pAd, &x); + LowerClock(pAd, &x); + } + + // output the read_opcode and register number in that order + ShiftOutBits(pAd, EEPROM_READ_OPCODE, 3); + ShiftOutBits(pAd, Offset, pAd->EEPROMAddressNum); + + // Now read the data (16 bits) in from the selected EEPROM word + data = ShiftInBits(pAd); + + EEpromCleanup(pAd); + + + *pValue = data; + + return NDIS_STATUS_SUCCESS; +} + + +int rtmp_ee_prom_write16( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN USHORT Data) +{ + UINT32 x; + + + Offset /= 2; + + EWEN(pAd); + + // reset bits and set EECS + RTMP_IO_READ32(pAd, E2PROM_CSR, &x); + x &= ~(EEDI | EEDO | EESK); + x |= EECS; + RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); + + // patch can not access e-Fuse issue + if (!(IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) + { + // kick a pulse + RaiseClock(pAd, &x); + LowerClock(pAd, &x); + } + + // output the read_opcode ,register number and data in that order + ShiftOutBits(pAd, EEPROM_WRITE_OPCODE, 3); + ShiftOutBits(pAd, Offset, pAd->EEPROMAddressNum); + ShiftOutBits(pAd, Data, 16); // 16-bit access + + // read DO status + RTMP_IO_READ32(pAd, E2PROM_CSR, &x); + + EEpromCleanup(pAd); + + RTMPusecDelay(10000); //delay for twp(MAX)=10ms + + EWDS(pAd); + + EEpromCleanup(pAd); + + + return NDIS_STATUS_SUCCESS; + +} diff --git a/drivers/staging/rt2860/common/eeprom.c b/drivers/staging/rt2860/common/eeprom.c index ffcb4ce1a034..03b8454bf74f 100644 --- a/drivers/staging/rt2860/common/eeprom.c +++ b/drivers/staging/rt2860/common/eeprom.c @@ -36,1444 +36,68 @@ */ #include "../rt_config.h" -// IRQL = PASSIVE_LEVEL -VOID RaiseClock( - IN PRTMP_ADAPTER pAd, - IN UINT32 *x) -{ - *x = *x | EESK; - RTMP_IO_WRITE32(pAd, E2PROM_CSR, *x); - RTMPusecDelay(1); // Max frequency = 1MHz in Spec. definition -} - -// IRQL = PASSIVE_LEVEL -VOID LowerClock( - IN PRTMP_ADAPTER pAd, - IN UINT32 *x) -{ - *x = *x & ~EESK; - RTMP_IO_WRITE32(pAd, E2PROM_CSR, *x); - RTMPusecDelay(1); -} - -// IRQL = PASSIVE_LEVEL -USHORT ShiftInBits( - IN PRTMP_ADAPTER pAd) -{ - UINT32 x,i; - USHORT data=0; - - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - - x &= ~( EEDO | EEDI); - - for(i=0; i<16; i++) - { - data = data << 1; - RaiseClock(pAd, &x); - - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - - LowerClock(pAd, &x); /* prevent read failed */ - - x &= ~(EEDI); - if(x & EEDO) - data |= 1; - } - - return data; -} - -// IRQL = PASSIVE_LEVEL -VOID ShiftOutBits( - IN PRTMP_ADAPTER pAd, - IN USHORT data, - IN USHORT count) -{ - UINT32 x,mask; - - mask = 0x01 << (count - 1); - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - - x &= ~(EEDO | EEDI); - - do - { - x &= ~EEDI; - if(data & mask) x |= EEDI; - - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - - RaiseClock(pAd, &x); - LowerClock(pAd, &x); - - mask = mask >> 1; - } while(mask); - - x &= ~EEDI; - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); -} - -// IRQL = PASSIVE_LEVEL -VOID EEpromCleanup( - IN PRTMP_ADAPTER pAd) -{ - UINT32 x; - - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - - x &= ~(EECS | EEDI); - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - - RaiseClock(pAd, &x); - LowerClock(pAd, &x); -} - -VOID EWEN( - IN PRTMP_ADAPTER pAd) -{ - UINT32 x; - - // reset bits and set EECS - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - x &= ~(EEDI | EEDO | EESK); - x |= EECS; - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - - // kick a pulse - RaiseClock(pAd, &x); - LowerClock(pAd, &x); - - // output the read_opcode and six pulse in that order - ShiftOutBits(pAd, EEPROM_EWEN_OPCODE, 5); - ShiftOutBits(pAd, 0, 6); - - EEpromCleanup(pAd); -} - -VOID EWDS( - IN PRTMP_ADAPTER pAd) -{ - UINT32 x; - - // reset bits and set EECS - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - x &= ~(EEDI | EEDO | EESK); - x |= EECS; - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - - // kick a pulse - RaiseClock(pAd, &x); - LowerClock(pAd, &x); - - // output the read_opcode and six pulse in that order - ShiftOutBits(pAd, EEPROM_EWDS_OPCODE, 5); - ShiftOutBits(pAd, 0, 6); - - EEpromCleanup(pAd); -} - -// IRQL = PASSIVE_LEVEL -USHORT RTMP_EEPROM_READ16( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset) -{ - UINT32 x; - USHORT data; - -#ifdef RT2870 - if (pAd->NicConfig2.field.AntDiversity) - { - pAd->EepromAccess = TRUE; - } -#endif - Offset /= 2; - // reset bits and set EECS - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - x &= ~(EEDI | EEDO | EESK); - x |= EECS; - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - - // patch can not access e-Fuse issue - if (!IS_RT3090(pAd)) - { - // kick a pulse - RaiseClock(pAd, &x); - LowerClock(pAd, &x); - } - - // output the read_opcode and register number in that order - ShiftOutBits(pAd, EEPROM_READ_OPCODE, 3); - ShiftOutBits(pAd, Offset, pAd->EEPROMAddressNum); - - // Now read the data (16 bits) in from the selected EEPROM word - data = ShiftInBits(pAd); - - EEpromCleanup(pAd); - -#ifdef RT2870 - // Antenna and EEPROM access are both using EESK pin, - // Therefor we should avoid accessing EESK at the same time - // Then restore antenna after EEPROM access - if ((pAd->NicConfig2.field.AntDiversity) || (pAd->RfIcType == RFIC_3020)) - { - pAd->EepromAccess = FALSE; - AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); - } -#endif - return data; -} //ReadEEprom - -VOID RTMP_EEPROM_WRITE16( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Data) -{ - UINT32 x; - -#ifdef RT2870 - if (pAd->NicConfig2.field.AntDiversity) - { - pAd->EepromAccess = TRUE; - } -#endif - Offset /= 2; - - EWEN(pAd); - - // reset bits and set EECS - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - x &= ~(EEDI | EEDO | EESK); - x |= EECS; - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - - // patch can not access e-Fuse issue - if (!IS_RT3090(pAd)) - { - // kick a pulse - RaiseClock(pAd, &x); - LowerClock(pAd, &x); - } - - // output the read_opcode ,register number and data in that order - ShiftOutBits(pAd, EEPROM_WRITE_OPCODE, 3); - ShiftOutBits(pAd, Offset, pAd->EEPROMAddressNum); - ShiftOutBits(pAd, Data, 16); // 16-bit access - - // read DO status - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - - EEpromCleanup(pAd); - - RTMPusecDelay(10000); //delay for twp(MAX)=10ms - - EWDS(pAd); - - EEpromCleanup(pAd); - -#ifdef RT2870 - // Antenna and EEPROM access are both using EESK pin, - // Therefor we should avoid accessing EESK at the same time - // Then restore antenna after EEPROM access - if ((pAd->NicConfig2.field.AntDiversity) || (pAd->RfIcType == RFIC_3020)) - { - pAd->EepromAccess = FALSE; - AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); - } -#endif -} - -#ifdef RT2870 -/* - ======================================================================== - - Routine Description: - - Arguments: - - Return Value: - - IRQL = - - Note: - - ======================================================================== -*/ -UCHAR eFuseReadRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - OUT USHORT* pData) -{ - EFUSE_CTRL_STRUC eFuseCtrlStruc; - int i; - USHORT efuseDataOffset; - UINT32 data; - - RTMP_IO_READ32(pAd, EFUSE_CTRL, (PUINT32) &eFuseCtrlStruc); - - //Step0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. - //Use the eeprom logical address and covert to address to block number - eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0; - - //Step1. Write EFSROM_MODE (0x580, bit7:bit6) to 0. - eFuseCtrlStruc.field.EFSROM_MODE = 0; - - //Step2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure. - eFuseCtrlStruc.field.EFSROM_KICK = 1; - NdisMoveMemory(&data, &eFuseCtrlStruc, 4); - RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); - - //Step3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. - i = 0; - while(i < 100) - { - //rtmp.HwMemoryReadDword(EFUSE_CTRL, (DWORD *) &eFuseCtrlStruc, 4); - RTMP_IO_READ32(pAd, EFUSE_CTRL, (PUINT32) &eFuseCtrlStruc); - if(eFuseCtrlStruc.field.EFSROM_KICK == 0) - { - break; - } - RTMPusecDelay(2); - i++; - } - - //if EFSROM_AOUT is not found in physical address, write 0xffff - if (eFuseCtrlStruc.field.EFSROM_AOUT == 0x3f) - { - for(i=0; i> (8*(Offset & 0x3)); - - NdisMoveMemory(pData, &data, Length); - } - - return (UCHAR) eFuseCtrlStruc.field.EFSROM_AOUT; - -} - -/* - ======================================================================== - - Routine Description: - - Arguments: - - Return Value: - - IRQL = - - Note: - - ======================================================================== -*/ -VOID eFusePhysicalReadRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - OUT USHORT* pData) +INT RtmpChipOpsEepromHook( + IN RTMP_ADAPTER *pAd, + IN INT infType) { - EFUSE_CTRL_STRUC eFuseCtrlStruc; - int i; - USHORT efuseDataOffset; - UINT32 data; - - RTMP_IO_READ32(pAd, EFUSE_CTRL, (PUINT32) &eFuseCtrlStruc); - - //Step0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. - eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0; - - //Step1. Write EFSROM_MODE (0x580, bit7:bit6) to 1. - //Read in physical view - eFuseCtrlStruc.field.EFSROM_MODE = 1; - - //Step2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure. - eFuseCtrlStruc.field.EFSROM_KICK = 1; - - NdisMoveMemory(&data, &eFuseCtrlStruc, 4); - RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); - - //Step3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. - i = 0; - while(i < 100) - { - RTMP_IO_READ32(pAd, EFUSE_CTRL, (PUINT32) &eFuseCtrlStruc); - if(eFuseCtrlStruc.field.EFSROM_KICK == 0) - break; - RTMPusecDelay(2); - i++; - } - - //Step4. Read 16-byte of data from EFUSE_DATA0-3 (0x59C-0x590) - //Because the size of each EFUSE_DATA is 4 Bytes, the size of address of each is 2 bits. - //The previous 2 bits is the EFUSE_DATA number, the last 2 bits is used to decide which bytes - //Decide which EFUSE_DATA to read - //590:F E D C - //594:B A 9 8 - //598:7 6 5 4 - //59C:3 2 1 0 - efuseDataOffset = EFUSE_DATA3 - (Offset & 0xC) ; - - RTMP_IO_READ32(pAd, efuseDataOffset, &data); - - data = data >> (8*(Offset & 0x3)); - - NdisMoveMemory(pData, &data, Length); - -} - -/* - ======================================================================== - - Routine Description: - - Arguments: - - Return Value: - - IRQL = - - Note: - - ======================================================================== -*/ -VOID eFuseReadPhysical( - IN PRTMP_ADAPTER pAd, - IN PUSHORT lpInBuffer, - IN ULONG nInBufferSize, - OUT PUSHORT lpOutBuffer, - IN ULONG nOutBufferSize -) -{ - USHORT* pInBuf = (USHORT*)lpInBuffer; - USHORT* pOutBuf = (USHORT*)lpOutBuffer; - - USHORT Offset = pInBuf[0]; //addr - USHORT Length = pInBuf[1]; //length - int i; - - for(i=0; i> 2; - data = pData[0] & 0xffff; - //The offset should be 0x***10 or 0x***00 - if((Offset % 4) != 0) - { - eFuseDataBuffer[efuseDataOffset] = (eFuseDataBuffer[efuseDataOffset] & 0xffff) | (data << 16); - } - else - { - eFuseDataBuffer[efuseDataOffset] = (eFuseDataBuffer[efuseDataOffset] & 0xffff0000) | data; - } - - efuseDataOffset = EFUSE_DATA3; - for(i=0; i< 4; i++) - { - RTMP_IO_WRITE32(pAd, efuseDataOffset, eFuseDataBuffer[i]); - efuseDataOffset -= 4; - } - ///////////////////////////////////////////////////////////////// - - //Step1. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. - eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0; - - //Step2. Write EFSROM_MODE (0x580, bit7:bit6) to 3. - eFuseCtrlStruc.field.EFSROM_MODE = 3; - - //Step3. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical write procedure. - eFuseCtrlStruc.field.EFSROM_KICK = 1; - - NdisMoveMemory(&data, &eFuseCtrlStruc, 4); - RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); - - //Step4. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. It��s done. - i = 0; - while(i < 100) - { - RTMP_IO_READ32(pAd, EFUSE_CTRL, (PUINT32) &eFuseCtrlStruc); - - if(eFuseCtrlStruc.field.EFSROM_KICK == 0) - break; - - RTMPusecDelay(2); - i++; - } -} - -/* - ======================================================================== - - Routine Description: - - Arguments: - - Return Value: - - IRQL = - - Note: - - ======================================================================== -*/ -NTSTATUS eFuseWriteRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - IN USHORT* pData) -{ - USHORT i; - USHORT eFuseData; - USHORT LogicalAddress, BlkNum = 0xffff; - UCHAR EFSROM_AOUT; - - USHORT addr,tmpaddr, InBuf[3], tmpOffset; - USHORT buffer[8]; - BOOLEAN bWriteSuccess = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters Offset=%x, pData=%x\n", Offset, *pData)); - - //Step 0. find the entry in the mapping table - //The address of EEPROM is 2-bytes alignment. - //The last bit is used for alignment, so it must be 0. - tmpOffset = Offset & 0xfffe; - EFSROM_AOUT = eFuseReadRegisters(pAd, tmpOffset, 2, &eFuseData); - - if( EFSROM_AOUT == 0x3f) - { //find available logical address pointer - //the logical address does not exist, find an empty one - //from the first address of block 45=16*45=0x2d0 to the last address of block 47 - //==>48*16-3(reserved)=2FC - for (i=EFUSE_USAGE_MAP_START; i<=EFUSE_USAGE_MAP_END; i+=2) - { - //Retrive the logical block nubmer form each logical address pointer - //It will access two logical address pointer each time. - eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); - if( (LogicalAddress & 0xff) == 0) - {//Not used logical address pointer - BlkNum = i-EFUSE_USAGE_MAP_START; - break; - } - else if(( (LogicalAddress >> 8) & 0xff) == 0) - {//Not used logical address pointer - if (i != EFUSE_USAGE_MAP_END) - { - BlkNum = i-EFUSE_USAGE_MAP_START+1; - } - break; - } - } - } - else - { - BlkNum = EFSROM_AOUT; - } - - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters BlkNum = %d \n", BlkNum)); - - if(BlkNum == 0xffff) - { - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters: out of free E-fuse space!!!\n")); - return FALSE; - } - - //Step 1. Save data of this block which is pointed by the avaible logical address pointer - // read and save the original block data - for(i =0; i<8; i++) - { - addr = BlkNum * 0x10 ; - - InBuf[0] = addr+2*i; - InBuf[1] = 2; - InBuf[2] = 0x0; - - eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); - - buffer[i] = InBuf[2]; - } - - //Step 2. Update the data in buffer, and write the data to Efuse - buffer[ (Offset >> 1) % 8] = pData[0]; + RTMP_CHIP_OP *pChipOps = &pAd->chipOps; +#ifdef RT30xx +#ifdef RTMP_EFUSE_SUPPORT + UINT32 eFuseCtrl, MacCsr0; + int index; + index = 0; do { - //Step 3. Write the data to Efuse - if(!bWriteSuccess) - { - for(i =0; i<8; i++) - { - addr = BlkNum * 0x10 ; - - InBuf[0] = addr+2*i; - InBuf[1] = 2; - InBuf[2] = buffer[i]; - - eFuseWritePhysical(pAd, &InBuf[0], 6, NULL, 2); - } - } - else - { - addr = BlkNum * 0x10 ; - - InBuf[0] = addr+(Offset % 16); - InBuf[1] = 2; - InBuf[2] = pData[0]; - - eFuseWritePhysical(pAd, &InBuf[0], 6, NULL, 2); - } - - //Step 4. Write mapping table - addr = EFUSE_USAGE_MAP_START+BlkNum; - - tmpaddr = addr; + RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0); + pAd->MACVersion = MacCsr0; - if(addr % 2 != 0) - addr = addr -1; - InBuf[0] = addr; - InBuf[1] = 2; - - //convert the address from 10 to 8 bit ( bit7, 6 = parity and bit5 ~ 0 = bit9~4), and write to logical map entry - tmpOffset = Offset; - tmpOffset >>= 4; - tmpOffset |= ((~((tmpOffset & 0x01) ^ ( tmpOffset >> 1 & 0x01) ^ (tmpOffset >> 2 & 0x01) ^ (tmpOffset >> 3 & 0x01))) << 6) & 0x40; - tmpOffset |= ((~( (tmpOffset >> 2 & 0x01) ^ (tmpOffset >> 3 & 0x01) ^ (tmpOffset >> 4 & 0x01) ^ ( tmpOffset >> 5 & 0x01))) << 7) & 0x80; - - // write the logical address - if(tmpaddr%2 != 0) - InBuf[2] = tmpOffset<<8; - else - InBuf[2] = tmpOffset; - - eFuseWritePhysical(pAd,&InBuf[0], 6, NULL, 0); - - //Step 5. Compare data if not the same, invalidate the mapping entry, then re-write the data until E-fuse is exhausted - bWriteSuccess = TRUE; - for(i =0; i<8; i++) - { - addr = BlkNum * 0x10 ; - - InBuf[0] = addr+2*i; - InBuf[1] = 2; - InBuf[2] = 0x0; - - eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); - - if(buffer[i] != InBuf[2]) - { - bWriteSuccess = FALSE; - break; - } - } - - //Step 6. invlidate mapping entry and find a free mapping entry if not succeed - if (!bWriteSuccess) - { - DBGPRINT(RT_DEBUG_TRACE, ("Not bWriteSuccess BlkNum = %d\n", BlkNum)); - - // the offset of current mapping entry - addr = EFUSE_USAGE_MAP_START+BlkNum; - - //find a new mapping entry - BlkNum = 0xffff; - for (i=EFUSE_USAGE_MAP_START; i<=EFUSE_USAGE_MAP_END; i+=2) - { - eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); - if( (LogicalAddress & 0xff) == 0) - { - BlkNum = i-EFUSE_USAGE_MAP_START; - break; - } - else if(( (LogicalAddress >> 8) & 0xff) == 0) - { - if (i != EFUSE_USAGE_MAP_END) - { - BlkNum = i+1-EFUSE_USAGE_MAP_START; - } - break; - } - } - DBGPRINT(RT_DEBUG_TRACE, ("Not bWriteSuccess new BlkNum = %d\n", BlkNum)); - if(BlkNum == 0xffff) - { - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters: out of free E-fuse space!!!\n")); - return FALSE; - } - - //invalidate the original mapping entry if new entry is not found - tmpaddr = addr; - - if(addr % 2 != 0) - addr = addr -1; - InBuf[0] = addr; - InBuf[1] = 2; - - eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); - - // write the logical address - if(tmpaddr%2 != 0) - { - // Invalidate the high byte - for (i=8; i<15; i++) - { - if( ( (InBuf[2] >> i) & 0x01) == 0) - { - InBuf[2] |= (0x1 <> i) & 0x01) == 0) - { - InBuf[2] |= (0x1 <bUseEfuse) - return FALSE; - for (i = EFUSE_USAGE_MAP_START; i <= EFUSE_USAGE_MAP_END; i+=2) - { - eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); - if( (LogicalAddress & 0xff) == 0) - { - efusefreenum= (UCHAR) (EFUSE_USAGE_MAP_END-i+1); - break; - } - else if(( (LogicalAddress >> 8) & 0xff) == 0) - { - efusefreenum = (UCHAR) (EFUSE_USAGE_MAP_END-i); - break; - } - - if(i == EFUSE_USAGE_MAP_END) - efusefreenum = 0; - } - printk("efuseFreeNumber is %d\n",efusefreenum); - return TRUE; -} -INT set_eFusedump_Proc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) -{ -USHORT InBuf[3]; - INT i=0; - if(!pAd->bUseEfuse) - return FALSE; - for(i =0; i0) - { - - NdisMoveMemory(src, arg, strlen(arg)); - } - - else - { - - NdisMoveMemory(src, "RT30xxEEPROM.bin", BinFileSize); - } - - DBGPRINT(RT_DEBUG_TRACE, ("FileName=%s\n",src)); - buffer = kmalloc(MAX_EEPROM_BIN_FILE_SIZE, MEM_ALLOC_FLAG); - - if(buffer == NULL) - { - kfree(src); - return FALSE; -} - PDATA=kmalloc(sizeof(USHORT)*8,MEM_ALLOC_FLAG); - - if(PDATA==NULL) - { - kfree(src); - - kfree(buffer); - return FALSE; - } - - orgfs = get_fs(); - set_fs(KERNEL_DS); - - if (src && *src) - { - srcf = filp_open(src, O_RDONLY, 0); - if (IS_ERR(srcf)) - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error %ld opening %s\n", -PTR_ERR(srcf),src)); - return FALSE; - } - else - { - // The object must have a read method - if (srcf->f_op && srcf->f_op->read) - { - memset(buffer, 0x00, MAX_EEPROM_BIN_FILE_SIZE); - while(srcf->f_op->read(srcf, &buffer[i], 1, &srcf->f_pos)==1) - { - DBGPRINT(RT_DEBUG_TRACE, ("%02X ",buffer[i])); - if((i+1)%8==0) - DBGPRINT(RT_DEBUG_TRACE, ("\n")); - i++; - if(i>=MAX_EEPROM_BIN_FILE_SIZE) - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error %ld reading %s, The file is too large[1024]\n", -PTR_ERR(srcf),src)); - kfree(PDATA); - kfree(buffer); - kfree(src); - return FALSE; - } - } - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error!! System doest not support read function\n")); - kfree(PDATA); - kfree(buffer); - kfree(src); - return FALSE; - } - } - - - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error src or srcf is null\n")); - kfree(PDATA); - kfree(buffer); - return FALSE; - - } - - - retval=filp_close(srcf,NULL); - - if (retval) - { - DBGPRINT(RT_DEBUG_TRACE, ("--> Error %d closing %s\n", -retval, src)); - } - set_fs(orgfs); - - for(j=0;j48*16-3(reserved)=2FC - bAllocateNewBlk=TRUE; - for (i=EFUSE_USAGE_MAP_START; i<=EFUSE_USAGE_MAP_END; i+=2) - { - //Retrive the logical block nubmer form each logical address pointer - //It will access two logical address pointer each time. - eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); - if( (LogicalAddress & 0xff) == 0) - {//Not used logical address pointer - BlkNum = i-EFUSE_USAGE_MAP_START; - break; - } - else if(( (LogicalAddress >> 8) & 0xff) == 0) - {//Not used logical address pointer - if (i != EFUSE_USAGE_MAP_END) - { - BlkNum = i-EFUSE_USAGE_MAP_START+1; - } - break; - } - } - } - else - { - bAllocateNewBlk=FALSE; - BlkNum = EFSROM_AOUT; - } - - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters BlkNum = %d \n", BlkNum)); - - if(BlkNum == 0xffff) - { - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters: out of free E-fuse space!!!\n")); - return FALSE; - } - //Step 1.1.0 - //If the block is not existing in mapping table, create one - //and write down the 16-bytes data to the new block - if(bAllocateNewBlk) - { - DBGPRINT(RT_DEBUG_TRACE, ("Allocate New Blk\n")); - efuseDataOffset = EFUSE_DATA3; - for(i=0; i< 4; i++) - { - DBGPRINT(RT_DEBUG_TRACE, ("Allocate New Blk, Data%d=%04x%04x\n",3-i,pData[2*i+1],pData[2*i])); - tempbuffer=((pData[2*i+1]<<16)&0xffff0000)|pData[2*i]; - - - RTMP_IO_WRITE32(pAd, efuseDataOffset,tempbuffer); - efuseDataOffset -= 4; - - } - ///////////////////////////////////////////////////////////////// - - //Step1.1.1. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. - eFuseCtrlStruc.field.EFSROM_AIN = BlkNum* 0x10 ; - - //Step1.1.2. Write EFSROM_MODE (0x580, bit7:bit6) to 3. - eFuseCtrlStruc.field.EFSROM_MODE = 3; - - //Step1.1.3. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical write procedure. - eFuseCtrlStruc.field.EFSROM_KICK = 1; - - NdisMoveMemory(&data, &eFuseCtrlStruc, 4); - - RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); - - //Step1.1.4. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. It��s done. - i = 0; - while(i < 100) - { - RTMP_IO_READ32(pAd, EFUSE_CTRL, (PUINT32) &eFuseCtrlStruc); - - if(eFuseCtrlStruc.field.EFSROM_KICK == 0) + if ((pAd->MACVersion != 0x00) && (pAd->MACVersion != 0xFFFFFFFF)) break; - RTMPusecDelay(2); - i++; - } + RTMPusecDelay(10); + } while (index++ < 100); - } - else - { //Step1.2. - //If the same logical number is existing, check if the writting data and the data - //saving in this block are the same. - ///////////////////////////////////////////////////////////////// - //read current values of 16-byte block - RTMP_IO_READ32(pAd, EFUSE_CTRL, (PUINT32) &eFuseCtrlStruc); - - //Step1.2.0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. - eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0; - - //Step1.2.1. Write EFSROM_MODE (0x580, bit7:bit6) to 1. - eFuseCtrlStruc.field.EFSROM_MODE = 0; - - //Step1.2.2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure. - eFuseCtrlStruc.field.EFSROM_KICK = 1; - - NdisMoveMemory(&data, &eFuseCtrlStruc, 4); - RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); - - //Step1.2.3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. - i = 0; - while(i < 100) - { - RTMP_IO_READ32(pAd, EFUSE_CTRL, (PUINT32) &eFuseCtrlStruc); - - if(eFuseCtrlStruc.field.EFSROM_KICK == 0) - break; - RTMPusecDelay(2); - i++; - } - - //Step1.2.4. Read 16-byte of data from EFUSE_DATA0-3 (0x59C-0x590) - efuseDataOffset = EFUSE_DATA3; - for(i=0; i< 4; i++) - { - RTMP_IO_READ32(pAd, efuseDataOffset, (PUINT32) &buffer[i]); - efuseDataOffset -= 4; - } - //Step1.2.5. Check if the data of efuse and the writing data are the same. - for(i =0; i<4; i++) - { - tempbuffer=((pData[2*i+1]<<16)&0xffff0000)|pData[2*i]; - DBGPRINT(RT_DEBUG_TRACE, ("buffer[%d]=%x,pData[%d]=%x,pData[%d]=%x,tempbuffer=%x\n",i,buffer[i],2*i,pData[2*i],2*i+1,pData[2*i+1],tempbuffer)); - - if(((buffer[i]&0xffff0000)==(pData[2*i+1]<<16))&&((buffer[i]&0xffff)==pData[2*i])) - bNotWrite&=TRUE; - else + pAd->bUseEfuse=FALSE; + RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrl); + pAd->bUseEfuse = ( (eFuseCtrl & 0x80000000) == 0x80000000) ? 1 : 0; + if(pAd->bUseEfuse) { - bNotWrite&=FALSE; - break; - } - } - if(!bNotWrite) - { - printk("The data is not the same\n"); - - for(i =0; i<8; i++) - { - addr = BlkNum * 0x10 ; - - InBuf[0] = addr+2*i; - InBuf[1] = 2; - InBuf[2] = pData[i]; - - eFuseWritePhysical(pAd, &InBuf[0], 6, NULL, 2); - } - - } - else - return TRUE; + pChipOps->eeinit = eFuse_init; + pChipOps->eeread = rtmp_ee_efuse_read16; + pChipOps->eewrite = rtmp_ee_efuse_write16; + return 0 ; } - - - - //Step 2. Write mapping table - addr = EFUSE_USAGE_MAP_START+BlkNum; - - tmpaddr = addr; - - if(addr % 2 != 0) - addr = addr -1; - InBuf[0] = addr; - InBuf[1] = 2; - - //convert the address from 10 to 8 bit ( bit7, 6 = parity and bit5 ~ 0 = bit9~4), and write to logical map entry - tmpOffset = Offset; - tmpOffset >>= 4; - tmpOffset |= ((~((tmpOffset & 0x01) ^ ( tmpOffset >> 1 & 0x01) ^ (tmpOffset >> 2 & 0x01) ^ (tmpOffset >> 3 & 0x01))) << 6) & 0x40; - tmpOffset |= ((~( (tmpOffset >> 2 & 0x01) ^ (tmpOffset >> 3 & 0x01) ^ (tmpOffset >> 4 & 0x01) ^ ( tmpOffset >> 5 & 0x01))) << 7) & 0x80; - - // write the logical address - if(tmpaddr%2 != 0) - InBuf[2] = tmpOffset<<8; else - InBuf[2] = tmpOffset; - - eFuseWritePhysical(pAd,&InBuf[0], 6, NULL, 0); - - //Step 3. Compare data if not the same, invalidate the mapping entry, then re-write the data until E-fuse is exhausted - bWriteSuccess = TRUE; - for(i =0; i<8; i++) - { - addr = BlkNum * 0x10 ; - - InBuf[0] = addr+2*i; - InBuf[1] = 2; - InBuf[2] = 0x0; - - eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); - DBGPRINT(RT_DEBUG_TRACE, ("addr=%x, buffer[i]=%x,InBuf[2]=%x\n",InBuf[0],pData[i],InBuf[2])); - if(pData[i] != InBuf[2]) { - bWriteSuccess = FALSE; - break; + pAd->bFroceEEPROMBuffer = FALSE; + DBGPRINT(RT_DEBUG_TRACE, ("NVM is EEPROM\n")); } - } - - //Step 4. invlidate mapping entry and find a free mapping entry if not succeed +#endif // RTMP_EFUSE_SUPPORT // +#endif // RT30xx // - if (!bWriteSuccess&&Loop<2) + switch(infType) { - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegistersFromBin::Not bWriteSuccess BlkNum = %d\n", BlkNum)); - - // the offset of current mapping entry - addr = EFUSE_USAGE_MAP_START+BlkNum; - - //find a new mapping entry - BlkNum = 0xffff; - for (i=EFUSE_USAGE_MAP_START; i<=EFUSE_USAGE_MAP_END; i+=2) - { - eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); - if( (LogicalAddress & 0xff) == 0) - { - BlkNum = i-EFUSE_USAGE_MAP_START; +#ifdef RTMP_PCI_SUPPORT + case RTMP_DEV_INF_PCI: + pChipOps->eeinit = NULL; + pChipOps->eeread = rtmp_ee_prom_read16; + pChipOps->eewrite = rtmp_ee_prom_write16; break; - } - else if(( (LogicalAddress >> 8) & 0xff) == 0) - { - if (i != EFUSE_USAGE_MAP_END) - { - BlkNum = i+1-EFUSE_USAGE_MAP_START; - } +#endif // RTMP_PCI_SUPPORT // +#ifdef RTMP_USB_SUPPORT + case RTMP_DEV_INF_USB: + pChipOps->eeinit = NULL; + pChipOps->eeread = RTUSBReadEEPROM16; + pChipOps->eewrite = RTUSBWriteEEPROM16; break; - } - } - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegistersFromBin::Not bWriteSuccess new BlkNum = %d\n", BlkNum)); - if(BlkNum == 0xffff) - { - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegistersFromBin: out of free E-fuse space!!!\n")); - return FALSE; - } - - //invalidate the original mapping entry if new entry is not found - tmpaddr = addr; +#endif // RTMP_USB_SUPPORT // - if(addr % 2 != 0) - addr = addr -1; - InBuf[0] = addr; - InBuf[1] = 2; - - eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); - - // write the logical address - if(tmpaddr%2 != 0) - { - // Invalidate the high byte - for (i=8; i<15; i++) - { - if( ( (InBuf[2] >> i) & 0x01) == 0) - { - InBuf[2] |= (0x1 <> i) & 0x01) == 0) - { - InBuf[2] |= (0x1 <5. - - // 802.11 HyperLan 2 - {100, 0x98402ec8, 0x984c06b2, 0x98178a55, 0x980ed783}, - - // 2008.04.30 modified - // The system team has AN to improve the EVM value - // for channel 102 to 108 for the RT2850/RT2750 dual band solution. - {102, 0x98402ec8, 0x985c06b2, 0x98578a55, 0x980ed793}, - {104, 0x98402ec8, 0x985c06b2, 0x98578a55, 0x980ed1a3}, - {108, 0x98402ecc, 0x985c0a32, 0x98578a55, 0x980ed193}, - - {110, 0x98402ecc, 0x984c0a36, 0x98178a55, 0x980ed183}, - {112, 0x98402ecc, 0x984c0a36, 0x98178a55, 0x980ed19b}, - {116, 0x98402ecc, 0x984c0a3a, 0x98178a55, 0x980ed1a3}, - {118, 0x98402ecc, 0x984c0a3e, 0x98178a55, 0x980ed193}, - {120, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed183}, - {124, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed193}, - {126, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed15b}, // 0x980ed1bb->0x980ed15b required by Rory 20070927 - {128, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed1a3}, - {132, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed18b}, - {134, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed193}, - {136, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed19b}, - {140, 0x98402ec4, 0x984c038a, 0x98178a55, 0x980ed183}, - - // 802.11 UNII - {149, 0x98402ec4, 0x984c038a, 0x98178a55, 0x980ed1a7}, - {151, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed187}, - {153, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed18f}, - {157, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed19f}, - {159, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed1a7}, - {161, 0x98402ec4, 0x984c0392, 0x98178a55, 0x980ed187}, - {165, 0x98402ec4, 0x984c0392, 0x98178a55, 0x980ed197}, - - // Japan - {184, 0x95002ccc, 0x9500491e, 0x9509be55, 0x950c0a0b}, - {188, 0x95002ccc, 0x95004922, 0x9509be55, 0x950c0a13}, - {192, 0x95002ccc, 0x95004926, 0x9509be55, 0x950c0a1b}, - {196, 0x95002ccc, 0x9500492a, 0x9509be55, 0x950c0a23}, - {208, 0x95002ccc, 0x9500493a, 0x9509be55, 0x950c0a13}, - {212, 0x95002ccc, 0x9500493e, 0x9509be55, 0x950c0a1b}, - {216, 0x95002ccc, 0x95004982, 0x9509be55, 0x950c0a23}, - - // still lack of MMAC(Japan) ch 34,38,42,46 -}; -UCHAR NUM_OF_2850_CHNL = (sizeof(RF2850RegTable) / sizeof(RTMP_RF_REGS)); - -FREQUENCY_ITEM FreqItems3020[] = -{ - /**************************************************/ - // ISM : 2.4 to 2.483 GHz // - /**************************************************/ - // 11g - /**************************************************/ - //-CH---N-------R---K----------- - {1, 241, 2, 2}, - {2, 241, 2, 7}, - {3, 242, 2, 2}, - {4, 242, 2, 7}, - {5, 243, 2, 2}, - {6, 243, 2, 7}, - {7, 244, 2, 2}, - {8, 244, 2, 7}, - {9, 245, 2, 2}, - {10, 245, 2, 7}, - {11, 246, 2, 2}, - {12, 246, 2, 7}, - {13, 247, 2, 2}, - {14, 248, 2, 4}, -}; -UCHAR NUM_OF_3020_CHNL=(sizeof(FreqItems3020) / sizeof(FREQUENCY_ITEM)); /* ========================================================================== @@ -484,14 +371,19 @@ NDIS_STATUS MlmeInit( AuthStateMachineInit(pAd, &pAd->Mlme.AuthMachine, pAd->Mlme.AuthFunc); AuthRspStateMachineInit(pAd, &pAd->Mlme.AuthRspMachine, pAd->Mlme.AuthRspFunc); SyncStateMachineInit(pAd, &pAd->Mlme.SyncMachine, pAd->Mlme.SyncFunc); - WpaPskStateMachineInit(pAd, &pAd->Mlme.WpaPskMachine, pAd->Mlme.WpaPskFunc); - AironetStateMachineInit(pAd, &pAd->Mlme.AironetMachine, pAd->Mlme.AironetFunc); + + + // Since we are using switch/case to implement it, the init is different from the above // state machine init MlmeCntlInit(pAd, &pAd->Mlme.CntlMachine, NULL); } + + WpaStateMachineInit(pAd, &pAd->Mlme.WpaMachine, pAd->Mlme.WpaFunc); + + ActionStateMachineInit(pAd, &pAd->Mlme.ActMachine, pAd->Mlme.ActFunc); // Init mlme periodic timer @@ -503,16 +395,24 @@ NDIS_STATUS MlmeInit( // software-based RX Antenna diversity RTMPInitTimer(pAd, &pAd->Mlme.RxAntEvalTimer, GET_TIMER_FUNCTION(AsicRxAntEvalTimeout), pAd, FALSE); -#ifdef RT2860 { +#ifdef RTMP_PCI_SUPPORT if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) { // only PCIe cards need these two timers RTMPInitTimer(pAd, &pAd->Mlme.PsPollTimer, GET_TIMER_FUNCTION(PsPollWakeExec), pAd, FALSE); RTMPInitTimer(pAd, &pAd->Mlme.RadioOnOffTimer, GET_TIMER_FUNCTION(RadioOnExec), pAd, FALSE); } +#endif // RTMP_PCI_SUPPORT // + + RTMPInitTimer(pAd, &pAd->Mlme.LinkDownTimer, GET_TIMER_FUNCTION(LinkDownExec), pAd, FALSE); + +#ifdef RTMP_MAC_USB + RTMPInitTimer(pAd, &pAd->Mlme.AutoWakeupTimer, GET_TIMER_FUNCTION(RtmpUsbStaAsicForceWakeupTimeout), pAd, FALSE); + pAd->Mlme.AutoWakeupTimerRunning = FALSE; +#endif // RTMP_MAC_USB // } -#endif + } while (FALSE); DBGPRINT(RT_DEBUG_TRACE, ("<-- MLME Initialize\n")); @@ -567,7 +467,7 @@ VOID MlmeHandler( //From message type, determine which state machine I should drive if (MlmeDequeue(&pAd->Mlme.Queue, &Elem)) { -#ifdef RT2870 +#ifdef RTMP_MAC_USB if (Elem->MsgType == MT2_RESET_CONF) { DBGPRINT_RAW(RT_DEBUG_TRACE, ("!!! reset MLME state machine !!!\n")); @@ -576,7 +476,7 @@ VOID MlmeHandler( Elem->MsgLen = 0; continue; } -#endif // RT2870 // +#endif // RTMP_MAC_USB // // if dequeue success switch (Elem->Machine) @@ -600,14 +500,16 @@ VOID MlmeHandler( case WPA_PSK_STATE_MACHINE: StateMachinePerformAction(pAd, &pAd->Mlme.WpaPskMachine, Elem); break; - case AIRONET_STATE_MACHINE: - StateMachinePerformAction(pAd, &pAd->Mlme.AironetMachine, Elem); - break; + + + case ACTION_STATE_MACHINE: StateMachinePerformAction(pAd, &pAd->Mlme.ActMachine, Elem); break; - + case WPA_STATE_MACHINE: + StateMachinePerformAction(pAd, &pAd->Mlme.WpaMachine, Elem); + break; default: @@ -647,9 +549,6 @@ VOID MlmeHalt( IN PRTMP_ADAPTER pAd) { BOOLEAN Cancelled; -#ifdef RT3070 - UINT32 TxPinCfg = 0x00050F0F; -#endif // RT3070 // DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeHalt\n")); @@ -667,13 +566,21 @@ VOID MlmeHalt( RTMPCancelTimer(&pAd->MlmeAux.AuthTimer, &Cancelled); RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &Cancelled); RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &Cancelled); -#ifdef RT2860 + + +#ifdef RTMP_MAC_PCI if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) { RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); } -#endif +#endif // RTMP_MAC_PCI // + + RTMPCancelTimer(&pAd->Mlme.LinkDownTimer, &Cancelled); + +#ifdef RTMP_MAC_USB + RTMPCancelTimer(&pAd->Mlme.AutoWakeupTimer, &Cancelled); +#endif // RTMP_MAC_USB // } RTMPCancelTimer(&pAd->Mlme.PeriodicTimer, &Cancelled); @@ -683,10 +590,12 @@ VOID MlmeHalt( if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) { + RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + // Set LED RTMPSetLED(pAd, LED_HALT); RTMPSetSignalLED(pAd, -100); // Force signal strength Led to be turned off, firmware is not done it. -#ifdef RT2870 +#ifdef RTMP_MAC_USB { LED_CFG_STRUC LedCfg; RTMP_IO_READ32(pAd, LED_CFG, &LedCfg.word); @@ -696,17 +605,10 @@ VOID MlmeHalt( LedCfg.field.YLedMode = 0; RTMP_IO_WRITE32(pAd, LED_CFG, LedCfg.word); } -#endif // RT2870 // -#ifdef RT3070 - // - // Turn off LNA_PE - // - if (IS_RT3070(pAd) || IS_RT3071(pAd)) - { - TxPinCfg &= 0xFFFFF0F0; - RTUSBWriteMACRegister(pAd, TX_PIN_CFG, TxPinCfg); - } -#endif // RT3070 // +#endif // RTMP_MAC_USB // + + if (pChipOps->AsicHaltAction) + pChipOps->AsicHaltAction(pAd); } RTMPusecDelay(5000); // 5 msec to gurantee Ant Diversity timer canceled @@ -730,6 +632,8 @@ VOID MlmeResetRalinkCounters( pAd->RalinkCounters.OneSecTxNoRetryOkCount = 0; pAd->RalinkCounters.OneSecTxRetryOkCount = 0; pAd->RalinkCounters.OneSecRxOkDataCnt = 0; + pAd->RalinkCounters.OneSecReceivedByteCount = 0; + pAd->RalinkCounters.OneSecTransmittedByteCount = 0; // TODO: for debug only. to be removed pAd->RalinkCounters.OneSecOsTxCount[QID_AC_BE] = 0; @@ -748,8 +652,6 @@ VOID MlmeResetRalinkCounters( return; } -unsigned long rx_AMSDU; -unsigned long rx_Total; /* ========================================================================== @@ -777,33 +679,19 @@ VOID MlmePeriodicExec( ULONG TxTotalCnt; PRTMP_ADAPTER pAd = (RTMP_ADAPTER *)FunctionContext; -#ifdef RT2860 - //Baron 2008/07/10 - //printk("Baron_Test:\t%s", RTMPGetRalinkEncryModeStr(pAd->StaCfg.WepStatus)); - //If the STA security setting is OPEN or WEP, pAd->StaCfg.WpaSupplicantUP = 0. - //If the STA security setting is WPAPSK or WPA2PSK, pAd->StaCfg.WpaSupplicantUP = 1. - if(pAd->StaCfg.WepStatus<2) - { - pAd->StaCfg.WpaSupplicantUP = 0; - } - else - { - pAd->StaCfg.WpaSupplicantUP = 1; - } - +#ifdef RTMP_MAC_PCI { // If Hardware controlled Radio enabled, we have to check GPIO pin2 every 2 second. // Move code to here, because following code will return when radio is off - if ((pAd->Mlme.PeriodicRound % (MLME_TASK_EXEC_MULTIPLE * 2) == 0) && - (pAd->StaCfg.bHardwareRadio == TRUE) && - (RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_START_UP)) && + if ((pAd->Mlme.PeriodicRound % (MLME_TASK_EXEC_MULTIPLE * 2) == 0) && (pAd->StaCfg.bHardwareRadio == TRUE) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS))) + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) + /*&&(pAd->bPCIclkOff == FALSE)*/) { UINT32 data = 0; // Read GPIO pin2 as Hardware controlled radio state - RTMP_IO_FORCE_READ32(pAd, GPIO_CTRL_CFG, &data); + RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &data); if (data & 0x04) { pAd->StaCfg.bHwRadio = TRUE; @@ -830,7 +718,7 @@ VOID MlmePeriodicExec( } } } -#endif /* RT2860 */ +#endif // RTMP_MAC_PCI // // Do nothing if the driver is starting halt state. // This might happen when timer already been fired before cancel timer with mlmehalt @@ -840,46 +728,7 @@ VOID MlmePeriodicExec( fRTMP_ADAPTER_RESET_IN_PROGRESS)))) return; -#ifdef RT2860 - { - if ((pAd->RalinkCounters.LastReceivedByteCount == pAd->RalinkCounters.ReceivedByteCount) && (pAd->StaCfg.bRadio == TRUE)) - { - // If ReceiveByteCount doesn't change, increase SameRxByteCount by 1. - pAd->SameRxByteCount++; - } - else - pAd->SameRxByteCount = 0; - - // If after BBP, still not work...need to check to reset PBF&MAC. - if (pAd->SameRxByteCount == 702) - { - pAd->SameRxByteCount = 0; - AsicResetPBF(pAd); - AsicResetMAC(pAd); - } - - // If SameRxByteCount keeps happens for 2 second in infra mode, or for 60 seconds in idle mode. - if (((INFRA_ON(pAd)) && (pAd->SameRxByteCount > 20)) || ((IDLE_ON(pAd)) && (pAd->SameRxByteCount > 600))) - { - if ((pAd->StaCfg.bRadio == TRUE) && (pAd->SameRxByteCount < 700)) - { - DBGPRINT(RT_DEBUG_TRACE, ("---> SameRxByteCount = %lu !!!!!!!!!!!!!!! \n", pAd->SameRxByteCount)); - pAd->SameRxByteCount = 700; - AsicResetBBP(pAd); - } - } - - // Update lastReceiveByteCount. - pAd->RalinkCounters.LastReceivedByteCount = pAd->RalinkCounters.ReceivedByteCount; - - if ((pAd->CheckDmaBusyCount > 3) && (IDLE_ON(pAd))) - { - pAd->CheckDmaBusyCount = 0; - AsicResetFromDMABusy(pAd); - } - } -#endif /* RT2860 */ - RT28XX_MLME_PRE_SANITY_CHECK(pAd); + RTMP_MLME_PRE_SANITY_CHECK(pAd); { // Do nothing if monitor mode is on @@ -911,10 +760,11 @@ VOID MlmePeriodicExec( // RECBATimerTimeout(SystemSpecific1,FunctionContext,SystemSpecific2,SystemSpecific3); pAd->Mlme.PeriodicRound ++; -#ifdef RT3070 +#ifdef RTMP_MAC_USB // execute every 100ms, update the Tx FIFO Cnt for update Tx Rate. NICUpdateFifoStaCounters(pAd); -#endif // RT3070 // +#endif // RTMP_MAC_USB // + // execute every 500ms if ((pAd->Mlme.PeriodicRound % 5 == 0) && RTMPAutoRateSwitchCheck(pAd)/*(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED))*/) { @@ -932,13 +782,10 @@ VOID MlmePeriodicExec( { pAd->Mlme.OneSecPeriodicRound ++; - if (rx_Total) - { - // reset counters - rx_AMSDU = 0; - rx_Total = 0; - } + + + //ORIBATimerTimeout(pAd); // Media status changed, report to NDIS if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_MEDIA_STATE_CHANGE)) @@ -963,14 +810,23 @@ VOID MlmePeriodicExec( // the dynamic tuning mechanism below are based on most up-to-date information NICUpdateRawCounters(pAd); -#ifdef RT2870 - RT2870_WatchDog(pAd); -#endif // RT2870 // +#ifdef RTMP_MAC_USB + RTUSBWatchDog(pAd); +#endif // RTMP_MAC_USB // // Need statistics after read counter. So put after NICUpdateRawCounters ORIBATimerTimeout(pAd); + // if MGMT RING is full more than twice within 1 second, we consider there's + // a hardware problem stucking the TX path. In this case, try a hardware reset + // to recover the system + // if (pAd->RalinkCounters.MgmtRingFullCount >= 2) + // RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HARDWARE_ERROR); + // else + // pAd->RalinkCounters.MgmtRingFullCount = 0; + // The time period for checking antenna is according to traffic + { if (pAd->Mlme.bEnableAutoAntennaCheck) { TxTotalCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount + @@ -993,15 +849,16 @@ VOID MlmePeriodicExec( } } } + } STAMlmePeriodicExec(pAd); MlmeResetRalinkCounters(pAd); { -#ifdef RT2860 +#ifdef RTMP_MAC_PCI if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST) && (pAd->bPCIclkOff == FALSE)) -#endif +#endif // RTMP_MAC_PCI // { // When Adhoc beacon is enabled and RTS/CTS is enabled, there is a chance that hardware MAC FSM will run into a deadlock // and sending CTS-to-self over and over. @@ -1024,106 +881,380 @@ VOID MlmePeriodicExec( } } - RT28XX_MLME_HANDLER(pAd); + RTMP_MLME_HANDLER(pAd); } + pAd->bUpdateBcnCntDone = FALSE; } -VOID STAMlmePeriodicExec( - PRTMP_ADAPTER pAd) + +/* + ========================================================================== + Validate SSID for connection try and rescan purpose + Valid SSID will have visible chars only. + The valid length is from 0 to 32. + IRQL = DISPATCH_LEVEL + ========================================================================== + */ +BOOLEAN MlmeValidateSSID( + IN PUCHAR pSsid, + IN UCHAR SsidLen) { -#ifdef RT2860 - ULONG TxTotalCnt; -#endif -#ifdef RT2870 - ULONG TxTotalCnt; - int i; -#endif + int index; - if (pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_DISABLE) + if (SsidLen > MAX_LEN_OF_SSID) + return (FALSE); + + // Check each character value + for (index = 0; index < SsidLen; index++) { - // WPA MIC error should block association attempt for 60 seconds - if (pAd->StaCfg.bBlockAssoc && (pAd->StaCfg.LastMicErrorTime + (60 * OS_HZ) < pAd->Mlme.Now32)) - pAd->StaCfg.bBlockAssoc = FALSE; + if (pSsid[index] < 0x20) + return (FALSE); } -#ifdef RT2860 - //Baron 2008/07/10 - //printk("Baron_Test:\t%s", RTMPGetRalinkEncryModeStr(pAd->StaCfg.WepStatus)); - //If the STA security setting is OPEN or WEP, pAd->StaCfg.WpaSupplicantUP = 0. - //If the STA security setting is WPAPSK or WPA2PSK, pAd->StaCfg.WpaSupplicantUP = 1. - if(pAd->StaCfg.WepStatus<2) + // All checked + return (TRUE); +} + +VOID MlmeSelectTxRateTable( + IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, + IN PUCHAR *ppTable, + IN PUCHAR pTableSize, + IN PUCHAR pInitTxRateIdx) +{ + do { - pAd->StaCfg.WpaSupplicantUP = 0; - } - else + // decide the rate table for tuning + if (pAd->CommonCfg.TxRateTableSize > 0) { - pAd->StaCfg.WpaSupplicantUP = 1; + *ppTable = RateSwitchTable; + *pTableSize = RateSwitchTable[0]; + *pInitTxRateIdx = RateSwitchTable[1]; + + break; } -#endif - if ((pAd->PreMediaState != pAd->IndicateMediaState) && (pAd->CommonCfg.bWirelessEvent)) + if ((pAd->OpMode == OPMODE_STA) && ADHOC_ON(pAd)) { - if (pAd->IndicateMediaState == NdisMediaStateConnected) + if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && + (pEntry->HTCapability.MCSSet[0] == 0xff) && + ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) + {// 11N 1S Adhoc + *ppTable = RateSwitchTable11N1S; + *pTableSize = RateSwitchTable11N1S[0]; + *pInitTxRateIdx = RateSwitchTable11N1S[1]; + + } + else if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && + (pEntry->HTCapability.MCSSet[0] == 0xff) && + (pEntry->HTCapability.MCSSet[1] == 0xff) && + (pAd->Antenna.field.TxPath == 2)) + {// 11N 2S Adhoc + if (pAd->LatchRfRegs.Channel <= 14) { - RTMPSendWirelessEvent(pAd, IW_STA_LINKUP_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); + *ppTable = RateSwitchTable11N2S; + *pTableSize = RateSwitchTable11N2S[0]; + *pInitTxRateIdx = RateSwitchTable11N2S[1]; } - pAd->PreMediaState = pAd->IndicateMediaState; + else + { + *ppTable = RateSwitchTable11N2SForABand; + *pTableSize = RateSwitchTable11N2SForABand[0]; + *pInitTxRateIdx = RateSwitchTable11N2SForABand[1]; } -#ifdef RT2860 - if ((pAd->OpMode == OPMODE_STA) && (IDLE_ON(pAd)) && - (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) && - (pAd->Mlme.SyncMachine.CurrState == SYNC_IDLE) && - (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) && - (RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_START_UP)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) - { - RT28xxPciAsicRadioOff(pAd, GUI_IDLE_POWER_SAVE, 0); } -#endif + else + if ((pEntry->RateLen == 4) + && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0) + ) + { + *ppTable = RateSwitchTable11B; + *pTableSize = RateSwitchTable11B[0]; + *pInitTxRateIdx = RateSwitchTable11B[1]; + } + else if (pAd->LatchRfRegs.Channel <= 14) + { + *ppTable = RateSwitchTable11BG; + *pTableSize = RateSwitchTable11BG[0]; + *pInitTxRateIdx = RateSwitchTable11BG[1]; + } + else + { + *ppTable = RateSwitchTable11G; + *pTableSize = RateSwitchTable11G[0]; + *pInitTxRateIdx = RateSwitchTable11G[1]; - AsicStaBbpTuning(pAd); + } + break; + } - TxTotalCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount + - pAd->RalinkCounters.OneSecTxRetryOkCount + - pAd->RalinkCounters.OneSecTxFailCount; + //if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen == 12) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && + // ((pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) + if (((pEntry->RateLen == 12) || (pAd->OpMode == OPMODE_STA)) && (pEntry->HTCapability.MCSSet[0] == 0xff) && + ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->CommonCfg.TxStream == 1))) + {// 11BGN 1S AP + *ppTable = RateSwitchTable11BGN1S; + *pTableSize = RateSwitchTable11BGN1S[0]; + *pInitTxRateIdx = RateSwitchTable11BGN1S[1]; - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - // update channel quality for Roaming and UI LinkQuality display - MlmeCalculateChannelQuality(pAd, pAd->Mlme.Now32); + break; } - // must be AFTER MlmeDynamicTxRateSwitching() because it needs to know if - // Radio is currently in noisy environment - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - AsicAdjustTxPower(pAd); - - if (INFRA_ON(pAd)) + //else if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen == 12) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && + // (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0xff) && (pAd->Antenna.field.TxPath == 2)) + if (((pEntry->RateLen == 12) || (pAd->OpMode == OPMODE_STA)) && (pEntry->HTCapability.MCSSet[0] == 0xff) && + (pEntry->HTCapability.MCSSet[1] == 0xff) && (pAd->CommonCfg.TxStream == 2)) + {// 11BGN 2S AP + if (pAd->LatchRfRegs.Channel <= 14) { - // Is PSM bit consistent with user power management policy? - // This is the only place that will set PSM bit ON. - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - MlmeCheckPsmChange(pAd, pAd->Mlme.Now32); + *ppTable = RateSwitchTable11BGN2S; + *pTableSize = RateSwitchTable11BGN2S[0]; + *pInitTxRateIdx = RateSwitchTable11BGN2S[1]; - pAd->RalinkCounters.LastOneSecTotalTxCount = TxTotalCnt; + } + else + { + *ppTable = RateSwitchTable11BGN2SForABand; + *pTableSize = RateSwitchTable11BGN2SForABand[0]; + *pInitTxRateIdx = RateSwitchTable11BGN2SForABand[1]; - if ((pAd->StaCfg.LastBeaconRxTime + 1*OS_HZ < pAd->Mlme.Now32) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) && - ((TxTotalCnt + pAd->RalinkCounters.OneSecRxOkCnt < 600))) - { - RTMPSetAGCInitValue(pAd, BW_20); - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - No BEACON. restore R66 to the low bound(%d) \n", (0x2E + GET_LNA_GAIN(pAd)))); + } + break; } - { - if (pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable) - { - // When APSD is enabled, the period changes as 20 sec + //else if ((pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && ((pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) + if ((pEntry->HTCapability.MCSSet[0] == 0xff) && ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->CommonCfg.TxStream == 1))) + {// 11N 1S AP + *ppTable = RateSwitchTable11N1S; + *pTableSize = RateSwitchTable11N1S[0]; + *pInitTxRateIdx = RateSwitchTable11N1S[1]; + + break; + } + + //else if ((pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0xff) && (pAd->Antenna.field.TxPath == 2)) + if ((pEntry->HTCapability.MCSSet[0] == 0xff) && (pEntry->HTCapability.MCSSet[1] == 0xff) && (pAd->CommonCfg.TxStream == 2)) + {// 11N 2S AP + if (pAd->LatchRfRegs.Channel <= 14) + { + *ppTable = RateSwitchTable11N2S; + *pTableSize = RateSwitchTable11N2S[0]; + *pInitTxRateIdx = RateSwitchTable11N2S[1]; + } + else + { + *ppTable = RateSwitchTable11N2SForABand; + *pTableSize = RateSwitchTable11N2SForABand[0]; + *pInitTxRateIdx = RateSwitchTable11N2SForABand[1]; + } + + break; + } + //else if ((pAd->StaActive.SupRateLen == 4) && (pAd->StaActive.ExtRateLen == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) + if ((pEntry->RateLen == 4 || pAd->CommonCfg.PhyMode==PHY_11B) + //Iverson mark for Adhoc b mode,sta will use rate 54 Mbps when connect with sta b/g/n mode + /* && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0)*/ + ) + {// B only AP + *ppTable = RateSwitchTable11B; + *pTableSize = RateSwitchTable11B[0]; + *pInitTxRateIdx = RateSwitchTable11B[1]; + + break; + } + + //else if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen > 8) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) + if ((pEntry->RateLen > 8) + && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0) + ) + {// B/G mixed AP + *ppTable = RateSwitchTable11BG; + *pTableSize = RateSwitchTable11BG[0]; + *pInitTxRateIdx = RateSwitchTable11BG[1]; + + break; + } + + //else if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen == 8) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) + if ((pEntry->RateLen == 8) + && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0) + ) + {// G only AP + *ppTable = RateSwitchTable11G; + *pTableSize = RateSwitchTable11G[0]; + *pInitTxRateIdx = RateSwitchTable11G[1]; + + break; + } + + { + //else if ((pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) + if ((pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0)) + { // Legacy mode + if (pAd->CommonCfg.MaxTxRate <= RATE_11) + { + *ppTable = RateSwitchTable11B; + *pTableSize = RateSwitchTable11B[0]; + *pInitTxRateIdx = RateSwitchTable11B[1]; + } + else if ((pAd->CommonCfg.MaxTxRate > RATE_11) && (pAd->CommonCfg.MinTxRate > RATE_11)) + { + *ppTable = RateSwitchTable11G; + *pTableSize = RateSwitchTable11G[0]; + *pInitTxRateIdx = RateSwitchTable11G[1]; + + } + else + { + *ppTable = RateSwitchTable11BG; + *pTableSize = RateSwitchTable11BG[0]; + *pInitTxRateIdx = RateSwitchTable11BG[1]; + } + break; + } + if (pAd->LatchRfRegs.Channel <= 14) + { + if (pAd->CommonCfg.TxStream == 1) + { + *ppTable = RateSwitchTable11N1S; + *pTableSize = RateSwitchTable11N1S[0]; + *pInitTxRateIdx = RateSwitchTable11N1S[1]; + DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode,default use 11N 1S AP \n")); + } + else + { + *ppTable = RateSwitchTable11N2S; + *pTableSize = RateSwitchTable11N2S[0]; + *pInitTxRateIdx = RateSwitchTable11N2S[1]; + DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode,default use 11N 2S AP \n")); + } + } + else + { + if (pAd->CommonCfg.TxStream == 1) + { + *ppTable = RateSwitchTable11N1S; + *pTableSize = RateSwitchTable11N1S[0]; + *pInitTxRateIdx = RateSwitchTable11N1S[1]; + DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode,default use 11N 1S AP \n")); + } + else + { + *ppTable = RateSwitchTable11N2SForABand; + *pTableSize = RateSwitchTable11N2SForABand[0]; + *pInitTxRateIdx = RateSwitchTable11N2SForABand[1]; + DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode,default use 11N 2S AP \n")); + } + } + DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode (SupRateLen=%d, ExtRateLen=%d, MCSSet[0]=0x%x, MCSSet[1]=0x%x)\n", + pAd->StaActive.SupRateLen, pAd->StaActive.ExtRateLen, pAd->StaActive.SupportedPhyInfo.MCSSet[0], pAd->StaActive.SupportedPhyInfo.MCSSet[1])); + } + } while(FALSE); +} + + +VOID STAMlmePeriodicExec( + PRTMP_ADAPTER pAd) +{ + ULONG TxTotalCnt; + int i; + + /* + We return here in ATE mode, because the statistics + that ATE need are not collected via this routine. + */ +#if defined(RT305x)||defined(RT3070) + // request by Gary, if Rssi0 > -42, BBP 82 need to be changed from 0x62 to 0x42, , bbp 67 need to be changed from 0x20 to 0x18 + if (!pAd->CommonCfg.HighPowerPatchDisabled) + { +#ifdef RT3070 + if ( (IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) +#endif // RT3070 // + { + if ((pAd->StaCfg.RssiSample.AvgRssi0 != 0) && (pAd->StaCfg.RssiSample.AvgRssi0 > (pAd->BbpRssiToDbmDelta - 35))) + { + RT30xxWriteRFRegister(pAd, RF_R27, 0x20); + } + else + { + RT30xxWriteRFRegister(pAd, RF_R27, 0x23); + } + } + } +#endif + + if (pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_DISABLE) + { + // WPA MIC error should block association attempt for 60 seconds + if (pAd->StaCfg.bBlockAssoc && + RTMP_TIME_AFTER(pAd->Mlme.Now32, pAd->StaCfg.LastMicErrorTime + (60*OS_HZ))) + pAd->StaCfg.bBlockAssoc = FALSE; + } + + if ((pAd->PreMediaState != pAd->IndicateMediaState) && (pAd->CommonCfg.bWirelessEvent)) + { + if (pAd->IndicateMediaState == NdisMediaStateConnected) + { + RTMPSendWirelessEvent(pAd, IW_STA_LINKUP_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); + } + pAd->PreMediaState = pAd->IndicateMediaState; + } + + + + + if (pAd->CommonCfg.PSPXlink && ADHOC_ON(pAd)) + { + } + else + { + AsicStaBbpTuning(pAd); + } + + TxTotalCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount + + pAd->RalinkCounters.OneSecTxRetryOkCount + + pAd->RalinkCounters.OneSecTxFailCount; + + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) + { + // update channel quality for Roaming and UI LinkQuality display + MlmeCalculateChannelQuality(pAd, NULL, pAd->Mlme.Now32); + } + + // must be AFTER MlmeDynamicTxRateSwitching() because it needs to know if + // Radio is currently in noisy environment + if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) + AsicAdjustTxPower(pAd); + + if (INFRA_ON(pAd)) + { + + // Is PSM bit consistent with user power management policy? + // This is the only place that will set PSM bit ON. + if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) + MlmeCheckPsmChange(pAd, pAd->Mlme.Now32); + + pAd->RalinkCounters.LastOneSecTotalTxCount = TxTotalCnt; + + if ((RTMP_TIME_AFTER(pAd->Mlme.Now32, pAd->StaCfg.LastBeaconRxTime + (1*OS_HZ))) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) && + (((TxTotalCnt + pAd->RalinkCounters.OneSecRxOkCnt) < 600))) + { + RTMPSetAGCInitValue(pAd, BW_20); + DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - No BEACON. restore R66 to the low bound(%d) \n", (0x2E + GET_LNA_GAIN(pAd)))); + } + + //if ((pAd->RalinkCounters.OneSecTxNoRetryOkCount == 0) && + // (pAd->RalinkCounters.OneSecTxRetryOkCount == 0)) + { + if (pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable) + { + // When APSD is enabled, the period changes as 20 sec if ((pAd->Mlme.OneSecPeriodicRound % 20) == 8) RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, TRUE); } @@ -1143,18 +1274,18 @@ VOID STAMlmePeriodicExec( if (CQI_IS_DEAD(pAd->Mlme.ChannelQuality)) { DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - No BEACON. Dead CQI. Auto Recovery attempt #%ld\n", pAd->RalinkCounters.BadCQIAutoRecoveryCount)); - pAd->StaCfg.CCXAdjacentAPReportFlag = TRUE; - pAd->StaCfg.CCXAdjacentAPLinkDownTime = pAd->StaCfg.LastBeaconRxTime; + + if ((pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) && + (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2)) + pAd->StaCfg.bLostAp = TRUE; // Lost AP, send disconnect & link down event LinkDown(pAd, FALSE); - { - union iwreq_data wrqu; - memset(wrqu.ap_addr.sa_data, 0, MAC_ADDR_LEN); - wireless_send_event(pAd->net_dev, SIOCGIWAP, &wrqu, NULL); - } + RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0); + + // RTMPPatchMacBbpBug(pAd); MlmeAutoReconnectLastSSID(pAd); } else if (CQI_IS_BAD(pAd->Mlme.ChannelQuality)) @@ -1164,76 +1295,46 @@ VOID STAMlmePeriodicExec( MlmeAutoReconnectLastSSID(pAd); } - // Add auto seamless roaming - if (pAd->StaCfg.bFastRoaming) + if (pAd->StaCfg.bAutoRoaming) { - SHORT dBmToRoam = (SHORT)pAd->StaCfg.dBmToRoam; - - DBGPRINT(RT_DEBUG_TRACE, ("Rssi=%d, dBmToRoam=%d\n", RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, pAd->StaCfg.RssiSample.LastRssi1, pAd->StaCfg.RssiSample.LastRssi2), (CHAR)dBmToRoam)); + BOOLEAN rv = FALSE; + CHAR dBmToRoam = pAd->StaCfg.dBmToRoam; + CHAR MaxRssi = RTMPMaxRssi(pAd, + pAd->StaCfg.RssiSample.LastRssi0, + pAd->StaCfg.RssiSample.LastRssi1, + pAd->StaCfg.RssiSample.LastRssi2); - if (RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, pAd->StaCfg.RssiSample.LastRssi1, pAd->StaCfg.RssiSample.LastRssi2) <= (CHAR)dBmToRoam) - { - MlmeCheckForFastRoaming(pAd, pAd->Mlme.Now32); - } - } - } - else if (ADHOC_ON(pAd)) + // Scanning, ignore Roaming + if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS) && + (pAd->Mlme.SyncMachine.CurrState == SYNC_IDLE) && + (MaxRssi <= dBmToRoam)) { -#ifdef RT2860 - // 2003-04-17 john. this is a patch that driver forces a BEACON out if ASIC fails - // the "TX BEACON competition" for the entire past 1 sec. - // So that even when ASIC's BEACONgen engine been blocked - // by peer's BEACON due to slower system clock, this STA still can send out - // minimum BEACON to tell the peer I'm alive. - // drawback is that this BEACON won't be well aligned at TBTT boundary. - // EnqueueBeaconFrame(pAd); // software send BEACON - - // if all 11b peers leave this BSS more than 5 seconds, update Tx rate, - // restore outgoing BEACON to support B/G-mixed mode - if ((pAd->CommonCfg.Channel <= 14) && - (pAd->CommonCfg.MaxTxRate <= RATE_11) && - (pAd->CommonCfg.MaxDesiredRate > RATE_11) && - ((pAd->StaCfg.Last11bBeaconRxTime + 5*OS_HZ) < pAd->Mlme.Now32)) - { - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - last 11B peer left, update Tx rates\n")); - NdisMoveMemory(pAd->StaActive.SupRate, pAd->CommonCfg.SupRate, MAX_LEN_OF_SUPPORTED_RATES); - pAd->StaActive.SupRateLen = pAd->CommonCfg.SupRateLen; - MlmeUpdateTxRates(pAd, FALSE, 0); - MakeIbssBeacon(pAd); // re-build BEACON frame - AsicEnableIbssSync(pAd); // copy to on-chip memory - pAd->StaCfg.AdhocBOnlyJoined = FALSE; - } + DBGPRINT(RT_DEBUG_TRACE, ("Rssi=%d, dBmToRoam=%d\n", MaxRssi, (CHAR)dBmToRoam)); + + + // Add auto seamless roaming + if (rv == FALSE) + rv = MlmeCheckForFastRoaming(pAd); - if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) + if (rv == FALSE) { - if ((pAd->StaCfg.AdhocBGJoined) && - ((pAd->StaCfg.Last11gBeaconRxTime + 5 * OS_HZ) < pAd->Mlme.Now32)) + if ((pAd->StaCfg.LastScanTime + 10 * OS_HZ) < pAd->Mlme.Now32) { - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - last 11G peer left\n")); - pAd->StaCfg.AdhocBGJoined = FALSE; + DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - Roaming, No eligable entry, try new scan!\n")); + pAd->StaCfg.ScanCnt = 2; + pAd->StaCfg.LastScanTime = pAd->Mlme.Now32; + MlmeAutoScan(pAd); } - - if ((pAd->StaCfg.Adhoc20NJoined) && - ((pAd->StaCfg.Last20NBeaconRxTime + 5 * OS_HZ) < pAd->Mlme.Now32)) - { - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - last 20MHz N peer left\n")); - pAd->StaCfg.Adhoc20NJoined = FALSE; } } -#endif /* RT2860 */ - - //radar detect - if ((pAd->CommonCfg.Channel > 14) - && (pAd->CommonCfg.bIEEE80211H == 1) - && RadarChannelCheck(pAd, pAd->CommonCfg.Channel)) - { - RadarDetectPeriodic(pAd); } - + } + else if (ADHOC_ON(pAd)) + { // If all peers leave, and this STA becomes the last one in this IBSS, then change MediaState // to DISCONNECTED. But still holding this IBSS (i.e. sending BEACON) so that other STAs can // join later. - if ((pAd->StaCfg.LastBeaconRxTime + ADHOC_BEACON_LOST_TIME < pAd->Mlme.Now32) && + if (RTMP_TIME_AFTER(pAd->Mlme.Now32, pAd->StaCfg.LastBeaconRxTime + ADHOC_BEACON_LOST_TIME) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) { MLME_START_REQ_STRUCT StartReq; @@ -1241,12 +1342,11 @@ VOID STAMlmePeriodicExec( DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - excessive BEACON lost, last STA in this IBSS, MediaState=Disconnected\n")); LinkDown(pAd, FALSE); - StartParmFill(pAd, &StartReq, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); + StartParmFill(pAd, &StartReq, (CHAR *)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, sizeof(MLME_START_REQ_STRUCT), &StartReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_START; } -#ifdef RT2870 for (i = 1; i < MAX_LEN_OF_MAC_TABLE; i++) { MAC_TABLE_ENTRY *pEntry = &pAd->MacTab.Content[i]; @@ -1254,16 +1354,15 @@ VOID STAMlmePeriodicExec( if (pEntry->ValidAsCLI == FALSE) continue; - if (pEntry->LastBeaconRxTime + ADHOC_BEACON_LOST_TIME < pAd->Mlme.Now32) + if (RTMP_TIME_AFTER(pAd->Mlme.Now32, pEntry->LastBeaconRxTime + ADHOC_BEACON_LOST_TIME)) MacTableDeleteEntry(pAd, pEntry->Aid, pEntry->Addr); } -#endif } else // no INFRA nor ADHOC connection { if (pAd->StaCfg.bScanReqIsFromWebUI && - ((pAd->StaCfg.LastScanTime + 30 * OS_HZ) > pAd->Mlme.Now32)) + RTMP_TIME_BEFORE(pAd->Mlme.Now32, pAd->StaCfg.LastScanTime + (30 * OS_HZ))) goto SKIP_AUTO_SCAN_CONN; else pAd->StaCfg.bScanReqIsFromWebUI = FALSE; @@ -1276,10 +1375,10 @@ VOID STAMlmePeriodicExec( { MLME_SCAN_REQ_STRUCT ScanReq; - if ((pAd->StaCfg.LastScanTime + 10 * OS_HZ) < pAd->Mlme.Now32) + if (RTMP_TIME_AFTER(pAd->Mlme.Now32, pAd->StaCfg.LastScanTime + (10 * OS_HZ))) { DBGPRINT(RT_DEBUG_TRACE, ("STAMlmePeriodicExec():CNTL - ScanTab.BssNr==0, start a new ACTIVE scan SSID[%s]\n", pAd->MlmeAux.AutoReconnectSsid)); - ScanParmFill(pAd, &ScanReq, pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen, BSS_ANY, SCAN_ACTIVE); + ScanParmFill(pAd, &ScanReq, (PSTRING) pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen, BSS_ANY, SCAN_ACTIVE); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; // Reset Missed scan number @@ -1326,12 +1425,26 @@ VOID LinkDownExec( IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; + if (pAd != NULL) + { + MLME_DISASSOC_REQ_STRUCT DisassocReq; + + if ((pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED) && + (INFRA_ON(pAd))) + { + DBGPRINT(RT_DEBUG_TRACE, ("LinkDownExec(): disassociate with current AP...\n")); + DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_DISASSOC_STA_LEAVING); + MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, + sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); + pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; + pAd->IndicateMediaState = NdisMediaStateDisconnected; RTMP_IndicateMediaState(pAd); pAd->ExtraInfo = GENERAL_LINK_DOWN; + } + } } // IRQL = DISPATCH_LEVEL @@ -1345,9 +1458,9 @@ VOID MlmeAutoScan( MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, OID_802_11_BSSID_LIST_SCAN, - 0, - NULL); - RT28XX_MLME_HANDLER(pAd); + pAd->MlmeAux.AutoReconnectSsidLen, + pAd->MlmeAux.AutoReconnectSsid); + RTMP_MLME_HANDLER(pAd); } } @@ -1355,10 +1468,29 @@ VOID MlmeAutoScan( VOID MlmeAutoReconnectLastSSID( IN PRTMP_ADAPTER pAd) { + if (pAd->StaCfg.bAutoConnectByBssid) + { + DBGPRINT(RT_DEBUG_TRACE, ("Driver auto reconnect to last OID_802_11_BSSID setting - %02X:%02X:%02X:%02X:%02X:%02X\n", + pAd->MlmeAux.Bssid[0], + pAd->MlmeAux.Bssid[1], + pAd->MlmeAux.Bssid[2], + pAd->MlmeAux.Bssid[3], + pAd->MlmeAux.Bssid[4], + pAd->MlmeAux.Bssid[5])); + + pAd->MlmeAux.Channel = pAd->CommonCfg.Channel; + MlmeEnqueue(pAd, + MLME_CNTL_STATE_MACHINE, + OID_802_11_BSSID, + MAC_ADDR_LEN, + pAd->MlmeAux.Bssid); + pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; + RTMP_MLME_HANDLER(pAd); + } // check CntlMachine.CurrState to avoid collision with NDIS SetOID request - if ((pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) && + else if ((pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) && (MlmeValidateSSID(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen) == TRUE)) { NDIS_802_11_SSID OidSsid; @@ -1371,6280 +1503,3622 @@ VOID MlmeAutoReconnectLastSSID( OID_802_11_SSID, sizeof(NDIS_802_11_SSID), &OidSsid); - RT28XX_MLME_HANDLER(pAd); + RTMP_MLME_HANDLER(pAd); } } + /* ========================================================================== - Validate SSID for connection try and rescan purpose - Valid SSID will have visible chars only. - The valid length is from 0 to 32. + Description: + This routine checks if there're other APs out there capable for + roaming. Caller should call this routine only when Link up in INFRA mode + and channel quality is below CQI_GOOD_THRESHOLD. + IRQL = DISPATCH_LEVEL + + Output: ========================================================================== */ -BOOLEAN MlmeValidateSSID( - IN PUCHAR pSsid, - IN UCHAR SsidLen) +VOID MlmeCheckForRoaming( + IN PRTMP_ADAPTER pAd, + IN ULONG Now32) { - int index; - - if (SsidLen > MAX_LEN_OF_SSID) - return (FALSE); + USHORT i; + BSS_TABLE *pRoamTab = &pAd->MlmeAux.RoamTab; + BSS_ENTRY *pBss; - // Check each character value - for (index = 0; index < SsidLen; index++) + DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeCheckForRoaming\n")); + // put all roaming candidates into RoamTab, and sort in RSSI order + BssTableInit(pRoamTab); + for (i = 0; i < pAd->ScanTab.BssNr; i++) { - if (pSsid[index] < 0x20) - return (FALSE); + pBss = &pAd->ScanTab.BssEntry[i]; + + if ((pBss->LastBeaconRxTime + pAd->StaCfg.BeaconLostTime) < Now32) + continue; // AP disappear + if (pBss->Rssi <= RSSI_THRESHOLD_FOR_ROAMING) + continue; // RSSI too weak. forget it. + if (MAC_ADDR_EQUAL(pBss->Bssid, pAd->CommonCfg.Bssid)) + continue; // skip current AP + if (pBss->Rssi < (pAd->StaCfg.RssiSample.LastRssi0 + RSSI_DELTA)) + continue; // only AP with stronger RSSI is eligible for roaming + + // AP passing all above rules is put into roaming candidate table + NdisMoveMemory(&pRoamTab->BssEntry[pRoamTab->BssNr], pBss, sizeof(BSS_ENTRY)); + pRoamTab->BssNr += 1; } - // All checked - return (TRUE); + if (pRoamTab->BssNr > 0) + { + // check CntlMachine.CurrState to avoid collision with NDIS SetOID request + if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) + { + pAd->RalinkCounters.PoorCQIRoamingCount ++; + DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - Roaming attempt #%ld\n", pAd->RalinkCounters.PoorCQIRoamingCount)); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_MLME_ROAMING_REQ, 0, NULL); + RTMP_MLME_HANDLER(pAd); + } + } + DBGPRINT(RT_DEBUG_TRACE, ("<== MlmeCheckForRoaming(# of candidate= %d)\n",pRoamTab->BssNr)); } -VOID MlmeSelectTxRateTable( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR *ppTable, - IN PUCHAR pTableSize, - IN PUCHAR pInitTxRateIdx) +/* + ========================================================================== + Description: + This routine checks if there're other APs out there capable for + roaming. Caller should call this routine only when link up in INFRA mode + and channel quality is below CQI_GOOD_THRESHOLD. + + IRQL = DISPATCH_LEVEL + + Output: + ========================================================================== + */ +BOOLEAN MlmeCheckForFastRoaming( + IN PRTMP_ADAPTER pAd) { - do - { - // decide the rate table for tuning - if (pAd->CommonCfg.TxRateTableSize > 0) + USHORT i; + BSS_TABLE *pRoamTab = &pAd->MlmeAux.RoamTab; + BSS_ENTRY *pBss; + + DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeCheckForFastRoaming\n")); + // put all roaming candidates into RoamTab, and sort in RSSI order + BssTableInit(pRoamTab); + for (i = 0; i < pAd->ScanTab.BssNr; i++) { - *ppTable = RateSwitchTable; - *pTableSize = RateSwitchTable[0]; - *pInitTxRateIdx = RateSwitchTable[1]; + pBss = &pAd->ScanTab.BssEntry[i]; - break; + if ((pBss->Rssi <= -50) && (pBss->Channel == pAd->CommonCfg.Channel)) + continue; // RSSI too weak. forget it. + if (MAC_ADDR_EQUAL(pBss->Bssid, pAd->CommonCfg.Bssid)) + continue; // skip current AP + if (!SSID_EQUAL(pBss->Ssid, pBss->SsidLen, pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen)) + continue; // skip different SSID + if (pBss->Rssi < (RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, pAd->StaCfg.RssiSample.LastRssi1, pAd->StaCfg.RssiSample.LastRssi2) + RSSI_DELTA)) + continue; // skip AP without better RSSI + + DBGPRINT(RT_DEBUG_TRACE, ("LastRssi0 = %d, pBss->Rssi = %d\n", RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, pAd->StaCfg.RssiSample.LastRssi1, pAd->StaCfg.RssiSample.LastRssi2), pBss->Rssi)); + // AP passing all above rules is put into roaming candidate table + NdisMoveMemory(&pRoamTab->BssEntry[pRoamTab->BssNr], pBss, sizeof(BSS_ENTRY)); + pRoamTab->BssNr += 1; } - if ((pAd->OpMode == OPMODE_STA) && ADHOC_ON(pAd)) + DBGPRINT(RT_DEBUG_TRACE, ("<== MlmeCheckForFastRoaming (BssNr=%d)\n", pRoamTab->BssNr)); + if (pRoamTab->BssNr > 0) { - if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && -#ifdef RT2860 - !pAd->StaCfg.AdhocBOnlyJoined && - !pAd->StaCfg.AdhocBGJoined && - (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && - ((pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) -#endif -#ifdef RT2870 - (pEntry->HTCapability.MCSSet[0] == 0xff) && - ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) -#endif - {// 11N 1S Adhoc - *ppTable = RateSwitchTable11N1S; - *pTableSize = RateSwitchTable11N1S[0]; - *pInitTxRateIdx = RateSwitchTable11N1S[1]; - - } - else if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && -#ifdef RT2860 - !pAd->StaCfg.AdhocBOnlyJoined && - !pAd->StaCfg.AdhocBGJoined && - (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && - (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0xff) && -#endif -#ifdef RT2870 - (pEntry->HTCapability.MCSSet[0] == 0xff) && - (pEntry->HTCapability.MCSSet[1] == 0xff) && -#endif - (pAd->Antenna.field.TxPath == 2)) - {// 11N 2S Adhoc - if (pAd->LatchRfRegs.Channel <= 14) + // check CntlMachine.CurrState to avoid collision with NDIS SetOID request + if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) { - *ppTable = RateSwitchTable11N2S; - *pTableSize = RateSwitchTable11N2S[0]; - *pInitTxRateIdx = RateSwitchTable11N2S[1]; + pAd->RalinkCounters.PoorCQIRoamingCount ++; + DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - Roaming attempt #%ld\n", pAd->RalinkCounters.PoorCQIRoamingCount)); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_MLME_ROAMING_REQ, 0, NULL); + RTMP_MLME_HANDLER(pAd); + return TRUE; } - else - { - *ppTable = RateSwitchTable11N2SForABand; - *pTableSize = RateSwitchTable11N2SForABand[0]; - *pInitTxRateIdx = RateSwitchTable11N2SForABand[1]; } - } - else -#ifdef RT2860 - if (pAd->CommonCfg.PhyMode == PHY_11B) - { - *ppTable = RateSwitchTable11B; - *pTableSize = RateSwitchTable11B[0]; - *pInitTxRateIdx = RateSwitchTable11B[1]; + return FALSE; +} - } - else if((pAd->LatchRfRegs.Channel <= 14) && (pAd->StaCfg.AdhocBOnlyJoined == TRUE)) -#endif -#ifdef RT2870 - if ((pEntry->RateLen == 4) - && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0) - ) -#endif - { - // USe B Table when Only b-only Station in my IBSS . - *ppTable = RateSwitchTable11B; - *pTableSize = RateSwitchTable11B[0]; - *pInitTxRateIdx = RateSwitchTable11B[1]; +VOID MlmeSetTxRate( + IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, + IN PRTMP_TX_RATE_SWITCH pTxRate) +{ + UCHAR MaxMode = MODE_OFDM; - } - else if (pAd->LatchRfRegs.Channel <= 14) - { - *ppTable = RateSwitchTable11BG; - *pTableSize = RateSwitchTable11BG[0]; - *pInitTxRateIdx = RateSwitchTable11BG[1]; + MaxMode = MODE_HTGREENFIELD; - } + if (pTxRate->STBC && (pAd->StaCfg.MaxHTPhyMode.field.STBC) && (pAd->Antenna.field.TxPath == 2)) + pAd->StaCfg.HTPhyMode.field.STBC = STBC_USE; else - { - *ppTable = RateSwitchTable11G; - *pTableSize = RateSwitchTable11G[0]; - *pInitTxRateIdx = RateSwitchTable11G[1]; - - } - break; - } + pAd->StaCfg.HTPhyMode.field.STBC = STBC_NONE; - if ((pEntry->RateLen == 12) && (pEntry->HTCapability.MCSSet[0] == 0xff) && - ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->CommonCfg.TxStream == 1))) - {// 11BGN 1S AP - *ppTable = RateSwitchTable11BGN1S; - *pTableSize = RateSwitchTable11BGN1S[0]; - *pInitTxRateIdx = RateSwitchTable11BGN1S[1]; + if (pTxRate->CurrMCS < MCS_AUTO) + pAd->StaCfg.HTPhyMode.field.MCS = pTxRate->CurrMCS; - break; - } + if (pAd->StaCfg.HTPhyMode.field.MCS > 7) + pAd->StaCfg.HTPhyMode.field.STBC = STBC_NONE; - if ((pEntry->RateLen == 12) && (pEntry->HTCapability.MCSSet[0] == 0xff) && - (pEntry->HTCapability.MCSSet[1] == 0xff) && (pAd->CommonCfg.TxStream == 2)) - {// 11BGN 2S AP - if (pAd->LatchRfRegs.Channel <= 14) + if (ADHOC_ON(pAd)) { - *ppTable = RateSwitchTable11BGN2S; - *pTableSize = RateSwitchTable11BGN2S[0]; - *pInitTxRateIdx = RateSwitchTable11BGN2S[1]; + // If peer adhoc is b-only mode, we can't send 11g rate. + pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; + pEntry->HTPhyMode.field.STBC = STBC_NONE; + // + // For Adhoc MODE_CCK, driver will use AdhocBOnlyJoined flag to roll back to B only if necessary + // + pEntry->HTPhyMode.field.MODE = pTxRate->Mode; + pEntry->HTPhyMode.field.ShortGI = pAd->StaCfg.HTPhyMode.field.ShortGI; + pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; + + // Patch speed error in status page + pAd->StaCfg.HTPhyMode.field.MODE = pEntry->HTPhyMode.field.MODE; } else { - *ppTable = RateSwitchTable11BGN2SForABand; - *pTableSize = RateSwitchTable11BGN2SForABand[0]; - *pInitTxRateIdx = RateSwitchTable11BGN2SForABand[1]; - - } - break; - } + if (pTxRate->Mode <= MaxMode) + pAd->StaCfg.HTPhyMode.field.MODE = pTxRate->Mode; - if ((pEntry->HTCapability.MCSSet[0] == 0xff) && ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->CommonCfg.TxStream == 1))) - {// 11N 1S AP - *ppTable = RateSwitchTable11N1S; - *pTableSize = RateSwitchTable11N1S[0]; - *pInitTxRateIdx = RateSwitchTable11N1S[1]; + if (pTxRate->ShortGI && (pAd->StaCfg.MaxHTPhyMode.field.ShortGI)) + pAd->StaCfg.HTPhyMode.field.ShortGI = GI_400; + else + pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; - break; + // Reexam each bandwidth's SGI support. + if (pAd->StaCfg.HTPhyMode.field.ShortGI == GI_400) + { + if ((pEntry->HTPhyMode.field.BW == BW_20) && (!CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_SGI20_CAPABLE))) + pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; + if ((pEntry->HTPhyMode.field.BW == BW_40) && (!CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_SGI40_CAPABLE))) + pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; } - if ((pEntry->HTCapability.MCSSet[0] == 0xff) && (pEntry->HTCapability.MCSSet[1] == 0xff) && (pAd->CommonCfg.TxStream == 2)) - {// 11N 2S AP - if (pAd->LatchRfRegs.Channel <= 14) + // Turn RTS/CTS rate to 6Mbps. + if ((pEntry->HTPhyMode.field.MCS == 0) && (pAd->StaCfg.HTPhyMode.field.MCS != 0)) { - *ppTable = RateSwitchTable11N2S; - *pTableSize = RateSwitchTable11N2S[0]; - *pInitTxRateIdx = RateSwitchTable11N2S[1]; + pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; + if (pAd->MacTab.fAnyBASession) + { + AsicUpdateProtect(pAd, HT_FORCERTSCTS, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); } else { - *ppTable = RateSwitchTable11N2SForABand; - *pTableSize = RateSwitchTable11N2SForABand[0]; - *pInitTxRateIdx = RateSwitchTable11N2SForABand[1]; + AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); + } + } + else if ((pEntry->HTPhyMode.field.MCS == 8) && (pAd->StaCfg.HTPhyMode.field.MCS != 8)) + { + pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; + if (pAd->MacTab.fAnyBASession) + { + AsicUpdateProtect(pAd, HT_FORCERTSCTS, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); + } + else + { + AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); + } } + else if ((pEntry->HTPhyMode.field.MCS != 0) && (pAd->StaCfg.HTPhyMode.field.MCS == 0)) + { + AsicUpdateProtect(pAd, HT_RTSCTS_6M, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); - break; - } + } + else if ((pEntry->HTPhyMode.field.MCS != 8) && (pAd->StaCfg.HTPhyMode.field.MCS == 8)) + { + AsicUpdateProtect(pAd, HT_RTSCTS_6M, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); + } - //else if ((pAd->StaActive.SupRateLen == 4) && (pAd->StaActive.ExtRateLen == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) - if (pEntry->RateLen == 4) - {// B only AP - *ppTable = RateSwitchTable11B; - *pTableSize = RateSwitchTable11B[0]; - *pInitTxRateIdx = RateSwitchTable11B[1]; - - break; - } - - //else if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen > 8) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) - if ((pEntry->RateLen > 8) - && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0) - ) - {// B/G mixed AP - *ppTable = RateSwitchTable11BG; - *pTableSize = RateSwitchTable11BG[0]; - *pInitTxRateIdx = RateSwitchTable11BG[1]; - - break; - } - - //else if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen == 8) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) - if ((pEntry->RateLen == 8) - && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0) - ) - {// G only AP - *ppTable = RateSwitchTable11G; - *pTableSize = RateSwitchTable11G[0]; - *pInitTxRateIdx = RateSwitchTable11G[1]; - - break; + pEntry->HTPhyMode.field.STBC = pAd->StaCfg.HTPhyMode.field.STBC; + pEntry->HTPhyMode.field.ShortGI = pAd->StaCfg.HTPhyMode.field.ShortGI; + pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; + pEntry->HTPhyMode.field.MODE = pAd->StaCfg.HTPhyMode.field.MODE; + if ((pAd->StaCfg.MaxHTPhyMode.field.MODE == MODE_HTGREENFIELD) && + pAd->WIFItestbed.bGreenField) + pEntry->HTPhyMode.field.MODE = MODE_HTGREENFIELD; } - { - //else if ((pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) - if ((pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0)) - { // Legacy mode - if (pAd->CommonCfg.MaxTxRate <= RATE_11) - { - *ppTable = RateSwitchTable11B; - *pTableSize = RateSwitchTable11B[0]; - *pInitTxRateIdx = RateSwitchTable11B[1]; - } - else if ((pAd->CommonCfg.MaxTxRate > RATE_11) && (pAd->CommonCfg.MinTxRate > RATE_11)) - { - *ppTable = RateSwitchTable11G; - *pTableSize = RateSwitchTable11G[0]; - *pInitTxRateIdx = RateSwitchTable11G[1]; - - } - else - { - *ppTable = RateSwitchTable11BG; - *pTableSize = RateSwitchTable11BG[0]; - *pInitTxRateIdx = RateSwitchTable11BG[1]; - } - break; - } - - if (pAd->LatchRfRegs.Channel <= 14) - { - if (pAd->CommonCfg.TxStream == 1) - { - *ppTable = RateSwitchTable11N1S; - *pTableSize = RateSwitchTable11N1S[0]; - *pInitTxRateIdx = RateSwitchTable11N1S[1]; - DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode,default use 11N 1S AP \n")); - } - else - { - *ppTable = RateSwitchTable11N2S; - *pTableSize = RateSwitchTable11N2S[0]; - *pInitTxRateIdx = RateSwitchTable11N2S[1]; - DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode,default use 11N 2S AP \n")); - } - } - else - { - if (pAd->CommonCfg.TxStream == 1) - { - *ppTable = RateSwitchTable11N1S; - *pTableSize = RateSwitchTable11N1S[0]; - *pInitTxRateIdx = RateSwitchTable11N1S[1]; - DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode,default use 11N 1S AP \n")); - } - else - { - *ppTable = RateSwitchTable11N2SForABand; - *pTableSize = RateSwitchTable11N2SForABand[0]; - *pInitTxRateIdx = RateSwitchTable11N2SForABand[1]; - DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode,default use 11N 2S AP \n")); - } - } - - DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode (SupRateLen=%d, ExtRateLen=%d, MCSSet[0]=0x%x, MCSSet[1]=0x%x)\n", - pAd->StaActive.SupRateLen, pAd->StaActive.ExtRateLen, pAd->StaActive.SupportedPhyInfo.MCSSet[0], pAd->StaActive.SupportedPhyInfo.MCSSet[1])); - } - } while(FALSE); + pAd->LastTxRate = (USHORT)(pEntry->HTPhyMode.word); } /* ========================================================================== Description: - This routine checks if there're other APs out there capable for - roaming. Caller should call this routine only when Link up in INFRA mode - and channel quality is below CQI_GOOD_THRESHOLD. + This routine calculates the acumulated TxPER of eaxh TxRate. And + according to the calculation result, change CommonCfg.TxRate which + is the stable TX Rate we expect the Radio situation could sustained. + + CommonCfg.TxRate will change dynamically within {RATE_1/RATE_6, MaxTxRate} + Output: + CommonCfg.TxRate - IRQL = DISPATCH_LEVEL - Output: + NOTE: + call this routine every second ========================================================================== */ -VOID MlmeCheckForRoaming( - IN PRTMP_ADAPTER pAd, - IN ULONG Now32) +VOID MlmeDynamicTxRateSwitching( + IN PRTMP_ADAPTER pAd) { - USHORT i; - BSS_TABLE *pRoamTab = &pAd->MlmeAux.RoamTab; - BSS_ENTRY *pBss; + UCHAR UpRateIdx = 0, DownRateIdx = 0, CurrRateIdx; + ULONG i, AccuTxTotalCnt = 0, TxTotalCnt; + ULONG TxErrorRatio = 0; + BOOLEAN bTxRateChanged = FALSE, bUpgradeQuality = FALSE; + PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate = NULL; + PUCHAR pTable; + UCHAR TableSize = 0; + UCHAR InitTxRateIdx = 0, TrainUp, TrainDown; + CHAR Rssi, RssiOffset = 0; + TX_STA_CNT1_STRUC StaTx1; + TX_STA_CNT0_STRUC TxStaCnt0; + ULONG TxRetransmit = 0, TxSuccess = 0, TxFailCount = 0; + MAC_TABLE_ENTRY *pEntry; + RSSI_SAMPLE *pRssi = &pAd->StaCfg.RssiSample; - DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeCheckForRoaming\n")); - // put all roaming candidates into RoamTab, and sort in RSSI order - BssTableInit(pRoamTab); - for (i = 0; i < pAd->ScanTab.BssNr; i++) - { - pBss = &pAd->ScanTab.BssEntry[i]; - if ((pBss->LastBeaconRxTime + BEACON_LOST_TIME) < Now32) - continue; // AP disappear - if (pBss->Rssi <= RSSI_THRESHOLD_FOR_ROAMING) - continue; // RSSI too weak. forget it. - if (MAC_ADDR_EQUAL(pBss->Bssid, pAd->CommonCfg.Bssid)) - continue; // skip current AP - if (pBss->Rssi < (pAd->StaCfg.RssiSample.LastRssi0 + RSSI_DELTA)) - continue; // only AP with stronger RSSI is eligible for roaming + // + // walk through MAC table, see if need to change AP's TX rate toward each entry + // + for (i = 1; i < MAX_LEN_OF_MAC_TABLE; i++) + { + pEntry = &pAd->MacTab.Content[i]; - // AP passing all above rules is put into roaming candidate table - NdisMoveMemory(&pRoamTab->BssEntry[pRoamTab->BssNr], pBss, sizeof(BSS_ENTRY)); - pRoamTab->BssNr += 1; - } + // check if this entry need to switch rate automatically + if (RTMPCheckEntryEnableAutoRateSwitch(pAd, pEntry) == FALSE) + continue; - if (pRoamTab->BssNr > 0) - { - // check CntlMachine.CurrState to avoid collision with NDIS SetOID request - if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) + if ((pAd->MacTab.Size == 1) || (pEntry->ValidAsDls)) { - pAd->RalinkCounters.PoorCQIRoamingCount ++; - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - Roaming attempt #%ld\n", pAd->RalinkCounters.PoorCQIRoamingCount)); - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_MLME_ROAMING_REQ, 0, NULL); - RT28XX_MLME_HANDLER(pAd); - } - } - DBGPRINT(RT_DEBUG_TRACE, ("<== MlmeCheckForRoaming(# of candidate= %d)\n",pRoamTab->BssNr)); -} + Rssi = RTMPMaxRssi(pAd, + pRssi->AvgRssi0, + pRssi->AvgRssi1, + pRssi->AvgRssi2); -/* - ========================================================================== - Description: - This routine checks if there're other APs out there capable for - roaming. Caller should call this routine only when link up in INFRA mode - and channel quality is below CQI_GOOD_THRESHOLD. + // Update statistic counter + RTMP_IO_READ32(pAd, TX_STA_CNT0, &TxStaCnt0.word); + RTMP_IO_READ32(pAd, TX_STA_CNT1, &StaTx1.word); + pAd->bUpdateBcnCntDone = TRUE; + TxRetransmit = StaTx1.field.TxRetransmit; + TxSuccess = StaTx1.field.TxSuccess; + TxFailCount = TxStaCnt0.field.TxFailCount; + TxTotalCnt = TxRetransmit + TxSuccess + TxFailCount; - IRQL = DISPATCH_LEVEL + pAd->RalinkCounters.OneSecTxRetryOkCount += StaTx1.field.TxRetransmit; + pAd->RalinkCounters.OneSecTxNoRetryOkCount += StaTx1.field.TxSuccess; + pAd->RalinkCounters.OneSecTxFailCount += TxStaCnt0.field.TxFailCount; + pAd->WlanCounters.TransmittedFragmentCount.u.LowPart += StaTx1.field.TxSuccess; + pAd->WlanCounters.RetryCount.u.LowPart += StaTx1.field.TxRetransmit; + pAd->WlanCounters.FailedCount.u.LowPart += TxStaCnt0.field.TxFailCount; - Output: - ========================================================================== - */ -VOID MlmeCheckForFastRoaming( - IN PRTMP_ADAPTER pAd, - IN ULONG Now) -{ - USHORT i; - BSS_TABLE *pRoamTab = &pAd->MlmeAux.RoamTab; - BSS_ENTRY *pBss; + // if no traffic in the past 1-sec period, don't change TX rate, + // but clear all bad history. because the bad history may affect the next + // Chariot throughput test + AccuTxTotalCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount + + pAd->RalinkCounters.OneSecTxRetryOkCount + + pAd->RalinkCounters.OneSecTxFailCount; - DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeCheckForFastRoaming\n")); - // put all roaming candidates into RoamTab, and sort in RSSI order - BssTableInit(pRoamTab); - for (i = 0; i < pAd->ScanTab.BssNr; i++) + if (TxTotalCnt) + TxErrorRatio = ((TxRetransmit + TxFailCount) * 100) / TxTotalCnt; + } + else { - pBss = &pAd->ScanTab.BssEntry[i]; + if (INFRA_ON(pAd) && (i == 1)) + Rssi = RTMPMaxRssi(pAd, + pRssi->AvgRssi0, + pRssi->AvgRssi1, + pRssi->AvgRssi2); + else + Rssi = RTMPMaxRssi(pAd, + pEntry->RssiSample.AvgRssi0, + pEntry->RssiSample.AvgRssi1, + pEntry->RssiSample.AvgRssi2); - if ((pBss->Rssi <= -50) && (pBss->Channel == pAd->CommonCfg.Channel)) - continue; // RSSI too weak. forget it. - if (MAC_ADDR_EQUAL(pBss->Bssid, pAd->CommonCfg.Bssid)) - continue; // skip current AP - if (!SSID_EQUAL(pBss->Ssid, pBss->SsidLen, pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen)) - continue; // skip different SSID - if (pBss->Rssi < (RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, pAd->StaCfg.RssiSample.LastRssi1, pAd->StaCfg.RssiSample.LastRssi2) + RSSI_DELTA)) - continue; // skip AP without better RSSI + TxTotalCnt = pEntry->OneSecTxNoRetryOkCount + + pEntry->OneSecTxRetryOkCount + + pEntry->OneSecTxFailCount; - DBGPRINT(RT_DEBUG_TRACE, ("LastRssi0 = %d, pBss->Rssi = %d\n", RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, pAd->StaCfg.RssiSample.LastRssi1, pAd->StaCfg.RssiSample.LastRssi2), pBss->Rssi)); - // AP passing all above rules is put into roaming candidate table - NdisMoveMemory(&pRoamTab->BssEntry[pRoamTab->BssNr], pBss, sizeof(BSS_ENTRY)); - pRoamTab->BssNr += 1; + if (TxTotalCnt) + TxErrorRatio = ((pEntry->OneSecTxRetryOkCount + pEntry->OneSecTxFailCount) * 100) / TxTotalCnt; } - if (pRoamTab->BssNr > 0) - { - // check CntlMachine.CurrState to avoid collision with NDIS SetOID request - if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) + if (TxTotalCnt) { - pAd->RalinkCounters.PoorCQIRoamingCount ++; - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - Roaming attempt #%ld\n", pAd->RalinkCounters.PoorCQIRoamingCount)); - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_MLME_ROAMING_REQ, 0, NULL); - RT28XX_MLME_HANDLER(pAd); - } - } - // Maybe site survey required - else - { - if ((pAd->StaCfg.LastScanTime + 10 * 1000) < Now) + /* + Three AdHoc connections can not work normally if one AdHoc connection is disappeared from a heavy traffic environment generated by ping tool + We force to set LongRtyLimit and ShortRtyLimit to 0 to stop retransmitting packet, after a while, resoring original settings + */ + if (TxErrorRatio == 100) + { + TX_RTY_CFG_STRUC TxRtyCfg,TxRtyCfgtmp; + ULONG Index; + ULONG MACValue; + + RTMP_IO_READ32(pAd, TX_RTY_CFG, &TxRtyCfg.word); + TxRtyCfgtmp.word = TxRtyCfg.word; + TxRtyCfg.field.LongRtyLimit = 0x0; + TxRtyCfg.field.ShortRtyLimit = 0x0; + RTMP_IO_WRITE32(pAd, TX_RTY_CFG, TxRtyCfg.word); + + RTMPusecDelay(1); + + Index = 0; + MACValue = 0; + do { - // check CntlMachine.CurrState to avoid collision with NDIS SetOID request - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - Roaming, No eligable entry, try new scan!\n")); - pAd->StaCfg.ScanCnt = 2; - pAd->StaCfg.LastScanTime = Now; - MlmeAutoScan(pAd); + RTMP_IO_READ32(pAd, TXRXQ_PCNT, &MACValue); + if ((MACValue & 0xffffff) == 0) + break; + Index++; + RTMPusecDelay(1000); + }while((Index < 330)&&(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS))); + + RTMP_IO_READ32(pAd, TX_RTY_CFG, &TxRtyCfg.word); + TxRtyCfg.field.LongRtyLimit = TxRtyCfgtmp.field.LongRtyLimit; + TxRtyCfg.field.ShortRtyLimit = TxRtyCfgtmp.field.ShortRtyLimit; + RTMP_IO_WRITE32(pAd, TX_RTY_CFG, TxRtyCfg.word); } } - DBGPRINT(RT_DEBUG_TRACE, ("<== MlmeCheckForFastRoaming (BssNr=%d)\n", pRoamTab->BssNr)); -} + CurrRateIdx = pEntry->CurrTxRateIndex; -/* - ========================================================================== - Description: - This routine calculates TxPER, RxPER of the past N-sec period. And - according to the calculation result, ChannelQuality is calculated here - to decide if current AP is still doing the job. + MlmeSelectTxRateTable(pAd, pEntry, &pTable, &TableSize, &InitTxRateIdx); - If ChannelQuality is not good, a ROAMing attempt may be tried later. - Output: - StaCfg.ChannelQuality - 0..100 + if (CurrRateIdx >= TableSize) + { + CurrRateIdx = TableSize - 1; + } - IRQL = DISPATCH_LEVEL + // When switch from Fixed rate -> auto rate, the REAL TX rate might be different from pAd->CommonCfg.TxRateIndex. + // So need to sync here. + pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(CurrRateIdx+1)*5]; + if ((pEntry->HTPhyMode.field.MCS != pCurrTxRate->CurrMCS) + //&& (pAd->StaCfg.bAutoTxRateSwitch == TRUE) + ) + { - NOTE: This routine decide channle quality based on RX CRC error ratio. - Caller should make sure a function call to NICUpdateRawCounters(pAd) - is performed right before this routine, so that this routine can decide - channel quality based on the most up-to-date information - ========================================================================== - */ -VOID MlmeCalculateChannelQuality( - IN PRTMP_ADAPTER pAd, - IN ULONG Now32) -{ - ULONG TxOkCnt, TxCnt, TxPER, TxPRR; - ULONG RxCnt, RxPER; - UCHAR NorRssi; - CHAR MaxRssi; - ULONG BeaconLostTime = BEACON_LOST_TIME; + // Need to sync Real Tx rate and our record. + // Then return for next DRS. + pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(InitTxRateIdx+1)*5]; + pEntry->CurrTxRateIndex = InitTxRateIdx; + MlmeSetTxRate(pAd, pEntry, pCurrTxRate); - MaxRssi = RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, pAd->StaCfg.RssiSample.LastRssi1, pAd->StaCfg.RssiSample.LastRssi2); + // reset all OneSecTx counters + RESET_ONE_SEC_TX_CNT(pEntry); + continue; + } - // - // calculate TX packet error ratio and TX retry ratio - if too few TX samples, skip TX related statistics - // - TxOkCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount + pAd->RalinkCounters.OneSecTxRetryOkCount; - TxCnt = TxOkCnt + pAd->RalinkCounters.OneSecTxFailCount; - if (TxCnt < 5) + // decide the next upgrade rate and downgrade rate, if any + if ((CurrRateIdx > 0) && (CurrRateIdx < (TableSize - 1))) { - TxPER = 0; - TxPRR = 0; + UpRateIdx = CurrRateIdx + 1; + DownRateIdx = CurrRateIdx -1; } - else + else if (CurrRateIdx == 0) + { + UpRateIdx = CurrRateIdx + 1; + DownRateIdx = CurrRateIdx; + } + else if (CurrRateIdx == (TableSize - 1)) { - TxPER = (pAd->RalinkCounters.OneSecTxFailCount * 100) / TxCnt; - TxPRR = ((TxCnt - pAd->RalinkCounters.OneSecTxNoRetryOkCount) * 100) / TxCnt; + UpRateIdx = CurrRateIdx; + DownRateIdx = CurrRateIdx - 1; } - // - // calculate RX PER - don't take RxPER into consideration if too few sample - // - RxCnt = pAd->RalinkCounters.OneSecRxOkCnt + pAd->RalinkCounters.OneSecRxFcsErrCnt; - if (RxCnt < 5) - RxPER = 0; - else - RxPER = (pAd->RalinkCounters.OneSecRxFcsErrCnt * 100) / RxCnt; + pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(CurrRateIdx+1)*5]; - // - // decide ChannelQuality based on: 1)last BEACON received time, 2)last RSSI, 3)TxPER, and 4)RxPER - // - if (INFRA_ON(pAd) && - (pAd->RalinkCounters.OneSecTxNoRetryOkCount < 2) && // no heavy traffic - (pAd->StaCfg.LastBeaconRxTime + BeaconLostTime < Now32)) + if ((Rssi > -65) && (pCurrTxRate->Mode >= MODE_HTMIX)) { - DBGPRINT(RT_DEBUG_TRACE, ("BEACON lost > %ld msec with TxOkCnt=%ld -> CQI=0\n", BeaconLostTime, TxOkCnt)); - pAd->Mlme.ChannelQuality = 0; + TrainUp = (pCurrTxRate->TrainUp + (pCurrTxRate->TrainUp >> 1)); + TrainDown = (pCurrTxRate->TrainDown + (pCurrTxRate->TrainDown >> 1)); } else { - // Normalize Rssi - if (MaxRssi > -40) - NorRssi = 100; - else if (MaxRssi < -90) - NorRssi = 0; - else - NorRssi = (MaxRssi + 90) * 2; - - // ChannelQuality = W1*RSSI + W2*TxPRR + W3*RxPER (RSSI 0..100), (TxPER 100..0), (RxPER 100..0) - pAd->Mlme.ChannelQuality = (RSSI_WEIGHTING * NorRssi + - TX_WEIGHTING * (100 - TxPRR) + - RX_WEIGHTING* (100 - RxPER)) / 100; - if (pAd->Mlme.ChannelQuality >= 100) - pAd->Mlme.ChannelQuality = 100; + TrainUp = pCurrTxRate->TrainUp; + TrainDown = pCurrTxRate->TrainDown; } -} - -VOID MlmeSetTxRate( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PRTMP_TX_RATE_SWITCH pTxRate) -{ - UCHAR MaxMode = MODE_OFDM; - - MaxMode = MODE_HTGREENFIELD; - - if (pTxRate->STBC && (pAd->StaCfg.MaxHTPhyMode.field.STBC) && (pAd->Antenna.field.TxPath == 2)) - pAd->StaCfg.HTPhyMode.field.STBC = STBC_USE; - else - pAd->StaCfg.HTPhyMode.field.STBC = STBC_NONE; + //pAd->DrsCounters.LastTimeTxRateChangeAction = pAd->DrsCounters.LastSecTxRateChangeAction; - if (pTxRate->CurrMCS < MCS_AUTO) - pAd->StaCfg.HTPhyMode.field.MCS = pTxRate->CurrMCS; + // + // Keep the last time TxRateChangeAction status. + // + pEntry->LastTimeTxRateChangeAction = pEntry->LastSecTxRateChangeAction; - if (pAd->StaCfg.HTPhyMode.field.MCS > 7) - pAd->StaCfg.HTPhyMode.field.STBC = STBC_NONE; - if (ADHOC_ON(pAd)) - { - // If peer adhoc is b-only mode, we can't send 11g rate. - pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; - pEntry->HTPhyMode.field.STBC = STBC_NONE; // - // For Adhoc MODE_CCK, driver will use AdhocBOnlyJoined flag to roll back to B only if necessary + // CASE 1. when TX samples are fewer than 15, then decide TX rate solely on RSSI + // (criteria copied from RT2500 for Netopia case) // - pEntry->HTPhyMode.field.MODE = pTxRate->Mode; - pEntry->HTPhyMode.field.ShortGI = pAd->StaCfg.HTPhyMode.field.ShortGI; - pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - - // Patch speed error in status page - pAd->StaCfg.HTPhyMode.field.MODE = pEntry->HTPhyMode.field.MODE; - } - else + if (TxTotalCnt <= 15) { - if (pTxRate->Mode <= MaxMode) - pAd->StaCfg.HTPhyMode.field.MODE = pTxRate->Mode; + CHAR idx = 0; + UCHAR TxRateIdx; + UCHAR MCS0 = 0, MCS1 = 0, MCS2 = 0, MCS3 = 0, MCS4 = 0, MCS5 =0, MCS6 = 0, MCS7 = 0; + UCHAR MCS12 = 0, MCS13 = 0, MCS14 = 0, MCS15 = 0; + UCHAR MCS20 = 0, MCS21 = 0, MCS22 = 0, MCS23 = 0; // 3*3 - if (pTxRate->ShortGI && (pAd->StaCfg.MaxHTPhyMode.field.ShortGI)) - pAd->StaCfg.HTPhyMode.field.ShortGI = GI_400; - else - pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; + // check the existence and index of each needed MCS + while (idx < pTable[0]) + { + pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(idx+1)*5]; - // Reexam each bandwidth's SGI support. - if (pAd->StaCfg.HTPhyMode.field.ShortGI == GI_400) + if (pCurrTxRate->CurrMCS == MCS_0) { - if ((pEntry->HTPhyMode.field.BW == BW_20) && (!CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_SGI20_CAPABLE))) - pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; - if ((pEntry->HTPhyMode.field.BW == BW_40) && (!CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_SGI40_CAPABLE))) - pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; + MCS0 = idx; } - - // Turn RTS/CTS rate to 6Mbps. - if ((pEntry->HTPhyMode.field.MCS == 0) && (pAd->StaCfg.HTPhyMode.field.MCS != 0)) + else if (pCurrTxRate->CurrMCS == MCS_1) { - pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - if (pAd->MacTab.fAnyBASession) + MCS1 = idx; + } + else if (pCurrTxRate->CurrMCS == MCS_2) { - AsicUpdateProtect(pAd, HT_FORCERTSCTS, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); + MCS2 = idx; } - else + else if (pCurrTxRate->CurrMCS == MCS_3) { - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); + MCS3 = idx; + } + else if (pCurrTxRate->CurrMCS == MCS_4) + { + MCS4 = idx; } + else if (pCurrTxRate->CurrMCS == MCS_5) + { + MCS5 = idx; } - else if ((pEntry->HTPhyMode.field.MCS == 8) && (pAd->StaCfg.HTPhyMode.field.MCS != 8)) + else if (pCurrTxRate->CurrMCS == MCS_6) { - pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - if (pAd->MacTab.fAnyBASession) + MCS6 = idx; + } + //else if (pCurrTxRate->CurrMCS == MCS_7) + else if ((pCurrTxRate->CurrMCS == MCS_7) && (pCurrTxRate->ShortGI == GI_800)) // prevent the highest MCS using short GI when 1T and low throughput { - AsicUpdateProtect(pAd, HT_FORCERTSCTS, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); + MCS7 = idx; } - else + else if (pCurrTxRate->CurrMCS == MCS_12) { - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); + MCS12 = idx; } + else if (pCurrTxRate->CurrMCS == MCS_13) + { + MCS13 = idx; } - else if ((pEntry->HTPhyMode.field.MCS != 0) && (pAd->StaCfg.HTPhyMode.field.MCS == 0)) + else if (pCurrTxRate->CurrMCS == MCS_14) { - AsicUpdateProtect(pAd, HT_RTSCTS_6M, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); - + MCS14 = idx; } - else if ((pEntry->HTPhyMode.field.MCS != 8) && (pAd->StaCfg.HTPhyMode.field.MCS == 8)) + //else if ((pCurrTxRate->CurrMCS == MCS_15)/* && (pCurrTxRate->ShortGI == GI_800)*/) //we hope to use ShortGI as initial rate + else if ((pCurrTxRate->CurrMCS == MCS_15) && (pCurrTxRate->ShortGI == GI_800)) //we hope to use ShortGI as initial rate, however Atheros's chip has bugs when short GI { - AsicUpdateProtect(pAd, HT_RTSCTS_6M, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); + MCS15 = idx; } + else if (pCurrTxRate->CurrMCS == MCS_20) // 3*3 + { + MCS20 = idx; + } + else if (pCurrTxRate->CurrMCS == MCS_21) + { + MCS21 = idx; + } + else if (pCurrTxRate->CurrMCS == MCS_22) + { + MCS22 = idx; + } + else if (pCurrTxRate->CurrMCS == MCS_23) + { + MCS23 = idx; + } + idx ++; + } - pEntry->HTPhyMode.field.STBC = pAd->StaCfg.HTPhyMode.field.STBC; - pEntry->HTPhyMode.field.ShortGI = pAd->StaCfg.HTPhyMode.field.ShortGI; - pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - pEntry->HTPhyMode.field.MODE = pAd->StaCfg.HTPhyMode.field.MODE; - - if ((pAd->StaCfg.MaxHTPhyMode.field.MODE == MODE_HTGREENFIELD) && - pAd->WIFItestbed.bGreenField) - pEntry->HTPhyMode.field.MODE = MODE_HTGREENFIELD; - } - - pAd->LastTxRate = (USHORT)(pEntry->HTPhyMode.word); -} - -/* - ========================================================================== - Description: - This routine calculates the acumulated TxPER of eaxh TxRate. And - according to the calculation result, change CommonCfg.TxRate which - is the stable TX Rate we expect the Radio situation could sustained. + if (pAd->LatchRfRegs.Channel <= 14) + { + if (pAd->NicConfig2.field.ExternalLNAForG) + { + RssiOffset = 2; + } + else + { + RssiOffset = 5; + } + } + else + { + if (pAd->NicConfig2.field.ExternalLNAForA) + { + RssiOffset = 5; + } + else + { + RssiOffset = 8; + } + } - CommonCfg.TxRate will change dynamically within {RATE_1/RATE_6, MaxTxRate} - Output: - CommonCfg.TxRate - - - IRQL = DISPATCH_LEVEL - - NOTE: - call this routine every second - ========================================================================== - */ -VOID MlmeDynamicTxRateSwitching( - IN PRTMP_ADAPTER pAd) -{ - UCHAR UpRateIdx = 0, DownRateIdx = 0, CurrRateIdx; - ULONG i, AccuTxTotalCnt = 0, TxTotalCnt; - ULONG TxErrorRatio = 0; - BOOLEAN bTxRateChanged, bUpgradeQuality = FALSE; - PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate = NULL; - PUCHAR pTable; - UCHAR TableSize = 0; - UCHAR InitTxRateIdx = 0, TrainUp, TrainDown; - CHAR Rssi, RssiOffset = 0; - TX_STA_CNT1_STRUC StaTx1; - TX_STA_CNT0_STRUC TxStaCnt0; - ULONG TxRetransmit = 0, TxSuccess = 0, TxFailCount = 0; - MAC_TABLE_ENTRY *pEntry; - - // - // walk through MAC table, see if need to change AP's TX rate toward each entry - // - for (i = 1; i < MAX_LEN_OF_MAC_TABLE; i++) - { - pEntry = &pAd->MacTab.Content[i]; - - // check if this entry need to switch rate automatically - if (RTMPCheckEntryEnableAutoRateSwitch(pAd, pEntry) == FALSE) - continue; - - if ((pAd->MacTab.Size == 1) || (pEntry->ValidAsDls)) - { -#ifdef RT2860 - Rssi = RTMPMaxRssi(pAd, (CHAR)pAd->StaCfg.RssiSample.AvgRssi0, (CHAR)pAd->StaCfg.RssiSample.AvgRssi1, (CHAR)pAd->StaCfg.RssiSample.AvgRssi2); -#endif -#ifdef RT2870 - Rssi = RTMPMaxRssi(pAd, - pAd->StaCfg.RssiSample.AvgRssi0, - pAd->StaCfg.RssiSample.AvgRssi1, - pAd->StaCfg.RssiSample.AvgRssi2); -#endif - - // Update statistic counter - RTMP_IO_READ32(pAd, TX_STA_CNT0, &TxStaCnt0.word); - RTMP_IO_READ32(pAd, TX_STA_CNT1, &StaTx1.word); - pAd->bUpdateBcnCntDone = TRUE; - TxRetransmit = StaTx1.field.TxRetransmit; - TxSuccess = StaTx1.field.TxSuccess; - TxFailCount = TxStaCnt0.field.TxFailCount; - TxTotalCnt = TxRetransmit + TxSuccess + TxFailCount; - - pAd->RalinkCounters.OneSecTxRetryOkCount += StaTx1.field.TxRetransmit; - pAd->RalinkCounters.OneSecTxNoRetryOkCount += StaTx1.field.TxSuccess; - pAd->RalinkCounters.OneSecTxFailCount += TxStaCnt0.field.TxFailCount; - pAd->WlanCounters.TransmittedFragmentCount.u.LowPart += StaTx1.field.TxSuccess; - pAd->WlanCounters.RetryCount.u.LowPart += StaTx1.field.TxRetransmit; - pAd->WlanCounters.FailedCount.u.LowPart += TxStaCnt0.field.TxFailCount; - - // if no traffic in the past 1-sec period, don't change TX rate, - // but clear all bad history. because the bad history may affect the next - // Chariot throughput test - AccuTxTotalCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount + - pAd->RalinkCounters.OneSecTxRetryOkCount + - pAd->RalinkCounters.OneSecTxFailCount; - - if (TxTotalCnt) - TxErrorRatio = ((TxRetransmit + TxFailCount) * 100) / TxTotalCnt; - } - else - { -#ifdef RT2860 - Rssi = RTMPMaxRssi(pAd, (CHAR)pEntry->RssiSample.AvgRssi0, (CHAR)pEntry->RssiSample.AvgRssi1, (CHAR)pEntry->RssiSample.AvgRssi2); -#endif -#ifdef RT2870 - if (INFRA_ON(pAd) && (i == 1)) - Rssi = RTMPMaxRssi(pAd, - pAd->StaCfg.RssiSample.AvgRssi0, - pAd->StaCfg.RssiSample.AvgRssi1, - pAd->StaCfg.RssiSample.AvgRssi2); - else - Rssi = RTMPMaxRssi(pAd, - pEntry->RssiSample.AvgRssi0, - pEntry->RssiSample.AvgRssi1, - pEntry->RssiSample.AvgRssi2); -#endif - - TxTotalCnt = pEntry->OneSecTxNoRetryOkCount + - pEntry->OneSecTxRetryOkCount + - pEntry->OneSecTxFailCount; - - if (TxTotalCnt) - TxErrorRatio = ((pEntry->OneSecTxRetryOkCount + pEntry->OneSecTxFailCount) * 100) / TxTotalCnt; - } - - CurrRateIdx = pEntry->CurrTxRateIndex; - - MlmeSelectTxRateTable(pAd, pEntry, &pTable, &TableSize, &InitTxRateIdx); - - if (CurrRateIdx >= TableSize) - { - CurrRateIdx = TableSize - 1; - } - - // When switch from Fixed rate -> auto rate, the REAL TX rate might be different from pAd->CommonCfg.TxRateIndex. - // So need to sync here. - pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(CurrRateIdx+1)*5]; - if ((pEntry->HTPhyMode.field.MCS != pCurrTxRate->CurrMCS) - //&& (pAd->StaCfg.bAutoTxRateSwitch == TRUE) - ) - { - - // Need to sync Real Tx rate and our record. - // Then return for next DRS. - pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(InitTxRateIdx+1)*5]; - pEntry->CurrTxRateIndex = InitTxRateIdx; - MlmeSetTxRate(pAd, pEntry, pCurrTxRate); - - // reset all OneSecTx counters - RESET_ONE_SEC_TX_CNT(pEntry); - continue; - } - - // decide the next upgrade rate and downgrade rate, if any - if ((CurrRateIdx > 0) && (CurrRateIdx < (TableSize - 1))) - { - UpRateIdx = CurrRateIdx + 1; - DownRateIdx = CurrRateIdx -1; - } - else if (CurrRateIdx == 0) - { - UpRateIdx = CurrRateIdx + 1; - DownRateIdx = CurrRateIdx; - } - else if (CurrRateIdx == (TableSize - 1)) - { - UpRateIdx = CurrRateIdx; - DownRateIdx = CurrRateIdx - 1; - } - - pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(CurrRateIdx+1)*5]; - - if ((Rssi > -65) && (pCurrTxRate->Mode >= MODE_HTMIX)) - { - TrainUp = (pCurrTxRate->TrainUp + (pCurrTxRate->TrainUp >> 1)); - TrainDown = (pCurrTxRate->TrainDown + (pCurrTxRate->TrainDown >> 1)); - } - else - { - TrainUp = pCurrTxRate->TrainUp; - TrainDown = pCurrTxRate->TrainDown; - } - - //pAd->DrsCounters.LastTimeTxRateChangeAction = pAd->DrsCounters.LastSecTxRateChangeAction; - - // - // Keep the last time TxRateChangeAction status. - // - pEntry->LastTimeTxRateChangeAction = pEntry->LastSecTxRateChangeAction; - - - - // - // CASE 1. when TX samples are fewer than 15, then decide TX rate solely on RSSI - // (criteria copied from RT2500 for Netopia case) - // - if (TxTotalCnt <= 15) - { - CHAR idx = 0; - UCHAR TxRateIdx; - //UCHAR MCS0 = 0, MCS1 = 0, MCS2 = 0, MCS3 = 0, MCS4 = 0, MCS7 = 0, MCS12 = 0, MCS13 = 0, MCS14 = 0, MCS15 = 0; - UCHAR MCS0 = 0, MCS1 = 0, MCS2 = 0, MCS3 = 0, MCS4 = 0, MCS5 =0, MCS6 = 0, MCS7 = 0; - UCHAR MCS12 = 0, MCS13 = 0, MCS14 = 0, MCS15 = 0; - UCHAR MCS20 = 0, MCS21 = 0, MCS22 = 0, MCS23 = 0; // 3*3 - - // check the existence and index of each needed MCS - while (idx < pTable[0]) - { - pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(idx+1)*5]; - - if (pCurrTxRate->CurrMCS == MCS_0) - { - MCS0 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_1) - { - MCS1 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_2) - { - MCS2 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_3) - { - MCS3 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_4) - { - MCS4 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_5) - { - MCS5 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_6) - { - MCS6 = idx; - } - //else if (pCurrTxRate->CurrMCS == MCS_7) - else if ((pCurrTxRate->CurrMCS == MCS_7) && (pCurrTxRate->ShortGI == GI_800)) // prevent the highest MCS using short GI when 1T and low throughput - { - MCS7 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_12) - { - MCS12 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_13) - { - MCS13 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_14) - { - MCS14 = idx; - } - else if ((pCurrTxRate->CurrMCS == MCS_15) && (pCurrTxRate->ShortGI == GI_800)) //we hope to use ShortGI as initial rate, however Atheros's chip has bugs when short GI - { - MCS15 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_20) // 3*3 - { - MCS20 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_21) - { - MCS21 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_22) - { - MCS22 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_23) - { - MCS23 = idx; - } - idx ++; - } - - if (pAd->LatchRfRegs.Channel <= 14) - { - if (pAd->NicConfig2.field.ExternalLNAForG) - { - RssiOffset = 2; - } - else - { - RssiOffset = 5; - } - } - else - { - if (pAd->NicConfig2.field.ExternalLNAForA) - { - RssiOffset = 5; - } - else - { - RssiOffset = 8; - } - } - - /*if (MCS15)*/ - if ((pTable == RateSwitchTable11BGN3S) || - (pTable == RateSwitchTable11N3S) || - (pTable == RateSwitchTable)) - {// N mode with 3 stream // 3*3 - if (MCS23 && (Rssi >= -70)) - TxRateIdx = MCS15; - else if (MCS22 && (Rssi >= -72)) - TxRateIdx = MCS14; - else if (MCS21 && (Rssi >= -76)) - TxRateIdx = MCS13; - else if (MCS20 && (Rssi >= -78)) - TxRateIdx = MCS12; - else if (MCS4 && (Rssi >= -82)) - TxRateIdx = MCS4; - else if (MCS3 && (Rssi >= -84)) - TxRateIdx = MCS3; - else if (MCS2 && (Rssi >= -86)) - TxRateIdx = MCS2; - else if (MCS1 && (Rssi >= -88)) - TxRateIdx = MCS1; - else - TxRateIdx = MCS0; - } - else if ((pTable == RateSwitchTable11BGN2S) || (pTable == RateSwitchTable11BGN2SForABand) ||(pTable == RateSwitchTable11N2S) ||(pTable == RateSwitchTable11N2SForABand)) // 3*3 - {// N mode with 2 stream - if (MCS15 && (Rssi >= (-70+RssiOffset))) - TxRateIdx = MCS15; - else if (MCS14 && (Rssi >= (-72+RssiOffset))) - TxRateIdx = MCS14; - else if (MCS13 && (Rssi >= (-76+RssiOffset))) - TxRateIdx = MCS13; - else if (MCS12 && (Rssi >= (-78+RssiOffset))) - TxRateIdx = MCS12; - else if (MCS4 && (Rssi >= (-82+RssiOffset))) - TxRateIdx = MCS4; - else if (MCS3 && (Rssi >= (-84+RssiOffset))) - TxRateIdx = MCS3; - else if (MCS2 && (Rssi >= (-86+RssiOffset))) - TxRateIdx = MCS2; - else if (MCS1 && (Rssi >= (-88+RssiOffset))) - TxRateIdx = MCS1; - else - TxRateIdx = MCS0; - } - else if ((pTable == RateSwitchTable11BGN1S) || (pTable == RateSwitchTable11N1S)) - {// N mode with 1 stream - if (MCS7 && (Rssi > (-72+RssiOffset))) - TxRateIdx = MCS7; - else if (MCS6 && (Rssi > (-74+RssiOffset))) - TxRateIdx = MCS6; - else if (MCS5 && (Rssi > (-77+RssiOffset))) - TxRateIdx = MCS5; - else if (MCS4 && (Rssi > (-79+RssiOffset))) - TxRateIdx = MCS4; - else if (MCS3 && (Rssi > (-81+RssiOffset))) - TxRateIdx = MCS3; - else if (MCS2 && (Rssi > (-83+RssiOffset))) - TxRateIdx = MCS2; - else if (MCS1 && (Rssi > (-86+RssiOffset))) - TxRateIdx = MCS1; - else - TxRateIdx = MCS0; - } - else - {// Legacy mode - if (MCS7 && (Rssi > -70)) - TxRateIdx = MCS7; - else if (MCS6 && (Rssi > -74)) - TxRateIdx = MCS6; - else if (MCS5 && (Rssi > -78)) - TxRateIdx = MCS5; - else if (MCS4 && (Rssi > -82)) - TxRateIdx = MCS4; - else if (MCS4 == 0) // for B-only mode - TxRateIdx = MCS3; - else if (MCS3 && (Rssi > -85)) - TxRateIdx = MCS3; - else if (MCS2 && (Rssi > -87)) - TxRateIdx = MCS2; - else if (MCS1 && (Rssi > -90)) - TxRateIdx = MCS1; - else - TxRateIdx = MCS0; - } - - { - pEntry->CurrTxRateIndex = TxRateIdx; - pNextTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(pEntry->CurrTxRateIndex+1)*5]; - MlmeSetTxRate(pAd, pEntry, pNextTxRate); - } - - NdisZeroMemory(pEntry->TxQuality, sizeof(USHORT) * MAX_STEP_OF_TX_RATE_SWITCH); - NdisZeroMemory(pEntry->PER, sizeof(UCHAR) * MAX_STEP_OF_TX_RATE_SWITCH); - pEntry->fLastSecAccordingRSSI = TRUE; - // reset all OneSecTx counters - RESET_ONE_SEC_TX_CNT(pEntry); - - continue; - } - - if (pEntry->fLastSecAccordingRSSI == TRUE) - { - pEntry->fLastSecAccordingRSSI = FALSE; - pEntry->LastSecTxRateChangeAction = 0; - // reset all OneSecTx counters - RESET_ONE_SEC_TX_CNT(pEntry); - - continue; - } - - do - { - BOOLEAN bTrainUpDown = FALSE; - - pEntry->CurrTxRateStableTime ++; - - // downgrade TX quality if PER >= Rate-Down threshold - if (TxErrorRatio >= TrainDown) - { - bTrainUpDown = TRUE; - pEntry->TxQuality[CurrRateIdx] = DRS_TX_QUALITY_WORST_BOUND; - } - // upgrade TX quality if PER <= Rate-Up threshold - else if (TxErrorRatio <= TrainUp) - { - bTrainUpDown = TRUE; - bUpgradeQuality = TRUE; - if (pEntry->TxQuality[CurrRateIdx]) - pEntry->TxQuality[CurrRateIdx] --; // quality very good in CurrRate - - if (pEntry->TxRateUpPenalty) - pEntry->TxRateUpPenalty --; - else if (pEntry->TxQuality[UpRateIdx]) - pEntry->TxQuality[UpRateIdx] --; // may improve next UP rate's quality - } - - pEntry->PER[CurrRateIdx] = (UCHAR)TxErrorRatio; - - if (bTrainUpDown) - { - // perform DRS - consider TxRate Down first, then rate up. - if ((CurrRateIdx != DownRateIdx) && (pEntry->TxQuality[CurrRateIdx] >= DRS_TX_QUALITY_WORST_BOUND)) - { - pEntry->CurrTxRateIndex = DownRateIdx; - } - else if ((CurrRateIdx != UpRateIdx) && (pEntry->TxQuality[UpRateIdx] <= 0)) - { - pEntry->CurrTxRateIndex = UpRateIdx; - } - } - } while (FALSE); - - // if rate-up happen, clear all bad history of all TX rates - if (pEntry->CurrTxRateIndex > CurrRateIdx) - { - pEntry->CurrTxRateStableTime = 0; - pEntry->TxRateUpPenalty = 0; - pEntry->LastSecTxRateChangeAction = 1; // rate UP - NdisZeroMemory(pEntry->TxQuality, sizeof(USHORT) * MAX_STEP_OF_TX_RATE_SWITCH); - NdisZeroMemory(pEntry->PER, sizeof(UCHAR) * MAX_STEP_OF_TX_RATE_SWITCH); - - // - // For TxRate fast train up - // - if (!pAd->StaCfg.StaQuickResponeForRateUpTimerRunning) - { - RTMPSetTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, 100); - - pAd->StaCfg.StaQuickResponeForRateUpTimerRunning = TRUE; - } - bTxRateChanged = TRUE; - } - // if rate-down happen, only clear DownRate's bad history - else if (pEntry->CurrTxRateIndex < CurrRateIdx) - { - pEntry->CurrTxRateStableTime = 0; - pEntry->TxRateUpPenalty = 0; // no penalty - pEntry->LastSecTxRateChangeAction = 2; // rate DOWN - pEntry->TxQuality[pEntry->CurrTxRateIndex] = 0; - pEntry->PER[pEntry->CurrTxRateIndex] = 0; - - // - // For TxRate fast train down - // - if (!pAd->StaCfg.StaQuickResponeForRateUpTimerRunning) - { - RTMPSetTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, 100); - - pAd->StaCfg.StaQuickResponeForRateUpTimerRunning = TRUE; - } - bTxRateChanged = TRUE; - } - else - { - pEntry->LastSecTxRateChangeAction = 0; // rate no change - bTxRateChanged = FALSE; - } - - pEntry->LastTxOkCount = TxSuccess; - - // reset all OneSecTx counters - RESET_ONE_SEC_TX_CNT(pEntry); - - pNextTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(pEntry->CurrTxRateIndex+1)*5]; - if (bTxRateChanged && pNextTxRate) - { - MlmeSetTxRate(pAd, pEntry, pNextTxRate); - } - } -} - -/* - ======================================================================== - Routine Description: - Station side, Auto TxRate faster train up timer call back function. - - Arguments: - SystemSpecific1 - Not used. - FunctionContext - Pointer to our Adapter context. - SystemSpecific2 - Not used. - SystemSpecific3 - Not used. - - Return Value: - None - - ======================================================================== -*/ -VOID StaQuickResponeForRateUpExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)FunctionContext; - UCHAR UpRateIdx = 0, DownRateIdx = 0, CurrRateIdx = 0; - ULONG TxTotalCnt; - ULONG TxErrorRatio = 0; -#ifdef RT2860 - BOOLEAN bTxRateChanged = TRUE; //, bUpgradeQuality = FALSE; -#endif -#ifdef RT2870 - BOOLEAN bTxRateChanged; //, bUpgradeQuality = FALSE; -#endif - PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate = NULL; - PUCHAR pTable; - UCHAR TableSize = 0; - UCHAR InitTxRateIdx = 0, TrainUp, TrainDown; - TX_STA_CNT1_STRUC StaTx1; - TX_STA_CNT0_STRUC TxStaCnt0; - CHAR Rssi, ratio; - ULONG TxRetransmit = 0, TxSuccess = 0, TxFailCount = 0; - MAC_TABLE_ENTRY *pEntry; - ULONG i; - - pAd->StaCfg.StaQuickResponeForRateUpTimerRunning = FALSE; - - // - // walk through MAC table, see if need to change AP's TX rate toward each entry - // - for (i = 1; i < MAX_LEN_OF_MAC_TABLE; i++) - { - pEntry = &pAd->MacTab.Content[i]; - - // check if this entry need to switch rate automatically - if (RTMPCheckEntryEnableAutoRateSwitch(pAd, pEntry) == FALSE) - continue; - -#ifdef RT2860 - //Rssi = RTMPMaxRssi(pAd, (CHAR)pAd->StaCfg.AvgRssi0, (CHAR)pAd->StaCfg.AvgRssi1, (CHAR)pAd->StaCfg.AvgRssi2); - if (pAd->Antenna.field.TxPath > 1) - Rssi = (pAd->StaCfg.RssiSample.AvgRssi0 + pAd->StaCfg.RssiSample.AvgRssi1) >> 1; - else - Rssi = pAd->StaCfg.RssiSample.AvgRssi0; -#endif -#ifdef RT2870 - if (INFRA_ON(pAd) && (i == 1)) - Rssi = RTMPMaxRssi(pAd, - pAd->StaCfg.RssiSample.AvgRssi0, - pAd->StaCfg.RssiSample.AvgRssi1, - pAd->StaCfg.RssiSample.AvgRssi2); - else - Rssi = RTMPMaxRssi(pAd, - pEntry->RssiSample.AvgRssi0, - pEntry->RssiSample.AvgRssi1, - pEntry->RssiSample.AvgRssi2); -#endif - - CurrRateIdx = pAd->CommonCfg.TxRateIndex; - - MlmeSelectTxRateTable(pAd, pEntry, &pTable, &TableSize, &InitTxRateIdx); - - // decide the next upgrade rate and downgrade rate, if any - if ((CurrRateIdx > 0) && (CurrRateIdx < (TableSize - 1))) - { - UpRateIdx = CurrRateIdx + 1; - DownRateIdx = CurrRateIdx -1; - } - else if (CurrRateIdx == 0) - { - UpRateIdx = CurrRateIdx + 1; - DownRateIdx = CurrRateIdx; - } - else if (CurrRateIdx == (TableSize - 1)) - { - UpRateIdx = CurrRateIdx; - DownRateIdx = CurrRateIdx - 1; - } - - pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(CurrRateIdx+1)*5]; - - if ((Rssi > -65) && (pCurrTxRate->Mode >= MODE_HTMIX)) - { - TrainUp = (pCurrTxRate->TrainUp + (pCurrTxRate->TrainUp >> 1)); - TrainDown = (pCurrTxRate->TrainDown + (pCurrTxRate->TrainDown >> 1)); - } - else - { - TrainUp = pCurrTxRate->TrainUp; - TrainDown = pCurrTxRate->TrainDown; - } - - if (pAd->MacTab.Size == 1) - { - // Update statistic counter - RTMP_IO_READ32(pAd, TX_STA_CNT0, &TxStaCnt0.word); - RTMP_IO_READ32(pAd, TX_STA_CNT1, &StaTx1.word); - - TxRetransmit = StaTx1.field.TxRetransmit; - TxSuccess = StaTx1.field.TxSuccess; - TxFailCount = TxStaCnt0.field.TxFailCount; - TxTotalCnt = TxRetransmit + TxSuccess + TxFailCount; - - pAd->RalinkCounters.OneSecTxRetryOkCount += StaTx1.field.TxRetransmit; - pAd->RalinkCounters.OneSecTxNoRetryOkCount += StaTx1.field.TxSuccess; - pAd->RalinkCounters.OneSecTxFailCount += TxStaCnt0.field.TxFailCount; - pAd->WlanCounters.TransmittedFragmentCount.u.LowPart += StaTx1.field.TxSuccess; - pAd->WlanCounters.RetryCount.u.LowPart += StaTx1.field.TxRetransmit; - pAd->WlanCounters.FailedCount.u.LowPart += TxStaCnt0.field.TxFailCount; - - if (TxTotalCnt) - TxErrorRatio = ((TxRetransmit + TxFailCount) * 100) / TxTotalCnt; - } - else - { - TxTotalCnt = pEntry->OneSecTxNoRetryOkCount + - pEntry->OneSecTxRetryOkCount + - pEntry->OneSecTxFailCount; - - if (TxTotalCnt) - TxErrorRatio = ((pEntry->OneSecTxRetryOkCount + pEntry->OneSecTxFailCount) * 100) / TxTotalCnt; - } - - - // - // CASE 1. when TX samples are fewer than 15, then decide TX rate solely on RSSI - // (criteria copied from RT2500 for Netopia case) - // - if (TxTotalCnt <= 12) - { - NdisZeroMemory(pAd->DrsCounters.TxQuality, sizeof(USHORT) * MAX_STEP_OF_TX_RATE_SWITCH); - NdisZeroMemory(pAd->DrsCounters.PER, sizeof(UCHAR) * MAX_STEP_OF_TX_RATE_SWITCH); - - if ((pAd->DrsCounters.LastSecTxRateChangeAction == 1) && (CurrRateIdx != DownRateIdx)) - { - pAd->CommonCfg.TxRateIndex = DownRateIdx; - pAd->DrsCounters.TxQuality[CurrRateIdx] = DRS_TX_QUALITY_WORST_BOUND; - } - else if ((pAd->DrsCounters.LastSecTxRateChangeAction == 2) && (CurrRateIdx != UpRateIdx)) - { - pAd->CommonCfg.TxRateIndex = UpRateIdx; - } - - DBGPRINT_RAW(RT_DEBUG_TRACE,("QuickDRS: TxTotalCnt <= 15, train back to original rate \n")); - return; - } - - do - { - ULONG OneSecTxNoRetryOKRationCount; - - if (pAd->DrsCounters.LastTimeTxRateChangeAction == 0) - ratio = 5; - else - ratio = 4; - - // downgrade TX quality if PER >= Rate-Down threshold - if (TxErrorRatio >= TrainDown) - { - pAd->DrsCounters.TxQuality[CurrRateIdx] = DRS_TX_QUALITY_WORST_BOUND; - } - - pAd->DrsCounters.PER[CurrRateIdx] = (UCHAR)TxErrorRatio; - - OneSecTxNoRetryOKRationCount = (TxSuccess * ratio); - - // perform DRS - consider TxRate Down first, then rate up. - if ((pAd->DrsCounters.LastSecTxRateChangeAction == 1) && (CurrRateIdx != DownRateIdx)) - { - if ((pAd->DrsCounters.LastTxOkCount + 2) >= OneSecTxNoRetryOKRationCount) - { - pAd->CommonCfg.TxRateIndex = DownRateIdx; - pAd->DrsCounters.TxQuality[CurrRateIdx] = DRS_TX_QUALITY_WORST_BOUND; - - } - - } - else if ((pAd->DrsCounters.LastSecTxRateChangeAction == 2) && (CurrRateIdx != UpRateIdx)) - { - if ((TxErrorRatio >= 50) || (TxErrorRatio >= TrainDown)) - { - - } - else if ((pAd->DrsCounters.LastTxOkCount + 2) >= OneSecTxNoRetryOKRationCount) - { - pAd->CommonCfg.TxRateIndex = UpRateIdx; - } - } - }while (FALSE); - - // if rate-up happen, clear all bad history of all TX rates - if (pAd->CommonCfg.TxRateIndex > CurrRateIdx) - { - pAd->DrsCounters.TxRateUpPenalty = 0; - NdisZeroMemory(pAd->DrsCounters.TxQuality, sizeof(USHORT) * MAX_STEP_OF_TX_RATE_SWITCH); - NdisZeroMemory(pAd->DrsCounters.PER, sizeof(UCHAR) * MAX_STEP_OF_TX_RATE_SWITCH); -#ifdef RT2870 - bTxRateChanged = TRUE; -#endif - } - // if rate-down happen, only clear DownRate's bad history - else if (pAd->CommonCfg.TxRateIndex < CurrRateIdx) - { - DBGPRINT_RAW(RT_DEBUG_TRACE,("QuickDRS: --TX rate from %d to %d \n", CurrRateIdx, pAd->CommonCfg.TxRateIndex)); - - pAd->DrsCounters.TxRateUpPenalty = 0; // no penalty - pAd->DrsCounters.TxQuality[pAd->CommonCfg.TxRateIndex] = 0; - pAd->DrsCounters.PER[pAd->CommonCfg.TxRateIndex] = 0; -#ifdef RT2870 - bTxRateChanged = TRUE; -#endif - } - else - { - bTxRateChanged = FALSE; - } - - pNextTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(pAd->CommonCfg.TxRateIndex+1)*5]; - if (bTxRateChanged && pNextTxRate) - { - MlmeSetTxRate(pAd, pEntry, pNextTxRate); - } - } -} - -/* - ========================================================================== - Description: - This routine is executed periodically inside MlmePeriodicExec() after - association with an AP. - It checks if StaCfg.Psm is consistent with user policy (recorded in - StaCfg.WindowsPowerMode). If not, enforce user policy. However, - there're some conditions to consider: - 1. we don't support power-saving in ADHOC mode, so Psm=PWR_ACTIVE all - the time when Mibss==TRUE - 2. When link up in INFRA mode, Psm should not be switch to PWR_SAVE - if outgoing traffic available in TxRing or MgmtRing. - Output: - 1. change pAd->StaCfg.Psm to PWR_SAVE or leave it untouched - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID MlmeCheckPsmChange( - IN PRTMP_ADAPTER pAd, - IN ULONG Now32) -{ - ULONG PowerMode; - - // condition - - // 1. Psm maybe ON only happen in INFRASTRUCTURE mode - // 2. user wants either MAX_PSP or FAST_PSP - // 3. but current psm is not in PWR_SAVE - // 4. CNTL state machine is not doing SCANning - // 5. no TX SUCCESS event for the past 1-sec period -#ifdef NDIS51_MINIPORT - if (pAd->StaCfg.WindowsPowerProfile == NdisPowerProfileBattery) - PowerMode = pAd->StaCfg.WindowsBatteryPowerMode; - else -#endif - PowerMode = pAd->StaCfg.WindowsPowerMode; - - if (INFRA_ON(pAd) && - (PowerMode != Ndis802_11PowerModeCAM) && - (pAd->StaCfg.Psm == PWR_ACTIVE) && -#ifdef RT2860 - RTMP_TEST_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP)) -#else - (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE)) -#endif - { - // add by johnli, use Rx OK data count per second to calculate throughput - // If Ttraffic is too high ( > 400 Rx per second), don't go to sleep mode. If tx rate is low, use low criteria - // Mode=CCK/MCS=3 => 11 Mbps, Mode=OFDM/MCS=3 => 18 Mbps - if (((pAd->StaCfg.HTPhyMode.field.MCS <= 3) && - (pAd->RalinkCounters.OneSecRxOkDataCnt < (ULONG)100)) || - ((pAd->StaCfg.HTPhyMode.field.MCS > 3) && - (pAd->RalinkCounters.OneSecRxOkDataCnt < (ULONG)400))) - { - // Get this time - NdisGetSystemUpTime(&pAd->Mlme.LastSendNULLpsmTime); - pAd->RalinkCounters.RxCountSinceLastNULL = 0; - MlmeSetPsmBit(pAd, PWR_SAVE); - if (!(pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable)) - { - RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, FALSE); - } - else - { - RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, TRUE); - } - } - } -} - -// IRQL = PASSIVE_LEVEL -// IRQL = DISPATCH_LEVEL -VOID MlmeSetPsmBit( - IN PRTMP_ADAPTER pAd, - IN USHORT psm) -{ - AUTO_RSP_CFG_STRUC csr4; - - pAd->StaCfg.Psm = psm; - RTMP_IO_READ32(pAd, AUTO_RSP_CFG, &csr4.word); - csr4.field.AckCtsPsmBit = (psm == PWR_SAVE)? 1:0; - RTMP_IO_WRITE32(pAd, AUTO_RSP_CFG, csr4.word); - - DBGPRINT(RT_DEBUG_TRACE, ("MlmeSetPsmBit = %d\n", psm)); -} - -// IRQL = DISPATCH_LEVEL -VOID MlmeSetTxPreamble( - IN PRTMP_ADAPTER pAd, - IN USHORT TxPreamble) -{ - AUTO_RSP_CFG_STRUC csr4; - - // - // Always use Long preamble before verifiation short preamble functionality works well. - // Todo: remove the following line if short preamble functionality works - // - //TxPreamble = Rt802_11PreambleLong; - - RTMP_IO_READ32(pAd, AUTO_RSP_CFG, &csr4.word); - if (TxPreamble == Rt802_11PreambleLong) - { - DBGPRINT(RT_DEBUG_TRACE, ("MlmeSetTxPreamble (= LONG PREAMBLE)\n")); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); - csr4.field.AutoResponderPreamble = 0; - } - else - { - // NOTE: 1Mbps should always use long preamble - DBGPRINT(RT_DEBUG_TRACE, ("MlmeSetTxPreamble (= SHORT PREAMBLE)\n")); - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); - csr4.field.AutoResponderPreamble = 1; - } - - RTMP_IO_WRITE32(pAd, AUTO_RSP_CFG, csr4.word); -} - -/* - ========================================================================== - Description: - Update basic rate bitmap - ========================================================================== - */ - -VOID UpdateBasicRateBitmap( - IN PRTMP_ADAPTER pAdapter) -{ - INT i, j; - /* 1 2 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 */ - UCHAR rate[] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 }; - UCHAR *sup_p = pAdapter->CommonCfg.SupRate; - UCHAR *ext_p = pAdapter->CommonCfg.ExtRate; - ULONG bitmap = pAdapter->CommonCfg.BasicRateBitmap; - - - /* if A mode, always use fix BasicRateBitMap */ - //if (pAdapter->CommonCfg.Channel == PHY_11A) - if (pAdapter->CommonCfg.Channel > 14) - pAdapter->CommonCfg.BasicRateBitmap = 0x150; /* 6, 12, 24M */ - /* End of if */ - - if (pAdapter->CommonCfg.BasicRateBitmap > 4095) - { - /* (2 ^ MAX_LEN_OF_SUPPORTED_RATES) -1 */ - return; - } /* End of if */ - - for(i=0; iCommonCfg.DesireRate[i] & 0x7f) - { - case 2: Rate = RATE_1; num++; break; - case 4: Rate = RATE_2; num++; break; - case 11: Rate = RATE_5_5; num++; break; - case 22: Rate = RATE_11; num++; break; - case 12: Rate = RATE_6; num++; break; - case 18: Rate = RATE_9; num++; break; - case 24: Rate = RATE_12; num++; break; - case 36: Rate = RATE_18; num++; break; - case 48: Rate = RATE_24; num++; break; - case 72: Rate = RATE_36; num++; break; - case 96: Rate = RATE_48; num++; break; - case 108: Rate = RATE_54; num++; break; - //default: Rate = RATE_1; break; - } - if (MaxDesire < Rate) MaxDesire = Rate; - } - -//=========================================================================== -//=========================================================================== - { - pHtPhy = &pAd->StaCfg.HTPhyMode; - pMaxHtPhy = &pAd->StaCfg.MaxHTPhyMode; - pMinHtPhy = &pAd->StaCfg.MinHTPhyMode; - - auto_rate_cur_p = &pAd->StaCfg.bAutoTxRateSwitch; - HtMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS; - - if ((pAd->StaCfg.BssType == BSS_ADHOC) && - (pAd->CommonCfg.PhyMode == PHY_11B) && - (MaxDesire > RATE_11)) - { - MaxDesire = RATE_11; - } - } - - pAd->CommonCfg.MaxDesiredRate = MaxDesire; - pMinHtPhy->word = 0; - pMaxHtPhy->word = 0; - pHtPhy->word = 0; - - // Auto rate switching is enabled only if more than one DESIRED RATES are - // specified; otherwise disabled - if (num <= 1) - { - *auto_rate_cur_p = FALSE; - } - else - { - *auto_rate_cur_p = TRUE; - } - -#if 1 - if (HtMcs != MCS_AUTO) - { - *auto_rate_cur_p = FALSE; - } - else - { - *auto_rate_cur_p = TRUE; - } -#endif - - if ((ADHOC_ON(pAd) || INFRA_ON(pAd)) && (pAd->OpMode == OPMODE_STA)) - { - pSupRate = &pAd->StaActive.SupRate[0]; - pExtRate = &pAd->StaActive.ExtRate[0]; - SupRateLen = pAd->StaActive.SupRateLen; - ExtRateLen = pAd->StaActive.ExtRateLen; - } - else - { - pSupRate = &pAd->CommonCfg.SupRate[0]; - pExtRate = &pAd->CommonCfg.ExtRate[0]; - SupRateLen = pAd->CommonCfg.SupRateLen; - ExtRateLen = pAd->CommonCfg.ExtRateLen; - } - - // find max supported rate - for (i=0; i Rate) MinSupport = Rate; - } - - for (i=0; i Rate) MinSupport = Rate; - } - - RTMP_IO_WRITE32(pAd, LEGACY_BASIC_RATE, BasicRateBitmap); - - // calculate the exptected ACK rate for each TX rate. This info is used to caculate - // the DURATION field of outgoing uniicast DATA/MGMT frame - for (i=0; iCommonCfg.ExpectedACKRate[i] = CurrBasicRate; - } - - DBGPRINT(RT_DEBUG_TRACE,("MlmeUpdateTxRates[MaxSupport = %d] = MaxDesire %d Mbps\n", RateIdToMbps[MaxSupport], RateIdToMbps[MaxDesire])); - // max tx rate = min {max desire rate, max supported rate} - if (MaxSupport < MaxDesire) - pAd->CommonCfg.MaxTxRate = MaxSupport; - else - pAd->CommonCfg.MaxTxRate = MaxDesire; - - pAd->CommonCfg.MinTxRate = MinSupport; - if (*auto_rate_cur_p) - { - short dbm = 0; - - dbm = pAd->StaCfg.RssiSample.AvgRssi0 - pAd->BbpRssiToDbmDelta; - - if (bLinkUp == TRUE) - pAd->CommonCfg.TxRate = RATE_24; - else - pAd->CommonCfg.TxRate = pAd->CommonCfg.MaxTxRate; - - if (dbm < -75) - pAd->CommonCfg.TxRate = RATE_11; - else if (dbm < -70) - pAd->CommonCfg.TxRate = RATE_24; - - // should never exceed MaxTxRate (consider 11B-only mode) - if (pAd->CommonCfg.TxRate > pAd->CommonCfg.MaxTxRate) - pAd->CommonCfg.TxRate = pAd->CommonCfg.MaxTxRate; - - pAd->CommonCfg.TxRateIndex = 0; - } - else - { - pAd->CommonCfg.TxRate = pAd->CommonCfg.MaxTxRate; - pHtPhy->field.MCS = (pAd->CommonCfg.MaxTxRate > 3) ? (pAd->CommonCfg.MaxTxRate - 4) : pAd->CommonCfg.MaxTxRate; - pHtPhy->field.MODE = (pAd->CommonCfg.MaxTxRate > 3) ? MODE_OFDM : MODE_CCK; - - pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.STBC = pHtPhy->field.STBC; - pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.ShortGI = pHtPhy->field.ShortGI; - pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MCS = pHtPhy->field.MCS; - pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE = pHtPhy->field.MODE; - } - - if (pAd->CommonCfg.TxRate <= RATE_11) - { - pMaxHtPhy->field.MODE = MODE_CCK; - pMaxHtPhy->field.MCS = pAd->CommonCfg.TxRate; - pMinHtPhy->field.MCS = pAd->CommonCfg.MinTxRate; - } - else - { - pMaxHtPhy->field.MODE = MODE_OFDM; - pMaxHtPhy->field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.TxRate]; - if (pAd->CommonCfg.MinTxRate >= RATE_6 && (pAd->CommonCfg.MinTxRate <= RATE_54)) - {pMinHtPhy->field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MinTxRate];} - else - {pMinHtPhy->field.MCS = pAd->CommonCfg.MinTxRate;} - } - - pHtPhy->word = (pMaxHtPhy->word); - if (bLinkUp && (pAd->OpMode == OPMODE_STA)) - { - pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word = pHtPhy->word; - pAd->MacTab.Content[BSSID_WCID].MaxHTPhyMode.word = pMaxHtPhy->word; - pAd->MacTab.Content[BSSID_WCID].MinHTPhyMode.word = pMinHtPhy->word; - } - else - { - switch (pAd->CommonCfg.PhyMode) - { - case PHY_11BG_MIXED: - case PHY_11B: - case PHY_11BGN_MIXED: - pAd->CommonCfg.MlmeRate = RATE_1; - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_CCK; - pAd->CommonCfg.MlmeTransmit.field.MCS = RATE_1; - pAd->CommonCfg.RtsRate = RATE_11; - break; - case PHY_11G: - case PHY_11A: - case PHY_11AGN_MIXED: - case PHY_11GN_MIXED: - case PHY_11N_2_4G: - case PHY_11AN_MIXED: - case PHY_11N_5G: - pAd->CommonCfg.MlmeRate = RATE_6; - pAd->CommonCfg.RtsRate = RATE_6; - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; - pAd->CommonCfg.MlmeTransmit.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; - break; - case PHY_11ABG_MIXED: - case PHY_11ABGN_MIXED: - if (pAd->CommonCfg.Channel <= 14) - { - pAd->CommonCfg.MlmeRate = RATE_1; - pAd->CommonCfg.RtsRate = RATE_1; - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_CCK; - pAd->CommonCfg.MlmeTransmit.field.MCS = RATE_1; - } - else - { - pAd->CommonCfg.MlmeRate = RATE_6; - pAd->CommonCfg.RtsRate = RATE_6; - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; - pAd->CommonCfg.MlmeTransmit.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; - } - break; - default: // error - pAd->CommonCfg.MlmeRate = RATE_6; - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; - pAd->CommonCfg.MlmeTransmit.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; - pAd->CommonCfg.RtsRate = RATE_1; - break; - } - // - // Keep Basic Mlme Rate. - // - pAd->MacTab.Content[MCAST_WCID].HTPhyMode.word = pAd->CommonCfg.MlmeTransmit.word; - if (pAd->CommonCfg.MlmeTransmit.field.MODE == MODE_OFDM) - pAd->MacTab.Content[MCAST_WCID].HTPhyMode.field.MCS = OfdmRateToRxwiMCS[RATE_24]; - else - pAd->MacTab.Content[MCAST_WCID].HTPhyMode.field.MCS = RATE_1; - pAd->CommonCfg.BasicMlmeRate = pAd->CommonCfg.MlmeRate; - } - - DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateTxRates (MaxDesire=%d, MaxSupport=%d, MaxTxRate=%d, MinRate=%d, Rate Switching =%d)\n", - RateIdToMbps[MaxDesire], RateIdToMbps[MaxSupport], RateIdToMbps[pAd->CommonCfg.MaxTxRate], RateIdToMbps[pAd->CommonCfg.MinTxRate], - /*OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)*/*auto_rate_cur_p)); - DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateTxRates (TxRate=%d, RtsRate=%d, BasicRateBitmap=0x%04lx)\n", - RateIdToMbps[pAd->CommonCfg.TxRate], RateIdToMbps[pAd->CommonCfg.RtsRate], BasicRateBitmap)); - DBGPRINT(RT_DEBUG_TRACE, ("MlmeUpdateTxRates (MlmeTransmit=0x%x, MinHTPhyMode=%x, MaxHTPhyMode=0x%x, HTPhyMode=0x%x)\n", - pAd->CommonCfg.MlmeTransmit.word, pAd->MacTab.Content[BSSID_WCID].MinHTPhyMode.word ,pAd->MacTab.Content[BSSID_WCID].MaxHTPhyMode.word ,pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word )); -} - -/* - ========================================================================== - Description: - This function update HT Rate setting. - Input Wcid value is valid for 2 case : - 1. it's used for Station in infra mode that copy AP rate to Mactable. - 2. OR Station in adhoc mode to copy peer's HT rate to Mactable. - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID MlmeUpdateHtTxRates( - IN PRTMP_ADAPTER pAd, - IN UCHAR apidx) -{ - UCHAR StbcMcs; //j, StbcMcs, bitmask; - CHAR i; // 3*3 - RT_HT_CAPABILITY *pRtHtCap = NULL; - RT_HT_PHY_INFO *pActiveHtPhy = NULL; - ULONG BasicMCS; - UCHAR j, bitmask; - PRT_HT_PHY_INFO pDesireHtPhy = NULL; - PHTTRANSMIT_SETTING pHtPhy = NULL; - PHTTRANSMIT_SETTING pMaxHtPhy = NULL; - PHTTRANSMIT_SETTING pMinHtPhy = NULL; - BOOLEAN *auto_rate_cur_p; - - DBGPRINT(RT_DEBUG_TRACE,("MlmeUpdateHtTxRates===> \n")); - - auto_rate_cur_p = NULL; - - { - pDesireHtPhy = &pAd->StaCfg.DesiredHtPhyInfo; - pActiveHtPhy = &pAd->StaCfg.DesiredHtPhyInfo; - pHtPhy = &pAd->StaCfg.HTPhyMode; - pMaxHtPhy = &pAd->StaCfg.MaxHTPhyMode; - pMinHtPhy = &pAd->StaCfg.MinHTPhyMode; - - auto_rate_cur_p = &pAd->StaCfg.bAutoTxRateSwitch; - } - - if ((ADHOC_ON(pAd) || INFRA_ON(pAd)) && (pAd->OpMode == OPMODE_STA)) - { - if (pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) - return; - - pRtHtCap = &pAd->StaActive.SupportedHtPhy; - pActiveHtPhy = &pAd->StaActive.SupportedPhyInfo; - StbcMcs = (UCHAR)pAd->MlmeAux.AddHtInfo.AddHtInfo3.StbcMcs; - BasicMCS =pAd->MlmeAux.AddHtInfo.MCSSet[0]+(pAd->MlmeAux.AddHtInfo.MCSSet[1]<<8)+(StbcMcs<<16); - if ((pAd->CommonCfg.DesiredHtPhy.TxSTBC) && (pRtHtCap->RxSTBC) && (pAd->Antenna.field.TxPath == 2)) - pMaxHtPhy->field.STBC = STBC_USE; - else - pMaxHtPhy->field.STBC = STBC_NONE; - } - else - { - if (pDesireHtPhy->bHtEnable == FALSE) - return; - - pRtHtCap = &pAd->CommonCfg.DesiredHtPhy; - StbcMcs = (UCHAR)pAd->CommonCfg.AddHTInfo.AddHtInfo3.StbcMcs; - BasicMCS = pAd->CommonCfg.AddHTInfo.MCSSet[0]+(pAd->CommonCfg.AddHTInfo.MCSSet[1]<<8)+(StbcMcs<<16); - if ((pAd->CommonCfg.DesiredHtPhy.TxSTBC) && (pRtHtCap->RxSTBC) && (pAd->Antenna.field.TxPath == 2)) - pMaxHtPhy->field.STBC = STBC_USE; - else - pMaxHtPhy->field.STBC = STBC_NONE; - } - - // Decide MAX ht rate. - if ((pRtHtCap->GF) && (pAd->CommonCfg.DesiredHtPhy.GF)) - pMaxHtPhy->field.MODE = MODE_HTGREENFIELD; - else - pMaxHtPhy->field.MODE = MODE_HTMIX; - - if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth) && (pRtHtCap->ChannelWidth)) - pMaxHtPhy->field.BW = BW_40; - else - pMaxHtPhy->field.BW = BW_20; - - if (pMaxHtPhy->field.BW == BW_20) - pMaxHtPhy->field.ShortGI = (pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 & pRtHtCap->ShortGIfor20); - else - pMaxHtPhy->field.ShortGI = (pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 & pRtHtCap->ShortGIfor40); - - for (i=23; i>=0; i--) // 3*3 - { - j = i/8; - bitmask = (1<<(i-(j*8))); - - if ((pActiveHtPhy->MCSSet[j] & bitmask) && (pDesireHtPhy->MCSSet[j] & bitmask)) - { - pMaxHtPhy->field.MCS = i; - break; - } - - if (i==0) - break; - } - - // Copy MIN ht rate. rt2860??? - pMinHtPhy->field.BW = BW_20; - pMinHtPhy->field.MCS = 0; - pMinHtPhy->field.STBC = 0; - pMinHtPhy->field.ShortGI = 0; - //If STA assigns fixed rate. update to fixed here. - if ( (pAd->OpMode == OPMODE_STA) && (pDesireHtPhy->MCSSet[0] != 0xff)) - { - if (pDesireHtPhy->MCSSet[4] != 0) - { - pMaxHtPhy->field.MCS = 32; - pMinHtPhy->field.MCS = 32; - DBGPRINT(RT_DEBUG_TRACE,("MlmeUpdateHtTxRates<=== Use Fixed MCS = %d\n",pMinHtPhy->field.MCS)); - } - - for (i=23; (CHAR)i >= 0; i--) // 3*3 - { - j = i/8; - bitmask = (1<<(i-(j*8))); - if ( (pDesireHtPhy->MCSSet[j] & bitmask) && (pActiveHtPhy->MCSSet[j] & bitmask)) - { - pMaxHtPhy->field.MCS = i; - pMinHtPhy->field.MCS = i; - break; - } - if (i==0) - break; - } - } - - // Decide ht rate - pHtPhy->field.STBC = pMaxHtPhy->field.STBC; - pHtPhy->field.BW = pMaxHtPhy->field.BW; - pHtPhy->field.MODE = pMaxHtPhy->field.MODE; - pHtPhy->field.MCS = pMaxHtPhy->field.MCS; - pHtPhy->field.ShortGI = pMaxHtPhy->field.ShortGI; - - // use default now. rt2860 - if (pDesireHtPhy->MCSSet[0] != 0xff) - *auto_rate_cur_p = FALSE; - else - *auto_rate_cur_p = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateHtTxRates<---.AMsduSize = %d \n", pAd->CommonCfg.DesiredHtPhy.AmsduSize )); - DBGPRINT(RT_DEBUG_TRACE,("TX: MCS[0] = %x (choose %d), BW = %d, ShortGI = %d, MODE = %d, \n", pActiveHtPhy->MCSSet[0],pHtPhy->field.MCS, - pHtPhy->field.BW, pHtPhy->field.ShortGI, pHtPhy->field.MODE)); - DBGPRINT(RT_DEBUG_TRACE,("MlmeUpdateHtTxRates<=== \n")); -} - -// IRQL = DISPATCH_LEVEL -VOID MlmeRadioOff( - IN PRTMP_ADAPTER pAd) -{ - RT28XX_MLME_RADIO_OFF(pAd); -} - -// IRQL = DISPATCH_LEVEL -VOID MlmeRadioOn( - IN PRTMP_ADAPTER pAd) -{ - RT28XX_MLME_RADIO_ON(pAd); -} - -// =========================================================================================== -// bss_table.c -// =========================================================================================== - - -/*! \brief initialize BSS table - * \param p_tab pointer to the table - * \return none - * \pre - * \post - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - */ -VOID BssTableInit( - IN BSS_TABLE *Tab) -{ - int i; - - Tab->BssNr = 0; - Tab->BssOverlapNr = 0; - for (i = 0; i < MAX_LEN_OF_BSS_TABLE; i++) - { - NdisZeroMemory(&Tab->BssEntry[i], sizeof(BSS_ENTRY)); - Tab->BssEntry[i].Rssi = -127; // initial the rssi as a minimum value - } -} - -VOID BATableInit( - IN PRTMP_ADAPTER pAd, - IN BA_TABLE *Tab) -{ - int i; - - Tab->numAsOriginator = 0; - Tab->numAsRecipient = 0; - NdisAllocateSpinLock(&pAd->BATabLock); - for (i = 0; i < MAX_LEN_OF_BA_REC_TABLE; i++) - { - Tab->BARecEntry[i].REC_BA_Status = Recipient_NONE; - NdisAllocateSpinLock(&(Tab->BARecEntry[i].RxReRingLock)); - } - for (i = 0; i < MAX_LEN_OF_BA_ORI_TABLE; i++) - { - Tab->BAOriEntry[i].ORI_BA_Status = Originator_NONE; - } -} - -/*! \brief search the BSS table by SSID - * \param p_tab pointer to the bss table - * \param ssid SSID string - * \return index of the table, BSS_NOT_FOUND if not in the table - * \pre - * \post - * \note search by sequential search - - IRQL = DISPATCH_LEVEL - - */ -ULONG BssTableSearch( - IN BSS_TABLE *Tab, - IN PUCHAR pBssid, - IN UCHAR Channel) -{ - UCHAR i; - - for (i = 0; i < Tab->BssNr; i++) - { - // - // Some AP that support A/B/G mode that may used the same BSSID on 11A and 11B/G. - // We should distinguish this case. - // - if ((((Tab->BssEntry[i].Channel <= 14) && (Channel <= 14)) || - ((Tab->BssEntry[i].Channel > 14) && (Channel > 14))) && - MAC_ADDR_EQUAL(Tab->BssEntry[i].Bssid, pBssid)) - { - return i; - } - } - return (ULONG)BSS_NOT_FOUND; -} - -ULONG BssSsidTableSearch( - IN BSS_TABLE *Tab, - IN PUCHAR pBssid, - IN PUCHAR pSsid, - IN UCHAR SsidLen, - IN UCHAR Channel) -{ - UCHAR i; - - for (i = 0; i < Tab->BssNr; i++) - { - // - // Some AP that support A/B/G mode that may used the same BSSID on 11A and 11B/G. - // We should distinguish this case. - // - if ((((Tab->BssEntry[i].Channel <= 14) && (Channel <= 14)) || - ((Tab->BssEntry[i].Channel > 14) && (Channel > 14))) && - MAC_ADDR_EQUAL(Tab->BssEntry[i].Bssid, pBssid) && - SSID_EQUAL(pSsid, SsidLen, Tab->BssEntry[i].Ssid, Tab->BssEntry[i].SsidLen)) - { - return i; - } - } - return (ULONG)BSS_NOT_FOUND; -} - -ULONG BssTableSearchWithSSID( - IN BSS_TABLE *Tab, - IN PUCHAR Bssid, - IN PUCHAR pSsid, - IN UCHAR SsidLen, - IN UCHAR Channel) -{ - UCHAR i; - - for (i = 0; i < Tab->BssNr; i++) - { - if ((((Tab->BssEntry[i].Channel <= 14) && (Channel <= 14)) || - ((Tab->BssEntry[i].Channel > 14) && (Channel > 14))) && - MAC_ADDR_EQUAL(&(Tab->BssEntry[i].Bssid), Bssid) && - (SSID_EQUAL(pSsid, SsidLen, Tab->BssEntry[i].Ssid, Tab->BssEntry[i].SsidLen) || - (NdisEqualMemory(pSsid, ZeroSsid, SsidLen)) || - (NdisEqualMemory(Tab->BssEntry[i].Ssid, ZeroSsid, Tab->BssEntry[i].SsidLen)))) - { - return i; - } - } - return (ULONG)BSS_NOT_FOUND; -} - -// IRQL = DISPATCH_LEVEL -VOID BssTableDeleteEntry( - IN OUT BSS_TABLE *Tab, - IN PUCHAR pBssid, - IN UCHAR Channel) -{ - UCHAR i, j; - - for (i = 0; i < Tab->BssNr; i++) - { - if ((Tab->BssEntry[i].Channel == Channel) && - (MAC_ADDR_EQUAL(Tab->BssEntry[i].Bssid, pBssid))) - { - for (j = i; j < Tab->BssNr - 1; j++) - { - NdisMoveMemory(&(Tab->BssEntry[j]), &(Tab->BssEntry[j + 1]), sizeof(BSS_ENTRY)); - } - NdisZeroMemory(&(Tab->BssEntry[Tab->BssNr - 1]), sizeof(BSS_ENTRY)); - Tab->BssNr -= 1; - return; - } - } -} - -/* - ======================================================================== - Routine Description: - Delete the Originator Entry in BAtable. Or decrease numAs Originator by 1 if needed. - - Arguments: - // IRQL = DISPATCH_LEVEL - ======================================================================== -*/ -VOID BATableDeleteORIEntry( - IN OUT PRTMP_ADAPTER pAd, - IN BA_ORI_ENTRY *pBAORIEntry) -{ - - if (pBAORIEntry->ORI_BA_Status != Originator_NONE) - { - NdisAcquireSpinLock(&pAd->BATabLock); - if (pBAORIEntry->ORI_BA_Status == Originator_Done) - { - pAd->BATable.numAsOriginator -= 1; - DBGPRINT(RT_DEBUG_TRACE, ("BATableDeleteORIEntry numAsOriginator= %ld\n", pAd->BATable.numAsRecipient)); - // Erase Bitmap flag. - } - pAd->MacTab.Content[pBAORIEntry->Wcid].TXBAbitmap &= (~(1<<(pBAORIEntry->TID) )); // If STA mode, erase flag here - pAd->MacTab.Content[pBAORIEntry->Wcid].BAOriWcidArray[pBAORIEntry->TID] = 0; // If STA mode, erase flag here - pBAORIEntry->ORI_BA_Status = Originator_NONE; - pBAORIEntry->Token = 1; - // Not clear Sequence here. - NdisReleaseSpinLock(&pAd->BATabLock); - } -} - -/*! \brief - * \param - * \return - * \pre - * \post - - IRQL = DISPATCH_LEVEL - - */ -VOID BssEntrySet( - IN PRTMP_ADAPTER pAd, - OUT BSS_ENTRY *pBss, - IN PUCHAR pBssid, - IN CHAR Ssid[], - IN UCHAR SsidLen, - IN UCHAR BssType, - IN USHORT BeaconPeriod, - IN PCF_PARM pCfParm, - IN USHORT AtimWin, - IN USHORT CapabilityInfo, - IN UCHAR SupRate[], - IN UCHAR SupRateLen, - IN UCHAR ExtRate[], - IN UCHAR ExtRateLen, - IN HT_CAPABILITY_IE *pHtCapability, - IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE - IN UCHAR HtCapabilityLen, - IN UCHAR AddHtInfoLen, - IN UCHAR NewExtChanOffset, - IN UCHAR Channel, - IN CHAR Rssi, - IN LARGE_INTEGER TimeStamp, - IN UCHAR CkipFlag, - IN PEDCA_PARM pEdcaParm, - IN PQOS_CAPABILITY_PARM pQosCapability, - IN PQBSS_LOAD_PARM pQbssLoad, - IN USHORT LengthVIE, - IN PNDIS_802_11_VARIABLE_IEs pVIE) -{ - COPY_MAC_ADDR(pBss->Bssid, pBssid); - // Default Hidden SSID to be TRUE, it will be turned to FALSE after coping SSID - pBss->Hidden = 1; - if (SsidLen > 0) - { - // For hidden SSID AP, it might send beacon with SSID len equal to 0 - // Or send beacon /probe response with SSID len matching real SSID length, - // but SSID is all zero. such as "00-00-00-00" with length 4. - // We have to prevent this case overwrite correct table - if (NdisEqualMemory(Ssid, ZeroSsid, SsidLen) == 0) - { - NdisZeroMemory(pBss->Ssid, MAX_LEN_OF_SSID); - NdisMoveMemory(pBss->Ssid, Ssid, SsidLen); - pBss->SsidLen = SsidLen; - pBss->Hidden = 0; - } - } - else - pBss->SsidLen = 0; - pBss->BssType = BssType; - pBss->BeaconPeriod = BeaconPeriod; - if (BssType == BSS_INFRA) - { - if (pCfParm->bValid) - { - pBss->CfpCount = pCfParm->CfpCount; - pBss->CfpPeriod = pCfParm->CfpPeriod; - pBss->CfpMaxDuration = pCfParm->CfpMaxDuration; - pBss->CfpDurRemaining = pCfParm->CfpDurRemaining; - } - } - else - { - pBss->AtimWin = AtimWin; - } - - pBss->CapabilityInfo = CapabilityInfo; - // The privacy bit indicate security is ON, it maight be WEP, TKIP or AES - // Combine with AuthMode, they will decide the connection methods. - pBss->Privacy = CAP_IS_PRIVACY_ON(pBss->CapabilityInfo); - ASSERT(SupRateLen <= MAX_LEN_OF_SUPPORTED_RATES); - if (SupRateLen <= MAX_LEN_OF_SUPPORTED_RATES) - NdisMoveMemory(pBss->SupRate, SupRate, SupRateLen); - else - NdisMoveMemory(pBss->SupRate, SupRate, MAX_LEN_OF_SUPPORTED_RATES); - pBss->SupRateLen = SupRateLen; - ASSERT(ExtRateLen <= MAX_LEN_OF_SUPPORTED_RATES); - NdisMoveMemory(pBss->ExtRate, ExtRate, ExtRateLen); - NdisMoveMemory(&pBss->HtCapability, pHtCapability, HtCapabilityLen); - NdisMoveMemory(&pBss->AddHtInfo, pAddHtInfo, AddHtInfoLen); - pBss->NewExtChanOffset = NewExtChanOffset; - pBss->ExtRateLen = ExtRateLen; - pBss->Channel = Channel; - pBss->CentralChannel = Channel; - pBss->Rssi = Rssi; - // Update CkipFlag. if not exists, the value is 0x0 - pBss->CkipFlag = CkipFlag; - - // New for microsoft Fixed IEs - NdisMoveMemory(pBss->FixIEs.Timestamp, &TimeStamp, 8); - pBss->FixIEs.BeaconInterval = BeaconPeriod; - pBss->FixIEs.Capabilities = CapabilityInfo; - - // New for microsoft Variable IEs - if (LengthVIE != 0) - { - pBss->VarIELen = LengthVIE; - NdisMoveMemory(pBss->VarIEs, pVIE, pBss->VarIELen); - } - else - { - pBss->VarIELen = 0; - } - - pBss->AddHtInfoLen = 0; - pBss->HtCapabilityLen = 0; - - if (HtCapabilityLen> 0) - { - pBss->HtCapabilityLen = HtCapabilityLen; - NdisMoveMemory(&pBss->HtCapability, pHtCapability, HtCapabilityLen); - if (AddHtInfoLen > 0) - { - pBss->AddHtInfoLen = AddHtInfoLen; - NdisMoveMemory(&pBss->AddHtInfo, pAddHtInfo, AddHtInfoLen); - - if ((pAddHtInfo->ControlChan > 2)&& (pAddHtInfo->AddHtInfo.ExtChanOffset == EXTCHA_BELOW) && (pHtCapability->HtCapInfo.ChannelWidth == BW_40)) - { - pBss->CentralChannel = pAddHtInfo->ControlChan - 2; - } - else if ((pAddHtInfo->AddHtInfo.ExtChanOffset == EXTCHA_ABOVE) && (pHtCapability->HtCapInfo.ChannelWidth == BW_40)) - { - pBss->CentralChannel = pAddHtInfo->ControlChan + 2; - } + /*if (MCS15)*/ + if ((pTable == RateSwitchTable11BGN3S) || + (pTable == RateSwitchTable11N3S) || + (pTable == RateSwitchTable)) + {// N mode with 3 stream // 3*3 + if (MCS23 && (Rssi >= -70)) + TxRateIdx = MCS23; + else if (MCS22 && (Rssi >= -72)) + TxRateIdx = MCS22; + else if (MCS21 && (Rssi >= -76)) + TxRateIdx = MCS21; + else if (MCS20 && (Rssi >= -78)) + TxRateIdx = MCS20; + else if (MCS4 && (Rssi >= -82)) + TxRateIdx = MCS4; + else if (MCS3 && (Rssi >= -84)) + TxRateIdx = MCS3; + else if (MCS2 && (Rssi >= -86)) + TxRateIdx = MCS2; + else if (MCS1 && (Rssi >= -88)) + TxRateIdx = MCS1; + else + TxRateIdx = MCS0; } - } - - BssCipherParse(pBss); - - // new for QOS - if (pEdcaParm) - NdisMoveMemory(&pBss->EdcaParm, pEdcaParm, sizeof(EDCA_PARM)); - else - pBss->EdcaParm.bValid = FALSE; - if (pQosCapability) - NdisMoveMemory(&pBss->QosCapability, pQosCapability, sizeof(QOS_CAPABILITY_PARM)); - else - pBss->QosCapability.bValid = FALSE; - if (pQbssLoad) - NdisMoveMemory(&pBss->QbssLoad, pQbssLoad, sizeof(QBSS_LOAD_PARM)); - else - pBss->QbssLoad.bValid = FALSE; - - { - PEID_STRUCT pEid; - USHORT Length = 0; - - - NdisZeroMemory(&pBss->WpaIE.IE[0], MAX_CUSTOM_LEN); - NdisZeroMemory(&pBss->RsnIE.IE[0], MAX_CUSTOM_LEN); - - pEid = (PEID_STRUCT) pVIE; - - while ((Length + 2 + (USHORT)pEid->Len) <= LengthVIE) - { - switch(pEid->Eid) - { - case IE_WPA: - if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4)) - { - if ((pEid->Len + 2) > MAX_CUSTOM_LEN) - { - pBss->WpaIE.IELen = 0; - break; - } - pBss->WpaIE.IELen = pEid->Len + 2; - NdisMoveMemory(pBss->WpaIE.IE, pEid, pBss->WpaIE.IELen); - } - break; - case IE_RSN: - if (NdisEqualMemory(pEid->Octet + 2, RSN_OUI, 3)) - { - if ((pEid->Len + 2) > MAX_CUSTOM_LEN) - { - pBss->RsnIE.IELen = 0; - break; - } - pBss->RsnIE.IELen = pEid->Len + 2; - NdisMoveMemory(pBss->RsnIE.IE, pEid, pBss->RsnIE.IELen); +// else if ((pTable == RateSwitchTable11BGN2S) || (pTable == RateSwitchTable11BGN2SForABand) ||(pTable == RateSwitchTable11N2S) ||(pTable == RateSwitchTable11N2SForABand) || (pTable == RateSwitchTable)) + else if ((pTable == RateSwitchTable11BGN2S) || (pTable == RateSwitchTable11BGN2SForABand) ||(pTable == RateSwitchTable11N2S) ||(pTable == RateSwitchTable11N2SForABand)) // 3*3 + {// N mode with 2 stream + if (MCS15 && (Rssi >= (-70+RssiOffset))) + TxRateIdx = MCS15; + else if (MCS14 && (Rssi >= (-72+RssiOffset))) + TxRateIdx = MCS14; + else if (MCS13 && (Rssi >= (-76+RssiOffset))) + TxRateIdx = MCS13; + else if (MCS12 && (Rssi >= (-78+RssiOffset))) + TxRateIdx = MCS12; + else if (MCS4 && (Rssi >= (-82+RssiOffset))) + TxRateIdx = MCS4; + else if (MCS3 && (Rssi >= (-84+RssiOffset))) + TxRateIdx = MCS3; + else if (MCS2 && (Rssi >= (-86+RssiOffset))) + TxRateIdx = MCS2; + else if (MCS1 && (Rssi >= (-88+RssiOffset))) + TxRateIdx = MCS1; + else + TxRateIdx = MCS0; } - break; - } - Length = Length + 2 + (USHORT)pEid->Len; // Eid[1] + Len[1]+ content[Len] - pEid = (PEID_STRUCT)((UCHAR*)pEid + 2 + pEid->Len); - } - } -} - -/*! - * \brief insert an entry into the bss table - * \param p_tab The BSS table - * \param Bssid BSSID - * \param ssid SSID - * \param ssid_len Length of SSID - * \param bss_type - * \param beacon_period - * \param timestamp - * \param p_cf - * \param atim_win - * \param cap - * \param rates - * \param rates_len - * \param channel_idx - * \return none - * \pre - * \post - * \note If SSID is identical, the old entry will be replaced by the new one - - IRQL = DISPATCH_LEVEL - - */ -ULONG BssTableSetEntry( - IN PRTMP_ADAPTER pAd, - OUT BSS_TABLE *Tab, - IN PUCHAR pBssid, - IN CHAR Ssid[], - IN UCHAR SsidLen, - IN UCHAR BssType, - IN USHORT BeaconPeriod, - IN CF_PARM *CfParm, - IN USHORT AtimWin, - IN USHORT CapabilityInfo, - IN UCHAR SupRate[], - IN UCHAR SupRateLen, - IN UCHAR ExtRate[], - IN UCHAR ExtRateLen, - IN HT_CAPABILITY_IE *pHtCapability, - IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE - IN UCHAR HtCapabilityLen, - IN UCHAR AddHtInfoLen, - IN UCHAR NewExtChanOffset, - IN UCHAR ChannelNo, - IN CHAR Rssi, - IN LARGE_INTEGER TimeStamp, - IN UCHAR CkipFlag, - IN PEDCA_PARM pEdcaParm, - IN PQOS_CAPABILITY_PARM pQosCapability, - IN PQBSS_LOAD_PARM pQbssLoad, - IN USHORT LengthVIE, - IN PNDIS_802_11_VARIABLE_IEs pVIE) -{ - ULONG Idx; - - Idx = BssTableSearchWithSSID(Tab, pBssid, Ssid, SsidLen, ChannelNo); - if (Idx == BSS_NOT_FOUND) - { - if (Tab->BssNr >= MAX_LEN_OF_BSS_TABLE) - { - // - // It may happen when BSS Table was full. - // The desired AP will not be added into BSS Table - // In this case, if we found the desired AP then overwrite BSS Table. - // - if(!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, pBssid) || - SSID_EQUAL(pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, Ssid, SsidLen)) - { - Idx = Tab->BssOverlapNr; - BssEntrySet(pAd, &Tab->BssEntry[Idx], pBssid, Ssid, SsidLen, BssType, BeaconPeriod, CfParm, AtimWin, - CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen,pHtCapability, pAddHtInfo,HtCapabilityLen, AddHtInfoLen, - NewExtChanOffset, ChannelNo, Rssi, TimeStamp, CkipFlag, pEdcaParm, pQosCapability, pQbssLoad, LengthVIE, pVIE); - Tab->BssOverlapNr = (Tab->BssOverlapNr++) % MAX_LEN_OF_BSS_TABLE; - } - return Idx; + else if ((pTable == RateSwitchTable11BGN1S) || (pTable == RateSwitchTable11N1S)) + {// N mode with 1 stream + if (MCS7 && (Rssi > (-72+RssiOffset))) + TxRateIdx = MCS7; + else if (MCS6 && (Rssi > (-74+RssiOffset))) + TxRateIdx = MCS6; + else if (MCS5 && (Rssi > (-77+RssiOffset))) + TxRateIdx = MCS5; + else if (MCS4 && (Rssi > (-79+RssiOffset))) + TxRateIdx = MCS4; + else if (MCS3 && (Rssi > (-81+RssiOffset))) + TxRateIdx = MCS3; + else if (MCS2 && (Rssi > (-83+RssiOffset))) + TxRateIdx = MCS2; + else if (MCS1 && (Rssi > (-86+RssiOffset))) + TxRateIdx = MCS1; + else + TxRateIdx = MCS0; } else - { - return BSS_NOT_FOUND; - } - } - Idx = Tab->BssNr; - BssEntrySet(pAd, &Tab->BssEntry[Idx], pBssid, Ssid, SsidLen, BssType, BeaconPeriod, CfParm, AtimWin, - CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen,pHtCapability, pAddHtInfo,HtCapabilityLen, AddHtInfoLen, - NewExtChanOffset, ChannelNo, Rssi, TimeStamp, CkipFlag, pEdcaParm, pQosCapability, pQbssLoad, LengthVIE, pVIE); - Tab->BssNr++; - } - else - { - /* avoid Hidden SSID form beacon to overwirite correct SSID from probe response */ - if ((SSID_EQUAL(Ssid, SsidLen, Tab->BssEntry[Idx].Ssid, Tab->BssEntry[Idx].SsidLen)) || - (NdisEqualMemory(Tab->BssEntry[Idx].Ssid, ZeroSsid, Tab->BssEntry[Idx].SsidLen))) - { - BssEntrySet(pAd, &Tab->BssEntry[Idx], pBssid, Ssid, SsidLen, BssType, BeaconPeriod,CfParm, AtimWin, - CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen,pHtCapability, pAddHtInfo,HtCapabilityLen, AddHtInfoLen, - NewExtChanOffset, ChannelNo, Rssi, TimeStamp, CkipFlag, pEdcaParm, pQosCapability, pQbssLoad, LengthVIE, pVIE); - } - } + {// Legacy mode + if (MCS7 && (Rssi > -70)) + TxRateIdx = MCS7; + else if (MCS6 && (Rssi > -74)) + TxRateIdx = MCS6; + else if (MCS5 && (Rssi > -78)) + TxRateIdx = MCS5; + else if (MCS4 && (Rssi > -82)) + TxRateIdx = MCS4; + else if (MCS4 == 0) // for B-only mode + TxRateIdx = MCS3; + else if (MCS3 && (Rssi > -85)) + TxRateIdx = MCS3; + else if (MCS2 && (Rssi > -87)) + TxRateIdx = MCS2; + else if (MCS1 && (Rssi > -90)) + TxRateIdx = MCS1; + else + TxRateIdx = MCS0; + } - return Idx; -} + // if (TxRateIdx != pAd->CommonCfg.TxRateIndex) + { + pEntry->CurrTxRateIndex = TxRateIdx; + pNextTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(pEntry->CurrTxRateIndex+1)*5]; + MlmeSetTxRate(pAd, pEntry, pNextTxRate); + } -// IRQL = DISPATCH_LEVEL -VOID BssTableSsidSort( - IN PRTMP_ADAPTER pAd, - OUT BSS_TABLE *OutTab, - IN CHAR Ssid[], - IN UCHAR SsidLen) -{ - INT i; - BssTableInit(OutTab); + NdisZeroMemory(pEntry->TxQuality, sizeof(USHORT) * MAX_STEP_OF_TX_RATE_SWITCH); + NdisZeroMemory(pEntry->PER, sizeof(UCHAR) * MAX_STEP_OF_TX_RATE_SWITCH); + pEntry->fLastSecAccordingRSSI = TRUE; + // reset all OneSecTx counters + RESET_ONE_SEC_TX_CNT(pEntry); - for (i = 0; i < pAd->ScanTab.BssNr; i++) - { - BSS_ENTRY *pInBss = &pAd->ScanTab.BssEntry[i]; - BOOLEAN bIsHiddenApIncluded = FALSE; + continue; + } - if (((pAd->CommonCfg.bIEEE80211H == 1) && - (pAd->MlmeAux.Channel > 14) && - RadarChannelCheck(pAd, pInBss->Channel)) - ) + if (pEntry->fLastSecAccordingRSSI == TRUE) { - if (pInBss->Hidden) - bIsHiddenApIncluded = TRUE; + pEntry->fLastSecAccordingRSSI = FALSE; + pEntry->LastSecTxRateChangeAction = 0; + // reset all OneSecTx counters + RESET_ONE_SEC_TX_CNT(pEntry); + + continue; } - if ((pInBss->BssType == pAd->StaCfg.BssType) && - (SSID_EQUAL(Ssid, SsidLen, pInBss->Ssid, pInBss->SsidLen) || bIsHiddenApIncluded)) + do { - BSS_ENTRY *pOutBss = &OutTab->BssEntry[OutTab->BssNr]; + BOOLEAN bTrainUpDown = FALSE; - // 2.4G/5G N only mode - if ((pInBss->HtCapabilityLen == 0) && - ((pAd->CommonCfg.PhyMode == PHY_11N_2_4G) || (pAd->CommonCfg.PhyMode == PHY_11N_5G))) - { - DBGPRINT(RT_DEBUG_TRACE,("STA is in N-only Mode, this AP don't have Ht capability in Beacon.\n")); - continue; - } + pEntry->CurrTxRateStableTime ++; - // New for WPA2 - // Check the Authmode first - if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) + // downgrade TX quality if PER >= Rate-Down threshold + if (TxErrorRatio >= TrainDown) { - // Check AuthMode and AuthModeAux for matching, in case AP support dual-mode - if ((pAd->StaCfg.AuthMode != pInBss->AuthMode) && (pAd->StaCfg.AuthMode != pInBss->AuthModeAux)) - // None matched - continue; - - // Check cipher suite, AP must have more secured cipher than station setting - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) - { - // If it's not mixed mode, we should only let BSS pass with the same encryption - if (pInBss->WPA.bMixMode == FALSE) - if (pAd->StaCfg.WepStatus != pInBss->WPA.GroupCipher) - continue; - - // check group cipher - if (pInBss->WPA.GroupCipher != Ndis802_11GroupWEP40Enabled && - pInBss->WPA.GroupCipher != Ndis802_11GroupWEP104Enabled && - pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) - continue; - - // check pairwise cipher, skip if none matched - // If profile set to AES, let it pass without question. - // If profile set to TKIP, we must find one mateched - if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && - (pAd->StaCfg.WepStatus != pInBss->WPA.PairCipher) && - (pAd->StaCfg.WepStatus != pInBss->WPA.PairCipherAux)) - continue; - } - else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - // If it's not mixed mode, we should only let BSS pass with the same encryption - if (pInBss->WPA2.bMixMode == FALSE) - if (pAd->StaCfg.WepStatus != pInBss->WPA2.GroupCipher) - continue; - - // check group cipher - if (pInBss->WPA2.GroupCipher != Ndis802_11GroupWEP40Enabled && - pInBss->WPA2.GroupCipher != Ndis802_11GroupWEP104Enabled && - pAd->StaCfg.WepStatus < pInBss->WPA2.GroupCipher) - continue; - - // check pairwise cipher, skip if none matched - // If profile set to AES, let it pass without question. - // If profile set to TKIP, we must find one mateched - if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && - (pAd->StaCfg.WepStatus != pInBss->WPA2.PairCipher) && - (pAd->StaCfg.WepStatus != pInBss->WPA2.PairCipherAux)) - continue; - } + bTrainUpDown = TRUE; + pEntry->TxQuality[CurrRateIdx] = DRS_TX_QUALITY_WORST_BOUND; } - // Bss Type matched, SSID matched. - // We will check wepstatus for qualification Bss - else if (pAd->StaCfg.WepStatus != pInBss->WepStatus) + // upgrade TX quality if PER <= Rate-Up threshold + else if (TxErrorRatio <= TrainUp) { - DBGPRINT(RT_DEBUG_TRACE,("StaCfg.WepStatus=%d, while pInBss->WepStatus=%d\n", pAd->StaCfg.WepStatus, pInBss->WepStatus)); - // - // For the SESv2 case, we will not qualify WepStatus. - // - if (!pInBss->bSES) - continue; + bTrainUpDown = TRUE; + bUpgradeQuality = TRUE; + if (pEntry->TxQuality[CurrRateIdx]) + pEntry->TxQuality[CurrRateIdx] --; // quality very good in CurrRate + + if (pEntry->TxRateUpPenalty) + pEntry->TxRateUpPenalty --; + else if (pEntry->TxQuality[UpRateIdx]) + pEntry->TxQuality[UpRateIdx] --; // may improve next UP rate's quality } - // Since the AP is using hidden SSID, and we are trying to connect to ANY - // It definitely will fail. So, skip it. - // CCX also require not even try to connect it!! - if (SsidLen == 0) - continue; + pEntry->PER[CurrRateIdx] = (UCHAR)TxErrorRatio; - // If both station and AP use 40MHz, still need to check if the 40MHZ band's legality in my country region - // If this 40MHz wideband is not allowed in my country list, use bandwidth 20MHZ instead, - if ((pInBss->CentralChannel != pInBss->Channel) && - (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)) + if (bTrainUpDown) { - if (RTMPCheckChannel(pAd, pInBss->CentralChannel, pInBss->Channel) == FALSE) + // perform DRS - consider TxRate Down first, then rate up. + if ((CurrRateIdx != DownRateIdx) && (pEntry->TxQuality[CurrRateIdx] >= DRS_TX_QUALITY_WORST_BOUND)) { - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - SetCommonHT(pAd); - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40; + pEntry->CurrTxRateIndex = DownRateIdx; } - else + else if ((CurrRateIdx != UpRateIdx) && (pEntry->TxQuality[UpRateIdx] <= 0)) { - if (pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BAND_WIDTH_20) - { - SetCommonHT(pAd); - } + pEntry->CurrTxRateIndex = UpRateIdx; } } + } while (FALSE); - // copy matching BSS from InTab to OutTab - NdisMoveMemory(pOutBss, pInBss, sizeof(BSS_ENTRY)); - - OutTab->BssNr++; - } - else if ((pInBss->BssType == pAd->StaCfg.BssType) && (SsidLen == 0)) + // if rate-up happen, clear all bad history of all TX rates + if (pEntry->CurrTxRateIndex > CurrRateIdx) { - BSS_ENTRY *pOutBss = &OutTab->BssEntry[OutTab->BssNr]; - - // 2.4G/5G N only mode - if ((pInBss->HtCapabilityLen == 0) && - ((pAd->CommonCfg.PhyMode == PHY_11N_2_4G) || (pAd->CommonCfg.PhyMode == PHY_11N_5G))) - { - DBGPRINT(RT_DEBUG_TRACE,("STA is in N-only Mode, this AP don't have Ht capability in Beacon.\n")); - continue; - } + pEntry->CurrTxRateStableTime = 0; + pEntry->TxRateUpPenalty = 0; + pEntry->LastSecTxRateChangeAction = 1; // rate UP + NdisZeroMemory(pEntry->TxQuality, sizeof(USHORT) * MAX_STEP_OF_TX_RATE_SWITCH); + NdisZeroMemory(pEntry->PER, sizeof(UCHAR) * MAX_STEP_OF_TX_RATE_SWITCH); - // New for WPA2 - // Check the Authmode first - if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) + // + // For TxRate fast train up + // + if (!pAd->StaCfg.StaQuickResponeForRateUpTimerRunning) { - // Check AuthMode and AuthModeAux for matching, in case AP support dual-mode - if ((pAd->StaCfg.AuthMode != pInBss->AuthMode) && (pAd->StaCfg.AuthMode != pInBss->AuthModeAux)) - // None matched - continue; - - // Check cipher suite, AP must have more secured cipher than station setting - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) - { - // If it's not mixed mode, we should only let BSS pass with the same encryption - if (pInBss->WPA.bMixMode == FALSE) - if (pAd->StaCfg.WepStatus != pInBss->WPA.GroupCipher) - continue; - - // check group cipher - if (pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) - continue; - - // check pairwise cipher, skip if none matched - // If profile set to AES, let it pass without question. - // If profile set to TKIP, we must find one mateched - if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && - (pAd->StaCfg.WepStatus != pInBss->WPA.PairCipher) && - (pAd->StaCfg.WepStatus != pInBss->WPA.PairCipherAux)) - continue; - } - else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - // If it's not mixed mode, we should only let BSS pass with the same encryption - if (pInBss->WPA2.bMixMode == FALSE) - if (pAd->StaCfg.WepStatus != pInBss->WPA2.GroupCipher) - continue; - - // check group cipher - if (pAd->StaCfg.WepStatus < pInBss->WPA2.GroupCipher) - continue; - - // check pairwise cipher, skip if none matched - // If profile set to AES, let it pass without question. - // If profile set to TKIP, we must find one mateched - if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && - (pAd->StaCfg.WepStatus != pInBss->WPA2.PairCipher) && - (pAd->StaCfg.WepStatus != pInBss->WPA2.PairCipherAux)) - continue; - } - } - // Bss Type matched, SSID matched. - // We will check wepstatus for qualification Bss - else if (pAd->StaCfg.WepStatus != pInBss->WepStatus) - continue; + RTMPSetTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, 100); - // If both station and AP use 40MHz, still need to check if the 40MHZ band's legality in my country region - // If this 40MHz wideband is not allowed in my country list, use bandwidth 20MHZ instead, - if ((pInBss->CentralChannel != pInBss->Channel) && - (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)) - { - if (RTMPCheckChannel(pAd, pInBss->CentralChannel, pInBss->Channel) == FALSE) - { - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - SetCommonHT(pAd); - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40; - } + pAd->StaCfg.StaQuickResponeForRateUpTimerRunning = TRUE; } + bTxRateChanged = TRUE; + } + // if rate-down happen, only clear DownRate's bad history + else if (pEntry->CurrTxRateIndex < CurrRateIdx) + { + pEntry->CurrTxRateStableTime = 0; + pEntry->TxRateUpPenalty = 0; // no penalty + pEntry->LastSecTxRateChangeAction = 2; // rate DOWN + pEntry->TxQuality[pEntry->CurrTxRateIndex] = 0; + pEntry->PER[pEntry->CurrTxRateIndex] = 0; - // copy matching BSS from InTab to OutTab - NdisMoveMemory(pOutBss, pInBss, sizeof(BSS_ENTRY)); + // + // For TxRate fast train down + // + if (!pAd->StaCfg.StaQuickResponeForRateUpTimerRunning) + { + RTMPSetTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, 100); - OutTab->BssNr++; + pAd->StaCfg.StaQuickResponeForRateUpTimerRunning = TRUE; + } + bTxRateChanged = TRUE; + } + else + { + pEntry->LastSecTxRateChangeAction = 0; // rate no change + bTxRateChanged = FALSE; } - if (OutTab->BssNr >= MAX_LEN_OF_BSS_TABLE) - break; - } - - BssTableSortByRssi(OutTab); -} - - -// IRQL = DISPATCH_LEVEL -VOID BssTableSortByRssi( - IN OUT BSS_TABLE *OutTab) -{ - INT i, j; - BSS_ENTRY TmpBss; - - for (i = 0; i < OutTab->BssNr - 1; i++) - { - for (j = i+1; j < OutTab->BssNr; j++) + pEntry->LastTxOkCount = TxSuccess; +#ifdef RT2860 + pNextTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(pEntry->CurrTxRateIndex+1)*5]; +#endif // RT2860 // +#if defined(RT2870) || defined(RT3070) { - if (OutTab->BssEntry[j].Rssi > OutTab->BssEntry[i].Rssi) + UCHAR tmpTxRate; + + // to fix tcp ack issue + if (!bTxRateChanged && (pAd->RalinkCounters.OneSecReceivedByteCount > (pAd->RalinkCounters.OneSecTransmittedByteCount * 5))) { - NdisMoveMemory(&TmpBss, &OutTab->BssEntry[j], sizeof(BSS_ENTRY)); - NdisMoveMemory(&OutTab->BssEntry[j], &OutTab->BssEntry[i], sizeof(BSS_ENTRY)); - NdisMoveMemory(&OutTab->BssEntry[i], &TmpBss, sizeof(BSS_ENTRY)); + tmpTxRate = DownRateIdx; + DBGPRINT_RAW(RT_DEBUG_TRACE,("DRS: Rx(%d) is 5 times larger than Tx(%d), use low rate (curr=%d, tmp=%d)\n", + pAd->RalinkCounters.OneSecReceivedByteCount, pAd->RalinkCounters.OneSecTransmittedByteCount, pEntry->CurrTxRateIndex, tmpTxRate)); + } + else + { + tmpTxRate = pEntry->CurrTxRateIndex; } + + pNextTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(tmpTxRate+1)*5]; + } +#endif // RT2870 // + if (bTxRateChanged && pNextTxRate) + { + MlmeSetTxRate(pAd, pEntry, pNextTxRate); } + // reset all OneSecTx counters + RESET_ONE_SEC_TX_CNT(pEntry); } } -VOID BssCipherParse( - IN OUT PBSS_ENTRY pBss) +/* + ======================================================================== + Routine Description: + Station side, Auto TxRate faster train up timer call back function. + + Arguments: + SystemSpecific1 - Not used. + FunctionContext - Pointer to our Adapter context. + SystemSpecific2 - Not used. + SystemSpecific3 - Not used. + + Return Value: + None + + ======================================================================== +*/ +VOID StaQuickResponeForRateUpExec( + IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3) { - PEID_STRUCT pEid; - PUCHAR pTmp; - PRSN_IE_HEADER_STRUCT pRsnHeader; - PCIPHER_SUITE_STRUCT pCipher; - PAKM_SUITE_STRUCT pAKM; - USHORT Count; - INT Length; - NDIS_802_11_ENCRYPTION_STATUS TmpCipher; + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)FunctionContext; + UCHAR UpRateIdx = 0, DownRateIdx = 0, CurrRateIdx = 0; + ULONG TxTotalCnt; + ULONG TxErrorRatio = 0; + BOOLEAN bTxRateChanged; //, bUpgradeQuality = FALSE; + PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate = NULL; + PUCHAR pTable; + UCHAR TableSize = 0; + UCHAR InitTxRateIdx = 0, TrainUp, TrainDown; + TX_STA_CNT1_STRUC StaTx1; + TX_STA_CNT0_STRUC TxStaCnt0; + CHAR Rssi, ratio; + ULONG TxRetransmit = 0, TxSuccess = 0, TxFailCount = 0; + MAC_TABLE_ENTRY *pEntry; + ULONG i; - // - // WepStatus will be reset later, if AP announce TKIP or AES on the beacon frame. - // - if (pBss->Privacy) - { - pBss->WepStatus = Ndis802_11WEPEnabled; - } - else + pAd->StaCfg.StaQuickResponeForRateUpTimerRunning = FALSE; + + // + // walk through MAC table, see if need to change AP's TX rate toward each entry + // + for (i = 1; i < MAX_LEN_OF_MAC_TABLE; i++) { - pBss->WepStatus = Ndis802_11WEPDisabled; - } - // Set default to disable & open authentication before parsing variable IE - pBss->AuthMode = Ndis802_11AuthModeOpen; - pBss->AuthModeAux = Ndis802_11AuthModeOpen; + pEntry = &pAd->MacTab.Content[i]; - // Init WPA setting - pBss->WPA.PairCipher = Ndis802_11WEPDisabled; - pBss->WPA.PairCipherAux = Ndis802_11WEPDisabled; - pBss->WPA.GroupCipher = Ndis802_11WEPDisabled; - pBss->WPA.RsnCapability = 0; - pBss->WPA.bMixMode = FALSE; + // check if this entry need to switch rate automatically + if (RTMPCheckEntryEnableAutoRateSwitch(pAd, pEntry) == FALSE) + continue; - // Init WPA2 setting - pBss->WPA2.PairCipher = Ndis802_11WEPDisabled; - pBss->WPA2.PairCipherAux = Ndis802_11WEPDisabled; - pBss->WPA2.GroupCipher = Ndis802_11WEPDisabled; - pBss->WPA2.RsnCapability = 0; - pBss->WPA2.bMixMode = FALSE; + if (INFRA_ON(pAd) && (i == 1)) + Rssi = RTMPMaxRssi(pAd, + pAd->StaCfg.RssiSample.AvgRssi0, + pAd->StaCfg.RssiSample.AvgRssi1, + pAd->StaCfg.RssiSample.AvgRssi2); + else + Rssi = RTMPMaxRssi(pAd, + pEntry->RssiSample.AvgRssi0, + pEntry->RssiSample.AvgRssi1, + pEntry->RssiSample.AvgRssi2); + CurrRateIdx = pAd->CommonCfg.TxRateIndex; - Length = (INT) pBss->VarIELen; + MlmeSelectTxRateTable(pAd, pEntry, &pTable, &TableSize, &InitTxRateIdx); - while (Length > 0) - { - // Parse cipher suite base on WPA1 & WPA2, they should be parsed differently - pTmp = ((PUCHAR) pBss->VarIEs) + pBss->VarIELen - Length; - pEid = (PEID_STRUCT) pTmp; - switch (pEid->Eid) + // decide the next upgrade rate and downgrade rate, if any + if ((CurrRateIdx > 0) && (CurrRateIdx < (TableSize - 1))) { - case IE_WPA: - //Parse Cisco IE_WPA (LEAP, CCKM, etc.) - if ( NdisEqualMemory((pTmp+8), CISCO_OUI, 3)) - { - pTmp += 11; - switch (*pTmp) - { - case 1: - case 5: // Although WEP is not allowed in WPA related auth mode, we parse it anyway - pBss->WepStatus = Ndis802_11Encryption1Enabled; - pBss->WPA.PairCipher = Ndis802_11Encryption1Enabled; - pBss->WPA.GroupCipher = Ndis802_11Encryption1Enabled; - break; - case 2: - pBss->WepStatus = Ndis802_11Encryption2Enabled; - pBss->WPA.PairCipher = Ndis802_11Encryption1Enabled; - pBss->WPA.GroupCipher = Ndis802_11Encryption1Enabled; - break; - case 4: - pBss->WepStatus = Ndis802_11Encryption3Enabled; - pBss->WPA.PairCipher = Ndis802_11Encryption1Enabled; - pBss->WPA.GroupCipher = Ndis802_11Encryption1Enabled; - break; - default: - break; - } + UpRateIdx = CurrRateIdx + 1; + DownRateIdx = CurrRateIdx -1; + } + else if (CurrRateIdx == 0) + { + UpRateIdx = CurrRateIdx + 1; + DownRateIdx = CurrRateIdx; + } + else if (CurrRateIdx == (TableSize - 1)) + { + UpRateIdx = CurrRateIdx; + DownRateIdx = CurrRateIdx - 1; + } - // if Cisco IE_WPA, break - break; - } - else if (NdisEqualMemory(pEid->Octet, SES_OUI, 3) && (pEid->Len == 7)) - { - pBss->bSES = TRUE; - break; - } - else if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4) != 1) - { - // if unsupported vendor specific IE - break; - } - // Skip OUI, version, and multicast suite - // This part should be improved in the future when AP supported multiple cipher suite. - // For now, it's OK since almost all APs have fixed cipher suite supported. - // pTmp = (PUCHAR) pEid->Octet; - pTmp += 11; + pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(CurrRateIdx+1)*5]; - // Cipher Suite Selectors from Spec P802.11i/D3.2 P26. - // Value Meaning - // 0 None - // 1 WEP-40 - // 2 Tkip - // 3 WRAP - // 4 AES - // 5 WEP-104 - // Parse group cipher - switch (*pTmp) - { - case 1: - pBss->WPA.GroupCipher = Ndis802_11GroupWEP40Enabled; - break; - case 5: - pBss->WPA.GroupCipher = Ndis802_11GroupWEP104Enabled; - break; - case 2: - pBss->WPA.GroupCipher = Ndis802_11Encryption2Enabled; - break; - case 4: - pBss->WPA.GroupCipher = Ndis802_11Encryption3Enabled; - break; - default: - break; - } - // number of unicast suite - pTmp += 1; + if ((Rssi > -65) && (pCurrTxRate->Mode >= MODE_HTMIX)) + { + TrainUp = (pCurrTxRate->TrainUp + (pCurrTxRate->TrainUp >> 1)); + TrainDown = (pCurrTxRate->TrainDown + (pCurrTxRate->TrainDown >> 1)); + } + else + { + TrainUp = pCurrTxRate->TrainUp; + TrainDown = pCurrTxRate->TrainDown; + } + + if (pAd->MacTab.Size == 1) + { + // Update statistic counter + RTMP_IO_READ32(pAd, TX_STA_CNT0, &TxStaCnt0.word); + RTMP_IO_READ32(pAd, TX_STA_CNT1, &StaTx1.word); + + TxRetransmit = StaTx1.field.TxRetransmit; + TxSuccess = StaTx1.field.TxSuccess; + TxFailCount = TxStaCnt0.field.TxFailCount; + TxTotalCnt = TxRetransmit + TxSuccess + TxFailCount; + + pAd->RalinkCounters.OneSecTxRetryOkCount += StaTx1.field.TxRetransmit; + pAd->RalinkCounters.OneSecTxNoRetryOkCount += StaTx1.field.TxSuccess; + pAd->RalinkCounters.OneSecTxFailCount += TxStaCnt0.field.TxFailCount; + pAd->WlanCounters.TransmittedFragmentCount.u.LowPart += StaTx1.field.TxSuccess; + pAd->WlanCounters.RetryCount.u.LowPart += StaTx1.field.TxRetransmit; + pAd->WlanCounters.FailedCount.u.LowPart += TxStaCnt0.field.TxFailCount; + + if (TxTotalCnt) + TxErrorRatio = ((TxRetransmit + TxFailCount) * 100) / TxTotalCnt; + } + else + { + TxTotalCnt = pEntry->OneSecTxNoRetryOkCount + + pEntry->OneSecTxRetryOkCount + + pEntry->OneSecTxFailCount; - // skip all unicast cipher suites - //Count = *(PUSHORT) pTmp; - Count = (pTmp[1]<<8) + pTmp[0]; - pTmp += sizeof(USHORT); + if (TxTotalCnt) + TxErrorRatio = ((pEntry->OneSecTxRetryOkCount + pEntry->OneSecTxFailCount) * 100) / TxTotalCnt; + } - // Parsing all unicast cipher suite - while (Count > 0) - { - // Skip OUI - pTmp += 3; - TmpCipher = Ndis802_11WEPDisabled; - switch (*pTmp) - { - case 1: - case 5: // Although WEP is not allowed in WPA related auth mode, we parse it anyway - TmpCipher = Ndis802_11Encryption1Enabled; - break; - case 2: - TmpCipher = Ndis802_11Encryption2Enabled; - break; - case 4: - TmpCipher = Ndis802_11Encryption3Enabled; - break; - default: - break; - } - if (TmpCipher > pBss->WPA.PairCipher) - { - // Move the lower cipher suite to PairCipherAux - pBss->WPA.PairCipherAux = pBss->WPA.PairCipher; - pBss->WPA.PairCipher = TmpCipher; - } - else - { - pBss->WPA.PairCipherAux = TmpCipher; - } - pTmp++; - Count--; - } - // 4. get AKM suite counts - //Count = *(PUSHORT) pTmp; - Count = (pTmp[1]<<8) + pTmp[0]; - pTmp += sizeof(USHORT); - pTmp += 3; + // + // CASE 1. when TX samples are fewer than 15, then decide TX rate solely on RSSI + // (criteria copied from RT2500 for Netopia case) + // + if (TxTotalCnt <= 12) + { + NdisZeroMemory(pAd->DrsCounters.TxQuality, sizeof(USHORT) * MAX_STEP_OF_TX_RATE_SWITCH); + NdisZeroMemory(pAd->DrsCounters.PER, sizeof(UCHAR) * MAX_STEP_OF_TX_RATE_SWITCH); - switch (*pTmp) - { - case 1: - // Set AP support WPA mode - if (pBss->AuthMode == Ndis802_11AuthModeOpen) - pBss->AuthMode = Ndis802_11AuthModeWPA; - else - pBss->AuthModeAux = Ndis802_11AuthModeWPA; - break; - case 2: - // Set AP support WPA mode - if (pBss->AuthMode == Ndis802_11AuthModeOpen) - pBss->AuthMode = Ndis802_11AuthModeWPAPSK; - else - pBss->AuthModeAux = Ndis802_11AuthModeWPAPSK; - break; - default: - break; - } - pTmp += 1; + if ((pAd->DrsCounters.LastSecTxRateChangeAction == 1) && (CurrRateIdx != DownRateIdx)) + { + pAd->CommonCfg.TxRateIndex = DownRateIdx; + pAd->DrsCounters.TxQuality[CurrRateIdx] = DRS_TX_QUALITY_WORST_BOUND; + } + else if ((pAd->DrsCounters.LastSecTxRateChangeAction == 2) && (CurrRateIdx != UpRateIdx)) + { + pAd->CommonCfg.TxRateIndex = UpRateIdx; + } - // Fixed for WPA-None - if (pBss->BssType == BSS_ADHOC) - { - pBss->AuthMode = Ndis802_11AuthModeWPANone; - pBss->AuthModeAux = Ndis802_11AuthModeWPANone; - pBss->WepStatus = pBss->WPA.GroupCipher; - if (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled) - pBss->WPA.PairCipherAux = pBss->WPA.GroupCipher; - } - else - pBss->WepStatus = pBss->WPA.PairCipher; + DBGPRINT_RAW(RT_DEBUG_TRACE,("QuickDRS: TxTotalCnt <= 15, train back to original rate \n")); + return; + } - // Check the Pair & Group, if different, turn on mixed mode flag - if (pBss->WPA.GroupCipher != pBss->WPA.PairCipher) - pBss->WPA.bMixMode = TRUE; + do + { + ULONG OneSecTxNoRetryOKRationCount; - break; + if (pAd->DrsCounters.LastTimeTxRateChangeAction == 0) + ratio = 5; + else + ratio = 4; - case IE_RSN: - pRsnHeader = (PRSN_IE_HEADER_STRUCT) pTmp; + // downgrade TX quality if PER >= Rate-Down threshold + if (TxErrorRatio >= TrainDown) + { + pAd->DrsCounters.TxQuality[CurrRateIdx] = DRS_TX_QUALITY_WORST_BOUND; + } - // 0. Version must be 1 - if (le2cpu16(pRsnHeader->Version) != 1) - break; - pTmp += sizeof(RSN_IE_HEADER_STRUCT); + pAd->DrsCounters.PER[CurrRateIdx] = (UCHAR)TxErrorRatio; - // 1. Check group cipher - pCipher = (PCIPHER_SUITE_STRUCT) pTmp; - if (!RTMPEqualMemory(pTmp, RSN_OUI, 3)) - break; + OneSecTxNoRetryOKRationCount = (TxSuccess * ratio); - // Parse group cipher - switch (pCipher->Type) + // perform DRS - consider TxRate Down first, then rate up. + if ((pAd->DrsCounters.LastSecTxRateChangeAction == 1) && (CurrRateIdx != DownRateIdx)) + { + if ((pAd->DrsCounters.LastTxOkCount + 2) >= OneSecTxNoRetryOKRationCount) { - case 1: - pBss->WPA2.GroupCipher = Ndis802_11GroupWEP40Enabled; - break; - case 5: - pBss->WPA2.GroupCipher = Ndis802_11GroupWEP104Enabled; - break; - case 2: - pBss->WPA2.GroupCipher = Ndis802_11Encryption2Enabled; - break; - case 4: - pBss->WPA2.GroupCipher = Ndis802_11Encryption3Enabled; - break; - default: - break; + pAd->CommonCfg.TxRateIndex = DownRateIdx; + pAd->DrsCounters.TxQuality[CurrRateIdx] = DRS_TX_QUALITY_WORST_BOUND; + } - // set to correct offset for next parsing - pTmp += sizeof(CIPHER_SUITE_STRUCT); - // 2. Get pairwise cipher counts - //Count = *(PUSHORT) pTmp; - Count = (pTmp[1]<<8) + pTmp[0]; - pTmp += sizeof(USHORT); + } + else if ((pAd->DrsCounters.LastSecTxRateChangeAction == 2) && (CurrRateIdx != UpRateIdx)) + { + if ((TxErrorRatio >= 50) || (TxErrorRatio >= TrainDown)) + { - // 3. Get pairwise cipher - // Parsing all unicast cipher suite - while (Count > 0) + } + else if ((pAd->DrsCounters.LastTxOkCount + 2) >= OneSecTxNoRetryOKRationCount) { - // Skip OUI - pCipher = (PCIPHER_SUITE_STRUCT) pTmp; - TmpCipher = Ndis802_11WEPDisabled; - switch (pCipher->Type) - { - case 1: - case 5: // Although WEP is not allowed in WPA related auth mode, we parse it anyway - TmpCipher = Ndis802_11Encryption1Enabled; - break; - case 2: - TmpCipher = Ndis802_11Encryption2Enabled; - break; - case 4: - TmpCipher = Ndis802_11Encryption3Enabled; - break; - default: - break; - } - if (TmpCipher > pBss->WPA2.PairCipher) - { - // Move the lower cipher suite to PairCipherAux - pBss->WPA2.PairCipherAux = pBss->WPA2.PairCipher; - pBss->WPA2.PairCipher = TmpCipher; - } - else - { - pBss->WPA2.PairCipherAux = TmpCipher; - } - pTmp += sizeof(CIPHER_SUITE_STRUCT); - Count--; + pAd->CommonCfg.TxRateIndex = UpRateIdx; } + } + }while (FALSE); - // 4. get AKM suite counts - //Count = *(PUSHORT) pTmp; - Count = (pTmp[1]<<8) + pTmp[0]; - pTmp += sizeof(USHORT); + // if rate-up happen, clear all bad history of all TX rates + if (pAd->CommonCfg.TxRateIndex > CurrRateIdx) + { + pAd->DrsCounters.TxRateUpPenalty = 0; + NdisZeroMemory(pAd->DrsCounters.TxQuality, sizeof(USHORT) * MAX_STEP_OF_TX_RATE_SWITCH); + NdisZeroMemory(pAd->DrsCounters.PER, sizeof(UCHAR) * MAX_STEP_OF_TX_RATE_SWITCH); + bTxRateChanged = TRUE; + } + // if rate-down happen, only clear DownRate's bad history + else if (pAd->CommonCfg.TxRateIndex < CurrRateIdx) + { + DBGPRINT_RAW(RT_DEBUG_TRACE,("QuickDRS: --TX rate from %d to %d \n", CurrRateIdx, pAd->CommonCfg.TxRateIndex)); - // 5. Get AKM ciphers - pAKM = (PAKM_SUITE_STRUCT) pTmp; - if (!RTMPEqualMemory(pTmp, RSN_OUI, 3)) - break; + pAd->DrsCounters.TxRateUpPenalty = 0; // no penalty + pAd->DrsCounters.TxQuality[pAd->CommonCfg.TxRateIndex] = 0; + pAd->DrsCounters.PER[pAd->CommonCfg.TxRateIndex] = 0; + bTxRateChanged = TRUE; + } + else + { + bTxRateChanged = FALSE; + } - switch (pAKM->Type) - { - case 1: - // Set AP support WPA mode - if (pBss->AuthMode == Ndis802_11AuthModeOpen) - pBss->AuthMode = Ndis802_11AuthModeWPA2; - else - pBss->AuthModeAux = Ndis802_11AuthModeWPA2; - break; - case 2: - // Set AP support WPA mode - if (pBss->AuthMode == Ndis802_11AuthModeOpen) - pBss->AuthMode = Ndis802_11AuthModeWPA2PSK; - else - pBss->AuthModeAux = Ndis802_11AuthModeWPA2PSK; - break; - default: - break; - } - pTmp += (Count * sizeof(AKM_SUITE_STRUCT)); + pNextTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(pAd->CommonCfg.TxRateIndex+1)*5]; + if (bTxRateChanged && pNextTxRate) + { + MlmeSetTxRate(pAd, pEntry, pNextTxRate); + } + } +} + +/* + ========================================================================== + Description: + This routine is executed periodically inside MlmePeriodicExec() after + association with an AP. + It checks if StaCfg.Psm is consistent with user policy (recorded in + StaCfg.WindowsPowerMode). If not, enforce user policy. However, + there're some conditions to consider: + 1. we don't support power-saving in ADHOC mode, so Psm=PWR_ACTIVE all + the time when Mibss==TRUE + 2. When link up in INFRA mode, Psm should not be switch to PWR_SAVE + if outgoing traffic available in TxRing or MgmtRing. + Output: + 1. change pAd->StaCfg.Psm to PWR_SAVE or leave it untouched - // Fixed for WPA-None - if (pBss->BssType == BSS_ADHOC) - { - pBss->AuthMode = Ndis802_11AuthModeWPANone; - pBss->AuthModeAux = Ndis802_11AuthModeWPANone; - pBss->WPA.PairCipherAux = pBss->WPA2.PairCipherAux; - pBss->WPA.GroupCipher = pBss->WPA2.GroupCipher; - pBss->WepStatus = pBss->WPA.GroupCipher; - if (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled) - pBss->WPA.PairCipherAux = pBss->WPA.GroupCipher; - } - pBss->WepStatus = pBss->WPA2.PairCipher; + IRQL = DISPATCH_LEVEL - // 6. Get RSN capability - //pBss->WPA2.RsnCapability = *(PUSHORT) pTmp; - pBss->WPA2.RsnCapability = (pTmp[1]<<8) + pTmp[0]; - pTmp += sizeof(USHORT); + ========================================================================== + */ +VOID MlmeCheckPsmChange( + IN PRTMP_ADAPTER pAd, + IN ULONG Now32) +{ + ULONG PowerMode; - // Check the Pair & Group, if different, turn on mixed mode flag - if (pBss->WPA2.GroupCipher != pBss->WPA2.PairCipher) - pBss->WPA2.bMixMode = TRUE; + // condition - + // 1. Psm maybe ON only happen in INFRASTRUCTURE mode + // 2. user wants either MAX_PSP or FAST_PSP + // 3. but current psm is not in PWR_SAVE + // 4. CNTL state machine is not doing SCANning + // 5. no TX SUCCESS event for the past 1-sec period + PowerMode = pAd->StaCfg.WindowsPowerMode; - break; - default: - break; + if (INFRA_ON(pAd) && + (PowerMode != Ndis802_11PowerModeCAM) && + (pAd->StaCfg.Psm == PWR_ACTIVE) && +// (! RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) + (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE)&& + RTMP_TEST_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP) + /*&& + (pAd->RalinkCounters.OneSecTxNoRetryOkCount == 0) && + (pAd->RalinkCounters.OneSecTxRetryOkCount == 0)*/) + { + NdisGetSystemUpTime(&pAd->Mlme.LastSendNULLpsmTime); + pAd->RalinkCounters.RxCountSinceLastNULL = 0; + RTMP_SET_PSM_BIT(pAd, PWR_SAVE); + if (!(pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable)) + { + RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, FALSE); + } + else + { + RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, TRUE); + } } - Length -= (pEid->Len + 2); - } } -// =========================================================================================== -// mac_table.c -// =========================================================================================== +// IRQL = PASSIVE_LEVEL +// IRQL = DISPATCH_LEVEL +VOID MlmeSetPsmBit( + IN PRTMP_ADAPTER pAd, + IN USHORT psm) +{ + AUTO_RSP_CFG_STRUC csr4; -/*! \brief generates a random mac address value for IBSS BSSID - * \param Addr the bssid location - * \return none - * \pre - * \post + pAd->StaCfg.Psm = psm; + RTMP_IO_READ32(pAd, AUTO_RSP_CFG, &csr4.word); + csr4.field.AckCtsPsmBit = (psm == PWR_SAVE)? 1:0; + RTMP_IO_WRITE32(pAd, AUTO_RSP_CFG, csr4.word); + + DBGPRINT(RT_DEBUG_TRACE, ("MlmeSetPsmBit = %d\n", psm)); +} + +/* + ========================================================================== + Description: + This routine calculates TxPER, RxPER of the past N-sec period. And + according to the calculation result, ChannelQuality is calculated here + to decide if current AP is still doing the job. + + If ChannelQuality is not good, a ROAMing attempt may be tried later. + Output: + StaCfg.ChannelQuality - 0..100 + + IRQL = DISPATCH_LEVEL + + NOTE: This routine decide channle quality based on RX CRC error ratio. + Caller should make sure a function call to NICUpdateRawCounters(pAd) + is performed right before this routine, so that this routine can decide + channel quality based on the most up-to-date information + ========================================================================== */ -VOID MacAddrRandomBssid( +VOID MlmeCalculateChannelQuality( IN PRTMP_ADAPTER pAd, - OUT PUCHAR pAddr) + IN PMAC_TABLE_ENTRY pMacEntry, + IN ULONG Now32) { - INT i; + ULONG TxOkCnt, TxCnt, TxPER, TxPRR; + ULONG RxCnt, RxPER; + UCHAR NorRssi; + CHAR MaxRssi; + RSSI_SAMPLE *pRssiSample = NULL; + UINT32 OneSecTxNoRetryOkCount = 0; + UINT32 OneSecTxRetryOkCount = 0; + UINT32 OneSecTxFailCount = 0; + UINT32 OneSecRxOkCnt = 0; + UINT32 OneSecRxFcsErrCnt = 0; + ULONG ChannelQuality = 0; // 0..100, Channel Quality Indication for Roaming + ULONG BeaconLostTime = pAd->StaCfg.BeaconLostTime; - for (i = 0; i < MAC_ADDR_LEN; i++) + + if (pAd->OpMode == OPMODE_STA) { - pAddr[i] = RandomByte(pAd); + pRssiSample = &pAd->StaCfg.RssiSample; + OneSecTxNoRetryOkCount = pAd->RalinkCounters.OneSecTxNoRetryOkCount; + OneSecTxRetryOkCount = pAd->RalinkCounters.OneSecTxRetryOkCount; + OneSecTxFailCount = pAd->RalinkCounters.OneSecTxFailCount; + OneSecRxOkCnt = pAd->RalinkCounters.OneSecRxOkCnt; + OneSecRxFcsErrCnt = pAd->RalinkCounters.OneSecRxFcsErrCnt; } - pAddr[0] = (pAddr[0] & 0xfe) | 0x02; // the first 2 bits must be 01xxxxxxxx -} + MaxRssi = RTMPMaxRssi(pAd, pRssiSample->LastRssi0, + pRssiSample->LastRssi1, + pRssiSample->LastRssi2); -/*! \brief init the management mac frame header - * \param p_hdr mac header - * \param subtype subtype of the frame - * \param p_ds destination address, don't care if it is a broadcast address - * \return none - * \pre the station has the following information in the pAd->StaCfg - * - bssid - * - station address - * \post - * \note this function initializes the following field + // + // calculate TX packet error ratio and TX retry ratio - if too few TX samples, skip TX related statistics + // + TxOkCnt = OneSecTxNoRetryOkCount + OneSecTxRetryOkCount; + TxCnt = TxOkCnt + OneSecTxFailCount; + if (TxCnt < 5) + { + TxPER = 0; + TxPRR = 0; + } + else + { + TxPER = (OneSecTxFailCount * 100) / TxCnt; + TxPRR = ((TxCnt - OneSecTxNoRetryOkCount) * 100) / TxCnt; + } - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL + // + // calculate RX PER - don't take RxPER into consideration if too few sample + // + RxCnt = OneSecRxOkCnt + OneSecRxFcsErrCnt; + if (RxCnt < 5) + RxPER = 0; + else + RxPER = (OneSecRxFcsErrCnt * 100) / RxCnt; - */ -VOID MgtMacHeaderInit( - IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, - IN UCHAR SubType, - IN UCHAR ToDs, - IN PUCHAR pDA, - IN PUCHAR pBssid) -{ - NdisZeroMemory(pHdr80211, sizeof(HEADER_802_11)); + // + // decide ChannelQuality based on: 1)last BEACON received time, 2)last RSSI, 3)TxPER, and 4)RxPER + // + if ((pAd->OpMode == OPMODE_STA) && + INFRA_ON(pAd) && + (OneSecTxNoRetryOkCount < 2) && // no heavy traffic + ((pAd->StaCfg.LastBeaconRxTime + BeaconLostTime) < Now32)) + { + DBGPRINT(RT_DEBUG_TRACE, ("BEACON lost > %ld msec with TxOkCnt=%ld -> CQI=0\n", BeaconLostTime, TxOkCnt)); + ChannelQuality = 0; + } + else + { + // Normalize Rssi + if (MaxRssi > -40) + NorRssi = 100; + else if (MaxRssi < -90) + NorRssi = 0; + else + NorRssi = (MaxRssi + 90) * 2; - pHdr80211->FC.Type = BTYPE_MGMT; - pHdr80211->FC.SubType = SubType; - pHdr80211->FC.ToDs = ToDs; - COPY_MAC_ADDR(pHdr80211->Addr1, pDA); + // ChannelQuality = W1*RSSI + W2*TxPRR + W3*RxPER (RSSI 0..100), (TxPER 100..0), (RxPER 100..0) + ChannelQuality = (RSSI_WEIGHTING * NorRssi + + TX_WEIGHTING * (100 - TxPRR) + + RX_WEIGHTING* (100 - RxPER)) / 100; + } - COPY_MAC_ADDR(pHdr80211->Addr2, pAd->CurrentAddress); - COPY_MAC_ADDR(pHdr80211->Addr3, pBssid); -} + if (pAd->OpMode == OPMODE_STA) + pAd->Mlme.ChannelQuality = (ChannelQuality > 100) ? 100 : ChannelQuality; -// =========================================================================================== -// mem_mgmt.c -// =========================================================================================== -/*!*************************************************************************** - * This routine build an outgoing frame, and fill all information specified - * in argument list to the frame body. The actual frame size is the summation - * of all arguments. - * input params: - * Buffer - pointer to a pre-allocated memory segment - * args - a list of pairs. - * NOTE NOTE NOTE!!!! the last argument must be NULL, otherwise this - * function will FAIL!!! - * return: - * Size of the buffer - * usage: - * MakeOutgoingFrame(Buffer, output_length, 2, &fc, 2, &dur, 6, p_addr1, 6,p_addr2, END_OF_ARGS); +} - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - ****************************************************************************/ -ULONG MakeOutgoingFrame( - OUT CHAR *Buffer, - OUT ULONG *FrameLen, ...) +// IRQL = DISPATCH_LEVEL +VOID MlmeSetTxPreamble( + IN PRTMP_ADAPTER pAd, + IN USHORT TxPreamble) { - CHAR *p; - int leng; - ULONG TotLeng; - va_list Args; + AUTO_RSP_CFG_STRUC csr4; - // calculates the total length - TotLeng = 0; - va_start(Args, FrameLen); - do + // + // Always use Long preamble before verifiation short preamble functionality works well. + // Todo: remove the following line if short preamble functionality works + // + //TxPreamble = Rt802_11PreambleLong; + + RTMP_IO_READ32(pAd, AUTO_RSP_CFG, &csr4.word); + if (TxPreamble == Rt802_11PreambleLong) { - leng = va_arg(Args, int); - if (leng == END_OF_ARGS) - { - break; - } - p = va_arg(Args, PVOID); - NdisMoveMemory(&Buffer[TotLeng], p, leng); - TotLeng = TotLeng + leng; - } while(TRUE); + DBGPRINT(RT_DEBUG_TRACE, ("MlmeSetTxPreamble (= LONG PREAMBLE)\n")); + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); + csr4.field.AutoResponderPreamble = 0; + } + else + { + // NOTE: 1Mbps should always use long preamble + DBGPRINT(RT_DEBUG_TRACE, ("MlmeSetTxPreamble (= SHORT PREAMBLE)\n")); + OPSTATUS_SET_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); + csr4.field.AutoResponderPreamble = 1; + } + + RTMP_IO_WRITE32(pAd, AUTO_RSP_CFG, csr4.word); +} + +/* + ========================================================================== + Description: + Update basic rate bitmap + ========================================================================== + */ + +VOID UpdateBasicRateBitmap( + IN PRTMP_ADAPTER pAdapter) +{ + INT i, j; + /* 1 2 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 */ + UCHAR rate[] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 }; + UCHAR *sup_p = pAdapter->CommonCfg.SupRate; + UCHAR *ext_p = pAdapter->CommonCfg.ExtRate; + ULONG bitmap = pAdapter->CommonCfg.BasicRateBitmap; + + + /* if A mode, always use fix BasicRateBitMap */ + //if (pAdapter->CommonCfg.Channel == PHY_11A) + if (pAdapter->CommonCfg.Channel > 14) + pAdapter->CommonCfg.BasicRateBitmap = 0x150; /* 6, 12, 24M */ + /* End of if */ - va_end(Args); /* clean up */ - *FrameLen = TotLeng; - return TotLeng; -} + if (pAdapter->CommonCfg.BasicRateBitmap > 4095) + { + /* (2 ^ MAX_LEN_OF_SUPPORTED_RATES) -1 */ + return; + } /* End of if */ -// =========================================================================================== -// mlme_queue.c -// =========================================================================================== + for(i=0; iLock); + int i, num; + UCHAR Rate = RATE_6, MaxDesire = RATE_1, MaxSupport = RATE_1; + UCHAR MinSupport = RATE_54; + ULONG BasicRateBitmap = 0; + UCHAR CurrBasicRate = RATE_1; + UCHAR *pSupRate, SupRateLen, *pExtRate, ExtRateLen; + PHTTRANSMIT_SETTING pHtPhy = NULL; + PHTTRANSMIT_SETTING pMaxHtPhy = NULL; + PHTTRANSMIT_SETTING pMinHtPhy = NULL; + BOOLEAN *auto_rate_cur_p; + UCHAR HtMcs = MCS_AUTO; - Queue->Num = 0; - Queue->Head = 0; - Queue->Tail = 0; + // find max desired rate + UpdateBasicRateBitmap(pAd); - for (i = 0; i < MAX_LEN_OF_MLME_QUEUE; i++) + num = 0; + auto_rate_cur_p = NULL; + for (i=0; iEntry[i].Occupied = FALSE; - Queue->Entry[i].MsgLen = 0; - NdisZeroMemory(Queue->Entry[i].Msg, MGMT_DMA_BUFFER_SIZE); + switch (pAd->CommonCfg.DesireRate[i] & 0x7f) + { + case 2: Rate = RATE_1; num++; break; + case 4: Rate = RATE_2; num++; break; + case 11: Rate = RATE_5_5; num++; break; + case 22: Rate = RATE_11; num++; break; + case 12: Rate = RATE_6; num++; break; + case 18: Rate = RATE_9; num++; break; + case 24: Rate = RATE_12; num++; break; + case 36: Rate = RATE_18; num++; break; + case 48: Rate = RATE_24; num++; break; + case 72: Rate = RATE_36; num++; break; + case 96: Rate = RATE_48; num++; break; + case 108: Rate = RATE_54; num++; break; + //default: Rate = RATE_1; break; + } + if (MaxDesire < Rate) MaxDesire = Rate; } - return NDIS_STATUS_SUCCESS; -} - -/*! \brief Enqueue a message for other threads, if they want to send messages to MLME thread - * \param *Queue The MLME Queue - * \param Machine The State Machine Id - * \param MsgType The Message Type - * \param MsgLen The Message length - * \param *Msg The message pointer - * \return TRUE if enqueue is successful, FALSE if the queue is full - * \pre - * \post - * \note The message has to be initialized +//=========================================================================== +//=========================================================================== + { + pHtPhy = &pAd->StaCfg.HTPhyMode; + pMaxHtPhy = &pAd->StaCfg.MaxHTPhyMode; + pMinHtPhy = &pAd->StaCfg.MinHTPhyMode; - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL + auto_rate_cur_p = &pAd->StaCfg.bAutoTxRateSwitch; + HtMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS; - */ -BOOLEAN MlmeEnqueue( - IN PRTMP_ADAPTER pAd, - IN ULONG Machine, - IN ULONG MsgType, - IN ULONG MsgLen, - IN VOID *Msg) -{ - INT Tail; - MLME_QUEUE *Queue = (MLME_QUEUE *)&pAd->Mlme.Queue; + if ((pAd->StaCfg.BssType == BSS_ADHOC) && + (pAd->CommonCfg.PhyMode == PHY_11B) && + (MaxDesire > RATE_11)) + { + MaxDesire = RATE_11; + } + } - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return FALSE; + pAd->CommonCfg.MaxDesiredRate = MaxDesire; + pMinHtPhy->word = 0; + pMaxHtPhy->word = 0; + pHtPhy->word = 0; - // First check the size, it MUST not exceed the mlme queue size - if (MsgLen > MGMT_DMA_BUFFER_SIZE) + // Auto rate switching is enabled only if more than one DESIRED RATES are + // specified; otherwise disabled + if (num <= 1) { - DBGPRINT_ERR(("MlmeEnqueue: msg too large, size = %ld \n", MsgLen)); - return FALSE; + //OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); + //pAd->CommonCfg.bAutoTxRateSwitch = FALSE; + *auto_rate_cur_p = FALSE; } - - if (MlmeQueueFull(Queue)) + else { - return FALSE; + //OPSTATUS_SET_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); + //pAd->CommonCfg.bAutoTxRateSwitch = TRUE; + *auto_rate_cur_p = TRUE; } - NdisAcquireSpinLock(&(Queue->Lock)); - Tail = Queue->Tail; - Queue->Tail++; - Queue->Num++; - if (Queue->Tail == MAX_LEN_OF_MLME_QUEUE) + if (HtMcs != MCS_AUTO) { - Queue->Tail = 0; + //OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); + //pAd->CommonCfg.bAutoTxRateSwitch = FALSE; + *auto_rate_cur_p = FALSE; } - - Queue->Entry[Tail].Wcid = RESERVED_WCID; - Queue->Entry[Tail].Occupied = TRUE; - Queue->Entry[Tail].Machine = Machine; - Queue->Entry[Tail].MsgType = MsgType; - Queue->Entry[Tail].MsgLen = MsgLen; - - if (Msg != NULL) + else { - NdisMoveMemory(Queue->Entry[Tail].Msg, Msg, MsgLen); + //OPSTATUS_SET_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); + //pAd->CommonCfg.bAutoTxRateSwitch = TRUE; + *auto_rate_cur_p = TRUE; } - NdisReleaseSpinLock(&(Queue->Lock)); - return TRUE; -} - -/*! \brief This function is used when Recv gets a MLME message - * \param *Queue The MLME Queue - * \param TimeStampHigh The upper 32 bit of timestamp - * \param TimeStampLow The lower 32 bit of timestamp - * \param Rssi The receiving RSSI strength - * \param MsgLen The length of the message - * \param *Msg The message pointer - * \return TRUE if everything ok, FALSE otherwise (like Queue Full) - * \pre - * \post - - IRQL = DISPATCH_LEVEL - - */ -BOOLEAN MlmeEnqueueForRecv( - IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN ULONG TimeStampHigh, - IN ULONG TimeStampLow, - IN UCHAR Rssi0, - IN UCHAR Rssi1, - IN UCHAR Rssi2, - IN ULONG MsgLen, - IN VOID *Msg, - IN UCHAR Signal) -{ - INT Tail, Machine; - PFRAME_802_11 pFrame = (PFRAME_802_11)Msg; - INT MsgType; - MLME_QUEUE *Queue = (MLME_QUEUE *)&pAd->Mlme.Queue; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + if ((ADHOC_ON(pAd) || INFRA_ON(pAd)) && (pAd->OpMode == OPMODE_STA)) { - DBGPRINT_ERR(("MlmeEnqueueForRecv: fRTMP_ADAPTER_HALT_IN_PROGRESS\n")); - return FALSE; + pSupRate = &pAd->StaActive.SupRate[0]; + pExtRate = &pAd->StaActive.ExtRate[0]; + SupRateLen = pAd->StaActive.SupRateLen; + ExtRateLen = pAd->StaActive.ExtRateLen; } - - // First check the size, it MUST not exceed the mlme queue size - if (MsgLen > MGMT_DMA_BUFFER_SIZE) + else { - DBGPRINT_ERR(("MlmeEnqueueForRecv: frame too large, size = %ld \n", MsgLen)); - return FALSE; + pSupRate = &pAd->CommonCfg.SupRate[0]; + pExtRate = &pAd->CommonCfg.ExtRate[0]; + SupRateLen = pAd->CommonCfg.SupRateLen; + ExtRateLen = pAd->CommonCfg.ExtRateLen; } - if (MlmeQueueFull(Queue)) + // find max supported rate + for (i=0; i Rate) MinSupport = Rate; } + for (i=0; isubtype=%d\n",pFrame->Hdr.FC.SubType)); - return FALSE; + case 2: Rate = RATE_1; if (pExtRate[i] & 0x80) BasicRateBitmap |= 0x0001; break; + case 4: Rate = RATE_2; if (pExtRate[i] & 0x80) BasicRateBitmap |= 0x0002; break; + case 11: Rate = RATE_5_5; if (pExtRate[i] & 0x80) BasicRateBitmap |= 0x0004; break; + case 22: Rate = RATE_11; if (pExtRate[i] & 0x80) BasicRateBitmap |= 0x0008; break; + case 12: Rate = RATE_6; /*if (pExtRate[i] & 0x80)*/ BasicRateBitmap |= 0x0010; break; + case 18: Rate = RATE_9; if (pExtRate[i] & 0x80) BasicRateBitmap |= 0x0020; break; + case 24: Rate = RATE_12; /*if (pExtRate[i] & 0x80)*/ BasicRateBitmap |= 0x0040; break; + case 36: Rate = RATE_18; if (pExtRate[i] & 0x80) BasicRateBitmap |= 0x0080; break; + case 48: Rate = RATE_24; /*if (pExtRate[i] & 0x80)*/ BasicRateBitmap |= 0x0100; break; + case 72: Rate = RATE_36; if (pExtRate[i] & 0x80) BasicRateBitmap |= 0x0200; break; + case 96: Rate = RATE_48; if (pExtRate[i] & 0x80) BasicRateBitmap |= 0x0400; break; + case 108: Rate = RATE_54; if (pExtRate[i] & 0x80) BasicRateBitmap |= 0x0800; break; + default: Rate = RATE_1; break; } - } + if (MaxSupport < Rate) MaxSupport = Rate; - // OK, we got all the informations, it is time to put things into queue - NdisAcquireSpinLock(&(Queue->Lock)); - Tail = Queue->Tail; - Queue->Tail++; - Queue->Num++; - if (Queue->Tail == MAX_LEN_OF_MLME_QUEUE) - { - Queue->Tail = 0; + if (MinSupport > Rate) MinSupport = Rate; } - Queue->Entry[Tail].Occupied = TRUE; - Queue->Entry[Tail].Machine = Machine; - Queue->Entry[Tail].MsgType = MsgType; - Queue->Entry[Tail].MsgLen = MsgLen; - Queue->Entry[Tail].TimeStamp.u.LowPart = TimeStampLow; - Queue->Entry[Tail].TimeStamp.u.HighPart = TimeStampHigh; - Queue->Entry[Tail].Rssi0 = Rssi0; - Queue->Entry[Tail].Rssi1 = Rssi1; - Queue->Entry[Tail].Rssi2 = Rssi2; - Queue->Entry[Tail].Signal = Signal; - Queue->Entry[Tail].Wcid = (UCHAR)Wcid; - Queue->Entry[Tail].Channel = pAd->LatchRfRegs.Channel; + RTMP_IO_WRITE32(pAd, LEGACY_BASIC_RATE, BasicRateBitmap); - if (Msg != NULL) + // bug fix + // pAd->CommonCfg.BasicRateBitmap = BasicRateBitmap; + + // calculate the exptected ACK rate for each TX rate. This info is used to caculate + // the DURATION field of outgoing uniicast DATA/MGMT frame + for (i=0; iEntry[Tail].Msg, Msg, MsgLen); + if (BasicRateBitmap & (0x01 << i)) + CurrBasicRate = (UCHAR)i; + pAd->CommonCfg.ExpectedACKRate[i] = CurrBasicRate; } - NdisReleaseSpinLock(&(Queue->Lock)); + DBGPRINT(RT_DEBUG_TRACE,("MlmeUpdateTxRates[MaxSupport = %d] = MaxDesire %d Mbps\n", RateIdToMbps[MaxSupport], RateIdToMbps[MaxDesire])); + // max tx rate = min {max desire rate, max supported rate} + if (MaxSupport < MaxDesire) + pAd->CommonCfg.MaxTxRate = MaxSupport; + else + pAd->CommonCfg.MaxTxRate = MaxDesire; - RT28XX_MLME_HANDLER(pAd); + pAd->CommonCfg.MinTxRate = MinSupport; + // 2003-07-31 john - 2500 doesn't have good sensitivity at high OFDM rates. to increase the success + // ratio of initial DHCP packet exchange, TX rate starts from a lower rate depending + // on average RSSI + // 1. RSSI >= -70db, start at 54 Mbps (short distance) + // 2. -70 > RSSI >= -75, start at 24 Mbps (mid distance) + // 3. -75 > RSSI, start at 11 Mbps (long distance) + //if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)/* && + // OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)*/) + if (*auto_rate_cur_p) + { + short dbm = 0; - return TRUE; -} + dbm = pAd->StaCfg.RssiSample.AvgRssi0 - pAd->BbpRssiToDbmDelta; + if (bLinkUp == TRUE) + pAd->CommonCfg.TxRate = RATE_24; + else + pAd->CommonCfg.TxRate = pAd->CommonCfg.MaxTxRate; -/*! \brief Dequeue a message from the MLME Queue - * \param *Queue The MLME Queue - * \param *Elem The message dequeued from MLME Queue - * \return TRUE if the Elem contains something, FALSE otherwise - * \pre - * \post + if (dbm < -75) + pAd->CommonCfg.TxRate = RATE_11; + else if (dbm < -70) + pAd->CommonCfg.TxRate = RATE_24; - IRQL = DISPATCH_LEVEL + // should never exceed MaxTxRate (consider 11B-only mode) + if (pAd->CommonCfg.TxRate > pAd->CommonCfg.MaxTxRate) + pAd->CommonCfg.TxRate = pAd->CommonCfg.MaxTxRate; - */ -BOOLEAN MlmeDequeue( - IN MLME_QUEUE *Queue, - OUT MLME_QUEUE_ELEM **Elem) -{ - NdisAcquireSpinLock(&(Queue->Lock)); - *Elem = &(Queue->Entry[Queue->Head]); - Queue->Num--; - Queue->Head++; - if (Queue->Head == MAX_LEN_OF_MLME_QUEUE) - { - Queue->Head = 0; + pAd->CommonCfg.TxRateIndex = 0; } - NdisReleaseSpinLock(&(Queue->Lock)); - return TRUE; -} - -// IRQL = DISPATCH_LEVEL -VOID MlmeRestartStateMachine( - IN PRTMP_ADAPTER pAd) -{ -#ifdef RT2860 - MLME_QUEUE_ELEM *Elem = NULL; -#endif - BOOLEAN Cancelled; + else + { + pAd->CommonCfg.TxRate = pAd->CommonCfg.MaxTxRate; + pHtPhy->field.MCS = (pAd->CommonCfg.MaxTxRate > 3) ? (pAd->CommonCfg.MaxTxRate - 4) : pAd->CommonCfg.MaxTxRate; + pHtPhy->field.MODE = (pAd->CommonCfg.MaxTxRate > 3) ? MODE_OFDM : MODE_CCK; - DBGPRINT(RT_DEBUG_TRACE, ("MlmeRestartStateMachine \n")); + pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.STBC = pHtPhy->field.STBC; + pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.ShortGI = pHtPhy->field.ShortGI; + pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MCS = pHtPhy->field.MCS; + pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE = pHtPhy->field.MODE; + } -#ifdef RT2860 - NdisAcquireSpinLock(&pAd->Mlme.TaskLock); - if(pAd->Mlme.bRunning) + if (pAd->CommonCfg.TxRate <= RATE_11) { - NdisReleaseSpinLock(&pAd->Mlme.TaskLock); - return; + pMaxHtPhy->field.MODE = MODE_CCK; + pMaxHtPhy->field.MCS = pAd->CommonCfg.TxRate; + pMinHtPhy->field.MCS = pAd->CommonCfg.MinTxRate; } else { - pAd->Mlme.bRunning = TRUE; + pMaxHtPhy->field.MODE = MODE_OFDM; + pMaxHtPhy->field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.TxRate]; + if (pAd->CommonCfg.MinTxRate >= RATE_6 && (pAd->CommonCfg.MinTxRate <= RATE_54)) + {pMinHtPhy->field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MinTxRate];} + else + {pMinHtPhy->field.MCS = pAd->CommonCfg.MinTxRate;} } - NdisReleaseSpinLock(&pAd->Mlme.TaskLock); - // Remove all Mlme queues elements - while (!MlmeQueueEmpty(&pAd->Mlme.Queue)) + pHtPhy->word = (pMaxHtPhy->word); + if (bLinkUp && (pAd->OpMode == OPMODE_STA)) { - //From message type, determine which state machine I should drive - if (MlmeDequeue(&pAd->Mlme.Queue, &Elem)) - { - // free MLME element - Elem->Occupied = FALSE; - Elem->MsgLen = 0; - - } - else { - DBGPRINT_ERR(("MlmeRestartStateMachine: MlmeQueue empty\n")); - } + pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word = pHtPhy->word; + pAd->MacTab.Content[BSSID_WCID].MaxHTPhyMode.word = pMaxHtPhy->word; + pAd->MacTab.Content[BSSID_WCID].MinHTPhyMode.word = pMinHtPhy->word; } -#endif /* RT2860 */ + else + { + switch (pAd->CommonCfg.PhyMode) + { + case PHY_11BG_MIXED: + case PHY_11B: + case PHY_11BGN_MIXED: + pAd->CommonCfg.MlmeRate = RATE_1; + pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_CCK; + pAd->CommonCfg.MlmeTransmit.field.MCS = RATE_1; +//#ifdef WIFI_TEST + pAd->CommonCfg.RtsRate = RATE_11; +//#else +// pAd->CommonCfg.RtsRate = RATE_1; +//#endif + break; + case PHY_11G: + case PHY_11A: + case PHY_11AGN_MIXED: + case PHY_11GN_MIXED: + case PHY_11N_2_4G: + case PHY_11AN_MIXED: + case PHY_11N_5G: + pAd->CommonCfg.MlmeRate = RATE_6; + pAd->CommonCfg.RtsRate = RATE_6; + pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; + pAd->CommonCfg.MlmeTransmit.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; + break; + case PHY_11ABG_MIXED: + case PHY_11ABGN_MIXED: + if (pAd->CommonCfg.Channel <= 14) { - // Cancel all timer events - // Be careful to cancel new added timer - RTMPCancelTimer(&pAd->MlmeAux.AssocTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.ReassocTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.DisassocTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.AuthTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &Cancelled); + pAd->CommonCfg.MlmeRate = RATE_1; + pAd->CommonCfg.RtsRate = RATE_1; + pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_CCK; + pAd->CommonCfg.MlmeTransmit.field.MCS = RATE_1; } - - // Change back to original channel in case of doing scan - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - - // Resume MSDU which is turned off durning scan - RTMPResumeMsduTransmission(pAd); - + else { - // Set all state machines back IDLE - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - pAd->Mlme.AuthRspMachine.CurrState = AUTH_RSP_IDLE; - pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; - pAd->Mlme.ActMachine.CurrState = ACT_IDLE; + pAd->CommonCfg.MlmeRate = RATE_6; + pAd->CommonCfg.RtsRate = RATE_6; + pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; + pAd->CommonCfg.MlmeTransmit.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; + } + break; + default: // error + pAd->CommonCfg.MlmeRate = RATE_6; + pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; + pAd->CommonCfg.MlmeTransmit.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; + pAd->CommonCfg.RtsRate = RATE_1; + break; + } + // + // Keep Basic Mlme Rate. + // + pAd->MacTab.Content[MCAST_WCID].HTPhyMode.word = pAd->CommonCfg.MlmeTransmit.word; + if (pAd->CommonCfg.MlmeTransmit.field.MODE == MODE_OFDM) + pAd->MacTab.Content[MCAST_WCID].HTPhyMode.field.MCS = OfdmRateToRxwiMCS[RATE_24]; + else + pAd->MacTab.Content[MCAST_WCID].HTPhyMode.field.MCS = RATE_1; + pAd->CommonCfg.BasicMlmeRate = pAd->CommonCfg.MlmeRate; } -#ifdef RT2860 - // Remove running state - NdisAcquireSpinLock(&pAd->Mlme.TaskLock); - pAd->Mlme.bRunning = FALSE; - NdisReleaseSpinLock(&pAd->Mlme.TaskLock); -#endif + DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateTxRates (MaxDesire=%d, MaxSupport=%d, MaxTxRate=%d, MinRate=%d, Rate Switching =%d)\n", + RateIdToMbps[MaxDesire], RateIdToMbps[MaxSupport], RateIdToMbps[pAd->CommonCfg.MaxTxRate], RateIdToMbps[pAd->CommonCfg.MinTxRate], + /*OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)*/*auto_rate_cur_p)); + DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateTxRates (TxRate=%d, RtsRate=%d, BasicRateBitmap=0x%04lx)\n", + RateIdToMbps[pAd->CommonCfg.TxRate], RateIdToMbps[pAd->CommonCfg.RtsRate], BasicRateBitmap)); + DBGPRINT(RT_DEBUG_TRACE, ("MlmeUpdateTxRates (MlmeTransmit=0x%x, MinHTPhyMode=%x, MaxHTPhyMode=0x%x, HTPhyMode=0x%x)\n", + pAd->CommonCfg.MlmeTransmit.word, pAd->MacTab.Content[BSSID_WCID].MinHTPhyMode.word ,pAd->MacTab.Content[BSSID_WCID].MaxHTPhyMode.word ,pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word )); } -/*! \brief test if the MLME Queue is empty - * \param *Queue The MLME Queue - * \return TRUE if the Queue is empty, FALSE otherwise - * \pre - * \post +/* + ========================================================================== + Description: + This function update HT Rate setting. + Input Wcid value is valid for 2 case : + 1. it's used for Station in infra mode that copy AP rate to Mactable. + 2. OR Station in adhoc mode to copy peer's HT rate to Mactable. IRQL = DISPATCH_LEVEL + ========================================================================== */ -BOOLEAN MlmeQueueEmpty( - IN MLME_QUEUE *Queue) +VOID MlmeUpdateHtTxRates( + IN PRTMP_ADAPTER pAd, + IN UCHAR apidx) { - BOOLEAN Ans; + UCHAR StbcMcs; //j, StbcMcs, bitmask; + CHAR i; // 3*3 + RT_HT_CAPABILITY *pRtHtCap = NULL; + RT_HT_PHY_INFO *pActiveHtPhy = NULL; + ULONG BasicMCS; + UCHAR j, bitmask; + PRT_HT_PHY_INFO pDesireHtPhy = NULL; + PHTTRANSMIT_SETTING pHtPhy = NULL; + PHTTRANSMIT_SETTING pMaxHtPhy = NULL; + PHTTRANSMIT_SETTING pMinHtPhy = NULL; + BOOLEAN *auto_rate_cur_p; - NdisAcquireSpinLock(&(Queue->Lock)); - Ans = (Queue->Num == 0); - NdisReleaseSpinLock(&(Queue->Lock)); + DBGPRINT(RT_DEBUG_TRACE,("MlmeUpdateHtTxRates===> \n")); - return Ans; -} + auto_rate_cur_p = NULL; -/*! \brief test if the MLME Queue is full - * \param *Queue The MLME Queue - * \return TRUE if the Queue is empty, FALSE otherwise - * \pre - * \post + { + pDesireHtPhy = &pAd->StaCfg.DesiredHtPhyInfo; + pActiveHtPhy = &pAd->StaCfg.DesiredHtPhyInfo; + pHtPhy = &pAd->StaCfg.HTPhyMode; + pMaxHtPhy = &pAd->StaCfg.MaxHTPhyMode; + pMinHtPhy = &pAd->StaCfg.MinHTPhyMode; - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL + auto_rate_cur_p = &pAd->StaCfg.bAutoTxRateSwitch; + } - */ -BOOLEAN MlmeQueueFull( - IN MLME_QUEUE *Queue) -{ - BOOLEAN Ans; + if ((ADHOC_ON(pAd) || INFRA_ON(pAd)) && (pAd->OpMode == OPMODE_STA)) + { + if (pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) + return; - NdisAcquireSpinLock(&(Queue->Lock)); - Ans = (Queue->Num == MAX_LEN_OF_MLME_QUEUE || Queue->Entry[Queue->Tail].Occupied); - NdisReleaseSpinLock(&(Queue->Lock)); + pRtHtCap = &pAd->StaActive.SupportedHtPhy; + pActiveHtPhy = &pAd->StaActive.SupportedPhyInfo; + StbcMcs = (UCHAR)pAd->MlmeAux.AddHtInfo.AddHtInfo3.StbcMcs; + BasicMCS =pAd->MlmeAux.AddHtInfo.MCSSet[0]+(pAd->MlmeAux.AddHtInfo.MCSSet[1]<<8)+(StbcMcs<<16); + if ((pAd->CommonCfg.DesiredHtPhy.TxSTBC) && (pRtHtCap->RxSTBC) && (pAd->Antenna.field.TxPath == 2)) + pMaxHtPhy->field.STBC = STBC_USE; + else + pMaxHtPhy->field.STBC = STBC_NONE; + } + else + { + if (pDesireHtPhy->bHtEnable == FALSE) + return; - return Ans; -} + pRtHtCap = &pAd->CommonCfg.DesiredHtPhy; + StbcMcs = (UCHAR)pAd->CommonCfg.AddHTInfo.AddHtInfo3.StbcMcs; + BasicMCS = pAd->CommonCfg.AddHTInfo.MCSSet[0]+(pAd->CommonCfg.AddHTInfo.MCSSet[1]<<8)+(StbcMcs<<16); + if ((pAd->CommonCfg.DesiredHtPhy.TxSTBC) && (pRtHtCap->RxSTBC) && (pAd->Antenna.field.TxPath == 2)) + pMaxHtPhy->field.STBC = STBC_USE; + else + pMaxHtPhy->field.STBC = STBC_NONE; + } -/*! \brief The destructor of MLME Queue - * \param - * \return - * \pre - * \post - * \note Clear Mlme Queue, Set Queue->Num to Zero. + // Decide MAX ht rate. + if ((pRtHtCap->GF) && (pAd->CommonCfg.DesiredHtPhy.GF)) + pMaxHtPhy->field.MODE = MODE_HTGREENFIELD; + else + pMaxHtPhy->field.MODE = MODE_HTMIX; - IRQL = PASSIVE_LEVEL + if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth) && (pRtHtCap->ChannelWidth)) + pMaxHtPhy->field.BW = BW_40; + else + pMaxHtPhy->field.BW = BW_20; - */ -VOID MlmeQueueDestroy( - IN MLME_QUEUE *pQueue) -{ - NdisAcquireSpinLock(&(pQueue->Lock)); - pQueue->Num = 0; - pQueue->Head = 0; - pQueue->Tail = 0; - NdisReleaseSpinLock(&(pQueue->Lock)); - NdisFreeSpinLock(&(pQueue->Lock)); -} + if (pMaxHtPhy->field.BW == BW_20) + pMaxHtPhy->field.ShortGI = (pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 & pRtHtCap->ShortGIfor20); + else + pMaxHtPhy->field.ShortGI = (pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 & pRtHtCap->ShortGIfor40); -/*! \brief To substitute the message type if the message is coming from external - * \param pFrame The frame received - * \param *Machine The state machine - * \param *MsgType the message type for the state machine - * \return TRUE if the substitution is successful, FALSE otherwise - * \pre - * \post + if (pDesireHtPhy->MCSSet[4] != 0) + { + pMaxHtPhy->field.MCS = 32; + } - IRQL = DISPATCH_LEVEL + for (i=23; i>=0; i--) // 3*3 + { + j = i/8; + bitmask = (1<<(i-(j*8))); - */ -BOOLEAN MsgTypeSubst( - IN PRTMP_ADAPTER pAd, - IN PFRAME_802_11 pFrame, - OUT INT *Machine, - OUT INT *MsgType) -{ - USHORT Seq; - UCHAR EAPType; - PUCHAR pData; + if ((pActiveHtPhy->MCSSet[j] & bitmask) && (pDesireHtPhy->MCSSet[j] & bitmask)) + { + pMaxHtPhy->field.MCS = i; + break; + } - // Pointer to start of data frames including SNAP header - pData = (PUCHAR) pFrame + LENGTH_802_11; + if (i==0) + break; + } - // The only data type will pass to this function is EAPOL frame - if (pFrame->Hdr.FC.Type == BTYPE_DATA) + // Copy MIN ht rate. rt2860??? + pMinHtPhy->field.BW = BW_20; + pMinHtPhy->field.MCS = 0; + pMinHtPhy->field.STBC = 0; + pMinHtPhy->field.ShortGI = 0; + //If STA assigns fixed rate. update to fixed here. + if ( (pAd->OpMode == OPMODE_STA) && (pDesireHtPhy->MCSSet[0] != 0xff)) { - if (NdisEqualMemory(SNAP_AIRONET, pData, LENGTH_802_1_H)) - { - // Cisco Aironet SNAP header - *Machine = AIRONET_STATE_MACHINE; - *MsgType = MT2_AIRONET_MSG; - return (TRUE); - } + if (pDesireHtPhy->MCSSet[4] != 0) + { + pMaxHtPhy->field.MCS = 32; + pMinHtPhy->field.MCS = 32; + DBGPRINT(RT_DEBUG_TRACE,("MlmeUpdateHtTxRates<=== Use Fixed MCS = %d\n",pMinHtPhy->field.MCS)); + } + + for (i=23; (CHAR)i >= 0; i--) // 3*3 + { + j = i/8; + bitmask = (1<<(i-(j*8))); + if ( (pDesireHtPhy->MCSSet[j] & bitmask) && (pActiveHtPhy->MCSSet[j] & bitmask)) { - *Machine = WPA_PSK_STATE_MACHINE; - EAPType = *((UCHAR*)pFrame + LENGTH_802_11 + LENGTH_802_1_H + 1); - return(WpaMsgTypeSubst(EAPType, MsgType)); + pMaxHtPhy->field.MCS = i; + pMinHtPhy->field.MCS = i; + break; } + if (i==0) + break; + } } - switch (pFrame->Hdr.FC.SubType) - { - case SUBTYPE_ASSOC_REQ: - *Machine = ASSOC_STATE_MACHINE; - *MsgType = MT2_PEER_ASSOC_REQ; - break; - case SUBTYPE_ASSOC_RSP: - *Machine = ASSOC_STATE_MACHINE; - *MsgType = MT2_PEER_ASSOC_RSP; - break; - case SUBTYPE_REASSOC_REQ: - *Machine = ASSOC_STATE_MACHINE; - *MsgType = MT2_PEER_REASSOC_REQ; - break; - case SUBTYPE_REASSOC_RSP: - *Machine = ASSOC_STATE_MACHINE; - *MsgType = MT2_PEER_REASSOC_RSP; - break; - case SUBTYPE_PROBE_REQ: - *Machine = SYNC_STATE_MACHINE; - *MsgType = MT2_PEER_PROBE_REQ; - break; - case SUBTYPE_PROBE_RSP: - *Machine = SYNC_STATE_MACHINE; - *MsgType = MT2_PEER_PROBE_RSP; - break; - case SUBTYPE_BEACON: - *Machine = SYNC_STATE_MACHINE; - *MsgType = MT2_PEER_BEACON; - break; - case SUBTYPE_ATIM: - *Machine = SYNC_STATE_MACHINE; - *MsgType = MT2_PEER_ATIM; - break; - case SUBTYPE_DISASSOC: - *Machine = ASSOC_STATE_MACHINE; - *MsgType = MT2_PEER_DISASSOC_REQ; - break; - case SUBTYPE_AUTH: - // get the sequence number from payload 24 Mac Header + 2 bytes algorithm - NdisMoveMemory(&Seq, &pFrame->Octet[2], sizeof(USHORT)); - if (Seq == 1 || Seq == 3) - { - *Machine = AUTH_RSP_STATE_MACHINE; - *MsgType = MT2_PEER_AUTH_ODD; - } - else if (Seq == 2 || Seq == 4) - { - *Machine = AUTH_STATE_MACHINE; - *MsgType = MT2_PEER_AUTH_EVEN; - } - else - { - return FALSE; - } - break; - case SUBTYPE_DEAUTH: - *Machine = AUTH_RSP_STATE_MACHINE; - *MsgType = MT2_PEER_DEAUTH; - break; - case SUBTYPE_ACTION: - *Machine = ACTION_STATE_MACHINE; - // Sometimes Sta will return with category bytes with MSB = 1, if they receive catogory out of their support - if ((pFrame->Octet[0]&0x7F) > MAX_PEER_CATE_MSG) - { - *MsgType = MT2_ACT_INVALID; - } - else - { - *MsgType = (pFrame->Octet[0]&0x7F); - } - break; - default: - return FALSE; - break; + + // Decide ht rate + pHtPhy->field.STBC = pMaxHtPhy->field.STBC; + pHtPhy->field.BW = pMaxHtPhy->field.BW; + pHtPhy->field.MODE = pMaxHtPhy->field.MODE; + pHtPhy->field.MCS = pMaxHtPhy->field.MCS; + pHtPhy->field.ShortGI = pMaxHtPhy->field.ShortGI; + + // use default now. rt2860 + if (pDesireHtPhy->MCSSet[0] != 0xff) + *auto_rate_cur_p = FALSE; + else + *auto_rate_cur_p = TRUE; + + DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateHtTxRates<---.AMsduSize = %d \n", pAd->CommonCfg.DesiredHtPhy.AmsduSize )); + DBGPRINT(RT_DEBUG_TRACE,("TX: MCS[0] = %x (choose %d), BW = %d, ShortGI = %d, MODE = %d, \n", pActiveHtPhy->MCSSet[0],pHtPhy->field.MCS, + pHtPhy->field.BW, pHtPhy->field.ShortGI, pHtPhy->field.MODE)); + DBGPRINT(RT_DEBUG_TRACE,("MlmeUpdateHtTxRates<=== \n")); +} + + +VOID BATableInit( + IN PRTMP_ADAPTER pAd, + IN BA_TABLE *Tab) +{ + int i; + + Tab->numAsOriginator = 0; + Tab->numAsRecipient = 0; + Tab->numDoneOriginator = 0; + NdisAllocateSpinLock(&pAd->BATabLock); + for (i = 0; i < MAX_LEN_OF_BA_REC_TABLE; i++) + { + Tab->BARecEntry[i].REC_BA_Status = Recipient_NONE; + NdisAllocateSpinLock(&(Tab->BARecEntry[i].RxReRingLock)); + } + for (i = 0; i < MAX_LEN_OF_BA_ORI_TABLE; i++) + { + Tab->BAOriEntry[i].ORI_BA_Status = Originator_NONE; } +} - return TRUE; +// IRQL = DISPATCH_LEVEL +VOID MlmeRadioOff( + IN PRTMP_ADAPTER pAd) +{ + RTMP_MLME_RADIO_OFF(pAd); +} + +// IRQL = DISPATCH_LEVEL +VOID MlmeRadioOn( + IN PRTMP_ADAPTER pAd) +{ + RTMP_MLME_RADIO_ON(pAd); } // =========================================================================================== -// state_machine.c +// bss_table.c // =========================================================================================== -/*! \brief Initialize the state machine. - * \param *S pointer to the state machine - * \param Trans State machine transition function - * \param StNr number of states - * \param MsgNr number of messages - * \param DefFunc default function, when there is invalid state/message combination - * \param InitState initial state of the state machine - * \param Base StateMachine base, internal use only - * \pre p_sm should be a legal pointer + +/*! \brief initialize BSS table + * \param p_tab pointer to the table + * \return none + * \pre * \post IRQL = PASSIVE_LEVEL + IRQL = DISPATCH_LEVEL */ -VOID StateMachineInit( - IN STATE_MACHINE *S, - IN STATE_MACHINE_FUNC Trans[], - IN ULONG StNr, - IN ULONG MsgNr, - IN STATE_MACHINE_FUNC DefFunc, - IN ULONG InitState, - IN ULONG Base) +VOID BssTableInit( + IN BSS_TABLE *Tab) { - ULONG i, j; + int i; - // set number of states and messages - S->NrState = StNr; - S->NrMsg = MsgNr; - S->Base = Base; + Tab->BssNr = 0; + Tab->BssOverlapNr = 0; + for (i = 0; i < MAX_LEN_OF_BSS_TABLE; i++) + { + NdisZeroMemory(&Tab->BssEntry[i], sizeof(BSS_ENTRY)); + Tab->BssEntry[i].Rssi = -127; // initial the rssi as a minimum value + } +} - S->TransFunc = Trans; - // init all state transition to default function - for (i = 0; i < StNr; i++) +/*! \brief search the BSS table by SSID + * \param p_tab pointer to the bss table + * \param ssid SSID string + * \return index of the table, BSS_NOT_FOUND if not in the table + * \pre + * \post + * \note search by sequential search + + IRQL = DISPATCH_LEVEL + + */ +ULONG BssTableSearch( + IN BSS_TABLE *Tab, + IN PUCHAR pBssid, + IN UCHAR Channel) +{ + UCHAR i; + + for (i = 0; i < Tab->BssNr; i++) { - for (j = 0; j < MsgNr; j++) + // + // Some AP that support A/B/G mode that may used the same BSSID on 11A and 11B/G. + // We should distinguish this case. + // + if ((((Tab->BssEntry[i].Channel <= 14) && (Channel <= 14)) || + ((Tab->BssEntry[i].Channel > 14) && (Channel > 14))) && + MAC_ADDR_EQUAL(Tab->BssEntry[i].Bssid, pBssid)) { - S->TransFunc[i * MsgNr + j] = DefFunc; + return i; } } - - // set the starting state - S->CurrState = InitState; + return (ULONG)BSS_NOT_FOUND; } -/*! \brief This function fills in the function pointer into the cell in the state machine - * \param *S pointer to the state machine - * \param St state - * \param Msg incoming message - * \param f the function to be executed when (state, message) combination occurs at the state machine - * \pre *S should be a legal pointer to the state machine, st, msg, should be all within the range, Base should be set in the initial state - * \post +ULONG BssSsidTableSearch( + IN BSS_TABLE *Tab, + IN PUCHAR pBssid, + IN PUCHAR pSsid, + IN UCHAR SsidLen, + IN UCHAR Channel) +{ + UCHAR i; - IRQL = PASSIVE_LEVEL + for (i = 0; i < Tab->BssNr; i++) + { + // + // Some AP that support A/B/G mode that may used the same BSSID on 11A and 11B/G. + // We should distinguish this case. + // + if ((((Tab->BssEntry[i].Channel <= 14) && (Channel <= 14)) || + ((Tab->BssEntry[i].Channel > 14) && (Channel > 14))) && + MAC_ADDR_EQUAL(Tab->BssEntry[i].Bssid, pBssid) && + SSID_EQUAL(pSsid, SsidLen, Tab->BssEntry[i].Ssid, Tab->BssEntry[i].SsidLen)) + { + return i; + } + } + return (ULONG)BSS_NOT_FOUND; +} - */ -VOID StateMachineSetAction( - IN STATE_MACHINE *S, - IN ULONG St, - IN ULONG Msg, - IN STATE_MACHINE_FUNC Func) +ULONG BssTableSearchWithSSID( + IN BSS_TABLE *Tab, + IN PUCHAR Bssid, + IN PUCHAR pSsid, + IN UCHAR SsidLen, + IN UCHAR Channel) { - ULONG MsgIdx; - - MsgIdx = Msg - S->Base; + UCHAR i; - if (St < S->NrState && MsgIdx < S->NrMsg) + for (i = 0; i < Tab->BssNr; i++) { - // boundary checking before setting the action - S->TransFunc[St * S->NrMsg + MsgIdx] = Func; + if ((((Tab->BssEntry[i].Channel <= 14) && (Channel <= 14)) || + ((Tab->BssEntry[i].Channel > 14) && (Channel > 14))) && + MAC_ADDR_EQUAL(&(Tab->BssEntry[i].Bssid), Bssid) && + (SSID_EQUAL(pSsid, SsidLen, Tab->BssEntry[i].Ssid, Tab->BssEntry[i].SsidLen) || + (NdisEqualMemory(pSsid, ZeroSsid, SsidLen)) || + (NdisEqualMemory(Tab->BssEntry[i].Ssid, ZeroSsid, Tab->BssEntry[i].SsidLen)))) + { + return i; + } } + return (ULONG)BSS_NOT_FOUND; } -/*! \brief This function does the state transition - * \param *Adapter the NIC adapter pointer - * \param *S the state machine - * \param *Elem the message to be executed - * \return None - IRQL = DISPATCH_LEVEL +ULONG BssSsidTableSearchBySSID( + IN BSS_TABLE *Tab, + IN PUCHAR pSsid, + IN UCHAR SsidLen) +{ + UCHAR i; - */ -VOID StateMachinePerformAction( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - IN MLME_QUEUE_ELEM *Elem) + for (i = 0; i < Tab->BssNr; i++) + { + if (SSID_EQUAL(pSsid, SsidLen, Tab->BssEntry[i].Ssid, Tab->BssEntry[i].SsidLen)) + { + return i; + } + } + return (ULONG)BSS_NOT_FOUND; +} + + +// IRQL = DISPATCH_LEVEL +VOID BssTableDeleteEntry( + IN OUT BSS_TABLE *Tab, + IN PUCHAR pBssid, + IN UCHAR Channel) { - (*(S->TransFunc[S->CurrState * S->NrMsg + Elem->MsgType - S->Base]))(pAd, Elem); + UCHAR i, j; + + for (i = 0; i < Tab->BssNr; i++) + { + if ((Tab->BssEntry[i].Channel == Channel) && + (MAC_ADDR_EQUAL(Tab->BssEntry[i].Bssid, pBssid))) + { + for (j = i; j < Tab->BssNr - 1; j++) + { + NdisMoveMemory(&(Tab->BssEntry[j]), &(Tab->BssEntry[j + 1]), sizeof(BSS_ENTRY)); + } + NdisZeroMemory(&(Tab->BssEntry[Tab->BssNr - 1]), sizeof(BSS_ENTRY)); + Tab->BssNr -= 1; + return; + } + } } /* - ========================================================================== - Description: - The drop function, when machine executes this, the message is simply - ignored. This function does nothing, the message is freed in - StateMachinePerformAction() - ========================================================================== - */ -VOID Drop( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) + ======================================================================== + Routine Description: + Delete the Originator Entry in BAtable. Or decrease numAs Originator by 1 if needed. + + Arguments: + // IRQL = DISPATCH_LEVEL + ======================================================================== +*/ +VOID BATableDeleteORIEntry( + IN OUT PRTMP_ADAPTER pAd, + IN BA_ORI_ENTRY *pBAORIEntry) { -} -// =========================================================================================== -// lfsr.c -// =========================================================================================== + if (pBAORIEntry->ORI_BA_Status != Originator_NONE) + { + NdisAcquireSpinLock(&pAd->BATabLock); + if (pBAORIEntry->ORI_BA_Status == Originator_Done) + { + pAd->BATable.numAsOriginator -= 1; + DBGPRINT(RT_DEBUG_TRACE, ("BATableDeleteORIEntry numAsOriginator= %ld\n", pAd->BATable.numAsRecipient)); + // Erase Bitmap flag. + } + pAd->MacTab.Content[pBAORIEntry->Wcid].TXBAbitmap &= (~(1<<(pBAORIEntry->TID) )); // If STA mode, erase flag here + pAd->MacTab.Content[pBAORIEntry->Wcid].BAOriWcidArray[pBAORIEntry->TID] = 0; // If STA mode, erase flag here + pBAORIEntry->ORI_BA_Status = Originator_NONE; + pBAORIEntry->Token = 1; + // Not clear Sequence here. + NdisReleaseSpinLock(&pAd->BATabLock); + } +} -/* - ========================================================================== - Description: +/*! \brief + * \param + * \return + * \pre + * \post - IRQL = PASSIVE_LEVEL + IRQL = DISPATCH_LEVEL - ========================================================================== */ -VOID LfsrInit( +VOID BssEntrySet( IN PRTMP_ADAPTER pAd, - IN ULONG Seed) + OUT BSS_ENTRY *pBss, + IN PUCHAR pBssid, + IN CHAR Ssid[], + IN UCHAR SsidLen, + IN UCHAR BssType, + IN USHORT BeaconPeriod, + IN PCF_PARM pCfParm, + IN USHORT AtimWin, + IN USHORT CapabilityInfo, + IN UCHAR SupRate[], + IN UCHAR SupRateLen, + IN UCHAR ExtRate[], + IN UCHAR ExtRateLen, + IN HT_CAPABILITY_IE *pHtCapability, + IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE + IN UCHAR HtCapabilityLen, + IN UCHAR AddHtInfoLen, + IN UCHAR NewExtChanOffset, + IN UCHAR Channel, + IN CHAR Rssi, + IN LARGE_INTEGER TimeStamp, + IN UCHAR CkipFlag, + IN PEDCA_PARM pEdcaParm, + IN PQOS_CAPABILITY_PARM pQosCapability, + IN PQBSS_LOAD_PARM pQbssLoad, + IN USHORT LengthVIE, + IN PNDIS_802_11_VARIABLE_IEs pVIE) { - if (Seed == 0) - pAd->Mlme.ShiftReg = 1; + COPY_MAC_ADDR(pBss->Bssid, pBssid); + // Default Hidden SSID to be TRUE, it will be turned to FALSE after coping SSID + pBss->Hidden = 1; + if (SsidLen > 0) + { + // For hidden SSID AP, it might send beacon with SSID len equal to 0 + // Or send beacon /probe response with SSID len matching real SSID length, + // but SSID is all zero. such as "00-00-00-00" with length 4. + // We have to prevent this case overwrite correct table + if (NdisEqualMemory(Ssid, ZeroSsid, SsidLen) == 0) + { + NdisZeroMemory(pBss->Ssid, MAX_LEN_OF_SSID); + NdisMoveMemory(pBss->Ssid, Ssid, SsidLen); + pBss->SsidLen = SsidLen; + pBss->Hidden = 0; + } + } else - pAd->Mlme.ShiftReg = Seed; -} + pBss->SsidLen = 0; + pBss->BssType = BssType; + pBss->BeaconPeriod = BeaconPeriod; + if (BssType == BSS_INFRA) + { + if (pCfParm->bValid) + { + pBss->CfpCount = pCfParm->CfpCount; + pBss->CfpPeriod = pCfParm->CfpPeriod; + pBss->CfpMaxDuration = pCfParm->CfpMaxDuration; + pBss->CfpDurRemaining = pCfParm->CfpDurRemaining; + } + } + else + { + pBss->AtimWin = AtimWin; + } -/* - ========================================================================== - Description: - ========================================================================== - */ -UCHAR RandomByte( - IN PRTMP_ADAPTER pAd) -{ - ULONG i; - UCHAR R, Result; + pBss->CapabilityInfo = CapabilityInfo; + // The privacy bit indicate security is ON, it maight be WEP, TKIP or AES + // Combine with AuthMode, they will decide the connection methods. + pBss->Privacy = CAP_IS_PRIVACY_ON(pBss->CapabilityInfo); + ASSERT(SupRateLen <= MAX_LEN_OF_SUPPORTED_RATES); + if (SupRateLen <= MAX_LEN_OF_SUPPORTED_RATES) + NdisMoveMemory(pBss->SupRate, SupRate, SupRateLen); + else + NdisMoveMemory(pBss->SupRate, SupRate, MAX_LEN_OF_SUPPORTED_RATES); + pBss->SupRateLen = SupRateLen; + ASSERT(ExtRateLen <= MAX_LEN_OF_SUPPORTED_RATES); + NdisMoveMemory(pBss->ExtRate, ExtRate, ExtRateLen); + pBss->NewExtChanOffset = NewExtChanOffset; + pBss->ExtRateLen = ExtRateLen; + pBss->Channel = Channel; + pBss->CentralChannel = Channel; + pBss->Rssi = Rssi; + // Update CkipFlag. if not exists, the value is 0x0 + pBss->CkipFlag = CkipFlag; - R = 0; + // New for microsoft Fixed IEs + NdisMoveMemory(pBss->FixIEs.Timestamp, &TimeStamp, 8); + pBss->FixIEs.BeaconInterval = BeaconPeriod; + pBss->FixIEs.Capabilities = CapabilityInfo; - if (pAd->Mlme.ShiftReg == 0) - NdisGetSystemUpTime((ULONG *)&pAd->Mlme.ShiftReg); + // New for microsoft Variable IEs + if (LengthVIE != 0) + { + pBss->VarIELen = LengthVIE; + NdisMoveMemory(pBss->VarIEs, pVIE, pBss->VarIELen); + } + else + { + pBss->VarIELen = 0; + } - for (i = 0; i < 8; i++) + pBss->AddHtInfoLen = 0; + pBss->HtCapabilityLen = 0; + if (HtCapabilityLen> 0) { - if (pAd->Mlme.ShiftReg & 0x00000001) + pBss->HtCapabilityLen = HtCapabilityLen; + NdisMoveMemory(&pBss->HtCapability, pHtCapability, HtCapabilityLen); + if (AddHtInfoLen > 0) { - pAd->Mlme.ShiftReg = ((pAd->Mlme.ShiftReg ^ LFSR_MASK) >> 1) | 0x80000000; - Result = 1; + pBss->AddHtInfoLen = AddHtInfoLen; + NdisMoveMemory(&pBss->AddHtInfo, pAddHtInfo, AddHtInfoLen); + + if ((pAddHtInfo->ControlChan > 2)&& (pAddHtInfo->AddHtInfo.ExtChanOffset == EXTCHA_BELOW) && (pHtCapability->HtCapInfo.ChannelWidth == BW_40)) + { + pBss->CentralChannel = pAddHtInfo->ControlChan - 2; } - else + else if ((pAddHtInfo->AddHtInfo.ExtChanOffset == EXTCHA_ABOVE) && (pHtCapability->HtCapInfo.ChannelWidth == BW_40)) { - pAd->Mlme.ShiftReg = pAd->Mlme.ShiftReg >> 1; - Result = 0; + pBss->CentralChannel = pAddHtInfo->ControlChan + 2; + } } - R = (R << 1) | Result; } - return R; -} + BssCipherParse(pBss); -VOID AsicUpdateAutoFallBackTable( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pRateTable) -{ - UCHAR i; - HT_FBK_CFG0_STRUC HtCfg0; - HT_FBK_CFG1_STRUC HtCfg1; - LG_FBK_CFG0_STRUC LgCfg0; - LG_FBK_CFG1_STRUC LgCfg1; - PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate; - - // set to initial value - HtCfg0.word = 0x65432100; - HtCfg1.word = 0xedcba988; - LgCfg0.word = 0xedcba988; - LgCfg1.word = 0x00002100; - - pNextTxRate = (PRTMP_TX_RATE_SWITCH)pRateTable+1; - for (i = 1; i < *((PUCHAR) pRateTable); i++) - { - pCurrTxRate = (PRTMP_TX_RATE_SWITCH)pRateTable+1+i; - switch (pCurrTxRate->Mode) + // new for QOS + if (pEdcaParm) + NdisMoveMemory(&pBss->EdcaParm, pEdcaParm, sizeof(EDCA_PARM)); + else + pBss->EdcaParm.bValid = FALSE; + if (pQosCapability) + NdisMoveMemory(&pBss->QosCapability, pQosCapability, sizeof(QOS_CAPABILITY_PARM)); + else + pBss->QosCapability.bValid = FALSE; + if (pQbssLoad) + NdisMoveMemory(&pBss->QbssLoad, pQbssLoad, sizeof(QBSS_LOAD_PARM)); + else + pBss->QbssLoad.bValid = FALSE; + + { + PEID_STRUCT pEid; + USHORT Length = 0; + + + NdisZeroMemory(&pBss->WpaIE.IE[0], MAX_CUSTOM_LEN); + NdisZeroMemory(&pBss->RsnIE.IE[0], MAX_CUSTOM_LEN); + pEid = (PEID_STRUCT) pVIE; + while ((Length + 2 + (USHORT)pEid->Len) <= LengthVIE) + { + switch(pEid->Eid) { - case 0: //CCK - break; - case 1: //OFDM + case IE_WPA: + if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4)) { - switch(pCurrTxRate->CurrMCS) + if ((pEid->Len + 2) > MAX_CUSTOM_LEN) { - case 0: - LgCfg0.field.OFDMMCS0FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 1: - LgCfg0.field.OFDMMCS1FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 2: - LgCfg0.field.OFDMMCS2FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 3: - LgCfg0.field.OFDMMCS3FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 4: - LgCfg0.field.OFDMMCS4FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 5: - LgCfg0.field.OFDMMCS5FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 6: - LgCfg0.field.OFDMMCS6FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 7: - LgCfg0.field.OFDMMCS7FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; + pBss->WpaIE.IELen = 0; break; } + pBss->WpaIE.IELen = pEid->Len + 2; + NdisMoveMemory(pBss->WpaIE.IE, pEid, pBss->WpaIE.IELen); } break; - case 2: //HT-MIX - case 3: //HT-GF - { - if ((pNextTxRate->Mode >= MODE_HTMIX) && (pCurrTxRate->CurrMCS != pNextTxRate->CurrMCS)) + case IE_RSN: + if (NdisEqualMemory(pEid->Octet + 2, RSN_OUI, 3)) { - switch(pCurrTxRate->CurrMCS) + if ((pEid->Len + 2) > MAX_CUSTOM_LEN) { - case 0: - HtCfg0.field.HTMCS0FBK = pNextTxRate->CurrMCS; - break; - case 1: - HtCfg0.field.HTMCS1FBK = pNextTxRate->CurrMCS; - break; - case 2: - HtCfg0.field.HTMCS2FBK = pNextTxRate->CurrMCS; - break; - case 3: - HtCfg0.field.HTMCS3FBK = pNextTxRate->CurrMCS; - break; - case 4: - HtCfg0.field.HTMCS4FBK = pNextTxRate->CurrMCS; - break; - case 5: - HtCfg0.field.HTMCS5FBK = pNextTxRate->CurrMCS; - break; - case 6: - HtCfg0.field.HTMCS6FBK = pNextTxRate->CurrMCS; - break; - case 7: - HtCfg0.field.HTMCS7FBK = pNextTxRate->CurrMCS; - break; - case 8: - HtCfg1.field.HTMCS8FBK = pNextTxRate->CurrMCS; - break; - case 9: - HtCfg1.field.HTMCS9FBK = pNextTxRate->CurrMCS; - break; - case 10: - HtCfg1.field.HTMCS10FBK = pNextTxRate->CurrMCS; - break; - case 11: - HtCfg1.field.HTMCS11FBK = pNextTxRate->CurrMCS; - break; - case 12: - HtCfg1.field.HTMCS12FBK = pNextTxRate->CurrMCS; - break; - case 13: - HtCfg1.field.HTMCS13FBK = pNextTxRate->CurrMCS; - break; - case 14: - HtCfg1.field.HTMCS14FBK = pNextTxRate->CurrMCS; - break; - case 15: - HtCfg1.field.HTMCS15FBK = pNextTxRate->CurrMCS; + pBss->RsnIE.IELen = 0; break; - default: - DBGPRINT(RT_DEBUG_ERROR, ("AsicUpdateAutoFallBackTable: not support CurrMCS=%d\n", pCurrTxRate->CurrMCS)); - } } + pBss->RsnIE.IELen = pEid->Len + 2; + NdisMoveMemory(pBss->RsnIE.IE, pEid, pBss->RsnIE.IELen); } break; } - - pNextTxRate = pCurrTxRate; + Length = Length + 2 + (USHORT)pEid->Len; // Eid[1] + Len[1]+ content[Len] + pEid = (PEID_STRUCT)((UCHAR*)pEid + 2 + pEid->Len); + } } - - RTMP_IO_WRITE32(pAd, HT_FBK_CFG0, HtCfg0.word); - RTMP_IO_WRITE32(pAd, HT_FBK_CFG1, HtCfg1.word); - RTMP_IO_WRITE32(pAd, LG_FBK_CFG0, LgCfg0.word); - RTMP_IO_WRITE32(pAd, LG_FBK_CFG1, LgCfg1.word); } -/* - ======================================================================== +/*! + * \brief insert an entry into the bss table + * \param p_tab The BSS table + * \param Bssid BSSID + * \param ssid SSID + * \param ssid_len Length of SSID + * \param bss_type + * \param beacon_period + * \param timestamp + * \param p_cf + * \param atim_win + * \param cap + * \param rates + * \param rates_len + * \param channel_idx + * \return none + * \pre + * \post + * \note If SSID is identical, the old entry will be replaced by the new one - Routine Description: - Set MAC register value according operation mode. - OperationMode AND bNonGFExist are for MM and GF Proteciton. - If MM or GF mask is not set, those passing argument doesn't not take effect. - - Operation mode meaning: - = 0 : Pure HT, no preotection. - = 0x01; there may be non-HT devices in both the control and extension channel, protection is optional in BSS. - = 0x10: No Transmission in 40M is protected. - = 0x11: Transmission in both 40M and 20M shall be protected - if (bNonGFExist) - we should choose not to use GF. But still set correct ASIC registers. - ======================================================================== -*/ -VOID AsicUpdateProtect( + IRQL = DISPATCH_LEVEL + + */ +ULONG BssTableSetEntry( IN PRTMP_ADAPTER pAd, - IN USHORT OperationMode, - IN UCHAR SetMask, - IN BOOLEAN bDisableBGProtect, - IN BOOLEAN bNonGFExist) + OUT BSS_TABLE *Tab, + IN PUCHAR pBssid, + IN CHAR Ssid[], + IN UCHAR SsidLen, + IN UCHAR BssType, + IN USHORT BeaconPeriod, + IN CF_PARM *CfParm, + IN USHORT AtimWin, + IN USHORT CapabilityInfo, + IN UCHAR SupRate[], + IN UCHAR SupRateLen, + IN UCHAR ExtRate[], + IN UCHAR ExtRateLen, + IN HT_CAPABILITY_IE *pHtCapability, + IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE + IN UCHAR HtCapabilityLen, + IN UCHAR AddHtInfoLen, + IN UCHAR NewExtChanOffset, + IN UCHAR ChannelNo, + IN CHAR Rssi, + IN LARGE_INTEGER TimeStamp, + IN UCHAR CkipFlag, + IN PEDCA_PARM pEdcaParm, + IN PQOS_CAPABILITY_PARM pQosCapability, + IN PQBSS_LOAD_PARM pQbssLoad, + IN USHORT LengthVIE, + IN PNDIS_802_11_VARIABLE_IEs pVIE) { - PROT_CFG_STRUC ProtCfg, ProtCfg4; - UINT32 Protect[6]; - USHORT offset; - UCHAR i; - UINT32 MacReg = 0; - - if (!(pAd->CommonCfg.bHTProtect) && (OperationMode != 8)) - { - return; - } + ULONG Idx; - if (pAd->BATable.numAsOriginator) + Idx = BssTableSearchWithSSID(Tab, pBssid, (UCHAR *)Ssid, SsidLen, ChannelNo); + if (Idx == BSS_NOT_FOUND) { - // - // enable the RTS/CTS to avoid channel collision - // - SetMask = ALLN_SETPROTECT; - OperationMode = 8; - } - - // Config ASIC RTS threshold register - RTMP_IO_READ32(pAd, TX_RTS_CFG, &MacReg); - MacReg &= 0xFF0000FF; - - // If the user want disable RtsThreshold and enable Amsdu/Ralink-Aggregation, set the RtsThreshold as 4096 - if (( - (pAd->CommonCfg.BACapability.field.AmsduEnable) || - (pAd->CommonCfg.bAggregationCapable == TRUE)) - && pAd->CommonCfg.RtsThreshold == MAX_RTS_THRESHOLD) - { - MacReg |= (0x1000 << 8); - } - else - { - MacReg |= (pAd->CommonCfg.RtsThreshold << 8); - } - - RTMP_IO_WRITE32(pAd, TX_RTS_CFG, MacReg); - - // Initial common protection settings - RTMPZeroMemory(Protect, sizeof(Protect)); - ProtCfg4.word = 0; - ProtCfg.word = 0; - ProtCfg.field.TxopAllowGF40 = 1; - ProtCfg.field.TxopAllowGF20 = 1; - ProtCfg.field.TxopAllowMM40 = 1; - ProtCfg.field.TxopAllowMM20 = 1; - ProtCfg.field.TxopAllowOfdm = 1; - ProtCfg.field.TxopAllowCck = 1; - ProtCfg.field.RTSThEn = 1; - ProtCfg.field.ProtectNav = ASIC_SHORTNAV; - - // update PHY mode and rate - if (pAd->CommonCfg.Channel > 14) - ProtCfg.field.ProtectRate = 0x4000; - ProtCfg.field.ProtectRate |= pAd->CommonCfg.RtsRate; - - // Handle legacy(B/G) protection - if (bDisableBGProtect) - { - //ProtCfg.field.ProtectRate = pAd->CommonCfg.RtsRate; - ProtCfg.field.ProtectCtrl = 0; - Protect[0] = ProtCfg.word; - Protect[1] = ProtCfg.word; - } - else + if (Tab->BssNr >= MAX_LEN_OF_BSS_TABLE) + { + // + // It may happen when BSS Table was full. + // The desired AP will not be added into BSS Table + // In this case, if we found the desired AP then overwrite BSS Table. + // + if(!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) { - //ProtCfg.field.ProtectRate = pAd->CommonCfg.RtsRate; - ProtCfg.field.ProtectCtrl = 0; // CCK do not need to be protected - Protect[0] = ProtCfg.word; - ProtCfg.field.ProtectCtrl = ASIC_CTS; // OFDM needs using CCK to protect - Protect[1] = ProtCfg.word; - } - - // Decide HT frame protection. - if ((SetMask & ALLN_SETPROTECT) != 0) + if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, pBssid) || + SSID_EQUAL(pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, Ssid, SsidLen)) { - switch(OperationMode) - { - case 0x0: - // NO PROTECT - // 1.All STAs in the BSS are 20/40 MHz HT - // 2. in ai 20/40MHz BSS - // 3. all STAs are 20MHz in a 20MHz BSS - // Pure HT. no protection. - - // MM20_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 010111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4004 (OFDM 24M) - Protect[2] = 0x01744004; - - // MM40_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 111111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4084 (duplicate OFDM 24M) - Protect[3] = 0x03f44084; - - // CF20_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 010111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4004 (OFDM 24M) - Protect[4] = 0x01744004; - - // CF40_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 111111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4084 (duplicate OFDM 24M) - Protect[5] = 0x03f44084; - - if (bNonGFExist) - { - // PROT_NAV(19:18) -- 01 (Short NAV protectiion) - // PROT_CTRL(17:16) -- 01 (RTS/CTS) - Protect[4] = 0x01754004; - Protect[5] = 0x03f54084; - } - pAd->CommonCfg.IOTestParm.bRTSLongProtOn = FALSE; - break; - - case 1: - // This is "HT non-member protection mode." - // If there may be non-HT STAs my BSS - ProtCfg.word = 0x01744004; // PROT_CTRL(17:16) : 0 (None) - ProtCfg4.word = 0x03f44084; // duplicaet legacy 24M. BW set 1. - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_BG_PROTECTION_INUSED)) - { - ProtCfg.word = 0x01740003; //ERP use Protection bit is set, use protection rate at Clause 18.. - ProtCfg4.word = 0x03f40003; // Don't duplicate RTS/CTS in CCK mode. 0x03f40083; + Idx = Tab->BssOverlapNr; + BssEntrySet(pAd, &Tab->BssEntry[Idx], pBssid, Ssid, SsidLen, BssType, BeaconPeriod, CfParm, AtimWin, + CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen,pHtCapability, pAddHtInfo,HtCapabilityLen, AddHtInfoLen, + NewExtChanOffset, ChannelNo, Rssi, TimeStamp, CkipFlag, pEdcaParm, pQosCapability, pQbssLoad, LengthVIE, pVIE); + Tab->BssOverlapNr = (Tab->BssOverlapNr++) % MAX_LEN_OF_BSS_TABLE; } - //Assign Protection method for 20&40 MHz packets - ProtCfg.field.ProtectCtrl = ASIC_RTS; - ProtCfg.field.ProtectNav = ASIC_SHORTNAV; - ProtCfg4.field.ProtectCtrl = ASIC_RTS; - ProtCfg4.field.ProtectNav = ASIC_SHORTNAV; - Protect[2] = ProtCfg.word; - Protect[3] = ProtCfg4.word; - Protect[4] = ProtCfg.word; - Protect[5] = ProtCfg4.word; - pAd->CommonCfg.IOTestParm.bRTSLongProtOn = TRUE; - break; - - case 2: - // If only HT STAs are in BSS. at least one is 20MHz. Only protect 40MHz packets - ProtCfg.word = 0x01744004; // PROT_CTRL(17:16) : 0 (None) - ProtCfg4.word = 0x03f44084; // duplicaet legacy 24M. BW set 1. - - //Assign Protection method for 40MHz packets - ProtCfg4.field.ProtectCtrl = ASIC_RTS; - ProtCfg4.field.ProtectNav = ASIC_SHORTNAV; - Protect[2] = ProtCfg.word; - Protect[3] = ProtCfg4.word; - if (bNonGFExist) - { - ProtCfg.field.ProtectCtrl = ASIC_RTS; - ProtCfg.field.ProtectNav = ASIC_SHORTNAV; + return Idx; } - Protect[4] = ProtCfg.word; - Protect[5] = ProtCfg4.word; - - pAd->CommonCfg.IOTestParm.bRTSLongProtOn = FALSE; - break; - - case 3: - // HT mixed mode. PROTECT ALL! - // Assign Rate - ProtCfg.word = 0x01744004; //duplicaet legacy 24M. BW set 1. - ProtCfg4.word = 0x03f44084; - // both 20MHz and 40MHz are protected. Whether use RTS or CTS-to-self depends on the - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_BG_PROTECTION_INUSED)) + else { - ProtCfg.word = 0x01740003; //ERP use Protection bit is set, use protection rate at Clause 18.. - ProtCfg4.word = 0x03f40003; // Don't duplicate RTS/CTS in CCK mode. 0x03f40083 + return BSS_NOT_FOUND; } - //Assign Protection method for 20&40 MHz packets - ProtCfg.field.ProtectCtrl = ASIC_RTS; - ProtCfg.field.ProtectNav = ASIC_SHORTNAV; - ProtCfg4.field.ProtectCtrl = ASIC_RTS; - ProtCfg4.field.ProtectNav = ASIC_SHORTNAV; - Protect[2] = ProtCfg.word; - Protect[3] = ProtCfg4.word; - Protect[4] = ProtCfg.word; - Protect[5] = ProtCfg4.word; - pAd->CommonCfg.IOTestParm.bRTSLongProtOn = TRUE; - break; - - case 8: - // Special on for Atheros problem n chip. - Protect[2] = 0x01754004; - Protect[3] = 0x03f54084; - Protect[4] = 0x01754004; - Protect[5] = 0x03f54084; - pAd->CommonCfg.IOTestParm.bRTSLongProtOn = TRUE; - break; } + Idx = Tab->BssNr; + BssEntrySet(pAd, &Tab->BssEntry[Idx], pBssid, Ssid, SsidLen, BssType, BeaconPeriod, CfParm, AtimWin, + CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen,pHtCapability, pAddHtInfo,HtCapabilityLen, AddHtInfoLen, + NewExtChanOffset, ChannelNo, Rssi, TimeStamp, CkipFlag, pEdcaParm, pQosCapability, pQbssLoad, LengthVIE, pVIE); + Tab->BssNr++; } - - offset = CCK_PROT_CFG; - for (i = 0;i < 6;i++) + else { - if ((SetMask & (1<< i))) + /* avoid Hidden SSID form beacon to overwirite correct SSID from probe response */ + if ((SSID_EQUAL(Ssid, SsidLen, Tab->BssEntry[Idx].Ssid, Tab->BssEntry[Idx].SsidLen)) || + (NdisEqualMemory(Tab->BssEntry[Idx].Ssid, ZeroSsid, Tab->BssEntry[Idx].SsidLen))) { - RTMP_IO_WRITE32(pAd, offset + i*4, Protect[i]); + BssEntrySet(pAd, &Tab->BssEntry[Idx], pBssid, Ssid, SsidLen, BssType, BeaconPeriod,CfParm, AtimWin, + CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen,pHtCapability, pAddHtInfo,HtCapabilityLen, AddHtInfoLen, + NewExtChanOffset, ChannelNo, Rssi, TimeStamp, CkipFlag, pEdcaParm, pQosCapability, pQbssLoad, LengthVIE, pVIE); } } -} -#ifdef RT2870 -/* - ========================================================================== - Description: + return Idx; +} - Load RF normal operation-mode setup - ========================================================================== - */ -VOID RT30xxLoadRFNormalModeSetup( - IN PRTMP_ADAPTER pAd) +// IRQL = DISPATCH_LEVEL +VOID BssTableSsidSort( + IN PRTMP_ADAPTER pAd, + OUT BSS_TABLE *OutTab, + IN CHAR Ssid[], + IN UCHAR SsidLen) { - UCHAR RFValue; - - // RX0_PD & TX0_PD, RF R1 register Bit 2 & Bit 3 to 0 and RF_BLOCK_en,RX1_PD & TX1_PD, Bit0, Bit 4 & Bit5 to 1 - RT30xxReadRFRegister(pAd, RF_R01, &RFValue); - RFValue = (RFValue & (~0x0C)) | 0x31; - RT30xxWriteRFRegister(pAd, RF_R01, RFValue); - - // TX_LO2_en, RF R15 register Bit 3 to 0 - RT30xxReadRFRegister(pAd, RF_R15, &RFValue); - RFValue &= (~0x08); - RT30xxWriteRFRegister(pAd, RF_R15, RFValue); - - // TX_LO1_en, RF R17 register Bit 3 to 0 - RT30xxReadRFRegister(pAd, RF_R17, &RFValue); - RFValue &= (~0x08); - // to fix rx long range issue - if (((pAd->MACVersion & 0xffff) >= 0x0211) && (pAd->NicConfig2.field.ExternalLNAForG == 0)) - { - RFValue |= 0x20; - } - RT30xxWriteRFRegister(pAd, RF_R17, RFValue); - - // RX_LO1_en, RF R20 register Bit 3 to 0 - RT30xxReadRFRegister(pAd, RF_R20, &RFValue); - RFValue &= (~0x08); - RT30xxWriteRFRegister(pAd, RF_R20, RFValue); - - // RX_LO2_en, RF R21 register Bit 3 to 0 - RT30xxReadRFRegister(pAd, RF_R21, &RFValue); - RFValue &= (~0x08); - RT30xxWriteRFRegister(pAd, RF_R21, RFValue); - - // LDORF_VC, RF R27 register Bit 2 to 0 - RT30xxReadRFRegister(pAd, RF_R27, &RFValue); - if ((pAd->MACVersion & 0xffff) < 0x0211) - RFValue = (RFValue & (~0x77)) | 0x3; - else - RFValue = (RFValue & (~0x77)); - RT30xxWriteRFRegister(pAd, RF_R27, RFValue); - /* end johnli */ -} - -/* - ========================================================================== - Description: + INT i; + BssTableInit(OutTab); - Load RF sleep-mode setup + for (i = 0; i < pAd->ScanTab.BssNr; i++) + { + BSS_ENTRY *pInBss = &pAd->ScanTab.BssEntry[i]; + BOOLEAN bIsHiddenApIncluded = FALSE; - ========================================================================== - */ -VOID RT30xxLoadRFSleepModeSetup( - IN PRTMP_ADAPTER pAd) + if (((pAd->CommonCfg.bIEEE80211H == 1) && + (pAd->MlmeAux.Channel > 14) && + RadarChannelCheck(pAd, pInBss->Channel)) + ) { - UCHAR RFValue; - UINT32 MACValue; - - // RF_BLOCK_en. RF R1 register Bit 0 to 0 - RT30xxReadRFRegister(pAd, RF_R01, &RFValue); - RFValue &= (~0x01); - RT30xxWriteRFRegister(pAd, RF_R01, RFValue); - - // VCO_IC, RF R7 register Bit 4 & Bit 5 to 0 - RT30xxReadRFRegister(pAd, RF_R07, &RFValue); - RFValue &= (~0x30); - RT30xxWriteRFRegister(pAd, RF_R07, RFValue); - - // Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 0 - RT30xxReadRFRegister(pAd, RF_R09, &RFValue); - RFValue &= (~0x0E); - RT30xxWriteRFRegister(pAd, RF_R09, RFValue); - - // RX_CTB_en, RF R21 register Bit 7 to 0 - RT30xxReadRFRegister(pAd, RF_R21, &RFValue); - RFValue &= (~0x80); - RT30xxWriteRFRegister(pAd, RF_R21, RFValue); - - // LDORF_VC, RF R27 register Bit 0, Bit 1 & Bit 2 to 1 - RT30xxReadRFRegister(pAd, RF_R27, &RFValue); - RFValue |= 0x77; - RT30xxWriteRFRegister(pAd, RF_R27, RFValue); - - RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue); - MACValue |= 0x1D000000; - RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue); + if (pInBss->Hidden) + bIsHiddenApIncluded = TRUE; } -/* - ========================================================================== - Description: + if ((pInBss->BssType == pAd->StaCfg.BssType) && + (SSID_EQUAL(Ssid, SsidLen, pInBss->Ssid, pInBss->SsidLen) || bIsHiddenApIncluded)) + { + BSS_ENTRY *pOutBss = &OutTab->BssEntry[OutTab->BssNr]; - Reverse RF sleep-mode setup - ========================================================================== - */ -VOID RT30xxReverseRFSleepModeSetup( - IN PRTMP_ADAPTER pAd) -{ - UCHAR RFValue; - UINT32 MACValue; - - // RF_BLOCK_en, RF R1 register Bit 0 to 1 - RT30xxReadRFRegister(pAd, RF_R01, &RFValue); - RFValue |= 0x01; - RT30xxWriteRFRegister(pAd, RF_R01, RFValue); - - // VCO_IC, RF R7 register Bit 4 & Bit 5 to 1 - RT30xxReadRFRegister(pAd, RF_R07, &RFValue); - RFValue |= 0x30; - RT30xxWriteRFRegister(pAd, RF_R07, RFValue); - - // Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 1 - RT30xxReadRFRegister(pAd, RF_R09, &RFValue); - RFValue |= 0x0E; - RT30xxWriteRFRegister(pAd, RF_R09, RFValue); - - // RX_CTB_en, RF R21 register Bit 7 to 1 - RT30xxReadRFRegister(pAd, RF_R21, &RFValue); - RFValue |= 0x80; - RT30xxWriteRFRegister(pAd, RF_R21, RFValue); - - // LDORF_VC, RF R27 register Bit 2 to 0 - RT30xxReadRFRegister(pAd, RF_R27, &RFValue); - if ((pAd->MACVersion & 0xffff) < 0x0211) - RFValue = (RFValue & (~0x77)) | 0x3; - else - RFValue = (RFValue & (~0x77)); - RT30xxWriteRFRegister(pAd, RF_R27, RFValue); - // RT3071 version E has fixed this issue - if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211)) - { - // patch tx EVM issue temporarily - RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue); - MACValue = ((MACValue & 0xE0FFFFFF) | 0x0D000000); - RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue); + // 2.4G/5G N only mode + if ((pInBss->HtCapabilityLen == 0) && + ((pAd->CommonCfg.PhyMode == PHY_11N_2_4G) || (pAd->CommonCfg.PhyMode == PHY_11N_5G))) + { + DBGPRINT(RT_DEBUG_TRACE,("STA is in N-only Mode, this AP don't have Ht capability in Beacon.\n")); + continue; } - else +#ifdef RT2860 + if ((pAd->CommonCfg.PhyMode == PHY_11GN_MIXED) && + ((pInBss->SupRateLen + pInBss->ExtRateLen) < 12)) { - RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue); - MACValue = ((MACValue & 0xE0FFFFFF) | 0x01000000); - RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue); + DBGPRINT(RT_DEBUG_TRACE,("STA is in GN-only Mode, this AP is in B mode.\n")); + continue; } -} -#endif +#endif // RT2860 // + // New for WPA2 + // Check the Authmode first + if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) + { + // Check AuthMode and AuthModeAux for matching, in case AP support dual-mode + if ((pAd->StaCfg.AuthMode != pInBss->AuthMode) && (pAd->StaCfg.AuthMode != pInBss->AuthModeAux)) + // None matched + continue; -/* - ========================================================================== - Description: + // Check cipher suite, AP must have more secured cipher than station setting + if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) + { + // If it's not mixed mode, we should only let BSS pass with the same encryption + if (pInBss->WPA.bMixMode == FALSE) + if (pAd->StaCfg.WepStatus != pInBss->WPA.GroupCipher) + continue; - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL + // check group cipher + if ((pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) && + (pInBss->WPA.GroupCipher != Ndis802_11GroupWEP40Enabled) && + (pInBss->WPA.GroupCipher != Ndis802_11GroupWEP104Enabled)) + continue; - ========================================================================== - */ -VOID AsicSwitchChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel, - IN BOOLEAN bScan) -{ - ULONG R2 = 0, R3 = DEFAULT_RF_TX_POWER, R4 = 0; - CHAR TxPwer = 0, TxPwer2 = DEFAULT_RF_TX_POWER; //Bbp94 = BBPR94_DEFAULT, TxPwer2 = DEFAULT_RF_TX_POWER; - UCHAR index; - UINT32 Value = 0; //BbpReg, Value; - RTMP_RF_REGS *RFRegTable; - - // Search Tx power value - // We can't use ChannelList to search channel, since some central channl's txpowr doesn't list - // in ChannelList, so use TxPower array instead. + // check pairwise cipher, skip if none matched + // If profile set to AES, let it pass without question. + // If profile set to TKIP, we must find one mateched + if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && + (pAd->StaCfg.WepStatus != pInBss->WPA.PairCipher) && + (pAd->StaCfg.WepStatus != pInBss->WPA.PairCipherAux)) + continue; + } + else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) + { + // If it's not mixed mode, we should only let BSS pass with the same encryption + if (pInBss->WPA2.bMixMode == FALSE) + if (pAd->StaCfg.WepStatus != pInBss->WPA2.GroupCipher) + continue; + + // check group cipher + if ((pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) && + (pInBss->WPA2.GroupCipher != Ndis802_11GroupWEP40Enabled) && + (pInBss->WPA2.GroupCipher != Ndis802_11GroupWEP104Enabled)) + continue; + + // check pairwise cipher, skip if none matched + // If profile set to AES, let it pass without question. + // If profile set to TKIP, we must find one mateched + if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && + (pAd->StaCfg.WepStatus != pInBss->WPA2.PairCipher) && + (pAd->StaCfg.WepStatus != pInBss->WPA2.PairCipherAux)) + continue; + } + } + // Bss Type matched, SSID matched. + // We will check wepstatus for qualification Bss + else if (pAd->StaCfg.WepStatus != pInBss->WepStatus) + { + DBGPRINT(RT_DEBUG_TRACE,("StaCfg.WepStatus=%d, while pInBss->WepStatus=%d\n", pAd->StaCfg.WepStatus, pInBss->WepStatus)); + // + // For the SESv2 case, we will not qualify WepStatus. // - for (index = 0; index < MAX_NUM_OF_CHANNELS; index++) + if (!pInBss->bSES) + continue; + } + + // Since the AP is using hidden SSID, and we are trying to connect to ANY + // It definitely will fail. So, skip it. + // CCX also require not even try to connect it!! + if (SsidLen == 0) + continue; + + // If both station and AP use 40MHz, still need to check if the 40MHZ band's legality in my country region + // If this 40MHz wideband is not allowed in my country list, use bandwidth 20MHZ instead, + if ((pInBss->CentralChannel != pInBss->Channel) && + (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)) { - if (Channel == pAd->TxPower[index].Channel) + if (RTMPCheckChannel(pAd, pInBss->CentralChannel, pInBss->Channel) == FALSE) { - TxPwer = pAd->TxPower[index].Power; - TxPwer2 = pAd->TxPower[index].Power2; - break; + pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; + SetCommonHT(pAd); + pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40; + } + else + { + if (pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BAND_WIDTH_20) + { + SetCommonHT(pAd); + } } } - if (index == MAX_NUM_OF_CHANNELS) - DBGPRINT(RT_DEBUG_ERROR, ("AsicSwitchChannel: Can't find the Channel#%d \n", Channel)); + // copy matching BSS from InTab to OutTab + NdisMoveMemory(pOutBss, pInBss, sizeof(BSS_ENTRY)); + + OutTab->BssNr++; + } + else if ((pInBss->BssType == pAd->StaCfg.BssType) && (SsidLen == 0)) + { + BSS_ENTRY *pOutBss = &OutTab->BssEntry[OutTab->BssNr]; + + + // 2.4G/5G N only mode + if ((pInBss->HtCapabilityLen == 0) && + ((pAd->CommonCfg.PhyMode == PHY_11N_2_4G) || (pAd->CommonCfg.PhyMode == PHY_11N_5G))) + { + DBGPRINT(RT_DEBUG_TRACE,("STA is in N-only Mode, this AP don't have Ht capability in Beacon.\n")); + continue; + } +#ifdef RT2860 + if ((pAd->CommonCfg.PhyMode == PHY_11GN_MIXED) && + ((pInBss->SupRateLen + pInBss->ExtRateLen) < 12)) + { + DBGPRINT(RT_DEBUG_TRACE,("STA is in GN-only Mode, this AP is in B mode.\n")); + continue; + } +#endif // RT2860 // + // New for WPA2 + // Check the Authmode first + if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) + { + // Check AuthMode and AuthModeAux for matching, in case AP support dual-mode + if ((pAd->StaCfg.AuthMode != pInBss->AuthMode) && (pAd->StaCfg.AuthMode != pInBss->AuthModeAux)) + // None matched + continue; + + // Check cipher suite, AP must have more secured cipher than station setting + if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) + { + // If it's not mixed mode, we should only let BSS pass with the same encryption + if (pInBss->WPA.bMixMode == FALSE) + if (pAd->StaCfg.WepStatus != pInBss->WPA.GroupCipher) + continue; -#ifdef RT2870 - // The RF programming sequence is difference between 3xxx and 2xxx - if ((IS_RT3070(pAd) || IS_RT3090(pAd)) && ( - (pAd->RfIcType == RFIC_3022) || (pAd->RfIcType == RFIC_3021) || - (pAd->RfIcType == RFIC_3020) || (pAd->RfIcType == RFIC_2020))) - { - /* modify by WY for Read RF Reg. error */ - UCHAR RFValue; + // check group cipher + if (pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) + continue; - for (index = 0; index < NUM_OF_3020_CHNL; index++) - { - if (Channel == FreqItems3020[index].Channel) - { - // Programming channel parameters - RT30xxWriteRFRegister(pAd, RF_R02, FreqItems3020[index].N); - RT30xxWriteRFRegister(pAd, RF_R03, FreqItems3020[index].K); - - RT30xxReadRFRegister(pAd, RF_R06, &RFValue); - RFValue = (RFValue & 0xFC) | FreqItems3020[index].R; - RT30xxWriteRFRegister(pAd, RF_R06, RFValue); - - // Set Tx0 Power - RT30xxReadRFRegister(pAd, RF_R12, &RFValue); - RFValue = (RFValue & 0xE0) | TxPwer; - RT30xxWriteRFRegister(pAd, RF_R12, RFValue); - - // Set Tx1 Power - RT30xxReadRFRegister(pAd, RF_R13, &RFValue); - RFValue = (RFValue & 0xE0) | TxPwer2; - RT30xxWriteRFRegister(pAd, RF_R13, RFValue); - - // Tx/Rx Stream setting - RT30xxReadRFRegister(pAd, RF_R01, &RFValue); - //if (IS_RT3090(pAd)) - // RFValue |= 0x01; // Enable RF block. - RFValue &= 0x03; //clear bit[7~2] - if (pAd->Antenna.field.TxPath == 1) - RFValue |= 0xA0; - else if (pAd->Antenna.field.TxPath == 2) - RFValue |= 0x80; - if (pAd->Antenna.field.RxPath == 1) - RFValue |= 0x50; - else if (pAd->Antenna.field.RxPath == 2) - RFValue |= 0x40; - RT30xxWriteRFRegister(pAd, RF_R01, RFValue); - - // Set RF offset - RT30xxReadRFRegister(pAd, RF_R23, &RFValue); - RFValue = (RFValue & 0x80) | pAd->RfFreqOffset; - RT30xxWriteRFRegister(pAd, RF_R23, RFValue); - - // Set BW - if (!bScan && (pAd->CommonCfg.BBPCurrentBW == BW_40)) + // check pairwise cipher, skip if none matched + // If profile set to AES, let it pass without question. + // If profile set to TKIP, we must find one mateched + if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && + (pAd->StaCfg.WepStatus != pInBss->WPA.PairCipher) && + (pAd->StaCfg.WepStatus != pInBss->WPA.PairCipherAux)) + continue; + } + else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) { - RFValue = pAd->Mlme.CaliBW40RfR24; - //DISABLE_11N_CHECK(pAd); + // If it's not mixed mode, we should only let BSS pass with the same encryption + if (pInBss->WPA2.bMixMode == FALSE) + if (pAd->StaCfg.WepStatus != pInBss->WPA2.GroupCipher) + continue; + + // check group cipher + if (pAd->StaCfg.WepStatus < pInBss->WPA2.GroupCipher) + continue; + + // check pairwise cipher, skip if none matched + // If profile set to AES, let it pass without question. + // If profile set to TKIP, we must find one mateched + if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && + (pAd->StaCfg.WepStatus != pInBss->WPA2.PairCipher) && + (pAd->StaCfg.WepStatus != pInBss->WPA2.PairCipherAux)) + continue; } - else + } + // Bss Type matched, SSID matched. + // We will check wepstatus for qualification Bss + else if (pAd->StaCfg.WepStatus != pInBss->WepStatus) + continue; + + // If both station and AP use 40MHz, still need to check if the 40MHZ band's legality in my country region + // If this 40MHz wideband is not allowed in my country list, use bandwidth 20MHZ instead, + if ((pInBss->CentralChannel != pInBss->Channel) && + (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)) + { + if (RTMPCheckChannel(pAd, pInBss->CentralChannel, pInBss->Channel) == FALSE) { - RFValue = pAd->Mlme.CaliBW20RfR24; + pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; + SetCommonHT(pAd); + pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40; } - RT30xxWriteRFRegister(pAd, RF_R24, RFValue); - RT30xxWriteRFRegister(pAd, RF_R31, RFValue); - - // Enable RF tuning - RT30xxReadRFRegister(pAd, RF_R07, &RFValue); - RFValue = RFValue | 0x1; - RT30xxWriteRFRegister(pAd, RF_R07, RFValue); - - // latch channel for future usage. - pAd->LatchRfRegs.Channel = Channel; - - DBGPRINT(RT_DEBUG_TRACE, ("SwitchChannel#%d(RF=%d, Pwr0=%d, Pwr1=%d, %dT), N=0x%02X, K=0x%02X, R=0x%02X\n", - Channel, - pAd->RfIcType, - TxPwer, - TxPwer2, - pAd->Antenna.field.TxPath, - FreqItems3020[index].N, - FreqItems3020[index].K, - FreqItems3020[index].R)); + } + + // copy matching BSS from InTab to OutTab + NdisMoveMemory(pOutBss, pInBss, sizeof(BSS_ENTRY)); + + OutTab->BssNr++; + } + + if (OutTab->BssNr >= MAX_LEN_OF_BSS_TABLE) break; } - } - DBGPRINT(RT_DEBUG_TRACE, ("SwitchChannel#%d(RF=%d, Pwr0=%d, Pwr1=%d, %dT), N=0x%02X, K=0x%02X, R=0x%02X\n", - Channel, - pAd->RfIcType, - TxPwer, - TxPwer2, - pAd->Antenna.field.TxPath, - FreqItems3020[index].N, - FreqItems3020[index].K, - FreqItems3020[index].R)); - } - else -#endif // RT2870 // - { - RFRegTable = RF2850RegTable; + BssTableSortByRssi(OutTab); +} - switch (pAd->RfIcType) - { - case RFIC_2820: - case RFIC_2850: - case RFIC_2720: - case RFIC_2750: - for (index = 0; index < NUM_OF_2850_CHNL; index++) +// IRQL = DISPATCH_LEVEL +VOID BssTableSortByRssi( + IN OUT BSS_TABLE *OutTab) +{ + INT i, j; + BSS_ENTRY TmpBss; + + for (i = 0; i < OutTab->BssNr - 1; i++) { - if (Channel == RFRegTable[index].Channel) + for (j = i+1; j < OutTab->BssNr; j++) { - R2 = RFRegTable[index].R2; - if (pAd->Antenna.field.TxPath == 1) + if (OutTab->BssEntry[j].Rssi > OutTab->BssEntry[i].Rssi) { - R2 |= 0x4000; // If TXpath is 1, bit 14 = 1; + NdisMoveMemory(&TmpBss, &OutTab->BssEntry[j], sizeof(BSS_ENTRY)); + NdisMoveMemory(&OutTab->BssEntry[j], &OutTab->BssEntry[i], sizeof(BSS_ENTRY)); + NdisMoveMemory(&OutTab->BssEntry[i], &TmpBss, sizeof(BSS_ENTRY)); } - - if (pAd->Antenna.field.RxPath == 2) - { - R2 |= 0x40; // write 1 to off Rxpath. } - else if (pAd->Antenna.field.RxPath == 1) - { - R2 |= 0x20040; // write 1 to off RxPath } +} - if (Channel > 14) - { - // initialize R3, R4 - R3 = (RFRegTable[index].R3 & 0xffffc1ff); - R4 = (RFRegTable[index].R4 & (~0x001f87c0)) | (pAd->RfFreqOffset << 15); - // 5G band power range: 0xF9~0X0F, TX0 Reg3 bit9/TX1 Reg4 bit6="0" means the TX power reduce 7dB - // R3 - if ((TxPwer >= -7) && (TxPwer < 0)) - { - TxPwer = (7+TxPwer); - TxPwer = (TxPwer > 0xF) ? (0xF) : (TxPwer); - R3 |= (TxPwer << 10); - DBGPRINT(RT_DEBUG_ERROR, ("AsicSwitchChannel: TxPwer=%d \n", TxPwer)); - } - else - { - TxPwer = (TxPwer > 0xF) ? (0xF) : (TxPwer); - R3 |= (TxPwer << 10) | (1 << 9); - } +VOID BssCipherParse( + IN OUT PBSS_ENTRY pBss) +{ + PEID_STRUCT pEid; + PUCHAR pTmp; + PRSN_IE_HEADER_STRUCT pRsnHeader; + PCIPHER_SUITE_STRUCT pCipher; + PAKM_SUITE_STRUCT pAKM; + USHORT Count; + INT Length; + NDIS_802_11_ENCRYPTION_STATUS TmpCipher; - // R4 - if ((TxPwer2 >= -7) && (TxPwer2 < 0)) - { - TxPwer2 = (7+TxPwer2); - TxPwer2 = (TxPwer2 > 0xF) ? (0xF) : (TxPwer2); - R4 |= (TxPwer2 << 7); - DBGPRINT(RT_DEBUG_ERROR, ("AsicSwitchChannel: TxPwer2=%d \n", TxPwer2)); - } - else + // + // WepStatus will be reset later, if AP announce TKIP or AES on the beacon frame. + // + if (pBss->Privacy) { - TxPwer2 = (TxPwer2 > 0xF) ? (0xF) : (TxPwer2); - R4 |= (TxPwer2 << 7) | (1 << 6); - } + pBss->WepStatus = Ndis802_11WEPEnabled; } else { - R3 = (RFRegTable[index].R3 & 0xffffc1ff) | (TxPwer << 9); // set TX power0 - R4 = (RFRegTable[index].R4 & (~0x001f87c0)) | (pAd->RfFreqOffset << 15) | (TxPwer2 <<6);// Set freq Offset & TxPwr1 - } - - // Based on BBP current mode before changing RF channel. - if (!bScan && (pAd->CommonCfg.BBPCurrentBW == BW_40)) - { - R4 |=0x200000; + pBss->WepStatus = Ndis802_11WEPDisabled; } + // Set default to disable & open authentication before parsing variable IE + pBss->AuthMode = Ndis802_11AuthModeOpen; + pBss->AuthModeAux = Ndis802_11AuthModeOpen; - // Update variables - pAd->LatchRfRegs.Channel = Channel; - pAd->LatchRfRegs.R1 = RFRegTable[index].R1; - pAd->LatchRfRegs.R2 = R2; - pAd->LatchRfRegs.R3 = R3; - pAd->LatchRfRegs.R4 = R4; - - // Set RF value 1's set R3[bit2] = [0] - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R1); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R2); - RTMP_RF_IO_WRITE32(pAd, (pAd->LatchRfRegs.R3 & (~0x04))); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R4); - - RTMPusecDelay(200); - - // Set RF value 2's set R3[bit2] = [1] - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R1); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R2); - RTMP_RF_IO_WRITE32(pAd, (pAd->LatchRfRegs.R3 | 0x04)); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R4); - - RTMPusecDelay(200); - - // Set RF value 3's set R3[bit2] = [0] - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R1); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R2); - RTMP_RF_IO_WRITE32(pAd, (pAd->LatchRfRegs.R3 & (~0x04))); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R4); - - break; - } - } - break; + // Init WPA setting + pBss->WPA.PairCipher = Ndis802_11WEPDisabled; + pBss->WPA.PairCipherAux = Ndis802_11WEPDisabled; + pBss->WPA.GroupCipher = Ndis802_11WEPDisabled; + pBss->WPA.RsnCapability = 0; + pBss->WPA.bMixMode = FALSE; - default: - break; - } - } + // Init WPA2 setting + pBss->WPA2.PairCipher = Ndis802_11WEPDisabled; + pBss->WPA2.PairCipherAux = Ndis802_11WEPDisabled; + pBss->WPA2.GroupCipher = Ndis802_11WEPDisabled; + pBss->WPA2.RsnCapability = 0; + pBss->WPA2.bMixMode = FALSE; - // Change BBP setting during siwtch from a->g, g->a - if (Channel <= 14) - { - ULONG TxPinCfg = 0x00050F0A;//Gary 2007/08/09 0x050A0A - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R62, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R63, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R64, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R86, 0);//(0x44 - GET_LNA_GAIN(pAd))); // According the Rory's suggestion to solve the middle range issue. - //RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0x62); + Length = (INT) pBss->VarIELen; - // Rx High power VGA offset for LNA select - if (pAd->NicConfig2.field.ExternalLNAForG) + while (Length > 0) { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0x62); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x46); - } - else + // Parse cipher suite base on WPA1 & WPA2, they should be parsed differently + pTmp = ((PUCHAR) pBss->VarIEs) + pBss->VarIELen - Length; + pEid = (PEID_STRUCT) pTmp; + switch (pEid->Eid) { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0x84); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x50); - } - - // 5G band selection PIN, bit1 and bit2 are complement - RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value); - Value &= (~0x6); - Value |= (0x04); - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); - - // Turn off unused PA or LNA when only 1T or 1R - if (pAd->Antenna.field.TxPath == 1) + case IE_WPA: + if (NdisEqualMemory(pEid->Octet, SES_OUI, 3) && (pEid->Len == 7)) { - TxPinCfg &= 0xFFFFFFF3; + pBss->bSES = TRUE; + break; } - if (pAd->Antenna.field.RxPath == 1) + else if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4) != 1) { - TxPinCfg &= 0xFFFFF3FF; + // if unsupported vendor specific IE + break; } + // Skip OUI, version, and multicast suite + // This part should be improved in the future when AP supported multiple cipher suite. + // For now, it's OK since almost all APs have fixed cipher suite supported. + // pTmp = (PUCHAR) pEid->Octet; + pTmp += 11; - RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg); - } - else + // Cipher Suite Selectors from Spec P802.11i/D3.2 P26. + // Value Meaning + // 0 None + // 1 WEP-40 + // 2 Tkip + // 3 WRAP + // 4 AES + // 5 WEP-104 + // Parse group cipher + switch (*pTmp) { - ULONG TxPinCfg = 0x00050F05;//Gary 2007/8/9 0x050505 - - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R62, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R63, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R64, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R86, 0);//(0x44 - GET_LNA_GAIN(pAd))); // According the Rory's suggestion to solve the middle range issue. - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0xF2); - - // Rx High power VGA offset for LNA select - if (pAd->NicConfig2.field.ExternalLNAForA) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x46); - } - else - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x50); - } + case 1: + pBss->WPA.GroupCipher = Ndis802_11GroupWEP40Enabled; + break; + case 5: + pBss->WPA.GroupCipher = Ndis802_11GroupWEP104Enabled; + break; + case 2: + pBss->WPA.GroupCipher = Ndis802_11Encryption2Enabled; + break; + case 4: + pBss->WPA.GroupCipher = Ndis802_11Encryption3Enabled; + break; + default: + break; + } + // number of unicast suite + pTmp += 1; - // 5G band selection PIN, bit1 and bit2 are complement - RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value); - Value &= (~0x6); - Value |= (0x02); - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); + // skip all unicast cipher suites + //Count = *(PUSHORT) pTmp; + Count = (pTmp[1]<<8) + pTmp[0]; + pTmp += sizeof(USHORT); - // Turn off unused PA or LNA when only 1T or 1R - if (pAd->Antenna.field.TxPath == 1) - { - TxPinCfg &= 0xFFFFFFF3; - } - if (pAd->Antenna.field.RxPath == 1) + // Parsing all unicast cipher suite + while (Count > 0) { - TxPinCfg &= 0xFFFFF3FF; - } - - RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg); - } - - // R66 should be set according to Channel and use 20MHz when scanning - //RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, (0x2E + GET_LNA_GAIN(pAd))); - if (bScan) - RTMPSetAGCInitValue(pAd, BW_20); - else - RTMPSetAGCInitValue(pAd, pAd->CommonCfg.BBPCurrentBW); - - // - // On 11A, We should delay and wait RF/BBP to be stable - // and the appropriate time should be 1000 micro seconds - // 2005/06/05 - On 11G, We also need this delay time. Otherwise it's difficult to pass the WHQL. - // - RTMPusecDelay(1000); - - DBGPRINT(RT_DEBUG_TRACE, ("SwitchChannel#%d(RF=%d, Pwr0=%lu, Pwr1=%lu, %dT) to , R1=0x%08lx, R2=0x%08lx, R3=0x%08lx, R4=0x%08lx\n", - Channel, - pAd->RfIcType, - (R3 & 0x00003e00) >> 9, - (R4 & 0x000007c0) >> 6, - pAd->Antenna.field.TxPath, - pAd->LatchRfRegs.R1, - pAd->LatchRfRegs.R2, - pAd->LatchRfRegs.R3, - pAd->LatchRfRegs.R4)); -} - -/* - ========================================================================== - Description: - This function is required for 2421 only, and should not be used during - site survey. It's only required after NIC decided to stay at a channel - for a longer period. - When this function is called, it's always after AsicSwitchChannel(). - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicLockChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel) -{ -} - -VOID AsicRfTuningExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ -} - -/* - ========================================================================== - Description: - Gives CCK TX rate 2 more dB TX power. - This routine works only in LINK UP in INFRASTRUCTURE mode. - - calculate desired Tx power in RF R3.Tx0~5, should consider - - 0. if current radio is a noisy environment (pAd->DrsCounters.fNoisyEnvironment) - 1. TxPowerPercentage - 2. auto calibration based on TSSI feedback - 3. extra 2 db for CCK - 4. -10 db upon very-short distance (AvgRSSI >= -40db) to AP - - NOTE: Since this routine requires the value of (pAd->DrsCounters.fNoisyEnvironment), - it should be called AFTER MlmeDynamicTxRatSwitching() - ========================================================================== - */ -VOID AsicAdjustTxPower( - IN PRTMP_ADAPTER pAd) -{ - INT i, j; - CHAR DeltaPwr = 0; - BOOLEAN bAutoTxAgc = FALSE; - UCHAR TssiRef, *pTssiMinusBoundary, *pTssiPlusBoundary, TxAgcStep; - UCHAR BbpR1 = 0, BbpR49 = 0, idx; - PCHAR pTxAgcCompensate; - ULONG TxPwr[5]; - CHAR Value; - -#ifdef RT2860 - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) - || (pAd->bPCIclkOff == TRUE) - || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF) - || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - return; -#endif - - if (pAd->CommonCfg.BBPCurrentBW == BW_40) - { - if (pAd->CommonCfg.CentralChannel > 14) + // Skip OUI + pTmp += 3; + TmpCipher = Ndis802_11WEPDisabled; + switch (*pTmp) { - TxPwr[0] = pAd->Tx40MPwrCfgABand[0]; - TxPwr[1] = pAd->Tx40MPwrCfgABand[1]; - TxPwr[2] = pAd->Tx40MPwrCfgABand[2]; - TxPwr[3] = pAd->Tx40MPwrCfgABand[3]; - TxPwr[4] = pAd->Tx40MPwrCfgABand[4]; + case 1: + case 5: // Although WEP is not allowed in WPA related auth mode, we parse it anyway + TmpCipher = Ndis802_11Encryption1Enabled; + break; + case 2: + TmpCipher = Ndis802_11Encryption2Enabled; + break; + case 4: + TmpCipher = Ndis802_11Encryption3Enabled; + break; + default: + break; } - else + if (TmpCipher > pBss->WPA.PairCipher) { - TxPwr[0] = pAd->Tx40MPwrCfgGBand[0]; - TxPwr[1] = pAd->Tx40MPwrCfgGBand[1]; - TxPwr[2] = pAd->Tx40MPwrCfgGBand[2]; - TxPwr[3] = pAd->Tx40MPwrCfgGBand[3]; - TxPwr[4] = pAd->Tx40MPwrCfgGBand[4]; - } + // Move the lower cipher suite to PairCipherAux + pBss->WPA.PairCipherAux = pBss->WPA.PairCipher; + pBss->WPA.PairCipher = TmpCipher; } - else - { - if (pAd->CommonCfg.Channel > 14) - { - TxPwr[0] = pAd->Tx20MPwrCfgABand[0]; - TxPwr[1] = pAd->Tx20MPwrCfgABand[1]; - TxPwr[2] = pAd->Tx20MPwrCfgABand[2]; - TxPwr[3] = pAd->Tx20MPwrCfgABand[3]; - TxPwr[4] = pAd->Tx20MPwrCfgABand[4]; - } - else + else { - TxPwr[0] = pAd->Tx20MPwrCfgGBand[0]; - TxPwr[1] = pAd->Tx20MPwrCfgGBand[1]; - TxPwr[2] = pAd->Tx20MPwrCfgGBand[2]; - TxPwr[3] = pAd->Tx20MPwrCfgGBand[3]; - TxPwr[4] = pAd->Tx20MPwrCfgGBand[4]; - } + pBss->WPA.PairCipherAux = TmpCipher; + } + pTmp++; + Count--; } - // TX power compensation for temperature variation based on TSSI. try every 4 second - if (pAd->Mlme.OneSecPeriodicRound % 4 == 0) - { - if (pAd->CommonCfg.Channel <= 14) + // 4. get AKM suite counts + //Count = *(PUSHORT) pTmp; + Count = (pTmp[1]<<8) + pTmp[0]; + pTmp += sizeof(USHORT); + pTmp += 3; + + switch (*pTmp) { - /* bg channel */ - bAutoTxAgc = pAd->bAutoTxAgcG; - TssiRef = pAd->TssiRefG; - pTssiMinusBoundary = &pAd->TssiMinusBoundaryG[0]; - pTssiPlusBoundary = &pAd->TssiPlusBoundaryG[0]; - TxAgcStep = pAd->TxAgcStepG; - pTxAgcCompensate = &pAd->TxAgcCompensateG; - } + case 1: + // Set AP support WPA-enterprise mode + if (pBss->AuthMode == Ndis802_11AuthModeOpen) + pBss->AuthMode = Ndis802_11AuthModeWPA; + else + pBss->AuthModeAux = Ndis802_11AuthModeWPA; + break; + case 2: + // Set AP support WPA-PSK mode + if (pBss->AuthMode == Ndis802_11AuthModeOpen) + pBss->AuthMode = Ndis802_11AuthModeWPAPSK; else + pBss->AuthModeAux = Ndis802_11AuthModeWPAPSK; + break; + default: + break; + } + pTmp += 1; + + // Fixed for WPA-None + if (pBss->BssType == BSS_ADHOC) { - /* a channel */ - bAutoTxAgc = pAd->bAutoTxAgcA; - TssiRef = pAd->TssiRefA; - pTssiMinusBoundary = &pAd->TssiMinusBoundaryA[0]; - pTssiPlusBoundary = &pAd->TssiPlusBoundaryA[0]; - TxAgcStep = pAd->TxAgcStepA; - pTxAgcCompensate = &pAd->TxAgcCompensateA; + pBss->AuthMode = Ndis802_11AuthModeWPANone; + pBss->AuthModeAux = Ndis802_11AuthModeWPANone; + pBss->WepStatus = pBss->WPA.GroupCipher; + // Patched bugs for old driver + if (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled) + pBss->WPA.PairCipherAux = pBss->WPA.GroupCipher; } + else + pBss->WepStatus = pBss->WPA.PairCipher; - if (bAutoTxAgc) - { - /* BbpR1 is unsigned char */ - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R49, &BbpR49); + // Check the Pair & Group, if different, turn on mixed mode flag + if (pBss->WPA.GroupCipher != pBss->WPA.PairCipher) + pBss->WPA.bMixMode = TRUE; - /* (p) TssiPlusBoundaryG[0] = 0 = (m) TssiMinusBoundaryG[0] */ - /* compensate: +4 +3 +2 +1 0 -1 -2 -3 -4 * steps */ - /* step value is defined in pAd->TxAgcStepG for tx power value */ + break; - /* [4]+1+[4] p4 p3 p2 p1 o1 m1 m2 m3 m4 */ - /* ex: 0x00 0x15 0x25 0x45 0x88 0xA0 0xB5 0xD0 0xF0 - above value are examined in mass factory production */ - /* [4] [3] [2] [1] [0] [1] [2] [3] [4] */ + case IE_RSN: + pRsnHeader = (PRSN_IE_HEADER_STRUCT) pTmp; - /* plus (+) is 0x00 ~ 0x45, minus (-) is 0xa0 ~ 0xf0 */ - /* if value is between p1 ~ o1 or o1 ~ s1, no need to adjust tx power */ - /* if value is 0xa5, tx power will be -= TxAgcStep*(2-1) */ + // 0. Version must be 1 + if (le2cpu16(pRsnHeader->Version) != 1) + break; + pTmp += sizeof(RSN_IE_HEADER_STRUCT); - if (BbpR49 > pTssiMinusBoundary[1]) - { - // Reading is larger than the reference value - // check for how large we need to decrease the Tx power - for (idx = 1; idx < 5; idx++) - { - if (BbpR49 <= pTssiMinusBoundary[idx]) // Found the range + // 1. Check group cipher + pCipher = (PCIPHER_SUITE_STRUCT) pTmp; + if (!RTMPEqualMemory(pTmp, RSN_OUI, 3)) break; - } - // The index is the step we should decrease, idx = 0 means there is nothing to compensate - *pTxAgcCompensate = -(TxAgcStep * (idx-1)); - DeltaPwr += (*pTxAgcCompensate); - DBGPRINT(RT_DEBUG_TRACE, ("-- Tx Power, BBP R1=%x, TssiRef=%x, TxAgcStep=%x, step = -%d\n", - BbpR49, TssiRef, TxAgcStep, idx-1)); - } - else if (BbpR49 < pTssiPlusBoundary[1]) - { - // Reading is smaller than the reference value - // check for how large we need to increase the Tx power - for (idx = 1; idx < 5; idx++) + // Parse group cipher + switch (pCipher->Type) { - if (BbpR49 >= pTssiPlusBoundary[idx]) // Found the range + case 1: + pBss->WPA2.GroupCipher = Ndis802_11GroupWEP40Enabled; + break; + case 5: + pBss->WPA2.GroupCipher = Ndis802_11GroupWEP104Enabled; + break; + case 2: + pBss->WPA2.GroupCipher = Ndis802_11Encryption2Enabled; + break; + case 4: + pBss->WPA2.GroupCipher = Ndis802_11Encryption3Enabled; + break; + default: break; } - // The index is the step we should increase, idx = 0 means there is nothing to compensate - *pTxAgcCompensate = TxAgcStep * (idx-1); - DeltaPwr += (*pTxAgcCompensate); - DBGPRINT(RT_DEBUG_TRACE, ("++ Tx Power, BBP R1=%x, TssiRef=%x, TxAgcStep=%x, step = +%d\n", - BbpR49, TssiRef, TxAgcStep, idx-1)); - } - else - { - *pTxAgcCompensate = 0; - DBGPRINT(RT_DEBUG_TRACE, (" Tx Power, BBP R49=%x, TssiRef=%x, TxAgcStep=%x, step = +%d\n", - BbpR49, TssiRef, TxAgcStep, 0)); - } - } - } - else - { - if (pAd->CommonCfg.Channel <= 14) - { - bAutoTxAgc = pAd->bAutoTxAgcG; - pTxAgcCompensate = &pAd->TxAgcCompensateG; - } - else - { - bAutoTxAgc = pAd->bAutoTxAgcA; - pTxAgcCompensate = &pAd->TxAgcCompensateA; - } - - if (bAutoTxAgc) - DeltaPwr += (*pTxAgcCompensate); - } + // set to correct offset for next parsing + pTmp += sizeof(CIPHER_SUITE_STRUCT); - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &BbpR1); - BbpR1 &= 0xFC; + // 2. Get pairwise cipher counts + //Count = *(PUSHORT) pTmp; + Count = (pTmp[1]<<8) + pTmp[0]; + pTmp += sizeof(USHORT); - /* calculate delta power based on the percentage specified from UI */ - // E2PROM setting is calibrated for maximum TX power (i.e. 100%) - // We lower TX power here according to the percentage specified from UI - if (pAd->CommonCfg.TxPowerPercentage == 0xffffffff) // AUTO TX POWER control - ; - else if (pAd->CommonCfg.TxPowerPercentage > 90) // 91 ~ 100% & AUTO, treat as 100% in terms of mW - ; - else if (pAd->CommonCfg.TxPowerPercentage > 60) // 61 ~ 90%, treat as 75% in terms of mW // DeltaPwr -= 1; + // 3. Get pairwise cipher + // Parsing all unicast cipher suite + while (Count > 0) { - DeltaPwr -= 1; - } - else if (pAd->CommonCfg.TxPowerPercentage > 30) // 31 ~ 60%, treat as 50% in terms of mW // DeltaPwr -= 3; + // Skip OUI + pCipher = (PCIPHER_SUITE_STRUCT) pTmp; + TmpCipher = Ndis802_11WEPDisabled; + switch (pCipher->Type) { - DeltaPwr -= 3; + case 1: + case 5: // Although WEP is not allowed in WPA related auth mode, we parse it anyway + TmpCipher = Ndis802_11Encryption1Enabled; + break; + case 2: + TmpCipher = Ndis802_11Encryption2Enabled; + break; + case 4: + TmpCipher = Ndis802_11Encryption3Enabled; + break; + default: + break; } - else if (pAd->CommonCfg.TxPowerPercentage > 15) // 16 ~ 30%, treat as 25% in terms of mW // DeltaPwr -= 6; + if (TmpCipher > pBss->WPA2.PairCipher) { - BbpR1 |= 0x01; + // Move the lower cipher suite to PairCipherAux + pBss->WPA2.PairCipherAux = pBss->WPA2.PairCipher; + pBss->WPA2.PairCipher = TmpCipher; } - else if (pAd->CommonCfg.TxPowerPercentage > 9) // 10 ~ 15%, treat as 12.5% in terms of mW // DeltaPwr -= 9; + else { - BbpR1 |= 0x01; - DeltaPwr -= 3; + pBss->WPA2.PairCipherAux = TmpCipher; } - else // 0 ~ 9 %, treat as MIN(~3%) in terms of mW // DeltaPwr -= 12; - { - BbpR1 |= 0x02; + pTmp += sizeof(CIPHER_SUITE_STRUCT); + Count--; } - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R1, BbpR1); + // 4. get AKM suite counts + //Count = *(PUSHORT) pTmp; + Count = (pTmp[1]<<8) + pTmp[0]; + pTmp += sizeof(USHORT); - /* reset different new tx power for different TX rate */ - for(i=0; i<5; i++) - { - if (TxPwr[i] != 0xffffffff) - { - for (j=0; j<8; j++) + // 5. Get AKM ciphers + // Parsing all AKM ciphers + while (Count > 0) { - Value = (CHAR)((TxPwr[i] >> j*4) & 0x0F); /* 0 ~ 15 */ + pAKM = (PAKM_SUITE_STRUCT) pTmp; + if (!RTMPEqualMemory(pTmp, RSN_OUI, 3)) + break; - if ((Value + DeltaPwr) < 0) - { - Value = 0; /* min */ - } - else if ((Value + DeltaPwr) > 0xF) + switch (pAKM->Type) { - Value = 0xF; /* max */ - } + case 1: + // Set AP support WPA-enterprise mode + if (pBss->AuthMode == Ndis802_11AuthModeOpen) + pBss->AuthMode = Ndis802_11AuthModeWPA2; else - { - Value += DeltaPwr; /* temperature compensation */ + pBss->AuthModeAux = Ndis802_11AuthModeWPA2; + break; + case 2: + // Set AP support WPA-PSK mode + if (pBss->AuthMode == Ndis802_11AuthModeOpen) + pBss->AuthMode = Ndis802_11AuthModeWPA2PSK; + else + pBss->AuthModeAux = Ndis802_11AuthModeWPA2PSK; + break; + default: + if (pBss->AuthMode == Ndis802_11AuthModeOpen) + pBss->AuthMode = Ndis802_11AuthModeMax; + else + pBss->AuthModeAux = Ndis802_11AuthModeMax; + break; } - - /* fill new value to CSR offset */ - TxPwr[i] = (TxPwr[i] & ~(0x0000000F << j*4)) | (Value << j*4); + pTmp += (Count * sizeof(AKM_SUITE_STRUCT)); + Count--; } - /* write tx power value to CSR */ - /* TX_PWR_CFG_0 (8 tx rate) for TX power for OFDM 12M/18M - TX power for OFDM 6M/9M - TX power for CCK5.5M/11M - TX power for CCK1M/2M */ - /* TX_PWR_CFG_1 ~ TX_PWR_CFG_4 */ - RTMP_IO_WRITE32(pAd, TX_PWR_CFG_0 + i*4, TxPwr[i]); - } + // Fixed for WPA-None + if (pBss->BssType == BSS_ADHOC) + { + pBss->AuthMode = Ndis802_11AuthModeWPANone; + pBss->AuthModeAux = Ndis802_11AuthModeWPANone; + pBss->WPA.PairCipherAux = pBss->WPA2.PairCipherAux; + pBss->WPA.GroupCipher = pBss->WPA2.GroupCipher; + pBss->WepStatus = pBss->WPA.GroupCipher; + // Patched bugs for old driver + if (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled) + pBss->WPA.PairCipherAux = pBss->WPA.GroupCipher; } + pBss->WepStatus = pBss->WPA2.PairCipher; -} - -/* - ========================================================================== - Description: - put PHY to sleep here, and set next wakeup timer. PHY doesn't not wakeup - automatically. Instead, MCU will issue a TwakeUpInterrupt to host after - the wakeup timer timeout. Driver has to issue a separate command to wake - PHY up. - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicSleepThenAutoWakeup( - IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp) -{ - RT28XX_STA_SLEEP_THEN_AUTO_WAKEUP(pAd, TbttNumToNextWakeUp); -} - -/* - ========================================================================== - Description: - AsicForceWakeup() is used whenever manual wakeup is required - AsicForceSleep() should only be used when not in INFRA BSS. When - in INFRA BSS, we should use AsicSleepThenAutoWakeup() instead. - ========================================================================== - */ -VOID AsicForceSleep( - IN PRTMP_ADAPTER pAd) -{ - -} - -/* - ========================================================================== - Description: - AsicForceWakeup() is used whenever Twakeup timer (set via AsicSleepThenAutoWakeup) - expired. - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - ========================================================================== - */ -VOID AsicForceWakeup( - IN PRTMP_ADAPTER pAd, -#ifdef RT2860 - IN UCHAR Level) -#endif -#ifdef RT2870 - IN BOOLEAN bFromTx) -#endif -{ - DBGPRINT(RT_DEBUG_TRACE, ("--> AsicForceWakeup \n")); -#ifdef RT2860 - RT28XX_STA_FORCE_WAKEUP(pAd, Level); -#endif -#ifdef RT2870 - RT28XX_STA_FORCE_WAKEUP(pAd, bFromTx); -#endif -} - -/* - ========================================================================== - Description: - Set My BSSID - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicSetBssid( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pBssid) -{ - ULONG Addr4; - DBGPRINT(RT_DEBUG_TRACE, ("==============> AsicSetBssid %x:%x:%x:%x:%x:%x\n", - pBssid[0],pBssid[1],pBssid[2],pBssid[3], pBssid[4],pBssid[5])); - - Addr4 = (ULONG)(pBssid[0]) | - (ULONG)(pBssid[1] << 8) | - (ULONG)(pBssid[2] << 16) | - (ULONG)(pBssid[3] << 24); - RTMP_IO_WRITE32(pAd, MAC_BSSID_DW0, Addr4); - - Addr4 = 0; - // always one BSSID in STA mode - Addr4 = (ULONG)(pBssid[4]) | (ULONG)(pBssid[5] << 8); - - RTMP_IO_WRITE32(pAd, MAC_BSSID_DW1, Addr4); -} - -VOID AsicSetMcastWC( - IN PRTMP_ADAPTER pAd) -{ - MAC_TABLE_ENTRY *pEntry = &pAd->MacTab.Content[MCAST_WCID]; - USHORT offset; - - pEntry->Sst = SST_ASSOC; - pEntry->Aid = MCAST_WCID; // Softap supports 1 BSSID and use WCID=0 as multicast Wcid index - pEntry->PsMode = PWR_ACTIVE; - pEntry->CurrTxRate = pAd->CommonCfg.MlmeRate; - offset = MAC_WCID_BASE + BSS0Mcast_WCID * HW_WCID_ENTRY_SIZE; -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicDelWcidTab( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid) -{ - ULONG Addr0 = 0x0, Addr1 = 0x0; - ULONG offset; - - DBGPRINT(RT_DEBUG_TRACE, ("AsicDelWcidTab==>Wcid = 0x%x\n",Wcid)); - offset = MAC_WCID_BASE + Wcid * HW_WCID_ENTRY_SIZE; - RTMP_IO_WRITE32(pAd, offset, Addr0); - offset += 4; - RTMP_IO_WRITE32(pAd, offset, Addr1); -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicEnableRDG( - IN PRTMP_ADAPTER pAd) -{ - TX_LINK_CFG_STRUC TxLinkCfg; - UINT32 Data = 0; - - RTMP_IO_READ32(pAd, TX_LINK_CFG, &TxLinkCfg.word); - TxLinkCfg.field.TxRDGEn = 1; - RTMP_IO_WRITE32(pAd, TX_LINK_CFG, TxLinkCfg.word); - - RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &Data); - Data &= 0xFFFFFF00; - Data |= 0x80; - RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Data); + // 6. Get RSN capability + //pBss->WPA2.RsnCapability = *(PUSHORT) pTmp; + pBss->WPA2.RsnCapability = (pTmp[1]<<8) + pTmp[0]; + pTmp += sizeof(USHORT); - //OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); -} + // Check the Pair & Group, if different, turn on mixed mode flag + if (pBss->WPA2.GroupCipher != pBss->WPA2.PairCipher) + pBss->WPA2.bMixMode = TRUE; -/* - ========================================================================== - Description: + break; + default: + break; + } + Length -= (pEid->Len + 2); + } +} - IRQL = DISPATCH_LEVEL +// =========================================================================================== +// mac_table.c +// =========================================================================================== - ========================================================================== +/*! \brief generates a random mac address value for IBSS BSSID + * \param Addr the bssid location + * \return none + * \pre + * \post */ -VOID AsicDisableRDG( - IN PRTMP_ADAPTER pAd) +VOID MacAddrRandomBssid( + IN PRTMP_ADAPTER pAd, + OUT PUCHAR pAddr) { - TX_LINK_CFG_STRUC TxLinkCfg; - UINT32 Data = 0; - - - RTMP_IO_READ32(pAd, TX_LINK_CFG, &TxLinkCfg.word); - TxLinkCfg.field.TxRDGEn = 0; - RTMP_IO_WRITE32(pAd, TX_LINK_CFG, TxLinkCfg.word); - - RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &Data); + INT i; - Data &= 0xFFFFFF00; - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_DYNAMIC_BE_TXOP_ACTIVE) - && (pAd->MacTab.fAnyStationMIMOPSDynamic == FALSE) - ) + for (i = 0; i < MAC_ADDR_LEN; i++) { - // For CWC test, change txop from 0x30 to 0x20 in TxBurst mode - if (pAd->CommonCfg.bEnableTxBurst) - Data |= 0x20; + pAddr[i] = RandomByte(pAd); } - RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Data); + + pAddr[0] = (pAddr[0] & 0xfe) | 0x02; // the first 2 bits must be 01xxxxxxxx } -/* - ========================================================================== - Description: +/*! \brief init the management mac frame header + * \param p_hdr mac header + * \param subtype subtype of the frame + * \param p_ds destination address, don't care if it is a broadcast address + * \return none + * \pre the station has the following information in the pAd->StaCfg + * - bssid + * - station address + * \post + * \note this function initializes the following field IRQL = PASSIVE_LEVEL IRQL = DISPATCH_LEVEL - ========================================================================== */ -VOID AsicDisableSync( - IN PRTMP_ADAPTER pAd) +VOID MgtMacHeaderInit( + IN PRTMP_ADAPTER pAd, + IN OUT PHEADER_802_11 pHdr80211, + IN UCHAR SubType, + IN UCHAR ToDs, + IN PUCHAR pDA, + IN PUCHAR pBssid) { - BCN_TIME_CFG_STRUC csr; - - DBGPRINT(RT_DEBUG_TRACE, ("--->Disable TSF synchronization\n")); - - // 2003-12-20 disable TSF and TBTT while NIC in power-saving have side effect - // that NIC will never wakes up because TSF stops and no more - // TBTT interrupts - pAd->TbttTickCount = 0; - RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr.word); - csr.field.bBeaconGen = 0; - csr.field.bTBTTEnable = 0; - csr.field.TsfSyncMode = 0; - csr.field.bTsfTicking = 0; - RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr.word); + NdisZeroMemory(pHdr80211, sizeof(HEADER_802_11)); + pHdr80211->FC.Type = BTYPE_MGMT; + pHdr80211->FC.SubType = SubType; +// if (SubType == SUBTYPE_ACK) // sample, no use, it will conflict with ACTION frame sub type +// pHdr80211->FC.Type = BTYPE_CNTL; + pHdr80211->FC.ToDs = ToDs; + COPY_MAC_ADDR(pHdr80211->Addr1, pDA); + COPY_MAC_ADDR(pHdr80211->Addr2, pAd->CurrentAddress); + COPY_MAC_ADDR(pHdr80211->Addr3, pBssid); } -/* - ========================================================================== - Description: +// =========================================================================================== +// mem_mgmt.c +// =========================================================================================== + +/*!*************************************************************************** + * This routine build an outgoing frame, and fill all information specified + * in argument list to the frame body. The actual frame size is the summation + * of all arguments. + * input params: + * Buffer - pointer to a pre-allocated memory segment + * args - a list of pairs. + * NOTE NOTE NOTE!!!! the last argument must be NULL, otherwise this + * function will FAIL!!! + * return: + * Size of the buffer + * usage: + * MakeOutgoingFrame(Buffer, output_length, 2, &fc, 2, &dur, 6, p_addr1, 6,p_addr2, END_OF_ARGS); + IRQL = PASSIVE_LEVEL IRQL = DISPATCH_LEVEL - ========================================================================== - */ -VOID AsicEnableBssSync( - IN PRTMP_ADAPTER pAd) + ****************************************************************************/ +ULONG MakeOutgoingFrame( + OUT UCHAR *Buffer, + OUT ULONG *FrameLen, ...) { - BCN_TIME_CFG_STRUC csr; - - DBGPRINT(RT_DEBUG_TRACE, ("--->AsicEnableBssSync(INFRA mode)\n")); - - RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr.word); + UCHAR *p; + int leng; + ULONG TotLeng; + va_list Args; + // calculates the total length + TotLeng = 0; + va_start(Args, FrameLen); + do { - csr.field.BeaconInterval = pAd->CommonCfg.BeaconPeriod << 4; // ASIC register in units of 1/16 TU - csr.field.bTsfTicking = 1; - csr.field.TsfSyncMode = 1; // sync TSF in INFRASTRUCTURE mode - csr.field.bBeaconGen = 0; // do NOT generate BEACON - csr.field.bTBTTEnable = 1; + leng = va_arg(Args, int); + if (leng == END_OF_ARGS) + { + break; } + p = va_arg(Args, PVOID); + NdisMoveMemory(&Buffer[TotLeng], p, leng); + TotLeng = TotLeng + leng; + } while(TRUE); - RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr.word); + va_end(Args); /* clean up */ + *FrameLen = TotLeng; + return TotLeng; } -/* - ========================================================================== - Description: - Note: - BEACON frame in shared memory should be built ok before this routine - can be called. Otherwise, a garbage frame maybe transmitted out every - Beacon period. +// =========================================================================================== +// mlme_queue.c +// =========================================================================================== - IRQL = DISPATCH_LEVEL +/*! \brief Initialize The MLME Queue, used by MLME Functions + * \param *Queue The MLME Queue + * \return Always Return NDIS_STATE_SUCCESS in this implementation + * \pre + * \post + * \note Because this is done only once (at the init stage), no need to be locked + + IRQL = PASSIVE_LEVEL - ========================================================================== */ -VOID AsicEnableIbssSync( - IN PRTMP_ADAPTER pAd) +NDIS_STATUS MlmeQueueInit( + IN MLME_QUEUE *Queue) { - BCN_TIME_CFG_STRUC csr9; - PUCHAR ptr; - UINT i; - - DBGPRINT(RT_DEBUG_TRACE, ("--->AsicEnableIbssSync(ADHOC mode. MPDUtotalByteCount = %d)\n", pAd->BeaconTxWI.MPDUtotalByteCount)); - - RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr9.word); - csr9.field.bBeaconGen = 0; - csr9.field.bTBTTEnable = 0; - csr9.field.bTsfTicking = 0; - RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr9.word); + INT i; -#ifdef RT2860 - // move BEACON TXD and frame content to on-chip memory - ptr = (PUCHAR)&pAd->BeaconTxWI; - for (i=0; iLock); - // start right after the 16-byte TXWI field - ptr = pAd->BeaconBuf; - for (i=0; i< pAd->BeaconTxWI.MPDUtotalByteCount; i+=4) - { - UINT32 longptr = *ptr + (*(ptr+1)<<8) + (*(ptr+2)<<16) + (*(ptr+3)<<24); - RTMP_IO_WRITE32(pAd, HW_BEACON_BASE0 + TXWI_SIZE + i, longptr); - ptr +=4; - } -#endif -#ifdef RT2870 - // move BEACON TXD and frame content to on-chip memory - ptr = (PUCHAR)&pAd->BeaconTxWI; - for (i=0; iNum = 0; + Queue->Head = 0; + Queue->Tail = 0; - // start right after the 16-byte TXWI field - ptr = pAd->BeaconBuf; - for (i=0; i< pAd->BeaconTxWI.MPDUtotalByteCount; i+=2) + for (i = 0; i < MAX_LEN_OF_MLME_QUEUE; i++) { - RTUSBMultiWrite(pAd, HW_BEACON_BASE0 + TXWI_SIZE + i, ptr, 2); - ptr +=2; + Queue->Entry[i].Occupied = FALSE; + Queue->Entry[i].MsgLen = 0; + NdisZeroMemory(Queue->Entry[i].Msg, MGMT_DMA_BUFFER_SIZE); } -#endif // RT2870 // - // start sending BEACON - csr9.field.BeaconInterval = pAd->CommonCfg.BeaconPeriod << 4; // ASIC register in units of 1/16 TU - csr9.field.bTsfTicking = 1; - csr9.field.TsfSyncMode = 2; // sync TSF in IBSS mode - csr9.field.bTBTTEnable = 1; - csr9.field.bBeaconGen = 1; - RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr9.word); + return NDIS_STATUS_SUCCESS; } -/* - ========================================================================== - Description: +/*! \brief Enqueue a message for other threads, if they want to send messages to MLME thread + * \param *Queue The MLME Queue + * \param Machine The State Machine Id + * \param MsgType The Message Type + * \param MsgLen The Message length + * \param *Msg The message pointer + * \return TRUE if enqueue is successful, FALSE if the queue is full + * \pre + * \post + * \note The message has to be initialized IRQL = PASSIVE_LEVEL IRQL = DISPATCH_LEVEL - ========================================================================== */ -VOID AsicSetEdcaParm( +BOOLEAN MlmeEnqueue( IN PRTMP_ADAPTER pAd, - IN PEDCA_PARM pEdcaParm) + IN ULONG Machine, + IN ULONG MsgType, + IN ULONG MsgLen, + IN VOID *Msg) { - EDCA_AC_CFG_STRUC Ac0Cfg, Ac1Cfg, Ac2Cfg, Ac3Cfg; - AC_TXOP_CSR0_STRUC csr0; - AC_TXOP_CSR1_STRUC csr1; - AIFSN_CSR_STRUC AifsnCsr; - CWMIN_CSR_STRUC CwminCsr; - CWMAX_CSR_STRUC CwmaxCsr; - int i; + INT Tail; + MLME_QUEUE *Queue = (MLME_QUEUE *)&pAd->Mlme.Queue; - Ac0Cfg.word = 0; - Ac1Cfg.word = 0; - Ac2Cfg.word = 0; - Ac3Cfg.word = 0; - if ((pEdcaParm == NULL) || (pEdcaParm->bValid == FALSE)) - { - DBGPRINT(RT_DEBUG_TRACE,("AsicSetEdcaParm\n")); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_WMM_INUSED); - for (i=0; iMacTab.Content[i].ValidAsCLI || pAd->MacTab.Content[i].ValidAsApCli) - CLIENT_STATUS_CLEAR_FLAG(&pAd->MacTab.Content[i], fCLIENT_STATUS_WMM_CAPABLE); - } + // Do nothing if the driver is starting halt state. + // This might happen when timer already been fired before cancel timer with mlmehalt + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + return FALSE; - //======================================================== - // MAC Register has a copy . - //======================================================== - if( pAd->CommonCfg.bEnableTxBurst ) - { - // For CWC test, change txop from 0x30 to 0x20 in TxBurst mode - Ac0Cfg.field.AcTxop = 0x20; // Suggest by John for TxBurst in HT Mode - } - else - Ac0Cfg.field.AcTxop = 0; // QID_AC_BE - Ac0Cfg.field.Cwmin = CW_MIN_IN_BITS; - Ac0Cfg.field.Cwmax = CW_MAX_IN_BITS; - Ac0Cfg.field.Aifsn = 2; - RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Ac0Cfg.word); - - Ac1Cfg.field.AcTxop = 0; // QID_AC_BK - Ac1Cfg.field.Cwmin = CW_MIN_IN_BITS; - Ac1Cfg.field.Cwmax = CW_MAX_IN_BITS; - Ac1Cfg.field.Aifsn = 2; - RTMP_IO_WRITE32(pAd, EDCA_AC1_CFG, Ac1Cfg.word); - - if (pAd->CommonCfg.PhyMode == PHY_11B) - { - Ac2Cfg.field.AcTxop = 192; // AC_VI: 192*32us ~= 6ms - Ac3Cfg.field.AcTxop = 96; // AC_VO: 96*32us ~= 3ms - } - else + // First check the size, it MUST not exceed the mlme queue size + if (MsgLen > MGMT_DMA_BUFFER_SIZE) { - Ac2Cfg.field.AcTxop = 96; // AC_VI: 96*32us ~= 3ms - Ac3Cfg.field.AcTxop = 48; // AC_VO: 48*32us ~= 1.5ms - } - Ac2Cfg.field.Cwmin = CW_MIN_IN_BITS; - Ac2Cfg.field.Cwmax = CW_MAX_IN_BITS; - Ac2Cfg.field.Aifsn = 2; - RTMP_IO_WRITE32(pAd, EDCA_AC2_CFG, Ac2Cfg.word); - Ac3Cfg.field.Cwmin = CW_MIN_IN_BITS; - Ac3Cfg.field.Cwmax = CW_MAX_IN_BITS; - Ac3Cfg.field.Aifsn = 2; - RTMP_IO_WRITE32(pAd, EDCA_AC3_CFG, Ac3Cfg.word); - - //======================================================== - // DMA Register has a copy too. - //======================================================== - csr0.field.Ac0Txop = 0; // QID_AC_BE - csr0.field.Ac1Txop = 0; // QID_AC_BK - RTMP_IO_WRITE32(pAd, WMM_TXOP0_CFG, csr0.word); - if (pAd->CommonCfg.PhyMode == PHY_11B) + DBGPRINT_ERR(("MlmeEnqueue: msg too large, size = %ld \n", MsgLen)); + return FALSE; + } + + if (MlmeQueueFull(Queue)) { - csr1.field.Ac2Txop = 192; // AC_VI: 192*32us ~= 6ms - csr1.field.Ac3Txop = 96; // AC_VO: 96*32us ~= 3ms + return FALSE; + } + + NdisAcquireSpinLock(&(Queue->Lock)); + Tail = Queue->Tail; + Queue->Tail++; + Queue->Num++; + if (Queue->Tail == MAX_LEN_OF_MLME_QUEUE) + { + Queue->Tail = 0; } - else - { - csr1.field.Ac2Txop = 96; // AC_VI: 96*32us ~= 3ms - csr1.field.Ac3Txop = 48; // AC_VO: 48*32us ~= 1.5ms + + Queue->Entry[Tail].Wcid = RESERVED_WCID; + Queue->Entry[Tail].Occupied = TRUE; + Queue->Entry[Tail].Machine = Machine; + Queue->Entry[Tail].MsgType = MsgType; + Queue->Entry[Tail].MsgLen = MsgLen; + + if (Msg != NULL) + { + NdisMoveMemory(Queue->Entry[Tail].Msg, Msg, MsgLen); } - RTMP_IO_WRITE32(pAd, WMM_TXOP1_CFG, csr1.word); - CwminCsr.word = 0; - CwminCsr.field.Cwmin0 = CW_MIN_IN_BITS; - CwminCsr.field.Cwmin1 = CW_MIN_IN_BITS; - CwminCsr.field.Cwmin2 = CW_MIN_IN_BITS; - CwminCsr.field.Cwmin3 = CW_MIN_IN_BITS; - RTMP_IO_WRITE32(pAd, WMM_CWMIN_CFG, CwminCsr.word); + NdisReleaseSpinLock(&(Queue->Lock)); + return TRUE; +} - CwmaxCsr.word = 0; - CwmaxCsr.field.Cwmax0 = CW_MAX_IN_BITS; - CwmaxCsr.field.Cwmax1 = CW_MAX_IN_BITS; - CwmaxCsr.field.Cwmax2 = CW_MAX_IN_BITS; - CwmaxCsr.field.Cwmax3 = CW_MAX_IN_BITS; - RTMP_IO_WRITE32(pAd, WMM_CWMAX_CFG, CwmaxCsr.word); +/*! \brief This function is used when Recv gets a MLME message + * \param *Queue The MLME Queue + * \param TimeStampHigh The upper 32 bit of timestamp + * \param TimeStampLow The lower 32 bit of timestamp + * \param Rssi The receiving RSSI strength + * \param MsgLen The length of the message + * \param *Msg The message pointer + * \return TRUE if everything ok, FALSE otherwise (like Queue Full) + * \pre + * \post - RTMP_IO_WRITE32(pAd, WMM_AIFSN_CFG, 0x00002222); + IRQL = DISPATCH_LEVEL - NdisZeroMemory(&pAd->CommonCfg.APEdcaParm, sizeof(EDCA_PARM)); - } - else - { - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_WMM_INUSED); - //======================================================== - // MAC Register has a copy. - //======================================================== - // - // Modify Cwmin/Cwmax/Txop on queue[QID_AC_VI], Recommend by Jerry 2005/07/27 - // To degrade our VIDO Queue's throughput for WiFi WMM S3T07 Issue. - // - //pEdcaParm->Txop[QID_AC_VI] = pEdcaParm->Txop[QID_AC_VI] * 7 / 10; // rt2860c need this + */ +BOOLEAN MlmeEnqueueForRecv( + IN PRTMP_ADAPTER pAd, + IN ULONG Wcid, + IN ULONG TimeStampHigh, + IN ULONG TimeStampLow, + IN UCHAR Rssi0, + IN UCHAR Rssi1, + IN UCHAR Rssi2, + IN ULONG MsgLen, + IN VOID *Msg, + IN UCHAR Signal) +{ + INT Tail, Machine; + PFRAME_802_11 pFrame = (PFRAME_802_11)Msg; + INT MsgType; + MLME_QUEUE *Queue = (MLME_QUEUE *)&pAd->Mlme.Queue; - Ac0Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BE]; - Ac0Cfg.field.Cwmin= pEdcaParm->Cwmin[QID_AC_BE]; - Ac0Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_BE]; - Ac0Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BE]; //+1; - Ac1Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BK]; - Ac1Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_BK]; //+2; - Ac1Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_BK]; - Ac1Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BK]; //+1; + // Do nothing if the driver is starting halt state. + // This might happen when timer already been fired before cancel timer with mlmehalt + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + { + DBGPRINT_ERR(("MlmeEnqueueForRecv: fRTMP_ADAPTER_HALT_IN_PROGRESS\n")); + return FALSE; + } - Ac2Cfg.field.AcTxop = (pEdcaParm->Txop[QID_AC_VI] * 6) / 10; - Ac2Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_VI]; - Ac2Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_VI]; - Ac2Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_VI]; + // First check the size, it MUST not exceed the mlme queue size + if (MsgLen > MGMT_DMA_BUFFER_SIZE) + { + DBGPRINT_ERR(("MlmeEnqueueForRecv: frame too large, size = %ld \n", MsgLen)); + return FALSE; + } + if (MlmeQueueFull(Queue)) { - // Tuning for Wi-Fi WMM S06 - if (pAd->CommonCfg.bWiFiTest && - pEdcaParm->Aifsn[QID_AC_VI] == 10) - Ac2Cfg.field.Aifsn -= 1; - - // Tuning for TGn Wi-Fi 5.2.32 - // STA TestBed changes in this item: connexant legacy sta ==> broadcom 11n sta - if (STA_TGN_WIFI_ON(pAd) && - pEdcaParm->Aifsn[QID_AC_VI] == 10) - { - Ac0Cfg.field.Aifsn = 3; - Ac2Cfg.field.AcTxop = 5; - } + return FALSE; + } -#ifdef RT2870 - if (pAd->RfIcType == RFIC_3020 || pAd->RfIcType == RFIC_2020) { - // Tuning for WiFi WMM S3-T07: connexant legacy sta ==> broadcom 11n sta. - Ac2Cfg.field.Aifsn = 5; + if (!MsgTypeSubst(pAd, pFrame, &Machine, &MsgType)) + { + DBGPRINT_ERR(("MlmeEnqueueForRecv: un-recongnized mgmt->subtype=%d\n",pFrame->Hdr.FC.SubType)); + return FALSE; } -#endif } - Ac3Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_VO]; - Ac3Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_VO]; - Ac3Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_VO]; - Ac3Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_VO]; - -//#ifdef WIFI_TEST - if (pAd->CommonCfg.bWiFiTest) + // OK, we got all the informations, it is time to put things into queue + NdisAcquireSpinLock(&(Queue->Lock)); + Tail = Queue->Tail; + Queue->Tail++; + Queue->Num++; + if (Queue->Tail == MAX_LEN_OF_MLME_QUEUE) { - if (Ac3Cfg.field.AcTxop == 102) - { - Ac0Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BE] ? pEdcaParm->Txop[QID_AC_BE] : 10; - Ac0Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BE]-1; /* AIFSN must >= 1 */ - Ac1Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BK]; - Ac1Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BK]; - Ac2Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_VI]; - } /* End of if */ + Queue->Tail = 0; } -//#endif // WIFI_TEST // - - RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Ac0Cfg.word); - RTMP_IO_WRITE32(pAd, EDCA_AC1_CFG, Ac1Cfg.word); - RTMP_IO_WRITE32(pAd, EDCA_AC2_CFG, Ac2Cfg.word); - RTMP_IO_WRITE32(pAd, EDCA_AC3_CFG, Ac3Cfg.word); - - - //======================================================== - // DMA Register has a copy too. - //======================================================== - csr0.field.Ac0Txop = Ac0Cfg.field.AcTxop; - csr0.field.Ac1Txop = Ac1Cfg.field.AcTxop; - RTMP_IO_WRITE32(pAd, WMM_TXOP0_CFG, csr0.word); - - csr1.field.Ac2Txop = Ac2Cfg.field.AcTxop; - csr1.field.Ac3Txop = Ac3Cfg.field.AcTxop; - RTMP_IO_WRITE32(pAd, WMM_TXOP1_CFG, csr1.word); - - CwminCsr.word = 0; - CwminCsr.field.Cwmin0 = pEdcaParm->Cwmin[QID_AC_BE]; - CwminCsr.field.Cwmin1 = pEdcaParm->Cwmin[QID_AC_BK]; - CwminCsr.field.Cwmin2 = pEdcaParm->Cwmin[QID_AC_VI]; - - CwminCsr.field.Cwmin3 = pEdcaParm->Cwmin[QID_AC_VO] - 1; //for TGn wifi test - - RTMP_IO_WRITE32(pAd, WMM_CWMIN_CFG, CwminCsr.word); + Queue->Entry[Tail].Occupied = TRUE; + Queue->Entry[Tail].Machine = Machine; + Queue->Entry[Tail].MsgType = MsgType; + Queue->Entry[Tail].MsgLen = MsgLen; + Queue->Entry[Tail].TimeStamp.u.LowPart = TimeStampLow; + Queue->Entry[Tail].TimeStamp.u.HighPart = TimeStampHigh; + Queue->Entry[Tail].Rssi0 = Rssi0; + Queue->Entry[Tail].Rssi1 = Rssi1; + Queue->Entry[Tail].Rssi2 = Rssi2; + Queue->Entry[Tail].Signal = Signal; + Queue->Entry[Tail].Wcid = (UCHAR)Wcid; - CwmaxCsr.word = 0; - CwmaxCsr.field.Cwmax0 = pEdcaParm->Cwmax[QID_AC_BE]; - CwmaxCsr.field.Cwmax1 = pEdcaParm->Cwmax[QID_AC_BK]; - CwmaxCsr.field.Cwmax2 = pEdcaParm->Cwmax[QID_AC_VI]; - CwmaxCsr.field.Cwmax3 = pEdcaParm->Cwmax[QID_AC_VO]; - RTMP_IO_WRITE32(pAd, WMM_CWMAX_CFG, CwmaxCsr.word); + Queue->Entry[Tail].Channel = pAd->LatchRfRegs.Channel; - AifsnCsr.word = 0; - AifsnCsr.field.Aifsn0 = Ac0Cfg.field.Aifsn; //pEdcaParm->Aifsn[QID_AC_BE]; - AifsnCsr.field.Aifsn1 = Ac1Cfg.field.Aifsn; //pEdcaParm->Aifsn[QID_AC_BK]; - AifsnCsr.field.Aifsn2 = Ac2Cfg.field.Aifsn; //pEdcaParm->Aifsn[QID_AC_VI]; + if (Msg != NULL) + { + NdisMoveMemory(Queue->Entry[Tail].Msg, Msg, MsgLen); + } - { - // Tuning for Wi-Fi WMM S06 - if (pAd->CommonCfg.bWiFiTest && - pEdcaParm->Aifsn[QID_AC_VI] == 10) - AifsnCsr.field.Aifsn2 = Ac2Cfg.field.Aifsn - 4; - - // Tuning for TGn Wi-Fi 5.2.32 - // STA TestBed changes in this item: connexant legacy sta ==> broadcom 11n sta - if (STA_TGN_WIFI_ON(pAd) && - pEdcaParm->Aifsn[QID_AC_VI] == 10) - { - AifsnCsr.field.Aifsn0 = 3; - AifsnCsr.field.Aifsn2 = 7; - } -#ifdef RT2870 - if (INFRA_ON(pAd)) - CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[BSSID_WCID], fCLIENT_STATUS_WMM_CAPABLE); -#endif - } + NdisReleaseSpinLock(&(Queue->Lock)); - AifsnCsr.field.Aifsn3 = Ac3Cfg.field.Aifsn - 1; //pEdcaParm->Aifsn[QID_AC_VO]; //for TGn wifi test -#ifdef RT2870 - if (pAd->RfIcType == RFIC_3020 || pAd->RfIcType == RFIC_2020) - AifsnCsr.field.Aifsn2 = 0x2; //pEdcaParm->Aifsn[QID_AC_VI]; //for WiFi WMM S4-T04. -#endif - RTMP_IO_WRITE32(pAd, WMM_AIFSN_CFG, AifsnCsr.word); + RTMP_MLME_HANDLER(pAd); - NdisMoveMemory(&pAd->CommonCfg.APEdcaParm, pEdcaParm, sizeof(EDCA_PARM)); - if (!ADHOC_ON(pAd)) - { - DBGPRINT(RT_DEBUG_TRACE,("EDCA [#%d]: AIFSN CWmin CWmax TXOP(us) ACM\n", pEdcaParm->EdcaUpdateCount)); - DBGPRINT(RT_DEBUG_TRACE,(" AC_BE %2d %2d %2d %4d %d\n", - pEdcaParm->Aifsn[0], - pEdcaParm->Cwmin[0], - pEdcaParm->Cwmax[0], - pEdcaParm->Txop[0]<<5, - pEdcaParm->bACM[0])); - DBGPRINT(RT_DEBUG_TRACE,(" AC_BK %2d %2d %2d %4d %d\n", - pEdcaParm->Aifsn[1], - pEdcaParm->Cwmin[1], - pEdcaParm->Cwmax[1], - pEdcaParm->Txop[1]<<5, - pEdcaParm->bACM[1])); - DBGPRINT(RT_DEBUG_TRACE,(" AC_VI %2d %2d %2d %4d %d\n", - pEdcaParm->Aifsn[2], - pEdcaParm->Cwmin[2], - pEdcaParm->Cwmax[2], - pEdcaParm->Txop[2]<<5, - pEdcaParm->bACM[2])); - DBGPRINT(RT_DEBUG_TRACE,(" AC_VO %2d %2d %2d %4d %d\n", - pEdcaParm->Aifsn[3], - pEdcaParm->Cwmin[3], - pEdcaParm->Cwmax[3], - pEdcaParm->Txop[3]<<5, - pEdcaParm->bACM[3])); - } - } + return TRUE; } -/* - ========================================================================== - Description: - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL +/*! \brief Dequeue a message from the MLME Queue + * \param *Queue The MLME Queue + * \param *Elem The message dequeued from MLME Queue + * \return TRUE if the Elem contains something, FALSE otherwise + * \pre + * \post + + IRQL = DISPATCH_LEVEL - ========================================================================== */ -VOID AsicSetSlotTime( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bUseShortSlotTime) +BOOLEAN MlmeDequeue( + IN MLME_QUEUE *Queue, + OUT MLME_QUEUE_ELEM **Elem) { - ULONG SlotTime; - UINT32 RegValue = 0; - - if (pAd->CommonCfg.Channel > 14) - bUseShortSlotTime = TRUE; - - if (bUseShortSlotTime) - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED); - else - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED); - - SlotTime = (bUseShortSlotTime)? 9 : 20; - + NdisAcquireSpinLock(&(Queue->Lock)); + *Elem = &(Queue->Entry[Queue->Head]); + Queue->Num--; + Queue->Head++; + if (Queue->Head == MAX_LEN_OF_MLME_QUEUE) { - // force using short SLOT time for FAE to demo performance when TxBurst is ON - if (((pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) && (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED))) - || ((pAd->StaActive.SupportedPhyInfo.bHtEnable == TRUE) && (pAd->CommonCfg.BACapability.field.Policy == BA_NOTUSE)) - ) - { - // In this case, we will think it is doing Wi-Fi test - // And we will not set to short slot when bEnableTxBurst is TRUE. - } - else if (pAd->CommonCfg.bEnableTxBurst) - SlotTime = 9; + Queue->Head = 0; } - - // - // For some reasons, always set it to short slot time. - // - // ToDo: Should consider capability with 11B - // - if (pAd->StaCfg.BssType == BSS_ADHOC) - SlotTime = 20; - - RTMP_IO_READ32(pAd, BKOFF_SLOT_CFG, &RegValue); - RegValue = RegValue & 0xFFFFFF00; - - RegValue |= SlotTime; - - RTMP_IO_WRITE32(pAd, BKOFF_SLOT_CFG, RegValue); + NdisReleaseSpinLock(&(Queue->Lock)); + return TRUE; } -/* - ======================================================================== - Description: - Add Shared key information into ASIC. - Update shared key, TxMic and RxMic to Asic Shared key table - Update its cipherAlg to Asic Shared key Mode. - - Return: - ======================================================================== -*/ -VOID AsicAddSharedKeyEntry( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssIndex, - IN UCHAR KeyIdx, - IN UCHAR CipherAlg, - IN PUCHAR pKey, - IN PUCHAR pTxMic, - IN PUCHAR pRxMic) +// IRQL = DISPATCH_LEVEL +VOID MlmeRestartStateMachine( + IN PRTMP_ADAPTER pAd) { - ULONG offset; //, csr0; - SHAREDKEY_MODE_STRUC csr1; -#ifdef RT2860 - INT i; -#endif +#ifdef RTMP_MAC_PCI + MLME_QUEUE_ELEM *Elem = NULL; +#endif // RTMP_MAC_PCI // + BOOLEAN Cancelled; - DBGPRINT(RT_DEBUG_TRACE, ("AsicAddSharedKeyEntry BssIndex=%d, KeyIdx=%d\n", BssIndex,KeyIdx)); -//============================================================================================ + DBGPRINT(RT_DEBUG_TRACE, ("MlmeRestartStateMachine \n")); - DBGPRINT(RT_DEBUG_TRACE,("AsicAddSharedKeyEntry: %s key #%d\n", CipherName[CipherAlg], BssIndex*4 + KeyIdx)); - DBGPRINT_RAW(RT_DEBUG_TRACE, (" Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", - pKey[0],pKey[1],pKey[2],pKey[3],pKey[4],pKey[5],pKey[6],pKey[7],pKey[8],pKey[9],pKey[10],pKey[11],pKey[12],pKey[13],pKey[14],pKey[15])); - if (pRxMic) +#ifdef RTMP_MAC_PCI + NdisAcquireSpinLock(&pAd->Mlme.TaskLock); + if(pAd->Mlme.bRunning) { - DBGPRINT_RAW(RT_DEBUG_TRACE, (" Rx MIC Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", - pRxMic[0],pRxMic[1],pRxMic[2],pRxMic[3],pRxMic[4],pRxMic[5],pRxMic[6],pRxMic[7])); + NdisReleaseSpinLock(&pAd->Mlme.TaskLock); + return; } - if (pTxMic) + else { - DBGPRINT_RAW(RT_DEBUG_TRACE, (" Tx MIC Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", - pTxMic[0],pTxMic[1],pTxMic[2],pTxMic[3],pTxMic[4],pTxMic[5],pTxMic[6],pTxMic[7])); + pAd->Mlme.bRunning = TRUE; } -//============================================================================================ - // - // fill key material - key + TX MIC + RX MIC - // + NdisReleaseSpinLock(&pAd->Mlme.TaskLock); - offset = SHARED_KEY_TABLE_BASE + (4*BssIndex + KeyIdx)*HW_KEY_ENTRY_SIZE; -#ifdef RT2860 - for (i=0; iMlme.Queue)) { -#ifdef RT2860 - for (i=0; i<8; i++) + //From message type, determine which state machine I should drive + if (MlmeDequeue(&pAd->Mlme.Queue, &Elem)) { - RTMP_IO_WRITE8(pAd, offset + i, pTxMic[i]); - } -#endif -#ifdef RT2870 - RTUSBMultiWrite(pAd, offset, pTxMic, 8); -#endif - } + // free MLME element + Elem->Occupied = FALSE; + Elem->MsgLen = 0; - offset += 8; - if (pRxMic) - { -#ifdef RT2860 - for (i=0; i<8; i++) - { - RTMP_IO_WRITE8(pAd, offset + i, pRxMic[i]); } -#endif -#ifdef RT2870 - RTUSBMultiWrite(pAd, offset, pRxMic, 8); -#endif + else { + DBGPRINT_ERR(("MlmeRestartStateMachine: MlmeQueue empty\n")); } - - - // - // Update cipher algorithm. WSTA always use BSS0 - // - RTMP_IO_READ32(pAd, SHARED_KEY_MODE_BASE+4*(BssIndex/2), &csr1.word); - DBGPRINT(RT_DEBUG_TRACE,("Read: SHARED_KEY_MODE_BASE at this Bss[%d] KeyIdx[%d]= 0x%x \n", BssIndex,KeyIdx, csr1.word)); - if ((BssIndex%2) == 0) - { - if (KeyIdx == 0) - csr1.field.Bss0Key0CipherAlg = CipherAlg; - else if (KeyIdx == 1) - csr1.field.Bss0Key1CipherAlg = CipherAlg; - else if (KeyIdx == 2) - csr1.field.Bss0Key2CipherAlg = CipherAlg; - else - csr1.field.Bss0Key3CipherAlg = CipherAlg; } - else +#endif // RTMP_MAC_PCI // + { - if (KeyIdx == 0) - csr1.field.Bss1Key0CipherAlg = CipherAlg; - else if (KeyIdx == 1) - csr1.field.Bss1Key1CipherAlg = CipherAlg; - else if (KeyIdx == 2) - csr1.field.Bss1Key2CipherAlg = CipherAlg; - else - csr1.field.Bss1Key3CipherAlg = CipherAlg; - } - DBGPRINT(RT_DEBUG_TRACE,("Write: SHARED_KEY_MODE_BASE at this Bss[%d] = 0x%x \n", BssIndex, csr1.word)); - RTMP_IO_WRITE32(pAd, SHARED_KEY_MODE_BASE+4*(BssIndex/2), csr1.word); + // Cancel all timer events + // Be careful to cancel new added timer + RTMPCancelTimer(&pAd->MlmeAux.AssocTimer, &Cancelled); + RTMPCancelTimer(&pAd->MlmeAux.ReassocTimer, &Cancelled); + RTMPCancelTimer(&pAd->MlmeAux.DisassocTimer, &Cancelled); + RTMPCancelTimer(&pAd->MlmeAux.AuthTimer, &Cancelled); + RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &Cancelled); + RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &Cancelled); -} + } -// IRQL = DISPATCH_LEVEL -VOID AsicRemoveSharedKeyEntry( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssIndex, - IN UCHAR KeyIdx) -{ - //ULONG SecCsr0; - SHAREDKEY_MODE_STRUC csr1; + // Change back to original channel in case of doing scan + AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); + AsicLockChannel(pAd, pAd->CommonCfg.Channel); - DBGPRINT(RT_DEBUG_TRACE,("AsicRemoveSharedKeyEntry: #%d \n", BssIndex*4 + KeyIdx)); + // Resume MSDU which is turned off durning scan + RTMPResumeMsduTransmission(pAd); - RTMP_IO_READ32(pAd, SHARED_KEY_MODE_BASE+4*(BssIndex/2), &csr1.word); - if ((BssIndex%2) == 0) - { - if (KeyIdx == 0) - csr1.field.Bss0Key0CipherAlg = 0; - else if (KeyIdx == 1) - csr1.field.Bss0Key1CipherAlg = 0; - else if (KeyIdx == 2) - csr1.field.Bss0Key2CipherAlg = 0; - else - csr1.field.Bss0Key3CipherAlg = 0; - } - else { - if (KeyIdx == 0) - csr1.field.Bss1Key0CipherAlg = 0; - else if (KeyIdx == 1) - csr1.field.Bss1Key1CipherAlg = 0; - else if (KeyIdx == 2) - csr1.field.Bss1Key2CipherAlg = 0; - else - csr1.field.Bss1Key3CipherAlg = 0; + // Set all state machines back IDLE + pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; + pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; + pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; + pAd->Mlme.AuthRspMachine.CurrState = AUTH_RSP_IDLE; + pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; + pAd->Mlme.ActMachine.CurrState = ACT_IDLE; } - DBGPRINT(RT_DEBUG_TRACE,("Write: SHARED_KEY_MODE_BASE at this Bss[%d] = 0x%x \n", BssIndex, csr1.word)); - RTMP_IO_WRITE32(pAd, SHARED_KEY_MODE_BASE+4*(BssIndex/2), csr1.word); - ASSERT(BssIndex < 4); - ASSERT(KeyIdx < 4); +#ifdef RTMP_MAC_PCI + // Remove running state + NdisAcquireSpinLock(&pAd->Mlme.TaskLock); + pAd->Mlme.bRunning = FALSE; + NdisReleaseSpinLock(&pAd->Mlme.TaskLock); +#endif // RTMP_MAC_PCI // } +/*! \brief test if the MLME Queue is empty + * \param *Queue The MLME Queue + * \return TRUE if the Queue is empty, FALSE otherwise + * \pre + * \post -VOID AsicUpdateWCIDAttribute( - IN PRTMP_ADAPTER pAd, - IN USHORT WCID, - IN UCHAR BssIndex, - IN UCHAR CipherAlg, - IN BOOLEAN bUsePairewiseKeyTable) -{ - ULONG WCIDAttri = 0, offset; - - // - // Update WCID attribute. - // Only TxKey could update WCID attribute. - // - offset = MAC_WCID_ATTRIBUTE_BASE + (WCID * HW_WCID_ATTRI_SIZE); - WCIDAttri = (BssIndex << 4) | (CipherAlg << 1) | (bUsePairewiseKeyTable); - RTMP_IO_WRITE32(pAd, offset, WCIDAttri); -} + IRQL = DISPATCH_LEVEL -VOID AsicUpdateWCIDIVEIV( - IN PRTMP_ADAPTER pAd, - IN USHORT WCID, - IN ULONG uIV, - IN ULONG uEIV) + */ +BOOLEAN MlmeQueueEmpty( + IN MLME_QUEUE *Queue) { - ULONG offset; + BOOLEAN Ans; - offset = MAC_IVEIV_TABLE_BASE + (WCID * HW_IVEIV_ENTRY_SIZE); + NdisAcquireSpinLock(&(Queue->Lock)); + Ans = (Queue->Num == 0); + NdisReleaseSpinLock(&(Queue->Lock)); - RTMP_IO_WRITE32(pAd, offset, uIV); - RTMP_IO_WRITE32(pAd, offset + 4, uEIV); + return Ans; } -VOID AsicUpdateRxWCIDTable( - IN PRTMP_ADAPTER pAd, - IN USHORT WCID, - IN PUCHAR pAddr) +/*! \brief test if the MLME Queue is full + * \param *Queue The MLME Queue + * \return TRUE if the Queue is empty, FALSE otherwise + * \pre + * \post + + IRQL = PASSIVE_LEVEL + IRQL = DISPATCH_LEVEL + + */ +BOOLEAN MlmeQueueFull( + IN MLME_QUEUE *Queue) { - ULONG offset; - ULONG Addr; - - offset = MAC_WCID_BASE + (WCID * HW_WCID_ENTRY_SIZE); - Addr = pAddr[0] + (pAddr[1] << 8) +(pAddr[2] << 16) +(pAddr[3] << 24); - RTMP_IO_WRITE32(pAd, offset, Addr); - Addr = pAddr[4] + (pAddr[5] << 8); - RTMP_IO_WRITE32(pAd, offset + 4, Addr); -} + BOOLEAN Ans; + NdisAcquireSpinLock(&(Queue->Lock)); + Ans = (Queue->Num == MAX_LEN_OF_MLME_QUEUE || Queue->Entry[Queue->Tail].Occupied); + NdisReleaseSpinLock(&(Queue->Lock)); -/* - ======================================================================== + return Ans; +} - Routine Description: - Set Cipher Key, Cipher algorithm, IV/EIV to Asic +/*! \brief The destructor of MLME Queue + * \param + * \return + * \pre + * \post + * \note Clear Mlme Queue, Set Queue->Num to Zero. - Arguments: - pAd Pointer to our adapter - WCID WCID Entry number. - BssIndex BSSID index, station or none multiple BSSID support - this value should be 0. - KeyIdx This KeyIdx will set to IV's KeyID if bTxKey enabled - pCipherKey Pointer to Cipher Key. - bUsePairewiseKeyTable TRUE means saved the key in SharedKey table, - otherwise PairewiseKey table - bTxKey This is the transmit key if enabled. + IRQL = PASSIVE_LEVEL - Return Value: - None + */ +VOID MlmeQueueDestroy( + IN MLME_QUEUE *pQueue) +{ + NdisAcquireSpinLock(&(pQueue->Lock)); + pQueue->Num = 0; + pQueue->Head = 0; + pQueue->Tail = 0; + NdisReleaseSpinLock(&(pQueue->Lock)); + NdisFreeSpinLock(&(pQueue->Lock)); +} - Note: - This routine will set the relative key stuff to Asic including WCID attribute, - Cipher Key, Cipher algorithm and IV/EIV. - IV/EIV will be update if this CipherKey is the transmission key because - ASIC will base on IV's KeyID value to select Cipher Key. +/*! \brief To substitute the message type if the message is coming from external + * \param pFrame The frame received + * \param *Machine The state machine + * \param *MsgType the message type for the state machine + * \return TRUE if the substitution is successful, FALSE otherwise + * \pre + * \post - If bTxKey sets to FALSE, this is not the TX key, but it could be - RX key + IRQL = DISPATCH_LEVEL - For AP mode bTxKey must be always set to TRUE. - ======================================================================== -*/ -VOID AsicAddKeyEntry( - IN PRTMP_ADAPTER pAd, - IN USHORT WCID, - IN UCHAR BssIndex, - IN UCHAR KeyIdx, - IN PCIPHER_KEY pCipherKey, - IN BOOLEAN bUsePairewiseKeyTable, - IN BOOLEAN bTxKey) + */ +BOOLEAN MsgTypeSubst( + IN PRTMP_ADAPTER pAd, + IN PFRAME_802_11 pFrame, + OUT INT *Machine, + OUT INT *MsgType) { - ULONG offset; - UCHAR IV4 = 0; - PUCHAR pKey = pCipherKey->Key; - PUCHAR pTxMic = pCipherKey->TxMic; - PUCHAR pRxMic = pCipherKey->RxMic; - PUCHAR pTxtsc = pCipherKey->TxTsc; - UCHAR CipherAlg = pCipherKey->CipherAlg; - SHAREDKEY_MODE_STRUC csr1; -#ifdef RT2860 - UCHAR i; -#endif - - DBGPRINT(RT_DEBUG_TRACE, ("==> AsicAddKeyEntry\n")); - // - // 1.) decide key table offset - // - if (bUsePairewiseKeyTable) - offset = PAIRWISE_KEY_TABLE_BASE + (WCID * HW_KEY_ENTRY_SIZE); - else - offset = SHARED_KEY_TABLE_BASE + (4 * BssIndex + KeyIdx) * HW_KEY_ENTRY_SIZE; + USHORT Seq, Alg; + UCHAR EAPType; + PUCHAR pData; - // - // 2.) Set Key to Asic - // - //for (i = 0; i < KeyLen; i++) -#ifdef RT2860 - for (i = 0; i < MAX_LEN_OF_PEER_KEY; i++) - { - RTMP_IO_WRITE8(pAd, offset + i, pKey[i]); - } -#endif -#ifdef RT2870 - RTUSBMultiWrite(pAd, offset, pKey, MAX_LEN_OF_PEER_KEY); -#endif - offset += MAX_LEN_OF_PEER_KEY; + // Pointer to start of data frames including SNAP header + pData = (PUCHAR) pFrame + LENGTH_802_11; - // - // 3.) Set MIC key if available - // - if (pTxMic) + // The only data type will pass to this function is EAPOL frame + if (pFrame->Hdr.FC.Type == BTYPE_DATA) { -#ifdef RT2860 - for (i = 0; i < 8; i++) { - RTMP_IO_WRITE8(pAd, offset + i, pTxMic[i]); + *Machine = WPA_STATE_MACHINE; + EAPType = *((UCHAR*)pFrame + LENGTH_802_11 + LENGTH_802_1_H + 1); + return (WpaMsgTypeSubst(EAPType, (INT *) MsgType)); } -#endif -#ifdef RT2870 - RTUSBMultiWrite(pAd, offset, pTxMic, 8); -#endif } - offset += LEN_TKIP_TXMICK; - if (pRxMic) + switch (pFrame->Hdr.FC.SubType) { -#ifdef RT2860 - for (i = 0; i < 8; i++) + case SUBTYPE_ASSOC_REQ: + *Machine = ASSOC_STATE_MACHINE; + *MsgType = MT2_PEER_ASSOC_REQ; + break; + case SUBTYPE_ASSOC_RSP: + *Machine = ASSOC_STATE_MACHINE; + *MsgType = MT2_PEER_ASSOC_RSP; + break; + case SUBTYPE_REASSOC_REQ: + *Machine = ASSOC_STATE_MACHINE; + *MsgType = MT2_PEER_REASSOC_REQ; + break; + case SUBTYPE_REASSOC_RSP: + *Machine = ASSOC_STATE_MACHINE; + *MsgType = MT2_PEER_REASSOC_RSP; + break; + case SUBTYPE_PROBE_REQ: + *Machine = SYNC_STATE_MACHINE; + *MsgType = MT2_PEER_PROBE_REQ; + break; + case SUBTYPE_PROBE_RSP: + *Machine = SYNC_STATE_MACHINE; + *MsgType = MT2_PEER_PROBE_RSP; + break; + case SUBTYPE_BEACON: + *Machine = SYNC_STATE_MACHINE; + *MsgType = MT2_PEER_BEACON; + break; + case SUBTYPE_ATIM: + *Machine = SYNC_STATE_MACHINE; + *MsgType = MT2_PEER_ATIM; + break; + case SUBTYPE_DISASSOC: + *Machine = ASSOC_STATE_MACHINE; + *MsgType = MT2_PEER_DISASSOC_REQ; + break; + case SUBTYPE_AUTH: + // get the sequence number from payload 24 Mac Header + 2 bytes algorithm + NdisMoveMemory(&Seq, &pFrame->Octet[2], sizeof(USHORT)); + NdisMoveMemory(&Alg, &pFrame->Octet[0], sizeof(USHORT)); + if (Seq == 1 || Seq == 3) { - RTMP_IO_WRITE8(pAd, offset + i, pRxMic[i]); - } -#endif -#ifdef RT2870 - RTUSBMultiWrite(pAd, offset, pRxMic, 8); -#endif + *Machine = AUTH_RSP_STATE_MACHINE; + *MsgType = MT2_PEER_AUTH_ODD; } - - - // - // 4.) Modify IV/EIV if needs - // This will force Asic to use this key ID by setting IV. - // - if (bTxKey) + else if (Seq == 2 || Seq == 4) { -#ifdef RT2860 - offset = MAC_IVEIV_TABLE_BASE + (WCID * HW_IVEIV_ENTRY_SIZE); - // - // Write IV - // - RTMP_IO_WRITE8(pAd, offset, pTxtsc[1]); - RTMP_IO_WRITE8(pAd, offset + 1, ((pTxtsc[1] | 0x20) & 0x7f)); - RTMP_IO_WRITE8(pAd, offset + 2, pTxtsc[0]); - - IV4 = (KeyIdx << 6); - if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) ||(CipherAlg == CIPHER_AES)) - IV4 |= 0x20; // turn on extension bit means EIV existence - - RTMP_IO_WRITE8(pAd, offset + 3, IV4); - - // - // Write EIV - // - offset += 4; - for (i = 0; i < 4; i++) + if (Alg == AUTH_MODE_OPEN || Alg == AUTH_MODE_KEY) { - RTMP_IO_WRITE8(pAd, offset + i, pTxtsc[i + 2]); + *Machine = AUTH_STATE_MACHINE; + *MsgType = MT2_PEER_AUTH_EVEN; } - -#endif -#ifdef RT2870 - UINT32 tmpVal; - - // - // Write IV - // - IV4 = (KeyIdx << 6); - if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) ||(CipherAlg == CIPHER_AES)) - IV4 |= 0x20; // turn on extension bit means EIV existence - - tmpVal = pTxtsc[1] + (((pTxtsc[1] | 0x20) & 0x7f) << 8) + (pTxtsc[0] << 16) + (IV4 << 24); - RTMP_IO_WRITE32(pAd, offset, tmpVal); - - // - // Write EIV - // - offset += 4; - RTMP_IO_WRITE32(pAd, offset, *(PUINT32)&pCipherKey->TxTsc[2]); -#endif // RT2870 // - AsicUpdateWCIDAttribute(pAd, WCID, BssIndex, CipherAlg, bUsePairewiseKeyTable); } - - if (!bUsePairewiseKeyTable) + else { - // - // Only update the shared key security mode - // - RTMP_IO_READ32(pAd, SHARED_KEY_MODE_BASE + 4 * (BssIndex / 2), &csr1.word); - if ((BssIndex % 2) == 0) + return FALSE; + } + break; + case SUBTYPE_DEAUTH: + *Machine = AUTH_RSP_STATE_MACHINE; + *MsgType = MT2_PEER_DEAUTH; + break; + case SUBTYPE_ACTION: + *Machine = ACTION_STATE_MACHINE; + // Sometimes Sta will return with category bytes with MSB = 1, if they receive catogory out of their support + if ((pFrame->Octet[0]&0x7F) > MAX_PEER_CATE_MSG) { - if (KeyIdx == 0) - csr1.field.Bss0Key0CipherAlg = CipherAlg; - else if (KeyIdx == 1) - csr1.field.Bss0Key1CipherAlg = CipherAlg; - else if (KeyIdx == 2) - csr1.field.Bss0Key2CipherAlg = CipherAlg; - else - csr1.field.Bss0Key3CipherAlg = CipherAlg; + *MsgType = MT2_ACT_INVALID; } else { - if (KeyIdx == 0) - csr1.field.Bss1Key0CipherAlg = CipherAlg; - else if (KeyIdx == 1) - csr1.field.Bss1Key1CipherAlg = CipherAlg; - else if (KeyIdx == 2) - csr1.field.Bss1Key2CipherAlg = CipherAlg; - else - csr1.field.Bss1Key3CipherAlg = CipherAlg; + *MsgType = (pFrame->Octet[0]&0x7F); } - RTMP_IO_WRITE32(pAd, SHARED_KEY_MODE_BASE + 4 * (BssIndex / 2), csr1.word); + break; + default: + return FALSE; + break; } - DBGPRINT(RT_DEBUG_TRACE, ("<== AsicAddKeyEntry\n")); + return TRUE; } +// =========================================================================================== +// state_machine.c +// =========================================================================================== -/* - ======================================================================== - Description: - Add Pair-wise key material into ASIC. - Update pairwise key, TxMic and RxMic to Asic Pair-wise key table +/*! \brief Initialize the state machine. + * \param *S pointer to the state machine + * \param Trans State machine transition function + * \param StNr number of states + * \param MsgNr number of messages + * \param DefFunc default function, when there is invalid state/message combination + * \param InitState initial state of the state machine + * \param Base StateMachine base, internal use only + * \pre p_sm should be a legal pointer + * \post - Return: - ======================================================================== -*/ -VOID AsicAddPairwiseKeyEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR WCID, - IN CIPHER_KEY *pCipherKey) + IRQL = PASSIVE_LEVEL + + */ +VOID StateMachineInit( + IN STATE_MACHINE *S, + IN STATE_MACHINE_FUNC Trans[], + IN ULONG StNr, + IN ULONG MsgNr, + IN STATE_MACHINE_FUNC DefFunc, + IN ULONG InitState, + IN ULONG Base) { - INT i; - ULONG offset; - PUCHAR pKey = pCipherKey->Key; - PUCHAR pTxMic = pCipherKey->TxMic; - PUCHAR pRxMic = pCipherKey->RxMic; -#ifdef DBG - UCHAR CipherAlg = pCipherKey->CipherAlg; -#endif // DBG // - - // EKEY - offset = PAIRWISE_KEY_TABLE_BASE + (WCID * HW_KEY_ENTRY_SIZE); -#ifdef RT2860 - for (i=0; iKey[0], MAX_LEN_OF_PEER_KEY); -#endif // RT2870 // - for (i=0; iNrState = StNr; + S->NrMsg = MsgNr; + S->Base = Base; - // MIC KEY - if (pTxMic) - { -#ifdef RT2860 - for (i=0; i<8; i++) - { - RTMP_IO_WRITE8(pAd, offset+i, pTxMic[i]); - } -#endif -#ifdef RT2870 - RTUSBMultiWrite(pAd, offset, &pCipherKey->TxMic[0], 8); -#endif // RT2870 // - } - offset += 8; - if (pRxMic) + S->TransFunc = Trans; + + // init all state transition to default function + for (i = 0; i < StNr; i++) { -#ifdef RT2860 - for (i=0; i<8; i++) + for (j = 0; j < MsgNr; j++) { - RTMP_IO_WRITE8(pAd, offset+i, pRxMic[i]); + S->TransFunc[i * MsgNr + j] = DefFunc; } -#endif -#ifdef RT2870 - RTUSBMultiWrite(pAd, offset, &pCipherKey->RxMic[0], 8); -#endif // RT2870 // } - DBGPRINT(RT_DEBUG_TRACE,("AsicAddPairwiseKeyEntry: WCID #%d Alg=%s\n",WCID, CipherName[CipherAlg])); - DBGPRINT(RT_DEBUG_TRACE,(" Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", - pKey[0],pKey[1],pKey[2],pKey[3],pKey[4],pKey[5],pKey[6],pKey[7],pKey[8],pKey[9],pKey[10],pKey[11],pKey[12],pKey[13],pKey[14],pKey[15])); - if (pRxMic) - { - DBGPRINT(RT_DEBUG_TRACE, (" Rx MIC Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", - pRxMic[0],pRxMic[1],pRxMic[2],pRxMic[3],pRxMic[4],pRxMic[5],pRxMic[6],pRxMic[7])); - } - if (pTxMic) + // set the starting state + S->CurrState = InitState; +} + +/*! \brief This function fills in the function pointer into the cell in the state machine + * \param *S pointer to the state machine + * \param St state + * \param Msg incoming message + * \param f the function to be executed when (state, message) combination occurs at the state machine + * \pre *S should be a legal pointer to the state machine, st, msg, should be all within the range, Base should be set in the initial state + * \post + + IRQL = PASSIVE_LEVEL + + */ +VOID StateMachineSetAction( + IN STATE_MACHINE *S, + IN ULONG St, + IN ULONG Msg, + IN STATE_MACHINE_FUNC Func) +{ + ULONG MsgIdx; + + MsgIdx = Msg - S->Base; + + if (St < S->NrState && MsgIdx < S->NrMsg) { - DBGPRINT(RT_DEBUG_TRACE, (" Tx MIC Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", - pTxMic[0],pTxMic[1],pTxMic[2],pTxMic[3],pTxMic[4],pTxMic[5],pTxMic[6],pTxMic[7])); + // boundary checking before setting the action + S->TransFunc[St * S->NrMsg + MsgIdx] = Func; } } + +/*! \brief This function does the state transition + * \param *Adapter the NIC adapter pointer + * \param *S the state machine + * \param *Elem the message to be executed + * \return None + + IRQL = DISPATCH_LEVEL + + */ +VOID StateMachinePerformAction( + IN PRTMP_ADAPTER pAd, + IN STATE_MACHINE *S, + IN MLME_QUEUE_ELEM *Elem) +{ + (*(S->TransFunc[S->CurrState * S->NrMsg + Elem->MsgType - S->Base]))(pAd, Elem); +} + /* - ======================================================================== + ========================================================================== Description: - Remove Pair-wise key material from ASIC. - - Return: - ======================================================================== -*/ -VOID AsicRemovePairwiseKeyEntry( + The drop function, when machine executes this, the message is simply + ignored. This function does nothing, the message is freed in + StateMachinePerformAction() + ========================================================================== + */ +VOID Drop( IN PRTMP_ADAPTER pAd, - IN UCHAR BssIdx, - IN UCHAR Wcid) + IN MLME_QUEUE_ELEM *Elem) { - ULONG WCIDAttri; - USHORT offset; - - // re-set the entry's WCID attribute as OPEN-NONE. - offset = MAC_WCID_ATTRIBUTE_BASE + (Wcid * HW_WCID_ATTRI_SIZE); - WCIDAttri = (BssIdx<<4) | PAIRWISEKEYTABLE; - RTMP_IO_WRITE32(pAd, offset, WCIDAttri); } -BOOLEAN AsicSendCommandToMcu( - IN PRTMP_ADAPTER pAd, - IN UCHAR Command, - IN UCHAR Token, - IN UCHAR Arg0, - IN UCHAR Arg1) -{ - HOST_CMD_CSR_STRUC H2MCmd; - H2M_MAILBOX_STRUC H2MMailbox; - ULONG i = 0; - - do - { - RTMP_IO_READ32(pAd, H2M_MAILBOX_CSR, &H2MMailbox.word); - if (H2MMailbox.field.Owner == 0) - break; - - RTMPusecDelay(2); - } while(i++ < 100); - - if (i > 100) - { - { -#ifdef RT2860 - UINT32 Data; - - // Reset DMA - RTMP_IO_READ32(pAd, PBF_SYS_CTRL, &Data); - Data |= 0x2; - RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, Data); - - // After Reset DMA, DMA index will become Zero. So Driver need to reset all ring indexs too. - // Reset DMA/CPU ring index - RTMPRingCleanUp(pAd, QID_AC_BK); - RTMPRingCleanUp(pAd, QID_AC_BE); - RTMPRingCleanUp(pAd, QID_AC_VI); - RTMPRingCleanUp(pAd, QID_AC_VO); - RTMPRingCleanUp(pAd, QID_HCCA); - RTMPRingCleanUp(pAd, QID_MGMT); - RTMPRingCleanUp(pAd, QID_RX); - - // Clear Reset - RTMP_IO_READ32(pAd, PBF_SYS_CTRL, &Data); - Data &= 0xfffffffd; - RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, Data); -#endif /* RT2860 */ - DBGPRINT_ERR(("H2M_MAILBOX still hold by MCU. command fail\n")); - } - //return FALSE; -#ifdef RT2870 - return FALSE; -#endif - } - - H2MMailbox.field.Owner = 1; // pass ownership to MCU - H2MMailbox.field.CmdToken = Token; - H2MMailbox.field.HighByte = Arg1; - H2MMailbox.field.LowByte = Arg0; - RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CSR, H2MMailbox.word); - - H2MCmd.word = 0; - H2MCmd.field.HostCommand = Command; - RTMP_IO_WRITE32(pAd, HOST_CMD_CSR, H2MCmd.word); +// =========================================================================================== +// lfsr.c +// =========================================================================================== - if (Command != 0x80) - { - } +/* + ========================================================================== + Description: - return TRUE; -} + IRQL = PASSIVE_LEVEL -#ifdef RT2860 -BOOLEAN AsicCheckCommanOk( + ========================================================================== + */ +VOID LfsrInit( IN PRTMP_ADAPTER pAd, - IN UCHAR Command) + IN ULONG Seed) { - UINT32 CmdStatus = 0, CID = 0, i; - UINT32 ThisCIDMask = 0; + if (Seed == 0) + pAd->Mlme.ShiftReg = 1; + else + pAd->Mlme.ShiftReg = Seed; +} - i = 0; - do - { - RTMP_IO_READ32(pAd, H2M_MAILBOX_CID, &CID); - // Find where the command is. Because this is randomly specified by firmware. - if ((CID & CID0MASK) == Command) - { - ThisCIDMask = CID0MASK; - break; - } - else if ((((CID & CID1MASK)>>8) & 0xff) == Command) - { - ThisCIDMask = CID1MASK; - break; - } - else if ((((CID & CID2MASK)>>16) & 0xff) == Command) - { - ThisCIDMask = CID2MASK; - break; - } - else if ((((CID & CID3MASK)>>24) & 0xff) == Command) - { - ThisCIDMask = CID3MASK; - break; - } +/* + ========================================================================== + Description: + ========================================================================== + */ +UCHAR RandomByte( + IN PRTMP_ADAPTER pAd) +{ + ULONG i; + UCHAR R, Result; - RTMPusecDelay(100); - i++; - }while (i < 200); + R = 0; - // Get CommandStatus Value - RTMP_IO_READ32(pAd, H2M_MAILBOX_STATUS, &CmdStatus); + if (pAd->Mlme.ShiftReg == 0) + NdisGetSystemUpTime((ULONG *)&pAd->Mlme.ShiftReg); - // This command's status is at the same position as command. So AND command position's bitmask to read status. - if (i < 200) + for (i = 0; i < 8; i++) { - // If Status is 1, the comamnd is success. - if (((CmdStatus & ThisCIDMask) == 0x1) || ((CmdStatus & ThisCIDMask) == 0x100) - || ((CmdStatus & ThisCIDMask) == 0x10000) || ((CmdStatus & ThisCIDMask) == 0x1000000)) + if (pAd->Mlme.ShiftReg & 0x00000001) { - DBGPRINT(RT_DEBUG_TRACE, ("--> AsicCheckCommanOk CID = 0x%x, CmdStatus= 0x%x \n", CID, CmdStatus)); - RTMP_IO_WRITE32(pAd, H2M_MAILBOX_STATUS, 0xffffffff); - RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CID, 0xffffffff); - return TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("--> AsicCheckCommanFail1 CID = 0x%x, CmdStatus= 0x%x \n", CID, CmdStatus)); + pAd->Mlme.ShiftReg = ((pAd->Mlme.ShiftReg ^ LFSR_MASK) >> 1) | 0x80000000; + Result = 1; } else { - DBGPRINT(RT_DEBUG_TRACE, ("--> AsicCheckCommanFail2 Timeout Command = %d, CmdStatus= 0x%x \n", Command, CmdStatus)); + pAd->Mlme.ShiftReg = pAd->Mlme.ShiftReg >> 1; + Result = 0; + } + R = (R << 1) | Result; } - // Clear Command and Status. - RTMP_IO_WRITE32(pAd, H2M_MAILBOX_STATUS, 0xffffffff); - RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CID, 0xffffffff); - return FALSE; + return R; } -#endif /* RT8260 */ + /* ======================================================================== @@ -7993,55 +5467,6 @@ CHAR RTMPMaxRssi( return larger; } -#ifdef RT2870 -// Antenna divesity use GPIO3 and EESK pin for control -// Antenna and EEPROM access are both using EESK pin, -// Therefor we should avoid accessing EESK at the same time -// Then restore antenna after EEPROM access -VOID AsicSetRxAnt( - IN PRTMP_ADAPTER pAd, - IN UCHAR Ant) -{ - UINT32 Value; - UINT32 x; - - if ((pAd->EepromAccess) || - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) || - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) || - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) || - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) - { - return; - } - - // the antenna selection is through firmware and MAC register(GPIO3) - if (Ant == 0) - { - // Main antenna - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - x |= (EESK); - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - - RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value); - Value &= ~(0x0808); - RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to main antenna\n")); - } - else - { - // Aux antenna - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - x &= ~(EESK); - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - - RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value); - Value &= ~(0x0808); - Value |= 0x08; - RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to aux antenna\n")); - } -} -#endif /* ======================================================================== @@ -8065,39 +5490,21 @@ VOID AsicEvaluateRxAnt( fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_RADIO_OFF | fRTMP_ADAPTER_NIC_NOT_EXIST | - fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS) - || OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) -#ifdef RT2870 + fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS) || + OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) +#ifdef RT30xx || (pAd->EepromAccess) -#endif +#endif // RT30xx // ) return; -#ifdef RT30xx - // two antenna selection mechanism- one is antenna diversity, the other is failed antenna remove - // one is antenna diversity:there is only one antenna can rx and tx - // the other is failed antenna remove:two physical antenna can rx and tx - if (pAd->NicConfig2.field.AntDiversity) - { - DBGPRINT(RT_DEBUG_TRACE,("AntDiv - before evaluate Pair1-Ant (%d,%d)\n", - pAd->RxAnt.Pair1PrimaryRxAnt, pAd->RxAnt.Pair1SecondaryRxAnt)); - - AsicSetRxAnt(pAd, pAd->RxAnt.Pair1SecondaryRxAnt); - pAd->RxAnt.EvaluatePeriod = 1; // 1:Means switch to SecondaryRxAnt, 0:Means switch to Pair1PrimaryRxAnt - pAd->RxAnt.FirstPktArrivedWhenEvaluate = FALSE; - pAd->RxAnt.RcvPktNumWhenEvaluate = 0; + { + //if (pAd->StaCfg.Psm == PWR_SAVE) + // return; - // a one-shot timer to end the evalution - // dynamic adjust antenna evaluation period according to the traffic - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - RTMPSetTimer(&pAd->Mlme.RxAntEvalTimer, 100); - else - RTMPSetTimer(&pAd->Mlme.RxAntEvalTimer, 300); - } - else -#endif { + if (pAd->StaCfg.Psm == PWR_SAVE) return; @@ -8116,12 +5523,9 @@ VOID AsicEvaluateRxAnt( BBPR3 |= (0x0); } RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBPR3); - -#ifdef RT2860 +#ifdef RTMP_MAC_PCI pAd->StaCfg.BBPR3 = BBPR3; -#endif - } - +#endif // RTMP_MAC_PCI // if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) ) { @@ -8141,6 +5545,11 @@ VOID AsicEvaluateRxAnt( pAd->Mlme.bLowThroughput = TRUE; } } + } + + } + + } /* @@ -8169,48 +5578,17 @@ VOID AsicRxAntEvalTimeout( if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_RADIO_OFF | - fRTMP_ADAPTER_NIC_NOT_EXIST) - || OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) -#ifdef RT2870 + fRTMP_ADAPTER_NIC_NOT_EXIST) || + OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) +#ifdef RT30xx || (pAd->EepromAccess) -#endif +#endif // RT30xx // ) return; { -#ifdef RT30xx - if (pAd->NicConfig2.field.AntDiversity) - { - if ((pAd->RxAnt.RcvPktNumWhenEvaluate != 0) && (pAd->RxAnt.Pair1AvgRssi[pAd->RxAnt.Pair1SecondaryRxAnt] >= pAd->RxAnt.Pair1AvgRssi[pAd->RxAnt.Pair1PrimaryRxAnt])) - { - UCHAR temp; - - // - // select PrimaryRxAntPair - // Role change, Used Pair1SecondaryRxAnt as PrimaryRxAntPair. - // Since Pair1SecondaryRxAnt Quality good than Pair1PrimaryRxAnt - // - temp = pAd->RxAnt.Pair1PrimaryRxAnt; - pAd->RxAnt.Pair1PrimaryRxAnt = pAd->RxAnt.Pair1SecondaryRxAnt; - pAd->RxAnt.Pair1SecondaryRxAnt = temp; - - pAd->RxAnt.Pair1LastAvgRssi = (pAd->RxAnt.Pair1AvgRssi[pAd->RxAnt.Pair1SecondaryRxAnt] >> 3); - pAd->RxAnt.EvaluateStableCnt = 0; - } - else - { - // if the evaluated antenna is not better than original, switch back to original antenna - AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); - pAd->RxAnt.EvaluateStableCnt ++; - } - - pAd->RxAnt.EvaluatePeriod = 0; // 1:Means switch to SecondaryRxAnt, 0:Means switch to Pair1PrimaryRxAnt - - DBGPRINT(RT_DEBUG_TRACE,("AsicRxAntEvalAction::After Eval(fix in #%d), <%d, %d>, RcvPktNumWhenEvaluate=%ld\n", - pAd->RxAnt.Pair1PrimaryRxAnt, (pAd->RxAnt.Pair1AvgRssi[0] >> 3), (pAd->RxAnt.Pair1AvgRssi[1] >> 3), pAd->RxAnt.RcvPktNumWhenEvaluate)); - } - else -#endif + //if (pAd->StaCfg.Psm == PWR_SAVE) + // return; { if (pAd->StaCfg.Psm == PWR_SAVE) return; @@ -8261,13 +5639,16 @@ VOID AsicRxAntEvalTimeout( BBPR3 |= (0x0); } RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBPR3); -#ifdef RT2860 +#ifdef RTMP_MAC_PCI pAd->StaCfg.BBPR3 = BBPR3; -#endif +#endif // RTMP_MAC_PCI // } } + + } + VOID APSDPeriodicExec( IN PVOID SystemSpecific1, IN PVOID FunctionContext, @@ -8281,6 +5662,18 @@ VOID APSDPeriodicExec( pAd->CommonCfg.TriggerTimerCount++; +// Driver should not send trigger frame, it should be send by application layer +/* + if (pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable + && (pAd->CommonCfg.bNeedSendTriggerFrame || + (((pAd->CommonCfg.TriggerTimerCount%20) == 19) && (!pAd->CommonCfg.bAPSDAC_BE || !pAd->CommonCfg.bAPSDAC_BK || !pAd->CommonCfg.bAPSDAC_VI || !pAd->CommonCfg.bAPSDAC_VO)))) + { + DBGPRINT(RT_DEBUG_TRACE,("Sending trigger frame and enter service period when support APSD\n")); + RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, TRUE); + pAd->CommonCfg.bNeedSendTriggerFrame = FALSE; + pAd->CommonCfg.TriggerTimerCount = 0; + pAd->CommonCfg.bInServicePeriod = TRUE; + }*/ } /* @@ -8347,9 +5740,10 @@ BOOLEAN RTMPCheckEntryEnableAutoRateSwitch( BOOLEAN RTMPAutoRateSwitchCheck( IN PRTMP_ADAPTER pAd) { + { if (pAd->StaCfg.bAutoTxRateSwitch) return TRUE; - + } return FALSE; } @@ -8375,7 +5769,9 @@ UCHAR RTMPStaFixedTxMode( { UCHAR tx_mode = FIXED_TXMODE_HT; + { tx_mode = (UCHAR)pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode; + } return tx_mode; } @@ -8462,12 +5858,10 @@ VOID AsicStaBbpTuning( && (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) ) && !(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) -#ifdef RT2860 - && (pAd->bPCIclkOff == FALSE)) -#endif -#ifdef RT2870 +#ifdef RTMP_MAC_PCI + && (pAd->bPCIclkOff == FALSE) +#endif // RTMP_MAC_PCI // ) -#endif { RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R66, &OrigR66Value); R66 = OrigR66Value; @@ -8479,26 +5873,31 @@ VOID AsicStaBbpTuning( if (pAd->LatchRfRegs.Channel <= 14) { //BG band -#ifdef RT2870 +#ifdef RT30xx // RT3070 is a no LNA solution, it should have different control regarding to AGC gain control // Otherwise, it will have some throughput side effect when low RSSI - if (IS_RT30xx(pAd)) + + if (IS_RT3070(pAd)||IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) { if (Rssi > RSSI_FOR_MID_LOW_SENSIBILITY) { R66 = 0x1C + 2*GET_LNA_GAIN(pAd) + 0x20; if (OrigR66Value != R66) + { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); } + } else { R66 = 0x1C + 2*GET_LNA_GAIN(pAd); if (OrigR66Value != R66) + { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); } } + } else -#endif // RT2870 // +#endif // RT30xx // { if (Rssi > RSSI_FOR_MID_LOW_SENSIBILITY) { @@ -8564,108 +5963,6 @@ VOID AsicStaBbpTuning( } } -#ifdef RT2860 -VOID AsicResetFromDMABusy( - IN PRTMP_ADAPTER pAd) -{ - UINT32 Data; - BOOLEAN bCtrl = FALSE; - - DBGPRINT(RT_DEBUG_TRACE, ("---> AsicResetFromDMABusy !!!!!!!!!!!!!!!!!!!!!!! \n")); - - // Be sure restore link control value so we can write register. - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); - if (RTMP_TEST_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND)) - { - DBGPRINT(RT_DEBUG_TRACE,("AsicResetFromDMABusy==>\n")); - RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_HALT); - RTMPusecDelay(6000); - pAd->bPCIclkOff = FALSE; - bCtrl = TRUE; - } - // Reset DMA - RTMP_IO_READ32(pAd, PBF_SYS_CTRL, &Data); - Data |= 0x2; - RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, Data); - - // After Reset DMA, DMA index will become Zero. So Driver need to reset all ring indexs too. - // Reset DMA/CPU ring index - RTMPRingCleanUp(pAd, QID_AC_BK); - RTMPRingCleanUp(pAd, QID_AC_BE); - RTMPRingCleanUp(pAd, QID_AC_VI); - RTMPRingCleanUp(pAd, QID_AC_VO); - RTMPRingCleanUp(pAd, QID_HCCA); - RTMPRingCleanUp(pAd, QID_MGMT); - RTMPRingCleanUp(pAd, QID_RX); - - // Clear Reset - RTMP_IO_READ32(pAd, PBF_SYS_CTRL, &Data); - Data &= 0xfffffffd; - RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, Data); - - // If in Radio off, should call RTMPPCIePowerLinkCtrl again. - if ((bCtrl == TRUE) && (pAd->StaCfg.bRadio == FALSE)) - RTMPPCIeLinkCtrlSetting(pAd, 3); - - RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_HALT_IN_PROGRESS); - DBGPRINT(RT_DEBUG_TRACE, ("<--- AsicResetFromDMABusy !!!!!!!!!!!!!!!!!!!!!!! \n")); -} - -VOID AsicResetBBP( - IN PRTMP_ADAPTER pAd) -{ - DBGPRINT(RT_DEBUG_TRACE, ("---> Asic HardReset BBP !!!!!!!!!!!!!!!!!!!!!!! \n")); - - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x0); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x2); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0xc); - - // After hard-reset BBP, initialize all BBP values. - NICRestoreBBPValue(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("<--- Asic HardReset BBP !!!!!!!!!!!!!!!!!!!!!!! \n")); -} - -VOID AsicResetMAC( - IN PRTMP_ADAPTER pAd) -{ - ULONG Data; - - DBGPRINT(RT_DEBUG_TRACE, ("---> AsicResetMAC !!!! \n")); - RTMP_IO_READ32(pAd, PBF_SYS_CTRL, &Data); - Data |= 0x4; - RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, Data); - Data &= 0xfffffffb; - RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, Data); - - DBGPRINT(RT_DEBUG_TRACE, ("<--- AsicResetMAC !!!! \n")); -} - -VOID AsicResetPBF( - IN PRTMP_ADAPTER pAd) -{ - ULONG Value1, Value2; - ULONG Data; - - RTMP_IO_READ32(pAd, TXRXQ_PCNT, &Value1); - RTMP_IO_READ32(pAd, PBF_DBG, &Value2); - - Value2 &= 0xff; - // sum should be equals to 0xff, which is the total buffer size. - if ((Value1 + Value2) < 0xff) - { - DBGPRINT(RT_DEBUG_TRACE, ("---> Asic HardReset PBF !!!! \n")); - RTMP_IO_READ32(pAd, PBF_SYS_CTRL, &Data); - Data |= 0x8; - RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, Data); - Data &= 0xfffffff7; - RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, Data); - - DBGPRINT(RT_DEBUG_TRACE, ("<--- Asic HardReset PBF !!!! \n")); - } -} -#endif /* RT2860 */ - VOID RTMPSetAGCInitValue( IN PRTMP_ADAPTER pAd, IN UCHAR BandWidth) @@ -8674,11 +5971,24 @@ VOID RTMPSetAGCInitValue( if (pAd->LatchRfRegs.Channel <= 14) { // BG band +#ifdef RT30xx + /* Gary was verified Amazon AP and find that RT307x has BBP_R66 invalid default value */ + + if (IS_RT3070(pAd)||IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) + { + R66 = 0x1C + 2*GET_LNA_GAIN(pAd); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); + } + else +#endif // RT30xx // + { R66 = 0x2E + GET_LNA_GAIN(pAd); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); } + } else { //A band + { if (BandWidth == BW_20) { R66 = (UCHAR)(0x32 + (GET_LNA_GAIN(pAd)*5)/3); @@ -8690,133 +6000,7 @@ VOID RTMPSetAGCInitValue( RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); } } - -} - -VOID AsicTurnOffRFClk( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel) -{ - - // RF R2 bit 18 = 0 - UINT32 R1 = 0, R2 = 0, R3 = 0; - UCHAR index; - RTMP_RF_REGS *RFRegTable; - - // The RF programming sequence is difference between 3xxx and 2xxx - if (IS_RT3090(pAd)) - { - RT30xxLoadRFSleepModeSetup(pAd); // add by johnli, RF power sequence setup, load RF sleep-mode setup - return; - } - - RFRegTable = RF2850RegTable; - - switch (pAd->RfIcType) - { - case RFIC_2820: - case RFIC_2850: - case RFIC_2720: - case RFIC_2750: - - for (index = 0; index < NUM_OF_2850_CHNL; index++) - { - if (Channel == RFRegTable[index].Channel) - { - R1 = RFRegTable[index].R1 & 0xffffdfff; - R2 = RFRegTable[index].R2 & 0xfffbffff; - R3 = RFRegTable[index].R3 & 0xfff3ffff; - - RTMP_RF_IO_WRITE32(pAd, R1); - RTMP_RF_IO_WRITE32(pAd, R2); - - // Program R1b13 to 1, R3/b18,19 to 0, R2b18 to 0. - // Set RF R2 bit18=0, R3 bit[18:19]=0 - //if (pAd->StaCfg.bRadio == FALSE) - if (1) - { - RTMP_RF_IO_WRITE32(pAd, R3); - - DBGPRINT(RT_DEBUG_TRACE, ("AsicTurnOffRFClk#%d(RF=%d, ) , R2=0x%08x, R3 = 0x%08x \n", - Channel, pAd->RfIcType, R2, R3)); - } - else - DBGPRINT(RT_DEBUG_TRACE, ("AsicTurnOffRFClk#%d(RF=%d, ) , R2=0x%08x \n", - Channel, pAd->RfIcType, R2)); - break; - } - } - break; - - default: - break; - } -} - - -VOID AsicTurnOnRFClk( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel) -{ - - // RF R2 bit 18 = 0 - UINT32 R1 = 0, R2 = 0, R3 = 0; - UCHAR index; - RTMP_RF_REGS *RFRegTable; - - // The RF programming sequence is difference between 3xxx and 2xxx - if (IS_RT3090(pAd)) - return; - - RFRegTable = RF2850RegTable; - - switch (pAd->RfIcType) - { - case RFIC_2820: - case RFIC_2850: - case RFIC_2720: - case RFIC_2750: - - for (index = 0; index < NUM_OF_2850_CHNL; index++) - { - if (Channel == RFRegTable[index].Channel) - { - R3 = pAd->LatchRfRegs.R3; - R3 &= 0xfff3ffff; - R3 |= 0x00080000; - RTMP_RF_IO_WRITE32(pAd, R3); - - R1 = RFRegTable[index].R1; - RTMP_RF_IO_WRITE32(pAd, R1); - - R2 = RFRegTable[index].R2; - if (pAd->Antenna.field.TxPath == 1) - { - R2 |= 0x4000; // If TXpath is 1, bit 14 = 1; - } - - if (pAd->Antenna.field.RxPath == 2) - { - R2 |= 0x40; // write 1 to off Rxpath. - } - else if (pAd->Antenna.field.RxPath == 1) - { - R2 |= 0x20040; // write 1 to off RxPath - } - RTMP_RF_IO_WRITE32(pAd, R2); - - break; - } - } - break; - - default: - break; } - DBGPRINT(RT_DEBUG_TRACE, ("AsicTurnOnRFClk#%d(RF=%d, ) , R2=0x%08x\n", - Channel, - pAd->RfIcType, - R2)); } diff --git a/drivers/staging/rt2860/common/rt_channel.c b/drivers/staging/rt2860/common/rt_channel.c new file mode 100644 index 000000000000..06b51a01289d --- /dev/null +++ b/drivers/staging/rt2860/common/rt_channel.c @@ -0,0 +1,1280 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* +*/ +#include "../rt_config.h" + + +CH_FREQ_MAP CH_HZ_ID_MAP[]= + { + {1, 2412}, + {2, 2417}, + {3, 2422}, + {4, 2427}, + {5, 2432}, + {6, 2437}, + {7, 2442}, + {8, 2447}, + {9, 2452}, + {10, 2457}, + {11, 2462}, + {12, 2467}, + {13, 2472}, + {14, 2484}, + + /* UNII */ + {36, 5180}, + {40, 5200}, + {44, 5220}, + {48, 5240}, + {52, 5260}, + {56, 5280}, + {60, 5300}, + {64, 5320}, + {149, 5745}, + {153, 5765}, + {157, 5785}, + {161, 5805}, + {165, 5825}, + {167, 5835}, + {169, 5845}, + {171, 5855}, + {173, 5865}, + + /* HiperLAN2 */ + {100, 5500}, + {104, 5520}, + {108, 5540}, + {112, 5560}, + {116, 5580}, + {120, 5600}, + {124, 5620}, + {128, 5640}, + {132, 5660}, + {136, 5680}, + {140, 5700}, + + /* Japan MMAC */ + {34, 5170}, + {38, 5190}, + {42, 5210}, + {46, 5230}, + + /* Japan */ + {184, 4920}, + {188, 4940}, + {192, 4960}, + {196, 4980}, + + {208, 5040}, /* Japan, means J08 */ + {212, 5060}, /* Japan, means J12 */ + {216, 5080}, /* Japan, means J16 */ +}; + +INT CH_HZ_ID_MAP_NUM = (sizeof(CH_HZ_ID_MAP)/sizeof(CH_FREQ_MAP)); + +CH_REGION ChRegion[] = +{ + { // Antigua and Berbuda + "AG", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Argentina + "AR", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 + { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Aruba + "AW", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Australia + "AU", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 + { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 + { 0}, // end + } + }, + + { // Austria + "AT", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, TRUE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Bahamas + "BS", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 + { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 + { 0}, // end + } + }, + + { // Barbados + "BB", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Bermuda + "BM", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Brazil + "BR", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 + { 100, 11, 24, BOTH, FALSE}, // 5G, ch 100~140 + { 149, 5, 30, BOTH, FALSE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Belgium + "BE", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 18, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 18, IDOR, FALSE}, // 5G, ch 52~64 + { 0}, // end + } + }, + + { // Bulgaria + "BG", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, ODOR, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Canada + "CA", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 + { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 + { 0}, // end + } + }, + + { // Cayman IsLands + "KY", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Chile + "CL", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 20, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 20, BOTH, FALSE}, // 5G, ch 52~64 + { 149, 5, 20, BOTH, FALSE}, // 5G, ch 149~165 + { 0}, // end + } + }, + + { // China + "CN", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Colombia + "CO", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 + { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 + { 0}, // end + } + }, + + { // Costa Rica + "CR", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 + { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Cyprus + "CY", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 24, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Czech_Republic + "CZ", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 0}, // end + } + }, + + { // Denmark + "DK", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Dominican Republic + "DO", + CE, + { + { 1, 0, 20, BOTH, FALSE}, // 2.4 G, ch 0 + { 149, 4, 20, BOTH, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Equador + "EC", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 100, 11, 27, BOTH, FALSE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // El Salvador + "SV", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 30, BOTH, TRUE}, // 5G, ch 52~64 + { 149, 4, 36, BOTH, TRUE}, // 5G, ch 149~165 + { 0}, // end + } + }, + + { // Finland + "FI", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // France + "FR", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 0}, // end + } + }, + + { // Germany + "DE", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Greece + "GR", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, ODOR, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Guam + "GU", + CE, + { + { 1, 11, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 + { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 + { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 + { 0}, // end + } + }, + + { // Guatemala + "GT", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 + { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Haiti + "HT", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 + { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Honduras + "HN", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Hong Kong + "HK", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, FALSE}, // 5G, ch 52~64 + { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Hungary + "HU", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 0}, // end + } + }, + + { // Iceland + "IS", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // India + "IN", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 149, 4, 24, IDOR, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Indonesia + "ID", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Ireland + "IE", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, ODOR, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Israel + "IL", + CE, + { + { 1, 3, 20, IDOR, FALSE}, // 2.4 G, ch 1~3 + { 4, 6, 20, BOTH, FALSE}, // 2.4 G, ch 4~9 + { 10, 4, 20, IDOR, FALSE}, // 2.4 G, ch 10~13 + { 0}, // end + } + }, + + { // Italy + "IT", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, ODOR, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Japan + "JP", + JAP, + { + { 1, 14, 20, BOTH, FALSE}, // 2.4 G, ch 1~14 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 0}, // end + } + }, + + { // Jordan + "JO", + CE, + { + { 1, 13, 20, IDOR, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 149, 4, 23, IDOR, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Latvia + "LV", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Liechtenstein + "LI", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Lithuania + "LT", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Luxemburg + "LU", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Malaysia + "MY", + CE, + { + { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 + { 149, 5, 20, BOTH, FALSE}, // 5G, ch 149~165 + { 0}, // end + } + }, + + { // Malta + "MT", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Marocco + "MA", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 24, IDOR, FALSE}, // 5G, ch 36~48 + { 0}, // end + } + }, + + { // Mexico + "MX", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 + { 149, 5, 30, IDOR, FALSE}, // 5G, ch 149~165 + { 0}, // end + } + }, + + { // Netherlands + "NL", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 24, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // New Zealand + "NZ", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 24, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 + { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Norway + "NO", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 24, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 24, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Peru + "PE", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Portugal + "PT", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Poland + "PL", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Romania + "RO", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Russia + "RU", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 149, 4, 20, IDOR, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Saudi Arabia + "SA", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 + { 149, 4, 23, BOTH, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Serbia_and_Montenegro + "CS", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 0}, // end + } + }, + + { // Singapore + "SG", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 + { 149, 4, 20, BOTH, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Slovakia + "SK", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Slovenia + "SI", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 0}, // end + } + }, + + { // South Africa + "ZA", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, FALSE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // South Korea + "KR", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 20, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 20, BOTH, FALSE}, // 5G, ch 52~64 + { 100, 8, 20, BOTH, FALSE}, // 5G, ch 100~128 + { 149, 4, 20, BOTH, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Spain + "ES", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 17, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Sweden + "SE", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Switzerland + "CH", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 + { 36, 4, 23, IDOR, TRUE}, // 5G, ch 36~48 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 0}, // end + } + }, + + { // Taiwan + "TW", + CE, + { + { 1, 11, 30, BOTH, FALSE}, // 2.4 G, ch 1~11 + { 52, 4, 23, IDOR, FALSE}, // 5G, ch 52~64 + { 0}, // end + } + }, + + { // Turkey + "TR", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 + { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 + { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 + { 0}, // end + } + }, + + { // UK + "GB", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 + { 36, 4, 23, IDOR, FALSE}, // 5G, ch 52~64 + { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 0}, // end + } + }, + + { // Ukraine + "UA", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 + { 0}, // end + } + }, + + { // United_Arab_Emirates + "AE", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 + { 0}, // end + } + }, + + { // United_States + "US", + CE, + { + { 1, 11, 30, BOTH, FALSE}, // 2.4 G, ch 1~11 + { 36, 4, 17, IDOR, FALSE}, // 5G, ch 52~64 + { 52, 4, 24, BOTH, TRUE}, // 5G, ch 52~64 + { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 + { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 + { 0}, // end + } + }, + + { // Venezuela + "VE", + CE, + { + { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 + { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 + { 0}, // end + } + }, + + { // Default + "", + CE, + { + { 1, 11, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 + { 36, 4, 20, BOTH, FALSE}, // 5G, ch 52~64 + { 52, 4, 20, BOTH, FALSE}, // 5G, ch 52~64 + { 100, 11, 20, BOTH, FALSE}, // 5G, ch 100~140 + { 149, 5, 20, BOTH, FALSE}, // 5G, ch 149~165 + { 0}, // end + } + }, +}; + + +static PCH_REGION GetChRegion( + IN PUCHAR CntryCode) +{ + INT loop = 0; + PCH_REGION pChRegion = NULL; + + while (strcmp((PSTRING) ChRegion[loop].CountReg, "") != 0) + { + if (strncmp((PSTRING) ChRegion[loop].CountReg, (PSTRING) CntryCode, 2) == 0) + { + pChRegion = &ChRegion[loop]; + break; + } + loop++; + } + + if (pChRegion == NULL) + pChRegion = &ChRegion[loop]; + return pChRegion; +} + +static VOID ChBandCheck( + IN UCHAR PhyMode, + OUT PUCHAR pChType) +{ + switch(PhyMode) + { + case PHY_11A: + case PHY_11AN_MIXED: + *pChType = BAND_5G; + break; + case PHY_11ABG_MIXED: + case PHY_11AGN_MIXED: + case PHY_11ABGN_MIXED: + *pChType = BAND_BOTH; + break; + + default: + *pChType = BAND_24G; + break; + } +} + +static UCHAR FillChList( + IN PRTMP_ADAPTER pAd, + IN PCH_DESP pChDesp, + IN UCHAR Offset, + IN UCHAR increment) +{ + INT i, j, l; + UCHAR channel; + + j = Offset; + for (i = 0; i < pChDesp->NumOfCh; i++) + { + channel = pChDesp->FirstChannel + i * increment; + for (l=0; lTxPower[l].Channel) + { + pAd->ChannelList[j].Power = pAd->TxPower[l].Power; + pAd->ChannelList[j].Power2 = pAd->TxPower[l].Power2; + break; + } + } + if (l == MAX_NUM_OF_CHANNELS) + continue; + + pAd->ChannelList[j].Channel = pChDesp->FirstChannel + i * increment; + pAd->ChannelList[j].MaxTxPwr = pChDesp->MaxTxPwr; + pAd->ChannelList[j].DfsReq = pChDesp->DfsReq; + j++; + } + pAd->ChannelListNum = j; + + return j; +} + + +static inline VOID CreateChList( + IN PRTMP_ADAPTER pAd, + IN PCH_REGION pChRegion, + IN UCHAR Geography) +{ + INT i; + UCHAR offset = 0; + PCH_DESP pChDesp; + UCHAR ChType; + UCHAR increment; + + if (pChRegion == NULL) + return; + + ChBandCheck(pAd->CommonCfg.PhyMode, &ChType); + + for (i=0; i<10; i++) + { + pChDesp = &pChRegion->ChDesp[i]; + if (pChDesp->FirstChannel == 0) + break; + + if (ChType == BAND_5G) + { + if (pChDesp->FirstChannel <= 14) + continue; + } + else if (ChType == BAND_24G) + { + if (pChDesp->FirstChannel > 14) + continue; + } + + if ((pChDesp->Geography == BOTH) + || (pChDesp->Geography == Geography)) + { + if (pChDesp->FirstChannel > 14) + increment = 4; + else + increment = 1; + offset = FillChList(pAd, pChDesp, offset, increment); + } + } +} + + +VOID BuildChannelListEx( + IN PRTMP_ADAPTER pAd) +{ + PCH_REGION pChReg; + + pChReg = GetChRegion(pAd->CommonCfg.CountryCode); + CreateChList(pAd, pChReg, pAd->CommonCfg.Geography); +} + + +VOID BuildBeaconChList( + IN PRTMP_ADAPTER pAd, + OUT PUCHAR pBuf, + OUT PULONG pBufLen) +{ + INT i; + ULONG TmpLen; + PCH_REGION pChRegion; + PCH_DESP pChDesp; + UCHAR ChType; + + pChRegion = GetChRegion(pAd->CommonCfg.CountryCode); + + if (pChRegion == NULL) + return; + + ChBandCheck(pAd->CommonCfg.PhyMode, &ChType); + *pBufLen = 0; + + for (i=0; i<10; i++) + { + pChDesp = &pChRegion->ChDesp[i]; + if (pChDesp->FirstChannel == 0) + break; + + if (ChType == BAND_5G) + { + if (pChDesp->FirstChannel <= 14) + continue; + } + else if (ChType == BAND_24G) + { + if (pChDesp->FirstChannel > 14) + continue; + } + + if ((pChDesp->Geography == BOTH) + || (pChDesp->Geography == pAd->CommonCfg.Geography)) + { + MakeOutgoingFrame(pBuf + *pBufLen, &TmpLen, + 1, &pChDesp->FirstChannel, + 1, &pChDesp->NumOfCh, + 1, &pChDesp->MaxTxPwr, + END_OF_ARGS); + *pBufLen += TmpLen; + } + } +} + + +static BOOLEAN IsValidChannel( + IN PRTMP_ADAPTER pAd, + IN UCHAR channel) + +{ + INT i; + + for (i = 0; i < pAd->ChannelListNum; i++) + { + if (pAd->ChannelList[i].Channel == channel) + break; + } + + if (i == pAd->ChannelListNum) + return FALSE; + else + return TRUE; +} + + +static UCHAR GetExtCh( + IN UCHAR Channel, + IN UCHAR Direction) +{ + CHAR ExtCh; + + if (Direction == EXTCHA_ABOVE) + ExtCh = Channel + 4; + else + ExtCh = (Channel - 4) > 0 ? (Channel - 4) : 0; + + return ExtCh; +} + + +VOID N_ChannelCheck( + IN PRTMP_ADAPTER pAd) +{ + //UCHAR ChannelNum = pAd->ChannelListNum; + UCHAR Channel = pAd->CommonCfg.Channel; + + if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)) + { + if (Channel > 14) + { + if ((Channel == 36) || (Channel == 44) || (Channel == 52) || (Channel == 60) || (Channel == 100) || (Channel == 108) || + (Channel == 116) || (Channel == 124) || (Channel == 132) || (Channel == 149) || (Channel == 157)) + { + pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE; + } + else if ((Channel == 40) || (Channel == 48) || (Channel == 56) || (Channel == 64) || (Channel == 104) || (Channel == 112) || + (Channel == 120) || (Channel == 128) || (Channel == 136) || (Channel == 153) || (Channel == 161)) + { + pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW; + } + else + { + pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; + } + } + else + { + do + { + UCHAR ExtCh; + UCHAR Dir = pAd->CommonCfg.RegTransmitSetting.field.EXTCHA; + ExtCh = GetExtCh(Channel, Dir); + if (IsValidChannel(pAd, ExtCh)) + break; + + Dir = (Dir == EXTCHA_ABOVE) ? EXTCHA_BELOW : EXTCHA_ABOVE; + ExtCh = GetExtCh(Channel, Dir); + if (IsValidChannel(pAd, ExtCh)) + { + pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = Dir; + break; + } + pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; + } while(FALSE); + + if (Channel == 14) + { + pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; + //pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_NONE; // We didn't set the ExtCh as NONE due to it'll set in RTMPSetHT() + } + } + } + + +} + + +VOID N_SetCenCh( + IN PRTMP_ADAPTER pAd) +{ + if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40) + { + if (pAd->CommonCfg.RegTransmitSetting.field.EXTCHA == EXTCHA_ABOVE) + { + pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel + 2; + } + else + { + if (pAd->CommonCfg.Channel == 14) + pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel - 1; + else + pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel - 2; + } + } + else + { + pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; + } +} + + +UINT8 GetCuntryMaxTxPwr( + IN PRTMP_ADAPTER pAd, + IN UINT8 channel) +{ + int i; + for (i = 0; i < pAd->ChannelListNum; i++) + { + if (pAd->ChannelList[i].Channel == channel) + break; + } + + if (i == pAd->ChannelListNum) + return 0xff; + else + return pAd->ChannelList[i].MaxTxPwr; +} diff --git a/drivers/staging/rt2860/common/rt_rf.c b/drivers/staging/rt2860/common/rt_rf.c new file mode 100644 index 000000000000..34a6fcae120f --- /dev/null +++ b/drivers/staging/rt2860/common/rt_rf.c @@ -0,0 +1,194 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + rt_rf.c + + Abstract: + Ralink Wireless driver RF related functions + + Revision History: + Who When What + -------- ---------- ---------------------------------------------- +*/ + + +#include "../rt_config.h" + + +#ifdef RTMP_RF_RW_SUPPORT +/* + ======================================================================== + + Routine Description: Write RT30xx RF register through MAC + + Arguments: + + Return Value: + + IRQL = + + Note: + + ======================================================================== +*/ +NDIS_STATUS RT30xxWriteRFRegister( + IN PRTMP_ADAPTER pAd, + IN UCHAR regID, + IN UCHAR value) +{ + RF_CSR_CFG_STRUC rfcsr; + UINT i = 0; + + do + { + RTMP_IO_READ32(pAd, RF_CSR_CFG, &rfcsr.word); + + if (!rfcsr.field.RF_CSR_KICK) + break; + i++; + } + while ((i < RETRY_LIMIT) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); + + if ((i == RETRY_LIMIT) || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) + { + DBGPRINT_RAW(RT_DEBUG_ERROR, ("Retry count exhausted or device removed!!!\n")); + return STATUS_UNSUCCESSFUL; + } + + rfcsr.field.RF_CSR_WR = 1; + rfcsr.field.RF_CSR_KICK = 1; + rfcsr.field.TESTCSR_RFACC_REGNUM = regID; + rfcsr.field.RF_CSR_DATA = value; + + RTMP_IO_WRITE32(pAd, RF_CSR_CFG, rfcsr.word); + + return NDIS_STATUS_SUCCESS; +} + + +/* + ======================================================================== + + Routine Description: Read RT30xx RF register through MAC + + Arguments: + + Return Value: + + IRQL = + + Note: + + ======================================================================== +*/ +NDIS_STATUS RT30xxReadRFRegister( + IN PRTMP_ADAPTER pAd, + IN UCHAR regID, + IN PUCHAR pValue) +{ + RF_CSR_CFG_STRUC rfcsr; + UINT i=0, k=0; + + for (i=0; ichipOps.AsicRfInit) + pAd->chipOps.AsicRfInit(pAd); +} + + +VOID RtmpChipOpsRFHook( + IN RTMP_ADAPTER *pAd) +{ + RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + + pChipOps->pRFRegTable = NULL; + pChipOps->AsicRfInit = NULL; + pChipOps->AsicRfTurnOn = NULL; + pChipOps->AsicRfTurnOff = NULL; + pChipOps->AsicReverseRfFromSleepMode = NULL; + pChipOps->AsicHaltAction = NULL; + /* We depends on RfICType and MACVersion to assign the corresponding operation callbacks. */ + +#ifdef RT30xx + if (IS_RT30xx(pAd)) + { + pChipOps->pRFRegTable = RT30xx_RFRegTable; + pChipOps->AsicHaltAction = RT30xxHaltAction; +#ifdef RT3070 + if((IS_RT3070(pAd) || IS_RT3071(pAd)) && (pAd->infType == RTMP_DEV_INF_USB)) + { + pChipOps->AsicRfInit = NICInitRT3070RFRegisters; + if (IS_RT3071(pAd)) + { + pChipOps->AsicRfTurnOff = RT30xxLoadRFSleepModeSetup; + pChipOps->AsicReverseRfFromSleepMode = RT30xxReverseRFSleepModeSetup; + } + } +#endif // RT3070 // + } +#endif // RT30xx // +} + +#endif // RTMP_RF_RW_SUPPORT // diff --git a/drivers/staging/rt2860/common/rtmp_init.c b/drivers/staging/rt2860/common/rtmp_init.c index 20c2ce26bc9d..1dd4c829291f 100644 --- a/drivers/staging/rt2860/common/rtmp_init.c +++ b/drivers/staging/rt2860/common/rtmp_init.c @@ -33,30 +33,10 @@ Revision History: Who When What -------- ---------- ---------------------------------------------- - Paul Lin 2002-08-01 created - John Chang 2004-08-20 RT2561/2661 use scatter-gather scheme - Jan Lee 2006-09-15 RT2860. Change for 802.11n , EEPROM, Led, BA, HT. */ #include "../rt_config.h" -#ifdef RT2860 -#include "firmware.h" -#include -#endif -#ifdef RT2870 -/* New firmware handles both RT2870 and RT3070. */ -#include "../../rt3070/firmware.h" -#endif UCHAR BIT8[] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80}; -ULONG BIT32[] = {0x00000001, 0x00000002, 0x00000004, 0x00000008, - 0x00000010, 0x00000020, 0x00000040, 0x00000080, - 0x00000100, 0x00000200, 0x00000400, 0x00000800, - 0x00001000, 0x00002000, 0x00004000, 0x00008000, - 0x00010000, 0x00020000, 0x00040000, 0x00080000, - 0x00100000, 0x00200000, 0x00400000, 0x00800000, - 0x01000000, 0x02000000, 0x04000000, 0x08000000, - 0x10000000, 0x20000000, 0x40000000, 0x80000000}; - char* CipherName[] = {"none","wep64","wep128","TKIP","AES","CKIP64","CKIP128"}; // @@ -77,36 +57,10 @@ REG_PAIR BBPRegTable[] = { {BBP_R92, 0x00}, // middle range issue, Rory @2008-01-28 {BBP_R103, 0x00}, // near range high-power issue, requested from Gary @2008-0528 {BBP_R105, 0x05}, // 0x05 is for rt2860E to turn on FEQ control. It is safe for rt2860D and before, because Bit 7:2 are reserved in rt2860D and before. + {BBP_R106, 0x35}, // for ShortGI throughput }; #define NUM_BBP_REG_PARMS (sizeof(BBPRegTable) / sizeof(REG_PAIR)) -// -// RF register initialization set -// -#ifdef RT2870 -REG_PAIR RT30xx_RFRegTable[] = { - {RF_R04, 0x40}, - {RF_R05, 0x03}, - {RF_R06, 0x02}, - {RF_R07, 0x70}, - {RF_R09, 0x0F}, - {RF_R10, 0x41}, - {RF_R11, 0x21}, - {RF_R12, 0x7B}, - {RF_R14, 0x90}, - {RF_R15, 0x58}, - {RF_R16, 0xB3}, - {RF_R17, 0x92}, - {RF_R18, 0x2C}, - {RF_R19, 0x02}, - {RF_R20, 0xBA}, - {RF_R21, 0xDB}, - {RF_R24, 0x16}, - {RF_R25, 0x01}, - {RF_R29, 0x1F}, -}; -#define NUM_RF_REG_PARMS (sizeof(RT30xx_RFRegTable) / sizeof(REG_PAIR)) -#endif // RT2870 // // // ASIC register initialization sets @@ -128,32 +82,37 @@ RTMP_REG_PAIR MACRegTable[] = { {MAC_SYS_CTRL, 0x00}, // 0x1004, , default Disable RX {RX_FILTR_CFG, 0x17f97}, //0x1400 , RX filter control, {BKOFF_SLOT_CFG, 0x209}, // default set short slot time, CC_DELAY_TIME should be 2 + //{TX_SW_CFG0, 0x40a06}, // Gary,2006-08-23 {TX_SW_CFG0, 0x0}, // Gary,2008-05-21 for CWC test {TX_SW_CFG1, 0x80606}, // Gary,2006-08-23 {TX_LINK_CFG, 0x1020}, // Gary,2006-08-23 + //{TX_TIMEOUT_CFG, 0x00182090}, // CCK has some problem. So increase timieout value. 2006-10-09// MArvek RT {TX_TIMEOUT_CFG, 0x000a2090}, // CCK has some problem. So increase timieout value. 2006-10-09// MArvek RT , Modify for 2860E ,2007-08-01 {MAX_LEN_CFG, MAX_AGGREGATION_SIZE | 0x00001000}, // 0x3018, MAX frame length. Max PSDU = 16kbytes. {LED_CFG, 0x7f031e46}, // Gary, 2006-08-23 + {PBF_MAX_PCNT, 0x1F3FBF9F}, //0x1F3f7f9f}, //Jan, 2006/04/20 + {TX_RTY_CFG, 0x47d01f0f}, // Jan, 2006/11/16, Set TxWI->ACK =0 in Probe Rsp Modify for 2860E ,2007-08-03 + {AUTO_RSP_CFG, 0x00000013}, // Initial Auto_Responder, because QA will turn off Auto-Responder {CCK_PROT_CFG, 0x05740003 /*0x01740003*/}, // Initial Auto_Responder, because QA will turn off Auto-Responder. And RTS threshold is enabled. {OFDM_PROT_CFG, 0x05740003 /*0x01740003*/}, // Initial Auto_Responder, because QA will turn off Auto-Responder. And RTS threshold is enabled. -//PS packets use Tx1Q (for HCCA) when dequeue from PS unicast queue (WiFi WPA2 MA9_DT1 for Marvell B STA) -#ifdef RT2870 +#ifdef RTMP_MAC_USB {PBF_CFG, 0xf40006}, // Only enable Queue 2 {MM40_PROT_CFG, 0x3F44084}, // Initial Auto_Responder, because QA will turn off Auto-Responder {WPDMA_GLO_CFG, 0x00000030}, -#endif // RT2870 // +#endif // RTMP_MAC_USB // {GF20_PROT_CFG, 0x01744004}, // set 19:18 --> Short NAV for MIMO PS {GF40_PROT_CFG, 0x03F44084}, {MM20_PROT_CFG, 0x01744004}, -#ifdef RT2860 +#ifdef RTMP_MAC_PCI {MM40_PROT_CFG, 0x03F54084}, -#endif +#endif // RTMP_MAC_PCI // {TXOP_CTRL_CFG, 0x0000583f, /*0x0000243f*/ /*0x000024bf*/}, //Extension channel backoff. {TX_RTS_CFG, 0x00092b20}, {EXP_ACK_TIME, 0x002400ca}, // default value + {TXOP_HLDR_ET, 0x00000002}, /* Jerry comments 2008/01/16: we use SIFS = 10us in CCK defaultly, but it seems that 10us @@ -173,26 +132,6 @@ RTMP_REG_PAIR STAMACRegTable[] = { #define NUM_MAC_REG_PARMS (sizeof(MACRegTable) / sizeof(RTMP_REG_PAIR)) #define NUM_STA_MAC_REG_PARMS (sizeof(STAMACRegTable) / sizeof(RTMP_REG_PAIR)) -#ifdef RT2870 -// -// RT2870 Firmware Spec only used 1 oct for version expression -// -#define FIRMWARE_MINOR_VERSION 7 - -#endif // RT2870 // - -// New 8k byte firmware size for RT3071/RT3072 -#define FIRMWAREIMAGE_MAX_LENGTH 0x2000 -#define FIRMWAREIMAGE_LENGTH (sizeof (FirmwareImage) / sizeof(UCHAR)) -#define FIRMWARE_MAJOR_VERSION 0 - -#define FIRMWAREIMAGEV1_LENGTH 0x1000 -#define FIRMWAREIMAGEV2_LENGTH 0x1000 - -#ifdef RT2860 -#define FIRMWARE_MINOR_VERSION 2 -#endif - /* ======================================================================== @@ -236,6 +175,7 @@ NDIS_STATUS RTMPAllocAdapterBlock( DBGPRINT_ERR(("Failed to allocate memory - BeaconBuf!\n")); break; } + NdisZeroMemory(pBeaconBuf, MAX_BEACON_SIZE); Status = AdapterBlockAllocateMemory(handle, (PVOID *)&pAd); if (Status != NDIS_STATUS_SUCCESS) @@ -244,14 +184,14 @@ NDIS_STATUS RTMPAllocAdapterBlock( break; } pAd->BeaconBuf = pBeaconBuf; - printk("\n\n=== pAd = %p, size = %d ===\n\n", pAd, (UINT32)sizeof(RTMP_ADAPTER)); + DBGPRINT(RT_DEBUG_OFF, ("\n\n=== pAd = %p, size = %d ===\n\n", pAd, (UINT32)sizeof(RTMP_ADAPTER))); // Init spin locks NdisAllocateSpinLock(&pAd->MgmtRingLock); -#ifdef RT2860 +#ifdef RTMP_MAC_PCI NdisAllocateSpinLock(&pAd->RxRingLock); -#endif +#endif // RTMP_MAC_PCI // for (index =0 ; index < NUM_OF_TX_RING; index++) { @@ -298,7 +238,7 @@ VOID RTMPReadTxPwrPerRate( USHORT i, value, value2; INT Apwrdelta, Gpwrdelta; UCHAR t1,t2,t3,t4; - BOOLEAN bValid, bApwrdeltaMinus = TRUE, bGpwrdeltaMinus = TRUE; + BOOLEAN bApwrdeltaMinus = TRUE, bGpwrdeltaMinus = TRUE; // // Get power delta for 20MHz and 40MHz. @@ -481,325 +421,16 @@ VOID RTMPReadTxPwrPerRate( Gdata |= ((t1<<16) + (t2<<20) + (t3<<24) + (t4<<28)); data |= (value<<16); - pAd->Tx20MPwrCfgABand[i] = pAd->Tx40MPwrCfgABand[i] = Adata; - pAd->Tx20MPwrCfgGBand[i] = pAd->Tx40MPwrCfgGBand[i] = Gdata; + /* For 20M/40M Power Delta issue */ + pAd->Tx20MPwrCfgABand[i] = data; + pAd->Tx20MPwrCfgGBand[i] = data; + pAd->Tx40MPwrCfgABand[i] = Adata; + pAd->Tx40MPwrCfgGBand[i] = Gdata; if (data != 0xffffffff) RTMP_IO_WRITE32(pAd, TX_PWR_CFG_0 + i*4, data); DBGPRINT_RAW(RT_DEBUG_TRACE, ("20MHz BW, 2.4G band-%lx, Adata = %lx, Gdata = %lx \n", data, Adata, Gdata)); } - - // - // Check this block is valid for 40MHz in 2.4G. If invalid, use parameter for 20MHz in 2.4G - // - bValid = TRUE; - for (i=0; i<6; i++) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_TXPOWER_BYRATE_40MHZ_2_4G + 2 + i*2, value); - if (((value & 0x00FF) == 0x00FF) || ((value & 0xFF00) == 0xFF00)) - { - bValid = FALSE; - break; - } - } - - // - // Get Txpower per MCS for 40MHz in 2.4G. - // - if (bValid) - { - for (i=0; i<4; i++) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_TXPOWER_BYRATE_40MHZ_2_4G + i*4, value); - if (bGpwrdeltaMinus == FALSE) - { - t1 = (value&0xf)+(Gpwrdelta); - if (t1 > 0xf) - t1 = 0xf; - t2 = ((value&0xf0)>>4)+(Gpwrdelta); - if (t2 > 0xf) - t2 = 0xf; - t3 = ((value&0xf00)>>8)+(Gpwrdelta); - if (t3 > 0xf) - t3 = 0xf; - t4 = ((value&0xf000)>>12)+(Gpwrdelta); - if (t4 > 0xf) - t4 = 0xf; - } - else - { - if ((value&0xf) > Gpwrdelta) - t1 = (value&0xf)-(Gpwrdelta); - else - t1 = 0; - if (((value&0xf0)>>4) > Gpwrdelta) - t2 = ((value&0xf0)>>4)-(Gpwrdelta); - else - t2 = 0; - if (((value&0xf00)>>8) > Gpwrdelta) - t3 = ((value&0xf00)>>8)-(Gpwrdelta); - else - t3 = 0; - if (((value&0xf000)>>12) > Gpwrdelta) - t4 = ((value&0xf000)>>12)-(Gpwrdelta); - else - t4 = 0; - } - Gdata = t1 + (t2<<4) + (t3<<8) + (t4<<12); - - RT28xx_EEPROM_READ16(pAd, EEPROM_TXPOWER_BYRATE_40MHZ_2_4G + i*4 + 2, value); - if (bGpwrdeltaMinus == FALSE) - { - t1 = (value&0xf)+(Gpwrdelta); - if (t1 > 0xf) - t1 = 0xf; - t2 = ((value&0xf0)>>4)+(Gpwrdelta); - if (t2 > 0xf) - t2 = 0xf; - t3 = ((value&0xf00)>>8)+(Gpwrdelta); - if (t3 > 0xf) - t3 = 0xf; - t4 = ((value&0xf000)>>12)+(Gpwrdelta); - if (t4 > 0xf) - t4 = 0xf; - } - else - { - if ((value&0xf) > Gpwrdelta) - t1 = (value&0xf)-(Gpwrdelta); - else - t1 = 0; - if (((value&0xf0)>>4) > Gpwrdelta) - t2 = ((value&0xf0)>>4)-(Gpwrdelta); - else - t2 = 0; - if (((value&0xf00)>>8) > Gpwrdelta) - t3 = ((value&0xf00)>>8)-(Gpwrdelta); - else - t3 = 0; - if (((value&0xf000)>>12) > Gpwrdelta) - t4 = ((value&0xf000)>>12)-(Gpwrdelta); - else - t4 = 0; - } - Gdata |= ((t1<<16) + (t2<<20) + (t3<<24) + (t4<<28)); - - if (i == 0) - pAd->Tx40MPwrCfgGBand[i+1] = (pAd->Tx40MPwrCfgGBand[i+1] & 0x0000FFFF) | (Gdata & 0xFFFF0000); - else - pAd->Tx40MPwrCfgGBand[i+1] = Gdata; - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("40MHz BW, 2.4G band, Gdata = %lx \n", Gdata)); - } - } - - // - // Check this block is valid for 20MHz in 5G. If invalid, use parameter for 20MHz in 2.4G - // - bValid = TRUE; - for (i=0; i<8; i++) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_TXPOWER_BYRATE_20MHZ_5G + 2 + i*2, value); - if (((value & 0x00FF) == 0x00FF) || ((value & 0xFF00) == 0xFF00)) - { - bValid = FALSE; - break; - } - } - - // - // Get Txpower per MCS for 20MHz in 5G. - // - if (bValid) - { - for (i=0; i<5; i++) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_TXPOWER_BYRATE_20MHZ_5G + i*4, value); - if (bApwrdeltaMinus == FALSE) - { - t1 = (value&0xf)+(Apwrdelta); - if (t1 > 0xf) - t1 = 0xf; - t2 = ((value&0xf0)>>4)+(Apwrdelta); - if (t2 > 0xf) - t2 = 0xf; - t3 = ((value&0xf00)>>8)+(Apwrdelta); - if (t3 > 0xf) - t3 = 0xf; - t4 = ((value&0xf000)>>12)+(Apwrdelta); - if (t4 > 0xf) - t4 = 0xf; - } - else - { - if ((value&0xf) > Apwrdelta) - t1 = (value&0xf)-(Apwrdelta); - else - t1 = 0; - if (((value&0xf0)>>4) > Apwrdelta) - t2 = ((value&0xf0)>>4)-(Apwrdelta); - else - t2 = 0; - if (((value&0xf00)>>8) > Apwrdelta) - t3 = ((value&0xf00)>>8)-(Apwrdelta); - else - t3 = 0; - if (((value&0xf000)>>12) > Apwrdelta) - t4 = ((value&0xf000)>>12)-(Apwrdelta); - else - t4 = 0; - } - Adata = t1 + (t2<<4) + (t3<<8) + (t4<<12); - - RT28xx_EEPROM_READ16(pAd, EEPROM_TXPOWER_BYRATE_20MHZ_5G + i*4 + 2, value); - if (bApwrdeltaMinus == FALSE) - { - t1 = (value&0xf)+(Apwrdelta); - if (t1 > 0xf) - t1 = 0xf; - t2 = ((value&0xf0)>>4)+(Apwrdelta); - if (t2 > 0xf) - t2 = 0xf; - t3 = ((value&0xf00)>>8)+(Apwrdelta); - if (t3 > 0xf) - t3 = 0xf; - t4 = ((value&0xf000)>>12)+(Apwrdelta); - if (t4 > 0xf) - t4 = 0xf; - } - else - { - if ((value&0xf) > Apwrdelta) - t1 = (value&0xf)-(Apwrdelta); - else - t1 = 0; - if (((value&0xf0)>>4) > Apwrdelta) - t2 = ((value&0xf0)>>4)-(Apwrdelta); - else - t2 = 0; - if (((value&0xf00)>>8) > Apwrdelta) - t3 = ((value&0xf00)>>8)-(Apwrdelta); - else - t3 = 0; - if (((value&0xf000)>>12) > Apwrdelta) - t4 = ((value&0xf000)>>12)-(Apwrdelta); - else - t4 = 0; - } - Adata |= ((t1<<16) + (t2<<20) + (t3<<24) + (t4<<28)); - - if (i == 0) - pAd->Tx20MPwrCfgABand[i] = (pAd->Tx20MPwrCfgABand[i] & 0x0000FFFF) | (Adata & 0xFFFF0000); - else - pAd->Tx20MPwrCfgABand[i] = Adata; - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("20MHz BW, 5GHz band, Adata = %lx \n", Adata)); - } - } - - // - // Check this block is valid for 40MHz in 5G. If invalid, use parameter for 20MHz in 2.4G - // - bValid = TRUE; - for (i=0; i<6; i++) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_TXPOWER_BYRATE_40MHZ_5G + 2 + i*2, value); - if (((value & 0x00FF) == 0x00FF) || ((value & 0xFF00) == 0xFF00)) - { - bValid = FALSE; - break; - } - } - - // - // Get Txpower per MCS for 40MHz in 5G. - // - if (bValid) - { - for (i=0; i<4; i++) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_TXPOWER_BYRATE_40MHZ_5G + i*4, value); - if (bApwrdeltaMinus == FALSE) - { - t1 = (value&0xf)+(Apwrdelta); - if (t1 > 0xf) - t1 = 0xf; - t2 = ((value&0xf0)>>4)+(Apwrdelta); - if (t2 > 0xf) - t2 = 0xf; - t3 = ((value&0xf00)>>8)+(Apwrdelta); - if (t3 > 0xf) - t3 = 0xf; - t4 = ((value&0xf000)>>12)+(Apwrdelta); - if (t4 > 0xf) - t4 = 0xf; - } - else - { - if ((value&0xf) > Apwrdelta) - t1 = (value&0xf)-(Apwrdelta); - else - t1 = 0; - if (((value&0xf0)>>4) > Apwrdelta) - t2 = ((value&0xf0)>>4)-(Apwrdelta); - else - t2 = 0; - if (((value&0xf00)>>8) > Apwrdelta) - t3 = ((value&0xf00)>>8)-(Apwrdelta); - else - t3 = 0; - if (((value&0xf000)>>12) > Apwrdelta) - t4 = ((value&0xf000)>>12)-(Apwrdelta); - else - t4 = 0; - } - Adata = t1 + (t2<<4) + (t3<<8) + (t4<<12); - - RT28xx_EEPROM_READ16(pAd, EEPROM_TXPOWER_BYRATE_40MHZ_5G + i*4 + 2, value); - if (bApwrdeltaMinus == FALSE) - { - t1 = (value&0xf)+(Apwrdelta); - if (t1 > 0xf) - t1 = 0xf; - t2 = ((value&0xf0)>>4)+(Apwrdelta); - if (t2 > 0xf) - t2 = 0xf; - t3 = ((value&0xf00)>>8)+(Apwrdelta); - if (t3 > 0xf) - t3 = 0xf; - t4 = ((value&0xf000)>>12)+(Apwrdelta); - if (t4 > 0xf) - t4 = 0xf; - } - else - { - if ((value&0xf) > Apwrdelta) - t1 = (value&0xf)-(Apwrdelta); - else - t1 = 0; - if (((value&0xf0)>>4) > Apwrdelta) - t2 = ((value&0xf0)>>4)-(Apwrdelta); - else - t2 = 0; - if (((value&0xf00)>>8) > Apwrdelta) - t3 = ((value&0xf00)>>8)-(Apwrdelta); - else - t3 = 0; - if (((value&0xf000)>>12) > Apwrdelta) - t4 = ((value&0xf000)>>12)-(Apwrdelta); - else - t4 = 0; - } - Adata |= ((t1<<16) + (t2<<20) + (t3<<24) + (t4<<28)); - - if (i == 0) - pAd->Tx40MPwrCfgABand[i+1] = (pAd->Tx40MPwrCfgABand[i+1] & 0x0000FFFF) | (Adata & 0xFFFF0000); - else - pAd->Tx40MPwrCfgABand[i+1] = Adata; - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("40MHz BW, 5GHz band, Adata = %lx \n", Adata)); - } - } } @@ -939,10 +570,11 @@ VOID RTMPReadChannelPwr( pAd->TxPower[i * 2 + choffset + 1].Power2 = Power2.field.Byte1; } - // 3. U-NII upper band: 149, 151, 153; 157, 159, 161; 165 (including central frequency in BW 40MHz) + // 3. U-NII upper band: 149, 151, 153; 157, 159, 161; 165, 167, 169; 171, 173 (including central frequency in BW 40MHz) // 3.1 Fill up channel choffset = 14 + 12 + 16; - for (i = 0; i < 2; i++) + /*for (i = 0; i < 2; i++)*/ + for (i = 0; i < 3; i++) { pAd->TxPower[3 * i + choffset + 0].Channel = 149 + i * 8 + 0; pAd->TxPower[3 * i + choffset + 0].Power = DEFAULT_RF_TX_POWER; @@ -956,12 +588,17 @@ VOID RTMPReadChannelPwr( pAd->TxPower[3 * i + choffset + 2].Power = DEFAULT_RF_TX_POWER; pAd->TxPower[3 * i + choffset + 2].Power2 = DEFAULT_RF_TX_POWER; } - pAd->TxPower[3 * 2 + choffset + 0].Channel = 165; - pAd->TxPower[3 * 2 + choffset + 0].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * 2 + choffset + 0].Power2 = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * 3 + choffset + 0].Channel = 171; + pAd->TxPower[3 * 3 + choffset + 0].Power = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * 3 + choffset + 0].Power2 = DEFAULT_RF_TX_POWER; + + pAd->TxPower[3 * 3 + choffset + 1].Channel = 173; + pAd->TxPower[3 * 3 + choffset + 1].Power = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * 3 + choffset + 1].Power2 = DEFAULT_RF_TX_POWER; // 3.2 Fill up power - for (i = 0; i < 4; i++) + /*for (i = 0; i < 4; i++)*/ + for (i = 0; i < 6; i++) { RT28xx_EEPROM_READ16(pAd, EEPROM_A_TX_PWR_OFFSET + (choffset - 14) + i * 2, Power.word); RT28xx_EEPROM_READ16(pAd, EEPROM_A_TX2_PWR_OFFSET + (choffset - 14) + i * 2, Power2.word); @@ -980,7 +617,10 @@ VOID RTMPReadChannelPwr( } // 4. Print and Debug - choffset = 14 + 12 + 16 + 7; + /*choffset = 14 + 12 + 16 + 7;*/ + choffset = 14 + 12 + 16 + 11; + + } /* @@ -1017,267 +657,6 @@ NDIS_STATUS NICReadRegParameters( } -#ifdef RT2870 -/* - ======================================================================== - - Routine Description: - For RF filter calibration purpose - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - IRQL = PASSIVE_LEVEL - - ======================================================================== -*/ -VOID RTMPFilterCalibration( - IN PRTMP_ADAPTER pAd) -{ - UCHAR R55x = 0, value, FilterTarget = 0x1E, BBPValue=0; - UINT loop = 0, count = 0, loopcnt = 0, ReTry = 0; - UCHAR RF_R24_Value = 0; - - // Give bbp filter initial value -#ifndef RT2870 - pAd->Mlme.CaliBW20RfR24 = 0x16; - pAd->Mlme.CaliBW40RfR24 = 0x36; //Bit[5] must be 1 for BW 40 -#else - pAd->Mlme.CaliBW20RfR24 = 0x1F; - pAd->Mlme.CaliBW40RfR24 = 0x2F; //Bit[5] must be 1 for BW 40 -#endif - do - { - if (loop == 1) //BandWidth = 40 MHz - { - // Write 0x27 to RF_R24 to program filter - RF_R24_Value = 0x27; - RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - if (IS_RT3090(pAd)) - FilterTarget = 0x15; - else - FilterTarget = 0x19; - - // when calibrate BW40, BBP mask must set to BW40. - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue&= (~0x18); - BBPValue|= (0x10); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); -#ifdef RT2870 - // set to BW40 - RT30xxReadRFRegister(pAd, RF_R31, &value); - value |= 0x20; - RT30xxWriteRFRegister(pAd, RF_R31, value); -#endif - } - else //BandWidth = 20 MHz - { - // Write 0x07 to RF_R24 to program filter - RF_R24_Value = 0x07; - RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - if (IS_RT3090(pAd)) - FilterTarget = 0x13; - else - FilterTarget = 0x16; -#ifdef RT2870 - // set to BW20 - RT30xxReadRFRegister(pAd, RF_R31, &value); - value &= (~0x20); - RT30xxWriteRFRegister(pAd, RF_R31, value); -#endif - } - - // Write 0x01 to RF_R22 to enable baseband loopback mode - RT30xxReadRFRegister(pAd, RF_R22, &value); - value |= 0x01; - RT30xxWriteRFRegister(pAd, RF_R22, value); - - // Write 0x00 to BBP_R24 to set power & frequency of passband test tone - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0); - - do - { - // Write 0x90 to BBP_R25 to transmit test tone - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90); - - RTMPusecDelay(1000); - // Read BBP_R55[6:0] for received power, set R55x = BBP_R55[6:0] - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value); - R55x = value & 0xFF; - - } while ((ReTry++ < 100) && (R55x == 0)); - - // Write 0x06 to BBP_R24 to set power & frequency of stopband test tone - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0x06); - - while(TRUE) - { - // Write 0x90 to BBP_R25 to transmit test tone - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90); - - //We need to wait for calibration - RTMPusecDelay(1000); - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value); - value &= 0xFF; - if ((R55x - value) < FilterTarget) - { - RF_R24_Value ++; - } - else if ((R55x - value) == FilterTarget) - { - RF_R24_Value ++; - count ++; - } - else - { - break; - } - - // prevent infinite loop cause driver hang. - if (loopcnt++ > 100) - { - DBGPRINT(RT_DEBUG_ERROR, ("RTMPFilterCalibration - can't find a valid value, loopcnt=%d stop calibrating", loopcnt)); - break; - } - - // Write RF_R24 to program filter - RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - } - - if (count > 0) - { - RF_R24_Value = RF_R24_Value - ((count) ? (1) : (0)); - } - - // Store for future usage - if (loopcnt < 100) - { - if (loop++ == 0) - { - //BandWidth = 20 MHz - pAd->Mlme.CaliBW20RfR24 = (UCHAR)RF_R24_Value; - } - else - { - //BandWidth = 40 MHz - pAd->Mlme.CaliBW40RfR24 = (UCHAR)RF_R24_Value; - break; - } - } - else - break; - - RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - - // reset count - count = 0; - } while(TRUE); - - // - // Set back to initial state - // - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0); - - RT30xxReadRFRegister(pAd, RF_R22, &value); - value &= ~(0x01); - RT30xxWriteRFRegister(pAd, RF_R22, value); - - // set BBP back to BW20 - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue&= (~0x18); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPFilterCalibration - CaliBW20RfR24=0x%x, CaliBW40RfR24=0x%x\n", pAd->Mlme.CaliBW20RfR24, pAd->Mlme.CaliBW40RfR24)); -} - -VOID NICInitRT30xxRFRegisters(IN PRTMP_ADAPTER pAd) -{ - INT i; - // Driver must read EEPROM to get RfIcType before initial RF registers - // Initialize RF register to default value - if (IS_RT3070(pAd) || IS_RT3071(pAd)) - { - // Init RF calibration - // Driver should toggle RF R30 bit7 before init RF registers - UINT32 RfReg = 0; - UINT32 data; - - RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg); - RfReg |= 0x80; - RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); - RTMPusecDelay(1000); - RfReg &= 0x7F; - RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); - - // Initialize RF register to default value - for (i = 0; i < NUM_RF_REG_PARMS; i++) - { - RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value); - } - - if (IS_RT3070(pAd)) - { - // Update MAC 0x05D4 from 01xxxxxx to 0Dxxxxxx (voltage 1.2V to 1.35V) for RT3070 to improve yield rate - RTUSBReadMACRegister(pAd, LDO_CFG0, &data); - data = ((data & 0xF0FFFFFF) | 0x0D000000); - RTUSBWriteMACRegister(pAd, LDO_CFG0, data); - } - else if (IS_RT3071(pAd)) - { - // Driver should set RF R6 bit6 on before init RF registers - RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RfReg); - RfReg |= 0x40; - RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg); - - // init R31 - RT30xxWriteRFRegister(pAd, RF_R31, 0x14); - - // RT3071 version E has fixed this issue - if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211)) - { - // patch tx EVM issue temporarily - RTUSBReadMACRegister(pAd, LDO_CFG0, &data); - data = ((data & 0xE0FFFFFF) | 0x0D000000); - RTUSBWriteMACRegister(pAd, LDO_CFG0, data); - } - else - { - RTMP_IO_READ32(pAd, LDO_CFG0, &data); - data = ((data & 0xE0FFFFFF) | 0x01000000); - RTMP_IO_WRITE32(pAd, LDO_CFG0, data); - } - - // patch LNA_PE_G1 failed issue - RTUSBReadMACRegister(pAd, GPIO_SWITCH, &data); - data &= ~(0x20); - RTUSBWriteMACRegister(pAd, GPIO_SWITCH, data); - } - - //For RF filter Calibration - RTMPFilterCalibration(pAd); - - // Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration() - if ((pAd->MACVersion & 0xffff) < 0x0211) - RT30xxWriteRFRegister(pAd, RF_R27, 0x3); - - // set led open drain enable - RTUSBReadMACRegister(pAd, OPT_14, &data); - data |= 0x01; - RTUSBWriteMACRegister(pAd, OPT_14, data); - - if (IS_RT3071(pAd)) - { - // add by johnli, RF power sequence setup, load RF normal operation-mode setup - RT30xxLoadRFNormalModeSetup(pAd); - } - } -} -#endif // RT2870 // - - /* ======================================================================== @@ -1310,6 +689,18 @@ VOID NICReadEEPROMParameters( DBGPRINT(RT_DEBUG_TRACE, ("--> NICReadEEPROMParameters\n")); + if (pAd->chipOps.eeinit) + pAd->chipOps.eeinit(pAd); +#ifdef RTMP_EFUSE_SUPPORT +#ifdef RT30xx + if(!pAd->bFroceEEPROMBuffer && pAd->bEEPROMFile) + { + DBGPRINT(RT_DEBUG_TRACE, ("--> NICReadEEPROMParameters::(Efuse)Load to EEPROM Buffer Mode\n")); + eFuseLoadEEPROM(pAd); + } +#endif // RT30xx // +#endif // RTMP_EFUSE_SUPPORT // + // Init EEPROM Address Number, before access EEPROM; if 93c46, EEPROMAddressNum=6, else if 93c66, EEPROMAddressNum=8 RTMP_IO_READ32(pAd, E2PROM_CSR, &data); DBGPRINT(RT_DEBUG_TRACE, ("--> E2PROM_CSR = 0x%x\n", data)); @@ -1325,7 +716,7 @@ VOID NICReadEEPROMParameters( // RT2860 MAC no longer auto load MAC address from E2PROM. Driver has to intialize // MAC address registers according to E2PROM setting if (mac_addr == NULL || - strlen(mac_addr) != 17 || + strlen((PSTRING) mac_addr) != 17 || mac_addr[2] != ':' || mac_addr[5] != ':' || mac_addr[8] != ':' || mac_addr[11] != ':' || mac_addr[14] != ':') { @@ -1347,9 +738,9 @@ VOID NICReadEEPROMParameters( else { INT j; - PUCHAR macptr; + PSTRING macptr; - macptr = mac_addr; + macptr = (PSTRING) mac_addr; for (j=0; jPermanentAddress[0], pAd->PermanentAddress[1], - pAd->PermanentAddress[2], pAd->PermanentAddress[3], - pAd->PermanentAddress[4], pAd->PermanentAddress[5])); + PRINT_MAC(pAd->PermanentAddress))); } } @@ -1450,7 +839,8 @@ VOID NICReadEEPROMParameters( Antenna.word = pAd->EEPROMDefaultValue[0]; if (Antenna.word == 0xFFFF) { - if(IS_RT3090(pAd)) +#ifdef RT30xx + if(IS_RT3090(pAd)|| IS_RT3390(pAd)) { Antenna.word = 0; Antenna.field.RfIcType = RFIC_3020; @@ -1458,7 +848,9 @@ VOID NICReadEEPROMParameters( Antenna.field.RxPath = 1; } else +#endif // RT30xx // { + Antenna.word = 0; Antenna.field.RfIcType = RFIC_2820; Antenna.field.TxPath = 1; @@ -1514,11 +906,26 @@ VOID NICReadEEPROMParameters( // Save the antenna for future use pAd->Antenna.word = Antenna.word; + // Set the RfICType here, then we can initialize RFIC related operation callbacks + pAd->Mlme.RealRxPath = (UCHAR) Antenna.field.RxPath; + pAd->RfIcType = (UCHAR) Antenna.field.RfIcType; + +#ifdef RTMP_RF_RW_SUPPORT + RtmpChipOpsRFHook(pAd); +#endif // RTMP_RF_RW_SUPPORT // + +#ifdef RTMP_MAC_PCI + sprintf((PSTRING) pAd->nickname, "RT2860STA"); +#endif // RTMP_MAC_PCI // + + // // Reset PhyMode if we don't support 802.11a // Only RFIC_2850 & RFIC_2750 support 802.11a // - if ((Antenna.field.RfIcType != RFIC_2850) && (Antenna.field.RfIcType != RFIC_2750)) + if ((Antenna.field.RfIcType != RFIC_2850) + && (Antenna.field.RfIcType != RFIC_2750) + && (Antenna.field.RfIcType != RFIC_3052)) { if ((pAd->CommonCfg.PhyMode == PHY_11ABG_MIXED) || (pAd->CommonCfg.PhyMode == PHY_11A)) @@ -1671,11 +1078,31 @@ VOID NICReadEEPROMParameters( if ((pAd->ARssiOffset2 < -10) || (pAd->ARssiOffset2 > 10)) pAd->ARssiOffset2 = 0; +#ifdef RT30xx + // + // Get TX mixer gain setting + // 0xff are invalid value + // Note: RT30xX default value is 0x00 and will program to RF_R17 only when this value is not zero. + // RT359X default value is 0x02 + // + if (IS_RT30xx(pAd) || IS_RT3572(pAd)) + { + RT28xx_EEPROM_READ16(pAd, EEPROM_TXMIXER_GAIN_2_4G, value); + pAd->TxMixerGain24G = 0; + value &= 0x00ff; + if (value != 0xff) + { + value &= 0x07; + pAd->TxMixerGain24G = (UCHAR)value; + } + } +#endif // RT30xx // + // // Get LED Setting. // RT28xx_EEPROM_READ16(pAd, 0x3a, value); - pAd->LedCntl.word = (value&0xff00) >> 8; + pAd->LedCntl.word = (value>>8); RT28xx_EEPROM_READ16(pAd, EEPROM_LED1_OFFSET, value); pAd->Led1 = value; RT28xx_EEPROM_READ16(pAd, EEPROM_LED2_OFFSET, value); @@ -1685,6 +1112,12 @@ VOID NICReadEEPROMParameters( RTMPReadTxPwrPerRate(pAd); +#ifdef RT30xx +#ifdef RTMP_EFUSE_SUPPORT + RtmpEfuseSupportCheck(pAd); +#endif // RTMP_EFUSE_SUPPORT // +#endif // RT30xx // + DBGPRINT(RT_DEBUG_TRACE, ("<-- NICReadEEPROMParameters\n")); } @@ -1712,7 +1145,7 @@ VOID NICInitAsicFromEEPROM( UINT32 data = 0; UCHAR BBPR1 = 0; USHORT i; - EEPROM_ANTENNA_STRUC Antenna; +// EEPROM_ANTENNA_STRUC Antenna; EEPROM_NIC_CONFIG2_STRUC NicConfig2; UCHAR BBPR3 = 0; @@ -1729,28 +1162,9 @@ VOID NICInitAsicFromEEPROM( } } -#ifndef RT2870 - Antenna.word = pAd->Antenna.word; -#else - Antenna.word = pAd->EEPROMDefaultValue[0]; - if (Antenna.word == 0xFFFF) - { - DBGPRINT(RT_DEBUG_ERROR, ("E2PROM error, hard code as 0x%04x\n", Antenna.word)); - BUG_ON(Antenna.word == 0xFFFF); - } -#endif - pAd->Mlme.RealRxPath = (UCHAR) Antenna.field.RxPath; - pAd->RfIcType = (UCHAR) Antenna.field.RfIcType; - -#ifdef RT2870 - DBGPRINT(RT_DEBUG_WARN, ("pAd->RfIcType = %d, RealRxPath=%d, TxPath = %d\n", pAd->RfIcType, pAd->Mlme.RealRxPath,Antenna.field.TxPath)); - // Save the antenna for future use - pAd->Antenna.word = Antenna.word; -#endif NicConfig2.word = pAd->EEPROMDefaultValue[1]; -#ifdef RT2870 { if ((NicConfig2.word & 0x00ff) == 0xff) { @@ -1762,15 +1176,16 @@ VOID NICInitAsicFromEEPROM( NicConfig2.word &= 0x00ff; } } -#endif + // Save the antenna for future use pAd->NicConfig2.word = NicConfig2.word; -#ifdef RT2870 +#ifdef RT30xx // set default antenna as main if (pAd->RfIcType == RFIC_3020) AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); -#endif +#endif // RT30xx // + // // Send LED Setting to MCU. // @@ -1779,19 +1194,21 @@ VOID NICInitAsicFromEEPROM( pAd->LedCntl.word = 0x01; pAd->Led1 = 0x5555; pAd->Led2 = 0x2221; -#ifdef RT2860 - pAd->Led3 = 0xA9F8; -#endif -#ifdef RT2870 +#ifdef RTMP_MAC_PCI + pAd->Led3 = 0xA9F8; +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB pAd->Led3 = 0x5627; -#endif // RT2870 // +#endif // RTMP_MAC_USB // } AsicSendCommandToMcu(pAd, 0x52, 0xff, (UCHAR)pAd->Led1, (UCHAR)(pAd->Led1 >> 8)); AsicSendCommandToMcu(pAd, 0x53, 0xff, (UCHAR)pAd->Led2, (UCHAR)(pAd->Led2 >> 8)); AsicSendCommandToMcu(pAd, 0x54, 0xff, (UCHAR)pAd->Led3, (UCHAR)(pAd->Led3 >> 8)); - pAd->LedIndicatorStregth = 0xFF; + AsicSendCommandToMcu(pAd, 0x51, 0xff, 0, pAd->LedCntl.field.Polarity); + + pAd->LedIndicatorStrength = 0xFF; RTMPSetSignalLED(pAd, -100); // Force signal strength Led to be turned off, before link up { @@ -1806,6 +1223,7 @@ VOID NICInitAsicFromEEPROM( { pAd->StaCfg.bHwRadio = FALSE; pAd->StaCfg.bRadio = FALSE; +// RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x00001818); RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); } } @@ -1819,26 +1237,29 @@ VOID NICInitAsicFromEEPROM( else { RTMPSetLED(pAd, LED_RADIO_ON); -#ifdef RT2860 +#ifdef RTMP_MAC_PCI AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02); AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x00); // 2-1. wait command ok. AsicCheckCommanOk(pAd, PowerWakeCID); -#endif +#endif // RTMP_MAC_PCI // } } // Turn off patching for cardbus controller if (NicConfig2.field.CardbusAcceleration == 1) { +// pAd->bTest1 = TRUE; } if (NicConfig2.field.DynamicTxAgcControl == 1) pAd->bAutoTxAgcA = pAd->bAutoTxAgcG = TRUE; else pAd->bAutoTxAgcA = pAd->bAutoTxAgcG = FALSE; - - /* BBP has been programmed so reset to UNKNOWN_BAND */ + // + // Since BBP has been progamed, to make sure BBP setting will be + // upate inside of AsicAntennaSelect, so reset to UNKNOWN_BAND!! + // pAd->CommonCfg.BandState = UNKNOWN_BAND; RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBPR3); @@ -1866,10 +1287,53 @@ VOID NICInitAsicFromEEPROM( } RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R1, BBPR1); - DBGPRINT(RT_DEBUG_TRACE, ("Use Hw Radio Control Pin=%d; if used Pin=%d;\n", pAd->CommonCfg.bHardwareRadio, pAd->CommonCfg.bHardwareRadio)); + DBGPRINT(RT_DEBUG_TRACE, ("Use Hw Radio Control Pin=%d; if used Pin=%d;\n", + pAd->CommonCfg.bHardwareRadio, pAd->CommonCfg.bHardwareRadio)); } - DBGPRINT(RT_DEBUG_TRACE, ("TxPath = %d, RxPath = %d, RFIC=%d, Polar+LED mode=%x\n", pAd->Antenna.field.TxPath, pAd->Antenna.field.RxPath, pAd->RfIcType, pAd->LedCntl.word)); +#ifdef RTMP_MAC_USB +#ifdef RT30xx + // update registers from EEPROM for RT3071 or later(3572/3592). + + if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) + { + UCHAR RegIdx, RegValue; + USHORT value; + + // after RT3071, write BBP from EEPROM 0xF0 to 0x102 + for (i = 0xF0; i <= 0x102; i = i+2) + { + value = 0xFFFF; + RT28xx_EEPROM_READ16(pAd, i, value); + if ((value != 0xFFFF) && (value != 0)) + { + RegIdx = (UCHAR)(value >> 8); + RegValue = (UCHAR)(value & 0xff); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, RegIdx, RegValue); + DBGPRINT(RT_DEBUG_TRACE, ("Update BBP Registers from EEPROM(0x%0x), BBP(0x%x) = 0x%x\n", i, RegIdx, RegValue)); + } + } + + // after RT3071, write RF from EEPROM 0x104 to 0x116 + for (i = 0x104; i <= 0x116; i = i+2) + { + value = 0xFFFF; + RT28xx_EEPROM_READ16(pAd, i, value); + if ((value != 0xFFFF) && (value != 0)) + { + RegIdx = (UCHAR)(value >> 8); + RegValue = (UCHAR)(value & 0xff); + RT30xxWriteRFRegister(pAd, RegIdx, RegValue); + DBGPRINT(RT_DEBUG_TRACE, ("Update RF Registers from EEPROM0x%x), BBP(0x%x) = 0x%x\n", i, RegIdx, RegValue)); + } + } + } +#endif // RT30xx // +#endif // RTMP_MAC_USB // + + DBGPRINT(RT_DEBUG_TRACE, ("TxPath = %d, RxPath = %d, RFIC=%d, Polar+LED mode=%x\n", + pAd->Antenna.field.TxPath, pAd->Antenna.field.RxPath, + pAd->RfIcType, pAd->LedCntl.word)); DBGPRINT(RT_DEBUG_TRACE, ("<-- NICInitAsicFromEEPROM\n")); } @@ -1897,10 +1361,11 @@ NDIS_STATUS NICInitializeAdapter( { NDIS_STATUS Status = NDIS_STATUS_SUCCESS; WPDMA_GLO_CFG_STRUC GloCfg; -#ifdef RT2860 +#ifdef RTMP_MAC_PCI UINT32 Value; DELAY_INT_CFG_STRUC IntCfg; -#endif +#endif // RTMP_MAC_PCI // +// INT_MASK_CSR_STRUC IntMask; ULONG i =0, j=0; AC_TXOP_CSR0_STRUC csr0; @@ -1939,11 +1404,11 @@ retry: // asic simulation sequence put this ahead before loading firmware. // pbf hardware reset -#ifdef RT2860 +#ifdef RTMP_MAC_PCI RTMP_IO_WRITE32(pAd, WPDMA_RST_IDX, 0x1003f); // 0x10000 for reset rx, 0x3f resets all 6 tx rings. RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, 0xe1f); RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, 0xe00); -#endif +#endif // RTMP_MAC_PCI // // Initialze ASIC for TX & Rx operation if (NICInitializeAsic(pAd , bHardReset) != NDIS_STATUS_SUCCESS) @@ -1957,7 +1422,7 @@ retry: } -#ifdef RT2860 +#ifdef RTMP_MAC_PCI // Write AC_BK base address register Value = RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_AC_BK].Cell[0].AllocPa); RTMP_IO_WRITE32(pAd, TX_BASE_PTR1, Value); @@ -2030,7 +1495,7 @@ retry: // Write RX_RING_CSR register Value = RX_RING_SIZE; RTMP_IO_WRITE32(pAd, RX_MAX_CNT, Value); -#endif /* RT2860 */ +#endif // RTMP_MAC_PCI // // WMM parameter @@ -2049,7 +1514,7 @@ retry: RTMP_IO_WRITE32(pAd, WMM_TXOP1_CFG, csr0.word); -#ifdef RT2860 +#ifdef RTMP_MAC_PCI // 3. Set DMA global configuration except TX_DMA_EN and RX_DMA_EN bits: i = 0; do @@ -2068,7 +1533,7 @@ retry: IntCfg.word = 0; RTMP_IO_WRITE32(pAd, DELAY_INT_CFG, IntCfg.word); -#endif +#endif // RTMP_MAC_PCI // // reset action @@ -2104,26 +1569,44 @@ NDIS_STATUS NICInitializeAsic( ULONG Index = 0; UCHAR R0 = 0xff; UINT32 MacCsr12 = 0, Counter = 0; -#ifdef RT2870 +#ifdef RTMP_MAC_USB UINT32 MacCsr0 = 0; NTSTATUS Status; UCHAR Value = 0xff; - UINT32 eFuseCtrl; -#endif +#endif // RTMP_MAC_USB // +#ifdef RT30xx + UCHAR bbpreg=0; + UCHAR RFValue=0; +#endif // RT30xx // USHORT KeyIdx; INT i,apidx; DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitializeAsic\n")); -#ifdef RT2860 +#ifdef RTMP_MAC_PCI + RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x3); // To fix driver disable/enable hang issue when radio off if (bHardReset == TRUE) { RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x3); } else RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x1); -#endif -#ifdef RT2870 + + RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x0); + // Initialize MAC register to default value + for (Index = 0; Index < NUM_MAC_REG_PARMS; Index++) + { + RTMP_IO_WRITE32(pAd, MACRegTable[Index].Register, MACRegTable[Index].Value); + } + + { + for (Index = 0; Index < NUM_STA_MAC_REG_PARMS; Index++) + { + RTMP_IO_WRITE32(pAd, STAMACRegTable[Index].Register, STAMACRegTable[Index].Value); + } + } +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB // // Make sure MAC gets ready after NICLoadFirmware(). // @@ -2151,44 +1634,32 @@ NDIS_STATUS NICInitializeAsic( RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x3); RTMP_IO_WRITE32(pAd, USB_DMA_CFG, 0x0); Status = RTUSBVenderReset(pAd); -#endif RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x0); // Initialize MAC register to default value -#ifdef RT2860 - for (Index = 0; Index < NUM_MAC_REG_PARMS; Index++) - { - RTMP_IO_WRITE32(pAd, MACRegTable[Index].Register, MACRegTable[Index].Value); - } -#endif -#ifdef RT2870 for(Index=0; IndexNicConfig2.field.DACTestBit == 1) { - RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x1F); // To fix throughput drop drastically + RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x2C); // To fix throughput drop drastically } else { @@ -2209,11 +1680,17 @@ NDIS_STATUS NICInitializeAsic( RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x0); } } -#ifdef RT2870 else if (IS_RT3070(pAd)) { + if (((pAd->MACVersion & 0xffff) < 0x0201)) + { RTMP_IO_WRITE32(pAd, TX_SW_CFG1, 0); - RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x1F); // To fix throughput drop drastically + RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x2C); // To fix throughput drop drastically + } + else + { + RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0); + } } #endif // RT30xx // @@ -2256,28 +1733,42 @@ NDIS_STATUS NICInitializeAsic( RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBPRegTable[Index].Register, BBPRegTable[Index].Value); } -#ifndef RT2870 - // for rt2860E and after, init BBP_R84 with 0x19. This is for extension channel overlapping IOT. - if ((pAd->MACVersion&0xffff) != 0x0101) - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R84, 0x19); -#else +#ifdef RTMP_MAC_PCI + // TODO: shiang, check MACVersion, currently, rbus-based chip use this. + if (pAd->MACVersion == 0x28720200) + { + //UCHAR value; + ULONG value2; + + //disable MLD by Bruce 20080704 + //BBP_IO_READ8_BY_REG_ID(pAd, BBP_R105, &value); + //BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R105, value | 4); + + //Maximum PSDU length from 16K to 32K bytes + RTMP_IO_READ32(pAd, MAX_LEN_CFG, &value2); + value2 &= ~(0x3<<12); + value2 |= (0x2<<12); + RTMP_IO_WRITE32(pAd, MAX_LEN_CFG, value2); + } +#endif // RTMP_MAC_PCI // + // for rt2860E and after, init BBP_R84 with 0x19. This is for extension channel overlapping IOT. // RT3090 should not program BBP R84 to 0x19, otherwise TX will block. - if (((pAd->MACVersion&0xffff) != 0x0101) && (!IS_RT30xx(pAd))) + //3070/71/72,3090,3090A( are included in RT30xx),3572,3390 + if (((pAd->MACVersion & 0xffff) != 0x0101) && !(IS_RT30xx(pAd)|| IS_RT3572(pAd) || IS_RT3390(pAd))) RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R84, 0x19); +#ifdef RT30xx // add by johnli, RF power sequence setup - if (IS_RT30xx(pAd)) - { //update for RT3070/71/72/90/91/92. + if (IS_RT30xx(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) + { //update for RT3070/71/72/90/91/92,3572,3390. RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R79, 0x13); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R80, 0x05); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R81, 0x33); } - if (IS_RT3090(pAd)) + if (IS_RT3090(pAd)||IS_RT3390(pAd)) // RT309x, RT3071/72 { - UCHAR bbpreg=0; - // enable DC filter if ((pAd->MACVersion & 0xffff) >= 0x0211) { @@ -2307,7 +1798,38 @@ NDIS_STATUS NICInitializeAsic( RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R31, bbpreg); } } -#endif + else if (IS_RT3070(pAd)) + { + if ((pAd->MACVersion & 0xffff) >= 0x0201) + { + // enable DC filter + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R103, 0xc0); + + // improve power consumption in RT3070 Ver.F + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R31, &bbpreg); + bbpreg &= (~0x3); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R31, bbpreg); + } + + // TX_LO1_en, RF R17 register Bit 3 to 0 + RT30xxReadRFRegister(pAd, RF_R17, &RFValue); + RFValue &= (~0x08); + // to fix rx long range issue + if (pAd->NicConfig2.field.ExternalLNAForG == 0) + { + RFValue |= 0x20; + } + // set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h + if (pAd->TxMixerGain24G >= 1) + { + RFValue &= (~0x7); // clean bit [2:0] + RFValue |= pAd->TxMixerGain24G; + } + RT30xxWriteRFRegister(pAd, RF_R17, RFValue); + } +// end johnli +#endif // RT30xx // + if (pAd->MACVersion == 0x28600100) { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x16); @@ -2324,7 +1846,7 @@ NDIS_STATUS NICInitializeAsic( RTMP_IO_WRITE32(pAd, MAX_LEN_CFG, csr); } -#ifdef RT2870 +#ifdef RTMP_MAC_USB { UCHAR MAC_Value[]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0,0}; @@ -2335,7 +1857,7 @@ NDIS_STATUS NICInitializeAsic( RTUSBMultiWrite(pAd, (USHORT)(MAC_WCID_BASE + Index * 8), MAC_Value, 8); } } -#endif // RT2870 // +#endif // RTMP_MAC_USB // // Add radio off control { @@ -2356,7 +1878,7 @@ NDIS_STATUS NICInitializeAsic( RTMP_IO_READ32(pAd, TX_STA_CNT2, &Counter); // ASIC will keep garbage value after boot - // Clear all seared key table when initial + // Clear all shared key table when initial // This routine can be ignored in radio-ON/OFF operation. if (bHardReset) { @@ -2372,6 +1894,9 @@ NDIS_STATUS NICInitializeAsic( } } + // assert HOST ready bit +// RTMP_IO_WRITE32(pAd, MAC_CSR1, 0x0); // 2004-09-14 asked by Mark +// RTMP_IO_WRITE32(pAd, MAC_CSR1, 0x4); // It isn't necessary to clear this space when not hard reset. if (bHardReset == TRUE) @@ -2383,7 +1908,8 @@ NDIS_STATUS NICInitializeAsic( RTMP_IO_WRITE32(pAd, pAd->BeaconOffset[apidx] + i, 0x00); } } -#ifdef RT2870 + +#ifdef RTMP_MAC_USB AsicDisableSync(pAd); // Clear raw counters RTMP_IO_READ32(pAd, RX_STA_CNT0, &Counter); @@ -2397,19 +1923,7 @@ NDIS_STATUS NICInitializeAsic( Counter&=0xffffff00; Counter|=0x000001e; RTMP_IO_WRITE32(pAd, USB_CYC_CFG, Counter); - - pAd->bUseEfuse=FALSE; - RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrl); - pAd->bUseEfuse = ( (eFuseCtrl & 0x80000000) == 0x80000000) ? 1 : 0; - if(pAd->bUseEfuse) - { - DBGPRINT(RT_DEBUG_TRACE, ("NVM is Efuse\n")); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("NVM is EEPROM\n")); - } -#endif +#endif // RTMP_MAC_USB // { // for rt2860E and after, init TXOP_CTRL_CFG with 0x583f. This is for extension channel overlapping IOT. @@ -2421,133 +1935,6 @@ NDIS_STATUS NICInitializeAsic( return NDIS_STATUS_SUCCESS; } - -#ifdef RT2860 -VOID NICRestoreBBPValue( - IN PRTMP_ADAPTER pAd) -{ - UCHAR index; - UCHAR Value = 0; - ULONG Data; - - DBGPRINT(RT_DEBUG_TRACE, ("---> NICRestoreBBPValue !!!!!!!!!!!!!!!!!!!!!!! \n")); - // Initialize BBP register to default value (rtmp_init.c) - for (index = 0; index < NUM_BBP_REG_PARMS; index++) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBPRegTable[index].Register, BBPRegTable[index].Value); - } - // copy from (rtmp_init.c) - if (pAd->MACVersion == 0x28600100) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x16); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x12); - } - - // copy from (connect.c LinkUp function) - if (INFRA_ON(pAd)) - { - // Change to AP channel - if ((pAd->CommonCfg.CentralChannel > pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - // Must using 40MHz. - pAd->CommonCfg.BBPCurrentBW = BW_40; - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value); - Value &= (~0x18); - Value |= 0x10; - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value); - - // RX : control channel at lower - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); - Value &= (~0x20); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); - // Record BBPR3 setting, But don't keep R Antenna # information. - pAd->StaCfg.BBPR3 = Value; - - RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data); - Data &= 0xfffffffe; - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Data); - - if (pAd->MACVersion == 0x28600100) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x1A); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x0A); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x16); - DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" )); - } - - DBGPRINT(RT_DEBUG_TRACE, ("!!!40MHz Lower LINK UP !!! Control Channel at Below. Central = %d \n", pAd->CommonCfg.CentralChannel )); - } - else if ((pAd->CommonCfg.CentralChannel < pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - // Must using 40MHz. - pAd->CommonCfg.BBPCurrentBW = BW_40; - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value); - Value &= (~0x18); - Value |= 0x10; - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value); - - RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data); - Data |= 0x1; - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Data); - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); - Value |= (0x20); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); - // Record BBPR3 setting, But don't keep R Antenna # information. - pAd->StaCfg.BBPR3 = Value; - - if (pAd->MACVersion == 0x28600100) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x1A); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x0A); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x16); - DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" )); - } - - DBGPRINT(RT_DEBUG_TRACE, ("!!!40MHz Upper LINK UP !!! Control Channel at UpperCentral = %d \n", pAd->CommonCfg.CentralChannel )); - } - else - { - pAd->CommonCfg.BBPCurrentBW = BW_20; - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value); - Value &= (~0x18); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value); - - RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data); - Data &= 0xfffffffe; - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Data); - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); - Value &= (~0x20); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); - // Record BBPR3 setting, But don't keep R Antenna # information. - pAd->StaCfg.BBPR3 = Value; - - if (pAd->MACVersion == 0x28600100) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x16); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x08); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x11); - DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" )); - } - - DBGPRINT(RT_DEBUG_TRACE, ("!!!20MHz LINK UP !!! \n" )); - } - } - - DBGPRINT(RT_DEBUG_TRACE, ("<--- NICRestoreBBPValue !!!!!!!!!!!!!!!!!!!!!!! \n")); -} -#endif /* RT2860 */ - /* ======================================================================== @@ -2573,6 +1960,9 @@ VOID NICIssueReset( UINT32 Value = 0; DBGPRINT(RT_DEBUG_TRACE, ("--> NICIssueReset\n")); + // Abort Tx, prevent ASIC from writing to Host memory + //RTMP_IO_WRITE32(pAd, TX_CNTL_CSR, 0x001f0000); + // Disable Rx, register value supposed will remain after reset RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); Value &= (0xfffffff3); @@ -2644,10 +2034,6 @@ VOID NICUpdateFifoStaCounters( if (StaFifo.field.TxBF) // 3*3 pEntry->TxBFCount++; -#ifdef UAPSD_AP_SUPPORT - UAPSD_SP_AUE_Handle(pAd, pEntry, StaFifo.field.TxSuccess); -#endif // UAPSD_AP_SUPPORT // - if (!StaFifo.field.TxSuccess) { pEntry->FIFOCount++; @@ -2676,7 +2062,9 @@ VOID NICUpdateFifoStaCounters( pEntry->FIFOCount = 0; pEntry->ContinueTxFailCnt = 0; } + //pEntry->FIFOCount = 0; } + //pEntry->bSendBAR = TRUE; } else { @@ -2752,7 +2140,9 @@ VOID NICUpdateFifoStaCounters( VOID NICUpdateRawCounters( IN PRTMP_ADAPTER pAd) { - UINT32 OldValue; + UINT32 OldValue;//, Value2; + //ULONG PageSum, OneSecTransmitCount; + //ULONG TxErrorRatio, Retry, Fail; RX_STA_CNT0_STRUC RxStaCnt0; RX_STA_CNT1_STRUC RxStaCnt1; RX_STA_CNT2_STRUC RxStaCnt2; @@ -2768,6 +2158,10 @@ VOID NICUpdateRawCounters( TX_AGG_CNT5_STRUC TxAggCnt5; TX_AGG_CNT6_STRUC TxAggCnt6; TX_AGG_CNT7_STRUC TxAggCnt7; + COUNTER_RALINK *pRalinkCounters; + + + pRalinkCounters = &pAd->RalinkCounters; RTMP_IO_READ32(pAd, RX_STA_CNT0, &RxStaCnt0.word); RTMP_IO_READ32(pAd, RX_STA_CNT2, &RxStaCnt2.word); @@ -2787,22 +2181,23 @@ VOID NICUpdateRawCounters( pAd->WlanCounters.FCSErrorCount.u.HighPart++; // Add FCS error count to private counters - pAd->RalinkCounters.OneSecRxFcsErrCnt += RxStaCnt0.field.CrcErr; - OldValue = pAd->RalinkCounters.RealFcsErrCount.u.LowPart; - pAd->RalinkCounters.RealFcsErrCount.u.LowPart += RxStaCnt0.field.CrcErr; - if (pAd->RalinkCounters.RealFcsErrCount.u.LowPart < OldValue) - pAd->RalinkCounters.RealFcsErrCount.u.HighPart++; + pRalinkCounters->OneSecRxFcsErrCnt += RxStaCnt0.field.CrcErr; + OldValue = pRalinkCounters->RealFcsErrCount.u.LowPart; + pRalinkCounters->RealFcsErrCount.u.LowPart += RxStaCnt0.field.CrcErr; + if (pRalinkCounters->RealFcsErrCount.u.LowPart < OldValue) + pRalinkCounters->RealFcsErrCount.u.HighPart++; // Update Duplicate Rcv check - pAd->RalinkCounters.DuplicateRcv += RxStaCnt2.field.RxDupliCount; + pRalinkCounters->DuplicateRcv += RxStaCnt2.field.RxDupliCount; pAd->WlanCounters.FrameDuplicateCount.u.LowPart += RxStaCnt2.field.RxDupliCount; // Update RX Overflow counter pAd->Counters8023.RxNoBuffer += (RxStaCnt2.field.RxFifoOverflowCount); -#ifdef RT2870 - if (pAd->RalinkCounters.RxCount != pAd->watchDogRxCnt) + //pAd->RalinkCounters.RxCount = 0; +#ifdef RTMP_MAC_USB + if (pRalinkCounters->RxCount != pAd->watchDogRxCnt) { - pAd->watchDogRxCnt = pAd->RalinkCounters.RxCount; + pAd->watchDogRxCnt = pRalinkCounters->RxCount; pAd->watchDogRxOverFlowCnt = 0; } else @@ -2812,24 +2207,28 @@ VOID NICUpdateRawCounters( else pAd->watchDogRxOverFlowCnt = 0; } -#endif // RT2870 // +#endif // RTMP_MAC_USB // + //if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED) || + // (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED) && (pAd->MacTab.Size != 1))) if (!pAd->bUpdateBcnCntDone) { // Update BEACON sent count RTMP_IO_READ32(pAd, TX_STA_CNT0, &TxStaCnt0.word); RTMP_IO_READ32(pAd, TX_STA_CNT1, &StaTx1.word); RTMP_IO_READ32(pAd, TX_STA_CNT2, &StaTx2.word); - pAd->RalinkCounters.OneSecBeaconSentCnt += TxStaCnt0.field.TxBeaconCount; - pAd->RalinkCounters.OneSecTxRetryOkCount += StaTx1.field.TxRetransmit; - pAd->RalinkCounters.OneSecTxNoRetryOkCount += StaTx1.field.TxSuccess; - pAd->RalinkCounters.OneSecTxFailCount += TxStaCnt0.field.TxFailCount; + pRalinkCounters->OneSecBeaconSentCnt += TxStaCnt0.field.TxBeaconCount; + pRalinkCounters->OneSecTxRetryOkCount += StaTx1.field.TxRetransmit; + pRalinkCounters->OneSecTxNoRetryOkCount += StaTx1.field.TxSuccess; + pRalinkCounters->OneSecTxFailCount += TxStaCnt0.field.TxFailCount; pAd->WlanCounters.TransmittedFragmentCount.u.LowPart += StaTx1.field.TxSuccess; pAd->WlanCounters.RetryCount.u.LowPart += StaTx1.field.TxRetransmit; pAd->WlanCounters.FailedCount.u.LowPart += TxStaCnt0.field.TxFailCount; } + + //if (pAd->bStaFifoTest == TRUE) { RTMP_IO_READ32(pAd, TX_AGG_CNT, &TxAggCnt.word); RTMP_IO_READ32(pAd, TX_AGG_CNT0, &TxAggCnt0.word); @@ -2840,53 +2239,53 @@ VOID NICUpdateRawCounters( RTMP_IO_READ32(pAd, TX_AGG_CNT5, &TxAggCnt5.word); RTMP_IO_READ32(pAd, TX_AGG_CNT6, &TxAggCnt6.word); RTMP_IO_READ32(pAd, TX_AGG_CNT7, &TxAggCnt7.word); - pAd->RalinkCounters.TxAggCount += TxAggCnt.field.AggTxCount; - pAd->RalinkCounters.TxNonAggCount += TxAggCnt.field.NonAggTxCount; - pAd->RalinkCounters.TxAgg1MPDUCount += TxAggCnt0.field.AggSize1Count; - pAd->RalinkCounters.TxAgg2MPDUCount += TxAggCnt0.field.AggSize2Count; + pRalinkCounters->TxAggCount += TxAggCnt.field.AggTxCount; + pRalinkCounters->TxNonAggCount += TxAggCnt.field.NonAggTxCount; + pRalinkCounters->TxAgg1MPDUCount += TxAggCnt0.field.AggSize1Count; + pRalinkCounters->TxAgg2MPDUCount += TxAggCnt0.field.AggSize2Count; - pAd->RalinkCounters.TxAgg3MPDUCount += TxAggCnt1.field.AggSize3Count; - pAd->RalinkCounters.TxAgg4MPDUCount += TxAggCnt1.field.AggSize4Count; - pAd->RalinkCounters.TxAgg5MPDUCount += TxAggCnt2.field.AggSize5Count; - pAd->RalinkCounters.TxAgg6MPDUCount += TxAggCnt2.field.AggSize6Count; + pRalinkCounters->TxAgg3MPDUCount += TxAggCnt1.field.AggSize3Count; + pRalinkCounters->TxAgg4MPDUCount += TxAggCnt1.field.AggSize4Count; + pRalinkCounters->TxAgg5MPDUCount += TxAggCnt2.field.AggSize5Count; + pRalinkCounters->TxAgg6MPDUCount += TxAggCnt2.field.AggSize6Count; - pAd->RalinkCounters.TxAgg7MPDUCount += TxAggCnt3.field.AggSize7Count; - pAd->RalinkCounters.TxAgg8MPDUCount += TxAggCnt3.field.AggSize8Count; - pAd->RalinkCounters.TxAgg9MPDUCount += TxAggCnt4.field.AggSize9Count; - pAd->RalinkCounters.TxAgg10MPDUCount += TxAggCnt4.field.AggSize10Count; + pRalinkCounters->TxAgg7MPDUCount += TxAggCnt3.field.AggSize7Count; + pRalinkCounters->TxAgg8MPDUCount += TxAggCnt3.field.AggSize8Count; + pRalinkCounters->TxAgg9MPDUCount += TxAggCnt4.field.AggSize9Count; + pRalinkCounters->TxAgg10MPDUCount += TxAggCnt4.field.AggSize10Count; - pAd->RalinkCounters.TxAgg11MPDUCount += TxAggCnt5.field.AggSize11Count; - pAd->RalinkCounters.TxAgg12MPDUCount += TxAggCnt5.field.AggSize12Count; - pAd->RalinkCounters.TxAgg13MPDUCount += TxAggCnt6.field.AggSize13Count; - pAd->RalinkCounters.TxAgg14MPDUCount += TxAggCnt6.field.AggSize14Count; + pRalinkCounters->TxAgg11MPDUCount += TxAggCnt5.field.AggSize11Count; + pRalinkCounters->TxAgg12MPDUCount += TxAggCnt5.field.AggSize12Count; + pRalinkCounters->TxAgg13MPDUCount += TxAggCnt6.field.AggSize13Count; + pRalinkCounters->TxAgg14MPDUCount += TxAggCnt6.field.AggSize14Count; - pAd->RalinkCounters.TxAgg15MPDUCount += TxAggCnt7.field.AggSize15Count; - pAd->RalinkCounters.TxAgg16MPDUCount += TxAggCnt7.field.AggSize16Count; + pRalinkCounters->TxAgg15MPDUCount += TxAggCnt7.field.AggSize15Count; + pRalinkCounters->TxAgg16MPDUCount += TxAggCnt7.field.AggSize16Count; // Calculate the transmitted A-MPDU count - pAd->RalinkCounters.TransmittedAMPDUCount.u.LowPart += TxAggCnt0.field.AggSize1Count; - pAd->RalinkCounters.TransmittedAMPDUCount.u.LowPart += (TxAggCnt0.field.AggSize2Count / 2); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += TxAggCnt0.field.AggSize1Count; + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt0.field.AggSize2Count / 2); - pAd->RalinkCounters.TransmittedAMPDUCount.u.LowPart += (TxAggCnt1.field.AggSize3Count / 3); - pAd->RalinkCounters.TransmittedAMPDUCount.u.LowPart += (TxAggCnt1.field.AggSize4Count / 4); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt1.field.AggSize3Count / 3); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt1.field.AggSize4Count / 4); - pAd->RalinkCounters.TransmittedAMPDUCount.u.LowPart += (TxAggCnt2.field.AggSize5Count / 5); - pAd->RalinkCounters.TransmittedAMPDUCount.u.LowPart += (TxAggCnt2.field.AggSize6Count / 6); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt2.field.AggSize5Count / 5); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt2.field.AggSize6Count / 6); - pAd->RalinkCounters.TransmittedAMPDUCount.u.LowPart += (TxAggCnt3.field.AggSize7Count / 7); - pAd->RalinkCounters.TransmittedAMPDUCount.u.LowPart += (TxAggCnt3.field.AggSize8Count / 8); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt3.field.AggSize7Count / 7); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt3.field.AggSize8Count / 8); - pAd->RalinkCounters.TransmittedAMPDUCount.u.LowPart += (TxAggCnt4.field.AggSize9Count / 9); - pAd->RalinkCounters.TransmittedAMPDUCount.u.LowPart += (TxAggCnt4.field.AggSize10Count / 10); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt4.field.AggSize9Count / 9); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt4.field.AggSize10Count / 10); - pAd->RalinkCounters.TransmittedAMPDUCount.u.LowPart += (TxAggCnt5.field.AggSize11Count / 11); - pAd->RalinkCounters.TransmittedAMPDUCount.u.LowPart += (TxAggCnt5.field.AggSize12Count / 12); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt5.field.AggSize11Count / 11); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt5.field.AggSize12Count / 12); - pAd->RalinkCounters.TransmittedAMPDUCount.u.LowPart += (TxAggCnt6.field.AggSize13Count / 13); - pAd->RalinkCounters.TransmittedAMPDUCount.u.LowPart += (TxAggCnt6.field.AggSize14Count / 14); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt6.field.AggSize13Count / 13); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt6.field.AggSize14Count / 14); - pAd->RalinkCounters.TransmittedAMPDUCount.u.LowPart += (TxAggCnt7.field.AggSize15Count / 15); - pAd->RalinkCounters.TransmittedAMPDUCount.u.LowPart += (TxAggCnt7.field.AggSize16Count / 16); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt7.field.AggSize15Count / 15); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt7.field.AggSize16Count / 16); } @@ -2932,112 +2331,38 @@ VOID NICResetFromError( AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); } -/* - ======================================================================== - - Routine Description: - erase 8051 firmware image in MAC ASIC - - Arguments: - Adapter Pointer to our adapter - - IRQL = PASSIVE_LEVEL - ======================================================================== -*/ -VOID NICEraseFirmware( +NDIS_STATUS NICLoadFirmware( IN PRTMP_ADAPTER pAd) { - ULONG i; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; + if (pAd->chipOps.loadFirmware) + status = pAd->chipOps.loadFirmware(pAd); - for(i=0; iMACVersion >> 16); -#endif // RT2870 // - - pFirmwareImage = FirmwareImage; - FileLength = sizeof(FirmwareImage); -#ifdef RT2870 - // New 8k byte firmware size for RT3071/RT3072 - //printk("Usb Chip\n"); - if (FIRMWAREIMAGE_LENGTH == FIRMWAREIMAGE_MAX_LENGTH) - //The firmware image consists of two parts. One is the origianl and the other is the new. - //Use Second Part - { - if ((Version != 0x2860) && (Version != 0x2872) && (Version != 0x3070)) - { // Use Firmware V2. - //printk("KH:Use New Version,part2\n"); - pFirmwareImage = (PUCHAR)&FirmwareImage[FIRMWAREIMAGEV1_LENGTH]; - FileLength = FIRMWAREIMAGEV2_LENGTH; - } - else - { - //printk("KH:Use New Version,part1\n"); - pFirmwareImage = FirmwareImage; - FileLength = FIRMWAREIMAGEV1_LENGTH; - } - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("KH: bin file should be 8KB.\n")); - Status = NDIS_STATUS_FAILURE; - } - -#endif // RT2870 // + if (pAd->chipOps.eraseFirmware) + pAd->chipOps.eraseFirmware(pAd); - RT28XX_WRITE_FIRMWARE(pAd, pFirmwareImage, FileLength); - - /* check if MCU is ready */ - Index = 0; - do - { - RTMP_IO_READ32(pAd, PBF_SYS_CTRL, &MacReg); - - if (MacReg & 0x80) - break; - - RTMPusecDelay(1000); - } while (Index++ < 1000); - - if (Index > 1000) - { - Status = NDIS_STATUS_FAILURE; - DBGPRINT(RT_DEBUG_ERROR, ("NICLoadFirmware: MCU is not ready\n\n\n")); - } /* End of if */ - - DBGPRINT(RT_DEBUG_TRACE, - ("<=== %s (status=%d)\n", __func__, Status)); - return Status; -} /* End of NICLoadFirmware */ +}/* End of NICEraseFirmware */ /* @@ -3067,52 +2392,6 @@ NDIS_STATUS NICLoadRateSwitchingParams( return NDIS_STATUS_SUCCESS; } -/* - ======================================================================== - - Routine Description: - if pSrc1 all zero with length Length, return 0. - If not all zero, return 1 - - Arguments: - pSrc1 - - Return Value: - 1: not all zero - 0: all zero - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -ULONG RTMPNotAllZero( - IN PVOID pSrc1, - IN ULONG Length) -{ - PUCHAR pMem1; - ULONG Index = 0; - - pMem1 = (PUCHAR) pSrc1; - - for (Index = 0; Index < Length; Index++) - { - if (pMem1[Index] != 0x0) - { - break; - } - } - - if (Index == Length) - { - return (0); - } - else - { - return (1); - } -} /* ======================================================================== @@ -3194,21 +2473,6 @@ VOID RTMPZeroMemory( } } -VOID RTMPFillMemory( - IN PVOID pSrc, - IN ULONG Length, - IN UCHAR Fill) -{ - PUCHAR pMem; - ULONG Index = 0; - - pMem = (PUCHAR) pSrc; - - for (Index = 0; Index < Length; Index++) - { - pMem[Index] = Fill; - } -} /* ======================================================================== @@ -3279,7 +2543,7 @@ VOID UserCfgInit( // // part I. intialize common configuration // -#ifdef RT2870 +#ifdef RTMP_MAC_USB pAd->BulkOutReq = 0; pAd->BulkOutComplete = 0; @@ -3294,7 +2558,7 @@ VOID UserCfgInit( pAd->bUsbTxBulkAggre = 0; // init as unsed value to ensure driver will set to MCU once. - pAd->LedIndicatorStregth = 0xFF; + pAd->LedIndicatorStrength = 0xFF; pAd->CommonCfg.MaxPktOneTxBulk = 2; pAd->CommonCfg.TxBulkFactor = 1; @@ -3303,7 +2567,7 @@ VOID UserCfgInit( pAd->CommonCfg.TxPower = 100; //mW NdisZeroMemory(&pAd->CommonCfg.IOTestParm, sizeof(pAd->CommonCfg.IOTestParm)); -#endif // RT2870 // +#endif // RTMP_MAC_USB // for(key_index=0; key_indexEepromAccess = FALSE; -#endif + pAd->Antenna.word = 0; pAd->CommonCfg.BBPCurrentBW = BW_20; pAd->LedCntl.word = 0; -#ifdef RT2860 - pAd->LedIndicatorStregth = 0; +#ifdef RTMP_MAC_PCI + pAd->LedIndicatorStrength = 0; pAd->RLnkCtrlOffset = 0; pAd->HostLnkCtrlOffset = 0; - pAd->CheckDmaBusyCount = 0; -#endif +#endif // RTMP_MAC_PCI // pAd->bAutoTxAgcA = FALSE; // Default is OFF pAd->bAutoTxAgcG = FALSE; // Default is OFF @@ -3355,6 +2617,10 @@ VOID UserCfgInit( pAd->CommonCfg.RadarDetect.CSPeriod = 10; pAd->CommonCfg.RadarDetect.CSCount = 0; pAd->CommonCfg.RadarDetect.RDMode = RD_NORMAL_MODE; + + + + pAd->CommonCfg.RadarDetect.ChMovingTime = 65; pAd->CommonCfg.RadarDetect.LongPulseRadarTh = 3; pAd->CommonCfg.bAPSDCapable = FALSE; @@ -3386,10 +2652,18 @@ VOID UserCfgInit( pAd->CommonCfg.bExtChannelSwitchAnnouncement = 1; pAd->CommonCfg.bHTProtect = 1; pAd->CommonCfg.bMIMOPSEnable = TRUE; + //2008/11/05:KH add to support Antenna power-saving of AP<-- + pAd->CommonCfg.bGreenAPEnable=FALSE; + //2008/11/05:KH add to support Antenna power-saving of AP--> pAd->CommonCfg.bBADecline = FALSE; pAd->CommonCfg.bDisableReordering = FALSE; + if (pAd->MACVersion == 0x28720200) + { + pAd->CommonCfg.TxBASize = 13; //by Jerry recommend + }else{ pAd->CommonCfg.TxBASize = 7; + } pAd->CommonCfg.REGBACapability.word = pAd->CommonCfg.BACapability.word; @@ -3467,12 +2741,6 @@ VOID UserCfgInit( // Patch for Ndtest pAd->StaCfg.ScanCnt = 0; - // CCX 2.0 control flag init - pAd->StaCfg.CCXEnable = FALSE; - pAd->StaCfg.CCXReqType = MSRN_TYPE_UNUSED; - pAd->StaCfg.CCXQosECWMin = 4; - pAd->StaCfg.CCXQosECWMax = 10; - pAd->StaCfg.bHwRadio = TRUE; // Default Hardware Radio status is On pAd->StaCfg.bSwRadio = TRUE; // Default Software Radio status is On pAd->StaCfg.bRadio = TRUE; // bHwRadio && bSwRadio @@ -3484,14 +2752,31 @@ VOID UserCfgInit( // Save the init time as last scan time, the system should do scan after 2 seconds. // This patch is for driver wake up from standby mode, system will do scan right away. - pAd->StaCfg.LastScanTime = 0; + NdisGetSystemUpTime(&pAd->StaCfg.LastScanTime); + if (pAd->StaCfg.LastScanTime > 10 * OS_HZ) + pAd->StaCfg.LastScanTime -= (10 * OS_HZ); + NdisZeroMemory(pAd->nickname, IW_ESSID_MAX_SIZE+1); - sprintf(pAd->nickname, "%s", STA_NIC_DEVICE_NAME); +#ifdef RTMP_MAC_USB + sprintf((PSTRING) pAd->nickname, "RT2870STA"); +#endif // RTMP_MAC_USB // RTMPInitTimer(pAd, &pAd->StaCfg.WpaDisassocAndBlockAssocTimer, GET_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc), pAd, FALSE); pAd->StaCfg.IEEE8021X = FALSE; pAd->StaCfg.IEEE8021x_required_keys = FALSE; pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_DISABLE; + pAd->StaCfg.bRSN_IE_FromWpaSupplicant = FALSE; pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_ENABLE; + pAd->StaCfg.bLostAp = FALSE; + + NdisZeroMemory(pAd->StaCfg.ReplayCounter, 8); + + + pAd->StaCfg.bAutoConnectByBssid = FALSE; + pAd->StaCfg.BeaconLostTime = BEACON_LOST_TIME; + NdisZeroMemory(pAd->StaCfg.WpaPassPhrase, 64); + pAd->StaCfg.WpaPassPhraseLen = 0; + pAd->StaCfg.bAutoRoaming = FALSE; + pAd->StaCfg.bForceTxBurst = FALSE; } // Default for extra information is not valid @@ -3524,22 +2809,30 @@ VOID UserCfgInit( pAd->Bbp94 = BBPR94_DEFAULT; pAd->BbpForCCK = FALSE; + // Default is FALSE for test bit 1 + //pAd->bTest1 = FALSE; + // initialize MAC table and allocate spin lock NdisZeroMemory(&pAd->MacTab, sizeof(MAC_TABLE)); InitializeQueueHeader(&pAd->MacTab.McastPsQueue); NdisAllocateSpinLock(&pAd->MacTabLock); + //RTMPInitTimer(pAd, &pAd->RECBATimer, RECBATimerTimeout, pAd, TRUE); + //RTMPSetTimer(&pAd->RECBATimer, REORDER_EXEC_INTV); + + + pAd->CommonCfg.bWiFiTest = FALSE; -#ifdef RT2860 +#ifdef RTMP_MAC_PCI pAd->bPCIclkOff = FALSE; +#endif // RTMP_MAC_PCI // - RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); -#endif +RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); DBGPRINT(RT_DEBUG_TRACE, ("<-- UserCfgInit\n")); } // IRQL = PASSIVE_LEVEL -UCHAR BtoH(char ch) +UCHAR BtoH(STRING ch) { if (ch >= '0' && ch <= '9') return (ch - '0'); // Handle numerals if (ch >= 'A' && ch <= 'F') return (ch - 'A' + 0xA); // Handle capitol hex digits @@ -3564,9 +2857,9 @@ UCHAR BtoH(char ch) // // IRQL = PASSIVE_LEVEL -void AtoH(char * src, UCHAR * dest, int destlen) +void AtoH(PSTRING src, PUCHAR dest, int destlen) { - char * srcptr; + PSTRING srcptr; PUCHAR destTemp; srcptr = src; @@ -3580,24 +2873,10 @@ void AtoH(char * src, UCHAR * dest, int destlen) } } -VOID RTMPPatchMacBbpBug( - IN PRTMP_ADAPTER pAd) -{ - ULONG Index; - - // Initialize BBP register to default value - for (Index = 0; Index < NUM_BBP_REG_PARMS; Index++) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBPRegTable[Index].Register, (UCHAR)BBPRegTable[Index].Value); - } - // Initialize RF register to default value - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); +//+++Mark by shiang, not use now, need to remove after confirm +//---Mark by shiang, not use now, need to remove after confirm - // Re-init BBP register from EEPROM value - NICInitAsicFromEEPROM(pAd); -} /* ======================================================================== @@ -3636,9 +2915,9 @@ VOID RTMPInitTimer( pTimer->State = FALSE; pTimer->cookie = (ULONG) pData; -#ifdef RT2870 +#ifdef RTMP_TIMER_TASK_SUPPORT pTimer->pAd = pAd; -#endif // RT2870 // +#endif // RTMP_TIMER_TASK_SUPPORT // RTMP_OS_Init_Timer(pAd, &pTimer->TimerObj, pTimerFunc, (PVOID) pTimer); } @@ -3760,24 +3039,20 @@ VOID RTMPCancelTimer( { if (pTimer->State == FALSE) pTimer->Repeat = FALSE; + RTMP_OS_Del_Timer(&pTimer->TimerObj, pCancelled); if (*pCancelled == TRUE) pTimer->State = TRUE; -#ifdef RT2870 +#ifdef RTMP_TIMER_TASK_SUPPORT // We need to go-through the TimerQ to findout this timer handler and remove it if // it's still waiting for execution. - - RT2870_TimerQ_Remove(pTimer->pAd, pTimer); -#endif // RT2870 // + RtmpTimerQRemove(pTimer->pAd, pTimer); +#endif // RTMP_TIMER_TASK_SUPPORT // } else { - // - // NdisMCancelTimer just canced the timer and not mean release the timer. - // And don't set the "Valid" to False. So that we can use this timer again. - // DBGPRINT_ERR(("RTMPCancelTimer failed, Timer hasn't been initialize!\n")); } } @@ -3816,7 +3091,7 @@ VOID RTMPSetLED( case LED_LINK_DOWN: HighByte = 0x20; AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); - pAd->LedIndicatorStregth = 0; + pAd->LedIndicatorStrength = 0; break; case LED_LINK_UP: if (pAd->CommonCfg.Channel > 14) @@ -3895,14 +3170,8 @@ VOID RTMPSetSignalLED( { UCHAR nLed = 0; - // - // if not Signal Stregth, then do nothing. - // - if (pAd->LedCntl.field.LedMode != LED_MODE_SIGNAL_STREGTH) + if (pAd->LedCntl.field.LedMode == LED_MODE_SIGNAL_STREGTH) { - return; - } - if (Dbm <= -90) nLed = 0; else if (Dbm <= -81) @@ -3919,10 +3188,11 @@ VOID RTMPSetSignalLED( // // Update Signal Stregth to firmware if changed. // - if (pAd->LedIndicatorStregth != nLed) + if (pAd->LedIndicatorStrength != nLed) { AsicSendCommandToMcu(pAd, 0x51, 0xff, nLed, pAd->LedCntl.field.Polarity); - pAd->LedIndicatorStregth = nLed; + pAd->LedIndicatorStrength = nLed; + } } } @@ -3947,6 +3217,10 @@ VOID RTMPSetSignalLED( VOID RTMPEnableRxTx( IN PRTMP_ADAPTER pAd) { +// WPDMA_GLO_CFG_STRUC GloCfg; +// ULONG i = 0; + UINT32 rx_filter_flag; + DBGPRINT(RT_DEBUG_TRACE, ("==> RTMPEnableRxTx\n")); // Enable Rx DMA. @@ -3955,14 +3229,18 @@ VOID RTMPEnableRxTx( // enable RX of MAC block if (pAd->OpMode == OPMODE_AP) { - UINT32 rx_filter_flag = APNORMAL; + rx_filter_flag = APNORMAL; RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, rx_filter_flag); // enable RX of DMA block } else { - RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, STANORMAL); // Staion not drop control frame will fail WiFi Certification. + if (pAd->CommonCfg.PSPXlink) + rx_filter_flag = PSPXLINK; + else + rx_filter_flag = STANORMAL; // Staion not drop control frame will fail WiFi Certification. + RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, rx_filter_flag); } RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0xc); @@ -3970,3 +3248,380 @@ VOID RTMPEnableRxTx( } +//+++Add by shiang, move from os/linux/rt_main_dev.c +void CfgInitHook(PRTMP_ADAPTER pAd) +{ + pAd->bBroadComHT = TRUE; +} + + +int rt28xx_init( + IN PRTMP_ADAPTER pAd, + IN PSTRING pDefaultMac, + IN PSTRING pHostName) +{ + UINT index; + UCHAR TmpPhy; + NDIS_STATUS Status; + UINT32 MacCsr0 = 0; + + +#ifdef RTMP_MAC_PCI + { + // If dirver doesn't wake up firmware here, + // NICLoadFirmware will hang forever when interface is up again. + // RT2860 PCI + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) && + OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + { + AUTO_WAKEUP_STRUC AutoWakeupCfg; + AsicForceWakeup(pAd, TRUE); + AutoWakeupCfg.word = 0; + RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); + } + } +#endif // RTMP_MAC_PCI // + + + // reset Adapter flags + RTMP_CLEAR_FLAGS(pAd); + + // Init BssTab & ChannelInfo tabbles for auto channel select. + + // Allocate BA Reordering memory + ba_reordering_resource_init(pAd, MAX_REORDERING_MPDU_NUM); + + // Make sure MAC gets ready. + index = 0; + do + { + RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0); + pAd->MACVersion = MacCsr0; + + if ((pAd->MACVersion != 0x00) && (pAd->MACVersion != 0xFFFFFFFF)) + break; + + RTMPusecDelay(10); + } while (index++ < 100); + DBGPRINT(RT_DEBUG_TRACE, ("MAC_CSR0 [ Ver:Rev=0x%08x]\n", pAd->MACVersion)); + +#ifdef RTMP_MAC_PCI + + // To fix driver disable/enable hang issue when radio off + RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x2); +#endif // RTMP_MAC_PCI // + + // Disable DMA + RT28XXDMADisable(pAd); + + + // Load 8051 firmware + Status = NICLoadFirmware(pAd); + if (Status != NDIS_STATUS_SUCCESS) + { + DBGPRINT_ERR(("NICLoadFirmware failed, Status[=0x%08x]\n", Status)); + goto err1; + } + + NICLoadRateSwitchingParams(pAd); + + // Disable interrupts here which is as soon as possible + // This statement should never be true. We might consider to remove it later +#ifdef RTMP_MAC_PCI + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) + { + RTMP_ASIC_INTERRUPT_DISABLE(pAd); + } +#endif // RTMP_MAC_PCI // + + Status = RTMPAllocTxRxRingMemory(pAd); + if (Status != NDIS_STATUS_SUCCESS) + { + DBGPRINT_ERR(("RTMPAllocDMAMemory failed, Status[=0x%08x]\n", Status)); + goto err1; + } + + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE); + + // initialize MLME + // + + Status = RtmpMgmtTaskInit(pAd); + if (Status != NDIS_STATUS_SUCCESS) + goto err2; + + Status = MlmeInit(pAd); + if (Status != NDIS_STATUS_SUCCESS) + { + DBGPRINT_ERR(("MlmeInit failed, Status[=0x%08x]\n", Status)); + goto err2; + } + + // Initialize pAd->StaCfg, pAd->ApCfg, pAd->CommonCfg to manufacture default + // + UserCfgInit(pAd); + Status = RtmpNetTaskInit(pAd); + if (Status != NDIS_STATUS_SUCCESS) + goto err3; + +// COPY_MAC_ADDR(pAd->ApCfg.MBSSID[apidx].Bssid, netif->hwaddr); +// pAd->bForcePrintTX = TRUE; + + CfgInitHook(pAd); + + NdisAllocateSpinLock(&pAd->MacTabLock); + + MeasureReqTabInit(pAd); + TpcReqTabInit(pAd); + + // + // Init the hardware, we need to init asic before read registry, otherwise mac register will be reset + // + Status = NICInitializeAdapter(pAd, TRUE); + if (Status != NDIS_STATUS_SUCCESS) + { + DBGPRINT_ERR(("NICInitializeAdapter failed, Status[=0x%08x]\n", Status)); + if (Status != NDIS_STATUS_SUCCESS) + goto err3; + } + + // Read parameters from Config File + Status = RTMPReadParametersHook(pAd); + + DBGPRINT(RT_DEBUG_OFF, ("1. Phy Mode = %d\n", pAd->CommonCfg.PhyMode)); + if (Status != NDIS_STATUS_SUCCESS) + { + DBGPRINT_ERR(("NICReadRegParameters failed, Status[=0x%08x]\n",Status)); +// goto err4; + Status = 0; + } + +#ifdef RTMP_MAC_USB + pAd->CommonCfg.bMultipleIRP = FALSE; + + if (pAd->CommonCfg.bMultipleIRP) + pAd->CommonCfg.NumOfBulkInIRP = RX_RING_SIZE; + else + pAd->CommonCfg.NumOfBulkInIRP = 1; +#endif // RTMP_MAC_USB // + + //Init Ba Capability parameters. +// RT28XX_BA_INIT(pAd); + pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity; + pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable; + pAd->CommonCfg.DesiredHtPhy.AmsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize; + pAd->CommonCfg.DesiredHtPhy.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode; + // UPdata to HT IE + pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode; + pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize; + pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity; + + // after reading Registry, we now know if in AP mode or STA mode + + // Load 8051 firmware; crash when FW image not existent + // Status = NICLoadFirmware(pAd); + // if (Status != NDIS_STATUS_SUCCESS) + // break; + + DBGPRINT(RT_DEBUG_OFF, ("2. Phy Mode = %d\n", pAd->CommonCfg.PhyMode)); + + // We should read EEPROM for all cases. rt2860b + NICReadEEPROMParameters(pAd, (PUCHAR)pDefaultMac); + + DBGPRINT(RT_DEBUG_OFF, ("3. Phy Mode = %d\n", pAd->CommonCfg.PhyMode)); + + NICInitAsicFromEEPROM(pAd); //rt2860b + + // Set PHY to appropriate mode + TmpPhy = pAd->CommonCfg.PhyMode; + pAd->CommonCfg.PhyMode = 0xff; + RTMPSetPhyMode(pAd, TmpPhy); + SetCommonHT(pAd); + + // No valid channels. + if (pAd->ChannelListNum == 0) + { + DBGPRINT(RT_DEBUG_ERROR, ("Wrong configuration. No valid channel found. Check \"ContryCode\" and \"ChannelGeography\" setting.\n")); + goto err4; + } + + DBGPRINT(RT_DEBUG_OFF, ("MCS Set = %02x %02x %02x %02x %02x\n", pAd->CommonCfg.HtCapability.MCSSet[0], + pAd->CommonCfg.HtCapability.MCSSet[1], pAd->CommonCfg.HtCapability.MCSSet[2], + pAd->CommonCfg.HtCapability.MCSSet[3], pAd->CommonCfg.HtCapability.MCSSet[4])); + +#ifdef RTMP_RF_RW_SUPPORT + //Init RT30xx RFRegisters after read RFIC type from EEPROM + NICInitRFRegisters(pAd); +#endif // RTMP_RF_RW_SUPPORT // + +// APInitialize(pAd); + + + // + // Initialize RF register to default value + // + AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); + AsicLockChannel(pAd, pAd->CommonCfg.Channel); + + // 8051 firmware require the signal during booting time. + //2008/11/28:KH marked the following codes to patch Frequency offset bug + //AsicSendCommandToMcu(pAd, 0x72, 0xFF, 0x00, 0x00); + + if (pAd && (Status != NDIS_STATUS_SUCCESS)) + { + // + // Undo everything if it failed + // + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) + { +// NdisMDeregisterInterrupt(&pAd->Interrupt); + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE); + } +// RTMPFreeAdapter(pAd); // we will free it in disconnect() + } + else if (pAd) + { + // Microsoft HCT require driver send a disconnect event after driver initialization. + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); +// pAd->IndicateMediaState = NdisMediaStateDisconnected; + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_MEDIA_STATE_CHANGE); + + DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_DISCONNECT Event B!\n")); + +#ifdef RTMP_MAC_USB + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS); + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS); + + // + // Support multiple BulkIn IRP, + // the value on pAd->CommonCfg.NumOfBulkInIRP may be large than 1. + // + for(index=0; indexCommonCfg.NumOfBulkInIRP; index++) + { + RTUSBBulkReceive(pAd); + DBGPRINT(RT_DEBUG_TRACE, ("RTUSBBulkReceive!\n" )); + } +#endif // RTMP_MAC_USB // + }// end of else + + + // Set up the Mac address + RtmpOSNetDevAddrSet(pAd->net_dev, &pAd->CurrentAddress[0]); + + DBGPRINT_S(Status, ("<==== rt28xx_init, Status=%x\n", Status)); + + return TRUE; + + +err4: +err3: + MlmeHalt(pAd); +err2: + RTMPFreeTxRxRingMemory(pAd); +err1: + + os_free_mem(pAd, pAd->mpdu_blk_pool.mem); // free BA pool + + // shall not set priv to NULL here because the priv didn't been free yet. + //net_dev->ml_priv = 0; +#ifdef ST +err0: +#endif // ST // + + DBGPRINT(RT_DEBUG_ERROR, ("!!! rt28xx Initialized fail !!!\n")); + return FALSE; +} +//---Add by shiang, move from os/linux/rt_main_dev.c + + +static INT RtmpChipOpsRegister( + IN RTMP_ADAPTER *pAd, + IN INT infType) +{ + RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + int status; + + memset(pChipOps, 0, sizeof(RTMP_CHIP_OP)); + + /* set eeprom related hook functions */ + status = RtmpChipOpsEepromHook(pAd, infType); + + /* set mcu related hook functions */ + switch(infType) + { +#ifdef RTMP_PCI_SUPPORT + case RTMP_DEV_INF_PCI: + pChipOps->loadFirmware = RtmpAsicLoadFirmware; + pChipOps->eraseFirmware = RtmpAsicEraseFirmware; + pChipOps->sendCommandToMcu = RtmpAsicSendCommandToMcu; + break; +#endif // RTMP_PCI_SUPPORT // +#ifdef RTMP_USB_SUPPORT + case RTMP_DEV_INF_USB: + pChipOps->loadFirmware = RtmpAsicLoadFirmware; + pChipOps->sendCommandToMcu = RtmpAsicSendCommandToMcu; + break; +#endif // RTMP_USB_SUPPORT // + default: + break; + } + + return status; +} + + +INT RtmpRaDevCtrlInit( + IN RTMP_ADAPTER *pAd, + IN RTMP_INF_TYPE infType) +{ + //VOID *handle; + + // Assign the interface type. We need use it when do register/EEPROM access. + pAd->infType = infType; + + + pAd->OpMode = OPMODE_STA; + DBGPRINT(RT_DEBUG_TRACE, ("STA Driver version-%s\n", STA_DRIVER_VERSION)); + +#ifdef RTMP_MAC_USB + init_MUTEX(&(pAd->UsbVendorReq_semaphore)); + os_alloc_mem(pAd, (PUCHAR)&pAd->UsbVendorReqBuf, MAX_PARAM_BUFFER_SIZE - 1); + if (pAd->UsbVendorReqBuf == NULL) + { + DBGPRINT(RT_DEBUG_ERROR, ("Allocate vendor request temp buffer failed!\n")); + return FALSE; + } +#endif // RTMP_MAC_USB // + + RtmpChipOpsRegister(pAd, infType); + + + return 0; +} + + +BOOLEAN RtmpRaDevCtrlExit(IN RTMP_ADAPTER *pAd) +{ + + + RTMPFreeAdapter(pAd); + + return TRUE; +} + + +// not yet support MBSS +PNET_DEV get_netdev_from_bssid( + IN PRTMP_ADAPTER pAd, + IN UCHAR FromWhichBSSID) +{ + PNET_DEV dev_p = NULL; + + { + dev_p = pAd->net_dev; + } + + ASSERT(dev_p); + return dev_p; /* return one of MBSS */ +} diff --git a/drivers/staging/rt2860/common/rtmp_mcu.c b/drivers/staging/rt2860/common/rtmp_mcu.c new file mode 100644 index 000000000000..24531c58f90e --- /dev/null +++ b/drivers/staging/rt2860/common/rtmp_mcu.c @@ -0,0 +1,233 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + rtmp_mcu.c + + Abstract: + Miniport generic portion header file + + Revision History: + Who When What + -------- ---------- ---------------------------------------------- +*/ + + +#include "../rt_config.h" + +#ifdef RT2860 +#include "firmware.h" +#endif +#ifdef RT2870 +#include "../../rt3070/firmware.h" +#include "firmware_3070.h" +#endif + +#include + +//#define BIN_IN_FILE /* use *.bin firmware */ + +#ifdef RTMP_MAC_USB +// +// RT2870 Firmware Spec only used 1 oct for version expression +// +#define FIRMWARE_MINOR_VERSION 7 +#endif // RTMP_MAC_USB // + +// New 8k byte firmware size for RT3071/RT3072 +#define FIRMWAREIMAGE_MAX_LENGTH 0x2000 +#define FIRMWAREIMAGE_LENGTH (sizeof (FirmwareImage) / sizeof(UCHAR)) +#define FIRMWARE_MAJOR_VERSION 0 + +#define FIRMWAREIMAGEV1_LENGTH 0x1000 +#define FIRMWAREIMAGEV2_LENGTH 0x1000 + +#ifdef RTMP_MAC_PCI +#define FIRMWARE_MINOR_VERSION 2 +#endif // RTMP_MAC_PCI // + +/* + ======================================================================== + + Routine Description: + erase 8051 firmware image in MAC ASIC + + Arguments: + Adapter Pointer to our adapter + + IRQL = PASSIVE_LEVEL + + ======================================================================== +*/ +INT RtmpAsicEraseFirmware( + IN PRTMP_ADAPTER pAd) +{ + ULONG i; + + for(i=0; iMACVersion >> 16); + +// pFirmwareImage = FirmwareImage; +// FileLength = sizeof(FirmwareImage); + + // New 8k byte firmware size for RT3071/RT3072 + { +#ifdef RTMP_MAC_PCI + if ((Version == 0x2860) || (Version == 0x3572) || IS_RT3090(pAd)) + { + pFirmwareImage = FirmwareImage_2860; + FileLength = FIRMWAREIMAGE_MAX_LENGTH; + } +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB + /* the firmware image consists of two parts */ + if ((Version != 0x2860) && (Version != 0x2872) && (Version != 0x3070)) + { /* use the second part */ + //printk("KH:Use New Version,part2\n"); + pFirmwareImage = (PUCHAR)&FirmwareImage_3070[FIRMWAREIMAGEV1_LENGTH]; + FileLength = FIRMWAREIMAGEV2_LENGTH; + } + else + { + //printk("KH:Use New Version,part1\n"); + if (Version == 0x3070) + pFirmwareImage = FirmwareImage_3070; + else + pFirmwareImage = FirmwareImage_2870; + FileLength = FIRMWAREIMAGEV1_LENGTH; + } +#endif // RTMP_MAC_USB // + } + + RTMP_WRITE_FIRMWARE(pAd, pFirmwareImage, FileLength); + + + /* check if MCU is ready */ + Index = 0; + do + { + RTMP_IO_READ32(pAd, PBF_SYS_CTRL, &MacReg); + + if (MacReg & 0x80) + break; + + RTMPusecDelay(1000); + } while (Index++ < 1000); + + if (Index > 1000) + { + DBGPRINT(RT_DEBUG_ERROR, ("NICLoadFirmware: MCU is not ready\n\n\n")); + Status = NDIS_STATUS_FAILURE; + } + + DBGPRINT(RT_DEBUG_TRACE, ("<=== %s (status=%d)\n", __func__, Status)); + + return Status; +} + + +INT RtmpAsicSendCommandToMcu( + IN PRTMP_ADAPTER pAd, + IN UCHAR Command, + IN UCHAR Token, + IN UCHAR Arg0, + IN UCHAR Arg1) +{ + HOST_CMD_CSR_STRUC H2MCmd; + H2M_MAILBOX_STRUC H2MMailbox; + ULONG i = 0; +#ifdef RTMP_MAC_PCI +#endif // RTMP_MAC_PCI // + + do + { + RTMP_IO_READ32(pAd, H2M_MAILBOX_CSR, &H2MMailbox.word); + if (H2MMailbox.field.Owner == 0) + break; + + RTMPusecDelay(2); + } while(i++ < 100); + + if (i > 100) + { +#ifdef RTMP_MAC_PCI +#endif // RTMP_MAC_PCI // + { + DBGPRINT_ERR(("H2M_MAILBOX still hold by MCU. command fail\n")); + } + return FALSE; + } + +#ifdef RTMP_MAC_PCI +#endif // RTMP_MAC_PCI // + + H2MMailbox.field.Owner = 1; // pass ownership to MCU + H2MMailbox.field.CmdToken = Token; + H2MMailbox.field.HighByte = Arg1; + H2MMailbox.field.LowByte = Arg0; + RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CSR, H2MMailbox.word); + + H2MCmd.word = 0; + H2MCmd.field.HostCommand = Command; + RTMP_IO_WRITE32(pAd, HOST_CMD_CSR, H2MCmd.word); + + if (Command != 0x80) + { + } + + return TRUE; +} diff --git a/drivers/staging/rt2860/common/rtmp_timer.c b/drivers/staging/rt2860/common/rtmp_timer.c new file mode 100644 index 000000000000..258ab1bb0f03 --- /dev/null +++ b/drivers/staging/rt2860/common/rtmp_timer.c @@ -0,0 +1,323 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + rtmp_timer.c + + Abstract: + task for timer handling + + Revision History: + Who When What + -------- ---------- ---------------------------------------------- + Name Date Modification logs + Shiang Tu 08-28-2008 init version + +*/ + +#include "../rt_config.h" + + +BUILD_TIMER_FUNCTION(MlmePeriodicExec); +//BUILD_TIMER_FUNCTION(MlmeRssiReportExec); +BUILD_TIMER_FUNCTION(AsicRxAntEvalTimeout); +BUILD_TIMER_FUNCTION(APSDPeriodicExec); +BUILD_TIMER_FUNCTION(AsicRfTuningExec); +#ifdef RTMP_MAC_USB +BUILD_TIMER_FUNCTION(BeaconUpdateExec); +#endif // RTMP_MAC_USB // + +BUILD_TIMER_FUNCTION(BeaconTimeout); +BUILD_TIMER_FUNCTION(ScanTimeout); +BUILD_TIMER_FUNCTION(AuthTimeout); +BUILD_TIMER_FUNCTION(AssocTimeout); +BUILD_TIMER_FUNCTION(ReassocTimeout); +BUILD_TIMER_FUNCTION(DisassocTimeout); +BUILD_TIMER_FUNCTION(LinkDownExec); +BUILD_TIMER_FUNCTION(StaQuickResponeForRateUpExec); +BUILD_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc); +#ifdef RTMP_PCI_SUPPORT +BUILD_TIMER_FUNCTION(PsPollWakeExec); +BUILD_TIMER_FUNCTION(RadioOnExec); +#endif // RTMP_PCI_SUPPORT // +#ifdef RTMP_MAC_USB +BUILD_TIMER_FUNCTION(RtmpUsbStaAsicForceWakeupTimeout); +#endif // RTMP_MAC_USB // + +#if defined(AP_LED) || defined(STA_LED) +extern void LedCtrlMain( + IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3); +BUILD_TIMER_FUNCTION(LedCtrlMain); +#endif + + +#ifdef RTMP_TIMER_TASK_SUPPORT +static void RtmpTimerQHandle(RTMP_ADAPTER *pAd) +{ +#ifndef KTHREAD_SUPPORT + int status; +#endif + RALINK_TIMER_STRUCT *pTimer; + RTMP_TIMER_TASK_ENTRY *pEntry; + unsigned long irqFlag; + RTMP_OS_TASK *pTask; + + + pTask = &pAd->timerTask; + while(!pTask->task_killed) + { + pTimer = NULL; + +#ifdef KTHREAD_SUPPORT + RTMP_WAIT_EVENT_INTERRUPTIBLE(pAd, pTask); +#else + RTMP_SEM_EVENT_WAIT(&(pTask->taskSema), status); +#endif + + if (pAd->TimerQ.status == RTMP_TASK_STAT_STOPED) + break; + + // event happened. + while(pAd->TimerQ.pQHead) + { + RTMP_INT_LOCK(&pAd->TimerQLock, irqFlag); + pEntry = pAd->TimerQ.pQHead; + if (pEntry) + { + pTimer = pEntry->pRaTimer; + + // update pQHead + pAd->TimerQ.pQHead = pEntry->pNext; + if (pEntry == pAd->TimerQ.pQTail) + pAd->TimerQ.pQTail = NULL; + + // return this queue entry to timerQFreeList. + pEntry->pNext = pAd->TimerQ.pQPollFreeList; + pAd->TimerQ.pQPollFreeList = pEntry; + } + RTMP_INT_UNLOCK(&pAd->TimerQLock, irqFlag); + + if (pTimer) + { + if ((pTimer->handle != NULL) && (!pAd->PM_FlgSuspend)) + pTimer->handle(NULL, (PVOID) pTimer->cookie, NULL, pTimer); + if ((pTimer->Repeat) && (pTimer->State == FALSE)) + RTMP_OS_Add_Timer(&pTimer->TimerObj, pTimer->TimerValue); + } + } + +#ifndef KTHREAD_SUPPORT + if (status != 0) + { + pAd->TimerQ.status = RTMP_TASK_STAT_STOPED; + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); + break; + } +#endif + } +} + + +INT RtmpTimerQThread( + IN OUT PVOID Context) +{ + RTMP_OS_TASK *pTask; + PRTMP_ADAPTER pAd; + + + pTask = (RTMP_OS_TASK *)Context; + pAd = (PRTMP_ADAPTER)pTask->priv; + + RtmpOSTaskCustomize(pTask); + + RtmpTimerQHandle(pAd); + + DBGPRINT(RT_DEBUG_TRACE,( "<---%s\n",__func__)); +#ifndef KTHREAD_SUPPORT + pTask->taskPID = THREAD_PID_INIT_VALUE; +#endif + /* notify the exit routine that we're actually exiting now + * + * complete()/wait_for_completion() is similar to up()/down(), + * except that complete() is safe in the case where the structure + * is getting deleted in a parallel mode of execution (i.e. just + * after the down() -- that's necessary for the thread-shutdown + * case. + * + * complete_and_exit() goes even further than this -- it is safe in + * the case that the thread of the caller is going away (not just + * the structure) -- this is necessary for the module-remove case. + * This is important in preemption kernels, which transfer the flow + * of execution immediately upon a complete(). + */ + RtmpOSTaskNotifyToExit(pTask); + + return 0; + +} + + +RTMP_TIMER_TASK_ENTRY *RtmpTimerQInsert( + IN RTMP_ADAPTER *pAd, + IN RALINK_TIMER_STRUCT *pTimer) +{ + RTMP_TIMER_TASK_ENTRY *pQNode = NULL, *pQTail; + unsigned long irqFlags; + RTMP_OS_TASK *pTask = &pAd->timerTask; + + RTMP_INT_LOCK(&pAd->TimerQLock, irqFlags); + if (pAd->TimerQ.status & RTMP_TASK_CAN_DO_INSERT) + { + if(pAd->TimerQ.pQPollFreeList) + { + pQNode = pAd->TimerQ.pQPollFreeList; + pAd->TimerQ.pQPollFreeList = pQNode->pNext; + + pQNode->pRaTimer = pTimer; + pQNode->pNext = NULL; + + pQTail = pAd->TimerQ.pQTail; + if (pAd->TimerQ.pQTail != NULL) + pQTail->pNext = pQNode; + pAd->TimerQ.pQTail = pQNode; + if (pAd->TimerQ.pQHead == NULL) + pAd->TimerQ.pQHead = pQNode; + } + } + RTMP_INT_UNLOCK(&pAd->TimerQLock, irqFlags); + + if (pQNode) + { +#ifdef KTHREAD_SUPPORT + WAKE_UP(pTask); +#else + RTMP_SEM_EVENT_UP(&pTask->taskSema); +#endif + } + + return pQNode; +} + + +BOOLEAN RtmpTimerQRemove( + IN RTMP_ADAPTER *pAd, + IN RALINK_TIMER_STRUCT *pTimer) +{ + RTMP_TIMER_TASK_ENTRY *pNode, *pPrev = NULL; + unsigned long irqFlags; + + RTMP_INT_LOCK(&pAd->TimerQLock, irqFlags); + if (pAd->TimerQ.status >= RTMP_TASK_STAT_INITED) + { + pNode = pAd->TimerQ.pQHead; + while (pNode) + { + if (pNode->pRaTimer == pTimer) + break; + pPrev = pNode; + pNode = pNode->pNext; + } + + // Now move it to freeList queue. + if (pNode) + { + if (pNode == pAd->TimerQ.pQHead) + pAd->TimerQ.pQHead = pNode->pNext; + if (pNode == pAd->TimerQ.pQTail) + pAd->TimerQ.pQTail = pPrev; + if (pPrev != NULL) + pPrev->pNext = pNode->pNext; + + // return this queue entry to timerQFreeList. + pNode->pNext = pAd->TimerQ.pQPollFreeList; + pAd->TimerQ.pQPollFreeList = pNode; + } + } + RTMP_INT_UNLOCK(&pAd->TimerQLock, irqFlags); + + return TRUE; +} + + +void RtmpTimerQExit(RTMP_ADAPTER *pAd) +{ + RTMP_TIMER_TASK_ENTRY *pTimerQ; + unsigned long irqFlags; + + RTMP_INT_LOCK(&pAd->TimerQLock, irqFlags); + while (pAd->TimerQ.pQHead) + { + pTimerQ = pAd->TimerQ.pQHead; + pAd->TimerQ.pQHead = pTimerQ->pNext; + // remove the timeQ + } + pAd->TimerQ.pQPollFreeList = NULL; + os_free_mem(pAd, pAd->TimerQ.pTimerQPoll); + pAd->TimerQ.pQTail = NULL; + pAd->TimerQ.pQHead = NULL; +#ifndef KTHREAD_SUPPORT + pAd->TimerQ.status = RTMP_TASK_STAT_STOPED; +#endif + RTMP_INT_UNLOCK(&pAd->TimerQLock, irqFlags); + +} + + +void RtmpTimerQInit(RTMP_ADAPTER *pAd) +{ + int i; + RTMP_TIMER_TASK_ENTRY *pQNode, *pEntry; + unsigned long irqFlags; + + NdisAllocateSpinLock(&pAd->TimerQLock); + + NdisZeroMemory(&pAd->TimerQ, sizeof(pAd->TimerQ)); + + os_alloc_mem(pAd, &pAd->TimerQ.pTimerQPoll, sizeof(RTMP_TIMER_TASK_ENTRY) * TIMER_QUEUE_SIZE_MAX); + if (pAd->TimerQ.pTimerQPoll) + { + pEntry = NULL; + pQNode = (RTMP_TIMER_TASK_ENTRY *)pAd->TimerQ.pTimerQPoll; + NdisZeroMemory(pAd->TimerQ.pTimerQPoll, sizeof(RTMP_TIMER_TASK_ENTRY) * TIMER_QUEUE_SIZE_MAX); + + RTMP_INT_LOCK(&pAd->TimerQLock, irqFlags); + for (i = 0 ;i pNext = pEntry; + pEntry = pQNode; + pQNode++; + } + pAd->TimerQ.pQPollFreeList = pEntry; + pAd->TimerQ.pQHead = NULL; + pAd->TimerQ.pQTail = NULL; + pAd->TimerQ.status = RTMP_TASK_STAT_INITED; + RTMP_INT_UNLOCK(&pAd->TimerQLock, irqFlags); + } +} +#endif // RTMP_TIMER_TASK_SUPPORT // diff --git a/drivers/staging/rt2860/common/spectrum.c b/drivers/staging/rt2860/common/spectrum.c index c658bf3082c3..7fd715ad39b1 100644 --- a/drivers/staging/rt2860/common/spectrum.c +++ b/drivers/staging/rt2860/common/spectrum.c @@ -40,6 +40,239 @@ #include "../rt_config.h" #include "action.h" + +/* The regulatory information in the USA (US) */ +DOT11_REGULATORY_INFORMATION USARegulatoryInfo[] = +{ +/* "regulatory class" "number of channels" "Max Tx Pwr" "channel list" */ + {0, {0, 0, {0}}}, // Invlid entry + {1, {4, 16, {36, 40, 44, 48}}}, + {2, {4, 23, {52, 56, 60, 64}}}, + {3, {4, 29, {149, 153, 157, 161}}}, + {4, {11, 23, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}}, + {5, {5, 30, {149, 153, 157, 161, 165}}}, + {6, {10, 14, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}}, + {7, {10, 27, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}}, + {8, {5, 17, {11, 13, 15, 17, 19}}}, + {9, {5, 30, {11, 13, 15, 17, 19}}}, + {10, {2, 20, {21, 25}}}, + {11, {2, 33, {21, 25}}}, + {12, {11, 30, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}}} +}; +#define USA_REGULATORY_INFO_SIZE (sizeof(USARegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION)) + + +/* The regulatory information in Europe */ +DOT11_REGULATORY_INFORMATION EuropeRegulatoryInfo[] = +{ +/* "regulatory class" "number of channels" "Max Tx Pwr" "channel list" */ + {0, {0, 0, {0}}}, // Invalid entry + {1, {4, 20, {36, 40, 44, 48}}}, + {2, {4, 20, {52, 56, 60, 64}}}, + {3, {11, 30, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}}, + {4, {13, 20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}} +}; +#define EU_REGULATORY_INFO_SIZE (sizeof(EuropeRegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION)) + + +/* The regulatory information in Japan */ +DOT11_REGULATORY_INFORMATION JapanRegulatoryInfo[] = +{ +/* "regulatory class" "number of channels" "Max Tx Pwr" "channel list" */ + {0, {0, 0, {0}}}, // Invalid entry + {1, {4, 22, {34, 38, 42, 46}}}, + {2, {3, 24, {8, 12, 16}}}, + {3, {3, 24, {8, 12, 16}}}, + {4, {3, 24, {8, 12, 16}}}, + {5, {3, 24, {8, 12, 16}}}, + {6, {3, 22, {8, 12, 16}}}, + {7, {4, 24, {184, 188, 192, 196}}}, + {8, {4, 24, {184, 188, 192, 196}}}, + {9, {4, 24, {184, 188, 192, 196}}}, + {10, {4, 24, {184, 188, 192, 196}}}, + {11, {4, 22, {184, 188, 192, 196}}}, + {12, {4, 24, {7, 8, 9, 11}}}, + {13, {4, 24, {7, 8, 9, 11}}}, + {14, {4, 24, {7, 8, 9, 11}}}, + {15, {4, 24, {7, 8, 9, 11}}}, + {16, {6, 24, {183, 184, 185, 187, 188, 189}}}, + {17, {6, 24, {183, 184, 185, 187, 188, 189}}}, + {18, {6, 24, {183, 184, 185, 187, 188, 189}}}, + {19, {6, 24, {183, 184, 185, 187, 188, 189}}}, + {20, {6, 17, {183, 184, 185, 187, 188, 189}}}, + {21, {6, 24, {6, 7, 8, 9, 10, 11}}}, + {22, {6, 24, {6, 7, 8, 9, 10, 11}}}, + {23, {6, 24, {6, 7, 8, 9, 10, 11}}}, + {24, {6, 24, {6, 7, 8, 9, 10, 11}}}, + {25, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}}}, + {26, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}}}, + {27, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}}}, + {28, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}}}, + {29, {8, 17, {182, 183, 184, 185, 186, 187, 188, 189}}}, + {30, {13, 23, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}}, + {31, {1, 23, {14}}}, + {32, {4, 22, {52, 56, 60, 64}}} +}; +#define JP_REGULATORY_INFO_SIZE (sizeof(JapanRegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION)) + + +CHAR RTMP_GetTxPwr( + IN PRTMP_ADAPTER pAd, + IN HTTRANSMIT_SETTING HTTxMode) +{ +typedef struct __TX_PWR_CFG +{ + UINT8 Mode; + UINT8 MCS; + UINT16 req; + UINT8 shift; + UINT32 BitMask; +} TX_PWR_CFG; + + UINT32 Value; + INT Idx; + UINT8 PhyMode; + CHAR CurTxPwr; + UINT8 TxPwrRef = 0; + CHAR DaltaPwr; + ULONG TxPwr[5]; + + + TX_PWR_CFG TxPwrCfg[] = { + {MODE_CCK, 0, 0, 4, 0x000000f0}, + {MODE_CCK, 1, 0, 0, 0x0000000f}, + {MODE_CCK, 2, 0, 12, 0x0000f000}, + {MODE_CCK, 3, 0, 8, 0x00000f00}, + + {MODE_OFDM, 0, 0, 20, 0x00f00000}, + {MODE_OFDM, 1, 0, 16, 0x000f0000}, + {MODE_OFDM, 2, 0, 28, 0xf0000000}, + {MODE_OFDM, 3, 0, 24, 0x0f000000}, + {MODE_OFDM, 4, 1, 4, 0x000000f0}, + {MODE_OFDM, 5, 1, 0, 0x0000000f}, + {MODE_OFDM, 6, 1, 12, 0x0000f000}, + {MODE_OFDM, 7, 1, 8, 0x00000f00} + ,{MODE_HTMIX, 0, 1, 20, 0x00f00000}, + {MODE_HTMIX, 1, 1, 16, 0x000f0000}, + {MODE_HTMIX, 2, 1, 28, 0xf0000000}, + {MODE_HTMIX, 3, 1, 24, 0x0f000000}, + {MODE_HTMIX, 4, 2, 4, 0x000000f0}, + {MODE_HTMIX, 5, 2, 0, 0x0000000f}, + {MODE_HTMIX, 6, 2, 12, 0x0000f000}, + {MODE_HTMIX, 7, 2, 8, 0x00000f00}, + {MODE_HTMIX, 8, 2, 20, 0x00f00000}, + {MODE_HTMIX, 9, 2, 16, 0x000f0000}, + {MODE_HTMIX, 10, 2, 28, 0xf0000000}, + {MODE_HTMIX, 11, 2, 24, 0x0f000000}, + {MODE_HTMIX, 12, 3, 4, 0x000000f0}, + {MODE_HTMIX, 13, 3, 0, 0x0000000f}, + {MODE_HTMIX, 14, 3, 12, 0x0000f000}, + {MODE_HTMIX, 15, 3, 8, 0x00000f00} + }; +#define MAX_TXPWR_TAB_SIZE (sizeof(TxPwrCfg) / sizeof(TX_PWR_CFG)) + + CurTxPwr = 19; + + /* check Tx Power setting from UI. */ + if (pAd->CommonCfg.TxPowerPercentage > 90) + ; + else if (pAd->CommonCfg.TxPowerPercentage > 60) /* reduce Pwr for 1 dB. */ + CurTxPwr -= 1; + else if (pAd->CommonCfg.TxPowerPercentage > 30) /* reduce Pwr for 3 dB. */ + CurTxPwr -= 3; + else if (pAd->CommonCfg.TxPowerPercentage > 15) /* reduce Pwr for 6 dB. */ + CurTxPwr -= 6; + else if (pAd->CommonCfg.TxPowerPercentage > 9) /* reduce Pwr for 9 dB. */ + CurTxPwr -= 9; + else /* reduce Pwr for 12 dB. */ + CurTxPwr -= 12; + + if (pAd->CommonCfg.BBPCurrentBW == BW_40) + { + if (pAd->CommonCfg.CentralChannel > 14) + { + TxPwr[0] = pAd->Tx40MPwrCfgABand[0]; + TxPwr[1] = pAd->Tx40MPwrCfgABand[1]; + TxPwr[2] = pAd->Tx40MPwrCfgABand[2]; + TxPwr[3] = pAd->Tx40MPwrCfgABand[3]; + TxPwr[4] = pAd->Tx40MPwrCfgABand[4]; + } + else + { + TxPwr[0] = pAd->Tx40MPwrCfgGBand[0]; + TxPwr[1] = pAd->Tx40MPwrCfgGBand[1]; + TxPwr[2] = pAd->Tx40MPwrCfgGBand[2]; + TxPwr[3] = pAd->Tx40MPwrCfgGBand[3]; + TxPwr[4] = pAd->Tx40MPwrCfgGBand[4]; + } + } + else + { + if (pAd->CommonCfg.Channel > 14) + { + TxPwr[0] = pAd->Tx20MPwrCfgABand[0]; + TxPwr[1] = pAd->Tx20MPwrCfgABand[1]; + TxPwr[2] = pAd->Tx20MPwrCfgABand[2]; + TxPwr[3] = pAd->Tx20MPwrCfgABand[3]; + TxPwr[4] = pAd->Tx20MPwrCfgABand[4]; + } + else + { + TxPwr[0] = pAd->Tx20MPwrCfgGBand[0]; + TxPwr[1] = pAd->Tx20MPwrCfgGBand[1]; + TxPwr[2] = pAd->Tx20MPwrCfgGBand[2]; + TxPwr[3] = pAd->Tx20MPwrCfgGBand[3]; + TxPwr[4] = pAd->Tx20MPwrCfgGBand[4]; + } + } + + + switch(HTTxMode.field.MODE) + { + case MODE_CCK: + case MODE_OFDM: + Value = TxPwr[1]; + TxPwrRef = (Value & 0x00000f00) >> 8; + + break; + + case MODE_HTMIX: + case MODE_HTGREENFIELD: + if (pAd->CommonCfg.TxStream == 1) + { + Value = TxPwr[2]; + TxPwrRef = (Value & 0x00000f00) >> 8; + } + else if (pAd->CommonCfg.TxStream == 2) + { + Value = TxPwr[3]; + TxPwrRef = (Value & 0x00000f00) >> 8; + } + break; + } + + PhyMode = + (HTTxMode.field.MODE == MODE_HTGREENFIELD) + ? MODE_HTMIX : + HTTxMode.field.MODE; + + for (Idx = 0; Idx < MAX_TXPWR_TAB_SIZE; Idx++) + { + if ((TxPwrCfg[Idx].Mode == PhyMode) + && (TxPwrCfg[Idx].MCS == HTTxMode.field.MCS)) + { + Value = TxPwr[TxPwrCfg[Idx].req]; + DaltaPwr = TxPwrRef - (CHAR)((Value & TxPwrCfg[Idx].BitMask) + >> TxPwrCfg[Idx].shift); + CurTxPwr -= DaltaPwr; + break; + } + } + + return CurTxPwr; +} + + VOID MeasureReqTabInit( IN PRTMP_ADAPTER pAd) { @@ -57,7 +290,7 @@ VOID MeasureReqTabInit( VOID MeasureReqTabExit( IN PRTMP_ADAPTER pAd) { - NdisFreeSpinLock(pAd->CommonCfg.MeasureReqTabLock); + NdisFreeSpinLock(&pAd->CommonCfg.MeasureReqTabLock); if (pAd->CommonCfg.pMeasureReqTab) kfree(pAd->CommonCfg.pMeasureReqTab); @@ -66,7 +299,7 @@ VOID MeasureReqTabExit( return; } -static PMEASURE_REQ_ENTRY MeasureReqLookUp( +PMEASURE_REQ_ENTRY MeasureReqLookUp( IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) { @@ -102,7 +335,7 @@ static PMEASURE_REQ_ENTRY MeasureReqLookUp( return pEntry; } -static PMEASURE_REQ_ENTRY MeasureReqInsert( +PMEASURE_REQ_ENTRY MeasureReqInsert( IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) { @@ -201,7 +434,7 @@ static PMEASURE_REQ_ENTRY MeasureReqInsert( return pEntry; } -static VOID MeasureReqDelete( +VOID MeasureReqDelete( IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) { @@ -275,7 +508,7 @@ VOID TpcReqTabInit( VOID TpcReqTabExit( IN PRTMP_ADAPTER pAd) { - NdisFreeSpinLock(pAd->CommonCfg.TpcReqTabLock); + NdisFreeSpinLock(&pAd->CommonCfg.TpcReqTabLock); if (pAd->CommonCfg.pTpcReqTab) kfree(pAd->CommonCfg.pTpcReqTab); @@ -511,6 +744,72 @@ static UINT8 GetCurTxPwr( return 16; /* 16 dBm */ } +/* + ========================================================================== + Description: + Get Current Transmit Power. + + Parametrs: + + Return : Current Time Stamp. + ========================================================================== + */ +VOID InsertChannelRepIE( + IN PRTMP_ADAPTER pAd, + OUT PUCHAR pFrameBuf, + OUT PULONG pFrameLen, + IN PSTRING pCountry, + IN UINT8 RegulatoryClass) +{ + ULONG TempLen; + UINT8 Len; + UINT8 IEId = IE_AP_CHANNEL_REPORT; + PUCHAR pChListPtr = NULL; + + Len = 1; + if (strncmp(pCountry, "US", 2) == 0) + { + if (RegulatoryClass >= USA_REGULATORY_INFO_SIZE) + { + DBGPRINT(RT_DEBUG_ERROR, ("%s: USA Unknow Requlatory class (%d)\n", + __func__, RegulatoryClass)); + return; + } + + Len += USARegulatoryInfo[RegulatoryClass].ChannelSet.NumberOfChannels; + pChListPtr = USARegulatoryInfo[RegulatoryClass].ChannelSet.ChannelList; + } + else if (strncmp(pCountry, "JP", 2) == 0) + { + if (RegulatoryClass >= JP_REGULATORY_INFO_SIZE) + { + DBGPRINT(RT_DEBUG_ERROR, ("%s: JP Unknow Requlatory class (%d)\n", + __func__, RegulatoryClass)); + return; + } + + Len += JapanRegulatoryInfo[RegulatoryClass].ChannelSet.NumberOfChannels; + pChListPtr = JapanRegulatoryInfo[RegulatoryClass].ChannelSet.ChannelList; + } + else + { + DBGPRINT(RT_DEBUG_ERROR, ("%s: Unknow Country (%s)\n", + __func__, pCountry)); + return; + } + + MakeOutgoingFrame(pFrameBuf, &TempLen, + 1, &IEId, + 1, &Len, + 1, &RegulatoryClass, + Len -1, pChListPtr, + END_OF_ARGS); + + *pFrameLen = *pFrameLen + TempLen; + + return; +} + /* ========================================================================== Description: @@ -524,7 +823,7 @@ static UINT8 GetCurTxPwr( Return : None. ========================================================================== */ -static VOID InsertDialogToken( +VOID InsertDialogToken( IN PRTMP_ADAPTER pAd, OUT PUCHAR pFrameBuf, OUT PULONG pFrameLen, @@ -585,7 +884,7 @@ static VOID InsertDialogToken( Return : None. ========================================================================== */ - static VOID InsertTpcReportIE( +VOID InsertTpcReportIE( IN PRTMP_ADAPTER pAd, OUT PUCHAR pFrameBuf, OUT PULONG pFrameLen, @@ -679,16 +978,16 @@ static VOID InsertMeasureReqIE( IN PRTMP_ADAPTER pAd, OUT PUCHAR pFrameBuf, OUT PULONG pFrameLen, + IN UINT8 Len, IN PMEASURE_REQ_INFO pMeasureReqIE) { ULONG TempLen; - UINT8 Len = sizeof(MEASURE_REQ_INFO); UINT8 ElementID = IE_MEASUREMENT_REQUEST; MakeOutgoingFrame(pFrameBuf, &TempLen, 1, &ElementID, 1, &Len, - Len, pMeasureReqIE, + sizeof(MEASURE_REQ_INFO), pMeasureReqIE, END_OF_ARGS); *pFrameLen = *pFrameLen + TempLen; @@ -758,53 +1057,43 @@ static VOID InsertMeasureReportIE( Return : None. ========================================================================== */ -VOID EnqueueMeasurementReq( +VOID MakeMeasurementReqFrame( IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, + OUT PUCHAR pOutBuffer, + OUT PULONG pFrameLen, + IN UINT8 TotalLen, + IN UINT8 Category, + IN UINT8 Action, IN UINT8 MeasureToken, IN UINT8 MeasureReqMode, IN UINT8 MeasureReqType, - IN UINT8 MeasureCh, - IN UINT16 MeasureDuration) + IN UINT8 NumOfRepetitions) { - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen; - HEADER_802_11 ActHdr; + ULONG TempLen; MEASURE_REQ_INFO MeasureReqIE; - UINT8 RmReqDailogToken = RandomByte(pAd); - UINT64 MeasureStartTime = GetCurrentTimeStamp(pAd); - // build action frame header. - MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, - pAd->CurrentAddress); + InsertActField(pAd, (pOutBuffer + *pFrameLen), pFrameLen, Category, Action); - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__)); - return; - } - NdisMoveMemory(pOutBuffer, (PCHAR)&ActHdr, sizeof(HEADER_802_11)); - FrameLen = sizeof(HEADER_802_11); + // fill Dialog Token + InsertDialogToken(pAd, (pOutBuffer + *pFrameLen), pFrameLen, MeasureToken); - InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_MRQ); + /* fill Number of repetitions. */ + if (Category == CATEGORY_RM) + { + MakeOutgoingFrame((pOutBuffer+*pFrameLen), &TempLen, + 2, &NumOfRepetitions, + END_OF_ARGS); - // fill Dialog Token - InsertDialogToken(pAd, (pOutBuffer + FrameLen), &FrameLen, MeasureToken); + *pFrameLen += TempLen; + } // prepare Measurement IE. NdisZeroMemory(&MeasureReqIE, sizeof(MEASURE_REQ_INFO)); - MeasureReqIE.Token = RmReqDailogToken; + MeasureReqIE.Token = MeasureToken; MeasureReqIE.ReqMode.word = MeasureReqMode; MeasureReqIE.ReqType = MeasureReqType; - MeasureReqIE.MeasureReq.ChNum = MeasureCh; - MeasureReqIE.MeasureReq.MeasureStartTime = cpu2le64(MeasureStartTime); - MeasureReqIE.MeasureReq.MeasureDuration = cpu2le16(MeasureDuration); - InsertMeasureReqIE(pAd, (pOutBuffer + FrameLen), &FrameLen, &MeasureReqIE); - - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); + InsertMeasureReqIE(pAd, (pOutBuffer+*pFrameLen), pFrameLen, + TotalLen, &MeasureReqIE); return; } @@ -858,7 +1147,7 @@ VOID EnqueueMeasurementRep( // prepare Measurement IE. NdisZeroMemory(&MeasureRepIE, sizeof(MEASURE_REPORT_INFO)); MeasureRepIE.Token = MeasureToken; - MeasureRepIE.ReportMode.word = MeasureReqMode; + MeasureRepIE.ReportMode = MeasureReqMode; MeasureRepIE.ReportType = MeasureReqType; InsertMeasureReportIE(pAd, (pOutBuffer + FrameLen), &FrameLen, &MeasureRepIE, ReportInfoLen, pReportInfo); @@ -1159,7 +1448,8 @@ static BOOLEAN PeerMeasureReqSanity( IN VOID *pMsg, IN ULONG MsgLen, OUT PUINT8 pDialogToken, - OUT PMEASURE_REQ_INFO pMeasureReqInfo) + OUT PMEASURE_REQ_INFO pMeasureReqInfo, + OUT PMEASURE_REQ pMeasureReq) { PFRAME_802_11 Fr = (PFRAME_802_11)pMsg; PUCHAR pFramePtr = Fr->Octet; @@ -1192,12 +1482,12 @@ static BOOLEAN PeerMeasureReqSanity( NdisMoveMemory(&pMeasureReqInfo->Token, eid_ptr->Octet, 1); NdisMoveMemory(&pMeasureReqInfo->ReqMode.word, eid_ptr->Octet + 1, 1); NdisMoveMemory(&pMeasureReqInfo->ReqType, eid_ptr->Octet + 2, 1); - ptr = eid_ptr->Octet + 3; - NdisMoveMemory(&pMeasureReqInfo->MeasureReq.ChNum, ptr, 1); + ptr = (PUCHAR)(eid_ptr->Octet + 3); + NdisMoveMemory(&pMeasureReq->ChNum, ptr, 1); NdisMoveMemory(&MeasureStartTime, ptr + 1, 8); - pMeasureReqInfo->MeasureReq.MeasureStartTime = SWAP64(MeasureStartTime); + pMeasureReq->MeasureStartTime = SWAP64(MeasureStartTime); NdisMoveMemory(&MeasureDuration, ptr + 9, 2); - pMeasureReqInfo->MeasureReq.MeasureDuration = SWAP16(MeasureDuration); + pMeasureReq->MeasureDuration = SWAP16(MeasureDuration); result = TRUE; break; @@ -1285,7 +1575,7 @@ static BOOLEAN PeerMeasureReportSanity( if (pMeasureReportInfo->ReportType == RM_BASIC) { PMEASURE_BASIC_REPORT pReport = (PMEASURE_BASIC_REPORT)pReportBuf; - ptr = eid_ptr->Octet + 3; + ptr = (PUCHAR)(eid_ptr->Octet + 3); NdisMoveMemory(&pReport->ChNum, ptr, 1); NdisMoveMemory(&pReport->MeasureStartTime, ptr + 1, 8); NdisMoveMemory(&pReport->MeasureDuration, ptr + 9, 2); @@ -1295,7 +1585,7 @@ static BOOLEAN PeerMeasureReportSanity( else if (pMeasureReportInfo->ReportType == RM_CCA) { PMEASURE_CCA_REPORT pReport = (PMEASURE_CCA_REPORT)pReportBuf; - ptr = eid_ptr->Octet + 3; + ptr = (PUCHAR)(eid_ptr->Octet + 3); NdisMoveMemory(&pReport->ChNum, ptr, 1); NdisMoveMemory(&pReport->MeasureStartTime, ptr + 1, 8); NdisMoveMemory(&pReport->MeasureDuration, ptr + 9, 2); @@ -1305,7 +1595,7 @@ static BOOLEAN PeerMeasureReportSanity( else if (pMeasureReportInfo->ReportType == RM_RPI_HISTOGRAM) { PMEASURE_RPI_REPORT pReport = (PMEASURE_RPI_REPORT)pReportBuf; - ptr = eid_ptr->Octet + 3; + ptr = (PUCHAR)(eid_ptr->Octet + 3); NdisMoveMemory(&pReport->ChNum, ptr, 1); NdisMoveMemory(&pReport->MeasureStartTime, ptr + 1, 8); NdisMoveMemory(&pReport->MeasureDuration, ptr + 9, 2); @@ -1533,9 +1823,10 @@ static VOID PeerMeasureReqAction( PFRAME_802_11 pFr = (PFRAME_802_11)Elem->Msg; UINT8 DialogToken; MEASURE_REQ_INFO MeasureReqInfo; + MEASURE_REQ MeasureReq; MEASURE_REPORT_MODE ReportMode; - if(PeerMeasureReqSanity(pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &MeasureReqInfo)) + if(PeerMeasureReqSanity(pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &MeasureReqInfo, &MeasureReq)) { ReportMode.word = 0; ReportMode.field.Incapable = 1; @@ -1729,8 +2020,8 @@ VOID PeerSpectrumAction( break; case SPEC_CHANNEL_SWITCH: -{ -} + + PeerChSwAnnAction(pAd, Elem); break; } @@ -1749,16 +2040,31 @@ VOID PeerSpectrumAction( */ INT Set_MeasureReq_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { UINT Aid = 1; UINT ArgIdx; - PUCHAR thisChar; + PSTRING thisChar; MEASURE_REQ_MODE MeasureReqMode; UINT8 MeasureReqToken = RandomByte(pAd); UINT8 MeasureReqType = RM_BASIC; UINT8 MeasureCh = 1; + UINT64 MeasureStartTime = GetCurrentTimeStamp(pAd); + MEASURE_REQ MeasureReq; + UINT8 TotalLen; + + HEADER_802_11 ActHdr; + PUCHAR pOutBuffer = NULL; + NDIS_STATUS NStatus; + ULONG FrameLen; + + NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory + if(NStatus != NDIS_STATUS_SUCCESS) + { + DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__)); + goto END_OF_MEASURE_REQ; + } ArgIdx = 1; while ((thisChar = strsep((char **)&arg, "-")) != NULL) @@ -1766,7 +2072,7 @@ INT Set_MeasureReq_Proc( switch(ArgIdx) { case 1: // Aid. - Aid = simple_strtol(thisChar, 0, 16); + Aid = (UINT8) simple_strtol(thisChar, 0, 16); break; case 2: // Measurement Request Type. @@ -1774,12 +2080,12 @@ INT Set_MeasureReq_Proc( if (MeasureReqType > 3) { DBGPRINT(RT_DEBUG_ERROR, ("%s: unknow MeasureReqType(%d)\n", __func__, MeasureReqType)); - return TRUE; + goto END_OF_MEASURE_REQ; } break; case 3: // Measurement channel. - MeasureCh = simple_strtol(thisChar, 0, 16); + MeasureCh = (UINT8) simple_strtol(thisChar, 0, 16); break; } ArgIdx++; @@ -1789,7 +2095,7 @@ INT Set_MeasureReq_Proc( if (!VALID_WCID(Aid)) { DBGPRINT(RT_DEBUG_ERROR, ("%s: unknow sta of Aid(%d)\n", __func__, Aid)); - return TRUE; + goto END_OF_MEASURE_REQ; } MeasureReqMode.word = 0; @@ -1797,21 +2103,49 @@ INT Set_MeasureReq_Proc( MeasureReqInsert(pAd, MeasureReqToken); - EnqueueMeasurementReq(pAd, pAd->MacTab.Content[Aid].Addr, - MeasureReqToken, MeasureReqMode.word, MeasureReqType, MeasureCh, 2000); + // build action frame header. + MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pAd->MacTab.Content[Aid].Addr, + pAd->CurrentAddress); + + NdisMoveMemory(pOutBuffer, (PCHAR)&ActHdr, sizeof(HEADER_802_11)); + FrameLen = sizeof(HEADER_802_11); + + TotalLen = sizeof(MEASURE_REQ_INFO) + sizeof(MEASURE_REQ); + + MakeMeasurementReqFrame(pAd, pOutBuffer, &FrameLen, + sizeof(MEASURE_REQ_INFO), CATEGORY_RM, RM_BASIC, + MeasureReqToken, MeasureReqMode.word, + MeasureReqType, 0); + + MeasureReq.ChNum = MeasureCh; + MeasureReq.MeasureStartTime = cpu2le64(MeasureStartTime); + MeasureReq.MeasureDuration = cpu2le16(2000); + + { + ULONG TempLen; + MakeOutgoingFrame( pOutBuffer+FrameLen, &TempLen, + sizeof(MEASURE_REQ), &MeasureReq, + END_OF_ARGS); + FrameLen += TempLen; + } + + MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, (UINT)FrameLen); + +END_OF_MEASURE_REQ: + MlmeFreeMemory(pAd, pOutBuffer); return TRUE; } INT Set_TpcReq_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { UINT Aid; UINT8 TpcReqToken = RandomByte(pAd); - Aid = simple_strtol(arg, 0, 16); + Aid = (UINT) simple_strtol(arg, 0, 16); DBGPRINT(RT_DEBUG_TRACE, ("%s::Aid = %d\n", __func__, Aid)); if (!VALID_WCID(Aid)) diff --git a/drivers/staging/rt2860/config.mk b/drivers/staging/rt2860/config.mk deleted file mode 100644 index 25bd55a7aab3..000000000000 --- a/drivers/staging/rt2860/config.mk +++ /dev/null @@ -1,241 +0,0 @@ -# Support ATE function -HAS_ATE=n - -# Support 28xx QA ATE function -HAS_28xx_QA=n - -# Support Wpa_Supplicant -HAS_WPA_SUPPLICANT=n - -# Support Native WpaSupplicant for Network Maganger -HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n - -#Support Net interface block while Tx-Sw queue full -HAS_BLOCK_NET_IF=n - -#Support DFS function -HAS_DFS_SUPPORT=n - -#Support Carrier-Sense function -HAS_CS_SUPPORT=n - -#ifdef MULTI_CARD -# Support for Multiple Cards -HAS_MC_SUPPORT=n -#endif // MULTI_CARD // - -#Support for IEEE802.11e DLS -HAS_QOS_DLS_SUPPORT=n - -#Support for EXT_CHANNEL -HAS_EXT_BUILD_CHANNEL_LIST=n - -#Support for Net-SNMP -HAS_SNMP_SUPPORT=n - -#Support features of Single SKU. -HAS_SINGLE_SKU_SUPPORT=n - -#Support features of 802.11n -HAS_DOT11_N_SUPPORT=y - - -################################################# - -CC := $(CROSS_COMPILE)gcc -LD := $(CROSS_COMPILE)ld - -WFLAGS := -DAGGREGATION_SUPPORT -DPIGGYBACK_SUPPORT -DWMM_SUPPORT -DLINUX -Wall -Wstrict-prototypes -Wno-trigraphs - - -################################################# - -#ifdef CONFIG_STA_SUPPORT -# config for STA mode - -ifeq ($(RT28xx_MODE),STA) -WFLAGS += -DCONFIG_STA_SUPPORT -DDBG - -ifeq ($(HAS_WPA_SUPPLICANT),y) -WFLAGS += -DWPA_SUPPLICANT_SUPPORT -endif - -ifeq ($(HAS_NATIVE_WPA_SUPPLICANT_SUPPORT),y) -WFLAGS += -DNATIVE_WPA_SUPPLICANT_SUPPORT -endif - -ifeq ($(HAS_ATE),y) -WFLAGS += -DRALINK_ATE -ifeq ($(HAS_28xx_QA),y) -WFLAGS += -DRALINK_28xx_QA -endif -endif - -ifeq ($(HAS_SNMP_SUPPORT),y) -WFLAGS += -DSNMP_SUPPORT -endif - -ifeq ($(HAS_QOS_DLS_SUPPORT),y) -WFLAGS += -DQOS_DLS_SUPPORT -endif - -ifeq ($(HAS_DOT11_N_SUPPORT),y) -WFLAGS += -DDOT11_N_SUPPORT -endif - -ifeq ($(HAS_CS_SUPPORT),y) -WFLAGS += -DCARRIER_DETECTION_SUPPORT -endif - -ifeq ($(HAS_SINGLE_SKU_SUPPORT),y) -WFLAGS += -DSINGLE_SKU -endif - -endif -# endif of ifeq ($(RT28xx_MODE),STA) -#endif // CONFIG_STA_SUPPORT // - -################################################# - -################################################# - -# -# Common compiler flag -# - - -ifeq ($(HAS_EXT_BUILD_CHANNEL_LIST),y) -WFLAGS += -DEXT_BUILD_CHANNEL_LIST -endif - -ifeq ($(CHIPSET),2870) -WFLAGS +=-DRT2870 -endif - -ifeq ($(PLATFORM),5VT) -#WFLAGS += -DCONFIG_5VT_ENHANCE -endif - -ifeq ($(HAS_BLOCK_NET_IF),y) -WFLAGS += -DBLOCK_NET_IF -endif - -ifeq ($(HAS_DFS_SUPPORT),y) -WFLAGS += -DDFS_SUPPORT -endif - -#ifdef MULTI_CARD -ifeq ($(HAS_MC_SUPPORT),y) -WFLAGS += -DMULTIPLE_CARD_SUPPORT -endif -#endif // MULTI_CARD // - -ifeq ($(HAS_LLTD),y) -WFLAGS += -DLLTD_SUPPORT -endif - -ifeq ($(PLATFORM),IXP) -WFLAGS += -DRT_BIG_ENDIAN -endif - -ifeq ($(PLATFORM),IKANOS_V160) -WFLAGS += -DRT_BIG_ENDIAN -DIKANOS_VX_1X0 -endif - -ifeq ($(PLATFORM),IKANOS_V180) -WFLAGS += -DRT_BIG_ENDIAN -DIKANOS_VX_1X0 -endif - -ifeq ($(PLATFORM),INF_TWINPASS) -WFLAGS += -DRT_BIG_ENDIAN -DINF_TWINPASS -endif - -ifeq ($(PLATFORM),INF_DANUBE) -WFLAGS += -DINF_DANUBE -DRT_BIG_ENDIAN -endif - -ifeq ($(PLATFORM),CAVM_OCTEON) -WFLAGS += -DRT_BIG_ENDIAN -endif - -ifeq ($(PLATFORM),BRCM_6358) -WFLAGS += -DRT_BIG_ENDIAN -endif - -ifeq ($(PLATFORM),INF_AMAZON_SE) -#WFLAGS += -DRT_BIG_ENDIAN -DINF_AMAZON_SE -DBG_FT_SUPPORT -WFLAGS += -DRT_BIG_ENDIAN -DINF_AMAZON_SE -endif - -#kernel build options for 2.4 -# move to Makefile outside LINUX_SRC := /opt/star/kernel/linux-2.4.27-star - -ifeq ($(PLATFORM),STAR) -CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -I$(RT28xx_DIR)/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -Uarm -fno-common -pipe -mapcs-32 -D__LINUX_ARM_ARCH__=4 -march=armv4 -mshort-load-bytes -msoft-float -Uarm -DMODULE -DMODVERSIONS -include $(LINUX_SRC)/include/linux/modversions.h $(WFLAGS) - -export CFLAGS -endif - -ifeq ($(PLATFORM),SIGMA) -CFLAGS := -D__KERNEL__ -I$(RT28xx_DIR)/include -I$(LINUX_SRC)/include -I$(LINUX_SRC)/include/asm/gcc -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -DEM86XX_CHIP=EM86XX_CHIPID_TANGO2 -DEM86XX_REVISION=6 -I$(LINUX_SRC)/include/asm-mips/mach-generic -I$(RT2860_DIR)/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2 -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe -mabi=32 -march=mips32r2 -Wa,-32 -Wa,-march=mips32r2 -Wa,-mips32r2 -Wa,--trap -DMODULE $(WFLAGS) - -export CFLAGS -endif - -ifeq ($(PLATFORM),SIGMA_8622) -CFLAGS := -D__KERNEL__ -I$(CROSS_COMPILE_INCLUDE)/include -I$(LINUX_SRC)/include -I$(RT28xx_DIR)/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fno-common -pipe -fno-builtin -D__linux__ -DNO_MM -mapcs-32 -march=armv4 -mtune=arm7tdmi -msoft-float -DMODULE -mshort-load-bytes -nostdinc -iwithprefix -DMODULE $(WFLAGS) -export CFLAGS -endif - -ifeq ($(PLATFORM),5VT) -CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -I$(RT28xx_DIR)/include -mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -O3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mabi=apcs-gnu -mno-thumb-interwork -D__LINUX_ARM_ARCH__=5 -march=armv5te -mtune=arm926ej-s --param max-inline-insns-single=40000 -Uarm -Wdeclaration-after-statement -Wno-pointer-sign -DMODULE $(WFLAGS) - -export CFLAGS -endif - -ifeq ($(PLATFORM),IKANOS_V160) -CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -I$(LINUX_SRC)/include/asm/gcc -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -I$(LINUX_SRC)/include/asm-mips/mach-generic -I$(RT28xx_DIR)/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2 -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe -march=lx4189 -Wa, -DMODULE $(WFLAGS) -export CFLAGS -endif - -ifeq ($(PLATFORM),IKANOS_V180) -CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -I$(LINUX_SRC)/include/asm/gcc -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -I$(LINUX_SRC)/include/asm-mips/mach-tango2 -I$(LINUX_SRC)/include/asm-mips/mach-generic -I$(RT28xx_DIR)/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2 -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe -mips32r2 -Wa, -DMODULE $(WFLAGS) -export CFLAGS -endif - -ifeq ($(PLATFORM),INF_TWINPASS) -CFLAGS := -D__KERNEL__ -DMODULE -I$(LINUX_SRC)/include -I$(RT28xx_DIR)/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -G 0 -mno-abicalls -fno-pic -march=4kc -mips32 -Wa,--trap -pipe -mlong-calls $(WFLAGS) -export CFLAGS -endif - -ifeq ($(PLATFORM),INF_DANUBE) -CFLAGS := -I$(RT28xx_DIR)/include $(WFLAGS) -Wundef -fno-strict-aliasing -fno-common -ffreestanding -Os -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic -pipe -msoft-float -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap -I$(LINUX_SRC)/include/asm-mips/mach-generic -export CFLAGS -endif - -ifeq ($(PLATFORM),BRCM_6358) -CFLAGS := $(WFLAGS) -I$(RT28xx_DIR)/include -nostdinc -iwithprefix include -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -I $(LINUX_SRC)/include/asm/gcc -G 0 -mno-abicalls -fno-pic -pipe -finline-limit=100000 -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap -I$(LINUX_SRC)/include/asm-mips/mach-bcm963xx -I$(LINUX_SRC)/include/asm-mips/mach-generic -Os -fomit-frame-pointer -Wdeclaration-after-statement -DMODULE -mlong-calls -export CFLAGS -endif - -ifeq ($(PLATFORM),PC) - ifneq (,$(findstring 2.4,$(LINUX_SRC))) - # Linux 2.4 - CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -I$(RT28xx_DIR)/include -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE -DMODVERSIONS -include $(LINUX_SRC)/include/linux/modversions.h $(WFLAGS) - export CFLAGS - else - # Linux 2.6 - EXTRA_CFLAGS := $(WFLAGS) -I$(RT28xx_DIR)/include - endif -endif - -ifeq ($(PLATFORM),IXP) - EXTRA_CFLAGS := -v $(WFLAGS) -I$(RT28xx_DIR)/include -mbig-endian -endif - -ifeq ($(PLATFORM),CAVM_OCTEON) - EXTRA_CFLAGS := $(WFLAGS) -I$(RT28xx_DIR)/include \ - -mabi=64 $(WFLAGS) -export CFLAGS -endif - diff --git a/drivers/staging/rt2860/crypt_hmac.h b/drivers/staging/rt2860/crypt_hmac.h new file mode 100644 index 000000000000..9314ff7547b5 --- /dev/null +++ b/drivers/staging/rt2860/crypt_hmac.h @@ -0,0 +1,82 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + */ + +/**************************************************************************** + Module Name: + HMAC + + Abstract: + FIPS 198: The Keyed-Hash Message Authentication Code (HMAC) + + Revision History: + Who When What + -------- ---------- ------------------------------------------ + Eddy 2008/11/24 Create HMAC-SHA1, HMAC-SHA256 +***************************************************************************/ +#ifndef __CRYPT_HMAC_H__ +#define __CRYPT_HMAC_H__ + +#ifdef CRYPT_TESTPLAN +#include "crypt_testplan.h" +#else +#include "rt_config.h" +#endif /* CRYPT_TESTPLAN */ + +#ifdef SHA1_SUPPORT +#define HMAC_SHA1_SUPPORT +VOID HMAC_SHA1 ( + IN const UINT8 Key[], + IN UINT KeyLen, + IN const UINT8 Message[], + IN UINT MessageLen, + OUT UINT8 MAC[], + IN UINT MACLen); +#endif /* SHA1_SUPPORT */ + +#ifdef SHA256_SUPPORT +#define HMAC_SHA256_SUPPORT +VOID HMAC_SHA256 ( + IN const UINT8 Key[], + IN UINT KeyLen, + IN const UINT8 Message[], + IN UINT MessageLen, + OUT UINT8 MAC[], + IN UINT MACLen); +#endif /* SHA256_SUPPORT */ + +#ifdef MD5_SUPPORT +#define HMAC_MD5_SUPPORT +VOID HMAC_MD5 ( + IN const UINT8 Key[], + IN UINT KeyLen, + IN const UINT8 Message[], + IN UINT MessageLen, + OUT UINT8 MAC[], + IN UINT MACLen); +#endif /* MD5_SUPPORT */ + +#endif /* __CRYPT_HMAC_H__ */ diff --git a/drivers/staging/rt2860/crypt_md5.h b/drivers/staging/rt2860/crypt_md5.h new file mode 100644 index 000000000000..66ae42466cea --- /dev/null +++ b/drivers/staging/rt2860/crypt_md5.h @@ -0,0 +1,80 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + */ + +/**************************************************************************** + Module Name: + MD5 + + Abstract: + RFC1321: The MD5 Message-Digest Algorithm + + Revision History: + Who When What + -------- ---------- ------------------------------------------ + Eddy 2008/11/24 Create md5 +***************************************************************************/ + +#ifndef __CRYPT_MD5_H__ +#define __CRYPT_MD5_H__ + +#ifdef CRYPT_TESTPLAN +#include "crypt_testplan.h" +#else +#include "rt_config.h" +#endif /* CRYPT_TESTPLAN */ + +/* Algorithm options */ +#define MD5_SUPPORT + +#ifdef MD5_SUPPORT +#define MD5_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ +#define MD5_DIGEST_SIZE 16 /* 128 bits = 16 bytes */ +typedef struct { + UINT32 HashValue[4]; + UINT64 MessageLen; + UINT8 Block[MD5_BLOCK_SIZE]; + UINT BlockLen; +} MD5_CTX_STRUC, *PMD5_CTX_STRUC; + +VOID MD5_Init ( + IN MD5_CTX_STRUC *pMD5_CTX); +VOID MD5_Hash ( + IN MD5_CTX_STRUC *pMD5_CTX); +VOID MD5_Append ( + IN MD5_CTX_STRUC *pMD5_CTX, + IN const UINT8 Message[], + IN UINT MessageLen); +VOID MD5_End ( + IN MD5_CTX_STRUC *pMD5_CTX, + OUT UINT8 DigestMessage[]); +VOID RT_MD5 ( + IN const UINT8 Message[], + IN UINT MessageLen, + OUT UINT8 DigestMessage[]); +#endif /* MD5_SUPPORT */ + +#endif /* __CRYPT_MD5_H__ */ diff --git a/drivers/staging/rt2860/crypt_sha2.h b/drivers/staging/rt2860/crypt_sha2.h new file mode 100644 index 000000000000..055efb15a45f --- /dev/null +++ b/drivers/staging/rt2860/crypt_sha2.h @@ -0,0 +1,109 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + */ + +/**************************************************************************** + Module Name: + SHA2 + + Abstract: + FIPS 180-2: Secure Hash Standard (SHS) + + Revision History: + Who When What + -------- ---------- ------------------------------------------ + Eddy 2008/11/24 Create SHA1 + Eddy 2008/07/23 Create SHA256 +***************************************************************************/ + +#ifndef __CRYPT_SHA2_H__ +#define __CRYPT_SHA2_H__ + +#ifdef CRYPT_TESTPLAN +#include "crypt_testplan.h" +#else +#include "rt_config.h" +#endif /* CRYPT_TESTPLAN */ + +/* Algorithm options */ +#define SHA1_SUPPORT +#define SHA256_SUPPORT + +#ifdef SHA1_SUPPORT +#define SHA1_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ +#define SHA1_DIGEST_SIZE 20 /* 160 bits = 20 bytes */ +typedef struct _SHA1_CTX_STRUC { + UINT32 HashValue[5]; /* 5 = (SHA1_DIGEST_SIZE / 32) */ + UINT64 MessageLen; /* total size */ + UINT8 Block[SHA1_BLOCK_SIZE]; + UINT BlockLen; +} SHA1_CTX_STRUC, *PSHA1_CTX_STRUC; + +VOID RT_SHA1_Init ( + IN SHA1_CTX_STRUC *pSHA_CTX); +VOID SHA1_Hash ( + IN SHA1_CTX_STRUC *pSHA_CTX); +VOID SHA1_Append ( + IN SHA1_CTX_STRUC *pSHA_CTX, + IN const UINT8 Message[], + IN UINT MessageLen); +VOID SHA1_End ( + IN SHA1_CTX_STRUC *pSHA_CTX, + OUT UINT8 DigestMessage[]); +VOID RT_SHA1 ( + IN const UINT8 Message[], + IN UINT MessageLen, + OUT UINT8 DigestMessage[]); +#endif /* SHA1_SUPPORT */ + +#ifdef SHA256_SUPPORT +#define SHA256_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ +#define SHA256_DIGEST_SIZE 32 /* 256 bits = 32 bytes */ +typedef struct _SHA256_CTX_STRUC { + UINT32 HashValue[8]; /* 8 = (SHA256_DIGEST_SIZE / 32) */ + UINT64 MessageLen; /* total size */ + UINT8 Block[SHA256_BLOCK_SIZE]; + UINT BlockLen; +} SHA256_CTX_STRUC, *PSHA256_CTX_STRUC; + +VOID SHA256_Init ( + IN SHA256_CTX_STRUC *pSHA_CTX); +VOID SHA256_Hash ( + IN SHA256_CTX_STRUC *pSHA_CTX); +VOID SHA256_Append ( + IN SHA256_CTX_STRUC *pSHA_CTX, + IN const UINT8 Message[], + IN UINT MessageLen); +VOID SHA256_End ( + IN SHA256_CTX_STRUC *pSHA_CTX, + OUT UINT8 DigestMessage[]); +VOID RT_SHA256 ( + IN const UINT8 Message[], + IN UINT MessageLen, + OUT UINT8 DigestMessage[]); +#endif /* SHA256_SUPPORT */ + +#endif /* __CRYPT_SHA2_H__ */ diff --git a/drivers/staging/rt2860/dfs.h b/drivers/staging/rt2860/dfs.h index f34f6183625c..6fa6d65e7b37 100644 --- a/drivers/staging/rt2860/dfs.h +++ b/drivers/staging/rt2860/dfs.h @@ -43,6 +43,33 @@ #define WIDTH_RD_CHECK 1 + +/************************************************************************* + * + * DFS Radar related definitions. + * + ************************************************************************/ +//#define CARRIER_DETECT_TASK_NUM 6 +//#define RADAR_DETECT_TASK_NUM 7 + +// McuRadarState && McuCarrierState for 2880-SW-MCU +#define FREE_FOR_TX 0 +#define WAIT_CTS_BEING_SENT 1 +#define DO_DETECTION 2 + +// McuRadarEvent +#define RADAR_EVENT_CTS_SENT 0x01 // Host signal MCU that CTS has been sent +#define RADAR_EVENT_CTS_CARRIER_SENT 0x02 // Host signal MCU that CTS has been sent (Carrier) +#define RADAR_EVENT_RADAR_DETECTING 0x04 // Radar detection is on going, carrier detection hold back +#define RADAR_EVENT_CARRIER_DETECTING 0x08 // Carrier detection is on going, radar detection hold back +#define RADAR_EVENT_WIDTH_RADAR 0x10 // BBP == 2 radar detected +#define RADAR_EVENT_CTS_KICKED 0x20 // Radar detection need to sent double CTS, first CTS sent + +// McuRadarCmd +#define DETECTION_STOP 0 +#define RADAR_DETECTION 1 +#define CARRIER_DETECTION 2 + VOID BbpRadarDetectionStart( IN PRTMP_ADAPTER pAd); @@ -77,12 +104,13 @@ ULONG RTMPReadRadarDuration( VOID RTMPCleanRadarDuration( IN PRTMP_ADAPTER pAd); + INT Set_ChMovingTime_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_LongPulseRadarTh_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); diff --git a/drivers/staging/rt2860/eeprom.h b/drivers/staging/rt2860/eeprom.h new file mode 100644 index 000000000000..f1aef0c17b00 --- /dev/null +++ b/drivers/staging/rt2860/eeprom.h @@ -0,0 +1,93 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + + Module Name: + eeprom.h + + Abstract: + Miniport header file for eeprom related information + + Revision History: + Who When What + -------- ---------- ---------------------------------------------- +*/ +#ifndef __EEPROM_H__ +#define __EEPROM_H__ + + + +#ifdef RTMP_PCI_SUPPORT +/************************************************************************* + * Public function declarations for prom-based chipset + ************************************************************************/ +int rtmp_ee_prom_read16( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + OUT USHORT *pValue); + +int rtmp_ee_prom_write16( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN USHORT value); +#endif // RTMP_PCI_SUPPORT // +#ifdef RTMP_USB_SUPPORT +/************************************************************************* + * Public function declarations for usb-based prom chipset + ************************************************************************/ +NTSTATUS RTUSBReadEEPROM16( + IN PRTMP_ADAPTER pAd, + IN USHORT offset, + OUT PUSHORT pData); + +NTSTATUS RTUSBWriteEEPROM16( + IN RTMP_ADAPTER *pAd, + IN USHORT offset, + IN USHORT value); +#endif // RTMP_USB_SUPPORT // + +#ifdef RT30xx +#ifdef RTMP_EFUSE_SUPPORT +int rtmp_ee_efuse_read16( + IN RTMP_ADAPTER *pAd, + IN USHORT Offset, + OUT USHORT *pValue); + +int rtmp_ee_efuse_write16( + IN RTMP_ADAPTER *pAd, + IN USHORT Offset, + IN USHORT data); +#endif // RTMP_EFUSE_SUPPORT // +#endif // RT30xx // + +/************************************************************************* + * Public function declarations for prom operation callback functions setting + ************************************************************************/ +INT RtmpChipOpsEepromHook( + IN RTMP_ADAPTER *pAd, + IN INT infType); + +#endif // __EEPROM_H__ // diff --git a/drivers/staging/rt2860/iface/rtmp_pci.h b/drivers/staging/rt2860/iface/rtmp_pci.h new file mode 100644 index 000000000000..aa66ff7e8fd6 --- /dev/null +++ b/drivers/staging/rt2860/iface/rtmp_pci.h @@ -0,0 +1,83 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* +*/ + +#ifndef __RTMP_PCI_H__ +#define __RTMP_PCI_H__ + +#define RT28XX_HANDLE_DEV_ASSIGN(handle, dev_p) \ + ((POS_COOKIE)handle)->pci_dev = dev_p; + + +#ifdef LINUX +// set driver data +#define RT28XX_DRVDATA_SET(_a) pci_set_drvdata(_a, net_dev); + +#define RT28XX_PUT_DEVICE(dev_p) + +#ifndef SA_SHIRQ +#define SA_SHIRQ IRQF_SHARED +#endif + +#ifdef PCI_MSI_SUPPORT +#define RTMP_MSI_ENABLE(_pAd) \ + { POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \ + (_pAd)->HaveMsi = pci_enable_msi(_pObj->pci_dev) == 0 ? TRUE : FALSE; \ + } + +#define RTMP_MSI_DISABLE(_pAd) \ + { POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \ + if (_pAd->HaveMsi == TRUE) \ + pci_disable_msi(_pObj->pci_dev); \ + _pAd->HaveMsi = FALSE; \ + } +#else +#define RTMP_MSI_ENABLE(_pAd) do{}while(0) +#define RTMP_MSI_DISABLE(_pAd) do{}while(0) +#endif // PCI_MSI_SUPPORT // + +#define RTMP_PCI_DEV_UNMAP() \ +{ if (net_dev->base_addr) { \ + iounmap((void *)(net_dev->base_addr)); \ + release_mem_region(pci_resource_start(dev_p, 0), \ + pci_resource_len(dev_p, 0)); } \ + if (net_dev->irq) pci_release_regions(dev_p); } + + +#define PCI_REG_READ_WORD(pci_dev, offset, Configuration) \ + if (pci_read_config_word(pci_dev, offset, ®16) == 0) \ + Configuration = le2cpu16(reg16); \ + else \ + Configuration = 0; + +#define PCI_REG_WIRTE_WORD(pci_dev, offset, Configuration) \ + reg16 = cpu2le16(Configuration); \ + pci_write_config_word(pci_dev, offset, reg16); + +#endif // LINUX // + + +#endif // __RTMP_PCI_H__ // diff --git a/drivers/staging/rt2860/iface/rtmp_usb.h b/drivers/staging/rt2860/iface/rtmp_usb.h new file mode 100644 index 000000000000..2e9165effb99 --- /dev/null +++ b/drivers/staging/rt2860/iface/rtmp_usb.h @@ -0,0 +1,200 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* +*/ + +#ifndef __RTMP_USB_H__ +#define __RTMP_USB_H__ + + +#include "../rtusb_io.h" + + +#ifdef LINUX +#include + +typedef struct usb_device * PUSB_DEV; +typedef struct urb *purbb_t; +typedef struct usb_ctrlrequest devctrlrequest; +#endif // LINUX // + +extern UCHAR EpToQueue[6]; + + +#define RXBULKAGGRE_ZISE 12 +#define MAX_TXBULK_LIMIT (LOCAL_TXBUF_SIZE*(BULKAGGRE_ZISE-1)) +#define MAX_TXBULK_SIZE (LOCAL_TXBUF_SIZE*BULKAGGRE_ZISE) +#define MAX_RXBULK_SIZE (LOCAL_TXBUF_SIZE*RXBULKAGGRE_ZISE) +#define MAX_MLME_HANDLER_MEMORY 20 + + +// Flags for Bulkflags control for bulk out data +// +#define fRTUSB_BULK_OUT_DATA_NULL 0x00000001 +#define fRTUSB_BULK_OUT_RTS 0x00000002 +#define fRTUSB_BULK_OUT_MLME 0x00000004 + +#define fRTUSB_BULK_OUT_PSPOLL 0x00000010 +#define fRTUSB_BULK_OUT_DATA_FRAG 0x00000020 +#define fRTUSB_BULK_OUT_DATA_FRAG_2 0x00000040 +#define fRTUSB_BULK_OUT_DATA_FRAG_3 0x00000080 +#define fRTUSB_BULK_OUT_DATA_FRAG_4 0x00000100 + +#define fRTUSB_BULK_OUT_DATA_NORMAL 0x00010000 +#define fRTUSB_BULK_OUT_DATA_NORMAL_2 0x00020000 +#define fRTUSB_BULK_OUT_DATA_NORMAL_3 0x00040000 +#define fRTUSB_BULK_OUT_DATA_NORMAL_4 0x00080000 + +// TODO:move to ./ate/include/iface/ate_usb.h + + +#define FREE_HTTX_RING(_pCookie, _pipeId, _txContext) \ +{ \ + if ((_txContext)->ENextBulkOutPosition == (_txContext)->CurWritePosition) \ + { \ + (_txContext)->bRingEmpty = TRUE; \ + } \ + /*NdisInterlockedDecrement(&(_p)->TxCount); */\ +} + + + +/****************************************************************************** + + USB Bulk operation related definitions + +******************************************************************************/ + +#ifdef LINUX +#define BULKAGGRE_ZISE 100 +#define RT28XX_PUT_DEVICE usb_put_dev +#define RTUSB_ALLOC_URB(iso) usb_alloc_urb(iso, GFP_ATOMIC) +#define RTUSB_SUBMIT_URB(pUrb) usb_submit_urb(pUrb, GFP_ATOMIC) +#define RTUSB_URB_ALLOC_BUFFER(pUsb_Dev, BufSize, pDma_addr) usb_buffer_alloc(pUsb_Dev, BufSize, GFP_ATOMIC, pDma_addr) +#define RTUSB_URB_FREE_BUFFER(pUsb_Dev, BufSize, pTransferBuf, Dma_addr) usb_buffer_free(pUsb_Dev, BufSize, pTransferBuf, Dma_addr) + +#define RTUSB_FREE_URB(pUrb) usb_free_urb(pUrb) + +// unlink urb +#define RTUSB_UNLINK_URB(pUrb) usb_kill_urb(pUrb) + +extern void dump_urb(struct urb* purb); + +#define InterlockedIncrement atomic_inc +#define NdisInterlockedIncrement atomic_inc +#define InterlockedDecrement atomic_dec +#define NdisInterlockedDecrement atomic_dec +#define InterlockedExchange atomic_set + +#endif // LINUX // + + + +#define NT_SUCCESS(status) (((status) >=0) ? (TRUE):(FALSE)) + + + +#define USBD_TRANSFER_DIRECTION_OUT 0 +#define USBD_TRANSFER_DIRECTION_IN 0 +#define USBD_SHORT_TRANSFER_OK 0 +#define PURB purbb_t + +#define PIRP PVOID +#define NDIS_OID UINT +#ifndef USB_ST_NOERROR +#define USB_ST_NOERROR 0 +#endif + +// vendor-specific control operations +#define CONTROL_TIMEOUT_JIFFIES ( (100 * OS_HZ) / 1000) +#define UNLINK_TIMEOUT_MS 3 + + +VOID RTUSBBulkOutDataPacketComplete(purbb_t purb, struct pt_regs *pt_regs); +VOID RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs *pt_regs); +VOID RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs); +VOID RTUSBBulkOutRTSFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs); +VOID RTUSBBulkOutPsPollComplete(purbb_t pUrb, struct pt_regs *pt_regs); +VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs); + + +#ifdef KTHREAD_SUPPORT +#define RTUSBMlmeUp(pAd) \ + do{ \ + RTMP_OS_TASK *_pTask = &((pAd)->mlmeTask);\ + if (_pTask->kthread_task) \ + { \ + _pTask->kthread_running = TRUE; \ + wake_up(&_pTask->kthread_q); \ + } \ + }while(0) +#else +#define RTUSBMlmeUp(pAd) \ + do{ \ + RTMP_OS_TASK *_pTask = &((pAd)->mlmeTask);\ + CHECK_PID_LEGALITY(_pTask->taskPID) \ + { \ + RTMP_SEM_EVENT_UP(&(_pTask->taskSema)); \ + }\ + }while(0) +#endif + +#ifdef KTHREAD_SUPPORT +#define RTUSBCMDUp(pAd) \ + do{ \ + RTMP_OS_TASK *_pTask = &((pAd)->cmdQTask); \ + { \ + _pTask->kthread_running = TRUE; \ + wake_up(&_pTask->kthread_q); \ + } \ + }while(0) + +#else +#define RTUSBCMDUp(pAd) \ + do{ \ + RTMP_OS_TASK *_pTask = &((pAd)->cmdQTask); \ + CHECK_PID_LEGALITY(_pTask->taskPID) \ + {\ + RTMP_SEM_EVENT_UP(&(_pTask->taskSema)); \ + }\ + }while(0) +#endif + +#define DEVICE_VENDOR_REQUEST_OUT 0x40 +#define DEVICE_VENDOR_REQUEST_IN 0xc0 +//#define INTERFACE_VENDOR_REQUEST_OUT 0x41 +//#define INTERFACE_VENDOR_REQUEST_IN 0xc1 + +#define BULKOUT_MGMT_RESET_FLAG 0x80 + +#define RTUSB_SET_BULK_FLAG(_M, _F) ((_M)->BulkFlags |= (_F)) +#define RTUSB_CLEAR_BULK_FLAG(_M, _F) ((_M)->BulkFlags &= ~(_F)) +#define RTUSB_TEST_BULK_FLAG(_M, _F) (((_M)->BulkFlags & (_F)) != 0) + +#define RTMP_IRQ_REQUEST(net_dev) do{}while(0) +#define RTMP_IRQ_RELEASE(net_dev) do{}while(0) + + +#endif // __RTMP_USB_H__ // diff --git a/drivers/staging/rt2860/md5.h b/drivers/staging/rt2860/md5.h deleted file mode 100644 index d85db12170d5..000000000000 --- a/drivers/staging/rt2860/md5.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - md5.h - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Name Date Modification logs - jan 10-28-03 Initial - Rita 11-23-04 Modify MD5 and SHA-1 -*/ - -#ifndef uint8 -#define uint8 unsigned char -#endif - -#ifndef uint32 -#define uint32 unsigned long int -#endif - - -#ifndef __MD5_H__ -#define __MD5_H__ - -#define MD5_MAC_LEN 16 - -typedef struct _MD5_CTX { - UINT32 Buf[4]; // buffers of four states - UCHAR Input[64]; // input message - UINT32 LenInBitCount[2]; // length counter for input message, 0 up to 64 bits -} MD5_CTX; - -VOID MD5Init(MD5_CTX *pCtx); -VOID MD5Update(MD5_CTX *pCtx, UCHAR *pData, UINT32 LenInBytes); -VOID MD5Final(UCHAR Digest[16], MD5_CTX *pCtx); -VOID MD5Transform(UINT32 Buf[4], UINT32 Mes[16]); - -void md5_mac(u8 *key, size_t key_len, u8 *data, size_t data_len, u8 *mac); -void hmac_md5(u8 *key, size_t key_len, u8 *data, size_t data_len, u8 *mac); - -// -// SHA context -// -typedef struct _SHA_CTX -{ - UINT32 Buf[5]; // buffers of five states - UCHAR Input[80]; // input message - UINT32 LenInBitCount[2]; // length counter for input message, 0 up to 64 bits - -} SHA_CTX; - -VOID SHAInit(SHA_CTX *pCtx); -UCHAR SHAUpdate(SHA_CTX *pCtx, UCHAR *pData, UINT32 LenInBytes); -VOID SHAFinal(SHA_CTX *pCtx, UCHAR Digest[20]); -VOID SHATransform(UINT32 Buf[5], UINT32 Mes[20]); - -#define SHA_DIGEST_LEN 20 -#endif // __MD5_H__ - -/******************************************************************************/ -#ifndef _AES_H -#define _AES_H - -typedef struct -{ - uint32 erk[64]; /* encryption round keys */ - uint32 drk[64]; /* decryption round keys */ - int nr; /* number of rounds */ -} -aes_context; - -int rtmp_aes_set_key( aes_context *ctx, uint8 *key, int nbits ); -void rtmp_aes_encrypt( aes_context *ctx, uint8 input[16], uint8 output[16] ); -void rtmp_aes_decrypt( aes_context *ctx, uint8 input[16], uint8 output[16] ); - -void F(char *password, unsigned char *ssid, int ssidlength, int iterations, int count, unsigned char *output); -int PasswordHash(char *password, unsigned char *ssid, int ssidlength, unsigned char *output); - -#endif /* aes.h */ - diff --git a/drivers/staging/rt2860/mlme.h b/drivers/staging/rt2860/mlme.h index 3d1a8284fbd4..f609ea5660a1 100644 --- a/drivers/staging/rt2860/mlme.h +++ b/drivers/staging/rt2860/mlme.h @@ -39,6 +39,10 @@ #ifndef __MLME_H__ #define __MLME_H__ +#include "rtmp_dot11.h" + + + // maximum supported capability information - // ESS, IBSS, Privacy, Short Preamble, Spectrum mgmt, Short Slot #define SUPPORTED_CAPABILITY_INFO 0x0533 @@ -58,23 +62,24 @@ #define JAP_W56 4 #define MAX_RD_REGION 5 -#ifdef NDIS51_MINIPORT -#define BEACON_LOST_TIME 4000 // 2048 msec = 2 sec -#else #define BEACON_LOST_TIME 4 * OS_HZ // 2048 msec = 2 sec -#endif #define DLS_TIMEOUT 1200 // unit: msec #define AUTH_TIMEOUT 300 // unit: msec #define ASSOC_TIMEOUT 300 // unit: msec -#define JOIN_TIMEOUT 2 * OS_HZ // unit: msec +#define JOIN_TIMEOUT 2000 // unit: msec #define SHORT_CHANNEL_TIME 90 // unit: msec #define MIN_CHANNEL_TIME 110 // unit: msec, for dual band scan #define MAX_CHANNEL_TIME 140 // unit: msec, for single band scan #define FAST_ACTIVE_SCAN_TIME 30 // Active scan waiting for probe response time #define CW_MIN_IN_BITS 4 // actual CwMin = 2^CW_MIN_IN_BITS - 1 +#define LINK_DOWN_TIMEOUT 20000 // unit: msec +#define AUTO_WAKEUP_TIMEOUT 70 //unit: msec + + #define CW_MAX_IN_BITS 10 // actual CwMax = 2^CW_MAX_IN_BITS - 1 + // Note: RSSI_TO_DBM_OFFSET has been changed to variable for new RF (2004-0720). // SHould not refer to this constant anymore //#define RSSI_TO_DBM_OFFSET 120 // for RT2530 RSSI-115 = dBm @@ -290,7 +295,7 @@ typedef struct PACKED _HT_CAPABILITY_IE{ #define dot11BSSWidthTriggerScanInterval 300 // in sec. max interval between scan operations to be performed to detect BSS channel width trigger events. #define dot11OBSSScanPassiveTotalPerChannel 200 // in TU. min total amount of time that the STA scans each channel when performing a passive OBSS scan. #define dot11OBSSScanActiveTotalPerChannel 20 //in TU. min total amount of time that the STA scans each channel when performing a active OBSS scan -#define dot11BSSWidthChannelTransactionDelayFactor 5 // min ratio between the delay time in performing a switch from 20MHz BSS to 20/40 BSS operation and the maxima +#define dot11BSSWidthChannelTransactionDelayFactor 5 // min ratio between the delay time in performing a switch from 20MHz BSS to 20/40 BSS operation and the maximum // interval between overlapping BSS scan operations. #define dot11BSSScanActivityThreshold 25 // in %%, max total time that a STA may be active on the medium during a period of // (dot11BSSWidthChannelTransactionDelayFactor * dot11BSSWidthTriggerScanInterval) seconds without @@ -382,7 +387,7 @@ typedef struct { BOOLEAN bHtEnable; // If we should use ht rate. BOOLEAN bPreNHt; // If we should use ht rate. //Substract from HT Capability IE - UCHAR MCSSet[16]; //only supoort MCS=0-15,32 , + UCHAR MCSSet[16]; } RT_HT_PHY_INFO, *PRT_HT_PHY_INFO; //This structure substracts ralink supports from all 802.11n-related features. @@ -460,60 +465,6 @@ typedef struct PACKED{ UCHAR NewExtChanOffset; } NEW_EXT_CHAN_IE, *PNEW_EXT_CHAN_IE; - -// 4-byte HTC field. maybe included in any frame except non-QOS data frame. The Order bit must set 1. -typedef struct PACKED { - UINT32 MA:1; //management action payload exist in (QoS Null+HTC) - UINT32 TRQ:1; //sounding request - UINT32 MRQ:1; //MCS feedback. Request for a MCS feedback - UINT32 MRSorASI:3; // MRQ Sequence identifier. unchanged during entire procedure. 0x000-0x110. - UINT32 MFS:3; //SET to the received value of MRS. 0x111 for unsolicited MFB. - UINT32 MFBorASC:7; //Link adaptation feedback containing recommended MCS. 0x7f for no feedback or not available - UINT32 CalPos:2; // calibration position - UINT32 CalSeq:2; //calibration sequence - UINT32 FBKReq:2; //feedback request - UINT32 CSISTEERING:2; //CSI/ STEERING - UINT32 ZLFAnnouce:1; // ZLF announcement - UINT32 rsv:5; //calibration sequence - UINT32 ACConstraint:1; //feedback request - UINT32 RDG:1; //RDG / More PPDU -} HT_CONTROL, *PHT_CONTROL; - -// 2-byte QOS CONTROL field -typedef struct PACKED { - USHORT TID:4; - USHORT EOSP:1; - USHORT AckPolicy:2; //0: normal ACK 1:No ACK 2:scheduled under MTBA/PSMP 3: BA - USHORT AMsduPresent:1; - USHORT Txop_QueueSize:8; -} QOS_CONTROL, *PQOS_CONTROL; - -// 2-byte Frame control field -typedef struct PACKED { - USHORT Ver:2; // Protocol version - USHORT Type:2; // MSDU type - USHORT SubType:4; // MSDU subtype - USHORT ToDs:1; // To DS indication - USHORT FrDs:1; // From DS indication - USHORT MoreFrag:1; // More fragment bit - USHORT Retry:1; // Retry status bit - USHORT PwrMgmt:1; // Power management bit - USHORT MoreData:1; // More data bit - USHORT Wep:1; // Wep data - USHORT Order:1; // Strict order expected -} FRAME_CONTROL, *PFRAME_CONTROL; - -typedef struct PACKED _HEADER_802_11 { - FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; - UCHAR Addr3[MAC_ADDR_LEN]; - USHORT Frag:4; - USHORT Sequence:12; - UCHAR Octet[0]; -} HEADER_802_11, *PHEADER_802_11; - typedef struct PACKED _FRAME_802_11 { HEADER_802_11 Hdr; UCHAR Octet[1]; @@ -595,20 +546,6 @@ typedef struct { } EACH_TID, *PEACH_TID; -typedef struct PACKED _PSPOLL_FRAME { - FRAME_CONTROL FC; - USHORT Aid; - UCHAR Bssid[MAC_ADDR_LEN]; - UCHAR Ta[MAC_ADDR_LEN]; -} PSPOLL_FRAME, *PPSPOLL_FRAME; - -typedef struct PACKED _RTS_FRAME { - FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; -}RTS_FRAME, *PRTS_FRAME; - // BAREQ AND MTBAREQ have the same subtype BAR, 802.11n BAR use compressed bitmap. typedef struct PACKED _FRAME_BA_REQ { FRAME_CONTROL FC; @@ -1059,7 +996,7 @@ typedef struct _MLME_START_REQ_STRUCT { typedef struct PACKED { UCHAR Eid; UCHAR Len; - CHAR Octet[1]; + UCHAR Octet[1]; } EID_STRUCT,*PEID_STRUCT, BEACON_EID_STRUCT, *PBEACON_EID_STRUCT; typedef struct PACKED _RTMP_TX_RATE_SWITCH diff --git a/drivers/staging/rt2860/oid.h b/drivers/staging/rt2860/oid.h index 0227c4a38f9f..a03293cabd87 100644 --- a/drivers/staging/rt2860/oid.h +++ b/drivers/staging/rt2860/oid.h @@ -37,9 +37,14 @@ #ifndef _OID_H_ #define _OID_H_ +//#include +#ifndef TRUE #define TRUE 1 +#endif +#ifndef FALSE #define FALSE 0 +#endif // // IEEE 802.11 Structures and definitions // @@ -73,24 +78,25 @@ #define NDIS_802_11_LENGTH_RATES 8 #define NDIS_802_11_LENGTH_RATES_EX 16 #define MAC_ADDR_LENGTH 6 -#define MAX_NUM_OF_CHS 49 // 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL terminationc +//#define MAX_NUM_OF_CHS 49 // 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL terminationc +#define MAX_NUM_OF_CHS 54 // 14 channels @2.4G + 12@UNII(lower/middle) + 16@HiperLAN2 + 11@UNII(upper) + 0 @Japan + 1 as NULL termination #define MAX_NUMBER_OF_EVENT 10 // entry # in EVENT table #define MAX_NUMBER_OF_MAC 32 // if MAX_MBSSID_NUM is 8, this value can't be larger than 211 #define MAX_NUMBER_OF_ACL 64 #define MAX_LENGTH_OF_SUPPORT_RATES 12 // 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 #define MAX_NUMBER_OF_DLS_ENTRY 4 -#define OID_GEN_MACHINE_NAME 0x0001021A #define RT_QUERY_SIGNAL_CONTEXT 0x0402 #define RT_SET_IAPP_PID 0x0404 #define RT_SET_APD_PID 0x0405 #define RT_SET_DEL_MAC_ENTRY 0x0406 - +#define RT_QUERY_EVENT_TABLE 0x0407 // // IEEE 802.11 OIDs // #define OID_GET_SET_TOGGLE 0x8000 +#define OID_GET_SET_FROM_UI 0x4000 #define OID_802_11_ADD_WEP 0x0112 #define OID_802_11_DISASSOCIATE 0x0114 @@ -101,22 +107,28 @@ #define RT_OID_DEVICE_NAME 0x0607 #define RT_OID_VERSION_INFO 0x0608 +#define OID_802_11_BSSID_LIST 0x0609 +#define OID_802_3_CURRENT_ADDRESS 0x060A #define OID_GEN_MEDIA_CONNECT_STATUS 0x060B +#define RT_OID_802_11_QUERY_LINK_STATUS 0x060C +#define OID_802_11_RSSI 0x060D +#define OID_802_11_STATISTICS 0x060E #define OID_GEN_RCV_OK 0x060F #define OID_GEN_RCV_NO_BUFFER 0x0610 - +#define RT_OID_802_11_QUERY_EEPROM_VERSION 0x0611 +#define RT_OID_802_11_QUERY_FIRMWARE_VERSION 0x0612 +#define RT_OID_802_11_QUERY_LAST_RX_RATE 0x0613 +#define RT_OID_802_11_TX_POWER_LEVEL_1 0x0614 +#define RT_OID_802_11_QUERY_PIDVID 0x0615 +//for WPA_SUPPLICANT_SUPPORT #define OID_SET_COUNTERMEASURES 0x0616 #define RT_OID_WPA_SUPPLICANT_SUPPORT 0x0621 #define RT_OID_WE_VERSION_COMPILED 0x0622 #define RT_OID_NEW_DRIVER 0x0623 -//rt2860 , kathy #define RT_OID_DRIVER_DEVICE_NAME 0x0645 #define RT_OID_QUERY_MULTIPLE_CARD_SUPPORT 0x0647 -// Ralink defined OIDs -// Dennis Lee move to platform specific - typedef enum _NDIS_802_11_STATUS_TYPE { Ndis802_11StatusType_Authentication, @@ -169,10 +181,10 @@ typedef enum _NDIS_802_11_NETWORK_TYPE Ndis802_11FH, Ndis802_11DS, Ndis802_11OFDM5, - Ndis802_11OFDM5_N, Ndis802_11OFDM24, - Ndis802_11OFDM24_N, Ndis802_11Automode, + Ndis802_11OFDM5_N, + Ndis802_11OFDM24_N, Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound } NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE; @@ -271,13 +283,15 @@ typedef struct PACKED _RADIUS_CONF UINT32 own_ip_addr; UINT32 retry_interval; UINT32 session_timeout_interval; - UCHAR EAPifname[IFNAMSIZ]; - UCHAR EAPifname_len; - UCHAR PreAuthifname[IFNAMSIZ]; - UCHAR PreAuthifname_len; - RADIUS_KEY_INFO RadiusInfo[8/*MAX_MBSSID_NUM*/]; + UCHAR EAPifname[8][IFNAMSIZ]; + UCHAR EAPifname_len[8]; + UCHAR PreAuthifname[8][IFNAMSIZ]; + UCHAR PreAuthifname_len[8]; + RADIUS_KEY_INFO RadiusInfo[8]; } RADIUS_CONF, *PRADIUS_CONF; + + // Key mapping keys require a BSSID typedef struct _NDIS_802_11_KEY { @@ -289,6 +303,13 @@ typedef struct _NDIS_802_11_KEY UCHAR KeyMaterial[1]; // variable length depending on above field } NDIS_802_11_KEY, *PNDIS_802_11_KEY; +typedef struct _NDIS_802_11_PASSPHRASE +{ + UINT KeyLength; // length of key in bytes + NDIS_802_11_MAC_ADDRESS BSSID; + UCHAR KeyMaterial[1]; // variable length depending on above field +} NDIS_802_11_PASSPHRASE, *PNDIS_802_11_PASSPHRASE; + typedef struct _NDIS_802_11_REMOVE_KEY { UINT Length; // Length of this structure @@ -481,6 +502,19 @@ typedef struct _NDIS_802_11_AUTHENTICATION_EVENT NDIS_802_11_AUTHENTICATION_REQUEST Request[1]; } NDIS_802_11_AUTHENTICATION_EVENT, *PNDIS_802_11_AUTHENTICATION_EVENT; +/* +typedef struct _NDIS_802_11_TEST +{ + ULONG Length; + ULONG Type; + union + { + NDIS_802_11_AUTHENTICATION_EVENT AuthenticationEvent; + NDIS_802_11_RSSI RssiTrigger; + }; +} NDIS_802_11_TEST, *PNDIS_802_11_TEST; + */ + // 802.11 Media stream constraints, associated with OID_802_11_MEDIA_STREAM_MODE typedef enum _NDIS_802_11_MEDIA_STREAM_MODE { @@ -519,14 +553,18 @@ typedef struct _NDIS_802_11_CAPABILITY NDIS_802_11_AUTHENTICATION_ENCRYPTION AuthenticationEncryptionSupported[1]; } NDIS_802_11_CAPABILITY, *PNDIS_802_11_CAPABILITY; -#define RT_PRIV_IOCTL_EXT (SIOCIWFIRSTPRIV + 0x01) // Sync. with AP for wsc upnp daemon +#ifdef LINUX +#endif // LINUX // + + +#define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x01) // Sync. with AP for wsc upnp daemon #define RTPRIV_IOCTL_SET (SIOCIWFIRSTPRIV + 0x02) #define RTPRIV_IOCTL_STATISTICS (SIOCIWFIRSTPRIV + 0x09) #define RTPRIV_IOCTL_ADD_PMKID_CACHE (SIOCIWFIRSTPRIV + 0x0A) #define RTPRIV_IOCTL_RADIUS_DATA (SIOCIWFIRSTPRIV + 0x0C) #define RTPRIV_IOCTL_GSITESURVEY (SIOCIWFIRSTPRIV + 0x0D) -#define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x0E) // Sync. with RT61 (for wpa_supplicant) +#define RT_PRIV_IOCTL_EXT (SIOCIWFIRSTPRIV + 0x0E) // Sync. with RT61 (for wpa_supplicant) #define RTPRIV_IOCTL_GET_MAC_TABLE (SIOCIWFIRSTPRIV + 0x0F) #define RTPRIV_IOCTL_SHOW (SIOCIWFIRSTPRIV + 0x11) @@ -535,27 +573,54 @@ enum { SHOW_DRVIER_VERION = 5, SHOW_BA_INFO = 6, SHOW_DESC_INFO = 7, -#ifdef RT2870 +#ifdef RTMP_MAC_USB SHOW_RXBULK_INFO = 8, SHOW_TXBULK_INFO = 9, -#endif // RT2870 // +#endif // RTMP_MAC_USB // RAIO_OFF = 10, RAIO_ON = 11, SHOW_CFG_VALUE = 20, -#if !defined(RT2860) SHOW_ADHOC_ENTRY_INFO = 21, -#endif }; -#ifdef LLTD_SUPPORT + + + + + +#define OID_802_11_BUILD_CHANNEL_EX 0x0714 +#define OID_802_11_GET_CH_LIST 0x0715 +#define OID_802_11_GET_COUNTRY_CODE 0x0716 +#define OID_802_11_GET_CHANNEL_GEOGRAPHY 0x0717 + +//#define RT_OID_802_11_STATISTICS (OID_GET_SET_TOGGLE | OID_802_11_STATISTICS) + +#define RT_OID_WSC_SET_PASSPHRASE 0x0740 // passphrase for wpa(2)-psk +#define RT_OID_WSC_DRIVER_AUTO_CONNECT 0x0741 +#define RT_OID_WSC_QUERY_DEFAULT_PROFILE 0x0742 +#define RT_OID_WSC_SET_CONN_BY_PROFILE_INDEX 0x0743 +#define RT_OID_WSC_SET_ACTION 0x0744 +#define RT_OID_WSC_SET_SSID 0x0745 +#define RT_OID_WSC_SET_PIN_CODE 0x0746 +#define RT_OID_WSC_SET_MODE 0x0747 // PIN or PBC +#define RT_OID_WSC_SET_CONF_MODE 0x0748 // Enrollee or Registrar +#define RT_OID_WSC_SET_PROFILE 0x0749 +#define RT_OID_WSC_CONFIG_STATUS 0x074F +#define RT_OID_802_11_WSC_QUERY_PROFILE 0x0750 // for consistency with RT61 -#define RT_OID_GET_PHY_MODE 0x761 -#endif // LLTD_SUPPORT // +#define RT_OID_WSC_QUERY_STATUS 0x0751 +#define RT_OID_WSC_PIN_CODE 0x0752 +#define RT_OID_WSC_UUID 0x0753 +#define RT_OID_WSC_SET_SELECTED_REGISTRAR 0x0754 +#define RT_OID_WSC_EAPMSG 0x0755 +#define RT_OID_WSC_MANUFACTURER 0x0756 +#define RT_OID_WSC_MODEL_NAME 0x0757 +#define RT_OID_WSC_MODEL_NO 0x0758 +#define RT_OID_WSC_SERIAL_NO 0x0759 +#define RT_OID_WSC_MAC_ADDRESS 0x0760 -#if defined(RT2860) || defined(RT30xx) // New for MeetingHouse Api support #define OID_MH_802_1X_SUPPORTED 0xFFEDC100 -#endif // MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!! typedef union _HTTRANSMIT_SETTING { @@ -564,6 +629,7 @@ typedef union _HTTRANSMIT_SETTING { USHORT BW:1; //channel bandwidth 20MHz or 40 MHz USHORT ShortGI:1; USHORT STBC:2; //SPACE +// USHORT rsv:3; USHORT rsv:2; USHORT TxBF:1; USHORT MODE:2; // Use definition MODE_xxx. @@ -577,7 +643,6 @@ typedef enum _RT_802_11_PREAMBLE { Rt802_11PreambleAuto } RT_802_11_PREAMBLE, *PRT_802_11_PREAMBLE; -// Only for STA, need to sync with AP typedef enum _RT_802_11_PHY_MODE { PHY_11BG_MIXED = 0, PHY_11B, @@ -744,19 +809,6 @@ typedef struct { UCHAR rsv; } OID_SET_HT_PHYMODE, *POID_SET_HT_PHYMODE; -#ifdef LLTD_SUPPORT -typedef struct _RT_LLTD_ASSOICATION_ENTRY { - UCHAR Addr[ETH_LENGTH_OF_ADDRESS]; - unsigned short MOR; // maximum operational rate - UCHAR phyMode; -} RT_LLTD_ASSOICATION_ENTRY, *PRT_LLTD_ASSOICATION_ENTRY; - -typedef struct _RT_LLTD_ASSOICATION_TABLE { - unsigned int Num; - RT_LLTD_ASSOICATION_ENTRY Entry[MAX_NUMBER_OF_MAC]; -} RT_LLTD_ASSOICATION_TABLE, *PRT_LLTD_ASSOICATION_TABLE; -#endif // LLTD_SUPPORT // - #define MAX_CUSTOM_LEN 128 typedef enum _RT_802_11_D_CLIENT_MODE @@ -772,7 +824,6 @@ typedef struct _RT_CHANNEL_LIST_INFO UCHAR ChannelListNum; // number of channel in ChannelList[] } RT_CHANNEL_LIST_INFO, *PRT_CHANNEL_LIST_INFO; -#ifdef RT2870 // WSC configured credential typedef struct _WSC_CREDENTIAL { @@ -790,9 +841,9 @@ typedef struct _WSC_CREDENTIAL typedef struct _WSC_PROFILE { UINT ProfileCnt; + UINT ApplyProfileIdx; // add by johnli, fix WPS test plan 5.1.1 WSC_CREDENTIAL Profile[8]; // Support up to 8 profiles } WSC_PROFILE, *PWSC_PROFILE; -#endif #endif // _OID_H_ diff --git a/drivers/staging/rt2860/pci_main_dev.c b/drivers/staging/rt2860/pci_main_dev.c new file mode 100644 index 000000000000..5f39c44d78f7 --- /dev/null +++ b/drivers/staging/rt2860/pci_main_dev.c @@ -0,0 +1,873 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + pci_main_dev.c + + Abstract: + Create and register network interface for PCI based chipsets in Linux platform. + + Revision History: + Who When What + -------- ---------- ---------------------------------------------- +*/ + +#include "rt_config.h" +#include + +// +// Function declarations +// +extern int rt28xx_close(IN struct net_device *net_dev); +extern int rt28xx_open(struct net_device *net_dev); + +static VOID __devexit rt2860_remove_one(struct pci_dev *pci_dev); +static INT __devinit rt2860_probe(struct pci_dev *pci_dev, const struct pci_device_id *ent); +static void __exit rt2860_cleanup_module(void); +static int __init rt2860_init_module(void); + + static VOID RTMPInitPCIeDevice( + IN struct pci_dev *pci_dev, + IN PRTMP_ADAPTER pAd); + +#ifdef CONFIG_PM +static int rt2860_suspend(struct pci_dev *pci_dev, pm_message_t state); +static int rt2860_resume(struct pci_dev *pci_dev); +#endif // CONFIG_PM // + +// +// Ralink PCI device table, include all supported chipsets +// +static struct pci_device_id rt2860_pci_tbl[] __devinitdata = +{ + {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2860_PCI_DEVICE_ID)}, //RT28602.4G + {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2860_PCIe_DEVICE_ID)}, + {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2760_PCI_DEVICE_ID)}, + {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2790_PCIe_DEVICE_ID)}, + {PCI_DEVICE(VEN_AWT_PCI_VENDOR_ID, VEN_AWT_PCIe_DEVICE_ID)}, + {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7708)}, + {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7728)}, + {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7758)}, + {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7727)}, + {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7738)}, + {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7748)}, + {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7768)}, + {0,} // terminate list +}; + +MODULE_DEVICE_TABLE(pci, rt2860_pci_tbl); +MODULE_LICENSE("GPL"); +#ifdef MODULE_VERSION +MODULE_VERSION(STA_DRIVER_VERSION); +#endif + + +// +// Our PCI driver structure +// +static struct pci_driver rt2860_driver = +{ + name: "rt2860", + id_table: rt2860_pci_tbl, + probe: rt2860_probe, + remove: __devexit_p(rt2860_remove_one), +#ifdef CONFIG_PM + suspend: rt2860_suspend, + resume: rt2860_resume, +#endif +}; + + +/*************************************************************************** + * + * PCI device initialization related procedures. + * + ***************************************************************************/ +#ifdef CONFIG_PM + +VOID RT2860RejectPendingPackets( + IN PRTMP_ADAPTER pAd) +{ + // clear PS packets + // clear TxSw packets +} + +static int rt2860_suspend( + struct pci_dev *pci_dev, + pm_message_t state) +{ + struct net_device *net_dev = pci_get_drvdata(pci_dev); + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)NULL; + INT32 retval = 0; + + + DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_suspend()\n")); + + if (net_dev == NULL) + { + DBGPRINT(RT_DEBUG_ERROR, ("net_dev == NULL!\n")); + } + else + { + GET_PAD_FROM_NET_DEV(pAd, net_dev); + + /* we can not use IFF_UP because ra0 down but ra1 up */ + /* and 1 suspend/resume function for 1 module, not for each interface */ + /* so Linux will call suspend/resume function once */ + if (VIRTUAL_IF_NUM(pAd) > 0) + { + // avoid users do suspend after interface is down + + // stop interface + netif_carrier_off(net_dev); + netif_stop_queue(net_dev); + + // mark device as removed from system and therefore no longer available + netif_device_detach(net_dev); + + // mark halt flag + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); + + // take down the device + rt28xx_close((PNET_DEV)net_dev); + + RT_MOD_DEC_USE_COUNT(); + } + } + + // reference to http://vovo2000.com/type-lab/linux/kernel-api/linux-kernel-api.html + // enable device to generate PME# when suspended + // pci_choose_state(): Choose the power state of a PCI device to be suspended + retval = pci_enable_wake(pci_dev, pci_choose_state(pci_dev, state), 1); + // save the PCI configuration space of a device before suspending + pci_save_state(pci_dev); + // disable PCI device after use + pci_disable_device(pci_dev); + + retval = pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)); + + DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_suspend()\n")); + return retval; +} + +static int rt2860_resume( + struct pci_dev *pci_dev) +{ + struct net_device *net_dev = pci_get_drvdata(pci_dev); + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)NULL; + INT32 retval; + + + // set the power state of a PCI device + // PCI has 4 power states, DO (normal) ~ D3(less power) + // in include/linux/pci.h, you can find that + // #define PCI_D0 ((pci_power_t __force) 0) + // #define PCI_D1 ((pci_power_t __force) 1) + // #define PCI_D2 ((pci_power_t __force) 2) + // #define PCI_D3hot ((pci_power_t __force) 3) + // #define PCI_D3cold ((pci_power_t __force) 4) + // #define PCI_UNKNOWN ((pci_power_t __force) 5) + // #define PCI_POWER_ERROR ((pci_power_t __force) -1) + retval = pci_set_power_state(pci_dev, PCI_D0); + + // restore the saved state of a PCI device + pci_restore_state(pci_dev); + + // initialize device before it's used by a driver + if (pci_enable_device(pci_dev)) + { + printk("pci enable fail!\n"); + return 0; + } + + DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_resume()\n")); + + if (net_dev == NULL) + { + DBGPRINT(RT_DEBUG_ERROR, ("net_dev == NULL!\n")); + } + else + GET_PAD_FROM_NET_DEV(pAd, net_dev); + + if (pAd != NULL) + { + /* we can not use IFF_UP because ra0 down but ra1 up */ + /* and 1 suspend/resume function for 1 module, not for each interface */ + /* so Linux will call suspend/resume function once */ + if (VIRTUAL_IF_NUM(pAd) > 0) + { + // mark device as attached from system and restart if needed + netif_device_attach(net_dev); + + if (rt28xx_open((PNET_DEV)net_dev) != 0) + { + // open fail + DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_resume()\n")); + return 0; + } + + // increase MODULE use count + RT_MOD_INC_USE_COUNT(); + + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); + + netif_start_queue(net_dev); + netif_carrier_on(net_dev); + netif_wake_queue(net_dev); + } + } + + DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_resume()\n")); + return 0; +} +#endif // CONFIG_PM // + + +static INT __init rt2860_init_module(VOID) +{ + return pci_register_driver(&rt2860_driver); +} + + +// +// Driver module unload function +// +static VOID __exit rt2860_cleanup_module(VOID) +{ + pci_unregister_driver(&rt2860_driver); +} + +module_init(rt2860_init_module); +module_exit(rt2860_cleanup_module); + + +// +// PCI device probe & initialization function +// +static INT __devinit rt2860_probe( + IN struct pci_dev *pci_dev, + IN const struct pci_device_id *pci_id) +{ + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)NULL; + struct net_device *net_dev; + PVOID handle; + PSTRING print_name; + ULONG csr_addr; + INT rv = 0; + RTMP_OS_NETDEV_OP_HOOK netDevHook; + + DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_probe\n")); + +//PCIDevInit============================================== + // wake up and enable device + if ((rv = pci_enable_device(pci_dev))!= 0) + { + DBGPRINT(RT_DEBUG_ERROR, ("Enable PCI device failed, errno=%d!\n", rv)); + return rv; + } + + print_name = pci_name(pci_dev); + + if ((rv = pci_request_regions(pci_dev, print_name)) != 0) + { + DBGPRINT(RT_DEBUG_ERROR, ("Request PCI resource failed, errno=%d!\n", rv)); + goto err_out; + } + + // map physical address to virtual address for accessing register + csr_addr = (unsigned long) ioremap(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); + if (!csr_addr) + { + DBGPRINT(RT_DEBUG_ERROR, ("ioremap failed for device %s, region 0x%lX @ 0x%lX\n", + print_name, (ULONG)pci_resource_len(pci_dev, 0), (ULONG)pci_resource_start(pci_dev, 0))); + goto err_out_free_res; + } + else + { + DBGPRINT(RT_DEBUG_TRACE, ("%s: at 0x%lx, VA 0x%lx, IRQ %d. \n", print_name, + (ULONG)pci_resource_start(pci_dev, 0), (ULONG)csr_addr, pci_dev->irq)); + } + + // Set DMA master + pci_set_master(pci_dev); + + +//RtmpDevInit============================================== + // Allocate RTMP_ADAPTER adapter structure + handle = kmalloc(sizeof(struct os_cookie), GFP_KERNEL); + if (handle == NULL) + { + DBGPRINT(RT_DEBUG_ERROR, ("%s(): Allocate memory for os handle failed!\n", __func__)); + goto err_out_iounmap; + } + + ((POS_COOKIE)handle)->pci_dev = pci_dev; + + rv = RTMPAllocAdapterBlock(handle, &pAd); //shiang: we may need the pci_dev for allocate structure of "RTMP_ADAPTER" + if (rv != NDIS_STATUS_SUCCESS) + goto err_out_iounmap; + // Here are the RTMP_ADAPTER structure with pci-bus specific parameters. + pAd->CSRBaseAddress = (PUCHAR)csr_addr; + DBGPRINT(RT_DEBUG_ERROR, ("pAd->CSRBaseAddress =0x%lx, csr_addr=0x%lx!\n", (ULONG)pAd->CSRBaseAddress, csr_addr)); + RtmpRaDevCtrlInit(pAd, RTMP_DEV_INF_PCI); + + +//NetDevInit============================================== + net_dev = RtmpPhyNetDevInit(pAd, &netDevHook); + if (net_dev == NULL) + goto err_out_free_radev; + + // Here are the net_device structure with pci-bus specific parameters. + net_dev->irq = pci_dev->irq; // Interrupt IRQ number + net_dev->base_addr = csr_addr; // Save CSR virtual address and irq to device structure + pci_set_drvdata(pci_dev, net_dev); // Set driver data + +/* for supporting Network Manager */ + /* Set the sysfs physical device reference for the network logical device + * if set prior to registration will cause a symlink during initialization. + */ + SET_NETDEV_DEV(net_dev, &(pci_dev->dev)); + + +//All done, it's time to register the net device to linux kernel. + // Register this device + rv = RtmpOSNetDevAttach(net_dev, &netDevHook); + if (rv) + goto err_out_free_netdev; + + pAd->StaCfg.OriDevType = net_dev->type; + RTMPInitPCIeDevice(pci_dev, pAd); + +#ifdef KTHREAD_SUPPORT +#endif // KTHREAD_SUPPORT // + + DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_probe\n")); + + return 0; // probe ok + + + /* --------------------------- ERROR HANDLE --------------------------- */ +err_out_free_netdev: + RtmpOSNetDevFree(net_dev); + +err_out_free_radev: + /* free RTMP_ADAPTER strcuture and os_cookie*/ + RTMPFreeAdapter(pAd); + +err_out_iounmap: + iounmap((void *)(csr_addr)); + release_mem_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); + +err_out_free_res: + pci_release_regions(pci_dev); + +err_out: + pci_disable_device(pci_dev); + + DBGPRINT(RT_DEBUG_ERROR, ("<=== rt2860_probe failed with rv = %d!\n", rv)); + + return -ENODEV; /* probe fail */ +} + + +static VOID __devexit rt2860_remove_one( + IN struct pci_dev *pci_dev) +{ + PNET_DEV net_dev = pci_get_drvdata(pci_dev); + RTMP_ADAPTER *pAd = NULL; + ULONG csr_addr = net_dev->base_addr; // pAd->CSRBaseAddress; + + GET_PAD_FROM_NET_DEV(pAd, net_dev); + + DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_remove_one\n")); + + if (pAd != NULL) + { + // Unregister/Free all allocated net_device. + RtmpPhyNetDevExit(pAd, net_dev); + + // Unmap CSR base address + iounmap((char *)(csr_addr)); + + // release memory region + release_mem_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); + + // Free RTMP_ADAPTER related structures. + RtmpRaDevCtrlExit(pAd); + + } + else + { + // Unregister network device + RtmpOSNetDevDetach(net_dev); + + // Unmap CSR base address + iounmap((char *)(net_dev->base_addr)); + + // release memory region + release_mem_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); + } + + // Free the root net_device + RtmpOSNetDevFree(net_dev); + +} + + +/* +======================================================================== +Routine Description: + Check the chipset vendor/product ID. + +Arguments: + _dev_p Point to the PCI or USB device + +Return Value: + TRUE Check ok + FALSE Check fail + +Note: +======================================================================== +*/ +BOOLEAN RT28XXChipsetCheck( + IN void *_dev_p) +{ + /* always TRUE */ + return TRUE; +} + + +/*************************************************************************** + * + * PCIe device initialization related procedures. + * + ***************************************************************************/ + static VOID RTMPInitPCIeDevice( + IN struct pci_dev *pci_dev, + IN PRTMP_ADAPTER pAd) +{ + USHORT device_id; + POS_COOKIE pObj; + + pObj = (POS_COOKIE) pAd->OS_Cookie; + pci_read_config_word(pci_dev, PCI_DEVICE_ID, &device_id); + device_id = le2cpu16(device_id); + pObj->DeviceID = device_id; + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE); + if ( + (device_id == NIC2860_PCIe_DEVICE_ID) || + (device_id == NIC2790_PCIe_DEVICE_ID) || + (device_id == VEN_AWT_PCIe_DEVICE_ID) || + 0) + { + UINT32 MacCsr0 = 0, Index= 0; + do + { + RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0); + + if ((MacCsr0 != 0x00) && (MacCsr0 != 0xFFFFFFFF)) + break; + + RTMPusecDelay(10); + } while (Index++ < 100); + + // Support advanced power save after 2892/2790. + // MAC version at offset 0x1000 is 0x2872XXXX/0x2870XXXX(PCIe, USB, SDIO). + if ((MacCsr0&0xffff0000) != 0x28600000) + { + OPSTATUS_SET_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE); + } + } +} + + +VOID RTMPInitPCIeLinkCtrlValue( + IN PRTMP_ADAPTER pAd) +{ + INT pos; + USHORT reg16, data2, PCIePowerSaveLevel, Configuration; + BOOLEAN bFindIntel = FALSE; + POS_COOKIE pObj; + + pObj = (POS_COOKIE) pAd->OS_Cookie; + + if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + return; + + DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __func__)); + // Init EEPROM, and save settings + if (!IS_RT3090(pAd)) + { + RT28xx_EEPROM_READ16(pAd, 0x22, PCIePowerSaveLevel); + pAd->PCIePowerSaveLevel = PCIePowerSaveLevel & 0xff; + + if ((PCIePowerSaveLevel&0xff) == 0xff) + { + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE); + DBGPRINT(RT_DEBUG_TRACE, ("====> PCIePowerSaveLevel = 0x%x.\n", PCIePowerSaveLevel)); + return; + } + else + { + PCIePowerSaveLevel &= 0x3; + RT28xx_EEPROM_READ16(pAd, 0x24, data2); + + if( !(((data2&0xff00) == 0x9200) && ((data2&0x80) !=0)) ) + { + if (PCIePowerSaveLevel > 1 ) + PCIePowerSaveLevel = 1; + } + + DBGPRINT(RT_DEBUG_TRACE, ("====> Write 0x83 = 0x%x.\n", PCIePowerSaveLevel)); + AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSaveLevel, 0x00); + RT28xx_EEPROM_READ16(pAd, 0x22, PCIePowerSaveLevel); + PCIePowerSaveLevel &= 0xff; + PCIePowerSaveLevel = PCIePowerSaveLevel >> 6; + switch(PCIePowerSaveLevel) + { + case 0: // Only support L0 + pAd->LnkCtrlBitMask = 0; + break; + case 1: // Only enable L0s + pAd->LnkCtrlBitMask = 1; + break; + case 2: // enable L1, L0s + pAd->LnkCtrlBitMask = 3; + break; + case 3: // sync with host clk and enable L1, L0s + pAd->LnkCtrlBitMask = 0x103; + break; + } + DBGPRINT(RT_DEBUG_TRACE, ("====> LnkCtrlBitMask = 0x%x.\n", pAd->LnkCtrlBitMask)); + } + } + else if (IS_RT3090(pAd)) + { + // 1. read setting from inf file. + // ..... + USHORT PCIePowerSetting = 0; + /* code from windows, default value of rt30xxPowerMode = 0 + PCIePowerSetting = pAd->StaCfg.PSControl.field.rt30xxPowerMode; + */ + DBGPRINT(RT_DEBUG_TRACE, ("====> rt30xx Read PowerLevelMode = 0x%x.\n", PCIePowerSetting)); + // 2. Check EnableNewPS + /* + if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) + PCIePowerSetting = 1; + */ + + if ((pAd->MACVersion&0xffff) <= 0x0211) + { + // Chip Version E only allow 1 + PCIePowerSetting = 1; + DBGPRINT(RT_DEBUG_TRACE, ("====> rt30xx Write 0x83 Command = 0x%x.\n", PCIePowerSetting)); + AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSetting, 0x00); + } + else + { + // Chip Version F only allow 1 or 2 + if ((PCIePowerSetting > 2) || (PCIePowerSetting == 0)) + PCIePowerSetting = 1; + DBGPRINT(RT_DEBUG_TRACE, ("====> rt30xx Write 0x83 Command = 0x%x.\n", PCIePowerSetting)); + AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSetting, 0x00); + } + + } + + // Find Ralink PCIe Device's Express Capability Offset + pos = pci_find_capability(pObj->pci_dev, PCI_CAP_ID_EXP); + + if (pos != 0) + { + // Ralink PCIe Device's Link Control Register Offset + pAd->RLnkCtrlOffset = pos + PCI_EXP_LNKCTL; + pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, ®16); + Configuration = le2cpu16(reg16); + DBGPRINT(RT_DEBUG_TRACE, ("Read (Ralink PCIe Link Control Register) offset 0x%x = 0x%x\n", + pAd->RLnkCtrlOffset, Configuration)); + pAd->RLnkCtrlConfiguration = (Configuration & 0x103); + Configuration &= 0xfefc; + Configuration |= (0x0); + if ((pObj->DeviceID == NIC2860_PCIe_DEVICE_ID) + ||(pObj->DeviceID == NIC2790_PCIe_DEVICE_ID)) + { + reg16 = cpu2le16(Configuration); + pci_write_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, reg16); + DBGPRINT(RT_DEBUG_TRACE, ("Write (Ralink PCIe Link Control Register) offset 0x%x = 0x%x\n", + pos + PCI_EXP_LNKCTL, Configuration)); + } + + RTMPFindHostPCIDev(pAd); + if (pObj->parent_pci_dev) + { + USHORT vendor_id; + + pci_read_config_word(pObj->parent_pci_dev, PCI_VENDOR_ID, &vendor_id); + vendor_id = le2cpu16(vendor_id); + if (vendor_id == PCIBUS_INTEL_VENDOR) + bFindIntel = TRUE; + + // Find PCI-to-PCI Bridge Express Capability Offset + pos = pci_find_capability(pObj->parent_pci_dev, PCI_CAP_ID_EXP); + + if (pos != 0) + { + BOOLEAN bChange = FALSE; + // PCI-to-PCI Bridge Link Control Register Offset + pAd->HostLnkCtrlOffset = pos + PCI_EXP_LNKCTL; + pci_read_config_word(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, ®16); + Configuration = le2cpu16(reg16); + DBGPRINT(RT_DEBUG_TRACE, ("Read (Host PCI-to-PCI Bridge Link Control Register) offset 0x%x = 0x%x\n", + pAd->HostLnkCtrlOffset, Configuration)); + pAd->HostLnkCtrlConfiguration = (Configuration & 0x103); + Configuration &= 0xfefc; + Configuration |= (0x0); + + switch (pObj->DeviceID) + { + case NIC2860_PCIe_DEVICE_ID: + case NIC2790_PCIe_DEVICE_ID: + bChange = TRUE; + break; + default: + break; + } + + if (bChange) + { + reg16 = cpu2le16(Configuration); + pci_write_config_word(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, reg16); + DBGPRINT(RT_DEBUG_TRACE, ("Write (Host PCI-to-PCI Bridge Link Control Register) offset 0x%x = 0x%x\n", + pAd->HostLnkCtrlOffset, Configuration)); + } + } + else + { + pAd->HostLnkCtrlOffset = 0; + DBGPRINT(RT_DEBUG_ERROR, ("%s: cannot find PCI-to-PCI Bridge PCI Express Capability!\n", __func__)); + } + } + } + else + { + pAd->RLnkCtrlOffset = 0; + pAd->HostLnkCtrlOffset = 0; + DBGPRINT(RT_DEBUG_ERROR, ("%s: cannot find Ralink PCIe Device's PCI Express Capability!\n", __func__)); + } + + if (bFindIntel == FALSE) + { + DBGPRINT(RT_DEBUG_TRACE, ("Doesn't find Intel PCI host controller. \n")); + // Doesn't switch L0, L1, So set PCIePowerSaveLevel to 0xff + pAd->PCIePowerSaveLevel = 0xff; + if ((pAd->RLnkCtrlOffset != 0) + ) + { + pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, ®16); + Configuration = le2cpu16(reg16); + DBGPRINT(RT_DEBUG_TRACE, ("Read (Ralink 30xx PCIe Link Control Register) offset 0x%x = 0x%x\n", + pAd->RLnkCtrlOffset, Configuration)); + pAd->RLnkCtrlConfiguration = (Configuration & 0x103); + Configuration &= 0xfefc; + Configuration |= (0x0); + reg16 = cpu2le16(Configuration); + pci_write_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, reg16); + DBGPRINT(RT_DEBUG_TRACE, ("Write (Ralink PCIe Link Control Register) offset 0x%x = 0x%x\n", + pos + PCI_EXP_LNKCTL, Configuration)); + } + } +} + +VOID RTMPFindHostPCIDev( + IN PRTMP_ADAPTER pAd) +{ + USHORT reg16; + UCHAR reg8; + UINT DevFn; + PPCI_DEV pPci_dev; + POS_COOKIE pObj; + + pObj = (POS_COOKIE) pAd->OS_Cookie; + + if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + return; + + DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __func__)); + + pObj->parent_pci_dev = NULL; + if (pObj->pci_dev->bus->parent) + { + for (DevFn = 0; DevFn < 255; DevFn++) + { + pPci_dev = pci_get_slot(pObj->pci_dev->bus->parent, DevFn); + if (pPci_dev) + { + pci_read_config_word(pPci_dev, PCI_CLASS_DEVICE, ®16); + reg16 = le2cpu16(reg16); + pci_read_config_byte(pPci_dev, PCI_CB_CARD_BUS, ®8); + if ((reg16 == PCI_CLASS_BRIDGE_PCI) && + (reg8 == pObj->pci_dev->bus->number)) + { + pObj->parent_pci_dev = pPci_dev; + } + } + } + } +} + +/* + ======================================================================== + + Routine Description: + + Arguments: + Level = RESTORE_HALT : Restore PCI host and Ralink PCIe Link Control field to its default value. + Level = Other Value : Restore from dot11 power save or radio off status. And force PCI host Link Control fields to 0x1 + + ======================================================================== +*/ +VOID RTMPPCIeLinkCtrlValueRestore( + IN PRTMP_ADAPTER pAd, + IN UCHAR Level) +{ + USHORT PCIePowerSaveLevel, reg16; + USHORT Configuration; + POS_COOKIE pObj; + + pObj = (POS_COOKIE) pAd->OS_Cookie; + + if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + return; + + if (!((pObj->DeviceID == NIC2860_PCIe_DEVICE_ID) + ||(pObj->DeviceID == NIC2790_PCIe_DEVICE_ID))) + return; + + DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __func__)); + PCIePowerSaveLevel = pAd->PCIePowerSaveLevel; + if ((PCIePowerSaveLevel&0xff) == 0xff) + { + DBGPRINT(RT_DEBUG_TRACE,("return \n")); + return; + } + + if (pObj->parent_pci_dev && (pAd->HostLnkCtrlOffset != 0)) + { + PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, Configuration); + if ((Configuration != 0) && + (Configuration != 0xFFFF)) + { + Configuration &= 0xfefc; + // If call from interface down, restore to orginial setting. + if (Level == RESTORE_CLOSE) + { + Configuration |= pAd->HostLnkCtrlConfiguration; + } + else + Configuration |= 0x0; + PCI_REG_WIRTE_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, Configuration); + DBGPRINT(RT_DEBUG_TRACE, ("Restore PCI host : offset 0x%x = 0x%x\n", pAd->HostLnkCtrlOffset, Configuration)); + } + else + DBGPRINT(RT_DEBUG_ERROR, ("Restore PCI host : PCI_REG_READ_WORD failed (Configuration = 0x%x)\n", Configuration)); + } + + if (pObj->pci_dev && (pAd->RLnkCtrlOffset != 0)) + { + PCI_REG_READ_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, Configuration); + if ((Configuration != 0) && + (Configuration != 0xFFFF)) + { + Configuration &= 0xfefc; + // If call from interface down, restore to orginial setting. + if (Level == RESTORE_CLOSE) + Configuration |= pAd->RLnkCtrlConfiguration; + else + Configuration |= 0x0; + PCI_REG_WIRTE_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, Configuration); + DBGPRINT(RT_DEBUG_TRACE, ("Restore Ralink : offset 0x%x = 0x%x\n", pAd->RLnkCtrlOffset, Configuration)); + } + else + DBGPRINT(RT_DEBUG_ERROR, ("Restore Ralink : PCI_REG_READ_WORD failed (Configuration = 0x%x)\n", Configuration)); + } + + DBGPRINT(RT_DEBUG_TRACE,("%s <===\n", __func__)); +} + +/* + ======================================================================== + + Routine Description: + + Arguments: + Max : limit Host PCI and Ralink PCIe device's LINK CONTROL field's value. + Because now frequently set our device to mode 1 or mode 3 will cause problem. + + ======================================================================== +*/ +VOID RTMPPCIeLinkCtrlSetting( + IN PRTMP_ADAPTER pAd, + IN USHORT Max) +{ + USHORT PCIePowerSaveLevel, reg16; + USHORT Configuration; + POS_COOKIE pObj; + + pObj = (POS_COOKIE) pAd->OS_Cookie; + + if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + return; + + if (!((pObj->DeviceID == NIC2860_PCIe_DEVICE_ID) + ||(pObj->DeviceID == NIC2790_PCIe_DEVICE_ID))) + return; + + DBGPRINT(RT_DEBUG_TRACE,("%s===>\n", __func__)); + PCIePowerSaveLevel = pAd->PCIePowerSaveLevel; + if ((PCIePowerSaveLevel&0xff) == 0xff) + { + DBGPRINT(RT_DEBUG_TRACE,("return \n")); + return; + } + PCIePowerSaveLevel = PCIePowerSaveLevel>>6; + + + if (pObj->pci_dev && (pAd->RLnkCtrlOffset != 0)) + { + // first 2892 chip not allow to frequently set mode 3. will cause hang problem. + if (PCIePowerSaveLevel > Max) + PCIePowerSaveLevel = Max; + + PCI_REG_READ_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, Configuration); + Configuration |= 0x100; + PCI_REG_WIRTE_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, Configuration); + DBGPRINT(RT_DEBUG_TRACE, ("Write Ralink device : offset 0x%x = 0x%x\n", pAd->RLnkCtrlOffset, Configuration)); + } + + DBGPRINT(RT_DEBUG_TRACE,("RTMPPCIePowerLinkCtrl <==============\n")); +} diff --git a/drivers/staging/rt2860/rt2860.h b/drivers/staging/rt2860/rt2860.h deleted file mode 100644 index ed28fe5757c9..000000000000 --- a/drivers/staging/rt2860/rt2860.h +++ /dev/null @@ -1,333 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - */ - -#ifndef __RT2860_H__ -#define __RT2860_H__ - -#define RT28xx_CHIP_NAME "RT2860" - -#define TXINFO_SIZE 0 -#define TXPADDING_SIZE 0 - -/* ----------------- EEPROM Related MACRO ----------------- */ -#define RT28xx_EEPROM_READ16(pAd, offset, var) \ - var = RTMP_EEPROM_READ16(pAd, offset) - -#define RT28xx_EEPROM_WRITE16(pAd, offset, var) \ - RTMP_EEPROM_WRITE16(pAd, offset, var) - -/* ----------------- TASK/THREAD Related MACRO ----------------- */ -#define RT28XX_TASK_THREAD_INIT(pAd, Status) \ - init_thread_task(pAd); NICInitTxRxRingAndBacklogQueue(pAd); \ - Status = NDIS_STATUS_SUCCESS; - -/* function declarations */ -#define IRQ_HANDLE_TYPE irqreturn_t - -IRQ_HANDLE_TYPE -rt2860_interrupt(int irq, void *dev_instance); - -/* ----------------- Frimware Related MACRO ----------------- */ -#define RT28XX_WRITE_FIRMWARE(_pAd, _pFwImage, _FwLen) \ - do{ \ - ULONG _i, _firm; \ - RTMP_IO_WRITE32(_pAd, PBF_SYS_CTRL, 0x10000); \ - \ - for(_i=0; _i<_FwLen; _i+=4) \ - { \ - _firm = _pFwImage[_i] + \ - (_pFwImage[_i+3] << 24) + \ - (_pFwImage[_i+2] << 16) + \ - (_pFwImage[_i+1] << 8); \ - RTMP_IO_WRITE32(_pAd, FIRMWARE_IMAGE_BASE + _i, _firm); \ - } \ - RTMP_IO_WRITE32(_pAd, PBF_SYS_CTRL, 0x00000); \ - RTMP_IO_WRITE32(_pAd, PBF_SYS_CTRL, 0x00001); \ - \ - /* initialize BBP R/W access agent */ \ - RTMP_IO_WRITE32(_pAd, H2M_BBP_AGENT, 0); \ - RTMP_IO_WRITE32(_pAd, H2M_MAILBOX_CSR, 0); \ - }while(0) - -/* ----------------- TX Related MACRO ----------------- */ -#define RT28XX_START_DEQUEUE(pAd, QueIdx, irqFlags) do{}while(0) -#define RT28XX_STOP_DEQUEUE(pAd, QueIdx, irqFlags) do{}while(0) - - -#define RT28XX_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, freeNum, pPacket) \ - ((freeNum) >= (ULONG)(pTxBlk->TotalFragNum + RTMP_GET_PACKET_FRAGMENTS(pPacket) + 3)) /* rough estimate we will use 3 more descriptor. */ -#define RT28XX_RELEASE_DESC_RESOURCE(pAd, QueIdx) \ - do{}while(0) - -#define NEED_QUEUE_BACK_FOR_AGG(pAd, QueIdx, freeNum, _TxFrameType) \ - (((freeNum != (TX_RING_SIZE-1)) && (pAd->TxSwQueue[QueIdx].Number == 0)) || (freeNum<3)) - //(((freeNum) != (TX_RING_SIZE-1)) && (pAd->TxSwQueue[QueIdx].Number == 1 /*0*/)) - - -#define HAL_KickOutMgmtTx(_pAd, _QueIdx, _pPacket, _pSrcBufVA, _SrcBufLen) \ - RtmpPCIMgmtKickOut(_pAd, _QueIdx, _pPacket, _pSrcBufVA, _SrcBufLen) - -#define RTMP_PKT_TAIL_PADDING 0 - -#define fRTMP_ADAPTER_NEED_STOP_TX 0 - -#define HAL_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) \ - /* RtmpPCI_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber)*/ - -#define HAL_WriteTxResource(pAd, pTxBlk,bIsLast, pFreeNumber) \ - RtmpPCI_WriteSingleTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) - -#define HAL_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber) \ - RtmpPCI_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber) - -#define HAL_WriteMultiTxResource(pAd, pTxBlk,frameNum, pFreeNumber) \ - RtmpPCI_WriteMultiTxResource(pAd, pTxBlk, frameNum, pFreeNumber) - -#define HAL_FinalWriteTxResource(_pAd, _pTxBlk, _TotalMPDUSize, _FirstTxIdx) \ - RtmpPCI_FinalWriteTxResource(_pAd, _pTxBlk, _TotalMPDUSize, _FirstTxIdx) - -#define HAL_LastTxIdx(_pAd, _QueIdx,_LastTxIdx) \ - /*RtmpPCIDataLastTxIdx(_pAd, _QueIdx,_LastTxIdx)*/ - -#define HAL_KickOutTx(_pAd, _pTxBlk, _QueIdx) \ - RTMP_IO_WRITE32((_pAd), TX_CTX_IDX0+((_QueIdx)*0x10), (_pAd)->TxRing[(_QueIdx)].TxCpuIdx) -/* RtmpPCIDataKickOut(_pAd, _pTxBlk, _QueIdx)*/ - -#define HAL_KickOutNullFrameTx(_pAd, _QueIdx, _pNullFrame, _frameLen) \ - MiniportMMRequest(_pAd, _QueIdx, _pNullFrame, _frameLen) - -#define GET_TXRING_FREENO(_pAd, _QueIdx) \ - (_pAd->TxRing[_QueIdx].TxSwFreeIdx > _pAd->TxRing[_QueIdx].TxCpuIdx) ? \ - (_pAd->TxRing[_QueIdx].TxSwFreeIdx - _pAd->TxRing[_QueIdx].TxCpuIdx - 1) \ - : \ - (_pAd->TxRing[_QueIdx].TxSwFreeIdx + TX_RING_SIZE - _pAd->TxRing[_QueIdx].TxCpuIdx - 1); - - -#define GET_MGMTRING_FREENO(_pAd) \ - (_pAd->MgmtRing.TxSwFreeIdx > _pAd->MgmtRing.TxCpuIdx) ? \ - (_pAd->MgmtRing.TxSwFreeIdx - _pAd->MgmtRing.TxCpuIdx - 1) \ - : \ - (_pAd->MgmtRing.TxSwFreeIdx + MGMT_RING_SIZE - _pAd->MgmtRing.TxCpuIdx - 1); - - -/* ----------------- RX Related MACRO ----------------- */ - -// no use -#define RT28XX_RCV_PKT_GET_INIT(pAd) -#define RT28XX_RV_A_BUF_END -//#define RT28XX_RV_ALL_BUF_END - - -/* ----------------- ASIC Related MACRO ----------------- */ -// no use -#define RT28XX_DMA_POST_WRITE(pAd) - -// reset MAC of a station entry to 0x000000000000 -#define RT28XX_STA_ENTRY_MAC_RESET(pAd, Wcid) \ - AsicDelWcidTab(pAd, Wcid); - -// add this entry into ASIC RX WCID search table -#define RT28XX_STA_ENTRY_ADD(pAd, pEntry) \ - AsicUpdateRxWCIDTable(pAd, pEntry->Aid, pEntry->Addr); - -// remove Pair-wise key material from ASIC -#define RT28XX_STA_ENTRY_KEY_DEL(pAd, BssIdx, Wcid) \ - AsicRemovePairwiseKeyEntry(pAd, BssIdx, (UCHAR)Wcid); - -// add Client security information into ASIC WCID table and IVEIV table -#define RT28XX_STA_SECURITY_INFO_ADD(pAd, apidx, KeyID, pEntry) \ - RTMPAddWcidAttributeEntry(pAd, apidx, KeyID, \ - pAd->SharedKey[apidx][KeyID].CipherAlg, pEntry); - -#define RT28XX_SECURITY_KEY_ADD(pAd, apidx, KeyID, pEntry) \ - { /* update pairwise key information to ASIC Shared Key Table */ \ - AsicAddSharedKeyEntry(pAd, apidx, KeyID, \ - pAd->SharedKey[apidx][KeyID].CipherAlg, \ - pAd->SharedKey[apidx][KeyID].Key, \ - pAd->SharedKey[apidx][KeyID].TxMic, \ - pAd->SharedKey[apidx][KeyID].RxMic); \ - /* update ASIC WCID attribute table and IVEIV table */ \ - RTMPAddWcidAttributeEntry(pAd, apidx, KeyID, \ - pAd->SharedKey[apidx][KeyID].CipherAlg, \ - pEntry); } - - -// Insert the BA bitmap to ASIC for the Wcid entry -#define RT28XX_ADD_BA_SESSION_TO_ASIC(_pAd, _Aid, _TID) \ - do{ \ - UINT32 _Value = 0, _Offset; \ - _Offset = MAC_WCID_BASE + (_Aid) * HW_WCID_ENTRY_SIZE + 4; \ - RTMP_IO_READ32((_pAd), _Offset, &_Value); \ - _Value |= (0x10000<<(_TID)); \ - RTMP_IO_WRITE32((_pAd), _Offset, _Value); \ - }while(0) - - -// Remove the BA bitmap from ASIC for the Wcid entry -// bitmap field starts at 0x10000 in ASIC WCID table -#define RT28XX_DEL_BA_SESSION_FROM_ASIC(_pAd, _Wcid, _TID) \ - do{ \ - UINT32 _Value = 0, _Offset; \ - _Offset = MAC_WCID_BASE + (_Wcid) * HW_WCID_ENTRY_SIZE + 4; \ - RTMP_IO_READ32((_pAd), _Offset, &_Value); \ - _Value &= (~(0x10000 << (_TID))); \ - RTMP_IO_WRITE32((_pAd), _Offset, _Value); \ - }while(0) - - -/* ----------------- PCI/USB Related MACRO ----------------- */ - -#define RT28XX_HANDLE_DEV_ASSIGN(handle, dev_p) \ - ((POS_COOKIE)handle)->pci_dev = dev_p; - -// set driver data -#define RT28XX_DRVDATA_SET(_a) pci_set_drvdata(_a, net_dev); - -#define RT28XX_UNMAP() \ -{ if (net_dev->base_addr) { \ - iounmap((void *)(net_dev->base_addr)); \ - release_mem_region(pci_resource_start(dev_p, 0), \ - pci_resource_len(dev_p, 0)); } \ - if (net_dev->irq) pci_release_regions(dev_p); } - -#ifdef PCI_MSI_SUPPORT -#define RTMP_MSI_ENABLE(_pAd) \ -{ POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \ - (_pAd)->HaveMsi = pci_enable_msi(_pObj->pci_dev) == 0 ? TRUE : FALSE; } - -#define RTMP_MSI_DISABLE(_pAd) \ -{ POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \ - if (_pAd->HaveMsi == TRUE) \ - pci_disable_msi(_pObj->pci_dev); \ - _pAd->HaveMsi = FALSE; } -#else -#define RTMP_MSI_ENABLE(_pAd) -#define RTMP_MSI_DISABLE(_pAd) -#endif // PCI_MSI_SUPPORT // - -#define SA_SHIRQ IRQF_SHARED - -#define RT28XX_IRQ_REQUEST(net_dev) \ -{ PRTMP_ADAPTER _pAd = (PRTMP_ADAPTER)((net_dev)->ml_priv); \ - POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \ - RTMP_MSI_ENABLE(_pAd); \ - if ((retval = request_irq(_pObj->pci_dev->irq, \ - rt2860_interrupt, SA_SHIRQ, \ - (net_dev)->name, (net_dev)))) { \ - printk("RT2860: request_irq ERROR(%d)\n", retval); \ - return retval; } } - -#define RT28XX_IRQ_RELEASE(net_dev) \ -{ PRTMP_ADAPTER _pAd = (PRTMP_ADAPTER)((net_dev)->ml_priv); \ - POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \ - synchronize_irq(_pObj->pci_dev->irq); \ - free_irq(_pObj->pci_dev->irq, (net_dev)); \ - RTMP_MSI_DISABLE(_pAd); } - -#define RT28XX_IRQ_INIT(pAd) \ - { pAd->int_enable_reg = ((DELAYINTMASK) | \ - (RxINT|TxDataInt|TxMgmtInt)) & ~(0x03); \ - pAd->int_disable_mask = 0; \ - pAd->int_pending = 0; } - -#define RT28XX_IRQ_ENABLE(pAd) \ - { /* clear garbage ints */ \ - RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, 0xffffffff); \ - NICEnableInterrupt(pAd); } - -#define RT28XX_PUT_DEVICE(dev_p) - - -/* ----------------- MLME Related MACRO ----------------- */ -#define RT28XX_MLME_HANDLER(pAd) MlmeHandler(pAd) - -#define RT28XX_MLME_PRE_SANITY_CHECK(pAd) - -#define RT28XX_MLME_STA_QUICK_RSP_WAKE_UP(pAd) \ - RTMPSetTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, 100); - -#define RT28XX_MLME_RESET_STATE_MACHINE(pAd) \ - MlmeRestartStateMachine(pAd) - -#define RT28XX_HANDLE_COUNTER_MEASURE(_pAd, _pEntry) \ - HandleCounterMeasure(_pAd, _pEntry) - -/* ----------------- Power Save Related MACRO ----------------- */ -#define RT28XX_PS_POLL_ENQUEUE(pAd) EnqueuePsPoll(pAd) - -// -// Device ID & Vendor ID, these values should match EEPROM value -// -#define NIC2860_PCI_DEVICE_ID 0x0601 -#define NIC2860_PCIe_DEVICE_ID 0x0681 -#define NIC2760_PCI_DEVICE_ID 0x0701 // 1T/2R Cardbus ??? -#define NIC2790_PCIe_DEVICE_ID 0x0781 // 1T/2R miniCard - -#define NIC_PCI_VENDOR_ID 0x1814 - -#define VEN_AWT_PCIe_DEVICE_ID 0x1059 -#define VEN_AWT_PCI_VENDOR_ID 0x1A3B - -#define EDIMAX_PCI_VENDOR_ID 0x1432 - -// For RTMPPCIePowerLinkCtrlRestore () function -#define RESTORE_HALT 1 -#define RESTORE_WAKEUP 2 -#define RESTORE_CLOSE 3 - -#define PowerSafeCID 1 -#define PowerRadioOffCID 2 -#define PowerWakeCID 3 -#define CID0MASK 0x000000ff -#define CID1MASK 0x0000ff00 -#define CID2MASK 0x00ff0000 -#define CID3MASK 0xff000000 - -#define PCI_REG_READ_WORD(pci_dev, offset, Configuration) \ - if (pci_read_config_word(pci_dev, offset, ®16) == 0) \ - Configuration = le2cpu16(reg16); \ - else \ - Configuration = 0; - -#define PCI_REG_WIRTE_WORD(pci_dev, offset, Configuration) \ - reg16 = cpu2le16(Configuration); \ - pci_write_config_word(pci_dev, offset, reg16); \ - -#define RT28XX_STA_FORCE_WAKEUP(pAd, Level) \ - RT28xxPciStaAsicForceWakeup(pAd, Level); - -#define RT28XX_STA_SLEEP_THEN_AUTO_WAKEUP(pAd, TbttNumToNextWakeUp) \ - RT28xxPciStaAsicSleepThenAutoWakeup(pAd, TbttNumToNextWakeUp); - -#define RT28XX_MLME_RADIO_ON(pAd) \ - RT28xxPciMlmeRadioOn(pAd); - -#define RT28XX_MLME_RADIO_OFF(pAd) \ - RT28xxPciMlmeRadioOFF(pAd); - -#endif //__RT2860_H__ - diff --git a/drivers/staging/rt2860/rt_config.h b/drivers/staging/rt2860/rt_config.h index 2093a80b19df..67b957b271e9 100644 --- a/drivers/staging/rt2860/rt_config.h +++ b/drivers/staging/rt2860/rt_config.h @@ -41,29 +41,37 @@ #define __RT_CONFIG_H__ #include "rtmp_type.h" -#ifdef LINUX -#include "rt_linux.h" -#endif -#include "rtmp_def.h" -#include "rt28xx.h" +#include "rtmp_os.h" -#ifdef RT2860 -#include "rt2860.h" -#endif -#ifdef RT2870 -#include "../rt2870/rt2870.h" -#endif // RT2870 // +#include "rtmp_def.h" +#include "rtmp_chip.h" +#include "rtmp_timer.h" #include "oid.h" #include "mlme.h" #include "wpa.h" -#include "md5.h" +#include "crypt_md5.h" +#include "crypt_sha2.h" +#include "crypt_hmac.h" #include "rtmp.h" #include "ap.h" #include "dfs.h" #include "chlist.h" #include "spectrum.h" +#include "eeprom.h" +#if defined(RTMP_PCI_SUPPORT) || defined(RTMP_USB_SUPPORT) +#include "rtmp_mcu.h" +#endif + +#undef AP_WSC_INCLUDED +#undef STA_WSC_INCLUDED +#undef WSC_INCLUDED + + + + + #ifdef IGMP_SNOOP_SUPPORT #include "igmp_snoop.h" #endif // IGMP_SNOOP_SUPPORT // diff --git a/drivers/staging/rt2860/rt_linux.c b/drivers/staging/rt2860/rt_linux.c index ed27b8545a1b..940b3851f145 100644 --- a/drivers/staging/rt2860/rt_linux.c +++ b/drivers/staging/rt2860/rt_linux.c @@ -30,27 +30,6 @@ ULONG RTDebugLevel = RT_DEBUG_ERROR; -BUILD_TIMER_FUNCTION(MlmePeriodicExec); -BUILD_TIMER_FUNCTION(AsicRxAntEvalTimeout); -BUILD_TIMER_FUNCTION(APSDPeriodicExec); -BUILD_TIMER_FUNCTION(AsicRfTuningExec); -#ifdef RT2870 -BUILD_TIMER_FUNCTION(BeaconUpdateExec); -#endif // RT2870 // - -BUILD_TIMER_FUNCTION(BeaconTimeout); -BUILD_TIMER_FUNCTION(ScanTimeout); -BUILD_TIMER_FUNCTION(AuthTimeout); -BUILD_TIMER_FUNCTION(AssocTimeout); -BUILD_TIMER_FUNCTION(ReassocTimeout); -BUILD_TIMER_FUNCTION(DisassocTimeout); -BUILD_TIMER_FUNCTION(LinkDownExec); -BUILD_TIMER_FUNCTION(StaQuickResponeForRateUpExec); -BUILD_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc); -#ifdef RT2860 -BUILD_TIMER_FUNCTION(PsPollWakeExec); -BUILD_TIMER_FUNCTION(RadioOnExec); -#endif // for wireless system event message char const *pWirelessSysEventText[IW_SYS_EVENT_TYPE_NUM] = { @@ -106,7 +85,7 @@ VOID RTMP_SetPeriodicTimer( IN NDIS_MINIPORT_TIMER *pTimer, IN unsigned long timeout) { - timeout = ((timeout*HZ) / 1000); + timeout = ((timeout*OS_HZ) / 1000); pTimer->expires = jiffies + timeout; add_timer(pTimer); } @@ -131,7 +110,7 @@ VOID RTMP_OS_Add_Timer( if (timer_pending(pTimer)) return; - timeout = ((timeout*HZ) / 1000); + timeout = ((timeout*OS_HZ) / 1000); pTimer->expires = jiffies + timeout; add_timer(pTimer); } @@ -140,7 +119,7 @@ VOID RTMP_OS_Mod_Timer( IN NDIS_MINIPORT_TIMER *pTimer, IN unsigned long timeout) { - timeout = ((timeout*HZ) / 1000); + timeout = ((timeout*OS_HZ) / 1000); mod_timer(pTimer, jiffies + timeout); } @@ -186,8 +165,8 @@ void RTMP_GetCurrentSystemTime(LARGE_INTEGER *time) // pAd MUST allow to be NULL NDIS_STATUS os_alloc_mem( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR *mem, + IN RTMP_ADAPTER *pAd, + OUT UCHAR **mem, IN ULONG size) { *mem = (PUCHAR) kmalloc(size, GFP_ATOMIC); @@ -200,7 +179,7 @@ NDIS_STATUS os_alloc_mem( // pAd MUST allow to be NULL NDIS_STATUS os_free_mem( IN PRTMP_ADAPTER pAd, - IN PUCHAR mem) + IN PVOID mem) { ASSERT(mem); @@ -209,6 +188,20 @@ NDIS_STATUS os_free_mem( } + + +PNDIS_PACKET RtmpOSNetPktAlloc( + IN RTMP_ADAPTER *pAd, + IN int size) +{ + struct sk_buff *skb; + /* Add 2 more bytes for ip header alignment*/ + skb = dev_alloc_skb(size+2); + + return ((PNDIS_PACKET)skb); +} + + PNDIS_PACKET RTMP_AllocateFragPacketBuffer( IN PRTMP_ADAPTER pAd, IN ULONG Length) @@ -283,13 +276,16 @@ VOID RTMPFreeAdapter( os_cookie=(POS_COOKIE)pAd->OS_Cookie; + if (pAd->BeaconBuf) kfree(pAd->BeaconBuf); NdisFreeSpinLock(&pAd->MgmtRingLock); -#ifdef RT2860 + +#ifdef RTMP_MAC_PCI NdisFreeSpinLock(&pAd->RxRingLock); -#endif +#endif // RTMP_MAC_PCI // + for (index =0 ; index < NUM_OF_TX_RING; index++) { NdisFreeSpinLock(&pAd->TxSwQueueLock[index]); @@ -299,7 +295,9 @@ VOID RTMPFreeAdapter( NdisFreeSpinLock(&pAd->irq_lock); + vfree(pAd); // pci_free_consistent(os_cookie->pci_dev,sizeof(RTMP_ADAPTER),pAd,os_cookie->pAd_pa); + if (os_cookie) kfree(os_cookie); } @@ -379,7 +377,7 @@ NDIS_STATUS RTMPAllocateNdisPacket( ASSERT(DataLen); // 1. Allocate a packet - pPacket = (PNDIS_PACKET *) dev_alloc_skb(HeaderLen + DataLen + TXPADDING_SIZE); + pPacket = (PNDIS_PACKET *) dev_alloc_skb(HeaderLen + DataLen + RTMP_PKT_TAIL_PADDING); if (pPacket == NULL) { *ppPacket = NULL; @@ -442,7 +440,7 @@ void RTMP_QueryPacketInfo( OUT UINT *pSrcBufLen) { pPacketInfo->BufferCount = 1; - pPacketInfo->pFirstBuffer = GET_OS_PKT_DATAPTR(pPacket); + pPacketInfo->pFirstBuffer = (PNDIS_BUFFER)GET_OS_PKT_DATAPTR(pPacket); pPacketInfo->PhysicalBufferCount = 1; pPacketInfo->TotalPacketLength = GET_OS_PKT_LEN(pPacket); @@ -464,7 +462,7 @@ void RTMP_QueryNextPacketInfo( if (pPacket) { pPacketInfo->BufferCount = 1; - pPacketInfo->pFirstBuffer = GET_OS_PKT_DATAPTR(pPacket); + pPacketInfo->pFirstBuffer = (PNDIS_BUFFER)GET_OS_PKT_DATAPTR(pPacket); pPacketInfo->PhysicalBufferCount = 1; pPacketInfo->TotalPacketLength = GET_OS_PKT_LEN(pPacket); @@ -485,18 +483,6 @@ void RTMP_QueryNextPacketInfo( } } -// not yet support MBSS -PNET_DEV get_netdev_from_bssid( - IN PRTMP_ADAPTER pAd, - IN UCHAR FromWhichBSSID) -{ - PNET_DEV dev_p = NULL; - - dev_p = pAd->net_dev; - - ASSERT(dev_p); - return dev_p; /* return one of MBSS */ -} PNDIS_PACKET DuplicatePacket( IN PRTMP_ADAPTER pAd, @@ -538,9 +524,9 @@ PNDIS_PACKET duplicate_pkt( if ((skb = __dev_alloc_skb(HdrLen + DataSize + 2, MEM_ALLOC_FLAG)) != NULL) { skb_reserve(skb, 2); - NdisMoveMemory(skb_tail_pointer(skb), pHeader802_3, HdrLen); + NdisMoveMemory(skb->tail, pHeader802_3, HdrLen); skb_put(skb, HdrLen); - NdisMoveMemory(skb_tail_pointer(skb), pData, DataSize); + NdisMoveMemory(skb->tail, pData, DataSize); skb_put(skb, DataSize); skb->dev = get_netdev_from_bssid(pAd, FromWhichBSSID); pPacket = OSPKT_TO_RTPKT(skb); @@ -649,7 +635,9 @@ void wlan_802_11_to_802_3_packet( // NdisMoveMemory(skb_push(pOSPkt, LENGTH_802_3), pHeader802_3, LENGTH_802_3); -} + } + + void announce_802_3_packet( IN PRTMP_ADAPTER pAd, @@ -726,8 +714,8 @@ VOID RTMPSendWirelessEvent( IN CHAR Rssi) { - union iwreq_data wrqu; - PUCHAR pBuf = NULL, pBufPtr = NULL; + //union iwreq_data wrqu; + PSTRING pBuf = NULL, pBufPtr = NULL; USHORT event, type, BufLen; UCHAR event_table_len = 0; @@ -788,13 +776,7 @@ VOID RTMPSendWirelessEvent( pBufPtr[pBufPtr - pBuf] = '\0'; BufLen = pBufPtr - pBuf; - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.data.flags = Event_flag; - wrqu.data.length = BufLen; - - //send wireless event - wireless_send_event(pAd->net_dev, IWEVCUSTOM, &wrqu, pBuf); - + RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, Event_flag, NULL, (PUCHAR)pBuf, BufLen); //DBGPRINT(RT_DEBUG_TRACE, ("%s : %s\n", __func__, pBuf)); kfree(pBuf); @@ -896,7 +878,7 @@ void send_monitor_packets( ph->msgcode = DIDmsg_lnxind_wlansniffrm; ph->msglen = sizeof(wlan_ng_prism2_header); - strcpy(ph->devname, pAd->net_dev->name); + strcpy((PSTRING) ph->devname, (PSTRING) pAd->net_dev->name); ph->hosttime.did = DIDmsg_lnxind_wlansniffrm_hosttime; ph->hosttime.status = 0; @@ -972,18 +954,275 @@ err_free_sk_buff: } -void rtmp_os_thread_init(PUCHAR pThreadName, PVOID pNotify) + +/******************************************************************************* + + Device IRQ related functions. + + *******************************************************************************/ +int RtmpOSIRQRequest(IN PNET_DEV pNetDev) +{ + struct net_device *net_dev = pNetDev; + PRTMP_ADAPTER pAd = NULL; + int retval = 0; + + GET_PAD_FROM_NET_DEV(pAd, pNetDev); + + ASSERT(pAd); + +#ifdef RTMP_PCI_SUPPORT + if (pAd->infType == RTMP_DEV_INF_PCI) + { + POS_COOKIE _pObj = (POS_COOKIE)(pAd->OS_Cookie); + RTMP_MSI_ENABLE(pAd); + retval = request_irq(_pObj->pci_dev->irq, rt2860_interrupt, SA_SHIRQ, (net_dev)->name, (net_dev)); + if (retval != 0) + printk("RT2860: request_irq ERROR(%d)\n", retval); + } +#endif // RTMP_PCI_SUPPORT // + + + return retval; + +} + + +int RtmpOSIRQRelease(IN PNET_DEV pNetDev) { - daemonize(pThreadName /*"%s",pAd->net_dev->name*/); + struct net_device *net_dev = pNetDev; + PRTMP_ADAPTER pAd = NULL; + + GET_PAD_FROM_NET_DEV(pAd, net_dev); + + ASSERT(pAd); + +#ifdef RTMP_PCI_SUPPORT + if (pAd->infType == RTMP_DEV_INF_PCI) + { + POS_COOKIE pObj = (POS_COOKIE)(pAd->OS_Cookie); + synchronize_irq(pObj->pci_dev->irq); + free_irq(pObj->pci_dev->irq, (net_dev)); + RTMP_MSI_DISABLE(pAd); + } +#endif // RTMP_PCI_SUPPORT // + + + return 0; +} + + +/******************************************************************************* + + File open/close related functions. + + *******************************************************************************/ +RTMP_OS_FD RtmpOSFileOpen(char *pPath, int flag, int mode) +{ + struct file *filePtr; + + filePtr = filp_open(pPath, flag, 0); + if (IS_ERR(filePtr)) + { + DBGPRINT(RT_DEBUG_ERROR, ("%s(): Error %ld opening %s\n", __func__, -PTR_ERR(filePtr), pPath)); + } + + return (RTMP_OS_FD)filePtr; +} + +int RtmpOSFileClose(RTMP_OS_FD osfd) +{ + filp_close(osfd, NULL); + return 0; +} + + +void RtmpOSFileSeek(RTMP_OS_FD osfd, int offset) +{ + osfd->f_pos = offset; +} + + +int RtmpOSFileRead(RTMP_OS_FD osfd, char *pDataPtr, int readLen) +{ + // The object must have a read method + if (osfd->f_op && osfd->f_op->read) + { + return osfd->f_op->read(osfd, pDataPtr, readLen, &osfd->f_pos); + } + else + { + DBGPRINT(RT_DEBUG_ERROR, ("no file read method\n")); + return -1; + } +} + + +int RtmpOSFileWrite(RTMP_OS_FD osfd, char *pDataPtr, int writeLen) +{ + return osfd->f_op->write(osfd, pDataPtr, (size_t)writeLen, &osfd->f_pos); +} + + +void RtmpOSFSInfoChange(RTMP_OS_FS_INFO *pOSFSInfo, BOOLEAN bSet) +{ + if (bSet) + { + // Save uid and gid used for filesystem access. + // Set user and group to 0 (root) + pOSFSInfo->fsuid = current_fsuid(); + pOSFSInfo->fsgid = current_fsgid(); + pOSFSInfo->fs = get_fs(); + set_fs(KERNEL_DS); + } + else + { + set_fs(pOSFSInfo->fs); + } +} + + + +/******************************************************************************* + + Task create/management/kill related functions. + + *******************************************************************************/ +NDIS_STATUS RtmpOSTaskKill( + IN RTMP_OS_TASK *pTask) +{ + RTMP_ADAPTER *pAd; + int ret = NDIS_STATUS_FAILURE; + + pAd = (RTMP_ADAPTER *)pTask->priv; + +#ifdef KTHREAD_SUPPORT + if (pTask->kthread_task) + { + kthread_stop(pTask->kthread_task); + ret = NDIS_STATUS_SUCCESS; + } +#else + CHECK_PID_LEGALITY(pTask->taskPID) + { + printk("Terminate the task(%s) with pid(%d)!\n", pTask->taskName, GET_PID_NUMBER(pTask->taskPID)); + mb(); + pTask->task_killed = 1; + mb(); + ret = KILL_THREAD_PID(pTask->taskPID, SIGTERM, 1); + if (ret) + { + printk(KERN_WARNING "kill task(%s) with pid(%d) failed(retVal=%d)!\n", + pTask->taskName, GET_PID_NUMBER(pTask->taskPID), ret); + } + else + { + wait_for_completion(&pTask->taskComplete); + pTask->taskPID = THREAD_PID_INIT_VALUE; + pTask->task_killed = 0; + ret = NDIS_STATUS_SUCCESS; + } + } +#endif + + return ret; + +} + + +INT RtmpOSTaskNotifyToExit( + IN RTMP_OS_TASK *pTask) +{ + +#ifndef KTHREAD_SUPPORT + complete_and_exit(&pTask->taskComplete, 0); +#endif + + return 0; +} + + +void RtmpOSTaskCustomize( + IN RTMP_OS_TASK *pTask) +{ + +#ifndef KTHREAD_SUPPORT + + daemonize((PSTRING)&pTask->taskName[0]/*"%s",pAd->net_dev->name*/); allow_signal(SIGTERM); allow_signal(SIGKILL); current->flags |= PF_NOFREEZE; /* signal that we've started the thread */ - complete(pNotify); + complete(&pTask->taskComplete); + +#endif } + +NDIS_STATUS RtmpOSTaskAttach( + IN RTMP_OS_TASK *pTask, + IN int (*fn)(void *), + IN void *arg) +{ + NDIS_STATUS status = NDIS_STATUS_SUCCESS; + pid_t pid_number = -1; + +#ifdef KTHREAD_SUPPORT + pTask->task_killed = 0; + pTask->kthread_task = NULL; + pTask->kthread_task = kthread_run(fn, arg, pTask->taskName); + if (IS_ERR(pTask->kthread_task)) + status = NDIS_STATUS_FAILURE; +#else + pid_number = kernel_thread(fn, arg, RTMP_OS_MGMT_TASK_FLAGS); + if (pid_number < 0) + { + DBGPRINT (RT_DEBUG_ERROR, ("Attach task(%s) failed!\n", pTask->taskName)); + status = NDIS_STATUS_FAILURE; + } + else + { + pTask->taskPID = GET_PID(pid_number); + + // Wait for the thread to start + wait_for_completion(&pTask->taskComplete); + status = NDIS_STATUS_SUCCESS; + } +#endif + return status; +} + + +NDIS_STATUS RtmpOSTaskInit( + IN RTMP_OS_TASK *pTask, + IN PSTRING pTaskName, + IN VOID *pPriv) +{ + int len; + + ASSERT(pTask); + +#ifndef KTHREAD_SUPPORT + NdisZeroMemory((PUCHAR)(pTask), sizeof(RTMP_OS_TASK)); +#endif + + len = strlen(pTaskName); + len = len > (RTMP_OS_TASK_NAME_LEN -1) ? (RTMP_OS_TASK_NAME_LEN-1) : len; + NdisMoveMemory(&pTask->taskName[0], pTaskName, len); + pTask->priv = pPriv; + +#ifndef KTHREAD_SUPPORT + RTMP_SEM_EVENT_INIT_LOCKED(&(pTask->taskSema)); + pTask->taskPID = THREAD_PID_INIT_VALUE; + + init_completion (&pTask->taskComplete); +#endif + + return NDIS_STATUS_SUCCESS; +} + + void RTMP_IndicateMediaState( IN PRTMP_ADAPTER pAd) { @@ -1000,3 +1239,259 @@ void RTMP_IndicateMediaState( } } +int RtmpOSWrielessEventSend( + IN RTMP_ADAPTER *pAd, + IN UINT32 eventType, + IN INT flags, + IN PUCHAR pSrcMac, + IN PUCHAR pData, + IN UINT32 dataLen) +{ + union iwreq_data wrqu; + + memset(&wrqu, 0, sizeof(wrqu)); + + if (flags>-1) + wrqu.data.flags = flags; + + if (pSrcMac) + memcpy(wrqu.ap_addr.sa_data, pSrcMac, MAC_ADDR_LEN); + + if ((pData!= NULL) && (dataLen > 0)) + wrqu.data.length = dataLen; + + wireless_send_event(pAd->net_dev, eventType, &wrqu, (char *)pData); + return 0; +} + + +int RtmpOSNetDevAddrSet( + IN PNET_DEV pNetDev, + IN PUCHAR pMacAddr) +{ + struct net_device *net_dev; + RTMP_ADAPTER *pAd; + + net_dev = pNetDev; + GET_PAD_FROM_NET_DEV(pAd, net_dev); + + // work-around for the SuSE due to it has it's own interface name management system. + { + NdisZeroMemory(pAd->StaCfg.dev_name, 16); + NdisMoveMemory(pAd->StaCfg.dev_name, net_dev->name, strlen(net_dev->name)); + } + + NdisMoveMemory(net_dev->dev_addr, pMacAddr, 6); + + return 0; +} + + + +/* + * Assign the network dev name for created Ralink WiFi interface. + */ +static int RtmpOSNetDevRequestName( + IN RTMP_ADAPTER *pAd, + IN PNET_DEV dev, + IN PSTRING pPrefixStr, + IN INT devIdx) +{ + PNET_DEV existNetDev; + STRING suffixName[IFNAMSIZ]; + STRING desiredName[IFNAMSIZ]; + int ifNameIdx, prefixLen, slotNameLen; + int Status; + + + prefixLen = strlen(pPrefixStr); + ASSERT((prefixLen < IFNAMSIZ)); + + for (ifNameIdx = devIdx; ifNameIdx < 32; ifNameIdx++) + { + memset(suffixName, 0, IFNAMSIZ); + memset(desiredName, 0, IFNAMSIZ); + strncpy(&desiredName[0], pPrefixStr, prefixLen); + + sprintf(suffixName, "%d", ifNameIdx); + + slotNameLen = strlen(suffixName); + ASSERT(((slotNameLen + prefixLen) < IFNAMSIZ)); + strcat(desiredName, suffixName); + + existNetDev = RtmpOSNetDevGetByName(dev, &desiredName[0]); + if (existNetDev == NULL) + break; + else + RtmpOSNetDeviceRefPut(existNetDev); + } + + if(ifNameIdx < 32) + { + strcpy(&dev->name[0], &desiredName[0]); + Status = NDIS_STATUS_SUCCESS; + } + else + { + DBGPRINT(RT_DEBUG_ERROR, + ("Cannot request DevName with preifx(%s) and in range(0~32) as suffix from OS!\n", pPrefixStr)); + Status = NDIS_STATUS_FAILURE; + } + + return Status; +} + + +void RtmpOSNetDevClose( + IN PNET_DEV pNetDev) +{ + dev_close(pNetDev); +} + + +void RtmpOSNetDevFree(PNET_DEV pNetDev) +{ + ASSERT(pNetDev); + + free_netdev(pNetDev); +} + + +INT RtmpOSNetDevAlloc( + IN PNET_DEV *new_dev_p, + IN UINT32 privDataSize) +{ + // assign it as null first. + *new_dev_p = NULL; + + DBGPRINT(RT_DEBUG_TRACE, ("Allocate a net device with private data size=%d!\n", privDataSize)); + *new_dev_p = alloc_etherdev(privDataSize); + if (*new_dev_p) + return NDIS_STATUS_SUCCESS; + else + return NDIS_STATUS_FAILURE; +} + + +PNET_DEV RtmpOSNetDevGetByName(PNET_DEV pNetDev, PSTRING pDevName) +{ + PNET_DEV pTargetNetDev = NULL; + + pTargetNetDev = dev_get_by_name(dev_net(pNetDev), pDevName); + + return pTargetNetDev; +} + + +void RtmpOSNetDeviceRefPut(PNET_DEV pNetDev) +{ + /* + every time dev_get_by_name is called, and it has returned a valid struct + net_device*, dev_put should be called afterwards, because otherwise the + machine hangs when the device is unregistered (since dev->refcnt > 1). + */ + if(pNetDev) + dev_put(pNetDev); +} + + +INT RtmpOSNetDevDestory( + IN RTMP_ADAPTER *pAd, + IN PNET_DEV pNetDev) +{ + + // TODO: Need to fix this + printk("WARNING: This function(%s) not implement yet!!!\n", __func__); + return 0; +} + + +void RtmpOSNetDevDetach(PNET_DEV pNetDev) +{ + unregister_netdev(pNetDev); +} + + +int RtmpOSNetDevAttach( + IN PNET_DEV pNetDev, + IN RTMP_OS_NETDEV_OP_HOOK *pDevOpHook) +{ + int ret, rtnl_locked = FALSE; + + DBGPRINT(RT_DEBUG_TRACE, ("RtmpOSNetDevAttach()--->\n")); + // If we need hook some callback function to the net device structrue, now do it. + if (pDevOpHook) + { + PRTMP_ADAPTER pAd = NULL; + + GET_PAD_FROM_NET_DEV(pAd, pNetDev); + + pNetDev->netdev_ops = pDevOpHook->netdev_ops; + + /* OS specific flags, here we used to indicate if we are virtual interface */ + pNetDev->priv_flags = pDevOpHook->priv_flags; + + + if (pAd->OpMode == OPMODE_STA) + { + pNetDev->wireless_handlers = &rt28xx_iw_handler_def; + } + + + // copy the net device mac address to the net_device structure. + NdisMoveMemory(pNetDev->dev_addr, &pDevOpHook->devAddr[0], MAC_ADDR_LEN); + + rtnl_locked = pDevOpHook->needProtcted; + } + + if (rtnl_locked) + ret = register_netdevice(pNetDev); + else + ret = register_netdev(pNetDev); + + DBGPRINT(RT_DEBUG_TRACE, ("<---RtmpOSNetDevAttach(), ret=%d\n", ret)); + if (ret == 0) + return NDIS_STATUS_SUCCESS; + else + return NDIS_STATUS_FAILURE; +} + + +PNET_DEV RtmpOSNetDevCreate( + IN RTMP_ADAPTER *pAd, + IN INT devType, + IN INT devNum, + IN INT privMemSize, + IN PSTRING pNamePrefix) +{ + struct net_device *pNetDev = NULL; + int status; + + + /* allocate a new network device */ + status = RtmpOSNetDevAlloc(&pNetDev, 0 /*privMemSize*/); + if (status != NDIS_STATUS_SUCCESS) + { + /* allocation fail, exit */ + DBGPRINT(RT_DEBUG_ERROR, ("Allocate network device fail (%s)...\n", pNamePrefix)); + return NULL; + } + + + /* find a available interface name, max 32 interfaces */ + status = RtmpOSNetDevRequestName(pAd, pNetDev, pNamePrefix, devNum); + if (status != NDIS_STATUS_SUCCESS) + { + /* error! no any available ra name can be used! */ + DBGPRINT(RT_DEBUG_ERROR, ("Assign interface name (%s with suffix 0~32) failed...\n", pNamePrefix)); + RtmpOSNetDevFree(pNetDev); + + return NULL; + } + else + { + DBGPRINT(RT_DEBUG_TRACE, ("The name of the new %s interface is %s...\n", pNamePrefix, pNetDev->name)); + } + + return pNetDev; +} diff --git a/drivers/staging/rt2860/rt_linux.h b/drivers/staging/rt2860/rt_linux.h index e8d64c30b906..4ebe943359d1 100644 --- a/drivers/staging/rt2860/rt_linux.h +++ b/drivers/staging/rt2860/rt_linux.h @@ -23,27 +23,22 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * * ************************************************************************* - */ -/***********************************************************************/ -/* */ -/* Program: rt_linux.c */ -/* Created: 4/21/2006 1:17:38 PM */ -/* Author: Wu Xi-Kun */ -/* Comments: `description` */ -/* */ -/*---------------------------------------------------------------------*/ -/* */ -/* History: */ -/* Revision 1.1 4/21/2006 1:17:38 PM xsikun */ -/* Initial revision */ -/* */ -/***********************************************************************/ - -#include "rtmp_type.h" + Module Name: + rt_linux.h + + Abstract: + + Revision History: + Who When What + --------- ---------- ---------------------------------------------- +*/ + +#ifndef __RT_LINUX_H__ +#define __RT_LINUX_H__ + #include #include - #include #include #include @@ -69,60 +64,80 @@ #define __KERNEL_SYSCALLS__ #include #include +#include +#include // for get_unaligned() +#define KTHREAD_SUPPORT 1 +// RT2870 2.1.0.0 has it disabled -#define MEM_ALLOC_FLAG (GFP_ATOMIC) //(GFP_DMA | GFP_ATOMIC) +#ifdef KTHREAD_SUPPORT +#include +#include +#endif // KTHREAD_SUPPORT // + +#undef AP_WSC_INCLUDED +#undef STA_WSC_INCLUDED +#undef WSC_INCLUDED + + + + +#ifdef KTHREAD_SUPPORT +#endif // KTHREAD_SUPPORT // + +/*********************************************************************************** + * Profile related sections + ***********************************************************************************/ -#ifndef IFNAMSIZ -#define IFNAMSIZ 16 -#endif -//#define CONFIG_CKIP_SUPPORT +#ifdef RTMP_MAC_PCI +#define STA_PROFILE_PATH "/etc/Wireless/RT2860STA/RT2860STA.dat" +#define STA_DRIVER_VERSION "2.1.0.0" +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB +#define STA_PROFILE_PATH "/etc/Wireless/RT2870STA/RT2870STA.dat" +#define STA_DRIVER_VERSION "2.1.0.0" +// RT3070 version: 2.1.1.0 +#endif // RTMP_MAC_USB // +extern const struct iw_handler_def rt28xx_iw_handler_def; + + +/*********************************************************************************** + * Compiler related definitions + ***********************************************************************************/ #undef __inline #define __inline static inline +#define IN +#define OUT +#define INOUT +#define NDIS_STATUS INT -typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_dev); -// add by kathy - -/* order of "if defined()" is important, because for 3070 driver - both RT2870 and RT3070 are defined */ -#if defined(RT2860) - #define STA_PROFILE_PATH "/etc/Wireless/RT2860STA/RT2860STA.dat" - #define STA_RTMP_FIRMWARE_FILE_NAME "/etc/Wireless/RT2860STA/RT2860STA.bin" - #define STA_NIC_DEVICE_NAME "RT2860STA" - #define STA_DRIVER_VERSION "1.8.1.1" -#elif defined(RT3070) - #define STA_PROFILE_PATH "/etc/Wireless/RT3070STA/RT3070STA.dat" - #define STA_RT2870_IMAGE_FILE_NAME "/etc/Wireless/RT3070STA/rt2870.bin" - #define STA_NIC_DEVICE_NAME "RT3070STA" - #define STA_DRIVER_VERSION "2.0.1.0" -#elif defined(RT2870) - #define STA_PROFILE_PATH "/etc/Wireless/RT2870STA/RT2870STA.dat" - #define STA_RT2870_IMAGE_FILE_NAME "/etc/Wireless/RT2870STA/rt2870.bin" - #define STA_NIC_DEVICE_NAME "RT2870STA" - #define STA_DRIVER_VERSION "1.4.0.0" -#endif +/*********************************************************************************** + * OS Specific definitions and data structures + ***********************************************************************************/ +typedef struct pci_dev * PPCI_DEV; +typedef struct net_device * PNET_DEV; +typedef void * PNDIS_PACKET; +typedef char NDIS_PACKET; +typedef PNDIS_PACKET * PPNDIS_PACKET; +typedef dma_addr_t NDIS_PHYSICAL_ADDRESS; +typedef dma_addr_t * PNDIS_PHYSICAL_ADDRESS; +typedef void * NDIS_HANDLE; +typedef char * PNDIS_BUFFER; +typedef struct pid * RTMP_OS_PID; +typedef struct semaphore RTMP_OS_SEM; + +typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_dev); -#ifdef RT2860 +#ifdef RTMP_MAC_PCI #ifndef PCI_DEVICE #define PCI_DEVICE(vend,dev) \ .vendor = (vend), .device = (dev), \ .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID #endif // PCI_DEVICE // -#endif - -#define RTMP_TIME_AFTER(a,b) \ - (typecheck(unsigned long, (unsigned long)a) && \ - typecheck(unsigned long, (unsigned long)b) && \ - ((long)(b) - (long)(a) < 0)) - -#define RTMP_TIME_AFTER_EQ(a,b) \ - (typecheck(unsigned long, (unsigned long)a) && \ - typecheck(unsigned long, (unsigned long)b) && \ - ((long)(a) - (long)(b) >= 0)) -#define RTMP_TIME_BEFORE(a,b) RTMP_TIME_AFTER_EQ(b,a) +#endif // RTMP_MAC_PCI // #define RT_MOD_INC_USE_COUNT() \ if (!try_module_get(THIS_MODULE)) \ @@ -133,220 +148,336 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_ #define RT_MOD_DEC_USE_COUNT() module_put(THIS_MODULE); -#define OS_HZ HZ +#define RTMP_INC_REF(_A) 0 +#define RTMP_DEC_REF(_A) 0 +#define RTMP_GET_REF(_A) 0 -#define ETH_LENGTH_OF_ADDRESS 6 -#define IN -#define OUT +// This function will be called when query /proc +struct iw_statistics *rt28xx_get_wireless_stats( + IN struct net_device *net_dev); + + +/*********************************************************************************** + * Network related constant definitions + ***********************************************************************************/ +#ifndef IFNAMSIZ +#define IFNAMSIZ 16 +#endif + +#define ETH_LENGTH_OF_ADDRESS 6 -#define NDIS_STATUS INT #define NDIS_STATUS_SUCCESS 0x00 #define NDIS_STATUS_FAILURE 0x01 #define NDIS_STATUS_INVALID_DATA 0x02 #define NDIS_STATUS_RESOURCES 0x03 +#define NDIS_SET_PACKET_STATUS(_p, _status) do{} while(0) +#define NdisWriteErrorLogEntry(_a, _b, _c, _d) do{} while(0) + +/* statistics counter */ +#define STATS_INC_RX_PACKETS(_pAd, _dev) +#define STATS_INC_TX_PACKETS(_pAd, _dev) + +#define STATS_INC_RX_BYTESS(_pAd, _dev, len) +#define STATS_INC_TX_BYTESS(_pAd, _dev, len) + +#define STATS_INC_RX_ERRORS(_pAd, _dev) +#define STATS_INC_TX_ERRORS(_pAd, _dev) + +#define STATS_INC_RX_DROPPED(_pAd, _dev) +#define STATS_INC_TX_DROPPED(_pAd, _dev) + + +/*********************************************************************************** + * Ralink Specific network related constant definitions + ***********************************************************************************/ #define MIN_NET_DEVICE_FOR_AID 0x00 //0x00~0x3f #define MIN_NET_DEVICE_FOR_MBSSID 0x00 //0x00,0x10,0x20,0x30 #define MIN_NET_DEVICE_FOR_WDS 0x10 //0x40,0x50,0x60,0x70 #define MIN_NET_DEVICE_FOR_APCLI 0x20 #define MIN_NET_DEVICE_FOR_MESH 0x30 #define MIN_NET_DEVICE_FOR_DLS 0x40 +#define NET_DEVICE_REAL_IDX_MASK 0x0f // for each operation mode, we maximum support 15 entities. + #define NDIS_PACKET_TYPE_DIRECTED 0 #define NDIS_PACKET_TYPE_MULTICAST 1 #define NDIS_PACKET_TYPE_BROADCAST 2 #define NDIS_PACKET_TYPE_ALL_MULTICAST 3 +#define NDIS_PACKET_TYPE_PROMISCUOUS 4 + + +/*********************************************************************************** + * OS signaling related constant definitions + ***********************************************************************************/ + + +/*********************************************************************************** + * OS file operation related data structure definitions + ***********************************************************************************/ +typedef struct file* RTMP_OS_FD; + +typedef struct _RTMP_OS_FS_INFO_ +{ + int fsuid; + int fsgid; + mm_segment_t fs; +}RTMP_OS_FS_INFO; +#define IS_FILE_OPEN_ERR(_fd) IS_ERR((_fd)) + + +/*********************************************************************************** + * OS semaphore related data structure and definitions + ***********************************************************************************/ struct os_lock { spinlock_t lock; - unsigned long flags; + unsigned long flags; }; +typedef spinlock_t NDIS_SPIN_LOCK; -struct os_cookie { -#ifdef RT2860 - struct pci_dev *pci_dev; - struct pci_dev *parent_pci_dev; - dma_addr_t pAd_pa; -#endif -#ifdef RT2870 - struct usb_device *pUsb_Dev; +// +// spin_lock enhanced for Nested spin lock +// +#define NdisAllocateSpinLock(__lock) \ +{ \ + spin_lock_init((spinlock_t *)(__lock)); \ +} - struct pid *MLMEThr_pid; - struct pid *RTUSBCmdThr_pid; - struct pid *TimerQThr_pid; -#endif // RT2870 // - - struct tasklet_struct rx_done_task; - struct tasklet_struct mgmt_dma_done_task; - struct tasklet_struct ac0_dma_done_task; - struct tasklet_struct ac1_dma_done_task; - struct tasklet_struct ac2_dma_done_task; - struct tasklet_struct ac3_dma_done_task; - struct tasklet_struct hcca_dma_done_task; - struct tasklet_struct tbtt_task; -#ifdef RT2860 - struct tasklet_struct fifo_statistic_full_task; -#endif -#ifdef RT2870 - struct tasklet_struct null_frame_complete_task; - struct tasklet_struct rts_frame_complete_task; - struct tasklet_struct pspoll_frame_complete_task; -#endif // RT2870 // +#define NdisFreeSpinLock(lock) \ + do{}while(0) - unsigned long apd_pid; //802.1x daemon pid - INT ioctl_if_type; - INT ioctl_if; -}; -#undef ASSERT -#define ASSERT(x) +#define RTMP_SEM_LOCK(__lock) \ +{ \ + spin_lock_bh((spinlock_t *)(__lock)); \ +} -typedef struct os_cookie * POS_COOKIE; -typedef struct pci_dev * PPCI_DEV; -typedef struct net_device * PNET_DEV; -typedef void * PNDIS_PACKET; -typedef char NDIS_PACKET; -typedef PNDIS_PACKET * PPNDIS_PACKET; -typedef dma_addr_t NDIS_PHYSICAL_ADDRESS; -typedef dma_addr_t * PNDIS_PHYSICAL_ADDRESS; -typedef spinlock_t NDIS_SPIN_LOCK; -typedef struct timer_list NDIS_MINIPORT_TIMER; -typedef void * NDIS_HANDLE; -typedef char * PNDIS_BUFFER; +#define RTMP_SEM_UNLOCK(__lock) \ +{ \ + spin_unlock_bh((spinlock_t *)(__lock)); \ +} +// sample, use semaphore lock to replace IRQ lock, 2007/11/15 +#define RTMP_IRQ_LOCK(__lock, __irqflags) \ +{ \ + __irqflags = 0; \ + spin_lock_bh((spinlock_t *)(__lock)); \ + pAd->irq_disabled |= 1; \ +} -void hex_dump(char *str, unsigned char *pSrcBufVA, unsigned int SrcBufLen); +#define RTMP_IRQ_UNLOCK(__lock, __irqflag) \ +{ \ + pAd->irq_disabled &= 0; \ + spin_unlock_bh((spinlock_t *)(__lock)); \ +} -dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, int sd_idx, int direction); -void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int direction); +#define RTMP_INT_LOCK(__lock, __irqflags) \ +{ \ + spin_lock_irqsave((spinlock_t *)__lock, __irqflags); \ +} +#define RTMP_INT_UNLOCK(__lock, __irqflag) \ +{ \ + spin_unlock_irqrestore((spinlock_t *)(__lock), ((unsigned long)__irqflag)); \ +} -//////////////////////////////////////// -// MOVE TO rtmp.h ? -///////////////////////////////////////// -#define PKTSRC_NDIS 0x7f -#define PKTSRC_DRIVER 0x0f -#define PRINT_MAC(addr) \ - addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] +#define NdisAcquireSpinLock RTMP_SEM_LOCK +#define NdisReleaseSpinLock RTMP_SEM_UNLOCK +#ifndef wait_event_interruptible_timeout +#define __wait_event_interruptible_timeout(wq, condition, ret) \ +do { \ + wait_queue_t __wait; \ + init_waitqueue_entry(&__wait, current); \ + add_wait_queue(&wq, &__wait); \ + for (;;) { \ + set_current_state(TASK_INTERRUPTIBLE); \ + if (condition) \ + break; \ + if (!signal_pending(current)) { \ + ret = schedule_timeout(ret); \ + if (!ret) \ + break; \ + continue; \ + } \ + ret = -ERESTARTSYS; \ + break; \ + } \ + current->state = TASK_RUNNING; \ + remove_wait_queue(&wq, &__wait); \ +} while (0) -#define RT2860_PCI_DEVICE_ID 0x0601 +#define wait_event_interruptible_timeout(wq, condition, timeout) \ +({ \ + long __ret = timeout; \ + if (!(condition)) \ + __wait_event_interruptible_timeout(wq, condition, __ret); \ + __ret; \ +}) +#endif -#ifdef RT2860 -#define PCI_MAP_SINGLE(_handle, _ptr, _size, _sd_idx, _dir) \ - linux_pci_map_single(_handle, _ptr, _size, _sd_idx, _dir) +#define RTMP_SEM_EVENT_INIT_LOCKED(_pSema) sema_init((_pSema), 0) +#define RTMP_SEM_EVENT_INIT(_pSema) sema_init((_pSema), 1) +#define RTMP_SEM_EVENT_WAIT(_pSema, _status) ((_status) = down_interruptible((_pSema))) +#define RTMP_SEM_EVENT_UP(_pSema) up(_pSema) + +#ifdef KTHREAD_SUPPORT +#define RTMP_WAIT_EVENT_INTERRUPTIBLE(_pAd, _pTask) \ +{ \ + wait_event_interruptible(_pTask->kthread_q, \ + _pTask->kthread_running || kthread_should_stop()); \ + _pTask->kthread_running = FALSE; \ + if (kthread_should_stop()) \ + { \ + RTMP_SET_FLAG(_pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); \ + break; \ + } \ +} +#endif -#define PCI_UNMAP_SINGLE(_handle, _ptr, _size, _dir) \ - linux_pci_unmap_single(_handle, _ptr, _size, _dir) +#ifdef KTHREAD_SUPPORT +#define WAKE_UP(_pTask) \ + do{ \ + if ((_pTask)->kthread_task) \ + { \ + (_pTask)->kthread_running = TRUE; \ + wake_up(&(_pTask)->kthread_q); \ + } \ + }while(0) +#endif -#define PCI_ALLOC_CONSISTENT(_pci_dev, _size, _ptr) \ - pci_alloc_consistent(_pci_dev, _size, _ptr) +/*********************************************************************************** + * OS Memory Access related data structure and definitions + ***********************************************************************************/ +#define MEM_ALLOC_FLAG (GFP_ATOMIC) //(GFP_DMA | GFP_ATOMIC) -#define PCI_FREE_CONSISTENT(_pci_dev, _size, _virtual_addr, _physical_addr) \ - pci_free_consistent(_pci_dev, _size, _virtual_addr, _physical_addr) +#define NdisMoveMemory(Destination, Source, Length) memmove(Destination, Source, Length) +#define NdisCopyMemory(Destination, Source, Length) memcpy(Destination, Source, Length) +#define NdisZeroMemory(Destination, Length) memset(Destination, 0, Length) +#define NdisFillMemory(Destination, Length, Fill) memset(Destination, Fill, Length) +#define NdisCmpMemory(Destination, Source, Length) memcmp(Destination, Source, Length) +#define NdisEqualMemory(Source1, Source2, Length) (!memcmp(Source1, Source2, Length)) +#define RTMPEqualMemory(Source1, Source2, Length) (!memcmp(Source1, Source2, Length)) -#define DEV_ALLOC_SKB(_length) \ - dev_alloc_skb(_length) -#endif -#ifdef RT2870 -#define PCI_MAP_SINGLE(_handle, _ptr, _size, _dir) (ULONG)0 +#define MlmeAllocateMemory(_pAd, _ppVA) os_alloc_mem(_pAd, _ppVA, MGMT_DMA_BUFFER_SIZE) +#define MlmeFreeMemory(_pAd, _pVA) os_free_mem(_pAd, _pVA) -#define PCI_UNMAP_SINGLE(_handle, _ptr, _size, _dir) -#endif // RT2870 // +#define COPY_MAC_ADDR(Addr1, Addr2) memcpy((Addr1), (Addr2), MAC_ADDR_LEN) -#define BEACON_FRAME_DMA_CACHE_WBACK(_ptr, _size) \ - dma_cache_wback(_ptr, _size) +/*********************************************************************************** + * OS task related data structure and definitions + ***********************************************************************************/ +#define RTMP_OS_MGMT_TASK_FLAGS CLONE_VM +typedef struct pid * THREAD_PID; +#define THREAD_PID_INIT_VALUE NULL +#define GET_PID(_v) find_get_pid((_v)) +#define GET_PID_NUMBER(_v) pid_nr((_v)) +#define CHECK_PID_LEGALITY(_pid) if (pid_nr((_pid)) > 0) +#define KILL_THREAD_PID(_A, _B, _C) kill_pid((_A), (_B), (_C)) -////////////////////////////////////////// -// -////////////////////////////////////////// +typedef struct tasklet_struct RTMP_NET_TASK_STRUCT; +typedef struct tasklet_struct *PRTMP_NET_TASK_STRUCT; -#define NdisMIndicateStatus(_w, _x, _y, _z) +/*********************************************************************************** + * Timer related definitions and data structures. + **********************************************************************************/ +#define OS_HZ HZ +typedef struct timer_list NDIS_MINIPORT_TIMER; typedef struct timer_list RTMP_OS_TIMER; +typedef void (*TIMER_FUNCTION)(unsigned long); -#ifdef RT2870 -/* ----------------- Timer Related MARCO ---------------*/ -// In RT2870, we have a lot of timer functions and will read/write register, it's -// not allowed in Linux USB sub-system to do it ( because of sleep issue when submit -// to ctrl pipe). So we need a wrapper function to take care it. - -typedef VOID (*RT2870_TIMER_HANDLE)( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); -#endif // RT2870 // - - -typedef struct _RALINK_TIMER_STRUCT { - RTMP_OS_TIMER TimerObj; // Ndis Timer object - BOOLEAN Valid; // Set to True when call RTMPInitTimer - BOOLEAN State; // True if timer cancelled - BOOLEAN PeriodicType; // True if timer is periodic timer - BOOLEAN Repeat; // True if periodic timer - ULONG TimerValue; // Timer value in milliseconds - ULONG cookie; // os specific object -#ifdef RT2870 - RT2870_TIMER_HANDLE handle; - void *pAd; -#endif // RT2870 // -} RALINK_TIMER_STRUCT, *PRALINK_TIMER_STRUCT; - - -#ifdef RT2870 - -typedef enum _RT2870_KERNEL_THREAD_STATUS_ -{ - RT2870_THREAD_UNKNOWN = 0, - RT2870_THREAD_INITED = 1, - RT2870_THREAD_RUNNING = 2, - RT2870_THREAD_STOPED = 4, -}RT2870_KERNEL_THREAD_STATUS; -#define RT2870_THREAD_CAN_DO_INSERT (RT2870_THREAD_INITED |RT2870_THREAD_RUNNING) +#define OS_WAIT(_time) \ +{ int _i; \ + long _loop = ((_time)/(1000/OS_HZ)) > 0 ? ((_time)/(1000/OS_HZ)) : 1;\ + wait_queue_head_t _wait; \ + init_waitqueue_head(&_wait); \ + for (_i=0; _i<(_loop); _i++) \ + wait_event_interruptible_timeout(_wait, 0, ONE_TICK); } -typedef struct _RT2870_TIMER_ENTRY_ -{ - RALINK_TIMER_STRUCT *pRaTimer; - struct _RT2870_TIMER_ENTRY_ *pNext; -}RT2870_TIMER_ENTRY; +#define RTMP_TIME_AFTER(a,b) \ + (typecheck(unsigned long, (unsigned long)a) && \ + typecheck(unsigned long, (unsigned long)b) && \ + ((long)(b) - (long)(a) < 0)) +#define RTMP_TIME_AFTER_EQ(a,b) \ + (typecheck(unsigned long, (unsigned long)a) && \ + typecheck(unsigned long, (unsigned long)b) && \ + ((long)(a) - (long)(b) >= 0)) +#define RTMP_TIME_BEFORE(a,b) RTMP_TIME_AFTER_EQ(b,a) + +#define ONE_TICK 1 -#define TIMER_QUEUE_SIZE_MAX 128 -typedef struct _RT2870_TIMER_QUEUE_ +static inline void NdisGetSystemUpTime(ULONG *time) { - unsigned int status; - UCHAR *pTimerQPoll; - RT2870_TIMER_ENTRY *pQPollFreeList; - RT2870_TIMER_ENTRY *pQHead; - RT2870_TIMER_ENTRY *pQTail; -}RT2870_TIMER_QUEUE; -#endif // RT2870 // + *time = jiffies; +} -//#define DBG 1 +/*********************************************************************************** + * OS specific cookie data structure binding to RTMP_ADAPTER + ***********************************************************************************/ + +struct os_cookie { +#ifdef RTMP_MAC_PCI + struct pci_dev *pci_dev; + struct pci_dev *parent_pci_dev; + USHORT DeviceID; + dma_addr_t pAd_pa; +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB + struct usb_device *pUsb_Dev; +#endif // RTMP_MAC_USB // + + RTMP_NET_TASK_STRUCT rx_done_task; + RTMP_NET_TASK_STRUCT mgmt_dma_done_task; + RTMP_NET_TASK_STRUCT ac0_dma_done_task; + RTMP_NET_TASK_STRUCT ac1_dma_done_task; + RTMP_NET_TASK_STRUCT ac2_dma_done_task; + RTMP_NET_TASK_STRUCT ac3_dma_done_task; + RTMP_NET_TASK_STRUCT tbtt_task; +#ifdef RTMP_MAC_PCI + RTMP_NET_TASK_STRUCT fifo_statistic_full_task; +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB + RTMP_NET_TASK_STRUCT null_frame_complete_task; + RTMP_NET_TASK_STRUCT rts_frame_complete_task; + RTMP_NET_TASK_STRUCT pspoll_frame_complete_task; +#endif // RTMP_MAC_USB // + + unsigned long apd_pid; //802.1x daemon pid + INT ioctl_if_type; + INT ioctl_if; +}; + +typedef struct os_cookie * POS_COOKIE; -// -// MACRO for debugging information -// + + +/*********************************************************************************** + * OS debugging and printing related definitions and data structure + ***********************************************************************************/ +#define PRINT_MAC(addr) \ + addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] #ifdef DBG extern ULONG RTDebugLevel; #define DBGPRINT_RAW(Level, Fmt) \ -{ \ +do{ \ if (Level <= RTDebugLevel) \ { \ printk Fmt; \ } \ -} +}while(0) #define DBGPRINT(Level, Fmt) DBGPRINT_RAW(Level, Fmt) @@ -370,55 +501,83 @@ extern ULONG RTDebugLevel; #define DBGPRINT_ERR(Fmt) #endif +#define ASSERT(x) -// -// spin_lock enhanced for Nested spin lock -// -#define NdisAllocateSpinLock(__lock) \ -{ \ - spin_lock_init((spinlock_t *)(__lock)); \ -} +void hex_dump(char *str, unsigned char *pSrcBufVA, unsigned int SrcBufLen); -#define NdisFreeSpinLock(lock) \ -{ \ -} +/********************************************************************************************************* + The following code are not revised, temporary put it here. + *********************************************************************************************************/ -#define RTMP_SEM_LOCK(__lock) \ -{ \ - spin_lock_bh((spinlock_t *)(__lock)); \ -} -#define RTMP_SEM_UNLOCK(__lock) \ -{ \ - spin_unlock_bh((spinlock_t *)(__lock)); \ -} +/*********************************************************************************** + * Device DMA Access related definitions and data structures. + **********************************************************************************/ +#ifdef RTMP_MAC_PCI +dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, int sd_idx, int direction); +void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int direction); -// sample, use semaphore lock to replace IRQ lock, 2007/11/15 -#define RTMP_IRQ_LOCK(__lock, __irqflags) \ -{ \ - __irqflags = 0; \ - spin_lock_bh((spinlock_t *)(__lock)); \ - pAd->irq_disabled |= 1; \ -} +#define PCI_MAP_SINGLE(_handle, _ptr, _size, _sd_idx, _dir) \ + linux_pci_map_single(_handle, _ptr, _size, _sd_idx, _dir) -#define RTMP_IRQ_UNLOCK(__lock, __irqflag) \ -{ \ - pAd->irq_disabled &= 0; \ - spin_unlock_bh((spinlock_t *)(__lock)); \ -} +#define PCI_UNMAP_SINGLE(_handle, _ptr, _size, _dir) \ + linux_pci_unmap_single(_handle, _ptr, _size, _dir) -#define RTMP_INT_LOCK(__lock, __irqflags) \ -{ \ - spin_lock_irqsave((spinlock_t *)__lock, __irqflags); \ -} +#define PCI_ALLOC_CONSISTENT(_pci_dev, _size, _ptr) \ + pci_alloc_consistent(_pci_dev, _size, _ptr) -#define RTMP_INT_UNLOCK(__lock, __irqflag) \ -{ \ - spin_unlock_irqrestore((spinlock_t *)(__lock), ((unsigned long)__irqflag)); \ -} +#define PCI_FREE_CONSISTENT(_pci_dev, _size, _virtual_addr, _physical_addr) \ + pci_free_consistent(_pci_dev, _size, _virtual_addr, _physical_addr) + +#define DEV_ALLOC_SKB(_length) \ + dev_alloc_skb(_length) +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB +#define PCI_MAP_SINGLE(_handle, _ptr, _size, _dir) (ULONG)0 -#ifdef RT2860 +#define PCI_UNMAP_SINGLE(_handle, _ptr, _size, _dir) +#endif // RTMP_MAC_USB // + +/* + * ULONG + * RTMP_GetPhysicalAddressLow( + * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); + */ +#define RTMP_GetPhysicalAddressLow(PhysicalAddress) (PhysicalAddress) + +/* + * ULONG + * RTMP_GetPhysicalAddressHigh( + * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); + */ +#define RTMP_GetPhysicalAddressHigh(PhysicalAddress) (0) + +/* + * VOID + * RTMP_SetPhysicalAddressLow( + * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, + * IN ULONG Value); + */ +#define RTMP_SetPhysicalAddressLow(PhysicalAddress, Value) \ + PhysicalAddress = Value; + +/* + * VOID + * RTMP_SetPhysicalAddressHigh( + * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, + * IN ULONG Value); + */ +#define RTMP_SetPhysicalAddressHigh(PhysicalAddress, Value) + +#define NdisMIndicateStatus(_w, _x, _y, _z) + + + +/*********************************************************************************** + * Device Register I/O Access related definitions and data structures. + **********************************************************************************/ +#ifdef RTMP_MAC_PCI //Patch for ASIC turst read/write bug, needs to remove after metel fix #define RTMP_IO_READ32(_A, _R, _pV) \ { \ @@ -430,11 +589,7 @@ extern ULONG RTDebugLevel; else \ *_pV = 0; \ } -#define RTMP_IO_FORCE_READ32(_A, _R, _pV) \ -{ \ - (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0))); \ - (*_pV = readl((void *)((_A)->CSRBaseAddress + (_R)))); \ -} + #define RTMP_IO_READ8(_A, _R, _pV) \ { \ (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0))); \ @@ -446,153 +601,92 @@ extern ULONG RTDebugLevel; { \ UINT Val; \ Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ - writel(_V, (void *)((_A)->CSRBaseAddress + (_R))); \ + writel((_V), (void *)((_A)->CSRBaseAddress + (_R))); \ } \ } + + + +#if defined(RALINK_2880) || defined(RALINK_3052) +#define RTMP_IO_WRITE8(_A, _R, _V) \ +{ \ + ULONG Val; \ + UCHAR _i; \ + _i = ((_R) & 0x3); \ + Val = readl((void *)((_A)->CSRBaseAddress + ((_R) - _i))); \ + Val = Val & (~(0x000000ff << ((_i)*8))); \ + Val = Val | ((ULONG)(_V) << ((_i)*8)); \ + writel((Val), (void *)((_A)->CSRBaseAddress + ((_R) - _i))); \ +} +#else #define RTMP_IO_WRITE8(_A, _R, _V) \ { \ UINT Val; \ Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ writeb((_V), (PUCHAR)((_A)->CSRBaseAddress + (_R))); \ } +#endif // #if defined(BRCM_6358) || defined(RALINK_2880) // + #define RTMP_IO_WRITE16(_A, _R, _V) \ { \ UINT Val; \ Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ writew((_V), (PUSHORT)((_A)->CSRBaseAddress + (_R))); \ } -#endif /* RT2860 */ -#ifdef RT2870 +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB //Patch for ASIC turst read/write bug, needs to remove after metel fix #define RTMP_IO_READ32(_A, _R, _pV) \ - RTUSBReadMACRegister(_A, _R, _pV) + RTUSBReadMACRegister((_A), (_R), (PUINT32) (_pV)) #define RTMP_IO_READ8(_A, _R, _pV) \ { \ } #define RTMP_IO_WRITE32(_A, _R, _V) \ - RTUSBWriteMACRegister(_A, _R, _V) - + RTUSBWriteMACRegister((_A), (_R), (UINT32) (_V)) #define RTMP_IO_WRITE8(_A, _R, _V) \ { \ USHORT _Val = _V; \ - RTUSBSingleWrite(_A, _R, _Val); \ + RTUSBSingleWrite((_A), (_R), (USHORT) (_Val)); \ } - #define RTMP_IO_WRITE16(_A, _R, _V) \ { \ - RTUSBSingleWrite(_A, _R, _V); \ + RTUSBSingleWrite((_A), (_R), (USHORT) (_V)); \ } -#endif // RT2870 // +#endif // RTMP_MAC_USB // -#ifndef wait_event_interruptible_timeout -#define __wait_event_interruptible_timeout(wq, condition, ret) \ -do { \ - wait_queue_t __wait; \ - init_waitqueue_entry(&__wait, current); \ - add_wait_queue(&wq, &__wait); \ - for (;;) { \ - set_current_state(TASK_INTERRUPTIBLE); \ - if (condition) \ - break; \ - if (!signal_pending(current)) { \ - ret = schedule_timeout(ret); \ - if (!ret) \ - break; \ - continue; \ - } \ - ret = -ERESTARTSYS; \ - break; \ - } \ - current->state = TASK_RUNNING; \ - remove_wait_queue(&wq, &__wait); \ -} while (0) +/*********************************************************************************** + * Network Related data structure and marco definitions + ***********************************************************************************/ +#define PKTSRC_NDIS 0x7f +#define PKTSRC_DRIVER 0x0f -#define wait_event_interruptible_timeout(wq, condition, timeout) \ -({ \ - long __ret = timeout; \ - if (!(condition)) \ - __wait_event_interruptible_timeout(wq, condition, __ret); \ - __ret; \ -}) -#endif -#define ONE_TICK 1 -#define OS_WAIT(_time) \ -{ int _i; \ - long _loop = ((_time)/(1000/OS_HZ)) > 0 ? ((_time)/(1000/OS_HZ)) : 1;\ - wait_queue_head_t _wait; \ - init_waitqueue_head(&_wait); \ - for (_i=0; _i<(_loop); _i++) \ - wait_event_interruptible_timeout(_wait, 0, ONE_TICK); } +#define RTMP_OS_NETDEV_SET_PRIV(_pNetDev, _pPriv) ((_pNetDev)->ml_priv = (_pPriv)) +#define RTMP_OS_NETDEV_GET_PRIV(_pNetDev) ((_pNetDev)->ml_priv) +#define RTMP_OS_NETDEV_GET_DEVNAME(_pNetDev) ((_pNetDev)->name) +#define RTMP_OS_NETDEV_GET_PHYADDR(_PNETDEV) ((_PNETDEV)->dev_addr) +#define RTMP_OS_NETDEV_START_QUEUE(_pNetDev) netif_start_queue((_pNetDev)) +#define RTMP_OS_NETDEV_STOP_QUEUE(_pNetDev) netif_stop_queue((_pNetDev)) +#define RTMP_OS_NETDEV_WAKE_QUEUE(_pNetDev) netif_wake_queue((_pNetDev)) +#define RTMP_OS_NETDEV_CARRIER_OFF(_pNetDev) netif_carrier_off((_pNetDev)) -typedef void (*TIMER_FUNCTION)(unsigned long); +#define QUEUE_ENTRY_TO_PACKET(pEntry) \ + (PNDIS_PACKET)(pEntry) -#define COPY_MAC_ADDR(Addr1, Addr2) memcpy((Addr1), (Addr2), MAC_ADDR_LEN) +#define PACKET_TO_QUEUE_ENTRY(pPacket) \ + (PQUEUE_ENTRY)(pPacket) -#define MlmeAllocateMemory(_pAd, _ppVA) os_alloc_mem(_pAd, _ppVA, MGMT_DMA_BUFFER_SIZE) -#define MlmeFreeMemory(_pAd, _pVA) os_free_mem(_pAd, _pVA) +#define GET_SG_LIST_FROM_PACKET(_p, _sc) \ + rt_get_sg_list_from_packet(_p, _sc) -#ifdef RT2860 -#define BUILD_TIMER_FUNCTION(_func) \ -void linux_##_func(unsigned long data) \ -{ \ - PRALINK_TIMER_STRUCT pTimer = (PRALINK_TIMER_STRUCT) data; \ - \ - _func(NULL, (PVOID) pTimer->cookie, NULL, pTimer); \ - if (pTimer->Repeat) \ - RTMP_OS_Add_Timer(&pTimer->TimerObj, pTimer->TimerValue); \ -} -#endif -#ifdef RT2870 -#define BUILD_TIMER_FUNCTION(_func) \ -void linux_##_func(unsigned long data) \ -{ \ - PRALINK_TIMER_STRUCT _pTimer = (PRALINK_TIMER_STRUCT)data; \ - RT2870_TIMER_ENTRY *_pQNode; \ - RTMP_ADAPTER *_pAd; \ - \ - _pTimer->handle = _func; \ - _pAd = (RTMP_ADAPTER *)_pTimer->pAd; \ - _pQNode = RT2870_TimerQ_Insert(_pAd, _pTimer); \ - if ((_pQNode == NULL) && (_pAd->TimerQ.status & RT2870_THREAD_CAN_DO_INSERT)) \ - RTMP_OS_Add_Timer(&_pTimer->TimerObj, HZ); \ +#define RELEASE_NDIS_PACKET(_pAd, _pPacket, _Status) \ +{ \ + RTMPFreeNdisPacket(_pAd, _pPacket); \ } -#endif // RT2870 // - - -#define DECLARE_TIMER_FUNCTION(_func) \ -void linux_##_func(unsigned long data) - -#define GET_TIMER_FUNCTION(_func) \ - linux_##_func - -DECLARE_TIMER_FUNCTION(MlmePeriodicExec); -DECLARE_TIMER_FUNCTION(MlmeRssiReportExec); -DECLARE_TIMER_FUNCTION(AsicRxAntEvalTimeout); -DECLARE_TIMER_FUNCTION(APSDPeriodicExec); -DECLARE_TIMER_FUNCTION(AsicRfTuningExec); -#ifdef RT2870 -DECLARE_TIMER_FUNCTION(BeaconUpdateExec); -#endif // RT2870 // - -DECLARE_TIMER_FUNCTION(BeaconTimeout); -DECLARE_TIMER_FUNCTION(ScanTimeout); -DECLARE_TIMER_FUNCTION(AuthTimeout); -DECLARE_TIMER_FUNCTION(AssocTimeout); -DECLARE_TIMER_FUNCTION(ReassocTimeout); -DECLARE_TIMER_FUNCTION(DisassocTimeout); -DECLARE_TIMER_FUNCTION(LinkDownExec); -DECLARE_TIMER_FUNCTION(StaQuickResponeForRateUpExec); -DECLARE_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc); -DECLARE_TIMER_FUNCTION(PsPollWakeExec); -DECLARE_TIMER_FUNCTION(RadioOnExec); - -void RTMP_GetCurrentSystemTime(LARGE_INTEGER *time); - /* * packet helper @@ -604,12 +698,18 @@ void RTMP_GetCurrentSystemTime(LARGE_INTEGER *time); #define GET_OS_PKT_DATAPTR(_pkt) \ (RTPKT_TO_OSPKT(_pkt)->data) +#define SET_OS_PKT_DATAPTR(_pkt, _dataPtr) \ + (RTPKT_TO_OSPKT(_pkt)->data) = (_dataPtr) #define GET_OS_PKT_LEN(_pkt) \ (RTPKT_TO_OSPKT(_pkt)->len) +#define SET_OS_PKT_LEN(_pkt, _len) \ + (RTPKT_TO_OSPKT(_pkt)->len) = (_len) #define GET_OS_PKT_DATATAIL(_pkt) \ (RTPKT_TO_OSPKT(_pkt)->tail) +#define SET_OS_PKT_DATATAIL(_pkt, _start, _len) \ + ((RTPKT_TO_OSPKT(_pkt))->tail) = (PUCHAR)((_start) + (_len)) #define GET_OS_PKT_HEAD(_pkt) \ (RTPKT_TO_OSPKT(_pkt)->head) @@ -619,6 +719,8 @@ void RTMP_GetCurrentSystemTime(LARGE_INTEGER *time); #define GET_OS_PKT_NETDEV(_pkt) \ (RTPKT_TO_OSPKT(_pkt)->dev) +#define SET_OS_PKT_NETDEV(_pkt, _pNetDev) \ + (RTPKT_TO_OSPKT(_pkt)->dev) = (_pNetDev) #define GET_OS_PKT_TYPE(_pkt) \ (RTPKT_TO_OSPKT(_pkt)) @@ -627,6 +729,8 @@ void RTMP_GetCurrentSystemTime(LARGE_INTEGER *time); (RTPKT_TO_OSPKT(_pkt)->next) +#define OS_PKT_CLONED(_pkt) skb_cloned(RTPKT_TO_OSPKT(_pkt)) + #define OS_NTOHS(_Val) \ (ntohs(_Val)) #define OS_HTONS(_Val) \ @@ -636,27 +740,8 @@ void RTMP_GetCurrentSystemTime(LARGE_INTEGER *time); #define OS_HTONL(_Val) \ (htonl(_Val)) -/* statistics counter */ -#define STATS_INC_RX_PACKETS(_pAd, _dev) -#define STATS_INC_TX_PACKETS(_pAd, _dev) - -#define STATS_INC_RX_BYTESS(_pAd, _dev, len) -#define STATS_INC_TX_BYTESS(_pAd, _dev, len) - -#define STATS_INC_RX_ERRORS(_pAd, _dev) -#define STATS_INC_TX_ERRORS(_pAd, _dev) - -#define STATS_INC_RX_DROPPED(_pAd, _dev) -#define STATS_INC_TX_DROPPED(_pAd, _dev) - - #define CB_OFF 10 - -// check DDK NDIS_PACKET data structure and find out only MiniportReservedEx[0..7] can be used by our driver without -// ambiguity. Fields after pPacket->MiniportReservedEx[8] may be used by other wrapper layer thus crashes the driver -// - // User Priority #define RTMP_SET_PACKET_UP(_p, _prio) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+0] = _prio) #define RTMP_GET_PACKET_UP(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+0]) @@ -782,137 +867,38 @@ void RTMP_GetCurrentSystemTime(LARGE_INTEGER *time); #define RTMP_SET_PACKET_CLEAR_EAP_FRAME(_p, _flg) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+12] = _flg) #define RTMP_GET_PACKET_CLEAR_EAP_FRAME(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+12]) -#define RTMP_SET_PACKET_5VT(_p, _flg) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+22] = _flg) -#define RTMP_GET_PACKET_5VT(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+22]) - -#ifdef CONFIG_5VT_ENHANCE -#define BRIDGE_TAG 0x35564252 // depends on 5VT define in br_input.c -#endif - -#define NDIS_SET_PACKET_STATUS(_p, _status) +/* use bit3 of cb[CB_OFF+16] */ -#define GET_SG_LIST_FROM_PACKET(_p, _sc) \ - rt_get_sg_list_from_packet(_p, _sc) - -#define NdisMoveMemory(Destination, Source, Length) memmove(Destination, Source, Length) -#define NdisZeroMemory(Destination, Length) memset(Destination, 0, Length) -#define NdisFillMemory(Destination, Length, Fill) memset(Destination, Fill, Length) -#define NdisEqualMemory(Source1, Source2, Length) (!memcmp(Source1, Source2, Length)) -#define RTMPEqualMemory(Source1, Source2, Length) (!memcmp(Source1, Source2, Length)) - - -#define RTMP_INC_REF(_A) 0 -#define RTMP_DEC_REF(_A) 0 -#define RTMP_GET_REF(_A) 0 - - - -/* - * ULONG - * RTMP_GetPhysicalAddressLow( - * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); - */ -#define RTMP_GetPhysicalAddressLow(PhysicalAddress) (PhysicalAddress) - -/* - * ULONG - * RTMP_GetPhysicalAddressHigh( - * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); - */ -#define RTMP_GetPhysicalAddressHigh(PhysicalAddress) (0) - -/* - * VOID - * RTMP_SetPhysicalAddressLow( - * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, - * IN ULONG Value); - */ -#define RTMP_SetPhysicalAddressLow(PhysicalAddress, Value) \ - PhysicalAddress = Value; - -/* - * VOID - * RTMP_SetPhysicalAddressHigh( - * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, - * IN ULONG Value); - */ -#define RTMP_SetPhysicalAddressHigh(PhysicalAddress, Value) - - -//CONTAINING_RECORD(pEntry, NDIS_PACKET, MiniportReservedEx); -#define QUEUE_ENTRY_TO_PACKET(pEntry) \ - (PNDIS_PACKET)(pEntry) - -#define PACKET_TO_QUEUE_ENTRY(pPacket) \ - (PQUEUE_ENTRY)(pPacket) - - -#ifndef CONTAINING_RECORD -#define CONTAINING_RECORD(address, type, field) \ -((type *)((PCHAR)(address) - offsetof(type, field))) -#endif - - -#define RELEASE_NDIS_PACKET(_pAd, _pPacket, _Status) \ -{ \ - RTMPFreeNdisPacket(_pAd, _pPacket); \ -} - - -#define SWITCH_PhyAB(_pAA, _pBB) \ -{ \ - ULONG AABasePaHigh; \ - ULONG AABasePaLow; \ - ULONG BBBasePaHigh; \ - ULONG BBBasePaLow; \ - BBBasePaHigh = RTMP_GetPhysicalAddressHigh(_pBB); \ - BBBasePaLow = RTMP_GetPhysicalAddressLow(_pBB); \ - AABasePaHigh = RTMP_GetPhysicalAddressHigh(_pAA); \ - AABasePaLow = RTMP_GetPhysicalAddressLow(_pAA); \ - RTMP_SetPhysicalAddressHigh(_pAA, BBBasePaHigh); \ - RTMP_SetPhysicalAddressLow(_pAA, BBBasePaLow); \ - RTMP_SetPhysicalAddressHigh(_pBB, AABasePaHigh); \ - RTMP_SetPhysicalAddressLow(_pBB, AABasePaLow); \ -} - - -#define NdisWriteErrorLogEntry(_a, _b, _c, _d) -#define NdisMAllocateMapRegisters(_a, _b, _c, _d, _e) NDIS_STATUS_SUCCESS - +#define RTMP_SET_PACKET_5VT(_p, _flg) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+22] = _flg) +#define RTMP_GET_PACKET_5VT(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+22]) -#define NdisAcquireSpinLock RTMP_SEM_LOCK -#define NdisReleaseSpinLock RTMP_SEM_UNLOCK +/* Max skb->cb = 48B = [CB_OFF+38] */ -static inline void NdisGetSystemUpTime(ULONG *time) -{ - *time = jiffies; -} -//pPacket = CONTAINING_RECORD(pEntry, NDIS_PACKET, MiniportReservedEx); -#define QUEUE_ENTRY_TO_PKT(pEntry) \ - ((PNDIS_PACKET) (pEntry)) +/*********************************************************************************** + * Other function prototypes definitions + ***********************************************************************************/ +void RTMP_GetCurrentSystemTime(LARGE_INTEGER *time); int rt28xx_packet_xmit(struct sk_buff *skb); +#ifdef RTMP_MAC_PCI +/* function declarations */ +#define IRQ_HANDLE_TYPE irqreturn_t +IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance); +#endif // RTMP_MAC_PCI // -void rtmp_os_thread_init(PUCHAR pThreadName, PVOID pNotify); - -#ifdef RT2860 -#if !defined(PCI_CAP_ID_EXP) -#define PCI_CAP_ID_EXP 0x10 -#endif +INT rt28xx_sta_ioctl( + IN PNET_DEV net_dev, + IN OUT struct ifreq *rq, + IN INT cmd); -#if !defined(PCI_EXP_LNKCTL) -#define PCI_EXP_LNKCTL 0x10 -#endif +extern int ra_mtd_write(int num, loff_t to, size_t len, const u_char *buf); +extern int ra_mtd_read(int num, loff_t from, size_t len, u_char *buf); -#if !defined(PCI_CLASS_BRIDGE_PCI) -#define PCI_CLASS_BRIDGE_PCI 0x0604 -#endif - -#define PCIBUS_INTEL_VENDOR 0x8086 -#endif +#define GET_PAD_FROM_NET_DEV(_pAd, _net_dev) (_pAd) = (PRTMP_ADAPTER)(_net_dev)->ml_priv; +#endif // __RT_LINUX_H__ // diff --git a/drivers/staging/rt2860/rt_main_dev.c b/drivers/staging/rt2860/rt_main_dev.c index 22f37cfbefbe..89c67fc9dc37 100644 --- a/drivers/staging/rt2860/rt_main_dev.c +++ b/drivers/staging/rt2860/rt_main_dev.c @@ -33,20 +33,18 @@ Revision History: Who When What -------- ---------- ---------------------------------------------- - Sample Mar/21/07 Merge RT2870 and RT2860 drivers. */ #include "rt_config.h" -#define FORTY_MHZ_INTOLERANT_INTERVAL (60*1000) // 1 min + /*---------------------------------------------------------------------*/ /* Private Variables Used */ /*---------------------------------------------------------------------*/ -//static RALINK_TIMER_STRUCT PeriodicTimer; -char *mac = ""; // default 00:00:00:00:00:00 -char *hostname = ""; // default CMPC +PSTRING mac = ""; // default 00:00:00:00:00:00 +PSTRING hostname = ""; // default CMPC module_param (mac, charp, 0); MODULE_PARM_DESC (mac, "rt28xx: wireless mac addr"); @@ -54,31 +52,16 @@ MODULE_PARM_DESC (mac, "rt28xx: wireless mac addr"); /*---------------------------------------------------------------------*/ /* Prototypes of Functions Used */ /*---------------------------------------------------------------------*/ -extern BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num); -extern void ba_reordering_resource_release(PRTMP_ADAPTER pAd); -extern NDIS_STATUS NICLoadRateSwitchingParams(IN PRTMP_ADAPTER pAd); - -#ifdef RT2860 -extern void init_thread_task(PRTMP_ADAPTER pAd); -#endif // public function prototype -INT __devinit rt28xx_probe(IN void *_dev_p, IN void *_dev_id_p, - IN UINT argc, OUT PRTMP_ADAPTER *ppAd); +int rt28xx_close(IN struct net_device *net_dev); +int rt28xx_open(struct net_device *net_dev); // private function prototype -static int rt28xx_init(IN struct net_device *net_dev); -INT rt28xx_send_packets(IN struct sk_buff *skb_p, IN struct net_device *net_dev); - -static void CfgInitHook(PRTMP_ADAPTER pAd); +static INT rt28xx_send_packets(IN struct sk_buff *skb_p, IN struct net_device *net_dev); -extern const struct iw_handler_def rt28xx_iw_handler_def; -// This function will be called when query /proc -struct iw_statistics *rt28xx_get_wireless_stats( - IN struct net_device *net_dev); - -struct net_device_stats *RT28xx_get_ether_stats( +static struct net_device_stats *RT28xx_get_ether_stats( IN struct net_device *net_dev); /* @@ -103,7 +86,9 @@ Note: */ int MainVirtualIF_close(IN struct net_device *net_dev) { - RTMP_ADAPTER *pAd = net_dev->ml_priv; + RTMP_ADAPTER *pAd = NULL; + + GET_PAD_FROM_NET_DEV(pAd, net_dev); // Sanity check for pAd if (pAd == NULL) @@ -112,6 +97,40 @@ int MainVirtualIF_close(IN struct net_device *net_dev) netif_carrier_off(pAd->net_dev); netif_stop_queue(pAd->net_dev); + { + BOOLEAN Cancelled; + + if (INFRA_ON(pAd) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) + { + MLME_DISASSOC_REQ_STRUCT DisReq; + MLME_QUEUE_ELEM *MsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); + + if (MsgElem) + { + COPY_MAC_ADDR(DisReq.Addr, pAd->CommonCfg.Bssid); + DisReq.Reason = REASON_DEAUTH_STA_LEAVING; + + MsgElem->Machine = ASSOC_STATE_MACHINE; + MsgElem->MsgType = MT2_MLME_DISASSOC_REQ; + MsgElem->MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT); + NdisMoveMemory(MsgElem->Msg, &DisReq, sizeof(MLME_DISASSOC_REQ_STRUCT)); + + // Prevent to connect AP again in STAMlmePeriodicExec + pAd->MlmeAux.AutoReconnectSsidLen= 32; + NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen); + + pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC; + MlmeDisassocReqAction(pAd, MsgElem); + kfree(MsgElem); + } + + RTMPusecDelay(1000); + } + + RTMPCancelTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, &Cancelled); + RTMPCancelTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, &Cancelled); + } VIRTUAL_IF_DOWN(pAd); @@ -142,7 +161,9 @@ Note: */ int MainVirtualIF_open(IN struct net_device *net_dev) { - RTMP_ADAPTER *pAd = net_dev->ml_priv; + RTMP_ADAPTER *pAd = NULL; + + GET_PAD_FROM_NET_DEV(pAd, net_dev); // Sanity check for pAd if (pAd == NULL) @@ -184,83 +205,46 @@ Note: int rt28xx_close(IN PNET_DEV dev) { struct net_device * net_dev = (struct net_device *)dev; - RTMP_ADAPTER *pAd = net_dev->ml_priv; - BOOLEAN Cancelled = FALSE; + RTMP_ADAPTER *pAd = NULL; + BOOLEAN Cancelled; UINT32 i = 0; -#ifdef RT2870 - DECLARE_WAIT_QUEUE_HEAD_ONSTACK(unlink_wakeup); + + GET_PAD_FROM_NET_DEV(pAd, net_dev); + +#ifdef RTMP_MAC_USB + DECLARE_WAIT_QUEUE_HEAD(unlink_wakeup); DECLARE_WAITQUEUE(wait, current); //RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS); -#endif // RT2870 // - +#endif // RTMP_MAC_USB // DBGPRINT(RT_DEBUG_TRACE, ("===> rt28xx_close\n")); + Cancelled = FALSE; // Sanity check for pAd if (pAd == NULL) return 0; // close ok { +#ifdef RTMP_PCI_SUPPORT + RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_CLOSE); +#endif // RTMP_PCI_SUPPORT // + // If dirver doesn't wake up firmware here, // NICLoadFirmware will hang forever when interface is up again. -#ifdef RT2860 - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) || - RTMP_SET_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF)) -#endif -#ifdef RT2870 if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) -#endif { -#ifdef RT2860 - AsicForceWakeup(pAd, RTMP_HALT); -#endif -#ifdef RT2870 AsicForceWakeup(pAd, TRUE); -#endif } - if (INFRA_ON(pAd) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) - { - MLME_DISASSOC_REQ_STRUCT DisReq; - MLME_QUEUE_ELEM *MsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); - - COPY_MAC_ADDR(DisReq.Addr, pAd->CommonCfg.Bssid); - DisReq.Reason = REASON_DEAUTH_STA_LEAVING; - - MsgElem->Machine = ASSOC_STATE_MACHINE; - MsgElem->MsgType = MT2_MLME_DISASSOC_REQ; - MsgElem->MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT); - NdisMoveMemory(MsgElem->Msg, &DisReq, sizeof(MLME_DISASSOC_REQ_STRUCT)); - - // Prevent to connect AP again in STAMlmePeriodicExec - pAd->MlmeAux.AutoReconnectSsidLen= 32; - NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen); - - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC; - MlmeDisassocReqAction(pAd, MsgElem); - kfree(MsgElem); - - RTMPusecDelay(1000); - } - -#ifdef RT2870 +#ifdef RTMP_MAC_USB RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS); -#endif // RT2870 // - -#ifdef CCX_SUPPORT - RTMPCancelTimer(&pAd->StaCfg.LeapAuthTimer, &Cancelled); -#endif - - RTMPCancelTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, &Cancelled); - RTMPCancelTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, &Cancelled); +#endif // RTMP_MAC_USB // MlmeRadioOff(pAd); -#ifdef RT2860 +#ifdef RTMP_MAC_PCI pAd->bPCIclkOff = FALSE; -#endif +#endif // RTMP_MAC_PCI // } RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); @@ -269,12 +253,12 @@ int rt28xx_close(IN PNET_DEV dev) { while (pAd->DeQueueRunning[i] == TRUE) { - printk("Waiting for TxQueue[%d] done..........\n", i); + DBGPRINT(RT_DEBUG_TRACE, ("Waiting for TxQueue[%d] done..........\n", i)); RTMPusecDelay(1000); } } -#ifdef RT2870 +#ifdef RTMP_MAC_USB // ensure there are no more active urbs. add_wait_queue (&unlink_wakeup, &wait); pAd->wait = &unlink_wakeup; @@ -299,290 +283,89 @@ int rt28xx_close(IN PNET_DEV dev) } pAd->wait = NULL; remove_wait_queue (&unlink_wakeup, &wait); -#endif // RT2870 // - -#ifdef RT2870 - // We need clear timerQ related structure before exits of the timer thread. - RT2870_TimerQ_Exit(pAd); - // Close kernel threads or tasklets - RT28xxThreadTerminate(pAd); -#endif // RT2870 // +#endif // RTMP_MAC_USB // // Stop Mlme state machine MlmeHalt(pAd); - // Close kernel threads or tasklets - kill_thread_task(pAd); - - MacTableReset(pAd); + // Close net tasklets + RtmpNetTaskExit(pAd); - MeasureReqTabExit(pAd); - TpcReqTabExit(pAd); - -#ifdef RT2860 - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) { - NICDisableInterrupt(pAd); + MacTableReset(pAd); } - // Disable Rx, register value supposed will remain after reset - NICIssueReset(pAd); - // Free IRQ - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - // Deregister interrupt function - RT28XX_IRQ_RELEASE(net_dev) - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE); - } -#endif - - // Free Ring or USB buffers - RTMPFreeTxRxRingMemory(pAd); - - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); - - // Free BA reorder resource - ba_reordering_resource_release(pAd); - - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_START_UP); - - return 0; // close ok -} /* End of rt28xx_close */ - -static int rt28xx_init(IN struct net_device *net_dev) -{ -#ifdef RT2860 - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)net_dev->ml_priv; -#endif -#ifdef RT2870 - PRTMP_ADAPTER pAd = net_dev->ml_priv; -#endif - UINT index; - UCHAR TmpPhy; - NDIS_STATUS Status; - UINT32 MacCsr0 = 0; - - // Allocate BA Reordering memory - ba_reordering_resource_init(pAd, MAX_REORDERING_MPDU_NUM); - - // Make sure MAC gets ready. - index = 0; - do - { - RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0); - pAd->MACVersion = MacCsr0; - - if ((pAd->MACVersion != 0x00) && (pAd->MACVersion != 0xFFFFFFFF)) - break; - - RTMPusecDelay(10); - } while (index++ < 100); + MeasureReqTabExit(pAd); + TpcReqTabExit(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("MAC_CSR0 [ Ver:Rev=0x%08x]\n", pAd->MACVersion)); -/*Iverson patch PCIE L1 issue */ - // Disable DMA - RT28XXDMADisable(pAd); + // Close kernel threads + RtmpMgmtTaskExit(pAd); - // Load 8051 firmware - Status = NICLoadFirmware(pAd); - if (Status != NDIS_STATUS_SUCCESS) +#ifdef RTMP_MAC_PCI { - DBGPRINT_ERR(("NICLoadFirmware failed, Status[=0x%08x]\n", Status)); - goto err1; - } - - NICLoadRateSwitchingParams(pAd); + BOOLEAN brc; + // ULONG Value; - // Disable interrupts here which is as soon as possible - // This statement should never be true. We might consider to remove it later -#ifdef RT2860 if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) { - NICDisableInterrupt(pAd); + RTMP_ASIC_INTERRUPT_DISABLE(pAd); } -#endif - Status = RTMPAllocTxRxRingMemory(pAd); - if (Status != NDIS_STATUS_SUCCESS) - { - DBGPRINT_ERR(("RTMPAllocDMAMemory failed, Status[=0x%08x]\n", Status)); - goto err1; - } + // Receive packets to clear DMA index after disable interrupt. + //RTMPHandleRxDoneInterrupt(pAd); + // put to radio off to save power when driver unload. After radiooff, can't write /read register. So need to finish all + // register access before Radio off. - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE); - // initialize MLME - // - - Status = MlmeInit(pAd); - if (Status != NDIS_STATUS_SUCCESS) + brc=RT28xxPciAsicRadioOff(pAd, RTMP_HALT, 0); + if (brc==FALSE) { - DBGPRINT_ERR(("MlmeInit failed, Status[=0x%08x]\n", Status)); - goto err2; + DBGPRINT(RT_DEBUG_ERROR,("%s call RT28xxPciAsicRadioOff fail !!\n", __func__)); } - - // Initialize pAd->StaCfg, pAd->ApCfg, pAd->CommonCfg to manufacture default - // - UserCfgInit(pAd); - -#ifdef RT2870 - // We need init timerQ related structure before create the timer thread. - RT2870_TimerQ_Init(pAd); -#endif // RT2870 // - - RT28XX_TASK_THREAD_INIT(pAd, Status); - if (Status != NDIS_STATUS_SUCCESS) - goto err1; - - CfgInitHook(pAd); - - NdisAllocateSpinLock(&pAd->MacTabLock); - - MeasureReqTabInit(pAd); - TpcReqTabInit(pAd); - - // - // Init the hardware, we need to init asic before read registry, otherwise mac register will be reset - // - Status = NICInitializeAdapter(pAd, TRUE); - if (Status != NDIS_STATUS_SUCCESS) - { - DBGPRINT_ERR(("NICInitializeAdapter failed, Status[=0x%08x]\n", Status)); - if (Status != NDIS_STATUS_SUCCESS) - goto err3; - } - - // Read parameters from Config File - Status = RTMPReadParametersHook(pAd); - - printk("1. Phy Mode = %d\n", pAd->CommonCfg.PhyMode); - if (Status != NDIS_STATUS_SUCCESS) - { - DBGPRINT_ERR(("NICReadRegParameters failed, Status[=0x%08x]\n",Status)); - goto err4; } -#ifdef RT2870 - pAd->CommonCfg.bMultipleIRP = FALSE; - - if (pAd->CommonCfg.bMultipleIRP) - pAd->CommonCfg.NumOfBulkInIRP = RX_RING_SIZE; - else - pAd->CommonCfg.NumOfBulkInIRP = 1; -#endif // RT2870 // - - - //Init Ba Capability parameters. - pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity; - pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable; - pAd->CommonCfg.DesiredHtPhy.AmsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize; - pAd->CommonCfg.DesiredHtPhy.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode; - // UPdata to HT IE - pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode; - pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize; - pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity; - - printk("2. Phy Mode = %d\n", pAd->CommonCfg.PhyMode); - - // We should read EEPROM for all cases. rt2860b - NICReadEEPROMParameters(pAd, mac); - - printk("3. Phy Mode = %d\n", pAd->CommonCfg.PhyMode); - - NICInitAsicFromEEPROM(pAd); //rt2860b - // Set PHY to appropriate mode - TmpPhy = pAd->CommonCfg.PhyMode; - pAd->CommonCfg.PhyMode = 0xff; - RTMPSetPhyMode(pAd, TmpPhy); - SetCommonHT(pAd); - - // No valid channels. - if (pAd->ChannelListNum == 0) +/* + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) { - printk("Wrong configuration. No valid channel found. Check \"ContryCode\" and \"ChannelGeography\" setting.\n"); - goto err4; + RTMP_ASIC_INTERRUPT_DISABLE(pAd); } - printk("MCS Set = %02x %02x %02x %02x %02x\n", pAd->CommonCfg.HtCapability.MCSSet[0], - pAd->CommonCfg.HtCapability.MCSSet[1], pAd->CommonCfg.HtCapability.MCSSet[2], - pAd->CommonCfg.HtCapability.MCSSet[3], pAd->CommonCfg.HtCapability.MCSSet[4]); - -#ifdef RT2870 - //Init RT30xx RFRegisters after read RFIC type from EEPROM - NICInitRT30xxRFRegisters(pAd); -#endif // RT2870 // - - - // - // Initialize RF register to default value - // - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - -#ifndef RT2870 - // 8051 firmware require the signal during booting time. - AsicSendCommandToMcu(pAd, 0x72, 0xFF, 0x00, 0x00); -#endif + // Disable Rx, register value supposed will remain after reset + NICIssueReset(pAd); +*/ +#endif // RTMP_MAC_PCI // - if (pAd && (Status != NDIS_STATUS_SUCCESS)) - { - // - // Undo everything if it failed - // + // Free IRQ if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { +#ifdef RTMP_MAC_PCI + // Deregister interrupt function + RtmpOSIRQRelease(net_dev); +#endif // RTMP_MAC_PCI // RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE); } - } - else if (pAd) - { - // Microsoft HCT require driver send a disconnect event after driver initialization. - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_MEDIA_STATE_CHANGE); - - DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_DISCONNECT Event B!\n")); - - -#ifdef RT2870 - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS); - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS); - - // - // Support multiple BulkIn IRP, - // the value on pAd->CommonCfg.NumOfBulkInIRP may be large than 1. - // - for(index=0; indexCommonCfg.NumOfBulkInIRP; index++) - { - RTUSBBulkReceive(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("RTUSBBulkReceive!\n" )); - } -#endif // RT2870 // - }// end of else + // Free Ring or USB buffers + RTMPFreeTxRxRingMemory(pAd); - DBGPRINT_S(Status, ("<==== RTMPInitialize, Status=%x\n", Status)); + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); - return TRUE; + // Free BA reorder resource + ba_reordering_resource_release(pAd); -err4: -err3: - MlmeHalt(pAd); -err2: - RTMPFreeTxRxRingMemory(pAd); -err1: - os_free_mem(pAd, pAd->mpdu_blk_pool.mem); // free BA pool - RT28XX_IRQ_RELEASE(net_dev); + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_START_UP); - // shall not set ml_priv to NULL here because the ml_priv didn't been free yet. - //net_dev->ml_priv = 0; +/*+++Modify by woody to solve the bulk fail+++*/ + { + } - printk("!!! %s Initialized fail !!!\n", RT28xx_CHIP_NAME); - return FALSE; -} /* End of rt28xx_init */ + DBGPRINT(RT_DEBUG_TRACE, ("<=== rt28xx_close\n")); + return 0; // close ok +} /* End of rt28xx_close */ /* @@ -603,10 +386,11 @@ Note: int rt28xx_open(IN PNET_DEV dev) { struct net_device * net_dev = (struct net_device *)dev; - PRTMP_ADAPTER pAd = net_dev->ml_priv; + PRTMP_ADAPTER pAd = NULL; int retval = 0; - POS_COOKIE pObj; + //POS_COOKIE pObj; + GET_PAD_FROM_NET_DEV(pAd, net_dev); // Sanity check for pAd if (pAd == NULL) @@ -616,37 +400,32 @@ int rt28xx_open(IN PNET_DEV dev) return -1; } - // Init - pObj = (POS_COOKIE)pAd->OS_Cookie; +#ifdef RTMP_PCI_SUPPORT + RTMPInitPCIeLinkCtrlValue(pAd); +#endif // RTMP_PCI_SUPPORT // - // reset Adapter flags - RTMP_CLEAR_FLAGS(pAd); + + if (net_dev->priv_flags == INT_MAIN) + { + if (pAd->OpMode == OPMODE_STA) + net_dev->wireless_handlers = (struct iw_handler_def *) &rt28xx_iw_handler_def; + } // Request interrupt service routine for PCI device // register the interrupt routine with the os - RT28XX_IRQ_REQUEST(net_dev); - + RtmpOSIRQRequest(net_dev); - // Init BssTab & ChannelInfo tabbles for auto channel select. + // Init IRQ parameters stored in pAd + RTMP_IRQ_INIT(pAd); // Chip & other init - if (rt28xx_init(net_dev) == FALSE) + if (rt28xx_init(pAd, mac, hostname) == FALSE) goto err; - NdisZeroMemory(pAd->StaCfg.dev_name, 16); - NdisMoveMemory(pAd->StaCfg.dev_name, net_dev->name, strlen(net_dev->name)); - - // Set up the Mac address - NdisMoveMemory(net_dev->dev_addr, (void *) pAd->CurrentAddress, 6); - - // Init IRQ parameters - RT28XX_IRQ_INIT(pAd); - - // Various AP function init // Enable Interrupt - RT28XX_IRQ_ENABLE(pAd); + RTMP_IRQ_ENABLE(pAd); // Now Enable RxTx RTMPEnableRxTx(pAd); @@ -658,12 +437,26 @@ int rt28xx_open(IN PNET_DEV dev) printk("0x1300 = %08x\n", reg); } -#ifdef RT2860 - RTMPInitPCIeLinkCtrlValue(pAd); -#endif + { +// u32 reg; +// UINT8 byte; +// u16 tmp; + +// RTMP_IO_READ32(pAd, XIFS_TIME_CFG, ®); + +// tmp = 0x0805; +// reg = (reg & 0xffff0000) | tmp; +// RTMP_IO_WRITE32(pAd, XIFS_TIME_CFG, reg); + + } + + return (retval); err: +//+++Add by shiang, move from rt28xx_init() to here. + RtmpOSIRQRelease(net_dev); +//---Add by shiang, move from rt28xx_init() to here. return (-1); } /* End of rt28xx_open */ @@ -678,155 +471,33 @@ static const struct net_device_ops rt2860_netdev_ops = { .ndo_start_xmit = rt28xx_send_packets, }; -/* Must not be called for mdev and apdev */ -static NDIS_STATUS rt_ieee80211_if_setup(struct net_device *dev, PRTMP_ADAPTER pAd) +PNET_DEV RtmpPhyNetDevInit( + IN RTMP_ADAPTER *pAd, + IN RTMP_OS_NETDEV_OP_HOOK *pNetDevHook) { - NDIS_STATUS Status; - INT i=0; - CHAR slot_name[IFNAMSIZ]; - struct net_device *device; - - if (pAd->OpMode == OPMODE_STA) - { - dev->wireless_handlers = &rt28xx_iw_handler_def; - } - - dev->priv_flags = INT_MAIN; - dev->netdev_ops = &rt2860_netdev_ops; - // find available device name - for (i = 0; i < 8; i++) - { - sprintf(slot_name, "wlan%d", i); - - device = dev_get_by_name(dev_net(dev), slot_name); - if (device != NULL) - dev_put(device); + struct net_device *net_dev = NULL; +// NDIS_STATUS Status; - if (device == NULL) - break; - } - - if(i == 8) - { - DBGPRINT(RT_DEBUG_ERROR, ("No available slot name\n")); - Status = NDIS_STATUS_FAILURE; - } - else - { - sprintf(dev->name, "wlan%d", i); - Status = NDIS_STATUS_SUCCESS; - } - - return Status; - -} - -/* -======================================================================== -Routine Description: - Probe RT28XX chipset. - -Arguments: - _dev_p Point to the PCI or USB device - _dev_id_p Point to the PCI or USB device ID - -Return Value: - 0 Probe OK - -ENODEV Probe Fail - -Note: -======================================================================== -*/ -INT __devinit rt28xx_probe( - IN void *_dev_p, - IN void *_dev_id_p, - IN UINT argc, - OUT PRTMP_ADAPTER *ppAd) -{ - struct net_device *net_dev; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) NULL; - INT status; - PVOID handle; -#ifdef RT2860 - struct pci_dev *dev_p = (struct pci_dev *)_dev_p; -#endif -#ifdef RT2870 - struct usb_interface *intf = (struct usb_interface *)_dev_p; - struct usb_device *dev_p = interface_to_usbdev(intf); - - dev_p = usb_get_dev(dev_p); -#endif // RT2870 // - - DBGPRINT(RT_DEBUG_TRACE, ("STA Driver version-%s\n", STA_DRIVER_VERSION)); - - net_dev = alloc_etherdev(sizeof(PRTMP_ADAPTER)); + net_dev = RtmpOSNetDevCreate(pAd, INT_MAIN, 0, sizeof(PRTMP_ADAPTER), INF_MAIN_DEV_NAME); if (net_dev == NULL) { - printk("alloc_netdev failed\n"); - - goto err_out; + printk("RtmpPhyNetDevInit(): creation failed for main physical net device!\n"); + return NULL; } - netif_stop_queue(net_dev); - -/* for supporting Network Manager */ -/* Set the sysfs physical device reference for the network logical device - * if set prior to registration will cause a symlink during initialization. - */ - SET_NETDEV_DEV(net_dev, &(dev_p->dev)); - - // Allocate RTMP_ADAPTER miniport adapter structure - handle = kmalloc(sizeof(struct os_cookie), GFP_KERNEL); - if (handle == NULL) - goto err_out_free_netdev;; - RT28XX_HANDLE_DEV_ASSIGN(handle, dev_p); - - status = RTMPAllocAdapterBlock(handle, &pAd); - if (status != NDIS_STATUS_SUCCESS) - goto err_out_free_netdev; + NdisZeroMemory((unsigned char *)pNetDevHook, sizeof(RTMP_OS_NETDEV_OP_HOOK)); + pNetDevHook->netdev_ops = &rt2860_netdev_ops; + pNetDevHook->priv_flags = INT_MAIN; + pNetDevHook->needProtcted = FALSE; net_dev->ml_priv = (PVOID)pAd; - pAd->net_dev = net_dev; // must be before RT28XXNetDevInit() - - RT28XXNetDevInit(_dev_p, net_dev, pAd); - - pAd->StaCfg.OriDevType = net_dev->type; - - // Post config - if (RT28XXProbePostConfig(_dev_p, pAd, 0) == FALSE) - goto err_out_unmap; - - pAd->OpMode = OPMODE_STA; - - // sample move - if (rt_ieee80211_if_setup(net_dev, pAd) != NDIS_STATUS_SUCCESS) - goto err_out_unmap; - - // Register this device - status = register_netdev(net_dev); - if (status) - goto err_out_unmap; - - // Set driver data - RT28XX_DRVDATA_SET(_dev_p); - - *ppAd = pAd; - return 0; // probe ok - - - /* --------------------------- ERROR HANDLE --------------------------- */ -err_out_unmap: - RTMPFreeAdapter(pAd); - RT28XX_UNMAP(); + pAd->net_dev = net_dev; -err_out_free_netdev: - free_netdev(net_dev); + netif_stop_queue(net_dev); -err_out: - RT28XX_PUT_DEVICE(dev_p); + return net_dev; - return -ENODEV; /* probe fail */ -} /* End of rt28xx_probe */ +} /* @@ -849,10 +520,14 @@ Note: int rt28xx_packet_xmit(struct sk_buff *skb) { struct net_device *net_dev = skb->dev; - PRTMP_ADAPTER pAd = net_dev->ml_priv; + PRTMP_ADAPTER pAd = NULL; int status = NETDEV_TX_OK; PNDIS_PACKET pPacket = (PNDIS_PACKET) skb; + GET_PAD_FROM_NET_DEV(pAd, net_dev); + + /* RT2870STA does this in RTMPSendPackets() */ + { // Drop send request since we are in monitor mode if (MONITOR_ON(pAd)) @@ -872,12 +547,6 @@ int rt28xx_packet_xmit(struct sk_buff *skb) } RTMP_SET_PACKET_5VT(pPacket, 0); -#ifdef CONFIG_5VT_ENHANCE - if (*(int*)(skb->cb) == BRIDGE_TAG) { - RTMP_SET_PACKET_5VT(pPacket, 1); - } -#endif - STASendPackets((NDIS_HANDLE)pAd, (PPNDIS_PACKET) &pPacket, 1); status = NETDEV_TX_OK; @@ -903,11 +572,14 @@ Return Value: Note: ======================================================================== */ -INT rt28xx_send_packets( +static int rt28xx_send_packets( IN struct sk_buff *skb_p, IN struct net_device *net_dev) { - RTMP_ADAPTER *pAd = net_dev->ml_priv; + RTMP_ADAPTER *pAd = NULL; + + GET_PAD_FROM_NET_DEV(pAd, net_dev); + if (!(net_dev->flags & IFF_UP)) { RELEASE_NDIS_PACKET(pAd, (PNDIS_PACKET)skb_p, NDIS_STATUS_FAILURE); @@ -918,36 +590,35 @@ INT rt28xx_send_packets( RTMP_SET_PACKET_NET_DEVICE_MBSSID(skb_p, MAIN_MBSSID); return rt28xx_packet_xmit(skb_p); - -} /* End of MBSS_VirtualIF_PacketSend */ - - - - -void CfgInitHook(PRTMP_ADAPTER pAd) -{ - pAd->bBroadComHT = TRUE; -} /* End of CfgInitHook */ +} // This function will be called when query /proc struct iw_statistics *rt28xx_get_wireless_stats( IN struct net_device *net_dev) { - PRTMP_ADAPTER pAd = net_dev->ml_priv; + PRTMP_ADAPTER pAd = NULL; + GET_PAD_FROM_NET_DEV(pAd, net_dev); DBGPRINT(RT_DEBUG_TRACE, ("rt28xx_get_wireless_stats --->\n")); pAd->iw_stats.status = 0; // Status - device dependent for now // link quality + if (pAd->OpMode == OPMODE_STA) pAd->iw_stats.qual.qual = ((pAd->Mlme.ChannelQuality * 12)/10 + 10); + if(pAd->iw_stats.qual.qual > 100) pAd->iw_stats.qual.qual = 100; if (pAd->OpMode == OPMODE_STA) - pAd->iw_stats.qual.level = RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, pAd->StaCfg.RssiSample.LastRssi1, pAd->StaCfg.RssiSample.LastRssi2); + { + pAd->iw_stats.qual.level = + RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, + pAd->StaCfg.RssiSample.LastRssi1, + pAd->StaCfg.RssiSample.LastRssi2); + } pAd->iw_stats.qual.noise = pAd->BbpWriteLatch[66]; // noise level (dBm) @@ -962,13 +633,12 @@ struct iw_statistics *rt28xx_get_wireless_stats( DBGPRINT(RT_DEBUG_TRACE, ("<--- rt28xx_get_wireless_stats\n")); return &pAd->iw_stats; -} /* End of rt28xx_get_wireless_stats */ - +} void tbtt_tasklet(unsigned long data) { -#define MAX_TX_IN_TBTT (16) +//#define MAX_TX_IN_TBTT (16) } @@ -988,13 +658,13 @@ void tbtt_tasklet(unsigned long data) ======================================================================== */ -struct net_device_stats *RT28xx_get_ether_stats( +static struct net_device_stats *RT28xx_get_ether_stats( IN struct net_device *net_dev) { RTMP_ADAPTER *pAd = NULL; if (net_dev) - pAd = net_dev->ml_priv; + GET_PAD_FROM_NET_DEV(pAd, net_dev); if (pAd) { @@ -1038,3 +708,55 @@ struct net_device_stats *RT28xx_get_ether_stats( return NULL; } + +BOOLEAN RtmpPhyNetDevExit( + IN RTMP_ADAPTER *pAd, + IN PNET_DEV net_dev) +{ + + + + // Unregister network device + if (net_dev != NULL) + { + printk("RtmpOSNetDevDetach(): RtmpOSNetDeviceDetach(), dev->name=%s!\n", net_dev->name); + RtmpOSNetDevDetach(net_dev); + } + + return TRUE; + +} + + +/* +======================================================================== +Routine Description: + Allocate memory for adapter control block. + +Arguments: + pAd Pointer to our adapter + +Return Value: + NDIS_STATUS_SUCCESS + NDIS_STATUS_FAILURE + NDIS_STATUS_RESOURCES + +Note: +======================================================================== +*/ +NDIS_STATUS AdapterBlockAllocateMemory( + IN PVOID handle, + OUT PVOID *ppAd) +{ + + *ppAd = (PVOID)vmalloc(sizeof(RTMP_ADAPTER)); //pci_alloc_consistent(pci_dev, sizeof(RTMP_ADAPTER), phy_addr); + + if (*ppAd) + { + NdisZeroMemory(*ppAd, sizeof(RTMP_ADAPTER)); + ((PRTMP_ADAPTER)*ppAd)->OS_Cookie = handle; + return (NDIS_STATUS_SUCCESS); + } else { + return (NDIS_STATUS_FAILURE); + } +} diff --git a/drivers/staging/rt2860/rt_pci_rbus.c b/drivers/staging/rt2860/rt_pci_rbus.c new file mode 100644 index 000000000000..b24df06d75cd --- /dev/null +++ b/drivers/staging/rt2860/rt_pci_rbus.c @@ -0,0 +1,877 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + rt_pci_rbus.c + + Abstract: + Create and register network interface. + + Revision History: + Who When What + -------- ---------- ---------------------------------------------- +*/ + +#include "rt_config.h" +#include + +IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance); + +static void rx_done_tasklet(unsigned long data); +static void mgmt_dma_done_tasklet(unsigned long data); +static void ac0_dma_done_tasklet(unsigned long data); +static void ac1_dma_done_tasklet(unsigned long data); +static void ac2_dma_done_tasklet(unsigned long data); +static void ac3_dma_done_tasklet(unsigned long data); +static void fifo_statistic_full_tasklet(unsigned long data); + + + +/*---------------------------------------------------------------------*/ +/* Symbol & Macro Definitions */ +/*---------------------------------------------------------------------*/ +#define RT2860_INT_RX_DLY (1<<0) // bit 0 +#define RT2860_INT_TX_DLY (1<<1) // bit 1 +#define RT2860_INT_RX_DONE (1<<2) // bit 2 +#define RT2860_INT_AC0_DMA_DONE (1<<3) // bit 3 +#define RT2860_INT_AC1_DMA_DONE (1<<4) // bit 4 +#define RT2860_INT_AC2_DMA_DONE (1<<5) // bit 5 +#define RT2860_INT_AC3_DMA_DONE (1<<6) // bit 6 +#define RT2860_INT_HCCA_DMA_DONE (1<<7) // bit 7 +#define RT2860_INT_MGMT_DONE (1<<8) // bit 8 + +#define INT_RX RT2860_INT_RX_DONE + +#define INT_AC0_DLY (RT2860_INT_AC0_DMA_DONE) //| RT2860_INT_TX_DLY) +#define INT_AC1_DLY (RT2860_INT_AC1_DMA_DONE) //| RT2860_INT_TX_DLY) +#define INT_AC2_DLY (RT2860_INT_AC2_DMA_DONE) //| RT2860_INT_TX_DLY) +#define INT_AC3_DLY (RT2860_INT_AC3_DMA_DONE) //| RT2860_INT_TX_DLY) +#define INT_HCCA_DLY (RT2860_INT_HCCA_DMA_DONE) //| RT2860_INT_TX_DLY) +#define INT_MGMT_DLY RT2860_INT_MGMT_DONE + + +/*************************************************************************** + * + * Interface-depended memory allocation/Free related procedures. + * Mainly for Hardware TxDesc/RxDesc/MgmtDesc, DMA Memory for TxData/RxData, etc., + * + **************************************************************************/ +// Function for TxDesc Memory allocation. +void RTMP_AllocateTxDescMemory( + IN PRTMP_ADAPTER pAd, + IN UINT Index, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID *VirtualAddress, + OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) +{ + POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; + + *VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); + +} + + +// Function for MgmtDesc Memory allocation. +void RTMP_AllocateMgmtDescMemory( + IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID *VirtualAddress, + OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) +{ + POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; + + *VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); + +} + + +// Function for RxDesc Memory allocation. +void RTMP_AllocateRxDescMemory( + IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID *VirtualAddress, + OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) +{ + POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; + + *VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); + +} + + +// Function for free allocated Desc Memory. +void RTMP_FreeDescMemory( + IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN PVOID VirtualAddress, + IN NDIS_PHYSICAL_ADDRESS PhysicalAddress) +{ + POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; + + pci_free_consistent(pObj->pci_dev, Length, VirtualAddress, PhysicalAddress); +} + + +// Function for TxData DMA Memory allocation. +void RTMP_AllocateFirstTxBuffer( + IN PRTMP_ADAPTER pAd, + IN UINT Index, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID *VirtualAddress, + OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) +{ + POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; + + *VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); +} + + +void RTMP_FreeFirstTxBuffer( + IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN BOOLEAN Cached, + IN PVOID VirtualAddress, + IN NDIS_PHYSICAL_ADDRESS PhysicalAddress) +{ + POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; + + pci_free_consistent(pObj->pci_dev, Length, VirtualAddress, PhysicalAddress); +} + + +/* + * FUNCTION: Allocate a common buffer for DMA + * ARGUMENTS: + * AdapterHandle: AdapterHandle + * Length: Number of bytes to allocate + * Cached: Whether or not the memory can be cached + * VirtualAddress: Pointer to memory is returned here + * PhysicalAddress: Physical address corresponding to virtual address + */ +void RTMP_AllocateSharedMemory( + IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID *VirtualAddress, + OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) +{ + POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; + + *VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); +} + + +/* + * FUNCTION: Allocate a packet buffer for DMA + * ARGUMENTS: + * AdapterHandle: AdapterHandle + * Length: Number of bytes to allocate + * Cached: Whether or not the memory can be cached + * VirtualAddress: Pointer to memory is returned here + * PhysicalAddress: Physical address corresponding to virtual address + * Notes: + * Cached is ignored: always cached memory + */ +PNDIS_PACKET RTMP_AllocateRxPacketBuffer( + IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID *VirtualAddress, + OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) +{ + struct sk_buff *pkt; + + pkt = dev_alloc_skb(Length); + + if (pkt == NULL) { + DBGPRINT(RT_DEBUG_ERROR, ("can't allocate rx %ld size packet\n",Length)); + } + + if (pkt) { + RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pkt), PKTSRC_NDIS); + *VirtualAddress = (PVOID) pkt->data; + *PhysicalAddress = PCI_MAP_SINGLE(pAd, *VirtualAddress, Length, -1, PCI_DMA_FROMDEVICE); + } else { + *VirtualAddress = (PVOID) NULL; + *PhysicalAddress = (NDIS_PHYSICAL_ADDRESS) NULL; + } + + return (PNDIS_PACKET) pkt; +} + + +VOID Invalid_Remaining_Packet( + IN PRTMP_ADAPTER pAd, + IN ULONG VirtualAddress) +{ + NDIS_PHYSICAL_ADDRESS PhysicalAddress; + + PhysicalAddress = PCI_MAP_SINGLE(pAd, (void *)(VirtualAddress+1600), RX_BUFFER_NORMSIZE-1600, -1, PCI_DMA_FROMDEVICE); +} + + +NDIS_STATUS RtmpNetTaskInit(IN RTMP_ADAPTER *pAd) +{ + POS_COOKIE pObj; + + pObj = (POS_COOKIE) pAd->OS_Cookie; + + tasklet_init(&pObj->rx_done_task, rx_done_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->mgmt_dma_done_task, mgmt_dma_done_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->ac0_dma_done_task, ac0_dma_done_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->ac1_dma_done_task, ac1_dma_done_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->ac2_dma_done_task, ac2_dma_done_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->ac3_dma_done_task, ac3_dma_done_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->tbtt_task, tbtt_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->fifo_statistic_full_task, fifo_statistic_full_tasklet, (unsigned long)pAd); + + return NDIS_STATUS_SUCCESS; +} + + +void RtmpNetTaskExit(IN RTMP_ADAPTER *pAd) +{ + POS_COOKIE pObj; + + pObj = (POS_COOKIE) pAd->OS_Cookie; + + tasklet_kill(&pObj->rx_done_task); + tasklet_kill(&pObj->mgmt_dma_done_task); + tasklet_kill(&pObj->ac0_dma_done_task); + tasklet_kill(&pObj->ac1_dma_done_task); + tasklet_kill(&pObj->ac2_dma_done_task); + tasklet_kill(&pObj->ac3_dma_done_task); + tasklet_kill(&pObj->tbtt_task); + tasklet_kill(&pObj->fifo_statistic_full_task); +} + + +NDIS_STATUS RtmpMgmtTaskInit(IN RTMP_ADAPTER *pAd) +{ + + + return NDIS_STATUS_SUCCESS; +} + + +/* +======================================================================== +Routine Description: + Close kernel threads. + +Arguments: + *pAd the raxx interface data pointer + +Return Value: + NONE + +Note: +======================================================================== +*/ +VOID RtmpMgmtTaskExit( + IN RTMP_ADAPTER *pAd) +{ + + + return; +} + + +static inline void rt2860_int_enable(PRTMP_ADAPTER pAd, unsigned int mode) +{ + u32 regValue; + + pAd->int_disable_mask &= ~(mode); + regValue = pAd->int_enable_reg & ~(pAd->int_disable_mask); + //if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) + { + RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); // 1:enable + } + //else + // DBGPRINT(RT_DEBUG_TRACE, ("fOP_STATUS_DOZE !\n")); + + if (regValue != 0) + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE); +} + + +static inline void rt2860_int_disable(PRTMP_ADAPTER pAd, unsigned int mode) +{ + u32 regValue; + + pAd->int_disable_mask |= mode; + regValue = pAd->int_enable_reg & ~(pAd->int_disable_mask); + RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); // 0: disable + + if (regValue == 0) + { + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE); + } +} + + +/*************************************************************************** + * + * tasklet related procedures. + * + **************************************************************************/ +static void mgmt_dma_done_tasklet(unsigned long data) +{ + unsigned long flags; + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; + INT_SOURCE_CSR_STRUC IntSource; + POS_COOKIE pObj; + + // Do nothing if the driver is starting halt state. + // This might happen when timer already been fired before cancel timer with mlmehalt + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + return; + + pObj = (POS_COOKIE) pAd->OS_Cookie; + +// printk("mgmt_dma_done_process\n"); + IntSource.word = 0; + IntSource.field.MgmtDmaDone = 1; + pAd->int_pending &= ~INT_MGMT_DLY; + + RTMPHandleMgmtRingDmaDoneInterrupt(pAd); + + // if you use RTMP_SEM_LOCK, sometimes kernel will hang up, no any + // bug report output + RTMP_INT_LOCK(&pAd->irq_lock, flags); + /* + * double check to avoid lose of interrupts + */ + if (pAd->int_pending & INT_MGMT_DLY) + { + tasklet_hi_schedule(&pObj->mgmt_dma_done_task); + RTMP_INT_UNLOCK(&pAd->irq_lock, flags); + return; + } + + /* enable TxDataInt again */ + rt2860_int_enable(pAd, INT_MGMT_DLY); + RTMP_INT_UNLOCK(&pAd->irq_lock, flags); +} + + +static void rx_done_tasklet(unsigned long data) +{ + unsigned long flags; + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; + BOOLEAN bReschedule = 0; + POS_COOKIE pObj; + + // Do nothing if the driver is starting halt state. + // This might happen when timer already been fired before cancel timer with mlmehalt + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + return; + + pObj = (POS_COOKIE) pAd->OS_Cookie; + + pAd->int_pending &= ~(INT_RX); + bReschedule = STARxDoneInterruptHandle(pAd, 0); + + RTMP_INT_LOCK(&pAd->irq_lock, flags); + /* + * double check to avoid rotting packet + */ + if (pAd->int_pending & INT_RX || bReschedule) + { + tasklet_hi_schedule(&pObj->rx_done_task); + RTMP_INT_UNLOCK(&pAd->irq_lock, flags); + return; + } + + /* enable RxINT again */ + rt2860_int_enable(pAd, INT_RX); + RTMP_INT_UNLOCK(&pAd->irq_lock, flags); + +} + + +void fifo_statistic_full_tasklet(unsigned long data) +{ + unsigned long flags; + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; + POS_COOKIE pObj; + + // Do nothing if the driver is starting halt state. + // This might happen when timer already been fired before cancel timer with mlmehalt + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + return; + + pObj = (POS_COOKIE) pAd->OS_Cookie; + + pAd->int_pending &= ~(FifoStaFullInt); + NICUpdateFifoStaCounters(pAd); + + RTMP_INT_LOCK(&pAd->irq_lock, flags); + /* + * double check to avoid rotting packet + */ + if (pAd->int_pending & FifoStaFullInt) + { + tasklet_hi_schedule(&pObj->fifo_statistic_full_task); + RTMP_INT_UNLOCK(&pAd->irq_lock, flags); + return; + } + + /* enable RxINT again */ + + rt2860_int_enable(pAd, FifoStaFullInt); + RTMP_INT_UNLOCK(&pAd->irq_lock, flags); + +} + +static void ac3_dma_done_tasklet(unsigned long data) +{ + unsigned long flags; + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; + INT_SOURCE_CSR_STRUC IntSource; + POS_COOKIE pObj; + BOOLEAN bReschedule = 0; + + // Do nothing if the driver is starting halt state. + // This might happen when timer already been fired before cancel timer with mlmehalt + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + return; + + pObj = (POS_COOKIE) pAd->OS_Cookie; + +// printk("ac0_dma_done_process\n"); + IntSource.word = 0; + IntSource.field.Ac3DmaDone = 1; + pAd->int_pending &= ~INT_AC3_DLY; + + bReschedule = RTMPHandleTxRingDmaDoneInterrupt(pAd, IntSource); + + RTMP_INT_LOCK(&pAd->irq_lock, flags); + /* + * double check to avoid lose of interrupts + */ + if ((pAd->int_pending & INT_AC3_DLY) || bReschedule) + { + tasklet_hi_schedule(&pObj->ac3_dma_done_task); + RTMP_INT_UNLOCK(&pAd->irq_lock, flags); + return; + } + + /* enable TxDataInt again */ + rt2860_int_enable(pAd, INT_AC3_DLY); + RTMP_INT_UNLOCK(&pAd->irq_lock, flags); +} + + +static void ac2_dma_done_tasklet(unsigned long data) +{ + unsigned long flags; + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; + INT_SOURCE_CSR_STRUC IntSource; + POS_COOKIE pObj; + BOOLEAN bReschedule = 0; + + // Do nothing if the driver is starting halt state. + // This might happen when timer already been fired before cancel timer with mlmehalt + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + return; + + pObj = (POS_COOKIE) pAd->OS_Cookie; + + IntSource.word = 0; + IntSource.field.Ac2DmaDone = 1; + pAd->int_pending &= ~INT_AC2_DLY; + + bReschedule = RTMPHandleTxRingDmaDoneInterrupt(pAd, IntSource); + + RTMP_INT_LOCK(&pAd->irq_lock, flags); + + /* + * double check to avoid lose of interrupts + */ + if ((pAd->int_pending & INT_AC2_DLY) || bReschedule) + { + tasklet_hi_schedule(&pObj->ac2_dma_done_task); + RTMP_INT_UNLOCK(&pAd->irq_lock, flags); + return; + } + + /* enable TxDataInt again */ + rt2860_int_enable(pAd, INT_AC2_DLY); + RTMP_INT_UNLOCK(&pAd->irq_lock, flags); +} + + +static void ac1_dma_done_tasklet(unsigned long data) +{ + unsigned long flags; + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; + INT_SOURCE_CSR_STRUC IntSource; + POS_COOKIE pObj; + BOOLEAN bReschedule = 0; + + // Do nothing if the driver is starting halt state. + // This might happen when timer already been fired before cancel timer with mlmehalt + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + return; + + pObj = (POS_COOKIE) pAd->OS_Cookie; + +// printk("ac0_dma_done_process\n"); + IntSource.word = 0; + IntSource.field.Ac1DmaDone = 1; + pAd->int_pending &= ~INT_AC1_DLY; + + bReschedule = RTMPHandleTxRingDmaDoneInterrupt(pAd, IntSource); + + RTMP_INT_LOCK(&pAd->irq_lock, flags); + /* + * double check to avoid lose of interrupts + */ + if ((pAd->int_pending & INT_AC1_DLY) || bReschedule) + { + tasklet_hi_schedule(&pObj->ac1_dma_done_task); + RTMP_INT_UNLOCK(&pAd->irq_lock, flags); + return; + } + + /* enable TxDataInt again */ + rt2860_int_enable(pAd, INT_AC1_DLY); + RTMP_INT_UNLOCK(&pAd->irq_lock, flags); +} + + +static void ac0_dma_done_tasklet(unsigned long data) +{ + unsigned long flags; + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; + INT_SOURCE_CSR_STRUC IntSource; + POS_COOKIE pObj; + BOOLEAN bReschedule = 0; + + // Do nothing if the driver is starting halt state. + // This might happen when timer already been fired before cancel timer with mlmehalt + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + return; + + pObj = (POS_COOKIE) pAd->OS_Cookie; + +// printk("ac0_dma_done_process\n"); + IntSource.word = 0; + IntSource.field.Ac0DmaDone = 1; + pAd->int_pending &= ~INT_AC0_DLY; + +// RTMPHandleMgmtRingDmaDoneInterrupt(pAd); + bReschedule = RTMPHandleTxRingDmaDoneInterrupt(pAd, IntSource); + + RTMP_INT_LOCK(&pAd->irq_lock, flags); + /* + * double check to avoid lose of interrupts + */ + if ((pAd->int_pending & INT_AC0_DLY) || bReschedule) + { + tasklet_hi_schedule(&pObj->ac0_dma_done_task); + RTMP_INT_UNLOCK(&pAd->irq_lock, flags); + return; + } + + /* enable TxDataInt again */ + rt2860_int_enable(pAd, INT_AC0_DLY); + RTMP_INT_UNLOCK(&pAd->irq_lock, flags); +} + + + + +/*************************************************************************** + * + * interrupt handler related procedures. + * + **************************************************************************/ +int print_int_count; + +IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) +{ + struct net_device *net_dev = (struct net_device *) dev_instance; + PRTMP_ADAPTER pAd = NULL; + INT_SOURCE_CSR_STRUC IntSource; + POS_COOKIE pObj; + + GET_PAD_FROM_NET_DEV(pAd, net_dev); + + pObj = (POS_COOKIE) pAd->OS_Cookie; + + + /* Note 03312008: we can not return here before + RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IntSource.word); + RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, IntSource.word); + Or kernel will panic after ifconfig ra0 down sometimes */ + + + // + // Inital the Interrupt source. + // + IntSource.word = 0x00000000L; +// McuIntSource.word = 0x00000000L; + + // + // Get the interrupt sources & saved to local variable + // + //RTMP_IO_READ32(pAd, where, &McuIntSource.word); + //RTMP_IO_WRITE32(pAd, , McuIntSource.word); + + // + // Flag fOP_STATUS_DOZE On, means ASIC put to sleep, elase means ASICK WakeUp + // And at the same time, clock maybe turned off that say there is no DMA service. + // when ASIC get to sleep. + // To prevent system hang on power saving. + // We need to check it before handle the INT_SOURCE_CSR, ASIC must be wake up. + // + // RT2661 => when ASIC is sleeping, MAC register cannot be read and written. + // RT2860 => when ASIC is sleeping, MAC register can be read and written. +// if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) + { + RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IntSource.word); + RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, IntSource.word); // write 1 to clear + } +// else +// DBGPRINT(RT_DEBUG_TRACE, (">>>fOP_STATUS_DOZE<<<\n")); + +// RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IsrAfterClear); +// RTMP_IO_READ32(pAd, MCU_INT_SOURCE_CSR, &McuIsrAfterClear); +// DBGPRINT(RT_DEBUG_INFO, ("====> RTMPHandleInterrupt(ISR=%08x,Mcu ISR=%08x, After clear ISR=%08x, MCU ISR=%08x)\n", +// IntSource.word, McuIntSource.word, IsrAfterClear, McuIsrAfterClear)); + + // Do nothing if Reset in progress + if (RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |fRTMP_ADAPTER_HALT_IN_PROGRESS))) + { + return IRQ_HANDLED; + } + + // + // Handle interrupt, walk through all bits + // Should start from highest priority interrupt + // The priority can be adjust by altering processing if statement + // + +#ifdef DBG + +#endif + + + pAd->bPCIclkOff = FALSE; + + // If required spinlock, each interrupt service routine has to acquire + // and release itself. + // + + // Do nothing if NIC doesn't exist + if (IntSource.word == 0xffffffff) + { + RTMP_SET_FLAG(pAd, (fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_HALT_IN_PROGRESS)); + return IRQ_HANDLED; + } + + if (IntSource.word & TxCoherent) + { + DBGPRINT(RT_DEBUG_ERROR, (">>>TxCoherent<<<\n")); + RTMPHandleRxCoherentInterrupt(pAd); + } + + if (IntSource.word & RxCoherent) + { + DBGPRINT(RT_DEBUG_ERROR, (">>>RxCoherent<<<\n")); + RTMPHandleRxCoherentInterrupt(pAd); + } + + if (IntSource.word & FifoStaFullInt) + { + if ((pAd->int_disable_mask & FifoStaFullInt) == 0) + { + /* mask FifoStaFullInt */ + rt2860_int_disable(pAd, FifoStaFullInt); + tasklet_hi_schedule(&pObj->fifo_statistic_full_task); + } + pAd->int_pending |= FifoStaFullInt; + } + + if (IntSource.word & INT_MGMT_DLY) + { + if ((pAd->int_disable_mask & INT_MGMT_DLY) ==0 ) + { + rt2860_int_disable(pAd, INT_MGMT_DLY); + tasklet_hi_schedule(&pObj->mgmt_dma_done_task); + } + pAd->int_pending |= INT_MGMT_DLY ; + } + + if (IntSource.word & INT_RX) + { + if ((pAd->int_disable_mask & INT_RX) == 0) + { + + /* mask RxINT */ + rt2860_int_disable(pAd, INT_RX); + tasklet_hi_schedule(&pObj->rx_done_task); + } + pAd->int_pending |= INT_RX; + } + + if (IntSource.word & INT_AC3_DLY) + { + + if ((pAd->int_disable_mask & INT_AC3_DLY) == 0) + { + /* mask TxDataInt */ + rt2860_int_disable(pAd, INT_AC3_DLY); + tasklet_hi_schedule(&pObj->ac3_dma_done_task); + } + pAd->int_pending |= INT_AC3_DLY; + } + + if (IntSource.word & INT_AC2_DLY) + { + + if ((pAd->int_disable_mask & INT_AC2_DLY) == 0) + { + /* mask TxDataInt */ + rt2860_int_disable(pAd, INT_AC2_DLY); + tasklet_hi_schedule(&pObj->ac2_dma_done_task); + } + pAd->int_pending |= INT_AC2_DLY; + } + + if (IntSource.word & INT_AC1_DLY) + { + + pAd->int_pending |= INT_AC1_DLY; + + if ((pAd->int_disable_mask & INT_AC1_DLY) == 0) + { + /* mask TxDataInt */ + rt2860_int_disable(pAd, INT_AC1_DLY); + tasklet_hi_schedule(&pObj->ac1_dma_done_task); + } + + } + + if (IntSource.word & INT_AC0_DLY) + { + +/* + if (IntSource.word & 0x2) { + u32 reg; + RTMP_IO_READ32(pAd, DELAY_INT_CFG, ®); + printk("IntSource.word = %08x, DELAY_REG = %08x\n", IntSource.word, reg); + } +*/ + pAd->int_pending |= INT_AC0_DLY; + + if ((pAd->int_disable_mask & INT_AC0_DLY) == 0) + { + /* mask TxDataInt */ + rt2860_int_disable(pAd, INT_AC0_DLY); + tasklet_hi_schedule(&pObj->ac0_dma_done_task); + } + + } + + + if (IntSource.word & PreTBTTInt) + { + RTMPHandlePreTBTTInterrupt(pAd); + } + + if (IntSource.word & TBTTInt) + { + RTMPHandleTBTTInterrupt(pAd); + } + + { + if (IntSource.word & AutoWakeupInt) + RTMPHandleTwakeupInterrupt(pAd); + } + + return IRQ_HANDLED; +} + +/* + * invaild or writeback cache + * and convert virtual address to physical address + */ +dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, int sd_idx, int direction) +{ + PRTMP_ADAPTER pAd; + POS_COOKIE pObj; + + /* + ------ Porting Information ------ + > For Tx Alloc: + mgmt packets => sd_idx = 0 + SwIdx: pAd->MgmtRing.TxCpuIdx + pTxD : pAd->MgmtRing.Cell[SwIdx].AllocVa; + + data packets => sd_idx = 1 + TxIdx : pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx + QueIdx: pTxBlk->QueIdx + pTxD : pAd->TxRing[pTxBlk->QueIdx].Cell[TxIdx].AllocVa; + + > For Rx Alloc: + sd_idx = -1 + */ + + pAd = (PRTMP_ADAPTER)handle; + pObj = (POS_COOKIE)pAd->OS_Cookie; + + if (sd_idx == 1) + { + PTX_BLK pTxBlk; + pTxBlk = (PTX_BLK)ptr; + return pci_map_single(pObj->pci_dev, pTxBlk->pSrcBufData, pTxBlk->SrcBufLen, direction); + } + else + { + return pci_map_single(pObj->pci_dev, ptr, size, direction); + } + +} + +void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int direction) +{ + PRTMP_ADAPTER pAd; + POS_COOKIE pObj; + + pAd=(PRTMP_ADAPTER)handle; + pObj = (POS_COOKIE)pAd->OS_Cookie; + + if (size > 0) + pci_unmap_single(pObj->pci_dev, dma_addr, size, direction); + +} diff --git a/drivers/staging/rt2860/rt_profile.c b/drivers/staging/rt2860/rt_profile.c index 3bc41f83f624..4355331a2f2c 100644 --- a/drivers/staging/rt2860/rt_profile.c +++ b/drivers/staging/rt2860/rt_profile.c @@ -23,1840 +23,73 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * * ************************************************************************* - */ -#include "rt_config.h" - -static void HTParametersHook( - IN PRTMP_ADAPTER pAd, - IN CHAR *pValueStr, - IN CHAR *pInput); - -#define ETH_MAC_ADDR_STR_LEN 17 // in format of xx:xx:xx:xx:xx:xx - -// We assume the s1 is a sting, s2 is a memory space with 6 bytes. and content of s1 will be changed. -BOOLEAN rtstrmactohex(char *s1, char *s2) -{ - int i = 0; - char *ptokS = s1, *ptokE = s1; - - if (strlen(s1) != ETH_MAC_ADDR_STR_LEN) - return FALSE; - - while((*ptokS) != '\0') - { - if((ptokE = strchr(ptokS, ':')) != NULL) - *ptokE++ = '\0'; - if ((strlen(ptokS) != 2) || (!isxdigit(*ptokS)) || (!isxdigit(*(ptokS+1)))) - break; // fail - AtoH(ptokS, &s2[i++], 1); - ptokS = ptokE; - if (i == 6) - break; // parsing finished - } - - return ( i == 6 ? TRUE : FALSE); - -} - - -// we assume the s1 and s2 both are strings. -BOOLEAN rtstrcasecmp(char *s1, char *s2) -{ - char *p1 = s1, *p2 = s2; - - if (strlen(s1) != strlen(s2)) - return FALSE; - - while(*p1 != '\0') - { - if((*p1 != *p2) && ((*p1 ^ *p2) != 0x20)) - return FALSE; - p1++; - p2++; - } - - return TRUE; -} - -// we assume the s1 (buffer) and s2 (key) both are strings. -char * rtstrstruncasecmp(char * s1, char * s2) -{ - INT l1, l2, i; - char temp1, temp2; - - l2 = strlen(s2); - if (!l2) - return (char *) s1; - - l1 = strlen(s1); - - while (l1 >= l2) - { - l1--; - - for(i=0; i= l2) - { - l1--; - if (!memcmp(s1,s2,l2)) - return (char *) s1; - s1++; - } - - return NULL; -} - -/** - * rstrtok - Split a string into tokens - * @s: The string to be searched - * @ct: The characters to search for - * * WARNING: strtok is deprecated, use strsep instead. However strsep is not compatible with old architecture. - */ -char * __rstrtok; -char * rstrtok(char * s,const char * ct) -{ - char *sbegin, *send; - - sbegin = s ? s : __rstrtok; - if (!sbegin) - { - return NULL; - } - - sbegin += strspn(sbegin,ct); - if (*sbegin == '\0') - { - __rstrtok = NULL; - return( NULL ); - } - - send = strpbrk( sbegin, ct); - if (send && *send != '\0') - *send++ = '\0'; - - __rstrtok = send; - - return (sbegin); -} - -/** - * delimitcnt - return the count of a given delimiter in a given string. - * @s: The string to be searched. - * @ct: The delimiter to search for. - * Notice : We suppose the delimiter is a single-char string(for example : ";"). - */ -INT delimitcnt(char * s,const char * ct) -{ - INT count = 0; - /* point to the beginning of the line */ - const char *token = s; - - for ( ;; ) - { - token = strpbrk(token, ct); /* search for delimiters */ - - if ( token == NULL ) - { - /* advanced to the terminating null character */ - break; - } - /* skip the delimiter */ - ++token; - - /* - * Print the found text: use len with %.*s to specify field width. - */ - - /* accumulate delimiter count */ - ++count; - } - return count; -} + Module Name: + rt_profile.c -/* - * converts the Internet host address from the standard numbers-and-dots notation - * into binary data. - * returns nonzero if the address is valid, zero if not. - */ -int rtinet_aton(const char *cp, unsigned int *addr) -{ - unsigned int val; - int base, n; - char c; - unsigned int parts[4]; - unsigned int *pp = parts; + Abstract: - for (;;) - { - /* - * Collect number up to ``.''. - * Values are specified as for C: - * 0x=hex, 0=octal, other=decimal. - */ - val = 0; - base = 10; - if (*cp == '0') - { - if (*++cp == 'x' || *cp == 'X') - base = 16, cp++; - else - base = 8; - } - while ((c = *cp) != '\0') - { - if (isdigit((unsigned char) c)) - { - val = (val * base) + (c - '0'); - cp++; - continue; - } - if (base == 16 && isxdigit((unsigned char) c)) - { - val = (val << 4) + - (c + 10 - (islower((unsigned char) c) ? 'a' : 'A')); - cp++; - continue; - } - break; - } - if (*cp == '.') - { - /* - * Internet format: a.b.c.d a.b.c (with c treated as 16-bits) - * a.b (with b treated as 24 bits) - */ - if (pp >= parts + 3 || val > 0xff) - return 0; - *pp++ = val, cp++; - } - else - break; - } - - /* - * Check for trailing junk. + Revision History: + Who When What + --------- ---------- ---------------------------------------------- */ - while (*cp) - if (!isspace((unsigned char) *cp++)) - return 0; - - /* - * Concoct the address according to the number of parts specified. - */ - n = pp - parts + 1; - switch (n) - { - - case 1: /* a -- 32 bits */ - break; - - case 2: /* a.b -- 8.24 bits */ - if (val > 0xffffff) - return 0; - val |= parts[0] << 24; - break; - - case 3: /* a.b.c -- 8.8.16 bits */ - if (val > 0xffff) - return 0; - val |= (parts[0] << 24) | (parts[1] << 16); - break; - - case 4: /* a.b.c.d -- 8.8.8.8 bits */ - if (val > 0xff) - return 0; - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); - break; - } - - *addr = htonl(val); - return 1; - -} - -/* - ======================================================================== - - Routine Description: - Find key section for Get key parameter. - - Arguments: - buffer Pointer to the buffer to start find the key section - section the key of the secion to be find - - Return Value: - NULL Fail - Others Success - ======================================================================== -*/ -PUCHAR RTMPFindSection( - IN PCHAR buffer) -{ - CHAR temp_buf[32]; - PUCHAR ptr; - - strcpy(temp_buf, "Default"); - - if((ptr = rtstrstr(buffer, temp_buf)) != NULL) - return (ptr+strlen("\n")); - else - return NULL; -} - -/* - ======================================================================== - - Routine Description: - Get key parameter. - Arguments: - key Pointer to key string - dest Pointer to destination - destsize The datasize of the destination - buffer Pointer to the buffer to start find the key - - Return Value: - TRUE Success - FALSE Fail - - Note: - This routine get the value with the matched key (case case-sensitive) - ======================================================================== -*/ -INT RTMPGetKeyParameter( - IN PCHAR key, - OUT PCHAR dest, - IN INT destsize, - IN PCHAR buffer) -{ - UCHAR *temp_buf1 = NULL; - UCHAR *temp_buf2 = NULL; - CHAR *start_ptr; - CHAR *end_ptr; - CHAR *ptr; - CHAR *offset = 0; - INT len; - - //temp_buf1 = kmalloc(MAX_PARAM_BUFFER_SIZE, MEM_ALLOC_FLAG); - os_alloc_mem(NULL, &temp_buf1, MAX_PARAM_BUFFER_SIZE); - - if(temp_buf1 == NULL) - return (FALSE); - - //temp_buf2 = kmalloc(MAX_PARAM_BUFFER_SIZE, MEM_ALLOC_FLAG); - os_alloc_mem(NULL, &temp_buf2, MAX_PARAM_BUFFER_SIZE); - if(temp_buf2 == NULL) - { - os_free_mem(NULL, temp_buf1); - return (FALSE); - } - - //find section - if((offset = RTMPFindSection(buffer)) == NULL) - { - os_free_mem(NULL, temp_buf1); - os_free_mem(NULL, temp_buf2); - return (FALSE); - } - - strcpy(temp_buf1, "\n"); - strcat(temp_buf1, key); - strcat(temp_buf1, "="); - - //search key - if((start_ptr=rtstrstr(offset, temp_buf1))==NULL) - { - os_free_mem(NULL, temp_buf1); - os_free_mem(NULL, temp_buf2); - return (FALSE); - } - - start_ptr+=strlen("\n"); - if((end_ptr=rtstrstr(start_ptr, "\n"))==NULL) - end_ptr=start_ptr+strlen(start_ptr); - - if (end_ptr 0) { - os_free_mem(NULL, temp_buf1); - os_free_mem(NULL, temp_buf2); - return (FALSE); + RTMPSetProfileParameters(pAd, buffer); + retval = NDIS_STATUS_SUCCESS; } - - *end_offset = end_ptr - buffer; - - NdisMoveMemory(temp_buf2, start_ptr, end_ptr-start_ptr); - temp_buf2[end_ptr-start_ptr]='\0'; - len = strlen(temp_buf2); - strcpy(temp_buf1, temp_buf2); - if((start_ptr=rtstrstr(temp_buf1, "=")) == NULL) - { - os_free_mem(NULL, temp_buf1); - os_free_mem(NULL, temp_buf2); - return (FALSE); - } - - strcpy(temp_buf2, start_ptr+1); - ptr = temp_buf2; - //trim space or tab - while(*ptr != 0x00) - { - if((bTrimSpace && (*ptr == ' ')) || (*ptr == '\t') ) - ptr++; - else - break; - } - - len = strlen(ptr); - memset(dest, 0x00, destsize); - strncpy(dest, ptr, len >= destsize ? destsize: len); - - os_free_mem(NULL, temp_buf1); - os_free_mem(NULL, temp_buf2); - return TRUE; -} - - -static int rtmp_parse_key_buffer_from_file(IN PRTMP_ADAPTER pAd,IN char *buffer,IN ULONG KeyType,IN INT BSSIdx,IN INT KeyIdx) -{ - PUCHAR keybuff; - INT i = BSSIdx, idx = KeyIdx; - ULONG KeyLen; - UCHAR CipherAlg = CIPHER_WEP64; - - keybuff = buffer; - KeyLen = strlen(keybuff); - - if (KeyType == 1) - {//Ascii - if( (KeyLen == 5) || (KeyLen == 13)) - { - pAd->SharedKey[i][idx].KeyLen = KeyLen; - NdisMoveMemory(pAd->SharedKey[i][idx].Key, keybuff, KeyLen); - if (KeyLen == 5) - CipherAlg = CIPHER_WEP64; - else - CipherAlg = CIPHER_WEP128; - pAd->SharedKey[i][idx].CipherAlg = CipherAlg; - - DBGPRINT(RT_DEBUG_TRACE, ("I/F(wlan%d) Key%dStr=%s and type=%s\n", i, idx+1, keybuff, (KeyType == 0) ? "Hex":"Ascii")); - return 1; - } - else - {//Invalid key length - DBGPRINT(RT_DEBUG_ERROR, ("Key%dStr is Invalid key length! KeyLen = %ld!\n", idx+1, KeyLen)); - return 0; - } - } - else - {//Hex type - if( (KeyLen == 10) || (KeyLen == 26)) - { - pAd->SharedKey[i][idx].KeyLen = KeyLen / 2; - AtoH(keybuff, pAd->SharedKey[i][idx].Key, KeyLen / 2); - if (KeyLen == 10) - CipherAlg = CIPHER_WEP64; - else - CipherAlg = CIPHER_WEP128; - pAd->SharedKey[i][idx].CipherAlg = CipherAlg; - - DBGPRINT(RT_DEBUG_TRACE, ("I/F(wlan%d) Key%dStr=%s and type=%s\n", i, idx+1, keybuff, (KeyType == 0) ? "Hex":"Ascii")); - return 1; - } - else - {//Invalid key length - DBGPRINT(RT_DEBUG_ERROR, ("I/F(wlan%d) Key%dStr is Invalid key length! KeyLen = %ld!\n", i, idx+1, KeyLen)); - return 0; - } - } -} -static void rtmp_read_key_parms_from_file(IN PRTMP_ADAPTER pAd, char *tmpbuf, char *buffer) -{ - char tok_str[16]; - PUCHAR macptr; - INT i = 0, idx; - ULONG KeyType[MAX_MBSSID_NUM]; - ULONG KeyIdx; - - NdisZeroMemory(KeyType, MAX_MBSSID_NUM); - - //DefaultKeyID - if(RTMPGetKeyParameter("DefaultKeyID", tmpbuf, 25, buffer)) - { - { - KeyIdx = simple_strtol(tmpbuf, 0, 10); - if((KeyIdx >= 1 ) && (KeyIdx <= 4)) - pAd->StaCfg.DefaultKeyId = (UCHAR) (KeyIdx - 1); - else - pAd->StaCfg.DefaultKeyId = 0; - - DBGPRINT(RT_DEBUG_TRACE, ("DefaultKeyID(0~3)=%d\n", pAd->StaCfg.DefaultKeyId)); - } - } - - - for (idx = 0; idx < 4; idx++) - { - sprintf(tok_str, "Key%dType", idx + 1); - //Key1Type - if (RTMPGetKeyParameter(tok_str, tmpbuf, 128, buffer)) - { - for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++) - { - KeyType[i] = simple_strtol(macptr, 0, 10); - } - - { - sprintf(tok_str, "Key%dStr", idx + 1); - if (RTMPGetCriticalParameter(tok_str, tmpbuf, 128, buffer)) - { - rtmp_parse_key_buffer_from_file(pAd, tmpbuf, KeyType[BSS0], BSS0, idx); - } - } - } - } -} - -static void rtmp_read_sta_wmm_parms_from_file(IN PRTMP_ADAPTER pAd, char *tmpbuf, char *buffer) -{ - PUCHAR macptr; - INT i=0; - BOOLEAN bWmmEnable = FALSE; - - //WmmCapable - if(RTMPGetKeyParameter("WmmCapable", tmpbuf, 32, buffer)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) //Enable - { - pAd->CommonCfg.bWmmCapable = TRUE; - bWmmEnable = TRUE; - } - else //Disable - { - pAd->CommonCfg.bWmmCapable = FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("WmmCapable=%d\n", pAd->CommonCfg.bWmmCapable)); - } - - //AckPolicy for AC_BK, AC_BE, AC_VI, AC_VO - if(RTMPGetKeyParameter("AckPolicy", tmpbuf, 32, buffer)) - { - for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++) - { - pAd->CommonCfg.AckPolicy[i] = (UCHAR)simple_strtol(macptr, 0, 10); - - DBGPRINT(RT_DEBUG_TRACE, ("AckPolicy[%d]=%d\n", i, pAd->CommonCfg.AckPolicy[i])); - } - } - - if (bWmmEnable) - { - //APSDCapable - if(RTMPGetKeyParameter("APSDCapable", tmpbuf, 10, buffer)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) //Enable - pAd->CommonCfg.bAPSDCapable = TRUE; else - pAd->CommonCfg.bAPSDCapable = FALSE; + DBGPRINT(RT_DEBUG_ERROR, ("Read file \"%s\" failed(errCode=%d)!\n", src, retval)); - DBGPRINT(RT_DEBUG_TRACE, ("APSDCapable=%d\n", pAd->CommonCfg.bAPSDCapable)); - } - - //APSDAC for AC_BE, AC_BK, AC_VI, AC_VO - if(RTMPGetKeyParameter("APSDAC", tmpbuf, 32, buffer)) + retval = RtmpOSFileClose(srcf); + if ( retval != 0) { - BOOLEAN apsd_ac[4]; - - for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++) - { - apsd_ac[i] = (BOOLEAN)simple_strtol(macptr, 0, 10); - - DBGPRINT(RT_DEBUG_TRACE, ("APSDAC%d %d\n", i, apsd_ac[i])); - } - - pAd->CommonCfg.bAPSDAC_BE = apsd_ac[0]; - pAd->CommonCfg.bAPSDAC_BK = apsd_ac[1]; - pAd->CommonCfg.bAPSDAC_VI = apsd_ac[2]; - pAd->CommonCfg.bAPSDAC_VO = apsd_ac[3]; + retval = NDIS_STATUS_FAILURE; + DBGPRINT(RT_DEBUG_ERROR, ("Close file \"%s\" failed(errCode=%d)!\n", src, retval)); } } -} - -NDIS_STATUS RTMPReadParametersHook( - IN PRTMP_ADAPTER pAd) -{ - PUCHAR src = NULL; - struct file *srcf; - INT retval; - mm_segment_t orgfs; - CHAR *buffer; - CHAR *tmpbuf; - ULONG RtsThresh; - ULONG FragThresh; - UCHAR keyMaterial[40]; - - PUCHAR macptr; - INT i = 0; - - buffer = kmalloc(MAX_INI_BUFFER_SIZE, MEM_ALLOC_FLAG); - if(buffer == NULL) - return NDIS_STATUS_FAILURE; - - tmpbuf = kmalloc(MAX_PARAM_BUFFER_SIZE, MEM_ALLOC_FLAG); - if(tmpbuf == NULL) - { - kfree(buffer); - return NDIS_STATUS_FAILURE; - } - - src = STA_PROFILE_PATH; - - orgfs = get_fs(); - set_fs(KERNEL_DS); - - if (src && *src) - { - srcf = filp_open(src, O_RDONLY, 0); - if (IS_ERR(srcf)) - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error %ld opening %s\n", -PTR_ERR(srcf),src)); - } - else - { - // The object must have a read method - if (srcf->f_op && srcf->f_op->read) - { - memset(buffer, 0x00, MAX_INI_BUFFER_SIZE); - retval=srcf->f_op->read(srcf, buffer, MAX_INI_BUFFER_SIZE, &srcf->f_pos); - if (retval < 0) - { - DBGPRINT(RT_DEBUG_TRACE, ("--> Read %s error %d\n", src, -retval)); - } - else - { - // set file parameter to portcfg - //CountryRegion - if(RTMPGetKeyParameter("CountryRegion", tmpbuf, 25, buffer)) - { - pAd->CommonCfg.CountryRegion = (UCHAR) simple_strtol(tmpbuf, 0, 10); - DBGPRINT(RT_DEBUG_TRACE, ("CountryRegion=%d\n", pAd->CommonCfg.CountryRegion)); - } - //CountryRegionABand - if(RTMPGetKeyParameter("CountryRegionABand", tmpbuf, 25, buffer)) - { - pAd->CommonCfg.CountryRegionForABand= (UCHAR) simple_strtol(tmpbuf, 0, 10); - DBGPRINT(RT_DEBUG_TRACE, ("CountryRegionABand=%d\n", pAd->CommonCfg.CountryRegionForABand)); - } - //CountryCode - if(RTMPGetKeyParameter("CountryCode", tmpbuf, 25, buffer)) - { - NdisMoveMemory(pAd->CommonCfg.CountryCode, tmpbuf , 2); - - if (strlen(pAd->CommonCfg.CountryCode) != 0) - { - pAd->CommonCfg.bCountryFlag = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("CountryCode=%s\n", pAd->CommonCfg.CountryCode)); - } - //ChannelGeography - if(RTMPGetKeyParameter("ChannelGeography", tmpbuf, 25, buffer)) - { - UCHAR Geography = (UCHAR) simple_strtol(tmpbuf, 0, 10); - if (Geography <= BOTH) - { - pAd->CommonCfg.Geography = Geography; - pAd->CommonCfg.CountryCode[2] = - (pAd->CommonCfg.Geography == BOTH) ? ' ' : ((pAd->CommonCfg.Geography == IDOR) ? 'I' : 'O'); - DBGPRINT(RT_DEBUG_TRACE, ("ChannelGeography=%d\n", pAd->CommonCfg.Geography)); - } - } - else - { - pAd->CommonCfg.Geography = BOTH; - pAd->CommonCfg.CountryCode[2] = ' '; - } - - { - //SSID - if (RTMPGetCriticalParameter("SSID", tmpbuf, 256, buffer)) - { - if (strlen(tmpbuf) <= 32) - { - pAd->CommonCfg.SsidLen = (UCHAR) strlen(tmpbuf); - NdisZeroMemory(pAd->CommonCfg.Ssid, NDIS_802_11_LENGTH_SSID); - NdisMoveMemory(pAd->CommonCfg.Ssid, tmpbuf, pAd->CommonCfg.SsidLen); - pAd->MlmeAux.AutoReconnectSsidLen = pAd->CommonCfg.SsidLen; - NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, NDIS_802_11_LENGTH_SSID); - NdisMoveMemory(pAd->MlmeAux.AutoReconnectSsid, tmpbuf, pAd->MlmeAux.AutoReconnectSsidLen); - pAd->MlmeAux.SsidLen = pAd->CommonCfg.SsidLen; - NdisZeroMemory(pAd->MlmeAux.Ssid, NDIS_802_11_LENGTH_SSID); - NdisMoveMemory(pAd->MlmeAux.Ssid, tmpbuf, pAd->MlmeAux.SsidLen); - DBGPRINT(RT_DEBUG_TRACE, ("%s::(SSID=%s)\n", __func__, tmpbuf)); - } - } - } - - { - //NetworkType - if (RTMPGetKeyParameter("NetworkType", tmpbuf, 25, buffer)) - { - pAd->bConfigChanged = TRUE; - if (strcmp(tmpbuf, "Adhoc") == 0) - pAd->StaCfg.BssType = BSS_ADHOC; - else //Default Infrastructure mode - pAd->StaCfg.BssType = BSS_INFRA; - // Reset Ralink supplicant to not use, it will be set to start when UI set PMK key - pAd->StaCfg.WpaState = SS_NOTUSE; - DBGPRINT(RT_DEBUG_TRACE, ("%s::(NetworkType=%d)\n", __func__, pAd->StaCfg.BssType)); - } - } - - //Channel - if(RTMPGetKeyParameter("Channel", tmpbuf, 10, buffer)) - { - pAd->CommonCfg.Channel = (UCHAR) simple_strtol(tmpbuf, 0, 10); - DBGPRINT(RT_DEBUG_TRACE, ("Channel=%d\n", pAd->CommonCfg.Channel)); - } - //WirelessMode - if(RTMPGetKeyParameter("WirelessMode", tmpbuf, 10, buffer)) - { - int value = 0, maxPhyMode = PHY_11G; - - maxPhyMode = PHY_11N_5G; - - value = simple_strtol(tmpbuf, 0, 10); - - if (value <= maxPhyMode) - { - pAd->CommonCfg.PhyMode = value; - } - DBGPRINT(RT_DEBUG_TRACE, ("PhyMode=%d\n", pAd->CommonCfg.PhyMode)); - } - //BasicRate - if(RTMPGetKeyParameter("BasicRate", tmpbuf, 10, buffer)) - { - pAd->CommonCfg.BasicRateBitmap = (ULONG) simple_strtol(tmpbuf, 0, 10); - DBGPRINT(RT_DEBUG_TRACE, ("BasicRate=%ld\n", pAd->CommonCfg.BasicRateBitmap)); - } - //BeaconPeriod - if(RTMPGetKeyParameter("BeaconPeriod", tmpbuf, 10, buffer)) - { - pAd->CommonCfg.BeaconPeriod = (USHORT) simple_strtol(tmpbuf, 0, 10); - DBGPRINT(RT_DEBUG_TRACE, ("BeaconPeriod=%d\n", pAd->CommonCfg.BeaconPeriod)); - } - //TxPower - if(RTMPGetKeyParameter("TxPower", tmpbuf, 10, buffer)) - { - pAd->CommonCfg.TxPowerPercentage = (ULONG) simple_strtol(tmpbuf, 0, 10); - - pAd->CommonCfg.TxPowerDefault = pAd->CommonCfg.TxPowerPercentage; - - DBGPRINT(RT_DEBUG_TRACE, ("TxPower=%ld\n", pAd->CommonCfg.TxPowerPercentage)); - } - //BGProtection - if(RTMPGetKeyParameter("BGProtection", tmpbuf, 10, buffer)) - { - switch (simple_strtol(tmpbuf, 0, 10)) - { - case 1: //Always On - pAd->CommonCfg.UseBGProtection = 1; - break; - case 2: //Always OFF - pAd->CommonCfg.UseBGProtection = 2; - break; - case 0: //AUTO - default: - pAd->CommonCfg.UseBGProtection = 0; - break; - } - DBGPRINT(RT_DEBUG_TRACE, ("BGProtection=%ld\n", pAd->CommonCfg.UseBGProtection)); - } - //OLBCDetection - if(RTMPGetKeyParameter("DisableOLBC", tmpbuf, 10, buffer)) - { - switch (simple_strtol(tmpbuf, 0, 10)) - { - case 1: //disable OLBC Detection - pAd->CommonCfg.DisableOLBCDetect = 1; - break; - case 0: //enable OLBC Detection - pAd->CommonCfg.DisableOLBCDetect = 0; - break; - default: - pAd->CommonCfg.DisableOLBCDetect= 0; - break; - } - DBGPRINT(RT_DEBUG_TRACE, ("OLBCDetection=%ld\n", pAd->CommonCfg.DisableOLBCDetect)); - } - //TxPreamble - if(RTMPGetKeyParameter("TxPreamble", tmpbuf, 10, buffer)) - { - switch (simple_strtol(tmpbuf, 0, 10)) - { - case Rt802_11PreambleShort: - pAd->CommonCfg.TxPreamble = Rt802_11PreambleShort; - break; - case Rt802_11PreambleLong: - default: - pAd->CommonCfg.TxPreamble = Rt802_11PreambleLong; - break; - } - DBGPRINT(RT_DEBUG_TRACE, ("TxPreamble=%ld\n", pAd->CommonCfg.TxPreamble)); - } - //RTSThreshold - if(RTMPGetKeyParameter("RTSThreshold", tmpbuf, 10, buffer)) - { - RtsThresh = simple_strtol(tmpbuf, 0, 10); - if( (RtsThresh >= 1) && (RtsThresh <= MAX_RTS_THRESHOLD) ) - pAd->CommonCfg.RtsThreshold = (USHORT)RtsThresh; - else - pAd->CommonCfg.RtsThreshold = MAX_RTS_THRESHOLD; - - DBGPRINT(RT_DEBUG_TRACE, ("RTSThreshold=%d\n", pAd->CommonCfg.RtsThreshold)); - } - //FragThreshold - if(RTMPGetKeyParameter("FragThreshold", tmpbuf, 10, buffer)) - { - FragThresh = simple_strtol(tmpbuf, 0, 10); - pAd->CommonCfg.bUseZeroToDisableFragment = FALSE; - - if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD) - { //illegal FragThresh so we set it to default - pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD; - pAd->CommonCfg.bUseZeroToDisableFragment = TRUE; - } - else if (FragThresh % 2 == 1) - { - // The length of each fragment shall always be an even number of octets, except for the last fragment - // of an MSDU or MMPDU, which may be either an even or an odd number of octets. - pAd->CommonCfg.FragmentThreshold = (USHORT)(FragThresh - 1); - } - else - { - pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh; - } - //pAd->CommonCfg.AllowFragSize = (pAd->CommonCfg.FragmentThreshold) - LENGTH_802_11 - LENGTH_CRC; - DBGPRINT(RT_DEBUG_TRACE, ("FragThreshold=%d\n", pAd->CommonCfg.FragmentThreshold)); - } - //TxBurst - if(RTMPGetKeyParameter("TxBurst", tmpbuf, 10, buffer)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) //Enable - pAd->CommonCfg.bEnableTxBurst = TRUE; - else //Disable - pAd->CommonCfg.bEnableTxBurst = FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("TxBurst=%d\n", pAd->CommonCfg.bEnableTxBurst)); - } - -#ifdef AGGREGATION_SUPPORT - //PktAggregate - if(RTMPGetKeyParameter("PktAggregate", tmpbuf, 10, buffer)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) //Enable - pAd->CommonCfg.bAggregationCapable = TRUE; - else //Disable - pAd->CommonCfg.bAggregationCapable = FALSE; -#ifdef PIGGYBACK_SUPPORT - pAd->CommonCfg.bPiggyBackCapable = pAd->CommonCfg.bAggregationCapable; -#endif // PIGGYBACK_SUPPORT // - DBGPRINT(RT_DEBUG_TRACE, ("PktAggregate=%d\n", pAd->CommonCfg.bAggregationCapable)); - } -#else - pAd->CommonCfg.bAggregationCapable = FALSE; - pAd->CommonCfg.bPiggyBackCapable = FALSE; -#endif // AGGREGATION_SUPPORT // - - // WmmCapable - rtmp_read_sta_wmm_parms_from_file(pAd, tmpbuf, buffer); - - //ShortSlot - if(RTMPGetKeyParameter("ShortSlot", tmpbuf, 10, buffer)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) //Enable - pAd->CommonCfg.bUseShortSlotTime = TRUE; - else //Disable - pAd->CommonCfg.bUseShortSlotTime = FALSE; - - DBGPRINT(RT_DEBUG_TRACE, ("ShortSlot=%d\n", pAd->CommonCfg.bUseShortSlotTime)); - } - //IEEE80211H - if(RTMPGetKeyParameter("IEEE80211H", tmpbuf, 10, buffer)) - { - for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++) - { - if(simple_strtol(macptr, 0, 10) != 0) //Enable - pAd->CommonCfg.bIEEE80211H = TRUE; - else //Disable - pAd->CommonCfg.bIEEE80211H = FALSE; - - DBGPRINT(RT_DEBUG_TRACE, ("IEEE80211H=%d\n", pAd->CommonCfg.bIEEE80211H)); - } - } - //CSPeriod - if(RTMPGetKeyParameter("CSPeriod", tmpbuf, 10, buffer)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) - pAd->CommonCfg.RadarDetect.CSPeriod = simple_strtol(tmpbuf, 0, 10); - else - pAd->CommonCfg.RadarDetect.CSPeriod = 0; - - DBGPRINT(RT_DEBUG_TRACE, ("CSPeriod=%d\n", pAd->CommonCfg.RadarDetect.CSPeriod)); - } - - //RDRegion - if(RTMPGetKeyParameter("RDRegion", tmpbuf, 128, buffer)) - { - if ((strncmp(tmpbuf, "JAP_W53", 7) == 0) || (strncmp(tmpbuf, "jap_w53", 7) == 0)) - { - pAd->CommonCfg.RadarDetect.RDDurRegion = JAP_W53; - pAd->CommonCfg.RadarDetect.DfsSessionTime = 15; - } - else if ((strncmp(tmpbuf, "JAP_W56", 7) == 0) || (strncmp(tmpbuf, "jap_w56", 7) == 0)) - { - pAd->CommonCfg.RadarDetect.RDDurRegion = JAP_W56; - pAd->CommonCfg.RadarDetect.DfsSessionTime = 13; - } - else if ((strncmp(tmpbuf, "JAP", 3) == 0) || (strncmp(tmpbuf, "jap", 3) == 0)) - { - pAd->CommonCfg.RadarDetect.RDDurRegion = JAP; - pAd->CommonCfg.RadarDetect.DfsSessionTime = 5; - } - else if ((strncmp(tmpbuf, "FCC", 3) == 0) || (strncmp(tmpbuf, "fcc", 3) == 0)) - { - pAd->CommonCfg.RadarDetect.RDDurRegion = FCC; - pAd->CommonCfg.RadarDetect.DfsSessionTime = 5; - } - else if ((strncmp(tmpbuf, "CE", 2) == 0) || (strncmp(tmpbuf, "ce", 2) == 0)) - { - pAd->CommonCfg.RadarDetect.RDDurRegion = CE; - pAd->CommonCfg.RadarDetect.DfsSessionTime = 13; - } - else - { - pAd->CommonCfg.RadarDetect.RDDurRegion = CE; - pAd->CommonCfg.RadarDetect.DfsSessionTime = 13; - } - - DBGPRINT(RT_DEBUG_TRACE, ("RDRegion=%d\n", pAd->CommonCfg.RadarDetect.RDDurRegion)); - } - else - { - pAd->CommonCfg.RadarDetect.RDDurRegion = CE; - pAd->CommonCfg.RadarDetect.DfsSessionTime = 13; - } - - //WirelessEvent - if(RTMPGetKeyParameter("WirelessEvent", tmpbuf, 10, buffer)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) - pAd->CommonCfg.bWirelessEvent = simple_strtol(tmpbuf, 0, 10); - else - pAd->CommonCfg.bWirelessEvent = 0; // disable - DBGPRINT(RT_DEBUG_TRACE, ("WirelessEvent=%d\n", pAd->CommonCfg.bWirelessEvent)); - } - if(RTMPGetKeyParameter("WiFiTest", tmpbuf, 10, buffer)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) - pAd->CommonCfg.bWiFiTest= simple_strtol(tmpbuf, 0, 10); - else - pAd->CommonCfg.bWiFiTest = 0; // disable - - DBGPRINT(RT_DEBUG_TRACE, ("WiFiTest=%d\n", pAd->CommonCfg.bWiFiTest)); - } - //AuthMode - if(RTMPGetKeyParameter("AuthMode", tmpbuf, 128, buffer)) - { - { - if ((strcmp(tmpbuf, "WEPAUTO") == 0) || (strcmp(tmpbuf, "wepauto") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeAutoSwitch; - else if ((strcmp(tmpbuf, "SHARED") == 0) || (strcmp(tmpbuf, "shared") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeShared; - else if ((strcmp(tmpbuf, "WPAPSK") == 0) || (strcmp(tmpbuf, "wpapsk") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPAPSK; - else if ((strcmp(tmpbuf, "WPANONE") == 0) || (strcmp(tmpbuf, "wpanone") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPANone; - else if ((strcmp(tmpbuf, "WPA2PSK") == 0) || (strcmp(tmpbuf, "wpa2psk") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPA2PSK; - else if ((strcmp(tmpbuf, "WPA") == 0) || (strcmp(tmpbuf, "wpa") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPA; - else if ((strcmp(tmpbuf, "WPA2") == 0) || (strcmp(tmpbuf, "wpa2") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPA2; - else - pAd->StaCfg.AuthMode = Ndis802_11AuthModeOpen; - - pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - - DBGPRINT(RT_DEBUG_TRACE, ("%s::(EncrypType=%d)\n", __func__, pAd->StaCfg.WepStatus)); - } - } - //EncrypType - if(RTMPGetKeyParameter("EncrypType", tmpbuf, 128, buffer)) - { - { - if ((strcmp(tmpbuf, "WEP") == 0) || (strcmp(tmpbuf, "wep") == 0)) - pAd->StaCfg.WepStatus = Ndis802_11WEPEnabled; - else if ((strcmp(tmpbuf, "TKIP") == 0) || (strcmp(tmpbuf, "tkip") == 0)) - pAd->StaCfg.WepStatus = Ndis802_11Encryption2Enabled; - else if ((strcmp(tmpbuf, "AES") == 0) || (strcmp(tmpbuf, "aes") == 0)) - pAd->StaCfg.WepStatus = Ndis802_11Encryption3Enabled; - else - pAd->StaCfg.WepStatus = Ndis802_11WEPDisabled; - - // Update all wepstatus related - pAd->StaCfg.PairCipher = pAd->StaCfg.WepStatus; - pAd->StaCfg.GroupCipher = pAd->StaCfg.WepStatus; - pAd->StaCfg.OrigWepStatus = pAd->StaCfg.WepStatus; - pAd->StaCfg.bMixCipher = FALSE; - - DBGPRINT(RT_DEBUG_TRACE, ("%s::(EncrypType=%d)\n", __func__, pAd->StaCfg.WepStatus)); - } - } - - { - if(RTMPGetCriticalParameter("WPAPSK", tmpbuf, 512, buffer)) - { - int err=0; - - tmpbuf[strlen(tmpbuf)] = '\0'; // make STA can process .$^& for WPAPSK input - - if ((pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPAPSK) && - (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPA2PSK) && - (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPANone) - ) - { - err = 1; - } - else if ((strlen(tmpbuf) >= 8) && (strlen(tmpbuf) < 64)) - { - PasswordHash((char *)tmpbuf, pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen, keyMaterial); - NdisMoveMemory(pAd->StaCfg.PMK, keyMaterial, 32); - - } - else if (strlen(tmpbuf) == 64) - { - AtoH(tmpbuf, keyMaterial, 32); - NdisMoveMemory(pAd->StaCfg.PMK, keyMaterial, 32); - } - else - { - err = 1; - DBGPRINT(RT_DEBUG_ERROR, ("%s::(WPAPSK key-string required 8 ~ 64 characters!)\n", __func__)); - } - - if (err == 0) - { - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - // Start STA supplicant state machine - pAd->StaCfg.WpaState = SS_START; - } - else if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) - { - pAd->StaCfg.WpaState = SS_NOTUSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("%s::(WPAPSK=%s)\n", __func__, tmpbuf)); - } - } - } - - //DefaultKeyID, KeyType, KeyStr - rtmp_read_key_parms_from_file(pAd, tmpbuf, buffer); - - HTParametersHook(pAd, tmpbuf, buffer); - - { - //PSMode -#ifdef RT2860 - if (RTMPGetKeyParameter("PSMode", tmpbuf, 32, buffer)) -#endif -#ifdef RT2870 - if (RTMPGetKeyParameter("PSMode", tmpbuf, 10, buffer)) -#endif - { - if (pAd->StaCfg.BssType == BSS_INFRA) - { - if ((strcmp(tmpbuf, "MAX_PSP") == 0) || (strcmp(tmpbuf, "max_psp") == 0)) - { - // do NOT turn on PSM bit here, wait until MlmeCheckForPsmChange() - // to exclude certain situations. - // MlmeSetPsm(pAd, PWR_SAVE); - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); - if (pAd->StaCfg.bWindowsACCAMEnable == FALSE) - pAd->StaCfg.WindowsPowerMode = Ndis802_11PowerModeMAX_PSP; - pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeMAX_PSP; - pAd->StaCfg.DefaultListenCount = 5; - } - else if ((strcmp(tmpbuf, "Fast_PSP") == 0) || (strcmp(tmpbuf, "fast_psp") == 0) - || (strcmp(tmpbuf, "FAST_PSP") == 0)) - { - // do NOT turn on PSM bit here, wait until MlmeCheckForPsmChange() - // to exclude certain situations. - // MlmeSetPsmBit(pAd, PWR_SAVE); - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); - if (pAd->StaCfg.bWindowsACCAMEnable == FALSE) - pAd->StaCfg.WindowsPowerMode = Ndis802_11PowerModeFast_PSP; - pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeFast_PSP; - pAd->StaCfg.DefaultListenCount = 3; - } - else if ((strcmp(tmpbuf, "Legacy_PSP") == 0) || (strcmp(tmpbuf, "legacy_psp") == 0) - || (strcmp(tmpbuf, "LEGACY_PSP") == 0)) - { - // do NOT turn on PSM bit here, wait until MlmeCheckForPsmChange() - // to exclude certain situations. - // MlmeSetPsmBit(pAd, PWR_SAVE); - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); - if (pAd->StaCfg.bWindowsACCAMEnable == FALSE) - pAd->StaCfg.WindowsPowerMode = Ndis802_11PowerModeLegacy_PSP; - pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeLegacy_PSP; - pAd->StaCfg.DefaultListenCount = 3; - } - else - { //Default Ndis802_11PowerModeCAM - // clear PSM bit immediately - MlmeSetPsmBit(pAd, PWR_ACTIVE); - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); - if (pAd->StaCfg.bWindowsACCAMEnable == FALSE) - pAd->StaCfg.WindowsPowerMode = Ndis802_11PowerModeCAM; - pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeCAM; - } - DBGPRINT(RT_DEBUG_TRACE, ("PSMode=%ld\n", pAd->StaCfg.WindowsPowerMode)); - } - } - // FastRoaming - if (RTMPGetKeyParameter("FastRoaming", tmpbuf, 32, buffer)) - { - if (simple_strtol(tmpbuf, 0, 10) == 0) - pAd->StaCfg.bFastRoaming = FALSE; - else - pAd->StaCfg.bFastRoaming = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, ("FastRoaming=%d\n", pAd->StaCfg.bFastRoaming)); - } - // RoamThreshold - if (RTMPGetKeyParameter("RoamThreshold", tmpbuf, 32, buffer)) - { - long lInfo = simple_strtol(tmpbuf, 0, 10); - - if (lInfo > 90 || lInfo < 60) - pAd->StaCfg.dBmToRoam = -70; - else - pAd->StaCfg.dBmToRoam = (CHAR)(-1)*lInfo; - - DBGPRINT(RT_DEBUG_TRACE, ("RoamThreshold=%d dBm\n", pAd->StaCfg.dBmToRoam)); - } - - if(RTMPGetKeyParameter("TGnWifiTest", tmpbuf, 10, buffer)) - { - if(simple_strtol(tmpbuf, 0, 10) == 0) - pAd->StaCfg.bTGnWifiTest = FALSE; - else - pAd->StaCfg.bTGnWifiTest = TRUE; - DBGPRINT(RT_DEBUG_TRACE, ("TGnWifiTest=%d\n", pAd->StaCfg.bTGnWifiTest)); - } - } - } - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("--> %s does not have a write method\n", src)); - } - - retval=filp_close(srcf,NULL); - - if (retval) - { - DBGPRINT(RT_DEBUG_TRACE, ("--> Error %d closing %s\n", -retval, src)); - } - } + RtmpOSFSInfoChange(&osFSInfo, FALSE); } - set_fs(orgfs); - kfree(buffer); - kfree(tmpbuf); - - return (NDIS_STATUS_SUCCESS); -} - -static void HTParametersHook( - IN PRTMP_ADAPTER pAd, - IN CHAR *pValueStr, - IN CHAR *pInput) -{ - - INT Value; - - if (RTMPGetKeyParameter("HT_PROTECT", pValueStr, 25, pInput)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bHTProtect = FALSE; - } - else - { - pAd->CommonCfg.bHTProtect = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Protection = %s\n", (Value==0) ? "Disable" : "Enable")); - } - if (RTMPGetKeyParameter("HT_MIMOPSEnable", pValueStr, 25, pInput)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bMIMOPSEnable = FALSE; - } - else - { - pAd->CommonCfg.bMIMOPSEnable = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: MIMOPSEnable = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - - if (RTMPGetKeyParameter("HT_MIMOPSMode", pValueStr, 25, pInput)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value > MMPS_ENABLE) - { - pAd->CommonCfg.BACapability.field.MMPSmode = MMPS_ENABLE; - } - else - { - //TODO: add mimo power saving mechanism - pAd->CommonCfg.BACapability.field.MMPSmode = MMPS_ENABLE; - //pAd->CommonCfg.BACapability.field.MMPSmode = Value; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: MIMOPS Mode = %d\n", Value)); - } - - if (RTMPGetKeyParameter("HT_BADecline", pValueStr, 25, pInput)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bBADecline = FALSE; - } - else - { - pAd->CommonCfg.bBADecline = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: BA Decline = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - - if (RTMPGetKeyParameter("HT_DisableReordering", pValueStr, 25, pInput)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bDisableReordering = FALSE; - } - else - { - pAd->CommonCfg.bDisableReordering = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: DisableReordering = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - if (RTMPGetKeyParameter("HT_AutoBA", pValueStr, 25, pInput)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.BACapability.field.AutoBA = FALSE; - pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE; - } - else - { - pAd->CommonCfg.BACapability.field.AutoBA = TRUE; - pAd->CommonCfg.BACapability.field.Policy = IMMED_BA; - } - pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA; - pAd->CommonCfg.REGBACapability.field.Policy = pAd->CommonCfg.BACapability.field.Policy; - DBGPRINT(RT_DEBUG_TRACE, ("HT: Auto BA = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - // Tx_+HTC frame - if (RTMPGetKeyParameter("HT_HTC", pValueStr, 25, pInput)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->HTCEnable = FALSE; - } - else - { - pAd->HTCEnable = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Tx +HTC frame = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - // Enable HT Link Adaptation Control - if (RTMPGetKeyParameter("HT_LinkAdapt", pValueStr, 25, pInput)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->bLinkAdapt = FALSE; - } - else - { - pAd->HTCEnable = TRUE; - pAd->bLinkAdapt = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Link Adaptation Control = %s\n", (Value==0) ? "Disable" : "Enable(+HTC)")); - } - - // Reverse Direction Mechanism - if (RTMPGetKeyParameter("HT_RDG", pValueStr, 25, pInput)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bRdg = FALSE; - } - else - { - pAd->HTCEnable = TRUE; - pAd->CommonCfg.bRdg = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: RDG = %s\n", (Value==0) ? "Disable" : "Enable(+HTC)")); - } - - - - - // Tx A-MSUD ? - if (RTMPGetKeyParameter("HT_AMSDU", pValueStr, 25, pInput)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.BACapability.field.AmsduEnable = FALSE; - } - else - { - pAd->CommonCfg.BACapability.field.AmsduEnable = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Tx A-MSDU = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - // MPDU Density - if (RTMPGetKeyParameter("HT_MpduDensity", pValueStr, 25, pInput)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value <=7 && Value >= 0) - { - pAd->CommonCfg.BACapability.field.MpduDensity = Value; - DBGPRINT(RT_DEBUG_TRACE, ("HT: MPDU Density = %d\n", Value)); - } - else - { - pAd->CommonCfg.BACapability.field.MpduDensity = 4; - DBGPRINT(RT_DEBUG_TRACE, ("HT: MPDU Density = %d (Default)\n", 4)); - } - } - - // Max Rx BA Window Size - if (RTMPGetKeyParameter("HT_BAWinSize", pValueStr, 25, pInput)) - { - Value = simple_strtol(pValueStr, 0, 10); - - if (Value >=1 && Value <= 64) - { - pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = Value; - pAd->CommonCfg.BACapability.field.RxBAWinLimit = Value; - DBGPRINT(RT_DEBUG_TRACE, ("HT: BA Windw Size = %d\n", Value)); - } - else - { - pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = 64; - pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64; - DBGPRINT(RT_DEBUG_TRACE, ("HT: BA Windw Size = 64 (Defualt)\n")); - } - - } - - // Guard Interval - if (RTMPGetKeyParameter("HT_GI", pValueStr, 25, pInput)) - { - Value = simple_strtol(pValueStr, 0, 10); - - if (Value == GI_400) - { - pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_400; - } - else - { - pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_800; - } - - DBGPRINT(RT_DEBUG_TRACE, ("HT: Guard Interval = %s\n", (Value==GI_400) ? "400" : "800" )); - } - - // HT Operation Mode : Mixed Mode , Green Field - if (RTMPGetKeyParameter("HT_OpMode", pValueStr, 25, pInput)) - { - Value = simple_strtol(pValueStr, 0, 10); - - if (Value == HTMODE_GF) - { - - pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_GF; - } - else - { - pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_MM; - } - - DBGPRINT(RT_DEBUG_TRACE, ("HT: Operate Mode = %s\n", (Value==HTMODE_GF) ? "Green Field" : "Mixed Mode" )); - } - - // Fixed Tx mode : CCK, OFDM - if (RTMPGetKeyParameter("FixedTxMode", pValueStr, 25, pInput)) - { - UCHAR fix_tx_mode; - - { - fix_tx_mode = FIXED_TXMODE_HT; - - if (strcmp(pValueStr, "OFDM") == 0 || strcmp(pValueStr, "ofdm") == 0) - { - fix_tx_mode = FIXED_TXMODE_OFDM; - } - else if (strcmp(pValueStr, "CCK") == 0 || strcmp(pValueStr, "cck") == 0) - { - fix_tx_mode = FIXED_TXMODE_CCK; - } - else if (strcmp(pValueStr, "HT") == 0 || strcmp(pValueStr, "ht") == 0) - { - fix_tx_mode = FIXED_TXMODE_HT; - } - else - { - Value = simple_strtol(pValueStr, 0, 10); - // 1 : CCK - // 2 : OFDM - // otherwise : HT - if (Value == FIXED_TXMODE_CCK || Value == FIXED_TXMODE_OFDM) - fix_tx_mode = Value; - else - fix_tx_mode = FIXED_TXMODE_HT; - } - - pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode = fix_tx_mode; - DBGPRINT(RT_DEBUG_TRACE, ("Fixed Tx Mode = %d\n", fix_tx_mode)); - - } - } - - - // Channel Width - if (RTMPGetKeyParameter("HT_BW", pValueStr, 25, pInput)) - { - Value = simple_strtol(pValueStr, 0, 10); - - if (Value == BW_40) - { - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40; - } - else - { - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - } - -#ifdef MCAST_RATE_SPECIFIC - pAd->CommonCfg.MCastPhyMode.field.BW = pAd->CommonCfg.RegTransmitSetting.field.BW; -#endif // MCAST_RATE_SPECIFIC // - - DBGPRINT(RT_DEBUG_TRACE, ("HT: Channel Width = %s\n", (Value==BW_40) ? "40 MHz" : "20 MHz" )); - } - - if (RTMPGetKeyParameter("HT_EXTCHA", pValueStr, 25, pInput)) - { - Value = simple_strtol(pValueStr, 0, 10); - - if (Value == 0) - { - - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW; - } - else - { - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("HT: Ext Channel = %s\n", (Value==0) ? "BELOW" : "ABOVE" )); - } - - // MSC - if (RTMPGetKeyParameter("HT_MCS", pValueStr, 50, pInput)) - { - { - Value = simple_strtol(pValueStr, 0, 10); - - if ((Value >= 0 && Value <= 23) || (Value == 32)) // 3*3 - { - pAd->StaCfg.DesiredTransmitSetting.field.MCS = Value; - pAd->StaCfg.bAutoTxRateSwitch = FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("HT: MCS = %d\n", pAd->StaCfg.DesiredTransmitSetting.field.MCS)); - } - else - { - pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; - pAd->StaCfg.bAutoTxRateSwitch = TRUE; - DBGPRINT(RT_DEBUG_TRACE, ("HT: MCS = AUTO\n")); - } - } - } - - // STBC - if (RTMPGetKeyParameter("HT_STBC", pValueStr, 25, pInput)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == STBC_USE) - { - pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_USE; - } - else - { - pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_NONE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: STBC = %d\n", pAd->CommonCfg.RegTransmitSetting.field.STBC)); - } - - // 40_Mhz_Intolerant - if (RTMPGetKeyParameter("HT_40MHZ_INTOLERANT", pValueStr, 25, pInput)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bForty_Mhz_Intolerant = FALSE; - } - else - { - pAd->CommonCfg.bForty_Mhz_Intolerant = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: 40MHZ INTOLERANT = %d\n", pAd->CommonCfg.bForty_Mhz_Intolerant)); - } - //HT_TxStream - if(RTMPGetKeyParameter("HT_TxStream", pValueStr, 10, pInput)) - { - switch (simple_strtol(pValueStr, 0, 10)) - { - case 1: - pAd->CommonCfg.TxStream = 1; - break; - case 2: - pAd->CommonCfg.TxStream = 2; - break; - case 3: // 3*3 - default: - pAd->CommonCfg.TxStream = 3; - - if (pAd->MACVersion < RALINK_2883_VERSION) - pAd->CommonCfg.TxStream = 2; // only 2 tx streams for RT2860 series - break; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Tx Stream = %d\n", pAd->CommonCfg.TxStream)); - } - //HT_RxStream - if(RTMPGetKeyParameter("HT_RxStream", pValueStr, 10, pInput)) - { - switch (simple_strtol(pValueStr, 0, 10)) - { - case 1: - pAd->CommonCfg.RxStream = 1; - break; - case 2: - pAd->CommonCfg.RxStream = 2; - break; - case 3: - default: - pAd->CommonCfg.RxStream = 3; - - if (pAd->MACVersion < RALINK_2883_VERSION) - pAd->CommonCfg.RxStream = 2; // only 2 rx streams for RT2860 series - break; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Rx Stream = %d\n", pAd->CommonCfg.RxStream)); - } + return (retval); } + diff --git a/drivers/staging/rt2860/rt_usb.c b/drivers/staging/rt2860/rt_usb.c new file mode 100644 index 000000000000..1e6d347a9663 --- /dev/null +++ b/drivers/staging/rt2860/rt_usb.c @@ -0,0 +1,828 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + rtusb_bulk.c + + Abstract: + + Revision History: + Who When What + -------- ---------- ---------------------------------------------- + Name Date Modification logs + +*/ + +#include "rt_config.h" + + void dump_urb(struct urb* purb) +{ + printk("urb :0x%08lx\n", (unsigned long)purb); + printk("\tdev :0x%08lx\n", (unsigned long)purb->dev); + printk("\t\tdev->state :0x%d\n", purb->dev->state); + printk("\tpipe :0x%08x\n", purb->pipe); + printk("\tstatus :%d\n", purb->status); + printk("\ttransfer_flags :0x%08x\n", purb->transfer_flags); + printk("\ttransfer_buffer :0x%08lx\n", (unsigned long)purb->transfer_buffer); + printk("\ttransfer_buffer_length:%d\n", purb->transfer_buffer_length); + printk("\tactual_length :%d\n", purb->actual_length); + printk("\tsetup_packet :0x%08lx\n", (unsigned long)purb->setup_packet); + printk("\tstart_frame :%d\n", purb->start_frame); + printk("\tnumber_of_packets :%d\n", purb->number_of_packets); + printk("\tinterval :%d\n", purb->interval); + printk("\terror_count :%d\n", purb->error_count); + printk("\tcontext :0x%08lx\n", (unsigned long)purb->context); + printk("\tcomplete :0x%08lx\n\n", (unsigned long)purb->complete); +} + +/* +======================================================================== +Routine Description: + Create kernel threads & tasklets. + +Arguments: + *net_dev Pointer to wireless net device interface + +Return Value: + NDIS_STATUS_SUCCESS + NDIS_STATUS_FAILURE + +Note: +======================================================================== +*/ +NDIS_STATUS RtmpMgmtTaskInit( + IN RTMP_ADAPTER *pAd) +{ + RTMP_OS_TASK *pTask; + NDIS_STATUS status; + + /* + Creat TimerQ Thread, We need init timerQ related structure before create the timer thread. + */ + RtmpTimerQInit(pAd); + + pTask = &pAd->timerTask; + RtmpOSTaskInit(pTask, "RtmpTimerTask", pAd); + status = RtmpOSTaskAttach(pTask, RtmpTimerQThread, pTask); + if (status == NDIS_STATUS_FAILURE) + { + printk (KERN_WARNING "%s: unable to start RtmpTimerQThread\n", RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev)); + return NDIS_STATUS_FAILURE; + } + + /* Creat MLME Thread */ + pTask = &pAd->mlmeTask; + RtmpOSTaskInit(pTask, "RtmpMlmeTask", pAd); + status = RtmpOSTaskAttach(pTask, MlmeThread, pTask); + if (status == NDIS_STATUS_FAILURE) + { + printk (KERN_WARNING "%s: unable to start MlmeThread\n", RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev)); + return NDIS_STATUS_FAILURE; + } + + /* Creat Command Thread */ + pTask = &pAd->cmdQTask; + RtmpOSTaskInit(pTask, "RtmpCmdQTask", pAd); + status = RtmpOSTaskAttach(pTask, RTUSBCmdThread, pTask); + if (status == NDIS_STATUS_FAILURE) + { + printk (KERN_WARNING "%s: unable to start RTUSBCmdThread\n", RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev)); + return NDIS_STATUS_FAILURE; + } + + + return NDIS_STATUS_SUCCESS; +} + + + +/* +======================================================================== +Routine Description: + Close kernel threads. + +Arguments: + *pAd the raxx interface data pointer + +Return Value: + NONE + +Note: +======================================================================== +*/ +VOID RtmpMgmtTaskExit( + IN RTMP_ADAPTER *pAd) +{ + INT ret; + RTMP_OS_TASK *pTask; + + // Sleep 50 milliseconds so pending io might finish normally + RTMPusecDelay(50000); + + // We want to wait until all pending receives and sends to the + // device object. We cancel any + // irps. Wait until sends and receives have stopped. + RTUSBCancelPendingIRPs(pAd); + + // We need clear timerQ related structure before exits of the timer thread. + RtmpTimerQExit(pAd); + + /* Terminate Mlme Thread */ + pTask = &pAd->mlmeTask; + ret = RtmpOSTaskKill(pTask); + if (ret == NDIS_STATUS_FAILURE) + { + DBGPRINT(RT_DEBUG_ERROR, ("%s: kill task(%s) failed!\n", + RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev), pTask->taskName)); + } + + /* Terminate cmdQ thread */ + pTask = &pAd->cmdQTask; +#ifdef KTHREAD_SUPPORT + if (pTask->kthread_task) +#else + CHECK_PID_LEGALITY(pTask->taskPID) +#endif + { + mb(); + NdisAcquireSpinLock(&pAd->CmdQLock); + pAd->CmdQ.CmdQState = RTMP_TASK_STAT_STOPED; + NdisReleaseSpinLock(&pAd->CmdQLock); + mb(); + //RTUSBCMDUp(pAd); + ret = RtmpOSTaskKill(pTask); + if (ret == NDIS_STATUS_FAILURE) + { + DBGPRINT(RT_DEBUG_ERROR, ("%s: kill task(%s) failed!\n", + RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev), pTask->taskName)); + } + pAd->CmdQ.CmdQState = RTMP_TASK_STAT_UNKNOWN; + } + + /* Terminate timer thread */ + pTask = &pAd->timerTask; + ret = RtmpOSTaskKill(pTask); + if (ret == NDIS_STATUS_FAILURE) + { + DBGPRINT(RT_DEBUG_ERROR, ("%s: kill task(%s) failed!\n", + RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev), pTask->taskName)); + } + + +} + + +static void rtusb_dataout_complete(unsigned long data) +{ + PRTMP_ADAPTER pAd; + purbb_t pUrb; + POS_COOKIE pObj; + PHT_TX_CONTEXT pHTTXContext; + UCHAR BulkOutPipeId; + NTSTATUS Status; + unsigned long IrqFlags; + + + pUrb = (purbb_t)data; + pHTTXContext = (PHT_TX_CONTEXT)pUrb->context; + pAd = pHTTXContext->pAd; + pObj = (POS_COOKIE) pAd->OS_Cookie; + Status = pUrb->status; + + // Store BulkOut PipeId + BulkOutPipeId = pHTTXContext->BulkOutPipeId; + pAd->BulkOutDataOneSecCount++; + + //DBGPRINT(RT_DEBUG_LOUD, ("Done-B(%d):I=0x%lx, CWPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", BulkOutPipeId, in_interrupt(), pHTTXContext->CurWritePosition, + // pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad)); + + RTMP_IRQ_LOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); + pAd->BulkOutPending[BulkOutPipeId] = FALSE; + pHTTXContext->IRPPending = FALSE; + pAd->watchDogTxPendingCnt[BulkOutPipeId] = 0; + + if (Status == USB_ST_NOERROR) + { + pAd->BulkOutComplete++; + + RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); + + pAd->Counters8023.GoodTransmits++; + //RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); + FREE_HTTX_RING(pAd, BulkOutPipeId, pHTTXContext); + //RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); + + + } + else // STATUS_OTHER + { + PUCHAR pBuf; + + pAd->BulkOutCompleteOther++; + + pBuf = &pHTTXContext->TransferBuffer->field.WirelessPacket[pHTTXContext->NextBulkOutPosition]; + + if (!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST | + fRTMP_ADAPTER_BULKOUT_RESET))) + { + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); + pAd->bulkResetPipeid = BulkOutPipeId; + pAd->bulkResetReq[BulkOutPipeId] = pAd->BulkOutReq; + } + RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); + + DBGPRINT_RAW(RT_DEBUG_ERROR, ("BulkOutDataPacket failed: ReasonCode=%d!\n", Status)); + DBGPRINT_RAW(RT_DEBUG_ERROR, ("\t>>BulkOut Req=0x%lx, Complete=0x%lx, Other=0x%lx\n", pAd->BulkOutReq, pAd->BulkOutComplete, pAd->BulkOutCompleteOther)); + DBGPRINT_RAW(RT_DEBUG_ERROR, ("\t>>BulkOut Header:%x %x %x %x %x %x %x %x\n", pBuf[0], pBuf[1], pBuf[2], pBuf[3], pBuf[4], pBuf[5], pBuf[6], pBuf[7])); + //DBGPRINT_RAW(RT_DEBUG_ERROR, (">>BulkOutCompleteCancel=0x%x, BulkOutCompleteOther=0x%x\n", pAd->BulkOutCompleteCancel, pAd->BulkOutCompleteOther)); + + } + + // + // bInUse = TRUE, means some process are filling TX data, after that must turn on bWaitingBulkOut + // bWaitingBulkOut = TRUE, means the TX data are waiting for bulk out. + // + //RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); + if ((pHTTXContext->ENextBulkOutPosition != pHTTXContext->CurWritePosition) && + (pHTTXContext->ENextBulkOutPosition != (pHTTXContext->CurWritePosition+8)) && + !RTUSB_TEST_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_FRAG << BulkOutPipeId))) + { + // Indicate There is data avaliable + RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId)); + } + //RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); + + // Always call Bulk routine, even reset bulk. + // The protection of rest bulk should be in BulkOut routine + RTUSBKickBulkOut(pAd); +} + + +static void rtusb_null_frame_done_tasklet(unsigned long data) +{ + PRTMP_ADAPTER pAd; + PTX_CONTEXT pNullContext; + purbb_t pUrb; + NTSTATUS Status; + unsigned long irqFlag; + + + pUrb = (purbb_t)data; + pNullContext = (PTX_CONTEXT)pUrb->context; + pAd = pNullContext->pAd; + Status = pUrb->status; + + // Reset Null frame context flags + RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], irqFlag); + pNullContext->IRPPending = FALSE; + pNullContext->InUse = FALSE; + pAd->BulkOutPending[0] = FALSE; + pAd->watchDogTxPendingCnt[0] = 0; + + if (Status == USB_ST_NOERROR) + { + RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); + + RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); + } + else // STATUS_OTHER + { + if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) + { + DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out Null Frame Failed, ReasonCode=%d!\n", Status)); + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); + pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG); + RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); + } + else + { + RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); + } + } + + // Always call Bulk routine, even reset bulk. + // The protectioon of rest bulk should be in BulkOut routine + RTUSBKickBulkOut(pAd); +} + + +static void rtusb_rts_frame_done_tasklet(unsigned long data) +{ + PRTMP_ADAPTER pAd; + PTX_CONTEXT pRTSContext; + purbb_t pUrb; + NTSTATUS Status; + unsigned long irqFlag; + + + pUrb = (purbb_t)data; + pRTSContext = (PTX_CONTEXT)pUrb->context; + pAd = pRTSContext->pAd; + Status = pUrb->status; + + // Reset RTS frame context flags + RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], irqFlag); + pRTSContext->IRPPending = FALSE; + pRTSContext->InUse = FALSE; + + if (Status == USB_ST_NOERROR) + { + RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); + RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); + } + else // STATUS_OTHER + { + if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) + { + DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out RTS Frame Failed\n")); + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); + pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG); + RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); + } + else + { + RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); + } + } + + RTMP_SEM_LOCK(&pAd->BulkOutLock[pRTSContext->BulkOutPipeId]); + pAd->BulkOutPending[pRTSContext->BulkOutPipeId] = FALSE; + RTMP_SEM_UNLOCK(&pAd->BulkOutLock[pRTSContext->BulkOutPipeId]); + + // Always call Bulk routine, even reset bulk. + // The protectioon of rest bulk should be in BulkOut routine + RTUSBKickBulkOut(pAd); + + +} + + +static void rtusb_pspoll_frame_done_tasklet(unsigned long data) +{ + PRTMP_ADAPTER pAd; + PTX_CONTEXT pPsPollContext; + purbb_t pUrb; + NTSTATUS Status; + + + + pUrb = (purbb_t)data; + pPsPollContext = (PTX_CONTEXT)pUrb->context; + pAd = pPsPollContext->pAd; + Status = pUrb->status; + + // Reset PsPoll context flags + pPsPollContext->IRPPending = FALSE; + pPsPollContext->InUse = FALSE; + pAd->watchDogTxPendingCnt[0] = 0; + + if (Status == USB_ST_NOERROR) + { + RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); + } + else // STATUS_OTHER + { + if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) + { + DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out PSPoll Failed\n")); + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); + pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG); + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); + } + } + + RTMP_SEM_LOCK(&pAd->BulkOutLock[0]); + pAd->BulkOutPending[0] = FALSE; + RTMP_SEM_UNLOCK(&pAd->BulkOutLock[0]); + + // Always call Bulk routine, even reset bulk. + // The protectioon of rest bulk should be in BulkOut routine + RTUSBKickBulkOut(pAd); + +} + + +/* +======================================================================== +Routine Description: + Handle received packets. + +Arguments: + data - URB information pointer + +Return Value: + None + +Note: +======================================================================== +*/ +static void rx_done_tasklet(unsigned long data) +{ + purbb_t pUrb; + PRX_CONTEXT pRxContext; + PRTMP_ADAPTER pAd; + NTSTATUS Status; + unsigned int IrqFlags; + + pUrb = (purbb_t)data; + pRxContext = (PRX_CONTEXT)pUrb->context; + pAd = pRxContext->pAd; + Status = pUrb->status; + + + RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags); + pRxContext->InUse = FALSE; + pRxContext->IRPPending = FALSE; + pRxContext->BulkInOffset += pUrb->actual_length; + //NdisInterlockedDecrement(&pAd->PendingRx); + pAd->PendingRx--; + + if (Status == USB_ST_NOERROR) + { + pAd->BulkInComplete++; + pAd->NextRxBulkInPosition = 0; + if (pRxContext->BulkInOffset) // As jan's comment, it may bulk-in success but size is zero. + { + pRxContext->Readable = TRUE; + INC_RING_INDEX(pAd->NextRxBulkInIndex, RX_RING_SIZE); + } + RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); + } + else // STATUS_OTHER + { + pAd->BulkInCompleteFail++; + // Still read this packet although it may comtain wrong bytes. + pRxContext->Readable = FALSE; + RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); + + // Parsing all packets. because after reset, the index will reset to all zero. + if ((!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | + fRTMP_ADAPTER_BULKIN_RESET | + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST)))) + { + + DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk In Failed. Status=%d, BIIdx=0x%x, BIRIdx=0x%x, actual_length= 0x%x\n", + Status, pAd->NextRxBulkInIndex, pAd->NextRxBulkInReadIndex, pRxContext->pUrb->actual_length)); + + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKIN_RESET); + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_IN, NULL, 0); + } + } + + ASSERT((pRxContext->InUse == pRxContext->IRPPending)); + + RTUSBBulkReceive(pAd); + + + return; + +} + + +static void rtusb_mgmt_dma_done_tasklet(unsigned long data) +{ + PRTMP_ADAPTER pAd; + PTX_CONTEXT pMLMEContext; + int index; + PNDIS_PACKET pPacket; + purbb_t pUrb; + NTSTATUS Status; + unsigned long IrqFlags; + + + pUrb = (purbb_t)data; + pMLMEContext = (PTX_CONTEXT)pUrb->context; + pAd = pMLMEContext->pAd; + Status = pUrb->status; + index = pMLMEContext->SelfIdx; + + ASSERT((pAd->MgmtRing.TxDmaIdx == index)); + + RTMP_IRQ_LOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags); + + + if (Status != USB_ST_NOERROR) + { + //Bulk-Out fail status handle + if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) + { + DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out MLME Failed, Status=%d!\n", Status)); + // TODO: How to handle about the MLMEBulkOut failed issue. Need to resend the mgmt pkt? + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); + pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG); + } + } + + pAd->BulkOutPending[MGMTPIPEIDX] = FALSE; + RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags); + + RTMP_IRQ_LOCK(&pAd->MLMEBulkOutLock, IrqFlags); + // Reset MLME context flags + pMLMEContext->IRPPending = FALSE; + pMLMEContext->InUse = FALSE; + pMLMEContext->bWaitingBulkOut = FALSE; + pMLMEContext->BulkOutSize = 0; + + pPacket = pAd->MgmtRing.Cell[index].pNdisPacket; + pAd->MgmtRing.Cell[index].pNdisPacket = NULL; + + // Increase MgmtRing Index + INC_RING_INDEX(pAd->MgmtRing.TxDmaIdx, MGMT_RING_SIZE); + pAd->MgmtRing.TxSwFreeIdx++; + RTMP_IRQ_UNLOCK(&pAd->MLMEBulkOutLock, IrqFlags); + + // No-matter success or fail, we free the mgmt packet. + if (pPacket) + RTMPFreeNdisPacket(pAd, pPacket); + + if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST)))) + { + // do nothing and return directly. + } + else + { + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET) && + ((pAd->bulkResetPipeid & BULKOUT_MGMT_RESET_FLAG) == BULKOUT_MGMT_RESET_FLAG)) + { // For Mgmt Bulk-Out failed, ignore it now. + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); + } + else + { + + // Always call Bulk routine, even reset bulk. + // The protectioon of rest bulk should be in BulkOut routine + if (pAd->MgmtRing.TxSwFreeIdx < MGMT_RING_SIZE /* pMLMEContext->bWaitingBulkOut == TRUE */) + { + RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_MLME); + } + RTUSBKickBulkOut(pAd); + } + } + + +} + +static void rtusb_ac3_dma_done_tasklet(unsigned long data) +{ + PRTMP_ADAPTER pAd; + PHT_TX_CONTEXT pHTTXContext; + UCHAR BulkOutPipeId = 3; + purbb_t pUrb; + + + pUrb = (purbb_t)data; + pHTTXContext = (PHT_TX_CONTEXT)pUrb->context; + pAd = pHTTXContext->pAd; + + rtusb_dataout_complete((unsigned long)pUrb); + + if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST)))) + { + // do nothing and return directly. + } + else + { + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) + { + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); + } + else + { pHTTXContext = &pAd->TxContext[BulkOutPipeId]; + if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) && + /*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */ + (pAd->DeQueueRunning[BulkOutPipeId] == FALSE) && + (pHTTXContext->bCurWriting == FALSE)) + { + RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS); + } + + RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL<<3); + RTUSBKickBulkOut(pAd); + } + } + + + return; +} + + +static void rtusb_ac2_dma_done_tasklet(unsigned long data) +{ + PRTMP_ADAPTER pAd; + PHT_TX_CONTEXT pHTTXContext; + UCHAR BulkOutPipeId = 2; + purbb_t pUrb; + + + pUrb = (purbb_t)data; + pHTTXContext = (PHT_TX_CONTEXT)pUrb->context; + pAd = pHTTXContext->pAd; + + rtusb_dataout_complete((unsigned long)pUrb); + + if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST)))) + { + // do nothing and return directly. + } + else + { + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) + { + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); + } + else + { pHTTXContext = &pAd->TxContext[BulkOutPipeId]; + if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) && + /*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */ + (pAd->DeQueueRunning[BulkOutPipeId] == FALSE) && + (pHTTXContext->bCurWriting == FALSE)) + { + RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS); + } + + RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL<<2); + RTUSBKickBulkOut(pAd); + } + } + + + return; +} + + +static void rtusb_ac1_dma_done_tasklet(unsigned long data) +{ + PRTMP_ADAPTER pAd; + PHT_TX_CONTEXT pHTTXContext; + UCHAR BulkOutPipeId = 1; + purbb_t pUrb; + + + pUrb = (purbb_t)data; + pHTTXContext = (PHT_TX_CONTEXT)pUrb->context; + pAd = pHTTXContext->pAd; + + rtusb_dataout_complete((unsigned long)pUrb); + + if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST)))) + { + // do nothing and return directly. + } + else + { + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) + { + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); + } + else + { pHTTXContext = &pAd->TxContext[BulkOutPipeId]; + if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) && + /*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */ + (pAd->DeQueueRunning[BulkOutPipeId] == FALSE) && + (pHTTXContext->bCurWriting == FALSE)) + { + RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS); + } + + RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL<<1); + RTUSBKickBulkOut(pAd); + } + } + return; + +} + + +static void rtusb_ac0_dma_done_tasklet(unsigned long data) +{ + PRTMP_ADAPTER pAd; + PHT_TX_CONTEXT pHTTXContext; + UCHAR BulkOutPipeId = 0; + purbb_t pUrb; + + + pUrb = (purbb_t)data; + pHTTXContext = (PHT_TX_CONTEXT)pUrb->context; + pAd = pHTTXContext->pAd; + + rtusb_dataout_complete((unsigned long)pUrb); + + if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST)))) + { + // do nothing and return directly. + } + else + { + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) + { + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); + } + else + { pHTTXContext = &pAd->TxContext[BulkOutPipeId]; + if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) && + /* ((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */ + (pAd->DeQueueRunning[BulkOutPipeId] == FALSE) && + (pHTTXContext->bCurWriting == FALSE)) + { + RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS); + } + + RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL); + RTUSBKickBulkOut(pAd); + } + } + + + return; + +} + + +NDIS_STATUS RtmpNetTaskInit( + IN RTMP_ADAPTER *pAd) +{ + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + + // Create receive tasklet + tasklet_init(&pObj->rx_done_task, rx_done_tasklet, (ULONG)pAd); + tasklet_init(&pObj->mgmt_dma_done_task, rtusb_mgmt_dma_done_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->ac0_dma_done_task, rtusb_ac0_dma_done_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->ac1_dma_done_task, rtusb_ac1_dma_done_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->ac2_dma_done_task, rtusb_ac2_dma_done_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->ac3_dma_done_task, rtusb_ac3_dma_done_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->tbtt_task, tbtt_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->null_frame_complete_task, rtusb_null_frame_done_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->rts_frame_complete_task, rtusb_rts_frame_done_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->pspoll_frame_complete_task, rtusb_pspoll_frame_done_tasklet, (unsigned long)pAd); + + return NDIS_STATUS_SUCCESS; +} + + +void RtmpNetTaskExit(IN RTMP_ADAPTER *pAd) +{ + POS_COOKIE pObj; + + pObj = (POS_COOKIE) pAd->OS_Cookie; + + tasklet_kill(&pObj->rx_done_task); + tasklet_kill(&pObj->mgmt_dma_done_task); + tasklet_kill(&pObj->ac0_dma_done_task); + tasklet_kill(&pObj->ac1_dma_done_task); + tasklet_kill(&pObj->ac2_dma_done_task); + tasklet_kill(&pObj->ac3_dma_done_task); + tasklet_kill(&pObj->tbtt_task); + tasklet_kill(&pObj->null_frame_complete_task); + tasklet_kill(&pObj->rts_frame_complete_task); + tasklet_kill(&pObj->pspoll_frame_complete_task); +} diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h index 90fd40f24734..ee047f8fdf75 100644 --- a/drivers/staging/rt2860/rtmp.h +++ b/drivers/staging/rt2860/rtmp.h @@ -42,140 +42,45 @@ #include "spectrum_def.h" -#include "aironet.h" +#include "rtmp_dot11.h" -#define VIRTUAL_IF_INC(__pAd) ((__pAd)->VirtualIfCnt++) -#define VIRTUAL_IF_DEC(__pAd) ((__pAd)->VirtualIfCnt--) -#define VIRTUAL_IF_NUM(__pAd) ((__pAd)->VirtualIfCnt) +#undef AP_WSC_INCLUDED +#undef STA_WSC_INCLUDED +#undef WSC_INCLUDED -#ifdef RT2870 -//////////////////////////////////////////////////////////////////////////// -// The TX_BUFFER structure forms the transmitted USB packet to the device -//////////////////////////////////////////////////////////////////////////// -typedef struct __TX_BUFFER{ - union { - UCHAR WirelessPacket[TX_BUFFER_NORMSIZE]; - HEADER_802_11 NullFrame; - PSPOLL_FRAME PsPollPacket; - RTS_FRAME RTSFrame; - }field; - UCHAR Aggregation[4]; //Buffer for save Aggregation size. -} TX_BUFFER, *PTX_BUFFER; - -typedef struct __HTTX_BUFFER{ - union { - UCHAR WirelessPacket[MAX_TXBULK_SIZE]; - HEADER_802_11 NullFrame; - PSPOLL_FRAME PsPollPacket; - RTS_FRAME RTSFrame; - }field; - UCHAR Aggregation[4]; //Buffer for save Aggregation size. -} HTTX_BUFFER, *PHTTX_BUFFER; - - -// used to track driver-generated write irps -typedef struct _TX_CONTEXT -{ - PVOID pAd; //Initialized in MiniportInitialize - PURB pUrb; //Initialized in MiniportInitialize - PIRP pIrp; //used to cancel pending bulk out. - //Initialized in MiniportInitialize - PTX_BUFFER TransferBuffer; //Initialized in MiniportInitialize - ULONG BulkOutSize; - UCHAR BulkOutPipeId; - UCHAR SelfIdx; - BOOLEAN InUse; - BOOLEAN bWaitingBulkOut; // at least one packet is in this TxContext, ready for making IRP anytime. - BOOLEAN bFullForBulkOut; // all tx buffer are full , so waiting for tx bulkout. - BOOLEAN IRPPending; - BOOLEAN LastOne; - BOOLEAN bAggregatible; - UCHAR Header_802_3[LENGTH_802_3]; - UCHAR Rsv[2]; - ULONG DataOffset; - UINT TxRate; - dma_addr_t data_dma; // urb dma on linux - -} TX_CONTEXT, *PTX_CONTEXT, **PPTX_CONTEXT; - - -// used to track driver-generated write irps -typedef struct _HT_TX_CONTEXT -{ - PVOID pAd; //Initialized in MiniportInitialize - PURB pUrb; //Initialized in MiniportInitialize - PIRP pIrp; //used to cancel pending bulk out. - //Initialized in MiniportInitialize - PHTTX_BUFFER TransferBuffer; //Initialized in MiniportInitialize - ULONG BulkOutSize; // Indicate the total bulk-out size in bytes in one bulk-transmission - UCHAR BulkOutPipeId; - BOOLEAN IRPPending; - BOOLEAN LastOne; - BOOLEAN bCurWriting; - BOOLEAN bRingEmpty; - BOOLEAN bCopySavePad; - UCHAR SavedPad[8]; - UCHAR Header_802_3[LENGTH_802_3]; - ULONG CurWritePosition; // Indicate the buffer offset which packet will be inserted start from. - ULONG CurWriteRealPos; // Indicate the buffer offset which packet now are writing to. - ULONG NextBulkOutPosition; // Indicate the buffer start offset of a bulk-transmission - ULONG ENextBulkOutPosition; // Indicate the buffer end offset of a bulk-transmission - UINT TxRate; - dma_addr_t data_dma; // urb dma on linux -} HT_TX_CONTEXT, *PHT_TX_CONTEXT, **PPHT_TX_CONTEXT; -// -// Structure to keep track of receive packets and buffers to indicate -// receive data to the protocol. -// -typedef struct _RX_CONTEXT -{ - PUCHAR TransferBuffer; - PVOID pAd; - PIRP pIrp;//used to cancel pending bulk in. - PURB pUrb; - //These 2 Boolean shouldn't both be 1 at the same time. - ULONG BulkInOffset; // number of packets waiting for reordering . - BOOLEAN bRxHandling; // Notify this packet is being process now. - BOOLEAN InUse; // USB Hardware Occupied. Wait for USB HW to put packet. - BOOLEAN Readable; // Receive Complete back. OK for driver to indicate receiving packet. - BOOLEAN IRPPending; // TODO: To be removed - atomic_t IrpLock; - NDIS_SPIN_LOCK RxContextLock; - dma_addr_t data_dma; // urb dma on linux -} RX_CONTEXT, *PRX_CONTEXT; -#endif // RT2870 // +#if defined(AP_WSC_INCLUDED) || defined(STA_WSC_INCLUDED) +#define WSC_INCLUDED +#endif +#include "rtmp_chip.h" -// -// NDIS Version definitions -// -#ifdef NDIS50_MINIPORT -#define RTMP_NDIS_MAJOR_VERSION 5 -#define RTMP_NDIS_MINOR_VERSION 0 -#endif -#ifdef NDIS51_MINIPORT -#define RTMP_NDIS_MAJOR_VERSION 5 -#define RTMP_NDIS_MINOR_VERSION 1 -#endif -extern char NIC_VENDOR_DESC[]; -extern int NIC_VENDOR_DESC_LEN; +typedef struct _RTMP_ADAPTER RTMP_ADAPTER; +typedef struct _RTMP_ADAPTER *PRTMP_ADAPTER; + +typedef struct _RTMP_CHIP_OP_ RTMP_CHIP_OP; + + +//#define DBG 1 + +//#define DBG_DIAGNOSE 1 + + +//+++Add by shiang for merge MiniportMMRequest() and MiniportDataMMRequest() into one function +#define MAX_DATAMM_RETRY 3 +#define MGMT_USE_QUEUE_FLAG 0x80 +//---Add by shiang for merge MiniportMMRequest() and MiniportDataMMRequest() into one function + +#define MAXSEQ (0xFFF) extern unsigned char SNAP_AIRONET[]; -extern unsigned char CipherSuiteCiscoCCKM[]; -extern unsigned char CipherSuiteCiscoCCKMLen; -extern unsigned char CipherSuiteCiscoCCKM24[]; -extern unsigned char CipherSuiteCiscoCCKM24Len; -extern unsigned char CipherSuiteCCXTkip[]; -extern unsigned char CipherSuiteCCXTkipLen; extern unsigned char CISCO_OUI[]; extern UCHAR BaSizeArray[4]; extern UCHAR BROADCAST_ADDR[MAC_ADDR_LEN]; -extern UCHAR MULTICAST_ADDR[MAC_ADDR_LEN]; extern UCHAR ZERO_MAC_ADDR[MAC_ADDR_LEN]; extern ULONG BIT32[32]; extern UCHAR BIT8[8]; @@ -231,9 +136,11 @@ extern UCHAR WpaIe; extern UCHAR Wpa2Ie; extern UCHAR IbssIe; extern UCHAR Ccx2Ie; +extern UCHAR WapiIe; extern UCHAR WPA_OUI[]; extern UCHAR RSN_OUI[]; +extern UCHAR WAPI_OUI[]; extern UCHAR WME_INFO_ELEM[]; extern UCHAR WME_PARM_ELEM[]; extern UCHAR Ccx2QosInfo[]; @@ -256,28 +163,8 @@ extern UCHAR RateSwitchTable11N2SForABand[]; extern UCHAR PRE_N_HT_OUI[]; -#define MAXSEQ (0xFFF) - -struct reordering_mpdu -{ - struct reordering_mpdu *next; - PNDIS_PACKET pPacket; /* coverted to 802.3 frame */ - int Sequence; /* sequence number of MPDU */ - BOOLEAN bAMSDU; -}; -struct reordering_list -{ - struct reordering_mpdu *next; - int qlen; -}; -struct reordering_mpdu_pool -{ - PVOID mem; - NDIS_SPIN_LOCK lock; - struct reordering_list freelist; -}; typedef struct _RSSI_SAMPLE { CHAR LastRssi0; // last received RSSI @@ -318,6 +205,7 @@ typedef struct _QUEUE_HEADER { if ((QueueHeader)->Head != NULL) \ { \ pNext = (QueueHeader)->Head->Next; \ + (QueueHeader)->Head->Next = NULL; \ (QueueHeader)->Head = pNext; \ if (pNext == NULL) \ (QueueHeader)->Tail = NULL; \ @@ -345,6 +233,19 @@ typedef struct _QUEUE_HEADER { (QueueHeader)->Number++; \ } +#define InsertTailQueueAc(pAd, pEntry, QueueHeader, QueueEntry) \ +{ \ + ((PQUEUE_ENTRY)QueueEntry)->Next = NULL; \ + if ((QueueHeader)->Tail) \ + (QueueHeader)->Tail->Next = (PQUEUE_ENTRY)(QueueEntry); \ + else \ + (QueueHeader)->Head = (PQUEUE_ENTRY)(QueueEntry); \ + (QueueHeader)->Tail = (PQUEUE_ENTRY)(QueueEntry); \ + (QueueHeader)->Number++; \ +} + + + // // Macros for flag and ref count operations // @@ -353,15 +254,12 @@ typedef struct _QUEUE_HEADER { #define RTMP_CLEAR_FLAGS(_M) ((_M)->Flags = 0) #define RTMP_TEST_FLAG(_M, _F) (((_M)->Flags & (_F)) != 0) #define RTMP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F)) - -#ifdef RT2860 // Macro for power save flag. #define RTMP_SET_PSFLAG(_M, _F) ((_M)->PSFlags |= (_F)) #define RTMP_CLEAR_PSFLAG(_M, _F) ((_M)->PSFlags &= ~(_F)) #define RTMP_CLEAR_PSFLAGS(_M) ((_M)->PSFlags = 0) #define RTMP_TEST_PSFLAG(_M, _F) (((_M)->PSFlags & (_F)) != 0) #define RTMP_TEST_PSFLAGS(_M, _F) (((_M)->PSFlags & (_F)) == (_F)) -#endif #define OPSTATUS_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags |= (_F)) #define OPSTATUS_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags &= ~(_F)) @@ -391,51 +289,6 @@ typedef struct _QUEUE_HEADER { (_idx) = (_idx+1) % (_RingSize); \ } -#ifdef RT2870 -// We will have a cost down version which mac version is 0x3090xxxx -#define IS_RT3090(_pAd) ((((_pAd)->MACVersion & 0xffff0000) == 0x30710000) || (((_pAd)->MACVersion & 0xffff0000) == 0x30900000)) -#else -#define IS_RT3090(_pAd) 0 -#endif -#define IS_RT3070(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x30700000) -#ifdef RT2870 -#define IS_RT3071(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x30710000) -#define IS_RT30xx(_pAd) (((_pAd)->MACVersion & 0xfff00000) == 0x30700000) -#endif - -#define RING_PACKET_INIT(_TxRing, _idx) \ -{ \ - _TxRing->Cell[_idx].pNdisPacket = NULL; \ - _TxRing->Cell[_idx].pNextNdisPacket = NULL; \ -} - -#define TXDT_INIT(_TxD) \ -{ \ - NdisZeroMemory(_TxD, TXD_SIZE); \ - _TxD->DMADONE = 1; \ -} - -//Set last data segment -#define RING_SET_LASTDS(_TxD, _IsSD0) \ -{ \ - if (_IsSD0) {_TxD->LastSec0 = 1;} \ - else {_TxD->LastSec1 = 1;} \ -} - -// Increase TxTsc value for next transmission -// TODO: -// When i==6, means TSC has done one full cycle, do re-keying stuff follow specs -// Should send a special event microsoft defined to request re-key -#define INC_TX_TSC(_tsc) \ -{ \ - int i=0; \ - while (++_tsc[i] == 0x0) \ - { \ - i++; \ - if (i == 6) \ - break; \ - } \ -} // StaActive.SupportedHtPhy.MCSSet is copied from AP beacon. Don't need to update here. #define COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(_pAd) \ @@ -475,301 +328,12 @@ typedef struct _QUEUE_HEADER { // ULONG Value) // -// -// BBP & RF are using indirect access. Before write any value into it. -// We have to make sure there is no outstanding command pending via checking busy bit. -// -#define MAX_BUSY_COUNT 100 // Number of retry before failing access BBP & RF indirect register -// -#ifdef RT2860 -#define RTMP_RF_IO_WRITE32(_A, _V) \ -{ \ - PHY_CSR4_STRUC Value; \ - ULONG BusyCnt = 0; \ - if ((_A)->bPCIclkOff) \ - { \ - return; \ - } \ - do { \ - RTMP_IO_READ32(_A, RF_CSR_CFG0, &Value.word); \ - if (Value.field.Busy == IDLE) \ - break; \ - BusyCnt++; \ - } while (BusyCnt < MAX_BUSY_COUNT); \ - if (BusyCnt < MAX_BUSY_COUNT) \ - { \ - RTMP_IO_WRITE32(_A, RF_CSR_CFG0, _V); \ - } \ -} - -#define BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \ -{ \ - BBP_CSR_CFG_STRUC BbpCsr; \ - int i, k; \ - for (i=0; iBbpWriteLatch[_I]; \ - } \ -} - -//#define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) {} -// Read BBP register by register's ID. Generate PER to test BA -#define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \ -{ \ - BBP_CSR_CFG_STRUC BbpCsr; \ - int i, k; \ - if ((_A)->bPCIclkOff == FALSE) \ - { \ - for (i=0; iBbpWriteLatch[_I]; \ - RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \ - BbpCsr.field.Busy = 0; \ - RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \ - } \ - } \ -} - -#define BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \ -{ \ - BBP_CSR_CFG_STRUC BbpCsr; \ - int BusyCnt; \ - for (BusyCnt=0; BusyCntBbpWriteLatch[_I] = _V; \ - break; \ - } \ - if (BusyCnt == MAX_BUSY_COUNT) \ - { \ - DBGPRINT_ERR(("BBP write R%d fail\n", _I)); \ - } \ -} - -// Write BBP register by register's ID & value -#define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \ -{ \ - BBP_CSR_CFG_STRUC BbpCsr; \ - int BusyCnt; \ - if ((_A)->bPCIclkOff == FALSE) \ - { \ - for (BusyCnt=0; BusyCntOpMode == OPMODE_AP) \ - RTMPusecDelay(1000); \ - (_A)->BbpWriteLatch[_I] = _V; \ - break; \ - } \ - if (BusyCnt == MAX_BUSY_COUNT) \ - { \ - DBGPRINT_ERR(("BBP write R%d=0x%x fail\n", _I, BbpCsr.word)); \ - RTMP_IO_READ32(_A, H2M_BBP_AGENT, &BbpCsr.word); \ - BbpCsr.field.Busy = 0; \ - RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \ - } \ - } \ -} -#endif /* RT2860 */ -#ifdef RT2870 -#define RTMP_RF_IO_WRITE32(_A, _V) RTUSBWriteRFRegister(_A, _V) -#define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) RTUSBReadBBPRegister(_A, _I, _pV) -#define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) RTUSBWriteBBPRegister(_A, _I, _V) - -#define BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) RTUSBWriteBBPRegister(_A, _I, _V) -#define BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) RTUSBReadBBPRegister(_A, _I, _pV) -#endif // RT2870 // - -#define MAP_CHANNEL_ID_TO_KHZ(ch, khz) { \ - switch (ch) \ - { \ - case 1: khz = 2412000; break; \ - case 2: khz = 2417000; break; \ - case 3: khz = 2422000; break; \ - case 4: khz = 2427000; break; \ - case 5: khz = 2432000; break; \ - case 6: khz = 2437000; break; \ - case 7: khz = 2442000; break; \ - case 8: khz = 2447000; break; \ - case 9: khz = 2452000; break; \ - case 10: khz = 2457000; break; \ - case 11: khz = 2462000; break; \ - case 12: khz = 2467000; break; \ - case 13: khz = 2472000; break; \ - case 14: khz = 2484000; break; \ - case 36: /* UNII */ khz = 5180000; break; \ - case 40: /* UNII */ khz = 5200000; break; \ - case 44: /* UNII */ khz = 5220000; break; \ - case 48: /* UNII */ khz = 5240000; break; \ - case 52: /* UNII */ khz = 5260000; break; \ - case 56: /* UNII */ khz = 5280000; break; \ - case 60: /* UNII */ khz = 5300000; break; \ - case 64: /* UNII */ khz = 5320000; break; \ - case 149: /* UNII */ khz = 5745000; break; \ - case 153: /* UNII */ khz = 5765000; break; \ - case 157: /* UNII */ khz = 5785000; break; \ - case 161: /* UNII */ khz = 5805000; break; \ - case 165: /* UNII */ khz = 5825000; break; \ - case 100: /* HiperLAN2 */ khz = 5500000; break; \ - case 104: /* HiperLAN2 */ khz = 5520000; break; \ - case 108: /* HiperLAN2 */ khz = 5540000; break; \ - case 112: /* HiperLAN2 */ khz = 5560000; break; \ - case 116: /* HiperLAN2 */ khz = 5580000; break; \ - case 120: /* HiperLAN2 */ khz = 5600000; break; \ - case 124: /* HiperLAN2 */ khz = 5620000; break; \ - case 128: /* HiperLAN2 */ khz = 5640000; break; \ - case 132: /* HiperLAN2 */ khz = 5660000; break; \ - case 136: /* HiperLAN2 */ khz = 5680000; break; \ - case 140: /* HiperLAN2 */ khz = 5700000; break; \ - case 34: /* Japan MMAC */ khz = 5170000; break; \ - case 38: /* Japan MMAC */ khz = 5190000; break; \ - case 42: /* Japan MMAC */ khz = 5210000; break; \ - case 46: /* Japan MMAC */ khz = 5230000; break; \ - case 184: /* Japan */ khz = 4920000; break; \ - case 188: /* Japan */ khz = 4940000; break; \ - case 192: /* Japan */ khz = 4960000; break; \ - case 196: /* Japan */ khz = 4980000; break; \ - case 208: /* Japan, means J08 */ khz = 5040000; break; \ - case 212: /* Japan, means J12 */ khz = 5060000; break; \ - case 216: /* Japan, means J16 */ khz = 5080000; break; \ - default: khz = 2412000; break; \ - } \ - } - -#define MAP_KHZ_TO_CHANNEL_ID(khz, ch) { \ - switch (khz) \ - { \ - case 2412000: ch = 1; break; \ - case 2417000: ch = 2; break; \ - case 2422000: ch = 3; break; \ - case 2427000: ch = 4; break; \ - case 2432000: ch = 5; break; \ - case 2437000: ch = 6; break; \ - case 2442000: ch = 7; break; \ - case 2447000: ch = 8; break; \ - case 2452000: ch = 9; break; \ - case 2457000: ch = 10; break; \ - case 2462000: ch = 11; break; \ - case 2467000: ch = 12; break; \ - case 2472000: ch = 13; break; \ - case 2484000: ch = 14; break; \ - case 5180000: ch = 36; /* UNII */ break; \ - case 5200000: ch = 40; /* UNII */ break; \ - case 5220000: ch = 44; /* UNII */ break; \ - case 5240000: ch = 48; /* UNII */ break; \ - case 5260000: ch = 52; /* UNII */ break; \ - case 5280000: ch = 56; /* UNII */ break; \ - case 5300000: ch = 60; /* UNII */ break; \ - case 5320000: ch = 64; /* UNII */ break; \ - case 5745000: ch = 149; /* UNII */ break; \ - case 5765000: ch = 153; /* UNII */ break; \ - case 5785000: ch = 157; /* UNII */ break; \ - case 5805000: ch = 161; /* UNII */ break; \ - case 5825000: ch = 165; /* UNII */ break; \ - case 5500000: ch = 100; /* HiperLAN2 */ break; \ - case 5520000: ch = 104; /* HiperLAN2 */ break; \ - case 5540000: ch = 108; /* HiperLAN2 */ break; \ - case 5560000: ch = 112; /* HiperLAN2 */ break; \ - case 5580000: ch = 116; /* HiperLAN2 */ break; \ - case 5600000: ch = 120; /* HiperLAN2 */ break; \ - case 5620000: ch = 124; /* HiperLAN2 */ break; \ - case 5640000: ch = 128; /* HiperLAN2 */ break; \ - case 5660000: ch = 132; /* HiperLAN2 */ break; \ - case 5680000: ch = 136; /* HiperLAN2 */ break; \ - case 5700000: ch = 140; /* HiperLAN2 */ break; \ - case 5170000: ch = 34; /* Japan MMAC */ break; \ - case 5190000: ch = 38; /* Japan MMAC */ break; \ - case 5210000: ch = 42; /* Japan MMAC */ break; \ - case 5230000: ch = 46; /* Japan MMAC */ break; \ - case 4920000: ch = 184; /* Japan */ break; \ - case 4940000: ch = 188; /* Japan */ break; \ - case 4960000: ch = 192; /* Japan */ break; \ - case 4980000: ch = 196; /* Japan */ break; \ - case 5040000: ch = 208; /* Japan, means J08 */ break; \ - case 5060000: ch = 212; /* Japan, means J12 */ break; \ - case 5080000: ch = 216; /* Japan, means J16 */ break; \ - default: ch = 1; break; \ - } \ - } // // Common fragment list structure - Identical to the scatter gather frag list structure // +//#define RTMP_SCATTER_GATHER_ELEMENT SCATTER_GATHER_ELEMENT +//#define PRTMP_SCATTER_GATHER_ELEMENT PSCATTER_GATHER_ELEMENT #define NIC_MAX_PHYS_BUF_COUNT 8 typedef struct _RTMP_SCATTER_GATHER_ELEMENT { @@ -893,18 +457,11 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { } \ } -#define SWITCH_AB( _pAA, _pBB) \ -{ \ - PVOID pCC; \ - pCC = _pBB; \ - _pBB = _pAA; \ - _pAA = pCC; \ -} // Enqueue this frame to MLME engine // We need to enqueue the whole frame because MLME need to pass data type // information from 802.11 header -#ifdef RT2860 +#ifdef RTMP_MAC_PCI #define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \ { \ UINT32 High32TSF, Low32TSF; \ @@ -912,49 +469,14 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { RTMP_IO_READ32(_pAd, TSF_TIMER_DW0, &Low32TSF); \ MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (UCHAR)_Rssi0, (UCHAR)_Rssi1,(UCHAR)_Rssi2,_FrameSize, _pFrame, (UCHAR)_PlcpSignal); \ } -#endif -#ifdef RT2870 +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB #define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \ { \ UINT32 High32TSF=0, Low32TSF=0; \ MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (UCHAR)_Rssi0, (UCHAR)_Rssi1,(UCHAR)_Rssi2,_FrameSize, _pFrame, (UCHAR)_PlcpSignal); \ } -#endif // RT2870 // - -//Need to collect each ant's rssi concurrently -//rssi1 is report to pair2 Ant and rss2 is reprot to pair1 Ant when 4 Ant -#define COLLECT_RX_ANTENNA_AVERAGE_RSSI(_pAd, _rssi1, _rssi2) \ -{ \ - SHORT AvgRssi; \ - UCHAR UsedAnt; \ - if (_pAd->RxAnt.EvaluatePeriod == 0) \ - { \ - UsedAnt = _pAd->RxAnt.Pair1PrimaryRxAnt; \ - AvgRssi = _pAd->RxAnt.Pair1AvgRssi[UsedAnt]; \ - if (AvgRssi < 0) \ - AvgRssi = AvgRssi - (AvgRssi >> 3) + _rssi1; \ - else \ - AvgRssi = _rssi1 << 3; \ - _pAd->RxAnt.Pair1AvgRssi[UsedAnt] = AvgRssi; \ - } \ - else \ - { \ - UsedAnt = _pAd->RxAnt.Pair1SecondaryRxAnt; \ - AvgRssi = _pAd->RxAnt.Pair1AvgRssi[UsedAnt]; \ - if ((AvgRssi < 0) && (_pAd->RxAnt.FirstPktArrivedWhenEvaluate)) \ - AvgRssi = AvgRssi - (AvgRssi >> 3) + _rssi1; \ - else \ - { \ - _pAd->RxAnt.FirstPktArrivedWhenEvaluate = TRUE; \ - AvgRssi = _rssi1 << 3; \ - } \ - _pAd->RxAnt.Pair1AvgRssi[UsedAnt] = AvgRssi; \ - _pAd->RxAnt.RcvPktNumWhenEvaluate++; \ - } \ -} - -#define NDIS_QUERY_BUFFER(_NdisBuf, _ppVA, _pBufLen) \ - NdisQueryBuffer(_NdisBuf, _ppVA, _pBufLen) +#endif // RTMP_MAC_USB // #define MAC_ADDR_EQUAL(pAddr1,pAddr2) RTMPEqualMemory((PVOID)(pAddr1), (PVOID)(pAddr2), MAC_ADDR_LEN) #define SSID_EQUAL(ssid1, len1, ssid2, len2) ((len1==len2) && (RTMPEqualMemory(ssid1, ssid2, len1))) @@ -964,59 +486,21 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { // #define JapanChannelCheck(channel) ((channel == 52) || (channel == 56) || (channel == 60) || (channel == 64)) -#ifdef RT2860 +#define STA_EXTRA_SETTING(_pAd) + #define STA_PORT_SECURED(_pAd) \ { \ - _pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; \ - RTMP_SET_PSFLAG(_pAd, fRTMP_PS_CAN_GO_SLEEP); \ - NdisAcquireSpinLock(&(_pAd)->MacTabLock); \ - _pAd->MacTab.Content[BSSID_WCID].PortSecured = _pAd->StaCfg.PortSecured; \ + BOOLEAN Cancelled; \ + (_pAd)->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; \ + NdisAcquireSpinLock(&((_pAd)->MacTabLock)); \ + (_pAd)->MacTab.Content[BSSID_WCID].PortSecured = (_pAd)->StaCfg.PortSecured; \ + (_pAd)->MacTab.Content[BSSID_WCID].PrivacyFilter = Ndis802_11PrivFilterAcceptAll;\ NdisReleaseSpinLock(&(_pAd)->MacTabLock); \ + RTMPCancelTimer(&((_pAd)->Mlme.LinkDownTimer), &Cancelled);\ + STA_EXTRA_SETTING(_pAd); \ } -#endif -#ifdef RT2870 -#define STA_PORT_SECURED(_pAd) \ -{ \ - _pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; \ - NdisAcquireSpinLock(&_pAd->MacTabLock); \ - _pAd->MacTab.Content[BSSID_WCID].PortSecured = _pAd->StaCfg.PortSecured; \ - NdisReleaseSpinLock(&_pAd->MacTabLock); \ -} -#endif -// -// Register set pair for initialzation register set definition -// -typedef struct _RTMP_REG_PAIR -{ - ULONG Register; - ULONG Value; -} RTMP_REG_PAIR, *PRTMP_REG_PAIR; - -typedef struct _REG_PAIR -{ - UCHAR Register; - UCHAR Value; -} REG_PAIR, *PREG_PAIR; -// -// Register set pair for initialzation register set definition -// -typedef struct _RTMP_RF_REGS -{ - UCHAR Channel; - ULONG R1; - ULONG R2; - ULONG R3; - ULONG R4; -} RTMP_RF_REGS, *PRTMP_RF_REGS; - -typedef struct _FREQUENCY_ITEM { - UCHAR Channel; - UCHAR N; - UCHAR R; - UCHAR K; -} FREQUENCY_ITEM, *PFREQUENCY_ITEM; // // Data buffer for DMA operation, the buffer must be contiguous physical memory @@ -1030,35 +514,6 @@ typedef struct _RTMP_DMABUF } RTMP_DMABUF, *PRTMP_DMABUF; -typedef union _HEADER_802_11_SEQ{ - struct { - USHORT Frag:4; - USHORT Sequence:12; - } field; - USHORT value; -} HEADER_802_11_SEQ, *PHEADER_802_11_SEQ; - -// -// Data buffer for DMA operation, the buffer must be contiguous physical memory -// Both DMA to / from CPU use the same structure. -// -typedef struct _RTMP_REORDERBUF -{ - BOOLEAN IsFull; - PVOID AllocVa; // TxBuf virtual address - UCHAR Header802_3[14]; - HEADER_802_11_SEQ Sequence; //support compressed bitmap BA, so no consider fragment in BA - UCHAR DataOffset; - USHORT Datasize; - ULONG AllocSize; -#ifdef RT2860 - NDIS_PHYSICAL_ADDRESS AllocPa; // TxBuf physical address -#endif -#ifdef RT2870 - PUCHAR AllocPa; -#endif // RT2870 // -} RTMP_REORDERBUF, *PRTMP_REORDERBUF; - // // Control block (Descriptor) for all ring descriptor DMA operation, buffer must be // contiguous physical memory. NDIS_PACKET stored the binding Rx packet descriptor @@ -1078,21 +533,7 @@ typedef struct _RTMP_DMACB RTMP_DMABUF DmaBuf; // Associated DMA buffer structure } RTMP_DMACB, *PRTMP_DMACB; -typedef struct _RTMP_TX_BUF -{ - PQUEUE_ENTRY Next; - UCHAR Index; - ULONG AllocSize; // Control block size - PVOID AllocVa; // Control block virtual address - NDIS_PHYSICAL_ADDRESS AllocPa; // Control block physical address -} RTMP_TXBUF, *PRTMP_TXBUF; -typedef struct _RTMP_RX_BUF -{ - BOOLEAN InUse; - ULONG ByBaRecIndex; - RTMP_REORDERBUF MAP_RXBuf[MAX_RX_REORDERBUF]; -} RTMP_RXBUF, *PRTMP_RXBUF; typedef struct _RTMP_TX_RING { RTMP_DMACB Cell[TX_RING_SIZE]; @@ -1155,9 +596,6 @@ typedef struct _COUNTER_802_11 { typedef struct _COUNTER_RALINK { ULONG TransmittedByteCount; // both successful and failure, used to calculate TX throughput -#ifdef RT2860 - ULONG LastReceivedByteCount; -#endif ULONG ReceivedByteCount; // both CRC okay and CRC error, used to calculate RX throughput ULONG BeenDisassociatedCount; ULONG BadCQIAutoRecoveryCount; @@ -1177,13 +615,10 @@ typedef struct _COUNTER_RALINK { ULONG OneSecRxCount; UINT32 OneSecTxAggregationCount; UINT32 OneSecRxAggregationCount; - + UINT32 OneSecReceivedByteCount; UINT32 OneSecFrameDuplicateCount; -#ifdef RT2870 - ULONG OneSecTransmittedByteCount; // both successful and failure, used to calculate TX throughput -#endif // RT2870 // - + UINT32 OneSecTransmittedByteCount; // both successful and failure, used to calculate TX throughput UINT32 OneSecTxNoRetryOkCount; UINT32 OneSecTxRetryOkCount; UINT32 OneSecTxFailCount; @@ -1224,12 +659,6 @@ typedef struct _COUNTER_RALINK { LARGE_INTEGER MPDUInReceivedAMPDUCount; } COUNTER_RALINK, *PCOUNTER_RALINK; -typedef struct _PID_COUNTER { - ULONG TxAckRequiredCount; // CRC error - ULONG TxAggreCount; - ULONG TxSuccessCount; // OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount - ULONG LastSuccessRate; -} PID_COUNTER, *PPID_COUNTER; typedef struct _COUNTER_DRS { // to record the each TX rate's quality. 0 is best, the bigger the worse. @@ -1244,33 +673,12 @@ typedef struct _COUNTER_DRS { ULONG LastTxOkCount; } COUNTER_DRS, *PCOUNTER_DRS; -// -// Arcfour Structure Added by PaulWu -// -typedef struct _ARCFOUR -{ - UINT X; - UINT Y; - UCHAR STATE[256]; -} ARCFOURCONTEXT, *PARCFOURCONTEXT; -// MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI too. just copy to TXWI. -typedef struct _RECEIVE_SETTING { - USHORT NumOfRX:2; // MIMO. WE HAVE 3R - USHORT Mode:2; //channel bandwidth 20MHz or 40 MHz - USHORT ShortGI:1; - USHORT STBC:2; //SPACE - USHORT rsv:3; - USHORT OFDM:1; - USHORT MIMO:1; - } RECEIVE_SETTING, *PRECEIVE_SETTING; - -// Shared key data structure -typedef struct _WEP_KEY { - UCHAR KeyLen; // Key length for each key, 0: entry is invalid - UCHAR Key[MAX_LEN_OF_KEY]; // right now we implement 4 keys, 128 bits max -} WEP_KEY, *PWEP_KEY; + +/*************************************************************************** + * security key related data structure + **************************************************************************/ typedef struct _CIPHER_KEY { UCHAR Key[16]; // right now we implement 4 keys, 128 bits max UCHAR RxMic[8]; // make alignment @@ -1284,42 +692,47 @@ typedef struct _CIPHER_KEY { UCHAR Type; // Indicate Pairwise/Group when reporting MIC error } CIPHER_KEY, *PCIPHER_KEY; -typedef struct _BBP_TUNING_STRUCT { - BOOLEAN Enable; - UCHAR FalseCcaCountUpperBound; // 100 per sec - UCHAR FalseCcaCountLowerBound; // 10 per sec - UCHAR R17LowerBound; // specified in E2PROM - UCHAR R17UpperBound; // 0x68 according to David Tung - UCHAR CurrentR17Value; -} BBP_TUNING, *PBBP_TUNING; -typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT { - UCHAR EvaluatePeriod; // 0:not evalute status, 1: evaluate status, 2: switching status -#ifdef RT2870 - UCHAR EvaluateStableCnt; -#endif - UCHAR Pair1PrimaryRxAnt; // 0:Ant-E1, 1:Ant-E2 - UCHAR Pair1SecondaryRxAnt; // 0:Ant-E1, 1:Ant-E2 - UCHAR Pair2PrimaryRxAnt; // 0:Ant-E3, 1:Ant-E4 - UCHAR Pair2SecondaryRxAnt; // 0:Ant-E3, 1:Ant-E4 - SHORT Pair1AvgRssi[2]; // AvgRssi[0]:E1, AvgRssi[1]:E2 - SHORT Pair2AvgRssi[2]; // AvgRssi[0]:E3, AvgRssi[1]:E4 - SHORT Pair1LastAvgRssi; // - SHORT Pair2LastAvgRssi; // - ULONG RcvPktNumWhenEvaluate; - BOOLEAN FirstPktArrivedWhenEvaluate; - RALINK_TIMER_STRUCT RxAntDiversityTimer; -} SOFT_RX_ANT_DIVERSITY, *PSOFT_RX_ANT_DIVERSITY; +// structure to define WPA Group Key Rekey Interval +typedef struct PACKED _RT_802_11_WPA_REKEY { + ULONG ReKeyMethod; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based + ULONG ReKeyInterval; // time-based: seconds, packet-based: kilo-packets +} RT_WPA_REKEY,*PRT_WPA_REKEY, RT_802_11_WPA_REKEY, *PRT_802_11_WPA_REKEY; + +#ifdef RTMP_MAC_USB +/*************************************************************************** + * RTUSB I/O related data structure + **************************************************************************/ +typedef struct _RT_SET_ASIC_WCID { + ULONG WCID; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based + ULONG SetTid; // time-based: seconds, packet-based: kilo-packets + ULONG DeleteTid; // time-based: seconds, packet-based: kilo-packets + UCHAR Addr[MAC_ADDR_LEN]; // avoid in interrupt when write key +} RT_SET_ASIC_WCID,*PRT_SET_ASIC_WCID; + +typedef struct _RT_SET_ASIC_WCID_ATTRI { + ULONG WCID; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based + ULONG Cipher; // ASIC Cipher definition + UCHAR Addr[ETH_LENGTH_OF_ADDRESS]; +} RT_SET_ASIC_WCID_ATTRI,*PRT_SET_ASIC_WCID_ATTRI; + +// for USB interface, avoid in interrupt when write key +typedef struct RT_ADD_PAIRWISE_KEY_ENTRY { + UCHAR MacAddr[6]; + USHORT MacTabMatchWCID; // ASIC + CIPHER_KEY CipherKey; +} RT_ADD_PAIRWISE_KEY_ENTRY,*PRT_ADD_PAIRWISE_KEY_ENTRY; -typedef struct _LEAP_AUTH_INFO { - BOOLEAN Enabled; //Ture: Enable LEAP Authentication - BOOLEAN CCKM; //Ture: Use Fast Reauthentication with CCKM - UCHAR Reserve[2]; - UCHAR UserName[256]; //LEAP, User name - ULONG UserNameLen; - UCHAR Password[256]; //LEAP, User Password - ULONG PasswordLen; -} LEAP_AUTH_INFO, *PLEAP_AUTH_INFO; +// Cipher suite type for mixed mode group cipher, P802.11i-2004 +typedef enum _RT_802_11_CIPHER_SUITE_TYPE { + Cipher_Type_NONE, + Cipher_Type_WEP40, + Cipher_Type_TKIP, + Cipher_Type_RSVD, + Cipher_Type_CCMP, + Cipher_Type_WEP104 +} RT_802_11_CIPHER_SUITE_TYPE, *PRT_802_11_CIPHER_SUITE_TYPE; +#endif // RTMP_MAC_USB // typedef struct { UCHAR Addr[MAC_ADDR_LEN]; @@ -1335,25 +748,30 @@ typedef struct { ROGUEAP_ENTRY RogueApEntry[MAX_LEN_OF_BSS_TABLE]; } ROGUEAP_TABLE, *PROGUEAP_TABLE; -typedef struct { - BOOLEAN Enable; - UCHAR Delta; - BOOLEAN PlusSign; -} CCK_TX_POWER_CALIBRATE, *PCCK_TX_POWER_CALIBRATE; - // -// Receive Tuple Cache Format +// Cisco IAPP format // -typedef struct _TUPLE_CACHE { - BOOLEAN Valid; - UCHAR MacAddress[MAC_ADDR_LEN]; - USHORT Sequence; - USHORT Frag; -} TUPLE_CACHE, *PTUPLE_CACHE; +typedef struct _CISCO_IAPP_CONTENT_ +{ + USHORT Length; //IAPP Length + UCHAR MessageType; //IAPP type + UCHAR FunctionCode; //IAPP function type + UCHAR DestinaionMAC[MAC_ADDR_LEN]; + UCHAR SourceMAC[MAC_ADDR_LEN]; + USHORT Tag; //Tag(element IE) - Adjacent AP report + USHORT TagLength; //Length of element not including 4 byte header + UCHAR OUI[4]; //0x00, 0x40, 0x96, 0x00 + UCHAR PreviousAP[MAC_ADDR_LEN]; //MAC Address of access point + USHORT Channel; + USHORT SsidLen; + UCHAR Ssid[MAX_LEN_OF_SSID]; + USHORT Seconds; //Seconds that the client has been disassociated. +} CISCO_IAPP_CONTENT, *PCISCO_IAPP_CONTENT; -// -// Fragment Frame structure -// + +/* + * Fragment Frame structure + */ typedef struct _FRAGMENT_FRAME { PNDIS_PACKET pFragPacket; ULONG RxSize; @@ -1373,6 +791,18 @@ typedef struct _PACKET_INFO { PNDIS_BUFFER pFirstBuffer; // Pointer to first buffer descriptor } PACKET_INFO, *PPACKET_INFO; + +// +// Arcfour Structure Added by PaulWu +// +typedef struct _ARCFOUR +{ + UINT X; + UINT Y; + UCHAR STATE[256]; +} ARCFOURCONTEXT, *PARCFOURCONTEXT; + + // // Tkip Key structure which RC4 key & MIC calculation // @@ -1404,6 +834,10 @@ typedef struct __PRIVATE_STRUC { TKIP_KEY_INFO Rx; } PRIVATE_STRUC, *PPRIVATE_STRUC; + +/*************************************************************************** + * Channel and BBP related data structures + **************************************************************************/ // structure to tune BBP R66 (BBP TUNING) typedef struct _BBP_R66_TUNING { BOOLEAN bEnable; @@ -1433,12 +867,56 @@ typedef struct _CHANNEL_11J_TX_POWER { USHORT RemainingTimeForUse; //unit: sec } CHANNEL_11J_TX_POWER, *PCHANNEL_11J_TX_POWER; +typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT { + UCHAR EvaluatePeriod; // 0:not evalute status, 1: evaluate status, 2: switching status + UCHAR EvaluateStableCnt; + UCHAR Pair1PrimaryRxAnt; // 0:Ant-E1, 1:Ant-E2 + UCHAR Pair1SecondaryRxAnt; // 0:Ant-E1, 1:Ant-E2 + UCHAR Pair2PrimaryRxAnt; // 0:Ant-E3, 1:Ant-E4 + UCHAR Pair2SecondaryRxAnt; // 0:Ant-E3, 1:Ant-E4 + SHORT Pair1AvgRssi[2]; // AvgRssi[0]:E1, AvgRssi[1]:E2 + SHORT Pair2AvgRssi[2]; // AvgRssi[0]:E3, AvgRssi[1]:E4 + SHORT Pair1LastAvgRssi; // + SHORT Pair2LastAvgRssi; // + ULONG RcvPktNumWhenEvaluate; + BOOLEAN FirstPktArrivedWhenEvaluate; + RALINK_TIMER_STRUCT RxAntDiversityTimer; +} SOFT_RX_ANT_DIVERSITY, *PSOFT_RX_ANT_DIVERSITY; + + +/*************************************************************************** + * structure for radar detection and channel switch + **************************************************************************/ +typedef struct _RADAR_DETECT_STRUCT { + //BOOLEAN IEEE80211H; // 0: disable, 1: enable IEEE802.11h + UCHAR CSCount; //Channel switch counter + UCHAR CSPeriod; //Channel switch period (beacon count) + UCHAR RDCount; //Radar detection counter + UCHAR RDMode; //Radar Detection mode + UCHAR RDDurRegion; //Radar detection duration region + UCHAR BBPR16; + UCHAR BBPR17; + UCHAR BBPR18; + UCHAR BBPR21; + UCHAR BBPR22; + UCHAR BBPR64; + ULONG InServiceMonitorCount; // unit: sec + UINT8 DfsSessionTime; + BOOLEAN bFastDfs; + UINT8 ChMovingTime; + UINT8 LongPulseRadarTh; +} RADAR_DETECT_STRUCT, *PRADAR_DETECT_STRUCT; + typedef enum _ABGBAND_STATE_ { UNKNOWN_BAND, BG_BAND, A_BAND, } ABGBAND_STATE; + +/*************************************************************************** + * structure for MLME state machine + **************************************************************************/ typedef struct _MLME_STRUCT { // STA state machines STATE_MACHINE CntlMachine; @@ -1448,17 +926,23 @@ typedef struct _MLME_STRUCT { STATE_MACHINE SyncMachine; STATE_MACHINE WpaPskMachine; STATE_MACHINE LeapMachine; - STATE_MACHINE AironetMachine; STATE_MACHINE_FUNC AssocFunc[ASSOC_FUNC_SIZE]; STATE_MACHINE_FUNC AuthFunc[AUTH_FUNC_SIZE]; STATE_MACHINE_FUNC AuthRspFunc[AUTH_RSP_FUNC_SIZE]; STATE_MACHINE_FUNC SyncFunc[SYNC_FUNC_SIZE]; - STATE_MACHINE_FUNC WpaPskFunc[WPA_PSK_FUNC_SIZE]; - STATE_MACHINE_FUNC AironetFunc[AIRONET_FUNC_SIZE]; STATE_MACHINE_FUNC ActFunc[ACT_FUNC_SIZE]; // Action STATE_MACHINE ActMachine; + + + + // common WPA state machine + STATE_MACHINE WpaMachine; + STATE_MACHINE_FUNC WpaFunc[WPA_FUNC_SIZE]; + + + ULONG ChannelQuality; // 0..100, Channel Quality Indication for Roaming ULONG Now32; // latch the value of NdisGetSystemUpTime() ULONG LastSendNULLpsmTime; @@ -1473,11 +957,11 @@ typedef struct _MLME_STRUCT { RALINK_TIMER_STRUCT APSDPeriodicTimer; RALINK_TIMER_STRUCT LinkDownTimer; RALINK_TIMER_STRUCT LinkUpTimer; -#ifdef RT2860 +#ifdef RTMP_MAC_PCI UCHAR bPsPollTimerRunning; RALINK_TIMER_STRUCT PsPollTimer; RALINK_TIMER_STRUCT RadioOnOffTimer; -#endif +#endif // RTMP_MAC_PCI // ULONG PeriodicRound; ULONG OneSecPeriodicRound; @@ -1486,38 +970,48 @@ typedef struct _MLME_STRUCT { BOOLEAN bEnableAutoAntennaCheck; RALINK_TIMER_STRUCT RxAntEvalTimer; -#ifdef RT2870 +#ifdef RT30xx UCHAR CaliBW40RfR24; UCHAR CaliBW20RfR24; -#endif // RT2870 // +#endif // RT30xx // + +#ifdef RTMP_MAC_USB + RALINK_TIMER_STRUCT AutoWakeupTimer; + BOOLEAN AutoWakeupTimerRunning; +#endif // RTMP_MAC_USB // } MLME_STRUCT, *PMLME_STRUCT; -// structure for radar detection and channel switch -typedef struct _RADAR_DETECT_STRUCT { - UCHAR CSCount; //Channel switch counter - UCHAR CSPeriod; //Channel switch period (beacon count) - UCHAR RDCount; //Radar detection counter - UCHAR RDMode; //Radar Detection mode - UCHAR RDDurRegion; //Radar detection duration region - UCHAR BBPR16; - UCHAR BBPR17; - UCHAR BBPR18; - UCHAR BBPR21; - UCHAR BBPR22; - UCHAR BBPR64; - ULONG InServiceMonitorCount; // unit: sec - UINT8 DfsSessionTime; - BOOLEAN bFastDfs; - UINT8 ChMovingTime; - UINT8 LongPulseRadarTh; -} RADAR_DETECT_STRUCT, *PRADAR_DETECT_STRUCT; -typedef enum _REC_BLOCKACK_STATUS +/*************************************************************************** + * 802.11 N related data structures + **************************************************************************/ +struct reordering_mpdu { - Recipient_NONE=0, - Recipient_USED, - Recipient_HandleRes, - Recipient_Accept + struct reordering_mpdu *next; + PNDIS_PACKET pPacket; /* coverted to 802.3 frame */ + int Sequence; /* sequence number of MPDU */ + BOOLEAN bAMSDU; +}; + +struct reordering_list +{ + struct reordering_mpdu *next; + int qlen; +}; + +struct reordering_mpdu_pool +{ + PVOID mem; + NDIS_SPIN_LOCK lock; + struct reordering_list freelist; +}; + +typedef enum _REC_BLOCKACK_STATUS +{ + Recipient_NONE=0, + Recipient_USED, + Recipient_HandleRes, + Recipient_Accept } REC_BLOCKACK_STATUS, *PREC_BLOCKACK_STATUS; typedef enum _ORI_BLOCKACK_STATUS @@ -1545,14 +1039,21 @@ typedef struct _BA_REC_ENTRY { UCHAR Wcid; UCHAR TID; UCHAR BAWinSize; // 7.3.1.14. each buffer is capable of holding a max AMSDU or MSDU. + //UCHAR NumOfRxPkt; + //UCHAR Curindidx; // the head in the RX reordering buffer USHORT LastIndSeq; +// USHORT LastIndSeqAtTimer; USHORT TimeOutValue; RALINK_TIMER_STRUCT RECBATimer; ULONG LastIndSeqAtTimer; ULONG nDropPacket; ULONG rcvSeq; REC_BLOCKACK_STATUS REC_BA_Status; +// UCHAR RxBufIdxUsed; + // corresponding virtual address for RX reordering packet storage. + //RTMP_REORDERDMABUF MAP_RXBuf[MAX_RX_REORDERBUF]; NDIS_SPIN_LOCK RxReRingLock; // Rx Ring spinlock +// struct _BA_REC_ENTRY *pNext; PVOID pAdapter; struct reordering_list list; } BA_REC_ENTRY, *PBA_REC_ENTRY; @@ -1561,6 +1062,7 @@ typedef struct _BA_REC_ENTRY { typedef struct { ULONG numAsRecipient; // I am recipient of numAsRecipient clients. These client are in the BARecEntry[] ULONG numAsOriginator; // I am originator of numAsOriginator clients. These clients are in the BAOriEntry[] + ULONG numDoneOriginator; // count Done Originator sessions BA_ORI_ENTRY BAOriEntry[MAX_LEN_OF_BA_ORI_TABLE]; BA_REC_ENTRY BARecEntry[MAX_LEN_OF_BA_REC_TABLE]; } BA_TABLE, *PBA_TABLE; @@ -1607,6 +1109,29 @@ typedef union _BACAP_STRUC { UINT32 word; } BACAP_STRUC, *PBACAP_STRUC; + +typedef struct { + BOOLEAN IsRecipient; + UCHAR MACAddr[MAC_ADDR_LEN]; + UCHAR TID; + UCHAR nMSDU; + USHORT TimeOut; + BOOLEAN bAllTid; // If True, delete all TID for BA sessions with this MACaddr. +} OID_ADD_BA_ENTRY, *POID_ADD_BA_ENTRY; + + + +#define IS_HT_STA(_pMacEntry) \ + (_pMacEntry->MaxHTPhyMode.field.MODE >= MODE_HTMIX) + +#define IS_HT_RATE(_pMacEntry) \ + (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX) + +#define PEER_IS_HT_RATE(_pMacEntry) \ + (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX) + + + //This structure is for all 802.11n card InterOptibilityTest action. Reset all Num every n second. (Details see MLMEPeriodic) typedef struct _IOT_STRUC { UCHAR Threshold[2]; @@ -1630,6 +1155,8 @@ typedef struct _IOT_STRUC { // This is the registry setting for 802.11n transmit setting. Used in advanced page. typedef union _REG_TRANSMIT_SETTING { struct { + //UINT32 PhyMode:4; + //UINT32 MCS:7; // MCS UINT32 rsv0:10; UINT32 TxBF:1; UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz @@ -1653,18 +1180,26 @@ typedef union _DESIRED_TRANSMIT_SETTING { USHORT word; } DESIRED_TRANSMIT_SETTING, *PDESIRED_TRANSMIT_SETTING; -typedef struct { - BOOLEAN IsRecipient; - UCHAR MACAddr[MAC_ADDR_LEN]; - UCHAR TID; - UCHAR nMSDU; - USHORT TimeOut; - BOOLEAN bAllTid; // If True, delete all TID for BA sessions with this MACaddr. -} OID_ADD_BA_ENTRY, *POID_ADD_BA_ENTRY; +#ifdef RTMP_MAC_USB +/*************************************************************************** + * USB-based chip Beacon related data structures + **************************************************************************/ +#define BEACON_BITMAP_MASK 0xff +typedef struct _BEACON_SYNC_STRUCT_ +{ + UCHAR BeaconBuf[HW_BEACON_MAX_COUNT][HW_BEACON_OFFSET]; + UCHAR BeaconTxWI[HW_BEACON_MAX_COUNT][TXWI_SIZE]; + ULONG TimIELocationInBeacon[HW_BEACON_MAX_COUNT]; + ULONG CapabilityInfoLocationInBeacon[HW_BEACON_MAX_COUNT]; + BOOLEAN EnableBeacon; // trigger to enable beacon transmission. + UCHAR BeaconBitMap; // NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change. + UCHAR DtimBitOn; // NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change. +}BEACON_SYNC_STRUCT; +#endif // RTMP_MAC_USB // -// -// Multiple SSID structure -// +/*************************************************************************** + * Multiple SSID related data structures + **************************************************************************/ #define WLAN_MAX_NUM_OF_TIM ((MAX_LEN_OF_MAC_TABLE >> 3) + 1) /* /8 + 1 */ #define WLAN_CT_TIM_BCMC_OFFSET 0 /* unit: 32B */ @@ -1688,124 +1223,6 @@ typedef struct { UCHAR bit_offset = wcid & 0x7; \ ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] |= BIT8[bit_offset]; } -#ifdef RT2870 -#define BEACON_BITMAP_MASK 0xff -typedef struct _BEACON_SYNC_STRUCT_ -{ - UCHAR BeaconBuf[HW_BEACON_MAX_COUNT][HW_BEACON_OFFSET]; - UCHAR BeaconTxWI[HW_BEACON_MAX_COUNT][TXWI_SIZE]; - ULONG TimIELocationInBeacon[HW_BEACON_MAX_COUNT]; - ULONG CapabilityInfoLocationInBeacon[HW_BEACON_MAX_COUNT]; - BOOLEAN EnableBeacon; // trigger to enable beacon transmission. - UCHAR BeaconBitMap; // NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change. - UCHAR DtimBitOn; // NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change. -}BEACON_SYNC_STRUCT; -#endif // RT2870 // - -typedef struct _MULTISSID_STRUCT { - UCHAR Bssid[MAC_ADDR_LEN]; - UCHAR SsidLen; - CHAR Ssid[MAX_LEN_OF_SSID]; - USHORT CapabilityInfo; - - PNET_DEV MSSIDDev; - - NDIS_802_11_AUTHENTICATION_MODE AuthMode; - NDIS_802_11_WEP_STATUS WepStatus; - NDIS_802_11_WEP_STATUS GroupKeyWepStatus; - WPA_MIX_PAIR_CIPHER WpaMixPairCipher; - - ULONG TxCount; - ULONG RxCount; - ULONG ReceivedByteCount; - ULONG TransmittedByteCount; - ULONG RxErrorCount; - ULONG RxDropCount; - - HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI. - RT_HT_PHY_INFO DesiredHtPhyInfo; - DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; // Desired transmit setting. this is for reading registry setting only. not useful. - BOOLEAN bAutoTxRateSwitch; - - UCHAR DefaultKeyId; - - UCHAR TxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11, ... - UCHAR DesiredRates[MAX_LEN_OF_SUPPORTED_RATES];// OID_802_11_DESIRED_RATES - UCHAR DesiredRatesIndex; - UCHAR MaxTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11 - - UCHAR TimBitmaps[WLAN_MAX_NUM_OF_TIM]; - - // WPA - UCHAR GMK[32]; - UCHAR PMK[32]; - UCHAR GTK[32]; - BOOLEAN IEEE8021X; - BOOLEAN PreAuth; - UCHAR GNonce[32]; - UCHAR PortSecured; - NDIS_802_11_PRIVACY_FILTER PrivacyFilter; - UCHAR BANClass3Data; - ULONG IsolateInterStaTraffic; - - UCHAR RSNIE_Len[2]; - UCHAR RSN_IE[2][MAX_LEN_OF_RSNIE]; - - - UCHAR TimIELocationInBeacon; - UCHAR CapabilityInfoLocationInBeacon; - // outgoing BEACON frame buffer and corresponding TXWI - // PTXWI_STRUC BeaconTxWI; // - CHAR BeaconBuf[MAX_BEACON_SIZE]; // NOTE: BeaconBuf should be 4-byte aligned - - BOOLEAN bHideSsid; - UINT16 StationKeepAliveTime; // unit: second - - USHORT VLAN_VID; - USHORT VLAN_Priority; - - RT_802_11_ACL AccessControlList; - - // EDCA Qos - BOOLEAN bWmmCapable; // 0:disable WMM, 1:enable WMM - BOOLEAN bDLSCapable; // 0:disable DLS, 1:enable DLS - - UCHAR DlsPTK[64]; // Due to windows dirver count on meetinghouse to handle 4-way shake - - // For 802.1x daemon setting per BSS - UCHAR radius_srv_num; - RADIUS_SRV_INFO radius_srv_info[MAX_RADIUS_SRV_NUM]; - -#ifdef RTL865X_SOC - unsigned int mylinkid; -#endif - - - UINT32 RcvdConflictSsidCount; - UINT32 RcvdSpoofedAssocRespCount; - UINT32 RcvdSpoofedReassocRespCount; - UINT32 RcvdSpoofedProbeRespCount; - UINT32 RcvdSpoofedBeaconCount; - UINT32 RcvdSpoofedDisassocCount; - UINT32 RcvdSpoofedAuthCount; - UINT32 RcvdSpoofedDeauthCount; - UINT32 RcvdSpoofedUnknownMgmtCount; - UINT32 RcvdReplayAttackCount; - - CHAR RssiOfRcvdConflictSsid; - CHAR RssiOfRcvdSpoofedAssocResp; - CHAR RssiOfRcvdSpoofedReassocResp; - CHAR RssiOfRcvdSpoofedProbeResp; - CHAR RssiOfRcvdSpoofedBeacon; - CHAR RssiOfRcvdSpoofedDisassoc; - CHAR RssiOfRcvdSpoofedAuth; - CHAR RssiOfRcvdSpoofedDeauth; - CHAR RssiOfRcvdSpoofedUnknownMgmt; - CHAR RssiOfRcvdReplayAttack; - - BOOLEAN bBcnSntReq; - UCHAR BcnBufIdx; -} MULTISSID_STRUCT, *PMULTISSID_STRUCT; // configuration common to OPMODE_AP as well as OPMODE_STA typedef struct _COMMON_CONFIG { @@ -1818,6 +1235,7 @@ typedef struct _COMMON_CONFIG { UCHAR PhyMode; // PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED USHORT Dsifs; // in units of usec ULONG PacketFilter; // Packet filter for receiving + UINT8 RegulatoryClass; CHAR Ssid[MAX_LEN_OF_SSID]; // NOT NULL-terminated UCHAR SsidLen; // the actual ssid length in used @@ -1846,16 +1264,27 @@ typedef struct _COMMON_CONFIG { BOOLEAN bAPSDAC_BK; BOOLEAN bAPSDAC_VI; BOOLEAN bAPSDAC_VO; + + /* because TSPEC can modify the APSD flag, we need to keep the APSD flag + requested in association stage from the station; + we need to recover the APSD flag after the TSPEC is deleted. */ + BOOLEAN bACMAPSDBackup[4]; /* for delivery-enabled & trigger-enabled both */ + BOOLEAN bACMAPSDTr[4]; /* no use */ + BOOLEAN bNeedSendTriggerFrame; BOOLEAN bAPSDForcePowerSave; // Force power save mode, should only use in APSD-STAUT ULONG TriggerTimerCount; UCHAR MaxSPLength; UCHAR BBPCurrentBW; // BW_10, BW_20, BW_40 + // move to MULTISSID_STRUCT for MBSS + //HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI. REG_TRANSMIT_SETTING RegTransmitSetting; //registry transmit setting. this is for reading registry setting only. not useful. + //UCHAR FixedTxMode; // Fixed Tx Mode (CCK, OFDM), for HT fixed tx mode (GF, MIX) , refer to RegTransmitSetting.field.HTMode UCHAR TxRate; // Same value to fill in TXD. TxRate is 6-bit UCHAR MaxTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11 UCHAR TxRateIndex; // Tx rate index in RateSwitchTable UCHAR TxRateTableSize; // Valid Tx rate table size in RateSwitchTable + //BOOLEAN bAutoTxRateSwitch; UCHAR MinTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11 UCHAR RtsRate; // RATE_xxx HTTRANSMIT_SETTING MlmeTransmit; // MGMT frame PHY rate setting when operatin at Ht rate. @@ -1868,6 +1297,7 @@ typedef struct _COMMON_CONFIG { UCHAR TxPower; // in unit of mW ULONG TxPowerPercentage; // 0~100 % ULONG TxPowerDefault; // keep for TxPowerPercentage + UINT8 PwrConstraint; BACAP_STRUC BACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 BACAP_STRUC REGBACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 @@ -1877,7 +1307,7 @@ typedef struct _COMMON_CONFIG { BOOLEAN bUseZeroToDisableFragment; // Microsoft use 0 as disable ULONG UseBGProtection; // 0: auto, 1: always use, 2: always not use BOOLEAN bUseShortSlotTime; // 0: disable, 1 - use short slot (9us) - BOOLEAN bEnableTxBurst; // 1: enble TX PACKET BURST, 0: disable TX PACKET BURST + BOOLEAN bEnableTxBurst; // 1: enble TX PACKET BURST (when BA is established or AP is not a legacy WMM AP), 0: disable TX PACKET BURST BOOLEAN bAggregationCapable; // 1: enable TX aggregation when the peer supports it BOOLEAN bPiggyBackCapable; // 1: enable TX piggy-back according MAC's version BOOLEAN bIEEE80211H; // 1: enable IEEE802.11h spec. @@ -1916,6 +1346,9 @@ typedef struct _COMMON_CONFIG { BOOLEAN bHTProtect; BOOLEAN bMIMOPSEnable; BOOLEAN bBADecline; +//2008/11/05: KH add to support Antenna power-saving of AP<-- + BOOLEAN bGreenAPEnable; +//2008/11/05: KH add to support Antenna power-saving of AP--> BOOLEAN bDisableReordering; BOOLEAN bForty_Mhz_Intolerant; BOOLEAN bExtChannelSwitchAnnouncement; @@ -1932,15 +1365,9 @@ typedef struct _COMMON_CONFIG { UCHAR TxStream; UCHAR RxStream; - // transmit phy mode, trasmit rate for Multicast. -#ifdef MCAST_RATE_SPECIFIC - UCHAR McastTransmitMcs; - UCHAR McastTransmitPhyMode; -#endif // MCAST_RATE_SPECIFIC // - BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled -#ifdef RT2870 +#ifdef RTMP_MAC_USB BOOLEAN bMultipleIRP; // Multiple Bulk IN flag UCHAR NumOfBulkInIRP; // if bMultipleIRP == TRUE, NumOfBulkInIRP will be 4 otherwise be 1 RT_HT_CAPABILITY SupportedHtPhy; @@ -1948,13 +1375,13 @@ typedef struct _COMMON_CONFIG { UCHAR TxBulkFactor; UCHAR RxBulkFactor; + BOOLEAN IsUpdateBeacon; BEACON_SYNC_STRUCT *pBeaconSync; RALINK_TIMER_STRUCT BeaconUpdateTimer; UINT32 BeaconAdjust; UINT32 BeaconFactor; UINT32 BeaconRemain; -#endif // RT2870 // - +#endif // RTMP_MAC_USB // NDIS_SPIN_LOCK MeasureReqTabLock; PMEASURE_REQ_TAB pMeasureReqTab; @@ -1962,12 +1389,17 @@ typedef struct _COMMON_CONFIG { NDIS_SPIN_LOCK TpcReqTabLock; PTPC_REQ_TAB pTpcReqTab; - // transmit phy mode, trasmit rate for Multicast. -#ifdef MCAST_RATE_SPECIFIC - HTTRANSMIT_SETTING MCastPhyMode; -#endif // MCAST_RATE_SPECIFIC // + BOOLEAN PSPXlink; // 0: Disable. 1: Enable + +#if defined(RT305x)||defined(RT30xx) + // request by Gary, for High Power issue + UCHAR HighPowerPatchDisabled; +#endif + + BOOLEAN HT_DisallowTKIP; /* Restrict the encryption type in 11n HT mode */ } COMMON_CONFIG, *PCOMMON_CONFIG; + /* Modified by Wu Xi-Kun 4/21/2006 */ // STA configuration and status typedef struct _STA_ADMIN_CONFIG { @@ -2016,6 +1448,8 @@ typedef struct _STA_ADMIN_CONFIG { NDIS_802_11_WEP_STATUS GroupKeyWepStatus; + UCHAR WpaPassPhrase[64]; // WPA PSK pass phrase + UINT WpaPassPhraseLen; // the length of WPA PSK pass phrase UCHAR PMK[32]; // WPA PSK mode PMK UCHAR PTK[64]; // WPA PSK mode PTK UCHAR GTK[32]; // GTK from authenticator @@ -2055,11 +1489,7 @@ typedef struct _STA_ADMIN_CONFIG { BOOLEAN bRadio; // Radio state, And of Sw & Hw radio state BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled BOOLEAN bShowHiddenSSID; // Show all known SSID in SSID list get operation -#ifdef RT2860 - BOOLEAN AdhocBOnlyJoined; // Indicate Adhoc B Join. - BOOLEAN AdhocBGJoined; // Indicate Adhoc B/G Join. - BOOLEAN Adhoc20NJoined; // Indicate Adhoc 20MHz N Join. -#endif + // New for WPA, windows want us to keep association information and // Fixed IEs from last association response NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo; @@ -2071,43 +1501,9 @@ typedef struct _STA_ADMIN_CONFIG { UCHAR RSNIE_Len; UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; // The content saved here should be little-endian format. - // New variables used for CCX 1.0 - BOOLEAN bCkipOn; - BOOLEAN bCkipCmicOn; - UCHAR CkipFlag; - UCHAR GIV[3]; //for CCX iv - UCHAR RxSEQ[4]; - UCHAR TxSEQ[4]; - UCHAR CKIPMIC[4]; - UCHAR LeapAuthMode; - LEAP_AUTH_INFO LeapAuthInfo; - UCHAR HashPwd[16]; - UCHAR NetworkChallenge[8]; - UCHAR NetworkChallengeResponse[24]; - UCHAR PeerChallenge[8]; - - UCHAR PeerChallengeResponse[24]; - UCHAR SessionKey[16]; //Network session keys (NSK) - RALINK_TIMER_STRUCT LeapAuthTimer; - ROGUEAP_TABLE RogueApTab; //Cisco CCX1 Rogue AP Detection - - // New control flags for CCX - CCX_CONTROL CCXControl; // Master administration state - BOOLEAN CCXEnable; // Actual CCX state - UCHAR CCXScanChannel; // Selected channel for CCX beacon request - USHORT CCXScanTime; // Time out to wait for beacon and probe response - UCHAR CCXReqType; // Current processing CCX request type - BSS_TABLE CCXBssTab; // BSS Table - UCHAR FrameReportBuf[2048]; // Buffer for creating frame report - USHORT FrameReportLen; // Current Frame report length ULONG CLBusyBytes; // Save the total bytes received durning channel load scan time USHORT RPIDensity[8]; // Array for RPI density collection - // Start address of each BSS table within FrameReportBuf - // It's important to update the RxPower of the corresponding Bss - USHORT BssReportOffset[MAX_LEN_OF_BSS_TABLE]; - USHORT BeaconToken; // Token for beacon report - ULONG LastBssIndex; // Most current reported Bss index - RM_REQUEST_ACTION MeasurementRequest[16]; // Saved measurement request + UCHAR RMReqCnt; // Number of measurement request saved. UCHAR CurrentRMReqIdx; // Number of measurement request saved. BOOLEAN ParallelReq; // Parallel measurement, only one request performed, @@ -2115,26 +1511,10 @@ typedef struct _STA_ADMIN_CONFIG { USHORT ParallelDuration; // Maximum duration for parallel measurement UCHAR ParallelChannel; // Only one channel with parallel measurement USHORT IAPPToken; // IAPP dialog token - UCHAR CCXQosECWMin; // Cisco QOS ECWMin for AC 0 - UCHAR CCXQosECWMax; // Cisco QOS ECWMax for AC 0 // Hack for channel load and noise histogram parameters UCHAR NHFactor; // Parameter for Noise histogram UCHAR CLFactor; // Parameter for channel load - UCHAR KRK[16]; //Key Refresh Key. - UCHAR BTK[32]; //Base Transient Key - BOOLEAN CCKMLinkUpFlag; - ULONG CCKMRN; //(Re)Association request number. - LARGE_INTEGER CCKMBeaconAtJoinTimeStamp; //TSF timer for Re-assocaite to the new AP - UCHAR AironetCellPowerLimit; //in dBm - UCHAR AironetIPAddress[4]; //eg. 192.168.1.1 - BOOLEAN CCXAdjacentAPReportFlag; //flag for determining report Assoc Lost time - CHAR CCXAdjacentAPSsid[MAX_LEN_OF_SSID]; //Adjacent AP's SSID report - UCHAR CCXAdjacentAPSsidLen; // the actual ssid length in used - UCHAR CCXAdjacentAPBssid[MAC_ADDR_LEN]; //Adjacent AP's BSSID report - USHORT CCXAdjacentAPChannel; - ULONG CCXAdjacentAPLinkDownTime; //for Spec S32. - RALINK_TIMER_STRUCT StaQuickResponeForRateUpTimer; BOOLEAN StaQuickResponeForRateUpTimerRunning; @@ -2148,7 +1528,7 @@ typedef struct _STA_ADMIN_CONFIG { RALINK_TIMER_STRUCT WpaDisassocAndBlockAssocTimer; // Fast Roaming - BOOLEAN bFastRoaming; // 0:disable fast roaming, 1:enable fast roaming + BOOLEAN bAutoRoaming; // 0:disable auto roaming by RSSI, 1:enable auto roaming by RSSI CHAR dBmToRoam; // the condition to roam when receiving Rssi less than this value. It's negative value. BOOLEAN IEEE8021X; @@ -2161,6 +1541,8 @@ typedef struct _STA_ADMIN_CONFIG { // 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters UCHAR WpaSupplicantUP; UCHAR WpaSupplicantScanCount; + BOOLEAN bRSN_IE_FromWpaSupplicant; + BOOLEAN bLostAp; CHAR dev_name[16]; USHORT OriDevType; @@ -2173,9 +1555,16 @@ typedef struct _STA_ADMIN_CONFIG { RT_HT_PHY_INFO DesiredHtPhyInfo; BOOLEAN bAutoTxRateSwitch; -#ifdef RT2860 +#ifdef RTMP_MAC_PCI UCHAR BBPR3; -#endif +#endif // RTMP_MAC_PCI // + + + + + BOOLEAN bAutoConnectByBssid; + ULONG BeaconLostTime; // seconds + BOOLEAN bForceTxBurst; // 1: force enble TX PACKET BURST, 0: disable } STA_ADMIN_CONFIG, *PSTA_ADMIN_CONFIG; // This data structure keep the current active BSS/IBSS's configuration that this STA @@ -2202,28 +1591,10 @@ typedef struct _STA_ACTIVE_CONFIG { RT_HT_CAPABILITY SupportedHtPhy; } STA_ACTIVE_CONFIG, *PSTA_ACTIVE_CONFIG; -#ifdef RT2870 -// for USB interface, avoid in interrupt when write key -typedef struct RT_ADD_PAIRWISE_KEY_ENTRY { - NDIS_802_11_MAC_ADDRESS MacAddr; - USHORT MacTabMatchWCID; // ASIC - CIPHER_KEY CipherKey; -} RT_ADD_PAIRWISE_KEY_ENTRY,*PRT_ADD_PAIRWISE_KEY_ENTRY; -#endif // RT2870 // -// ----------- start of AP -------------------------- -// AUTH-RSP State Machine Aux data structure -typedef struct _AP_MLME_AUX { - UCHAR Addr[MAC_ADDR_LEN]; - USHORT Alg; - CHAR Challenge[CIPHER_TEXT_LEN]; -} AP_MLME_AUX, *PAP_MLME_AUX; -// structure to define WPA Group Key Rekey Interval -typedef struct PACKED _RT_802_11_WPA_REKEY { - ULONG ReKeyMethod; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based - ULONG ReKeyInterval; // time-based: seconds, packet-based: kilo-packets -} RT_WPA_REKEY,*PRT_WPA_REKEY, RT_802_11_WPA_REKEY, *PRT_802_11_WPA_REKEY; + + typedef struct _MAC_TABLE_ENTRY { //Choose 1 from ValidAsWDS and ValidAsCLI to validize. @@ -2243,6 +1614,7 @@ typedef struct _MAC_TABLE_ENTRY { UCHAR RSNIE_Len; UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; UCHAR ANonce[LEN_KEY_DESC_NONCE]; + UCHAR SNonce[LEN_KEY_DESC_NONCE]; UCHAR R_Counter[LEN_KEY_DESC_REPLAY]; UCHAR PTK[64]; UCHAR ReTryCounter; @@ -2250,6 +1622,7 @@ typedef struct _MAC_TABLE_ENTRY { RALINK_TIMER_STRUCT EnqueueStartForPSKTimer; // A timer which enqueue EAPoL-Start for triggering PSK SM NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined NDIS_802_11_WEP_STATUS WepStatus; + NDIS_802_11_WEP_STATUS GroupKeyWepStatus; AP_WPA_STATE WpaState; GTK_STATE GTKState; USHORT PortSecured; @@ -2288,13 +1661,14 @@ typedef struct _MAC_TABLE_ENTRY { //==================================================== //WDS entry needs these -// rt2860 add this. if ValidAsWDS==TRUE, MatchWDSTabIdx is the index in WdsTab.MacTab +// if ValidAsWDS==TRUE, MatchWDSTabIdx is the index in WdsTab.MacTab UINT MatchWDSTabIdx; UCHAR MaxSupportedRate; UCHAR CurrTxRate; UCHAR CurrTxRateIndex; // to record the each TX rate's quality. 0 is best, the bigger the worse. USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH]; +// USHORT OneSecTxOkCount; UINT32 OneSecTxNoRetryOkCount; UINT32 OneSecTxRetryOkCount; UINT32 OneSecTxFailCount; @@ -2348,9 +1722,10 @@ typedef struct _MAC_TABLE_ENTRY { UINT32 TXMCSSuccessful[16]; UINT32 TXMCSFailed[16]; UINT32 TXMCSAutoFallBack[16][16]; -#ifdef RT2870 + ULONG LastBeaconRxTime; -#endif + + ULONG AssocDeadLine; } MAC_TABLE_ENTRY, *PMAC_TABLE_ENTRY; typedef struct _MAC_TABLE { @@ -2362,134 +1737,20 @@ typedef struct _MAC_TABLE { BOOLEAN fAnyStationInPsm; BOOLEAN fAnyStationBadAtheros; // Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip. BOOLEAN fAnyTxOPForceDisable; // Check if it is necessary to disable BE TxOP -#ifdef RT2870 BOOLEAN fAllStationAsRalink; // Check if all stations are ralink-chipset -#endif BOOLEAN fAnyStationIsLegacy; // Check if I use legacy rate to transmit to my BSS Station/ BOOLEAN fAnyStationNonGF; // Check if any Station can't support GF. BOOLEAN fAnyStation20Only; // Check if any Station can't support GF. BOOLEAN fAnyStationMIMOPSDynamic; // Check if any Station is MIMO Dynamic BOOLEAN fAnyBASession; // Check if there is BA session. Force turn on RTS/CTS +//2008/10/28: KH add to support Antenna power-saving of AP<-- +//2008/10/28: KH add to support Antenna power-saving of AP--> } MAC_TABLE, *PMAC_TABLE; -#define IS_HT_STA(_pMacEntry) \ - (_pMacEntry->MaxHTPhyMode.field.MODE >= MODE_HTMIX) - -#define IS_HT_RATE(_pMacEntry) \ - (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX) - -#define PEER_IS_HT_RATE(_pMacEntry) \ - (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX) - -typedef struct _WDS_ENTRY { - BOOLEAN Valid; - UCHAR Addr[MAC_ADDR_LEN]; - ULONG NoDataIdleCount; - struct _WDS_ENTRY *pNext; -} WDS_ENTRY, *PWDS_ENTRY; - -typedef struct _WDS_TABLE_ENTRY { - USHORT Size; - UCHAR WdsAddr[MAC_ADDR_LEN]; - WDS_ENTRY *Hash[HASH_TABLE_SIZE]; - WDS_ENTRY Content[MAX_LEN_OF_MAC_TABLE]; - UCHAR MaxSupportedRate; - UCHAR CurrTxRate; - USHORT TxQuality[MAX_LEN_OF_SUPPORTED_RATES]; - USHORT OneSecTxOkCount; - USHORT OneSecTxRetryOkCount; - USHORT OneSecTxFailCount; - ULONG CurrTxRateStableTime; // # of second in current TX rate - UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition -} WDS_TABLE_ENTRY, *PWDS_TABLE_ENTRY; - -typedef struct _RT_802_11_WDS_ENTRY { - PNET_DEV dev; - UCHAR Valid; - UCHAR PhyMode; - UCHAR PeerWdsAddr[MAC_ADDR_LEN]; - UCHAR MacTabMatchWCID; // ASIC - NDIS_802_11_WEP_STATUS WepStatus; - UCHAR KeyIdx; - CIPHER_KEY WdsKey; - HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode; - RT_HT_PHY_INFO DesiredHtPhyInfo; - BOOLEAN bAutoTxRateSwitch; - DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; // Desired transmit setting. -} RT_802_11_WDS_ENTRY, *PRT_802_11_WDS_ENTRY; - -typedef struct _WDS_TABLE { - UCHAR Mode; - ULONG Size; - RT_802_11_WDS_ENTRY WdsEntry[MAX_WDS_ENTRY]; -} WDS_TABLE, *PWDS_TABLE; - -typedef struct _APCLI_STRUCT { - PNET_DEV dev; -#ifdef RTL865X_SOC - unsigned int mylinkid; -#endif - BOOLEAN Enable; // Set it as 1 if the apcli interface was configured to "1" or by iwpriv cmd "ApCliEnable" - BOOLEAN Valid; // Set it as 1 if the apcli interface associated success to remote AP. - UCHAR MacTabWCID; //WCID value, which point to the entry of ASIC Mac table. - UCHAR SsidLen; - CHAR Ssid[MAX_LEN_OF_SSID]; - - UCHAR CfgSsidLen; - CHAR CfgSsid[MAX_LEN_OF_SSID]; - UCHAR CfgApCliBssid[ETH_LENGTH_OF_ADDRESS]; - UCHAR CurrentAddress[ETH_LENGTH_OF_ADDRESS]; - - ULONG ApCliRcvBeaconTime; - - ULONG CtrlCurrState; - ULONG SyncCurrState; - ULONG AuthCurrState; - ULONG AssocCurrState; - ULONG WpaPskCurrState; - - USHORT AuthReqCnt; - USHORT AssocReqCnt; - - ULONG ClientStatusFlags; - UCHAR MpduDensity; - - NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined - NDIS_802_11_WEP_STATUS WepStatus; - - // Add to support different cipher suite for WPA2/WPA mode - NDIS_802_11_ENCRYPTION_STATUS GroupCipher; // Multicast cipher suite - NDIS_802_11_ENCRYPTION_STATUS PairCipher; // Unicast cipher suite - BOOLEAN bMixCipher; // Indicate current Pair & Group use different cipher suites - USHORT RsnCapability; - - UCHAR PSK[100]; // reserve PSK key material - UCHAR PSKLen; - UCHAR PMK[32]; // WPA PSK mode PMK - UCHAR GTK[32]; // GTK from authenticator - - CIPHER_KEY SharedKey[SHARE_KEY_NUM]; - UCHAR DefaultKeyId; - // store RSN_IE built by driver - UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; // The content saved here should be convert to little-endian format. - UCHAR RSNIE_Len; - - // For WPA countermeasures - ULONG LastMicErrorTime; // record last MIC error time - BOOLEAN bBlockAssoc; // Block associate attempt for 60 seconds after counter measure occurred. - // For WPA-PSK supplicant state - UCHAR SNonce[32]; // SNonce for WPA-PSK - UCHAR GNonce[32]; // GNonce for WPA-PSK from authenticator - HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode; - RT_HT_PHY_INFO DesiredHtPhyInfo; - BOOLEAN bAutoTxRateSwitch; - DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; // Desired transmit setting. -} APCLI_STRUCT, *PAPCLI_STRUCT; -// ----------- end of AP ---------------------------- struct wificonf { @@ -2498,32 +1759,56 @@ struct wificonf }; - - -typedef struct _INF_PCI_CONFIG +typedef struct _RTMP_DEV_INFO_ { - PUCHAR CSRBaseAddress; // PCI MMIO Base Address, all access will use -}INF_PCI_CONFIG; + UCHAR chipName[16]; + RTMP_INF_TYPE infType; +}RTMP_DEV_INFO; -typedef struct _INF_USB_CONFIG -{ - UINT BulkInEpAddr; // bulk-in endpoint address - UINT BulkOutEpAddr[6]; // bulk-out endpoint address -}INF_USB_CONFIG; +struct _RTMP_CHIP_OP_ +{ + /* Calibration access related callback functions */ + int (*eeinit)(RTMP_ADAPTER *pAd); /* int (*eeinit)(RTMP_ADAPTER *pAd); */ + int (*eeread)(RTMP_ADAPTER *pAd, USHORT offset, PUSHORT pValue); /* int (*eeread)(RTMP_ADAPTER *pAd, int offset, PUSHORT pValue); */ + int (*eewrite)(RTMP_ADAPTER *pAd, USHORT offset, USHORT value);; /* int (*eewrite)(RTMP_ADAPTER *pAd, int offset, USHORT value); */ + + /* MCU related callback functions */ + int (*loadFirmware)(RTMP_ADAPTER *pAd); /* int (*loadFirmware)(RTMP_ADAPTER *pAd); */ + int (*eraseFirmware)(RTMP_ADAPTER *pAd); /* int (*eraseFirmware)(RTMP_ADAPTER *pAd); */ + int (*sendCommandToMcu)(RTMP_ADAPTER *pAd, UCHAR cmd, UCHAR token, UCHAR arg0, UCHAR arg1);; /* int (*sendCommandToMcu)(RTMP_ADAPTER *pAd, UCHAR cmd, UCHAR token, UCHAR arg0, UCHAR arg1); */ + + /* RF access related callback functions */ + REG_PAIR *pRFRegTable; + void (*AsicRfInit)(RTMP_ADAPTER *pAd); + void (*AsicRfTurnOn)(RTMP_ADAPTER *pAd); + void (*AsicRfTurnOff)(RTMP_ADAPTER *pAd); + void (*AsicReverseRfFromSleepMode)(RTMP_ADAPTER *pAd); + void (*AsicHaltAction)(RTMP_ADAPTER *pAd); +}; + // // The miniport adapter structure // -typedef struct _RTMP_ADAPTER +struct _RTMP_ADAPTER { PVOID OS_Cookie; // save specific structure relative to OS PNET_DEV net_dev; ULONG VirtualIfCnt; -#ifdef RT2860 + RTMP_CHIP_OP chipOps; + USHORT ThisTbttNumToNextWakeUp; + +#ifdef RTMP_MAC_PCI +/*****************************************************************************************/ +/* PCI related parameters */ +/*****************************************************************************************/ + PUCHAR CSRBaseAddress; // PCI MMIO Base Address, all access will use + unsigned int irq_num; + USHORT LnkCtrlBitMask; USHORT RLnkCtrlConfiguration; USHORT RLnkCtrlOffset; @@ -2531,15 +1816,7 @@ typedef struct _RTMP_ADAPTER USHORT HostLnkCtrlOffset; USHORT PCIePowerSaveLevel; BOOLEAN bPCIclkOff; // flag that indicate if the PICE power status in Configuration SPace.. - ULONG CheckDmaBusyCount; // Check Interrupt Status Register Count. - USHORT ThisTbttNumToNextWakeUp; - ULONG SameRxByteCount; - - -/*****************************************************************************************/ -/* PCI related parameters */ -/*****************************************************************************************/ - PUCHAR CSRBaseAddress; // PCI MMIO Base Address, all access will use + BOOLEAN bPCIclkOffDisableTx; // UINT int_enable_reg; UINT int_disable_mask; @@ -2550,12 +1827,13 @@ typedef struct _RTMP_ADAPTER RTMP_DMABUF RxDescRing; // Shared memory for RX descriptors RTMP_DMABUF TxDescRing[NUM_OF_TX_RING]; // Shared memory for Tx descriptors RTMP_TX_RING TxRing[NUM_OF_TX_RING]; // AC0~4 + HCCA -#endif +#endif // RTMP_MAC_PCI // + NDIS_SPIN_LOCK irq_lock; UCHAR irq_disabled; -#ifdef RT2870 +#ifdef RTMP_MAC_USB /*****************************************************************************************/ /* USB related parameters */ /*****************************************************************************************/ @@ -2572,34 +1850,38 @@ typedef struct _RTMP_ADAPTER ULONG BulkFlags; BOOLEAN bUsbTxBulkAggre; // Flags for bulk out data priority - - //======Timer Thread - RT2870_TIMER_QUEUE TimerQ; - NDIS_SPIN_LOCK TimerQLock; - - //======Cmd Thread CmdQ CmdQ; NDIS_SPIN_LOCK CmdQLock; // CmdQLock spinlock - - BOOLEAN TimerFunc_kill; - BOOLEAN mlme_kill; - + RTMP_OS_TASK cmdQTask; //======Semaphores (event) - struct semaphore mlme_semaphore; /* to sleep thread on */ - struct semaphore RTUSBCmd_semaphore; /* to sleep thread on */ - struct semaphore RTUSBTimer_semaphore; - struct completion TimerQComplete; - struct completion mlmeComplete; - struct completion CmdQComplete; + RTMP_OS_SEM UsbVendorReq_semaphore; + PVOID UsbVendorReqBuf; wait_queue_head_t *wait; -#endif // RT2870 // +#endif // RTMP_MAC_USB // + +/*****************************************************************************************/ +/* RBUS related parameters */ +/*****************************************************************************************/ /*****************************************************************************************/ - /* Both PCI/USB related parameters */ +/* Both PCI/USB related parameters */ /*****************************************************************************************/ + //RTMP_DEV_INFO chipInfo; + RTMP_INF_TYPE infType; + +/*****************************************************************************************/ +/* Driver Mgmt related parameters */ +/*****************************************************************************************/ + RTMP_OS_TASK mlmeTask; +#ifdef RTMP_TIMER_TASK_SUPPORT + // If you want use timer task to handle the timer related jobs, enable this. + RTMP_TIMER_TASK_QUEUE TimerQ; + NDIS_SPIN_LOCK TimerQLock; + RTMP_OS_TASK timerTask; +#endif // RTMP_TIMER_TASK_SUPPORT // /*****************************************************************************************/ @@ -2608,7 +1890,7 @@ typedef struct _RTMP_ADAPTER BOOLEAN DeQueueRunning[NUM_OF_TX_RING]; // for ensuring RTUSBDeQueuePacket get call once NDIS_SPIN_LOCK DeQueueLock[NUM_OF_TX_RING]; -#ifdef RT2870 +#ifdef RTMP_MAC_USB // Data related context and AC specified, 4 AC supported NDIS_SPIN_LOCK BulkOutLock[6]; // BulkOut spinlock for 4 ACs NDIS_SPIN_LOCK MLMEBulkOutLock; // MLME BulkOut lock @@ -2623,7 +1905,7 @@ typedef struct _RTMP_ADAPTER UCHAR bulkResetPipeid; BOOLEAN MgmtBulkPending; ULONG bulkResetReq[6]; -#endif // RT2870 // +#endif // RTMP_MAC_USB // // resource for software backlog queues QUEUE_HEADER TxSwQueue[NUM_OF_TX_RING]; // 4 AC + 1 HCCA @@ -2637,21 +1919,21 @@ typedef struct _RTMP_ADAPTER /*****************************************************************************************/ /* Rx related parameters */ /*****************************************************************************************/ -#ifdef RT2860 + +#ifdef RTMP_MAC_PCI RTMP_RX_RING RxRing; NDIS_SPIN_LOCK RxRingLock; // Rx Ring spinlock -#endif -#ifdef RT2870 +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB RX_CONTEXT RxContext[RX_RING_SIZE]; // 1 for redundant multiple IRP bulk in. NDIS_SPIN_LOCK BulkInLock; // BulkIn spinlock for 4 ACs - UCHAR PendingRx; // The Maxima pending Rx value should be RX_RING_SIZE. + UCHAR PendingRx; // The Maximum pending Rx value should be RX_RING_SIZE. UCHAR NextRxBulkInIndex; // Indicate the current RxContext Index which hold by Host controller. UCHAR NextRxBulkInReadIndex; // Indicate the current RxContext Index which driver can read & process it. ULONG NextRxBulkInPosition; // Want to contatenate 2 URB buffer while 1st is bulkin failed URB. This Position is 1st URB TransferLength. ULONG TransferBufferLength; // current length of the packet buffer ULONG ReadPosition; // current read position in a packet buffer -#endif // RT2870 // - +#endif // RTMP_MAC_USB // /*****************************************************************************************/ /* ASIC related parameters */ @@ -2662,18 +1944,18 @@ typedef struct _RTMP_ADAPTER // E2PROM // --------------------------- ULONG EepromVersion; // byte 0: version, byte 1: revision, byte 2~3: unused - UCHAR EEPROMAddressNum; // 93c46=6 93c66=8 + ULONG FirmwareVersion; // byte 0: Minor version, byte 1: Major version, otherwise unused. USHORT EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS]; -#ifdef RT2870 + UCHAR EEPROMAddressNum; // 93c46=6 93c66=8 BOOLEAN EepromAccess; -#endif - ULONG FirmwareVersion; // byte 0: Minor version, byte 1: Major version, otherwise unused. + UCHAR EFuseTag; + // --------------------------- // BBP Control // --------------------------- UCHAR BbpWriteLatch[140]; // record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID - UCHAR BbpRssiToDbmDelta; + CHAR BbpRssiToDbmDelta; // change from UCHAR to CHAR for high power BBP_R66_TUNING BbpTuning; // ---------------------------- @@ -2718,23 +2000,26 @@ typedef struct _RTMP_ADAPTER UCHAR TxAgcStepG; // Store Tx TSSI delta increment / decrement value CHAR TxAgcCompensateG; // Store the compensation (TxAgcStep * (idx-1)) - //+++For RT2870, the parameteres is start from BGRssiOffset1 ~ BGRssiOffset3 CHAR BGRssiOffset0; // Store B/G RSSI#0 Offset value on EEPROM 0x46h CHAR BGRssiOffset1; // Store B/G RSSI#1 Offset value CHAR BGRssiOffset2; // Store B/G RSSI#2 Offset value - //--- - //+++For RT2870, the parameteres is start from ARssiOffset1 ~ ARssiOffset3 CHAR ARssiOffset0; // Store A RSSI#0 Offset value on EEPROM 0x4Ah CHAR ARssiOffset1; // Store A RSSI#1 Offset value CHAR ARssiOffset2; // Store A RSSI#2 Offset value - //--- CHAR BLNAGain; // Store B/G external LNA#0 value on EEPROM 0x44h CHAR ALNAGain0; // Store A external LNA#0 value for ch36~64 CHAR ALNAGain1; // Store A external LNA#1 value for ch100~128 CHAR ALNAGain2; // Store A external LNA#2 value for ch132~165 - +#ifdef RT30xx + // for 3572 + UCHAR Bbp25; + UCHAR Bbp26; + + UCHAR TxMixerGain24G; // Tx mixer gain value from EEPROM to improve Tx EVM / Tx DAC, 2.4G + UCHAR TxMixerGain5G; +#endif // RT30xx // // ---------------------------- // LED control // ---------------------------- @@ -2742,7 +2027,7 @@ typedef struct _RTMP_ADAPTER USHORT Led1; // read from EEPROM 0x3c USHORT Led2; // EEPROM 0x3e USHORT Led3; // EEPROM 0x40 - UCHAR LedIndicatorStregth; + UCHAR LedIndicatorStrength; UCHAR RssiSingalstrengthOffet; BOOLEAN bLedOnScanning; UCHAR LedStatus; @@ -2759,20 +2044,17 @@ typedef struct _RTMP_ADAPTER PSPOLL_FRAME PsPollFrame; HEADER_802_11 NullFrame; -#ifdef RT2870 +#ifdef RTMP_MAC_USB TX_CONTEXT BeaconContext[BEACON_RING_SIZE]; TX_CONTEXT NullContext; TX_CONTEXT PsPollContext; TX_CONTEXT RTSContext; -#endif // RT2870 // - - +#endif // RTMP_MAC_USB // //=========AP=========== //=======STA=========== -/* Modified by Wu Xi-Kun 4/21/2006 */ // ----------------------------------------------- // STA specific configuration & operation status // used only when pAd->OpMode == OPMODE_STA @@ -2789,6 +2071,8 @@ typedef struct _RTMP_ADAPTER NDIS_MEDIA_STATE IndicateMediaState; // Base on Indication state, default is NdisMediaStateDisConnected + /* MAT related parameters */ + // configuration: read from Registry & E2PROM BOOLEAN bLocalAdminMAC; // Use user changed MAC UCHAR PermanentAddress[MAC_ADDR_LEN]; // Factory default MAC address @@ -2828,9 +2112,7 @@ typedef struct _RTMP_ADAPTER // flags, see fRTMP_ADAPTER_xxx flags ULONG Flags; // Represent current device status -#ifdef RT2860 ULONG PSFlags; // Power Save operation flag. -#endif // current TX sequence # USHORT Sequence; @@ -2863,36 +2145,38 @@ typedef struct _RTMP_ADAPTER /*****************************************************************************************/ /* Statistic related parameters */ /*****************************************************************************************/ -#ifdef RT2870 +#ifdef RTMP_MAC_USB ULONG BulkOutDataOneSecCount; ULONG BulkInDataOneSecCount; ULONG BulkLastOneSecCount; // BulkOutDataOneSecCount + BulkInDataOneSecCount ULONG watchDogRxCnt; ULONG watchDogRxOverFlowCnt; ULONG watchDogTxPendingCnt[NUM_OF_TX_RING]; -#endif // RT2870 // + INT TransferedLength[NUM_OF_TX_RING]; +#endif // RTMP_MAC_USB // BOOLEAN bUpdateBcnCntDone; ULONG watchDogMacDeadlock; // prevent MAC/BBP into deadlock condition // ---------------------------- // DEBUG paramerts // ---------------------------- + //ULONG DebugSetting[4]; BOOLEAN bBanAllBaSetup; BOOLEAN bPromiscuous; // ---------------------------- // rt2860c emulation-use Parameters // ---------------------------- - ULONG rtsaccu[30]; - ULONG ctsaccu[30]; - ULONG cfendaccu[30]; - ULONG bacontent[16]; - ULONG rxint[RX_RING_SIZE+1]; - UCHAR rcvba[60]; + //ULONG rtsaccu[30]; + //ULONG ctsaccu[30]; + //ULONG cfendaccu[30]; + //ULONG bacontent[16]; + //ULONG rxint[RX_RING_SIZE+1]; + //UCHAR rcvba[60]; BOOLEAN bLinkAdapt; BOOLEAN bForcePrintTX; BOOLEAN bForcePrintRX; - BOOLEAN bDisablescanning; //defined in RT2870 USB + //BOOLEAN bDisablescanning; //defined in RT2870 USB BOOLEAN bStaFifoTest; BOOLEAN bProtectionTest; BOOLEAN bHCCATest; @@ -2914,9 +2198,15 @@ typedef struct _RTMP_ADAPTER ULONG OneSecondnonBEpackets; // record non BE packets per second +#ifdef LINUX struct iw_statistics iw_stats; struct net_device_stats stats; +#endif // LINUX // + + + + ULONG TbttTickCount; #ifdef PCI_MSI_SUPPORT @@ -2933,32 +2223,24 @@ typedef struct _RTMP_ADAPTER + + + + + UINT8 FlgCtsEnabled; UINT8 PM_FlgSuspend; -#ifdef RT2870 +#ifdef RT30xx +#ifdef RTMP_EFUSE_SUPPORT BOOLEAN bUseEfuse; -#endif -} RTMP_ADAPTER, *PRTMP_ADAPTER; + BOOLEAN bEEPROMFile; + BOOLEAN bFroceEEPROMBuffer; + UCHAR EEPROMImage[1024]; +#endif // RTMP_EFUSE_SUPPORT // +#endif // RT30xx // +}; + -// -// Cisco IAPP format -// -typedef struct _CISCO_IAPP_CONTENT_ -{ - USHORT Length; //IAPP Length - UCHAR MessageType; //IAPP type - UCHAR FunctionCode; //IAPP function type - UCHAR DestinaionMAC[MAC_ADDR_LEN]; - UCHAR SourceMAC[MAC_ADDR_LEN]; - USHORT Tag; //Tag(element IE) - Adjacent AP report - USHORT TagLength; //Length of element not including 4 byte header - UCHAR OUI[4]; //0x00, 0x40, 0x96, 0x00 - UCHAR PreviousAP[MAC_ADDR_LEN]; //MAC Address of access point - USHORT Channel; - USHORT SsidLen; - UCHAR Ssid[MAX_LEN_OF_SSID]; - USHORT Seconds; //Seconds that the client has been disassociated. -} CISCO_IAPP_CONTENT, *PCISCO_IAPP_CONTENT; #define DELAYINTMASK 0x0003fffb #define INTMASK 0x0003fffb @@ -2976,8 +2258,12 @@ typedef struct _CISCO_IAPP_CONTENT_ #define FifoStaFullInt 0x00002000 // fifo statistics full interrupt +/*************************************************************************** + * Rx Path software control block related data structures + **************************************************************************/ typedef struct _RX_BLK_ { +// RXD_STRUC RxD; // sample RT28XX_RXD_STRUC RxD; PRXWI_STRUC pRxWI; PHEADER_802_11 pHeader; @@ -3012,6 +2298,10 @@ typedef struct _RX_BLK_ #define LENGTH_ARALINK_SUBFRAMEHEAD 14 #define LENGTH_ARALINK_HEADER_FIELD 2 + +/*************************************************************************** + * Tx Path software control block related data structures + **************************************************************************/ #define TX_UNKOWN_FRAME 0x00 #define TX_MCAST_FRAME 0x01 #define TX_LEGACY_FRAME 0x02 @@ -3040,7 +2330,9 @@ typedef struct _TX_BLK_ PUCHAR pSrcBufData; // Reference to the sk_buff->data, will changed depends on hanlding progresss UINT SrcBufLen; // Length of packet payload which not including Layer 2 header PUCHAR pExtraLlcSnapEncap; // NULL means no extra LLC/SNAP is required - UCHAR HeaderBuf[80]; // TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP + UCHAR HeaderBuf[128]; // TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP + //RT2870 2.1.0.0 uses only 80 bytes + //RT3070 2.1.1.0 uses only 96 bytes UCHAR MpduHeaderLen; // 802.11 header length NOT including the padding UCHAR HdrPadLen; // recording Header Padding Length; UCHAR apidx; // The interface associated to this packet @@ -3069,17 +2361,8 @@ typedef struct _TX_BLK_ #define fTX_bAllowFrag 0x0020 // allow to fragment the packet, A-MPDU, A-MSDU, A-Ralink is not allowed to fragment #define fTX_bMoreData 0x0040 // there are more data packets in PowerSave Queue #define fTX_bWMM 0x0080 // QOS Data - #define fTX_bClearEAPFrame 0x0100 -#define TX_BLK_ASSIGN_FLAG(_pTxBlk, _flag, value) \ - do { \ - if (value) \ - (_pTxBlk->Flags |= _flag) \ - else \ - (_pTxBlk->Flags &= ~(_flag)) \ - }while(0) - #define TX_BLK_SET_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags |= _flag) #define TX_BLK_TEST_FLAG(_pTxBlk, _flag) (((_pTxBlk->Flags & _flag) == _flag) ? 1 : 0) #define TX_BLK_CLEAR_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags &= ~(_flag)) @@ -3088,46 +2371,14 @@ typedef struct _TX_BLK_ -//------------------------------------------------------------------------------------------ -#ifdef RT2860 -// -// Enable & Disable NIC interrupt via writing interrupt mask register -// Since it use ADAPTER structure, it have to be put after structure definition. -// -__inline VOID NICDisableInterrupt( - IN PRTMP_ADAPTER pAd) -{ - RTMP_IO_WRITE32(pAd, INT_MASK_CSR, 0x0); // 0: disable - //RTMP_IO_WRITE32(pAd, PBF_INT_ENA, 0x0); // 0x418 is for firmware . SW doesn't handle here. - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE); -} - -__inline VOID NICEnableInterrupt( - IN PRTMP_ADAPTER pAd) -{ - // - // Flag "fOP_STATUS_DOZE" On, means ASIC put to sleep, else means ASIC WakeUp - // To prevent System hang, we should enalbe the interrupt when - // ASIC is already Wake Up. - // - // RT2661 => when ASIC is sleeping, MAC register cannot be read and written. - // RT2860 => when ASIC is sleeping, MAC register can be read and written. - //if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - RTMP_IO_WRITE32(pAd, INT_MASK_CSR, pAd->int_enable_reg /*DELAYINTMASK*/); // 1:enable - } - //else - // DBGPRINT(RT_DEBUG_TRACE, ("fOP_STATUS_DOZE !\n")); - - //RTMP_IO_WRITE32(pAd, PBF_INT_ENA, 0x00000030); // 1 : enable - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE); -} - -static inline VOID ConvertMulticastIP2MAC( - IN PUCHAR pIpAddr, - IN PUCHAR *ppMacAddr, - IN UINT16 ProtoType) +/*************************************************************************** + * Other static inline function definitions + **************************************************************************/ +static inline VOID ConvertMulticastIP2MAC( + IN PUCHAR pIpAddr, + IN PUCHAR *ppMacAddr, + IN UINT16 ProtoType) { if (pIpAddr == NULL) return; @@ -3161,37 +2412,59 @@ static inline VOID ConvertMulticastIP2MAC( return; } -#endif /* RT2860 */ + + +char *GetPhyMode(int Mode); +char* GetBW(int BW); // // Private routines in rtmp_init.c // NDIS_STATUS RTMPAllocAdapterBlock( IN PVOID handle, - OUT PRTMP_ADAPTER *ppAdapter - ); + OUT PRTMP_ADAPTER *ppAdapter); NDIS_STATUS RTMPAllocTxRxRingMemory( - IN PRTMP_ADAPTER pAd - ); + IN PRTMP_ADAPTER pAd); NDIS_STATUS RTMPReadParametersHook( - IN PRTMP_ADAPTER pAd - ); + IN PRTMP_ADAPTER pAd); + +NDIS_STATUS RTMPSetProfileParameters( + IN RTMP_ADAPTER *pAd, + IN PSTRING pBuffer); + +INT RTMPGetKeyParameter( + IN PSTRING key, + OUT PSTRING dest, + IN INT destsize, + IN PSTRING buffer, + IN BOOLEAN bTrimSpace); VOID RTMPFreeAdapter( - IN PRTMP_ADAPTER pAd - ); + IN PRTMP_ADAPTER pAd); NDIS_STATUS NICReadRegParameters( IN PRTMP_ADAPTER pAd, - IN NDIS_HANDLE WrapperConfigurationContext - ); + IN NDIS_HANDLE WrapperConfigurationContext); -#ifdef RT2870 -VOID NICInitRT30xxRFRegisters( +#ifdef RTMP_RF_RW_SUPPORT +VOID NICInitRFRegisters( IN PRTMP_ADAPTER pAd); -#endif // RT2870 // + +VOID RtmpChipOpsRFHook( + IN RTMP_ADAPTER *pAd); + +NDIS_STATUS RT30xxWriteRFRegister( + IN PRTMP_ADAPTER pAd, + IN UCHAR regID, + IN UCHAR value); + +NDIS_STATUS RT30xxReadRFRegister( + IN PRTMP_ADAPTER pAd, + IN UCHAR regID, + IN PUCHAR pValue); +#endif // RTMP_RF_RW_SUPPORT // VOID NICReadEEPROMParameters( IN PRTMP_ADAPTER pAd, @@ -3200,8 +2473,6 @@ VOID NICReadEEPROMParameters( VOID NICInitAsicFromEEPROM( IN PRTMP_ADAPTER pAd); -VOID NICInitTxRxRingAndBacklogQueue( - IN PRTMP_ADAPTER pAd); NDIS_STATUS NICInitializeAdapter( IN PRTMP_ADAPTER pAd, @@ -3210,10 +2481,7 @@ NDIS_STATUS NICInitializeAdapter( NDIS_STATUS NICInitializeAsic( IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset); -#ifdef RT2860 -VOID NICRestoreBBPValue( - IN PRTMP_ADAPTER pAd); -#endif + VOID NICIssueReset( IN PRTMP_ADAPTER pAd); @@ -3227,10 +2495,10 @@ VOID UserCfgInit( VOID NICResetFromError( IN PRTMP_ADAPTER pAd); -VOID NICEraseFirmware( +NDIS_STATUS NICLoadFirmware( IN PRTMP_ADAPTER pAd); -NDIS_STATUS NICLoadFirmware( +VOID NICEraseFirmware( IN PRTMP_ADAPTER pAd); NDIS_STATUS NICLoadRateSwitchingParams( @@ -3245,10 +2513,6 @@ VOID NICUpdateFifoStaCounters( VOID NICUpdateRawCounters( IN PRTMP_ADAPTER pAd); -ULONG RTMPNotAllZero( - IN PVOID pSrc1, - IN ULONG Length); - VOID RTMPZeroMemory( IN PVOID pSrc, IN ULONG Length); @@ -3264,8 +2528,8 @@ VOID RTMPMoveMemory( IN ULONG Length); VOID AtoH( - char *src, - UCHAR *dest, + PSTRING src, + PUCHAR dest, int destlen); UCHAR BtoH( @@ -3383,6 +2647,7 @@ VOID SendRefreshBAR( IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY *pEntry); + VOID ActHeaderInit( IN PRTMP_ADAPTER pAd, IN OUT PHEADER_802_11 pHdr80211, @@ -3444,6 +2709,7 @@ BOOLEAN PeerIsAggreOn( IN ULONG TxRate, IN PMAC_TABLE_ENTRY pMacEntry); + NDIS_STATUS Sniff2BytesFromNdisBuffer( IN PNDIS_BUFFER pFirstBuffer, IN UCHAR DesiredOffset, @@ -3498,11 +2764,24 @@ NDIS_STATUS MlmeHardTransmitMgmtRing( IN UCHAR QueIdx, IN PNDIS_PACKET pPacket); +#ifdef RTMP_MAC_PCI NDIS_STATUS MlmeHardTransmitTxRing( IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx, IN PNDIS_PACKET pPacket); +NDIS_STATUS MlmeDataHardTransmit( + IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, + IN PNDIS_PACKET pPacket); + +VOID RTMPWriteTxDescriptor( + IN PRTMP_ADAPTER pAd, + IN PTXD_STRUC pTxD, + IN BOOLEAN bWIV, + IN UCHAR QSEL); +#endif // RTMP_MAC_PCI // + USHORT RTMPCalcDuration( IN PRTMP_ADAPTER pAd, IN UCHAR Rate, @@ -3539,12 +2818,6 @@ VOID RTMPWriteTxWI_Cache( IN OUT PTXWI_STRUC pTxWI, IN TX_BLK *pTxBlk); -VOID RTMPWriteTxDescriptor( - IN PRTMP_ADAPTER pAd, - IN PTXD_STRUC pTxD, - IN BOOLEAN bWIV, - IN UCHAR QSEL); - VOID RTMPSuspendMsduTransmission( IN PRTMP_ADAPTER pAd); @@ -3557,6 +2830,9 @@ NDIS_STATUS MiniportMMRequest( IN PUCHAR pData, IN UINT Length); +//+++mark by shiang, now this function merge to MiniportMMRequest() +//---mark by shiang, now this function merge to MiniportMMRequest() + VOID RTMPSendNullFrame( IN PRTMP_ADAPTER pAd, IN UCHAR TxRate, @@ -3593,6 +2869,16 @@ VOID WpaDisassocApAndBlockAssoc( IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +VOID WpaStaPairwiseKeySetting( + IN PRTMP_ADAPTER pAd); + +VOID WpaStaGroupKeySetting( + IN PRTMP_ADAPTER pAd); + +VOID WpaSendEapolStart( + IN PRTMP_ADAPTER pAdapter, + IN PUCHAR pBssid); + NDIS_STATUS RTMPCloneNdisPacket( IN PRTMP_ADAPTER pAd, IN BOOLEAN pInsAMSDUHdr, @@ -3713,6 +2999,9 @@ VOID AsicRfTuningExec( IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +VOID AsicResetBBPAgent( + IN PRTMP_ADAPTER pAd); + VOID AsicSleepThenAutoWakeup( IN PRTMP_ADAPTER pAd, IN USHORT TbttNumToNextWakeUp); @@ -3722,12 +3011,7 @@ VOID AsicForceSleep( VOID AsicForceWakeup( IN PRTMP_ADAPTER pAd, -#ifdef RT2860 - IN UCHAR Level); -#endif -#ifdef RT2870 IN BOOLEAN bFromTx); -#endif VOID AsicSetBssid( IN PRTMP_ADAPTER pAd, @@ -3821,11 +3105,14 @@ BOOLEAN AsicSendCommandToMcu( IN UCHAR Token, IN UCHAR Arg0, IN UCHAR Arg1); -#ifdef RT2860 + + +#ifdef RTMP_MAC_PCI BOOLEAN AsicCheckCommanOk( IN PRTMP_ADAPTER pAd, IN UCHAR Command); -#endif +#endif // RTMP_MAC_PCI // + VOID MacAddrRandomBssid( IN PRTMP_ADAPTER pAd, OUT PUCHAR pAddr); @@ -3871,6 +3158,11 @@ ULONG BssTableSearchWithSSID( IN UCHAR SsidLen, IN UCHAR Channel); +ULONG BssSsidTableSearchBySSID( + IN BSS_TABLE *Tab, + IN PUCHAR pSsid, + IN UCHAR SsidLen); + VOID BssTableDeleteEntry( IN OUT PBSS_TABLE pTab, IN PUCHAR pBssid, @@ -4095,9 +3387,6 @@ VOID Cls3errAction( IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr); -VOID SwitchBetweenWepAndCkip( - IN PRTMP_ADAPTER pAd); - VOID InvalidStateWhenAssoc( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem); @@ -4110,12 +3399,12 @@ VOID InvalidStateWhenDisassociate( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem); -#ifdef RT2870 +#ifdef RTMP_MAC_USB VOID MlmeCntlConfirm( IN PRTMP_ADAPTER pAd, IN ULONG MsgType, IN USHORT Msg); -#endif // RT2870 // +#endif // RTMP_MAC_USB // VOID ComposePsPoll( IN PRTMP_ADAPTER pAd); @@ -4325,7 +3614,7 @@ VOID AssocParmFill( VOID ScanParmFill( IN PRTMP_ADAPTER pAd, IN OUT MLME_SCAN_REQ_STRUCT *ScanReq, - IN CHAR Ssid[], + IN STRING Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN UCHAR ScanType); @@ -4396,7 +3685,7 @@ VOID ScanNextChannel( ULONG MakeIbssBeacon( IN PRTMP_ADAPTER pAd); -VOID CCXAdjacentAPReport( +VOID InitChannelRelatedValue( IN PRTMP_ADAPTER pAd); BOOLEAN MlmeScanReqSanity( @@ -4527,6 +3816,13 @@ BOOLEAN PeerDisassocSanity( OUT PUCHAR pAddr2, OUT USHORT *Reason); +BOOLEAN PeerWpaMessageSanity( + IN PRTMP_ADAPTER pAd, + IN PEAPOL_PACKET pMsg, + IN ULONG MsgLen, + IN UCHAR MsgType, + IN MAC_TABLE_ENTRY *pEntry); + BOOLEAN PeerDeauthSanity( IN PRTMP_ADAPTER pAd, IN VOID *Msg, @@ -4570,7 +3866,7 @@ BOOLEAN MlmeAddBAReqSanity( OUT PUCHAR pAddr2); ULONG MakeOutgoingFrame( - OUT CHAR *Buffer, + OUT UCHAR *Buffer, OUT ULONG *Length, ...); VOID LfsrInit( @@ -4613,9 +3909,8 @@ VOID MlmeCheckForRoaming( IN PRTMP_ADAPTER pAd, IN ULONG Now32); -VOID MlmeCheckForFastRoaming( - IN PRTMP_ADAPTER pAd, - IN ULONG Now); +BOOLEAN MlmeCheckForFastRoaming( + IN PRTMP_ADAPTER pAd); VOID MlmeDynamicTxRateSwitching( IN PRTMP_ADAPTER pAd); @@ -4634,6 +3929,7 @@ VOID MlmeSelectTxRateTable( VOID MlmeCalculateChannelQuality( IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pMacEntry, IN ULONG Now); VOID MlmeCheckPsmChange( @@ -4691,10 +3987,91 @@ CHAR RTMPMaxRssi( IN CHAR Rssi1, IN CHAR Rssi2); +#ifdef RT30xx VOID AsicSetRxAnt( IN PRTMP_ADAPTER pAd, IN UCHAR Ant); +VOID RTMPFilterCalibration( + IN PRTMP_ADAPTER pAd); + +#ifdef RTMP_EFUSE_SUPPORT +//2008/09/11:KH add to support efuse<-- +INT set_eFuseGetFreeBlockCount_Proc( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg); + +INT set_eFusedump_Proc( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg); + +INT set_eFuseLoadFromBin_Proc( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg); + +VOID eFusePhysicalReadRegisters( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN USHORT Length, + OUT USHORT* pData); + +int RtmpEfuseSupportCheck( + IN RTMP_ADAPTER *pAd); + +INT set_eFuseBufferModeWriteBack_Proc( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg); + +INT eFuseLoadEEPROM( + IN PRTMP_ADAPTER pAd); + +INT eFuseWriteEeeppromBuf( + IN PRTMP_ADAPTER pAd); + +VOID eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, + PUINT EfuseFreeBlock); + +INT eFuse_init( + IN PRTMP_ADAPTER pAd); + +NTSTATUS eFuseRead( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + OUT PUCHAR pData, + IN USHORT Length); + +NTSTATUS eFuseWrite( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN PUCHAR pData, + IN USHORT length); +//2008/09/11:KH add to support efuse--> +#endif // RTMP_EFUSE_SUPPORT // + +// add by johnli, RF power sequence setup +VOID RT30xxLoadRFNormalModeSetup( + IN PRTMP_ADAPTER pAd); + +VOID RT30xxLoadRFSleepModeSetup( + IN PRTMP_ADAPTER pAd); + +VOID RT30xxReverseRFSleepModeSetup( + IN PRTMP_ADAPTER pAd); +// end johnli + +#ifdef RT3070 +VOID NICInitRT3070RFRegisters( + IN RTMP_ADAPTER *pAd); +#endif // RT3070 // + +VOID RT30xxHaltAction( + IN PRTMP_ADAPTER pAd); + +VOID RT30xxSetRxAnt( + IN PRTMP_ADAPTER pAd, + IN UCHAR Ant); +#endif // RT30xx // + VOID AsicEvaluateRxAnt( IN PRTMP_ADAPTER pAd); @@ -4751,15 +4128,6 @@ VOID ChangeToCellPowerLimit( IN PRTMP_ADAPTER pAd, IN UCHAR AironetCellPowerLimit); -USHORT RTMP_EEPROM_READ16( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset); - -VOID RTMP_EEPROM_WRITE16( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Data); - // // Prototypes of function definition in rtmp_tkip.c // @@ -4797,15 +4165,6 @@ VOID RTMPCalculateMICValue( IN PCIPHER_KEY pKey, IN UCHAR apidx); -BOOLEAN RTMPTkipCompareMICValueWithLLC( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pLLC, - IN PUCHAR pSrc, - IN PUCHAR pDA, - IN PUCHAR pSA, - IN PUCHAR pMICKey, - IN UINT Len); - VOID RTMPTkipAppendByte( IN PTKIP_KEY_INFO pTkip, IN UCHAR uChar); @@ -4831,6 +4190,39 @@ BOOLEAN RTMPSoftDecryptAES( IN ULONG DataByteCnt, IN PCIPHER_KEY pWpaKey); + + +// +// Prototypes of function definition in cmm_info.c +// +INT RT_CfgSetCountryRegion( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg, + IN INT band); + +INT RT_CfgSetWirelessMode( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg); + +INT RT_CfgSetShortSlot( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg); + +INT RT_CfgSetWepKey( + IN PRTMP_ADAPTER pAd, + IN PSTRING keyString, + IN CIPHER_KEY *pSharedKey, + IN INT keyIdx); + +INT RT_CfgSetWPAPSKKey( + IN RTMP_ADAPTER *pAd, + IN PSTRING keyString, + IN UCHAR *pHashStr, + IN INT hashStrLen, + OUT PUCHAR pPMKBuf); + + + // // Prototypes of function definition in cmm_info.c // @@ -4862,26 +4254,12 @@ VOID RTMPAddWcidAttributeEntry( IN UCHAR CipherAlg, IN MAC_TABLE_ENTRY *pEntry); -CHAR *GetEncryptType( +PSTRING GetEncryptType( CHAR enc); -CHAR *GetAuthMode( +PSTRING GetAuthMode( CHAR auth); -VOID RTMPIoctlGetSiteSurvey( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq); - -VOID RTMPIoctlGetMacTable( - IN PRTMP_ADAPTER pAd, - IN struct iwreq *wrq); - -VOID RTMPAddBSSIDCipher( - IN PRTMP_ADAPTER pAd, - IN UCHAR Aid, - IN PNDIS_802_11_KEY pKey, - IN UCHAR CipherAlg); - VOID RTMPSetHT( IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE *pHTPhyMode); @@ -4897,88 +4275,24 @@ VOID RTMPSendWirelessEvent( IN UCHAR BssIdx, IN CHAR Rssi); -// -// prototype in wpa.c -// -BOOLEAN WpaMsgTypeSubst( - IN UCHAR EAPType, - OUT INT *MsgType); - -VOID WpaPskStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - OUT STATE_MACHINE_FUNC Trans[]); - -VOID WpaEAPOLKeyAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID WpaPairMsg1Action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID WpaPairMsg3Action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID WpaGroupMsg1Action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID WpaMacHeaderInit( - IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, - IN UCHAR wep, - IN PUCHAR pAddr1); - -VOID Wpa2PairMsg1Action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID Wpa2PairMsg3Action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -BOOLEAN ParseKeyData( +CHAR ConvertToRssi( IN PRTMP_ADAPTER pAd, - IN PUCHAR pKeyData, - IN UCHAR KeyDataLen, - IN UCHAR bPairewise); + IN CHAR Rssi, + IN UCHAR RssiNumber); +/*=================================== + Function prototype in cmm_wpa.c + =================================== */ VOID RTMPToWirelessSta( IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, IN PUCHAR pHeader802_3, IN UINT HdrLen, IN PUCHAR pData, IN UINT DataLen, - IN BOOLEAN is4wayFrame); - -VOID HMAC_SHA1( - IN UCHAR *text, - IN UINT text_len, - IN UCHAR *key, - IN UINT key_len, - IN UCHAR *digest); - -VOID PRF( - IN UCHAR *key, - IN INT key_len, - IN UCHAR *prefix, - IN INT prefix_len, - IN UCHAR *data, - IN INT data_len, - OUT UCHAR *output, - IN INT len); - -VOID CCKMPRF( - IN UCHAR *key, - IN INT key_len, - IN UCHAR *data, - IN INT data_len, - OUT UCHAR *output, - IN INT len); + IN BOOLEAN bClearFrame); -VOID WpaCountPTK( +VOID WpaDerivePTK( IN PRTMP_ADAPTER pAd, IN UCHAR *PMK, IN UCHAR *ANonce, @@ -4993,95 +4307,129 @@ VOID GenRandom( IN UCHAR *macAddr, OUT UCHAR *random); -// -// prototype in aironet.c -// -VOID AironetStateMachineInit( +BOOLEAN RTMPCheckWPAframe( IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - OUT STATE_MACHINE_FUNC Trans[]); + IN PMAC_TABLE_ENTRY pEntry, + IN PUCHAR pData, + IN ULONG DataByteCount, + IN UCHAR FromWhichBSSID); -VOID AironetMsgAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID AES_GTK_KEY_UNWRAP( + IN UCHAR *key, + OUT UCHAR *plaintext, + IN UINT32 c_len, + IN UCHAR *ciphertext); -VOID AironetRequestAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +BOOLEAN RTMPParseEapolKeyData( + IN PRTMP_ADAPTER pAd, + IN PUCHAR pKeyData, + IN UCHAR KeyDataLen, + IN UCHAR GroupKeyIndex, + IN UCHAR MsgType, + IN BOOLEAN bWPA2, + IN MAC_TABLE_ENTRY *pEntry); + +VOID ConstructEapolMsg( + IN PMAC_TABLE_ENTRY pEntry, + IN UCHAR GroupKeyWepStatus, + IN UCHAR MsgType, + IN UCHAR DefaultKeyIdx, + IN UCHAR *KeyNonce, + IN UCHAR *TxRSC, + IN UCHAR *GTK, + IN UCHAR *RSNIE, + IN UCHAR RSNIE_Len, + OUT PEAPOL_PACKET pMsg); + +NDIS_STATUS RTMPSoftDecryptBroadCastData( + IN PRTMP_ADAPTER pAd, + IN RX_BLK *pRxBlk, + IN NDIS_802_11_ENCRYPTION_STATUS GroupCipher, + IN PCIPHER_KEY pShard_key); -VOID ChannelLoadRequestAction( +VOID RTMPMakeRSNIE( IN PRTMP_ADAPTER pAd, - IN UCHAR Index); + IN UINT AuthMode, + IN UINT WepStatus, + IN UCHAR apidx); -VOID NoiseHistRequestAction( +// +// function prototype in ap_wpa.c +// +VOID RTMPGetTxTscFromAsic( IN PRTMP_ADAPTER pAd, - IN UCHAR Index); + IN UCHAR apidx, + OUT PUCHAR pTxTsc); + +VOID APInstallPairwiseKey( + PRTMP_ADAPTER pAd, + PMAC_TABLE_ENTRY pEntry); -VOID BeaconRequestAction( +UINT APValidateRSNIE( IN PRTMP_ADAPTER pAd, - IN UCHAR Index); + IN PMAC_TABLE_ENTRY pEntry, + IN PUCHAR pRsnIe, + IN UCHAR rsnie_len); -VOID AironetReportAction( +VOID HandleCounterMeasure( IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); + IN MAC_TABLE_ENTRY *pEntry); -VOID ChannelLoadReportAction( +VOID WPAStart4WayHS( IN PRTMP_ADAPTER pAd, - IN UCHAR Index); + IN MAC_TABLE_ENTRY *pEntry, + IN ULONG TimeInterval); -VOID NoiseHistReportAction( +VOID WPAStart2WayGroupHS( IN PRTMP_ADAPTER pAd, - IN UCHAR Index); + IN MAC_TABLE_ENTRY *pEntry); -VOID AironetFinalReportAction( - IN PRTMP_ADAPTER pAd); +VOID PeerPairMsg1Action( + IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY *pEntry, + IN MLME_QUEUE_ELEM *Elem); -VOID BeaconReportAction( +VOID PeerPairMsg2Action( IN PRTMP_ADAPTER pAd, - IN UCHAR Index); + IN MAC_TABLE_ENTRY *pEntry, + IN MLME_QUEUE_ELEM *Elem); -VOID AironetAddBeaconReport( +VOID PeerPairMsg3Action( IN PRTMP_ADAPTER pAd, - IN ULONG Index, - IN PMLME_QUEUE_ELEM pElem); + IN MAC_TABLE_ENTRY *pEntry, + IN MLME_QUEUE_ELEM *Elem); -VOID AironetCreateBeaconReportFromBssTable( - IN PRTMP_ADAPTER pAd); +VOID PeerPairMsg4Action( + IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY *pEntry, + IN MLME_QUEUE_ELEM *Elem); -CHAR ConvertToRssi( +VOID PeerGroupMsg1Action( IN PRTMP_ADAPTER pAd, - IN CHAR Rssi, - IN UCHAR RssiNumber); + IN PMAC_TABLE_ENTRY pEntry, + IN MLME_QUEUE_ELEM *Elem); -// -// function prototype in cmm_wpa.c -// -BOOLEAN RTMPCheckWPAframe( +VOID PeerGroupMsg2Action( IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR pData, - IN ULONG DataByteCount, - IN UCHAR FromWhichBSSID); + IN VOID *Msg, + IN UINT MsgLen); -VOID AES_GTK_KEY_UNWRAP( - IN UCHAR *key, - OUT UCHAR *plaintext, - IN UCHAR c_len, - IN UCHAR *ciphertext); +VOID WpaDeriveGTK( + IN UCHAR *PMK, + IN UCHAR *GNonce, + IN UCHAR *AA, + OUT UCHAR *output, + IN UINT len); -VOID RTMPMakeRSNIE( - IN PRTMP_ADAPTER pAd, - IN UINT AuthMode, - IN UINT WepStatus, - IN UCHAR apidx); +VOID AES_GTK_KEY_WRAP( + IN UCHAR *key, + IN UCHAR *plaintext, + IN UINT32 p_len, + OUT UCHAR *ciphertext); -// -// function prototype in ap_wpa.c -// +//typedef void (*TIMER_FUNCTION)(unsigned long); -VOID HandleCounterMeasure( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry); /* timeout -- ms */ VOID RTMP_SetPeriodicTimer( @@ -5116,13 +4464,13 @@ VOID RTMPusecDelay( IN ULONG usec); NDIS_STATUS os_alloc_mem( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR *mem, + IN RTMP_ADAPTER *pAd, + OUT UCHAR **mem, IN ULONG size); NDIS_STATUS os_free_mem( IN PRTMP_ADAPTER pAd, - IN PUCHAR mem); + IN PVOID mem); void RTMP_AllocateSharedMemory( @@ -5155,6 +4503,13 @@ void RTMP_AllocateFirstTxBuffer( OUT PVOID *VirtualAddress, OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); +void RTMP_FreeFirstTxBuffer( + IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN BOOLEAN Cached, + IN PVOID VirtualAddress, + IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); + void RTMP_AllocateMgmtDescMemory( IN PRTMP_ADAPTER pAd, IN ULONG Length, @@ -5169,6 +4524,16 @@ void RTMP_AllocateRxDescMemory( OUT PVOID *VirtualAddress, OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); +void RTMP_FreeDescMemory( + IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN PVOID VirtualAddress, + IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); + +PNDIS_PACKET RtmpOSNetPktAlloc( + IN RTMP_ADAPTER *pAd, + IN int size); + PNDIS_PACKET RTMP_AllocateRxPacketBuffer( IN PRTMP_ADAPTER pAd, IN ULONG Length, @@ -5279,203 +4644,210 @@ VOID BARecSessionTearDown( BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num); void ba_reordering_resource_release(PRTMP_ADAPTER pAd); + + + BOOLEAN rtstrmactohex( - IN char *s1, - IN char *s2); + IN PSTRING s1, + IN PSTRING s2); BOOLEAN rtstrcasecmp( - IN char *s1, - IN char *s2); + IN PSTRING s1, + IN PSTRING s2); -char *rtstrstruncasecmp( - IN char *s1, - IN char *s2); +PSTRING rtstrstruncasecmp( + IN PSTRING s1, + IN PSTRING s2); -char *rtstrstr( - IN const char * s1, - IN const char * s2); +PSTRING rtstrstr( + IN const PSTRING s1, + IN const PSTRING s2); -char *rstrtok( - IN char * s, - IN const char * ct); +PSTRING rstrtok( + IN PSTRING s, + IN const PSTRING ct); int rtinet_aton( - const char *cp, + const PSTRING cp, unsigned int *addr); ////////// common ioctl functions ////////// INT Set_DriverVersion_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_CountryRegion_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_CountryRegionABand_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_WirelessMode_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_Channel_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_ShortSlot_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_TxPower_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_BGProtection_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_TxPreamble_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_RTSThreshold_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_FragThreshold_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_TxBurst_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); #ifdef AGGREGATION_SUPPORT INT Set_PktAggregate_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); -#endif + IN PSTRING arg); +#endif // AGGREGATION_SUPPORT // INT Set_IEEE80211H_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); #ifdef DBG INT Set_Debug_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); #endif INT Show_DescInfo_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_ResetStatCounter_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_BASetup_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_BADecline_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_BAOriTearDown_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_BARecTearDown_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_HtBw_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_HtMcs_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_HtGi_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_HtOpMode_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_HtStbc_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_HtHtc_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_HtExtcha_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_HtMpduDensity_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_HtBaWinSize_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_HtRdg_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_HtLinkAdapt_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_HtAmsdu_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_HtAutoBa_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_HtProtect_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_HtMimoPs_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_ForceShortGI_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_ForceGF_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT SetCommonHT( IN PRTMP_ADAPTER pAd); INT Set_SendPSMPAction_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_HtMIMOPSmode_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_HtTxBASize_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); + +INT Set_HtDisallowTKIP_Proc( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg); INT WpaCheckEapCode( IN PRTMP_ADAPTER pAd, @@ -5528,12 +4900,6 @@ void wlan_802_11_to_802_3_packet( IN PUCHAR pHeader802_3, IN UCHAR FromWhichBSSID); -UINT deaggregate_AMSDU_announce( - IN PRTMP_ADAPTER pAd, - PNDIS_PACKET pPacket, - IN PUCHAR pData, - IN ULONG DataSize); - // remove LLC and get 802_3 Header #define RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(_pRxBlk, _pHeader802_3) \ { \ @@ -5604,11 +4970,28 @@ VOID Update_Rssi_Sample( IN RSSI_SAMPLE *pRssi, IN PRXWI_STRUC pRxWI); +PNDIS_PACKET GetPacketFromRxRing( + IN PRTMP_ADAPTER pAd, + OUT PRT28XX_RXD_STRUC pSaveRxD, + OUT BOOLEAN *pbReschedule, + IN OUT UINT32 *pRxPending); + PNDIS_PACKET RTMPDeFragmentDataFrame( IN PRTMP_ADAPTER pAd, IN RX_BLK *pRxBlk); //////////////////////////////////////// + +VOID RTMPIoctlGetSiteSurvey( + IN PRTMP_ADAPTER pAdapter, + IN struct iwreq *wrq); + + + + + + + enum { DIDmsg_lnxind_wlansniffrm = 0x00000044, DIDmsg_lnxind_wlansniffrm_hosttime = 0x00010044, @@ -5712,9 +5095,6 @@ void send_monitor_packets( IN PRTMP_ADAPTER pAd, IN RX_BLK *pRxBlk); -// This function will be called when query /proc -struct iw_statistics *rt28xx_get_wireless_stats( - IN struct net_device *net_dev); VOID RTMPSetDesiredRates( IN PRTMP_ADAPTER pAdapter, @@ -5722,62 +5102,20 @@ VOID RTMPSetDesiredRates( INT Set_FixedTxMode_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); - -static inline char* GetPhyMode( - int Mode) -{ - switch(Mode) - { - case MODE_CCK: - return "CCK"; - - case MODE_OFDM: - return "OFDM"; - case MODE_HTMIX: - return "HTMIX"; - - case MODE_HTGREENFIELD: - return "GREEN"; - default: - return "N/A"; - } -} - - -static inline char* GetBW( - int BW) -{ - switch(BW) - { - case BW_10: - return "10M"; + IN PSTRING arg); - case BW_20: - return "20M"; - case BW_40: - return "40M"; - default: - return "N/A"; - } -} +INT Set_LongRetryLimit_Proc( + IN PRTMP_ADAPTER pAdapter, + IN PSTRING arg); -VOID RT28xxThreadTerminate( - IN RTMP_ADAPTER *pAd); +INT Set_ShortRetryLimit_Proc( + IN PRTMP_ADAPTER pAdapter, + IN PSTRING arg); BOOLEAN RT28XXChipsetCheck( IN void *_dev_p); -BOOLEAN RT28XXNetDevInit( - IN void *_dev_p, - IN struct net_device *net_dev, - IN RTMP_ADAPTER *pAd); - -BOOLEAN RT28XXProbePostConfig( - IN void *_dev_p, - IN RTMP_ADAPTER *pAd, - IN INT32 argc); VOID RT28XXDMADisable( IN RTMP_ADAPTER *pAd); @@ -5791,26 +5129,45 @@ VOID RT28xx_UpdateBeaconToAsic( IN ULONG BeaconLen, IN ULONG UpdatePos); -INT rt28xx_sta_ioctl( - IN struct net_device *net_dev, - IN OUT struct ifreq *rq, - IN INT cmd); - -//////////////////////////////////////// -PNDIS_PACKET GetPacketFromRxRing( +int rt28xx_init( IN PRTMP_ADAPTER pAd, - OUT PRT28XX_RXD_STRUC pSaveRxD, - OUT BOOLEAN *pbReschedule, - IN OUT UINT32 *pRxPending); + IN PSTRING pDefaultMac, + IN PSTRING pHostName); + +NDIS_STATUS RtmpNetTaskInit( + IN RTMP_ADAPTER *pAd); + +VOID RtmpNetTaskExit( + IN PRTMP_ADAPTER pAd); +NDIS_STATUS RtmpMgmtTaskInit( + IN RTMP_ADAPTER *pAd); -void kill_thread_task(PRTMP_ADAPTER pAd); +VOID RtmpMgmtTaskExit( + IN RTMP_ADAPTER *pAd); void tbtt_tasklet(unsigned long data); -#ifdef RT2860 + +PNET_DEV RtmpPhyNetDevInit( + IN RTMP_ADAPTER *pAd, + IN RTMP_OS_NETDEV_OP_HOOK *pNetHook); + +BOOLEAN RtmpPhyNetDevExit( + IN RTMP_ADAPTER *pAd, + IN PNET_DEV net_dev); + +INT RtmpRaDevCtrlInit( + IN RTMP_ADAPTER *pAd, + IN RTMP_INF_TYPE infType); + +BOOLEAN RtmpRaDevCtrlExit( + IN RTMP_ADAPTER *pAd); + + +#ifdef RTMP_MAC_PCI // -// Function Prototype in cmm_data_2860.c +// Function Prototype in cmm_data_pci.c // USHORT RtmpPCI_WriteTxResource( IN PRTMP_ADAPTER pAd, @@ -5873,6 +5230,16 @@ NDIS_STATUS RTMPCheckRxError( IN PRXWI_STRUC pRxWI, IN PRT28XX_RXD_STRUC pRxD); +BOOLEAN RT28xxPciAsicRadioOff( + IN PRTMP_ADAPTER pAd, + IN UCHAR Level, + IN USHORT TbttNumToNextWakeUp); + +BOOLEAN RT28xxPciAsicRadioOn( + IN PRTMP_ADAPTER pAd, + IN UCHAR Level); + +#ifdef RTMP_PCI_SUPPORT VOID RTMPInitPCIeLinkCtrlValue( IN PRTMP_ADAPTER pAd); @@ -5887,23 +5254,6 @@ VOID RTMPPCIeLinkCtrlSetting( IN PRTMP_ADAPTER pAd, IN USHORT Max); -VOID RT28xxPciAsicRadioOff( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level, - IN USHORT TbttNumToNextWakeUp); - -BOOLEAN RT28xxPciAsicRadioOn( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level); - -VOID RT28xxPciStaAsicForceWakeup( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level); - -VOID RT28xxPciStaAsicSleepThenAutoWakeup( - IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp); - VOID PsPollWakeExec( IN PVOID SystemSpecific1, IN PVOID FunctionContext, @@ -5915,112 +5265,25 @@ VOID RadioOnExec( IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +#endif // RTMP_PCI_SUPPORT // -VOID RT28xxPciMlmeRadioOn( - IN PRTMP_ADAPTER pAd); - -VOID RT28xxPciMlmeRadioOFF( - IN PRTMP_ADAPTER pAd); -#endif /* RT2860 */ - -VOID AsicTurnOffRFClk( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel); - -VOID AsicTurnOnRFClk( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel); - -NTSTATUS RT30xxWriteRFRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR RegID, - IN UCHAR Value); - -NTSTATUS RT30xxReadRFRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR RegID, - IN PUCHAR pValue); - -UCHAR eFuseReadRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - OUT USHORT* pData); - -VOID eFuseReadPhysical( - IN PRTMP_ADAPTER pAd, - IN PUSHORT lpInBuffer, - IN ULONG nInBufferSize, - OUT PUSHORT lpOutBuffer, - IN ULONG nOutBufferSize -); - -NTSTATUS eFuseRead( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - OUT PUCHAR pData, - IN USHORT Length); - -VOID eFusePhysicalWriteRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - OUT USHORT* pData); - -NTSTATUS eFuseWriteRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - IN USHORT* pData); - -VOID eFuseWritePhysical( - IN PRTMP_ADAPTER pAd, - PUSHORT lpInBuffer, - ULONG nInBufferSize, - PUCHAR lpOutBuffer, - ULONG nOutBufferSize -); - -NTSTATUS eFuseWrite( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN PUCHAR pData, - IN USHORT length); - -INT set_eFuseGetFreeBlockCount_Proc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); - -INT set_eFusedump_Proc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); - -INT set_eFuseLoadFromBin_Proc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); - -NTSTATUS eFuseWriteRegistersFromBin( +VOID RT28xxPciStaAsicForceWakeup( IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - IN USHORT* pData); + IN BOOLEAN bFromTx); -VOID eFusePhysicalReadRegisters( +VOID RT28xxPciStaAsicSleepThenAutoWakeup( IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - OUT USHORT* pData); + IN USHORT TbttNumToNextWakeUp); -VOID RT30xxLoadRFNormalModeSetup( - IN PRTMP_ADAPTER pAd); -VOID RT30xxLoadRFSleepModeSetup( +VOID RT28xxPciMlmeRadioOn( IN PRTMP_ADAPTER pAd); -VOID RT30xxReverseRFSleepModeSetup( +VOID RT28xxPciMlmeRadioOFF( IN PRTMP_ADAPTER pAd); +#endif // RTMP_MAC_PCI // -#ifdef RT2870 +#ifdef RTMP_MAC_USB // // Function Prototype in rtusb_bulk.c // @@ -6037,6 +5300,10 @@ VOID RTUSBInitHTTxDesc( IN ULONG BulkOutSize, IN usb_complete_t Func); +VOID RTUSBInitRxDesc( + IN PRTMP_ADAPTER pAd, + IN PRX_CONTEXT pRxContext); + VOID RTUSBCleanUpDataBulkOutQueue( IN PRTMP_ADAPTER pAd); @@ -6083,6 +5350,9 @@ VOID RTUSBInitRxDesc( IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext); +VOID RTUSBBulkRxHandle( + IN unsigned long data); + // // Function Prototype in rtusb_io.c // @@ -6168,36 +5438,19 @@ VOID RTUSBDequeueCmd( INT RTUSBCmdThread( IN OUT PVOID Context); -INT TimerQThread( - IN OUT PVOID Context); - -RT2870_TIMER_ENTRY *RT2870_TimerQ_Insert( - IN RTMP_ADAPTER *pAd, - IN RALINK_TIMER_STRUCT *pTimer); - -BOOLEAN RT2870_TimerQ_Remove( - IN RTMP_ADAPTER *pAd, - IN RALINK_TIMER_STRUCT *pTimer); - -void RT2870_TimerQ_Exit( - IN RTMP_ADAPTER *pAd); - -void RT2870_TimerQ_Init( - IN RTMP_ADAPTER *pAd); - -VOID RT2870_BssBeaconExit( +VOID RTUSBBssBeaconExit( IN RTMP_ADAPTER *pAd); -VOID RT2870_BssBeaconStop( +VOID RTUSBBssBeaconStop( IN RTMP_ADAPTER *pAd); -VOID RT2870_BssBeaconStart( +VOID RTUSBBssBeaconStart( IN RTMP_ADAPTER * pAd); -VOID RT2870_BssBeaconInit( +VOID RTUSBBssBeaconInit( IN RTMP_ADAPTER *pAd); -VOID RT2870_WatchDog( +VOID RTUSBWatchDog( IN RTMP_ADAPTER *pAd); NTSTATUS RTUSBWriteMACRegister( @@ -6215,28 +5468,27 @@ NTSTATUS RTUSBSingleWrite( IN USHORT Offset, IN USHORT Value); -NTSTATUS RTUSBFirmwareRun( - IN PRTMP_ADAPTER pAd); - NTSTATUS RTUSBFirmwareWrite( IN PRTMP_ADAPTER pAd, IN PUCHAR pFwImage, IN ULONG FwLen); -NTSTATUS RTUSBFirmwareOpmode( - IN PRTMP_ADAPTER pAd, - OUT PUINT32 pValue); - NTSTATUS RTUSBVenderReset( IN PRTMP_ADAPTER pAd); -VOID CMDHandler( - IN PRTMP_ADAPTER pAd); +NDIS_STATUS RTUSBSetHardWareRegister( + IN PRTMP_ADAPTER pAdapter, + IN PVOID pBuf); +NDIS_STATUS RTUSBQueryHardWareRegister( + IN PRTMP_ADAPTER pAdapter, + IN PVOID pBuf); -NDIS_STATUS CreateThreads( - IN struct net_device *net_dev ); +VOID CMDHandler( + IN PRTMP_ADAPTER pAd); +NDIS_STATUS RTUSBWriteHWMACAddress( + IN PRTMP_ADAPTER pAdapter); VOID MacTableInitialize( IN PRTMP_ADAPTER pAd); @@ -6252,12 +5504,30 @@ NDIS_STATUS RTMPWPAAddKeyProc( VOID AsicRxAntEvalAction( IN PRTMP_ADAPTER pAd); +void append_pkt( + IN PRTMP_ADAPTER pAd, + IN PUCHAR pHeader802_3, + IN UINT HdrLen, + IN PUCHAR pData, + IN ULONG DataSize, + OUT PNDIS_PACKET *ppPacket); + +UINT deaggregate_AMSDU_announce( + IN PRTMP_ADAPTER pAd, + PNDIS_PACKET pPacket, + IN PUCHAR pData, + IN ULONG DataSize); + NDIS_STATUS RTMPCheckRxError( IN PRTMP_ADAPTER pAd, IN PHEADER_802_11 pHeader, IN PRXWI_STRUC pRxWI, IN PRT28XX_RXD_STRUC pRxINFO); +VOID RTUSBMlmeHardTransmit( + IN PRTMP_ADAPTER pAd, + IN PMGMT_STRUC pMgmt); + INT MlmeThread( IN PVOID Context); @@ -6285,7 +5555,7 @@ VOID RTMPWriteTxInfo( IN UCHAR TxBurst); // -// Function Prototype in cmm_data_2870.c +// Function Prototype in cmm_data_usb.c // USHORT RtmpUSB_WriteSubTxResource( IN PRTMP_ADAPTER pAd, @@ -6315,9 +5585,6 @@ VOID RtmpUSB_FinalWriteTxResource( IN PRTMP_ADAPTER pAd, IN TX_BLK *pTxBlk, IN USHORT totalMPDUSize, -#ifdef RT2860 - IN USHORT FirstTxIdx); -#endif IN USHORT TxIdx); VOID RtmpUSBDataLastTxIdx( @@ -6344,6 +5611,12 @@ VOID RtmpUSBNullFrameKickOut( IN UCHAR *pNullFrame, IN UINT32 frameLen); +VOID RtmpUsbStaAsicForceWakeupTimeout( + IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3); + VOID RT28xxUsbStaAsicForceWakeup( IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx); @@ -6357,44 +5630,72 @@ VOID RT28xxUsbMlmeRadioOn( VOID RT28xxUsbMlmeRadioOFF( IN PRTMP_ADAPTER pAd); -#endif // RT2870 // +#endif // RTMP_MAC_USB // + +VOID AsicTurnOffRFClk( + IN PRTMP_ADAPTER pAd, + IN UCHAR Channel); + +VOID AsicTurnOnRFClk( + IN PRTMP_ADAPTER pAd, + IN UCHAR Channel); + + + +#ifdef RTMP_TIMER_TASK_SUPPORT +INT RtmpTimerQThread( + IN OUT PVOID Context); + +RTMP_TIMER_TASK_ENTRY *RtmpTimerQInsert( + IN RTMP_ADAPTER *pAd, + IN RALINK_TIMER_STRUCT *pTimer); + +BOOLEAN RtmpTimerQRemove( + IN RTMP_ADAPTER *pAd, + IN RALINK_TIMER_STRUCT *pTimer); + +void RtmpTimerQExit( + IN RTMP_ADAPTER *pAd); + +void RtmpTimerQInit( + IN RTMP_ADAPTER *pAd); +#endif // RTMP_TIMER_TASK_SUPPORT // +/////////////////////////////////////// INT RTMPShowCfgValue( IN PRTMP_ADAPTER pAd, - IN PUCHAR pName, - IN PUCHAR pBuf); + IN PSTRING pName, + IN PSTRING pBuf); -PCHAR RTMPGetRalinkAuthModeStr( +PSTRING RTMPGetRalinkAuthModeStr( IN NDIS_802_11_AUTHENTICATION_MODE authMode); -PCHAR RTMPGetRalinkEncryModeStr( +PSTRING RTMPGetRalinkEncryModeStr( IN USHORT encryMode); +////////////////////////////////////// VOID AsicStaBbpTuning( IN PRTMP_ADAPTER pAd); -#ifdef RT2860 -VOID AsicResetFromDMABusy( - IN PRTMP_ADAPTER pAd); - -VOID AsicResetBBP( - IN PRTMP_ADAPTER pAd); - -VOID AsicResetMAC( - IN PRTMP_ADAPTER pAd); - -VOID AsicResetPBF( - IN PRTMP_ADAPTER pAd); -#endif -#ifdef RT2870 BOOLEAN StaAddMacTableEntry( IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, IN UCHAR MaxSupportedRateIn500Kbps, IN HT_CAPABILITY_IE *pHtCapability, IN UCHAR HtCapabilityLen, + IN ADD_HT_INFO_IE *pAddHtInfo, + IN UCHAR AddHtInfoLen, IN USHORT CapabilityInfo); -#endif + + +BOOLEAN AUTH_ReqSend( + IN PRTMP_ADAPTER pAd, + IN PMLME_QUEUE_ELEM pElem, + IN PRALINK_TIMER_STRUCT pAuthTimer, + IN PSTRING pSMName, + IN USHORT SeqNo, + IN PUCHAR pNewElement, + IN ULONG ElementLen); void RTMP_IndicateMediaState( IN PRTMP_ADAPTER pAd); @@ -6409,13 +5710,23 @@ VOID RTMPSetAGCInitValue( int rt28xx_close(IN PNET_DEV dev); int rt28xx_open(IN PNET_DEV dev); + +#define VIRTUAL_IF_INC(__pAd) ((__pAd)->VirtualIfCnt++) +#define VIRTUAL_IF_DEC(__pAd) ((__pAd)->VirtualIfCnt--) +#define VIRTUAL_IF_NUM(__pAd) ((__pAd)->VirtualIfCnt) + + +#ifdef LINUX __inline INT VIRTUAL_IF_UP(PRTMP_ADAPTER pAd) { if (VIRTUAL_IF_NUM(pAd) == 0) { if (rt28xx_open(pAd->net_dev) != 0) + { + DBGPRINT(RT_DEBUG_TRACE, ("rt28xx_open return fail!\n")); return -1; } + } else { } @@ -6430,6 +5741,107 @@ __inline VOID VIRTUAL_IF_DOWN(PRTMP_ADAPTER pAd) rt28xx_close(pAd->net_dev); return; } +#endif // LINUX // + + +/* + OS Related funciton prototype definitions. + TODO: Maybe we need to move these function prototypes to other proper place. +*/ +int RtmpOSWrielessEventSend( + IN RTMP_ADAPTER *pAd, + IN UINT32 eventType, + IN INT flags, + IN PUCHAR pSrcMac, + IN PUCHAR pData, + IN UINT32 dataLen); + +int RtmpOSNetDevAddrSet( + IN PNET_DEV pNetDev, + IN PUCHAR pMacAddr); + +int RtmpOSNetDevAttach( + IN PNET_DEV pNetDev, + IN RTMP_OS_NETDEV_OP_HOOK *pDevOpHook); + +void RtmpOSNetDevClose( + IN PNET_DEV pNetDev); + +void RtmpOSNetDevDetach( + IN PNET_DEV pNetDev); + +INT RtmpOSNetDevAlloc( + IN PNET_DEV *pNewNetDev, + IN UINT32 privDataSize); + +void RtmpOSNetDevFree( + IN PNET_DEV pNetDev); + +PNET_DEV RtmpOSNetDevGetByName( + IN PNET_DEV pNetDev, + IN PSTRING pDevName); + +void RtmpOSNetDeviceRefPut( + IN PNET_DEV pNetDev); + +PNET_DEV RtmpOSNetDevCreate( + IN RTMP_ADAPTER *pAd, + IN INT devType, + IN INT devNum, + IN INT privMemSize, + IN PSTRING pNamePrefix); + +/* + Task operation related function prototypes +*/ +void RtmpOSTaskCustomize( + IN RTMP_OS_TASK *pTask); + +INT RtmpOSTaskNotifyToExit( + IN RTMP_OS_TASK *pTask); + +NDIS_STATUS RtmpOSTaskKill( + IN RTMP_OS_TASK *pTask); + +NDIS_STATUS RtmpOSTaskInit( + IN RTMP_OS_TASK *pTask, + PSTRING pTaskName, + VOID *pPriv); + +NDIS_STATUS RtmpOSTaskAttach( + IN RTMP_OS_TASK *pTask, + IN int (*fn)(void *), + IN void *arg); + + +/* + File operation related function prototypes +*/ +RTMP_OS_FD RtmpOSFileOpen( + IN char *pPath, + IN int flag, + IN int mode); + +int RtmpOSFileClose( + IN RTMP_OS_FD osfd); + +void RtmpOSFileSeek( + IN RTMP_OS_FD osfd, + IN int offset); + +int RtmpOSFileRead( + IN RTMP_OS_FD osfd, + IN char *pDataPtr, + IN int readLen); + +int RtmpOSFileWrite( + IN RTMP_OS_FD osfd, + IN char *pDataPtr, + IN int writeLen); + +void RtmpOSFSInfoChange( + IN RTMP_OS_FS_INFO *pOSFSInfo, + IN BOOLEAN bSet); #endif // __RTMP_H__ diff --git a/drivers/staging/rt2860/rtmp_chip.h b/drivers/staging/rt2860/rtmp_chip.h new file mode 100644 index 000000000000..998960ede86e --- /dev/null +++ b/drivers/staging/rt2860/rtmp_chip.h @@ -0,0 +1,265 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + rtmp_chip.h + + Abstract: + Ralink Wireless Chip related definition & structures + + Revision History: + Who When What + -------- ---------- ---------------------------------------------- +*/ + +#ifndef __RTMP_CHIP_H__ +#define __RTMP_CHIP_H__ + +#include "rtmp_type.h" + +#ifdef RT2860 +#include "chip/rt2860.h" +#endif // RT2860 // +#ifdef RT2870 +#include "chip/rt2870.h" +#endif // RT2870 // +#ifdef RT3070 +#include "chip/rt3070.h" +#endif // RT3070 // + +// We will have a cost down version which mac version is 0x3090xxxx +// +// RT3090A facts +// +// a) 2.4 GHz +// b) Replacement for RT3090 +// c) Internal LNA +// d) Interference over channel #14 +// e) New BBP features (e.g., SIG re-modulation) +// +#define IS_RT3090A(_pAd) ((((_pAd)->MACVersion & 0xffff0000) == 0x30900000)) + +// We will have a cost down version which mac version is 0x3090xxxx +#define IS_RT3090(_pAd) ((((_pAd)->MACVersion & 0xffff0000) == 0x30710000) || (IS_RT3090A(_pAd))) + +#define IS_RT3070(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x30700000) +#define IS_RT3071(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x30710000) +#define IS_RT2070(_pAd) (((_pAd)->RfIcType == RFIC_2020) || ((_pAd)->EFuseTag == 0x27)) + +#define IS_RT30xx(_pAd) (((_pAd)->MACVersion & 0xfff00000) == 0x30700000||IS_RT3090A(_pAd)) +//#define IS_RT305X(_pAd) ((_pAd)->MACVersion == 0x28720200) + +/* RT3572, 3592, 3562, 3062 share the same MAC version */ +#define IS_RT3572(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x35720000) +#define IS_VERSION_BEFORE_F(_pAd) (((_pAd)->MACVersion&0xffff) <= 0x0211) +// F version is 0x0212, E version is 0x0211. 309x can save more power after F version. +#define IS_VERSION_AFTER_F(_pAd) ((((_pAd)->MACVersion&0xffff) >= 0x0212) || (((_pAd)->b3090ESpecialChip == TRUE))) +// +// RT3390 facts +// +// a) Base on RT3090 (RF IC: RT3020) +// b) 2.4 GHz +// c) 1x1 +// d) Single chip +// e) Internal components: PA and LNA +// +//RT3390,RT3370 +#define IS_RT3390(_pAd) (((_pAd)->MACVersion & 0xFFFF0000) == 0x33900000) + +// ------------------------------------------------------ +// PCI registers - base address 0x0000 +// ------------------------------------------------------ +#define CHIP_PCI_CFG 0x0000 +#define CHIP_PCI_EECTRL 0x0004 +#define CHIP_PCI_MCUCTRL 0x0008 + +#define OPT_14 0x114 + +#define RETRY_LIMIT 10 + + + +// ------------------------------------------------------ +// BBP & RF definition +// ------------------------------------------------------ +#define BUSY 1 +#define IDLE 0 + + +//------------------------------------------------------------------------- +// EEPROM definition +//------------------------------------------------------------------------- +#define EEDO 0x08 +#define EEDI 0x04 +#define EECS 0x02 +#define EESK 0x01 +#define EERL 0x80 + +#define EEPROM_WRITE_OPCODE 0x05 +#define EEPROM_READ_OPCODE 0x06 +#define EEPROM_EWDS_OPCODE 0x10 +#define EEPROM_EWEN_OPCODE 0x13 + +#define NUM_EEPROM_BBP_PARMS 19 // Include NIC Config 0, 1, CR, TX ALC step, BBPs +#define NUM_EEPROM_TX_G_PARMS 7 +#define EEPROM_NIC1_OFFSET 0x34 // The address is from NIC config 0, not BBP register ID +#define EEPROM_NIC2_OFFSET 0x36 // The address is from NIC config 0, not BBP register ID +#define EEPROM_BBP_BASE_OFFSET 0xf0 // The address is from NIC config 0, not BBP register ID +#define EEPROM_G_TX_PWR_OFFSET 0x52 +#define EEPROM_G_TX2_PWR_OFFSET 0x60 +#define EEPROM_LED1_OFFSET 0x3c +#define EEPROM_LED2_OFFSET 0x3e +#define EEPROM_LED3_OFFSET 0x40 +#define EEPROM_LNA_OFFSET 0x44 +#define EEPROM_RSSI_BG_OFFSET 0x46 +#define EEPROM_TXMIXER_GAIN_2_4G 0x48 +#define EEPROM_RSSI_A_OFFSET 0x4a +#define EEPROM_TXMIXER_GAIN_5G 0x4c +#define EEPROM_DEFINE_MAX_TXPWR 0x4e +#define EEPROM_TXPOWER_BYRATE_20MHZ_2_4G 0xde // 20MHZ 2.4G tx power. +#define EEPROM_TXPOWER_BYRATE_40MHZ_2_4G 0xee // 40MHZ 2.4G tx power. +#define EEPROM_TXPOWER_BYRATE_20MHZ_5G 0xfa // 20MHZ 5G tx power. +#define EEPROM_TXPOWER_BYRATE_40MHZ_5G 0x10a // 40MHZ 5G tx power. +#define EEPROM_A_TX_PWR_OFFSET 0x78 +#define EEPROM_A_TX2_PWR_OFFSET 0xa6 +//#define EEPROM_Japan_TX_PWR_OFFSET 0x90 // 802.11j +//#define EEPROM_Japan_TX2_PWR_OFFSET 0xbe +//#define EEPROM_TSSI_REF_OFFSET 0x54 +//#define EEPROM_TSSI_DELTA_OFFSET 0x24 +//#define EEPROM_CCK_TX_PWR_OFFSET 0x62 +//#define EEPROM_CALIBRATE_OFFSET 0x7c +#define EEPROM_VERSION_OFFSET 0x02 +#define EEPROM_FREQ_OFFSET 0x3a +#define EEPROM_TXPOWER_BYRATE 0xde // 20MHZ power. +#define EEPROM_TXPOWER_DELTA 0x50 // 20MHZ AND 40 MHZ use different power. This is delta in 40MHZ. +#define VALID_EEPROM_VERSION 1 + + +/* + * EEPROM operation related marcos + */ +#define RT28xx_EEPROM_READ16(_pAd, _offset, _value) \ + (_pAd)->chipOps.eeread((RTMP_ADAPTER *)(_pAd), (USHORT)(_offset), (PUSHORT)&(_value)) + +#define RT28xx_EEPROM_WRITE16(_pAd, _offset, _value) \ + (_pAd)->chipOps.eewrite((RTMP_ADAPTER *)(_pAd), (USHORT)(_offset), (USHORT)(_value)) + + + +// ------------------------------------------------------------------- +// E2PROM data layout +// ------------------------------------------------------------------- + +// +// MCU_LEDCS: MCU LED Control Setting. +// +typedef union _MCU_LEDCS_STRUC { + struct { + UCHAR LedMode:7; + UCHAR Polarity:1; + } field; + UCHAR word; +} MCU_LEDCS_STRUC, *PMCU_LEDCS_STRUC; + + +// +// EEPROM antenna select format +// +typedef union _EEPROM_ANTENNA_STRUC { + struct { + USHORT RxPath:4; // 1: 1R, 2: 2R, 3: 3R + USHORT TxPath:4; // 1: 1T, 2: 2T + USHORT RfIcType:4; // see E2PROM document + USHORT Rsv:4; + } field; + USHORT word; +} EEPROM_ANTENNA_STRUC, *PEEPROM_ANTENNA_STRUC; + +typedef union _EEPROM_NIC_CINFIG2_STRUC { + struct { + USHORT HardwareRadioControl:1; // 1:enable, 0:disable + USHORT DynamicTxAgcControl:1; // + USHORT ExternalLNAForG:1; // + USHORT ExternalLNAForA:1; // external LNA enable for 2.4G + USHORT CardbusAcceleration:1; // !!! NOTE: 0 - enable, 1 - disable + USHORT BW40MSidebandForG:1; + USHORT BW40MSidebandForA:1; + USHORT EnableWPSPBC:1; // WPS PBC Control bit + USHORT BW40MAvailForG:1; // 0:enable, 1:disable + USHORT BW40MAvailForA:1; // 0:enable, 1:disable + USHORT Rsv1:1; // must be 0 + USHORT AntDiversity:1; // Antenna diversity + USHORT Rsv2:3; // must be 0 + USHORT DACTestBit:1; // control if driver should patch the DAC issue + } field; + USHORT word; +} EEPROM_NIC_CONFIG2_STRUC, *PEEPROM_NIC_CONFIG2_STRUC; + +// +// TX_PWR Value valid range 0xFA(-6) ~ 0x24(36) +// +typedef union _EEPROM_TX_PWR_STRUC { + struct { + CHAR Byte0; // Low Byte + CHAR Byte1; // High Byte + } field; + USHORT word; +} EEPROM_TX_PWR_STRUC, *PEEPROM_TX_PWR_STRUC; + +typedef union _EEPROM_VERSION_STRUC { + struct { + UCHAR FaeReleaseNumber; // Low Byte + UCHAR Version; // High Byte + } field; + USHORT word; +} EEPROM_VERSION_STRUC, *PEEPROM_VERSION_STRUC; + +typedef union _EEPROM_LED_STRUC { + struct { + USHORT PolarityRDY_G:1; // Polarity RDY_G setting. + USHORT PolarityRDY_A:1; // Polarity RDY_A setting. + USHORT PolarityACT:1; // Polarity ACT setting. + USHORT PolarityGPIO_0:1; // Polarity GPIO#0 setting. + USHORT PolarityGPIO_1:1; // Polarity GPIO#1 setting. + USHORT PolarityGPIO_2:1; // Polarity GPIO#2 setting. + USHORT PolarityGPIO_3:1; // Polarity GPIO#3 setting. + USHORT PolarityGPIO_4:1; // Polarity GPIO#4 setting. + USHORT LedMode:5; // Led mode. + USHORT Rsvd:3; // Reserved + } field; + USHORT word; +} EEPROM_LED_STRUC, *PEEPROM_LED_STRUC; + +typedef union _EEPROM_TXPOWER_DELTA_STRUC { + struct { + UCHAR DeltaValue:6; // Tx Power dalta value (MAX=4) + UCHAR Type:1; // 1: plus the delta value, 0: minus the delta value + UCHAR TxPowerEnable:1;// Enable + } field; + UCHAR value; +} EEPROM_TXPOWER_DELTA_STRUC, *PEEPROM_TXPOWER_DELTA_STRUC; + +#endif // __RTMP_CHIP_H__ // diff --git a/drivers/staging/rt2860/rtmp_def.h b/drivers/staging/rt2860/rtmp_def.h index f5fee57fbe3e..e999710c02f5 100644 --- a/drivers/staging/rt2860/rtmp_def.h +++ b/drivers/staging/rt2860/rtmp_def.h @@ -41,6 +41,15 @@ #include "oid.h" +#undef AP_WSC_INCLUDED +#undef STA_WSC_INCLUDED +#undef WSC_INCLUDED + + + +#if defined(AP_WSC_INCLUDED) || defined(STA_WSC_INCLUDED) +#define WSC_INCLUDED +#endif // // Debug information verbosity: lower values indicate higher urgency // @@ -54,55 +63,28 @@ #define NIC_TAG ((ULONG)'0682') #define NIC_DBG_STRING ("**RT28xx**") +#ifdef RTMP_MAC_USB +#define TX_RING_SIZE 8 // 1 +#define PRIO_RING_SIZE 8 +#define MGMT_RING_SIZE 32 // PRIO_RING_SIZE +#define RX_RING_SIZE 8 +#define MAX_TX_PROCESS 4 +#define LOCAL_TXBUF_SIZE 2048 +#endif // RTMP_MAC_USB // + +//#define PACKED + #define RALINK_2883_VERSION ((UINT32)0x28830300) #define RALINK_2880E_VERSION ((UINT32)0x28720200) #define RALINK_3070_VERSION ((UINT32)0x30700200) -// -// NDIS version in use by the NIC driver. -// The high byte is the major version. The low byte is the minor version. -// -#ifdef NDIS51_MINIPORT -#define NIC_DRIVER_VERSION 0x0501 -#else -#define NIC_DRIVER_VERSION 0x0500 -#endif - -// -// NDIS media type, current is ethernet, change if native wireless supported -// -#define NIC_MEDIA_TYPE NdisMedium802_3 -#define NIC_PCI_HDR_LENGTH 0xe2 -#define NIC_MAX_PACKET_SIZE 2304 -#define NIC_HEADER_SIZE 14 -#define MAX_MAP_REGISTERS_NEEDED 32 -#define MIN_MAP_REGISTERS_NEEDED 2 //Todo: should consider fragment issue. - -// -// interface type, we use PCI -// -#define NIC_INTERFACE_TYPE NdisInterfacePci -#define NIC_INTERRUPT_MODE NdisInterruptLevelSensitive - -// -// buffer size passed in NdisMQueryAdapterResources -// We should only need three adapter resources (IO, interrupt and memory), -// Some devices get extra resources, so have room for 10 resources -// UF_SIZE (sizeof(NDIS_RESOURCE_LIST) + (10*sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR))) - - -#define NIC_RESOURCE_B// -// IO space length -// -#define NIC_MAP_IOSPACE_LENGTH sizeof(CSR_STRUC) - #define MAX_RX_PKT_LEN 1520 // // Entry number for each DMA descriptor ring // -#ifdef RT2860 +#ifdef RTMP_MAC_PCI #define TX_RING_SIZE 64 //64 #define MGMT_RING_SIZE 128 #define RX_RING_SIZE 128 //64 @@ -110,15 +92,7 @@ #define MAX_DMA_DONE_PROCESS TX_RING_SIZE #define MAX_TX_DONE_PROCESS TX_RING_SIZE //8 #define LOCAL_TXBUF_SIZE 2 -#endif -#ifdef RT2870 -#define TX_RING_SIZE 8 // 1 -#define PRIO_RING_SIZE 8 -#define MGMT_RING_SIZE 32 // PRIO_RING_SIZE -#define RX_RING_SIZE 8 -#define MAX_TX_PROCESS 4 -#define LOCAL_TXBUF_SIZE 2048 -#endif // RT2870 // +#endif // RTMP_MAC_PCI // #define MAX_RX_PROCESS 128 //64 //32 #define NUM_OF_LOCAL_TXBUF 2 @@ -143,16 +117,43 @@ #define MAX_RX_PROCESS_CNT (RX_RING_SIZE) +/* + WMM Note: If memory of your system is not much, please reduce the definition; + or when you do WMM test, the queue for low priority AC will be full, i.e. + TX_RING_SIZE + MAX_PACKETS_IN_QUEUE packets for the AC will be buffered in + WLAN, maybe no any packet buffer can be got in Ethernet driver. + + Sometimes no packet buffer can be got in Ethernet driver, the system will + send flow control packet to the sender to slow down its sending rate. + So no WMM can be saw in the air. +*/ + +/* + Need to use 64 in vxworks for test case WMM A5-T07 + Two dnlink (10Mbps) from a WMM station to a non-WMM station. + If use 256, queue is not enough. + And in rt_main_end.c, clConfig.clNum = RX_RING_SIZE * 3; is changed to + clConfig.clNum = RX_RING_SIZE * 4; +*/ +// TODO: For VxWorks the size is 256. Shall we cahnge the value as 256 for all OS????? #define MAX_PACKETS_IN_QUEUE (512) //(512) // to pass WMM A5-WPAPSK + #define MAX_PACKETS_IN_MCAST_PS_QUEUE 32 #define MAX_PACKETS_IN_PS_QUEUE 128 //32 #define WMM_NUM_OF_AC 4 /* AC0, AC1, AC2, and AC3 */ + +#ifdef RTMP_EFUSE_SUPPORT +//2008/09/11:KH add to support efuse<-- #define MAX_EEPROM_BIN_FILE_SIZE 1024 +#define EFUSE_BUFFER_PATH "/tmp/RT30xxEEPROM.bin" +//2008/09/11:KH add to support efuse--> +#endif // RTMP_EFUSE_SUPPORT // // RxFilter #define STANORMAL 0x17f97 #define APNORMAL 0x15f97 +#define PSPXLINK 0x17f93 // // RTMP_ADAPTER flags // @@ -203,9 +204,9 @@ #define fOP_STATUS_TX_AMSDU_INUSED 0x00002000 #define fOP_STATUS_MAX_RETRY_ENABLED 0x00004000 #define fOP_STATUS_WAKEUP_NOW 0x00008000 -#define fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE 0x00020000 +#define fOP_STATUS_PCIE_DEVICE 0x00020000 +#define fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE fOP_STATUS_PCIE_DEVICE -#ifdef RT2860 // // RTMP_ADAPTER PSFlags : related to advanced power save. // @@ -218,7 +219,8 @@ // Indicate driver should IMMEDIATELY fo to sleep after receiving AP's beacon in which doesn't indicate unicate nor multicast packets for me //. This flag is used ONLY in RTMPHandleRxDoneInterrupt routine. #define fRTMP_PS_GO_TO_SLEEP_NOW 0x00000008 -#endif +#define fRTMP_PS_TOGGLE_L1 0x00000010 // Use Toggle L1 mechanism for rt28xx PCIe + #define CCKSETPROTECT 0x1 #define OFDMSETPROTECT 0x2 @@ -266,6 +268,7 @@ #define fRX_FILTER_ACCEPT_MULTICAST NDIS_PACKET_TYPE_MULTICAST #define fRX_FILTER_ACCEPT_BROADCAST NDIS_PACKET_TYPE_BROADCAST #define fRX_FILTER_ACCEPT_ALL_MULTICAST NDIS_PACKET_TYPE_ALL_MULTICAST +#define fRX_FILTER_ACCEPT_PROMISCUOUS NDIS_PACKET_TYPE_PROMISCUOUS // // Error code section @@ -321,17 +324,15 @@ #define MAX_APCLI_NUM 0 #define MAX_MBSSID_NUM 1 -#if defined(RT2860) || defined(RT30xx) #ifdef MBSS_SUPPORT #undef MAX_MBSSID_NUM #define MAX_MBSSID_NUM (8 - MAX_MESH_NUM - MAX_APCLI_NUM) #endif // MBSS_SUPPORT // -#endif /* sanity check for apidx */ #define MBSS_MR_APIDX_SANITY_CHECK(apidx) \ { if (apidx > MAX_MBSSID_NUM) { \ - printk("%s> Error! apidx = %d > MAX_MBSSID_NUM!\n", __func__, apidx); \ + DBGPRINT(RT_DEBUG_ERROR, ("%s> Error! apidx = %d > MAX_MBSSID_NUM!\n", __func__, apidx)); \ apidx = MAIN_MBSSID; } } #define VALID_WCID(_wcid) ((_wcid) > 0 && (_wcid) < MAX_LEN_OF_MAC_TABLE ) @@ -397,6 +398,7 @@ #define HASH_TABLE_SIZE 256 #define MAX_VIE_LEN 1024 // New for WPA cipher suite variable IE sizes. #define MAX_SUPPORT_MCS 32 +#define MAX_NUM_OF_BBP_LATCH 140 //============================================================ // ASIC WCID Table definition. @@ -515,6 +517,9 @@ #define MLME_QOS_UNSPECIFY 32 #define MLME_REQUEST_DECLINED 37 #define MLME_REQUEST_WITH_INVALID_PARAM 38 +#define MLME_INVALID_GROUP_CIPHER 41 +#define MLME_INVALID_PAIRWISE_CIPHER 42 +#define MLME_INVALID_AKMP 43 #define MLME_DLS_NOT_ALLOW_IN_QBSS 48 #define MLME_DEST_STA_NOT_IN_QBSS 49 #define MLME_DEST_STA_IS_NOT_A_QSTA 50 @@ -569,6 +574,7 @@ // For 802.11n D3.03 //#define IE_NEW_EXT_CHA_OFFSET 62 // 802.11n d1. New extension channel offset elemet #define IE_SECONDARY_CH_OFFSET 62 // 802.11n D3.03 Secondary Channel Offset element +#define IE_WAPI 68 // WAPI information element #define IE_2040_BSS_COEXIST 72 // 802.11n D3.0.3 #define IE_2040_BSS_INTOLERANT_REPORT 73 // 802.11n D3.03 #define IE_OVERLAPBSS_SCAN_PARM 74 // 802.11n D3.03 @@ -605,17 +611,22 @@ #define SYNC_STATE_MACHINE 4 #define MLME_CNTL_STATE_MACHINE 5 #define WPA_PSK_STATE_MACHINE 6 -#define LEAP_STATE_MACHINE 7 +//#define LEAP_STATE_MACHINE 7 #define AIRONET_STATE_MACHINE 8 #define ACTION_STATE_MACHINE 9 // AP MLME state machines #define AP_ASSOC_STATE_MACHINE 11 #define AP_AUTH_STATE_MACHINE 12 -#define AP_AUTH_RSP_STATE_MACHINE 13 #define AP_SYNC_STATE_MACHINE 14 #define AP_CNTL_STATE_MACHINE 15 -#define AP_WPA_STATE_MACHINE 16 +#define WSC_STATE_MACHINE 17 +#define WSC_UPNP_STATE_MACHINE 18 + + +#define WPA_STATE_MACHINE 23 + + // // STA's CONTROL/CONNECT state machine: states, events, total function # @@ -630,9 +641,9 @@ #define CNTL_WAIT_AUTH2 7 #define CNTL_WAIT_OID_LIST_SCAN 8 #define CNTL_WAIT_OID_DISASSOC 9 -#ifdef RT2870 +#ifdef RTMP_MAC_USB #define CNTL_WAIT_SCAN_FOR_CONNECT 10 -#endif // RT2870 // +#endif // RTMP_MAC_USB // #define MT2_ASSOC_CONF 34 #define MT2_AUTH_CONF 35 @@ -646,6 +657,7 @@ #define MT2_GET_CONF 43 #define MT2_SET_CONF 44 #define MT2_RESET_CONF 45 +#define MT2_FT_OTD_CONF 46 #define MT2_MLME_ROAMING_REQ 52 #define CNTL_FUNC_SIZE 1 @@ -691,8 +703,11 @@ #define MT2_PEER_BA_CATE 3 #define MT2_PEER_PUBLIC_CATE 4 #define MT2_PEER_RM_CATE 5 +/* "FT_CATEGORY_BSS_TRANSITION equal to 6" is defined file of "dot11r_ft.h" */ #define MT2_PEER_HT_CATE 7 // 7.4.7 #define MAX_PEER_CATE_MSG 7 + + #define MT2_MLME_ADD_BA_CATE 8 #define MT2_MLME_ORI_DELBA_CATE 9 #define MT2_MLME_REC_DELBA_CATE 10 @@ -822,35 +837,8 @@ #define DLS_FUNC_SIZE (MAX_DLS_STATE * MAX_DLS_MSG) // -// STA's WPA-PSK State machine: states, events, total function # +// WSC State machine: states, events, total function # // -#define WPA_PSK_IDLE 0 -#define MAX_WPA_PSK_STATE 1 - -#define WPA_MACHINE_BASE 0 -#define MT2_EAPPacket 0 -#define MT2_EAPOLStart 1 -#define MT2_EAPOLLogoff 2 -#define MT2_EAPOLKey 3 -#define MT2_EAPOLASFAlert 4 -#define MAX_WPA_PSK_MSG 5 - -#define WPA_PSK_FUNC_SIZE (MAX_WPA_PSK_STATE * MAX_WPA_PSK_MSG) - -// -// STA's CISCO-AIRONET State machine: states, events, total function # -// -#define AIRONET_IDLE 0 -#define AIRONET_SCANNING 1 -#define MAX_AIRONET_STATE 2 - -#define AIRONET_MACHINE_BASE 0 -#define MT2_AIRONET_MSG 0 -#define MT2_AIRONET_SCAN_REQ 1 -#define MT2_AIRONET_SCAN_DONE 2 -#define MAX_AIRONET_MSG 3 - -#define AIRONET_FUNC_SIZE (MAX_AIRONET_STATE * MAX_AIRONET_MSG) // // AP's CONTROL/CONNECT state machine: states, events, total function # @@ -882,23 +870,12 @@ #define AP_AUTH_MACHINE_BASE 0 #define APMT2_MLME_DEAUTH_REQ 0 #define APMT2_CLS2ERR 1 -#define AP_MAX_AUTH_MSG 2 - -#define AP_AUTH_FUNC_SIZE (AP_MAX_AUTH_STATE * AP_MAX_AUTH_MSG) - -// -// AP's AUTH-RSP state machine: states, events, total function # -// -#define AP_AUTH_RSP_IDLE 0 -#define AP_MAX_AUTH_RSP_STATE 1 - -#define AP_AUTH_RSP_MACHINE_BASE 0 -#define APMT2_AUTH_CHALLENGE_TIMEOUT 0 -#define APMT2_PEER_AUTH_ODD 1 #define APMT2_PEER_DEAUTH 2 -#define AP_MAX_AUTH_RSP_MSG 3 +#define APMT2_PEER_AUTH_REQ 3 +#define APMT2_PEER_AUTH_CONFIRM 4 +#define AP_MAX_AUTH_MSG 5 -#define AP_AUTH_RSP_FUNC_SIZE (AP_MAX_AUTH_RSP_STATE * AP_MAX_AUTH_RSP_MSG) +#define AP_AUTH_FUNC_SIZE (AP_MAX_AUTH_STATE * AP_MAX_AUTH_MSG) // // AP's SYNC state machine: states, events, total function # @@ -919,20 +896,22 @@ #define AP_SYNC_FUNC_SIZE (AP_MAX_SYNC_STATE * AP_MAX_SYNC_MSG) // -// AP's WPA state machine: states, events, total function # +// Common WPA state machine: states, events, total function # // -#define AP_WPA_PTK 0 -#define AP_MAX_WPA_PTK_STATE 1 +#define WPA_PTK 0 +#define MAX_WPA_PTK_STATE 1 + +#define WPA_MACHINE_BASE 0 +#define MT2_EAPPacket 0 +#define MT2_EAPOLStart 1 +#define MT2_EAPOLLogoff 2 +#define MT2_EAPOLKey 3 +#define MT2_EAPOLASFAlert 4 +#define MAX_WPA_MSG 5 + +#define WPA_FUNC_SIZE (MAX_WPA_PTK_STATE * MAX_WPA_MSG) -#define AP_WPA_MACHINE_BASE 0 -#define APMT2_EAPPacket 0 -#define APMT2_EAPOLStart 1 -#define APMT2_EAPOLLogoff 2 -#define APMT2_EAPOLKey 3 -#define APMT2_EAPOLASFAlert 4 -#define AP_MAX_WPA_MSG 5 -#define AP_WPA_FUNC_SIZE (AP_MAX_WPA_PTK_STATE * AP_MAX_WPA_MSG) // ============================================================================= @@ -1178,12 +1157,16 @@ #define REGION_4_A_BAND 4 // 149, 153, 157, 161, 165 #define REGION_5_A_BAND 5 // 149, 153, 157, 161 #define REGION_6_A_BAND 6 // 36, 40, 44, 48 -#define REGION_7_A_BAND 7 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 +#define REGION_7_A_BAND 7 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173 #define REGION_8_A_BAND 8 // 52, 56, 60, 64 #define REGION_9_A_BAND 9 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165 #define REGION_10_A_BAND 10 // 36, 40, 44, 48, 149, 153, 157, 161, 165 #define REGION_11_A_BAND 11 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 149, 153, 157, 161 -#define REGION_MAXIMUM_A_BAND 11 +#define REGION_12_A_BAND 12 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 +#define REGION_13_A_BAND 13 // 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161 +#define REGION_14_A_BAND 14 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 136, 140, 149, 153, 157, 161, 165 +#define REGION_15_A_BAND 15 // 149, 153, 157, 161, 165, 169, 173 +#define REGION_MAXIMUM_A_BAND 15 // pTxD->CipherAlg #define CIPHER_NONE 0 @@ -1196,15 +1179,6 @@ #define CIPHER_TKIP_NO_MIC 7 // MIC appended by driver: not a valid value in hardware key table #define CIPHER_SMS4 8 -// value domain of pAd->RfIcType -#define RFIC_2820 1 // 2.4G 2T3R -#define RFIC_2850 2 // 2.4G/5G 2T3R -#define RFIC_2720 3 // 2.4G 1T2R -#define RFIC_2750 4 // 2.4G/5G 1T2R -#define RFIC_3020 5 // 2.4G 1T1R -#define RFIC_2020 6 // 2.4G B/G -#define RFIC_3021 7 // 2.4G 1T2R -#define RFIC_3022 8 // 2.4G 2T2R // LED Status. #define LED_LINK_DOWN 0 @@ -1219,7 +1193,8 @@ // value domain of pAd->LedCntl.LedMode and E2PROM #define LED_MODE_DEFAULT 0 #define LED_MODE_TWO_LED 1 -#define LED_MODE_SIGNAL_STREGTH 8 // EEPROM define =8 +//#define LED_MODE_SIGNAL_STREGTH 8 // EEPROM define =8 +#define LED_MODE_SIGNAL_STREGTH 0x40 // EEPROM define = 64 // RC4 init value, used fro WEP & TKIP #define PPPINITFCS32 0xffffffff /* Initial FCS value */ @@ -1305,7 +1280,12 @@ #define INT_APCLI 0x0400 #define INT_MESH 0x0500 -// Use bitmap to allow coexist of ATE_TXFRAME and ATE_RXFRAME(i.e.,to support LoopBack mode) +#define INF_MAIN_DEV_NAME "wlan" +#define INF_MBSSID_DEV_NAME "ra" +#define INF_WDS_DEV_NAME "wds" +#define INF_APCLI_DEV_NAME "apcli" +#define INF_MESH_DEV_NAME "mesh" + // WEP Key TYPE #define WEP_HEXADECIMAL_TYPE 0 @@ -1380,7 +1360,7 @@ #define MAX_NUM_OF_INIT_DLS_ENTRY 1 #define MAX_NUM_OF_DLS_ENTRY MAX_NUMBER_OF_DLS_ENTRY -//Block ACK , rt2860, kathy +//Block ACK, kathy #define MAX_TX_REORDERBUF 64 #define MAX_RX_REORDERBUF 64 #define DEFAULT_TX_TIMEOUT 30 @@ -1392,29 +1372,13 @@ #define IW_ESSID_MAX_SIZE 32 #endif -#ifdef MCAST_RATE_SPECIFIC -#define MCAST_DISABLE 0 -#define MCAST_CCK 1 -#define MCAST_OFDM 2 -#define MCAST_HTMIX 3 -#endif // MCAST_RATE_SPECIFIC // - -#ifdef RT2860 -// For AsicRadioOff/AsicRadioOn/AsicForceWakeup function -// This is to indicate from where to call this function. -#define DOT11POWERSAVE 0 // TO do .11 power save sleep -#define GUIRADIO_OFF 1 // To perform Radio OFf command from GUI -#define RTMP_HALT 2 // Called from Halt handler. -#define GUI_IDLE_POWER_SAVE 3 // Call to sleep before link up with AP -#define FROM_TX 4 // Force wake up from Tx packet. -#endif -#ifdef RT2870 // For AsicRadioOff/AsicRadioOn function #define DOT11POWERSAVE 0 #define GUIRADIO_OFF 1 #define RTMP_HALT 2 #define GUI_IDLE_POWER_SAVE 3 -#endif +// -- + // definition for WpaSupport flag #define WPA_SUPPLICANT_DISABLE 0 @@ -1458,6 +1422,41 @@ #define cpu2be16(x) SWAP16((x)) #define be2cpu16(x) SWAP16((x)) + +#define ABS(_x, _y) ((_x) > (_y)) ? ((_x) -(_y)) : ((_y) -(_x)) + + +#define A2Dec(_X, _p) \ +{ \ + UCHAR *p; \ + _X = 0; \ + p = _p; \ + while (((*p >= '0') && (*p <= '9'))) \ + { \ + if ((*p >= '0') && (*p <= '9')) \ + _X = _X * 10 + *p - 48; \ + p++; \ + } \ +} + + +#define A2Hex(_X, _p) \ +do{ \ + char *__p; \ + (_X) = 0; \ + __p = (char *)(_p); \ + while (((*__p >= 'a') && (*__p <= 'f')) || ((*__p >= 'A') && (*__p <= 'F')) || ((*__p >= '0') && (*__p <= '9'))) \ + { \ + if ((*__p >= 'a') && (*__p <= 'f')) \ + (_X) = (_X) * 16 + *__p - 87; \ + else if ((*__p >= 'A') && (*__p <= 'F')) \ + (_X) = (_X) * 16 + *__p - 55; \ + else if ((*__p >= '0') && (*__p <= '9')) \ + (_X) = (_X) * 16 + *__p - 48; \ + __p++; \ + } \ +}while(0) + #endif // __RTMP_DEF_H__ diff --git a/drivers/staging/rt2860/rtmp_dot11.h b/drivers/staging/rt2860/rtmp_dot11.h new file mode 100644 index 000000000000..f6887a83ea2c --- /dev/null +++ b/drivers/staging/rt2860/rtmp_dot11.h @@ -0,0 +1,102 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* +*/ + +#ifndef __DOT11_BASE_H__ +#define __DOT11_BASE_H__ + +#include "rtmp_type.h" + + +// 4-byte HTC field. maybe included in any frame except non-QOS data frame. The Order bit must set 1. +typedef struct PACKED { + UINT32 MA:1; //management action payload exist in (QoS Null+HTC) + UINT32 TRQ:1; //sounding request + UINT32 MRQ:1; //MCS feedback. Request for a MCS feedback + UINT32 MRSorASI:3; // MRQ Sequence identifier. unchanged during entire procedure. 0x000-0x110. + UINT32 MFS:3; //SET to the received value of MRS. 0x111 for unsolicited MFB. + UINT32 MFBorASC:7; //Link adaptation feedback containing recommended MCS. 0x7f for no feedback or not available + UINT32 CalPos:2; // calibration position + UINT32 CalSeq:2; //calibration sequence + UINT32 FBKReq:2; //feedback request + UINT32 CSISTEERING:2; //CSI/ STEERING + UINT32 ZLFAnnouce:1; // ZLF announcement + UINT32 rsv:5; //calibration sequence + UINT32 ACConstraint:1; //feedback request + UINT32 RDG:1; //RDG / More PPDU +} HT_CONTROL, *PHT_CONTROL; + +// 2-byte QOS CONTROL field +typedef struct PACKED { + USHORT TID:4; + USHORT EOSP:1; + USHORT AckPolicy:2; //0: normal ACK 1:No ACK 2:scheduled under MTBA/PSMP 3: BA + USHORT AMsduPresent:1; + USHORT Txop_QueueSize:8; +} QOS_CONTROL, *PQOS_CONTROL; + + +// 2-byte Frame control field +typedef struct PACKED { + USHORT Ver:2; // Protocol version + USHORT Type:2; // MSDU type + USHORT SubType:4; // MSDU subtype + USHORT ToDs:1; // To DS indication + USHORT FrDs:1; // From DS indication + USHORT MoreFrag:1; // More fragment bit + USHORT Retry:1; // Retry status bit + USHORT PwrMgmt:1; // Power management bit + USHORT MoreData:1; // More data bit + USHORT Wep:1; // Wep data + USHORT Order:1; // Strict order expected +} FRAME_CONTROL, *PFRAME_CONTROL; + +typedef struct PACKED _HEADER_802_11 { + FRAME_CONTROL FC; + USHORT Duration; + UCHAR Addr1[MAC_ADDR_LEN]; + UCHAR Addr2[MAC_ADDR_LEN]; + UCHAR Addr3[MAC_ADDR_LEN]; + USHORT Frag:4; + USHORT Sequence:12; + UCHAR Octet[0]; +} HEADER_802_11, *PHEADER_802_11; + +typedef struct PACKED _PSPOLL_FRAME { + FRAME_CONTROL FC; + USHORT Aid; + UCHAR Bssid[MAC_ADDR_LEN]; + UCHAR Ta[MAC_ADDR_LEN]; +} PSPOLL_FRAME, *PPSPOLL_FRAME; + +typedef struct PACKED _RTS_FRAME { + FRAME_CONTROL FC; + USHORT Duration; + UCHAR Addr1[MAC_ADDR_LEN]; + UCHAR Addr2[MAC_ADDR_LEN]; +}RTS_FRAME, *PRTS_FRAME; + +#endif // __DOT11_BASE_H__ // diff --git a/drivers/staging/rt2860/rtmp_iface.h b/drivers/staging/rt2860/rtmp_iface.h new file mode 100644 index 000000000000..c24ece5b7244 --- /dev/null +++ b/drivers/staging/rt2860/rtmp_iface.h @@ -0,0 +1,84 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + rt_iface.h + + Abstract: + + Revision History: + Who When What + --------- ---------- ---------------------------------------------- + */ + +#ifndef __RTMP_IFACE_H__ +#define __RTMP_IFACE_H__ + + +#ifdef RTMP_PCI_SUPPORT +#include "iface/rtmp_pci.h" +#endif // RTMP_PCI_SUPPORT // +#ifdef RTMP_USB_SUPPORT +#include "iface/rtmp_usb.h" +#endif // RTMP_USB_SUPPORT // + +typedef struct _INF_PCI_CONFIG_ +{ + unsigned long CSRBaseAddress; // PCI MMIO Base Address, all access will use + unsigned int irq_num; +}INF_PCI_CONFIG; + + +typedef struct _INF_USB_CONFIG_ +{ + UINT8 BulkInEpAddr; // bulk-in endpoint address + UINT8 BulkOutEpAddr[6]; // bulk-out endpoint address +}INF_USB_CONFIG; + + +typedef struct _INF_RBUS_CONFIG_ +{ + unsigned long csr_addr; + unsigned int irq; +}INF_RBUS_CONFIG; + + +typedef enum _RTMP_INF_TYPE_ +{ + RTMP_DEV_INF_UNKNOWN = 0, + RTMP_DEV_INF_PCI = 1, + RTMP_DEV_INF_USB = 2, + RTMP_DEV_INF_RBUS = 4, +}RTMP_INF_TYPE; + + +typedef union _RTMP_INF_CONFIG_{ + struct _INF_PCI_CONFIG_ pciConfig; + struct _INF_USB_CONFIG_ usbConfig; + struct _INF_RBUS_CONFIG_ rbusConfig; +}RTMP_INF_CONFIG; + +#endif // __RTMP_IFACE_H__ // diff --git a/drivers/staging/rt2860/rtmp_mcu.h b/drivers/staging/rt2860/rtmp_mcu.h new file mode 100644 index 000000000000..e1b2fee9e105 --- /dev/null +++ b/drivers/staging/rt2860/rtmp_mcu.h @@ -0,0 +1,55 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + rtmp_mcu.h + + Abstract: + Miniport header file for mcu related information + + Revision History: + Who When What + -------- ---------- ---------------------------------------------- +*/ + +#ifndef __RTMP_MCU_H__ +#define __RTMP_MCU_H__ + + +INT RtmpAsicEraseFirmware( + IN PRTMP_ADAPTER pAd); + +NDIS_STATUS RtmpAsicLoadFirmware( + IN PRTMP_ADAPTER pAd); + +INT RtmpAsicSendCommandToMcu( + IN PRTMP_ADAPTER pAd, + IN UCHAR Command, + IN UCHAR Token, + IN UCHAR Arg0, + IN UCHAR Arg1); + +#endif // __RTMP_MCU_H__ // diff --git a/drivers/staging/rt2860/rtmp_os.h b/drivers/staging/rt2860/rtmp_os.h new file mode 100644 index 000000000000..350621d59d1b --- /dev/null +++ b/drivers/staging/rt2860/rtmp_os.h @@ -0,0 +1,98 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + rtmp_os.h + + Abstract: + + Revision History: + Who When What + --------- ---------- ---------------------------------------------- + */ + + +#ifndef __RTMP_OS_H__ +#define __RTMP_OS_H__ + +#ifdef LINUX +#include "rt_linux.h" +#endif // LINUX // + + + +/* + This data structure mainly strip some callback function defined in + "struct net_device" in kernel source "include/linux/netdevice.h". + + The definition of this data structure may various depends on different + OS. Use it carefully. +*/ +typedef struct _RTMP_OS_NETDEV_OP_HOOK_ +{ + const struct net_device_ops *netdev_ops; + void *priv; + int priv_flags; + unsigned char devAddr[6]; + unsigned char devName[16]; + unsigned char needProtcted; +}RTMP_OS_NETDEV_OP_HOOK, *PRTMP_OS_NETDEV_OP_HOOK; + + +typedef enum _RTMP_TASK_STATUS_ +{ + RTMP_TASK_STAT_UNKNOWN = 0, + RTMP_TASK_STAT_INITED = 1, + RTMP_TASK_STAT_RUNNING = 2, + RTMP_TASK_STAT_STOPED = 4, +}RTMP_TASK_STATUS; +#define RTMP_TASK_CAN_DO_INSERT (RTMP_TASK_STAT_INITED |RTMP_TASK_STAT_RUNNING) + +#define RTMP_OS_TASK_NAME_LEN 16 +typedef struct _RTMP_OS_TASK_ +{ + char taskName[RTMP_OS_TASK_NAME_LEN]; + void *priv; + //unsigned long taskFlags; + RTMP_TASK_STATUS taskStatus; +#ifndef KTHREAD_SUPPORT + RTMP_OS_SEM taskSema; + RTMP_OS_PID taskPID; + struct completion taskComplete; +#endif + unsigned char task_killed; +#ifdef KTHREAD_SUPPORT + struct task_struct *kthread_task; + wait_queue_head_t kthread_q; + BOOLEAN kthread_running; +#endif +}RTMP_OS_TASK; + + +int RtmpOSIRQRequest(IN PNET_DEV pNetDev); +int RtmpOSIRQRelease(IN PNET_DEV pNetDev); + +#endif // __RMTP_OS_H__ // diff --git a/drivers/staging/rt2860/rtmp_timer.h b/drivers/staging/rt2860/rtmp_timer.h new file mode 100644 index 000000000000..5f6e3ce368a0 --- /dev/null +++ b/drivers/staging/rt2860/rtmp_timer.h @@ -0,0 +1,156 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + rtmp_timer.h + + Abstract: + Ralink Wireless Driver timer related data structures and delcarations + + Revision History: + Who When What + -------- ---------- ---------------------------------------------- + Name Date Modification logs + Shiang Tu Aug-28-2008 init version + +*/ + +#ifndef __RTMP_TIMER_H__ +#define __RTMP_TIMER_H__ + +#include "rtmp_os.h" + + +#define DECLARE_TIMER_FUNCTION(_func) \ + void rtmp_timer_##_func(unsigned long data) + +#define GET_TIMER_FUNCTION(_func) \ + rtmp_timer_##_func + + +/* ----------------- Timer Related MARCO ---------------*/ +// In some os or chipset, we have a lot of timer functions and will read/write register, +// it's not allowed in Linux USB sub-system to do it ( because of sleep issue when +// submit to ctrl pipe). So we need a wrapper function to take care it. + +#ifdef RTMP_TIMER_TASK_SUPPORT +typedef VOID (*RTMP_TIMER_TASK_HANDLE)( + IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3); +#endif // RTMP_TIMER_TASK_SUPPORT // + +typedef struct _RALINK_TIMER_STRUCT { + RTMP_OS_TIMER TimerObj; // Ndis Timer object + BOOLEAN Valid; // Set to True when call RTMPInitTimer + BOOLEAN State; // True if timer cancelled + BOOLEAN PeriodicType; // True if timer is periodic timer + BOOLEAN Repeat; // True if periodic timer + ULONG TimerValue; // Timer value in milliseconds + ULONG cookie; // os specific object +#ifdef RTMP_TIMER_TASK_SUPPORT + RTMP_TIMER_TASK_HANDLE handle; + void *pAd; +#endif // RTMP_TIMER_TASK_SUPPORT // +}RALINK_TIMER_STRUCT, *PRALINK_TIMER_STRUCT; + + +#ifdef RTMP_TIMER_TASK_SUPPORT +typedef struct _RTMP_TIMER_TASK_ENTRY_ +{ + RALINK_TIMER_STRUCT *pRaTimer; + struct _RTMP_TIMER_TASK_ENTRY_ *pNext; +}RTMP_TIMER_TASK_ENTRY; + + +#define TIMER_QUEUE_SIZE_MAX 128 +typedef struct _RTMP_TIMER_TASK_QUEUE_ +{ + unsigned int status; + unsigned char *pTimerQPoll; + RTMP_TIMER_TASK_ENTRY *pQPollFreeList; + RTMP_TIMER_TASK_ENTRY *pQHead; + RTMP_TIMER_TASK_ENTRY *pQTail; +}RTMP_TIMER_TASK_QUEUE; + +#define BUILD_TIMER_FUNCTION(_func) \ +void rtmp_timer_##_func(unsigned long data) \ +{ \ + PRALINK_TIMER_STRUCT _pTimer = (PRALINK_TIMER_STRUCT)data; \ + RTMP_TIMER_TASK_ENTRY *_pQNode; \ + RTMP_ADAPTER *_pAd; \ + \ + _pTimer->handle = _func; \ + _pAd = (RTMP_ADAPTER *)_pTimer->pAd; \ + _pQNode = RtmpTimerQInsert(_pAd, _pTimer); \ + if ((_pQNode == NULL) && (_pAd->TimerQ.status & RTMP_TASK_CAN_DO_INSERT)) \ + RTMP_OS_Add_Timer(&_pTimer->TimerObj, OS_HZ); \ +} +#else +#define BUILD_TIMER_FUNCTION(_func) \ +void rtmp_timer_##_func(unsigned long data) \ +{ \ + PRALINK_TIMER_STRUCT pTimer = (PRALINK_TIMER_STRUCT) data; \ + \ + _func(NULL, (PVOID) pTimer->cookie, NULL, pTimer); \ + if (pTimer->Repeat) \ + RTMP_OS_Add_Timer(&pTimer->TimerObj, pTimer->TimerValue); \ +} +#endif // RTMP_TIMER_TASK_SUPPORT // + + +DECLARE_TIMER_FUNCTION(MlmePeriodicExec); +DECLARE_TIMER_FUNCTION(MlmeRssiReportExec); +DECLARE_TIMER_FUNCTION(AsicRxAntEvalTimeout); +DECLARE_TIMER_FUNCTION(APSDPeriodicExec); +DECLARE_TIMER_FUNCTION(AsicRfTuningExec); +#ifdef RTMP_MAC_USB +DECLARE_TIMER_FUNCTION(BeaconUpdateExec); +#endif // RTMP_MAC_USB // + +DECLARE_TIMER_FUNCTION(BeaconTimeout); +DECLARE_TIMER_FUNCTION(ScanTimeout); +DECLARE_TIMER_FUNCTION(AuthTimeout); +DECLARE_TIMER_FUNCTION(AssocTimeout); +DECLARE_TIMER_FUNCTION(ReassocTimeout); +DECLARE_TIMER_FUNCTION(DisassocTimeout); +DECLARE_TIMER_FUNCTION(LinkDownExec); +DECLARE_TIMER_FUNCTION(StaQuickResponeForRateUpExec); +DECLARE_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc); +DECLARE_TIMER_FUNCTION(PsPollWakeExec); +DECLARE_TIMER_FUNCTION(RadioOnExec); + +#ifdef RTMP_MAC_USB +DECLARE_TIMER_FUNCTION(RtmpUsbStaAsicForceWakeupTimeout); +#endif // RTMP_MAC_USB // + +#if defined(AP_LED) || defined(STA_LED) +DECLARE_TIMER_FUNCTION(LedCtrlMain); +#endif + + +#endif // __RTMP_TIMER_H__ // diff --git a/drivers/staging/rt2860/rtmp_type.h b/drivers/staging/rt2860/rtmp_type.h index 1fd7df1e1791..f99cd2b4c48e 100644 --- a/drivers/staging/rt2860/rtmp_type.h +++ b/drivers/staging/rt2860/rtmp_type.h @@ -38,8 +38,10 @@ #ifndef __RTMP_TYPE_H__ #define __RTMP_TYPE_H__ + #define PACKED __attribute__ ((packed)) +#ifdef LINUX // Put platform dependent declaration here // For example, linux type definition typedef unsigned char UINT8; @@ -48,6 +50,7 @@ typedef unsigned int UINT32; typedef unsigned long long UINT64; typedef int INT32; typedef long long INT64; +#endif // LINUX // typedef unsigned char * PUINT8; typedef unsigned short * PUINT16; @@ -56,22 +59,30 @@ typedef unsigned long long * PUINT64; typedef int * PINT32; typedef long long * PINT64; +// modified for fixing compile warning on Sigma 8634 platform +typedef char STRING; typedef signed char CHAR; + typedef signed short SHORT; typedef signed int INT; typedef signed long LONG; typedef signed long long LONGLONG; +#ifdef LINUX typedef unsigned char UCHAR; typedef unsigned short USHORT; typedef unsigned int UINT; typedef unsigned long ULONG; +#endif // LINUX // typedef unsigned long long ULONGLONG; typedef unsigned char BOOLEAN; +#ifdef LINUX typedef void VOID; +#endif // LINUX // +typedef char * PSTRING; typedef VOID * PVOID; typedef CHAR * PCHAR; typedef UCHAR * PUCHAR; @@ -90,5 +101,47 @@ typedef union _LARGE_INTEGER { INT64 QuadPart; } LARGE_INTEGER; -#endif // __RTMP_TYPE_H__ + +// +// Register set pair for initialzation register set definition +// +typedef struct _RTMP_REG_PAIR +{ + ULONG Register; + ULONG Value; +} RTMP_REG_PAIR, *PRTMP_REG_PAIR; + +typedef struct _REG_PAIR +{ + UCHAR Register; + UCHAR Value; +} REG_PAIR, *PREG_PAIR; + +// +// Register set pair for initialzation register set definition +// +typedef struct _RTMP_RF_REGS +{ + UCHAR Channel; + ULONG R1; + ULONG R2; + ULONG R3; + ULONG R4; +} RTMP_RF_REGS, *PRTMP_RF_REGS; + +typedef struct _FREQUENCY_ITEM { + UCHAR Channel; + UCHAR N; + UCHAR R; + UCHAR K; +} FREQUENCY_ITEM, *PFREQUENCY_ITEM; + + +typedef int NTSTATUS; + + +#define STATUS_SUCCESS 0x00 +#define STATUS_UNSUCCESSFUL 0x01 + +#endif // __RTMP_TYPE_H__ // diff --git a/drivers/staging/rt2860/rtusb_io.h b/drivers/staging/rt2860/rtusb_io.h new file mode 100644 index 000000000000..055e4efac2f8 --- /dev/null +++ b/drivers/staging/rt2860/rtusb_io.h @@ -0,0 +1,189 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* +*/ + + +#ifndef __RTUSB_IO_H__ +#define __RTUSB_IO_H__ + +#include "rtmp_type.h" + +// New for MeetingHouse Api support +#define CMDTHREAD_VENDOR_RESET 0x0D730101 // cmd +#define CMDTHREAD_VENDOR_UNPLUG 0x0D730102 // cmd +#define CMDTHREAD_VENDOR_SWITCH_FUNCTION 0x0D730103 // cmd +#define CMDTHREAD_MULTI_WRITE_MAC 0x0D730107 // cmd +#define CMDTHREAD_MULTI_READ_MAC 0x0D730108 // cmd +#define CMDTHREAD_VENDOR_EEPROM_WRITE 0x0D73010A // cmd +#define CMDTHREAD_VENDOR_EEPROM_READ 0x0D73010B // cmd +#define CMDTHREAD_VENDOR_ENTER_TESTMODE 0x0D73010C // cmd +#define CMDTHREAD_VENDOR_EXIT_TESTMODE 0x0D73010D // cmd +#define CMDTHREAD_VENDOR_WRITE_BBP 0x0D730119 // cmd +#define CMDTHREAD_VENDOR_READ_BBP 0x0D730118 // cmd +#define CMDTHREAD_VENDOR_WRITE_RF 0x0D73011A // cmd +#define CMDTHREAD_VENDOR_FLIP_IQ 0x0D73011D // cmd +#define CMDTHREAD_RESET_BULK_OUT 0x0D730210 // cmd +#define CMDTHREAD_RESET_BULK_IN 0x0D730211 // cmd +#define CMDTHREAD_SET_PSM_BIT 0x0D730212 // cmd +#define CMDTHREAD_SET_RADIO 0x0D730214 // cmd +#define CMDTHREAD_UPDATE_TX_RATE 0x0D730216 // cmd +#define CMDTHREAD_802_11_ADD_KEY_WEP 0x0D730218 // cmd +#define CMDTHREAD_RESET_FROM_ERROR 0x0D73021A // cmd +#define CMDTHREAD_LINK_DOWN 0x0D73021B // cmd +#define CMDTHREAD_RESET_FROM_NDIS 0x0D73021C // cmd +#define CMDTHREAD_CHECK_GPIO 0x0D730215 // cmd +#define CMDTHREAD_FORCE_WAKE_UP 0x0D730222 // cmd +#define CMDTHREAD_SET_BW 0x0D730225 // cmd +#define CMDTHREAD_SET_ASIC_WCID 0x0D730226 // cmd +#define CMDTHREAD_SET_ASIC_WCID_CIPHER 0x0D730227 // cmd +#define CMDTHREAD_QKERIODIC_EXECUT 0x0D73023D // cmd +#define RT_CMD_SET_KEY_TABLE 0x0D730228 // cmd +#define RT_CMD_SET_RX_WCID_TABLE 0x0D730229 // cmd +#define CMDTHREAD_SET_CLIENT_MAC_ENTRY 0x0D73023E // cmd +#define CMDTHREAD_SET_GROUP_KEY 0x0D73023F // cmd +#define CMDTHREAD_SET_PAIRWISE_KEY 0x0D730240 // cmd + +#define CMDTHREAD_802_11_QUERY_HARDWARE_REGISTER 0x0D710105 // cmd +#define CMDTHREAD_802_11_SET_PHY_MODE 0x0D79010C // cmd +#define CMDTHREAD_802_11_SET_STA_CONFIG 0x0D790111 // cmd +#define CMDTHREAD_802_11_SET_PREAMBLE 0x0D790101 // cmd +#define CMDTHREAD_802_11_COUNTER_MEASURE 0x0D790102 // cmd +// add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet +#define CMDTHREAD_UPDATE_PROTECT 0x0D790103 // cmd +// end johnli + + +//CMDTHREAD_MULTI_READ_MAC +//CMDTHREAD_MULTI_WRITE_MAC +//CMDTHREAD_VENDOR_EEPROM_READ +//CMDTHREAD_VENDOR_EEPROM_WRITE +typedef struct _CMDHandler_TLV { + USHORT Offset; + USHORT Length; + UCHAR DataFirst; +} CMDHandler_TLV, *PCMDHandler_TLV; + + +typedef struct _CmdQElmt { + UINT command; + PVOID buffer; + ULONG bufferlength; + BOOLEAN CmdFromNdis; + BOOLEAN SetOperation; + struct _CmdQElmt *next; +} CmdQElmt, *PCmdQElmt; + +typedef struct _CmdQ { + UINT size; + CmdQElmt *head; + CmdQElmt *tail; + UINT32 CmdQState; +}CmdQ, *PCmdQ; + + +#define EnqueueCmd(cmdq, cmdqelmt) \ +{ \ + if (cmdq->size == 0) \ + cmdq->head = cmdqelmt; \ + else \ + cmdq->tail->next = cmdqelmt; \ + cmdq->tail = cmdqelmt; \ + cmdqelmt->next = NULL; \ + cmdq->size++; \ +} + + +/****************************************************************************** + + USB Cmd to ASIC Related MACRO + +******************************************************************************/ +// reset MAC of a station entry to 0xFFFFFFFFFFFF +#define RTMP_STA_ENTRY_MAC_RESET(pAd, Wcid) \ + { RT_SET_ASIC_WCID SetAsicWcid; \ + SetAsicWcid.WCID = Wcid; \ + SetAsicWcid.SetTid = 0xffffffff; \ + SetAsicWcid.DeleteTid = 0xffffffff; \ + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_ASIC_WCID, \ + &SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); } + +// add this entry into ASIC RX WCID search table +#define RTMP_STA_ENTRY_ADD(pAd, pEntry) \ + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_CLIENT_MAC_ENTRY, \ + pEntry, sizeof(MAC_TABLE_ENTRY)); + +// add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet +// Set MAC register value according operation mode +#define RTMP_UPDATE_PROTECT(pAd) \ + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_UPDATE_PROTECT, NULL, 0); +// end johnli + +// remove Pair-wise key material from ASIC +// yet implement +#define RTMP_STA_ENTRY_KEY_DEL(pAd, BssIdx, Wcid) + +// add Client security information into ASIC WCID table and IVEIV table +#define RTMP_STA_SECURITY_INFO_ADD(pAd, apidx, KeyID, pEntry) \ + { RTMP_STA_ENTRY_MAC_RESET(pAd, pEntry->Aid); \ + if (pEntry->Aid >= 1) { \ + RT_SET_ASIC_WCID_ATTRI SetAsicWcidAttri; \ + SetAsicWcidAttri.WCID = pEntry->Aid; \ + if ((pEntry->AuthMode <= Ndis802_11AuthModeAutoSwitch) && \ + (pEntry->WepStatus == Ndis802_11Encryption1Enabled)) \ + { \ + SetAsicWcidAttri.Cipher = pAd->SharedKey[apidx][KeyID].CipherAlg; \ + } \ + else if (pEntry->AuthMode == Ndis802_11AuthModeWPANone) \ + { \ + SetAsicWcidAttri.Cipher = pAd->SharedKey[apidx][KeyID].CipherAlg; \ + } \ + else SetAsicWcidAttri.Cipher = 0; \ + DBGPRINT(RT_DEBUG_TRACE, ("aid cipher = %ld\n",SetAsicWcidAttri.Cipher)); \ + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_ASIC_WCID_CIPHER, \ + &SetAsicWcidAttri, sizeof(RT_SET_ASIC_WCID_ATTRI)); } } + +// Insert the BA bitmap to ASIC for the Wcid entry +#define RTMP_ADD_BA_SESSION_TO_ASIC(_pAd, _Aid, _TID) \ + do{ \ + RT_SET_ASIC_WCID SetAsicWcid; \ + SetAsicWcid.WCID = (_Aid); \ + SetAsicWcid.SetTid = (0x10000<<(_TID)); \ + SetAsicWcid.DeleteTid = 0xffffffff; \ + RTUSBEnqueueInternalCmd((_pAd), CMDTHREAD_SET_ASIC_WCID, &SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); \ + }while(0) + +// Remove the BA bitmap from ASIC for the Wcid entry +#define RTMP_DEL_BA_SESSION_FROM_ASIC(_pAd, _Wcid, _TID) \ + do{ \ + RT_SET_ASIC_WCID SetAsicWcid; \ + SetAsicWcid.WCID = (_Wcid); \ + SetAsicWcid.SetTid = (0xffffffff); \ + SetAsicWcid.DeleteTid = (0x10000<<(_TID) ); \ + RTUSBEnqueueInternalCmd((_pAd), CMDTHREAD_SET_ASIC_WCID, &SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); \ + }while(0) + + +#endif // __RTUSB_IO_H__ // diff --git a/drivers/staging/rt2860/spectrum.h b/drivers/staging/rt2860/spectrum.h index 0a878ba81b48..b9fc67603385 100644 --- a/drivers/staging/rt2860/spectrum.h +++ b/drivers/staging/rt2860/spectrum.h @@ -23,7 +23,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * * ************************************************************************* -*/ + */ #ifndef __SPECTRUM_H__ #define __SPECTRUM_H__ @@ -31,112 +31,10 @@ #include "rtmp_type.h" #include "spectrum_def.h" -typedef struct PACKED _TPC_REPORT_INFO -{ - UINT8 TxPwr; - UINT8 LinkMargin; -} TPC_REPORT_INFO, *PTPC_REPORT_INFO; - -typedef struct PACKED _CH_SW_ANN_INFO -{ - UINT8 ChSwMode; - UINT8 Channel; - UINT8 ChSwCnt; -} CH_SW_ANN_INFO, *PCH_SW_ANN_INFO; - -typedef union PACKED _MEASURE_REQ_MODE -{ - struct PACKED - { - UINT8 Rev0:1; - UINT8 Enable:1; - UINT8 Request:1; - UINT8 Report:1; - UINT8 Rev1:4; - } field; - UINT8 word; -} MEASURE_REQ_MODE, *PMEASURE_REQ_MODE; - -typedef struct PACKED _MEASURE_REQ -{ - UINT8 ChNum; - UINT64 MeasureStartTime; - UINT16 MeasureDuration; -} MEASURE_REQ, *PMEASURE_REQ; - -typedef struct PACKED _MEASURE_REQ_INFO -{ - UINT8 Token; - MEASURE_REQ_MODE ReqMode; - UINT8 ReqType; - MEASURE_REQ MeasureReq; -} MEASURE_REQ_INFO, *PMEASURE_REQ_INFO; - -typedef union PACKED _MEASURE_BASIC_REPORT_MAP -{ - struct PACKED - { - UINT8 BSS:1; - UINT8 OfdmPreamble:1; - UINT8 UnidentifiedSignal:1; - UINT8 Radar:1; - UINT8 Unmeasure:1; - UINT8 Rev:3; - } field; - UINT8 word; -} MEASURE_BASIC_REPORT_MAP, *PMEASURE_BASIC_REPORT_MAP; - -typedef struct PACKED _MEASURE_BASIC_REPORT -{ - UINT8 ChNum; - UINT64 MeasureStartTime; - UINT16 MeasureDuration; - MEASURE_BASIC_REPORT_MAP Map; -} MEASURE_BASIC_REPORT, *PMEASURE_BASIC_REPORT; - -typedef struct PACKED _MEASURE_CCA_REPORT -{ - UINT8 ChNum; - UINT64 MeasureStartTime; - UINT16 MeasureDuration; - UINT8 CCA_Busy_Fraction; -} MEASURE_CCA_REPORT, *PMEASURE_CCA_REPORT; - -typedef struct PACKED _MEASURE_RPI_REPORT -{ - UINT8 ChNum; - UINT64 MeasureStartTime; - UINT16 MeasureDuration; - UINT8 RPI_Density[8]; -} MEASURE_RPI_REPORT, *PMEASURE_RPI_REPORT; - -typedef union PACKED _MEASURE_REPORT_MODE -{ - struct PACKED - { - UINT8 Late:1; - UINT8 Incapable:1; - UINT8 Refused:1; - UINT8 Rev:5; - } field; - UINT8 word; -} MEASURE_REPORT_MODE, *PMEASURE_REPORT_MODE; - -typedef struct PACKED _MEASURE_REPORT_INFO -{ - UINT8 Token; - MEASURE_REPORT_MODE ReportMode; - UINT8 ReportType; - UINT8 Octect[0]; -} MEASURE_REPORT_INFO, *PMEASURE_REPORT_INFO; - -typedef struct PACKED _QUIET_INFO -{ - UINT8 QuietCnt; - UINT8 QuietPeriod; - UINT8 QuietDuration; - UINT8 QuietOffset; -} QUIET_INFO, *PQUIET_INFO; + +CHAR RTMP_GetTxPwr( + IN PRTMP_ADAPTER pAd, + IN HTTRANSMIT_SETTING HTTxMode); /* ========================================================================== @@ -150,14 +48,17 @@ typedef struct PACKED _QUIET_INFO Return : None. ========================================================================== */ -VOID EnqueueMeasurementReq( +VOID MakeMeasurementReqFrame( IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, + OUT PUCHAR pOutBuffer, + OUT PULONG pFrameLen, + IN UINT8 TotalLen, + IN UINT8 Category, + IN UINT8 Action, IN UINT8 MeasureToken, IN UINT8 MeasureReqMode, IN UINT8 MeasureReqType, - IN UINT8 MeasureCh, - IN UINT16 MeasureDuration); + IN UINT8 NumOfRepetitions); /* ========================================================================== @@ -264,11 +165,16 @@ VOID PeerSpectrumAction( */ INT Set_MeasureReq_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_TpcReq_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); + +INT Set_PwrConstraint( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg); + VOID MeasureReqTabInit( IN PRTMP_ADAPTER pAd); @@ -276,6 +182,38 @@ VOID MeasureReqTabInit( VOID MeasureReqTabExit( IN PRTMP_ADAPTER pAd); +PMEASURE_REQ_ENTRY MeasureReqLookUp( + IN PRTMP_ADAPTER pAd, + IN UINT8 DialogToken); + +PMEASURE_REQ_ENTRY MeasureReqInsert( + IN PRTMP_ADAPTER pAd, + IN UINT8 DialogToken); + +VOID MeasureReqDelete( + IN PRTMP_ADAPTER pAd, + IN UINT8 DialogToken); + +VOID InsertChannelRepIE( + IN PRTMP_ADAPTER pAd, + OUT PUCHAR pFrameBuf, + OUT PULONG pFrameLen, + IN PSTRING pCountry, + IN UINT8 RegulatoryClass); + +VOID InsertTpcReportIE( + IN PRTMP_ADAPTER pAd, + OUT PUCHAR pFrameBuf, + OUT PULONG pFrameLen, + IN UINT8 TxPwr, + IN UINT8 LinkMargin); + +VOID InsertDialogToken( + IN PRTMP_ADAPTER pAd, + OUT PUCHAR pFrameBuf, + OUT PULONG pFrameLen, + IN UINT8 DialogToken); + VOID TpcReqTabInit( IN PRTMP_ADAPTER pAd); @@ -288,5 +226,10 @@ VOID NotifyChSwAnnToPeerAPs( IN PUCHAR pTA, IN UINT8 ChSwMode, IN UINT8 Channel); + +VOID RguClass_BuildBcnChList( + IN PRTMP_ADAPTER pAd, + OUT PUCHAR pBuf, + OUT PULONG pBufLen); #endif // __SPECTRUM_H__ // diff --git a/drivers/staging/rt2860/spectrum_def.h b/drivers/staging/rt2860/spectrum_def.h index 4ca4817bba05..ae67014a4703 100644 --- a/drivers/staging/rt2860/spectrum_def.h +++ b/drivers/staging/rt2860/spectrum_def.h @@ -39,21 +39,15 @@ #ifndef __SPECTRUM_DEF_H__ #define __SPECTRUM_DEF_H__ -#define MAX_MEASURE_REQ_TAB_SIZE 3 + +#define MAX_MEASURE_REQ_TAB_SIZE 32 #define MAX_HASH_MEASURE_REQ_TAB_SIZE MAX_MEASURE_REQ_TAB_SIZE -#define MAX_TPC_REQ_TAB_SIZE 3 +#define MAX_TPC_REQ_TAB_SIZE 32 #define MAX_HASH_TPC_REQ_TAB_SIZE MAX_TPC_REQ_TAB_SIZE #define MIN_RCV_PWR 100 /* Negative value ((dBm) */ -#define RM_TPC_REQ 0 -#define RM_MEASURE_REQ 1 - -#define RM_BASIC 0 -#define RM_CCA 1 -#define RM_RPI_HISTOGRAM 2 - #define TPC_REQ_AGE_OUT 500 /* ms */ #define MQ_REQ_AGE_OUT 500 /* ms */ @@ -91,5 +85,141 @@ typedef struct _TPC_REQ_TAB TPC_REQ_ENTRY Content[MAX_TPC_REQ_TAB_SIZE]; } TPC_REQ_TAB, *PTPC_REQ_TAB; + +/* The regulatory information */ +typedef struct _DOT11_CHANNEL_SET +{ + UCHAR NumberOfChannels; + UINT8 MaxTxPwr; + UCHAR ChannelList[16]; +} DOT11_CHANNEL_SET, *PDOT11_CHANNEL_SET; + +typedef struct _DOT11_REGULATORY_INFORMATION +{ + UCHAR RegulatoryClass; + DOT11_CHANNEL_SET ChannelSet; +} DOT11_REGULATORY_INFORMATION, *PDOT11_REGULATORY_INFORMATION; + + + +#define RM_TPC_REQ 0 +#define RM_MEASURE_REQ 1 + +#define RM_BASIC 0 +#define RM_CCA 1 +#define RM_RPI_HISTOGRAM 2 +#define RM_CH_LOAD 3 +#define RM_NOISE_HISTOGRAM 4 + + +typedef struct PACKED _TPC_REPORT_INFO +{ + UINT8 TxPwr; + UINT8 LinkMargin; +} TPC_REPORT_INFO, *PTPC_REPORT_INFO; + +typedef struct PACKED _CH_SW_ANN_INFO +{ + UINT8 ChSwMode; + UINT8 Channel; + UINT8 ChSwCnt; +} CH_SW_ANN_INFO, *PCH_SW_ANN_INFO; + +typedef union PACKED _MEASURE_REQ_MODE +{ + struct PACKED + { + UINT8 Parallel:1; + UINT8 Enable:1; + UINT8 Request:1; + UINT8 Report:1; + UINT8 DurationMandatory:1; + UINT8 :3; + } field; + UINT8 word; +} MEASURE_REQ_MODE, *PMEASURE_REQ_MODE; + +typedef struct PACKED _MEASURE_REQ +{ + UINT8 ChNum; + UINT64 MeasureStartTime; + UINT16 MeasureDuration; +} MEASURE_REQ, *PMEASURE_REQ; + +typedef struct PACKED _MEASURE_REQ_INFO +{ + UINT8 Token; + MEASURE_REQ_MODE ReqMode; + UINT8 ReqType; + UINT8 Oct[0]; +} MEASURE_REQ_INFO, *PMEASURE_REQ_INFO; + +typedef union PACKED _MEASURE_BASIC_REPORT_MAP +{ + struct PACKED + { + UINT8 BSS:1; + + UINT8 OfdmPreamble:1; + UINT8 UnidentifiedSignal:1; + UINT8 Radar:1; + UINT8 Unmeasure:1; + UINT8 Rev:3; + } field; + UINT8 word; +} MEASURE_BASIC_REPORT_MAP, *PMEASURE_BASIC_REPORT_MAP; + +typedef struct PACKED _MEASURE_BASIC_REPORT +{ + UINT8 ChNum; + UINT64 MeasureStartTime; + UINT16 MeasureDuration; + MEASURE_BASIC_REPORT_MAP Map; +} MEASURE_BASIC_REPORT, *PMEASURE_BASIC_REPORT; + +typedef struct PACKED _MEASURE_CCA_REPORT +{ + UINT8 ChNum; + UINT64 MeasureStartTime; + UINT16 MeasureDuration; + UINT8 CCA_Busy_Fraction; +} MEASURE_CCA_REPORT, *PMEASURE_CCA_REPORT; + +typedef struct PACKED _MEASURE_RPI_REPORT +{ + UINT8 ChNum; + UINT64 MeasureStartTime; + UINT16 MeasureDuration; + UINT8 RPI_Density[8]; +} MEASURE_RPI_REPORT, *PMEASURE_RPI_REPORT; + +typedef union PACKED _MEASURE_REPORT_MODE +{ + struct PACKED + { + UINT8 Late:1; + UINT8 Incapable:1; + UINT8 Refused:1; + UINT8 Rev:5; + } field; + UINT8 word; +} MEASURE_REPORT_MODE, *PMEASURE_REPORT_MODE; + +typedef struct PACKED _MEASURE_REPORT_INFO +{ + UINT8 Token; + UINT8 ReportMode; + UINT8 ReportType; + UINT8 Octect[0]; +} MEASURE_REPORT_INFO, *PMEASURE_REPORT_INFO; + +typedef struct PACKED _QUIET_INFO +{ + UINT8 QuietCnt; + UINT8 QuietPeriod; + UINT16 QuietDuration; + UINT16 QuietOffset; +} QUIET_INFO, *PQUIET_INFO; + #endif // __SPECTRUM_DEF_H__ // diff --git a/drivers/staging/rt2860/sta/aironet.c b/drivers/staging/rt2860/sta/aironet.c deleted file mode 100644 index 4af4a1906181..000000000000 --- a/drivers/staging/rt2860/sta/aironet.c +++ /dev/null @@ -1,1312 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - aironet.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Paul Lin 04-06-15 Initial -*/ -#include "../rt_config.h" - -/* - ========================================================================== - Description: - association state machine init, including state transition and timer init - Parameters: - S - pointer to the association state machine - ========================================================================== - */ -VOID AironetStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - OUT STATE_MACHINE_FUNC Trans[]) -{ - StateMachineInit(S, Trans, MAX_AIRONET_STATE, MAX_AIRONET_MSG, (STATE_MACHINE_FUNC)Drop, AIRONET_IDLE, AIRONET_MACHINE_BASE); - StateMachineSetAction(S, AIRONET_IDLE, MT2_AIRONET_MSG, (STATE_MACHINE_FUNC)AironetMsgAction); - StateMachineSetAction(S, AIRONET_IDLE, MT2_AIRONET_SCAN_REQ, (STATE_MACHINE_FUNC)AironetRequestAction); - StateMachineSetAction(S, AIRONET_SCANNING, MT2_AIRONET_SCAN_DONE, (STATE_MACHINE_FUNC)AironetReportAction); -} - -/* - ========================================================================== - Description: - This is state machine function. - When receiving EAPOL packets which is for 802.1x key management. - Use both in WPA, and WPAPSK case. - In this function, further dispatch to different functions according to the received packet. 3 categories are : - 1. normal 4-way pairwisekey and 2-way groupkey handshake - 2. MIC error (Countermeasures attack) report packet from STA. - 3. Request for pairwise/group key update from STA - Return: - ========================================================================== -*/ -VOID AironetMsgAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Length; - UCHAR Index, i; - PUCHAR pData; - PAIRONET_RM_REQUEST_FRAME pRMReq; - PRM_REQUEST_ACTION pReqElem; - - DBGPRINT(RT_DEBUG_TRACE, ("-----> AironetMsgAction\n")); - - // 0. Get Aironet IAPP header first - pRMReq = (PAIRONET_RM_REQUEST_FRAME) &Elem->Msg[LENGTH_802_11]; - pData = (PUCHAR) &Elem->Msg[LENGTH_802_11]; - - // 1. Change endian format form network to little endian - Length = be2cpu16(pRMReq->IAPP.Length); - - // 2.0 Sanity check, this should only happen when CCX 2.0 support is enabled - if (pAd->StaCfg.CCXEnable != TRUE) - return; - - // 2.1 Radio measurement must be on - if (pAd->StaCfg.CCXControl.field.RMEnable != 1) - return; - - // 2.2. Debug print all bit information - DBGPRINT(RT_DEBUG_TRACE, ("IAPP ID & Length %d\n", Length)); - DBGPRINT(RT_DEBUG_TRACE, ("IAPP Type %x\n", pRMReq->IAPP.Type)); - DBGPRINT(RT_DEBUG_TRACE, ("IAPP SubType %x\n", pRMReq->IAPP.SubType)); - DBGPRINT(RT_DEBUG_TRACE, ("IAPP Dialog Token %x\n", pRMReq->IAPP.Token)); - DBGPRINT(RT_DEBUG_TRACE, ("IAPP Activation Delay %x\n", pRMReq->Delay)); - DBGPRINT(RT_DEBUG_TRACE, ("IAPP Measurement Offset %x\n", pRMReq->Offset)); - - // 3. Check IAPP frame type, it must be 0x32 for Cisco Aironet extension - if (pRMReq->IAPP.Type != AIRONET_IAPP_TYPE) - { - DBGPRINT(RT_DEBUG_ERROR, ("Wrong IAPP type for Cisco Aironet extension\n")); - return; - } - - // 4. Check IAPP frame subtype, it must be 0x01 for Cisco Aironet extension request. - // Since we are acting as client only, we will disregards reply subtype. - if (pRMReq->IAPP.SubType != AIRONET_IAPP_SUBTYPE_REQUEST) - { - DBGPRINT(RT_DEBUG_ERROR, ("Wrong IAPP subtype for Cisco Aironet extension\n")); - return; - } - - // 5. Verify Destination MAC and Source MAC, both should be all zeros. - if (! MAC_ADDR_EQUAL(pRMReq->IAPP.DA, ZERO_MAC_ADDR)) - { - DBGPRINT(RT_DEBUG_ERROR, ("Wrong IAPP DA for Cisco Aironet extension, it's not Zero\n")); - return; - } - - if (! MAC_ADDR_EQUAL(pRMReq->IAPP.SA, ZERO_MAC_ADDR)) - { - DBGPRINT(RT_DEBUG_ERROR, ("Wrong IAPP SA for Cisco Aironet extension, it's not Zero\n")); - return; - } - - // 6. Reinit all report related fields - NdisZeroMemory(pAd->StaCfg.FrameReportBuf, 2048); - NdisZeroMemory(pAd->StaCfg.BssReportOffset, sizeof(USHORT) * MAX_LEN_OF_BSS_TABLE); - NdisZeroMemory(pAd->StaCfg.MeasurementRequest, sizeof(RM_REQUEST_ACTION) * 4); - - // 7. Point to the start of first element report element - pAd->StaCfg.FrameReportLen = LENGTH_802_11 + sizeof(AIRONET_IAPP_HEADER); - DBGPRINT(RT_DEBUG_TRACE, ("FR len = %d\n", pAd->StaCfg.FrameReportLen)); - pAd->StaCfg.LastBssIndex = 0xff; - pAd->StaCfg.RMReqCnt = 0; - pAd->StaCfg.ParallelReq = FALSE; - pAd->StaCfg.ParallelDuration = 0; - pAd->StaCfg.ParallelChannel = 0; - pAd->StaCfg.IAPPToken = pRMReq->IAPP.Token; - pAd->StaCfg.CurrentRMReqIdx = 0; - pAd->StaCfg.CLBusyBytes = 0; - // Reset the statistics - for (i = 0; i < 8; i++) - pAd->StaCfg.RPIDensity[i] = 0; - - Index = 0; - - // 8. Save dialog token for report - pAd->StaCfg.IAPPToken = pRMReq->IAPP.Token; - - // Save Activation delay & measurement offset, Not really needed - - // 9. Point to the first request element - pData += sizeof(AIRONET_RM_REQUEST_FRAME); - // Length should exclude the CISCO Aironet SNAP header - Length -= (sizeof(AIRONET_RM_REQUEST_FRAME) - LENGTH_802_1_H); - - // 10. Start Parsing the Measurement elements. - // Be careful about multiple MR elements within one frames. - while (Length > 0) - { - pReqElem = (PRM_REQUEST_ACTION) pData; - switch (pReqElem->ReqElem.Eid) - { - case IE_MEASUREMENT_REQUEST: - // From the example, it seems we only need to support one request in one frame - // There is no multiple request in one frame. - // Besides, looks like we need to take care the measurement request only. - // The measurement request is always 4 bytes. - - // Start parsing this type of request. - // 0. Eid is IE_MEASUREMENT_REQUEST - // 1. Length didn't include Eid and Length field, it always be 8. - // 2. Measurement Token, we nned to save it for the corresponding report. - // 3. Measurement Mode, Although there are definitions, but we din't see value other than - // 0 from test specs examples. - // 4. Measurement Type, this is what we need to do. - switch (pReqElem->ReqElem.Type) - { - case MSRN_TYPE_CHANNEL_LOAD_REQ: - case MSRN_TYPE_NOISE_HIST_REQ: - case MSRN_TYPE_BEACON_REQ: - // Check the Enable non-serving channel measurement control - if (pAd->StaCfg.CCXControl.field.DCRMEnable == 0) - { - // Check channel before enqueue the action - if (pReqElem->Measurement.Channel != pAd->CommonCfg.Channel) - break; - } - else - { - // If off channel measurement, check the TU duration limit - if (pReqElem->Measurement.Channel != pAd->CommonCfg.Channel) - if (pReqElem->Measurement.Duration > pAd->StaCfg.CCXControl.field.TuLimit) - break; - } - - // Save requests and execute actions later - NdisMoveMemory(&pAd->StaCfg.MeasurementRequest[Index], pReqElem, sizeof(RM_REQUEST_ACTION)); - Index += 1; - break; - - case MSRN_TYPE_FRAME_REQ: - // Since it's option, we will support later - // FrameRequestAction(pAd, pData); - break; - - default: - break; - } - - // Point to next Measurement request - pData += sizeof(RM_REQUEST_ACTION); - Length -= sizeof(RM_REQUEST_ACTION); - break; - - // We accept request only, all others are dropped - case IE_MEASUREMENT_REPORT: - case IE_AP_TX_POWER: - case IE_MEASUREMENT_CAPABILITY: - default: - return; - } - } - - // 11. Update some flags and index - pAd->StaCfg.RMReqCnt = Index; - - if (Index) - { - MlmeEnqueue(pAd, AIRONET_STATE_MACHINE, MT2_AIRONET_SCAN_REQ, 0, NULL); - RT28XX_MLME_HANDLER(pAd); - } - - DBGPRINT(RT_DEBUG_TRACE, ("<----- AironetMsgAction\n")); -} - -/* - ======================================================================== - - Routine Description: - - Arguments: - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID AironetRequestAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - PRM_REQUEST_ACTION pReq; - - // 1. Point to next request element - pReq = (PRM_REQUEST_ACTION) &pAd->StaCfg.MeasurementRequest[pAd->StaCfg.CurrentRMReqIdx]; - - // 2. Parse measurement type and call appropriate functions - if (pReq->ReqElem.Type == MSRN_TYPE_CHANNEL_LOAD_REQ) - // Channel Load measurement request - ChannelLoadRequestAction(pAd, pAd->StaCfg.CurrentRMReqIdx); - else if (pReq->ReqElem.Type == MSRN_TYPE_NOISE_HIST_REQ) - // Noise Histogram measurement request - NoiseHistRequestAction(pAd, pAd->StaCfg.CurrentRMReqIdx); - else if (pReq->ReqElem.Type == MSRN_TYPE_BEACON_REQ) - // Beacon measurement request - BeaconRequestAction(pAd, pAd->StaCfg.CurrentRMReqIdx); - else - // Unknown. Do nothing and return, this should never happen - return; - - // 3. Peek into the next request, if it's parallel, we will update the scan time to the largest one - if ((pAd->StaCfg.CurrentRMReqIdx + 1) < pAd->StaCfg.RMReqCnt) - { - pReq = (PRM_REQUEST_ACTION) &pAd->StaCfg.MeasurementRequest[pAd->StaCfg.CurrentRMReqIdx + 1]; - // Check for parallel bit - if ((pReq->ReqElem.Mode & 0x01) && (pReq->Measurement.Channel == pAd->StaCfg.CCXScanChannel)) - { - // Update parallel mode request information - pAd->StaCfg.ParallelReq = TRUE; - pAd->StaCfg.CCXScanTime = ((pReq->Measurement.Duration > pAd->StaCfg.CCXScanTime) ? - (pReq->Measurement.Duration) : (pAd->StaCfg.CCXScanTime)); - } - } - - // 4. Call RT28XX_MLME_HANDLER to execute the request mlme commands, Scan request is the only one used - RT28XX_MLME_HANDLER(pAd); - -} - - -/* - ======================================================================== - - Routine Description: - Prepare channel load report action, special scan operation added - to support - - Arguments: - pAd Pointer to our adapter - pData Start from element ID - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID ChannelLoadRequestAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Index) -{ - PRM_REQUEST_ACTION pReq; - MLME_SCAN_REQ_STRUCT ScanReq; - UCHAR ZeroSsid[32]; - NDIS_STATUS NStatus; - PUCHAR pOutBuffer = NULL; - PHEADER_802_11 pNullFrame; - - DBGPRINT(RT_DEBUG_TRACE, ("ChannelLoadRequestAction ----->\n")); - - pReq = (PRM_REQUEST_ACTION) &pAd->StaCfg.MeasurementRequest[Index]; - NdisZeroMemory(ZeroSsid, 32); - - // Prepare for special scan request - // The scan definition is different with our Active, Passive scan definition. - // For CCX2, Active means send out probe request with broadcast BSSID. - // Passive means no probe request sent, only listen to the beacons. - // The channel scanned is fixed as specified, no need to scan all channels. - // The scan wait time is specified in the request too. - // Passive scan Mode - - // Control state machine is not idle, reject the request - if ((pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) && (Index == 0)) - return; - - // Fill out stuff for scan request - ScanParmFill(pAd, &ScanReq, ZeroSsid, 0, BSS_ANY, SCAN_CISCO_CHANNEL_LOAD); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; - - // Reset some internal control flags to make sure this scan works. - BssTableInit(&pAd->StaCfg.CCXBssTab); - pAd->StaCfg.ScanCnt = 0; - pAd->StaCfg.CCXScanChannel = pReq->Measurement.Channel; - pAd->StaCfg.CCXScanTime = pReq->Measurement.Duration; - - DBGPRINT(RT_DEBUG_TRACE, ("Duration %d, Channel %d!\n", pReq->Measurement.Duration, pReq->Measurement.Channel)); - - // If it's non serving channel scan, send out a null frame with PSM bit on. - if (pAd->StaCfg.CCXScanChannel != pAd->CommonCfg.Channel) - { - // Use MLME enqueue method - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - return; - - pNullFrame = (PHEADER_802_11) pOutBuffer;; - // Make the power save Null frame with PSM bit on - MgtMacHeaderInit(pAd, pNullFrame, SUBTYPE_NULL_FUNC, 1, pAd->CommonCfg.Bssid, pAd->CommonCfg.Bssid); - pNullFrame->Duration = 0; - pNullFrame->FC.Type = BTYPE_DATA; - pNullFrame->FC.PwrMgmt = PWR_SAVE; - - // Send using priority queue - MiniportMMRequest(pAd, 0, pOutBuffer, sizeof(HEADER_802_11)); - MlmeFreeMemory(pAd, pOutBuffer); - DBGPRINT(RT_DEBUG_TRACE, ("Send PSM Data frame for off channel RM\n")); - RTMPusecDelay(5000); - } - - pAd->StaCfg.CCXReqType = MSRN_TYPE_CHANNEL_LOAD_REQ; - pAd->StaCfg.CLBusyBytes = 0; - // Enable Rx with promiscuous reception - RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, 0x1010); - - // Set channel load measurement flag - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_MEASUREMENT); - - pAd->Mlme.AironetMachine.CurrState = AIRONET_SCANNING; - - DBGPRINT(RT_DEBUG_TRACE, ("ChannelLoadRequestAction <-----\n")); -} - -/* - ======================================================================== - - Routine Description: - Prepare noise histogram report action, special scan operation added - to support - - Arguments: - pAd Pointer to our adapter - pData Start from element ID - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID NoiseHistRequestAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Index) -{ - PRM_REQUEST_ACTION pReq; - MLME_SCAN_REQ_STRUCT ScanReq; - UCHAR ZeroSsid[32], i; - NDIS_STATUS NStatus; - PUCHAR pOutBuffer = NULL; - PHEADER_802_11 pNullFrame; - - DBGPRINT(RT_DEBUG_TRACE, ("NoiseHistRequestAction ----->\n")); - - pReq = (PRM_REQUEST_ACTION) &pAd->StaCfg.MeasurementRequest[Index]; - NdisZeroMemory(ZeroSsid, 32); - - // Prepare for special scan request - // The scan definition is different with our Active, Passive scan definition. - // For CCX2, Active means send out probe request with broadcast BSSID. - // Passive means no probe request sent, only listen to the beacons. - // The channel scanned is fixed as specified, no need to scan all channels. - // The scan wait time is specified in the request too. - // Passive scan Mode - - // Control state machine is not idle, reject the request - if ((pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) && (Index == 0)) - return; - - // Fill out stuff for scan request - ScanParmFill(pAd, &ScanReq, ZeroSsid, 0, BSS_ANY, SCAN_CISCO_NOISE); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; - - // Reset some internal control flags to make sure this scan works. - BssTableInit(&pAd->StaCfg.CCXBssTab); - pAd->StaCfg.ScanCnt = 0; - pAd->StaCfg.CCXScanChannel = pReq->Measurement.Channel; - pAd->StaCfg.CCXScanTime = pReq->Measurement.Duration; - pAd->StaCfg.CCXReqType = MSRN_TYPE_NOISE_HIST_REQ; - - DBGPRINT(RT_DEBUG_TRACE, ("Duration %d, Channel %d!\n", pReq->Measurement.Duration, pReq->Measurement.Channel)); - - // If it's non serving channel scan, send out a null frame with PSM bit on. - if (pAd->StaCfg.CCXScanChannel != pAd->CommonCfg.Channel) - { - // Use MLME enqueue method - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - return; - - pNullFrame = (PHEADER_802_11) pOutBuffer; - // Make the power save Null frame with PSM bit on - MgtMacHeaderInit(pAd, pNullFrame, SUBTYPE_NULL_FUNC, 1, pAd->CommonCfg.Bssid, pAd->CommonCfg.Bssid); - pNullFrame->Duration = 0; - pNullFrame->FC.Type = BTYPE_DATA; - pNullFrame->FC.PwrMgmt = PWR_SAVE; - - // Send using priority queue - MiniportMMRequest(pAd, 0, pOutBuffer, sizeof(HEADER_802_11)); - MlmeFreeMemory(pAd, pOutBuffer); - DBGPRINT(RT_DEBUG_TRACE, ("Send PSM Data frame for off channel RM\n")); - RTMPusecDelay(5000); - } - - // Reset the statistics - for (i = 0; i < 8; i++) - pAd->StaCfg.RPIDensity[i] = 0; - - // Enable Rx with promiscuous reception - RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, 0x1010); - - // Set channel load measurement flag - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_MEASUREMENT); - - pAd->Mlme.AironetMachine.CurrState = AIRONET_SCANNING; - - DBGPRINT(RT_DEBUG_TRACE, ("NoiseHistRequestAction <-----\n")); -} - -/* - ======================================================================== - - Routine Description: - Prepare Beacon report action, special scan operation added - to support - - Arguments: - pAd Pointer to our adapter - pData Start from element ID - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID BeaconRequestAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Index) -{ - PRM_REQUEST_ACTION pReq; - NDIS_STATUS NStatus; - PUCHAR pOutBuffer = NULL; - PHEADER_802_11 pNullFrame; - MLME_SCAN_REQ_STRUCT ScanReq; - UCHAR ZeroSsid[32]; - - DBGPRINT(RT_DEBUG_TRACE, ("BeaconRequestAction ----->\n")); - - pReq = (PRM_REQUEST_ACTION) &pAd->StaCfg.MeasurementRequest[Index]; - NdisZeroMemory(ZeroSsid, 32); - - // Prepare for special scan request - // The scan definition is different with our Active, Passive scan definition. - // For CCX2, Active means send out probe request with broadcast BSSID. - // Passive means no probe request sent, only listen to the beacons. - // The channel scanned is fixed as specified, no need to scan all channels. - // The scan wait time is specified in the request too. - if (pReq->Measurement.ScanMode == MSRN_SCAN_MODE_PASSIVE) - { - // Passive scan Mode - DBGPRINT(RT_DEBUG_TRACE, ("Passive Scan Mode!\n")); - - // Control state machine is not idle, reject the request - if ((pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) && (Index == 0)) - return; - - // Fill out stuff for scan request - ScanParmFill(pAd, &ScanReq, ZeroSsid, 0, BSS_ANY, SCAN_CISCO_PASSIVE); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; - - // Reset some internal control flags to make sure this scan works. - BssTableInit(&pAd->StaCfg.CCXBssTab); - pAd->StaCfg.ScanCnt = 0; - pAd->StaCfg.CCXScanChannel = pReq->Measurement.Channel; - pAd->StaCfg.CCXScanTime = pReq->Measurement.Duration; - pAd->StaCfg.CCXReqType = MSRN_TYPE_BEACON_REQ; - DBGPRINT(RT_DEBUG_TRACE, ("Duration %d!\n", pReq->Measurement.Duration)); - - // If it's non serving channel scan, send out a null frame with PSM bit on. - if (pAd->StaCfg.CCXScanChannel != pAd->CommonCfg.Channel) - { - // Use MLME enqueue method - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - return; - - pNullFrame = (PHEADER_802_11) pOutBuffer; - // Make the power save Null frame with PSM bit on - MgtMacHeaderInit(pAd, pNullFrame, SUBTYPE_NULL_FUNC, 1, pAd->CommonCfg.Bssid, pAd->CommonCfg.Bssid); - pNullFrame->Duration = 0; - pNullFrame->FC.Type = BTYPE_DATA; - pNullFrame->FC.PwrMgmt = PWR_SAVE; - - // Send using priority queue - MiniportMMRequest(pAd, 0, pOutBuffer, sizeof(HEADER_802_11)); - MlmeFreeMemory(pAd, pOutBuffer); - DBGPRINT(RT_DEBUG_TRACE, ("Send PSM Data frame for off channel RM\n")); - RTMPusecDelay(5000); - } - - pAd->Mlme.AironetMachine.CurrState = AIRONET_SCANNING; - } - else if (pReq->Measurement.ScanMode == MSRN_SCAN_MODE_ACTIVE) - { - // Active scan Mode - DBGPRINT(RT_DEBUG_TRACE, ("Active Scan Mode!\n")); - - // Control state machine is not idle, reject the request - if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) - return; - - // Fill out stuff for scan request - ScanParmFill(pAd, &ScanReq, ZeroSsid, 0, BSS_ANY, SCAN_CISCO_ACTIVE); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; - - // Reset some internal control flags to make sure this scan works. - BssTableInit(&pAd->StaCfg.CCXBssTab); - pAd->StaCfg.ScanCnt = 0; - pAd->StaCfg.CCXScanChannel = pReq->Measurement.Channel; - pAd->StaCfg.CCXScanTime = pReq->Measurement.Duration; - pAd->StaCfg.CCXReqType = MSRN_TYPE_BEACON_REQ; - DBGPRINT(RT_DEBUG_TRACE, ("Duration %d!\n", pReq->Measurement.Duration)); - - // If it's non serving channel scan, send out a null frame with PSM bit on. - if (pAd->StaCfg.CCXScanChannel != pAd->CommonCfg.Channel) - { - // Use MLME enqueue method - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - return; - - pNullFrame = (PHEADER_802_11) pOutBuffer; - // Make the power save Null frame with PSM bit on - MgtMacHeaderInit(pAd, pNullFrame, SUBTYPE_NULL_FUNC, 1, pAd->CommonCfg.Bssid, pAd->CommonCfg.Bssid); - pNullFrame->Duration = 0; - pNullFrame->FC.Type = BTYPE_DATA; - pNullFrame->FC.PwrMgmt = PWR_SAVE; - - // Send using priority queue - MiniportMMRequest(pAd, 0, pOutBuffer, sizeof(HEADER_802_11)); - MlmeFreeMemory(pAd, pOutBuffer); - DBGPRINT(RT_DEBUG_TRACE, ("Send PSM Data frame for off channel RM\n")); - RTMPusecDelay(5000); - } - - pAd->Mlme.AironetMachine.CurrState = AIRONET_SCANNING; - } - else if (pReq->Measurement.ScanMode == MSRN_SCAN_MODE_BEACON_TABLE) - { - // Beacon report Mode, report all the APS in current bss table - DBGPRINT(RT_DEBUG_TRACE, ("Beacon Report Mode!\n")); - - // Copy current BSS table to CCX table, we can omit this step later on. - NdisMoveMemory(&pAd->StaCfg.CCXBssTab, &pAd->ScanTab, sizeof(BSS_TABLE)); - - // Create beacon report from Bss table - AironetCreateBeaconReportFromBssTable(pAd); - - // Set state to scanning - pAd->Mlme.AironetMachine.CurrState = AIRONET_SCANNING; - - // Enqueue report request - // Cisco scan request is finished, prepare beacon report - MlmeEnqueue(pAd, AIRONET_STATE_MACHINE, MT2_AIRONET_SCAN_DONE, 0, NULL); - } - else - { - // Wrong scan Mode - DBGPRINT(RT_DEBUG_TRACE, ("Wrong Scan Mode!\n")); - } - - DBGPRINT(RT_DEBUG_TRACE, ("BeaconRequestAction <-----\n")); -} - -/* - ======================================================================== - - Routine Description: - - Arguments: - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID AironetReportAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - PRM_REQUEST_ACTION pReq; - ULONG Now32; - - NdisGetSystemUpTime(&Now32); - pAd->StaCfg.LastBeaconRxTime = Now32; - - pReq = (PRM_REQUEST_ACTION) &pAd->StaCfg.MeasurementRequest[pAd->StaCfg.CurrentRMReqIdx]; - - DBGPRINT(RT_DEBUG_TRACE, ("AironetReportAction ----->\n")); - - // 1. Parse measurement type and call appropriate functions - if (pReq->ReqElem.Type == MSRN_TYPE_CHANNEL_LOAD_REQ) - // Channel Load measurement request - ChannelLoadReportAction(pAd, pAd->StaCfg.CurrentRMReqIdx); - else if (pReq->ReqElem.Type == MSRN_TYPE_NOISE_HIST_REQ) - // Noise Histogram measurement request - NoiseHistReportAction(pAd, pAd->StaCfg.CurrentRMReqIdx); - else if (pReq->ReqElem.Type == MSRN_TYPE_BEACON_REQ) - // Beacon measurement request - BeaconReportAction(pAd, pAd->StaCfg.CurrentRMReqIdx); - else - // Unknown. Do nothing and return - ; - - // 2. Point to the correct index of action element, start from 0 - pAd->StaCfg.CurrentRMReqIdx++; - - // 3. Check for parallel actions - if (pAd->StaCfg.ParallelReq == TRUE) - { - pReq = (PRM_REQUEST_ACTION) &pAd->StaCfg.MeasurementRequest[pAd->StaCfg.CurrentRMReqIdx]; - - // Process next action right away - if (pReq->ReqElem.Type == MSRN_TYPE_CHANNEL_LOAD_REQ) - // Channel Load measurement request - ChannelLoadReportAction(pAd, pAd->StaCfg.CurrentRMReqIdx); - else if (pReq->ReqElem.Type == MSRN_TYPE_NOISE_HIST_REQ) - // Noise Histogram measurement request - NoiseHistReportAction(pAd, pAd->StaCfg.CurrentRMReqIdx); - - pAd->StaCfg.ParallelReq = FALSE; - pAd->StaCfg.CurrentRMReqIdx++; - } - - if (pAd->StaCfg.CurrentRMReqIdx >= pAd->StaCfg.RMReqCnt) - { - // 4. There is no more unprocessed measurement request, go for transmit this report - AironetFinalReportAction(pAd); - pAd->Mlme.AironetMachine.CurrState = AIRONET_IDLE; - } - else - { - pReq = (PRM_REQUEST_ACTION) &pAd->StaCfg.MeasurementRequest[pAd->StaCfg.CurrentRMReqIdx]; - - if (pReq->Measurement.Channel != pAd->CommonCfg.Channel) - { - RTMPusecDelay(100000); - } - - // 5. There are more requests to be measure - MlmeEnqueue(pAd, AIRONET_STATE_MACHINE, MT2_AIRONET_SCAN_REQ, 0, NULL); - RT28XX_MLME_HANDLER(pAd); - } - - DBGPRINT(RT_DEBUG_TRACE, ("AironetReportAction <-----\n")); -} - -/* - ======================================================================== - - Routine Description: - - Arguments: - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID AironetFinalReportAction( - IN PRTMP_ADAPTER pAd) -{ - PUCHAR pDest; - PAIRONET_IAPP_HEADER pIAPP; - PHEADER_802_11 pHeader; - UCHAR AckRate = RATE_2; - USHORT AckDuration = 0; - NDIS_STATUS NStatus; - PUCHAR pOutBuffer = NULL; - ULONG FrameLen = 0; - - DBGPRINT(RT_DEBUG_TRACE, ("AironetFinalReportAction ----->\n")); - - // 0. Set up the frame pointer, Frame was inited at the end of message action - pDest = &pAd->StaCfg.FrameReportBuf[LENGTH_802_11]; - - // 1. Update report IAPP fields - pIAPP = (PAIRONET_IAPP_HEADER) pDest; - - // 2. Copy Cisco SNAP header - NdisMoveMemory(pIAPP->CiscoSnapHeader, SNAP_AIRONET, LENGTH_802_1_H); - - // 3. network order for this 16bit length - pIAPP->Length = cpu2be16(pAd->StaCfg.FrameReportLen - LENGTH_802_11 - LENGTH_802_1_H); - - // 3.1 sanity check the report length, ignore it if there is nothing to report - if (be2cpu16(pIAPP->Length) <= 18) - return; - - // 4. Type must be 0x32 - pIAPP->Type = AIRONET_IAPP_TYPE; - - // 5. SubType for report must be 0x81 - pIAPP->SubType = AIRONET_IAPP_SUBTYPE_REPORT; - - // 6. DA is not used and must be zero, although the whole frame was cleared at the start of function - // We will do it again here. We can use BSSID instead - COPY_MAC_ADDR(pIAPP->DA, pAd->CommonCfg.Bssid); - - // 7. SA is the client reporting which must be our MAC - COPY_MAC_ADDR(pIAPP->SA, pAd->CurrentAddress); - - // 8. Copy the saved dialog token - pIAPP->Token = pAd->StaCfg.IAPPToken; - - // 9. Make the Report frame 802.11 header - // Reuse function in wpa.c - pHeader = (PHEADER_802_11) pAd->StaCfg.FrameReportBuf; - pAd->Sequence ++; - WpaMacHeaderInit(pAd, pHeader, 0, pAd->CommonCfg.Bssid); - - // ACK size is 14 include CRC, and its rate is based on real time information - AckRate = pAd->CommonCfg.ExpectedACKRate[pAd->CommonCfg.MlmeRate]; - AckDuration = RTMPCalcDuration(pAd, AckRate, 14); - pHeader->Duration = pAd->CommonCfg.Dsifs + AckDuration; - - // Use MLME enqueue method - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - return; - - // 10. Prepare report frame with dynamic outbuffer. Just simply copy everything. - MakeOutgoingFrame(pOutBuffer, &FrameLen, - pAd->StaCfg.FrameReportLen, pAd->StaCfg.FrameReportBuf, - END_OF_ARGS); - - // 11. Send using priority queue - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - - pAd->StaCfg.CCXReqType = MSRN_TYPE_UNUSED; - - DBGPRINT(RT_DEBUG_TRACE, ("AironetFinalReportAction <-----\n")); -} - -/* - ======================================================================== - - Routine Description: - - Arguments: - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID ChannelLoadReportAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Index) -{ - PMEASUREMENT_REPORT_ELEMENT pReport; - PCHANNEL_LOAD_REPORT pLoad; - PUCHAR pDest; - UCHAR CCABusyFraction; - - DBGPRINT(RT_DEBUG_TRACE, ("ChannelLoadReportAction ----->\n")); - - // Disable Rx with promiscuous reception, make it back to normal - RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, STANORMAL); // Staion not drop control frame will fail WiFi Certification. - - // 0. Setup pointer for processing beacon & probe response - pDest = (PUCHAR) &pAd->StaCfg.FrameReportBuf[pAd->StaCfg.FrameReportLen]; - pReport = (PMEASUREMENT_REPORT_ELEMENT) pDest; - - // 1. Fill Measurement report element field. - pReport->Eid = IE_MEASUREMENT_REPORT; - // Fixed Length at 9, not include Eid and length fields - pReport->Length = 9; - pReport->Token = pAd->StaCfg.MeasurementRequest[Index].ReqElem.Token; - pReport->Mode = pAd->StaCfg.MeasurementRequest[Index].ReqElem.Mode; - pReport->Type = MSRN_TYPE_CHANNEL_LOAD_REQ; - - // 2. Fill channel report measurement data - pDest += sizeof(MEASUREMENT_REPORT_ELEMENT); - pLoad = (PCHANNEL_LOAD_REPORT) pDest; - pLoad->Channel = pAd->StaCfg.MeasurementRequest[Index].Measurement.Channel; - pLoad->Spare = 0; - pLoad->Duration = pAd->StaCfg.MeasurementRequest[Index].Measurement.Duration; - - // 3. Calculate the CCA Busy Fraction - // (Bytes + ACK size) * 8 / Tx speed * 255 / 1000 / measurement duration, use 24 us Tx speed - // = (Bytes + ACK) / 12 / duration - // 9 is the good value for pAd->StaCfg.CLFactor - // CCABusyFraction = (UCHAR) (pAd->StaCfg.CLBusyBytes / 9 / pLoad->Duration); - CCABusyFraction = (UCHAR) (pAd->StaCfg.CLBusyBytes / pAd->StaCfg.CLFactor / pLoad->Duration); - if (CCABusyFraction < 10) - CCABusyFraction = (UCHAR) (pAd->StaCfg.CLBusyBytes / 3 / pLoad->Duration) + 1; - - pLoad->CCABusy = CCABusyFraction; - DBGPRINT(RT_DEBUG_TRACE, ("CLBusyByte %ld, Duration %d, Result, %d\n", pAd->StaCfg.CLBusyBytes, pLoad->Duration, CCABusyFraction)); - - DBGPRINT(RT_DEBUG_TRACE, ("FrameReportLen %d\n", pAd->StaCfg.FrameReportLen)); - pAd->StaCfg.FrameReportLen += (sizeof(MEASUREMENT_REPORT_ELEMENT) + sizeof(CHANNEL_LOAD_REPORT)); - DBGPRINT(RT_DEBUG_TRACE, ("FrameReportLen %d\n", pAd->StaCfg.FrameReportLen)); - - // 4. Clear channel load measurement flag - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_MEASUREMENT); - - // 5. reset to idle state - pAd->Mlme.AironetMachine.CurrState = AIRONET_IDLE; - - DBGPRINT(RT_DEBUG_TRACE, ("ChannelLoadReportAction <-----\n")); -} - -/* - ======================================================================== - - Routine Description: - - Arguments: - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID NoiseHistReportAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Index) -{ - PMEASUREMENT_REPORT_ELEMENT pReport; - PNOISE_HIST_REPORT pNoise; - PUCHAR pDest; - UCHAR i,NoiseCnt; - USHORT TotalRPICnt, TotalRPISum; - - DBGPRINT(RT_DEBUG_TRACE, ("NoiseHistReportAction ----->\n")); - - // 0. Disable Rx with promiscuous reception, make it back to normal - RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, STANORMAL); // Staion not drop control frame will fail WiFi Certification. - // 1. Setup pointer for processing beacon & probe response - pDest = (PUCHAR) &pAd->StaCfg.FrameReportBuf[pAd->StaCfg.FrameReportLen]; - pReport = (PMEASUREMENT_REPORT_ELEMENT) pDest; - - // 2. Fill Measurement report element field. - pReport->Eid = IE_MEASUREMENT_REPORT; - // Fixed Length at 16, not include Eid and length fields - pReport->Length = 16; - pReport->Token = pAd->StaCfg.MeasurementRequest[Index].ReqElem.Token; - pReport->Mode = pAd->StaCfg.MeasurementRequest[Index].ReqElem.Mode; - pReport->Type = MSRN_TYPE_NOISE_HIST_REQ; - - // 3. Fill noise histogram report measurement data - pDest += sizeof(MEASUREMENT_REPORT_ELEMENT); - pNoise = (PNOISE_HIST_REPORT) pDest; - pNoise->Channel = pAd->StaCfg.MeasurementRequest[Index].Measurement.Channel; - pNoise->Spare = 0; - pNoise->Duration = pAd->StaCfg.MeasurementRequest[Index].Measurement.Duration; - // 4. Fill Noise histogram, the total RPI counts should be 0.4 * TU - // We estimate 4000 normal packets received durning 10 seconds test. - // Adjust it if required. - // 3 is a good value for pAd->StaCfg.NHFactor - // TotalRPICnt = pNoise->Duration * 3 / 10; - TotalRPICnt = pNoise->Duration * pAd->StaCfg.NHFactor / 10; - TotalRPISum = 0; - - for (i = 0; i < 8; i++) - { - TotalRPISum += pAd->StaCfg.RPIDensity[i]; - DBGPRINT(RT_DEBUG_TRACE, ("RPI %d Conuts %d\n", i, pAd->StaCfg.RPIDensity[i])); - } - - // Double check if the counter is larger than our expectation. - // We will replace it with the total number plus a fraction. - if (TotalRPISum > TotalRPICnt) - TotalRPICnt = TotalRPISum + pNoise->Duration / 20; - - DBGPRINT(RT_DEBUG_TRACE, ("Total RPI Conuts %d\n", TotalRPICnt)); - - // 5. Initialize noise count for the total summation of 0xff - NoiseCnt = 0; - for (i = 1; i < 8; i++) - { - pNoise->Density[i] = (UCHAR) (pAd->StaCfg.RPIDensity[i] * 255 / TotalRPICnt); - if ((pNoise->Density[i] == 0) && (pAd->StaCfg.RPIDensity[i] != 0)) - pNoise->Density[i]++; - NoiseCnt += pNoise->Density[i]; - DBGPRINT(RT_DEBUG_TRACE, ("Reported RPI[%d] = 0x%02x\n", i, pNoise->Density[i])); - } - - // 6. RPI[0] represents the rest of counts - pNoise->Density[0] = 0xff - NoiseCnt; - DBGPRINT(RT_DEBUG_TRACE, ("Reported RPI[0] = 0x%02x\n", pNoise->Density[0])); - - pAd->StaCfg.FrameReportLen += (sizeof(MEASUREMENT_REPORT_ELEMENT) + sizeof(NOISE_HIST_REPORT)); - - // 7. Clear channel load measurement flag - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_MEASUREMENT); - - // 8. reset to idle state - pAd->Mlme.AironetMachine.CurrState = AIRONET_IDLE; - - DBGPRINT(RT_DEBUG_TRACE, ("NoiseHistReportAction <-----\n")); -} - -/* - ======================================================================== - - Routine Description: - Prepare Beacon report action, - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID BeaconReportAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Index) -{ - DBGPRINT(RT_DEBUG_TRACE, ("BeaconReportAction ----->\n")); - - // Looks like we don't have anything thing need to do here. - // All measurement report already finished in AddBeaconReport - // The length is in the FrameReportLen - - // reset Beacon index for next beacon request - pAd->StaCfg.LastBssIndex = 0xff; - - // reset to idle state - pAd->Mlme.AironetMachine.CurrState = AIRONET_IDLE; - - DBGPRINT(RT_DEBUG_TRACE, ("BeaconReportAction <-----\n")); -} - -/* - ======================================================================== - - Routine Description: - - Arguments: - Index Current BSSID in CCXBsstab entry index - - Return Value: - - Note: - - ======================================================================== -*/ -VOID AironetAddBeaconReport( - IN PRTMP_ADAPTER pAd, - IN ULONG Index, - IN PMLME_QUEUE_ELEM pElem) -{ - PVOID pMsg; - PUCHAR pSrc, pDest; - UCHAR ReqIdx; - ULONG MsgLen; - USHORT Length; - PFRAME_802_11 pFrame; - PMEASUREMENT_REPORT_ELEMENT pReport; - PEID_STRUCT pEid; - PBEACON_REPORT pBeaconReport; - PBSS_ENTRY pBss; - - // 0. Setup pointer for processing beacon & probe response - pMsg = pElem->Msg; - MsgLen = pElem->MsgLen; - pFrame = (PFRAME_802_11) pMsg; - pSrc = pFrame->Octet; // Start from AP TSF - pBss = (PBSS_ENTRY) &pAd->StaCfg.CCXBssTab.BssEntry[Index]; - ReqIdx = pAd->StaCfg.CurrentRMReqIdx; - - // 1 Check the Index, if we already create this entry, only update the average RSSI - if ((Index <= pAd->StaCfg.LastBssIndex) && (pAd->StaCfg.LastBssIndex != 0xff)) - { - pDest = (PUCHAR) &pAd->StaCfg.FrameReportBuf[pAd->StaCfg.BssReportOffset[Index]]; - // Point to bss report information - pDest += sizeof(MEASUREMENT_REPORT_ELEMENT); - pBeaconReport = (PBEACON_REPORT) pDest; - - // Update Rx power, in dBm - // Get the original RSSI readback from BBP - pBeaconReport->RxPower += pAd->BbpRssiToDbmDelta; - // Average the Rssi reading - pBeaconReport->RxPower = (pBeaconReport->RxPower + pBss->Rssi) / 2; - // Get to dBm format - pBeaconReport->RxPower -= pAd->BbpRssiToDbmDelta; - - DBGPRINT(RT_DEBUG_TRACE, ("Bssid %02x:%02x:%02x:%02x:%02x:%02x ", - pBss->Bssid[0], pBss->Bssid[1], pBss->Bssid[2], - pBss->Bssid[3], pBss->Bssid[4], pBss->Bssid[5])); - DBGPRINT(RT_DEBUG_TRACE, ("RxPower[%ld] Rssi %d, Avg Rssi %d\n", Index, (pBss->Rssi - pAd->BbpRssiToDbmDelta), pBeaconReport->RxPower - 256)); - DBGPRINT(RT_DEBUG_TRACE, ("FrameReportLen = %d\n", pAd->StaCfg.BssReportOffset[Index])); - - // Update other information here - - // Done - return; - } - - // 2. Update reported Index - pAd->StaCfg.LastBssIndex = Index; - - // 3. Setup the buffer address for copying this BSSID into reporting frame - // The offset should start after 802.11 header and report frame header. - pDest = (PUCHAR) &pAd->StaCfg.FrameReportBuf[pAd->StaCfg.FrameReportLen]; - - // 4. Save the start offset of each Bss in report frame - pAd->StaCfg.BssReportOffset[Index] = pAd->StaCfg.FrameReportLen; - - // 5. Fill Measurement report fields - pReport = (PMEASUREMENT_REPORT_ELEMENT) pDest; - pReport->Eid = IE_MEASUREMENT_REPORT; - pReport->Length = 0; - pReport->Token = pAd->StaCfg.MeasurementRequest[ReqIdx].ReqElem.Token; - pReport->Mode = pAd->StaCfg.MeasurementRequest[ReqIdx].ReqElem.Mode; - pReport->Type = MSRN_TYPE_BEACON_REQ; - Length = sizeof(MEASUREMENT_REPORT_ELEMENT); - pDest += sizeof(MEASUREMENT_REPORT_ELEMENT); - - // 6. Start thebeacon report format - pBeaconReport = (PBEACON_REPORT) pDest; - pDest += sizeof(BEACON_REPORT); - Length += sizeof(BEACON_REPORT); - - // 7. Copy Channel number - pBeaconReport->Channel = pBss->Channel; - pBeaconReport->Spare = 0; - pBeaconReport->Duration = pAd->StaCfg.MeasurementRequest[ReqIdx].Measurement.Duration; - pBeaconReport->PhyType = ((pBss->SupRateLen+pBss->ExtRateLen > 4) ? PHY_ERP : PHY_DSS); - // 8. Rx power, in dBm - pBeaconReport->RxPower = pBss->Rssi - pAd->BbpRssiToDbmDelta; - - DBGPRINT(RT_DEBUG_TRACE, ("Bssid %02x:%02x:%02x:%02x:%02x:%02x ", - pBss->Bssid[0], pBss->Bssid[1], pBss->Bssid[2], - pBss->Bssid[3], pBss->Bssid[4], pBss->Bssid[5])); - DBGPRINT(RT_DEBUG_TRACE, ("RxPower[%ld], Rssi %d\n", Index, pBeaconReport->RxPower - 256)); - DBGPRINT(RT_DEBUG_TRACE, ("FrameReportLen = %d\n", pAd->StaCfg.FrameReportLen)); - - pBeaconReport->BeaconInterval = pBss->BeaconPeriod; - COPY_MAC_ADDR(pBeaconReport->BSSID, pFrame->Hdr.Addr3); - NdisMoveMemory(pBeaconReport->ParentTSF, pSrc, 4); - NdisMoveMemory(pBeaconReport->TargetTSF, &pElem->TimeStamp.u.LowPart, 4); - NdisMoveMemory(&pBeaconReport->TargetTSF[4], &pElem->TimeStamp.u.HighPart, 4); - - // 9. Skip the beacon frame and offset to start of capabilityinfo since we already processed capabilityinfo - pSrc += (TIMESTAMP_LEN + 2); - pBeaconReport->CapabilityInfo = *(USHORT *)pSrc; - - // 10. Point to start of element ID - pSrc += 2; - pEid = (PEID_STRUCT) pSrc; - - // 11. Start process all variable Eid oayload and add the appropriate to the frame report - while (((PUCHAR) pEid + pEid->Len + 1) < ((PUCHAR) pFrame + MsgLen)) - { - // Only limited EID are required to report for CCX 2. It includes SSID, Supported rate, - // FH paramenter set, DS parameter set, CF parameter set, IBSS parameter set, - // TIM (report first 4 bytes only, radio measurement capability - switch (pEid->Eid) - { - case IE_SSID: - case IE_SUPP_RATES: - case IE_FH_PARM: - case IE_DS_PARM: - case IE_CF_PARM: - case IE_IBSS_PARM: - NdisMoveMemory(pDest, pEid, pEid->Len + 2); - pDest += (pEid->Len + 2); - Length += (pEid->Len + 2); - break; - - case IE_MEASUREMENT_CAPABILITY: - // Since this IE is duplicated with WPA security IE, we has to do sanity check before - // recognize it. - // 1. It also has fixed 6 bytes IE length. - if (pEid->Len != 6) - break; - // 2. Check the Cisco Aironet OUI - if (NdisEqualMemory(CISCO_OUI, (pSrc + 2), 3)) - { - // Matched, this is what we want - NdisMoveMemory(pDest, pEid, pEid->Len + 2); - pDest += (pEid->Len + 2); - Length += (pEid->Len + 2); - } - break; - - case IE_TIM: - if (pEid->Len > 4) - { - // May truncate and report the first 4 bytes only, with the eid & len, total should be 6 - NdisMoveMemory(pDest, pEid, 6); - pDest += 6; - Length += 6; - } - else - { - NdisMoveMemory(pDest, pEid, pEid->Len + 2); - pDest += (pEid->Len + 2); - Length += (pEid->Len + 2); - } - break; - - default: - break; - } - // 12. Move to next element ID - pSrc += (2 + pEid->Len); - pEid = (PEID_STRUCT) pSrc; - } - - // 13. Update the length in the header, not include EID and length - pReport->Length = Length - 4; - - // 14. Update the frame report buffer data length - pAd->StaCfg.FrameReportLen += Length; - DBGPRINT(RT_DEBUG_TRACE, ("FR len = %d\n", pAd->StaCfg.FrameReportLen)); -} - -/* - ======================================================================== - - Routine Description: - - Arguments: - Index Current BSSID in CCXBsstab entry index - - Return Value: - - Note: - - ======================================================================== -*/ -VOID AironetCreateBeaconReportFromBssTable( - IN PRTMP_ADAPTER pAd) -{ - PMEASUREMENT_REPORT_ELEMENT pReport; - PBEACON_REPORT pBeaconReport; - UCHAR Index, ReqIdx; - USHORT Length; - PUCHAR pDest; - PBSS_ENTRY pBss; - - // 0. setup base pointer - ReqIdx = pAd->StaCfg.CurrentRMReqIdx; - - for (Index = 0; Index < pAd->StaCfg.CCXBssTab.BssNr; Index++) - { - // 1. Setup the buffer address for copying this BSSID into reporting frame - // The offset should start after 802.11 header and report frame header. - pDest = (PUCHAR) &pAd->StaCfg.FrameReportBuf[pAd->StaCfg.FrameReportLen]; - pBss = (PBSS_ENTRY) &pAd->StaCfg.CCXBssTab.BssEntry[Index]; - Length = 0; - - // 2. Fill Measurement report fields - pReport = (PMEASUREMENT_REPORT_ELEMENT) pDest; - pReport->Eid = IE_MEASUREMENT_REPORT; - pReport->Length = 0; - pReport->Token = pAd->StaCfg.MeasurementRequest[ReqIdx].ReqElem.Token; - pReport->Mode = pAd->StaCfg.MeasurementRequest[ReqIdx].ReqElem.Mode; - pReport->Type = MSRN_TYPE_BEACON_REQ; - Length = sizeof(MEASUREMENT_REPORT_ELEMENT); - pDest += sizeof(MEASUREMENT_REPORT_ELEMENT); - - // 3. Start the beacon report format - pBeaconReport = (PBEACON_REPORT) pDest; - pDest += sizeof(BEACON_REPORT); - Length += sizeof(BEACON_REPORT); - - // 4. Copy Channel number - pBeaconReport->Channel = pBss->Channel; - pBeaconReport->Spare = 0; - pBeaconReport->Duration = pAd->StaCfg.MeasurementRequest[ReqIdx].Measurement.Duration; - pBeaconReport->PhyType = ((pBss->SupRateLen+pBss->ExtRateLen > 4) ? PHY_ERP : PHY_DSS); - pBeaconReport->RxPower = pBss->Rssi - pAd->BbpRssiToDbmDelta; - pBeaconReport->BeaconInterval = pBss->BeaconPeriod; - pBeaconReport->CapabilityInfo = pBss->CapabilityInfo; - COPY_MAC_ADDR(pBeaconReport->BSSID, pBss->Bssid); - NdisMoveMemory(pBeaconReport->ParentTSF, pBss->PTSF, 4); - NdisMoveMemory(pBeaconReport->TargetTSF, pBss->TTSF, 8); - - // 5. Create SSID - *pDest++ = 0x00; - *pDest++ = pBss->SsidLen; - NdisMoveMemory(pDest, pBss->Ssid, pBss->SsidLen); - pDest += pBss->SsidLen; - Length += (2 + pBss->SsidLen); - - // 6. Create SupportRates - *pDest++ = 0x01; - *pDest++ = pBss->SupRateLen; - NdisMoveMemory(pDest, pBss->SupRate, pBss->SupRateLen); - pDest += pBss->SupRateLen; - Length += (2 + pBss->SupRateLen); - - // 7. DS Parameter - *pDest++ = 0x03; - *pDest++ = 1; - *pDest++ = pBss->Channel; - Length += 3; - - // 8. IBSS parameter if presents - if (pBss->BssType == BSS_ADHOC) - { - *pDest++ = 0x06; - *pDest++ = 2; - *(PUSHORT) pDest = pBss->AtimWin; - pDest += 2; - Length += 4; - } - - // 9. Update length field, not include EID and length - pReport->Length = Length - 4; - - // 10. Update total frame size - pAd->StaCfg.FrameReportLen += Length; - } -} diff --git a/drivers/staging/rt2860/sta/assoc.c b/drivers/staging/rt2860/sta/assoc.c index 1a587153c75e..b13d3a2e9645 100644 --- a/drivers/staging/rt2860/sta/assoc.c +++ b/drivers/staging/rt2860/sta/assoc.c @@ -149,7 +149,7 @@ VOID AssocTimeout(IN PVOID SystemSpecific1, return; MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_ASSOC_TIMEOUT, 0, NULL); - RT28XX_MLME_HANDLER(pAd); + RTMP_MLME_HANDLER(pAd); } /* @@ -177,7 +177,7 @@ VOID ReassocTimeout(IN PVOID SystemSpecific1, return; MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_REASSOC_TIMEOUT, 0, NULL); - RT28XX_MLME_HANDLER(pAd); + RTMP_MLME_HANDLER(pAd); } /* @@ -205,7 +205,7 @@ VOID DisassocTimeout(IN PVOID SystemSpecific1, return; MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_DISASSOC_TIMEOUT, 0, NULL); - RT28XX_MLME_HANDLER(pAd); + RTMP_MLME_HANDLER(pAd); } /* @@ -236,7 +236,6 @@ VOID MlmeAssocReqAction( { UCHAR ApAddr[6]; HEADER_802_11 AssocHdr; - UCHAR Ccx2Len = 5; UCHAR WmeIe[9] = {IE_VENDOR_SPECIFIC, 0x07, 0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00}; USHORT ListenIntv; ULONG Timeout; @@ -247,13 +246,6 @@ VOID MlmeAssocReqAction( ULONG FrameLen = 0; ULONG tmp; USHORT VarIesOffset; - UCHAR CkipFlag; - UCHAR CkipNegotiationBuffer[CKIP_NEGOTIATION_LENGTH]; - UCHAR AironetCkipIe = IE_AIRONET_CKIP; - UCHAR AironetCkipLen = CKIP_NEGOTIATION_LENGTH; - UCHAR AironetIPAddressIE = IE_AIRONET_IPADDRESS; - UCHAR AironetIPAddressLen = AIRONET_IPADDRESS_LENGTH; - UCHAR AironetIPAddressBuffer[AIRONET_IPADDRESS_LENGTH] = {0x00, 0x40, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00}; USHORT Status; // Block all authentication request durning WPA block period @@ -454,7 +446,8 @@ VOID MlmeAssocReqAction( RSNIe = IE_WPA2; } - if (pAd->StaCfg.WpaSupplicantUP != 1) + if ((pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_ENABLE) && + (pAd->StaCfg.bRSN_IE_FromWpaSupplicant == FALSE)) RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, BSS0); // Check for WPA PMK cache list @@ -471,7 +464,18 @@ VOID MlmeAssocReqAction( break; } } - +#ifdef RT2860 + /* + When AuthMode is WPA2-Enterprise and AP reboot or STA lost AP, + AP would not do PMK cache with STA after STA re-connect to AP again. + In this case, driver doesn't need to send PMKID to AP and WpaSupplicant. + */ + if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) && + (NdisEqualMemory(pAd->MlmeAux.Bssid, pAd->CommonCfg.LastBssid, MAC_ADDR_LEN))) + { + FoundPMK = FALSE; + } +#endif // RT2860 // if (FoundPMK) { // Set PMK number @@ -481,7 +485,8 @@ VOID MlmeAssocReqAction( } } - if (pAd->StaCfg.WpaSupplicantUP == 1) + if ((pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) && + (pAd->StaCfg.bRSN_IE_FromWpaSupplicant == TRUE)) { MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, pAd->StaCfg.RSNIE_Len, pAd->StaCfg.RSN_IE, @@ -498,7 +503,8 @@ VOID MlmeAssocReqAction( FrameLen += tmp; - if (pAd->StaCfg.WpaSupplicantUP != 1) + if ((pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_ENABLE) || + (pAd->StaCfg.bRSN_IE_FromWpaSupplicant == FALSE)) { // Append Variable IE NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &RSNIe, 1); @@ -513,53 +519,6 @@ VOID MlmeAssocReqAction( pAd->StaCfg.ReqVarIELen = VarIesOffset; } - // We have update that at PeerBeaconAtJoinRequest() - CkipFlag = pAd->StaCfg.CkipFlag; - if (CkipFlag != 0) - { - NdisZeroMemory(CkipNegotiationBuffer, CKIP_NEGOTIATION_LENGTH); - CkipNegotiationBuffer[2] = 0x66; - // Make it try KP & MIC, since we have to follow the result from AssocRsp - CkipNegotiationBuffer[8] = 0x18; - CkipNegotiationBuffer[CKIP_NEGOTIATION_LENGTH - 1] = 0x22; - CkipFlag = 0x18; - - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 1, &AironetCkipIe, - 1, &AironetCkipLen, - AironetCkipLen, CkipNegotiationBuffer, - END_OF_ARGS); - FrameLen += tmp; - } - - // Add CCX v2 request if CCX2 admin state is on - if (pAd->StaCfg.CCXControl.field.Enable == 1) - { - - // - // Add AironetIPAddressIE for Cisco CCX 2.X - // Add CCX Version - // - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 1, &AironetIPAddressIE, - 1, &AironetIPAddressLen, - AironetIPAddressLen, AironetIPAddressBuffer, - 1, &Ccx2Ie, - 1, &Ccx2Len, - Ccx2Len, Ccx2IeInfo, - END_OF_ARGS); - FrameLen += tmp; - - // Add by James 03/06/27 - // Set Variable IEs Length - pAd->StaCfg.ReqVarIELen = VarIesOffset; - pAd->StaCfg.AssocInfo.RequestIELength = VarIesOffset; - - // OffsetResponseIEs follow ReqVarIE - pAd->StaCfg.AssocInfo.OffsetResponseIEs = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION) + pAd->StaCfg.ReqVarIELen; - // End Add by James - } - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); @@ -600,7 +559,6 @@ VOID MlmeReassocReqAction( { UCHAR ApAddr[6]; HEADER_802_11 ReassocHdr; - UCHAR Ccx2Len = 5; UCHAR WmeIe[9] = {IE_VENDOR_SPECIFIC, 0x07, 0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00}; USHORT CapabilityInfo, ListenIntv; ULONG Timeout; @@ -749,20 +707,6 @@ VOID MlmeReassocReqAction( FrameLen += TmpLen; } - // Add CCX v2 request if CCX2 admin state is on - if (pAd->StaCfg.CCXControl.field.Enable == 1) - { - // - // Add CCX Version - // - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 1, &Ccx2Ie, - 1, &Ccx2Len, - Ccx2Len, Ccx2IeInfo, - END_OF_ARGS); - FrameLen += tmp; - } - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); @@ -800,9 +744,10 @@ VOID MlmeDisassocReqAction( ULONG FrameLen = 0; NDIS_STATUS NStatus; BOOLEAN TimerCancelled; - ULONG Timeout = 0; + ULONG Timeout = 500; USHORT Status; + // skip sanity check pDisassocReq = (PMLME_DISASSOC_REQ_STRUCT)(Elem->Msg); @@ -845,11 +790,9 @@ VOID MlmeDisassocReqAction( RTMPSetTimer(&pAd->MlmeAux.DisassocTimer, Timeout); /* in mSec */ pAd->Mlme.AssocMachine.CurrState = DISASSOC_WAIT_RSP; - { - union iwreq_data wrqu; - memset(wrqu.ap_addr.sa_data, 0, MAC_ADDR_LEN); - wireless_send_event(pAd->net_dev, SIOCGIWAP, &wrqu, NULL); - } + + RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0); + } /* @@ -876,7 +819,7 @@ VOID PeerAssocRspAction( EDCA_PARM EdcaParm; HT_CAPABILITY_IE HtCapability; ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE - UCHAR HtCapabilityLen; + UCHAR HtCapabilityLen = 0; UCHAR AddHtInfoLen; UCHAR NewExtChannelOffset = 0xff; @@ -889,24 +832,10 @@ VOID PeerAssocRspAction( DBGPRINT(RT_DEBUG_TRACE, ("PeerAssocRspAction():ASSOC - receive ASSOC_RSP to me (status=%d)\n", Status)); DBGPRINT(RT_DEBUG_TRACE, ("PeerAssocRspAction():MacTable [%d].AMsduSize = %d. ClientStatusFlags = 0x%lx \n",Elem->Wcid, pAd->MacTab.Content[BSSID_WCID].AMsduSize, pAd->MacTab.Content[BSSID_WCID].ClientStatusFlags)); RTMPCancelTimer(&pAd->MlmeAux.AssocTimer, &TimerCancelled); - if(Status == MLME_SUCCESS) - { -#ifdef RT2860 - // go to procedure listed on page 376 - AssocPostProc(pAd, Addr2, CapabilityInfo, Aid, SupRate, SupRateLen, ExtRate, ExtRateLen, - &EdcaParm, &HtCapability, HtCapabilityLen, &AddHtInfo); - - { - union iwreq_data wrqu; - wext_notify_event_assoc(pAd); - memset(wrqu.ap_addr.sa_data, 0, MAC_ADDR_LEN); - memcpy(wrqu.ap_addr.sa_data, pAd->MlmeAux.Bssid, MAC_ADDR_LEN); - wireless_send_event(pAd->net_dev, SIOCGIWAP, &wrqu, NULL); - } -#endif -#ifdef RT2870 + if(Status == MLME_SUCCESS) + { UCHAR MaxSupportedRateIn500Kbps = 0; UCHAR idx; @@ -926,23 +855,14 @@ VOID PeerAssocRspAction( AssocPostProc(pAd, Addr2, CapabilityInfo, Aid, SupRate, SupRateLen, ExtRate, ExtRateLen, &EdcaParm, &HtCapability, HtCapabilityLen, &AddHtInfo); - StaAddMacTableEntry(pAd, &pAd->MacTab.Content[BSSID_WCID], MaxSupportedRateIn500Kbps, &HtCapability, HtCapabilityLen, CapabilityInfo); -#endif - pAd->StaCfg.CkipFlag = CkipFlag; - if (CkipFlag & 0x18) - { - NdisZeroMemory(pAd->StaCfg.TxSEQ, 4); - NdisZeroMemory(pAd->StaCfg.RxSEQ, 4); - NdisZeroMemory(pAd->StaCfg.CKIPMIC, 4); - pAd->StaCfg.GIV[0] = RandomByte(pAd); - pAd->StaCfg.GIV[1] = RandomByte(pAd); - pAd->StaCfg.GIV[2] = RandomByte(pAd); - pAd->StaCfg.bCkipOn = TRUE; - DBGPRINT(RT_DEBUG_TRACE, (" pAd->StaCfg.CkipFlag = 0x%02x\n", pAd->StaCfg.CkipFlag)); - } - } - else - { + StaAddMacTableEntry(pAd, + &pAd->MacTab.Content[BSSID_WCID], + MaxSupportedRateIn500Kbps, + &HtCapability, + HtCapabilityLen, + &AddHtInfo, + AddHtInfoLen, + CapabilityInfo); } pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_ASSOC_CONF, 2, &Status); @@ -998,25 +918,19 @@ VOID PeerReassocRspAction( AssocPostProc(pAd, Addr2, CapabilityInfo, Aid, SupRate, SupRateLen, ExtRate, ExtRateLen, &EdcaParm, &HtCapability, HtCapabilityLen, &AddHtInfo); + { - union iwreq_data wrqu; wext_notify_event_assoc(pAd); - - memset(wrqu.ap_addr.sa_data, 0, MAC_ADDR_LEN); - memcpy(wrqu.ap_addr.sa_data, pAd->MlmeAux.Bssid, MAC_ADDR_LEN); - wireless_send_event(pAd->net_dev, SIOCGIWAP, &wrqu, NULL); - + RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, &pAd->MlmeAux.Bssid[0], NULL, 0); } } - { // CkipFlag is no use for reassociate pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, &Status); } } - } else { DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - PeerReassocRspAction() sanity check fail\n")); @@ -1123,6 +1037,10 @@ VOID AssocPostProc( pVIE = pAd->ScanTab.BssEntry[Idx].VarIEs; len = pAd->ScanTab.BssEntry[Idx].VarIELen; + //KH need to check again + // Don't allow to go to sleep mode if authmode is WPA-related. + //This can make Authentication process more smoothly. + RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); while (len > 0) { @@ -1147,6 +1065,8 @@ VOID AssocPostProc( pVIE += (pEid->Len + 2); len -= (pEid->Len + 2); } + + } if (pAd->MacTab.Content[BSSID_WCID].RSNIE_Len == 0) @@ -1190,19 +1110,12 @@ VOID PeerDisassocAction( RTMPSendWirelessEvent(pAd, IW_DISASSOC_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); } - // - // Get Current System time and Turn on AdjacentAPReport - // - NdisGetSystemUpTime(&pAd->StaCfg.CCXAdjacentAPLinkDownTime); - pAd->StaCfg.CCXAdjacentAPReportFlag = TRUE; + LinkDown(pAd, TRUE); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - { - union iwreq_data wrqu; - memset(wrqu.ap_addr.sa_data, 0, MAC_ADDR_LEN); - wireless_send_event(pAd->net_dev, SIOCGIWAP, &wrqu, NULL); - } + + RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0); } } else @@ -1359,143 +1272,16 @@ VOID Cls3errAction( COPY_MAC_ADDR(pAd->StaCfg.DisassocSta, pAddr); } - /* - ========================================================================== - Description: - Switch between WEP and CKIP upon new association up. - Parameters: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID SwitchBetweenWepAndCkip( - IN PRTMP_ADAPTER pAd) -{ - int i; - SHAREDKEY_MODE_STRUC csr1; - - // if KP is required. change the CipherAlg in hardware shard key table from WEP - // to CKIP. else remain as WEP - if (pAd->StaCfg.bCkipOn && (pAd->StaCfg.CkipFlag & 0x10)) - { - // modify hardware key table so that MAC use correct algorithm to decrypt RX - RTMP_IO_READ32(pAd, SHARED_KEY_MODE_BASE, &csr1.word); - if (csr1.field.Bss0Key0CipherAlg == CIPHER_WEP64) - csr1.field.Bss0Key0CipherAlg = CIPHER_CKIP64; - else if (csr1.field.Bss0Key0CipherAlg == CIPHER_WEP128) - csr1.field.Bss0Key0CipherAlg = CIPHER_CKIP128; - - if (csr1.field.Bss0Key1CipherAlg == CIPHER_WEP64) - csr1.field.Bss0Key1CipherAlg = CIPHER_CKIP64; - else if (csr1.field.Bss0Key1CipherAlg == CIPHER_WEP128) - csr1.field.Bss0Key1CipherAlg = CIPHER_CKIP128; - - if (csr1.field.Bss0Key2CipherAlg == CIPHER_WEP64) - csr1.field.Bss0Key2CipherAlg = CIPHER_CKIP64; - else if (csr1.field.Bss0Key2CipherAlg == CIPHER_WEP128) - csr1.field.Bss0Key2CipherAlg = CIPHER_CKIP128; - - if (csr1.field.Bss0Key3CipherAlg == CIPHER_WEP64) - csr1.field.Bss0Key3CipherAlg = CIPHER_CKIP64; - else if (csr1.field.Bss0Key3CipherAlg == CIPHER_WEP128) - csr1.field.Bss0Key3CipherAlg = CIPHER_CKIP128; - RTMP_IO_WRITE32(pAd, SHARED_KEY_MODE_BASE, csr1.word); - DBGPRINT(RT_DEBUG_TRACE, ("SwitchBetweenWepAndCkip: modify BSS0 cipher to %s\n", CipherName[csr1.field.Bss0Key0CipherAlg])); - - // modify software key table so that driver can specify correct algorithm in TXD upon TX - for (i=0; iSharedKey[BSS0][i].CipherAlg == CIPHER_WEP64) - pAd->SharedKey[BSS0][i].CipherAlg = CIPHER_CKIP64; - else if (pAd->SharedKey[BSS0][i].CipherAlg == CIPHER_WEP128) - pAd->SharedKey[BSS0][i].CipherAlg = CIPHER_CKIP128; - } - } - - // else if KP NOT inused. change the CipherAlg in hardware shard key table from CKIP - // to WEP. - else - { - // modify hardware key table so that MAC use correct algorithm to decrypt RX - RTMP_IO_READ32(pAd, SHARED_KEY_MODE_BASE, &csr1.word); - if (csr1.field.Bss0Key0CipherAlg == CIPHER_CKIP64) - csr1.field.Bss0Key0CipherAlg = CIPHER_WEP64; - else if (csr1.field.Bss0Key0CipherAlg == CIPHER_CKIP128) - csr1.field.Bss0Key0CipherAlg = CIPHER_WEP128; - - if (csr1.field.Bss0Key1CipherAlg == CIPHER_CKIP64) - csr1.field.Bss0Key1CipherAlg = CIPHER_WEP64; - else if (csr1.field.Bss0Key1CipherAlg == CIPHER_CKIP128) - csr1.field.Bss0Key1CipherAlg = CIPHER_WEP128; - - if (csr1.field.Bss0Key2CipherAlg == CIPHER_CKIP64) - csr1.field.Bss0Key2CipherAlg = CIPHER_WEP64; - else if (csr1.field.Bss0Key2CipherAlg == CIPHER_CKIP128) - csr1.field.Bss0Key2CipherAlg = CIPHER_WEP128; - - if (csr1.field.Bss0Key3CipherAlg == CIPHER_CKIP64) - csr1.field.Bss0Key3CipherAlg = CIPHER_WEP64; - else if (csr1.field.Bss0Key3CipherAlg == CIPHER_CKIP128) - csr1.field.Bss0Key3CipherAlg = CIPHER_WEP128; - - // modify software key table so that driver can specify correct algorithm in TXD upon TX - for (i=0; iSharedKey[BSS0][i].CipherAlg == CIPHER_CKIP64) - pAd->SharedKey[BSS0][i].CipherAlg = CIPHER_WEP64; - else if (pAd->SharedKey[BSS0][i].CipherAlg == CIPHER_CKIP128) - pAd->SharedKey[BSS0][i].CipherAlg = CIPHER_WEP128; - } - - // - // On WPA-NONE, must update CipherAlg. - // Because the OID_802_11_WEP_STATUS was been set after OID_802_11_ADD_KEY - // and CipherAlg will be CIPHER_NONE by Windows ZeroConfig. - // So we need to update CipherAlg after connect. - // - if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) - { - for (i = 0; i < SHARE_KEY_NUM; i++) - { - if (pAd->SharedKey[BSS0][i].KeyLen != 0) - { - if (pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) - { - pAd->SharedKey[BSS0][i].CipherAlg = CIPHER_TKIP; - } - else if (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { - pAd->SharedKey[BSS0][i].CipherAlg = CIPHER_AES; - } - } - else - { - pAd->SharedKey[BSS0][i].CipherAlg = CIPHER_NONE; - } - } - - csr1.field.Bss0Key0CipherAlg = pAd->SharedKey[BSS0][0].CipherAlg; - csr1.field.Bss0Key1CipherAlg = pAd->SharedKey[BSS0][1].CipherAlg; - csr1.field.Bss0Key2CipherAlg = pAd->SharedKey[BSS0][2].CipherAlg; - csr1.field.Bss0Key3CipherAlg = pAd->SharedKey[BSS0][3].CipherAlg; - } - RTMP_IO_WRITE32(pAd, SHARED_KEY_MODE_BASE, csr1.word); - DBGPRINT(RT_DEBUG_TRACE, ("SwitchBetweenWepAndCkip: modify BSS0 cipher to %s\n", CipherName[csr1.field.Bss0Key0CipherAlg])); - } -} int wext_notify_event_assoc( IN RTMP_ADAPTER *pAd) { - union iwreq_data wrqu; char custom[IW_CUSTOM_MAX] = {0}; if (pAd->StaCfg.ReqVarIELen <= IW_CUSTOM_MAX) { - wrqu.data.length = pAd->StaCfg.ReqVarIELen; - memcpy(custom, pAd->StaCfg.ReqVarIEs, pAd->StaCfg.ReqVarIELen); - wireless_send_event(pAd->net_dev, IWEVASSOCREQIE, &wrqu, custom); + NdisMoveMemory(custom, pAd->StaCfg.ReqVarIEs, pAd->StaCfg.ReqVarIELen); + RtmpOSWrielessEventSend(pAd, IWEVASSOCREQIE, -1, NULL, custom, pAd->StaCfg.ReqVarIELen); } else DBGPRINT(RT_DEBUG_TRACE, ("pAd->StaCfg.ReqVarIELen > MAX_CUSTOM_LEN\n")); @@ -1504,13 +1290,15 @@ int wext_notify_event_assoc( } -#ifdef RT2870 + BOOLEAN StaAddMacTableEntry( IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, IN UCHAR MaxSupportedRateIn500Kbps, IN HT_CAPABILITY_IE *pHtCapability, IN UCHAR HtCapabilityLen, + IN ADD_HT_INFO_IE *pAddHtInfo, + IN UCHAR AddHtInfoLen, IN USHORT CapabilityInfo) { UCHAR MaxSupportedRate = RATE_11; @@ -1586,6 +1374,7 @@ BOOLEAN StaAddMacTableEntry( CLIENT_STATUS_CLEAR_FLAG(pEntry, fCLIENT_STATUS_PIGGYBACK_CAPABLE); } + NdisZeroMemory(&pEntry->HTCapability, sizeof(pEntry->HTCapability)); // If this Entry supports 802.11n, upgrade to HT rate. if ((HtCapabilityLen != 0) && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) { @@ -1605,7 +1394,9 @@ BOOLEAN StaAddMacTableEntry( pAd->CommonCfg.AddHTInfo.AddHtInfo2.NonGfPresent = 1; } - if ((pHtCapability->HtCapInfo.ChannelWidth) && (pAd->CommonCfg.DesiredHtPhy.ChannelWidth)) + if ((pHtCapability->HtCapInfo.ChannelWidth) && + (pAd->CommonCfg.DesiredHtPhy.ChannelWidth) && + ((pAd->StaCfg.BssType == BSS_INFRA) || ((pAd->StaCfg.BssType == BSS_ADHOC) && (pAddHtInfo->AddHtInfo.ExtChanOffset == pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset)))) { pEntry->MaxHTPhyMode.field.BW= BW_40; pEntry->MaxHTPhyMode.field.ShortGI = ((pAd->CommonCfg.DesiredHtPhy.ShortGIfor40)&(pHtCapability->HtCapInfo.ShortGIfor40)); @@ -1677,14 +1468,13 @@ BOOLEAN StaAddMacTableEntry( CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_RDG_CAPABLE); if (pHtCapability->ExtHtCapInfo.MCSFeedback == 0x03) CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_MCSFEEDBACK_CAPABLE); + NdisMoveMemory(&pEntry->HTCapability, pHtCapability, HtCapabilityLen); } else { pAd->MacTab.fAnyStationIsLegacy = TRUE; } - NdisMoveMemory(&pEntry->HTCapability, pHtCapability, sizeof(HT_CAPABILITY_IE)); - pEntry->HTPhyMode.word = pEntry->MaxHTPhyMode.word; pEntry->CurrTxRate = pEntry->MaxSupportedRate; @@ -1726,4 +1516,3 @@ BOOLEAN StaAddMacTableEntry( } return TRUE; } -#endif /* RT2870 */ diff --git a/drivers/staging/rt2860/sta/auth.c b/drivers/staging/rt2860/sta/auth.c index d8414eac42f8..7fb0760dabcc 100644 --- a/drivers/staging/rt2860/sta/auth.c +++ b/drivers/staging/rt2860/sta/auth.c @@ -108,7 +108,7 @@ VOID AuthTimeout( MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_AUTH_TIMEOUT, 0, NULL); - RT28XX_MLME_HANDLER(pAd); + RTMP_MLME_HANDLER(pAd); } @@ -124,59 +124,12 @@ VOID MlmeAuthReqAction( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem) { - UCHAR Addr[6]; - USHORT Alg, Seq, Status; - ULONG Timeout; - HEADER_802_11 AuthHdr; - BOOLEAN TimerCancelled; - NDIS_STATUS NStatus; - PUCHAR pOutBuffer = NULL; - ULONG FrameLen = 0; - - // Block all authentication request durning WPA block period - if (pAd->StaCfg.bBlockAssoc == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Block Auth request durning WPA block period!\n")); - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - Status = MLME_STATE_MACHINE_REJECT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); - } - else if(MlmeAuthReqSanity(pAd, Elem->Msg, Elem->MsgLen, Addr, &Timeout, &Alg)) - { - // reset timer - RTMPCancelTimer(&pAd->MlmeAux.AuthTimer, &TimerCancelled); - COPY_MAC_ADDR(pAd->MlmeAux.Bssid, Addr); - pAd->MlmeAux.Alg = Alg; - Seq = 1; - Status = MLME_SUCCESS; - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - MlmeAuthReqAction(Alg:%d) allocate memory failed\n", Alg)); - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - Status = MLME_FAIL_NO_RESOURCE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); - return; - } - - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Send AUTH request seq#1 (Alg=%d)...\n", Alg)); - MgtMacHeaderInit(pAd, &AuthHdr, SUBTYPE_AUTH, 0, Addr, pAd->MlmeAux.Bssid); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11),&AuthHdr, - 2, &Alg, - 2, &Seq, - 2, &Status, - END_OF_ARGS); - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - - RTMPSetTimer(&pAd->MlmeAux.AuthTimer, Timeout); + if (AUTH_ReqSend(pAd, Elem, &pAd->MlmeAux.AuthTimer, "AUTH", 1, NULL, 0)) pAd->Mlme.AuthMachine.CurrState = AUTH_WAIT_SEQ2; - } else { - DBGPRINT_ERR(("AUTH - MlmeAuthReqAction() sanity check failed\n")); + USHORT Status; + pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; Status = MLME_INVALID_FORMAT; MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); @@ -207,7 +160,7 @@ VOID PeerAuthRspAtSeq2Action( ULONG FrameLen = 0; USHORT Status2; - if (PeerAuthSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Alg, &Seq, &Status, ChlgText)) + if (PeerAuthSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Alg, &Seq, &Status, (PCHAR)ChlgText)) { if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, Addr2) && Seq == 2) { @@ -217,8 +170,7 @@ VOID PeerAuthRspAtSeq2Action( if (Status == MLME_SUCCESS) { // Authentication Mode "LEAP" has allow for CCX 1.X - if ((pAd->MlmeAux.Alg == Ndis802_11AuthModeOpen) - ) + if (pAd->MlmeAux.Alg == Ndis802_11AuthModeOpen) { pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); @@ -457,4 +409,82 @@ VOID Cls2errAction( COPY_MAC_ADDR(pAd->StaCfg.DeauthSta, pAddr); } +BOOLEAN AUTH_ReqSend( + IN PRTMP_ADAPTER pAd, + IN PMLME_QUEUE_ELEM pElem, + IN PRALINK_TIMER_STRUCT pAuthTimer, + IN PSTRING pSMName, + IN USHORT SeqNo, + IN PUCHAR pNewElement, + IN ULONG ElementLen) +{ + USHORT Alg, Seq, Status; + UCHAR Addr[6]; + ULONG Timeout; + HEADER_802_11 AuthHdr; + BOOLEAN TimerCancelled; + NDIS_STATUS NStatus; + PUCHAR pOutBuffer = NULL; + ULONG FrameLen = 0, tmp = 0; + + // Block all authentication request durning WPA block period + if (pAd->StaCfg.bBlockAssoc == TRUE) + { + DBGPRINT(RT_DEBUG_TRACE, ("%s - Block Auth request durning WPA block period!\n", pSMName)); + pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; + Status = MLME_STATE_MACHINE_REJECT; + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); + } + else if(MlmeAuthReqSanity(pAd, pElem->Msg, pElem->MsgLen, Addr, &Timeout, &Alg)) + { + /* reset timer */ + RTMPCancelTimer(pAuthTimer, &TimerCancelled); + + COPY_MAC_ADDR(pAd->MlmeAux.Bssid, Addr); + pAd->MlmeAux.Alg = Alg; + Seq = SeqNo; + Status = MLME_SUCCESS; + + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + if(NStatus != NDIS_STATUS_SUCCESS) + { + DBGPRINT(RT_DEBUG_TRACE, ("%s - MlmeAuthReqAction(Alg:%d) allocate memory failed\n", pSMName, Alg)); + pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; + Status = MLME_FAIL_NO_RESOURCE; + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); + return FALSE; + } + + DBGPRINT(RT_DEBUG_TRACE, ("%s - Send AUTH request seq#1 (Alg=%d)...\n", pSMName, Alg)); + MgtMacHeaderInit(pAd, &AuthHdr, SUBTYPE_AUTH, 0, Addr, pAd->MlmeAux.Bssid); + MakeOutgoingFrame(pOutBuffer, &FrameLen, + sizeof(HEADER_802_11),&AuthHdr, + 2, &Alg, + 2, &Seq, + 2, &Status, + END_OF_ARGS); + + if (pNewElement && ElementLen) + { + MakeOutgoingFrame(pOutBuffer+FrameLen, &tmp, + ElementLen, pNewElement, + END_OF_ARGS); + FrameLen += tmp; + } + + MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); + MlmeFreeMemory(pAd, pOutBuffer); + + RTMPSetTimer(pAuthTimer, Timeout); + return TRUE; + } + else + { + DBGPRINT_ERR(("%s - MlmeAuthReqAction() sanity check failed\n", pSMName)); + return FALSE; + } + + return TRUE; +} + diff --git a/drivers/staging/rt2860/sta/auth_rsp.c b/drivers/staging/rt2860/sta/auth_rsp.c index cc639b1c6c13..0a5d28cea390 100644 --- a/drivers/staging/rt2860/sta/auth_rsp.c +++ b/drivers/staging/rt2860/sta/auth_rsp.c @@ -123,20 +123,24 @@ VOID PeerDeauthAction( if (PeerDeauthSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Reason)) { - if (INFRA_ON(pAd) && MAC_ADDR_EQUAL(Addr2, pAd->CommonCfg.Bssid)) + if (INFRA_ON(pAd) + && MAC_ADDR_EQUAL(Addr2, pAd->CommonCfg.Bssid) + ) { DBGPRINT(RT_DEBUG_TRACE,("AUTH_RSP - receive DE-AUTH from our AP (Reason=%d)\n", Reason)); - { - union iwreq_data wrqu; - memset(wrqu.ap_addr.sa_data, 0, MAC_ADDR_LEN); - wireless_send_event(pAd->net_dev, SIOCGIWAP, &wrqu, NULL); - } + + RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0); + // send wireless event - for deauthentication if (pAd->CommonCfg.bWirelessEvent) RTMPSendWirelessEvent(pAd, IW_DEAUTH_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); + if ((pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) && + (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2)) + pAd->StaCfg.bLostAp = TRUE; + LinkDown(pAd, TRUE); } } diff --git a/drivers/staging/rt2860/sta/connect.c b/drivers/staging/rt2860/sta/connect.c index 7bc75ab971f9..3852d044b66d 100644 --- a/drivers/staging/rt2860/sta/connect.c +++ b/drivers/staging/rt2860/sta/connect.c @@ -64,6 +64,7 @@ UCHAR CipherSuiteWpaNoneAesLen = (sizeof(CipherSuiteWpaNoneAes) / sizeof(UCHAR)) // and are copied to pAd->StaActive #define COPY_SETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(_pAd) \ { \ + NdisZeroMemory((_pAd)->CommonCfg.Ssid, MAX_LEN_OF_SSID); \ (_pAd)->CommonCfg.SsidLen = (_pAd)->MlmeAux.SsidLen; \ NdisMoveMemory((_pAd)->CommonCfg.Ssid, (_pAd)->MlmeAux.Ssid, (_pAd)->MlmeAux.SsidLen); \ COPY_MAC_ADDR((_pAd)->CommonCfg.Bssid, (_pAd)->MlmeAux.Bssid); \ @@ -123,9 +124,7 @@ VOID MlmeCntlMachinePerformAction( switch(pAd->Mlme.CntlMachine.CurrState) { case CNTL_IDLE: - { CntlIdleProc(pAd, Elem); - } break; case CNTL_WAIT_DISASSOC: CntlWaitDisassocProc(pAd, Elem); @@ -163,11 +162,7 @@ VOID MlmeCntlMachinePerformAction( // Resume TxRing after SCANING complete. We hope the out-of-service time // won't be too long to let upper layer time-out the waiting frames RTMPResumeMsduTransmission(pAd); - if (pAd->StaCfg.CCXReqType != MSRN_TYPE_UNUSED) - { - // Cisco scan request is finished, prepare beacon report - MlmeEnqueue(pAd, AIRONET_STATE_MACHINE, MT2_AIRONET_SCAN_DONE, 0, NULL); - } + pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; // @@ -188,7 +183,7 @@ VOID MlmeCntlMachinePerformAction( pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; } break; -#ifdef RT2870 +#ifdef RTMP_MAC_USB // // This state is for that we want to connect to an AP but // it didn't find on BSS List table. So we need to scan the air first, @@ -212,14 +207,14 @@ VOID MlmeCntlMachinePerformAction( // // Check if we can connect to. // - BssTableSsidSort(pAd, &pAd->MlmeAux.SsidBssTab, pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen); + BssTableSsidSort(pAd, &pAd->MlmeAux.SsidBssTab, (CHAR *) pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen); if (pAd->MlmeAux.SsidBssTab.BssNr > 0) { MlmeAutoReconnectLastSSID(pAd); } } break; -#endif // RT2870 // +#endif // RTMP_MAC_USB // default: DBGPRINT_ERR(("!ERROR! CNTL - Illegal message type(=%ld)", Elem->MsgType)); break; @@ -294,11 +289,13 @@ VOID CntlOidScanProc( ULONG BssIdx = BSS_NOT_FOUND; BSS_ENTRY CurrBss; + + // record current BSS if network is connected. // 2003-2-13 do not include current IBSS if this is the only STA in this IBSS. if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) { - BssIdx = BssSsidTableSearch(&pAd->ScanTab, pAd->CommonCfg.Bssid, pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen, pAd->CommonCfg.Channel); + BssIdx = BssSsidTableSearch(&pAd->ScanTab, pAd->CommonCfg.Bssid, (PUCHAR)pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen, pAd->CommonCfg.Channel); if (BssIdx != BSS_NOT_FOUND) { NdisMoveMemory(&CurrBss, &pAd->ScanTab.BssEntry[BssIdx], sizeof(BSS_ENTRY)); @@ -318,7 +315,7 @@ VOID CntlOidScanProc( pAd->ScanTab.BssNr = 1; } - ScanParmFill(pAd, &ScanReq, "", 0, BSS_ANY, SCAN_ACTIVE); + ScanParmFill(pAd, &ScanReq, (PSTRING) Elem->Msg, Elem->MsgLen, BSS_ANY, SCAN_ACTIVE); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; @@ -341,11 +338,6 @@ VOID CntlOidSsidProc( MLME_DISASSOC_REQ_STRUCT DisassocReq; ULONG Now; -#ifdef RT2860 - // BBP and RF are not accessible in PS mode, we has to wake them up first - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - AsicForceWakeup(pAd, RTMP_HALT); -#endif // Step 1. record the desired user settings to MlmeAux NdisZeroMemory(pAd->MlmeAux.Ssid, MAX_LEN_OF_SSID); @@ -354,6 +346,7 @@ VOID CntlOidSsidProc( NdisZeroMemory(pAd->MlmeAux.Bssid, MAC_ADDR_LEN); pAd->MlmeAux.BssType = pAd->StaCfg.BssType; + pAd->StaCfg.bAutoConnectByBssid = FALSE; // // Update Reconnect Ssid, that user desired to connect. @@ -364,7 +357,7 @@ VOID CntlOidSsidProc( // step 2. find all matching BSS in the lastest SCAN result (inBssTab) // & log them into MlmeAux.SsidBssTab for later-on iteration. Sort by RSSI order - BssTableSsidSort(pAd, &pAd->MlmeAux.SsidBssTab, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); + BssTableSsidSort(pAd, &pAd->MlmeAux.SsidBssTab, (PCHAR)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - %d BSS of %d BSS match the desire (%d)SSID - %s\n", pAd->MlmeAux.SsidBssTab.BssNr, pAd->ScanTab.BssNr, pAd->MlmeAux.SsidLen, pAd->MlmeAux.Ssid)); @@ -423,15 +416,7 @@ VOID CntlOidSsidProc( } pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - - { - union iwreq_data wrqu; - - memset(wrqu.ap_addr.sa_data, 0, MAC_ADDR_LEN); - memcpy(wrqu.ap_addr.sa_data, pAd->MlmeAux.Bssid, MAC_ADDR_LEN); - wireless_send_event(pAd->net_dev, SIOCGIWAP, &wrqu, NULL); - - } + RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, &pAd->MlmeAux.Bssid[0], NULL, 0); } } else if (INFRA_ON(pAd)) @@ -483,7 +468,7 @@ VOID CntlOidSsidProc( MLME_SCAN_REQ_STRUCT ScanReq; DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - No matching BSS, start a new scan\n")); - ScanParmFill(pAd, &ScanReq, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, BSS_ANY, SCAN_ACTIVE); + ScanParmFill(pAd, &ScanReq, (PSTRING) pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, BSS_ANY, SCAN_ACTIVE); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; // Reset Missed scan number @@ -519,52 +504,41 @@ VOID CntlOidRTBssidProc( COPY_MAC_ADDR(pAd->MlmeAux.Bssid, pOidBssid); pAd->MlmeAux.BssType = pAd->StaCfg.BssType; - // - // Update Reconnect Ssid, that user desired to connect. - // - NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, MAX_LEN_OF_SSID); - pAd->MlmeAux.AutoReconnectSsidLen = pAd->MlmeAux.SsidLen; - NdisMoveMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); - // find the desired BSS in the latest SCAN result table BssIdx = BssTableSearch(&pAd->ScanTab, pOidBssid, pAd->MlmeAux.Channel); if (BssIdx == BSS_NOT_FOUND) { + MLME_SCAN_REQ_STRUCT ScanReq; + DBGPRINT(RT_DEBUG_TRACE, ("CNTL - BSSID not found. reply NDIS_STATUS_NOT_ACCEPTED\n")); - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; + //pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; + + DBGPRINT(RT_DEBUG_TRACE, ("CNTL - BSSID not found. start a new scan\n")); + ScanParmFill(pAd, &ScanReq, (PSTRING) pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, BSS_ANY, SCAN_ACTIVE); + MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); + pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; + // Reset Missed scan number + NdisGetSystemUpTime(&pAd->StaCfg.LastScanTime); return; } + // + // Update Reconnect Ssid, that user desired to connect. + // + NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, MAX_LEN_OF_SSID); + pAd->MlmeAux.AutoReconnectSsidLen = pAd->ScanTab.BssEntry[BssIdx].SsidLen; + NdisMoveMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->ScanTab.BssEntry[BssIdx].Ssid, pAd->ScanTab.BssEntry[BssIdx].SsidLen); + // copy the matched BSS entry from ScanTab to MlmeAux.SsidBssTab. Why? // Because we need this entry to become the JOIN target in later on SYNC state machine pAd->MlmeAux.BssIdx = 0; pAd->MlmeAux.SsidBssTab.BssNr = 1; NdisMoveMemory(&pAd->MlmeAux.SsidBssTab.BssEntry[0], &pAd->ScanTab.BssEntry[BssIdx], sizeof(BSS_ENTRY)); - // 2002-11-26 skip the following checking. i.e. if user wants to re-connect to same AP - // we just follow normal procedure. The reason of user doing this may because he/she changed - // AP to another channel, but we still received BEACON from it thus don't claim Link Down. - // Since user knows he's changed AP channel, he'll re-connect again. By skipping the following - // checking, we'll disassociate then re-do normal association with this AP at the new channel. - // 2003-1-6 Re-enable this feature based on microsoft requirement which prefer not to re-do - // connection when setting the same BSSID. - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) && - MAC_ADDR_EQUAL(pAd->CommonCfg.Bssid, pOidBssid)) - { - // already connected to the same BSSID, go back to idle state directly - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - already in this BSSID. ignore this SET_BSSID request\n")); - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - - { - union iwreq_data wrqu; + // Add SSID into MlmeAux for site surey joining hidden SSID + pAd->MlmeAux.SsidLen = pAd->ScanTab.BssEntry[BssIdx].SsidLen; + NdisMoveMemory(pAd->MlmeAux.Ssid, pAd->ScanTab.BssEntry[BssIdx].Ssid, pAd->MlmeAux.SsidLen); - memset(wrqu.ap_addr.sa_data, 0, MAC_ADDR_LEN); - memcpy(wrqu.ap_addr.sa_data, pAd->MlmeAux.Bssid, MAC_ADDR_LEN); - wireless_send_event(pAd->net_dev, SIOCGIWAP, &wrqu, NULL); - - } - } - else { if (INFRA_ON(pAd)) { @@ -625,11 +599,11 @@ VOID CntlOidRTBssidProc( // Set Mix cipher flag pAd->StaCfg.bMixCipher = (pAd->StaCfg.PairCipher == pAd->StaCfg.GroupCipher) ? FALSE : TRUE; - if (pAd->StaCfg.bMixCipher == TRUE) + /*if (pAd->StaCfg.bMixCipher == TRUE) { // If mix cipher, re-build RSNIE RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, 0); - } + }*/ // No active association, join the BSS immediately DBGPRINT(RT_DEBUG_TRACE, ("CNTL - joining %02x:%02x:%02x:%02x:%02x:%02x ...\n", pOidBssid[0],pOidBssid[1],pOidBssid[2],pOidBssid[3],pOidBssid[4],pOidBssid[5])); @@ -654,19 +628,26 @@ VOID CntlMlmeRoamingProc( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem) { - // TODO: - // AP in different channel may show lower RSSI than actual value?? - // should we add a weighting factor to compensate it? + UCHAR BBPValue = 0; + DBGPRINT(RT_DEBUG_TRACE,("CNTL - Roaming in MlmeAux.RoamTab...\n")); + { + //Let BBP register at 20MHz to do (fast) roaming. + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); + BBPValue &= (~0x18); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); + NdisMoveMemory(&pAd->MlmeAux.SsidBssTab, &pAd->MlmeAux.RoamTab, sizeof(pAd->MlmeAux.RoamTab)); pAd->MlmeAux.SsidBssTab.BssNr = pAd->MlmeAux.RoamTab.BssNr; BssTableSortByRssi(&pAd->MlmeAux.SsidBssTab); pAd->MlmeAux.BssIdx = 0; IterateOnBssTab(pAd); + } } + /* ========================================================================== Description: @@ -696,7 +677,7 @@ VOID CntlWaitDisassocProc( if ((pAd->MlmeAux.SsidBssTab.BssNr==0) && (pAd->StaCfg.BssType == BSS_ADHOC)) { DBGPRINT(RT_DEBUG_TRACE, ("CNTL - No matching BSS, start a new ADHOC (Ssid=%s)...\n",pAd->MlmeAux.Ssid)); - StartParmFill(pAd, &StartReq, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); + StartParmFill(pAd, &StartReq, (PCHAR)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, sizeof(MLME_START_REQ_STRUCT), &StartReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_START; } @@ -763,15 +744,15 @@ VOID CntlWaitJoinProc( if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeShared) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeAutoSwitch)) { - AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, Ndis802_11AuthModeShared); + AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, AUTH_MODE_KEY); } else { - AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, Ndis802_11AuthModeOpen); - } + AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, AUTH_MODE_OPEN); } MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_MLME_AUTH_REQ, sizeof(MLME_AUTH_REQ_STRUCT), &AuthReq); + } pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_AUTH; } @@ -817,7 +798,7 @@ VOID CntlWaitStartProc( DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Channel=%d, Start adhoc on W53(52,56,60,64) Channels are not accepted\n", pAd->CommonCfg.Channel)); return; } - + NdisZeroMemory(&pAd->StaActive.SupportedPhyInfo.MCSSet[0], 16); if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) { N_ChannelCheck(pAd); @@ -825,7 +806,6 @@ VOID CntlWaitStartProc( NdisMoveMemory(&pAd->MlmeAux.AddHtInfo, &pAd->CommonCfg.AddHTInfo, sizeof(ADD_HT_INFO_IE)); RTMPCheckHt(pAd, BSSID_WCID, &pAd->CommonCfg.HtCapability, &pAd->CommonCfg.AddHTInfo); pAd->StaActive.SupportedPhyInfo.bHtEnable = TRUE; - NdisZeroMemory(&pAd->StaActive.SupportedPhyInfo.MCSSet[0], 16); NdisMoveMemory(&pAd->StaActive.SupportedPhyInfo.MCSSet[0], &pAd->CommonCfg.HtCapability.MCSSet[0], 16); COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(pAd); @@ -911,16 +891,16 @@ VOID CntlWaitAuthProc( (pAd->StaCfg.AuthMode == Ndis802_11AuthModeAutoSwitch)) { // either Ndis802_11AuthModeShared or Ndis802_11AuthModeAutoSwitch, try shared key first - AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, Ndis802_11AuthModeShared); + AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, AUTH_MODE_KEY); } else { - AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, Ndis802_11AuthModeOpen); - } + AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, AUTH_MODE_OPEN); } MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_MLME_AUTH_REQ, sizeof(MLME_AUTH_REQ_STRUCT), &AuthReq); + } pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_AUTH2; } } @@ -950,11 +930,13 @@ VOID CntlWaitAuthProc2( DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH OK\n")); AssocParmFill(pAd, &AssocReq, pAd->MlmeAux.Bssid, pAd->MlmeAux.CapabilityInfo, ASSOC_TIMEOUT, pAd->StaCfg.DefaultListenCount); + { MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_ASSOC_REQ, sizeof(MLME_ASSOC_REQ_STRUCT), &AssocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_ASSOC; } + } else { if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeAutoSwitch) && @@ -998,14 +980,14 @@ VOID CntlWaitAssocProc( NdisMoveMemory(&Reason, Elem->Msg, sizeof(USHORT)); if (Reason == MLME_SUCCESS) { - LinkUp(pAd, BSS_INFRA); - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Association successful on BSS #%ld\n",pAd->MlmeAux.BssIdx)); - if (pAd->CommonCfg.bWirelessEvent) { RTMPSendWirelessEvent(pAd, IW_ASSOC_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); } + + LinkUp(pAd, BSS_INFRA); + pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; + DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Association successful on BSS #%ld\n",pAd->MlmeAux.BssIdx)); } else { @@ -1036,15 +1018,16 @@ VOID CntlWaitReassocProc( NdisMoveMemory(&Result, Elem->Msg, sizeof(USHORT)); if (Result == MLME_SUCCESS) { + // send wireless event - for association + if (pAd->CommonCfg.bWirelessEvent) + RTMPSendWirelessEvent(pAd, IW_ASSOC_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); + + // // NDIS requires a new Link UP indication but no Link Down for RE-ASSOC // LinkUp(pAd, BSS_INFRA); - // send wireless event - for association - if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_ASSOC_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Re-assocition successful on BSS #%ld\n", pAd->MlmeAux.RoamIdx)); } @@ -1052,14 +1035,15 @@ VOID CntlWaitReassocProc( { // reassoc failed, try to pick next BSS in the BSS Table DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Re-assocition fails on BSS #%ld\n", pAd->MlmeAux.RoamIdx)); + { pAd->MlmeAux.RoamIdx++; IterateOnBssTab2(pAd); } } + } } -#ifdef RT2870 VOID AdhocTurnOnQos( IN PRTMP_ADAPTER pAd) { @@ -1094,7 +1078,6 @@ VOID AdhocTurnOnQos( } AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm); } -#endif /* RT2870 */ /* ========================================================================== @@ -1111,17 +1094,19 @@ VOID LinkUp( ULONG Now; UINT32 Data; BOOLEAN Cancelled; - UCHAR Value = 0, idx; - MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry; + UCHAR Value = 0, idx = 0, HashIdx = 0; + MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry = NULL; -#ifdef RT2860 - if (RTMP_TEST_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND)) + // Init ChannelQuality to prevent DEAD_CQI at initial LinkUp + pAd->Mlme.ChannelQuality = 50; + + pEntry = MacTableLookup(pAd, pAd->CommonCfg.Bssid); + if (pEntry) { - RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_HALT); - RTMPusecDelay(6000); - pAd->bPCIclkOff = FALSE; + MacTableDeleteEntry(pAd, pEntry->Aid, pEntry->Addr); + pEntry = NULL; } -#endif + pEntry = &pAd->MacTab.Content[BSSID_WCID]; @@ -1140,52 +1125,16 @@ VOID LinkUp( COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(pAd); - // It's quite difficult to tell if a newly added KEY is WEP or CKIP until a new BSS - // is formed (either ASSOC/RE-ASSOC done or IBSS started. LinkUP should be a safe place - // to examine if cipher algorithm switching is required. - //rt2860b. Don't know why need this - SwitchBetweenWepAndCkip(pAd); - -#ifdef RT2860 - // Before power save before link up function, We will force use 1R. - // So after link up, check Rx antenna # again. - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); - if(pAd->Antenna.field.RxPath == 3) - { - Value |= (0x10); - } - else if(pAd->Antenna.field.RxPath == 2) - { - Value |= (0x8); - } - else if(pAd->Antenna.field.RxPath == 1) - { - Value |= (0x0); - } - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); - pAd->StaCfg.BBPR3 = Value; -#endif /* RT2860 */ - if (BssType == BSS_ADHOC) { OPSTATUS_SET_FLAG(pAd, fOP_STATUS_ADHOC_ON); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_INFRA_ON); - if ((pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth == BW_40) && - (pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset == EXTCHA_ABOVE)) - { - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel + 2; - } - else if ((pAd->CommonCfg.Channel > 2) && - (pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth == BW_40) && - (pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset == EXTCHA_BELOW)) - { - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel - 2; - } -#ifdef RT2870 + if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) AdhocTurnOnQos(pAd); -#endif + + InitChannelRelatedValue(pAd); DBGPRINT(RT_DEBUG_TRACE, ("!!!Adhoc LINK UP !!! \n" )); } @@ -1197,6 +1146,7 @@ VOID LinkUp( DBGPRINT(RT_DEBUG_TRACE, ("!!!Infra LINK UP !!! \n" )); } +#if defined(RT2870) || defined(RT3070) // 3*3 // reset Tx beamforming bit RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value); @@ -1221,9 +1171,6 @@ VOID LinkUp( RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); Value &= (~0x20); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); -#ifdef RT2860 - pAd->StaCfg.BBPR3 = Value; -#endif RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data); Data &= 0xfffffffe; @@ -1258,9 +1205,6 @@ VOID LinkUp( RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); Value |= (0x20); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); -#ifdef RT2860 - pAd->StaCfg.BBPR3 = Value; -#endif if (pAd->MACVersion == 0x28600100) { @@ -1290,9 +1234,6 @@ VOID LinkUp( RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); Value &= (~0x20); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); -#ifdef RT2860 - pAd->StaCfg.BBPR3 = Value; -#endif if (pAd->MACVersion == 0x28600100) { @@ -1306,6 +1247,8 @@ VOID LinkUp( } RTMPSetAGCInitValue(pAd, pAd->CommonCfg.BBPCurrentBW); +#endif // RT2870 // + // // Save BBP_R66 value, it will be used in RTUSBResumeMsduTransmission // @@ -1467,25 +1410,23 @@ VOID LinkUp( // On WPA mode, Remove All Keys if not connect to the last BSSID // Key will be set after 4-way handshake. // - if ((pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA)) + if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) { ULONG IV; // Remove all WPA keys + RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); RTMPWPARemoveAllKeys(pAd); pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; pAd->StaCfg.PrivacyFilter = Ndis802_11PrivFilter8021xWEP; // Fixed connection failed with Range Maximizer - 515 AP (Marvell Chip) when security is WPAPSK/TKIP // If IV related values are too large in GroupMsg2, AP would ignore this message. - IV = 0; + IV = 1; IV |= (pAd->StaCfg.DefaultKeyId << 30); AsicUpdateWCIDIVEIV(pAd, BSSID_WCID, IV, 0); - -#ifdef RT2860 - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); -#endif } + // NOTE: // the decision of using "short slot time" or not may change dynamically due to // new STA association to the AP. so we have to decide that upon parsing BEACON, not here @@ -1502,28 +1443,6 @@ VOID LinkUp( // Add BSSID to WCID search table AsicUpdateRxWCIDTable(pAd, BSSID_WCID, pAd->CommonCfg.Bssid); - NdisAcquireSpinLock(&pAd->MacTabLock); - // add this BSSID entry into HASH table - { - UCHAR HashIdx; - - //pEntry = &pAd->MacTab.Content[BSSID_WCID]; - HashIdx = MAC_ADDR_HASH_INDEX(pAd->CommonCfg.Bssid); - if (pAd->MacTab.Hash[HashIdx] == NULL) - { - pAd->MacTab.Hash[HashIdx] = pEntry; - } - else - { - pCurrEntry = pAd->MacTab.Hash[HashIdx]; - while (pCurrEntry->pNext != NULL) - pCurrEntry = pCurrEntry->pNext; - pCurrEntry->pNext = pEntry; - } - } - NdisReleaseSpinLock(&pAd->MacTabLock); - - // If WEP is enabled, add paiewise and shared key if (((pAd->StaCfg.WpaSupplicantUP)&& (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled)&& @@ -1549,6 +1468,7 @@ VOID LinkUp( // Assign group key info RTMPAddWcidAttributeEntry(pAd, BSS0, idx, CipherAlg, NULL); + pEntry->Aid = BSSID_WCID; // Assign pairwise key info RTMPAddWcidAttributeEntry(pAd, BSS0, idx, CipherAlg, pEntry); } @@ -1565,26 +1485,55 @@ VOID LinkUp( { pAd->IndicateMediaState = NdisMediaStateConnected; pAd->ExtraInfo = GENERAL_LINK_UP; -#ifdef RT2870 RTMP_IndicateMediaState(pAd); -#endif + } + else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || + (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) + { + if (pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_DISABLE) + RTMPSetTimer(&pAd->Mlme.LinkDownTimer, LINK_DOWN_TIMEOUT); } // -- -#ifdef RT2860 - RTMP_IndicateMediaState(pAd); -#endif // Add BSSID in my MAC Table. NdisAcquireSpinLock(&pAd->MacTabLock); - RTMPMoveMemory(pAd->MacTab.Content[BSSID_WCID].Addr, pAd->CommonCfg.Bssid, MAC_ADDR_LEN); - pAd->MacTab.Content[BSSID_WCID].Aid = BSSID_WCID; - pAd->MacTab.Content[BSSID_WCID].pAd = pAd; - pAd->MacTab.Content[BSSID_WCID].ValidAsCLI = TRUE; //Although this is bssid..still set ValidAsCl + // add this MAC entry into HASH table + if (pEntry) + { + HashIdx = MAC_ADDR_HASH_INDEX(pAd->CommonCfg.Bssid); + if (pAd->MacTab.Hash[HashIdx] == NULL) + { + pAd->MacTab.Hash[HashIdx] = pEntry; + } + else + { + pCurrEntry = pAd->MacTab.Hash[HashIdx]; + while (pCurrEntry->pNext != NULL) + { + pCurrEntry = pCurrEntry->pNext; + } + pCurrEntry->pNext = pEntry; + } + } + RTMPMoveMemory(pEntry->Addr, pAd->CommonCfg.Bssid, MAC_ADDR_LEN); + pEntry->Aid = BSSID_WCID; + pEntry->pAd = pAd; + pEntry->ValidAsCLI = TRUE; //Although this is bssid..still set ValidAsCl pAd->MacTab.Size = 1; // infra mode always set MACtab size =1. - pAd->MacTab.Content[BSSID_WCID].Sst = SST_ASSOC; - pAd->MacTab.Content[BSSID_WCID].AuthState = SST_ASSOC; - pAd->MacTab.Content[BSSID_WCID].AuthMode = pAd->StaCfg.AuthMode; - pAd->MacTab.Content[BSSID_WCID].WepStatus = pAd->StaCfg.WepStatus; + pEntry->Sst = SST_ASSOC; + pEntry->AuthState = SST_ASSOC; + pEntry->AuthMode = pAd->StaCfg.AuthMode; + pEntry->WepStatus = pAd->StaCfg.WepStatus; + if (pEntry->AuthMode < Ndis802_11AuthModeWPA) + { + pEntry->WpaState = AS_NOTUSE; + pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; + } + else + { + pEntry->WpaState = AS_PTKSTART; + pEntry->PrivacyFilter = Ndis802_11PrivFilter8021xWEP; + } NdisReleaseSpinLock(&pAd->MacTabLock); DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK UP !!! ClientStatusFlags=%lx)\n", @@ -1598,32 +1547,34 @@ VOID LinkUp( { if ((pAd->CommonCfg.bPiggyBackCapable) && (pAd->MlmeAux.APRalinkIe & 0x00000003) == 3) { - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_PIGGYBACK_INUSED); OPSTATUS_SET_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); + CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_AGGREGATION_CAPABLE); + CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_PIGGYBACK_CAPABLE); RTMPSetPiggyBack(pAd, TRUE); DBGPRINT(RT_DEBUG_TRACE, ("Turn on Piggy-Back\n")); } else if (pAd->MlmeAux.APRalinkIe & 0x00000001) { OPSTATUS_SET_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); + CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_AGGREGATION_CAPABLE); + DBGPRINT(RT_DEBUG_TRACE, ("Ralink Aggregation\n")); } } if (pAd->MlmeAux.APRalinkIe != 0x0) { - if (CLIENT_STATUS_TEST_FLAG(&pAd->MacTab.Content[BSSID_WCID], fCLIENT_STATUS_RDG_CAPABLE)) + if (CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_RDG_CAPABLE)) { AsicEnableRDG(pAd); } - OPSTATUS_SET_FLAG(pAd, fCLIENT_STATUS_RALINK_CHIPSET); - CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[BSSID_WCID], fCLIENT_STATUS_RALINK_CHIPSET); + CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_RALINK_CHIPSET); } else { OPSTATUS_CLEAR_FLAG(pAd, fCLIENT_STATUS_RALINK_CHIPSET); - CLIENT_STATUS_CLEAR_FLAG(&pAd->MacTab.Content[BSSID_WCID], fCLIENT_STATUS_RALINK_CHIPSET); + CLIENT_STATUS_CLEAR_FLAG(pEntry, fCLIENT_STATUS_RALINK_CHIPSET); } } @@ -1707,8 +1658,8 @@ VOID LinkUp( // Txop can only be modified when RDG is off, WMM is disable and TxBurst is enable // // if 1. Legacy AP WMM on, or 2. 11n AP, AMPDU disable. Force turn off burst no matter what bEnableTxBurst is. - if ( - !(pAd->CommonCfg.RxStream == 1 && pAd->CommonCfg.TxStream == 1) && + if (!((pAd->CommonCfg.RxStream == 1)&&(pAd->CommonCfg.TxStream == 1)) && + (pAd->StaCfg.bForceTxBurst == FALSE) && (((pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED)) || ((pAd->StaActive.SupportedPhyInfo.bHtEnable == TRUE) && (pAd->CommonCfg.BACapability.field.Policy == BA_NOTUSE)))) { @@ -1770,9 +1721,16 @@ VOID LinkUp( if (pAd->StaCfg.WepStatus <= Ndis802_11WEPDisabled) { + if (pAd->StaCfg.WpaSupplicantUP && + (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled) && + (pAd->StaCfg.IEEE8021X == TRUE)) + ; + else + { pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; pAd->StaCfg.PrivacyFilter = Ndis802_11PrivFilterAcceptAll; } + } NdisAcquireSpinLock(&pAd->MacTabLock); pEntry->PortSecured = pAd->StaCfg.PortSecured; @@ -1792,9 +1750,23 @@ VOID LinkUp( } RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); -#ifdef RT2860 + RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_GO_TO_SLEEP_NOW); -#endif + +#ifdef RT2860 + /* + When AuthMode is WPA2-Enterprise and AP reboot or STA lost AP, + WpaSupplicant would not send EapolStart to AP after STA re-connect to AP again. + In this case, driver would send EapolStart to AP. + */ + if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) && + (NdisEqualMemory(pAd->CommonCfg.Bssid, pAd->CommonCfg.LastBssid, MAC_ADDR_LEN)) && + (pAd->StaCfg.bLostAp == TRUE)) + { + WpaSendEapolStart(pAd, pAd->CommonCfg.Bssid); + } +#endif // RT2860 // + pAd->StaCfg.bLostAp = FALSE; } /* @@ -1827,21 +1799,17 @@ VOID LinkDown( IN BOOLEAN IsReqFromAP) { UCHAR i, ByteValue = 0; -#ifdef RT2860 BOOLEAN Cancelled; -#endif // Do nothing if monitor mode is on if (MONITOR_ON(pAd)) return; -#ifdef RT2860 RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_GO_TO_SLEEP_NOW); - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - + //Comment the codes, beasue the line 2291 call the same function. + //RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); // Not allow go to sleep within linkdown function. RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); -#endif if (pAd->CommonCfg.bWirelessEvent) { @@ -1851,7 +1819,7 @@ VOID LinkDown( DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK DOWN !!!\n")); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); -#ifdef RT2860 +#ifdef RTMP_MAC_PCI if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) { BOOLEAN Cancelled; @@ -1859,16 +1827,20 @@ VOID LinkDown( RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); } - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) || - RTMP_TEST_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF)) + pAd->bPCIclkOff = FALSE; +#endif // RTMP_MAC_PCI // + + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) +|| RTMP_TEST_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND) + || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF)) { - AsicForceWakeup(pAd, RTMP_HALT); + AUTO_WAKEUP_STRUC AutoWakeupCfg; + AsicForceWakeup(pAd, TRUE); + AutoWakeupCfg.word = 0; + RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); } - pAd->bPCIclkOff = FALSE; -#endif if (ADHOC_ON(pAd)) // Adhoc mode link down { DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK DOWN 1!!!\n")); @@ -1917,34 +1889,22 @@ VOID LinkDown( // 3. short preamble OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_BG_PROTECTION_INUSED); - if (pAd->StaCfg.CCXAdjacentAPReportFlag == TRUE) - { - // - // Record current AP's information. - // for later used reporting Adjacent AP report. - // - pAd->StaCfg.CCXAdjacentAPChannel = pAd->CommonCfg.Channel; - pAd->StaCfg.CCXAdjacentAPSsidLen = pAd->CommonCfg.SsidLen; - NdisMoveMemory(pAd->StaCfg.CCXAdjacentAPSsid, pAd->CommonCfg.Ssid, pAd->StaCfg.CCXAdjacentAPSsidLen); - COPY_MAC_ADDR(pAd->StaCfg.CCXAdjacentAPBssid, pAd->CommonCfg.Bssid); - } + } + for (i=1; iMacTab.Content[i].ValidAsCLI == TRUE) MacTableDeleteEntry(pAd, pAd->MacTab.Content[i].Aid, pAd->MacTab.Content[i].Addr); } - pAd->StaCfg.CCXQosECWMin = 4; - pAd->StaCfg.CCXQosECWMax = 10; - AsicSetSlotTime(pAd, TRUE); //FALSE); AsicSetEdcaParm(pAd, NULL); // Set LED RTMPSetLED(pAd, LED_LINK_DOWN); - pAd->LedIndicatorStregth = 0xF0; + pAd->LedIndicatorStrength = 0xF0; RTMPSetSignalLED(pAd, -100); // Force signal strength Led to be turned off, firmware is not done it. AsicDisableSync(pAd); @@ -1971,8 +1931,8 @@ VOID LinkDown( pAd->StaCfg.WpaState = SS_START; // Clear Replay counter NdisZeroMemory(pAd->StaCfg.ReplayCounter, 8); - } + } // // if link down come from AP, we need to remove all WPA keys on WPA mode. @@ -2001,31 +1961,21 @@ VOID LinkDown( } NdisAcquireSpinLock(&pAd->MacTabLock); + NdisZeroMemory(&pAd->MacTab, sizeof(MAC_TABLE)); pAd->MacTab.Content[BSSID_WCID].PortSecured = pAd->StaCfg.PortSecured; NdisReleaseSpinLock(&pAd->MacTabLock); pAd->StaCfg.MicErrCnt = 0; - // Turn off Ckip control flag - pAd->StaCfg.bCkipOn = FALSE; - pAd->StaCfg.CCXEnable = FALSE; - pAd->IndicateMediaState = NdisMediaStateDisconnected; // Update extra information to link is up pAd->ExtraInfo = GENERAL_LINK_DOWN; -#ifdef RT2860 - pAd->StaCfg.AdhocBOnlyJoined = FALSE; - pAd->StaCfg.AdhocBGJoined = FALSE; - pAd->StaCfg.Adhoc20NJoined = FALSE; -#endif pAd->StaActive.SupportedPhyInfo.bHtEnable = FALSE; - // Reset the Current AP's IP address - NdisZeroMemory(pAd->StaCfg.AironetIPAddress, 4); -#ifdef RT2870 +#ifdef RTMP_MAC_USB pAd->bUsbTxBulkAggre = FALSE; -#endif // RT2870 // +#endif // RTMP_MAC_USB // // Clean association information NdisZeroMemory(&pAd->StaCfg.AssocInfo, sizeof(NDIS_802_11_ASSOCIATION_INFORMATION)); @@ -2081,30 +2031,18 @@ VOID LinkDown( RTMP_IO_WRITE32(pAd, MAX_LEN_CFG, 0x1fff); RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); -#ifdef RT2860 - // Allow go to sleep after linkdown steps. +// Allow go to sleep after linkdown steps. RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); -#endif - { - union iwreq_data wrqu; - memset(wrqu.ap_addr.sa_data, 0, MAC_ADDR_LEN); - wireless_send_event(pAd->net_dev, SIOCGIWAP, &wrqu, NULL); - } + RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0); - if (IS_RT3090(pAd)) +#ifdef RT30xx + if ((IS_RT30xx(pAd) || IS_RT3090(pAd)||IS_RT3390(pAd)) + &&(pAd->Antenna.field.RxPath>1||pAd->Antenna.field.TxPath>1)) { - UINT32 macdata; - // disable MMPS BBP control register - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &ByteValue); - ByteValue &= ~(0x04); //bit 2 - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, ByteValue); - - // disable MMPS MAC control register - RTMP_IO_READ32(pAd, 0x1210, &macdata); - macdata &= ~(0x09); //bit 0, 3 - RTMP_IO_WRITE32(pAd, 0x1210, macdata); + RTMP_ASIC_MMPS_DISABLE(pAd); } +#endif // RT30xx // } /* @@ -2161,11 +2099,11 @@ VOID IterateOnBssTab( // Set Mix cipher flag pAd->StaCfg.bMixCipher = (pAd->StaCfg.PairCipher == pAd->StaCfg.GroupCipher) ? FALSE : TRUE; - if (pAd->StaCfg.bMixCipher == TRUE) + /*if (pAd->StaCfg.bMixCipher == TRUE) { // If mix cipher, re-build RSNIE RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, 0); - } + }*/ DBGPRINT(RT_DEBUG_TRACE, ("CNTL - iterate BSS %ld of %d\n", BssIdx, pAd->MlmeAux.SsidBssTab.BssNr)); JoinParmFill(pAd, &JoinReq, BssIdx); @@ -2176,15 +2114,19 @@ VOID IterateOnBssTab( else if (pAd->StaCfg.BssType == BSS_ADHOC) { DBGPRINT(RT_DEBUG_TRACE, ("CNTL - All BSS fail; start a new ADHOC (Ssid=%s)...\n",pAd->MlmeAux.Ssid)); - StartParmFill(pAd, &StartReq, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); + StartParmFill(pAd, &StartReq, (PCHAR)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, sizeof(MLME_START_REQ_STRUCT), &StartReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_START; } else // no more BSS { - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - All roaming failed, stay @ ch #%d\n", pAd->CommonCfg.Channel)); + + { AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.Channel); + DBGPRINT(RT_DEBUG_TRACE, ("CNTL - All roaming failed, restore to channel %d, Total BSS[%02d]\n",pAd->CommonCfg.Channel, pAd->ScanTab.BssNr)); + } + pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; } } @@ -2218,9 +2160,13 @@ VOID IterateOnBssTab2( } else // no more BSS { - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - All fast roaming failed, back to ch #%d\n",pAd->CommonCfg.Channel)); + + { AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.Channel); + DBGPRINT(RT_DEBUG_TRACE, ("CNTL - All roaming failed, restore to channel %d, Total BSS[%02d]\n",pAd->CommonCfg.Channel, pAd->ScanTab.BssNr)); + } + pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; } } @@ -2252,7 +2198,7 @@ VOID JoinParmFill( VOID ScanParmFill( IN PRTMP_ADAPTER pAd, IN OUT MLME_SCAN_REQ_STRUCT *ScanReq, - IN CHAR Ssid[], + IN STRING Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN UCHAR ScanType) @@ -2310,10 +2256,32 @@ VOID AuthParmFill( ========================================================================== */ +#ifdef RTMP_MAC_PCI +VOID ComposePsPoll( + IN PRTMP_ADAPTER pAd) +{ + NdisZeroMemory(&pAd->PsPollFrame, sizeof(PSPOLL_FRAME)); + pAd->PsPollFrame.FC.Type = BTYPE_CNTL; + pAd->PsPollFrame.FC.SubType = SUBTYPE_PS_POLL; + pAd->PsPollFrame.Aid = pAd->StaActive.Aid | 0xC000; + COPY_MAC_ADDR(pAd->PsPollFrame.Bssid, pAd->CommonCfg.Bssid); + COPY_MAC_ADDR(pAd->PsPollFrame.Ta, pAd->CurrentAddress); +} - -#ifdef RT2870 - +// IRQL = DISPATCH_LEVEL +VOID ComposeNullFrame( + IN PRTMP_ADAPTER pAd) +{ + NdisZeroMemory(&pAd->NullFrame, sizeof(HEADER_802_11)); + pAd->NullFrame.FC.Type = BTYPE_DATA; + pAd->NullFrame.FC.SubType = SUBTYPE_NULL_FUNC; + pAd->NullFrame.FC.ToDs = 1; + COPY_MAC_ADDR(pAd->NullFrame.Addr1, pAd->CommonCfg.Bssid); + COPY_MAC_ADDR(pAd->NullFrame.Addr2, pAd->CurrentAddress); + COPY_MAC_ADDR(pAd->NullFrame.Addr3, pAd->CommonCfg.Bssid); +} +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB VOID MlmeCntlConfirm( IN PRTMP_ADAPTER pAd, IN ULONG MsgType, @@ -2321,29 +2289,23 @@ VOID MlmeCntlConfirm( { MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MsgType, sizeof(USHORT), &Msg); } -#endif VOID ComposePsPoll( IN PRTMP_ADAPTER pAd) { -#ifdef RT2870 PTXINFO_STRUC pTxInfo; PTXWI_STRUC pTxWI; DBGPRINT(RT_DEBUG_TRACE, ("ComposePsPoll\n")); -#endif NdisZeroMemory(&pAd->PsPollFrame, sizeof(PSPOLL_FRAME)); -#ifdef RT2870 pAd->PsPollFrame.FC.PwrMgmt = 0; -#endif pAd->PsPollFrame.FC.Type = BTYPE_CNTL; pAd->PsPollFrame.FC.SubType = SUBTYPE_PS_POLL; pAd->PsPollFrame.Aid = pAd->StaActive.Aid | 0xC000; COPY_MAC_ADDR(pAd->PsPollFrame.Bssid, pAd->CommonCfg.Bssid); COPY_MAC_ADDR(pAd->PsPollFrame.Ta, pAd->CurrentAddress); -#ifdef RT2870 RTMPZeroMemory(&pAd->PsPollContext.TransferBuffer->field.WirelessPacket[0], 100); pTxInfo = (PTXINFO_STRUC)&pAd->PsPollContext.TransferBuffer->field.WirelessPacket[0]; RTMPWriteTxInfo(pAd, pTxInfo, (USHORT)(sizeof(PSPOLL_FRAME)+TXWI_SIZE), TRUE, EpToQueue[MGMTPIPEIDX], FALSE, FALSE); @@ -2353,17 +2315,14 @@ VOID ComposePsPoll( RTMPMoveMemory(&pAd->PsPollContext.TransferBuffer->field.WirelessPacket[TXWI_SIZE+TXINFO_SIZE], &pAd->PsPollFrame, sizeof(PSPOLL_FRAME)); // Append 4 extra zero bytes. pAd->PsPollContext.BulkOutSize = TXINFO_SIZE + TXWI_SIZE + sizeof(PSPOLL_FRAME) + 4; -#endif } // IRQL = DISPATCH_LEVEL VOID ComposeNullFrame( IN PRTMP_ADAPTER pAd) { -#ifdef RT2870 PTXINFO_STRUC pTxInfo; PTXWI_STRUC pTxWI; -#endif NdisZeroMemory(&pAd->NullFrame, sizeof(HEADER_802_11)); pAd->NullFrame.FC.Type = BTYPE_DATA; @@ -2372,7 +2331,6 @@ VOID ComposeNullFrame( COPY_MAC_ADDR(pAd->NullFrame.Addr1, pAd->CommonCfg.Bssid); COPY_MAC_ADDR(pAd->NullFrame.Addr2, pAd->CurrentAddress); COPY_MAC_ADDR(pAd->NullFrame.Addr3, pAd->CommonCfg.Bssid); -#ifdef RT2870 RTMPZeroMemory(&pAd->NullContext.TransferBuffer->field.WirelessPacket[0], 100); pTxInfo = (PTXINFO_STRUC)&pAd->NullContext.TransferBuffer->field.WirelessPacket[0]; RTMPWriteTxInfo(pAd, pTxInfo, (USHORT)(sizeof(HEADER_802_11)+TXWI_SIZE), TRUE, EpToQueue[MGMTPIPEIDX], FALSE, FALSE); @@ -2381,11 +2339,8 @@ VOID ComposeNullFrame( 0, 0, (UCHAR)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); RTMPMoveMemory(&pAd->NullContext.TransferBuffer->field.WirelessPacket[TXWI_SIZE+TXINFO_SIZE], &pAd->NullFrame, sizeof(HEADER_802_11)); pAd->NullContext.BulkOutSize = TXINFO_SIZE + TXWI_SIZE + sizeof(pAd->NullFrame) + 4; -#endif } - - - +#endif // RTMP_MAC_USB // /* ========================================================================== @@ -2407,7 +2362,7 @@ ULONG MakeIbssBeacon( LARGE_INTEGER FakeTimestamp; ULONG FrameLen = 0; PTXWI_STRUC pTxWI = &pAd->BeaconTxWI; - CHAR *pBeaconFrame = pAd->BeaconBuf; + UCHAR *pBeaconFrame = pAd->BeaconBuf; BOOLEAN Privacy; UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; UCHAR SupRateLen = 0; @@ -2566,4 +2521,138 @@ ULONG MakeIbssBeacon( return FrameLen; } +VOID InitChannelRelatedValue( + IN PRTMP_ADAPTER pAd) +{ +#ifdef RT2860 + UCHAR Value = 0; + UINT32 Data = 0; + +#ifdef RTMP_MAC_PCI + // In power save , We will force use 1R. + // So after link up, check Rx antenna # again. + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); + if(pAd->Antenna.field.RxPath == 3) + { + Value |= (0x10); + } + else if(pAd->Antenna.field.RxPath == 2) + { + Value |= (0x8); + } + else if(pAd->Antenna.field.RxPath == 1) + { + Value |= (0x0); + } + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); + pAd->StaCfg.BBPR3 = Value; +#endif // RTMP_MAC_PCI // + + pAd->CommonCfg.CentralChannel = pAd->MlmeAux.CentralChannel; + pAd->CommonCfg.Channel = pAd->MlmeAux.Channel; + // Change to AP channel + if ((pAd->CommonCfg.CentralChannel > pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) + { + // Must using 40MHz. + pAd->CommonCfg.BBPCurrentBW = BW_40; + AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); + AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); + + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value); + Value &= (~0x18); + Value |= 0x10; + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value); + + // RX : control channel at lower + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); + Value &= (~0x20); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); +#ifdef RTMP_MAC_PCI + pAd->StaCfg.BBPR3 = Value; +#endif // RTMP_MAC_PCI // + + RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data); + Data &= 0xfffffffe; + RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Data); + + if (pAd->MACVersion == 0x28600100) + { + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x1A); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x0A); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x16); + DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" )); + } + + DBGPRINT(RT_DEBUG_TRACE, ("!!!40MHz Lower !!! Control Channel at Below. Central = %d \n", pAd->CommonCfg.CentralChannel )); + } + else if ((pAd->CommonCfg.CentralChannel < pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) + { + // Must using 40MHz. + pAd->CommonCfg.BBPCurrentBW = BW_40; + AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); + AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); + + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value); + Value &= (~0x18); + Value |= 0x10; + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value); + + RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data); + Data |= 0x1; + RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Data); + + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); + Value |= (0x20); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); +#ifdef RTMP_MAC_PCI + pAd->StaCfg.BBPR3 = Value; +#endif // RTMP_MAC_PCI // + + if (pAd->MACVersion == 0x28600100) + { + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x1A); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x0A); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x16); + DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" )); + } + + DBGPRINT(RT_DEBUG_TRACE, ("!!! 40MHz Upper !!! Control Channel at UpperCentral = %d \n", pAd->CommonCfg.CentralChannel )); + } + else + { + pAd->CommonCfg.BBPCurrentBW = BW_20; + pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; + AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); + AsicLockChannel(pAd, pAd->CommonCfg.Channel); + + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value); + Value &= (~0x18); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value); + + RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data); + Data &= 0xfffffffe; + RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Data); + + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); + Value &= (~0x20); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); +#ifdef RTMP_MAC_PCI + pAd->StaCfg.BBPR3 = Value; +#endif // RTMP_MAC_PCI // + + if (pAd->MACVersion == 0x28600100) + { + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x16); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x08); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x11); + DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" )); + } + + DBGPRINT(RT_DEBUG_TRACE, ("!!! 20MHz !!! \n" )); + } + + RTMPSetAGCInitValue(pAd, pAd->CommonCfg.BBPCurrentBW); +#endif // RT2860 // +} + diff --git a/drivers/staging/rt2860/sta/rtmp_data.c b/drivers/staging/rt2860/sta/rtmp_data.c index f751ab61c438..6a8ffdee827f 100644 --- a/drivers/staging/rt2860/sta/rtmp_data.c +++ b/drivers/staging/rt2860/sta/rtmp_data.c @@ -33,8 +33,6 @@ Revision History: Who When What -------- ---------- ---------------------------------------------- - John Aug/17/04 major modification for RT2561/2661 - Jan Lee Mar/17/06 major modification for RT2860 New Ring Design */ #include "../rt_config.h" @@ -64,6 +62,7 @@ VOID STARxEAPOLFrameIndicate( int idx = 0; DBGPRINT_RAW(RT_DEBUG_TRACE, ("Receive EAP-SUCCESS Packet\n")); + //pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; STA_PORT_SECURED(pAd); if (pAd->StaCfg.IEEE8021x_required_keys == FALSE) @@ -74,7 +73,7 @@ VOID STARxEAPOLFrameIndicate( if (pAd->StaCfg.DesireSharedKey[idx].KeyLen > 0) { -#ifdef RT2860 +#ifdef RTMP_MAC_PCI MAC_TABLE_ENTRY *pEntry = &pAd->MacTab.Content[BSSID_WCID]; // Set key material and cipherAlg to Asic @@ -88,8 +87,8 @@ VOID STARxEAPOLFrameIndicate( pAd->IndicateMediaState = NdisMediaStateConnected; pAd->ExtraInfo = GENERAL_LINK_UP; -#endif -#ifdef RT2870 +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB union { char buf[sizeof(NDIS_802_11_WEP)+MAX_LEN_OF_KEY- 1]; @@ -113,7 +112,7 @@ VOID STARxEAPOLFrameIndicate( pAd->ExtraInfo = GENERAL_LINK_UP; // need to enqueue cmd to thread RTUSBEnqueueCmdFromNdis(pAd, OID_802_11_ADD_WEP, TRUE, &WepKey, sizeof(WepKey.keyinfo) + len - 1); -#endif // RT2870 // +#endif // RTMP_MAC_USB // // For Preventing ShardKey Table is cleared by remove key procedure. pAd->SharedKey[BSS0][idx].CipherAlg = CipherAlg; pAd->SharedKey[BSS0][idx].KeyLen = pAd->StaCfg.DesireSharedKey[idx].KeyLen; @@ -156,6 +155,7 @@ VOID STARxDataFrameAnnounce( // non-EAP frame if (!RTMPCheckWPAframe(pAd, pEntry, pRxBlk->pData, pRxBlk->DataSize, FromWhichBSSID)) { + { // drop all non-EAP DATA frame before // this client's Port-Access-Control is secured @@ -309,13 +309,13 @@ VOID STAHandleRxDataFrame( if (pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable && (pHeader->FC.SubType & 0x08)) { UCHAR *pData; - DBGPRINT(RT_DEBUG_TRACE,("bAPSDCapable\n")); + DBGPRINT(RT_DEBUG_INFO,("bAPSDCapable\n")); // Qos bit 4 pData = (PUCHAR)pHeader + LENGTH_802_11; if ((*pData >> 4) & 0x01) { - DBGPRINT(RT_DEBUG_TRACE,("RxDone- Rcv EOSP frame, driver may fall into sleep\n")); + DBGPRINT(RT_DEBUG_INFO,("RxDone- Rcv EOSP frame, driver may fall into sleep\n")); pAd->CommonCfg.bInServicePeriod = FALSE; // Force driver to fall into sleep mode when rcv EOSP frame @@ -332,7 +332,7 @@ VOID STAHandleRxDataFrame( if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM) && (TbttNumToNextWakeUp > NextDtim)) TbttNumToNextWakeUp = NextDtim; - MlmeSetPsmBit(pAd, PWR_SAVE); + RTMP_SET_PSM_BIT(pAd, PWR_SAVE); // if WMM-APSD is failed, try to disable following line AsicSleepThenAutoWakeup(pAd, TbttNumToNextWakeUp); } @@ -442,6 +442,23 @@ VOID STAHandleRxDataFrame( } pRxBlk->UserPriority = UserPriority; + /* check if need to resend PS Poll when received packet with MoreData = 1 */ + if ((pAd->StaCfg.Psm == PWR_SAVE) && (pHeader->FC.MoreData == 1)) + { + if ((((UserPriority == 0) || (UserPriority == 3)) && + pAd->CommonCfg.bAPSDAC_BE == 0) || + (((UserPriority == 1) || (UserPriority == 2)) && + pAd->CommonCfg.bAPSDAC_BK == 0) || + (((UserPriority == 4) || (UserPriority == 5)) && + pAd->CommonCfg.bAPSDAC_VI == 0) || + (((UserPriority == 6) || (UserPriority == 7)) && + pAd->CommonCfg.bAPSDAC_VO == 0)) + { + /* non-UAPSD delivery-enabled AC */ + RTMP_PS_POLL_ENQUEUE(pAd); + } + } + // 3. Order bit: A-Ralink or HTC+ if (pHeader->FC.Order) { @@ -451,7 +468,7 @@ VOID STAHandleRxDataFrame( RX_BLK_SET_FLAG(pRxBlk, fRX_ARALINK); } else -#endif +#endif // AGGREGATION_SUPPORT // { RX_BLK_SET_FLAG(pRxBlk, fRX_HTC); // skip HTC contorl field @@ -574,27 +591,31 @@ VOID STAHandleRxMgmtFrame( do { + + /* check if need to resend PS Poll when received packet with MoreData = 1 */ + if ((pAd->StaCfg.Psm == PWR_SAVE) && (pHeader->FC.MoreData == 1)) + { + /* for UAPSD, all management frames will be VO priority */ + if (pAd->CommonCfg.bAPSDAC_VO == 0) + { + /* non-UAPSD delivery-enabled AC */ + RTMP_PS_POLL_ENQUEUE(pAd); + } + } + + /* TODO: if MoreData == 0, station can go to sleep */ + + // We should collect RSSI not only U2M data but also my beacon - if (pAd->RxAnt.EvaluatePeriod == 0 && - pHeader->FC.SubType == SUBTYPE_BEACON && - MAC_ADDR_EQUAL(&pAd->CommonCfg.Bssid, &pHeader->Addr2)) { + if ((pHeader->FC.SubType == SUBTYPE_BEACON) && (MAC_ADDR_EQUAL(&pAd->CommonCfg.Bssid, &pHeader->Addr2)) + && (pAd->RxAnt.EvaluatePeriod == 0)) + { Update_Rssi_Sample(pAd, &pAd->StaCfg.RssiSample, pRxWI); pAd->StaCfg.LastSNR0 = (UCHAR)(pRxWI->SNR0); pAd->StaCfg.LastSNR1 = (UCHAR)(pRxWI->SNR1); } -#ifdef RT2870 - // collect rssi information for antenna diversity - if (pAd->NicConfig2.field.AntDiversity) - { - if ((pRxD->U2M) || ((pHeader->FC.SubType == SUBTYPE_BEACON) && (MAC_ADDR_EQUAL(&pAd->CommonCfg.Bssid, &pHeader->Addr2)))) - { - COLLECT_RX_ANTENNA_AVERAGE_RSSI(pAd, ConvertToRssi(pAd, (UCHAR)pRxWI->RSSI0, RSSI_0), 0); //Note: RSSI2 not used on RT73 - pAd->StaCfg.NumOfAvgRssiSample ++; - } - } -#endif // First check the size, it MUST not exceed the mlme queue size if (pRxWI->MPDUtotalByteCount > MGMT_DMA_BUFFER_SIZE) @@ -683,14 +704,14 @@ BOOLEAN STARxDoneInterruptHandle( break; } -#ifdef RT2860 +#ifdef RTMP_MAC_PCI if (RxProcessed++ > MAX_RX_PROCESS_CNT) { // need to reschedule rx handle bReschedule = TRUE; break; } -#endif +#endif // RTMP_MAC_PCI // RxProcessed ++; // test @@ -725,6 +746,7 @@ BOOLEAN STARxDoneInterruptHandle( // Increase Total receive byte counter after real data received no mater any error or not pAd->RalinkCounters.ReceivedByteCount += pRxWI->MPDUtotalByteCount; + pAd->RalinkCounters.OneSecReceivedByteCount += pRxWI->MPDUtotalByteCount; pAd->RalinkCounters.RxCount ++; INC_COUNTER64(pAd->WlanCounters.ReceivedFragmentCount); @@ -737,7 +759,8 @@ BOOLEAN STARxDoneInterruptHandle( send_monitor_packets(pAd, &RxCell); break; } - /* RT2870 invokes STARxDoneInterruptHandle() in rtusb_bulk.c */ + + /* STARxDoneInterruptHandle() is called in rtusb_bulk.c */ // Check for all RxD errors Status = RTMPCheckRxError(pAd, pHeader, pRxWI, pRxD); @@ -780,15 +803,6 @@ BOOLEAN STARxDoneInterruptHandle( } } -#ifdef RT2860 - // fRTMP_PS_GO_TO_SLEEP_NOW is set if receiving beacon. - if (RTMP_TEST_PSFLAG(pAd, fRTMP_PS_GO_TO_SLEEP_NOW) && (INFRA_ON(pAd))) - { - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_GO_TO_SLEEP_NOW); - AsicSleepThenAutoWakeup(pAd, pAd->ThisTbttNumToNextWakeUp); - bReschedule = FALSE; - } -#endif return bReschedule; } @@ -806,12 +820,7 @@ BOOLEAN STARxDoneInterruptHandle( VOID RTMPHandleTwakeupInterrupt( IN PRTMP_ADAPTER pAd) { -#ifdef RT2860 - AsicForceWakeup(pAd, DOT11POWERSAVE); -#endif -#ifdef RT2870 AsicForceWakeup(pAd, FALSE); -#endif } /* @@ -914,6 +923,7 @@ NDIS_STATUS STASendPacket( UINT SrcBufLen; UINT AllowFragSize; UCHAR NumberOfFrag; + UCHAR RTSRequired; UCHAR QueIdx, UserPriority; MAC_TABLE_ENTRY *pEntry = NULL; unsigned int IrqFlags; @@ -1052,7 +1062,14 @@ NDIS_STATUS STASendPacket( // If multiple fragment required, RTS is required only for the first fragment // if the fragment size large than RTS threshold // For RT28xx, Let ASIC send RTS/CTS - RTMP_SET_PACKET_RTS(pPacket, 0); +// RTMP_SET_PACKET_RTS(pPacket, 0); + if (NumberOfFrag > 1) + RTSRequired = (pAd->CommonCfg.FragmentThreshold > pAd->CommonCfg.RtsThreshold) ? 1 : 0; + else + RTSRequired = (PacketInfo.TotalPacketLength > pAd->CommonCfg.RtsThreshold) ? 1 : 0; + + // Save RTS requirement to Ndis packet reserved field + RTMP_SET_PACKET_RTS(pPacket, RTSRequired); RTMP_SET_PACKET_TXRATE(pPacket, pAd->CommonCfg.TxRate); // @@ -1060,13 +1077,8 @@ NDIS_STATUS STASendPacket( // UserPriority = 0; QueIdx = QID_AC_BE; -#ifdef RT2860 - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED)) -#endif -#ifdef RT2870 if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_WMM_CAPABLE)) -#endif { USHORT Protocol; UCHAR LlcSnapLen = 0, Byte0, Byte1; @@ -1102,6 +1114,11 @@ NDIS_STATUS STASendPacket( // TODO: have to check ACM bit. apply TSPEC if ACM is ON // TODO: downgrade UP & QueIdx before passing ACM + /* + Under WMM ACM control, we dont need to check the bit; + Or when a TSPEC is built for VO but we will change to issue + BA session for BE here, so we will not use BA to send VO packets. + */ if (pAd->CommonCfg.APEdcaParm.bACM[QueIdx]) { UserPriority = 0; @@ -1125,18 +1142,14 @@ NDIS_STATUS STASendPacket( } else { - InsertTailQueue(&pAd->TxSwQueue[QueIdx], PACKET_TO_QUEUE_ENTRY(pPacket)); + InsertTailQueueAc(pAd, pEntry, &pAd->TxSwQueue[QueIdx], PACKET_TO_QUEUE_ENTRY(pPacket)); } RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); if ((pAd->CommonCfg.BACapability.field.AutoBA == TRUE)&& -#ifdef RT2860 - (pAd->StaActive.SupportedPhyInfo.bHtEnable == TRUE)) -#endif -#ifdef RT2870 IS_HT_STA(pEntry)) -#endif { + //PMAC_TABLE_ENTRY pMacEntry = &pAd->MacTab.Content[BSSID_WCID]; if (((pEntry->TXBAbitmap & (1<BADeclineBitmap & (1<PortSecured == WPA_802_1X_PORT_SECURED) @@ -1145,10 +1158,10 @@ NDIS_STATUS STASendPacket( // 2. It is OPEN or AES mode, // then BA session can be bulit. && ((pEntry->ValidAsCLI && pAd->MlmeAux.APRalinkIe != 0x0) || - (pEntry->WepStatus == Ndis802_11WEPDisabled || pEntry->WepStatus == Ndis802_11Encryption3Enabled)) + (pEntry->WepStatus != Ndis802_11WEPEnabled && pEntry->WepStatus != Ndis802_11Encryption2Enabled)) ) { - BAOriSessionSetUp(pAd, pEntry, 0, 0, 10, FALSE); + BAOriSessionSetUp(pAd, pEntry, UserPriority, 0, 10, FALSE); } } @@ -1179,27 +1192,15 @@ NDIS_STATUS STASendPacket( ======================================================================== */ - -#ifdef RT2870 -/* - Actually, this function used to check if the TxHardware Queue still has frame need to send. - If no frame need to send, go to sleep, else, still wake up. -*/ -#endif +#ifdef RTMP_MAC_PCI NDIS_STATUS RTMPFreeTXDRequest( IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx, IN UCHAR NumberRequired, IN PUCHAR FreeNumberIs) { -#ifdef RT2860 ULONG FreeNumber = 0; -#endif NDIS_STATUS Status = NDIS_STATUS_FAILURE; -#ifdef RT2870 - unsigned long IrqFlags; - HT_TX_CONTEXT *pHTTXContext; -#endif switch (QueIdx) { @@ -1208,7 +1209,6 @@ NDIS_STATUS RTMPFreeTXDRequest( case QID_AC_VI: case QID_AC_VO: case QID_HCCA: -#ifdef RT2860 if (pAd->TxRing[QueIdx].TxSwFreeIdx > pAd->TxRing[QueIdx].TxCpuIdx) FreeNumber = pAd->TxRing[QueIdx].TxSwFreeIdx - pAd->TxRing[QueIdx].TxCpuIdx - 1; else @@ -1216,8 +1216,49 @@ NDIS_STATUS RTMPFreeTXDRequest( if (FreeNumber >= NumberRequired) Status = NDIS_STATUS_SUCCESS; -#endif -#ifdef RT2870 + break; + + case QID_MGMT: + if (pAd->MgmtRing.TxSwFreeIdx > pAd->MgmtRing.TxCpuIdx) + FreeNumber = pAd->MgmtRing.TxSwFreeIdx - pAd->MgmtRing.TxCpuIdx - 1; + else + FreeNumber = pAd->MgmtRing.TxSwFreeIdx + MGMT_RING_SIZE - pAd->MgmtRing.TxCpuIdx - 1; + + if (FreeNumber >= NumberRequired) + Status = NDIS_STATUS_SUCCESS; + break; + + default: + DBGPRINT(RT_DEBUG_ERROR,("RTMPFreeTXDRequest::Invalid QueIdx(=%d)\n", QueIdx)); + break; + } + *FreeNumberIs = (UCHAR)FreeNumber; + + return (Status); +} +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB +/* + Actually, this function used to check if the TxHardware Queue still has frame need to send. + If no frame need to send, go to sleep, else, still wake up. +*/ +NDIS_STATUS RTMPFreeTXDRequest( + IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, + IN UCHAR NumberRequired, + IN PUCHAR FreeNumberIs) +{ + //ULONG FreeNumber = 0; + NDIS_STATUS Status = NDIS_STATUS_FAILURE; + unsigned long IrqFlags; + HT_TX_CONTEXT *pHTTXContext; + + switch (QueIdx) + { + case QID_AC_BK: + case QID_AC_BE: + case QID_AC_VI: + case QID_AC_VO: { pHTTXContext = &pAd->TxContext[QueIdx]; RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); @@ -1232,39 +1273,21 @@ NDIS_STATUS RTMPFreeTXDRequest( } RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); } -#endif break; - case QID_MGMT: -#ifdef RT2860 - if (pAd->MgmtRing.TxSwFreeIdx > pAd->MgmtRing.TxCpuIdx) - FreeNumber = pAd->MgmtRing.TxSwFreeIdx - pAd->MgmtRing.TxCpuIdx - 1; - else - FreeNumber = pAd->MgmtRing.TxSwFreeIdx + MGMT_RING_SIZE - pAd->MgmtRing.TxCpuIdx - 1; - - if (FreeNumber >= NumberRequired) - Status = NDIS_STATUS_SUCCESS; -#endif -#ifdef RT2870 if (pAd->MgmtRing.TxSwFreeIdx != MGMT_RING_SIZE) Status = NDIS_STATUS_FAILURE; else Status = NDIS_STATUS_SUCCESS; -#endif break; - default: DBGPRINT(RT_DEBUG_ERROR,("RTMPFreeTXDRequest::Invalid QueIdx(=%d)\n", QueIdx)); break; } -#ifdef RT2860 - *FreeNumberIs = (UCHAR)FreeNumber; -#endif return (Status); } - - +#endif // RTMP_MAC_USB // VOID RTMPSendDisassociationFrame( IN PRTMP_ADAPTER pAd) @@ -1527,6 +1550,9 @@ VOID STABuildCache802_11Header( pMacEntry->TxSeq[pTxBlk->UserPriority] = (pMacEntry->TxSeq[pTxBlk->UserPriority]+1) & MAXSEQ; { + // Check if the frame can be sent through DLS direct link interface + // If packet can be sent through DLS, then force aggregation disable. (Hard to determine peer STA's capability) + // The addr3 of normal packet send from DS is Dest Mac address. if (ADHOC_ON(pAd)) COPY_MAC_ADDR(pHeader80211->Addr3, pAd->CommonCfg.Bssid); @@ -1580,13 +1606,13 @@ static inline PUCHAR STA_Build_ARalink_Frame_Header( // padding at front of LLC header. LLC header should at 4-bytes aligment. pTxBlk->HdrPadLen = (ULONG)pHeaderBufPtr; - pHeaderBufPtr = (PCHAR)ROUND_UP(pHeaderBufPtr, 4); + pHeaderBufPtr = (PUCHAR)ROUND_UP(pHeaderBufPtr, 4); pTxBlk->HdrPadLen = (ULONG)(pHeaderBufPtr - pTxBlk->HdrPadLen); // For RA Aggregation, // put the 2nd MSDU length(extra 2-byte field) after QOS_CONTROL in little endian format pQEntry = pTxBlk->TxPacketList.Head; - pNextPacket = QUEUE_ENTRY_TO_PKT(pQEntry); + pNextPacket = QUEUE_ENTRY_TO_PACKET(pQEntry); nextBufLen = GET_OS_PKT_LEN(pNextPacket); if (RTMP_GET_PACKET_VLAN(pNextPacket)) nextBufLen -= LENGTH_802_1Q; @@ -1641,7 +1667,7 @@ static inline PUCHAR STA_Build_AMSDU_Frame_Header( // @@@ MpduHeaderLen excluding padding @@@ // pTxBlk->HdrPadLen = (ULONG)pHeaderBufPtr; - pHeaderBufPtr = (PCHAR) ROUND_UP(pHeaderBufPtr, 4); + pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); pTxBlk->HdrPadLen = (ULONG)(pHeaderBufPtr - pTxBlk->HdrPadLen); return pHeaderBufPtr; @@ -1743,7 +1769,7 @@ VOID STA_AMPDU_Frame_Tx( // @@@ MpduHeaderLen excluding padding @@@ // pTxBlk->HdrPadLen = (ULONG)pHeaderBufPtr; - pHeaderBufPtr = (PCHAR) ROUND_UP(pHeaderBufPtr, 4); + pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); pTxBlk->HdrPadLen = (ULONG)(pHeaderBufPtr - pTxBlk->HdrPadLen); { @@ -1790,9 +1816,7 @@ VOID STA_AMPDU_Frame_Tx( // // Kick out Tx // -#ifdef RT2860 if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_DISABLE_TX)) -#endif HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); pAd->RalinkCounters.KickTxCount++; @@ -1923,9 +1947,7 @@ VOID STA_AMSDU_Frame_Tx( // // Kick out Tx // -#ifdef RT2860 if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_DISABLE_TX)) -#endif HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); } @@ -1991,7 +2013,7 @@ VOID STA_Legacy_Frame_Tx( // // build QOS Control bytes // - *pHeaderBufPtr = (pTxBlk->UserPriority & 0x0F); + *(pHeaderBufPtr) = ((pTxBlk->UserPriority & 0x0F) | (pAd->CommonCfg.AckPolicy[pTxBlk->QueIdx]<<5)); *(pHeaderBufPtr+1) = 0; pHeaderBufPtr +=2; pTxBlk->MpduHeaderLen += 2; @@ -1999,7 +2021,7 @@ VOID STA_Legacy_Frame_Tx( // The remaining content of MPDU header should locate at 4-octets aligment pTxBlk->HdrPadLen = (ULONG)pHeaderBufPtr; - pHeaderBufPtr = (PCHAR) ROUND_UP(pHeaderBufPtr, 4); + pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); pTxBlk->HdrPadLen = (ULONG)(pHeaderBufPtr - pTxBlk->HdrPadLen); { @@ -2045,9 +2067,7 @@ VOID STA_Legacy_Frame_Tx( // // Kick out Tx // -#ifdef RT2860 if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_DISABLE_TX)) -#endif HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); } @@ -2158,9 +2178,7 @@ VOID STA_ARalink_Frame_Tx( // // Kick out Tx // -#ifdef RT2860 if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_DISABLE_TX)) -#endif HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); } @@ -2181,6 +2199,7 @@ VOID STA_Fragment_Frame_Tx( UINT NextMpduSize; BOOLEAN bVLANPkt; PQUEUE_ENTRY pQEntry; + HTTRANSMIT_SETTING *pTransmit; ASSERT(pTxBlk); @@ -2243,7 +2262,7 @@ VOID STA_Fragment_Frame_Tx( // LLC header should locate at 4-octets aligment // pTxBlk->HdrPadLen = (ULONG)pHeaderBufPtr; - pHeaderBufPtr = (PCHAR) ROUND_UP(pHeaderBufPtr, 4); + pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); pTxBlk->HdrPadLen = (ULONG)(pHeaderBufPtr - pTxBlk->HdrPadLen); @@ -2276,6 +2295,7 @@ VOID STA_Fragment_Frame_Tx( // MAC ASIC will only perform IV/EIV/ICV insertion but no TKIP MIC if (pTxBlk->CipherAlg == CIPHER_TKIP) { + RTMPCalculateMICValue(pAd, pTxBlk->pPacket, pTxBlk->pExtraLlcSnapEncap, pTxBlk->pKey, 0); // NOTE: DON'T refer the skb->len directly after following copy. Becasue the length is not adjust // to correct lenght, refer to pTxBlk->SrcBufLen for the packet length in following progress. @@ -2301,8 +2321,20 @@ VOID STA_Fragment_Frame_Tx( else EncryptionOverhead = 0; + pTransmit = pTxBlk->pTransmit; + // Decide the TX rate + if (pTransmit->field.MODE == MODE_CCK) + pTxBlk->TxRate = pTransmit->field.MCS; + else if (pTransmit->field.MODE == MODE_OFDM) + pTxBlk->TxRate = pTransmit->field.MCS + RATE_FIRST_OFDM_RATE; + else + pTxBlk->TxRate = RATE_6_5; + // decide how much time an ACK/CTS frame will consume in the air + if (pTxBlk->TxRate <= RATE_LAST_OFDM_RATE) AckDuration = RTMPCalcDuration(pAd, pAd->CommonCfg.ExpectedACKRate[pTxBlk->TxRate], 14); + else + AckDuration = RTMPCalcDuration(pAd, RATE_6_5, 14); // Init the total payload length of this frame. SrcRemainingBytes = pTxBlk->SrcBufLen; @@ -2365,6 +2397,7 @@ VOID STA_Fragment_Frame_Tx( // // Kick out Tx // + if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_DISABLE_TX)) HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); } @@ -2428,13 +2461,13 @@ NDIS_STATUS STAHardTransmit( // not to change PSM bit, just send this frame out? if ((pAd->StaCfg.Psm == PWR_SAVE) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { - DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicForceWakeup At HardTx\n")); -#ifdef RT2860 - AsicForceWakeup(pAd, FROM_TX); -#endif -#ifdef RT2870 + DBGPRINT_RAW(RT_DEBUG_INFO, ("AsicForceWakeup At HardTx\n")); +#ifdef RTMP_MAC_PCI AsicForceWakeup(pAd, TRUE); -#endif +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_FORCE_WAKE_UP, NULL, 0); +#endif // RTMP_MAC_USB // } // It should not change PSM bit, when APSD turn on. @@ -2444,7 +2477,7 @@ NDIS_STATUS STAHardTransmit( { if ((pAd->StaCfg.Psm == PWR_SAVE) && (pAd->StaCfg.WindowsPowerMode == Ndis802_11PowerModeFast_PSP)) - MlmeSetPsmBit(pAd, PWR_ACTIVE); + RTMP_SET_PSM_BIT(pAd, PWR_ACTIVE); } switch (pTxBlk->TxFrameType) diff --git a/drivers/staging/rt2860/sta/sanity.c b/drivers/staging/rt2860/sta/sanity.c index 7d530f601602..292baa86196b 100644 --- a/drivers/staging/rt2860/sta/sanity.c +++ b/drivers/staging/rt2860/sta/sanity.c @@ -117,7 +117,7 @@ BOOLEAN PeerAssocRspSanity( *pHtCapabilityLen = 0; *pAddHtInfoLen = 0; COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); - Ptr = pFrame->Octet; + Ptr = (PCHAR)pFrame->Octet; Length += LENGTH_802_11; NdisMoveMemory(pCapabilityInfo, &pFrame->Octet[0], 2); @@ -213,28 +213,7 @@ BOOLEAN PeerAssocRspSanity( DBGPRINT(RT_DEBUG_WARN, ("PeerAssocRspSanity - wrong IE_SECONDARY_CH_OFFSET. \n")); } break; - case IE_AIRONET_CKIP: - // 0. Check Aironet IE length, it must be larger or equal to 28 - // Cisco's AP VxWork version(will not be supported) used this IE length as 28 - // Cisco's AP IOS version used this IE length as 30 - if (pEid->Len < (CKIP_NEGOTIATION_LENGTH - 2)) - break; - - // 1. Copy CKIP flag byte to buffer for process - *pCkipFlag = *(pEid->Octet + 8); - break; - case IE_AIRONET_IPADDRESS: - if (pEid->Len != 0x0A) - break; - - // Get Cisco Aironet IP information - if (NdisEqualMemory(pEid->Octet, CISCO_OUI, 3) == 1) - NdisMoveMemory(pAd->StaCfg.AironetIPAddress, pEid->Octet + 4, 4); - break; - - // CCX2, WMM use the same IE value - // case IE_CCX_V2: case IE_VENDOR_SPECIFIC: // handle WME PARAMTER ELEMENT if (NdisEqualMemory(pEid->Octet, WME_PARM_ELEM, 6) && (pEid->Len == 24)) @@ -250,7 +229,7 @@ BOOLEAN PeerAssocRspSanity( //pEdcaParm->bMoreDataAck = FALSE; // pEid->Octet[0] & 0x80; pEdcaParm->EdcaUpdateCount = pEid->Octet[6] & 0x0f; pEdcaParm->bAPSDCapable = (pEid->Octet[6] & 0x80) ? 1 : 0; - ptr = &pEid->Octet[8]; + ptr = (PUCHAR)&pEid->Octet[8]; for (i=0; i<4; i++) { UCHAR aci = (*ptr & 0x60) >> 5; // b5~6 is AC INDEX @@ -262,23 +241,7 @@ BOOLEAN PeerAssocRspSanity( ptr += 4; // point to next AC } } - - // handle CCX IE - else - { - // 0. Check the size and CCX admin control - if (pAd->StaCfg.CCXControl.field.Enable == 0) - break; - if (pEid->Len != 5) - break; - - // Turn CCX2 if matched - if (NdisEqualMemory(pEid->Octet, Ccx2IeInfo, 5) == 1) - pAd->StaCfg.CCXEnable = TRUE; - break; - } break; - default: DBGPRINT(RT_DEBUG_TRACE, ("PeerAssocRspSanity - ignore unrecognized EID = %d\n", pEid->Eid)); break; @@ -288,9 +251,6 @@ BOOLEAN PeerAssocRspSanity( pEid = (PEID_STRUCT)((UCHAR*)pEid + 2 + pEid->Len); } - // Force CCX2 enable to TRUE for those AP didn't replay CCX v2 IE, we still force it to be on - if (pAd->StaCfg.CCXControl.field.Enable == 1) - pAd->StaCfg.CCXEnable = TRUE; return TRUE; } diff --git a/drivers/staging/rt2860/sta/sync.c b/drivers/staging/rt2860/sta/sync.c index a6e4362fc5cc..f72f11a8ec20 100644 --- a/drivers/staging/rt2860/sta/sync.c +++ b/drivers/staging/rt2860/sta/sync.c @@ -37,45 +37,8 @@ */ #include "../rt_config.h" -#ifdef RT2860 -#define AC0_DEF_TXOP 0 -#define AC1_DEF_TXOP 0 -#define AC2_DEF_TXOP 94 -#define AC3_DEF_TXOP 47 -VOID AdhocTurnOnQos( - IN PRTMP_ADAPTER pAd) -{ - // Turn on QOs if use HT rate. - if (pAd->CommonCfg.APEdcaParm.bValid == FALSE) - { - pAd->CommonCfg.APEdcaParm.bValid = TRUE; - pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3; - pAd->CommonCfg.APEdcaParm.Aifsn[1] = 7; - pAd->CommonCfg.APEdcaParm.Aifsn[2] = 1; - pAd->CommonCfg.APEdcaParm.Aifsn[3] = 1; - - pAd->CommonCfg.APEdcaParm.Cwmin[0] = 4; - pAd->CommonCfg.APEdcaParm.Cwmin[1] = 4; - pAd->CommonCfg.APEdcaParm.Cwmin[2] = 3; - pAd->CommonCfg.APEdcaParm.Cwmin[3] = 2; - - pAd->CommonCfg.APEdcaParm.Cwmax[0] = 10; - pAd->CommonCfg.APEdcaParm.Cwmax[1] = 6; - pAd->CommonCfg.APEdcaParm.Cwmax[2] = 4; - pAd->CommonCfg.APEdcaParm.Cwmax[3] = 3; - - pAd->CommonCfg.APEdcaParm.Txop[0] = 0; - pAd->CommonCfg.APEdcaParm.Txop[1] = 0; - pAd->CommonCfg.APEdcaParm.Txop[2] = AC2_DEF_TXOP; - pAd->CommonCfg.APEdcaParm.Txop[3] = AC3_DEF_TXOP; - } - AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm); -} -#endif /* RT2860 */ -#ifdef RT2870 #define ADHOC_ENTRY_BEACON_LOST_TIME (2*OS_HZ) // 2 sec -#endif /* ========================================================================== @@ -160,7 +123,7 @@ VOID BeaconTimeout( } MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_BEACON_TIMEOUT, 0, NULL); - RT28XX_MLME_HANDLER(pAd); + RTMP_MLME_HANDLER(pAd); } /* @@ -188,8 +151,8 @@ VOID ScanTimeout( if (MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_SCAN_TIMEOUT, 0, NULL)) { - RT28XX_MLME_HANDLER(pAd); - } + RTMP_MLME_HANDLER(pAd); +} else { // To prevent SyncMachine.CurrState is SCAN_LISTEN forever. @@ -231,7 +194,7 @@ VOID MlmeScanReqAction( // Increase the scan retry counters. pAd->StaCfg.ScanCnt++; -#ifdef RT2860 +#ifdef RTMP_MAC_PCI if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) && (IDLE_ON(pAd)) && (pAd->StaCfg.bRadio == TRUE) && @@ -239,30 +202,22 @@ VOID MlmeScanReqAction( { RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); } -#endif +#endif // RTMP_MAC_PCI // // first check the parameter sanity if (MlmeScanReqSanity(pAd, Elem->Msg, Elem->MsgLen, &BssType, - Ssid, + (PCHAR)Ssid, &SsidLen, &ScanType)) { // Check for channel load and noise hist request // Suspend MSDU only at scan request, not the last two mentioned - if ((ScanType == SCAN_CISCO_NOISE) || (ScanType == SCAN_CISCO_CHANNEL_LOAD)) - { - if (pAd->StaCfg.CCXScanChannel != pAd->CommonCfg.Channel) - RTMPSuspendMsduTransmission(pAd); // Suspend MSDU transmission here - } - else - { // Suspend MSDU transmission here RTMPSuspendMsduTransmission(pAd); - } // // To prevent data lost. @@ -304,11 +259,6 @@ VOID MlmeScanReqAction( // start from the first channel pAd->MlmeAux.Channel = FirstChannel(pAd); - // Change the scan channel when dealing with CCX beacon report - if ((ScanType == SCAN_CISCO_PASSIVE) || (ScanType == SCAN_CISCO_ACTIVE) || - (ScanType == SCAN_CISCO_CHANNEL_LOAD) || (ScanType == SCAN_CISCO_NOISE)) - pAd->MlmeAux.Channel = pAd->StaCfg.CCXScanChannel; - // Let BBP register at 20MHz to do scan RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); BBPValue &= (~0x18); @@ -352,7 +302,7 @@ VOID MlmeJoinReqAction( DBGPRINT(RT_DEBUG_TRACE, ("SYNC - MlmeJoinReqAction(BSS #%ld)\n", pInfo->BssIdx)); -#ifdef RT2860 +#ifdef RTMP_MAC_PCI if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) && (IDLE_ON(pAd)) && (pAd->StaCfg.bRadio == TRUE) && @@ -360,7 +310,7 @@ VOID MlmeJoinReqAction( { RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); } -#endif +#endif // RTMP_MAC_PCI // // reset all the timers RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &TimerCancelled); @@ -374,6 +324,7 @@ VOID MlmeJoinReqAction( // If AP's SSID is not hidden, it is OK for updating ssid to MlmeAux again. if (pBss->Hidden == 0) { + RTMPZeroMemory(pAd->MlmeAux.Ssid, MAX_LEN_OF_SSID); NdisMoveMemory(pAd->MlmeAux.Ssid, pBss->Ssid, pBss->SsidLen); pAd->MlmeAux.SsidLen = pBss->SsidLen; } @@ -382,10 +333,14 @@ VOID MlmeJoinReqAction( pAd->MlmeAux.Channel = pBss->Channel; pAd->MlmeAux.CentralChannel = pBss->CentralChannel; + // Let BBP register at 20MHz to do scan RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); BBPValue &= (~0x18); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); +#ifdef RT2860 + pAd->CommonCfg.BBPCurrentBW = BW_20; +#endif // RT2860 // DBGPRINT(RT_DEBUG_TRACE, ("SYNC - BBP R4 to 20MHz.l\n")); // switch channel and waiting for beacon timer @@ -494,7 +449,7 @@ VOID MlmeStartReqAction( TimeStamp.u.LowPart = 0; TimeStamp.u.HighPart = 0; - if (MlmeStartReqSanity(pAd, Elem->Msg, Elem->MsgLen, Ssid, &SsidLen)) + if (MlmeStartReqSanity(pAd, Elem->Msg, Elem->MsgLen, (PCHAR)Ssid, &SsidLen)) { // reset all the timers RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &TimerCancelled); @@ -541,6 +496,7 @@ VOID MlmeStartReqAction( { pAd->MlmeAux.HtCapabilityLen = 0; pAd->StaActive.SupportedPhyInfo.bHtEnable = FALSE; + NdisZeroMemory(&pAd->StaActive.SupportedPhyInfo.MCSSet[0], 16); } // temporarily not support QOS in IBSS NdisZeroMemory(&pAd->MlmeAux.APEdcaParm, sizeof(EDCA_PARM)); @@ -601,6 +557,8 @@ VOID PeerBeaconAtScanAction( UCHAR AddHtInfoLen; UCHAR NewExtChannelOffset = 0xff; + + // NdisFillMemory(Ssid, MAX_LEN_OF_SSID, 0x00); pFrame = (PFRAME_802_11) Elem->Msg; // Init Variable IE structure pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; @@ -615,7 +573,7 @@ VOID PeerBeaconAtScanAction( Elem->Channel, Addr2, Bssid, - Ssid, + (PCHAR)Ssid, &SsidLen, &BssType, &BeaconPeriod, @@ -661,24 +619,7 @@ VOID PeerBeaconAtScanAction( if ((HtCapabilityLen > 0) || (PreNHtCapabilityLen > 0)) HtCapabilityLen = SIZE_HT_CAP_IE; - if ((pAd->StaCfg.CCXReqType != MSRN_TYPE_UNUSED) && (Channel == pAd->StaCfg.CCXScanChannel)) - { - Idx = BssTableSetEntry(pAd, &pAd->StaCfg.CCXBssTab, Bssid, Ssid, SsidLen, BssType, BeaconPeriod, - &CfParm, AtimWin, CapabilityInfo, SupRate, SupRateLen,ExtRate, ExtRateLen, &HtCapability, - &AddHtInfo, HtCapabilityLen, AddHtInfoLen, NewExtChannelOffset, Channel, Rssi, TimeStamp, CkipFlag, - &EdcaParm, &QosCapability, &QbssLoad, LenVIE, pVIE); - if (Idx != BSS_NOT_FOUND) - { - NdisMoveMemory(pAd->StaCfg.CCXBssTab.BssEntry[Idx].PTSF, &Elem->Msg[24], 4); - NdisMoveMemory(&pAd->StaCfg.CCXBssTab.BssEntry[Idx].TTSF[0], &Elem->TimeStamp.u.LowPart, 4); - NdisMoveMemory(&pAd->StaCfg.CCXBssTab.BssEntry[Idx].TTSF[4], &Elem->TimeStamp.u.LowPart, 4); - if (pAd->StaCfg.CCXReqType == MSRN_TYPE_BEACON_REQ) - AironetAddBeaconReport(pAd, Idx, Elem); - } - } - else - { - Idx = BssTableSetEntry(pAd, &pAd->ScanTab, Bssid, Ssid, SsidLen, BssType, BeaconPeriod, + Idx = BssTableSetEntry(pAd, &pAd->ScanTab, Bssid, (PCHAR)Ssid, SsidLen, BssType, BeaconPeriod, &CfParm, AtimWin, CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen, &HtCapability, &AddHtInfo, HtCapabilityLen, AddHtInfoLen, NewExtChannelOffset, Channel, Rssi, TimeStamp, CkipFlag, &EdcaParm, &QosCapability, &QbssLoad, LenVIE, pVIE); @@ -689,7 +630,7 @@ VOID PeerBeaconAtScanAction( NdisMoveMemory(&pAd->ScanTab.BssEntry[Idx].TTSF[0], &Elem->TimeStamp.u.LowPart, 4); NdisMoveMemory(&pAd->ScanTab.BssEntry[Idx].TTSF[4], &Elem->TimeStamp.u.LowPart, 4); } - } + } // sanity check fail, ignored } @@ -731,6 +672,7 @@ VOID PeerBeaconAtJoinAction( UCHAR AddHtInfoLen; UCHAR NewExtChannelOffset = 0xff; UCHAR CentralChannel; + BOOLEAN bAllowNrate = FALSE; // Init Variable IE structure pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; @@ -745,7 +687,7 @@ VOID PeerBeaconAtJoinAction( Elem->Channel, Addr2, Bssid, - Ssid, + (PCHAR)Ssid, &SsidLen, &BssType, &BeaconPeriod, @@ -818,7 +760,23 @@ VOID PeerBeaconAtJoinAction( { Idx = BssSsidTableSearch(&pAd->ScanTab, Bssid, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, Channel); + if (Idx == BSS_NOT_FOUND) + { + CHAR Rssi = 0; + Rssi = RTMPMaxRssi(pAd, ConvertToRssi(pAd, Elem->Rssi0, RSSI_0), ConvertToRssi(pAd, Elem->Rssi1, RSSI_1), ConvertToRssi(pAd, Elem->Rssi2, RSSI_2)); + Idx = BssTableSetEntry(pAd, &pAd->ScanTab, Bssid, (CHAR *) Ssid, SsidLen, BssType, BeaconPeriod, + &Cf, AtimWin, CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen, &HtCapability, + &AddHtInfo, HtCapabilityLen, AddHtInfoLen, NewExtChannelOffset, Channel, Rssi, TimeStamp, CkipFlag, + &EdcaParm, &QosCapability, &QbssLoad, LenVIE, pVIE); if (Idx != BSS_NOT_FOUND) + { + NdisMoveMemory(pAd->ScanTab.BssEntry[Idx].PTSF, &Elem->Msg[24], 4); + NdisMoveMemory(&pAd->ScanTab.BssEntry[Idx].TTSF[0], &Elem->TimeStamp.u.LowPart, 4); + NdisMoveMemory(&pAd->ScanTab.BssEntry[Idx].TTSF[4], &Elem->TimeStamp.u.LowPart, 4); + CapabilityInfo = pAd->ScanTab.BssEntry[Idx].CapabilityInfo; + } + } + else { // // Multiple SSID case, used correct CapabilityInfo @@ -847,13 +805,21 @@ VOID PeerBeaconAtJoinAction( NdisZeroMemory(pAd->StaActive.SupportedPhyInfo.MCSSet, 16); + + if (((pAd->StaCfg.WepStatus != Ndis802_11WEPEnabled) && (pAd->StaCfg.WepStatus != Ndis802_11Encryption2Enabled)) + || (pAd->CommonCfg.HT_DisallowTKIP == FALSE)) + { + bAllowNrate = TRUE; + } + pAd->MlmeAux.NewExtChannelOffset = NewExtChannelOffset; pAd->MlmeAux.HtCapabilityLen = HtCapabilityLen; + RTMPZeroMemory(&pAd->MlmeAux.HtCapability, SIZE_HT_CAP_IE); // filter out un-supported ht rates - if (((HtCapabilityLen > 0) || (PreNHtCapabilityLen > 0)) && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) + if (((HtCapabilityLen > 0) || (PreNHtCapabilityLen > 0)) && + ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && (bAllowNrate))) { - RTMPZeroMemory(&pAd->MlmeAux.HtCapability, SIZE_HT_CAP_IE); RTMPMoveMemory(&pAd->MlmeAux.AddHtInfo, &AddHtInfo, SIZE_ADD_HT_INFO_IE); // StaActive.SupportedHtPhy.MCSSet stores Peer AP's 11n Rx capability @@ -897,7 +863,9 @@ VOID PeerBeaconAtJoinAction( pAd->MlmeAux.CentralChannel = pAd->MlmeAux.Channel; pAd->StaActive.SupportedPhyInfo.bHtEnable = FALSE; + pAd->MlmeAux.NewExtChannelOffset = 0xff; RTMPZeroMemory(&pAd->MlmeAux.HtCapability, SIZE_HT_CAP_IE); + pAd->MlmeAux.HtCapabilityLen = 0; RTMPZeroMemory(&pAd->MlmeAux.AddHtInfo, SIZE_ADD_HT_INFO_IE); } @@ -930,6 +898,8 @@ VOID PeerBeaconAtJoinAction( else //Used the default TX Power Percentage. pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault; + InitChannelRelatedValue(pAd); + pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; Status = MLME_SUCCESS; MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_JOIN_CONF, 2, &Status); @@ -1116,8 +1086,6 @@ VOID PeerBeacon( // Add the safeguard against the mismatch of adhoc wep status if (pAd->StaCfg.WepStatus != pAd->ScanTab.BssEntry[Bssidx].WepStatus) { - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - Not matched wep status %d %d\n", pAd->StaCfg.WepStatus, pAd->ScanTab.BssEntry[Bssidx].WepStatus)); - DBGPRINT(RT_DEBUG_TRACE, ("bssid=%s\n", pAd->ScanTab.BssEntry[Bssidx].Bssid)); return; } @@ -1181,200 +1149,8 @@ VOID PeerBeacon( pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault; } -#ifdef RT2860 - // at least one 11b peer joined. downgrade the MaxTxRate to 11Mbps - // after last 11b peer left for several seconds, we'll auto switch back to 11G rate - // in MlmePeriodicExec() -#endif if (ADHOC_ON(pAd) && (CAP_IS_IBSS_ON(CapabilityInfo))) { -#ifdef RT2860 - BOOLEAN bRestart; - BOOLEAN bnRestart; - - bRestart = FALSE; - bnRestart = FALSE; - - do - { - if ((SupRateLen+ExtRateLen <= 4) && (pAd->CommonCfg.MaxTxRate > RATE_11)) - { - if (pAd->StaCfg.AdhocBOnlyJoined == FALSE) - { - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - 11b peer joined. down-grade to 11b TX rates \n")); - bRestart = TRUE; - NdisMoveMemory(pAd->StaActive.SupRate, SupRate, MAX_LEN_OF_SUPPORTED_RATES); - pAd->StaActive.SupRateLen = SupRateLen; - NdisMoveMemory(pAd->StaActive.ExtRate, ExtRate, MAX_LEN_OF_SUPPORTED_RATES); - pAd->StaActive.ExtRateLen = ExtRateLen; - pAd->StaCfg.AdhocBOnlyJoined = TRUE; - pAd->StaActive.SupportedPhyInfo.bHtEnable = FALSE; - AsicSetEdcaParm(pAd, NULL); - } - - // this timestamp is for MlmePeriodicExec() to check if all 11B peers have left - pAd->StaCfg.Last11bBeaconRxTime = Now; - break; - } - - // Update Ht Phy. - if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) - { - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) && - !pAd->StaCfg.AdhocBGJoined && - !pAd->StaCfg.AdhocBOnlyJoined) - AdhocTurnOnQos(pAd); - - // Handle rate switch issue when Adhoc mode - if ((SupRateLen+ExtRateLen >= 8) && (HtCapability.MCSSet[0] == 0) && (HtCapability.MCSSet[1] == 0)) - { - if (pAd->StaCfg.AdhocBGJoined == FALSE) - { - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - 11g peer joined. down-grade to 11g TX rates \n")); - bRestart = TRUE; - NdisMoveMemory(pAd->StaActive.SupRate, SupRate, MAX_LEN_OF_SUPPORTED_RATES); - pAd->StaActive.SupRateLen = SupRateLen; - NdisMoveMemory(pAd->StaActive.ExtRate, ExtRate, MAX_LEN_OF_SUPPORTED_RATES); - pAd->StaActive.ExtRateLen = ExtRateLen; - pAd->StaCfg.AdhocBGJoined = TRUE; - pAd->StaActive.SupportedPhyInfo.bHtEnable = FALSE; - AsicSetEdcaParm(pAd, NULL); - } - - // this timestamp is for MlmePeriodicExec() to check if all 11g peers have left - pAd->StaCfg.Last11gBeaconRxTime = Now; - break; - } - else if (!pAd->StaCfg.AdhocBGJoined && - !pAd->StaCfg.AdhocBOnlyJoined && - (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40) && - (HtCapability.HtCapInfo.ChannelWidth == BW_20)) - { - if (pAd->StaCfg.Adhoc20NJoined == FALSE) - { - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; - - pAd->StaCfg.Adhoc20NJoined = TRUE; - NdisMoveMemory(&pAd->MlmeAux.HtCapability, &HtCapability, SIZE_HT_CAP_IE); - if (AddHtInfoLen != 0) - NdisMoveMemory(&pAd->MlmeAux.AddHtInfo, &AddHtInfo, AddHtInfoLen); - NdisMoveMemory(pAd->StaActive.SupportedPhyInfo.MCSSet, HtCapability.MCSSet, 16); - - RTMPCheckHt(pAd, Elem->Wcid, &pAd->MlmeAux.HtCapability, &pAd->MlmeAux.AddHtInfo); - COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(pAd); - pAd->StaActive.SupportedPhyInfo.bHtEnable = TRUE; - bRestart = TRUE; - bnRestart = TRUE; - } - // this timestamp is for MlmePeriodicExec() to check if all 20MHz N peers have left - pAd->StaCfg.Last20NBeaconRxTime = Now; - } - - } - else - { - RTMPZeroMemory(&pAd->MlmeAux.HtCapability, SIZE_HT_CAP_IE); - RTMPZeroMemory(&pAd->MlmeAux.AddHtInfo, SIZE_ADD_HT_INFO_IE); - } - }while (FALSE); - - // If peer Adhoc is legacy mode, I don't need to call MlmeUpdateHtTxRates no matter I support HT or not - if ((bRestart == TRUE) && (bnRestart == FALSE)) - { - MlmeUpdateTxRates(pAd, FALSE, 0); - MakeIbssBeacon(pAd); // re-build BEACON frame - AsicEnableIbssSync(pAd); // copy to on-chip memory - } - else if ((bRestart == TRUE) && (bnRestart == TRUE)) - { - MlmeUpdateTxRates(pAd, FALSE, BSS0); - MlmeUpdateHtTxRates(pAd, BSS0); - MakeIbssBeacon(pAd); // re-build BEACON frame - AsicEnableIbssSync(pAd); // copy to on-chip memory - } - - // At least another peer in this IBSS, declare MediaState as CONNECTED - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); - - pAd->IndicateMediaState = NdisMediaStateConnected; - RTMP_IndicateMediaState(pAd); - pAd->ExtraInfo = GENERAL_LINK_UP; - AsicSetBssid(pAd, pAd->CommonCfg.Bssid); - - // 2003/03/12 - john - // Make sure this entry in "ScanTab" table, thus complies to Microsoft's policy that - // "site survey" result should always include the current connected network. - // - Bssidx = BssTableSearch(&pAd->ScanTab, Bssid, Channel); - if (Bssidx == BSS_NOT_FOUND) - { - Bssidx = BssTableSetEntry(pAd, &pAd->ScanTab, Bssid, Ssid, SsidLen, BssType, BeaconPeriod, - &CfParm, AtimWin, CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen, &HtCapability, - &AddHtInfo, HtCapabilityLen, AddHtInfoLen, NewExtChannelOffset, Channel, RealRssi, TimeStamp, 0, - &EdcaParm, &QosCapability, &QbssLoad, LenVIE, pVIE); - } - DBGPRINT(RT_DEBUG_TRACE, ("ADHOC fOP_STATUS_MEDIA_STATE_CONNECTED.\n")); - } - - // Ad-hoc mode is using MAC address as BA session. So we need to continuously find newly joined adhoc station by receiving beacon. - // To prevent always check this, we use wcid == RESERVED_WCID to recognize it as newly joined adhoc station. - if (ADHOC_ON(pAd) && (Elem->Wcid == RESERVED_WCID)) - { - UCHAR idx; - MAC_TABLE_ENTRY *pEntry; - - // look up the existing table - pEntry = MacTableLookup(pAd, Addr2); - if (pEntry == NULL) - { - // Another adhoc joining, add to our MAC table. - pEntry = MacTableInsertEntry(pAd, Addr2, BSS0, FALSE); - if (pEntry) - { - pEntry->Sst = SST_ASSOC; - idx = pAd->StaCfg.DefaultKeyId; - // After InsertEntry, Write to ASIC on-chip table. - RT28XX_STA_SECURITY_INFO_ADD(pAd, BSS0, idx, pEntry); - DBGPRINT(RT_DEBUG_TRACE, ("ADHOC %x:%x:%x:%x:%x:%x join in.Entry=%d\n", Addr2[0],Addr2[1],Addr2[2],Addr2[3],Addr2[4],Addr2[5], pEntry->Aid)); - - pEntry->HTPhyMode.word = pAd->StaCfg.HTPhyMode.word; - if (HtCapabilityLen <= 0) - { - pEntry->HTPhyMode.field.STBC = 0; - pEntry->HTPhyMode.field.BW = 0; - pEntry->HTPhyMode.field.ShortGI = 0; - if ((SupRateLen+ExtRateLen <= 4) && (pAd->CommonCfg.Channel <= 14)) - { - pEntry->HTPhyMode.field.MODE = MODE_CCK; - } - else - { - pEntry->HTPhyMode.field.MODE = MODE_OFDM; - } - MlmeUpdateTxRates(pAd, FALSE, 0); - } - else - { - MlmeUpdateTxRates(pAd, FALSE, 0); - MlmeUpdateHtTxRates(pAd, BSS0); - } - - { - union iwreq_data wrqu; - wext_notify_event_assoc(pAd); - - memset(wrqu.ap_addr.sa_data, 0, MAC_ADDR_LEN); - memcpy(wrqu.ap_addr.sa_data, pAd->MlmeAux.Bssid, MAC_ADDR_LEN); - wireless_send_event(pAd->net_dev, SIOCGIWAP, &wrqu, NULL); - - } - } - } - } -#endif /* RT2860 */ -#ifdef RT2870 UCHAR MaxSupportedRateIn500Kbps = 0; UCHAR idx; MAC_TABLE_ENTRY *pEntry; @@ -1404,7 +1180,14 @@ VOID PeerBeacon( // Another adhoc joining, add to our MAC table. pEntry = MacTableInsertEntry(pAd, Addr2, BSS0, FALSE); - if (StaAddMacTableEntry(pAd, pEntry, MaxSupportedRateIn500Kbps, &HtCapability, HtCapabilityLen, CapabilityInfo) == FALSE) + if (StaAddMacTableEntry(pAd, + pEntry, + MaxSupportedRateIn500Kbps, + &HtCapability, + HtCapabilityLen, + &AddHtInfo, + AddHtInfoLen, + CapabilityInfo) == FALSE) { DBGPRINT(RT_DEBUG_TRACE, ("ADHOC - Add Entry failed.\n")); return; @@ -1414,7 +1197,7 @@ VOID PeerBeacon( (Elem->Wcid == RESERVED_WCID)) { idx = pAd->StaCfg.DefaultKeyId; - RT28XX_STA_SECURITY_INFO_ADD(pAd, BSS0, idx, pEntry); + RTMP_STA_SECURITY_INFO_ADD(pAd, BSS0, idx, pEntry); } } @@ -1445,7 +1228,6 @@ VOID PeerBeacon( } DBGPRINT(RT_DEBUG_TRACE, ("ADHOC fOP_STATUS_MEDIA_STATE_CONNECTED.\n")); } -#endif /* RT2870 */ } if (INFRA_ON(pAd)) @@ -1534,28 +1316,32 @@ VOID PeerBeacon( // 5. otherwise, put PHY back to sleep to save battery. if (MessageToMe) { -#ifdef RT2860 +#ifdef RTMP_MAC_PCI if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) { + // Restore to correct BBP R3 value + if (pAd->Antenna.field.RxPath > 1) RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, pAd->StaCfg.BBPR3); + // Turn clk to 80Mhz. } -#endif +#endif // RTMP_MAC_PCI // if (pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable && pAd->CommonCfg.bAPSDAC_BE && pAd->CommonCfg.bAPSDAC_BK && pAd->CommonCfg.bAPSDAC_VI && pAd->CommonCfg.bAPSDAC_VO) { pAd->CommonCfg.bNeedSendTriggerFrame = TRUE; } else - RT28XX_PS_POLL_ENQUEUE(pAd); + RTMP_PS_POLL_ENQUEUE(pAd); } else if (BcastFlag && (DtimCount == 0) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM)) { -#ifdef RT2860 +#ifdef RTMP_MAC_PCI if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) { + if (pAd->Antenna.field.RxPath > 1) RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, pAd->StaCfg.BBPR3); } -#endif +#endif // RTMP_MAC_PCI // } else if ((pAd->TxSwQueue[QID_AC_BK].Number != 0) || (pAd->TxSwQueue[QID_AC_BE].Number != 0) || @@ -1569,12 +1355,42 @@ VOID PeerBeacon( { // TODO: consider scheduled HCCA. might not be proper to use traditional DTIM-based power-saving scheme // can we cheat here (i.e. just check MGMT & AC_BE) for better performance? -#ifdef RT2860 +#ifdef RTMP_MAC_PCI if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) { + if (pAd->Antenna.field.RxPath > 1) RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, pAd->StaCfg.BBPR3); } -#endif +#endif // RTMP_MAC_PCI // + } + else + { + if ((pAd->CommonCfg.bACMAPSDTr[QID_AC_VO]) || + (pAd->CommonCfg.bACMAPSDTr[QID_AC_VI]) || + (pAd->CommonCfg.bACMAPSDTr[QID_AC_BK]) || + (pAd->CommonCfg.bACMAPSDTr[QID_AC_BE])) + { + /* + WMM Spec v1.0 3.6.2.4, + The WMM STA shall remain awake until it receives a + QoS Data or Null frame addressed to it, with the + EOSP subfield in QoS Control field set to 1. + + So we can not sleep here or we will suffer a case: + + PS Management Frame --> + Trigger frame --> + Beacon (TIM=0) (Beacon is closer to Trig frame) --> + Station goes to sleep --> + AP delivery queued UAPSD packets --> + Station can NOT receive the reply + + Maybe we need a timeout timer to avoid that we do + NOT receive the EOSP frame. + + We can not use More Data to check if SP is ended + due to MaxSPLength. + */ } else { @@ -1589,14 +1405,10 @@ VOID PeerBeacon( if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { -#ifdef RT2860 // Set a flag to go to sleep . Then after parse this RxDoneInterrupt, will go to sleep mode. - RTMP_SET_PSFLAG(pAd, fRTMP_PS_GO_TO_SLEEP_NOW); pAd->ThisTbttNumToNextWakeUp = TbttNumToNextWakeUp; -#endif -#ifdef RT2870 - AsicSleepThenAutoWakeup(pAd, TbttNumToNextWakeUp); -#endif + AsicSleepThenAutoWakeup(pAd, pAd->ThisTbttNumToNextWakeUp); + } } } } @@ -1825,6 +1637,8 @@ VOID InvalidStateWhenStart( VOID EnqueuePsPoll( IN PRTMP_ADAPTER pAd) { + + if (pAd->StaCfg.WindowsPowerMode == Ndis802_11PowerModeLegacy_PSP) pAd->PsPollFrame.FC.PwrMgmt = PWR_SAVE; MiniportMMRequest(pAd, 0, (PUCHAR)&pAd->PsPollFrame, sizeof(PSPOLL_FRAME)); diff --git a/drivers/staging/rt2860/sta/wpa.c b/drivers/staging/rt2860/sta/wpa.c index 8c34e39f3860..d45b9ba88b05 100644 --- a/drivers/staging/rt2860/sta/wpa.c +++ b/drivers/staging/rt2860/sta/wpa.c @@ -37,1813 +37,7 @@ */ #include "../rt_config.h" -#define WPARSNIE 0xdd -#define WPA2RSNIE 0x30 - -//extern UCHAR BIT8[]; -UCHAR CipherWpaPskTkip[] = { - 0xDD, 0x16, // RSN IE - 0x00, 0x50, 0xf2, 0x01, // oui - 0x01, 0x00, // Version - 0x00, 0x50, 0xf2, 0x02, // Multicast - 0x01, 0x00, // Number of unicast - 0x00, 0x50, 0xf2, 0x02, // unicast - 0x01, 0x00, // number of authentication method - 0x00, 0x50, 0xf2, 0x02 // authentication - }; -UCHAR CipherWpaPskTkipLen = (sizeof(CipherWpaPskTkip) / sizeof(UCHAR)); - -UCHAR CipherWpaPskAes[] = { - 0xDD, 0x16, // RSN IE - 0x00, 0x50, 0xf2, 0x01, // oui - 0x01, 0x00, // Version - 0x00, 0x50, 0xf2, 0x04, // Multicast - 0x01, 0x00, // Number of unicast - 0x00, 0x50, 0xf2, 0x04, // unicast - 0x01, 0x00, // number of authentication method - 0x00, 0x50, 0xf2, 0x02 // authentication - }; -UCHAR CipherWpaPskAesLen = (sizeof(CipherWpaPskAes) / sizeof(UCHAR)); - -UCHAR CipherSuiteCiscoCCKM[] = { - 0xDD, 0x16, // RSN IE - 0x00, 0x50, 0xf2, 0x01, // oui - 0x01, 0x00, // Version - 0x00, 0x40, 0x96, 0x01, // Multicast - 0x01, 0x00, // Number of uicast - 0x00, 0x40, 0x96, 0x01, // unicast - 0x01, 0x00, // number of authentication method - 0x00, 0x40, 0x96, 0x00 // Authentication - }; -UCHAR CipherSuiteCiscoCCKMLen = (sizeof(CipherSuiteCiscoCCKM) / sizeof(UCHAR)); - -UCHAR CipherSuiteCiscoCCKM24[] = { - 0xDD, 0x18, // RSN IE - 0x00, 0x50, 0xf2, 0x01, // oui - 0x01, 0x00, // Version - 0x00, 0x40, 0x96, 0x01, // Multicast - 0x01, 0x00, // Number of uicast - 0x00, 0x40, 0x96, 0x01, // unicast - 0x01, 0x00, // number of authentication method - 0x00, 0x40, 0x96, 0x00, - 0x28, 0x00// Authentication - }; - -UCHAR CipherSuiteCiscoCCKM24Len = (sizeof(CipherSuiteCiscoCCKM24) / sizeof(UCHAR)); - -UCHAR CipherSuiteCCXTkip[] = { - 0xDD, 0x16, // RSN IE - 0x00, 0x50, 0xf2, 0x01, // oui - 0x01, 0x00, // Version - 0x00, 0x50, 0xf2, 0x02, // Multicast - 0x01, 0x00, // Number of unicast - 0x00, 0x50, 0xf2, 0x02, // unicast - 0x01, 0x00, // number of authentication method - 0x00, 0x50, 0xf2, 0x01 // authentication - }; -UCHAR CipherSuiteCCXTkipLen = (sizeof(CipherSuiteCCXTkip) / sizeof(UCHAR)); - -UCHAR CCX_LLC_HDR[] = {0xAA, 0xAA, 0x03, 0x00, 0x40, 0x96, 0x00, 0x02}; -UCHAR LLC_NORMAL[] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; - -UCHAR EAPOL_FRAME[] = {0x88, 0x8E}; - -BOOLEAN CheckRSNIE( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN UCHAR DataLen, - OUT UCHAR *Offset); - -void inc_byte_array(UCHAR *counter, int len); - -/* - ======================================================================== - - Routine Description: - Classify WPA EAP message type - - Arguments: - EAPType Value of EAP message type - MsgType Internal Message definition for MLME state machine - - Return Value: - TRUE Found appropriate message type - FALSE No appropriate message type - - IRQL = DISPATCH_LEVEL - - Note: - All these constants are defined in wpa.h - For supplicant, there is only EAPOL Key message avaliable - - ======================================================================== -*/ -BOOLEAN WpaMsgTypeSubst( - IN UCHAR EAPType, - OUT INT *MsgType) -{ - switch (EAPType) - { - case EAPPacket: - *MsgType = MT2_EAPPacket; - break; - case EAPOLStart: - *MsgType = MT2_EAPOLStart; - break; - case EAPOLLogoff: - *MsgType = MT2_EAPOLLogoff; - break; - case EAPOLKey: - *MsgType = MT2_EAPOLKey; - break; - case EAPOLASFAlert: - *MsgType = MT2_EAPOLASFAlert; - break; - default: - return FALSE; - } - return TRUE; -} - -/* - ========================================================================== - Description: - association state machine init, including state transition and timer init - Parameters: - S - pointer to the association state machine - ========================================================================== - */ -VOID WpaPskStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - OUT STATE_MACHINE_FUNC Trans[]) -{ - StateMachineInit(S, Trans, MAX_WPA_PSK_STATE, MAX_WPA_PSK_MSG, (STATE_MACHINE_FUNC)Drop, WPA_PSK_IDLE, WPA_MACHINE_BASE); - StateMachineSetAction(S, WPA_PSK_IDLE, MT2_EAPOLKey, (STATE_MACHINE_FUNC)WpaEAPOLKeyAction); -} - -/* - ========================================================================== - Description: - This is state machine function. - When receiving EAPOL packets which is for 802.1x key management. - Use both in WPA, and WPAPSK case. - In this function, further dispatch to different functions according to the received packet. 3 categories are : - 1. normal 4-way pairwisekey and 2-way groupkey handshake - 2. MIC error (Countermeasures attack) report packet from STA. - 3. Request for pairwise/group key update from STA - Return: - ========================================================================== -*/ -VOID WpaEAPOLKeyAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) - -{ - INT MsgType = EAPOL_MSG_INVALID; - PKEY_DESCRIPTER pKeyDesc; - PHEADER_802_11 pHeader; //red - UCHAR ZeroReplay[LEN_KEY_DESC_REPLAY]; - UCHAR EapolVr; - KEY_INFO peerKeyInfo; - - DBGPRINT(RT_DEBUG_TRACE, ("-----> WpaEAPOLKeyAction\n")); - - // Get 802.11 header first - pHeader = (PHEADER_802_11) Elem->Msg; - - // Get EAPoL-Key Descriptor - pKeyDesc = (PKEY_DESCRIPTER) &Elem->Msg[(LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H)]; - - NdisZeroMemory((PUCHAR)&peerKeyInfo, sizeof(peerKeyInfo)); - NdisMoveMemory((PUCHAR)&peerKeyInfo, (PUCHAR)&pKeyDesc->KeyInfo, sizeof(KEY_INFO)); - - *((USHORT *)&peerKeyInfo) = cpu2le16(*((USHORT *)&peerKeyInfo)); - - - // 1. Check EAPOL frame version and type - EapolVr = (UCHAR) Elem->Msg[LENGTH_802_11+LENGTH_802_1_H]; - - if (((EapolVr != EAPOL_VER) && (EapolVr != EAPOL_VER2)) || ((pKeyDesc->Type != WPA1_KEY_DESC) && (pKeyDesc->Type != WPA2_KEY_DESC))) - { - DBGPRINT(RT_DEBUG_ERROR, ("Key descripter does not match with WPA rule\n")); - return; - } - - // First validate replay counter, only accept message with larger replay counter - // Let equal pass, some AP start with all zero replay counter - NdisZeroMemory(ZeroReplay, LEN_KEY_DESC_REPLAY); - - if((RTMPCompareMemory(pKeyDesc->ReplayCounter, pAd->StaCfg.ReplayCounter, LEN_KEY_DESC_REPLAY) != 1) && - (RTMPCompareMemory(pKeyDesc->ReplayCounter, ZeroReplay, LEN_KEY_DESC_REPLAY) != 0)) - { - DBGPRINT(RT_DEBUG_ERROR, (" ReplayCounter not match \n")); - return; - } - - // Process WPA2PSK frame - if(pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) - { - if((peerKeyInfo.KeyType == PAIRWISEKEY) && - (peerKeyInfo.EKD_DL == 0) && - (peerKeyInfo.KeyAck == 1) && - (peerKeyInfo.KeyMic == 0) && - (peerKeyInfo.Secure == 0) && - (peerKeyInfo.Error == 0) && - (peerKeyInfo.Request == 0)) - { - MsgType = EAPOL_PAIR_MSG_1; - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOL Key Pairwise Message 1\n")); - } else if((peerKeyInfo.KeyType == PAIRWISEKEY) && - (peerKeyInfo.EKD_DL == 1) && - (peerKeyInfo.KeyAck == 1) && - (peerKeyInfo.KeyMic == 1) && - (peerKeyInfo.Secure == 1) && - (peerKeyInfo.Error == 0) && - (peerKeyInfo.Request == 0)) - { - MsgType = EAPOL_PAIR_MSG_3; - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOL Key Pairwise Message 3\n")); - } else if((peerKeyInfo.KeyType == GROUPKEY) && - (peerKeyInfo.EKD_DL == 1) && - (peerKeyInfo.KeyAck == 1) && - (peerKeyInfo.KeyMic == 1) && - (peerKeyInfo.Secure == 1) && - (peerKeyInfo.Error == 0) && - (peerKeyInfo.Request == 0)) - { - MsgType = EAPOL_GROUP_MSG_1; - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOL Key Group Message 1\n")); - } - - // We will assume link is up (assoc suceess and port not secured). - // All state has to be able to process message from previous state - switch(pAd->StaCfg.WpaState) - { - case SS_START: - if(MsgType == EAPOL_PAIR_MSG_1) - { - Wpa2PairMsg1Action(pAd, Elem); - pAd->StaCfg.WpaState = SS_WAIT_MSG_3; - } - break; - - case SS_WAIT_MSG_3: - if(MsgType == EAPOL_PAIR_MSG_1) - { - Wpa2PairMsg1Action(pAd, Elem); - pAd->StaCfg.WpaState = SS_WAIT_MSG_3; - } - else if(MsgType == EAPOL_PAIR_MSG_3) - { - Wpa2PairMsg3Action(pAd, Elem); - pAd->StaCfg.WpaState = SS_WAIT_GROUP; - } - break; - - case SS_WAIT_GROUP: // When doing group key exchange - case SS_FINISH: // This happened when update group key - if(MsgType == EAPOL_PAIR_MSG_1) - { - // Reset port secured variable - pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - Wpa2PairMsg1Action(pAd, Elem); - pAd->StaCfg.WpaState = SS_WAIT_MSG_3; - } - else if(MsgType == EAPOL_PAIR_MSG_3) - { - // Reset port secured variable - pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - Wpa2PairMsg3Action(pAd, Elem); - pAd->StaCfg.WpaState = SS_WAIT_GROUP; - } - else if(MsgType == EAPOL_GROUP_MSG_1) - { - WpaGroupMsg1Action(pAd, Elem); - pAd->StaCfg.WpaState = SS_FINISH; - } - break; - - default: - break; - } - } - // Process WPAPSK Frame - // Classify message Type, either pairwise message 1, 3, or group message 1 for supplicant - else if(pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) - { - if((peerKeyInfo.KeyType == PAIRWISEKEY) && - (peerKeyInfo.KeyIndex == 0) && - (peerKeyInfo.KeyAck == 1) && - (peerKeyInfo.KeyMic == 0) && - (peerKeyInfo.Secure == 0) && - (peerKeyInfo.Error == 0) && - (peerKeyInfo.Request == 0)) - { - MsgType = EAPOL_PAIR_MSG_1; - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOL Key Pairwise Message 1\n")); - } - else if((peerKeyInfo.KeyType == PAIRWISEKEY) && - (peerKeyInfo.KeyIndex == 0) && - (peerKeyInfo.KeyAck == 1) && - (peerKeyInfo.KeyMic == 1) && - (peerKeyInfo.Secure == 0) && - (peerKeyInfo.Error == 0) && - (peerKeyInfo.Request == 0)) - { - MsgType = EAPOL_PAIR_MSG_3; - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOL Key Pairwise Message 3\n")); - } - else if((peerKeyInfo.KeyType == GROUPKEY) && - (peerKeyInfo.KeyIndex != 0) && - (peerKeyInfo.KeyAck == 1) && - (peerKeyInfo.KeyMic == 1) && - (peerKeyInfo.Secure == 1) && - (peerKeyInfo.Error == 0) && - (peerKeyInfo.Request == 0)) - { - MsgType = EAPOL_GROUP_MSG_1; - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOL Key Group Message 1\n")); - } - - // We will assume link is up (assoc suceess and port not secured). - // All state has to be able to process message from previous state - switch(pAd->StaCfg.WpaState) - { - case SS_START: - if(MsgType == EAPOL_PAIR_MSG_1) - { - WpaPairMsg1Action(pAd, Elem); - pAd->StaCfg.WpaState = SS_WAIT_MSG_3; - } - break; - - case SS_WAIT_MSG_3: - if(MsgType == EAPOL_PAIR_MSG_1) - { - WpaPairMsg1Action(pAd, Elem); - pAd->StaCfg.WpaState = SS_WAIT_MSG_3; - } - else if(MsgType == EAPOL_PAIR_MSG_3) - { - WpaPairMsg3Action(pAd, Elem); - pAd->StaCfg.WpaState = SS_WAIT_GROUP; - } - break; - - case SS_WAIT_GROUP: // When doing group key exchange - case SS_FINISH: // This happened when update group key - if(MsgType == EAPOL_PAIR_MSG_1) - { - WpaPairMsg1Action(pAd, Elem); - pAd->StaCfg.WpaState = SS_WAIT_MSG_3; - // Reset port secured variable - pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - } - else if(MsgType == EAPOL_PAIR_MSG_3) - { - WpaPairMsg3Action(pAd, Elem); - pAd->StaCfg.WpaState = SS_WAIT_GROUP; - // Reset port secured variable - pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - } - else if(MsgType == EAPOL_GROUP_MSG_1) - { - WpaGroupMsg1Action(pAd, Elem); - pAd->StaCfg.WpaState = SS_FINISH; - } - break; - - default: - break; - } - } - - DBGPRINT(RT_DEBUG_TRACE, ("<----- WpaEAPOLKeyAction\n")); -} - -/* - ======================================================================== - - Routine Description: - Process Pairwise key 4-way handshaking - - Arguments: - pAd Pointer to our adapter - Elem Message body - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID WpaPairMsg1Action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - PHEADER_802_11 pHeader; - UCHAR *mpool, *PTK, *digest; - PUCHAR pOutBuffer = NULL; - UCHAR Header802_3[14]; - ULONG FrameLen = 0; - PEAPOL_PACKET pMsg1; - EAPOL_PACKET Packet; - UCHAR Mic[16]; - - DBGPRINT(RT_DEBUG_TRACE, ("WpaPairMsg1Action ----->\n")); - - // allocate memory pool - os_alloc_mem(pAd, (PUCHAR *)&mpool, 256); - - if (mpool == NULL) - return; - - // PTK Len = 80. - PTK = (UCHAR *) ROUND_UP(mpool, 4); - // digest Len = 80. - digest = (UCHAR *) ROUND_UP(PTK + 80, 4); - - pHeader = (PHEADER_802_11) Elem->Msg; - - // Process message 1 from authenticator - pMsg1 = (PEAPOL_PACKET) &Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; - - // 1. Save Replay counter, it will use to verify message 3 and construct message 2 - NdisMoveMemory(pAd->StaCfg.ReplayCounter, pMsg1->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - - // 2. Save ANonce - NdisMoveMemory(pAd->StaCfg.ANonce, pMsg1->KeyDesc.KeyNonce, LEN_KEY_DESC_NONCE); - - // Generate random SNonce - GenRandom(pAd, pAd->CurrentAddress, pAd->StaCfg.SNonce); - - // Calc PTK(ANonce, SNonce) - WpaCountPTK(pAd, - pAd->StaCfg.PMK, - pAd->StaCfg.ANonce, - pAd->CommonCfg.Bssid, - pAd->StaCfg.SNonce, - pAd->CurrentAddress, - PTK, - LEN_PTK); - - // Save key to PTK entry - NdisMoveMemory(pAd->StaCfg.PTK, PTK, LEN_PTK); - - // init 802.3 header and Fill Packet - MAKE_802_3_HEADER(Header802_3, pAd->CommonCfg.Bssid, pAd->CurrentAddress, EAPOL); - - // Zero Message 2 body - NdisZeroMemory(&Packet, sizeof(Packet)); - Packet.ProVer = EAPOL_VER; - Packet.ProType = EAPOLKey; - // - // Message 2 as EAPOL-Key(0,1,0,0,0,P,0,SNonce,MIC,RSN IE) - // - Packet.KeyDesc.Type = WPA1_KEY_DESC; - // 1. Key descriptor version and appropriate RSN IE - if(pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { - Packet.KeyDesc.KeyInfo.KeyDescVer = 2; - } - else // TKIP - { - Packet.KeyDesc.KeyInfo.KeyDescVer = 1; - } - - // fill in Data Material and its length - Packet.KeyDesc.KeyData[0] = IE_WPA; - Packet.KeyDesc.KeyData[1] = pAd->StaCfg.RSNIE_Len; - Packet.KeyDesc.KeyDataLen[1] = pAd->StaCfg.RSNIE_Len + 2; - NdisMoveMemory(&Packet.KeyDesc.KeyData[2], pAd->StaCfg.RSN_IE, pAd->StaCfg.RSNIE_Len); - - // Update packet length after decide Key data payload - Packet.Body_Len[1] = sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE + Packet.KeyDesc.KeyDataLen[1]; - - // Update Key length - Packet.KeyDesc.KeyLength[0] = pMsg1->KeyDesc.KeyLength[0]; - Packet.KeyDesc.KeyLength[1] = pMsg1->KeyDesc.KeyLength[1]; - // 2. Key Type PeerKey - Packet.KeyDesc.KeyInfo.KeyType = PAIRWISEKEY; - - // 3. KeyMic field presented - Packet.KeyDesc.KeyInfo.KeyMic = 1; - - //Convert to little-endian format. - *((USHORT *)&Packet.KeyDesc.KeyInfo) = cpu2le16(*((USHORT *)&Packet.KeyDesc.KeyInfo)); - - - // 4. Fill SNonce - NdisMoveMemory(Packet.KeyDesc.KeyNonce, pAd->StaCfg.SNonce, LEN_KEY_DESC_NONCE); - - // 5. Key Replay Count - NdisMoveMemory(Packet.KeyDesc.ReplayCounter, pAd->StaCfg.ReplayCounter, LEN_KEY_DESC_REPLAY); - - // Send EAPOL(0, 1, 0, 0, 0, P, 0, SNonce, MIC, RSN_IE) - // Out buffer for transmitting message 2 - MlmeAllocateMemory(pAd, (PUCHAR *)&pOutBuffer); // allocate memory - if(pOutBuffer == NULL) - { - os_free_mem(pAd, mpool); - return; - } - // Prepare EAPOL frame for MIC calculation - // Be careful, only EAPOL frame is counted for MIC calculation - MakeOutgoingFrame(pOutBuffer, &FrameLen, - Packet.Body_Len[1] + 4, &Packet, - END_OF_ARGS); - - // 6. Prepare and Fill MIC value - NdisZeroMemory(Mic, sizeof(Mic)); - if(pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { // AES - - HMAC_SHA1(pOutBuffer, FrameLen, PTK, LEN_EAP_MICK, digest); - NdisMoveMemory(Mic, digest, LEN_KEY_DESC_MIC); - } - else - { // TKIP - hmac_md5(PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, Mic); - } - NdisMoveMemory(Packet.KeyDesc.KeyMic, Mic, LEN_KEY_DESC_MIC); - - //hex_dump("MIC", Mic, LEN_KEY_DESC_MIC); - - MakeOutgoingFrame(pOutBuffer, &FrameLen, - LENGTH_802_3, &Header802_3, - Packet.Body_Len[1] + 4, &Packet, - END_OF_ARGS); - - - // 5. Copy frame to Tx ring and send Msg 2 to authenticator - RTMPToWirelessSta(pAd, Header802_3, LENGTH_802_3, (PUCHAR)&Packet, Packet.Body_Len[1] + 4, TRUE); - - MlmeFreeMemory(pAd, (PUCHAR)pOutBuffer); - os_free_mem(pAd, (PUCHAR)mpool); - - DBGPRINT(RT_DEBUG_TRACE, ("WpaPairMsg1Action <-----\n")); -} - -VOID Wpa2PairMsg1Action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - PHEADER_802_11 pHeader; - UCHAR *mpool, *PTK, *digest; - PUCHAR pOutBuffer = NULL; - UCHAR Header802_3[14]; - ULONG FrameLen = 0; - PEAPOL_PACKET pMsg1; - EAPOL_PACKET Packet; - UCHAR Mic[16]; - - DBGPRINT(RT_DEBUG_TRACE, ("Wpa2PairMsg1Action ----->\n")); - - // allocate memory pool - os_alloc_mem(pAd, (PUCHAR *)&mpool, 256); - - if (mpool == NULL) - return; - - // PTK Len = 80. - PTK = (UCHAR *) ROUND_UP(mpool, 4); - // digest Len = 80. - digest = (UCHAR *) ROUND_UP(PTK + 80, 4); - - pHeader = (PHEADER_802_11) Elem->Msg; - - // Process message 1 from authenticator - pMsg1 = (PEAPOL_PACKET) &Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; - - // 1. Save Replay counter, it will use to verify message 3 and construct message 2 - NdisMoveMemory(pAd->StaCfg.ReplayCounter, pMsg1->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - - // 2. Save ANonce - NdisMoveMemory(pAd->StaCfg.ANonce, pMsg1->KeyDesc.KeyNonce, LEN_KEY_DESC_NONCE); - - // Generate random SNonce - GenRandom(pAd, pAd->CurrentAddress, pAd->StaCfg.SNonce); - - if(pMsg1->KeyDesc.KeyDataLen[1] > 0 ) - { - // cached PMKID - } - - // Calc PTK(ANonce, SNonce) - WpaCountPTK(pAd, - pAd->StaCfg.PMK, - pAd->StaCfg.ANonce, - pAd->CommonCfg.Bssid, - pAd->StaCfg.SNonce, - pAd->CurrentAddress, - PTK, - LEN_PTK); - - // Save key to PTK entry - NdisMoveMemory(pAd->StaCfg.PTK, PTK, LEN_PTK); - - // init 802.3 header and Fill Packet - MAKE_802_3_HEADER(Header802_3, pAd->CommonCfg.Bssid, pAd->CurrentAddress, EAPOL); - - // Zero message 2 body - NdisZeroMemory(&Packet, sizeof(Packet)); - Packet.ProVer = EAPOL_VER; - Packet.ProType = EAPOLKey; - // - // Message 2 as EAPOL-Key(0,1,0,0,0,P,0,SNonce,MIC,RSN IE) - // - Packet.KeyDesc.Type = WPA2_KEY_DESC; - - // 1. Key descriptor version and appropriate RSN IE - if(pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { - Packet.KeyDesc.KeyInfo.KeyDescVer = 2; - } - else // TKIP - { - Packet.KeyDesc.KeyInfo.KeyDescVer = 1; - } - - // fill in Data Material and its length - Packet.KeyDesc.KeyData[0] = IE_WPA2; - Packet.KeyDesc.KeyData[1] = pAd->StaCfg.RSNIE_Len; - Packet.KeyDesc.KeyDataLen[1] = pAd->StaCfg.RSNIE_Len + 2; - NdisMoveMemory(&Packet.KeyDesc.KeyData[2], pAd->StaCfg.RSN_IE, pAd->StaCfg.RSNIE_Len); - - // Update packet length after decide Key data payload - Packet.Body_Len[1] = sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE + Packet.KeyDesc.KeyDataLen[1]; - - // 2. Key Type PeerKey - Packet.KeyDesc.KeyInfo.KeyType = PAIRWISEKEY; - - // 3. KeyMic field presented - Packet.KeyDesc.KeyInfo.KeyMic = 1; - - // Update Key Length - Packet.KeyDesc.KeyLength[0] = 0; - Packet.KeyDesc.KeyLength[1] = pMsg1->KeyDesc.KeyLength[1]; - - // 4. Fill SNonce - NdisMoveMemory(Packet.KeyDesc.KeyNonce, pAd->StaCfg.SNonce, LEN_KEY_DESC_NONCE); - - // 5. Key Replay Count - NdisMoveMemory(Packet.KeyDesc.ReplayCounter, pAd->StaCfg.ReplayCounter, LEN_KEY_DESC_REPLAY); - - // Convert to little-endian format. - *((USHORT *)&Packet.KeyDesc.KeyInfo) = cpu2le16(*((USHORT *)&Packet.KeyDesc.KeyInfo)); - - // Send EAPOL-Key(0,1,0,0,0,P,0,SNonce,MIC,RSN IE) - // Out buffer for transmitting message 2 - MlmeAllocateMemory(pAd, (PUCHAR *)&pOutBuffer); // allocate memory - if(pOutBuffer == NULL) - { - os_free_mem(pAd, mpool); - return; - } - - // Prepare EAPOL frame for MIC calculation - // Be careful, only EAPOL frame is counted for MIC calculation - MakeOutgoingFrame(pOutBuffer, &FrameLen, - Packet.Body_Len[1] + 4, &Packet, - END_OF_ARGS); - - // 6. Prepare and Fill MIC value - NdisZeroMemory(Mic, sizeof(Mic)); - if(pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { - // AES - HMAC_SHA1(pOutBuffer, FrameLen, PTK, LEN_EAP_MICK, digest); - NdisMoveMemory(Mic, digest, LEN_KEY_DESC_MIC); - } - else - { - hmac_md5(PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, Mic); - } - NdisMoveMemory(Packet.KeyDesc.KeyMic, Mic, LEN_KEY_DESC_MIC); - - - // Make Transmitting frame - MakeOutgoingFrame(pOutBuffer, &FrameLen, - LENGTH_802_3, &Header802_3, - Packet.Body_Len[1] + 4, &Packet, - END_OF_ARGS); - - - // 5. Copy frame to Tx ring - RTMPToWirelessSta(pAd, Header802_3, LENGTH_802_3, (PUCHAR)&Packet, Packet.Body_Len[1] + 4, TRUE); - - MlmeFreeMemory(pAd, pOutBuffer); - os_free_mem(pAd, mpool); - - DBGPRINT(RT_DEBUG_TRACE, ("Wpa2PairMsg1Action <-----\n")); - -} - -/* - ======================================================================== - - Routine Description: - Process Pairwise key 4-way handshaking - - Arguments: - pAd Pointer to our adapter - Elem Message body - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID WpaPairMsg3Action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) - -{ - PHEADER_802_11 pHeader; - PUCHAR pOutBuffer = NULL; - UCHAR Header802_3[14]; - ULONG FrameLen = 0; - EAPOL_PACKET Packet; - PEAPOL_PACKET pMsg3; - UCHAR Mic[16], OldMic[16]; - MAC_TABLE_ENTRY *pEntry = NULL; - UCHAR skip_offset; - KEY_INFO peerKeyInfo; - - DBGPRINT(RT_DEBUG_TRACE, ("WpaPairMsg3Action ----->\n")); - - // Record 802.11 header & the received EAPOL packet Msg3 - pHeader = (PHEADER_802_11) Elem->Msg; - pMsg3 = (PEAPOL_PACKET) &Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; - - NdisZeroMemory((PUCHAR)&peerKeyInfo, sizeof(peerKeyInfo)); - NdisMoveMemory((PUCHAR)&peerKeyInfo, (PUCHAR)&pMsg3->KeyDesc.KeyInfo, sizeof(KEY_INFO)); - - *((USHORT*)&peerKeyInfo) = cpu2le16(*((USHORT*)&peerKeyInfo)); - - - // 1. Verify cipher type match - if (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled && (peerKeyInfo.KeyDescVer != 2)) - { - return; - } - else if(pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled && (peerKeyInfo.KeyDescVer != 1)) - { - return; - } - - // Verify RSN IE - //if (!RTMPEqualMemory(pMsg3->KeyDesc.KeyData, pAd->MacTab.Content[BSSID_WCID].RSN_IE, pAd->MacTab.Content[BSSID_WCID].RSNIE_Len)) - if (!CheckRSNIE(pAd, pMsg3->KeyDesc.KeyData, pMsg3->KeyDesc.KeyDataLen[1], &skip_offset)) - { - DBGPRINT(RT_DEBUG_ERROR, ("RSN_IE Different in Msg 3 of WPA1 4-way handshake!! \n")); - hex_dump("The original RSN_IE", pAd->MacTab.Content[BSSID_WCID].RSN_IE, pAd->MacTab.Content[BSSID_WCID].RSNIE_Len); - hex_dump("The received RSN_IE", pMsg3->KeyDesc.KeyData, pMsg3->KeyDesc.KeyDataLen[1]); - return; - } - else - DBGPRINT(RT_DEBUG_TRACE, ("RSN_IE VALID in Msg 3 of WPA1 4-way handshake!! \n")); - - - // 2. Check MIC value - // Save the MIC and replace with zero - NdisMoveMemory(OldMic, pMsg3->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); - NdisZeroMemory(pMsg3->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); - if(pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { - // AES - UCHAR digest[80]; - - HMAC_SHA1((PUCHAR) pMsg3, pMsg3->Body_Len[1] + 4, pAd->StaCfg.PTK, LEN_EAP_MICK, digest); - NdisMoveMemory(Mic, digest, LEN_KEY_DESC_MIC); - } - else // TKIP - { - hmac_md5(pAd->StaCfg.PTK, LEN_EAP_MICK, (PUCHAR) pMsg3, pMsg3->Body_Len[1] + 4, Mic); - } - - if(!NdisEqualMemory(OldMic, Mic, LEN_KEY_DESC_MIC)) - { - DBGPRINT(RT_DEBUG_ERROR, (" MIC Different in msg 3 of 4-way handshake!!!!!!!!!! \n")); - return; - } - else - DBGPRINT(RT_DEBUG_TRACE, (" MIC VALID in msg 3 of 4-way handshake!!!!!!!!!! \n")); - - // 3. Check Replay Counter, it has to be larger than last one. No need to be exact one larger - if(RTMPCompareMemory(pMsg3->KeyDesc.ReplayCounter, pAd->StaCfg.ReplayCounter, LEN_KEY_DESC_REPLAY) != 1) - return; - - // Update new replay counter - NdisMoveMemory(pAd->StaCfg.ReplayCounter, pMsg3->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - - // 4. Double check ANonce - if(!NdisEqualMemory(pAd->StaCfg.ANonce, pMsg3->KeyDesc.KeyNonce, LEN_KEY_DESC_NONCE)) - return; - - // init 802.3 header and Fill Packet - MAKE_802_3_HEADER(Header802_3, pAd->CommonCfg.Bssid, pAd->CurrentAddress, EAPOL); - - // Zero Message 4 body - NdisZeroMemory(&Packet, sizeof(Packet)); - Packet.ProVer = EAPOL_VER; - Packet.ProType = EAPOLKey; - Packet.Body_Len[1] = sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE; // No data field - - // - // Message 4 as EAPOL-Key(0,1,0,0,0,P,0,0,MIC,0) - // - Packet.KeyDesc.Type = WPA1_KEY_DESC; - - // Key descriptor version and appropriate RSN IE - Packet.KeyDesc.KeyInfo.KeyDescVer = peerKeyInfo.KeyDescVer; - - // Update Key Length - Packet.KeyDesc.KeyLength[0] = pMsg3->KeyDesc.KeyLength[0]; - Packet.KeyDesc.KeyLength[1] = pMsg3->KeyDesc.KeyLength[1]; - - // Key Type PeerKey - Packet.KeyDesc.KeyInfo.KeyType = PAIRWISEKEY; - - // KeyMic field presented - Packet.KeyDesc.KeyInfo.KeyMic = 1; - - // In Msg3, KeyInfo.secure =0 if Group Key HS to come. 1 if no group key HS - // Station sends Msg4 KeyInfo.secure should be the same as that in Msg.3 - Packet.KeyDesc.KeyInfo.Secure= peerKeyInfo.Secure; - - // Convert to little-endian format. - *((USHORT *)&Packet.KeyDesc.KeyInfo) = cpu2le16(*((USHORT *)&Packet.KeyDesc.KeyInfo)); - - // Key Replay count - NdisMoveMemory(Packet.KeyDesc.ReplayCounter, pMsg3->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - - // Out buffer for transmitting message 4 - MlmeAllocateMemory(pAd, (PUCHAR *)&pOutBuffer); // allocate memory - if(pOutBuffer == NULL) - return; - - // Prepare EAPOL frame for MIC calculation - // Be careful, only EAPOL frame is counted for MIC calculation - MakeOutgoingFrame(pOutBuffer, &FrameLen, - Packet.Body_Len[1] + 4, &Packet, - END_OF_ARGS); - - // Prepare and Fill MIC value - NdisZeroMemory(Mic, sizeof(Mic)); - if(pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { - // AES - UCHAR digest[80]; - - HMAC_SHA1(pOutBuffer, FrameLen, pAd->StaCfg.PTK, LEN_EAP_MICK, digest); - NdisMoveMemory(Mic, digest, LEN_KEY_DESC_MIC); - } - else - { - hmac_md5(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, Mic); - } - NdisMoveMemory(Packet.KeyDesc.KeyMic, Mic, LEN_KEY_DESC_MIC); - - // Update PTK - // Prepare pair-wise key information into shared key table - NdisZeroMemory(&pAd->SharedKey[BSS0][0], sizeof(CIPHER_KEY)); - pAd->SharedKey[BSS0][0].KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pAd->SharedKey[BSS0][0].Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); - NdisMoveMemory(pAd->SharedKey[BSS0][0].RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_RXMICK); - NdisMoveMemory(pAd->SharedKey[BSS0][0].TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); - - // Decide its ChiperAlg - if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) - pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_TKIP; - else if (pAd->StaCfg.PairCipher == Ndis802_11Encryption3Enabled) - pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_AES; - else - pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_NONE; - - // Update these related information to MAC_TABLE_ENTRY - pEntry = &pAd->MacTab.Content[BSSID_WCID]; - NdisMoveMemory(pEntry->PairwiseKey.Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); - NdisMoveMemory(pEntry->PairwiseKey.RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_RXMICK); - NdisMoveMemory(pEntry->PairwiseKey.TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); - pEntry->PairwiseKey.CipherAlg = pAd->SharedKey[BSS0][0].CipherAlg; - - // Update pairwise key information to ASIC Shared Key Table - AsicAddSharedKeyEntry(pAd, - BSS0, - 0, - pAd->SharedKey[BSS0][0].CipherAlg, - pAd->SharedKey[BSS0][0].Key, - pAd->SharedKey[BSS0][0].TxMic, - pAd->SharedKey[BSS0][0].RxMic); - - // Update ASIC WCID attribute table and IVEIV table - RTMPAddWcidAttributeEntry(pAd, - BSS0, - 0, - pAd->SharedKey[BSS0][0].CipherAlg, - pEntry); - - // Make transmitting frame - MakeOutgoingFrame(pOutBuffer, &FrameLen, - LENGTH_802_3, &Header802_3, - Packet.Body_Len[1] + 4, &Packet, - END_OF_ARGS); - - - // Copy frame to Tx ring and Send Message 4 to authenticator - RTMPToWirelessSta(pAd, Header802_3, LENGTH_802_3, (PUCHAR)&Packet, Packet.Body_Len[1] + 4, TRUE); - - MlmeFreeMemory(pAd, (PUCHAR)pOutBuffer); - - DBGPRINT(RT_DEBUG_TRACE, ("WpaPairMsg3Action <-----\n")); -} - -VOID Wpa2PairMsg3Action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) - -{ - PHEADER_802_11 pHeader; - PUCHAR pOutBuffer = NULL; - UCHAR Header802_3[14]; - ULONG FrameLen = 0; - EAPOL_PACKET Packet; - PEAPOL_PACKET pMsg3; - UCHAR Mic[16], OldMic[16]; - UCHAR *mpool, *KEYDATA, *digest; - UCHAR Key[32]; - MAC_TABLE_ENTRY *pEntry = NULL; - KEY_INFO peerKeyInfo; - - // allocate memory - os_alloc_mem(pAd, (PUCHAR *)&mpool, 1024); - - if(mpool == NULL) - return; - - // KEYDATA Len = 512. - KEYDATA = (UCHAR *) ROUND_UP(mpool, 4); - // digest Len = 80. - digest = (UCHAR *) ROUND_UP(KEYDATA + 512, 4); - - DBGPRINT(RT_DEBUG_TRACE, ("Wpa2PairMsg3Action ----->\n")); - - pHeader = (PHEADER_802_11) Elem->Msg; - - // Process message 3 frame. - pMsg3 = (PEAPOL_PACKET) &Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; - - NdisZeroMemory((PUCHAR)&peerKeyInfo, sizeof(peerKeyInfo)); - NdisMoveMemory((PUCHAR)&peerKeyInfo, (PUCHAR)&pMsg3->KeyDesc.KeyInfo, sizeof(KEY_INFO)); - - *((USHORT*)&peerKeyInfo) = cpu2le16(*((USHORT*)&peerKeyInfo)); - - // 1. Verify cipher type match - if (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled && (peerKeyInfo.KeyDescVer!= 2)) - { - os_free_mem(pAd, (PUCHAR)mpool); - return; - } - else if(pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled && (peerKeyInfo.KeyDescVer != 1)) - { - os_free_mem(pAd, (PUCHAR)mpool); - return; - } - - // 2. Check MIC value - // Save the MIC and replace with zero - NdisMoveMemory(OldMic, pMsg3->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); - NdisZeroMemory(pMsg3->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); - if (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { - // AES - HMAC_SHA1((PUCHAR) pMsg3, pMsg3->Body_Len[1] + 4, pAd->StaCfg.PTK, LEN_EAP_MICK, digest); - NdisMoveMemory(Mic, digest, LEN_KEY_DESC_MIC); - } - else - { - hmac_md5(pAd->StaCfg.PTK, LEN_EAP_MICK, (PUCHAR) pMsg3, pMsg3->Body_Len[1] + 4, Mic); - } - - if(!NdisEqualMemory(OldMic, Mic, LEN_KEY_DESC_MIC)) - { - DBGPRINT(RT_DEBUG_ERROR, (" MIC Different in msg 3 of 4-way handshake!!!!!!!!!! \n")); - os_free_mem(pAd, (PUCHAR)mpool); - return; - } - else - DBGPRINT(RT_DEBUG_TRACE, (" MIC VALID in msg 3 of 4-way handshake!!!!!!!!!! \n")); - - // 3. Check Replay Counter, it has to be larger than last one. No need to be exact one larger - if(RTMPCompareMemory(pMsg3->KeyDesc.ReplayCounter, pAd->StaCfg.ReplayCounter, LEN_KEY_DESC_REPLAY) != 1) - { - os_free_mem(pAd, (PUCHAR)mpool); - return; - } - - // Update new replay counter - NdisMoveMemory(pAd->StaCfg.ReplayCounter, pMsg3->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - - // 4. Double check ANonce - if(!NdisEqualMemory(pAd->StaCfg.ANonce, pMsg3->KeyDesc.KeyNonce, LEN_KEY_DESC_NONCE)) - { - os_free_mem(pAd, (PUCHAR)mpool); - return; - } - - // Obtain GTK - // 5. Decrypt GTK from Key Data - DBGPRINT_RAW(RT_DEBUG_TRACE, ("EKD = %d\n", peerKeyInfo.EKD_DL)); - if(pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { - // Decrypt AES GTK - AES_GTK_KEY_UNWRAP(&pAd->StaCfg.PTK[16], KEYDATA, pMsg3->KeyDesc.KeyDataLen[1],pMsg3->KeyDesc.KeyData); - } - else // TKIP - { - INT i; - // Decrypt TKIP GTK - // Construct 32 bytes RC4 Key - NdisMoveMemory(Key, pMsg3->KeyDesc.KeyIv, 16); - NdisMoveMemory(&Key[16], &pAd->StaCfg.PTK[16], 16); - ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, Key, 32); - //discard first 256 bytes - for(i = 0; i < 256; i++) - ARCFOUR_BYTE(&pAd->PrivateInfo.WEPCONTEXT); - // Decrypt GTK. Becareful, there is no ICV to check the result is correct or not - ARCFOUR_DECRYPT(&pAd->PrivateInfo.WEPCONTEXT, KEYDATA, pMsg3->KeyDesc.KeyData, pMsg3->KeyDesc.KeyDataLen[1]); - } - - if (!ParseKeyData(pAd, KEYDATA, pMsg3->KeyDesc.KeyDataLen[1], 1)) - { - os_free_mem(pAd, (PUCHAR)mpool); - return; - } - - // Update GTK to ASIC - // Update group key information to ASIC Shared Key Table - AsicAddSharedKeyEntry(pAd, - BSS0, - pAd->StaCfg.DefaultKeyId, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].Key, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].TxMic, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].RxMic); - - // Update ASIC WCID attribute table and IVEIV table - RTMPAddWcidAttributeEntry(pAd, - BSS0, - pAd->StaCfg.DefaultKeyId, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg, - NULL); - - // init 802.3 header and Fill Packet - MAKE_802_3_HEADER(Header802_3, pAd->CommonCfg.Bssid, pAd->CurrentAddress, EAPOL); - - // Zero message 4 body - NdisZeroMemory(&Packet, sizeof(Packet)); - Packet.ProVer = EAPOL_VER; - Packet.ProType = EAPOLKey; - Packet.Body_Len[1] = sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE; // No data field - - // - // Message 4 as EAPOL-Key(0,1,0,0,0,P,0,0,MIC,0) - // - Packet.KeyDesc.Type = WPA2_KEY_DESC; - - // Key descriptor version and appropriate RSN IE - Packet.KeyDesc.KeyInfo.KeyDescVer = peerKeyInfo.KeyDescVer; - - // Update Key Length - Packet.KeyDesc.KeyLength[0] = pMsg3->KeyDesc.KeyLength[0]; - Packet.KeyDesc.KeyLength[1] = pMsg3->KeyDesc.KeyLength[1]; - - // Key Type PeerKey - Packet.KeyDesc.KeyInfo.KeyType = PAIRWISEKEY; - - // KeyMic field presented - Packet.KeyDesc.KeyInfo.KeyMic = 1; - Packet.KeyDesc.KeyInfo.Secure = 1; - - // Convert to little-endian format. - *((USHORT *)&Packet.KeyDesc.KeyInfo) = cpu2le16(*((USHORT *)&Packet.KeyDesc.KeyInfo)); - - // Key Replay count - NdisMoveMemory(Packet.KeyDesc.ReplayCounter, pMsg3->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - - // Out buffer for transmitting message 4 - MlmeAllocateMemory(pAd, (PUCHAR *)&pOutBuffer); // allocate memory - if(pOutBuffer == NULL) - { - os_free_mem(pAd, (PUCHAR)mpool); - return; - } - - // Prepare EAPOL frame for MIC calculation - // Be careful, only EAPOL frame is counted for MIC calculation - MakeOutgoingFrame(pOutBuffer, &FrameLen, - Packet.Body_Len[1] + 4, &Packet, - END_OF_ARGS); - - // Prepare and Fill MIC value - NdisZeroMemory(Mic, sizeof(Mic)); - if(pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { - // AES - HMAC_SHA1(pOutBuffer, FrameLen, pAd->StaCfg.PTK, LEN_EAP_MICK, digest); - NdisMoveMemory(Mic, digest, LEN_KEY_DESC_MIC); - } - else - { - hmac_md5(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, Mic); - } - NdisMoveMemory(Packet.KeyDesc.KeyMic, Mic, LEN_KEY_DESC_MIC); - - // Update PTK - // Prepare pair-wise key information into shared key table - NdisZeroMemory(&pAd->SharedKey[BSS0][0], sizeof(CIPHER_KEY)); - pAd->SharedKey[BSS0][0].KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pAd->SharedKey[BSS0][0].Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); - NdisMoveMemory(pAd->SharedKey[BSS0][0].RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_RXMICK); - NdisMoveMemory(pAd->SharedKey[BSS0][0].TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); - - // Decide its ChiperAlg - if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) - pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_TKIP; - else if (pAd->StaCfg.PairCipher == Ndis802_11Encryption3Enabled) - pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_AES; - else - pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_NONE; - - // Update these related information to MAC_TABLE_ENTRY - pEntry = &pAd->MacTab.Content[BSSID_WCID]; - NdisMoveMemory(&pEntry->PairwiseKey.Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); - NdisMoveMemory(&pEntry->PairwiseKey.RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_RXMICK); - NdisMoveMemory(&pEntry->PairwiseKey.TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); - pEntry->PairwiseKey.CipherAlg = pAd->SharedKey[BSS0][0].CipherAlg; - - // Update pairwise key information to ASIC Shared Key Table - AsicAddSharedKeyEntry(pAd, - BSS0, - 0, - pAd->SharedKey[BSS0][0].CipherAlg, - pAd->SharedKey[BSS0][0].Key, - pAd->SharedKey[BSS0][0].TxMic, - pAd->SharedKey[BSS0][0].RxMic); - - // Update ASIC WCID attribute table and IVEIV table - RTMPAddWcidAttributeEntry(pAd, - BSS0, - 0, - pAd->SharedKey[BSS0][0].CipherAlg, - pEntry); - - // Make Transmitting frame - MakeOutgoingFrame(pOutBuffer, &FrameLen, - LENGTH_802_3, &Header802_3, - Packet.Body_Len[1] + 4, &Packet, - END_OF_ARGS); - - - // Copy frame to Tx ring and Send Message 4 to authenticator - RTMPToWirelessSta(pAd, Header802_3, LENGTH_802_3, (PUCHAR)&Packet, Packet.Body_Len[1] + 4, TRUE); - - // set 802.1x port control - STA_PORT_SECURED(pAd); - - // Indicate Connected for GUI - pAd->IndicateMediaState = NdisMediaStateConnected; - - MlmeFreeMemory(pAd, (PUCHAR)pOutBuffer); - os_free_mem(pAd, (PUCHAR)mpool); - - - // send wireless event - for set key done WPA2 - if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_SET_KEY_DONE_WPA2_EVENT_FLAG, pEntry->Addr, BSS0, 0); - - DBGPRINT(RT_DEBUG_ERROR, ("Wpa2PairMsg3Action <-----\n")); - -} - -/* - ======================================================================== - - Routine Description: - Process Group key 2-way handshaking - - Arguments: - pAd Pointer to our adapter - Elem Message body - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID WpaGroupMsg1Action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) - -{ - PUCHAR pOutBuffer = NULL; - UCHAR Header802_3[14]; - ULONG FrameLen = 0; - EAPOL_PACKET Packet; - PEAPOL_PACKET pGroup; - UCHAR *mpool, *digest, *KEYDATA; - UCHAR Mic[16], OldMic[16]; - UCHAR GTK[32], Key[32]; - KEY_INFO peerKeyInfo; - - // allocate memory - os_alloc_mem(pAd, (PUCHAR *)&mpool, 1024); - - if(mpool == NULL) - return; - - // digest Len = 80. - digest = (UCHAR *) ROUND_UP(mpool, 4); - // KEYDATA Len = 512. - KEYDATA = (UCHAR *) ROUND_UP(digest + 80, 4); - - DBGPRINT(RT_DEBUG_TRACE, ("WpaGroupMsg1Action ----->\n")); - - // Process Group Message 1 frame. skip 802.11 header(24) & LLC_SNAP header(8) - pGroup = (PEAPOL_PACKET) &Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; - - NdisZeroMemory((PUCHAR)&peerKeyInfo, sizeof(peerKeyInfo)); - NdisMoveMemory((PUCHAR)&peerKeyInfo, (PUCHAR)&pGroup->KeyDesc.KeyInfo, sizeof(KEY_INFO)); - - *((USHORT*)&peerKeyInfo) = cpu2le16(*((USHORT*)&peerKeyInfo)); - - // 0. Check cipher type match - if (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled && (peerKeyInfo.KeyDescVer != 2)) - { - os_free_mem(pAd, (PUCHAR)mpool); - return; - } - else if (pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled && (peerKeyInfo.KeyDescVer != 1)) - { - os_free_mem(pAd, (PUCHAR)mpool); - return; - } - - // 1. Verify Replay counter - // Check Replay Counter, it has to be larger than last one. No need to be exact one larger - if(RTMPCompareMemory(pGroup->KeyDesc.ReplayCounter, pAd->StaCfg.ReplayCounter, LEN_KEY_DESC_REPLAY) != 1) - { - os_free_mem(pAd, (PUCHAR)mpool); - return; - } - - // Update new replay counter - NdisMoveMemory(pAd->StaCfg.ReplayCounter, pGroup->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - - // 2. Verify MIC is valid - // Save the MIC and replace with zero - NdisMoveMemory(OldMic, pGroup->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); - NdisZeroMemory(pGroup->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); - - if(pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { // AES - HMAC_SHA1((PUCHAR) pGroup, pGroup->Body_Len[1] + 4, pAd->StaCfg.PTK, LEN_EAP_MICK, digest); - NdisMoveMemory(Mic, digest, LEN_KEY_DESC_MIC); - } - else - { // TKIP - hmac_md5(pAd->StaCfg.PTK, LEN_EAP_MICK, (PUCHAR) pGroup, pGroup->Body_Len[1] + 4, Mic); - } - - if(!NdisEqualMemory(OldMic, Mic, LEN_KEY_DESC_MIC)) - { - DBGPRINT(RT_DEBUG_ERROR, (" MIC Different in group msg 1 of 2-way handshake!!!!!!!!!! \n")); - MlmeFreeMemory(pAd, (PUCHAR)mpool); - return; - } - else - DBGPRINT(RT_DEBUG_TRACE, (" MIC VALID in group msg 1 of 2-way handshake!!!!!!!!!! \n")); - - - // 3. Decrypt GTK from Key Data - if (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { - // Decrypt AES GTK - AES_GTK_KEY_UNWRAP(&pAd->StaCfg.PTK[16], KEYDATA, pGroup->KeyDesc.KeyDataLen[1], pGroup->KeyDesc.KeyData); - } - else // TKIP - { - INT i; - - // Decrypt TKIP GTK - // Construct 32 bytes RC4 Key - NdisMoveMemory(Key, pGroup->KeyDesc.KeyIv, 16); - NdisMoveMemory(&Key[16], &pAd->StaCfg.PTK[16], 16); - ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, Key, 32); - //discard first 256 bytes - for(i = 0; i < 256; i++) - ARCFOUR_BYTE(&pAd->PrivateInfo.WEPCONTEXT); - // Decrypt GTK. Becareful, there is no ICV to check the result is correct or not - ARCFOUR_DECRYPT(&pAd->PrivateInfo.WEPCONTEXT, KEYDATA, pGroup->KeyDesc.KeyData, pGroup->KeyDesc.KeyDataLen[1]); - } - - // Process decrypted key data material - // Parse keyData to handle KDE format for WPA2PSK - if (peerKeyInfo.EKD_DL) - { - if (!ParseKeyData(pAd, KEYDATA, pGroup->KeyDesc.KeyDataLen[1], 0)) - { - os_free_mem(pAd, (PUCHAR)mpool); - return; - } - } - else // WPAPSK - { - // set key material, TxMic and RxMic for WPAPSK - NdisMoveMemory(GTK, KEYDATA, 32); - NdisMoveMemory(pAd->StaCfg.GTK, GTK, 32); - pAd->StaCfg.DefaultKeyId = peerKeyInfo.KeyIndex; - - // Prepare pair-wise key information into shared key table - NdisZeroMemory(&pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId], sizeof(CIPHER_KEY)); - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].Key, GTK, LEN_TKIP_EK); - NdisMoveMemory(pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].RxMic, >K[16], LEN_TKIP_RXMICK); - NdisMoveMemory(pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].TxMic, >K[24], LEN_TKIP_TXMICK); - - // Update Shared Key CipherAlg - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_NONE; - if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption2Enabled) - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_TKIP; - else if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption3Enabled) - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_AES; - else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP40Enabled) - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_WEP64; - else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP104Enabled) - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_WEP128; - - //hex_dump("Group Key :", pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].Key, LEN_TKIP_EK); - } - - // Update group key information to ASIC Shared Key Table - AsicAddSharedKeyEntry(pAd, - BSS0, - pAd->StaCfg.DefaultKeyId, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].Key, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].TxMic, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].RxMic); - - // Update ASIC WCID attribute table and IVEIV table - RTMPAddWcidAttributeEntry(pAd, - BSS0, - pAd->StaCfg.DefaultKeyId, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg, - NULL); - - // set 802.1x port control - STA_PORT_SECURED(pAd); - - // Indicate Connected for GUI - pAd->IndicateMediaState = NdisMediaStateConnected; - - // init header and Fill Packet - MAKE_802_3_HEADER(Header802_3, pAd->CommonCfg.Bssid, pAd->CurrentAddress, EAPOL); - - // Zero Group message 1 body - NdisZeroMemory(&Packet, sizeof(Packet)); - Packet.ProVer = EAPOL_VER; - Packet.ProType = EAPOLKey; - Packet.Body_Len[1] = sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE; // No data field - - // - // Group Message 2 as EAPOL-Key(1,0,0,0,G,0,0,MIC,0) - // - if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) - { - Packet.KeyDesc.Type = WPA2_KEY_DESC; - } - else - { - Packet.KeyDesc.Type = WPA1_KEY_DESC; - } - - // Key descriptor version and appropriate RSN IE - Packet.KeyDesc.KeyInfo.KeyDescVer = peerKeyInfo.KeyDescVer; - - // Update Key Length - Packet.KeyDesc.KeyLength[0] = pGroup->KeyDesc.KeyLength[0]; - Packet.KeyDesc.KeyLength[1] = pGroup->KeyDesc.KeyLength[1]; - - // Key Index as G-Msg 1 - if(pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) - Packet.KeyDesc.KeyInfo.KeyIndex = peerKeyInfo.KeyIndex; - - // Key Type Group key - Packet.KeyDesc.KeyInfo.KeyType = GROUPKEY; - - // KeyMic field presented - Packet.KeyDesc.KeyInfo.KeyMic = 1; - - // Secure bit - Packet.KeyDesc.KeyInfo.Secure = 1; - - // Convert to little-endian format. - *((USHORT *)&Packet.KeyDesc.KeyInfo) = cpu2le16(*((USHORT *)&Packet.KeyDesc.KeyInfo)); - - // Key Replay count - NdisMoveMemory(Packet.KeyDesc.ReplayCounter, pGroup->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - - // Out buffer for transmitting group message 2 - MlmeAllocateMemory(pAd, (PUCHAR *)&pOutBuffer); // allocate memory - if(pOutBuffer == NULL) - { - MlmeFreeMemory(pAd, (PUCHAR)mpool); - return; - } - - // Prepare EAPOL frame for MIC calculation - // Be careful, only EAPOL frame is counted for MIC calculation - MakeOutgoingFrame(pOutBuffer, &FrameLen, - Packet.Body_Len[1] + 4, &Packet, - END_OF_ARGS); - - // Prepare and Fill MIC value - NdisZeroMemory(Mic, sizeof(Mic)); - if(pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { - // AES - HMAC_SHA1(pOutBuffer, FrameLen, pAd->StaCfg.PTK, LEN_EAP_MICK, digest); - NdisMoveMemory(Mic, digest, LEN_KEY_DESC_MIC); - } - else - { - hmac_md5(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, Mic); - } - NdisMoveMemory(Packet.KeyDesc.KeyMic, Mic, LEN_KEY_DESC_MIC); - - - MakeOutgoingFrame(pOutBuffer, &FrameLen, - LENGTH_802_3, &Header802_3, - Packet.Body_Len[1] + 4, &Packet, - END_OF_ARGS); - - - // 5. Copy frame to Tx ring and prepare for encryption - RTMPToWirelessSta(pAd, Header802_3, LENGTH_802_3, (PUCHAR)&Packet, Packet.Body_Len[1] + 4, FALSE); - - // 6 Free allocated memory - MlmeFreeMemory(pAd, (PUCHAR)pOutBuffer); - os_free_mem(pAd, (PUCHAR)mpool); - - // send wireless event - for set key done WPA2 - if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_SET_KEY_DONE_WPA2_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - - DBGPRINT(RT_DEBUG_TRACE, ("WpaGroupMsg1Action <-----\n")); -} - -/* - ======================================================================== - - Routine Description: - Init WPA MAC header - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID WpaMacHeaderInit( - IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, - IN UCHAR wep, - IN PUCHAR pAddr1) -{ - NdisZeroMemory(pHdr80211, sizeof(HEADER_802_11)); - pHdr80211->FC.Type = BTYPE_DATA; - pHdr80211->FC.ToDs = 1; - if (wep == 1) - pHdr80211->FC.Wep = 1; - - // Addr1: BSSID, Addr2: SA, Addr3: DA - COPY_MAC_ADDR(pHdr80211->Addr1, pAddr1); - COPY_MAC_ADDR(pHdr80211->Addr2, pAd->CurrentAddress); - COPY_MAC_ADDR(pHdr80211->Addr3, pAd->CommonCfg.Bssid); - pHdr80211->Sequence = pAd->Sequence; -} - -/* - ======================================================================== - - Routine Description: - Copy frame from waiting queue into relative ring buffer and set - appropriate ASIC register to kick hardware encryption before really - sent out to air. - - Arguments: - pAd Pointer to our adapter - PNDIS_PACKET Pointer to outgoing Ndis frame - NumberOfFrag Number of fragment required - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID RTMPToWirelessSta( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, - IN UINT DataLen, - IN BOOLEAN is4wayFrame) - -{ - NDIS_STATUS Status; - PNDIS_PACKET pPacket; - UCHAR Index; - - do - { - // 1. build a NDIS packet and call RTMPSendPacket(); - // be careful about how/when to release this internal allocated NDIS PACKET buffer - Status = RTMPAllocateNdisPacket(pAd, &pPacket, pHeader802_3, HdrLen, pData, DataLen); - if (Status != NDIS_STATUS_SUCCESS) - break; - - if (is4wayFrame) - RTMP_SET_PACKET_CLEAR_EAP_FRAME(pPacket, 1); - else - RTMP_SET_PACKET_CLEAR_EAP_FRAME(pPacket, 0); - - // 2. send out the packet - Status = STASendPacket(pAd, pPacket); - if(Status == NDIS_STATUS_SUCCESS) - { - // Dequeue one frame from TxSwQueue0..3 queue and process it - // There are three place calling dequeue for TX ring. - // 1. Here, right after queueing the frame. - // 2. At the end of TxRingTxDone service routine. - // 3. Upon NDIS call RTMPSendPackets - if((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS))) - { - for(Index = 0; Index < 5; Index ++) - if(pAd->TxSwQueue[Index].Number > 0) - RTMPDeQueuePacket(pAd, FALSE, Index, MAX_TX_PROCESS); - } - } - } while(FALSE); - -} - -/* - ======================================================================== - - Routine Description: - Check Sanity RSN IE form AP - - Arguments: - - Return Value: - - - ======================================================================== -*/ -BOOLEAN CheckRSNIE( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN UCHAR DataLen, - OUT UCHAR *Offset) -{ - PUCHAR pVIE; - UCHAR len; - PEID_STRUCT pEid; - BOOLEAN result = FALSE; - - pVIE = pData; - len = DataLen; - *Offset = 0; - - while (len > sizeof(RSNIE2)) - { - pEid = (PEID_STRUCT) pVIE; - // WPA RSN IE - if ((pEid->Eid == IE_WPA) && (NdisEqualMemory(pEid->Octet, WPA_OUI, 4))) - { - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA || pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) && - (NdisEqualMemory(pVIE, pAd->MacTab.Content[BSSID_WCID].RSN_IE, pAd->MacTab.Content[BSSID_WCID].RSNIE_Len)) && - (pAd->MacTab.Content[BSSID_WCID].RSNIE_Len == (pEid->Len + 2))) - { - DBGPRINT(RT_DEBUG_TRACE, ("CheckRSNIE ==> WPA/WPAPSK RSN IE matched in Msg 3, Length(%d) \n", (pEid->Len + 2))); - result = TRUE; - } - - *Offset += (pEid->Len + 2); - } - // WPA2 RSN IE - else if ((pEid->Eid == IE_RSN) && (NdisEqualMemory(pEid->Octet + 2, RSN_OUI, 3))) - { - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2 || pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) && - (NdisEqualMemory(pVIE, pAd->MacTab.Content[BSSID_WCID].RSN_IE, pAd->MacTab.Content[BSSID_WCID].RSNIE_Len)) && - (pAd->MacTab.Content[BSSID_WCID].RSNIE_Len == (pEid->Len + 2))) - { - DBGPRINT(RT_DEBUG_TRACE, ("CheckRSNIE ==> WPA2/WPA2PSK RSN IE matched in Msg 3, Length(%d) \n", (pEid->Len + 2))); - result = TRUE; - } - - *Offset += (pEid->Len + 2); - } - else - { - break; - } - - pVIE += (pEid->Len + 2); - len -= (pEid->Len + 2); - } - - DBGPRINT(RT_DEBUG_TRACE, ("CheckRSNIE ==> skip_offset(%d) \n", *Offset)); - - return result; - -} - - -/* - ======================================================================== - - Routine Description: - Parse KEYDATA field. KEYDATA[] May contain 2 RSN IE and optionally GTK. - GTK is encaptulated in KDE format at p.83 802.11i D10 - - Arguments: - - Return Value: - - Note: - 802.11i D10 - - ======================================================================== -*/ -BOOLEAN ParseKeyData( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKeyData, - IN UCHAR KeyDataLen, - IN UCHAR bPairewise) -{ - PKDE_ENCAP pKDE = NULL; - PUCHAR pMyKeyData = pKeyData; - UCHAR KeyDataLength = KeyDataLen; - UCHAR GTKLEN; - UCHAR skip_offset; - - // Verify The RSN IE contained in Pairewise-Msg 3 and skip it - if (bPairewise) - { - // Check RSN IE whether it is WPA2/WPA2PSK - if (!CheckRSNIE(pAd, pKeyData, KeyDataLen, &skip_offset)) - { - DBGPRINT(RT_DEBUG_ERROR, ("ParseKeyData ==> WPA2/WPA2PSK RSN IE mismatched \n")); - hex_dump("Get KEYDATA :", pKeyData, KeyDataLen); - return FALSE; - } - else - { - // skip RSN IE - pMyKeyData += skip_offset; - KeyDataLength -= skip_offset; - - //DBGPRINT(RT_DEBUG_TRACE, ("ParseKeyData ==> WPA2/WPA2PSK RSN IE matched in Msg 3, Length(%d) \n", skip_offset)); - } - } - - DBGPRINT(RT_DEBUG_TRACE,("ParseKeyData ==> KeyDataLength %d without RSN_IE \n", KeyDataLength)); - - // Parse EKD format - if (KeyDataLength >= 8) - { - pKDE = (PKDE_ENCAP) pMyKeyData; - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR: KeyDataLength is too short \n")); - return FALSE; - } - - - // Sanity check - shared key index should not be 0 - if (pKDE->GTKEncap.Kid == 0) - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR: GTK Key index zero \n")); - return FALSE; - } - - // Sanity check - KED length - if (KeyDataLength < (pKDE->Len + 2)) - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR: The len from KDE is too short \n")); - return FALSE; - } - - // Get GTK length - refer to IEEE 802.11i-2004 p.82 - GTKLEN = pKDE->Len -6; - - if (GTKLEN < LEN_AES_KEY) - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR: GTK Key length is too short (%d) \n", GTKLEN)); - return FALSE; - } - else - DBGPRINT(RT_DEBUG_TRACE, ("GTK Key with KDE formet got index=%d, len=%d \n", pKDE->GTKEncap.Kid, GTKLEN)); - - // Update GTK - // set key material, TxMic and RxMic for WPAPSK - NdisMoveMemory(pAd->StaCfg.GTK, pKDE->GTKEncap.GTK, 32); - pAd->StaCfg.DefaultKeyId = pKDE->GTKEncap.Kid; - - // Update shared key table - NdisZeroMemory(&pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId], sizeof(CIPHER_KEY)); - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].Key, pKDE->GTKEncap.GTK, LEN_TKIP_EK); - NdisMoveMemory(pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].RxMic, &pKDE->GTKEncap.GTK[16], LEN_TKIP_RXMICK); - NdisMoveMemory(pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].TxMic, &pKDE->GTKEncap.GTK[24], LEN_TKIP_TXMICK); - - // Update Shared Key CipherAlg - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_NONE; - if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption2Enabled) - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_TKIP; - else if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption3Enabled) - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_AES; - else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP40Enabled) - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_WEP64; - else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP104Enabled) - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_WEP128; - - return TRUE; - -} - -/* - ======================================================================== - - Routine Description: - Cisco CCKM PRF function - - Arguments: - key Cisco Base Transient Key (BTK) - key_len The key length of the BTK - data Ruquest Number(RN) + BSSID - data_len The length of the data - output Store for PTK(Pairwise transient keys) - len The length of the output - Return Value: - None - - Note: - 802.1i Annex F.9 - - ======================================================================== -*/ -VOID CCKMPRF( - IN UCHAR *key, - IN INT key_len, - IN UCHAR *data, - IN INT data_len, - OUT UCHAR *output, - IN INT len) -{ - INT i; - UCHAR input[1024]; - INT currentindex = 0; - INT total_len; - - NdisMoveMemory(input, data, data_len); - total_len = data_len; - input[total_len] = 0; - total_len++; - for (i = 0; i < (len + 19) / 20; i++) - { - HMAC_SHA1(input, total_len, key, key_len, &output[currentindex]); - currentindex += 20; - input[total_len - 1]++; - } -} +void inc_byte_array(UCHAR *counter, int len); /* ======================================================================== @@ -1872,7 +66,7 @@ VOID RTMPReportMicError( UCHAR unicastKey = (pWpaKey->Type == PAIRWISE_KEY ? 1:0); // Record Last MIC error time and count - Now = jiffies; + NdisGetSystemUpTime(&Now); if (pAd->StaCfg.MicErrCnt == 0) { pAd->StaCfg.MicErrCnt++; @@ -1895,6 +89,17 @@ VOID RTMPReportMicError( pAd->StaCfg.LastMicErrorTime = Now; // Violate MIC error counts, MIC countermeasures kicks in pAd->StaCfg.MicErrCnt++; + // We shall block all reception + // We shall clean all Tx ring and disassoicate from AP after next EAPOL frame + // + // No necessary to clean all Tx ring, on RTMPHardTransmit will stop sending non-802.1X EAPOL packets + // if pAd->StaCfg.MicErrCnt greater than 2. + // + // RTMPRingCleanUp(pAd, QID_AC_BK); + // RTMPRingCleanUp(pAd, QID_AC_BE); + // RTMPRingCleanUp(pAd, QID_AC_VI); + // RTMPRingCleanUp(pAd, QID_AC_VO); + // RTMPRingCleanUp(pAd, QID_HCCA); } } else @@ -1944,14 +149,13 @@ VOID WpaSendMicFailureToWpaSupplicant( IN PRTMP_ADAPTER pAd, IN BOOLEAN bUnicast) { - union iwreq_data wrqu; char custom[IW_CUSTOM_MAX] = {0}; sprintf(custom, "MLME-MICHAELMICFAILURE.indication"); - if (bUnicast) + if(bUnicast) sprintf(custom, "%s unicast", custom); - wrqu.data.length = strlen(custom); - wireless_send_event(pAd->net_dev, IWEVCUSTOM, &wrqu, custom); + + RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, -1, NULL, (PUCHAR)custom, strlen(custom)); return; } @@ -2002,7 +206,7 @@ VOID WpaMicFailureReportFrame( Packet.KeyDesc.KeyInfo.Error = 1; // Update packet length after decide Key data payload - Packet.Body_Len[1] = sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE; + SET_UINT16_TO_ARRARY(Packet.Body_Len, LEN_EAPOL_KEY_MSG) // Key Replay Count NdisMoveMemory(Packet.KeyDesc.ReplayCounter, pAd->StaCfg.ReplayCounter, LEN_KEY_DESC_REPLAY); @@ -2021,7 +225,7 @@ VOID WpaMicFailureReportFrame( // Prepare EAPOL frame for MIC calculation // Be careful, only EAPOL frame is counted for MIC calculation MakeOutgoingFrame(pOutBuffer, &FrameLen, - Packet.Body_Len[1] + 4, &Packet, + CONV_ARRARY_TO_UINT16(Packet.Body_Len) + 4, &Packet, END_OF_ARGS); // Prepare and Fill MIC value @@ -2029,22 +233,20 @@ VOID WpaMicFailureReportFrame( if(pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) { // AES UCHAR digest[20] = {0}; - HMAC_SHA1(pOutBuffer, FrameLen, pAd->StaCfg.PTK, LEN_EAP_MICK, digest); + HMAC_SHA1(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, digest, SHA1_DIGEST_SIZE); NdisMoveMemory(Mic, digest, LEN_KEY_DESC_MIC); } else { // TKIP - hmac_md5(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, Mic); + HMAC_MD5(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, Mic, MD5_DIGEST_SIZE); } NdisMoveMemory(Packet.KeyDesc.KeyMic, Mic, LEN_KEY_DESC_MIC); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - LENGTH_802_3, &Header802_3, - Packet.Body_Len[1] + 4, &Packet, - END_OF_ARGS); - - // opy frame to Tx ring and send MIC failure report frame to authenticator - RTMPToWirelessSta(pAd, Header802_3, LENGTH_802_3, (PUCHAR)&Packet, Packet.Body_Len[1] + 4, FALSE); + // copy frame to Tx ring and send MIC failure report frame to authenticator + RTMPToWirelessSta(pAd, &pAd->MacTab.Content[BSSID_WCID], + Header802_3, LENGTH_802_3, + (PUCHAR)&Packet, + CONV_ARRARY_TO_UINT16(Packet.Body_Len) + 4, FALSE); MlmeFreeMemory(pAd, (PUCHAR)pOutBuffer); @@ -2089,3 +291,149 @@ VOID WpaDisassocApAndBlockAssoc( pAd->StaCfg.bBlockAssoc = TRUE; } +VOID WpaStaPairwiseKeySetting( + IN PRTMP_ADAPTER pAd) +{ + PCIPHER_KEY pSharedKey; + PMAC_TABLE_ENTRY pEntry; + + pEntry = &pAd->MacTab.Content[BSSID_WCID]; + + // Pairwise key shall use key#0 + pSharedKey = &pAd->SharedKey[BSS0][0]; + + NdisMoveMemory(pAd->StaCfg.PTK, pEntry->PTK, LEN_PTK); + + // Prepare pair-wise key information into shared key table + NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); + pSharedKey->KeyLen = LEN_TKIP_EK; + NdisMoveMemory(pSharedKey->Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); + NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_RXMICK); + NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); + + // Decide its ChiperAlg + if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) + pSharedKey->CipherAlg = CIPHER_TKIP; + else if (pAd->StaCfg.PairCipher == Ndis802_11Encryption3Enabled) + pSharedKey->CipherAlg = CIPHER_AES; + else + pSharedKey->CipherAlg = CIPHER_NONE; + + // Update these related information to MAC_TABLE_ENTRY + NdisMoveMemory(pEntry->PairwiseKey.Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); + NdisMoveMemory(pEntry->PairwiseKey.RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_RXMICK); + NdisMoveMemory(pEntry->PairwiseKey.TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); + pEntry->PairwiseKey.CipherAlg = pSharedKey->CipherAlg; + + // Update pairwise key information to ASIC Shared Key Table + AsicAddSharedKeyEntry(pAd, + BSS0, + 0, + pSharedKey->CipherAlg, + pSharedKey->Key, + pSharedKey->TxMic, + pSharedKey->RxMic); + + // Update ASIC WCID attribute table and IVEIV table + RTMPAddWcidAttributeEntry(pAd, + BSS0, + 0, + pSharedKey->CipherAlg, + pEntry); + STA_PORT_SECURED(pAd); + pAd->IndicateMediaState = NdisMediaStateConnected; + + DBGPRINT(RT_DEBUG_TRACE, ("%s : AID(%d) port secured\n", __func__, pEntry->Aid)); + +} + +VOID WpaStaGroupKeySetting( + IN PRTMP_ADAPTER pAd) +{ + PCIPHER_KEY pSharedKey; + + pSharedKey = &pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId]; + + // Prepare pair-wise key information into shared key table + NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); + pSharedKey->KeyLen = LEN_TKIP_EK; + NdisMoveMemory(pSharedKey->Key, pAd->StaCfg.GTK, LEN_TKIP_EK); + NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.GTK[16], LEN_TKIP_RXMICK); + NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.GTK[24], LEN_TKIP_TXMICK); + + // Update Shared Key CipherAlg + pSharedKey->CipherAlg = CIPHER_NONE; + if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption2Enabled) + pSharedKey->CipherAlg = CIPHER_TKIP; + else if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption3Enabled) + pSharedKey->CipherAlg = CIPHER_AES; + else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP40Enabled) + pSharedKey->CipherAlg = CIPHER_WEP64; + else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP104Enabled) + pSharedKey->CipherAlg = CIPHER_WEP128; + + // Update group key information to ASIC Shared Key Table + AsicAddSharedKeyEntry(pAd, + BSS0, + pAd->StaCfg.DefaultKeyId, + pSharedKey->CipherAlg, + pSharedKey->Key, + pSharedKey->TxMic, + pSharedKey->RxMic); + + // Update ASIC WCID attribute table and IVEIV table + RTMPAddWcidAttributeEntry(pAd, + BSS0, + pAd->StaCfg.DefaultKeyId, + pSharedKey->CipherAlg, + NULL); + +} + + +/* + ======================================================================== + + Routine Description: + Send EAPoL-Start packet to AP. + + Arguments: + pAd - NIC Adapter pointer + + Return Value: + None + + IRQL = DISPATCH_LEVEL + + Note: + Actions after link up + 1. Change the correct parameters + 2. Send EAPOL - START + + ======================================================================== +*/ +VOID WpaSendEapolStart( + IN PRTMP_ADAPTER pAd, + IN PUCHAR pBssid) +{ + IEEE8021X_FRAME Packet; + UCHAR Header802_3[14]; + + DBGPRINT(RT_DEBUG_TRACE, ("-----> WpaSendEapolStart\n")); + + NdisZeroMemory(Header802_3,sizeof(UCHAR)*14); + + MAKE_802_3_HEADER(Header802_3, pBssid, &pAd->CurrentAddress[0], EAPOL); + + // Zero message 2 body + NdisZeroMemory(&Packet, sizeof(Packet)); + Packet.Version = EAPOL_VER; + Packet.Type = EAPOLStart; + Packet.Length = cpu2be16(0); + + // Copy frame to Tx ring + RTMPToWirelessSta((PRTMP_ADAPTER)pAd, &pAd->MacTab.Content[BSSID_WCID], + Header802_3, LENGTH_802_3, (PUCHAR)&Packet, 4, TRUE); + + DBGPRINT(RT_DEBUG_TRACE, ("<----- WpaSendEapolStart\n")); +} diff --git a/drivers/staging/rt2860/sta_ioctl.c b/drivers/staging/rt2860/sta_ioctl.c index c0e04251e126..b6a3c9006340 100644 --- a/drivers/staging/rt2860/sta_ioctl.c +++ b/drivers/staging/rt2860/sta_ioctl.c @@ -50,8 +50,6 @@ extern ULONG RTDebugLevel; #define GROUP_KEY_NO 4 extern UCHAR CipherWpa2Template[]; -extern UCHAR CipherWpaPskTkip[]; -extern UCHAR CipherWpaPskTkipLen; typedef struct PACKED _RT_VERSION_INFO{ UCHAR DriverVersionW; @@ -68,25 +66,25 @@ struct iw_priv_args privtab[] = { IW_PRIV_TYPE_CHAR | 1024, 0, "set"}, -{ RTPRIV_IOCTL_SHOW, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, - ""}, { RTPRIV_IOCTL_SHOW, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, ""}, /* --- sub-ioctls definitions --- */ { SHOW_CONN_STATUS, - 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "connStatus" }, + IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "connStatus" }, { SHOW_DRVIER_VERION, - 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "driverVer" }, + IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "driverVer" }, { SHOW_BA_INFO, - 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "bainfo" }, + IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "bainfo" }, { SHOW_DESC_INFO, - 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "descinfo" }, + IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "descinfo" }, { RAIO_OFF, - 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "radio_off" }, + IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "radio_off" }, { RAIO_ON, - 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "radio_on" }, + IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "radio_on" }, { SHOW_CFG_VALUE, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "show" }, + { SHOW_ADHOC_ENTRY_INFO, + IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "adhocEntry" }, /* --- sub-ioctls relations --- */ { RTPRIV_IOCTL_STATISTICS, @@ -95,62 +93,76 @@ struct iw_priv_args privtab[] = { { RTPRIV_IOCTL_GSITESURVEY, 0, IW_PRIV_TYPE_CHAR | 1024, "get_site_survey"}, + + }; +static __s32 ralinkrate[] = + {2, 4, 11, 22, // CCK + 12, 18, 24, 36, 48, 72, 96, 108, // OFDM + 13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78, 104, 156, 208, 234, 260, // 20MHz, 800ns GI, MCS: 0 ~ 15 + 39, 78, 117, 156, 234, 312, 351, 390, // 20MHz, 800ns GI, MCS: 16 ~ 23 + 27, 54, 81, 108, 162, 216, 243, 270, 54, 108, 162, 216, 324, 432, 486, 540, // 40MHz, 800ns GI, MCS: 0 ~ 15 + 81, 162, 243, 324, 486, 648, 729, 810, // 40MHz, 800ns GI, MCS: 16 ~ 23 + 14, 29, 43, 57, 87, 115, 130, 144, 29, 59, 87, 115, 173, 230, 260, 288, // 20MHz, 400ns GI, MCS: 0 ~ 15 + 43, 87, 130, 173, 260, 317, 390, 433, // 20MHz, 400ns GI, MCS: 16 ~ 23 + 30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 480, 540, 600, // 40MHz, 400ns GI, MCS: 0 ~ 15 + 90, 180, 270, 360, 540, 720, 810, 900}; + INT Set_SSID_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg); + IN PSTRING arg); #ifdef WMM_SUPPORT INT Set_WmmCapable_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); #endif INT Set_NetworkType_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg); + IN PSTRING arg); INT Set_AuthMode_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg); + IN PSTRING arg); INT Set_EncrypType_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg); + IN PSTRING arg); INT Set_DefaultKeyID_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg); + IN PSTRING arg); INT Set_Key1_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg); + IN PSTRING arg); INT Set_Key2_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg); + IN PSTRING arg); INT Set_Key3_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg); + IN PSTRING arg); INT Set_Key4_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg); + IN PSTRING arg); INT Set_WPAPSK_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg); + IN PSTRING arg); INT Set_PSMode_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg); + IN PSTRING arg); INT Set_Wpa_Support( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); NDIS_STATUS RTMPWPANoneAddKeyProc( IN PRTMP_ADAPTER pAd, @@ -158,23 +170,45 @@ NDIS_STATUS RTMPWPANoneAddKeyProc( INT Set_FragTest_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg); + IN PSTRING arg); INT Set_TGnWifiTest_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); + IN PSTRING arg); INT Set_LongRetryLimit_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg); + IN PSTRING arg); INT Set_ShortRetryLimit_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg); + IN PSTRING arg); + + + +INT Show_Adhoc_MacTable_Proc( + IN PRTMP_ADAPTER pAd, + IN PSTRING extra); + +INT Set_BeaconLostTime_Proc( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg); + +INT Set_AutoRoaming_Proc( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg); + +INT Set_SiteSurvey_Proc( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg); + +INT Set_ForceTxBurst_Proc( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg); static struct { - CHAR *name; - INT (*set_proc)(PRTMP_ADAPTER pAdapter, PUCHAR arg); + PSTRING name; + INT (*set_proc)(PRTMP_ADAPTER pAdapter, PSTRING arg); } *PRTMP_PRIVATE_SET_PROC, RTMP_PRIVATE_SUPPORT_PROC[] = { {"DriverVersion", Set_DriverVersion_Proc}, {"CountryRegion", Set_CountryRegion_Proc}, @@ -201,9 +235,10 @@ static struct { {"HtBaDecline", Set_BADecline_Proc}, {"HtProtect", Set_HtProtect_Proc}, {"HtMimoPs", Set_HtMimoPs_Proc}, + {"HtDisallowTKIP", Set_HtDisallowTKIP_Proc}, #ifdef AGGREGATION_SUPPORT {"PktAggregate", Set_PktAggregate_Proc}, -#endif +#endif // AGGREGATION_SUPPORT // #ifdef WMM_SUPPORT {"WmmCapable", Set_WmmCapable_Proc}, @@ -222,18 +257,36 @@ static struct { {"PSMode", Set_PSMode_Proc}, #ifdef DBG {"Debug", Set_Debug_Proc}, -#endif +#endif // DBG // + + {"WpaSupport", Set_Wpa_Support}, + + + + + {"FixedTxMode", Set_FixedTxMode_Proc}, {"TGnWifiTest", Set_TGnWifiTest_Proc}, {"ForceGF", Set_ForceGF_Proc}, {"LongRetry", Set_LongRetryLimit_Proc}, {"ShortRetry", Set_ShortRetryLimit_Proc}, -#ifdef RT2870 + +//2008/09/11:KH add to support efuse<-- +#ifdef RT30xx +#ifdef RTMP_EFUSE_SUPPORT {"efuseFreeNumber", set_eFuseGetFreeBlockCount_Proc}, {"efuseDump", set_eFusedump_Proc}, {"efuseLoadFromBin", set_eFuseLoadFromBin_Proc}, -#endif + {"efuseBufferModeWriteBack", set_eFuseBufferModeWriteBack_Proc}, +#endif // RTMP_EFUSE_SUPPORT // +#endif // RT30xx // +//2008/09/11:KH add to support efuse--> + {"BeaconLostTime", Set_BeaconLostTime_Proc}, + {"AutoRoaming", Set_AutoRoaming_Proc}, + {"SiteSurvey", Set_SiteSurvey_Proc}, + {"ForceTxBurst", Set_ForceTxBurst_Proc}, + {NULL,} }; @@ -247,22 +300,6 @@ VOID RTMPAddKey( DBGPRINT(RT_DEBUG_TRACE, ("RTMPAddKey ------>\n")); -#ifdef RT2860 - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); - if (RTMP_TEST_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND)) - { - if (pAd->StaCfg.bRadio == FALSE) - { - RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); - return; - } - DBGPRINT(RT_DEBUG_TRACE,("RTMPWPAAddKeyProc1==>\n")); - RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_HALT); - RTMPusecDelay(6000); - pAd->bPCIclkOff = FALSE; - } -#endif - if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) { if (pKey->KeyIndex & 0x80000000) @@ -323,6 +360,7 @@ VOID RTMPAddKey( if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA2) { // set 802.1x port control + //pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; STA_PORT_SECURED(pAd); // Indicate Connected for GUI @@ -372,6 +410,7 @@ VOID RTMPAddKey( NULL); // set 802.1x port control + //pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; STA_PORT_SECURED(pAd); // Indicate Connected for GUI @@ -454,10 +493,6 @@ VOID RTMPAddKey( } } end: -#ifdef RT2860 - RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); - DBGPRINT(RT_DEBUG_INFO, ("<------ RTMPAddKey\n")); -#endif return; } @@ -478,8 +513,8 @@ rt_ioctl_giwname(struct net_device *dev, struct iw_request_info *info, char *name, char *extra) { -// PRTMP_ADAPTER pAdapter = dev->ml_priv; - strncpy(name, RT28xx_CHIP_NAME " Wireless", IFNAMSIZ); + strncpy(name, "Ralink STA", IFNAMSIZ); + // RT2870 2.1.0.0 uses "RT2870 Wireless" return 0; } @@ -487,9 +522,11 @@ int rt_ioctl_siwfreq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *freq, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; int chan = -1; + GET_PAD_FROM_NET_DEV(pAdapter, dev); + //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { @@ -520,9 +557,13 @@ int rt_ioctl_giwfreq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *freq, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; - UCHAR ch = pAdapter->CommonCfg.Channel; - ULONG m; + PRTMP_ADAPTER pAdapter = NULL; + UCHAR ch; + ULONG m = 2412000; + + GET_PAD_FROM_NET_DEV(pAdapter, dev); + + ch = pAdapter->CommonCfg.Channel; DBGPRINT(RT_DEBUG_TRACE,("==>rt_ioctl_giwfreq %d\n", ch)); @@ -536,7 +577,9 @@ int rt_ioctl_siwmode(struct net_device *dev, struct iw_request_info *info, __u32 *mode, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; + + GET_PAD_FROM_NET_DEV(pAdapter, dev); //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) @@ -571,7 +614,9 @@ int rt_ioctl_giwmode(struct net_device *dev, struct iw_request_info *info, __u32 *mode, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; + + GET_PAD_FROM_NET_DEV(pAdapter, dev); if (ADHOC_ON(pAdapter)) *mode = IW_MODE_ADHOC; @@ -592,7 +637,9 @@ int rt_ioctl_siwsens(struct net_device *dev, struct iw_request_info *info, char *name, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; + + GET_PAD_FROM_NET_DEV(pAdapter, dev); //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) @@ -615,11 +662,13 @@ int rt_ioctl_giwrange(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; struct iw_range *range = (struct iw_range *) extra; u16 val; int i; + GET_PAD_FROM_NET_DEV(pAdapter, dev); + DBGPRINT(RT_DEBUG_TRACE ,("===>rt_ioctl_giwrange\n")); data->length = sizeof(struct iw_range); memset(range, 0, sizeof(struct iw_range)); @@ -651,10 +700,10 @@ int rt_ioctl_giwrange(struct net_device *dev, val = 0; for (i = 1; i <= range->num_channels; i++) { - u32 m; + u32 m = 2412000; range->freq[val].i = pAdapter->ChannelList[i-1].Channel; MAP_CHANNEL_ID_TO_KHZ(pAdapter->ChannelList[i-1].Channel, m); - range->freq[val].m = m * 100; /* HZ */ + range->freq[val].m = m * 100; /* OS_HZ */ range->freq[val].e = 1; val++; @@ -696,9 +745,11 @@ int rt_ioctl_siwap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *ap_addr, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; NDIS_802_11_MAC_ADDRESS Bssid; + GET_PAD_FROM_NET_DEV(pAdapter, dev); + //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { @@ -708,7 +759,7 @@ int rt_ioctl_siwap(struct net_device *dev, if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) { - RT28XX_MLME_RESET_STATE_MACHINE(pAdapter); + RTMP_MLME_RESET_STATE_MACHINE(pAdapter); DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); } @@ -736,7 +787,9 @@ int rt_ioctl_giwap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *ap_addr, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; + + GET_PAD_FROM_NET_DEV(pAdapter, dev); if (INFRA_ON(pAdapter) || ADHOC_ON(pAdapter)) { @@ -802,12 +855,14 @@ int rt_ioctl_iwaplist(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; struct sockaddr addr[IW_MAX_AP]; struct iw_quality qual[IW_MAX_AP]; int i; + GET_PAD_FROM_NET_DEV(pAdapter, dev); + //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { @@ -837,11 +892,13 @@ int rt_ioctl_siwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; ULONG Now; int Status = NDIS_STATUS_SUCCESS; + GET_PAD_FROM_NET_DEV(pAdapter, dev); + //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { @@ -854,17 +911,8 @@ int rt_ioctl_siwscan(struct net_device *dev, DBGPRINT(RT_DEBUG_TRACE, ("!!! Driver is in Monitor Mode now !!!\n")); return -EINVAL; } -#ifdef RT2860 - if ((pAdapter->OpMode == OPMODE_STA) && (IDLE_ON(pAdapter)) - && (pAdapter->StaCfg.bRadio == TRUE) - && (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_IDLE_RADIO_OFF))) - { - RT28xxPciAsicRadioOn(pAdapter, GUI_IDLE_POWER_SAVE); - } - // Check if still radio off. - else if (pAdapter->bPCIclkOff == TRUE) - return 0; -#endif + + if (pAdapter->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) { pAdapter->StaCfg.WpaSupplicantScanCount++; @@ -872,7 +920,7 @@ int rt_ioctl_siwscan(struct net_device *dev, pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE; if (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - return 0; + return NDIS_STATUS_SUCCESS; do{ Now = jiffies; @@ -896,7 +944,7 @@ int rt_ioctl_siwscan(struct net_device *dev, if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) { - RT28XX_MLME_RESET_STATE_MACHINE(pAdapter); + RTMP_MLME_RESET_STATE_MACHINE(pAdapter); DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); } @@ -914,23 +962,25 @@ int rt_ioctl_siwscan(struct net_device *dev, NULL); Status = NDIS_STATUS_SUCCESS; - RT28XX_MLME_HANDLER(pAdapter); + RTMP_MLME_HANDLER(pAdapter); }while(0); - return 0; + return NDIS_STATUS_SUCCESS; } int rt_ioctl_giwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *extra) { - - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; int i=0; - char *current_ev = extra, *previous_ev = extra; - char *end_buf; - char *current_val, custom[MAX_CUSTOM_LEN] = {0}; + PSTRING current_ev = extra, previous_ev = extra; + PSTRING end_buf; + PSTRING current_val; + STRING custom[MAX_CUSTOM_LEN] = {0}; struct iw_event iwe; + GET_PAD_FROM_NET_DEV(pAdapter, dev); + if (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) { /* @@ -958,7 +1008,9 @@ int rt_ioctl_giwscan(struct net_device *dev, for (i = 0; i < pAdapter->ScanTab.BssNr; i++) { if (current_ev >= end_buf) + { return -E2BIG; + } //MAC address //================================ @@ -1043,7 +1095,7 @@ int rt_ioctl_giwscan(struct net_device *dev, } previous_ev = current_ev; - 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); if (current_ev == previous_ev) return -E2BIG; @@ -1055,7 +1107,7 @@ int rt_ioctl_giwscan(struct net_device *dev, iwe.u.data.flags = 1; previous_ev = current_ev; - current_ev = iwe_stream_add_point(info, current_ev,end_buf, &iwe, pAdapter->ScanTab.BssEntry[i].Ssid); + current_ev = iwe_stream_add_point(info, current_ev,end_buf, &iwe, (PSTRING) pAdapter->ScanTab.BssEntry[i].Ssid); if (current_ev == previous_ev) return -E2BIG; @@ -1142,6 +1194,20 @@ int rt_ioctl_giwscan(struct net_device *dev, else iwe.u.bitrate.value = (tmpRate/2) * 1000000; + if (tmpRate == 0x6c && pAdapter->ScanTab.BssEntry[i].HtCapabilityLen > 0) + { + int rate_count = sizeof(ralinkrate)/sizeof(__s32); + HT_CAP_INFO capInfo = pAdapter->ScanTab.BssEntry[i].HtCapability.HtCapInfo; + int shortGI = capInfo.ChannelWidth ? capInfo.ShortGIfor40 : capInfo.ShortGIfor20; + int maxMCS = pAdapter->ScanTab.BssEntry[i].HtCapability.MCSSet[1] ? 15 : 7; + int rate_index = 12 + ((UCHAR)capInfo.ChannelWidth * 24) + ((UCHAR)shortGI *48) + ((UCHAR)maxMCS); + if (rate_index < 0) + rate_index = 0; + if (rate_index > rate_count) + rate_index = rate_count; + iwe.u.bitrate.value = ralinkrate[rate_index] * 500000; + } + iwe.u.bitrate.disabled = 0; current_val = iwe_stream_add_value(info, current_ev, current_val, end_buf, &iwe, @@ -1192,7 +1258,9 @@ int rt_ioctl_siwessid(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *essid) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; + + GET_PAD_FROM_NET_DEV(pAdapter, dev); //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) @@ -1203,13 +1271,13 @@ int rt_ioctl_siwessid(struct net_device *dev, if (data->flags) { - PCHAR pSsidString = NULL; + PSTRING pSsidString = NULL; // Includes null character. if (data->length > (IW_ESSID_MAX_SIZE + 1)) return -E2BIG; - pSsidString = (CHAR *) kmalloc(MAX_LEN_OF_SSID+1, MEM_ALLOC_FLAG); + pSsidString = kmalloc(MAX_LEN_OF_SSID+1, MEM_ALLOC_FLAG); if (pSsidString) { NdisZeroMemory(pSsidString, MAX_LEN_OF_SSID+1); @@ -1233,7 +1301,9 @@ int rt_ioctl_giwessid(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *essid) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; + + GET_PAD_FROM_NET_DEV(pAdapter, dev); data->flags = 1; if (MONITOR_ON(pAdapter)) @@ -1248,14 +1318,14 @@ int rt_ioctl_giwessid(struct net_device *dev, data->length = pAdapter->CommonCfg.SsidLen; memcpy(essid, pAdapter->CommonCfg.Ssid, pAdapter->CommonCfg.SsidLen); } -#ifdef RT2870 +#ifdef RTMP_MAC_USB // Add for RT2870 else if (pAdapter->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) { data->length = pAdapter->CommonCfg.SsidLen; memcpy(essid, pAdapter->CommonCfg.Ssid, pAdapter->CommonCfg.SsidLen); } -#endif // RT2870 // +#endif // RTMP_MAC_USB // else {//the ANY ssid was specified data->length = 0; @@ -1270,7 +1340,9 @@ int rt_ioctl_siwnickn(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *nickname) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; + + GET_PAD_FROM_NET_DEV(pAdapter, dev); //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) @@ -1293,10 +1365,12 @@ int rt_ioctl_giwnickn(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *nickname) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; - if (data->length > strlen(pAdapter->nickname) + 1) - data->length = strlen(pAdapter->nickname) + 1; + GET_PAD_FROM_NET_DEV(pAdapter, dev); + + if (data->length > strlen((PSTRING) pAdapter->nickname) + 1) + data->length = strlen((PSTRING) pAdapter->nickname) + 1; if (data->length > 0) { memcpy(nickname, pAdapter->nickname, data->length-1); nickname[data->length-1] = '\0'; @@ -1308,9 +1382,11 @@ int rt_ioctl_siwrts(struct net_device *dev, struct iw_request_info *info, struct iw_param *rts, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; u16 val; + GET_PAD_FROM_NET_DEV(pAdapter, dev); + //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { @@ -1337,7 +1413,9 @@ int rt_ioctl_giwrts(struct net_device *dev, struct iw_request_info *info, struct iw_param *rts, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; + + GET_PAD_FROM_NET_DEV(pAdapter, dev); //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) @@ -1357,9 +1435,11 @@ int rt_ioctl_siwfrag(struct net_device *dev, struct iw_request_info *info, struct iw_param *frag, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; u16 val; + GET_PAD_FROM_NET_DEV(pAdapter, dev); + //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { @@ -1384,7 +1464,9 @@ int rt_ioctl_giwfrag(struct net_device *dev, struct iw_request_info *info, struct iw_param *frag, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; + + GET_PAD_FROM_NET_DEV(pAdapter, dev); //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) @@ -1406,7 +1488,9 @@ int rt_ioctl_siwencode(struct net_device *dev, struct iw_request_info *info, struct iw_point *erq, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; + + GET_PAD_FROM_NET_DEV(pAdapter, dev); //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) @@ -1424,8 +1508,10 @@ int rt_ioctl_siwencode(struct net_device *dev, pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; goto done; - } else if ( - (erq->flags & IW_ENCODE_RESTRICTED || erq->flags & IW_ENCODE_OPEN)) { + } + else if (erq->flags & IW_ENCODE_RESTRICTED || erq->flags & IW_ENCODE_OPEN) + { + //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; STA_PORT_SECURED(pAdapter); pAdapter->StaCfg.PairCipher = Ndis802_11WEPEnabled; pAdapter->StaCfg.GroupCipher = Ndis802_11WEPEnabled; @@ -1441,7 +1527,8 @@ int rt_ioctl_siwencode(struct net_device *dev, { int keyIdx = (erq->flags & IW_ENCODE_INDEX) - 1; /* Check the size of the key */ - if (erq->length > MAX_WEP_KEY_SIZE) { + if (erq->length > MAX_WEP_KEY_SIZE) + { return -EINVAL; } /* Check key index */ @@ -1454,7 +1541,7 @@ int rt_ioctl_siwencode(struct net_device *dev, keyIdx = pAdapter->StaCfg.DefaultKeyId; } else - pAdapter->StaCfg.DefaultKeyId=keyIdx; + pAdapter->StaCfg.DefaultKeyId = keyIdx; NdisZeroMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, 16); @@ -1473,7 +1560,8 @@ int rt_ioctl_siwencode(struct net_device *dev, pAdapter->SharedKey[BSS0][keyIdx].KeyLen = 0; /* Check if the key is not marked as invalid */ - if(!(erq->flags & IW_ENCODE_NOKEY)) { + if(!(erq->flags & IW_ENCODE_NOKEY)) + { /* Copy the key in the driver */ NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, extra, erq->length); } @@ -1488,10 +1576,9 @@ int rt_ioctl_siwencode(struct net_device *dev, } else /* Don't complain if only change the mode */ - if (!(erq->flags & IW_ENCODE_MODE)) { + if (!(erq->flags & IW_ENCODE_MODE)) return -EINVAL; } - } done: DBGPRINT(RT_DEBUG_TRACE ,("==>rt_ioctl_siwencode::erq->flags=%x\n",erq->flags)); @@ -1506,8 +1593,10 @@ rt_ioctl_giwencode(struct net_device *dev, struct iw_request_info *info, struct iw_point *erq, char *key) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; int kid; + PRTMP_ADAPTER pAdapter = NULL; + + GET_PAD_FROM_NET_DEV(pAdapter, dev); //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) @@ -1564,12 +1653,15 @@ static int rt_ioctl_setparam(struct net_device *dev, struct iw_request_info *info, void *w, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; - POS_COOKIE pObj = (POS_COOKIE)pAdapter->OS_Cookie; - char *this_char = extra; - char *value; + PRTMP_ADAPTER pAdapter; + POS_COOKIE pObj; + PSTRING this_char = extra; + PSTRING value; int Status=0; + GET_PAD_FROM_NET_DEV(pAdapter, dev); + + pObj = (POS_COOKIE) pAdapter->OS_Cookie; { pObj->ioctl_if_type = INT_MAIN; pObj->ioctl_if = MAIN_MBSSID; @@ -1588,13 +1680,16 @@ rt_ioctl_setparam(struct net_device *dev, struct iw_request_info *info, if ((value = rtstrchr(this_char, '=')) != NULL) *value++ = 0; - if (!value) + if (!value && (strcmp(this_char, "SiteSurvey") != 0)) return -EINVAL; + else + goto SET_PROC; // reject setting nothing besides ANY ssid(ssidLen=0) if (!*value && (strcmp(this_char, "SSID") != 0)) return -EINVAL; +SET_PROC: for (PRTMP_PRIVATE_SET_PROC = RTMP_PRIVATE_SUPPORT_PROC; PRTMP_PRIVATE_SET_PROC->name; PRTMP_PRIVATE_SET_PROC++) { if (strcmp(this_char, PRTMP_PRIVATE_SET_PROC->name) == 0) @@ -1622,7 +1717,9 @@ rt_private_get_statistics(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { INT Status = 0; - PRTMP_ADAPTER pAd = dev->ml_priv; + PRTMP_ADAPTER pAd = NULL; + + GET_PAD_FROM_NET_DEV(pAd, dev); if (extra == NULL) { @@ -1655,6 +1752,8 @@ rt_private_get_statistics(struct net_device *dev, struct iw_request_info *info, } sprintf(extra+strlen(extra), "WpaSupplicantUP = %d\n\n", pAd->StaCfg.WpaSupplicantUP); + + wrq->length = strlen(extra) + 1; // 1: size of '\0' DBGPRINT(RT_DEBUG_TRACE, ("<== rt_private_get_statistics, wrq->length = %d\n", wrq->length)); @@ -1663,7 +1762,7 @@ rt_private_get_statistics(struct net_device *dev, struct iw_request_info *info, void getBaInfo( IN PRTMP_ADAPTER pAd, - IN PUCHAR pOutBuf) + IN PSTRING pOutBuf) { INT i, j; BA_ORI_ENTRY *pOriBAEntry; @@ -1710,13 +1809,16 @@ void getBaInfo( static int rt_private_show(struct net_device *dev, struct iw_request_info *info, - struct iw_point *wrq, char *extra) + struct iw_point *wrq, PSTRING extra) { INT Status = 0; - PRTMP_ADAPTER pAd = dev->ml_priv; - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + PRTMP_ADAPTER pAd; + POS_COOKIE pObj; u32 subcmd = wrq->flags; + GET_PAD_FROM_NET_DEV(pAd, dev); + + pObj = (POS_COOKIE) pAd->OS_Cookie; if (extra == NULL) { wrq->length = 0; @@ -1785,9 +1887,11 @@ rt_private_show(struct net_device *dev, struct iw_request_info *info, case RAIO_OFF: if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) { - sprintf(extra, "Scanning\n"); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; + if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) + { + RTMP_MLME_RESET_STATE_MACHINE(pAd); + DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); + } } pAd->StaCfg.bSwRadio = FALSE; if (pAd->StaCfg.bRadio != (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio)) @@ -1804,14 +1908,6 @@ rt_private_show(struct net_device *dev, struct iw_request_info *info, wrq->length = strlen(extra) + 1; // 1: size of '\0' break; case RAIO_ON: -#ifdef RT2870 - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - { - sprintf(extra, "Scanning\n"); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; - } -#endif pAd->StaCfg.bSwRadio = TRUE; //if (pAd->StaCfg.bRadio != (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio)) { @@ -1827,13 +1923,19 @@ rt_private_show(struct net_device *dev, struct iw_request_info *info, wrq->length = strlen(extra) + 1; // 1: size of '\0' break; + + case SHOW_CFG_VALUE: { - Status = RTMPShowCfgValue(pAd, wrq->pointer, extra); + Status = RTMPShowCfgValue(pAd, (PSTRING) wrq->pointer, extra); if (Status == 0) wrq->length = strlen(extra) + 1; // 1: size of '\0' } break; + case SHOW_ADHOC_ENTRY_INFO: + Show_Adhoc_MacTable_Proc(pAd, extra); + wrq->length = strlen(extra) + 1; // 1: size of '\0' + break; default: DBGPRINT(RT_DEBUG_TRACE, ("%s - unknow subcmd = %d\n", __func__, subcmd)); break; @@ -1847,12 +1949,14 @@ int rt_ioctl_siwmlme(struct net_device *dev, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = dev->ml_priv; + PRTMP_ADAPTER pAd = NULL; struct iw_mlme *pMlme = (struct iw_mlme *)wrqu->data.pointer; MLME_QUEUE_ELEM MsgElem; MLME_DISASSOC_REQ_STRUCT DisAssocReq; MLME_DEAUTH_REQ_STRUCT DeAuthReq; + GET_PAD_FROM_NET_DEV(pAd, dev); + DBGPRINT(RT_DEBUG_TRACE, ("====> %s\n", __func__)); if (pMlme == NULL) @@ -1902,9 +2006,11 @@ int rt_ioctl_siwauth(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; struct iw_param *param = &wrqu->param; + GET_PAD_FROM_NET_DEV(pAdapter, dev); + //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { @@ -1992,6 +2098,7 @@ int rt_ioctl_siwauth(struct net_device *dev, } else if (param->value == 0) { + //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; STA_PORT_SECURED(pAdapter); } DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_KEY_MGMT - param->value = %d!\n", __func__, param->value)); @@ -1999,6 +2106,14 @@ int rt_ioctl_siwauth(struct net_device *dev, case IW_AUTH_RX_UNENCRYPTED_EAPOL: break; case IW_AUTH_PRIVACY_INVOKED: + /*if (param->value == 0) + { + pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; + pAdapter->StaCfg.WepStatus = Ndis802_11WEPDisabled; + pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; + pAdapter->StaCfg.PairCipher = Ndis802_11WEPDisabled; + pAdapter->StaCfg.GroupCipher = Ndis802_11WEPDisabled; + }*/ DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_PRIVACY_INVOKED - param->value = %d!\n", __func__, param->value)); break; case IW_AUTH_DROP_UNENCRYPTED: @@ -2006,6 +2121,7 @@ int rt_ioctl_siwauth(struct net_device *dev, pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; else { + //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; STA_PORT_SECURED(pAdapter); } DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_WPA_VERSION - param->value = %d!\n", __func__, param->value)); @@ -2037,9 +2153,11 @@ int rt_ioctl_giwauth(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; struct iw_param *param = &wrqu->param; + GET_PAD_FROM_NET_DEV(pAdapter, dev); + //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { @@ -2074,21 +2192,6 @@ void fnSetCipherKey( IN BOOLEAN bGTK, IN struct iw_encode_ext *ext) { -#ifdef RT2860 - RTMP_CLEAR_PSFLAG(pAdapter, fRTMP_PS_CAN_GO_SLEEP); - if (RTMP_TEST_PSFLAG(pAdapter, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND)) - { - if (pAdapter->StaCfg.bRadio == FALSE) - { - RTMP_SET_PSFLAG(pAdapter, fRTMP_PS_CAN_GO_SLEEP); - return; - } - DBGPRINT(RT_DEBUG_TRACE,("RTMPWPAAddKeyProc1==>\n")); - RTMPPCIeLinkCtrlValueRestore(pAdapter, RESTORE_HALT); - RTMPusecDelay(6000); - pAdapter->bPCIclkOff = FALSE; - } -#endif NdisZeroMemory(&pAdapter->SharedKey[BSS0][keyIdx], sizeof(CIPHER_KEY)); pAdapter->SharedKey[BSS0][keyIdx].KeyLen = LEN_TKIP_EK; NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, ext->key, LEN_TKIP_EK); @@ -2119,9 +2222,6 @@ void fnSetCipherKey( keyIdx, pAdapter->SharedKey[BSS0][keyIdx].CipherAlg, &pAdapter->MacTab.Content[BSSID_WCID]); -#ifdef RT2860 - RTMP_SET_PSFLAG(pAdapter, fRTMP_PS_CAN_GO_SLEEP); -#endif } int rt_ioctl_siwencodeext(struct net_device *dev, @@ -2129,11 +2229,13 @@ int rt_ioctl_siwencodeext(struct net_device *dev, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAdapter = dev->ml_priv; + PRTMP_ADAPTER pAdapter = NULL; struct iw_point *encoding = &wrqu->encoding; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; int keyIdx, alg = ext->alg; + GET_PAD_FROM_NET_DEV(pAdapter, dev); + //check if the interface is down if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { @@ -2210,7 +2312,9 @@ int rt_ioctl_siwencodeext(struct net_device *dev, fnSetCipherKey(pAdapter, keyIdx, CIPHER_TKIP, FALSE, ext); if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA2) { + //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; STA_PORT_SECURED(pAdapter); + pAdapter->IndicateMediaState = NdisMediaStateConnected; } } else if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) @@ -2218,7 +2322,9 @@ int rt_ioctl_siwencodeext(struct net_device *dev, fnSetCipherKey(pAdapter, keyIdx, CIPHER_TKIP, TRUE, ext); // set 802.1x port control + //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; STA_PORT_SECURED(pAdapter); + pAdapter->IndicateMediaState = NdisMediaStateConnected; } } else @@ -2229,14 +2335,18 @@ int rt_ioctl_siwencodeext(struct net_device *dev, { fnSetCipherKey(pAdapter, keyIdx, CIPHER_AES, FALSE, ext); if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA2) + //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; STA_PORT_SECURED(pAdapter); + pAdapter->IndicateMediaState = NdisMediaStateConnected; } else if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { fnSetCipherKey(pAdapter, keyIdx, CIPHER_AES, TRUE, ext); // set 802.1x port control + //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; STA_PORT_SECURED(pAdapter); + pAdapter->IndicateMediaState = NdisMediaStateConnected; } break; default: @@ -2252,12 +2362,14 @@ rt_ioctl_giwencodeext(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = dev->ml_priv; + PRTMP_ADAPTER pAd = NULL; PCHAR pKey = NULL; struct iw_point *encoding = &wrqu->encoding; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; int idx, max_key_len; + GET_PAD_FROM_NET_DEV(pAd, dev); + DBGPRINT(RT_DEBUG_TRACE ,("===> rt_ioctl_giwencodeext\n")); max_key_len = encoding->length - sizeof(*ext); @@ -2300,7 +2412,7 @@ rt_ioctl_giwencodeext(struct net_device *dev, else { ext->key_len = pAd->SharedKey[BSS0][idx].KeyLen; - pKey = &(pAd->SharedKey[BSS0][idx].Key[0]); + pKey = (PCHAR)&(pAd->SharedKey[BSS0][idx].Key[0]); } break; case Ndis802_11Encryption2Enabled: @@ -2315,7 +2427,7 @@ rt_ioctl_giwencodeext(struct net_device *dev, else { ext->key_len = 32; - pKey = &pAd->StaCfg.PMK[0]; + pKey = (PCHAR)&pAd->StaCfg.PMK[0]; } break; default: @@ -2335,8 +2447,12 @@ int rt_ioctl_siwgenie(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = dev->ml_priv; + PRTMP_ADAPTER pAd = NULL; + + GET_PAD_FROM_NET_DEV(pAd, dev); + DBGPRINT(RT_DEBUG_TRACE ,("===> rt_ioctl_siwgenie\n")); + pAd->StaCfg.bRSN_IE_FromWpaSupplicant = FALSE; if (wrqu->data.length > MAX_LEN_OF_RSNIE || (wrqu->data.length && extra == NULL)) return -EINVAL; @@ -2345,6 +2461,7 @@ int rt_ioctl_siwgenie(struct net_device *dev, { pAd->StaCfg.RSNIE_Len = wrqu->data.length; NdisMoveMemory(&pAd->StaCfg.RSN_IE[0], extra, pAd->StaCfg.RSNIE_Len); + pAd->StaCfg.bRSN_IE_FromWpaSupplicant = TRUE; } else { @@ -2359,7 +2476,9 @@ int rt_ioctl_giwgenie(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = dev->ml_priv; + PRTMP_ADAPTER pAd = NULL; + + GET_PAD_FROM_NET_DEV(pAd, dev); if ((pAd->StaCfg.RSNIE_Len == 0) || (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA)) @@ -2401,10 +2520,12 @@ int rt_ioctl_siwpmksa(struct net_device *dev, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = dev->ml_priv; + PRTMP_ADAPTER pAd = NULL; struct iw_pmksa *pPmksa = (struct iw_pmksa *)wrqu->data.pointer; INT CachedIdx = 0, idx = 0; + GET_PAD_FROM_NET_DEV(pAd, dev); + if (pPmksa == NULL) return -EINVAL; @@ -2475,9 +2596,11 @@ int rt_ioctl_siwrate(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = dev->ml_priv; + PRTMP_ADAPTER pAd = NULL; UINT32 rate = wrqu->bitrate.value, fixed = wrqu->bitrate.fixed; + GET_PAD_FROM_NET_DEV(pAd, dev); + //check if the interface is down if(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { @@ -2529,9 +2652,10 @@ int rt_ioctl_giwrate(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = dev->ml_priv; + PRTMP_ADAPTER pAd = NULL; int rate_index = 0, rate_count = 0; HTTRANSMIT_SETTING ht_setting; +/* Remove to global variable __s32 ralinkrate[] = {2, 4, 11, 22, // CCK 12, 18, 24, 36, 48, 72, 96, 108, // OFDM @@ -2543,6 +2667,8 @@ int rt_ioctl_giwrate(struct net_device *dev, 43, 87, 130, 173, 260, 317, 390, 433, // 20MHz, 400ns GI, MCS: 16 ~ 23 30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 480, 540, 600, // 40MHz, 400ns GI, MCS: 0 ~ 15 90, 180, 270, 360, 540, 720, 810, 900}; // 40MHz, 400ns GI, MCS: 16 ~ 23 +*/ + GET_PAD_FROM_NET_DEV(pAd, dev); rate_count = sizeof(ralinkrate)/sizeof(__s32); //check if the interface is down @@ -2561,6 +2687,7 @@ int rt_ioctl_giwrate(struct net_device *dev, if (ht_setting.field.MODE >= MODE_HTMIX) { +// rate_index = 12 + ((UCHAR)ht_setting.field.BW *16) + ((UCHAR)ht_setting.field.ShortGI *32) + ((UCHAR)ht_setting.field.MCS); rate_index = 12 + ((UCHAR)ht_setting.field.BW *24) + ((UCHAR)ht_setting.field.ShortGI *48) + ((UCHAR)ht_setting.field.MCS); } else @@ -2661,7 +2788,9 @@ static const iw_handler rt_priv_handlers[] = { (iw_handler) rt_private_show, /* + 0x11 */ (iw_handler) NULL, /* + 0x12 */ (iw_handler) NULL, /* + 0x13 */ + (iw_handler) NULL, /* + 0x14 */ (iw_handler) NULL, /* + 0x15 */ + (iw_handler) NULL, /* + 0x16 */ (iw_handler) NULL, /* + 0x17 */ (iw_handler) NULL, /* + 0x18 */ }; @@ -2685,12 +2814,16 @@ INT rt28xx_sta_ioctl( IN OUT struct ifreq *rq, IN INT cmd) { - RTMP_ADAPTER *pAd = net_dev->ml_priv; - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; + POS_COOKIE pObj; + RTMP_ADAPTER *pAd = NULL; struct iwreq *wrq = (struct iwreq *) rq; BOOLEAN StateMachineTouched = FALSE; INT Status = NDIS_STATUS_SUCCESS; + GET_PAD_FROM_NET_DEV(pAd, net_dev); + + pObj = (POS_COOKIE) pAd->OS_Cookie; + //check if the interface is down if(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { @@ -2747,14 +2880,16 @@ INT rt28xx_sta_ioctl( } case SIOCSIWNICKN: //set node name/nickname { - struct iw_point *data=&wrq->u.data; - rt_ioctl_siwnickn(net_dev, NULL, data, NULL); + //struct iw_point *data=&wrq->u.data; + //rt_ioctl_siwnickn(net_dev, NULL, data, NULL); break; } case SIOCGIWNICKN: //get node name/nickname { - struct iw_point *data=&wrq->u.data; - rt_ioctl_giwnickn(net_dev, NULL, data, NULL); + struct iw_point *erq = NULL; + erq = &wrq->u.data; + erq->length = strlen((PSTRING) pAd->nickname); + Status = copy_to_user(erq->pointer, pAd->nickname, erq->length); break; } case SIOCGIWRATE: //get default bit rate (bps) @@ -2790,14 +2925,14 @@ INT rt28xx_sta_ioctl( case SIOCGIWENCODE: //get encoding token & mode { struct iw_point *erq=&wrq->u.encoding; - if(erq->pointer) + if(erq) rt_ioctl_giwencode(net_dev, NULL, erq, erq->pointer); break; } case SIOCSIWENCODE: //set encoding token & mode { struct iw_point *erq=&wrq->u.encoding; - if(erq->pointer) + if(erq) rt_ioctl_siwencode(net_dev, NULL, erq, erq->pointer); break; } @@ -2865,7 +3000,7 @@ INT rt28xx_sta_ioctl( } if(StateMachineTouched) // Upper layer sent a MLME-related operations - RT28XX_MLME_HANDLER(pAd); + RTMP_MLME_HANDLER(pAd); return Status; } @@ -2880,7 +3015,7 @@ INT rt28xx_sta_ioctl( */ INT Set_SSID_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg) + IN PSTRING arg) { NDIS_802_11_SSID Ssid, *pSsid=NULL; BOOLEAN StateMachineTouched = FALSE; @@ -2906,10 +3041,29 @@ INT Set_SSID_Proc( if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) { - RT28XX_MLME_RESET_STATE_MACHINE(pAdapter); + RTMP_MLME_RESET_STATE_MACHINE(pAdapter); DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); } + if ((pAdapter->StaCfg.WpaPassPhraseLen >= 8) && + (pAdapter->StaCfg.WpaPassPhraseLen <= 64)) + { + STRING passphrase_str[65] = {0}; + UCHAR keyMaterial[40]; + + RTMPMoveMemory(passphrase_str, pAdapter->StaCfg.WpaPassPhrase, pAdapter->StaCfg.WpaPassPhraseLen); + RTMPZeroMemory(pAdapter->StaCfg.PMK, 32); + if (pAdapter->StaCfg.WpaPassPhraseLen == 64) + { + AtoH((PSTRING) pAdapter->StaCfg.WpaPassPhrase, pAdapter->StaCfg.PMK, 32); + } + else + { + PasswordHash((PSTRING) pAdapter->StaCfg.WpaPassPhrase, Ssid.Ssid, Ssid.SsidLength, keyMaterial); + NdisMoveMemory(pAdapter->StaCfg.PMK, keyMaterial, 32); + } + } + pAdapter->MlmeAux.CurrReqIsFromNdis = TRUE; pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE; pAdapter->bConfigChanged = TRUE; @@ -2927,7 +3081,7 @@ INT Set_SSID_Proc( success = FALSE; if (StateMachineTouched) // Upper layer sent a MLME-related operations - RT28XX_MLME_HANDLER(pAdapter); + RTMP_MLME_HANDLER(pAdapter); return success; } @@ -2943,16 +3097,16 @@ INT Set_SSID_Proc( */ INT Set_WmmCapable_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { BOOLEAN bWmmCapable; bWmmCapable = simple_strtol(arg, 0, 10); if ((bWmmCapable == 1) -#ifdef RT2870 +#ifdef RTMP_MAC_USB && (pAd->NumberOfPipes >= 5) -#endif // RT2870 // +#endif // RTMP_MAC_USB // ) pAd->CommonCfg.bWmmCapable = TRUE; else if (bWmmCapable == 0) @@ -2977,7 +3131,7 @@ INT Set_WmmCapable_Proc( */ INT Set_NetworkType_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg) + IN PSTRING arg) { UINT32 Value = 0; @@ -3043,8 +3197,6 @@ INT Set_NetworkType_Proc( pAdapter->StaCfg.BssType = BSS_INFRA; pAdapter->net_dev->type = pAdapter->StaCfg.OriDevType; DBGPRINT(RT_DEBUG_TRACE, ("===>Set_NetworkType_Proc::(INFRA)\n")); - - pAdapter->StaCfg.BssType = BSS_INFRA; } else if (strcmp(arg, "Monitor") == 0) { @@ -3056,7 +3208,7 @@ INT Set_NetworkType_Proc( // disable all periodic state machine pAdapter->StaCfg.bAutoReconnect = FALSE; // reset all mlme state machine - RT28XX_MLME_RESET_STATE_MACHINE(pAdapter); + RTMP_MLME_RESET_STATE_MACHINE(pAdapter); DBGPRINT(RT_DEBUG_TRACE, ("fOP_STATUS_MEDIA_STATE_CONNECTED \n")); if (pAdapter->CommonCfg.CentralChannel == 0) { @@ -3164,7 +3316,7 @@ INT Set_NetworkType_Proc( */ INT Set_AuthMode_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg) + IN PSTRING arg) { if ((strcmp(arg, "WEPAUTO") == 0) || (strcmp(arg, "wepauto") == 0)) pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeAutoSwitch; @@ -3202,7 +3354,7 @@ INT Set_AuthMode_Proc( */ INT Set_EncrypType_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg) + IN PSTRING arg) { if ((strcmp(arg, "NONE") == 0) || (strcmp(arg, "none") == 0)) { @@ -3260,7 +3412,7 @@ INT Set_EncrypType_Proc( */ INT Set_DefaultKeyID_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg) + IN PSTRING arg) { ULONG KeyIdx; @@ -3285,7 +3437,7 @@ INT Set_DefaultKeyID_Proc( */ INT Set_Key1_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg) + IN PSTRING arg) { int KeyLen; int i; @@ -3366,7 +3518,7 @@ INT Set_Key1_Proc( */ INT Set_Key2_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg) + IN PSTRING arg) { int KeyLen; int i; @@ -3445,7 +3597,7 @@ INT Set_Key2_Proc( */ INT Set_Key3_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg) + IN PSTRING arg) { int KeyLen; int i; @@ -3524,7 +3676,7 @@ INT Set_Key3_Proc( */ INT Set_Key4_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg) + IN PSTRING arg) { int KeyLen; int i; @@ -3603,50 +3755,40 @@ INT Set_Key4_Proc( ========================================================================== */ INT Set_WPAPSK_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg) + IN PRTMP_ADAPTER pAd, + IN PSTRING arg) { - UCHAR keyMaterial[40]; + int status; - if ((pAdapter->StaCfg.AuthMode != Ndis802_11AuthModeWPAPSK) && - (pAdapter->StaCfg.AuthMode != Ndis802_11AuthModeWPA2PSK) && - (pAdapter->StaCfg.AuthMode != Ndis802_11AuthModeWPANone) + if ((pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPAPSK) && + (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPA2PSK) && + (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPANone) ) return TRUE; // do nothing DBGPRINT(RT_DEBUG_TRACE, ("Set_WPAPSK_Proc::(WPAPSK=%s)\n", arg)); - NdisZeroMemory(keyMaterial, 40); - - if ((strlen(arg) < 8) || (strlen(arg) > 64)) + status = RT_CfgSetWPAPSKKey(pAd, arg, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, pAd->StaCfg.PMK); + if (status == FALSE) { - DBGPRINT(RT_DEBUG_TRACE, ("Set failed!!(WPAPSK=%s), WPAPSK key-string required 8 ~ 64 characters \n", arg)); + DBGPRINT(RT_DEBUG_TRACE, ("Set_WPAPSK_Proc(): Set key failed!\n")); return FALSE; } - - if (strlen(arg) == 64) - { - AtoH(arg, keyMaterial, 32); - NdisMoveMemory(pAdapter->StaCfg.PMK, keyMaterial, 32); - - } - else - { - PasswordHash((char *)arg, pAdapter->MlmeAux.Ssid, pAdapter->MlmeAux.SsidLen, keyMaterial); - NdisMoveMemory(pAdapter->StaCfg.PMK, keyMaterial, 32); - } + NdisZeroMemory(pAd->StaCfg.WpaPassPhrase, 64); + NdisMoveMemory(pAd->StaCfg.WpaPassPhrase, arg, strlen(arg)); + pAd->StaCfg.WpaPassPhraseLen = (UINT)strlen(arg); - if(pAdapter->StaCfg.BssType == BSS_ADHOC && - pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) + if(pAd->StaCfg.BssType == BSS_ADHOC && + pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) { - pAdapter->StaCfg.WpaState = SS_NOTUSE; + pAd->StaCfg.WpaState = SS_NOTUSE; } else { // Start STA supplicant state machine - pAdapter->StaCfg.WpaState = SS_START; + pAd->StaCfg.WpaState = SS_START; } return TRUE; @@ -3662,7 +3804,7 @@ INT Set_WPAPSK_Proc( */ INT Set_PSMode_Proc( IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg) + IN PSTRING arg) { if (pAdapter->StaCfg.BssType == BSS_INFRA) { @@ -3670,7 +3812,7 @@ INT Set_PSMode_Proc( (strcmp(arg, "max_psp") == 0) || (strcmp(arg, "MAX_PSP") == 0)) { - // do NOT turn on PSM bit here, wait until MlmeCheckForPsmChange() + // do NOT turn on PSM bit here, wait until MlmeCheckPsmChange() // to exclude certain situations. if (pAdapter->StaCfg.bWindowsACCAMEnable == FALSE) pAdapter->StaCfg.WindowsPowerMode = Ndis802_11PowerModeMAX_PSP; @@ -3683,7 +3825,7 @@ INT Set_PSMode_Proc( (strcmp(arg, "fast_psp") == 0) || (strcmp(arg, "FAST_PSP") == 0)) { - // do NOT turn on PSM bit here, wait until MlmeCheckForPsmChange() + // do NOT turn on PSM bit here, wait until MlmeCheckPsmChange() // to exclude certain situations. OPSTATUS_SET_FLAG(pAdapter, fOP_STATUS_RECEIVE_DTIM); if (pAdapter->StaCfg.bWindowsACCAMEnable == FALSE) @@ -3695,7 +3837,7 @@ INT Set_PSMode_Proc( (strcmp(arg, "legacy_psp") == 0) || (strcmp(arg, "LEGACY_PSP") == 0)) { - // do NOT turn on PSM bit here, wait until MlmeCheckForPsmChange() + // do NOT turn on PSM bit here, wait until MlmeCheckPsmChange() // to exclude certain situations. OPSTATUS_SET_FLAG(pAdapter, fOP_STATUS_RECEIVE_DTIM); if (pAdapter->StaCfg.bWindowsACCAMEnable == FALSE) @@ -3707,7 +3849,7 @@ INT Set_PSMode_Proc( { //Default Ndis802_11PowerModeCAM // clear PSM bit immediately - MlmeSetPsmBit(pAdapter, PWR_ACTIVE); + RTMP_SET_PSM_BIT(pAdapter, PWR_ACTIVE); OPSTATUS_SET_FLAG(pAdapter, fOP_STATUS_RECEIVE_DTIM); if (pAdapter->StaCfg.bWindowsACCAMEnable == FALSE) pAdapter->StaCfg.WindowsPowerMode = Ndis802_11PowerModeCAM; @@ -3737,7 +3879,7 @@ INT Set_PSMode_Proc( */ INT Set_Wpa_Support( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { if ( simple_strtol(arg, 0, 10) == 0) @@ -3756,7 +3898,7 @@ INT Set_Wpa_Support( INT Set_TGnWifiTest_Proc( IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) + IN PSTRING arg) { if (simple_strtol(arg, 0, 10) == 0) pAd->StaCfg.bTGnWifiTest = FALSE; @@ -3767,30 +3909,161 @@ INT Set_TGnWifiTest_Proc( return TRUE; } -INT Set_LongRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg) + + + +INT Show_Adhoc_MacTable_Proc( + IN PRTMP_ADAPTER pAd, + IN PSTRING extra) { - TX_RTY_CFG_STRUC tx_rty_cfg; - UCHAR LongRetryLimit = (UCHAR)simple_strtol(arg, 0, 10); + INT i; + + sprintf(extra, "\n"); + + sprintf(extra + strlen(extra), "HT Operating Mode : %d\n", pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode); + + sprintf(extra + strlen(extra), "\n%-19s%-4s%-4s%-7s%-7s%-7s%-10s%-6s%-6s%-6s%-6s\n", + "MAC", "AID", "BSS", "RSSI0", "RSSI1", "RSSI2", "PhMd", "BW", "MCS", "SGI", "STBC"); + + for (i=1; iMacTab.Content[i]; + + if (strlen(extra) > (IW_PRIV_SIZE_MASK - 30)) + break; + if ((pEntry->ValidAsCLI || pEntry->ValidAsApCli) && (pEntry->Sst == SST_ASSOC)) + { + sprintf(extra + strlen(extra), "%02X:%02X:%02X:%02X:%02X:%02X ", + pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2], + pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]); + sprintf(extra + strlen(extra), "%-4d", (int)pEntry->Aid); + sprintf(extra + strlen(extra), "%-4d", (int)pEntry->apidx); + sprintf(extra + strlen(extra), "%-7d", pEntry->RssiSample.AvgRssi0); + sprintf(extra + strlen(extra), "%-7d", pEntry->RssiSample.AvgRssi1); + sprintf(extra + strlen(extra), "%-7d", pEntry->RssiSample.AvgRssi2); + sprintf(extra + strlen(extra), "%-10s", GetPhyMode(pEntry->HTPhyMode.field.MODE)); + sprintf(extra + strlen(extra), "%-6s", GetBW(pEntry->HTPhyMode.field.BW)); + sprintf(extra + strlen(extra), "%-6d", pEntry->HTPhyMode.field.MCS); + sprintf(extra + strlen(extra), "%-6d", pEntry->HTPhyMode.field.ShortGI); + sprintf(extra + strlen(extra), "%-6d", pEntry->HTPhyMode.field.STBC); + sprintf(extra + strlen(extra), "%-10d, %d, %d%%\n", pEntry->DebugFIFOCount, pEntry->DebugTxCount, + (pEntry->DebugTxCount) ? ((pEntry->DebugTxCount-pEntry->DebugFIFOCount)*100/pEntry->DebugTxCount) : 0); + sprintf(extra, "%s\n", extra); + } + } - RTMP_IO_READ32(pAdapter, TX_RTY_CFG, &tx_rty_cfg.word); - tx_rty_cfg.field.LongRtyLimit = LongRetryLimit; - RTMP_IO_WRITE32(pAdapter, TX_RTY_CFG, tx_rty_cfg.word); - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_LongRetryLimit_Proc::(tx_rty_cfg=0x%x)\n", tx_rty_cfg.word)); return TRUE; } -INT Set_ShortRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PUCHAR arg) + +INT Set_BeaconLostTime_Proc( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg) +{ + ULONG ltmp = (ULONG)simple_strtol(arg, 0, 10); + + if ((ltmp != 0) && (ltmp <= 60)) + pAd->StaCfg.BeaconLostTime = (ltmp * OS_HZ); + + DBGPRINT(RT_DEBUG_TRACE, ("IF Set_BeaconLostTime_Proc::(BeaconLostTime=%ld)\n", pAd->StaCfg.BeaconLostTime)); + return TRUE; +} + +INT Set_AutoRoaming_Proc( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg) +{ + if (simple_strtol(arg, 0, 10) == 0) + pAd->StaCfg.bAutoRoaming = FALSE; + else + pAd->StaCfg.bAutoRoaming = TRUE; + + DBGPRINT(RT_DEBUG_TRACE, ("IF Set_AutoRoaming_Proc::(bAutoRoaming=%d)\n", pAd->StaCfg.bAutoRoaming)); + return TRUE; +} + + +/* + ========================================================================== + Description: + Issue a site survey command to driver + Arguments: + pAdapter Pointer to our adapter + wrq Pointer to the ioctl argument + + Return Value: + None + + Note: + Usage: + 1.) iwpriv ra0 set site_survey + ========================================================================== +*/ +INT Set_SiteSurvey_Proc( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg) { - TX_RTY_CFG_STRUC tx_rty_cfg; - UCHAR ShortRetryLimit = (UCHAR)simple_strtol(arg, 0, 10); + NDIS_802_11_SSID Ssid; + + //check if the interface is down + if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) + { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + return -ENETDOWN; + } + + if (MONITOR_ON(pAd)) + { + DBGPRINT(RT_DEBUG_TRACE, ("!!! Driver is in Monitor Mode now !!!\n")); + return -EINVAL; + } + + RTMPZeroMemory(&Ssid, sizeof(NDIS_802_11_SSID)); + Ssid.SsidLength = 0; + if ((arg != NULL) && + (strlen(arg) <= MAX_LEN_OF_SSID)) + { + RTMPMoveMemory(Ssid.Ssid, arg, strlen(arg)); + Ssid.SsidLength = strlen(arg); + } + + pAd->StaCfg.bScanReqIsFromWebUI = TRUE; + + if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) + { + RTMP_MLME_RESET_STATE_MACHINE(pAd); + DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); + } + + // tell CNTL state machine to call NdisMSetInformationComplete() after completing + // this request, because this request is initiated by NDIS. + pAd->MlmeAux.CurrReqIsFromNdis = FALSE; + // Reset allowed scan retries + pAd->StaCfg.ScanCnt = 0; + NdisGetSystemUpTime(&pAd->StaCfg.LastScanTime); + + MlmeEnqueue(pAd, + MLME_CNTL_STATE_MACHINE, + OID_802_11_BSSID_LIST_SCAN, + Ssid.SsidLength, + Ssid.Ssid); + + RTMP_MLME_HANDLER(pAd); + + DBGPRINT(RT_DEBUG_TRACE, ("Set_SiteSurvey_Proc\n")); + + return TRUE; +} + +INT Set_ForceTxBurst_Proc( + IN PRTMP_ADAPTER pAd, + IN PSTRING arg) +{ + if (simple_strtol(arg, 0, 10) == 0) + pAd->StaCfg.bForceTxBurst = FALSE; + else + pAd->StaCfg.bForceTxBurst = TRUE; - RTMP_IO_READ32(pAdapter, TX_RTY_CFG, &tx_rty_cfg.word); - tx_rty_cfg.field.ShortRtyLimit = ShortRetryLimit; - RTMP_IO_WRITE32(pAdapter, TX_RTY_CFG, tx_rty_cfg.word); - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_ShortRetryLimit_Proc::(tx_rty_cfg=0x%x)\n", tx_rty_cfg.word)); + DBGPRINT(RT_DEBUG_TRACE, ("IF Set_ForceTxBurst_Proc::(bForceTxBurst=%d)\n", pAd->StaCfg.bForceTxBurst)); return TRUE; } diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c new file mode 100644 index 000000000000..16e1bbfce435 --- /dev/null +++ b/drivers/staging/rt2860/usb_main_dev.c @@ -0,0 +1,897 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + *************************************************************************/ + +#include "rt_config.h" + + +// Following information will be show when you run 'modinfo' +// *** If you have a solution for the bug in current version of driver, please mail to me. +// Otherwise post to forum in ralinktech's web site(www.ralinktech.com) and let all users help you. *** +MODULE_AUTHOR("Paul Lin "); +MODULE_DESCRIPTION("RT2870/RT3070 Wireless Lan Linux Driver"); +MODULE_LICENSE("GPL"); +#ifdef MODULE_VERSION +MODULE_VERSION(STA_DRIVER_VERSION); +#endif + + +/* module table */ +struct usb_device_id rtusb_usb_id[] = { +#ifdef RT2870 + {USB_DEVICE(0x148F,0x2770)}, /* Ralink */ + {USB_DEVICE(0x148F,0x2870)}, /* Ralink */ + {USB_DEVICE(0x07B8,0x2870)}, /* AboCom */ + {USB_DEVICE(0x07B8,0x2770)}, /* AboCom */ + {USB_DEVICE(0x0DF6,0x0039)}, /* Sitecom 2770 */ + {USB_DEVICE(0x083A,0x7512)}, /* Arcadyan 2770 */ + {USB_DEVICE(0x0789,0x0162)}, /* Logitec 2870 */ + {USB_DEVICE(0x0789,0x0163)}, /* Logitec 2870 */ + {USB_DEVICE(0x0789,0x0164)}, /* Logitec 2870 */ + {USB_DEVICE(0x177f,0x0302)}, /* lsusb */ + {USB_DEVICE(0x0B05,0x1731)}, /* Asus */ + {USB_DEVICE(0x0B05,0x1732)}, /* Asus */ + {USB_DEVICE(0x0B05,0x1742)}, /* Asus */ + {USB_DEVICE(0x0DF6,0x0017)}, /* Sitecom */ + {USB_DEVICE(0x0DF6,0x002B)}, /* Sitecom */ + {USB_DEVICE(0x0DF6,0x002C)}, /* Sitecom */ + {USB_DEVICE(0x0DF6,0x002D)}, /* Sitecom */ + {USB_DEVICE(0x14B2,0x3C06)}, /* Conceptronic */ + {USB_DEVICE(0x14B2,0x3C28)}, /* Conceptronic */ + {USB_DEVICE(0x2019,0xED06)}, /* Planex Communications, Inc. */ + {USB_DEVICE(0x07D1,0x3C09)}, /* D-Link */ + {USB_DEVICE(0x07D1,0x3C11)}, /* D-Link */ + {USB_DEVICE(0x14B2,0x3C07)}, /* AL */ + {USB_DEVICE(0x050D,0x8053)}, /* Belkin */ + {USB_DEVICE(0x14B2,0x3C23)}, /* Airlink */ + {USB_DEVICE(0x14B2,0x3C27)}, /* Airlink */ + {USB_DEVICE(0x07AA,0x002F)}, /* Corega */ + {USB_DEVICE(0x07AA,0x003C)}, /* Corega */ + {USB_DEVICE(0x07AA,0x003F)}, /* Corega */ + {USB_DEVICE(0x1044,0x800B)}, /* Gigabyte */ + {USB_DEVICE(0x15A9,0x0006)}, /* Sparklan */ + {USB_DEVICE(0x083A,0xB522)}, /* SMC */ + {USB_DEVICE(0x083A,0xA618)}, /* SMC */ + {USB_DEVICE(0x083A,0x8522)}, /* Arcadyan */ + {USB_DEVICE(0x083A,0x7522)}, /* Arcadyan */ + {USB_DEVICE(0x0CDE,0x0022)}, /* ZCOM */ + {USB_DEVICE(0x0586,0x3416)}, /* Zyxel */ + {USB_DEVICE(0x0CDE,0x0025)}, /* Zyxel */ + {USB_DEVICE(0x1740,0x9701)}, /* EnGenius */ + {USB_DEVICE(0x1740,0x9702)}, /* EnGenius */ + {USB_DEVICE(0x0471,0x200f)}, /* Philips */ + {USB_DEVICE(0x14B2,0x3C25)}, /* Draytek */ + {USB_DEVICE(0x13D3,0x3247)}, /* AzureWave */ + {USB_DEVICE(0x083A,0x6618)}, /* Accton */ + {USB_DEVICE(0x15c5,0x0008)}, /* Amit */ + {USB_DEVICE(0x0E66,0x0001)}, /* Hawking */ + {USB_DEVICE(0x0E66,0x0003)}, /* Hawking */ + {USB_DEVICE(0x129B,0x1828)}, /* Siemens */ + {USB_DEVICE(0x157E,0x300E)}, /* U-Media */ + {USB_DEVICE(0x050d,0x805c)}, + {USB_DEVICE(0x050d,0x815c)}, + {USB_DEVICE(0x1482,0x3C09)}, /* Abocom*/ + {USB_DEVICE(0x14B2,0x3C09)}, /* Alpha */ + {USB_DEVICE(0x04E8,0x2018)}, /* samsung */ + {USB_DEVICE(0x5A57,0x0280)}, /* Zinwell */ + {USB_DEVICE(0x5A57,0x0282)}, /* Zinwell */ + {USB_DEVICE(0x7392,0x7718)}, + {USB_DEVICE(0x7392,0x7717)}, + {USB_DEVICE(0x1737,0x0070)}, /* Linksys WUSB100 */ + {USB_DEVICE(0x1737,0x0071)}, /* Linksys WUSB600N */ + {USB_DEVICE(0x0411,0x00e8)}, /* Buffalo WLI-UC-G300N*/ + {USB_DEVICE(0x050d,0x815c)}, /* Belkin F5D8053 */ +#endif // RT2870 // +#ifdef RT3070 + {USB_DEVICE(0x148F,0x3070)}, /* Ralink 3070 */ + {USB_DEVICE(0x148F,0x3071)}, /* Ralink 3071 */ + {USB_DEVICE(0x148F,0x3072)}, /* Ralink 3072 */ + {USB_DEVICE(0x0DB0,0x3820)}, /* Ralink 3070 */ + {USB_DEVICE(0x0DF6,0x003E)}, /* Sitecom 3070 */ + {USB_DEVICE(0x0DF6,0x0042)}, /* Sitecom 3072 */ + {USB_DEVICE(0x14B2,0x3C12)}, /* AL 3070 */ + {USB_DEVICE(0x18C5,0x0012)}, /* Corega 3070 */ + {USB_DEVICE(0x083A,0x7511)}, /* Arcadyan 3070 */ + {USB_DEVICE(0x1740,0x9703)}, /* EnGenius 3070 */ + {USB_DEVICE(0x1740,0x9705)}, /* EnGenius 3071 */ + {USB_DEVICE(0x1740,0x9706)}, /* EnGenius 3072 */ + {USB_DEVICE(0x13D3,0x3273)}, /* AzureWave 3070*/ + {USB_DEVICE(0x1044,0x800D)}, /* Gigabyte GN-WB32L 3070 */ + {USB_DEVICE(0x2019,0xAB25)}, /* Planex Communications, Inc. RT3070 */ + {USB_DEVICE(0x07B8,0x3070)}, /* AboCom 3070 */ + {USB_DEVICE(0x07B8,0x3071)}, /* AboCom 3071 */ + {USB_DEVICE(0x07B8,0x3072)}, /* Abocom 3072 */ + {USB_DEVICE(0x7392,0x7711)}, /* Edimax 3070 */ + {USB_DEVICE(0x1A32,0x0304)}, /* Quanta 3070 */ + {USB_DEVICE(0x1EDA,0x2310)}, /* AirTies 3070 */ + {USB_DEVICE(0x07D1,0x3C0A)}, /* D-Link 3072 */ + {USB_DEVICE(0x07D1,0x3C0D)}, /* D-Link 3070 */ + {USB_DEVICE(0x07D1,0x3C0E)}, /* D-Link 3070 */ + {USB_DEVICE(0x07D1,0x3C0F)}, /* D-Link 3070 */ + {USB_DEVICE(0x1D4D,0x000C)}, /* Pegatron Corporation 3070 */ + {USB_DEVICE(0x1D4D,0x000E)}, /* Pegatron Corporation 3070 */ + {USB_DEVICE(0x5A57,0x5257)}, /* Zinwell 3070 */ + {USB_DEVICE(0x5A57,0x0283)}, /* Zinwell 3072 */ + {USB_DEVICE(0x04BB,0x0945)}, /* I-O DATA 3072 */ + {USB_DEVICE(0x203D,0x1480)}, /* Encore 3070 */ +#endif // RT3070 // + { USB_DEVICE(0x0DF6, 0x003F) }, /* Sitecom WL-608 */ + { USB_DEVICE(0x1737, 0x0077) }, /* Linksys WUSB54GC-EU v3 */ + { USB_DEVICE(0x2001, 0x3C09) }, /* D-Link */ + { USB_DEVICE(0x2001, 0x3C0A) }, /* D-Link 3072*/ + { USB_DEVICE(0x2019, 0xED14) }, /* Planex Communications, Inc. */ + { }/* Terminating entry */ +}; + +INT const rtusb_usb_id_len = sizeof(rtusb_usb_id) / sizeof(struct usb_device_id); + +MODULE_DEVICE_TABLE(usb, rtusb_usb_id); + +static void rt2870_disconnect( + IN struct usb_device *dev, + IN PRTMP_ADAPTER pAd); + +static int __devinit rt2870_probe( + IN struct usb_interface *intf, + IN struct usb_device *usb_dev, + IN const struct usb_device_id *dev_id, + IN RTMP_ADAPTER **ppAd); + +#ifndef PF_NOFREEZE +#define PF_NOFREEZE 0 +#endif + + +extern int rt28xx_close(IN struct net_device *net_dev); +extern int rt28xx_open(struct net_device *net_dev); + +static BOOLEAN USBDevConfigInit( + IN struct usb_device *dev, + IN struct usb_interface *intf, + IN RTMP_ADAPTER *pAd); + + +/* +======================================================================== +Routine Description: + Check the chipset vendor/product ID. + +Arguments: + _dev_p Point to the PCI or USB device + +Return Value: + TRUE Check ok + FALSE Check fail + +Note: +======================================================================== +*/ +BOOLEAN RT28XXChipsetCheck( + IN void *_dev_p) +{ + struct usb_interface *intf = (struct usb_interface *)_dev_p; + struct usb_device *dev_p = interface_to_usbdev(intf); + UINT32 i; + + + for(i=0; idescriptor.idVendor == rtusb_usb_id[i].idVendor && + dev_p->descriptor.idProduct == rtusb_usb_id[i].idProduct) + { + printk("rt2870: idVendor = 0x%x, idProduct = 0x%x\n", + dev_p->descriptor.idVendor, dev_p->descriptor.idProduct); + break; + } + } + + if (i == rtusb_usb_id_len) + { + printk("rt2870: Error! Device Descriptor not matching!\n"); + return FALSE; + } + + return TRUE; +} + +/**************************************************************************/ +/**************************************************************************/ +//tested for kernel 2.6series +/**************************************************************************/ +/**************************************************************************/ + +#ifdef CONFIG_PM +static int rt2870_suspend(struct usb_interface *intf, pm_message_t state); +static int rt2870_resume(struct usb_interface *intf); +#endif // CONFIG_PM // + +static int rtusb_probe (struct usb_interface *intf, + const struct usb_device_id *id); +static void rtusb_disconnect(struct usb_interface *intf); + +static BOOLEAN USBDevConfigInit( + IN struct usb_device *dev, + IN struct usb_interface *intf, + IN RTMP_ADAPTER *pAd) +{ + struct usb_host_interface *iface_desc; + ULONG BulkOutIdx; + UINT32 i; + + + /* get the active interface descriptor */ + iface_desc = intf->cur_altsetting; + + /* get # of enpoints */ + pAd->NumberOfPipes = iface_desc->desc.bNumEndpoints; + DBGPRINT(RT_DEBUG_TRACE, ("NumEndpoints=%d\n", iface_desc->desc.bNumEndpoints)); + + /* Configure Pipes */ + BulkOutIdx = 0; + + for(i=0; iNumberOfPipes; i++) + { + if ((iface_desc->endpoint[i].desc.bmAttributes == + USB_ENDPOINT_XFER_BULK) && + ((iface_desc->endpoint[i].desc.bEndpointAddress & + USB_ENDPOINT_DIR_MASK) == USB_DIR_IN)) + { + pAd->BulkInEpAddr = iface_desc->endpoint[i].desc.bEndpointAddress; + pAd->BulkInMaxPacketSize = le2cpu16(iface_desc->endpoint[i].desc.wMaxPacketSize); + + DBGPRINT_RAW(RT_DEBUG_TRACE, ("BULK IN MaxPacketSize = %d\n", pAd->BulkInMaxPacketSize)); + DBGPRINT_RAW(RT_DEBUG_TRACE, ("EP address = 0x%2x\n", iface_desc->endpoint[i].desc.bEndpointAddress)); + } + else if ((iface_desc->endpoint[i].desc.bmAttributes == + USB_ENDPOINT_XFER_BULK) && + ((iface_desc->endpoint[i].desc.bEndpointAddress & + USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT)) + { + // there are 6 bulk out EP. EP6 highest priority. + // EP1-4 is EDCA. EP5 is HCCA. + pAd->BulkOutEpAddr[BulkOutIdx++] = iface_desc->endpoint[i].desc.bEndpointAddress; + pAd->BulkOutMaxPacketSize = le2cpu16(iface_desc->endpoint[i].desc.wMaxPacketSize); + + DBGPRINT_RAW(RT_DEBUG_TRACE, ("BULK OUT MaxPacketSize = %d\n", pAd->BulkOutMaxPacketSize)); + DBGPRINT_RAW(RT_DEBUG_TRACE, ("EP address = 0x%2x \n", iface_desc->endpoint[i].desc.bEndpointAddress)); + } + } + + if (!(pAd->BulkInEpAddr && pAd->BulkOutEpAddr[0])) + { + printk("%s: Could not find both bulk-in and bulk-out endpoints\n", __FUNCTION__); + return FALSE; + } + + pAd->config = &dev->config->desc; + usb_set_intfdata(intf, pAd); + + return TRUE; + +} + + + +static int rtusb_probe (struct usb_interface *intf, + const struct usb_device_id *id) +{ + RTMP_ADAPTER *pAd; + struct usb_device *dev; + int rv; + + dev = interface_to_usbdev(intf); + dev = usb_get_dev(dev); + + rv = rt2870_probe(intf, dev, id, &pAd); + if (rv != 0) + usb_put_dev(dev); + + return rv; +} + + +static void rtusb_disconnect(struct usb_interface *intf) +{ + struct usb_device *dev = interface_to_usbdev(intf); + PRTMP_ADAPTER pAd; + + + pAd = usb_get_intfdata(intf); + usb_set_intfdata(intf, NULL); + + rt2870_disconnect(dev, pAd); +} + + +struct usb_driver rtusb_driver = { + .name="rt2870", + .probe=rtusb_probe, + .disconnect=rtusb_disconnect, + .id_table=rtusb_usb_id, + +#ifdef CONFIG_PM + suspend: rt2870_suspend, + resume: rt2870_resume, +#endif + }; + +#ifdef CONFIG_PM + +VOID RT2870RejectPendingPackets( + IN PRTMP_ADAPTER pAd) +{ + // clear PS packets + // clear TxSw packets +} + +static int rt2870_suspend( + struct usb_interface *intf, + pm_message_t state) +{ + struct net_device *net_dev; + PRTMP_ADAPTER pAd = usb_get_intfdata(intf); + + + DBGPRINT(RT_DEBUG_TRACE, ("===> rt2870_suspend()\n")); + net_dev = pAd->net_dev; + netif_device_detach(net_dev); + + pAd->PM_FlgSuspend = 1; + if (netif_running(net_dev)) { + RTUSBCancelPendingBulkInIRP(pAd); + RTUSBCancelPendingBulkOutIRP(pAd); + } + DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2870_suspend()\n")); + return 0; +} + +static int rt2870_resume( + struct usb_interface *intf) +{ + struct net_device *net_dev; + PRTMP_ADAPTER pAd = usb_get_intfdata(intf); + + + DBGPRINT(RT_DEBUG_TRACE, ("===> rt2870_resume()\n")); + + pAd->PM_FlgSuspend = 0; + net_dev = pAd->net_dev; + netif_device_attach(net_dev); + netif_start_queue(net_dev); + netif_carrier_on(net_dev); + netif_wake_queue(net_dev); + + DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2870_resume()\n")); + return 0; +} +#endif // CONFIG_PM // + +// Init driver module +INT __init rtusb_init(void) +{ + printk("rtusb init --->\n"); + return usb_register(&rtusb_driver); +} + +// Deinit driver module +VOID __exit rtusb_exit(void) +{ + usb_deregister(&rtusb_driver); + printk("<--- rtusb exit\n"); +} + +module_init(rtusb_init); +module_exit(rtusb_exit); + + + + +/*--------------------------------------------------------------------- */ +/* function declarations */ +/*--------------------------------------------------------------------- */ + +/* +======================================================================== +Routine Description: + MLME kernel thread. + +Arguments: + *Context the pAd, driver control block pointer + +Return Value: + 0 close the thread + +Note: +======================================================================== +*/ +INT MlmeThread( + IN void *Context) +{ + RTMP_ADAPTER *pAd; + RTMP_OS_TASK *pTask; + int status; + status = 0; + + pTask = (RTMP_OS_TASK *)Context; + pAd = (PRTMP_ADAPTER)pTask->priv; + + RtmpOSTaskCustomize(pTask); + + while(!pTask->task_killed) + { +#ifdef KTHREAD_SUPPORT + RTMP_WAIT_EVENT_INTERRUPTIBLE(pAd, pTask); +#else + RTMP_SEM_EVENT_WAIT(&(pTask->taskSema), status); + + /* unlock the device pointers */ + if (status != 0) + { + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); + break; + } +#endif + + /* lock the device pointers , need to check if required*/ + //down(&(pAd->usbdev_semaphore)); + + if (!pAd->PM_FlgSuspend) + MlmeHandler(pAd); + } + + /* notify the exit routine that we're actually exiting now + * + * complete()/wait_for_completion() is similar to up()/down(), + * except that complete() is safe in the case where the structure + * is getting deleted in a parallel mode of execution (i.e. just + * after the down() -- that's necessary for the thread-shutdown + * case. + * + * complete_and_exit() goes even further than this -- it is safe in + * the case that the thread of the caller is going away (not just + * the structure) -- this is necessary for the module-remove case. + * This is important in preemption kernels, which transfer the flow + * of execution immediately upon a complete(). + */ + DBGPRINT(RT_DEBUG_TRACE,( "<---%s\n",__FUNCTION__)); +#ifndef KTHREAD_SUPPORT + pTask->taskPID = THREAD_PID_INIT_VALUE; + complete_and_exit (&pTask->taskComplete, 0); +#endif + return 0; + +} + + +/* +======================================================================== +Routine Description: + USB command kernel thread. + +Arguments: + *Context the pAd, driver control block pointer + +Return Value: + 0 close the thread + +Note: +======================================================================== +*/ +INT RTUSBCmdThread( + IN void * Context) +{ + RTMP_ADAPTER *pAd; + RTMP_OS_TASK *pTask; + int status; + status = 0; + + pTask = (RTMP_OS_TASK *)Context; + pAd = (PRTMP_ADAPTER)pTask->priv; + + RtmpOSTaskCustomize(pTask); + + NdisAcquireSpinLock(&pAd->CmdQLock); + pAd->CmdQ.CmdQState = RTMP_TASK_STAT_RUNNING; + NdisReleaseSpinLock(&pAd->CmdQLock); + + while (pAd && pAd->CmdQ.CmdQState == RTMP_TASK_STAT_RUNNING) + { +#ifdef KTHREAD_SUPPORT + RTMP_WAIT_EVENT_INTERRUPTIBLE(pAd, pTask); +#else + /* lock the device pointers */ + RTMP_SEM_EVENT_WAIT(&(pTask->taskSema), status); + + if (status != 0) + { + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); + break; + } +#endif + + if (pAd->CmdQ.CmdQState == RTMP_TASK_STAT_STOPED) + break; + + if (!pAd->PM_FlgSuspend) + CMDHandler(pAd); + } + + if (pAd && !pAd->PM_FlgSuspend) + { // Clear the CmdQElements. + CmdQElmt *pCmdQElmt = NULL; + + NdisAcquireSpinLock(&pAd->CmdQLock); + pAd->CmdQ.CmdQState = RTMP_TASK_STAT_STOPED; + while(pAd->CmdQ.size) + { + RTUSBDequeueCmd(&pAd->CmdQ, &pCmdQElmt); + if (pCmdQElmt) + { + if (pCmdQElmt->CmdFromNdis == TRUE) + { + if (pCmdQElmt->buffer != NULL) + os_free_mem(pAd, pCmdQElmt->buffer); + os_free_mem(pAd, (PUCHAR)pCmdQElmt); + } + else + { + if ((pCmdQElmt->buffer != NULL) && (pCmdQElmt->bufferlength != 0)) + os_free_mem(pAd, pCmdQElmt->buffer); + os_free_mem(pAd, (PUCHAR)pCmdQElmt); + } + } + } + + NdisReleaseSpinLock(&pAd->CmdQLock); + } + /* notify the exit routine that we're actually exiting now + * + * complete()/wait_for_completion() is similar to up()/down(), + * except that complete() is safe in the case where the structure + * is getting deleted in a parallel mode of execution (i.e. just + * after the down() -- that's necessary for the thread-shutdown + * case. + * + * complete_and_exit() goes even further than this -- it is safe in + * the case that the thread of the caller is going away (not just + * the structure) -- this is necessary for the module-remove case. + * This is important in preemption kernels, which transfer the flow + * of execution immediately upon a complete(). + */ + DBGPRINT(RT_DEBUG_TRACE,( "<---RTUSBCmdThread\n")); + +#ifndef KTHREAD_SUPPORT + pTask->taskPID = THREAD_PID_INIT_VALUE; + complete_and_exit (&pTask->taskComplete, 0); +#endif + return 0; + +} + + +VOID RTUSBWatchDog(IN RTMP_ADAPTER *pAd) +{ + PHT_TX_CONTEXT pHTTXContext; + int idx; + ULONG irqFlags; + PURB pUrb; + BOOLEAN needDumpSeq = FALSE; + UINT32 MACValue; + UINT32 TxRxQ_Pcnt; + + idx = 0; + RTMP_IO_READ32(pAd, TXRXQ_PCNT, &MACValue); + if ((MACValue & 0xff) !=0 ) + { + DBGPRINT(RT_DEBUG_TRACE, ("TX QUEUE 0 Not EMPTY(Value=0x%0x). !!!!!!!!!!!!!!!\n", MACValue)); + RTMP_IO_WRITE32(pAd, PBF_CFG, 0xf40012); + while((MACValue &0xff) != 0 && (idx++ < 10)) + { + RTMP_IO_READ32(pAd, TXRXQ_PCNT, &MACValue); + RTMPusecDelay(1); + } + RTMP_IO_WRITE32(pAd, PBF_CFG, 0xf40006); + } + + if (pAd->watchDogRxOverFlowCnt >= 2) + { + DBGPRINT(RT_DEBUG_TRACE, ("Maybe the Rx Bulk-In hanged! Cancel the pending Rx bulks request!\n")); + if ((!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | + fRTMP_ADAPTER_BULKIN_RESET | + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST)))) + { + DBGPRINT(RT_DEBUG_TRACE, ("Call CMDTHREAD_RESET_BULK_IN to cancel the pending Rx Bulk!\n")); + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKIN_RESET); + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_IN, NULL, 0); + needDumpSeq = TRUE; + } + pAd->watchDogRxOverFlowCnt = 0; + } + + RTUSBReadMACRegister(pAd, 0x438, &TxRxQ_Pcnt); + + for (idx = 0; idx < NUM_OF_TX_RING; idx++) + { + pUrb = NULL; + + RTMP_IRQ_LOCK(&pAd->BulkOutLock[idx], irqFlags); + if ((pAd->BulkOutPending[idx] == TRUE) && pAd->watchDogTxPendingCnt) + { + INT actual_length=0,transfer_buffer_length=0; + BOOLEAN isDataPacket=FALSE; + pAd->watchDogTxPendingCnt[idx]++; + + if ((pAd->watchDogTxPendingCnt[idx] > 2) && + (!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_BULKOUT_RESET))) + ) + { + // FIXME: Following code just support single bulk out. If you wanna support multiple bulk out. Modify it! + pHTTXContext = (PHT_TX_CONTEXT)(&pAd->TxContext[idx]); + if (pHTTXContext->IRPPending) + { // Check TxContext. + pUrb = pHTTXContext->pUrb; + + actual_length=pUrb->actual_length; + transfer_buffer_length=pUrb->transfer_buffer_length; + isDataPacket=TRUE; + } + else if (idx == MGMTPIPEIDX) + { + PTX_CONTEXT pMLMEContext, pNULLContext, pPsPollContext; + + //Check MgmtContext. + pMLMEContext = (PTX_CONTEXT)(pAd->MgmtRing.Cell[pAd->MgmtRing.TxDmaIdx].AllocVa); + pPsPollContext = (PTX_CONTEXT)(&pAd->PsPollContext); + pNULLContext = (PTX_CONTEXT)(&pAd->NullContext); + + if (pMLMEContext->IRPPending) + { + ASSERT(pMLMEContext->IRPPending); + pUrb = pMLMEContext->pUrb; + } + else if (pNULLContext->IRPPending) + { + ASSERT(pNULLContext->IRPPending); + pUrb = pNULLContext->pUrb; + } + else if (pPsPollContext->IRPPending) + { + ASSERT(pPsPollContext->IRPPending); + pUrb = pPsPollContext->pUrb; + } + } + + RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[idx], irqFlags); + + + printk("%d:%d LTL=%d , TL=%d L:%d\n",idx,pAd->watchDogTxPendingCnt[idx],pAd->TransferedLength[idx] + ,actual_length,transfer_buffer_length); + + if (pUrb) + { + if ((isDataPacket + && pAd->TransferedLength[idx]==actual_length + && pAd->TransferedLength[idx]watchDogTxPendingCnt[idx]>3) + || isDataPacket==FALSE || pAd->watchDogTxPendingCnt[idx]>6) + { + DBGPRINT(RT_DEBUG_TRACE, ("Maybe the Tx Bulk-Out hanged! Cancel the pending Tx bulks request of idx(%d)!\n", idx)); + DBGPRINT(RT_DEBUG_TRACE, ("Unlink the pending URB!\n")); + // unlink it now + RTUSB_UNLINK_URB(pUrb); + // Sleep 200 microseconds to give cancellation time to work + //RTMPusecDelay(200); + needDumpSeq = TRUE; + } + } + else + { + DBGPRINT(RT_DEBUG_ERROR, ("Unkonw bulkOut URB maybe hanged!!!!!!!!!!!!\n")); + } + } + else + { + RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[idx], irqFlags); + } + + if (isDataPacket==TRUE) + pAd->TransferedLength[idx]=actual_length; + } + else + { + RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[idx], irqFlags); + } + } + + // For Sigma debug, dump the ba_reordering sequence. + if((needDumpSeq == TRUE) && (pAd->CommonCfg.bDisableReordering == 0)) + { + USHORT Idx; + PBA_REC_ENTRY pBAEntry = NULL; + UCHAR count = 0; + struct reordering_mpdu *mpdu_blk; + + Idx = pAd->MacTab.Content[BSSID_WCID].BARecWcidArray[0]; + + pBAEntry = &pAd->BATable.BARecEntry[Idx]; + if((pBAEntry->list.qlen > 0) && (pBAEntry->list.next != NULL)) + { + DBGPRINT(RT_DEBUG_TRACE, ("NICUpdateRawCounters():The Queueing pkt in reordering buffer:\n")); + NdisAcquireSpinLock(&pBAEntry->RxReRingLock); + mpdu_blk = pBAEntry->list.next; + while (mpdu_blk) + { + DBGPRINT(RT_DEBUG_TRACE, ("\t%d:Seq-%d, bAMSDU-%d!\n", count, mpdu_blk->Sequence, mpdu_blk->bAMSDU)); + mpdu_blk = mpdu_blk->next; + count++; + } + + DBGPRINT(RT_DEBUG_TRACE, ("\npBAEntry->LastIndSeq=%d!\n", pBAEntry->LastIndSeq)); + NdisReleaseSpinLock(&pBAEntry->RxReRingLock); + } + } +} + +/* +======================================================================== +Routine Description: + Release allocated resources. + +Arguments: + *dev Point to the PCI or USB device + pAd driver control block pointer + +Return Value: + None + +Note: +======================================================================== +*/ +static void rt2870_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd) +{ + DBGPRINT(RT_DEBUG_ERROR, ("rtusb_disconnect: unregister usbnet usb-%s-%s\n", + dev->bus->bus_name, dev->devpath)); + if (!pAd) + { + usb_put_dev(dev); + printk("rtusb_disconnect: pAd == NULL!\n"); + return; + } + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST); + + // for debug, wait to show some messages to /proc system + udelay(1); + + + RtmpPhyNetDevExit(pAd, pAd->net_dev); + + // FIXME: Shall we need following delay and flush the schedule?? + udelay(1); + flush_scheduled_work(); + udelay(1); + + // free the root net_device + RtmpOSNetDevFree(pAd->net_dev); + + RtmpRaDevCtrlExit(pAd); + + // release a use of the usb device structure + usb_put_dev(dev); + udelay(1); + + DBGPRINT(RT_DEBUG_ERROR, (" RTUSB disconnect successfully\n")); +} + + +static int __devinit rt2870_probe( + IN struct usb_interface *intf, + IN struct usb_device *usb_dev, + IN const struct usb_device_id *dev_id, + IN RTMP_ADAPTER **ppAd) +{ + struct net_device *net_dev = NULL; + RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) NULL; + INT status, rv; + PVOID handle; + RTMP_OS_NETDEV_OP_HOOK netDevHook; + + + DBGPRINT(RT_DEBUG_TRACE, ("===>rt2870_probe()!\n")); + + // Check chipset vendor/product ID + //if (RT28XXChipsetCheck(_dev_p) == FALSE) + // goto err_out; + +//RtmpDevInit============================================= + // Allocate RTMP_ADAPTER adapter structure + handle = kmalloc(sizeof(struct os_cookie), GFP_KERNEL); + if (handle == NULL) + { + printk("rt2870_probe(): Allocate memory for os handle failed!\n"); + return -ENOMEM; + } + ((POS_COOKIE)handle)->pUsb_Dev = usb_dev; + + rv = RTMPAllocAdapterBlock(handle, &pAd); + if (rv != NDIS_STATUS_SUCCESS) + { + kfree(handle); + goto err_out; + } + +//USBDevInit============================================== + if (USBDevConfigInit(usb_dev, intf, pAd) == FALSE) + goto err_out_free_radev; + + RtmpRaDevCtrlInit(pAd, RTMP_DEV_INF_USB); + +//NetDevInit============================================== + net_dev = RtmpPhyNetDevInit(pAd, &netDevHook); + if (net_dev == NULL) + goto err_out_free_radev; + + // Here are the net_device structure with usb specific parameters. + /* for supporting Network Manager. + * Set the sysfs physical device reference for the network logical device if set prior to registration will + * cause a symlink during initialization. + */ + SET_NETDEV_DEV(net_dev, &(usb_dev->dev)); + + pAd->StaCfg.OriDevType = net_dev->type; + +//All done, it's time to register the net device to linux kernel. + // Register this device + status = RtmpOSNetDevAttach(net_dev, &netDevHook); + if (status != 0) + goto err_out_free_netdev; + +#ifdef KTHREAD_SUPPORT + init_waitqueue_head(&pAd->mlmeTask.kthread_q); + init_waitqueue_head(&pAd->timerTask.kthread_q); + init_waitqueue_head(&pAd->cmdQTask.kthread_q); +#endif + + *ppAd = pAd; + + DBGPRINT(RT_DEBUG_TRACE, ("<===rt2870_probe()!\n")); + + return 0; + + /* --------------------------- ERROR HANDLE --------------------------- */ +err_out_free_netdev: + RtmpOSNetDevFree(net_dev); + +err_out_free_radev: + RTMPFreeAdapter(pAd); + +err_out: + *ppAd = NULL; + + return -1; + +} diff --git a/drivers/staging/rt2860/wpa.h b/drivers/staging/rt2860/wpa.h index 7006e389e323..63f47742e05d 100644 --- a/drivers/staging/rt2860/wpa.h +++ b/drivers/staging/rt2860/wpa.h @@ -67,7 +67,6 @@ // Key Descriptor Version of Key Information #define DESC_TYPE_TKIP 1 #define DESC_TYPE_AES 2 -#define DESC_TYPE_MESH 3 #define LEN_MSG1_2WAY 0x7f #define MAX_LEN_OF_EAP_HS 256 @@ -90,11 +89,17 @@ #define TKIP_AP_RXMICK_OFFSET (TKIP_AP_TXMICK_OFFSET+LEN_TKIP_TXMICK) #define TKIP_GTK_LENGTH ((LEN_TKIP_EK)+(LEN_TKIP_RXMICK)+(LEN_TKIP_TXMICK)) #define LEN_PTK ((LEN_EAP_KEY)+(LEN_TKIP_KEY)) +#define MIN_LEN_OF_GTK 5 +#define LEN_PMK 32 +#define LEN_PMK_NAME 16 +#define LEN_NONCE 32 // RSN IE Length definition -#define MAX_LEN_OF_RSNIE 90 +#define MAX_LEN_OF_RSNIE 255 #define MIN_LEN_OF_RSNIE 8 +#define KEY_LIFETIME 3600 + //EAP Packet Type #define EAPPacket 0 #define EAPOLStart 1 @@ -119,6 +124,29 @@ #define PEER_MSG3_RETRY_TIMER_CTR 10 #define GROUP_MSG1_RETRY_TIMER_CTR 20 +//#ifdef CONFIG_AP_SUPPORT +// WPA mechanism retry timer interval +#define PEER_MSG1_RETRY_EXEC_INTV 1000 // 1 sec +#define PEER_MSG3_RETRY_EXEC_INTV 3000 // 3 sec +#define GROUP_KEY_UPDATE_EXEC_INTV 1000 // 1 sec +#define PEER_GROUP_KEY_UPDATE_INIV 2000 // 2 sec + +#define ENQUEUE_EAPOL_START_TIMER 200 // 200 ms + +// group rekey interval +#define TIME_REKEY 0 +#define PKT_REKEY 1 +#define DISABLE_REKEY 2 +#define MAX_REKEY 2 + +#define MAX_REKEY_INTER 0x3ffffff +//#endif // CONFIG_AP_SUPPORT // + +#define GROUP_SUITE 0 +#define PAIRWISE_SUITE 1 +#define AKM_SUITE 2 +#define PMKID_LIST 3 + #define EAPOL_START_DISABLE 0 #define EAPOL_START_PSK 1 @@ -129,8 +157,30 @@ #define MIX_CIPHER_WPA2_TKIP_ON(x) (((x) & 0x02) != 0) #define MIX_CIPHER_WPA2_AES_ON(x) (((x) & 0x01) != 0) +#ifndef ROUND_UP #define ROUND_UP(__x, __y) \ (((ULONG)((__x)+((__y)-1))) & ((ULONG)~((__y)-1))) +#endif + +#define SET_UINT16_TO_ARRARY(_V, _LEN) \ +{ \ + _V[0] = (_LEN & 0xFF00) >> 8; \ + _V[1] = (_LEN & 0xFF); \ +} + +#define INC_UINT16_TO_ARRARY(_V, _LEN) \ +{ \ + UINT16 var_len; \ + \ + var_len = (_V[0]<<8) | (_V[1]); \ + var_len += _LEN; \ + \ + _V[0] = (var_len & 0xFF00) >> 8; \ + _V[1] = (var_len & 0xFF); \ +} + +#define CONV_ARRARY_TO_UINT16(_V) ((_V[0]<<8) | (_V[1])) + #define ADD_ONE_To_64BIT_VAR(_V) \ { \ @@ -297,6 +347,13 @@ typedef enum _WpaMixPairCipher WPA_TKIPAES_WPA2_TKIPAES = 0x0F, } WPA_MIX_PAIR_CIPHER; +// 802.1x authentication format +typedef struct _IEEE8021X_FRAME { + UCHAR Version; // 1.0 + UCHAR Type; // 0 = EAP Packet + USHORT Length; +} IEEE8021X_FRAME, *PIEEE8021X_FRAME; + typedef struct PACKED _RSN_IE_HEADER_STRUCT { UCHAR Eid; UCHAR Length; @@ -324,4 +381,47 @@ typedef struct PACKED _RSN_CAPABILITY { USHORT PreAuth:1; } RSN_CAPABILITY, *PRSN_CAPABILITY; + +/*======================================== + The prototype is defined in cmm_wpa.c + ========================================*/ +BOOLEAN WpaMsgTypeSubst( + IN UCHAR EAPType, + OUT INT *MsgType); + +VOID PRF( + IN UCHAR *key, + IN INT key_len, + IN UCHAR *prefix, + IN INT prefix_len, + IN UCHAR *data, + IN INT data_len, + OUT UCHAR *output, + IN INT len); + +int PasswordHash( + char *password, + unsigned char *ssid, + int ssidlength, + unsigned char *output); + +PUINT8 GetSuiteFromRSNIE( + IN PUINT8 rsnie, + IN UINT rsnie_len, + IN UINT8 type, + OUT UINT8 *count); + +VOID WpaShowAllsuite( + IN PUINT8 rsnie, + IN UINT rsnie_len); + +VOID RTMPInsertRSNIE( + IN PUCHAR pFrameBuf, + OUT PULONG pFrameLen, + IN PUINT8 rsnie_ptr, + IN UINT8 rsnie_len, + IN PUINT8 pmkid_ptr, + IN UINT8 pmkid_len); + + #endif diff --git a/drivers/staging/rt2870/2870_main_dev.c b/drivers/staging/rt2870/2870_main_dev.c deleted file mode 100644 index d0ed48bed2bb..000000000000 --- a/drivers/staging/rt2870/2870_main_dev.c +++ /dev/null @@ -1,1530 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rtmp_main.c - - Abstract: - main initialization routines - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Name Date Modification logs - Jan Lee 01-10-2005 modified - Sample Jun/01/07 Merge RT2870 and RT2860 drivers. -*/ - -#include "rt_config.h" - - -// Following information will be show when you run 'modinfo' -// *** If you have a solution for the bug in current version of driver, please mail to me. -// Otherwise post to forum in ralinktech's web site(www.ralinktech.com) and let all users help you. *** -MODULE_AUTHOR("Paul Lin "); -MODULE_DESCRIPTION(RT28xx_CHIP_NAME " Wireless LAN Linux Driver"); -MODULE_LICENSE("GPL"); -#ifdef MODULE_VERSION -MODULE_VERSION(STA_DRIVER_VERSION); -#endif -MODULE_ALIAS("rt3070sta"); - -/* Kernel thread and vars, which handles packets that are completed. Only - * packets that have a "complete" function are sent here. This way, the - * completion is run out of kernel context, and doesn't block the rest of - * the stack. */ - -extern INT __devinit rt28xx_probe(IN void *_dev_p, IN void *_dev_id_p, - IN UINT argc, OUT PRTMP_ADAPTER *ppAd); - -struct usb_device_id rtusb_usb_id[] = { - { USB_DEVICE(0x148F, 0x2770) }, /* Ralink */ - { USB_DEVICE(0x1737, 0x0071) }, /* Linksys WUSB600N */ - { USB_DEVICE(0x1737, 0x0070) }, /* Linksys */ - { USB_DEVICE(0x148F, 0x2870) }, /* Ralink */ - { USB_DEVICE(0x148F, 0x3070) }, /* Ralink 3070 */ - { USB_DEVICE(0x148F, 0x3071) }, /* Ralink 3071 */ - { USB_DEVICE(0x148F, 0x3072) }, /* Ralink 3072 */ - { USB_DEVICE(0x0B05, 0x1731) }, /* Asus */ - { USB_DEVICE(0x0B05, 0x1732) }, /* Asus */ - { USB_DEVICE(0x0B05, 0x1742) }, /* Asus */ - { USB_DEVICE(0x0DF6, 0x0017) }, /* Sitecom */ - { USB_DEVICE(0x0DF6, 0x002B) }, /* Sitecom */ - { USB_DEVICE(0x0DF6, 0x002C) }, /* Sitecom */ - { USB_DEVICE(0x0DF6, 0x003E) }, /* Sitecom 3070 */ - { USB_DEVICE(0x0DF6, 0x002D) }, /* Sitecom */ - { USB_DEVICE(0x0DF6, 0x0039) }, /* Sitecom 2770 */ - { USB_DEVICE(0x0DF6, 0x003F) }, /* Sitecom WL-608 */ - { USB_DEVICE(0x14B2, 0x3C06) }, /* Conceptronic */ - { USB_DEVICE(0x14B2, 0x3C28) }, /* Conceptronic */ - { USB_DEVICE(0x2019, 0xED06) }, /* Planex Communications, Inc. */ - { USB_DEVICE(0x2019, 0xED14) }, /* Planex Communications, Inc. */ - { USB_DEVICE(0x2019, 0xAB25) }, /* Planex Communications, Inc. RT3070 */ - { USB_DEVICE(0x07D1, 0x3C09) }, /* D-Link */ - { USB_DEVICE(0x07D1, 0x3C11) }, /* D-Link */ - { USB_DEVICE(0x2001, 0x3C09) }, /* D-Link */ - { USB_DEVICE(0x2001, 0x3C0A) }, /* D-Link 3072*/ - { USB_DEVICE(0x14B2, 0x3C07) }, /* AL */ - { USB_DEVICE(0x14B2, 0x3C12) }, /* AL 3070 */ - { USB_DEVICE(0x050D, 0x8053) }, /* Belkin */ - { USB_DEVICE(0x050D, 0x815C) }, /* Belkin */ - { USB_DEVICE(0x050D, 0x825a) }, /* Belkin */ - { USB_DEVICE(0x14B2, 0x3C23) }, /* Airlink */ - { USB_DEVICE(0x14B2, 0x3C27) }, /* Airlink */ - { USB_DEVICE(0x07AA, 0x002F) }, /* Corega */ - { USB_DEVICE(0x07AA, 0x003C) }, /* Corega */ - { USB_DEVICE(0x07AA, 0x003F) }, /* Corega */ - { USB_DEVICE(0x18C5, 0x0012) }, /* Corega 3070 */ - { USB_DEVICE(0x1044, 0x800B) }, /* Gigabyte */ - { USB_DEVICE(0x1044, 0x800D) }, /* Gigabyte GN-WB32L 3070 */ - { USB_DEVICE(0x15A9, 0x0006) }, /* Sparklan */ - { USB_DEVICE(0x083A, 0xB522) }, /* SMC */ - { USB_DEVICE(0x083A, 0xA618) }, /* SMC */ - { USB_DEVICE(0x083A, 0x8522) }, /* Arcadyan */ - { USB_DEVICE(0x083A, 0x7512) }, /* Arcadyan 2770 */ - { USB_DEVICE(0x083A, 0x7522) }, /* Arcadyan */ - { USB_DEVICE(0x083A, 0x7511) }, /* Arcadyan 3070 */ - { USB_DEVICE(0x0CDE, 0x0022) }, /* ZCOM */ - { USB_DEVICE(0x0586, 0x3416) }, /* Zyxel */ - { USB_DEVICE(0x0CDE, 0x0025) }, /* Zyxel */ - { USB_DEVICE(0x1740, 0x9701) }, /* EnGenius */ - { USB_DEVICE(0x1740, 0x9702) }, /* EnGenius */ - { USB_DEVICE(0x1740, 0x9703) }, /* EnGenius 3070 */ - { USB_DEVICE(0x0471, 0x200f) }, /* Philips */ - { USB_DEVICE(0x14B2, 0x3C25) }, /* Draytek */ - { USB_DEVICE(0x13D3, 0x3247) }, /* AzureWave */ - { USB_DEVICE(0x13D3, 0x3273) }, /* AzureWave 3070*/ - { USB_DEVICE(0x083A, 0x6618) }, /* Accton */ - { USB_DEVICE(0x15c5, 0x0008) }, /* Amit */ - { USB_DEVICE(0x0E66, 0x0001) }, /* Hawking */ - { USB_DEVICE(0x0E66, 0x0003) }, /* Hawking */ - { USB_DEVICE(0x129B, 0x1828) }, /* Siemens */ - { USB_DEVICE(0x157E, 0x300E) }, /* U-Media */ - { USB_DEVICE(0x050d, 0x805c) }, - { USB_DEVICE(0x1482, 0x3C09) }, /* Abocom*/ - { USB_DEVICE(0x14B2, 0x3C09) }, /* Alpha */ - { USB_DEVICE(0x04E8, 0x2018) }, /* samsung */ - { USB_DEVICE(0x07B8, 0x3070) }, /* AboCom 3070 */ - { USB_DEVICE(0x07B8, 0x3071) }, /* AboCom 3071 */ - { USB_DEVICE(0x07B8, 0x2870) }, /* AboCom */ - { USB_DEVICE(0x07B8, 0x2770) }, /* AboCom */ - { USB_DEVICE(0x07B8, 0x3072) }, /* Abocom 3072 */ - { USB_DEVICE(0x7392, 0x7711) }, /* Edimax 3070 */ - { USB_DEVICE(0x5A57, 0x0280) }, /* Zinwell */ - { USB_DEVICE(0x5A57, 0x0282) }, /* Zinwell */ - { USB_DEVICE(0x1A32, 0x0304) }, /* Quanta 3070 */ - { USB_DEVICE(0x0789, 0x0162) }, /* Logitec 2870 */ - { USB_DEVICE(0x0789, 0x0163) }, /* Logitec 2870 */ - { USB_DEVICE(0x0789, 0x0164) }, /* Logitec 2870 */ - { USB_DEVICE(0x7392, 0x7717) }, /* Edimax */ - { USB_DEVICE(0x1EDA, 0x2310) }, /* AirTies 3070 */ - { USB_DEVICE(0x1737, 0x0077) }, /* Linksys WUSB54GC-EU v3 */ - { } /* Terminating entry */ -}; - -INT const rtusb_usb_id_len = sizeof(rtusb_usb_id) / sizeof(struct usb_device_id); -MODULE_DEVICE_TABLE(usb, rtusb_usb_id); - -#ifndef PF_NOFREEZE -#define PF_NOFREEZE 0 -#endif - - -#ifdef CONFIG_PM -static int rt2870_suspend(struct usb_interface *intf, pm_message_t state); -static int rt2870_resume(struct usb_interface *intf); -#endif // CONFIG_PM // - -/**************************************************************************/ -/**************************************************************************/ -//tested for kernel 2.6series -/**************************************************************************/ -/**************************************************************************/ -static int rtusb_probe (struct usb_interface *intf, - const struct usb_device_id *id); -static void rtusb_disconnect(struct usb_interface *intf); - -struct usb_driver rtusb_driver = { - .name="rt2870", - .probe=rtusb_probe, - .disconnect=rtusb_disconnect, - .id_table=rtusb_usb_id, - -#ifdef CONFIG_PM - suspend: rt2870_suspend, - resume: rt2870_resume, -#endif - }; - -#ifdef CONFIG_PM - -VOID RT2860RejectPendingPackets( - IN PRTMP_ADAPTER pAd) -{ - // clear PS packets - // clear TxSw packets -} - -static int rt2870_suspend( - struct usb_interface *intf, - pm_message_t state) -{ - struct net_device *net_dev; - PRTMP_ADAPTER pAd = usb_get_intfdata(intf); - - - DBGPRINT(RT_DEBUG_TRACE, ("===> rt2870_suspend()\n")); - net_dev = pAd->net_dev; - netif_device_detach (net_dev); - - pAd->PM_FlgSuspend = 1; - if (netif_running(net_dev)) { - RTUSBCancelPendingBulkInIRP(pAd); - RTUSBCancelPendingBulkOutIRP(pAd); - } - DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2870_suspend()\n")); - return 0; -} - -static int rt2870_resume( - struct usb_interface *intf) -{ - struct net_device *net_dev; - PRTMP_ADAPTER pAd = usb_get_intfdata(intf); - - - DBGPRINT(RT_DEBUG_TRACE, ("===> rt2870_resume()\n")); - - pAd->PM_FlgSuspend = 0; - net_dev = pAd->net_dev; - netif_device_attach (net_dev); - netif_start_queue(net_dev); - netif_carrier_on(net_dev); - netif_wake_queue(net_dev); - - DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2870_resume()\n")); - return 0; -} -#endif // CONFIG_PM // - - -// Init driver module -INT __init rtusb_init(void) -{ - printk("rtusb init --->\n"); - return usb_register(&rtusb_driver); -} - -// Deinit driver module -VOID __exit rtusb_exit(void) -{ - usb_deregister(&rtusb_driver); - printk("<--- rtusb exit\n"); -} - -module_init(rtusb_init); -module_exit(rtusb_exit); - - - - -/*--------------------------------------------------------------------- */ -/* function declarations */ -/*--------------------------------------------------------------------- */ - -/* -======================================================================== -Routine Description: - MLME kernel thread. - -Arguments: - *Context the pAd, driver control block pointer - -Return Value: - 0 close the thread - -Note: -======================================================================== -*/ -INT MlmeThread( - IN void *Context) -{ - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)Context; - POS_COOKIE pObj; - int status; - - pObj = (POS_COOKIE)pAd->OS_Cookie; - - rtmp_os_thread_init("rt2870MlmeThread", (PVOID)&(pAd->mlmeComplete)); - - while (pAd->mlme_kill == 0) - { - /* lock the device pointers */ - //down(&(pAd->mlme_semaphore)); - status = down_interruptible(&(pAd->mlme_semaphore)); - - /* lock the device pointers , need to check if required*/ - //down(&(pAd->usbdev_semaphore)); - - if (!pAd->PM_FlgSuspend) - MlmeHandler(pAd); - - /* unlock the device pointers */ - //up(&(pAd->usbdev_semaphore)); - if (status != 0) - { - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); - break; - } - } - - /* notify the exit routine that we're actually exiting now - * - * complete()/wait_for_completion() is similar to up()/down(), - * except that complete() is safe in the case where the structure - * is getting deleted in a parallel mode of execution (i.e. just - * after the down() -- that's necessary for the thread-shutdown - * case. - * - * complete_and_exit() goes even further than this -- it is safe in - * the case that the thread of the caller is going away (not just - * the structure) -- this is necessary for the module-remove case. - * This is important in preemption kernels, which transfer the flow - * of execution immediately upon a complete(). - */ - DBGPRINT(RT_DEBUG_TRACE,( "<---%s\n",__func__)); - - pObj->MLMEThr_pid = NULL; - - complete_and_exit (&pAd->mlmeComplete, 0); - return 0; - -} - - -/* -======================================================================== -Routine Description: - USB command kernel thread. - -Arguments: - *Context the pAd, driver control block pointer - -Return Value: - 0 close the thread - -Note: -======================================================================== -*/ -INT RTUSBCmdThread( - IN void * Context) -{ - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)Context; - POS_COOKIE pObj; - int status; - - pObj = (POS_COOKIE)pAd->OS_Cookie; - - rtmp_os_thread_init("rt2870CmdThread", (PVOID)&(pAd->CmdQComplete)); - - NdisAcquireSpinLock(&pAd->CmdQLock); - pAd->CmdQ.CmdQState = RT2870_THREAD_RUNNING; - NdisReleaseSpinLock(&pAd->CmdQLock); - - while (pAd->CmdQ.CmdQState == RT2870_THREAD_RUNNING) - { - /* lock the device pointers */ - //down(&(pAd->RTUSBCmd_semaphore)); - status = down_interruptible(&(pAd->RTUSBCmd_semaphore)); - - if (pAd->CmdQ.CmdQState == RT2870_THREAD_STOPED) - break; - - if (status != 0) - { - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); - break; - } - /* lock the device pointers , need to check if required*/ - //down(&(pAd->usbdev_semaphore)); - - if (!pAd->PM_FlgSuspend) - CMDHandler(pAd); - - /* unlock the device pointers */ - //up(&(pAd->usbdev_semaphore)); - } - - if (!pAd->PM_FlgSuspend) - { // Clear the CmdQElements. - CmdQElmt *pCmdQElmt = NULL; - - NdisAcquireSpinLock(&pAd->CmdQLock); - pAd->CmdQ.CmdQState = RT2870_THREAD_STOPED; - while(pAd->CmdQ.size) - { - RTUSBDequeueCmd(&pAd->CmdQ, &pCmdQElmt); - if (pCmdQElmt) - { - if (pCmdQElmt->CmdFromNdis == TRUE) - { - if (pCmdQElmt->buffer != NULL) - NdisFreeMemory(pCmdQElmt->buffer, pCmdQElmt->bufferlength, 0); - - NdisFreeMemory(pCmdQElmt, sizeof(CmdQElmt), 0); - } - else - { - if ((pCmdQElmt->buffer != NULL) && (pCmdQElmt->bufferlength != 0)) - NdisFreeMemory(pCmdQElmt->buffer, pCmdQElmt->bufferlength, 0); - { - NdisFreeMemory(pCmdQElmt, sizeof(CmdQElmt), 0); - } - } - } - } - - NdisReleaseSpinLock(&pAd->CmdQLock); - } - /* notify the exit routine that we're actually exiting now - * - * complete()/wait_for_completion() is similar to up()/down(), - * except that complete() is safe in the case where the structure - * is getting deleted in a parallel mode of execution (i.e. just - * after the down() -- that's necessary for the thread-shutdown - * case. - * - * complete_and_exit() goes even further than this -- it is safe in - * the case that the thread of the caller is going away (not just - * the structure) -- this is necessary for the module-remove case. - * This is important in preemption kernels, which transfer the flow - * of execution immediately upon a complete(). - */ - DBGPRINT(RT_DEBUG_TRACE,( "<---RTUSBCmdThread\n")); - - pObj->RTUSBCmdThr_pid = NULL; - - complete_and_exit (&pAd->CmdQComplete, 0); - return 0; - -} - - -static void RT2870_TimerQ_Handle(RTMP_ADAPTER *pAd) -{ - int status; - RALINK_TIMER_STRUCT *pTimer; - RT2870_TIMER_ENTRY *pEntry; - unsigned long irqFlag; - - while(!pAd->TimerFunc_kill) - { -// printk("waiting for event!\n"); - pTimer = NULL; - - status = down_interruptible(&(pAd->RTUSBTimer_semaphore)); - - if (pAd->TimerQ.status == RT2870_THREAD_STOPED) - break; - - // event happened. - while(pAd->TimerQ.pQHead) - { - RTMP_IRQ_LOCK(&pAd->TimerQLock, irqFlag); - pEntry = pAd->TimerQ.pQHead; - if (pEntry) - { - pTimer = pEntry->pRaTimer; - - // update pQHead - pAd->TimerQ.pQHead = pEntry->pNext; - if (pEntry == pAd->TimerQ.pQTail) - pAd->TimerQ.pQTail = NULL; - - // return this queue entry to timerQFreeList. - pEntry->pNext = pAd->TimerQ.pQPollFreeList; - pAd->TimerQ.pQPollFreeList = pEntry; - } - RTMP_IRQ_UNLOCK(&pAd->TimerQLock, irqFlag); - - if (pTimer) - { - if (pTimer->handle != NULL) - if (!pAd->PM_FlgSuspend) - pTimer->handle(NULL, (PVOID) pTimer->cookie, NULL, pTimer); - if ((pTimer->Repeat) && (pTimer->State == FALSE)) - RTMP_OS_Add_Timer(&pTimer->TimerObj, pTimer->TimerValue); - } - } - - if (status != 0) - { - pAd->TimerQ.status = RT2870_THREAD_STOPED; - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); - break; - } - } -} - - -INT TimerQThread( - IN OUT PVOID Context) -{ - PRTMP_ADAPTER pAd; - POS_COOKIE pObj; - - pAd = (PRTMP_ADAPTER)Context; - pObj = (POS_COOKIE) pAd->OS_Cookie; - - rtmp_os_thread_init("rt2870TimerQHandle", (PVOID)&(pAd->TimerQComplete)); - - RT2870_TimerQ_Handle(pAd); - - /* notify the exit routine that we're actually exiting now - * - * complete()/wait_for_completion() is similar to up()/down(), - * except that complete() is safe in the case where the structure - * is getting deleted in a parallel mode of execution (i.e. just - * after the down() -- that's necessary for the thread-shutdown - * case. - * - * complete_and_exit() goes even further than this -- it is safe in - * the case that the thread of the caller is going away (not just - * the structure) -- this is necessary for the module-remove case. - * This is important in preemption kernels, which transfer the flow - * of execution immediately upon a complete(). - */ - DBGPRINT(RT_DEBUG_TRACE,( "<---%s\n",__func__)); - - pObj->TimerQThr_pid = NULL; - - complete_and_exit(&pAd->TimerQComplete, 0); - return 0; - -} - - -RT2870_TIMER_ENTRY *RT2870_TimerQ_Insert( - IN RTMP_ADAPTER *pAd, - IN RALINK_TIMER_STRUCT *pTimer) -{ - RT2870_TIMER_ENTRY *pQNode = NULL, *pQTail; - unsigned long irqFlags; - - - RTMP_IRQ_LOCK(&pAd->TimerQLock, irqFlags); - if (pAd->TimerQ.status & RT2870_THREAD_CAN_DO_INSERT) - { - if(pAd->TimerQ.pQPollFreeList) - { - pQNode = pAd->TimerQ.pQPollFreeList; - pAd->TimerQ.pQPollFreeList = pQNode->pNext; - - pQNode->pRaTimer = pTimer; - pQNode->pNext = NULL; - - pQTail = pAd->TimerQ.pQTail; - if (pAd->TimerQ.pQTail != NULL) - pQTail->pNext = pQNode; - pAd->TimerQ.pQTail = pQNode; - if (pAd->TimerQ.pQHead == NULL) - pAd->TimerQ.pQHead = pQNode; - } - RTMP_IRQ_UNLOCK(&pAd->TimerQLock, irqFlags); - - if (pQNode) - up(&pAd->RTUSBTimer_semaphore); - //wake_up(&timerWaitQ); - } - else - { - RTMP_IRQ_UNLOCK(&pAd->TimerQLock, irqFlags); - } - return pQNode; -} - - -BOOLEAN RT2870_TimerQ_Remove( - IN RTMP_ADAPTER *pAd, - IN RALINK_TIMER_STRUCT *pTimer) -{ - RT2870_TIMER_ENTRY *pNode, *pPrev = NULL; - unsigned long irqFlags; - - RTMP_IRQ_LOCK(&pAd->TimerQLock, irqFlags); - if (pAd->TimerQ.status >= RT2870_THREAD_INITED) - { - pNode = pAd->TimerQ.pQHead; - while (pNode) - { - if (pNode->pRaTimer == pTimer) - break; - pPrev = pNode; - pNode = pNode->pNext; - } - - // Now move it to freeList queue. - if (pNode) - { - if (pNode == pAd->TimerQ.pQHead) - pAd->TimerQ.pQHead = pNode->pNext; - if (pNode == pAd->TimerQ.pQTail) - pAd->TimerQ.pQTail = pPrev; - if (pPrev != NULL) - pPrev->pNext = pNode->pNext; - - // return this queue entry to timerQFreeList. - pNode->pNext = pAd->TimerQ.pQPollFreeList; - pAd->TimerQ.pQPollFreeList = pNode; - } - } - RTMP_IRQ_UNLOCK(&pAd->TimerQLock, irqFlags); - - return TRUE; -} - - -void RT2870_TimerQ_Exit(RTMP_ADAPTER *pAd) -{ - RT2870_TIMER_ENTRY *pTimerQ; - unsigned long irqFlags; - - RTMP_IRQ_LOCK(&pAd->TimerQLock, irqFlags); - while (pAd->TimerQ.pQHead) - { - pTimerQ = pAd->TimerQ.pQHead; - pAd->TimerQ.pQHead = pTimerQ->pNext; - // remove the timeQ - } - pAd->TimerQ.pQPollFreeList = NULL; - os_free_mem(pAd, pAd->TimerQ.pTimerQPoll); - pAd->TimerQ.pQTail = NULL; - pAd->TimerQ.pQHead = NULL; - pAd->TimerQ.status = RT2870_THREAD_STOPED; - RTMP_IRQ_UNLOCK(&pAd->TimerQLock, irqFlags); - -} - - -void RT2870_TimerQ_Init(RTMP_ADAPTER *pAd) -{ - int i; - RT2870_TIMER_ENTRY *pQNode, *pEntry; - unsigned long irqFlags; - - NdisAllocateSpinLock(&pAd->TimerQLock); - - RTMP_IRQ_LOCK(&pAd->TimerQLock, irqFlags); - NdisZeroMemory(&pAd->TimerQ, sizeof(pAd->TimerQ)); - //InterlockedExchange(&pAd->TimerQ.count, 0); - - /* Initialise the wait q head */ - //init_waitqueue_head(&timerWaitQ); - - os_alloc_mem(pAd, &pAd->TimerQ.pTimerQPoll, sizeof(RT2870_TIMER_ENTRY) * TIMER_QUEUE_SIZE_MAX); - if (pAd->TimerQ.pTimerQPoll) - { - pEntry = NULL; - pQNode = (RT2870_TIMER_ENTRY *)pAd->TimerQ.pTimerQPoll; - for (i = 0 ;i pNext = pEntry; - pEntry = pQNode; - pQNode++; - } - pAd->TimerQ.pQPollFreeList = pEntry; - pAd->TimerQ.pQHead = NULL; - pAd->TimerQ.pQTail = NULL; - pAd->TimerQ.status = RT2870_THREAD_INITED; - } - RTMP_IRQ_UNLOCK(&pAd->TimerQLock, irqFlags); -} - - -VOID RT2870_WatchDog(IN RTMP_ADAPTER *pAd) -{ - PHT_TX_CONTEXT pHTTXContext; - int idx; - ULONG irqFlags; - PURB pUrb; - BOOLEAN needDumpSeq = FALSE; - UINT32 MACValue; - - - idx = 0; - RTMP_IO_READ32(pAd, TXRXQ_PCNT, &MACValue); - if ((MACValue & 0xff) !=0 ) - { - DBGPRINT(RT_DEBUG_TRACE, ("TX QUEUE 0 Not EMPTY(Value=0x%0x). !!!!!!!!!!!!!!!\n", MACValue)); - RTMP_IO_WRITE32(pAd, PBF_CFG, 0xf40012); - while((MACValue &0xff) != 0 && (idx++ < 10)) - { - RTMP_IO_READ32(pAd, TXRXQ_PCNT, &MACValue); - NdisMSleep(1); - } - RTMP_IO_WRITE32(pAd, PBF_CFG, 0xf40006); - } - -//PS packets use HCCA queue when dequeue from PS unicast queue (WiFi WPA2 MA9_DT1 for Marvell B STA) - idx = 0; - if ((MACValue & 0xff00) !=0 ) - { - DBGPRINT(RT_DEBUG_TRACE, ("TX QUEUE 1 Not EMPTY(Value=0x%0x). !!!!!!!!!!!!!!!\n", MACValue)); - RTMP_IO_WRITE32(pAd, PBF_CFG, 0xf4000a); - while((MACValue &0xff00) != 0 && (idx++ < 10)) - { - RTMP_IO_READ32(pAd, TXRXQ_PCNT, &MACValue); - NdisMSleep(1); - } - RTMP_IO_WRITE32(pAd, PBF_CFG, 0xf40006); - } - - if (pAd->watchDogRxOverFlowCnt >= 2) - { - DBGPRINT(RT_DEBUG_TRACE, ("Maybe the Rx Bulk-In hanged! Cancel the pending Rx bulks request!\n")); - if ((!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_BULKIN_RESET | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST)))) - { - DBGPRINT(RT_DEBUG_TRACE, ("Call CMDTHREAD_RESET_BULK_IN to cancel the pending Rx Bulk!\n")); - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKIN_RESET); - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_IN, NULL, 0); - needDumpSeq = TRUE; - } - pAd->watchDogRxOverFlowCnt = 0; - } - - - for (idx = 0; idx < NUM_OF_TX_RING; idx++) - { - pUrb = NULL; - - RTMP_IRQ_LOCK(&pAd->BulkOutLock[idx], irqFlags); - if ((pAd->BulkOutPending[idx] == TRUE) && pAd->watchDogTxPendingCnt) - { - pAd->watchDogTxPendingCnt[idx]++; - - if ((pAd->watchDogTxPendingCnt[idx] > 2) && - (!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_BULKOUT_RESET))) - ) - { - // FIXME: Following code just support single bulk out. If you wanna support multiple bulk out. Modify it! - pHTTXContext = (PHT_TX_CONTEXT)(&pAd->TxContext[idx]); - if (pHTTXContext->IRPPending) - { // Check TxContext. - pUrb = pHTTXContext->pUrb; - } - else if (idx == MGMTPIPEIDX) - { - PTX_CONTEXT pMLMEContext, pNULLContext, pPsPollContext; - - //Check MgmtContext. - pMLMEContext = (PTX_CONTEXT)(pAd->MgmtRing.Cell[pAd->MgmtRing.TxDmaIdx].AllocVa); - pPsPollContext = (PTX_CONTEXT)(&pAd->PsPollContext); - pNULLContext = (PTX_CONTEXT)(&pAd->NullContext); - - if (pMLMEContext->IRPPending) - { - ASSERT(pMLMEContext->IRPPending); - pUrb = pMLMEContext->pUrb; - } - else if (pNULLContext->IRPPending) - { - ASSERT(pNULLContext->IRPPending); - pUrb = pNULLContext->pUrb; - } - else if (pPsPollContext->IRPPending) - { - ASSERT(pPsPollContext->IRPPending); - pUrb = pPsPollContext->pUrb; - } - } - - RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[idx], irqFlags); - - DBGPRINT(RT_DEBUG_TRACE, ("Maybe the Tx Bulk-Out hanged! Cancel the pending Tx bulks request of idx(%d)!\n", idx)); - if (pUrb) - { - DBGPRINT(RT_DEBUG_TRACE, ("Unlink the pending URB!\n")); - // unlink it now - RTUSB_UNLINK_URB(pUrb); - // Sleep 200 microseconds to give cancellation time to work - RTMPusecDelay(200); - needDumpSeq = TRUE; - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("Unkonw bulkOut URB maybe hanged!!!!!!!!!!!!\n")); - } - } - else - { - RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[idx], irqFlags); - } - } - else - { - RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[idx], irqFlags); - } - } - - // For Sigma debug, dump the ba_reordering sequence. - if((needDumpSeq == TRUE) && (pAd->CommonCfg.bDisableReordering == 0)) - { - USHORT Idx; - PBA_REC_ENTRY pBAEntry = NULL; - UCHAR count = 0; - struct reordering_mpdu *mpdu_blk; - - Idx = pAd->MacTab.Content[BSSID_WCID].BARecWcidArray[0]; - - pBAEntry = &pAd->BATable.BARecEntry[Idx]; - if((pBAEntry->list.qlen > 0) && (pBAEntry->list.next != NULL)) - { - DBGPRINT(RT_DEBUG_TRACE, ("NICUpdateRawCounters():The Queueing pkt in reordering buffer:\n")); - NdisAcquireSpinLock(&pBAEntry->RxReRingLock); - mpdu_blk = pBAEntry->list.next; - while (mpdu_blk) - { - DBGPRINT(RT_DEBUG_TRACE, ("\t%d:Seq-%d, bAMSDU-%d!\n", count, mpdu_blk->Sequence, mpdu_blk->bAMSDU)); - mpdu_blk = mpdu_blk->next; - count++; - } - - DBGPRINT(RT_DEBUG_TRACE, ("\npBAEntry->LastIndSeq=%d!\n", pBAEntry->LastIndSeq)); - NdisReleaseSpinLock(&pBAEntry->RxReRingLock); - } - } -} - -/* -======================================================================== -Routine Description: - Release allocated resources. - -Arguments: - *dev Point to the PCI or USB device - pAd driver control block pointer - -Return Value: - None - -Note: -======================================================================== -*/ -static void _rtusb_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd) -{ - struct net_device *net_dev = NULL; - - - DBGPRINT(RT_DEBUG_ERROR, ("rtusb_disconnect: unregister usbnet usb-%s-%s\n", - dev->bus->bus_name, dev->devpath)); - if (!pAd) - { - usb_put_dev(dev); - - printk("rtusb_disconnect: pAd == NULL!\n"); - return; - } - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST); - - - - // for debug, wait to show some messages to /proc system - udelay(1); - - - - - net_dev = pAd->net_dev; - if (pAd->net_dev != NULL) - { - printk("rtusb_disconnect: unregister_netdev(), dev->name=%s!\n", net_dev->name); - unregister_netdev (pAd->net_dev); - } - udelay(1); - flush_scheduled_work(); - udelay(1); - - // free net_device memory - free_netdev(net_dev); - - // free adapter memory - RTMPFreeAdapter(pAd); - - // release a use of the usb device structure - usb_put_dev(dev); - udelay(1); - - DBGPRINT(RT_DEBUG_ERROR, (" RTUSB disconnect successfully\n")); -} - - -/* -======================================================================== -Routine Description: - Probe RT28XX chipset. - -Arguments: - *dev Point to the PCI or USB device - interface - *id_table Point to the PCI or USB device ID - -Return Value: - None - -Note: -======================================================================== -*/ -static int rtusb_probe (struct usb_interface *intf, - const struct usb_device_id *id) -{ - PRTMP_ADAPTER pAd; - return (int)rt28xx_probe((void *)intf, (void *)id, 0, &pAd); -} - - -static void rtusb_disconnect(struct usb_interface *intf) -{ - struct usb_device *dev = interface_to_usbdev(intf); - PRTMP_ADAPTER pAd; - - - pAd = usb_get_intfdata(intf); - usb_set_intfdata(intf, NULL); - - _rtusb_disconnect(dev, pAd); -} - - -/* -======================================================================== -Routine Description: - Close kernel threads. - -Arguments: - *pAd the raxx interface data pointer - -Return Value: - NONE - -Note: -======================================================================== -*/ -VOID RT28xxThreadTerminate( - IN RTMP_ADAPTER *pAd) -{ - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - INT ret; - - - // Sleep 50 milliseconds so pending io might finish normally - RTMPusecDelay(50000); - - // We want to wait until all pending receives and sends to the - // device object. We cancel any - // irps. Wait until sends and receives have stopped. - RTUSBCancelPendingIRPs(pAd); - - // Terminate Threads - - if (pid_nr(pObj->TimerQThr_pid) > 0) - { - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; - - printk("Terminate the TimerQThr_pid=%d!\n", pid_nr(pObj->TimerQThr_pid)); - mb(); - pAd->TimerFunc_kill = 1; - mb(); - ret = kill_pid(pObj->TimerQThr_pid, SIGTERM, 1); - if (ret) - { - printk(KERN_WARNING "%s: unable to stop TimerQThread, pid=%d, ret=%d!\n", - pAd->net_dev->name, pid_nr(pObj->TimerQThr_pid), ret); - } - else - { - wait_for_completion(&pAd->TimerQComplete); - pObj->TimerQThr_pid = NULL; - } - } - - if (pid_nr(pObj->MLMEThr_pid) > 0) - { - printk("Terminate the MLMEThr_pid=%d!\n", pid_nr(pObj->MLMEThr_pid)); - mb(); - pAd->mlme_kill = 1; - //RT28XX_MLME_HANDLER(pAd); - mb(); - ret = kill_pid(pObj->MLMEThr_pid, SIGTERM, 1); - if (ret) - { - printk (KERN_WARNING "%s: unable to Mlme thread, pid=%d, ret=%d!\n", - pAd->net_dev->name, pid_nr(pObj->MLMEThr_pid), ret); - } - else - { - //wait_for_completion (&pAd->notify); - wait_for_completion (&pAd->mlmeComplete); - pObj->MLMEThr_pid = NULL; - } - } - - if (pid_nr(pObj->RTUSBCmdThr_pid) > 0) - { - printk("Terminate the RTUSBCmdThr_pid=%d!\n", pid_nr(pObj->RTUSBCmdThr_pid)); - mb(); - NdisAcquireSpinLock(&pAd->CmdQLock); - pAd->CmdQ.CmdQState = RT2870_THREAD_STOPED; - NdisReleaseSpinLock(&pAd->CmdQLock); - mb(); - //RTUSBCMDUp(pAd); - ret = kill_pid(pObj->RTUSBCmdThr_pid, SIGTERM, 1); - if (ret) - { - printk(KERN_WARNING "%s: unable to RTUSBCmd thread, pid=%d, ret=%d!\n", - pAd->net_dev->name, pid_nr(pObj->RTUSBCmdThr_pid), ret); - } - else - { - //wait_for_completion (&pAd->notify); - wait_for_completion (&pAd->CmdQComplete); - pObj->RTUSBCmdThr_pid = NULL; - } - } - - // Kill tasklets - pAd->mlme_kill = 0; - pAd->CmdQ.CmdQState = RT2870_THREAD_UNKNOWN; - pAd->TimerFunc_kill = 0; -} - - -void kill_thread_task(IN PRTMP_ADAPTER pAd) -{ - POS_COOKIE pObj; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - tasklet_kill(&pObj->rx_done_task); - tasklet_kill(&pObj->mgmt_dma_done_task); - tasklet_kill(&pObj->ac0_dma_done_task); - tasklet_kill(&pObj->ac1_dma_done_task); - tasklet_kill(&pObj->ac2_dma_done_task); - tasklet_kill(&pObj->ac3_dma_done_task); - tasklet_kill(&pObj->hcca_dma_done_task); - tasklet_kill(&pObj->tbtt_task); - -} - - -/* -======================================================================== -Routine Description: - Check the chipset vendor/product ID. - -Arguments: - _dev_p Point to the PCI or USB device - -Return Value: - TRUE Check ok - FALSE Check fail - -Note: -======================================================================== -*/ -BOOLEAN RT28XXChipsetCheck( - IN void *_dev_p) -{ - struct usb_interface *intf = (struct usb_interface *)_dev_p; - struct usb_device *dev_p = interface_to_usbdev(intf); - UINT32 i; - - - for(i=0; idescriptor.idVendor == rtusb_usb_id[i].idVendor && - dev_p->descriptor.idProduct == rtusb_usb_id[i].idProduct) - { - printk("rt2870: idVendor = 0x%x, idProduct = 0x%x\n", - dev_p->descriptor.idVendor, dev_p->descriptor.idProduct); - break; - } - } - - if (i == rtusb_usb_id_len) - { - printk("rt2870: Error! Device Descriptor not matching!\n"); - return FALSE; - } - - return TRUE; -} - - -/* -======================================================================== -Routine Description: - Init net device structure. - -Arguments: - _dev_p Point to the PCI or USB device - *net_dev Point to the net device - *pAd the raxx interface data pointer - -Return Value: - TRUE Init ok - FALSE Init fail - -Note: -======================================================================== -*/ -BOOLEAN RT28XXNetDevInit( - IN void *_dev_p, - IN struct net_device *net_dev, - IN RTMP_ADAPTER *pAd) -{ - struct usb_interface *intf = (struct usb_interface *)_dev_p; - struct usb_device *dev_p = interface_to_usbdev(intf); - - - pAd->config = &dev_p->config->desc; - return TRUE; -} - - -/* -======================================================================== -Routine Description: - Init net device structure. - -Arguments: - _dev_p Point to the PCI or USB device - *pAd the raxx interface data pointer - -Return Value: - TRUE Config ok - FALSE Config fail - -Note: -======================================================================== -*/ -BOOLEAN RT28XXProbePostConfig( - IN void *_dev_p, - IN RTMP_ADAPTER *pAd, - IN INT32 interface) -{ - struct usb_interface *intf = (struct usb_interface *)_dev_p; - struct usb_host_interface *iface_desc; - ULONG BulkOutIdx; - UINT32 i; - - - /* get the active interface descriptor */ - iface_desc = intf->cur_altsetting; - - /* get # of enpoints */ - pAd->NumberOfPipes = iface_desc->desc.bNumEndpoints; - DBGPRINT(RT_DEBUG_TRACE, - ("NumEndpoints=%d\n", iface_desc->desc.bNumEndpoints)); - - /* Configure Pipes */ - BulkOutIdx = 0; - - for(i=0; iNumberOfPipes; i++) - { - if ((iface_desc->endpoint[i].desc.bmAttributes == - USB_ENDPOINT_XFER_BULK) && - ((iface_desc->endpoint[i].desc.bEndpointAddress & - USB_ENDPOINT_DIR_MASK) == USB_DIR_IN)) - { - pAd->BulkInEpAddr = iface_desc->endpoint[i].desc.bEndpointAddress; - pAd->BulkInMaxPacketSize = iface_desc->endpoint[i].desc.wMaxPacketSize; - - DBGPRINT_RAW(RT_DEBUG_TRACE, - ("BULK IN MaximumPacketSize = %d\n", pAd->BulkInMaxPacketSize)); - DBGPRINT_RAW(RT_DEBUG_TRACE, - ("EP address = 0x%2x\n", iface_desc->endpoint[i].desc.bEndpointAddress)); - } - else if ((iface_desc->endpoint[i].desc.bmAttributes == - USB_ENDPOINT_XFER_BULK) && - ((iface_desc->endpoint[i].desc.bEndpointAddress & - USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT)) - { - // there are 6 bulk out EP. EP6 highest priority. - // EP1-4 is EDCA. EP5 is HCCA. - pAd->BulkOutEpAddr[BulkOutIdx++] = iface_desc->endpoint[i].desc.bEndpointAddress; - pAd->BulkOutMaxPacketSize = iface_desc->endpoint[i].desc.wMaxPacketSize; - - DBGPRINT_RAW(RT_DEBUG_TRACE, - ("BULK OUT MaximumPacketSize = %d\n", pAd->BulkOutMaxPacketSize)); - DBGPRINT_RAW(RT_DEBUG_TRACE, - ("EP address = 0x%2x \n", iface_desc->endpoint[i].desc.bEndpointAddress)); - } - } - - if (!(pAd->BulkInEpAddr && pAd->BulkOutEpAddr[0])) - { - printk("%s: Could not find both bulk-in and bulk-out endpoints\n", __func__); - return FALSE; - } - - return TRUE; -} - - -/* -======================================================================== -Routine Description: - Disable DMA. - -Arguments: - *pAd the raxx interface data pointer - -Return Value: - None - -Note: -======================================================================== -*/ -VOID RT28XXDMADisable( - IN RTMP_ADAPTER *pAd) -{ - // no use -} - - - -/* -======================================================================== -Routine Description: - Enable DMA. - -Arguments: - *pAd the raxx interface data pointer - -Return Value: - None - -Note: -======================================================================== -*/ -VOID RT28XXDMAEnable( - IN RTMP_ADAPTER *pAd) -{ - WPDMA_GLO_CFG_STRUC GloCfg; - USB_DMA_CFG_STRUC UsbCfg; - int i = 0; - - - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x4); - do - { - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); - if ((GloCfg.field.TxDMABusy == 0) && (GloCfg.field.RxDMABusy == 0)) - break; - - DBGPRINT(RT_DEBUG_TRACE, ("==> DMABusy\n")); - RTMPusecDelay(1000); - i++; - }while ( i <200); - - - RTMPusecDelay(50); - GloCfg.field.EnTXWriteBackDDONE = 1; - GloCfg.field.EnableRxDMA = 1; - GloCfg.field.EnableTxDMA = 1; - DBGPRINT(RT_DEBUG_TRACE, ("<== WRITE DMA offset 0x208 = 0x%x\n", GloCfg.word)); - RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); - - UsbCfg.word = 0; - UsbCfg.field.phyclear = 0; - /* usb version is 1.1,do not use bulk in aggregation */ - if (pAd->BulkInMaxPacketSize == 512) - UsbCfg.field.RxBulkAggEn = 1; - /* for last packet, PBF might use more than limited, so minus 2 to prevent from error */ - UsbCfg.field.RxBulkAggLmt = (MAX_RXBULK_SIZE /1024)-3; - UsbCfg.field.RxBulkAggTOut = 0x80; /* 2006-10-18 */ - UsbCfg.field.RxBulkEn = 1; - UsbCfg.field.TxBulkEn = 1; - - RTUSBWriteMACRegister(pAd, USB_DMA_CFG, UsbCfg.word); - -} - -/* -======================================================================== -Routine Description: - Write Beacon buffer to Asic. - -Arguments: - *pAd the raxx interface data pointer - -Return Value: - None - -Note: -======================================================================== -*/ -VOID RT28xx_UpdateBeaconToAsic( - IN RTMP_ADAPTER *pAd, - IN INT apidx, - IN ULONG FrameLen, - IN ULONG UpdatePos) -{ - PUCHAR pBeaconFrame = NULL; - UCHAR *ptr; - UINT i, padding; - BEACON_SYNC_STRUCT *pBeaconSync = pAd->CommonCfg.pBeaconSync; - UINT32 longValue; - BOOLEAN bBcnReq = FALSE; - UCHAR bcn_idx = 0; - - - if (pBeaconFrame == NULL) - { - DBGPRINT(RT_DEBUG_ERROR,("pBeaconFrame is NULL!\n")); - return; - } - - if (pBeaconSync == NULL) - { - DBGPRINT(RT_DEBUG_ERROR,("pBeaconSync is NULL!\n")); - return; - } - - //if ((pAd->WdsTab.Mode == WDS_BRIDGE_MODE) || - // ((pAd->ApCfg.MBSSID[apidx].MSSIDDev == NULL) || !(pAd->ApCfg.MBSSID[apidx].MSSIDDev->flags & IFF_UP)) - // ) - if (bBcnReq == FALSE) - { - /* when the ra interface is down, do not send its beacon frame */ - /* clear all zero */ - for(i=0; iBeaconOffset[bcn_idx] + i, 0x00); - } - pBeaconSync->BeaconBitMap &= (~(BEACON_BITMAP_MASK & (1 << bcn_idx))); - NdisZeroMemory(pBeaconSync->BeaconTxWI[bcn_idx], TXWI_SIZE); - } - else - { - ptr = (PUCHAR)&pAd->BeaconTxWI; - - if (NdisEqualMemory(pBeaconSync->BeaconTxWI[bcn_idx], &pAd->BeaconTxWI, TXWI_SIZE) == FALSE) - { // If BeaconTxWI changed, we need to rewrite the TxWI for the Beacon frames. - pBeaconSync->BeaconBitMap &= (~(BEACON_BITMAP_MASK & (1 << bcn_idx))); - NdisMoveMemory(pBeaconSync->BeaconTxWI[bcn_idx], &pAd->BeaconTxWI, TXWI_SIZE); - } - - if ((pBeaconSync->BeaconBitMap & (1 << bcn_idx)) != (1 << bcn_idx)) - { - for (i=0; iBeaconOffset[bcn_idx] + i, longValue); - ptr += 4; - } - } - - ptr = pBeaconSync->BeaconBuf[bcn_idx]; - padding = (FrameLen & 0x01); - NdisZeroMemory((PUCHAR)(pBeaconFrame + FrameLen), padding); - FrameLen += padding; - for (i = 0 ; i < FrameLen /*HW_BEACON_OFFSET*/; i += 2) - { - if (NdisEqualMemory(ptr, pBeaconFrame, 2) == FALSE) - { - NdisMoveMemory(ptr, pBeaconFrame, 2); - //shortValue = *ptr + (*(ptr+1)<<8); - //RTMP_IO_WRITE8(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, shortValue); - RTUSBMultiWrite(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, ptr, 2); - } - ptr +=2; - pBeaconFrame += 2; - } - - pBeaconSync->BeaconBitMap |= (1 << bcn_idx); - - // For AP interface, set the DtimBitOn so that we can send Bcast/Mcast frame out after this beacon frame. - } - -} - - -VOID RT2870_BssBeaconStop( - IN RTMP_ADAPTER *pAd) -{ - BEACON_SYNC_STRUCT *pBeaconSync; - int i, offset; - BOOLEAN Cancelled = TRUE; - - pBeaconSync = pAd->CommonCfg.pBeaconSync; - if (pBeaconSync && pBeaconSync->EnableBeacon) - { - INT NumOfBcn; - - NumOfBcn = MAX_MESH_NUM; - - RTMPCancelTimer(&pAd->CommonCfg.BeaconUpdateTimer, &Cancelled); - - for(i=0; iBeaconBuf[i], HW_BEACON_OFFSET); - NdisZeroMemory(pBeaconSync->BeaconTxWI[i], TXWI_SIZE); - - for (offset=0; offsetBeaconOffset[i] + offset, 0x00); - - pBeaconSync->CapabilityInfoLocationInBeacon[i] = 0; - pBeaconSync->TimIELocationInBeacon[i] = 0; - } - pBeaconSync->BeaconBitMap = 0; - pBeaconSync->DtimBitOn = 0; - } -} - - -VOID RT2870_BssBeaconStart( - IN RTMP_ADAPTER *pAd) -{ - int apidx; - BEACON_SYNC_STRUCT *pBeaconSync; -// LARGE_INTEGER tsfTime, deltaTime; - - pBeaconSync = pAd->CommonCfg.pBeaconSync; - if (pBeaconSync && pBeaconSync->EnableBeacon) - { - INT NumOfBcn; - - NumOfBcn = MAX_MESH_NUM; - - for(apidx=0; apidxBeaconBuf[apidx], HW_BEACON_OFFSET); - pBeaconSync->CapabilityInfoLocationInBeacon[apidx] = CapabilityInfoLocationInBeacon; - pBeaconSync->TimIELocationInBeacon[apidx] = TimIELocationInBeacon; - NdisZeroMemory(pBeaconSync->BeaconTxWI[apidx], TXWI_SIZE); - } - pBeaconSync->BeaconBitMap = 0; - pBeaconSync->DtimBitOn = 0; - pAd->CommonCfg.BeaconUpdateTimer.Repeat = TRUE; - - pAd->CommonCfg.BeaconAdjust = 0; - pAd->CommonCfg.BeaconFactor = 0xffffffff / (pAd->CommonCfg.BeaconPeriod << 10); - pAd->CommonCfg.BeaconRemain = (0xffffffff % (pAd->CommonCfg.BeaconPeriod << 10)) + 1; - printk(RT28xx_CHIP_NAME "_BssBeaconStart:BeaconFactor=%d, BeaconRemain=%d!\n", pAd->CommonCfg.BeaconFactor, pAd->CommonCfg.BeaconRemain); - RTMPSetTimer(&pAd->CommonCfg.BeaconUpdateTimer, pAd->CommonCfg.BeaconPeriod); - - } -} - - -VOID RT2870_BssBeaconInit( - IN RTMP_ADAPTER *pAd) -{ - BEACON_SYNC_STRUCT *pBeaconSync; - int i; - - NdisAllocMemory(pAd->CommonCfg.pBeaconSync, sizeof(BEACON_SYNC_STRUCT), MEM_ALLOC_FLAG); - if (pAd->CommonCfg.pBeaconSync) - { - pBeaconSync = pAd->CommonCfg.pBeaconSync; - NdisZeroMemory(pBeaconSync, sizeof(BEACON_SYNC_STRUCT)); - for(i=0; i < HW_BEACON_MAX_COUNT; i++) - { - NdisZeroMemory(pBeaconSync->BeaconBuf[i], HW_BEACON_OFFSET); - pBeaconSync->CapabilityInfoLocationInBeacon[i] = 0; - pBeaconSync->TimIELocationInBeacon[i] = 0; - NdisZeroMemory(pBeaconSync->BeaconTxWI[i], TXWI_SIZE); - } - pBeaconSync->BeaconBitMap = 0; - - //RTMPInitTimer(pAd, &pAd->CommonCfg.BeaconUpdateTimer, GET_TIMER_FUNCTION(BeaconUpdateExec), pAd, TRUE); - pBeaconSync->EnableBeacon = TRUE; - } -} - - -VOID RT2870_BssBeaconExit( - IN RTMP_ADAPTER *pAd) -{ - BEACON_SYNC_STRUCT *pBeaconSync; - BOOLEAN Cancelled = TRUE; - int i; - - if (pAd->CommonCfg.pBeaconSync) - { - pBeaconSync = pAd->CommonCfg.pBeaconSync; - pBeaconSync->EnableBeacon = FALSE; - RTMPCancelTimer(&pAd->CommonCfg.BeaconUpdateTimer, &Cancelled); - pBeaconSync->BeaconBitMap = 0; - - for(i=0; iBeaconBuf[i], HW_BEACON_OFFSET); - pBeaconSync->CapabilityInfoLocationInBeacon[i] = 0; - pBeaconSync->TimIELocationInBeacon[i] = 0; - NdisZeroMemory(pBeaconSync->BeaconTxWI[i], TXWI_SIZE); - } - - NdisFreeMemory(pAd->CommonCfg.pBeaconSync, HW_BEACON_OFFSET * HW_BEACON_MAX_COUNT, 0); - pAd->CommonCfg.pBeaconSync = NULL; - } -} - -VOID BeaconUpdateExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)FunctionContext; - LARGE_INTEGER tsfTime_a;//, tsfTime_b, deltaTime_exp, deltaTime_ab; - UINT32 delta, remain, remain_low, remain_high; -// BOOLEAN positive; - - ReSyncBeaconTime(pAd); - - - - RTMP_IO_READ32(pAd, TSF_TIMER_DW0, &tsfTime_a.u.LowPart); - RTMP_IO_READ32(pAd, TSF_TIMER_DW1, &tsfTime_a.u.HighPart); - - - //positive=getDeltaTime(tsfTime_a, expectedTime, &deltaTime_exp); - remain_high = pAd->CommonCfg.BeaconRemain * tsfTime_a.u.HighPart; - remain_low = tsfTime_a.u.LowPart % (pAd->CommonCfg.BeaconPeriod << 10); - remain = (remain_high + remain_low)%(pAd->CommonCfg.BeaconPeriod << 10); - delta = (pAd->CommonCfg.BeaconPeriod << 10) - remain; - - pAd->CommonCfg.BeaconUpdateTimer.TimerValue = (delta >> 10) + 10; - -} - diff --git a/drivers/staging/rt2870/Makefile b/drivers/staging/rt2870/Makefile index 306c33113c58..661cdf9b6157 100644 --- a/drivers/staging/rt2870/Makefile +++ b/drivers/staging/rt2870/Makefile @@ -1,27 +1,36 @@ +# obj-$(CONFIG_RT2870) += rt2870sta.o # TODO: all of these should be removed EXTRA_CFLAGS += -DLINUX -DAGGREGATION_SUPPORT -DPIGGYBACK_SUPPORT -DWMM_SUPPORT -EXTRA_CFLAGS += -DRT2870 -DRT3070 +EXTRA_CFLAGS += -DRTMP_MAC_USB -DRTMP_USB_SUPPORT -DRT2870 -DRTMP_TIMER_TASK_SUPPORT +EXTRA_CFLAGS += -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -DRT30xx -DRT3070 EXTRA_CFLAGS += -DDBG rt2870sta-objs := \ - common/md5.o \ + common/crypt_md5.o \ + common/crypt_sha2.o \ + common/crypt_hmac.o \ common/mlme.o \ - common/rtmp_wep.o \ + common/cmm_wep.o \ common/action.o \ common/cmm_data.o \ common/rtmp_init.o \ - common/rtmp_tkip.o \ + common/cmm_tkip.o \ + common/cmm_aes.o \ common/cmm_sync.o \ common/eeprom.o \ common/cmm_sanity.o \ common/cmm_info.o \ + common/cmm_cfg.o \ common/cmm_wpa.o \ common/dfs.o \ common/spectrum.o \ + common/rtmp_timer.o \ + common/rt_channel.o \ + common/cmm_profile.o \ + common/cmm_asic.o \ sta/assoc.o \ - sta/aironet.o \ sta/auth.o \ sta/auth_rsp.o \ sta/sync.o \ @@ -34,10 +43,15 @@ rt2870sta-objs := \ rt_main_dev.o \ sta_ioctl.o \ common/ba_action.o \ - 2870_main_dev.o \ - common/2870_rtmp_init.o \ + usb_main_dev.o \ + rt_usb.o \ + common/cmm_mac_usb.o \ common/rtusb_io.o \ common/rtusb_bulk.o \ common/rtusb_data.o \ - common/cmm_data_2870.o - + common/cmm_data_usb.o \ + common/rtmp_mcu.o \ + common/ee_efuse.o \ + chips/rt30xx.o \ + common/rt_rf.o \ + chips/rt3070.o diff --git a/drivers/staging/rt2870/chips/rt3070.c b/drivers/staging/rt2870/chips/rt3070.c new file mode 100644 index 000000000000..3a6db5ea89ab --- /dev/null +++ b/drivers/staging/rt2870/chips/rt3070.c @@ -0,0 +1 @@ +#include "../../rt2860/chips/rt3070.c" diff --git a/drivers/staging/rt2870/chips/rt30xx.c b/drivers/staging/rt2870/chips/rt30xx.c new file mode 100644 index 000000000000..6c56b84c75d9 --- /dev/null +++ b/drivers/staging/rt2870/chips/rt30xx.c @@ -0,0 +1 @@ +#include "../../rt2860/chips/rt30xx.c" diff --git a/drivers/staging/rt2870/common/2870_rtmp_init.c b/drivers/staging/rt2870/common/2870_rtmp_init.c deleted file mode 100644 index f517d9e90271..000000000000 --- a/drivers/staging/rt2870/common/2870_rtmp_init.c +++ /dev/null @@ -1,1730 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - 2870_rtmp_init.c - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Paul Lin 2002-08-01 created - John Chang 2004-08-20 RT2561/2661 use scatter-gather scheme - Jan Lee 2006-09-15 RT2860. Change for 802.11n , EEPROM, Led, BA, HT. - Sample Lin 2007-05-31 Merge RT2860 and RT2870 drivers. -*/ - -#include "../rt_config.h" - - -static void rx_done_tasklet(unsigned long data); -static void rt2870_hcca_dma_done_tasklet(unsigned long data); -static void rt2870_ac3_dma_done_tasklet(unsigned long data); -static void rt2870_ac2_dma_done_tasklet(unsigned long data); -static void rt2870_ac1_dma_done_tasklet(unsigned long data); -static void rt2870_ac0_dma_done_tasklet(unsigned long data); -static void rt2870_mgmt_dma_done_tasklet(unsigned long data); -static void rt2870_null_frame_complete_tasklet(unsigned long data); -static void rt2870_rts_frame_complete_tasklet(unsigned long data); -static void rt2870_pspoll_frame_complete_tasklet(unsigned long data); -static void rt2870_dataout_complete_tasklet(unsigned long data); - - -/* -======================================================================== -Routine Description: - Initialize receive data structures. - -Arguments: - pAd Pointer to our adapter - -Return Value: - NDIS_STATUS_SUCCESS - NDIS_STATUS_RESOURCES - -Note: - Initialize all receive releated private buffer, include those define - in RTMP_ADAPTER structure and all private data structures. The mahor - work is to allocate buffer for each packet and chain buffer to - NDIS packet descriptor. -======================================================================== -*/ -NDIS_STATUS NICInitRecv( - IN PRTMP_ADAPTER pAd) -{ - UCHAR i; - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - - - DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitRecv\n")); - pObj = pObj; - - //InterlockedExchange(&pAd->PendingRx, 0); - pAd->PendingRx = 0; - pAd->NextRxBulkInReadIndex = 0; // Next Rx Read index - pAd->NextRxBulkInIndex = 0 ; //RX_RING_SIZE -1; // Rx Bulk pointer - pAd->NextRxBulkInPosition = 0; - - for (i = 0; i < (RX_RING_SIZE); i++) - { - PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); - - //Allocate URB - pRxContext->pUrb = RTUSB_ALLOC_URB(0); - if (pRxContext->pUrb == NULL) - { - Status = NDIS_STATUS_RESOURCES; - goto out1; - } - - // Allocate transfer buffer - pRxContext->TransferBuffer = RTUSB_URB_ALLOC_BUFFER(pObj->pUsb_Dev, MAX_RXBULK_SIZE, &pRxContext->data_dma); - if (pRxContext->TransferBuffer == NULL) - { - Status = NDIS_STATUS_RESOURCES; - goto out1; - } - - NdisZeroMemory(pRxContext->TransferBuffer, MAX_RXBULK_SIZE); - - pRxContext->pAd = pAd; - pRxContext->pIrp = NULL; - pRxContext->InUse = FALSE; - pRxContext->IRPPending = FALSE; - pRxContext->Readable = FALSE; - //pRxContext->ReorderInUse = FALSE; - pRxContext->bRxHandling = FALSE; - pRxContext->BulkInOffset = 0; - } - - DBGPRINT(RT_DEBUG_TRACE, ("<-- NICInitRecv\n")); - return Status; - -out1: - for (i = 0; i < (RX_RING_SIZE); i++) - { - PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); - - if (NULL != pRxContext->TransferBuffer) - { - RTUSB_URB_FREE_BUFFER(pObj->pUsb_Dev, MAX_RXBULK_SIZE, - pRxContext->TransferBuffer, pRxContext->data_dma); - pRxContext->TransferBuffer = NULL; - } - - if (NULL != pRxContext->pUrb) - { - RTUSB_UNLINK_URB(pRxContext->pUrb); - RTUSB_FREE_URB(pRxContext->pUrb); - pRxContext->pUrb = NULL; - } - } - - return Status; -} - - -/* -======================================================================== -Routine Description: - Initialize transmit data structures. - -Arguments: - pAd Pointer to our adapter - -Return Value: - NDIS_STATUS_SUCCESS - NDIS_STATUS_RESOURCES - -Note: -======================================================================== -*/ -NDIS_STATUS NICInitTransmit( - IN PRTMP_ADAPTER pAd) -{ -#define LM_USB_ALLOC(pObj, Context, TB_Type, BufferSize, Status, msg1, err1, msg2, err2) \ - Context->pUrb = RTUSB_ALLOC_URB(0); \ - if (Context->pUrb == NULL) { \ - DBGPRINT(RT_DEBUG_ERROR, msg1); \ - Status = NDIS_STATUS_RESOURCES; \ - goto err1; } \ - \ - Context->TransferBuffer = \ - (TB_Type)RTUSB_URB_ALLOC_BUFFER(pObj->pUsb_Dev, BufferSize, &Context->data_dma); \ - if (Context->TransferBuffer == NULL) { \ - DBGPRINT(RT_DEBUG_ERROR, msg2); \ - Status = NDIS_STATUS_RESOURCES; \ - goto err2; } - -#define LM_URB_FREE(pObj, Context, BufferSize) \ - if (NULL != Context->pUrb) { \ - RTUSB_UNLINK_URB(Context->pUrb); \ - RTUSB_FREE_URB(Context->pUrb); \ - Context->pUrb = NULL; } \ - if (NULL != Context->TransferBuffer) { \ - RTUSB_URB_FREE_BUFFER(pObj->pUsb_Dev, BufferSize, \ - Context->TransferBuffer, \ - Context->data_dma); \ - Context->TransferBuffer = NULL; } - - UCHAR i, acidx; - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - PTX_CONTEXT pNullContext = &(pAd->NullContext); - PTX_CONTEXT pPsPollContext = &(pAd->PsPollContext); - PTX_CONTEXT pRTSContext = &(pAd->RTSContext); - PTX_CONTEXT pMLMEContext = NULL; -// PHT_TX_CONTEXT pHTTXContext = NULL; - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - PVOID RingBaseVa; -// RTMP_TX_RING *pTxRing; - RTMP_MGMT_RING *pMgmtRing; - - DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitTransmit\n")); - pObj = pObj; - - // Init 4 set of Tx parameters - for(acidx = 0; acidx < NUM_OF_TX_RING; acidx++) - { - // Initialize all Transmit releated queues - InitializeQueueHeader(&pAd->TxSwQueue[acidx]); - - // Next Local tx ring pointer waiting for buck out - pAd->NextBulkOutIndex[acidx] = acidx; - pAd->BulkOutPending[acidx] = FALSE; // Buck Out control flag - //pAd->DataBulkDoneIdx[acidx] = 0; - } - - //pAd->NextMLMEIndex = 0; - //pAd->PushMgmtIndex = 0; - //pAd->PopMgmtIndex = 0; - //InterlockedExchange(&pAd->MgmtQueueSize, 0); - //InterlockedExchange(&pAd->TxCount, 0); - - //pAd->PrioRingFirstIndex = 0; - //pAd->PrioRingTxCnt = 0; - - do - { - // - // TX_RING_SIZE, 4 ACs - // - for(acidx=0; acidx<4; acidx++) - { - PHT_TX_CONTEXT pHTTXContext = &(pAd->TxContext[acidx]); - - NdisZeroMemory(pHTTXContext, sizeof(HT_TX_CONTEXT)); - //Allocate URB - LM_USB_ALLOC(pObj, pHTTXContext, PHTTX_BUFFER, sizeof(HTTX_BUFFER), Status, - ("<-- ERROR in Alloc TX TxContext[%d] urb!! \n", acidx), - done, - ("<-- ERROR in Alloc TX TxContext[%d] HTTX_BUFFER !! \n", acidx), - out1); - - NdisZeroMemory(pHTTXContext->TransferBuffer->Aggregation, 4); - pHTTXContext->pAd = pAd; - pHTTXContext->pIrp = NULL; - pHTTXContext->IRPPending = FALSE; - pHTTXContext->NextBulkOutPosition = 0; - pHTTXContext->ENextBulkOutPosition = 0; - pHTTXContext->CurWritePosition = 0; - pHTTXContext->CurWriteRealPos = 0; - pHTTXContext->BulkOutSize = 0; - pHTTXContext->BulkOutPipeId = acidx; - pHTTXContext->bRingEmpty = TRUE; - pHTTXContext->bCopySavePad = FALSE; - - pAd->BulkOutPending[acidx] = FALSE; - } - - - // - // MGMT_RING_SIZE - // - // Allocate MGMT ring descriptor's memory - pAd->MgmtDescRing.AllocSize = MGMT_RING_SIZE * sizeof(TX_CONTEXT); - RTMPAllocateMemory(&pAd->MgmtDescRing.AllocVa, pAd->MgmtDescRing.AllocSize); - if (pAd->MgmtDescRing.AllocVa == NULL) - { - DBGPRINT_ERR(("Failed to allocate a big buffer for MgmtDescRing!\n")); - Status = NDIS_STATUS_RESOURCES; - goto out1; - } - NdisZeroMemory(pAd->MgmtDescRing.AllocVa, pAd->MgmtDescRing.AllocSize); - RingBaseVa = pAd->MgmtDescRing.AllocVa; - - // Initialize MGMT Ring and associated buffer memory - pMgmtRing = &pAd->MgmtRing; - for (i = 0; i < MGMT_RING_SIZE; i++) - { - // link the pre-allocated Mgmt buffer to MgmtRing.Cell - pMgmtRing->Cell[i].AllocSize = sizeof(TX_CONTEXT); - pMgmtRing->Cell[i].AllocVa = RingBaseVa; - pMgmtRing->Cell[i].pNdisPacket = NULL; - pMgmtRing->Cell[i].pNextNdisPacket = NULL; - - //Allocate URB for MLMEContext - pMLMEContext = (PTX_CONTEXT) pAd->MgmtRing.Cell[i].AllocVa; - pMLMEContext->pUrb = RTUSB_ALLOC_URB(0); - if (pMLMEContext->pUrb == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("<-- ERROR in Alloc TX MLMEContext[%d] urb!! \n", i)); - Status = NDIS_STATUS_RESOURCES; - goto out2; - } - pMLMEContext->pAd = pAd; - pMLMEContext->pIrp = NULL; - pMLMEContext->TransferBuffer = NULL; - pMLMEContext->InUse = FALSE; - pMLMEContext->IRPPending = FALSE; - pMLMEContext->bWaitingBulkOut = FALSE; - pMLMEContext->BulkOutSize = 0; - pMLMEContext->SelfIdx = i; - - // Offset to next ring descriptor address - RingBaseVa = (PUCHAR) RingBaseVa + sizeof(TX_CONTEXT); - } - DBGPRINT(RT_DEBUG_TRACE, ("MGMT Ring: total %d entry allocated\n", i)); - - //pAd->MgmtRing.TxSwFreeIdx = (MGMT_RING_SIZE - 1); - pAd->MgmtRing.TxSwFreeIdx = MGMT_RING_SIZE; - pAd->MgmtRing.TxCpuIdx = 0; - pAd->MgmtRing.TxDmaIdx = 0; - - // - // BEACON_RING_SIZE - // - for(i=0; iBeaconContext[i]); - - - NdisZeroMemory(pBeaconContext, sizeof(TX_CONTEXT)); - - //Allocate URB - LM_USB_ALLOC(pObj, pBeaconContext, PTX_BUFFER, sizeof(TX_BUFFER), Status, - ("<-- ERROR in Alloc TX BeaconContext[%d] urb!! \n", i), - out2, - ("<-- ERROR in Alloc TX BeaconContext[%d] TX_BUFFER !! \n", i), - out3); - - pBeaconContext->pAd = pAd; - pBeaconContext->pIrp = NULL; - pBeaconContext->InUse = FALSE; - pBeaconContext->IRPPending = FALSE; - } - - // - // NullContext - // - NdisZeroMemory(pNullContext, sizeof(TX_CONTEXT)); - - //Allocate URB - LM_USB_ALLOC(pObj, pNullContext, PTX_BUFFER, sizeof(TX_BUFFER), Status, - ("<-- ERROR in Alloc TX NullContext urb!! \n"), - out3, - ("<-- ERROR in Alloc TX NullContext TX_BUFFER !! \n"), - out4); - - pNullContext->pAd = pAd; - pNullContext->pIrp = NULL; - pNullContext->InUse = FALSE; - pNullContext->IRPPending = FALSE; - - // - // RTSContext - // - NdisZeroMemory(pRTSContext, sizeof(TX_CONTEXT)); - - //Allocate URB - LM_USB_ALLOC(pObj, pRTSContext, PTX_BUFFER, sizeof(TX_BUFFER), Status, - ("<-- ERROR in Alloc TX RTSContext urb!! \n"), - out4, - ("<-- ERROR in Alloc TX RTSContext TX_BUFFER !! \n"), - out5); - - pRTSContext->pAd = pAd; - pRTSContext->pIrp = NULL; - pRTSContext->InUse = FALSE; - pRTSContext->IRPPending = FALSE; - - // - // PsPollContext - // - //NdisZeroMemory(pPsPollContext, sizeof(TX_CONTEXT)); - //Allocate URB - LM_USB_ALLOC(pObj, pPsPollContext, PTX_BUFFER, sizeof(TX_BUFFER), Status, - ("<-- ERROR in Alloc TX PsPollContext urb!! \n"), - out5, - ("<-- ERROR in Alloc TX PsPollContext TX_BUFFER !! \n"), - out6); - - pPsPollContext->pAd = pAd; - pPsPollContext->pIrp = NULL; - pPsPollContext->InUse = FALSE; - pPsPollContext->IRPPending = FALSE; - pPsPollContext->bAggregatible = FALSE; - pPsPollContext->LastOne = TRUE; - - } while (FALSE); - - -done: - DBGPRINT(RT_DEBUG_TRACE, ("<-- NICInitTransmit\n")); - - return Status; - - /* --------------------------- ERROR HANDLE --------------------------- */ -out6: - LM_URB_FREE(pObj, pPsPollContext, sizeof(TX_BUFFER)); - -out5: - LM_URB_FREE(pObj, pRTSContext, sizeof(TX_BUFFER)); - -out4: - LM_URB_FREE(pObj, pNullContext, sizeof(TX_BUFFER)); - -out3: - for(i=0; iBeaconContext[i]); - if (pBeaconContext) - LM_URB_FREE(pObj, pBeaconContext, sizeof(TX_BUFFER)); - } - -out2: - if (pAd->MgmtDescRing.AllocVa) - { - pMgmtRing = &pAd->MgmtRing; - for(i=0; iMgmtRing.Cell[i].AllocVa; - if (pMLMEContext) - LM_URB_FREE(pObj, pMLMEContext, sizeof(TX_BUFFER)); - } - NdisFreeMemory(pAd->MgmtDescRing.AllocVa, pAd->MgmtDescRing.AllocSize, 0); - pAd->MgmtDescRing.AllocVa = NULL; - } - -out1: - for (acidx = 0; acidx < 4; acidx++) - { - PHT_TX_CONTEXT pTxContext = &(pAd->TxContext[acidx]); - if (pTxContext) - LM_URB_FREE(pObj, pTxContext, sizeof(HTTX_BUFFER)); - } - - // Here we didn't have any pre-allocated memory need to free. - - return Status; -} - - -/* -======================================================================== -Routine Description: - Allocate DMA memory blocks for send, receive. - -Arguments: - pAd Pointer to our adapter - -Return Value: - NDIS_STATUS_SUCCESS - NDIS_STATUS_FAILURE - NDIS_STATUS_RESOURCES - -Note: -======================================================================== -*/ -NDIS_STATUS RTMPAllocTxRxRingMemory( - IN PRTMP_ADAPTER pAd) -{ -// COUNTER_802_11 pCounter = &pAd->WlanCounters; - NDIS_STATUS Status; - INT num; - - - DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPAllocTxRxRingMemory\n")); - - - do - { - // Init the CmdQ and CmdQLock - NdisAllocateSpinLock(&pAd->CmdQLock); - NdisAcquireSpinLock(&pAd->CmdQLock); - RTUSBInitializeCmdQ(&pAd->CmdQ); - NdisReleaseSpinLock(&pAd->CmdQLock); - - - NdisAllocateSpinLock(&pAd->MLMEBulkOutLock); - //NdisAllocateSpinLock(&pAd->MLMEWaitQueueLock); - NdisAllocateSpinLock(&pAd->BulkOutLock[0]); - NdisAllocateSpinLock(&pAd->BulkOutLock[1]); - NdisAllocateSpinLock(&pAd->BulkOutLock[2]); - NdisAllocateSpinLock(&pAd->BulkOutLock[3]); - NdisAllocateSpinLock(&pAd->BulkOutLock[4]); - NdisAllocateSpinLock(&pAd->BulkOutLock[5]); - NdisAllocateSpinLock(&pAd->BulkInLock); - - for (num = 0; num < NUM_OF_TX_RING; num++) - { - NdisAllocateSpinLock(&pAd->TxContextQueueLock[num]); - } - -// NdisAllocateSpinLock(&pAd->MemLock); // Not used in RT28XX - -// NdisAllocateSpinLock(&pAd->MacTabLock); // init it in UserCfgInit() -// NdisAllocateSpinLock(&pAd->BATabLock); // init it in BATableInit() - -// for(num=0; numBATable.BARecEntry[num].RxReRingLock); -// } - - // - // Init Mac Table - // -// MacTableInitialize(pAd); - - // - // Init send data structures and related parameters - // - Status = NICInitTransmit(pAd); - if (Status != NDIS_STATUS_SUCCESS) - break; - - // - // Init receive data structures and related parameters - // - Status = NICInitRecv(pAd); - if (Status != NDIS_STATUS_SUCCESS) - break; - - pAd->PendingIoCount = 1; - - } while (FALSE); - - NdisZeroMemory(&pAd->FragFrame, sizeof(FRAGMENT_FRAME)); - pAd->FragFrame.pFragPacket = RTMP_AllocateFragPacketBuffer(pAd, RX_BUFFER_NORMSIZE); - - if (pAd->FragFrame.pFragPacket == NULL) - { - Status = NDIS_STATUS_RESOURCES; - } - - DBGPRINT_S(Status, ("<-- RTMPAllocTxRxRingMemory, Status=%x\n", Status)); - return Status; -} - - -/* -======================================================================== -Routine Description: - Calls USB_InterfaceStop and frees memory allocated for the URBs - calls NdisMDeregisterDevice and frees the memory - allocated in VNetInitialize for the Adapter Object - -Arguments: - *pAd the raxx interface data pointer - -Return Value: - None - -Note: -======================================================================== -*/ -VOID RTMPFreeTxRxRingMemory( - IN PRTMP_ADAPTER pAd) -{ -#define LM_URB_FREE(pObj, Context, BufferSize) \ - if (NULL != Context->pUrb) { \ - RTUSB_UNLINK_URB(Context->pUrb); \ - RTUSB_FREE_URB(Context->pUrb); \ - Context->pUrb = NULL; } \ - if (NULL != Context->TransferBuffer) { \ - RTUSB_URB_FREE_BUFFER(pObj->pUsb_Dev, BufferSize, \ - Context->TransferBuffer, \ - Context->data_dma); \ - Context->TransferBuffer = NULL; } - - - UINT i, acidx; - PTX_CONTEXT pNullContext = &pAd->NullContext; - PTX_CONTEXT pPsPollContext = &pAd->PsPollContext; - PTX_CONTEXT pRTSContext = &pAd->RTSContext; -// PHT_TX_CONTEXT pHTTXContext; - //PRTMP_REORDERBUF pReorderBuf; - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; -// RTMP_TX_RING *pTxRing; - - DBGPRINT(RT_DEBUG_ERROR, ("---> RTMPFreeTxRxRingMemory\n")); - pObj = pObj; - - // Free all resources for the RECEIVE buffer queue. - for(i=0; i<(RX_RING_SIZE); i++) - { - PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); - if (pRxContext) - LM_URB_FREE(pObj, pRxContext, MAX_RXBULK_SIZE); - } - - // Free PsPoll frame resource - LM_URB_FREE(pObj, pPsPollContext, sizeof(TX_BUFFER)); - - // Free NULL frame resource - LM_URB_FREE(pObj, pNullContext, sizeof(TX_BUFFER)); - - // Free RTS frame resource - LM_URB_FREE(pObj, pRTSContext, sizeof(TX_BUFFER)); - - - // Free beacon frame resource - for(i=0; iBeaconContext[i]); - if (pBeaconContext) - LM_URB_FREE(pObj, pBeaconContext, sizeof(TX_BUFFER)); - } - - - // Free mgmt frame resource - for(i = 0; i < MGMT_RING_SIZE; i++) - { - PTX_CONTEXT pMLMEContext = (PTX_CONTEXT)pAd->MgmtRing.Cell[i].AllocVa; - //LM_URB_FREE(pObj, pMLMEContext, sizeof(TX_BUFFER)); - if (NULL != pAd->MgmtRing.Cell[i].pNdisPacket) - { - RTMPFreeNdisPacket(pAd, pAd->MgmtRing.Cell[i].pNdisPacket); - pAd->MgmtRing.Cell[i].pNdisPacket = NULL; - pMLMEContext->TransferBuffer = NULL; - } - - if (pMLMEContext) - { - if (NULL != pMLMEContext->pUrb) - { - RTUSB_UNLINK_URB(pMLMEContext->pUrb); - RTUSB_FREE_URB(pMLMEContext->pUrb); - pMLMEContext->pUrb = NULL; - } - } - } - if (pAd->MgmtDescRing.AllocVa) - NdisFreeMemory(pAd->MgmtDescRing.AllocVa, pAd->MgmtDescRing.AllocSize, 0); - - - // Free Tx frame resource - for(acidx=0; acidx<4; acidx++) - { - PHT_TX_CONTEXT pHTTXContext = &(pAd->TxContext[acidx]); - if (pHTTXContext) - LM_URB_FREE(pObj, pHTTXContext, sizeof(HTTX_BUFFER)); - } - - if (pAd->FragFrame.pFragPacket) - RELEASE_NDIS_PACKET(pAd, pAd->FragFrame.pFragPacket, NDIS_STATUS_SUCCESS); - - for(i=0; i<6; i++) - { - NdisFreeSpinLock(&pAd->BulkOutLock[i]); - } - - NdisFreeSpinLock(&pAd->BulkInLock); - NdisFreeSpinLock(&pAd->MLMEBulkOutLock); - - NdisFreeSpinLock(&pAd->CmdQLock); - - // Clear all pending bulk-out request flags. - RTUSB_CLEAR_BULK_FLAG(pAd, 0xffffffff); - -// NdisFreeSpinLock(&pAd->MacTabLock); - -// for(i=0; iBATable.BARecEntry[i].RxReRingLock); -// } - - DBGPRINT(RT_DEBUG_ERROR, ("<--- ReleaseAdapter\n")); -} - - -/* -======================================================================== -Routine Description: - Allocate memory for adapter control block. - -Arguments: - pAd Pointer to our adapter - -Return Value: - NDIS_STATUS_SUCCESS - NDIS_STATUS_FAILURE - NDIS_STATUS_RESOURCES - -Note: -======================================================================== -*/ -NDIS_STATUS AdapterBlockAllocateMemory( - IN PVOID handle, - OUT PVOID *ppAd) -{ - PUSB_DEV usb_dev; - POS_COOKIE pObj = (POS_COOKIE) handle; - - - usb_dev = pObj->pUsb_Dev; - - pObj->MLMEThr_pid = NULL; - pObj->RTUSBCmdThr_pid = NULL; - - *ppAd = (PVOID)vmalloc(sizeof(RTMP_ADAPTER)); - - if (*ppAd) - { - NdisZeroMemory(*ppAd, sizeof(RTMP_ADAPTER)); - ((PRTMP_ADAPTER)*ppAd)->OS_Cookie = handle; - return (NDIS_STATUS_SUCCESS); - } - else - { - return (NDIS_STATUS_FAILURE); - } -} - - -/* -======================================================================== -Routine Description: - Create kernel threads & tasklets. - -Arguments: - *net_dev Pointer to wireless net device interface - -Return Value: - NDIS_STATUS_SUCCESS - NDIS_STATUS_FAILURE - -Note: -======================================================================== -*/ -NDIS_STATUS CreateThreads( - IN struct net_device *net_dev) -{ - PRTMP_ADAPTER pAd = net_dev->ml_priv; - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - pid_t pid_number; - - //init_MUTEX(&(pAd->usbdev_semaphore)); - - init_MUTEX_LOCKED(&(pAd->mlme_semaphore)); - init_completion (&pAd->mlmeComplete); - - init_MUTEX_LOCKED(&(pAd->RTUSBCmd_semaphore)); - init_completion (&pAd->CmdQComplete); - - init_MUTEX_LOCKED(&(pAd->RTUSBTimer_semaphore)); - init_completion (&pAd->TimerQComplete); - - // Creat MLME Thread - pObj->MLMEThr_pid = NULL; - pid_number = kernel_thread(MlmeThread, pAd, CLONE_VM); - if (pid_number < 0) - { - printk (KERN_WARNING "%s: unable to start Mlme thread\n",pAd->net_dev->name); - return NDIS_STATUS_FAILURE; - } - - pObj->MLMEThr_pid = find_get_pid(pid_number); - - // Wait for the thread to start - wait_for_completion(&(pAd->mlmeComplete)); - - // Creat Command Thread - pObj->RTUSBCmdThr_pid = NULL; - pid_number = kernel_thread(RTUSBCmdThread, pAd, CLONE_VM); - if (pid_number < 0) - { - printk (KERN_WARNING "%s: unable to start RTUSBCmd thread\n",pAd->net_dev->name); - return NDIS_STATUS_FAILURE; - } - - pObj->RTUSBCmdThr_pid = find_get_pid(pid_number); - - wait_for_completion(&(pAd->CmdQComplete)); - - pObj->TimerQThr_pid = NULL; - pid_number = kernel_thread(TimerQThread, pAd, CLONE_VM); - if (pid_number < 0) - { - printk (KERN_WARNING "%s: unable to start TimerQThread\n",pAd->net_dev->name); - return NDIS_STATUS_FAILURE; - } - - pObj->TimerQThr_pid = find_get_pid(pid_number); - - // Wait for the thread to start - wait_for_completion(&(pAd->TimerQComplete)); - - // Create receive tasklet - tasklet_init(&pObj->rx_done_task, rx_done_tasklet, (ULONG)pAd); - tasklet_init(&pObj->mgmt_dma_done_task, rt2870_mgmt_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac0_dma_done_task, rt2870_ac0_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac1_dma_done_task, rt2870_ac1_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac2_dma_done_task, rt2870_ac2_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac3_dma_done_task, rt2870_ac3_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->hcca_dma_done_task, rt2870_hcca_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->tbtt_task, tbtt_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->null_frame_complete_task, rt2870_null_frame_complete_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->rts_frame_complete_task, rt2870_rts_frame_complete_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->pspoll_frame_complete_task, rt2870_pspoll_frame_complete_tasklet, (unsigned long)pAd); - - return NDIS_STATUS_SUCCESS; -} - -/* -======================================================================== -Routine Description: - As STA's BSSID is a WC too, it uses shared key table. - This function write correct unicast TX key to ASIC WCID. - And we still make a copy in our MacTab.Content[BSSID_WCID].PairwiseKey. - Caller guarantee TKIP/AES always has keyidx = 0. (pairwise key) - Caller guarantee WEP calls this function when set Txkey, default key index=0~3. - -Arguments: - pAd Pointer to our adapter - pKey Pointer to the where the key stored - -Return Value: - NDIS_SUCCESS Add key successfully - -Note: -======================================================================== -*/ -VOID RTMPAddBSSIDCipher( - IN PRTMP_ADAPTER pAd, - IN UCHAR Aid, - IN PNDIS_802_11_KEY pKey, - IN UCHAR CipherAlg) -{ - PUCHAR pTxMic, pRxMic; - BOOLEAN bKeyRSC, bAuthenticator; // indicate the receive SC set by KeyRSC value -// UCHAR CipherAlg; - UCHAR i; - ULONG WCIDAttri; - USHORT offset; - UCHAR KeyIdx, IVEIV[8]; - UINT32 Value; - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPAddBSSIDCipher==> Aid = %d\n",Aid)); - - // Bit 29 of Add-key KeyRSC - bKeyRSC = (pKey->KeyIndex & 0x20000000) ? TRUE : FALSE; - - // Bit 28 of Add-key Authenticator - bAuthenticator = (pKey->KeyIndex & 0x10000000) ? TRUE : FALSE; - KeyIdx = (UCHAR)pKey->KeyIndex&0xff; - - if (KeyIdx > 4) - return; - - - if (pAd->MacTab.Content[Aid].PairwiseKey.CipherAlg == CIPHER_TKIP) - { if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) - { - // for WPA-None Tx, Rx MIC is the same - pTxMic = (PUCHAR) (&pKey->KeyMaterial) + 16; - pRxMic = pTxMic; - } - else if (bAuthenticator == TRUE) - { - pTxMic = (PUCHAR) (&pKey->KeyMaterial) + 16; - pRxMic = (PUCHAR) (&pKey->KeyMaterial) + 24; - } - else - { - pRxMic = (PUCHAR) (&pKey->KeyMaterial) + 16; - pTxMic = (PUCHAR) (&pKey->KeyMaterial) + 24; - } - - offset = PAIRWISE_KEY_TABLE_BASE + (Aid * HW_KEY_ENTRY_SIZE) + 0x10; - for (i=0; i<8; ) - { - Value = *(pTxMic+i); - Value += (*(pTxMic+i+1)<<8); - Value += (*(pTxMic+i+2)<<16); - Value += (*(pTxMic+i+3)<<24); - RTUSBWriteMACRegister(pAd, offset+i, Value); - i+=4; - } - - offset = PAIRWISE_KEY_TABLE_BASE + (Aid * HW_KEY_ENTRY_SIZE) + 0x18; - for (i=0; i<8; ) - { - Value = *(pRxMic+i); - Value += (*(pRxMic+i+1)<<8); - Value += (*(pRxMic+i+2)<<16); - Value += (*(pRxMic+i+3)<<24); - RTUSBWriteMACRegister(pAd, offset+i, Value); - i+=4; - } - - // Only Key lenth equal to TKIP key have these - NdisMoveMemory(pAd->MacTab.Content[Aid].PairwiseKey.RxMic, pRxMic, 8); - NdisMoveMemory(pAd->MacTab.Content[Aid].PairwiseKey.TxMic, pTxMic, 8); - - DBGPRINT(RT_DEBUG_TRACE, - (" TxMIC = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x \n", - pTxMic[0],pTxMic[1],pTxMic[2],pTxMic[3], - pTxMic[4],pTxMic[5],pTxMic[6],pTxMic[7])); - DBGPRINT(RT_DEBUG_TRACE, - (" RxMIC = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x \n", - pRxMic[0],pRxMic[1],pRxMic[2],pRxMic[3], - pRxMic[4],pRxMic[5],pRxMic[6],pRxMic[7])); - } - - // 2. Record Security Key. - pAd->MacTab.Content[BSSID_WCID].PairwiseKey.KeyLen= (UCHAR)pKey->KeyLength; - NdisMoveMemory(pAd->MacTab.Content[Aid].PairwiseKey.Key, &pKey->KeyMaterial, pKey->KeyLength); - - // 3. Check RxTsc. And used to init to ASIC IV. - if (bKeyRSC == TRUE) - NdisMoveMemory(pAd->MacTab.Content[Aid].PairwiseKey.RxTsc, &pKey->KeyRSC, 6); - else - NdisZeroMemory(pAd->MacTab.Content[Aid].PairwiseKey.RxTsc, 6); - - // 4. Init TxTsc to one based on WiFi WPA specs - pAd->MacTab.Content[Aid].PairwiseKey.TxTsc[0] = 1; - pAd->MacTab.Content[Aid].PairwiseKey.TxTsc[1] = 0; - pAd->MacTab.Content[Aid].PairwiseKey.TxTsc[2] = 0; - pAd->MacTab.Content[Aid].PairwiseKey.TxTsc[3] = 0; - pAd->MacTab.Content[Aid].PairwiseKey.TxTsc[4] = 0; - pAd->MacTab.Content[Aid].PairwiseKey.TxTsc[5] = 0; - - CipherAlg = pAd->MacTab.Content[Aid].PairwiseKey.CipherAlg; - - offset = PAIRWISE_KEY_TABLE_BASE + (Aid * HW_KEY_ENTRY_SIZE); - RTUSBMultiWrite(pAd, (USHORT) offset, pKey->KeyMaterial, - ((pKey->KeyLength == LEN_TKIP_KEY) ? 16 : (USHORT)pKey->KeyLength)); - - offset = SHARED_KEY_TABLE_BASE + (KeyIdx * HW_KEY_ENTRY_SIZE); - RTUSBMultiWrite(pAd, (USHORT) offset, pKey->KeyMaterial, (USHORT)pKey->KeyLength); - - offset = PAIRWISE_IVEIV_TABLE_BASE + (Aid * HW_IVEIV_ENTRY_SIZE); - NdisZeroMemory(IVEIV, 8); - - // IV/EIV - if ((CipherAlg == CIPHER_TKIP) || - (CipherAlg == CIPHER_TKIP_NO_MIC) || - (CipherAlg == CIPHER_AES)) - { - IVEIV[3] = 0x20; // Eiv bit on. keyid always 0 for pairwise key - } - // default key idx needs to set. - // in TKIP/AES KeyIdx = 0 , WEP KeyIdx is default tx key. - else - { - IVEIV[3] |= (KeyIdx<< 6); - } - RTUSBMultiWrite(pAd, (USHORT) offset, IVEIV, 8); - - // WCID Attribute UDF:3, BSSIdx:3, Alg:3, Keytable:1=PAIRWISE KEY, BSSIdx is 0 - if ((CipherAlg == CIPHER_TKIP) || - (CipherAlg == CIPHER_TKIP_NO_MIC) || - (CipherAlg == CIPHER_AES)) - { - WCIDAttri = (CipherAlg<<1)|SHAREDKEYTABLE; - } - else - WCIDAttri = (CipherAlg<<1)|SHAREDKEYTABLE; - - offset = MAC_WCID_ATTRIBUTE_BASE + (Aid* HW_WCID_ATTRI_SIZE); - RTUSBWriteMACRegister(pAd, offset, WCIDAttri); - RTUSBReadMACRegister(pAd, offset, &Value); - - DBGPRINT(RT_DEBUG_TRACE, ("BSSID_WCID : offset = %x, WCIDAttri = %lx\n", - offset, WCIDAttri)); - - // pAddr - // Add Bssid mac address at linkup. not here. check! - /*offset = MAC_WCID_BASE + (BSSID_WCID * HW_WCID_ENTRY_SIZE); - *for (i=0; iBSSID[i]); - } - */ - - DBGPRINT(RT_DEBUG_ERROR, ("AddBSSIDasWCIDEntry: Alg=%s, KeyLength = %d\n", - CipherName[CipherAlg], pKey->KeyLength)); - DBGPRINT(RT_DEBUG_TRACE, ("Key [idx=%x] [KeyLen = %d]\n", - pKey->KeyIndex, pKey->KeyLength)); - for(i=0; iKeyLength; i++) - DBGPRINT_RAW(RT_DEBUG_TRACE,(" %x:", pKey->KeyMaterial[i])); - DBGPRINT(RT_DEBUG_TRACE,(" \n")); -} - -/* -======================================================================== -Routine Description: - Get a received packet. - -Arguments: - pAd device control block - pSaveRxD receive descriptor information - *pbReschedule need reschedule flag - *pRxPending pending received packet flag - -Return Value: - the recieved packet - -Note: -======================================================================== -*/ -#define RT2870_RXDMALEN_FIELD_SIZE 4 -PNDIS_PACKET GetPacketFromRxRing( - IN PRTMP_ADAPTER pAd, - OUT PRT28XX_RXD_STRUC pSaveRxD, - OUT BOOLEAN *pbReschedule, - IN OUT UINT32 *pRxPending) -{ - PRX_CONTEXT pRxContext; - PNDIS_PACKET pSkb; - PUCHAR pData; - ULONG ThisFrameLen; - ULONG RxBufferLength; - PRXWI_STRUC pRxWI; - - pRxContext = &pAd->RxContext[pAd->NextRxBulkInReadIndex]; - if ((pRxContext->Readable == FALSE) || (pRxContext->InUse == TRUE)) - return NULL; - - RxBufferLength = pRxContext->BulkInOffset - pAd->ReadPosition; - if (RxBufferLength < (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXWI_STRUC) + sizeof(RXINFO_STRUC))) - { - goto label_null; - } - - pData = &pRxContext->TransferBuffer[pAd->ReadPosition]; /* 4KB */ - // The RXDMA field is 4 bytes, now just use the first 2 bytes. The Length including the (RXWI + MSDU + Padding) - ThisFrameLen = *pData + (*(pData+1)<<8); - if (ThisFrameLen == 0) - { - DBGPRINT(RT_DEBUG_TRACE, ("BIRIdx(%d): RXDMALen is zero.[%ld], BulkInBufLen = %ld)\n", - pAd->NextRxBulkInReadIndex, ThisFrameLen, pRxContext->BulkInOffset)); - goto label_null; - } - if ((ThisFrameLen&0x3) != 0) - { - DBGPRINT(RT_DEBUG_ERROR, ("BIRIdx(%d): RXDMALen not multiple of 4.[%ld], BulkInBufLen = %ld)\n", - pAd->NextRxBulkInReadIndex, ThisFrameLen, pRxContext->BulkInOffset)); - goto label_null; - } - - if ((ThisFrameLen + 8)> RxBufferLength) // 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC)) - { - DBGPRINT(RT_DEBUG_TRACE,("BIRIdx(%d):FrameLen(0x%lx) outranges. BulkInLen=0x%lx, remaining RxBufLen=0x%lx, ReadPos=0x%lx\n", - pAd->NextRxBulkInReadIndex, ThisFrameLen, pRxContext->BulkInOffset, RxBufferLength, pAd->ReadPosition)); - - // error frame. finish this loop - goto label_null; - } - - // skip USB frame length field - pData += RT2870_RXDMALEN_FIELD_SIZE; - pRxWI = (PRXWI_STRUC)pData; - - if (pRxWI->MPDUtotalByteCount > ThisFrameLen) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s():pRxWIMPDUtotalByteCount(%d) large than RxDMALen(%ld)\n", - __func__, pRxWI->MPDUtotalByteCount, ThisFrameLen)); - goto label_null; - } - - // allocate a rx packet - pSkb = dev_alloc_skb(ThisFrameLen); - if (pSkb == NULL) - { - DBGPRINT(RT_DEBUG_ERROR,("%s():Cannot Allocate sk buffer for this Bulk-In buffer!\n", __func__)); - goto label_null; - } - - // copy the rx packet - memcpy(skb_put(pSkb, ThisFrameLen), pData, ThisFrameLen); - RTPKT_TO_OSPKT(pSkb)->dev = get_netdev_from_bssid(pAd, BSS0); - RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pSkb), PKTSRC_NDIS); - - // copy RxD - *pSaveRxD = *(PRXINFO_STRUC)(pData + ThisFrameLen); - - // update next packet read position. - pAd->ReadPosition += (ThisFrameLen + RT2870_RXDMALEN_FIELD_SIZE + RXINFO_SIZE); // 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC)) - - return pSkb; - -label_null: - - return NULL; -} - - -/* -======================================================================== -Routine Description: - Handle received packets. - -Arguments: - data - URB information pointer - -Return Value: - None - -Note: -======================================================================== -*/ -static void rx_done_tasklet(unsigned long data) -{ - purbb_t pUrb; - PRX_CONTEXT pRxContext; - PRTMP_ADAPTER pAd; - NTSTATUS Status; - unsigned int IrqFlags; - - pUrb = (purbb_t)data; - pRxContext = (PRX_CONTEXT)pUrb->context; - pAd = pRxContext->pAd; - Status = pUrb->status; - - - RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags); - pRxContext->InUse = FALSE; - pRxContext->IRPPending = FALSE; - pRxContext->BulkInOffset += pUrb->actual_length; - //NdisInterlockedDecrement(&pAd->PendingRx); - pAd->PendingRx--; - - if (Status == USB_ST_NOERROR) - { - pAd->BulkInComplete++; - pAd->NextRxBulkInPosition = 0; - if (pRxContext->BulkInOffset) // As jan's comment, it may bulk-in success but size is zero. - { - pRxContext->Readable = TRUE; - INC_RING_INDEX(pAd->NextRxBulkInIndex, RX_RING_SIZE); - } - RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); - } - else // STATUS_OTHER - { - pAd->BulkInCompleteFail++; - // Still read this packet although it may comtain wrong bytes. - pRxContext->Readable = FALSE; - RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); - - // Parsing all packets. because after reset, the index will reset to all zero. - if ((!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_BULKIN_RESET | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST)))) - { - - DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk In Failed. Status=%d, BIIdx=0x%x, BIRIdx=0x%x, actual_length= 0x%x\n", - Status, pAd->NextRxBulkInIndex, pAd->NextRxBulkInReadIndex, pRxContext->pUrb->actual_length)); - - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKIN_RESET); - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_IN, NULL, 0); - } - } - - ASSERT((pRxContext->InUse == pRxContext->IRPPending)); - - RTUSBBulkReceive(pAd); - - return; - -} - - -static void rt2870_mgmt_dma_done_tasklet(unsigned long data) -{ - PRTMP_ADAPTER pAd; - PTX_CONTEXT pMLMEContext; - int index; - PNDIS_PACKET pPacket; - purbb_t pUrb; - NTSTATUS Status; - unsigned long IrqFlags; - - - pUrb = (purbb_t)data; - pMLMEContext = (PTX_CONTEXT)pUrb->context; - pAd = pMLMEContext->pAd; - Status = pUrb->status; - index = pMLMEContext->SelfIdx; - - ASSERT((pAd->MgmtRing.TxDmaIdx == index)); - - RTMP_IRQ_LOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags); - - - if (Status != USB_ST_NOERROR) - { - //Bulk-Out fail status handle - if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out MLME Failed, Status=%d!\n", Status)); - // TODO: How to handle about the MLMEBulkOut failed issue. Need to resend the mgmt pkt? - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); - pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG); - } - } - - pAd->BulkOutPending[MGMTPIPEIDX] = FALSE; - RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags); - - RTMP_IRQ_LOCK(&pAd->MLMEBulkOutLock, IrqFlags); - // Reset MLME context flags - pMLMEContext->IRPPending = FALSE; - pMLMEContext->InUse = FALSE; - pMLMEContext->bWaitingBulkOut = FALSE; - pMLMEContext->BulkOutSize = 0; - - pPacket = pAd->MgmtRing.Cell[index].pNdisPacket; - pAd->MgmtRing.Cell[index].pNdisPacket = NULL; - - // Increase MgmtRing Index - INC_RING_INDEX(pAd->MgmtRing.TxDmaIdx, MGMT_RING_SIZE); - pAd->MgmtRing.TxSwFreeIdx++; - RTMP_IRQ_UNLOCK(&pAd->MLMEBulkOutLock, IrqFlags); - - // No-matter success or fail, we free the mgmt packet. - if (pPacket) - RTMPFreeNdisPacket(pAd, pPacket); - - if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST)))) - { - // do nothing and return directly. - } - else - { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET) && - ((pAd->bulkResetPipeid & BULKOUT_MGMT_RESET_FLAG) == BULKOUT_MGMT_RESET_FLAG)) - { // For Mgmt Bulk-Out failed, ignore it now. - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); - } - else - { - - // Always call Bulk routine, even reset bulk. - // The protectioon of rest bulk should be in BulkOut routine - if (pAd->MgmtRing.TxSwFreeIdx < MGMT_RING_SIZE /* pMLMEContext->bWaitingBulkOut == TRUE */) - { - RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_MLME); - } - RTUSBKickBulkOut(pAd); - } - } - -} - - -static void rt2870_hcca_dma_done_tasklet(unsigned long data) -{ - PRTMP_ADAPTER pAd; - PHT_TX_CONTEXT pHTTXContext; - UCHAR BulkOutPipeId = 4; - purbb_t pUrb; - - DBGPRINT_RAW(RT_DEBUG_ERROR, ("--->hcca_dma_done_tasklet\n")); - - pUrb = (purbb_t)data; - pHTTXContext = (PHT_TX_CONTEXT)pUrb->context; - pAd = pHTTXContext->pAd; - - rt2870_dataout_complete_tasklet((unsigned long)pUrb); - - if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST)))) - { - // do nothing and return directly. - } - else - { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) - { - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); - } - else - { pHTTXContext = &pAd->TxContext[BulkOutPipeId]; - if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) && - /*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */ - (pAd->DeQueueRunning[BulkOutPipeId] == FALSE) && - (pHTTXContext->bCurWriting == FALSE)) - { - RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS); - } - - RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL<<4); - RTUSBKickBulkOut(pAd); - } - } - - DBGPRINT_RAW(RT_DEBUG_ERROR, ("<---hcca_dma_done_tasklet\n")); -} - - -static void rt2870_ac3_dma_done_tasklet(unsigned long data) -{ - PRTMP_ADAPTER pAd; - PHT_TX_CONTEXT pHTTXContext; - UCHAR BulkOutPipeId = 3; - purbb_t pUrb; - - - pUrb = (purbb_t)data; - pHTTXContext = (PHT_TX_CONTEXT)pUrb->context; - pAd = pHTTXContext->pAd; - - rt2870_dataout_complete_tasklet((unsigned long)pUrb); - - if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST)))) - { - // do nothing and return directly. - } - else - { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) - { - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); - } - else - { pHTTXContext = &pAd->TxContext[BulkOutPipeId]; - if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) && - /*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */ - (pAd->DeQueueRunning[BulkOutPipeId] == FALSE) && - (pHTTXContext->bCurWriting == FALSE)) - { - RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS); - } - - RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL<<3); - RTUSBKickBulkOut(pAd); - } - } - - - return; -} - - -static void rt2870_ac2_dma_done_tasklet(unsigned long data) -{ - PRTMP_ADAPTER pAd; - PHT_TX_CONTEXT pHTTXContext; - UCHAR BulkOutPipeId = 2; - purbb_t pUrb; - - - pUrb = (purbb_t)data; - pHTTXContext = (PHT_TX_CONTEXT)pUrb->context; - pAd = pHTTXContext->pAd; - - rt2870_dataout_complete_tasklet((unsigned long)pUrb); - - if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST)))) - { - // do nothing and return directly. - } - else - { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) - { - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); - } - else - { pHTTXContext = &pAd->TxContext[BulkOutPipeId]; - if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) && - /*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */ - (pAd->DeQueueRunning[BulkOutPipeId] == FALSE) && - (pHTTXContext->bCurWriting == FALSE)) - { - RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS); - } - - RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL<<2); - RTUSBKickBulkOut(pAd); - } - } - - return; -} - - -static void rt2870_ac1_dma_done_tasklet(unsigned long data) -{ - PRTMP_ADAPTER pAd; - PHT_TX_CONTEXT pHTTXContext; - UCHAR BulkOutPipeId = 1; - purbb_t pUrb; - - - pUrb = (purbb_t)data; - pHTTXContext = (PHT_TX_CONTEXT)pUrb->context; - pAd = pHTTXContext->pAd; - - rt2870_dataout_complete_tasklet((unsigned long)pUrb); - - if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST)))) - { - // do nothing and return directly. - } - else - { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) - { - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); - } - else - { pHTTXContext = &pAd->TxContext[BulkOutPipeId]; - if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) && - /*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */ - (pAd->DeQueueRunning[BulkOutPipeId] == FALSE) && - (pHTTXContext->bCurWriting == FALSE)) - { - RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS); - } - - RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL<<1); - RTUSBKickBulkOut(pAd); - } - } - - - return; -} - - -static void rt2870_ac0_dma_done_tasklet(unsigned long data) -{ - PRTMP_ADAPTER pAd; - PHT_TX_CONTEXT pHTTXContext; - UCHAR BulkOutPipeId = 0; - purbb_t pUrb; - - - pUrb = (purbb_t)data; - pHTTXContext = (PHT_TX_CONTEXT)pUrb->context; - pAd = pHTTXContext->pAd; - - rt2870_dataout_complete_tasklet((unsigned long)pUrb); - - if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST)))) - { - // do nothing and return directly. - } - else - { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) - { - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); - } - else - { pHTTXContext = &pAd->TxContext[BulkOutPipeId]; - if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) && - /* ((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */ - (pAd->DeQueueRunning[BulkOutPipeId] == FALSE) && - (pHTTXContext->bCurWriting == FALSE)) - { - RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS); - } - - RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL); - RTUSBKickBulkOut(pAd); - } - } - - - return; - -} - - -static void rt2870_null_frame_complete_tasklet(unsigned long data) -{ - PRTMP_ADAPTER pAd; - PTX_CONTEXT pNullContext; - purbb_t pUrb; - NTSTATUS Status; - unsigned long irqFlag; - - - pUrb = (purbb_t)data; - pNullContext = (PTX_CONTEXT)pUrb->context; - pAd = pNullContext->pAd; - Status = pUrb->status; - - // Reset Null frame context flags - RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], irqFlag); - pNullContext->IRPPending = FALSE; - pNullContext->InUse = FALSE; - pAd->BulkOutPending[0] = FALSE; - pAd->watchDogTxPendingCnt[0] = 0; - - if (Status == USB_ST_NOERROR) - { - RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); - - RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); - } - else // STATUS_OTHER - { - if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out Null Frame Failed, ReasonCode=%d!\n", Status)); - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); - pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG); - RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); - } - else - { - RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); - } - } - - // Always call Bulk routine, even reset bulk. - // The protectioon of rest bulk should be in BulkOut routine - RTUSBKickBulkOut(pAd); - -} - - -static void rt2870_rts_frame_complete_tasklet(unsigned long data) -{ - PRTMP_ADAPTER pAd; - PTX_CONTEXT pRTSContext; - purbb_t pUrb; - NTSTATUS Status; - unsigned long irqFlag; - - - pUrb = (purbb_t)data; - pRTSContext = (PTX_CONTEXT)pUrb->context; - pAd = pRTSContext->pAd; - Status = pUrb->status; - - // Reset RTS frame context flags - RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], irqFlag); - pRTSContext->IRPPending = FALSE; - pRTSContext->InUse = FALSE; - - if (Status == USB_ST_NOERROR) - { - RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); - RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); - } - else // STATUS_OTHER - { - if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out RTS Frame Failed\n")); - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); - pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG); - RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); - } - else - { - RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); - } - } - - RTMP_SEM_LOCK(&pAd->BulkOutLock[pRTSContext->BulkOutPipeId]); - pAd->BulkOutPending[pRTSContext->BulkOutPipeId] = FALSE; - RTMP_SEM_UNLOCK(&pAd->BulkOutLock[pRTSContext->BulkOutPipeId]); - - // Always call Bulk routine, even reset bulk. - // The protectioon of rest bulk should be in BulkOut routine - RTUSBKickBulkOut(pAd); - -} - - -static void rt2870_pspoll_frame_complete_tasklet(unsigned long data) -{ - PRTMP_ADAPTER pAd; - PTX_CONTEXT pPsPollContext; - purbb_t pUrb; - NTSTATUS Status; - - - pUrb = (purbb_t)data; - pPsPollContext = (PTX_CONTEXT)pUrb->context; - pAd = pPsPollContext->pAd; - Status = pUrb->status; - - // Reset PsPoll context flags - pPsPollContext->IRPPending = FALSE; - pPsPollContext->InUse = FALSE; - pAd->watchDogTxPendingCnt[0] = 0; - - if (Status == USB_ST_NOERROR) - { - RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); - } - else // STATUS_OTHER - { - if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out PSPoll Failed\n")); - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); - pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG); - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); - } - } - - RTMP_SEM_LOCK(&pAd->BulkOutLock[0]); - pAd->BulkOutPending[0] = FALSE; - RTMP_SEM_UNLOCK(&pAd->BulkOutLock[0]); - - // Always call Bulk routine, even reset bulk. - // The protectioon of rest bulk should be in BulkOut routine - RTUSBKickBulkOut(pAd); - -} - - -static void rt2870_dataout_complete_tasklet(unsigned long data) -{ - PRTMP_ADAPTER pAd; - purbb_t pUrb; - POS_COOKIE pObj; - PHT_TX_CONTEXT pHTTXContext; - UCHAR BulkOutPipeId; - NTSTATUS Status; - unsigned long IrqFlags; - - - pUrb = (purbb_t)data; - pHTTXContext = (PHT_TX_CONTEXT)pUrb->context; - pAd = pHTTXContext->pAd; - pObj = (POS_COOKIE) pAd->OS_Cookie; - Status = pUrb->status; - - // Store BulkOut PipeId - BulkOutPipeId = pHTTXContext->BulkOutPipeId; - pAd->BulkOutDataOneSecCount++; - - //DBGPRINT(RT_DEBUG_LOUD, ("Done-B(%d):I=0x%lx, CWPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", BulkOutPipeId, in_interrupt(), pHTTXContext->CurWritePosition, - // pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad)); - - RTMP_IRQ_LOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); - pAd->BulkOutPending[BulkOutPipeId] = FALSE; - pHTTXContext->IRPPending = FALSE; - pAd->watchDogTxPendingCnt[BulkOutPipeId] = 0; - - if (Status == USB_ST_NOERROR) - { - pAd->BulkOutComplete++; - - RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); - - pAd->Counters8023.GoodTransmits++; - //RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); - FREE_HTTX_RING(pAd, BulkOutPipeId, pHTTXContext); - //RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); - - - } - else // STATUS_OTHER - { - PUCHAR pBuf; - - pAd->BulkOutCompleteOther++; - - pBuf = &pHTTXContext->TransferBuffer->field.WirelessPacket[pHTTXContext->NextBulkOutPosition]; - - if (!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST | - fRTMP_ADAPTER_BULKOUT_RESET))) - { - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); - pAd->bulkResetPipeid = BulkOutPipeId; - pAd->bulkResetReq[BulkOutPipeId] = pAd->BulkOutReq; - } - RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); - - DBGPRINT_RAW(RT_DEBUG_ERROR, ("BulkOutDataPacket failed: ReasonCode=%d!\n", Status)); - DBGPRINT_RAW(RT_DEBUG_ERROR, ("\t>>BulkOut Req=0x%lx, Complete=0x%lx, Other=0x%lx\n", pAd->BulkOutReq, pAd->BulkOutComplete, pAd->BulkOutCompleteOther)); - DBGPRINT_RAW(RT_DEBUG_ERROR, ("\t>>BulkOut Header:%x %x %x %x %x %x %x %x\n", pBuf[0], pBuf[1], pBuf[2], pBuf[3], pBuf[4], pBuf[5], pBuf[6], pBuf[7])); - //DBGPRINT_RAW(RT_DEBUG_ERROR, (">>BulkOutCompleteCancel=0x%x, BulkOutCompleteOther=0x%x\n", pAd->BulkOutCompleteCancel, pAd->BulkOutCompleteOther)); - - } - - // - // bInUse = TRUE, means some process are filling TX data, after that must turn on bWaitingBulkOut - // bWaitingBulkOut = TRUE, means the TX data are waiting for bulk out. - // - //RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); - if ((pHTTXContext->ENextBulkOutPosition != pHTTXContext->CurWritePosition) && - (pHTTXContext->ENextBulkOutPosition != (pHTTXContext->CurWritePosition+8)) && - !RTUSB_TEST_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_FRAG << BulkOutPipeId))) - { - // Indicate There is data avaliable - RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId)); - } - //RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); - - // Always call Bulk routine, even reset bulk. - // The protection of rest bulk should be in BulkOut routine - RTUSBKickBulkOut(pAd); -} - -/* End of 2870_rtmp_init.c */ diff --git a/drivers/staging/rt2870/common/acction.c b/drivers/staging/rt2870/common/acction.c new file mode 100644 index 000000000000..fd806c3871aa --- /dev/null +++ b/drivers/staging/rt2870/common/acction.c @@ -0,0 +1 @@ +#include "../../rt2860/common/action.c" diff --git a/drivers/staging/rt2870/common/cmm_aes.c b/drivers/staging/rt2870/common/cmm_aes.c new file mode 100644 index 000000000000..15d6a14d2d9c --- /dev/null +++ b/drivers/staging/rt2870/common/cmm_aes.c @@ -0,0 +1 @@ +#include "../../rt2860/common/cmm_aes.c" diff --git a/drivers/staging/rt2870/common/cmm_asic.c b/drivers/staging/rt2870/common/cmm_asic.c new file mode 100644 index 000000000000..38de817991ff --- /dev/null +++ b/drivers/staging/rt2870/common/cmm_asic.c @@ -0,0 +1 @@ +#include "../../rt2860/common/cmm_asic.c" diff --git a/drivers/staging/rt2870/common/cmm_cfg.c b/drivers/staging/rt2870/common/cmm_cfg.c new file mode 100644 index 000000000000..6b2bdd7d44ec --- /dev/null +++ b/drivers/staging/rt2870/common/cmm_cfg.c @@ -0,0 +1 @@ +#include "../../rt2860/common/cmm_cfg.c" diff --git a/drivers/staging/rt2870/common/cmm_data_usb.c b/drivers/staging/rt2870/common/cmm_data_usb.c new file mode 100644 index 000000000000..704675fccb7d --- /dev/null +++ b/drivers/staging/rt2870/common/cmm_data_usb.c @@ -0,0 +1 @@ +#include "../../rt2860/common/cmm_data_usb.c" diff --git a/drivers/staging/rt2870/common/cmm_mac_usb.c b/drivers/staging/rt2870/common/cmm_mac_usb.c new file mode 100644 index 000000000000..b26af4af890b --- /dev/null +++ b/drivers/staging/rt2870/common/cmm_mac_usb.c @@ -0,0 +1 @@ +#include "../../rt2860/common/cmm_mac_usb.c" diff --git a/drivers/staging/rt2870/common/cmm_profile.c b/drivers/staging/rt2870/common/cmm_profile.c new file mode 100644 index 000000000000..9926e45aba3c --- /dev/null +++ b/drivers/staging/rt2870/common/cmm_profile.c @@ -0,0 +1 @@ +#include "../../rt2860/common/cmm_profile.c" diff --git a/drivers/staging/rt2870/common/cmm_tkip.c b/drivers/staging/rt2870/common/cmm_tkip.c new file mode 100644 index 000000000000..f73c71bafe86 --- /dev/null +++ b/drivers/staging/rt2870/common/cmm_tkip.c @@ -0,0 +1 @@ +#include "../../rt2860/common/cmm_tkip.c" diff --git a/drivers/staging/rt2870/common/cmm_wep.c b/drivers/staging/rt2870/common/cmm_wep.c new file mode 100644 index 000000000000..5f681078387f --- /dev/null +++ b/drivers/staging/rt2870/common/cmm_wep.c @@ -0,0 +1 @@ +#include "../../rt2860/common/cmm_wep.c" diff --git a/drivers/staging/rt2870/common/crypt_hmac.c b/drivers/staging/rt2870/common/crypt_hmac.c new file mode 100644 index 000000000000..24d84e7724fb --- /dev/null +++ b/drivers/staging/rt2870/common/crypt_hmac.c @@ -0,0 +1 @@ +#include "../../rt2860/common/crypt_hmac.c" diff --git a/drivers/staging/rt2870/common/crypt_md5.c b/drivers/staging/rt2870/common/crypt_md5.c new file mode 100644 index 000000000000..457a2caca1e3 --- /dev/null +++ b/drivers/staging/rt2870/common/crypt_md5.c @@ -0,0 +1 @@ +#include "../../rt2860/common/crypt_md5.c" diff --git a/drivers/staging/rt2870/common/crypt_sha2.c b/drivers/staging/rt2870/common/crypt_sha2.c new file mode 100644 index 000000000000..07ffb300c193 --- /dev/null +++ b/drivers/staging/rt2870/common/crypt_sha2.c @@ -0,0 +1 @@ +#include "../../rt2860/common/crypt_sha2.c" diff --git a/drivers/staging/rt2870/common/ee_efuse.c b/drivers/staging/rt2870/common/ee_efuse.c new file mode 100644 index 000000000000..0e34e65e5f28 --- /dev/null +++ b/drivers/staging/rt2870/common/ee_efuse.c @@ -0,0 +1 @@ +#include "../../rt2860/common/ee_efuse.c" diff --git a/drivers/staging/rt2870/common/rt_channel.c b/drivers/staging/rt2870/common/rt_channel.c new file mode 100644 index 000000000000..c8ceb4c177d9 --- /dev/null +++ b/drivers/staging/rt2870/common/rt_channel.c @@ -0,0 +1 @@ +#include "../../rt2860/common/rt_channel.c" diff --git a/drivers/staging/rt2870/common/rt_rf.c b/drivers/staging/rt2870/common/rt_rf.c new file mode 100644 index 000000000000..b81cff34969b --- /dev/null +++ b/drivers/staging/rt2870/common/rt_rf.c @@ -0,0 +1 @@ +#include "../../rt2860/common/rt_rf.c" diff --git a/drivers/staging/rt2870/common/rtmp_mcu.c b/drivers/staging/rt2870/common/rtmp_mcu.c new file mode 100644 index 000000000000..20b7f13d60f8 --- /dev/null +++ b/drivers/staging/rt2870/common/rtmp_mcu.c @@ -0,0 +1 @@ +#include "../../rt2860/common/rtmp_mcu.c" diff --git a/drivers/staging/rt2870/common/rtmp_timer.c b/drivers/staging/rt2870/common/rtmp_timer.c new file mode 100644 index 000000000000..fd4aedcd5e8b --- /dev/null +++ b/drivers/staging/rt2870/common/rtmp_timer.c @@ -0,0 +1 @@ +#include "../../rt2860/common/rtmp_timer.c" diff --git a/drivers/staging/rt2870/common/rtusb_bulk.c b/drivers/staging/rt2870/common/rtusb_bulk.c index a4244b516440..82b23ae9facd 100644 --- a/drivers/staging/rt2870/common/rtusb_bulk.c +++ b/drivers/staging/rt2870/common/rtusb_bulk.c @@ -1,4 +1,4 @@ - /* +/* ************************************************************************* * Ralink Tech Inc. * 5F., No.36, Taiyuan St., Jhubei City, @@ -37,6 +37,9 @@ */ +#ifdef RTMP_MAC_USB + + #include "../rt_config.h" // Match total 6 bulkout endpoint to corresponding queue. UCHAR EpToQueue[6]={FIFO_EDCA, FIFO_EDCA, FIFO_EDCA, FIFO_EDCA, FIFO_EDCA, FIFO_MGMT}; @@ -317,11 +320,13 @@ VOID RTUSBBulkOutDataPacket( break; } - //PS packets use HCCA queue when dequeue from PS unicast queue (WiFi WPA2 MA9_DT1 for Marvell B STA) if (pTxInfo->QSEL != FIFO_EDCA) { - printk("%s(): ====> pTxInfo->QueueSel(%d)!= FIFO_EDCA!!!!\n", __func__, pTxInfo->QSEL); - printk("\tCWPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", pHTTXContext->CurWritePosition, pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad); + DBGPRINT(RT_DEBUG_ERROR, ("%s(): ====> pTxInfo->QueueSel(%d)!= FIFO_EDCA!!!!\n", + __FUNCTION__, pTxInfo->QSEL)); + DBGPRINT(RT_DEBUG_ERROR, ("\tCWPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", + pHTTXContext->CurWritePosition, pHTTXContext->NextBulkOutPosition, + pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad)); hex_dump("Wrong QSel Pkt:", (PUCHAR)&pWirelessPkt[TmpBulkEndPos], (pHTTXContext->CurWritePosition - pHTTXContext->NextBulkOutPosition)); } @@ -350,7 +355,7 @@ VOID RTUSBBulkOutDataPacket( pLastTxInfo = pTxInfo; // Make sure we use EDCA QUEUE. - pTxInfo->QSEL = FIFO_EDCA; //PS packets use HCCA queue when dequeue from PS unicast queue (WiFi WPA2 MA9_DT1 for Marvell B STA) + pTxInfo->QSEL = FIFO_EDCA; ThisBulkSize += (pTxInfo->USBDMATxPktLen+4); TmpBulkEndPos += (pTxInfo->USBDMATxPktLen+4); @@ -366,8 +371,11 @@ VOID RTUSBBulkOutDataPacket( bTxQLastRound = TRUE; pHTTXContext->ENextBulkOutPosition = 8; + break; } + + }while (TRUE); // adjust the pTxInfo->USBDMANextVLD value of last pTxInfo. @@ -481,11 +489,9 @@ VOID RTUSBBulkOutDataPacketComplete(purbb_t pUrb, struct pt_regs *pt_regs) pObj->ac3_dma_done_task.data = (unsigned long)pUrb; tasklet_hi_schedule(&pObj->ac3_dma_done_task); break; - case 4: - pObj->hcca_dma_done_task.data = (unsigned long)pUrb; - tasklet_hi_schedule(&pObj->hcca_dma_done_task); - break; } + + } @@ -933,7 +939,7 @@ VOID RTUSBKickBulkOut( } // 5. Mlme frame is next - else if ((RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_MLME)) && + else if ((RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_MLME)) || (pAd->MgmtRing.TxSwFreeIdx < MGMT_RING_SIZE)) { RTUSBBulkOutMLMEPacket(pAd, pAd->MgmtRing.TxDmaIdx); @@ -977,16 +983,6 @@ VOID RTUSBKickBulkOut( } } - //PS packets use HCCA queue when dequeue from PS unicast queue (WiFi WPA2 MA9_DT1 for Marvell B STA) - if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL_5)) - { - if (((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) || - (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - )) - { - } - } - // 7. Null frame is the last else if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NULL)) { @@ -1231,3 +1227,4 @@ VOID RTUSBCancelPendingBulkOutIRP( } } +#endif // RTMP_MAC_USB // diff --git a/drivers/staging/rt2870/common/rtusb_data.c b/drivers/staging/rt2870/common/rtusb_data.c index 6b003f63372e..807b32a69cec 100644 --- a/drivers/staging/rt2870/common/rtusb_data.c +++ b/drivers/staging/rt2870/common/rtusb_data.c @@ -36,6 +36,10 @@ Jan 03-25-2006 created */ + +#ifdef RTMP_MAC_USB + + #include "../rt_config.h" extern UCHAR Phy11BGNextRateUpward[]; // defined in mlme.c @@ -68,6 +72,26 @@ VOID REPORT_AMSDU_FRAMES_TO_LLC( } } + +/* + ======================================================================== + + Routine Description: + This subroutine will scan through releative ring descriptor to find + out avaliable free ring descriptor and compare with request size. + + Arguments: + pAd Pointer to our adapter + RingType Selected Ring + + Return Value: + NDIS_STATUS_FAILURE Not enough free descriptor + NDIS_STATUS_SUCCESS Enough free descriptor + + Note: + + ======================================================================== +*/ NDIS_STATUS RTUSBFreeDescriptorRequest( IN PRTMP_ADAPTER pAd, IN UCHAR BulkOutPipeId, @@ -193,6 +217,36 @@ VOID RTUSBRejectPendingPackets( } + +/* + ======================================================================== + + Routine Description: + Calculates the duration which is required to transmit out frames + with given size and specified rate. + + Arguments: + pTxD Pointer to transmit descriptor + Ack Setting for Ack requirement bit + Fragment Setting for Fragment bit + RetryMode Setting for retry mode + Ifs Setting for IFS gap + Rate Setting for transmit rate + Service Setting for service + Length Frame length + TxPreamble Short or Long preamble when using CCK rates + QueIdx - 0-3, according to 802.11e/d4.4 June/2003 + + Return Value: + None + + IRQL = PASSIVE_LEVEL + IRQL = DISPATCH_LEVEL + + ======================================================================== +*/ + + VOID RTMPWriteTxInfo( IN PRTMP_ADAPTER pAd, IN PTXINFO_STRUC pTxInfo, @@ -214,3 +268,4 @@ VOID RTMPWriteTxInfo( pTxInfo->rsv2 = 0; } +#endif // RTMP_MAC_USB // diff --git a/drivers/staging/rt2870/common/rtusb_io.c b/drivers/staging/rt2870/common/rtusb_io.c index 1d69590421a3..a93fde5e5725 100644 --- a/drivers/staging/rt2870/common/rtusb_io.c +++ b/drivers/staging/rt2870/common/rtusb_io.c @@ -36,6 +36,9 @@ Paul Lin 06-25-2004 created */ +#ifdef RTMP_MAC_USB + + #include "../rt_config.h" @@ -55,7 +58,7 @@ ======================================================================== */ -NTSTATUS RTUSBFirmwareRun( +static NTSTATUS RTUSBFirmwareRun( IN PRTMP_ADAPTER pAd) { NTSTATUS Status; @@ -110,48 +113,16 @@ NTSTATUS RTUSBFirmwareWrite( Status = RTUSBWriteMACRegister(pAd, 0x701c, 0xffffffff); Status = RTUSBFirmwareRun(pAd); + //2008/11/28:KH add to fix the dead rf frequency offset bug<-- RTMPusecDelay(10000); RTUSBWriteMACRegister(pAd,H2M_MAILBOX_CSR,0); - AsicSendCommandToMcu(pAd, 0x72, 0x00, 0x00, 0x00);//reset rf by MCU supported by new firmware + AsicSendCommandToMcu(pAd, 0x72, 0x00, 0x00, 0x00); //reset rf by MCU supported by new firmware + //2008/11/28:KH add to fix the dead rf frequency offset bug--> return Status; } -/* - ======================================================================== - - Routine Description: Get current firmware operation mode (Return Value) - - Arguments: - - Return Value: - 0 or 1 = Downloaded by host driver - others = Driver doesn't download firmware - - IRQL = - - Note: - - ======================================================================== -*/ -NTSTATUS RTUSBFirmwareOpmode( - IN PRTMP_ADAPTER pAd, - OUT PUINT32 pValue) -{ - NTSTATUS Status; - - Status = RTUSB_VendorRequest( - pAd, - (USBD_TRANSFER_DIRECTION_IN | USBD_SHORT_TRANSFER_OK), - DEVICE_VENDOR_REQUEST_IN, - 0x1, - 0x11, - 0, - pValue, - 4); - return Status; -} NTSTATUS RTUSBVenderReset( IN PRTMP_ADAPTER pAd) { @@ -312,7 +283,7 @@ NTSTATUS RTUSBReadMACRegister( IN USHORT Offset, OUT PUINT32 pValue) { - NTSTATUS Status; + NTSTATUS Status = 0; UINT32 localVal; Status = RTUSB_VendorRequest( @@ -368,7 +339,6 @@ NTSTATUS RTUSBWriteMACRegister( -#if 1 /* ======================================================================== @@ -402,10 +372,9 @@ NTSTATUS RTUSBReadBBPRegister( if (!(BbpCsr.field.Busy == BUSY)) break; } - printk("RTUSBReadBBPRegister(BBP_CSR_CFG_1):retry count=%d!\n", i); + DBGPRINT(RT_DEBUG_TRACE, ("RTUSBReadBBPRegister(BBP_CSR_CFG_1):retry count=%d!\n", i)); i++; - } - while ((i < RETRY_LIMIT) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); + }while ((i < RETRY_LIMIT) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); if ((i == RETRY_LIMIT) || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) { @@ -438,10 +407,9 @@ NTSTATUS RTUSBReadBBPRegister( break; } } - printk("RTUSBReadBBPRegister(BBP_CSR_CFG_2):retry count=%d!\n", i); + DBGPRINT(RT_DEBUG_TRACE, ("RTUSBReadBBPRegister(BBP_CSR_CFG_2):retry count=%d!\n", i)); i++; - } - while ((i < RETRY_LIMIT) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); + }while ((i < RETRY_LIMIT) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); if ((i == RETRY_LIMIT) || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) { @@ -456,67 +424,8 @@ NTSTATUS RTUSBReadBBPRegister( return STATUS_SUCCESS; } -#else -/* - ======================================================================== - - Routine Description: Read 8-bit BBP register via firmware - - Arguments: - - Return Value: - - IRQL = - Note: - ======================================================================== -*/ -NTSTATUS RTUSBReadBBPRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR Id, - IN PUCHAR pValue) -{ - BBP_CSR_CFG_STRUC BbpCsr; - int i, k; - for (i=0; iBbpWriteLatch[Id]; - return STATUS_UNSUCCESSFUL; - } - return STATUS_SUCCESS; -} -#endif - -#if 1 /* ======================================================================== @@ -549,7 +458,7 @@ NTSTATUS RTUSBWriteBBPRegister( if (!(BbpCsr.field.Busy == BUSY)) break; } - printk("RTUSBWriteBBPRegister(BBP_CSR_CFG):retry count=%d!\n", i); + DBGPRINT(RT_DEBUG_TRACE, ("RTUSBWriteBBPRegister(BBP_CSR_CFG):retry count=%d!\n", i)); i++; } while ((i < RETRY_LIMIT) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); @@ -572,55 +481,6 @@ NTSTATUS RTUSBWriteBBPRegister( return STATUS_SUCCESS; } -#else -/* - ======================================================================== - - Routine Description: Write 8-bit BBP register via firmware - - Arguments: - - Return Value: - - IRQL = - - Note: - - ======================================================================== -*/ - -NTSTATUS RTUSBWriteBBPRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR Id, - IN UCHAR Value) - -{ - BBP_CSR_CFG_STRUC BbpCsr; - int BusyCnt; - for (BusyCnt=0; BusyCntBbpWriteLatch[Id] = Value; - break; - } - if (BusyCnt == MAX_BUSY_COUNT) - { - DBGPRINT_ERR(("BBP write R%d=0x%x fail\n", Id, BbpCsr.word)); - return STATUS_UNSUCCESSFUL; - } - return STATUS_SUCCESS; -} -#endif /* ======================================================================== @@ -653,7 +513,7 @@ NTSTATUS RTUSBWriteRFRegister( if (!(PhyCsr4.field.Busy)) break; } - printk("RTUSBWriteRFRegister(RF_CSR_CFG0):retry count=%d!\n", i); + DBGPRINT(RT_DEBUG_TRACE, ("RTUSBWriteRFRegister(RF_CSR_CFG0):retry count=%d!\n", i)); i++; } while ((i < RETRY_LIMIT) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); @@ -669,114 +529,6 @@ NTSTATUS RTUSBWriteRFRegister( return STATUS_SUCCESS; } -/* - ======================================================================== - - Routine Description: Write RT30xx RF register through MAC - - Arguments: - - Return Value: - - IRQL = - - Note: - - ======================================================================== -*/ -NTSTATUS RT30xxWriteRFRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR RegID, - IN UCHAR Value) -{ - RF_CSR_CFG_STRUC rfcsr; - UINT i = 0; - - do - { - RTMP_IO_READ32(pAd, RF_CSR_CFG, &rfcsr.word); - - if (!rfcsr.field.RF_CSR_KICK) - break; - i++; - } - while ((i < RETRY_LIMIT) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); - - if ((i == RETRY_LIMIT) || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("Retry count exhausted or device removed!!!\n")); - return STATUS_UNSUCCESSFUL; - } - - rfcsr.field.RF_CSR_WR = 1; - rfcsr.field.RF_CSR_KICK = 1; - rfcsr.field.TESTCSR_RFACC_REGNUM = RegID; - rfcsr.field.RF_CSR_DATA = Value; - - RTMP_IO_WRITE32(pAd, RF_CSR_CFG, rfcsr.word); - - return STATUS_SUCCESS; -} - - -/* - ======================================================================== - - Routine Description: Read RT30xx RF register through MAC - - Arguments: - - Return Value: - - IRQL = - - Note: - - ======================================================================== -*/ -NTSTATUS RT30xxReadRFRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR RegID, - IN PUCHAR pValue) -{ - RF_CSR_CFG_STRUC rfcsr; - UINT i=0, k=0; - - for (i=0; ibUseEfuse) - Status =eFuseRead(pAd, Offset, pData, length); - else - { Status = RTUSB_VendorRequest( pAd, (USBD_TRANSFER_DIRECTION_IN | USBD_SHORT_TRANSFER_OK), @@ -814,7 +562,6 @@ NTSTATUS RTUSBReadEEPROM( Offset, pData, length); - } return Status; } @@ -842,10 +589,6 @@ NTSTATUS RTUSBWriteEEPROM( { NTSTATUS Status = STATUS_SUCCESS; - if(pAd->bUseEfuse) - Status = eFuseWrite(pAd, Offset, pData, length); - else - { Status = RTUSB_VendorRequest( pAd, USBD_TRANSFER_DIRECTION_OUT, @@ -855,11 +598,38 @@ NTSTATUS RTUSBWriteEEPROM( Offset, pData, length); - } return Status; } + +NTSTATUS RTUSBReadEEPROM16( + IN PRTMP_ADAPTER pAd, + IN USHORT offset, + OUT PUSHORT pData) +{ + NTSTATUS status; + USHORT localData; + + status = RTUSBReadEEPROM(pAd, offset, (PUCHAR)(&localData), 2); + if (status == STATUS_SUCCESS) + *pData = le2cpu16(localData); + + return status; + +} + +NTSTATUS RTUSBWriteEEPROM16( + IN RTMP_ADAPTER *pAd, + IN USHORT offset, + IN USHORT value) +{ + USHORT tmpVal; + + tmpVal = cpu2le16(value); + return RTUSBWriteEEPROM(pAd, offset, (PUCHAR)&(tmpVal), 2); +} + /* ======================================================================== @@ -943,7 +713,7 @@ VOID RTUSBInitializeCmdQ( cmdq->head = NULL; cmdq->tail = NULL; cmdq->size = 0; - cmdq->CmdQState = RT2870_THREAD_INITED; + cmdq->CmdQState = RTMP_TASK_STAT_INITED; } /* @@ -970,19 +740,26 @@ NDIS_STATUS RTUSBEnqueueCmdFromNdis( { NDIS_STATUS status; PCmdQElmt cmdqelmt = NULL; - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + RTMP_OS_TASK *pTask = &pAd->cmdQTask; - if (pid_nr(pObj->RTUSBCmdThr_pid) > 0) +#ifdef KTHREAD_SUPPORT + if (pTask->kthread_task == NULL) +#else + CHECK_PID_LEGALITY(pTask->taskPID) + { + } + else +#endif return (NDIS_STATUS_RESOURCES); - status = RTMPAllocateMemory((PVOID *)&cmdqelmt, sizeof(CmdQElmt)); + status = os_alloc_mem(pAd, (PUCHAR *)(&cmdqelmt), sizeof(CmdQElmt)); if ((status != NDIS_STATUS_SUCCESS) || (cmdqelmt == NULL)) return (NDIS_STATUS_RESOURCES); cmdqelmt->buffer = NULL; if (pInformationBuffer != NULL) { - status = RTMPAllocateMemory((PVOID *)&cmdqelmt->buffer, InformationBufferLength); + status = os_alloc_mem(pAd, (PUCHAR *)&cmdqelmt->buffer, InformationBufferLength); if ((status != NDIS_STATUS_SUCCESS) || (cmdqelmt->buffer == NULL)) { kfree(cmdqelmt); @@ -1005,7 +782,7 @@ NDIS_STATUS RTUSBEnqueueCmdFromNdis( cmdqelmt->SetOperation = FALSE; NdisAcquireSpinLock(&pAd->CmdQLock); - if (pAd->CmdQ.CmdQState & RT2870_THREAD_CAN_DO_INSERT) + if (pAd->CmdQ.CmdQState & RTMP_TASK_CAN_DO_INSERT) { EnqueueCmd((&pAd->CmdQ), cmdqelmt); status = NDIS_STATUS_SUCCESS; @@ -1019,8 +796,8 @@ NDIS_STATUS RTUSBEnqueueCmdFromNdis( if (status == NDIS_STATUS_FAILURE) { if (cmdqelmt->buffer) - NdisFreeMemory(cmdqelmt->buffer, cmdqelmt->bufferlength, 0); - NdisFreeMemory(cmdqelmt, sizeof(CmdQElmt), 0); + os_free_mem(pAd, cmdqelmt->buffer); + os_free_mem(pAd, cmdqelmt); } else RTUSBCMDUp(pAd); @@ -1054,17 +831,17 @@ NDIS_STATUS RTUSBEnqueueInternalCmd( PCmdQElmt cmdqelmt = NULL; - status = RTMPAllocateMemory((PVOID *)&cmdqelmt, sizeof(CmdQElmt)); + status = os_alloc_mem(pAd, (PUCHAR *)&cmdqelmt, sizeof(CmdQElmt)); if ((status != NDIS_STATUS_SUCCESS) || (cmdqelmt == NULL)) return (NDIS_STATUS_RESOURCES); NdisZeroMemory(cmdqelmt, sizeof(CmdQElmt)); if(InformationBufferLength > 0) { - status = RTMPAllocateMemory((PVOID *)&cmdqelmt->buffer, InformationBufferLength); + status = os_alloc_mem(pAd, (PUCHAR *)&cmdqelmt->buffer, InformationBufferLength); if ((status != NDIS_STATUS_SUCCESS) || (cmdqelmt->buffer == NULL)) { - NdisFreeMemory(cmdqelmt, sizeof(CmdQElmt), 0); + os_free_mem(pAd, cmdqelmt); return (NDIS_STATUS_RESOURCES); } else @@ -1085,7 +862,7 @@ NDIS_STATUS RTUSBEnqueueInternalCmd( if (cmdqelmt != NULL) { NdisAcquireSpinLock(&pAd->CmdQLock); - if (pAd->CmdQ.CmdQState & RT2870_THREAD_CAN_DO_INSERT) + if (pAd->CmdQ.CmdQState & RTMP_TASK_CAN_DO_INSERT) { EnqueueCmd((&pAd->CmdQ), cmdqelmt); status = NDIS_STATUS_SUCCESS; @@ -1099,8 +876,8 @@ NDIS_STATUS RTUSBEnqueueInternalCmd( if (status == NDIS_STATUS_FAILURE) { if (cmdqelmt->buffer) - NdisFreeMemory(cmdqelmt->buffer, cmdqelmt->bufferlength, 0); - NdisFreeMemory(cmdqelmt, sizeof(CmdQElmt), 0); + os_free_mem(pAd, cmdqelmt->buffer); + os_free_mem(pAd, cmdqelmt); } else RTUSBCMDUp(pAd); @@ -1185,7 +962,7 @@ NTSTATUS RTUSB_VendorRequest( IN PVOID TransferBuffer, IN UINT32 TransferBufferLength) { - int ret; + int ret = 0; POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) @@ -1206,7 +983,18 @@ NTSTATUS RTUSB_VendorRequest( int retryCount = 0; void *tmpBuf = TransferBuffer; - // Acquire Control token + ret = down_interruptible(&(pAd->UsbVendorReq_semaphore)); + if (pAd->UsbVendorReqBuf) + { + ASSERT(TransferBufferLength UsbVendorReqBuf; + NdisZeroMemory(pAd->UsbVendorReqBuf, TransferBufferLength); + + if (RequestType == DEVICE_VENDOR_REQUEST_OUT) + NdisMoveMemory(tmpBuf, TransferBuffer, TransferBufferLength); + } + do { if( RequestType == DEVICE_VENDOR_REQUEST_OUT) ret=usb_control_msg(pObj->pUsb_Dev, usb_sndctrlpipe( pObj->pUsb_Dev, 0 ), Request, RequestType, Value,Index, tmpBuf, TransferBufferLength, CONTROL_TIMEOUT_JIFFIES); @@ -1220,13 +1008,16 @@ NTSTATUS RTUSB_VendorRequest( retryCount++; if (ret < 0) { - printk("#\n"); + DBGPRINT(RT_DEBUG_OFF, ("#\n")); RTMPusecDelay(5000); } } while((ret < 0) && (retryCount < MAX_RETRY_COUNT)); + if ((pAd->UsbVendorReqBuf) && (RequestType == DEVICE_VENDOR_REQUEST_IN)) + NdisMoveMemory(TransferBuffer, tmpBuf, TransferBufferLength); + up(&(pAd->UsbVendorReq_semaphore)); + if (ret < 0) { -// DBGPRINT(RT_DEBUG_ERROR, ("USBVendorRequest failed ret=%d \n",ret)); DBGPRINT(RT_DEBUG_ERROR, ("RTUSB_VendorRequest failed(%d),TxFlags=0x%x, ReqType=%s, Req=0x%x, Index=0x%x\n", ret, TransferFlags, (RequestType == DEVICE_VENDOR_REQUEST_OUT ? "OUT" : "IN"), Request, Index)); if (Request == 0x2) @@ -1235,8 +1026,14 @@ NTSTATUS RTUSB_VendorRequest( if ((TransferBuffer!= NULL) && (TransferBufferLength > 0)) hex_dump("Failed TransferBuffer value", TransferBuffer, TransferBufferLength); } + + } - return ret; + + if (ret != -1) + return STATUS_SUCCESS; + else + return STATUS_UNSUCCESSFUL; } /* @@ -1275,7 +1072,7 @@ VOID CMDHandler( NTSTATUS ntStatus; // unsigned long IrqFlags; - while (pAd->CmdQ.size > 0) + while (pAd && pAd->CmdQ.size > 0) { NdisStatus = NDIS_STATUS_SUCCESS; @@ -1410,8 +1207,6 @@ VOID CMDHandler( //NdisReleaseSpinLock(&pAd->BulkOutLock[pAd->bulkResetPipeid]); RTMP_INT_UNLOCK(&pAd->BulkOutLock[pAd->bulkResetPipeid], IrqFlags); -/*-----------------------------------------------------------------------------------------------*/ -/*-----------------------------------------------------------------------------------------------*/ { RTUSBInitHTTxDesc(pAd, pHTTXContext, pAd->bulkResetPipeid, pHTTXContext->BulkOutSize, (usb_complete_t)RTUSBBulkOutDataPacketComplete); @@ -1522,8 +1317,7 @@ VOID CMDHandler( // All transfers must be aborted or cancelled before attempting to reset the pipe. { UINT32 MACValue; -/*-----------------------------------------------------------------------------------------------*/ -/*-----------------------------------------------------------------------------------------------*/ + { //while ((atomic_read(&pAd->PendingRx) > 0) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) if((pAd->PendingRx > 0) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) @@ -1612,6 +1406,8 @@ VOID CMDHandler( } else { // success + //DBGPRINT(RT_DEBUG_TRACE, ("BIDone, Pend=%d,BIIdx=%d,BIRIdx=%d!\n", + // pAd->PendingRx, pAd->NextRxBulkInIndex, pAd->NextRxBulkInReadIndex)); DBGPRINT_RAW(RT_DEBUG_TRACE, ("CMDTHREAD_RESET_BULK_IN: Submit Rx URB Done, status=%d!\n", pUrb->status)); ASSERT((pRxContext->InUse == pRxContext->IRPPending)); } @@ -1722,6 +1518,40 @@ VOID CMDHandler( } } break; + +//Benson modified for USB interface, avoid in interrupt when write key, 20080724 --> + case RT_CMD_SET_KEY_TABLE: //General call for AsicAddPairwiseKeyEntry() + { + RT_ADD_PAIRWISE_KEY_ENTRY KeyInfo; + KeyInfo = *((PRT_ADD_PAIRWISE_KEY_ENTRY)(pData)); + AsicAddPairwiseKeyEntry(pAd, + KeyInfo.MacAddr, + (UCHAR)KeyInfo.MacTabMatchWCID, + &KeyInfo.CipherKey); + } + break; + + case RT_CMD_SET_RX_WCID_TABLE: //General call for RTMPAddWcidAttributeEntry() + { + PMAC_TABLE_ENTRY pEntry ; + UCHAR KeyIdx = 0; + UCHAR CipherAlg = CIPHER_NONE; + UCHAR ApIdx = BSS0; + + pEntry = (PMAC_TABLE_ENTRY)(pData); + + + + RTMPAddWcidAttributeEntry( + pAd, + ApIdx, + KeyIdx, + CipherAlg, + pEntry); + } + break; +//Benson modified for USB interface, avoid in interrupt when write key, 20080724 <-- + case CMDTHREAD_SET_CLIENT_MAC_ENTRY: { MAC_TABLE_ENTRY *pEntry; @@ -1731,7 +1561,7 @@ VOID CMDHandler( AsicRemovePairwiseKeyEntry(pAd, pEntry->apidx, (UCHAR)pEntry->Aid); if ((pEntry->AuthMode <= Ndis802_11AuthModeAutoSwitch) && (pEntry->WepStatus == Ndis802_11Encryption1Enabled)) { - UINT32 uIV = 0; + UINT32 uIV = 1; PUCHAR ptr; ptr = (PUCHAR) &uIV; @@ -1741,7 +1571,7 @@ VOID CMDHandler( } else if (pEntry->AuthMode == Ndis802_11AuthModeWPANone) { - UINT32 uIV = 0; + UINT32 uIV = 1; PUCHAR ptr; ptr = (PUCHAR) &uIV; @@ -1763,15 +1593,19 @@ VOID CMDHandler( } AsicUpdateRxWCIDTable(pAd, pEntry->Aid, pEntry->Addr); - printk("UpdateRxWCIDTable(): Aid=%d, Addr=%02x:%02x:%02x:%02x:%02x:%02x!\n", pEntry->Aid, - pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2], pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]); + DBGPRINT(RT_DEBUG_TRACE, ("UpdateRxWCIDTable(): Aid=%d, Addr=%02x:%02x:%02x:%02x:%02x:%02x!\n", pEntry->Aid, + pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2], pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5])); } break; + +// add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet case CMDTHREAD_UPDATE_PROTECT: { AsicUpdateProtect(pAd, 0, (ALLN_SETPROTECT), TRUE, 0); } break; +// end johnli + case OID_802_11_ADD_WEP: { UINT i; @@ -1852,6 +1686,25 @@ VOID CMDHandler( case CMDTHREAD_802_11_COUNTER_MEASURE: break; + + case CMDTHREAD_SET_GROUP_KEY: + WpaStaGroupKeySetting(pAd); + break; + + case CMDTHREAD_SET_PAIRWISE_KEY: + WpaStaPairwiseKeySetting(pAd); + break; + + case CMDTHREAD_SET_PSM_BIT: + { + USHORT *pPsm = (USHORT *)pData; + MlmeSetPsmBit(pAd, *pPsm); + } + break; + case CMDTHREAD_FORCE_WAKE_UP: + AsicForceWakeup(pAd, TRUE); + break; + default: DBGPRINT(RT_DEBUG_ERROR, ("--> Control Thread !! ERROR !! Unknown(cmdqelmt->command=0x%x) !! \n", cmdqelmt->command)); break; @@ -1861,18 +1714,16 @@ VOID CMDHandler( if (cmdqelmt->CmdFromNdis == TRUE) { if (cmdqelmt->buffer != NULL) - NdisFreeMemory(cmdqelmt->buffer, cmdqelmt->bufferlength, 0); - - NdisFreeMemory(cmdqelmt, sizeof(CmdQElmt), 0); + os_free_mem(pAd, cmdqelmt->buffer); + os_free_mem(pAd, cmdqelmt); } else { if ((cmdqelmt->buffer != NULL) && (cmdqelmt->bufferlength != 0)) - NdisFreeMemory(cmdqelmt->buffer, cmdqelmt->bufferlength, 0); - { - NdisFreeMemory(cmdqelmt, sizeof(CmdQElmt), 0); - } + os_free_mem(pAd, cmdqelmt->buffer); + os_free_mem(pAd, cmdqelmt); } } /* end of while */ } +#endif // RTMP_MAC_USB // diff --git a/drivers/staging/rt2870/rt2870.h b/drivers/staging/rt2870/rt2870.h deleted file mode 100644 index 4c67bafad4e6..000000000000 --- a/drivers/staging/rt2870/rt2870.h +++ /dev/null @@ -1,583 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - */ - -#ifndef __RT2870_H__ -#define __RT2870_H__ - -//usb header files -#include - -/* rtmp_def.h */ -// -#define BULKAGGRE_ZISE 100 -#define RT28XX_DRVDATA_SET(_a) usb_set_intfdata(_a, pAd); -#define RT28XX_PUT_DEVICE usb_put_dev -#define RTUSB_ALLOC_URB(iso) usb_alloc_urb(iso, GFP_ATOMIC) -#define RTUSB_SUBMIT_URB(pUrb) usb_submit_urb(pUrb, GFP_ATOMIC) -#define RTUSB_URB_ALLOC_BUFFER(pUsb_Dev, BufSize, pDma_addr) usb_buffer_alloc(pUsb_Dev, BufSize, GFP_ATOMIC, pDma_addr) -#define RTUSB_URB_FREE_BUFFER(pUsb_Dev, BufSize, pTransferBuf, Dma_addr) usb_buffer_free(pUsb_Dev, BufSize, pTransferBuf, Dma_addr) - -#define RXBULKAGGRE_ZISE 12 -#define MAX_TXBULK_LIMIT (LOCAL_TXBUF_SIZE*(BULKAGGRE_ZISE-1)) -#define MAX_TXBULK_SIZE (LOCAL_TXBUF_SIZE*BULKAGGRE_ZISE) -#define MAX_RXBULK_SIZE (LOCAL_TXBUF_SIZE*RXBULKAGGRE_ZISE) -#define MAX_MLME_HANDLER_MEMORY 20 -#define RETRY_LIMIT 10 -#define BUFFER_SIZE 2400 //2048 -#define TX_RING 0xa -#define PRIO_RING 0xc - - -// Flags for Bulkflags control for bulk out data -// -#define fRTUSB_BULK_OUT_DATA_NULL 0x00000001 -#define fRTUSB_BULK_OUT_RTS 0x00000002 -#define fRTUSB_BULK_OUT_MLME 0x00000004 - -#define fRTUSB_BULK_OUT_DATA_NORMAL 0x00010000 -#define fRTUSB_BULK_OUT_DATA_NORMAL_2 0x00020000 -#define fRTUSB_BULK_OUT_DATA_NORMAL_3 0x00040000 -#define fRTUSB_BULK_OUT_DATA_NORMAL_4 0x00080000 -#define fRTUSB_BULK_OUT_DATA_NORMAL_5 0x00100000 - -#define fRTUSB_BULK_OUT_PSPOLL 0x00000020 -#define fRTUSB_BULK_OUT_DATA_FRAG 0x00000040 -#define fRTUSB_BULK_OUT_DATA_FRAG_2 0x00000080 -#define fRTUSB_BULK_OUT_DATA_FRAG_3 0x00000100 -#define fRTUSB_BULK_OUT_DATA_FRAG_4 0x00000200 - -#define FREE_HTTX_RING(_p, _b, _t) \ -{ \ - if ((_t)->ENextBulkOutPosition == (_t)->CurWritePosition) \ - { \ - (_t)->bRingEmpty = TRUE; \ - } \ - /*NdisInterlockedDecrement(&(_p)->TxCount); */\ -} - -// -// RXINFO appends at the end of each rx packet. -// -typedef struct PACKED _RXINFO_STRUC { - UINT32 BA:1; - UINT32 DATA:1; - UINT32 NULLDATA:1; - UINT32 FRAG:1; - UINT32 U2M:1; // 1: this RX frame is unicast to me - UINT32 Mcast:1; // 1: this is a multicast frame - UINT32 Bcast:1; // 1: this is a broadcast frame - UINT32 MyBss:1; // 1: this frame belongs to the same BSSID - UINT32 Crc:1; // 1: CRC error - UINT32 CipherErr:2; // 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid - UINT32 AMSDU:1; // rx with 802.3 header, not 802.11 header. - UINT32 HTC:1; - UINT32 RSSI:1; - UINT32 L2PAD:1; - UINT32 AMPDU:1; // To be moved - UINT32 Decrypted:1; - UINT32 PlcpRssil:1; - UINT32 CipherAlg:1; - UINT32 LastAMSDU:1; - UINT32 PlcpSignal:12; -} RXINFO_STRUC, *PRXINFO_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC; - -// -// TXINFO -// -typedef struct _TXINFO_STRUC { - // Word 0 - UINT32 USBDMATxPktLen:16; //used ONLY in USB bulk Aggregation, Total byte counts of all sub-frame. - UINT32 rsv:8; - UINT32 WIV:1; // Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition - UINT32 QSEL:2; // select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA - UINT32 SwUseLastRound:1; // Software use. - UINT32 rsv2:2; // Software use. - UINT32 USBDMANextVLD:1; //used ONLY in USB bulk Aggregation, NextValid - UINT32 USBDMATxburst:1;//used ONLY in USB bulk Aggre. Force USB DMA transmit frame from current selected endpoint -} TXINFO_STRUC, *PTXINFO_STRUC; - -#define TXINFO_SIZE 4 -#define RXINFO_SIZE 4 -#define TXPADDING_SIZE 11 - -// -// Management ring buffer format -// -typedef struct _MGMT_STRUC { - BOOLEAN Valid; - PUCHAR pBuffer; - ULONG Length; -} MGMT_STRUC, *PMGMT_STRUC; - - -/* ----------------- EEPROM Related MACRO ----------------- */ -#define RT28xx_EEPROM_READ16(pAd, offset, var) \ - do { \ - RTUSBReadEEPROM(pAd, offset, (PUCHAR)&(var), 2); \ - if(!pAd->bUseEfuse) \ - var = le2cpu16(var); \ - }while(0) - -#define RT28xx_EEPROM_WRITE16(pAd, offset, var) \ - do{ \ - USHORT _tmpVar=var; \ - if(!pAd->bUseEfuse) \ - _tmpVar = cpu2le16(var); \ - RTUSBWriteEEPROM(pAd, offset, (PUCHAR)&(_tmpVar), 2); \ - }while(0) - -/* ----------------- TASK/THREAD Related MACRO ----------------- */ -#define RT28XX_TASK_THREAD_INIT(pAd, Status) \ - Status = CreateThreads(net_dev); - - -/* ----------------- Frimware Related MACRO ----------------- */ -#define RT28XX_WRITE_FIRMWARE(_pAd, _pFwImage, _FwLen) \ - RTUSBFirmwareWrite(_pAd, _pFwImage, _FwLen) - -/* ----------------- TX Related MACRO ----------------- */ -#define RT28XX_START_DEQUEUE(pAd, QueIdx, irqFlags) \ - { \ - RTMP_IRQ_LOCK(&pAd->DeQueueLock[QueIdx], irqFlags); \ - if (pAd->DeQueueRunning[QueIdx]) \ - { \ - RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags);\ - printk("DeQueueRunning[%d]= TRUE!\n", QueIdx); \ - continue; \ - } \ - else \ - { \ - pAd->DeQueueRunning[QueIdx] = TRUE; \ - RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags);\ - } \ - } -#define RT28XX_STOP_DEQUEUE(pAd, QueIdx, irqFlags) \ - do{ \ - RTMP_IRQ_LOCK(&pAd->DeQueueLock[QueIdx], irqFlags); \ - pAd->DeQueueRunning[QueIdx] = FALSE; \ - RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags); \ - }while(0) - - -#define RT28XX_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, freeNum, pPacket) \ - (RTUSBFreeDescriptorRequest(pAd, pTxBlk->QueIdx, (pTxBlk->TotalFrameLen + GET_OS_PKT_LEN(pPacket))) == NDIS_STATUS_SUCCESS) - -#define RT28XX_RELEASE_DESC_RESOURCE(pAd, QueIdx) \ - do{}while(0) - -#define NEED_QUEUE_BACK_FOR_AGG(_pAd, _QueIdx, _freeNum, _TxFrameType) \ - ((_TxFrameType == TX_RALINK_FRAME) && (RTUSBNeedQueueBackForAgg(_pAd, _QueIdx))) - - - -#define fRTMP_ADAPTER_NEED_STOP_TX \ - (fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_HALT_IN_PROGRESS | \ - fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_BULKOUT_RESET | \ - fRTMP_ADAPTER_RADIO_OFF | fRTMP_ADAPTER_REMOVE_IN_PROGRESS) - - -#define HAL_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) \ - RtmpUSB_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) - -#define HAL_WriteTxResource(pAd, pTxBlk,bIsLast, pFreeNumber) \ - RtmpUSB_WriteSingleTxResource(pAd, pTxBlk,bIsLast, pFreeNumber) - -#define HAL_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber) \ - RtmpUSB_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber) - -#define HAL_WriteMultiTxResource(pAd, pTxBlk,frameNum, pFreeNumber) \ - RtmpUSB_WriteMultiTxResource(pAd, pTxBlk,frameNum, pFreeNumber) - -#define HAL_FinalWriteTxResource(pAd, pTxBlk, totalMPDUSize, TxIdx) \ - RtmpUSB_FinalWriteTxResource(pAd, pTxBlk, totalMPDUSize, TxIdx) - -#define HAL_LastTxIdx(pAd, QueIdx,TxIdx) \ - /*RtmpUSBDataLastTxIdx(pAd, QueIdx,TxIdx)*/ - -#define HAL_KickOutTx(pAd, pTxBlk, QueIdx) \ - RtmpUSBDataKickOut(pAd, pTxBlk, QueIdx) - - -#define HAL_KickOutMgmtTx(pAd, QueIdx, pPacket, pSrcBufVA, SrcBufLen) \ - RtmpUSBMgmtKickOut(pAd, QueIdx, pPacket, pSrcBufVA, SrcBufLen) - -#define HAL_KickOutNullFrameTx(_pAd, _QueIdx, _pNullFrame, _frameLen) \ - RtmpUSBNullFrameKickOut(_pAd, _QueIdx, _pNullFrame, _frameLen) - -#define RTMP_PKT_TAIL_PADDING 11 // 3(max 4 byte padding) + 4 (last packet padding) + 4 (MaxBulkOutsize align padding) - -extern UCHAR EpToQueue[6]; - - -#ifdef RT2870 -#define GET_TXRING_FREENO(_pAd, _QueIdx) (_QueIdx) //(_pAd->TxRing[_QueIdx].TxSwFreeIdx) -#define GET_MGMTRING_FREENO(_pAd) (_pAd->MgmtRing.TxSwFreeIdx) -#endif // RT2870 // - - -/* ----------------- RX Related MACRO ----------------- */ -//#define RT28XX_RX_ERROR_CHECK RTMPCheckRxWI - -#define RT28XX_RV_ALL_BUF_END(bBulkReceive) \ - /* We return STATUS_MORE_PROCESSING_REQUIRED so that the completion */ \ - /* routine (IofCompleteRequest) will stop working on the irp. */ \ - if (bBulkReceive == TRUE) RTUSBBulkReceive(pAd); - - -/* ----------------- ASIC Related MACRO ----------------- */ - -// reset MAC of a station entry to 0xFFFFFFFFFFFF -#define RT28XX_STA_ENTRY_MAC_RESET(pAd, Wcid) \ - { RT_SET_ASIC_WCID SetAsicWcid; \ - SetAsicWcid.WCID = Wcid; \ - SetAsicWcid.SetTid = 0xffffffff; \ - SetAsicWcid.DeleteTid = 0xffffffff; \ - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_ASIC_WCID, \ - &SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); } - -// add this entry into ASIC RX WCID search table -#define RT28XX_STA_ENTRY_ADD(pAd, pEntry) \ - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_CLIENT_MAC_ENTRY, \ - pEntry, sizeof(MAC_TABLE_ENTRY)); - -// remove Pair-wise key material from ASIC -// yet implement -#define RT28XX_STA_ENTRY_KEY_DEL(pAd, BssIdx, Wcid) - -// add Client security information into ASIC WCID table and IVEIV table -#define RT28XX_STA_SECURITY_INFO_ADD(pAd, apidx, KeyID, pEntry) \ - { RT28XX_STA_ENTRY_MAC_RESET(pAd, pEntry->Aid); \ - if (pEntry->Aid >= 1) { \ - RT_SET_ASIC_WCID_ATTRI SetAsicWcidAttri; \ - SetAsicWcidAttri.WCID = pEntry->Aid; \ - if ((pEntry->AuthMode <= Ndis802_11AuthModeAutoSwitch) && \ - (pEntry->WepStatus == Ndis802_11Encryption1Enabled)) \ - { \ - SetAsicWcidAttri.Cipher = pAd->SharedKey[apidx][KeyID].CipherAlg; \ - } \ - else if (pEntry->AuthMode == Ndis802_11AuthModeWPANone) \ - { \ - SetAsicWcidAttri.Cipher = pAd->SharedKey[apidx][KeyID].CipherAlg; \ - } \ - else SetAsicWcidAttri.Cipher = 0; \ - DBGPRINT(RT_DEBUG_TRACE, ("aid cipher = %ld\n",SetAsicWcidAttri.Cipher)); \ - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_ASIC_WCID_CIPHER, \ - &SetAsicWcidAttri, sizeof(RT_SET_ASIC_WCID_ATTRI)); } } - -// Insert the BA bitmap to ASIC for the Wcid entry -#define RT28XX_ADD_BA_SESSION_TO_ASIC(_pAd, _Aid, _TID) \ - do{ \ - RT_SET_ASIC_WCID SetAsicWcid; \ - SetAsicWcid.WCID = (_Aid); \ - SetAsicWcid.SetTid = (0x10000<<(_TID)); \ - SetAsicWcid.DeleteTid = 0xffffffff; \ - RTUSBEnqueueInternalCmd((_pAd), CMDTHREAD_SET_ASIC_WCID, &SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); \ - }while(0) - -// Remove the BA bitmap from ASIC for the Wcid entry -#define RT28XX_DEL_BA_SESSION_FROM_ASIC(_pAd, _Wcid, _TID) \ - do{ \ - RT_SET_ASIC_WCID SetAsicWcid; \ - SetAsicWcid.WCID = (_Wcid); \ - SetAsicWcid.SetTid = (0xffffffff); \ - SetAsicWcid.DeleteTid = (0x10000<<(_TID) ); \ - RTUSBEnqueueInternalCmd((_pAd), CMDTHREAD_SET_ASIC_WCID, &SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); \ - }while(0) - - -/* ----------------- PCI/USB Related MACRO ----------------- */ -#define RT28XX_HANDLE_DEV_ASSIGN(handle, dev_p) \ - ((POS_COOKIE)handle)->pUsb_Dev = dev_p; - -// no use -#define RT28XX_UNMAP() -#define RT28XX_IRQ_REQUEST(net_dev) -#define RT28XX_IRQ_RELEASE(net_dev) -#define RT28XX_IRQ_INIT(pAd) -#define RT28XX_IRQ_ENABLE(pAd) - - -/* ----------------- MLME Related MACRO ----------------- */ -#define RT28XX_MLME_HANDLER(pAd) RTUSBMlmeUp(pAd) - -#define RT28XX_MLME_PRE_SANITY_CHECK(pAd) \ - { if ((pAd->CommonCfg.bHardwareRadio == TRUE) && \ - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && \ - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS))) { \ - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_CHECK_GPIO, NULL, 0); } } - -#define RT28XX_MLME_STA_QUICK_RSP_WAKE_UP(pAd) \ - { RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_QKERIODIC_EXECUT, NULL, 0); \ - RTUSBMlmeUp(pAd); } - -#define RT28XX_MLME_RESET_STATE_MACHINE(pAd) \ - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_RESET_CONF, 0, NULL); \ - RTUSBMlmeUp(pAd); - -#define RT28XX_HANDLE_COUNTER_MEASURE(_pAd, _pEntry) \ - { RTUSBEnqueueInternalCmd(_pAd, CMDTHREAD_802_11_COUNTER_MEASURE, _pEntry, sizeof(MAC_TABLE_ENTRY)); \ - RTUSBMlmeUp(_pAd); \ - } - - -/* ----------------- Power Save Related MACRO ----------------- */ -#define RT28XX_PS_POLL_ENQUEUE(pAd) \ - { RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_PSPOLL); \ - RTUSBKickBulkOut(pAd); } - -#define RT28xx_CHIP_NAME "RTxx70" - -#define USB_CYC_CFG 0x02a4 -#define STATUS_SUCCESS 0x00 -#define STATUS_UNSUCCESSFUL 0x01 -#define NT_SUCCESS(status) (((status) > 0) ? (1):(0)) -#define InterlockedIncrement atomic_inc -#define NdisInterlockedIncrement atomic_inc -#define InterlockedDecrement atomic_dec -#define NdisInterlockedDecrement atomic_dec -#define InterlockedExchange atomic_set -//#define NdisMSendComplete RTMP_SendComplete -#define NdisMCancelTimer RTMPCancelTimer -#define NdisAllocMemory(_ptr, _size, _flag) \ - do{_ptr = kmalloc((_size),(_flag));}while(0) -#define NdisFreeMemory(a, b, c) kfree((a)) -#define NdisMSleep RTMPusecDelay /* unit: microsecond */ - - -#define USBD_TRANSFER_DIRECTION_OUT 0 -#define USBD_TRANSFER_DIRECTION_IN 0 -#define USBD_SHORT_TRANSFER_OK 0 -#define PURB purbb_t - -#define RTUSB_FREE_URB(pUrb) usb_free_urb(pUrb) - -//#undef MlmeAllocateMemory -//#undef MlmeFreeMemory - -typedef struct usb_device * PUSB_DEV; - -/* MACRO for linux usb */ -typedef struct urb *purbb_t; -typedef struct usb_ctrlrequest devctrlrequest; -#define PIRP PVOID -#define PMDL PVOID -#define NDIS_OID UINT -#ifndef USB_ST_NOERROR -#define USB_ST_NOERROR 0 -#endif - -// vendor-specific control operations -#define CONTROL_TIMEOUT_JIFFIES ( (100 * HZ) / 1000) -#define UNLINK_TIMEOUT_MS 3 - -/* unlink urb */ -#define RTUSB_UNLINK_URB(pUrb) usb_kill_urb(pUrb) - -// Prototypes of completion funuc. -VOID RTUSBBulkOutDataPacketComplete(purbb_t purb, struct pt_regs *pt_regs); -VOID RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs *pt_regs); -VOID RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs); -VOID RTUSBBulkOutRTSFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs); -VOID RTUSBBulkOutPsPollComplete(purbb_t pUrb, struct pt_regs *pt_regs); -VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs); - -#define RTUSBMlmeUp(pAd) \ -{ \ - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; \ - if (pid_nr(pObj->MLMEThr_pid) > 0) \ - up(&(pAd->mlme_semaphore)); \ -} - -#define RTUSBCMDUp(pAd) \ -{ \ - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; \ - if (pid_nr(pObj->RTUSBCmdThr_pid) > 0) \ - up(&(pAd->RTUSBCmd_semaphore)); \ -} - -static inline NDIS_STATUS RTMPAllocateMemory( - OUT PVOID *ptr, - IN size_t size) -{ - *ptr = kmalloc(size, GFP_ATOMIC); - if(*ptr) - return NDIS_STATUS_SUCCESS; - else - return NDIS_STATUS_RESOURCES; -} - -/* rtmp.h */ -#define BEACON_RING_SIZE 2 -#define DEVICE_VENDOR_REQUEST_OUT 0x40 -#define DEVICE_VENDOR_REQUEST_IN 0xc0 -#define INTERFACE_VENDOR_REQUEST_OUT 0x41 -#define INTERFACE_VENDOR_REQUEST_IN 0xc1 -#define MGMTPIPEIDX 0 // EP6 is highest priority - -#define BULKOUT_MGMT_RESET_FLAG 0x80 - -#define RTUSB_SET_BULK_FLAG(_M, _F) ((_M)->BulkFlags |= (_F)) -#define RTUSB_CLEAR_BULK_FLAG(_M, _F) ((_M)->BulkFlags &= ~(_F)) -#define RTUSB_TEST_BULK_FLAG(_M, _F) (((_M)->BulkFlags & (_F)) != 0) - -#define EnqueueCmd(cmdq, cmdqelmt) \ -{ \ - if (cmdq->size == 0) \ - cmdq->head = cmdqelmt; \ - else \ - cmdq->tail->next = cmdqelmt; \ - cmdq->tail = cmdqelmt; \ - cmdqelmt->next = NULL; \ - cmdq->size++; \ -} - -typedef struct _RT_SET_ASIC_WCID { - ULONG WCID; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based - ULONG SetTid; // time-based: seconds, packet-based: kilo-packets - ULONG DeleteTid; // time-based: seconds, packet-based: kilo-packets - UCHAR Addr[MAC_ADDR_LEN]; // avoid in interrupt when write key -} RT_SET_ASIC_WCID,*PRT_SET_ASIC_WCID; - -typedef struct _RT_SET_ASIC_WCID_ATTRI { - ULONG WCID; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based - ULONG Cipher; // ASIC Cipher definition - UCHAR Addr[ETH_LENGTH_OF_ADDRESS]; -} RT_SET_ASIC_WCID_ATTRI,*PRT_SET_ASIC_WCID_ATTRI; - -typedef struct _MLME_MEMORY_STRUCT { - PVOID AllocVa; //Pointer to the base virtual address of the allocated memory - struct _MLME_MEMORY_STRUCT *Next; //Pointer to the next virtual address of the allocated memory -} MLME_MEMORY_STRUCT, *PMLME_MEMORY_STRUCT; - -typedef struct _MLME_MEMORY_HANDLER { - BOOLEAN MemRunning; //The flag of the Mlme memory handler's status - UINT MemoryCount; //Total nonpaged system-space memory not size - UINT InUseCount; //Nonpaged system-space memory in used counts - UINT UnUseCount; //Nonpaged system-space memory available counts - INT PendingCount; //Nonpaged system-space memory for free counts - PMLME_MEMORY_STRUCT pInUseHead; //Pointer to the first nonpaed memory not used - PMLME_MEMORY_STRUCT pInUseTail; //Pointer to the last nonpaged memory not used - PMLME_MEMORY_STRUCT pUnUseHead; //Pointer to the first nonpaged memory in used - PMLME_MEMORY_STRUCT pUnUseTail; //Pointer to the last nonpaged memory in used - PULONG MemFreePending[MAX_MLME_HANDLER_MEMORY]; //an array to keep pending free-memory's pointer (32bits) -} MLME_MEMORY_HANDLER, *PMLME_MEMORY_HANDLER; - -typedef struct _CmdQElmt { - UINT command; - PVOID buffer; - ULONG bufferlength; - BOOLEAN CmdFromNdis; - BOOLEAN SetOperation; - struct _CmdQElmt *next; -} CmdQElmt, *PCmdQElmt; - -typedef struct _CmdQ { - UINT size; - CmdQElmt *head; - CmdQElmt *tail; - UINT32 CmdQState; -}CmdQ, *PCmdQ; - -/* oid.h */ -// Cipher suite type for mixed mode group cipher, P802.11i-2004 -typedef enum _RT_802_11_CIPHER_SUITE_TYPE { - Cipher_Type_NONE, - Cipher_Type_WEP40, - Cipher_Type_TKIP, - Cipher_Type_RSVD, - Cipher_Type_CCMP, - Cipher_Type_WEP104 -} RT_802_11_CIPHER_SUITE_TYPE, *PRT_802_11_CIPHER_SUITE_TYPE; - -//CMDTHREAD_MULTI_READ_MAC -//CMDTHREAD_MULTI_WRITE_MAC -//CMDTHREAD_VENDOR_EEPROM_READ -//CMDTHREAD_VENDOR_EEPROM_WRITE -typedef struct _CMDHandler_TLV { - USHORT Offset; - USHORT Length; - UCHAR DataFirst; -} CMDHandler_TLV, *PCMDHandler_TLV; - -// New for MeetingHouse Api support -#define CMDTHREAD_VENDOR_RESET 0x0D730101 // cmd -#define CMDTHREAD_VENDOR_UNPLUG 0x0D730102 // cmd -#define CMDTHREAD_VENDOR_SWITCH_FUNCTION 0x0D730103 // cmd -#define CMDTHREAD_MULTI_WRITE_MAC 0x0D730107 // cmd -#define CMDTHREAD_MULTI_READ_MAC 0x0D730108 // cmd -#define CMDTHREAD_VENDOR_EEPROM_WRITE 0x0D73010A // cmd -#define CMDTHREAD_VENDOR_EEPROM_READ 0x0D73010B // cmd -#define CMDTHREAD_VENDOR_ENTER_TESTMODE 0x0D73010C // cmd -#define CMDTHREAD_VENDOR_EXIT_TESTMODE 0x0D73010D // cmd -#define CMDTHREAD_VENDOR_WRITE_BBP 0x0D730119 // cmd -#define CMDTHREAD_VENDOR_READ_BBP 0x0D730118 // cmd -#define CMDTHREAD_VENDOR_WRITE_RF 0x0D73011A // cmd -#define CMDTHREAD_VENDOR_FLIP_IQ 0x0D73011D // cmd -#define CMDTHREAD_RESET_BULK_OUT 0x0D730210 // cmd -#define CMDTHREAD_RESET_BULK_IN 0x0D730211 // cmd -#define CMDTHREAD_SET_PSM_BIT_SAVE 0x0D730212 // cmd -#define CMDTHREAD_SET_RADIO 0x0D730214 // cmd -#define CMDTHREAD_UPDATE_TX_RATE 0x0D730216 // cmd -#define CMDTHREAD_802_11_ADD_KEY_WEP 0x0D730218 // cmd -#define CMDTHREAD_RESET_FROM_ERROR 0x0D73021A // cmd -#define CMDTHREAD_LINK_DOWN 0x0D73021B // cmd -#define CMDTHREAD_RESET_FROM_NDIS 0x0D73021C // cmd -#define CMDTHREAD_CHECK_GPIO 0x0D730215 // cmd -#define CMDTHREAD_FORCE_WAKE_UP 0x0D730222 // cmd -#define CMDTHREAD_SET_BW 0x0D730225 // cmd -#define CMDTHREAD_SET_ASIC_WCID 0x0D730226 // cmd -#define CMDTHREAD_SET_ASIC_WCID_CIPHER 0x0D730227 // cmd -#define CMDTHREAD_QKERIODIC_EXECUT 0x0D73023D // cmd -#define CMDTHREAD_SET_CLIENT_MAC_ENTRY 0x0D73023E // cmd -#define CMDTHREAD_802_11_QUERY_HARDWARE_REGISTER 0x0D710105 // cmd -#define CMDTHREAD_802_11_SET_PHY_MODE 0x0D79010C // cmd -#define CMDTHREAD_802_11_SET_STA_CONFIG 0x0D790111 // cmd -#define CMDTHREAD_802_11_SET_PREAMBLE 0x0D790101 // cmd -#define CMDTHREAD_802_11_COUNTER_MEASURE 0x0D790102 // cmd -#define CMDTHREAD_UPDATE_PROTECT 0x0D790103 // cmd - -#define WPA1AKMBIT 0x01 -#define WPA2AKMBIT 0x02 -#define WPA1PSKAKMBIT 0x04 -#define WPA2PSKAKMBIT 0x08 -#define TKIPBIT 0x01 -#define CCMPBIT 0x02 - - -#define RT28XX_STA_FORCE_WAKEUP(pAd, bFromTx) \ - RT28xxUsbStaAsicForceWakeup(pAd, bFromTx); - -#define RT28XX_STA_SLEEP_THEN_AUTO_WAKEUP(pAd, TbttNumToNextWakeUp) \ - RT28xxUsbStaAsicSleepThenAutoWakeup(pAd, TbttNumToNextWakeUp); - -#define RT28XX_MLME_RADIO_ON(pAd) \ - RT28xxUsbMlmeRadioOn(pAd); - -#define RT28XX_MLME_RADIO_OFF(pAd) \ - RT28xxUsbMlmeRadioOFF(pAd); - -#endif //__RT2870_H__ diff --git a/drivers/staging/rt2870/rt_usb.c b/drivers/staging/rt2870/rt_usb.c new file mode 100644 index 000000000000..5e02d4c88d73 --- /dev/null +++ b/drivers/staging/rt2870/rt_usb.c @@ -0,0 +1 @@ +#include "../rt2860/rt_usb.c" diff --git a/drivers/staging/rt2870/usb_main_dev.c b/drivers/staging/rt2870/usb_main_dev.c new file mode 100644 index 000000000000..6e63bc50047a --- /dev/null +++ b/drivers/staging/rt2870/usb_main_dev.c @@ -0,0 +1 @@ +#include "../rt2860/usb_main_dev.c" diff --git a/drivers/staging/rt3070/firmware.h b/drivers/staging/rt3070/firmware.h index b07783ed8dd0..d3c5d6c5ad53 100644 --- a/drivers/staging/rt3070/firmware.h +++ b/drivers/staging/rt3070/firmware.h @@ -43,7 +43,7 @@ /* AUTO GEN PLEASE DO NOT MODIFY IT */ -UCHAR FirmwareImage [] = { +UCHAR FirmwareImage_2870 [] = { 0xff, 0xff, 0xff, 0x02, 0x10, 0x28, 0x02, 0x10, 0x32, 0x02, 0x10, 0x78, 0x02, 0x12, 0x67, 0x02, 0x12, 0x68, 0x02, 0x12, 0x87, 0x02, 0x12, 0x8c, 0x12, 0x12, 0x88, 0x22, 0x02, 0x16, 0x49, 0x02, 0x17, 0x1f, 0x02, 0x13, 0x77, 0x02, 0x12, 0x8d, 0x30, 0x05, 0x06, 0x20, 0x0d, 0x03, 0x12, 0x17, -- GitLab From c3126b93b512c046340dfc4ab38beabd8084169f Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Tue, 22 Sep 2009 20:44:15 +0200 Subject: [PATCH 006/235] Staging: rt28x0: remove unused code from common/dfs.c Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/common/dfs.c | 378 ---------------------------- drivers/staging/rt2860/dfs.h | 75 ------ 2 files changed, 453 deletions(-) diff --git a/drivers/staging/rt2860/common/dfs.c b/drivers/staging/rt2860/common/dfs.c index 7b3890f631ea..11b7c1932a2e 100644 --- a/drivers/staging/rt2860/common/dfs.c +++ b/drivers/staging/rt2860/common/dfs.c @@ -37,196 +37,6 @@ #include "../rt_config.h" -typedef struct _RADAR_DURATION_TABLE -{ - ULONG RDDurRegion; - ULONG RadarSignalDuration; - ULONG Tolerance; -} RADAR_DURATION_TABLE, *PRADAR_DURATION_TABLE; - - - -UCHAR RdIdleTimeTable[MAX_RD_REGION][4] = -{ - {9, 250, 250, 250}, // CE -#ifdef DFS_FCC_BW40_FIX - {1, 250, 250, 250}, // FCC -#else - {4, 250, 250, 250}, // FCC -#endif - {4, 250, 250, 250}, // JAP - {15, 250, 250, 250}, // JAP_W53 - {4, 250, 250, 250} // JAP_W56 -}; - -/* - ======================================================================== - - Routine Description: - Bbp Radar detection routine - - Arguments: - pAd Pointer to our adapter - - Return Value: - - ======================================================================== -*/ -VOID BbpRadarDetectionStart( - IN PRTMP_ADAPTER pAd) -{ - UINT8 RadarPeriod; - - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 114, 0x02); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 121, 0x20); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 122, 0x00); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 123, 0x08/*0x80*/); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 124, 0x28); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 125, 0xff); - -#ifdef MERGE_ARCH_TEAM - if ((pAd->CommonCfg.RadarDetect.RDDurRegion == JAP) || (pAd->CommonCfg.RadarDetect.RDDurRegion == JAP_W53) || (pAd->CommonCfg.RadarDetect.RDDurRegion == JAP_W56)) - { - pAd->CommonCfg.RadarDetect.RDDurRegion = JAP; - pAd->CommonCfg.RadarDetect.RDDurRegion = JapRadarType(pAd); - if (pAd->CommonCfg.RadarDetect.RDDurRegion == JAP_W56) - { - pAd->CommonCfg.RadarDetect.DfsSessionTime = 13; - } - else if (pAd->CommonCfg.RadarDetect.RDDurRegion == JAP_W53) - { - pAd->CommonCfg.RadarDetect.DfsSessionTime = 15; - } - } -#endif // MERGE_ARCH_TEAM // - - RadarPeriod = ((UINT)RdIdleTimeTable[pAd->CommonCfg.RadarDetect.RDDurRegion][0] + (UINT)pAd->CommonCfg.RadarDetect.DfsSessionTime) < 250 ? - (RdIdleTimeTable[pAd->CommonCfg.RadarDetect.RDDurRegion][0] + pAd->CommonCfg.RadarDetect.DfsSessionTime) : 250; - -#ifdef MERGE_ARCH_TEAM - - -#else // Original RT28xx source code. - RTMP_IO_WRITE8(pAd, 0x7020, 0x1d); - RTMP_IO_WRITE8(pAd, 0x7021, 0x40); -#endif // MERGE_ARCH_TEAM // - - RadarDetectionStart(pAd, 0, RadarPeriod); - return; -} - -/* - ======================================================================== - - Routine Description: - Bbp Radar detection routine - - Arguments: - pAd Pointer to our adapter - - Return Value: - - ======================================================================== -*/ -VOID BbpRadarDetectionStop( - IN PRTMP_ADAPTER pAd) -{ - RTMP_IO_WRITE8(pAd, 0x7020, 0x1d); - RTMP_IO_WRITE8(pAd, 0x7021, 0x60); - - RadarDetectionStop(pAd); - return; -} - -/* - ======================================================================== - - Routine Description: - Radar detection routine - - Arguments: - pAd Pointer to our adapter - - Return Value: - - ======================================================================== -*/ -VOID RadarDetectionStart( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN CTSProtect, - IN UINT8 CTSPeriod) -{ - UINT8 DfsActiveTime = (pAd->CommonCfg.RadarDetect.DfsSessionTime & 0x1f); - UINT8 CtsProtect = (CTSProtect == 1) ? 0x02 : 0x01; // CTS protect. - - if (CTSProtect != 0) - { - switch(pAd->CommonCfg.RadarDetect.RDDurRegion) - { - case FCC: - case JAP_W56: - CtsProtect = 0x03; - break; - - case JAP: - { - UCHAR RDDurRegion; - RDDurRegion = JapRadarType(pAd); - if (RDDurRegion == JAP_W56) - CtsProtect = 0x03; - else - CtsProtect = 0x02; - break; - } - - case CE: - case JAP_W53: - default: - CtsProtect = 0x02; - break; - } - } - else - CtsProtect = 0x01; - - - // send start-RD with CTS protection command to MCU - // highbyte [7] reserve - // highbyte [6:5] 0x: stop Carrier/Radar detection - // highbyte [10]: Start Carrier/Radar detection without CTS protection, 11: Start Carrier/Radar detection with CTS protection - // highbyte [4:0] Radar/carrier detection duration. In 1ms. - - // lowbyte [7:0] Radar/carrier detection period, in 1ms. - AsicSendCommandToMcu(pAd, 0x60, 0xff, CTSPeriod, DfsActiveTime | (CtsProtect << 5)); - //AsicSendCommandToMcu(pAd, 0x63, 0xff, 10, 0); - - return; -} - -/* - ======================================================================== - - Routine Description: - Radar detection routine - - Arguments: - pAd Pointer to our adapter - - Return Value: - TRUE Found radar signal - FALSE Not found radar signal - - ======================================================================== -*/ -VOID RadarDetectionStop( - IN PRTMP_ADAPTER pAd) -{ - DBGPRINT(RT_DEBUG_TRACE,("RadarDetectionStop.\n")); - AsicSendCommandToMcu(pAd, 0x60, 0xff, 0x00, 0x00); // send start-RD with CTS protection command to MCU - - return; -} - /* ======================================================================== @@ -260,191 +70,3 @@ BOOLEAN RadarChannelCheck( return result; } - -ULONG JapRadarType( - IN PRTMP_ADAPTER pAd) -{ - ULONG i; - const UCHAR Channel[15]={52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}; - - if (pAd->CommonCfg.RadarDetect.RDDurRegion != JAP) - { - return pAd->CommonCfg.RadarDetect.RDDurRegion; - } - - for (i=0; i<15; i++) - { - if (pAd->CommonCfg.Channel == Channel[i]) - { - break; - } - } - - if (i < 4) - return JAP_W53; - else if (i < 15) - return JAP_W56; - else - return JAP; // W52 - -} - -ULONG RTMPBbpReadRadarDuration( - IN PRTMP_ADAPTER pAd) -{ - UINT8 byteValue = 0; - ULONG result; - - BBP_IO_READ8_BY_REG_ID(pAd, BBP_R115, &byteValue); - - result = 0; - switch (byteValue) - { - case 1: // radar signal detected by pulse mode. - case 2: // radar signal detected by width mode. - result = RTMPReadRadarDuration(pAd); - break; - - case 0: // No radar signal. - default: - - result = 0; - break; - } - - return result; -} - -ULONG RTMPReadRadarDuration( - IN PRTMP_ADAPTER pAd) -{ - ULONG result = 0; - - return result; - -} - -VOID RTMPCleanRadarDuration( - IN PRTMP_ADAPTER pAd) -{ - return; -} - -/* - ======================================================================== - Routine Description: - Radar wave detection. The API should be invoke each second. - - Arguments: - pAd - Adapter pointer - - Return Value: - None - - ======================================================================== -*/ -VOID ApRadarDetectPeriodic( - IN PRTMP_ADAPTER pAd) -{ - INT i; - - pAd->CommonCfg.RadarDetect.InServiceMonitorCount++; - - for (i=0; iChannelListNum; i++) - { - if (pAd->ChannelList[i].RemainingTimeForUse > 0) - { - pAd->ChannelList[i].RemainingTimeForUse --; - if ((pAd->Mlme.PeriodicRound%5) == 0) - { - DBGPRINT(RT_DEBUG_TRACE, ("RadarDetectPeriodic - ch=%d, RemainingTimeForUse=%d\n", pAd->ChannelList[i].Channel, pAd->ChannelList[i].RemainingTimeForUse)); - } - } - } - - //radar detect - if ((pAd->CommonCfg.Channel > 14) - && (pAd->CommonCfg.bIEEE80211H == 1) - && RadarChannelCheck(pAd, pAd->CommonCfg.Channel)) - { - RadarDetectPeriodic(pAd); - } - - return; -} - -// Periodic Radar detection, switch channel will occur in RTMPHandleTBTTInterrupt() -// Before switch channel, driver needs doing channel switch announcement. -VOID RadarDetectPeriodic( - IN PRTMP_ADAPTER pAd) -{ - // need to check channel availability, after switch channel - if (pAd->CommonCfg.RadarDetect.RDMode != RD_SILENCE_MODE) - return; - - // channel availability check time is 60sec, use 65 for assurance - if (pAd->CommonCfg.RadarDetect.RDCount++ > pAd->CommonCfg.RadarDetect.ChMovingTime) - { - DBGPRINT(RT_DEBUG_TRACE, ("Not found radar signal, start send beacon and radar detection in service monitor\n\n")); - BbpRadarDetectionStop(pAd); - AsicEnableBssSync(pAd); - pAd->CommonCfg.RadarDetect.RDMode = RD_NORMAL_MODE; - - - return; - } - - return; -} - - -/* - ========================================================================== - Description: - change channel moving time for DFS testing. - - Arguments: - pAdapter Pointer to our adapter - wrq Pointer to the ioctl argument - - Return Value: - None - - Note: - Usage: - 1.) iwpriv ra0 set ChMovTime=[value] - ========================================================================== -*/ -INT Set_ChMovingTime_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UINT8 Value; - - Value = (UINT8) simple_strtol(arg, 0, 10); - - pAd->CommonCfg.RadarDetect.ChMovingTime = Value; - - DBGPRINT(RT_DEBUG_TRACE, ("%s:: %d\n", __func__, - pAd->CommonCfg.RadarDetect.ChMovingTime)); - - return TRUE; -} - -INT Set_LongPulseRadarTh_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UINT8 Value; - - Value = (UINT8) simple_strtol(arg, 0, 10) > 10 ? 10 : simple_strtol(arg, 0, 10); - - pAd->CommonCfg.RadarDetect.LongPulseRadarTh = Value; - - DBGPRINT(RT_DEBUG_TRACE, ("%s:: %d\n", __func__, - pAd->CommonCfg.RadarDetect.LongPulseRadarTh)); - - return TRUE; -} - - diff --git a/drivers/staging/rt2860/dfs.h b/drivers/staging/rt2860/dfs.h index 6fa6d65e7b37..9ab445c736df 100644 --- a/drivers/staging/rt2860/dfs.h +++ b/drivers/staging/rt2860/dfs.h @@ -36,81 +36,6 @@ Fonchi 03-12-2007 created */ -#define RADAR_PULSE 1 -#define RADAR_WIDTH 2 - -#define WIDTH_RD_IDLE 0 -#define WIDTH_RD_CHECK 1 - - - -/************************************************************************* - * - * DFS Radar related definitions. - * - ************************************************************************/ -//#define CARRIER_DETECT_TASK_NUM 6 -//#define RADAR_DETECT_TASK_NUM 7 - -// McuRadarState && McuCarrierState for 2880-SW-MCU -#define FREE_FOR_TX 0 -#define WAIT_CTS_BEING_SENT 1 -#define DO_DETECTION 2 - -// McuRadarEvent -#define RADAR_EVENT_CTS_SENT 0x01 // Host signal MCU that CTS has been sent -#define RADAR_EVENT_CTS_CARRIER_SENT 0x02 // Host signal MCU that CTS has been sent (Carrier) -#define RADAR_EVENT_RADAR_DETECTING 0x04 // Radar detection is on going, carrier detection hold back -#define RADAR_EVENT_CARRIER_DETECTING 0x08 // Carrier detection is on going, radar detection hold back -#define RADAR_EVENT_WIDTH_RADAR 0x10 // BBP == 2 radar detected -#define RADAR_EVENT_CTS_KICKED 0x20 // Radar detection need to sent double CTS, first CTS sent - -// McuRadarCmd -#define DETECTION_STOP 0 -#define RADAR_DETECTION 1 -#define CARRIER_DETECTION 2 - -VOID BbpRadarDetectionStart( - IN PRTMP_ADAPTER pAd); - -VOID BbpRadarDetectionStop( - IN PRTMP_ADAPTER pAd); - -VOID RadarDetectionStart( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN CTS_Protect, - IN UINT8 CTSPeriod); - -VOID RadarDetectionStop( - IN PRTMP_ADAPTER pAd); - -VOID RadarDetectPeriodic( - IN PRTMP_ADAPTER pAd); - - BOOLEAN RadarChannelCheck( IN PRTMP_ADAPTER pAd, IN UCHAR Ch); - -ULONG JapRadarType( - IN PRTMP_ADAPTER pAd); - -ULONG RTMPBbpReadRadarDuration( - IN PRTMP_ADAPTER pAd); - -ULONG RTMPReadRadarDuration( - IN PRTMP_ADAPTER pAd); - -VOID RTMPCleanRadarDuration( - IN PRTMP_ADAPTER pAd); - - -INT Set_ChMovingTime_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_LongPulseRadarTh_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - - -- GitLab From e44fd1cfded0e42c681ad5419b1ceea600ead29d Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Tue, 22 Sep 2009 20:44:24 +0200 Subject: [PATCH 007/235] Staging: rt2860: add RT3090 chipset support Add support for RT3090 chipset (based on 2009_0612_RT3090_Linux_STA_V2.1.0.0_DPO). Tested with RT2860. Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/Kconfig | 5 +- drivers/staging/rt2860/Makefile | 7 +- drivers/staging/rt2860/chip/mac_pci.h | 12 + drivers/staging/rt2860/chip/rt3090.h | 72 ++++ drivers/staging/rt2860/chip/rtmp_phy.h | 183 ++++++++- drivers/staging/rt2860/chips/rt3090.c | 123 ++++++ drivers/staging/rt2860/chips/rt30xx.c | 12 + drivers/staging/rt2860/common/cmm_asic.c | 29 ++ drivers/staging/rt2860/common/cmm_data_pci.c | 6 - drivers/staging/rt2860/common/cmm_mac_pci.c | 255 +++++++++--- drivers/staging/rt2860/common/cmm_profile.c | 43 +++ drivers/staging/rt2860/common/cmm_sync.c | 13 - drivers/staging/rt2860/common/mlme.c | 112 ++++-- drivers/staging/rt2860/common/rt_rf.c | 8 + drivers/staging/rt2860/common/rtmp_init.c | 73 +++- drivers/staging/rt2860/common/rtmp_mcu.c | 98 ++++- drivers/staging/rt2860/common/rtmp_timer.c | 4 +- drivers/staging/rt2860/iface/rtmp_pci.h | 2 - drivers/staging/rt2860/pci_main_dev.c | 384 +++++++++++++++++-- drivers/staging/rt2860/rt_linux.c | 3 + drivers/staging/rt2860/rt_linux.h | 13 +- drivers/staging/rt2860/rt_main_dev.c | 17 +- drivers/staging/rt2860/rt_pci_rbus.c | 4 +- drivers/staging/rt2860/rtmp.h | 49 ++- drivers/staging/rt2860/rtmp_chip.h | 3 + drivers/staging/rt2860/rtmp_def.h | 5 + drivers/staging/rt2860/sta/assoc.c | 12 - drivers/staging/rt2860/sta/auth_rsp.c | 4 - drivers/staging/rt2860/sta/connect.c | 190 ++------- drivers/staging/rt2860/sta/rtmp_data.c | 1 - drivers/staging/rt2860/sta/sync.c | 26 +- drivers/staging/rt2860/sta/wpa.c | 48 --- drivers/staging/rt2860/sta_ioctl.c | 7 + drivers/staging/rt2860/wpa.h | 7 - drivers/staging/rt3090/common/rtmp_mcu.c | 8 +- drivers/staging/rt3090/firmware.h | 2 +- 36 files changed, 1416 insertions(+), 424 deletions(-) create mode 100644 drivers/staging/rt2860/chip/rt3090.h create mode 100644 drivers/staging/rt2860/chips/rt3090.c diff --git a/drivers/staging/rt2860/Kconfig b/drivers/staging/rt2860/Kconfig index efe38e25c5ed..bd5f8666dde2 100644 --- a/drivers/staging/rt2860/Kconfig +++ b/drivers/staging/rt2860/Kconfig @@ -1,5 +1,6 @@ config RT2860 - tristate "Ralink 2860 wireless support" + tristate "Ralink 2860/3090 wireless support" depends on PCI && X86 && WLAN ---help--- - This is an experimental driver for the Ralink 2860 wireless chip. + This is an experimental driver for the Ralink 2860 and 3090 + wireless chips. diff --git a/drivers/staging/rt2860/Makefile b/drivers/staging/rt2860/Makefile index 4404ddb63572..ba171427ac9d 100644 --- a/drivers/staging/rt2860/Makefile +++ b/drivers/staging/rt2860/Makefile @@ -3,6 +3,7 @@ obj-$(CONFIG_RT2860) += rt2860sta.o # TODO: all of these should be removed EXTRA_CFLAGS += -DLINUX -DAGGREGATION_SUPPORT -DPIGGYBACK_SUPPORT -DWMM_SUPPORT EXTRA_CFLAGS += -DRTMP_MAC_PCI -DRTMP_PCI_SUPPORT -DRT2860 +EXTRA_CFLAGS += -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -DRT30xx -DRT3090 EXTRA_CFLAGS += -DDBG rt2860sta-objs := \ @@ -46,4 +47,8 @@ rt2860sta-objs := \ common/cmm_mac_pci.o \ common/cmm_data_pci.o \ common/ee_prom.o \ - common/rtmp_mcu.o + common/rtmp_mcu.o \ + common/ee_efuse.o \ + chips/rt30xx.o \ + common/rt_rf.o \ + chips/rt3090.o diff --git a/drivers/staging/rt2860/chip/mac_pci.h b/drivers/staging/rt2860/chip/mac_pci.h index 9ca9c3602d69..61b3f82315a1 100644 --- a/drivers/staging/rt2860/chip/mac_pci.h +++ b/drivers/staging/rt2860/chip/mac_pci.h @@ -133,6 +133,18 @@ typedef struct PACKED _RXD_STRUC{ UINT32 Rsv1:13; } RXD_STRUC, *PRXD_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC; +typedef union _TX_ATTENUATION_CTRL_STRUC { + struct + { + ULONG RF_ISOLATION_ENABLE:1; + ULONG Reserve2:7; + ULONG PCIE_PHY_TX_ATTEN_VALUE:3; + ULONG PCIE_PHY_TX_ATTEN_EN:1; + ULONG Reserve1:20; + } field; + + ULONG word; +} TX_ATTENUATION_CTRL_STRUC, *PTX_ATTENUATION_CTRL_STRUC; /* ----------------- EEPROM Related MACRO ----------------- */ diff --git a/drivers/staging/rt2860/chip/rt3090.h b/drivers/staging/rt2860/chip/rt3090.h new file mode 100644 index 000000000000..c2249a471231 --- /dev/null +++ b/drivers/staging/rt2860/chip/rt3090.h @@ -0,0 +1,72 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + rt3090.h + + Abstract: + + Revision History: + Who When What + --------- ---------- ---------------------------------------------- + */ + +#ifndef __RT3090_H__ +#define __RT3090_H__ + +#ifdef RT3090 + +#ifndef RTMP_PCI_SUPPORT +#error "For RT3090, you should define the compile flag -DRTMP_PCI_SUPPORT" +#endif + +#ifndef RTMP_MAC_PCI +#error "For RT3090, you should define the compile flag -DRTMP_MAC_PCI" +#endif + +#ifndef RTMP_RF_RW_SUPPORT +#error "For RT3090, you should define the compile flag -DRTMP_RF_RW_SUPPORT" +#endif + +#ifndef RT30xx +#error "For RT3090, you should define the compile flag -DRT30xx" +#endif + +#define PCIE_PS_SUPPORT + +#include "mac_pci.h" +#include "rt30xx.h" + +// +// Device ID & Vendor ID, these values should match EEPROM value +// +#define NIC3090_PCIe_DEVICE_ID 0x3090 // 1T/1R miniCard +#define NIC3091_PCIe_DEVICE_ID 0x3091 // 1T/2R miniCard +#define NIC3092_PCIe_DEVICE_ID 0x3092 // 2T/2R miniCard + +#endif // RT3090 // + +#endif //__RT3090_H__ // diff --git a/drivers/staging/rt2860/chip/rtmp_phy.h b/drivers/staging/rt2860/chip/rtmp_phy.h index b3326c603cc2..87516f3a111a 100644 --- a/drivers/staging/rt2860/chip/rtmp_phy.h +++ b/drivers/staging/rt2860/chip/rtmp_phy.h @@ -278,6 +278,7 @@ But for some chipset which didn't have mcu (e.g., RBUS based chipset), we will use this function too and didn't access the bbp register via the MCU. */ +#if 0 #define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \ do{ \ if ((_A)->bPCIclkOff == FALSE) \ @@ -288,7 +289,99 @@ RTMP_BBP_IO_READ8((_A), (_I), (_pV), TRUE); \ } \ }while(0) - +#else +// Read BBP register by register's ID. Generate PER to test BA +#define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \ +{ \ + BBP_CSR_CFG_STRUC BbpCsr; \ + int i, k; \ + BOOLEAN brc; \ + BbpCsr.field.Busy = IDLE; \ + if ((IS_RT3090((_A)) || IS_RT3572((_A)) || IS_RT3390((_A))) && ((_A)->StaCfg.PSControl.field.rt30xxPowerMode == 3) \ + && ((_A)->StaCfg.PSControl.field.EnableNewPS == TRUE) \ + && ((_A)->bPCIclkOff == FALSE) \ + && ((_A)->brt30xxBanMcuCmd == FALSE)) \ + { \ + for (i=0; iStaCfg.PSControl.field.rt30xxPowerMode == 3) \ + && ((_A)->StaCfg.PSControl.field.EnableNewPS == TRUE)) \ + && ((_A)->bPCIclkOff == FALSE)) \ + { \ + for (i=0; ibrt30xxBanMcuCmd, (_I))); \ + *(_pV) = (_A)->BbpWriteLatch[_I]; \ + } \ + if ((BbpCsr.field.Busy == BUSY) || ((_A)->bPCIclkOff == TRUE)) \ + { \ + DBGPRINT_ERR(("BBP read R%d=0x%x fail\n", _I, BbpCsr.word)); \ + *(_pV) = (_A)->BbpWriteLatch[_I]; \ + } \ +} +#endif // 0 // /* basic marco for BBP write operation. @@ -348,6 +441,7 @@ But for some chipset which didn't have mcu (e.g., RBUS based chipset), we will use this function too and didn't access the bbp register via the MCU. */ +#if 0 #define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _pV) \ do{ \ if ((_A)->bPCIclkOff == FALSE) \ @@ -358,6 +452,93 @@ RTMP_BBP_IO_WRITE8((_A), (_I), (_pV), TRUE); \ } \ }while(0) +#else +// Write BBP register by register's ID & value +#define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \ +{ \ + BBP_CSR_CFG_STRUC BbpCsr; \ + INT BusyCnt = 0; \ + BOOLEAN brc; \ + if (_I < MAX_NUM_OF_BBP_LATCH) \ + { \ + if ((IS_RT3090((_A)) || IS_RT3572((_A)) || IS_RT3390((_A))) && ((_A)->StaCfg.PSControl.field.rt30xxPowerMode == 3) \ + && ((_A)->StaCfg.PSControl.field.EnableNewPS == TRUE) \ + && ((_A)->bPCIclkOff == FALSE) \ + && ((_A)->brt30xxBanMcuCmd == FALSE)) \ + { \ + if (_A->AccessBBPFailCount > 20) \ + { \ + AsicResetBBPAgent(_A); \ + _A->AccessBBPFailCount = 0; \ + } \ + for (BusyCnt=0; BusyCntBbpWriteLatch[_I] = _V; \ + } \ + else \ + { \ + BbpCsr.field.Busy = 0; \ + RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \ + } \ + break; \ + } \ + } \ + else if (!((IS_RT3090((_A)) || IS_RT3572((_A)) || IS_RT3390((_A))) && ((_A)->StaCfg.PSControl.field.rt30xxPowerMode == 3) \ + && ((_A)->StaCfg.PSControl.field.EnableNewPS == TRUE)) \ + && ((_A)->bPCIclkOff == FALSE)) \ + { \ + if (_A->AccessBBPFailCount > 20) \ + { \ + AsicResetBBPAgent(_A); \ + _A->AccessBBPFailCount = 0; \ + } \ + for (BusyCnt=0; BusyCntBbpWriteLatch[_I] = _V; \ + break; \ + } \ + } \ + else \ + { \ + DBGPRINT_ERR((" brt30xxBanMcuCmd = %d. Write BBP %d \n", (_A)->brt30xxBanMcuCmd, (_I))); \ + } \ + if ((BusyCnt == MAX_BUSY_COUNT) || ((_A)->bPCIclkOff == TRUE)) \ + { \ + if (BusyCnt == MAX_BUSY_COUNT) \ + (_A)->AccessBBPFailCount++; \ + DBGPRINT_ERR(("BBP write R%d=0x%x fail. BusyCnt= %d.bPCIclkOff = %d. \n", _I, BbpCsr.word, BusyCnt, (_A)->bPCIclkOff )); \ + } \ + } \ + else \ + { \ + DBGPRINT_ERR(("****** BBP_Write_Latch Buffer exceeds max boundry ****** \n")); \ + } \ +} +#endif // 0 // #endif // RTMP_MAC_PCI // #ifdef RTMP_MAC_USB diff --git a/drivers/staging/rt2860/chips/rt3090.c b/drivers/staging/rt2860/chips/rt3090.c new file mode 100644 index 000000000000..35c549dc4ce1 --- /dev/null +++ b/drivers/staging/rt2860/chips/rt3090.c @@ -0,0 +1,123 @@ +/* + ************************************************************************* + * Ralink Tech Inc. + * 5F., No.36, Taiyuan St., Jhubei City, + * Hsinchu County 302, + * Taiwan, R.O.C. + * + * (c) Copyright 2002-2007, Ralink Technology, Inc. + * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ************************************************************************* + + Module Name: + rt3090.c + + Abstract: + Specific funcitons and variables for RT3070 + + Revision History: + Who When What + -------- ---------- ---------------------------------------------- +*/ + +#ifdef RT3090 + +#include "../rt_config.h" + + +#ifndef RTMP_RF_RW_SUPPORT +#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" +#endif // RTMP_RF_RW_SUPPORT // + + +VOID NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd) +{ + INT i; + // Driver must read EEPROM to get RfIcType before initial RF registers + // Initialize RF register to default value + if (IS_RT3090(pAd)) + { + // Init RF calibration + // Driver should toggle RF R30 bit7 before init RF registers + UINT32 RfReg = 0, data; + + RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg); + RfReg |= 0x80; + RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); + RTMPusecDelay(1000); + RfReg &= 0x7F; + RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); + + // init R24, R31 + RT30xxWriteRFRegister(pAd, RF_R24, 0x0F); + RT30xxWriteRFRegister(pAd, RF_R31, 0x0F); + + // RT309x version E has fixed this issue + if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211)) + { + // patch tx EVM issue temporarily + RTMP_IO_READ32(pAd, LDO_CFG0, &data); + data = ((data & 0xE0FFFFFF) | 0x0D000000); + RTMP_IO_WRITE32(pAd, LDO_CFG0, data); + } + else + { + RTMP_IO_READ32(pAd, LDO_CFG0, &data); + data = ((data & 0xE0FFFFFF) | 0x01000000); + RTMP_IO_WRITE32(pAd, LDO_CFG0, data); + } + + // patch LNA_PE_G1 failed issue + RTMP_IO_READ32(pAd, GPIO_SWITCH, &data); + data &= ~(0x20); + RTMP_IO_WRITE32(pAd, GPIO_SWITCH, data); + + // Initialize RF register to default value + for (i = 0; i < NUM_RF_REG_PARMS; i++) + { + RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value); + } + + // Driver should set RF R6 bit6 on before calibration + RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RfReg); + RfReg |= 0x40; + RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg); + + //For RF filter Calibration + RTMPFilterCalibration(pAd); + + // Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration() + if ((pAd->MACVersion & 0xffff) < 0x0211) + RT30xxWriteRFRegister(pAd, RF_R27, 0x3); + + // set led open drain enable + RTMP_IO_READ32(pAd, OPT_14, &data); + data |= 0x01; + RTMP_IO_WRITE32(pAd, OPT_14, data); + + // set default antenna as main + if (pAd->RfIcType == RFIC_3020) + AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); + + // add by johnli, RF power sequence setup, load RF normal operation-mode setup + RT30xxLoadRFNormalModeSetup(pAd); + } + +} + +#endif // RT3090 // diff --git a/drivers/staging/rt2860/chips/rt30xx.c b/drivers/staging/rt2860/chips/rt30xx.c index fe7d8ec5c011..f29d11d6de47 100644 --- a/drivers/staging/rt2860/chips/rt30xx.c +++ b/drivers/staging/rt2860/chips/rt30xx.c @@ -101,7 +101,13 @@ VOID RT30xxSetRxAnt( if (Ant == 0) { // Main antenna +#ifdef RTMP_MAC_PCI + RTMP_IO_READ32(pAd, E2PROM_CSR, &x); + x |= (EESK); + RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); +#else AsicSendCommandToMcu(pAd, 0x73, 0xFF, 0x1, 0x0); +#endif // RTMP_MAC_PCI // RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value); Value &= ~(0x0808); @@ -111,7 +117,13 @@ VOID RT30xxSetRxAnt( else { // Aux antenna +#ifdef RTMP_MAC_PCI + RTMP_IO_READ32(pAd, E2PROM_CSR, &x); + x &= ~(EESK); + RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); +#else AsicSendCommandToMcu(pAd, 0x73, 0xFF, 0x0, 0x0); +#endif // RTMP_MAC_PCI // RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value); Value &= ~(0x0808); Value |= 0x08; diff --git a/drivers/staging/rt2860/common/cmm_asic.c b/drivers/staging/rt2860/common/cmm_asic.c index 83ed07b45bdd..5d3a387f76a2 100644 --- a/drivers/staging/rt2860/common/cmm_asic.c +++ b/drivers/staging/rt2860/common/cmm_asic.c @@ -808,6 +808,28 @@ VOID AsicSwitchChannel( RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg); +#if defined(RT3090) || defined(RT3390) + // PCIe PHY Transmit attenuation adjustment + if (IS_RT3090A(pAd) || IS_RT3390(pAd)) + { + TX_ATTENUATION_CTRL_STRUC TxAttenuationCtrl = {0}; + + RTMP_IO_READ32(pAd, PCIE_PHY_TX_ATTENUATION_CTRL, &TxAttenuationCtrl.word); + + if (Channel == 14) // Channel #14 + { + TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_EN = 1; // Enable PCIe PHY Tx attenuation + TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_VALUE = 4; // 9/16 full drive level + } + else // Channel #1~#13 + { + TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_EN = 0; // Disable PCIe PHY Tx attenuation + TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_VALUE = 0; // n/a + } + + RTMP_IO_WRITE32(pAd, PCIE_PHY_TX_ATTENUATION_CTRL, TxAttenuationCtrl.word); + } +#endif } else { @@ -2477,6 +2499,13 @@ VOID AsicTurnOnRFClk( UCHAR index; RTMP_RF_REGS *RFRegTable; +#ifdef PCIE_PS_SUPPORT + // The RF programming sequence is difference between 3xxx and 2xxx + if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) + { + return; + } +#endif // PCIE_PS_SUPPORT // RFRegTable = RF2850RegTable; diff --git a/drivers/staging/rt2860/common/cmm_data_pci.c b/drivers/staging/rt2860/common/cmm_data_pci.c index d808e7d7767d..e9739b45ba37 100644 --- a/drivers/staging/rt2860/common/cmm_data_pci.c +++ b/drivers/staging/rt2860/common/cmm_data_pci.c @@ -638,9 +638,6 @@ BOOLEAN RTMPHandleTxRingDmaDoneInterrupt( if (TxRingBitmap.field.Ac0DmaDone) bReschedule = RTMPFreeTXDUponTxDmaDone(pAd, QID_AC_BE); - if (TxRingBitmap.field.HccaDmaDone) - bReschedule |= RTMPFreeTXDUponTxDmaDone(pAd, QID_HCCA); - if (TxRingBitmap.field.Ac3DmaDone) bReschedule |= RTMPFreeTXDUponTxDmaDone(pAd, QID_AC_VO); @@ -791,7 +788,6 @@ VOID RTMPHandleRxCoherentInterrupt( RTMPRingCleanUp(pAd, QID_AC_BK); RTMPRingCleanUp(pAd, QID_AC_VI); RTMPRingCleanUp(pAd, QID_AC_VO); - RTMPRingCleanUp(pAd, QID_HCCA); RTMPRingCleanUp(pAd, QID_MGMT); RTMPRingCleanUp(pAd, QID_RX); @@ -1147,7 +1143,5 @@ VOID RTMPWriteTxDescriptor( pTxD->QSEL= (QueueSEL); //RT2860c?? fixed using EDCA queue for test... We doubt Queue1 has problem. 2006-09-26 Jan //pTxD->QSEL= FIFO_EDCA; - if (pAd->bGenOneHCCA == TRUE) - pTxD->QSEL= FIFO_HCCA; pTxD->DMADONE = 0; } diff --git a/drivers/staging/rt2860/common/cmm_mac_pci.c b/drivers/staging/rt2860/common/cmm_mac_pci.c index 5aa6944d1180..73992cb4ee67 100644 --- a/drivers/staging/rt2860/common/cmm_mac_pci.c +++ b/drivers/staging/rt2860/common/cmm_mac_pci.c @@ -414,7 +414,6 @@ VOID RTMPRingCleanUp( case QID_AC_BE: case QID_AC_VI: case QID_AC_VO: - case QID_HCCA: pTxRing = &pAd->TxRing[RingType]; @@ -860,11 +859,14 @@ VOID RT28xxPciStaAsicForceWakeup( OPSTATUS_SET_FLAG(pAd, fOP_STATUS_WAKEUP_NOW); -#ifdef RTMP_PCI_SUPPORT - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_GO_TO_SLEEP_NOW); + + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) + &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) { // Support PCIe Advance Power Save - if (bFromTx == TRUE) + if (bFromTx == TRUE + &&(pAd->Mlme.bPsPollTimerRunning == TRUE)) { pAd->Mlme.bPsPollTimerRunning = FALSE; RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); @@ -877,6 +879,17 @@ VOID RT28xxPciStaAsicForceWakeup( if (RT28xxPciAsicRadioOn(pAd, DOT11POWERSAVE)) { +#ifdef PCIE_PS_SUPPORT + // add by johnli, RF power sequence setup, load RF normal operation-mode setup + if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) + { + RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + + if (pChipOps->AsicReverseRfFromSleepMode) + pChipOps->AsicReverseRfFromSleepMode(pAd); + } + else +#endif // PCIE_PS_SUPPORT // { // end johnli // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. @@ -895,11 +908,24 @@ VOID RT28xxPciStaAsicForceWakeup( } } } +#ifdef PCIE_PS_SUPPORT + // 3090 MCU Wakeup command needs more time to be stable. + // Before stable, don't issue other MCU command to prevent from firmware error. + if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) + { + DBGPRINT(RT_DEBUG_TRACE, ("<==RT28xxPciStaAsicForceWakeup::Release the MCU Lock(3090)\n")); + RTMP_SEM_LOCK(&pAd->McuCmdLock); + pAd->brt30xxBanMcuCmd = FALSE; + RTMP_SEM_UNLOCK(&pAd->McuCmdLock); + } +#endif // PCIE_PS_SUPPORT // } else -#endif // RTMP_PCI_SUPPORT // { // PCI, 2860-PCIe + DBGPRINT(RT_DEBUG_TRACE, ("<==RT28xxPciStaAsicForceWakeup::Original PCI Power Saving\n")); AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02); AutoWakeupCfg.word = 0; RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); @@ -922,7 +948,8 @@ VOID RT28xxPciStaAsicSleepThenAutoWakeup( OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); return; } - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) + &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) { ULONG Now = 0; if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WAKEUP_NOW)) @@ -972,7 +999,6 @@ VOID RT28xxPciStaAsicSleepThenAutoWakeup( } -#ifdef RTMP_PCI_SUPPORT VOID PsPollWakeExec( IN PVOID SystemSpecific1, IN PVOID FunctionContext, @@ -990,6 +1016,17 @@ VOID PsPollWakeExec( } pAd->Mlme.bPsPollTimerRunning = FALSE; RTMP_INT_UNLOCK(&pAd->irq_lock, flags); +#ifdef PCIE_PS_SUPPORT + // For rt30xx power solution 3, Use software timer to wake up in psm. So call + // AsicForceWakeup here instead of handling twakeup interrupt. + if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) + { + DBGPRINT(RT_DEBUG_TRACE,("<--PsPollWakeExec::3090 calls AsicForceWakeup(pAd, DOT11POWERSAVE) in advance \n")); + AsicForceWakeup(pAd, DOT11POWERSAVE); + } +#endif // PCIE_PS_SUPPORT // } VOID RadioOnExec( @@ -1006,18 +1043,34 @@ VOID RadioOnExec( if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { DBGPRINT(RT_DEBUG_TRACE,("-->RadioOnExec() return on fOP_STATUS_DOZE == TRUE; \n")); +//KH Debug: Add the compile flag "RT2860 and condition +#ifdef RTMP_PCI_SUPPORT + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) + &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); +#endif // RTMP_PCI_SUPPORT // return; } if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) { DBGPRINT(RT_DEBUG_TRACE,("-->RadioOnExec() return on SCAN_IN_PROGRESS; \n")); +#ifdef RTMP_PCI_SUPPORT +if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) + &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); +#endif // RTMP_PCI_SUPPORT // return; } +//KH Debug: need to check. I add the compile flag "CONFIG_STA_SUPPORT" to enclose the following codes. +#ifdef RTMP_PCI_SUPPORT +if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) + &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) + { pAd->Mlme.bPsPollTimerRunning = FALSE; RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); + } +#endif // RTMP_PCI_SUPPORT // if (pAd->StaCfg.bRadio == TRUE) { pAd->bPCIclkOff = FALSE; @@ -1025,7 +1078,6 @@ VOID RadioOnExec( RTMPRingCleanUp(pAd, QID_AC_BE); RTMPRingCleanUp(pAd, QID_AC_VI); RTMPRingCleanUp(pAd, QID_AC_VO); - RTMPRingCleanUp(pAd, QID_HCCA); RTMPRingCleanUp(pAd, QID_MGMT); RTMPRingCleanUp(pAd, QID_RX); @@ -1058,9 +1110,23 @@ VOID RadioOnExec( AsicLockChannel(pAd, pAd->CommonCfg.Channel); } +//KH Debug:The following codes should be enclosed by RT3090 compile flag if (pChipOps->AsicReverseRfFromSleepMode) pChipOps->AsicReverseRfFromSleepMode(pAd); +#ifdef PCIE_PS_SUPPORT +// 3090 MCU Wakeup command needs more time to be stable. +// Before stable, don't issue other MCU command to prevent from firmware error. +if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) + { + RTMP_SEM_LOCK(&pAd->McuCmdLock); + pAd->brt30xxBanMcuCmd = FALSE; + RTMP_SEM_UNLOCK(&pAd->McuCmdLock); + } +#endif // PCIE_PS_SUPPORT // + // Clear Radio off flag RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); @@ -1077,8 +1143,6 @@ VOID RadioOnExec( RT28xxPciAsicRadioOff(pAd, GUIRADIO_OFF, 0); } } -#endif // RTMP_PCI_SUPPORT // - /* ========================================================================== @@ -1102,12 +1166,24 @@ BOOLEAN RT28xxPciAsicRadioOn( if (pAd->OpMode == OPMODE_AP && Level==DOT11POWERSAVE) return FALSE; -#ifdef RTMP_PCI_SUPPORT - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) + { + if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) { pAd->Mlme.bPsPollTimerRunning = FALSE; RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - if ((Level == GUIRADIO_OFF) || (Level == GUI_IDLE_POWER_SAVE)) + } + if ((pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)&& + ((Level == GUIRADIO_OFF) || (Level == GUI_IDLE_POWER_SAVE)) + ||(RTMP_TEST_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND))) + { + // Some chips don't need to delay 6ms, so copy RTMPPCIePowerLinkCtrlRestore + // return condition here. + /* + if (((pAd->MACVersion&0xffff0000) != 0x28600000) + && ((pAd->DeviceID == NIC2860_PCIe_DEVICE_ID) + ||(pAd->DeviceID == NIC2790_PCIe_DEVICE_ID))) + */ { DBGPRINT(RT_DEBUG_TRACE, ("RT28xxPciAsicRadioOn ()\n")); // 1. Set PCI Link Control in Configuration Space. @@ -1115,9 +1191,17 @@ BOOLEAN RT28xxPciAsicRadioOn( RTMPusecDelay(6000); } } -#endif // RTMP_PCI_SUPPORT // + } +#ifdef PCIE_PS_SUPPORT +if (!(((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)))) +#endif // PCIE_PS_SUPPORT // + { pAd->bPCIclkOff = FALSE; + DBGPRINT(RT_DEBUG_TRACE, ("PSM :309xbPCIclkOff == %d\n", pAd->bPCIclkOff)); + } // 2. Send wake up command. AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x02); pAd->bPCIclkOff = FALSE; @@ -1125,10 +1209,32 @@ BOOLEAN RT28xxPciAsicRadioOn( AsicCheckCommanOk(pAd, PowerWakeCID); RTMP_ASIC_INTERRUPT_ENABLE(pAd); - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); if (Level == GUI_IDLE_POWER_SAVE) { +#ifdef PCIE_PS_SUPPORT + + // add by johnli, RF power sequence setup, load RF normal operation-mode setup + if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) + { + RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + + if (pChipOps->AsicReverseRfFromSleepMode) + pChipOps->AsicReverseRfFromSleepMode(pAd); + // 3090 MCU Wakeup command needs more time to be stable. + // Before stable, don't issue other MCU command to prevent from firmware error. + if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) + { + RTMP_SEM_LOCK(&pAd->McuCmdLock); + pAd->brt30xxBanMcuCmd = FALSE; + RTMP_SEM_UNLOCK(&pAd->McuCmdLock); + } + } + else + // end johnli +#endif // PCIE_PS_SUPPORT // { // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. { @@ -1198,11 +1304,13 @@ BOOLEAN RT28xxPciAsicRadioOff( } // Once go into this function, disable tx because don't want too many packets in queue to prevent HW stops. - pAd->bPCIclkOffDisableTx = TRUE; - - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE) && pAd->OpMode == OPMODE_STA) + //pAd->bPCIclkOffDisableTx = TRUE; + RTMP_SET_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) + && pAd->OpMode == OPMODE_STA + &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE + ) { - printk("==>fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE\n"); RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); @@ -1216,12 +1324,22 @@ BOOLEAN RT28xxPciAsicRadioOff( { DBGPRINT(RT_DEBUG_TRACE, ("TbTTTime = 0x%x , give up this sleep. \n", TbTTTime)); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); - pAd->bPCIclkOffDisableTx = FALSE; + //pAd->bPCIclkOffDisableTx = FALSE; + RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); return FALSE; } else { PsPollTime = (64*TbTTTime- LEAD_TIME*1024)/1000; +#ifdef PCIE_PS_SUPPORT + if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) + { + PsPollTime -= 5; + } + else +#endif // PCIE_PS_SUPPORT // PsPollTime -= 3; BeaconPeriodTime = pAd->CommonCfg.BeaconPeriod*102/100; @@ -1233,6 +1351,12 @@ BOOLEAN RT28xxPciAsicRadioOff( } } } + else + { + DBGPRINT(RT_DEBUG_TRACE, ("RT28xxPciAsicRadioOff::Level!=DOT11POWERSAVE \n")); + } + + pAd->bPCIclkOffDisableTx = FALSE; RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); @@ -1315,6 +1439,23 @@ BOOLEAN RT28xxPciAsicRadioOff( pAd->CheckDmaBusyCount = 0; } */ +//KH Debug:My original codes have the follwoing codes, but currecnt codes do not have it. +// Disable for stability. If PCIE Link Control is modified for advance power save, re-covery this code segment. +RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, 0x1280); +//OPSTATUS_SET_FLAG(pAd, fOP_STATUS_CLKSELECT_40MHZ); + +#ifdef PCIE_PS_SUPPORT +if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) + { + DBGPRINT(RT_DEBUG_TRACE, ("RT28xxPciAsicRadioOff::3090 return to skip the following TbttNumToNextWakeUp setting for 279x\n")); + pAd->bPCIclkOff = TRUE; + RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); + // For this case, doesn't need to below actions, so return here. + return brc; + } +#endif // PCIE_PS_SUPPORT // if (Level == DOT11POWERSAVE) { @@ -1335,7 +1476,6 @@ BOOLEAN RT28xxPciAsicRadioOff( RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); } -#ifdef RTMP_PCI_SUPPORT // 4-1. If it's to disable our device. Need to restore PCI Configuration Space to its original value. if (Level == RTMP_HALT && pAd->OpMode == OPMODE_STA) { @@ -1348,9 +1488,9 @@ BOOLEAN RT28xxPciAsicRadioOff( if ((brc == TRUE) && (i < 50)) RTMPPCIeLinkCtrlSetting(pAd, 3); } -#endif // RTMP_PCI_SUPPORT // - pAd->bPCIclkOffDisableTx = FALSE; + //pAd->bPCIclkOffDisableTx = FALSE; + RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); return TRUE; } @@ -1365,41 +1505,37 @@ VOID RT28xxPciMlmeRadioOn( DBGPRINT(RT_DEBUG_TRACE,("%s===>\n", __func__)); - if ((pAd->OpMode == OPMODE_AP) || - ((pAd->OpMode == OPMODE_STA) && (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)))) + if ((pAd->OpMode == OPMODE_AP) || + ((pAd->OpMode == OPMODE_STA) + && (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) + ||pAd->StaCfg.PSControl.field.EnableNewPS == FALSE + ))) { - if (pAd->OpMode == OPMODE_AP) RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); - //NICResetFromError(pAd); RTMPRingCleanUp(pAd, QID_AC_BK); RTMPRingCleanUp(pAd, QID_AC_BE); RTMPRingCleanUp(pAd, QID_AC_VI); RTMPRingCleanUp(pAd, QID_AC_VO); - RTMPRingCleanUp(pAd, QID_HCCA); RTMPRingCleanUp(pAd, QID_MGMT); RTMPRingCleanUp(pAd, QID_RX); - if (pAd->OpMode == OPMODE_STA) - { - AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02); - RTMPusecDelay(10000); - } - // Enable Tx/Rx RTMPEnableRxTx(pAd); // Clear Radio off flag RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); + // Set LED RTMPSetLED(pAd, LED_RADIO_ON); } -#ifdef RTMP_PCI_SUPPORT if ((pAd->OpMode == OPMODE_STA) && - (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))) + (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) + &&(pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) { BOOLEAN Cancelled; @@ -1408,9 +1544,8 @@ VOID RT28xxPciMlmeRadioOn( pAd->Mlme.bPsPollTimerRunning = FALSE; RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); - RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); + RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 40); } -#endif // RTMP_PCI_SUPPORT // } @@ -1455,19 +1590,33 @@ VOID RT28xxPciMlmeRadioOFF( { BOOLEAN Cancelled; + if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) + { if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) { RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &Cancelled); RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); } - - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + // If during power safe mode. + if (pAd->StaCfg.bRadio == TRUE) + { + DBGPRINT(RT_DEBUG_TRACE,("-->MlmeRadioOff() return on bRadio == TRUE; \n")); + return; + } + // Always radio on since the NIC needs to set the MCU command (LED_RADIO_OFF). + if (IDLE_ON(pAd) && + (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) + { + RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); + } + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { BOOLEAN Cancelled; pAd->Mlme.bPsPollTimerRunning = FALSE; RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); } + } // Link down first if any association exists if (INFRA_ON(pAd) || ADHOC_ON(pAd)) @@ -1477,28 +1626,38 @@ VOID RT28xxPciMlmeRadioOFF( // Clean up old bss table BssTableInit(&pAd->ScanTab); - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + /* + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); return; } + */ } - // Set LED + // Set LED.Move to here for fixing LED bug. This flag must be called after LinkDown RTMPSetLED(pAd, LED_RADIO_OFF); - if (pAd->OpMode == OPMODE_AP) +//KH Debug:All PCIe devices need to use timer to execute radio off function, or the PCIe&&EnableNewPS needs. +//KH Ans:It is right, because only when the PCIe and EnableNewPs is true, we need to delay the RadioOffTimer +//to avoid the deadlock with PCIe Power saving function. +if (pAd->OpMode == OPMODE_STA&& + OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)&& + pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) + { + RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); + } +else +{ brc=RT28xxPciAsicRadioOff(pAd, GUIRADIO_OFF, 0); if (brc==FALSE) { DBGPRINT(RT_DEBUG_ERROR,("%s call RT28xxPciAsicRadioOff fail !!\n", __func__)); } - - - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE) && - (pAd->OpMode == OPMODE_STA)) - AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02); +} +/* +*/ } #endif // RTMP_MAC_PCI // diff --git a/drivers/staging/rt2860/common/cmm_profile.c b/drivers/staging/rt2860/common/cmm_profile.c index 2d28524c1392..056cffda42b1 100644 --- a/drivers/staging/rt2860/common/cmm_profile.c +++ b/drivers/staging/rt2860/common/cmm_profile.c @@ -1266,6 +1266,49 @@ NDIS_STATUS RTMPSetProfileParameters( DBGPRINT(RT_DEBUG_TRACE, ("%s::(NetworkType=%d)\n", __func__, pAd->StaCfg.BssType)); } } +#ifdef RTMP_MAC_PCI + //NewPCIePS + if(RTMPGetKeyParameter("NewPCIePS", tmpbuf, 10, pBuffer, TRUE)) + { + UCHAR temp_buffer = (UCHAR) simple_strtol(tmpbuf, 0, 10); + if(temp_buffer>0) + pAd->StaCfg.PSControl.field.EnableNewPS=TRUE; + else + pAd->StaCfg.PSControl.field.EnableNewPS=FALSE; + DBGPRINT(RT_DEBUG_TRACE, ("NewPCIePS=%d\n", pAd->StaCfg.PSControl.field.EnableNewPS)); + } +#endif // RTMP_MAC_PCI // +#ifdef RT3090 + //PCIePowerLevel + + if(RTMPGetKeyParameter("PCIePowerLevel", tmpbuf, 10, pBuffer, TRUE)) + { + pAd->StaCfg.PSControl.field.rt30xxPowerMode = (UCHAR) simple_strtol(tmpbuf, 0, 10); + DBGPRINT(RT_DEBUG_TRACE, ("PCIePowerLevel=%d\n", pAd->StaCfg.PSControl.field.rt30xxPowerMode)); + } + //FollowHostASPM + if(RTMPGetKeyParameter("FollowHostASPM", tmpbuf, 10, pBuffer, TRUE)) + { + UCHAR temp_buffer = (UCHAR) simple_strtol(tmpbuf, 0, 10); + + if(temp_buffer>0) + pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM=TRUE; + else + pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM=FALSE; + DBGPRINT(RT_DEBUG_TRACE, ("rt30xxFollowHostASPM=%d\n", pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM)); + } + //ForceTestASPM + if(RTMPGetKeyParameter("ForceTestASPM", tmpbuf, 10, pBuffer, TRUE)) + { + UCHAR temp_buffer = (UCHAR) simple_strtol(tmpbuf, 0, 10); + + if(temp_buffer>0) + pAd->StaCfg.PSControl.field.rt30xxForceASPMTest=TRUE; + else + pAd->StaCfg.PSControl.field.rt30xxForceASPMTest=FALSE; + DBGPRINT(RT_DEBUG_TRACE, ("rt30xxForceASPM=%d\n", pAd->StaCfg.PSControl.field.rt30xxForceASPMTest)); + } +#endif // RT3090 // //Channel if(RTMPGetKeyParameter("Channel", tmpbuf, 10, pBuffer, TRUE)) { diff --git a/drivers/staging/rt2860/common/cmm_sync.c b/drivers/staging/rt2860/common/cmm_sync.c index 4cb507dbeca1..9be4d50ab5d5 100644 --- a/drivers/staging/rt2860/common/cmm_sync.c +++ b/drivers/staging/rt2860/common/cmm_sync.c @@ -432,19 +432,6 @@ VOID ScanNextChannel( } { -#ifdef RT2860 - /* - If all peer Ad-hoc clients leave, driver would do LinkDown and LinkUp. - In LinkUp, CommonCfg.Ssid would copy SSID from MlmeAux. - To prevent SSID is zero or wrong in Beacon, need to recover MlmeAux.SSID here. - */ - if (ADHOC_ON(pAd)) - { - NdisZeroMemory(pAd->MlmeAux.Ssid, MAX_LEN_OF_SSID); - pAd->MlmeAux.SsidLen = pAd->CommonCfg.SsidLen; - NdisMoveMemory(pAd->MlmeAux.Ssid, pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen); - } -#endif // RT2860 // // // To prevent data lost. // Send an NULL data with turned PSM bit on to current associated AP before SCAN progress. diff --git a/drivers/staging/rt2860/common/mlme.c b/drivers/staging/rt2860/common/mlme.c index 02627c70b2db..7647c090c349 100644 --- a/drivers/staging/rt2860/common/mlme.c +++ b/drivers/staging/rt2860/common/mlme.c @@ -397,7 +397,7 @@ NDIS_STATUS MlmeInit( { #ifdef RTMP_PCI_SUPPORT - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { // only PCIe cards need these two timers RTMPInitTimer(pAd, &pAd->Mlme.PsPollTimer, GET_TIMER_FUNCTION(PsPollWakeExec), pAd, FALSE); @@ -569,7 +569,8 @@ VOID MlmeHalt( #ifdef RTMP_MAC_PCI - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) + &&(pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) { RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); @@ -678,6 +679,7 @@ VOID MlmePeriodicExec( { ULONG TxTotalCnt; PRTMP_ADAPTER pAd = (RTMP_ADAPTER *)FunctionContext; + SHORT realavgrssi; #ifdef RTMP_MAC_PCI { @@ -691,7 +693,27 @@ VOID MlmePeriodicExec( UINT32 data = 0; // Read GPIO pin2 as Hardware controlled radio state +#ifndef RT3090 RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &data); +#endif // RT3090 // +//KH(PCIE PS):Added based on Jane<-- +#ifdef RT3090 +// Read GPIO pin2 as Hardware controlled radio state +// We need to Read GPIO if HW said so no mater what advance power saving +if ((pAd->OpMode == OPMODE_STA) && (IDLE_ON(pAd)) + && (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF)) + && (pAd->StaCfg.PSControl.field.EnablePSinIdle == TRUE)) + { + // Want to make sure device goes to L0 state before reading register. + RTMPPCIeLinkCtrlValueRestore(pAd, 0); + RTMP_IO_FORCE_READ32(pAd, GPIO_CTRL_CFG, &data); + RTMPPCIeLinkCtrlSetting(pAd, 3); + } +else + RTMP_IO_FORCE_READ32(pAd, GPIO_CTRL_CFG, &data); +#endif // RT3090 // +//KH(PCIE PS):Added based on Jane--> + if (data & 0x04) { pAd->StaCfg.bHwRadio = TRUE; @@ -1187,6 +1209,60 @@ VOID STAMlmePeriodicExec( } } #endif +#ifdef PCIE_PS_SUPPORT +// don't perform idle-power-save mechanism within 3 min after driver initialization. +// This can make rebooter test more robust +if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) + { + if ((pAd->OpMode == OPMODE_STA) && (IDLE_ON(pAd)) + && (pAd->Mlme.SyncMachine.CurrState == SYNC_IDLE) + && (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) + && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) + { + if (IS_RT3090(pAd)|| IS_RT3572(pAd) || IS_RT3390(pAd)) + { + if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) + { + DBGPRINT(RT_DEBUG_TRACE, ("%s::%d\n",__FUNCTION__,__LINE__)); + + RT28xxPciAsicRadioOff(pAd, GUI_IDLE_POWER_SAVE, 0); + } + else + { + DBGPRINT(RT_DEBUG_TRACE, ("%s::%d\n",__FUNCTION__,__LINE__)); + AsicSendCommandToMcu(pAd, 0x30, PowerSafeCID, 0xff, 0x2); + // Wait command success + AsicCheckCommanOk(pAd, PowerSafeCID); + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); + DBGPRINT(RT_DEBUG_TRACE, ("PSM - rt30xx Issue Sleep command)\n")); + } + } + else if (pAd->Mlme.OneSecPeriodicRound > 180) + { + if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) + { + DBGPRINT(RT_DEBUG_TRACE, ("%s::%d\n",__FUNCTION__,__LINE__)); + RT28xxPciAsicRadioOff(pAd, GUI_IDLE_POWER_SAVE, 0); + } + else + { + DBGPRINT(RT_DEBUG_TRACE, ("%s::%d\n",__FUNCTION__,__LINE__)); + AsicSendCommandToMcu(pAd, 0x30, PowerSafeCID, 0xff, 0x02); + // Wait command success + AsicCheckCommanOk(pAd, PowerSafeCID); + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); + DBGPRINT(RT_DEBUG_TRACE, ("PSM - rt28xx Issue Sleep command)\n")); + } + } + } + else + { + DBGPRINT(RT_DEBUG_TRACE,("STAMlmePeriodicExec MMCHK - CommonCfg.Ssid[%d]=%c%c%c%c... MlmeAux.Ssid[%d]=%c%c%c%c...\n", + pAd->CommonCfg.SsidLen, pAd->CommonCfg.Ssid[0], pAd->CommonCfg.Ssid[1], pAd->CommonCfg.Ssid[2], pAd->CommonCfg.Ssid[3], + pAd->MlmeAux.SsidLen, pAd->MlmeAux.Ssid[0], pAd->MlmeAux.Ssid[1], pAd->MlmeAux.Ssid[2], pAd->MlmeAux.Ssid[3])); + } + } +#endif // PCIE_PS_SUPPORT // if (pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_DISABLE) { @@ -1275,10 +1351,6 @@ VOID STAMlmePeriodicExec( { DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - No BEACON. Dead CQI. Auto Recovery attempt #%ld\n", pAd->RalinkCounters.BadCQIAutoRecoveryCount)); - if ((pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) && - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2)) - pAd->StaCfg.bLostAp = TRUE; - // Lost AP, send disconnect & link down event LinkDown(pAd, FALSE); @@ -2240,10 +2312,6 @@ VOID MlmeDynamicTxRateSwitching( } pEntry->LastTxOkCount = TxSuccess; -#ifdef RT2860 - pNextTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(pEntry->CurrTxRateIndex+1)*5]; -#endif // RT2860 // -#if defined(RT2870) || defined(RT3070) { UCHAR tmpTxRate; @@ -2261,7 +2329,6 @@ VOID MlmeDynamicTxRateSwitching( pNextTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(tmpTxRate+1)*5]; } -#endif // RT2870 // if (bTxRateChanged && pNextTxRate) { MlmeSetTxRate(pAd, pEntry, pNextTxRate); @@ -3805,14 +3872,6 @@ VOID BssTableSsidSort( DBGPRINT(RT_DEBUG_TRACE,("STA is in N-only Mode, this AP don't have Ht capability in Beacon.\n")); continue; } -#ifdef RT2860 - if ((pAd->CommonCfg.PhyMode == PHY_11GN_MIXED) && - ((pInBss->SupRateLen + pInBss->ExtRateLen) < 12)) - { - DBGPRINT(RT_DEBUG_TRACE,("STA is in GN-only Mode, this AP is in B mode.\n")); - continue; - } -#endif // RT2860 // // New for WPA2 // Check the Authmode first if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) @@ -3921,14 +3980,7 @@ VOID BssTableSsidSort( DBGPRINT(RT_DEBUG_TRACE,("STA is in N-only Mode, this AP don't have Ht capability in Beacon.\n")); continue; } -#ifdef RT2860 - if ((pAd->CommonCfg.PhyMode == PHY_11GN_MIXED) && - ((pInBss->SupRateLen + pInBss->ExtRateLen) < 12)) - { - DBGPRINT(RT_DEBUG_TRACE,("STA is in GN-only Mode, this AP is in B mode.\n")); - continue; - } -#endif // RT2860 // + // New for WPA2 // Check the Authmode first if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) @@ -5495,6 +5547,9 @@ VOID AsicEvaluateRxAnt( #ifdef RT30xx || (pAd->EepromAccess) #endif // RT30xx // +#ifdef RT3090 + || (pAd->bPCIclkOff == TRUE) +#endif // RT3090 // ) return; @@ -5583,6 +5638,9 @@ VOID AsicRxAntEvalTimeout( #ifdef RT30xx || (pAd->EepromAccess) #endif // RT30xx // +#ifdef RT3090 + || (pAd->bPCIclkOff == TRUE) +#endif // RT3090 // ) return; diff --git a/drivers/staging/rt2860/common/rt_rf.c b/drivers/staging/rt2860/common/rt_rf.c index 34a6fcae120f..e9f9384b024a 100644 --- a/drivers/staging/rt2860/common/rt_rf.c +++ b/drivers/staging/rt2860/common/rt_rf.c @@ -187,6 +187,14 @@ VOID RtmpChipOpsRFHook( } } #endif // RT3070 // +#ifdef RT3090 + if (IS_RT3090(pAd) && (pAd->infType == RTMP_DEV_INF_PCI)) + { + pChipOps->AsicRfTurnOff = RT30xxLoadRFSleepModeSetup; + pChipOps->AsicRfInit = NICInitRT3090RFRegisters; + pChipOps->AsicReverseRfFromSleepMode = RT30xxReverseRFSleepModeSetup; + } +#endif // RT3090 // } #endif // RT30xx // } diff --git a/drivers/staging/rt2860/common/rtmp_init.c b/drivers/staging/rt2860/common/rtmp_init.c index 1dd4c829291f..3b43101102f3 100644 --- a/drivers/staging/rt2860/common/rtmp_init.c +++ b/drivers/staging/rt2860/common/rtmp_init.c @@ -191,6 +191,9 @@ NDIS_STATUS RTMPAllocAdapterBlock( NdisAllocateSpinLock(&pAd->MgmtRingLock); #ifdef RTMP_MAC_PCI NdisAllocateSpinLock(&pAd->RxRingLock); +#ifdef RT3090 + NdisAllocateSpinLock(&pAd->McuCmdLock); +#endif // RT3090 // #endif // RTMP_MAC_PCI // for (index =0 ; index < NUM_OF_TX_RING; index++) @@ -1238,7 +1241,13 @@ VOID NICInitAsicFromEEPROM( { RTMPSetLED(pAd, LED_RADIO_ON); #ifdef RTMP_MAC_PCI +#ifdef RT3090 + AsicSendCommandToMcu(pAd, 0x30, PowerRadioOffCID, 0xff, 0x02); + AsicCheckCommanOk(pAd, PowerRadioOffCID); +#endif // RT3090 // +#ifndef RT3090 AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02); +#endif // RT3090 // AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x00); // 2-1. wait command ok. AsicCheckCommanOk(pAd, PowerWakeCID); @@ -1246,6 +1255,29 @@ VOID NICInitAsicFromEEPROM( } } +#ifdef RTMP_MAC_PCI +#ifdef RT30xx + if (IS_RT3090(pAd)|| IS_RT3572(pAd) || IS_RT3390(pAd)) + { + RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + if (pChipOps->AsicReverseRfFromSleepMode) + pChipOps->AsicReverseRfFromSleepMode(pAd); + } + // 3090 MCU Wakeup command needs more time to be stable. + // Before stable, don't issue other MCU command to prevent from firmware error. + + if ((IS_RT3090(pAd)|| IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) + { + DBGPRINT(RT_DEBUG_TRACE,("%s::%d,release Mcu Lock\n",__FUNCTION__,__LINE__)); + RTMP_SEM_LOCK(&pAd->McuCmdLock); + pAd->brt30xxBanMcuCmd = FALSE; + RTMP_SEM_UNLOCK(&pAd->McuCmdLock); + } +#endif // RT30xx // +#endif // RTMP_MAC_PCI // + // Turn off patching for cardbus controller if (NicConfig2.field.CardbusAcceleration == 1) { @@ -1443,11 +1475,6 @@ retry: RTMP_IO_WRITE32(pAd, TX_BASE_PTR3, Value); DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR3 : 0x%x\n", Value)); - // Write HCCA base address register - Value = RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_HCCA].Cell[0].AllocPa); - RTMP_IO_WRITE32(pAd, TX_BASE_PTR4, Value); - DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR4 : 0x%x\n", Value)); - // Write MGMT_BASE_CSR register Value = RTMP_GetPhysicalAddressLow(pAd->MgmtRing.Cell[0].AllocPa); RTMP_IO_WRITE32(pAd, TX_BASE_PTR5, Value); @@ -1641,7 +1668,7 @@ NDIS_STATUS NICInitializeAsic( for(Index=0; Index +#endif // RT3090 // RTMPusecDelay(1000); // Read BBP register, make sure BBP is up and running before write new data @@ -2588,6 +2620,8 @@ VOID UserCfgInit( pAd->LedIndicatorStrength = 0; pAd->RLnkCtrlOffset = 0; pAd->HostLnkCtrlOffset = 0; + pAd->StaCfg.PSControl.field.EnableNewPS=TRUE; + pAd->CheckDmaBusyCount = 0; #endif // RTMP_MAC_PCI // pAd->bAutoTxAgcA = FALSE; // Default is OFF @@ -2600,8 +2634,6 @@ VOID UserCfgInit( pAd->bForcePrintRX = FALSE; pAd->bStaFifoTest = FALSE; pAd->bProtectionTest = FALSE; - pAd->bHCCATest = FALSE; - pAd->bGenOneHCCA = FALSE; pAd->CommonCfg.Dsifs = 10; // in units of usec pAd->CommonCfg.TxPower = 100; //mW pAd->CommonCfg.TxPowerPercentage = 0xffffffff; // AUTO @@ -2720,6 +2752,15 @@ VOID UserCfgInit( pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; } +#ifdef PCIE_PS_SUPPORT +pAd->brt30xxBanMcuCmd = FALSE; +pAd->b3090ESpecialChip = FALSE; +//KH Debug:the following must be removed +pAd->StaCfg.PSControl.field.rt30xxPowerMode=3; +pAd->StaCfg.PSControl.field.rt30xxForceASPMTest=0; +pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM=1; +#endif // PCIE_PS_SUPPORT // + // global variables mXXXX used in MAC protocol state machines OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_ADHOC_ON); @@ -2757,6 +2798,9 @@ VOID UserCfgInit( pAd->StaCfg.LastScanTime -= (10 * OS_HZ); NdisZeroMemory(pAd->nickname, IW_ESSID_MAX_SIZE+1); +#ifdef RTMP_MAC_PCI + sprintf((PSTRING) pAd->nickname, "RT2860STA"); +#endif // RTMP_MAC_PCI // #ifdef RTMP_MAC_USB sprintf((PSTRING) pAd->nickname, "RT2870STA"); #endif // RTMP_MAC_USB // @@ -2766,7 +2810,6 @@ VOID UserCfgInit( pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_DISABLE; pAd->StaCfg.bRSN_IE_FromWpaSupplicant = FALSE; pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_ENABLE; - pAd->StaCfg.bLostAp = FALSE; NdisZeroMemory(pAd->StaCfg.ReplayCounter, 8); @@ -3272,7 +3315,7 @@ int rt28xx_init( // NICLoadFirmware will hang forever when interface is up again. // RT2860 PCI if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) && - OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { AUTO_WAKEUP_STRUC AutoWakeupCfg; AsicForceWakeup(pAd, TRUE); @@ -3307,6 +3350,16 @@ int rt28xx_init( DBGPRINT(RT_DEBUG_TRACE, ("MAC_CSR0 [ Ver:Rev=0x%08x]\n", pAd->MACVersion)); #ifdef RTMP_MAC_PCI +#ifdef PCIE_PS_SUPPORT + /*Iverson patch PCIE L1 issue to make sure that driver can be read,write ,BBP and RF register at pcie L.1 level */ + if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))&&OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) + { + RTMP_IO_READ32(pAd, AUX_CTRL, &MacCsr0); + MacCsr0 |= 0x402; + RTMP_IO_WRITE32(pAd, AUX_CTRL, MacCsr0); + DBGPRINT(RT_DEBUG_TRACE, ("AUX_CTRL = 0x%x\n", MacCsr0)); + } +#endif // PCIE_PS_SUPPORT // // To fix driver disable/enable hang issue when radio off RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x2); diff --git a/drivers/staging/rt2860/common/rtmp_mcu.c b/drivers/staging/rt2860/common/rtmp_mcu.c index 24531c58f90e..229ea05e9336 100644 --- a/drivers/staging/rt2860/common/rtmp_mcu.c +++ b/drivers/staging/rt2860/common/rtmp_mcu.c @@ -38,8 +38,9 @@ #include "../rt_config.h" -#ifdef RT2860 +#if defined(RT2860) || defined(RT3090) #include "firmware.h" +#include "../../rt3090/firmware.h" #endif #ifdef RT2870 #include "../../rt3070/firmware.h" @@ -115,20 +116,18 @@ NDIS_STATUS RtmpAsicLoadFirmware( { NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - PUCHAR pFirmwareImage; + PUCHAR pFirmwareImage = NULL; ULONG FileLength, Index; - //ULONG firm; UINT32 MacReg = 0; UINT32 Version = (pAd->MACVersion >> 16); -// pFirmwareImage = FirmwareImage; -// FileLength = sizeof(FirmwareImage); - // New 8k byte firmware size for RT3071/RT3072 { #ifdef RTMP_MAC_PCI - if ((Version == 0x2860) || (Version == 0x3572) || IS_RT3090(pAd)) - { + if (IS_RT3090(pAd) || IS_RT3390(pAd)) { + pFirmwareImage = FirmwareImage_3090; + FileLength = FIRMWAREIMAGE_MAX_LENGTH; + } else { pFirmwareImage = FirmwareImage_2860; FileLength = FIRMWAREIMAGE_MAX_LENGTH; } @@ -190,9 +189,72 @@ INT RtmpAsicSendCommandToMcu( HOST_CMD_CSR_STRUC H2MCmd; H2M_MAILBOX_STRUC H2MMailbox; ULONG i = 0; -#ifdef RTMP_MAC_PCI -#endif // RTMP_MAC_PCI // +#ifdef PCIE_PS_SUPPORT + // 3090F power solution 3 has hw limitation that needs to ban all mcu command + // when firmware is in radio state. For other chip doesn't have this limitation. + if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) + { + RTMP_SEM_LOCK(&pAd->McuCmdLock); + if ((pAd->brt30xxBanMcuCmd == TRUE) + && (Command != WAKE_MCU_CMD) && (Command != RFOFF_MCU_CMD)) + { + RTMP_SEM_UNLOCK(&pAd->McuCmdLock); + DBGPRINT(RT_DEBUG_TRACE, (" Ban Mcu Cmd %x in sleep mode\n", Command)); + return FALSE; + } + else if ((Command == SLEEP_MCU_CMD) + ||(Command == RFOFF_MCU_CMD)) + { + pAd->brt30xxBanMcuCmd = TRUE; + } + else if (Command != WAKE_MCU_CMD) + { + pAd->brt30xxBanMcuCmd = FALSE; + } + + RTMP_SEM_UNLOCK(&pAd->McuCmdLock); + + } + if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) + && (Command == WAKE_MCU_CMD)) + { + + do + { + RTMP_IO_FORCE_READ32(pAd, H2M_MAILBOX_CSR, &H2MMailbox.word); + if (H2MMailbox.field.Owner == 0) + break; + + RTMPusecDelay(2); + DBGPRINT(RT_DEBUG_INFO, ("AsicSendCommanToMcu::Mail box is busy\n")); + } while(i++ < 100); + + if (i >= 100) + { + DBGPRINT_ERR(("H2M_MAILBOX still hold by MCU. command fail\n")); + return FALSE; + } + + H2MMailbox.field.Owner = 1; // pass ownership to MCU + H2MMailbox.field.CmdToken = Token; + H2MMailbox.field.HighByte = Arg1; + H2MMailbox.field.LowByte = Arg0; + RTMP_IO_FORCE_WRITE32(pAd, H2M_MAILBOX_CSR, H2MMailbox.word); + + H2MCmd.word = 0; + H2MCmd.field.HostCommand = Command; + RTMP_IO_FORCE_WRITE32(pAd, HOST_CMD_CSR, H2MCmd.word); + + + } + else +#endif // PCIE_PS_SUPPORT // + { do { RTMP_IO_READ32(pAd, H2M_MAILBOX_CSR, &H2MMailbox.word); @@ -228,6 +290,22 @@ INT RtmpAsicSendCommandToMcu( if (Command != 0x80) { } +} +#ifdef PCIE_PS_SUPPORT + // 3090 MCU Wakeup command needs more time to be stable. + // Before stable, don't issue other MCU command to prevent from firmware error. + if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) + && (Command == WAKE_MCU_CMD)) + { + RTMPusecDelay(2000); + //Put this is after RF programming. + //NdisAcquireSpinLock(&pAd->McuCmdLock); + //pAd->brt30xxBanMcuCmd = FALSE; + //NdisReleaseSpinLock(&pAd->McuCmdLock); + } +#endif // PCIE_PS_SUPPORT // return TRUE; } diff --git a/drivers/staging/rt2860/common/rtmp_timer.c b/drivers/staging/rt2860/common/rtmp_timer.c index 258ab1bb0f03..fa77f5d26c73 100644 --- a/drivers/staging/rt2860/common/rtmp_timer.c +++ b/drivers/staging/rt2860/common/rtmp_timer.c @@ -59,10 +59,10 @@ BUILD_TIMER_FUNCTION(DisassocTimeout); BUILD_TIMER_FUNCTION(LinkDownExec); BUILD_TIMER_FUNCTION(StaQuickResponeForRateUpExec); BUILD_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc); -#ifdef RTMP_PCI_SUPPORT +#ifdef RTMP_MAC_PCI BUILD_TIMER_FUNCTION(PsPollWakeExec); BUILD_TIMER_FUNCTION(RadioOnExec); -#endif // RTMP_PCI_SUPPORT // +#endif // RTMP_MAC_PCI // #ifdef RTMP_MAC_USB BUILD_TIMER_FUNCTION(RtmpUsbStaAsicForceWakeupTimeout); #endif // RTMP_MAC_USB // diff --git a/drivers/staging/rt2860/iface/rtmp_pci.h b/drivers/staging/rt2860/iface/rtmp_pci.h index aa66ff7e8fd6..7d7efbd9e272 100644 --- a/drivers/staging/rt2860/iface/rtmp_pci.h +++ b/drivers/staging/rt2860/iface/rtmp_pci.h @@ -38,9 +38,7 @@ #define RT28XX_PUT_DEVICE(dev_p) -#ifndef SA_SHIRQ #define SA_SHIRQ IRQF_SHARED -#endif #ifdef PCI_MSI_SUPPORT #define RTMP_MSI_ENABLE(_pAd) \ diff --git a/drivers/staging/rt2860/pci_main_dev.c b/drivers/staging/rt2860/pci_main_dev.c index 5f39c44d78f7..0df1ac8162b4 100644 --- a/drivers/staging/rt2860/pci_main_dev.c +++ b/drivers/staging/rt2860/pci_main_dev.c @@ -38,6 +38,13 @@ #include "rt_config.h" #include +// Following information will be show when you run 'modinfo' +// *** If you have a solution for the bug in current version of driver, please mail to me. +// Otherwise post to forum in ralinktech's web site(www.ralinktech.com) and let all users help you. *** +MODULE_AUTHOR("Jett Chen "); +MODULE_DESCRIPTION("RT2860/RT3090 Wireless Lan Linux Driver"); +MODULE_LICENSE("GPL"); + // // Function declarations // @@ -63,6 +70,7 @@ static int rt2860_resume(struct pci_dev *pci_dev); // static struct pci_device_id rt2860_pci_tbl[] __devinitdata = { +#ifdef RT2860 {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2860_PCI_DEVICE_ID)}, //RT28602.4G {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2860_PCIe_DEVICE_ID)}, {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2760_PCI_DEVICE_ID)}, @@ -75,11 +83,21 @@ static struct pci_device_id rt2860_pci_tbl[] __devinitdata = {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7738)}, {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7748)}, {PCI_DEVICE(EDIMAX_PCI_VENDOR_ID, 0x7768)}, +#endif +#ifdef RT3090 + {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3090_PCIe_DEVICE_ID)}, + {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3091_PCIe_DEVICE_ID)}, + {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3092_PCIe_DEVICE_ID)}, +#endif // RT3090 // +#ifdef RT3390 + {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3390_PCIe_DEVICE_ID)}, + {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3391_PCIe_DEVICE_ID)}, + {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3392_PCIe_DEVICE_ID)}, +#endif // RT3390 // {0,} // terminate list }; MODULE_DEVICE_TABLE(pci, rt2860_pci_tbl); -MODULE_LICENSE("GPL"); #ifdef MODULE_VERSION MODULE_VERSION(STA_DRIVER_VERSION); #endif @@ -363,9 +381,6 @@ static INT __devinit rt2860_probe( pAd->StaCfg.OriDevType = net_dev->type; RTMPInitPCIeDevice(pci_dev, pAd); -#ifdef KTHREAD_SUPPORT -#endif // KTHREAD_SUPPORT // - DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_probe\n")); return 0; // probe ok @@ -478,11 +493,17 @@ BOOLEAN RT28XXChipsetCheck( pci_read_config_word(pci_dev, PCI_DEVICE_ID, &device_id); device_id = le2cpu16(device_id); pObj->DeviceID = device_id; - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE); if ( +#ifdef RT2860 (device_id == NIC2860_PCIe_DEVICE_ID) || (device_id == NIC2790_PCIe_DEVICE_ID) || (device_id == VEN_AWT_PCIe_DEVICE_ID) || +#endif +#ifdef RT3090 + (device_id == NIC3090_PCIe_DEVICE_ID) || + (device_id == NIC3091_PCIe_DEVICE_ID) || + (device_id == NIC3092_PCIe_DEVICE_ID) || +#endif // RT3090 // 0) { UINT32 MacCsr0 = 0, Index= 0; @@ -500,7 +521,7 @@ BOOLEAN RT28XXChipsetCheck( // MAC version at offset 0x1000 is 0x2872XXXX/0x2870XXXX(PCIe, USB, SDIO). if ((MacCsr0&0xffff0000) != 0x28600000) { - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE); + OPSTATUS_SET_FLAG(pAd, fOP_STATUS_PCIE_DEVICE); } } } @@ -511,24 +532,26 @@ VOID RTMPInitPCIeLinkCtrlValue( { INT pos; USHORT reg16, data2, PCIePowerSaveLevel, Configuration; + UINT32 MacValue; BOOLEAN bFindIntel = FALSE; POS_COOKIE pObj; pObj = (POS_COOKIE) pAd->OS_Cookie; - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) return; DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __func__)); // Init EEPROM, and save settings - if (!IS_RT3090(pAd)) + if (!(IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) { RT28xx_EEPROM_READ16(pAd, 0x22, PCIePowerSaveLevel); pAd->PCIePowerSaveLevel = PCIePowerSaveLevel & 0xff; + pAd->LnkCtrlBitMask = 0; if ((PCIePowerSaveLevel&0xff) == 0xff) { - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE); + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_PCIE_DEVICE); DBGPRINT(RT_DEBUG_TRACE, ("====> PCIePowerSaveLevel = 0x%x.\n", PCIePowerSaveLevel)); return; } @@ -563,40 +586,108 @@ VOID RTMPInitPCIeLinkCtrlValue( pAd->LnkCtrlBitMask = 0x103; break; } + RT28xx_EEPROM_READ16(pAd, 0x24, data2); + if ((PCIePowerSaveLevel&0xff) != 0xff) + { + PCIePowerSaveLevel &= 0x3; + + if( !(((data2&0xff00) == 0x9200) && ((data2&0x80) !=0)) ) + { + if (PCIePowerSaveLevel > 1 ) + PCIePowerSaveLevel = 1; + } + + DBGPRINT(RT_DEBUG_TRACE, ("====> rt28xx Write 0x83 Command = 0x%x.\n", PCIePowerSaveLevel)); + printk("\n\n\n%s:%d\n",__FUNCTION__,__LINE__); + + AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSaveLevel, 0x00); + } DBGPRINT(RT_DEBUG_TRACE, ("====> LnkCtrlBitMask = 0x%x.\n", pAd->LnkCtrlBitMask)); } } - else if (IS_RT3090(pAd)) + else if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) { + UCHAR LinkCtrlSetting = 0; + + // Check 3090E special setting chip. + RT28xx_EEPROM_READ16(pAd, 0x24, data2); + if ((data2 == 0x9280) && ((pAd->MACVersion&0xffff) == 0x0211)) + { + pAd->b3090ESpecialChip = TRUE; + DBGPRINT_RAW(RT_DEBUG_ERROR,("Special 3090E chip \n")); + } + + RTMP_IO_READ32(pAd, AUX_CTRL, &MacValue); + //enable WAKE_PCIE function, which forces to enable PCIE clock when mpu interrupt asserting. + //Force PCIE 125MHz CLK to toggle + MacValue |= 0x402; + RTMP_IO_WRITE32(pAd, AUX_CTRL, MacValue); + DBGPRINT_RAW(RT_DEBUG_ERROR,(" AUX_CTRL = 0x%32x\n", MacValue)); + + + + // for RT30xx F and after, PCIe infterface, and for power solution 3 + if ((IS_VERSION_AFTER_F(pAd)) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode >= 2) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode <= 3)) + { + RTMP_IO_READ32(pAd, AUX_CTRL, &MacValue); + DBGPRINT_RAW(RT_DEBUG_ERROR,(" Read AUX_CTRL = 0x%x\n", MacValue)); + // turn on bit 12. + //enable 32KHz clock mode for power saving + MacValue |= 0x1000; + if (MacValue != 0xffffffff) + { + RTMP_IO_WRITE32(pAd, AUX_CTRL, MacValue); + DBGPRINT_RAW(RT_DEBUG_ERROR,(" Write AUX_CTRL = 0x%x\n", MacValue)); + // 1. if use PCIePowerSetting is 2 or 3, need to program OSC_CTRL to 0x3ff11. + MacValue = 0x3ff11; + RTMP_IO_WRITE32(pAd, OSC_CTRL, MacValue); + DBGPRINT_RAW(RT_DEBUG_ERROR,(" OSC_CTRL = 0x%x\n", MacValue)); + // 2. Write PCI register Clk ref bit + RTMPrt3xSetPCIePowerLinkCtrl(pAd); + } + else + { + // Error read Aux_Ctrl value. Force to use solution 1 + DBGPRINT(RT_DEBUG_ERROR,(" Error Value in AUX_CTRL = 0x%x\n", MacValue)); + pAd->StaCfg.PSControl.field.rt30xxPowerMode = 1; + DBGPRINT(RT_DEBUG_ERROR,(" Force to use power solution1 \n")); + } + } // 1. read setting from inf file. - // ..... - USHORT PCIePowerSetting = 0; - /* code from windows, default value of rt30xxPowerMode = 0 - PCIePowerSetting = pAd->StaCfg.PSControl.field.rt30xxPowerMode; - */ - DBGPRINT(RT_DEBUG_TRACE, ("====> rt30xx Read PowerLevelMode = 0x%x.\n", PCIePowerSetting)); - // 2. Check EnableNewPS - /* + + PCIePowerSaveLevel = (USHORT)pAd->StaCfg.PSControl.field.rt30xxPowerMode; + DBGPRINT(RT_DEBUG_ERROR, ("====> rt30xx Read PowerLevelMode = 0x%x.\n", PCIePowerSaveLevel)); + // 2. Check EnableNewPS. if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) - PCIePowerSetting = 1; - */ + PCIePowerSaveLevel = 1; - if ((pAd->MACVersion&0xffff) <= 0x0211) + if (IS_VERSION_BEFORE_F(pAd) && (pAd->b3090ESpecialChip == FALSE)) { - // Chip Version E only allow 1 - PCIePowerSetting = 1; - DBGPRINT(RT_DEBUG_TRACE, ("====> rt30xx Write 0x83 Command = 0x%x.\n", PCIePowerSetting)); - AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSetting, 0x00); + // Chip Version E only allow 1, So force set 1. + PCIePowerSaveLevel &= 0x1; + pAd->PCIePowerSaveLevel = (USHORT)PCIePowerSaveLevel; + DBGPRINT(RT_DEBUG_TRACE, ("====> rt30xx E Write 0x83 Command = 0x%x.\n", PCIePowerSaveLevel)); + + AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSaveLevel, 0x00); } else { - // Chip Version F only allow 1 or 2 - if ((PCIePowerSetting > 2) || (PCIePowerSetting == 0)) - PCIePowerSetting = 1; - DBGPRINT(RT_DEBUG_TRACE, ("====> rt30xx Write 0x83 Command = 0x%x.\n", PCIePowerSetting)); - AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSetting, 0x00); + // Chip Version F and after only allow 1 or 2 or 3. This might be modified after new chip version come out. + if (!((PCIePowerSaveLevel == 1) || (PCIePowerSaveLevel == 3))) + PCIePowerSaveLevel = 1; + DBGPRINT(RT_DEBUG_ERROR, ("====> rt30xx F Write 0x83 Command = 0x%x.\n", PCIePowerSaveLevel)); + pAd->PCIePowerSaveLevel = (USHORT)PCIePowerSaveLevel; + // for 3090F , we need to add high-byte arg for 0x83 command to indicate the link control setting in + // PCI Configuration Space. Because firmware can't read PCI Configuration Space + if ((pAd->Rt3xxRalinkLinkCtrl & 0x2) && (pAd->Rt3xxHostLinkCtrl & 0x2)) + { + LinkCtrlSetting = 1; + } + DBGPRINT(RT_DEBUG_TRACE, ("====> rt30xxF LinkCtrlSetting = 0x%x.\n", LinkCtrlSetting)); + AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSaveLevel, LinkCtrlSetting); } - } // Find Ralink PCIe Device's Express Capability Offset @@ -613,6 +704,7 @@ VOID RTMPInitPCIeLinkCtrlValue( pAd->RLnkCtrlConfiguration = (Configuration & 0x103); Configuration &= 0xfefc; Configuration |= (0x0); +#ifdef RT2860 if ((pObj->DeviceID == NIC2860_PCIe_DEVICE_ID) ||(pObj->DeviceID == NIC2790_PCIe_DEVICE_ID)) { @@ -621,6 +713,7 @@ VOID RTMPInitPCIeLinkCtrlValue( DBGPRINT(RT_DEBUG_TRACE, ("Write (Ralink PCIe Link Control Register) offset 0x%x = 0x%x\n", pos + PCI_EXP_LNKCTL, Configuration)); } +#endif // RT2860 // RTMPFindHostPCIDev(pAd); if (pObj->parent_pci_dev) @@ -630,7 +723,10 @@ VOID RTMPInitPCIeLinkCtrlValue( pci_read_config_word(pObj->parent_pci_dev, PCI_VENDOR_ID, &vendor_id); vendor_id = le2cpu16(vendor_id); if (vendor_id == PCIBUS_INTEL_VENDOR) + { bFindIntel = TRUE; + RTMP_SET_PSFLAG(pAd, fRTMP_PS_TOGGLE_L1); + } // Find PCI-to-PCI Bridge Express Capability Offset pos = pci_find_capability(pObj->parent_pci_dev, PCI_CAP_ID_EXP); @@ -650,10 +746,20 @@ VOID RTMPInitPCIeLinkCtrlValue( switch (pObj->DeviceID) { +#ifdef RT2860 case NIC2860_PCIe_DEVICE_ID: case NIC2790_PCIe_DEVICE_ID: bChange = TRUE; break; +#endif // RT2860 // +#ifdef RT3090 + case NIC3090_PCIe_DEVICE_ID: + case NIC3091_PCIe_DEVICE_ID: + case NIC3092_PCIe_DEVICE_ID: + if (bFindIntel == FALSE) + bChange = TRUE; + break; +#endif // RT3090 // default: break; } @@ -686,6 +792,11 @@ VOID RTMPInitPCIeLinkCtrlValue( // Doesn't switch L0, L1, So set PCIePowerSaveLevel to 0xff pAd->PCIePowerSaveLevel = 0xff; if ((pAd->RLnkCtrlOffset != 0) +#ifdef RT3090 + && ((pObj->DeviceID == NIC3090_PCIe_DEVICE_ID) + ||(pObj->DeviceID == NIC3091_PCIe_DEVICE_ID) + ||(pObj->DeviceID == NIC3092_PCIe_DEVICE_ID)) +#endif // RT3090 // ) { pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, ®16); @@ -714,7 +825,7 @@ VOID RTMPFindHostPCIDev( pObj = (POS_COOKIE) pAd->OS_Cookie; - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) return; DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __func__)); @@ -761,12 +872,27 @@ VOID RTMPPCIeLinkCtrlValueRestore( pObj = (POS_COOKIE) pAd->OS_Cookie; - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) return; +#ifdef RT2860 if (!((pObj->DeviceID == NIC2860_PCIe_DEVICE_ID) ||(pObj->DeviceID == NIC2790_PCIe_DEVICE_ID))) return; +#endif // RT2860 // + // Check PSControl Configuration + if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) + return TRUE; + + //3090 will not execute the following codes. + // Check interface : If not PCIe interface, return. + +#ifdef RT3090 + if ((pObj->DeviceID == NIC3090_PCIe_DEVICE_ID) + ||(pObj->DeviceID == NIC3091_PCIe_DEVICE_ID) + ||(pObj->DeviceID == NIC3092_PCIe_DEVICE_ID)) + return; +#endif // RT3090 // DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __func__)); PCIePowerSaveLevel = pAd->PCIePowerSaveLevel; @@ -840,12 +966,32 @@ VOID RTMPPCIeLinkCtrlSetting( pObj = (POS_COOKIE) pAd->OS_Cookie; - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) return; +#ifdef RT2860 if (!((pObj->DeviceID == NIC2860_PCIe_DEVICE_ID) ||(pObj->DeviceID == NIC2790_PCIe_DEVICE_ID))) return; +#endif // RT2860 // + // Check PSControl Configuration + if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) + return TRUE; + + // Check interface : If not PCIe interface, return. + //Block 3090 to enter the following function + +#ifdef RT3090 + if ((pObj->DeviceID == NIC3090_PCIe_DEVICE_ID) + ||(pObj->DeviceID == NIC3091_PCIe_DEVICE_ID) + ||(pObj->DeviceID == NIC3092_PCIe_DEVICE_ID)) + return; +#endif // RT3090 // + if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP)) + { + DBGPRINT(RT_DEBUG_INFO, ("RTMPPCIePowerLinkCtrl return on fRTMP_PS_CAN_GO_SLEEP flag\n")); + return; + } DBGPRINT(RT_DEBUG_TRACE,("%s===>\n", __func__)); PCIePowerSaveLevel = pAd->PCIePowerSaveLevel; @@ -856,6 +1002,35 @@ VOID RTMPPCIeLinkCtrlSetting( } PCIePowerSaveLevel = PCIePowerSaveLevel>>6; + // Skip non-exist deice right away + if (pObj->parent_pci_dev && (pAd->HostLnkCtrlOffset != 0)) + { + PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, Configuration); + switch (PCIePowerSaveLevel) + { + case 0: + // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 00 + Configuration &= 0xfefc; + break; + case 1: + // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 01 + Configuration &= 0xfefc; + Configuration |= 0x1; + break; + case 2: + // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 + Configuration &= 0xfefc; + Configuration |= 0x3; + break; + case 3: + // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 and bit 8 of LinkControl of 2892 to 1 + Configuration &= 0xfefc; + Configuration |= 0x103; + break; + } + PCI_REG_WIRTE_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, Configuration); + DBGPRINT(RT_DEBUG_TRACE, ("Write PCI host offset 0x%x = 0x%x\n", pAd->HostLnkCtrlOffset, Configuration)); + } if (pObj->pci_dev && (pAd->RLnkCtrlOffset != 0)) { @@ -864,10 +1039,149 @@ VOID RTMPPCIeLinkCtrlSetting( PCIePowerSaveLevel = Max; PCI_REG_READ_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, Configuration); - Configuration |= 0x100; + switch (PCIePowerSaveLevel) + { + case 0: + // No PCI power safe + // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 00 . + Configuration &= 0xfefc; + break; + case 1: + // L0 + // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 01 . + Configuration &= 0xfefc; + Configuration |= 0x1; + break; + case 2: + // L0 and L1 + // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 + Configuration &= 0xfefc; + Configuration |= 0x3; + break; + case 3: + // L0 , L1 and clock management. + // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 and bit 8 of LinkControl of 2892 to 1 + Configuration &= 0xfefc; + Configuration |= 0x103; + pAd->bPCIclkOff = TRUE; + break; + } PCI_REG_WIRTE_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, Configuration); DBGPRINT(RT_DEBUG_TRACE, ("Write Ralink device : offset 0x%x = 0x%x\n", pAd->RLnkCtrlOffset, Configuration)); } DBGPRINT(RT_DEBUG_TRACE,("RTMPPCIePowerLinkCtrl <==============\n")); } + +/* + ======================================================================== + + Routine Description: + 1. Write a PCI register for rt30xx power solution 3 + + ======================================================================== +*/ +VOID RTMPrt3xSetPCIePowerLinkCtrl( + IN PRTMP_ADAPTER pAd) +{ + + ULONG HostConfiguration; + ULONG Configuration; + ULONG Vendor; + ULONG offset; + POS_COOKIE pObj; + INT pos; + USHORT reg16; + + pObj = (POS_COOKIE) pAd->OS_Cookie; + + DBGPRINT(RT_DEBUG_INFO, ("RTMPrt3xSetPCIePowerLinkCtrl.===> %x\n", pAd->StaCfg.PSControl.word)); + + // Check PSControl Configuration + if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) + return; + RTMPFindHostPCIDev(pAd); + if (pObj->parent_pci_dev) + { + USHORT vendor_id; + // Find PCI-to-PCI Bridge Express Capability Offset + pos = pci_find_capability(pObj->parent_pci_dev, PCI_CAP_ID_EXP); + + if (pos != 0) + { + pAd->HostLnkCtrlOffset = pos + PCI_EXP_LNKCTL; + } + // If configurared to turn on L1. + HostConfiguration = 0; + if (pAd->StaCfg.PSControl.field.rt30xxForceASPMTest == 1) + { + DBGPRINT(RT_DEBUG_TRACE, ("Enter,PSM : Force ASPM \n")); + + // Skip non-exist deice right away + if ((pAd->HostLnkCtrlOffset != 0)) + { + PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, HostConfiguration); + // Prepare Configuration to write to Host + HostConfiguration |= 0x3; + PCI_REG_WIRTE_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, HostConfiguration); + pAd->Rt3xxHostLinkCtrl = HostConfiguration; + // Because in rt30xxForceASPMTest Mode, Force turn on L0s, L1. + // Fix HostConfiguration bit0:1 = 0x3 for later use. + HostConfiguration = 0x3; + DBGPRINT(RT_DEBUG_TRACE, ("PSM : Force ASPM : Host device L1/L0s Value = 0x%x\n", HostConfiguration)); + } + } + else if (pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM == 1) + { + + // Skip non-exist deice right away + if ((pAd->HostLnkCtrlOffset != 0)) + { + PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, HostConfiguration); + pAd->Rt3xxHostLinkCtrl = HostConfiguration; + HostConfiguration &= 0x3; + DBGPRINT(RT_DEBUG_TRACE, ("PSM : Follow Host ASPM : Host device L1/L0s Value = 0x%x\n", HostConfiguration)); + } + } + } + // Prepare to write Ralink setting. + // Find Ralink PCIe Device's Express Capability Offset + pos = pci_find_capability(pObj->pci_dev, PCI_CAP_ID_EXP); + + if (pos != 0) + { + // Ralink PCIe Device's Link Control Register Offset + pAd->RLnkCtrlOffset = pos + PCI_EXP_LNKCTL; + pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, ®16); + Configuration = le2cpu16(reg16); + DBGPRINT(RT_DEBUG_TRACE, ("Read (Ralink PCIe Link Control Register) offset 0x%x = 0x%x\n", + pAd->RLnkCtrlOffset, Configuration)); + Configuration |= 0x100; + if ((pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM == 1) + || (pAd->StaCfg.PSControl.field.rt30xxForceASPMTest == 1)) + { + switch(HostConfiguration) + { + case 0: + Configuration &= 0xffffffc; + break; + case 1: + Configuration &= 0xffffffc; + Configuration |= 0x1; + break; + case 2: + Configuration &= 0xffffffc; + Configuration |= 0x2; + break; + case 3: + Configuration |= 0x3; + break; + } + } + reg16 = cpu2le16(Configuration); + pci_write_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, reg16); + pAd->Rt3xxRalinkLinkCtrl = Configuration; + DBGPRINT(RT_DEBUG_TRACE, ("PSM :Write Ralink device L1/L0s Value = 0x%x\n", Configuration)); + } + DBGPRINT(RT_DEBUG_INFO,("PSM :RTMPrt3xSetPCIePowerLinkCtrl <==============\n")); +} diff --git a/drivers/staging/rt2860/rt_linux.c b/drivers/staging/rt2860/rt_linux.c index 940b3851f145..b57836086600 100644 --- a/drivers/staging/rt2860/rt_linux.c +++ b/drivers/staging/rt2860/rt_linux.c @@ -284,6 +284,9 @@ VOID RTMPFreeAdapter( #ifdef RTMP_MAC_PCI NdisFreeSpinLock(&pAd->RxRingLock); +#ifdef RT3090 +NdisFreeSpinLock(&pAd->McuCmdLock); +#endif // RT3090 // #endif // RTMP_MAC_PCI // for (index =0 ; index < NUM_OF_TX_RING; index++) diff --git a/drivers/staging/rt2860/rt_linux.h b/drivers/staging/rt2860/rt_linux.h index 4ebe943359d1..e8c7d887de1e 100644 --- a/drivers/staging/rt2860/rt_linux.h +++ b/drivers/staging/rt2860/rt_linux.h @@ -590,6 +590,12 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int *_pV = 0; \ } +#define RTMP_IO_FORCE_READ32(_A, _R, _pV) \ +{ \ + (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0))); \ + (*_pV = readl((void *)((_A)->CSRBaseAddress + (_R)))); \ +} + #define RTMP_IO_READ8(_A, _R, _pV) \ { \ (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0))); \ @@ -605,7 +611,12 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int } \ } - +#define RTMP_IO_FORCE_WRITE32(_A, _R, _V) \ +{ \ + UINT Val; \ + Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ + writel(_V, (void *)((_A)->CSRBaseAddress + (_R))); \ +} #if defined(RALINK_2880) || defined(RALINK_3052) #define RTMP_IO_WRITE8(_A, _R, _V) \ diff --git a/drivers/staging/rt2860/rt_main_dev.c b/drivers/staging/rt2860/rt_main_dev.c index 89c67fc9dc37..7ea85e6a3363 100644 --- a/drivers/staging/rt2860/rt_main_dev.c +++ b/drivers/staging/rt2860/rt_main_dev.c @@ -226,9 +226,9 @@ int rt28xx_close(IN PNET_DEV dev) return 0; // close ok { -#ifdef RTMP_PCI_SUPPORT +#ifdef RTMP_MAC_PCI RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_CLOSE); -#endif // RTMP_PCI_SUPPORT // +#endif // RTMP_MAC_PCI // // If dirver doesn't wake up firmware here, // NICLoadFirmware will hang forever when interface is up again. @@ -320,6 +320,10 @@ int rt28xx_close(IN PNET_DEV dev) brc=RT28xxPciAsicRadioOff(pAd, RTMP_HALT, 0); + +//In solution 3 of 3090F, the bPCIclkOff will be set to TRUE after calling RT28xxPciAsicRadioOff + pAd->bPCIclkOff = FALSE; + if (brc==FALSE) { DBGPRINT(RT_DEBUG_ERROR,("%s call RT28xxPciAsicRadioOff fail !!\n", __func__)); @@ -400,11 +404,6 @@ int rt28xx_open(IN PNET_DEV dev) return -1; } -#ifdef RTMP_PCI_SUPPORT - RTMPInitPCIeLinkCtrlValue(pAd); -#endif // RTMP_PCI_SUPPORT // - - if (net_dev->priv_flags == INT_MAIN) { if (pAd->OpMode == OPMODE_STA) @@ -449,7 +448,9 @@ int rt28xx_open(IN PNET_DEV dev) // RTMP_IO_WRITE32(pAd, XIFS_TIME_CFG, reg); } - +#ifdef RTMP_MAC_PCI + RTMPInitPCIeLinkCtrlValue(pAd); +#endif // RTMP_MAC_PCI // return (retval); diff --git a/drivers/staging/rt2860/rt_pci_rbus.c b/drivers/staging/rt2860/rt_pci_rbus.c index b24df06d75cd..59900011b552 100644 --- a/drivers/staging/rt2860/rt_pci_rbus.c +++ b/drivers/staging/rt2860/rt_pci_rbus.c @@ -236,7 +236,6 @@ VOID Invalid_Remaining_Packet( PhysicalAddress = PCI_MAP_SINGLE(pAd, (void *)(VirtualAddress+1600), RX_BUFFER_NORMSIZE-1600, -1, PCI_DMA_FROMDEVICE); } - NDIS_STATUS RtmpNetTaskInit(IN RTMP_ADAPTER *pAd) { POS_COOKIE pObj; @@ -871,7 +870,6 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int pAd=(PRTMP_ADAPTER)handle; pObj = (POS_COOKIE)pAd->OS_Cookie; - if (size > 0) - pci_unmap_single(pObj->pci_dev, dma_addr, size, direction); + pci_unmap_single(pObj->pci_dev, dma_addr, size, direction); } diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h index ee047f8fdf75..12b14654e67e 100644 --- a/drivers/staging/rt2860/rtmp.h +++ b/drivers/staging/rt2860/rtmp.h @@ -913,6 +913,20 @@ typedef enum _ABGBAND_STATE_ { A_BAND, } ABGBAND_STATE; +#ifdef RTMP_MAC_PCI +// Power save method control +typedef union _PS_CONTROL { + struct { + ULONG EnablePSinIdle:1; // Enable radio off when not connect to AP. radio on only when sitesurvey, + ULONG EnableNewPS:1; // Enable new Chip power save fucntion . New method can only be applied in chip version after 2872. and PCIe. + ULONG rt30xxPowerMode:2; // Power Level Mode for rt30xx chip + ULONG rt30xxFollowHostASPM:1; // Card Follows Host's setting for rt30xx chip. + ULONG rt30xxForceASPMTest:1; // Force enable L1 for rt30xx chip. This has higher priority than rt30xxFollowHostASPM Mode. + ULONG rsv:26; // Radio Measurement Enable + } field; + ULONG word; +} PS_CONTROL, *PPS_CONTROL; +#endif // RTMP_MAC_PCI // /*************************************************************************** * structure for MLME state machine @@ -1542,7 +1556,6 @@ typedef struct _STA_ADMIN_CONFIG { UCHAR WpaSupplicantUP; UCHAR WpaSupplicantScanCount; BOOLEAN bRSN_IE_FromWpaSupplicant; - BOOLEAN bLostAp; CHAR dev_name[16]; USHORT OriDevType; @@ -1557,6 +1570,10 @@ typedef struct _STA_ADMIN_CONFIG { #ifdef RTMP_MAC_PCI UCHAR BBPR3; + // PS Control has 2 meanings for advanced power save function. + // 1. EnablePSinIdle : When no connection, always radio off except need to do site survey. + // 2. EnableNewPS : will save more current in sleep or radio off mode. + PS_CONTROL PSControl; #endif // RTMP_MAC_PCI // @@ -1815,9 +1832,17 @@ struct _RTMP_ADAPTER USHORT HostLnkCtrlConfiguration; USHORT HostLnkCtrlOffset; USHORT PCIePowerSaveLevel; + ULONG Rt3xxHostLinkCtrl; // USed for 3090F chip + ULONG Rt3xxRalinkLinkCtrl; // USed for 3090F chip + USHORT DeviceID; // Read from PCI config + ULONG AccessBBPFailCount; BOOLEAN bPCIclkOff; // flag that indicate if the PICE power status in Configuration SPace.. BOOLEAN bPCIclkOffDisableTx; // + BOOLEAN brt30xxBanMcuCmd; //when = 0xff means all commands are ok to set . + BOOLEAN b3090ESpecialChip; //3090E special chip that write EEPROM 0x24=0x9280. + ULONG CheckDmaBusyCount; // Check Interrupt Status Register Count. + UINT int_enable_reg; UINT int_disable_mask; UINT int_pending; @@ -1923,6 +1948,9 @@ struct _RTMP_ADAPTER #ifdef RTMP_MAC_PCI RTMP_RX_RING RxRing; NDIS_SPIN_LOCK RxRingLock; // Rx Ring spinlock +#ifdef RT3090 + NDIS_SPIN_LOCK McuCmdLock; //MCU Command Queue spinlock +#endif // RT3090 // #endif // RTMP_MAC_PCI // #ifdef RTMP_MAC_USB RX_CONTEXT RxContext[RX_RING_SIZE]; // 1 for redundant multiple IRP bulk in. @@ -2179,8 +2207,6 @@ struct _RTMP_ADAPTER //BOOLEAN bDisablescanning; //defined in RT2870 USB BOOLEAN bStaFifoTest; BOOLEAN bProtectionTest; - BOOLEAN bHCCATest; - BOOLEAN bGenOneHCCA; BOOLEAN bBroadComHT; //+++Following add from RT2870 USB. ULONG BulkOutReq; @@ -2333,6 +2359,7 @@ typedef struct _TX_BLK_ UCHAR HeaderBuf[128]; // TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP //RT2870 2.1.0.0 uses only 80 bytes //RT3070 2.1.1.0 uses only 96 bytes + //RT3090 2.1.0.0 uses only 96 bytes UCHAR MpduHeaderLen; // 802.11 header length NOT including the padding UCHAR HdrPadLen; // recording Header Padding Length; UCHAR apidx; // The interface associated to this packet @@ -2875,10 +2902,6 @@ VOID WpaStaPairwiseKeySetting( VOID WpaStaGroupKeySetting( IN PRTMP_ADAPTER pAd); -VOID WpaSendEapolStart( - IN PRTMP_ADAPTER pAdapter, - IN PUCHAR pBssid); - NDIS_STATUS RTMPCloneNdisPacket( IN PRTMP_ADAPTER pAd, IN BOOLEAN pInsAMSDUHdr, @@ -3685,9 +3708,6 @@ VOID ScanNextChannel( ULONG MakeIbssBeacon( IN PRTMP_ADAPTER pAd); -VOID InitChannelRelatedValue( - IN PRTMP_ADAPTER pAd); - BOOLEAN MlmeScanReqSanity( IN PRTMP_ADAPTER pAd, IN VOID *Msg, @@ -4063,6 +4083,10 @@ VOID RT30xxReverseRFSleepModeSetup( VOID NICInitRT3070RFRegisters( IN RTMP_ADAPTER *pAd); #endif // RT3070 // +#ifdef RT3090 +VOID NICInitRT3090RFRegisters( + IN RTMP_ADAPTER *pAd); +#endif // RT3090 // VOID RT30xxHaltAction( IN PRTMP_ADAPTER pAd); @@ -5239,7 +5263,6 @@ BOOLEAN RT28xxPciAsicRadioOn( IN PRTMP_ADAPTER pAd, IN UCHAR Level); -#ifdef RTMP_PCI_SUPPORT VOID RTMPInitPCIeLinkCtrlValue( IN PRTMP_ADAPTER pAd); @@ -5254,6 +5277,9 @@ VOID RTMPPCIeLinkCtrlSetting( IN PRTMP_ADAPTER pAd, IN USHORT Max); +VOID RTMPrt3xSetPCIePowerLinkCtrl( + IN PRTMP_ADAPTER pAd); + VOID PsPollWakeExec( IN PVOID SystemSpecific1, IN PVOID FunctionContext, @@ -5265,7 +5291,6 @@ VOID RadioOnExec( IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); -#endif // RTMP_PCI_SUPPORT // VOID RT28xxPciStaAsicForceWakeup( IN PRTMP_ADAPTER pAd, diff --git a/drivers/staging/rt2860/rtmp_chip.h b/drivers/staging/rt2860/rtmp_chip.h index 998960ede86e..1284a446786e 100644 --- a/drivers/staging/rt2860/rtmp_chip.h +++ b/drivers/staging/rt2860/rtmp_chip.h @@ -49,6 +49,9 @@ #ifdef RT3070 #include "chip/rt3070.h" #endif // RT3070 // +#ifdef RT3090 +#include "chip/rt3090.h" +#endif // RT3090 // // We will have a cost down version which mac version is 0x3090xxxx // diff --git a/drivers/staging/rt2860/rtmp_def.h b/drivers/staging/rt2860/rtmp_def.h index e999710c02f5..ca700d064a91 100644 --- a/drivers/staging/rt2860/rtmp_def.h +++ b/drivers/staging/rt2860/rtmp_def.h @@ -221,6 +221,11 @@ #define fRTMP_PS_GO_TO_SLEEP_NOW 0x00000008 #define fRTMP_PS_TOGGLE_L1 0x00000010 // Use Toggle L1 mechanism for rt28xx PCIe +#ifdef RT3090 +#define WAKE_MCU_CMD 0x31 +#define SLEEP_MCU_CMD 0x30 +#define RFOFF_MCU_CMD 0x35 +#endif // RT3090 // #define CCKSETPROTECT 0x1 #define OFDMSETPROTECT 0x2 diff --git a/drivers/staging/rt2860/sta/assoc.c b/drivers/staging/rt2860/sta/assoc.c index b13d3a2e9645..a67e213718d6 100644 --- a/drivers/staging/rt2860/sta/assoc.c +++ b/drivers/staging/rt2860/sta/assoc.c @@ -464,18 +464,6 @@ VOID MlmeAssocReqAction( break; } } -#ifdef RT2860 - /* - When AuthMode is WPA2-Enterprise and AP reboot or STA lost AP, - AP would not do PMK cache with STA after STA re-connect to AP again. - In this case, driver doesn't need to send PMKID to AP and WpaSupplicant. - */ - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) && - (NdisEqualMemory(pAd->MlmeAux.Bssid, pAd->CommonCfg.LastBssid, MAC_ADDR_LEN))) - { - FoundPMK = FALSE; - } -#endif // RT2860 // if (FoundPMK) { // Set PMK number diff --git a/drivers/staging/rt2860/sta/auth_rsp.c b/drivers/staging/rt2860/sta/auth_rsp.c index 0a5d28cea390..9c2fde479afe 100644 --- a/drivers/staging/rt2860/sta/auth_rsp.c +++ b/drivers/staging/rt2860/sta/auth_rsp.c @@ -137,10 +137,6 @@ VOID PeerDeauthAction( if (pAd->CommonCfg.bWirelessEvent) RTMPSendWirelessEvent(pAd, IW_DEAUTH_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - if ((pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) && - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2)) - pAd->StaCfg.bLostAp = TRUE; - LinkDown(pAd, TRUE); } } diff --git a/drivers/staging/rt2860/sta/connect.c b/drivers/staging/rt2860/sta/connect.c index 3852d044b66d..7f263a66d79a 100644 --- a/drivers/staging/rt2860/sta/connect.c +++ b/drivers/staging/rt2860/sta/connect.c @@ -1125,6 +1125,26 @@ VOID LinkUp( COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(pAd); +#ifdef RTMP_MAC_PCI + // Before power save before link up function, We will force use 1R. + // So after link up, check Rx antenna # again. + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); + if(pAd->Antenna.field.RxPath == 3) + { + Value |= (0x10); + } + else if(pAd->Antenna.field.RxPath == 2) + { + Value |= (0x8); + } + else if(pAd->Antenna.field.RxPath == 1) + { + Value |= (0x0); + } + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); + pAd->StaCfg.BBPR3 = Value; +#endif // RTMP_MAC_PCI // + if (BssType == BSS_ADHOC) { OPSTATUS_SET_FLAG(pAd, fOP_STATUS_ADHOC_ON); @@ -1134,8 +1154,6 @@ VOID LinkUp( if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) AdhocTurnOnQos(pAd); - InitChannelRelatedValue(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("!!!Adhoc LINK UP !!! \n" )); } else @@ -1146,7 +1164,6 @@ VOID LinkUp( DBGPRINT(RT_DEBUG_TRACE, ("!!!Infra LINK UP !!! \n" )); } -#if defined(RT2870) || defined(RT3070) // 3*3 // reset Tx beamforming bit RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value); @@ -1171,6 +1188,9 @@ VOID LinkUp( RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); Value &= (~0x20); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); +#ifdef RTMP_MAC_PCI + pAd->StaCfg.BBPR3 = Value; +#endif // RTMP_MAC_PCI // RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data); Data &= 0xfffffffe; @@ -1205,6 +1225,9 @@ VOID LinkUp( RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); Value |= (0x20); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); +#ifdef RTMP_MAC_PCI + pAd->StaCfg.BBPR3 = Value; +#endif // RTMP_MAC_PCI // if (pAd->MACVersion == 0x28600100) { @@ -1234,6 +1257,9 @@ VOID LinkUp( RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); Value &= (~0x20); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); +#ifdef RTMP_MAC_PCI + pAd->StaCfg.BBPR3 = Value; +#endif // RTMP_MAC_PCI // if (pAd->MACVersion == 0x28600100) { @@ -1247,7 +1273,6 @@ VOID LinkUp( } RTMPSetAGCInitValue(pAd, pAd->CommonCfg.BBPCurrentBW); -#endif // RT2870 // // // Save BBP_R66 value, it will be used in RTUSBResumeMsduTransmission @@ -1752,21 +1777,6 @@ VOID LinkUp( RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_GO_TO_SLEEP_NOW); - -#ifdef RT2860 - /* - When AuthMode is WPA2-Enterprise and AP reboot or STA lost AP, - WpaSupplicant would not send EapolStart to AP after STA re-connect to AP again. - In this case, driver would send EapolStart to AP. - */ - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) && - (NdisEqualMemory(pAd->CommonCfg.Bssid, pAd->CommonCfg.LastBssid, MAC_ADDR_LEN)) && - (pAd->StaCfg.bLostAp == TRUE)) - { - WpaSendEapolStart(pAd, pAd->CommonCfg.Bssid); - } -#endif // RT2860 // - pAd->StaCfg.bLostAp = FALSE; } /* @@ -1820,7 +1830,7 @@ VOID LinkDown( OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); #ifdef RTMP_MAC_PCI - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { BOOLEAN Cancelled; pAd->Mlme.bPsPollTimerRunning = FALSE; @@ -1841,6 +1851,10 @@ VOID LinkDown( OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); } +#ifdef RTMP_MAC_PCI + pAd->bPCIclkOff = FALSE; +#endif // RTMP_MAC_PCI // + if (ADHOC_ON(pAd)) // Adhoc mode link down { DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK DOWN 1!!!\n")); @@ -2520,139 +2534,3 @@ ULONG MakeIbssBeacon( FrameLen, SupRateLen, ExtRateLen, pAd->CommonCfg.Channel, pAd->CommonCfg.PhyMode)); return FrameLen; } - -VOID InitChannelRelatedValue( - IN PRTMP_ADAPTER pAd) -{ -#ifdef RT2860 - UCHAR Value = 0; - UINT32 Data = 0; - -#ifdef RTMP_MAC_PCI - // In power save , We will force use 1R. - // So after link up, check Rx antenna # again. - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); - if(pAd->Antenna.field.RxPath == 3) - { - Value |= (0x10); - } - else if(pAd->Antenna.field.RxPath == 2) - { - Value |= (0x8); - } - else if(pAd->Antenna.field.RxPath == 1) - { - Value |= (0x0); - } - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); - pAd->StaCfg.BBPR3 = Value; -#endif // RTMP_MAC_PCI // - - pAd->CommonCfg.CentralChannel = pAd->MlmeAux.CentralChannel; - pAd->CommonCfg.Channel = pAd->MlmeAux.Channel; - // Change to AP channel - if ((pAd->CommonCfg.CentralChannel > pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - // Must using 40MHz. - pAd->CommonCfg.BBPCurrentBW = BW_40; - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value); - Value &= (~0x18); - Value |= 0x10; - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value); - - // RX : control channel at lower - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); - Value &= (~0x20); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); -#ifdef RTMP_MAC_PCI - pAd->StaCfg.BBPR3 = Value; -#endif // RTMP_MAC_PCI // - - RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data); - Data &= 0xfffffffe; - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Data); - - if (pAd->MACVersion == 0x28600100) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x1A); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x0A); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x16); - DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" )); - } - - DBGPRINT(RT_DEBUG_TRACE, ("!!!40MHz Lower !!! Control Channel at Below. Central = %d \n", pAd->CommonCfg.CentralChannel )); - } - else if ((pAd->CommonCfg.CentralChannel < pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - // Must using 40MHz. - pAd->CommonCfg.BBPCurrentBW = BW_40; - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value); - Value &= (~0x18); - Value |= 0x10; - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value); - - RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data); - Data |= 0x1; - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Data); - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); - Value |= (0x20); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); -#ifdef RTMP_MAC_PCI - pAd->StaCfg.BBPR3 = Value; -#endif // RTMP_MAC_PCI // - - if (pAd->MACVersion == 0x28600100) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x1A); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x0A); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x16); - DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" )); - } - - DBGPRINT(RT_DEBUG_TRACE, ("!!! 40MHz Upper !!! Control Channel at UpperCentral = %d \n", pAd->CommonCfg.CentralChannel )); - } - else - { - pAd->CommonCfg.BBPCurrentBW = BW_20; - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value); - Value &= (~0x18); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value); - - RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data); - Data &= 0xfffffffe; - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Data); - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); - Value &= (~0x20); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); -#ifdef RTMP_MAC_PCI - pAd->StaCfg.BBPR3 = Value; -#endif // RTMP_MAC_PCI // - - if (pAd->MACVersion == 0x28600100) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x16); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x08); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x11); - DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" )); - } - - DBGPRINT(RT_DEBUG_TRACE, ("!!! 20MHz !!! \n" )); - } - - RTMPSetAGCInitValue(pAd, pAd->CommonCfg.BBPCurrentBW); -#endif // RT2860 // -} - - diff --git a/drivers/staging/rt2860/sta/rtmp_data.c b/drivers/staging/rt2860/sta/rtmp_data.c index 6a8ffdee827f..0ab3dce5d1ae 100644 --- a/drivers/staging/rt2860/sta/rtmp_data.c +++ b/drivers/staging/rt2860/sta/rtmp_data.c @@ -1208,7 +1208,6 @@ NDIS_STATUS RTMPFreeTXDRequest( case QID_AC_BE: case QID_AC_VI: case QID_AC_VO: - case QID_HCCA: if (pAd->TxRing[QueIdx].TxSwFreeIdx > pAd->TxRing[QueIdx].TxCpuIdx) FreeNumber = pAd->TxRing[QueIdx].TxSwFreeIdx - pAd->TxRing[QueIdx].TxCpuIdx - 1; else diff --git a/drivers/staging/rt2860/sta/sync.c b/drivers/staging/rt2860/sta/sync.c index f72f11a8ec20..dc71c1dabc7b 100644 --- a/drivers/staging/rt2860/sta/sync.c +++ b/drivers/staging/rt2860/sta/sync.c @@ -195,13 +195,23 @@ VOID MlmeScanReqAction( pAd->StaCfg.ScanCnt++; #ifdef RTMP_MAC_PCI - if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) && + if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) && (IDLE_ON(pAd)) && (pAd->StaCfg.bRadio == TRUE) && (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) { + if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) + { + AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x02); + AsicCheckCommanOk(pAd, PowerWakeCID); + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); + DBGPRINT(RT_DEBUG_TRACE, ("PSM - Issue Wake up command \n")); + } + else + { RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); } + } #endif // RTMP_MAC_PCI // // first check the parameter sanity @@ -303,7 +313,7 @@ VOID MlmeJoinReqAction( DBGPRINT(RT_DEBUG_TRACE, ("SYNC - MlmeJoinReqAction(BSS #%ld)\n", pInfo->BssIdx)); #ifdef RTMP_MAC_PCI - if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) && + if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) && (IDLE_ON(pAd)) && (pAd->StaCfg.bRadio == TRUE) && (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) @@ -338,9 +348,7 @@ VOID MlmeJoinReqAction( RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); BBPValue &= (~0x18); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); -#ifdef RT2860 - pAd->CommonCfg.BBPCurrentBW = BW_20; -#endif // RT2860 // + DBGPRINT(RT_DEBUG_TRACE, ("SYNC - BBP R4 to 20MHz.l\n")); // switch channel and waiting for beacon timer @@ -898,8 +906,6 @@ VOID PeerBeaconAtJoinAction( else //Used the default TX Power Percentage. pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault; - InitChannelRelatedValue(pAd); - pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; Status = MLME_SUCCESS; MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_JOIN_CONF, 2, &Status); @@ -1317,7 +1323,7 @@ VOID PeerBeacon( if (MessageToMe) { #ifdef RTMP_MAC_PCI - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { // Restore to correct BBP R3 value if (pAd->Antenna.field.RxPath > 1) @@ -1336,7 +1342,7 @@ VOID PeerBeacon( else if (BcastFlag && (DtimCount == 0) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM)) { #ifdef RTMP_MAC_PCI - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { if (pAd->Antenna.field.RxPath > 1) RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, pAd->StaCfg.BBPR3); @@ -1356,7 +1362,7 @@ VOID PeerBeacon( // TODO: consider scheduled HCCA. might not be proper to use traditional DTIM-based power-saving scheme // can we cheat here (i.e. just check MGMT & AC_BE) for better performance? #ifdef RTMP_MAC_PCI - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { if (pAd->Antenna.field.RxPath > 1) RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, pAd->StaCfg.BBPR3); diff --git a/drivers/staging/rt2860/sta/wpa.c b/drivers/staging/rt2860/sta/wpa.c index d45b9ba88b05..c6c3f3bc418d 100644 --- a/drivers/staging/rt2860/sta/wpa.c +++ b/drivers/staging/rt2860/sta/wpa.c @@ -389,51 +389,3 @@ VOID WpaStaGroupKeySetting( NULL); } - - -/* - ======================================================================== - - Routine Description: - Send EAPoL-Start packet to AP. - - Arguments: - pAd - NIC Adapter pointer - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - Actions after link up - 1. Change the correct parameters - 2. Send EAPOL - START - - ======================================================================== -*/ -VOID WpaSendEapolStart( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pBssid) -{ - IEEE8021X_FRAME Packet; - UCHAR Header802_3[14]; - - DBGPRINT(RT_DEBUG_TRACE, ("-----> WpaSendEapolStart\n")); - - NdisZeroMemory(Header802_3,sizeof(UCHAR)*14); - - MAKE_802_3_HEADER(Header802_3, pBssid, &pAd->CurrentAddress[0], EAPOL); - - // Zero message 2 body - NdisZeroMemory(&Packet, sizeof(Packet)); - Packet.Version = EAPOL_VER; - Packet.Type = EAPOLStart; - Packet.Length = cpu2be16(0); - - // Copy frame to Tx ring - RTMPToWirelessSta((PRTMP_ADAPTER)pAd, &pAd->MacTab.Content[BSSID_WCID], - Header802_3, LENGTH_802_3, (PUCHAR)&Packet, 4, TRUE); - - DBGPRINT(RT_DEBUG_TRACE, ("<----- WpaSendEapolStart\n")); -} diff --git a/drivers/staging/rt2860/sta_ioctl.c b/drivers/staging/rt2860/sta_ioctl.c index b6a3c9006340..e5e294284108 100644 --- a/drivers/staging/rt2860/sta_ioctl.c +++ b/drivers/staging/rt2860/sta_ioctl.c @@ -160,6 +160,12 @@ INT Set_PSMode_Proc( IN PRTMP_ADAPTER pAdapter, IN PSTRING arg); +#ifdef RT3090 +INT Set_PCIePSLevel_Proc( +IN PRTMP_ADAPTER pAdapter, +IN PUCHAR arg); +#endif // RT3090 // + INT Set_Wpa_Support( IN PRTMP_ADAPTER pAd, IN PSTRING arg); @@ -515,6 +521,7 @@ rt_ioctl_giwname(struct net_device *dev, { strncpy(name, "Ralink STA", IFNAMSIZ); // RT2870 2.1.0.0 uses "RT2870 Wireless" + // RT3090 2.1.0.0 uses "RT2860 Wireless" return 0; } diff --git a/drivers/staging/rt2860/wpa.h b/drivers/staging/rt2860/wpa.h index 63f47742e05d..27e5aab82855 100644 --- a/drivers/staging/rt2860/wpa.h +++ b/drivers/staging/rt2860/wpa.h @@ -347,13 +347,6 @@ typedef enum _WpaMixPairCipher WPA_TKIPAES_WPA2_TKIPAES = 0x0F, } WPA_MIX_PAIR_CIPHER; -// 802.1x authentication format -typedef struct _IEEE8021X_FRAME { - UCHAR Version; // 1.0 - UCHAR Type; // 0 = EAP Packet - USHORT Length; -} IEEE8021X_FRAME, *PIEEE8021X_FRAME; - typedef struct PACKED _RSN_IE_HEADER_STRUCT { UCHAR Eid; UCHAR Length; diff --git a/drivers/staging/rt3090/common/rtmp_mcu.c b/drivers/staging/rt3090/common/rtmp_mcu.c index 23f785a90e06..20319e69a94f 100644 --- a/drivers/staging/rt3090/common/rtmp_mcu.c +++ b/drivers/staging/rt3090/common/rtmp_mcu.c @@ -43,7 +43,7 @@ // New 8k byte firmware size for RT3071/RT3072 #define FIRMWAREIMAGE_MAX_LENGTH 0x2000 -#define FIRMWAREIMAGE_LENGTH (sizeof (FirmwareImage) / sizeof(UCHAR)) +#define FIRMWAREIMAGE_LENGTH (sizeof (FirmwareImage_3090) / sizeof(UCHAR)) #define FIRMWARE_MAJOR_VERSION 0 #define FIRMWAREIMAGEV1_LENGTH 0x1000 @@ -335,8 +335,8 @@ NDIS_STATUS RtmpAsicLoadFirmware( UINT32 MacReg = 0; UINT32 Version = (pAd->MACVersion >> 16); - pFirmwareImage = FirmwareImage; - FileLength = sizeof(FirmwareImage); + pFirmwareImage = FirmwareImage_3090; + FileLength = sizeof(*pFirmwareImage); // New 8k byte firmware size for RT3071/RT3072 //DBGPRINT(RT_DEBUG_TRACE, ("Usb Chip\n")); @@ -347,7 +347,7 @@ NDIS_STATUS RtmpAsicLoadFirmware( #ifdef RTMP_MAC_PCI if ((Version == 0x2860) || IS_RT3090(pAd)||IS_RT3390(pAd)) { - pFirmwareImage = FirmwareImage; + pFirmwareImage = FirmwareImage_3090; FileLength = FIRMWAREIMAGE_LENGTH; } #endif // RTMP_MAC_PCI // diff --git a/drivers/staging/rt3090/firmware.h b/drivers/staging/rt3090/firmware.h index f2836a22cb8e..ef2576251dfa 100644 --- a/drivers/staging/rt3090/firmware.h +++ b/drivers/staging/rt3090/firmware.h @@ -2,7 +2,7 @@ /* AUTO GEN PLEASE DO NOT MODIFY IT */ -UCHAR FirmwareImage [] = { +UCHAR FirmwareImage_3090 [] = { 0x02, 0x02, 0xf3, 0x02, 0x02, 0xa1, 0x22, 0x22, 0xff, 0xff, 0xff, 0x02, 0x01, 0x27, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x1e, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0xd8, 0xc0, 0xe0, 0xc0, 0xf0, 0xc0, 0x83, 0xc0, 0x82, 0xc0, 0xd0, 0x75, 0xd0, 0x18, 0xc2, 0xaf, 0x30, 0x45, 0x03, -- GitLab From e20aea64e160d5873c2aaf62cc255ea81ce000eb Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Tue, 22 Sep 2009 20:44:33 +0200 Subject: [PATCH 008/235] Staging: remove no longer needed rt3090 driver rt2860 handles now all rt2860/rt3090 chipsets. Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/Kconfig | 2 - drivers/staging/Makefile | 1 - drivers/staging/rt2860/pci_main_dev.c | 1 + drivers/staging/rt3090/Kconfig | 5 - drivers/staging/rt3090/Makefile | 80 - drivers/staging/rt3090/action.h | 66 - drivers/staging/rt3090/ap.h | 512 -- drivers/staging/rt3090/ap_apcli.h | 276 - drivers/staging/rt3090/ap_autoChSel.h | 79 - drivers/staging/rt3090/ap_autoChSel_cmm.h | 66 - drivers/staging/rt3090/ap_cfg.h | 118 - drivers/staging/rt3090/ap_ids.h | 82 - drivers/staging/rt3090/ap_mbss.h | 72 - drivers/staging/rt3090/ap_uapsd.h | 636 -- drivers/staging/rt3090/ap_wds.h | 212 - drivers/staging/rt3090/chips/rt3090.c | 123 - drivers/staging/rt3090/chips/rt30xx.c | 525 -- drivers/staging/rt3090/chips/rt3370.c | 121 - drivers/staging/rt3090/chips/rt3390.c | 122 - drivers/staging/rt3090/chips/rt33xx.c | 536 -- drivers/staging/rt3090/chlist.h | 130 - drivers/staging/rt3090/common/action.c | 1057 --- drivers/staging/rt3090/common/ba_action.c | 1779 ----- drivers/staging/rt3090/common/cmm_aes.c | 1560 ---- drivers/staging/rt3090/common/cmm_asic.c | 2753 ------- drivers/staging/rt3090/common/cmm_cfg.c | 295 - drivers/staging/rt3090/common/cmm_data.c | 2763 ------- drivers/staging/rt3090/common/cmm_data_pci.c | 1576 ---- drivers/staging/rt3090/common/cmm_info.c | 3718 --------- drivers/staging/rt3090/common/cmm_mac_pci.c | 1757 ----- drivers/staging/rt3090/common/cmm_profile.c | 2321 ------ drivers/staging/rt3090/common/cmm_sanity.c | 1718 ---- drivers/staging/rt3090/common/cmm_sync.c | 734 -- drivers/staging/rt3090/common/cmm_tkip.c | 966 --- drivers/staging/rt3090/common/cmm_wep.c | 500 -- drivers/staging/rt3090/common/cmm_wpa.c | 3149 -------- drivers/staging/rt3090/common/crypt_aes.c | 1007 --- .../staging/rt3090/common/crypt_biginteger.c | 1119 --- drivers/staging/rt3090/common/crypt_dh.c | 234 - drivers/staging/rt3090/common/crypt_hmac.c | 279 - drivers/staging/rt3090/common/crypt_md5.c | 353 - drivers/staging/rt3090/common/crypt_sha2.c | 536 -- drivers/staging/rt3090/common/dfs.c | 481 -- drivers/staging/rt3090/common/ee_efuse.c | 1548 ---- drivers/staging/rt3090/common/ee_prom.c | 308 - drivers/staging/rt3090/common/eeprom.c | 98 - drivers/staging/rt3090/common/igmp_snoop.c | 1365 ---- drivers/staging/rt3090/common/mlme.c | 6550 ---------------- drivers/staging/rt3090/common/mlme_ex.c | 215 - drivers/staging/rt3090/common/netif_block.c | 147 - drivers/staging/rt3090/common/rt_channel.c | 1287 --- drivers/staging/rt3090/common/rt_rf.c | 201 - drivers/staging/rt3090/common/rtmp_init.c | 3882 ---------- drivers/staging/rt3090/common/rtmp_mcu.c | 560 -- drivers/staging/rt3090/common/rtmp_timer.c | 327 - drivers/staging/rt3090/common/spectrum.c | 2221 ------ drivers/staging/rt3090/config.mk | 187 - drivers/staging/rt3090/crypt_hmac.h | 81 - drivers/staging/rt3090/crypt_md5.h | 78 - drivers/staging/rt3090/crypt_sha2.h | 107 - drivers/staging/rt3090/dfs.h | 137 - drivers/staging/rt3090/eeprom.h | 82 - drivers/staging/rt3090/igmp_snoop.h | 152 - drivers/staging/rt3090/ipv6.h | 215 - drivers/staging/rt3090/link_list.h | 133 - drivers/staging/rt3090/mac_pci.h | 454 -- drivers/staging/rt3090/mlme.h | 1360 ---- drivers/staging/rt3090/mlme_ex.h | 83 - drivers/staging/rt3090/mlme_ex_def.h | 53 - drivers/staging/rt3090/netif_block.h | 56 - drivers/staging/rt3090/oid.h | 1015 --- drivers/staging/rt3090/pci_main_dev.c | 1195 --- drivers/staging/rt3090/rt3090.h | 77 - drivers/staging/rt3090/rt30xx.h | 48 - drivers/staging/rt3090/rt3370.h | 64 - drivers/staging/rt3090/rt3390.h | 77 - drivers/staging/rt3090/rt33xx.h | 48 - drivers/staging/rt3090/rt_ate.c | 6089 --------------- drivers/staging/rt3090/rt_ate.h | 314 - drivers/staging/rt3090/rt_config.h | 126 - drivers/staging/rt3090/rt_linux.c | 1624 ---- drivers/staging/rt3090/rt_linux.h | 1034 --- drivers/staging/rt3090/rt_main_dev.c | 897 --- drivers/staging/rt3090/rt_pci_rbus.c | 989 --- drivers/staging/rt3090/rt_profile.c | 101 - drivers/staging/rt3090/rtmp.h | 6873 ----------------- drivers/staging/rt3090/rtmp_chip.h | 355 - drivers/staging/rt3090/rtmp_def.h | 1650 ---- drivers/staging/rt3090/rtmp_dot11.h | 146 - drivers/staging/rt3090/rtmp_iface.h | 81 - drivers/staging/rt3090/rtmp_mac.h | 2304 ------ drivers/staging/rt3090/rtmp_mcu.h | 55 - drivers/staging/rt3090/rtmp_os.h | 93 - drivers/staging/rt3090/rtmp_pci.h | 110 - drivers/staging/rt3090/rtmp_phy.h | 631 -- drivers/staging/rt3090/rtmp_timer.h | 162 - drivers/staging/rt3090/rtmp_type.h | 147 - drivers/staging/rt3090/spectrum.h | 234 - drivers/staging/rt3090/spectrum_def.h | 257 - drivers/staging/rt3090/sta/assoc.c | 1673 ---- drivers/staging/rt3090/sta/auth.c | 491 -- drivers/staging/rt3090/sta/auth_rsp.c | 151 - drivers/staging/rt3090/sta/connect.c | 2759 ------- drivers/staging/rt3090/sta/dls.c | 2207 ------ drivers/staging/rt3090/sta/rtmp_ckipmic.c | 579 -- drivers/staging/rt3090/sta/rtmp_data.c | 2661 ------- drivers/staging/rt3090/sta/sanity.c | 382 - drivers/staging/rt3090/sta/sync.c | 1840 ----- drivers/staging/rt3090/sta/wpa.c | 396 - drivers/staging/rt3090/sta_ioctl.c | 4477 ----------- drivers/staging/rt3090/vr_ikans.h | 71 - drivers/staging/rt3090/wpa.h | 447 -- 112 files changed, 1 insertion(+), 101236 deletions(-) delete mode 100644 drivers/staging/rt3090/Kconfig delete mode 100644 drivers/staging/rt3090/Makefile delete mode 100644 drivers/staging/rt3090/action.h delete mode 100644 drivers/staging/rt3090/ap.h delete mode 100644 drivers/staging/rt3090/ap_apcli.h delete mode 100644 drivers/staging/rt3090/ap_autoChSel.h delete mode 100644 drivers/staging/rt3090/ap_autoChSel_cmm.h delete mode 100644 drivers/staging/rt3090/ap_cfg.h delete mode 100644 drivers/staging/rt3090/ap_ids.h delete mode 100644 drivers/staging/rt3090/ap_mbss.h delete mode 100644 drivers/staging/rt3090/ap_uapsd.h delete mode 100644 drivers/staging/rt3090/ap_wds.h delete mode 100644 drivers/staging/rt3090/chips/rt3090.c delete mode 100644 drivers/staging/rt3090/chips/rt30xx.c delete mode 100644 drivers/staging/rt3090/chips/rt3370.c delete mode 100644 drivers/staging/rt3090/chips/rt3390.c delete mode 100644 drivers/staging/rt3090/chips/rt33xx.c delete mode 100644 drivers/staging/rt3090/chlist.h delete mode 100644 drivers/staging/rt3090/common/action.c delete mode 100644 drivers/staging/rt3090/common/ba_action.c delete mode 100644 drivers/staging/rt3090/common/cmm_aes.c delete mode 100644 drivers/staging/rt3090/common/cmm_asic.c delete mode 100644 drivers/staging/rt3090/common/cmm_cfg.c delete mode 100644 drivers/staging/rt3090/common/cmm_data.c delete mode 100644 drivers/staging/rt3090/common/cmm_data_pci.c delete mode 100644 drivers/staging/rt3090/common/cmm_info.c delete mode 100644 drivers/staging/rt3090/common/cmm_mac_pci.c delete mode 100644 drivers/staging/rt3090/common/cmm_profile.c delete mode 100644 drivers/staging/rt3090/common/cmm_sanity.c delete mode 100644 drivers/staging/rt3090/common/cmm_sync.c delete mode 100644 drivers/staging/rt3090/common/cmm_tkip.c delete mode 100644 drivers/staging/rt3090/common/cmm_wep.c delete mode 100644 drivers/staging/rt3090/common/cmm_wpa.c delete mode 100644 drivers/staging/rt3090/common/crypt_aes.c delete mode 100644 drivers/staging/rt3090/common/crypt_biginteger.c delete mode 100644 drivers/staging/rt3090/common/crypt_dh.c delete mode 100644 drivers/staging/rt3090/common/crypt_hmac.c delete mode 100644 drivers/staging/rt3090/common/crypt_md5.c delete mode 100644 drivers/staging/rt3090/common/crypt_sha2.c delete mode 100644 drivers/staging/rt3090/common/dfs.c delete mode 100644 drivers/staging/rt3090/common/ee_efuse.c delete mode 100644 drivers/staging/rt3090/common/ee_prom.c delete mode 100644 drivers/staging/rt3090/common/eeprom.c delete mode 100644 drivers/staging/rt3090/common/igmp_snoop.c delete mode 100644 drivers/staging/rt3090/common/mlme.c delete mode 100644 drivers/staging/rt3090/common/mlme_ex.c delete mode 100644 drivers/staging/rt3090/common/netif_block.c delete mode 100644 drivers/staging/rt3090/common/rt_channel.c delete mode 100644 drivers/staging/rt3090/common/rt_rf.c delete mode 100644 drivers/staging/rt3090/common/rtmp_init.c delete mode 100644 drivers/staging/rt3090/common/rtmp_mcu.c delete mode 100644 drivers/staging/rt3090/common/rtmp_timer.c delete mode 100644 drivers/staging/rt3090/common/spectrum.c delete mode 100644 drivers/staging/rt3090/config.mk delete mode 100644 drivers/staging/rt3090/crypt_hmac.h delete mode 100644 drivers/staging/rt3090/crypt_md5.h delete mode 100644 drivers/staging/rt3090/crypt_sha2.h delete mode 100644 drivers/staging/rt3090/dfs.h delete mode 100644 drivers/staging/rt3090/eeprom.h delete mode 100644 drivers/staging/rt3090/igmp_snoop.h delete mode 100644 drivers/staging/rt3090/ipv6.h delete mode 100644 drivers/staging/rt3090/link_list.h delete mode 100644 drivers/staging/rt3090/mac_pci.h delete mode 100644 drivers/staging/rt3090/mlme.h delete mode 100644 drivers/staging/rt3090/mlme_ex.h delete mode 100644 drivers/staging/rt3090/mlme_ex_def.h delete mode 100644 drivers/staging/rt3090/netif_block.h delete mode 100644 drivers/staging/rt3090/oid.h delete mode 100644 drivers/staging/rt3090/pci_main_dev.c delete mode 100644 drivers/staging/rt3090/rt3090.h delete mode 100644 drivers/staging/rt3090/rt30xx.h delete mode 100644 drivers/staging/rt3090/rt3370.h delete mode 100644 drivers/staging/rt3090/rt3390.h delete mode 100644 drivers/staging/rt3090/rt33xx.h delete mode 100644 drivers/staging/rt3090/rt_ate.c delete mode 100644 drivers/staging/rt3090/rt_ate.h delete mode 100644 drivers/staging/rt3090/rt_config.h delete mode 100644 drivers/staging/rt3090/rt_linux.c delete mode 100644 drivers/staging/rt3090/rt_linux.h delete mode 100644 drivers/staging/rt3090/rt_main_dev.c delete mode 100644 drivers/staging/rt3090/rt_pci_rbus.c delete mode 100644 drivers/staging/rt3090/rt_profile.c delete mode 100644 drivers/staging/rt3090/rtmp.h delete mode 100644 drivers/staging/rt3090/rtmp_chip.h delete mode 100644 drivers/staging/rt3090/rtmp_def.h delete mode 100644 drivers/staging/rt3090/rtmp_dot11.h delete mode 100644 drivers/staging/rt3090/rtmp_iface.h delete mode 100644 drivers/staging/rt3090/rtmp_mac.h delete mode 100644 drivers/staging/rt3090/rtmp_mcu.h delete mode 100644 drivers/staging/rt3090/rtmp_os.h delete mode 100644 drivers/staging/rt3090/rtmp_pci.h delete mode 100644 drivers/staging/rt3090/rtmp_phy.h delete mode 100644 drivers/staging/rt3090/rtmp_timer.h delete mode 100644 drivers/staging/rt3090/rtmp_type.h delete mode 100644 drivers/staging/rt3090/spectrum.h delete mode 100644 drivers/staging/rt3090/spectrum_def.h delete mode 100644 drivers/staging/rt3090/sta/assoc.c delete mode 100644 drivers/staging/rt3090/sta/auth.c delete mode 100644 drivers/staging/rt3090/sta/auth_rsp.c delete mode 100644 drivers/staging/rt3090/sta/connect.c delete mode 100644 drivers/staging/rt3090/sta/dls.c delete mode 100644 drivers/staging/rt3090/sta/rtmp_ckipmic.c delete mode 100644 drivers/staging/rt3090/sta/rtmp_data.c delete mode 100644 drivers/staging/rt3090/sta/sanity.c delete mode 100644 drivers/staging/rt3090/sta/sync.c delete mode 100644 drivers/staging/rt3090/sta/wpa.c delete mode 100644 drivers/staging/rt3090/sta_ioctl.c delete mode 100644 drivers/staging/rt3090/vr_ikans.h delete mode 100644 drivers/staging/rt3090/wpa.h diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index dfcd75cf4907..37ec2138d385 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -65,8 +65,6 @@ source "drivers/staging/rt2860/Kconfig" source "drivers/staging/rt2870/Kconfig" -source "drivers/staging/rt3090/Kconfig" - source "drivers/staging/comedi/Kconfig" source "drivers/staging/asus_oled/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 7719d04a4a86..ff7222d7ed8f 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -15,7 +15,6 @@ obj-$(CONFIG_POCH) += poch/ obj-$(CONFIG_OTUS) += otus/ obj-$(CONFIG_RT2860) += rt2860/ obj-$(CONFIG_RT2870) += rt2870/ -obj-$(CONFIG_RT3090) += rt3090/ obj-$(CONFIG_COMEDI) += comedi/ obj-$(CONFIG_ASUS_OLED) += asus_oled/ obj-$(CONFIG_PANEL) += panel/ diff --git a/drivers/staging/rt2860/pci_main_dev.c b/drivers/staging/rt2860/pci_main_dev.c index 0df1ac8162b4..1436a60e894b 100644 --- a/drivers/staging/rt2860/pci_main_dev.c +++ b/drivers/staging/rt2860/pci_main_dev.c @@ -44,6 +44,7 @@ MODULE_AUTHOR("Jett Chen "); MODULE_DESCRIPTION("RT2860/RT3090 Wireless Lan Linux Driver"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("rt3090sta"); // // Function declarations diff --git a/drivers/staging/rt3090/Kconfig b/drivers/staging/rt3090/Kconfig deleted file mode 100644 index 2b3f745d72b7..000000000000 --- a/drivers/staging/rt3090/Kconfig +++ /dev/null @@ -1,5 +0,0 @@ -config RT3090 - tristate "Ralink 3090 wireless support" - depends on PCI && X86 && WLAN - ---help--- - This is an experimental driver for the Ralink 3090 wireless chip. diff --git a/drivers/staging/rt3090/Makefile b/drivers/staging/rt3090/Makefile deleted file mode 100644 index 995491c91fce..000000000000 --- a/drivers/staging/rt3090/Makefile +++ /dev/null @@ -1,80 +0,0 @@ -obj-$(CONFIG_RT3090) += rt3090sta.o - -include drivers/staging/rt3090/config.mk - -rt3090sta-objs := \ - common/crypt_md5.o \ - common/crypt_sha2.o \ - common/crypt_hmac.o \ - common/mlme.o \ - common/cmm_wep.o \ - common/action.o \ - common/cmm_data.o \ - common/rtmp_init.o \ - common/cmm_tkip.o \ - common/cmm_aes.o \ - common/cmm_sync.o \ - common/eeprom.o \ - common/cmm_sanity.o \ - common/cmm_info.o \ - common/cmm_cfg.o \ - common/cmm_wpa.o \ - common/dfs.o \ - common/spectrum.o \ - common/rtmp_timer.o \ - common/rt_channel.o \ - common/cmm_profile.o \ - common/cmm_asic.o \ - sta/assoc.o \ - sta/auth.o \ - sta/auth_rsp.o \ - sta/sync.o \ - sta/sanity.o \ - sta/rtmp_data.o \ - sta/connect.o \ - sta/wpa.o \ - rt_linux.o \ - rt_profile.o \ - rt_main_dev.o \ - sta_ioctl.o - -#ifdef DOT11_N_SUPPORT -ifeq ($(HAS_DOT11_N_SUPPORT),y) -rt3090sta-objs += \ - common/ba_action.o -endif -#endif // DOT11_N_SUPPORT // - -#ifdef ETH_CONVERT -ifeq ($(HAS_ETH_CONVERT_SUPPORT), y) -rt3090sta-objs += \ - common/cmm_mat.o \ - common/cmm_mat_iparp.o \ - common/cmm_mat_pppoe.o \ - common/cmm_mat_ipv6.o -endif -#endif // ETH_CONVERT // - -ifeq ($(HAS_BLOCK_NET_IF),y) -rt3090sta-objs += common/netif_block.o -endif - -ifeq ($(HAS_QOS_DLS_SUPPORT),y) -rt3090sta-objs += sta/dls.o -endif - -rt3090sta-objs += \ - pci_main_dev.o \ - rt_pci_rbus.o \ - common/cmm_mac_pci.o \ - common/cmm_data_pci.o \ - common/ee_prom.o \ - common/ee_efuse.o \ - common/rtmp_mcu.o \ - chips/rt30xx.o \ - common/rt_rf.o \ - chips/rt3090.o - -ifeq ($(HAS_ATE),y) -rt3090sta-objs += rt_ate.o -endif diff --git a/drivers/staging/rt3090/action.h b/drivers/staging/rt3090/action.h deleted file mode 100644 index ac0a0a3c5ce4..000000000000 --- a/drivers/staging/rt3090/action.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - aironet.h - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Name Date Modification logs - Paul Lin 04-06-15 Initial -*/ - -#ifndef __ACTION_H__ -#define __ACTION_H__ - -typedef struct PACKED __HT_INFO_OCTET -{ -#ifdef RT_BIG_ENDIAN - UCHAR Reserved:5; - UCHAR STA_Channel_Width:1; - UCHAR Forty_MHz_Intolerant:1; - UCHAR Request:1; -#else - UCHAR Request:1; - UCHAR Forty_MHz_Intolerant:1; - UCHAR STA_Channel_Width:1; - UCHAR Reserved:5; -#endif -} HT_INFORMATION_OCTET; - - -typedef struct PACKED __FRAME_HT_INFO -{ - HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; - HT_INFORMATION_OCTET HT_Info; -} FRAME_HT_INFO, *PFRAME_HT_INFO; - -#endif /* __ACTION_H__ */ diff --git a/drivers/staging/rt3090/ap.h b/drivers/staging/rt3090/ap.h deleted file mode 100644 index e89430381071..000000000000 --- a/drivers/staging/rt3090/ap.h +++ /dev/null @@ -1,512 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - ap.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Paul Lin 08-01-2002 created - James Tan 09-06-2002 modified (Revise NTCRegTable) - John Chang 12-22-2004 modified for RT2561/2661. merge with STA driver -*/ -#ifndef __AP_H__ -#define __AP_H__ - - -// ============================================================= -// Function Prototypes -// ============================================================= - -// ap_data.c - -BOOLEAN APBridgeToWirelessSta( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pHeader, - IN UINT HdrLen, - IN PUCHAR pData, - IN UINT DataLen, - IN ULONG fromwdsidx); - - -VOID APSendPackets( - IN NDIS_HANDLE MiniportAdapterContext, - IN PPNDIS_PACKET ppPacketArray, - IN UINT NumberOfPackets); - -NDIS_STATUS APSendPacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket); - - -NDIS_STATUS APHardTransmit( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR QueIdx); - -VOID APRxEAPOLFrameIndicate( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID); - -NDIS_STATUS APCheckRxError( - IN PRTMP_ADAPTER pAd, - IN PRT28XX_RXD_STRUC pRxD, - IN UCHAR Wcid); - -BOOLEAN APCheckClass2Class3Error( - IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN PHEADER_802_11 pHeader); - -VOID APHandleRxPsPoll( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN USHORT Aid, - IN BOOLEAN isActive); - -VOID RTMPDescriptorEndianChange( - IN PUCHAR pData, - IN ULONG DescriptorType); - -VOID RTMPFrameEndianChange( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG Dir, - IN BOOLEAN FromRxDoneInt); - -// ap_assoc.c - -VOID APAssocStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - OUT STATE_MACHINE_FUNC Trans[]); - -VOID APPeerAssocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APPeerReassocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APPeerDisassocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MbssKickOutStas( - IN PRTMP_ADAPTER pAd, - IN INT apidx, - IN USHORT Reason); - -VOID APMlmeKickOutSta( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pStaAddr, - IN UCHAR Wcid, - IN USHORT Reason); - -VOID APMlmeDisassocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APCls3errAction( - IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN PHEADER_802_11 pHeader); - - -USHORT APBuildAssociation( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN USHORT CapabilityInfo, - IN UCHAR MaxSupportedRateIn500Kbps, - IN UCHAR *RSN, - IN UCHAR *pRSNLen, - IN BOOLEAN bWmmCapable, - IN ULONG RalinkIe, -#ifdef DOT11N_DRAFT3 - IN EXT_CAP_INFO_ELEMENT ExtCapInfo, -#endif // DOT11N_DRAFT3 // - IN HT_CAPABILITY_IE *pHtCapability, - IN UCHAR HtCapabilityLen, - OUT USHORT *pAid); - -/* -VOID RTMPAddClientSec( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssIdx, - IN UCHAR KeyIdx, - IN UCHAR CipherAlg, - IN PUCHAR pKey, - IN PUCHAR pTxMic, - IN PUCHAR pRxMic, - IN MAC_TABLE_ENTRY *pEntry); -*/ - -// ap_auth.c - -void APAuthStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *Sm, - OUT STATE_MACHINE_FUNC Trans[]); - -VOID APCls2errAction( - IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN PHEADER_802_11 pHeader); - -// ap_connect.c - - -VOID APMakeBssBeacon( - IN PRTMP_ADAPTER pAd, - IN INT apidx); - -VOID APUpdateBeaconFrame( - IN PRTMP_ADAPTER pAd, - IN INT apidx); - -VOID APMakeAllBssBeacon( - IN PRTMP_ADAPTER pAd); - -VOID APUpdateAllBeaconFrame( - IN PRTMP_ADAPTER pAd); - - -// ap_sync.c - -VOID APSyncStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *Sm, - OUT STATE_MACHINE_FUNC Trans[]); - -VOID APScanTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID APInvalidStateWhenScan( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APScanTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APPeerProbeReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APPeerBeaconAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APMlmeScanReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APPeerBeaconAtScanAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID APScanCnclAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID ApSiteSurvey( - IN PRTMP_ADAPTER pAd, - IN PNDIS_802_11_SSID pSsid, - IN UCHAR ScanType); - -VOID SupportRate( - IN PUCHAR SupRate, - IN UCHAR SupRateLen, - IN PUCHAR ExtRate, - IN UCHAR ExtRateLen, - OUT PUCHAR *Rates, - OUT PUCHAR RatesLen, - OUT PUCHAR pMaxSupportRate); - - -BOOLEAN ApScanRunning( - IN PRTMP_ADAPTER pAd); - -#ifdef DOT11N_DRAFT3 -VOID APOverlappingBSSScan( - IN RTMP_ADAPTER *pAd); -#endif // DOT11N_DRAFT3 // - -// ap_wpa.c -VOID WpaStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *Sm, - OUT STATE_MACHINE_FUNC Trans[]); - -// ap_mlme.c -VOID APMlmePeriodicExec( - IN PRTMP_ADAPTER pAd); - -VOID APMlmeSelectTxRateTable( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR *ppTable, - IN PUCHAR pTableSize, - IN PUCHAR pInitTxRateIdx); - -VOID APMlmeSetTxRate( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PRTMP_TX_RATE_SWITCH pTxRate); - -VOID APMlmeDynamicTxRateSwitching( - IN PRTMP_ADAPTER pAd); - -VOID APQuickResponeForRateUpExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -BOOLEAN APMsgTypeSubst( - IN PRTMP_ADAPTER pAd, - IN PFRAME_802_11 pFrame, - OUT INT *Machine, - OUT INT *MsgType); - -VOID APQuickResponeForRateUpExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - - -VOID RTMPSetPiggyBack( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bPiggyBack); - -VOID APAsicEvaluateRxAnt( - IN PRTMP_ADAPTER pAd); - -VOID APAsicRxAntEvalTimeout( - IN PRTMP_ADAPTER pAd); - -// ap.c - -VOID APSwitchChannel( - IN PRTMP_ADAPTER pAd, - IN INT Channel); - -NDIS_STATUS APInitialize( - IN PRTMP_ADAPTER pAd); - -VOID APShutdown( - IN PRTMP_ADAPTER pAd); - -VOID APStartUp( - IN PRTMP_ADAPTER pAd); - -VOID APStop( - IN PRTMP_ADAPTER pAd); - -VOID APCleanupPsQueue( - IN PRTMP_ADAPTER pAd, - IN PQUEUE_HEADER pQueue); - -VOID MacTableReset( - IN PRTMP_ADAPTER pAd); - -MAC_TABLE_ENTRY *MacTableInsertEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR apidx, - IN BOOLEAN CleanAll); - -BOOLEAN MacTableDeleteEntry( - IN PRTMP_ADAPTER pAd, - IN USHORT wcid, - IN PUCHAR pAddr); - -MAC_TABLE_ENTRY *MacTableLookup( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr); - -VOID MacTableMaintenance( - IN PRTMP_ADAPTER pAd); - -UINT32 MacTableAssocStaNumGet( - IN PRTMP_ADAPTER pAd); - -MAC_TABLE_ENTRY *APSsPsInquiry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - OUT SST *Sst, - OUT USHORT *Aid, - OUT UCHAR *PsMode, - OUT UCHAR *Rate); - -BOOLEAN APPsIndicate( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN ULONG Wcid, - IN UCHAR Psm); - -VOID ApLogEvent( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN USHORT Event); - -#ifdef DOT11_N_SUPPORT -VOID APUpdateOperationMode( - IN PRTMP_ADAPTER pAd); -#endif // DOT11_N_SUPPORT // - -VOID APUpdateCapabilityAndErpIe( - IN PRTMP_ADAPTER pAd); - -BOOLEAN ApCheckAccessControlList( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR Apidx); - -VOID ApUpdateAccessControlList( - IN PRTMP_ADAPTER pAd, - IN UCHAR Apidx); - -VOID ApEnqueueNullFrame( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR TxRate, - IN UCHAR PID, - IN UCHAR apidx, - IN BOOLEAN bQosNull, - IN BOOLEAN bEOSP, - IN UCHAR OldUP); - -VOID ApSendFrame( - IN PRTMP_ADAPTER pAd, - IN PVOID pBuffer, - IN ULONG Length, - IN UCHAR TxRate, - IN UCHAR PID); - -VOID ApEnqueueAckFrame( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR TxRate, - IN UCHAR apidx); - -// ap_sanity.c - - -BOOLEAN PeerAssocReqCmmSanity( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN isRessoc, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *pCapabilityInfo, - OUT USHORT *pListenInterval, - OUT PUCHAR pApAddr, - OUT UCHAR *pSsidLen, - OUT char *Ssid, - OUT UCHAR *pRatesLen, - OUT UCHAR Rates[], - OUT UCHAR *RSN, - OUT UCHAR *pRSNLen, - OUT BOOLEAN *pbWmmCapable, - OUT ULONG *pRalinkIe, -#ifdef DOT11N_DRAFT3 - OUT EXT_CAP_INFO_ELEMENT *pExtCapInfo, -#endif // DOT11N_DRAFT3 // - OUT UCHAR *pHtCapabilityLen, - OUT HT_CAPABILITY_IE *pHtCapability); - - -BOOLEAN PeerDisassocReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *Reason); - -BOOLEAN PeerDeauthReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *Reason); - -BOOLEAN APPeerAuthSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr1, - OUT PUCHAR pAddr2, - OUT USHORT *Alg, - OUT USHORT *Seq, - OUT USHORT *Status, - OUT CHAR *ChlgText - ); - -BOOLEAN APPeerProbeReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT CHAR Ssid[], - OUT UCHAR *SsidLen); - -BOOLEAN APPeerBeaconAndProbeRspSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT PUCHAR pBssid, - OUT CHAR Ssid[], - OUT UCHAR *SsidLen, - OUT UCHAR *BssType, - OUT USHORT *BeaconPeriod, - OUT UCHAR *Channel, - OUT LARGE_INTEGER *Timestamp, - OUT USHORT *CapabilityInfo, - OUT UCHAR Rate[], - OUT UCHAR *RateLen, - OUT BOOLEAN *ExtendedRateIeExist, - OUT UCHAR *Erp); -#if defined(RT30xx) || defined(RT305x) -VOID EnableAPMIMOPS( - IN PRTMP_ADAPTER pAd); - -VOID DisableAPMIMOPS( - IN PRTMP_ADAPTER pAd); -#endif -#endif // __AP_H__ diff --git a/drivers/staging/rt3090/ap_apcli.h b/drivers/staging/rt3090/ap_apcli.h deleted file mode 100644 index d363c36b8287..000000000000 --- a/drivers/staging/rt3090/ap_apcli.h +++ /dev/null @@ -1,276 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - ap_apcli.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Shiang, Fonchi 02-13-2007 created -*/ - -#ifndef _AP_APCLI_H_ -#define _AP_APCLI_H_ - -#ifdef APCLI_SUPPORT - -#include "rtmp.h" - -#define AUTH_TIMEOUT 300 // unit: msec -#define ASSOC_TIMEOUT 300 // unit: msec -//#define JOIN_TIMEOUT 2000 // unit: msec // not used in Ap-client mode, remove it -#define PROBE_TIMEOUT 1000 // unit: msec - -#define APCLI_ROOT_BSSID_GET(pAd, wcid) ((pAd)->MacTab.Content[(wcid)].Addr) -#define APCLI_IF_UP_CHECK(pAd, ifidx) ((pAd)->ApCfg.ApCliTab[(ifidx)].dev->flags & IFF_UP) - -/* sanity check for apidx */ -#define APCLI_MR_APIDX_SANITY_CHECK(idx) \ -{ \ - if ((idx) >= MAX_APCLI_NUM) \ - { \ - (idx) = 0; \ - DBGPRINT(RT_DEBUG_ERROR, ("%s> Error! apcli-idx > MAX_APCLI_NUM!\n", __FUNCTION__)); \ - } \ -} - -typedef struct _APCLI_MLME_JOIN_REQ_STRUCT { - UCHAR Bssid[MAC_ADDR_LEN]; - UCHAR SsidLen; - UCHAR Ssid[MAX_LEN_OF_SSID]; -} APCLI_MLME_JOIN_REQ_STRUCT; - -typedef struct _STA_CTRL_JOIN_REQ_STRUCT { - USHORT Status; -} APCLI_CTRL_MSG_STRUCT, *PSTA_CTRL_MSG_STRUCT; - -BOOLEAN isValidApCliIf( - SHORT ifIndex); - -// -// Private routines in apcli_ctrl.c -// -VOID ApCliCtrlStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE_EX *Sm, - OUT STATE_MACHINE_FUNC_EX Trans[]); - -// -// Private routines in apcli_sync.c -// -VOID ApCliSyncStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE_EX *Sm, - OUT STATE_MACHINE_FUNC_EX Trans[]); - -// -// Private routines in apcli_auth.c -// -VOID ApCliAuthStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE_EX *Sm, - OUT STATE_MACHINE_FUNC_EX Trans[]); - -// -// Private routines in apcli_assoc.c -// -VOID ApCliAssocStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE_EX *Sm, - OUT STATE_MACHINE_FUNC_EX Trans[]); - -MAC_TABLE_ENTRY *ApCliTableLookUpByWcid( - IN PRTMP_ADAPTER pAd, - IN UCHAR wcid, - IN PUCHAR pAddrs); - - -BOOLEAN ApCliAllowToSendPacket( - IN RTMP_ADAPTER *pAd, - IN PNDIS_PACKET pPacket, - OUT UCHAR *pWcid); - -BOOLEAN ApCliValidateRSNIE( - IN PRTMP_ADAPTER pAd, - IN PEID_STRUCT pEid_ptr, - IN USHORT eid_len, - IN USHORT idx); - -VOID RT28xx_ApCli_Init( - IN PRTMP_ADAPTER pAd, - IN PNET_DEV pPhyNetDev); - -VOID RT28xx_ApCli_Close( - IN PRTMP_ADAPTER pAd); - -VOID RT28xx_ApCli_Remove( - IN PRTMP_ADAPTER pAd); - - -VOID RT28xx_ApCli_Remove( - IN PRTMP_ADAPTER ad_p); - -INT ApCliIfLookUp( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr); - -INT ApCli_VirtualIF_Open( - IN PNET_DEV dev_p); - -INT ApCli_VirtualIF_Close( - IN PNET_DEV dev_p); - -INT ApCli_VirtualIF_PacketSend( - IN PNDIS_PACKET skb_p, - IN PNET_DEV dev_p); - -INT ApCli_VirtualIF_Ioctl( - IN PNET_DEV dev_p, - IN OUT struct ifreq *rq_p, - IN INT cmd); - - -VOID ApCliMgtMacHeaderInit( - IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, - IN UCHAR SubType, - IN UCHAR ToDs, - IN PUCHAR pDA, - IN PUCHAR pBssid, - IN USHORT ifIndex); - -#ifdef DOT11_N_SUPPORT -BOOLEAN ApCliCheckHt( - IN PRTMP_ADAPTER pAd, - IN USHORT IfIndex, - IN OUT HT_CAPABILITY_IE *pHtCapability, - IN OUT ADD_HT_INFO_IE *pAddHtInfo); -#endif // DOT11_N_SUPPORT // - -BOOLEAN ApCliLinkUp( - IN PRTMP_ADAPTER pAd, - IN UCHAR ifIndex); - -VOID ApCliLinkDown( - IN PRTMP_ADAPTER pAd, - IN UCHAR ifIndex); - -VOID ApCliIfUp( - IN PRTMP_ADAPTER pAd); - -VOID ApCliIfDown( - IN PRTMP_ADAPTER pAd); - -VOID ApCliIfMonitor( - IN PRTMP_ADAPTER pAd); - -BOOLEAN ApCliMsgTypeSubst( - IN PRTMP_ADAPTER pAd, - IN PFRAME_802_11 pFrame, - OUT INT *Machine, - OUT INT *MsgType); - -BOOLEAN preCheckMsgTypeSubset( - IN PRTMP_ADAPTER pAd, - IN PFRAME_802_11 pFrame, - OUT INT *Machine, - OUT INT *MsgType); - -BOOLEAN ApCliPeerAssocRspSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *pCapabilityInfo, - OUT USHORT *pStatus, - OUT USHORT *pAid, - OUT UCHAR SupRate[], - OUT UCHAR *pSupRateLen, - OUT UCHAR ExtRate[], - OUT UCHAR *pExtRateLen, - OUT HT_CAPABILITY_IE *pHtCapability, - OUT ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE - OUT UCHAR *pHtCapabilityLen, - OUT UCHAR *pAddHtInfoLen, - OUT UCHAR *pNewExtChannelOffset, - OUT PEDCA_PARM pEdcaParm, - OUT UCHAR *pCkipFlag); - -VOID ApCliPeerPairMsg1Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem); - -VOID ApCliPeerPairMsg3Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem); - -VOID ApCliPeerGroupMsg1Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem); - -BOOLEAN ApCliCheckRSNIE( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN UCHAR DataLen, - IN MAC_TABLE_ENTRY *pEntry, - OUT UCHAR *Offset); - -BOOLEAN ApCliParseKeyData( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKeyData, - IN UCHAR KeyDataLen, - IN MAC_TABLE_ENTRY *pEntry, - IN UCHAR IfIdx, - IN UCHAR bPairewise); - -BOOLEAN ApCliHandleRxBroadcastFrame( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN MAC_TABLE_ENTRY *pEntry, - IN UCHAR FromWhichBSSID); - -VOID APCliUpdatePairwiseKeyTable( - IN PRTMP_ADAPTER pAd, - IN UCHAR *KeyRsc, - IN MAC_TABLE_ENTRY *pEntry); - -BOOLEAN APCliUpdateSharedKeyTable( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKey, - IN UCHAR KeyLen, - IN UCHAR DefaultKeyIdx, - IN MAC_TABLE_ENTRY *pEntry); - -#endif // APCLI_SUPPORT // - -#endif /* _AP_APCLI_H_ */ diff --git a/drivers/staging/rt3090/ap_autoChSel.h b/drivers/staging/rt3090/ap_autoChSel.h deleted file mode 100644 index 46881ff857ac..000000000000 --- a/drivers/staging/rt3090/ap_autoChSel.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - ap_autoChSel.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#include "ap_autoChSel_cmm.h" - -#ifndef __AUTOCHSELECT_H__ -#define __AUTOCHSELECT_H__ - -#ifdef AUTO_CH_SELECT_ENHANCE -#define AP_AUTO_CH_SEL(__P, __O) New_APAutoSelectChannel((__P), (__O)) -#else -#define AP_AUTO_CH_SEL(__P, __O) APAutoSelectChannel((__P), (__O)) -#endif - - -ULONG AutoChBssInsertEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pBssid, - IN CHAR Ssid[], - IN UCHAR SsidLen, - IN UCHAR ChannelNo, - IN UCHAR ExtChOffset, - IN CHAR Rssi); - -void AutoChBssTableInit( - IN PRTMP_ADAPTER pAd); - -void ChannelInfoInit( - IN PRTMP_ADAPTER pAd); - -void AutoChBssTableDestroy( - IN PRTMP_ADAPTER pAd); - -void ChannelInfoDestroy( - IN PRTMP_ADAPTER pAd); - -UCHAR New_APAutoSelectChannel( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN Optimal); - -UCHAR APAutoSelectChannel( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN Optimal); - -#endif // __AUTOCHSELECT_H__ // diff --git a/drivers/staging/rt3090/ap_autoChSel_cmm.h b/drivers/staging/rt3090/ap_autoChSel_cmm.h deleted file mode 100644 index ad77ec125625..000000000000 --- a/drivers/staging/rt3090/ap_autoChSel_cmm.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - ap_autoChSel_cmm.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - - -#ifndef __AUTOCHSELECT_CMM_H__ -#define __AUTOCHSELECT_CMM_H__ - -#define RSSI_TO_DBM_OFFSET 120 // RSSI-115 = dBm - - -typedef struct { - ULONG dirtyness[MAX_NUM_OF_CHANNELS+1]; - ULONG max_rssi[MAX_NUM_OF_CHANNELS+1]; - ULONG total_rssi[MAX_NUM_OF_CHANNELS+1]; - UINT32 FalseCCA[MAX_NUM_OF_CHANNELS+1]; -} CHANNELINFO, *PCHANNELINFO; - -typedef struct { - UCHAR Bssid[MAC_ADDR_LEN]; - UCHAR SsidLen; - CHAR Ssid[MAX_LEN_OF_SSID]; - UCHAR Channel; - UCHAR ExtChOffset; - UCHAR Rssi; -} BSSENTRY, *PBSSENTRY; - -typedef struct { - UCHAR BssNr; - BSSENTRY BssEntry[MAX_LEN_OF_BSS_TABLE]; -} BSSINFO, *PBSSINFO; - -#endif // __AUTOCHSELECT_CMM_H__ // diff --git a/drivers/staging/rt3090/ap_cfg.h b/drivers/staging/rt3090/ap_cfg.h deleted file mode 100644 index 7c99423900ad..000000000000 --- a/drivers/staging/rt3090/ap_cfg.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - ap_cfg.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ -#ifndef __AP_CFG_H__ -#define __AP_CFG_H__ - - -#include "rt_config.h" - -INT RTMPAPPrivIoctlSet( - IN RTMP_ADAPTER *pAd, - IN struct iwreq *pIoctlCmdStr); - -INT RTMPAPPrivIoctlShow( - IN RTMP_ADAPTER *pAd, - IN struct iwreq *pIoctlCmdStr); - -INT RTMPAPSetInformation( - IN PRTMP_ADAPTER pAd, - IN OUT struct iwreq *rq, - IN INT cmd); - -INT RTMPAPQueryInformation( - IN PRTMP_ADAPTER pAd, - IN OUT struct iwreq *rq, - IN INT cmd); - -VOID RTMPIoctlStatistics( - IN PRTMP_ADAPTER pAd, - IN struct iwreq *wrq); - -VOID RTMPIoctlGetMacTable( - IN PRTMP_ADAPTER pAd, - IN struct iwreq *wrq); - -#ifdef DBG -VOID RTMPAPIoctlBBP( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq); - -VOID RTMPAPIoctlMAC( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq); - -VOID RTMPAPIoctlE2PROM( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq); - -#ifdef RTMP_RF_RW_SUPPORT -VOID RTMPAPIoctlRF( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq); -#endif // RTMP_RF_RW_SUPPORT // - -#endif // DBG // - -VOID RT28XX_IOCTL_MaxRateGet( - IN RTMP_ADAPTER *pAd, - IN PHTTRANSMIT_SETTING pHtPhyMode, - OUT UINT32 *pRate); - - -#ifdef DOT11_N_SUPPORT -VOID RTMPIoctlQueryBaTable( - IN PRTMP_ADAPTER pAd, - IN struct iwreq *wrq); -#endif // DOT11_N_SUPPORT // - -VOID RTMPIoctlStaticWepCopy( - IN PRTMP_ADAPTER pAd, - IN struct iwreq *wrq); - -VOID RTMPIoctlRadiusData( - IN PRTMP_ADAPTER pAd, - IN struct iwreq *wrq); - -VOID RTMPIoctlAddWPAKey( - IN PRTMP_ADAPTER pAd, - IN struct iwreq *wrq); - -VOID RTMPIoctlAddPMKIDCache( - IN PRTMP_ADAPTER pAd, - IN struct iwreq *wrq); - -#endif // __AP_CFG_H__ // diff --git a/drivers/staging/rt3090/ap_ids.h b/drivers/staging/rt3090/ap_ids.h deleted file mode 100644 index cf8797f7f580..000000000000 --- a/drivers/staging/rt3090/ap_ids.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - ap_ids.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -VOID RTMPIdsPeriodicExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -BOOLEAN RTMPSpoofedMgmtDetection( - IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHeader, - IN CHAR Rssi0, - IN CHAR Rssi1, - IN CHAR Rssi2); - -VOID RTMPConflictSsidDetection( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pSsid, - IN UCHAR SsidLen, - IN CHAR Rssi0, - IN CHAR Rssi1, - IN CHAR Rssi2); - -BOOLEAN RTMPReplayAttackDetection( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr2, - IN CHAR Rssi0, - IN CHAR Rssi1, - IN CHAR Rssi2); - -VOID RTMPUpdateStaMgmtCounter( - IN PRTMP_ADAPTER pAd, - IN USHORT type); - -VOID RTMPClearAllIdsCounter( - IN PRTMP_ADAPTER pAd); - -VOID RTMPIdsStart( - IN PRTMP_ADAPTER pAd); - -VOID RTMPIdsStop( - IN PRTMP_ADAPTER pAd); - -VOID rtmp_read_ids_from_file( - IN PRTMP_ADAPTER pAd, - char *tmpbuf, - char *buffer); diff --git a/drivers/staging/rt3090/ap_mbss.h b/drivers/staging/rt3090/ap_mbss.h deleted file mode 100644 index f78556c529a8..000000000000 --- a/drivers/staging/rt3090/ap_mbss.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - ap_mbss.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#ifndef MODULE_MBSS - -#define MBSS_EXTERN extern - -#else - -#define MBSS_EXTERN - -#endif // MODULE_MBSS // - - -/* Public function list */ -MBSS_EXTERN VOID RT28xx_MBSS_Init( - IN PRTMP_ADAPTER ad_p, - IN PNET_DEV main_dev_p); - -MBSS_EXTERN VOID RT28xx_MBSS_Close( - IN PRTMP_ADAPTER ad_p); - -MBSS_EXTERN VOID RT28xx_MBSS_Remove( - IN PRTMP_ADAPTER ad_p); - -INT MBSS_VirtualIF_Open( - IN PNET_DEV dev_p); -INT MBSS_VirtualIF_Close( - IN PNET_DEV dev_p); -INT MBSS_VirtualIF_PacketSend( - IN PNDIS_PACKET skb_p, - IN PNET_DEV dev_p); -INT MBSS_VirtualIF_Ioctl( - IN PNET_DEV dev_p, - IN OUT struct ifreq *rq_p, - IN INT cmd); - -/* End of ap_mbss.h */ diff --git a/drivers/staging/rt3090/ap_uapsd.h b/drivers/staging/rt3090/ap_uapsd.h deleted file mode 100644 index d49a9e7500b4..000000000000 --- a/drivers/staging/rt3090/ap_uapsd.h +++ /dev/null @@ -1,636 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - ap_uapsd.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -/* only for UAPSD_TIMING_RECORD */ - -//#define UAPSD_TIMING_RECORD_FUNC - -#define UAPSD_TIMING_RECORD_MAX 1000 -#define UAPSD_TIMING_RECORD_DISPLAY_TIMES 10 - -#define UAPSD_TIMING_RECORD_ISR 1 -#define UAPSD_TIMING_RECORD_TASKLET 2 -#define UAPSD_TIMING_RECORD_TRG_RCV 3 -#define UAPSD_TIMING_RECORD_MOVE2TX 4 -#define UAPSD_TIMING_RECORD_TX2AIR 5 - -#define UAPSD_TIMING_CTRL_STOP 0 -#define UAPSD_TIMING_CTRL_START 1 -#define UAPSD_TIMING_CTRL_SUSPEND 2 - -#define UAPSD_TIMESTAMP_GET(__pAd, __TimeStamp) \ - { \ - UINT32 __CSR=0; UINT64 __Value64; \ - RTMP_IO_READ32((__pAd), TSF_TIMER_DW0, &__CSR); \ - __TimeStamp = (UINT64)__CSR; \ - RTMP_IO_READ32((__pAd), TSF_TIMER_DW1, &__CSR); \ - __Value64 = (UINT64)__CSR; \ - __TimeStamp |= (__Value64 << 32); \ - } - -#ifdef LINUX -#define UAPSD_TIME_GET(__pAd, __Time) \ - __Time = jiffies -#endif // LINUX // - - -#ifdef UAPSD_TIMING_RECORD_FUNC -#define UAPSD_TIMING_RECORD_START() \ - UAPSD_TimingRecordCtrl(UAPSD_TIMING_CTRL_START); -#define UAPSD_TIMING_RECORD_STOP() \ - UAPSD_TimingRecordCtrl(UAPSD_TIMING_CTRL_STOP); -#define UAPSD_TIMING_RECORD(__pAd, __Type) \ - UAPSD_TimingRecord(__pAd, __Type); -#define UAPSD_TIMING_RECORD_INDEX(__LoopIndex) \ - UAPSD_TimeingRecordLoopIndex(__LoopIndex); -#else - -#define UAPSD_TIMING_RECORD_START() -#define UAPSD_TIMING_RECORD_STOP() -#define UAPSD_TIMING_RECORD(__pAd, __type) -#define UAPSD_TIMING_RECORD_INDEX(__LoopIndex) -#endif // UAPSD_TIMING_RECORD_FUNC // - - -#ifndef MODULE_WMM_UAPSD - -#define UAPSD_EXTERN extern - -/* Public Marco list */ - -/* - Init some parameters in packet structure for QoS Null frame; - purpose: is for management frame tx done use -*/ -#define UAPSD_MR_QOS_NULL_HANDLE(__pAd, __pData, __pPacket) \ - { \ - PHEADER_802_11 __pHeader = (PHEADER_802_11)(__pData); \ - MAC_TABLE_ENTRY *__pEntry; \ - if (__pHeader->FC.SubType == SUBTYPE_QOS_NULL) \ - { \ - RTMP_SET_PACKET_QOS_NULL((__pPacket)); \ - __pEntry = MacTableLookup((__pAd), __pHeader->Addr1); \ - if (__pEntry != NULL) \ - { \ - RTMP_SET_PACKET_WCID((__pPacket), __pEntry->Aid); \ - } \ - } \ - else \ - { \ - RTMP_SET_PACKET_NON_QOS_NULL((__pPacket)); \ - } \ - } - -/* - Init MAC entry UAPSD parameters; - purpose: initialize UAPSD PS queue and control parameters -*/ -#define UAPSD_MR_ENTRY_INIT(__pEntry) \ - { \ - UINT16 __IdAc; \ - for(__IdAc=0; __IdAcUAPSDQueue[__IdAc]); \ - (__pEntry)->UAPSDTxNum = 0; \ - (__pEntry)->pUAPSDEOSPFrame = NULL; \ - (__pEntry)->bAPSDFlagSPStart = 0; \ - (__pEntry)->bAPSDFlagEOSPOK = 0; \ - (__pEntry)->MaxSPLength = 0; \ - } - -/* - Reset MAC entry UAPSD parameters; - purpose: clean all UAPSD PS queue; release the EOSP frame if exists; - reset control parameters -*/ -#define UAPSD_MR_ENTRY_RESET(__pAd, __pEntry) \ - { \ - MAC_TABLE_ENTRY *__pSta; \ - UINT32 __IdAc; \ - __pSta = (__pEntry); \ - /* clear all U-APSD queues */ \ - for(__IdAc=0; __IdAcUAPSDQueue[__IdAc]); \ - /* clear EOSP frame */ \ - __pSta->UAPSDTxNum = 0; \ - if (__pSta->pUAPSDEOSPFrame != NULL) { \ - RELEASE_NDIS_PACKET((__pAd), \ - QUEUE_ENTRY_TO_PACKET(__pSta->pUAPSDEOSPFrame), \ - NDIS_STATUS_FAILURE); \ - __pSta->pUAPSDEOSPFrame = NULL; } \ - __pSta->bAPSDFlagSPStart = 0; \ - __pSta->bAPSDFlagEOSPOK = 0; } - -/* - Enable or disable UAPSD flag in WMM element in beacon frame; - purpose: set UAPSD enable/disable bit -*/ -#define UAPSD_MR_IE_FILL(__QosCtrlField, __pAd) \ - (__QosCtrlField) |= ((__pAd)->CommonCfg.bAPSDCapable) ? 0x80 : 0x00; - -/* - Check if we do NOT need to control TIM bit for the station; - note: we control TIM bit only when all AC are UAPSD AC -*/ -#define UAPSD_MR_IS_NOT_TIM_BIT_NEEDED_HANDLED(__pMacEntry, __QueIdx) \ - (CLIENT_STATUS_TEST_FLAG((__pMacEntry), fCLIENT_STATUS_APSD_CAPABLE) && \ - (!(__pMacEntry)->bAPSDDeliverEnabledPerAC[QID_AC_VO] || \ - !(__pMacEntry)->bAPSDDeliverEnabledPerAC[QID_AC_VI] || \ - !(__pMacEntry)->bAPSDDeliverEnabledPerAC[QID_AC_BE] || \ - !(__pMacEntry)->bAPSDDeliverEnabledPerAC[QID_AC_BK]) && \ - (__pMacEntry)->bAPSDDeliverEnabledPerAC[__QueIdx]) - -/* check if the AC is UAPSD delivery-enabled AC */ -#define UAPSD_MR_IS_UAPSD_AC(__pMacEntry, __AcId) \ - (CLIENT_STATUS_TEST_FLAG((__pMacEntry), fCLIENT_STATUS_APSD_CAPABLE) && \ - ((0 <= (__AcId)) && ((__AcId) < WMM_NUM_OF_AC)) && /* 0 ~ 3 */ \ - (__pMacEntry)->bAPSDDeliverEnabledPerAC[(__AcId)]) - -/* check if all AC are UAPSD delivery-enabled AC */ -#define UAPSD_MR_IS_ALL_AC_UAPSD(__FlgIsActive, __pMacEntry) \ - (((__FlgIsActive) == FALSE) && ((__pMacEntry)->bAPSDAllAC == 1)) - -/* suspend SP */ -#define UAPSD_MR_SP_SUSPEND(__pAd) \ - (__pAd)->bAPSDFlagSPSuspend = 1; - -/* resume SP */ -#define UAPSD_MR_SP_RESUME(__pAd) \ - (__pAd)->bAPSDFlagSPSuspend = 0; - -/* mark PS poll frame sent in mix mode */ -#ifdef RTMP_MAC_PCI -/* - Note: - (1) When SP is not started, try to mark a flag to record if the legacy ps - packet is handled in statistics handler; - (2) When SP is started, increase the UAPSD count number for the legacy PS. -*/ -#define UAPSD_MR_MIX_PS_POLL_RCV(__pAd, __pMacEntry) \ - if ((__pMacEntry)->bAPSDFlagSpRoughUse == 0) \ - { \ - if ((__pMacEntry)->bAPSDFlagSPStart == 0) \ - { \ - if ((__pMacEntry)->bAPSDFlagLegacySent == 1) \ - NICUpdateFifoStaCounters((__pAd)); \ - (__pMacEntry)->bAPSDFlagLegacySent = 1; \ - } \ - else \ - { \ - (__pMacEntry)->UAPSDTxNum ++; \ - } \ - } -#endif // RTMP_MAC_PCI // - - -#else - -#define UAPSD_EXTERN -#define UAPSD_QOS_NULL_QUE_ID 0x7f - -#ifdef RTMP_MAC_PCI -/* - In RT2870, FIFO counter is for all stations, not for per-entry, - so we can not use accurate method in RT2870 -*/ - -/* - Note for SP ACCURATE Mechanism: - 1. When traffic is busy for the PS station - Statistics FIFO counter maybe overflow before we read it, so UAPSD - counting mechanism will not accurately. - - Solution: - We need to avoid the worse case so we suggest a maximum interval for - a SP that the interval between last frame from QAP and data frame from - QSTA is larger than UAPSD_EPT_SP_INT. - - 2. When traffic use CCK/1Mbps from QAP - Statistics FIFO will not count the packet. There are 2 cases: - (1) We force to downgrage ARP response & DHCP packet to 1Mbps; - (2) After rate switch mechanism, tx rate is fixed to 1Mbps. - - Solution: - Use old DMA UAPSD mechanism. - - 3. When part of AC uses legacy PS mode - Statistics count will inclue packet statistics for legacy PS packets - so we can not know which one is UAPSD, which one is legacy. - - Solution: - Cound the legacy PS packet. - - 4. Check FIFO statistics count in Rx Done function - We can not to check TX FIFO statistics count in Rx Done function or - the real packet tx/rx sequence will be disarranged. - - Solution: - Suspend SP handle before rx done and resume SP handle after rx done. -*/ -#define UAPSD_SP_ACCURATE /* use more accurate method to send EOSP */ -#endif // RTMP_MAC_PCI // - -#define UAPSD_EPT_SP_INT (100000/(1000000/OS_HZ)) /* 100ms */ - -#endif // MODULE_WMM_UAPSD // - - -/* max UAPSD buffer queue size */ -#define MAX_PACKETS_IN_UAPSD_QUEUE 16 /* for each AC = 16*4 = 64 */ - - -/* Public function list */ -/* -======================================================================== -Routine Description: - UAPSD Module Init. - -Arguments: - pAd Pointer to our adapter - -Return Value: - None - -Note: -======================================================================== -*/ -UAPSD_EXTERN VOID UAPSD_Init( - IN PRTMP_ADAPTER pAd); - - -/* -======================================================================== -Routine Description: - UAPSD Module Release. - -Arguments: - pAd Pointer to our adapter - -Return Value: - None - -Note: -======================================================================== -*/ -UAPSD_EXTERN VOID UAPSD_Release( - IN PRTMP_ADAPTER pAd); - - -/* -======================================================================== -Routine Description: - Free all EOSP frames and close all SP. - -Arguments: - pAd Pointer to our adapter - -Return Value: - None - -Note: -======================================================================== -*/ -UAPSD_EXTERN VOID UAPSD_FreeAll( - IN PRTMP_ADAPTER pAd); - - -/* -======================================================================== -Routine Description: - Close current Service Period. - -Arguments: - pAd Pointer to our adapter - pEntry Close the SP of the entry - -Return Value: - None - -Note: -======================================================================== -*/ -UAPSD_EXTERN VOID UAPSD_SP_Close( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry); - - -/* -======================================================================== -Routine Description: - Deliver all queued packets. - -Arguments: - pAd Pointer to our adapter - *pEntry STATION - -Return Value: - None - -Note: - SMP protection by caller for packet enqueue. -======================================================================== -*/ -UAPSD_EXTERN VOID UAPSD_AllPacketDeliver( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry); - - -/* -======================================================================== -Routine Description: - Parse the UAPSD field in WMM element in (re)association request frame. - -Arguments: - pAd Pointer to our adapter - *pEntry STATION - *pElm QoS information field - -Return Value: - None - -Note: - No protection is needed. - - 1. Association -> TSPEC: - use static UAPSD settings in Association - update UAPSD settings in TSPEC - - 2. Association -> TSPEC(11r) -> Reassociation: - update UAPSD settings in TSPEC - backup static UAPSD settings in Reassociation - - 3. Association -> Reassociation: - update UAPSD settings in TSPEC - backup static UAPSD settings in Reassociation -======================================================================== -*/ -UAPSD_EXTERN VOID UAPSD_AssocParse( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN UCHAR *pElm); - - -/* -======================================================================== -Routine Description: - Enqueue a UAPSD packet. - -Arguments: - pAd Pointer to our adapter - *pEntry STATION - pPacket UAPSD dnlink packet - IdAc UAPSD AC ID (0 ~ 3) - -Return Value: - None - -Note: -======================================================================== -*/ -UAPSD_EXTERN VOID UAPSD_PacketEnqueue( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN PNDIS_PACKET pPacket, - IN UINT32 IdAc); - - -/* -======================================================================== -Routine Description: - Handle QoS Null Frame Tx Done or Management Tx Done interrupt. - -Arguments: - pAd Pointer to our adapter - pPacket Completed TX packet - pDstMac Destinated MAC address - -Return Value: - None - -Note: -======================================================================== -*/ -UAPSD_EXTERN VOID UAPSD_QoSNullTxMgmtTxDoneHandle( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN UCHAR *pDstMac); - - -/* -======================================================================== -Routine Description: - Maintenance our UAPSD PS queue. Release all queued packet if timeout. - -Arguments: - pAd Pointer to our adapter - *pEntry STATION - -Return Value: - None - -Note: - If in RT2870, pEntry can not be removed during UAPSD_QueueMaintenance() -======================================================================== -*/ -UAPSD_EXTERN VOID UAPSD_QueueMaintenance( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry); - - -/* -======================================================================== -Routine Description: - Close SP in Tx Done, not Tx DMA Done. - -Arguments: - pAd Pointer to our adapter - pEntry destination entry - FlgSuccess 0:tx success, 1:tx fail - -Return Value: - None - -Note: - For RT28xx series, for packetID=0 or multicast frame, no statistics - count can be got, ex: ARP response or DHCP packets, we will use - low rate to set (CCK, MCS=0=packetID). - So SP will not be close until UAPSD_EPT_SP_INT timeout. - - So if the tx rate is 1Mbps for a entry, we will use DMA done, not - use UAPSD_SP_AUE_Handle(). -======================================================================== -*/ -UAPSD_EXTERN VOID UAPSD_SP_AUE_Handle( - IN RTMP_ADAPTER *pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN UCHAR FlgSuccess); - - -/* -======================================================================== -Routine Description: - Close current Service Period. - -Arguments: - pAd Pointer to our adapter - -Return Value: - None - -Note: - When we receive EOSP frame tx done interrupt and a uplink packet - from the station simultaneously, we will regard it as a new trigger - frame because the packet is received when EOSP frame tx done interrupt. - - We can not sure the uplink packet is sent after old SP or in the old SP. - So we must close the old SP in receive done ISR to avoid the problem. -======================================================================== -*/ -UAPSD_EXTERN VOID UAPSD_SP_CloseInRVDone( - IN PRTMP_ADAPTER pAd); - - -/* -======================================================================== -Routine Description: - Check if we need to close current SP. - -Arguments: - pAd Pointer to our adapter - pPacket Completed TX packet - pDstMac Destinated MAC address - -Return Value: - None - -Note: - 1. We need to call the function in TxDone ISR. - 2. SMP protection by caller for packet enqueue. -======================================================================== -*/ -UAPSD_EXTERN VOID UAPSD_SP_PacketCheck( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN UCHAR *pDstMac); - - -#ifdef UAPSD_TIMING_RECORD_FUNC -/* -======================================================================== -Routine Description: - Enable/Disable Timing Record Function. - -Arguments: - pAd Pointer to our adapter - Flag 1 (Enable) or 0 (Disable) - -Return Value: - None - -Note: -======================================================================== -*/ -UAPSD_EXTERN VOID UAPSD_TimingRecordCtrl( - IN UINT32 Flag); - -/* -======================================================================== -Routine Description: - Record some timings. - -Arguments: - pAd Pointer to our adapter - Type The timing is for what type - -Return Value: - None - -Note: - UAPSD_TIMING_RECORD_ISR - UAPSD_TIMING_RECORD_TASKLET - UAPSD_TIMING_RECORD_TRG_RCV - UAPSD_TIMING_RECORD_MOVE2TX - UAPSD_TIMING_RECORD_TX2AIR -======================================================================== -*/ -UAPSD_EXTERN VOID UAPSD_TimingRecord( - IN PRTMP_ADAPTER pAd, - IN UINT32 Type); - -/* -======================================================================== -Routine Description: - Record the loop index for received packet handle. - -Arguments: - pAd Pointer to our adapter - LoopIndex The RxProcessed in APRxDoneInterruptHandle() - -Return Value: - None - -Note: -======================================================================== -*/ -UAPSD_EXTERN VOID UAPSD_TimeingRecordLoopIndex( - IN UINT32 LoopIndex); -#endif // UAPSD_TIMING_RECORD_FUNC // - - -/* -======================================================================== -Routine Description: - Handle UAPSD Trigger Frame. - -Arguments: - pAd Pointer to our adapter - *pEntry the source STATION - UpOfFrame the UP of the trigger frame - -Return Value: - None - -Note: -======================================================================== -*/ -UAPSD_EXTERN VOID UAPSD_TriggerFrameHandle( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN UCHAR UpOfFrame); - - - -/* End of ap_uapsd.h */ diff --git a/drivers/staging/rt3090/ap_wds.h b/drivers/staging/rt3090/ap_wds.h deleted file mode 100644 index efcb107db4ff..000000000000 --- a/drivers/staging/rt3090/ap_wds.h +++ /dev/null @@ -1,212 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - ap_cfg.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Fonchi 02-13-2007 created -*/ - -#ifndef _AP_WDS_H_ -#define _AP_WDS_H_ - -#define WDS_ENTRY_RETRY_INTERVAL (100 * OS_HZ / 1000) - - -static inline BOOLEAN WDS_IF_UP_CHECK( - IN PRTMP_ADAPTER pAd, - IN ULONG ifidx) -{ - if ((pAd->flg_wds_init != TRUE) || - (ifidx >= MAX_WDS_ENTRY)) - return FALSE; - -// if (pAd->WdsTab.WdsEntry[ifidx].dev->flags & IFF_UP) -// Patch for wds ,when dirver call apmlmeperiod => APMlmeDynamicTxRateSwitching check if wds device ready -if ((pAd->WdsTab.WdsEntry[ifidx].dev != NULL) && (pAd->WdsTab.WdsEntry[ifidx].dev->flags & IFF_UP)) - return TRUE; - - return FALSE; -} - -LONG WdsEntryAlloc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr); - -VOID WdsEntryDel( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr); - -MAC_TABLE_ENTRY *MacTableInsertWDSEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - UINT WdsTabIdx); - -BOOLEAN MacTableDeleteWDSEntry( - IN PRTMP_ADAPTER pAd, - IN USHORT wcid, - IN PUCHAR pAddr); - - -BOOLEAN ApWdsAllowToSendPacket( - IN RTMP_ADAPTER *pAd, - IN PNDIS_PACKET pPacket, - OUT UCHAR *pWcid); - -MAC_TABLE_ENTRY *WdsTableLookupByWcid( - IN PRTMP_ADAPTER pAd, - IN UCHAR wcid, - IN PUCHAR pAddr, - IN BOOLEAN bResetIdelCount); - -MAC_TABLE_ENTRY *WdsTableLookup( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN BOOLEAN bResetIdelCount); - -MAC_TABLE_ENTRY *FindWdsEntry( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN PUCHAR pAddr, - IN UINT32 PhyMode); - -VOID WdsTableMaintenance( - IN PRTMP_ADAPTER pAd); - -VOID RT28xx_WDS_Init( - IN PRTMP_ADAPTER pAd, - IN PNET_DEV net_dev); - -VOID RT28xx_WDS_Close( - IN PRTMP_ADAPTER pAd); - -VOID RT28xx_WDS_Remove( - IN PRTMP_ADAPTER pAd); - -VOID WdsDown( - IN PRTMP_ADAPTER pAd); - -VOID AsicUpdateWdsRxWCIDTable( - IN PRTMP_ADAPTER pAd); - -VOID AsicUpdateWdsEncryption( - IN PRTMP_ADAPTER pAd, - IN UCHAR wcid); - -VOID WdsPeerBeaconProc( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN USHORT CapabilityInfo, - IN UCHAR MaxSupportedRateIn500Kbps, - IN UCHAR MaxSupportedRateLen, - IN BOOLEAN bWmmCapable, - IN ULONG ClientRalinkIe, - IN HT_CAPABILITY_IE *pHtCapability, - IN UCHAR HtCapabilityLen); - -VOID APWdsInitialize( - IN PRTMP_ADAPTER pAd); - -INT Show_WdsTable_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -VOID rtmp_read_wds_from_file( - IN PRTMP_ADAPTER pAd, - PSTRING tmpbuf, - PSTRING buffer); - -VOID WdsPrepareWepKeyFromMainBss( - IN PRTMP_ADAPTER pAd); - -INT WdsVirtualIFSendPackets( - IN PNDIS_PACKET pSkb, - IN PNET_DEV dev); - -INT WdsVirtualIF_open( - IN PNET_DEV dev); - -INT WdsVirtualIF_close( - IN PNET_DEV dev); - -INT WdsVirtualIF_ioctl( - IN PNET_DEV net_dev, - IN OUT struct ifreq *rq, - IN INT cmd); - -/* - ========================================================================== - Description: - Check the WDS Entry is valid or not. - ========================================================================== - */ -static inline BOOLEAN ValidWdsEntry( - IN PRTMP_ADAPTER pAd, - IN UCHAR WdsIndex) -{ - BOOLEAN result; - PMAC_TABLE_ENTRY pMacEntry; - - do - { - if (WdsIndex >= MAX_WDS_ENTRY) - { - result = FALSE; - break; - } - - if (pAd->WdsTab.WdsEntry[WdsIndex].Valid != TRUE) - { - result = FALSE; - break; - } - - if ((pAd->WdsTab.WdsEntry[WdsIndex].MacTabMatchWCID==0) - || (pAd->WdsTab.WdsEntry[WdsIndex].MacTabMatchWCID >= MAX_LEN_OF_MAC_TABLE)) - { - result = FALSE; - break; - } - - pMacEntry = &pAd->MacTab.Content[pAd->WdsTab.WdsEntry[WdsIndex].MacTabMatchWCID]; - if (pMacEntry->ValidAsWDS != TRUE) - { - result = FALSE; - break; - } - - result = TRUE; - } while(FALSE); - - return result; -} -#endif // _AP_WDS_H_ // diff --git a/drivers/staging/rt3090/chips/rt3090.c b/drivers/staging/rt3090/chips/rt3090.c deleted file mode 100644 index 35c549dc4ce1..000000000000 --- a/drivers/staging/rt3090/chips/rt3090.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rt3090.c - - Abstract: - Specific funcitons and variables for RT3070 - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#ifdef RT3090 - -#include "../rt_config.h" - - -#ifndef RTMP_RF_RW_SUPPORT -#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" -#endif // RTMP_RF_RW_SUPPORT // - - -VOID NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd) -{ - INT i; - // Driver must read EEPROM to get RfIcType before initial RF registers - // Initialize RF register to default value - if (IS_RT3090(pAd)) - { - // Init RF calibration - // Driver should toggle RF R30 bit7 before init RF registers - UINT32 RfReg = 0, data; - - RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg); - RfReg |= 0x80; - RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); - RTMPusecDelay(1000); - RfReg &= 0x7F; - RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); - - // init R24, R31 - RT30xxWriteRFRegister(pAd, RF_R24, 0x0F); - RT30xxWriteRFRegister(pAd, RF_R31, 0x0F); - - // RT309x version E has fixed this issue - if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211)) - { - // patch tx EVM issue temporarily - RTMP_IO_READ32(pAd, LDO_CFG0, &data); - data = ((data & 0xE0FFFFFF) | 0x0D000000); - RTMP_IO_WRITE32(pAd, LDO_CFG0, data); - } - else - { - RTMP_IO_READ32(pAd, LDO_CFG0, &data); - data = ((data & 0xE0FFFFFF) | 0x01000000); - RTMP_IO_WRITE32(pAd, LDO_CFG0, data); - } - - // patch LNA_PE_G1 failed issue - RTMP_IO_READ32(pAd, GPIO_SWITCH, &data); - data &= ~(0x20); - RTMP_IO_WRITE32(pAd, GPIO_SWITCH, data); - - // Initialize RF register to default value - for (i = 0; i < NUM_RF_REG_PARMS; i++) - { - RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value); - } - - // Driver should set RF R6 bit6 on before calibration - RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RfReg); - RfReg |= 0x40; - RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg); - - //For RF filter Calibration - RTMPFilterCalibration(pAd); - - // Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration() - if ((pAd->MACVersion & 0xffff) < 0x0211) - RT30xxWriteRFRegister(pAd, RF_R27, 0x3); - - // set led open drain enable - RTMP_IO_READ32(pAd, OPT_14, &data); - data |= 0x01; - RTMP_IO_WRITE32(pAd, OPT_14, data); - - // set default antenna as main - if (pAd->RfIcType == RFIC_3020) - AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); - - // add by johnli, RF power sequence setup, load RF normal operation-mode setup - RT30xxLoadRFNormalModeSetup(pAd); - } - -} - -#endif // RT3090 // diff --git a/drivers/staging/rt3090/chips/rt30xx.c b/drivers/staging/rt3090/chips/rt30xx.c deleted file mode 100644 index 9c8ae009dff9..000000000000 --- a/drivers/staging/rt3090/chips/rt30xx.c +++ /dev/null @@ -1,525 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rt30xx.c - - Abstract: - Specific funcitons and variables for RT30xx. - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - - -#ifdef RT30xx - - -#ifndef RTMP_RF_RW_SUPPORT -#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" -#endif // RTMP_RF_RW_SUPPORT // - -#include "../rt_config.h" - - -// -// RF register initialization set -// -REG_PAIR RT30xx_RFRegTable[] = { - {RF_R04, 0x40}, - {RF_R05, 0x03}, - {RF_R06, 0x02}, - {RF_R07, 0x70}, - {RF_R09, 0x0F}, - {RF_R10, 0x41}, - {RF_R11, 0x21}, - {RF_R12, 0x7B}, - {RF_R14, 0x90}, - {RF_R15, 0x58}, - {RF_R16, 0xB3}, - {RF_R17, 0x92}, - {RF_R18, 0x2C}, - {RF_R19, 0x02}, - {RF_R20, 0xBA}, - {RF_R21, 0xDB}, - {RF_R24, 0x16}, - {RF_R25, 0x01}, - {RF_R29, 0x1F}, -}; - -UCHAR NUM_RF_REG_PARMS = (sizeof(RT30xx_RFRegTable) / sizeof(REG_PAIR)); - - - -// Antenna divesity use GPIO3 and EESK pin for control -// Antenna and EEPROM access are both using EESK pin, -// Therefor we should avoid accessing EESK at the same time -// Then restore antenna after EEPROM access -// The original name of this function is AsicSetRxAnt(), now change to -//VOID AsicSetRxAnt( -VOID RT30xxSetRxAnt( - IN PRTMP_ADAPTER pAd, - IN UCHAR Ant) -{ - UINT32 Value; - UINT32 x; - - if ((pAd->EepromAccess) || - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) || - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) || - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) || - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) - { - return; - } - - // the antenna selection is through firmware and MAC register(GPIO3) - if (Ant == 0) - { - // Main antenna -#ifdef RTMP_MAC_PCI - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - x |= (EESK); - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); -#else - AsicSendCommandToMcu(pAd, 0x73, 0xFF, 0x1, 0x0); -#endif // RTMP_MAC_PCI // - - RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value); - Value &= ~(0x0808); - RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to main antenna\n")); - } - else - { - // Aux antenna -#ifdef RTMP_MAC_PCI - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - x &= ~(EESK); - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); -#else - AsicSendCommandToMcu(pAd, 0x73, 0xFF, 0x0, 0x0); -#endif // RTMP_MAC_PCI // - RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value); - Value &= ~(0x0808); - Value |= 0x08; - RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to aux antenna\n")); - } -} - - -/* - ======================================================================== - - Routine Description: - For RF filter calibration purpose - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - IRQL = PASSIVE_LEVEL - - ======================================================================== -*/ -VOID RTMPFilterCalibration( - IN PRTMP_ADAPTER pAd) -{ - UCHAR R55x = 0, value, FilterTarget = 0x1E, BBPValue=0; - UINT loop = 0, count = 0, loopcnt = 0, ReTry = 0; - UCHAR RF_R24_Value = 0; - - // Give bbp filter initial value - pAd->Mlme.CaliBW20RfR24 = 0x1F; - pAd->Mlme.CaliBW40RfR24 = 0x2F; //Bit[5] must be 1 for BW 40 - - do - { - if (loop == 1) //BandWidth = 40 MHz - { - // Write 0x27 to RF_R24 to program filter - RF_R24_Value = 0x27; - RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - if (IS_RT3090(pAd) || IS_RT3572(pAd)|| IS_RT3390(pAd)) - FilterTarget = 0x15; - else - FilterTarget = 0x19; - - // when calibrate BW40, BBP mask must set to BW40. - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue&= (~0x18); - BBPValue|= (0x10); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - - // set to BW40 - RT30xxReadRFRegister(pAd, RF_R31, &value); - value |= 0x20; - RT30xxWriteRFRegister(pAd, RF_R31, value); - } - else //BandWidth = 20 MHz - { - // Write 0x07 to RF_R24 to program filter - RF_R24_Value = 0x07; - RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - if (IS_RT3090(pAd) || IS_RT3572(pAd)|| IS_RT3390(pAd)) - FilterTarget = 0x13; - else - FilterTarget = 0x16; - - // set to BW20 - RT30xxReadRFRegister(pAd, RF_R31, &value); - value &= (~0x20); - RT30xxWriteRFRegister(pAd, RF_R31, value); - } - - // Write 0x01 to RF_R22 to enable baseband loopback mode - RT30xxReadRFRegister(pAd, RF_R22, &value); - value |= 0x01; - RT30xxWriteRFRegister(pAd, RF_R22, value); - - // Write 0x00 to BBP_R24 to set power & frequency of passband test tone - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0); - - do - { - // Write 0x90 to BBP_R25 to transmit test tone - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90); - - RTMPusecDelay(1000); - // Read BBP_R55[6:0] for received power, set R55x = BBP_R55[6:0] - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value); - R55x = value & 0xFF; - - } while ((ReTry++ < 100) && (R55x == 0)); - - // Write 0x06 to BBP_R24 to set power & frequency of stopband test tone - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0x06); - - while(TRUE) - { - // Write 0x90 to BBP_R25 to transmit test tone - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90); - - //We need to wait for calibration - RTMPusecDelay(1000); - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value); - value &= 0xFF; - if ((R55x - value) < FilterTarget) - { - RF_R24_Value ++; - } - else if ((R55x - value) == FilterTarget) - { - RF_R24_Value ++; - count ++; - } - else - { - break; - } - - // prevent infinite loop cause driver hang. - if (loopcnt++ > 100) - { - DBGPRINT(RT_DEBUG_ERROR, ("RTMPFilterCalibration - can't find a valid value, loopcnt=%d stop calibrating", loopcnt)); - break; - } - - // Write RF_R24 to program filter - RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - } - - if (count > 0) - { - RF_R24_Value = RF_R24_Value - ((count) ? (1) : (0)); - } - - // Store for future usage - if (loopcnt < 100) - { - if (loop++ == 0) - { - //BandWidth = 20 MHz - pAd->Mlme.CaliBW20RfR24 = (UCHAR)RF_R24_Value; - } - else - { - //BandWidth = 40 MHz - pAd->Mlme.CaliBW40RfR24 = (UCHAR)RF_R24_Value; - break; - } - } - else - break; - - RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - - // reset count - count = 0; - } while(TRUE); - - // - // Set back to initial state - // - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0); - - RT30xxReadRFRegister(pAd, RF_R22, &value); - value &= ~(0x01); - RT30xxWriteRFRegister(pAd, RF_R22, value); - - // set BBP back to BW20 - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue&= (~0x18); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPFilterCalibration - CaliBW20RfR24=0x%x, CaliBW40RfR24=0x%x\n", pAd->Mlme.CaliBW20RfR24, pAd->Mlme.CaliBW40RfR24)); -} - - -// add by johnli, RF power sequence setup -/* - ========================================================================== - Description: - - Load RF normal operation-mode setup - - ========================================================================== - */ -VOID RT30xxLoadRFNormalModeSetup( - IN PRTMP_ADAPTER pAd) -{ - UCHAR RFValue; - - // RX0_PD & TX0_PD, RF R1 register Bit 2 & Bit 3 to 0 and RF_BLOCK_en,RX1_PD & TX1_PD, Bit0, Bit 4 & Bit5 to 1 - RT30xxReadRFRegister(pAd, RF_R01, &RFValue); - RFValue = (RFValue & (~0x0C)) | 0x31; - RT30xxWriteRFRegister(pAd, RF_R01, RFValue); - - // TX_LO2_en, RF R15 register Bit 3 to 0 - RT30xxReadRFRegister(pAd, RF_R15, &RFValue); - RFValue &= (~0x08); - RT30xxWriteRFRegister(pAd, RF_R15, RFValue); - - /* move to NICInitRT30xxRFRegisters - // TX_LO1_en, RF R17 register Bit 3 to 0 - RT30xxReadRFRegister(pAd, RF_R17, &RFValue); - RFValue &= (~0x08); - // to fix rx long range issue - if (((pAd->MACVersion & 0xffff) >= 0x0211) && (pAd->NicConfig2.field.ExternalLNAForG == 0)) - { - RFValue |= 0x20; - } - // set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h - if (pAd->TxMixerGain24G >= 2) - { - RFValue &= (~0x7); // clean bit [2:0] - RFValue |= pAd->TxMixerGain24G; - } - RT30xxWriteRFRegister(pAd, RF_R17, RFValue); - */ - - // RX_LO1_en, RF R20 register Bit 3 to 0 - RT30xxReadRFRegister(pAd, RF_R20, &RFValue); - RFValue &= (~0x08); - RT30xxWriteRFRegister(pAd, RF_R20, RFValue); - - // RX_LO2_en, RF R21 register Bit 3 to 0 - RT30xxReadRFRegister(pAd, RF_R21, &RFValue); - RFValue &= (~0x08); - RT30xxWriteRFRegister(pAd, RF_R21, RFValue); - - /* add by johnli, reset RF_R27 when interface down & up to fix throughput problem*/ - // LDORF_VC, RF R27 register Bit 2 to 0 - RT30xxReadRFRegister(pAd, RF_R27, &RFValue); - // TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F). - // Raising RF voltage is no longer needed for RT3070(F) - if (IS_RT3090(pAd)) // RT309x and RT3071/72 - { - if ((pAd->MACVersion & 0xffff) < 0x0211) - RFValue = (RFValue & (~0x77)) | 0x3; - else - RFValue = (RFValue & (~0x77)); - RT30xxWriteRFRegister(pAd, RF_R27, RFValue); - } - /* end johnli */ -} - -/* - ========================================================================== - Description: - - Load RF sleep-mode setup - - ========================================================================== - */ -VOID RT30xxLoadRFSleepModeSetup( - IN PRTMP_ADAPTER pAd) -{ - UCHAR RFValue; - UINT32 MACValue; - - - { - // RF_BLOCK_en. RF R1 register Bit 0 to 0 - RT30xxReadRFRegister(pAd, RF_R01, &RFValue); - RFValue &= (~0x01); - RT30xxWriteRFRegister(pAd, RF_R01, RFValue); - - // VCO_IC, RF R7 register Bit 4 & Bit 5 to 0 - RT30xxReadRFRegister(pAd, RF_R07, &RFValue); - RFValue &= (~0x30); - RT30xxWriteRFRegister(pAd, RF_R07, RFValue); - - // Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 0 - RT30xxReadRFRegister(pAd, RF_R09, &RFValue); - RFValue &= (~0x0E); - RT30xxWriteRFRegister(pAd, RF_R09, RFValue); - - // RX_CTB_en, RF R21 register Bit 7 to 0 - RT30xxReadRFRegister(pAd, RF_R21, &RFValue); - RFValue &= (~0x80); - RT30xxWriteRFRegister(pAd, RF_R21, RFValue); - } - - if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72 - IS_RT3572(pAd) || - (IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) - { - { - RT30xxReadRFRegister(pAd, RF_R27, &RFValue); - RFValue |= 0x77; - RT30xxWriteRFRegister(pAd, RF_R27, RFValue); - } - - RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue); - MACValue |= 0x1D000000; - RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue); - } -} - -/* - ========================================================================== - Description: - - Reverse RF sleep-mode setup - - ========================================================================== - */ -VOID RT30xxReverseRFSleepModeSetup( - IN PRTMP_ADAPTER pAd) -{ - UCHAR RFValue; - UINT32 MACValue; - - { - // RF_BLOCK_en, RF R1 register Bit 0 to 1 - RT30xxReadRFRegister(pAd, RF_R01, &RFValue); - RFValue |= 0x01; - RT30xxWriteRFRegister(pAd, RF_R01, RFValue); - - // VCO_IC, RF R7 register Bit 4 & Bit 5 to 1 - RT30xxReadRFRegister(pAd, RF_R07, &RFValue); - RFValue |= 0x30; - RT30xxWriteRFRegister(pAd, RF_R07, RFValue); - - // Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 1 - RT30xxReadRFRegister(pAd, RF_R09, &RFValue); - RFValue |= 0x0E; - RT30xxWriteRFRegister(pAd, RF_R09, RFValue); - - // RX_CTB_en, RF R21 register Bit 7 to 1 - RT30xxReadRFRegister(pAd, RF_R21, &RFValue); - RFValue |= 0x80; - RT30xxWriteRFRegister(pAd, RF_R21, RFValue); - } - - if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72 - IS_RT3572(pAd) || - IS_RT3390(pAd) || - (IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) - { - { - RT30xxReadRFRegister(pAd, RF_R27, &RFValue); - if ((pAd->MACVersion & 0xffff) < 0x0211) - RFValue = (RFValue & (~0x77)) | 0x3; - else - RFValue = (RFValue & (~0x77)); - RT30xxWriteRFRegister(pAd, RF_R27, RFValue); - } - - // RT3071 version E has fixed this issue - if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211)) - { - // patch tx EVM issue temporarily - RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue); - MACValue = ((MACValue & 0xE0FFFFFF) | 0x0D000000); - RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue); - } - else - { - RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue); - MACValue = ((MACValue & 0xE0FFFFFF) | 0x01000000); - RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue); - } - } - - if(IS_RT3572(pAd)) - RT30xxWriteRFRegister(pAd, RF_R08, 0x80); -} -// end johnli - -VOID RT30xxHaltAction( - IN PRTMP_ADAPTER pAd) -{ - UINT32 TxPinCfg = 0x00050F0F; - - // - // Turn off LNA_PE or TRSW_POL - // - if (IS_RT3070(pAd) || IS_RT3071(pAd) || IS_RT3572(pAd)) - { - if ((IS_RT3071(pAd) || IS_RT3572(pAd)) -#ifdef RTMP_EFUSE_SUPPORT - && (pAd->bUseEfuse) -#endif // RTMP_EFUSE_SUPPORT // - ) - { - TxPinCfg &= 0xFFFBF0F0; // bit18 off - } - else - { - TxPinCfg &= 0xFFFFF0F0; - } - - RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg); - } -} - -#endif // RT30xx // diff --git a/drivers/staging/rt3090/chips/rt3370.c b/drivers/staging/rt3090/chips/rt3370.c deleted file mode 100644 index 38ecb0623424..000000000000 --- a/drivers/staging/rt3090/chips/rt3370.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rt3370.c - - Abstract: - Specific funcitons and variables for RT30xx. - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#ifdef RT3370 - -#include "../rt_config.h" - - -#ifndef RTMP_RF_RW_SUPPORT -#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" -#endif // RTMP_RF_RW_SUPPORT // - - -VOID NICInitRT3370RFRegisters(IN PRTMP_ADAPTER pAd) -{ - INT i; - // Driver must read EEPROM to get RfIcType before initial RF registers - // Initialize RF register to default value - if (IS_RT3090(pAd)||IS_RT3390(pAd)||IS_RT3572(pAd)) - { - // Init RF calibration - // Driver should toggle RF R30 bit7 before init RF registers - UINT32 RfReg = 0, data; - - RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg); - RfReg |= 0x80; - RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); - RTMPusecDelay(1000); - RfReg &= 0x7F; - RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); - - // init R24, R31 - RT30xxWriteRFRegister(pAd, RF_R24, 0x0F); - RT30xxWriteRFRegister(pAd, RF_R31, 0x0F); - - if (IS_RT3390(pAd)) - { - // patch LNA_PE_G1 failed issue - RTMP_IO_READ32(pAd, GPIO_SWITCH, &data); - data &= ~(0x20); - RTMP_IO_WRITE32(pAd, GPIO_SWITCH, data); - - // RF registers initialization - for (i = 0; i < NUM_RF_REG_PARMS_OVER_RT3390; i++) - { - RT30xxWriteRFRegister(pAd, RFRegTableOverRT3390[i].Register, RFRegTableOverRT3390[i].Value); - } - } - - // patch LNA_PE_G1 failed issue - RTMP_IO_READ32(pAd, GPIO_SWITCH, &data); - data &= ~(0x20); - RTMP_IO_WRITE32(pAd, GPIO_SWITCH, data); - - // Initialize RF register to default value - for (i = 0; i < NUM_RF_REG_PARMS_OVER_RT3390; i++) - { - RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value); - } - - // Driver should set RF R6 bit6 on before calibration - RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RfReg); - RfReg |= 0x40; - RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg); - - //For RF filter Calibration - RTMPFilterCalibration(pAd); - - // Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration() - if ((pAd->MACVersion & 0xffff) < 0x0211) - RT30xxWriteRFRegister(pAd, RF_R27, 0x3); - - // set led open drain enable - RTMP_IO_READ32(pAd, OPT_14, &data); - data |= 0x01; - RTMP_IO_WRITE32(pAd, OPT_14, data); - - // set default antenna as main - if (pAd->RfIcType == RFIC_3020) - AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); - - // add by johnli, RF power sequence setup, load RF normal operation-mode setup - RT30xxLoadRFNormalModeSetup(pAd); - } - -} -#endif // RT3070 // diff --git a/drivers/staging/rt3090/chips/rt3390.c b/drivers/staging/rt3090/chips/rt3390.c deleted file mode 100644 index afed9e705e8d..000000000000 --- a/drivers/staging/rt3090/chips/rt3390.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rt3390.c - - Abstract: - Specific funcitons and variables for RT30xx. - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#ifdef RT3390 - -#include "../rt_config.h" - - -#ifndef RTMP_RF_RW_SUPPORT -#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" -#endif // RTMP_RF_RW_SUPPORT // - - -VOID NICInitRT3390RFRegisters(IN PRTMP_ADAPTER pAd) -{ - INT i; - // Driver must read EEPROM to get RfIcType before initial RF registers - // Initialize RF register to default value - if (IS_RT3090(pAd)||IS_RT3390(pAd)||IS_RT3572(pAd)) - { - // Init RF calibration - // Driver should toggle RF R30 bit7 before init RF registers - UINT32 RfReg = 0, data; - - RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg); - RfReg |= 0x80; - RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); - RTMPusecDelay(1000); - RfReg &= 0x7F; - RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); - - // init R24, R31 - RT30xxWriteRFRegister(pAd, RF_R24, 0x0F); - RT30xxWriteRFRegister(pAd, RF_R31, 0x0F); - - if (IS_RT3390(pAd)) - { - // patch LNA_PE_G1 failed issue - RTMP_IO_READ32(pAd, GPIO_SWITCH, &data); - data &= ~(0x20); - RTMP_IO_WRITE32(pAd, GPIO_SWITCH, data); - - // RF registers initialization - for (i = 0; i < NUM_RF_REG_PARMS_OVER_RT3390; i++) - { - RT30xxWriteRFRegister(pAd, RFRegTableOverRT3390[i].Register, RFRegTableOverRT3390[i].Value); - } - } - - // patch LNA_PE_G1 failed issue - RTMP_IO_READ32(pAd, GPIO_SWITCH, &data); - data &= ~(0x20); - RTMP_IO_WRITE32(pAd, GPIO_SWITCH, data); - - // Initialize RF register to default value - for (i = 0; i < NUM_RF_REG_PARMS_OVER_RT3390; i++) - { - RT30xxWriteRFRegister(pAd, RFRegTableOverRT3390[i].Register, RFRegTableOverRT3390[i].Value); - } - - // Driver should set RF R6 bit6 on before calibration - RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RfReg); - RfReg |= 0x40; - RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg); - - //For RF filter Calibration - RTMPFilterCalibration(pAd); - - // Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration() - if ((pAd->MACVersion & 0xffff) < 0x0211) - RT30xxWriteRFRegister(pAd, RF_R27, 0x3); - - // set led open drain enable - RTMP_IO_READ32(pAd, OPT_14, &data); - data |= 0x01; - RTMP_IO_WRITE32(pAd, OPT_14, data); - - // set default antenna as main - if (pAd->RfIcType == RFIC_3020) - AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); - - // add by johnli, RF power sequence setup, load RF normal operation-mode setup - RT33xxLoadRFNormalModeSetup(pAd); - } - -} - -#endif // RT3390 // diff --git a/drivers/staging/rt3090/chips/rt33xx.c b/drivers/staging/rt3090/chips/rt33xx.c deleted file mode 100644 index 56f376c88bda..000000000000 --- a/drivers/staging/rt3090/chips/rt33xx.c +++ /dev/null @@ -1,536 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rt33xx.c - - Abstract: - Specific funcitons and variables for RT30xx. - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - - -#ifdef RT33xx - - -#ifndef RTMP_RF_RW_SUPPORT -#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" -#endif // RTMP_RF_RW_SUPPORT // - -#include "../rt_config.h" - - -// -// RF register initialization set -// -REG_PAIR RFRegTableOverRT3390[] = { - {RF_R00, 0xA0}, - {RF_R01, 0xE1}, - {RF_R02, 0xF1}, - {RF_R03, 0x62}, - {RF_R04, 0x40}, - {RF_R05, 0x8B}, - {RF_R06, 0x42}, - {RF_R07, 0x34}, - {RF_R08, 0x00}, // Read only - {RF_R09, 0xC0}, - - {RF_R10, 0x61}, - {RF_R11, 0x21}, - {RF_R12, 0x3B}, - {RF_R13, 0xE0}, - {RF_R14, 0x90}, - {RF_R15, 0x53}, - {RF_R16, 0x0E}, - {RF_R17, 0x94}, - {RF_R18, 0x5C}, - {RF_R19, 0x4A}, - - {RF_R20, 0xB2}, - {RF_R21, 0xF6}, - {RF_R22, 0x00}, - {RF_R23, 0x14}, - {RF_R24, 0x08}, - {RF_R25, 0x3D}, - {RF_R26, 0x85}, - {RF_R27, 0x00}, - {RF_R28, 0x41}, - {RF_R29, 0x8F}, - {RF_R30, 0x20}, - {RF_R31, 0x0F}, -}; - -UCHAR NUM_RF_REG_PARMS_OVER_RT3390=(sizeof(RFRegTableOverRT3390) / sizeof(REG_PAIR)); - - - -// Antenna divesity use GPIO3 and EESK pin for control -// Antenna and EEPROM access are both using EESK pin, -// Therefor we should avoid accessing EESK at the same time -// Then restore antenna after EEPROM access -// The original name of this function is AsicSetRxAnt(), now change to -//VOID AsicSetRxAnt( - -VOID RT33xxSetRxAnt( - IN PRTMP_ADAPTER pAd, - IN UCHAR Ant) -{ - UINT32 Value; - UINT32 x; - - if ((pAd->EepromAccess) || - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) || - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) || - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) || - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) - { - return; - } - - // the antenna selection is through firmware and MAC register(GPIO3) - if (Ant == 0) - { - // Main antenna - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - x |= (EESK); - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - - RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value); - Value &= ~(0x0808); - RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to main antenna\n")); - } - else - { - // Aux antenna - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - x &= ~(EESK); - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - - RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value); - Value &= ~(0x0808); - Value |= 0x08; - RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to aux antenna\n")); - } -} - - -/* - ======================================================================== - - Routine Description: - For RF filter calibration purpose - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - IRQL = PASSIVE_LEVEL - - ======================================================================== -*/ -VOID RTMPFilterCalibration( - IN PRTMP_ADAPTER pAd) -{ - UCHAR R55x = 0, value, FilterTarget = 0x1E, BBPValue=0; - UINT loop = 0, count = 0, loopcnt = 0, ReTry = 0; - UCHAR RF_R24_Value = 0; - - // Give bbp filter initial value - pAd->Mlme.CaliBW20RfR24 = 0x1F; - pAd->Mlme.CaliBW40RfR24 = 0x2F; //Bit[5] must be 1 for BW 40 - - do - { - if (loop == 1) //BandWidth = 40 MHz - { - // Write 0x27 to RF_R24 to program filter - RF_R24_Value = 0x27; - RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - if (IS_RT3090(pAd) || IS_RT3572(pAd)|| IS_RT3390(pAd)) - FilterTarget = 0x15; - else - FilterTarget = 0x19; - - // when calibrate BW40, BBP mask must set to BW40. - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue&= (~0x18); - BBPValue|= (0x10); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - - // set to BW40 - RT30xxReadRFRegister(pAd, RF_R31, &value); - value |= 0x20; - RT30xxWriteRFRegister(pAd, RF_R31, value); - } - else //BandWidth = 20 MHz - { - // Write 0x07 to RF_R24 to program filter - RF_R24_Value = 0x07; - RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - if (IS_RT3090(pAd) || IS_RT3572(pAd)|| IS_RT3390(pAd)) - FilterTarget = 0x13; - else - FilterTarget = 0x16; - - // set to BW20 - RT30xxReadRFRegister(pAd, RF_R31, &value); - value &= (~0x20); - RT30xxWriteRFRegister(pAd, RF_R31, value); - } - - // Write 0x01 to RF_R22 to enable baseband loopback mode - RT30xxReadRFRegister(pAd, RF_R22, &value); - value |= 0x01; - RT30xxWriteRFRegister(pAd, RF_R22, value); - - // Write 0x00 to BBP_R24 to set power & frequency of passband test tone - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0); - - do - { - // Write 0x90 to BBP_R25 to transmit test tone - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90); - - RTMPusecDelay(1000); - // Read BBP_R55[6:0] for received power, set R55x = BBP_R55[6:0] - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value); - R55x = value & 0xFF; - - } while ((ReTry++ < 100) && (R55x == 0)); - - // Write 0x06 to BBP_R24 to set power & frequency of stopband test tone - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0x06); - - while(TRUE) - { - // Write 0x90 to BBP_R25 to transmit test tone - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90); - - //We need to wait for calibration - RTMPusecDelay(1000); - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value); - value &= 0xFF; - if ((R55x - value) < FilterTarget) - { - RF_R24_Value ++; - } - else if ((R55x - value) == FilterTarget) - { - RF_R24_Value ++; - count ++; - } - else - { - break; - } - - // prevent infinite loop cause driver hang. - if (loopcnt++ > 100) - { - DBGPRINT(RT_DEBUG_ERROR, ("RTMPFilterCalibration - can't find a valid value, loopcnt=%d stop calibrating", loopcnt)); - break; - } - - // Write RF_R24 to program filter - RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - } - - if (count > 0) - { - RF_R24_Value = RF_R24_Value - ((count) ? (1) : (0)); - } - - // Store for future usage - if (loopcnt < 100) - { - if (loop++ == 0) - { - //BandWidth = 20 MHz - pAd->Mlme.CaliBW20RfR24 = (UCHAR)RF_R24_Value; - } - else - { - //BandWidth = 40 MHz - pAd->Mlme.CaliBW40RfR24 = (UCHAR)RF_R24_Value; - break; - } - } - else - break; - - RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - - // reset count - count = 0; - } while(TRUE); - - // - // Set back to initial state - // - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0); - - RT30xxReadRFRegister(pAd, RF_R22, &value); - value &= ~(0x01); - RT30xxWriteRFRegister(pAd, RF_R22, value); - - // set BBP back to BW20 - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue&= (~0x18); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPFilterCalibration - CaliBW20RfR24=0x%x, CaliBW40RfR24=0x%x\n", pAd->Mlme.CaliBW20RfR24, pAd->Mlme.CaliBW40RfR24)); -} - - -// add by johnli, RF power sequence setup -/* - ========================================================================== - Description: - - Load RF normal operation-mode setup - - ========================================================================== - */ -VOID RT33xxLoadRFNormalModeSetup( - IN PRTMP_ADAPTER pAd) -{ - UCHAR RFValue; - - // RX0_PD & TX0_PD, RF R1 register Bit 2 & Bit 3 to 0 and RF_BLOCK_en,RX1_PD & TX1_PD, Bit0, Bit 4 & Bit5 to 1 - RT30xxReadRFRegister(pAd, RF_R01, &RFValue); - RFValue = (RFValue & (~0x0C)) | 0x31; - RT30xxWriteRFRegister(pAd, RF_R01, RFValue); - - // TX_LO2_en, RF R15 register Bit 3 to 0 - RT30xxReadRFRegister(pAd, RF_R15, &RFValue); - RFValue &= (~0x08); - RT30xxWriteRFRegister(pAd, RF_R15, RFValue); - - /* move to NICInitRT30xxRFRegisters - // TX_LO1_en, RF R17 register Bit 3 to 0 - RT30xxReadRFRegister(pAd, RF_R17, &RFValue); - RFValue &= (~0x08); - // to fix rx long range issue - if (((pAd->MACVersion & 0xffff) >= 0x0211) && (pAd->NicConfig2.field.ExternalLNAForG == 0)) - { - RFValue |= 0x20; - } - // set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h - if (pAd->TxMixerGain24G >= 2) - { - RFValue &= (~0x7); // clean bit [2:0] - RFValue |= pAd->TxMixerGain24G; - } - RT30xxWriteRFRegister(pAd, RF_R17, RFValue); - */ - - // RX_LO1_en, RF R20 register Bit 3 to 0 - RT30xxReadRFRegister(pAd, RF_R20, &RFValue); - RFValue &= (~0x08); - RT30xxWriteRFRegister(pAd, RF_R20, RFValue); - - // RX_LO2_en, RF R21 register Bit 3 to 0 - RT30xxReadRFRegister(pAd, RF_R21, &RFValue); - RFValue &= (~0x08); - RT30xxWriteRFRegister(pAd, RF_R21, RFValue); - - /* add by johnli, reset RF_R27 when interface down & up to fix throughput problem*/ - // LDORF_VC, RF R27 register Bit 2 to 0 - RT30xxReadRFRegister(pAd, RF_R27, &RFValue); - // TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F). - // Raising RF voltage is no longer needed for RT3070(F) - if (IS_RT3090(pAd)) // RT309x and RT3071/72 - { - if ((pAd->MACVersion & 0xffff) < 0x0211) - RFValue = (RFValue & (~0x77)) | 0x3; - else - RFValue = (RFValue & (~0x77)); - RT30xxWriteRFRegister(pAd, RF_R27, RFValue); - } - /* end johnli */ -} - -/* - ========================================================================== - Description: - - Load RF sleep-mode setup - - ========================================================================== - */ -VOID RT33xxLoadRFSleepModeSetup( - IN PRTMP_ADAPTER pAd) -{ - UCHAR RFValue; - UINT32 MACValue; - - - { - // RF_BLOCK_en. RF R1 register Bit 0 to 0 - RT30xxReadRFRegister(pAd, RF_R01, &RFValue); - RFValue &= (~0x01); - RT30xxWriteRFRegister(pAd, RF_R01, RFValue); - - // VCO_IC, RF R7 register Bit 4 & Bit 5 to 0 - RT30xxReadRFRegister(pAd, RF_R07, &RFValue); - RFValue &= (~0x30); - RT30xxWriteRFRegister(pAd, RF_R07, RFValue); - - // Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 0 - RT30xxReadRFRegister(pAd, RF_R09, &RFValue); - RFValue &= (~0x0E); - RT30xxWriteRFRegister(pAd, RF_R09, RFValue); - - // RX_CTB_en, RF R21 register Bit 7 to 0 - RT30xxReadRFRegister(pAd, RF_R21, &RFValue); - RFValue &= (~0x80); - RT30xxWriteRFRegister(pAd, RF_R21, RFValue); - } - - if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72 - IS_RT3572(pAd) || - IS_RT3390(pAd) || - (IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) - { - { - RT30xxReadRFRegister(pAd, RF_R27, &RFValue); - RFValue |= 0x77; - RT30xxWriteRFRegister(pAd, RF_R27, RFValue); - } - - RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue); - MACValue |= 0x1D000000; - RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue); - } -} - -/* - ========================================================================== - Description: - - Reverse RF sleep-mode setup - - ========================================================================== - */ -VOID RT33xxReverseRFSleepModeSetup( - IN PRTMP_ADAPTER pAd) -{ - UCHAR RFValue; - UINT32 MACValue; - - { - // RF_BLOCK_en, RF R1 register Bit 0 to 1 - RT30xxReadRFRegister(pAd, RF_R01, &RFValue); - RFValue |= 0x01; - RT30xxWriteRFRegister(pAd, RF_R01, RFValue); - - // VCO_IC, RF R7 register Bit 4 & Bit 5 to 1 - RT30xxReadRFRegister(pAd, RF_R07, &RFValue); - RFValue |= 0x30; - RT30xxWriteRFRegister(pAd, RF_R07, RFValue); - - // Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 1 - RT30xxReadRFRegister(pAd, RF_R09, &RFValue); - RFValue |= 0x0E; - RT30xxWriteRFRegister(pAd, RF_R09, RFValue); - - // RX_CTB_en, RF R21 register Bit 7 to 1 - RT30xxReadRFRegister(pAd, RF_R21, &RFValue); - RFValue |= 0x80; - RT30xxWriteRFRegister(pAd, RF_R21, RFValue); - } - - if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72 - IS_RT3572(pAd) || - IS_RT3390(pAd) || - (IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) - { - { - RT30xxReadRFRegister(pAd, RF_R27, &RFValue); - if ((pAd->MACVersion & 0xffff) < 0x0211) - RFValue = (RFValue & (~0x77)) | 0x3; - else - RFValue = (RFValue & (~0x77)); - RT30xxWriteRFRegister(pAd, RF_R27, RFValue); - } - - // RT3071 version E has fixed this issue - if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211)) - { - // patch tx EVM issue temporarily - RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue); - MACValue = ((MACValue & 0xE0FFFFFF) | 0x0D000000); - RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue); - } - else - { - RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue); - MACValue = ((MACValue & 0xE0FFFFFF) | 0x01000000); - RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue); - } - } - - if(IS_RT3572(pAd)) - RT30xxWriteRFRegister(pAd, RF_R08, 0x80); -} -// end johnli - -VOID RT33xxHaltAction( - IN PRTMP_ADAPTER pAd) -{ - UINT32 TxPinCfg = 0x00050F0F; - - // - // Turn off LNA_PE or TRSW_POL - // - if (IS_RT3070(pAd) || IS_RT3071(pAd) || IS_RT3390(pAd)||IS_RT3572(pAd)) - { - //KH? Both support 3390 usb and PCI - if ((IS_RT3071(pAd) || IS_RT3572(pAd)||IS_RT3390(pAd)) -#ifdef RTMP_EFUSE_SUPPORT - && (pAd->bUseEfuse) -#endif // RTMP_EFUSE_SUPPORT // - ) - { - TxPinCfg &= 0xFFFBF0F0; // bit18 off - } - else - { - TxPinCfg &= 0xFFFFF0F0; - } - - RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg); - } -} - -#endif // RT30xx // diff --git a/drivers/staging/rt3090/chlist.h b/drivers/staging/rt3090/chlist.h deleted file mode 100644 index d03cb4754394..000000000000 --- a/drivers/staging/rt3090/chlist.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - chlist.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Fonchi Wu 2007-12-19 created -*/ - -#ifndef __CHLIST_H__ -#define __CHLIST_H__ - -#include "rtmp_type.h" -#include "rtmp_def.h" - - -#define ODOR 0 -#define IDOR 1 -#define BOTH 2 - -#define BAND_5G 0 -#define BAND_24G 1 -#define BAND_BOTH 2 - -typedef struct _CH_DESP { - UCHAR FirstChannel; - UCHAR NumOfCh; - CHAR MaxTxPwr; // dBm - UCHAR Geography; // 0:out door, 1:in door, 2:both - BOOLEAN DfsReq; // Dfs require, 0: No, 1: yes. -} CH_DESP, *PCH_DESP; - -typedef struct _CH_REGION { - UCHAR CountReg[3]; - UCHAR DfsType; // 0: CE, 1: FCC, 2: JAP, 3:JAP_W53, JAP_W56 - CH_DESP ChDesp[10]; -} CH_REGION, *PCH_REGION; - -extern CH_REGION ChRegion[]; - -typedef struct _CH_FREQ_MAP_{ - UINT16 channel; - UINT16 freqKHz; -}CH_FREQ_MAP; - -extern CH_FREQ_MAP CH_HZ_ID_MAP[]; -extern int CH_HZ_ID_MAP_NUM; - - -#define MAP_CHANNEL_ID_TO_KHZ(_ch, _khz) \ - do{ \ - int _chIdx; \ - for (_chIdx = 0; _chIdx < CH_HZ_ID_MAP_NUM; _chIdx++)\ - { \ - if ((_ch) == CH_HZ_ID_MAP[_chIdx].channel) \ - { \ - (_khz) = CH_HZ_ID_MAP[_chIdx].freqKHz * 1000; \ - break; \ - } \ - } \ - if (_chIdx == CH_HZ_ID_MAP_NUM) \ - (_khz) = 2412000; \ - }while(0) - -#define MAP_KHZ_TO_CHANNEL_ID(_khz, _ch) \ - do{ \ - int _chIdx; \ - for (_chIdx = 0; _chIdx < CH_HZ_ID_MAP_NUM; _chIdx++)\ - { \ - if ((_khz) == CH_HZ_ID_MAP[_chIdx].freqKHz) \ - { \ - (_ch) = CH_HZ_ID_MAP[_chIdx].channel; \ - break; \ - } \ - } \ - if (_chIdx == CH_HZ_ID_MAP_NUM) \ - (_ch) = 1; \ - }while(0) - - -VOID BuildChannelListEx( - IN PRTMP_ADAPTER pAd); - -VOID BuildBeaconChList( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf, - OUT PULONG pBufLen); - -#ifdef DOT11_N_SUPPORT -VOID N_ChannelCheck( - IN PRTMP_ADAPTER pAd); - -VOID N_SetCenCh( - IN PRTMP_ADAPTER pAd); -#endif // DOT11_N_SUPPORT // - -UINT8 GetCuntryMaxTxPwr( - IN PRTMP_ADAPTER pAd, - IN UINT8 channel); - -#endif // __CHLIST_H__ diff --git a/drivers/staging/rt3090/common/action.c b/drivers/staging/rt3090/common/action.c deleted file mode 100644 index 8e3b0a0c2d64..000000000000 --- a/drivers/staging/rt3090/common/action.c +++ /dev/null @@ -1,1057 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - action.c - - Abstract: - Handle association related requests either from WSTA or from local MLME - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Jan Lee 2006 created for rt2860 - */ - -#include "../rt_config.h" -#include "../action.h" - - -static VOID ReservedAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - - -/* - ========================================================================== - Description: - association state machine init, including state transition and timer init - Parameters: - S - pointer to the association state machine - Note: - The state machine looks like the following - - ASSOC_IDLE - MT2_MLME_DISASSOC_REQ mlme_disassoc_req_action - MT2_PEER_DISASSOC_REQ peer_disassoc_action - MT2_PEER_ASSOC_REQ drop - MT2_PEER_REASSOC_REQ drop - MT2_CLS3ERR cls3err_action - ========================================================================== - */ -VOID ActionStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - OUT STATE_MACHINE_FUNC Trans[]) -{ - StateMachineInit(S, (STATE_MACHINE_FUNC *)Trans, MAX_ACT_STATE, MAX_ACT_MSG, (STATE_MACHINE_FUNC)Drop, ACT_IDLE, ACT_MACHINE_BASE); - - StateMachineSetAction(S, ACT_IDLE, MT2_PEER_SPECTRUM_CATE, (STATE_MACHINE_FUNC)PeerSpectrumAction); - StateMachineSetAction(S, ACT_IDLE, MT2_PEER_QOS_CATE, (STATE_MACHINE_FUNC)PeerQOSAction); - - StateMachineSetAction(S, ACT_IDLE, MT2_PEER_DLS_CATE, (STATE_MACHINE_FUNC)ReservedAction); -#ifdef QOS_DLS_SUPPORT - StateMachineSetAction(S, ACT_IDLE, MT2_PEER_DLS_CATE, (STATE_MACHINE_FUNC)PeerDLSAction); -#endif // QOS_DLS_SUPPORT // - -#ifdef DOT11_N_SUPPORT - StateMachineSetAction(S, ACT_IDLE, MT2_PEER_BA_CATE, (STATE_MACHINE_FUNC)PeerBAAction); - StateMachineSetAction(S, ACT_IDLE, MT2_PEER_HT_CATE, (STATE_MACHINE_FUNC)PeerHTAction); - StateMachineSetAction(S, ACT_IDLE, MT2_MLME_ADD_BA_CATE, (STATE_MACHINE_FUNC)MlmeADDBAAction); - StateMachineSetAction(S, ACT_IDLE, MT2_MLME_ORI_DELBA_CATE, (STATE_MACHINE_FUNC)MlmeDELBAAction); - StateMachineSetAction(S, ACT_IDLE, MT2_MLME_REC_DELBA_CATE, (STATE_MACHINE_FUNC)MlmeDELBAAction); -#endif // DOT11_N_SUPPORT // - - StateMachineSetAction(S, ACT_IDLE, MT2_PEER_PUBLIC_CATE, (STATE_MACHINE_FUNC)PeerPublicAction); - StateMachineSetAction(S, ACT_IDLE, MT2_PEER_RM_CATE, (STATE_MACHINE_FUNC)PeerRMAction); - - StateMachineSetAction(S, ACT_IDLE, MT2_MLME_QOS_CATE, (STATE_MACHINE_FUNC)MlmeQOSAction); - StateMachineSetAction(S, ACT_IDLE, MT2_MLME_DLS_CATE, (STATE_MACHINE_FUNC)MlmeDLSAction); - StateMachineSetAction(S, ACT_IDLE, MT2_ACT_INVALID, (STATE_MACHINE_FUNC)MlmeInvalidAction); - - -} - -#ifdef DOT11_N_SUPPORT -VOID MlmeADDBAAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) - -{ - MLME_ADDBA_REQ_STRUCT *pInfo; - UCHAR Addr[6]; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG Idx; - FRAME_ADDBA_REQ Frame; - ULONG FrameLen; - BA_ORI_ENTRY *pBAEntry = NULL; - - pInfo = (MLME_ADDBA_REQ_STRUCT *)Elem->Msg; - NdisZeroMemory(&Frame, sizeof(FRAME_ADDBA_REQ)); - - if(MlmeAddBAReqSanity(pAd, Elem->Msg, Elem->MsgLen, Addr)) - { - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE,("BA - MlmeADDBAAction() allocate memory failed \n")); - return; - } - // 1. find entry - Idx = pAd->MacTab.Content[pInfo->Wcid].BAOriWcidArray[pInfo->TID]; - if (Idx == 0) - { - MlmeFreeMemory(pAd, pOutBuffer); - DBGPRINT(RT_DEBUG_ERROR,("BA - MlmeADDBAAction() can't find BAOriEntry \n")); - return; - } - else - { - pBAEntry =&pAd->BATable.BAOriEntry[Idx]; - } - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (ADHOC_ON(pAd)) - ActHeaderInit(pAd, &Frame.Hdr, pInfo->pAddr, pAd->CurrentAddress, pAd->CommonCfg.Bssid); - else -#ifdef QOS_DLS_SUPPORT - if (pAd->MacTab.Content[pInfo->Wcid].ValidAsDls) - ActHeaderInit(pAd, &Frame.Hdr, pInfo->pAddr, pAd->CurrentAddress, pAd->CommonCfg.Bssid); - else -#endif // QOS_DLS_SUPPORT // - ActHeaderInit(pAd, &Frame.Hdr, pAd->CommonCfg.Bssid, pAd->CurrentAddress, pInfo->pAddr); - - } -#endif // CONFIG_STA_SUPPORT // - - Frame.Category = CATEGORY_BA; - Frame.Action = ADDBA_REQ; - Frame.BaParm.AMSDUSupported = 0; - Frame.BaParm.BAPolicy = IMMED_BA; - Frame.BaParm.TID = pInfo->TID; - Frame.BaParm.BufSize = pInfo->BaBufSize; - Frame.Token = pInfo->Token; - Frame.TimeOutValue = pInfo->TimeOutValue; - Frame.BaStartSeq.field.FragNum = 0; - Frame.BaStartSeq.field.StartSeq = pAd->MacTab.Content[pInfo->Wcid].TxSeq[pInfo->TID]; - - *(USHORT *)(&Frame.BaParm) = cpu2le16(*(USHORT *)(&Frame.BaParm)); - Frame.TimeOutValue = cpu2le16(Frame.TimeOutValue); - Frame.BaStartSeq.word = cpu2le16(Frame.BaStartSeq.word); - - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_ADDBA_REQ), &Frame, - END_OF_ARGS); - - MiniportMMRequest(pAd, (MGMT_USE_QUEUE_FLAG | MapUserPriorityToAccessCategory[pInfo->TID]), pOutBuffer, FrameLen); - - MlmeFreeMemory(pAd, pOutBuffer); - - DBGPRINT(RT_DEBUG_TRACE, ("BA - Send ADDBA request. StartSeq = %x, FrameLen = %ld. BufSize = %d\n", Frame.BaStartSeq.field.StartSeq, FrameLen, Frame.BaParm.BufSize)); - } -} - -/* - ========================================================================== - Description: - send DELBA and delete BaEntry if any - Parametrs: - Elem - MLME message MLME_DELBA_REQ_STRUCT - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID MlmeDELBAAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - MLME_DELBA_REQ_STRUCT *pInfo; - PUCHAR pOutBuffer = NULL; - PUCHAR pOutBuffer2 = NULL; - NDIS_STATUS NStatus; - ULONG Idx; - FRAME_DELBA_REQ Frame; - ULONG FrameLen; - FRAME_BAR FrameBar; - - pInfo = (MLME_DELBA_REQ_STRUCT *)Elem->Msg; - // must send back DELBA - NdisZeroMemory(&Frame, sizeof(FRAME_DELBA_REQ)); - DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeDELBAAction(), Initiator(%d) \n", pInfo->Initiator)); - - if(MlmeDelBAReqSanity(pAd, Elem->Msg, Elem->MsgLen)) - { - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_ERROR,("BA - MlmeDELBAAction() allocate memory failed 1. \n")); - return; - } - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - MlmeFreeMemory(pAd, pOutBuffer); - DBGPRINT(RT_DEBUG_ERROR, ("BA - MlmeDELBAAction() allocate memory failed 2. \n")); - return; - } - - // SEND BAR (Send BAR to refresh peer reordering buffer.) - Idx = pAd->MacTab.Content[pInfo->Wcid].BAOriWcidArray[pInfo->TID]; - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - BarHeaderInit(pAd, &FrameBar, pAd->MacTab.Content[pInfo->Wcid].Addr, pAd->CurrentAddress); -#endif // CONFIG_STA_SUPPORT // - - FrameBar.StartingSeq.field.FragNum = 0; // make sure sequence not clear in DEL funciton. - FrameBar.StartingSeq.field.StartSeq = pAd->MacTab.Content[pInfo->Wcid].TxSeq[pInfo->TID]; // make sure sequence not clear in DEL funciton. - FrameBar.BarControl.TID = pInfo->TID; // make sure sequence not clear in DEL funciton. - FrameBar.BarControl.ACKPolicy = IMMED_BA; // make sure sequence not clear in DEL funciton. - FrameBar.BarControl.Compressed = 1; // make sure sequence not clear in DEL funciton. - FrameBar.BarControl.MTID = 0; // make sure sequence not clear in DEL funciton. - - MakeOutgoingFrame(pOutBuffer2, &FrameLen, - sizeof(FRAME_BAR), &FrameBar, - END_OF_ARGS); - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer2, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer2); - DBGPRINT(RT_DEBUG_TRACE,("BA - MlmeDELBAAction() . Send BAR to refresh peer reordering buffer \n")); - - // SEND DELBA FRAME - FrameLen = 0; -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (ADHOC_ON(pAd)) - ActHeaderInit(pAd, &Frame.Hdr, pAd->MacTab.Content[pInfo->Wcid].Addr, pAd->CurrentAddress, pAd->CommonCfg.Bssid); - else -#ifdef QOS_DLS_SUPPORT - if (pAd->MacTab.Content[pInfo->Wcid].ValidAsDls) - ActHeaderInit(pAd, &Frame.Hdr, pAd->MacTab.Content[pInfo->Wcid].Addr, pAd->CurrentAddress, pAd->CommonCfg.Bssid); - else -#endif // QOS_DLS_SUPPORT // - ActHeaderInit(pAd, &Frame.Hdr, pAd->CommonCfg.Bssid, pAd->CurrentAddress, pAd->MacTab.Content[pInfo->Wcid].Addr); - } -#endif // CONFIG_STA_SUPPORT // - Frame.Category = CATEGORY_BA; - Frame.Action = DELBA; - Frame.DelbaParm.Initiator = pInfo->Initiator; - Frame.DelbaParm.TID = pInfo->TID; - Frame.ReasonCode = 39; // Time Out - *(USHORT *)(&Frame.DelbaParm) = cpu2le16(*(USHORT *)(&Frame.DelbaParm)); - Frame.ReasonCode = cpu2le16(Frame.ReasonCode); - - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_DELBA_REQ), &Frame, - END_OF_ARGS); - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - DBGPRINT(RT_DEBUG_TRACE, ("BA - MlmeDELBAAction() . 3 DELBA sent. Initiator(%d)\n", pInfo->Initiator)); - } -} -#endif // DOT11_N_SUPPORT // - -VOID MlmeQOSAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ -} - -VOID MlmeDLSAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ -} - -VOID MlmeInvalidAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - //PUCHAR pOutBuffer = NULL; - //Return the receiving frame except the MSB of category filed set to 1. 7.3.1.11 -} - -VOID PeerQOSAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ -} - -#ifdef QOS_DLS_SUPPORT -VOID PeerDLSAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR Action = Elem->Msg[LENGTH_802_11+1]; - - switch(Action) - { - case ACTION_DLS_REQUEST: -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - PeerDlsReqAction(pAd, Elem); -#endif // CONFIG_STA_SUPPORT // - break; - - case ACTION_DLS_RESPONSE: -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - PeerDlsRspAction(pAd, Elem); -#endif // CONFIG_STA_SUPPORT // - break; - - case ACTION_DLS_TEARDOWN: -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - PeerDlsTearDownAction(pAd, Elem); -#endif // CONFIG_STA_SUPPORT // - break; - } -} -#endif // QOS_DLS_SUPPORT // - - - -#ifdef DOT11_N_SUPPORT -VOID PeerBAAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR Action = Elem->Msg[LENGTH_802_11+1]; - - switch(Action) - { - case ADDBA_REQ: - PeerAddBAReqAction(pAd,Elem); - break; - case ADDBA_RESP: - PeerAddBARspAction(pAd,Elem); - break; - case DELBA: - PeerDelBAAction(pAd,Elem); - break; - } -} - - -#ifdef DOT11N_DRAFT3 - -#ifdef CONFIG_STA_SUPPORT -VOID StaPublicAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Bss2040Coexist) -{ - BSS_2040_COEXIST_IE BssCoexist; - MLME_SCAN_REQ_STRUCT ScanReq; - - BssCoexist.word = Bss2040Coexist; - // AP asks Station to return a 20/40 BSS Coexistence mgmt frame. So we first starts a scan, then send back 20/40 BSS Coexistence mgmt frame - if ((BssCoexist.field.InfoReq == 1) && (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_SCAN_2040))) - { - // Clear record first. After scan , will update those bit and send back to transmiter. - pAd->CommonCfg.BSSCoexist2040.field.InfoReq = 1; - pAd->CommonCfg.BSSCoexist2040.field.Intolerant40 = 0; - pAd->CommonCfg.BSSCoexist2040.field.BSS20WidthReq = 0; - // Fill out stuff for scan request - ScanParmFill(pAd, &ScanReq, ZeroSsid, 0, BSS_ANY, SCAN_2040_BSS_COEXIST); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; - } -} - - -/* -Description : Build Intolerant Channel Rerpot from Trigger event table. -return : how many bytes copied. -*/ -ULONG BuildIntolerantChannelRep( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDest) -{ - ULONG FrameLen = 0; - ULONG ReadOffset = 0; - UCHAR i; - UCHAR LastRegClass = 0xff; - PUCHAR pLen; - - for ( i = 0;i < MAX_TRIGGER_EVENT;i++) - { - if (pAd->CommonCfg.TriggerEventTab.EventA[i].bValid == TRUE) - { - if (pAd->CommonCfg.TriggerEventTab.EventA[i].RegClass == LastRegClass) - { - *(pDest + ReadOffset) = (UCHAR)pAd->CommonCfg.TriggerEventTab.EventA[i].Channel; - *pLen++; - ReadOffset++; - FrameLen++; - } - else - { - *(pDest + ReadOffset) = IE_2040_BSS_INTOLERANT_REPORT; // IE - *(pDest + ReadOffset + 1) = 2; // Len = RegClass byte + channel byte. - pLen = pDest + ReadOffset + 1; - LastRegClass = pAd->CommonCfg.TriggerEventTab.EventA[i].RegClass; - *(pDest + ReadOffset + 2) = LastRegClass; // Len = RegClass byte + channel byte. - *(pDest + ReadOffset + 3) = (UCHAR)pAd->CommonCfg.TriggerEventTab.EventA[i].Channel; - FrameLen += 4; - ReadOffset += 4; - } - - } - } - return FrameLen; -} - - -/* -Description : Send 20/40 BSS Coexistence Action frame If one trigger event is triggered. -*/ -VOID Send2040CoexistAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN BOOLEAN bAddIntolerantCha) -{ - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - FRAME_ACTION_HDR Frame; - ULONG FrameLen; - ULONG IntolerantChaRepLen; - - IntolerantChaRepLen = 0; - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_ERROR,("ACT - Send2040CoexistAction() allocate memory failed \n")); - return; - } - ActHeaderInit(pAd, &Frame.Hdr, pAd->MacTab.Content[Wcid].Addr, pAd->CommonCfg.Bssid); - Frame.Category = CATEGORY_PUBLIC; - Frame.Action = ACTION_BSS_2040_COEXIST; - - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_ACTION_HDR), &Frame, - END_OF_ARGS); - - *(pOutBuffer + FrameLen) = pAd->CommonCfg.BSSCoexist2040.word; - FrameLen++; - - if (bAddIntolerantCha == TRUE) - IntolerantChaRepLen = BuildIntolerantChannelRep(pAd, pOutBuffer + FrameLen); - - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen + IntolerantChaRepLen); - DBGPRINT(RT_DEBUG_ERROR,("ACT - Send2040CoexistAction( BSSCoexist2040 = 0x%x ) \n", pAd->CommonCfg.BSSCoexist2040.word)); - -} - - -/* - ========================================================================== - Description: - After scan, Update 20/40 BSS Coexistence IE and send out. - According to 802.11n D3.03 11.14.10 - - Parameters: - ========================================================================== - */ -VOID Update2040CoexistFrameAndNotify( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN BOOLEAN bAddIntolerantCha) -{ - BSS_2040_COEXIST_IE OldValue; - - OldValue.word = pAd->CommonCfg.BSSCoexist2040.word; - if ((pAd->CommonCfg.TriggerEventTab.EventANo > 0) || (pAd->CommonCfg.TriggerEventTab.EventBCountDown > 0)) - pAd->CommonCfg.BSSCoexist2040.field.BSS20WidthReq = 1; - - // Need to check !!!! - // How STA will set Intolerant40 if implementation dependent. Now we don't set this bit first.!!!!! - // So Only check BSS20WidthReq change. - if (OldValue.field.BSS20WidthReq != pAd->CommonCfg.BSSCoexist2040.field.BSS20WidthReq) - { - Send2040CoexistAction(pAd, Wcid, bAddIntolerantCha); - } -} -#endif // CONFIG_STA_SUPPORT // - - -BOOLEAN ChannelSwitchSanityCheck( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR NewChannel, - IN UCHAR Secondary) -{ - UCHAR i; - - if (Wcid >= MAX_LEN_OF_MAC_TABLE) - return FALSE; - - if ((NewChannel > 7) && (Secondary == 1)) - return FALSE; - - if ((NewChannel < 5) && (Secondary == 3)) - return FALSE; - - // 0. Check if new channel is in the channellist. - for (i = 0;i < pAd->ChannelListNum;i++) - { - if (pAd->ChannelList[i].Channel == NewChannel) - { - break; - } - } - - if (i == pAd->ChannelListNum) - return FALSE; - - return TRUE; -} - - -VOID ChannelSwitchAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR NewChannel, - IN UCHAR Secondary) -{ - UCHAR BBPValue = 0; - ULONG MACValue; - - DBGPRINT(RT_DEBUG_TRACE,("SPECTRUM - ChannelSwitchAction(NewChannel = %d , Secondary = %d) \n", NewChannel, Secondary)); - - if (ChannelSwitchSanityCheck(pAd, Wcid, NewChannel, Secondary) == FALSE) - return; - - // 1. Switches to BW = 20. - if (Secondary == 0) - { - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue&= (~0x18); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - if (pAd->MACVersion == 0x28600100) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x16); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x08); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x11); - DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" )); - } - pAd->CommonCfg.BBPCurrentBW = BW_20; - pAd->CommonCfg.Channel = NewChannel; - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel,FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - pAd->MacTab.Content[Wcid].HTPhyMode.field.BW = 0; - DBGPRINT(RT_DEBUG_TRACE, ("!!!20MHz !!! \n" )); - } - // 1. Switches to BW = 40 And Station supports BW = 40. - else if (((Secondary == 1) || (Secondary == 3)) && (pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth == 1)) - { - pAd->CommonCfg.Channel = NewChannel; - - if (Secondary == 1) - { - // Secondary above. - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel + 2; - RTMP_IO_READ32(pAd, TX_BAND_CFG, &MACValue); - MACValue &= 0xfe; - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, MACValue); - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue&= (~0x18); - BBPValue|= (0x10); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBPValue); - BBPValue&= (~0x20); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBPValue); - DBGPRINT(RT_DEBUG_TRACE, ("!!!40MHz Lower LINK UP !!! Control Channel at Below. Central = %d \n", pAd->CommonCfg.CentralChannel )); - } - else - { - // Secondary below. - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel - 2; - RTMP_IO_READ32(pAd, TX_BAND_CFG, &MACValue); - MACValue &= 0xfe; - MACValue |= 0x1; - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, MACValue); - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue&= (~0x18); - BBPValue|= (0x10); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBPValue); - BBPValue&= (~0x20); - BBPValue|= (0x20); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBPValue); - DBGPRINT(RT_DEBUG_TRACE, ("!!!40MHz Upper LINK UP !!! Control Channel at UpperCentral = %d \n", pAd->CommonCfg.CentralChannel )); - } - pAd->CommonCfg.BBPCurrentBW = BW_40; - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - pAd->MacTab.Content[Wcid].HTPhyMode.field.BW = 1; - } -} -#endif // DOT11N_DRAFT3 // -#endif // DOT11_N_SUPPORT // - -VOID PeerPublicAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ -#ifdef DOT11_N_SUPPORT -#ifdef DOT11N_DRAFT3 - UCHAR Action = Elem->Msg[LENGTH_802_11+1]; -#endif // DOT11N_DRAFT3 // -#endif // DOT11_N_SUPPORT // - if (Elem->Wcid >= MAX_LEN_OF_MAC_TABLE) - return; - -#ifdef DOT11_N_SUPPORT -#ifdef DOT11N_DRAFT3 - switch(Action) - { - case ACTION_BSS_2040_COEXIST: // Format defined in IEEE 7.4.7a.1 in 11n Draf3.03 - { - //UCHAR BssCoexist; - BSS_2040_COEXIST_ELEMENT *pCoexistInfo; - BSS_2040_COEXIST_IE *pBssCoexistIe; - BSS_2040_INTOLERANT_CH_REPORT *pIntolerantReport = NULL; - - if (Elem->MsgLen <= (LENGTH_802_11 + sizeof(BSS_2040_COEXIST_ELEMENT)) ) - { - DBGPRINT(RT_DEBUG_ERROR, ("ACTION - 20/40 BSS Coexistence Management Frame length too short! len = %ld!\n", Elem->MsgLen)); - break; - } - DBGPRINT(RT_DEBUG_TRACE, ("ACTION - 20/40 BSS Coexistence Management action----> \n")); - hex_dump("CoexistenceMgmtFrame", Elem->Msg, Elem->MsgLen); - - - pCoexistInfo = (BSS_2040_COEXIST_ELEMENT *) &Elem->Msg[LENGTH_802_11+2]; - //hex_dump("CoexistInfo", (PUCHAR)pCoexistInfo, sizeof(BSS_2040_COEXIST_ELEMENT)); - if (Elem->MsgLen >= (LENGTH_802_11 + sizeof(BSS_2040_COEXIST_ELEMENT) + sizeof(BSS_2040_INTOLERANT_CH_REPORT))) - { - pIntolerantReport = (BSS_2040_INTOLERANT_CH_REPORT *)((PUCHAR)pCoexistInfo + sizeof(BSS_2040_COEXIST_ELEMENT)); - } - //hex_dump("IntolerantReport ", (PUCHAR)pIntolerantReport, sizeof(BSS_2040_INTOLERANT_CH_REPORT)); - - pBssCoexistIe = (BSS_2040_COEXIST_IE *)(&pCoexistInfo->BssCoexistIe); - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (INFRA_ON(pAd)) - { - StaPublicAction(pAd, pCoexistInfo); - } - } -#endif // CONFIG_STA_SUPPORT // - - } - break; - } - -#endif // DOT11N_DRAFT3 // -#endif // DOT11_N_SUPPORT // - -} - - -static VOID ReservedAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR Category; - - if (Elem->MsgLen <= LENGTH_802_11) - { - return; - } - - Category = Elem->Msg[LENGTH_802_11]; - DBGPRINT(RT_DEBUG_TRACE,("Rcv reserved category(%d) Action Frame\n", Category)); - hex_dump("Reserved Action Frame", &Elem->Msg[0], Elem->MsgLen); -} - -VOID PeerRMAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) - -{ - return; -} - -#ifdef DOT11_N_SUPPORT -static VOID respond_ht_information_exchange_action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen; - FRAME_HT_INFO HTINFOframe, *pFrame; - UCHAR *pAddr; - - - // 2. Always send back ADDBA Response - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE,("ACTION - respond_ht_information_exchange_action() allocate memory failed \n")); - return; - } - - // get RA - pFrame = (FRAME_HT_INFO *) &Elem->Msg[0]; - pAddr = pFrame->Hdr.Addr2; - - NdisZeroMemory(&HTINFOframe, sizeof(FRAME_HT_INFO)); - // 2-1. Prepare ADDBA Response frame. -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (ADHOC_ON(pAd)) - ActHeaderInit(pAd, &HTINFOframe.Hdr, pAddr, pAd->CurrentAddress, pAd->CommonCfg.Bssid); - else - ActHeaderInit(pAd, &HTINFOframe.Hdr, pAd->CommonCfg.Bssid, pAd->CurrentAddress, pAddr); - } -#endif // CONFIG_STA_SUPPORT // - - HTINFOframe.Category = CATEGORY_HT; - HTINFOframe.Action = HT_INFO_EXCHANGE; - HTINFOframe.HT_Info.Request = 0; - HTINFOframe.HT_Info.Forty_MHz_Intolerant = pAd->CommonCfg.HtCapability.HtCapInfo.Forty_Mhz_Intolerant; - HTINFOframe.HT_Info.STA_Channel_Width = pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth; - - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_HT_INFO), &HTINFOframe, - END_OF_ARGS); - - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); -} - - -#ifdef DOT11N_DRAFT3 -VOID SendNotifyBWActionFrame( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR apidx) -{ - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - FRAME_ACTION_HDR Frame; - ULONG FrameLen; - PUCHAR pAddr1; - - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_ERROR,("ACT - SendNotifyBWAction() allocate memory failed \n")); - return; - } - - if (Wcid == MCAST_WCID) - pAddr1 = &BROADCAST_ADDR[0]; - else - pAddr1 = pAd->MacTab.Content[Wcid].Addr; - ActHeaderInit(pAd, &Frame.Hdr, pAddr1, pAd->ApCfg.MBSSID[apidx].Bssid, pAd->ApCfg.MBSSID[apidx].Bssid); - - Frame.Category = CATEGORY_HT; - Frame.Action = NOTIFY_BW_ACTION; - - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_ACTION_HDR), &Frame, - END_OF_ARGS); - - *(pOutBuffer + FrameLen) = pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth; - FrameLen++; - - - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); - DBGPRINT(RT_DEBUG_TRACE,("ACT - SendNotifyBWAction(NotifyBW= %d)!\n", pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth)); - -} -#endif // DOT11N_DRAFT3 // - - -VOID PeerHTAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR Action = Elem->Msg[LENGTH_802_11+1]; - - if (Elem->Wcid >= MAX_LEN_OF_MAC_TABLE) - return; - - switch(Action) - { - case NOTIFY_BW_ACTION: - DBGPRINT(RT_DEBUG_TRACE,("ACTION - HT Notify Channel bandwidth action----> \n")); -#ifdef CONFIG_STA_SUPPORT - if(pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) - { - // Note, this is to patch DIR-1353 AP. When the AP set to Wep, it will use legacy mode. But AP still keeps - // sending BW_Notify Action frame, and cause us to linkup and linkdown. - // In legacy mode, don't need to parse HT action frame. - DBGPRINT(RT_DEBUG_TRACE,("ACTION -Ignore HT Notify Channel BW when link as legacy mode. BW = %d---> \n", - Elem->Msg[LENGTH_802_11+2] )); - break; - } -#endif // CONFIG_STA_SUPPORT // - - if (Elem->Msg[LENGTH_802_11+2] == 0) // 7.4.8.2. if value is 1, keep the same as supported channel bandwidth. - pAd->MacTab.Content[Elem->Wcid].HTPhyMode.field.BW = 0; - - break; - - case SMPS_ACTION: - // 7.3.1.25 - DBGPRINT(RT_DEBUG_TRACE,("ACTION - SMPS action----> \n")); - if (((Elem->Msg[LENGTH_802_11+2]&0x1) == 0)) - { - pAd->MacTab.Content[Elem->Wcid].MmpsMode = MMPS_ENABLE; - } - else if (((Elem->Msg[LENGTH_802_11+2]&0x2) == 0)) - { - pAd->MacTab.Content[Elem->Wcid].MmpsMode = MMPS_STATIC; - } - else - { - pAd->MacTab.Content[Elem->Wcid].MmpsMode = MMPS_DYNAMIC; - } - - DBGPRINT(RT_DEBUG_TRACE,("Aid(%d) MIMO PS = %d\n", Elem->Wcid, pAd->MacTab.Content[Elem->Wcid].MmpsMode)); - // rt2860c : add something for smps change. - break; - - case SETPCO_ACTION: - break; - - case MIMO_CHA_MEASURE_ACTION: - break; - - case HT_INFO_EXCHANGE: - { - HT_INFORMATION_OCTET *pHT_info; - - pHT_info = (HT_INFORMATION_OCTET *) &Elem->Msg[LENGTH_802_11+2]; - // 7.4.8.10 - DBGPRINT(RT_DEBUG_TRACE,("ACTION - HT Information Exchange action----> \n")); - if (pHT_info->Request) - { - respond_ht_information_exchange_action(pAd, Elem); - } - } - break; - } -} - - -/* - ========================================================================== - Description: - Retry sending ADDBA Reqest. - - IRQL = DISPATCH_LEVEL - - Parametrs: - p8023Header: if this is already 802.3 format, p8023Header is NULL - - Return : TRUE if put into rx reordering buffer, shouldn't indicaterxhere. - FALSE , then continue indicaterx at this moment. - ========================================================================== - */ -VOID ORIBATimerTimeout( - IN PRTMP_ADAPTER pAd) -{ - MAC_TABLE_ENTRY *pEntry; - INT i, total; -// FRAME_BAR FrameBar; -// ULONG FrameLen; -// NDIS_STATUS NStatus; -// PUCHAR pOutBuffer = NULL; -// USHORT Sequence; - UCHAR TID; - -#ifdef RALINK_ATE - if (ATE_ON(pAd)) - return; -#endif // RALINK_ATE // - - total = pAd->MacTab.Size * NUM_OF_TID; - - for (i = 1; ((i 0)) ; i++) - { - if (pAd->BATable.BAOriEntry[i].ORI_BA_Status == Originator_Done) - { - pEntry = &pAd->MacTab.Content[pAd->BATable.BAOriEntry[i].Wcid]; - TID = pAd->BATable.BAOriEntry[i].TID; - - ASSERT(pAd->BATable.BAOriEntry[i].Wcid < MAX_LEN_OF_MAC_TABLE); - } - total --; - } -} - - -VOID SendRefreshBAR( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry) -{ - FRAME_BAR FrameBar; - ULONG FrameLen; - NDIS_STATUS NStatus; - PUCHAR pOutBuffer = NULL; - USHORT Sequence; - UCHAR i, TID; - USHORT idx; - BA_ORI_ENTRY *pBAEntry; - - for (i = 0; i BAOriWcidArray[i]; - if (idx == 0) - { - continue; - } - pBAEntry = &pAd->BATable.BAOriEntry[idx]; - - if (pBAEntry->ORI_BA_Status == Originator_Done) - { - TID = pBAEntry->TID; - - ASSERT(pBAEntry->Wcid < MAX_LEN_OF_MAC_TABLE); - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_ERROR,("BA - MlmeADDBAAction() allocate memory failed \n")); - return; - } - - Sequence = pEntry->TxSeq[TID]; - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - BarHeaderInit(pAd, &FrameBar, pEntry->Addr, pAd->CurrentAddress); -#endif // CONFIG_STA_SUPPORT // - - FrameBar.StartingSeq.field.FragNum = 0; // make sure sequence not clear in DEL function. - FrameBar.StartingSeq.field.StartSeq = Sequence; // make sure sequence not clear in DEL funciton. - FrameBar.BarControl.TID = TID; // make sure sequence not clear in DEL funciton. - - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_BAR), &FrameBar, - END_OF_ARGS); - //if (!(CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_RALINK_CHIPSET))) - if (1) // Now we always send BAR. - { - //MiniportMMRequestUnlock(pAd, 0, pOutBuffer, FrameLen); - MiniportMMRequest(pAd, (MGMT_USE_QUEUE_FLAG | MapUserPriorityToAccessCategory[TID]), pOutBuffer, FrameLen); - - } - MlmeFreeMemory(pAd, pOutBuffer); - } - } -} -#endif // DOT11_N_SUPPORT // - -VOID ActHeaderInit( - IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, - IN PUCHAR Addr1, - IN PUCHAR Addr2, - IN PUCHAR Addr3) -{ - NdisZeroMemory(pHdr80211, sizeof(HEADER_802_11)); - pHdr80211->FC.Type = BTYPE_MGMT; - pHdr80211->FC.SubType = SUBTYPE_ACTION; - - COPY_MAC_ADDR(pHdr80211->Addr1, Addr1); - COPY_MAC_ADDR(pHdr80211->Addr2, Addr2); - COPY_MAC_ADDR(pHdr80211->Addr3, Addr3); -} - -VOID BarHeaderInit( - IN PRTMP_ADAPTER pAd, - IN OUT PFRAME_BAR pCntlBar, - IN PUCHAR pDA, - IN PUCHAR pSA) -{ -// USHORT Duration; - - NdisZeroMemory(pCntlBar, sizeof(FRAME_BAR)); - pCntlBar->FC.Type = BTYPE_CNTL; - pCntlBar->FC.SubType = SUBTYPE_BLOCK_ACK_REQ; - pCntlBar->BarControl.MTID = 0; - pCntlBar->BarControl.Compressed = 1; - pCntlBar->BarControl.ACKPolicy = 0; - - - pCntlBar->Duration = 16 + RTMPCalcDuration(pAd, RATE_1, sizeof(FRAME_BA)); - - COPY_MAC_ADDR(pCntlBar->Addr1, pDA); - COPY_MAC_ADDR(pCntlBar->Addr2, pSA); -} - - -/* - ========================================================================== - Description: - Insert Category and action code into the action frame. - - Parametrs: - 1. frame buffer pointer. - 2. frame length. - 3. category code of the frame. - 4. action code of the frame. - - Return : None. - ========================================================================== - */ -VOID InsertActField( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 Category, - IN UINT8 ActCode) -{ - ULONG TempLen; - - MakeOutgoingFrame( pFrameBuf, &TempLen, - 1, &Category, - 1, &ActCode, - END_OF_ARGS); - - *pFrameLen = *pFrameLen + TempLen; - - return; -} diff --git a/drivers/staging/rt3090/common/ba_action.c b/drivers/staging/rt3090/common/ba_action.c deleted file mode 100644 index c73248980690..000000000000 --- a/drivers/staging/rt3090/common/ba_action.c +++ /dev/null @@ -1,1779 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - */ - - -#ifdef DOT11_N_SUPPORT - -#include "../rt_config.h" - - -#define BA_ORI_INIT_SEQ (pEntry->TxSeq[TID]) //1 // inital sequence number of BA session - -#define ORI_SESSION_MAX_RETRY 8 -#define ORI_BA_SESSION_TIMEOUT (2000) // ms -#define REC_BA_SESSION_IDLE_TIMEOUT (1000) // ms - -#define REORDERING_PACKET_TIMEOUT ((100 * OS_HZ)/1000) // system ticks -- 100 ms -#define MAX_REORDERING_PACKET_TIMEOUT ((3000 * OS_HZ)/1000) // system ticks -- 100 ms - -#define RESET_RCV_SEQ (0xFFFF) - -static void ba_mpdu_blk_free(PRTMP_ADAPTER pAd, struct reordering_mpdu *mpdu_blk); - - -BA_ORI_ENTRY *BATableAllocOriEntry( - IN PRTMP_ADAPTER pAd, - OUT USHORT *Idx); - -BA_REC_ENTRY *BATableAllocRecEntry( - IN PRTMP_ADAPTER pAd, - OUT USHORT *Idx); - -VOID BAOriSessionSetupTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID BARecSessionIdleTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - - -BUILD_TIMER_FUNCTION(BAOriSessionSetupTimeout); -BUILD_TIMER_FUNCTION(BARecSessionIdleTimeout); - -#define ANNOUNCE_REORDERING_PACKET(_pAd, _mpdu_blk) \ - Announce_Reordering_Packet(_pAd, _mpdu_blk); - -VOID BA_MaxWinSizeReasign( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntryPeer, - OUT UCHAR *pWinSize) -{ - UCHAR MaxSize; - - - if (pAd->MACVersion >= RALINK_2883_VERSION) // 3*3 - { - if (pAd->MACVersion >= RALINK_3070_VERSION) - { - if (pEntryPeer->WepStatus != Ndis802_11EncryptionDisabled) - MaxSize = 7; // for non-open mode - else - MaxSize = 13; - } - else - MaxSize = 31; - } - else if (pAd->MACVersion >= RALINK_2880E_VERSION) // 2880 e - { - if (pEntryPeer->WepStatus != Ndis802_11EncryptionDisabled) - MaxSize = 7; // for non-open mode - else - MaxSize = 13; - } - else - MaxSize = 7; - - DBGPRINT(RT_DEBUG_TRACE, ("ba> Win Size = %d, Max Size = %d\n", - *pWinSize, MaxSize)); - - if ((*pWinSize) > MaxSize) - { - DBGPRINT(RT_DEBUG_TRACE, ("ba> reassign max win size from %d to %d\n", - *pWinSize, MaxSize)); - - *pWinSize = MaxSize; - } -} - -void Announce_Reordering_Packet(IN PRTMP_ADAPTER pAd, - IN struct reordering_mpdu *mpdu) -{ - PNDIS_PACKET pPacket; - - pPacket = mpdu->pPacket; - - if (mpdu->bAMSDU) - { - ASSERT(0); - BA_Reorder_AMSDU_Annnounce(pAd, pPacket); - } - else - { - // - // pass this 802.3 packet to upper layer or forward this packet to WM directly - // - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - ANNOUNCE_OR_FORWARD_802_3_PACKET(pAd, pPacket, RTMP_GET_PACKET_IF(pPacket)); -#endif // CONFIG_STA_SUPPORT // - } -} - -/* - * Insert a reordering mpdu into sorted linked list by sequence no. - */ -BOOLEAN ba_reordering_mpdu_insertsorted(struct reordering_list *list, struct reordering_mpdu *mpdu) -{ - - struct reordering_mpdu **ppScan = &list->next; - - while (*ppScan != NULL) - { - if (SEQ_SMALLER((*ppScan)->Sequence, mpdu->Sequence, MAXSEQ)) - { - ppScan = &(*ppScan)->next; - } - else if ((*ppScan)->Sequence == mpdu->Sequence) - { - /* give up this duplicated frame */ - return(FALSE); - } - else - { - /* find position */ - break; - } - } - - mpdu->next = *ppScan; - *ppScan = mpdu; - list->qlen++; - return TRUE; -} - - -/* - * caller lock critical section if necessary - */ -static inline void ba_enqueue(struct reordering_list *list, struct reordering_mpdu *mpdu_blk) -{ - list->qlen++; - mpdu_blk->next = list->next; - list->next = mpdu_blk; -} - -/* - * caller lock critical section if necessary - */ -static inline struct reordering_mpdu * ba_dequeue(struct reordering_list *list) -{ - struct reordering_mpdu *mpdu_blk = NULL; - - ASSERT(list); - - if (list->qlen) - { - list->qlen--; - mpdu_blk = list->next; - if (mpdu_blk) - { - list->next = mpdu_blk->next; - mpdu_blk->next = NULL; - } - } - return mpdu_blk; -} - - -static inline struct reordering_mpdu *ba_reordering_mpdu_dequeue(struct reordering_list *list) -{ - return(ba_dequeue(list)); -} - - -static inline struct reordering_mpdu *ba_reordering_mpdu_probe(struct reordering_list *list) - { - ASSERT(list); - - return(list->next); - } - - -/* - * free all resource for reordering mechanism - */ -void ba_reordering_resource_release(PRTMP_ADAPTER pAd) -{ - BA_TABLE *Tab; - PBA_REC_ENTRY pBAEntry; - struct reordering_mpdu *mpdu_blk; - int i; - - Tab = &pAd->BATable; - - /* I. release all pending reordering packet */ - NdisAcquireSpinLock(&pAd->BATabLock); - for (i = 0; i < MAX_LEN_OF_BA_REC_TABLE; i++) - { - pBAEntry = &Tab->BARecEntry[i]; - if (pBAEntry->REC_BA_Status != Recipient_NONE) - { - while ((mpdu_blk = ba_reordering_mpdu_dequeue(&pBAEntry->list))) - { - ASSERT(mpdu_blk->pPacket); - RELEASE_NDIS_PACKET(pAd, mpdu_blk->pPacket, NDIS_STATUS_FAILURE); - ba_mpdu_blk_free(pAd, mpdu_blk); - } - } - } - NdisReleaseSpinLock(&pAd->BATabLock); - - ASSERT(pBAEntry->list.qlen == 0); - /* II. free memory of reordering mpdu table */ - NdisAcquireSpinLock(&pAd->mpdu_blk_pool.lock); - os_free_mem(pAd, pAd->mpdu_blk_pool.mem); - NdisReleaseSpinLock(&pAd->mpdu_blk_pool.lock); -} - - - -/* - * Allocate all resource for reordering mechanism - */ -BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num) -{ - int i; - PUCHAR mem; - struct reordering_mpdu *mpdu_blk; - struct reordering_list *freelist; - - /* allocate spinlock */ - NdisAllocateSpinLock(&pAd->mpdu_blk_pool.lock); - - /* initialize freelist */ - freelist = &pAd->mpdu_blk_pool.freelist; - freelist->next = NULL; - freelist->qlen = 0; - - DBGPRINT(RT_DEBUG_TRACE, ("Allocate %d memory for BA reordering\n", (UINT32)(num*sizeof(struct reordering_mpdu)))); - - /* allocate number of mpdu_blk memory */ - os_alloc_mem(pAd, (PUCHAR *)&mem, (num*sizeof(struct reordering_mpdu))); - - pAd->mpdu_blk_pool.mem = mem; - - if (mem == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("Can't Allocate Memory for BA Reordering\n")); - return(FALSE); - } - - /* build mpdu_blk free list */ - for (i=0; impdu_blk_pool.lock); - mpdu_blk = ba_dequeue(&pAd->mpdu_blk_pool.freelist); - if (mpdu_blk) - { -// blk_count++; - /* reset mpdu_blk */ - NdisZeroMemory(mpdu_blk, sizeof(struct reordering_mpdu)); - } - NdisReleaseSpinLock(&pAd->mpdu_blk_pool.lock); - return mpdu_blk; -} - -static void ba_mpdu_blk_free(PRTMP_ADAPTER pAd, struct reordering_mpdu *mpdu_blk) -{ - ASSERT(mpdu_blk); - - NdisAcquireSpinLock(&pAd->mpdu_blk_pool.lock); -// blk_count--; - ba_enqueue(&pAd->mpdu_blk_pool.freelist, mpdu_blk); - NdisReleaseSpinLock(&pAd->mpdu_blk_pool.lock); -} - - -static USHORT ba_indicate_reordering_mpdus_in_order( - IN PRTMP_ADAPTER pAd, - IN PBA_REC_ENTRY pBAEntry, - IN USHORT StartSeq) -{ - struct reordering_mpdu *mpdu_blk; - USHORT LastIndSeq = RESET_RCV_SEQ; - - NdisAcquireSpinLock(&pBAEntry->RxReRingLock); - - while ((mpdu_blk = ba_reordering_mpdu_probe(&pBAEntry->list))) - { - /* find in-order frame */ - if (!SEQ_STEPONE(mpdu_blk->Sequence, StartSeq, MAXSEQ)) - { - break; - } - /* dequeue in-order frame from reodering list */ - mpdu_blk = ba_reordering_mpdu_dequeue(&pBAEntry->list); - /* pass this frame up */ - ANNOUNCE_REORDERING_PACKET(pAd, mpdu_blk); - /* move to next sequence */ - StartSeq = mpdu_blk->Sequence; - LastIndSeq = StartSeq; - /* free mpdu_blk */ - ba_mpdu_blk_free(pAd, mpdu_blk); - } - - NdisReleaseSpinLock(&pBAEntry->RxReRingLock); - - /* update last indicated sequence */ - return LastIndSeq; -} - -static void ba_indicate_reordering_mpdus_le_seq( - IN PRTMP_ADAPTER pAd, - IN PBA_REC_ENTRY pBAEntry, - IN USHORT Sequence) -{ - struct reordering_mpdu *mpdu_blk; - - NdisAcquireSpinLock(&pBAEntry->RxReRingLock); - while ((mpdu_blk = ba_reordering_mpdu_probe(&pBAEntry->list))) - { - /* find in-order frame */ - if ((mpdu_blk->Sequence == Sequence) || SEQ_SMALLER(mpdu_blk->Sequence, Sequence, MAXSEQ)) - { - /* dequeue in-order frame from reodering list */ - mpdu_blk = ba_reordering_mpdu_dequeue(&pBAEntry->list); - /* pass this frame up */ - ANNOUNCE_REORDERING_PACKET(pAd, mpdu_blk); - /* free mpdu_blk */ - ba_mpdu_blk_free(pAd, mpdu_blk); - } - else - { - break; - } - } - NdisReleaseSpinLock(&pBAEntry->RxReRingLock); -} - - -static void ba_refresh_reordering_mpdus( - IN PRTMP_ADAPTER pAd, - PBA_REC_ENTRY pBAEntry) -{ - struct reordering_mpdu *mpdu_blk; - - NdisAcquireSpinLock(&pBAEntry->RxReRingLock); - - /* dequeue in-order frame from reodering list */ - while ((mpdu_blk = ba_reordering_mpdu_dequeue(&pBAEntry->list))) - { - /* pass this frame up */ - ANNOUNCE_REORDERING_PACKET(pAd, mpdu_blk); - - pBAEntry->LastIndSeq = mpdu_blk->Sequence; - ba_mpdu_blk_free(pAd, mpdu_blk); - - /* update last indicated sequence */ - } - ASSERT(pBAEntry->list.qlen == 0); - pBAEntry->LastIndSeq = RESET_RCV_SEQ; - NdisReleaseSpinLock(&pBAEntry->RxReRingLock); -} - - -//static -void ba_flush_reordering_timeout_mpdus( - IN PRTMP_ADAPTER pAd, - IN PBA_REC_ENTRY pBAEntry, - IN ULONG Now32) - -{ - USHORT Sequence; - -// if ((RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+REORDERING_PACKET_TIMEOUT)) && -// (pBAEntry->list.qlen > ((pBAEntry->BAWinSize*7)/8))) //|| -// (RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+(10*REORDERING_PACKET_TIMEOUT))) && -// (pBAEntry->list.qlen > (pBAEntry->BAWinSize/8))) - if (RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+(MAX_REORDERING_PACKET_TIMEOUT/6))) - &&(pBAEntry->list.qlen > 1) - ) - { - DBGPRINT(RT_DEBUG_TRACE,("timeout[%d] (%08lx-%08lx = %d > %d): %x, flush all!\n ", pBAEntry->list.qlen, Now32, (pBAEntry->LastIndSeqAtTimer), - (int)((long) Now32 - (long)(pBAEntry->LastIndSeqAtTimer)), MAX_REORDERING_PACKET_TIMEOUT, - pBAEntry->LastIndSeq)); - ba_refresh_reordering_mpdus(pAd, pBAEntry); - pBAEntry->LastIndSeqAtTimer = Now32; - } - else - if (RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+(REORDERING_PACKET_TIMEOUT))) - && (pBAEntry->list.qlen > 0) - ) - { -// DBGPRINT(RT_DEBUG_OFF, ("timeout[%d] (%lx-%lx = %d > %d): %x, ", pBAEntry->list.qlen, Now32, (pBAEntry->LastIndSeqAtTimer), -// (int)((long) Now32 - (long)(pBAEntry->LastIndSeqAtTimer)), REORDERING_PACKET_TIMEOUT, -// pBAEntry->LastIndSeq)); - // - // force LastIndSeq to shift to LastIndSeq+1 - // - Sequence = (pBAEntry->LastIndSeq+1) & MAXSEQ; - ba_indicate_reordering_mpdus_le_seq(pAd, pBAEntry, Sequence); - pBAEntry->LastIndSeqAtTimer = Now32; - pBAEntry->LastIndSeq = Sequence; - // - // indicate in-order mpdus - // - Sequence = ba_indicate_reordering_mpdus_in_order(pAd, pBAEntry, Sequence); - if (Sequence != RESET_RCV_SEQ) - { - pBAEntry->LastIndSeq = Sequence; - } - - DBGPRINT(RT_DEBUG_OFF, ("%x, flush one!\n", pBAEntry->LastIndSeq)); - - } -} - - -/* - * generate ADDBA request to - * set up BA agreement - */ -VOID BAOriSessionSetUp( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN UCHAR TID, - IN USHORT TimeOut, - IN ULONG DelayTime, - IN BOOLEAN isForced) - -{ - //MLME_ADDBA_REQ_STRUCT AddbaReq; - BA_ORI_ENTRY *pBAEntry = NULL; - USHORT Idx; - BOOLEAN Cancelled; - - if ((pAd->CommonCfg.BACapability.field.AutoBA != TRUE) && (isForced == FALSE)) - return; - - // if this entry is limited to use legacy tx mode, it doesn't generate BA. - if (RTMPStaFixedTxMode(pAd, pEntry) != FIXED_TXMODE_HT) - return; - - if ((pEntry->BADeclineBitmap & (1<BAOriWcidArray[TID]; - if (Idx == 0) - { - // allocate a BA session - pBAEntry = BATableAllocOriEntry(pAd, &Idx); - if (pBAEntry == NULL) - { - DBGPRINT(RT_DEBUG_TRACE,("ADDBA - MlmeADDBAAction() allocate BA session failed \n")); - return; - } - } - else - { - pBAEntry =&pAd->BATable.BAOriEntry[Idx]; - } - - if (pBAEntry->ORI_BA_Status >= Originator_WaitRes) - { - return; - } - - pEntry->BAOriWcidArray[TID] = Idx; - - // Initialize BA session - pBAEntry->ORI_BA_Status = Originator_WaitRes; - pBAEntry->Wcid = pEntry->Aid; - pBAEntry->BAWinSize = pAd->CommonCfg.BACapability.field.RxBAWinLimit; - pBAEntry->Sequence = BA_ORI_INIT_SEQ; - pBAEntry->Token = 1; // (2008-01-21) Jan Lee recommends it - this token can't be 0 - pBAEntry->TID = TID; - pBAEntry->TimeOutValue = TimeOut; - pBAEntry->pAdapter = pAd; - - if (!(pEntry->TXBAbitmap & (1<ORIBATimer, GET_TIMER_FUNCTION(BAOriSessionSetupTimeout), pBAEntry, FALSE); - } - else - RTMPCancelTimer(&pBAEntry->ORIBATimer, &Cancelled); - - // set timer to send ADDBA request - RTMPSetTimer(&pBAEntry->ORIBATimer, DelayTime); -} - -VOID BAOriSessionAdd( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN PFRAME_ADDBA_RSP pFrame) -{ - BA_ORI_ENTRY *pBAEntry = NULL; - BOOLEAN Cancelled; - UCHAR TID; - USHORT Idx; - PUCHAR pOutBuffer2 = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen; - FRAME_BAR FrameBar; - - TID = pFrame->BaParm.TID; - Idx = pEntry->BAOriWcidArray[TID]; - pBAEntry =&pAd->BATable.BAOriEntry[Idx]; - - // Start fill in parameters. - if ((Idx !=0) && (pBAEntry->TID == TID) && (pBAEntry->ORI_BA_Status == Originator_WaitRes)) - { - pBAEntry->BAWinSize = min(pBAEntry->BAWinSize, ((UCHAR)pFrame->BaParm.BufSize)); - BA_MaxWinSizeReasign(pAd, pEntry, &pBAEntry->BAWinSize); - - pBAEntry->TimeOutValue = pFrame->TimeOutValue; - pBAEntry->ORI_BA_Status = Originator_Done; - pAd->BATable.numDoneOriginator ++; - - // reset sequence number - pBAEntry->Sequence = BA_ORI_INIT_SEQ; - // Set Bitmap flag. - pEntry->TXBAbitmap |= (1<ORIBATimer, &Cancelled); - - pBAEntry->ORIBATimer.TimerValue = 0; //pFrame->TimeOutValue; - - DBGPRINT(RT_DEBUG_TRACE,("%s : TXBAbitmap = %x, BAWinSize = %d, TimeOut = %ld\n", __FUNCTION__, pEntry->TXBAbitmap, - pBAEntry->BAWinSize, pBAEntry->ORIBATimer.TimerValue)); - - // SEND BAR ; - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE,("BA - BAOriSessionAdd() allocate memory failed \n")); - return; - } - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - BarHeaderInit(pAd, &FrameBar, pAd->MacTab.Content[pBAEntry->Wcid].Addr, pAd->CurrentAddress); -#endif // CONFIG_STA_SUPPORT // - - FrameBar.StartingSeq.field.FragNum = 0; // make sure sequence not clear in DEL function. - FrameBar.StartingSeq.field.StartSeq = pBAEntry->Sequence; // make sure sequence not clear in DEL funciton. - FrameBar.BarControl.TID = pBAEntry->TID; // make sure sequence not clear in DEL funciton. - MakeOutgoingFrame(pOutBuffer2, &FrameLen, - sizeof(FRAME_BAR), &FrameBar, - END_OF_ARGS); - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer2, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer2); - - - if (pBAEntry->ORIBATimer.TimerValue) - RTMPSetTimer(&pBAEntry->ORIBATimer, pBAEntry->ORIBATimer.TimerValue); // in mSec - } -} - -BOOLEAN BARecSessionAdd( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN PFRAME_ADDBA_REQ pFrame) -{ - BA_REC_ENTRY *pBAEntry = NULL; - BOOLEAN Status = TRUE; - BOOLEAN Cancelled; - USHORT Idx; - UCHAR TID; - UCHAR BAWinSize; - //UINT32 Value; - //UINT offset; - - - ASSERT(pEntry); - - // find TID - TID = pFrame->BaParm.TID; - - BAWinSize = min(((UCHAR)pFrame->BaParm.BufSize), (UCHAR)pAd->CommonCfg.BACapability.field.RxBAWinLimit); - - // Intel patch - if (BAWinSize == 0) - { - BAWinSize = 64; - } - - Idx = pEntry->BARecWcidArray[TID]; - - - if (Idx == 0) - { - pBAEntry = BATableAllocRecEntry(pAd, &Idx); - } - else - { - pBAEntry = &pAd->BATable.BARecEntry[Idx]; - // flush all pending reordering mpdus - ba_refresh_reordering_mpdus(pAd, pBAEntry); - } - - DBGPRINT(RT_DEBUG_TRACE,("%s(%ld): Idx = %d, BAWinSize(req %d) = %d\n", __FUNCTION__, pAd->BATable.numAsRecipient, Idx, - pFrame->BaParm.BufSize, BAWinSize)); - - // Start fill in parameters. - if (pBAEntry != NULL) - { - ASSERT(pBAEntry->list.qlen == 0); - - pBAEntry->REC_BA_Status = Recipient_HandleRes; - pBAEntry->BAWinSize = BAWinSize; - pBAEntry->Wcid = pEntry->Aid; - pBAEntry->TID = TID; - pBAEntry->TimeOutValue = pFrame->TimeOutValue; - pBAEntry->REC_BA_Status = Recipient_Accept; - // initial sequence number - pBAEntry->LastIndSeq = RESET_RCV_SEQ; //pFrame->BaStartSeq.field.StartSeq; - - DBGPRINT(RT_DEBUG_OFF, ("Start Seq = %08x\n", pFrame->BaStartSeq.field.StartSeq)); - - if (pEntry->RXBAbitmap & (1<RECBATimer, &Cancelled); - } - else - { - RTMPInitTimer(pAd, &pBAEntry->RECBATimer, GET_TIMER_FUNCTION(BARecSessionIdleTimeout), pBAEntry, TRUE); - } - - - // Set Bitmap flag. - pEntry->RXBAbitmap |= (1<BARecWcidArray[TID] = Idx; - - pEntry->BADeclineBitmap &= ~(1<Aid, TID); - - DBGPRINT(RT_DEBUG_TRACE,("MACEntry[%d]RXBAbitmap = 0x%x. BARecWcidArray=%d\n", - pEntry->Aid, pEntry->RXBAbitmap, pEntry->BARecWcidArray[TID])); - } - else - { - Status = FALSE; - DBGPRINT(RT_DEBUG_TRACE,("Can't Accept ADDBA for %02x:%02x:%02x:%02x:%02x:%02x TID = %d\n", - PRINT_MAC(pEntry->Addr), TID)); - } - return(Status); -} - - -BA_REC_ENTRY *BATableAllocRecEntry( - IN PRTMP_ADAPTER pAd, - OUT USHORT *Idx) -{ - int i; - BA_REC_ENTRY *pBAEntry = NULL; - - - NdisAcquireSpinLock(&pAd->BATabLock); - - if (pAd->BATable.numAsRecipient >= MAX_BARECI_SESSION) - { - DBGPRINT(RT_DEBUG_OFF, ("BA Recipeint Session (%ld) > %d\n", - pAd->BATable.numAsRecipient, MAX_BARECI_SESSION)); - goto done; - } - - // reserve idx 0 to identify BAWcidArray[TID] as empty - for (i=1; i < MAX_LEN_OF_BA_REC_TABLE; i++) - { - pBAEntry =&pAd->BATable.BARecEntry[i]; - if ((pBAEntry->REC_BA_Status == Recipient_NONE)) - { - // get one - pAd->BATable.numAsRecipient++; - pBAEntry->REC_BA_Status = Recipient_USED; - *Idx = i; - break; - } - } - -done: - NdisReleaseSpinLock(&pAd->BATabLock); - return pBAEntry; -} - -BA_ORI_ENTRY *BATableAllocOriEntry( - IN PRTMP_ADAPTER pAd, - OUT USHORT *Idx) -{ - int i; - BA_ORI_ENTRY *pBAEntry = NULL; - - NdisAcquireSpinLock(&pAd->BATabLock); - - if (pAd->BATable.numAsOriginator >= (MAX_LEN_OF_BA_ORI_TABLE)) - { - goto done; - } - - // reserve idx 0 to identify BAWcidArray[TID] as empty - for (i=1; iBATable.BAOriEntry[i]; - if ((pBAEntry->ORI_BA_Status == Originator_NONE)) - { - // get one - pAd->BATable.numAsOriginator++; - pBAEntry->ORI_BA_Status = Originator_USED; - pBAEntry->pAdapter = pAd; - *Idx = i; - break; - } - } - -done: - NdisReleaseSpinLock(&pAd->BATabLock); - return pBAEntry; -} - - -VOID BATableFreeOriEntry( - IN PRTMP_ADAPTER pAd, - IN ULONG Idx) -{ - BA_ORI_ENTRY *pBAEntry = NULL; - MAC_TABLE_ENTRY *pEntry; - - - if ((Idx == 0) || (Idx >= MAX_LEN_OF_BA_ORI_TABLE)) - return; - - pBAEntry =&pAd->BATable.BAOriEntry[Idx]; - - if (pBAEntry->ORI_BA_Status != Originator_NONE) - { - pEntry = &pAd->MacTab.Content[pBAEntry->Wcid]; - pEntry->BAOriWcidArray[pBAEntry->TID] = 0; - - - NdisAcquireSpinLock(&pAd->BATabLock); - if (pBAEntry->ORI_BA_Status == Originator_Done) - { - pAd->BATable.numDoneOriginator -= 1; - pEntry->TXBAbitmap &= (~(1<<(pBAEntry->TID) )); - DBGPRINT(RT_DEBUG_TRACE, ("BATableFreeOriEntry numAsOriginator= %ld\n", pAd->BATable.numAsRecipient)); - // Erase Bitmap flag. - } - - ASSERT(pAd->BATable.numAsOriginator != 0); - - pAd->BATable.numAsOriginator -= 1; - - pBAEntry->ORI_BA_Status = Originator_NONE; - pBAEntry->Token = 0; - NdisReleaseSpinLock(&pAd->BATabLock); - } -} - - -VOID BATableFreeRecEntry( - IN PRTMP_ADAPTER pAd, - IN ULONG Idx) -{ - BA_REC_ENTRY *pBAEntry = NULL; - MAC_TABLE_ENTRY *pEntry; - - - if ((Idx == 0) || (Idx >= MAX_LEN_OF_BA_REC_TABLE)) - return; - - pBAEntry =&pAd->BATable.BARecEntry[Idx]; - - if (pBAEntry->REC_BA_Status != Recipient_NONE) - { - pEntry = &pAd->MacTab.Content[pBAEntry->Wcid]; - pEntry->BARecWcidArray[pBAEntry->TID] = 0; - - NdisAcquireSpinLock(&pAd->BATabLock); - - ASSERT(pAd->BATable.numAsRecipient != 0); - - pAd->BATable.numAsRecipient -= 1; - - pBAEntry->REC_BA_Status = Recipient_NONE; - NdisReleaseSpinLock(&pAd->BATabLock); - } -} - - -VOID BAOriSessionTearDown( - IN OUT PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR TID, - IN BOOLEAN bPassive, - IN BOOLEAN bForceSend) -{ - ULONG Idx = 0; - BA_ORI_ENTRY *pBAEntry; - BOOLEAN Cancelled; - - if (Wcid >= MAX_LEN_OF_MAC_TABLE) - { - return; - } - - // - // Locate corresponding BA Originator Entry in BA Table with the (pAddr,TID). - // - Idx = pAd->MacTab.Content[Wcid].BAOriWcidArray[TID]; - if ((Idx == 0) || (Idx >= MAX_LEN_OF_BA_ORI_TABLE)) - { - if (bForceSend == TRUE) - { - // force send specified TID DelBA - MLME_DELBA_REQ_STRUCT DelbaReq; - MLME_QUEUE_ELEM *Elem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); - if (Elem != NULL) - { - NdisZeroMemory(&DelbaReq, sizeof(DelbaReq)); - NdisZeroMemory(Elem, sizeof(MLME_QUEUE_ELEM)); - - COPY_MAC_ADDR(DelbaReq.Addr, pAd->MacTab.Content[Wcid].Addr); - DelbaReq.Wcid = Wcid; - DelbaReq.TID = TID; - DelbaReq.Initiator = ORIGINATOR; - Elem->MsgLen = sizeof(DelbaReq); - NdisMoveMemory(Elem->Msg, &DelbaReq, sizeof(DelbaReq)); - MlmeDELBAAction(pAd, Elem); - kfree(Elem); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("%s(bForceSend):alloc memory failed!\n", __FUNCTION__)); - } - } - - return; - } - - DBGPRINT(RT_DEBUG_TRACE,("%s===>Wcid=%d.TID=%d \n", __FUNCTION__, Wcid, TID)); - - pBAEntry = &pAd->BATable.BAOriEntry[Idx]; - DBGPRINT(RT_DEBUG_TRACE,("\t===>Idx = %ld, Wcid=%d.TID=%d, ORI_BA_Status = %d \n", Idx, Wcid, TID, pBAEntry->ORI_BA_Status)); - // - // Prepare DelBA action frame and send to the peer. - // - if ((bPassive == FALSE) && (TID == pBAEntry->TID) && (pBAEntry->ORI_BA_Status == Originator_Done)) - { - MLME_DELBA_REQ_STRUCT DelbaReq; - MLME_QUEUE_ELEM *Elem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); - if (Elem != NULL) - { - NdisZeroMemory(&DelbaReq, sizeof(DelbaReq)); - NdisZeroMemory(Elem, sizeof(MLME_QUEUE_ELEM)); - - COPY_MAC_ADDR(DelbaReq.Addr, pAd->MacTab.Content[Wcid].Addr); - DelbaReq.Wcid = Wcid; - DelbaReq.TID = pBAEntry->TID; - DelbaReq.Initiator = ORIGINATOR; - Elem->MsgLen = sizeof(DelbaReq); - NdisMoveMemory(Elem->Msg, &DelbaReq, sizeof(DelbaReq)); - MlmeDELBAAction(pAd, Elem); - kfree(Elem); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("%s():alloc memory failed!\n", __FUNCTION__)); - return; - } - } - RTMPCancelTimer(&pBAEntry->ORIBATimer, &Cancelled); - BATableFreeOriEntry(pAd, Idx); - - if (bPassive) - { - //BAOriSessionSetUp(pAd, &pAd->MacTab.Content[Wcid], TID, 0, 10000, TRUE); - } -} - -VOID BARecSessionTearDown( - IN OUT PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR TID, - IN BOOLEAN bPassive) -{ - ULONG Idx = 0; - BA_REC_ENTRY *pBAEntry; - - if (Wcid >= MAX_LEN_OF_MAC_TABLE) - { - return; - } - - // - // Locate corresponding BA Originator Entry in BA Table with the (pAddr,TID). - // - Idx = pAd->MacTab.Content[Wcid].BARecWcidArray[TID]; - if (Idx == 0) - return; - - DBGPRINT(RT_DEBUG_TRACE,("%s===>Wcid=%d.TID=%d \n", __FUNCTION__, Wcid, TID)); - - - pBAEntry = &pAd->BATable.BARecEntry[Idx]; - DBGPRINT(RT_DEBUG_TRACE,("\t===>Idx = %ld, Wcid=%d.TID=%d, REC_BA_Status = %d \n", Idx, Wcid, TID, pBAEntry->REC_BA_Status)); - // - // Prepare DelBA action frame and send to the peer. - // - if ((TID == pBAEntry->TID) && (pBAEntry->REC_BA_Status == Recipient_Accept)) - { - MLME_DELBA_REQ_STRUCT DelbaReq; - BOOLEAN Cancelled; - //ULONG offset; - //UINT32 VALUE; - - RTMPCancelTimer(&pBAEntry->RECBATimer, &Cancelled); - - // - // 1. Send DELBA Action Frame - // - if (bPassive == FALSE) - { - MLME_QUEUE_ELEM *Elem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); - if (Elem != NULL) - { - NdisZeroMemory(&DelbaReq, sizeof(DelbaReq)); - NdisZeroMemory(Elem, sizeof(MLME_QUEUE_ELEM)); - - COPY_MAC_ADDR(DelbaReq.Addr, pAd->MacTab.Content[Wcid].Addr); - DelbaReq.Wcid = Wcid; - DelbaReq.TID = TID; - DelbaReq.Initiator = RECIPIENT; - Elem->MsgLen = sizeof(DelbaReq); - NdisMoveMemory(Elem->Msg, &DelbaReq, sizeof(DelbaReq)); - MlmeDELBAAction(pAd, Elem); - kfree(Elem); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("%s():alloc memory failed!\n", __FUNCTION__)); - return; - } - } - - - // - // 2. Free resource of BA session - // - // flush all pending reordering mpdus - ba_refresh_reordering_mpdus(pAd, pBAEntry); - - NdisAcquireSpinLock(&pAd->BATabLock); - - // Erase Bitmap flag. - pBAEntry->LastIndSeq = RESET_RCV_SEQ; - pBAEntry->BAWinSize = 0; - // Erase Bitmap flag at software mactable - pAd->MacTab.Content[Wcid].RXBAbitmap &= (~(1<<(pBAEntry->TID))); - pAd->MacTab.Content[Wcid].BARecWcidArray[TID] = 0; - - RTMP_DEL_BA_SESSION_FROM_ASIC(pAd, Wcid, TID); - - NdisReleaseSpinLock(&pAd->BATabLock); - - } - - BATableFreeRecEntry(pAd, Idx); -} - -VOID BASessionTearDownALL( - IN OUT PRTMP_ADAPTER pAd, - IN UCHAR Wcid) -{ - int i; - - for (i=0; ipAdapter; - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // Do nothing if monitor mode is on - if (MONITOR_ON(pAd)) - return; - } -#endif // CONFIG_STA_SUPPORT // - -#ifdef RALINK_ATE - // Nothing to do in ATE mode. - if (ATE_ON(pAd)) - return; -#endif // RALINK_ATE // - - pEntry = &pAd->MacTab.Content[pBAEntry->Wcid]; - - if ((pBAEntry->ORI_BA_Status == Originator_WaitRes) && (pBAEntry->Token < ORI_SESSION_MAX_RETRY)) - { - MLME_ADDBA_REQ_STRUCT AddbaReq; - - NdisZeroMemory(&AddbaReq, sizeof(AddbaReq)); - COPY_MAC_ADDR(AddbaReq.pAddr, pEntry->Addr); - AddbaReq.Wcid = (UCHAR)(pEntry->Aid); - AddbaReq.TID = pBAEntry->TID; - AddbaReq.BaBufSize = pAd->CommonCfg.BACapability.field.RxBAWinLimit; - AddbaReq.TimeOutValue = 0; - AddbaReq.Token = pBAEntry->Token; - MlmeEnqueue(pAd, ACTION_STATE_MACHINE, MT2_MLME_ADD_BA_CATE, sizeof(MLME_ADDBA_REQ_STRUCT), (PVOID)&AddbaReq); - RTMP_MLME_HANDLER(pAd); - DBGPRINT(RT_DEBUG_TRACE,("BA Ori Session Timeout(%d) : Send ADD BA again\n", pBAEntry->Token)); - - pBAEntry->Token++; - RTMPSetTimer(&pBAEntry->ORIBATimer, ORI_BA_SESSION_TIMEOUT); - } - else - { - BATableFreeOriEntry(pAd, pEntry->BAOriWcidArray[pBAEntry->TID]); - } -} - -/* - ========================================================================== - Description: - Retry sending ADDBA Reqest. - - IRQL = DISPATCH_LEVEL - - Parametrs: - p8023Header: if this is already 802.3 format, p8023Header is NULL - - Return : TRUE if put into rx reordering buffer, shouldn't indicaterxhere. - FALSE , then continue indicaterx at this moment. - ========================================================================== - */ -VOID BARecSessionIdleTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - - BA_REC_ENTRY *pBAEntry = (BA_REC_ENTRY *)FunctionContext; - PRTMP_ADAPTER pAd; - ULONG Now32; - - if (pBAEntry == NULL) - return; - - if ((pBAEntry->REC_BA_Status == Recipient_Accept)) - { - NdisGetSystemUpTime(&Now32); - - if (RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer + REC_BA_SESSION_IDLE_TIMEOUT))) - { - pAd = pBAEntry->pAdapter; - // flush all pending reordering mpdus - ba_refresh_reordering_mpdus(pAd, pBAEntry); - DBGPRINT(RT_DEBUG_OFF, ("%ld: REC BA session Timeout\n", Now32)); - } - } -} - - -VOID PeerAddBAReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) - -{ - // 7.4.4.1 - //ULONG Idx; - UCHAR Status = 1; - UCHAR pAddr[6]; - FRAME_ADDBA_RSP ADDframe; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - PFRAME_ADDBA_REQ pAddreqFrame = NULL; - //UCHAR BufSize; - ULONG FrameLen; - PULONG ptemp; - PMAC_TABLE_ENTRY pMacEntry; - - DBGPRINT(RT_DEBUG_TRACE, ("%s ==> (Wcid = %d)\n", __FUNCTION__, Elem->Wcid)); - - //hex_dump("AddBAReq", Elem->Msg, Elem->MsgLen); - - //ADDBA Request from unknown peer, ignore this. - if (Elem->Wcid >= MAX_LEN_OF_MAC_TABLE) - return; - - pMacEntry = &pAd->MacTab.Content[Elem->Wcid]; - DBGPRINT(RT_DEBUG_TRACE,("BA - PeerAddBAReqAction----> \n")); - ptemp = (PULONG)Elem->Msg; - //DBGPRINT_RAW(RT_DEBUG_EMU, ("%08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x\n", *(ptemp), *(ptemp+1), *(ptemp+2), *(ptemp+3), *(ptemp+4), *(ptemp+5), *(ptemp+6), *(ptemp+7), *(ptemp+8))); - - if (PeerAddBAReqActionSanity(pAd, Elem->Msg, Elem->MsgLen, pAddr)) - { - - if ((pAd->CommonCfg.bBADecline == FALSE) && IS_HT_STA(pMacEntry)) - { - pAddreqFrame = (PFRAME_ADDBA_REQ)(&Elem->Msg[0]); - DBGPRINT(RT_DEBUG_OFF, ("Rcv Wcid(%d) AddBAReq\n", Elem->Wcid)); - if (BARecSessionAdd(pAd, &pAd->MacTab.Content[Elem->Wcid], pAddreqFrame)) - Status = 0; - else - Status = 38; // more parameters have invalid values - } - else - { - Status = 37; // the request has been declined. - } - } - - if (pAd->MacTab.Content[Elem->Wcid].ValidAsCLI) - ASSERT(pAd->MacTab.Content[Elem->Wcid].Sst == SST_ASSOC); - - pAddreqFrame = (PFRAME_ADDBA_REQ)(&Elem->Msg[0]); - // 2. Always send back ADDBA Response - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE,("ACTION - PeerBAAction() allocate memory failed \n")); - return; - } - - NdisZeroMemory(&ADDframe, sizeof(FRAME_ADDBA_RSP)); - // 2-1. Prepare ADDBA Response frame. -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (ADHOC_ON(pAd)) - ActHeaderInit(pAd, &ADDframe.Hdr, pAddr, pAd->CurrentAddress, pAd->CommonCfg.Bssid); - else -#ifdef QOS_DLS_SUPPORT - if (pAd->MacTab.Content[Elem->Wcid].ValidAsDls) - ActHeaderInit(pAd, &ADDframe.Hdr, pAddr, pAd->CurrentAddress, pAd->CommonCfg.Bssid); - else -#endif // QOS_DLS_SUPPORT // - ActHeaderInit(pAd, &ADDframe.Hdr, pAd->CommonCfg.Bssid, pAd->CurrentAddress, pAddr); - } -#endif // CONFIG_STA_SUPPORT // - ADDframe.Category = CATEGORY_BA; - ADDframe.Action = ADDBA_RESP; - ADDframe.Token = pAddreqFrame->Token; - // What is the Status code?? need to check. - ADDframe.StatusCode = Status; - ADDframe.BaParm.BAPolicy = IMMED_BA; - ADDframe.BaParm.AMSDUSupported = 0; - ADDframe.BaParm.TID = pAddreqFrame->BaParm.TID; - ADDframe.BaParm.BufSize = min(((UCHAR)pAddreqFrame->BaParm.BufSize), (UCHAR)pAd->CommonCfg.BACapability.field.RxBAWinLimit); - if (ADDframe.BaParm.BufSize == 0) - { - ADDframe.BaParm.BufSize = 64; - } - ADDframe.TimeOutValue = 0; //pAddreqFrame->TimeOutValue; - - *(USHORT *)(&ADDframe.BaParm) = cpu2le16(*(USHORT *)(&ADDframe.BaParm)); - ADDframe.StatusCode = cpu2le16(ADDframe.StatusCode); - ADDframe.TimeOutValue = cpu2le16(ADDframe.TimeOutValue); - - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_ADDBA_RSP), &ADDframe, - END_OF_ARGS); - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - - DBGPRINT(RT_DEBUG_TRACE, ("%s(%d): TID(%d), BufSize(%d) <== \n", __FUNCTION__, Elem->Wcid, ADDframe.BaParm.TID, - ADDframe.BaParm.BufSize)); -} - - -VOID PeerAddBARspAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) - -{ - //UCHAR Idx, i; - //PUCHAR pOutBuffer = NULL; - PFRAME_ADDBA_RSP pFrame = NULL; - //PBA_ORI_ENTRY pBAEntry; - - //ADDBA Response from unknown peer, ignore this. - if (Elem->Wcid >= MAX_LEN_OF_MAC_TABLE) - return; - - DBGPRINT(RT_DEBUG_TRACE, ("%s ==> Wcid(%d)\n", __FUNCTION__, Elem->Wcid)); - - //hex_dump("PeerAddBARspAction()", Elem->Msg, Elem->MsgLen); - - if (PeerAddBARspActionSanity(pAd, Elem->Msg, Elem->MsgLen)) - { - pFrame = (PFRAME_ADDBA_RSP)(&Elem->Msg[0]); - - DBGPRINT(RT_DEBUG_TRACE, ("\t\t StatusCode = %d\n", pFrame->StatusCode)); - switch (pFrame->StatusCode) - { - case 0: - // I want a BAsession with this peer as an originator. - BAOriSessionAdd(pAd, &pAd->MacTab.Content[Elem->Wcid], pFrame); - break; - default: - // check status == USED ??? - BAOriSessionTearDown(pAd, Elem->Wcid, pFrame->BaParm.TID, TRUE, FALSE); - break; - } - // Rcv Decline StatusCode - if ((pFrame->StatusCode == 37) -#ifdef CONFIG_STA_SUPPORT - || ((pAd->OpMode == OPMODE_STA) && STA_TGN_WIFI_ON(pAd) && (pFrame->StatusCode != 0)) -#endif // CONFIG_STA_SUPPORT // - ) - { - pAd->MacTab.Content[Elem->Wcid].BADeclineBitmap |= 1<BaParm.TID; - } - } -} - -VOID PeerDelBAAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) - -{ - //UCHAR Idx; - //PUCHAR pOutBuffer = NULL; - PFRAME_DELBA_REQ pDelFrame = NULL; - - DBGPRINT(RT_DEBUG_TRACE,("%s ==>\n", __FUNCTION__)); - //DELBA Request from unknown peer, ignore this. - if (PeerDelBAActionSanity(pAd, Elem->Wcid, Elem->Msg, Elem->MsgLen)) - { - pDelFrame = (PFRAME_DELBA_REQ)(&Elem->Msg[0]); - if (pDelFrame->DelbaParm.Initiator == ORIGINATOR) - { - DBGPRINT(RT_DEBUG_TRACE,("BA - PeerDelBAAction----> ORIGINATOR\n")); - BARecSessionTearDown(pAd, Elem->Wcid, pDelFrame->DelbaParm.TID, TRUE); - } - else - { - DBGPRINT(RT_DEBUG_TRACE,("BA - PeerDelBAAction----> RECIPIENT, Reason = %d\n", pDelFrame->ReasonCode)); - //hex_dump("DelBA Frame", pDelFrame, Elem->MsgLen); - BAOriSessionTearDown(pAd, Elem->Wcid, pDelFrame->DelbaParm.TID, TRUE, FALSE); - } - } -} - - -BOOLEAN CntlEnqueueForRecv( - IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN ULONG MsgLen, - IN PFRAME_BA_REQ pMsg) -{ - PFRAME_BA_REQ pFrame = pMsg; - //PRTMP_REORDERBUF pBuffer; - //PRTMP_REORDERBUF pDmaBuf; - PBA_REC_ENTRY pBAEntry; - //BOOLEAN Result; - ULONG Idx; - //UCHAR NumRxPkt; - UCHAR TID;//, i; - - TID = (UCHAR)pFrame->BARControl.TID; - - DBGPRINT(RT_DEBUG_TRACE, ("%s(): BAR-Wcid(%ld), Tid (%d)\n", __FUNCTION__, Wcid, TID)); - //hex_dump("BAR", (PCHAR) pFrame, MsgLen); - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return FALSE; - - // First check the size, it MUST not exceed the mlme queue size - if (MsgLen > MGMT_DMA_BUFFER_SIZE) - { - DBGPRINT_ERR(("CntlEnqueueForRecv: frame too large, size = %ld \n", MsgLen)); - return FALSE; - } - else if (MsgLen != sizeof(FRAME_BA_REQ)) - { - DBGPRINT_ERR(("CntlEnqueueForRecv: BlockAck Request frame length size = %ld incorrect\n", MsgLen)); - return FALSE; - } - else if (MsgLen != sizeof(FRAME_BA_REQ)) - { - DBGPRINT_ERR(("CntlEnqueueForRecv: BlockAck Request frame length size = %ld incorrect\n", MsgLen)); - return FALSE; - } - - if ((Wcid < MAX_LEN_OF_MAC_TABLE) && (TID < 8)) - { - // if this receiving packet is from SA that is in our OriEntry. Since WCID <9 has direct mapping. no need search. - Idx = pAd->MacTab.Content[Wcid].BARecWcidArray[TID]; - pBAEntry = &pAd->BATable.BARecEntry[Idx]; - } - else - { - return FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("BAR(%ld) : Tid (%d) - %04x:%04x\n", Wcid, TID, pFrame->BAStartingSeq.field.StartSeq, pBAEntry->LastIndSeq )); - - if (SEQ_SMALLER(pBAEntry->LastIndSeq, pFrame->BAStartingSeq.field.StartSeq, MAXSEQ)) - { - //DBGPRINT(RT_DEBUG_TRACE, ("BAR Seq = %x, LastIndSeq = %x\n", pFrame->BAStartingSeq.field.StartSeq, pBAEntry->LastIndSeq)); - ba_indicate_reordering_mpdus_le_seq(pAd, pBAEntry, pFrame->BAStartingSeq.field.StartSeq); - pBAEntry->LastIndSeq = (pFrame->BAStartingSeq.field.StartSeq == 0) ? MAXSEQ :(pFrame->BAStartingSeq.field.StartSeq -1); - } - //ba_refresh_reordering_mpdus(pAd, pBAEntry); - return TRUE; -} - -/* -Description : Send PSMP Action frame If PSMP mode switches. -*/ -VOID SendPSMPAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR Psmp) -{ - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - //ULONG Idx; - FRAME_PSMP_ACTION Frame; - ULONG FrameLen; - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_ERROR,("BA - MlmeADDBAAction() allocate memory failed \n")); - return; - } -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - ActHeaderInit(pAd, &Frame.Hdr, pAd->CommonCfg.Bssid, pAd->CurrentAddress, pAd->MacTab.Content[Wcid].Addr); -#endif // CONFIG_STA_SUPPORT // - - Frame.Category = CATEGORY_HT; - Frame.Action = SMPS_ACTION; - switch (Psmp) - { - case MMPS_ENABLE: -#ifdef RT30xx - if (IS_RT30xx(pAd) - &&(pAd->Antenna.field.RxPath>1||pAd->Antenna.field.TxPath>1)) - { - RTMP_ASIC_MMPS_DISABLE(pAd); - } -#endif // RT30xx // - Frame.Psmp = 0; - break; - case MMPS_DYNAMIC: - Frame.Psmp = 3; - break; - case MMPS_STATIC: -#ifdef RT30xx - if (IS_RT30xx(pAd) - &&(pAd->Antenna.field.RxPath>1||pAd->Antenna.field.TxPath>1)) - { - RTMP_ASIC_MMPS_ENABLE(pAd); - } -#endif // RT30xx // - Frame.Psmp = 1; - break; - } - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_PSMP_ACTION), &Frame, - END_OF_ARGS); - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - DBGPRINT(RT_DEBUG_ERROR,("HT - SendPSMPAction( %d ) \n", Frame.Psmp)); -} - - -#define RADIO_MEASUREMENT_REQUEST_ACTION 0 - -typedef struct PACKED -{ - UCHAR RegulatoryClass; - UCHAR ChannelNumber; - USHORT RandomInterval; - USHORT MeasurementDuration; - UCHAR MeasurementMode; - UCHAR BSSID[MAC_ADDR_LEN]; - UCHAR ReportingCondition; - UCHAR Threshold; - UCHAR SSIDIE[2]; // 2 byte -} BEACON_REQUEST; - -typedef struct PACKED -{ - UCHAR ID; - UCHAR Length; - UCHAR Token; - UCHAR RequestMode; - UCHAR Type; -} MEASUREMENT_REQ; - - - - -void convert_reordering_packet_to_preAMSDU_or_802_3_packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) -{ - PNDIS_PACKET pRxPkt; - UCHAR Header802_3[LENGTH_802_3]; - - // 1. get 802.3 Header - // 2. remove LLC - // a. pointer pRxBlk->pData to payload - // b. modify pRxBlk->DataSize - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(pRxBlk, Header802_3); -#endif // CONFIG_STA_SUPPORT // - - ASSERT(pRxBlk->pRxPacket); - pRxPkt = RTPKT_TO_OSPKT(pRxBlk->pRxPacket); - - SET_OS_PKT_NETDEV(pRxPkt, get_netdev_from_bssid(pAd, FromWhichBSSID)); - SET_OS_PKT_DATAPTR(pRxPkt, pRxBlk->pData); - SET_OS_PKT_LEN(pRxPkt, pRxBlk->DataSize); - SET_OS_PKT_DATATAIL(pRxPkt, pRxBlk->pData, pRxBlk->DataSize); - - // - // copy 802.3 header, if necessary - // - if (!RX_BLK_TEST_FLAG(pRxBlk, fRX_AMSDU)) - { - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { -#ifdef LINUX - NdisMoveMemory(skb_push(pRxPkt, LENGTH_802_3), Header802_3, LENGTH_802_3); -#endif - } -#endif // CONFIG_STA_SUPPORT // - } -} - - -#define INDICATE_LEGACY_OR_AMSDU(_pAd, _pRxBlk, _fromWhichBSSID) \ - do \ - { \ - if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_AMSDU)) \ - { \ - Indicate_AMSDU_Packet(_pAd, _pRxBlk, _fromWhichBSSID); \ - } \ - else if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_EAP)) \ - { \ - Indicate_EAPOL_Packet(_pAd, _pRxBlk, _fromWhichBSSID); \ - } \ - else \ - { \ - Indicate_Legacy_Packet(_pAd, _pRxBlk, _fromWhichBSSID); \ - } \ - } while (0); - - - -static VOID ba_enqueue_reordering_packet( - IN PRTMP_ADAPTER pAd, - IN PBA_REC_ENTRY pBAEntry, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) -{ - struct reordering_mpdu *mpdu_blk; - UINT16 Sequence = (UINT16) pRxBlk->pHeader->Sequence; - - mpdu_blk = ba_mpdu_blk_alloc(pAd); - if ((mpdu_blk != NULL) && - (!RX_BLK_TEST_FLAG(pRxBlk, fRX_EAP))) - { - // Write RxD buffer address & allocated buffer length - NdisAcquireSpinLock(&pBAEntry->RxReRingLock); - - mpdu_blk->Sequence = Sequence; - - mpdu_blk->bAMSDU = RX_BLK_TEST_FLAG(pRxBlk, fRX_AMSDU); - - convert_reordering_packet_to_preAMSDU_or_802_3_packet(pAd, pRxBlk, FromWhichBSSID); - - STATS_INC_RX_PACKETS(pAd, FromWhichBSSID); - - // - // it is necessary for reordering packet to record - // which BSS it come from - // - RTMP_SET_PACKET_IF(pRxBlk->pRxPacket, FromWhichBSSID); - - mpdu_blk->pPacket = pRxBlk->pRxPacket; - - if (ba_reordering_mpdu_insertsorted(&pBAEntry->list, mpdu_blk) == FALSE) - { - // had been already within reordering list - // don't indicate - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_SUCCESS); - ba_mpdu_blk_free(pAd, mpdu_blk); - } - - ASSERT((0<= pBAEntry->list.qlen) && (pBAEntry->list.qlen <= pBAEntry->BAWinSize)); - NdisReleaseSpinLock(&pBAEntry->RxReRingLock); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("!!! (%d) Can't allocate reordering mpdu blk\n", - pBAEntry->list.qlen)); - /* - * flush all pending reordering mpdus - * and receving mpdu to upper layer - * make tcp/ip to take care reordering mechanism - */ - //ba_refresh_reordering_mpdus(pAd, pBAEntry); - ba_indicate_reordering_mpdus_le_seq(pAd, pBAEntry, Sequence); - - pBAEntry->LastIndSeq = Sequence; - INDICATE_LEGACY_OR_AMSDU(pAd, pRxBlk, FromWhichBSSID); - } -} - - -/* - ========================================================================== - Description: - Indicate this packet to upper layer or put it into reordering buffer - - Parametrs: - pRxBlk : carry necessary packet info 802.11 format - FromWhichBSSID : the packet received from which BSS - - Return : - none - - Note : - the packet queued into reordering buffer need to cover to 802.3 format - or pre_AMSDU format - ========================================================================== - */ - -VOID Indicate_AMPDU_Packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) -{ - USHORT Idx; - PBA_REC_ENTRY pBAEntry = NULL; - UINT16 Sequence = pRxBlk->pHeader->Sequence; - ULONG Now32; - UCHAR Wcid = pRxBlk->pRxWI->WirelessCliID; - UCHAR TID = pRxBlk->pRxWI->TID; - - - if (!RX_BLK_TEST_FLAG(pRxBlk, fRX_AMSDU) && (pRxBlk->DataSize > MAX_RX_PKT_LEN)) - { - // release packet - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); - return; - } - - - - if (Wcid < MAX_LEN_OF_MAC_TABLE) - { - Idx = pAd->MacTab.Content[Wcid].BARecWcidArray[TID]; - if (Idx == 0) - { - /* Rec BA Session had been torn down */ - INDICATE_LEGACY_OR_AMSDU(pAd, pRxBlk, FromWhichBSSID); - return; - } - pBAEntry = &pAd->BATable.BARecEntry[Idx]; - } - else - { - // impossible !!! - ASSERT(0); - // release packet - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); - return; - } - - ASSERT(pBAEntry); - - // update last rx time - NdisGetSystemUpTime(&Now32); - - pBAEntry->rcvSeq = Sequence; - - - ba_flush_reordering_timeout_mpdus(pAd, pBAEntry, Now32); - pBAEntry->LastIndSeqAtTimer = Now32; - - // - // Reset Last Indicate Sequence - // - if (pBAEntry->LastIndSeq == RESET_RCV_SEQ) - { - ASSERT((pBAEntry->list.qlen == 0) && (pBAEntry->list.next == NULL)); - - // reset rcv sequence of BA session - pBAEntry->LastIndSeq = Sequence; - pBAEntry->LastIndSeqAtTimer = Now32; - INDICATE_LEGACY_OR_AMSDU(pAd, pRxBlk, FromWhichBSSID); - return; - } - - // - // I. Check if in order. - // - if (SEQ_STEPONE(Sequence, pBAEntry->LastIndSeq, MAXSEQ)) - { - USHORT LastIndSeq; - - pBAEntry->LastIndSeq = Sequence; - INDICATE_LEGACY_OR_AMSDU(pAd, pRxBlk, FromWhichBSSID); - LastIndSeq = ba_indicate_reordering_mpdus_in_order(pAd, pBAEntry, pBAEntry->LastIndSeq); - if (LastIndSeq != RESET_RCV_SEQ) - { - pBAEntry->LastIndSeq = LastIndSeq; - } - pBAEntry->LastIndSeqAtTimer = Now32; - } - // - // II. Drop Duplicated Packet - // - else if (Sequence == pBAEntry->LastIndSeq) - { - - // drop and release packet - pBAEntry->nDropPacket++; - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); - } - // - // III. Drop Old Received Packet - // - else if (SEQ_SMALLER(Sequence, pBAEntry->LastIndSeq, MAXSEQ)) - { - - // drop and release packet - pBAEntry->nDropPacket++; - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); - } - // - // IV. Receive Sequence within Window Size - // - else if (SEQ_SMALLER(Sequence, (((pBAEntry->LastIndSeq+pBAEntry->BAWinSize+1)) & MAXSEQ), MAXSEQ)) - { - ba_enqueue_reordering_packet(pAd, pBAEntry, pRxBlk, FromWhichBSSID); - } - // - // V. Receive seq surpasses Win(lastseq + nMSDU). So refresh all reorder buffer - // - else - { - LONG WinStartSeq, TmpSeq; - - - TmpSeq = Sequence - (pBAEntry->BAWinSize) -1; - if (TmpSeq < 0) - { - TmpSeq = (MAXSEQ+1) + TmpSeq; - } - WinStartSeq = (TmpSeq+1) & MAXSEQ; - ba_indicate_reordering_mpdus_le_seq(pAd, pBAEntry, WinStartSeq); - pBAEntry->LastIndSeq = WinStartSeq; //TmpSeq; - - pBAEntry->LastIndSeqAtTimer = Now32; - - ba_enqueue_reordering_packet(pAd, pBAEntry, pRxBlk, FromWhichBSSID); - - TmpSeq = ba_indicate_reordering_mpdus_in_order(pAd, pBAEntry, pBAEntry->LastIndSeq); - if (TmpSeq != RESET_RCV_SEQ) - { - pBAEntry->LastIndSeq = TmpSeq; - } - } -} - -#endif // DOT11_N_SUPPORT // diff --git a/drivers/staging/rt3090/common/cmm_aes.c b/drivers/staging/rt3090/common/cmm_aes.c deleted file mode 100644 index 4ccbbbfe4cca..000000000000 --- a/drivers/staging/rt3090/common/cmm_aes.c +++ /dev/null @@ -1,1560 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - cmm_aes.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Paul Wu 02-25-02 Initial -*/ - -#include "../rt_config.h" - - -typedef struct -{ - UINT32 erk[64]; /* encryption round keys */ - UINT32 drk[64]; /* decryption round keys */ - int nr; /* number of rounds */ -} -aes_context; - -/*****************************/ -/******** SBOX Table *********/ -/*****************************/ - -UCHAR SboxTable[256] = -{ - 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, - 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, - 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, - 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, - 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, - 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, - 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, - 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, - 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, - 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, - 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, - 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, - 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, - 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, - 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, - 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, - 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, - 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, - 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, - 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, - 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, - 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, - 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, - 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, - 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, - 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, - 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, - 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, - 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, - 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, - 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, - 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 -}; - -VOID xor_32( - IN PUCHAR a, - IN PUCHAR b, - OUT PUCHAR out) -{ - INT i; - - for (i=0;i<4; i++) - { - out[i] = a[i] ^ b[i]; - } -} - -VOID xor_128( - IN PUCHAR a, - IN PUCHAR b, - OUT PUCHAR out) -{ - INT i; - - for (i=0;i<16; i++) - { - out[i] = a[i] ^ b[i]; - } -} - -UCHAR RTMPCkipSbox( - IN UCHAR a) -{ - return SboxTable[(int)a]; -} - -VOID next_key( - IN PUCHAR key, - IN INT round) -{ - UCHAR rcon; - UCHAR sbox_key[4]; - UCHAR rcon_table[12] = - { - 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, - 0x1b, 0x36, 0x36, 0x36 - }; - - sbox_key[0] = RTMPCkipSbox(key[13]); - sbox_key[1] = RTMPCkipSbox(key[14]); - sbox_key[2] = RTMPCkipSbox(key[15]); - sbox_key[3] = RTMPCkipSbox(key[12]); - - rcon = rcon_table[round]; - - xor_32(&key[0], sbox_key, &key[0]); - key[0] = key[0] ^ rcon; - - xor_32(&key[4], &key[0], &key[4]); - xor_32(&key[8], &key[4], &key[8]); - xor_32(&key[12], &key[8], &key[12]); -} - -VOID byte_sub( - IN PUCHAR in, - OUT PUCHAR out) -{ - INT i; - - for (i=0; i< 16; i++) - { - out[i] = RTMPCkipSbox(in[i]); - } -} - -/************************************/ -/* bitwise_xor() */ -/* A 128 bit, bitwise exclusive or */ -/************************************/ - -void bitwise_xor(unsigned char *ina, unsigned char *inb, unsigned char *out) -{ - int i; - for (i=0; i<16; i++) - { - out[i] = ina[i] ^ inb[i]; - } -} - -VOID shift_row( - IN PUCHAR in, - OUT PUCHAR out) -{ - out[0] = in[0]; - out[1] = in[5]; - out[2] = in[10]; - out[3] = in[15]; - out[4] = in[4]; - out[5] = in[9]; - out[6] = in[14]; - out[7] = in[3]; - out[8] = in[8]; - out[9] = in[13]; - out[10] = in[2]; - out[11] = in[7]; - out[12] = in[12]; - out[13] = in[1]; - out[14] = in[6]; - out[15] = in[11]; -} - -VOID mix_column( - IN PUCHAR in, - OUT PUCHAR out) -{ - INT i; - UCHAR add1b[4]; - UCHAR add1bf7[4]; - UCHAR rotl[4]; - UCHAR swap_halfs[4]; - UCHAR andf7[4]; - UCHAR rotr[4]; - UCHAR temp[4]; - UCHAR tempb[4]; - - for (i=0 ; i<4; i++) - { - if ((in[i] & 0x80)== 0x80) - add1b[i] = 0x1b; - else - add1b[i] = 0x00; - } - - swap_halfs[0] = in[2]; /* Swap halfs */ - swap_halfs[1] = in[3]; - swap_halfs[2] = in[0]; - swap_halfs[3] = in[1]; - - rotl[0] = in[3]; /* Rotate left 8 bits */ - rotl[1] = in[0]; - rotl[2] = in[1]; - rotl[3] = in[2]; - - andf7[0] = in[0] & 0x7f; - andf7[1] = in[1] & 0x7f; - andf7[2] = in[2] & 0x7f; - andf7[3] = in[3] & 0x7f; - - for (i = 3; i>0; i--) /* logical shift left 1 bit */ - { - andf7[i] = andf7[i] << 1; - if ((andf7[i-1] & 0x80) == 0x80) - { - andf7[i] = (andf7[i] | 0x01); - } - } - andf7[0] = andf7[0] << 1; - andf7[0] = andf7[0] & 0xfe; - - xor_32(add1b, andf7, add1bf7); - - xor_32(in, add1bf7, rotr); - - temp[0] = rotr[0]; /* Rotate right 8 bits */ - rotr[0] = rotr[1]; - rotr[1] = rotr[2]; - rotr[2] = rotr[3]; - rotr[3] = temp[0]; - - xor_32(add1bf7, rotr, temp); - xor_32(swap_halfs, rotl,tempb); - xor_32(temp, tempb, out); -} - - -/************************************************/ -/* construct_mic_header1() */ -/* Builds the first MIC header block from */ -/* header fields. */ -/************************************************/ - -void construct_mic_header1( - unsigned char *mic_header1, - int header_length, - unsigned char *mpdu) -{ - mic_header1[0] = (unsigned char)((header_length - 2) / 256); - mic_header1[1] = (unsigned char)((header_length - 2) % 256); - mic_header1[2] = mpdu[0] & 0xcf; /* Mute CF poll & CF ack bits */ - mic_header1[3] = mpdu[1] & 0xc7; /* Mute retry, more data and pwr mgt bits */ - mic_header1[4] = mpdu[4]; /* A1 */ - mic_header1[5] = mpdu[5]; - mic_header1[6] = mpdu[6]; - mic_header1[7] = mpdu[7]; - mic_header1[8] = mpdu[8]; - mic_header1[9] = mpdu[9]; - mic_header1[10] = mpdu[10]; /* A2 */ - mic_header1[11] = mpdu[11]; - mic_header1[12] = mpdu[12]; - mic_header1[13] = mpdu[13]; - mic_header1[14] = mpdu[14]; - mic_header1[15] = mpdu[15]; -} - -/************************************************/ -/* construct_mic_header2() */ -/* Builds the last MIC header block from */ -/* header fields. */ -/************************************************/ - -void construct_mic_header2( - unsigned char *mic_header2, - unsigned char *mpdu, - int a4_exists, - int qc_exists) -{ - int i; - - for (i = 0; i<16; i++) mic_header2[i]=0x00; - - mic_header2[0] = mpdu[16]; /* A3 */ - mic_header2[1] = mpdu[17]; - mic_header2[2] = mpdu[18]; - mic_header2[3] = mpdu[19]; - mic_header2[4] = mpdu[20]; - mic_header2[5] = mpdu[21]; - - // In Sequence Control field, mute sequence numer bits (12-bit) - mic_header2[6] = mpdu[22] & 0x0f; /* SC */ - mic_header2[7] = 0x00; /* mpdu[23]; */ - - if ((!qc_exists) & a4_exists) - { - for (i=0;i<6;i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ - - } - - if (qc_exists && (!a4_exists)) - { - mic_header2[8] = mpdu[24] & 0x0f; /* mute bits 15 - 4 */ - mic_header2[9] = mpdu[25] & 0x00; - } - - if (qc_exists && a4_exists) - { - for (i=0;i<6;i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ - - mic_header2[14] = mpdu[30] & 0x0f; - mic_header2[15] = mpdu[31] & 0x00; - } -} - - -/************************************************/ -/* construct_mic_iv() */ -/* Builds the MIC IV from header fields and PN */ -/************************************************/ - -void construct_mic_iv( - unsigned char *mic_iv, - int qc_exists, - int a4_exists, - unsigned char *mpdu, - unsigned int payload_length, - unsigned char *pn_vector) -{ - int i; - - mic_iv[0] = 0x59; - if (qc_exists && a4_exists) - mic_iv[1] = mpdu[30] & 0x0f; /* QoS_TC */ - if (qc_exists && !a4_exists) - mic_iv[1] = mpdu[24] & 0x0f; /* mute bits 7-4 */ - if (!qc_exists) - mic_iv[1] = 0x00; - for (i = 2; i < 8; i++) - mic_iv[i] = mpdu[i + 8]; /* mic_iv[2:7] = A2[0:5] = mpdu[10:15] */ -#ifdef CONSISTENT_PN_ORDER - for (i = 8; i < 14; i++) - mic_iv[i] = pn_vector[i - 8]; /* mic_iv[8:13] = PN[0:5] */ -#else - for (i = 8; i < 14; i++) - mic_iv[i] = pn_vector[13 - i]; /* mic_iv[8:13] = PN[5:0] */ -#endif - i = (payload_length / 256); - i = (payload_length % 256); - mic_iv[14] = (unsigned char) (payload_length / 256); - mic_iv[15] = (unsigned char) (payload_length % 256); - -} - -/****************************************/ -/* aes128k128d() */ -/* Performs a 128 bit AES encrypt with */ -/* 128 bit data. */ -/****************************************/ -void aes128k128d(unsigned char *key, unsigned char *data, unsigned char *ciphertext) -{ - int round; - int i; - unsigned char intermediatea[16]; - unsigned char intermediateb[16]; - unsigned char round_key[16]; - - for(i=0; i<16; i++) round_key[i] = key[i]; - - for (round = 0; round < 11; round++) - { - if (round == 0) - { - xor_128(round_key, data, ciphertext); - next_key(round_key, round); - } - else if (round == 10) - { - byte_sub(ciphertext, intermediatea); - shift_row(intermediatea, intermediateb); - xor_128(intermediateb, round_key, ciphertext); - } - else /* 1 - 9 */ - { - byte_sub(ciphertext, intermediatea); - shift_row(intermediatea, intermediateb); - mix_column(&intermediateb[0], &intermediatea[0]); - mix_column(&intermediateb[4], &intermediatea[4]); - mix_column(&intermediateb[8], &intermediatea[8]); - mix_column(&intermediateb[12], &intermediatea[12]); - xor_128(intermediatea, round_key, ciphertext); - next_key(round_key, round); - } - } - -} - -void construct_ctr_preload( - unsigned char *ctr_preload, - int a4_exists, - int qc_exists, - unsigned char *mpdu, - unsigned char *pn_vector, - int c) -{ - - int i = 0; - for (i=0; i<16; i++) ctr_preload[i] = 0x00; - i = 0; - - ctr_preload[0] = 0x01; /* flag */ - if (qc_exists && a4_exists) ctr_preload[1] = mpdu[30] & 0x0f; /* QoC_Control */ - if (qc_exists && !a4_exists) ctr_preload[1] = mpdu[24] & 0x0f; - - for (i = 2; i < 8; i++) - ctr_preload[i] = mpdu[i + 8]; /* ctr_preload[2:7] = A2[0:5] = mpdu[10:15] */ -#ifdef CONSISTENT_PN_ORDER - for (i = 8; i < 14; i++) - ctr_preload[i] = pn_vector[i - 8]; /* ctr_preload[8:13] = PN[0:5] */ -#else - for (i = 8; i < 14; i++) - ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */ -#endif - ctr_preload[14] = (unsigned char) (c / 256); // Ctr - ctr_preload[15] = (unsigned char) (c % 256); - -} - -BOOLEAN RTMPSoftDecryptAES( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, - IN PCIPHER_KEY pWpaKey) -{ - UCHAR KeyID; - UINT HeaderLen; - UCHAR PN[6]; - UINT payload_len; - UINT num_blocks; - UINT payload_remainder; - USHORT fc; - UCHAR fc0; - UCHAR fc1; - UINT frame_type; - UINT frame_subtype; - UINT from_ds; - UINT to_ds; - INT a4_exists; - INT qc_exists; - UCHAR aes_out[16]; - int payload_index; - UINT i; - UCHAR ctr_preload[16]; - UCHAR chain_buffer[16]; - UCHAR padded_buffer[16]; - UCHAR mic_iv[16]; - UCHAR mic_header1[16]; - UCHAR mic_header2[16]; - UCHAR MIC[8]; - UCHAR TrailMIC[8]; - -#ifdef RT_BIG_ENDIAN - RTMPFrameEndianChange(pAd, (PUCHAR)pData, DIR_READ, FALSE); -#endif - - fc0 = *pData; - fc1 = *(pData + 1); - - fc = *((PUSHORT)pData); - - frame_type = ((fc0 >> 2) & 0x03); - frame_subtype = ((fc0 >> 4) & 0x0f); - - from_ds = (fc1 & 0x2) >> 1; - to_ds = (fc1 & 0x1); - - a4_exists = (from_ds & to_ds); - qc_exists = ((frame_subtype == 0x08) || /* Assumed QoS subtypes */ - (frame_subtype == 0x09) || /* Likely to change. */ - (frame_subtype == 0x0a) || - (frame_subtype == 0x0b) - ); - - HeaderLen = 24; - if (a4_exists) - HeaderLen += 6; - - KeyID = *((PUCHAR)(pData+ HeaderLen + 3)); - KeyID = KeyID >> 6; - - if (pWpaKey[KeyID].KeyLen == 0) - { - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSoftDecryptAES failed!(KeyID[%d] Length can not be 0)\n", KeyID)); - return FALSE; - } - - PN[0] = *(pData+ HeaderLen); - PN[1] = *(pData+ HeaderLen + 1); - PN[2] = *(pData+ HeaderLen + 4); - PN[3] = *(pData+ HeaderLen + 5); - PN[4] = *(pData+ HeaderLen + 6); - PN[5] = *(pData+ HeaderLen + 7); - - payload_len = DataByteCnt - HeaderLen - 8 - 8; // 8 bytes for CCMP header , 8 bytes for MIC - payload_remainder = (payload_len) % 16; - num_blocks = (payload_len) / 16; - - - - // Find start of payload - payload_index = HeaderLen + 8; //IV+EIV - - for (i=0; i< num_blocks; i++) - { - construct_ctr_preload(ctr_preload, - a4_exists, - qc_exists, - pData, - PN, - i+1 ); - - aes128k128d(pWpaKey[KeyID].Key, ctr_preload, aes_out); - - bitwise_xor(aes_out, pData + payload_index, chain_buffer); - NdisMoveMemory(pData + payload_index - 8, chain_buffer, 16); - payload_index += 16; - } - - // - // If there is a short final block, then pad it - // encrypt it and copy the unpadded part back - // - if (payload_remainder > 0) - { - construct_ctr_preload(ctr_preload, - a4_exists, - qc_exists, - pData, - PN, - num_blocks + 1); - - NdisZeroMemory(padded_buffer, 16); - NdisMoveMemory(padded_buffer, pData + payload_index, payload_remainder); - - aes128k128d(pWpaKey[KeyID].Key, ctr_preload, aes_out); - - bitwise_xor(aes_out, padded_buffer, chain_buffer); - NdisMoveMemory(pData + payload_index - 8, chain_buffer, payload_remainder); - payload_index += payload_remainder; - } - - // - // Descrypt the MIC - // - construct_ctr_preload(ctr_preload, - a4_exists, - qc_exists, - pData, - PN, - 0); - NdisZeroMemory(padded_buffer, 16); - NdisMoveMemory(padded_buffer, pData + payload_index, 8); - - aes128k128d(pWpaKey[KeyID].Key, ctr_preload, aes_out); - - bitwise_xor(aes_out, padded_buffer, chain_buffer); - - NdisMoveMemory(TrailMIC, chain_buffer, 8); - - - // - // Calculate MIC - // - - //Force the protected frame bit on - *(pData + 1) = *(pData + 1) | 0x40; - - // Find start of payload - // Because the CCMP header has been removed - payload_index = HeaderLen; - - construct_mic_iv( - mic_iv, - qc_exists, - a4_exists, - pData, - payload_len, - PN); - - construct_mic_header1( - mic_header1, - HeaderLen, - pData); - - construct_mic_header2( - mic_header2, - pData, - a4_exists, - qc_exists); - - aes128k128d(pWpaKey[KeyID].Key, mic_iv, aes_out); - bitwise_xor(aes_out, mic_header1, chain_buffer); - aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); - bitwise_xor(aes_out, mic_header2, chain_buffer); - aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); - - // iterate through each 16 byte payload block - for (i = 0; i < num_blocks; i++) - { - bitwise_xor(aes_out, pData + payload_index, chain_buffer); - payload_index += 16; - aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); - } - - // Add on the final payload block if it needs padding - if (payload_remainder > 0) - { - NdisZeroMemory(padded_buffer, 16); - NdisMoveMemory(padded_buffer, pData + payload_index, payload_remainder); - - bitwise_xor(aes_out, padded_buffer, chain_buffer); - aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); - } - - // aes_out contains padded mic, discard most significant - // 8 bytes to generate 64 bit MIC - for (i = 0 ; i < 8; i++) MIC[i] = aes_out[i]; - - if (!NdisEqualMemory(MIC, TrailMIC, 8)) - { - DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptAES, MIC Error !\n")); //MIC error. - return FALSE; - } - -#ifdef RT_BIG_ENDIAN - RTMPFrameEndianChange(pAd, (PUCHAR)pData, DIR_READ, FALSE); -#endif - - return TRUE; -} - -/* ========================= AES En/Decryption ========================== */ -#ifndef uint8 -#define uint8 unsigned char -#endif - -#ifndef uint32 -#define uint32 unsigned int -#endif - -/* forward S-box */ -static uint32 FSb[256] = -{ - 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, - 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76, - 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, - 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0, - 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, - 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15, - 0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, - 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75, - 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, - 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84, - 0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, - 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF, - 0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, - 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8, - 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, - 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2, - 0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, - 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73, - 0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, - 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB, - 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, - 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79, - 0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, - 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08, - 0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, - 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A, - 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, - 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E, - 0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, - 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF, - 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, - 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16 -}; - -/* forward table */ -#define FT \ -\ - V(C6,63,63,A5), V(F8,7C,7C,84), V(EE,77,77,99), V(F6,7B,7B,8D), \ - V(FF,F2,F2,0D), V(D6,6B,6B,BD), V(DE,6F,6F,B1), V(91,C5,C5,54), \ - V(60,30,30,50), V(02,01,01,03), V(CE,67,67,A9), V(56,2B,2B,7D), \ - V(E7,FE,FE,19), V(B5,D7,D7,62), V(4D,AB,AB,E6), V(EC,76,76,9A), \ - V(8F,CA,CA,45), V(1F,82,82,9D), V(89,C9,C9,40), V(FA,7D,7D,87), \ - V(EF,FA,FA,15), V(B2,59,59,EB), V(8E,47,47,C9), V(FB,F0,F0,0B), \ - V(41,AD,AD,EC), V(B3,D4,D4,67), V(5F,A2,A2,FD), V(45,AF,AF,EA), \ - V(23,9C,9C,BF), V(53,A4,A4,F7), V(E4,72,72,96), V(9B,C0,C0,5B), \ - V(75,B7,B7,C2), V(E1,FD,FD,1C), V(3D,93,93,AE), V(4C,26,26,6A), \ - V(6C,36,36,5A), V(7E,3F,3F,41), V(F5,F7,F7,02), V(83,CC,CC,4F), \ - V(68,34,34,5C), V(51,A5,A5,F4), V(D1,E5,E5,34), V(F9,F1,F1,08), \ - V(E2,71,71,93), V(AB,D8,D8,73), V(62,31,31,53), V(2A,15,15,3F), \ - V(08,04,04,0C), V(95,C7,C7,52), V(46,23,23,65), V(9D,C3,C3,5E), \ - V(30,18,18,28), V(37,96,96,A1), V(0A,05,05,0F), V(2F,9A,9A,B5), \ - V(0E,07,07,09), V(24,12,12,36), V(1B,80,80,9B), V(DF,E2,E2,3D), \ - V(CD,EB,EB,26), V(4E,27,27,69), V(7F,B2,B2,CD), V(EA,75,75,9F), \ - V(12,09,09,1B), V(1D,83,83,9E), V(58,2C,2C,74), V(34,1A,1A,2E), \ - V(36,1B,1B,2D), V(DC,6E,6E,B2), V(B4,5A,5A,EE), V(5B,A0,A0,FB), \ - V(A4,52,52,F6), V(76,3B,3B,4D), V(B7,D6,D6,61), V(7D,B3,B3,CE), \ - V(52,29,29,7B), V(DD,E3,E3,3E), V(5E,2F,2F,71), V(13,84,84,97), \ - V(A6,53,53,F5), V(B9,D1,D1,68), V(00,00,00,00), V(C1,ED,ED,2C), \ - V(40,20,20,60), V(E3,FC,FC,1F), V(79,B1,B1,C8), V(B6,5B,5B,ED), \ - V(D4,6A,6A,BE), V(8D,CB,CB,46), V(67,BE,BE,D9), V(72,39,39,4B), \ - V(94,4A,4A,DE), V(98,4C,4C,D4), V(B0,58,58,E8), V(85,CF,CF,4A), \ - V(BB,D0,D0,6B), V(C5,EF,EF,2A), V(4F,AA,AA,E5), V(ED,FB,FB,16), \ - V(86,43,43,C5), V(9A,4D,4D,D7), V(66,33,33,55), V(11,85,85,94), \ - V(8A,45,45,CF), V(E9,F9,F9,10), V(04,02,02,06), V(FE,7F,7F,81), \ - V(A0,50,50,F0), V(78,3C,3C,44), V(25,9F,9F,BA), V(4B,A8,A8,E3), \ - V(A2,51,51,F3), V(5D,A3,A3,FE), V(80,40,40,C0), V(05,8F,8F,8A), \ - V(3F,92,92,AD), V(21,9D,9D,BC), V(70,38,38,48), V(F1,F5,F5,04), \ - V(63,BC,BC,DF), V(77,B6,B6,C1), V(AF,DA,DA,75), V(42,21,21,63), \ - V(20,10,10,30), V(E5,FF,FF,1A), V(FD,F3,F3,0E), V(BF,D2,D2,6D), \ - V(81,CD,CD,4C), V(18,0C,0C,14), V(26,13,13,35), V(C3,EC,EC,2F), \ - V(BE,5F,5F,E1), V(35,97,97,A2), V(88,44,44,CC), V(2E,17,17,39), \ - V(93,C4,C4,57), V(55,A7,A7,F2), V(FC,7E,7E,82), V(7A,3D,3D,47), \ - V(C8,64,64,AC), V(BA,5D,5D,E7), V(32,19,19,2B), V(E6,73,73,95), \ - V(C0,60,60,A0), V(19,81,81,98), V(9E,4F,4F,D1), V(A3,DC,DC,7F), \ - V(44,22,22,66), V(54,2A,2A,7E), V(3B,90,90,AB), V(0B,88,88,83), \ - V(8C,46,46,CA), V(C7,EE,EE,29), V(6B,B8,B8,D3), V(28,14,14,3C), \ - V(A7,DE,DE,79), V(BC,5E,5E,E2), V(16,0B,0B,1D), V(AD,DB,DB,76), \ - V(DB,E0,E0,3B), V(64,32,32,56), V(74,3A,3A,4E), V(14,0A,0A,1E), \ - V(92,49,49,DB), V(0C,06,06,0A), V(48,24,24,6C), V(B8,5C,5C,E4), \ - V(9F,C2,C2,5D), V(BD,D3,D3,6E), V(43,AC,AC,EF), V(C4,62,62,A6), \ - V(39,91,91,A8), V(31,95,95,A4), V(D3,E4,E4,37), V(F2,79,79,8B), \ - V(D5,E7,E7,32), V(8B,C8,C8,43), V(6E,37,37,59), V(DA,6D,6D,B7), \ - V(01,8D,8D,8C), V(B1,D5,D5,64), V(9C,4E,4E,D2), V(49,A9,A9,E0), \ - V(D8,6C,6C,B4), V(AC,56,56,FA), V(F3,F4,F4,07), V(CF,EA,EA,25), \ - V(CA,65,65,AF), V(F4,7A,7A,8E), V(47,AE,AE,E9), V(10,08,08,18), \ - V(6F,BA,BA,D5), V(F0,78,78,88), V(4A,25,25,6F), V(5C,2E,2E,72), \ - V(38,1C,1C,24), V(57,A6,A6,F1), V(73,B4,B4,C7), V(97,C6,C6,51), \ - V(CB,E8,E8,23), V(A1,DD,DD,7C), V(E8,74,74,9C), V(3E,1F,1F,21), \ - V(96,4B,4B,DD), V(61,BD,BD,DC), V(0D,8B,8B,86), V(0F,8A,8A,85), \ - V(E0,70,70,90), V(7C,3E,3E,42), V(71,B5,B5,C4), V(CC,66,66,AA), \ - V(90,48,48,D8), V(06,03,03,05), V(F7,F6,F6,01), V(1C,0E,0E,12), \ - V(C2,61,61,A3), V(6A,35,35,5F), V(AE,57,57,F9), V(69,B9,B9,D0), \ - V(17,86,86,91), V(99,C1,C1,58), V(3A,1D,1D,27), V(27,9E,9E,B9), \ - V(D9,E1,E1,38), V(EB,F8,F8,13), V(2B,98,98,B3), V(22,11,11,33), \ - V(D2,69,69,BB), V(A9,D9,D9,70), V(07,8E,8E,89), V(33,94,94,A7), \ - V(2D,9B,9B,B6), V(3C,1E,1E,22), V(15,87,87,92), V(C9,E9,E9,20), \ - V(87,CE,CE,49), V(AA,55,55,FF), V(50,28,28,78), V(A5,DF,DF,7A), \ - V(03,8C,8C,8F), V(59,A1,A1,F8), V(09,89,89,80), V(1A,0D,0D,17), \ - V(65,BF,BF,DA), V(D7,E6,E6,31), V(84,42,42,C6), V(D0,68,68,B8), \ - V(82,41,41,C3), V(29,99,99,B0), V(5A,2D,2D,77), V(1E,0F,0F,11), \ - V(7B,B0,B0,CB), V(A8,54,54,FC), V(6D,BB,BB,D6), V(2C,16,16,3A) - -#define V(a,b,c,d) 0x##a##b##c##d -static uint32 FT0[256] = { FT }; -#undef V - -#define V(a,b,c,d) 0x##d##a##b##c -static uint32 FT1[256] = { FT }; -#undef V - -#define V(a,b,c,d) 0x##c##d##a##b -static uint32 FT2[256] = { FT }; -#undef V - -#define V(a,b,c,d) 0x##b##c##d##a -static uint32 FT3[256] = { FT }; -#undef V - -#undef FT - -/* reverse S-box */ - -static uint32 RSb[256] = -{ - 0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, - 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB, - 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, - 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB, - 0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, - 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E, - 0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, - 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25, - 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, - 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92, - 0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, - 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84, - 0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, - 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06, - 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, - 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B, - 0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, - 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73, - 0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, - 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E, - 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, - 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B, - 0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, - 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4, - 0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, - 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F, - 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, - 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF, - 0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, - 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61, - 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, - 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D -}; - -/* reverse table */ - -#define RT \ -\ - V(51,F4,A7,50), V(7E,41,65,53), V(1A,17,A4,C3), V(3A,27,5E,96), \ - V(3B,AB,6B,CB), V(1F,9D,45,F1), V(AC,FA,58,AB), V(4B,E3,03,93), \ - V(20,30,FA,55), V(AD,76,6D,F6), V(88,CC,76,91), V(F5,02,4C,25), \ - V(4F,E5,D7,FC), V(C5,2A,CB,D7), V(26,35,44,80), V(B5,62,A3,8F), \ - V(DE,B1,5A,49), V(25,BA,1B,67), V(45,EA,0E,98), V(5D,FE,C0,E1), \ - V(C3,2F,75,02), V(81,4C,F0,12), V(8D,46,97,A3), V(6B,D3,F9,C6), \ - V(03,8F,5F,E7), V(15,92,9C,95), V(BF,6D,7A,EB), V(95,52,59,DA), \ - V(D4,BE,83,2D), V(58,74,21,D3), V(49,E0,69,29), V(8E,C9,C8,44), \ - V(75,C2,89,6A), V(F4,8E,79,78), V(99,58,3E,6B), V(27,B9,71,DD), \ - V(BE,E1,4F,B6), V(F0,88,AD,17), V(C9,20,AC,66), V(7D,CE,3A,B4), \ - V(63,DF,4A,18), V(E5,1A,31,82), V(97,51,33,60), V(62,53,7F,45), \ - V(B1,64,77,E0), V(BB,6B,AE,84), V(FE,81,A0,1C), V(F9,08,2B,94), \ - V(70,48,68,58), V(8F,45,FD,19), V(94,DE,6C,87), V(52,7B,F8,B7), \ - V(AB,73,D3,23), V(72,4B,02,E2), V(E3,1F,8F,57), V(66,55,AB,2A), \ - V(B2,EB,28,07), V(2F,B5,C2,03), V(86,C5,7B,9A), V(D3,37,08,A5), \ - V(30,28,87,F2), V(23,BF,A5,B2), V(02,03,6A,BA), V(ED,16,82,5C), \ - V(8A,CF,1C,2B), V(A7,79,B4,92), V(F3,07,F2,F0), V(4E,69,E2,A1), \ - V(65,DA,F4,CD), V(06,05,BE,D5), V(D1,34,62,1F), V(C4,A6,FE,8A), \ - V(34,2E,53,9D), V(A2,F3,55,A0), V(05,8A,E1,32), V(A4,F6,EB,75), \ - V(0B,83,EC,39), V(40,60,EF,AA), V(5E,71,9F,06), V(BD,6E,10,51), \ - V(3E,21,8A,F9), V(96,DD,06,3D), V(DD,3E,05,AE), V(4D,E6,BD,46), \ - V(91,54,8D,B5), V(71,C4,5D,05), V(04,06,D4,6F), V(60,50,15,FF), \ - V(19,98,FB,24), V(D6,BD,E9,97), V(89,40,43,CC), V(67,D9,9E,77), \ - V(B0,E8,42,BD), V(07,89,8B,88), V(E7,19,5B,38), V(79,C8,EE,DB), \ - V(A1,7C,0A,47), V(7C,42,0F,E9), V(F8,84,1E,C9), V(00,00,00,00), \ - V(09,80,86,83), V(32,2B,ED,48), V(1E,11,70,AC), V(6C,5A,72,4E), \ - V(FD,0E,FF,FB), V(0F,85,38,56), V(3D,AE,D5,1E), V(36,2D,39,27), \ - V(0A,0F,D9,64), V(68,5C,A6,21), V(9B,5B,54,D1), V(24,36,2E,3A), \ - V(0C,0A,67,B1), V(93,57,E7,0F), V(B4,EE,96,D2), V(1B,9B,91,9E), \ - V(80,C0,C5,4F), V(61,DC,20,A2), V(5A,77,4B,69), V(1C,12,1A,16), \ - V(E2,93,BA,0A), V(C0,A0,2A,E5), V(3C,22,E0,43), V(12,1B,17,1D), \ - V(0E,09,0D,0B), V(F2,8B,C7,AD), V(2D,B6,A8,B9), V(14,1E,A9,C8), \ - V(57,F1,19,85), V(AF,75,07,4C), V(EE,99,DD,BB), V(A3,7F,60,FD), \ - V(F7,01,26,9F), V(5C,72,F5,BC), V(44,66,3B,C5), V(5B,FB,7E,34), \ - V(8B,43,29,76), V(CB,23,C6,DC), V(B6,ED,FC,68), V(B8,E4,F1,63), \ - V(D7,31,DC,CA), V(42,63,85,10), V(13,97,22,40), V(84,C6,11,20), \ - V(85,4A,24,7D), V(D2,BB,3D,F8), V(AE,F9,32,11), V(C7,29,A1,6D), \ - V(1D,9E,2F,4B), V(DC,B2,30,F3), V(0D,86,52,EC), V(77,C1,E3,D0), \ - V(2B,B3,16,6C), V(A9,70,B9,99), V(11,94,48,FA), V(47,E9,64,22), \ - V(A8,FC,8C,C4), V(A0,F0,3F,1A), V(56,7D,2C,D8), V(22,33,90,EF), \ - V(87,49,4E,C7), V(D9,38,D1,C1), V(8C,CA,A2,FE), V(98,D4,0B,36), \ - V(A6,F5,81,CF), V(A5,7A,DE,28), V(DA,B7,8E,26), V(3F,AD,BF,A4), \ - V(2C,3A,9D,E4), V(50,78,92,0D), V(6A,5F,CC,9B), V(54,7E,46,62), \ - V(F6,8D,13,C2), V(90,D8,B8,E8), V(2E,39,F7,5E), V(82,C3,AF,F5), \ - V(9F,5D,80,BE), V(69,D0,93,7C), V(6F,D5,2D,A9), V(CF,25,12,B3), \ - V(C8,AC,99,3B), V(10,18,7D,A7), V(E8,9C,63,6E), V(DB,3B,BB,7B), \ - V(CD,26,78,09), V(6E,59,18,F4), V(EC,9A,B7,01), V(83,4F,9A,A8), \ - V(E6,95,6E,65), V(AA,FF,E6,7E), V(21,BC,CF,08), V(EF,15,E8,E6), \ - V(BA,E7,9B,D9), V(4A,6F,36,CE), V(EA,9F,09,D4), V(29,B0,7C,D6), \ - V(31,A4,B2,AF), V(2A,3F,23,31), V(C6,A5,94,30), V(35,A2,66,C0), \ - V(74,4E,BC,37), V(FC,82,CA,A6), V(E0,90,D0,B0), V(33,A7,D8,15), \ - V(F1,04,98,4A), V(41,EC,DA,F7), V(7F,CD,50,0E), V(17,91,F6,2F), \ - V(76,4D,D6,8D), V(43,EF,B0,4D), V(CC,AA,4D,54), V(E4,96,04,DF), \ - V(9E,D1,B5,E3), V(4C,6A,88,1B), V(C1,2C,1F,B8), V(46,65,51,7F), \ - V(9D,5E,EA,04), V(01,8C,35,5D), V(FA,87,74,73), V(FB,0B,41,2E), \ - V(B3,67,1D,5A), V(92,DB,D2,52), V(E9,10,56,33), V(6D,D6,47,13), \ - V(9A,D7,61,8C), V(37,A1,0C,7A), V(59,F8,14,8E), V(EB,13,3C,89), \ - V(CE,A9,27,EE), V(B7,61,C9,35), V(E1,1C,E5,ED), V(7A,47,B1,3C), \ - V(9C,D2,DF,59), V(55,F2,73,3F), V(18,14,CE,79), V(73,C7,37,BF), \ - V(53,F7,CD,EA), V(5F,FD,AA,5B), V(DF,3D,6F,14), V(78,44,DB,86), \ - V(CA,AF,F3,81), V(B9,68,C4,3E), V(38,24,34,2C), V(C2,A3,40,5F), \ - V(16,1D,C3,72), V(BC,E2,25,0C), V(28,3C,49,8B), V(FF,0D,95,41), \ - V(39,A8,01,71), V(08,0C,B3,DE), V(D8,B4,E4,9C), V(64,56,C1,90), \ - V(7B,CB,84,61), V(D5,32,B6,70), V(48,6C,5C,74), V(D0,B8,57,42) - -#define V(a,b,c,d) 0x##a##b##c##d -static uint32 RT0[256] = { RT }; -#undef V - -#define V(a,b,c,d) 0x##d##a##b##c -static uint32 RT1[256] = { RT }; -#undef V - -#define V(a,b,c,d) 0x##c##d##a##b -static uint32 RT2[256] = { RT }; -#undef V - -#define V(a,b,c,d) 0x##b##c##d##a -static uint32 RT3[256] = { RT }; -#undef V - -#undef RT - -/* round constants */ - -static uint32 RCON[10] = -{ - 0x01000000, 0x02000000, 0x04000000, 0x08000000, - 0x10000000, 0x20000000, 0x40000000, 0x80000000, - 0x1B000000, 0x36000000 -}; - -/* key schedule tables */ - -static int KT_init = 1; - -static uint32 KT0[256]; -static uint32 KT1[256]; -static uint32 KT2[256]; -static uint32 KT3[256]; - -/* platform-independant 32-bit integer manipulation macros */ - -#define GET_UINT32(n,b,i) \ -{ \ - (n) = ( (uint32) (b)[(i) ] << 24 ) \ - | ( (uint32) (b)[(i) + 1] << 16 ) \ - | ( (uint32) (b)[(i) + 2] << 8 ) \ - | ( (uint32) (b)[(i) + 3] ); \ -} - -#define PUT_UINT32(n,b,i) \ -{ \ - (b)[(i) ] = (uint8) ( (n) >> 24 ); \ - (b)[(i) + 1] = (uint8) ( (n) >> 16 ); \ - (b)[(i) + 2] = (uint8) ( (n) >> 8 ); \ - (b)[(i) + 3] = (uint8) ( (n) ); \ -} - - -int rt_aes_set_key( aes_context *ctx, uint8 *key, int nbits ) -{ - int i; - uint32 *RK, *SK; - - switch( nbits ) - { - case 128: ctx->nr = 10; break; - case 192: ctx->nr = 12; break; - case 256: ctx->nr = 14; break; - default : return( 1 ); - } - - RK = (uint32 *) ctx->erk; - - for( i = 0; i < (nbits >> 5); i++ ) - { - GET_UINT32( RK[i], key, i * 4 ); - } - - /* setup encryption round keys */ - - switch( nbits ) - { - case 128: - - for( i = 0; i < 10; i++, RK += 4 ) - { - RK[4] = RK[0] ^ RCON[i] ^ - ( FSb[ (uint8) ( RK[3] >> 16 ) ] << 24 ) ^ - ( FSb[ (uint8) ( RK[3] >> 8 ) ] << 16 ) ^ - ( FSb[ (uint8) ( RK[3] ) ] << 8 ) ^ - ( FSb[ (uint8) ( RK[3] >> 24 ) ] ); - - RK[5] = RK[1] ^ RK[4]; - RK[6] = RK[2] ^ RK[5]; - RK[7] = RK[3] ^ RK[6]; - } - break; - - case 192: - - for( i = 0; i < 8; i++, RK += 6 ) - { - RK[6] = RK[0] ^ RCON[i] ^ - ( FSb[ (uint8) ( RK[5] >> 16 ) ] << 24 ) ^ - ( FSb[ (uint8) ( RK[5] >> 8 ) ] << 16 ) ^ - ( FSb[ (uint8) ( RK[5] ) ] << 8 ) ^ - ( FSb[ (uint8) ( RK[5] >> 24 ) ] ); - - RK[7] = RK[1] ^ RK[6]; - RK[8] = RK[2] ^ RK[7]; - RK[9] = RK[3] ^ RK[8]; - RK[10] = RK[4] ^ RK[9]; - RK[11] = RK[5] ^ RK[10]; - } - break; - - case 256: - - for( i = 0; i < 7; i++, RK += 8 ) - { - RK[8] = RK[0] ^ RCON[i] ^ - ( FSb[ (uint8) ( RK[7] >> 16 ) ] << 24 ) ^ - ( FSb[ (uint8) ( RK[7] >> 8 ) ] << 16 ) ^ - ( FSb[ (uint8) ( RK[7] ) ] << 8 ) ^ - ( FSb[ (uint8) ( RK[7] >> 24 ) ] ); - - RK[9] = RK[1] ^ RK[8]; - RK[10] = RK[2] ^ RK[9]; - RK[11] = RK[3] ^ RK[10]; - - RK[12] = RK[4] ^ - ( FSb[ (uint8) ( RK[11] >> 24 ) ] << 24 ) ^ - ( FSb[ (uint8) ( RK[11] >> 16 ) ] << 16 ) ^ - ( FSb[ (uint8) ( RK[11] >> 8 ) ] << 8 ) ^ - ( FSb[ (uint8) ( RK[11] ) ] ); - - RK[13] = RK[5] ^ RK[12]; - RK[14] = RK[6] ^ RK[13]; - RK[15] = RK[7] ^ RK[14]; - } - break; - } - - /* setup decryption round keys */ - - if( KT_init ) - { - for( i = 0; i < 256; i++ ) - { - KT0[i] = RT0[ FSb[i] ]; - KT1[i] = RT1[ FSb[i] ]; - KT2[i] = RT2[ FSb[i] ]; - KT3[i] = RT3[ FSb[i] ]; - } - - KT_init = 0; - } - - SK = (uint32 *) ctx->drk; - - *SK++ = *RK++; - *SK++ = *RK++; - *SK++ = *RK++; - *SK++ = *RK++; - - for( i = 1; i < ctx->nr; i++ ) - { - RK -= 8; - - *SK++ = KT0[ (uint8) ( *RK >> 24 ) ] ^ - KT1[ (uint8) ( *RK >> 16 ) ] ^ - KT2[ (uint8) ( *RK >> 8 ) ] ^ - KT3[ (uint8) ( *RK ) ]; RK++; - - *SK++ = KT0[ (uint8) ( *RK >> 24 ) ] ^ - KT1[ (uint8) ( *RK >> 16 ) ] ^ - KT2[ (uint8) ( *RK >> 8 ) ] ^ - KT3[ (uint8) ( *RK ) ]; RK++; - - *SK++ = KT0[ (uint8) ( *RK >> 24 ) ] ^ - KT1[ (uint8) ( *RK >> 16 ) ] ^ - KT2[ (uint8) ( *RK >> 8 ) ] ^ - KT3[ (uint8) ( *RK ) ]; RK++; - - *SK++ = KT0[ (uint8) ( *RK >> 24 ) ] ^ - KT1[ (uint8) ( *RK >> 16 ) ] ^ - KT2[ (uint8) ( *RK >> 8 ) ] ^ - KT3[ (uint8) ( *RK ) ]; RK++; - } - - RK -= 8; - - *SK++ = *RK++; - *SK++ = *RK++; - *SK++ = *RK++; - *SK++ = *RK++; - - return( 0 ); -} - -/* AES 128-bit block encryption routine */ - -void rt_aes_encrypt(aes_context *ctx, uint8 input[16], uint8 output[16] ) -{ - uint32 *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3; - - RK = (uint32 *) ctx->erk; - GET_UINT32( X0, input, 0 ); X0 ^= RK[0]; - GET_UINT32( X1, input, 4 ); X1 ^= RK[1]; - GET_UINT32( X2, input, 8 ); X2 ^= RK[2]; - GET_UINT32( X3, input, 12 ); X3 ^= RK[3]; - -#define AES_FROUND(X0,X1,X2,X3,Y0,Y1,Y2,Y3) \ -{ \ - RK += 4; \ - \ - X0 = RK[0] ^ FT0[ (uint8) ( Y0 >> 24 ) ] ^ \ - FT1[ (uint8) ( Y1 >> 16 ) ] ^ \ - FT2[ (uint8) ( Y2 >> 8 ) ] ^ \ - FT3[ (uint8) ( Y3 ) ]; \ - \ - X1 = RK[1] ^ FT0[ (uint8) ( Y1 >> 24 ) ] ^ \ - FT1[ (uint8) ( Y2 >> 16 ) ] ^ \ - FT2[ (uint8) ( Y3 >> 8 ) ] ^ \ - FT3[ (uint8) ( Y0 ) ]; \ - \ - X2 = RK[2] ^ FT0[ (uint8) ( Y2 >> 24 ) ] ^ \ - FT1[ (uint8) ( Y3 >> 16 ) ] ^ \ - FT2[ (uint8) ( Y0 >> 8 ) ] ^ \ - FT3[ (uint8) ( Y1 ) ]; \ - \ - X3 = RK[3] ^ FT0[ (uint8) ( Y3 >> 24 ) ] ^ \ - FT1[ (uint8) ( Y0 >> 16 ) ] ^ \ - FT2[ (uint8) ( Y1 >> 8 ) ] ^ \ - FT3[ (uint8) ( Y2 ) ]; \ -} - - AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 1 */ - AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 2 */ - AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 3 */ - AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 4 */ - AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 5 */ - AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 6 */ - AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 7 */ - AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 8 */ - AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 9 */ - - if( ctx->nr > 10 ) - { - AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 10 */ - AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 11 */ - } - - if( ctx->nr > 12 ) - { - AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 12 */ - AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 13 */ - } - - /* last round */ - - RK += 4; - - X0 = RK[0] ^ ( FSb[ (uint8) ( Y0 >> 24 ) ] << 24 ) ^ - ( FSb[ (uint8) ( Y1 >> 16 ) ] << 16 ) ^ - ( FSb[ (uint8) ( Y2 >> 8 ) ] << 8 ) ^ - ( FSb[ (uint8) ( Y3 ) ] ); - - X1 = RK[1] ^ ( FSb[ (uint8) ( Y1 >> 24 ) ] << 24 ) ^ - ( FSb[ (uint8) ( Y2 >> 16 ) ] << 16 ) ^ - ( FSb[ (uint8) ( Y3 >> 8 ) ] << 8 ) ^ - ( FSb[ (uint8) ( Y0 ) ] ); - - X2 = RK[2] ^ ( FSb[ (uint8) ( Y2 >> 24 ) ] << 24 ) ^ - ( FSb[ (uint8) ( Y3 >> 16 ) ] << 16 ) ^ - ( FSb[ (uint8) ( Y0 >> 8 ) ] << 8 ) ^ - ( FSb[ (uint8) ( Y1 ) ] ); - - X3 = RK[3] ^ ( FSb[ (uint8) ( Y3 >> 24 ) ] << 24 ) ^ - ( FSb[ (uint8) ( Y0 >> 16 ) ] << 16 ) ^ - ( FSb[ (uint8) ( Y1 >> 8 ) ] << 8 ) ^ - ( FSb[ (uint8) ( Y2 ) ] ); - - PUT_UINT32( X0, output, 0 ); - PUT_UINT32( X1, output, 4 ); - PUT_UINT32( X2, output, 8 ); - PUT_UINT32( X3, output, 12 ); -} - -/* AES 128-bit block decryption routine */ - -void rt_aes_decrypt( aes_context *ctx, uint8 input[16], uint8 output[16] ) -{ - uint32 *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3; - - RK = (uint32 *) ctx->drk; - - GET_UINT32( X0, input, 0 ); X0 ^= RK[0]; - GET_UINT32( X1, input, 4 ); X1 ^= RK[1]; - GET_UINT32( X2, input, 8 ); X2 ^= RK[2]; - GET_UINT32( X3, input, 12 ); X3 ^= RK[3]; - -#define AES_RROUND(X0,X1,X2,X3,Y0,Y1,Y2,Y3) \ -{ \ - RK += 4; \ - \ - X0 = RK[0] ^ RT0[ (uint8) ( Y0 >> 24 ) ] ^ \ - RT1[ (uint8) ( Y3 >> 16 ) ] ^ \ - RT2[ (uint8) ( Y2 >> 8 ) ] ^ \ - RT3[ (uint8) ( Y1 ) ]; \ - \ - X1 = RK[1] ^ RT0[ (uint8) ( Y1 >> 24 ) ] ^ \ - RT1[ (uint8) ( Y0 >> 16 ) ] ^ \ - RT2[ (uint8) ( Y3 >> 8 ) ] ^ \ - RT3[ (uint8) ( Y2 ) ]; \ - \ - X2 = RK[2] ^ RT0[ (uint8) ( Y2 >> 24 ) ] ^ \ - RT1[ (uint8) ( Y1 >> 16 ) ] ^ \ - RT2[ (uint8) ( Y0 >> 8 ) ] ^ \ - RT3[ (uint8) ( Y3 ) ]; \ - \ - X3 = RK[3] ^ RT0[ (uint8) ( Y3 >> 24 ) ] ^ \ - RT1[ (uint8) ( Y2 >> 16 ) ] ^ \ - RT2[ (uint8) ( Y1 >> 8 ) ] ^ \ - RT3[ (uint8) ( Y0 ) ]; \ -} - - AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 1 */ - AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 2 */ - AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 3 */ - AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 4 */ - AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 5 */ - AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 6 */ - AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 7 */ - AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 8 */ - AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 9 */ - - if( ctx->nr > 10 ) - { - AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 10 */ - AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 11 */ - } - - if( ctx->nr > 12 ) - { - AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 12 */ - AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 13 */ - } - - /* last round */ - - RK += 4; - - X0 = RK[0] ^ ( RSb[ (uint8) ( Y0 >> 24 ) ] << 24 ) ^ - ( RSb[ (uint8) ( Y3 >> 16 ) ] << 16 ) ^ - ( RSb[ (uint8) ( Y2 >> 8 ) ] << 8 ) ^ - ( RSb[ (uint8) ( Y1 ) ] ); - - X1 = RK[1] ^ ( RSb[ (uint8) ( Y1 >> 24 ) ] << 24 ) ^ - ( RSb[ (uint8) ( Y0 >> 16 ) ] << 16 ) ^ - ( RSb[ (uint8) ( Y3 >> 8 ) ] << 8 ) ^ - ( RSb[ (uint8) ( Y2 ) ] ); - - X2 = RK[2] ^ ( RSb[ (uint8) ( Y2 >> 24 ) ] << 24 ) ^ - ( RSb[ (uint8) ( Y1 >> 16 ) ] << 16 ) ^ - ( RSb[ (uint8) ( Y0 >> 8 ) ] << 8 ) ^ - ( RSb[ (uint8) ( Y3 ) ] ); - - X3 = RK[3] ^ ( RSb[ (uint8) ( Y3 >> 24 ) ] << 24 ) ^ - ( RSb[ (uint8) ( Y2 >> 16 ) ] << 16 ) ^ - ( RSb[ (uint8) ( Y1 >> 8 ) ] << 8 ) ^ - ( RSb[ (uint8) ( Y0 ) ] ); - - PUT_UINT32( X0, output, 0 ); - PUT_UINT32( X1, output, 4 ); - PUT_UINT32( X2, output, 8 ); - PUT_UINT32( X3, output, 12 ); -} - -/* - ========================================================================== - Description: - ENCRYPT AES GTK before sending in EAPOL frame. - AES GTK length = 128 bit, so fix blocks for aes-key-wrap as 2 in this function. - This function references to RFC 3394 for aes key wrap algorithm. - Return: - ========================================================================== -*/ -VOID AES_GTK_KEY_WRAP( - IN UCHAR *key, - IN UCHAR *plaintext, - IN UINT32 p_len, - OUT UCHAR *ciphertext) -{ - UCHAR A[8], BIN[16], BOUT[16]; - UCHAR R[512]; - INT num_blocks = p_len/8; // unit:64bits - INT i, j; - aes_context aesctx; - UCHAR xor; - - rt_aes_set_key(&aesctx, key, 128); - - // Init IA - for (i = 0; i < 8; i++) - A[i] = 0xa6; - - //Input plaintext - for (i = 0; i < num_blocks; i++) - { - for (j = 0 ; j < 8; j++) - R[8 * (i + 1) + j] = plaintext[8 * i + j]; - } - - // Key Mix - for (j = 0; j < 6; j++) - { - for(i = 1; i <= num_blocks; i++) - { - //phase 1 - NdisMoveMemory(BIN, A, 8); - NdisMoveMemory(&BIN[8], &R[8 * i], 8); - rt_aes_encrypt(&aesctx, BIN, BOUT); - - NdisMoveMemory(A, &BOUT[0], 8); - xor = num_blocks * j + i; - A[7] = BOUT[7] ^ xor; - NdisMoveMemory(&R[8 * i], &BOUT[8], 8); - } - } - - // Output ciphertext - NdisMoveMemory(ciphertext, A, 8); - - for (i = 1; i <= num_blocks; i++) - { - for (j = 0 ; j < 8; j++) - ciphertext[8 * i + j] = R[8 * i + j]; - } -} - -/* - ======================================================================== - - Routine Description: - Misc function to decrypt AES body - - Arguments: - - Return Value: - - Note: - This function references to RFC 3394 for aes key unwrap algorithm. - - ======================================================================== -*/ -VOID AES_GTK_KEY_UNWRAP( - IN UCHAR *key, - OUT UCHAR *plaintext, - IN UINT32 c_len, - IN UCHAR *ciphertext) - -{ - UCHAR A[8], BIN[16], BOUT[16]; - UCHAR xor; - INT i, j; - aes_context aesctx; - UCHAR *R; - INT num_blocks = c_len/8; // unit:64bits - - - os_alloc_mem(NULL, (PUCHAR *)&R, 512); - - if (R == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("!!!AES_GTK_KEY_UNWRAP: no memory!!!\n")); - return; - } /* End of if */ - - // Initialize - NdisMoveMemory(A, ciphertext, 8); - //Input plaintext - for(i = 0; i < (c_len-8); i++) - { - R[ i] = ciphertext[i + 8]; - } - - rt_aes_set_key(&aesctx, key, 128); - - for(j = 5; j >= 0; j--) - { - for(i = (num_blocks-1); i > 0; i--) - { - xor = (num_blocks -1 )* j + i; - NdisMoveMemory(BIN, A, 8); - BIN[7] = A[7] ^ xor; - NdisMoveMemory(&BIN[8], &R[(i-1)*8], 8); - rt_aes_decrypt(&aesctx, BIN, BOUT); - NdisMoveMemory(A, &BOUT[0], 8); - NdisMoveMemory(&R[(i-1)*8], &BOUT[8], 8); - } - } - - // OUTPUT - for(i = 0; i < c_len; i++) - { - plaintext[i] = R[i]; - } - - - os_free_mem(NULL, R); -} - - -/* ======= The related function of AES-128-CMAC ======= */ -VOID leftshift_onebit( - IN PUCHAR input, - OUT PUCHAR output) -{ - INT i; - UCHAR overflow = 0; - - for (i=15; i>=0; i--) - { - output[i] = input[i] << 1; - output[i] |= overflow; - overflow = (input[i] & 0x80) ? 1 : 0; - } -} - -VOID do_padding( - IN PUCHAR lastb, - OUT PUCHAR pad, - IN INT len) -{ - INT j; - - for (j=0; j<16; j++) - { - if (j < len) - pad[j] = lastb[j]; - else if (j == len) - pad[j] = 0x80; - else - pad[j] = 0x00; - } - - -} - -/* - * The Subkey Generation Algorithm - */ -VOID generate_subkey( - IN PUCHAR key, - OUT PUCHAR K1, - OUT PUCHAR K2) -{ - aes_context aesctx; - UCHAR aes_128_key[16]; - UCHAR const_Zero[16]; - UCHAR tmp[16]; - UCHAR const_Rb[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87}; - - // initial the key material - memset(const_Zero, 0, 16); - memset(aes_128_key, 0, 16); - - // AES-128 with key is applied to an all-zero input block - rt_aes_set_key(&aesctx, key, 128); - rt_aes_encrypt(&aesctx, const_Zero, aes_128_key); - - // derive K1(128-bit first subkey) and K2(128-bit second subkey), refer to rfc-4493 ch 2.3 - if ((aes_128_key[0] & 0x80) == 0) - { - leftshift_onebit(aes_128_key, K1); - } - else - { - leftshift_onebit(aes_128_key, tmp); - xor_128(tmp, const_Rb, K1); - } - - if ((K1[0] & 0x80) == 0) - { - leftshift_onebit(K1, K2); - } - else - { - leftshift_onebit(K1, tmp); - xor_128(tmp, const_Rb, K2); - } - -} - -/* - * AES-CMAC Algorithm. (refer to rfc-4493 and SP800-38B) - * - * Input : key (128-bit key) - * input (message to be authenticated) - * len (length of the message in octets) - * - * output: mac (message authentication code) - */ -VOID AES_128_CMAC( - IN PUCHAR key, - IN PUCHAR input, - IN INT len, - OUT PUCHAR mac) -{ - UCHAR X[16], Y[16], M_last[16], padded[16]; - UCHAR K1[16], K2[16]; - aes_context aesctx; - INT n, i, flag; - - generate_subkey(key, K1, K2); - - n = (len+15) / 16; // n is number of rounds - - if (n == 0) - { - n = 1; - flag = 0; - } - else - { - if ((len%16) == 0) - flag = 1; // indicate that last block is a complete block - else - flag = 0; // indicate that last block is not a complete block - } - - if (flag) - { - xor_128(&input[16*(n-1)], K1, M_last); - } - else - { - do_padding(&input[16*(n-1)], padded, len%16); - xor_128(padded, K2, M_last); - } - - memset(X, 0, 16); - for (i=0; i5. - - // 802.11 HyperLan 2 - {100, 0x98402ec8, 0x984c06b2, 0x98178a55, 0x980ed783}, - - // 2008.04.30 modified - // The system team has AN to improve the EVM value - // for channel 102 to 108 for the RT2850/RT2750 dual band solution. - {102, 0x98402ec8, 0x985c06b2, 0x98578a55, 0x980ed793}, - {104, 0x98402ec8, 0x985c06b2, 0x98578a55, 0x980ed1a3}, - {108, 0x98402ecc, 0x985c0a32, 0x98578a55, 0x980ed193}, - - {110, 0x98402ecc, 0x984c0a36, 0x98178a55, 0x980ed183}, - {112, 0x98402ecc, 0x984c0a36, 0x98178a55, 0x980ed19b}, - {116, 0x98402ecc, 0x984c0a3a, 0x98178a55, 0x980ed1a3}, - {118, 0x98402ecc, 0x984c0a3e, 0x98178a55, 0x980ed193}, - {120, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed183}, - {124, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed193}, - {126, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed15b}, // 0x980ed1bb->0x980ed15b required by Rory 20070927 - {128, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed1a3}, - {132, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed18b}, - {134, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed193}, - {136, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed19b}, - {140, 0x98402ec4, 0x984c038a, 0x98178a55, 0x980ed183}, - - // 802.11 UNII - {149, 0x98402ec4, 0x984c038a, 0x98178a55, 0x980ed1a7}, - {151, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed187}, - {153, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed18f}, - {157, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed19f}, - {159, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed1a7}, - {161, 0x98402ec4, 0x984c0392, 0x98178a55, 0x980ed187}, - {165, 0x98402ec4, 0x984c0392, 0x98178a55, 0x980ed197}, - {167, 0x98402ec4, 0x984c03d2, 0x98179855, 0x9815531f}, - {169, 0x98402ec4, 0x984c03d2, 0x98179855, 0x98155327}, - {171, 0x98402ec4, 0x984c03d6, 0x98179855, 0x98155307}, - {173, 0x98402ec4, 0x984c03d6, 0x98179855, 0x9815530f}, - - // Japan - {184, 0x95002ccc, 0x9500491e, 0x9509be55, 0x950c0a0b}, - {188, 0x95002ccc, 0x95004922, 0x9509be55, 0x950c0a13}, - {192, 0x95002ccc, 0x95004926, 0x9509be55, 0x950c0a1b}, - {196, 0x95002ccc, 0x9500492a, 0x9509be55, 0x950c0a23}, - {208, 0x95002ccc, 0x9500493a, 0x9509be55, 0x950c0a13}, - {212, 0x95002ccc, 0x9500493e, 0x9509be55, 0x950c0a1b}, - {216, 0x95002ccc, 0x95004982, 0x9509be55, 0x950c0a23}, - - // still lack of MMAC(Japan) ch 34,38,42,46 -}; -UCHAR NUM_OF_2850_CHNL = (sizeof(RF2850RegTable) / sizeof(RTMP_RF_REGS)); - -FREQUENCY_ITEM FreqItems3020[] = -{ - /**************************************************/ - // ISM : 2.4 to 2.483 GHz // - /**************************************************/ - // 11g - /**************************************************/ - //-CH---N-------R---K----------- - {1, 241, 2, 2}, - {2, 241, 2, 7}, - {3, 242, 2, 2}, - {4, 242, 2, 7}, - {5, 243, 2, 2}, - {6, 243, 2, 7}, - {7, 244, 2, 2}, - {8, 244, 2, 7}, - {9, 245, 2, 2}, - {10, 245, 2, 7}, - {11, 246, 2, 2}, - {12, 246, 2, 7}, - {13, 247, 2, 2}, - {14, 248, 2, 4}, -}; -UCHAR NUM_OF_3020_CHNL = (sizeof(FreqItems3020) / sizeof(FREQUENCY_ITEM)); - - -VOID AsicUpdateAutoFallBackTable( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pRateTable) -{ - UCHAR i; - HT_FBK_CFG0_STRUC HtCfg0; - HT_FBK_CFG1_STRUC HtCfg1; - LG_FBK_CFG0_STRUC LgCfg0; - LG_FBK_CFG1_STRUC LgCfg1; - PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate; - - // set to initial value - HtCfg0.word = 0x65432100; - HtCfg1.word = 0xedcba988; - LgCfg0.word = 0xedcba988; - LgCfg1.word = 0x00002100; - - pNextTxRate = (PRTMP_TX_RATE_SWITCH)pRateTable+1; - for (i = 1; i < *((PUCHAR) pRateTable); i++) - { - pCurrTxRate = (PRTMP_TX_RATE_SWITCH)pRateTable+1+i; - switch (pCurrTxRate->Mode) - { - case 0: //CCK - break; - case 1: //OFDM - { - switch(pCurrTxRate->CurrMCS) - { - case 0: - LgCfg0.field.OFDMMCS0FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 1: - LgCfg0.field.OFDMMCS1FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 2: - LgCfg0.field.OFDMMCS2FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 3: - LgCfg0.field.OFDMMCS3FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 4: - LgCfg0.field.OFDMMCS4FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 5: - LgCfg0.field.OFDMMCS5FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 6: - LgCfg0.field.OFDMMCS6FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 7: - LgCfg0.field.OFDMMCS7FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - } - } - break; -#ifdef DOT11_N_SUPPORT - case 2: //HT-MIX - case 3: //HT-GF - { - if ((pNextTxRate->Mode >= MODE_HTMIX) && (pCurrTxRate->CurrMCS != pNextTxRate->CurrMCS)) - { - switch(pCurrTxRate->CurrMCS) - { - case 0: - HtCfg0.field.HTMCS0FBK = pNextTxRate->CurrMCS; - break; - case 1: - HtCfg0.field.HTMCS1FBK = pNextTxRate->CurrMCS; - break; - case 2: - HtCfg0.field.HTMCS2FBK = pNextTxRate->CurrMCS; - break; - case 3: - HtCfg0.field.HTMCS3FBK = pNextTxRate->CurrMCS; - break; - case 4: - HtCfg0.field.HTMCS4FBK = pNextTxRate->CurrMCS; - break; - case 5: - HtCfg0.field.HTMCS5FBK = pNextTxRate->CurrMCS; - break; - case 6: - HtCfg0.field.HTMCS6FBK = pNextTxRate->CurrMCS; - break; - case 7: - HtCfg0.field.HTMCS7FBK = pNextTxRate->CurrMCS; - break; - case 8: - HtCfg1.field.HTMCS8FBK = pNextTxRate->CurrMCS; - break; - case 9: - HtCfg1.field.HTMCS9FBK = pNextTxRate->CurrMCS; - break; - case 10: - HtCfg1.field.HTMCS10FBK = pNextTxRate->CurrMCS; - break; - case 11: - HtCfg1.field.HTMCS11FBK = pNextTxRate->CurrMCS; - break; - case 12: - HtCfg1.field.HTMCS12FBK = pNextTxRate->CurrMCS; - break; - case 13: - HtCfg1.field.HTMCS13FBK = pNextTxRate->CurrMCS; - break; - case 14: - HtCfg1.field.HTMCS14FBK = pNextTxRate->CurrMCS; - break; - case 15: - HtCfg1.field.HTMCS15FBK = pNextTxRate->CurrMCS; - break; - default: - DBGPRINT(RT_DEBUG_ERROR, ("AsicUpdateAutoFallBackTable: not support CurrMCS=%d\n", pCurrTxRate->CurrMCS)); - } - } - } - break; -#endif // DOT11_N_SUPPORT // - } - - pNextTxRate = pCurrTxRate; - } - - RTMP_IO_WRITE32(pAd, HT_FBK_CFG0, HtCfg0.word); - RTMP_IO_WRITE32(pAd, HT_FBK_CFG1, HtCfg1.word); - RTMP_IO_WRITE32(pAd, LG_FBK_CFG0, LgCfg0.word); - RTMP_IO_WRITE32(pAd, LG_FBK_CFG1, LgCfg1.word); -} - -/* - ======================================================================== - - Routine Description: - Set MAC register value according operation mode. - OperationMode AND bNonGFExist are for MM and GF Proteciton. - If MM or GF mask is not set, those passing argument doesn't not take effect. - - Operation mode meaning: - = 0 : Pure HT, no preotection. - = 0x01; there may be non-HT devices in both the control and extension channel, protection is optional in BSS. - = 0x10: No Transmission in 40M is protected. - = 0x11: Transmission in both 40M and 20M shall be protected - if (bNonGFExist) - we should choose not to use GF. But still set correct ASIC registers. - ======================================================================== -*/ -VOID AsicUpdateProtect( - IN PRTMP_ADAPTER pAd, - IN USHORT OperationMode, - IN UCHAR SetMask, - IN BOOLEAN bDisableBGProtect, - IN BOOLEAN bNonGFExist) -{ - PROT_CFG_STRUC ProtCfg, ProtCfg4; - UINT32 Protect[6]; - USHORT offset; - UCHAR i; - UINT32 MacReg = 0; - -#ifdef RALINK_ATE - if (ATE_ON(pAd)) - return; -#endif // RALINK_ATE // - -#ifdef DOT11_N_SUPPORT - if (!(pAd->CommonCfg.bHTProtect) && (OperationMode != 8)) - { - return; - } - - if (pAd->BATable.numDoneOriginator) - { - // - // enable the RTS/CTS to avoid channel collision - // - SetMask = ALLN_SETPROTECT; - OperationMode = 8; - } -#endif // DOT11_N_SUPPORT // - - // Config ASIC RTS threshold register - RTMP_IO_READ32(pAd, TX_RTS_CFG, &MacReg); - MacReg &= 0xFF0000FF; - // If the user want disable RtsThreshold and enbale Amsdu/Ralink-Aggregation, set the RtsThreshold as 4096 - if (( -#ifdef DOT11_N_SUPPORT - (pAd->CommonCfg.BACapability.field.AmsduEnable) || -#endif // DOT11_N_SUPPORT // - (pAd->CommonCfg.bAggregationCapable == TRUE)) - && pAd->CommonCfg.RtsThreshold == MAX_RTS_THRESHOLD) - { - MacReg |= (0x1000 << 8); - } - else - { - MacReg |= (pAd->CommonCfg.RtsThreshold << 8); - } - - RTMP_IO_WRITE32(pAd, TX_RTS_CFG, MacReg); - - // Initial common protection settings - RTMPZeroMemory(Protect, sizeof(Protect)); - ProtCfg4.word = 0; - ProtCfg.word = 0; - ProtCfg.field.TxopAllowGF40 = 1; - ProtCfg.field.TxopAllowGF20 = 1; - ProtCfg.field.TxopAllowMM40 = 1; - ProtCfg.field.TxopAllowMM20 = 1; - ProtCfg.field.TxopAllowOfdm = 1; - ProtCfg.field.TxopAllowCck = 1; - ProtCfg.field.RTSThEn = 1; - ProtCfg.field.ProtectNav = ASIC_SHORTNAV; - - // update PHY mode and rate - if (pAd->CommonCfg.Channel > 14) - ProtCfg.field.ProtectRate = 0x4000; - ProtCfg.field.ProtectRate |= pAd->CommonCfg.RtsRate; - - // Handle legacy(B/G) protection - if (bDisableBGProtect) - { - //ProtCfg.field.ProtectRate = pAd->CommonCfg.RtsRate; - ProtCfg.field.ProtectCtrl = 0; - Protect[0] = ProtCfg.word; - Protect[1] = ProtCfg.word; - pAd->FlgCtsEnabled = 0; /* CTS-self is not used */ - } - else - { - //ProtCfg.field.ProtectRate = pAd->CommonCfg.RtsRate; - ProtCfg.field.ProtectCtrl = 0; // CCK do not need to be protected - Protect[0] = ProtCfg.word; - ProtCfg.field.ProtectCtrl = ASIC_CTS; // OFDM needs using CCK to protect - Protect[1] = ProtCfg.word; - pAd->FlgCtsEnabled = 1; /* CTS-self is used */ - } - -#ifdef DOT11_N_SUPPORT - // Decide HT frame protection. - if ((SetMask & ALLN_SETPROTECT) != 0) - { - switch(OperationMode) - { - case 0x0: - // NO PROTECT - // 1.All STAs in the BSS are 20/40 MHz HT - // 2. in ai 20/40MHz BSS - // 3. all STAs are 20MHz in a 20MHz BSS - // Pure HT. no protection. - - // MM20_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 010111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4004 (OFDM 24M) - Protect[2] = 0x01744004; - - // MM40_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 111111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4084 (duplicate OFDM 24M) - Protect[3] = 0x03f44084; - - // CF20_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 010111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4004 (OFDM 24M) - Protect[4] = 0x01744004; - - // CF40_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 111111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4084 (duplicate OFDM 24M) - Protect[5] = 0x03f44084; - - if (bNonGFExist) - { - // PROT_NAV(19:18) -- 01 (Short NAV protectiion) - // PROT_CTRL(17:16) -- 01 (RTS/CTS) - Protect[4] = 0x01754004; - Protect[5] = 0x03f54084; - } - pAd->CommonCfg.IOTestParm.bRTSLongProtOn = FALSE; - break; - - case 1: - // This is "HT non-member protection mode." - // If there may be non-HT STAs my BSS - ProtCfg.word = 0x01744004; // PROT_CTRL(17:16) : 0 (None) - ProtCfg4.word = 0x03f44084; // duplicaet legacy 24M. BW set 1. - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_BG_PROTECTION_INUSED)) - { - ProtCfg.word = 0x01740003; //ERP use Protection bit is set, use protection rate at Clause 18.. - ProtCfg4.word = 0x03f40003; // Don't duplicate RTS/CTS in CCK mode. 0x03f40083; - } - //Assign Protection method for 20&40 MHz packets - ProtCfg.field.ProtectCtrl = ASIC_RTS; - ProtCfg.field.ProtectNav = ASIC_SHORTNAV; - ProtCfg4.field.ProtectCtrl = ASIC_RTS; - ProtCfg4.field.ProtectNav = ASIC_SHORTNAV; - Protect[2] = ProtCfg.word; - Protect[3] = ProtCfg4.word; - Protect[4] = ProtCfg.word; - Protect[5] = ProtCfg4.word; - pAd->CommonCfg.IOTestParm.bRTSLongProtOn = TRUE; - break; - - case 2: - // If only HT STAs are in BSS. at least one is 20MHz. Only protect 40MHz packets - ProtCfg.word = 0x01744004; // PROT_CTRL(17:16) : 0 (None) - ProtCfg4.word = 0x03f44084; // duplicaet legacy 24M. BW set 1. - - //Assign Protection method for 40MHz packets - ProtCfg4.field.ProtectCtrl = ASIC_RTS; - ProtCfg4.field.ProtectNav = ASIC_SHORTNAV; - Protect[2] = ProtCfg.word; - Protect[3] = ProtCfg4.word; - if (bNonGFExist) - { - ProtCfg.field.ProtectCtrl = ASIC_RTS; - ProtCfg.field.ProtectNav = ASIC_SHORTNAV; - } - Protect[4] = ProtCfg.word; - Protect[5] = ProtCfg4.word; - - pAd->CommonCfg.IOTestParm.bRTSLongProtOn = FALSE; - break; - - case 3: - // HT mixed mode. PROTECT ALL! - // Assign Rate - ProtCfg.word = 0x01744004; //duplicaet legacy 24M. BW set 1. - ProtCfg4.word = 0x03f44084; - // both 20MHz and 40MHz are protected. Whether use RTS or CTS-to-self depends on the - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_BG_PROTECTION_INUSED)) - { - ProtCfg.word = 0x01740003; //ERP use Protection bit is set, use protection rate at Clause 18.. - ProtCfg4.word = 0x03f40003; // Don't duplicate RTS/CTS in CCK mode. 0x03f40083 - } - //Assign Protection method for 20&40 MHz packets - ProtCfg.field.ProtectCtrl = ASIC_RTS; - ProtCfg.field.ProtectNav = ASIC_SHORTNAV; - ProtCfg4.field.ProtectCtrl = ASIC_RTS; - ProtCfg4.field.ProtectNav = ASIC_SHORTNAV; - Protect[2] = ProtCfg.word; - Protect[3] = ProtCfg4.word; - Protect[4] = ProtCfg.word; - Protect[5] = ProtCfg4.word; - pAd->CommonCfg.IOTestParm.bRTSLongProtOn = TRUE; - break; - - case 8: - // Special on for Atheros problem n chip. - Protect[2] = 0x01754004; - Protect[3] = 0x03f54084; - Protect[4] = 0x01754004; - Protect[5] = 0x03f54084; - pAd->CommonCfg.IOTestParm.bRTSLongProtOn = TRUE; - break; - } - } -#endif // DOT11_N_SUPPORT // - - offset = CCK_PROT_CFG; - for (i = 0;i < 6;i++) - { - if ((SetMask & (1<< i))) - { - RTMP_IO_WRITE32(pAd, offset + i*4, Protect[i]); - } -} -} - - -/* - ========================================================================== - Description: - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicSwitchChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel, - IN BOOLEAN bScan) -{ - ULONG R2 = 0, R3 = DEFAULT_RF_TX_POWER, R4 = 0; - CHAR TxPwer = 0, TxPwer2 = DEFAULT_RF_TX_POWER; //Bbp94 = BBPR94_DEFAULT, TxPwer2 = DEFAULT_RF_TX_POWER; - UCHAR index; - UINT32 Value = 0; //BbpReg, Value; - RTMP_RF_REGS *RFRegTable; - UCHAR RFValue; - - RFValue = 0; - // Search Tx power value - // We can't use ChannelList to search channel, since some central channl's txpowr doesn't list - // in ChannelList, so use TxPower array instead. - // - for (index = 0; index < MAX_NUM_OF_CHANNELS; index++) - { - if (Channel == pAd->TxPower[index].Channel) - { - TxPwer = pAd->TxPower[index].Power; - TxPwer2 = pAd->TxPower[index].Power2; - break; - } - } - - if (index == MAX_NUM_OF_CHANNELS) - { - DBGPRINT(RT_DEBUG_ERROR, ("AsicSwitchChannel: Can't find the Channel#%d \n", Channel)); - } - -#ifdef RT30xx - // The RF programming sequence is difference between 3xxx and 2xxx - if ((IS_RT3070(pAd) || IS_RT3090(pAd)||IS_RT3390(pAd)) && ((pAd->RfIcType == RFIC_3020) || (pAd->RfIcType == RFIC_2020) || - (pAd->RfIcType == RFIC_3021) || (pAd->RfIcType == RFIC_3022))) - { - /* modify by WY for Read RF Reg. error */ - - for (index = 0; index < NUM_OF_3020_CHNL; index++) - { - if (Channel == FreqItems3020[index].Channel) - { - // Programming channel parameters - RT30xxWriteRFRegister(pAd, RF_R02, FreqItems3020[index].N); - RT30xxWriteRFRegister(pAd, RF_R03, FreqItems3020[index].K); - RT30xxReadRFRegister(pAd, RF_R06, &RFValue); - RFValue = (RFValue & 0xFC) | FreqItems3020[index].R; - RT30xxWriteRFRegister(pAd, RF_R06, RFValue); - - // Set Tx0 Power - RT30xxReadRFRegister(pAd, RF_R12, &RFValue); - RFValue = (RFValue & 0xE0) | TxPwer; - RT30xxWriteRFRegister(pAd, RF_R12, RFValue); - - // Set Tx1 Power - RT30xxReadRFRegister(pAd, RF_R13, &RFValue); - RFValue = (RFValue & 0xE0) | TxPwer2; - RT30xxWriteRFRegister(pAd, RF_R13, RFValue); - - // Tx/Rx Stream setting - RT30xxReadRFRegister(pAd, RF_R01, &RFValue); - //if (IS_RT3090(pAd)) - // RFValue |= 0x01; // Enable RF block. - RFValue &= 0x03; //clear bit[7~2] - if (pAd->Antenna.field.TxPath == 1) - RFValue |= 0xA0; - else if (pAd->Antenna.field.TxPath == 2) - RFValue |= 0x80; - if (pAd->Antenna.field.RxPath == 1) - RFValue |= 0x50; - else if (pAd->Antenna.field.RxPath == 2) - RFValue |= 0x40; - RT30xxWriteRFRegister(pAd, RF_R01, RFValue); - - // Set RF offset - RT30xxReadRFRegister(pAd, RF_R23, &RFValue); - RFValue = (RFValue & 0x80) | pAd->RfFreqOffset; - RT30xxWriteRFRegister(pAd, RF_R23, RFValue); - - // Set BW - if (!bScan && (pAd->CommonCfg.BBPCurrentBW == BW_40)) - { - RFValue = pAd->Mlme.CaliBW40RfR24; - //DISABLE_11N_CHECK(pAd); - } - else - { - RFValue = pAd->Mlme.CaliBW20RfR24; - } - RT30xxWriteRFRegister(pAd, RF_R24, RFValue); - RT30xxWriteRFRegister(pAd, RF_R31, RFValue); - - // Enable RF tuning - RT30xxReadRFRegister(pAd, RF_R07, &RFValue); - RFValue = RFValue | 0x1; - RT30xxWriteRFRegister(pAd, RF_R07, RFValue); - - // latch channel for future usage. - pAd->LatchRfRegs.Channel = Channel; - - DBGPRINT(RT_DEBUG_TRACE, ("SwitchChannel#%d(RF=%d, Pwr0=%d, Pwr1=%d, %dT), N=0x%02X, K=0x%02X, R=0x%02X\n", - Channel, - pAd->RfIcType, - TxPwer, - TxPwer2, - pAd->Antenna.field.TxPath, - FreqItems3020[index].N, - FreqItems3020[index].K, - FreqItems3020[index].R)); - - break; - } - } - } - else -#endif // RT30xx // - { - RFRegTable = RF2850RegTable; - switch (pAd->RfIcType) - { - case RFIC_2820: - case RFIC_2850: - case RFIC_2720: - case RFIC_2750: - - for (index = 0; index < NUM_OF_2850_CHNL; index++) - { - if (Channel == RFRegTable[index].Channel) - { - R2 = RFRegTable[index].R2; - if (pAd->Antenna.field.TxPath == 1) - { - R2 |= 0x4000; // If TXpath is 1, bit 14 = 1; - } - - if (pAd->Antenna.field.RxPath == 2) - { - R2 |= 0x40; // write 1 to off Rxpath. - } - else if (pAd->Antenna.field.RxPath == 1) - { - R2 |= 0x20040; // write 1 to off RxPath - } - - if (Channel > 14) - { - // initialize R3, R4 - R3 = (RFRegTable[index].R3 & 0xffffc1ff); - R4 = (RFRegTable[index].R4 & (~0x001f87c0)) | (pAd->RfFreqOffset << 15); - - // 5G band power range: 0xF9~0X0F, TX0 Reg3 bit9/TX1 Reg4 bit6="0" means the TX power reduce 7dB - // R3 - if ((TxPwer >= -7) && (TxPwer < 0)) - { - TxPwer = (7+TxPwer); - TxPwer = (TxPwer > 0xF) ? (0xF) : (TxPwer); - R3 |= (TxPwer << 10); - DBGPRINT(RT_DEBUG_ERROR, ("AsicSwitchChannel: TxPwer=%d \n", TxPwer)); - } - else - { - TxPwer = (TxPwer > 0xF) ? (0xF) : (TxPwer); - R3 |= (TxPwer << 10) | (1 << 9); - } - - // R4 - if ((TxPwer2 >= -7) && (TxPwer2 < 0)) - { - TxPwer2 = (7+TxPwer2); - TxPwer2 = (TxPwer2 > 0xF) ? (0xF) : (TxPwer2); - R4 |= (TxPwer2 << 7); - DBGPRINT(RT_DEBUG_ERROR, ("AsicSwitchChannel: TxPwer2=%d \n", TxPwer2)); - } - else - { - TxPwer2 = (TxPwer2 > 0xF) ? (0xF) : (TxPwer2); - R4 |= (TxPwer2 << 7) | (1 << 6); - } - } - else - { - R3 = (RFRegTable[index].R3 & 0xffffc1ff) | (TxPwer << 9); // set TX power0 - R4 = (RFRegTable[index].R4 & (~0x001f87c0)) | (pAd->RfFreqOffset << 15) | (TxPwer2 <<6);// Set freq Offset & TxPwr1 - } - - // Based on BBP current mode before changing RF channel. - if (!bScan && (pAd->CommonCfg.BBPCurrentBW == BW_40)) - { - R4 |=0x200000; - } - - // Update variables - pAd->LatchRfRegs.Channel = Channel; - pAd->LatchRfRegs.R1 = RFRegTable[index].R1; - pAd->LatchRfRegs.R2 = R2; - pAd->LatchRfRegs.R3 = R3; - pAd->LatchRfRegs.R4 = R4; - -#ifdef DFS_DEBUG -#ifdef DFS_FCC_BW40_FIX - if (pAd->infType == RTMP_DEV_INF_PCI) // RT2880 PCI - { - /* only for RT2880 */ - // FCC DFS test - pAd->LatchRfRegs.R1 |= 0x100; - pAd->LatchRfRegs.R4 |= 0x00400000; - } -#endif // DFS_FCC_BW40_FIX // -#endif // DFS_DEBUG // - - // Set RF value 1's set R3[bit2] = [0] - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R1); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R2); - RTMP_RF_IO_WRITE32(pAd, (pAd->LatchRfRegs.R3 & (~0x04))); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R4); - - RTMPusecDelay(200); - - // Set RF value 2's set R3[bit2] = [1] - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R1); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R2); - RTMP_RF_IO_WRITE32(pAd, (pAd->LatchRfRegs.R3 | 0x04)); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R4); - - RTMPusecDelay(200); - - // Set RF value 3's set R3[bit2] = [0] - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R1); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R2); - RTMP_RF_IO_WRITE32(pAd, (pAd->LatchRfRegs.R3 & (~0x04))); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R4); - - break; - } - } - break; - - default: - break; - } - - DBGPRINT(RT_DEBUG_TRACE, ("SwitchChannel#%d(RF=%d, Pwr0=%lu, Pwr1=%lu, %dT) to , R1=0x%08lx, R2=0x%08lx, R3=0x%08lx, R4=0x%08lx\n", - Channel, - pAd->RfIcType, - (R3 & 0x00003e00) >> 9, - (R4 & 0x000007c0) >> 6, - pAd->Antenna.field.TxPath, - pAd->LatchRfRegs.R1, - pAd->LatchRfRegs.R2, - pAd->LatchRfRegs.R3, - pAd->LatchRfRegs.R4)); - } - - // Change BBP setting during siwtch from a->g, g->a - if (Channel <= 14) - { - ULONG TxPinCfg = 0x00050F0A;//Gary 2007/08/09 0x050A0A - - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R62, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R63, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R64, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R86, 0);//(0x44 - GET_LNA_GAIN(pAd))); // According the Rory's suggestion to solve the middle range issue. - //RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0x62); - - // Rx High power VGA offset for LNA select - if (pAd->NicConfig2.field.ExternalLNAForG) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0x62); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x46); - } - else - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0x84); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x50); - } - - // 5G band selection PIN, bit1 and bit2 are complement - RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value); - Value &= (~0x6); - Value |= (0x04); - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); - - // Turn off unused PA or LNA when only 1T or 1R - if (pAd->Antenna.field.TxPath == 1) - { - TxPinCfg &= 0xFFFFFFF3; - } - if (pAd->Antenna.field.RxPath == 1) - { - TxPinCfg &= 0xFFFFF3FF; - } - - - RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg); - -#if defined(RT3090) || defined(RT3390) - // PCIe PHY Transmit attenuation adjustment - if (IS_RT3090A(pAd) || IS_RT3390(pAd)) - { - TX_ATTENUATION_CTRL_STRUC TxAttenuationCtrl = {0}; - - RTMP_IO_READ32(pAd, PCIE_PHY_TX_ATTENUATION_CTRL, &TxAttenuationCtrl.word); - - if (Channel == 14) // Channel #14 - { - TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_EN = 1; // Enable PCIe PHY Tx attenuation - TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_VALUE = 4; // 9/16 full drive level - } - else // Channel #1~#13 - { - TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_EN = 0; // Disable PCIe PHY Tx attenuation - TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_VALUE = 0; // n/a - } - - RTMP_IO_WRITE32(pAd, PCIE_PHY_TX_ATTENUATION_CTRL, TxAttenuationCtrl.word); - } -#endif - } - else - { - ULONG TxPinCfg = 0x00050F05;//Gary 2007/8/9 0x050505 - - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R62, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R63, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R64, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R86, 0);//(0x44 - GET_LNA_GAIN(pAd))); // According the Rory's suggestion to solve the middle range issue. - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0xF2); - - // Rx High power VGA offset for LNA select - if (pAd->NicConfig2.field.ExternalLNAForA) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x46); - } - else - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x50); - } - - // 5G band selection PIN, bit1 and bit2 are complement - RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value); - Value &= (~0x6); - Value |= (0x02); - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); - - // Turn off unused PA or LNA when only 1T or 1R - if (pAd->Antenna.field.TxPath == 1) - { - TxPinCfg &= 0xFFFFFFF3; - } - if (pAd->Antenna.field.RxPath == 1) - { - TxPinCfg &= 0xFFFFF3FF; - } - - - RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg); - - } - - // R66 should be set according to Channel and use 20MHz when scanning - //RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, (0x2E + GET_LNA_GAIN(pAd))); - if (bScan) - RTMPSetAGCInitValue(pAd, BW_20); - else - RTMPSetAGCInitValue(pAd, pAd->CommonCfg.BBPCurrentBW); - - // - // On 11A, We should delay and wait RF/BBP to be stable - // and the appropriate time should be 1000 micro seconds - // 2005/06/05 - On 11G, We also need this delay time. Otherwise it's difficult to pass the WHQL. - // - RTMPusecDelay(1000); -} - -/* - ========================================================================== - Description: - This function is required for 2421 only, and should not be used during - site survey. It's only required after NIC decided to stay at a channel - for a longer period. - When this function is called, it's always after AsicSwitchChannel(). - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicLockChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel) -{ -} - -/* - ========================================================================== - Description: - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -#ifdef ANT_DIVERSITY_SUPPORT -VOID AsicAntennaSelect( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel) -{ -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - if (pAd->Mlme.OneSecPeriodicRound % 2 == 1) -#endif // CONFIG_STA_SUPPORT // - { - // patch for AsicSetRxAnt failed - pAd->RxAnt.EvaluatePeriod = 0; - - // check every 2 second. If rcv-beacon less than 5 in the past 2 second, then AvgRSSI is no longer a - // valid indication of the distance between this AP and its clients. - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - SHORT realavgrssi1; - - // if no traffic then reset average rssi to trigger evaluation -#ifdef CONFIG_STA_SUPPORT - if (pAd->StaCfg.NumOfAvgRssiSample < 5) - { - pAd->RxAnt.Pair1LastAvgRssi = (-99); - pAd->RxAnt.Pair2LastAvgRssi = (-99); - DBGPRINT(RT_DEBUG_TRACE, ("MlmePeriodicExec: no traffic/beacon, reset RSSI\n")); - } - - pAd->StaCfg.NumOfAvgRssiSample = 0; - realavgrssi1 = (pAd->RxAnt.Pair1AvgRssi[pAd->RxAnt.Pair1PrimaryRxAnt] >> 3); -#endif // CONFIG_STA_SUPPORT // - - DBGPRINT(RT_DEBUG_TRACE,("Ant-realrssi0(%d), Lastrssi0(%d), EvaluateStableCnt=%d\n", realavgrssi1, pAd->RxAnt.Pair1LastAvgRssi, pAd->RxAnt.EvaluateStableCnt)); - - // if the difference between two rssi is larger or less than 5, then evaluate the other antenna - if ((pAd->RxAnt.EvaluateStableCnt < 2) || (realavgrssi1 > (pAd->RxAnt.Pair1LastAvgRssi + 5)) || (realavgrssi1 < (pAd->RxAnt.Pair1LastAvgRssi - 5))) - AsicEvaluateRxAnt(pAd); - - pAd->RxAnt.Pair1LastAvgRssi = realavgrssi1; - } - else - { - // if not connected, always switch antenna to try to connect - UCHAR temp; - - temp = pAd->RxAnt.Pair1PrimaryRxAnt; - pAd->RxAnt.Pair1PrimaryRxAnt = pAd->RxAnt.Pair1SecondaryRxAnt; - pAd->RxAnt.Pair1SecondaryRxAnt = temp; - - DBGPRINT(RT_DEBUG_TRACE, ("MlmePeriodicExec: no connect, switch to another one to try connection\n")); - - AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); - } - } -} -#endif // ANT_DIVERSITY_SUPPORT // - -/* - ======================================================================== - - Routine Description: - Antenna miscellaneous setting. - - Arguments: - pAd Pointer to our adapter - BandState Indicate current Band State. - - Return Value: - None - - IRQL <= DISPATCH_LEVEL - - Note: - 1.) Frame End type control - only valid for G only (RF_2527 & RF_2529) - 0: means DPDT, set BBP R4 bit 5 to 1 - 1: means SPDT, set BBP R4 bit 5 to 0 - - - ======================================================================== -*/ -VOID AsicAntennaSetting( - IN PRTMP_ADAPTER pAd, - IN ABGBAND_STATE BandState) -{ -} - -VOID AsicRfTuningExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ -} - -/* - ========================================================================== - Description: - Gives CCK TX rate 2 more dB TX power. - This routine works only in LINK UP in INFRASTRUCTURE mode. - - calculate desired Tx power in RF R3.Tx0~5, should consider - - 0. if current radio is a noisy environment (pAd->DrsCounters.fNoisyEnvironment) - 1. TxPowerPercentage - 2. auto calibration based on TSSI feedback - 3. extra 2 db for CCK - 4. -10 db upon very-short distance (AvgRSSI >= -40db) to AP - - NOTE: Since this routine requires the value of (pAd->DrsCounters.fNoisyEnvironment), - it should be called AFTER MlmeDynamicTxRatSwitching() - ========================================================================== - */ -VOID AsicAdjustTxPower( - IN PRTMP_ADAPTER pAd) -{ - INT i, j; - CHAR DeltaPwr = 0; - BOOLEAN bAutoTxAgc = FALSE; - UCHAR TssiRef, *pTssiMinusBoundary, *pTssiPlusBoundary, TxAgcStep; - UCHAR BbpR1 = 0, BbpR49 = 0, idx; - PCHAR pTxAgcCompensate; - ULONG TxPwr[5]; - CHAR Value; -#ifdef CONFIG_STA_SUPPORT - CHAR Rssi = -127; -#endif // CONFIG_STA_SUPPORT // -#ifdef CARRIER_SENSE_NEW_ALGO - unsigned long flags; //KH Add to Fix PCIe Power-Saving bug -#endif // CARRIER_SENSE_NEW_ALGO // - - -#ifdef CARRIER_SENSE_NEW_ALGO - //KH Add to Fix PCIe Power-Saving bug<-- - RTMP_INT_LOCK(&pAd->irq_lock, flags); - //KH Add to Fix PCIe Power-Saving bug--> -#endif // CARRIER_SENSE_NEW_ALGO // - -#ifdef CONFIG_STA_SUPPORT - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) || -#ifdef RTMP_MAC_PCI - (pAd->bPCIclkOff == TRUE) || -#endif // RTMP_MAC_PCI // - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) -{ - -#ifdef CARRIER_SENSE_NEW_ALGO - //KH Add to Fix PCIe Power-Saving bug<-- - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - //KH add to fix PCIe-Power Saving --> -#endif // CARRIER_SENSE_NEW_ALGO // - return; -} - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - Rssi = RTMPMaxRssi(pAd, - pAd->StaCfg.RssiSample.AvgRssi0, - pAd->StaCfg.RssiSample.AvgRssi1, - pAd->StaCfg.RssiSample.AvgRssi2); -#endif // CONFIG_STA_SUPPORT // - - if (pAd->CommonCfg.BBPCurrentBW == BW_40) - { - if (pAd->CommonCfg.CentralChannel > 14) - { - TxPwr[0] = pAd->Tx40MPwrCfgABand[0]; - TxPwr[1] = pAd->Tx40MPwrCfgABand[1]; - TxPwr[2] = pAd->Tx40MPwrCfgABand[2]; - TxPwr[3] = pAd->Tx40MPwrCfgABand[3]; - TxPwr[4] = pAd->Tx40MPwrCfgABand[4]; - } - else - { - TxPwr[0] = pAd->Tx40MPwrCfgGBand[0]; - TxPwr[1] = pAd->Tx40MPwrCfgGBand[1]; - TxPwr[2] = pAd->Tx40MPwrCfgGBand[2]; - TxPwr[3] = pAd->Tx40MPwrCfgGBand[3]; - TxPwr[4] = pAd->Tx40MPwrCfgGBand[4]; - } - } - else - { - if (pAd->CommonCfg.Channel > 14) - { - TxPwr[0] = pAd->Tx20MPwrCfgABand[0]; - TxPwr[1] = pAd->Tx20MPwrCfgABand[1]; - TxPwr[2] = pAd->Tx20MPwrCfgABand[2]; - TxPwr[3] = pAd->Tx20MPwrCfgABand[3]; - TxPwr[4] = pAd->Tx20MPwrCfgABand[4]; - } - else - { - TxPwr[0] = pAd->Tx20MPwrCfgGBand[0]; - TxPwr[1] = pAd->Tx20MPwrCfgGBand[1]; - TxPwr[2] = pAd->Tx20MPwrCfgGBand[2]; - TxPwr[3] = pAd->Tx20MPwrCfgGBand[3]; - TxPwr[4] = pAd->Tx20MPwrCfgGBand[4]; - } - } - - // TX power compensation for temperature variation based on TSSI. try every 4 second - if (pAd->Mlme.OneSecPeriodicRound % 4 == 0) - { - if (pAd->CommonCfg.Channel <= 14) - { - /* bg channel */ - bAutoTxAgc = pAd->bAutoTxAgcG; - TssiRef = pAd->TssiRefG; - pTssiMinusBoundary = &pAd->TssiMinusBoundaryG[0]; - pTssiPlusBoundary = &pAd->TssiPlusBoundaryG[0]; - TxAgcStep = pAd->TxAgcStepG; - pTxAgcCompensate = &pAd->TxAgcCompensateG; - } - else - { - /* a channel */ - bAutoTxAgc = pAd->bAutoTxAgcA; - TssiRef = pAd->TssiRefA; - pTssiMinusBoundary = &pAd->TssiMinusBoundaryA[0]; - pTssiPlusBoundary = &pAd->TssiPlusBoundaryA[0]; - TxAgcStep = pAd->TxAgcStepA; - pTxAgcCompensate = &pAd->TxAgcCompensateA; - } - - if (bAutoTxAgc) - { - /* BbpR1 is unsigned char */ - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R49, &BbpR49); - - /* (p) TssiPlusBoundaryG[0] = 0 = (m) TssiMinusBoundaryG[0] */ - /* compensate: +4 +3 +2 +1 0 -1 -2 -3 -4 * steps */ - /* step value is defined in pAd->TxAgcStepG for tx power value */ - - /* [4]+1+[4] p4 p3 p2 p1 o1 m1 m2 m3 m4 */ - /* ex: 0x00 0x15 0x25 0x45 0x88 0xA0 0xB5 0xD0 0xF0 - above value are examined in mass factory production */ - /* [4] [3] [2] [1] [0] [1] [2] [3] [4] */ - - /* plus (+) is 0x00 ~ 0x45, minus (-) is 0xa0 ~ 0xf0 */ - /* if value is between p1 ~ o1 or o1 ~ s1, no need to adjust tx power */ - /* if value is 0xa5, tx power will be -= TxAgcStep*(2-1) */ - - if (BbpR49 > pTssiMinusBoundary[1]) - { - // Reading is larger than the reference value - // check for how large we need to decrease the Tx power - for (idx = 1; idx < 5; idx++) - { - if (BbpR49 <= pTssiMinusBoundary[idx]) // Found the range - break; - } - // The index is the step we should decrease, idx = 0 means there is nothing to compensate -// if (R3 > (ULONG) (TxAgcStep * (idx-1))) - *pTxAgcCompensate = -(TxAgcStep * (idx-1)); -// else -// *pTxAgcCompensate = -((UCHAR)R3); - - DeltaPwr += (*pTxAgcCompensate); - DBGPRINT(RT_DEBUG_TRACE, ("-- Tx Power, BBP R1=%x, TssiRef=%x, TxAgcStep=%x, step = -%d\n", - BbpR49, TssiRef, TxAgcStep, idx-1)); - } - else if (BbpR49 < pTssiPlusBoundary[1]) - { - // Reading is smaller than the reference value - // check for how large we need to increase the Tx power - for (idx = 1; idx < 5; idx++) - { - if (BbpR49 >= pTssiPlusBoundary[idx]) // Found the range - break; - } - // The index is the step we should increase, idx = 0 means there is nothing to compensate - *pTxAgcCompensate = TxAgcStep * (idx-1); - DeltaPwr += (*pTxAgcCompensate); - DBGPRINT(RT_DEBUG_TRACE, ("++ Tx Power, BBP R1=%x, TssiRef=%x, TxAgcStep=%x, step = +%d\n", - BbpR49, TssiRef, TxAgcStep, idx-1)); - } - else - { - *pTxAgcCompensate = 0; - DBGPRINT(RT_DEBUG_TRACE, (" Tx Power, BBP R49=%x, TssiRef=%x, TxAgcStep=%x, step = +%d\n", - BbpR49, TssiRef, TxAgcStep, 0)); - } - } - } - else - { - if (pAd->CommonCfg.Channel <= 14) - { - bAutoTxAgc = pAd->bAutoTxAgcG; - pTxAgcCompensate = &pAd->TxAgcCompensateG; - } - else - { - bAutoTxAgc = pAd->bAutoTxAgcA; - pTxAgcCompensate = &pAd->TxAgcCompensateA; - } - - if (bAutoTxAgc) - DeltaPwr += (*pTxAgcCompensate); - } - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &BbpR1); - BbpR1 &= 0xFC; - -#ifdef SINGLE_SKU - // Handle regulatory max tx power constrain - do - { - UCHAR TxPwrInEEPROM = 0xFF, CountryTxPwr = 0xFF, criterion; - UCHAR AdjustMaxTxPwr[40]; - - if (pAd->CommonCfg.Channel > 14) // 5G band - TxPwrInEEPROM = ((pAd->CommonCfg.DefineMaxTxPwr & 0xFF00) >> 8); - else // 2.4G band - TxPwrInEEPROM = (pAd->CommonCfg.DefineMaxTxPwr & 0x00FF); - CountryTxPwr = GetCuntryMaxTxPwr(pAd, pAd->CommonCfg.Channel); - - // error handling, range check - if ((TxPwrInEEPROM > 0x50) || (CountryTxPwr > 0x50)) - { - DBGPRINT(RT_DEBUG_ERROR,("AsicAdjustTxPower - Invalid max tx power (=0x%02x), CountryTxPwr=%d\n", TxPwrInEEPROM, CountryTxPwr)); - break; - } - - criterion = *((PUCHAR)TxPwr + 2) & 0xF; // FAE use OFDM 6M as criterion - - DBGPRINT_RAW(RT_DEBUG_TRACE,("AsicAdjustTxPower (criterion=%d, TxPwrInEEPROM=%d, CountryTxPwr=%d)\n", criterion, TxPwrInEEPROM, CountryTxPwr)); - - // Adjust max tx power according to the relationship of tx power in E2PROM - for (i=0; i<5; i++) - { - // CCK will have 4dBm larger than OFDM - // Therefore, we should separate to parse the tx power field - if (i == 0) - { - for (j=0; j<8; j++) - { - Value = (CHAR)((TxPwr[i] >> j*4) & 0x0F); - - if (j < 4) - { - // CCK will have 4dBm larger than OFDM - AdjustMaxTxPwr[i*8+j] = TxPwrInEEPROM + (Value - criterion) + 4; - } - else - { - AdjustMaxTxPwr[i*8+j] = TxPwrInEEPROM + (Value - criterion); - } - DBGPRINT_RAW(RT_DEBUG_TRACE,("AsicAdjustTxPower (i/j=%d/%d, Value=%d, %d)\n", i, j, Value, AdjustMaxTxPwr[i*8+j])); - } - } - else - { - for (j=0; j<8; j++) - { - Value = (CHAR)((TxPwr[i] >> j*4) & 0x0F); - - AdjustMaxTxPwr[i*8+j] = TxPwrInEEPROM + (Value - criterion); - DBGPRINT_RAW(RT_DEBUG_TRACE,("AsicAdjustTxPower (i/j=%d/%d, Value=%d, %d)\n", i, j, Value, AdjustMaxTxPwr[i*8+j])); - } - } - } - - // Adjust tx power according to the relationship - for (i=0; i<5; i++) - { - if (TxPwr[i] != 0xffffffff) - { - for (j=0; j<8; j++) - { - Value = (CHAR)((TxPwr[i] >> j*4) & 0x0F); - - // The system tx power is larger than the regulatory, the power should be restrain - if (AdjustMaxTxPwr[i*8+j] > CountryTxPwr) - { - // decrease to zero and don't need to take care BBPR1 - if ((Value - (AdjustMaxTxPwr[i*8+j] - CountryTxPwr)) > 0) - Value -= (AdjustMaxTxPwr[i*8+j] - CountryTxPwr); - else - Value = 0; - - DBGPRINT_RAW(RT_DEBUG_TRACE,("AsicAdjustTxPower (i/j=%d/%d, Value=%d, %d)\n", i, j, Value, AdjustMaxTxPwr[i*8+j])); - } - else - DBGPRINT_RAW(RT_DEBUG_TRACE,("AsicAdjustTxPower (i/j=%d/%d, Value=%d, %d, no change)\n", i, j, Value, AdjustMaxTxPwr[i*8+j])); - - TxPwr[i] = (TxPwr[i] & ~(0x0000000F << j*4)) | (Value << j*4); - } - } - } - } while (FALSE); -#endif // SINGLE_SKU // - - /* calculate delta power based on the percentage specified from UI */ - // E2PROM setting is calibrated for maximum TX power (i.e. 100%) - // We lower TX power here according to the percentage specified from UI - if (pAd->CommonCfg.TxPowerPercentage == 0xffffffff) // AUTO TX POWER control - { -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // to patch high power issue with some APs, like Belkin N1. - if (Rssi > -35) - { - BbpR1 |= 0x02; // DeltaPwr -= 12; - } - else if (Rssi > -40) - { - BbpR1 |= 0x01; // DeltaPwr -= 6; - } - else - ; - } -#endif // CONFIG_STA_SUPPORT // - } - else if (pAd->CommonCfg.TxPowerPercentage > 90) // 91 ~ 100% & AUTO, treat as 100% in terms of mW - ; - else if (pAd->CommonCfg.TxPowerPercentage > 60) // 61 ~ 90%, treat as 75% in terms of mW // DeltaPwr -= 1; - { - DeltaPwr -= 1; - } - else if (pAd->CommonCfg.TxPowerPercentage > 30) // 31 ~ 60%, treat as 50% in terms of mW // DeltaPwr -= 3; - { - DeltaPwr -= 3; - } - else if (pAd->CommonCfg.TxPowerPercentage > 15) // 16 ~ 30%, treat as 25% in terms of mW // DeltaPwr -= 6; - { - BbpR1 |= 0x01; - } - else if (pAd->CommonCfg.TxPowerPercentage > 9) // 10 ~ 15%, treat as 12.5% in terms of mW // DeltaPwr -= 9; - { - BbpR1 |= 0x01; - DeltaPwr -= 3; - } - else // 0 ~ 9 %, treat as MIN(~3%) in terms of mW // DeltaPwr -= 12; - { - BbpR1 |= 0x02; - } - - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R1, BbpR1); - - /* reset different new tx power for different TX rate */ - for(i=0; i<5; i++) - { - if (TxPwr[i] != 0xffffffff) - { - for (j=0; j<8; j++) - { - Value = (CHAR)((TxPwr[i] >> j*4) & 0x0F); /* 0 ~ 15 */ - - if ((Value + DeltaPwr) < 0) - { - Value = 0; /* min */ - } - else if ((Value + DeltaPwr) > 0xF) - { - Value = 0xF; /* max */ - } - else - { - Value += DeltaPwr; /* temperature compensation */ - } - - /* fill new value to CSR offset */ - TxPwr[i] = (TxPwr[i] & ~(0x0000000F << j*4)) | (Value << j*4); - } - - /* write tx power value to CSR */ - /* TX_PWR_CFG_0 (8 tx rate) for TX power for OFDM 12M/18M - TX power for OFDM 6M/9M - TX power for CCK5.5M/11M - TX power for CCK1M/2M */ - /* TX_PWR_CFG_1 ~ TX_PWR_CFG_4 */ - RTMP_IO_WRITE32(pAd, TX_PWR_CFG_0 + i*4, TxPwr[i]); - } - } - -#ifdef CARRIER_SENSE_NEW_ALGO - //KH Add to Fix PCIe Power-Saving bug<-- - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - //KH add to fix PCIe-Power Saving --> -#endif // CARRIER_SENSE_NEW_ALGO // - -} - - -#ifdef CONFIG_STA_SUPPORT -VOID AsicResetBBPAgent( -IN PRTMP_ADAPTER pAd) -{ - BBP_CSR_CFG_STRUC BbpCsr; - DBGPRINT(RT_DEBUG_ERROR, ("Reset BBP Agent busy bit.!! \n")); - // Still need to find why BBP agent keeps busy, but in fact, hardware still function ok. Now clear busy first. - RTMP_IO_READ32(pAd, H2M_BBP_AGENT, &BbpCsr.word); - BbpCsr.field.Busy = 0; - RTMP_IO_WRITE32(pAd, H2M_BBP_AGENT, BbpCsr.word); -} -/* - ========================================================================== - Description: - put PHY to sleep here, and set next wakeup timer. PHY doesn't not wakeup - automatically. Instead, MCU will issue a TwakeUpInterrupt to host after - the wakeup timer timeout. Driver has to issue a separate command to wake - PHY up. - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicSleepThenAutoWakeup( - IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp) -{ - RTMP_STA_SLEEP_THEN_AUTO_WAKEUP(pAd, TbttNumToNextWakeUp); -} - -/* - ========================================================================== - Description: - AsicForceWakeup() is used whenever manual wakeup is required - AsicForceSleep() should only be used when not in INFRA BSS. When - in INFRA BSS, we should use AsicSleepThenAutoWakeup() instead. - ========================================================================== - */ -VOID AsicForceSleep( - IN PRTMP_ADAPTER pAd) -{ - -} - -/* - ========================================================================== - Description: - AsicForceWakeup() is used whenever Twakeup timer (set via AsicSleepThenAutoWakeup) - expired. - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - ========================================================================== - */ -VOID AsicForceWakeup( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bFromTx) -{ - DBGPRINT(RT_DEBUG_INFO, ("--> AsicForceWakeup \n")); - RTMP_STA_FORCE_WAKEUP(pAd, bFromTx); -} -#endif // CONFIG_STA_SUPPORT // - - -/* - ========================================================================== - Description: - Set My BSSID - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicSetBssid( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pBssid) -{ - ULONG Addr4; - DBGPRINT(RT_DEBUG_TRACE, ("==============> AsicSetBssid %x:%x:%x:%x:%x:%x\n", - pBssid[0],pBssid[1],pBssid[2],pBssid[3], pBssid[4],pBssid[5])); - - Addr4 = (ULONG)(pBssid[0]) | - (ULONG)(pBssid[1] << 8) | - (ULONG)(pBssid[2] << 16) | - (ULONG)(pBssid[3] << 24); - RTMP_IO_WRITE32(pAd, MAC_BSSID_DW0, Addr4); - - Addr4 = 0; - // always one BSSID in STA mode - Addr4 = (ULONG)(pBssid[4]) | (ULONG)(pBssid[5] << 8); - - RTMP_IO_WRITE32(pAd, MAC_BSSID_DW1, Addr4); -} - -VOID AsicSetMcastWC( - IN PRTMP_ADAPTER pAd) -{ - MAC_TABLE_ENTRY *pEntry = &pAd->MacTab.Content[MCAST_WCID]; - USHORT offset; - - pEntry->Sst = SST_ASSOC; - pEntry->Aid = MCAST_WCID; // Softap supports 1 BSSID and use WCID=0 as multicast Wcid index - pEntry->PsMode = PWR_ACTIVE; - pEntry->CurrTxRate = pAd->CommonCfg.MlmeRate; - offset = MAC_WCID_BASE + BSS0Mcast_WCID * HW_WCID_ENTRY_SIZE; -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicDelWcidTab( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid) -{ - ULONG Addr0 = 0x0, Addr1 = 0x0; - ULONG offset; - - DBGPRINT(RT_DEBUG_TRACE, ("AsicDelWcidTab==>Wcid = 0x%x\n",Wcid)); - offset = MAC_WCID_BASE + Wcid * HW_WCID_ENTRY_SIZE; - RTMP_IO_WRITE32(pAd, offset, Addr0); - offset += 4; - RTMP_IO_WRITE32(pAd, offset, Addr1); -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicEnableRDG( - IN PRTMP_ADAPTER pAd) -{ - TX_LINK_CFG_STRUC TxLinkCfg; - UINT32 Data = 0; - - RTMP_IO_READ32(pAd, TX_LINK_CFG, &TxLinkCfg.word); - TxLinkCfg.field.TxRDGEn = 1; - RTMP_IO_WRITE32(pAd, TX_LINK_CFG, TxLinkCfg.word); - - RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &Data); - Data &= 0xFFFFFF00; - Data |= 0x80; - RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Data); - - //OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicDisableRDG( - IN PRTMP_ADAPTER pAd) -{ - TX_LINK_CFG_STRUC TxLinkCfg; - UINT32 Data = 0; - - - RTMP_IO_READ32(pAd, TX_LINK_CFG, &TxLinkCfg.word); - TxLinkCfg.field.TxRDGEn = 0; - RTMP_IO_WRITE32(pAd, TX_LINK_CFG, TxLinkCfg.word); - - RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &Data); - - Data &= 0xFFFFFF00; - //Data |= 0x20; -#ifndef WIFI_TEST - //if ( pAd->CommonCfg.bEnableTxBurst ) - // Data |= 0x60; // for performance issue not set the TXOP to 0 -#endif - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_DYNAMIC_BE_TXOP_ACTIVE) -#ifdef DOT11_N_SUPPORT - && (pAd->MacTab.fAnyStationMIMOPSDynamic == FALSE) -#endif // DOT11_N_SUPPORT // - ) - { - // For CWC test, change txop from 0x30 to 0x20 in TxBurst mode - if (pAd->CommonCfg.bEnableTxBurst) - Data |= 0x20; - } - RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Data); -} - -/* - ========================================================================== - Description: - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicDisableSync( - IN PRTMP_ADAPTER pAd) -{ - BCN_TIME_CFG_STRUC csr; - - DBGPRINT(RT_DEBUG_TRACE, ("--->Disable TSF synchronization\n")); - - // 2003-12-20 disable TSF and TBTT while NIC in power-saving have side effect - // that NIC will never wakes up because TSF stops and no more - // TBTT interrupts - pAd->TbttTickCount = 0; - RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr.word); - csr.field.bBeaconGen = 0; - csr.field.bTBTTEnable = 0; - csr.field.TsfSyncMode = 0; - csr.field.bTsfTicking = 0; - RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr.word); - -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicEnableBssSync( - IN PRTMP_ADAPTER pAd) -{ - BCN_TIME_CFG_STRUC csr; - - DBGPRINT(RT_DEBUG_TRACE, ("--->AsicEnableBssSync(INFRA mode)\n")); - - RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr.word); -// RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, 0x00000000); -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - csr.field.BeaconInterval = pAd->CommonCfg.BeaconPeriod << 4; // ASIC register in units of 1/16 TU - csr.field.bTsfTicking = 1; - csr.field.TsfSyncMode = 1; // sync TSF in INFRASTRUCTURE mode - csr.field.bBeaconGen = 0; // do NOT generate BEACON - csr.field.bTBTTEnable = 1; - } -#endif // CONFIG_STA_SUPPORT // - RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr.word); -} - -/* - ========================================================================== - Description: - Note: - BEACON frame in shared memory should be built ok before this routine - can be called. Otherwise, a garbage frame maybe transmitted out every - Beacon period. - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicEnableIbssSync( - IN PRTMP_ADAPTER pAd) -{ - BCN_TIME_CFG_STRUC csr9; - PUCHAR ptr; - UINT i; - - DBGPRINT(RT_DEBUG_TRACE, ("--->AsicEnableIbssSync(ADHOC mode. MPDUtotalByteCount = %d)\n", pAd->BeaconTxWI.MPDUtotalByteCount)); - - RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr9.word); - csr9.field.bBeaconGen = 0; - csr9.field.bTBTTEnable = 0; - csr9.field.bTsfTicking = 0; - RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr9.word); - -#ifdef RTMP_MAC_PCI - // move BEACON TXD and frame content to on-chip memory - ptr = (PUCHAR)&pAd->BeaconTxWI; - for (i=0; iBeaconBuf; - for (i=0; i< pAd->BeaconTxWI.MPDUtotalByteCount; i+=4) - { - UINT32 longptr = *ptr + (*(ptr+1)<<8) + (*(ptr+2)<<16) + (*(ptr+3)<<24); - RTMP_IO_WRITE32(pAd, HW_BEACON_BASE0 + TXWI_SIZE + i, longptr); - ptr +=4; - } -#endif // RTMP_MAC_PCI // - - - // - // For Wi-Fi faily generated beacons between participating stations. - // Set TBTT phase adaptive adjustment step to 8us (default 16us) - // don't change settings 2006-5- by Jerry - //RTMP_IO_WRITE32(pAd, TBTT_SYNC_CFG, 0x00001010); - - // start sending BEACON - csr9.field.BeaconInterval = pAd->CommonCfg.BeaconPeriod << 4; // ASIC register in units of 1/16 TU - csr9.field.bTsfTicking = 1; - csr9.field.TsfSyncMode = 2; // sync TSF in IBSS mode - csr9.field.bTBTTEnable = 1; - csr9.field.bBeaconGen = 1; - RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr9.word); -} - -/* - ========================================================================== - Description: - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicSetEdcaParm( - IN PRTMP_ADAPTER pAd, - IN PEDCA_PARM pEdcaParm) -{ - EDCA_AC_CFG_STRUC Ac0Cfg, Ac1Cfg, Ac2Cfg, Ac3Cfg; - AC_TXOP_CSR0_STRUC csr0; - AC_TXOP_CSR1_STRUC csr1; - AIFSN_CSR_STRUC AifsnCsr; - CWMIN_CSR_STRUC CwminCsr; - CWMAX_CSR_STRUC CwmaxCsr; - int i; - - Ac0Cfg.word = 0; - Ac1Cfg.word = 0; - Ac2Cfg.word = 0; - Ac3Cfg.word = 0; - if ((pEdcaParm == NULL) || (pEdcaParm->bValid == FALSE)) - { - DBGPRINT(RT_DEBUG_TRACE,("AsicSetEdcaParm\n")); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_WMM_INUSED); - for (i=0; iMacTab.Content[i].ValidAsCLI || pAd->MacTab.Content[i].ValidAsApCli) - CLIENT_STATUS_CLEAR_FLAG(&pAd->MacTab.Content[i], fCLIENT_STATUS_WMM_CAPABLE); - } - - //======================================================== - // MAC Register has a copy . - //======================================================== -//#ifndef WIFI_TEST - if( pAd->CommonCfg.bEnableTxBurst ) - { - // For CWC test, change txop from 0x30 to 0x20 in TxBurst mode - Ac0Cfg.field.AcTxop = 0x20; // Suggest by John for TxBurst in HT Mode - } - else - Ac0Cfg.field.AcTxop = 0; // QID_AC_BE -//#else -// Ac0Cfg.field.AcTxop = 0; // QID_AC_BE -//#endif - Ac0Cfg.field.Cwmin = CW_MIN_IN_BITS; - Ac0Cfg.field.Cwmax = CW_MAX_IN_BITS; - Ac0Cfg.field.Aifsn = 2; - RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Ac0Cfg.word); - - Ac1Cfg.field.AcTxop = 0; // QID_AC_BK - Ac1Cfg.field.Cwmin = CW_MIN_IN_BITS; - Ac1Cfg.field.Cwmax = CW_MAX_IN_BITS; - Ac1Cfg.field.Aifsn = 2; - RTMP_IO_WRITE32(pAd, EDCA_AC1_CFG, Ac1Cfg.word); - - if (pAd->CommonCfg.PhyMode == PHY_11B) - { - Ac2Cfg.field.AcTxop = 192; // AC_VI: 192*32us ~= 6ms - Ac3Cfg.field.AcTxop = 96; // AC_VO: 96*32us ~= 3ms - } - else - { - Ac2Cfg.field.AcTxop = 96; // AC_VI: 96*32us ~= 3ms - Ac3Cfg.field.AcTxop = 48; // AC_VO: 48*32us ~= 1.5ms - } - Ac2Cfg.field.Cwmin = CW_MIN_IN_BITS; - Ac2Cfg.field.Cwmax = CW_MAX_IN_BITS; - Ac2Cfg.field.Aifsn = 2; - RTMP_IO_WRITE32(pAd, EDCA_AC2_CFG, Ac2Cfg.word); - Ac3Cfg.field.Cwmin = CW_MIN_IN_BITS; - Ac3Cfg.field.Cwmax = CW_MAX_IN_BITS; - Ac3Cfg.field.Aifsn = 2; - RTMP_IO_WRITE32(pAd, EDCA_AC3_CFG, Ac3Cfg.word); - - //======================================================== - // DMA Register has a copy too. - //======================================================== - csr0.field.Ac0Txop = 0; // QID_AC_BE - csr0.field.Ac1Txop = 0; // QID_AC_BK - RTMP_IO_WRITE32(pAd, WMM_TXOP0_CFG, csr0.word); - if (pAd->CommonCfg.PhyMode == PHY_11B) - { - csr1.field.Ac2Txop = 192; // AC_VI: 192*32us ~= 6ms - csr1.field.Ac3Txop = 96; // AC_VO: 96*32us ~= 3ms - } - else - { - csr1.field.Ac2Txop = 96; // AC_VI: 96*32us ~= 3ms - csr1.field.Ac3Txop = 48; // AC_VO: 48*32us ~= 1.5ms - } - RTMP_IO_WRITE32(pAd, WMM_TXOP1_CFG, csr1.word); - - CwminCsr.word = 0; - CwminCsr.field.Cwmin0 = CW_MIN_IN_BITS; - CwminCsr.field.Cwmin1 = CW_MIN_IN_BITS; - CwminCsr.field.Cwmin2 = CW_MIN_IN_BITS; - CwminCsr.field.Cwmin3 = CW_MIN_IN_BITS; - RTMP_IO_WRITE32(pAd, WMM_CWMIN_CFG, CwminCsr.word); - - CwmaxCsr.word = 0; - CwmaxCsr.field.Cwmax0 = CW_MAX_IN_BITS; - CwmaxCsr.field.Cwmax1 = CW_MAX_IN_BITS; - CwmaxCsr.field.Cwmax2 = CW_MAX_IN_BITS; - CwmaxCsr.field.Cwmax3 = CW_MAX_IN_BITS; - RTMP_IO_WRITE32(pAd, WMM_CWMAX_CFG, CwmaxCsr.word); - - RTMP_IO_WRITE32(pAd, WMM_AIFSN_CFG, 0x00002222); - - NdisZeroMemory(&pAd->CommonCfg.APEdcaParm, sizeof(EDCA_PARM)); - } - else - { - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_WMM_INUSED); - //======================================================== - // MAC Register has a copy. - //======================================================== - // - // Modify Cwmin/Cwmax/Txop on queue[QID_AC_VI], Recommend by Jerry 2005/07/27 - // To degrade our VIDO Queue's throughput for WiFi WMM S3T07 Issue. - // - //pEdcaParm->Txop[QID_AC_VI] = pEdcaParm->Txop[QID_AC_VI] * 7 / 10; // rt2860c need this - - Ac0Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BE]; - Ac0Cfg.field.Cwmin= pEdcaParm->Cwmin[QID_AC_BE]; - Ac0Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_BE]; - Ac0Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BE]; //+1; - - Ac1Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BK]; - Ac1Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_BK]; //+2; - Ac1Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_BK]; - Ac1Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BK]; //+1; - - Ac2Cfg.field.AcTxop = (pEdcaParm->Txop[QID_AC_VI] * 6) / 10; - if(pAd->Antenna.field.TxPath == 1) - { - Ac2Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_VI] + 1; - Ac2Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_VI] + 1; - } - else - { - Ac2Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_VI]; - Ac2Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_VI]; - } - Ac2Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_VI] + 1; -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // - -#ifdef INF_AMAZON_SE -#endif // INF_AMAZON_SE // - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // Tuning for Wi-Fi WMM S06 - if (pAd->CommonCfg.bWiFiTest && - pEdcaParm->Aifsn[QID_AC_VI] == 10) - Ac2Cfg.field.Aifsn -= 1; - - // Tuning for TGn Wi-Fi 5.2.32 - // STA TestBed changes in this item: conexant legacy sta ==> broadcom 11n sta - if (STA_TGN_WIFI_ON(pAd) && - pEdcaParm->Aifsn[QID_AC_VI] == 10) - { - Ac0Cfg.field.Aifsn = 3; - Ac2Cfg.field.AcTxop = 5; - } - -#ifdef RT30xx - if (pAd->RfIcType == RFIC_3020 || pAd->RfIcType == RFIC_2020) - { - // Tuning for WiFi WMM S3-T07: connexant legacy sta ==> broadcom 11n sta. - Ac2Cfg.field.Aifsn = 5; - } -#endif // RT30xx // - } -#endif // CONFIG_STA_SUPPORT // - - Ac3Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_VO]; - Ac3Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_VO]; - Ac3Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_VO]; - Ac3Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_VO]; - -//#ifdef WIFI_TEST - if (pAd->CommonCfg.bWiFiTest) - { - if (Ac3Cfg.field.AcTxop == 102) - { - Ac0Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BE] ? pEdcaParm->Txop[QID_AC_BE] : 10; - Ac0Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BE]-1; /* AIFSN must >= 1 */ - Ac1Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BK]; - Ac1Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BK]; - Ac2Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_VI]; - } /* End of if */ - } -//#endif // WIFI_TEST // - - RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Ac0Cfg.word); - RTMP_IO_WRITE32(pAd, EDCA_AC1_CFG, Ac1Cfg.word); - RTMP_IO_WRITE32(pAd, EDCA_AC2_CFG, Ac2Cfg.word); - RTMP_IO_WRITE32(pAd, EDCA_AC3_CFG, Ac3Cfg.word); - - - //======================================================== - // DMA Register has a copy too. - //======================================================== - csr0.field.Ac0Txop = Ac0Cfg.field.AcTxop; - csr0.field.Ac1Txop = Ac1Cfg.field.AcTxop; - RTMP_IO_WRITE32(pAd, WMM_TXOP0_CFG, csr0.word); - - csr1.field.Ac2Txop = Ac2Cfg.field.AcTxop; - csr1.field.Ac3Txop = Ac3Cfg.field.AcTxop; - RTMP_IO_WRITE32(pAd, WMM_TXOP1_CFG, csr1.word); - - CwminCsr.word = 0; - CwminCsr.field.Cwmin0 = pEdcaParm->Cwmin[QID_AC_BE]; - CwminCsr.field.Cwmin1 = pEdcaParm->Cwmin[QID_AC_BK]; - CwminCsr.field.Cwmin2 = pEdcaParm->Cwmin[QID_AC_VI]; -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - CwminCsr.field.Cwmin3 = pEdcaParm->Cwmin[QID_AC_VO] - 1; //for TGn wifi test -#endif // CONFIG_STA_SUPPORT // - RTMP_IO_WRITE32(pAd, WMM_CWMIN_CFG, CwminCsr.word); - - CwmaxCsr.word = 0; - CwmaxCsr.field.Cwmax0 = pEdcaParm->Cwmax[QID_AC_BE]; - CwmaxCsr.field.Cwmax1 = pEdcaParm->Cwmax[QID_AC_BK]; - CwmaxCsr.field.Cwmax2 = pEdcaParm->Cwmax[QID_AC_VI]; - CwmaxCsr.field.Cwmax3 = pEdcaParm->Cwmax[QID_AC_VO]; - RTMP_IO_WRITE32(pAd, WMM_CWMAX_CFG, CwmaxCsr.word); - - AifsnCsr.word = 0; - AifsnCsr.field.Aifsn0 = Ac0Cfg.field.Aifsn; //pEdcaParm->Aifsn[QID_AC_BE]; - AifsnCsr.field.Aifsn1 = Ac1Cfg.field.Aifsn; //pEdcaParm->Aifsn[QID_AC_BK]; - AifsnCsr.field.Aifsn2 = Ac2Cfg.field.Aifsn; //pEdcaParm->Aifsn[QID_AC_VI]; -#ifdef INF_AMAZON_SE -#endif // INF_AMAZON_SE // - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // Tuning for Wi-Fi WMM S06 - if (pAd->CommonCfg.bWiFiTest && - pEdcaParm->Aifsn[QID_AC_VI] == 10) - AifsnCsr.field.Aifsn2 = Ac2Cfg.field.Aifsn - 4; - - // Tuning for TGn Wi-Fi 5.2.32 - // STA TestBed changes in this item: connexant legacy sta ==> broadcom 11n sta - if (STA_TGN_WIFI_ON(pAd) && - pEdcaParm->Aifsn[QID_AC_VI] == 10) - { - AifsnCsr.field.Aifsn0 = 3; - AifsnCsr.field.Aifsn2 = 7; - } - - if (INFRA_ON(pAd)) - CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[BSSID_WCID], fCLIENT_STATUS_WMM_CAPABLE); - } -#endif // CONFIG_STA_SUPPORT // - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - AifsnCsr.field.Aifsn3 = Ac3Cfg.field.Aifsn - 1; //pEdcaParm->Aifsn[QID_AC_VO]; //for TGn wifi test -#ifdef RT30xx - // TODO: Shiang, this modification also suitable for RT3052/RT3050 ??? - if (pAd->RfIcType == RFIC_3020 || pAd->RfIcType == RFIC_2020) - { - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - AifsnCsr.field.Aifsn2 = 0x2; //pEdcaParm->Aifsn[QID_AC_VI]; //for WiFi WMM S4-T04. - } -#endif // RT30xx // - } -#endif // CONFIG_STA_SUPPORT // - RTMP_IO_WRITE32(pAd, WMM_AIFSN_CFG, AifsnCsr.word); - - NdisMoveMemory(&pAd->CommonCfg.APEdcaParm, pEdcaParm, sizeof(EDCA_PARM)); - if (!ADHOC_ON(pAd)) - { - DBGPRINT(RT_DEBUG_TRACE,("EDCA [#%d]: AIFSN CWmin CWmax TXOP(us) ACM\n", pEdcaParm->EdcaUpdateCount)); - DBGPRINT(RT_DEBUG_TRACE,(" AC_BE %2d %2d %2d %4d %d\n", - pEdcaParm->Aifsn[0], - pEdcaParm->Cwmin[0], - pEdcaParm->Cwmax[0], - pEdcaParm->Txop[0]<<5, - pEdcaParm->bACM[0])); - DBGPRINT(RT_DEBUG_TRACE,(" AC_BK %2d %2d %2d %4d %d\n", - pEdcaParm->Aifsn[1], - pEdcaParm->Cwmin[1], - pEdcaParm->Cwmax[1], - pEdcaParm->Txop[1]<<5, - pEdcaParm->bACM[1])); - DBGPRINT(RT_DEBUG_TRACE,(" AC_VI %2d %2d %2d %4d %d\n", - pEdcaParm->Aifsn[2], - pEdcaParm->Cwmin[2], - pEdcaParm->Cwmax[2], - pEdcaParm->Txop[2]<<5, - pEdcaParm->bACM[2])); - DBGPRINT(RT_DEBUG_TRACE,(" AC_VO %2d %2d %2d %4d %d\n", - pEdcaParm->Aifsn[3], - pEdcaParm->Cwmin[3], - pEdcaParm->Cwmax[3], - pEdcaParm->Txop[3]<<5, - pEdcaParm->bACM[3])); - } - } - -} - -/* - ========================================================================== - Description: - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicSetSlotTime( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bUseShortSlotTime) -{ - ULONG SlotTime; - UINT32 RegValue = 0; - -#ifdef CONFIG_STA_SUPPORT - if (pAd->CommonCfg.Channel > 14) - bUseShortSlotTime = TRUE; -#endif // CONFIG_STA_SUPPORT // - - if (bUseShortSlotTime && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED)) - return; - else if ((!bUseShortSlotTime) && (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED))) - return; - - if (bUseShortSlotTime) - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED); - else - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED); - - SlotTime = (bUseShortSlotTime)? 9 : 20; - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // force using short SLOT time for FAE to demo performance when TxBurst is ON - if (((pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) && (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED))) -#ifdef DOT11_N_SUPPORT - || ((pAd->StaActive.SupportedPhyInfo.bHtEnable == TRUE) && (pAd->CommonCfg.BACapability.field.Policy == BA_NOTUSE)) -#endif // DOT11_N_SUPPORT // - ) - { - // In this case, we will think it is doing Wi-Fi test - // And we will not set to short slot when bEnableTxBurst is TRUE. - } - else if (pAd->CommonCfg.bEnableTxBurst) - { - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED); - SlotTime = 9; - } - } -#endif // CONFIG_STA_SUPPORT // - - // - // For some reasons, always set it to short slot time. - // - // ToDo: Should consider capability with 11B - // -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (pAd->StaCfg.BssType == BSS_ADHOC) - { - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED); - SlotTime = 20; - } - } -#endif // CONFIG_STA_SUPPORT // - - RTMP_IO_READ32(pAd, BKOFF_SLOT_CFG, &RegValue); - RegValue = RegValue & 0xFFFFFF00; - - RegValue |= SlotTime; - - RTMP_IO_WRITE32(pAd, BKOFF_SLOT_CFG, RegValue); -} - -/* - ======================================================================== - Description: - Add Shared key information into ASIC. - Update shared key, TxMic and RxMic to Asic Shared key table - Update its cipherAlg to Asic Shared key Mode. - - Return: - ======================================================================== -*/ -VOID AsicAddSharedKeyEntry( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssIndex, - IN UCHAR KeyIdx, - IN UCHAR CipherAlg, - IN PUCHAR pKey, - IN PUCHAR pTxMic, - IN PUCHAR pRxMic) -{ - ULONG offset; //, csr0; - SHAREDKEY_MODE_STRUC csr1; -#ifdef RTMP_MAC_PCI - INT i; -#endif // RTMP_MAC_PCI // - - DBGPRINT(RT_DEBUG_TRACE, ("AsicAddSharedKeyEntry BssIndex=%d, KeyIdx=%d\n", BssIndex,KeyIdx)); -//============================================================================================ - - DBGPRINT(RT_DEBUG_TRACE,("AsicAddSharedKeyEntry: %s key #%d\n", CipherName[CipherAlg], BssIndex*4 + KeyIdx)); - DBGPRINT_RAW(RT_DEBUG_TRACE, (" Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", - pKey[0],pKey[1],pKey[2],pKey[3],pKey[4],pKey[5],pKey[6],pKey[7],pKey[8],pKey[9],pKey[10],pKey[11],pKey[12],pKey[13],pKey[14],pKey[15])); - if (pRxMic) - { - DBGPRINT_RAW(RT_DEBUG_TRACE, (" Rx MIC Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", - pRxMic[0],pRxMic[1],pRxMic[2],pRxMic[3],pRxMic[4],pRxMic[5],pRxMic[6],pRxMic[7])); - } - if (pTxMic) - { - DBGPRINT_RAW(RT_DEBUG_TRACE, (" Tx MIC Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", - pTxMic[0],pTxMic[1],pTxMic[2],pTxMic[3],pTxMic[4],pTxMic[5],pTxMic[6],pTxMic[7])); - } -//============================================================================================ - // - // fill key material - key + TX MIC + RX MIC - // -#ifdef RTMP_MAC_PCI - offset = SHARED_KEY_TABLE_BASE + (4*BssIndex + KeyIdx)*HW_KEY_ENTRY_SIZE; - for (i=0; iKey; -// ULONG KeyLen = pCipherKey->KeyLen; - PUCHAR pTxMic = pCipherKey->TxMic; - PUCHAR pRxMic = pCipherKey->RxMic; - PUCHAR pTxtsc = pCipherKey->TxTsc; - UCHAR CipherAlg = pCipherKey->CipherAlg; - SHAREDKEY_MODE_STRUC csr1; -#ifdef RTMP_MAC_PCI - UCHAR i; -#endif // RTMP_MAC_PCI // - -// ASSERT(KeyLen <= MAX_LEN_OF_PEER_KEY); - - DBGPRINT(RT_DEBUG_TRACE, ("==> AsicAddKeyEntry\n")); - // - // 1.) decide key table offset - // - if (bUsePairewiseKeyTable) - offset = PAIRWISE_KEY_TABLE_BASE + (WCID * HW_KEY_ENTRY_SIZE); - else - offset = SHARED_KEY_TABLE_BASE + (4 * BssIndex + KeyIdx) * HW_KEY_ENTRY_SIZE; - - // - // 2.) Set Key to Asic - // - //for (i = 0; i < KeyLen; i++) -#ifdef RTMP_MAC_PCI - for (i = 0; i < MAX_LEN_OF_PEER_KEY; i++) - { - RTMP_IO_WRITE8(pAd, offset + i, pKey[i]); - } - offset += MAX_LEN_OF_PEER_KEY; - - // - // 3.) Set MIC key if available - // - if (pTxMic) - { - for (i = 0; i < 8; i++) - { - RTMP_IO_WRITE8(pAd, offset + i, pTxMic[i]); - } - } - offset += LEN_TKIP_TXMICK; - - if (pRxMic) - { - for (i = 0; i < 8; i++) - { - RTMP_IO_WRITE8(pAd, offset + i, pRxMic[i]); - } - } -#endif // RTMP_MAC_PCI // - - - // - // 4.) Modify IV/EIV if needs - // This will force Asic to use this key ID by setting IV. - // - if (bTxKey) - { -#ifdef RTMP_MAC_PCI - offset = MAC_IVEIV_TABLE_BASE + (WCID * HW_IVEIV_ENTRY_SIZE); - // - // Write IV - // - RTMP_IO_WRITE8(pAd, offset, pTxtsc[1]); - RTMP_IO_WRITE8(pAd, offset + 1, ((pTxtsc[1] | 0x20) & 0x7f)); - RTMP_IO_WRITE8(pAd, offset + 2, pTxtsc[0]); - - IV4 = (KeyIdx << 6); - if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) ||(CipherAlg == CIPHER_AES)) - IV4 |= 0x20; // turn on extension bit means EIV existence - - RTMP_IO_WRITE8(pAd, offset + 3, IV4); - - // - // Write EIV - // - offset += 4; - for (i = 0; i < 4; i++) - { - RTMP_IO_WRITE8(pAd, offset + i, pTxtsc[i + 2]); - } -#endif // RTMP_MAC_PCI // - - AsicUpdateWCIDAttribute(pAd, WCID, BssIndex, CipherAlg, bUsePairewiseKeyTable); - } - - if (!bUsePairewiseKeyTable) - { - // - // Only update the shared key security mode - // - RTMP_IO_READ32(pAd, SHARED_KEY_MODE_BASE + 4 * (BssIndex / 2), &csr1.word); - if ((BssIndex % 2) == 0) - { - if (KeyIdx == 0) - csr1.field.Bss0Key0CipherAlg = CipherAlg; - else if (KeyIdx == 1) - csr1.field.Bss0Key1CipherAlg = CipherAlg; - else if (KeyIdx == 2) - csr1.field.Bss0Key2CipherAlg = CipherAlg; - else - csr1.field.Bss0Key3CipherAlg = CipherAlg; - } - else - { - if (KeyIdx == 0) - csr1.field.Bss1Key0CipherAlg = CipherAlg; - else if (KeyIdx == 1) - csr1.field.Bss1Key1CipherAlg = CipherAlg; - else if (KeyIdx == 2) - csr1.field.Bss1Key2CipherAlg = CipherAlg; - else - csr1.field.Bss1Key3CipherAlg = CipherAlg; - } - RTMP_IO_WRITE32(pAd, SHARED_KEY_MODE_BASE + 4 * (BssIndex / 2), csr1.word); - } - - DBGPRINT(RT_DEBUG_TRACE, ("<== AsicAddKeyEntry\n")); -} - - -/* - ======================================================================== - Description: - Add Pair-wise key material into ASIC. - Update pairwise key, TxMic and RxMic to Asic Pair-wise key table - - Return: - ======================================================================== -*/ -VOID AsicAddPairwiseKeyEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR WCID, - IN CIPHER_KEY *pCipherKey) -{ - INT i; - ULONG offset; - PUCHAR pKey = pCipherKey->Key; - PUCHAR pTxMic = pCipherKey->TxMic; - PUCHAR pRxMic = pCipherKey->RxMic; -#ifdef DBG - UCHAR CipherAlg = pCipherKey->CipherAlg; -#endif // DBG // - - // EKEY - offset = PAIRWISE_KEY_TABLE_BASE + (WCID * HW_KEY_ENTRY_SIZE); -#ifdef RTMP_MAC_PCI - for (i=0; ichipOps.sendCommandToMcu) - pAd->chipOps.sendCommandToMcu(pAd, Command, Token, Arg0, Arg1); - - return TRUE; -} - - -VOID AsicSetRxAnt( - IN PRTMP_ADAPTER pAd, - IN UCHAR Ant) -{ -#ifdef RT33xx - RT33xxSetRxAnt(pAd, Ant); -#else -#ifdef RT30xx - /* RT3572 ATE need not to do this. */ - RT30xxSetRxAnt(pAd, Ant); -#endif // RT30xx // -#endif // RT33xx // -} - - -VOID AsicTurnOffRFClk( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel) -{ - if (pAd->chipOps.AsicRfTurnOff) - { - pAd->chipOps.AsicRfTurnOff(pAd); - } - else - { - // RF R2 bit 18 = 0 - UINT32 R1 = 0, R2 = 0, R3 = 0; - UCHAR index; - RTMP_RF_REGS *RFRegTable; - - RFRegTable = RF2850RegTable; - - switch (pAd->RfIcType) - { - case RFIC_2820: - case RFIC_2850: - case RFIC_2720: - case RFIC_2750: - - for (index = 0; index < NUM_OF_2850_CHNL; index++) - { - if (Channel == RFRegTable[index].Channel) - { - R1 = RFRegTable[index].R1 & 0xffffdfff; - R2 = RFRegTable[index].R2 & 0xfffbffff; - R3 = RFRegTable[index].R3 & 0xfff3ffff; - - RTMP_RF_IO_WRITE32(pAd, R1); - RTMP_RF_IO_WRITE32(pAd, R2); - - // Program R1b13 to 1, R3/b18,19 to 0, R2b18 to 0. - // Set RF R2 bit18=0, R3 bit[18:19]=0 - //if (pAd->StaCfg.bRadio == FALSE) - if (1) - { - RTMP_RF_IO_WRITE32(pAd, R3); - - DBGPRINT(RT_DEBUG_TRACE, ("AsicTurnOffRFClk#%d(RF=%d, ) , R2=0x%08x, R3 = 0x%08x \n", - Channel, pAd->RfIcType, R2, R3)); - } - else - DBGPRINT(RT_DEBUG_TRACE, ("AsicTurnOffRFClk#%d(RF=%d, ) , R2=0x%08x \n", - Channel, pAd->RfIcType, R2)); - break; - } - } - break; - - default: - break; - } - } -} - - -VOID AsicTurnOnRFClk( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel) -{ - // RF R2 bit 18 = 0 - UINT32 R1 = 0, R2 = 0, R3 = 0; - UCHAR index; - RTMP_RF_REGS *RFRegTable; - -#ifdef PCIE_PS_SUPPORT - // The RF programming sequence is difference between 3xxx and 2xxx - if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) - { - return; - } -#endif // PCIE_PS_SUPPORT // - - RFRegTable = RF2850RegTable; - - switch (pAd->RfIcType) - { - case RFIC_2820: - case RFIC_2850: - case RFIC_2720: - case RFIC_2750: - - for (index = 0; index < NUM_OF_2850_CHNL; index++) - { - if (Channel == RFRegTable[index].Channel) - { - R3 = pAd->LatchRfRegs.R3; - R3 &= 0xfff3ffff; - R3 |= 0x00080000; - RTMP_RF_IO_WRITE32(pAd, R3); - - R1 = RFRegTable[index].R1; - RTMP_RF_IO_WRITE32(pAd, R1); - - R2 = RFRegTable[index].R2; - if (pAd->Antenna.field.TxPath == 1) - { - R2 |= 0x4000; // If TXpath is 1, bit 14 = 1; - } - - if (pAd->Antenna.field.RxPath == 2) - { - R2 |= 0x40; // write 1 to off Rxpath. - } - else if (pAd->Antenna.field.RxPath == 1) - { - R2 |= 0x20040; // write 1 to off RxPath - } - RTMP_RF_IO_WRITE32(pAd, R2); - - break; - } - } - break; - - default: - break; - } - - DBGPRINT(RT_DEBUG_TRACE, ("AsicTurnOnRFClk#%d(RF=%d, ) , R2=0x%08x\n", - Channel, - pAd->RfIcType, - R2)); -} diff --git a/drivers/staging/rt3090/common/cmm_cfg.c b/drivers/staging/rt3090/common/cmm_cfg.c deleted file mode 100644 index d8be9793c61b..000000000000 --- a/drivers/staging/rt3090/common/cmm_cfg.c +++ /dev/null @@ -1,295 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - cmm_cfg.c - - Abstract: - Ralink WiFi Driver configuration related subroutines - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- -*/ - -#include "../rt_config.h" - - -char* GetPhyMode( - int Mode) -{ - switch(Mode) - { - case MODE_CCK: - return "CCK"; - - case MODE_OFDM: - return "OFDM"; -#ifdef DOT11_N_SUPPORT - case MODE_HTMIX: - return "HTMIX"; - - case MODE_HTGREENFIELD: - return "GREEN"; -#endif // DOT11_N_SUPPORT // - default: - return "N/A"; - } -} - - -char* GetBW( - int BW) -{ - switch(BW) - { - case BW_10: - return "10M"; - - case BW_20: - return "20M"; -#ifdef DOT11_N_SUPPORT - case BW_40: - return "40M"; -#endif // DOT11_N_SUPPORT // - default: - return "N/A"; - } -} - - -/* - ========================================================================== - Description: - Set Country Region to pAd->CommonCfg.CountryRegion. - This command will not work, if the field of CountryRegion in eeprom is programmed. - - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT RT_CfgSetCountryRegion( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg, - IN INT band) -{ - LONG region, regionMax; - UCHAR *pCountryRegion; - - region = simple_strtol(arg, 0, 10); - - if (band == BAND_24G) - { - pCountryRegion = &pAd->CommonCfg.CountryRegion; - regionMax = REGION_MAXIMUM_BG_BAND; - } - else - { - pCountryRegion = &pAd->CommonCfg.CountryRegionForABand; - regionMax = REGION_MAXIMUM_A_BAND; - } - - // TODO: Is it neccesay for following check??? - // Country can be set only when EEPROM not programmed - if (*pCountryRegion & 0x80) - { - DBGPRINT(RT_DEBUG_ERROR, ("CfgSetCountryRegion():CountryRegion in eeprom was programmed\n")); - return FALSE; - } - - if((region >= 0) && (region <= REGION_MAXIMUM_BG_BAND)) - { - *pCountryRegion= (UCHAR) region; - } - else if ((region == REGION_31_BG_BAND) && (band == BAND_24G)) - { - *pCountryRegion = (UCHAR) region; - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("CfgSetCountryRegion():region(%ld) out of range!\n", region)); - return FALSE; - } - - return TRUE; - -} - - -/* - ========================================================================== - Description: - Set Wireless Mode - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT RT_CfgSetWirelessMode( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - INT MaxPhyMode = PHY_11G; - LONG WirelessMode; - -#ifdef DOT11_N_SUPPORT - MaxPhyMode = PHY_11N_5G; -#endif // DOT11_N_SUPPORT // - - WirelessMode = simple_strtol(arg, 0, 10); - if (WirelessMode <= MaxPhyMode) - { - pAd->CommonCfg.PhyMode = WirelessMode; - pAd->CommonCfg.DesiredPhyMode = WirelessMode; - return TRUE; - } - - return FALSE; - -} - - -INT RT_CfgSetShortSlot( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - LONG ShortSlot; - - ShortSlot = simple_strtol(arg, 0, 10); - - if (ShortSlot == 1) - pAd->CommonCfg.bUseShortSlotTime = TRUE; - else if (ShortSlot == 0) - pAd->CommonCfg.bUseShortSlotTime = FALSE; - else - return FALSE; //Invalid argument - - return TRUE; -} - - -/* - ========================================================================== - Description: - Set WEP KEY base on KeyIdx - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT RT_CfgSetWepKey( - IN PRTMP_ADAPTER pAd, - IN PSTRING keyString, - IN CIPHER_KEY *pSharedKey, - IN INT keyIdx) -{ - INT KeyLen; - INT i; - UCHAR CipherAlg = CIPHER_NONE; - BOOLEAN bKeyIsHex = FALSE; - - // TODO: Shall we do memset for the original key info?? - memset(pSharedKey, 0, sizeof(CIPHER_KEY)); - KeyLen = strlen(keyString); - switch (KeyLen) - { - case 5: //wep 40 Ascii type - case 13: //wep 104 Ascii type - bKeyIsHex = FALSE; - pSharedKey->KeyLen = KeyLen; - NdisMoveMemory(pSharedKey->Key, keyString, KeyLen); - break; - - case 10: //wep 40 Hex type - case 26: //wep 104 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(keyString+i)) ) - return FALSE; //Not Hex value; - } - bKeyIsHex = TRUE; - pSharedKey->KeyLen = KeyLen/2 ; - AtoH(keyString, pSharedKey->Key, pSharedKey->KeyLen); - break; - - default: //Invalid argument - DBGPRINT(RT_DEBUG_TRACE, ("RT_CfgSetWepKey(keyIdx=%d):Invalid argument (arg=%s)\n", keyIdx, keyString)); - return FALSE; - } - - pSharedKey->CipherAlg = ((KeyLen % 5) ? CIPHER_WEP128 : CIPHER_WEP64); - DBGPRINT(RT_DEBUG_TRACE, ("RT_CfgSetWepKey:(KeyIdx=%d,type=%s, Alg=%s)\n", - keyIdx, (bKeyIsHex == FALSE ? "Ascii" : "Hex"), CipherName[CipherAlg])); - - return TRUE; -} - - -/* - ========================================================================== - Description: - Set WPA PSK key - - Arguments: - pAdapter Pointer to our adapter - keyString WPA pre-shared key string - pHashStr String used for password hash function - hashStrLen Lenght of the hash string - pPMKBuf Output buffer of WPAPSK key - - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT RT_CfgSetWPAPSKKey( - IN RTMP_ADAPTER *pAd, - IN PSTRING keyString, - IN UCHAR *pHashStr, - IN INT hashStrLen, - OUT PUCHAR pPMKBuf) -{ - int keyLen; - UCHAR keyMaterial[40]; - - keyLen = strlen(keyString); - if ((keyLen < 8) || (keyLen > 64)) - { - DBGPRINT(RT_DEBUG_TRACE, ("WPAPSK Key length(%d) error, required 8 ~ 64 characters!(keyStr=%s)\n", - keyLen, keyString)); - return FALSE; - } - - memset(pPMKBuf, 0, 32); - if (keyLen == 64) - { - AtoH(keyString, pPMKBuf, 32); - } - else - { - PasswordHash(keyString, pHashStr, hashStrLen, keyMaterial); - NdisMoveMemory(pPMKBuf, keyMaterial, 32); - } - - return TRUE; -} diff --git a/drivers/staging/rt3090/common/cmm_data.c b/drivers/staging/rt3090/common/cmm_data.c deleted file mode 100644 index 634007163160..000000000000 --- a/drivers/staging/rt3090/common/cmm_data.c +++ /dev/null @@ -1,2763 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - cmm_data.c - - Abstract: - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- - */ - -#include "../rt_config.h" - - -UCHAR SNAP_802_1H[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; -UCHAR SNAP_BRIDGE_TUNNEL[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8}; -// Add Cisco Aironet SNAP heade for CCX2 support -UCHAR SNAP_AIRONET[] = {0xaa, 0xaa, 0x03, 0x00, 0x40, 0x96, 0x00, 0x00}; -UCHAR CKIP_LLC_SNAP[] = {0xaa, 0xaa, 0x03, 0x00, 0x40, 0x96, 0x00, 0x02}; -UCHAR EAPOL_LLC_SNAP[]= {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8e}; -UCHAR EAPOL[] = {0x88, 0x8e}; -UCHAR TPID[] = {0x81, 0x00}; /* VLAN related */ - -UCHAR IPX[] = {0x81, 0x37}; -UCHAR APPLE_TALK[] = {0x80, 0xf3}; -UCHAR RateIdToPlcpSignal[12] = { - 0, /* RATE_1 */ 1, /* RATE_2 */ 2, /* RATE_5_5 */ 3, /* RATE_11 */ // see BBP spec - 11, /* RATE_6 */ 15, /* RATE_9 */ 10, /* RATE_12 */ 14, /* RATE_18 */ // see IEEE802.11a-1999 p.14 - 9, /* RATE_24 */ 13, /* RATE_36 */ 8, /* RATE_48 */ 12 /* RATE_54 */ }; // see IEEE802.11a-1999 p.14 - -UCHAR OfdmSignalToRateId[16] = { - RATE_54, RATE_54, RATE_54, RATE_54, // OFDM PLCP Signal = 0, 1, 2, 3 respectively - RATE_54, RATE_54, RATE_54, RATE_54, // OFDM PLCP Signal = 4, 5, 6, 7 respectively - RATE_48, RATE_24, RATE_12, RATE_6, // OFDM PLCP Signal = 8, 9, 10, 11 respectively - RATE_54, RATE_36, RATE_18, RATE_9, // OFDM PLCP Signal = 12, 13, 14, 15 respectively -}; - -UCHAR OfdmRateToRxwiMCS[12] = { - 0, 0, 0, 0, - 0, 1, 2, 3, // OFDM rate 6,9,12,18 = rxwi mcs 0,1,2,3 - 4, 5, 6, 7, // OFDM rate 24,36,48,54 = rxwi mcs 4,5,6,7 -}; -UCHAR RxwiMCSToOfdmRate[12] = { - RATE_6, RATE_9, RATE_12, RATE_18, - RATE_24, RATE_36, RATE_48, RATE_54, // OFDM rate 6,9,12,18 = rxwi mcs 0,1,2,3 - 4, 5, 6, 7, // OFDM rate 24,36,48,54 = rxwi mcs 4,5,6,7 -}; - -char* MCSToMbps[] = {"1Mbps","2Mbps","5.5Mbps","11Mbps","06Mbps","09Mbps","12Mbps","18Mbps","24Mbps","36Mbps","48Mbps","54Mbps","MM-0","MM-1","MM-2","MM-3","MM-4","MM-5","MM-6","MM-7","MM-8","MM-9","MM-10","MM-11","MM-12","MM-13","MM-14","MM-15","MM-32","ee1","ee2","ee3"}; - -UCHAR default_cwmin[]={CW_MIN_IN_BITS, CW_MIN_IN_BITS, CW_MIN_IN_BITS-1, CW_MIN_IN_BITS-2}; -//UCHAR default_cwmax[]={CW_MAX_IN_BITS, CW_MAX_IN_BITS, CW_MIN_IN_BITS, CW_MIN_IN_BITS-1}; -UCHAR default_sta_aifsn[]={3,7,2,2}; - -UCHAR MapUserPriorityToAccessCategory[8] = {QID_AC_BE, QID_AC_BK, QID_AC_BK, QID_AC_BE, QID_AC_VI, QID_AC_VI, QID_AC_VO, QID_AC_VO}; - - -/* - ======================================================================== - - Routine Description: - API for MLME to transmit management frame to AP (BSS Mode) - or station (IBSS Mode) - - Arguments: - pAd Pointer to our adapter - pData Pointer to the outgoing 802.11 frame - Length Size of outgoing management frame - - Return Value: - NDIS_STATUS_FAILURE - NDIS_STATUS_PENDING - NDIS_STATUS_SUCCESS - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -NDIS_STATUS MiniportMMRequest( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PUCHAR pData, - IN UINT Length) -{ - PNDIS_PACKET pPacket; - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - ULONG FreeNum; - UCHAR rtmpHwHdr[TXINFO_SIZE + TXWI_SIZE]; //RTMP_HW_HDR_LEN]; -#ifdef RTMP_MAC_PCI - unsigned long IrqFlags = 0; - UCHAR IrqState; -#endif // RTMP_MAC_PCI // - BOOLEAN bUseDataQ = FALSE; - int retryCnt = 0; - - ASSERT(Length <= MGMT_DMA_BUFFER_SIZE); - - if ((QueIdx & MGMT_USE_QUEUE_FLAG) == MGMT_USE_QUEUE_FLAG) - { - bUseDataQ = TRUE; - QueIdx &= (~MGMT_USE_QUEUE_FLAG); - } - -#ifdef RTMP_MAC_PCI - // 2860C use Tx Ring - IrqState = pAd->irq_disabled; - if (pAd->MACVersion == 0x28600100) - { - QueIdx = (bUseDataQ ==TRUE ? QueIdx : 3); - bUseDataQ = TRUE; - } - if (bUseDataQ && (!IrqState)) - RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); -#endif // RTMP_MAC_PCI // - - do - { - // Reset is in progress, stop immediately - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)|| - !RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_START_UP)) - { - Status = NDIS_STATUS_FAILURE; - break; - } - - // Check Free priority queue - // Since we use PBF Queue2 for management frame. Its corresponding DMA ring should be using TxRing. -#ifdef RTMP_MAC_PCI - if (bUseDataQ) - { - retryCnt = MAX_DATAMM_RETRY; - // free Tx(QueIdx) resources - RTMPFreeTXDUponTxDmaDone(pAd, QueIdx); - FreeNum = GET_TXRING_FREENO(pAd, QueIdx); - } - else -#endif // RTMP_MAC_PCI // - { - FreeNum = GET_MGMTRING_FREENO(pAd); - } - - if ((FreeNum > 0)) - { - // We need to reserve space for rtmp hardware header. i.e., TxWI for RT2860 and TxInfo+TxWI for RT2870 - NdisZeroMemory(&rtmpHwHdr, (TXINFO_SIZE + TXWI_SIZE)); - Status = RTMPAllocateNdisPacket(pAd, &pPacket, (PUCHAR)&rtmpHwHdr, (TXINFO_SIZE + TXWI_SIZE), pData, Length); - if (Status != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_WARN, ("MiniportMMRequest (error:: can't allocate NDIS PACKET)\n")); - break; - } - - //pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_CCK; - //pAd->CommonCfg.MlmeRate = RATE_2; - - -#ifdef RTMP_MAC_PCI - if (bUseDataQ) - { - Status = MlmeDataHardTransmit(pAd, QueIdx, pPacket); - retryCnt--; - } - else -#endif // RTMP_MAC_PCI // - Status = MlmeHardTransmit(pAd, QueIdx, pPacket); - if (Status == NDIS_STATUS_SUCCESS) - retryCnt = 0; - else - RTMPFreeNdisPacket(pAd, pPacket); - } - else - { - pAd->RalinkCounters.MgmtRingFullCount++; -#ifdef RTMP_MAC_PCI - if (bUseDataQ) - { - retryCnt--; - DBGPRINT(RT_DEBUG_TRACE, ("retryCnt %d\n", retryCnt)); - if (retryCnt == 0) - { - DBGPRINT(RT_DEBUG_ERROR, ("Qidx(%d), not enough space in DataRing, MgmtRingFullCount=%ld!\n", - QueIdx, pAd->RalinkCounters.MgmtRingFullCount)); - } - } -#endif // RTMP_MAC_PCI // - DBGPRINT(RT_DEBUG_ERROR, ("Qidx(%d), not enough space in MgmtRing, MgmtRingFullCount=%ld!\n", - QueIdx, pAd->RalinkCounters.MgmtRingFullCount)); - - - - } - } while (retryCnt > 0); - - -#ifdef RTMP_MAC_PCI - if (bUseDataQ && (!IrqState)) - RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); -#endif // RTMP_MAC_PCI // - - return Status; -} - - - - -/* - ======================================================================== - - Routine Description: - Copy frame from waiting queue into relative ring buffer and set - appropriate ASIC register to kick hardware transmit function - - Arguments: - pAd Pointer to our adapter - pBuffer Pointer to memory of outgoing frame - Length Size of outgoing management frame - - Return Value: - NDIS_STATUS_FAILURE - NDIS_STATUS_PENDING - NDIS_STATUS_SUCCESS - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -NDIS_STATUS MlmeHardTransmit( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket) -{ - PACKET_INFO PacketInfo; - PUCHAR pSrcBufVA; - UINT SrcBufLen; - PHEADER_802_11 pHeader_802_11; - - if ((pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) -#ifdef CARRIER_DETECTION_SUPPORT -#endif // CARRIER_DETECTION_SUPPORT // - ) - { - return NDIS_STATUS_FAILURE; - } - - RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); - if (pSrcBufVA == NULL) - return NDIS_STATUS_FAILURE; - - pHeader_802_11 = (PHEADER_802_11) (pSrcBufVA + TXINFO_SIZE + TXWI_SIZE); - - -#ifdef RTMP_MAC_PCI - if ( pAd->MACVersion == 0x28600100 ) - return MlmeHardTransmitTxRing(pAd,QueIdx,pPacket); - else -#endif // RTMP_MAC_PCI // - return MlmeHardTransmitMgmtRing(pAd,QueIdx,pPacket); - -} - - -NDIS_STATUS MlmeHardTransmitMgmtRing( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket) -{ - PACKET_INFO PacketInfo; - PUCHAR pSrcBufVA; - UINT SrcBufLen; - PHEADER_802_11 pHeader_802_11; - BOOLEAN bAckRequired, bInsertTimestamp; - UCHAR MlmeRate; - PTXWI_STRUC pFirstTxWI; - MAC_TABLE_ENTRY *pMacEntry = NULL; - UCHAR PID; - - RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); - - // Make sure MGMT ring resource won't be used by other threads - RTMP_SEM_LOCK(&pAd->MgmtRingLock); - if (pSrcBufVA == NULL) - { - // The buffer shouldn't be NULL - RTMP_SEM_UNLOCK(&pAd->MgmtRingLock); - return NDIS_STATUS_FAILURE; - } - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // outgoing frame always wakeup PHY to prevent frame lost - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - AsicForceWakeup(pAd, TRUE); - } -#endif // CONFIG_STA_SUPPORT // - - pFirstTxWI = (PTXWI_STRUC)(pSrcBufVA + TXINFO_SIZE); - pHeader_802_11 = (PHEADER_802_11) (pSrcBufVA + TXINFO_SIZE + TXWI_SIZE); //TXWI_SIZE); - - if (pHeader_802_11->Addr1[0] & 0x01) - { - MlmeRate = pAd->CommonCfg.BasicMlmeRate; - } - else - { - MlmeRate = pAd->CommonCfg.MlmeRate; - } - - // Verify Mlme rate for a / g bands. - if ((pAd->LatchRfRegs.Channel > 14) && (MlmeRate < RATE_6)) // 11A band - MlmeRate = RATE_6; - - if ((pHeader_802_11->FC.Type == BTYPE_DATA) && - (pHeader_802_11->FC.SubType == SUBTYPE_QOS_NULL)) - { - pMacEntry = MacTableLookup(pAd, pHeader_802_11->Addr1); - } - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // Fixed W52 with Activity scan issue in ABG_MIXED and ABGN_MIXED mode. - if (pAd->CommonCfg.PhyMode == PHY_11ABG_MIXED -#ifdef DOT11_N_SUPPORT - || pAd->CommonCfg.PhyMode == PHY_11ABGN_MIXED -#endif // DOT11_N_SUPPORT // - ) - { - if (pAd->LatchRfRegs.Channel > 14) - pAd->CommonCfg.MlmeTransmit.field.MODE = 1; - else - pAd->CommonCfg.MlmeTransmit.field.MODE = 0; - } - } -#endif // CONFIG_STA_SUPPORT // - - // - // Should not be hard code to set PwrMgmt to 0 (PWR_ACTIVE) - // Snice it's been set to 0 while on MgtMacHeaderInit - // By the way this will cause frame to be send on PWR_SAVE failed. - // - pHeader_802_11->FC.PwrMgmt = PWR_ACTIVE; // (pAd->StaCfg.Psm == PWR_SAVE); - -#ifdef CONFIG_STA_SUPPORT - // - // In WMM-UAPSD, mlme frame should be set psm as power saving but probe request frame - // Data-Null packets alse pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD -// if ((pHeader_802_11->FC.Type != BTYPE_DATA) && (pHeader_802_11->FC.Type != BTYPE_CNTL)) - { - if ((pHeader_802_11->FC.SubType == SUBTYPE_ACTION) || - ((pHeader_802_11->FC.Type == BTYPE_DATA) && - ((pHeader_802_11->FC.SubType == SUBTYPE_QOS_NULL) || - (pHeader_802_11->FC.SubType == SUBTYPE_NULL_FUNC)))) - { - if (pAd->StaCfg.Psm == PWR_SAVE) - pHeader_802_11->FC.PwrMgmt = PWR_SAVE; - else - pHeader_802_11->FC.PwrMgmt = pAd->CommonCfg.bAPSDForcePowerSave; - } - } -#endif // CONFIG_STA_SUPPORT // - - - - - - bInsertTimestamp = FALSE; - if (pHeader_802_11->FC.Type == BTYPE_CNTL) // must be PS-POLL - { -#ifdef CONFIG_STA_SUPPORT - //Set PM bit in ps-poll, to fix WLK 1.2 PowerSaveMode_ext failure issue. - if ((pAd->OpMode == OPMODE_STA) && (pHeader_802_11->FC.SubType == SUBTYPE_PS_POLL)) - { - pHeader_802_11->FC.PwrMgmt = PWR_SAVE; - } -#endif // CONFIG_STA_SUPPORT // - bAckRequired = FALSE; - } - else // BTYPE_MGMT or BTYPE_DATA(must be NULL frame) - { - //pAd->Sequence++; - //pHeader_802_11->Sequence = pAd->Sequence; - - if (pHeader_802_11->Addr1[0] & 0x01) // MULTICAST, BROADCAST - { - bAckRequired = FALSE; - pHeader_802_11->Duration = 0; - } - else - { - bAckRequired = TRUE; - pHeader_802_11->Duration = RTMPCalcDuration(pAd, MlmeRate, 14); - if ((pHeader_802_11->FC.SubType == SUBTYPE_PROBE_RSP) && (pHeader_802_11->FC.Type == BTYPE_MGMT)) - { - bInsertTimestamp = TRUE; - bAckRequired = FALSE; // Disable ACK to prevent retry 0x1f for Probe Response - } - else if ((pHeader_802_11->FC.SubType == SUBTYPE_PROBE_REQ) && (pHeader_802_11->FC.Type == BTYPE_MGMT)) - { - bAckRequired = FALSE; // Disable ACK to prevent retry 0x1f for Probe Request - } - } - } - - pHeader_802_11->Sequence = pAd->Sequence++; - if (pAd->Sequence >0xfff) - pAd->Sequence = 0; - - // Before radar detection done, mgmt frame can not be sent but probe req - // Because we need to use probe req to trigger driver to send probe req in passive scan - if ((pHeader_802_11->FC.SubType != SUBTYPE_PROBE_REQ) - && (pAd->CommonCfg.bIEEE80211H == 1) - && (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE)) - { - DBGPRINT(RT_DEBUG_ERROR,("MlmeHardTransmit --> radar detect not in normal mode !!!\n")); -// if (!IrqState) - RTMP_SEM_UNLOCK(&pAd->MgmtRingLock); - return (NDIS_STATUS_FAILURE); - } - -#ifdef RT_BIG_ENDIAN - RTMPFrameEndianChange(pAd, (PUCHAR)pHeader_802_11, DIR_WRITE, FALSE); -#endif - - // - // fill scatter-and-gather buffer list into TXD. Internally created NDIS PACKET - // should always has only one physical buffer, and the whole frame size equals - // to the first scatter buffer size - // - - // Initialize TX Descriptor - // For inter-frame gap, the number is for this frame and next frame - // For MLME rate, we will fix as 2Mb to match other vendor's implement -// pAd->CommonCfg.MlmeTransmit.field.MODE = 1; - -// management frame doesn't need encryption. so use RESERVED_WCID no matter u are sending to specific wcid or not. - PID = PID_MGMT; - - - if (pMacEntry == NULL) - { - RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, bInsertTimestamp, FALSE, bAckRequired, FALSE, - 0, RESERVED_WCID, (SrcBufLen - TXINFO_SIZE - TXWI_SIZE), PID, 0, (UCHAR)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); - } - else - { - /* dont use low rate to send QoS Null data frame */ - RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, - bInsertTimestamp, FALSE, bAckRequired, FALSE, - 0, pMacEntry->Aid, (SrcBufLen - TXINFO_SIZE - TXWI_SIZE), - pMacEntry->MaxHTPhyMode.field.MCS, 0, - (UCHAR)pMacEntry->MaxHTPhyMode.field.MCS, - IFS_BACKOFF, FALSE, &pMacEntry->MaxHTPhyMode); - } - -#ifdef RT_BIG_ENDIAN - RTMPWIEndianChange((PUCHAR)pFirstTxWI, TYPE_TXWI); -#endif - - // Now do hardware-depened kick out. - HAL_KickOutMgmtTx(pAd, QueIdx, pPacket, pSrcBufVA, SrcBufLen); - - // Make sure to release MGMT ring resource -// if (!IrqState) - RTMP_SEM_UNLOCK(&pAd->MgmtRingLock); - return NDIS_STATUS_SUCCESS; -} - - -/******************************************************************************** - - New DeQueue Procedures. - - ********************************************************************************/ - -#define DEQUEUE_LOCK(lock, bIntContext, IrqFlags) \ - do{ \ - if (bIntContext == FALSE) \ - RTMP_IRQ_LOCK((lock), IrqFlags); \ - }while(0) - -#define DEQUEUE_UNLOCK(lock, bIntContext, IrqFlags) \ - do{ \ - if (bIntContext == FALSE) \ - RTMP_IRQ_UNLOCK((lock), IrqFlags); \ - }while(0) - - - - -/* - ======================================================================== - Tx Path design algorithm: - Basically, we divide the packets into four types, Broadcast/Multicast, 11N Rate(AMPDU, AMSDU, Normal), B/G Rate(ARALINK, Normal), - Specific Packet Type. Following show the classification rule and policy for each kinds of packets. - Classification Rule=> - Multicast: (*addr1 & 0x01) == 0x01 - Specific : bDHCPFrame, bARPFrame, bEAPOLFrame, etc. - 11N Rate : If peer support HT - (1).AMPDU -- If TXBA is negotiated. - (2).AMSDU -- If AMSDU is capable for both peer and ourself. - *). AMSDU can embedded in a AMPDU, but now we didn't support it. - (3).Normal -- Other packets which send as 11n rate. - - B/G Rate : If peer is b/g only. - (1).ARALINK-- If both of peer/us supprot Ralink proprietary Aggregation and the TxRate is large than RATE_6 - (2).Normal -- Other packets which send as b/g rate. - Fragment: - The packet must be unicast, NOT A-RALINK, NOT A-MSDU, NOT 11n, then can consider about fragment. - - Classified Packet Handle Rule=> - Multicast: - No ACK, //pTxBlk->bAckRequired = FALSE; - No WMM, //pTxBlk->bWMM = FALSE; - No piggyback, //pTxBlk->bPiggyBack = FALSE; - Force LowRate, //pTxBlk->bForceLowRate = TRUE; - Specific : Basically, for specific packet, we should handle it specifically, but now all specific packets are use - the same policy to handle it. - Force LowRate, //pTxBlk->bForceLowRate = TRUE; - - 11N Rate : - No piggyback, //pTxBlk->bPiggyBack = FALSE; - - (1).AMSDU - pTxBlk->bWMM = TRUE; - (2).AMPDU - pTxBlk->bWMM = TRUE; - (3).Normal - - B/G Rate : - (1).ARALINK - - (2).Normal - ======================================================================== -*/ -static UCHAR TxPktClassification( - IN RTMP_ADAPTER *pAd, - IN PNDIS_PACKET pPacket) -{ - UCHAR TxFrameType = TX_UNKOWN_FRAME; - UCHAR Wcid; - MAC_TABLE_ENTRY *pMacEntry = NULL; -#ifdef DOT11_N_SUPPORT - BOOLEAN bHTRate = FALSE; -#endif // DOT11_N_SUPPORT // - - Wcid = RTMP_GET_PACKET_WCID(pPacket); - if (Wcid == MCAST_WCID) - { // Handle for RA is Broadcast/Multicast Address. - return TX_MCAST_FRAME; - } - - // Handle for unicast packets - pMacEntry = &pAd->MacTab.Content[Wcid]; - if (RTMP_GET_PACKET_LOWRATE(pPacket)) - { // It's a specific packet need to force low rate, i.e., bDHCPFrame, bEAPOLFrame, bWAIFrame - TxFrameType = TX_LEGACY_FRAME; - } -#ifdef DOT11_N_SUPPORT - else if (IS_HT_RATE(pMacEntry)) - { // it's a 11n capable packet - - // Depends on HTPhyMode to check if the peer support the HTRate transmission. - // Currently didn't support A-MSDU embedded in A-MPDU - bHTRate = TRUE; - if (RTMP_GET_PACKET_MOREDATA(pPacket) || (pMacEntry->PsMode == PWR_SAVE)) - TxFrameType = TX_LEGACY_FRAME; -#ifdef UAPSD_AP_SUPPORT - else if (RTMP_GET_PACKET_EOSP(pPacket)) - TxFrameType = TX_LEGACY_FRAME; -#endif // UAPSD_AP_SUPPORT // - else if((pMacEntry->TXBAbitmap & (1<<(RTMP_GET_PACKET_UP(pPacket)))) != 0) - return TX_AMPDU_FRAME; - else if(CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_AMSDU_INUSED)) - return TX_AMSDU_FRAME; - else - TxFrameType = TX_LEGACY_FRAME; - } -#endif // DOT11_N_SUPPORT // - else - { // it's a legacy b/g packet. - if ((CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_AGGREGATION_CAPABLE) && pAd->CommonCfg.bAggregationCapable) && - (RTMP_GET_PACKET_TXRATE(pPacket) >= RATE_6) && - (!(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_WMM_CAPABLE)))) - { // if peer support Ralink Aggregation, we use it. - TxFrameType = TX_RALINK_FRAME; - } - else - { - TxFrameType = TX_LEGACY_FRAME; - } - } - - // Currently, our fragment only support when a unicast packet send as NOT-ARALINK, NOT-AMSDU and NOT-AMPDU. - if ((RTMP_GET_PACKET_FRAGMENTS(pPacket) > 1) && (TxFrameType == TX_LEGACY_FRAME)) - TxFrameType = TX_FRAG_FRAME; - - return TxFrameType; -} - - -BOOLEAN RTMP_FillTxBlkInfo( - IN RTMP_ADAPTER *pAd, - IN TX_BLK *pTxBlk) -{ - PACKET_INFO PacketInfo; - PNDIS_PACKET pPacket; - PMAC_TABLE_ENTRY pMacEntry = NULL; - - pPacket = pTxBlk->pPacket; - RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pTxBlk->pSrcBufHeader, &pTxBlk->SrcBufLen); - - pTxBlk->Wcid = RTMP_GET_PACKET_WCID(pPacket); - pTxBlk->apidx = RTMP_GET_PACKET_IF(pPacket); - pTxBlk->UserPriority = RTMP_GET_PACKET_UP(pPacket); - pTxBlk->FrameGap = IFS_HTTXOP; // ASIC determine Frame Gap - - if (RTMP_GET_PACKET_CLEAR_EAP_FRAME(pTxBlk->pPacket)) - TX_BLK_SET_FLAG(pTxBlk, fTX_bClearEAPFrame); - else - TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bClearEAPFrame); - - // Default to clear this flag - TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bForceNonQoS); - - - if (pTxBlk->Wcid == MCAST_WCID) - { - pTxBlk->pMacEntry = NULL; - { -#ifdef MCAST_RATE_SPECIFIC - PUCHAR pDA = GET_OS_PKT_DATAPTR(pPacket); - if (((*pDA & 0x01) == 0x01) && (*pDA != 0xff)) - pTxBlk->pTransmit = &pAd->CommonCfg.MCastPhyMode; - else -#endif // MCAST_RATE_SPECIFIC // - pTxBlk->pTransmit = &pAd->MacTab.Content[MCAST_WCID].HTPhyMode; - } - - TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bAckRequired); // AckRequired = FALSE, when broadcast packet in Adhoc mode. - //TX_BLK_SET_FLAG(pTxBlk, fTX_bForceLowRate); - TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bAllowFrag); - TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bWMM); - if (RTMP_GET_PACKET_MOREDATA(pPacket)) - { - TX_BLK_SET_FLAG(pTxBlk, fTX_bMoreData); - } - - } - else - { - pTxBlk->pMacEntry = &pAd->MacTab.Content[pTxBlk->Wcid]; - pTxBlk->pTransmit = &pTxBlk->pMacEntry->HTPhyMode; - - pMacEntry = pTxBlk->pMacEntry; - - - // For all unicast packets, need Ack unless the Ack Policy is not set as NORMAL_ACK. - if (pAd->CommonCfg.AckPolicy[pTxBlk->QueIdx] != NORMAL_ACK) - TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bAckRequired); - else - TX_BLK_SET_FLAG(pTxBlk, fTX_bAckRequired); - -#ifdef CONFIG_STA_SUPPORT - if ((pAd->OpMode == OPMODE_STA) && - (ADHOC_ON(pAd)) && - (RX_FILTER_TEST_FLAG(pAd, fRX_FILTER_ACCEPT_PROMISCUOUS))) - { - if(pAd->CommonCfg.PSPXlink) - TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bAckRequired); - } -#endif // CONFIG_STA_SUPPORT // - - { - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - - // If support WMM, enable it. - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && - CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_WMM_CAPABLE)) - TX_BLK_SET_FLAG(pTxBlk, fTX_bWMM); - -// if (pAd->StaCfg.bAutoTxRateSwitch) -// TX_BLK_SET_FLAG(pTxBlk, fTX_AutoRateSwitch); - } -#endif // CONFIG_STA_SUPPORT // - } - - if (pTxBlk->TxFrameType == TX_LEGACY_FRAME) - { - if ( (RTMP_GET_PACKET_LOWRATE(pPacket)) || - ((pAd->OpMode == OPMODE_AP) && (pMacEntry->MaxHTPhyMode.field.MODE == MODE_CCK) && (pMacEntry->MaxHTPhyMode.field.MCS == RATE_1))) - { // Specific packet, i.e., bDHCPFrame, bEAPOLFrame, bWAIFrame, need force low rate. - pTxBlk->pTransmit = &pAd->MacTab.Content[MCAST_WCID].HTPhyMode; -#ifdef DOT11_N_SUPPORT - // Modify the WMM bit for ICV issue. If we have a packet with EOSP field need to set as 1, how to handle it??? - if (IS_HT_STA(pTxBlk->pMacEntry) && - (CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_RALINK_CHIPSET)) && - ((pAd->CommonCfg.bRdg == TRUE) && CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_RDG_CAPABLE))) - { - TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bWMM); - TX_BLK_SET_FLAG(pTxBlk, fTX_bForceNonQoS); - } -#endif // DOT11_N_SUPPORT // - } - -#ifdef DOT11_N_SUPPORT - if ( (IS_HT_RATE(pMacEntry) == FALSE) && - (CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_PIGGYBACK_CAPABLE))) - { // Currently piggy-back only support when peer is operate in b/g mode. - TX_BLK_SET_FLAG(pTxBlk, fTX_bPiggyBack); - } -#endif // DOT11_N_SUPPORT // - - if (RTMP_GET_PACKET_MOREDATA(pPacket)) - { - TX_BLK_SET_FLAG(pTxBlk, fTX_bMoreData); - } -#ifdef UAPSD_AP_SUPPORT - if (RTMP_GET_PACKET_EOSP(pPacket)) - { - TX_BLK_SET_FLAG(pTxBlk, fTX_bWMM_UAPSD_EOSP); - } -#endif // UAPSD_AP_SUPPORT // - } - else if (pTxBlk->TxFrameType == TX_FRAG_FRAME) - { - TX_BLK_SET_FLAG(pTxBlk, fTX_bAllowFrag); - } - - pMacEntry->DebugTxCount++; - } - - return TRUE; -} - - -BOOLEAN CanDoAggregateTransmit( - IN RTMP_ADAPTER *pAd, - IN NDIS_PACKET *pPacket, - IN TX_BLK *pTxBlk) -{ - - //DBGPRINT(RT_DEBUG_TRACE, ("Check if can do aggregation! TxFrameType=%d!\n", pTxBlk->TxFrameType)); - - if (RTMP_GET_PACKET_WCID(pPacket) == MCAST_WCID) - return FALSE; - - if (RTMP_GET_PACKET_DHCP(pPacket) || - RTMP_GET_PACKET_EAPOL(pPacket) || - RTMP_GET_PACKET_WAI(pPacket)) - return FALSE; - - if ((pTxBlk->TxFrameType == TX_AMSDU_FRAME) && - ((pTxBlk->TotalFrameLen + GET_OS_PKT_LEN(pPacket))> (RX_BUFFER_AGGRESIZE - 100))) - { // For AMSDU, allow the packets with total length < max-amsdu size - return FALSE; - } - - if ((pTxBlk->TxFrameType == TX_RALINK_FRAME) && - (pTxBlk->TxPacketList.Number == 2)) - { // For RALINK-Aggregation, allow two frames in one batch. - return FALSE; - } - -#ifdef CONFIG_STA_SUPPORT - if ((INFRA_ON(pAd)) && (pAd->OpMode == OPMODE_STA)) // must be unicast to AP - return TRUE; - else -#endif // CONFIG_STA_SUPPORT // - return FALSE; - -} - - -/* - ======================================================================== - - Routine Description: - To do the enqueue operation and extract the first item of waiting - list. If a number of available shared memory segments could meet - the request of extracted item, the extracted item will be fragmented - into shared memory segments. - - Arguments: - pAd Pointer to our adapter - pQueue Pointer to Waiting Queue - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPDeQueuePacket( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bIntContext, - IN UCHAR QIdx, /* BulkOutPipeId */ - IN UCHAR Max_Tx_Packets) -{ - PQUEUE_ENTRY pEntry = NULL; - PNDIS_PACKET pPacket; - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - UCHAR Count=0; - PQUEUE_HEADER pQueue; - ULONG FreeNumber[NUM_OF_TX_RING]; - UCHAR QueIdx, sQIdx, eQIdx; - unsigned long IrqFlags = 0; - BOOLEAN hasTxDesc = FALSE; - TX_BLK TxBlk; - TX_BLK *pTxBlk; - -#ifdef DBG_DIAGNOSE - BOOLEAN firstRound; - RtmpDiagStruct *pDiagStruct = &pAd->DiagStruct; -#endif - - - if (QIdx == NUM_OF_TX_RING) - { - sQIdx = 0; - eQIdx = 3; // 4 ACs, start from 0. - } - else - { - sQIdx = eQIdx = QIdx; - } - - for (QueIdx=sQIdx; QueIdx <= eQIdx; QueIdx++) - { - Count=0; - - RTMP_START_DEQUEUE(pAd, QueIdx, IrqFlags); - -#ifdef DBG_DIAGNOSE - firstRound = ((QueIdx == 0) ? TRUE : FALSE); -#endif // DBG_DIAGNOSE // - - while (1) - { - if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS | - fRTMP_ADAPTER_RADIO_OFF | - fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST)))) - { - RTMP_STOP_DEQUEUE(pAd, QueIdx, IrqFlags); - return; - } - - if (Count >= Max_Tx_Packets) - break; - - DEQUEUE_LOCK(&pAd->irq_lock, bIntContext, IrqFlags); - if (&pAd->TxSwQueue[QueIdx] == NULL) - { -#ifdef DBG_DIAGNOSE - if (firstRound == TRUE) - pDiagStruct->TxSWQueCnt[pDiagStruct->ArrayCurIdx][0]++; -#endif // DBG_DIAGNOSE // - DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, IrqFlags); - break; - } - -#ifdef RTMP_MAC_PCI - FreeNumber[QueIdx] = GET_TXRING_FREENO(pAd, QueIdx); - -#ifdef DBG_DIAGNOSE - if (firstRound == TRUE) - { - UCHAR txDescNumLevel, txSwQNumLevel; - - txDescNumLevel = (TX_RING_SIZE - FreeNumber[QueIdx]); // Number of occupied hw desc. - txDescNumLevel = ((txDescNumLevel <=15) ? txDescNumLevel : 15); - pDiagStruct->TxDescCnt[pDiagStruct->ArrayCurIdx][txDescNumLevel]++; - - txSwQNumLevel = ((pAd->TxSwQueue[QueIdx].Number <=7) ? pAd->TxSwQueue[QueIdx].Number : 8); - pDiagStruct->TxSWQueCnt[pDiagStruct->ArrayCurIdx][txSwQNumLevel]++; - - firstRound = FALSE; - } -#endif // DBG_DIAGNOSE // - - if (FreeNumber[QueIdx] <= 5) - { - // free Tx(QueIdx) resources - RTMPFreeTXDUponTxDmaDone(pAd, QueIdx); - FreeNumber[QueIdx] = GET_TXRING_FREENO(pAd, QueIdx); - } -#endif // RTMP_MAC_PCI // - - // probe the Queue Head - pQueue = &pAd->TxSwQueue[QueIdx]; - if ((pEntry = pQueue->Head) == NULL) - { - DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, IrqFlags); - break; - } - - pTxBlk = &TxBlk; - NdisZeroMemory((PUCHAR)pTxBlk, sizeof(TX_BLK)); - //InitializeQueueHeader(&pTxBlk->TxPacketList); // Didn't need it because we already memzero it. - pTxBlk->QueIdx = QueIdx; - - pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); - - - // Early check to make sure we have enoguh Tx Resource. - hasTxDesc = RTMP_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, FreeNumber[QueIdx], pPacket); - if (!hasTxDesc) - { - pAd->PrivateInfo.TxRingFullCnt++; - - DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, IrqFlags); - - break; - } - - pTxBlk->TxFrameType = TxPktClassification(pAd, pPacket); - pEntry = RemoveHeadQueue(pQueue); - pTxBlk->TotalFrameNum++; - pTxBlk->TotalFragNum += RTMP_GET_PACKET_FRAGMENTS(pPacket); // The real fragment number maybe vary - pTxBlk->TotalFrameLen += GET_OS_PKT_LEN(pPacket); - pTxBlk->pPacket = pPacket; - InsertTailQueue(&pTxBlk->TxPacketList, PACKET_TO_QUEUE_ENTRY(pPacket)); - - if (pTxBlk->TxFrameType == TX_RALINK_FRAME || pTxBlk->TxFrameType == TX_AMSDU_FRAME) - { - // Enhance SW Aggregation Mechanism - if (NEED_QUEUE_BACK_FOR_AGG(pAd, QueIdx, FreeNumber[QueIdx], pTxBlk->TxFrameType)) - { - InsertHeadQueue(pQueue, PACKET_TO_QUEUE_ENTRY(pPacket)); - DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, IrqFlags); - break; - } - - do{ - if((pEntry = pQueue->Head) == NULL) - break; - - // For TX_AMSDU_FRAME/TX_RALINK_FRAME, Need to check if next pakcet can do aggregation. - pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); - FreeNumber[QueIdx] = GET_TXRING_FREENO(pAd, QueIdx); - hasTxDesc = RTMP_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, FreeNumber[QueIdx], pPacket); - if ((hasTxDesc == FALSE) || (CanDoAggregateTransmit(pAd, pPacket, pTxBlk) == FALSE)) - break; - - //Remove the packet from the TxSwQueue and insert into pTxBlk - pEntry = RemoveHeadQueue(pQueue); - ASSERT(pEntry); - pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); - pTxBlk->TotalFrameNum++; - pTxBlk->TotalFragNum += RTMP_GET_PACKET_FRAGMENTS(pPacket); // The real fragment number maybe vary - pTxBlk->TotalFrameLen += GET_OS_PKT_LEN(pPacket); - InsertTailQueue(&pTxBlk->TxPacketList, PACKET_TO_QUEUE_ENTRY(pPacket)); - }while(1); - - if (pTxBlk->TxPacketList.Number == 1) - pTxBlk->TxFrameType = TX_LEGACY_FRAME; - } - - - Count += pTxBlk->TxPacketList.Number; - - - // Do HardTransmit now. -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - Status = STAHardTransmit(pAd, pTxBlk, QueIdx); -#endif // CONFIG_STA_SUPPORT // - -#ifdef RTMP_MAC_PCI - DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, IrqFlags); - // static rate also need NICUpdateFifoStaCounters() function. - //if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) - NICUpdateFifoStaCounters(pAd); -#endif // RTMP_MAC_PCI // - - } - - RTMP_STOP_DEQUEUE(pAd, QueIdx, IrqFlags); - - -#ifdef BLOCK_NET_IF - if ((pAd->blockQueueTab[QueIdx].SwTxQueueBlockFlag == TRUE) - && (pAd->TxSwQueue[QueIdx].Number < 1)) - { - releaseNetIf(&pAd->blockQueueTab[QueIdx]); - } -#endif // BLOCK_NET_IF // - - } - -} - - -/* - ======================================================================== - - Routine Description: - Calculates the duration which is required to transmit out frames - with given size and specified rate. - - Arguments: - pAd Pointer to our adapter - Rate Transmit rate - Size Frame size in units of byte - - Return Value: - Duration number in units of usec - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -USHORT RTMPCalcDuration( - IN PRTMP_ADAPTER pAd, - IN UCHAR Rate, - IN ULONG Size) -{ - ULONG Duration = 0; - - if (Rate < RATE_FIRST_OFDM_RATE) // CCK - { - if ((Rate > RATE_1) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED)) - Duration = 96; // 72+24 preamble+plcp - else - Duration = 192; // 144+48 preamble+plcp - - Duration += (USHORT)((Size << 4) / RateIdTo500Kbps[Rate]); - if ((Size << 4) % RateIdTo500Kbps[Rate]) - Duration ++; - } - else if (Rate <= RATE_LAST_OFDM_RATE)// OFDM rates - { - Duration = 20 + 6; // 16+4 preamble+plcp + Signal Extension - Duration += 4 * (USHORT)((11 + Size * 4) / RateIdTo500Kbps[Rate]); - if ((11 + Size * 4) % RateIdTo500Kbps[Rate]) - Duration += 4; - } - else //mimo rate - { - Duration = 20 + 6; // 16+4 preamble+plcp + Signal Extension - } - - return (USHORT)Duration; -} - - -/* - ======================================================================== - - Routine Description: - Calculates the duration which is required to transmit out frames - with given size and specified rate. - - Arguments: - pTxWI Pointer to head of each MPDU to HW. - Ack Setting for Ack requirement bit - Fragment Setting for Fragment bit - RetryMode Setting for retry mode - Ifs Setting for IFS gap - Rate Setting for transmit rate - Service Setting for service - Length Frame length - TxPreamble Short or Long preamble when using CCK rates - QueIdx - 0-3, according to 802.11e/d4.4 June/2003 - - Return Value: - None - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - See also : BASmartHardTransmit() !!! - - ======================================================================== -*/ -VOID RTMPWriteTxWI( - IN PRTMP_ADAPTER pAd, - IN PTXWI_STRUC pOutTxWI, - IN BOOLEAN FRAG, - IN BOOLEAN CFACK, - IN BOOLEAN InsTimestamp, - IN BOOLEAN AMPDU, - IN BOOLEAN Ack, - IN BOOLEAN NSeq, // HW new a sequence. - IN UCHAR BASize, - IN UCHAR WCID, - IN ULONG Length, - IN UCHAR PID, - IN UCHAR TID, - IN UCHAR TxRate, - IN UCHAR Txopmode, - IN BOOLEAN CfAck, - IN HTTRANSMIT_SETTING *pTransmit) -{ - PMAC_TABLE_ENTRY pMac = NULL; - TXWI_STRUC TxWI; - PTXWI_STRUC pTxWI; - - if (WCID < MAX_LEN_OF_MAC_TABLE) - pMac = &pAd->MacTab.Content[WCID]; - - // - // Always use Long preamble before verifiation short preamble functionality works well. - // Todo: remove the following line if short preamble functionality works - // - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); - NdisZeroMemory(&TxWI, TXWI_SIZE); - pTxWI = &TxWI; - - pTxWI->FRAG= FRAG; - - pTxWI->CFACK = CFACK; - pTxWI->TS= InsTimestamp; - pTxWI->AMPDU = AMPDU; - pTxWI->ACK = Ack; - pTxWI->txop= Txopmode; - - pTxWI->NSEQ = NSeq; - // John tune the performace with Intel Client in 20 MHz performance -#ifdef DOT11_N_SUPPORT - BASize = pAd->CommonCfg.TxBASize; - if (pAd->MACVersion == 0x28720200) - { - if( BASize >13 ) - BASize =13; - } - else - { - if( BASize >7 ) - BASize =7; - } - pTxWI->BAWinSize = BASize; - pTxWI->ShortGI = pTransmit->field.ShortGI; - pTxWI->STBC = pTransmit->field.STBC; -#endif // DOT11_N_SUPPORT // - - pTxWI->WirelessCliID = WCID; - pTxWI->MPDUtotalByteCount = Length; - pTxWI->PacketId = PID; - - // If CCK or OFDM, BW must be 20 - pTxWI->BW = (pTransmit->field.MODE <= MODE_OFDM) ? (BW_20) : (pTransmit->field.BW); -#ifdef DOT11_N_SUPPORT -#ifdef DOT11N_DRAFT3 - if (pTxWI->BW) - pTxWI->BW = (pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth == 0) ? (BW_20) : (pTransmit->field.BW); -#endif // DOT11N_DRAFT3 // -#endif // DOT11_N_SUPPORT // - - pTxWI->MCS = pTransmit->field.MCS; - pTxWI->PHYMODE = pTransmit->field.MODE; - pTxWI->CFACK = CfAck; - -#ifdef DOT11_N_SUPPORT - if (pMac) - { - if (pAd->CommonCfg.bMIMOPSEnable) - { - if ((pMac->MmpsMode == MMPS_DYNAMIC) && (pTransmit->field.MCS > 7)) - { - // Dynamic MIMO Power Save Mode - pTxWI->MIMOps = 1; - } - else if (pMac->MmpsMode == MMPS_STATIC) - { - // Static MIMO Power Save Mode - if (pTransmit->field.MODE >= MODE_HTMIX && pTransmit->field.MCS > 7) - { - pTxWI->MCS = 7; - pTxWI->MIMOps = 0; - } - } - } - //pTxWI->MIMOps = (pMac->PsMode == PWR_MMPS)? 1:0; - if (pMac->bIAmBadAtheros && (pMac->WepStatus != Ndis802_11WEPDisabled)) - { - pTxWI->MpduDensity = 7; - } - else - { - pTxWI->MpduDensity = pMac->MpduDensity; - } - } -#endif // DOT11_N_SUPPORT // - - pTxWI->PacketId = pTxWI->MCS; - NdisMoveMemory(pOutTxWI, &TxWI, sizeof(TXWI_STRUC)); -} - - -VOID RTMPWriteTxWI_Data( - IN PRTMP_ADAPTER pAd, - IN OUT PTXWI_STRUC pTxWI, - IN TX_BLK *pTxBlk) -{ - HTTRANSMIT_SETTING *pTransmit; - PMAC_TABLE_ENTRY pMacEntry; -#ifdef DOT11_N_SUPPORT - UCHAR BASize; -#endif // DOT11_N_SUPPORT // - - - ASSERT(pTxWI); - - pTransmit = pTxBlk->pTransmit; - pMacEntry = pTxBlk->pMacEntry; - - - // - // Always use Long preamble before verifiation short preamble functionality works well. - // Todo: remove the following line if short preamble functionality works - // - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); - NdisZeroMemory(pTxWI, TXWI_SIZE); - - pTxWI->FRAG = TX_BLK_TEST_FLAG(pTxBlk, fTX_bAllowFrag); - pTxWI->ACK = TX_BLK_TEST_FLAG(pTxBlk, fTX_bAckRequired); - pTxWI->txop = pTxBlk->FrameGap; - -#ifdef CONFIG_STA_SUPPORT -#ifdef QOS_DLS_SUPPORT - if (pMacEntry && - (pAd->StaCfg.BssType == BSS_INFRA) && - (pMacEntry->ValidAsDls == TRUE)) - pTxWI->WirelessCliID = BSSID_WCID; - else -#endif // QOS_DLS_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - pTxWI->WirelessCliID = pTxBlk->Wcid; - - pTxWI->MPDUtotalByteCount = pTxBlk->MpduHeaderLen + pTxBlk->SrcBufLen; - pTxWI->CFACK = TX_BLK_TEST_FLAG(pTxBlk, fTX_bPiggyBack); - - // If CCK or OFDM, BW must be 20 - pTxWI->BW = (pTransmit->field.MODE <= MODE_OFDM) ? (BW_20) : (pTransmit->field.BW); -#ifdef DOT11_N_SUPPORT -#ifdef DOT11N_DRAFT3 - if (pTxWI->BW) - pTxWI->BW = (pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth == 0) ? (BW_20) : (pTransmit->field.BW); -#endif // DOT11N_DRAFT3 // - pTxWI->AMPDU = ((pTxBlk->TxFrameType == TX_AMPDU_FRAME) ? TRUE : FALSE); - - // John tune the performace with Intel Client in 20 MHz performance - BASize = pAd->CommonCfg.TxBASize; - if((pTxBlk->TxFrameType == TX_AMPDU_FRAME) && (pMacEntry)) - { - UCHAR RABAOriIdx = 0; //The RA's BA Originator table index. - - RABAOriIdx = pTxBlk->pMacEntry->BAOriWcidArray[pTxBlk->UserPriority]; - BASize = pAd->BATable.BAOriEntry[RABAOriIdx].BAWinSize; - } - - - pTxWI->TxBF = pTransmit->field.TxBF; - pTxWI->BAWinSize = BASize; - pTxWI->ShortGI = pTransmit->field.ShortGI; - pTxWI->STBC = pTransmit->field.STBC; -#endif // DOT11_N_SUPPORT // - - pTxWI->MCS = pTransmit->field.MCS; - pTxWI->PHYMODE = pTransmit->field.MODE; - - -#ifdef DOT11_N_SUPPORT - if (pMacEntry) - { - if ((pMacEntry->MmpsMode == MMPS_DYNAMIC) && (pTransmit->field.MCS > 7)) - { - // Dynamic MIMO Power Save Mode - pTxWI->MIMOps = 1; - } - else if (pMacEntry->MmpsMode == MMPS_STATIC) - { - // Static MIMO Power Save Mode - if (pTransmit->field.MODE >= MODE_HTMIX && pTransmit->field.MCS > 7) - { - pTxWI->MCS = 7; - pTxWI->MIMOps = 0; - } - } - - if (pMacEntry->bIAmBadAtheros && (pMacEntry->WepStatus != Ndis802_11WEPDisabled)) - { - pTxWI->MpduDensity = 7; - } - else - { - pTxWI->MpduDensity = pMacEntry->MpduDensity; - } - } -#endif // DOT11_N_SUPPORT // - -#ifdef DBG_DIAGNOSE - if (pTxBlk->QueIdx== 0) - { - pAd->DiagStruct.TxDataCnt[pAd->DiagStruct.ArrayCurIdx]++; - pAd->DiagStruct.TxMcsCnt[pAd->DiagStruct.ArrayCurIdx][pTxWI->MCS]++; - } -#endif // DBG_DIAGNOSE // - - // for rate adapation - pTxWI->PacketId = pTxWI->MCS; -#ifdef INF_AMAZON_SE -/*Iverson patch for WMM A5-T07 ,WirelessStaToWirelessSta do not bulk out aggregate */ - if( RTMP_GET_PACKET_NOBULKOUT(pTxBlk->pPacket)) - { - if(pTxWI->PHYMODE == MODE_CCK) - { - pTxWI->PacketId = 6; - } - } -#endif // INF_AMAZON_SE // -} - - -VOID RTMPWriteTxWI_Cache( - IN PRTMP_ADAPTER pAd, - IN OUT PTXWI_STRUC pTxWI, - IN TX_BLK *pTxBlk) -{ - PHTTRANSMIT_SETTING /*pTxHTPhyMode,*/ pTransmit; - PMAC_TABLE_ENTRY pMacEntry; - - // - // update TXWI - // - pMacEntry = pTxBlk->pMacEntry; - pTransmit = pTxBlk->pTransmit; - - //if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) - //if (RTMPCheckEntryEnableAutoRateSwitch(pAd, pMacEntry)) - //if (TX_BLK_TEST_FLAG(pTxBlk, fTX_AutoRateSwitch)) - if (pMacEntry->bAutoTxRateSwitch) - { - pTxWI->txop = IFS_HTTXOP; - - // If CCK or OFDM, BW must be 20 - pTxWI->BW = (pTransmit->field.MODE <= MODE_OFDM) ? (BW_20) : (pTransmit->field.BW); - pTxWI->ShortGI = pTransmit->field.ShortGI; - pTxWI->STBC = pTransmit->field.STBC; - - pTxWI->MCS = pTransmit->field.MCS; - pTxWI->PHYMODE = pTransmit->field.MODE; - - // set PID for TxRateSwitching - pTxWI->PacketId = pTransmit->field.MCS; - } - -#ifdef DOT11_N_SUPPORT - pTxWI->AMPDU = ((pMacEntry->NoBADataCountDown == 0) ? TRUE: FALSE); - pTxWI->MIMOps = 0; - -#ifdef DOT11N_DRAFT3 - if (pTxWI->BW) - pTxWI->BW = (pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth == 0) ? (BW_20) : (pTransmit->field.BW); -#endif // DOT11N_DRAFT3 // - - if (pAd->CommonCfg.bMIMOPSEnable) - { - // MIMO Power Save Mode - if ((pMacEntry->MmpsMode == MMPS_DYNAMIC) && (pTransmit->field.MCS > 7)) - { - // Dynamic MIMO Power Save Mode - pTxWI->MIMOps = 1; - } - else if (pMacEntry->MmpsMode == MMPS_STATIC) - { - // Static MIMO Power Save Mode - if ((pTransmit->field.MODE >= MODE_HTMIX) && (pTransmit->field.MCS > 7)) - { - pTxWI->MCS = 7; - pTxWI->MIMOps = 0; - } - } - } -#endif // DOT11_N_SUPPORT // - -#ifdef DBG_DIAGNOSE - if (pTxBlk->QueIdx== 0) - { - pAd->DiagStruct.TxDataCnt[pAd->DiagStruct.ArrayCurIdx]++; - pAd->DiagStruct.TxMcsCnt[pAd->DiagStruct.ArrayCurIdx][pTxWI->MCS]++; - } -#endif // DBG_DIAGNOSE // - - pTxWI->MPDUtotalByteCount = pTxBlk->MpduHeaderLen + pTxBlk->SrcBufLen; - -} - - -// should be called only when - -// 1. MEADIA_CONNECTED -// 2. AGGREGATION_IN_USED -// 3. Fragmentation not in used -// 4. either no previous frame (pPrevAddr1=NULL) .OR. previoud frame is aggregatible -BOOLEAN TxFrameIsAggregatible( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pPrevAddr1, - IN PUCHAR p8023hdr) -{ - - // can't aggregate EAPOL (802.1x) frame - if ((p8023hdr[12] == 0x88) && (p8023hdr[13] == 0x8e)) - return FALSE; - - // can't aggregate multicast/broadcast frame - if (p8023hdr[0] & 0x01) - return FALSE; - - if (INFRA_ON(pAd)) // must be unicast to AP - return TRUE; - else if ((pPrevAddr1 == NULL) || MAC_ADDR_EQUAL(pPrevAddr1, p8023hdr)) // unicast to same STA - return TRUE; - else - return FALSE; -} - - -/* - ======================================================================== - - Routine Description: - Check the MSDU Aggregation policy - 1.HT aggregation is A-MSDU - 2.legaacy rate aggregation is software aggregation by Ralink. - - Arguments: - - Return Value: - - Note: - - ======================================================================== -*/ -BOOLEAN PeerIsAggreOn( - IN PRTMP_ADAPTER pAd, - IN ULONG TxRate, - IN PMAC_TABLE_ENTRY pMacEntry) -{ - ULONG AFlags = (fCLIENT_STATUS_AMSDU_INUSED | fCLIENT_STATUS_AGGREGATION_CAPABLE); - - if (pMacEntry != NULL && CLIENT_STATUS_TEST_FLAG(pMacEntry, AFlags)) - { -#ifdef DOT11_N_SUPPORT - if (pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX) - { - return TRUE; - } -#endif // DOT11_N_SUPPORT // - -#ifdef AGGREGATION_SUPPORT - if (TxRate >= RATE_6 && pAd->CommonCfg.bAggregationCapable && (!(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_WMM_CAPABLE)))) - { // legacy Ralink Aggregation support - return TRUE; - } -#endif // AGGREGATION_SUPPORT // - } - - return FALSE; - -} - - -/* - ======================================================================== - - Routine Description: - Check and fine the packet waiting in SW queue with highest priority - - Arguments: - pAd Pointer to our adapter - - Return Value: - pQueue Pointer to Waiting Queue - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -PQUEUE_HEADER RTMPCheckTxSwQueue( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pQueIdx) -{ - - ULONG Number; - // 2004-11-15 to be removed. test aggregation only -// if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED)) && (*pNumber < 2)) -// return NULL; - - Number = pAd->TxSwQueue[QID_AC_BK].Number - + pAd->TxSwQueue[QID_AC_BE].Number - + pAd->TxSwQueue[QID_AC_VI].Number - + pAd->TxSwQueue[QID_AC_VO].Number; - /*+ pAd->TxSwQueue[QID_HCCA].Number;*/ - - if (pAd->TxSwQueue[QID_AC_VO].Head != NULL) - { - *pQueIdx = QID_AC_VO; - return (&pAd->TxSwQueue[QID_AC_VO]); - } - else if (pAd->TxSwQueue[QID_AC_VI].Head != NULL) - { - *pQueIdx = QID_AC_VI; - return (&pAd->TxSwQueue[QID_AC_VI]); - } - else if (pAd->TxSwQueue[QID_AC_BE].Head != NULL) - { - *pQueIdx = QID_AC_BE; - return (&pAd->TxSwQueue[QID_AC_BE]); - } - else if (pAd->TxSwQueue[QID_AC_BK].Head != NULL) - { - *pQueIdx = QID_AC_BK; - return (&pAd->TxSwQueue[QID_AC_BK]); - } - /* - else if (pAd->TxSwQueue[QID_HCCA].Head != NULL) - { - *pQueIdx = QID_HCCA; - return (&pAd->TxSwQueue[QID_HCCA]); - } - */ - - // No packet pending in Tx Sw queue - *pQueIdx = QID_AC_BK; - - return (NULL); -} - - -/* - ======================================================================== - - Routine Description: - Suspend MSDU transmission - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID RTMPSuspendMsduTransmission( - IN PRTMP_ADAPTER pAd) -{ - DBGPRINT(RT_DEBUG_TRACE,("SCANNING, suspend MSDU transmission ...\n")); - - - // - // Before BSS_SCAN_IN_PROGRESS, we need to keep Current R66 value and - // use Lowbound as R66 value on ScanNextChannel(...) - // - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R66, &pAd->BbpTuning.R66CurrentValue); - - // set BBP_R66 to 0x30/0x40 when scanning (AsicSwitchChannel will set R66 according to channel when scanning) - //RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, (0x26 + GET_LNA_GAIN(pAd))); - RTMPSetAGCInitValue(pAd, BW_20); - - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); - //RTMP_IO_WRITE32(pAd, TX_CNTL_CSR, 0x000f0000); // abort all TX rings -} - - -/* - ======================================================================== - - Routine Description: - Resume MSDU transmission - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPResumeMsduTransmission( - IN PRTMP_ADAPTER pAd) -{ -// UCHAR IrqState; - - DBGPRINT(RT_DEBUG_TRACE,("SCAN done, resume MSDU transmission ...\n")); - - - // After finish BSS_SCAN_IN_PROGRESS, we need to restore Current R66 value - // R66 should not be 0 - if (pAd->BbpTuning.R66CurrentValue == 0) - { - pAd->BbpTuning.R66CurrentValue = 0x38; - DBGPRINT_ERR(("RTMPResumeMsduTransmission, R66CurrentValue=0...\n")); - } - - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, pAd->BbpTuning.R66CurrentValue); - - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); -// sample, for IRQ LOCK to SEM LOCK -// IrqState = pAd->irq_disabled; -// if (IrqState) -// RTMPDeQueuePacket(pAd, TRUE, NUM_OF_TX_RING, MAX_TX_PROCESS); -// else - RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); -} - - -UINT deaggregate_AMSDU_announce( - IN PRTMP_ADAPTER pAd, - PNDIS_PACKET pPacket, - IN PUCHAR pData, - IN ULONG DataSize) -{ - USHORT PayloadSize; - USHORT SubFrameSize; - PHEADER_802_3 pAMSDUsubheader; - UINT nMSDU; - UCHAR Header802_3[14]; - - PUCHAR pPayload, pDA, pSA, pRemovedLLCSNAP; - PNDIS_PACKET pClonePacket; - - - - nMSDU = 0; - - while (DataSize > LENGTH_802_3) - { - - nMSDU++; - - //hex_dump("subheader", pData, 64); - pAMSDUsubheader = (PHEADER_802_3)pData; - //pData += LENGTH_802_3; - PayloadSize = pAMSDUsubheader->Octet[1] + (pAMSDUsubheader->Octet[0]<<8); - SubFrameSize = PayloadSize + LENGTH_802_3; - - - if ((DataSize < SubFrameSize) || (PayloadSize > 1518 )) - { - break; - } - - //DBGPRINT(RT_DEBUG_TRACE,("%d subframe: Size = %d\n", nMSDU, PayloadSize)); - - pPayload = pData + LENGTH_802_3; - pDA = pData; - pSA = pData + MAC_ADDR_LEN; - - // convert to 802.3 header - CONVERT_TO_802_3(Header802_3, pDA, pSA, pPayload, PayloadSize, pRemovedLLCSNAP); - -#ifdef CONFIG_STA_SUPPORT - if ((Header802_3[12] == 0x88) && (Header802_3[13] == 0x8E) ) - { - /* avoid local heap overflow, use dyanamic allocation */ - MLME_QUEUE_ELEM *Elem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); - if (Elem != NULL) - { - memmove(Elem->Msg+(LENGTH_802_11 + LENGTH_802_1_H), pPayload, PayloadSize); - Elem->MsgLen = LENGTH_802_11 + LENGTH_802_1_H + PayloadSize; - //WpaEAPOLKeyAction(pAd, Elem); - REPORT_MGMT_FRAME_TO_MLME(pAd, BSSID_WCID, Elem->Msg, Elem->MsgLen, 0, 0, 0, 0); - kfree(Elem); - } - } -#endif // CONFIG_STA_SUPPORT // - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (pRemovedLLCSNAP) - { - pPayload -= LENGTH_802_3; - PayloadSize += LENGTH_802_3; - NdisMoveMemory(pPayload, &Header802_3[0], LENGTH_802_3); - } - } -#endif // CONFIG_STA_SUPPORT // - - pClonePacket = ClonePacket(pAd, pPacket, pPayload, PayloadSize); - if (pClonePacket) - { -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - ANNOUNCE_OR_FORWARD_802_3_PACKET(pAd, pClonePacket, RTMP_GET_PACKET_IF(pPacket)); -#endif // CONFIG_STA_SUPPORT // - } - - - // A-MSDU has padding to multiple of 4 including subframe header. - // align SubFrameSize up to multiple of 4 - SubFrameSize = (SubFrameSize+3)&(~0x3); - - - if (SubFrameSize > 1528 || SubFrameSize < 32) - { - break; - } - - if (DataSize > SubFrameSize) - { - pData += SubFrameSize; - DataSize -= SubFrameSize; - } - else - { - // end of A-MSDU - DataSize = 0; - } - } - - // finally release original rx packet - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - - return nMSDU; -} - - -UINT BA_Reorder_AMSDU_Annnounce( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket) -{ - PUCHAR pData; - USHORT DataSize; - UINT nMSDU = 0; - - pData = (PUCHAR) GET_OS_PKT_DATAPTR(pPacket); - DataSize = (USHORT) GET_OS_PKT_LEN(pPacket); - - nMSDU = deaggregate_AMSDU_announce(pAd, pPacket, pData, DataSize); - - return nMSDU; -} - - -/* - ========================================================================== - Description: - Look up the MAC address in the MAC table. Return NULL if not found. - Return: - pEntry - pointer to the MAC entry; NULL is not found - ========================================================================== -*/ -MAC_TABLE_ENTRY *MacTableLookup( - IN PRTMP_ADAPTER pAd, - PUCHAR pAddr) -{ - ULONG HashIdx; - MAC_TABLE_ENTRY *pEntry = NULL; - - HashIdx = MAC_ADDR_HASH_INDEX(pAddr); - pEntry = pAd->MacTab.Hash[HashIdx]; - - while (pEntry && (pEntry->ValidAsCLI || pEntry->ValidAsWDS || pEntry->ValidAsApCli || pEntry->ValidAsMesh)) - { - if (MAC_ADDR_EQUAL(pEntry->Addr, pAddr)) - { - break; - } - else - pEntry = pEntry->pNext; - } - - return pEntry; -} - -MAC_TABLE_ENTRY *MacTableInsertEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR apidx, - IN BOOLEAN CleanAll) -{ - UCHAR HashIdx; - int i, FirstWcid; - MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry; -// USHORT offset; -// ULONG addr; - - // if FULL, return - if (pAd->MacTab.Size >= MAX_LEN_OF_MAC_TABLE) - return NULL; - - FirstWcid = 1; -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - if (pAd->StaCfg.BssType == BSS_INFRA) - FirstWcid = 2; -#endif // CONFIG_STA_SUPPORT // - - // allocate one MAC entry - NdisAcquireSpinLock(&pAd->MacTabLock); - for (i = FirstWcid; i< MAX_LEN_OF_MAC_TABLE; i++) // skip entry#0 so that "entry index == AID" for fast lookup - { - // pick up the first available vacancy - if ((pAd->MacTab.Content[i].ValidAsCLI == FALSE) && - (pAd->MacTab.Content[i].ValidAsWDS == FALSE) && - (pAd->MacTab.Content[i].ValidAsApCli== FALSE) && - (pAd->MacTab.Content[i].ValidAsMesh == FALSE) -#ifdef CONFIG_STA_SUPPORT -#ifdef QOS_DLS_SUPPORT - && (pAd->MacTab.Content[i].ValidAsDls == FALSE) -#endif // QOS_DLS_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - ) - { - pEntry = &pAd->MacTab.Content[i]; - if (CleanAll == TRUE) - { - pEntry->MaxSupportedRate = RATE_11; - pEntry->CurrTxRate = RATE_11; - NdisZeroMemory(pEntry, sizeof(MAC_TABLE_ENTRY)); - pEntry->PairwiseKey.KeyLen = 0; - pEntry->PairwiseKey.CipherAlg = CIPHER_NONE; - } -#ifdef CONFIG_STA_SUPPORT -#ifdef QOS_DLS_SUPPORT - if (apidx >= MIN_NET_DEVICE_FOR_DLS) - { - pEntry->ValidAsCLI = FALSE; - pEntry->ValidAsWDS = FALSE; - pEntry->ValidAsApCli = FALSE; - pEntry->ValidAsMesh = FALSE; - pEntry->ValidAsDls = TRUE; - pEntry->isCached = FALSE; - } - else -#endif // QOS_DLS_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - { - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - pEntry->ValidAsCLI = TRUE; - pEntry->ValidAsWDS = FALSE; - pEntry->ValidAsApCli = FALSE; - pEntry->ValidAsMesh = FALSE; - pEntry->ValidAsDls = FALSE; - } -#endif // CONFIG_STA_SUPPORT // - } - - pEntry->bIAmBadAtheros = FALSE; - pEntry->pAd = pAd; - pEntry->CMTimerRunning = FALSE; - pEntry->EnqueueEapolStartTimerRunning = EAPOL_START_DISABLE; - pEntry->RSNIE_Len = 0; - NdisZeroMemory(pEntry->R_Counter, sizeof(pEntry->R_Counter)); - pEntry->ReTryCounter = PEER_MSG1_RETRY_TIMER_CTR; - - if (pEntry->ValidAsMesh) - pEntry->apidx = (apidx - MIN_NET_DEVICE_FOR_MESH); - else if (pEntry->ValidAsApCli) - pEntry->apidx = (apidx - MIN_NET_DEVICE_FOR_APCLI); - else if (pEntry->ValidAsWDS) - pEntry->apidx = (apidx - MIN_NET_DEVICE_FOR_WDS); -#ifdef CONFIG_STA_SUPPORT -#ifdef QOS_DLS_SUPPORT - else if (pEntry->ValidAsDls) - pEntry->apidx = (apidx - MIN_NET_DEVICE_FOR_DLS); -#endif // QOS_DLS_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - else - pEntry->apidx = apidx; - - - { - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - pEntry->AuthMode = pAd->StaCfg.AuthMode; - pEntry->WepStatus = pAd->StaCfg.WepStatus; - pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; -#ifdef RTMP_MAC_PCI - AsicRemovePairwiseKeyEntry(pAd, pEntry->apidx, (UCHAR)i); -#endif // RTMP_MAC_PCI // - } -#endif // CONFIG_STA_SUPPORT // - } - - pEntry->GTKState = REKEY_NEGOTIATING; - pEntry->PairwiseKey.KeyLen = 0; - pEntry->PairwiseKey.CipherAlg = CIPHER_NONE; -#ifdef CONFIG_STA_SUPPORT -#ifdef QOS_DLS_SUPPORT - if (pEntry->ValidAsDls == TRUE) - pEntry->PortSecured = WPA_802_1X_PORT_SECURED; - else -#endif //QOS_DLS_SUPPORT -#endif // CONFIG_STA_SUPPORT // - pEntry->PortSecured = WPA_802_1X_PORT_NOT_SECURED; - - pEntry->PMKID_CacheIdx = ENTRY_NOT_FOUND; - COPY_MAC_ADDR(pEntry->Addr, pAddr); - pEntry->Sst = SST_NOT_AUTH; - pEntry->AuthState = AS_NOT_AUTH; - pEntry->Aid = (USHORT)i; //0; - pEntry->CapabilityInfo = 0; - pEntry->PsMode = PWR_ACTIVE; - pEntry->PsQIdleCount = 0; - pEntry->NoDataIdleCount = 0; - pEntry->AssocDeadLine = MAC_TABLE_ASSOC_TIMEOUT; - pEntry->ContinueTxFailCnt = 0; -#ifdef WDS_SUPPORT - pEntry->LockEntryTx = FALSE; - pEntry->TimeStamp_toTxRing = 0; -#endif // WDS_SUPPORT // - InitializeQueueHeader(&pEntry->PsQueue); - - - pAd->MacTab.Size ++; - // Add this entry into ASIC RX WCID search table - RTMP_STA_ENTRY_ADD(pAd, pEntry); - - - - DBGPRINT(RT_DEBUG_TRACE, ("MacTableInsertEntry - allocate entry #%d, Total= %d\n",i, pAd->MacTab.Size)); - break; - } - } - - // add this MAC entry into HASH table - if (pEntry) - { - HashIdx = MAC_ADDR_HASH_INDEX(pAddr); - if (pAd->MacTab.Hash[HashIdx] == NULL) - { - pAd->MacTab.Hash[HashIdx] = pEntry; - } - else - { - pCurrEntry = pAd->MacTab.Hash[HashIdx]; - while (pCurrEntry->pNext != NULL) - pCurrEntry = pCurrEntry->pNext; - pCurrEntry->pNext = pEntry; - } - } - - NdisReleaseSpinLock(&pAd->MacTabLock); - return pEntry; -} - -/* - ========================================================================== - Description: - Delete a specified client from MAC table - ========================================================================== - */ -BOOLEAN MacTableDeleteEntry( - IN PRTMP_ADAPTER pAd, - IN USHORT wcid, - IN PUCHAR pAddr) -{ - USHORT HashIdx; - MAC_TABLE_ENTRY *pEntry, *pPrevEntry, *pProbeEntry; - BOOLEAN Cancelled; - //USHORT offset; // unused variable - //UCHAR j; // unused variable - - if (wcid >= MAX_LEN_OF_MAC_TABLE) - return FALSE; - - NdisAcquireSpinLock(&pAd->MacTabLock); - - HashIdx = MAC_ADDR_HASH_INDEX(pAddr); - //pEntry = pAd->MacTab.Hash[HashIdx]; - pEntry = &pAd->MacTab.Content[wcid]; - - if (pEntry && (pEntry->ValidAsCLI || pEntry->ValidAsApCli || pEntry->ValidAsWDS || pEntry->ValidAsMesh -#ifdef CONFIG_STA_SUPPORT -#ifdef QOS_DLS_SUPPORT - || pEntry->ValidAsDls -#endif // QOS_DLS_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - )) - { - if (MAC_ADDR_EQUAL(pEntry->Addr, pAddr)) - { - - // Delete this entry from ASIC on-chip WCID Table - RTMP_STA_ENTRY_MAC_RESET(pAd, wcid); - -#ifdef DOT11_N_SUPPORT - // free resources of BA - BASessionTearDownALL(pAd, pEntry->Aid); -#endif // DOT11_N_SUPPORT // - - - pPrevEntry = NULL; - pProbeEntry = pAd->MacTab.Hash[HashIdx]; - ASSERT(pProbeEntry); - - // update Hash list - do - { - if (pProbeEntry == pEntry) - { - if (pPrevEntry == NULL) - { - pAd->MacTab.Hash[HashIdx] = pEntry->pNext; - } - else - { - pPrevEntry->pNext = pEntry->pNext; - } - break; - } - - pPrevEntry = pProbeEntry; - pProbeEntry = pProbeEntry->pNext; - } while (pProbeEntry); - - // not found !!! - ASSERT(pProbeEntry != NULL); - - RTMP_STA_ENTRY_KEY_DEL(pAd, BSS0, wcid); - - - if (pEntry->EnqueueEapolStartTimerRunning != EAPOL_START_DISABLE) - { - RTMPCancelTimer(&pEntry->EnqueueStartForPSKTimer, &Cancelled); - pEntry->EnqueueEapolStartTimerRunning = EAPOL_START_DISABLE; - } - - - NdisZeroMemory(pEntry, sizeof(MAC_TABLE_ENTRY)); - pAd->MacTab.Size --; - DBGPRINT(RT_DEBUG_TRACE, ("MacTableDeleteEntry1 - Total= %d\n", pAd->MacTab.Size)); - } - else - { - DBGPRINT(RT_DEBUG_OFF, ("\n%s: Impossible Wcid = %d !!!!!\n", __FUNCTION__, wcid)); - } - } - - NdisReleaseSpinLock(&pAd->MacTabLock); - - //Reset operating mode when no Sta. - if (pAd->MacTab.Size == 0) - { -#ifdef DOT11_N_SUPPORT - pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode = 0; -#endif // DOT11_N_SUPPORT // - //AsicUpdateProtect(pAd, 0 /*pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode*/, (ALLN_SETPROTECT), TRUE, 0 /*pAd->MacTab.fAnyStationNonGF*/); - RTMP_UPDATE_PROTECT(pAd); // edit by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet - } - - return TRUE; -} - - -/* - ========================================================================== - Description: - This routine reset the entire MAC table. All packets pending in - the power-saving queues are freed here. - ========================================================================== - */ -VOID MacTableReset( - IN PRTMP_ADAPTER pAd) -{ - int i; - - DBGPRINT(RT_DEBUG_TRACE, ("MacTableReset\n")); - //NdisAcquireSpinLock(&pAd->MacTabLock); - - - for (i=1; iMacTab.Content[i].ValidAsCLI == TRUE) - { - - -#ifdef DOT11_N_SUPPORT - // free resources of BA - BASessionTearDownALL(pAd, i); -#endif // DOT11_N_SUPPORT // - - pAd->MacTab.Content[i].ValidAsCLI = FALSE; - - - - - //AsicDelWcidTab(pAd, i); - } - } - - return; -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID AssocParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_ASSOC_REQ_STRUCT *AssocReq, - IN PUCHAR pAddr, - IN USHORT CapabilityInfo, - IN ULONG Timeout, - IN USHORT ListenIntv) -{ - COPY_MAC_ADDR(AssocReq->Addr, pAddr); - // Add mask to support 802.11b mode only - AssocReq->CapabilityInfo = CapabilityInfo & SUPPORTED_CAPABILITY_INFO; // not cf-pollable, not cf-poll-request - AssocReq->Timeout = Timeout; - AssocReq->ListenIntv = ListenIntv; -} - - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID DisassocParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_DISASSOC_REQ_STRUCT *DisassocReq, - IN PUCHAR pAddr, - IN USHORT Reason) -{ - COPY_MAC_ADDR(DisassocReq->Addr, pAddr); - DisassocReq->Reason = Reason; -} - - -/* - ======================================================================== - - Routine Description: - Check the out going frame, if this is an DHCP or ARP datagram - will be duplicate another frame at low data rate transmit. - - Arguments: - pAd Pointer to our adapter - pPacket Pointer to outgoing Ndis frame - - Return Value: - TRUE To be duplicate at Low data rate transmit. (1mb) - FALSE Do nothing. - - IRQL = DISPATCH_LEVEL - - Note: - - MAC header + IP Header + UDP Header - 14 Bytes 20 Bytes - - UDP Header - 00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15| - Source Port - 16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31| - Destination Port - - port 0x43 means Bootstrap Protocol, server. - Port 0x44 means Bootstrap Protocol, client. - - ======================================================================== -*/ - -BOOLEAN RTMPCheckDHCPFrame( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket) -{ - PACKET_INFO PacketInfo; - ULONG NumberOfBytesRead = 0; - ULONG CurrentOffset = 0; - PVOID pVirtualAddress = NULL; - UINT NdisBufferLength; - PUCHAR pSrc; - USHORT Protocol; - UCHAR ByteOffset36 = 0; - UCHAR ByteOffset38 = 0; - BOOLEAN ReadFirstParm = TRUE; - - RTMP_QueryPacketInfo(pPacket, &PacketInfo, (PUCHAR *)&pVirtualAddress, &NdisBufferLength); - - NumberOfBytesRead += NdisBufferLength; - pSrc = (PUCHAR) pVirtualAddress; - Protocol = *(pSrc + 12) * 256 + *(pSrc + 13); - - // - // Check DHCP & BOOTP protocol - // - while (NumberOfBytesRead <= PacketInfo.TotalPacketLength) - { - if ((NumberOfBytesRead >= 35) && (ReadFirstParm == TRUE)) - { - CurrentOffset = 35 - (NumberOfBytesRead - NdisBufferLength); - ByteOffset36 = *(pSrc + CurrentOffset); - ReadFirstParm = FALSE; - } - - if (NumberOfBytesRead >= 37) - { - CurrentOffset = 37 - (NumberOfBytesRead - NdisBufferLength); - ByteOffset38 = *(pSrc + CurrentOffset); - //End of Read - break; - } - return FALSE; - } - - // Check for DHCP & BOOTP protocol - if ((ByteOffset36 != 0x44) || (ByteOffset38 != 0x43)) - { - // - // 2054 (hex 0806) for ARP datagrams - // if this packet is not ARP datagrams, then do nothing - // ARP datagrams will also be duplicate at 1mb broadcast frames - // - if (Protocol != 0x0806 ) - return FALSE; - } - - return TRUE; -} - - -BOOLEAN RTMPCheckEtherType( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket) -{ - USHORT TypeLen; - UCHAR Byte0, Byte1; - PUCHAR pSrcBuf; - UINT32 pktLen; - UINT16 srcPort, dstPort; - BOOLEAN status = TRUE; - - - pSrcBuf = GET_OS_PKT_DATAPTR(pPacket); - pktLen = GET_OS_PKT_LEN(pPacket); - - ASSERT(pSrcBuf); - - RTMP_SET_PACKET_SPECIFIC(pPacket, 0); - - // get Ethernet protocol field - TypeLen = (pSrcBuf[12] << 8) + pSrcBuf[13]; - - pSrcBuf += LENGTH_802_3; // Skip the Ethernet Header. - - if (TypeLen <= 1500) - { // 802.3, 802.3 LLC - /* - DestMAC(6) + SrcMAC(6) + Lenght(2) + - DSAP(1) + SSAP(1) + Control(1) + - if the DSAP = 0xAA, SSAP=0xAA, Contorl = 0x03, it has a 5-bytes SNAP header. - => + SNAP (5, OriginationID(3) + etherType(2)) - */ - if (pSrcBuf[0] == 0xAA && pSrcBuf[1] == 0xAA && pSrcBuf[2] == 0x03) - { - Sniff2BytesFromNdisBuffer((PNDIS_BUFFER)pSrcBuf, 6, &Byte0, &Byte1); - RTMP_SET_PACKET_LLCSNAP(pPacket, 1); - TypeLen = (USHORT)((Byte0 << 8) + Byte1); - pSrcBuf += 8; // Skip this LLC/SNAP header - } - else - { - //It just has 3-byte LLC header, maybe a legacy ether type frame. we didn't handle it. - } - } - - // If it's a VLAN packet, get the real Type/Length field. - if (TypeLen == 0x8100) - { - /* 0x8100 means VLAN packets */ - - /* Dest. MAC Address (6-bytes) + - Source MAC Address (6-bytes) + - Length/Type = 802.1Q Tag Type (2-byte) + - Tag Control Information (2-bytes) + - Length / Type (2-bytes) + - data payload (0-n bytes) + - Pad (0-p bytes) + - Frame Check Sequence (4-bytes) */ - - RTMP_SET_PACKET_VLAN(pPacket, 1); - Sniff2BytesFromNdisBuffer((PNDIS_BUFFER)pSrcBuf, 2, &Byte0, &Byte1); - TypeLen = (USHORT)((Byte0 << 8) + Byte1); - - pSrcBuf += 4; // Skip the VLAN Header. - } - - switch (TypeLen) - { - case 0x0800: - { - ASSERT((pktLen > 34)); - if (*(pSrcBuf + 9) == 0x11) - { // udp packet - ASSERT((pktLen > 34)); // 14 for ethernet header, 20 for IP header - - pSrcBuf += 20; // Skip the IP header - srcPort = OS_NTOHS(get_unaligned((PUINT16)(pSrcBuf))); - dstPort = OS_NTOHS(get_unaligned((PUINT16)(pSrcBuf+2))); - - if ((srcPort==0x44 && dstPort==0x43) || (srcPort==0x43 && dstPort==0x44)) - { //It's a BOOTP/DHCP packet - RTMP_SET_PACKET_DHCP(pPacket, 1); - } - } - } - break; - case 0x0806: - { - //ARP Packet. - RTMP_SET_PACKET_DHCP(pPacket, 1); - } - break; - case 0x888e: - { - // EAPOL Packet. - RTMP_SET_PACKET_EAPOL(pPacket, 1); - } - break; - default: - status = FALSE; - break; - } - - return status; - -} - - - -VOID Update_Rssi_Sample( - IN PRTMP_ADAPTER pAd, - IN RSSI_SAMPLE *pRssi, - IN PRXWI_STRUC pRxWI) - { - CHAR rssi0 = pRxWI->RSSI0; - CHAR rssi1 = pRxWI->RSSI1; - CHAR rssi2 = pRxWI->RSSI2; - - if (rssi0 != 0) - { - pRssi->LastRssi0 = ConvertToRssi(pAd, (CHAR)rssi0, RSSI_0); - pRssi->AvgRssi0X8 = (pRssi->AvgRssi0X8 - pRssi->AvgRssi0) + pRssi->LastRssi0; - pRssi->AvgRssi0 = pRssi->AvgRssi0X8 >> 3; - } - - if (rssi1 != 0) - { - pRssi->LastRssi1 = ConvertToRssi(pAd, (CHAR)rssi1, RSSI_1); - pRssi->AvgRssi1X8 = (pRssi->AvgRssi1X8 - pRssi->AvgRssi1) + pRssi->LastRssi1; - pRssi->AvgRssi1 = pRssi->AvgRssi1X8 >> 3; - } - - if (rssi2 != 0) - { - pRssi->LastRssi2 = ConvertToRssi(pAd, (CHAR)rssi2, RSSI_2); - pRssi->AvgRssi2X8 = (pRssi->AvgRssi2X8 - pRssi->AvgRssi2) + pRssi->LastRssi2; - pRssi->AvgRssi2 = pRssi->AvgRssi2X8 >> 3; - } -} - - - -// Normal legacy Rx packet indication -VOID Indicate_Legacy_Packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) -{ - PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; - UCHAR Header802_3[LENGTH_802_3]; - - // 1. get 802.3 Header - // 2. remove LLC - // a. pointer pRxBlk->pData to payload - // b. modify pRxBlk->DataSize -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(pRxBlk, Header802_3); -#endif // CONFIG_STA_SUPPORT // - - if (pRxBlk->DataSize > MAX_RX_PKT_LEN) - { - - // release packet - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); - return; - } - - - STATS_INC_RX_PACKETS(pAd, FromWhichBSSID); - - - wlan_802_11_to_802_3_packet(pAd, pRxBlk, Header802_3, FromWhichBSSID); - - // - // pass this 802.3 packet to upper layer or forward this packet to WM directly - // -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - ANNOUNCE_OR_FORWARD_802_3_PACKET(pAd, pRxPacket, FromWhichBSSID); -#endif // CONFIG_STA_SUPPORT // - -} - - -// Normal, AMPDU or AMSDU -VOID CmmRxnonRalinkFrameIndicate( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) -{ -#ifdef DOT11_N_SUPPORT - if (RX_BLK_TEST_FLAG(pRxBlk, fRX_AMPDU) && (pAd->CommonCfg.bDisableReordering == 0)) - { - Indicate_AMPDU_Packet(pAd, pRxBlk, FromWhichBSSID); - } - else -#endif // DOT11_N_SUPPORT // - { -#ifdef DOT11_N_SUPPORT - if (RX_BLK_TEST_FLAG(pRxBlk, fRX_AMSDU)) - { - // handle A-MSDU - Indicate_AMSDU_Packet(pAd, pRxBlk, FromWhichBSSID); - } - else -#endif // DOT11_N_SUPPORT // - { - Indicate_Legacy_Packet(pAd, pRxBlk, FromWhichBSSID); - } - } -} - - -VOID CmmRxRalinkFrameIndicate( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) -{ - UCHAR Header802_3[LENGTH_802_3]; - UINT16 Msdu2Size; - UINT16 Payload1Size, Payload2Size; - PUCHAR pData2; - PNDIS_PACKET pPacket2 = NULL; - - - - Msdu2Size = *(pRxBlk->pData) + (*(pRxBlk->pData+1) << 8); - - if ((Msdu2Size <= 1536) && (Msdu2Size < pRxBlk->DataSize)) - { - /* skip two byte MSDU2 len */ - pRxBlk->pData += 2; - pRxBlk->DataSize -= 2; - } - else - { - // release packet - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); - return; - } - - // get 802.3 Header and remove LLC -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(pRxBlk, Header802_3); -#endif // CONFIG_STA_SUPPORT // - - - ASSERT(pRxBlk->pRxPacket); - - // Ralink Aggregation frame - pAd->RalinkCounters.OneSecRxAggregationCount ++; - Payload1Size = pRxBlk->DataSize - Msdu2Size; - Payload2Size = Msdu2Size - LENGTH_802_3; - - pData2 = pRxBlk->pData + Payload1Size + LENGTH_802_3; -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - pPacket2 = duplicate_pkt(pAd, (pData2-LENGTH_802_3), LENGTH_802_3, pData2, Payload2Size, FromWhichBSSID); -#endif // CONFIG_STA_SUPPORT // - - if (!pPacket2) - { - // release packet - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); - return; - } - - // update payload size of 1st packet - pRxBlk->DataSize = Payload1Size; - wlan_802_11_to_802_3_packet(pAd, pRxBlk, Header802_3, FromWhichBSSID); - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - ANNOUNCE_OR_FORWARD_802_3_PACKET(pAd, pRxBlk->pRxPacket, FromWhichBSSID); -#endif // CONFIG_STA_SUPPORT // - - if (pPacket2) - { -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - ANNOUNCE_OR_FORWARD_802_3_PACKET(pAd, pPacket2, FromWhichBSSID); -#endif // CONFIG_STA_SUPPORT // - } -} - - -#define RESET_FRAGFRAME(_fragFrame) \ - { \ - _fragFrame.RxSize = 0; \ - _fragFrame.Sequence = 0; \ - _fragFrame.LastFrag = 0; \ - _fragFrame.Flags = 0; \ - } - - -PNDIS_PACKET RTMPDeFragmentDataFrame( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk) -{ - PHEADER_802_11 pHeader = pRxBlk->pHeader; - PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; - UCHAR *pData = pRxBlk->pData; - USHORT DataSize = pRxBlk->DataSize; - PNDIS_PACKET pRetPacket = NULL; - UCHAR *pFragBuffer = NULL; - BOOLEAN bReassDone = FALSE; - UCHAR HeaderRoom = 0; - - - ASSERT(pHeader); - - HeaderRoom = pData - (UCHAR *)pHeader; - - // Re-assemble the fragmented packets - if (pHeader->Frag == 0) // Frag. Number is 0 : First frag or only one pkt - { - // the first pkt of fragment, record it. - if (pHeader->FC.MoreFrag) - { - ASSERT(pAd->FragFrame.pFragPacket); - pFragBuffer = GET_OS_PKT_DATAPTR(pAd->FragFrame.pFragPacket); - pAd->FragFrame.RxSize = DataSize + HeaderRoom; - NdisMoveMemory(pFragBuffer, pHeader, pAd->FragFrame.RxSize); - pAd->FragFrame.Sequence = pHeader->Sequence; - pAd->FragFrame.LastFrag = pHeader->Frag; // Should be 0 - ASSERT(pAd->FragFrame.LastFrag == 0); - goto done; // end of processing this frame - } - } - else //Middle & End of fragment - { - if ((pHeader->Sequence != pAd->FragFrame.Sequence) || - (pHeader->Frag != (pAd->FragFrame.LastFrag + 1))) - { - // Fragment is not the same sequence or out of fragment number order - // Reset Fragment control blk - RESET_FRAGFRAME(pAd->FragFrame); - DBGPRINT(RT_DEBUG_ERROR, ("Fragment is not the same sequence or out of fragment number order.\n")); - goto done; // give up this frame - } - else if ((pAd->FragFrame.RxSize + DataSize) > MAX_FRAME_SIZE) - { - // Fragment frame is too large, it exeeds the maximum frame size. - // Reset Fragment control blk - RESET_FRAGFRAME(pAd->FragFrame); - DBGPRINT(RT_DEBUG_ERROR, ("Fragment frame is too large, it exeeds the maximum frame size.\n")); - goto done; // give up this frame - } - - // - // Broadcom AP(BCM94704AGR) will send out LLC in fragment's packet, LLC only can accpet at first fragment. - // In this case, we will dropt it. - // - if (NdisEqualMemory(pData, SNAP_802_1H, sizeof(SNAP_802_1H))) - { - DBGPRINT(RT_DEBUG_ERROR, ("Find another LLC at Middle or End fragment(SN=%d, Frag=%d)\n", pHeader->Sequence, pHeader->Frag)); - goto done; // give up this frame - } - - pFragBuffer = GET_OS_PKT_DATAPTR(pAd->FragFrame.pFragPacket); - - // concatenate this fragment into the re-assembly buffer - NdisMoveMemory((pFragBuffer + pAd->FragFrame.RxSize), pData, DataSize); - pAd->FragFrame.RxSize += DataSize; - pAd->FragFrame.LastFrag = pHeader->Frag; // Update fragment number - - // Last fragment - if (pHeader->FC.MoreFrag == FALSE) - { - bReassDone = TRUE; - } - } - -done: - // always release rx fragmented packet - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); - - // return defragmented packet if packet is reassembled completely - // otherwise return NULL - if (bReassDone) - { - PNDIS_PACKET pNewFragPacket; - - // allocate a new packet buffer for fragment - pNewFragPacket = RTMP_AllocateFragPacketBuffer(pAd, RX_BUFFER_NORMSIZE); - if (pNewFragPacket) - { - // update RxBlk - pRetPacket = pAd->FragFrame.pFragPacket; - pAd->FragFrame.pFragPacket = pNewFragPacket; - pRxBlk->pHeader = (PHEADER_802_11) GET_OS_PKT_DATAPTR(pRetPacket); - pRxBlk->pData = (UCHAR *)pRxBlk->pHeader + HeaderRoom; - pRxBlk->DataSize = pAd->FragFrame.RxSize - HeaderRoom; - pRxBlk->pRxPacket = pRetPacket; - } - else - { - RESET_FRAGFRAME(pAd->FragFrame); - } - } - - return pRetPacket; -} - - -VOID Indicate_AMSDU_Packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) -{ - UINT nMSDU; - - update_os_packet_info(pAd, pRxBlk, FromWhichBSSID); - RTMP_SET_PACKET_IF(pRxBlk->pRxPacket, FromWhichBSSID); - nMSDU = deaggregate_AMSDU_announce(pAd, pRxBlk->pRxPacket, pRxBlk->pData, pRxBlk->DataSize); -} - -VOID Indicate_EAPOL_Packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) -{ - MAC_TABLE_ENTRY *pEntry = NULL; - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - pEntry = &pAd->MacTab.Content[BSSID_WCID]; - STARxEAPOLFrameIndicate(pAd, pEntry, pRxBlk, FromWhichBSSID); - return; - } -#endif // CONFIG_STA_SUPPORT // - - if (pEntry == NULL) - { - DBGPRINT(RT_DEBUG_WARN, ("Indicate_EAPOL_Packet: drop and release the invalid packet.\n")); - // release packet - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); - return; - } -} - -#define BCN_TBTT_OFFSET 64 //defer 64 us -VOID ReSyncBeaconTime( - IN PRTMP_ADAPTER pAd) -{ - - UINT32 Offset; - - - Offset = (pAd->TbttTickCount) % (BCN_TBTT_OFFSET); - - pAd->TbttTickCount++; - - // - // The updated BeaconInterval Value will affect Beacon Interval after two TBTT - // beacasue the original BeaconInterval had been loaded into next TBTT_TIMER - // - if (Offset == (BCN_TBTT_OFFSET-2)) - { - BCN_TIME_CFG_STRUC csr; - RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr.word); - csr.field.BeaconInterval = (pAd->CommonCfg.BeaconPeriod << 4) - 1 ; // ASIC register in units of 1/16 TU = 64us - RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr.word); - } - else - { - if (Offset == (BCN_TBTT_OFFSET-1)) - { - BCN_TIME_CFG_STRUC csr; - - RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr.word); - csr.field.BeaconInterval = (pAd->CommonCfg.BeaconPeriod) << 4; // ASIC register in units of 1/16 TU - RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr.word); - } - } -} diff --git a/drivers/staging/rt3090/common/cmm_data_pci.c b/drivers/staging/rt3090/common/cmm_data_pci.c deleted file mode 100644 index 084f81927158..000000000000 --- a/drivers/staging/rt3090/common/cmm_data_pci.c +++ /dev/null @@ -1,1576 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* -*/ - -/* - All functions in this file must be PCI-depended, or you should out your function - in other files. - -*/ -#include "../rt_config.h" - - -USHORT RtmpPCI_WriteTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN BOOLEAN bIsLast, - OUT USHORT *FreeNumber) -{ - - UCHAR *pDMAHeaderBufVA; - USHORT TxIdx, RetTxIdx; - PTXD_STRUC pTxD; - UINT32 BufBasePaLow; - PRTMP_TX_RING pTxRing; - USHORT hwHeaderLen; - - // - // get Tx Ring Resource - // - pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; - TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; - pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; - BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); - - // copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer - if (pTxBlk->TxFrameType == TX_AMSDU_FRAME) - { - //hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD; - hwHeaderLen = pTxBlk->MpduHeaderLen - LENGTH_AMSDU_SUBFRAMEHEAD + pTxBlk->HdrPadLen + LENGTH_AMSDU_SUBFRAMEHEAD; - } - else - { - //hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); - hwHeaderLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; - } - NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, TXINFO_SIZE + TXWI_SIZE + hwHeaderLen); - - pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket; - pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; - - // - // build Tx Descriptor - // - - pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; - NdisZeroMemory(pTxD, TXD_SIZE); - - pTxD->SDPtr0 = BufBasePaLow; - pTxD->SDLen0 = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; // include padding - pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE); - pTxD->SDLen1 = pTxBlk->SrcBufLen; - pTxD->LastSec0 = 0; - pTxD->LastSec1 = (bIsLast) ? 1 : 0; - - RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); - - RetTxIdx = TxIdx; - // - // Update Tx index - // - INC_RING_INDEX(TxIdx, TX_RING_SIZE); - pTxRing->TxCpuIdx = TxIdx; - - *FreeNumber -= 1; - - return RetTxIdx; -} - - -USHORT RtmpPCI_WriteSingleTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN BOOLEAN bIsLast, - OUT USHORT *FreeNumber) -{ - - UCHAR *pDMAHeaderBufVA; - USHORT TxIdx, RetTxIdx; - PTXD_STRUC pTxD; -#ifdef RT_BIG_ENDIAN - PTXD_STRUC pDestTxD; - TXD_STRUC TxD; -#endif - UINT32 BufBasePaLow; - PRTMP_TX_RING pTxRing; - USHORT hwHeaderLen; - - // - // get Tx Ring Resource - // - pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; - TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; - pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; - BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); - - // copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer - //hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); - hwHeaderLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; - - NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, TXINFO_SIZE + TXWI_SIZE + hwHeaderLen); - - pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket; - pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; - - // - // build Tx Descriptor - // -#ifndef RT_BIG_ENDIAN - pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; -#else - pDestTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; - TxD = *pDestTxD; - pTxD = &TxD; -#endif - NdisZeroMemory(pTxD, TXD_SIZE); - - pTxD->SDPtr0 = BufBasePaLow; - pTxD->SDLen0 = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; // include padding - pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE);; - pTxD->SDLen1 = pTxBlk->SrcBufLen; - pTxD->LastSec0 = 0; - pTxD->LastSec1 = (bIsLast) ? 1 : 0; - - RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); -#ifdef RT_BIG_ENDIAN - RTMPWIEndianChange((PUCHAR)(pDMAHeaderBufVA + TXINFO_SIZE), TYPE_TXWI); - RTMPFrameEndianChange(pAd, (PUCHAR)(pDMAHeaderBufVA + TXINFO_SIZE + TXWI_SIZE), DIR_WRITE, FALSE); - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); - WriteBackToDescriptor((PUCHAR)pDestTxD, (PUCHAR)pTxD, FALSE, TYPE_TXD); -#endif // RT_BIG_ENDIAN // - - RetTxIdx = TxIdx; - // - // Update Tx index - // - INC_RING_INDEX(TxIdx, TX_RING_SIZE); - pTxRing->TxCpuIdx = TxIdx; - - *FreeNumber -= 1; - - return RetTxIdx; -} - - -USHORT RtmpPCI_WriteMultiTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR frameNum, - OUT USHORT *FreeNumber) -{ - BOOLEAN bIsLast; - UCHAR *pDMAHeaderBufVA; - USHORT TxIdx, RetTxIdx; - PTXD_STRUC pTxD; -#ifdef RT_BIG_ENDIAN - PTXD_STRUC pDestTxD; - TXD_STRUC TxD; -#endif - UINT32 BufBasePaLow; - PRTMP_TX_RING pTxRing; - USHORT hwHdrLen; - UINT32 firstDMALen; - - bIsLast = ((frameNum == (pTxBlk->TotalFrameNum - 1)) ? 1 : 0); - - // - // get Tx Ring Resource - // - pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; - TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; - pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; - BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); - - if (frameNum == 0) - { - // copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer - if (pTxBlk->TxFrameType == TX_AMSDU_FRAME) - //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD; - hwHdrLen = pTxBlk->MpduHeaderLen - LENGTH_AMSDU_SUBFRAMEHEAD + pTxBlk->HdrPadLen + LENGTH_AMSDU_SUBFRAMEHEAD; - else if (pTxBlk->TxFrameType == TX_RALINK_FRAME) - //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_ARALINK_HEADER_FIELD, 4)+LENGTH_ARALINK_HEADER_FIELD; - hwHdrLen = pTxBlk->MpduHeaderLen - LENGTH_ARALINK_HEADER_FIELD + pTxBlk->HdrPadLen + LENGTH_ARALINK_HEADER_FIELD; - else - //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); - hwHdrLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; - - firstDMALen = TXINFO_SIZE + TXWI_SIZE + hwHdrLen; - } - else - { - firstDMALen = pTxBlk->MpduHeaderLen; - } - - NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, firstDMALen); - - pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket; - pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; - - // - // build Tx Descriptor - // -#ifndef RT_BIG_ENDIAN - pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; -#else - pDestTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; - TxD = *pDestTxD; - pTxD = &TxD; -#endif - NdisZeroMemory(pTxD, TXD_SIZE); - - pTxD->SDPtr0 = BufBasePaLow; - pTxD->SDLen0 = firstDMALen; // include padding - pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE);; - pTxD->SDLen1 = pTxBlk->SrcBufLen; - pTxD->LastSec0 = 0; - pTxD->LastSec1 = (bIsLast) ? 1 : 0; - - RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); - -#ifdef RT_BIG_ENDIAN - if (frameNum == 0) - RTMPFrameEndianChange(pAd, (PUCHAR)(pDMAHeaderBufVA+ TXINFO_SIZE + TXWI_SIZE), DIR_WRITE, FALSE); - - if (frameNum != 0) - RTMPWIEndianChange((PUCHAR)(pDMAHeaderBufVA + TXINFO_SIZE), TYPE_TXWI); - - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); - WriteBackToDescriptor((PUCHAR)pDestTxD, (PUCHAR)pTxD, FALSE, TYPE_TXD); -#endif // RT_BIG_ENDIAN // - - RetTxIdx = TxIdx; - // - // Update Tx index - // - INC_RING_INDEX(TxIdx, TX_RING_SIZE); - pTxRing->TxCpuIdx = TxIdx; - - *FreeNumber -= 1; - - return RetTxIdx; - -} - - -VOID RtmpPCI_FinalWriteTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN USHORT totalMPDUSize, - IN USHORT FirstTxIdx) -{ - - PTXWI_STRUC pTxWI; - PRTMP_TX_RING pTxRing; - - // - // get Tx Ring Resource - // - pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; - pTxWI = (PTXWI_STRUC) pTxRing->Cell[FirstTxIdx].DmaBuf.AllocVa; - pTxWI->MPDUtotalByteCount = totalMPDUSize; -#ifdef RT_BIG_ENDIAN - RTMPWIEndianChange((PUCHAR)pTxWI, TYPE_TXWI); -#endif // RT_BIG_ENDIAN // - -} - - -VOID RtmpPCIDataLastTxIdx( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN USHORT LastTxIdx) -{ - PTXD_STRUC pTxD; -#ifdef RT_BIG_ENDIAN - PTXD_STRUC pDestTxD; - TXD_STRUC TxD; -#endif - PRTMP_TX_RING pTxRing; - - // - // get Tx Ring Resource - // - pTxRing = &pAd->TxRing[QueIdx]; - - // - // build Tx Descriptor - // -#ifndef RT_BIG_ENDIAN - pTxD = (PTXD_STRUC) pTxRing->Cell[LastTxIdx].AllocVa; -#else - pDestTxD = (PTXD_STRUC) pTxRing->Cell[LastTxIdx].AllocVa; - TxD = *pDestTxD; - pTxD = &TxD; -#endif - - pTxD->LastSec1 = 1; - -#ifdef RT_BIG_ENDIAN - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); - WriteBackToDescriptor((PUCHAR)pDestTxD, (PUCHAR)pTxD, FALSE, TYPE_TXD); -#endif // RT_BIG_ENDIAN // - -} - - -USHORT RtmpPCI_WriteFragTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR fragNum, - OUT USHORT *FreeNumber) -{ - UCHAR *pDMAHeaderBufVA; - USHORT TxIdx, RetTxIdx; - PTXD_STRUC pTxD; -#ifdef RT_BIG_ENDIAN - PTXD_STRUC pDestTxD; - TXD_STRUC TxD; -#endif - UINT32 BufBasePaLow; - PRTMP_TX_RING pTxRing; - USHORT hwHeaderLen; - UINT32 firstDMALen; - - // - // Get Tx Ring Resource - // - pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; - TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; - pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; - BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); - - // - // Copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer - // - //hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); - hwHeaderLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; - - firstDMALen = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; - NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, firstDMALen); - - - // - // Build Tx Descriptor - // -#ifndef RT_BIG_ENDIAN - pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; -#else - pDestTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; - TxD = *pDestTxD; - pTxD = &TxD; -#endif - NdisZeroMemory(pTxD, TXD_SIZE); - - if (fragNum == pTxBlk->TotalFragNum) - { - pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket; - pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; - } - - pTxD->SDPtr0 = BufBasePaLow; - pTxD->SDLen0 = firstDMALen; // include padding - pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE); - pTxD->SDLen1 = pTxBlk->SrcBufLen; - pTxD->LastSec0 = 0; - pTxD->LastSec1 = 1; - - RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); - -#ifdef RT_BIG_ENDIAN - RTMPWIEndianChange((PUCHAR)(pDMAHeaderBufVA + TXINFO_SIZE), TYPE_TXWI); - RTMPFrameEndianChange(pAd, (PUCHAR)(pDMAHeaderBufVA + TXINFO_SIZE + TXWI_SIZE), DIR_WRITE, FALSE); - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); - WriteBackToDescriptor((PUCHAR)pDestTxD, (PUCHAR)pTxD, FALSE, TYPE_TXD); -#endif // RT_BIG_ENDIAN // - - RetTxIdx = TxIdx; - pTxBlk->Priv += pTxBlk->SrcBufLen; - - // - // Update Tx index - // - INC_RING_INDEX(TxIdx, TX_RING_SIZE); - pTxRing->TxCpuIdx = TxIdx; - - *FreeNumber -= 1; - - return RetTxIdx; - -} - - -/* - Must be run in Interrupt context - This function handle PCI specific TxDesc and cpu index update and kick the packet out. - */ -int RtmpPCIMgmtKickOut( - IN RTMP_ADAPTER *pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket, - IN PUCHAR pSrcBufVA, - IN UINT SrcBufLen) -{ - PTXD_STRUC pTxD; -#ifdef RT_BIG_ENDIAN - PTXD_STRUC pDestTxD; - TXD_STRUC TxD; -#endif - ULONG SwIdx = pAd->MgmtRing.TxCpuIdx; - -#ifdef RT_BIG_ENDIAN - pDestTxD = (PTXD_STRUC)pAd->MgmtRing.Cell[SwIdx].AllocVa; - TxD = *pDestTxD; - pTxD = &TxD; - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); -#else - pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[SwIdx].AllocVa; -#endif - - pAd->MgmtRing.Cell[SwIdx].pNdisPacket = pPacket; - pAd->MgmtRing.Cell[SwIdx].pNextNdisPacket = NULL; - - RTMPWriteTxDescriptor(pAd, pTxD, TRUE, FIFO_MGMT); - pTxD->LastSec0 = 1; - pTxD->LastSec1 = 1; - pTxD->DMADONE = 0; - pTxD->SDLen1 = 0; - pTxD->SDPtr0 = PCI_MAP_SINGLE(pAd, pSrcBufVA, SrcBufLen, 0, PCI_DMA_TODEVICE); - pTxD->SDLen0 = SrcBufLen; - -#ifdef RT_BIG_ENDIAN - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); - WriteBackToDescriptor((PUCHAR)pDestTxD, (PUCHAR)pTxD, FALSE, TYPE_TXD); -#endif - -//================================================================== -/* DBGPRINT_RAW(RT_DEBUG_TRACE, ("MLMEHardTransmit\n")); - for (i = 0; i < (TXWI_SIZE+24); i++) - { - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("%x:", *(pSrcBufVA+i))); - if ( i%4 == 3) - DBGPRINT_RAW(RT_DEBUG_TRACE, (" :: ")); - if ( i%16 == 15) - DBGPRINT_RAW(RT_DEBUG_TRACE, ("\n ")); - } - DBGPRINT_RAW(RT_DEBUG_TRACE, ("\n "));*/ -//======================================================================= - - pAd->RalinkCounters.KickTxCount++; - pAd->RalinkCounters.OneSecTxDoneCount++; - - // Increase TX_CTX_IDX, but write to register later. - INC_RING_INDEX(pAd->MgmtRing.TxCpuIdx, MGMT_RING_SIZE); - - RTMP_IO_WRITE32(pAd, TX_MGMTCTX_IDX, pAd->MgmtRing.TxCpuIdx); - - return 0; -} - - -#ifdef CONFIG_STA_SUPPORT -/* - ======================================================================== - - Routine Description: - Check Rx descriptor, return NDIS_STATUS_FAILURE if any error dound - - Arguments: - pRxD Pointer to the Rx descriptor - - Return Value: - NDIS_STATUS_SUCCESS No err - NDIS_STATUS_FAILURE Error - - Note: - - ======================================================================== -*/ -NDIS_STATUS RTMPCheckRxError( - IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHeader, - IN PRXWI_STRUC pRxWI, - IN PRT28XX_RXD_STRUC pRxD) -{ - PCIPHER_KEY pWpaKey; - INT dBm; - - // Phy errors & CRC errors - if (/*(pRxD->PhyErr) ||*/ (pRxD->Crc)) - { - // Check RSSI for Noise Hist statistic collection. - dBm = (INT) (pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta; - if (dBm <= -87) - pAd->StaCfg.RPIDensity[0] += 1; - else if (dBm <= -82) - pAd->StaCfg.RPIDensity[1] += 1; - else if (dBm <= -77) - pAd->StaCfg.RPIDensity[2] += 1; - else if (dBm <= -72) - pAd->StaCfg.RPIDensity[3] += 1; - else if (dBm <= -67) - pAd->StaCfg.RPIDensity[4] += 1; - else if (dBm <= -62) - pAd->StaCfg.RPIDensity[5] += 1; - else if (dBm <= -57) - pAd->StaCfg.RPIDensity[6] += 1; - else if (dBm > -57) - pAd->StaCfg.RPIDensity[7] += 1; - - return(NDIS_STATUS_FAILURE); - } - - // Add Rx size to channel load counter, we should ignore error counts - pAd->StaCfg.CLBusyBytes += (pRxD->SDL0 + 14); - - // Drop ToDs promiscous frame, it is opened due to CCX 2 channel load statistics - if (pHeader != NULL) - { - if (pHeader->FC.ToDs) - { - return(NDIS_STATUS_FAILURE); - } - } - - // Drop not U2M frames, cant's drop here because we will drop beacon in this case - // I am kind of doubting the U2M bit operation - // if (pRxD->U2M == 0) - // return(NDIS_STATUS_FAILURE); - - // drop decyption fail frame - if (pRxD->CipherErr) - { - if (pRxD->CipherErr == 2) - {DBGPRINT_RAW(RT_DEBUG_TRACE,("pRxD ERROR: ICV ok but MICErr "));} - else if (pRxD->CipherErr == 1) - {DBGPRINT_RAW(RT_DEBUG_TRACE,("pRxD ERROR: ICV Err "));} - else if (pRxD->CipherErr == 3) - DBGPRINT_RAW(RT_DEBUG_TRACE,("pRxD ERROR: Key not valid ")); - - if (((pRxD->CipherErr & 1) == 1) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) - RTMPSendWirelessEvent(pAd, IW_ICV_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - - DBGPRINT_RAW(RT_DEBUG_TRACE,(" %d (len=%d, Mcast=%d, MyBss=%d, Wcid=%d, KeyId=%d)\n", - pRxD->CipherErr, - pRxD->SDL0, - pRxD->Mcast | pRxD->Bcast, - pRxD->MyBss, - pRxWI->WirelessCliID, -// CipherName[pRxD->CipherAlg], - pRxWI->KeyIndex)); - - // - // MIC Error - // - if (pRxD->CipherErr == 2) - { - pWpaKey = &pAd->SharedKey[BSS0][pRxWI->KeyIndex]; -#ifdef WPA_SUPPLICANT_SUPPORT - if (pAd->StaCfg.WpaSupplicantUP) - WpaSendMicFailureToWpaSupplicant(pAd, - (pWpaKey->Type == PAIRWISEKEY) ? TRUE:FALSE); - else -#endif // WPA_SUPPLICANT_SUPPORT // - RTMPReportMicError(pAd, pWpaKey); - - if (((pRxD->CipherErr & 2) == 2) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) - RTMPSendWirelessEvent(pAd, IW_MIC_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - - DBGPRINT_RAW(RT_DEBUG_ERROR,("Rx MIC Value error\n")); - } - - if (pHeader == NULL) - return(NDIS_STATUS_SUCCESS); - /*if ((pRxD->CipherAlg == CIPHER_AES) && - (pHeader->Sequence == pAd->FragFrame.Sequence)) - { - // - // Acceptable since the First FragFrame no CipherErr problem. - // - return(NDIS_STATUS_SUCCESS); - }*/ - - return(NDIS_STATUS_FAILURE); - } - - return(NDIS_STATUS_SUCCESS); -} -#endif // CONFIG_STA_SUPPORT // - - -BOOLEAN RTMPFreeTXDUponTxDmaDone( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx) -{ - PRTMP_TX_RING pTxRing; - PTXD_STRUC pTxD; -#ifdef RT_BIG_ENDIAN - PTXD_STRUC pDestTxD; -#endif - PNDIS_PACKET pPacket; - UCHAR FREE = 0; - TXD_STRUC TxD, *pOriTxD; - //ULONG IrqFlags; - BOOLEAN bReschedule = FALSE; - - - ASSERT(QueIdx < NUM_OF_TX_RING); - pTxRing = &pAd->TxRing[QueIdx]; - - RTMP_IO_READ32(pAd, TX_DTX_IDX0 + QueIdx * RINGREG_DIFF, &pTxRing->TxDmaIdx); - while (pTxRing->TxSwFreeIdx != pTxRing->TxDmaIdx) - { -// RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); -#ifdef RALINK_ATE -#ifdef RALINK_28xx_QA - PHEADER_802_11 pHeader80211; - - if ((ATE_ON(pAd)) && (pAd->ate.bQATxStart == TRUE)) - { - if (pAd->ate.QID == QueIdx) - { - pAd->ate.TxDoneCount++; - pAd->RalinkCounters.KickTxCount++; - - /* always use QID_AC_BE and FIFO_EDCA */ - ASSERT(pAd->ate.QID == 0); - pAd->ate.TxAc0++; - - FREE++; -#ifndef RT_BIG_ENDIAN - pTxD = (PTXD_STRUC) (pTxRing->Cell[pTxRing->TxSwFreeIdx].AllocVa); - pOriTxD = pTxD; - NdisMoveMemory(&TxD, pTxD, sizeof(TXD_STRUC)); - pTxD = &TxD; -#else - pDestTxD = (PTXD_STRUC) (pTxRing->Cell[pTxRing->TxSwFreeIdx].AllocVa); - pOriTxD = pDestTxD ; - TxD = *pDestTxD; - pTxD = &TxD; - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); -#endif - pTxD->DMADONE = 0; - - pHeader80211 = pTxRing->Cell[pTxRing->TxSwFreeIdx].DmaBuf.AllocVa + sizeof(TXWI_STRUC); -#ifdef RT_BIG_ENDIAN - RTMPFrameEndianChange(pAd, (PUCHAR)pHeader80211, DIR_READ, FALSE); -#endif - pHeader80211->Sequence = ++pAd->ate.seq; -#ifdef RT_BIG_ENDIAN - RTMPFrameEndianChange(pAd, (PUCHAR)pHeader80211, DIR_WRITE, FALSE); -#endif - - if ((pAd->ate.bQATxStart == TRUE) && (pAd->ate.Mode & ATE_TXFRAME) && (pAd->ate.TxDoneCount < pAd->ate.TxCount)) - { - pAd->RalinkCounters.TransmittedByteCount += (pTxD->SDLen1 + pTxD->SDLen0); - pAd->RalinkCounters.OneSecTransmittedByteCount += (pTxD->SDLen1 + pTxD->SDLen0); - pAd->RalinkCounters.OneSecDmaDoneCount[QueIdx] ++; - INC_RING_INDEX(pTxRing->TxSwFreeIdx, TX_RING_SIZE); - - /* get TX_DTX_IDX again */ - RTMP_IO_READ32(pAd, TX_DTX_IDX0 + QueIdx * RINGREG_DIFF , &pTxRing->TxDmaIdx); - goto kick_out; - } - else if ((pAd->ate.TxStatus == 1)/* or (pAd->ate.bQATxStart == TRUE) ??? */ && (pAd->ate.TxDoneCount == pAd->ate.TxCount)) - { - DBGPRINT(RT_DEBUG_TRACE,("all Tx is done\n")); - - // Tx status enters idle mode. - pAd->ate.TxStatus = 0; - } - else if (!(pAd->ate.Mode & ATE_TXFRAME)) - { - /* not complete sending yet, but someone press the Stop TX botton */ - DBGPRINT(RT_DEBUG_ERROR,("not complete sending yet, but someone pressed the Stop TX bottom\n")); - DBGPRINT(RT_DEBUG_ERROR,("pAd->ate.Mode = 0x%02x\n", pAd->ate.Mode)); - } - else - { - DBGPRINT(RT_DEBUG_OFF,("pTxRing->TxSwFreeIdx = %d\n", pTxRing->TxSwFreeIdx)); - } - -#ifndef RT_BIG_ENDIAN - NdisMoveMemory(pOriTxD, pTxD, sizeof(TXD_STRUC)); -#else - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); - *pDestTxD = TxD; -#endif // RT_BIG_ENDIAN // - - INC_RING_INDEX(pTxRing->TxSwFreeIdx, TX_RING_SIZE); - continue; - } - } -#endif // RALINK_28xx_QA // -#endif // RALINK_ATE // - - // static rate also need NICUpdateFifoStaCounters() function. - //if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) - NICUpdateFifoStaCounters(pAd); - - /* Note : If (pAd->ate.bQATxStart == TRUE), we will never reach here. */ - FREE++; -#ifndef RT_BIG_ENDIAN - pTxD = (PTXD_STRUC) (pTxRing->Cell[pTxRing->TxSwFreeIdx].AllocVa); - pOriTxD = pTxD; - NdisMoveMemory(&TxD, pTxD, sizeof(TXD_STRUC)); - pTxD = &TxD; -#else - pDestTxD = (PTXD_STRUC) (pTxRing->Cell[pTxRing->TxSwFreeIdx].AllocVa); - pOriTxD = pDestTxD ; - TxD = *pDestTxD; - pTxD = &TxD; - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); -#endif - - pTxD->DMADONE = 0; - - -#ifdef RALINK_ATE - /* Execution of this block is not allowed when ATE is running. */ - if (!(ATE_ON(pAd))) -#endif // RALINK_ATE // - { - pPacket = pTxRing->Cell[pTxRing->TxSwFreeIdx].pNdisPacket; - if (pPacket) - { -#ifdef CONFIG_5VT_ENHANCE - if (RTMP_GET_PACKET_5VT(pPacket)) - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, 16, PCI_DMA_TODEVICE); - else -#endif // CONFIG_5VT_ENHANCE // - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - //Always assign pNdisPacket as NULL after clear - pTxRing->Cell[pTxRing->TxSwFreeIdx].pNdisPacket = NULL; - - pPacket = pTxRing->Cell[pTxRing->TxSwFreeIdx].pNextNdisPacket; - - ASSERT(pPacket == NULL); - if (pPacket) - { -#ifdef CONFIG_5VT_ENHANCE - if (RTMP_GET_PACKET_5VT(pPacket)) - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, 16, PCI_DMA_TODEVICE); - else -#endif // CONFIG_5VT_ENHANCE // - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - //Always assign pNextNdisPacket as NULL after clear - pTxRing->Cell[pTxRing->TxSwFreeIdx].pNextNdisPacket = NULL; - } - - pAd->RalinkCounters.TransmittedByteCount += (pTxD->SDLen1 + pTxD->SDLen0); - pAd->RalinkCounters.OneSecDmaDoneCount[QueIdx] ++; - INC_RING_INDEX(pTxRing->TxSwFreeIdx, TX_RING_SIZE); - /* get tx_tdx_idx again */ - RTMP_IO_READ32(pAd, TX_DTX_IDX0 + QueIdx * RINGREG_DIFF , &pTxRing->TxDmaIdx); -#ifdef RT_BIG_ENDIAN - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); - *pDestTxD = TxD; -#else - NdisMoveMemory(pOriTxD, pTxD, sizeof(TXD_STRUC)); -#endif - -#ifdef RALINK_ATE -#ifdef RALINK_28xx_QA -kick_out: -#endif // RALINK_28xx_QA // - - /* - ATE_TXCONT mode also need to send some normal frames, so let it in. - ATE_STOP must be changed not to be 0xff - to prevent it from running into this block. - */ - if ((pAd->ate.Mode & ATE_TXFRAME) && (pAd->ate.QID == QueIdx)) - { - // TxDoneCount++ has been done if QA is used. - if (pAd->ate.bQATxStart == FALSE) - { - pAd->ate.TxDoneCount++; - } - if (((pAd->ate.TxCount - pAd->ate.TxDoneCount + 1) >= TX_RING_SIZE)) - { - /* Note : We increase TxCpuIdx here, not TxSwFreeIdx ! */ - INC_RING_INDEX(pAd->TxRing[QueIdx].TxCpuIdx, TX_RING_SIZE); -#ifndef RT_BIG_ENDIAN - pTxD = (PTXD_STRUC) (pTxRing->Cell[pAd->TxRing[QueIdx].TxCpuIdx].AllocVa); - pOriTxD = pTxD; - NdisMoveMemory(&TxD, pTxD, sizeof(TXD_STRUC)); - pTxD = &TxD; -#else - pDestTxD = (PTXD_STRUC) (pTxRing->Cell[pAd->TxRing[QueIdx].TxCpuIdx].AllocVa); - pOriTxD = pDestTxD ; - TxD = *pDestTxD; - pTxD = &TxD; - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); -#endif - pTxD->DMADONE = 0; -#ifndef RT_BIG_ENDIAN - NdisMoveMemory(pOriTxD, pTxD, sizeof(TXD_STRUC)); -#else - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); - *pDestTxD = TxD; -#endif - // kick Tx-Ring - RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + QueIdx * RINGREG_DIFF, pAd->TxRing[QueIdx].TxCpuIdx); - pAd->RalinkCounters.KickTxCount++; - } - } -#endif // RALINK_ATE // -// RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); - } - - - return bReschedule; - -} - - -/* - ======================================================================== - - Routine Description: - Process TX Rings DMA Done interrupt, running in DPC level - - Arguments: - Adapter Pointer to our adapter - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - ======================================================================== -*/ -BOOLEAN RTMPHandleTxRingDmaDoneInterrupt( - IN PRTMP_ADAPTER pAd, - IN INT_SOURCE_CSR_STRUC TxRingBitmap) -{ -// UCHAR Count = 0; - unsigned long IrqFlags; - BOOLEAN bReschedule = FALSE; - - // Make sure Tx ring resource won't be used by other threads - //NdisAcquireSpinLock(&pAd->TxRingLock); - - RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); - - if (TxRingBitmap.field.Ac0DmaDone) - bReschedule = RTMPFreeTXDUponTxDmaDone(pAd, QID_AC_BE); -/* - if (TxRingBitmap.field.HccaDmaDone) - bReschedule |= RTMPFreeTXDUponTxDmaDone(pAd, QID_HCCA); -*/ - - if (TxRingBitmap.field.Ac3DmaDone) - bReschedule |= RTMPFreeTXDUponTxDmaDone(pAd, QID_AC_VO); - - if (TxRingBitmap.field.Ac2DmaDone) - bReschedule |= RTMPFreeTXDUponTxDmaDone(pAd, QID_AC_VI); - - if (TxRingBitmap.field.Ac1DmaDone) - bReschedule |= RTMPFreeTXDUponTxDmaDone(pAd, QID_AC_BK); - - // Make sure to release Tx ring resource - //NdisReleaseSpinLock(&pAd->TxRingLock); - RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); - - // Dequeue outgoing frames from TxSwQueue[] and process it - RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); - - return bReschedule; -} - - -/* - ======================================================================== - - Routine Description: - Process MGMT ring DMA done interrupt, running in DPC level - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPHandleMgmtRingDmaDoneInterrupt( - IN PRTMP_ADAPTER pAd) -{ - PTXD_STRUC pTxD; -#ifdef RT_BIG_ENDIAN - PTXD_STRUC pDestTxD; - TXD_STRUC TxD; -#endif - PNDIS_PACKET pPacket; -// int i; - UCHAR FREE = 0; - PRTMP_MGMT_RING pMgmtRing = &pAd->MgmtRing; - - NdisAcquireSpinLock(&pAd->MgmtRingLock); - - RTMP_IO_READ32(pAd, TX_MGMTDTX_IDX, &pMgmtRing->TxDmaIdx); - while (pMgmtRing->TxSwFreeIdx!= pMgmtRing->TxDmaIdx) - { - FREE++; -#ifdef RT_BIG_ENDIAN - pDestTxD = (PTXD_STRUC) (pMgmtRing->Cell[pAd->MgmtRing.TxSwFreeIdx].AllocVa); - TxD = *pDestTxD; - pTxD = &TxD; - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); -#else - pTxD = (PTXD_STRUC) (pMgmtRing->Cell[pAd->MgmtRing.TxSwFreeIdx].AllocVa); -#endif - pTxD->DMADONE = 0; - pPacket = pMgmtRing->Cell[pMgmtRing->TxSwFreeIdx].pNdisPacket; - - - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - pMgmtRing->Cell[pMgmtRing->TxSwFreeIdx].pNdisPacket = NULL; - - pPacket = pMgmtRing->Cell[pMgmtRing->TxSwFreeIdx].pNextNdisPacket; - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - pMgmtRing->Cell[pMgmtRing->TxSwFreeIdx].pNextNdisPacket = NULL; - INC_RING_INDEX(pMgmtRing->TxSwFreeIdx, MGMT_RING_SIZE); - -#ifdef RT_BIG_ENDIAN - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); - WriteBackToDescriptor((PUCHAR)pDestTxD, (PUCHAR)pTxD, TRUE, TYPE_TXD); -#endif - } - NdisReleaseSpinLock(&pAd->MgmtRingLock); - -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // -} - - -/* - ======================================================================== - - Routine Description: - Arguments: - Adapter Pointer to our adapter. Dequeue all power safe delayed braodcast frames after beacon. - - IRQL = DISPATCH_LEVEL - - ======================================================================== -*/ -VOID RTMPHandleTBTTInterrupt( - IN PRTMP_ADAPTER pAd) -{ - { - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - } - } -} - - -/* - ======================================================================== - - Routine Description: - Arguments: - pAd Pointer to our adapter. Rewrite beacon content before next send-out. - - IRQL = DISPATCH_LEVEL - - ======================================================================== -*/ -VOID RTMPHandlePreTBTTInterrupt( - IN PRTMP_ADAPTER pAd) -{ - { - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("RTMPHandlePreTBTTInterrupt...\n")); - } - } - - -} - -VOID RTMPHandleRxCoherentInterrupt( - IN PRTMP_ADAPTER pAd) -{ - WPDMA_GLO_CFG_STRUC GloCfg; - - if (pAd == NULL) - { - DBGPRINT(RT_DEBUG_TRACE, ("====> pAd is NULL, return.\n")); - return; - } - - DBGPRINT(RT_DEBUG_TRACE, ("==> RTMPHandleRxCoherentInterrupt \n")); - - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG , &GloCfg.word); - - GloCfg.field.EnTXWriteBackDDONE = 0; - GloCfg.field.EnableRxDMA = 0; - GloCfg.field.EnableTxDMA = 0; - RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); - - RTMPRingCleanUp(pAd, QID_AC_BE); - RTMPRingCleanUp(pAd, QID_AC_BK); - RTMPRingCleanUp(pAd, QID_AC_VI); - RTMPRingCleanUp(pAd, QID_AC_VO); - /*RTMPRingCleanUp(pAd, QID_HCCA);*/ - RTMPRingCleanUp(pAd, QID_MGMT); - RTMPRingCleanUp(pAd, QID_RX); - - RTMPEnableRxTx(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("<== RTMPHandleRxCoherentInterrupt \n")); -} - - - - -VOID DBGPRINT_TX_RING( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx) -{ - UINT32 Ac0Base; - UINT32 Ac0HwIdx = 0, Ac0SwIdx = 0, AC0freeIdx; - int i; -// PULONG pTxD; - PULONG ptemp; - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("=====================================================\n " )); - switch (QueIdx) - { - case QID_AC_BE: - RTMP_IO_READ32(pAd, TX_BASE_PTR0, &Ac0Base); - RTMP_IO_READ32(pAd, TX_CTX_IDX0, &Ac0SwIdx); - RTMP_IO_READ32(pAd, TX_DTX_IDX0, &Ac0HwIdx); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("All QID_AC_BE DESCRIPTOR \n " )); - for (i=0;iTxRing[QID_AC_BE].Cell[i].AllocVa; - DBGPRINT_RAW(RT_DEBUG_TRACE, ("[%02d] %08lx: %08lx: %08lx: %08lx\n " , i, *ptemp,*(ptemp+1),*(ptemp+2),*(ptemp+3))); - } - DBGPRINT_RAW(RT_DEBUG_TRACE, (" \n " )); - break; - case QID_AC_BK: - RTMP_IO_READ32(pAd, TX_BASE_PTR1, &Ac0Base); - RTMP_IO_READ32(pAd, TX_CTX_IDX1, &Ac0SwIdx); - RTMP_IO_READ32(pAd, TX_DTX_IDX1, &Ac0HwIdx); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("All QID_AC_BK DESCRIPTOR \n " )); - for (i=0;iTxRing[QID_AC_BK].Cell[i].AllocVa; - DBGPRINT_RAW(RT_DEBUG_TRACE, ("[%02d] %08lx: %08lx: %08lx: %08lx\n " , i, *ptemp,*(ptemp+1),*(ptemp+2),*(ptemp+3))); - } - DBGPRINT_RAW(RT_DEBUG_TRACE, (" \n " )); - break; - case QID_AC_VI: - RTMP_IO_READ32(pAd, TX_BASE_PTR2, &Ac0Base); - RTMP_IO_READ32(pAd, TX_CTX_IDX2, &Ac0SwIdx); - RTMP_IO_READ32(pAd, TX_DTX_IDX2, &Ac0HwIdx); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("All QID_AC_VI DESCRIPTOR \n " )); - for (i=0;iTxRing[QID_AC_VI].Cell[i].AllocVa; - DBGPRINT_RAW(RT_DEBUG_TRACE, ("[%02d] %08lx: %08lx: %08lx: %08lx\n " , i, *ptemp,*(ptemp+1),*(ptemp+2),*(ptemp+3))); - } - DBGPRINT_RAW(RT_DEBUG_TRACE, (" \n " )); - break; - case QID_AC_VO: - RTMP_IO_READ32(pAd, TX_BASE_PTR3, &Ac0Base); - RTMP_IO_READ32(pAd, TX_CTX_IDX3, &Ac0SwIdx); - RTMP_IO_READ32(pAd, TX_DTX_IDX3, &Ac0HwIdx); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("All QID_AC_VO DESCRIPTOR \n " )); - for (i=0;iTxRing[QID_AC_VO].Cell[i].AllocVa; - DBGPRINT_RAW(RT_DEBUG_TRACE, ("[%02d] %08lx: %08lx: %08lx: %08lx\n " , i, *ptemp,*(ptemp+1),*(ptemp+2),*(ptemp+3))); - } - DBGPRINT_RAW(RT_DEBUG_TRACE, (" \n " )); - break; - case QID_MGMT: - RTMP_IO_READ32(pAd, TX_BASE_PTR5, &Ac0Base); - RTMP_IO_READ32(pAd, TX_CTX_IDX5, &Ac0SwIdx); - RTMP_IO_READ32(pAd, TX_DTX_IDX5, &Ac0HwIdx); - DBGPRINT_RAW(RT_DEBUG_TRACE, (" All QID_MGMT DESCRIPTOR \n " )); - for (i=0;iMgmtRing.Cell[i].AllocVa; - DBGPRINT_RAW(RT_DEBUG_TRACE, ("[%02d] %08lx: %08lx: %08lx: %08lx\n " , i, *ptemp,*(ptemp+1),*(ptemp+2),*(ptemp+3))); - } - DBGPRINT_RAW(RT_DEBUG_TRACE, (" \n " )); - break; - - default: - DBGPRINT_ERR(("DBGPRINT_TX_RING(Ring %d) not supported\n", QueIdx)); - break; - } - AC0freeIdx = pAd->TxRing[QueIdx].TxSwFreeIdx; - - DBGPRINT(RT_DEBUG_TRACE,("TxRing%d, TX_DTX_IDX=%d, TX_CTX_IDX=%d\n", QueIdx, Ac0HwIdx, Ac0SwIdx)); - DBGPRINT_RAW(RT_DEBUG_TRACE,(" TxSwFreeIdx[%d]", AC0freeIdx)); - DBGPRINT_RAW(RT_DEBUG_TRACE,(" pending-NDIS=%ld\n", pAd->RalinkCounters.PendingNdisPacketCount)); - - -} - - -VOID DBGPRINT_RX_RING( - IN PRTMP_ADAPTER pAd) -{ - UINT32 Ac0Base; - UINT32 Ac0HwIdx = 0, Ac0SwIdx = 0, AC0freeIdx; -// PULONG pTxD; - int i; - UINT32 *ptemp; -// PRXD_STRUC pRxD; - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("=====================================================\n " )); - RTMP_IO_READ32(pAd, RX_BASE_PTR, &Ac0Base); - RTMP_IO_READ32(pAd, RX_CRX_IDX, &Ac0SwIdx); - RTMP_IO_READ32(pAd, RX_DRX_IDX, &Ac0HwIdx); - AC0freeIdx = pAd->RxRing.RxSwReadIdx; - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("All RX DSP \n " )); - for (i=0;iRxRing.Cell[i].AllocVa; - DBGPRINT_RAW(RT_DEBUG_TRACE, ("[%02d] %08x: %08x: %08x: %08x\n " , i, *ptemp,*(ptemp+1),*(ptemp+2),*(ptemp+3))); - } - DBGPRINT(RT_DEBUG_TRACE,("RxRing, RX_DRX_IDX=%d, RX_CRX_IDX=%d \n", Ac0HwIdx, Ac0SwIdx)); - DBGPRINT_RAW(RT_DEBUG_TRACE,(" RxSwReadIdx [%d]=", AC0freeIdx)); - DBGPRINT_RAW(RT_DEBUG_TRACE,(" pending-NDIS=%ld\n", pAd->RalinkCounters.PendingNdisPacketCount)); -} - - -PNDIS_PACKET GetPacketFromRxRing( - IN PRTMP_ADAPTER pAd, - OUT PRT28XX_RXD_STRUC pSaveRxD, - OUT BOOLEAN *pbReschedule, - IN OUT UINT32 *pRxPending) -{ - PRXD_STRUC pRxD; -#ifdef RT_BIG_ENDIAN - PRXD_STRUC pDestRxD; - RXD_STRUC RxD; -#endif - PNDIS_PACKET pRxPacket = NULL; - PNDIS_PACKET pNewPacket; - PVOID AllocVa; - NDIS_PHYSICAL_ADDRESS AllocPa; - BOOLEAN bReschedule = FALSE; - - RTMP_SEM_LOCK(&pAd->RxRingLock); - - if (*pRxPending == 0) - { - // Get how may packets had been received - RTMP_IO_READ32(pAd, RX_DRX_IDX , &pAd->RxRing.RxDmaIdx); - - if (pAd->RxRing.RxSwReadIdx == pAd->RxRing.RxDmaIdx) - { - // no more rx packets - bReschedule = FALSE; - goto done; - } - - // get rx pending count - if (pAd->RxRing.RxDmaIdx > pAd->RxRing.RxSwReadIdx) - *pRxPending = pAd->RxRing.RxDmaIdx - pAd->RxRing.RxSwReadIdx; - else - *pRxPending = pAd->RxRing.RxDmaIdx + RX_RING_SIZE - pAd->RxRing.RxSwReadIdx; - - } - -#ifdef RT_BIG_ENDIAN - pDestRxD = (PRXD_STRUC) pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx].AllocVa; - RxD = *pDestRxD; - pRxD = &RxD; - RTMPDescriptorEndianChange((PUCHAR)pRxD, TYPE_RXD); -#else - // Point to Rx indexed rx ring descriptor - pRxD = (PRXD_STRUC) pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx].AllocVa; -#endif - - if (pRxD->DDONE == 0) - { - *pRxPending = 0; - // DMAIndx had done but DDONE bit not ready - bReschedule = TRUE; - goto done; - } - - - // return rx descriptor - NdisMoveMemory(pSaveRxD, pRxD, RXD_SIZE); - - pNewPacket = RTMP_AllocateRxPacketBuffer(pAd, RX_BUFFER_AGGRESIZE, FALSE, &AllocVa, &AllocPa); - - if (pNewPacket) - { - // unmap the rx buffer - PCI_UNMAP_SINGLE(pAd, pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx].DmaBuf.AllocPa, - pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx].DmaBuf.AllocSize, PCI_DMA_FROMDEVICE); - pRxPacket = pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx].pNdisPacket; - - pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx].DmaBuf.AllocSize = RX_BUFFER_AGGRESIZE; - pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx].pNdisPacket = (PNDIS_PACKET) pNewPacket; - pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx].DmaBuf.AllocVa = AllocVa; - pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx].DmaBuf.AllocPa = AllocPa; - /* update SDP0 to new buffer of rx packet */ - pRxD->SDP0 = AllocPa; - } - else - { - //DBGPRINT(RT_DEBUG_TRACE,("No Rx Buffer\n")); - pRxPacket = NULL; - bReschedule = TRUE; - } - - pRxD->DDONE = 0; - - // had handled one rx packet - *pRxPending = *pRxPending - 1; - - // update rx descriptor and kick rx -#ifdef RT_BIG_ENDIAN - RTMPDescriptorEndianChange((PUCHAR)pRxD, TYPE_RXD); - WriteBackToDescriptor((PUCHAR)pDestRxD, (PUCHAR)pRxD, FALSE, TYPE_RXD); -#endif - INC_RING_INDEX(pAd->RxRing.RxSwReadIdx, RX_RING_SIZE); - - pAd->RxRing.RxCpuIdx = (pAd->RxRing.RxSwReadIdx == 0) ? (RX_RING_SIZE-1) : (pAd->RxRing.RxSwReadIdx-1); - RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RxCpuIdx); - -done: - RTMP_SEM_UNLOCK(&pAd->RxRingLock); - *pbReschedule = bReschedule; - return pRxPacket; -} - - -NDIS_STATUS MlmeHardTransmitTxRing( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket) -{ - PACKET_INFO PacketInfo; - PUCHAR pSrcBufVA; - UINT SrcBufLen; - PTXD_STRUC pTxD; -#ifdef RT_BIG_ENDIAN - PTXD_STRUC pDestTxD; - TXD_STRUC TxD; -#endif - PHEADER_802_11 pHeader_802_11; - BOOLEAN bAckRequired, bInsertTimestamp; - ULONG SrcBufPA; - //UCHAR TxBufIdx; - UCHAR MlmeRate; - ULONG SwIdx = pAd->TxRing[QueIdx].TxCpuIdx; - PTXWI_STRUC pFirstTxWI; - //ULONG i; - //HTTRANSMIT_SETTING MlmeTransmit; //Rate for this MGMT frame. - ULONG FreeNum; - MAC_TABLE_ENTRY *pMacEntry = NULL; - - - RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); - - - if (pSrcBufVA == NULL) - { - // The buffer shouldn't be NULL - return NDIS_STATUS_FAILURE; - } - - // Make sure MGMT ring resource won't be used by other threads - //NdisAcquireSpinLock(&pAd->TxRingLock); - - FreeNum = GET_TXRING_FREENO(pAd, QueIdx); - - if (FreeNum == 0) - { - //NdisReleaseSpinLock(&pAd->TxRingLock); - return NDIS_STATUS_FAILURE; - } - - SwIdx = pAd->TxRing[QueIdx].TxCpuIdx; - -#ifndef RT_BIG_ENDIAN - pTxD = (PTXD_STRUC) pAd->TxRing[QueIdx].Cell[SwIdx].AllocVa; -#else - pDestTxD = (PTXD_STRUC)pAd->TxRing[QueIdx].Cell[SwIdx].AllocVa; - TxD = *pDestTxD; - pTxD = &TxD; - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); -#endif - - if (pAd->TxRing[QueIdx].Cell[SwIdx].pNdisPacket) - { - DBGPRINT(RT_DEBUG_OFF, ("MlmeHardTransmit Error\n")); - //NdisReleaseSpinLock(&pAd->TxRingLock); - return NDIS_STATUS_FAILURE; - } - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // outgoing frame always wakeup PHY to prevent frame lost - // if (pAd->StaCfg.Psm == PWR_SAVE) - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - AsicForceWakeup(pAd, TRUE); - } -#endif // CONFIG_STA_SUPPORT // - pFirstTxWI =(PTXWI_STRUC)pSrcBufVA; - - pHeader_802_11 = (PHEADER_802_11) (pSrcBufVA + TXWI_SIZE); - if (pHeader_802_11->Addr1[0] & 0x01) - { - MlmeRate = pAd->CommonCfg.BasicMlmeRate; - } - else - { - MlmeRate = pAd->CommonCfg.MlmeRate; - } - - if ((pHeader_802_11->FC.Type == BTYPE_DATA) && - (pHeader_802_11->FC.SubType == SUBTYPE_QOS_NULL)) - { - pMacEntry = MacTableLookup(pAd, pHeader_802_11->Addr1); - } - - // Verify Mlme rate for a / g bands. - if ((pAd->LatchRfRegs.Channel > 14) && (MlmeRate < RATE_6)) // 11A band - MlmeRate = RATE_6; - - // - // Should not be hard code to set PwrMgmt to 0 (PWR_ACTIVE) - // Snice it's been set to 0 while on MgtMacHeaderInit - // By the way this will cause frame to be send on PWR_SAVE failed. - // - // - // In WMM-UAPSD, mlme frame should be set psm as power saving but probe request frame -#ifdef CONFIG_STA_SUPPORT - // Data-Null packets alse pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD - if (pHeader_802_11->FC.Type != BTYPE_DATA) - { - if ((pHeader_802_11->FC.SubType == SUBTYPE_PROBE_REQ) || !(pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable)) - { - pHeader_802_11->FC.PwrMgmt = PWR_ACTIVE; - } - else - { - pHeader_802_11->FC.PwrMgmt = pAd->CommonCfg.bAPSDForcePowerSave; - } - } -#endif // CONFIG_STA_SUPPORT // - - bInsertTimestamp = FALSE; - if (pHeader_802_11->FC.Type == BTYPE_CNTL) // must be PS-POLL - { - bAckRequired = FALSE; - } - else // BTYPE_MGMT or BTYPE_DATA(must be NULL frame) - { - if (pHeader_802_11->Addr1[0] & 0x01) // MULTICAST, BROADCAST - { - bAckRequired = FALSE; - pHeader_802_11->Duration = 0; - } - else - { - bAckRequired = TRUE; - pHeader_802_11->Duration = RTMPCalcDuration(pAd, MlmeRate, 14); - if (pHeader_802_11->FC.SubType == SUBTYPE_PROBE_RSP) - { - bInsertTimestamp = TRUE; - } - } - } - pHeader_802_11->Sequence = pAd->Sequence++; - if (pAd->Sequence > 0xfff) - pAd->Sequence = 0; - // Before radar detection done, mgmt frame can not be sent but probe req - // Because we need to use probe req to trigger driver to send probe req in passive scan - if ((pHeader_802_11->FC.SubType != SUBTYPE_PROBE_REQ) - && (pAd->CommonCfg.bIEEE80211H == 1) - && (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE)) - { - DBGPRINT(RT_DEBUG_ERROR,("MlmeHardTransmit --> radar detect not in normal mode !!!\n")); - //NdisReleaseSpinLock(&pAd->TxRingLock); - return (NDIS_STATUS_FAILURE); - } - -#ifdef RT_BIG_ENDIAN - RTMPFrameEndianChange(pAd, (PUCHAR)pHeader_802_11, DIR_WRITE, FALSE); -#endif - // - // fill scatter-and-gather buffer list into TXD. Internally created NDIS PACKET - // should always has only one ohysical buffer, and the whole frame size equals - // to the first scatter buffer size - // - - // Initialize TX Descriptor - // For inter-frame gap, the number is for this frame and next frame - // For MLME rate, we will fix as 2Mb to match other vendor's implement -// pAd->CommonCfg.MlmeTransmit.field.MODE = 1; - -// management frame doesn't need encryption. so use RESERVED_WCID no matter u are sending to specific wcid or not. - // Only beacon use Nseq=TRUE. So here we use Nseq=FALSE. - if (pMacEntry == NULL) - { - RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, bInsertTimestamp, FALSE, bAckRequired, FALSE, - 0, RESERVED_WCID, (SrcBufLen - TXWI_SIZE), PID_MGMT, 0, (UCHAR)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); - } - else - { - RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, - bInsertTimestamp, FALSE, bAckRequired, FALSE, - 0, pMacEntry->Aid, (SrcBufLen - TXWI_SIZE), - pMacEntry->MaxHTPhyMode.field.MCS, 0, - (UCHAR)pMacEntry->MaxHTPhyMode.field.MCS, - IFS_BACKOFF, FALSE, &pMacEntry->MaxHTPhyMode); - } - - pAd->TxRing[QueIdx].Cell[SwIdx].pNdisPacket = pPacket; - pAd->TxRing[QueIdx].Cell[SwIdx].pNextNdisPacket = NULL; -// pFirstTxWI->MPDUtotalByteCount = SrcBufLen - TXWI_SIZE; -#ifdef RT_BIG_ENDIAN - RTMPWIEndianChange((PUCHAR)pFirstTxWI, TYPE_TXWI); -#endif - SrcBufPA = PCI_MAP_SINGLE(pAd, pSrcBufVA, SrcBufLen, 0, PCI_DMA_TODEVICE); - - - RTMPWriteTxDescriptor(pAd, pTxD, TRUE, FIFO_EDCA); - pTxD->LastSec0 = 1; - pTxD->LastSec1 = 1; - pTxD->SDLen0 = SrcBufLen; - pTxD->SDLen1 = 0; - pTxD->SDPtr0 = SrcBufPA; - pTxD->DMADONE = 0; - -#ifdef RT_BIG_ENDIAN - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); - WriteBackToDescriptor((PUCHAR)pDestTxD, (PUCHAR)pTxD, FALSE, TYPE_TXD); -#endif - - pAd->RalinkCounters.KickTxCount++; - pAd->RalinkCounters.OneSecTxDoneCount++; - - // Increase TX_CTX_IDX, but write to register later. - INC_RING_INDEX(pAd->TxRing[QueIdx].TxCpuIdx, TX_RING_SIZE); - - RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + QueIdx*0x10, pAd->TxRing[QueIdx].TxCpuIdx); - - // Make sure to release MGMT ring resource -// NdisReleaseSpinLock(&pAd->TxRingLock); - - return NDIS_STATUS_SUCCESS; -} - - -NDIS_STATUS MlmeDataHardTransmit( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket) -{ - if ((pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) - ) - { - return NDIS_STATUS_FAILURE; - } - - return MlmeHardTransmitTxRing(pAd,QueIdx,pPacket); -} - - -/* - ======================================================================== - - Routine Description: - Calculates the duration which is required to transmit out frames - with given size and specified rate. - - Arguments: - pTxD Pointer to transmit descriptor - Ack Setting for Ack requirement bit - Fragment Setting for Fragment bit - RetryMode Setting for retry mode - Ifs Setting for IFS gap - Rate Setting for transmit rate - Service Setting for service - Length Frame length - TxPreamble Short or Long preamble when using CCK rates - QueIdx - 0-3, according to 802.11e/d4.4 June/2003 - - Return Value: - None - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - ======================================================================== -*/ -VOID RTMPWriteTxDescriptor( - IN PRTMP_ADAPTER pAd, - IN PTXD_STRUC pTxD, - IN BOOLEAN bWIV, - IN UCHAR QueueSEL) -{ - // - // Always use Long preamble before verifiation short preamble functionality works well. - // Todo: remove the following line if short preamble functionality works - // - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); - - pTxD->WIV = (bWIV) ? 1: 0; - pTxD->QSEL= (QueueSEL); - //RT2860c?? fixed using EDCA queue for test... We doubt Queue1 has problem. 2006-09-26 Jan - //pTxD->QSEL= FIFO_EDCA; - /* - if (pAd->bGenOneHCCA == TRUE) - pTxD->QSEL= FIFO_HCCA; - */ - pTxD->DMADONE = 0; -} diff --git a/drivers/staging/rt3090/common/cmm_info.c b/drivers/staging/rt3090/common/cmm_info.c deleted file mode 100644 index 3e51e98b474c..000000000000 --- a/drivers/staging/rt3090/common/cmm_info.c +++ /dev/null @@ -1,3718 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - cmm_info.c - - Abstract: - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- - */ - -#include -#include "../rt_config.h" - - -INT Show_SSID_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_WirelessMode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_TxBurst_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_TxPreamble_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_TxPower_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_Channel_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_BGProtection_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_RTSThreshold_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_FragThreshold_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -#ifdef DOT11_N_SUPPORT -INT Show_HtBw_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtMcs_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtGi_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtOpMode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtExtcha_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtMpduDensity_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtBaWinSize_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtRdg_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtAmsdu_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtAutoBa_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); -#endif // DOT11_N_SUPPORT // - -INT Show_CountryRegion_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_CountryRegionABand_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_CountryCode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -#ifdef AGGREGATION_SUPPORT -INT Show_PktAggregate_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); -#endif // AGGREGATION_SUPPORT // - -#ifdef WMM_SUPPORT -INT Show_WmmCapable_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); -#endif // WMM_SUPPORT // - -INT Show_IEEE80211H_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -#ifdef CONFIG_STA_SUPPORT -INT Show_NetworkType_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -#endif // CONFIG_STA_SUPPORT // - -INT Show_AuthMode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_EncrypType_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_DefaultKeyID_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_Key1_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_Key2_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_Key3_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_Key4_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_WPAPSK_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -static struct { - PSTRING name; - INT (*show_proc)(PRTMP_ADAPTER pAdapter, PSTRING arg); -} *PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC, RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC[] = { - {"SSID", Show_SSID_Proc}, - {"WirelessMode", Show_WirelessMode_Proc}, - {"TxBurst", Show_TxBurst_Proc}, - {"TxPreamble", Show_TxPreamble_Proc}, - {"TxPower", Show_TxPower_Proc}, - {"Channel", Show_Channel_Proc}, - {"BGProtection", Show_BGProtection_Proc}, - {"RTSThreshold", Show_RTSThreshold_Proc}, - {"FragThreshold", Show_FragThreshold_Proc}, -#ifdef DOT11_N_SUPPORT - {"HtBw", Show_HtBw_Proc}, - {"HtMcs", Show_HtMcs_Proc}, - {"HtGi", Show_HtGi_Proc}, - {"HtOpMode", Show_HtOpMode_Proc}, - {"HtExtcha", Show_HtExtcha_Proc}, - {"HtMpduDensity", Show_HtMpduDensity_Proc}, - {"HtBaWinSize", Show_HtBaWinSize_Proc}, - {"HtRdg", Show_HtRdg_Proc}, - {"HtAmsdu", Show_HtAmsdu_Proc}, - {"HtAutoBa", Show_HtAutoBa_Proc}, -#endif // DOT11_N_SUPPORT // - {"CountryRegion", Show_CountryRegion_Proc}, - {"CountryRegionABand", Show_CountryRegionABand_Proc}, - {"CountryCode", Show_CountryCode_Proc}, -#ifdef AGGREGATION_SUPPORT - {"PktAggregate", Show_PktAggregate_Proc}, -#endif - -#ifdef WMM_SUPPORT - {"WmmCapable", Show_WmmCapable_Proc}, -#endif - {"IEEE80211H", Show_IEEE80211H_Proc}, -#ifdef CONFIG_STA_SUPPORT - {"NetworkType", Show_NetworkType_Proc}, -#endif // CONFIG_STA_SUPPORT // - {"AuthMode", Show_AuthMode_Proc}, - {"EncrypType", Show_EncrypType_Proc}, - {"DefaultKeyID", Show_DefaultKeyID_Proc}, - {"Key1", Show_Key1_Proc}, - {"Key2", Show_Key2_Proc}, - {"Key3", Show_Key3_Proc}, - {"Key4", Show_Key4_Proc}, - {"WPAPSK", Show_WPAPSK_Proc}, - {NULL, NULL} -}; - -/* - ========================================================================== - Description: - Get Driver version. - - Return: - ========================================================================== -*/ -INT Set_DriverVersion_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - DBGPRINT(RT_DEBUG_TRACE, ("Driver version-%s\n", STA_DRIVER_VERSION)); -#endif // CONFIG_STA_SUPPORT // - - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Country Region. - This command will not work, if the field of CountryRegion in eeprom is programmed. - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_CountryRegion_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - int retval; - -#ifdef EXT_BUILD_CHANNEL_LIST - return -EOPNOTSUPP; -#endif // EXT_BUILD_CHANNEL_LIST // - - retval = RT_CfgSetCountryRegion(pAd, arg, BAND_24G); - if (retval == FALSE) - return FALSE; - - // if set country region, driver needs to be reset - BuildChannelList(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegion_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegion)); - - return TRUE; -} - - -/* - ========================================================================== - Description: - Set Country Region for A band. - This command will not work, if the field of CountryRegion in eeprom is programmed. - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_CountryRegionABand_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - int retval; - -#ifdef EXT_BUILD_CHANNEL_LIST - return -EOPNOTSUPP; -#endif // EXT_BUILD_CHANNEL_LIST // - - retval = RT_CfgSetCountryRegion(pAd, arg, BAND_5G); - if (retval == FALSE) - return FALSE; - - // if set country region, driver needs to be reset - BuildChannelList(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegionABand_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegionForABand)); - - return TRUE; -} - - -/* - ========================================================================== - Description: - Set Wireless Mode - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_WirelessMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - INT success = TRUE; - - success = RT_CfgSetWirelessMode(pAd, arg); - if (success) - { - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - LONG WirelessMode = pAd->CommonCfg.PhyMode; - - RTMPSetPhyMode(pAd, WirelessMode); -#ifdef DOT11_N_SUPPORT - if (WirelessMode >= PHY_11ABGN_MIXED) - { - pAd->CommonCfg.BACapability.field.AutoBA = TRUE; - pAd->CommonCfg.REGBACapability.field.AutoBA = TRUE; - } - else - { - pAd->CommonCfg.BACapability.field.AutoBA = FALSE; - pAd->CommonCfg.REGBACapability.field.AutoBA = FALSE; - } -#endif // DOT11_N_SUPPORT // - // Set AdhocMode rates - if (pAd->StaCfg.BssType == BSS_ADHOC) - { - MlmeUpdateTxRates(pAd, FALSE, 0); - MakeIbssBeacon(pAd); // re-build BEACON frame - AsicEnableIbssSync(pAd); // copy to on-chip memory - } - } -#endif // CONFIG_STA_SUPPORT // - - // it is needed to set SSID to take effect -#ifdef DOT11_N_SUPPORT - SetCommonHT(pAd); -#endif // DOT11_N_SUPPORT // - DBGPRINT(RT_DEBUG_TRACE, ("Set_WirelessMode_Proc::(=%d)\n", pAd->CommonCfg.PhyMode)); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("Set_WirelessMode_Proc::parameters out of range\n")); - } - - return success; -} - -/* - ========================================================================== - Description: - Set Channel - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Channel_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - INT success = TRUE; - UCHAR Channel; - - Channel = (UCHAR) simple_strtol(arg, 0, 10); - - // check if this channel is valid - if (ChannelSanity(pAd, Channel) == TRUE) - { -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - pAd->CommonCfg.Channel = Channel; - - if (MONITOR_ON(pAd)) - { -#ifdef DOT11_N_SUPPORT - N_ChannelCheck(pAd); - if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED && - pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40) - { - N_SetCenCh(pAd); - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - DBGPRINT(RT_DEBUG_TRACE, ("BW_40, control_channel(%d), CentralChannel(%d) \n", - pAd->CommonCfg.Channel, pAd->CommonCfg.CentralChannel)); - } - else -#endif // DOT11_N_SUPPORT // - { - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - DBGPRINT(RT_DEBUG_TRACE, ("BW_20, Channel(%d)\n", pAd->CommonCfg.Channel)); - } - } - } -#endif // CONFIG_STA_SUPPORT // - success = TRUE; - } - else - { - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - success = FALSE; -#endif // CONFIG_STA_SUPPORT // - } - - - if (success == TRUE) - DBGPRINT(RT_DEBUG_TRACE, ("Set_Channel_Proc::(Channel=%d)\n", pAd->CommonCfg.Channel)); - - return success; -} - - -/* - ========================================================================== - Description: - Set Short Slot Time Enable or Disable - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_ShortSlot_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - int retval; - - retval = RT_CfgSetShortSlot(pAd, arg); - if (retval == TRUE) - DBGPRINT(RT_DEBUG_TRACE, ("Set_ShortSlot_Proc::(ShortSlot=%d)\n", pAd->CommonCfg.bUseShortSlotTime)); - - return retval; -} - - -/* - ========================================================================== - Description: - Set Tx power - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_TxPower_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - LONG TxPower; - INT success = FALSE; - - TxPower = simple_strtol(arg, 0, 10); - if (TxPower <= 100) - { - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - pAd->CommonCfg.TxPowerDefault = TxPower; - pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault; - } -#endif // CONFIG_STA_SUPPORT // - success = TRUE; - } - else - success = FALSE; - - DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPower_Proc::(TxPowerPercentage=%ld)\n", pAd->CommonCfg.TxPowerPercentage)); - - return success; -} - -/* - ========================================================================== - Description: - Set 11B/11G Protection - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_BGProtection_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - switch (simple_strtol(arg, 0, 10)) - { - case 0: //AUTO - pAd->CommonCfg.UseBGProtection = 0; - break; - case 1: //Always On - pAd->CommonCfg.UseBGProtection = 1; - break; - case 2: //Always OFF - pAd->CommonCfg.UseBGProtection = 2; - break; - default: //Invalid argument - return FALSE; - } - - - DBGPRINT(RT_DEBUG_TRACE, ("Set_BGProtection_Proc::(BGProtection=%ld)\n", pAd->CommonCfg.UseBGProtection)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set TxPreamble - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_TxPreamble_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - RT_802_11_PREAMBLE Preamble; - - Preamble = simple_strtol(arg, 0, 10); - - - switch (Preamble) - { - case Rt802_11PreambleShort: - pAd->CommonCfg.TxPreamble = Preamble; -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - MlmeSetTxPreamble(pAd, Rt802_11PreambleShort); -#endif // CONFIG_STA_SUPPORT // - break; - case Rt802_11PreambleLong: -#ifdef CONFIG_STA_SUPPORT - case Rt802_11PreambleAuto: - // if user wants AUTO, initialize to LONG here, then change according to AP's - // capability upon association. -#endif // CONFIG_STA_SUPPORT // - pAd->CommonCfg.TxPreamble = Preamble; -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - MlmeSetTxPreamble(pAd, Rt802_11PreambleLong); -#endif // CONFIG_STA_SUPPORT // - break; - default: //Invalid argument - return FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPreamble_Proc::(TxPreamble=%ld)\n", pAd->CommonCfg.TxPreamble)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set RTS Threshold - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_RTSThreshold_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - NDIS_802_11_RTS_THRESHOLD RtsThresh; - - RtsThresh = simple_strtol(arg, 0, 10); - - if((RtsThresh > 0) && (RtsThresh <= MAX_RTS_THRESHOLD)) - pAd->CommonCfg.RtsThreshold = (USHORT)RtsThresh; -#ifdef CONFIG_STA_SUPPORT - else if (RtsThresh == 0) - pAd->CommonCfg.RtsThreshold = MAX_RTS_THRESHOLD; -#endif // CONFIG_STA_SUPPORT // - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_RTSThreshold_Proc::(RTSThreshold=%d)\n", pAd->CommonCfg.RtsThreshold)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Fragment Threshold - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_FragThreshold_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh; - - FragThresh = simple_strtol(arg, 0, 10); - - if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD) - { - //Illegal FragThresh so we set it to default - pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD; - } - else if (FragThresh % 2 == 1) - { - // The length of each fragment shall always be an even number of octets, except for the last fragment - // of an MSDU or MMPDU, which may be either an even or an odd number of octets. - pAd->CommonCfg.FragmentThreshold = (USHORT)(FragThresh - 1); - } - else - { - pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh; - } - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (pAd->CommonCfg.FragmentThreshold == MAX_FRAG_THRESHOLD) - pAd->CommonCfg.bUseZeroToDisableFragment = TRUE; - else - pAd->CommonCfg.bUseZeroToDisableFragment = FALSE; - } -#endif // CONFIG_STA_SUPPORT // - - DBGPRINT(RT_DEBUG_TRACE, ("Set_FragThreshold_Proc::(FragThreshold=%d)\n", pAd->CommonCfg.FragmentThreshold)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set TxBurst - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_TxBurst_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - LONG TxBurst; - - TxBurst = simple_strtol(arg, 0, 10); - if (TxBurst == 1) - pAd->CommonCfg.bEnableTxBurst = TRUE; - else if (TxBurst == 0) - pAd->CommonCfg.bEnableTxBurst = FALSE; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_TxBurst_Proc::(TxBurst=%d)\n", pAd->CommonCfg.bEnableTxBurst)); - - return TRUE; -} - -#ifdef AGGREGATION_SUPPORT -/* - ========================================================================== - Description: - Set TxBurst - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_PktAggregate_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - LONG aggre; - - aggre = simple_strtol(arg, 0, 10); - - if (aggre == 1) - pAd->CommonCfg.bAggregationCapable = TRUE; - else if (aggre == 0) - pAd->CommonCfg.bAggregationCapable = FALSE; - else - return FALSE; //Invalid argument - - - DBGPRINT(RT_DEBUG_TRACE, ("Set_PktAggregate_Proc::(AGGRE=%d)\n", pAd->CommonCfg.bAggregationCapable)); - - return TRUE; -} -#endif - - -#ifdef INF_AMAZON_PPA -INT Set_INF_AMAZON_SE_PPA_Proc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) -{ - ULONG aggre; - UINT status; - - aggre = simple_strtol(arg, 0, 10); - - if (aggre == 1) - { - if(pAd->PPAEnable==TRUE) - { - printk("INF_AMAZON_SE_PPA already enabled \n"); - } - else - { - if (ppa_hook_directpath_register_dev_fn) - { - UINT32 g_if_id; - - if (pAd->pDirectpathCb == NULL) - { - pAd->pDirectpathCb = (PPA_DIRECTPATH_CB *) kmalloc (sizeof(PPA_DIRECTPATH_CB), GFP_ATOMIC); - printk("Realloc memory for pDirectpathCb ??\n"); - } - - /* register callback */ - pAd->pDirectpathCb->rx_fn = NULL; - pAd->pDirectpathCb->stop_tx_fn = NULL; - pAd->pDirectpathCb->start_tx_fn = NULL; - - status = ppa_hook_directpath_register_dev_fn(&g_if_id, pAd->net_dev, pAd->pDirectpathCb, PPA_F_DIRECTPATH_ETH_IF); - - if(status==1) - { - pAd->g_if_id=g_if_id; - printk("register INF_AMAZON_SE_PPA success :ret:%d id:%d:%d\n",status,pAd->g_if_id,g_if_id); - pAd->PPAEnable=TRUE; - } - else - { - printk("register INF_AMAZON_SE_PPA fail :ret:%d\n",status); - } - - } - else - { - printk("INF_AMAZON_SE_PPA enable fail : there is no INF_AMAZON_SE_PPA module . \n"); - } - } - - - } - else if (aggre == 0) - { - if(pAd->PPAEnable==FALSE) - { - -printk("INF_AMAZON_SE_PPA already disable \n"); - } - else - { - if (ppa_hook_directpath_register_dev_fn) - { - UINT32 g_if_id; - g_if_id=pAd->g_if_id; - printk("g_if_id=%d \n",pAd->g_if_id); - status=ppa_hook_directpath_register_dev_fn(&g_if_id, pAd->net_dev, NULL, PPA_F_DIRECTPATH_DEREGISTER); - - if(status==1) - { - pAd->g_if_id=0; - printk("unregister INF_AMAZON_SE_PPA success :ret:%d\n",status); - pAd->PPAEnable=FALSE; - } - else - { - printk("unregister INF_AMAZON_SE_PPA fail :ret:%d\n",status); - } - - } - else - { - printk("INF_AMAZON_SE_PPA enable fail : there is no INF_AMAZON_SE_PPA module . \n"); - } - } - - } - else - { - printk("Invalid argument %d \n",aggre); - return FALSE; //Invalid argument - } - - return TRUE; - -} -#endif // INF_AMAZON_PPA // - - -/* - ========================================================================== - Description: - Set IEEE80211H. - This parameter is 1 when needs radar detection, otherwise 0 - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_IEEE80211H_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - LONG ieee80211h; - - ieee80211h = simple_strtol(arg, 0, 10); - - if (ieee80211h == 1) - pAd->CommonCfg.bIEEE80211H = TRUE; - else if (ieee80211h == 0) - pAd->CommonCfg.bIEEE80211H = FALSE; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_IEEE80211H_Proc::(IEEE80211H=%d)\n", pAd->CommonCfg.bIEEE80211H)); - - return TRUE; -} - - -#ifdef DBG -/* - ========================================================================== - Description: - For Debug information - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Debug_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - DBGPRINT(RT_DEBUG_TRACE, ("==> Set_Debug_Proc *******************\n")); - - if(simple_strtol(arg, 0, 10) <= RT_DEBUG_LOUD) - RTDebugLevel = simple_strtol(arg, 0, 10); - - DBGPRINT(RT_DEBUG_TRACE, ("<== Set_Debug_Proc(RTDebugLevel = %ld)\n", RTDebugLevel)); - - return TRUE; -} -#endif - -INT Show_DescInfo_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ -#ifdef RTMP_MAC_PCI - INT i, QueIdx=0; -// ULONG RegValue; - PRT28XX_RXD_STRUC pRxD; - PTXD_STRUC pTxD; - PRTMP_TX_RING pTxRing = &pAd->TxRing[QueIdx]; - PRTMP_MGMT_RING pMgmtRing = &pAd->MgmtRing; - PRTMP_RX_RING pRxRing = &pAd->RxRing; - - for(i=0;iCell[i].AllocVa; - DBGPRINT(RT_DEBUG_OFF, ("Desc #%d\n",i)); - hex_dump("Tx Descriptor", (PUCHAR)pTxD, 16); - DBGPRINT(RT_DEBUG_OFF, ("pTxD->DMADONE = %x\n", pTxD->DMADONE)); - } - DBGPRINT(RT_DEBUG_OFF, ("---------------------------------------------------\n")); - for(i=0;iCell[i].AllocVa; - DBGPRINT(RT_DEBUG_OFF, ("Desc #%d\n",i)); - hex_dump("Mgmt Descriptor", (PUCHAR)pTxD, 16); - DBGPRINT(RT_DEBUG_OFF, ("pMgmt->DMADONE = %x\n", pTxD->DMADONE)); - } - DBGPRINT(RT_DEBUG_OFF, ("---------------------------------------------------\n")); - for(i=0;iCell[i].AllocVa; - DBGPRINT(RT_DEBUG_OFF, ("Desc #%d\n",i)); - hex_dump("Rx Descriptor", (PUCHAR)pRxD, 16); - DBGPRINT(RT_DEBUG_OFF, ("pRxD->DDONE = %x\n", pRxD->DDONE)); - } -#endif // RTMP_MAC_PCI // - - return TRUE; -} - -/* - ========================================================================== - Description: - Reset statistics counter - - Arguments: - pAdapter Pointer to our adapter - arg - - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_ResetStatCounter_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - //UCHAR i; - //MAC_TABLE_ENTRY *pEntry; - - DBGPRINT(RT_DEBUG_TRACE, ("==>Set_ResetStatCounter_Proc\n")); - - // add the most up-to-date h/w raw counters into software counters - NICUpdateRawCounters(pAd); - - NdisZeroMemory(&pAd->WlanCounters, sizeof(COUNTER_802_11)); - NdisZeroMemory(&pAd->Counters8023, sizeof(COUNTER_802_3)); - NdisZeroMemory(&pAd->RalinkCounters, sizeof(COUNTER_RALINK)); - - // Reset HotSpot counter - - - return TRUE; -} - -/* - ======================================================================== - - Routine Description: - Add WPA key process. - In Adhoc WPANONE, bPairwise = 0; KeyIdx = 0; - - Arguments: - pAd Pointer to our adapter - pBuf Pointer to the where the key stored - - Return Value: - NDIS_SUCCESS Add key successfully - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ - -BOOLEAN RTMPCheckStrPrintAble( - IN CHAR *pInPutStr, - IN UCHAR strLen) -{ - UCHAR i=0; - - for (i=0; i 0x7E)) - return FALSE; - } - - return TRUE; -} - -/* - ======================================================================== - - Routine Description: - Remove WPA Key process - - Arguments: - pAd Pointer to our adapter - pBuf Pointer to the where the key stored - - Return Value: - NDIS_SUCCESS Add key successfully - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -#ifdef CONFIG_STA_SUPPORT -VOID RTMPSetDesiredRates( - IN PRTMP_ADAPTER pAdapter, - IN LONG Rates) -{ - NDIS_802_11_RATES aryRates; - - memset(&aryRates, 0x00, sizeof(NDIS_802_11_RATES)); - switch (pAdapter->CommonCfg.PhyMode) - { - case PHY_11A: // A only - switch (Rates) - { - case 6000000: //6M - aryRates[0] = 0x0c; // 6M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0; - break; - case 9000000: //9M - aryRates[0] = 0x12; // 9M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1; - break; - case 12000000: //12M - aryRates[0] = 0x18; // 12M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2; - break; - case 18000000: //18M - aryRates[0] = 0x24; // 18M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3; - break; - case 24000000: //24M - aryRates[0] = 0x30; // 24M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4; - break; - case 36000000: //36M - aryRates[0] = 0x48; // 36M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5; - break; - case 48000000: //48M - aryRates[0] = 0x60; // 48M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6; - break; - case 54000000: //54M - aryRates[0] = 0x6c; // 54M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7; - break; - case -1: //Auto - default: - aryRates[0] = 0x6c; // 54Mbps - aryRates[1] = 0x60; // 48Mbps - aryRates[2] = 0x48; // 36Mbps - aryRates[3] = 0x30; // 24Mbps - aryRates[4] = 0x24; // 18M - aryRates[5] = 0x18; // 12M - aryRates[6] = 0x12; // 9M - aryRates[7] = 0x0c; // 6M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; - break; - } - break; - case PHY_11BG_MIXED: // B/G Mixed - case PHY_11B: // B only - case PHY_11ABG_MIXED: // A/B/G Mixed - default: - switch (Rates) - { - case 1000000: //1M - aryRates[0] = 0x02; - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0; - break; - case 2000000: //2M - aryRates[0] = 0x04; - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1; - break; - case 5000000: //5.5M - aryRates[0] = 0x0b; // 5.5M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2; - break; - case 11000000: //11M - aryRates[0] = 0x16; // 11M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3; - break; - case 6000000: //6M - aryRates[0] = 0x0c; // 6M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0; - break; - case 9000000: //9M - aryRates[0] = 0x12; // 9M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1; - break; - case 12000000: //12M - aryRates[0] = 0x18; // 12M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2; - break; - case 18000000: //18M - aryRates[0] = 0x24; // 18M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3; - break; - case 24000000: //24M - aryRates[0] = 0x30; // 24M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4; - break; - case 36000000: //36M - aryRates[0] = 0x48; // 36M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5; - break; - case 48000000: //48M - aryRates[0] = 0x60; // 48M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6; - break; - case 54000000: //54M - aryRates[0] = 0x6c; // 54M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7; - break; - case -1: //Auto - default: - if (pAdapter->CommonCfg.PhyMode == PHY_11B) - { //B Only - aryRates[0] = 0x16; // 11Mbps - aryRates[1] = 0x0b; // 5.5Mbps - aryRates[2] = 0x04; // 2Mbps - aryRates[3] = 0x02; // 1Mbps - } - else - { //(B/G) Mixed or (A/B/G) Mixed - aryRates[0] = 0x6c; // 54Mbps - aryRates[1] = 0x60; // 48Mbps - aryRates[2] = 0x48; // 36Mbps - aryRates[3] = 0x30; // 24Mbps - aryRates[4] = 0x16; // 11Mbps - aryRates[5] = 0x0b; // 5.5Mbps - aryRates[6] = 0x04; // 2Mbps - aryRates[7] = 0x02; // 1Mbps - } - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; - break; - } - break; - } - - NdisZeroMemory(pAdapter->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES); - NdisMoveMemory(pAdapter->CommonCfg.DesireRate, &aryRates, sizeof(NDIS_802_11_RATES)); - DBGPRINT(RT_DEBUG_TRACE, (" RTMPSetDesiredRates (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n", - pAdapter->CommonCfg.DesireRate[0],pAdapter->CommonCfg.DesireRate[1], - pAdapter->CommonCfg.DesireRate[2],pAdapter->CommonCfg.DesireRate[3], - pAdapter->CommonCfg.DesireRate[4],pAdapter->CommonCfg.DesireRate[5], - pAdapter->CommonCfg.DesireRate[6],pAdapter->CommonCfg.DesireRate[7] )); - // Changing DesiredRate may affect the MAX TX rate we used to TX frames out - MlmeUpdateTxRates(pAdapter, FALSE, 0); -} - -NDIS_STATUS RTMPWPARemoveKeyProc( - IN PRTMP_ADAPTER pAd, - IN PVOID pBuf) -{ - PNDIS_802_11_REMOVE_KEY pKey; - ULONG KeyIdx; - NDIS_STATUS Status = NDIS_STATUS_FAILURE; - BOOLEAN bTxKey; // Set the key as transmit key - BOOLEAN bPairwise; // Indicate the key is pairwise key - BOOLEAN bKeyRSC; // indicate the receive SC set by KeyRSC value. - // Otherwise, it will set by the NIC. - BOOLEAN bAuthenticator; // indicate key is set by authenticator. - INT i; - - DBGPRINT(RT_DEBUG_TRACE,("---> RTMPWPARemoveKeyProc\n")); - - pKey = (PNDIS_802_11_REMOVE_KEY) pBuf; - KeyIdx = pKey->KeyIndex & 0xff; - // Bit 31 of Add-key, Tx Key - bTxKey = (pKey->KeyIndex & 0x80000000) ? TRUE : FALSE; - // Bit 30 of Add-key PairwiseKey - bPairwise = (pKey->KeyIndex & 0x40000000) ? TRUE : FALSE; - // Bit 29 of Add-key KeyRSC - bKeyRSC = (pKey->KeyIndex & 0x20000000) ? TRUE : FALSE; - // Bit 28 of Add-key Authenticator - bAuthenticator = (pKey->KeyIndex & 0x10000000) ? TRUE : FALSE; - - // 1. If bTx is TRUE, return failure information - if (bTxKey == TRUE) - return(NDIS_STATUS_INVALID_DATA); - - // 2. Check Pairwise Key - if (bPairwise) - { - // a. If BSSID is broadcast, remove all pairwise keys. - // b. If not broadcast, remove the pairwise specified by BSSID - for (i = 0; i < SHARE_KEY_NUM; i++) - { - if (MAC_ADDR_EQUAL(pAd->SharedKey[BSS0][i].BssId, pKey->BSSID)) - { - DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%d)\n", i)); - pAd->SharedKey[BSS0][i].KeyLen = 0; - pAd->SharedKey[BSS0][i].CipherAlg = CIPHER_NONE; - AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)i); - Status = NDIS_STATUS_SUCCESS; - break; - } - } - } - // 3. Group Key - else - { - // a. If BSSID is broadcast, remove all group keys indexed - // b. If BSSID matched, delete the group key indexed. - DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%ld)\n", KeyIdx)); - pAd->SharedKey[BSS0][KeyIdx].KeyLen = 0; - pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE; - AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)KeyIdx); - Status = NDIS_STATUS_SUCCESS; - } - - return (Status); -} -#endif // CONFIG_STA_SUPPORT // - - -#ifdef CONFIG_STA_SUPPORT -/* - ======================================================================== - - Routine Description: - Remove All WPA Keys - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPWPARemoveAllKeys( - IN PRTMP_ADAPTER pAd) -{ - - UCHAR i; - - DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus)); - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); - // For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after - // Link up. And it will be replaced if user changed it. - if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA) - return; - - // For WPA-None, there is no need to remove it, since WinXP won't set it again after - // Link up. And it will be replaced if user changed it. - if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) - return; - - // set BSSID wcid entry of the Pair-wise Key table as no-security mode - AsicRemovePairwiseKeyEntry(pAd, BSS0, BSSID_WCID); - - // set all shared key mode as no-security. - for (i = 0; i < SHARE_KEY_NUM; i++) - { - DBGPRINT(RT_DEBUG_TRACE,("remove %s key #%d\n", CipherName[pAd->SharedKey[BSS0][i].CipherAlg], i)); - NdisZeroMemory(&pAd->SharedKey[BSS0][i], sizeof(CIPHER_KEY)); - - AsicRemoveSharedKeyEntry(pAd, BSS0, i); - } - RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); - -} -#endif // CONFIG_STA_SUPPORT // - - -/* - ======================================================================== - - Routine Description: - As STA's BSSID is a WC too, it uses shared key table. - This function write correct unicast TX key to ASIC WCID. - And we still make a copy in our MacTab.Content[BSSID_WCID].PairwiseKey. - Caller guarantee TKIP/AES always has keyidx = 0. (pairwise key) - Caller guarantee WEP calls this function when set Txkey, default key index=0~3. - - Arguments: - pAd Pointer to our adapter - pKey Pointer to the where the key stored - - Return Value: - NDIS_SUCCESS Add key successfully - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -/* - ======================================================================== - Routine Description: - Change NIC PHY mode. Re-association may be necessary. possible settings - include - PHY_11B, PHY_11BG_MIXED, PHY_11A, and PHY_11ABG_MIXED - - Arguments: - pAd - Pointer to our adapter - phymode - - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - ======================================================================== -*/ -VOID RTMPSetPhyMode( - IN PRTMP_ADAPTER pAd, - IN ULONG phymode) -{ - INT i; - // the selected phymode must be supported by the RF IC encoded in E2PROM - - // if no change, do nothing - /* bug fix - if (pAd->CommonCfg.PhyMode == phymode) - return; - */ - pAd->CommonCfg.PhyMode = (UCHAR)phymode; - - DBGPRINT(RT_DEBUG_TRACE,("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", pAd->CommonCfg.PhyMode, pAd->CommonCfg.Channel)); -#ifdef EXT_BUILD_CHANNEL_LIST - BuildChannelListEx(pAd); -#else - BuildChannelList(pAd); -#endif // EXT_BUILD_CHANNEL_LIST // - - // sanity check user setting - for (i = 0; i < pAd->ChannelListNum; i++) - { - if (pAd->CommonCfg.Channel == pAd->ChannelList[i].Channel) - break; - } - - if (i == pAd->ChannelListNum) - { -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - pAd->CommonCfg.Channel = FirstChannel(pAd); -#endif // CONFIG_STA_SUPPORT // - DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetPhyMode: channel is out of range, use first channel=%d \n", pAd->CommonCfg.Channel)); - } - - NdisZeroMemory(pAd->CommonCfg.SupRate, MAX_LEN_OF_SUPPORTED_RATES); - NdisZeroMemory(pAd->CommonCfg.ExtRate, MAX_LEN_OF_SUPPORTED_RATES); - NdisZeroMemory(pAd->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES); - switch (phymode) { - case PHY_11B: - pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRateLen = 4; - pAd->CommonCfg.ExtRateLen = 0; - pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps - //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use - break; - - case PHY_11G: - case PHY_11BG_MIXED: - case PHY_11ABG_MIXED: -#ifdef DOT11_N_SUPPORT - case PHY_11N_2_4G: - case PHY_11ABGN_MIXED: - case PHY_11BGN_MIXED: - case PHY_11GN_MIXED: -#endif // DOT11_N_SUPPORT // - pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[4] = 0x12; // 9 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[5] = 0x24; // 18 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[6] = 0x48; // 36 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRateLen = 8; - pAd->CommonCfg.ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps - pAd->CommonCfg.ExtRate[1] = 0x18; // 12 mbps, in units of 0.5 Mbps - pAd->CommonCfg.ExtRate[2] = 0x30; // 24 mbps, in units of 0.5 Mbps - pAd->CommonCfg.ExtRate[3] = 0x60; // 48 mbps, in units of 0.5 Mbps - pAd->CommonCfg.ExtRateLen = 4; - pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[4] = 12; // 6 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[5] = 18; // 9 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[6] = 24; // 12 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[7] = 36; // 18 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[8] = 48; // 24 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[9] = 72; // 36 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[10] = 96; // 48 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[11] = 108; // 54 mbps, in units of 0.5 Mbps - break; - - case PHY_11A: -#ifdef DOT11_N_SUPPORT - case PHY_11AN_MIXED: - case PHY_11AGN_MIXED: - case PHY_11N_5G: -#endif // DOT11_N_SUPPORT // - pAd->CommonCfg.SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRateLen = 8; - pAd->CommonCfg.ExtRateLen = 0; - pAd->CommonCfg.DesireRate[0] = 12; // 6 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[1] = 18; // 9 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[2] = 24; // 12 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[3] = 36; // 18 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[4] = 48; // 24 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[5] = 72; // 36 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[6] = 96; // 48 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[7] = 108; // 54 mbps, in units of 0.5 Mbps - //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use - break; - - default: - break; - } - - - pAd->CommonCfg.BandState = UNKNOWN_BAND; -} - - -#ifdef DOT11_N_SUPPORT -/* - ======================================================================== - Routine Description: - Caller ensures we has 802.11n support. - Calls at setting HT from AP/STASetinformation - - Arguments: - pAd - Pointer to our adapter - phymode - - - ======================================================================== -*/ -VOID RTMPSetHT( - IN PRTMP_ADAPTER pAd, - IN OID_SET_HT_PHYMODE *pHTPhyMode) -{ - //ULONG *pmcs; - UINT32 Value = 0; - UCHAR BBPValue = 0; - UCHAR BBP3Value = 0; - UCHAR RxStream = pAd->CommonCfg.RxStream; - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n", - pHTPhyMode->HtMode, pHTPhyMode->ExtOffset, - pHTPhyMode->MCS, pHTPhyMode->BW, - pHTPhyMode->STBC, pHTPhyMode->SHORTGI)); - - // Don't zero supportedHyPhy structure. - RTMPZeroMemory(&pAd->CommonCfg.HtCapability, sizeof(pAd->CommonCfg.HtCapability)); - RTMPZeroMemory(&pAd->CommonCfg.AddHTInfo, sizeof(pAd->CommonCfg.AddHTInfo)); - RTMPZeroMemory(&pAd->CommonCfg.NewExtChanOffset, sizeof(pAd->CommonCfg.NewExtChanOffset)); - RTMPZeroMemory(&pAd->CommonCfg.DesiredHtPhy, sizeof(pAd->CommonCfg.DesiredHtPhy)); - - if (pAd->CommonCfg.bRdg) - { - pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 1; - pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 1; - } - else - { - pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 0; - pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 0; - } - - pAd->CommonCfg.HtCapability.HtCapParm.MaxRAmpduFactor = 3; - pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor = 3; - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : RxBAWinLimit = %d\n", pAd->CommonCfg.BACapability.field.RxBAWinLimit)); - - // Mimo power save, A-MSDU size, - pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable; - pAd->CommonCfg.DesiredHtPhy.AmsduSize = (UCHAR)pAd->CommonCfg.BACapability.field.AmsduSize; - pAd->CommonCfg.DesiredHtPhy.MimoPs = (UCHAR)pAd->CommonCfg.BACapability.field.MMPSmode; - pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity; - - pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize; - pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode; - pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity; - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n", - pAd->CommonCfg.DesiredHtPhy.AmsduSize, - pAd->CommonCfg.DesiredHtPhy.MimoPs, - pAd->CommonCfg.DesiredHtPhy.MpduDensity, - pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor)); - - if(pHTPhyMode->HtMode == HTMODE_GF) - { - pAd->CommonCfg.HtCapability.HtCapInfo.GF = 1; - pAd->CommonCfg.DesiredHtPhy.GF = 1; - } - else - pAd->CommonCfg.DesiredHtPhy.GF = 0; - - // Decide Rx MCSSet - switch (RxStream) - { - case 1: - pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff; - pAd->CommonCfg.HtCapability.MCSSet[1] = 0x00; - break; - - case 2: - pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff; - pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff; - break; - - case 3: // 3*3 - pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff; - pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff; - pAd->CommonCfg.HtCapability.MCSSet[2] = 0xff; - break; - } - - if (pAd->CommonCfg.bForty_Mhz_Intolerant && (pAd->CommonCfg.Channel <= 14) && (pHTPhyMode->BW == BW_40) ) - { - pHTPhyMode->BW = BW_20; - pAd->CommonCfg.HtCapability.HtCapInfo.Forty_Mhz_Intolerant = 1; - } - - if(pHTPhyMode->BW == BW_40) - { - pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; // MCS 32 - pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 1; - if (pAd->CommonCfg.Channel <= 14) - pAd->CommonCfg.HtCapability.HtCapInfo.CCKmodein40 = 1; - - pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 1; - pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 1; - pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = (pHTPhyMode->ExtOffset == EXTCHA_BELOW)? (EXTCHA_BELOW): EXTCHA_ABOVE; - // Set Regsiter for extension channel position. - RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value); - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBP3Value); - if ((pHTPhyMode->ExtOffset == EXTCHA_BELOW)) - { - Value |= 0x1; - BBP3Value |= (0x20); - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); - } - else if ((pHTPhyMode->ExtOffset == EXTCHA_ABOVE)) - { - Value &= 0xfe; - BBP3Value &= (~0x20); - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); - } - - // Turn on BBP 40MHz mode now only as AP . - // Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection. - if ((pAd->OpMode == OPMODE_AP) || INFRA_ON(pAd) || ADHOC_ON(pAd) - ) - { - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue &= (~0x18); - BBPValue |= 0x10; - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBP3Value); - pAd->CommonCfg.BBPCurrentBW = BW_40; - } - } - else - { - pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 0; - pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 0; - pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 0; - pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = EXTCHA_NONE; - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; - // Turn on BBP 20MHz mode by request here. - { - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue &= (~0x18); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - pAd->CommonCfg.BBPCurrentBW = BW_20; - } - } - - if(pHTPhyMode->STBC == STBC_USE) - { - pAd->CommonCfg.HtCapability.HtCapInfo.TxSTBC = 1; - pAd->CommonCfg.DesiredHtPhy.TxSTBC = 1; - pAd->CommonCfg.HtCapability.HtCapInfo.RxSTBC = 1; - pAd->CommonCfg.DesiredHtPhy.RxSTBC = 1; - } - else - { - pAd->CommonCfg.DesiredHtPhy.TxSTBC = 0; - pAd->CommonCfg.DesiredHtPhy.RxSTBC = 0; - } - - if(pHTPhyMode->SHORTGI == GI_400) - { - pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 1; - pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 1; - pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 1; - pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 1; - } - else - { - pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 0; - pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 0; - pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 0; - pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 0; - } - - // We support link adaptation for unsolicit MCS feedback, set to 2. - pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; //MCSFBK_UNSOLICIT; - pAd->CommonCfg.AddHTInfo.ControlChan = pAd->CommonCfg.Channel; - // 1, the extension channel above the control channel. - - // EDCA parameters used for AP's own transmission - if (pAd->CommonCfg.APEdcaParm.bValid == FALSE) - { - pAd->CommonCfg.APEdcaParm.bValid = TRUE; - pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3; - pAd->CommonCfg.APEdcaParm.Aifsn[1] = 7; - pAd->CommonCfg.APEdcaParm.Aifsn[2] = 1; - pAd->CommonCfg.APEdcaParm.Aifsn[3] = 1; - - pAd->CommonCfg.APEdcaParm.Cwmin[0] = 4; - pAd->CommonCfg.APEdcaParm.Cwmin[1] = 4; - pAd->CommonCfg.APEdcaParm.Cwmin[2] = 3; - pAd->CommonCfg.APEdcaParm.Cwmin[3] = 2; - - pAd->CommonCfg.APEdcaParm.Cwmax[0] = 6; - pAd->CommonCfg.APEdcaParm.Cwmax[1] = 10; - pAd->CommonCfg.APEdcaParm.Cwmax[2] = 4; - pAd->CommonCfg.APEdcaParm.Cwmax[3] = 3; - - pAd->CommonCfg.APEdcaParm.Txop[0] = 0; - pAd->CommonCfg.APEdcaParm.Txop[1] = 0; - pAd->CommonCfg.APEdcaParm.Txop[2] = 94; - pAd->CommonCfg.APEdcaParm.Txop[3] = 47; - } - AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm); - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - RTMPSetIndividualHT(pAd, 0); - } -#endif // CONFIG_STA_SUPPORT // - -} - -/* - ======================================================================== - Routine Description: - Caller ensures we has 802.11n support. - Calls at setting HT from AP/STASetinformation - - Arguments: - pAd - Pointer to our adapter - phymode - - - ======================================================================== -*/ -VOID RTMPSetIndividualHT( - IN PRTMP_ADAPTER pAd, - IN UCHAR apidx) -{ - PRT_HT_PHY_INFO pDesired_ht_phy = NULL; - UCHAR TxStream = pAd->CommonCfg.TxStream; - UCHAR DesiredMcs = MCS_AUTO; - - do - { - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - pDesired_ht_phy = &pAd->StaCfg.DesiredHtPhyInfo; - DesiredMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS; - //pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE; - break; - } -#endif // CONFIG_STA_SUPPORT // - } while (FALSE); - - if (pDesired_ht_phy == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetIndividualHT: invalid apidx(%d)\n", apidx)); - return; - } - RTMPZeroMemory(pDesired_ht_phy, sizeof(RT_HT_PHY_INFO)); - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs)); - // Check the validity of MCS - if ((TxStream == 1) && ((DesiredMcs >= MCS_8) && (DesiredMcs <= MCS_15))) - { - DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS(%d) is invalid in 1S, reset it as MCS_7\n", DesiredMcs)); - DesiredMcs = MCS_7; - } - - if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_20) && (DesiredMcs == MCS_32)) - { - DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS_32 is only supported in 40-MHz, reset it as MCS_0\n")); - DesiredMcs = MCS_0; - } - - pDesired_ht_phy->bHtEnable = TRUE; - - // Decide desired Tx MCS - switch (TxStream) - { - case 1: - if (DesiredMcs == MCS_AUTO) - { - pDesired_ht_phy->MCSSet[0]= 0xff; - pDesired_ht_phy->MCSSet[1]= 0x00; - } - else if (DesiredMcs <= MCS_7) - { - pDesired_ht_phy->MCSSet[0]= 1<MCSSet[1]= 0x00; - } - break; - - case 2: - if (DesiredMcs == MCS_AUTO) - { - pDesired_ht_phy->MCSSet[0]= 0xff; - pDesired_ht_phy->MCSSet[1]= 0xff; - } - else if (DesiredMcs <= MCS_15) - { - ULONG mode; - - mode = DesiredMcs / 8; - if (mode < 2) - pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8)); - } - break; - - case 3: // 3*3 - if (DesiredMcs == MCS_AUTO) - { - /* MCS0 ~ MCS23, 3 bytes */ - pDesired_ht_phy->MCSSet[0]= 0xff; - pDesired_ht_phy->MCSSet[1]= 0xff; - pDesired_ht_phy->MCSSet[2]= 0xff; - } - else if (DesiredMcs <= MCS_23) - { - ULONG mode; - - mode = DesiredMcs / 8; - if (mode < 3) - pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8)); - } - break; - } - - if(pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_40) - { - if (DesiredMcs == MCS_AUTO || DesiredMcs == MCS_32) - pDesired_ht_phy->MCSSet[4] = 0x1; - } - - // update HT Rate setting - if (pAd->OpMode == OPMODE_STA) - MlmeUpdateHtTxRates(pAd, BSS0); - else - MlmeUpdateHtTxRates(pAd, apidx); -} - - -/* - ======================================================================== - Routine Description: - Update HT IE from our capability. - - Arguments: - Send all HT IE in beacon/probe rsp/assoc rsp/action frame. - - - ======================================================================== -*/ -VOID RTMPUpdateHTIE( - IN RT_HT_CAPABILITY *pRtHt, - IN UCHAR *pMcsSet, - OUT HT_CAPABILITY_IE *pHtCapability, - OUT ADD_HT_INFO_IE *pAddHtInfo) -{ - RTMPZeroMemory(pHtCapability, sizeof(HT_CAPABILITY_IE)); - RTMPZeroMemory(pAddHtInfo, sizeof(ADD_HT_INFO_IE)); - - pHtCapability->HtCapInfo.ChannelWidth = pRtHt->ChannelWidth; - pHtCapability->HtCapInfo.MimoPs = pRtHt->MimoPs; - pHtCapability->HtCapInfo.GF = pRtHt->GF; - pHtCapability->HtCapInfo.ShortGIfor20 = pRtHt->ShortGIfor20; - pHtCapability->HtCapInfo.ShortGIfor40 = pRtHt->ShortGIfor40; - pHtCapability->HtCapInfo.TxSTBC = pRtHt->TxSTBC; - pHtCapability->HtCapInfo.RxSTBC = pRtHt->RxSTBC; - pHtCapability->HtCapInfo.AMsduSize = pRtHt->AmsduSize; - pHtCapability->HtCapParm.MaxRAmpduFactor = pRtHt->MaxRAmpduFactor; - pHtCapability->HtCapParm.MpduDensity = pRtHt->MpduDensity; - - pAddHtInfo->AddHtInfo.ExtChanOffset = pRtHt->ExtChanOffset ; - pAddHtInfo->AddHtInfo.RecomWidth = pRtHt->RecomWidth; - pAddHtInfo->AddHtInfo2.OperaionMode = pRtHt->OperaionMode; - pAddHtInfo->AddHtInfo2.NonGfPresent = pRtHt->NonGfPresent; - RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet*/pMcsSet, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar. - - DBGPRINT(RT_DEBUG_TRACE,("RTMPUpdateHTIE <== \n")); -} -#endif // DOT11_N_SUPPORT // - -/* - ======================================================================== - Description: - Add Client security information into ASIC WCID table and IVEIV table. - Return: - ======================================================================== -*/ -VOID RTMPAddWcidAttributeEntry( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssIdx, - IN UCHAR KeyIdx, - IN UCHAR CipherAlg, - IN MAC_TABLE_ENTRY *pEntry) -{ - UINT32 WCIDAttri = 0; - USHORT offset; - UCHAR IVEIV = 0; - USHORT Wcid = 0; - - { -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (BssIdx > BSS0) - { - DBGPRINT(RT_DEBUG_ERROR, ("RTMPAddWcidAttributeEntry: The BSS-index(%d) is out of range for Infra link. \n", BssIdx)); - return; - } - - // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists. - // 2. In Infra mode, the AID:1 MUST be wcid of infra STA. - // the AID:2~ assign to mesh link entry. - if (pEntry) - Wcid = pEntry->Aid; - else - Wcid = MCAST_WCID; - } -#endif // CONFIG_STA_SUPPORT // - } - - // Update WCID attribute table - offset = MAC_WCID_ATTRIBUTE_BASE + (Wcid * HW_WCID_ATTRI_SIZE); - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (pEntry && pEntry->ValidAsMesh) - WCIDAttri = (CipherAlg<<1) | PAIRWISEKEYTABLE; -#ifdef QOS_DLS_SUPPORT - else if ((pEntry) && (pEntry->ValidAsDls) && - ((CipherAlg == CIPHER_TKIP) || - (CipherAlg == CIPHER_TKIP_NO_MIC) || - (CipherAlg == CIPHER_AES) || - (CipherAlg == CIPHER_NONE))) - WCIDAttri = (CipherAlg<<1) | PAIRWISEKEYTABLE; -#endif // QOS_DLS_SUPPORT // - else - WCIDAttri = (CipherAlg<<1) | SHAREDKEYTABLE; - } -#endif // CONFIG_STA_SUPPORT // - - RTMP_IO_WRITE32(pAd, offset, WCIDAttri); - - - // Update IV/EIV table - offset = MAC_IVEIV_TABLE_BASE + (Wcid * HW_IVEIV_ENTRY_SIZE); - - // WPA mode - if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) || (CipherAlg == CIPHER_AES)) - { - // Eiv bit on. keyid always is 0 for pairwise key - IVEIV = (KeyIdx <<6) | 0x20; - } - else - { - // WEP KeyIdx is default tx key. - IVEIV = (KeyIdx << 6); - } - - // For key index and ext IV bit, so only need to update the position(offset+3). -#ifdef RTMP_MAC_PCI - RTMP_IO_WRITE8(pAd, offset+3, IVEIV); -#endif // RTMP_MAC_PCI // - - DBGPRINT(RT_DEBUG_TRACE,("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",Wcid, KeyIdx, CipherName[CipherAlg])); - DBGPRINT(RT_DEBUG_TRACE,(" WCIDAttri = 0x%x \n", WCIDAttri)); - -} - -/* - ========================================================================== - Description: - Parse encryption type -Arguments: - pAdapter Pointer to our adapter - wrq Pointer to the ioctl argument - - Return Value: - None - - Note: - ========================================================================== -*/ -PSTRING GetEncryptType(CHAR enc) -{ - if(enc == Ndis802_11WEPDisabled) - return "NONE"; - if(enc == Ndis802_11WEPEnabled) - return "WEP"; - if(enc == Ndis802_11Encryption2Enabled) - return "TKIP"; - if(enc == Ndis802_11Encryption3Enabled) - return "AES"; - if(enc == Ndis802_11Encryption4Enabled) - return "TKIPAES"; - else - return "UNKNOW"; -} - -PSTRING GetAuthMode(CHAR auth) -{ - if(auth == Ndis802_11AuthModeOpen) - return "OPEN"; - if(auth == Ndis802_11AuthModeShared) - return "SHARED"; - if(auth == Ndis802_11AuthModeAutoSwitch) - return "AUTOWEP"; - if(auth == Ndis802_11AuthModeWPA) - return "WPA"; - if(auth == Ndis802_11AuthModeWPAPSK) - return "WPAPSK"; - if(auth == Ndis802_11AuthModeWPANone) - return "WPANONE"; - if(auth == Ndis802_11AuthModeWPA2) - return "WPA2"; - if(auth == Ndis802_11AuthModeWPA2PSK) - return "WPA2PSK"; - if(auth == Ndis802_11AuthModeWPA1WPA2) - return "WPA1WPA2"; - if(auth == Ndis802_11AuthModeWPA1PSKWPA2PSK) - return "WPA1PSKWPA2PSK"; - - return "UNKNOW"; -} - - -/* - ========================================================================== - Description: - Get site survey results - Arguments: - pAdapter Pointer to our adapter - wrq Pointer to the ioctl argument - - Return Value: - None - - Note: - Usage: - 1.) UI needs to wait 4 seconds after issue a site survey command - 2.) iwpriv ra0 get_site_survey - 3.) UI needs to prepare at least 4096bytes to get the results - ========================================================================== -*/ -#define LINE_LEN (4+33+20+23+9+7+3) // Channel+SSID+Bssid+Security+Signal+WiressMode+NetworkType -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // -VOID RTMPCommSiteSurveyData( - IN PSTRING msg, - IN PBSS_ENTRY pBss) -{ - INT Rssi = 0; - UINT Rssi_Quality = 0; - NDIS_802_11_NETWORK_TYPE wireless_mode; - CHAR Ssid[MAX_LEN_OF_SSID +1]; - STRING SecurityStr[32] = {0}; - NDIS_802_11_ENCRYPTION_STATUS ap_cipher = Ndis802_11EncryptionDisabled; - NDIS_802_11_AUTHENTICATION_MODE ap_auth_mode = Ndis802_11AuthModeOpen; - - memset(Ssid, 0 ,(MAX_LEN_OF_SSID +1)); - - //Channel - sprintf(msg+strlen(msg),"%-4d", pBss->Channel); - //SSID - memcpy(Ssid, pBss->Ssid, pBss->SsidLen); - Ssid[pBss->SsidLen] = '\0'; - sprintf(msg+strlen(msg),"%-33s", Ssid); - //BSSID - sprintf(msg+strlen(msg),"%02x:%02x:%02x:%02x:%02x:%02x ", - pBss->Bssid[0], - pBss->Bssid[1], - pBss->Bssid[2], - pBss->Bssid[3], - pBss->Bssid[4], - pBss->Bssid[5]); - - //Security - if ((Ndis802_11AuthModeWPA <= pBss->AuthMode) && - (pBss->AuthMode <= Ndis802_11AuthModeWPA1PSKWPA2PSK)) - { - if (pBss->AuthModeAux == Ndis802_11AuthModeWPANone) - { - ap_auth_mode = pBss->AuthMode; - if (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled) - ap_cipher = pBss->WPA.PairCipher; - else - ap_cipher = Ndis802_11Encryption4Enabled; - } - else if (pBss->AuthModeAux == Ndis802_11AuthModeOpen) - { - ap_auth_mode = pBss->AuthMode; - if ((ap_auth_mode == Ndis802_11AuthModeWPA) || - (ap_auth_mode == Ndis802_11AuthModeWPAPSK)) - { - if (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled) - ap_cipher = pBss->WPA.PairCipher; - else - ap_cipher = Ndis802_11Encryption4Enabled; - } - else if ((ap_auth_mode == Ndis802_11AuthModeWPA2) || - (ap_auth_mode == Ndis802_11AuthModeWPA2PSK)) - { - if (pBss->WPA2.PairCipherAux == Ndis802_11WEPDisabled) - ap_cipher = pBss->WPA2.PairCipher; - else - ap_cipher = Ndis802_11Encryption4Enabled; - } - } - else if ((pBss->AuthMode == Ndis802_11AuthModeWPAPSK) || - (pBss->AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - if ((pBss->AuthModeAux == Ndis802_11AuthModeWPAPSK) || - (pBss->AuthModeAux == Ndis802_11AuthModeWPA2PSK)) - ap_auth_mode = Ndis802_11AuthModeWPA1PSKWPA2PSK; - else - ap_auth_mode = pBss->AuthMode; - - if (pBss->WPA.PairCipher != pBss->WPA2.PairCipher) - ap_cipher = Ndis802_11Encryption4Enabled; - else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && - (pBss->WPA.PairCipherAux != pBss->WPA2.PairCipherAux)) - ap_cipher = Ndis802_11Encryption4Enabled; - else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && - (pBss->WPA.PairCipherAux == pBss->WPA2.PairCipherAux) && - (pBss->WPA.PairCipherAux != Ndis802_11WEPDisabled)) - ap_cipher = Ndis802_11Encryption4Enabled; - else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && - (pBss->WPA.PairCipherAux == pBss->WPA2.PairCipherAux) && - (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled)) - ap_cipher = pBss->WPA.PairCipher; - } - else if ((pBss->AuthMode == Ndis802_11AuthModeWPA) || - (pBss->AuthMode == Ndis802_11AuthModeWPA2)) - { - if ((pBss->AuthModeAux == Ndis802_11AuthModeWPA) || - (pBss->AuthMode == Ndis802_11AuthModeWPA2)) - ap_auth_mode = Ndis802_11AuthModeWPA1WPA2; - else - ap_auth_mode = pBss->AuthMode; - - if (pBss->WPA.PairCipher != pBss->WPA2.PairCipher) - ap_cipher = Ndis802_11Encryption4Enabled; - else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && - (pBss->WPA.PairCipherAux != pBss->WPA2.PairCipherAux)) - ap_cipher = Ndis802_11Encryption4Enabled; - else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && - (pBss->WPA.PairCipherAux == pBss->WPA2.PairCipherAux) && - (pBss->WPA.PairCipherAux != Ndis802_11WEPDisabled)) - ap_cipher = Ndis802_11Encryption4Enabled; - else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && - (pBss->WPA.PairCipherAux == pBss->WPA2.PairCipherAux) && - (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled)) - ap_cipher = pBss->WPA.PairCipher; - } - - sprintf(SecurityStr, "%s/%s", GetAuthMode((CHAR)ap_auth_mode), GetEncryptType((CHAR)ap_cipher)); - } - else - { - ap_auth_mode = pBss->AuthMode; - ap_cipher = pBss->WepStatus; - if (ap_cipher == Ndis802_11WEPDisabled) - sprintf(SecurityStr, "NONE"); - else if (ap_cipher == Ndis802_11WEPEnabled) - sprintf(SecurityStr, "WEP"); - else - sprintf(SecurityStr, "%s/%s", GetAuthMode((CHAR)ap_auth_mode), GetEncryptType((CHAR)ap_cipher)); - } - - sprintf(msg+strlen(msg), "%-23s", SecurityStr); - - // Rssi - Rssi = (INT)pBss->Rssi; - if (Rssi >= -50) - Rssi_Quality = 100; - else if (Rssi >= -80) // between -50 ~ -80dbm - Rssi_Quality = (UINT)(24 + ((Rssi + 80) * 26)/10); - else if (Rssi >= -90) // between -80 ~ -90dbm - Rssi_Quality = (UINT)(((Rssi + 90) * 26)/10); - else // < -84 dbm - Rssi_Quality = 0; - sprintf(msg+strlen(msg),"%-9d", Rssi_Quality); - // Wireless Mode - wireless_mode = NetworkTypeInUseSanity(pBss); - if (wireless_mode == Ndis802_11FH || - wireless_mode == Ndis802_11DS) - sprintf(msg+strlen(msg),"%-7s", "11b"); - else if (wireless_mode == Ndis802_11OFDM5) - sprintf(msg+strlen(msg),"%-7s", "11a"); - else if (wireless_mode == Ndis802_11OFDM5_N) - sprintf(msg+strlen(msg),"%-7s", "11a/n"); - else if (wireless_mode == Ndis802_11OFDM24) - sprintf(msg+strlen(msg),"%-7s", "11b/g"); - else if (wireless_mode == Ndis802_11OFDM24_N) - sprintf(msg+strlen(msg),"%-7s", "11b/g/n"); - else - sprintf(msg+strlen(msg),"%-7s", "unknow"); - //Network Type - if (pBss->BssType == BSS_ADHOC) - sprintf(msg+strlen(msg),"%-3s", " Ad"); - else - sprintf(msg+strlen(msg),"%-3s", " In"); - - sprintf(msg+strlen(msg),"\n"); - - return; -} - -VOID RTMPIoctlGetSiteSurvey( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq) -{ - PSTRING msg; - INT i=0; - INT WaitCnt; - INT Status=0; - INT max_len = LINE_LEN; - PBSS_ENTRY pBss; - -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // - - os_alloc_mem(NULL, (PUCHAR *)&msg, sizeof(CHAR)*((MAX_LEN_OF_BSS_TABLE)*max_len)); - - if (msg == NULL) - { - DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - msg memory alloc fail.\n")); - return; - } - - memset(msg, 0 ,(MAX_LEN_OF_BSS_TABLE)*max_len ); - sprintf(msg,"%s","\n"); - sprintf(msg+strlen(msg),"%-4s%-33s%-20s%-23s%-9s%-7s%-3s\n", - "Ch", "SSID", "BSSID", "Security", "Siganl(%)", "W-Mode", " NT"); - -#ifdef CONFIG_STA_SUPPORT - -#endif // CONFIG_STA_SUPPORT // - - WaitCnt = 0; -#ifdef CONFIG_STA_SUPPORT - pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE; - while ((ScanRunning(pAdapter) == TRUE) && (WaitCnt++ < 200)) - OS_WAIT(500); -#endif // CONFIG_STA_SUPPORT // - - for(i=0; iScanTab.BssNr ;i++) - { - pBss = &pAdapter->ScanTab.BssEntry[i]; - - if( pBss->Channel==0) - break; - - if((strlen(msg)+max_len ) >= IW_SCAN_MAX_DATA) - break; - - - RTMPCommSiteSurveyData(msg, pBss); - -#ifdef CONFIG_STA_SUPPORT - -#endif // CONFIG_STA_SUPPORT // - } - -#ifdef CONFIG_STA_SUPPORT - pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE; -#endif // CONFIG_STA_SUPPORT // - wrq->u.data.length = strlen(msg); - Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length); - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - wrq->u.data.length = %d\n", wrq->u.data.length)); - os_free_mem(NULL, (PUCHAR)msg); -} - -#define MAC_LINE_LEN (14+4+4+10+10+10+6+6) // Addr+aid+psm+datatime+rxbyte+txbyte+current tx rate+last tx rate -VOID RTMPIoctlGetMacTable( - IN PRTMP_ADAPTER pAd, - IN struct iwreq *wrq) -{ - INT i; - RT_802_11_MAC_TABLE MacTab; - char *msg; - - MacTab.Num = 0; - for (i=0; iMacTab.Content[i].ValidAsCLI && (pAd->MacTab.Content[i].Sst == SST_ASSOC)) - { - COPY_MAC_ADDR(MacTab.Entry[MacTab.Num].Addr, &pAd->MacTab.Content[i].Addr); - MacTab.Entry[MacTab.Num].Aid = (UCHAR)pAd->MacTab.Content[i].Aid; - MacTab.Entry[MacTab.Num].Psm = pAd->MacTab.Content[i].PsMode; -#ifdef DOT11_N_SUPPORT - MacTab.Entry[MacTab.Num].MimoPs = pAd->MacTab.Content[i].MmpsMode; -#endif // DOT11_N_SUPPORT // - - // Fill in RSSI per entry - MacTab.Entry[MacTab.Num].AvgRssi0 = pAd->MacTab.Content[i].RssiSample.AvgRssi0; - MacTab.Entry[MacTab.Num].AvgRssi1 = pAd->MacTab.Content[i].RssiSample.AvgRssi1; - MacTab.Entry[MacTab.Num].AvgRssi2 = pAd->MacTab.Content[i].RssiSample.AvgRssi2; - - // the connected time per entry - MacTab.Entry[MacTab.Num].ConnectedTime = pAd->MacTab.Content[i].StaConnectTime; - MacTab.Entry[MacTab.Num].TxRate.field.MCS = pAd->MacTab.Content[i].HTPhyMode.field.MCS; - MacTab.Entry[MacTab.Num].TxRate.field.BW = pAd->MacTab.Content[i].HTPhyMode.field.BW; - MacTab.Entry[MacTab.Num].TxRate.field.ShortGI = pAd->MacTab.Content[i].HTPhyMode.field.ShortGI; - MacTab.Entry[MacTab.Num].TxRate.field.STBC = pAd->MacTab.Content[i].HTPhyMode.field.STBC; - MacTab.Entry[MacTab.Num].TxRate.field.rsv = pAd->MacTab.Content[i].HTPhyMode.field.rsv; - MacTab.Entry[MacTab.Num].TxRate.field.MODE = pAd->MacTab.Content[i].HTPhyMode.field.MODE; - MacTab.Entry[MacTab.Num].TxRate.word = pAd->MacTab.Content[i].HTPhyMode.word; - - MacTab.Num += 1; - } - } - wrq->u.data.length = sizeof(RT_802_11_MAC_TABLE); - if (copy_to_user(wrq->u.data.pointer, &MacTab, wrq->u.data.length)) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s: copy_to_user() fail\n", __FUNCTION__)); - } - - msg = kmalloc(sizeof(CHAR)*(MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN), MEM_ALLOC_FLAG); - if (msg == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s():Alloc memory failed\n", __FUNCTION__)); - return; - } - memset(msg, 0 ,MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN ); - sprintf(msg,"%s","\n"); - sprintf(msg+strlen(msg),"%-14s%-4s%-4s%-10s%-10s%-10s%-6s%-6s\n", - "MAC", "AID", "PSM", "LDT", "RxB", "TxB","CTxR", "LTxR"); - - for (i=0; iMacTab.Content[i]; - if (pEntry->ValidAsCLI && (pEntry->Sst == SST_ASSOC)) - { - if((strlen(msg)+MAC_LINE_LEN ) >= (MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN) ) - break; - sprintf(msg+strlen(msg),"%02x%02x%02x%02x%02x%02x ", - pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2], - pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]); - sprintf(msg+strlen(msg),"%-4d", (int)pEntry->Aid); - sprintf(msg+strlen(msg),"%-4d", (int)pEntry->PsMode); - sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.LastDataPacketTime*/); // ToDo - sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalRxByteCount*/); // ToDo - sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalTxByteCount*/); // ToDo - sprintf(msg+strlen(msg),"%-6d",RateIdToMbps[pAd->MacTab.Content[i].CurrTxRate]); - sprintf(msg+strlen(msg),"%-6d\n",0/*RateIdToMbps[pAd->MacTab.Content[i].LastTxRate]*/); // ToDo - } - } - // for compatible with old API just do the printk to console - //wrq->u.data.length = strlen(msg); - //if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length)) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s", msg)); - } - - kfree(msg); -} - - -#ifdef DOT11_N_SUPPORT -INT Set_BASetup_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR mac[6], tid; - PSTRING token; - STRING sepValue[] = ":", DASH = '-'; - INT i; - MAC_TABLE_ENTRY *pEntry; - -/* - The BASetup inupt string format should be xx:xx:xx:xx:xx:xx-d, - =>The six 2 digit hex-decimal number previous are the Mac address, - =>The seventh decimal number is the tid value. -*/ - //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg)); - - if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format. - return FALSE; - - token = strchr(arg, DASH); - if ((token != NULL) && (strlen(token)>1)) - { - tid = (UCHAR) simple_strtol((token+1), 0, 10); - if (tid > 15) - return FALSE; - - *token = '\0'; - for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++) - { - if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1)))) - return FALSE; - AtoH(token, (&mac[i]), 1); - } - if(i != 6) - return FALSE; - - DBGPRINT(RT_DEBUG_OFF, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x\n", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], tid)); - - pEntry = MacTableLookup(pAd, (PUCHAR) mac); - - if (pEntry) { - DBGPRINT(RT_DEBUG_OFF, ("\nSetup BA Session: Tid = %d\n", tid)); - BAOriSessionSetUp(pAd, pEntry, tid, 0, 100, TRUE); - } - - return TRUE; - } - - return FALSE; - -} - -INT Set_BADecline_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG bBADecline; - - bBADecline = simple_strtol(arg, 0, 10); - - if (bBADecline == 0) - { - pAd->CommonCfg.bBADecline = FALSE; - } - else if (bBADecline == 1) - { - pAd->CommonCfg.bBADecline = TRUE; - } - else - { - return FALSE; //Invalid argument - } - - DBGPRINT(RT_DEBUG_TRACE, ("Set_BADecline_Proc::(BADecline=%d)\n", pAd->CommonCfg.bBADecline)); - - return TRUE; -} - -INT Set_BAOriTearDown_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR mac[6], tid; - PSTRING token; - STRING sepValue[] = ":", DASH = '-'; - INT i; - MAC_TABLE_ENTRY *pEntry; - - //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg)); -/* - The BAOriTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d, - =>The six 2 digit hex-decimal number previous are the Mac address, - =>The seventh decimal number is the tid value. -*/ - if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format. - return FALSE; - - token = strchr(arg, DASH); - if ((token != NULL) && (strlen(token)>1)) - { - tid = simple_strtol((token+1), 0, 10); - if (tid > NUM_OF_TID) - return FALSE; - - *token = '\0'; - for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++) - { - if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1)))) - return FALSE; - AtoH(token, (&mac[i]), 1); - } - if(i != 6) - return FALSE; - - DBGPRINT(RT_DEBUG_OFF, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], tid)); - - pEntry = MacTableLookup(pAd, (PUCHAR) mac); - - if (pEntry) { - DBGPRINT(RT_DEBUG_OFF, ("\nTear down Ori BA Session: Tid = %d\n", tid)); - BAOriSessionTearDown(pAd, pEntry->Aid, tid, FALSE, TRUE); - } - - return TRUE; - } - - return FALSE; - -} - -INT Set_BARecTearDown_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR mac[6], tid; - PSTRING token; - STRING sepValue[] = ":", DASH = '-'; - INT i; - MAC_TABLE_ENTRY *pEntry; - - //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg)); -/* - The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d, - =>The six 2 digit hex-decimal number previous are the Mac address, - =>The seventh decimal number is the tid value. -*/ - if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format. - return FALSE; - - token = strchr(arg, DASH); - if ((token != NULL) && (strlen(token)>1)) - { - tid = simple_strtol((token+1), 0, 10); - if (tid > NUM_OF_TID) - return FALSE; - - *token = '\0'; - for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++) - { - if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1)))) - return FALSE; - AtoH(token, (&mac[i]), 1); - } - if(i != 6) - return FALSE; - - DBGPRINT(RT_DEBUG_OFF, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], tid)); - - pEntry = MacTableLookup(pAd, (PUCHAR) mac); - - if (pEntry) { - DBGPRINT(RT_DEBUG_OFF, ("\nTear down Rec BA Session: Tid = %d\n", tid)); - BARecSessionTearDown(pAd, pEntry->Aid, tid, FALSE); - } - - return TRUE; - } - - return FALSE; - -} - -INT Set_HtBw_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG HtBw; - - HtBw = simple_strtol(arg, 0, 10); - if (HtBw == BW_40) - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40; - else if (HtBw == BW_20) - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBw_Proc::(HtBw=%d)\n", pAd->CommonCfg.RegTransmitSetting.field.BW)); - - return TRUE; -} - -INT Set_HtMcs_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG HtMcs, Mcs_tmp; -#ifdef CONFIG_STA_SUPPORT - BOOLEAN bAutoRate = FALSE; -#endif // CONFIG_STA_SUPPORT // - - Mcs_tmp = simple_strtol(arg, 0, 10); - - if (Mcs_tmp <= 15 || Mcs_tmp == 32) - HtMcs = Mcs_tmp; - else - HtMcs = MCS_AUTO; - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - pAd->StaCfg.DesiredTransmitSetting.field.MCS = HtMcs; - pAd->StaCfg.bAutoTxRateSwitch = (HtMcs == MCS_AUTO) ? TRUE:FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(HtMcs=%d, bAutoTxRateSwitch = %d)\n", - pAd->StaCfg.DesiredTransmitSetting.field.MCS, pAd->StaCfg.bAutoTxRateSwitch)); - - if ((pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED) || - (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE < MODE_HTMIX)) - { - if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) && - (HtMcs >= 0 && HtMcs <= 3) && - (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_CCK)) - { - RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs] * 1000000)); - } - else if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) && - (HtMcs >= 0 && HtMcs <= 7) && - (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_OFDM)) - { - RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs+4] * 1000000)); - } - else - bAutoRate = TRUE; - - if (bAutoRate) - { - pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; - RTMPSetDesiredRates(pAd, -1); - } - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(FixedTxMode=%d)\n",pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode)); - } - if (ADHOC_ON(pAd)) - return TRUE; - } -#endif // CONFIG_STA_SUPPORT // - - SetCommonHT(pAd); - - return TRUE; -} - -INT Set_HtGi_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG HtGi; - - HtGi = simple_strtol(arg, 0, 10); - - if ( HtGi == GI_400) - pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_400; - else if ( HtGi == GI_800 ) - pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_800; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtGi_Proc::(ShortGI=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.ShortGI)); - - return TRUE; -} - - -INT Set_HtTxBASize_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR Size; - - Size = simple_strtol(arg, 0, 10); - - if (Size <=0 || Size >=64) - { - Size = 8; - } - pAd->CommonCfg.TxBASize = Size-1; - DBGPRINT(RT_DEBUG_ERROR, ("Set_HtTxBASize ::(TxBASize= %d)\n", Size)); - - return TRUE; -} - -INT Set_HtDisallowTKIP_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value == 1) - { - pAd->CommonCfg.HT_DisallowTKIP = TRUE; - } - else - { - pAd->CommonCfg.HT_DisallowTKIP = FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtDisallowTKIP_Proc ::%s\n", - (pAd->CommonCfg.HT_DisallowTKIP == TRUE) ? "enabled" : "disabled")); - - return TRUE; -} - -INT Set_HtOpMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value == HTMODE_GF) - pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_GF; - else if ( Value == HTMODE_MM ) - pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_MM; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtOpMode_Proc::(HtOpMode=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.HTMODE)); - - return TRUE; - -} - -INT Set_HtStbc_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value == STBC_USE) - pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_USE; - else if ( Value == STBC_NONE ) - pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_NONE; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_Stbc_Proc::(HtStbc=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.STBC)); - - return TRUE; -} - -INT Set_HtHtc_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->HTCEnable = FALSE; - else if ( Value ==1 ) - pAd->HTCEnable = TRUE; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtHtc_Proc::(HtHtc=%d)\n",pAd->HTCEnable)); - - return TRUE; -} - -INT Set_HtExtcha_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value == 0) - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW; - else if ( Value ==1 ) - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtExtcha_Proc::(HtExtcha=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.EXTCHA)); - - return TRUE; -} - -INT Set_HtMpduDensity_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value <=7 && Value >= 0) - pAd->CommonCfg.BACapability.field.MpduDensity = Value; - else - pAd->CommonCfg.BACapability.field.MpduDensity = 4; - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMpduDensity_Proc::(HtMpduDensity=%d)\n",pAd->CommonCfg.BACapability.field.MpduDensity)); - - return TRUE; -} - -INT Set_HtBaWinSize_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - - if (Value >=1 && Value <= 64) - { - pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = Value; - pAd->CommonCfg.BACapability.field.RxBAWinLimit = Value; - } - else - { - pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = 64; - pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64; - } - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBaWinSize_Proc::(HtBaWinSize=%d)\n",pAd->CommonCfg.BACapability.field.RxBAWinLimit)); - - return TRUE; -} - -INT Set_HtRdg_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value == 0) - pAd->CommonCfg.bRdg = FALSE; - else if ( Value ==1 ) - { - pAd->HTCEnable = TRUE; - pAd->CommonCfg.bRdg = TRUE; - } - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtRdg_Proc::(HtRdg=%d)\n",pAd->CommonCfg.bRdg)); - - return TRUE; -} - -INT Set_HtLinkAdapt_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->bLinkAdapt = FALSE; - else if ( Value ==1 ) - { - pAd->HTCEnable = TRUE; - pAd->bLinkAdapt = TRUE; - } - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtLinkAdapt_Proc::(HtLinkAdapt=%d)\n",pAd->bLinkAdapt)); - - return TRUE; -} - -INT Set_HtAmsdu_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->CommonCfg.BACapability.field.AmsduEnable = FALSE; - else if ( Value == 1 ) - pAd->CommonCfg.BACapability.field.AmsduEnable = TRUE; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAmsdu_Proc::(HtAmsdu=%d)\n",pAd->CommonCfg.BACapability.field.AmsduEnable)); - - return TRUE; -} - -INT Set_HtAutoBa_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.BACapability.field.AutoBA = FALSE; - pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE; - } - else if (Value == 1) - { - pAd->CommonCfg.BACapability.field.AutoBA = TRUE; - pAd->CommonCfg.BACapability.field.Policy = IMMED_BA; - } - else - return FALSE; //Invalid argument - - pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA; - pAd->CommonCfg.REGBACapability.field.Policy = pAd->CommonCfg.BACapability.field.Policy; - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAutoBa_Proc::(HtAutoBa=%d)\n",pAd->CommonCfg.BACapability.field.AutoBA)); - - return TRUE; - -} - -INT Set_HtProtect_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->CommonCfg.bHTProtect = FALSE; - else if (Value == 1) - pAd->CommonCfg.bHTProtect = TRUE; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtProtect_Proc::(HtProtect=%d)\n",pAd->CommonCfg.bHTProtect)); - - return TRUE; -} - -INT Set_SendPSMPAction_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR mac[6], mode; - PSTRING token; - STRING sepValue[] = ":", DASH = '-'; - INT i; - MAC_TABLE_ENTRY *pEntry; - - //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg)); -/* - The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d, - =>The six 2 digit hex-decimal number previous are the Mac address, - =>The seventh decimal number is the mode value. -*/ - if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and mode value in decimal format. - return FALSE; - - token = strchr(arg, DASH); - if ((token != NULL) && (strlen(token)>1)) - { - mode = simple_strtol((token+1), 0, 10); - if (mode > MMPS_ENABLE) - return FALSE; - - *token = '\0'; - for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++) - { - if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1)))) - return FALSE; - AtoH(token, (&mac[i]), 1); - } - if(i != 6) - return FALSE; - - DBGPRINT(RT_DEBUG_OFF, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], mode)); - - pEntry = MacTableLookup(pAd, mac); - - if (pEntry) { - DBGPRINT(RT_DEBUG_OFF, ("\nSendPSMPAction MIPS mode = %d\n", mode)); - SendPSMPAction(pAd, pEntry->Aid, mode); - } - - return TRUE; - } - - return FALSE; - - -} - -INT Set_HtMIMOPSmode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value <=3 && Value >= 0) - pAd->CommonCfg.BACapability.field.MMPSmode = Value; - else - pAd->CommonCfg.BACapability.field.MMPSmode = 3; - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMIMOPSmode_Proc::(MIMOPS mode=%d)\n",pAd->CommonCfg.BACapability.field.MMPSmode)); - - return TRUE; -} - - -INT Set_ForceShortGI_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->WIFItestbed.bShortGI = FALSE; - else if (Value == 1) - pAd->WIFItestbed.bShortGI = TRUE; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceShortGI_Proc::(ForceShortGI=%d)\n", pAd->WIFItestbed.bShortGI)); - - return TRUE; -} - - - -INT Set_ForceGF_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->WIFItestbed.bGreenField = FALSE; - else if (Value == 1) - pAd->WIFItestbed.bGreenField = TRUE; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceGF_Proc::(ForceGF=%d)\n", pAd->WIFItestbed.bGreenField)); - - return TRUE; -} - -INT Set_HtMimoPs_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->CommonCfg.bMIMOPSEnable = FALSE; - else if (Value == 1) - pAd->CommonCfg.bMIMOPSEnable = TRUE; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMimoPs_Proc::(HtMimoPs=%d)\n",pAd->CommonCfg.bMIMOPSEnable)); - - return TRUE; -} -#endif // DOT11_N_SUPPORT // - - -#ifdef DOT11_N_SUPPORT -INT SetCommonHT( - IN PRTMP_ADAPTER pAd) -{ - OID_SET_HT_PHYMODE SetHT; - - if (pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED) - return FALSE; - - SetHT.PhyMode = pAd->CommonCfg.PhyMode; - SetHT.TransmitNo = ((UCHAR)pAd->Antenna.field.TxPath); - SetHT.HtMode = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.HTMODE; - SetHT.ExtOffset = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.EXTCHA; - SetHT.MCS = MCS_AUTO; - SetHT.BW = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.BW; - SetHT.STBC = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.STBC; - SetHT.SHORTGI = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.ShortGI; - - RTMPSetHT(pAd, &SetHT); - - return TRUE; -} -#endif // DOT11_N_SUPPORT // - -INT Set_FixedTxMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR fix_tx_mode = FIXED_TXMODE_HT; - - if (strcmp(arg, "OFDM") == 0 || strcmp(arg, "ofdm") == 0) - { - fix_tx_mode = FIXED_TXMODE_OFDM; - } - else if (strcmp(arg, "CCK") == 0 || strcmp(arg, "cck") == 0) - { - fix_tx_mode = FIXED_TXMODE_CCK; - } - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode = fix_tx_mode; -#endif // CONFIG_STA_SUPPORT // - - DBGPRINT(RT_DEBUG_TRACE, ("Set_FixedTxMode_Proc::(FixedTxMode=%d)\n", fix_tx_mode)); - - return TRUE; -} - -#ifdef CONFIG_APSTA_MIXED_SUPPORT -INT Set_OpMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - -#ifdef RTMP_MAC_PCI - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) -#endif // RTMP_MAC_PCI // - { - DBGPRINT(RT_DEBUG_ERROR, ("Can not switch operate mode on interface up !! \n")); - return FALSE; - } - - if (Value == 0) - pAd->OpMode = OPMODE_STA; - else if (Value == 1) - pAd->OpMode = OPMODE_AP; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_OpMode_Proc::(OpMode=%s)\n", pAd->OpMode == 1 ? "AP Mode" : "STA Mode")); - - return TRUE; -} -#endif // CONFIG_APSTA_MIXED_SUPPORT // - - - -INT Set_LongRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - TX_RTY_CFG_STRUC tx_rty_cfg; - UCHAR LongRetryLimit = (UCHAR)simple_strtol(arg, 0, 10); - - RTMP_IO_READ32(pAdapter, TX_RTY_CFG, &tx_rty_cfg.word); - tx_rty_cfg.field.LongRtyLimit = LongRetryLimit; - RTMP_IO_WRITE32(pAdapter, TX_RTY_CFG, tx_rty_cfg.word); - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_LongRetryLimit_Proc::(tx_rty_cfg=0x%x)\n", tx_rty_cfg.word)); - return TRUE; -} - -INT Set_ShortRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - TX_RTY_CFG_STRUC tx_rty_cfg; - UCHAR ShortRetryLimit = (UCHAR)simple_strtol(arg, 0, 10); - - RTMP_IO_READ32(pAdapter, TX_RTY_CFG, &tx_rty_cfg.word); - tx_rty_cfg.field.ShortRtyLimit = ShortRetryLimit; - RTMP_IO_WRITE32(pAdapter, TX_RTY_CFG, tx_rty_cfg.word); - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_ShortRetryLimit_Proc::(tx_rty_cfg=0x%x)\n", tx_rty_cfg.word)); - return TRUE; -} - - -///////////////////////////////////////////////////////////////////////// -PSTRING RTMPGetRalinkAuthModeStr( - IN NDIS_802_11_AUTHENTICATION_MODE authMode) -{ - switch(authMode) - { - case Ndis802_11AuthModeOpen: - return "OPEN"; - case Ndis802_11AuthModeWPAPSK: - return "WPAPSK"; - case Ndis802_11AuthModeShared: - return "SHARED"; - case Ndis802_11AuthModeWPA: - return "WPA"; - case Ndis802_11AuthModeWPA2: - return "WPA2"; - case Ndis802_11AuthModeWPA2PSK: - return "WPA2PSK"; - case Ndis802_11AuthModeWPA1PSKWPA2PSK: - return "WPAPSKWPA2PSK"; - case Ndis802_11AuthModeWPA1WPA2: - return "WPA1WPA2"; - case Ndis802_11AuthModeWPANone: - return "WPANONE"; - default: - return "UNKNOW"; - } -} - -PSTRING RTMPGetRalinkEncryModeStr( - IN USHORT encryMode) -{ - switch(encryMode) - { - case Ndis802_11WEPDisabled: - return "NONE"; - case Ndis802_11WEPEnabled: - return "WEP"; - case Ndis802_11Encryption2Enabled: - return "TKIP"; - case Ndis802_11Encryption3Enabled: - return "AES"; - case Ndis802_11Encryption4Enabled: - return "TKIPAES"; - default: - return "UNKNOW"; - } -} - -INT RTMPShowCfgValue( - IN PRTMP_ADAPTER pAd, - IN PSTRING pName, - IN PSTRING pBuf) -{ - INT Status = 0; - - for (PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC = RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC; PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name; PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC++) - { - if (!strcmp(pName, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name)) - { - if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->show_proc(pAd, pBuf)) - Status = -EINVAL; - break; //Exit for loop. - } - } - - if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name == NULL) - { - sprintf(pBuf, "\n"); - for (PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC = RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC; PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name; PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC++) - sprintf(pBuf, "%s%s\n", pBuf, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name); - } - - return Status; -} - -INT Show_SSID_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - sprintf(pBuf, "\t%s", pAd->CommonCfg.Ssid); -#endif // CONFIG_STA_SUPPORT // - return 0; -} - -INT Show_WirelessMode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->CommonCfg.PhyMode) - { - case PHY_11BG_MIXED: - sprintf(pBuf, "\t11B/G"); - break; - case PHY_11B: - sprintf(pBuf, "\t11B"); - break; - case PHY_11A: - sprintf(pBuf, "\t11A"); - break; - case PHY_11ABG_MIXED: - sprintf(pBuf, "\t11A/B/G"); - break; - case PHY_11G: - sprintf(pBuf, "\t11G"); - break; -#ifdef DOT11_N_SUPPORT - case PHY_11ABGN_MIXED: - sprintf(pBuf, "\t11A/B/G/N"); - break; - case PHY_11N_2_4G: - sprintf(pBuf, "\t11N only with 2.4G"); - break; - case PHY_11GN_MIXED: - sprintf(pBuf, "\t11G/N"); - break; - case PHY_11AN_MIXED: - sprintf(pBuf, "\t11A/N"); - break; - case PHY_11BGN_MIXED: - sprintf(pBuf, "\t11B/G/N"); - break; - case PHY_11AGN_MIXED: - sprintf(pBuf, "\t11A/G/N"); - break; - case PHY_11N_5G: - sprintf(pBuf, "\t11N only with 5G"); - break; -#endif // DOT11_N_SUPPORT // - default: - sprintf(pBuf, "\tUnknow Value(%d)", pAd->CommonCfg.PhyMode); - break; - } - return 0; -} - - -INT Show_TxBurst_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.bEnableTxBurst ? "TRUE":"FALSE"); - return 0; -} - -INT Show_TxPreamble_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->CommonCfg.TxPreamble) - { - case Rt802_11PreambleShort: - sprintf(pBuf, "\tShort"); - break; - case Rt802_11PreambleLong: - sprintf(pBuf, "\tLong"); - break; - case Rt802_11PreambleAuto: - sprintf(pBuf, "\tAuto"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.TxPreamble); - break; - } - - return 0; -} - -INT Show_TxPower_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%lu", pAd->CommonCfg.TxPowerPercentage); - return 0; -} - -INT Show_Channel_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%d", pAd->CommonCfg.Channel); - return 0; -} - -INT Show_BGProtection_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->CommonCfg.UseBGProtection) - { - case 1: //Always On - sprintf(pBuf, "\tON"); - break; - case 2: //Always OFF - sprintf(pBuf, "\tOFF"); - break; - case 0: //AUTO - sprintf(pBuf, "\tAuto"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.UseBGProtection); - break; - } - return 0; -} - -INT Show_RTSThreshold_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%u", pAd->CommonCfg.RtsThreshold); - return 0; -} - -INT Show_FragThreshold_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%u", pAd->CommonCfg.FragmentThreshold); - return 0; -} - -#ifdef DOT11_N_SUPPORT -INT Show_HtBw_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40) - { - sprintf(pBuf, "\t40 MHz"); - } - else - { - sprintf(pBuf, "\t20 MHz"); - } - return 0; -} - -INT Show_HtMcs_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - sprintf(pBuf, "\t%u", pAd->StaCfg.DesiredTransmitSetting.field.MCS); -#endif // CONFIG_STA_SUPPORT // - return 0; -} - -INT Show_HtGi_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->CommonCfg.RegTransmitSetting.field.ShortGI) - { - case GI_400: - sprintf(pBuf, "\tGI_400"); - break; - case GI_800: - sprintf(pBuf, "\tGI_800"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.ShortGI); - break; - } - return 0; -} - -INT Show_HtOpMode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->CommonCfg.RegTransmitSetting.field.HTMODE) - { - case HTMODE_GF: - sprintf(pBuf, "\tGF"); - break; - case HTMODE_MM: - sprintf(pBuf, "\tMM"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.HTMODE); - break; - } - return 0; -} - -INT Show_HtExtcha_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->CommonCfg.RegTransmitSetting.field.EXTCHA) - { - case EXTCHA_BELOW: - sprintf(pBuf, "\tBelow"); - break; - case EXTCHA_ABOVE: - sprintf(pBuf, "\tAbove"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.EXTCHA); - break; - } - return 0; -} - - -INT Show_HtMpduDensity_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.MpduDensity); - return 0; -} - -INT Show_HtBaWinSize_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.RxBAWinLimit); - return 0; -} - -INT Show_HtRdg_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.bRdg ? "TRUE":"FALSE"); - return 0; -} - -INT Show_HtAmsdu_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AmsduEnable ? "TRUE":"FALSE"); - return 0; -} - -INT Show_HtAutoBa_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AutoBA ? "TRUE":"FALSE"); - return 0; -} -#endif // DOT11_N_SUPPORT // - -INT Show_CountryRegion_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegion); - return 0; -} - -INT Show_CountryRegionABand_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegionForABand); - return 0; -} - -INT Show_CountryCode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.CountryCode); - return 0; -} - -#ifdef AGGREGATION_SUPPORT -INT Show_PktAggregate_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.bAggregationCapable ? "TRUE":"FALSE"); - return 0; -} -#endif // AGGREGATION_SUPPORT // - -#ifdef WMM_SUPPORT -INT Show_WmmCapable_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - sprintf(pBuf, "\t%s", pAd->CommonCfg.bWmmCapable ? "TRUE":"FALSE"); -#endif // CONFIG_STA_SUPPORT // - - return 0; -} -#endif // WMM_SUPPORT // - -INT Show_IEEE80211H_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.bIEEE80211H ? "TRUE":"FALSE"); - return 0; -} - -#ifdef CONFIG_STA_SUPPORT -INT Show_NetworkType_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->StaCfg.BssType) - { - case BSS_ADHOC: - sprintf(pBuf, "\tAdhoc"); - break; - case BSS_INFRA: - sprintf(pBuf, "\tInfra"); - break; - case BSS_ANY: - sprintf(pBuf, "\tAny"); - break; - case BSS_MONITOR: - sprintf(pBuf, "\tMonitor"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%d)", pAd->StaCfg.BssType); - break; - } - return 0; -} - - -#endif // CONFIG_STA_SUPPORT // - -INT Show_AuthMode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - NDIS_802_11_AUTHENTICATION_MODE AuthMode = Ndis802_11AuthModeOpen; - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - AuthMode = pAd->StaCfg.AuthMode; -#endif // CONFIG_STA_SUPPORT // - - if ((AuthMode >= Ndis802_11AuthModeOpen) && - (AuthMode <= Ndis802_11AuthModeWPA1PSKWPA2PSK)) - sprintf(pBuf, "\t%s", RTMPGetRalinkAuthModeStr(AuthMode)); - else - sprintf(pBuf, "\tUnknow Value(%d)", AuthMode); - - return 0; -} - -INT Show_EncrypType_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - NDIS_802_11_WEP_STATUS WepStatus = Ndis802_11WEPDisabled; - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - WepStatus = pAd->StaCfg.WepStatus; -#endif // CONFIG_STA_SUPPORT // - - if ((WepStatus >= Ndis802_11WEPEnabled) && - (WepStatus <= Ndis802_11Encryption4KeyAbsent)) - sprintf(pBuf, "\t%s", RTMPGetRalinkEncryModeStr(WepStatus)); - else - sprintf(pBuf, "\tUnknow Value(%d)", WepStatus); - - return 0; -} - -INT Show_DefaultKeyID_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - UCHAR DefaultKeyId = 0; - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - DefaultKeyId = pAd->StaCfg.DefaultKeyId; -#endif // CONFIG_STA_SUPPORT // - - sprintf(pBuf, "\t%d", DefaultKeyId); - - return 0; -} - -INT Show_WepKey_Proc( - IN PRTMP_ADAPTER pAd, - IN INT KeyIdx, - OUT PSTRING pBuf) -{ - UCHAR Key[16] = {0}, KeyLength = 0; - INT index = BSS0; - - KeyLength = pAd->SharedKey[index][KeyIdx].KeyLen; - NdisMoveMemory(Key, pAd->SharedKey[index][KeyIdx].Key, KeyLength); - - //check key string is ASCII or not - if (RTMPCheckStrPrintAble((PCHAR)Key, KeyLength)) - sprintf(pBuf, "\t%s", Key); - else - { - int idx; - sprintf(pBuf, "\t"); - for (idx = 0; idx < KeyLength; idx++) - sprintf(pBuf+strlen(pBuf), "%02X", Key[idx]); - } - return 0; -} - -INT Show_Key1_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - Show_WepKey_Proc(pAd, 0, pBuf); - return 0; -} - -INT Show_Key2_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - Show_WepKey_Proc(pAd, 1, pBuf); - return 0; -} - -INT Show_Key3_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - Show_WepKey_Proc(pAd, 2, pBuf); - return 0; -} - -INT Show_Key4_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - Show_WepKey_Proc(pAd, 3, pBuf); - return 0; -} - -INT Show_WPAPSK_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - INT idx; - UCHAR PMK[32] = {0}; - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - NdisMoveMemory(PMK, pAd->StaCfg.PMK, 32); -#endif // CONFIG_STA_SUPPORT // - - sprintf(pBuf, "\tPMK = "); - for (idx = 0; idx < 32; idx++) - sprintf(pBuf+strlen(pBuf), "%02X", PMK[idx]); - - return 0; -} diff --git a/drivers/staging/rt3090/common/cmm_mac_pci.c b/drivers/staging/rt3090/common/cmm_mac_pci.c deleted file mode 100644 index 8e1636315a8b..000000000000 --- a/drivers/staging/rt3090/common/cmm_mac_pci.c +++ /dev/null @@ -1,1757 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* -*/ - -#ifdef RTMP_MAC_PCI - -#include "../rt_config.h" - - -/* - ======================================================================== - - Routine Description: - Allocate DMA memory blocks for send, receive - - Arguments: - Adapter Pointer to our adapter - - Return Value: - NDIS_STATUS_SUCCESS - NDIS_STATUS_FAILURE - NDIS_STATUS_RESOURCES - - IRQL = PASSIVE_LEVEL - - Note: - - ======================================================================== -*/ -NDIS_STATUS RTMPAllocTxRxRingMemory( - IN PRTMP_ADAPTER pAd) -{ - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - ULONG RingBasePaHigh; - ULONG RingBasePaLow; - PVOID RingBaseVa; - INT index, num; - PTXD_STRUC pTxD; - PRXD_STRUC pRxD; - ULONG ErrorValue = 0; - PRTMP_TX_RING pTxRing; - PRTMP_DMABUF pDmaBuf; - PNDIS_PACKET pPacket; -// PRTMP_REORDERBUF pReorderBuf; - - DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPAllocTxRxRingMemory\n")); - do - { - // - // Allocate all ring descriptors, include TxD, RxD, MgmtD. - // Although each size is different, to prevent cacheline and alignment - // issue, I intentional set them all to 64 bytes. - // - for (num=0; numTxDescRing[num].AllocSize = TX_RING_SIZE * TXD_SIZE; - RTMP_AllocateTxDescMemory( - pAd, - num, - pAd->TxDescRing[num].AllocSize, - FALSE, - &pAd->TxDescRing[num].AllocVa, - &pAd->TxDescRing[num].AllocPa); - - if (pAd->TxDescRing[num].AllocVa == NULL) - { - ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; - DBGPRINT_ERR(("Failed to allocate a big buffer\n")); - Status = NDIS_STATUS_RESOURCES; - break; - } - - // Zero init this memory block - NdisZeroMemory(pAd->TxDescRing[num].AllocVa, pAd->TxDescRing[num].AllocSize); - - // Save PA & VA for further operation - RingBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->TxDescRing[num].AllocPa); - RingBasePaLow = RTMP_GetPhysicalAddressLow (pAd->TxDescRing[num].AllocPa); - RingBaseVa = pAd->TxDescRing[num].AllocVa; - - // - // Allocate all 1st TXBuf's memory for this TxRing - // - pAd->TxBufSpace[num].AllocSize = TX_RING_SIZE * TX_DMA_1ST_BUFFER_SIZE; - RTMP_AllocateFirstTxBuffer( - pAd, - num, - pAd->TxBufSpace[num].AllocSize, - FALSE, - &pAd->TxBufSpace[num].AllocVa, - &pAd->TxBufSpace[num].AllocPa); - - if (pAd->TxBufSpace[num].AllocVa == NULL) - { - ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; - DBGPRINT_ERR(("Failed to allocate a big buffer\n")); - Status = NDIS_STATUS_RESOURCES; - break; - } - - // Zero init this memory block - NdisZeroMemory(pAd->TxBufSpace[num].AllocVa, pAd->TxBufSpace[num].AllocSize); - - // Save PA & VA for further operation - BufBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->TxBufSpace[num].AllocPa); - BufBasePaLow = RTMP_GetPhysicalAddressLow (pAd->TxBufSpace[num].AllocPa); - BufBaseVa = pAd->TxBufSpace[num].AllocVa; - - // - // Initialize Tx Ring Descriptor and associated buffer memory - // - pTxRing = &pAd->TxRing[num]; - for (index = 0; index < TX_RING_SIZE; index++) - { - pTxRing->Cell[index].pNdisPacket = NULL; - pTxRing->Cell[index].pNextNdisPacket = NULL; - // Init Tx Ring Size, Va, Pa variables - pTxRing->Cell[index].AllocSize = TXD_SIZE; - pTxRing->Cell[index].AllocVa = RingBaseVa; - RTMP_SetPhysicalAddressHigh(pTxRing->Cell[index].AllocPa, RingBasePaHigh); - RTMP_SetPhysicalAddressLow (pTxRing->Cell[index].AllocPa, RingBasePaLow); - - // Setup Tx Buffer size & address. only 802.11 header will store in this space - pDmaBuf = &pTxRing->Cell[index].DmaBuf; - pDmaBuf->AllocSize = TX_DMA_1ST_BUFFER_SIZE; - pDmaBuf->AllocVa = BufBaseVa; - RTMP_SetPhysicalAddressHigh(pDmaBuf->AllocPa, BufBasePaHigh); - RTMP_SetPhysicalAddressLow(pDmaBuf->AllocPa, BufBasePaLow); - - // link the pre-allocated TxBuf to TXD - pTxD = (PTXD_STRUC) pTxRing->Cell[index].AllocVa; - pTxD->SDPtr0 = BufBasePaLow; - // advance to next ring descriptor address - pTxD->DMADONE = 1; -#ifdef RT_BIG_ENDIAN - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); -#endif - RingBasePaLow += TXD_SIZE; - RingBaseVa = (PUCHAR) RingBaseVa + TXD_SIZE; - - // advance to next TxBuf address - BufBasePaLow += TX_DMA_1ST_BUFFER_SIZE; - BufBaseVa = (PUCHAR) BufBaseVa + TX_DMA_1ST_BUFFER_SIZE; - } - DBGPRINT(RT_DEBUG_TRACE, ("TxRing[%d]: total %d entry allocated\n", num, index)); - } - if (Status == NDIS_STATUS_RESOURCES) - break; - - // - // Allocate MGMT ring descriptor's memory except Tx ring which allocated eariler - // - pAd->MgmtDescRing.AllocSize = MGMT_RING_SIZE * TXD_SIZE; - RTMP_AllocateMgmtDescMemory( - pAd, - pAd->MgmtDescRing.AllocSize, - FALSE, - &pAd->MgmtDescRing.AllocVa, - &pAd->MgmtDescRing.AllocPa); - - if (pAd->MgmtDescRing.AllocVa == NULL) - { - ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; - DBGPRINT_ERR(("Failed to allocate a big buffer\n")); - Status = NDIS_STATUS_RESOURCES; - break; - } - - // Zero init this memory block - NdisZeroMemory(pAd->MgmtDescRing.AllocVa, pAd->MgmtDescRing.AllocSize); - - // Save PA & VA for further operation - RingBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->MgmtDescRing.AllocPa); - RingBasePaLow = RTMP_GetPhysicalAddressLow (pAd->MgmtDescRing.AllocPa); - RingBaseVa = pAd->MgmtDescRing.AllocVa; - - // - // Initialize MGMT Ring and associated buffer memory - // - for (index = 0; index < MGMT_RING_SIZE; index++) - { - pAd->MgmtRing.Cell[index].pNdisPacket = NULL; - pAd->MgmtRing.Cell[index].pNextNdisPacket = NULL; - // Init MGMT Ring Size, Va, Pa variables - pAd->MgmtRing.Cell[index].AllocSize = TXD_SIZE; - pAd->MgmtRing.Cell[index].AllocVa = RingBaseVa; - RTMP_SetPhysicalAddressHigh(pAd->MgmtRing.Cell[index].AllocPa, RingBasePaHigh); - RTMP_SetPhysicalAddressLow (pAd->MgmtRing.Cell[index].AllocPa, RingBasePaLow); - - // Offset to next ring descriptor address - RingBasePaLow += TXD_SIZE; - RingBaseVa = (PUCHAR) RingBaseVa + TXD_SIZE; - - // link the pre-allocated TxBuf to TXD - pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[index].AllocVa; - pTxD->DMADONE = 1; - -#ifdef RT_BIG_ENDIAN - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); -#endif - // no pre-allocated buffer required in MgmtRing for scatter-gather case - } - DBGPRINT(RT_DEBUG_TRACE, ("MGMT Ring: total %d entry allocated\n", index)); - - // - // Allocate RX ring descriptor's memory except Tx ring which allocated eariler - // - pAd->RxDescRing.AllocSize = RX_RING_SIZE * RXD_SIZE; - RTMP_AllocateRxDescMemory( - pAd, - pAd->RxDescRing.AllocSize, - FALSE, - &pAd->RxDescRing.AllocVa, - &pAd->RxDescRing.AllocPa); - - if (pAd->RxDescRing.AllocVa == NULL) - { - ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; - DBGPRINT_ERR(("Failed to allocate a big buffer\n")); - Status = NDIS_STATUS_RESOURCES; - break; - } - - // Zero init this memory block - NdisZeroMemory(pAd->RxDescRing.AllocVa, pAd->RxDescRing.AllocSize); - - - DBGPRINT(RT_DEBUG_OFF, - ("RX DESC %p size = %ld\n", pAd->RxDescRing.AllocVa, pAd->RxDescRing.AllocSize)); - - // Save PA & VA for further operation - RingBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->RxDescRing.AllocPa); - RingBasePaLow = RTMP_GetPhysicalAddressLow (pAd->RxDescRing.AllocPa); - RingBaseVa = pAd->RxDescRing.AllocVa; - - // - // Initialize Rx Ring and associated buffer memory - // - for (index = 0; index < RX_RING_SIZE; index++) - { - // Init RX Ring Size, Va, Pa variables - pAd->RxRing.Cell[index].AllocSize = RXD_SIZE; - pAd->RxRing.Cell[index].AllocVa = RingBaseVa; - RTMP_SetPhysicalAddressHigh(pAd->RxRing.Cell[index].AllocPa, RingBasePaHigh); - RTMP_SetPhysicalAddressLow (pAd->RxRing.Cell[index].AllocPa, RingBasePaLow); - - //NdisZeroMemory(RingBaseVa, RXD_SIZE); - - // Offset to next ring descriptor address - RingBasePaLow += RXD_SIZE; - RingBaseVa = (PUCHAR) RingBaseVa + RXD_SIZE; - - // Setup Rx associated Buffer size & allocate share memory - pDmaBuf = &pAd->RxRing.Cell[index].DmaBuf; - pDmaBuf->AllocSize = RX_BUFFER_AGGRESIZE; - pPacket = RTMP_AllocateRxPacketBuffer( - pAd, - pDmaBuf->AllocSize, - FALSE, - &pDmaBuf->AllocVa, - &pDmaBuf->AllocPa); - - /* keep allocated rx packet */ - pAd->RxRing.Cell[index].pNdisPacket = pPacket; - - // Error handling - if (pDmaBuf->AllocVa == NULL) - { - ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; - DBGPRINT_ERR(("Failed to allocate RxRing's 1st buffer\n")); - Status = NDIS_STATUS_RESOURCES; - break; - } - - // Zero init this memory block - NdisZeroMemory(pDmaBuf->AllocVa, pDmaBuf->AllocSize); - - // Write RxD buffer address & allocated buffer length - pRxD = (PRXD_STRUC) pAd->RxRing.Cell[index].AllocVa; - pRxD->SDP0 = RTMP_GetPhysicalAddressLow(pDmaBuf->AllocPa); - pRxD->DDONE = 0; - -#ifdef RT_BIG_ENDIAN - RTMPDescriptorEndianChange((PUCHAR)pRxD, TYPE_RXD); -#endif - } - - DBGPRINT(RT_DEBUG_TRACE, ("Rx Ring: total %d entry allocated\n", index)); - - } while (FALSE); - - - NdisZeroMemory(&pAd->FragFrame, sizeof(FRAGMENT_FRAME)); - pAd->FragFrame.pFragPacket = RTMP_AllocateFragPacketBuffer(pAd, RX_BUFFER_NORMSIZE); - - if (pAd->FragFrame.pFragPacket == NULL) - { - Status = NDIS_STATUS_RESOURCES; - } - - if (Status != NDIS_STATUS_SUCCESS) - { - // Log error inforamtion - NdisWriteErrorLogEntry( - pAd->AdapterHandle, - NDIS_ERROR_CODE_OUT_OF_RESOURCES, - 1, - ErrorValue); - } - - // Following code segment get from original func:NICInitTxRxRingAndBacklogQueue(), now should integrate it to here. - { - DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitTxRxRingAndBacklogQueue\n")); - -/* - // Disable DMA. - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); - GloCfg.word &= 0xff0; - GloCfg.field.EnTXWriteBackDDONE =1; - RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); -*/ - - // Initialize all transmit related software queues - for(index = 0; index < NUM_OF_TX_RING; index++) - { - InitializeQueueHeader(&pAd->TxSwQueue[index]); - // Init TX rings index pointer - pAd->TxRing[index].TxSwFreeIdx = 0; - pAd->TxRing[index].TxCpuIdx = 0; - //RTMP_IO_WRITE32(pAd, (TX_CTX_IDX0 + i * 0x10) , pAd->TxRing[i].TX_CTX_IDX); - } - - // Init RX Ring index pointer - pAd->RxRing.RxSwReadIdx = 0; - pAd->RxRing.RxCpuIdx = RX_RING_SIZE - 1; - //RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RX_CRX_IDX0); - - - // init MGMT ring index pointer - pAd->MgmtRing.TxSwFreeIdx = 0; - pAd->MgmtRing.TxCpuIdx = 0; - - pAd->PrivateInfo.TxRingFullCnt = 0; - - DBGPRINT(RT_DEBUG_TRACE, ("<-- NICInitTxRxRingAndBacklogQueue\n")); - } - - DBGPRINT_S(Status, ("<-- RTMPAllocTxRxRingMemory, Status=%x\n", Status)); - return Status; -} - - - - -/* - ======================================================================== - - Routine Description: - Reset NIC Asics. Call after rest DMA. So reset TX_CTX_IDX to zero. - - Arguments: - Adapter Pointer to our adapter - - Return Value: - None - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - Note: - Reset NIC to initial state AS IS system boot up time. - - ======================================================================== -*/ -VOID RTMPRingCleanUp( - IN PRTMP_ADAPTER pAd, - IN UCHAR RingType) -{ - PTXD_STRUC pTxD; - PRXD_STRUC pRxD; - PQUEUE_ENTRY pEntry; - PNDIS_PACKET pPacket; - int i; - PRTMP_TX_RING pTxRing; - unsigned long IrqFlags; - //UINT32 RxSwReadIdx; - - - DBGPRINT(RT_DEBUG_TRACE,("RTMPRingCleanUp(RingIdx=%d, Pending-NDIS=%ld)\n", RingType, pAd->RalinkCounters.PendingNdisPacketCount)); - switch (RingType) - { - case QID_AC_BK: - case QID_AC_BE: - case QID_AC_VI: - case QID_AC_VO: - /*case QID_HCCA:*/ - - pTxRing = &pAd->TxRing[RingType]; - - RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); - // We have to clean all descriptors in case some error happened with reset - for (i=0; iCell[i].AllocVa; - - pPacket = (PNDIS_PACKET) pTxRing->Cell[i].pNdisPacket; - // release scatter-and-gather NDIS_PACKET - if (pPacket) - { - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - pTxRing->Cell[i].pNdisPacket = NULL; - } - - pPacket = (PNDIS_PACKET) pTxRing->Cell[i].pNextNdisPacket; - // release scatter-and-gather NDIS_PACKET - if (pPacket) - { - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - pTxRing->Cell[i].pNextNdisPacket = NULL; - } - } - - RTMP_IO_READ32(pAd, TX_DTX_IDX0 + RingType * 0x10, &pTxRing->TxDmaIdx); - pTxRing->TxSwFreeIdx = pTxRing->TxDmaIdx; - pTxRing->TxCpuIdx = pTxRing->TxDmaIdx; - RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + RingType * 0x10, pTxRing->TxCpuIdx); - - RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); - - RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); - while (pAd->TxSwQueue[RingType].Head != NULL) - { - pEntry = RemoveHeadQueue(&pAd->TxSwQueue[RingType]); - pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - DBGPRINT(RT_DEBUG_TRACE,("Release 1 NDIS packet from s/w backlog queue\n")); - } - RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); - break; - - case QID_MGMT: - // We have to clean all descriptors in case some error happened with reset - NdisAcquireSpinLock(&pAd->MgmtRingLock); - - for (i=0; iMgmtRing.Cell[i].AllocVa; - - pPacket = (PNDIS_PACKET) pAd->MgmtRing.Cell[i].pNdisPacket; - // rlease scatter-and-gather NDIS_PACKET - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - } - pAd->MgmtRing.Cell[i].pNdisPacket = NULL; - - pPacket = (PNDIS_PACKET) pAd->MgmtRing.Cell[i].pNextNdisPacket; - // release scatter-and-gather NDIS_PACKET - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - } - pAd->MgmtRing.Cell[i].pNextNdisPacket = NULL; - - } - - RTMP_IO_READ32(pAd, TX_MGMTDTX_IDX, &pAd->MgmtRing.TxDmaIdx); - pAd->MgmtRing.TxSwFreeIdx = pAd->MgmtRing.TxDmaIdx; - pAd->MgmtRing.TxCpuIdx = pAd->MgmtRing.TxDmaIdx; - RTMP_IO_WRITE32(pAd, TX_MGMTCTX_IDX, pAd->MgmtRing.TxCpuIdx); - - NdisReleaseSpinLock(&pAd->MgmtRingLock); - pAd->RalinkCounters.MgmtRingFullCount = 0; - break; - - case QID_RX: - // We have to clean all descriptors in case some error happened with reset - NdisAcquireSpinLock(&pAd->RxRingLock); - - for (i=0; iRxRing.Cell[i].AllocVa; - pRxD->DDONE = 0 ; - } - - RTMP_IO_READ32(pAd, RX_DRX_IDX, &pAd->RxRing.RxDmaIdx); - pAd->RxRing.RxSwReadIdx = pAd->RxRing.RxDmaIdx; - pAd->RxRing.RxCpuIdx = ((pAd->RxRing.RxDmaIdx == 0) ? (RX_RING_SIZE-1) : (pAd->RxRing.RxDmaIdx-1)); - RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RxCpuIdx); - - NdisReleaseSpinLock(&pAd->RxRingLock); - break; - - default: - break; - } -} - - -VOID RTMPFreeTxRxRingMemory( - IN PRTMP_ADAPTER pAd) -{ - int index, num , j; - PRTMP_TX_RING pTxRing; - PTXD_STRUC pTxD; - PNDIS_PACKET pPacket; - unsigned int IrqFlags; - - //POS_COOKIE pObj =(POS_COOKIE) pAd->OS_Cookie; - - DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPFreeTxRxRingMemory\n")); - - // Free TxSwQueue Packet - for (index=0; index irq_lock, IrqFlags); - pQueue = &pAd->TxSwQueue[index]; - while (pQueue->Head) - { - pEntry = RemoveHeadQueue(pQueue); - pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - } - RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); - } - - // Free Tx Ring Packet - for (index=0;index< NUM_OF_TX_RING;index++) - { - pTxRing = &pAd->TxRing[index]; - - for (j=0; j< TX_RING_SIZE; j++) - { - pTxD = (PTXD_STRUC) (pTxRing->Cell[j].AllocVa); - pPacket = pTxRing->Cell[j].pNdisPacket; - - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - //Always assign pNdisPacket as NULL after clear - pTxRing->Cell[j].pNdisPacket = NULL; - - pPacket = pTxRing->Cell[j].pNextNdisPacket; - - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - //Always assign pNextNdisPacket as NULL after clear - pTxRing->Cell[pTxRing->TxSwFreeIdx].pNextNdisPacket = NULL; - - } - } - - for (index = RX_RING_SIZE - 1 ; index >= 0; index--) - { - if ((pAd->RxRing.Cell[index].DmaBuf.AllocVa) && (pAd->RxRing.Cell[index].pNdisPacket)) - { - PCI_UNMAP_SINGLE(pAd, pAd->RxRing.Cell[index].DmaBuf.AllocPa, pAd->RxRing.Cell[index].DmaBuf.AllocSize, PCI_DMA_FROMDEVICE); - RELEASE_NDIS_PACKET(pAd, pAd->RxRing.Cell[index].pNdisPacket, NDIS_STATUS_SUCCESS); - } - } - NdisZeroMemory(pAd->RxRing.Cell, RX_RING_SIZE * sizeof(RTMP_DMACB)); - - if (pAd->RxDescRing.AllocVa) - { - RTMP_FreeDescMemory(pAd, pAd->RxDescRing.AllocSize, pAd->RxDescRing.AllocVa, pAd->RxDescRing.AllocPa); - } - NdisZeroMemory(&pAd->RxDescRing, sizeof(RTMP_DMABUF)); - - if (pAd->MgmtDescRing.AllocVa) - { - RTMP_FreeDescMemory(pAd, pAd->MgmtDescRing.AllocSize, pAd->MgmtDescRing.AllocVa, pAd->MgmtDescRing.AllocPa); - } - NdisZeroMemory(&pAd->MgmtDescRing, sizeof(RTMP_DMABUF)); - - for (num = 0; num < NUM_OF_TX_RING; num++) - { - if (pAd->TxBufSpace[num].AllocVa) - { - RTMP_FreeFirstTxBuffer(pAd, pAd->TxBufSpace[num].AllocSize, FALSE, pAd->TxBufSpace[num].AllocVa, pAd->TxBufSpace[num].AllocPa); - } - NdisZeroMemory(&pAd->TxBufSpace[num], sizeof(RTMP_DMABUF)); - - if (pAd->TxDescRing[num].AllocVa) - { - RTMP_FreeDescMemory(pAd, pAd->TxDescRing[num].AllocSize, pAd->TxDescRing[num].AllocVa, pAd->TxDescRing[num].AllocPa); - } - NdisZeroMemory(&pAd->TxDescRing[num], sizeof(RTMP_DMABUF)); - } - - if (pAd->FragFrame.pFragPacket) - RELEASE_NDIS_PACKET(pAd, pAd->FragFrame.pFragPacket, NDIS_STATUS_SUCCESS); - - DBGPRINT(RT_DEBUG_TRACE, ("<-- RTMPFreeTxRxRingMemory\n")); -} - - -/*************************************************************************** - * - * register related procedures. - * - **************************************************************************/ -/* -======================================================================== -Routine Description: - Disable DMA. - -Arguments: - *pAd the raxx interface data pointer - -Return Value: - None - -Note: -======================================================================== -*/ -VOID RT28XXDMADisable( - IN RTMP_ADAPTER *pAd) -{ - WPDMA_GLO_CFG_STRUC GloCfg; - - - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); - GloCfg.word &= 0xff0; - GloCfg.field.EnTXWriteBackDDONE =1; - RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); -} - - -/* -======================================================================== -Routine Description: - Enable DMA. - -Arguments: - *pAd the raxx interface data pointer - -Return Value: - None - -Note: -======================================================================== -*/ -VOID RT28XXDMAEnable( - IN RTMP_ADAPTER *pAd) -{ - WPDMA_GLO_CFG_STRUC GloCfg; - int i = 0; - - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x4); - do - { - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); - if ((GloCfg.field.TxDMABusy == 0) && (GloCfg.field.RxDMABusy == 0)) - break; - - DBGPRINT(RT_DEBUG_TRACE, ("==> DMABusy\n")); - RTMPusecDelay(1000); - i++; - }while ( i <200); - - RTMPusecDelay(50); - - GloCfg.field.EnTXWriteBackDDONE = 1; - GloCfg.field.WPDMABurstSIZE = 2; - GloCfg.field.EnableRxDMA = 1; - GloCfg.field.EnableTxDMA = 1; - - DBGPRINT(RT_DEBUG_TRACE, ("<== WRITE DMA offset 0x208 = 0x%x\n", GloCfg.word)); - RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); - -} - - -BOOLEAN AsicCheckCommanOk( - IN PRTMP_ADAPTER pAd, - IN UCHAR Command) -{ - UINT32 CmdStatus = 0, CID = 0, i; - UINT32 ThisCIDMask = 0; - - i = 0; - do - { - RTMP_IO_READ32(pAd, H2M_MAILBOX_CID, &CID); - // Find where the command is. Because this is randomly specified by firmware. - if ((CID & CID0MASK) == Command) - { - ThisCIDMask = CID0MASK; - break; - } - else if ((((CID & CID1MASK)>>8) & 0xff) == Command) - { - ThisCIDMask = CID1MASK; - break; - } - else if ((((CID & CID2MASK)>>16) & 0xff) == Command) - { - ThisCIDMask = CID2MASK; - break; - } - else if ((((CID & CID3MASK)>>24) & 0xff) == Command) - { - ThisCIDMask = CID3MASK; - break; - } - - RTMPusecDelay(100); - i++; - }while (i < 200); - - // Get CommandStatus Value - RTMP_IO_READ32(pAd, H2M_MAILBOX_STATUS, &CmdStatus); - - // This command's status is at the same position as command. So AND command position's bitmask to read status. - if (i < 200) - { - // If Status is 1, the comamnd is success. - if (((CmdStatus & ThisCIDMask) == 0x1) || ((CmdStatus & ThisCIDMask) == 0x100) - || ((CmdStatus & ThisCIDMask) == 0x10000) || ((CmdStatus & ThisCIDMask) == 0x1000000)) - { - DBGPRINT(RT_DEBUG_TRACE, ("--> AsicCheckCommanOk CID = 0x%x, CmdStatus= 0x%x \n", CID, CmdStatus)); - RTMP_IO_WRITE32(pAd, H2M_MAILBOX_STATUS, 0xffffffff); - RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CID, 0xffffffff); - return TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("--> AsicCheckCommanFail1 CID = 0x%x, CmdStatus= 0x%x \n", CID, CmdStatus)); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("--> AsicCheckCommanFail2 Timeout Command = %d, CmdStatus= 0x%x \n", Command, CmdStatus)); - } - // Clear Command and Status. - RTMP_IO_WRITE32(pAd, H2M_MAILBOX_STATUS, 0xffffffff); - RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CID, 0xffffffff); - - return FALSE; -} - - -/* -======================================================================== -Routine Description: - Write Beacon buffer to Asic. - -Arguments: - *pAd the raxx interface data pointer - -Return Value: - None - -Note: -======================================================================== -*/ -VOID RT28xx_UpdateBeaconToAsic( - IN RTMP_ADAPTER *pAd, - IN INT apidx, - IN ULONG FrameLen, - IN ULONG UpdatePos) -{ - ULONG CapInfoPos = 0; - UCHAR *ptr, *ptr_update, *ptr_capinfo; - UINT i; - BOOLEAN bBcnReq = FALSE; - UCHAR bcn_idx = 0; - - - { - DBGPRINT(RT_DEBUG_ERROR, ("%s() : No valid Interface be found.\n", __FUNCTION__)); - return; - } - - //if ((pAd->WdsTab.Mode == WDS_BRIDGE_MODE) - // || ((pAd->ApCfg.MBSSID[apidx].MSSIDDev == NULL) - // || !(pAd->ApCfg.MBSSID[apidx].MSSIDDev->flags & IFF_UP)) - // ) - if (bBcnReq == FALSE) - { - /* when the ra interface is down, do not send its beacon frame */ - /* clear all zero */ - for(i=0; iBeaconOffset[bcn_idx] + i, 0x00); - } - else - { - ptr = (PUCHAR)&pAd->BeaconTxWI; -#ifdef RT_BIG_ENDIAN - RTMPWIEndianChange(ptr, TYPE_TXWI); -#endif - for (i=0; iBeaconOffset[bcn_idx] + i, longptr); - ptr += 4; - } - - // Update CapabilityInfo in Beacon - for (i = CapInfoPos; i < (CapInfoPos+2); i++) - { - RTMP_IO_WRITE8(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, *ptr_capinfo); - ptr_capinfo ++; - } - - if (FrameLen > UpdatePos) - { - for (i= UpdatePos; i< (FrameLen); i++) - { - RTMP_IO_WRITE8(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, *ptr_update); - ptr_update ++; - } - } - - } - -} - - -#ifdef CONFIG_STA_SUPPORT -VOID RT28xxPciStaAsicForceWakeup( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bFromTx) -{ - AUTO_WAKEUP_STRUC AutoWakeupCfg; - - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - return; - - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WAKEUP_NOW)) - { - DBGPRINT(RT_DEBUG_TRACE, ("waking up now!\n")); - return; - } - - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_WAKEUP_NOW); - - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_GO_TO_SLEEP_NOW); - - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) - &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - { - // Support PCIe Advance Power Save - if (bFromTx == TRUE - &&(pAd->Mlme.bPsPollTimerRunning == TRUE)) - { - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); - RTMPusecDelay(3000); - DBGPRINT(RT_DEBUG_TRACE, ("=======AsicForceWakeup===bFromTx\n")); - } - - AutoWakeupCfg.word = 0; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - - if (RT28xxPciAsicRadioOn(pAd, DOT11POWERSAVE)) - { -#ifdef PCIE_PS_SUPPORT - // add by johnli, RF power sequence setup, load RF normal operation-mode setup - if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) - { - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; - - if (pChipOps->AsicReverseRfFromSleepMode) - pChipOps->AsicReverseRfFromSleepMode(pAd); - } - else -#endif // PCIE_PS_SUPPORT // - { - // end johnli - // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. - if (INFRA_ON(pAd) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) - && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - // Must using 40MHz. - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - } - else - { - // Must using 20MHz. - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - } - } - } -#ifdef PCIE_PS_SUPPORT - // 3090 MCU Wakeup command needs more time to be stable. - // Before stable, don't issue other MCU command to prevent from firmware error. - if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("<==RT28xxPciStaAsicForceWakeup::Release the MCU Lock(3090)\n")); - RTMP_SEM_LOCK(&pAd->McuCmdLock); - pAd->brt30xxBanMcuCmd = FALSE; - RTMP_SEM_UNLOCK(&pAd->McuCmdLock); - } -#endif // PCIE_PS_SUPPORT // - } - else - { - // PCI, 2860-PCIe - DBGPRINT(RT_DEBUG_TRACE, ("<==RT28xxPciStaAsicForceWakeup::Original PCI Power Saving\n")); - AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02); - AutoWakeupCfg.word = 0; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - } - - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_WAKEUP_NOW); - DBGPRINT(RT_DEBUG_TRACE, ("<=======RT28xxPciStaAsicForceWakeup\n")); -} - - -VOID RT28xxPciStaAsicSleepThenAutoWakeup( - IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp) -{ - BOOLEAN brc; - - if (pAd->StaCfg.bRadio == FALSE) - { - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); - return; - } - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) - &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - { - ULONG Now = 0; - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WAKEUP_NOW)) - { - DBGPRINT(RT_DEBUG_TRACE, ("waking up now!\n")); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); - return; - } - - NdisGetSystemUpTime(&Now); - // If last send NULL fram time is too close to this receiving beacon (within 8ms), don't go to sleep for this DTM. - // Because Some AP can't queuing outgoing frames immediately. - if (((pAd->Mlme.LastSendNULLpsmTime + 8) >= Now) && (pAd->Mlme.LastSendNULLpsmTime <= Now)) - { - DBGPRINT(RT_DEBUG_TRACE, ("Now = %lu, LastSendNULLpsmTime=%lu : RxCountSinceLastNULL = %lu. \n", Now, pAd->Mlme.LastSendNULLpsmTime, pAd->RalinkCounters.RxCountSinceLastNULL)); - return; - } - else if ((pAd->RalinkCounters.RxCountSinceLastNULL > 0) && ((pAd->Mlme.LastSendNULLpsmTime + pAd->CommonCfg.BeaconPeriod) >= Now)) - { - DBGPRINT(RT_DEBUG_TRACE, ("Now = %lu, LastSendNULLpsmTime=%lu: RxCountSinceLastNULL = %lu > 0 \n", Now, pAd->Mlme.LastSendNULLpsmTime, pAd->RalinkCounters.RxCountSinceLastNULL)); - return; - } - - brc = RT28xxPciAsicRadioOff(pAd, DOT11POWERSAVE, TbttNumToNextWakeUp); - if (brc==TRUE) - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_DOZE); - } - else - { - AUTO_WAKEUP_STRUC AutoWakeupCfg; - // we have decided to SLEEP, so at least do it for a BEACON period. - if (TbttNumToNextWakeUp == 0) - TbttNumToNextWakeUp = 1; - - //RTMP_IO_WRITE32(pAd, INT_MASK_CSR, AutoWakeupInt); - - AutoWakeupCfg.word = 0; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - AutoWakeupCfg.field.NumofSleepingTbtt = TbttNumToNextWakeUp - 1; - AutoWakeupCfg.field.EnableAutoWakeup = 1; - AutoWakeupCfg.field.AutoLeadTime = 5; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x00); // send POWER-SAVE command to MCU. Timeout 40us. - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_DOZE); - DBGPRINT(RT_DEBUG_TRACE, ("<-- %s, TbttNumToNextWakeUp=%d \n", __FUNCTION__, TbttNumToNextWakeUp)); - } - -} - - -VOID PsPollWakeExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; - unsigned long flags; - - DBGPRINT(RT_DEBUG_TRACE,("-->PsPollWakeExec \n")); - - RTMP_INT_LOCK(&pAd->irq_lock, flags); - if (pAd->Mlme.bPsPollTimerRunning) - { - RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); - } - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); -#ifdef PCIE_PS_SUPPORT - // For rt30xx power solution 3, Use software timer to wake up in psm. So call - // AsicForceWakeup here instead of handling twakeup interrupt. - if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - DBGPRINT(RT_DEBUG_TRACE,("<--PsPollWakeExec::3090 calls AsicForceWakeup(pAd, DOT11POWERSAVE) in advance \n")); - AsicForceWakeup(pAd, DOT11POWERSAVE); - } - -#endif // PCIE_PS_SUPPORT // -} - -VOID RadioOnExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; - WPDMA_GLO_CFG_STRUC DmaCfg; - BOOLEAN Cancelled; - - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - DBGPRINT(RT_DEBUG_TRACE,("-->RadioOnExec() return on fOP_STATUS_DOZE == TRUE; \n")); -//KH Debug: Add the compile flag "RT2860 and condition -#ifdef RTMP_PCI_SUPPORT - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) - &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); -#endif // RTMP_PCI_SUPPORT // - return; - } - - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - { - DBGPRINT(RT_DEBUG_TRACE,("-->RadioOnExec() return on SCAN_IN_PROGRESS; \n")); - - -#ifdef RTMP_PCI_SUPPORT -if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) - &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); -#endif // RTMP_PCI_SUPPORT // - return; - } -//KH Debug: need to check. I add the compile flag "CONFIG_STA_SUPPORT" to enclose the following codes. -#ifdef RTMP_PCI_SUPPORT -if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) - &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - { - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - } -#endif // RTMP_PCI_SUPPORT // - if (pAd->StaCfg.bRadio == TRUE) - { - pAd->bPCIclkOff = FALSE; - RTMPRingCleanUp(pAd, QID_AC_BK); - RTMPRingCleanUp(pAd, QID_AC_BE); - RTMPRingCleanUp(pAd, QID_AC_VI); - RTMPRingCleanUp(pAd, QID_AC_VO); - /*RTMPRingCleanUp(pAd, QID_HCCA);*/ - RTMPRingCleanUp(pAd, QID_MGMT); - RTMPRingCleanUp(pAd, QID_RX); - - // 2. Send wake up command. - AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x02); - // 2-1. wait command ok. - AsicCheckCommanOk(pAd, PowerWakeCID); - - // When PCI clock is off, don't want to service interrupt. So when back to clock on, enable interrupt. - //RTMP_IO_WRITE32(pAd, INT_MASK_CSR, (DELAYINTMASK|RxINT)); - RTMP_ASIC_INTERRUPT_ENABLE(pAd); - - // 3. Enable Tx DMA. - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &DmaCfg.word); - DmaCfg.field.EnableTxDMA = 1; - RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, DmaCfg.word); - - // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. - if (INFRA_ON(pAd) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) - && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - // Must using 40MHz. - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - } - else - { - // Must using 20MHz. - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - } -//KH Debug:The following codes should be enclosed by RT3090 compile flag - if (pChipOps->AsicReverseRfFromSleepMode) - pChipOps->AsicReverseRfFromSleepMode(pAd); -#ifdef PCIE_PS_SUPPORT -#ifdef CONFIG_STA_SUPPORT -// 3090 MCU Wakeup command needs more time to be stable. -// Before stable, don't issue other MCU command to prevent from firmware error. -if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - RTMP_SEM_LOCK(&pAd->McuCmdLock); - pAd->brt30xxBanMcuCmd = FALSE; - RTMP_SEM_UNLOCK(&pAd->McuCmdLock); - } -#endif // CONFIG_STA_SUPPORT // -#endif // PCIE_PS_SUPPORT // - // Clear Radio off flag - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - - // Set LED - RTMPSetLED(pAd, LED_RADIO_ON); - - if (pAd->StaCfg.Psm == PWR_ACTIVE) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, pAd->StaCfg.BBPR3); - } - } - else - { - RT28xxPciAsicRadioOff(pAd, GUIRADIO_OFF, 0); - } -} -#endif // CONFIG_STA_SUPPORT // - - -/* - ========================================================================== - Description: - This routine sends command to firmware and turn our chip to wake up mode from power save mode. - Both RadioOn and .11 power save function needs to call this routine. - Input: - Level = GUIRADIO_OFF : call this function is from Radio Off to Radio On. Need to restore PCI host value. - Level = other value : normal wake up function. - - ========================================================================== - */ -BOOLEAN RT28xxPciAsicRadioOn( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level) -{ - //WPDMA_GLO_CFG_STRUC DmaCfg; -#ifdef CONFIG_STA_SUPPORT - BOOLEAN Cancelled; -#endif // CONFIG_STA_SUPPORT // - //UINT32 MACValue; - - if (pAd->OpMode == OPMODE_AP && Level==DOT11POWERSAVE) - return FALSE; - -#ifdef CONFIG_STA_SUPPORT - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - { - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - } - if ((pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)&& - ((Level == GUIRADIO_OFF) || (Level == GUI_IDLE_POWER_SAVE)) - ||(RTMP_TEST_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND))) - { - // Some chips don't need to delay 6ms, so copy RTMPPCIePowerLinkCtrlRestore - // return condition here. - /* - if (((pAd->MACVersion&0xffff0000) != 0x28600000) - && ((pAd->DeviceID == NIC2860_PCIe_DEVICE_ID) - ||(pAd->DeviceID == NIC2790_PCIe_DEVICE_ID))) - */ - { - DBGPRINT(RT_DEBUG_TRACE, ("RT28xxPciAsicRadioOn ()\n")); - // 1. Set PCI Link Control in Configuration Space. - RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); - RTMPusecDelay(6000); - } - } - } - -#ifdef PCIE_PS_SUPPORT -if (!(((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)))) -#endif // PCIE_PS_SUPPORT // - { - pAd->bPCIclkOff = FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("PSM :309xbPCIclkOff == %d\n", pAd->bPCIclkOff)); - - } -#endif // CONFIG_STA_SUPPORT // - // 2. Send wake up command. - AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x02); - pAd->bPCIclkOff = FALSE; - // 2-1. wait command ok. - AsicCheckCommanOk(pAd, PowerWakeCID); - RTMP_ASIC_INTERRUPT_ENABLE(pAd); - - - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); - if (Level == GUI_IDLE_POWER_SAVE) - { -#ifdef PCIE_PS_SUPPORT - - // add by johnli, RF power sequence setup, load RF normal operation-mode setup - if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) - { - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; - - if (pChipOps->AsicReverseRfFromSleepMode) - pChipOps->AsicReverseRfFromSleepMode(pAd); -#ifdef CONFIG_STA_SUPPORT - // 3090 MCU Wakeup command needs more time to be stable. - // Before stable, don't issue other MCU command to prevent from firmware error. - if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - RTMP_SEM_LOCK(&pAd->McuCmdLock); - pAd->brt30xxBanMcuCmd = FALSE; - RTMP_SEM_UNLOCK(&pAd->McuCmdLock); - } -#endif // CONFIG_STA_SUPPORT // - } - else - // end johnli -#endif // PCIE_PS_SUPPORT // - { - // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (INFRA_ON(pAd) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) - && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - // Must using 40MHz. - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - } - else - { - // Must using 20MHz. - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - } - } -#endif // CONFIG_STA_SUPPORT // - } - } - return TRUE; - -} - - -/* - ========================================================================== - Description: - This routine sends command to firmware and turn our chip to power save mode. - Both RadioOff and .11 power save function needs to call this routine. - Input: - Level = GUIRADIO_OFF : GUI Radio Off mode - Level = DOT11POWERSAVE : 802.11 power save mode - Level = RTMP_HALT : When Disable device. - - ========================================================================== - */ -BOOLEAN RT28xxPciAsicRadioOff( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level, - IN USHORT TbttNumToNextWakeUp) -{ -#ifdef CONFIG_STA_SUPPORT - WPDMA_GLO_CFG_STRUC DmaCfg; - UCHAR i, tempBBP_R3 = 0; -#endif // CONFIG_STA_SUPPORT // - BOOLEAN brc = FALSE, Cancelled; - UINT32 TbTTTime = 0; - UINT32 PsPollTime = 0/*, MACValue*/; - ULONG BeaconPeriodTime; - UINT32 RxDmaIdx, RxCpuIdx; - DBGPRINT(RT_DEBUG_TRACE, ("AsicRadioOff ===> Lv= %d, TxCpuIdx = %d, TxDmaIdx = %d. RxCpuIdx = %d, RxDmaIdx = %d.\n", Level,pAd->TxRing[0].TxCpuIdx, pAd->TxRing[0].TxDmaIdx, pAd->RxRing.RxCpuIdx, pAd->RxRing.RxDmaIdx)); - - if (pAd->OpMode == OPMODE_AP && Level==DOT11POWERSAVE) - return FALSE; - - // Check Rx DMA busy status, if more than half is occupied, give up this radio off. - RTMP_IO_READ32(pAd, RX_DRX_IDX , &RxDmaIdx); - RTMP_IO_READ32(pAd, RX_CRX_IDX , &RxCpuIdx); - if ((RxDmaIdx > RxCpuIdx) && ((RxDmaIdx - RxCpuIdx) > RX_RING_SIZE/3)) - { - DBGPRINT(RT_DEBUG_TRACE, ("AsicRadioOff ===> return1. RxDmaIdx = %d , RxCpuIdx = %d. \n", RxDmaIdx, RxCpuIdx)); - return FALSE; - } - else if ((RxCpuIdx >= RxDmaIdx) && ((RxCpuIdx - RxDmaIdx) < RX_RING_SIZE/3)) - { - DBGPRINT(RT_DEBUG_TRACE, ("AsicRadioOff ===> return2. RxCpuIdx = %d. RxDmaIdx = %d , \n", RxCpuIdx, RxDmaIdx)); - return FALSE; - } - - // Once go into this function, disable tx because don't want too many packets in queue to prevent HW stops. - //pAd->bPCIclkOffDisableTx = TRUE; - RTMP_SET_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) - && pAd->OpMode == OPMODE_STA -#ifdef CONFIG_STA_SUPPORT - &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE -#endif // CONFIG_STA_SUPPORT // - ) - { - - RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - - if (Level == DOT11POWERSAVE) - { - RTMP_IO_READ32(pAd, TBTT_TIMER, &TbTTTime); - TbTTTime &= 0x1ffff; - // 00. check if need to do sleep in this DTIM period. If next beacon will arrive within 30ms , ...doesn't necessarily sleep. - // TbTTTime uint = 64us, LEAD_TIME unit = 1024us, PsPollTime unit = 1ms - if (((64*TbTTTime) <((LEAD_TIME*1024) + 40000)) && (TbttNumToNextWakeUp == 0)) - { - DBGPRINT(RT_DEBUG_TRACE, ("TbTTTime = 0x%x , give up this sleep. \n", TbTTTime)); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); - //pAd->bPCIclkOffDisableTx = FALSE; - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); - return FALSE; - } - else - { - PsPollTime = (64*TbTTTime- LEAD_TIME*1024)/1000; -#ifdef PCIE_PS_SUPPORT -#ifdef CONFIG_STA_SUPPORT - if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - PsPollTime -= 5; - } - else -#endif // CONFIG_STA_SUPPORT // -#endif // PCIE_PS_SUPPORT // - PsPollTime -= 3; - - BeaconPeriodTime = pAd->CommonCfg.BeaconPeriod*102/100; - if (TbttNumToNextWakeUp > 0) - PsPollTime += ((TbttNumToNextWakeUp -1) * BeaconPeriodTime); - - pAd->Mlme.bPsPollTimerRunning = TRUE; - RTMPSetTimer(&pAd->Mlme.PsPollTimer, PsPollTime); - } - } - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("RT28xxPciAsicRadioOff::Level!=DOT11POWERSAVE \n")); - } - - pAd->bPCIclkOffDisableTx = FALSE; - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); - -#ifdef CONFIG_STA_SUPPORT - // Set to 1R. - if (pAd->Antenna.field.RxPath > 1 && pAd->OpMode == OPMODE_STA) - { - tempBBP_R3 = (pAd->StaCfg.BBPR3 & 0xE7); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, tempBBP_R3); - } -#endif // CONFIG_STA_SUPPORT // - - // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. - if ((INFRA_ON(pAd) || pAd->OpMode == OPMODE_AP) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) - && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - // Must using 40MHz. - AsicTurnOffRFClk(pAd, pAd->CommonCfg.CentralChannel); - } - else - { - // Must using 20MHz. - AsicTurnOffRFClk(pAd, pAd->CommonCfg.Channel); - } - - if (Level != RTMP_HALT) - { - // Change Interrupt bitmask. - // When PCI clock is off, don't want to service interrupt. - RTMP_IO_WRITE32(pAd, INT_MASK_CSR, AutoWakeupInt); - } - else - { - RTMP_ASIC_INTERRUPT_DISABLE(pAd); - } - - - RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RxCpuIdx); - // 2. Send Sleep command - RTMP_IO_WRITE32(pAd, H2M_MAILBOX_STATUS, 0xffffffff); - RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CID, 0xffffffff); - // send POWER-SAVE command to MCU. high-byte = 1 save power as much as possible. high byte = 0 save less power - AsicSendCommandToMcu(pAd, 0x30, PowerSafeCID, 0xff, 0x1); - // 2-1. Wait command success - // Status = 1 : success, Status = 2, already sleep, Status = 3, Maybe MAC is busy so can't finish this task. - brc = AsicCheckCommanOk(pAd, PowerSafeCID); - - // 3. After 0x30 command is ok, send radio off command. lowbyte = 0 for power safe. - // If 0x30 command is not ok this time, we can ignore 0x35 command. It will make sure not cause firmware'r problem. - if ((Level == DOT11POWERSAVE) && (brc == TRUE)) - { - AsicSendCommandToMcu(pAd, 0x35, PowerRadioOffCID, 0, 0x00); // lowbyte = 0 means to do power safe, NOT turn off radio. - // 3-1. Wait command success - AsicCheckCommanOk(pAd, PowerRadioOffCID); - } - else if (brc == TRUE) - { - AsicSendCommandToMcu(pAd, 0x35, PowerRadioOffCID, 1, 0x00); // lowbyte = 0 means to do power safe, NOT turn off radio. - // 3-1. Wait command success - AsicCheckCommanOk(pAd, PowerRadioOffCID); - } - -#ifdef CONFIG_STA_SUPPORT - // 1. Wait DMA not busy - i = 0; - do - { - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &DmaCfg.word); - if ((DmaCfg.field.RxDMABusy == 0) && (DmaCfg.field.TxDMABusy == 0)) - break; - RTMPusecDelay(20); - i++; - }while(i < 50); - - /* - if (i >= 50) - { - pAd->CheckDmaBusyCount++; - DBGPRINT(RT_DEBUG_TRACE, ("DMA Rx keeps busy. return on AsicRadioOff () CheckDmaBusyCount = %d \n", pAd->CheckDmaBusyCount)); - } - else - { - pAd->CheckDmaBusyCount = 0; - } - */ -#endif // CONFIG_STA_SUPPORT // -//KH Debug:My original codes have the follwoing codes, but currecnt codes do not have it. -// Disable for stability. If PCIE Link Control is modified for advance power save, re-covery this code segment. -RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, 0x1280); -//OPSTATUS_SET_FLAG(pAd, fOP_STATUS_CLKSELECT_40MHZ); - -#ifdef PCIE_PS_SUPPORT -#ifdef CONFIG_STA_SUPPORT -if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("RT28xxPciAsicRadioOff::3090 return to skip the following TbttNumToNextWakeUp setting for 279x\n")); - pAd->bPCIclkOff = TRUE; - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); - // For this case, doesn't need to below actions, so return here. - return brc; - } -#endif // CONFIG_STA_SUPPORT // -#endif // PCIE_PS_SUPPORT // - if (Level == DOT11POWERSAVE) - { - AUTO_WAKEUP_STRUC AutoWakeupCfg; - //RTMPSetTimer(&pAd->Mlme.PsPollTimer, 90); - - // we have decided to SLEEP, so at least do it for a BEACON period. - if (TbttNumToNextWakeUp == 0) - TbttNumToNextWakeUp = 1; - - AutoWakeupCfg.word = 0; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - - // 1. Set auto wake up timer. - AutoWakeupCfg.field.NumofSleepingTbtt = TbttNumToNextWakeUp - 1; - AutoWakeupCfg.field.EnableAutoWakeup = 1; - AutoWakeupCfg.field.AutoLeadTime = LEAD_TIME; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - } - -#ifdef CONFIG_STA_SUPPORT - // 4-1. If it's to disable our device. Need to restore PCI Configuration Space to its original value. - if (Level == RTMP_HALT && pAd->OpMode == OPMODE_STA) - { - if ((brc == TRUE) && (i < 50)) - RTMPPCIeLinkCtrlSetting(pAd, 1); - } - // 4. Set PCI configuration Space Link Comtrol fields. Only Radio Off needs to call this function - else if (pAd->OpMode == OPMODE_STA) - { - if ((brc == TRUE) && (i < 50)) - RTMPPCIeLinkCtrlSetting(pAd, 3); - } -#endif // CONFIG_STA_SUPPORT // - - //pAd->bPCIclkOffDisableTx = FALSE; - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); - return TRUE; -} - - - - -VOID RT28xxPciMlmeRadioOn( - IN PRTMP_ADAPTER pAd) -{ - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) - return; - - DBGPRINT(RT_DEBUG_TRACE,("%s===>\n", __FUNCTION__)); - - if ((pAd->OpMode == OPMODE_AP) || - ((pAd->OpMode == OPMODE_STA) - && (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) -#ifdef CONFIG_STA_SUPPORT - ||pAd->StaCfg.PSControl.field.EnableNewPS == FALSE -#endif // CONFIG_STA_SUPPORT // - ))) - { - RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); - //NICResetFromError(pAd); - - RTMPRingCleanUp(pAd, QID_AC_BK); - RTMPRingCleanUp(pAd, QID_AC_BE); - RTMPRingCleanUp(pAd, QID_AC_VI); - RTMPRingCleanUp(pAd, QID_AC_VO); - /*RTMPRingCleanUp(pAd, QID_HCCA);*/ - RTMPRingCleanUp(pAd, QID_MGMT); - RTMPRingCleanUp(pAd, QID_RX); - - // Enable Tx/Rx - RTMPEnableRxTx(pAd); - - // Clear Radio off flag - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); - // Set LED - RTMPSetLED(pAd, LED_RADIO_ON); - } - -#ifdef CONFIG_STA_SUPPORT - if ((pAd->OpMode == OPMODE_STA) && - (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - &&(pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - BOOLEAN Cancelled; - - RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); - - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); - RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 40); - } -#endif // CONFIG_STA_SUPPORT // -} - - -VOID RT28xxPciMlmeRadioOFF( - IN PRTMP_ADAPTER pAd) -{ - BOOLEAN brc=TRUE; - - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) - return; - -#ifdef CONFIG_STA_SUPPORT - // Link down first if any association exists - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) - { - if (INFRA_ON(pAd) || ADHOC_ON(pAd)) - { - MLME_DISASSOC_REQ_STRUCT DisReq; - MLME_QUEUE_ELEM *pMsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); - - if (pMsgElem) - { - COPY_MAC_ADDR(&DisReq.Addr, pAd->CommonCfg.Bssid); - DisReq.Reason = REASON_DISASSOC_STA_LEAVING; - - pMsgElem->Machine = ASSOC_STATE_MACHINE; - pMsgElem->MsgType = MT2_MLME_DISASSOC_REQ; - pMsgElem->MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT); - NdisMoveMemory(pMsgElem->Msg, &DisReq, sizeof(MLME_DISASSOC_REQ_STRUCT)); - - MlmeDisassocReqAction(pAd, pMsgElem); - kfree(pMsgElem); - - RTMPusecDelay(1000); - } - } - } -#endif // CONFIG_STA_SUPPORT // - - DBGPRINT(RT_DEBUG_TRACE,("%s===>\n", __FUNCTION__)); - - // Set LED - //RTMPSetLED(pAd, LED_RADIO_OFF); - // Set Radio off flag - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - BOOLEAN Cancelled; - if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - { - RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &Cancelled); - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); - } - // If during power safe mode. - if (pAd->StaCfg.bRadio == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE,("-->MlmeRadioOff() return on bRadio == TRUE; \n")); - return; - } - // Always radio on since the NIC needs to set the MCU command (LED_RADIO_OFF). - if (IDLE_ON(pAd) && - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) - { - RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); - } - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - BOOLEAN Cancelled; - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); - } - } - - // Link down first if any association exists - if (INFRA_ON(pAd) || ADHOC_ON(pAd)) - LinkDown(pAd, FALSE); - RTMPusecDelay(10000); - //========================================== - // Clean up old bss table - BssTableInit(&pAd->ScanTab); - - /* - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); - return; - } - */ - } -#endif // CONFIG_STA_SUPPORT // - // Set LED.Move to here for fixing LED bug. This flag must be called after LinkDown - RTMPSetLED(pAd, LED_RADIO_OFF); - -#ifdef CONFIG_STA_SUPPORT -//KH Debug:All PCIe devices need to use timer to execute radio off function, or the PCIe&&EnableNewPS needs. -//KH Ans:It is right, because only when the PCIe and EnableNewPs is true, we need to delay the RadioOffTimer -//to avoid the deadlock with PCIe Power saving function. -if (pAd->OpMode == OPMODE_STA&& - OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)&& - pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - { - RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); - } -else -#endif // CONFIG_STA_SUPPORT // -{ - - - brc=RT28xxPciAsicRadioOff(pAd, GUIRADIO_OFF, 0); - - if (brc==FALSE) - { - DBGPRINT(RT_DEBUG_ERROR,("%s call RT28xxPciAsicRadioOff fail !!\n", __FUNCTION__)); - } -} -/* - // Disable Tx/Rx DMA - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); // disable DMA - GloCfg.field.EnableTxDMA = 0; - GloCfg.field.EnableRxDMA = 0; - RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); // abort all TX rings - - - // MAC_SYS_CTRL => value = 0x0 => 40mA - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0); - - // PWR_PIN_CFG => value = 0x0 => 40mA - RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0); - - // TX_PIN_CFG => value = 0x0 => 20mA - RTMP_IO_WRITE32(pAd, TX_PIN_CFG, 0); - - if (pAd->CommonCfg.BBPCurrentBW == BW_40) - { - // Must using 40MHz. - AsicTurnOffRFClk(pAd, pAd->CommonCfg.CentralChannel); - } - else - { - // Must using 20MHz. - AsicTurnOffRFClk(pAd, pAd->CommonCfg.Channel); - } - - // Waiting for DMA idle - i = 0; - do - { - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); - if ((GloCfg.field.TxDMABusy == 0) && (GloCfg.field.RxDMABusy == 0)) - break; - - RTMPusecDelay(1000); - }while (i++ < 100); -*/ -} - -#endif // RTMP_MAC_PCI // diff --git a/drivers/staging/rt3090/common/cmm_profile.c b/drivers/staging/rt3090/common/cmm_profile.c deleted file mode 100644 index 5803f422ae09..000000000000 --- a/drivers/staging/rt3090/common/cmm_profile.c +++ /dev/null @@ -1,2321 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - cmm_profile.c - - Abstract: - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- - */ - -#include "../rt_config.h" - - -#define ETH_MAC_ADDR_STR_LEN 17 // in format of xx:xx:xx:xx:xx:xx - -// We assume the s1 is a sting, s2 is a memory space with 6 bytes. and content of s1 will be changed. -BOOLEAN rtstrmactohex(PSTRING s1, PSTRING s2) -{ - int i = 0; - PSTRING ptokS = s1, ptokE = s1; - - if (strlen(s1) != ETH_MAC_ADDR_STR_LEN) - return FALSE; - - while((*ptokS) != '\0') - { - if((ptokE = strchr(ptokS, ':')) != NULL) - *ptokE++ = '\0'; - if ((strlen(ptokS) != 2) || (!isxdigit(*ptokS)) || (!isxdigit(*(ptokS+1)))) - break; // fail - AtoH(ptokS, (PUCHAR)&s2[i++], 1); - ptokS = ptokE; - if (i == 6) - break; // parsing finished - } - - return ( i == 6 ? TRUE : FALSE); - -} - - -// we assume the s1 and s2 both are strings. -BOOLEAN rtstrcasecmp(PSTRING s1, PSTRING s2) -{ - PSTRING p1 = s1, p2 = s2; - - if (strlen(s1) != strlen(s2)) - return FALSE; - - while(*p1 != '\0') - { - if((*p1 != *p2) && ((*p1 ^ *p2) != 0x20)) - return FALSE; - p1++; - p2++; - } - - return TRUE; -} - -// we assume the s1 (buffer) and s2 (key) both are strings. -PSTRING rtstrstruncasecmp(PSTRING s1, PSTRING s2) -{ - INT l1, l2, i; - char temp1, temp2; - - l2 = strlen(s2); - if (!l2) - return (char *) s1; - - l1 = strlen(s1); - - while (l1 >= l2) - { - l1--; - - for(i=0; i= l2) - { - l1--; - if (!memcmp(s1,s2,l2)) - return s1; - s1++; - } - - return NULL; -} - -/** - * rstrtok - Split a string into tokens - * @s: The string to be searched - * @ct: The characters to search for - * * WARNING: strtok is deprecated, use strsep instead. However strsep is not compatible with old architecture. - */ -PSTRING __rstrtok; -PSTRING rstrtok(PSTRING s,const PSTRING ct) -{ - PSTRING sbegin, send; - - sbegin = s ? s : __rstrtok; - if (!sbegin) - { - return NULL; - } - - sbegin += strspn(sbegin,ct); - if (*sbegin == '\0') - { - __rstrtok = NULL; - return( NULL ); - } - - send = strpbrk( sbegin, ct); - if (send && *send != '\0') - *send++ = '\0'; - - __rstrtok = send; - - return (sbegin); -} - -/** - * delimitcnt - return the count of a given delimiter in a given string. - * @s: The string to be searched. - * @ct: The delimiter to search for. - * Notice : We suppose the delimiter is a single-char string(for example : ";"). - */ -INT delimitcnt(PSTRING s,PSTRING ct) -{ - INT count = 0; - /* point to the beginning of the line */ - PSTRING token = s; - - for ( ;; ) - { - token = strpbrk(token, ct); /* search for delimiters */ - - if ( token == NULL ) - { - /* advanced to the terminating null character */ - break; - } - /* skip the delimiter */ - ++token; - - /* - * Print the found text: use len with %.*s to specify field width. - */ - - /* accumulate delimiter count */ - ++count; - } - return count; -} - -/* - * converts the Internet host address from the standard numbers-and-dots notation - * into binary data. - * returns nonzero if the address is valid, zero if not. - */ -int rtinet_aton(PSTRING cp, unsigned int *addr) -{ - unsigned int val; - int base, n; - STRING c; - unsigned int parts[4]; - unsigned int *pp = parts; - - for (;;) - { - /* - * Collect number up to ``.''. - * Values are specified as for C: - * 0x=hex, 0=octal, other=decimal. - */ - val = 0; - base = 10; - if (*cp == '0') - { - if (*++cp == 'x' || *cp == 'X') - base = 16, cp++; - else - base = 8; - } - while ((c = *cp) != '\0') - { - if (isdigit((unsigned char) c)) - { - val = (val * base) + (c - '0'); - cp++; - continue; - } - if (base == 16 && isxdigit((unsigned char) c)) - { - val = (val << 4) + - (c + 10 - (islower((unsigned char) c) ? 'a' : 'A')); - cp++; - continue; - } - break; - } - if (*cp == '.') - { - /* - * Internet format: a.b.c.d a.b.c (with c treated as 16-bits) - * a.b (with b treated as 24 bits) - */ - if (pp >= parts + 3 || val > 0xff) - return 0; - *pp++ = val, cp++; - } - else - break; - } - - /* - * Check for trailing junk. - */ - while (*cp) - if (!isspace((unsigned char) *cp++)) - return 0; - - /* - * Concoct the address according to the number of parts specified. - */ - n = pp - parts + 1; - switch (n) - { - - case 1: /* a -- 32 bits */ - break; - - case 2: /* a.b -- 8.24 bits */ - if (val > 0xffffff) - return 0; - val |= parts[0] << 24; - break; - - case 3: /* a.b.c -- 8.8.16 bits */ - if (val > 0xffff) - return 0; - val |= (parts[0] << 24) | (parts[1] << 16); - break; - - case 4: /* a.b.c.d -- 8.8.8.8 bits */ - if (val > 0xff) - return 0; - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); - break; - } - - *addr = htonl(val); - return 1; - -} - -/* - ======================================================================== - - Routine Description: - Find key section for Get key parameter. - - Arguments: - buffer Pointer to the buffer to start find the key section - section the key of the secion to be find - - Return Value: - NULL Fail - Others Success - ======================================================================== -*/ -PSTRING RTMPFindSection( - IN PSTRING buffer) -{ - STRING temp_buf[32]; - PSTRING ptr; - - strcpy(temp_buf, "Default"); - - if((ptr = rtstrstr(buffer, temp_buf)) != NULL) - return (ptr+strlen("\n")); - else - return NULL; -} - -/* - ======================================================================== - - Routine Description: - Get key parameter. - - Arguments: - key Pointer to key string - dest Pointer to destination - destsize The datasize of the destination - buffer Pointer to the buffer to start find the key - bTrimSpace Set true if you want to strip the space character of the result pattern - - Return Value: - TRUE Success - FALSE Fail - - Note: - This routine get the value with the matched key (case case-sensitive) - For SSID and security key related parameters, we SHALL NOT trim the space(' ') character. - ======================================================================== -*/ -INT RTMPGetKeyParameter( - IN PSTRING key, - OUT PSTRING dest, - IN INT destsize, - IN PSTRING buffer, - IN BOOLEAN bTrimSpace) -{ - PSTRING pMemBuf, temp_buf1 = NULL, temp_buf2 = NULL; - PSTRING start_ptr, end_ptr; - PSTRING ptr; - PSTRING offset = NULL; - INT len, keyLen; - - - keyLen = strlen(key); - os_alloc_mem(NULL, (PUCHAR *)&pMemBuf, MAX_PARAM_BUFFER_SIZE * 2); - if (pMemBuf == NULL) - return (FALSE); - - memset(pMemBuf, 0, MAX_PARAM_BUFFER_SIZE * 2); - temp_buf1 = pMemBuf; - temp_buf2 = (PSTRING)(pMemBuf + MAX_PARAM_BUFFER_SIZE); - - - //find section - if((offset = RTMPFindSection(buffer)) == NULL) - { - os_free_mem(NULL, (PUCHAR)pMemBuf); - return (FALSE); - } - - strcpy(temp_buf1, "\n"); - strcat(temp_buf1, key); - strcat(temp_buf1, "="); - - //search key - if((start_ptr=rtstrstr(offset, temp_buf1)) == NULL) - { - os_free_mem(NULL, (PUCHAR)pMemBuf); - return (FALSE); - } - - start_ptr += strlen("\n"); - if((end_ptr = rtstrstr(start_ptr, "\n"))==NULL) - end_ptr = start_ptr+strlen(start_ptr); - - if (end_ptr= 1 ) && (KeyIdx <= 4)) - pAd->StaCfg.DefaultKeyId = (UCHAR) (KeyIdx - 1); - else - pAd->StaCfg.DefaultKeyId = 0; - - DBGPRINT(RT_DEBUG_TRACE, ("DefaultKeyID(0~3)=%d\n", pAd->StaCfg.DefaultKeyId)); - } -#endif // CONFIG_STA_SUPPORT // - } - - - for (idx = 0; idx < 4; idx++) - { - sprintf(tok_str, "Key%dType", idx + 1); - //Key1Type - if (RTMPGetKeyParameter(tok_str, tmpbuf, 128, buffer, TRUE)) - { - for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++) - { - /* - do sanity check for KeyType length; - or in station mode, the KeyType length > 1, - the code will overwrite the stack of caller - (RTMPSetProfileParameters) and cause srcbuf = NULL - */ - if (i < MAX_MBSSID_NUM) - KeyType[i] = simple_strtol(macptr, 0, 10); - } - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - sprintf(tok_str, "Key%dStr", idx + 1); - if (RTMPGetKeyParameter(tok_str, tmpbuf, 128, buffer, FALSE)) - { - rtmp_parse_key_buffer_from_file(pAd, tmpbuf, KeyType[BSS0], BSS0, idx); - } - } -#endif // CONFIG_STA_SUPPORT // - } - } -} - - - -#ifdef CONFIG_STA_SUPPORT -static void rtmp_read_sta_wmm_parms_from_file(IN PRTMP_ADAPTER pAd, char *tmpbuf, char *buffer) -{ - PSTRING macptr; - INT i=0; - BOOLEAN bWmmEnable = FALSE; - - //WmmCapable - if(RTMPGetKeyParameter("WmmCapable", tmpbuf, 32, buffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) //Enable - { - pAd->CommonCfg.bWmmCapable = TRUE; - bWmmEnable = TRUE; - } - else //Disable - { - pAd->CommonCfg.bWmmCapable = FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("WmmCapable=%d\n", pAd->CommonCfg.bWmmCapable)); - } - -#ifdef QOS_DLS_SUPPORT - //DLSCapable - if(RTMPGetKeyParameter("DLSCapable", tmpbuf, 32, buffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) //Enable - { - pAd->CommonCfg.bDLSCapable = TRUE; - } - else //Disable - { - pAd->CommonCfg.bDLSCapable = FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("bDLSCapable=%d\n", pAd->CommonCfg.bDLSCapable)); - } -#endif // QOS_DLS_SUPPORT // - - //AckPolicy for AC_BK, AC_BE, AC_VI, AC_VO - if(RTMPGetKeyParameter("AckPolicy", tmpbuf, 32, buffer, TRUE)) - { - for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++) - { - pAd->CommonCfg.AckPolicy[i] = (UCHAR)simple_strtol(macptr, 0, 10); - - DBGPRINT(RT_DEBUG_TRACE, ("AckPolicy[%d]=%d\n", i, pAd->CommonCfg.AckPolicy[i])); - } - } - - if (bWmmEnable) - { - //APSDCapable - if(RTMPGetKeyParameter("APSDCapable", tmpbuf, 10, buffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) //Enable - pAd->CommonCfg.bAPSDCapable = TRUE; - else - pAd->CommonCfg.bAPSDCapable = FALSE; - - DBGPRINT(RT_DEBUG_TRACE, ("APSDCapable=%d\n", pAd->CommonCfg.bAPSDCapable)); - } - - //MaxSPLength - if(RTMPGetKeyParameter("MaxSPLength", tmpbuf, 10, buffer, TRUE)) - { - pAd->CommonCfg.MaxSPLength = simple_strtol(tmpbuf, 0, 10); - - DBGPRINT(RT_DEBUG_TRACE, ("MaxSPLength=%d\n", pAd->CommonCfg.MaxSPLength)); - } - - //APSDAC for AC_BE, AC_BK, AC_VI, AC_VO - if(RTMPGetKeyParameter("APSDAC", tmpbuf, 32, buffer, TRUE)) - { - BOOLEAN apsd_ac[4]; - - for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++) - { - apsd_ac[i] = (BOOLEAN)simple_strtol(macptr, 0, 10); - - DBGPRINT(RT_DEBUG_TRACE, ("APSDAC%d %d\n", i, apsd_ac[i])); - } - - pAd->CommonCfg.bAPSDAC_BE = apsd_ac[0]; - pAd->CommonCfg.bAPSDAC_BK = apsd_ac[1]; - pAd->CommonCfg.bAPSDAC_VI = apsd_ac[2]; - pAd->CommonCfg.bAPSDAC_VO = apsd_ac[3]; - - pAd->CommonCfg.bACMAPSDTr[0] = apsd_ac[0]; - pAd->CommonCfg.bACMAPSDTr[1] = apsd_ac[1]; - pAd->CommonCfg.bACMAPSDTr[2] = apsd_ac[2]; - pAd->CommonCfg.bACMAPSDTr[3] = apsd_ac[3]; - } - } - -} -#endif // CONFIG_STA_SUPPORT // - - -#ifdef DOT11_N_SUPPORT -static void HTParametersHook( - IN PRTMP_ADAPTER pAd, - IN PSTRING pValueStr, - IN PSTRING pInput) -{ - - long Value; - - if (RTMPGetKeyParameter("HT_PROTECT", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bHTProtect = FALSE; - } - else - { - pAd->CommonCfg.bHTProtect = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Protection = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - if (RTMPGetKeyParameter("HT_MIMOPSEnable", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bMIMOPSEnable = FALSE; - } - else - { - pAd->CommonCfg.bMIMOPSEnable = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: MIMOPSEnable = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - - if (RTMPGetKeyParameter("HT_MIMOPSMode", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value > MMPS_ENABLE) - { - pAd->CommonCfg.BACapability.field.MMPSmode = MMPS_ENABLE; - } - else - { - //TODO: add mimo power saving mechanism - pAd->CommonCfg.BACapability.field.MMPSmode = MMPS_ENABLE; - //pAd->CommonCfg.BACapability.field.MMPSmode = Value; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: MIMOPS Mode = %d\n", (INT) Value)); - } - - if (RTMPGetKeyParameter("HT_BADecline", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bBADecline = FALSE; - } - else - { - pAd->CommonCfg.bBADecline = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: BA Decline = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - - if (RTMPGetKeyParameter("HT_DisableReordering", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bDisableReordering = FALSE; - } - else - { - pAd->CommonCfg.bDisableReordering = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: DisableReordering = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - if (RTMPGetKeyParameter("HT_AutoBA", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.BACapability.field.AutoBA = FALSE; - pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE; - } - else - { - pAd->CommonCfg.BACapability.field.AutoBA = TRUE; - pAd->CommonCfg.BACapability.field.Policy = IMMED_BA; - } - pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA; - DBGPRINT(RT_DEBUG_TRACE, ("HT: Auto BA = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - // Tx_+HTC frame - if (RTMPGetKeyParameter("HT_HTC", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->HTCEnable = FALSE; - } - else - { - pAd->HTCEnable = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Tx +HTC frame = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - // Enable HT Link Adaptation Control - if (RTMPGetKeyParameter("HT_LinkAdapt", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->bLinkAdapt = FALSE; - } - else - { - pAd->HTCEnable = TRUE; - pAd->bLinkAdapt = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Link Adaptation Control = %s\n", (Value==0) ? "Disable" : "Enable(+HTC)")); - } - - // Reverse Direction Mechanism - if (RTMPGetKeyParameter("HT_RDG", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bRdg = FALSE; - } - else - { - pAd->HTCEnable = TRUE; - pAd->CommonCfg.bRdg = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: RDG = %s\n", (Value==0) ? "Disable" : "Enable(+HTC)")); - } - - - - - // Tx A-MSUD ? - if (RTMPGetKeyParameter("HT_AMSDU", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.BACapability.field.AmsduEnable = FALSE; - } - else - { - pAd->CommonCfg.BACapability.field.AmsduEnable = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Tx A-MSDU = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - // MPDU Density - if (RTMPGetKeyParameter("HT_MpduDensity", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value <=7 && Value >= 0) - { - pAd->CommonCfg.BACapability.field.MpduDensity = Value; - DBGPRINT(RT_DEBUG_TRACE, ("HT: MPDU Density = %d\n", (INT) Value)); - } - else - { - pAd->CommonCfg.BACapability.field.MpduDensity = 4; - DBGPRINT(RT_DEBUG_TRACE, ("HT: MPDU Density = %d (Default)\n", 4)); - } - } - - // Max Rx BA Window Size - if (RTMPGetKeyParameter("HT_BAWinSize", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - - if (Value >=1 && Value <= 64) - { - pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = Value; - pAd->CommonCfg.BACapability.field.RxBAWinLimit = Value; - DBGPRINT(RT_DEBUG_TRACE, ("HT: BA Windw Size = %d\n", (INT) Value)); - } - else - { - pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = 64; - pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64; - DBGPRINT(RT_DEBUG_TRACE, ("HT: BA Windw Size = 64 (Defualt)\n")); - } - - } - - // Guard Interval - if (RTMPGetKeyParameter("HT_GI", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - - if (Value == GI_400) - { - pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_400; - } - else - { - pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_800; - } - - DBGPRINT(RT_DEBUG_TRACE, ("HT: Guard Interval = %s\n", (Value==GI_400) ? "400" : "800" )); - } - - // HT Operation Mode : Mixed Mode , Green Field - if (RTMPGetKeyParameter("HT_OpMode", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - - if (Value == HTMODE_GF) - { - - pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_GF; - } - else - { - pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_MM; - } - - DBGPRINT(RT_DEBUG_TRACE, ("HT: Operate Mode = %s\n", (Value==HTMODE_GF) ? "Green Field" : "Mixed Mode" )); - } - - // Fixed Tx mode : CCK, OFDM - if (RTMPGetKeyParameter("FixedTxMode", pValueStr, 25, pInput, TRUE)) - { - UCHAR fix_tx_mode; - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - fix_tx_mode = FIXED_TXMODE_HT; - - if (strcmp(pValueStr, "OFDM") == 0 || strcmp(pValueStr, "ofdm") == 0) - { - fix_tx_mode = FIXED_TXMODE_OFDM; - } - else if (strcmp(pValueStr, "CCK") == 0 || strcmp(pValueStr, "cck") == 0) - { - fix_tx_mode = FIXED_TXMODE_CCK; - } - else if (strcmp(pValueStr, "HT") == 0 || strcmp(pValueStr, "ht") == 0) - { - fix_tx_mode = FIXED_TXMODE_HT; - } - else - { - Value = simple_strtol(pValueStr, 0, 10); - // 1 : CCK - // 2 : OFDM - // otherwise : HT - if (Value == FIXED_TXMODE_CCK || Value == FIXED_TXMODE_OFDM) - fix_tx_mode = Value; - else - fix_tx_mode = FIXED_TXMODE_HT; - } - - pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode = fix_tx_mode; - DBGPRINT(RT_DEBUG_TRACE, ("Fixed Tx Mode = %d\n", fix_tx_mode)); - - } -#endif // CONFIG_STA_SUPPORT // - } - - - // Channel Width - if (RTMPGetKeyParameter("HT_BW", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - - if (Value == BW_40) - { - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40; - } - else - { - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - } - -#ifdef MCAST_RATE_SPECIFIC - pAd->CommonCfg.MCastPhyMode.field.BW = pAd->CommonCfg.RegTransmitSetting.field.BW; -#endif // MCAST_RATE_SPECIFIC // - - DBGPRINT(RT_DEBUG_TRACE, ("HT: Channel Width = %s\n", (Value==BW_40) ? "40 MHz" : "20 MHz" )); - } - - if (RTMPGetKeyParameter("HT_EXTCHA", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - - if (Value == 0) - { - - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW; - } - else - { - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("HT: Ext Channel = %s\n", (Value==0) ? "BELOW" : "ABOVE" )); - } - - // MSC - if (RTMPGetKeyParameter("HT_MCS", pValueStr, 50, pInput, TRUE)) - { - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - Value = simple_strtol(pValueStr, 0, 10); - -// if ((Value >= 0 && Value <= 15) || (Value == 32)) - if ((Value >= 0 && Value <= 23) || (Value == 32)) // 3*3 - { - pAd->StaCfg.DesiredTransmitSetting.field.MCS = Value; - pAd->StaCfg.bAutoTxRateSwitch = FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("HT: MCS = %d\n", pAd->StaCfg.DesiredTransmitSetting.field.MCS)); - } - else - { - pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; - pAd->StaCfg.bAutoTxRateSwitch = TRUE; - DBGPRINT(RT_DEBUG_TRACE, ("HT: MCS = AUTO\n")); - } - } -#endif // CONFIG_STA_SUPPORT // - } - - // STBC - if (RTMPGetKeyParameter("HT_STBC", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == STBC_USE) - { - pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_USE; - } - else - { - pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_NONE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: STBC = %d\n", pAd->CommonCfg.RegTransmitSetting.field.STBC)); - } - - // 40_Mhz_Intolerant - if (RTMPGetKeyParameter("HT_40MHZ_INTOLERANT", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bForty_Mhz_Intolerant = FALSE; - } - else - { - pAd->CommonCfg.bForty_Mhz_Intolerant = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: 40MHZ INTOLERANT = %d\n", pAd->CommonCfg.bForty_Mhz_Intolerant)); - } - //HT_TxStream - if(RTMPGetKeyParameter("HT_TxStream", pValueStr, 10, pInput, TRUE)) - { - switch (simple_strtol(pValueStr, 0, 10)) - { - case 1: - pAd->CommonCfg.TxStream = 1; - break; - case 2: - pAd->CommonCfg.TxStream = 2; - break; - case 3: // 3*3 - default: - pAd->CommonCfg.TxStream = 3; - - if (pAd->MACVersion < RALINK_2883_VERSION) - pAd->CommonCfg.TxStream = 2; // only 2 tx streams for RT2860 series - break; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Tx Stream = %d\n", pAd->CommonCfg.TxStream)); - } - //HT_RxStream - if(RTMPGetKeyParameter("HT_RxStream", pValueStr, 10, pInput, TRUE)) - { - switch (simple_strtol(pValueStr, 0, 10)) - { - case 1: - pAd->CommonCfg.RxStream = 1; - break; - case 2: - pAd->CommonCfg.RxStream = 2; - break; - case 3: - default: - pAd->CommonCfg.RxStream = 3; - - if (pAd->MACVersion < RALINK_2883_VERSION) - pAd->CommonCfg.RxStream = 2; // only 2 rx streams for RT2860 series - break; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Rx Stream = %d\n", pAd->CommonCfg.RxStream)); - } - //2008/11/05: KH add to support Antenna power-saving of AP<-- - //Green AP - if(RTMPGetKeyParameter("GreenAP", pValueStr, 10, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bGreenAPEnable = FALSE; - } - else - { - pAd->CommonCfg.bGreenAPEnable = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Green AP= %d\n", pAd->CommonCfg.bGreenAPEnable)); - } - - // HT_DisallowTKIP - if (RTMPGetKeyParameter("HT_DisallowTKIP", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - - if (Value == 1) - { - pAd->CommonCfg.HT_DisallowTKIP = TRUE; - } - else - { - pAd->CommonCfg.HT_DisallowTKIP = FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("HT: Disallow TKIP mode = %s\n", (pAd->CommonCfg.HT_DisallowTKIP == TRUE) ? "ON" : "OFF" )); - } - - - //2008/11/05:KH add to support Antenna power-saving of AP--> -} -#endif // DOT11_N_SUPPORT // - - -NDIS_STATUS RTMPSetProfileParameters( - IN RTMP_ADAPTER *pAd, - IN PSTRING pBuffer) -{ - PSTRING tmpbuf; - ULONG RtsThresh; - ULONG FragThresh; - PSTRING macptr; - INT i = 0, retval; - tmpbuf = kmalloc(MAX_PARAM_BUFFER_SIZE, MEM_ALLOC_FLAG); - if(tmpbuf == NULL) - return NDIS_STATUS_FAILURE; - - do - { - // set file parameter to portcfg - //CountryRegion - if(RTMPGetKeyParameter("CountryRegion", tmpbuf, 25, pBuffer, TRUE)) - { - retval = RT_CfgSetCountryRegion(pAd, tmpbuf, BAND_24G); - DBGPRINT(RT_DEBUG_TRACE, ("CountryRegion=%d\n", pAd->CommonCfg.CountryRegion)); - } - //CountryRegionABand - if(RTMPGetKeyParameter("CountryRegionABand", tmpbuf, 25, pBuffer, TRUE)) - { - retval = RT_CfgSetCountryRegion(pAd, tmpbuf, BAND_5G); - DBGPRINT(RT_DEBUG_TRACE, ("CountryRegionABand=%d\n", pAd->CommonCfg.CountryRegionForABand)); - } -#ifdef RTMP_EFUSE_SUPPORT -#ifdef RT30xx - //EfuseBufferMode - if(RTMPGetKeyParameter("EfuseBufferMode", tmpbuf, 25, pBuffer, TRUE)) - { - pAd->bEEPROMFile = (UCHAR) simple_strtol(tmpbuf, 0, 10); - DBGPRINT(RT_DEBUG_TRACE, ("EfuseBufferMode=%d\n", pAd->bUseEfuse)); - } -#endif // RT30xx // -#endif // RTMP_EFUSE_SUPPORT // - //CountryCode - if(RTMPGetKeyParameter("CountryCode", tmpbuf, 25, pBuffer, TRUE)) - { - NdisMoveMemory(pAd->CommonCfg.CountryCode, tmpbuf , 2); -#ifdef CONFIG_STA_SUPPORT -#ifdef EXT_BUILD_CHANNEL_LIST - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - NdisMoveMemory(pAd->StaCfg.StaOriCountryCode, tmpbuf , 2); -#endif // EXT_BUILD_CHANNEL_LIST // -#endif // CONFIG_STA_SUPPORT // - if (strlen((PSTRING) pAd->CommonCfg.CountryCode) != 0) - { - pAd->CommonCfg.bCountryFlag = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("CountryCode=%s\n", pAd->CommonCfg.CountryCode)); - } - //ChannelGeography - if(RTMPGetKeyParameter("ChannelGeography", tmpbuf, 25, pBuffer, TRUE)) - { - UCHAR Geography = (UCHAR) simple_strtol(tmpbuf, 0, 10); - if (Geography <= BOTH) - { - pAd->CommonCfg.Geography = Geography; - pAd->CommonCfg.CountryCode[2] = - (pAd->CommonCfg.Geography == BOTH) ? ' ' : ((pAd->CommonCfg.Geography == IDOR) ? 'I' : 'O'); -#ifdef CONFIG_STA_SUPPORT -#ifdef EXT_BUILD_CHANNEL_LIST - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - pAd->StaCfg.StaOriGeography = pAd->CommonCfg.Geography; -#endif // EXT_BUILD_CHANNEL_LIST // -#endif // CONFIG_STA_SUPPORT // - DBGPRINT(RT_DEBUG_TRACE, ("ChannelGeography=%d\n", pAd->CommonCfg.Geography)); - } - } - else - { - pAd->CommonCfg.Geography = BOTH; - pAd->CommonCfg.CountryCode[2] = ' '; - } - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - //SSID - if (RTMPGetKeyParameter("SSID", tmpbuf, 256, pBuffer, FALSE)) - { - if (strlen(tmpbuf) <= 32) - { - pAd->CommonCfg.SsidLen = (UCHAR) strlen(tmpbuf); - NdisZeroMemory(pAd->CommonCfg.Ssid, NDIS_802_11_LENGTH_SSID); - NdisMoveMemory(pAd->CommonCfg.Ssid, tmpbuf, pAd->CommonCfg.SsidLen); - pAd->MlmeAux.AutoReconnectSsidLen = pAd->CommonCfg.SsidLen; - NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, NDIS_802_11_LENGTH_SSID); - NdisMoveMemory(pAd->MlmeAux.AutoReconnectSsid, tmpbuf, pAd->MlmeAux.AutoReconnectSsidLen); - pAd->MlmeAux.SsidLen = pAd->CommonCfg.SsidLen; - NdisZeroMemory(pAd->MlmeAux.Ssid, NDIS_802_11_LENGTH_SSID); - NdisMoveMemory(pAd->MlmeAux.Ssid, tmpbuf, pAd->MlmeAux.SsidLen); - DBGPRINT(RT_DEBUG_TRACE, ("%s::(SSID=%s)\n", __FUNCTION__, tmpbuf)); - } - } - } -#endif // CONFIG_STA_SUPPORT // - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - //NetworkType - if (RTMPGetKeyParameter("NetworkType", tmpbuf, 25, pBuffer, TRUE)) - { - pAd->bConfigChanged = TRUE; - if (strcmp(tmpbuf, "Adhoc") == 0) - pAd->StaCfg.BssType = BSS_ADHOC; - else //Default Infrastructure mode - pAd->StaCfg.BssType = BSS_INFRA; - // Reset Ralink supplicant to not use, it will be set to start when UI set PMK key - pAd->StaCfg.WpaState = SS_NOTUSE; - DBGPRINT(RT_DEBUG_TRACE, ("%s::(NetworkType=%d)\n", __FUNCTION__, pAd->StaCfg.BssType)); - } - } -#ifdef RTMP_MAC_PCI - //NewPCIePS - if(RTMPGetKeyParameter("NewPCIePS", tmpbuf, 10, pBuffer, TRUE)) - { - UCHAR temp_buffer = (UCHAR) simple_strtol(tmpbuf, 0, 10); - if(temp_buffer>0) - pAd->StaCfg.PSControl.field.EnableNewPS=TRUE; - else - pAd->StaCfg.PSControl.field.EnableNewPS=FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("NewPCIePS=%d\n", pAd->StaCfg.PSControl.field.EnableNewPS)); - } -#endif // RTMP_MAC_PCI // -#ifdef RT3090 - //PCIePowerLevel - - if(RTMPGetKeyParameter("PCIePowerLevel", tmpbuf, 10, pBuffer, TRUE)) - { - pAd->StaCfg.PSControl.field.rt30xxPowerMode = (UCHAR) simple_strtol(tmpbuf, 0, 10); - DBGPRINT(RT_DEBUG_TRACE, ("PCIePowerLevel=%d\n", pAd->StaCfg.PSControl.field.rt30xxPowerMode)); - } - //FollowHostASPM - if(RTMPGetKeyParameter("FollowHostASPM", tmpbuf, 10, pBuffer, TRUE)) - { - UCHAR temp_buffer = (UCHAR) simple_strtol(tmpbuf, 0, 10); - - if(temp_buffer>0) - pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM=TRUE; - else - pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM=FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("rt30xxFollowHostASPM=%d\n", pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM)); - } - //ForceTestASPM - if(RTMPGetKeyParameter("ForceTestASPM", tmpbuf, 10, pBuffer, TRUE)) - { - UCHAR temp_buffer = (UCHAR) simple_strtol(tmpbuf, 0, 10); - - if(temp_buffer>0) - pAd->StaCfg.PSControl.field.rt30xxForceASPMTest=TRUE; - else - pAd->StaCfg.PSControl.field.rt30xxForceASPMTest=FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("rt30xxForceASPM=%d\n", pAd->StaCfg.PSControl.field.rt30xxForceASPMTest)); - } -#endif // RT3090 // -#endif // CONFIG_STA_SUPPORT // - //Channel - if(RTMPGetKeyParameter("Channel", tmpbuf, 10, pBuffer, TRUE)) - { - pAd->CommonCfg.Channel = (UCHAR) simple_strtol(tmpbuf, 0, 10); - DBGPRINT(RT_DEBUG_TRACE, ("Channel=%d\n", pAd->CommonCfg.Channel)); - } - //WirelessMode - if(RTMPGetKeyParameter("WirelessMode", tmpbuf, 10, pBuffer, TRUE)) - { - RT_CfgSetWirelessMode(pAd, tmpbuf); - DBGPRINT(RT_DEBUG_TRACE, ("PhyMode=%d\n", pAd->CommonCfg.PhyMode)); - } - //BasicRate - if(RTMPGetKeyParameter("BasicRate", tmpbuf, 10, pBuffer, TRUE)) - { - pAd->CommonCfg.BasicRateBitmap = (ULONG) simple_strtol(tmpbuf, 0, 10); - DBGPRINT(RT_DEBUG_TRACE, ("BasicRate=%ld\n", pAd->CommonCfg.BasicRateBitmap)); - } - //BeaconPeriod - if(RTMPGetKeyParameter("BeaconPeriod", tmpbuf, 10, pBuffer, TRUE)) - { - pAd->CommonCfg.BeaconPeriod = (USHORT) simple_strtol(tmpbuf, 0, 10); - DBGPRINT(RT_DEBUG_TRACE, ("BeaconPeriod=%d\n", pAd->CommonCfg.BeaconPeriod)); - } - //TxPower - if(RTMPGetKeyParameter("TxPower", tmpbuf, 10, pBuffer, TRUE)) - { - pAd->CommonCfg.TxPowerPercentage = (ULONG) simple_strtol(tmpbuf, 0, 10); -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - pAd->CommonCfg.TxPowerDefault = pAd->CommonCfg.TxPowerPercentage; -#endif // CONFIG_STA_SUPPORT // - DBGPRINT(RT_DEBUG_TRACE, ("TxPower=%ld\n", pAd->CommonCfg.TxPowerPercentage)); - } - //BGProtection - if(RTMPGetKeyParameter("BGProtection", tmpbuf, 10, pBuffer, TRUE)) - { - //#if 0 //#ifndef WIFI_TEST - // pAd->CommonCfg.UseBGProtection = 2;// disable b/g protection for throughput test - //#else - switch (simple_strtol(tmpbuf, 0, 10)) - { - case 1: //Always On - pAd->CommonCfg.UseBGProtection = 1; - break; - case 2: //Always OFF - pAd->CommonCfg.UseBGProtection = 2; - break; - case 0: //AUTO - default: - pAd->CommonCfg.UseBGProtection = 0; - break; - } - //#endif - DBGPRINT(RT_DEBUG_TRACE, ("BGProtection=%ld\n", pAd->CommonCfg.UseBGProtection)); - } - //OLBCDetection - if(RTMPGetKeyParameter("DisableOLBC", tmpbuf, 10, pBuffer, TRUE)) - { - switch (simple_strtol(tmpbuf, 0, 10)) - { - case 1: //disable OLBC Detection - pAd->CommonCfg.DisableOLBCDetect = 1; - break; - case 0: //enable OLBC Detection - pAd->CommonCfg.DisableOLBCDetect = 0; - break; - default: - pAd->CommonCfg.DisableOLBCDetect= 0; - break; - } - DBGPRINT(RT_DEBUG_TRACE, ("OLBCDetection=%ld\n", pAd->CommonCfg.DisableOLBCDetect)); - } - //TxPreamble - if(RTMPGetKeyParameter("TxPreamble", tmpbuf, 10, pBuffer, TRUE)) - { - switch (simple_strtol(tmpbuf, 0, 10)) - { - case Rt802_11PreambleShort: - pAd->CommonCfg.TxPreamble = Rt802_11PreambleShort; - break; - case Rt802_11PreambleLong: - default: - pAd->CommonCfg.TxPreamble = Rt802_11PreambleLong; - break; - } - DBGPRINT(RT_DEBUG_TRACE, ("TxPreamble=%ld\n", pAd->CommonCfg.TxPreamble)); - } - //RTSThreshold - if(RTMPGetKeyParameter("RTSThreshold", tmpbuf, 10, pBuffer, TRUE)) - { - RtsThresh = simple_strtol(tmpbuf, 0, 10); - if( (RtsThresh >= 1) && (RtsThresh <= MAX_RTS_THRESHOLD) ) - pAd->CommonCfg.RtsThreshold = (USHORT)RtsThresh; - else - pAd->CommonCfg.RtsThreshold = MAX_RTS_THRESHOLD; - - DBGPRINT(RT_DEBUG_TRACE, ("RTSThreshold=%d\n", pAd->CommonCfg.RtsThreshold)); - } - //FragThreshold - if(RTMPGetKeyParameter("FragThreshold", tmpbuf, 10, pBuffer, TRUE)) - { - FragThresh = simple_strtol(tmpbuf, 0, 10); - pAd->CommonCfg.bUseZeroToDisableFragment = FALSE; - - if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD) - { //illegal FragThresh so we set it to default - pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD; - pAd->CommonCfg.bUseZeroToDisableFragment = TRUE; - } - else if (FragThresh % 2 == 1) - { - // The length of each fragment shall always be an even number of octets, except for the last fragment - // of an MSDU or MMPDU, which may be either an even or an odd number of octets. - pAd->CommonCfg.FragmentThreshold = (USHORT)(FragThresh - 1); - } - else - { - pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh; - } - //pAd->CommonCfg.AllowFragSize = (pAd->CommonCfg.FragmentThreshold) - LENGTH_802_11 - LENGTH_CRC; - DBGPRINT(RT_DEBUG_TRACE, ("FragThreshold=%d\n", pAd->CommonCfg.FragmentThreshold)); - } - //TxBurst - if(RTMPGetKeyParameter("TxBurst", tmpbuf, 10, pBuffer, TRUE)) - { - //#ifdef WIFI_TEST - // pAd->CommonCfg.bEnableTxBurst = FALSE; - //#else - if(simple_strtol(tmpbuf, 0, 10) != 0) //Enable - pAd->CommonCfg.bEnableTxBurst = TRUE; - else //Disable - pAd->CommonCfg.bEnableTxBurst = FALSE; - //#endif - DBGPRINT(RT_DEBUG_TRACE, ("TxBurst=%d\n", pAd->CommonCfg.bEnableTxBurst)); - } - -#ifdef AGGREGATION_SUPPORT - //PktAggregate - if(RTMPGetKeyParameter("PktAggregate", tmpbuf, 10, pBuffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) //Enable - pAd->CommonCfg.bAggregationCapable = TRUE; - else //Disable - pAd->CommonCfg.bAggregationCapable = FALSE; -#ifdef PIGGYBACK_SUPPORT - pAd->CommonCfg.bPiggyBackCapable = pAd->CommonCfg.bAggregationCapable; -#endif // PIGGYBACK_SUPPORT // - DBGPRINT(RT_DEBUG_TRACE, ("PktAggregate=%d\n", pAd->CommonCfg.bAggregationCapable)); - } -#else - pAd->CommonCfg.bAggregationCapable = FALSE; - pAd->CommonCfg.bPiggyBackCapable = FALSE; -#endif // AGGREGATION_SUPPORT // - - // WmmCapable - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - rtmp_read_sta_wmm_parms_from_file(pAd, tmpbuf, pBuffer); -#endif // CONFIG_STA_SUPPORT // - - //ShortSlot - if(RTMPGetKeyParameter("ShortSlot", tmpbuf, 10, pBuffer, TRUE)) - { - RT_CfgSetShortSlot(pAd, tmpbuf); - DBGPRINT(RT_DEBUG_TRACE, ("ShortSlot=%d\n", pAd->CommonCfg.bUseShortSlotTime)); - } - //IEEE80211H - if(RTMPGetKeyParameter("IEEE80211H", tmpbuf, 10, pBuffer, TRUE)) - { - for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++) - { - if(simple_strtol(macptr, 0, 10) != 0) //Enable - pAd->CommonCfg.bIEEE80211H = TRUE; - else //Disable - pAd->CommonCfg.bIEEE80211H = FALSE; - - DBGPRINT(RT_DEBUG_TRACE, ("IEEE80211H=%d\n", pAd->CommonCfg.bIEEE80211H)); - } - } - //CSPeriod - if(RTMPGetKeyParameter("CSPeriod", tmpbuf, 10, pBuffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) - pAd->CommonCfg.RadarDetect.CSPeriod = simple_strtol(tmpbuf, 0, 10); - else - pAd->CommonCfg.RadarDetect.CSPeriod = 0; - - DBGPRINT(RT_DEBUG_TRACE, ("CSPeriod=%d\n", pAd->CommonCfg.RadarDetect.CSPeriod)); - } - -#ifdef MERGE_ARCH_TEAM - // DfsLowerLimit - if(RTMPGetKeyParameter("DfsLowerLimit", tmpbuf, 10, pBuffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) - pAd->CommonCfg.RadarDetect.DfsLowerLimit = simple_strtol(tmpbuf, 0, 10); - - DBGPRINT(RT_DEBUG_TRACE, ("DfsLowerLimit=%ld\n", pAd->CommonCfg.RadarDetect.DfsLowerLimit)); - } - - // DfsUpperLimit - if(RTMPGetKeyParameter("DfsUpperLimit", tmpbuf, 10, pBuffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) - pAd->CommonCfg.RadarDetect.DfsUpperLimit = simple_strtol(tmpbuf, 0, 10); - - DBGPRINT(RT_DEBUG_TRACE, ("DfsUpperLimit=%ld\n", pAd->CommonCfg.RadarDetect.DfsUpperLimit)); - } - - // FixDfsLimit - if(RTMPGetKeyParameter("FixDfsLimit", tmpbuf, 10, pBuffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) - pAd->CommonCfg.RadarDetect.FixDfsLimit = TRUE; - else - pAd->CommonCfg.RadarDetect.FixDfsLimit = FALSE; - - DBGPRINT(RT_DEBUG_TRACE, ("FixDfsLimit=%d\n", pAd->CommonCfg.RadarDetect.FixDfsLimit)); - } - - // LongPulseRadarTh - if(RTMPGetKeyParameter("LongPulseRadarTh", tmpbuf, 10, pBuffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) - pAd->CommonCfg.RadarDetect.LongPulseRadarTh = simple_strtol(tmpbuf, 0, 10); - - DBGPRINT(RT_DEBUG_TRACE, ("LongPulseRadarTh=%d\n", pAd->CommonCfg.RadarDetect.LongPulseRadarTh)); - } - - // AvgRssiReq - if(RTMPGetKeyParameter("AvgRssiReq", tmpbuf, 10, pBuffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) - pAd->CommonCfg.RadarDetect.AvgRssiReq = simple_strtol(tmpbuf, 0, 10); - - DBGPRINT(RT_DEBUG_TRACE, ("AvgRssiReq=%d\n", pAd->CommonCfg.RadarDetect.AvgRssiReq)); - } - -#endif // MERGE_ARCH_TEAM // - - //RDRegion - if(RTMPGetKeyParameter("RDRegion", tmpbuf, 128, pBuffer, TRUE)) - { - RADAR_DETECT_STRUCT *pRadarDetect = &pAd->CommonCfg.RadarDetect; - if ((strncmp(tmpbuf, "JAP_W53", 7) == 0) || (strncmp(tmpbuf, "jap_w53", 7) == 0)) - { - pRadarDetect->RDDurRegion = JAP_W53; - pRadarDetect->DfsSessionTime = 15; - } - else if ((strncmp(tmpbuf, "JAP_W56", 7) == 0) || (strncmp(tmpbuf, "jap_w56", 7) == 0)) - { - pRadarDetect->RDDurRegion = JAP_W56; - pRadarDetect->DfsSessionTime = 13; - } - else if ((strncmp(tmpbuf, "JAP", 3) == 0) || (strncmp(tmpbuf, "jap", 3) == 0)) - { - pRadarDetect->RDDurRegion = JAP; - pRadarDetect->DfsSessionTime = 5; - } - else if ((strncmp(tmpbuf, "FCC", 3) == 0) || (strncmp(tmpbuf, "fcc", 3) == 0)) - { - pRadarDetect->RDDurRegion = FCC; - pRadarDetect->DfsSessionTime = 5; -#ifdef DFS_FCC_BW40_FIX - pRadarDetect->DfsSessionFccOff = 0; -#endif // DFS_FCC_BW40_FIX // - } - else if ((strncmp(tmpbuf, "CE", 2) == 0) || (strncmp(tmpbuf, "ce", 2) == 0)) - { - pRadarDetect->RDDurRegion = CE; - pRadarDetect->DfsSessionTime = 13; - } - else - { - pRadarDetect->RDDurRegion = CE; - pRadarDetect->DfsSessionTime = 13; - } - - DBGPRINT(RT_DEBUG_TRACE, ("RDRegion=%d\n", pRadarDetect->RDDurRegion)); - } - else - { - pAd->CommonCfg.RadarDetect.RDDurRegion = CE; - pAd->CommonCfg.RadarDetect.DfsSessionTime = 13; - } - - //WirelessEvent - if(RTMPGetKeyParameter("WirelessEvent", tmpbuf, 10, pBuffer, TRUE)) - { -#if WIRELESS_EXT >= 15 - if(simple_strtol(tmpbuf, 0, 10) != 0) - pAd->CommonCfg.bWirelessEvent = simple_strtol(tmpbuf, 0, 10); - else - pAd->CommonCfg.bWirelessEvent = 0; // disable -#else - pAd->CommonCfg.bWirelessEvent = 0; // disable -#endif - DBGPRINT(RT_DEBUG_TRACE, ("WirelessEvent=%d\n", pAd->CommonCfg.bWirelessEvent)); - } - if(RTMPGetKeyParameter("WiFiTest", tmpbuf, 10, pBuffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) - pAd->CommonCfg.bWiFiTest= simple_strtol(tmpbuf, 0, 10); - else - pAd->CommonCfg.bWiFiTest = 0; // disable - - DBGPRINT(RT_DEBUG_TRACE, ("WiFiTest=%d\n", pAd->CommonCfg.bWiFiTest)); - } - //AuthMode - if(RTMPGetKeyParameter("AuthMode", tmpbuf, 128, pBuffer, TRUE)) - { -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if ((strcmp(tmpbuf, "WEPAUTO") == 0) || (strcmp(tmpbuf, "wepauto") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeAutoSwitch; - else if ((strcmp(tmpbuf, "SHARED") == 0) || (strcmp(tmpbuf, "shared") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeShared; - else if ((strcmp(tmpbuf, "WPAPSK") == 0) || (strcmp(tmpbuf, "wpapsk") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPAPSK; - else if ((strcmp(tmpbuf, "WPANONE") == 0) || (strcmp(tmpbuf, "wpanone") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPANone; - else if ((strcmp(tmpbuf, "WPA2PSK") == 0) || (strcmp(tmpbuf, "wpa2psk") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPA2PSK; -#ifdef WPA_SUPPLICANT_SUPPORT - else if ((strcmp(tmpbuf, "WPA") == 0) || (strcmp(tmpbuf, "wpa") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPA; - else if ((strcmp(tmpbuf, "WPA2") == 0) || (strcmp(tmpbuf, "wpa2") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPA2; -#endif // WPA_SUPPLICANT_SUPPORT // - else - pAd->StaCfg.AuthMode = Ndis802_11AuthModeOpen; - - pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - - DBGPRINT(RT_DEBUG_TRACE, ("%s::(EncrypType=%d)\n", __FUNCTION__, pAd->StaCfg.WepStatus)); - } -#endif // CONFIG_STA_SUPPORT // - } - //EncrypType - if(RTMPGetKeyParameter("EncrypType", tmpbuf, 128, pBuffer, TRUE)) - { - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if ((strcmp(tmpbuf, "WEP") == 0) || (strcmp(tmpbuf, "wep") == 0)) - pAd->StaCfg.WepStatus = Ndis802_11WEPEnabled; - else if ((strcmp(tmpbuf, "TKIP") == 0) || (strcmp(tmpbuf, "tkip") == 0)) - pAd->StaCfg.WepStatus = Ndis802_11Encryption2Enabled; - else if ((strcmp(tmpbuf, "AES") == 0) || (strcmp(tmpbuf, "aes") == 0)) - pAd->StaCfg.WepStatus = Ndis802_11Encryption3Enabled; - else - pAd->StaCfg.WepStatus = Ndis802_11WEPDisabled; - - // Update all wepstatus related - pAd->StaCfg.PairCipher = pAd->StaCfg.WepStatus; - pAd->StaCfg.GroupCipher = pAd->StaCfg.WepStatus; - pAd->StaCfg.OrigWepStatus = pAd->StaCfg.WepStatus; - pAd->StaCfg.bMixCipher = FALSE; - - //RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, 0); - DBGPRINT(RT_DEBUG_TRACE, ("%s::(EncrypType=%d)\n", __FUNCTION__, pAd->StaCfg.WepStatus)); - } -#endif // CONFIG_STA_SUPPORT // - } - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if(RTMPGetKeyParameter("WPAPSK", tmpbuf, 512, pBuffer, FALSE)) - { - int ret = TRUE; - - tmpbuf[strlen(tmpbuf)] = '\0'; // make STA can process .$^& for WPAPSK input - - if ((pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPAPSK) && - (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPA2PSK) && - (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPANone) - ) - { - ret = FALSE; - } - else - { - ret = RT_CfgSetWPAPSKKey(pAd, tmpbuf, (PUCHAR)pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen, pAd->StaCfg.PMK); - } - - if (ret == TRUE) - { - RTMPZeroMemory(pAd->StaCfg.WpaPassPhrase, 64); - RTMPMoveMemory(pAd->StaCfg.WpaPassPhrase, tmpbuf, strlen(tmpbuf)); - pAd->StaCfg.WpaPassPhraseLen= strlen(tmpbuf); - - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - // Start STA supplicant state machine - pAd->StaCfg.WpaState = SS_START; - } - else if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) - { - pAd->StaCfg.WpaState = SS_NOTUSE; - } - DBGPRINT(RT_DEBUG_TRACE, ("%s::(WPAPSK=%s)\n", __FUNCTION__, tmpbuf)); - } - } - } -#endif // CONFIG_STA_SUPPORT // - - //DefaultKeyID, KeyType, KeyStr - rtmp_read_key_parms_from_file(pAd, tmpbuf, pBuffer); - - - //HSCounter - /*if(RTMPGetKeyParameter("HSCounter", tmpbuf, 10, pBuffer, TRUE)) - { - switch (simple_strtol(tmpbuf, 0, 10)) - { - case 1: //Enable - pAd->CommonCfg.bEnableHSCounter = TRUE; - break; - case 0: //Disable - default: - pAd->CommonCfg.bEnableHSCounter = FALSE; - break; - } - DBGPRINT(RT_DEBUG_TRACE, "HSCounter=%d\n", pAd->CommonCfg.bEnableHSCounter); - }*/ - -#ifdef DOT11_N_SUPPORT - HTParametersHook(pAd, tmpbuf, pBuffer); -#endif // DOT11_N_SUPPORT // - - -#ifdef CARRIER_DETECTION_SUPPORT - //CarrierDetect - if(RTMPGetKeyParameter("CarrierDetect", tmpbuf, 128, pBuffer, TRUE)) - { - if ((strncmp(tmpbuf, "0", 1) == 0)) - pAd->CommonCfg.CarrierDetect.Enable = FALSE; - else if ((strncmp(tmpbuf, "1", 1) == 0)) - pAd->CommonCfg.CarrierDetect.Enable = TRUE; - else - pAd->CommonCfg.CarrierDetect.Enable = FALSE; - - DBGPRINT(RT_DEBUG_TRACE, ("CarrierDetect.Enable=%d\n", pAd->CommonCfg.CarrierDetect.Enable)); - } - else - pAd->CommonCfg.CarrierDetect.Enable = FALSE; -#endif // CARRIER_DETECTION_SUPPORT // - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - //PSMode - if (RTMPGetKeyParameter("PSMode", tmpbuf, 10, pBuffer, TRUE)) - { - if (pAd->StaCfg.BssType == BSS_INFRA) - { - if ((strcmp(tmpbuf, "MAX_PSP") == 0) || (strcmp(tmpbuf, "max_psp") == 0)) - { - // do NOT turn on PSM bit here, wait until MlmeCheckForPsmChange() - // to exclude certain situations. - // MlmeSetPsm(pAd, PWR_SAVE); - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); - if (pAd->StaCfg.bWindowsACCAMEnable == FALSE) - pAd->StaCfg.WindowsPowerMode = Ndis802_11PowerModeMAX_PSP; - pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeMAX_PSP; - pAd->StaCfg.DefaultListenCount = 5; - } - else if ((strcmp(tmpbuf, "Fast_PSP") == 0) || (strcmp(tmpbuf, "fast_psp") == 0) - || (strcmp(tmpbuf, "FAST_PSP") == 0)) - { - // do NOT turn on PSM bit here, wait until MlmeCheckForPsmChange() - // to exclude certain situations. - // MlmeSetPsmBit(pAd, PWR_SAVE); - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); - if (pAd->StaCfg.bWindowsACCAMEnable == FALSE) - pAd->StaCfg.WindowsPowerMode = Ndis802_11PowerModeFast_PSP; - pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeFast_PSP; - pAd->StaCfg.DefaultListenCount = 3; - } - else if ((strcmp(tmpbuf, "Legacy_PSP") == 0) || (strcmp(tmpbuf, "legacy_psp") == 0) - || (strcmp(tmpbuf, "LEGACY_PSP") == 0)) - { - // do NOT turn on PSM bit here, wait until MlmeCheckForPsmChange() - // to exclude certain situations. - // MlmeSetPsmBit(pAd, PWR_SAVE); - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); - if (pAd->StaCfg.bWindowsACCAMEnable == FALSE) - pAd->StaCfg.WindowsPowerMode = Ndis802_11PowerModeLegacy_PSP; - pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeLegacy_PSP; - pAd->StaCfg.DefaultListenCount = 3; - } - else - { //Default Ndis802_11PowerModeCAM - // clear PSM bit immediately - RTMP_SET_PSM_BIT(pAd, PWR_ACTIVE); - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); - if (pAd->StaCfg.bWindowsACCAMEnable == FALSE) - pAd->StaCfg.WindowsPowerMode = Ndis802_11PowerModeCAM; - pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeCAM; - } - DBGPRINT(RT_DEBUG_TRACE, ("PSMode=%ld\n", pAd->StaCfg.WindowsPowerMode)); - } - } - // AutoRoaming by RSSI - if (RTMPGetKeyParameter("AutoRoaming", tmpbuf, 32, pBuffer, TRUE)) - { - if (simple_strtol(tmpbuf, 0, 10) == 0) - pAd->StaCfg.bAutoRoaming = FALSE; - else - pAd->StaCfg.bAutoRoaming = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, ("AutoRoaming=%d\n", pAd->StaCfg.bAutoRoaming)); - } - // RoamThreshold - if (RTMPGetKeyParameter("RoamThreshold", tmpbuf, 32, pBuffer, TRUE)) - { - long lInfo = simple_strtol(tmpbuf, 0, 10); - - if (lInfo > 90 || lInfo < 60) - pAd->StaCfg.dBmToRoam = -70; - else - pAd->StaCfg.dBmToRoam = (CHAR)(-1)*lInfo; - - DBGPRINT(RT_DEBUG_TRACE, ("RoamThreshold=%d dBm\n", pAd->StaCfg.dBmToRoam)); - } - - if(RTMPGetKeyParameter("TGnWifiTest", tmpbuf, 10, pBuffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) == 0) - pAd->StaCfg.bTGnWifiTest = FALSE; - else - pAd->StaCfg.bTGnWifiTest = TRUE; - DBGPRINT(RT_DEBUG_TRACE, ("TGnWifiTest=%d\n", pAd->StaCfg.bTGnWifiTest)); - } - - // Beacon Lost Time - if (RTMPGetKeyParameter("BeaconLostTime", tmpbuf, 32, pBuffer, TRUE)) - { - ULONG lInfo = (ULONG)simple_strtol(tmpbuf, 0, 10); - - if ((lInfo != 0) && (lInfo <= 60)) - pAd->StaCfg.BeaconLostTime = (lInfo * OS_HZ); - DBGPRINT(RT_DEBUG_TRACE, ("BeaconLostTime=%ld \n", pAd->StaCfg.BeaconLostTime)); - } - - - } -#endif // CONFIG_STA_SUPPORT // - - - -#ifdef RT30xx -#ifdef ANT_DIVERSITY_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if(RTMPGetKeyParameter("AntDiversity", tmpbuf, 10, pBuffer, TRUE)) - { - for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++) - { - UCHAR Ant = simple_strtol(tmpbuf, 0, 10); - if(Ant < 3) - pAd->CommonCfg.bRxAntDiversity = Ant; - else - pAd->CommonCfg.bRxAntDiversity = ANT_DIVERSITY_DISABLE; - - DBGPRINT(RT_DEBUG_ERROR, ("AntDiversity=%d\n", pAd->CommonCfg.bRxAntDiversity)); - } - } - } -#endif // ANT_DIVERSITY_SUPPORT // -#endif // RT30xx // - - }while(0); - - - kfree(tmpbuf); - - return NDIS_STATUS_SUCCESS; - -} - - -#ifdef MULTIPLE_CARD_SUPPORT -// record whether the card in the card list is used in the card file -UINT8 MC_CardUsed[MAX_NUM_OF_MULTIPLE_CARD]; -// record used card mac address in the card list -static UINT8 MC_CardMac[MAX_NUM_OF_MULTIPLE_CARD][6]; - -/* -======================================================================== -Routine Description: - Get card profile path. - -Arguments: - pAd - -Return Value: - TRUE - Find a card profile - FALSE - use default profile - -Note: -======================================================================== -*/ -BOOLEAN RTMP_CardInfoRead( - IN PRTMP_ADAPTER pAd) -{ -#define MC_SELECT_CARDID 0 /* use CARD ID (0 ~ 31) to identify different cards */ -#define MC_SELECT_MAC 1 /* use CARD MAC to identify different cards */ -#define MC_SELECT_CARDTYPE 2 /* use CARD type (abgn or bgn) to identify different cards */ - -#define LETTER_CASE_TRANSLATE(txt_p, card_id) \ - { UINT32 _len; char _char; \ - for(_len=0; _lenEEPROMAddressNum = 6; // 93C46 - else if ((data & 0x30) == 0x10) - pAd->EEPROMAddressNum = 8; // 93C66 - else - pAd->EEPROMAddressNum = 8; // 93C86 - - RT28xx_EEPROM_READ16(pAd, EEPROM_NIC1_OFFSET, antenna.word); - - if ((antenna.field.RfIcType == RFIC_2850) || - (antenna.field.RfIcType == RFIC_2750)) - { - /* ABGN card */ - strcpy(RFIC_word, "abgn"); - } - else - { - /* BGN card */ - strcpy(RFIC_word, "bgn"); - } - - // get MAC address - RT28xx_EEPROM_READ16(pAd, 0x04, addr01); - RT28xx_EEPROM_READ16(pAd, 0x06, addr23); - RT28xx_EEPROM_READ16(pAd, 0x08, addr45); - - mac[0] = (UCHAR)(addr01 & 0xff); - mac[1] = (UCHAR)(addr01 >> 8); - mac[2] = (UCHAR)(addr23 & 0xff); - mac[3] = (UCHAR)(addr23 >> 8); - mac[4] = (UCHAR)(addr45 & 0xff); - mac[5] = (UCHAR)(addr45 >> 8); - - DBGPRINT(RT_DEBUG_TRACE, ("mac addr=%02x:%02x:%02x:%02x:%02x:%02x!\n", PRINT_MAC(mac))); - - RtmpOSFSInfoChange(&osFSInfo, TRUE); - // open card information file - srcf = RtmpOSFileOpen(CARD_INFO_PATH, O_RDONLY, 0); - if (IS_FILE_OPEN_ERR(srcf)) - { - /* card information file does not exist */ - DBGPRINT(RT_DEBUG_TRACE, - ("--> Error opening %s\n", CARD_INFO_PATH)); - goto free_resource; - } - - /* card information file exists so reading the card information */ - memset(buffer, 0x00, MAX_INI_BUFFER_SIZE); - retval = RtmpOSFileRead(srcf, buffer, MAX_INI_BUFFER_SIZE); - if (retval < 0) - { - /* read fail */ - DBGPRINT(RT_DEBUG_TRACE, - ("--> Read %s error %d\n", CARD_INFO_PATH, -retval)); - } - else - { - /* get card selection method */ - memset(tmpbuf, 0x00, MAX_PARAM_BUFFER_SIZE); - card_select_method = MC_SELECT_CARDTYPE; // default - - if (RTMPGetKeyParameter("SELECT", tmpbuf, 256, buffer, TRUE)) - { - if (strcmp(tmpbuf, "CARDID") == 0) - card_select_method = MC_SELECT_CARDID; - else if (strcmp(tmpbuf, "MAC") == 0) - card_select_method = MC_SELECT_MAC; - else if (strcmp(tmpbuf, "CARDTYPE") == 0) - card_select_method = MC_SELECT_CARDTYPE; - } - - DBGPRINT(RT_DEBUG_TRACE, - ("MC> Card Selection = %d\n", card_select_method)); - - // init - card_free_id = -1; - card_nouse_id = -1; - card_same_mac_id = -1; - card_match_id = -1; - - // search current card information records - for(card_index=0; - card_index Free = %d, Same = %d, NOUSE = %d\n", - card_free_id, card_same_mac_id, card_nouse_id)); - - if ((card_same_mac_id >= 0) && - ((card_select_method == MC_SELECT_CARDID) || - (card_select_method == MC_SELECT_CARDTYPE))) - { - // same MAC entry is found - card_match_id = card_same_mac_id; - - if (card_select_method == MC_SELECT_CARDTYPE) - { - // for CARDTYPE - sprintf(card_id_buf, "%02dCARDTYPE%s", - card_match_id, RFIC_word); - - if ((start_ptr = (PUCHAR)rtstrstruncasecmp(buffer, card_id_buf)) != NULL) - { - // we found the card ID - LETTER_CASE_TRANSLATE(start_ptr, card_id_buf); - } - } - } - else - { - // the card is 1st plug-in, try to find the match card profile - switch(card_select_method) - { - case MC_SELECT_CARDID: // CARDID - default: - if (card_free_id >= 0) - card_match_id = card_free_id; - else - card_match_id = card_nouse_id; - break; - - case MC_SELECT_MAC: // MAC - sprintf(card_id_buf, "MAC%02x:%02x:%02x:%02x:%02x:%02x", - mac[0], mac[1], mac[2], - mac[3], mac[4], mac[5]); - - /* try to find the key word in the card file */ - if ((start_ptr = (PUCHAR)rtstrstruncasecmp(buffer, card_id_buf)) != NULL) - { - LETTER_CASE_TRANSLATE(start_ptr, card_id_buf); - - /* get the row ID (2 ASCII characters) */ - start_ptr -= 2; - card_id_buf[0] = *(start_ptr); - card_id_buf[1] = *(start_ptr+1); - card_id_buf[2] = 0x00; - - card_match_id = simple_strtol(card_id_buf, 0, 10); - } - break; - - case MC_SELECT_CARDTYPE: // CARDTYPE - card_nouse_id = -1; - - for(card_index=0; - card_index= 0) - { - // make up search keyword - switch(card_select_method) - { - case MC_SELECT_CARDID: // CARDID - sprintf(card_id_buf, "%02dCARDID", card_match_id); - break; - - case MC_SELECT_MAC: // MAC - sprintf(card_id_buf, - "%02dmac%02x:%02x:%02x:%02x:%02x:%02x", - card_match_id, - mac[0], mac[1], mac[2], - mac[3], mac[4], mac[5]); - break; - - case MC_SELECT_CARDTYPE: // CARDTYPE - default: - sprintf(card_id_buf, "%02dcardtype%s", - card_match_id, RFIC_word); - break; - } - - DBGPRINT(RT_DEBUG_TRACE, ("Search Keyword = %s\n", card_id_buf)); - - // read card file path - if (RTMPGetKeyParameter(card_id_buf, tmpbuf, 256, buffer, TRUE)) - { - if (strlen(tmpbuf) < sizeof(pAd->MC_FileName)) - { - // backup card information - pAd->MC_RowID = card_match_id; /* base 0 */ - MC_CardUsed[card_match_id] = 1; - memcpy(MC_CardMac[card_match_id], mac, sizeof(mac)); - - // backup card file path - NdisMoveMemory(pAd->MC_FileName, tmpbuf , strlen(tmpbuf)); - pAd->MC_FileName[strlen(tmpbuf)] = '\0'; - flg_match_ok = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, - ("Card Profile Name = %s\n", pAd->MC_FileName)); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, - ("Card Profile Name length too large!\n")); - } - } - else - { - DBGPRINT(RT_DEBUG_ERROR, - ("Can not find search key word in card.dat!\n")); - } - - if ((flg_match_ok != TRUE) && - (card_match_id < MAX_NUM_OF_MULTIPLE_CARD)) - { - MC_CardUsed[card_match_id] = 0; - memset(MC_CardMac[card_match_id], 0, sizeof(mac)); - } - } // if (card_match_id >= 0) - } - - - // close file - retval = RtmpOSFileClose(srcf); - -free_resource: - RtmpOSFSInfoChange(&osFSInfo, FALSE); - kfree(buffer); - kfree(tmpbuf); - - return flg_match_ok; -} -#endif // MULTIPLE_CARD_SUPPORT // diff --git a/drivers/staging/rt3090/common/cmm_sanity.c b/drivers/staging/rt3090/common/cmm_sanity.c deleted file mode 100644 index de631c38a44e..000000000000 --- a/drivers/staging/rt3090/common/cmm_sanity.c +++ /dev/null @@ -1,1718 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - sanity.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - John Chang 2004-09-01 add WMM support -*/ - -#include "../rt_config.h" - - -extern UCHAR CISCO_OUI[]; - -extern UCHAR WPA_OUI[]; -extern UCHAR RSN_OUI[]; -extern UCHAR WME_INFO_ELEM[]; -extern UCHAR WME_PARM_ELEM[]; -extern UCHAR Ccx2QosInfo[]; -extern UCHAR RALINK_OUI[]; -extern UCHAR BROADCOM_OUI[]; -extern UCHAR WPS_OUI[]; - -/* - ========================================================================== - Description: - MLME message sanity check - Return: - TRUE if all parameters are OK, FALSE otherwise - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -BOOLEAN MlmeAddBAReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2) -{ - PMLME_ADDBA_REQ_STRUCT pInfo; - - pInfo = (MLME_ADDBA_REQ_STRUCT *)Msg; - - if ((MsgLen != sizeof(MLME_ADDBA_REQ_STRUCT))) - { - DBGPRINT(RT_DEBUG_TRACE, ("MlmeAddBAReqSanity fail - message lenght not correct.\n")); - return FALSE; - } - - if ((pInfo->Wcid >= MAX_LEN_OF_MAC_TABLE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("MlmeAddBAReqSanity fail - The peer Mac is not associated yet.\n")); - return FALSE; - } - - /* - if ((pInfo->BaBufSize > MAX_RX_REORDERBUF) || (pInfo->BaBufSize < 2)) - { - DBGPRINT(RT_DEBUG_TRACE, ("MlmeAddBAReqSanity fail - Rx Reordering buffer too big or too small\n")); - return FALSE; - } - */ - - if ((pInfo->pAddr[0]&0x01) == 0x01) - { - DBGPRINT(RT_DEBUG_TRACE, ("MlmeAddBAReqSanity fail - broadcast address not support BA\n")); - return FALSE; - } - - return TRUE; -} - -/* - ========================================================================== - Description: - MLME message sanity check - Return: - TRUE if all parameters are OK, FALSE otherwise - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -BOOLEAN MlmeDelBAReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen) -{ - MLME_DELBA_REQ_STRUCT *pInfo; - pInfo = (MLME_DELBA_REQ_STRUCT *)Msg; - - if ((MsgLen != sizeof(MLME_DELBA_REQ_STRUCT))) - { - DBGPRINT(RT_DEBUG_ERROR, ("MlmeDelBAReqSanity fail - message lenght not correct.\n")); - return FALSE; - } - - if ((pInfo->Wcid >= MAX_LEN_OF_MAC_TABLE)) - { - DBGPRINT(RT_DEBUG_ERROR, ("MlmeDelBAReqSanity fail - The peer Mac is not associated yet.\n")); - return FALSE; - } - - if ((pInfo->TID & 0xf0)) - { - DBGPRINT(RT_DEBUG_ERROR, ("MlmeDelBAReqSanity fail - The peer TID is incorrect.\n")); - return FALSE; - } - - if (NdisEqualMemory(pAd->MacTab.Content[pInfo->Wcid].Addr, pInfo->Addr, MAC_ADDR_LEN) == 0) - { - DBGPRINT(RT_DEBUG_ERROR, ("MlmeDelBAReqSanity fail - the peer addr dosen't exist.\n")); - return FALSE; - } - - return TRUE; -} - -BOOLEAN PeerAddBAReqActionSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2) -{ - PFRAME_802_11 pFrame = (PFRAME_802_11)pMsg; - PFRAME_ADDBA_REQ pAddFrame; - pAddFrame = (PFRAME_ADDBA_REQ)(pMsg); - if (MsgLen < (sizeof(FRAME_ADDBA_REQ))) - { - DBGPRINT(RT_DEBUG_ERROR,("PeerAddBAReqActionSanity: ADDBA Request frame length size = %ld incorrect\n", MsgLen)); - return FALSE; - } - // we support immediate BA. -#ifdef UNALIGNMENT_SUPPORT - { - BA_PARM tmpBaParm; - - NdisMoveMemory((PUCHAR)(&tmpBaParm), (PUCHAR)(&pAddFrame->BaParm), sizeof(BA_PARM)); - *(USHORT *)(&tmpBaParm) = cpu2le16(*(USHORT *)(&tmpBaParm)); - NdisMoveMemory((PUCHAR)(&pAddFrame->BaParm), (PUCHAR)(&tmpBaParm), sizeof(BA_PARM)); - } -#else - *(USHORT *)(&pAddFrame->BaParm) = cpu2le16(*(USHORT *)(&pAddFrame->BaParm)); -#endif - pAddFrame->TimeOutValue = cpu2le16(pAddFrame->TimeOutValue); - pAddFrame->BaStartSeq.word = cpu2le16(pAddFrame->BaStartSeq.word); - - if (pAddFrame->BaParm.BAPolicy != IMMED_BA) - { - DBGPRINT(RT_DEBUG_ERROR,("PeerAddBAReqActionSanity: ADDBA Request Ba Policy[%d] not support\n", pAddFrame->BaParm.BAPolicy)); - DBGPRINT(RT_DEBUG_ERROR,("ADDBA Request. tid=%x, Bufsize=%x, AMSDUSupported=%x \n", pAddFrame->BaParm.TID, pAddFrame->BaParm.BufSize, pAddFrame->BaParm.AMSDUSupported)); - return FALSE; - } - - // we support immediate BA. - if (pAddFrame->BaParm.TID &0xfff0) - { - DBGPRINT(RT_DEBUG_ERROR,("PeerAddBAReqActionSanity: ADDBA Request incorrect TID = %d\n", pAddFrame->BaParm.TID)); - return FALSE; - } - COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); - return TRUE; -} - -BOOLEAN PeerAddBARspActionSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen) -{ - //PFRAME_802_11 pFrame = (PFRAME_802_11)pMsg; - PFRAME_ADDBA_RSP pAddFrame; - - pAddFrame = (PFRAME_ADDBA_RSP)(pMsg); - if (MsgLen < (sizeof(FRAME_ADDBA_RSP))) - { - DBGPRINT(RT_DEBUG_ERROR,("PeerAddBARspActionSanity: ADDBA Response frame length size = %ld incorrect\n", MsgLen)); - return FALSE; - } - // we support immediate BA. -#ifdef UNALIGNMENT_SUPPORT - { - BA_PARM tmpBaParm; - - NdisMoveMemory((PUCHAR)(&tmpBaParm), (PUCHAR)(&pAddFrame->BaParm), sizeof(BA_PARM)); - *(USHORT *)(&tmpBaParm) = cpu2le16(*(USHORT *)(&tmpBaParm)); - NdisMoveMemory((PUCHAR)(&pAddFrame->BaParm), (PUCHAR)(&tmpBaParm), sizeof(BA_PARM)); - } -#else - *(USHORT *)(&pAddFrame->BaParm) = cpu2le16(*(USHORT *)(&pAddFrame->BaParm)); -#endif - pAddFrame->StatusCode = cpu2le16(pAddFrame->StatusCode); - pAddFrame->TimeOutValue = cpu2le16(pAddFrame->TimeOutValue); - - if (pAddFrame->BaParm.BAPolicy != IMMED_BA) - { - DBGPRINT(RT_DEBUG_ERROR,("PeerAddBAReqActionSanity: ADDBA Response Ba Policy[%d] not support\n", pAddFrame->BaParm.BAPolicy)); - return FALSE; - } - - // we support immediate BA. - if (pAddFrame->BaParm.TID &0xfff0) - { - DBGPRINT(RT_DEBUG_ERROR,("PeerAddBARspActionSanity: ADDBA Response incorrect TID = %d\n", pAddFrame->BaParm.TID)); - return FALSE; - } - return TRUE; - -} - -BOOLEAN PeerDelBAActionSanity( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN VOID *pMsg, - IN ULONG MsgLen ) -{ - //PFRAME_802_11 pFrame = (PFRAME_802_11)pMsg; - PFRAME_DELBA_REQ pDelFrame; - if (MsgLen != (sizeof(FRAME_DELBA_REQ))) - return FALSE; - - if (Wcid >= MAX_LEN_OF_MAC_TABLE) - return FALSE; - - pDelFrame = (PFRAME_DELBA_REQ)(pMsg); - - *(USHORT *)(&pDelFrame->DelbaParm) = cpu2le16(*(USHORT *)(&pDelFrame->DelbaParm)); - pDelFrame->ReasonCode = cpu2le16(pDelFrame->ReasonCode); - - if (pDelFrame->DelbaParm.TID &0xfff0) - return FALSE; - - return TRUE; -} - -/* - ========================================================================== - Description: - MLME message sanity check - Return: - TRUE if all parameters are OK, FALSE otherwise - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -BOOLEAN PeerBeaconAndProbeRspSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - IN UCHAR MsgChannel, - OUT PUCHAR pAddr2, - OUT PUCHAR pBssid, - OUT CHAR Ssid[], - OUT UCHAR *pSsidLen, - OUT UCHAR *pBssType, - OUT USHORT *pBeaconPeriod, - OUT UCHAR *pChannel, - OUT UCHAR *pNewChannel, - OUT LARGE_INTEGER *pTimestamp, - OUT CF_PARM *pCfParm, - OUT USHORT *pAtimWin, - OUT USHORT *pCapabilityInfo, - OUT UCHAR *pErp, - OUT UCHAR *pDtimCount, - OUT UCHAR *pDtimPeriod, - OUT UCHAR *pBcastFlag, - OUT UCHAR *pMessageToMe, - OUT UCHAR SupRate[], - OUT UCHAR *pSupRateLen, - OUT UCHAR ExtRate[], - OUT UCHAR *pExtRateLen, - OUT UCHAR *pCkipFlag, - OUT UCHAR *pAironetCellPowerLimit, - OUT PEDCA_PARM pEdcaParm, - OUT PQBSS_LOAD_PARM pQbssLoad, - OUT PQOS_CAPABILITY_PARM pQosCapability, - OUT ULONG *pRalinkIe, - OUT UCHAR *pHtCapabilityLen, -#ifdef CONFIG_STA_SUPPORT - OUT UCHAR *pPreNHtCapabilityLen, -#endif // CONFIG_STA_SUPPORT // - OUT HT_CAPABILITY_IE *pHtCapability, - OUT UCHAR *AddHtInfoLen, - OUT ADD_HT_INFO_IE *AddHtInfo, - OUT UCHAR *NewExtChannelOffset, // Ht extension channel offset(above or below) - OUT USHORT *LengthVIE, - OUT PNDIS_802_11_VARIABLE_IEs pVIE) -{ - UCHAR *Ptr; -#ifdef CONFIG_STA_SUPPORT - UCHAR TimLen; -#endif // CONFIG_STA_SUPPORT // - PFRAME_802_11 pFrame; - PEID_STRUCT pEid; - UCHAR SubType; - UCHAR Sanity; - //UCHAR ECWMin, ECWMax; - //MAC_CSR9_STRUC Csr9; - ULONG Length = 0; - - // For some 11a AP which didn't have DS_IE, we use two conditions to decide the channel - // 1. If the AP is 11n enabled, then check the control channel. - // 2. If the AP didn't have any info about channel, use the channel we received this frame as the channel. (May inaccuracy!!) - UCHAR CtrlChannel = 0; - - // Add for 3 necessary EID field check - Sanity = 0; - - *pAtimWin = 0; - *pErp = 0; - *pDtimCount = 0; - *pDtimPeriod = 0; - *pBcastFlag = 0; - *pMessageToMe = 0; - *pExtRateLen = 0; - *pCkipFlag = 0; // Default of CkipFlag is 0 - *pAironetCellPowerLimit = 0xFF; // Default of AironetCellPowerLimit is 0xFF - *LengthVIE = 0; // Set the length of VIE to init value 0 - *pHtCapabilityLen = 0; // Set the length of VIE to init value 0 -#ifdef CONFIG_STA_SUPPORT - if (pAd->OpMode == OPMODE_STA) - *pPreNHtCapabilityLen = 0; // Set the length of VIE to init value 0 -#endif // CONFIG_STA_SUPPORT // - *AddHtInfoLen = 0; // Set the length of VIE to init value 0 - *pRalinkIe = 0; - *pNewChannel = 0; - *NewExtChannelOffset = 0xff; //Default 0xff means no such IE - pCfParm->bValid = FALSE; // default: no IE_CF found - pQbssLoad->bValid = FALSE; // default: no IE_QBSS_LOAD found - pEdcaParm->bValid = FALSE; // default: no IE_EDCA_PARAMETER found - pQosCapability->bValid = FALSE; // default: no IE_QOS_CAPABILITY found - - pFrame = (PFRAME_802_11)Msg; - - // get subtype from header - SubType = (UCHAR)pFrame->Hdr.FC.SubType; - - // get Addr2 and BSSID from header - COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); - COPY_MAC_ADDR(pBssid, pFrame->Hdr.Addr3); - -// hex_dump("Beacon", Msg, MsgLen); - - Ptr = pFrame->Octet; - Length += LENGTH_802_11; - - // get timestamp from payload and advance the pointer - NdisMoveMemory(pTimestamp, Ptr, TIMESTAMP_LEN); - - pTimestamp->u.LowPart = cpu2le32(pTimestamp->u.LowPart); - pTimestamp->u.HighPart = cpu2le32(pTimestamp->u.HighPart); - - Ptr += TIMESTAMP_LEN; - Length += TIMESTAMP_LEN; - - // get beacon interval from payload and advance the pointer - NdisMoveMemory(pBeaconPeriod, Ptr, 2); - Ptr += 2; - Length += 2; - - // get capability info from payload and advance the pointer - NdisMoveMemory(pCapabilityInfo, Ptr, 2); - Ptr += 2; - Length += 2; - - if (CAP_IS_ESS_ON(*pCapabilityInfo)) - *pBssType = BSS_INFRA; - else - *pBssType = BSS_ADHOC; - - pEid = (PEID_STRUCT) Ptr; - - // get variable fields from payload and advance the pointer - while ((Length + 2 + pEid->Len) <= MsgLen) - { - // - // Secure copy VIE to VarIE[MAX_VIE_LEN] didn't overflow. - // - if ((*LengthVIE + pEid->Len + 2) >= MAX_VIE_LEN) - { - DBGPRINT(RT_DEBUG_WARN, ("PeerBeaconAndProbeRspSanity - Variable IEs out of resource [len(=%d) > MAX_VIE_LEN(=%d)]\n", - (*LengthVIE + pEid->Len + 2), MAX_VIE_LEN)); - break; - } - - switch(pEid->Eid) - { - case IE_SSID: - // Already has one SSID EID in this beacon, ignore the second one - if (Sanity & 0x1) - break; - if(pEid->Len <= MAX_LEN_OF_SSID) - { - NdisMoveMemory(Ssid, pEid->Octet, pEid->Len); - *pSsidLen = pEid->Len; - Sanity |= 0x1; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAndProbeRspSanity - wrong IE_SSID (len=%d)\n",pEid->Len)); - return FALSE; - } - break; - - case IE_SUPP_RATES: - if(pEid->Len <= MAX_LEN_OF_SUPPORTED_RATES) - { - Sanity |= 0x2; - NdisMoveMemory(SupRate, pEid->Octet, pEid->Len); - *pSupRateLen = pEid->Len; - - // TODO: 2004-09-14 not a good design here, cause it exclude extra rates - // from ScanTab. We should report as is. And filter out unsupported - // rates in MlmeAux. - // Check against the supported rates - // RTMPCheckRates(pAd, SupRate, pSupRateLen); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAndProbeRspSanity - wrong IE_SUPP_RATES (len=%d)\n",pEid->Len)); - return FALSE; - } - break; - - case IE_HT_CAP: - if (pEid->Len >= SIZE_HT_CAP_IE) //Note: allow extension.!! - { - NdisMoveMemory(pHtCapability, pEid->Octet, sizeof(HT_CAPABILITY_IE)); - *pHtCapabilityLen = SIZE_HT_CAP_IE; // Nnow we only support 26 bytes. - - *(USHORT *)(&pHtCapability->HtCapInfo) = cpu2le16(*(USHORT *)(&pHtCapability->HtCapInfo)); -#ifdef UNALIGNMENT_SUPPORT - { - EXT_HT_CAP_INFO extHtCapInfo; - NdisMoveMemory((PUCHAR)(&extHtCapInfo), (PUCHAR)(&pHtCapability->ExtHtCapInfo), sizeof(EXT_HT_CAP_INFO)); - *(USHORT *)(&extHtCapInfo) = cpu2le16(*(USHORT *)(&extHtCapInfo)); - NdisMoveMemory((PUCHAR)(&pHtCapability->ExtHtCapInfo), (PUCHAR)(&extHtCapInfo), sizeof(EXT_HT_CAP_INFO)); - } -#else - *(USHORT *)(&pHtCapability->ExtHtCapInfo) = cpu2le16(*(USHORT *)(&pHtCapability->ExtHtCapInfo)); -#endif // UNALIGNMENT_SUPPORT // - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - *pPreNHtCapabilityLen = 0; // Now we only support 26 bytes. - - Ptr = (PUCHAR) pVIE; - NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid, pEid->Len + 2); - *LengthVIE += (pEid->Len + 2); - } -#endif // CONFIG_STA_SUPPORT // - } - else - { - DBGPRINT(RT_DEBUG_WARN, ("PeerBeaconAndProbeRspSanity - wrong IE_HT_CAP. pEid->Len = %d\n", pEid->Len)); - } - - break; - case IE_ADD_HT: - if (pEid->Len >= sizeof(ADD_HT_INFO_IE)) - { - // This IE allows extension, but we can ignore extra bytes beyond our knowledge , so only - // copy first sizeof(ADD_HT_INFO_IE) - NdisMoveMemory(AddHtInfo, pEid->Octet, sizeof(ADD_HT_INFO_IE)); - *AddHtInfoLen = SIZE_ADD_HT_INFO_IE; - - CtrlChannel = AddHtInfo->ControlChan; - - *(USHORT *)(&AddHtInfo->AddHtInfo2) = cpu2le16(*(USHORT *)(&AddHtInfo->AddHtInfo2)); - *(USHORT *)(&AddHtInfo->AddHtInfo3) = cpu2le16(*(USHORT *)(&AddHtInfo->AddHtInfo3)); - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - Ptr = (PUCHAR) pVIE; - NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid, pEid->Len + 2); - *LengthVIE += (pEid->Len + 2); - } -#endif // CONFIG_STA_SUPPORT // - } - else - { - DBGPRINT(RT_DEBUG_WARN, ("PeerBeaconAndProbeRspSanity - wrong IE_ADD_HT. \n")); - } - - break; - case IE_SECONDARY_CH_OFFSET: - if (pEid->Len == 1) - { - *NewExtChannelOffset = pEid->Octet[0]; - } - else - { - DBGPRINT(RT_DEBUG_WARN, ("PeerBeaconAndProbeRspSanity - wrong IE_SECONDARY_CH_OFFSET. \n")); - } - - break; - case IE_FH_PARM: - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAndProbeRspSanity(IE_FH_PARM) \n")); - break; - - case IE_DS_PARM: - if(pEid->Len == 1) - { - *pChannel = *pEid->Octet; -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (ChannelSanity(pAd, *pChannel) == 0) - { - - return FALSE; - } - } -#endif // CONFIG_STA_SUPPORT // - Sanity |= 0x4; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAndProbeRspSanity - wrong IE_DS_PARM (len=%d)\n",pEid->Len)); - return FALSE; - } - break; - - case IE_CF_PARM: - if(pEid->Len == 6) - { - pCfParm->bValid = TRUE; - pCfParm->CfpCount = pEid->Octet[0]; - pCfParm->CfpPeriod = pEid->Octet[1]; - pCfParm->CfpMaxDuration = pEid->Octet[2] + 256 * pEid->Octet[3]; - pCfParm->CfpDurRemaining = pEid->Octet[4] + 256 * pEid->Octet[5]; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAndProbeRspSanity - wrong IE_CF_PARM\n")); - return FALSE; - } - break; - - case IE_IBSS_PARM: - if(pEid->Len == 2) - { - NdisMoveMemory(pAtimWin, pEid->Octet, pEid->Len); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAndProbeRspSanity - wrong IE_IBSS_PARM\n")); - return FALSE; - } - break; - -#ifdef CONFIG_STA_SUPPORT - case IE_TIM: - if(INFRA_ON(pAd) && SubType == SUBTYPE_BEACON) - { - GetTimBit((PCHAR)pEid, pAd->StaActive.Aid, &TimLen, pBcastFlag, pDtimCount, pDtimPeriod, pMessageToMe); - } - break; -#endif // CONFIG_STA_SUPPORT // - case IE_CHANNEL_SWITCH_ANNOUNCEMENT: - if(pEid->Len == 3) - { - *pNewChannel = pEid->Octet[1]; //extract new channel number - } - break; - - // New for WPA - // CCX v2 has the same IE, we need to parse that too - // Wifi WMM use the same IE vale, need to parse that too - // case IE_WPA: - case IE_VENDOR_SPECIFIC: - // Check Broadcom/Atheros 802.11n OUI version, for HT Capability IE. - // This HT IE is before IEEE draft set HT IE value.2006-09-28 by Jan. - /*if (NdisEqualMemory(pEid->Octet, BROADCOM_OUI, 3) && (pEid->Len >= 4)) - { - if ((pEid->Octet[3] == OUI_BROADCOM_HT) && (pEid->Len >= 30)) - { - { - NdisMoveMemory(pHtCapability, &pEid->Octet[4], sizeof(HT_CAPABILITY_IE)); - *pHtCapabilityLen = SIZE_HT_CAP_IE; // Nnow we only support 26 bytes. - } - } - if ((pEid->Octet[3] == OUI_BROADCOM_HT) && (pEid->Len >= 26)) - { - { - NdisMoveMemory(AddHtInfo, &pEid->Octet[4], sizeof(ADD_HT_INFO_IE)); - *AddHtInfoLen = SIZE_ADD_HT_INFO_IE; // Nnow we only support 26 bytes. - } - } - } - */ - // Check the OUI version, filter out non-standard usage - if (NdisEqualMemory(pEid->Octet, RALINK_OUI, 3) && (pEid->Len == 7)) - { - //*pRalinkIe = pEid->Octet[3]; - if (pEid->Octet[3] != 0) - *pRalinkIe = pEid->Octet[3]; - else - *pRalinkIe = 0xf0000000; // Set to non-zero value (can't set bit0-2) to represent this is Ralink Chip. So at linkup, we will set ralinkchip flag. - } -#ifdef CONFIG_STA_SUPPORT -#ifdef DOT11_N_SUPPORT - // This HT IE is before IEEE draft set HT IE value.2006-09-28 by Jan. - - // Other vendors had production before IE_HT_CAP value is assigned. To backward support those old-firmware AP, - // Check broadcom-defiend pre-802.11nD1.0 OUI for HT related IE, including HT Capatilities IE and HT Information IE - else if ((*pHtCapabilityLen == 0) && NdisEqualMemory(pEid->Octet, PRE_N_HT_OUI, 3) && (pEid->Len >= 4) && (pAd->OpMode == OPMODE_STA)) - { - if ((pEid->Octet[3] == OUI_PREN_HT_CAP) && (pEid->Len >= 30) && (*pHtCapabilityLen == 0)) - { - NdisMoveMemory(pHtCapability, &pEid->Octet[4], sizeof(HT_CAPABILITY_IE)); - *pPreNHtCapabilityLen = SIZE_HT_CAP_IE; - } - - if ((pEid->Octet[3] == OUI_PREN_ADD_HT) && (pEid->Len >= 26)) - { - NdisMoveMemory(AddHtInfo, &pEid->Octet[4], sizeof(ADD_HT_INFO_IE)); - *AddHtInfoLen = SIZE_ADD_HT_INFO_IE; - } - } -#endif // DOT11_N_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - else if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4)) - { - // Copy to pVIE which will report to microsoft bssid list. - Ptr = (PUCHAR) pVIE; - NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid, pEid->Len + 2); - *LengthVIE += (pEid->Len + 2); - } - else if (NdisEqualMemory(pEid->Octet, WME_PARM_ELEM, 6) && (pEid->Len == 24)) - { - PUCHAR ptr; - int i; - - // parsing EDCA parameters - pEdcaParm->bValid = TRUE; - pEdcaParm->bQAck = FALSE; // pEid->Octet[0] & 0x10; - pEdcaParm->bQueueRequest = FALSE; // pEid->Octet[0] & 0x20; - pEdcaParm->bTxopRequest = FALSE; // pEid->Octet[0] & 0x40; - pEdcaParm->EdcaUpdateCount = pEid->Octet[6] & 0x0f; - pEdcaParm->bAPSDCapable = (pEid->Octet[6] & 0x80) ? 1 : 0; - ptr = &pEid->Octet[8]; - for (i=0; i<4; i++) - { - UCHAR aci = (*ptr & 0x60) >> 5; // b5~6 is AC INDEX - pEdcaParm->bACM[aci] = (((*ptr) & 0x10) == 0x10); // b5 is ACM - pEdcaParm->Aifsn[aci] = (*ptr) & 0x0f; // b0~3 is AIFSN - pEdcaParm->Cwmin[aci] = *(ptr+1) & 0x0f; // b0~4 is Cwmin - pEdcaParm->Cwmax[aci] = *(ptr+1) >> 4; // b5~8 is Cwmax - pEdcaParm->Txop[aci] = *(ptr+2) + 256 * (*(ptr+3)); // in unit of 32-us - ptr += 4; // point to next AC - } - } - else if (NdisEqualMemory(pEid->Octet, WME_INFO_ELEM, 6) && (pEid->Len == 7)) - { - // parsing EDCA parameters - pEdcaParm->bValid = TRUE; - pEdcaParm->bQAck = FALSE; // pEid->Octet[0] & 0x10; - pEdcaParm->bQueueRequest = FALSE; // pEid->Octet[0] & 0x20; - pEdcaParm->bTxopRequest = FALSE; // pEid->Octet[0] & 0x40; - pEdcaParm->EdcaUpdateCount = pEid->Octet[6] & 0x0f; - pEdcaParm->bAPSDCapable = (pEid->Octet[6] & 0x80) ? 1 : 0; - - // use default EDCA parameter - pEdcaParm->bACM[QID_AC_BE] = 0; - pEdcaParm->Aifsn[QID_AC_BE] = 3; - pEdcaParm->Cwmin[QID_AC_BE] = CW_MIN_IN_BITS; - pEdcaParm->Cwmax[QID_AC_BE] = CW_MAX_IN_BITS; - pEdcaParm->Txop[QID_AC_BE] = 0; - - pEdcaParm->bACM[QID_AC_BK] = 0; - pEdcaParm->Aifsn[QID_AC_BK] = 7; - pEdcaParm->Cwmin[QID_AC_BK] = CW_MIN_IN_BITS; - pEdcaParm->Cwmax[QID_AC_BK] = CW_MAX_IN_BITS; - pEdcaParm->Txop[QID_AC_BK] = 0; - - pEdcaParm->bACM[QID_AC_VI] = 0; - pEdcaParm->Aifsn[QID_AC_VI] = 2; - pEdcaParm->Cwmin[QID_AC_VI] = CW_MIN_IN_BITS-1; - pEdcaParm->Cwmax[QID_AC_VI] = CW_MAX_IN_BITS; - pEdcaParm->Txop[QID_AC_VI] = 96; // AC_VI: 96*32us ~= 3ms - - pEdcaParm->bACM[QID_AC_VO] = 0; - pEdcaParm->Aifsn[QID_AC_VO] = 2; - pEdcaParm->Cwmin[QID_AC_VO] = CW_MIN_IN_BITS-2; - pEdcaParm->Cwmax[QID_AC_VO] = CW_MAX_IN_BITS-1; - pEdcaParm->Txop[QID_AC_VO] = 48; // AC_VO: 48*32us ~= 1.5ms - } -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // - - - break; - - case IE_EXT_SUPP_RATES: - if (pEid->Len <= MAX_LEN_OF_SUPPORTED_RATES) - { - NdisMoveMemory(ExtRate, pEid->Octet, pEid->Len); - *pExtRateLen = pEid->Len; - - // TODO: 2004-09-14 not a good design here, cause it exclude extra rates - // from ScanTab. We should report as is. And filter out unsupported - // rates in MlmeAux. - // Check against the supported rates - // RTMPCheckRates(pAd, ExtRate, pExtRateLen); - } - break; - - case IE_ERP: - if (pEid->Len == 1) - { - *pErp = (UCHAR)pEid->Octet[0]; - } - break; - - case IE_AIRONET_CKIP: - // 0. Check Aironet IE length, it must be larger or equal to 28 - // Cisco AP350 used length as 28 - // Cisco AP12XX used length as 30 - if (pEid->Len < (CKIP_NEGOTIATION_LENGTH - 2)) - break; - - // 1. Copy CKIP flag byte to buffer for process - *pCkipFlag = *(pEid->Octet + 8); - break; - - case IE_AP_TX_POWER: - // AP Control of Client Transmit Power - //0. Check Aironet IE length, it must be 6 - if (pEid->Len != 0x06) - break; - - // Get cell power limit in dBm - if (NdisEqualMemory(pEid->Octet, CISCO_OUI, 3) == 1) - *pAironetCellPowerLimit = *(pEid->Octet + 4); - break; - - // WPA2 & 802.11i RSN - case IE_RSN: - // There is no OUI for version anymore, check the group cipher OUI before copying - if (RTMPEqualMemory(pEid->Octet + 2, RSN_OUI, 3)) - { - // Copy to pVIE which will report to microsoft bssid list. - Ptr = (PUCHAR) pVIE; - NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid, pEid->Len + 2); - *LengthVIE += (pEid->Len + 2); - } - break; -#ifdef CONFIG_STA_SUPPORT -#ifdef EXT_BUILD_CHANNEL_LIST - case IE_COUNTRY: - Ptr = (PUCHAR) pVIE; - NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid, pEid->Len + 2); - *LengthVIE += (pEid->Len + 2); - break; -#endif // EXT_BUILD_CHANNEL_LIST // -#endif // CONFIG_STA_SUPPORT // - - - default: - break; - } - - Length = Length + 2 + pEid->Len; // Eid[1] + Len[1]+ content[Len] - pEid = (PEID_STRUCT)((UCHAR*)pEid + 2 + pEid->Len); - } - - // For some 11a AP. it did not have the channel EID, patch here -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - UCHAR LatchRfChannel = MsgChannel; - if ((pAd->LatchRfRegs.Channel > 14) && ((Sanity & 0x4) == 0)) - { - if (CtrlChannel != 0) - *pChannel = CtrlChannel; - else - *pChannel = LatchRfChannel; - Sanity |= 0x4; - } - } -#endif // CONFIG_STA_SUPPORT // - - if (Sanity != 0x7) - { - DBGPRINT(RT_DEBUG_LOUD, ("PeerBeaconAndProbeRspSanity - missing field, Sanity=0x%02x\n", Sanity)); - return FALSE; - } - else - { - return TRUE; - } - -} - -#ifdef DOT11N_DRAFT3 -/* - ========================================================================== - Description: - MLME message sanity check for some IE addressed in 802.11n d3.03. - Return: - TRUE if all parameters are OK, FALSE otherwise - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -BOOLEAN PeerBeaconAndProbeRspSanity2( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT UCHAR *RegClass) -{ - CHAR *Ptr; - PFRAME_802_11 pFrame; - PEID_STRUCT pEid; - ULONG Length = 0; - - pFrame = (PFRAME_802_11)Msg; - - *RegClass = 0; - Ptr = (PCHAR) pFrame->Octet; - Length += LENGTH_802_11; - - // get timestamp from payload and advance the pointer - Ptr += TIMESTAMP_LEN; - Length += TIMESTAMP_LEN; - - // get beacon interval from payload and advance the pointer - Ptr += 2; - Length += 2; - - // get capability info from payload and advance the pointer - Ptr += 2; - Length += 2; - - pEid = (PEID_STRUCT) Ptr; - - // get variable fields from payload and advance the pointer - while ((Length + 2 + pEid->Len) <= MsgLen) - { - switch(pEid->Eid) - { - case IE_SUPP_REG_CLASS: - if(pEid->Len > 0) - { - *RegClass = *pEid->Octet; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAndProbeRspSanity - wrong IE_SSID (len=%d)\n",pEid->Len)); - return FALSE; - } - break; - } - - Length = Length + 2 + pEid->Len; // Eid[1] + Len[1]+ content[Len] - pEid = (PEID_STRUCT)((UCHAR*)pEid + 2 + pEid->Len); - } - - return TRUE; - -} -#endif // DOT11N_DRAFT3 // - -/* - ========================================================================== - Description: - MLME message sanity check - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== - */ -BOOLEAN MlmeScanReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT UCHAR *pBssType, - OUT CHAR Ssid[], - OUT UCHAR *pSsidLen, - OUT UCHAR *pScanType) -{ - MLME_SCAN_REQ_STRUCT *Info; - - Info = (MLME_SCAN_REQ_STRUCT *)(Msg); - *pBssType = Info->BssType; - *pSsidLen = Info->SsidLen; - NdisMoveMemory(Ssid, Info->Ssid, *pSsidLen); - *pScanType = Info->ScanType; - - if ((*pBssType == BSS_INFRA || *pBssType == BSS_ADHOC || *pBssType == BSS_ANY) - && (*pScanType == SCAN_ACTIVE || *pScanType == SCAN_PASSIVE -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // - )) - { - return TRUE; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("MlmeScanReqSanity fail - wrong BssType or ScanType\n")); - return FALSE; - } -} - -// IRQL = DISPATCH_LEVEL -UCHAR ChannelSanity( - IN PRTMP_ADAPTER pAd, - IN UCHAR channel) -{ - int i; - - for (i = 0; i < pAd->ChannelListNum; i ++) - { - if (channel == pAd->ChannelList[i].Channel) - return 1; - } - return 0; -} - -/* - ========================================================================== - Description: - MLME message sanity check - Return: - TRUE if all parameters are OK, FALSE otherwise - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -BOOLEAN PeerDeauthSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *pReason) -{ - PFRAME_802_11 pFrame = (PFRAME_802_11)Msg; - - COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); - NdisMoveMemory(pReason, &pFrame->Octet[0], 2); - - return TRUE; -} - -/* - ========================================================================== - Description: - MLME message sanity check - Return: - TRUE if all parameters are OK, FALSE otherwise - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -BOOLEAN PeerAuthSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr, - OUT USHORT *pAlg, - OUT USHORT *pSeq, - OUT USHORT *pStatus, - CHAR *pChlgText) -{ - PFRAME_802_11 pFrame = (PFRAME_802_11)Msg; - - COPY_MAC_ADDR(pAddr, pFrame->Hdr.Addr2); - NdisMoveMemory(pAlg, &pFrame->Octet[0], 2); - NdisMoveMemory(pSeq, &pFrame->Octet[2], 2); - NdisMoveMemory(pStatus, &pFrame->Octet[4], 2); - - if (*pAlg == AUTH_MODE_OPEN) - { - if (*pSeq == 1 || *pSeq == 2) - { - return TRUE; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerAuthSanity fail - wrong Seg#\n")); - return FALSE; - } - } - else if (*pAlg == AUTH_MODE_KEY) - { - if (*pSeq == 1 || *pSeq == 4) - { - return TRUE; - } - else if (*pSeq == 2 || *pSeq == 3) - { - NdisMoveMemory(pChlgText, &pFrame->Octet[8], CIPHER_TEXT_LEN); - return TRUE; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerAuthSanity fail - wrong Seg#\n")); - return FALSE; - } - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerAuthSanity fail - wrong algorithm\n")); - return FALSE; - } -} - -/* - ========================================================================== - Description: - MLME message sanity check - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== - */ -BOOLEAN MlmeAuthReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr, - OUT ULONG *pTimeout, - OUT USHORT *pAlg) -{ - MLME_AUTH_REQ_STRUCT *pInfo; - - pInfo = (MLME_AUTH_REQ_STRUCT *)Msg; - COPY_MAC_ADDR(pAddr, pInfo->Addr); - *pTimeout = pInfo->Timeout; - *pAlg = pInfo->Alg; - - if (((*pAlg == AUTH_MODE_KEY) ||(*pAlg == AUTH_MODE_OPEN) - ) && - ((*pAddr & 0x01) == 0)) - { - return TRUE; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("MlmeAuthReqSanity fail - wrong algorithm\n")); - return FALSE; - } -} - -/* - ========================================================================== - Description: - MLME message sanity check - Return: - TRUE if all parameters are OK, FALSE otherwise - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -BOOLEAN MlmeAssocReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pApAddr, - OUT USHORT *pCapabilityInfo, - OUT ULONG *pTimeout, - OUT USHORT *pListenIntv) -{ - MLME_ASSOC_REQ_STRUCT *pInfo; - - pInfo = (MLME_ASSOC_REQ_STRUCT *)Msg; - *pTimeout = pInfo->Timeout; // timeout - COPY_MAC_ADDR(pApAddr, pInfo->Addr); // AP address - *pCapabilityInfo = pInfo->CapabilityInfo; // capability info - *pListenIntv = pInfo->ListenIntv; - - return TRUE; -} - -/* - ========================================================================== - Description: - MLME message sanity check - Return: - TRUE if all parameters are OK, FALSE otherwise - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -BOOLEAN PeerDisassocSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *pReason) -{ - PFRAME_802_11 pFrame = (PFRAME_802_11)Msg; - - COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); - NdisMoveMemory(pReason, &pFrame->Octet[0], 2); - - return TRUE; -} - -/* - ======================================================================== - Routine Description: - Sanity check NetworkType (11b, 11g or 11a) - - Arguments: - pBss - Pointer to BSS table. - - Return Value: - Ndis802_11DS .......(11b) - Ndis802_11OFDM24....(11g) - Ndis802_11OFDM5.....(11a) - - IRQL = DISPATCH_LEVEL - - ======================================================================== -*/ -NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity( - IN PBSS_ENTRY pBss) -{ - NDIS_802_11_NETWORK_TYPE NetWorkType; - UCHAR rate, i; - - NetWorkType = Ndis802_11DS; - - if (pBss->Channel <= 14) - { - // - // First check support Rate. - // - for (i = 0; i < pBss->SupRateLen; i++) - { - rate = pBss->SupRate[i] & 0x7f; // Mask out basic rate set bit - if ((rate == 2) || (rate == 4) || (rate == 11) || (rate == 22)) - { - continue; - } - else - { - // - // Otherwise (even rate > 108) means Ndis802_11OFDM24 - // - NetWorkType = Ndis802_11OFDM24; - break; - } - } - - // - // Second check Extend Rate. - // - if (NetWorkType != Ndis802_11OFDM24) - { - for (i = 0; i < pBss->ExtRateLen; i++) - { - rate = pBss->SupRate[i] & 0x7f; // Mask out basic rate set bit - if ((rate == 2) || (rate == 4) || (rate == 11) || (rate == 22)) - { - continue; - } - else - { - // - // Otherwise (even rate > 108) means Ndis802_11OFDM24 - // - NetWorkType = Ndis802_11OFDM24; - break; - } - } - } - } - else - { - NetWorkType = Ndis802_11OFDM5; - } - - if (pBss->HtCapabilityLen != 0) - { - if (NetWorkType == Ndis802_11OFDM5) - NetWorkType = Ndis802_11OFDM5_N; - else - NetWorkType = Ndis802_11OFDM24_N; - } - - return NetWorkType; -} - -/* - ========================================================================== - Description: - Check the validity of the received EAPoL frame - Return: - TRUE if all parameters are OK, - FALSE otherwise - ========================================================================== - */ -BOOLEAN PeerWpaMessageSanity( - IN PRTMP_ADAPTER pAd, - IN PEAPOL_PACKET pMsg, - IN ULONG MsgLen, - IN UCHAR MsgType, - IN MAC_TABLE_ENTRY *pEntry) -{ - UCHAR mic[LEN_KEY_DESC_MIC], digest[80], KEYDATA[MAX_LEN_OF_RSNIE]; - BOOLEAN bReplayDiff = FALSE; - BOOLEAN bWPA2 = FALSE; - KEY_INFO EapolKeyInfo; - UCHAR GroupKeyIndex = 0; - - - NdisZeroMemory(mic, sizeof(mic)); - NdisZeroMemory(digest, sizeof(digest)); - NdisZeroMemory(KEYDATA, sizeof(KEYDATA)); - NdisZeroMemory((PUCHAR)&EapolKeyInfo, sizeof(EapolKeyInfo)); - - NdisMoveMemory((PUCHAR)&EapolKeyInfo, (PUCHAR)&pMsg->KeyDesc.KeyInfo, sizeof(KEY_INFO)); - - *((USHORT *)&EapolKeyInfo) = cpu2le16(*((USHORT *)&EapolKeyInfo)); - - // Choose WPA2 or not - if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) || (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) - bWPA2 = TRUE; - - // 0. Check MsgType - if ((MsgType > EAPOL_GROUP_MSG_2) || (MsgType < EAPOL_PAIR_MSG_1)) - { - DBGPRINT(RT_DEBUG_ERROR, ("The message type is invalid(%d)! \n", MsgType)); - return FALSE; - } - - // 1. Replay counter check - if (MsgType == EAPOL_PAIR_MSG_1 || MsgType == EAPOL_PAIR_MSG_3 || MsgType == EAPOL_GROUP_MSG_1) // For supplicant - { - // First validate replay counter, only accept message with larger replay counter. - // Let equal pass, some AP start with all zero replay counter - UCHAR ZeroReplay[LEN_KEY_DESC_REPLAY]; - - NdisZeroMemory(ZeroReplay, LEN_KEY_DESC_REPLAY); - if ((RTMPCompareMemory(pMsg->KeyDesc.ReplayCounter, pEntry->R_Counter, LEN_KEY_DESC_REPLAY) != 1) && - (RTMPCompareMemory(pMsg->KeyDesc.ReplayCounter, ZeroReplay, LEN_KEY_DESC_REPLAY) != 0)) - { - bReplayDiff = TRUE; - } - } - else if (MsgType == EAPOL_PAIR_MSG_2 || MsgType == EAPOL_PAIR_MSG_4 || MsgType == EAPOL_GROUP_MSG_2) // For authenticator - { - // check Replay Counter coresponds to MSG from authenticator, otherwise discard - if (!NdisEqualMemory(pMsg->KeyDesc.ReplayCounter, pEntry->R_Counter, LEN_KEY_DESC_REPLAY)) - { - bReplayDiff = TRUE; - } - } - - // Replay Counter different condition - if (bReplayDiff) - { - // send wireless event - for replay counter different - if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_REPLAY_COUNTER_DIFF_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); - - if (MsgType < EAPOL_GROUP_MSG_1) - { - DBGPRINT(RT_DEBUG_ERROR, ("Replay Counter Different in pairwise msg %d of 4-way handshake!\n", MsgType)); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("Replay Counter Different in group msg %d of 2-way handshake!\n", (MsgType - EAPOL_PAIR_MSG_4))); - } - - hex_dump("Receive replay counter ", pMsg->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - hex_dump("Current replay counter ", pEntry->R_Counter, LEN_KEY_DESC_REPLAY); - return FALSE; - } - - // 2. Verify MIC except Pairwise Msg1 - if (MsgType != EAPOL_PAIR_MSG_1) - { - UCHAR rcvd_mic[LEN_KEY_DESC_MIC]; - - // Record the received MIC for check later - NdisMoveMemory(rcvd_mic, pMsg->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); - NdisZeroMemory(pMsg->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); - - if (EapolKeyInfo.KeyDescVer == DESC_TYPE_TKIP) // TKIP - { - HMAC_MD5(pEntry->PTK, LEN_EAP_MICK, (PUCHAR)pMsg, MsgLen, mic, MD5_DIGEST_SIZE); - } - else if (EapolKeyInfo.KeyDescVer == DESC_TYPE_AES) // AES - { - HMAC_SHA1(pEntry->PTK, LEN_EAP_MICK, (PUCHAR)pMsg, MsgLen, digest, SHA1_DIGEST_SIZE); - NdisMoveMemory(mic, digest, LEN_KEY_DESC_MIC); - } - - if (!NdisEqualMemory(rcvd_mic, mic, LEN_KEY_DESC_MIC)) - { - // send wireless event - for MIC different - if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_MIC_DIFF_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); - - if (MsgType < EAPOL_GROUP_MSG_1) - { - DBGPRINT(RT_DEBUG_ERROR, ("MIC Different in pairwise msg %d of 4-way handshake!\n", MsgType)); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("MIC Different in group msg %d of 2-way handshake!\n", (MsgType - EAPOL_PAIR_MSG_4))); - } - - hex_dump("Received MIC", rcvd_mic, LEN_KEY_DESC_MIC); - hex_dump("Desired MIC", mic, LEN_KEY_DESC_MIC); - - return FALSE; - } - } - - // 1. Decrypt the Key Data field if GTK is included. - // 2. Extract the context of the Key Data field if it exist. - // The field in pairwise_msg_2_WPA1(WPA2) & pairwise_msg_3_WPA1 is clear. - // The field in group_msg_1_WPA1(WPA2) & pairwise_msg_3_WPA2 is encrypted. - if (CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen) > 0) - { - // Decrypt this field - if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2) || (MsgType == EAPOL_GROUP_MSG_1)) - { - if( - (EapolKeyInfo.KeyDescVer == DESC_TYPE_AES)) - { - // AES - AES_GTK_KEY_UNWRAP(&pEntry->PTK[16], KEYDATA, - CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen), - pMsg->KeyDesc.KeyData); - } - else - { - INT i; - UCHAR Key[32]; - // Decrypt TKIP GTK - // Construct 32 bytes RC4 Key - NdisMoveMemory(Key, pMsg->KeyDesc.KeyIv, 16); - NdisMoveMemory(&Key[16], &pEntry->PTK[16], 16); - ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, Key, 32); - //discard first 256 bytes - for(i = 0; i < 256; i++) - ARCFOUR_BYTE(&pAd->PrivateInfo.WEPCONTEXT); - // Decrypt GTK. Becareful, there is no ICV to check the result is correct or not - ARCFOUR_DECRYPT(&pAd->PrivateInfo.WEPCONTEXT, KEYDATA, - pMsg->KeyDesc.KeyData, - CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen)); - } - - if (!bWPA2 && (MsgType == EAPOL_GROUP_MSG_1)) - GroupKeyIndex = EapolKeyInfo.KeyIndex; - - } - else if ((MsgType == EAPOL_PAIR_MSG_2) || (MsgType == EAPOL_PAIR_MSG_3 && !bWPA2)) - { - NdisMoveMemory(KEYDATA, pMsg->KeyDesc.KeyData, CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen)); - } - else - { - - return TRUE; - } - - // Parse Key Data field to - // 1. verify RSN IE for pairwise_msg_2_WPA1(WPA2) ,pairwise_msg_3_WPA1(WPA2) - // 2. verify KDE format for pairwise_msg_3_WPA2, group_msg_1_WPA2 - // 3. update shared key for pairwise_msg_3_WPA2, group_msg_1_WPA1(WPA2) - if (!RTMPParseEapolKeyData(pAd, KEYDATA, - CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen), - GroupKeyIndex, MsgType, bWPA2, pEntry)) - { - return FALSE; - } - } - - return TRUE; - -} - -#ifdef CONFIG_STA_SUPPORT -#ifdef QOS_DLS_SUPPORT -BOOLEAN MlmeDlsReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PRT_802_11_DLS *pDLS, - OUT PUSHORT pReason) -{ - MLME_DLS_REQ_STRUCT *pInfo; - - pInfo = (MLME_DLS_REQ_STRUCT *)Msg; - - *pDLS = pInfo->pDLS; - *pReason = pInfo->Reason; - - return TRUE; -} -#endif // QOS_DLS_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - -#ifdef QOS_DLS_SUPPORT -BOOLEAN PeerDlsReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pDA, - OUT PUCHAR pSA, - OUT USHORT *pCapabilityInfo, - OUT USHORT *pDlsTimeout, - OUT UCHAR *pRatesLen, - OUT UCHAR Rates[], - OUT UCHAR *pHtCapabilityLen, - OUT HT_CAPABILITY_IE *pHtCapability) -{ - CHAR *Ptr; - PFRAME_802_11 Fr = (PFRAME_802_11)Msg; - PEID_STRUCT eid_ptr; - - // to prevent caller from using garbage output value - *pCapabilityInfo = 0; - *pDlsTimeout = 0; - *pHtCapabilityLen = 0; - - Ptr = (PCHAR)Fr->Octet; - - // offset to destination MAC address (Category and Action field) - Ptr += 2; - - // get DA from payload and advance the pointer - NdisMoveMemory(pDA, Ptr, MAC_ADDR_LEN); - Ptr += MAC_ADDR_LEN; - - // get SA from payload and advance the pointer - NdisMoveMemory(pSA, Ptr, MAC_ADDR_LEN); - Ptr += MAC_ADDR_LEN; - - // get capability info from payload and advance the pointer - NdisMoveMemory(pCapabilityInfo, Ptr, 2); - Ptr += 2; - - // get capability info from payload and advance the pointer - NdisMoveMemory(pDlsTimeout, Ptr, 2); - Ptr += 2; - - // Category and Action field + DA + SA + capability + Timeout - eid_ptr = (PEID_STRUCT) &Fr->Octet[18]; - - while (((UCHAR*)eid_ptr + eid_ptr->Len + 1) < ((UCHAR*)Fr + MsgLen)) - { - switch(eid_ptr->Eid) - { - case IE_SUPP_RATES: - if ((eid_ptr->Len <= MAX_LEN_OF_SUPPORTED_RATES) && (eid_ptr->Len > 0)) - { - NdisMoveMemory(Rates, eid_ptr->Octet, eid_ptr->Len); - DBGPRINT(RT_DEBUG_TRACE, ("PeerDlsReqSanity - IE_SUPP_RATES., Len=%d. Rates[0]=%x\n",eid_ptr->Len, Rates[0])); - DBGPRINT(RT_DEBUG_TRACE, ("Rates[1]=%x %x %x %x %x %x %x\n", Rates[1], Rates[2], Rates[3], Rates[4], Rates[5], Rates[6], Rates[7])); - *pRatesLen = eid_ptr->Len; - } - else - { - *pRatesLen = 8; - Rates[0] = 0x82; - Rates[1] = 0x84; - Rates[2] = 0x8b; - Rates[3] = 0x96; - Rates[4] = 0x12; - Rates[5] = 0x24; - Rates[6] = 0x48; - Rates[7] = 0x6c; - DBGPRINT(RT_DEBUG_TRACE, ("PeerDlsReqSanity - wrong IE_SUPP_RATES., Len=%d\n",eid_ptr->Len)); - } - break; - - case IE_EXT_SUPP_RATES: - if (eid_ptr->Len + *pRatesLen <= MAX_LEN_OF_SUPPORTED_RATES) - { - NdisMoveMemory(&Rates[*pRatesLen], eid_ptr->Octet, eid_ptr->Len); - *pRatesLen = (*pRatesLen) + eid_ptr->Len; - } - else - { - NdisMoveMemory(&Rates[*pRatesLen], eid_ptr->Octet, MAX_LEN_OF_SUPPORTED_RATES - (*pRatesLen)); - *pRatesLen = MAX_LEN_OF_SUPPORTED_RATES; - } - break; - - case IE_HT_CAP: - if (eid_ptr->Len >= sizeof(HT_CAPABILITY_IE)) - { - NdisMoveMemory(pHtCapability, eid_ptr->Octet, sizeof(HT_CAPABILITY_IE)); - - *(USHORT *)(&pHtCapability->HtCapInfo) = cpu2le16(*(USHORT *)(&pHtCapability->HtCapInfo)); -#ifdef UNALIGNMENT_SUPPORT - { - EXT_HT_CAP_INFO extHtCapInfo; - - NdisMoveMemory((PUCHAR)(&extHtCapInfo), (PUCHAR)(&pHtCapability->ExtHtCapInfo), sizeof(EXT_HT_CAP_INFO)); - *(USHORT *)(&extHtCapInfo) = cpu2le16(*(USHORT *)(&extHtCapInfo)); - NdisMoveMemory((PUCHAR)(&pHtCapability->ExtHtCapInfo), (PUCHAR)(&extHtCapInfo), sizeof(EXT_HT_CAP_INFO)); - } -#else - *(USHORT *)(&pHtCapability->ExtHtCapInfo) = cpu2le16(*(USHORT *)(&pHtCapability->ExtHtCapInfo)); -#endif // UNALIGNMENT_SUPPORT // - *pHtCapabilityLen = sizeof(HT_CAPABILITY_IE); - - DBGPRINT(RT_DEBUG_TRACE, ("PeerDlsReqSanity - IE_HT_CAP\n")); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerDlsReqSanity - wrong IE_HT_CAP.eid_ptr->Len = %d\n", eid_ptr->Len)); - } - break; - - default: - break; - } - - eid_ptr = (PEID_STRUCT)((UCHAR*)eid_ptr + 2 + eid_ptr->Len); - } - - return TRUE; -} - -BOOLEAN PeerDlsRspSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pDA, - OUT PUCHAR pSA, - OUT USHORT *pCapabilityInfo, - OUT USHORT *pStatus, - OUT UCHAR *pRatesLen, - OUT UCHAR Rates[], - OUT UCHAR *pHtCapabilityLen, - OUT HT_CAPABILITY_IE *pHtCapability) -{ - CHAR *Ptr; - PFRAME_802_11 Fr = (PFRAME_802_11)Msg; - PEID_STRUCT eid_ptr; - - // to prevent caller from using garbage output value - *pStatus = 0; - *pCapabilityInfo = 0; - *pHtCapabilityLen = 0; - - Ptr = (PCHAR)Fr->Octet; - - // offset to destination MAC address (Category and Action field) - Ptr += 2; - - // get status code from payload and advance the pointer - NdisMoveMemory(pStatus, Ptr, 2); - Ptr += 2; - - // get DA from payload and advance the pointer - NdisMoveMemory(pDA, Ptr, MAC_ADDR_LEN); - Ptr += MAC_ADDR_LEN; - - // get SA from payload and advance the pointer - NdisMoveMemory(pSA, Ptr, MAC_ADDR_LEN); - Ptr += MAC_ADDR_LEN; - - if (pStatus == 0) - { - // get capability info from payload and advance the pointer - NdisMoveMemory(pCapabilityInfo, Ptr, 2); - Ptr += 2; - } - - // Category and Action field + status code + DA + SA + capability - eid_ptr = (PEID_STRUCT) &Fr->Octet[18]; - - while (((UCHAR*)eid_ptr + eid_ptr->Len + 1) < ((UCHAR*)Fr + MsgLen)) - { - switch(eid_ptr->Eid) - { - case IE_SUPP_RATES: - if ((eid_ptr->Len <= MAX_LEN_OF_SUPPORTED_RATES) && (eid_ptr->Len > 0)) - { - NdisMoveMemory(Rates, eid_ptr->Octet, eid_ptr->Len); - DBGPRINT(RT_DEBUG_TRACE, ("PeerDlsRspSanity - IE_SUPP_RATES., Len=%d. Rates[0]=%x\n",eid_ptr->Len, Rates[0])); - DBGPRINT(RT_DEBUG_TRACE, ("Rates[1]=%x %x %x %x %x %x %x\n", Rates[1], Rates[2], Rates[3], Rates[4], Rates[5], Rates[6], Rates[7])); - *pRatesLen = eid_ptr->Len; - } - else - { - *pRatesLen = 8; - Rates[0] = 0x82; - Rates[1] = 0x84; - Rates[2] = 0x8b; - Rates[3] = 0x96; - Rates[4] = 0x12; - Rates[5] = 0x24; - Rates[6] = 0x48; - Rates[7] = 0x6c; - DBGPRINT(RT_DEBUG_TRACE, ("PeerDlsRspSanity - wrong IE_SUPP_RATES., Len=%d\n",eid_ptr->Len)); - } - break; - - case IE_EXT_SUPP_RATES: - if (eid_ptr->Len + *pRatesLen <= MAX_LEN_OF_SUPPORTED_RATES) - { - NdisMoveMemory(&Rates[*pRatesLen], eid_ptr->Octet, eid_ptr->Len); - *pRatesLen = (*pRatesLen) + eid_ptr->Len; - } - else - { - NdisMoveMemory(&Rates[*pRatesLen], eid_ptr->Octet, MAX_LEN_OF_SUPPORTED_RATES - (*pRatesLen)); - *pRatesLen = MAX_LEN_OF_SUPPORTED_RATES; - } - break; - - case IE_HT_CAP: - if (eid_ptr->Len >= sizeof(HT_CAPABILITY_IE)) - { - NdisMoveMemory(pHtCapability, eid_ptr->Octet, sizeof(HT_CAPABILITY_IE)); - - *(USHORT *)(&pHtCapability->HtCapInfo) = cpu2le16(*(USHORT *)(&pHtCapability->HtCapInfo)); -#ifdef UNALIGNMENT_SUPPORT - { - EXT_HT_CAP_INFO extHtCapInfo; - - NdisMoveMemory((PUCHAR)(&extHtCapInfo), (PUCHAR)(&pHtCapability->ExtHtCapInfo), sizeof(EXT_HT_CAP_INFO)); - *(USHORT *)(&extHtCapInfo) = cpu2le16(*(USHORT *)(&extHtCapInfo)); - NdisMoveMemory((PUCHAR)(&pHtCapability->ExtHtCapInfo), (PUCHAR)(&extHtCapInfo), sizeof(EXT_HT_CAP_INFO)); - } -#else - *(USHORT *)(&pHtCapability->ExtHtCapInfo) = cpu2le16(*(USHORT *)(&pHtCapability->ExtHtCapInfo)); -#endif // UNALIGNMENT_SUPPORT // - *pHtCapabilityLen = sizeof(HT_CAPABILITY_IE); - - DBGPRINT(RT_DEBUG_TRACE, ("PeerDlsRspSanity - IE_HT_CAP\n")); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerDlsRspSanity - wrong IE_HT_CAP.eid_ptr->Len = %d\n", eid_ptr->Len)); - } - break; - - default: - break; - } - - eid_ptr = (PEID_STRUCT)((UCHAR*)eid_ptr + 2 + eid_ptr->Len); - } - - return TRUE; -} - -BOOLEAN PeerDlsTearDownSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pDA, - OUT PUCHAR pSA, - OUT USHORT *pReason) -{ - CHAR *Ptr; - PFRAME_802_11 Fr = (PFRAME_802_11)Msg; - - // to prevent caller from using garbage output value - *pReason = 0; - - Ptr = (PCHAR)Fr->Octet; - - // offset to destination MAC address (Category and Action field) - Ptr += 2; - - // get DA from payload and advance the pointer - NdisMoveMemory(pDA, Ptr, MAC_ADDR_LEN); - Ptr += MAC_ADDR_LEN; - - // get SA from payload and advance the pointer - NdisMoveMemory(pSA, Ptr, MAC_ADDR_LEN); - Ptr += MAC_ADDR_LEN; - - // get reason code from payload and advance the pointer - NdisMoveMemory(pReason, Ptr, 2); - Ptr += 2; - - return TRUE; -} -#endif // QOS_DLS_SUPPORT // diff --git a/drivers/staging/rt3090/common/cmm_sync.c b/drivers/staging/rt3090/common/cmm_sync.c deleted file mode 100644 index 6d7b974d7e15..000000000000 --- a/drivers/staging/rt3090/common/cmm_sync.c +++ /dev/null @@ -1,734 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - cmm_sync.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - John Chang 2004-09-01 modified for rt2561/2661 -*/ - -#include "../rt_config.h" - - -// 2.4 Ghz channel plan index in the TxPower arrays. -#define BG_BAND_REGION_0_START 0 // 1,2,3,4,5,6,7,8,9,10,11 -#define BG_BAND_REGION_0_SIZE 11 -#define BG_BAND_REGION_1_START 0 // 1,2,3,4,5,6,7,8,9,10,11,12,13 -#define BG_BAND_REGION_1_SIZE 13 -#define BG_BAND_REGION_2_START 9 // 10,11 -#define BG_BAND_REGION_2_SIZE 2 -#define BG_BAND_REGION_3_START 9 // 10,11,12,13 -#define BG_BAND_REGION_3_SIZE 4 -#define BG_BAND_REGION_4_START 13 // 14 -#define BG_BAND_REGION_4_SIZE 1 -#define BG_BAND_REGION_5_START 0 // 1,2,3,4,5,6,7,8,9,10,11,12,13,14 -#define BG_BAND_REGION_5_SIZE 14 -#define BG_BAND_REGION_6_START 2 // 3,4,5,6,7,8,9 -#define BG_BAND_REGION_6_SIZE 7 -#define BG_BAND_REGION_7_START 4 // 5,6,7,8,9,10,11,12,13 -#define BG_BAND_REGION_7_SIZE 9 -#define BG_BAND_REGION_31_START 0 // 1,2,3,4,5,6,7,8,9,10,11,12,13,14 -#define BG_BAND_REGION_31_SIZE 14 - -// 5 Ghz channel plan index in the TxPower arrays. -UCHAR A_BAND_REGION_0_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165}; -UCHAR A_BAND_REGION_1_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}; -UCHAR A_BAND_REGION_2_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64}; -UCHAR A_BAND_REGION_3_CHANNEL_LIST[]={52, 56, 60, 64, 149, 153, 157, 161}; -UCHAR A_BAND_REGION_4_CHANNEL_LIST[]={149, 153, 157, 161, 165}; -UCHAR A_BAND_REGION_5_CHANNEL_LIST[]={149, 153, 157, 161}; -UCHAR A_BAND_REGION_6_CHANNEL_LIST[]={36, 40, 44, 48}; -UCHAR A_BAND_REGION_7_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173}; -UCHAR A_BAND_REGION_8_CHANNEL_LIST[]={52, 56, 60, 64}; -UCHAR A_BAND_REGION_9_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165}; -UCHAR A_BAND_REGION_10_CHANNEL_LIST[]={36, 40, 44, 48, 149, 153, 157, 161, 165}; -UCHAR A_BAND_REGION_11_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 149, 153, 157, 161}; -UCHAR A_BAND_REGION_12_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}; -UCHAR A_BAND_REGION_13_CHANNEL_LIST[]={52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161}; -UCHAR A_BAND_REGION_14_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 136, 140, 149, 153, 157, 161, 165}; -UCHAR A_BAND_REGION_15_CHANNEL_LIST[]={149, 153, 157, 161, 165, 169, 173}; - - -//BaSizeArray follows the 802.11n definition as MaxRxFactor. 2^(13+factor) bytes. When factor =0, it's about Ba buffer size =8. -UCHAR BaSizeArray[4] = {8,16,32,64}; - -/* - ========================================================================== - Description: - Update StaCfg->ChannelList[] according to 1) Country Region 2) RF IC type, - and 3) PHY-mode user selected. - The outcome is used by driver when doing site survey. - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID BuildChannelList( - IN PRTMP_ADAPTER pAd) -{ - UCHAR i, j, index=0, num=0; - PUCHAR pChannelList = NULL; - - NdisZeroMemory(pAd->ChannelList, MAX_NUM_OF_CHANNELS * sizeof(CHANNEL_TX_POWER)); - - // if not 11a-only mode, channel list starts from 2.4Ghz band - if ((pAd->CommonCfg.PhyMode != PHY_11A) -#ifdef DOT11_N_SUPPORT - && (pAd->CommonCfg.PhyMode != PHY_11AN_MIXED) && (pAd->CommonCfg.PhyMode != PHY_11N_5G) -#endif // DOT11_N_SUPPORT // - ) - { - switch (pAd->CommonCfg.CountryRegion & 0x7f) - { - case REGION_0_BG_BAND: // 1 -11 - NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_0_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_0_SIZE); - index += BG_BAND_REGION_0_SIZE; - break; - case REGION_1_BG_BAND: // 1 - 13 - NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_1_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_1_SIZE); - index += BG_BAND_REGION_1_SIZE; - break; - case REGION_2_BG_BAND: // 10 - 11 - NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_2_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_2_SIZE); - index += BG_BAND_REGION_2_SIZE; - break; - case REGION_3_BG_BAND: // 10 - 13 - NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_3_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_3_SIZE); - index += BG_BAND_REGION_3_SIZE; - break; - case REGION_4_BG_BAND: // 14 - NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_4_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_4_SIZE); - index += BG_BAND_REGION_4_SIZE; - break; - case REGION_5_BG_BAND: // 1 - 14 - NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_5_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_5_SIZE); - index += BG_BAND_REGION_5_SIZE; - break; - case REGION_6_BG_BAND: // 3 - 9 - NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_6_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_6_SIZE); - index += BG_BAND_REGION_6_SIZE; - break; - case REGION_7_BG_BAND: // 5 - 13 - NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_7_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_7_SIZE); - index += BG_BAND_REGION_7_SIZE; - break; - case REGION_31_BG_BAND: // 1 - 14 - NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_31_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_31_SIZE); - index += BG_BAND_REGION_31_SIZE; - break; - default: // Error. should never happen - break; - } - for (i=0; iChannelList[i].MaxTxPwr = 20; - } - - if ((pAd->CommonCfg.PhyMode == PHY_11A) || (pAd->CommonCfg.PhyMode == PHY_11ABG_MIXED) -#ifdef DOT11_N_SUPPORT - || (pAd->CommonCfg.PhyMode == PHY_11ABGN_MIXED) || (pAd->CommonCfg.PhyMode == PHY_11AN_MIXED) - || (pAd->CommonCfg.PhyMode == PHY_11AGN_MIXED) || (pAd->CommonCfg.PhyMode == PHY_11N_5G) -#endif // DOT11_N_SUPPORT // - ) - { - switch (pAd->CommonCfg.CountryRegionForABand & 0x7f) - { - case REGION_0_A_BAND: - num = sizeof(A_BAND_REGION_0_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_0_CHANNEL_LIST; - break; - case REGION_1_A_BAND: - num = sizeof(A_BAND_REGION_1_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_1_CHANNEL_LIST; - break; - case REGION_2_A_BAND: - num = sizeof(A_BAND_REGION_2_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_2_CHANNEL_LIST; - break; - case REGION_3_A_BAND: - num = sizeof(A_BAND_REGION_3_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_3_CHANNEL_LIST; - break; - case REGION_4_A_BAND: - num = sizeof(A_BAND_REGION_4_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_4_CHANNEL_LIST; - break; - case REGION_5_A_BAND: - num = sizeof(A_BAND_REGION_5_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_5_CHANNEL_LIST; - break; - case REGION_6_A_BAND: - num = sizeof(A_BAND_REGION_6_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_6_CHANNEL_LIST; - break; - case REGION_7_A_BAND: - num = sizeof(A_BAND_REGION_7_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_7_CHANNEL_LIST; - break; - case REGION_8_A_BAND: - num = sizeof(A_BAND_REGION_8_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_8_CHANNEL_LIST; - break; - case REGION_9_A_BAND: - num = sizeof(A_BAND_REGION_9_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_9_CHANNEL_LIST; - break; - case REGION_10_A_BAND: - num = sizeof(A_BAND_REGION_10_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_10_CHANNEL_LIST; - break; - case REGION_11_A_BAND: - num = sizeof(A_BAND_REGION_11_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_11_CHANNEL_LIST; - break; - case REGION_12_A_BAND: - num = sizeof(A_BAND_REGION_12_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_12_CHANNEL_LIST; - break; - case REGION_13_A_BAND: - num = sizeof(A_BAND_REGION_13_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_13_CHANNEL_LIST; - break; - case REGION_14_A_BAND: - num = sizeof(A_BAND_REGION_14_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_14_CHANNEL_LIST; - break; - case REGION_15_A_BAND: - num = sizeof(A_BAND_REGION_15_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_15_CHANNEL_LIST; - break; - default: // Error. should never happen - DBGPRINT(RT_DEBUG_WARN,("countryregion=%d not support", pAd->CommonCfg.CountryRegionForABand)); - break; - } - - if (num != 0) - { - UCHAR RadarCh[15]={52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}; - for (i=0; iTxPower[j].Channel) - NdisMoveMemory(&pAd->ChannelList[index+i], &pAd->TxPower[j], sizeof(CHANNEL_TX_POWER)); - } - for (j=0; j<15; j++) - { - if (pChannelList[i] == RadarCh[j]) - pAd->ChannelList[index+i].DfsReq = TRUE; - } - pAd->ChannelList[index+i].MaxTxPwr = 20; - } - index += num; - } - } - - pAd->ChannelListNum = index; - DBGPRINT(RT_DEBUG_TRACE,("country code=%d/%d, RFIC=%d, PHY mode=%d, support %d channels\n", - pAd->CommonCfg.CountryRegion, pAd->CommonCfg.CountryRegionForABand, pAd->RfIcType, pAd->CommonCfg.PhyMode, pAd->ChannelListNum)); -#ifdef DBG - for (i=0;iChannelListNum;i++) - { - DBGPRINT_RAW(RT_DEBUG_TRACE,("BuildChannel # %d :: Pwr0 = %d, Pwr1 =%d, \n ", pAd->ChannelList[i].Channel, pAd->ChannelList[i].Power, pAd->ChannelList[i].Power2)); - } -#endif -} - -/* - ========================================================================== - Description: - This routine return the first channel number according to the country - code selection and RF IC selection (signal band or dual band). It is called - whenever driver need to start a site survey of all supported channels. - Return: - ch - the first channel number of current country code setting - - IRQL = PASSIVE_LEVEL - - ========================================================================== - */ -UCHAR FirstChannel( - IN PRTMP_ADAPTER pAd) -{ - return pAd->ChannelList[0].Channel; -} - -/* - ========================================================================== - Description: - This routine returns the next channel number. This routine is called - during driver need to start a site survey of all supported channels. - Return: - next_channel - the next channel number valid in current country code setting. - Note: - return 0 if no more next channel - ========================================================================== - */ -UCHAR NextChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR channel) -{ - int i; - UCHAR next_channel = 0; - - for (i = 0; i < (pAd->ChannelListNum - 1); i++) - if (channel == pAd->ChannelList[i].Channel) - { - next_channel = pAd->ChannelList[i+1].Channel; - break; - } - return next_channel; -} - -/* - ========================================================================== - Description: - This routine is for Cisco Compatible Extensions 2.X - Spec31. AP Control of Client Transmit Power - Return: - None - Note: - Required by Aironet dBm(mW) - 0dBm(1mW), 1dBm(5mW), 13dBm(20mW), 15dBm(30mW), - 17dBm(50mw), 20dBm(100mW) - - We supported - 3dBm(Lowest), 6dBm(10%), 9dBm(25%), 12dBm(50%), - 14dBm(75%), 15dBm(100%) - - The client station's actual transmit power shall be within +/- 5dB of - the minimum value or next lower value. - ========================================================================== - */ -VOID ChangeToCellPowerLimit( - IN PRTMP_ADAPTER pAd, - IN UCHAR AironetCellPowerLimit) -{ - //valud 0xFF means that hasn't found power limit information - //from the AP's Beacon/Probe response. - if (AironetCellPowerLimit == 0xFF) - return; - - if (AironetCellPowerLimit < 6) //Used Lowest Power Percentage. - pAd->CommonCfg.TxPowerPercentage = 6; - else if (AironetCellPowerLimit < 9) - pAd->CommonCfg.TxPowerPercentage = 10; - else if (AironetCellPowerLimit < 12) - pAd->CommonCfg.TxPowerPercentage = 25; - else if (AironetCellPowerLimit < 14) - pAd->CommonCfg.TxPowerPercentage = 50; - else if (AironetCellPowerLimit < 15) - pAd->CommonCfg.TxPowerPercentage = 75; - else - pAd->CommonCfg.TxPowerPercentage = 100; //else used maximum - - if (pAd->CommonCfg.TxPowerPercentage > pAd->CommonCfg.TxPowerDefault) - pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault; - -} - -CHAR ConvertToRssi( - IN PRTMP_ADAPTER pAd, - IN CHAR Rssi, - IN UCHAR RssiNumber) -{ - UCHAR RssiOffset, LNAGain; - - // Rssi equals to zero should be an invalid value - if (Rssi == 0) - return -99; - - LNAGain = GET_LNA_GAIN(pAd); - if (pAd->LatchRfRegs.Channel > 14) - { - if (RssiNumber == 0) - RssiOffset = pAd->ARssiOffset0; - else if (RssiNumber == 1) - RssiOffset = pAd->ARssiOffset1; - else - RssiOffset = pAd->ARssiOffset2; - } - else - { - if (RssiNumber == 0) - RssiOffset = pAd->BGRssiOffset0; - else if (RssiNumber == 1) - RssiOffset = pAd->BGRssiOffset1; - else - RssiOffset = pAd->BGRssiOffset2; - } - - return (-12 - RssiOffset - LNAGain - Rssi); -} - -/* - ========================================================================== - Description: - Scan next channel - ========================================================================== - */ -VOID ScanNextChannel( - IN PRTMP_ADAPTER pAd) -{ - HEADER_802_11 Hdr80211; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - UCHAR SsidLen = 0, ScanType = pAd->MlmeAux.ScanType, BBPValue = 0; -#ifdef CONFIG_STA_SUPPORT - USHORT Status; - PHEADER_802_11 pHdr80211; -#endif // CONFIG_STA_SUPPORT // - UINT ScanTimeIn5gChannel = SHORT_CHANNEL_TIME; - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (MONITOR_ON(pAd)) - return; - } -#endif // CONFIG_STA_SUPPORT // - -#ifdef RALINK_ATE - // Nothing to do in ATE mode. - if (ATE_ON(pAd)) - return; -#endif // RALINK_ATE // - - if (pAd->MlmeAux.Channel == 0) - { - if ((pAd->CommonCfg.BBPCurrentBW == BW_40) -#ifdef CONFIG_STA_SUPPORT - && (INFRA_ON(pAd) - || (pAd->OpMode == OPMODE_AP)) -#endif // CONFIG_STA_SUPPORT // - ) - { - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue &= (~0x18); - BBPValue |= 0x10; - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - End of SCAN, restore to 40MHz channel %d, Total BSS[%02d]\n",pAd->CommonCfg.CentralChannel, pAd->ScanTab.BssNr)); - } - else - { - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - End of SCAN, restore to channel %d, Total BSS[%02d]\n",pAd->CommonCfg.Channel, pAd->ScanTab.BssNr)); - } - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // - // To prevent data lost. - // Send an NULL data with turned PSM bit on to current associated AP before SCAN progress. - // Now, we need to send an NULL data with turned PSM bit off to AP, when scan progress done - // - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) && (INFRA_ON(pAd))) - { - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); - if (NStatus == NDIS_STATUS_SUCCESS) - { - pHdr80211 = (PHEADER_802_11) pOutBuffer; - MgtMacHeaderInit(pAd, pHdr80211, SUBTYPE_NULL_FUNC, 1, pAd->CommonCfg.Bssid, pAd->CommonCfg.Bssid); - pHdr80211->Duration = 0; - pHdr80211->FC.Type = BTYPE_DATA; - pHdr80211->FC.PwrMgmt = (pAd->StaCfg.Psm == PWR_SAVE); - - // Send using priority queue - MiniportMMRequest(pAd, 0, pOutBuffer, sizeof(HEADER_802_11)); - DBGPRINT(RT_DEBUG_TRACE, ("MlmeScanReqAction -- Send PSM Data frame\n")); - MlmeFreeMemory(pAd, pOutBuffer); - RTMPusecDelay(5000); - } - } - - pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; - Status = MLME_SUCCESS; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_SCAN_CONF, 2, &Status); - } -#endif // CONFIG_STA_SUPPORT // - - - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); - } - else - { -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // BBP and RF are not accessible in PS mode, we has to wake them up first - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - AsicForceWakeup(pAd, TRUE); - - // leave PSM during scanning. otherwise we may lost ProbeRsp & BEACON - if (pAd->StaCfg.Psm == PWR_SAVE) - RTMP_SET_PSM_BIT(pAd, PWR_ACTIVE); - } -#endif // CONFIG_STA_SUPPORT // - - AsicSwitchChannel(pAd, pAd->MlmeAux.Channel, TRUE); - AsicLockChannel(pAd, pAd->MlmeAux.Channel); - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (pAd->MlmeAux.Channel > 14) - { - if ((pAd->CommonCfg.bIEEE80211H == 1) && RadarChannelCheck(pAd, pAd->MlmeAux.Channel)) - { - ScanType = SCAN_PASSIVE; - ScanTimeIn5gChannel = MIN_CHANNEL_TIME; - } - } - -#ifdef CARRIER_DETECTION_SUPPORT // Roger sync Carrier - // carrier detection - if (pAd->CommonCfg.CarrierDetect.Enable == TRUE) - { - ScanType = SCAN_PASSIVE; - ScanTimeIn5gChannel = MIN_CHANNEL_TIME; - } -#endif // CARRIER_DETECTION_SUPPORT // - } - -#endif // CONFIG_STA_SUPPORT // - - //Global country domain(ch1-11:active scan, ch12-14 passive scan) - if ((pAd->MlmeAux.Channel <= 14) && (pAd->MlmeAux.Channel >= 12) && ((pAd->CommonCfg.CountryRegion & 0x7f) == REGION_31_BG_BAND)) - { - ScanType = SCAN_PASSIVE; - } - - // We need to shorten active scan time in order for WZC connect issue - // Chnage the channel scan time for CISCO stuff based on its IAPP announcement - if (ScanType == FAST_SCAN_ACTIVE) - RTMPSetTimer(&pAd->MlmeAux.ScanTimer, FAST_ACTIVE_SCAN_TIME); - else // must be SCAN_PASSIVE or SCAN_ACTIVE - { - if ((pAd->CommonCfg.PhyMode == PHY_11ABG_MIXED) -#ifdef DOT11_N_SUPPORT - || (pAd->CommonCfg.PhyMode == PHY_11ABGN_MIXED) || (pAd->CommonCfg.PhyMode == PHY_11AGN_MIXED) -#endif // DOT11_N_SUPPORT // - ) - { - if (pAd->MlmeAux.Channel > 14) - RTMPSetTimer(&pAd->MlmeAux.ScanTimer, ScanTimeIn5gChannel); - else - RTMPSetTimer(&pAd->MlmeAux.ScanTimer, MIN_CHANNEL_TIME); - } - else - RTMPSetTimer(&pAd->MlmeAux.ScanTimer, MAX_CHANNEL_TIME); - } - - if ((ScanType == SCAN_ACTIVE) - || (ScanType == FAST_SCAN_ACTIVE) - ) - { - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - ScanNextChannel() allocate memory fail\n")); -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; - Status = MLME_FAIL_NO_RESOURCE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_SCAN_CONF, 2, &Status); - } -#endif // CONFIG_STA_SUPPORT // - - return; - } - - // There is no need to send broadcast probe request if active scan is in effect. - if ((ScanType == SCAN_ACTIVE) || (ScanType == FAST_SCAN_ACTIVE) - ) - SsidLen = pAd->MlmeAux.SsidLen; - else - SsidLen = 0; - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - MgtMacHeaderInit(pAd, &Hdr80211, SUBTYPE_PROBE_REQ, 0, BROADCAST_ADDR, BROADCAST_ADDR); -#endif // CONFIG_STA_SUPPORT // - - - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &Hdr80211, - 1, &SsidIe, - 1, &SsidLen, - SsidLen, pAd->MlmeAux.Ssid, - 1, &SupRateIe, - 1, &pAd->CommonCfg.SupRateLen, - pAd->CommonCfg.SupRateLen, pAd->CommonCfg.SupRate, - END_OF_ARGS); - - if (pAd->CommonCfg.ExtRateLen) - { - ULONG Tmp; - MakeOutgoingFrame(pOutBuffer + FrameLen, &Tmp, - 1, &ExtRateIe, - 1, &pAd->CommonCfg.ExtRateLen, - pAd->CommonCfg.ExtRateLen, pAd->CommonCfg.ExtRate, - END_OF_ARGS); - FrameLen += Tmp; - } - -#ifdef DOT11_N_SUPPORT - if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) - { - ULONG Tmp; - UCHAR HtLen; - UCHAR BROADCOM[4] = {0x0, 0x90, 0x4c, 0x33}; -#ifdef RT_BIG_ENDIAN - HT_CAPABILITY_IE HtCapabilityTmp; -#endif - if (pAd->bBroadComHT == TRUE) - { - HtLen = pAd->MlmeAux.HtCapabilityLen + 4; -#ifdef RT_BIG_ENDIAN - NdisMoveMemory(&HtCapabilityTmp, &pAd->MlmeAux.HtCapability, SIZE_HT_CAP_IE); - *(USHORT *)(&HtCapabilityTmp.HtCapInfo) = SWAP16(*(USHORT *)(&HtCapabilityTmp.HtCapInfo)); -#ifdef UNALIGNMENT_SUPPORT - { - EXT_HT_CAP_INFO extHtCapInfo; - - NdisMoveMemory((PUCHAR)(&extHtCapInfo), (PUCHAR)(&HtCapabilityTmp.ExtHtCapInfo), sizeof(EXT_HT_CAP_INFO)); - *(USHORT *)(&extHtCapInfo) = cpu2le16(*(USHORT *)(&extHtCapInfo)); - NdisMoveMemory((PUCHAR)(&HtCapabilityTmp.ExtHtCapInfo), (PUCHAR)(&extHtCapInfo), sizeof(EXT_HT_CAP_INFO)); - } -#else - *(USHORT *)(&HtCapabilityTmp.ExtHtCapInfo) = cpu2le16(*(USHORT *)(&HtCapabilityTmp.ExtHtCapInfo)); -#endif // UNALIGNMENT_SUPPORT // - - MakeOutgoingFrame(pOutBuffer + FrameLen, &Tmp, - 1, &WpaIe, - 1, &HtLen, - 4, &BROADCOM[0], - pAd->MlmeAux.HtCapabilityLen, &HtCapabilityTmp, - END_OF_ARGS); -#else - MakeOutgoingFrame(pOutBuffer + FrameLen, &Tmp, - 1, &WpaIe, - 1, &HtLen, - 4, &BROADCOM[0], - pAd->MlmeAux.HtCapabilityLen, &pAd->MlmeAux.HtCapability, - END_OF_ARGS); -#endif // RT_BIG_ENDIAN // - } - else - { - HtLen = pAd->MlmeAux.HtCapabilityLen; -#ifdef RT_BIG_ENDIAN - NdisMoveMemory(&HtCapabilityTmp, &pAd->CommonCfg.HtCapability, SIZE_HT_CAP_IE); - *(USHORT *)(&HtCapabilityTmp.HtCapInfo) = SWAP16(*(USHORT *)(&HtCapabilityTmp.HtCapInfo)); -#ifdef UNALIGNMENT_SUPPORT - { - EXT_HT_CAP_INFO extHtCapInfo; - - NdisMoveMemory((PUCHAR)(&extHtCapInfo), (PUCHAR)(&HtCapabilityTmp.ExtHtCapInfo), sizeof(EXT_HT_CAP_INFO)); - *(USHORT *)(&extHtCapInfo) = cpu2le16(*(USHORT *)(&extHtCapInfo)); - NdisMoveMemory((PUCHAR)(&HtCapabilityTmp.ExtHtCapInfo), (PUCHAR)(&extHtCapInfo), sizeof(EXT_HT_CAP_INFO)); - } -#else - *(USHORT *)(&HtCapabilityTmp.ExtHtCapInfo) = cpu2le16(*(USHORT *)(&HtCapabilityTmp.ExtHtCapInfo)); -#endif // UNALIGNMENT_SUPPORT // - - MakeOutgoingFrame(pOutBuffer + FrameLen, &Tmp, - 1, &HtCapIe, - 1, &HtLen, - HtLen, &HtCapabilityTmp, - END_OF_ARGS); -#else - MakeOutgoingFrame(pOutBuffer + FrameLen, &Tmp, - 1, &HtCapIe, - 1, &HtLen, - HtLen, &pAd->CommonCfg.HtCapability, - END_OF_ARGS); -#endif // RT_BIG_ENDIAN // - } - FrameLen += Tmp; - -#ifdef DOT11N_DRAFT3 - if (pAd->CommonCfg.BACapability.field.b2040CoexistScanSup == 1) - { - ULONG Tmp; - HtLen = 1; - MakeOutgoingFrame(pOutBuffer + FrameLen, &Tmp, - 1, &ExtHtCapIe, - 1, &HtLen, - 1, &pAd->CommonCfg.BSSCoexist2040.word, - END_OF_ARGS); - - FrameLen += Tmp; - } -#endif // DOT11N_DRAFT3 // - } -#endif // DOT11_N_SUPPORT // - - - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - } - - // For SCAN_CISCO_PASSIVE, do nothing and silently wait for beacon or other probe reponse - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - pAd->Mlme.SyncMachine.CurrState = SCAN_LISTEN; -#endif // CONFIG_STA_SUPPORT // - - } -} - -VOID MgtProbReqMacHeaderInit( - IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, - IN UCHAR SubType, - IN UCHAR ToDs, - IN PUCHAR pDA, - IN PUCHAR pBssid) -{ - NdisZeroMemory(pHdr80211, sizeof(HEADER_802_11)); - - pHdr80211->FC.Type = BTYPE_MGMT; - pHdr80211->FC.SubType = SubType; - if (SubType == SUBTYPE_ACK) - pHdr80211->FC.Type = BTYPE_CNTL; - pHdr80211->FC.ToDs = ToDs; - COPY_MAC_ADDR(pHdr80211->Addr1, pDA); - COPY_MAC_ADDR(pHdr80211->Addr2, pAd->CurrentAddress); - COPY_MAC_ADDR(pHdr80211->Addr3, pBssid); -} diff --git a/drivers/staging/rt3090/common/cmm_tkip.c b/drivers/staging/rt3090/common/cmm_tkip.c deleted file mode 100644 index 0b474f20859b..000000000000 --- a/drivers/staging/rt3090/common/cmm_tkip.c +++ /dev/null @@ -1,966 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - cmm_tkip.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Paul Wu 02-25-02 Initial -*/ - -#include "../rt_config.h" - - -// Rotation functions on 32 bit values -#define ROL32( A, n ) \ - ( ((A) << (n)) | ( ((A)>>(32-(n))) & ( (1UL << (n)) - 1 ) ) ) -#define ROR32( A, n ) ROL32( (A), 32-(n) ) - -UINT Tkip_Sbox_Lower[256] = -{ - 0xA5,0x84,0x99,0x8D,0x0D,0xBD,0xB1,0x54, - 0x50,0x03,0xA9,0x7D,0x19,0x62,0xE6,0x9A, - 0x45,0x9D,0x40,0x87,0x15,0xEB,0xC9,0x0B, - 0xEC,0x67,0xFD,0xEA,0xBF,0xF7,0x96,0x5B, - 0xC2,0x1C,0xAE,0x6A,0x5A,0x41,0x02,0x4F, - 0x5C,0xF4,0x34,0x08,0x93,0x73,0x53,0x3F, - 0x0C,0x52,0x65,0x5E,0x28,0xA1,0x0F,0xB5, - 0x09,0x36,0x9B,0x3D,0x26,0x69,0xCD,0x9F, - 0x1B,0x9E,0x74,0x2E,0x2D,0xB2,0xEE,0xFB, - 0xF6,0x4D,0x61,0xCE,0x7B,0x3E,0x71,0x97, - 0xF5,0x68,0x00,0x2C,0x60,0x1F,0xC8,0xED, - 0xBE,0x46,0xD9,0x4B,0xDE,0xD4,0xE8,0x4A, - 0x6B,0x2A,0xE5,0x16,0xC5,0xD7,0x55,0x94, - 0xCF,0x10,0x06,0x81,0xF0,0x44,0xBA,0xE3, - 0xF3,0xFE,0xC0,0x8A,0xAD,0xBC,0x48,0x04, - 0xDF,0xC1,0x75,0x63,0x30,0x1A,0x0E,0x6D, - 0x4C,0x14,0x35,0x2F,0xE1,0xA2,0xCC,0x39, - 0x57,0xF2,0x82,0x47,0xAC,0xE7,0x2B,0x95, - 0xA0,0x98,0xD1,0x7F,0x66,0x7E,0xAB,0x83, - 0xCA,0x29,0xD3,0x3C,0x79,0xE2,0x1D,0x76, - 0x3B,0x56,0x4E,0x1E,0xDB,0x0A,0x6C,0xE4, - 0x5D,0x6E,0xEF,0xA6,0xA8,0xA4,0x37,0x8B, - 0x32,0x43,0x59,0xB7,0x8C,0x64,0xD2,0xE0, - 0xB4,0xFA,0x07,0x25,0xAF,0x8E,0xE9,0x18, - 0xD5,0x88,0x6F,0x72,0x24,0xF1,0xC7,0x51, - 0x23,0x7C,0x9C,0x21,0xDD,0xDC,0x86,0x85, - 0x90,0x42,0xC4,0xAA,0xD8,0x05,0x01,0x12, - 0xA3,0x5F,0xF9,0xD0,0x91,0x58,0x27,0xB9, - 0x38,0x13,0xB3,0x33,0xBB,0x70,0x89,0xA7, - 0xB6,0x22,0x92,0x20,0x49,0xFF,0x78,0x7A, - 0x8F,0xF8,0x80,0x17,0xDA,0x31,0xC6,0xB8, - 0xC3,0xB0,0x77,0x11,0xCB,0xFC,0xD6,0x3A -}; - -UINT Tkip_Sbox_Upper[256] = -{ - 0xC6,0xF8,0xEE,0xF6,0xFF,0xD6,0xDE,0x91, - 0x60,0x02,0xCE,0x56,0xE7,0xB5,0x4D,0xEC, - 0x8F,0x1F,0x89,0xFA,0xEF,0xB2,0x8E,0xFB, - 0x41,0xB3,0x5F,0x45,0x23,0x53,0xE4,0x9B, - 0x75,0xE1,0x3D,0x4C,0x6C,0x7E,0xF5,0x83, - 0x68,0x51,0xD1,0xF9,0xE2,0xAB,0x62,0x2A, - 0x08,0x95,0x46,0x9D,0x30,0x37,0x0A,0x2F, - 0x0E,0x24,0x1B,0xDF,0xCD,0x4E,0x7F,0xEA, - 0x12,0x1D,0x58,0x34,0x36,0xDC,0xB4,0x5B, - 0xA4,0x76,0xB7,0x7D,0x52,0xDD,0x5E,0x13, - 0xA6,0xB9,0x00,0xC1,0x40,0xE3,0x79,0xB6, - 0xD4,0x8D,0x67,0x72,0x94,0x98,0xB0,0x85, - 0xBB,0xC5,0x4F,0xED,0x86,0x9A,0x66,0x11, - 0x8A,0xE9,0x04,0xFE,0xA0,0x78,0x25,0x4B, - 0xA2,0x5D,0x80,0x05,0x3F,0x21,0x70,0xF1, - 0x63,0x77,0xAF,0x42,0x20,0xE5,0xFD,0xBF, - 0x81,0x18,0x26,0xC3,0xBE,0x35,0x88,0x2E, - 0x93,0x55,0xFC,0x7A,0xC8,0xBA,0x32,0xE6, - 0xC0,0x19,0x9E,0xA3,0x44,0x54,0x3B,0x0B, - 0x8C,0xC7,0x6B,0x28,0xA7,0xBC,0x16,0xAD, - 0xDB,0x64,0x74,0x14,0x92,0x0C,0x48,0xB8, - 0x9F,0xBD,0x43,0xC4,0x39,0x31,0xD3,0xF2, - 0xD5,0x8B,0x6E,0xDA,0x01,0xB1,0x9C,0x49, - 0xD8,0xAC,0xF3,0xCF,0xCA,0xF4,0x47,0x10, - 0x6F,0xF0,0x4A,0x5C,0x38,0x57,0x73,0x97, - 0xCB,0xA1,0xE8,0x3E,0x96,0x61,0x0D,0x0F, - 0xE0,0x7C,0x71,0xCC,0x90,0x06,0xF7,0x1C, - 0xC2,0x6A,0xAE,0x69,0x17,0x99,0x3A,0x27, - 0xD9,0xEB,0x2B,0x22,0xD2,0xA9,0x07,0x33, - 0x2D,0x3C,0x15,0xC9,0x87,0xAA,0x50,0xA5, - 0x03,0x59,0x09,0x1A,0x65,0xD7,0x84,0xD0, - 0x82,0x29,0x5A,0x1E,0x7B,0xA8,0x6D,0x2C -}; - -// -// Expanded IV for TKIP function. -// -typedef struct PACKED _IV_CONTROL_ -{ - union PACKED - { - struct PACKED - { - UCHAR rc0; - UCHAR rc1; - UCHAR rc2; - - union PACKED - { - struct PACKED - { -#ifdef RT_BIG_ENDIAN - UCHAR KeyID:2; - UCHAR ExtIV:1; - UCHAR Rsvd:5; -#else - UCHAR Rsvd:5; - UCHAR ExtIV:1; - UCHAR KeyID:2; -#endif - } field; - UCHAR Byte; - } CONTROL; - } field; - - ULONG word; - } IV16; - - ULONG IV32; -} TKIP_IV, *PTKIP_IV; - - -/* - ======================================================================== - - Routine Description: - Convert from UCHAR[] to ULONG in a portable way - - Arguments: - pMICKey pointer to MIC Key - - Return Value: - None - - Note: - - ======================================================================== -*/ -ULONG RTMPTkipGetUInt32( - IN PUCHAR pMICKey) -{ - ULONG res = 0; - INT i; - - for (i = 0; i < 4; i++) - { - res |= (*pMICKey++) << (8 * i); - } - - return res; -} - -/* - ======================================================================== - - Routine Description: - Convert from ULONG to UCHAR[] in a portable way - - Arguments: - pDst pointer to destination for convert ULONG to UCHAR[] - val the value for convert - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPTkipPutUInt32( - IN OUT PUCHAR pDst, - IN ULONG val) -{ - INT i; - - for(i = 0; i < 4; i++) - { - *pDst++ = (UCHAR) (val & 0xff); - val >>= 8; - } -} - -/* - ======================================================================== - - Routine Description: - Set the MIC Key. - - Arguments: - pAd Pointer to our adapter - pMICKey pointer to MIC Key - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPTkipSetMICKey( - IN PTKIP_KEY_INFO pTkip, - IN PUCHAR pMICKey) -{ - // Set the key - pTkip->K0 = RTMPTkipGetUInt32(pMICKey); - pTkip->K1 = RTMPTkipGetUInt32(pMICKey + 4); - // and reset the message - pTkip->L = pTkip->K0; - pTkip->R = pTkip->K1; - pTkip->nBytesInM = 0; - pTkip->M = 0; -} - -/* - ======================================================================== - - Routine Description: - Calculate the MIC Value. - - Arguments: - pAd Pointer to our adapter - uChar Append this uChar - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPTkipAppendByte( - IN PTKIP_KEY_INFO pTkip, - IN UCHAR uChar) -{ - // Append the byte to our word-sized buffer - pTkip->M |= (uChar << (8* pTkip->nBytesInM)); - pTkip->nBytesInM++; - // Process the word if it is full. - if( pTkip->nBytesInM >= 4 ) - { - pTkip->L ^= pTkip->M; - pTkip->R ^= ROL32( pTkip->L, 17 ); - pTkip->L += pTkip->R; - pTkip->R ^= ((pTkip->L & 0xff00ff00) >> 8) | ((pTkip->L & 0x00ff00ff) << 8); - pTkip->L += pTkip->R; - pTkip->R ^= ROL32( pTkip->L, 3 ); - pTkip->L += pTkip->R; - pTkip->R ^= ROR32( pTkip->L, 2 ); - pTkip->L += pTkip->R; - // Clear the buffer - pTkip->M = 0; - pTkip->nBytesInM = 0; - } -} - -/* - ======================================================================== - - Routine Description: - Calculate the MIC Value. - - Arguments: - pAd Pointer to our adapter - pSrc Pointer to source data for Calculate MIC Value - Len Indicate the length of the source data - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPTkipAppend( - IN PTKIP_KEY_INFO pTkip, - IN PUCHAR pSrc, - IN UINT nBytes) -{ - // This is simple - while(nBytes > 0) - { - RTMPTkipAppendByte(pTkip, *pSrc++); - nBytes--; - } -} - -/* - ======================================================================== - - Routine Description: - Get the MIC Value. - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - the MIC Value is store in pAd->PrivateInfo.MIC - ======================================================================== -*/ -VOID RTMPTkipGetMIC( - IN PTKIP_KEY_INFO pTkip) -{ - // Append the minimum padding - RTMPTkipAppendByte(pTkip, 0x5a ); - RTMPTkipAppendByte(pTkip, 0 ); - RTMPTkipAppendByte(pTkip, 0 ); - RTMPTkipAppendByte(pTkip, 0 ); - RTMPTkipAppendByte(pTkip, 0 ); - // and then zeroes until the length is a multiple of 4 - while( pTkip->nBytesInM != 0 ) - { - RTMPTkipAppendByte(pTkip, 0 ); - } - // The appendByte function has already computed the result. - RTMPTkipPutUInt32(pTkip->MIC, pTkip->L); - RTMPTkipPutUInt32(pTkip->MIC + 4, pTkip->R); -} - -/* - ======================================================================== - - Routine Description: - Init Tkip function. - - Arguments: - pAd Pointer to our adapter - pTKey Pointer to the Temporal Key (TK), TK shall be 128bits. - KeyId TK Key ID - pTA Pointer to transmitter address - pMICKey pointer to MIC Key - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPInitTkipEngine( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKey, - IN UCHAR KeyId, - IN PUCHAR pTA, - IN PUCHAR pMICKey, - IN PUCHAR pTSC, - OUT PULONG pIV16, - OUT PULONG pIV32) -{ - TKIP_IV tkipIv; - - // Prepare 8 bytes TKIP encapsulation for MPDU - NdisZeroMemory(&tkipIv, sizeof(TKIP_IV)); - tkipIv.IV16.field.rc0 = *(pTSC + 1); - tkipIv.IV16.field.rc1 = (tkipIv.IV16.field.rc0 | 0x20) & 0x7f; - tkipIv.IV16.field.rc2 = *pTSC; - tkipIv.IV16.field.CONTROL.field.ExtIV = 1; // 0: non-extended IV, 1: an extended IV - tkipIv.IV16.field.CONTROL.field.KeyID = KeyId; -// tkipIv.IV32 = *(PULONG)(pTSC + 2); - NdisMoveMemory(&tkipIv.IV32, (pTSC + 2), 4); // Copy IV - - *pIV16 = tkipIv.IV16.word; - *pIV32 = tkipIv.IV32; -} - -/* - ======================================================================== - - Routine Description: - Init MIC Value calculation function which include set MIC key & - calculate first 16 bytes (DA + SA + priority + 0) - - Arguments: - pAd Pointer to our adapter - pTKey Pointer to the Temporal Key (TK), TK shall be 128bits. - pDA Pointer to DA address - pSA Pointer to SA address - pMICKey pointer to MIC Key - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID RTMPInitMICEngine( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKey, - IN PUCHAR pDA, - IN PUCHAR pSA, - IN UCHAR UserPriority, - IN PUCHAR pMICKey) -{ - ULONG Priority = UserPriority; - - // Init MIC value calculation - RTMPTkipSetMICKey(&pAd->PrivateInfo.Tx, pMICKey); - // DA - RTMPTkipAppend(&pAd->PrivateInfo.Tx, pDA, MAC_ADDR_LEN); - // SA - RTMPTkipAppend(&pAd->PrivateInfo.Tx, pSA, MAC_ADDR_LEN); - // Priority + 3 bytes of 0 - RTMPTkipAppend(&pAd->PrivateInfo.Tx, (PUCHAR)&Priority, 4); -} - -/* - ======================================================================== - - Routine Description: - Compare MIC value of received MSDU - - Arguments: - pAd Pointer to our adapter - pSrc Pointer to the received Plain text data - pDA Pointer to DA address - pSA Pointer to SA address - pMICKey pointer to MIC Key - Len the length of the received plain text data exclude MIC value - - Return Value: - TRUE MIC value matched - FALSE MIC value mismatched - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -BOOLEAN RTMPTkipCompareMICValue( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pSrc, - IN PUCHAR pDA, - IN PUCHAR pSA, - IN PUCHAR pMICKey, - IN UCHAR UserPriority, - IN UINT Len) -{ - UCHAR OldMic[8]; - ULONG Priority = UserPriority; - - // Init MIC value calculation - RTMPTkipSetMICKey(&pAd->PrivateInfo.Rx, pMICKey); - // DA - RTMPTkipAppend(&pAd->PrivateInfo.Rx, pDA, MAC_ADDR_LEN); - // SA - RTMPTkipAppend(&pAd->PrivateInfo.Rx, pSA, MAC_ADDR_LEN); - // Priority + 3 bytes of 0 - RTMPTkipAppend(&pAd->PrivateInfo.Rx, (PUCHAR)&Priority, 4); - - // Calculate MIC value from plain text data - RTMPTkipAppend(&pAd->PrivateInfo.Rx, pSrc, Len); - - // Get MIC valude from received frame - NdisMoveMemory(OldMic, pSrc + Len, 8); - - // Get MIC value from decrypted plain data - RTMPTkipGetMIC(&pAd->PrivateInfo.Rx); - - // Move MIC value from MSDU, this steps should move to data path. - // Since the MIC value might cross MPDUs. - if(!NdisEqualMemory(pAd->PrivateInfo.Rx.MIC, OldMic, 8)) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("RTMPTkipCompareMICValue(): TKIP MIC Error !\n")); //MIC error. - - - return (FALSE); - } - return (TRUE); -} - -/* - ======================================================================== - - Routine Description: - Compare MIC value of received MSDU - - Arguments: - pAd Pointer to our adapter - pLLC LLC header - pSrc Pointer to the received Plain text data - pDA Pointer to DA address - pSA Pointer to SA address - pMICKey pointer to MIC Key - Len the length of the received plain text data exclude MIC value - - Return Value: - TRUE MIC value matched - FALSE MIC value mismatched - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -BOOLEAN RTMPTkipCompareMICValueWithLLC( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pLLC, - IN PUCHAR pSrc, - IN PUCHAR pDA, - IN PUCHAR pSA, - IN PUCHAR pMICKey, - IN UINT Len) -{ - UCHAR OldMic[8]; - ULONG Priority = 0; - - // Init MIC value calculation - RTMPTkipSetMICKey(&pAd->PrivateInfo.Rx, pMICKey); - // DA - RTMPTkipAppend(&pAd->PrivateInfo.Rx, pDA, MAC_ADDR_LEN); - // SA - RTMPTkipAppend(&pAd->PrivateInfo.Rx, pSA, MAC_ADDR_LEN); - // Priority + 3 bytes of 0 - RTMPTkipAppend(&pAd->PrivateInfo.Rx, (PUCHAR)&Priority, 4); - - // Start with LLC header - RTMPTkipAppend(&pAd->PrivateInfo.Rx, pLLC, 8); - - // Calculate MIC value from plain text data - RTMPTkipAppend(&pAd->PrivateInfo.Rx, pSrc, Len); - - // Get MIC valude from received frame - NdisMoveMemory(OldMic, pSrc + Len, 8); - - // Get MIC value from decrypted plain data - RTMPTkipGetMIC(&pAd->PrivateInfo.Rx); - - // Move MIC value from MSDU, this steps should move to data path. - // Since the MIC value might cross MPDUs. - if(!NdisEqualMemory(pAd->PrivateInfo.Rx.MIC, OldMic, 8)) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("RTMPTkipCompareMICValueWithLLC(): TKIP MIC Error !\n")); //MIC error. - - - return (FALSE); - } - return (TRUE); -} -/* - ======================================================================== - - Routine Description: - Copy frame from waiting queue into relative ring buffer and set - appropriate ASIC register to kick hardware transmit function - - Arguments: - pAd Pointer to our adapter - PNDIS_PACKET Pointer to Ndis Packet for MIC calculation - pEncap Pointer to LLC encap data - LenEncap Total encap length, might be 0 which indicates no encap - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPCalculateMICValue( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN PUCHAR pEncap, - IN PCIPHER_KEY pKey, - IN UCHAR apidx) -{ - PACKET_INFO PacketInfo; - PUCHAR pSrcBufVA; - UINT SrcBufLen; - PUCHAR pSrc; - UCHAR UserPriority; - UCHAR vlan_offset = 0; - - RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); - - UserPriority = RTMP_GET_PACKET_UP(pPacket); - pSrc = pSrcBufVA; - - // determine if this is a vlan packet - if (((*(pSrc + 12) << 8) + *(pSrc + 13)) == 0x8100) - vlan_offset = 4; - -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // - { - RTMPInitMICEngine( - pAd, - pKey->Key, - pSrc, - pSrc + 6, - UserPriority, - pKey->TxMic); - } - - - if (pEncap != NULL) - { - // LLC encapsulation - RTMPTkipAppend(&pAd->PrivateInfo.Tx, pEncap, 6); - // Protocol Type - RTMPTkipAppend(&pAd->PrivateInfo.Tx, pSrc + 12 + vlan_offset, 2); - } - SrcBufLen -= (14 + vlan_offset); - pSrc += (14 + vlan_offset); - do - { - if (SrcBufLen > 0) - { - RTMPTkipAppend(&pAd->PrivateInfo.Tx, pSrc, SrcBufLen); - } - - break; // No need handle next packet - - } while (TRUE); // End of copying payload - - // Compute the final MIC Value - RTMPTkipGetMIC(&pAd->PrivateInfo.Tx); -} - - -/************************************************************/ -/* tkip_sbox() */ -/* Returns a 16 bit value from a 64K entry table. The Table */ -/* is synthesized from two 256 entry byte wide tables. */ -/************************************************************/ - -UINT tkip_sbox(UINT index) -{ - UINT index_low; - UINT index_high; - UINT left, right; - - index_low = (index % 256); - index_high = ((index >> 8) % 256); - - left = Tkip_Sbox_Lower[index_low] + (Tkip_Sbox_Upper[index_low] * 256); - right = Tkip_Sbox_Upper[index_high] + (Tkip_Sbox_Lower[index_high] * 256); - - return (left ^ right); -} - -UINT rotr1(UINT a) -{ - unsigned int b; - - if ((a & 0x01) == 0x01) - { - b = (a >> 1) | 0x8000; - } - else - { - b = (a >> 1) & 0x7fff; - } - b = b % 65536; - return b; -} - -VOID RTMPTkipMixKey( - UCHAR *key, - UCHAR *ta, - ULONG pnl, /* Least significant 16 bits of PN */ - ULONG pnh, /* Most significant 32 bits of PN */ - UCHAR *rc4key, - UINT *p1k) -{ - - UINT tsc0; - UINT tsc1; - UINT tsc2; - - UINT ppk0; - UINT ppk1; - UINT ppk2; - UINT ppk3; - UINT ppk4; - UINT ppk5; - - INT i; - INT j; - - tsc0 = (unsigned int)((pnh >> 16) % 65536); /* msb */ - tsc1 = (unsigned int)(pnh % 65536); - tsc2 = (unsigned int)(pnl % 65536); /* lsb */ - - /* Phase 1, step 1 */ - p1k[0] = tsc1; - p1k[1] = tsc0; - p1k[2] = (UINT)(ta[0] + (ta[1]*256)); - p1k[3] = (UINT)(ta[2] + (ta[3]*256)); - p1k[4] = (UINT)(ta[4] + (ta[5]*256)); - - /* Phase 1, step 2 */ - for (i=0; i<8; i++) - { - j = 2*(i & 1); - p1k[0] = (p1k[0] + tkip_sbox( (p1k[4] ^ ((256*key[1+j]) + key[j])) % 65536 )) % 65536; - p1k[1] = (p1k[1] + tkip_sbox( (p1k[0] ^ ((256*key[5+j]) + key[4+j])) % 65536 )) % 65536; - p1k[2] = (p1k[2] + tkip_sbox( (p1k[1] ^ ((256*key[9+j]) + key[8+j])) % 65536 )) % 65536; - p1k[3] = (p1k[3] + tkip_sbox( (p1k[2] ^ ((256*key[13+j]) + key[12+j])) % 65536 )) % 65536; - p1k[4] = (p1k[4] + tkip_sbox( (p1k[3] ^ (((256*key[1+j]) + key[j]))) % 65536 )) % 65536; - p1k[4] = (p1k[4] + i) % 65536; - } - - /* Phase 2, Step 1 */ - ppk0 = p1k[0]; - ppk1 = p1k[1]; - ppk2 = p1k[2]; - ppk3 = p1k[3]; - ppk4 = p1k[4]; - ppk5 = (p1k[4] + tsc2) % 65536; - - /* Phase2, Step 2 */ - ppk0 = ppk0 + tkip_sbox( (ppk5 ^ ((256*key[1]) + key[0])) % 65536); - ppk1 = ppk1 + tkip_sbox( (ppk0 ^ ((256*key[3]) + key[2])) % 65536); - ppk2 = ppk2 + tkip_sbox( (ppk1 ^ ((256*key[5]) + key[4])) % 65536); - ppk3 = ppk3 + tkip_sbox( (ppk2 ^ ((256*key[7]) + key[6])) % 65536); - ppk4 = ppk4 + tkip_sbox( (ppk3 ^ ((256*key[9]) + key[8])) % 65536); - ppk5 = ppk5 + tkip_sbox( (ppk4 ^ ((256*key[11]) + key[10])) % 65536); - - ppk0 = ppk0 + rotr1(ppk5 ^ ((256*key[13]) + key[12])); - ppk1 = ppk1 + rotr1(ppk0 ^ ((256*key[15]) + key[14])); - ppk2 = ppk2 + rotr1(ppk1); - ppk3 = ppk3 + rotr1(ppk2); - ppk4 = ppk4 + rotr1(ppk3); - ppk5 = ppk5 + rotr1(ppk4); - - /* Phase 2, Step 3 */ - /* Phase 2, Step 3 */ - - tsc0 = (unsigned int)((pnh >> 16) % 65536); /* msb */ - tsc1 = (unsigned int)(pnh % 65536); - tsc2 = (unsigned int)(pnl % 65536); /* lsb */ - - rc4key[0] = (tsc2 >> 8) % 256; - rc4key[1] = (((tsc2 >> 8) % 256) | 0x20) & 0x7f; - rc4key[2] = tsc2 % 256; - rc4key[3] = ((ppk5 ^ ((256*key[1]) + key[0])) >> 1) % 256; - - rc4key[4] = ppk0 % 256; - rc4key[5] = (ppk0 >> 8) % 256; - - rc4key[6] = ppk1 % 256; - rc4key[7] = (ppk1 >> 8) % 256; - - rc4key[8] = ppk2 % 256; - rc4key[9] = (ppk2 >> 8) % 256; - - rc4key[10] = ppk3 % 256; - rc4key[11] = (ppk3 >> 8) % 256; - - rc4key[12] = ppk4 % 256; - rc4key[13] = (ppk4 >> 8) % 256; - - rc4key[14] = ppk5 % 256; - rc4key[15] = (ppk5 >> 8) % 256; -} - - -// -// TRUE: Success! -// FALSE: Decrypt Error! -// -BOOLEAN RTMPSoftDecryptTKIP( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, - IN UCHAR UserPriority, - IN PCIPHER_KEY pWpaKey) -{ - UCHAR KeyID; - UINT HeaderLen; - UCHAR fc0; - UCHAR fc1; - USHORT fc; - UINT frame_type; - UINT frame_subtype; - UINT from_ds; - UINT to_ds; - INT a4_exists; - INT qc_exists; - USHORT duration; - USHORT seq_control; - USHORT qos_control; - UCHAR TA[MAC_ADDR_LEN]; - UCHAR DA[MAC_ADDR_LEN]; - UCHAR SA[MAC_ADDR_LEN]; - UCHAR RC4Key[16]; - UINT p1k[5]; //for mix_key; - ULONG pnl;/* Least significant 16 bits of PN */ - ULONG pnh;/* Most significant 32 bits of PN */ - UINT num_blocks; - UINT payload_remainder; - ARCFOURCONTEXT ArcFourContext; - UINT crc32 = 0; - UINT trailfcs = 0; - UCHAR MIC[8]; - UCHAR TrailMIC[8]; - -#ifdef RT_BIG_ENDIAN - RTMPFrameEndianChange(pAd, (PUCHAR)pData, DIR_READ, FALSE); -#endif - - fc0 = *pData; - fc1 = *(pData + 1); - - fc = *((PUSHORT)pData); - - frame_type = ((fc0 >> 2) & 0x03); - frame_subtype = ((fc0 >> 4) & 0x0f); - - from_ds = (fc1 & 0x2) >> 1; - to_ds = (fc1 & 0x1); - - a4_exists = (from_ds & to_ds); - qc_exists = ((frame_subtype == 0x08) || /* Assumed QoS subtypes */ - (frame_subtype == 0x09) || /* Likely to change. */ - (frame_subtype == 0x0a) || - (frame_subtype == 0x0b) - ); - - HeaderLen = 24; - if (a4_exists) - HeaderLen += 6; - - KeyID = *((PUCHAR)(pData+ HeaderLen + 3)); - KeyID = KeyID >> 6; - - if (pWpaKey[KeyID].KeyLen == 0) - { - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSoftDecryptTKIP failed!(KeyID[%d] Length can not be 0)\n", KeyID)); - return FALSE; - } - - duration = *((PUSHORT)(pData+2)); - - seq_control = *((PUSHORT)(pData+22)); - - if (qc_exists) - { - if (a4_exists) - { - qos_control = *((PUSHORT)(pData+30)); - } - else - { - qos_control = *((PUSHORT)(pData+24)); - } - } - - if (to_ds == 0 && from_ds == 1) - { - NdisMoveMemory(DA, pData+4, MAC_ADDR_LEN); - NdisMoveMemory(SA, pData+16, MAC_ADDR_LEN); - NdisMoveMemory(TA, pData+10, MAC_ADDR_LEN); //BSSID - } - else if (to_ds == 0 && from_ds == 0 ) - { - NdisMoveMemory(TA, pData+10, MAC_ADDR_LEN); - NdisMoveMemory(DA, pData+4, MAC_ADDR_LEN); - NdisMoveMemory(SA, pData+10, MAC_ADDR_LEN); - } - else if (to_ds == 1 && from_ds == 0) - { - NdisMoveMemory(SA, pData+10, MAC_ADDR_LEN); - NdisMoveMemory(TA, pData+10, MAC_ADDR_LEN); - NdisMoveMemory(DA, pData+16, MAC_ADDR_LEN); - } - else if (to_ds == 1 && from_ds == 1) - { - NdisMoveMemory(TA, pData+10, MAC_ADDR_LEN); - NdisMoveMemory(DA, pData+16, MAC_ADDR_LEN); - NdisMoveMemory(SA, pData+22, MAC_ADDR_LEN); - } - - num_blocks = (DataByteCnt - 16) / 16; - payload_remainder = (DataByteCnt - 16) % 16; - - pnl = (*(pData + HeaderLen)) * 256 + *(pData + HeaderLen + 2); - pnh = *((PULONG)(pData + HeaderLen + 4)); - pnh = cpu2le32(pnh); - RTMPTkipMixKey(pWpaKey[KeyID].Key, TA, pnl, pnh, RC4Key, p1k); - - ARCFOUR_INIT(&ArcFourContext, RC4Key, 16); - - ARCFOUR_DECRYPT(&ArcFourContext, pData + HeaderLen, pData + HeaderLen + 8, DataByteCnt - HeaderLen - 8); - NdisMoveMemory(&trailfcs, pData + DataByteCnt - 8 - 4, 4); - crc32 = RTMP_CALC_FCS32(PPPINITFCS32, pData + HeaderLen, DataByteCnt - HeaderLen - 8 - 4); //Skip IV+EIV 8 bytes & Skip last 4 bytes(FCS). - crc32 ^= 0xffffffff; /* complement */ - - if(crc32 != cpu2le32(trailfcs)) - { - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSoftDecryptTKIP, WEP Data ICV Error !\n")); //ICV error. - - return (FALSE); - } - - NdisMoveMemory(TrailMIC, pData + DataByteCnt - 8 - 8 - 4, 8); - RTMPInitMICEngine(pAd, pWpaKey[KeyID].Key, DA, SA, UserPriority, pWpaKey[KeyID].RxMic); - RTMPTkipAppend(&pAd->PrivateInfo.Tx, pData + HeaderLen, DataByteCnt - HeaderLen - 8 - 12); - RTMPTkipGetMIC(&pAd->PrivateInfo.Tx); - NdisMoveMemory(MIC, pAd->PrivateInfo.Tx.MIC, 8); - - if (!NdisEqualMemory(MIC, TrailMIC, 8)) - { - DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptTKIP, WEP Data MIC Error !\n")); //MIC error. - //RTMPReportMicError(pAd, &pWpaKey[KeyID]); // marked by AlbertY @ 20060630 - return (FALSE); - } - -#ifdef RT_BIG_ENDIAN - RTMPFrameEndianChange(pAd, (PUCHAR)pData, DIR_READ, FALSE); -#endif - //DBGPRINT(RT_DEBUG_TRACE, "RTMPSoftDecryptTKIP Decript done!!\n"); - return TRUE; -} diff --git a/drivers/staging/rt3090/common/cmm_wep.c b/drivers/staging/rt3090/common/cmm_wep.c deleted file mode 100644 index d8ddfb245578..000000000000 --- a/drivers/staging/rt3090/common/cmm_wep.c +++ /dev/null @@ -1,500 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rtmp_wep.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Paul Wu 10-28-02 Initial -*/ - -#include "../rt_config.h" - - -UINT FCSTAB_32[256] = -{ - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, - 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, - 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, - 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, - 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, - 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, - 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, - 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, - 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, - 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, - 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, - 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, - 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, - 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, - 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, - 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, - 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, - 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, - 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, - 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, - 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, - 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, - 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, - 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, - 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, - 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, - 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, - 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, - 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, - 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, - 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, - 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, - 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, - 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, - 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, - 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, - 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, - 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, - 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, - 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, - 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, - 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, - 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, - 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, - 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, - 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, - 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, - 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, - 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, - 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, - 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, - 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, - 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, - 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, - 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, - 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, - 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, - 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d -}; - -/* -UCHAR WEPKEY[] = { - //IV - 0x00, 0x11, 0x22, - //WEP KEY - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC - }; - */ - -/* - ======================================================================== - - Routine Description: - Init WEP function. - - Arguments: - pAd Pointer to our adapter - pKey Pointer to the WEP KEY - KeyId WEP Key ID - KeyLen the length of WEP KEY - pDest Pointer to the destination which Encryption data will store in. - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPInitWepEngine( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKey, - IN UCHAR KeyId, - IN UCHAR KeyLen, - IN OUT PUCHAR pDest) -{ - UINT i; - UCHAR WEPKEY[] = { - //IV - 0x00, 0x11, 0x22, - //WEP KEY - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC - }; - - pAd->PrivateInfo.FCSCRC32 = PPPINITFCS32; //Init crc32. - - { - NdisMoveMemory(WEPKEY + 3, pKey, KeyLen); - - for(i = 0; i < 3; i++) - WEPKEY[i] = RandomByte(pAd); //Call mlme RandomByte() function. - ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, WEPKEY, KeyLen + 3); //INIT SBOX, KEYLEN+3(IV) - - NdisMoveMemory(pDest, WEPKEY, 3); //Append Init Vector - } - *(pDest+3) = (KeyId << 6); //Append KEYID - -} - -/* - ======================================================================== - - Routine Description: - Encrypt transimitted data - - Arguments: - pAd Pointer to our adapter - pSrc Pointer to the transimitted source data that will be encrypt - pDest Pointer to the destination where entryption data will be store in. - Len Indicate the length of the source data - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPEncryptData( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pSrc, - IN PUCHAR pDest, - IN UINT Len) -{ - pAd->PrivateInfo.FCSCRC32 = RTMP_CALC_FCS32(pAd->PrivateInfo.FCSCRC32, pSrc, Len); - ARCFOUR_ENCRYPT(&pAd->PrivateInfo.WEPCONTEXT, pDest, pSrc, Len); -} - - -/* - ======================================================================== - - Routine Description: - Decrypt received WEP data - - Arguments: - pAdapter Pointer to our adapter - pSrc Pointer to the received data - Len the length of the received data - - Return Value: - TRUE Decrypt WEP data success - FALSE Decrypt WEP data failed - - Note: - - ======================================================================== -*/ -BOOLEAN RTMPSoftDecryptWEP( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, - IN PCIPHER_KEY pGroupKey) -{ - UINT trailfcs; - UINT crc32; - UCHAR KeyIdx; - UCHAR WEPKEY[] = { - //IV - 0x00, 0x11, 0x22, - //WEP KEY - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC - }; - UCHAR *pPayload = (UCHAR *)pData + LENGTH_802_11; - ULONG payload_len = DataByteCnt - LENGTH_802_11; - - NdisMoveMemory(WEPKEY, pPayload, 3); //Get WEP IV - - KeyIdx = (*(pPayload + 3) & 0xc0) >> 6; - if (pGroupKey[KeyIdx].KeyLen == 0) - return (FALSE); - - NdisMoveMemory(WEPKEY + 3, pGroupKey[KeyIdx].Key, pGroupKey[KeyIdx].KeyLen); - ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, WEPKEY, pGroupKey[KeyIdx].KeyLen + 3); - ARCFOUR_DECRYPT(&pAd->PrivateInfo.WEPCONTEXT, pPayload, pPayload + 4, payload_len - 4); - NdisMoveMemory(&trailfcs, pPayload + payload_len - 8, 4); - crc32 = RTMP_CALC_FCS32(PPPINITFCS32, pPayload, payload_len - 8); //Skip last 4 bytes(FCS). - crc32 ^= 0xffffffff; /* complement */ - - if(crc32 != cpu2le32(trailfcs)) - { - DBGPRINT(RT_DEBUG_TRACE, ("! WEP Data CRC Error !\n")); //CRC error. - return (FALSE); - } - return (TRUE); -} - -/* - ======================================================================== - - Routine Description: - The Stream Cipher Encryption Algorithm "ARCFOUR" initialize - - Arguments: - Ctx Pointer to ARCFOUR CONTEXT (SBOX) - pKey Pointer to the WEP KEY - KeyLen Indicate the length fo the WEP KEY - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID ARCFOUR_INIT( - IN PARCFOURCONTEXT Ctx, - IN PUCHAR pKey, - IN UINT KeyLen) -{ - UCHAR t, u; - UINT keyindex; - UINT stateindex; - PUCHAR state; - UINT counter; - - state = Ctx->STATE; - Ctx->X = 0; - Ctx->Y = 0; - for (counter = 0; counter < 256; counter++) - state[counter] = (UCHAR)counter; - keyindex = 0; - stateindex = 0; - for (counter = 0; counter < 256; counter++) - { - t = state[counter]; - stateindex = (stateindex + pKey[keyindex] + t) & 0xff; - u = state[stateindex]; - state[stateindex] = t; - state[counter] = u; - if (++keyindex >= KeyLen) - keyindex = 0; - } -} - -/* - ======================================================================== - - Routine Description: - Get bytes from ARCFOUR CONTEXT (S-BOX) - - Arguments: - Ctx Pointer to ARCFOUR CONTEXT (SBOX) - - Return Value: - UCHAR - the value of the ARCFOUR CONTEXT (S-BOX) - - Note: - - ======================================================================== -*/ -UCHAR ARCFOUR_BYTE( - IN PARCFOURCONTEXT Ctx) -{ - UINT x; - UINT y; - UCHAR sx, sy; - PUCHAR state; - - state = Ctx->STATE; - x = (Ctx->X + 1) & 0xff; - sx = state[x]; - y = (sx + Ctx->Y) & 0xff; - sy = state[y]; - Ctx->X = x; - Ctx->Y = y; - state[y] = sx; - state[x] = sy; - - return(state[(sx + sy) & 0xff]); - -} - -/* - ======================================================================== - - Routine Description: - The Stream Cipher Decryption Algorithm - - Arguments: - Ctx Pointer to ARCFOUR CONTEXT (SBOX) - pDest Pointer to the Destination - pSrc Pointer to the Source data - Len Indicate the length of the Source data - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID ARCFOUR_DECRYPT( - IN PARCFOURCONTEXT Ctx, - IN PUCHAR pDest, - IN PUCHAR pSrc, - IN UINT Len) -{ - UINT i; - - for (i = 0; i < Len; i++) - pDest[i] = pSrc[i] ^ ARCFOUR_BYTE(Ctx); -} - -/* - ======================================================================== - - Routine Description: - The Stream Cipher Encryption Algorithm - - Arguments: - Ctx Pointer to ARCFOUR CONTEXT (SBOX) - pDest Pointer to the Destination - pSrc Pointer to the Source data - Len Indicate the length of the Source dta - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID ARCFOUR_ENCRYPT( - IN PARCFOURCONTEXT Ctx, - IN PUCHAR pDest, - IN PUCHAR pSrc, - IN UINT Len) -{ - UINT i; - - for (i = 0; i < Len; i++) - pDest[i] = pSrc[i] ^ ARCFOUR_BYTE(Ctx); -} - -/* - ======================================================================== - - Routine Description: - The Stream Cipher Encryption Algorithm which conform to the special requirement to encrypt GTK. - - Arguments: - Ctx Pointer to ARCFOUR CONTEXT (SBOX) - pDest Pointer to the Destination - pSrc Pointer to the Source data - Len Indicate the length of the Source dta - - - ======================================================================== -*/ - -VOID WPAARCFOUR_ENCRYPT( - IN PARCFOURCONTEXT Ctx, - IN PUCHAR pDest, - IN PUCHAR pSrc, - IN UINT Len) -{ - UINT i; - //discard first 256 bytes - for (i = 0; i < 256; i++) - ARCFOUR_BYTE(Ctx); - - for (i = 0; i < Len; i++) - pDest[i] = pSrc[i] ^ ARCFOUR_BYTE(Ctx); -} - - -/* - ======================================================================== - - Routine Description: - Calculate a new FCS given the current FCS and the new data. - - Arguments: - Fcs the original FCS value - Cp pointer to the data which will be calculate the FCS - Len the length of the data - - Return Value: - UINT - FCS 32 bits - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -UINT RTMP_CALC_FCS32( - IN UINT Fcs, - IN PUCHAR Cp, - IN INT Len) -{ - while (Len--) - Fcs = (((Fcs) >> 8) ^ FCSTAB_32[((Fcs) ^ (*Cp++)) & 0xff]); - - return (Fcs); -} - - -/* - ======================================================================== - - Routine Description: - Get last FCS and encrypt it to the destination - - Arguments: - pDest Pointer to the Destination - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID RTMPSetICV( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDest) -{ - pAd->PrivateInfo.FCSCRC32 ^= 0xffffffff; /* complement */ - pAd->PrivateInfo.FCSCRC32 = cpu2le32(pAd->PrivateInfo.FCSCRC32); - - ARCFOUR_ENCRYPT(&pAd->PrivateInfo.WEPCONTEXT, pDest, (PUCHAR) &pAd->PrivateInfo.FCSCRC32, 4); -} diff --git a/drivers/staging/rt3090/common/cmm_wpa.c b/drivers/staging/rt3090/common/cmm_wpa.c deleted file mode 100644 index bf68ad8747ac..000000000000 --- a/drivers/staging/rt3090/common/cmm_wpa.c +++ /dev/null @@ -1,3149 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - wpa.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Jan Lee 03-07-22 Initial - Paul Lin 03-11-28 Modify for supplicant -*/ - -#include "../rt_config.h" - - -// WPA OUI -UCHAR OUI_WPA_NONE_AKM[4] = {0x00, 0x50, 0xF2, 0x00}; -UCHAR OUI_WPA_VERSION[4] = {0x00, 0x50, 0xF2, 0x01}; -UCHAR OUI_WPA_WEP40[4] = {0x00, 0x50, 0xF2, 0x01}; -UCHAR OUI_WPA_TKIP[4] = {0x00, 0x50, 0xF2, 0x02}; -UCHAR OUI_WPA_CCMP[4] = {0x00, 0x50, 0xF2, 0x04}; -UCHAR OUI_WPA_WEP104[4] = {0x00, 0x50, 0xF2, 0x05}; -UCHAR OUI_WPA_8021X_AKM[4] = {0x00, 0x50, 0xF2, 0x01}; -UCHAR OUI_WPA_PSK_AKM[4] = {0x00, 0x50, 0xF2, 0x02}; -// WPA2 OUI -UCHAR OUI_WPA2_WEP40[4] = {0x00, 0x0F, 0xAC, 0x01}; -UCHAR OUI_WPA2_TKIP[4] = {0x00, 0x0F, 0xAC, 0x02}; -UCHAR OUI_WPA2_CCMP[4] = {0x00, 0x0F, 0xAC, 0x04}; -UCHAR OUI_WPA2_8021X_AKM[4] = {0x00, 0x0F, 0xAC, 0x01}; -UCHAR OUI_WPA2_PSK_AKM[4] = {0x00, 0x0F, 0xAC, 0x02}; -UCHAR OUI_WPA2_WEP104[4] = {0x00, 0x0F, 0xAC, 0x05}; - - - -static VOID ConstructEapolKeyData( - IN PMAC_TABLE_ENTRY pEntry, - IN UCHAR GroupKeyWepStatus, - IN UCHAR keyDescVer, - IN UCHAR MsgType, - IN UCHAR DefaultKeyIdx, - IN UCHAR *GTK, - IN UCHAR *RSNIE, - IN UCHAR RSNIE_LEN, - OUT PEAPOL_PACKET pMsg); - -static VOID CalculateMIC( - IN UCHAR KeyDescVer, - IN UCHAR *PTK, - OUT PEAPOL_PACKET pMsg); - -static VOID WpaEAPPacketAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -static VOID WpaEAPOLASFAlertAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -static VOID WpaEAPOLLogoffAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -static VOID WpaEAPOLStartAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -static VOID WpaEAPOLKeyAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -/* - ========================================================================== - Description: - association state machine init, including state transition and timer init - Parameters: - S - pointer to the association state machine - ========================================================================== - */ -VOID WpaStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - OUT STATE_MACHINE_FUNC Trans[]) -{ - StateMachineInit(S, (STATE_MACHINE_FUNC *)Trans, MAX_WPA_PTK_STATE, MAX_WPA_MSG, (STATE_MACHINE_FUNC)Drop, WPA_PTK, WPA_MACHINE_BASE); - - StateMachineSetAction(S, WPA_PTK, MT2_EAPPacket, (STATE_MACHINE_FUNC)WpaEAPPacketAction); - StateMachineSetAction(S, WPA_PTK, MT2_EAPOLStart, (STATE_MACHINE_FUNC)WpaEAPOLStartAction); - StateMachineSetAction(S, WPA_PTK, MT2_EAPOLLogoff, (STATE_MACHINE_FUNC)WpaEAPOLLogoffAction); - StateMachineSetAction(S, WPA_PTK, MT2_EAPOLKey, (STATE_MACHINE_FUNC)WpaEAPOLKeyAction); - StateMachineSetAction(S, WPA_PTK, MT2_EAPOLASFAlert, (STATE_MACHINE_FUNC)WpaEAPOLASFAlertAction); -} - -/* - ========================================================================== - Description: - this is state machine function. - When receiving EAP packets which is for 802.1x authentication use. - Not use in PSK case - Return: - ========================================================================== -*/ -VOID WpaEAPPacketAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ -} - -VOID WpaEAPOLASFAlertAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ -} - -VOID WpaEAPOLLogoffAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ -} - -/* - ========================================================================== - Description: - Start 4-way HS when rcv EAPOL_START which may create by our driver in assoc.c - Return: - ========================================================================== -*/ -VOID WpaEAPOLStartAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - MAC_TABLE_ENTRY *pEntry; - PHEADER_802_11 pHeader; - - DBGPRINT(RT_DEBUG_TRACE, ("WpaEAPOLStartAction ===> \n")); - - pHeader = (PHEADER_802_11)Elem->Msg; - - //For normaol PSK, we enqueue an EAPOL-Start command to trigger the process. - if (Elem->MsgLen == 6) - pEntry = MacTableLookup(pAd, Elem->Msg); - else - { - pEntry = MacTableLookup(pAd, pHeader->Addr2); - } - - if (pEntry) - { - DBGPRINT(RT_DEBUG_TRACE, (" PortSecured(%d), WpaState(%d), AuthMode(%d), PMKID_CacheIdx(%d) \n", pEntry->PortSecured, pEntry->WpaState, pEntry->AuthMode, pEntry->PMKID_CacheIdx)); - - if ((pEntry->PortSecured == WPA_802_1X_PORT_NOT_SECURED) - && (pEntry->WpaState < AS_PTKSTART) - && ((pEntry->AuthMode == Ndis802_11AuthModeWPAPSK) || (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK) || ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) && (pEntry->PMKID_CacheIdx != ENTRY_NOT_FOUND)))) - { - pEntry->PrivacyFilter = Ndis802_11PrivFilter8021xWEP; - pEntry->WpaState = AS_INITPSK; - pEntry->PortSecured = WPA_802_1X_PORT_NOT_SECURED; - NdisZeroMemory(pEntry->R_Counter, sizeof(pEntry->R_Counter)); - pEntry->ReTryCounter = PEER_MSG1_RETRY_TIMER_CTR; - - WPAStart4WayHS(pAd, pEntry, PEER_MSG1_RETRY_EXEC_INTV); - } - } -} - -/* - ========================================================================== - Description: - This is state machine function. - When receiving EAPOL packets which is for 802.1x key management. - Use both in WPA, and WPAPSK case. - In this function, further dispatch to different functions according to the received packet. 3 categories are : - 1. normal 4-way pairwisekey and 2-way groupkey handshake - 2. MIC error (Countermeasures attack) report packet from STA. - 3. Request for pairwise/group key update from STA - Return: - ========================================================================== -*/ -VOID WpaEAPOLKeyAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - MAC_TABLE_ENTRY *pEntry; - PHEADER_802_11 pHeader; - PEAPOL_PACKET pEapol_packet; - KEY_INFO peerKeyInfo; - - DBGPRINT(RT_DEBUG_TRACE, ("WpaEAPOLKeyAction ===>\n")); - - pHeader = (PHEADER_802_11)Elem->Msg; - pEapol_packet = (PEAPOL_PACKET)&Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; - - NdisZeroMemory((PUCHAR)&peerKeyInfo, sizeof(peerKeyInfo)); - NdisMoveMemory((PUCHAR)&peerKeyInfo, (PUCHAR)&pEapol_packet->KeyDesc.KeyInfo, sizeof(KEY_INFO)); - - hex_dump("Received Eapol frame", (unsigned char *)pEapol_packet, (Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H)); - - *((USHORT *)&peerKeyInfo) = cpu2le16(*((USHORT *)&peerKeyInfo)); - - do - { - pEntry = MacTableLookup(pAd, pHeader->Addr2); - - if (!pEntry || ((!pEntry->ValidAsCLI) && (!pEntry->ValidAsApCli))) - break; - - if (pEntry->AuthMode < Ndis802_11AuthModeWPA) - break; - - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPoL-Key frame from STA %02X-%02X-%02X-%02X-%02X-%02X\n", PRINT_MAC(pEntry->Addr))); - - if (((pEapol_packet->ProVer != EAPOL_VER) && (pEapol_packet->ProVer != EAPOL_VER2)) || - ((pEapol_packet->KeyDesc.Type != WPA1_KEY_DESC) && (pEapol_packet->KeyDesc.Type != WPA2_KEY_DESC))) - { - DBGPRINT(RT_DEBUG_ERROR, ("Key descripter does not match with WPA rule\n")); - break; - } - - // The value 1 shall be used for all EAPOL-Key frames to and from a STA when - // neither the group nor pairwise ciphers are CCMP for Key Descriptor 1. - if ((pEntry->WepStatus == Ndis802_11Encryption2Enabled) && (peerKeyInfo.KeyDescVer != DESC_TYPE_TKIP)) - { - DBGPRINT(RT_DEBUG_ERROR, ("Key descripter version not match(TKIP) \n")); - break; - } - // The value 2 shall be used for all EAPOL-Key frames to and from a STA when - // either the pairwise or the group cipher is AES-CCMP for Key Descriptor 2. - else if ((pEntry->WepStatus == Ndis802_11Encryption3Enabled) && (peerKeyInfo.KeyDescVer != DESC_TYPE_AES)) - { - DBGPRINT(RT_DEBUG_ERROR, ("Key descripter version not match(AES) \n")); - break; - } - - // Check if this STA is in class 3 state and the WPA state is started - if ((pEntry->Sst == SST_ASSOC) && (pEntry->WpaState >= AS_INITPSK)) - { - // Check the Key Ack (bit 7) of the Key Information to determine the Authenticator - // or not. - // An EAPOL-Key frame that is sent by the Supplicant in response to an EAPOL- - // Key frame from the Authenticator must not have the Ack bit set. - if (peerKeyInfo.KeyAck == 1) - { - // The frame is snet by Authenticator. - // So the Supplicant side shall handle this. - - if ((peerKeyInfo.Secure == 0) && (peerKeyInfo.Request == 0) && - (peerKeyInfo.Error == 0) && (peerKeyInfo.KeyType == PAIRWISEKEY)) - { - // Process 1. the message 1 of 4-way HS in WPA or WPA2 - // EAPOL-Key(0,0,1,0,P,0,0,ANonce,0,DataKD_M1) - // 2. the message 3 of 4-way HS in WPA - // EAPOL-Key(0,1,1,1,P,0,KeyRSC,ANonce,MIC,DataKD_M3) - if (peerKeyInfo.KeyMic == 0) - PeerPairMsg1Action(pAd, pEntry, Elem); - else - PeerPairMsg3Action(pAd, pEntry, Elem); - } - else if ((peerKeyInfo.Secure == 1) && - (peerKeyInfo.KeyMic == 1) && - (peerKeyInfo.Request == 0) && - (peerKeyInfo.Error == 0)) - { - // Process 1. the message 3 of 4-way HS in WPA2 - // EAPOL-Key(1,1,1,1,P,0,KeyRSC,ANonce,MIC,DataKD_M3) - // 2. the message 1 of group KS in WPA or WPA2 - // EAPOL-Key(1,1,1,0,G,0,Key RSC,0, MIC,GTK[N]) - if (peerKeyInfo.KeyType == PAIRWISEKEY) - PeerPairMsg3Action(pAd, pEntry, Elem); - else - PeerGroupMsg1Action(pAd, pEntry, Elem); - } - } - else - { - // The frame is snet by Supplicant. - // So the Authenticator side shall handle this. - if ((peerKeyInfo.Request == 0) && - (peerKeyInfo.Error == 0) && - (peerKeyInfo.KeyMic == 1)) - { - if (peerKeyInfo.Secure == 0 && peerKeyInfo.KeyType == PAIRWISEKEY) - { - // EAPOL-Key(0,1,0,0,P,0,0,SNonce,MIC,Data) - // Process 1. message 2 of 4-way HS in WPA or WPA2 - // 2. message 4 of 4-way HS in WPA - if (CONV_ARRARY_TO_UINT16(pEapol_packet->KeyDesc.KeyDataLen) == 0) - { - PeerPairMsg4Action(pAd, pEntry, Elem); - } - else - { - PeerPairMsg2Action(pAd, pEntry, Elem); - } - } - else if (peerKeyInfo.Secure == 1 && peerKeyInfo.KeyType == PAIRWISEKEY) - { - // EAPOL-Key(1,1,0,0,P,0,0,0,MIC,0) - // Process message 4 of 4-way HS in WPA2 - PeerPairMsg4Action(pAd, pEntry, Elem); - } - else if (peerKeyInfo.Secure == 1 && peerKeyInfo.KeyType == GROUPKEY) - { - // EAPOL-Key(1,1,0,0,G,0,0,0,MIC,0) - // Process message 2 of Group key HS in WPA or WPA2 - PeerGroupMsg2Action(pAd, pEntry, &Elem->Msg[LENGTH_802_11], (Elem->MsgLen - LENGTH_802_11)); - } - } - } - } - }while(FALSE); -} - -/* - ======================================================================== - - Routine Description: - Copy frame from waiting queue into relative ring buffer and set - appropriate ASIC register to kick hardware encryption before really - sent out to air. - - Arguments: - pAd Pointer to our adapter - PNDIS_PACKET Pointer to outgoing Ndis frame - NumberOfFrag Number of fragment required - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID RTMPToWirelessSta( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, - IN UINT DataLen, - IN BOOLEAN bClearFrame) -{ - PNDIS_PACKET pPacket; - NDIS_STATUS Status; - - if ((!pEntry) || ((!pEntry->ValidAsCLI) && (!pEntry->ValidAsApCli))) - return; - - do { - // build a NDIS packet - Status = RTMPAllocateNdisPacket(pAd, &pPacket, pHeader802_3, HdrLen, pData, DataLen); - if (Status != NDIS_STATUS_SUCCESS) - break; - - - if (bClearFrame) - RTMP_SET_PACKET_CLEAR_EAP_FRAME(pPacket, 1); - else - RTMP_SET_PACKET_CLEAR_EAP_FRAME(pPacket, 0); - { - RTMP_SET_PACKET_SOURCE(pPacket, PKTSRC_NDIS); - - RTMP_SET_PACKET_NET_DEVICE_MBSSID(pPacket, MAIN_MBSSID); // set a default value - if(pEntry->apidx != 0) - RTMP_SET_PACKET_NET_DEVICE_MBSSID(pPacket, pEntry->apidx); - - RTMP_SET_PACKET_WCID(pPacket, (UCHAR)pEntry->Aid); - RTMP_SET_PACKET_MOREDATA(pPacket, FALSE); - } - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // send out the packet - Status = STASendPacket(pAd, pPacket); - if (Status == NDIS_STATUS_SUCCESS) - { - UCHAR Index; - - // Dequeue one frame from TxSwQueue0..3 queue and process it - // There are three place calling dequeue for TX ring. - // 1. Here, right after queueing the frame. - // 2. At the end of TxRingTxDone service routine. - // 3. Upon NDIS call RTMPSendPackets - if((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS))) - { - for(Index = 0; Index < 5; Index ++) - if(pAd->TxSwQueue[Index].Number > 0) - RTMPDeQueuePacket(pAd, FALSE, Index, MAX_TX_PROCESS); - } - } - } -#endif // CONFIG_STA_SUPPORT // - - } while (FALSE); -} - -/* - ========================================================================== - Description: - This is a function to initilize 4-way handshake - - Return: - - ========================================================================== -*/ -VOID WPAStart4WayHS( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN ULONG TimeInterval) -{ - UCHAR Header802_3[14]; - EAPOL_PACKET EAPOLPKT; - PUINT8 pBssid = NULL; - UCHAR group_cipher = Ndis802_11WEPDisabled; - - DBGPRINT(RT_DEBUG_TRACE, ("===> WPAStart4WayHS\n")); - - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_HALT_IN_PROGRESS)) - { - DBGPRINT(RT_DEBUG_ERROR, ("[ERROR]WPAStart4WayHS : The interface is closed...\n")); - return; - } - - - if (pBssid == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("[ERROR]WPAStart4WayHS : No corresponding Authenticator.\n")); - return; - } - - // Check the status - if ((pEntry->WpaState > AS_PTKSTART) || (pEntry->WpaState < AS_INITPMK)) - { - DBGPRINT(RT_DEBUG_ERROR, ("[ERROR]WPAStart4WayHS : Not expect calling\n")); - return; - } - - - // Increment replay counter by 1 - ADD_ONE_To_64BIT_VAR(pEntry->R_Counter); - - // Randomly generate ANonce - GenRandom(pAd, (UCHAR *)pBssid, pEntry->ANonce); - - // Construct EAPoL message - Pairwise Msg 1 - // EAPOL-Key(0,0,1,0,P,0,0,ANonce,0,DataKD_M1) - NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); - ConstructEapolMsg(pEntry, - group_cipher, - EAPOL_PAIR_MSG_1, - 0, // Default key index - pEntry->ANonce, - NULL, // TxRSC - NULL, // GTK - NULL, // RSNIE - 0, // RSNIE length - &EAPOLPKT); - - - // Make outgoing frame - MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pBssid, EAPOL); - RTMPToWirelessSta(pAd, pEntry, Header802_3, - LENGTH_802_3, (PUCHAR)&EAPOLPKT, - CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, - (pEntry->PortSecured == WPA_802_1X_PORT_SECURED) ? FALSE : TRUE); - - // Trigger Retry Timer - RTMPModTimer(&pEntry->RetryTimer, TimeInterval); - - // Update State - pEntry->WpaState = AS_PTKSTART; - - DBGPRINT(RT_DEBUG_TRACE, ("<=== WPAStart4WayHS: send Msg1 of 4-way \n")); - -} - -/* - ======================================================================== - - Routine Description: - Process Pairwise key Msg-1 of 4-way handshaking and send Msg-2 - - Arguments: - pAd Pointer to our adapter - Elem Message body - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID PeerPairMsg1Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR PTK[80]; - UCHAR Header802_3[14]; - PEAPOL_PACKET pMsg1; - UINT MsgLen; - EAPOL_PACKET EAPOLPKT; - PUINT8 pCurrentAddr = NULL; - PUINT8 pmk_ptr = NULL; - UCHAR group_cipher = Ndis802_11WEPDisabled; - PUINT8 rsnie_ptr = NULL; - UCHAR rsnie_len = 0; - - DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg1Action \n")); - - if ((!pEntry) || ((!pEntry->ValidAsCLI) && (!pEntry->ValidAsApCli))) - return; - - if (Elem->MsgLen < (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) - return; - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - pCurrentAddr = pAd->CurrentAddress; - pmk_ptr = pAd->StaCfg.PMK; - group_cipher = pAd->StaCfg.GroupCipher; - rsnie_ptr = pAd->StaCfg.RSN_IE; - rsnie_len = pAd->StaCfg.RSNIE_Len; - } -#endif // CONFIG_STA_SUPPORT // - - // Store the received frame - pMsg1 = (PEAPOL_PACKET) &Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; - MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; - - // Sanity Check peer Pairwise message 1 - Replay Counter - if (PeerWpaMessageSanity(pAd, pMsg1, MsgLen, EAPOL_PAIR_MSG_1, pEntry) == FALSE) - return; - - // Store Replay counter, it will use to verify message 3 and construct message 2 - NdisMoveMemory(pEntry->R_Counter, pMsg1->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - - // Store ANonce - NdisMoveMemory(pEntry->ANonce, pMsg1->KeyDesc.KeyNonce, LEN_KEY_DESC_NONCE); - - // Generate random SNonce - GenRandom(pAd, (UCHAR *)pCurrentAddr, pEntry->SNonce); - - { - // Calculate PTK(ANonce, SNonce) - WpaDerivePTK(pAd, - pmk_ptr, - pEntry->ANonce, - pEntry->Addr, - pEntry->SNonce, - pCurrentAddr, - PTK, - LEN_PTK); - - // Save key to PTK entry - NdisMoveMemory(pEntry->PTK, PTK, LEN_PTK); - } - - // Update WpaState - pEntry->WpaState = AS_PTKINIT_NEGOTIATING; - - // Construct EAPoL message - Pairwise Msg 2 - // EAPOL-Key(0,1,0,0,P,0,0,SNonce,MIC,DataKD_M2) - NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); - ConstructEapolMsg(pEntry, - group_cipher, - EAPOL_PAIR_MSG_2, - 0, // DefaultKeyIdx - pEntry->SNonce, - NULL, // TxRsc - NULL, // GTK - (UCHAR *)rsnie_ptr, - rsnie_len, - &EAPOLPKT); - - // Make outgoing frame - MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pCurrentAddr, EAPOL); - - RTMPToWirelessSta(pAd, pEntry, - Header802_3, sizeof(Header802_3), (PUCHAR)&EAPOLPKT, - CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, TRUE); - - DBGPRINT(RT_DEBUG_TRACE, ("<=== PeerPairMsg1Action: send Msg2 of 4-way \n")); -} - - -/* - ========================================================================== - Description: - When receiving the second packet of 4-way pairwisekey handshake. - Return: - ========================================================================== -*/ -VOID PeerPairMsg2Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR PTK[80]; - BOOLEAN Cancelled; - PHEADER_802_11 pHeader; - EAPOL_PACKET EAPOLPKT; - PEAPOL_PACKET pMsg2; - UINT MsgLen; - UCHAR Header802_3[LENGTH_802_3]; - UCHAR TxTsc[6]; - PUINT8 pBssid = NULL; - PUINT8 pmk_ptr = NULL; - PUINT8 gtk_ptr = NULL; - UCHAR default_key = 0; - UCHAR group_cipher = Ndis802_11WEPDisabled; - PUINT8 rsnie_ptr = NULL; - UCHAR rsnie_len = 0; - - DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg2Action \n")); - - if ((!pEntry) || (!pEntry->ValidAsCLI)) - return; - - if (Elem->MsgLen < (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) - return; - - // check Entry in valid State - if (pEntry->WpaState < AS_PTKSTART) - return; - - - - // pointer to 802.11 header - pHeader = (PHEADER_802_11)Elem->Msg; - - // skip 802.11_header(24-byte) and LLC_header(8) - pMsg2 = (PEAPOL_PACKET)&Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; - MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; - - // Store SNonce - NdisMoveMemory(pEntry->SNonce, pMsg2->KeyDesc.KeyNonce, LEN_KEY_DESC_NONCE); - - { - // Derive PTK - WpaDerivePTK(pAd, - (UCHAR *)pmk_ptr, - pEntry->ANonce, // ANONCE - (UCHAR *)pBssid, - pEntry->SNonce, // SNONCE - pEntry->Addr, - PTK, - LEN_PTK); - - NdisMoveMemory(pEntry->PTK, PTK, LEN_PTK); - } - - // Sanity Check peer Pairwise message 2 - Replay Counter, MIC, RSNIE - if (PeerWpaMessageSanity(pAd, pMsg2, MsgLen, EAPOL_PAIR_MSG_2, pEntry) == FALSE) - return; - - do - { - // delete retry timer - RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); - - // Change state - pEntry->WpaState = AS_PTKINIT_NEGOTIATING; - - // Increment replay counter by 1 - ADD_ONE_To_64BIT_VAR(pEntry->R_Counter); - - // Construct EAPoL message - Pairwise Msg 3 - NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); - ConstructEapolMsg(pEntry, - group_cipher, - EAPOL_PAIR_MSG_3, - default_key, - pEntry->ANonce, - TxTsc, - (UCHAR *)gtk_ptr, - (UCHAR *)rsnie_ptr, - rsnie_len, - &EAPOLPKT); - - // Make outgoing frame - MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pBssid, EAPOL); - RTMPToWirelessSta(pAd, pEntry, Header802_3, LENGTH_802_3, - (PUCHAR)&EAPOLPKT, - CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, - (pEntry->PortSecured == WPA_802_1X_PORT_SECURED) ? FALSE : TRUE); - - pEntry->ReTryCounter = PEER_MSG3_RETRY_TIMER_CTR; - RTMPSetTimer(&pEntry->RetryTimer, PEER_MSG3_RETRY_EXEC_INTV); - - // Update State - pEntry->WpaState = AS_PTKINIT_NEGOTIATING; - }while(FALSE); - - DBGPRINT(RT_DEBUG_TRACE, ("<=== PeerPairMsg2Action: send Msg3 of 4-way \n")); -} - -/* - ======================================================================== - - Routine Description: - Process Pairwise key Msg 3 of 4-way handshaking and send Msg 4 - - Arguments: - pAd Pointer to our adapter - Elem Message body - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID PeerPairMsg3Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem) -{ - PHEADER_802_11 pHeader; - UCHAR Header802_3[14]; - EAPOL_PACKET EAPOLPKT; - PEAPOL_PACKET pMsg3; - UINT MsgLen; - PUINT8 pCurrentAddr = NULL; - UCHAR group_cipher = Ndis802_11WEPDisabled; - - DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg3Action \n")); - - if ((!pEntry) || ((!pEntry->ValidAsCLI) && (!pEntry->ValidAsApCli))) - return; - - if (Elem->MsgLen < (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) - return; - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - pCurrentAddr = pAd->CurrentAddress; - group_cipher = pAd->StaCfg.GroupCipher; - - } -#endif // CONFIG_STA_SUPPORT // - - // Record 802.11 header & the received EAPOL packet Msg3 - pHeader = (PHEADER_802_11) Elem->Msg; - pMsg3 = (PEAPOL_PACKET) &Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; - MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; - - // Sanity Check peer Pairwise message 3 - Replay Counter, MIC, RSNIE - if (PeerWpaMessageSanity(pAd, pMsg3, MsgLen, EAPOL_PAIR_MSG_3, pEntry) == FALSE) - return; - - // Save Replay counter, it will use construct message 4 - NdisMoveMemory(pEntry->R_Counter, pMsg3->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - - // Double check ANonce - if (!NdisEqualMemory(pEntry->ANonce, pMsg3->KeyDesc.KeyNonce, LEN_KEY_DESC_NONCE)) - { - return; - } - - // Construct EAPoL message - Pairwise Msg 4 - NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); - ConstructEapolMsg(pEntry, - group_cipher, - EAPOL_PAIR_MSG_4, - 0, // group key index not used in message 4 - NULL, // Nonce not used in message 4 - NULL, // TxRSC not used in message 4 - NULL, // GTK not used in message 4 - NULL, // RSN IE not used in message 4 - 0, - &EAPOLPKT); - - // Update WpaState - pEntry->WpaState = AS_PTKINITDONE; - - // Update pairwise key -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - PCIPHER_KEY pSharedKey; - - pSharedKey = &pAd->SharedKey[BSS0][0]; - - NdisMoveMemory(pAd->StaCfg.PTK, pEntry->PTK, LEN_PTK); - - // Prepare pair-wise key information into shared key table - NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); - pSharedKey->KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pSharedKey->Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); - NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_RXMICK); - NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); - - // Decide its ChiperAlg - if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) - pSharedKey->CipherAlg = CIPHER_TKIP; - else if (pAd->StaCfg.PairCipher == Ndis802_11Encryption3Enabled) - pSharedKey->CipherAlg = CIPHER_AES; - else - pSharedKey->CipherAlg = CIPHER_NONE; - - // Update these related information to MAC_TABLE_ENTRY - pEntry = &pAd->MacTab.Content[BSSID_WCID]; - NdisMoveMemory(pEntry->PairwiseKey.Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); - NdisMoveMemory(pEntry->PairwiseKey.RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_RXMICK); - NdisMoveMemory(pEntry->PairwiseKey.TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); - pEntry->PairwiseKey.CipherAlg = pSharedKey->CipherAlg; - - // Update pairwise key information to ASIC Shared Key Table - AsicAddSharedKeyEntry(pAd, - BSS0, - 0, - pSharedKey->CipherAlg, - pSharedKey->Key, - pSharedKey->TxMic, - pSharedKey->RxMic); - - // Update ASIC WCID attribute table and IVEIV table - RTMPAddWcidAttributeEntry(pAd, - BSS0, - 0, - pSharedKey->CipherAlg, - pEntry); - - } -#endif // CONFIG_STA_SUPPORT // - - // open 802.1x port control and privacy filter - if (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK || - pEntry->AuthMode == Ndis802_11AuthModeWPA2) - { - pEntry->PortSecured = WPA_802_1X_PORT_SECURED; - pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; - -#ifdef CONFIG_STA_SUPPORT - STA_PORT_SECURED(pAd); - // Indicate Connected for GUI - pAd->IndicateMediaState = NdisMediaStateConnected; -#endif // CONFIG_STA_SUPPORT // - DBGPRINT(RT_DEBUG_TRACE, ("PeerPairMsg3Action: AuthMode(%s) PairwiseCipher(%s) GroupCipher(%s) \n", - GetAuthMode(pEntry->AuthMode), - GetEncryptType(pEntry->WepStatus), - GetEncryptType(group_cipher))); - } - else - { - } - - // Init 802.3 header and send out - MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pCurrentAddr, EAPOL); - RTMPToWirelessSta(pAd, pEntry, - Header802_3, sizeof(Header802_3), - (PUCHAR)&EAPOLPKT, - CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, TRUE); - - DBGPRINT(RT_DEBUG_TRACE, ("<=== PeerPairMsg3Action: send Msg4 of 4-way \n")); -} - -/* - ========================================================================== - Description: - When receiving the last packet of 4-way pairwisekey handshake. - Initilize 2-way groupkey handshake following. - Return: - ========================================================================== -*/ -VOID PeerPairMsg4Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem) -{ - PEAPOL_PACKET pMsg4; - PHEADER_802_11 pHeader; - UINT MsgLen; - BOOLEAN Cancelled; - UCHAR group_cipher = Ndis802_11WEPDisabled; - - DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg4Action\n")); - - do - { - if ((!pEntry) || (!pEntry->ValidAsCLI)) - break; - - if (Elem->MsgLen < (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2 ) ) - break; - - if (pEntry->WpaState < AS_PTKINIT_NEGOTIATING) - break; - - - // pointer to 802.11 header - pHeader = (PHEADER_802_11)Elem->Msg; - - // skip 802.11_header(24-byte) and LLC_header(8) - pMsg4 = (PEAPOL_PACKET)&Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; - MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; - - // Sanity Check peer Pairwise message 4 - Replay Counter, MIC - if (PeerWpaMessageSanity(pAd, pMsg4, MsgLen, EAPOL_PAIR_MSG_4, pEntry) == FALSE) - break; - - // 3. uses the MLME.SETKEYS.request to configure PTK into MAC - NdisZeroMemory(&pEntry->PairwiseKey, sizeof(CIPHER_KEY)); - - // reset IVEIV in Asic - AsicUpdateWCIDIVEIV(pAd, pEntry->Aid, 1, 0); - - pEntry->PairwiseKey.KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pEntry->PairwiseKey.Key, &pEntry->PTK[32], LEN_TKIP_EK); - NdisMoveMemory(pEntry->PairwiseKey.RxMic, &pEntry->PTK[TKIP_AP_RXMICK_OFFSET], LEN_TKIP_RXMICK); - NdisMoveMemory(pEntry->PairwiseKey.TxMic, &pEntry->PTK[TKIP_AP_TXMICK_OFFSET], LEN_TKIP_TXMICK); - - // Set pairwise key to Asic - { - pEntry->PairwiseKey.CipherAlg = CIPHER_NONE; - if (pEntry->WepStatus == Ndis802_11Encryption2Enabled) - pEntry->PairwiseKey.CipherAlg = CIPHER_TKIP; - else if (pEntry->WepStatus == Ndis802_11Encryption3Enabled) - pEntry->PairwiseKey.CipherAlg = CIPHER_AES; - - // Add Pair-wise key to Asic - AsicAddPairwiseKeyEntry( - pAd, - pEntry->Addr, - (UCHAR)pEntry->Aid, - &pEntry->PairwiseKey); - - // update WCID attribute table and IVEIV table for this entry - RTMPAddWcidAttributeEntry( - pAd, - pEntry->apidx, - 0, - pEntry->PairwiseKey.CipherAlg, - pEntry); - } - - // 4. upgrade state - pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; - pEntry->WpaState = AS_PTKINITDONE; - pEntry->PortSecured = WPA_802_1X_PORT_SECURED; - - - if (pEntry->AuthMode == Ndis802_11AuthModeWPA2 || - pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK) - { - pEntry->GTKState = REKEY_ESTABLISHED; - RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); - - - // send wireless event - for set key done WPA2 - if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_SET_KEY_DONE_WPA2_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); - - DBGPRINT(RT_DEBUG_OFF, ("AP SETKEYS DONE - WPA2, AuthMode(%d)=%s, WepStatus(%d)=%s, GroupWepStatus(%d)=%s\n\n", - pEntry->AuthMode, GetAuthMode(pEntry->AuthMode), - pEntry->WepStatus, GetEncryptType(pEntry->WepStatus), - group_cipher, - GetEncryptType(group_cipher))); - } - else - { - // 5. init Group 2-way handshake if necessary. - WPAStart2WayGroupHS(pAd, pEntry); - - pEntry->ReTryCounter = GROUP_MSG1_RETRY_TIMER_CTR; - RTMPModTimer(&pEntry->RetryTimer, PEER_MSG3_RETRY_EXEC_INTV); - } - }while(FALSE); - -} - -/* - ========================================================================== - Description: - This is a function to send the first packet of 2-way groupkey handshake - Return: - - ========================================================================== -*/ -VOID WPAStart2WayGroupHS( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry) -{ - UCHAR Header802_3[14]; - UCHAR TxTsc[6]; - EAPOL_PACKET EAPOLPKT; - UCHAR group_cipher = Ndis802_11WEPDisabled; - UCHAR default_key = 0; - PUINT8 gnonce_ptr = NULL; - PUINT8 gtk_ptr = NULL; - PUINT8 pBssid = NULL; - - DBGPRINT(RT_DEBUG_TRACE, ("===> WPAStart2WayGroupHS\n")); - - if ((!pEntry) || (!pEntry->ValidAsCLI)) - return; - - - do - { - // Increment replay counter by 1 - ADD_ONE_To_64BIT_VAR(pEntry->R_Counter); - - // Construct EAPoL message - Group Msg 1 - NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); - ConstructEapolMsg(pEntry, - group_cipher, - EAPOL_GROUP_MSG_1, - default_key, - (UCHAR *)gnonce_ptr, - TxTsc, - (UCHAR *)gtk_ptr, - NULL, - 0, - &EAPOLPKT); - - // Make outgoing frame - MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pBssid, EAPOL); - RTMPToWirelessSta(pAd, pEntry, - Header802_3, LENGTH_802_3, - (PUCHAR)&EAPOLPKT, - CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, FALSE); - - - - }while (FALSE); - - DBGPRINT(RT_DEBUG_TRACE, ("<=== WPAStart2WayGroupHS : send out Group Message 1 \n")); - - return; -} - -/* - ======================================================================== - - Routine Description: - Process Group key 2-way handshaking - - Arguments: - pAd Pointer to our adapter - Elem Message body - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID PeerGroupMsg1Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR Header802_3[14]; - EAPOL_PACKET EAPOLPKT; - PEAPOL_PACKET pGroup; - UINT MsgLen; - BOOLEAN Cancelled; - UCHAR default_key = 0; - UCHAR group_cipher = Ndis802_11WEPDisabled; - PUINT8 pCurrentAddr = NULL; - - DBGPRINT(RT_DEBUG_TRACE, ("===> PeerGroupMsg1Action \n")); - - if ((!pEntry) || ((!pEntry->ValidAsCLI) && (!pEntry->ValidAsApCli))) - return; - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - pCurrentAddr = pAd->CurrentAddress; - group_cipher = pAd->StaCfg.GroupCipher; - default_key = pAd->StaCfg.DefaultKeyId; - } -#endif // CONFIG_STA_SUPPORT // - - // Process Group Message 1 frame. skip 802.11 header(24) & LLC_SNAP header(8) - pGroup = (PEAPOL_PACKET) &Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; - MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; - - // Sanity Check peer group message 1 - Replay Counter, MIC, RSNIE - if (PeerWpaMessageSanity(pAd, pGroup, MsgLen, EAPOL_GROUP_MSG_1, pEntry) == FALSE) - return; - - // delete retry timer - RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); - - // Save Replay counter, it will use to construct message 2 - NdisMoveMemory(pEntry->R_Counter, pGroup->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - - // Construct EAPoL message - Group Msg 2 - NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); - ConstructEapolMsg(pEntry, - group_cipher, - EAPOL_GROUP_MSG_2, - default_key, - NULL, // Nonce not used - NULL, // TxRSC not used - NULL, // GTK not used - NULL, // RSN IE not used - 0, - &EAPOLPKT); - - // open 802.1x port control and privacy filter - pEntry->PortSecured = WPA_802_1X_PORT_SECURED; - pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; - -#ifdef CONFIG_STA_SUPPORT - STA_PORT_SECURED(pAd); - // Indicate Connected for GUI - pAd->IndicateMediaState = NdisMediaStateConnected; -#endif // CONFIG_STA_SUPPORT // - - DBGPRINT(RT_DEBUG_TRACE, ("PeerGroupMsg1Action: AuthMode(%s) PairwiseCipher(%s) GroupCipher(%s) \n", - GetAuthMode(pEntry->AuthMode), - GetEncryptType(pEntry->WepStatus), - GetEncryptType(group_cipher))); - - // init header and Fill Packet and send Msg 2 to authenticator - MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pCurrentAddr, EAPOL); - RTMPToWirelessSta(pAd, pEntry, - Header802_3, sizeof(Header802_3), - (PUCHAR)&EAPOLPKT, - CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, FALSE); - - DBGPRINT(RT_DEBUG_TRACE, ("<=== PeerGroupMsg1Action: sned group message 2\n")); -} - -/* - ========================================================================== - Description: - When receiving the last packet of 2-way groupkey handshake. - Return: - ========================================================================== -*/ -VOID PeerGroupMsg2Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN VOID *Msg, - IN UINT MsgLen) -{ - UINT Len; - PUCHAR pData; - BOOLEAN Cancelled; - PEAPOL_PACKET pMsg2; - UCHAR group_cipher = Ndis802_11WEPDisabled; - - DBGPRINT(RT_DEBUG_TRACE, ("===> PeerGroupMsg2Action \n")); - - do - { - if ((!pEntry) || (!pEntry->ValidAsCLI)) - break; - - if (MsgLen < (LENGTH_802_1_H + LENGTH_EAPOL_H + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) - break; - - if (pEntry->WpaState != AS_PTKINITDONE) - break; - - - pData = (PUCHAR)Msg; - pMsg2 = (PEAPOL_PACKET) (pData + LENGTH_802_1_H); - Len = MsgLen - LENGTH_802_1_H; - - // Sanity Check peer group message 2 - Replay Counter, MIC - if (PeerWpaMessageSanity(pAd, pMsg2, Len, EAPOL_GROUP_MSG_2, pEntry) == FALSE) - break; - - // 3. upgrade state - - RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); - pEntry->GTKState = REKEY_ESTABLISHED; - - if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) || (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - // send wireless event - for set key done WPA2 - if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_SET_KEY_DONE_WPA2_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); - - DBGPRINT(RT_DEBUG_OFF, ("AP SETKEYS DONE - WPA2, AuthMode(%d)=%s, WepStatus(%d)=%s, GroupWepStatus(%d)=%s\n\n", - pEntry->AuthMode, GetAuthMode(pEntry->AuthMode), - pEntry->WepStatus, GetEncryptType(pEntry->WepStatus), - group_cipher, GetEncryptType(group_cipher))); - } - else - { - // send wireless event - for set key done WPA - if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_SET_KEY_DONE_WPA1_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); - - DBGPRINT(RT_DEBUG_OFF, ("AP SETKEYS DONE - WPA1, AuthMode(%d)=%s, WepStatus(%d)=%s, GroupWepStatus(%d)=%s\n\n", - pEntry->AuthMode, GetAuthMode(pEntry->AuthMode), - pEntry->WepStatus, GetEncryptType(pEntry->WepStatus), - group_cipher, GetEncryptType(group_cipher))); - } - }while(FALSE); -} - -/* - ======================================================================== - - Routine Description: - Classify WPA EAP message type - - Arguments: - EAPType Value of EAP message type - MsgType Internal Message definition for MLME state machine - - Return Value: - TRUE Found appropriate message type - FALSE No appropriate message type - - IRQL = DISPATCH_LEVEL - - Note: - All these constants are defined in wpa.h - For supplicant, there is only EAPOL Key message avaliable - - ======================================================================== -*/ -BOOLEAN WpaMsgTypeSubst( - IN UCHAR EAPType, - OUT INT *MsgType) -{ - switch (EAPType) - { - case EAPPacket: - *MsgType = MT2_EAPPacket; - break; - case EAPOLStart: - *MsgType = MT2_EAPOLStart; - break; - case EAPOLLogoff: - *MsgType = MT2_EAPOLLogoff; - break; - case EAPOLKey: - *MsgType = MT2_EAPOLKey; - break; - case EAPOLASFAlert: - *MsgType = MT2_EAPOLASFAlert; - break; - default: - return FALSE; - } - return TRUE; -} - -/* - ======================================================================== - - Routine Description: - The pseudo-random function(PRF) that hashes various inputs to - derive a pseudo-random value. To add liveness to the pseudo-random - value, a nonce should be one of the inputs. - - It is used to generate PTK, GTK or some specific random value. - - Arguments: - UCHAR *key, - the key material for HMAC_SHA1 use - INT key_len - the length of key - UCHAR *prefix - a prefix label - INT prefix_len - the length of the label - UCHAR *data - a specific data with variable length - INT data_len - the length of a specific data - INT len - the output lenght - - Return Value: - UCHAR *output - the calculated result - - Note: - 802.11i-2004 Annex H.3 - - ======================================================================== -*/ -VOID PRF( - IN UCHAR *key, - IN INT key_len, - IN UCHAR *prefix, - IN INT prefix_len, - IN UCHAR *data, - IN INT data_len, - OUT UCHAR *output, - IN INT len) -{ - INT i; - UCHAR *input; - INT currentindex = 0; - INT total_len; - - // Allocate memory for input - os_alloc_mem(NULL, (PUCHAR *)&input, 1024); - - if (input == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("!!!PRF: no memory!!!\n")); - return; - } - - // Generate concatenation input - NdisMoveMemory(input, prefix, prefix_len); - - // Concatenate a single octet containing 0 - input[prefix_len] = 0; - - // Concatenate specific data - NdisMoveMemory(&input[prefix_len + 1], data, data_len); - total_len = prefix_len + 1 + data_len; - - // Concatenate a single octet containing 0 - // This octet shall be update later - input[total_len] = 0; - total_len++; - - // Iterate to calculate the result by hmac-sha-1 - // Then concatenate to last result - for (i = 0; i < (len + 19) / 20; i++) - { - HMAC_SHA1(key, key_len, input, total_len, &output[currentindex], SHA1_DIGEST_SIZE); - currentindex += 20; - - // update the last octet - input[total_len - 1]++; - } - os_free_mem(NULL, input); -} - -/* -* F(P, S, c, i) = U1 xor U2 xor ... Uc -* U1 = PRF(P, S || Int(i)) -* U2 = PRF(P, U1) -* Uc = PRF(P, Uc-1) -*/ - -static void F(char *password, unsigned char *ssid, int ssidlength, int iterations, int count, unsigned char *output) -{ - unsigned char digest[36], digest1[SHA1_DIGEST_SIZE]; - int i, j; - - /* U1 = PRF(P, S || int(i)) */ - memcpy(digest, ssid, ssidlength); - digest[ssidlength] = (unsigned char)((count>>24) & 0xff); - digest[ssidlength+1] = (unsigned char)((count>>16) & 0xff); - digest[ssidlength+2] = (unsigned char)((count>>8) & 0xff); - digest[ssidlength+3] = (unsigned char)(count & 0xff); - HMAC_SHA1((unsigned char*) password, (int) strlen(password), digest, ssidlength+4, digest1, SHA1_DIGEST_SIZE); // for WPA update - - /* output = U1 */ - memcpy(output, digest1, SHA1_DIGEST_SIZE); - - for (i = 1; i < iterations; i++) - { - /* Un = PRF(P, Un-1) */ - HMAC_SHA1((unsigned char*) password, (int) strlen(password), digest1, SHA1_DIGEST_SIZE, digest, SHA1_DIGEST_SIZE); // for WPA update - memcpy(digest1, digest, SHA1_DIGEST_SIZE); - - /* output = output xor Un */ - for (j = 0; j < SHA1_DIGEST_SIZE; j++) - { - output[j] ^= digest[j]; - } - } -} - -/* -* password - ascii string up to 63 characters in length -* ssid - octet string up to 32 octets -* ssidlength - length of ssid in octets -* output must be 40 octets in length and outputs 256 bits of key -*/ -int PasswordHash(PSTRING password, PUCHAR ssid, INT ssidlength, PUCHAR output) -{ - if ((strlen(password) > 63) || (ssidlength > 32)) - return 0; - - F(password, ssid, ssidlength, 4096, 1, output); - F(password, ssid, ssidlength, 4096, 2, &output[SHA1_DIGEST_SIZE]); - return 1; -} - - - -/* - ======================================================================== - - Routine Description: - It utilizes PRF-384 or PRF-512 to derive session-specific keys from a PMK. - It shall be called by 4-way handshake processing. - - Arguments: - pAd - pointer to our pAdapter context - PMK - pointer to PMK - ANonce - pointer to ANonce - AA - pointer to Authenticator Address - SNonce - pointer to SNonce - SA - pointer to Supplicant Address - len - indicate the length of PTK (octet) - - Return Value: - Output pointer to the PTK - - Note: - Refer to IEEE 802.11i-2004 8.5.1.2 - - ======================================================================== -*/ -VOID WpaDerivePTK( - IN PRTMP_ADAPTER pAd, - IN UCHAR *PMK, - IN UCHAR *ANonce, - IN UCHAR *AA, - IN UCHAR *SNonce, - IN UCHAR *SA, - OUT UCHAR *output, - IN UINT len) -{ - UCHAR concatenation[76]; - UINT CurrPos = 0; - UCHAR temp[32]; - UCHAR Prefix[] = {'P', 'a', 'i', 'r', 'w', 'i', 's', 'e', ' ', 'k', 'e', 'y', ' ', - 'e', 'x', 'p', 'a', 'n', 's', 'i', 'o', 'n'}; - - // initiate the concatenation input - NdisZeroMemory(temp, sizeof(temp)); - NdisZeroMemory(concatenation, 76); - - // Get smaller address - if (RTMPCompareMemory(SA, AA, 6) == 1) - NdisMoveMemory(concatenation, AA, 6); - else - NdisMoveMemory(concatenation, SA, 6); - CurrPos += 6; - - // Get larger address - if (RTMPCompareMemory(SA, AA, 6) == 1) - NdisMoveMemory(&concatenation[CurrPos], SA, 6); - else - NdisMoveMemory(&concatenation[CurrPos], AA, 6); - - // store the larger mac address for backward compatible of - // ralink proprietary STA-key issue - NdisMoveMemory(temp, &concatenation[CurrPos], MAC_ADDR_LEN); - CurrPos += 6; - - // Get smaller Nonce - if (RTMPCompareMemory(ANonce, SNonce, 32) == 0) - NdisMoveMemory(&concatenation[CurrPos], temp, 32); // patch for ralink proprietary STA-key issue - else if (RTMPCompareMemory(ANonce, SNonce, 32) == 1) - NdisMoveMemory(&concatenation[CurrPos], SNonce, 32); - else - NdisMoveMemory(&concatenation[CurrPos], ANonce, 32); - CurrPos += 32; - - // Get larger Nonce - if (RTMPCompareMemory(ANonce, SNonce, 32) == 0) - NdisMoveMemory(&concatenation[CurrPos], temp, 32); // patch for ralink proprietary STA-key issue - else if (RTMPCompareMemory(ANonce, SNonce, 32) == 1) - NdisMoveMemory(&concatenation[CurrPos], ANonce, 32); - else - NdisMoveMemory(&concatenation[CurrPos], SNonce, 32); - CurrPos += 32; - - hex_dump("concatenation=", concatenation, 76); - - // Use PRF to generate PTK - PRF(PMK, LEN_MASTER_KEY, Prefix, 22, concatenation, 76, output, len); - -} - -/* - ======================================================================== - - Routine Description: - Generate random number by software. - - Arguments: - pAd - pointer to our pAdapter context - macAddr - pointer to local MAC address - - Return Value: - - Note: - 802.1ii-2004 Annex H.5 - - ======================================================================== -*/ -VOID GenRandom( - IN PRTMP_ADAPTER pAd, - IN UCHAR *macAddr, - OUT UCHAR *random) -{ - INT i, curr; - UCHAR local[80], KeyCounter[32]; - UCHAR result[80]; - ULONG CurrentTime; - UCHAR prefix[] = {'I', 'n', 'i', 't', ' ', 'C', 'o', 'u', 'n', 't', 'e', 'r'}; - - // Zero the related information - NdisZeroMemory(result, 80); - NdisZeroMemory(local, 80); - NdisZeroMemory(KeyCounter, 32); - - for (i = 0; i < 32; i++) - { - // copy the local MAC address - COPY_MAC_ADDR(local, macAddr); - curr = MAC_ADDR_LEN; - - // concatenate the current time - NdisGetSystemUpTime(&CurrentTime); - NdisMoveMemory(&local[curr], &CurrentTime, sizeof(CurrentTime)); - curr += sizeof(CurrentTime); - - // concatenate the last result - NdisMoveMemory(&local[curr], result, 32); - curr += 32; - - // concatenate a variable - NdisMoveMemory(&local[curr], &i, 2); - curr += 2; - - // calculate the result - PRF(KeyCounter, 32, prefix,12, local, curr, result, 32); - } - - NdisMoveMemory(random, result, 32); -} - -/* - ======================================================================== - - Routine Description: - Build cipher suite in RSN-IE. - It only shall be called by RTMPMakeRSNIE. - - Arguments: - pAd - pointer to our pAdapter context - ElementID - indicate the WPA1 or WPA2 - WepStatus - indicate the encryption type - bMixCipher - a boolean to indicate the pairwise cipher and group - cipher are the same or not - - Return Value: - - Note: - - ======================================================================== -*/ -static VOID RTMPMakeRsnIeCipher( - IN PRTMP_ADAPTER pAd, - IN UCHAR ElementID, - IN UINT WepStatus, - IN BOOLEAN bMixCipher, - IN UCHAR FlexibleCipher, - OUT PUCHAR pRsnIe, - OUT UCHAR *rsn_len) -{ - UCHAR PairwiseCnt; - - *rsn_len = 0; - - // decide WPA2 or WPA1 - if (ElementID == Wpa2Ie) - { - RSNIE2 *pRsnie_cipher = (RSNIE2*)pRsnIe; - - // Assign the verson as 1 - pRsnie_cipher->version = 1; - - switch (WepStatus) - { - // TKIP mode - case Ndis802_11Encryption2Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_TKIP, 4); - pRsnie_cipher->ucount = 1; - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_TKIP, 4); - *rsn_len = sizeof(RSNIE2); - break; - - // AES mode - case Ndis802_11Encryption3Enabled: - if (bMixCipher) - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_TKIP, 4); - else - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_CCMP, 4); - pRsnie_cipher->ucount = 1; - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_CCMP, 4); - *rsn_len = sizeof(RSNIE2); - break; - - // TKIP-AES mix mode - case Ndis802_11Encryption4Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_TKIP, 4); - - PairwiseCnt = 1; - // Insert WPA2 TKIP as the first pairwise cipher - if (MIX_CIPHER_WPA2_TKIP_ON(FlexibleCipher)) - { - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_TKIP, 4); - // Insert WPA2 AES as the secondary pairwise cipher - if (MIX_CIPHER_WPA2_AES_ON(FlexibleCipher)) - { - NdisMoveMemory(pRsnie_cipher->ucast[0].oui + 4, OUI_WPA2_CCMP, 4); - PairwiseCnt = 2; - } - } - else - { - // Insert WPA2 AES as the first pairwise cipher - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_CCMP, 4); - } - - pRsnie_cipher->ucount = PairwiseCnt; - *rsn_len = sizeof(RSNIE2) + (4 * (PairwiseCnt - 1)); - break; - } - -#ifdef CONFIG_STA_SUPPORT - if ((pAd->OpMode == OPMODE_STA) && - (pAd->StaCfg.GroupCipher != Ndis802_11Encryption2Enabled) && - (pAd->StaCfg.GroupCipher != Ndis802_11Encryption3Enabled)) - { - UINT GroupCipher = pAd->StaCfg.GroupCipher; - switch(GroupCipher) - { - case Ndis802_11GroupWEP40Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_WEP40, 4); - break; - case Ndis802_11GroupWEP104Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_WEP104, 4); - break; - } - } -#endif // CONFIG_STA_SUPPORT // - - // swap for big-endian platform - pRsnie_cipher->version = cpu2le16(pRsnie_cipher->version); - pRsnie_cipher->ucount = cpu2le16(pRsnie_cipher->ucount); - } - else - { - RSNIE *pRsnie_cipher = (RSNIE*)pRsnIe; - - // Assign OUI and version - NdisMoveMemory(pRsnie_cipher->oui, OUI_WPA_VERSION, 4); - pRsnie_cipher->version = 1; - - switch (WepStatus) - { - // TKIP mode - case Ndis802_11Encryption2Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_TKIP, 4); - pRsnie_cipher->ucount = 1; - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_TKIP, 4); - *rsn_len = sizeof(RSNIE); - break; - - // AES mode - case Ndis802_11Encryption3Enabled: - if (bMixCipher) - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_TKIP, 4); - else - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_CCMP, 4); - pRsnie_cipher->ucount = 1; - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_CCMP, 4); - *rsn_len = sizeof(RSNIE); - break; - - // TKIP-AES mix mode - case Ndis802_11Encryption4Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_TKIP, 4); - - PairwiseCnt = 1; - // Insert WPA TKIP as the first pairwise cipher - if (MIX_CIPHER_WPA_TKIP_ON(FlexibleCipher)) - { - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_TKIP, 4); - // Insert WPA AES as the secondary pairwise cipher - if (MIX_CIPHER_WPA_AES_ON(FlexibleCipher)) - { - NdisMoveMemory(pRsnie_cipher->ucast[0].oui + 4, OUI_WPA_CCMP, 4); - PairwiseCnt = 2; - } - } - else - { - // Insert WPA AES as the first pairwise cipher - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_CCMP, 4); - } - - pRsnie_cipher->ucount = PairwiseCnt; - *rsn_len = sizeof(RSNIE) + (4 * (PairwiseCnt - 1)); - break; - } - -#ifdef CONFIG_STA_SUPPORT - if ((pAd->OpMode == OPMODE_STA) && - (pAd->StaCfg.GroupCipher != Ndis802_11Encryption2Enabled) && - (pAd->StaCfg.GroupCipher != Ndis802_11Encryption3Enabled)) - { - UINT GroupCipher = pAd->StaCfg.GroupCipher; - switch(GroupCipher) - { - case Ndis802_11GroupWEP40Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_WEP40, 4); - break; - case Ndis802_11GroupWEP104Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_WEP104, 4); - break; - } - } -#endif // CONFIG_STA_SUPPORT // - - // swap for big-endian platform - pRsnie_cipher->version = cpu2le16(pRsnie_cipher->version); - pRsnie_cipher->ucount = cpu2le16(pRsnie_cipher->ucount); - } -} - -/* - ======================================================================== - - Routine Description: - Build AKM suite in RSN-IE. - It only shall be called by RTMPMakeRSNIE. - - Arguments: - pAd - pointer to our pAdapter context - ElementID - indicate the WPA1 or WPA2 - AuthMode - indicate the authentication mode - apidx - indicate the interface index - - Return Value: - - Note: - - ======================================================================== -*/ -static VOID RTMPMakeRsnIeAKM( - IN PRTMP_ADAPTER pAd, - IN UCHAR ElementID, - IN UINT AuthMode, - IN UCHAR apidx, - OUT PUCHAR pRsnIe, - OUT UCHAR *rsn_len) -{ - RSNIE_AUTH *pRsnie_auth; - UCHAR AkmCnt = 1; // default as 1 - - pRsnie_auth = (RSNIE_AUTH*)(pRsnIe + (*rsn_len)); - - // decide WPA2 or WPA1 - if (ElementID == Wpa2Ie) - { - - switch (AuthMode) - { - case Ndis802_11AuthModeWPA2: - case Ndis802_11AuthModeWPA1WPA2: - NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA2_8021X_AKM, 4); - break; - - case Ndis802_11AuthModeWPA2PSK: - case Ndis802_11AuthModeWPA1PSKWPA2PSK: - NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA2_PSK_AKM, 4); - break; - default: - AkmCnt = 0; - break; - - } - } - else - { - switch (AuthMode) - { - case Ndis802_11AuthModeWPA: - case Ndis802_11AuthModeWPA1WPA2: - NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA_8021X_AKM, 4); - break; - - case Ndis802_11AuthModeWPAPSK: - case Ndis802_11AuthModeWPA1PSKWPA2PSK: - NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA_PSK_AKM, 4); - break; - - case Ndis802_11AuthModeWPANone: - NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA_NONE_AKM, 4); - break; - default: - AkmCnt = 0; - break; - } - } - - pRsnie_auth->acount = AkmCnt; - pRsnie_auth->acount = cpu2le16(pRsnie_auth->acount); - - // update current RSNIE length - (*rsn_len) += (sizeof(RSNIE_AUTH) + (4 * (AkmCnt - 1))); - -} - -/* - ======================================================================== - - Routine Description: - Build capability in RSN-IE. - It only shall be called by RTMPMakeRSNIE. - - Arguments: - pAd - pointer to our pAdapter context - ElementID - indicate the WPA1 or WPA2 - apidx - indicate the interface index - - Return Value: - - Note: - - ======================================================================== -*/ -static VOID RTMPMakeRsnIeCap( - IN PRTMP_ADAPTER pAd, - IN UCHAR ElementID, - IN UCHAR apidx, - OUT PUCHAR pRsnIe, - OUT UCHAR *rsn_len) -{ - RSN_CAPABILITIES *pRSN_Cap; - - // it could be ignored in WPA1 mode - if (ElementID == WpaIe) - return; - - pRSN_Cap = (RSN_CAPABILITIES*)(pRsnIe + (*rsn_len)); - - - pRSN_Cap->word = cpu2le16(pRSN_Cap->word); - - (*rsn_len) += sizeof(RSN_CAPABILITIES); // update current RSNIE length - -} - - -/* - ======================================================================== - - Routine Description: - Build RSN IE context. It is not included element-ID and length. - - Arguments: - pAd - pointer to our pAdapter context - AuthMode - indicate the authentication mode - WepStatus - indicate the encryption type - apidx - indicate the interface index - - Return Value: - - Note: - - ======================================================================== -*/ -VOID RTMPMakeRSNIE( - IN PRTMP_ADAPTER pAd, - IN UINT AuthMode, - IN UINT WepStatus, - IN UCHAR apidx) -{ - PUCHAR pRsnIe = NULL; // primary RSNIE - UCHAR *rsnielen_cur_p = 0; // the length of the primary RSNIE - UCHAR *rsnielen_ex_cur_p = 0; // the length of the secondary RSNIE - UCHAR PrimaryRsnie; - BOOLEAN bMixCipher = FALSE; // indicate the pairwise and group cipher are different - UCHAR p_offset; - WPA_MIX_PAIR_CIPHER FlexibleCipher = WPA_TKIPAES_WPA2_TKIPAES; // it provide the more flexible cipher combination in WPA-WPA2 and TKIPAES mode - - rsnielen_cur_p = NULL; - rsnielen_ex_cur_p = NULL; - - { -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { -#ifdef WPA_SUPPLICANT_SUPPORT - if (pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) - { - if (AuthMode < Ndis802_11AuthModeWPA) - return; - } - else -#endif // WPA_SUPPLICANT_SUPPORT // - { - // Support WPAPSK or WPA2PSK in STA-Infra mode - // Support WPANone in STA-Adhoc mode - if ((AuthMode != Ndis802_11AuthModeWPAPSK) && - (AuthMode != Ndis802_11AuthModeWPA2PSK) && - (AuthMode != Ndis802_11AuthModeWPANone) - ) - return; - } - - DBGPRINT(RT_DEBUG_TRACE,("==> RTMPMakeRSNIE(STA)\n")); - - // Zero RSNIE context - pAd->StaCfg.RSNIE_Len = 0; - NdisZeroMemory(pAd->StaCfg.RSN_IE, MAX_LEN_OF_RSNIE); - - // Pointer to RSNIE - rsnielen_cur_p = &pAd->StaCfg.RSNIE_Len; - pRsnIe = pAd->StaCfg.RSN_IE; - - bMixCipher = pAd->StaCfg.bMixCipher; - } -#endif // CONFIG_STA_SUPPORT // - } - - // indicate primary RSNIE as WPA or WPA2 - if ((AuthMode == Ndis802_11AuthModeWPA) || - (AuthMode == Ndis802_11AuthModeWPAPSK) || - (AuthMode == Ndis802_11AuthModeWPANone) || - (AuthMode == Ndis802_11AuthModeWPA1WPA2) || - (AuthMode == Ndis802_11AuthModeWPA1PSKWPA2PSK)) - PrimaryRsnie = WpaIe; - else - PrimaryRsnie = Wpa2Ie; - - { - // Build the primary RSNIE - // 1. insert cipher suite - RTMPMakeRsnIeCipher(pAd, PrimaryRsnie, WepStatus, bMixCipher, FlexibleCipher, pRsnIe, &p_offset); - - // 2. insert AKM - RTMPMakeRsnIeAKM(pAd, PrimaryRsnie, AuthMode, apidx, pRsnIe, &p_offset); - - // 3. insert capability - RTMPMakeRsnIeCap(pAd, PrimaryRsnie, apidx, pRsnIe, &p_offset); - } - - // 4. update the RSNIE length - *rsnielen_cur_p = p_offset; - - hex_dump("The primary RSNIE", pRsnIe, (*rsnielen_cur_p)); - - -} - -/* - ========================================================================== - Description: - Check whether the received frame is EAP frame. - - Arguments: - pAd - pointer to our pAdapter context - pEntry - pointer to active entry - pData - the received frame - DataByteCount - the received frame's length - FromWhichBSSID - indicate the interface index - - Return: - TRUE - This frame is EAP frame - FALSE - otherwise - ========================================================================== -*/ -BOOLEAN RTMPCheckWPAframe( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR pData, - IN ULONG DataByteCount, - IN UCHAR FromWhichBSSID) -{ - ULONG Body_len; - BOOLEAN Cancelled; - - - if(DataByteCount < (LENGTH_802_1_H + LENGTH_EAPOL_H)) - return FALSE; - - - // Skip LLC header - if (NdisEqualMemory(SNAP_802_1H, pData, 6) || - // Cisco 1200 AP may send packet with SNAP_BRIDGE_TUNNEL - NdisEqualMemory(SNAP_BRIDGE_TUNNEL, pData, 6)) - { - pData += 6; - } - // Skip 2-bytes EAPoL type - if (NdisEqualMemory(EAPOL, pData, 2)) -// if (*(UINT16 *)EAPOL == *(UINT16 *)pData) - { - pData += 2; - } - else - return FALSE; - - switch (*(pData+1)) - { - case EAPPacket: - Body_len = (*(pData+2)<<8) | (*(pData+3)); - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAP-Packet frame, TYPE = 0, Length = %ld\n", Body_len)); - break; - case EAPOLStart: - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOL-Start frame, TYPE = 1 \n")); - if (pEntry->EnqueueEapolStartTimerRunning != EAPOL_START_DISABLE) - { - DBGPRINT(RT_DEBUG_TRACE, ("Cancel the EnqueueEapolStartTimerRunning \n")); - RTMPCancelTimer(&pEntry->EnqueueStartForPSKTimer, &Cancelled); - pEntry->EnqueueEapolStartTimerRunning = EAPOL_START_DISABLE; - } - break; - case EAPOLLogoff: - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOLLogoff frame, TYPE = 2 \n")); - break; - case EAPOLKey: - Body_len = (*(pData+2)<<8) | (*(pData+3)); - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOL-Key frame, TYPE = 3, Length = %ld\n", Body_len)); - break; - case EAPOLASFAlert: - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOLASFAlert frame, TYPE = 4 \n")); - break; - default: - return FALSE; - - } - return TRUE; -} - -/* - ========================================================================== - Description: - Report the EAP message type - - Arguments: - msg - EAPOL_PAIR_MSG_1 - EAPOL_PAIR_MSG_2 - EAPOL_PAIR_MSG_3 - EAPOL_PAIR_MSG_4 - EAPOL_GROUP_MSG_1 - EAPOL_GROUP_MSG_2 - - Return: - message type string - - ========================================================================== -*/ -PSTRING GetEapolMsgType(CHAR msg) -{ - if(msg == EAPOL_PAIR_MSG_1) - return "Pairwise Message 1"; - else if(msg == EAPOL_PAIR_MSG_2) - return "Pairwise Message 2"; - else if(msg == EAPOL_PAIR_MSG_3) - return "Pairwise Message 3"; - else if(msg == EAPOL_PAIR_MSG_4) - return "Pairwise Message 4"; - else if(msg == EAPOL_GROUP_MSG_1) - return "Group Message 1"; - else if(msg == EAPOL_GROUP_MSG_2) - return "Group Message 2"; - else - return "Invalid Message"; -} - - -/* - ======================================================================== - - Routine Description: - Check Sanity RSN IE of EAPoL message - - Arguments: - - Return Value: - - - ======================================================================== -*/ -BOOLEAN RTMPCheckRSNIE( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN UCHAR DataLen, - IN MAC_TABLE_ENTRY *pEntry, - OUT UCHAR *Offset) -{ - PUCHAR pVIE; - UCHAR len; - PEID_STRUCT pEid; - BOOLEAN result = FALSE; - - pVIE = pData; - len = DataLen; - *Offset = 0; - - while (len > sizeof(RSNIE2)) - { - pEid = (PEID_STRUCT) pVIE; - // WPA RSN IE - if ((pEid->Eid == IE_WPA) && (NdisEqualMemory(pEid->Octet, WPA_OUI, 4))) - { - if ((pEntry->AuthMode == Ndis802_11AuthModeWPA || pEntry->AuthMode == Ndis802_11AuthModeWPAPSK) && - (NdisEqualMemory(pVIE, pEntry->RSN_IE, pEntry->RSNIE_Len)) && - (pEntry->RSNIE_Len == (pEid->Len + 2))) - { - result = TRUE; - } - - *Offset += (pEid->Len + 2); - } - // WPA2 RSN IE - else if ((pEid->Eid == IE_RSN) && (NdisEqualMemory(pEid->Octet + 2, RSN_OUI, 3))) - { - if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2 || pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK) && - (pEid->Eid == pEntry->RSN_IE[0]) && - ((pEid->Len + 2) >= pEntry->RSNIE_Len) && - (NdisEqualMemory(pEid->Octet, &pEntry->RSN_IE[2], pEntry->RSNIE_Len - 2))) - { - - result = TRUE; - } - - *Offset += (pEid->Len + 2); - } - else - { - break; - } - - pVIE += (pEid->Len + 2); - len -= (pEid->Len + 2); - } - - - return result; - -} - - -/* - ======================================================================== - - Routine Description: - Parse KEYDATA field. KEYDATA[] May contain 2 RSN IE and optionally GTK. - GTK is encaptulated in KDE format at p.83 802.11i D10 - - Arguments: - - Return Value: - - Note: - 802.11i D10 - - ======================================================================== -*/ -BOOLEAN RTMPParseEapolKeyData( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKeyData, - IN UCHAR KeyDataLen, - IN UCHAR GroupKeyIndex, - IN UCHAR MsgType, - IN BOOLEAN bWPA2, - IN MAC_TABLE_ENTRY *pEntry) -{ - PKDE_ENCAP pKDE = NULL; - PUCHAR pMyKeyData = pKeyData; - UCHAR KeyDataLength = KeyDataLen; - UCHAR GTKLEN = 0; - UCHAR DefaultIdx = 0; - UCHAR skip_offset; - - // Verify The RSN IE contained in pairewise_msg_2 && pairewise_msg_3 and skip it - if (MsgType == EAPOL_PAIR_MSG_2 || MsgType == EAPOL_PAIR_MSG_3) - { - // Check RSN IE whether it is WPA2/WPA2PSK - if (!RTMPCheckRSNIE(pAd, pKeyData, KeyDataLen, pEntry, &skip_offset)) - { - // send wireless event - for RSN IE different - if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_RSNIE_DIFF_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); - - DBGPRINT(RT_DEBUG_ERROR, ("RSN_IE Different in msg %d of 4-way handshake!\n", MsgType)); - hex_dump("Receive RSN_IE ", pKeyData, KeyDataLen); - hex_dump("Desired RSN_IE ", pEntry->RSN_IE, pEntry->RSNIE_Len); - - return FALSE; - } - else - { - if (bWPA2 && MsgType == EAPOL_PAIR_MSG_3) - { - WpaShowAllsuite(pMyKeyData, skip_offset); - - // skip RSN IE - pMyKeyData += skip_offset; - KeyDataLength -= skip_offset; - DBGPRINT(RT_DEBUG_TRACE, ("RTMPParseEapolKeyData ==> WPA2/WPA2PSK RSN IE matched in Msg 3, Length(%d) \n", skip_offset)); - } - else - return TRUE; - } - } - - DBGPRINT(RT_DEBUG_TRACE,("RTMPParseEapolKeyData ==> KeyDataLength %d without RSN_IE \n", KeyDataLength)); - //hex_dump("remain data", pMyKeyData, KeyDataLength); - - - // Parse EKD format in pairwise_msg_3_WPA2 && group_msg_1_WPA2 - if (bWPA2 && (MsgType == EAPOL_PAIR_MSG_3 || MsgType == EAPOL_GROUP_MSG_1)) - { - if (KeyDataLength >= 8) // KDE format exclude GTK length - { - pKDE = (PKDE_ENCAP) pMyKeyData; - - - DefaultIdx = pKDE->GTKEncap.Kid; - - // Sanity check - KED length - if (KeyDataLength < (pKDE->Len + 2)) - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR: The len from KDE is too short \n")); - return FALSE; - } - - // Get GTK length - refer to IEEE 802.11i-2004 p.82 - GTKLEN = pKDE->Len -6; - if (GTKLEN < LEN_AES_KEY) - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR: GTK Key length is too short (%d) \n", GTKLEN)); - return FALSE; - } - - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR: KDE format length is too short \n")); - return FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("GTK in KDE format ,DefaultKeyID=%d, KeyLen=%d \n", DefaultIdx, GTKLEN)); - // skip it - pMyKeyData += 8; - KeyDataLength -= 8; - - } - else if (!bWPA2 && MsgType == EAPOL_GROUP_MSG_1) - { - DefaultIdx = GroupKeyIndex; - DBGPRINT(RT_DEBUG_TRACE, ("GTK DefaultKeyID=%d \n", DefaultIdx)); - } - - // Sanity check - shared key index must be 1 ~ 3 - if (DefaultIdx < 1 || DefaultIdx > 3) - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR: GTK Key index(%d) is invalid in %s %s \n", DefaultIdx, ((bWPA2) ? "WPA2" : "WPA"), GetEapolMsgType(MsgType))); - return FALSE; - } - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - PCIPHER_KEY pSharedKey; - - // set key material, TxMic and RxMic - NdisMoveMemory(pAd->StaCfg.GTK, pMyKeyData, 32); - pAd->StaCfg.DefaultKeyId = DefaultIdx; - - pSharedKey = &pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId]; - - // Prepare pair-wise key information into shared key table - NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); - pSharedKey->KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pSharedKey->Key, pAd->StaCfg.GTK, LEN_TKIP_EK); - NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.GTK[16], LEN_TKIP_RXMICK); - NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.GTK[24], LEN_TKIP_TXMICK); - - // Update Shared Key CipherAlg - pSharedKey->CipherAlg = CIPHER_NONE; - if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption2Enabled) - pSharedKey->CipherAlg = CIPHER_TKIP; - else if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption3Enabled) - pSharedKey->CipherAlg = CIPHER_AES; - else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP40Enabled) - pSharedKey->CipherAlg = CIPHER_WEP64; - else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP104Enabled) - pSharedKey->CipherAlg = CIPHER_WEP128; - - - // Update group key information to ASIC Shared Key Table - AsicAddSharedKeyEntry(pAd, - BSS0, - pAd->StaCfg.DefaultKeyId, - pSharedKey->CipherAlg, - pSharedKey->Key, - pSharedKey->TxMic, - pSharedKey->RxMic); - - // Update ASIC WCID attribute table and IVEIV table - RTMPAddWcidAttributeEntry(pAd, - BSS0, - pAd->StaCfg.DefaultKeyId, - pSharedKey->CipherAlg, - NULL); - } -#endif // CONFIG_STA_SUPPORT // - - return TRUE; - -} - - -/* - ======================================================================== - - Routine Description: - Construct EAPoL message for WPA handshaking - Its format is below, - - +--------------------+ - | Protocol Version | 1 octet - +--------------------+ - | Protocol Type | 1 octet - +--------------------+ - | Body Length | 2 octets - +--------------------+ - | Descriptor Type | 1 octet - +--------------------+ - | Key Information | 2 octets - +--------------------+ - | Key Length | 1 octet - +--------------------+ - | Key Repaly Counter | 8 octets - +--------------------+ - | Key Nonce | 32 octets - +--------------------+ - | Key IV | 16 octets - +--------------------+ - | Key RSC | 8 octets - +--------------------+ - | Key ID or Reserved | 8 octets - +--------------------+ - | Key MIC | 16 octets - +--------------------+ - | Key Data Length | 2 octets - +--------------------+ - | Key Data | n octets - +--------------------+ - - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID ConstructEapolMsg( - IN PMAC_TABLE_ENTRY pEntry, - IN UCHAR GroupKeyWepStatus, - IN UCHAR MsgType, - IN UCHAR DefaultKeyIdx, - IN UCHAR *KeyNonce, - IN UCHAR *TxRSC, - IN UCHAR *GTK, - IN UCHAR *RSNIE, - IN UCHAR RSNIE_Len, - OUT PEAPOL_PACKET pMsg) -{ - BOOLEAN bWPA2 = FALSE; - UCHAR KeyDescVer; - - // Choose WPA2 or not - if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) || - (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) - bWPA2 = TRUE; - - // Init Packet and Fill header - pMsg->ProVer = EAPOL_VER; - pMsg->ProType = EAPOLKey; - - // Default 95 bytes, the EAPoL-Key descriptor exclude Key-data field - SET_UINT16_TO_ARRARY(pMsg->Body_Len, LEN_EAPOL_KEY_MSG); - - // Fill in EAPoL descriptor - if (bWPA2) - pMsg->KeyDesc.Type = WPA2_KEY_DESC; - else - pMsg->KeyDesc.Type = WPA1_KEY_DESC; - - // Key Descriptor Version (bits 0-2) specifies the key descriptor version type - { - // Fill in Key information, refer to IEEE Std 802.11i-2004 page 78 - // When either the pairwise or the group cipher is AES, the DESC_TYPE_AES(2) shall be used. - KeyDescVer = (((pEntry->WepStatus == Ndis802_11Encryption3Enabled) || - (GroupKeyWepStatus == Ndis802_11Encryption3Enabled)) ? (DESC_TYPE_AES) : (DESC_TYPE_TKIP)); - } - - pMsg->KeyDesc.KeyInfo.KeyDescVer = KeyDescVer; - - // Specify Key Type as Group(0) or Pairwise(1) - if (MsgType >= EAPOL_GROUP_MSG_1) - pMsg->KeyDesc.KeyInfo.KeyType = GROUPKEY; - else - pMsg->KeyDesc.KeyInfo.KeyType = PAIRWISEKEY; - - // Specify Key Index, only group_msg1_WPA1 - if (!bWPA2 && (MsgType >= EAPOL_GROUP_MSG_1)) - pMsg->KeyDesc.KeyInfo.KeyIndex = DefaultKeyIdx; - - if (MsgType == EAPOL_PAIR_MSG_3) - pMsg->KeyDesc.KeyInfo.Install = 1; - - if ((MsgType == EAPOL_PAIR_MSG_1) || (MsgType == EAPOL_PAIR_MSG_3) || (MsgType == EAPOL_GROUP_MSG_1)) - pMsg->KeyDesc.KeyInfo.KeyAck = 1; - - if (MsgType != EAPOL_PAIR_MSG_1) - pMsg->KeyDesc.KeyInfo.KeyMic = 1; - - if ((bWPA2 && (MsgType >= EAPOL_PAIR_MSG_3)) || - (!bWPA2 && (MsgType >= EAPOL_GROUP_MSG_1))) - { - pMsg->KeyDesc.KeyInfo.Secure = 1; - } - - if (bWPA2 && ((MsgType == EAPOL_PAIR_MSG_3) || - (MsgType == EAPOL_GROUP_MSG_1))) - { - pMsg->KeyDesc.KeyInfo.EKD_DL = 1; - } - - // key Information element has done. - *(USHORT *)(&pMsg->KeyDesc.KeyInfo) = cpu2le16(*(USHORT *)(&pMsg->KeyDesc.KeyInfo)); - - // Fill in Key Length - { - if (MsgType >= EAPOL_GROUP_MSG_1) - { - // the length of group key cipher - pMsg->KeyDesc.KeyLength[1] = ((GroupKeyWepStatus == Ndis802_11Encryption2Enabled) ? TKIP_GTK_LENGTH : LEN_AES_KEY); - } - else - { - // the length of pairwise key cipher - pMsg->KeyDesc.KeyLength[1] = ((pEntry->WepStatus == Ndis802_11Encryption2Enabled) ? LEN_TKIP_KEY : LEN_AES_KEY); - } - } - - // Fill in replay counter - NdisMoveMemory(pMsg->KeyDesc.ReplayCounter, pEntry->R_Counter, LEN_KEY_DESC_REPLAY); - - // Fill Key Nonce field - // ANonce : pairwise_msg1 & pairwise_msg3 - // SNonce : pairwise_msg2 - // GNonce : group_msg1_wpa1 - if ((MsgType <= EAPOL_PAIR_MSG_3) || ((!bWPA2 && (MsgType == EAPOL_GROUP_MSG_1)))) - NdisMoveMemory(pMsg->KeyDesc.KeyNonce, KeyNonce, LEN_KEY_DESC_NONCE); - - // Fill key IV - WPA2 as 0, WPA1 as random - if (!bWPA2 && (MsgType == EAPOL_GROUP_MSG_1)) - { - // Suggest IV be random number plus some number, - NdisMoveMemory(pMsg->KeyDesc.KeyIv, &KeyNonce[16], LEN_KEY_DESC_IV); - pMsg->KeyDesc.KeyIv[15] += 2; - } - - // Fill Key RSC field - // It contains the RSC for the GTK being installed. - if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2) || (MsgType == EAPOL_GROUP_MSG_1)) - { - NdisMoveMemory(pMsg->KeyDesc.KeyRsc, TxRSC, 6); - } - - // Clear Key MIC field for MIC calculation later - NdisZeroMemory(pMsg->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); - - ConstructEapolKeyData(pEntry, - GroupKeyWepStatus, - KeyDescVer, - MsgType, - DefaultKeyIdx, - GTK, - RSNIE, - RSNIE_Len, - pMsg); - - // Calculate MIC and fill in KeyMic Field except Pairwise Msg 1. - if (MsgType != EAPOL_PAIR_MSG_1) - { - CalculateMIC(KeyDescVer, pEntry->PTK, pMsg); - } - - DBGPRINT(RT_DEBUG_TRACE, ("===> ConstructEapolMsg for %s %s\n", ((bWPA2) ? "WPA2" : "WPA"), GetEapolMsgType(MsgType))); - DBGPRINT(RT_DEBUG_TRACE, (" Body length = %d \n", CONV_ARRARY_TO_UINT16(pMsg->Body_Len))); - DBGPRINT(RT_DEBUG_TRACE, (" Key length = %d \n", CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyLength))); - - -} - -/* - ======================================================================== - - Routine Description: - Construct the Key Data field of EAPoL message - - Arguments: - pAd Pointer to our adapter - Elem Message body - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID ConstructEapolKeyData( - IN PMAC_TABLE_ENTRY pEntry, - IN UCHAR GroupKeyWepStatus, - IN UCHAR keyDescVer, - IN UCHAR MsgType, - IN UCHAR DefaultKeyIdx, - IN UCHAR *GTK, - IN UCHAR *RSNIE, - IN UCHAR RSNIE_LEN, - OUT PEAPOL_PACKET pMsg) -{ - UCHAR *mpool, *Key_Data, *Rc4GTK; - UCHAR ekey[(LEN_KEY_DESC_IV+LEN_EAP_EK)]; - ULONG data_offset; - BOOLEAN bWPA2Capable = FALSE; - PRTMP_ADAPTER pAd = pEntry->pAd; - BOOLEAN GTK_Included = FALSE; - - // Choose WPA2 or not - if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) || - (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) - bWPA2Capable = TRUE; - - if (MsgType == EAPOL_PAIR_MSG_1 || - MsgType == EAPOL_PAIR_MSG_4 || - MsgType == EAPOL_GROUP_MSG_2) - return; - - // allocate memory pool - os_alloc_mem(NULL, (PUCHAR *)&mpool, 1500); - - if (mpool == NULL) - return; - - /* Rc4GTK Len = 512 */ - Rc4GTK = (UCHAR *) ROUND_UP(mpool, 4); - /* Key_Data Len = 512 */ - Key_Data = (UCHAR *) ROUND_UP(Rc4GTK + 512, 4); - - NdisZeroMemory(Key_Data, 512); - SET_UINT16_TO_ARRARY(pMsg->KeyDesc.KeyDataLen, 0); - data_offset = 0; - - // Encapsulate RSNIE in pairwise_msg2 & pairwise_msg3 - if (RSNIE_LEN && ((MsgType == EAPOL_PAIR_MSG_2) || (MsgType == EAPOL_PAIR_MSG_3))) - { - PUINT8 pmkid_ptr = NULL; - UINT8 pmkid_len = 0; - - - RTMPInsertRSNIE(&Key_Data[data_offset], - (PULONG)&data_offset, - RSNIE, - RSNIE_LEN, - pmkid_ptr, - pmkid_len); - } - - - // Encapsulate KDE format in pairwise_msg3_WPA2 & group_msg1_WPA2 - if (bWPA2Capable && ((MsgType == EAPOL_PAIR_MSG_3) || (MsgType == EAPOL_GROUP_MSG_1))) - { - // Key Data Encapsulation (KDE) format - 802.11i-2004 Figure-43w and Table-20h - Key_Data[data_offset + 0] = 0xDD; - - if (GroupKeyWepStatus == Ndis802_11Encryption3Enabled) - { - Key_Data[data_offset + 1] = 0x16;// 4+2+16(OUI+DataType+DataField) - } - else - { - Key_Data[data_offset + 1] = 0x26;// 4+2+32(OUI+DataType+DataField) - } - - Key_Data[data_offset + 2] = 0x00; - Key_Data[data_offset + 3] = 0x0F; - Key_Data[data_offset + 4] = 0xAC; - Key_Data[data_offset + 5] = 0x01; - - // GTK KDE format - 802.11i-2004 Figure-43x - Key_Data[data_offset + 6] = (DefaultKeyIdx & 0x03); - Key_Data[data_offset + 7] = 0x00; // Reserved Byte - - data_offset += 8; - } - - - // Encapsulate GTK - // Only for pairwise_msg3_WPA2 and group_msg1 - if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2Capable) || (MsgType == EAPOL_GROUP_MSG_1)) - { - // Fill in GTK - if (GroupKeyWepStatus == Ndis802_11Encryption3Enabled) - { - NdisMoveMemory(&Key_Data[data_offset], GTK, LEN_AES_KEY); - data_offset += LEN_AES_KEY; - } - else - { - NdisMoveMemory(&Key_Data[data_offset], GTK, TKIP_GTK_LENGTH); - data_offset += TKIP_GTK_LENGTH; - } - - GTK_Included = TRUE; - } - - - // This whole key-data field shall be encrypted if a GTK is included. - // Encrypt the data material in key data field with KEK - if (GTK_Included) - { - //hex_dump("GTK_Included", Key_Data, data_offset); - - if ( - (keyDescVer == DESC_TYPE_AES)) - { - UCHAR remainder = 0; - UCHAR pad_len = 0; - - // Key Descriptor Version 2 or 3: AES key wrap, defined in IETF RFC 3394, - // shall be used to encrypt the Key Data field using the KEK field from - // the derived PTK. - - // If the Key Data field uses the NIST AES key wrap, then the Key Data field - // shall be padded before encrypting if the key data length is less than 16 - // octets or if it is not a multiple of 8. The padding consists of appending - // a single octet 0xdd followed by zero or more 0x00 octets. - if ((remainder = data_offset & 0x07) != 0) - { - INT i; - - pad_len = (8 - remainder); - Key_Data[data_offset] = 0xDD; - for (i = 1; i < pad_len; i++) - Key_Data[data_offset + i] = 0; - - data_offset += pad_len; - } - - AES_GTK_KEY_WRAP(&pEntry->PTK[16], Key_Data, data_offset, Rc4GTK); - // AES wrap function will grow 8 bytes in length - data_offset += 8; - } - else - { - /* Key Descriptor Version 1: ARC4 is used to encrypt the Key Data field - using the KEK field from the derived PTK. */ - - // PREPARE Encrypted "Key DATA" field. (Encrypt GTK with RC4, usinf PTK[16]->[31] as Key, IV-field as IV) - // put TxTsc in Key RSC field - pAd->PrivateInfo.FCSCRC32 = PPPINITFCS32; //Init crc32. - - // ekey is the contanetion of IV-field, and PTK[16]->PTK[31] - NdisMoveMemory(ekey, pMsg->KeyDesc.KeyIv, LEN_KEY_DESC_IV); - NdisMoveMemory(&ekey[LEN_KEY_DESC_IV], &pEntry->PTK[16], LEN_EAP_EK); - ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, ekey, sizeof(ekey)); //INIT SBOX, KEYLEN+3(IV) - pAd->PrivateInfo.FCSCRC32 = RTMP_CALC_FCS32(pAd->PrivateInfo.FCSCRC32, Key_Data, data_offset); - WPAARCFOUR_ENCRYPT(&pAd->PrivateInfo.WEPCONTEXT, Rc4GTK, Key_Data, data_offset); - } - - NdisMoveMemory(pMsg->KeyDesc.KeyData, Rc4GTK, data_offset); - } - else - { - NdisMoveMemory(pMsg->KeyDesc.KeyData, Key_Data, data_offset); - } - - // Update key data length field and total body length - SET_UINT16_TO_ARRARY(pMsg->KeyDesc.KeyDataLen, data_offset); - INC_UINT16_TO_ARRARY(pMsg->Body_Len, data_offset); - - os_free_mem(NULL, mpool); - -} - -/* - ======================================================================== - - Routine Description: - Calcaulate MIC. It is used during 4-ways handsharking. - - Arguments: - pAd - pointer to our pAdapter context - PeerWepStatus - indicate the encryption type - - Return Value: - - Note: - - ======================================================================== -*/ -static VOID CalculateMIC( - IN UCHAR KeyDescVer, - IN UCHAR *PTK, - OUT PEAPOL_PACKET pMsg) -{ - UCHAR *OutBuffer; - ULONG FrameLen = 0; - UCHAR mic[LEN_KEY_DESC_MIC]; - UCHAR digest[80]; - - // allocate memory for MIC calculation - os_alloc_mem(NULL, (PUCHAR *)&OutBuffer, 512); - - if (OutBuffer == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("!!!CalculateMIC: no memory!!!\n")); - return; - } - - // make a frame for calculating MIC. - MakeOutgoingFrame(OutBuffer, &FrameLen, - CONV_ARRARY_TO_UINT16(pMsg->Body_Len) + 4, pMsg, - END_OF_ARGS); - - NdisZeroMemory(mic, sizeof(mic)); - - // Calculate MIC - if (KeyDescVer == DESC_TYPE_AES) - { - HMAC_SHA1(PTK, LEN_EAP_MICK, OutBuffer, FrameLen, digest, SHA1_DIGEST_SIZE); - NdisMoveMemory(mic, digest, LEN_KEY_DESC_MIC); - } - else - { - HMAC_MD5(PTK, LEN_EAP_MICK, OutBuffer, FrameLen, mic, MD5_DIGEST_SIZE); - } - - // store the calculated MIC - NdisMoveMemory(pMsg->KeyDesc.KeyMic, mic, LEN_KEY_DESC_MIC); - - os_free_mem(NULL, OutBuffer); -} - -/* - ======================================================================== - - Routine Description: - Some received frames can't decrypt by Asic, so decrypt them by software. - - Arguments: - pAd - pointer to our pAdapter context - PeerWepStatus - indicate the encryption type - - Return Value: - NDIS_STATUS_SUCCESS - decryption successful - NDIS_STATUS_FAILURE - decryption failure - - ======================================================================== -*/ -NDIS_STATUS RTMPSoftDecryptBroadCastData( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN NDIS_802_11_ENCRYPTION_STATUS GroupCipher, - IN PCIPHER_KEY pShard_key) -{ - PRXWI_STRUC pRxWI = pRxBlk->pRxWI; - - - - // handle WEP decryption - if (GroupCipher == Ndis802_11Encryption1Enabled) - { - if (RTMPSoftDecryptWEP(pAd, pRxBlk->pData, pRxWI->MPDUtotalByteCount, pShard_key)) - { - - //Minus IV[4] & ICV[4] - pRxWI->MPDUtotalByteCount -= 8; - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR : Software decrypt WEP data fails.\n")); - // give up this frame - return NDIS_STATUS_FAILURE; - } - } - // handle TKIP decryption - else if (GroupCipher == Ndis802_11Encryption2Enabled) - { - if (RTMPSoftDecryptTKIP(pAd, pRxBlk->pData, pRxWI->MPDUtotalByteCount, 0, pShard_key)) - { - - //Minus 8 bytes MIC, 8 bytes IV/EIV, 4 bytes ICV - pRxWI->MPDUtotalByteCount -= 20; - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR : RTMPSoftDecryptTKIP Failed\n")); - // give up this frame - return NDIS_STATUS_FAILURE; - } - } - // handle AES decryption - else if (GroupCipher == Ndis802_11Encryption3Enabled) - { - if (RTMPSoftDecryptAES(pAd, pRxBlk->pData, pRxWI->MPDUtotalByteCount , pShard_key)) - { - - //8 bytes MIC, 8 bytes IV/EIV (CCMP Header) - pRxWI->MPDUtotalByteCount -= 16; - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR : RTMPSoftDecryptAES Failed\n")); - // give up this frame - return NDIS_STATUS_FAILURE; - } - } - else - { - // give up this frame - return NDIS_STATUS_FAILURE; - } - - return NDIS_STATUS_SUCCESS; - -} - - -PUINT8 GetSuiteFromRSNIE( - IN PUINT8 rsnie, - IN UINT rsnie_len, - IN UINT8 type, - OUT UINT8 *count) -{ - PEID_STRUCT pEid; - INT len; - PUINT8 pBuf; - INT offset = 0; - PRSNIE_AUTH pAkm; - UINT16 acount; - BOOLEAN isWPA2 = FALSE; - - pEid = (PEID_STRUCT)rsnie; - len = rsnie_len - 2; // exclude IE and length - pBuf = (PUINT8)&pEid->Octet[0]; - - - - // set default value - *count = 0; - - // Check length - if ((len <= 0) || (pEid->Len != len)) - { - DBGPRINT_ERR(("%s : The length is invalid\n", __FUNCTION__)); - return NULL; - } - - // Check WPA or WPA2 - if (pEid->Eid == IE_WPA) - { - PRSNIE pRsnie = (PRSNIE)pBuf; - UINT16 ucount; - - if (len < sizeof(RSNIE)) - { - DBGPRINT_ERR(("%s : The length is too short for WPA\n", __FUNCTION__)); - return NULL; - } - - // Get the count of pairwise cipher - ucount = cpu2le16(pRsnie->ucount); - if (ucount > 2) - { - DBGPRINT_ERR(("%s : The count(%d) of pairwise cipher is invlaid\n", - __FUNCTION__, ucount)); - return NULL; - } - - // Get the group cipher - if (type == GROUP_SUITE) - { - *count = 1; - return pRsnie->mcast; - } - // Get the pairwise cipher suite - else if (type == PAIRWISE_SUITE) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s : The count of pairwise cipher is %d\n", - __FUNCTION__, ucount)); - *count = ucount; - return pRsnie->ucast[0].oui; - } - - offset = sizeof(RSNIE) + (4 * (ucount - 1)); - - } - else if (pEid->Eid == IE_RSN) - { - PRSNIE2 pRsnie = (PRSNIE2)pBuf; - UINT16 ucount; - - isWPA2 = TRUE; - - if (len < sizeof(RSNIE2)) - { - DBGPRINT_ERR(("%s : The length is too short for WPA2\n", __FUNCTION__)); - return NULL; - } - - // Get the count of pairwise cipher - ucount = cpu2le16(pRsnie->ucount); - if (ucount > 2) - { - DBGPRINT_ERR(("%s : The count(%d) of pairwise cipher is invlaid\n", - __FUNCTION__, ucount)); - return NULL; - } - - // Get the group cipher - if (type == GROUP_SUITE) - { - *count = 1; - return pRsnie->mcast; - } - // Get the pairwise cipher suite - else if (type == PAIRWISE_SUITE) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s : The count of pairwise cipher is %d\n", - __FUNCTION__, ucount)); - *count = ucount; - return pRsnie->ucast[0].oui; - } - - offset = sizeof(RSNIE2) + (4 * (ucount - 1)); - - } - else - { - DBGPRINT_ERR(("%s : Unknown IE (%d)\n", __FUNCTION__, pEid->Eid)); - return NULL; - } - - // skip group cipher and pairwise cipher suite - pBuf += offset; - len -= offset; - - if (len < sizeof(RSNIE_AUTH)) - { - DBGPRINT_ERR(("%s : The length of RSNIE is too short\n", __FUNCTION__)); - return NULL; - } - - // pointer to AKM count - pAkm = (PRSNIE_AUTH)pBuf; - - // Get the count of pairwise cipher - acount = cpu2le16(pAkm->acount); - if (acount > 2) - { - DBGPRINT_ERR(("%s : The count(%d) of AKM is invlaid\n", - __FUNCTION__, acount)); - return NULL; - } - - // Get the AKM suite - if (type == AKM_SUITE) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s : The count of AKM is %d\n", - __FUNCTION__, acount)); - *count = acount; - return pAkm->auth[0].oui; - } - offset = sizeof(RSNIE_AUTH) + (4 * (acount - 1)); - - pBuf += offset; - len -= offset; - - // The remaining length must larger than (RSN-Capability(2) + PMKID-Count(2) + PMKID(16~)) - if (len >= (sizeof(RSN_CAPABILITIES) + 2 + LEN_PMKID)) - { - // Skip RSN capability and PMKID-Count - pBuf += (sizeof(RSN_CAPABILITIES) + 2); - len -= (sizeof(RSN_CAPABILITIES) + 2); - - // Get PMKID - if (type == PMKID_LIST) - { - *count = 1; - return pBuf; - } - } - else - { - DBGPRINT_ERR(("%s : it can't get any more information beyond AKM \n", __FUNCTION__)); - return NULL; - } - - *count = 0; - //DBGPRINT_ERR(("%s : The type(%d) doesn't support \n", __FUNCTION__, type)); - return NULL; - -} - -VOID WpaShowAllsuite( - IN PUINT8 rsnie, - IN UINT rsnie_len) -{ - PUINT8 pSuite = NULL; - UINT8 count; - - hex_dump("RSNIE", rsnie, rsnie_len); - - // group cipher - if ((pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, GROUP_SUITE, &count)) != NULL) - { - hex_dump("group cipher", pSuite, 4*count); - } - - // pairwise cipher - if ((pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, PAIRWISE_SUITE, &count)) != NULL) - { - hex_dump("pairwise cipher", pSuite, 4*count); - } - - // AKM - if ((pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, AKM_SUITE, &count)) != NULL) - { - hex_dump("AKM suite", pSuite, 4*count); - } - - // PMKID - if ((pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, PMKID_LIST, &count)) != NULL) - { - hex_dump("PMKID", pSuite, LEN_PMKID); - } - -} - -VOID RTMPInsertRSNIE( - IN PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN PUINT8 rsnie_ptr, - IN UINT8 rsnie_len, - IN PUINT8 pmkid_ptr, - IN UINT8 pmkid_len) -{ - PUCHAR pTmpBuf; - ULONG TempLen = 0; - UINT8 extra_len = 0; - UINT16 pmk_count = 0; - UCHAR ie_num; - UINT8 total_len = 0; - UCHAR WPA2_OUI[3]={0x00,0x0F,0xAC}; - - pTmpBuf = pFrameBuf; - - /* PMKID-List Must larger than 0 and the multiple of 16. */ - if (pmkid_len > 0 && ((pmkid_len & 0x0f) == 0)) - { - extra_len = sizeof(UINT16) + pmkid_len; - - pmk_count = (pmkid_len >> 4); - pmk_count = cpu2le16(pmk_count); - } - else - { - DBGPRINT(RT_DEBUG_WARN, ("%s : The length is PMKID-List is invalid (%d), so don't insert it.\n", - __FUNCTION__, pmkid_len)); - } - - if (rsnie_len != 0) - { - ie_num = IE_WPA; - total_len = rsnie_len; - - if (NdisEqualMemory(rsnie_ptr + 2, WPA2_OUI, sizeof(WPA2_OUI))) - { - ie_num = IE_RSN; - total_len += extra_len; - } - - /* construct RSNIE body */ - MakeOutgoingFrame(pTmpBuf, &TempLen, - 1, &ie_num, - 1, &total_len, - rsnie_len, rsnie_ptr, - END_OF_ARGS); - - pTmpBuf += TempLen; - *pFrameLen = *pFrameLen + TempLen; - - if (ie_num == IE_RSN) - { - /* Insert PMKID-List field */ - if (extra_len > 0) - { - MakeOutgoingFrame(pTmpBuf, &TempLen, - 2, &pmk_count, - pmkid_len, pmkid_ptr, - END_OF_ARGS); - - pTmpBuf += TempLen; - *pFrameLen = *pFrameLen + TempLen; - } - } - } - - return; -} diff --git a/drivers/staging/rt3090/common/crypt_aes.c b/drivers/staging/rt3090/common/crypt_aes.c deleted file mode 100644 index f400f1eab516..000000000000 --- a/drivers/staging/rt3090/common/crypt_aes.c +++ /dev/null @@ -1,1007 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - crypt_aes.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Eddy 2009/01/19 Create AES-128, AES-192, AES-256, AES-CBC -*/ - -#include "crypt_aes.h" - -/* The value given by [x^(i-1),{00},{00},{00}], with x^(i-1) being powers of x in the field GF(2^8). */ -static const UINT32 aes_rcon[] = { - 0x00000000, 0x01000000, 0x02000000, 0x04000000, - 0x08000000, 0x10000000, 0x20000000, 0x40000000, - 0x80000000, 0x1B000000, 0x36000000}; - -static const UINT8 aes_sbox_enc[] = { - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7 ,0xab, 0x76, /* 0 */ - 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4 ,0x72, 0xc0, /* 1 */ - 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8 ,0x31, 0x15, /* 2 */ - 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27 ,0xb2, 0x75, /* 3 */ - 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3 ,0x2f, 0x84, /* 4 */ - 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c ,0x58, 0xcf, /* 5 */ - 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c ,0x9f, 0xa8, /* 6 */ - 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff ,0xf3, 0xd2, /* 7 */ - 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d ,0x19, 0x73, /* 8 */ - 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e ,0x0b, 0xdb, /* 9 */ - 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95 ,0xe4, 0x79, /* a */ - 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a ,0xae, 0x08, /* b */ - 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd ,0x8b, 0x8a, /* c */ - 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1 ,0x1d, 0x9e, /* d */ - 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55 ,0x28, 0xdf, /* e */ - 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54 ,0xbb, 0x16, /* f */ -}; - -static const UINT8 aes_sbox_dec[] = { - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, /* 0 */ - 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, /* 1 */ - 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, /* 2 */ - 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, /* 3 */ - 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, /* 4 */ - 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, /* 5 */ - 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, /* 6 */ - 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, /* 7 */ - 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, /* 8 */ - 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, /* 9 */ - 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, /* a */ - 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, /* b */ - 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, /* c */ - 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, /* d */ - 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, /* e */ - 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d, /* f */ -}; - -/* ArrayIndex*{02} */ -static const UINT8 aes_mul_2[] = { - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - 0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, /* 0 */ - 0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e, /* 1 */ - 0x40, 0x42, 0x44, 0x46, 0x48, 0x4a, 0x4c, 0x4e, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e, /* 2 */ - 0x60, 0x62, 0x64, 0x66, 0x68, 0x6a, 0x6c, 0x6e, 0x70, 0x72, 0x74, 0x76, 0x78, 0x7a, 0x7c, 0x7e, /* 3 */ - 0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9c, 0x9e, /* 4 */ - 0xa0, 0xa2, 0xa4, 0xa6, 0xa8, 0xaa, 0xac, 0xae, 0xb0, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe, /* 5 */ - 0xc0, 0xc2, 0xc4, 0xc6, 0xc8, 0xca, 0xcc, 0xce, 0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde, /* 6 */ - 0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee, 0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0xfe, /* 7 */ - 0x1b, 0x19, 0x1f, 0x1d, 0x13, 0x11, 0x17, 0x15, 0x0b, 0x09, 0x0f, 0x0d, 0x03, 0x01, 0x07, 0x05, /* 8 */ - 0x3b, 0x39, 0x3f, 0x3d, 0x33, 0x31, 0x37, 0x35, 0x2b, 0x29, 0x2f, 0x2d, 0x23, 0x21, 0x27, 0x25, /* 9 */ - 0x5b, 0x59, 0x5f, 0x5d, 0x53, 0x51, 0x57, 0x55, 0x4b, 0x49, 0x4f, 0x4d, 0x43, 0x41, 0x47, 0x45, /* a */ - 0x7b, 0x79, 0x7f, 0x7d, 0x73, 0x71, 0x77, 0x75, 0x6b, 0x69, 0x6f, 0x6d, 0x63, 0x61, 0x67, 0x65, /* b */ - 0x9b, 0x99, 0x9f, 0x9d, 0x93, 0x91, 0x97, 0x95, 0x8b, 0x89, 0x8f, 0x8d, 0x83, 0x81, 0x87, 0x85, /* c */ - 0xbb, 0xb9, 0xbf, 0xbd, 0xb3, 0xb1, 0xb7, 0xb5, 0xab, 0xa9, 0xaf, 0xad, 0xa3, 0xa1, 0xa7, 0xa5, /* d */ - 0xdb, 0xd9, 0xdf, 0xdd, 0xd3, 0xd1, 0xd7, 0xd5, 0xcb, 0xc9, 0xcf, 0xcd, 0xc3, 0xc1, 0xc7, 0xc5, /* e */ - 0xfb, 0xf9, 0xff, 0xfd, 0xf3, 0xf1, 0xf7, 0xf5, 0xeb, 0xe9, 0xef, 0xed, 0xe3, 0xe1, 0xe7, 0xe5, /* f */ -}; - -/* ArrayIndex*{03} */ -static const UINT8 aes_mul_3[] = { - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - 0x00, 0x03, 0x06, 0x05, 0x0c, 0x0f, 0x0a, 0x09, 0x18, 0x1b, 0x1e, 0x1d, 0x14, 0x17, 0x12, 0x11, /* 0 */ - 0x30, 0x33, 0x36, 0x35, 0x3c, 0x3f, 0x3a, 0x39, 0x28, 0x2b, 0x2e, 0x2d, 0x24, 0x27, 0x22, 0x21, /* 1 */ - 0x60, 0x63, 0x66, 0x65, 0x6c, 0x6f, 0x6a, 0x69, 0x78, 0x7b, 0x7e, 0x7d, 0x74, 0x77, 0x72, 0x71, /* 2 */ - 0x50, 0x53, 0x56, 0x55, 0x5c, 0x5f, 0x5a, 0x59, 0x48, 0x4b, 0x4e, 0x4d, 0x44, 0x47, 0x42, 0x41, /* 3 */ - 0xc0, 0xc3, 0xc6, 0xc5, 0xcc, 0xcf, 0xca, 0xc9, 0xd8, 0xdb, 0xde, 0xdd, 0xd4, 0xd7, 0xd2, 0xd1, /* 4 */ - 0xf0, 0xf3, 0xf6, 0xf5, 0xfc, 0xff, 0xfa, 0xf9, 0xe8, 0xeb, 0xee, 0xed, 0xe4, 0xe7, 0xe2, 0xe1, /* 5 */ - 0xa0, 0xa3, 0xa6, 0xa5, 0xac, 0xaf, 0xaa, 0xa9, 0xb8, 0xbb, 0xbe, 0xbd, 0xb4, 0xb7, 0xb2, 0xb1, /* 6 */ - 0x90, 0x93, 0x96, 0x95, 0x9c, 0x9f, 0x9a, 0x99, 0x88, 0x8b, 0x8e, 0x8d, 0x84, 0x87, 0x82, 0x81, /* 7 */ - 0x9b, 0x98, 0x9d, 0x9e, 0x97, 0x94, 0x91, 0x92, 0x83, 0x80, 0x85, 0x86, 0x8f, 0x8c, 0x89, 0x8a, /* 8 */ - 0xab, 0xa8, 0xad, 0xae, 0xa7, 0xa4, 0xa1, 0xa2, 0xb3, 0xb0, 0xb5, 0xb6, 0xbf, 0xbc, 0xb9, 0xba, /* 9 */ - 0xfb, 0xf8, 0xfd, 0xfe, 0xf7, 0xf4, 0xf1, 0xf2, 0xe3, 0xe0, 0xe5, 0xe6, 0xef, 0xec, 0xe9, 0xea, /* a */ - 0xcb, 0xc8, 0xcd, 0xce, 0xc7, 0xc4, 0xc1, 0xc2, 0xd3, 0xd0, 0xd5, 0xd6, 0xdf, 0xdc, 0xd9, 0xda, /* b */ - 0x5b, 0x58, 0x5d, 0x5e, 0x57, 0x54, 0x51, 0x52, 0x43, 0x40, 0x45, 0x46, 0x4f, 0x4c, 0x49, 0x4a, /* c */ - 0x6b, 0x68, 0x6d, 0x6e, 0x67, 0x64, 0x61, 0x62, 0x73, 0x70, 0x75, 0x76, 0x7f, 0x7c, 0x79, 0x7a, /* d */ - 0x3b, 0x38, 0x3d, 0x3e, 0x37, 0x34, 0x31, 0x32, 0x23, 0x20, 0x25, 0x26, 0x2f, 0x2c, 0x29, 0x2a, /* e */ - 0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1f, 0x1c, 0x19, 0x1a, /* f */ -}; - -/* ArrayIndex*{09} */ -static const UINT8 aes_mul_9[] = { - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - 0x00, 0x09, 0x12, 0x1b, 0x24, 0x2d, 0x36, 0x3f, 0x48, 0x41, 0x5a, 0x53, 0x6c, 0x65, 0x7e, 0x77, /* 0 */ - 0x90, 0x99, 0x82, 0x8b, 0xb4, 0xbd, 0xa6, 0xaf, 0xd8, 0xd1, 0xca, 0xc3, 0xfc, 0xf5, 0xee, 0xe7, /* 1 */ - 0x3b, 0x32, 0x29, 0x20, 0x1f, 0x16, 0x0d, 0x04, 0x73, 0x7a, 0x61, 0x68, 0x57, 0x5e, 0x45, 0x4c, /* 2 */ - 0xab, 0xa2, 0xb9, 0xb0, 0x8f, 0x86, 0x9d, 0x94, 0xe3, 0xea, 0xf1, 0xf8, 0xc7, 0xce, 0xd5, 0xdc, /* 3 */ - 0x76, 0x7f, 0x64, 0x6d, 0x52, 0x5b, 0x40, 0x49, 0x3e, 0x37, 0x2c, 0x25, 0x1a, 0x13, 0x08, 0x01, /* 4 */ - 0xe6, 0xef, 0xf4, 0xfd, 0xc2, 0xcb, 0xd0, 0xd9, 0xae, 0xa7, 0xbc, 0xb5, 0x8a, 0x83, 0x98, 0x91, /* 5 */ - 0x4d, 0x44, 0x5f, 0x56, 0x69, 0x60, 0x7b, 0x72, 0x05, 0x0c, 0x17, 0x1e, 0x21, 0x28, 0x33, 0x3a, /* 6 */ - 0xdd, 0xd4, 0xcf, 0xc6, 0xf9, 0xf0, 0xeb, 0xe2, 0x95, 0x9c, 0x87, 0x8e, 0xb1, 0xb8, 0xa3, 0xaa, /* 7 */ - 0xec, 0xe5, 0xfe, 0xf7, 0xc8, 0xc1, 0xda, 0xd3, 0xa4, 0xad, 0xb6, 0xbf, 0x80, 0x89, 0x92, 0x9b, /* 8 */ - 0x7c, 0x75, 0x6e, 0x67, 0x58, 0x51, 0x4a, 0x43, 0x34, 0x3d, 0x26, 0x2f, 0x10, 0x19, 0x02, 0x0b, /* 9 */ - 0xd7, 0xde, 0xc5, 0xcc, 0xf3, 0xfa, 0xe1, 0xe8, 0x9f, 0x96, 0x8d, 0x84, 0xbb, 0xb2, 0xa9, 0xa0, /* a */ - 0x47, 0x4e, 0x55, 0x5c, 0x63, 0x6a, 0x71, 0x78, 0x0f, 0x06, 0x1d, 0x14, 0x2b, 0x22, 0x39, 0x30, /* b */ - 0x9a, 0x93, 0x88, 0x81, 0xbe, 0xb7, 0xac, 0xa5, 0xd2, 0xdb, 0xc0, 0xc9, 0xf6, 0xff, 0xe4, 0xed, /* c */ - 0x0a, 0x03, 0x18, 0x11, 0x2e, 0x27, 0x3c, 0x35, 0x42, 0x4b, 0x50, 0x59, 0x66, 0x6f, 0x74, 0x7d, /* d */ - 0xa1, 0xa8, 0xb3, 0xba, 0x85, 0x8c, 0x97, 0x9e, 0xe9, 0xe0, 0xfb, 0xf2, 0xcd, 0xc4, 0xdf, 0xd6, /* e */ - 0x31, 0x38, 0x23, 0x2a, 0x15, 0x1c, 0x07, 0x0e, 0x79, 0x70, 0x6b, 0x62, 0x5d, 0x54, 0x4f, 0x46, /* f */ -}; - -/* ArrayIndex*{0b} */ -static const UINT8 aes_mul_b[] = { - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - 0x00, 0x0b, 0x16, 0x1d, 0x2c, 0x27, 0x3a, 0x31, 0x58, 0x53, 0x4e, 0x45, 0x74, 0x7f, 0x62, 0x69, /* 0 */ - 0xb0, 0xbb, 0xa6, 0xad, 0x9c, 0x97, 0x8a, 0x81, 0xe8, 0xe3, 0xfe, 0xf5, 0xc4, 0xcf, 0xd2, 0xd9, /* 1 */ - 0x7b, 0x70, 0x6d, 0x66, 0x57, 0x5c, 0x41, 0x4a, 0x23, 0x28, 0x35, 0x3e, 0x0f, 0x04, 0x19, 0x12, /* 2 */ - 0xcb, 0xc0, 0xdd, 0xd6, 0xe7, 0xec, 0xf1, 0xfa, 0x93, 0x98, 0x85, 0x8e, 0xbf, 0xb4, 0xa9, 0xa2, /* 3 */ - 0xf6, 0xfd, 0xe0, 0xeb, 0xda, 0xd1, 0xcc, 0xc7, 0xae, 0xa5, 0xb8, 0xb3, 0x82, 0x89, 0x94, 0x9f, /* 4 */ - 0x46, 0x4d, 0x50, 0x5b, 0x6a, 0x61, 0x7c, 0x77, 0x1e, 0x15, 0x08, 0x03, 0x32, 0x39, 0x24, 0x2f, /* 5 */ - 0x8d, 0x86, 0x9b, 0x90, 0xa1, 0xaa, 0xb7, 0xbc, 0xd5, 0xde, 0xc3, 0xc8, 0xf9, 0xf2, 0xef, 0xe4, /* 6 */ - 0x3d, 0x36, 0x2b, 0x20, 0x11, 0x1a, 0x07, 0x0c, 0x65, 0x6e, 0x73, 0x78, 0x49, 0x42, 0x5f, 0x54, /* 7 */ - 0xf7, 0xfc, 0xe1, 0xea, 0xdb, 0xd0, 0xcd, 0xc6, 0xaf, 0xa4, 0xb9, 0xb2, 0x83, 0x88, 0x95, 0x9e, /* 8 */ - 0x47, 0x4c, 0x51, 0x5a, 0x6b, 0x60, 0x7d, 0x76, 0x1f, 0x14, 0x09, 0x02, 0x33, 0x38, 0x25, 0x2e, /* 9 */ - 0x8c, 0x87, 0x9a, 0x91, 0xa0, 0xab, 0xb6, 0xbd, 0xd4, 0xdf, 0xc2, 0xc9, 0xf8, 0xf3, 0xee, 0xe5, /* a */ - 0x3c, 0x37, 0x2a, 0x21, 0x10, 0x1b, 0x06, 0x0d, 0x64, 0x6f, 0x72, 0x79, 0x48, 0x43, 0x5e, 0x55, /* b */ - 0x01, 0x0a, 0x17, 0x1c, 0x2d, 0x26, 0x3b, 0x30, 0x59, 0x52, 0x4f, 0x44, 0x75, 0x7e, 0x63, 0x68, /* c */ - 0xb1, 0xba, 0xa7, 0xac, 0x9d, 0x96, 0x8b, 0x80, 0xe9, 0xe2, 0xff, 0xf4, 0xc5, 0xce, 0xd3, 0xd8, /* d */ - 0x7a, 0x71, 0x6c, 0x67, 0x56, 0x5d, 0x40, 0x4b, 0x22, 0x29, 0x34, 0x3f, 0x0e, 0x05, 0x18, 0x13, /* e */ - 0xca, 0xc1, 0xdc, 0xd7, 0xe6, 0xed, 0xf0, 0xfb, 0x92, 0x99, 0x84, 0x8f, 0xbe, 0xb5, 0xa8, 0xa3, /* f */ -}; - -/* ArrayIndex*{0d} */ -static const UINT8 aes_mul_d[] = { - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - 0x00, 0x0d, 0x1a, 0x17, 0x34, 0x39, 0x2e, 0x23, 0x68, 0x65, 0x72, 0x7f, 0x5c, 0x51, 0x46, 0x4b, /* 0 */ - 0xd0, 0xdd, 0xca, 0xc7, 0xe4, 0xe9, 0xfe, 0xf3, 0xb8, 0xb5, 0xa2, 0xaf, 0x8c, 0x81, 0x96, 0x9b, /* 1 */ - 0xbb, 0xb6, 0xa1, 0xac, 0x8f, 0x82, 0x95, 0x98, 0xd3, 0xde, 0xc9, 0xc4, 0xe7, 0xea, 0xfd, 0xf0, /* 2 */ - 0x6b, 0x66, 0x71, 0x7c, 0x5f, 0x52, 0x45, 0x48, 0x03, 0x0e, 0x19, 0x14, 0x37, 0x3a, 0x2d, 0x20, /* 3 */ - 0x6d, 0x60, 0x77, 0x7a, 0x59, 0x54, 0x43, 0x4e, 0x05, 0x08, 0x1f, 0x12, 0x31, 0x3c, 0x2b, 0x26, /* 4 */ - 0xbd, 0xb0, 0xa7, 0xaa, 0x89, 0x84, 0x93, 0x9e, 0xd5, 0xd8, 0xcf, 0xc2, 0xe1, 0xec, 0xfb, 0xf6, /* 5 */ - 0xd6, 0xdb, 0xcc, 0xc1, 0xe2, 0xef, 0xf8, 0xf5, 0xbe, 0xb3, 0xa4, 0xa9, 0x8a, 0x87, 0x90, 0x9d, /* 6 */ - 0x06, 0x0b, 0x1c, 0x11, 0x32, 0x3f, 0x28, 0x25, 0x6e, 0x63, 0x74, 0x79, 0x5a, 0x57, 0x40, 0x4d, /* 7 */ - 0xda, 0xd7, 0xc0, 0xcd, 0xee, 0xe3, 0xf4, 0xf9, 0xb2, 0xbf, 0xa8, 0xa5, 0x86, 0x8b, 0x9c, 0x91, /* 8 */ - 0x0a, 0x07, 0x10, 0x1d, 0x3e, 0x33, 0x24, 0x29, 0x62, 0x6f, 0x78, 0x75, 0x56, 0x5b, 0x4c, 0x41, /* 9 */ - 0x61, 0x6c, 0x7b, 0x76, 0x55, 0x58, 0x4f, 0x42, 0x09, 0x04, 0x13, 0x1e, 0x3d, 0x30, 0x27, 0x2a, /* a */ - 0xb1, 0xbc, 0xab, 0xa6, 0x85, 0x88, 0x9f, 0x92, 0xd9, 0xd4, 0xc3, 0xce, 0xed, 0xe0, 0xf7, 0xfa, /* b */ - 0xb7, 0xba, 0xad, 0xa0, 0x83, 0x8e, 0x99, 0x94, 0xdf, 0xd2, 0xc5, 0xc8, 0xeb, 0xe6, 0xf1, 0xfc, /* c */ - 0x67, 0x6a, 0x7d, 0x70, 0x53, 0x5e, 0x49, 0x44, 0x0f, 0x02, 0x15, 0x18, 0x3b, 0x36, 0x21, 0x2c, /* d */ - 0x0c, 0x01, 0x16, 0x1b, 0x38, 0x35, 0x22, 0x2f, 0x64, 0x69, 0x7e, 0x73, 0x50, 0x5d, 0x4a, 0x47, /* e */ - 0xdc, 0xd1, 0xc6, 0xcb, 0xe8, 0xe5, 0xf2, 0xff, 0xb4, 0xb9, 0xae, 0xa3, 0x80, 0x8d, 0x9a, 0x97, /* f */ -}; - -/* ArrayIndex*{0e} */ -static const UINT8 aes_mul_e[] = { - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - 0x00, 0x0e, 0x1c, 0x12, 0x38, 0x36, 0x24, 0x2a, 0x70, 0x7e, 0x6c, 0x62, 0x48, 0x46, 0x54, 0x5a, /* 0 */ - 0xe0, 0xee, 0xfc, 0xf2, 0xd8, 0xd6, 0xc4, 0xca, 0x90, 0x9e, 0x8c, 0x82, 0xa8, 0xa6, 0xb4, 0xba, /* 1 */ - 0xdb, 0xd5, 0xc7, 0xc9, 0xe3, 0xed, 0xff, 0xf1, 0xab, 0xa5, 0xb7, 0xb9, 0x93, 0x9d, 0x8f, 0x81, /* 2 */ - 0x3b, 0x35, 0x27, 0x29, 0x03, 0x0d, 0x1f, 0x11, 0x4b, 0x45, 0x57, 0x59, 0x73, 0x7d, 0x6f, 0x61, /* 3 */ - 0xad, 0xa3, 0xb1, 0xbf, 0x95, 0x9b, 0x89, 0x87, 0xdd, 0xd3, 0xc1, 0xcf, 0xe5, 0xeb, 0xf9, 0xf7, /* 4 */ - 0x4d, 0x43, 0x51, 0x5f, 0x75, 0x7b, 0x69, 0x67, 0x3d, 0x33, 0x21, 0x2f, 0x05, 0x0b, 0x19, 0x17, /* 5 */ - 0x76, 0x78, 0x6a, 0x64, 0x4e, 0x40, 0x52, 0x5c, 0x06, 0x08, 0x1a, 0x14, 0x3e, 0x30, 0x22, 0x2c, /* 6 */ - 0x96, 0x98, 0x8a, 0x84, 0xae, 0xa0, 0xb2, 0xbc, 0xe6, 0xe8, 0xfa, 0xf4, 0xde, 0xd0, 0xc2, 0xcc, /* 7 */ - 0x41, 0x4f, 0x5d, 0x53, 0x79, 0x77, 0x65, 0x6b, 0x31, 0x3f, 0x2d, 0x23, 0x09, 0x07, 0x15, 0x1b, /* 8 */ - 0xa1, 0xaf, 0xbd, 0xb3, 0x99, 0x97, 0x85, 0x8b, 0xd1, 0xdf, 0xcd, 0xc3, 0xe9, 0xe7, 0xf5, 0xfb, /* 9 */ - 0x9a, 0x94, 0x86, 0x88, 0xa2, 0xac, 0xbe, 0xb0, 0xea, 0xe4, 0xf6, 0xf8, 0xd2, 0xdc, 0xce, 0xc0, /* a */ - 0x7a, 0x74, 0x66, 0x68, 0x42, 0x4c, 0x5e, 0x50, 0x0a, 0x04, 0x16, 0x18, 0x32, 0x3c, 0x2e, 0x20, /* b */ - 0xec, 0xe2, 0xf0, 0xfe, 0xd4, 0xda, 0xc8, 0xc6, 0x9c, 0x92, 0x80, 0x8e, 0xa4, 0xaa, 0xb8, 0xb6, /* c */ - 0x0c, 0x02, 0x10, 0x1e, 0x34, 0x3a, 0x28, 0x26, 0x7c, 0x72, 0x60, 0x6e, 0x44, 0x4a, 0x58, 0x56, /* d */ - 0x37, 0x39, 0x2b, 0x25, 0x0f, 0x01, 0x13, 0x1d, 0x47, 0x49, 0x5b, 0x55, 0x7f, 0x71, 0x63, 0x6d, /* e */ - 0xd7, 0xd9, 0xcb, 0xc5, 0xef, 0xe1, 0xf3, 0xfd, 0xa7, 0xa9, 0xbb, 0xb5, 0x9f, 0x91, 0x83, 0x8d, /* f */ -}; - - -/* For AES_CMAC */ -#define AES_MAC_LENGTH 16 /* 128-bit string */ -static UINT8 Const_Zero[16] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -static UINT8 Const_Rb[16] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87}; - - -/* -======================================================================== -Routine Description: - AES key expansion (key schedule) - -Arguments: - Key Cipher key, it may be 16, 24, or 32 bytes (128, 192, or 256 bits) - KeyLength The length of cipher key in bytes - paes_ctx Pointer to AES_CTX_STRUC - -Return Value: - paes_ctx Retrun the KeyWordExpansion of AES_CTX_STRUC - -Note: - Pseudo code for key expansion - ------------------------------------------ - Nk = (key length/4); - - while (i < Nk) - KeyWordExpansion[i] = word(key[4*i], key[4*i + 1], key[4*i + 2], key[4*i + 3]); - i++; - end while - - while (i < ((key length/4 + 6 + 1)*4) ) - temp = KeyWordExpansion[i - 1]; - if (i % Nk ==0) - temp = SubWord(RotWord(temp)) ^ Rcon[i/Nk]; - else if ((Nk > 6) && (i % 4 == 4)) - temp = SubWord(temp); - end if - - KeyWordExpansion[i] = KeyWordExpansion[i - Nk]^ temp; - i++; - end while -======================================================================== -*/ -VOID AES_KeyExpansion ( - IN UINT8 Key[], - IN UINT KeyLength, - INOUT AES_CTX_STRUC *paes_ctx) -{ - UINT KeyIndex = 0; - UINT NumberOfWordOfKey, NumberOfWordOfKeyExpansion; - UINT8 TempWord[AES_KEY_ROWS], Temp; - UINT32 Temprcon; - - NumberOfWordOfKey = KeyLength >> 2; - while (KeyIndex < NumberOfWordOfKey) - { - paes_ctx->KeyWordExpansion[0][KeyIndex] = Key[4*KeyIndex]; - paes_ctx->KeyWordExpansion[1][KeyIndex] = Key[4*KeyIndex + 1]; - paes_ctx->KeyWordExpansion[2][KeyIndex] = Key[4*KeyIndex + 2]; - paes_ctx->KeyWordExpansion[3][KeyIndex] = Key[4*KeyIndex + 3]; - KeyIndex++; - } /* End of while */ - - NumberOfWordOfKeyExpansion = ((UINT) AES_KEY_ROWS) * ((KeyLength >> 2) + 6 + 1); - while (KeyIndex < NumberOfWordOfKeyExpansion) - { - TempWord[0] = paes_ctx->KeyWordExpansion[0][KeyIndex - 1]; - TempWord[1] = paes_ctx->KeyWordExpansion[1][KeyIndex - 1]; - TempWord[2] = paes_ctx->KeyWordExpansion[2][KeyIndex - 1]; - TempWord[3] = paes_ctx->KeyWordExpansion[3][KeyIndex - 1]; - if ((KeyIndex % NumberOfWordOfKey) == 0) { - Temprcon = aes_rcon[KeyIndex/NumberOfWordOfKey]; - Temp = aes_sbox_enc[TempWord[1]]^((Temprcon >> 24) & 0xff); - TempWord[1] = aes_sbox_enc[TempWord[2]]^((Temprcon >> 16) & 0xff); - TempWord[2] = aes_sbox_enc[TempWord[3]]^((Temprcon >> 8) & 0xff); - TempWord[3] = aes_sbox_enc[TempWord[0]]^((Temprcon ) & 0xff); - TempWord[0] = Temp; - } else if ((NumberOfWordOfKey > 6) && ((KeyIndex % NumberOfWordOfKey) == 4)) { - Temp = aes_sbox_enc[TempWord[0]]; - TempWord[1] = aes_sbox_enc[TempWord[1]]; - TempWord[2] = aes_sbox_enc[TempWord[2]]; - TempWord[3] = aes_sbox_enc[TempWord[3]]; - TempWord[0] = Temp; - } - paes_ctx->KeyWordExpansion[0][KeyIndex] = paes_ctx->KeyWordExpansion[0][KeyIndex - NumberOfWordOfKey]^TempWord[0]; - paes_ctx->KeyWordExpansion[1][KeyIndex] = paes_ctx->KeyWordExpansion[1][KeyIndex - NumberOfWordOfKey]^TempWord[1]; - paes_ctx->KeyWordExpansion[2][KeyIndex] = paes_ctx->KeyWordExpansion[2][KeyIndex - NumberOfWordOfKey]^TempWord[2]; - paes_ctx->KeyWordExpansion[3][KeyIndex] = paes_ctx->KeyWordExpansion[3][KeyIndex - NumberOfWordOfKey]^TempWord[3]; - KeyIndex++; - } /* End of while */ -} /* End of AES_KeyExpansion */ - - -/* -======================================================================== -Routine Description: - AES encryption - -Arguments: - PlainBlock The block of plain text, 16 bytes(128 bits) each block - PlainBlockSize The length of block of plain text in bytes - Key Cipher key, it may be 16, 24, or 32 bytes (128, 192, or 256 bits) - KeyLength The length of cipher key in bytes - CipherBlockSize The length of allocated cipher block in bytes - -Return Value: - CipherBlock Return cipher text - CipherBlockSize Return the length of real used cipher block in bytes - -Note: - Reference to FIPS-PUB 197 - 1. Check if block size is 16 bytes(128 bits) and if key length is 16, 24, or 32 bytes(128, 192, or 256 bits) - 2. Transfer the plain block to state block - 3. Main encryption rounds - 4. Transfer the state block to cipher block - ------------------------------------------ - NumberOfRound = (key length / 4) + 6; - state block = plain block; - - AddRoundKey(state block, key); - for round = 1 to NumberOfRound - SubBytes(state block) - ShiftRows(state block) - MixColumns(state block) - AddRoundKey(state block, key); - end for - - SubBytes(state block) - ShiftRows(state block) - AddRoundKey(state block, key); - - cipher block = state block; -======================================================================== -*/ -VOID AES_Encrypt ( - IN UINT8 PlainBlock[], - IN UINT PlainBlockSize, - IN UINT8 Key[], - IN UINT KeyLength, - OUT UINT8 CipherBlock[], - INOUT UINT *CipherBlockSize) -{ - AES_CTX_STRUC aes_ctx; - UINT RowIndex, ColumnIndex; - UINT RoundIndex, NumberOfRound = 0; - UINT8 Temp, Row0, Row1, Row2, Row3; - - /* - * 1. Check if block size is 16 bytes(128 bits) and if key length is 16, 24, or 32 bytes(128, 192, or 256 bits) - */ - if (PlainBlockSize != AES_BLOCK_SIZES) { - DBGPRINT(RT_DEBUG_ERROR, ("AES_Encrypt: plain block size is %d bytes, it must be %d bytes(128 bits).\n", - PlainBlockSize, AES_BLOCK_SIZES)); - return; - } /* End of if */ - if ((KeyLength != AES_KEY128_LENGTH) && (KeyLength != AES_KEY192_LENGTH) && (KeyLength != AES_KEY256_LENGTH)) { - DBGPRINT(RT_DEBUG_ERROR, ("AES_Encrypt: key length is %d bytes, it must be %d, %d, or %d bytes(128, 192, or 256 bits).\n", - KeyLength, AES_KEY128_LENGTH, AES_KEY192_LENGTH, AES_KEY256_LENGTH)); - return; - } /* End of if */ - if (*CipherBlockSize < AES_BLOCK_SIZES) { - DBGPRINT(RT_DEBUG_ERROR, ("AES_Encrypt: cipher block size is %d bytes, it must be %d bytes(128 bits).\n", - *CipherBlockSize, AES_BLOCK_SIZES)); - return; - } /* End of if */ - - /* - * 2. Transfer the plain block to state block - */ - for (RowIndex = 0; RowIndex < AES_STATE_ROWS;RowIndex++) - for (ColumnIndex = 0; ColumnIndex < AES_STATE_COLUMNS;ColumnIndex++) - aes_ctx.State[RowIndex][ColumnIndex] = PlainBlock[RowIndex + 4*ColumnIndex]; - - /* - * 3. Main encryption rounds - */ - AES_KeyExpansion(Key, KeyLength, &aes_ctx); - NumberOfRound = (KeyLength >> 2) + 6; - - /* AES_AddRoundKey */ - RoundIndex = 0; - for (RowIndex = 0; RowIndex < AES_STATE_ROWS;RowIndex++) - for (ColumnIndex = 0; ColumnIndex < AES_STATE_COLUMNS;ColumnIndex++) - aes_ctx.State[RowIndex][ColumnIndex] ^= aes_ctx.KeyWordExpansion[RowIndex][(RoundIndex*((UINT) AES_STATE_COLUMNS)) + ColumnIndex]; - - for (RoundIndex = 1; RoundIndex < NumberOfRound;RoundIndex++) - { - /* AES_SubBytes */ - for (RowIndex = 0; RowIndex < AES_STATE_ROWS;RowIndex++) - for (ColumnIndex = 0; ColumnIndex < AES_STATE_COLUMNS;ColumnIndex++) - aes_ctx.State[RowIndex][ColumnIndex] = aes_sbox_enc[aes_ctx.State[RowIndex][ColumnIndex]]; - - /* AES_ShiftRows */ - Temp = aes_ctx.State[1][0]; - aes_ctx.State[1][0] = aes_ctx.State[1][1]; - aes_ctx.State[1][1] = aes_ctx.State[1][2]; - aes_ctx.State[1][2] = aes_ctx.State[1][3]; - aes_ctx.State[1][3] = Temp; - Temp = aes_ctx.State[2][0]; - aes_ctx.State[2][0] = aes_ctx.State[2][2]; - aes_ctx.State[2][2] = Temp; - Temp = aes_ctx.State[2][1]; - aes_ctx.State[2][1] = aes_ctx.State[2][3]; - aes_ctx.State[2][3] = Temp; - Temp = aes_ctx.State[3][3]; - aes_ctx.State[3][3] = aes_ctx.State[3][2]; - aes_ctx.State[3][2] = aes_ctx.State[3][1]; - aes_ctx.State[3][1] = aes_ctx.State[3][0]; - aes_ctx.State[3][0] = Temp; - - /* AES_MixColumns */ - for (ColumnIndex = 0; ColumnIndex < AES_STATE_COLUMNS;ColumnIndex++) - { - Row0 = aes_ctx.State[0][ColumnIndex]; - Row1 = aes_ctx.State[1][ColumnIndex]; - Row2 = aes_ctx.State[2][ColumnIndex]; - Row3 = aes_ctx.State[3][ColumnIndex]; - aes_ctx.State[0][ColumnIndex] = aes_mul_2[Row0]^aes_mul_3[Row1]^Row2^Row3; - aes_ctx.State[1][ColumnIndex] = Row0^aes_mul_2[Row1]^aes_mul_3[Row2]^Row3; - aes_ctx.State[2][ColumnIndex] = Row0^Row1^aes_mul_2[Row2]^aes_mul_3[Row3]; - aes_ctx.State[3][ColumnIndex] = aes_mul_3[Row0]^Row1^Row2^aes_mul_2[Row3]; - } - - /* AES_AddRoundKey */ - for (RowIndex = 0; RowIndex < AES_STATE_ROWS;RowIndex++) - for (ColumnIndex = 0; ColumnIndex < AES_STATE_COLUMNS;ColumnIndex++) - aes_ctx.State[RowIndex][ColumnIndex] ^= aes_ctx.KeyWordExpansion[RowIndex][(RoundIndex*((UINT) AES_STATE_COLUMNS)) + ColumnIndex]; - } /* End of for */ - - /* AES_SubBytes */ - for (RowIndex = 0; RowIndex < AES_STATE_ROWS;RowIndex++) - for (ColumnIndex = 0; ColumnIndex < AES_STATE_COLUMNS;ColumnIndex++) - aes_ctx.State[RowIndex][ColumnIndex] = aes_sbox_enc[aes_ctx.State[RowIndex][ColumnIndex]]; - /* AES_ShiftRows */ - Temp = aes_ctx.State[1][0]; - aes_ctx.State[1][0] = aes_ctx.State[1][1]; - aes_ctx.State[1][1] = aes_ctx.State[1][2]; - aes_ctx.State[1][2] = aes_ctx.State[1][3]; - aes_ctx.State[1][3] = Temp; - Temp = aes_ctx.State[2][0]; - aes_ctx.State[2][0] = aes_ctx.State[2][2]; - aes_ctx.State[2][2] = Temp; - Temp = aes_ctx.State[2][1]; - aes_ctx.State[2][1] = aes_ctx.State[2][3]; - aes_ctx.State[2][3] = Temp; - Temp = aes_ctx.State[3][3]; - aes_ctx.State[3][3] = aes_ctx.State[3][2]; - aes_ctx.State[3][2] = aes_ctx.State[3][1]; - aes_ctx.State[3][1] = aes_ctx.State[3][0]; - aes_ctx.State[3][0] = Temp; - /* AES_AddRoundKey */ - for (RowIndex = 0; RowIndex < AES_STATE_ROWS;RowIndex++) - for (ColumnIndex = 0; ColumnIndex < AES_STATE_COLUMNS;ColumnIndex++) - aes_ctx.State[RowIndex][ColumnIndex] ^= aes_ctx.KeyWordExpansion[RowIndex][(RoundIndex*((UINT) AES_STATE_COLUMNS)) + ColumnIndex]; - - /* - * 4. Transfer the state block to cipher block - */ - for (RowIndex = 0; RowIndex < AES_STATE_ROWS;RowIndex++) - for (ColumnIndex = 0; ColumnIndex < AES_STATE_COLUMNS;ColumnIndex++) - CipherBlock[RowIndex + 4*ColumnIndex] = aes_ctx.State[RowIndex][ColumnIndex]; - - *CipherBlockSize = ((UINT) AES_STATE_ROWS)*((UINT) AES_STATE_COLUMNS); -} /* End of AES_Encrypt */ - - -/* -======================================================================== -Routine Description: - AES decryption - -Arguments: - CipherBlock The block of cipher text, 16 bytes(128 bits) each block - CipherBlockSize The length of block of cipher text in bytes - Key Cipher key, it may be 16, 24, or 32 bytes (128, 192, or 256 bits) - KeyLength The length of cipher key in bytes - PlainBlockSize The length of allocated plain block in bytes - -Return Value: - PlainBlock Return plain text - PlainBlockSize Return the length of real used plain block in bytes - -Note: - Reference to FIPS-PUB 197 - 1. Check if block size is 16 bytes(128 bits) and if key length is 16, 24, or 32 bytes(128, 192, or 256 bits) - 2. Transfer the cipher block to state block - 3. Main decryption rounds - 4. Transfer the state block to plain block - ------------------------------------------ - NumberOfRound = (key length / 4) + 6; - state block = cipher block; - - AddRoundKey(state block, key); - for round = NumberOfRound to 1 - InvSubBytes(state block) - InvShiftRows(state block) - InvMixColumns(state block) - AddRoundKey(state block, key); - end for - - InvSubBytes(state block) - InvShiftRows(state block) - AddRoundKey(state block, key); - - plain block = state block; -======================================================================== -*/ -VOID AES_Decrypt ( - IN UINT8 CipherBlock[], - IN UINT CipherBlockSize, - IN UINT8 Key[], - IN UINT KeyLength, - OUT UINT8 PlainBlock[], - INOUT UINT *PlainBlockSize) -{ - AES_CTX_STRUC aes_ctx; - UINT RowIndex, ColumnIndex; - UINT RoundIndex, NumberOfRound = 0; - UINT8 Temp, Row0, Row1, Row2, Row3; - - /* - * 1. Check if block size is 16 bytes(128 bits) and if key length is 16, 24, or 32 bytes(128, 192, or 256 bits) - */ - if (*PlainBlockSize < AES_BLOCK_SIZES) { - DBGPRINT(RT_DEBUG_ERROR, ("AES_Decrypt: plain block size is %d bytes, it must be %d bytes(128 bits).\n", - *PlainBlockSize, AES_BLOCK_SIZES)); - return; - } /* End of if */ - if ((KeyLength != AES_KEY128_LENGTH) && (KeyLength != AES_KEY192_LENGTH) && (KeyLength != AES_KEY256_LENGTH)) { - DBGPRINT(RT_DEBUG_ERROR, ("AES_Decrypt: key length is %d bytes, it must be %d, %d, or %d bytes(128, 192, or 256 bits).\n", - KeyLength, AES_KEY128_LENGTH, AES_KEY192_LENGTH, AES_KEY256_LENGTH)); - return; - } /* End of if */ - if (CipherBlockSize != AES_BLOCK_SIZES) { - DBGPRINT(RT_DEBUG_ERROR, ("AES_Decrypt: cipher block size is %d bytes, it must be %d bytes(128 bits).\n", - CipherBlockSize, AES_BLOCK_SIZES)); - return; - } /* End of if */ - - /* - * 2. Transfer the cipher block to state block - */ - for (RowIndex = 0; RowIndex < AES_STATE_ROWS;RowIndex++) - for (ColumnIndex = 0; ColumnIndex < AES_STATE_COLUMNS;ColumnIndex++) - aes_ctx.State[RowIndex][ColumnIndex] = CipherBlock[RowIndex + 4*ColumnIndex]; - - /* - * 3. Main decryption rounds - */ - AES_KeyExpansion(Key, KeyLength, &aes_ctx); - NumberOfRound = (KeyLength >> 2) + 6; - - /* AES_AddRoundKey */ - RoundIndex = NumberOfRound; - for (RowIndex = 0; RowIndex < AES_STATE_ROWS;RowIndex++) - for (ColumnIndex = 0; ColumnIndex < AES_STATE_COLUMNS;ColumnIndex++) - aes_ctx.State[RowIndex][ColumnIndex] ^= aes_ctx.KeyWordExpansion[RowIndex][(RoundIndex*((UINT) AES_STATE_COLUMNS)) + ColumnIndex]; - - for (RoundIndex = (NumberOfRound - 1); RoundIndex > 0 ;RoundIndex--) - { - /* AES_InvShiftRows */ - Temp = aes_ctx.State[1][3]; - aes_ctx.State[1][3] = aes_ctx.State[1][2]; - aes_ctx.State[1][2] = aes_ctx.State[1][1]; - aes_ctx.State[1][1] = aes_ctx.State[1][0]; - aes_ctx.State[1][0] = Temp; - Temp = aes_ctx.State[2][0]; - aes_ctx.State[2][0] = aes_ctx.State[2][2]; - aes_ctx.State[2][2] = Temp; - Temp = aes_ctx.State[2][1]; - aes_ctx.State[2][1] = aes_ctx.State[2][3]; - aes_ctx.State[2][3] = Temp; - Temp = aes_ctx.State[3][0]; - aes_ctx.State[3][0] = aes_ctx.State[3][1]; - aes_ctx.State[3][1] = aes_ctx.State[3][2]; - aes_ctx.State[3][2] = aes_ctx.State[3][3]; - aes_ctx.State[3][3] = Temp; - - /* AES_InvSubBytes */ - for (RowIndex = 0; RowIndex < AES_STATE_ROWS;RowIndex++) - for (ColumnIndex = 0; ColumnIndex < AES_STATE_COLUMNS;ColumnIndex++) - aes_ctx.State[RowIndex][ColumnIndex] = aes_sbox_dec[aes_ctx.State[RowIndex][ColumnIndex]]; - - /* AES_AddRoundKey */ - for (RowIndex = 0; RowIndex < AES_STATE_ROWS;RowIndex++) - for (ColumnIndex = 0; ColumnIndex < AES_STATE_COLUMNS;ColumnIndex++) - aes_ctx.State[RowIndex][ColumnIndex] ^= aes_ctx.KeyWordExpansion[RowIndex][(RoundIndex*((UINT) AES_STATE_COLUMNS)) + ColumnIndex]; - - /* AES_InvMixColumns */ - for (ColumnIndex = 0; ColumnIndex < AES_STATE_COLUMNS;ColumnIndex++) - { - Row0 = aes_ctx.State[0][ColumnIndex]; - Row1 = aes_ctx.State[1][ColumnIndex]; - Row2 = aes_ctx.State[2][ColumnIndex]; - Row3 = aes_ctx.State[3][ColumnIndex]; - aes_ctx.State[0][ColumnIndex] = aes_mul_e[Row0]^aes_mul_b[Row1]^aes_mul_d[Row2]^aes_mul_9[Row3]; - aes_ctx.State[1][ColumnIndex] = aes_mul_9[Row0]^aes_mul_e[Row1]^aes_mul_b[Row2]^aes_mul_d[Row3]; - aes_ctx.State[2][ColumnIndex] = aes_mul_d[Row0]^aes_mul_9[Row1]^aes_mul_e[Row2]^aes_mul_b[Row3]; - aes_ctx.State[3][ColumnIndex] = aes_mul_b[Row0]^aes_mul_d[Row1]^aes_mul_9[Row2]^aes_mul_e[Row3]; - } - } /* End of for */ - - /* AES_InvShiftRows */ - Temp = aes_ctx.State[1][3]; - aes_ctx.State[1][3] = aes_ctx.State[1][2]; - aes_ctx.State[1][2] = aes_ctx.State[1][1]; - aes_ctx.State[1][1] = aes_ctx.State[1][0]; - aes_ctx.State[1][0] = Temp; - Temp = aes_ctx.State[2][0]; - aes_ctx.State[2][0] = aes_ctx.State[2][2]; - aes_ctx.State[2][2] = Temp; - Temp = aes_ctx.State[2][1]; - aes_ctx.State[2][1] = aes_ctx.State[2][3]; - aes_ctx.State[2][3] = Temp; - Temp = aes_ctx.State[3][0]; - aes_ctx.State[3][0] = aes_ctx.State[3][1]; - aes_ctx.State[3][1] = aes_ctx.State[3][2]; - aes_ctx.State[3][2] = aes_ctx.State[3][3]; - aes_ctx.State[3][3] = Temp; - /* AES_InvSubBytes */ - for (RowIndex = 0; RowIndex < AES_STATE_ROWS;RowIndex++) - for (ColumnIndex = 0; ColumnIndex < AES_STATE_COLUMNS;ColumnIndex++) - aes_ctx.State[RowIndex][ColumnIndex] = aes_sbox_dec[aes_ctx.State[RowIndex][ColumnIndex]]; - /* AES_AddRoundKey */ - for (RowIndex = 0; RowIndex < AES_STATE_ROWS;RowIndex++) - for (ColumnIndex = 0; ColumnIndex < AES_STATE_COLUMNS;ColumnIndex++) - aes_ctx.State[RowIndex][ColumnIndex] ^= aes_ctx.KeyWordExpansion[RowIndex][(RoundIndex*((UINT) AES_STATE_COLUMNS)) + ColumnIndex]; - - /* - * 4. Transfer the state block to plain block - */ - for (RowIndex = 0; RowIndex < AES_STATE_ROWS;RowIndex++) - for (ColumnIndex = 0; ColumnIndex < AES_STATE_COLUMNS;ColumnIndex++) - PlainBlock[RowIndex + 4*ColumnIndex] = aes_ctx.State[RowIndex][ColumnIndex]; - - *PlainBlockSize = ((UINT) AES_STATE_ROWS)*((UINT) AES_STATE_COLUMNS); -} /* End of AES_Decrypt */ - - -/* -======================================================================== -Routine Description: - AES-CBC encryption - -Arguments: - PlainText Plain text - PlainTextLength The length of plain text in bytes - Key Cipher key, it may be 16, 24, or 32 bytes (128, 192, or 256 bits) - KeyLength The length of cipher key in bytes - IV Initialization vector, it may be 16 bytes (128 bits) - IVLength The length of initialization vector in bytes - CipherTextLength The length of allocated cipher text in bytes - -Return Value: - CipherText Return cipher text - CipherTextLength Return the length of real used cipher text in bytes - -Note: - Reference to RFC 3602 and NIST 800-38A -======================================================================== -*/ -VOID AES_CBC_Encrypt ( - IN UINT8 PlainText[], - IN UINT PlainTextLength, - IN UINT8 Key[], - IN UINT KeyLength, - IN UINT8 IV[], - IN UINT IVLength, - OUT UINT8 CipherText[], - INOUT UINT *CipherTextLength) -{ - UINT PaddingSize, PlainBlockStart, CipherBlockStart, CipherBlockSize; - UINT Index; - UINT8 Block[AES_BLOCK_SIZES]; - - /* - * 1. Check the input parameters - * - CipherTextLength > (PlainTextLength + Padding size), Padding size = block size - (PlainTextLength % block size) - * - Key length must be 16, 24, or 32 bytes(128, 192, or 256 bits) - * - IV length must be 16 bytes(128 bits) - */ - PaddingSize = ((UINT) AES_BLOCK_SIZES) - (PlainTextLength % ((UINT)AES_BLOCK_SIZES)); - if (*CipherTextLength < (PlainTextLength + PaddingSize)) { - DBGPRINT(RT_DEBUG_ERROR, ("AES_CBC_Encrypt: cipher text length is %d bytes < (plain text length %d bytes + padding size %d bytes).\n", - *CipherTextLength, PlainTextLength, PaddingSize)); - return; - } /* End of if */ - if ((KeyLength != AES_KEY128_LENGTH) && (KeyLength != AES_KEY192_LENGTH) && (KeyLength != AES_KEY256_LENGTH)) { - DBGPRINT(RT_DEBUG_ERROR, ("AES_CBC_Encrypt: key length is %d bytes, it must be %d, %d, or %d bytes(128, 192, or 256 bits).\n", - KeyLength, AES_KEY128_LENGTH, AES_KEY192_LENGTH, AES_KEY256_LENGTH)); - return; - } /* End of if */ - if (IVLength != AES_CBC_IV_LENGTH) { - DBGPRINT(RT_DEBUG_ERROR, ("AES_CBC_Encrypt: IV length is %d bytes, it must be %d bytes(128bits).\n", - IVLength, AES_CBC_IV_LENGTH)); - return; - } /* End of if */ - - - /* - * 2. Main algorithm - * - Plain text divide into serveral blocks (16 bytes/block) - * - If plain text is divided with no remainder by block, add a new block and padding size = block(16 bytes) - * - If plain text is not divided with no remainder by block, padding size = (block - remainder plain text) - * - Execute AES_Encrypt procedure. - * - * - Padding method: The remainder bytes will be filled with padding size (1 byte) - */ - PlainBlockStart = 0; - CipherBlockStart = 0; - while ((PlainTextLength - PlainBlockStart) >= AES_BLOCK_SIZES) - { - if (CipherBlockStart == 0) { - for (Index = 0; Index < AES_BLOCK_SIZES; Index++) - Block[Index] = PlainText[PlainBlockStart + Index]^IV[Index]; - } else { - for (Index = 0; Index < AES_BLOCK_SIZES; Index++) - Block[Index] = PlainText[PlainBlockStart + Index]^CipherText[CipherBlockStart - ((UINT) AES_BLOCK_SIZES) + Index]; - } /* End of if */ - - CipherBlockSize = *CipherTextLength - CipherBlockStart; - AES_Encrypt(Block, AES_BLOCK_SIZES , Key, KeyLength, CipherText + CipherBlockStart, &CipherBlockSize); - - PlainBlockStart += ((UINT) AES_BLOCK_SIZES); - CipherBlockStart += CipherBlockSize; - } /* End of while */ - - NdisMoveMemory(Block, (&PlainText[0] + PlainBlockStart), (PlainTextLength - PlainBlockStart)); - NdisFillMemory((Block + (((UINT) AES_BLOCK_SIZES) -PaddingSize)), PaddingSize, (UINT8) PaddingSize); - if (CipherBlockStart == 0) { - for (Index = 0; Index < AES_BLOCK_SIZES; Index++) - Block[Index] ^= IV[Index]; - } else { - for (Index = 0; Index < AES_BLOCK_SIZES; Index++) - Block[Index] ^= CipherText[CipherBlockStart - ((UINT) AES_BLOCK_SIZES) + Index]; - } /* End of if */ - CipherBlockSize = *CipherTextLength - CipherBlockStart; - AES_Encrypt(Block, AES_BLOCK_SIZES , Key, KeyLength, CipherText + CipherBlockStart, &CipherBlockSize); - CipherBlockStart += CipherBlockSize; - *CipherTextLength = CipherBlockStart; -} /* End of AES_CBC_Encrypt */ - - -/* -======================================================================== -Routine Description: - AES-CBC decryption - -Arguments: - CipherText Cipher text - CipherTextLength The length of cipher text in bytes - Key Cipher key, it may be 16, 24, or 32 bytes (128, 192, or 256 bits) - KeyLength The length of cipher key in bytes - IV Initialization vector, it may be 16 bytes (128 bits) - IVLength The length of initialization vector in bytes - PlainTextLength The length of allocated plain text in bytes - -Return Value: - PlainText Return plain text - PlainTextLength Return the length of real used plain text in bytes - -Note: - Reference to RFC 3602 and NIST 800-38A -======================================================================== -*/ -VOID AES_CBC_Decrypt ( - IN UINT8 CipherText[], - IN UINT CipherTextLength, - IN UINT8 Key[], - IN UINT KeyLength, - IN UINT8 IV[], - IN UINT IVLength, - OUT UINT8 PlainText[], - INOUT UINT *PlainTextLength) -{ - UINT PaddingSize, PlainBlockStart, CipherBlockStart, PlainBlockSize; - UINT Index; - - /* - * 1. Check the input parameters - * - CipherTextLength must be divided with no remainder by block - * - Key length must be 16, 24, or 32 bytes(128, 192, or 256 bits) - * - IV length must be 16 bytes(128 bits) - */ - if ((CipherTextLength % AES_BLOCK_SIZES) != 0) { - DBGPRINT(RT_DEBUG_ERROR, ("AES_CBC_Decrypt: cipher text length is %d bytes, it can't be divided with no remainder by block size(%d).\n", - CipherTextLength, AES_BLOCK_SIZES)); - return; - } /* End of if */ - if ((KeyLength != AES_KEY128_LENGTH) && (KeyLength != AES_KEY192_LENGTH) && (KeyLength != AES_KEY256_LENGTH)) { - DBGPRINT(RT_DEBUG_ERROR, ("AES_CBC_Decrypt: key length is %d bytes, it must be %d, %d, or %d bytes(128, 192, or 256 bits).\n", - KeyLength, AES_KEY128_LENGTH, AES_KEY192_LENGTH, AES_KEY256_LENGTH)); - return; - } /* End of if */ - if (IVLength != AES_CBC_IV_LENGTH) { - DBGPRINT(RT_DEBUG_ERROR, ("AES_CBC_Decrypt: IV length is %d bytes, it must be %d bytes(128bits).\n", - IVLength, AES_CBC_IV_LENGTH)); - return; - } /* End of if */ - - - /* - * 2. Main algorithm - * - Cypher text divide into serveral blocks (16 bytes/block) - * - Execute AES_Decrypt procedure. - * - Remove padding bytes, padding size is the last byte of plain text - */ - CipherBlockStart = 0; - PlainBlockStart = 0; - while ((CipherTextLength - CipherBlockStart) >= AES_BLOCK_SIZES) - { - PlainBlockSize = *PlainTextLength - PlainBlockStart; - AES_Decrypt(CipherText + CipherBlockStart, AES_BLOCK_SIZES , Key, KeyLength, PlainText + PlainBlockStart, &PlainBlockSize); - - if (PlainBlockStart == 0) { - for (Index = 0; Index < AES_BLOCK_SIZES; Index++) - PlainText[PlainBlockStart + Index] ^= IV[Index]; - } else { - for (Index = 0; Index < AES_BLOCK_SIZES; Index++) - PlainText[PlainBlockStart + Index] ^= CipherText[CipherBlockStart + Index - ((UINT) AES_BLOCK_SIZES)]; - } /* End of if */ - - CipherBlockStart += AES_BLOCK_SIZES; - PlainBlockStart += PlainBlockSize; - } /* End of while */ - - PaddingSize = (UINT8) PlainText[PlainBlockStart -1]; - *PlainTextLength = PlainBlockStart - PaddingSize; - -} /* End of AES_CBC_Encrypt */ - - - -/* -======================================================================== -Routine Description: - AES-CMAC generate subkey - -Arguments: - Key Cipher key 128 bits - KeyLength The length of Cipher key in bytes - -Return Value: - SubKey1 SubKey 1 128 bits - SubKey2 SubKey 2 128 bits - -Note: - Reference to RFC 4493 - - Step 1. L := AES-128(K, const_Zero); - Step 2. if MSB(L) is equal to 0 - then K1 := L << 1; - else K1 := (L << 1) XOR const_Rb; - Step 3. if MSB(K1) is equal to 0 - then K2 := K1 << 1; - else K2 := (K1 << 1) XOR const_Rb; - Step 4. return K1, K2; -======================================================================== -*/ -VOID AES_CMAC_GenerateSubKey ( - IN UINT8 Key[], - IN UINT KeyLength, - OUT UINT8 SubKey1[], - OUT UINT8 SubKey2[]) -{ - UINT8 MSB_L = 0, MSB_K1 = 0, Top_Bit = 0; - UINT SubKey1_Length = 0; - INT Index = 0; - - if (KeyLength != AES_KEY128_LENGTH) { - DBGPRINT(RT_DEBUG_ERROR, ("AES_CMAC_GenerateSubKey: key length is %d bytes, it must be %d bytes(128 bits).\n", - KeyLength, AES_KEY128_LENGTH)); - return; - } /* End of if */ - - /* Step 1: L := AES-128(K, const_Zero); */ - SubKey1_Length = 16; - AES_Encrypt(Const_Zero, sizeof(Const_Zero), Key, KeyLength, SubKey1, &SubKey1_Length); - - /* - * Step 2. if MSB(L) is equal to 0 - * then K1 := L << 1; - * else K1 := (L << 1) XOR const_Rb; - */ - MSB_L = SubKey1[0] & 0x80; - for(Index = 0; Index < 15; Index++) { - Top_Bit = (SubKey1[Index + 1] & 0x80)?1:0; - SubKey1[Index] <<= 1; - SubKey1[Index] |= Top_Bit; - } - SubKey1[15] <<= 1; - if (MSB_L > 0) { - for(Index = 0; Index < 16; Index++) - SubKey1[Index] ^= Const_Rb[Index]; - } /* End of if */ - - /* - * Step 3. if MSB(K1) is equal to 0 - * then K2 := K1 << 1; - * else K2 := (K1 << 1) XOR const_Rb; - */ - MSB_K1 = SubKey1[0] & 0x80; - for(Index = 0; Index < 15; Index++) { - Top_Bit = (SubKey1[Index + 1] & 0x80)?1:0; - SubKey2[Index] = SubKey1[Index] << 1; - SubKey2[Index] |= Top_Bit; - } - SubKey2[15] = SubKey1[15] << 1; - if (MSB_K1 > 0) { - for(Index = 0; Index < 16; Index++) - SubKey2[Index] ^= Const_Rb[Index]; - } /* End of if */ -} /* End of AES_CMAC_GenerateSubKey */ - - -/* -======================================================================== -Routine Description: - AES-CMAC - -Arguments: - PlainText Plain text - PlainTextLength The length of plain text in bytes - Key Cipher key, it may be 16, 24, or 32 bytes (128, 192, or 256 bits) - KeyLength The length of cipher key in bytes - MACTextLength The length of allocated memory spaces in bytes - -Return Value: - MACText Message authentication code (128-bit string) - MACTextLength Return the length of Message authentication code in bytes - -Note: - Reference to RFC 4493 -======================================================================== -*/ -VOID AES_CMAC ( - IN UINT8 PlainText[], - IN UINT PlainTextLength, - IN UINT8 Key[], - IN UINT KeyLength, - OUT UINT8 MACText[], - INOUT UINT *MACTextLength) -{ - UINT PlainBlockStart; - UINT8 X[AES_BLOCK_SIZES], Y[AES_BLOCK_SIZES]; - UINT8 SubKey1[16]; - UINT8 SubKey2[16]; - INT X_Length, Index; - - if (*MACTextLength < AES_MAC_LENGTH) { - DBGPRINT(RT_DEBUG_ERROR, ("AES_CMAC: MAC text length is less than %d bytes).\n", - AES_MAC_LENGTH)); - return; - } /* End of if */ - if (KeyLength != AES_KEY128_LENGTH) { - DBGPRINT(RT_DEBUG_ERROR, ("AES_CMAC: key length is %d bytes, it must be %d bytes(128 bits).\n", - KeyLength, AES_KEY128_LENGTH)); - return; - } /* End of if */ - - /* Step 1. (K1,K2) := Generate_Subkey(K); */ - NdisZeroMemory(SubKey1, 16); - NdisZeroMemory(SubKey2, 16); - AES_CMAC_GenerateSubKey(Key, KeyLength, SubKey1, SubKey2); - - /* - * 2. Main algorithm - * - Plain text divide into serveral blocks (16 bytes/block) - * - If plain text is not divided with no remainder by block, padding size = (block - remainder plain text) - * - Execute AES_Encrypt procedure. - */ - PlainBlockStart = 0; - NdisMoveMemory(X, Const_Zero, AES_BLOCK_SIZES); - while ((PlainTextLength - PlainBlockStart) > AES_BLOCK_SIZES) - { - for (Index = 0; Index < AES_BLOCK_SIZES; Index++) - Y[Index] = PlainText[PlainBlockStart + Index]^X[Index]; - - X_Length = sizeof(X); - AES_Encrypt(Y, sizeof(Y) , Key, KeyLength, X, &X_Length); - PlainBlockStart += ((UINT) AES_BLOCK_SIZES); - } /* End of while */ - if ((PlainTextLength - PlainBlockStart) == AES_BLOCK_SIZES) { - for (Index = 0; Index < AES_BLOCK_SIZES; Index++) - Y[Index] = PlainText[PlainBlockStart + Index]^X[Index]^SubKey1[Index]; - } else { - NdisZeroMemory(Y, AES_BLOCK_SIZES); - NdisMoveMemory(Y, &PlainText[PlainBlockStart], (PlainTextLength - PlainBlockStart)); - Y[(PlainTextLength - PlainBlockStart)] = 0x80; - for (Index = 0; Index < AES_BLOCK_SIZES; Index++) - Y[Index] = Y[Index]^X[Index]^SubKey2[Index]; - } /* End of if */ - AES_Encrypt(Y, sizeof(Y) , Key, KeyLength, MACText, MACTextLength); -} /* End of AES_CMAC */ diff --git a/drivers/staging/rt3090/common/crypt_biginteger.c b/drivers/staging/rt3090/common/crypt_biginteger.c deleted file mode 100644 index b346c5f7fbd0..000000000000 --- a/drivers/staging/rt3090/common/crypt_biginteger.c +++ /dev/null @@ -1,1119 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - cmm_profile.c - - Abstract: - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- - */ - -#include "crypt_biginteger.h" - -#ifdef __KERNEL__ -#define DEBUGPRINT(fmt, args...) printk(KERN_ERR fmt, ## args) -#else -#define DEBUGPRINT(fmt, args...) printf(fmt, ## args) -#endif /* __KERNEL__ */ - -#define UINT32_HBITS(value) (((value) >> 0x10) & 0xffff) -#define UINT32_LBITS(value) ((value) & 0xffff) -#define UINT32_GETBYTE(value, index) (((value) >> ((index)*8)) & 0xff) -#define UINT64_HBITS(value) (((value) >> 0x20) & 0xffffffff) -#define UINT64_LBITS(value) ((value) & 0xffffffff) - -static UINT8 WPS_DH_P_VALUE[192] = -{ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xC9, 0x0F, 0xDA, 0xA2, 0x21, 0x68, 0xC2, 0x34, - 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1, - 0x29, 0x02, 0x4E, 0x08, 0x8A, 0x67, 0xCC, 0x74, - 0x02, 0x0B, 0xBE, 0xA6, 0x3B, 0x13, 0x9B, 0x22, - 0x51, 0x4A, 0x08, 0x79, 0x8E, 0x34, 0x04, 0xDD, - 0xEF, 0x95, 0x19, 0xB3, 0xCD, 0x3A, 0x43, 0x1B, - 0x30, 0x2B, 0x0A, 0x6D, 0xF2, 0x5F, 0x14, 0x37, - 0x4F, 0xE1, 0x35, 0x6D, 0x6D, 0x51, 0xC2, 0x45, - 0xE4, 0x85, 0xB5, 0x76, 0x62, 0x5E, 0x7E, 0xC6, - 0xF4, 0x4C, 0x42, 0xE9, 0xA6, 0x37, 0xED, 0x6B, - 0x0B, 0xFF, 0x5C, 0xB6, 0xF4, 0x06, 0xB7, 0xED, - 0xEE, 0x38, 0x6B, 0xFB, 0x5A, 0x89, 0x9F, 0xA5, - 0xAE, 0x9F, 0x24, 0x11, 0x7C, 0x4B, 0x1F, 0xE6, - 0x49, 0x28, 0x66, 0x51, 0xEC, 0xE4, 0x5B, 0x3D, - 0xC2, 0x00, 0x7C, 0xB8, 0xA1, 0x63, 0xBF, 0x05, - 0x98, 0xDA, 0x48, 0x36, 0x1C, 0x55, 0xD3, 0x9A, - 0x69, 0x16, 0x3F, 0xA8, 0xFD, 0x24, 0xCF, 0x5F, - 0x83, 0x65, 0x5D, 0x23, 0xDC, 0xA3, 0xAD, 0x96, - 0x1C, 0x62, 0xF3, 0x56, 0x20, 0x85, 0x52, 0xBB, - 0x9E, 0xD5, 0x29, 0x07, 0x70, 0x96, 0x96, 0x6D, - 0x67, 0x0C, 0x35, 0x4E, 0x4A, 0xBC, 0x98, 0x04, - 0xF1, 0x74, 0x6C, 0x08, 0xCA, 0x23, 0x73, 0x27, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, -}; - -static UINT8 WPS_DH_R_VALUE[193] = -{ - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, -}; - -static UINT8 WPS_DH_X_VALUE[184] = -{ - 0x36, 0xf0, 0x25, 0x5d, 0xde, 0x97, 0x3d, 0xcb, - 0x3b, 0x39, 0x9d, 0x74, 0x7f, 0x23, 0xe3, 0x2e, - 0xd6, 0xfd, 0xb1, 0xf7, 0x75, 0x98, 0x33, 0x8b, - 0xfd, 0xf4, 0x41, 0x59, 0xc4, 0xec, 0x64, 0xdd, - 0xae, 0xb5, 0xf7, 0x86, 0x71, 0xcb, 0xfb, 0x22, - 0x10, 0x6a, 0xe6, 0x4c, 0x32, 0xc5, 0xbc, 0xe4, - 0xcf, 0xd4, 0xf5, 0x92, 0x0d, 0xa0, 0xeb, 0xc8, - 0xb0, 0x1e, 0xca, 0x92, 0x92, 0xae, 0x3d, 0xba, - 0x1b, 0x7a, 0x4a, 0x89, 0x9d, 0xa1, 0x81, 0x39, - 0x0b, 0xb3, 0xbd, 0x16, 0x59, 0xc8, 0x12, 0x94, - 0xf4, 0x00, 0xa3, 0x49, 0x0b, 0xf9, 0x48, 0x12, - 0x11, 0xc7, 0x94, 0x04, 0xa5, 0x76, 0x60, 0x5a, - 0x51, 0x60, 0xdb, 0xee, 0x83, 0xb4, 0xe0, 0x19, - 0xb6, 0xd7, 0x99, 0xae, 0x13, 0x1b, 0xa4, 0xc2, - 0x3d, 0xff, 0x83, 0x47, 0x5e, 0x9c, 0x40, 0xfa, - 0x67, 0x25, 0xb7, 0xc9, 0xe3, 0xaa, 0x2c, 0x65, - 0x96, 0xe9, 0xc0, 0x57, 0x02, 0xdb, 0x30, 0xa0, - 0x7c, 0x9a, 0xa2, 0xdc, 0x23, 0x5c, 0x52, 0x69, - 0xe3, 0x9d, 0x0c, 0xa9, 0xdf, 0x7a, 0xad, 0x44, - 0x61, 0x2a, 0xd6, 0xf8, 0x8f, 0x69, 0x69, 0x92, - 0x98, 0xf3, 0xca, 0xb1, 0xb5, 0x43, 0x67, 0xfb, - 0x0e, 0x8b, 0x93, 0xf7, 0x35, 0xdc, 0x8c, 0xd8, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, -}; - -static UINT8 WPS_DH_RRModP_VALUE[192] = -{ - 0xe3, 0xb3, 0x3c, 0x72, 0x59, 0x54, 0x1c, 0x01, - 0xee, 0x9c, 0x9a, 0x21, 0x6c, 0xc1, 0xeb, 0xd2, - 0xae, 0x59, 0x41, 0x04, 0x79, 0x29, 0xa1, 0xc7, - 0xe9, 0xc3, 0xfa, 0x02, 0xcc, 0x24, 0x56, 0xef, - 0x10, 0x26, 0x30, 0xfa, 0x9a, 0x36, 0xa5, 0x1f, - 0x57, 0xb5, 0x93, 0x48, 0x67, 0x98, 0x44, 0x60, - 0x0b, 0xe4, 0x96, 0x47, 0xa8, 0x7c, 0x7b, 0x37, - 0xf8, 0x05, 0x65, 0x64, 0x96, 0x9b, 0x7f, 0x02, - 0xdc, 0x54, 0x1a, 0x4e, 0xd4, 0x05, 0x3f, 0x54, - 0xd6, 0x2a, 0x0e, 0xea, 0xb2, 0x70, 0x52, 0x1b, - 0x22, 0xc2, 0x96, 0xe9, 0xd4, 0x6f, 0xec, 0x23, - 0x8e, 0x1a, 0xbd, 0x78, 0x02, 0x23, 0xb7, 0x6b, - 0xb8, 0xfe, 0x61, 0x21, 0x19, 0x6b, 0x7e, 0x88, - 0x1c, 0x72, 0x9c, 0x7e, 0x04, 0xb9, 0xf7, 0x96, - 0x07, 0xcd, 0x0a, 0x62, 0x8e, 0x43, 0x41, 0x30, - 0x04, 0xa5, 0x41, 0xff, 0x93, 0xae, 0x1c, 0xeb, - 0xb0, 0x04, 0xa7, 0x50, 0xdb, 0x10, 0x2d, 0x39, - 0xb9, 0x05, 0x2b, 0xb4, 0x7a, 0x58, 0xf1, 0x70, - 0x7e, 0x8c, 0xd2, 0xac, 0x98, 0xb5, 0xfb, 0x62, - 0x8f, 0x23, 0x31, 0xb1, 0x3b, 0x01, 0xe0, 0x18, - 0xf4, 0x66, 0xee, 0x5f, 0xbc, 0xd4, 0x9d, 0x68, - 0xd0, 0xab, 0x92, 0xe1, 0x83, 0x97, 0xf2, 0x45, - 0x8e, 0x0e, 0x3e, 0x21, 0x67, 0x47, 0x8c, 0x73, - 0xf1, 0x15, 0xd2, 0x7d, 0x32, 0xc6, 0x95, 0xe0, -}; - -static UINT8 Value_0[1] = {0x00}; -static UINT8 Value_1[1] = {0x01}; -static PBIG_INTEGER pBI_U = NULL, pBI_S = NULL, pBI_O = NULL; -static UINT Bits_Of_R = 0; - - -VOID BigInteger_Print ( - IN PBIG_INTEGER pBI) -{ - int i = 0, j = 0; - - if ((pBI == NULL) || (pBI->pIntegerArray == NULL)) - return; - - if (strlen(pBI->Name) != 0) - DEBUGPRINT("Name=%s\n", pBI->Name); - DEBUGPRINT("AllocSize=%d, ArrayLength=%d, IntegerLength=%d, Signed=%d\n", pBI->AllocSize, pBI->ArrayLength, pBI->IntegerLength, pBI->Signed); - for (i = (pBI->ArrayLength - 1), j = 0;i >=0;i--,j++) { - DEBUGPRINT("%08x, ", pBI->pIntegerArray[i]); - if ((j%8) == 7) - DEBUGPRINT("\n"); - } /* End od for */ - DEBUGPRINT("\n\n"); -} /* End of BigInteger_Print */ - - -VOID BigInteger_Init ( - INOUT PBIG_INTEGER *pBI) -{ - if (*pBI != NULL) - BigInteger_Free(pBI); - - if ((*pBI = (PBIG_INTEGER) kmalloc(sizeof(BIG_INTEGER), GFP_ATOMIC)) == NULL) { - DEBUGPRINT("BigInteger_Init: allocate %d bytes memory failure.\n", (sizeof(BIG_INTEGER))); - return; - } /* End of if */ - - NdisZeroMemory(*pBI, sizeof(BIG_INTEGER)); - (*pBI)->pIntegerArray = NULL; - (*pBI)->Signed = 1; -} /* End of BigInteger_Init */ - - -VOID BigInteger_Free_AllocSize ( - IN PBIG_INTEGER *pBI) -{ - if ((*pBI != NULL) && ((*pBI)->pIntegerArray != NULL)) { - kfree((*pBI)->pIntegerArray); - NdisZeroMemory(*pBI, sizeof(BIG_INTEGER)); - (*pBI)->pIntegerArray = NULL; - (*pBI)->Signed = 1; - } /* End of if */ -} /* End of BigInteger_Free_AllocSize */ - - -VOID BigInteger_Free ( - IN PBIG_INTEGER *pBI) -{ - if (*pBI != NULL) { - BigInteger_Free_AllocSize(pBI); - kfree(*pBI); - } /* End of if */ - - *pBI = NULL; -} /* End of BigInteger_Free */ - - -VOID BigInteger_AllocSize ( - IN PBIG_INTEGER *pBI, - IN UINT Length) -{ - UINT ArrayLength = 0; - - if (Length == 0) - return; - - if (*pBI == NULL) - BigInteger_Init(pBI); - - /* Caculate array size */ - ArrayLength = Length >> 0x2; - if ((Length & 0x3) != 0) - ArrayLength++; - - if (((*pBI)->pIntegerArray != NULL) && ((*pBI)->AllocSize < (sizeof(UINT32)*ArrayLength))) - BigInteger_Free_AllocSize(pBI); - - if ((*pBI)->pIntegerArray == NULL) { - if (((*pBI)->pIntegerArray = (UINT32 *) kmalloc(sizeof(UINT32)*ArrayLength, GFP_ATOMIC)) == NULL) { - DEBUGPRINT("BigInteger_AllocSize: allocate %d bytes memory failure.\n", (sizeof(UINT32)*ArrayLength)); - return; - } /* End of if */ - (*pBI)->AllocSize = sizeof(UINT32)*ArrayLength; - } /* End of if */ - - NdisZeroMemory((*pBI)->pIntegerArray, (*pBI)->AllocSize); - (*pBI)->ArrayLength = ArrayLength; - (*pBI)->IntegerLength = Length; -} /* End of BigInteger_AllocSize */ - - -VOID BigInteger_ClearHighBits ( - IN PBIG_INTEGER pBI) -{ - INT BIArrayIndex, ShiftIndex = 0; - UINT8 value; - - if ((pBI == NULL) || (pBI->pIntegerArray == NULL)) - return; - - BIArrayIndex = pBI->ArrayLength - 1; - while ((BIArrayIndex >= 0) && (pBI->pIntegerArray[BIArrayIndex] == 0)) - BIArrayIndex--; - - if (BIArrayIndex >= 0) { - value = 0; - ShiftIndex = 4; - while (value == 0) { - ShiftIndex--; - value = UINT32_GETBYTE(pBI->pIntegerArray[BIArrayIndex], ShiftIndex); - } /* End of while */ - } /* End of if */ - - if ((BIArrayIndex == -1) && (ShiftIndex == -1)) { - pBI->IntegerLength = 1; - pBI->ArrayLength = 1; - pBI->Signed = 1; - } else { - pBI->IntegerLength = (BIArrayIndex*4) + ShiftIndex + 1; - pBI->ArrayLength = BIArrayIndex + 1; - } /* End of if */ -} /* End of BigInteger_ClearHighBits */ - - -VOID BigInteger_BI2Bin ( - IN PBIG_INTEGER pBI, - OUT UINT8 *pValue, - OUT UINT *Length) -{ - INT ValueIndex, BIArrayIndex, ShiftIndex; - UINT32 Number; - - if (pBI == NULL) { - DEBUGPRINT("BigInteger_BI2Bin: pBI is NUll\n"); - *Length = 0; - return; - } /* End of if */ - - if (*Length < (sizeof(UINT8) * pBI->IntegerLength)) { - DEBUGPRINT("BigInteger_BI2Bin: length(%d) is not enough.\n", *Length); - *Length = 0; - return; - } /* End of if */ - - if (pBI->pIntegerArray == NULL) { - *Length = 0; - return; - } /* End of if */ - - BigInteger_ClearHighBits(pBI); - if ((ShiftIndex = pBI->IntegerLength & 0x3) == 0) - ShiftIndex = 4; - BIArrayIndex = pBI->ArrayLength - 1; - ValueIndex = 0; - - Number = pBI->pIntegerArray[BIArrayIndex]; - while (ValueIndex < pBI->IntegerLength) - { - pValue[ValueIndex++] = (UINT8) UINT32_GETBYTE(Number, ShiftIndex - 1); - if ((--ShiftIndex) == 0) { - ShiftIndex = 4; - BIArrayIndex--; - Number = pBI->pIntegerArray[BIArrayIndex]; - } /* End of if */ - } /* End of while */ - *Length = pBI->IntegerLength; -} /* End of BigInteger_BI2Bin */ - - -VOID BigInteger_Bin2BI ( - IN UINT8 *pValue, - IN UINT Length, - OUT PBIG_INTEGER *pBI) -{ - INT ValueIndex, BIArrayIndex, ShiftIndex; - UINT32 Number; - - BigInteger_AllocSize(pBI, Length); - - if ((*pBI)->pIntegerArray != NULL) { - Number = 0; - if ((ShiftIndex = Length & 0x3) == 0) - ShiftIndex = 4; - BIArrayIndex = (*pBI)->ArrayLength - 1; - ValueIndex = 0; - while (ValueIndex < Length) - { - Number = (Number << 8) | (UINT8) pValue[ValueIndex++]; - if ((--ShiftIndex) == 0) { - (*pBI)->pIntegerArray[BIArrayIndex] = Number; - ShiftIndex = 4; - BIArrayIndex--; - Number = 0; - } /* End of if */ - } /* End of while */ - } /* End of if */ -} /* End of BigInteger_Bin2BI */ - - -/* Calculate the bits of BigInteger, the highest bit is 1 */ -VOID BigInteger_BitsOfBI ( - IN PBIG_INTEGER pBI, - OUT UINT *Bits_Of_P) -{ - UINT32 Number, Index; - - Number = pBI->pIntegerArray[pBI->ArrayLength - 1]; - Index = 0; - while ((!(Number & 0x80000000)) && (Index < 32)) { - Number <<= 1; - Index++; - } /* End of while */ - *Bits_Of_P = (pBI->ArrayLength*sizeof(UINT32)) - Index; -} /* End of BigInteger_BitsOfBN */ - - -INT BigInteger_GetBitValue ( - IN PBIG_INTEGER pBI, - IN UINT Index) -{ - UINT Array = 0; - UINT Shift = 0; - - if (Index > 0) { - Array = (Index - 1) >> 0x5; - Shift = (Index - 1) & 0x1F; - } - if (Array > pBI->ArrayLength) - return 0; - - return ((pBI->pIntegerArray[Array] >> Shift) & 0x1); -} /* End of BigInteger_GetBitValue */ - - -UINT8 BigInteger_GetByteValue ( - IN PBIG_INTEGER pBI, - IN UINT Index) -{ - UINT Array = 0; - UINT Shift = 0; - - if (Index > 0) { - Array = (Index - 1) >> 0x2; - Shift = (Index - 1) & 0x3; - } - if ((Array > pBI->ArrayLength) || (Index > pBI->IntegerLength)) - return 0; - - - return (UINT8) UINT32_GETBYTE(pBI->pIntegerArray[Array], Shift - 1); -} /* End of BigInteger_GetByteValue */ - - -VOID BigInteger_Copy ( - IN PBIG_INTEGER pBI_Copied, - OUT PBIG_INTEGER *pBI_Result) -{ - BigInteger_AllocSize(pBI_Result, pBI_Copied->IntegerLength); - NdisCopyMemory((*pBI_Result)->pIntegerArray, pBI_Copied->pIntegerArray, (sizeof(UINT32)*(*pBI_Result)->ArrayLength)); - (*pBI_Result)->ArrayLength = pBI_Copied->ArrayLength; - (*pBI_Result)->IntegerLength = pBI_Copied->IntegerLength; - (*pBI_Result)->Signed = pBI_Copied->Signed; -} /* End of BigInteger_Copy */ - - -INT BigInteger_UnsignedCompare ( - IN PBIG_INTEGER pFirstOperand, - IN PBIG_INTEGER pSecondOperand) -{ - INT BIArrayIndex; - - if (pFirstOperand->IntegerLength > pSecondOperand->IntegerLength) - return 1; - - if (pFirstOperand->IntegerLength < pSecondOperand->IntegerLength) - return -1; - - if (pFirstOperand->IntegerLength == pSecondOperand->IntegerLength) { - for(BIArrayIndex = (pFirstOperand->ArrayLength - 1);BIArrayIndex >= 0 ; BIArrayIndex--) - { - if (pFirstOperand->pIntegerArray[BIArrayIndex] > pSecondOperand->pIntegerArray[BIArrayIndex]) - return 1; - else if (pFirstOperand->pIntegerArray[BIArrayIndex] < pSecondOperand->pIntegerArray[BIArrayIndex]) - return -1; - } /* End of for */ - } /* End of if */ - - return 0; -} /* End of BigInteger_Compare */ - - -VOID BigInteger_Add ( - IN PBIG_INTEGER pFirstOperand, - IN PBIG_INTEGER pSecondOperand, - OUT PBIG_INTEGER *pBI_Result) -{ - INT CompareResult; - UINT32 BIArrayIndex; - UINT64 Sum, Carry; - PBIG_INTEGER pTempBI = NULL; - - if ((pFirstOperand == NULL) || (pFirstOperand->pIntegerArray == NULL) - || (pSecondOperand == NULL) || (pSecondOperand->pIntegerArray == NULL)) { - DEBUGPRINT("BigInteger_Add: first or second operand is NULL.\n"); - return; - } /* End of if */ - - if (*pBI_Result == NULL) - BigInteger_Init(pBI_Result); - - CompareResult = BigInteger_UnsignedCompare(pFirstOperand, pSecondOperand); - if ((CompareResult == 0) & ((pFirstOperand->Signed * pSecondOperand->Signed) < 0)) { - BigInteger_AllocSize(pBI_Result, 1); - return ; - } /* End of if */ - - /* - * Singed table - * A + B || A > B || A < B - * ------------------------ - * + + || + || + - * + - || + || - - * - + || - || + - * - - || - || - - */ - if ((pFirstOperand->Signed * pSecondOperand->Signed) > 0) { - if (pFirstOperand->IntegerLength > pSecondOperand->IntegerLength) { - BigInteger_AllocSize(pBI_Result, pFirstOperand->IntegerLength + 1); - } else { - BigInteger_AllocSize(pBI_Result, pSecondOperand->IntegerLength + 1); - } /* End of if */ - - Carry = 0; - for (BIArrayIndex=0; BIArrayIndex < (*pBI_Result)->ArrayLength; BIArrayIndex++) - { - - Sum = 0; - if (BIArrayIndex < pFirstOperand->ArrayLength) - Sum += (UINT64) pFirstOperand->pIntegerArray[BIArrayIndex]; - - if (BIArrayIndex < pSecondOperand->ArrayLength) - Sum += (UINT64) pSecondOperand->pIntegerArray[BIArrayIndex]; - - Sum += Carry; - Carry = Sum >> 32; - (*pBI_Result)->pIntegerArray[BIArrayIndex] = (UINT32) (Sum & 0xffffffffUL); - } /* End of for */ - (*pBI_Result)->Signed = pFirstOperand->Signed; - BigInteger_ClearHighBits(*pBI_Result); - } else { - if ((pFirstOperand->Signed == 1) & (pSecondOperand->Signed == -1)) { - BigInteger_Copy(pSecondOperand, &pTempBI); - pTempBI->Signed = 1; - BigInteger_Sub(pFirstOperand, pTempBI, pBI_Result); - } else if ((pFirstOperand->Signed == -1) & (pSecondOperand->Signed == 1)) { - BigInteger_Copy(pFirstOperand, &pTempBI); - pTempBI->Signed = 1; - BigInteger_Sub(pSecondOperand, pTempBI, pBI_Result); - } /* End of if */ - } /* End of if */ - - BigInteger_Free(&pTempBI); -} /* End of BigInteger_Add */ - - -VOID BigInteger_Sub ( - IN PBIG_INTEGER pFirstOperand, - IN PBIG_INTEGER pSecondOperand, - OUT PBIG_INTEGER *pBI_Result) -{ - INT CompareResult; - UINT32 BIArrayIndex, Carry; - PBIG_INTEGER pTempBI = NULL, pTempBI2 = NULL; - - if ((pFirstOperand == NULL) || (pFirstOperand->pIntegerArray == NULL) - || (pSecondOperand == NULL) || (pSecondOperand->pIntegerArray == NULL)) { - DEBUGPRINT("BigInteger_Sub: first or second operand is NULL.\n"); - return; - } /* End of if */ - - if (*pBI_Result == NULL) - BigInteger_Init(pBI_Result); - - CompareResult = BigInteger_UnsignedCompare(pFirstOperand, pSecondOperand); - if ((CompareResult == 0) & ((pFirstOperand->Signed * pSecondOperand->Signed) > 0)) { - BigInteger_AllocSize(pBI_Result, 1); - return ; - } /* End of if */ - - BigInteger_Init(&pTempBI); - BigInteger_Init(&pTempBI2); - - /* - * Singed table - * A - B || A > B || A < B - * ------------------------ - * + + || + || - - * + - || + || + - * - + || - || - - * - - || - || + - */ - if ((pFirstOperand->Signed * pSecondOperand->Signed) > 0) { - if (CompareResult == 1) { - BigInteger_Copy(pFirstOperand, &pTempBI); - BigInteger_Copy(pSecondOperand, &pTempBI2); - } else if (CompareResult == -1) { - BigInteger_Copy(pSecondOperand, &pTempBI); - BigInteger_Copy(pFirstOperand, &pTempBI2); - } /* End of if */ - - BigInteger_Copy(pTempBI, pBI_Result); - Carry = 0; - for (BIArrayIndex=0; BIArrayIndex < (*pBI_Result)->ArrayLength; BIArrayIndex++) - { - if (BIArrayIndex < pTempBI2->ArrayLength) { - if ((*pBI_Result)->pIntegerArray[BIArrayIndex] >= (pTempBI2->pIntegerArray[BIArrayIndex] - Carry)) { - (*pBI_Result)->pIntegerArray[BIArrayIndex] = (*pBI_Result)->pIntegerArray[BIArrayIndex] - pTempBI2->pIntegerArray[BIArrayIndex] - Carry; - Carry = 0; - } else { - (*pBI_Result)->pIntegerArray[BIArrayIndex] = 0xffffffffUL - pTempBI2->pIntegerArray[BIArrayIndex] - Carry + (*pBI_Result)->pIntegerArray[BIArrayIndex] + 1; - Carry = 1; - } /* End of if */ - } else { - if ((*pBI_Result)->pIntegerArray[BIArrayIndex] >= Carry) { - (*pBI_Result)->pIntegerArray[BIArrayIndex] -= Carry; - Carry = 0; - } else { - (*pBI_Result)->pIntegerArray[BIArrayIndex] = 0xffffffffUL - Carry; - Carry = 1; - } /* End of if */ - } /* End of if */ - } /* End of for */ - - if (((pFirstOperand->Signed == 1) & (pSecondOperand->Signed == 1) & (CompareResult == -1)) - || ((pFirstOperand->Signed == -1) & (pSecondOperand->Signed == -1) & (CompareResult == 1))) - (*pBI_Result)->Signed = -1; - - BigInteger_ClearHighBits(*pBI_Result); - } else { - if ((pFirstOperand->Signed == 1) & (pSecondOperand->Signed == -1)) { - BigInteger_Copy(pSecondOperand, &pTempBI); - pTempBI->Signed = 1; - BigInteger_Add(pFirstOperand, pTempBI, pBI_Result); - } else if ((pFirstOperand->Signed == -1) & (pSecondOperand->Signed == 1)) { - BigInteger_Copy(pFirstOperand, &pTempBI); - pTempBI->Signed = 1; - BigInteger_Add(pTempBI, pSecondOperand, pBI_Result); - (*pBI_Result)->Signed = -1; - } /* End of if */ - } /* End of if */ - - BigInteger_Free(&pTempBI); - BigInteger_Free(&pTempBI2); -} /* End of BigInteger_Sub */ - - -VOID BigInteger_Mul ( - IN PBIG_INTEGER pFirstOperand, - IN PBIG_INTEGER pSecondOperand, - OUT PBIG_INTEGER *pBI_Result) -{ - - UINT32 BIFirstIndex, BISecondIndex; - UINT64 FirstValue, SecondValue, Sum, Carry; - - if ((pFirstOperand == NULL) || (pFirstOperand->pIntegerArray == NULL) - || (pSecondOperand == NULL) || (pSecondOperand->pIntegerArray == NULL)) { - DEBUGPRINT("BigInteger_Mul: first or second operand is NULL.\n"); - return; - } /* End of if */ - - /* The first or second operand is zero */ - if (((pFirstOperand->IntegerLength == 1) && (pFirstOperand->pIntegerArray[0] == 0)) - ||((pSecondOperand->IntegerLength == 1) && (pSecondOperand->pIntegerArray[0] == 0))) { - BigInteger_AllocSize(pBI_Result, 1); - goto output; - } /* End of if */ - - /* The first or second operand is one */ - if ((pFirstOperand->IntegerLength == 1) && (pFirstOperand->pIntegerArray[0] == 1)) { - BigInteger_Copy(pSecondOperand, pBI_Result); - goto output; - } /* End of if */ - if ((pSecondOperand->IntegerLength == 1) && (pSecondOperand->pIntegerArray[0] == 1)) { - BigInteger_Copy(pFirstOperand, pBI_Result); - goto output; - } /* End of if */ - - BigInteger_AllocSize(pBI_Result, pFirstOperand->IntegerLength + pSecondOperand->IntegerLength); - - for (BIFirstIndex=0; BIFirstIndex < pFirstOperand->ArrayLength; BIFirstIndex++) - { - Carry = 0; - FirstValue = (UINT64) pFirstOperand->pIntegerArray[BIFirstIndex]; - if (FirstValue == 0) { - continue; - } else { - for (BISecondIndex=0; BISecondIndex < pSecondOperand->ArrayLength; BISecondIndex++) - { - SecondValue = ((UINT64) pSecondOperand->pIntegerArray[BISecondIndex])*FirstValue; - Sum = (UINT64) ((*pBI_Result)->pIntegerArray[BIFirstIndex + BISecondIndex] + SecondValue + Carry); - Carry = Sum >> 32; - (*pBI_Result)->pIntegerArray[BIFirstIndex + BISecondIndex] = (UINT32) (Sum & 0xffffffffUL); - } /* End of for */ - while (Carry != 0) { - Sum = (UINT64) (*pBI_Result)->pIntegerArray[BIFirstIndex + BISecondIndex]; - Sum += Carry; - - Carry = Sum >> 32; - (*pBI_Result)->pIntegerArray[BIFirstIndex + BISecondIndex] = (UINT32) (Sum & 0xffffffffUL); - BISecondIndex++; - } /* End of while */ - } /* End of if */ - } /* End of for */ - -output: - (*pBI_Result)->Signed = pFirstOperand->Signed * pSecondOperand->Signed; - BigInteger_ClearHighBits(*pBI_Result); -} /* End of BigInteger_Mul */ - - -VOID BigInteger_Square ( - IN PBIG_INTEGER pBI, - OUT PBIG_INTEGER *pBI_Result) -{ - INT BIFirstIndex, BISecondIndex; - UINT32 HBITS_Value, LBITS_Value, Temp1_Value, Temp2_Value, Carry32; - UINT32 *Point_Of_S, *Point_Of_Result, *Point_Of_BI; - UINT64 Result64_1, Result64_2, Carry64, TempValue64; - - if ((pBI == NULL) || (pBI->pIntegerArray == NULL)) { - DEBUGPRINT("\tBigInteger_Square: the operand is NULL.\n"); - return; - } /* End of if */ - - /* The operand is zero */ - if ((pBI->IntegerLength == 1) && (pBI->pIntegerArray[0] == 0)) { - BigInteger_AllocSize(pBI_Result, 1); - goto output; - } /* End of if */ - - BigInteger_AllocSize(pBI_Result, (pBI->IntegerLength*2) + 20); - BigInteger_AllocSize(&pBI_S, (pBI->IntegerLength*2) + 20); - BigInteger_AllocSize(&pBI_O, (pBI->IntegerLength*2) + 20); - - /* - * Input: pBI = {a_0, a_1, a_2, a_3, ..., a_n} - * Step1. calculate a_0^2, a_1^2, a_2^2, a_3^2 ... a_n^2 - */ - Point_Of_S = pBI_S->pIntegerArray; - for (BIFirstIndex=0; BIFirstIndex < pBI->ArrayLength; BIFirstIndex++) - { - HBITS_Value = UINT32_HBITS(pBI->pIntegerArray[BIFirstIndex]); - LBITS_Value = UINT32_LBITS(pBI->pIntegerArray[BIFirstIndex]); - Temp1_Value = HBITS_Value*LBITS_Value; - Temp2_Value = (Temp1_Value & 0x7fff) << 0x11; - Point_Of_S[0] = (LBITS_Value*LBITS_Value) + Temp2_Value; - Point_Of_S[1] = (HBITS_Value*HBITS_Value) + ((Temp1_Value >> 0xf) & 0x1ffff); - if (Point_Of_S[0] < Temp2_Value) - Point_Of_S[1] += 1; - - Point_Of_S += 2; - } /* End of for */ - - /* - * Step2. calculate a_0*{a_1, a_2, a_3, a_4, ..., a_n} - */ - Point_Of_BI = pBI->pIntegerArray; - Point_Of_Result = (*pBI_Result)->pIntegerArray; - Point_Of_Result[0] = 0; - TempValue64 = (UINT64) Point_Of_BI[0]; - Point_Of_Result++; - Carry64 = 0; - for (BIFirstIndex=1; BIFirstIndex < pBI->ArrayLength; BIFirstIndex++) - { - Result64_1 = (UINT64) Point_Of_BI[BIFirstIndex]*TempValue64; - Result64_1 += Carry64; - Carry64 = (Result64_1 >> 32); - Point_Of_Result[0] = (UINT32) (Result64_1 & 0xffffffffUL); - Point_Of_Result++; - } /* End of for */ - if (Carry64 > 0) - Point_Of_Result[0] = (UINT32) (Carry64 & 0xffffffffUL); - - /* - * Step3. calculate - * a_1*{a_2, a_3, a_4, ..., a_n} - * a_2*{a_3, a_4, a_5, ..., a_n} - * a_3*{a_4, a_5, a_6, ..., a_n} - * a_4*{a_5, a_6, a_7, ..., a_n} - * ... - * a_n-1*{a_n} - */ - Point_Of_BI = pBI->pIntegerArray; - for (BIFirstIndex=1; BIFirstIndex < (pBI->ArrayLength - 1); BIFirstIndex++) - { - Point_Of_Result = (*pBI_Result)->pIntegerArray; - Point_Of_Result += (BIFirstIndex*2) + 1; - TempValue64 = (UINT64) Point_Of_BI[BIFirstIndex]; - Carry64 = 0; - for (BISecondIndex=(BIFirstIndex + 1); BISecondIndex < pBI->ArrayLength; BISecondIndex++) - { - Result64_1 = ((UINT64) Point_Of_Result[0]) + Carry64; - Result64_2 = (UINT64) Point_Of_BI[BISecondIndex]*TempValue64; - Carry64 = (Result64_1 >> 32); - Result64_1 = (Result64_1 & 0xffffffffUL); - Result64_1 = Result64_1 + Result64_2; - Carry64 += (Result64_1 >> 32); - Point_Of_Result[0] = (UINT32) (Result64_1 & 0xffffffffUL); - Point_Of_Result++; - } /* End of for */ - if (Carry64 > 0) - Point_Of_Result[0] += (UINT32) (Carry64 & 0xffffffffUL); - } /* End of for */ - - BigInteger_ClearHighBits(*pBI_Result); - BigInteger_Copy(*pBI_Result, &pBI_O); - - Carry32 = 0; - for (BIFirstIndex=0; BIFirstIndex < pBI_O->ArrayLength; BIFirstIndex++) { - pBI_O->pIntegerArray[BIFirstIndex] = (pBI_O->pIntegerArray[BIFirstIndex] << 1) | Carry32; - if (pBI_O->pIntegerArray[BIFirstIndex] < (*pBI_Result)->pIntegerArray[BIFirstIndex]) - Carry32 = 1; - else - Carry32 = 0; - } /* End of for */ - pBI_O->pIntegerArray[BIFirstIndex] = Carry32; - pBI_O->IntegerLength++; - pBI_O->ArrayLength++; - BigInteger_ClearHighBits(pBI_O); - - BigInteger_Add(pBI_O, pBI_S, pBI_Result); -output: - (*pBI_Result)->Signed = 1; - BigInteger_ClearHighBits(*pBI_Result); -} /* End of BigInteger_Square */ - - -VOID BigInteger_Div ( - IN PBIG_INTEGER pFirstOperand, - IN PBIG_INTEGER pSecondOperand, - OUT PBIG_INTEGER *pBI_Result, - OUT PBIG_INTEGER *pBI_Remainder) -{ - INT CompareResult; - INT Index, MulIndex, ComputeSize; - UINT32 MulStart; - UINT AllocLength, ArrayIndex, ShiftIndex; - PBIG_INTEGER pTempBI = NULL, pTempBI2 = NULL, pMulBI = NULL; - UINT8 SecondHighByte; - - if ((pFirstOperand == NULL) || (pFirstOperand->pIntegerArray == NULL) - || (pSecondOperand == NULL) || (pSecondOperand->pIntegerArray == NULL)) { - DEBUGPRINT("BigInteger_Div: first or second operand is NULL.\n"); - return; - } /* End of if */ - - /* The second operand is zero */ - if ((pSecondOperand->IntegerLength == 1) && (pSecondOperand->pIntegerArray[0] == 0)) { - DEBUGPRINT("BigInteger_Div: second operand is zero.\n"); - return; - } /* End of if */ - - if (*pBI_Result == NULL) - BigInteger_Init(pBI_Result); - if (*pBI_Remainder == NULL) - BigInteger_Init(pBI_Remainder); - - /* The second operand is one */ - if ((pSecondOperand->IntegerLength == 1) && (pSecondOperand->pIntegerArray[0] == 1)) { - BigInteger_Copy(pFirstOperand, pBI_Result); - BigInteger_Bin2BI(Value_0, 1, pBI_Remainder); - goto output; - } /* End of if */ - - CompareResult = BigInteger_UnsignedCompare(pFirstOperand, pSecondOperand); - if (CompareResult == 0) { - BigInteger_Bin2BI(Value_1, 1, pBI_Result); - BigInteger_Bin2BI(Value_0, 1, pBI_Remainder); - goto output; - } else if (CompareResult == -1) { - BigInteger_Bin2BI(Value_0, 1, pBI_Result); - BigInteger_Copy(pFirstOperand, pBI_Remainder); - goto output; - } /* End of if */ - BigInteger_AllocSize(pBI_Result, pFirstOperand->IntegerLength - pSecondOperand->IntegerLength + 1); - BigInteger_AllocSize(pBI_Remainder, pSecondOperand->IntegerLength); - - AllocLength = (UINT) (pFirstOperand->IntegerLength << 1); - BigInteger_AllocSize(&pTempBI, AllocLength); - BigInteger_AllocSize(&pTempBI2, AllocLength); - BigInteger_AllocSize(&pMulBI, AllocLength); - - BigInteger_Copy(pFirstOperand, pBI_Remainder); - SecondHighByte = BigInteger_GetByteValue(pSecondOperand, pSecondOperand->IntegerLength); - ComputeSize = (INT) pFirstOperand->IntegerLength - pSecondOperand->IntegerLength + 1; - for (Index = (INT) ComputeSize;Index >= 0;Index--) { - if (BigInteger_UnsignedCompare(*pBI_Remainder, pSecondOperand) == -1) - break; - - if (((pSecondOperand->IntegerLength + Index) - (*pBI_Remainder)->IntegerLength) <= 1) { - BigInteger_AllocSize(&pMulBI, Index + 1); - ArrayIndex = 0; - if (Index > 0) - ArrayIndex = (UINT) (Index - 1) >> 2 ; - ShiftIndex = (Index & 0x03); - if (ShiftIndex == 0) - ShiftIndex = 4; - ShiftIndex--; - MulStart = 0; - MulStart = (BigInteger_GetByteValue((*pBI_Remainder), pFirstOperand->IntegerLength + Index - ComputeSize + 1) & 0xFF) << 8; - MulStart = MulStart | (BigInteger_GetByteValue((*pBI_Remainder), pFirstOperand->IntegerLength + Index - ComputeSize) & 0xFF); - if (MulStart < (UINT32) SecondHighByte) - continue; - - MulStart = MulStart / (UINT32) SecondHighByte; - - if (MulStart > 0xFF) - MulStart = 0x100; - - for (MulIndex = (INT) MulStart;MulIndex <= 0x101;MulIndex++) { /* 0xFFFF / 0xFF = 0x101 */ - if ((MulIndex > 0xFF) && (ShiftIndex == 3)) - pMulBI->pIntegerArray[ArrayIndex + 1] = 0x01; - pMulBI->pIntegerArray[ArrayIndex] = ((UINT) MulIndex << (8*ShiftIndex)); - BigInteger_Mul(pSecondOperand, pMulBI , &pTempBI); - CompareResult = BigInteger_UnsignedCompare(*pBI_Remainder, pTempBI); - if (CompareResult < 1) { - if (MulIndex > 1) { - if (CompareResult != 0) { - if ((MulIndex == 0x100) && (ShiftIndex == 3)) - pMulBI->pIntegerArray[ArrayIndex + 1] = 0; - pMulBI->pIntegerArray[ArrayIndex] = ((UINT) (MulIndex - 1) << (8*ShiftIndex)); - } /* End of if */ - - BigInteger_Mul(pSecondOperand, pMulBI, &pTempBI); - BigInteger_Sub(*pBI_Remainder, pTempBI, &pTempBI2); - BigInteger_Copy(pTempBI2, pBI_Remainder); - BigInteger_Add(*pBI_Result, pMulBI, &pTempBI2); - BigInteger_Copy(pTempBI2, pBI_Result); - } /* End of if */ - break; - } /* End of if */ - - if ((MulIndex >= 0x100) && (ShiftIndex == 3)) - pMulBI->pIntegerArray[ArrayIndex++] = 0; - pMulBI->pIntegerArray[ArrayIndex] = 0; - } /* End of for */ - } /* End of if */ - } /* End of for */ - - BigInteger_Free(&pTempBI); - BigInteger_Free(&pTempBI2); - BigInteger_Free(&pMulBI); -output: - (*pBI_Result)->Signed = pFirstOperand->Signed * pSecondOperand->Signed; - (*pBI_Remainder)->Signed = pFirstOperand->Signed * pSecondOperand->Signed; - BigInteger_ClearHighBits(*pBI_Result); - BigInteger_ClearHighBits(*pBI_Remainder); -} /* End of BigInteger_Div */ - - -VOID BigInteger_Montgomery_Reduction ( - IN PBIG_INTEGER pBI_A, - IN PBIG_INTEGER pBI_P, - IN PBIG_INTEGER pBI_R, - OUT PBIG_INTEGER *pBI_Result) -{ - UINT32 *Point_P, *Point_Result; - UINT32 LoopCount; - UINT64 Result64_1, Result64_2, Carry64, TempValue64; - INT FirstLoop, SecondLoop; - - BigInteger_AllocSize(pBI_Result, pBI_A->IntegerLength+ pBI_P->IntegerLength + 20); - BigInteger_Copy(pBI_A, pBI_Result); - - Point_P = pBI_P->pIntegerArray; - Point_Result = (*pBI_Result)->pIntegerArray; - - LoopCount = Bits_Of_R >> 0x5; - for (FirstLoop = 0;FirstLoop < LoopCount;FirstLoop++) { - Carry64 = 0; - TempValue64 = (UINT64) Point_Result[0]; - for (SecondLoop = 0;SecondLoop < pBI_P->ArrayLength;SecondLoop++) { - Result64_1 = ((UINT64) Point_Result[SecondLoop]) + Carry64; - Result64_2 = (UINT64) Point_P[SecondLoop]*TempValue64; - Carry64 = (Result64_1 >> 32); - Result64_1 = (Result64_1 & 0xffffffffUL); - Result64_1 = Result64_1 + Result64_2; - Carry64 += (Result64_1 >> 32); - Point_Result[SecondLoop] = (UINT32) (Result64_1 & 0xffffffffUL); - } /* End of for */ - while (Carry64 != 0) { - Result64_1 = ((UINT64) Point_Result[SecondLoop]) + Carry64; - Carry64 = Result64_1 >> 32; - Point_Result[SecondLoop] = (UINT32) (Result64_1 & 0xffffffffUL); - SecondLoop++; - } /* End of while */ - Point_Result++; - } /* End of for */ - - for (FirstLoop = 0;FirstLoop <= LoopCount;FirstLoop++) { - (*pBI_Result)->pIntegerArray[FirstLoop] = (*pBI_Result)->pIntegerArray[FirstLoop + LoopCount]; - } /* End of for */ - if ((*pBI_Result)->pIntegerArray[LoopCount] != 0) - (*pBI_Result)->ArrayLength = LoopCount + 1; - else - (*pBI_Result)->ArrayLength = LoopCount; - - (*pBI_Result)->IntegerLength = (*pBI_Result)->ArrayLength*4; - BigInteger_ClearHighBits(*pBI_Result); - - if (BigInteger_UnsignedCompare(*pBI_Result, pBI_P) >= 0) { - BigInteger_Sub(*pBI_Result, pBI_P, &pBI_U); - BigInteger_Copy(pBI_U, pBI_Result); - } /* End of if */ - BigInteger_ClearHighBits(*pBI_Result); -} /* End of BigInteger_Montgomery_Reduction */ - - -VOID BigInteger_Montgomery_ExpMod ( - IN PBIG_INTEGER pBI_G, - IN PBIG_INTEGER pBI_E, - IN PBIG_INTEGER pBI_P, - OUT PBIG_INTEGER *pBI_Result) -{ - UINT Bits_Of_P; - UINT32 Index, Index2, AllocLength; - UINT32 Sliding_Value , Sliding_HighValue, Sliding_LowValue; - PBIG_INTEGER pBI_Temp1 = NULL, pBI_Temp2 = NULL; - PBIG_INTEGER pBI_X = NULL, pBI_R = NULL, pBI_RR = NULL, pBI_1 = NULL; - BIG_INTEGER *pBI_A[SLIDING_WINDOW]; - UINT8 *pRValue = NULL; - - AllocLength = (pBI_G->IntegerLength + pBI_E->IntegerLength + pBI_P->IntegerLength + 300); - BigInteger_AllocSize(&pBI_Temp1, AllocLength); - BigInteger_AllocSize(&pBI_Temp2, AllocLength); - - /* Calculate the bits of P and E, the highest bit is 1 */ - BigInteger_BitsOfBI(pBI_P, &Bits_Of_P); - - if ((pBI_E->IntegerLength == 1) && (pBI_E->pIntegerArray[0] == 1)) { - BigInteger_Div(pBI_G, pBI_P, &pBI_Temp1, pBI_Result); - goto memory_free; - } /* End of if */ - - if ((pBI_E->IntegerLength == 1) && (pBI_E->pIntegerArray[0] == 2)) { - BigInteger_Mul(pBI_G, pBI_G, &pBI_Temp1); - BigInteger_Div(pBI_Temp1, pBI_P, &pBI_Temp2, pBI_Result); - goto memory_free; - } /* End of if */ - - /* - * Main algorithm - */ - BigInteger_Init(&pBI_R); - BigInteger_Init(&pBI_RR); - BigInteger_Bin2BI(Value_1, 1, &pBI_1); - BigInteger_AllocSize(&pBI_X, AllocLength); - BigInteger_AllocSize(&pBI_U, AllocLength); // for BigInteger_Montgomery_Reduction - BigInteger_AllocSize(&pBI_S, AllocLength); // for BigInteger_Square - BigInteger_AllocSize(&pBI_O, AllocLength); // for BigInteger_Square - - for (Index = 0; Index < SLIDING_WINDOW; Index++) { - pBI_A[Index] = NULL; - BigInteger_AllocSize(&pBI_A[Index], 193); - } /* End of for */ - BigInteger_Bin2BI(WPS_DH_P_VALUE, 192, &pBI_Temp1); - if (NdisCmpMemory(pBI_P->pIntegerArray, pBI_Temp1->pIntegerArray, pBI_P->IntegerLength) == 0) { - BigInteger_Bin2BI(WPS_DH_X_VALUE, 184, &pBI_X); - BigInteger_Bin2BI(WPS_DH_R_VALUE, 193, &pBI_R); - BigInteger_Bin2BI(WPS_DH_RRModP_VALUE, 192, &pBI_RR); - Bits_Of_R = 1537; - } else { - if ((Bits_Of_P % 8) == 0) { - AllocLength = pBI_P->IntegerLength + 1; - } else { - AllocLength = pBI_P->IntegerLength; - } /* End of if */ - pRValue = (UINT8 *) kmalloc(sizeof(UINT8)*AllocLength, GFP_ATOMIC); - if (pRValue == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s():Alloc memory failed\n", __FUNCTION__)); - goto memory_free; - } - NdisZeroMemory(pRValue, sizeof(UINT8)*AllocLength); - pRValue[0] = (UINT8) (1 << (Bits_Of_P & 0x7)); - BigInteger_Bin2BI(pRValue, AllocLength , &pBI_R); - - BigInteger_Mul(pBI_R, pBI_R, &pBI_Temp1); - BigInteger_Div(pBI_Temp1, pBI_P, &pBI_A[1], &pBI_RR); - - /* X = 1*R (mod P) */ - BigInteger_Div(pBI_R, pBI_P, &pBI_Temp2, &pBI_X); - } /* End of if */ - - /* A = G*R (mod P) => A = MonMod(G, R^2 mod P) */ - BigInteger_Mul(pBI_G, pBI_RR, &pBI_Temp1); - BigInteger_Montgomery_Reduction(pBI_Temp1, pBI_P , pBI_R, &pBI_A[1]); - for (Index = 2; Index < SLIDING_WINDOW; Index++) { - BigInteger_Mul(pBI_A[Index - 1], pBI_A[1], &pBI_Temp1); - BigInteger_Montgomery_Reduction(pBI_Temp1, pBI_P, pBI_R, &pBI_A[Index]); - } /* End of for */ - - for (Index = pBI_E->IntegerLength ; Index > 0 ; Index--) { - for (Index2 = 0; Index2 < 4 ; Index2++) { - BigInteger_Square(pBI_X, &pBI_Temp1); - BigInteger_Montgomery_Reduction(pBI_Temp1, pBI_P, pBI_R, &pBI_X); - } /* End of for */ - - Sliding_Value = BigInteger_GetByteValue(pBI_E, Index); - Sliding_HighValue = (Sliding_Value >> 4); - if (Sliding_HighValue != 0) { - BigInteger_Mul(pBI_A[Sliding_HighValue], pBI_X, &pBI_Temp1); - BigInteger_Montgomery_Reduction(pBI_Temp1, pBI_P, pBI_R, &pBI_X); - } /* End of if */ - - for (Index2 = 0; Index2 < 4 ; Index2++) { - BigInteger_Square(pBI_X, &pBI_Temp1); - BigInteger_Montgomery_Reduction(pBI_Temp1, pBI_P, pBI_R, &pBI_X); - } /* End of for */ - - Sliding_LowValue = Sliding_Value & 0x0f; - if (Sliding_LowValue != 0) { - BigInteger_Mul(pBI_A[Sliding_LowValue], pBI_X, &pBI_Temp1); - BigInteger_Montgomery_Reduction(pBI_Temp1, pBI_P, pBI_R, &pBI_X); - } /* End of if */ - } /* End of for */ - BigInteger_Montgomery_Reduction(pBI_X, pBI_P , pBI_R, pBI_Result); - - BigInteger_Free(&pBI_X); - BigInteger_Free(&pBI_R); - BigInteger_Free(&pBI_RR); - BigInteger_Free(&pBI_1); - BigInteger_Free(&pBI_U); - BigInteger_Free(&pBI_S); - BigInteger_Free(&pBI_O); - for(Index = 0; Index < SLIDING_WINDOW; Index++) - BigInteger_Free(&pBI_A[Index]); - if (pRValue != NULL) - kfree(pRValue); - -memory_free: - BigInteger_Free(&pBI_Temp1); - BigInteger_Free(&pBI_Temp2); -} /* End of BigInteger_Montgomery_ExpMod */ - -/* End of crypt_biginteger.c */ diff --git a/drivers/staging/rt3090/common/crypt_dh.c b/drivers/staging/rt3090/common/crypt_dh.c deleted file mode 100644 index 0f69f2af9038..000000000000 --- a/drivers/staging/rt3090/common/crypt_dh.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - crypt_dh.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Eddy 2009/01/19 Create AES-128, AES-192, AES-256, AES-CBC -*/ - -#include "crypt_dh.h" -#include "crypt_biginteger.h" - -/* -======================================================================== -Routine Description: - Diffie-Hellman public key generation - -Arguments: - GValue Array in UINT8 - GValueLength The length of G in bytes - PValue Array in UINT8 - PValueLength The length of P in bytes - PrivateKey Private key - PrivateKeyLength The length of Private key in bytes - -Return Value: - PublicKey Public key - PublicKeyLength The length of public key in bytes - -Note: - Reference to RFC2631 - PublicKey = G^PrivateKey (mod P) -======================================================================== -*/ -void DH_PublicKey_Generate ( - IN UINT8 GValue[], - IN UINT GValueLength, - IN UINT8 PValue[], - IN UINT PValueLength, - IN UINT8 PrivateKey[], - IN UINT PrivateKeyLength, - OUT UINT8 PublicKey[], - INOUT UINT *PublicKeyLength) -{ - PBIG_INTEGER pBI_G = NULL; - PBIG_INTEGER pBI_P = NULL; - PBIG_INTEGER pBI_PrivateKey = NULL; - PBIG_INTEGER pBI_PublicKey = NULL; - - /* - * 1. Check the input parameters - * - GValueLength, PValueLength and PrivateLength must be large than zero - * - PublicKeyLength must be large or equal than PValueLength - * - PValue must be odd - * - * - PValue must be prime number (no implement) - * - GValue must be greater than 0 but less than the PValue (no implement) - */ - if (GValueLength == 0) { - DBGPRINT(RT_DEBUG_ERROR, ("DH_PublicKey_Generate: G length is (%d)\n", GValueLength)); - return; - } /* End of if */ - if (PValueLength == 0) { - DBGPRINT(RT_DEBUG_ERROR, ("DH_PublicKey_Generate: P length is (%d)\n", PValueLength)); - return; - } /* End of if */ - if (PrivateKeyLength == 0) { - DBGPRINT(RT_DEBUG_ERROR, ("DH_PublicKey_Generate: private key length is (%d)\n", PrivateKeyLength)); - return; - } /* End of if */ - if (*PublicKeyLength < PValueLength) { - DBGPRINT(RT_DEBUG_ERROR, ("DH_PublicKey_Generate: public key length(%d) must be large or equal than P length(%d)\n", - *PublicKeyLength, PValueLength)); - return; - } /* End of if */ - if (!(PValue[PValueLength - 1] & 0x1)) { - DBGPRINT(RT_DEBUG_ERROR, ("DH_PublicKey_Generate: P value must be odd\n")); - return; - } /* End of if */ - - /* - * 2. Transfer parameters to BigInteger structure - */ - BigInteger_Init(&pBI_G); - BigInteger_Init(&pBI_P); - BigInteger_Init(&pBI_PrivateKey); - BigInteger_Init(&pBI_PublicKey); - BigInteger_Bin2BI(GValue, GValueLength, &pBI_G); - BigInteger_Bin2BI(PValue, PValueLength, &pBI_P); - BigInteger_Bin2BI(PrivateKey, PrivateKeyLength, &pBI_PrivateKey); - - /* - * 3. Calculate PublicKey = G^PrivateKey (mod P) - * - BigInteger Operation - * - Montgomery reduction - */ - BigInteger_Montgomery_ExpMod(pBI_G, pBI_PrivateKey, pBI_P, &pBI_PublicKey); - - /* - * 4. Transfer BigInteger structure to char array - */ - BigInteger_BI2Bin(pBI_PublicKey, PublicKey, PublicKeyLength); - - BigInteger_Free(&pBI_G); - BigInteger_Free(&pBI_P); - BigInteger_Free(&pBI_PrivateKey); - BigInteger_Free(&pBI_PublicKey); -} /* End of DH_PublicKey_Generate */ - - -/* -======================================================================== -Routine Description: - Diffie-Hellman secret key generation - -Arguments: - PublicKey Public key - PublicKeyLength The length of Public key in bytes - PValue Array in UINT8 - PValueLength The length of P in bytes - PrivateKey Private key - PrivateKeyLength The length of Private key in bytes - -Return Value: - SecretKey Secret key - SecretKeyLength The length of secret key in bytes - -Note: - Reference to RFC2631 - SecretKey = PublicKey^PrivateKey (mod P) -======================================================================== -*/ -void DH_SecretKey_Generate ( - IN UINT8 PublicKey[], - IN UINT PublicKeyLength, - IN UINT8 PValue[], - IN UINT PValueLength, - IN UINT8 PrivateKey[], - IN UINT PrivateKeyLength, - OUT UINT8 SecretKey[], - INOUT UINT *SecretKeyLength) -{ - PBIG_INTEGER pBI_P = NULL; - PBIG_INTEGER pBI_SecretKey = NULL; - PBIG_INTEGER pBI_PrivateKey = NULL; - PBIG_INTEGER pBI_PublicKey = NULL; - - /* - * 1. Check the input parameters - * - PublicKeyLength, PValueLength and PrivateLength must be large than zero - * - SecretKeyLength must be large or equal than PValueLength - * - PValue must be odd - * - * - PValue must be prime number (no implement) - */ - if (PublicKeyLength == 0) { - DBGPRINT(RT_DEBUG_ERROR, ("DH_SecretKey_Generate: public key length is (%d)\n", PublicKeyLength)); - return; - } /* End of if */ - if (PValueLength == 0) { - DBGPRINT(RT_DEBUG_ERROR, ("DH_SecretKey_Generate: P length is (%d)\n", PValueLength)); - return; - } /* End of if */ - if (PrivateKeyLength == 0) { - DBGPRINT(RT_DEBUG_ERROR, ("DH_SecretKey_Generate: private key length is (%d)\n", PrivateKeyLength)); - return; - } /* End of if */ - if (*SecretKeyLength < PValueLength) { - DBGPRINT(RT_DEBUG_ERROR, ("DH_SecretKey_Generate: secret key length(%d) must be large or equal than P length(%d)\n", - *SecretKeyLength, PValueLength)); - return; - } /* End of if */ - if (!(PValue[PValueLength - 1] & 0x1)) { - DBGPRINT(RT_DEBUG_ERROR, ("DH_SecretKey_Generate: P value must be odd\n")); - return; - } /* End of if */ - - /* - * 2. Transfer parameters to BigInteger structure - */ - BigInteger_Init(&pBI_P); - BigInteger_Init(&pBI_PrivateKey); - BigInteger_Init(&pBI_PublicKey); - BigInteger_Init(&pBI_SecretKey); - - BigInteger_Bin2BI(PublicKey, PublicKeyLength, &pBI_PublicKey); - BigInteger_Bin2BI(PValue, PValueLength, &pBI_P); - BigInteger_Bin2BI(PrivateKey, PrivateKeyLength, &pBI_PrivateKey); - - /* - * 3. Calculate SecretKey = PublicKey^PrivateKey (mod P) - * - BigInteger Operation - * - Montgomery reduction - */ - BigInteger_Montgomery_ExpMod(pBI_PublicKey, pBI_PrivateKey, pBI_P, &pBI_SecretKey); - - /* - * 4. Transfer BigInteger structure to char array - */ - BigInteger_BI2Bin(pBI_SecretKey, SecretKey, SecretKeyLength); - - BigInteger_Free(&pBI_P); - BigInteger_Free(&pBI_PrivateKey); - BigInteger_Free(&pBI_PublicKey); - BigInteger_Free(&pBI_SecretKey); -} /* End of DH_SecretKey_Generate */ diff --git a/drivers/staging/rt3090/common/crypt_hmac.c b/drivers/staging/rt3090/common/crypt_hmac.c deleted file mode 100644 index e2854082f1d9..000000000000 --- a/drivers/staging/rt3090/common/crypt_hmac.c +++ /dev/null @@ -1,279 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - *************************************************************************/ - -#include "../crypt_hmac.h" - - -#ifdef HMAC_SHA1_SUPPORT -/* -======================================================================== -Routine Description: - HMAC using SHA1 hash function - -Arguments: - key Secret key - key_len The length of the key in bytes - message Message context - message_len The length of message in bytes - macLen Request the length of message authentication code - -Return Value: - mac Message authentication code - -Note: - None -======================================================================== -*/ -VOID HMAC_SHA1 ( - IN const UINT8 Key[], - IN UINT KeyLen, - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 MAC[], - IN UINT MACLen) -{ - SHA1_CTX_STRUC sha_ctx1; - SHA1_CTX_STRUC sha_ctx2; - UINT8 K0[SHA1_BLOCK_SIZE]; - UINT8 Digest[SHA1_DIGEST_SIZE]; - UINT index; - - NdisZeroMemory(&sha_ctx1, sizeof(SHA1_CTX_STRUC)); - NdisZeroMemory(&sha_ctx2, sizeof(SHA1_CTX_STRUC)); - /* - * If the length of K = B(Block size): K0 = K. - * If the length of K > B: hash K to obtain an L byte string, - * then append (B-L) zeros to create a B-byte string K0 (i.e., K0 = H(K) || 00...00). - * If the length of K < B: append zeros to the end of K to create a B-byte string K0 - */ - NdisZeroMemory(K0, SHA1_BLOCK_SIZE); - if (KeyLen <= SHA1_BLOCK_SIZE) - NdisMoveMemory(K0, Key, KeyLen); - else - RT_SHA1(Key, KeyLen, K0); - /* End of if */ - - /* Exclusive-Or K0 with ipad */ - /* ipad: Inner pad; the byte x��36�� repeated B times. */ - for (index = 0; index < SHA1_BLOCK_SIZE; index++) - K0[index] ^= 0x36; - /* End of for */ - - SHA1_Init(&sha_ctx1); - /* H(K0^ipad) */ - SHA1_Append(&sha_ctx1, K0, sizeof(K0)); - /* H((K0^ipad)||text) */ - SHA1_Append(&sha_ctx1, Message, MessageLen); - SHA1_End(&sha_ctx1, Digest); - - /* Exclusive-Or K0 with opad and remove ipad */ - /* opad: Outer pad; the byte x��5c�� repeated B times. */ - for (index = 0; index < SHA1_BLOCK_SIZE; index++) - K0[index] ^= 0x36^0x5c; - /* End of for */ - - SHA1_Init(&sha_ctx2); - /* H(K0^opad) */ - SHA1_Append(&sha_ctx2, K0, sizeof(K0)); - /* H( (K0^opad) || H((K0^ipad)||text) ) */ - SHA1_Append(&sha_ctx2, Digest, SHA1_DIGEST_SIZE); - SHA1_End(&sha_ctx2, Digest); - - if (MACLen > SHA1_DIGEST_SIZE) - NdisMoveMemory(MAC, Digest, SHA1_DIGEST_SIZE); - else - NdisMoveMemory(MAC, Digest, MACLen); -} /* End of HMAC_SHA1 */ -#endif /* HMAC_SHA1_SUPPORT */ - - -#ifdef HMAC_SHA256_SUPPORT -/* -======================================================================== -Routine Description: - HMAC using SHA256 hash function - -Arguments: - key Secret key - key_len The length of the key in bytes - message Message context - message_len The length of message in bytes - macLen Request the length of message authentication code - -Return Value: - mac Message authentication code - -Note: - None -======================================================================== -*/ -VOID HMAC_SHA256 ( - IN const UINT8 Key[], - IN UINT KeyLen, - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 MAC[], - IN UINT MACLen) -{ - SHA256_CTX_STRUC sha_ctx1; - SHA256_CTX_STRUC sha_ctx2; - UINT8 K0[SHA256_BLOCK_SIZE]; - UINT8 Digest[SHA256_DIGEST_SIZE]; - UINT index; - - NdisZeroMemory(&sha_ctx1, sizeof(SHA256_CTX_STRUC)); - NdisZeroMemory(&sha_ctx2, sizeof(SHA256_CTX_STRUC)); - /* - * If the length of K = B(Block size): K0 = K. - * If the length of K > B: hash K to obtain an L byte string, - * then append (B-L) zeros to create a B-byte string K0 (i.e., K0 = H(K) || 00...00). - * If the length of K < B: append zeros to the end of K to create a B-byte string K0 - */ - NdisZeroMemory(K0, SHA256_BLOCK_SIZE); - if (KeyLen <= SHA256_BLOCK_SIZE) { - NdisMoveMemory(K0, Key, KeyLen); - } else { - RT_SHA256(Key, KeyLen, K0); - } - - /* Exclusive-Or K0 with ipad */ - /* ipad: Inner pad; the byte x��36�� repeated B times. */ - for (index = 0; index < SHA256_BLOCK_SIZE; index++) - K0[index] ^= 0x36; - /* End of for */ - - SHA256_Init(&sha_ctx1); - /* H(K0^ipad) */ - SHA256_Append(&sha_ctx1, K0, sizeof(K0)); - /* H((K0^ipad)||text) */ - SHA256_Append(&sha_ctx1, Message, MessageLen); - SHA256_End(&sha_ctx1, Digest); - - /* Exclusive-Or K0 with opad and remove ipad */ - /* opad: Outer pad; the byte x��5c�� repeated B times. */ - for (index = 0; index < SHA256_BLOCK_SIZE; index++) - K0[index] ^= 0x36^0x5c; - /* End of for */ - - SHA256_Init(&sha_ctx2); - /* H(K0^opad) */ - SHA256_Append(&sha_ctx2, K0, sizeof(K0)); - /* H( (K0^opad) || H((K0^ipad)||text) ) */ - SHA256_Append(&sha_ctx2, Digest, SHA256_DIGEST_SIZE); - SHA256_End(&sha_ctx2, Digest); - - if (MACLen > SHA256_DIGEST_SIZE) - NdisMoveMemory(MAC, Digest,SHA256_DIGEST_SIZE); - else - NdisMoveMemory(MAC, Digest, MACLen); - -} /* End of HMAC_SHA256 */ -#endif /* HMAC_SHA256_SUPPORT */ - - -#ifdef HMAC_MD5_SUPPORT -/* -======================================================================== -Routine Description: - HMAC using MD5 hash function - -Arguments: - key Secret key - key_len The length of the key in bytes - message Message context - message_len The length of message in bytes - macLen Request the length of message authentication code - -Return Value: - mac Message authentication code - -Note: - None -======================================================================== -*/ -VOID HMAC_MD5( - IN const UINT8 Key[], - IN UINT KeyLen, - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 MAC[], - IN UINT MACLen) -{ - MD5_CTX_STRUC md5_ctx1; - MD5_CTX_STRUC md5_ctx2; - UINT8 K0[MD5_BLOCK_SIZE]; - UINT8 Digest[MD5_DIGEST_SIZE]; - UINT index; - - NdisZeroMemory(&md5_ctx1, sizeof(MD5_CTX_STRUC)); - NdisZeroMemory(&md5_ctx2, sizeof(MD5_CTX_STRUC)); - /* - * If the length of K = B(Block size): K0 = K. - * If the length of K > B: hash K to obtain an L byte string, - * then append (B-L) zeros to create a B-byte string K0 (i.e., K0 = H(K) || 00...00). - * If the length of K < B: append zeros to the end of K to create a B-byte string K0 - */ - NdisZeroMemory(K0, MD5_BLOCK_SIZE); - if (KeyLen <= MD5_BLOCK_SIZE) { - NdisMoveMemory(K0, Key, KeyLen); - } else { - RT_MD5(Key, KeyLen, K0); - } - - /* Exclusive-Or K0 with ipad */ - /* ipad: Inner pad; the byte x��36�� repeated B times. */ - for (index = 0; index < MD5_BLOCK_SIZE; index++) - K0[index] ^= 0x36; - /* End of for */ - - MD5_Init(&md5_ctx1); - /* H(K0^ipad) */ - MD5_Append(&md5_ctx1, K0, sizeof(K0)); - /* H((K0^ipad)||text) */ - MD5_Append(&md5_ctx1, Message, MessageLen); - MD5_End(&md5_ctx1, Digest); - - /* Exclusive-Or K0 with opad and remove ipad */ - /* opad: Outer pad; the byte x��5c�� repeated B times. */ - for (index = 0; index < MD5_BLOCK_SIZE; index++) - K0[index] ^= 0x36^0x5c; - /* End of for */ - - MD5_Init(&md5_ctx2); - /* H(K0^opad) */ - MD5_Append(&md5_ctx2, K0, sizeof(K0)); - /* H( (K0^opad) || H((K0^ipad)||text) ) */ - MD5_Append(&md5_ctx2, Digest, MD5_DIGEST_SIZE); - MD5_End(&md5_ctx2, Digest); - - if (MACLen > MD5_DIGEST_SIZE) - NdisMoveMemory(MAC, Digest, MD5_DIGEST_SIZE); - else - NdisMoveMemory(MAC, Digest, MACLen); -} /* End of HMAC_SHA256 */ -#endif /* HMAC_MD5_SUPPORT */ - -/* End of crypt_hmac.c */ diff --git a/drivers/staging/rt3090/common/crypt_md5.c b/drivers/staging/rt3090/common/crypt_md5.c deleted file mode 100644 index b09326540f5e..000000000000 --- a/drivers/staging/rt3090/common/crypt_md5.c +++ /dev/null @@ -1,353 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - *************************************************************************/ - -#include "../crypt_md5.h" - - -#ifdef MD5_SUPPORT -/* - * F, G, H and I are basic MD5 functions. - */ -#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) -#define H(x, y, z) ((x) ^ (y) ^ (z)) -#define I(x, y, z) ((y) ^ ((x) | (~z))) - -#define ROTL(x,n,w) ((x << n) | (x >> (w - n))) -#define ROTL32(x,n) ROTL(x,n,32) /* 32 bits word */ - -#define ROUND1(a, b, c, d, x, s, ac) { \ - (a) += F((b),(c),(d)) + (x) + (UINT32)(ac); \ - (a) = ROTL32((a),(s)); \ - (a) += (b); \ -} -#define ROUND2(a, b, c, d, x, s, ac) { \ - (a) += G((b),(c),(d)) + (x) + (UINT32)(ac); \ - (a) = ROTL32((a),(s)); \ - (a) += (b); \ -} -#define ROUND3(a, b, c, d, x, s, ac) { \ - (a) += H((b),(c),(d)) + (x) + (UINT32)(ac); \ - (a) = ROTL32((a),(s)); \ - (a) += (b); \ -} -#define ROUND4(a, b, c, d, x, s, ac) { \ - (a) += I((b),(c),(d)) + (x) + (UINT32)(ac); \ - (a) = ROTL32((a),(s)); \ - (a) += (b); \ -} -static const UINT32 MD5_DefaultHashValue[4] = { - 0x67452301UL, 0xefcdab89UL, 0x98badcfeUL, 0x10325476UL -}; -#endif /* MD5_SUPPORT */ - - -#ifdef MD5_SUPPORT -/* -======================================================================== -Routine Description: - Initial Md5_CTX_STRUC - -Arguments: - pMD5_CTX Pointer to Md5_CTX_STRUC - -Return Value: - None - -Note: - None -======================================================================== -*/ -VOID MD5_Init ( - IN MD5_CTX_STRUC *pMD5_CTX) -{ - NdisMoveMemory(pMD5_CTX->HashValue, MD5_DefaultHashValue, - sizeof(MD5_DefaultHashValue)); - NdisZeroMemory(pMD5_CTX->Block, MD5_BLOCK_SIZE); - pMD5_CTX->BlockLen = 0; - pMD5_CTX->MessageLen = 0; -} /* End of MD5_Init */ - - -/* -======================================================================== -Routine Description: - MD5 computation for one block (512 bits) - -Arguments: - pMD5_CTX Pointer to Md5_CTX_STRUC - -Return Value: - None - -Note: - T[i] := floor(abs(sin(i + 1)) * (2 pow 32)), i is number of round -======================================================================== -*/ -VOID MD5_Hash ( - IN MD5_CTX_STRUC *pMD5_CTX) -{ - UINT32 X_i; - UINT32 X[16]; - UINT32 a,b,c,d; - - /* Prepare the message schedule, {X_i} */ - NdisMoveMemory(X, pMD5_CTX->Block, MD5_BLOCK_SIZE); - for (X_i = 0; X_i < 16; X_i++) - X[X_i] = cpu2le32(X[X_i]); /* Endian Swap */ - /* End of for */ - - /* MD5 hash computation */ - /* Initialize the working variables */ - a = pMD5_CTX->HashValue[0]; - b = pMD5_CTX->HashValue[1]; - c = pMD5_CTX->HashValue[2]; - d = pMD5_CTX->HashValue[3]; - - /* - * Round 1 - * Let [abcd k s i] denote the operation - * a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s) - */ - ROUND1(a, b, c, d, X[ 0], 7, 0xd76aa478); /* 1 */ - ROUND1(d, a, b, c, X[ 1], 12, 0xe8c7b756); /* 2 */ - ROUND1(c, d, a, b, X[ 2], 17, 0x242070db); /* 3 */ - ROUND1(b, c, d, a, X[ 3], 22, 0xc1bdceee); /* 4 */ - ROUND1(a, b, c, d, X[ 4], 7, 0xf57c0faf); /* 5 */ - ROUND1(d, a, b, c, X[ 5], 12, 0x4787c62a); /* 6 */ - ROUND1(c, d, a, b, X[ 6], 17, 0xa8304613); /* 7 */ - ROUND1(b, c, d, a, X[ 7], 22, 0xfd469501); /* 8 */ - ROUND1(a, b, c, d, X[ 8], 7, 0x698098d8); /* 9 */ - ROUND1(d, a, b, c, X[ 9], 12, 0x8b44f7af); /* 10 */ - ROUND1(c, d, a, b, X[10], 17, 0xffff5bb1); /* 11 */ - ROUND1(b, c, d, a, X[11], 22, 0x895cd7be); /* 12 */ - ROUND1(a, b, c, d, X[12], 7, 0x6b901122); /* 13 */ - ROUND1(d, a, b, c, X[13], 12, 0xfd987193); /* 14 */ - ROUND1(c, d, a, b, X[14], 17, 0xa679438e); /* 15 */ - ROUND1(b, c, d, a, X[15], 22, 0x49b40821); /* 16 */ - - /* - * Round 2 - * Let [abcd k s i] denote the operation - * a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s) - */ - ROUND2(a, b, c, d, X[ 1], 5, 0xf61e2562); /* 17 */ - ROUND2(d, a, b, c, X[ 6], 9, 0xc040b340); /* 18 */ - ROUND2(c, d, a, b, X[11], 14, 0x265e5a51); /* 19 */ - ROUND2(b, c, d, a, X[ 0], 20, 0xe9b6c7aa); /* 20 */ - ROUND2(a, b, c, d, X[ 5], 5, 0xd62f105d); /* 21 */ - ROUND2(d, a, b, c, X[10], 9, 0x2441453); /* 22 */ - ROUND2(c, d, a, b, X[15], 14, 0xd8a1e681); /* 23 */ - ROUND2(b, c, d, a, X[ 4], 20, 0xe7d3fbc8); /* 24 */ - ROUND2(a, b, c, d, X[ 9], 5, 0x21e1cde6); /* 25 */ - ROUND2(d, a, b, c, X[14], 9, 0xc33707d6); /* 26 */ - ROUND2(c, d, a, b, X[ 3], 14, 0xf4d50d87); /* 27 */ - ROUND2(b, c, d, a, X[ 8], 20, 0x455a14ed); /* 28 */ - ROUND2(a, b, c, d, X[13], 5, 0xa9e3e905); /* 29 */ - ROUND2(d, a, b, c, X[ 2], 9, 0xfcefa3f8); /* 30 */ - ROUND2(c, d, a, b, X[ 7], 14, 0x676f02d9); /* 31 */ - ROUND2(b, c, d, a, X[12], 20, 0x8d2a4c8a); /* 32 */ - - /* - * Round 3 - * Let [abcd k s t] denote the operation - * a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s) - */ - ROUND3(a, b, c, d, X[ 5], 4, 0xfffa3942); /* 33 */ - ROUND3(d, a, b, c, X[ 8], 11, 0x8771f681); /* 34 */ - ROUND3(c, d, a, b, X[11], 16, 0x6d9d6122); /* 35 */ - ROUND3(b, c, d, a, X[14], 23, 0xfde5380c); /* 36 */ - ROUND3(a, b, c, d, X[ 1], 4, 0xa4beea44); /* 37 */ - ROUND3(d, a, b, c, X[ 4], 11, 0x4bdecfa9); /* 38 */ - ROUND3(c, d, a, b, X[ 7], 16, 0xf6bb4b60); /* 39 */ - ROUND3(b, c, d, a, X[10], 23, 0xbebfbc70); /* 40 */ - ROUND3(a, b, c, d, X[13], 4, 0x289b7ec6); /* 41 */ - ROUND3(d, a, b, c, X[ 0], 11, 0xeaa127fa); /* 42 */ - ROUND3(c, d, a, b, X[ 3], 16, 0xd4ef3085); /* 43 */ - ROUND3(b, c, d, a, X[ 6], 23, 0x4881d05); /* 44 */ - ROUND3(a, b, c, d, X[ 9], 4, 0xd9d4d039); /* 45 */ - ROUND3(d, a, b, c, X[12], 11, 0xe6db99e5); /* 46 */ - ROUND3(c, d, a, b, X[15], 16, 0x1fa27cf8); /* 47 */ - ROUND3(b, c, d, a, X[ 2], 23, 0xc4ac5665); /* 48 */ - - /* - * Round 4 - * Let [abcd k s t] denote the operation - * a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s) - */ - ROUND4(a, b, c, d, X[ 0], 6, 0xf4292244); /* 49 */ - ROUND4(d, a, b, c, X[ 7], 10, 0x432aff97); /* 50 */ - ROUND4(c, d, a, b, X[14], 15, 0xab9423a7); /* 51 */ - ROUND4(b, c, d, a, X[ 5], 21, 0xfc93a039); /* 52 */ - ROUND4(a, b, c, d, X[12], 6, 0x655b59c3); /* 53 */ - ROUND4(d, a, b, c, X[ 3], 10, 0x8f0ccc92); /* 54 */ - ROUND4(c, d, a, b, X[10], 15, 0xffeff47d); /* 55 */ - ROUND4(b, c, d, a, X[ 1], 21, 0x85845dd1); /* 56 */ - ROUND4(a, b, c, d, X[ 8], 6, 0x6fa87e4f); /* 57 */ - ROUND4(d, a, b, c, X[15], 10, 0xfe2ce6e0); /* 58 */ - ROUND4(c, d, a, b, X[ 6], 15, 0xa3014314); /* 59 */ - ROUND4(b, c, d, a, X[13], 21, 0x4e0811a1); /* 60 */ - ROUND4(a, b, c, d, X[ 4], 6, 0xf7537e82); /* 61 */ - ROUND4(d, a, b, c, X[11], 10, 0xbd3af235); /* 62 */ - ROUND4(c, d, a, b, X[ 2], 15, 0x2ad7d2bb); /* 63 */ - ROUND4(b, c, d, a, X[ 9], 21, 0xeb86d391); /* 64 */ - - /* Compute the i^th intermediate hash value H^(i) */ - pMD5_CTX->HashValue[0] += a; - pMD5_CTX->HashValue[1] += b; - pMD5_CTX->HashValue[2] += c; - pMD5_CTX->HashValue[3] += d; - - NdisZeroMemory(pMD5_CTX->Block, MD5_BLOCK_SIZE); - pMD5_CTX->BlockLen = 0; -} /* End of MD5_Hash */ - - -/* -======================================================================== -Routine Description: - The message is appended to block. If block size > 64 bytes, the MD5_Hash -will be called. - -Arguments: - pMD5_CTX Pointer to MD5_CTX_STRUC - message Message context - messageLen The length of message in bytes - -Return Value: - None - -Note: - None -======================================================================== -*/ -VOID MD5_Append ( - IN MD5_CTX_STRUC *pMD5_CTX, - IN const UINT8 Message[], - IN UINT MessageLen) -{ - UINT appendLen = 0; - UINT diffLen = 0; - - while (appendLen != MessageLen) { - diffLen = MessageLen - appendLen; - if ((pMD5_CTX->BlockLen + diffLen) < MD5_BLOCK_SIZE) { - NdisMoveMemory(pMD5_CTX->Block + pMD5_CTX->BlockLen, - Message + appendLen, diffLen); - pMD5_CTX->BlockLen += diffLen; - appendLen += diffLen; - } - else - { - NdisMoveMemory(pMD5_CTX->Block + pMD5_CTX->BlockLen, - Message + appendLen, MD5_BLOCK_SIZE - pMD5_CTX->BlockLen); - appendLen += (MD5_BLOCK_SIZE - pMD5_CTX->BlockLen); - pMD5_CTX->BlockLen = MD5_BLOCK_SIZE; - MD5_Hash(pMD5_CTX); - } /* End of if */ - } /* End of while */ - pMD5_CTX->MessageLen += MessageLen; -} /* End of MD5_Append */ - - -/* -======================================================================== -Routine Description: - 1. Append bit 1 to end of the message - 2. Append the length of message in rightmost 64 bits - 3. Transform the Hash Value to digest message - -Arguments: - pMD5_CTX Pointer to MD5_CTX_STRUC - -Return Value: - digestMessage Digest message - -Note: - None -======================================================================== -*/ -VOID MD5_End ( - IN MD5_CTX_STRUC *pMD5_CTX, - OUT UINT8 DigestMessage[]) -{ - UINT index; - UINT64 message_length_bits; - - /* append 1 bits to end of the message */ - NdisFillMemory(pMD5_CTX->Block + pMD5_CTX->BlockLen, 1, 0x80); - - /* 55 = 64 - 8 - 1: append 1 bit(1 byte) and message length (8 bytes) */ - if (pMD5_CTX->BlockLen > 55) - MD5_Hash(pMD5_CTX); - /* End of if */ - - /* Append the length of message in rightmost 64 bits */ - message_length_bits = pMD5_CTX->MessageLen*8; - message_length_bits = cpu2le64(message_length_bits); - NdisMoveMemory(&pMD5_CTX->Block[56], &message_length_bits, 8); - MD5_Hash(pMD5_CTX); - - /* Return message digest, transform the UINT32 hash value to bytes */ - for (index = 0; index < 4;index++) - pMD5_CTX->HashValue[index] = cpu2le32(pMD5_CTX->HashValue[index]); - /* End of for */ - NdisMoveMemory(DigestMessage, pMD5_CTX->HashValue, MD5_DIGEST_SIZE); -} /* End of MD5_End */ - - -/* -======================================================================== -Routine Description: - MD5 algorithm - -Arguments: - message Message context - messageLen The length of message in bytes - -Return Value: - digestMessage Digest message - -Note: - None -======================================================================== -*/ -VOID RT_MD5 ( - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 DigestMessage[]) -{ - MD5_CTX_STRUC md5_ctx; - - NdisZeroMemory(&md5_ctx, sizeof(MD5_CTX_STRUC)); - MD5_Init(&md5_ctx); - MD5_Append(&md5_ctx, Message, MessageLen); - MD5_End(&md5_ctx, DigestMessage); -} /* End of RT_MD5 */ - -#endif /* MD5_SUPPORT */ - -/* End of crypt_md5.c */ diff --git a/drivers/staging/rt3090/common/crypt_sha2.c b/drivers/staging/rt3090/common/crypt_sha2.c deleted file mode 100644 index c7490d0d3c44..000000000000 --- a/drivers/staging/rt3090/common/crypt_sha2.c +++ /dev/null @@ -1,536 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - *************************************************************************/ - -#include "../crypt_sha2.h" - - -/* Basic operations */ -#define SHR(x,n) (x >> n) /* SHR(x)^n, right shift n bits , x is w-bit word, 0 <= n <= w */ -#define ROTR(x,n,w) ((x >> n) | (x << (w - n))) /* ROTR(x)^n, circular right shift n bits , x is w-bit word, 0 <= n <= w */ -#define ROTL(x,n,w) ((x << n) | (x >> (w - n))) /* ROTL(x)^n, circular left shift n bits , x is w-bit word, 0 <= n <= w */ -#define ROTR32(x,n) ROTR(x,n,32) /* 32 bits word */ -#define ROTL32(x,n) ROTL(x,n,32) /* 32 bits word */ - -/* Basic functions */ -#define Ch(x,y,z) ((x & y) ^ ((~x) & z)) -#define Maj(x,y,z) ((x & y) ^ (x & z) ^ (y & z)) -#define Parity(x,y,z) (x ^ y ^ z) - -#ifdef SHA1_SUPPORT -/* SHA1 constants */ -#define SHA1_MASK 0x0000000f -static const UINT32 SHA1_K[4] = { - 0x5a827999UL, 0x6ed9eba1UL, 0x8f1bbcdcUL, 0xca62c1d6UL -}; -static const UINT32 SHA1_DefaultHashValue[5] = { - 0x67452301UL, 0xefcdab89UL, 0x98badcfeUL, 0x10325476UL, 0xc3d2e1f0UL -}; -#endif /* SHA1_SUPPORT */ - - -#ifdef SHA256_SUPPORT -/* SHA256 functions */ -#define Zsigma_256_0(x) (ROTR32(x,2) ^ ROTR32(x,13) ^ ROTR32(x,22)) -#define Zsigma_256_1(x) (ROTR32(x,6) ^ ROTR32(x,11) ^ ROTR32(x,25)) -#define Sigma_256_0(x) (ROTR32(x,7) ^ ROTR32(x,18) ^ SHR(x,3)) -#define Sigma_256_1(x) (ROTR32(x,17) ^ ROTR32(x,19) ^ SHR(x,10)) -/* SHA256 constants */ -static const UINT32 SHA256_K[64] = { - 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, - 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, - 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL, - 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL, - 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL, - 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, - 0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, - 0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL, - 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL, - 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL, - 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, - 0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, - 0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL, - 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL, - 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL, - 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL -}; -static const UINT32 SHA256_DefaultHashValue[8] = { - 0x6a09e667UL, 0xbb67ae85UL, 0x3c6ef372UL, 0xa54ff53aUL, - 0x510e527fUL, 0x9b05688cUL, 0x1f83d9abUL, 0x5be0cd19UL -}; -#endif /* SHA256_SUPPORT */ - - -#ifdef SHA1_SUPPORT -/* -======================================================================== -Routine Description: - Initial SHA1_CTX_STRUC - -Arguments: - pSHA_CTX Pointer to SHA1_CTX_STRUC - -Return Value: - None - -Note: - None -======================================================================== -*/ -VOID SHA1_Init ( - IN SHA1_CTX_STRUC *pSHA_CTX) -{ - NdisMoveMemory(pSHA_CTX->HashValue, SHA1_DefaultHashValue, - sizeof(SHA1_DefaultHashValue)); - NdisZeroMemory(pSHA_CTX->Block, SHA1_BLOCK_SIZE); - pSHA_CTX->MessageLen = 0; - pSHA_CTX->BlockLen = 0; -} /* End of SHA1_Init */ - - -/* -======================================================================== -Routine Description: - SHA1 computation for one block (512 bits) - -Arguments: - pSHA_CTX Pointer to SHA1_CTX_STRUC - -Return Value: - None - -Note: - None -======================================================================== -*/ -VOID SHA1_Hash ( - IN SHA1_CTX_STRUC *pSHA_CTX) -{ - UINT32 W_i,t,s; - UINT32 W[16]; - UINT32 a,b,c,d,e,T,f_t = 0; - - /* Prepare the message schedule, {W_i}, 0 < t < 15 */ - NdisMoveMemory(W, pSHA_CTX->Block, SHA1_BLOCK_SIZE); - for (W_i = 0; W_i < 16; W_i++) - W[W_i] = cpu2be32(W[W_i]); /* Endian Swap */ - /* End of for */ - - /* SHA256 hash computation */ - /* Initialize the working variables */ - a = pSHA_CTX->HashValue[0]; - b = pSHA_CTX->HashValue[1]; - c = pSHA_CTX->HashValue[2]; - d = pSHA_CTX->HashValue[3]; - e = pSHA_CTX->HashValue[4]; - - /* 80 rounds */ - for (t = 0;t < 80;t++) { - s = t & SHA1_MASK; - if (t > 15) { /* Prepare the message schedule, {W_i}, 16 < t < 79 */ - W[s] = (W[(s+13) & SHA1_MASK]) ^ (W[(s+8) & SHA1_MASK]) ^ (W[(s+2) & SHA1_MASK]) ^ W[s]; - W[s] = ROTL32(W[s],1); - } /* End of if */ - switch (t / 20) { - case 0: - f_t = Ch(b,c,d); - break; - case 1: - f_t = Parity(b,c,d); - break; - case 2: - f_t = Maj(b,c,d); - break; - case 3: - f_t = Parity(b,c,d); - break; - } /* End of switch */ - T = ROTL32(a,5) + f_t + e + SHA1_K[t / 20] + W[s]; - e = d; - d = c; - c = ROTL32(b,30); - b = a; - a = T; - } /* End of for */ - - /* Compute the i^th intermediate hash value H^(i) */ - pSHA_CTX->HashValue[0] += a; - pSHA_CTX->HashValue[1] += b; - pSHA_CTX->HashValue[2] += c; - pSHA_CTX->HashValue[3] += d; - pSHA_CTX->HashValue[4] += e; - - NdisZeroMemory(pSHA_CTX->Block, SHA1_BLOCK_SIZE); - pSHA_CTX->BlockLen = 0; -} /* End of SHA1_Hash */ - - -/* -======================================================================== -Routine Description: - The message is appended to block. If block size > 64 bytes, the SHA1_Hash -will be called. - -Arguments: - pSHA_CTX Pointer to SHA1_CTX_STRUC - message Message context - messageLen The length of message in bytes - -Return Value: - None - -Note: - None -======================================================================== -*/ -VOID SHA1_Append ( - IN SHA1_CTX_STRUC *pSHA_CTX, - IN const UINT8 Message[], - IN UINT MessageLen) -{ - UINT appendLen = 0; - UINT diffLen = 0; - - while (appendLen != MessageLen) { - diffLen = MessageLen - appendLen; - if ((pSHA_CTX->BlockLen + diffLen) < SHA1_BLOCK_SIZE) { - NdisMoveMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, - Message + appendLen, diffLen); - pSHA_CTX->BlockLen += diffLen; - appendLen += diffLen; - } - else - { - NdisMoveMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, - Message + appendLen, SHA1_BLOCK_SIZE - pSHA_CTX->BlockLen); - appendLen += (SHA1_BLOCK_SIZE - pSHA_CTX->BlockLen); - pSHA_CTX->BlockLen = SHA1_BLOCK_SIZE; - SHA1_Hash(pSHA_CTX); - } /* End of if */ - } /* End of while */ - pSHA_CTX->MessageLen += MessageLen; -} /* End of SHA1_Append */ - - -/* -======================================================================== -Routine Description: - 1. Append bit 1 to end of the message - 2. Append the length of message in rightmost 64 bits - 3. Transform the Hash Value to digest message - -Arguments: - pSHA_CTX Pointer to SHA1_CTX_STRUC - -Return Value: - digestMessage Digest message - -Note: - None -======================================================================== -*/ -VOID SHA1_End ( - IN SHA1_CTX_STRUC *pSHA_CTX, - OUT UINT8 DigestMessage[]) -{ - UINT index; - UINT64 message_length_bits; - - /* Append bit 1 to end of the message */ - NdisFillMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, 1, 0x80); - - /* 55 = 64 - 8 - 1: append 1 bit(1 byte) and message length (8 bytes) */ - if (pSHA_CTX->BlockLen > 55) - SHA1_Hash(pSHA_CTX); - /* End of if */ - - /* Append the length of message in rightmost 64 bits */ - message_length_bits = pSHA_CTX->MessageLen*8; - message_length_bits = cpu2be64(message_length_bits); - NdisMoveMemory(&pSHA_CTX->Block[56], &message_length_bits, 8); - SHA1_Hash(pSHA_CTX); - - /* Return message digest, transform the UINT32 hash value to bytes */ - for (index = 0; index < 5;index++) - pSHA_CTX->HashValue[index] = cpu2be32(pSHA_CTX->HashValue[index]); - /* End of for */ - NdisMoveMemory(DigestMessage, pSHA_CTX->HashValue, SHA1_DIGEST_SIZE); -} /* End of SHA1_End */ - - -/* -======================================================================== -Routine Description: - SHA1 algorithm - -Arguments: - message Message context - messageLen The length of message in bytes - -Return Value: - digestMessage Digest message - -Note: - None -======================================================================== -*/ -VOID RT_SHA1 ( - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 DigestMessage[]) -{ - - SHA1_CTX_STRUC sha_ctx; - - NdisZeroMemory(&sha_ctx, sizeof(SHA1_CTX_STRUC)); - SHA1_Init(&sha_ctx); - SHA1_Append(&sha_ctx, Message, MessageLen); - SHA1_End(&sha_ctx, DigestMessage); -} /* End of RT_SHA1 */ -#endif /* SHA1_SUPPORT */ - - -#ifdef SHA256_SUPPORT -/* -======================================================================== -Routine Description: - Initial SHA256_CTX_STRUC - -Arguments: - pSHA_CTX Pointer to SHA256_CTX_STRUC - -Return Value: - None - -Note: - None -======================================================================== -*/ -VOID SHA256_Init ( - IN SHA256_CTX_STRUC *pSHA_CTX) -{ - NdisMoveMemory(pSHA_CTX->HashValue, SHA256_DefaultHashValue, - sizeof(SHA256_DefaultHashValue)); - NdisZeroMemory(pSHA_CTX->Block, SHA256_BLOCK_SIZE); - pSHA_CTX->MessageLen = 0; - pSHA_CTX->BlockLen = 0; -} /* End of SHA256_Init */ - - -/* -======================================================================== -Routine Description: - SHA256 computation for one block (512 bits) - -Arguments: - pSHA_CTX Pointer to SHA256_CTX_STRUC - -Return Value: - None - -Note: - None -======================================================================== -*/ -VOID SHA256_Hash ( - IN SHA256_CTX_STRUC *pSHA_CTX) -{ - UINT32 W_i,t; - UINT32 W[64]; - UINT32 a,b,c,d,e,f,g,h,T1,T2; - - /* Prepare the message schedule, {W_i}, 0 < t < 15 */ - NdisMoveMemory(W, pSHA_CTX->Block, SHA256_BLOCK_SIZE); - for (W_i = 0; W_i < 16; W_i++) - W[W_i] = cpu2be32(W[W_i]); /* Endian Swap */ - /* End of for */ - - /* SHA256 hash computation */ - /* Initialize the working variables */ - a = pSHA_CTX->HashValue[0]; - b = pSHA_CTX->HashValue[1]; - c = pSHA_CTX->HashValue[2]; - d = pSHA_CTX->HashValue[3]; - e = pSHA_CTX->HashValue[4]; - f = pSHA_CTX->HashValue[5]; - g = pSHA_CTX->HashValue[6]; - h = pSHA_CTX->HashValue[7]; - - /* 64 rounds */ - for (t = 0;t < 64;t++) { - if (t > 15) /* Prepare the message schedule, {W_i}, 16 < t < 63 */ - W[t] = Sigma_256_1(W[t-2]) + W[t-7] + Sigma_256_0(W[t-15]) + W[t-16]; - /* End of if */ - T1 = h + Zsigma_256_1(e) + Ch(e,f,g) + SHA256_K[t] + W[t]; - T2 = Zsigma_256_0(a) + Maj(a,b,c); - h = g; - g = f; - f = e; - e = d + T1; - d = c; - c = b; - b = a; - a = T1 + T2; - } /* End of for */ - - /* Compute the i^th intermediate hash value H^(i) */ - pSHA_CTX->HashValue[0] += a; - pSHA_CTX->HashValue[1] += b; - pSHA_CTX->HashValue[2] += c; - pSHA_CTX->HashValue[3] += d; - pSHA_CTX->HashValue[4] += e; - pSHA_CTX->HashValue[5] += f; - pSHA_CTX->HashValue[6] += g; - pSHA_CTX->HashValue[7] += h; - - NdisZeroMemory(pSHA_CTX->Block, SHA256_BLOCK_SIZE); - pSHA_CTX->BlockLen = 0; -} /* End of SHA256_Hash */ - - -/* -======================================================================== -Routine Description: - The message is appended to block. If block size > 64 bytes, the SHA256_Hash -will be called. - -Arguments: - pSHA_CTX Pointer to SHA256_CTX_STRUC - message Message context - messageLen The length of message in bytes - -Return Value: - None - -Note: - None -======================================================================== -*/ -VOID SHA256_Append ( - IN SHA256_CTX_STRUC *pSHA_CTX, - IN const UINT8 Message[], - IN UINT MessageLen) -{ - UINT appendLen = 0; - UINT diffLen = 0; - - while (appendLen != MessageLen) { - diffLen = MessageLen - appendLen; - if ((pSHA_CTX->BlockLen + diffLen) < SHA256_BLOCK_SIZE) { - NdisMoveMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, - Message + appendLen, diffLen); - pSHA_CTX->BlockLen += diffLen; - appendLen += diffLen; - } - else - { - NdisMoveMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, - Message + appendLen, SHA256_BLOCK_SIZE - pSHA_CTX->BlockLen); - appendLen += (SHA256_BLOCK_SIZE - pSHA_CTX->BlockLen); - pSHA_CTX->BlockLen = SHA256_BLOCK_SIZE; - SHA256_Hash(pSHA_CTX); - } /* End of if */ - } /* End of while */ - pSHA_CTX->MessageLen += MessageLen; -} /* End of SHA256_Append */ - - -/* -======================================================================== -Routine Description: - 1. Append bit 1 to end of the message - 2. Append the length of message in rightmost 64 bits - 3. Transform the Hash Value to digest message - -Arguments: - pSHA_CTX Pointer to SHA256_CTX_STRUC - -Return Value: - digestMessage Digest message - -Note: - None -======================================================================== -*/ -VOID SHA256_End ( - IN SHA256_CTX_STRUC *pSHA_CTX, - OUT UINT8 DigestMessage[]) -{ - UINT index; - UINT64 message_length_bits; - - /* Append bit 1 to end of the message */ - NdisFillMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, 1, 0x80); - - /* 55 = 64 - 8 - 1: append 1 bit(1 byte) and message length (8 bytes) */ - if (pSHA_CTX->BlockLen > 55) - SHA256_Hash(pSHA_CTX); - /* End of if */ - - /* Append the length of message in rightmost 64 bits */ - message_length_bits = pSHA_CTX->MessageLen*8; - message_length_bits = cpu2be64(message_length_bits); - NdisMoveMemory(&pSHA_CTX->Block[56], &message_length_bits, 8); - SHA256_Hash(pSHA_CTX); - - /* Return message digest, transform the UINT32 hash value to bytes */ - for (index = 0; index < 8;index++) - pSHA_CTX->HashValue[index] = cpu2be32(pSHA_CTX->HashValue[index]); - /* End of for */ - NdisMoveMemory(DigestMessage, pSHA_CTX->HashValue, SHA256_DIGEST_SIZE); -} /* End of SHA256_End */ - - -/* -======================================================================== -Routine Description: - SHA256 algorithm - -Arguments: - message Message context - messageLen The length of message in bytes - -Return Value: - digestMessage Digest message - -Note: - None -======================================================================== -*/ -VOID RT_SHA256 ( - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 DigestMessage[]) -{ - SHA256_CTX_STRUC sha_ctx; - - NdisZeroMemory(&sha_ctx, sizeof(SHA256_CTX_STRUC)); - SHA256_Init(&sha_ctx); - SHA256_Append(&sha_ctx, Message, MessageLen); - SHA256_End(&sha_ctx, DigestMessage); -} /* End of RT_SHA256 */ -#endif /* SHA256_SUPPORT */ - -/* End of crypt_sha2.c */ diff --git a/drivers/staging/rt3090/common/dfs.c b/drivers/staging/rt3090/common/dfs.c deleted file mode 100644 index c15704ae2f24..000000000000 --- a/drivers/staging/rt3090/common/dfs.c +++ /dev/null @@ -1,481 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - ap_dfs.c - - Abstract: - Support DFS function. - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#include "../rt_config.h" - - -typedef struct _RADAR_DURATION_TABLE -{ - ULONG RDDurRegion; - ULONG RadarSignalDuration; - ULONG Tolerance; -} RADAR_DURATION_TABLE, *PRADAR_DURATION_TABLE; - - - -UCHAR RdIdleTimeTable[MAX_RD_REGION][4] = -{ - {9, 250, 250, 250}, // CE -#ifdef DFS_FCC_BW40_FIX - {1, 250, 250, 250}, // FCC -#else - {4, 250, 250, 250}, // FCC -#endif - {4, 250, 250, 250}, // JAP - {15, 250, 250, 250}, // JAP_W53 - {4, 250, 250, 250} // JAP_W56 -}; - -#ifdef TONE_RADAR_DETECT_SUPPORT -static void ToneRadarProgram(PRTMP_ADAPTER pAd); -static void ToneRadarEnable(PRTMP_ADAPTER pAd); -#endif // TONE_RADAR_DETECT_SUPPORT // - -#ifdef DFS_SUPPORT -/* - ======================================================================== - - Routine Description: - Bbp Radar detection routine - - Arguments: - pAd Pointer to our adapter - - Return Value: - - ======================================================================== -*/ -VOID BbpRadarDetectionStart( - IN PRTMP_ADAPTER pAd) -{ - UINT8 RadarPeriod; - - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 114, 0x02); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 121, 0x20); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 122, 0x00); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 123, 0x08/*0x80*/); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 124, 0x28); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, 125, 0xff); - -#ifdef MERGE_ARCH_TEAM - if ((pAd->CommonCfg.RadarDetect.RDDurRegion == JAP) || (pAd->CommonCfg.RadarDetect.RDDurRegion == JAP_W53) || (pAd->CommonCfg.RadarDetect.RDDurRegion == JAP_W56)) - { - pAd->CommonCfg.RadarDetect.RDDurRegion = JAP; - pAd->CommonCfg.RadarDetect.RDDurRegion = JapRadarType(pAd); - if (pAd->CommonCfg.RadarDetect.RDDurRegion == JAP_W56) - { - pAd->CommonCfg.RadarDetect.DfsSessionTime = 13; - } - else if (pAd->CommonCfg.RadarDetect.RDDurRegion == JAP_W53) - { - pAd->CommonCfg.RadarDetect.DfsSessionTime = 15; - } -#ifdef CARRIER_DETECTION_SUPPORT - pAd->CommonCfg.CarrierDetect.Enable = 1; -#endif // CARRIER_DETECTION_SUPPORT // - } -#endif // MERGE_ARCH_TEAM // - - RadarPeriod = ((UINT)RdIdleTimeTable[pAd->CommonCfg.RadarDetect.RDDurRegion][0] + (UINT)pAd->CommonCfg.RadarDetect.DfsSessionTime) < 250 ? - (RdIdleTimeTable[pAd->CommonCfg.RadarDetect.RDDurRegion][0] + pAd->CommonCfg.RadarDetect.DfsSessionTime) : 250; - -#ifdef MERGE_ARCH_TEAM - - -#else // Original RT28xx source code. - RTMP_IO_WRITE8(pAd, 0x7020, 0x1d); - RTMP_IO_WRITE8(pAd, 0x7021, 0x40); -#endif // MERGE_ARCH_TEAM // - - RadarDetectionStart(pAd, 0, RadarPeriod); - return; -} - -/* - ======================================================================== - - Routine Description: - Bbp Radar detection routine - - Arguments: - pAd Pointer to our adapter - - Return Value: - - ======================================================================== -*/ -VOID BbpRadarDetectionStop( - IN PRTMP_ADAPTER pAd) -{ - RTMP_IO_WRITE8(pAd, 0x7020, 0x1d); - RTMP_IO_WRITE8(pAd, 0x7021, 0x60); - - RadarDetectionStop(pAd); - return; -} - -/* - ======================================================================== - - Routine Description: - Radar detection routine - - Arguments: - pAd Pointer to our adapter - - Return Value: - - ======================================================================== -*/ -VOID RadarDetectionStart( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN CTSProtect, - IN UINT8 CTSPeriod) -{ - UINT8 DfsActiveTime = (pAd->CommonCfg.RadarDetect.DfsSessionTime & 0x1f); - UINT8 CtsProtect = (CTSProtect == 1) ? 0x02 : 0x01; // CTS protect. - - if (CTSProtect != 0) - { - switch(pAd->CommonCfg.RadarDetect.RDDurRegion) - { - case FCC: - case JAP_W56: - CtsProtect = 0x03; - break; - - case JAP: - { - UCHAR RDDurRegion; - RDDurRegion = JapRadarType(pAd); - if (RDDurRegion == JAP_W56) - CtsProtect = 0x03; - else - CtsProtect = 0x02; - break; - } - - case CE: - case JAP_W53: - default: - CtsProtect = 0x02; - break; - } - } - else - CtsProtect = 0x01; - - - // send start-RD with CTS protection command to MCU - // highbyte [7] reserve - // highbyte [6:5] 0x: stop Carrier/Radar detection - // highbyte [10]: Start Carrier/Radar detection without CTS protection, 11: Start Carrier/Radar detection with CTS protection - // highbyte [4:0] Radar/carrier detection duration. In 1ms. - - // lowbyte [7:0] Radar/carrier detection period, in 1ms. - AsicSendCommandToMcu(pAd, 0x60, 0xff, CTSPeriod, DfsActiveTime | (CtsProtect << 5)); - //AsicSendCommandToMcu(pAd, 0x63, 0xff, 10, 0); - - return; -} - -/* - ======================================================================== - - Routine Description: - Radar detection routine - - Arguments: - pAd Pointer to our adapter - - Return Value: - TRUE Found radar signal - FALSE Not found radar signal - - ======================================================================== -*/ -VOID RadarDetectionStop( - IN PRTMP_ADAPTER pAd) -{ - DBGPRINT(RT_DEBUG_TRACE,("RadarDetectionStop.\n")); - AsicSendCommandToMcu(pAd, 0x60, 0xff, 0x00, 0x00); // send start-RD with CTS protection command to MCU - - return; -} -#endif // DFS_SUPPORT // - - -/* - ======================================================================== - - Routine Description: - Radar channel check routine - - Arguments: - pAd Pointer to our adapter - - Return Value: - TRUE need to do radar detect - FALSE need not to do radar detect - - ======================================================================== -*/ -BOOLEAN RadarChannelCheck( - IN PRTMP_ADAPTER pAd, - IN UCHAR Ch) -{ - INT i; - BOOLEAN result = FALSE; - - for (i=0; iChannelListNum; i++) - { - if (Ch == pAd->ChannelList[i].Channel) - { - result = pAd->ChannelList[i].DfsReq; - break; - } - } - - return result; -} - -#ifdef DFS_SUPPORT - -ULONG JapRadarType( - IN PRTMP_ADAPTER pAd) -{ - ULONG i; - const UCHAR Channel[15]={52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}; - - if (pAd->CommonCfg.RadarDetect.RDDurRegion != JAP) - { - return pAd->CommonCfg.RadarDetect.RDDurRegion; - } - - for (i=0; i<15; i++) - { - if (pAd->CommonCfg.Channel == Channel[i]) - { - break; - } - } - - if (i < 4) - return JAP_W53; - else if (i < 15) - return JAP_W56; - else - return JAP; // W52 - -} - -ULONG RTMPBbpReadRadarDuration( - IN PRTMP_ADAPTER pAd) -{ - UINT8 byteValue = 0; - ULONG result; - - BBP_IO_READ8_BY_REG_ID(pAd, BBP_R115, &byteValue); - - result = 0; - switch (byteValue) - { - case 1: // radar signal detected by pulse mode. - case 2: // radar signal detected by width mode. - result = RTMPReadRadarDuration(pAd); - break; - - case 0: // No radar signal. - default: - - result = 0; - break; - } - - return result; -} - -ULONG RTMPReadRadarDuration( - IN PRTMP_ADAPTER pAd) -{ - ULONG result = 0; - -#ifdef DFS_SUPPORT - UINT8 duration1 = 0, duration2 = 0, duration3 = 0; - - - BBP_IO_READ8_BY_REG_ID(pAd, BBP_R116, &duration1); - BBP_IO_READ8_BY_REG_ID(pAd, BBP_R117, &duration2); - BBP_IO_READ8_BY_REG_ID(pAd, BBP_R118, &duration3); - result = (duration1 << 16) + (duration2 << 8) + duration3; -#endif // DFS_SUPPORT // - - return result; - -} - -VOID RTMPCleanRadarDuration( - IN PRTMP_ADAPTER pAd) -{ - return; -} - -/* - ======================================================================== - Routine Description: - Radar wave detection. The API should be invoke each second. - - Arguments: - pAd - Adapter pointer - - Return Value: - None - - ======================================================================== -*/ -VOID ApRadarDetectPeriodic( - IN PRTMP_ADAPTER pAd) -{ - INT i; - - pAd->CommonCfg.RadarDetect.InServiceMonitorCount++; - - for (i=0; iChannelListNum; i++) - { - - if (pAd->ChannelList[i].RemainingTimeForUse > 0) - { - pAd->ChannelList[i].RemainingTimeForUse --; - if ((pAd->Mlme.PeriodicRound%5) == 0) - { - DBGPRINT(RT_DEBUG_TRACE, ("RadarDetectPeriodic - ch=%d, RemainingTimeForUse=%d\n", pAd->ChannelList[i].Channel, pAd->ChannelList[i].RemainingTimeForUse)); - } - } - } - - //radar detect - if ((pAd->CommonCfg.Channel > 14) - && (pAd->CommonCfg.bIEEE80211H == 1) - && RadarChannelCheck(pAd, pAd->CommonCfg.Channel)) - { - RadarDetectPeriodic(pAd); - } - - return; -} - -// Periodic Radar detection, switch channel will occur in RTMPHandleTBTTInterrupt() -// Before switch channel, driver needs doing channel switch announcement. -VOID RadarDetectPeriodic( - IN PRTMP_ADAPTER pAd) -{ - - // need to check channel availability, after switch channel - if (pAd->CommonCfg.RadarDetect.RDMode != RD_SILENCE_MODE) - return; - - - - // channel availability check time is 60sec, use 65 for assurance - if (pAd->CommonCfg.RadarDetect.RDCount++ > pAd->CommonCfg.RadarDetect.ChMovingTime) - { - DBGPRINT(RT_DEBUG_TRACE, ("Not found radar signal, start send beacon and radar detection in service monitor\n\n")); - BbpRadarDetectionStop(pAd); - - - AsicEnableBssSync(pAd); - pAd->CommonCfg.RadarDetect.RDMode = RD_NORMAL_MODE; - - - - return; - } - - return; -} -#endif // DFS_SUPPORT // - -#ifdef DFS_SUPPORT -/* - ========================================================================== - Description: - change channel moving time for DFS testing. - - Arguments: - pAdapter Pointer to our adapter - wrq Pointer to the ioctl argument - - Return Value: - None - - Note: - Usage: - 1.) iwpriv ra0 set ChMovTime=[value] - ========================================================================== -*/ -INT Set_ChMovingTime_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UINT8 Value; - - Value = (UINT8) simple_strtol(arg, 0, 10); - - pAd->CommonCfg.RadarDetect.ChMovingTime = Value; - - DBGPRINT(RT_DEBUG_TRACE, ("%s:: %d\n", __FUNCTION__, - pAd->CommonCfg.RadarDetect.ChMovingTime)); - - return TRUE; -} - -INT Set_LongPulseRadarTh_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UINT8 Value; - - Value = (UINT8) simple_strtol(arg, 0, 10) > 10 ? 10 : simple_strtol(arg, 0, 10); - - pAd->CommonCfg.RadarDetect.LongPulseRadarTh = Value; - - DBGPRINT(RT_DEBUG_TRACE, ("%s:: %d\n", __FUNCTION__, - pAd->CommonCfg.RadarDetect.LongPulseRadarTh)); - - return TRUE; -} -#endif // DFS_SUPPORT // diff --git a/drivers/staging/rt3090/common/ee_efuse.c b/drivers/staging/rt3090/common/ee_efuse.c deleted file mode 100644 index c51e3059bf4c..000000000000 --- a/drivers/staging/rt3090/common/ee_efuse.c +++ /dev/null @@ -1,1548 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - ee_efuse.c - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#include "../rt_config.h" - - -#define EFUSE_USAGE_MAP_START 0x2d0 -#define EFUSE_USAGE_MAP_END 0x2fc -#define EFUSE_USAGE_MAP_SIZE 45 - - - -#define EFUSE_EEPROM_DEFULT_FILE "RT30xxEEPROM.bin" -#define MAX_EEPROM_BIN_FILE_SIZE 1024 - - - -#define EFUSE_TAG 0x2fe - - -#ifdef RT_BIG_ENDIAN -typedef union _EFUSE_CTRL_STRUC { - struct { - UINT32 SEL_EFUSE:1; - UINT32 EFSROM_KICK:1; - UINT32 RESERVED:4; - UINT32 EFSROM_AIN:10; - UINT32 EFSROM_LDO_ON_TIME:2; - UINT32 EFSROM_LDO_OFF_TIME:6; - UINT32 EFSROM_MODE:2; - UINT32 EFSROM_AOUT:6; - } field; - UINT32 word; -} EFUSE_CTRL_STRUC, *PEFUSE_CTRL_STRUC; -#else -typedef union _EFUSE_CTRL_STRUC { - struct { - UINT32 EFSROM_AOUT:6; - UINT32 EFSROM_MODE:2; - UINT32 EFSROM_LDO_OFF_TIME:6; - UINT32 EFSROM_LDO_ON_TIME:2; - UINT32 EFSROM_AIN:10; - UINT32 RESERVED:4; - UINT32 EFSROM_KICK:1; - UINT32 SEL_EFUSE:1; - } field; - UINT32 word; -} EFUSE_CTRL_STRUC, *PEFUSE_CTRL_STRUC; -#endif // RT_BIG_ENDIAN // - -static UCHAR eFuseReadRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - OUT USHORT* pData); - -static VOID eFuseReadPhysical( - IN PRTMP_ADAPTER pAd, - IN PUSHORT lpInBuffer, - IN ULONG nInBufferSize, - OUT PUSHORT lpOutBuffer, - IN ULONG nOutBufferSize); - -static VOID eFusePhysicalWriteRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - OUT USHORT* pData); - -static NTSTATUS eFuseWriteRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - IN USHORT* pData); - -static VOID eFuseWritePhysical( - IN PRTMP_ADAPTER pAd, - PUSHORT lpInBuffer, - ULONG nInBufferSize, - PUCHAR lpOutBuffer, - ULONG nOutBufferSize); - - -static NTSTATUS eFuseWriteRegistersFromBin( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - IN USHORT* pData); - - -/* -======================================================================== - - Routine Description: - - Arguments: - - Return Value: - - Note: - -======================================================================== -*/ -UCHAR eFuseReadRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - OUT USHORT* pData) -{ - EFUSE_CTRL_STRUC eFuseCtrlStruc; - int i; - USHORT efuseDataOffset; - UINT32 data; - - RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); - - //Step0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. - //Use the eeprom logical address and covert to address to block number - eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0; - - //Step1. Write EFSROM_MODE (0x580, bit7:bit6) to 0. - eFuseCtrlStruc.field.EFSROM_MODE = 0; - - //Step2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure. - eFuseCtrlStruc.field.EFSROM_KICK = 1; - - NdisMoveMemory(&data, &eFuseCtrlStruc, 4); - RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); - - //Step3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. - i = 0; - while(i < 500) - { - //rtmp.HwMemoryReadDword(EFUSE_CTRL, (DWORD *) &eFuseCtrlStruc, 4); - RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); - if(eFuseCtrlStruc.field.EFSROM_KICK == 0) - { - break; - } - RTMPusecDelay(2); - i++; - } - - //if EFSROM_AOUT is not found in physical address, write 0xffff - if (eFuseCtrlStruc.field.EFSROM_AOUT == 0x3f) - { - for(i=0; i> (8*(Offset & 0x3)); -#endif // RT_BIG_ENDIAN // - - NdisMoveMemory(pData, &data, Length); - } - - return (UCHAR) eFuseCtrlStruc.field.EFSROM_AOUT; - -} - -/* -======================================================================== - - Routine Description: - - Arguments: - - Return Value: - - Note: - -======================================================================== -*/ -VOID eFusePhysicalReadRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - OUT USHORT* pData) -{ - EFUSE_CTRL_STRUC eFuseCtrlStruc; - int i; - USHORT efuseDataOffset; - UINT32 data; - - RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); - - //Step0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. - eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0; - - //Step1. Write EFSROM_MODE (0x580, bit7:bit6) to 1. - //Read in physical view - eFuseCtrlStruc.field.EFSROM_MODE = 1; - - //Step2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure. - eFuseCtrlStruc.field.EFSROM_KICK = 1; - - NdisMoveMemory(&data, &eFuseCtrlStruc, 4); - RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); - - //Step3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. - i = 0; - while(i < 500) - { - RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); - if(eFuseCtrlStruc.field.EFSROM_KICK == 0) - break; - RTMPusecDelay(2); - i++; - } - - //Step4. Read 16-byte of data from EFUSE_DATA0-3 (0x59C-0x590) - //Because the size of each EFUSE_DATA is 4 Bytes, the size of address of each is 2 bits. - //The previous 2 bits is the EFUSE_DATA number, the last 2 bits is used to decide which bytes - //Decide which EFUSE_DATA to read - //590:F E D C - //594:B A 9 8 - //598:7 6 5 4 - //59C:3 2 1 0 - efuseDataOffset = EFUSE_DATA3 - (Offset & 0xC) ; - - RTMP_IO_READ32(pAd, efuseDataOffset, &data); - -#ifdef RT_BIG_ENDIAN - data = data << (8*((Offset & 0x3)^0x2)); -#else - data = data >> (8*(Offset & 0x3)); -#endif // RT_BIG_ENDIAN // - - NdisMoveMemory(pData, &data, Length); - -} - -/* -======================================================================== - - Routine Description: - - Arguments: - - Return Value: - - Note: - -======================================================================== -*/ -static VOID eFuseReadPhysical( - IN PRTMP_ADAPTER pAd, - IN PUSHORT lpInBuffer, - IN ULONG nInBufferSize, - OUT PUSHORT lpOutBuffer, - IN ULONG nOutBufferSize -) -{ - USHORT* pInBuf = (USHORT*)lpInBuffer; - USHORT* pOutBuf = (USHORT*)lpOutBuffer; - - USHORT Offset = pInBuf[0]; //addr - USHORT Length = pInBuf[1]; //length - int i; - - for(i=0; i> 2; - data = pData[0] & 0xffff; - //The offset should be 0x***10 or 0x***00 - if((Offset % 4) != 0) - { - eFuseDataBuffer[efuseDataOffset] = (eFuseDataBuffer[efuseDataOffset] & 0xffff) | (data << 16); - } - else - { - eFuseDataBuffer[efuseDataOffset] = (eFuseDataBuffer[efuseDataOffset] & 0xffff0000) | data; - } - - efuseDataOffset = EFUSE_DATA3; - for(i=0; i< 4; i++) - { - RTMP_IO_WRITE32(pAd, efuseDataOffset, eFuseDataBuffer[i]); - efuseDataOffset -= 4; - } - ///////////////////////////////////////////////////////////////// - - //Step1. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. - - RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); - - eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0; - - //Step2. Write EFSROM_MODE (0x580, bit7:bit6) to 3. - eFuseCtrlStruc.field.EFSROM_MODE = 3; - - //Step3. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical write procedure. - eFuseCtrlStruc.field.EFSROM_KICK = 1; - - NdisMoveMemory(&data, &eFuseCtrlStruc, 4); - RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); - - //Step4. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. It��s done. - i = 0; - - while(i < 500) - { - RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); - - if(eFuseCtrlStruc.field.EFSROM_KICK == 0) - break; - - RTMPusecDelay(2); - i++; - } -} - -/* -======================================================================== - - Routine Description: - - Arguments: - - Return Value: - - Note: - -======================================================================== -*/ -static NTSTATUS eFuseWriteRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - IN USHORT* pData) -{ - USHORT i,Loop=0; - USHORT eFuseData; - USHORT LogicalAddress, BlkNum = 0xffff; - UCHAR EFSROM_AOUT; - - USHORT addr,tmpaddr, InBuf[3], tmpOffset; - USHORT buffer[8]; - BOOLEAN bWriteSuccess = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters Offset=%x, pData=%x\n", Offset, *pData)); - - //Step 0. find the entry in the mapping table - //The address of EEPROM is 2-bytes alignment. - //The last bit is used for alignment, so it must be 0. - tmpOffset = Offset & 0xfffe; - EFSROM_AOUT = eFuseReadRegisters(pAd, tmpOffset, 2, &eFuseData); - - if( EFSROM_AOUT == 0x3f) - { //find available logical address pointer - //the logical address does not exist, find an empty one - //from the first address of block 45=16*45=0x2d0 to the last address of block 47 - //==>48*16-3(reserved)=2FC - for (i=EFUSE_USAGE_MAP_START; i<=EFUSE_USAGE_MAP_END; i+=2) - { - //Retrive the logical block nubmer form each logical address pointer - //It will access two logical address pointer each time. - eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); - if( (LogicalAddress & 0xff) == 0) - {//Not used logical address pointer - BlkNum = i-EFUSE_USAGE_MAP_START; - break; - } - else if(( (LogicalAddress >> 8) & 0xff) == 0) - {//Not used logical address pointer - if (i != EFUSE_USAGE_MAP_END) - { - BlkNum = i-EFUSE_USAGE_MAP_START+1; - } - break; - } - } - } - else - { - BlkNum = EFSROM_AOUT; - } - - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters BlkNum = %d \n", BlkNum)); - - if(BlkNum == 0xffff) - { - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters: out of free E-fuse space!!!\n")); - return FALSE; - } - - //Step 1. Save data of this block which is pointed by the avaible logical address pointer - // read and save the original block data - for(i =0; i<8; i++) - { - addr = BlkNum * 0x10 ; - - InBuf[0] = addr+2*i; - InBuf[1] = 2; - InBuf[2] = 0x0; - - eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); - - buffer[i] = InBuf[2]; - } - - //Step 2. Update the data in buffer, and write the data to Efuse - buffer[ (Offset >> 1) % 8] = pData[0]; - - do - { Loop++; - //Step 3. Write the data to Efuse - if(!bWriteSuccess) - { - for(i =0; i<8; i++) - { - addr = BlkNum * 0x10 ; - - InBuf[0] = addr+2*i; - InBuf[1] = 2; - InBuf[2] = buffer[i]; - - eFuseWritePhysical(pAd, &InBuf[0], 6, NULL, 2); - } - } - else - { - addr = BlkNum * 0x10 ; - - InBuf[0] = addr+(Offset % 16); - InBuf[1] = 2; - InBuf[2] = pData[0]; - - eFuseWritePhysical(pAd, &InBuf[0], 6, NULL, 2); - } - - //Step 4. Write mapping table - addr = EFUSE_USAGE_MAP_START+BlkNum; - - tmpaddr = addr; - - if(addr % 2 != 0) - addr = addr -1; - InBuf[0] = addr; - InBuf[1] = 2; - - //convert the address from 10 to 8 bit ( bit7, 6 = parity and bit5 ~ 0 = bit9~4), and write to logical map entry - tmpOffset = Offset; - tmpOffset >>= 4; - tmpOffset |= ((~((tmpOffset & 0x01) ^ ( tmpOffset >> 1 & 0x01) ^ (tmpOffset >> 2 & 0x01) ^ (tmpOffset >> 3 & 0x01))) << 6) & 0x40; - tmpOffset |= ((~( (tmpOffset >> 2 & 0x01) ^ (tmpOffset >> 3 & 0x01) ^ (tmpOffset >> 4 & 0x01) ^ ( tmpOffset >> 5 & 0x01))) << 7) & 0x80; - - // write the logical address - if(tmpaddr%2 != 0) - InBuf[2] = tmpOffset<<8; - else - InBuf[2] = tmpOffset; - - eFuseWritePhysical(pAd,&InBuf[0], 6, NULL, 0); - - //Step 5. Compare data if not the same, invalidate the mapping entry, then re-write the data until E-fuse is exhausted - bWriteSuccess = TRUE; - for(i =0; i<8; i++) - { - addr = BlkNum * 0x10 ; - - InBuf[0] = addr+2*i; - InBuf[1] = 2; - InBuf[2] = 0x0; - - eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); - - if(buffer[i] != InBuf[2]) - { - bWriteSuccess = FALSE; - break; - } - } - - //Step 6. invlidate mapping entry and find a free mapping entry if not succeed - if (!bWriteSuccess) - { - DBGPRINT(RT_DEBUG_TRACE, ("Not bWriteSuccess BlkNum = %d\n", BlkNum)); - - // the offset of current mapping entry - addr = EFUSE_USAGE_MAP_START+BlkNum; - - //find a new mapping entry - BlkNum = 0xffff; - for (i=EFUSE_USAGE_MAP_START; i<=EFUSE_USAGE_MAP_END; i+=2) - { - eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); - if( (LogicalAddress & 0xff) == 0) - { - BlkNum = i-EFUSE_USAGE_MAP_START; - break; - } - else if(( (LogicalAddress >> 8) & 0xff) == 0) - { - if (i != EFUSE_USAGE_MAP_END) - { - BlkNum = i+1-EFUSE_USAGE_MAP_START; - } - break; - } - } - DBGPRINT(RT_DEBUG_TRACE, ("Not bWriteSuccess new BlkNum = %d\n", BlkNum)); - if(BlkNum == 0xffff) - { - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters: out of free E-fuse space!!!\n")); - return FALSE; - } - - //invalidate the original mapping entry if new entry is not found - tmpaddr = addr; - - if(addr % 2 != 0) - addr = addr -1; - InBuf[0] = addr; - InBuf[1] = 2; - - eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); - - // write the logical address - if(tmpaddr%2 != 0) - { - // Invalidate the high byte - for (i=8; i<15; i++) - { - if( ( (InBuf[2] >> i) & 0x01) == 0) - { - InBuf[2] |= (0x1 <> i) & 0x01) == 0) - { - InBuf[2] |= (0x1 <bUseEfuse) - return FALSE; - for (i = EFUSE_USAGE_MAP_START; i <= EFUSE_USAGE_MAP_END; i+=2) - { - eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); - if( (LogicalAddress & 0xff) == 0) - { - efusefreenum= (UCHAR) (EFUSE_USAGE_MAP_END-i+1); - break; - } - else if(( (LogicalAddress >> 8) & 0xff) == 0) - { - efusefreenum = (UCHAR) (EFUSE_USAGE_MAP_END-i); - break; - } - - if(i == EFUSE_USAGE_MAP_END) - efusefreenum = 0; - } - printk("efuseFreeNumber is %d\n",efusefreenum); - return TRUE; -} - - -INT set_eFusedump_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ -USHORT InBuf[3]; - INT i=0; - if(!pAd->bUseEfuse) - return FALSE; - for(i =0; i0) - NdisMoveMemory(src, arg, strlen(arg)); - else - NdisMoveMemory(src, EFUSE_EEPROM_DEFULT_FILE, strlen(EFUSE_EEPROM_DEFULT_FILE)); - DBGPRINT(RT_DEBUG_TRACE, ("FileName=%s\n",src)); - - RtmpOSFSInfoChange(&osfsInfo, TRUE); - - srcf = RtmpOSFileOpen(src, O_RDONLY, 0); - if (IS_FILE_OPEN_ERR(srcf)) - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error opening file %s\n", src)); - retval = FALSE; - goto recoverFS; - } - else - { - // The object must have a read method - while(RtmpOSFileRead(srcf, &buffer[i], 1)==1) - { - i++; - if(i>MAX_EEPROM_BIN_FILE_SIZE) - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error reading file %s, file size too large[>%d]\n", src, MAX_EEPROM_BIN_FILE_SIZE)); - retval = FALSE; - goto closeFile; - } - } - - retval = RtmpOSFileClose(srcf); - if (retval) - DBGPRINT(RT_DEBUG_TRACE, ("--> Error closing file %s\n", src)); - } - - - RtmpOSFSInfoChange(&osfsInfo, FALSE); - - for(j=0;j48*16-3(reserved)=2FC - bAllocateNewBlk=TRUE; - for (i=EFUSE_USAGE_MAP_START; i<=EFUSE_USAGE_MAP_END; i+=2) - { - //Retrive the logical block nubmer form each logical address pointer - //It will access two logical address pointer each time. - eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); - if( (LogicalAddress & 0xff) == 0) - {//Not used logical address pointer - BlkNum = i-EFUSE_USAGE_MAP_START; - break; - } - else if(( (LogicalAddress >> 8) & 0xff) == 0) - {//Not used logical address pointer - if (i != EFUSE_USAGE_MAP_END) - { - BlkNum = i-EFUSE_USAGE_MAP_START+1; - } - break; - } - } - } - else - { - bAllocateNewBlk=FALSE; - BlkNum = EFSROM_AOUT; - } - - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters BlkNum = %d \n", BlkNum)); - - if(BlkNum == 0xffff) - { - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters: out of free E-fuse space!!!\n")); - return FALSE; - } - //Step 1.1.0 - //If the block is not existing in mapping table, create one - //and write down the 16-bytes data to the new block - if(bAllocateNewBlk) - { - DBGPRINT(RT_DEBUG_TRACE, ("Allocate New Blk\n")); - efuseDataOffset = EFUSE_DATA3; - for(i=0; i< 4; i++) - { - DBGPRINT(RT_DEBUG_TRACE, ("Allocate New Blk, Data%d=%04x%04x\n",3-i,pData[2*i+1],pData[2*i])); - tempbuffer=((pData[2*i+1]<<16)&0xffff0000)|pData[2*i]; - - - RTMP_IO_WRITE32(pAd, efuseDataOffset,tempbuffer); - efuseDataOffset -= 4; - - } - ///////////////////////////////////////////////////////////////// - - //Step1.1.1. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. - RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); - eFuseCtrlStruc.field.EFSROM_AIN = BlkNum* 0x10 ; - - //Step1.1.2. Write EFSROM_MODE (0x580, bit7:bit6) to 3. - eFuseCtrlStruc.field.EFSROM_MODE = 3; - - //Step1.1.3. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical write procedure. - eFuseCtrlStruc.field.EFSROM_KICK = 1; - - NdisMoveMemory(&data, &eFuseCtrlStruc, 4); - - RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); - - //Step1.1.4. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. It��s done. - i = 0; - while(i < 100) - { - RTMP_IO_READ32(pAd, EFUSE_CTRL, (PUINT32) &eFuseCtrlStruc); - - if(eFuseCtrlStruc.field.EFSROM_KICK == 0) - break; - - RTMPusecDelay(2); - i++; - } - - } - else - { //Step1.2. - //If the same logical number is existing, check if the writting data and the data - //saving in this block are the same. - ///////////////////////////////////////////////////////////////// - //read current values of 16-byte block - RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); - - //Step1.2.0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. - eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0; - - //Step1.2.1. Write EFSROM_MODE (0x580, bit7:bit6) to 1. - eFuseCtrlStruc.field.EFSROM_MODE = 0; - - //Step1.2.2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure. - eFuseCtrlStruc.field.EFSROM_KICK = 1; - - NdisMoveMemory(&data, &eFuseCtrlStruc, 4); - RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); - - //Step1.2.3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. - i = 0; - while(i < 500) - { - RTMP_IO_READ32(pAd, EFUSE_CTRL, (PUINT32) &eFuseCtrlStruc); - - if(eFuseCtrlStruc.field.EFSROM_KICK == 0) - break; - RTMPusecDelay(2); - i++; - } - - //Step1.2.4. Read 16-byte of data from EFUSE_DATA0-3 (0x59C-0x590) - efuseDataOffset = EFUSE_DATA3; - for(i=0; i< 4; i++) - { - RTMP_IO_READ32(pAd, efuseDataOffset, (PUINT32) &buffer[i]); - efuseDataOffset -= 4; - } - //Step1.2.5. Check if the data of efuse and the writing data are the same. - for(i =0; i<4; i++) - { - tempbuffer=((pData[2*i+1]<<16)&0xffff0000)|pData[2*i]; - DBGPRINT(RT_DEBUG_TRACE, ("buffer[%d]=%x,pData[%d]=%x,pData[%d]=%x,tempbuffer=%x\n",i,buffer[i],2*i,pData[2*i],2*i+1,pData[2*i+1],tempbuffer)); - - if(((buffer[i]&0xffff0000)==(pData[2*i+1]<<16))&&((buffer[i]&0xffff)==pData[2*i])) - bNotWrite&=TRUE; - else - { - bNotWrite&=FALSE; - break; - } - } - if(!bNotWrite) - { - printk("The data is not the same\n"); - - for(i =0; i<8; i++) - { - addr = BlkNum * 0x10 ; - - InBuf[0] = addr+2*i; - InBuf[1] = 2; - InBuf[2] = pData[i]; - - eFuseWritePhysical(pAd, &InBuf[0], 6, NULL, 2); - } - - } - else - return TRUE; - } - - - - //Step 2. Write mapping table - addr = EFUSE_USAGE_MAP_START+BlkNum; - - tmpaddr = addr; - - if(addr % 2 != 0) - addr = addr -1; - InBuf[0] = addr; - InBuf[1] = 2; - - //convert the address from 10 to 8 bit ( bit7, 6 = parity and bit5 ~ 0 = bit9~4), and write to logical map entry - tmpOffset = Offset; - tmpOffset >>= 4; - tmpOffset |= ((~((tmpOffset & 0x01) ^ ( tmpOffset >> 1 & 0x01) ^ (tmpOffset >> 2 & 0x01) ^ (tmpOffset >> 3 & 0x01))) << 6) & 0x40; - tmpOffset |= ((~( (tmpOffset >> 2 & 0x01) ^ (tmpOffset >> 3 & 0x01) ^ (tmpOffset >> 4 & 0x01) ^ ( tmpOffset >> 5 & 0x01))) << 7) & 0x80; - - // write the logical address - if(tmpaddr%2 != 0) - InBuf[2] = tmpOffset<<8; - else - InBuf[2] = tmpOffset; - - eFuseWritePhysical(pAd,&InBuf[0], 6, NULL, 0); - - //Step 3. Compare data if not the same, invalidate the mapping entry, then re-write the data until E-fuse is exhausted - bWriteSuccess = TRUE; - for(i =0; i<8; i++) - { - addr = BlkNum * 0x10 ; - - InBuf[0] = addr+2*i; - InBuf[1] = 2; - InBuf[2] = 0x0; - - eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); - DBGPRINT(RT_DEBUG_TRACE, ("addr=%x, buffer[i]=%x,InBuf[2]=%x\n",InBuf[0],pData[i],InBuf[2])); - if(pData[i] != InBuf[2]) - { - bWriteSuccess = FALSE; - break; - } - } - - //Step 4. invlidate mapping entry and find a free mapping entry if not succeed - - if (!bWriteSuccess&&Loop<2) - { - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegistersFromBin::Not bWriteSuccess BlkNum = %d\n", BlkNum)); - - // the offset of current mapping entry - addr = EFUSE_USAGE_MAP_START+BlkNum; - - //find a new mapping entry - BlkNum = 0xffff; - for (i=EFUSE_USAGE_MAP_START; i<=EFUSE_USAGE_MAP_END; i+=2) - { - eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); - if( (LogicalAddress & 0xff) == 0) - { - BlkNum = i-EFUSE_USAGE_MAP_START; - break; - } - else if(( (LogicalAddress >> 8) & 0xff) == 0) - { - if (i != EFUSE_USAGE_MAP_END) - { - BlkNum = i+1-EFUSE_USAGE_MAP_START; - } - break; - } - } - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegistersFromBin::Not bWriteSuccess new BlkNum = %d\n", BlkNum)); - if(BlkNum == 0xffff) - { - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegistersFromBin: out of free E-fuse space!!!\n")); - return FALSE; - } - - //invalidate the original mapping entry if new entry is not found - tmpaddr = addr; - - if(addr % 2 != 0) - addr = addr -1; - InBuf[0] = addr; - InBuf[1] = 2; - - eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); - - // write the logical address - if(tmpaddr%2 != 0) - { - // Invalidate the high byte - for (i=8; i<15; i++) - { - if( ( (InBuf[2] >> i) & 0x01) == 0) - { - InBuf[2] |= (0x1 <> i) & 0x01) == 0) - { - InBuf[2] |= (0x1 <bFroceEEPROMBuffer || pAd->bEEPROMFile) - { - DBGPRINT(RT_DEBUG_TRACE, ("Read from EEPROM Buffer\n")); - NdisMoveMemory(pValue, &(pAd->EEPROMImage[Offset]), 2); - } - else - eFuseReadRegisters(pAd, Offset, 2, pValue); - return (*pValue); -} - - -int rtmp_ee_efuse_write16( - IN RTMP_ADAPTER *pAd, - IN USHORT Offset, - IN USHORT data) -{ - if(pAd->bFroceEEPROMBuffer||pAd->bEEPROMFile) - { - DBGPRINT(RT_DEBUG_TRACE, ("Write to EEPROM Buffer\n")); - NdisMoveMemory(&(pAd->EEPROMImage[Offset]), &data, 2); - } - else - eFuseWriteRegisters(pAd, Offset, 2, &data); - return 0; -} - - -int RtmpEfuseSupportCheck( - IN RTMP_ADAPTER *pAd) -{ - USHORT value; - - if (IS_RT30xx(pAd)) - { - eFusePhysicalReadRegisters(pAd, EFUSE_TAG, 2, &value); - pAd->EFuseTag = (value & 0xff); - } - return 0; -} - -INT set_eFuseBufferModeWriteBack_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UINT Enable; - - - if(strlen(arg)>0) - { - Enable= simple_strtol(arg, 0, 16); - } - else - return FALSE; - if(Enable==1) - { - DBGPRINT(RT_DEBUG_TRACE, ("set_eFuseBufferMode_Proc:: Call WRITEEEPROMBUF")); - eFuseWriteEeeppromBuf(pAd); - } - else - return FALSE; - return TRUE; -} - - -/* - ======================================================================== - - Routine Description: - Load EEPROM from bin file for eFuse mode - - Arguments: - Adapter Pointer to our adapter - - Return Value: - NDIS_STATUS_SUCCESS firmware image load ok - NDIS_STATUS_FAILURE image not found - - IRQL = PASSIVE_LEVEL - - ======================================================================== -*/ -INT eFuseLoadEEPROM( - IN PRTMP_ADAPTER pAd) -{ - PSTRING src = NULL; - INT retval; - RTMP_OS_FD srcf; - RTMP_OS_FS_INFO osFSInfo; - - - src=EFUSE_BUFFER_PATH; - DBGPRINT(RT_DEBUG_TRACE, ("FileName=%s\n",src)); - - - RtmpOSFSInfoChange(&osFSInfo, TRUE); - - if (src && *src) - { - srcf = RtmpOSFileOpen(src, O_RDONLY, 0); - if (IS_FILE_OPEN_ERR(srcf)) - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error %ld opening %s\n", -PTR_ERR(srcf),src)); - return FALSE; - } - else - { - - memset(pAd->EEPROMImage, 0x00, MAX_EEPROM_BIN_FILE_SIZE); - - - retval =RtmpOSFileRead(srcf, (PSTRING)pAd->EEPROMImage, MAX_EEPROM_BIN_FILE_SIZE); - if (retval > 0) - { - RTMPSetProfileParameters(pAd, (PSTRING)pAd->EEPROMImage); - retval = NDIS_STATUS_SUCCESS; - } - else - DBGPRINT(RT_DEBUG_ERROR, ("Read file \"%s\" failed(errCode=%d)!\n", src, retval)); - - } - - - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error src or srcf is null\n")); - return FALSE; - - } - - retval=RtmpOSFileClose(srcf); - - if (retval) - { - DBGPRINT(RT_DEBUG_TRACE, ("--> Error %d closing %s\n", -retval, src)); - } - - - RtmpOSFSInfoChange(&osFSInfo, FALSE); - - return TRUE; -} - -INT eFuseWriteEeeppromBuf( - IN PRTMP_ADAPTER pAd) -{ - - PSTRING src = NULL; - INT retval; - RTMP_OS_FD srcf; - RTMP_OS_FS_INFO osFSInfo; - - - src=EFUSE_BUFFER_PATH; - DBGPRINT(RT_DEBUG_TRACE, ("FileName=%s\n",src)); - - RtmpOSFSInfoChange(&osFSInfo, TRUE); - - - - if (src && *src) - { - srcf = RtmpOSFileOpen(src, O_WRONLY|O_CREAT, 0); - - if (IS_FILE_OPEN_ERR(srcf)) - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error %ld opening %s\n", -PTR_ERR(srcf),src)); - return FALSE; - } - else - { -/* - // The object must have a read method - if (srcf->f_op && srcf->f_op->write) - { - // The object must have a read method - srcf->f_op->write(srcf, pAd->EEPROMImage, 1024, &srcf->f_pos); - - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error!! System doest not support read function\n")); - return FALSE; - } -*/ - - RtmpOSFileWrite(srcf, (PSTRING)pAd->EEPROMImage,MAX_EEPROM_BIN_FILE_SIZE); - - } - - - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error src or srcf is null\n")); - return FALSE; - - } - - retval=RtmpOSFileClose(srcf); - - if (retval) - { - DBGPRINT(RT_DEBUG_TRACE, ("--> Error %d closing %s\n", -retval, src)); - } - - RtmpOSFSInfoChange(&osFSInfo, FALSE); - return TRUE; -} - - -VOID eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, - PUINT EfuseFreeBlock) -{ - USHORT i; - USHORT LogicalAddress; - if(!pAd->bUseEfuse) - { - DBGPRINT(RT_DEBUG_TRACE,("eFuseGetFreeBlockCount Only supports efuse Mode\n")); - return ; - } - for (i = EFUSE_USAGE_MAP_START; i <= EFUSE_USAGE_MAP_END; i+=2) - { - eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); - if( (LogicalAddress & 0xff) == 0) - { - *EfuseFreeBlock= (UCHAR) (EFUSE_USAGE_MAP_END-i+1); - break; - } - else if(( (LogicalAddress >> 8) & 0xff) == 0) - { - *EfuseFreeBlock = (UCHAR) (EFUSE_USAGE_MAP_END-i); - break; - } - - if(i == EFUSE_USAGE_MAP_END) - *EfuseFreeBlock = 0; - } - DBGPRINT(RT_DEBUG_TRACE,("eFuseGetFreeBlockCount is 0x%x\n",*EfuseFreeBlock)); -} - -INT eFuse_init( - IN PRTMP_ADAPTER pAd) -{ - UINT EfuseFreeBlock=0; - DBGPRINT(RT_DEBUG_ERROR, ("NVM is Efuse and its size =%x[%x-%x] \n",EFUSE_USAGE_MAP_SIZE,EFUSE_USAGE_MAP_START,EFUSE_USAGE_MAP_END)); - eFuseGetFreeBlockCount(pAd, &EfuseFreeBlock); - //If the used block of efuse is less than 5. We assume the default value - // of this efuse is empty and change to the buffer mode in odrder to - //bring up interfaces successfully. - if(EfuseFreeBlock > (EFUSE_USAGE_MAP_END-5)) - { - DBGPRINT(RT_DEBUG_ERROR, ("NVM is Efuse and the information is too less to bring up interface. Force to use EEPROM Buffer Mode\n")); - pAd->bFroceEEPROMBuffer = TRUE; - eFuseLoadEEPROM(pAd); - } - else - pAd->bFroceEEPROMBuffer = FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("NVM is Efuse and force to use EEPROM Buffer Mode=%x\n",pAd->bFroceEEPROMBuffer)); - - return 0; -} diff --git a/drivers/staging/rt3090/common/ee_prom.c b/drivers/staging/rt3090/common/ee_prom.c deleted file mode 100644 index 051cfdee2a15..000000000000 --- a/drivers/staging/rt3090/common/ee_prom.c +++ /dev/null @@ -1,308 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - ee_prom.c - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#include "../rt_config.h" - - -// IRQL = PASSIVE_LEVEL -static inline VOID RaiseClock( - IN PRTMP_ADAPTER pAd, - IN UINT32 *x) -{ - *x = *x | EESK; - RTMP_IO_WRITE32(pAd, E2PROM_CSR, *x); - RTMPusecDelay(1); // Max frequency = 1MHz in Spec. definition -} - -// IRQL = PASSIVE_LEVEL -static inline VOID LowerClock( - IN PRTMP_ADAPTER pAd, - IN UINT32 *x) -{ - *x = *x & ~EESK; - RTMP_IO_WRITE32(pAd, E2PROM_CSR, *x); - RTMPusecDelay(1); -} - -// IRQL = PASSIVE_LEVEL -static inline USHORT ShiftInBits( - IN PRTMP_ADAPTER pAd) -{ - UINT32 x,i; - USHORT data=0; - - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - - x &= ~( EEDO | EEDI); - - for(i=0; i<16; i++) - { - data = data << 1; - RaiseClock(pAd, &x); - - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - LowerClock(pAd, &x); //prevent read failed - - x &= ~(EEDI); - if(x & EEDO) - data |= 1; - } - - return data; -} - - -// IRQL = PASSIVE_LEVEL -static inline VOID ShiftOutBits( - IN PRTMP_ADAPTER pAd, - IN USHORT data, - IN USHORT count) -{ - UINT32 x,mask; - - mask = 0x01 << (count - 1); - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - - x &= ~(EEDO | EEDI); - - do - { - x &= ~EEDI; - if(data & mask) x |= EEDI; - - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - - RaiseClock(pAd, &x); - LowerClock(pAd, &x); - - mask = mask >> 1; - } while(mask); - - x &= ~EEDI; - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); -} - - -// IRQL = PASSIVE_LEVEL -static inline VOID EEpromCleanup( - IN PRTMP_ADAPTER pAd) -{ - UINT32 x; - - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - - x &= ~(EECS | EEDI); - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - - RaiseClock(pAd, &x); - LowerClock(pAd, &x); -} - - -static inline VOID EWEN( - IN PRTMP_ADAPTER pAd) -{ - UINT32 x; - - // reset bits and set EECS - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - x &= ~(EEDI | EEDO | EESK); - x |= EECS; - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - - // kick a pulse - RaiseClock(pAd, &x); - LowerClock(pAd, &x); - - // output the read_opcode and six pulse in that order - ShiftOutBits(pAd, EEPROM_EWEN_OPCODE, 5); - ShiftOutBits(pAd, 0, 6); - - EEpromCleanup(pAd); -} - - -static inline VOID EWDS( - IN PRTMP_ADAPTER pAd) -{ - UINT32 x; - - // reset bits and set EECS - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - x &= ~(EEDI | EEDO | EESK); - x |= EECS; - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - - // kick a pulse - RaiseClock(pAd, &x); - LowerClock(pAd, &x); - - // output the read_opcode and six pulse in that order - ShiftOutBits(pAd, EEPROM_EWDS_OPCODE, 5); - ShiftOutBits(pAd, 0, 6); - - EEpromCleanup(pAd); -} - - -// IRQL = PASSIVE_LEVEL -int rtmp_ee_prom_read16( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - OUT USHORT *pValue) -{ - UINT32 x; - USHORT data; - -#ifdef RT30xx -#ifdef ANT_DIVERSITY_SUPPORT - if (pAd->NicConfig2.field.AntDiversity) - { - pAd->EepromAccess = TRUE; - } -#endif // ANT_DIVERSITY_SUPPORT // -#endif // RT30xx // - - Offset /= 2; - // reset bits and set EECS - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - x &= ~(EEDI | EEDO | EESK); - x |= EECS; - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - - // patch can not access e-Fuse issue - if (!(IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) - { - // kick a pulse - RaiseClock(pAd, &x); - LowerClock(pAd, &x); - } - - // output the read_opcode and register number in that order - ShiftOutBits(pAd, EEPROM_READ_OPCODE, 3); - ShiftOutBits(pAd, Offset, pAd->EEPROMAddressNum); - - // Now read the data (16 bits) in from the selected EEPROM word - data = ShiftInBits(pAd); - - EEpromCleanup(pAd); - -#ifdef RT30xx -#ifdef ANT_DIVERSITY_SUPPORT - // Antenna and EEPROM access are both using EESK pin, - // Therefor we should avoid accessing EESK at the same time - // Then restore antenna after EEPROM access - if ((pAd->NicConfig2.field.AntDiversity)/* || (pAd->RfIcType == RFIC_3020)*/) - { - pAd->EepromAccess = FALSE; - AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); - } -#endif // ANT_DIVERSITY_SUPPORT // -#endif // RT30xx // - - *pValue = data; - - return NDIS_STATUS_SUCCESS; -} - - -int rtmp_ee_prom_write16( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Data) -{ - UINT32 x; - -#ifdef RT30xx -#ifdef ANT_DIVERSITY_SUPPORT - if (pAd->NicConfig2.field.AntDiversity) - { - pAd->EepromAccess = TRUE; - } -#endif // ANT_DIVERSITY_SUPPORT // -#endif // RT30xx // - - Offset /= 2; - - EWEN(pAd); - - // reset bits and set EECS - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - x &= ~(EEDI | EEDO | EESK); - x |= EECS; - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - - // patch can not access e-Fuse issue - if (!(IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) - { - // kick a pulse - RaiseClock(pAd, &x); - LowerClock(pAd, &x); - } - - // output the read_opcode ,register number and data in that order - ShiftOutBits(pAd, EEPROM_WRITE_OPCODE, 3); - ShiftOutBits(pAd, Offset, pAd->EEPROMAddressNum); - ShiftOutBits(pAd, Data, 16); // 16-bit access - - // read DO status - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - - EEpromCleanup(pAd); - - RTMPusecDelay(10000); //delay for twp(MAX)=10ms - - EWDS(pAd); - - EEpromCleanup(pAd); - -#ifdef RT30xx -#ifdef ANT_DIVERSITY_SUPPORT - // Antenna and EEPROM access are both using EESK pin, - // Therefor we should avoid accessing EESK at the same time - // Then restore antenna after EEPROM access - if ((pAd->NicConfig2.field.AntDiversity) /*|| (pAd->RfIcType == RFIC_3020)*/) - { - pAd->EepromAccess = FALSE; - AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); - } -#endif // ANT_DIVERSITY_SUPPORT // -#endif // RT30xx // - - return NDIS_STATUS_SUCCESS; - -} diff --git a/drivers/staging/rt3090/common/eeprom.c b/drivers/staging/rt3090/common/eeprom.c deleted file mode 100644 index 2e837499e5e4..000000000000 --- a/drivers/staging/rt3090/common/eeprom.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - eeprom.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Name Date Modification logs -*/ - -#include "../rt_config.h" - - -INT RtmpChipOpsEepromHook( - IN RTMP_ADAPTER *pAd, - IN INT infType) -{ - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; -#ifdef RT30xx -#ifdef RTMP_EFUSE_SUPPORT - UINT32 eFuseCtrl, MacCsr0; - int index; - - index = 0; - do - { - RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0); - pAd->MACVersion = MacCsr0; - - if ((pAd->MACVersion != 0x00) && (pAd->MACVersion != 0xFFFFFFFF)) - break; - - RTMPusecDelay(10); - } while (index++ < 100); - - pAd->bUseEfuse=FALSE; - RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrl); - pAd->bUseEfuse = ( (eFuseCtrl & 0x80000000) == 0x80000000) ? 1 : 0; - if(pAd->bUseEfuse) - { - pChipOps->eeinit = eFuse_init; - pChipOps->eeread = rtmp_ee_efuse_read16; - pChipOps->eewrite = rtmp_ee_efuse_write16; - return 0 ; - } - else - { - pAd->bFroceEEPROMBuffer = FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("NVM is EEPROM\n")); - } -#endif // RTMP_EFUSE_SUPPORT // -#endif // RT30xx // - - switch(infType) - { -#ifdef RTMP_PCI_SUPPORT - case RTMP_DEV_INF_PCI: - pChipOps->eeinit = NULL; - pChipOps->eeread = rtmp_ee_prom_read16; - pChipOps->eewrite = rtmp_ee_prom_write16; - break; -#endif // RTMP_PCI_SUPPORT // - - - default: - DBGPRINT(RT_DEBUG_ERROR, ("RtmpChipOpsEepromHook() failed!\n")); - break; - } - - return 0; -} diff --git a/drivers/staging/rt3090/common/igmp_snoop.c b/drivers/staging/rt3090/common/igmp_snoop.c deleted file mode 100644 index 680658f97f0a..000000000000 --- a/drivers/staging/rt3090/common/igmp_snoop.c +++ /dev/null @@ -1,1365 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - */ - - -#ifdef IGMP_SNOOP_SUPPORT - -#include "../rt_config.h" -#include "../ipv6.h" -#include "../igmp_snoop.h" - - -static inline void initFreeEntryList( - IN PMULTICAST_FILTER_TABLE pMulticastFilterTable, - IN PLIST_HEADER pList) -{ - int i; - - for (i = 0; i < FREE_MEMBER_POOL_SIZE; i++) - insertTailList(pList, (PLIST_ENTRY)&(pMulticastFilterTable->freeMemberPool[i])); - - return; -} - -static inline PMEMBER_ENTRY AllocaGrpMemberEntry( - IN PMULTICAST_FILTER_TABLE pMulticastFilterTable) -{ - PMEMBER_ENTRY pMemberEntry; - - RTMP_SEM_LOCK(&pMulticastFilterTable->FreeMemberPoolTabLock); - - pMemberEntry = (PMEMBER_ENTRY)removeHeadList(&pMulticastFilterTable->freeEntryList); - - RTMP_SEM_UNLOCK(&pMulticastFilterTable->FreeMemberPoolTabLock); - - return (PMEMBER_ENTRY)pMemberEntry; -} - -static inline VOID FreeGrpMemberEntry( - IN PMULTICAST_FILTER_TABLE pMulticastFilterTable, - IN PMEMBER_ENTRY pEntry) -{ - RTMP_SEM_LOCK(&pMulticastFilterTable->FreeMemberPoolTabLock); - - insertTailList(&pMulticastFilterTable->freeEntryList, (PLIST_ENTRY)pEntry); - - RTMP_SEM_UNLOCK(&pMulticastFilterTable->FreeMemberPoolTabLock); -} - -static VOID IGMPTableDisplay( - IN PRTMP_ADAPTER pAd); - -static BOOLEAN isIgmpMacAddr( - IN PUCHAR pMacAddr); - -static VOID InsertIgmpMember( - IN PMULTICAST_FILTER_TABLE pMulticastFilterTable, - IN PLIST_HEADER pList, - IN PUCHAR pMemberAddr); - -static VOID DeleteIgmpMember( - IN PMULTICAST_FILTER_TABLE pMulticastFilterTable, - IN PLIST_HEADER pList, - IN PUCHAR pMemberAddr); - -static VOID DeleteIgmpMemberList( - IN PMULTICAST_FILTER_TABLE pMulticastFilterTable, - IN PLIST_HEADER pList); - - -/* - ========================================================================== - Description: - This routine init the entire IGMP table. - ========================================================================== - */ -VOID MulticastFilterTableInit( - IN PMULTICAST_FILTER_TABLE *ppMulticastFilterTable) -{ - // Initialize MAC table and allocate spin lock - *ppMulticastFilterTable = kmalloc(sizeof(MULTICAST_FILTER_TABLE), MEM_ALLOC_FLAG); - if (*ppMulticastFilterTable == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s unable to alloc memory for Multicase filter table, size=%d\n", - __FUNCTION__, sizeof(MULTICAST_FILTER_TABLE))); - return; - } - - NdisZeroMemory(*ppMulticastFilterTable, sizeof(MULTICAST_FILTER_TABLE)); - NdisAllocateSpinLock(&((*ppMulticastFilterTable)->MulticastFilterTabLock)); - - NdisAllocateSpinLock(&((*ppMulticastFilterTable)->FreeMemberPoolTabLock)); - initList(&((*ppMulticastFilterTable)->freeEntryList)); - initFreeEntryList(*ppMulticastFilterTable, &((*ppMulticastFilterTable)->freeEntryList)); - return; -} - -/* - ========================================================================== - Description: - This routine reset the entire IGMP table. - ========================================================================== - */ -VOID MultiCastFilterTableReset( - IN PMULTICAST_FILTER_TABLE *ppMulticastFilterTable) -{ - if(*ppMulticastFilterTable == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s Multicase filter table is not ready.\n", __FUNCTION__)); - return; - } - - NdisFreeSpinLock(&((*ppMulticastFilterTable)->FreeMemberPoolTabLock)); - NdisFreeSpinLock(&((*ppMulticastFilterTable)->MulticastFilterTabLock)); - kfree(*ppMulticastFilterTable); - *ppMulticastFilterTable = NULL; -} - -/* - ========================================================================== - Description: - Display all entrys in IGMP table - ========================================================================== - */ -static VOID IGMPTableDisplay( - IN PRTMP_ADAPTER pAd) -{ - int i; - MULTICAST_FILTER_TABLE_ENTRY *pEntry = NULL; - PMULTICAST_FILTER_TABLE pMulticastFilterTable = pAd->pMulticastFilterTable; - - if (pMulticastFilterTable == NULL) - { - DBGPRINT(RT_DEBUG_OFF, ("%s Multicase filter table is not ready.\n", __FUNCTION__)); - return; - } - - // if FULL, return - if (pMulticastFilterTable->Size == 0) - { - DBGPRINT(RT_DEBUG_ERROR, ("Table empty.\n")); - return; - } - - // allocate one MAC entry - RTMP_SEM_LOCK(&pMulticastFilterTable->MulticastFilterTabLock); - - for (i = 0; i< MAX_LEN_OF_MULTICAST_FILTER_TABLE; i++) - { - // pick up the first available vacancy - if (pMulticastFilterTable->Content[i].Valid == TRUE) - { - PMEMBER_ENTRY pMemberEntry = NULL; - pEntry = &pMulticastFilterTable->Content[i]; - - DBGPRINT(RT_DEBUG_OFF, ("IF(%s) entry #%d, type=%s, GrpId=(%02x:%02x:%02x:%02x:%02x:%02x) memberCnt=%d\n", - RTMP_OS_NETDEV_GET_DEVNAME(pEntry->net_dev), i, (pEntry->type==0 ? "static":"dynamic"), - PRINT_MAC(pEntry->Addr), IgmpMemberCnt(&pEntry->MemberList))); - - pMemberEntry = (PMEMBER_ENTRY)pEntry->MemberList.pHead; - while (pMemberEntry) - { - DBGPRINT(RT_DEBUG_OFF, ("member mac=(%02x:%02x:%02x:%02x:%02x:%02x)\n", - PRINT_MAC(pMemberEntry->Addr))); - - pMemberEntry = pMemberEntry->pNext; - } - } - } - - RTMP_SEM_UNLOCK(&pMulticastFilterTable->MulticastFilterTabLock); - - return; -} - -/* - ========================================================================== - Description: - Add and new entry into MAC table - ========================================================================== - */ -BOOLEAN MulticastFilterTableInsertEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pGrpId, - IN PUCHAR pMemberAddr, - IN PNET_DEV dev, - IN MulticastFilterEntryType type) -{ - UCHAR HashIdx; - int i; - MULTICAST_FILTER_TABLE_ENTRY *pEntry = NULL, *pCurrEntry, *pPrevEntry; - PMEMBER_ENTRY pMemberEntry; - PMULTICAST_FILTER_TABLE pMulticastFilterTable = pAd->pMulticastFilterTable; - - if (pMulticastFilterTable == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s Multicase filter table is not ready.\n", __FUNCTION__)); - return FALSE; - } - - // if FULL, return - if (pMulticastFilterTable->Size >= MAX_LEN_OF_MULTICAST_FILTER_TABLE) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s Multicase filter table full. max-entries = %d\n", - __FUNCTION__, MAX_LEN_OF_MULTICAST_FILTER_TABLE)); - return FALSE; - } - - // check the rule is in table already or not. - if ((pEntry = MulticastFilterTableLookup(pMulticastFilterTable, pGrpId, dev))) - { - // doesn't indicate member mac address. - if(pMemberAddr == NULL) - { - return FALSE; - } - - pMemberEntry = (PMEMBER_ENTRY)pEntry->MemberList.pHead; - - while (pMemberEntry) - { - if (MAC_ADDR_EQUAL(pMemberAddr, pMemberEntry->Addr)) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: already in Members list.\n", __FUNCTION__)); - return FALSE; - } - - pMemberEntry = pMemberEntry->pNext; - } - } - - RTMP_SEM_LOCK(&pMulticastFilterTable->MulticastFilterTabLock); - do - { - ULONG Now; - // the multicast entry already exist but doesn't include the member yet. - if (pEntry != NULL && pMemberAddr != NULL) - { - InsertIgmpMember(pMulticastFilterTable, &pEntry->MemberList, pMemberAddr); - break; - } - - // allocate one MAC entry - for (i = 0; i < MAX_LEN_OF_MULTICAST_FILTER_TABLE; i++) - { - // pick up the first available vacancy - pEntry = &pMulticastFilterTable->Content[i]; - NdisGetSystemUpTime(&Now); - if ((pEntry->Valid == TRUE) && (pEntry->type == MCAT_FILTER_DYNAMIC) - && ((Now - pEntry->lastTime) > IGMPMAC_TB_ENTRY_AGEOUT_TIME)) - { - PMULTICAST_FILTER_TABLE_ENTRY pHashEntry; - - HashIdx = MULTICAST_ADDR_HASH_INDEX(pEntry->Addr); - pHashEntry = pMulticastFilterTable->Hash[HashIdx]; - - if ((pEntry->net_dev == pHashEntry->net_dev) - && MAC_ADDR_EQUAL(pEntry->Addr, pHashEntry->Addr)) - { - pMulticastFilterTable->Hash[HashIdx] = pHashEntry->pNext; - pMulticastFilterTable->Size --; - DBGPRINT(RT_DEBUG_TRACE, ("MCastFilterTableDeleteEntry 1 - Total= %d\n", pMulticastFilterTable->Size)); - } else - { - while (pHashEntry->pNext) - { - pPrevEntry = pHashEntry; - pHashEntry = pHashEntry->pNext; - if ((pEntry->net_dev == pHashEntry->net_dev) - && MAC_ADDR_EQUAL(pEntry->Addr, pHashEntry->Addr)) - { - pPrevEntry->pNext = pHashEntry->pNext; - pMulticastFilterTable->Size --; - DBGPRINT(RT_DEBUG_TRACE, ("MCastFilterTableDeleteEntry 2 - Total= %d\n", pMulticastFilterTable->Size)); - break; - } - } - } - pEntry->Valid = FALSE; - DeleteIgmpMemberList(pMulticastFilterTable, &pEntry->MemberList); - } - - if (pEntry->Valid == FALSE) - { - NdisZeroMemory(pEntry, sizeof(MULTICAST_FILTER_TABLE_ENTRY)); - pEntry->Valid = TRUE; - - COPY_MAC_ADDR(pEntry->Addr, pGrpId); - pEntry->net_dev = dev; - NdisGetSystemUpTime(&Now); - pEntry->lastTime = Now; - pEntry->type = type; - initList(&pEntry->MemberList); - if (pMemberAddr != NULL) - InsertIgmpMember(pMulticastFilterTable, &pEntry->MemberList, pMemberAddr); - - pMulticastFilterTable->Size ++; - - DBGPRINT(RT_DEBUG_TRACE, ("MulticastFilterTableInsertEntry -IF(%s) allocate entry #%d, Total= %d\n", RTMP_OS_NETDEV_GET_DEVNAME(dev), i, pMulticastFilterTable->Size)); - break; - } - } - - // add this MAC entry into HASH table - if (pEntry) - { - HashIdx = MULTICAST_ADDR_HASH_INDEX(pGrpId); - if (pMulticastFilterTable->Hash[HashIdx] == NULL) - { - pMulticastFilterTable->Hash[HashIdx] = pEntry; - } else - { - pCurrEntry = pMulticastFilterTable->Hash[HashIdx]; - while (pCurrEntry->pNext != NULL) - pCurrEntry = pCurrEntry->pNext; - pCurrEntry->pNext = pEntry; - } - } - }while(FALSE); - - RTMP_SEM_UNLOCK(&pMulticastFilterTable->MulticastFilterTabLock); - - return TRUE; -} - -/* - ========================================================================== - Description: - Delete a specified client from MAC table - ========================================================================== - */ -BOOLEAN MulticastFilterTableDeleteEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pGrpId, - IN PUCHAR pMemberAddr, - IN PNET_DEV dev) -{ - USHORT HashIdx; - MULTICAST_FILTER_TABLE_ENTRY *pEntry, *pPrevEntry; - PMULTICAST_FILTER_TABLE pMulticastFilterTable = pAd->pMulticastFilterTable; - USHORT Aid = MCAST_WCID; - SST Sst = SST_ASSOC; - UCHAR PsMode = PWR_ACTIVE, Rate; - - if (pMulticastFilterTable == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s Multicase filter table is not ready.\n", __FUNCTION__)); - return FALSE; - } - - RTMP_SEM_LOCK(&pMulticastFilterTable->MulticastFilterTabLock); - - do - { - HashIdx = MULTICAST_ADDR_HASH_INDEX(pGrpId); - pPrevEntry = pEntry = pMulticastFilterTable->Hash[HashIdx]; - - while (pEntry && pEntry->Valid) - { - if ((pEntry->net_dev == dev) - && MAC_ADDR_EQUAL(pEntry->Addr, pGrpId)) - break; - else - { - pPrevEntry = pEntry; - pEntry = pEntry->pNext; - } - } - - // check the rule is in table already or not. - if (pEntry && (pMemberAddr != NULL)) - { - if(APSsPsInquiry(pAd, pMemberAddr, &Sst, &Aid, &PsMode, &Rate)) - DeleteIgmpMember(pMulticastFilterTable, &pEntry->MemberList, pMemberAddr); - if (IgmpMemberCnt(&pEntry->MemberList) > 0) - break; - } - - if (pEntry) - { - if (pEntry == pMulticastFilterTable->Hash[HashIdx]) - { - pMulticastFilterTable->Hash[HashIdx] = pEntry->pNext; - DeleteIgmpMemberList(pMulticastFilterTable, &pEntry->MemberList); - NdisZeroMemory(pEntry, sizeof(MULTICAST_FILTER_TABLE_ENTRY)); - pMulticastFilterTable->Size --; - DBGPRINT(RT_DEBUG_TRACE, ("MCastFilterTableDeleteEntry 1 - Total= %d\n", pMulticastFilterTable->Size)); - } - else - { - pPrevEntry->pNext = pEntry->pNext; - DeleteIgmpMemberList(pMulticastFilterTable, &pEntry->MemberList); - NdisZeroMemory(pEntry, sizeof(MULTICAST_FILTER_TABLE_ENTRY)); - pMulticastFilterTable->Size --; - DBGPRINT(RT_DEBUG_TRACE, ("MCastFilterTableDeleteEntry 2 - Total= %d\n", pMulticastFilterTable->Size)); - } - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: the Group doesn't exist.\n", __FUNCTION__)); - } - } while(FALSE); - - RTMP_SEM_UNLOCK(&pMulticastFilterTable->MulticastFilterTabLock); - - return TRUE; -} - -/* - ========================================================================== - Description: - Look up the MAC address in the IGMP table. Return NULL if not found. - Return: - pEntry - pointer to the MAC entry; NULL is not found - ========================================================================== -*/ -PMULTICAST_FILTER_TABLE_ENTRY MulticastFilterTableLookup( - IN PMULTICAST_FILTER_TABLE pMulticastFilterTable, - IN PUCHAR pAddr, - IN PNET_DEV dev) -{ - ULONG HashIdx, Now; - PMULTICAST_FILTER_TABLE_ENTRY pEntry = NULL, pPrev = NULL; - - if (pMulticastFilterTable == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s Multicase filter table is not ready.\n", __FUNCTION__)); - return NULL; - } - - RTMP_SEM_LOCK(&pMulticastFilterTable->MulticastFilterTabLock); - - HashIdx = MULTICAST_ADDR_HASH_INDEX(pAddr); - pEntry = pPrev = pMulticastFilterTable->Hash[HashIdx]; - - while (pEntry && pEntry->Valid) - { - if ((pEntry->net_dev == dev) - && MAC_ADDR_EQUAL(pEntry->Addr, pAddr)) - { - NdisGetSystemUpTime(&Now); - pEntry->lastTime = Now; - break; - } - else - { - NdisGetSystemUpTime(&Now); - if ((pEntry->Valid == TRUE) && (pEntry->type == MCAT_FILTER_DYNAMIC) - && RTMP_TIME_AFTER(Now, pEntry->lastTime+IGMPMAC_TB_ENTRY_AGEOUT_TIME)) - { - // Remove the aged entry - if (pEntry == pMulticastFilterTable->Hash[HashIdx]) - { - pMulticastFilterTable->Hash[HashIdx] = pEntry->pNext; - pPrev = pMulticastFilterTable->Hash[HashIdx]; - DeleteIgmpMemberList(pMulticastFilterTable, &pEntry->MemberList); - NdisZeroMemory(pEntry, sizeof(MULTICAST_FILTER_TABLE_ENTRY)); - pMulticastFilterTable->Size --; - pEntry = pPrev; - DBGPRINT(RT_DEBUG_TRACE, ("MCastFilterTableDeleteEntry 2 - Total= %d\n", pMulticastFilterTable->Size)); - } - else - { - pPrev->pNext = pEntry->pNext; - DeleteIgmpMemberList(pMulticastFilterTable, &pEntry->MemberList); - NdisZeroMemory(pEntry, sizeof(MULTICAST_FILTER_TABLE_ENTRY)); - pMulticastFilterTable->Size --; - pEntry = (pPrev == NULL ? NULL: pPrev->pNext); - DBGPRINT(RT_DEBUG_TRACE, ("MCastFilterTableDeleteEntry 2 - Total= %d\n", pMulticastFilterTable->Size)); - } - } - else - { - pPrev = pEntry; - pEntry = pEntry->pNext; - } - } - } - - RTMP_SEM_UNLOCK(&pMulticastFilterTable->MulticastFilterTabLock); - - return pEntry; -} - -VOID IGMPSnooping( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDstMacAddr, - IN PUCHAR pSrcMacAddr, - IN PUCHAR pIpHeader, - IN PNET_DEV pDev) -{ - INT i; - INT IpHeaderLen; - UCHAR GroupType; - UINT16 numOfGroup; - UCHAR IgmpVerType; - PUCHAR pIgmpHeader; - PUCHAR pGroup; - UCHAR AuxDataLen; - UINT16 numOfSources; - PUCHAR pGroupIpAddr; - UCHAR GroupMacAddr[6]; - PUCHAR pGroupMacAddr = (PUCHAR)&GroupMacAddr; - - if(isIgmpPkt(pDstMacAddr, pIpHeader)) - { - IpHeaderLen = (*(pIpHeader + 2) & 0x0f) * 4; - pIgmpHeader = pIpHeader + 2 + IpHeaderLen; - IgmpVerType = (UCHAR)(*(pIgmpHeader)); - - DBGPRINT(RT_DEBUG_TRACE, ("IGMP type=%0x\n", IgmpVerType)); - - switch(IgmpVerType) - { - case IGMP_V1_MEMBERSHIP_REPORT: // IGMP version 1 membership report. - case IGMP_V2_MEMBERSHIP_REPORT: // IGMP version 2 membership report. - pGroupIpAddr = (PUCHAR)(pIgmpHeader + 4); - ConvertMulticastIP2MAC(pGroupIpAddr, (PUCHAR *)&pGroupMacAddr, ETH_P_IP); - DBGPRINT(RT_DEBUG_TRACE, ("IGMP Group=%02x:%02x:%02x:%02x:%02x:%02x\n", - GroupMacAddr[0], GroupMacAddr[1], GroupMacAddr[2], GroupMacAddr[3], GroupMacAddr[4], GroupMacAddr[5])); - MulticastFilterTableInsertEntry(pAd, GroupMacAddr, pSrcMacAddr, pDev, MCAT_FILTER_DYNAMIC); - break; - - case IGMP_LEAVE_GROUP: // IGMP version 1 and version 2 leave group. - pGroupIpAddr = (PUCHAR)(pIgmpHeader + 4); - ConvertMulticastIP2MAC(pGroupIpAddr, (PUCHAR *)&pGroupMacAddr, ETH_P_IP); - DBGPRINT(RT_DEBUG_TRACE, ("IGMP Group=%02x:%02x:%02x:%02x:%02x:%02x\n", - GroupMacAddr[0], GroupMacAddr[1], GroupMacAddr[2], GroupMacAddr[3], GroupMacAddr[4], GroupMacAddr[5])); - MulticastFilterTableDeleteEntry(pAd, GroupMacAddr, pSrcMacAddr, pDev); - break; - - case IGMP_V3_MEMBERSHIP_REPORT: // IGMP version 3 membership report. - numOfGroup = ntohs(*((UINT16 *)(pIgmpHeader + 6))); - pGroup = (PUCHAR)(pIgmpHeader + 8); - for (i=0; i < numOfGroup; i++) - { - GroupType = (UCHAR)(*pGroup); - AuxDataLen = (UCHAR)(*(pGroup + 1)); - numOfSources = ntohs(*((UINT16 *)(pGroup + 2))); - pGroupIpAddr = (PUCHAR)(pGroup + 4); - DBGPRINT(RT_DEBUG_TRACE, ("IGMPv3 Type=%d, ADL=%d, numOfSource=%d\n", GroupType, AuxDataLen, numOfSources)); - ConvertMulticastIP2MAC(pGroupIpAddr, (PUCHAR *)&pGroupMacAddr, ETH_P_IP); - DBGPRINT(RT_DEBUG_TRACE, ("IGMP Group=%02x:%02x:%02x:%02x:%02x:%02x\n", - GroupMacAddr[0], GroupMacAddr[1], GroupMacAddr[2], GroupMacAddr[3], GroupMacAddr[4], GroupMacAddr[5])); - - do - { - if((GroupType == MODE_IS_EXCLUDE) || (GroupType == CHANGE_TO_EXCLUDE_MODE) || (GroupType == ALLOW_NEW_SOURCES)) - { - MulticastFilterTableInsertEntry(pAd, GroupMacAddr, pSrcMacAddr, pDev, MCAT_FILTER_DYNAMIC); - break; - } - - if((GroupType == MODE_IS_INCLUDE) || (GroupType == BLOCK_OLD_SOURCES)) - { - MulticastFilterTableDeleteEntry(pAd, GroupMacAddr, pSrcMacAddr, pDev); - break; - } - - if((GroupType == CHANGE_TO_INCLUDE_MODE)) - { - if(numOfSources == 0) - MulticastFilterTableDeleteEntry(pAd, GroupMacAddr, pSrcMacAddr, pDev); - else - MulticastFilterTableInsertEntry(pAd, GroupMacAddr, pSrcMacAddr, pDev, MCAT_FILTER_DYNAMIC); - break; - } - } while(FALSE); - pGroup += (8 + (numOfSources * 4) + AuxDataLen); - } - break; - - default: - DBGPRINT(RT_DEBUG_TRACE, ("unknow IGMP Type=%d\n", IgmpVerType)); - break; - } - } - - return; -} - - -static BOOLEAN isIgmpMacAddr( - IN PUCHAR pMacAddr) -{ - if((pMacAddr[0] == 0x01) - && (pMacAddr[1] == 0x00) - && (pMacAddr[2] == 0x5e)) - return TRUE; - return FALSE; -} - -BOOLEAN isIgmpPkt( - IN PUCHAR pDstMacAddr, - IN PUCHAR pIpHeader) -{ - UINT16 IpProtocol = ntohs(*((UINT16 *)(pIpHeader))); - UCHAR IgmpProtocol; - - if(!isIgmpMacAddr(pDstMacAddr)) - return FALSE; - - if(IpProtocol == ETH_P_IP) - { - IgmpProtocol = (UCHAR)*(pIpHeader + 11); - if(IgmpProtocol == IGMP_PROTOCOL_DESCRIPTOR) - return TRUE; - } - - return FALSE; -} - -static VOID InsertIgmpMember( - IN PMULTICAST_FILTER_TABLE pMulticastFilterTable, - IN PLIST_HEADER pList, - IN PUCHAR pMemberAddr) -{ - PMEMBER_ENTRY pMemberEntry; - - if(pList == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: membert list doesn't exist.\n", __FUNCTION__)); - return; - } - - if (pMemberAddr == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: invalid member.\n", __FUNCTION__)); - return; - } - - if((pMemberEntry = (PMEMBER_ENTRY)AllocaGrpMemberEntry(pMulticastFilterTable)) != NULL) - { - NdisZeroMemory(pMemberEntry, sizeof(MEMBER_ENTRY)); - COPY_MAC_ADDR(pMemberEntry->Addr, pMemberAddr); - insertTailList(pList, (PLIST_ENTRY)pMemberEntry); - - DBGPRINT(RT_DEBUG_TRACE, ("%s Member Mac=%02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__, - pMemberEntry->Addr[0], pMemberEntry->Addr[1], pMemberEntry->Addr[2], - pMemberEntry->Addr[3], pMemberEntry->Addr[4], pMemberEntry->Addr[5])); - } - return; -} - -static VOID DeleteIgmpMember( - IN PMULTICAST_FILTER_TABLE pMulticastFilterTable, - IN PLIST_HEADER pList, - IN PUCHAR pMemberAddr) -{ - PMEMBER_ENTRY pCurEntry; - - if((pList == NULL) || (pList->pHead == NULL)) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: membert list doesn't exist.\n", __FUNCTION__)); - return; - } - - if (pMemberAddr == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: invalid member.\n", __FUNCTION__)); - return; - } - - pCurEntry = (PMEMBER_ENTRY)pList->pHead; - while (pCurEntry) - { - if(MAC_ADDR_EQUAL(pMemberAddr, pCurEntry->Addr)) - { - delEntryList(pList, (PLIST_ENTRY)pCurEntry); - FreeGrpMemberEntry(pMulticastFilterTable, pCurEntry); - break; - } - pCurEntry = pCurEntry->pNext; - } - - return; -} - -static VOID DeleteIgmpMemberList( - IN PMULTICAST_FILTER_TABLE pMulticastFilterTable, - IN PLIST_HEADER pList) -{ - PMEMBER_ENTRY pCurEntry, pPrvEntry; - - if((pList == NULL) || (pList->pHead == NULL)) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: membert list doesn't exist.\n", __FUNCTION__)); - return; - } - - pPrvEntry = pCurEntry = (PMEMBER_ENTRY)pList->pHead; - while (pCurEntry) - { - delEntryList(pList, (PLIST_ENTRY)pCurEntry); - pPrvEntry = pCurEntry; - pCurEntry = pCurEntry->pNext; - FreeGrpMemberEntry(pMulticastFilterTable, pPrvEntry); - } - - initList(pList); - return; -} - - -UCHAR IgmpMemberCnt( - IN PLIST_HEADER pList) -{ - if(pList == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: membert list doesn't exist.\n", __FUNCTION__)); - return 0; - } - - return getListSize(pList); -} - -VOID IgmpGroupDelMembers( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pMemberAddr, - IN PNET_DEV pDev) -{ - INT i; - MULTICAST_FILTER_TABLE_ENTRY *pEntry = NULL; - PMULTICAST_FILTER_TABLE pMulticastFilterTable = pAd->pMulticastFilterTable; - - for (i = 0; i < MAX_LEN_OF_MULTICAST_FILTER_TABLE; i++) - { - // pick up the first available vacancy - pEntry = &pMulticastFilterTable->Content[i]; - if (pEntry->Valid == TRUE) - { - if(pMemberAddr != NULL) - { - RTMP_SEM_LOCK(&pMulticastFilterTable->MulticastFilterTabLock); - DeleteIgmpMember(pMulticastFilterTable, &pEntry->MemberList, pMemberAddr); - RTMP_SEM_UNLOCK(&pMulticastFilterTable->MulticastFilterTabLock); - } - - if((pEntry->type == MCAT_FILTER_DYNAMIC) - && (IgmpMemberCnt(&pEntry->MemberList) == 0)) - MulticastFilterTableDeleteEntry(pAd, pEntry->Addr, pMemberAddr, pDev); - } - } -} - -INT Set_IgmpSn_Enable_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UINT Enable; - POS_COOKIE pObj; - UCHAR ifIndex; - PNET_DEV pDev; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - ifIndex = pObj->ioctl_if; - - pDev = (ifIndex == MAIN_MBSSID) ? (pAd->net_dev) : (pAd->ApCfg.MBSSID[ifIndex].MSSIDDev); - Enable = (UINT) simple_strtol(arg, 0, 10); - - pAd->ApCfg.MBSSID[ifIndex].IgmpSnoopEnable = (BOOLEAN)(Enable == 0 ? 0 : 1); - DBGPRINT(RT_DEBUG_TRACE, ("%s::(%s) %s\n", __FUNCTION__, RTMP_OS_NETDEV_GET_DEVNAME(pDev), Enable == TRUE ? "Enable IGMP Snooping":"Disable IGMP Snooping")); - - return TRUE; -} - -INT Set_IgmpSn_AddEntry_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - INT i; - BOOLEAN bGroupId = 1; - PSTRING value; - PSTRING thisChar; - UCHAR IpAddr[4]; - UCHAR Addr[ETH_LENGTH_OF_ADDRESS]; - UCHAR GroupId[ETH_LENGTH_OF_ADDRESS]; - PUCHAR *pAddr = (PUCHAR *)&Addr; - PNET_DEV pDev; - POS_COOKIE pObj; - UCHAR ifIndex; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - ifIndex = pObj->ioctl_if; - - pDev = (ifIndex == MAIN_MBSSID) ? (pAd->net_dev) : (pAd->ApCfg.MBSSID[ifIndex].MSSIDDev); - - while ((thisChar = strsep((char **)&arg, "-")) != NULL) - { - // refuse the Member if it's not a MAC address. - if((bGroupId == 0) && (strlen(thisChar) != 17)) - continue; - - if(strlen(thisChar) == 17) //Mac address acceptable format 01:02:03:04:05:06 length 17 - { - for (i=0, value = rstrtok(thisChar,":"); value; value = rstrtok(NULL,":")) - { - if((strlen(value) != 2) || (!isxdigit(*value)) || (!isxdigit(*(value+1))) ) - return FALSE; //Invalid - - AtoH(value, &Addr[i++], 1); - } - - if(i != 6) - return FALSE; //Invalid - } - else - { - for (i=0, value = rstrtok(thisChar,"."); value; value = rstrtok(NULL,".")) - { - if((strlen(value) > 0) && (strlen(value) <= 3)) - { - int ii; - for(ii=0; iiOS_Cookie; - ifIndex = pObj->ioctl_if; - - pDev = (ifIndex == MAIN_MBSSID) ? (pAd->net_dev) : (pAd->ApCfg.MBSSID[ifIndex].MSSIDDev); - - while ((thisChar = strsep((char **)&arg, "-")) != NULL) - { - // refuse the Member if it's not a MAC address. - if((bGroupId == 0) && (strlen(thisChar) != 17)) - continue; - - if(strlen(thisChar) == 17) //Mac address acceptable format 01:02:03:04:05:06 length 17 - { - for (i=0, value = rstrtok(thisChar,":"); value; value = rstrtok(NULL,":")) - { - if((strlen(value) != 2) || (!isxdigit(*value)) || (!isxdigit(*(value+1))) ) - return FALSE; //Invalid - - AtoH(value, &Addr[i++], 1); - } - - if(i != 6) - return FALSE; //Invalid - } - else - { - for (i=0, value = rstrtok(thisChar,"."); value; value = rstrtok(NULL,".")) - { - if((strlen(value) > 0) && (strlen(value) <= 3)) - { - int ii; - for(ii=0; ii 0 ) - MulticastFilterTableDeleteEntry(pAd, (PUCHAR)GroupId, Addr, pDev); - - bGroupId = 0; - } - - if(memberCnt == 0) - MulticastFilterTableDeleteEntry(pAd, (PUCHAR)GroupId, NULL, pDev); - - DBGPRINT(RT_DEBUG_TRACE, ("%s (%2X:%2X:%2X:%2X:%2X:%2X)\n", - __FUNCTION__, Addr[0], Addr[1], Addr[2], Addr[3], Addr[4], Addr[5])); - - return TRUE; -} - -INT Set_IgmpSn_TabDisplay_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - IGMPTableDisplay(pAd); - return TRUE; -} - -void rtmp_read_igmp_snoop_from_file( - IN PRTMP_ADAPTER pAd, - PSTRING tmpbuf, - PSTRING buffer) -{ - PSTRING macptr; - INT i=0; - - //IgmpSnEnable - if(RTMPGetKeyParameter("IgmpSnEnable", tmpbuf, 128, buffer, TRUE)) - { - for (i = 0, macptr = rstrtok(tmpbuf,";"); (macptr && i < pAd->ApCfg.BssidNum); macptr = rstrtok(NULL,";"), i++) - { - if ((strncmp(macptr, "0", 1) == 0)) - pAd->ApCfg.MBSSID[i].IgmpSnoopEnable = FALSE; - else if ((strncmp(macptr, "1", 1) == 0)) - pAd->ApCfg.MBSSID[i].IgmpSnoopEnable = TRUE; - else - pAd->ApCfg.MBSSID[i].IgmpSnoopEnable = FALSE; - - DBGPRINT(RT_DEBUG_TRACE, ("MBSSID[%d].Enable=%d\n", i, pAd->ApCfg.MBSSID[i].IgmpSnoopEnable)); - } - } -} - -NDIS_STATUS IgmpPktInfoQuery( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pSrcBufVA, - IN PNDIS_PACKET pPacket, - IN UCHAR apidx, - OUT BOOLEAN *pInIgmpGroup, - OUT PMULTICAST_FILTER_TABLE_ENTRY *ppGroupEntry) -{ - if(IS_MULTICAST_MAC_ADDR(pSrcBufVA)) - { - BOOLEAN IgmpMldPkt = FALSE; - PUCHAR pIpHeader = pSrcBufVA + 12; - - if(ntohs(*((UINT16 *)(pIpHeader))) == ETH_P_IPV6) - IgmpMldPkt = isMldPkt(pSrcBufVA, pIpHeader, NULL, NULL); - else - IgmpMldPkt = isIgmpPkt(pSrcBufVA, pIpHeader); - - if (IgmpMldPkt) - { - *ppGroupEntry = NULL; - } - else if ((*ppGroupEntry = MulticastFilterTableLookup(pAd->pMulticastFilterTable, pSrcBufVA, - pAd->ApCfg.MBSSID[apidx].MSSIDDev)) == NULL) - { - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - return NDIS_STATUS_FAILURE; - } - *pInIgmpGroup = TRUE; - } - else if (IS_BROADCAST_MAC_ADDR(pSrcBufVA)) - { - PUCHAR pDstIpAddr = pSrcBufVA + 30; // point to Destination of Ip address of IP header. - UCHAR GroupMacAddr[6]; - PUCHAR pGroupMacAddr = (PUCHAR)&GroupMacAddr; - - ConvertMulticastIP2MAC(pDstIpAddr, (PUCHAR *)&pGroupMacAddr, ETH_P_IP); - if ((*ppGroupEntry = MulticastFilterTableLookup(pAd->pMulticastFilterTable, pGroupMacAddr, - pAd->ApCfg.MBSSID[apidx].MSSIDDev)) != NULL) - { - *pInIgmpGroup = TRUE; - } - } - return NDIS_STATUS_SUCCESS; -} - -NDIS_STATUS IgmpPktClone( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN UCHAR QueIdx, - IN PMULTICAST_FILTER_TABLE_ENTRY pGroupEntry) -{ - PNDIS_PACKET pSkbClone = NULL; - PMEMBER_ENTRY pMemberEntry = (PMEMBER_ENTRY)pGroupEntry->MemberList.pHead; - MAC_TABLE_ENTRY *pMacEntry = NULL; - USHORT Aid; - SST Sst = SST_ASSOC; - UCHAR PsMode = PWR_ACTIVE; - UCHAR Rate; - unsigned long IrqFlags; - - // check all members of the IGMP group. - while(pMemberEntry != NULL) - { - pMacEntry = APSsPsInquiry(pAd, pMemberEntry->Addr, &Sst, &Aid, &PsMode, &Rate); - - if (pMacEntry && (Sst == SST_ASSOC) && (PsMode != PWR_SAVE)) - { - pSkbClone = skb_clone(RTPKT_TO_OSPKT(pPacket), MEM_ALLOC_FLAG); - if(pSkbClone) - { - RTMP_SET_PACKET_WCID(pSkbClone, (UCHAR)Aid); - // Pkt type must set to PKTSRC_NDIS. - // It cause of the deason that APHardTransmit() - // doesn't handle PKTSRC_DRIVER pkt type in version 1.3.0.0. - RTMP_SET_PACKET_SOURCE(pSkbClone, PKTSRC_NDIS); - } - else - { - pMemberEntry = pMemberEntry->pNext; - continue; - } - - // insert the pkt to TxSwQueue. - if (pAd->TxSwQueue[QueIdx].Number >= MAX_PACKETS_IN_QUEUE) - { -#ifdef BLOCK_NET_IF - StopNetIfQueue(pAd, QueIdx, pSkbClone); -#endif // BLOCK_NET_IF // - RELEASE_NDIS_PACKET(pAd, pSkbClone, NDIS_STATUS_FAILURE); - return NDIS_STATUS_FAILURE; - } - else - { - RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); - InsertTailQueueAc(pAd, pMacEntry, &pAd->TxSwQueue[QueIdx], PACKET_TO_QUEUE_ENTRY(pSkbClone)); - RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); - } - } - pMemberEntry = pMemberEntry->pNext; - } - return NDIS_STATUS_SUCCESS; -} - -static inline BOOLEAN isMldMacAddr( - IN PUCHAR pMacAddr) -{ - return ((pMacAddr[0] == 0x33) && (pMacAddr[1] == 0x33)) ? TRUE : FALSE; -} - -static inline BOOLEAN IsSupportedMldMsg( - IN UINT8 MsgType) -{ - BOOLEAN result = FALSE; - switch(MsgType) - { - case MLD_V1_LISTENER_REPORT: - case MLD_V1_LISTENER_DONE: - case MLD_V2_LISTERNER_REPORT: - result = TRUE; - break; - default: - result = FALSE; - break; - } - - return result; -} - -BOOLEAN isMldPkt( - IN PUCHAR pDstMacAddr, - IN PUCHAR pIpHeader, - OUT UINT8 *pProtoType, - OUT PUCHAR *pMldHeader) -{ - BOOLEAN result = FALSE; - UINT16 IpProtocol = ntohs(*((UINT16 *)(pIpHeader))); - - if(!isMldMacAddr(pDstMacAddr)) - return FALSE; - - if(IpProtocol != ETH_P_IPV6) - return FALSE; - - // skip protocol (2 Bytes). - pIpHeader += 2; - do - { - PRT_IPV6_HDR pIpv6Hdr = (PRT_IPV6_HDR)(pIpHeader); - UINT8 nextProtocol = pIpv6Hdr->nextHdr; - UINT32 offset = IPV6_HDR_LEN; - - while(nextProtocol != IPV6_NEXT_HEADER_ICMPV6) - { - if(IPv6ExtHdrHandle((RT_IPV6_EXT_HDR *)(pIpHeader + offset), &nextProtocol, &offset) == FALSE) - break; - } - - if(nextProtocol == IPV6_NEXT_HEADER_ICMPV6) - { - PRT_ICMPV6_HDR pICMPv6Hdr = (PRT_ICMPV6_HDR)(pIpHeader + offset); - if (IsSupportedMldMsg(pICMPv6Hdr->type) == TRUE) - { - if (pProtoType != NULL) - *pProtoType = pICMPv6Hdr->type; - if (pMldHeader != NULL) - *pMldHeader = (PUCHAR)pICMPv6Hdr; - result = TRUE; - } - } - }while(FALSE); - - return result; -} - -/* MLD v1 messages have the following format: - 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Type | Code | Checksum | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Maximum Response Delay | Reserved | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | | - + + - | | - + Multicast Address + - | | - + + - | | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -*/ - -/* Version 3 Membership Report Message - 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Type = 143 | Reserved | Checksum | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Reserved | Number of Group Records (M) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | | - . . - . Multicast Address Record [1] . - . . - | | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | | - . . - . Multicast Address Record [2] . - . . - | | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | . | - . . . - | . | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | | - . . - . Multicast Address Record [M] . - . . - | | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - - where each Group Record has the following internal format: - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Record Type | Aux Data Len | Number of Sources (N) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | | - * * - | | - * Multicast Address * - | | - * * - | | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | | - * * - | | - * Source Address [1] * - | | - * * - | | - +- -+ - | | - * * - | | - * Source Address [2] * - | | - * * - | | - +- -+ - . . . - . . . - . . . - +- -+ - | | - * * - | | - * Source Address [N] * - | | - * * - | | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | | - . . - . Auxiliary Data . - . . - | | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -*/ - -VOID MLDSnooping( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDstMacAddr, - IN PUCHAR pSrcMacAddr, - IN PUCHAR pIpHeader, - IN PNET_DEV pDev) -{ - INT i; - UCHAR GroupType; - UINT16 numOfGroup; - PUCHAR pGroup; - UCHAR AuxDataLen; - UINT16 numOfSources; - PUCHAR pGroupIpAddr; - UCHAR GroupMacAddr[6]; - PUCHAR pGroupMacAddr = (PUCHAR)&GroupMacAddr; - - UINT8 MldType; - PUCHAR pMldHeader; - - if(isMldPkt(pDstMacAddr, pIpHeader, &MldType, &pMldHeader) == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE, ("MLD type=%0x\n", MldType)); - - switch(MldType) - { - case MLD_V1_LISTENER_REPORT: - // skip Type(1 Byte), code(1 Byte), checksum(2 Bytes), Maximum Rsp Delay(2 Bytes), Reserve(2 Bytes). - pGroupIpAddr = (PUCHAR)(pMldHeader + 8); - ConvertMulticastIP2MAC(pGroupIpAddr, (PUCHAR *)&pGroupMacAddr, ETH_P_IPV6); - DBGPRINT(RT_DEBUG_TRACE, ("Group Id=%02x:%02x:%02x:%02x:%02x:%02x\n", - GroupMacAddr[0], GroupMacAddr[1], GroupMacAddr[2], GroupMacAddr[3], GroupMacAddr[4], GroupMacAddr[5])); - MulticastFilterTableInsertEntry(pAd, GroupMacAddr, pSrcMacAddr, pDev, MCAT_FILTER_DYNAMIC); - break; - - case MLD_V1_LISTENER_DONE: - // skip Type(1 Byte), code(1 Byte), checksum(2 Bytes), Maximum Rsp Delay(2 Bytes), Reserve(2 Bytes). - pGroupIpAddr = (PUCHAR)(pMldHeader + 8); - ConvertMulticastIP2MAC(pGroupIpAddr, (PUCHAR *)&pGroupMacAddr, ETH_P_IPV6); - DBGPRINT(RT_DEBUG_TRACE, ("Group Id=%02x:%02x:%02x:%02x:%02x:%02x\n", - GroupMacAddr[0], GroupMacAddr[1], GroupMacAddr[2], GroupMacAddr[3], GroupMacAddr[4], GroupMacAddr[5])); - MulticastFilterTableDeleteEntry(pAd, GroupMacAddr, pSrcMacAddr, pDev); - break; - - case MLD_V2_LISTERNER_REPORT: // IGMP version 3 membership report. - numOfGroup = ntohs(*((UINT16 *)(pMldHeader + 6))); - pGroup = (PUCHAR)(pMldHeader + 8); - for (i=0; i < numOfGroup; i++) - { - GroupType = (UCHAR)(*pGroup); - AuxDataLen = (UCHAR)(*(pGroup + 1)); - numOfSources = ntohs(*((UINT16 *)(pGroup + 2))); - pGroupIpAddr = (PUCHAR)(pGroup + 4); - DBGPRINT(RT_DEBUG_TRACE, ("MLDv2 Type=%d, ADL=%d, numOfSource=%d\n", GroupType, AuxDataLen, numOfSources)); - ConvertMulticastIP2MAC(pGroupIpAddr, (PUCHAR *)&pGroupMacAddr, ETH_P_IPV6); - DBGPRINT(RT_DEBUG_TRACE, ("MLD Group=%02x:%02x:%02x:%02x:%02x:%02x\n", - GroupMacAddr[0], GroupMacAddr[1], GroupMacAddr[2], GroupMacAddr[3], GroupMacAddr[4], GroupMacAddr[5])); - - do - { - if((GroupType == MODE_IS_EXCLUDE) || (GroupType == CHANGE_TO_EXCLUDE_MODE) || (GroupType == ALLOW_NEW_SOURCES)) - { - MulticastFilterTableInsertEntry(pAd, GroupMacAddr, pSrcMacAddr, pDev, MCAT_FILTER_DYNAMIC); - break; - } - - if((GroupType == MODE_IS_INCLUDE) || (GroupType == BLOCK_OLD_SOURCES)) - { - MulticastFilterTableDeleteEntry(pAd, GroupMacAddr, pSrcMacAddr, pDev); - break; - } - - if((GroupType == CHANGE_TO_INCLUDE_MODE)) - { - if(numOfSources == 0) - MulticastFilterTableDeleteEntry(pAd, GroupMacAddr, pSrcMacAddr, pDev); - else - MulticastFilterTableInsertEntry(pAd, GroupMacAddr, pSrcMacAddr, pDev, MCAT_FILTER_DYNAMIC); - break; - } - } while(FALSE); - // skip 4 Bytes (Record Type, Aux Data Len, Number of Sources) + a IPv6 address. - pGroup += (4 + IPV6_ADDR_LEN + (numOfSources * 16) + AuxDataLen); - } - break; - - default: - DBGPRINT(RT_DEBUG_TRACE, ("unknow MLD Type=%d\n", MldType)); - break; - } - } - - return; -} - - -#endif // IGMP_SNOOP_SUPPORT // diff --git a/drivers/staging/rt3090/common/mlme.c b/drivers/staging/rt3090/common/mlme.c deleted file mode 100644 index 1613c04c5932..000000000000 --- a/drivers/staging/rt3090/common/mlme.c +++ /dev/null @@ -1,6550 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - mlme.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - John Chang 2004-08-25 Modify from RT2500 code base - John Chang 2004-09-06 modified for RT2600 -*/ - -#include "../rt_config.h" -#include - -UCHAR CISCO_OUI[] = {0x00, 0x40, 0x96}; - -UCHAR WPA_OUI[] = {0x00, 0x50, 0xf2, 0x01}; -UCHAR RSN_OUI[] = {0x00, 0x0f, 0xac}; -UCHAR WAPI_OUI[] = {0x00, 0x14, 0x72}; -UCHAR WME_INFO_ELEM[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01}; -UCHAR WME_PARM_ELEM[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01}; -UCHAR Ccx2QosInfo[] = {0x00, 0x40, 0x96, 0x04}; -UCHAR RALINK_OUI[] = {0x00, 0x0c, 0x43}; -UCHAR BROADCOM_OUI[] = {0x00, 0x90, 0x4c}; -UCHAR WPS_OUI[] = {0x00, 0x50, 0xf2, 0x04}; -#ifdef CONFIG_STA_SUPPORT -#ifdef DOT11_N_SUPPORT -UCHAR PRE_N_HT_OUI[] = {0x00, 0x90, 0x4c}; -#endif // DOT11_N_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - -UCHAR RateSwitchTable[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x11, 0x00, 0, 0, 0, // Initial used item after association - 0x00, 0x00, 0, 40, 101, - 0x01, 0x00, 1, 40, 50, - 0x02, 0x00, 2, 35, 45, - 0x03, 0x00, 3, 20, 45, - 0x04, 0x21, 0, 30, 50, - 0x05, 0x21, 1, 20, 50, - 0x06, 0x21, 2, 20, 50, - 0x07, 0x21, 3, 15, 50, - 0x08, 0x21, 4, 15, 30, - 0x09, 0x21, 5, 10, 25, - 0x0a, 0x21, 6, 8, 25, - 0x0b, 0x21, 7, 8, 25, - 0x0c, 0x20, 12, 15, 30, - 0x0d, 0x20, 13, 8, 20, - 0x0e, 0x20, 14, 8, 20, - 0x0f, 0x20, 15, 8, 25, - 0x10, 0x22, 15, 8, 25, - 0x11, 0x00, 0, 0, 0, - 0x12, 0x00, 0, 0, 0, - 0x13, 0x00, 0, 0, 0, - 0x14, 0x00, 0, 0, 0, - 0x15, 0x00, 0, 0, 0, - 0x16, 0x00, 0, 0, 0, - 0x17, 0x00, 0, 0, 0, - 0x18, 0x00, 0, 0, 0, - 0x19, 0x00, 0, 0, 0, - 0x1a, 0x00, 0, 0, 0, - 0x1b, 0x00, 0, 0, 0, - 0x1c, 0x00, 0, 0, 0, - 0x1d, 0x00, 0, 0, 0, - 0x1e, 0x00, 0, 0, 0, - 0x1f, 0x00, 0, 0, 0, -}; - -UCHAR RateSwitchTable11B[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x04, 0x03, 0, 0, 0, // Initial used item after association - 0x00, 0x00, 0, 40, 101, - 0x01, 0x00, 1, 40, 50, - 0x02, 0x00, 2, 35, 45, - 0x03, 0x00, 3, 20, 45, -}; - -UCHAR RateSwitchTable11BG[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0a, 0x00, 0, 0, 0, // Initial used item after association - 0x00, 0x00, 0, 40, 101, - 0x01, 0x00, 1, 40, 50, - 0x02, 0x00, 2, 35, 45, - 0x03, 0x00, 3, 20, 45, - 0x04, 0x10, 2, 20, 35, - 0x05, 0x10, 3, 16, 35, - 0x06, 0x10, 4, 10, 25, - 0x07, 0x10, 5, 16, 25, - 0x08, 0x10, 6, 10, 25, - 0x09, 0x10, 7, 10, 13, -}; - -UCHAR RateSwitchTable11G[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x08, 0x00, 0, 0, 0, // Initial used item after association - 0x00, 0x10, 0, 20, 101, - 0x01, 0x10, 1, 20, 35, - 0x02, 0x10, 2, 20, 35, - 0x03, 0x10, 3, 16, 35, - 0x04, 0x10, 4, 10, 25, - 0x05, 0x10, 5, 16, 25, - 0x06, 0x10, 6, 10, 25, - 0x07, 0x10, 7, 10, 13, -}; - -#ifdef DOT11_N_SUPPORT -UCHAR RateSwitchTable11N1S[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0c, 0x0a, 0, 0, 0, // Initial used item after association - 0x00, 0x00, 0, 40, 101, - 0x01, 0x00, 1, 40, 50, - 0x02, 0x00, 2, 25, 45, - 0x03, 0x21, 0, 20, 35, - 0x04, 0x21, 1, 20, 35, - 0x05, 0x21, 2, 20, 35, - 0x06, 0x21, 3, 15, 35, - 0x07, 0x21, 4, 15, 30, - 0x08, 0x21, 5, 10, 25, - 0x09, 0x21, 6, 8, 14, - 0x0a, 0x21, 7, 8, 14, - 0x0b, 0x23, 7, 8, 14, -}; - -UCHAR RateSwitchTable11N2S[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0e, 0x0c, 0, 0, 0, // Initial used item after association - 0x00, 0x00, 0, 40, 101, - 0x01, 0x00, 1, 40, 50, - 0x02, 0x00, 2, 25, 45, - 0x03, 0x21, 0, 20, 35, - 0x04, 0x21, 1, 20, 35, - 0x05, 0x21, 2, 20, 35, - 0x06, 0x21, 3, 15, 35, - 0x07, 0x21, 4, 15, 30, - 0x08, 0x20, 11, 15, 30, - 0x09, 0x20, 12, 15, 30, - 0x0a, 0x20, 13, 8, 20, - 0x0b, 0x20, 14, 8, 20, - 0x0c, 0x20, 15, 8, 25, - 0x0d, 0x22, 15, 8, 15, -}; - -UCHAR RateSwitchTable11N3S[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0b, 0x00, 0, 0, 0, // 0x0a, 0x00, 0, 0, 0, // Initial used item after association - 0x00, 0x21, 0, 30, 101, - 0x01, 0x21, 1, 20, 50, - 0x02, 0x21, 2, 20, 50, - 0x03, 0x21, 3, 15, 50, - 0x04, 0x21, 4, 15, 30, - 0x05, 0x20, 11, 15, 30, // Required by System-Alan @ 20080812 - 0x06, 0x20, 12, 15, 30, // 0x05, 0x20, 12, 15, 30, - 0x07, 0x20, 13, 8, 20, // 0x06, 0x20, 13, 8, 20, - 0x08, 0x20, 14, 8, 20, // 0x07, 0x20, 14, 8, 20, - 0x09, 0x20, 15, 8, 25, // 0x08, 0x20, 15, 8, 25, - 0x0a, 0x22, 15, 8, 25, // 0x09, 0x22, 15, 8, 25, -}; - -UCHAR RateSwitchTable11N2SForABand[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0b, 0x09, 0, 0, 0, // Initial used item after association - 0x00, 0x21, 0, 30, 101, - 0x01, 0x21, 1, 20, 50, - 0x02, 0x21, 2, 20, 50, - 0x03, 0x21, 3, 15, 50, - 0x04, 0x21, 4, 15, 30, - 0x05, 0x21, 5, 15, 30, - 0x06, 0x20, 12, 15, 30, - 0x07, 0x20, 13, 8, 20, - 0x08, 0x20, 14, 8, 20, - 0x09, 0x20, 15, 8, 25, - 0x0a, 0x22, 15, 8, 25, -}; - -UCHAR RateSwitchTable11N3SForABand[] = { // 3*3 -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0b, 0x09, 0, 0, 0, // Initial used item after association - 0x00, 0x21, 0, 30, 101, - 0x01, 0x21, 1, 20, 50, - 0x02, 0x21, 2, 20, 50, - 0x03, 0x21, 3, 15, 50, - 0x04, 0x21, 4, 15, 30, - 0x05, 0x21, 5, 15, 30, - 0x06, 0x20, 12, 15, 30, - 0x07, 0x20, 13, 8, 20, - 0x08, 0x20, 14, 8, 20, - 0x09, 0x20, 15, 8, 25, - 0x0a, 0x22, 15, 8, 25, -}; - -UCHAR RateSwitchTable11BGN1S[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0c, 0x0a, 0, 0, 0, // Initial used item after association - 0x00, 0x00, 0, 40, 101, - 0x01, 0x00, 1, 40, 50, - 0x02, 0x00, 2, 25, 45, - 0x03, 0x21, 0, 20, 35, - 0x04, 0x21, 1, 20, 35, - 0x05, 0x21, 2, 20, 35, - 0x06, 0x21, 3, 15, 35, - 0x07, 0x21, 4, 15, 30, - 0x08, 0x21, 5, 10, 25, - 0x09, 0x21, 6, 8, 14, - 0x0a, 0x21, 7, 8, 14, - 0x0b, 0x23, 7, 8, 14, -}; - -UCHAR RateSwitchTable11BGN2S[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0e, 0x0c, 0, 0, 0, // Initial used item after association - 0x00, 0x00, 0, 40, 101, - 0x01, 0x00, 1, 40, 50, - 0x02, 0x00, 2, 25, 45, - 0x03, 0x21, 0, 20, 35, - 0x04, 0x21, 1, 20, 35, - 0x05, 0x21, 2, 20, 35, - 0x06, 0x21, 3, 15, 35, - 0x07, 0x21, 4, 15, 30, - 0x08, 0x20, 11, 15, 30, - 0x09, 0x20, 12, 15, 30, - 0x0a, 0x20, 13, 8, 20, - 0x0b, 0x20, 14, 8, 20, - 0x0c, 0x20, 15, 8, 25, - 0x0d, 0x22, 15, 8, 15, -}; - -UCHAR RateSwitchTable11BGN3S[] = { // 3*3 -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0a, 0x00, 0, 0, 0, // Initial used item after association - 0x00, 0x21, 0, 30,101, //50 - 0x01, 0x21, 1, 20, 50, - 0x02, 0x21, 2, 20, 50, - 0x03, 0x21, 3, 20, 50, - 0x04, 0x21, 4, 15, 50, - 0x05, 0x20, 20, 15, 30, - 0x06, 0x20, 21, 8, 20, - 0x07, 0x20, 22, 8, 20, - 0x08, 0x20, 23, 8, 25, - 0x09, 0x22, 23, 8, 25, -}; - -UCHAR RateSwitchTable11BGN2SForABand[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0b, 0x09, 0, 0, 0, // Initial used item after association - 0x00, 0x21, 0, 30,101, //50 - 0x01, 0x21, 1, 20, 50, - 0x02, 0x21, 2, 20, 50, - 0x03, 0x21, 3, 15, 50, - 0x04, 0x21, 4, 15, 30, - 0x05, 0x21, 5, 15, 30, - 0x06, 0x20, 12, 15, 30, - 0x07, 0x20, 13, 8, 20, - 0x08, 0x20, 14, 8, 20, - 0x09, 0x20, 15, 8, 25, - 0x0a, 0x22, 15, 8, 25, -}; - -UCHAR RateSwitchTable11BGN3SForABand[] = { // 3*3 -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0c, 0x09, 0, 0, 0, // Initial used item after association - 0x00, 0x21, 0, 30,101, //50 - 0x01, 0x21, 1, 20, 50, - 0x02, 0x21, 2, 20, 50, - 0x03, 0x21, 3, 15, 50, - 0x04, 0x21, 4, 15, 30, - 0x05, 0x21, 5, 15, 30, - 0x06, 0x21, 12, 15, 30, - 0x07, 0x20, 20, 15, 30, - 0x08, 0x20, 21, 8, 20, - 0x09, 0x20, 22, 8, 20, - 0x0a, 0x20, 23, 8, 25, - 0x0b, 0x22, 23, 8, 25, -}; -#endif // DOT11_N_SUPPORT // - - -extern UCHAR OfdmRateToRxwiMCS[]; -// since RT61 has better RX sensibility, we have to limit TX ACK rate not to exceed our normal data TX rate. -// otherwise the WLAN peer may not be able to receive the ACK thus downgrade its data TX rate -ULONG BasicRateMask[12] = {0xfffff001 /* 1-Mbps */, 0xfffff003 /* 2 Mbps */, 0xfffff007 /* 5.5 */, 0xfffff00f /* 11 */, - 0xfffff01f /* 6 */ , 0xfffff03f /* 9 */ , 0xfffff07f /* 12 */ , 0xfffff0ff /* 18 */, - 0xfffff1ff /* 24 */ , 0xfffff3ff /* 36 */ , 0xfffff7ff /* 48 */ , 0xffffffff /* 54 */}; - -UCHAR BROADCAST_ADDR[MAC_ADDR_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; -UCHAR ZERO_MAC_ADDR[MAC_ADDR_LEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -// e.g. RssiSafeLevelForTxRate[RATE_36]" means if the current RSSI is greater than -// this value, then it's quaranteed capable of operating in 36 mbps TX rate in -// clean environment. -// TxRate: 1 2 5.5 11 6 9 12 18 24 36 48 54 72 100 -CHAR RssiSafeLevelForTxRate[] ={ -92, -91, -90, -87, -88, -86, -85, -83, -81, -78, -72, -71, -40, -40 }; - -UCHAR RateIdToMbps[] = { 1, 2, 5, 11, 6, 9, 12, 18, 24, 36, 48, 54, 72, 100}; -USHORT RateIdTo500Kbps[] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108, 144, 200}; - -UCHAR SsidIe = IE_SSID; -UCHAR SupRateIe = IE_SUPP_RATES; -UCHAR ExtRateIe = IE_EXT_SUPP_RATES; -#ifdef DOT11_N_SUPPORT -UCHAR HtCapIe = IE_HT_CAP; -UCHAR AddHtInfoIe = IE_ADD_HT; -UCHAR NewExtChanIe = IE_SECONDARY_CH_OFFSET; -#ifdef DOT11N_DRAFT3 -UCHAR ExtHtCapIe = IE_EXT_CAPABILITY; -#endif // DOT11N_DRAFT3 // -#endif // DOT11_N_SUPPORT // -UCHAR ErpIe = IE_ERP; -UCHAR DsIe = IE_DS_PARM; -UCHAR TimIe = IE_TIM; -UCHAR WpaIe = IE_WPA; -UCHAR Wpa2Ie = IE_WPA2; -UCHAR IbssIe = IE_IBSS_PARM; -UCHAR Ccx2Ie = IE_CCX_V2; -UCHAR WapiIe = IE_WAPI; - -extern UCHAR WPA_OUI[]; - -UCHAR SES_OUI[] = {0x00, 0x90, 0x4c}; - -UCHAR ZeroSsid[32] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; - - -/* - ========================================================================== - Description: - initialize the MLME task and its data structure (queue, spinlock, - timer, state machines). - - IRQL = PASSIVE_LEVEL - - Return: - always return NDIS_STATUS_SUCCESS - - ========================================================================== -*/ -NDIS_STATUS MlmeInit( - IN PRTMP_ADAPTER pAd) -{ - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - - DBGPRINT(RT_DEBUG_TRACE, ("--> MLME Initialize\n")); - - do - { - Status = MlmeQueueInit(&pAd->Mlme.Queue); - if(Status != NDIS_STATUS_SUCCESS) - break; - - pAd->Mlme.bRunning = FALSE; - NdisAllocateSpinLock(&pAd->Mlme.TaskLock); - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - BssTableInit(&pAd->ScanTab); - - // init STA state machines - AssocStateMachineInit(pAd, &pAd->Mlme.AssocMachine, pAd->Mlme.AssocFunc); - AuthStateMachineInit(pAd, &pAd->Mlme.AuthMachine, pAd->Mlme.AuthFunc); - AuthRspStateMachineInit(pAd, &pAd->Mlme.AuthRspMachine, pAd->Mlme.AuthRspFunc); - SyncStateMachineInit(pAd, &pAd->Mlme.SyncMachine, pAd->Mlme.SyncFunc); - -#ifdef QOS_DLS_SUPPORT - DlsStateMachineInit(pAd, &pAd->Mlme.DlsMachine, pAd->Mlme.DlsFunc); -#endif // QOS_DLS_SUPPORT // - - - - // Since we are using switch/case to implement it, the init is different from the above - // state machine init - MlmeCntlInit(pAd, &pAd->Mlme.CntlMachine, NULL); - } -#endif // CONFIG_STA_SUPPORT // - - - WpaStateMachineInit(pAd, &pAd->Mlme.WpaMachine, pAd->Mlme.WpaFunc); - - - ActionStateMachineInit(pAd, &pAd->Mlme.ActMachine, pAd->Mlme.ActFunc); - - // Init mlme periodic timer - RTMPInitTimer(pAd, &pAd->Mlme.PeriodicTimer, GET_TIMER_FUNCTION(MlmePeriodicExec), pAd, TRUE); - - // Set mlme periodic timer - RTMPSetTimer(&pAd->Mlme.PeriodicTimer, MLME_TASK_EXEC_INTV); - - // software-based RX Antenna diversity - RTMPInitTimer(pAd, &pAd->Mlme.RxAntEvalTimer, GET_TIMER_FUNCTION(AsicRxAntEvalTimeout), pAd, FALSE); - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { -#ifdef RTMP_PCI_SUPPORT - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - // only PCIe cards need these two timers - RTMPInitTimer(pAd, &pAd->Mlme.PsPollTimer, GET_TIMER_FUNCTION(PsPollWakeExec), pAd, FALSE); - RTMPInitTimer(pAd, &pAd->Mlme.RadioOnOffTimer, GET_TIMER_FUNCTION(RadioOnExec), pAd, FALSE); - } -#endif // RTMP_PCI_SUPPORT // - - RTMPInitTimer(pAd, &pAd->Mlme.LinkDownTimer, GET_TIMER_FUNCTION(LinkDownExec), pAd, FALSE); - - } -#endif // CONFIG_STA_SUPPORT // - - } while (FALSE); - - DBGPRINT(RT_DEBUG_TRACE, ("<-- MLME Initialize\n")); - - return Status; -} - -/* - ========================================================================== - Description: - main loop of the MLME - Pre: - Mlme has to be initialized, and there are something inside the queue - Note: - This function is invoked from MPSetInformation and MPReceive; - This task guarantee only one MlmeHandler will run. - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID MlmeHandler( - IN PRTMP_ADAPTER pAd) -{ - MLME_QUEUE_ELEM *Elem = NULL; -#ifdef APCLI_SUPPORT - SHORT apcliIfIndex; -#endif // APCLI_SUPPORT // - - // Only accept MLME and Frame from peer side, no other (control/data) frame should - // get into this state machine - - NdisAcquireSpinLock(&pAd->Mlme.TaskLock); - if(pAd->Mlme.bRunning) - { - NdisReleaseSpinLock(&pAd->Mlme.TaskLock); - return; - } - else - { - pAd->Mlme.bRunning = TRUE; - } - NdisReleaseSpinLock(&pAd->Mlme.TaskLock); - - while (!MlmeQueueEmpty(&pAd->Mlme.Queue)) - { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_MLME_RESET_IN_PROGRESS) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) - { - DBGPRINT(RT_DEBUG_TRACE, ("Device Halted or Removed or MlmeRest, exit MlmeHandler! (queue num = %ld)\n", pAd->Mlme.Queue.Num)); - break; - } - -#ifdef RALINK_ATE - if(ATE_ON(pAd)) - { - DBGPRINT(RT_DEBUG_TRACE, ("The driver is in ATE mode now in MlmeHandler\n")); - break; - } -#endif // RALINK_ATE // - - //From message type, determine which state machine I should drive - if (MlmeDequeue(&pAd->Mlme.Queue, &Elem)) - { - - // if dequeue success - switch (Elem->Machine) - { - // STA state machines -#ifdef CONFIG_STA_SUPPORT - case ASSOC_STATE_MACHINE: - StateMachinePerformAction(pAd, &pAd->Mlme.AssocMachine, Elem); - break; - case AUTH_STATE_MACHINE: - StateMachinePerformAction(pAd, &pAd->Mlme.AuthMachine, Elem); - break; - case AUTH_RSP_STATE_MACHINE: - StateMachinePerformAction(pAd, &pAd->Mlme.AuthRspMachine, Elem); - break; - case SYNC_STATE_MACHINE: - StateMachinePerformAction(pAd, &pAd->Mlme.SyncMachine, Elem); - break; - case MLME_CNTL_STATE_MACHINE: - MlmeCntlMachinePerformAction(pAd, &pAd->Mlme.CntlMachine, Elem); - break; - case WPA_PSK_STATE_MACHINE: - StateMachinePerformAction(pAd, &pAd->Mlme.WpaPskMachine, Elem); - break; - -#ifdef QOS_DLS_SUPPORT - case DLS_STATE_MACHINE: - StateMachinePerformAction(pAd, &pAd->Mlme.DlsMachine, Elem); - break; -#endif // QOS_DLS_SUPPORT // - -#endif // CONFIG_STA_SUPPORT // - - case ACTION_STATE_MACHINE: - StateMachinePerformAction(pAd, &pAd->Mlme.ActMachine, Elem); - break; - - case WPA_STATE_MACHINE: - StateMachinePerformAction(pAd, &pAd->Mlme.WpaMachine, Elem); - break; - - - default: - DBGPRINT(RT_DEBUG_TRACE, ("ERROR: Illegal machine %ld in MlmeHandler()\n", Elem->Machine)); - break; - } // end of switch - - // free MLME element - Elem->Occupied = FALSE; - Elem->MsgLen = 0; - - } - else { - DBGPRINT_ERR(("MlmeHandler: MlmeQueue empty\n")); - } - } - - NdisAcquireSpinLock(&pAd->Mlme.TaskLock); - pAd->Mlme.bRunning = FALSE; - NdisReleaseSpinLock(&pAd->Mlme.TaskLock); -} - -/* - ========================================================================== - Description: - Destructor of MLME (Destroy queue, state machine, spin lock and timer) - Parameters: - Adapter - NIC Adapter pointer - Post: - The MLME task will no longer work properly - - IRQL = PASSIVE_LEVEL - - ========================================================================== - */ -VOID MlmeHalt( - IN PRTMP_ADAPTER pAd) -{ - BOOLEAN Cancelled; - - DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeHalt\n")); - - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) - { - // disable BEACON generation and other BEACON related hardware timers - AsicDisableSync(pAd); - } - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { -#ifdef QOS_DLS_SUPPORT - UCHAR i; -#endif // QOS_DLS_SUPPORT // - // Cancel pending timers - RTMPCancelTimer(&pAd->MlmeAux.AssocTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.ReassocTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.DisassocTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.AuthTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &Cancelled); - - -#ifdef RTMP_MAC_PCI - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) - &&(pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); - } -#endif // RTMP_MAC_PCI // - -#ifdef QOS_DLS_SUPPORT - for (i=0; iStaCfg.DLSEntry[i].Timer, &Cancelled); - } -#endif // QOS_DLS_SUPPORT // - RTMPCancelTimer(&pAd->Mlme.LinkDownTimer, &Cancelled); - - } -#endif // CONFIG_STA_SUPPORT // - - RTMPCancelTimer(&pAd->Mlme.PeriodicTimer, &Cancelled); - RTMPCancelTimer(&pAd->Mlme.RxAntEvalTimer, &Cancelled); - - - - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) - { - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; - - // Set LED - RTMPSetLED(pAd, LED_HALT); - RTMPSetSignalLED(pAd, -100); // Force signal strength Led to be turned off, firmware is not done it. - - if (pChipOps->AsicHaltAction) - pChipOps->AsicHaltAction(pAd); - } - - RTMPusecDelay(5000); // 5 msec to gurantee Ant Diversity timer canceled - - MlmeQueueDestroy(&pAd->Mlme.Queue); - NdisFreeSpinLock(&pAd->Mlme.TaskLock); - - DBGPRINT(RT_DEBUG_TRACE, ("<== MlmeHalt\n")); -} - -VOID MlmeResetRalinkCounters( - IN PRTMP_ADAPTER pAd) -{ - pAd->RalinkCounters.LastOneSecRxOkDataCnt = pAd->RalinkCounters.OneSecRxOkDataCnt; - // clear all OneSecxxx counters. - pAd->RalinkCounters.OneSecBeaconSentCnt = 0; - pAd->RalinkCounters.OneSecFalseCCACnt = 0; - pAd->RalinkCounters.OneSecRxFcsErrCnt = 0; - pAd->RalinkCounters.OneSecRxOkCnt = 0; - pAd->RalinkCounters.OneSecTxFailCount = 0; - pAd->RalinkCounters.OneSecTxNoRetryOkCount = 0; - pAd->RalinkCounters.OneSecTxRetryOkCount = 0; - pAd->RalinkCounters.OneSecRxOkDataCnt = 0; - pAd->RalinkCounters.OneSecReceivedByteCount = 0; - pAd->RalinkCounters.OneSecTransmittedByteCount = 0; - - // TODO: for debug only. to be removed - pAd->RalinkCounters.OneSecOsTxCount[QID_AC_BE] = 0; - pAd->RalinkCounters.OneSecOsTxCount[QID_AC_BK] = 0; - pAd->RalinkCounters.OneSecOsTxCount[QID_AC_VI] = 0; - pAd->RalinkCounters.OneSecOsTxCount[QID_AC_VO] = 0; - pAd->RalinkCounters.OneSecDmaDoneCount[QID_AC_BE] = 0; - pAd->RalinkCounters.OneSecDmaDoneCount[QID_AC_BK] = 0; - pAd->RalinkCounters.OneSecDmaDoneCount[QID_AC_VI] = 0; - pAd->RalinkCounters.OneSecDmaDoneCount[QID_AC_VO] = 0; - pAd->RalinkCounters.OneSecTxDoneCount = 0; - pAd->RalinkCounters.OneSecRxCount = 0; - pAd->RalinkCounters.OneSecTxAggregationCount = 0; - pAd->RalinkCounters.OneSecRxAggregationCount = 0; - - return; -} - - -/* - ========================================================================== - Description: - This routine is executed periodically to - - 1. Decide if it's a right time to turn on PwrMgmt bit of all - outgoiing frames - 2. Calculate ChannelQuality based on statistics of the last - period, so that TX rate won't toggling very frequently between a - successful TX and a failed TX. - 3. If the calculated ChannelQuality indicated current connection not - healthy, then a ROAMing attempt is tried here. - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -#define ADHOC_BEACON_LOST_TIME (8*OS_HZ) // 8 sec -VOID MlmePeriodicExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - ULONG TxTotalCnt; - PRTMP_ADAPTER pAd = (RTMP_ADAPTER *)FunctionContext; - SHORT realavgrssi; - -#ifdef CONFIG_STA_SUPPORT -#ifdef RTMP_MAC_PCI - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // If Hardware controlled Radio enabled, we have to check GPIO pin2 every 2 second. - // Move code to here, because following code will return when radio is off - if ((pAd->Mlme.PeriodicRound % (MLME_TASK_EXEC_MULTIPLE * 2) == 0) && (pAd->StaCfg.bHardwareRadio == TRUE) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) - /*&&(pAd->bPCIclkOff == FALSE)*/) - { - UINT32 data = 0; - - // Read GPIO pin2 as Hardware controlled radio state -#ifndef RT3090 - RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &data); -#endif // RT3090 // -//KH(PCIE PS):Added based on Jane<-- -#ifdef RT3090 -// Read GPIO pin2 as Hardware controlled radio state -// We need to Read GPIO if HW said so no mater what advance power saving -if ((pAd->OpMode == OPMODE_STA) && (IDLE_ON(pAd)) - && (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF)) - && (pAd->StaCfg.PSControl.field.EnablePSinIdle == TRUE)) - { - // Want to make sure device goes to L0 state before reading register. - RTMPPCIeLinkCtrlValueRestore(pAd, 0); - RTMP_IO_FORCE_READ32(pAd, GPIO_CTRL_CFG, &data); - RTMPPCIeLinkCtrlSetting(pAd, 3); - } -else - RTMP_IO_FORCE_READ32(pAd, GPIO_CTRL_CFG, &data); -#endif // RT3090 // -//KH(PCIE PS):Added based on Jane--> - - if (data & 0x04) - { - pAd->StaCfg.bHwRadio = TRUE; - } - else - { - pAd->StaCfg.bHwRadio = FALSE; - } - if (pAd->StaCfg.bRadio != (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio)) - { - pAd->StaCfg.bRadio = (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio); - if (pAd->StaCfg.bRadio == TRUE) - { - MlmeRadioOn(pAd); - // Update extra information - pAd->ExtraInfo = EXTRA_INFO_CLEAR; - } - else - { - MlmeRadioOff(pAd); - // Update extra information - pAd->ExtraInfo = HW_RADIO_OFF; - } - } - } - } -#endif // RTMP_MAC_PCI // -#endif // CONFIG_STA_SUPPORT // - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_RADIO_OFF | - fRTMP_ADAPTER_RADIO_MEASUREMENT | - fRTMP_ADAPTER_RESET_IN_PROGRESS)))) - return; - - RTMP_MLME_PRE_SANITY_CHECK(pAd); - -#ifdef RALINK_ATE - /* Do not show RSSI until "Normal 1 second Mlme PeriodicExec". */ - if (ATE_ON(pAd)) - { - if (pAd->Mlme.PeriodicRound % MLME_TASK_EXEC_MULTIPLE != (MLME_TASK_EXEC_MULTIPLE - 1)) - { - pAd->Mlme.PeriodicRound ++; - return; - } - } -#endif // RALINK_ATE // - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // Do nothing if monitor mode is on - if (MONITOR_ON(pAd)) - return; - - if (pAd->Mlme.PeriodicRound & 0x1) - { - // This is the fix for wifi 11n extension channel overlapping test case. for 2860D - if (((pAd->MACVersion & 0xffff) == 0x0101) && - (STA_TGN_WIFI_ON(pAd)) && - (pAd->CommonCfg.IOTestParm.bToggle == FALSE)) - - { - RTMP_IO_WRITE32(pAd, TXOP_CTRL_CFG, 0x24Bf); - pAd->CommonCfg.IOTestParm.bToggle = TRUE; - } - else if ((STA_TGN_WIFI_ON(pAd)) && - ((pAd->MACVersion & 0xffff) == 0x0101)) - { - RTMP_IO_WRITE32(pAd, TXOP_CTRL_CFG, 0x243f); - pAd->CommonCfg.IOTestParm.bToggle = FALSE; - } - } - } -#endif // CONFIG_STA_SUPPORT // - - pAd->bUpdateBcnCntDone = FALSE; - -// RECBATimerTimeout(SystemSpecific1,FunctionContext,SystemSpecific2,SystemSpecific3); - pAd->Mlme.PeriodicRound ++; - - - // execute every 500ms - if ((pAd->Mlme.PeriodicRound % 5 == 0) && RTMPAutoRateSwitchCheck(pAd)/*(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED))*/) - { -#ifdef CONFIG_STA_SUPPORT - // perform dynamic tx rate switching based on past TX history - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) - ) - && (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE))) - MlmeDynamicTxRateSwitching(pAd); - } -#endif // CONFIG_STA_SUPPORT // - } - - // Normal 1 second Mlme PeriodicExec. - if (pAd->Mlme.PeriodicRound %MLME_TASK_EXEC_MULTIPLE == 0) - { - pAd->Mlme.OneSecPeriodicRound ++; - -#ifdef RALINK_ATE - if (ATE_ON(pAd)) - { - /* request from Baron : move this routine from later to here */ - /* for showing Rx error count in ATE RXFRAME */ - NICUpdateRawCounters(pAd); - if (pAd->ate.bRxFER == 1) - { - pAd->ate.RxTotalCnt += pAd->ate.RxCntPerSec; - ate_print(KERN_EMERG "MlmePeriodicExec: Rx packet cnt = %d/%d\n", pAd->ate.RxCntPerSec, pAd->ate.RxTotalCnt); - pAd->ate.RxCntPerSec = 0; - - if (pAd->ate.RxAntennaSel == 0) - ate_print(KERN_EMERG "MlmePeriodicExec: Rx AvgRssi0=%d, AvgRssi1=%d, AvgRssi2=%d\n\n", - pAd->ate.AvgRssi0, pAd->ate.AvgRssi1, pAd->ate.AvgRssi2); - else - ate_print(KERN_EMERG "MlmePeriodicExec: Rx AvgRssi=%d\n\n", pAd->ate.AvgRssi0); - } - MlmeResetRalinkCounters(pAd); - - - - return; - } -#endif // RALINK_ATE // - - - - //ORIBATimerTimeout(pAd); - - // Media status changed, report to NDIS - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_MEDIA_STATE_CHANGE)) - { - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_MEDIA_STATE_CHANGE); - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - pAd->IndicateMediaState = NdisMediaStateConnected; - RTMP_IndicateMediaState(pAd); - } - else - { - pAd->IndicateMediaState = NdisMediaStateDisconnected; - RTMP_IndicateMediaState(pAd); - } - } - - NdisGetSystemUpTime(&pAd->Mlme.Now32); - - // add the most up-to-date h/w raw counters into software variable, so that - // the dynamic tuning mechanism below are based on most up-to-date information - NICUpdateRawCounters(pAd); - - -#ifdef DOT11_N_SUPPORT - // Need statistics after read counter. So put after NICUpdateRawCounters - ORIBATimerTimeout(pAd); -#endif // DOT11_N_SUPPORT // - - // if MGMT RING is full more than twice within 1 second, we consider there's - // a hardware problem stucking the TX path. In this case, try a hardware reset - // to recover the system - // if (pAd->RalinkCounters.MgmtRingFullCount >= 2) - // RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HARDWARE_ERROR); - // else - // pAd->RalinkCounters.MgmtRingFullCount = 0; - - // The time period for checking antenna is according to traffic -#ifdef ANT_DIVERSITY_SUPPORT - if ((pAd->NicConfig2.field.AntDiversity) && - (pAd->CommonCfg.bRxAntDiversity == ANT_DIVERSITY_ENABLE) && - (!pAd->EepromAccess)) - AsicAntennaSelect(pAd, pAd->MlmeAux.Channel); - else if(pAd->CommonCfg.bRxAntDiversity == ANT_FIX_ANT1 || pAd->CommonCfg.bRxAntDiversity == ANT_FIX_ANT2) - { -#ifdef CONFIG_STA_SUPPORT - realavgrssi = (pAd->RxAnt.Pair1AvgRssi[pAd->RxAnt.Pair1PrimaryRxAnt] >> 3); -#endif // CONFIG_STA_SUPPORT // - DBGPRINT(RT_DEBUG_TRACE,("Ant-realrssi0(%d), Lastrssi0(%d), EvaluateStableCnt=%d\n", realavgrssi, pAd->RxAnt.Pair1LastAvgRssi, pAd->RxAnt.EvaluateStableCnt)); - } - else -#endif // ANT_DIVERSITY_SUPPORT // - { - if (pAd->Mlme.bEnableAutoAntennaCheck) - { - TxTotalCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount + - pAd->RalinkCounters.OneSecTxRetryOkCount + - pAd->RalinkCounters.OneSecTxFailCount; - - // dynamic adjust antenna evaluation period according to the traffic - if (TxTotalCnt > 50) - { - if (pAd->Mlme.OneSecPeriodicRound % 10 == 0) - { - AsicEvaluateRxAnt(pAd); - } - } - else - { - if (pAd->Mlme.OneSecPeriodicRound % 3 == 0) - { - AsicEvaluateRxAnt(pAd); - } - } - } - } - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - STAMlmePeriodicExec(pAd); -#endif // CONFIG_STA_SUPPORT // - - MlmeResetRalinkCounters(pAd); - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { -#ifdef RTMP_MAC_PCI - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST) && (pAd->bPCIclkOff == FALSE)) -#endif // RTMP_MAC_PCI // - { - // When Adhoc beacon is enabled and RTS/CTS is enabled, there is a chance that hardware MAC FSM will run into a deadlock - // and sending CTS-to-self over and over. - // Software Patch Solution: - // 1. Polling debug state register 0x10F4 every one second. - // 2. If in 0x10F4 the ((bit29==1) && (bit7==1)) OR ((bit29==1) && (bit5==1)), it means the deadlock has occurred. - // 3. If the deadlock occurred, reset MAC/BBP by setting 0x1004 to 0x0001 for a while then setting it back to 0x000C again. - - UINT32 MacReg = 0; - - RTMP_IO_READ32(pAd, 0x10F4, &MacReg); - if (((MacReg & 0x20000000) && (MacReg & 0x80)) || ((MacReg & 0x20000000) && (MacReg & 0x20))) - { - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x1); - RTMPusecDelay(1); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0xC); - - DBGPRINT(RT_DEBUG_WARN,("Warning, MAC specific condition occurs \n")); - } - } - } -#endif // CONFIG_STA_SUPPORT // - - RTMP_MLME_HANDLER(pAd); - } - - - pAd->bUpdateBcnCntDone = FALSE; -} - - -/* - ========================================================================== - Validate SSID for connection try and rescan purpose - Valid SSID will have visible chars only. - The valid length is from 0 to 32. - IRQL = DISPATCH_LEVEL - ========================================================================== - */ -BOOLEAN MlmeValidateSSID( - IN PUCHAR pSsid, - IN UCHAR SsidLen) -{ - int index; - - if (SsidLen > MAX_LEN_OF_SSID) - return (FALSE); - - // Check each character value - for (index = 0; index < SsidLen; index++) - { - if (pSsid[index] < 0x20) - return (FALSE); - } - - // All checked - return (TRUE); -} - -VOID MlmeSelectTxRateTable( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR *ppTable, - IN PUCHAR pTableSize, - IN PUCHAR pInitTxRateIdx) -{ - do - { - // decide the rate table for tuning - if (pAd->CommonCfg.TxRateTableSize > 0) - { - *ppTable = RateSwitchTable; - *pTableSize = RateSwitchTable[0]; - *pInitTxRateIdx = RateSwitchTable[1]; - - break; - } - -#ifdef CONFIG_STA_SUPPORT - if ((pAd->OpMode == OPMODE_STA) && ADHOC_ON(pAd)) - { -#ifdef DOT11_N_SUPPORT - if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && - (pEntry->HTCapability.MCSSet[0] == 0xff) && - ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) - {// 11N 1S Adhoc - *ppTable = RateSwitchTable11N1S; - *pTableSize = RateSwitchTable11N1S[0]; - *pInitTxRateIdx = RateSwitchTable11N1S[1]; - - } - else if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && - (pEntry->HTCapability.MCSSet[0] == 0xff) && - (pEntry->HTCapability.MCSSet[1] == 0xff) && - (pAd->Antenna.field.TxPath == 2)) - {// 11N 2S Adhoc - if (pAd->LatchRfRegs.Channel <= 14) - { - *ppTable = RateSwitchTable11N2S; - *pTableSize = RateSwitchTable11N2S[0]; - *pInitTxRateIdx = RateSwitchTable11N2S[1]; - } - else - { - *ppTable = RateSwitchTable11N2SForABand; - *pTableSize = RateSwitchTable11N2SForABand[0]; - *pInitTxRateIdx = RateSwitchTable11N2SForABand[1]; - } - - } - else -#endif // DOT11_N_SUPPORT // - if ((pEntry->RateLen == 4) -#ifdef DOT11_N_SUPPORT - && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0) -#endif // DOT11_N_SUPPORT // - ) - { - *ppTable = RateSwitchTable11B; - *pTableSize = RateSwitchTable11B[0]; - *pInitTxRateIdx = RateSwitchTable11B[1]; - - } - else if (pAd->LatchRfRegs.Channel <= 14) - { - *ppTable = RateSwitchTable11BG; - *pTableSize = RateSwitchTable11BG[0]; - *pInitTxRateIdx = RateSwitchTable11BG[1]; - - } - else - { - *ppTable = RateSwitchTable11G; - *pTableSize = RateSwitchTable11G[0]; - *pInitTxRateIdx = RateSwitchTable11G[1]; - - } - break; - } -#endif // CONFIG_STA_SUPPORT // - -#ifdef DOT11_N_SUPPORT - //if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen == 12) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && - // ((pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) - if (((pEntry->RateLen == 12) || (pAd->OpMode == OPMODE_STA)) && (pEntry->HTCapability.MCSSet[0] == 0xff) && - ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->CommonCfg.TxStream == 1))) - {// 11BGN 1S AP - *ppTable = RateSwitchTable11BGN1S; - *pTableSize = RateSwitchTable11BGN1S[0]; - *pInitTxRateIdx = RateSwitchTable11BGN1S[1]; - - break; - } - - //else if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen == 12) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && - // (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0xff) && (pAd->Antenna.field.TxPath == 2)) - if (((pEntry->RateLen == 12) || (pAd->OpMode == OPMODE_STA)) && (pEntry->HTCapability.MCSSet[0] == 0xff) && - (pEntry->HTCapability.MCSSet[1] == 0xff) && (pAd->CommonCfg.TxStream == 2)) - {// 11BGN 2S AP - if (pAd->LatchRfRegs.Channel <= 14) - { - *ppTable = RateSwitchTable11BGN2S; - *pTableSize = RateSwitchTable11BGN2S[0]; - *pInitTxRateIdx = RateSwitchTable11BGN2S[1]; - - } - else - { - *ppTable = RateSwitchTable11BGN2SForABand; - *pTableSize = RateSwitchTable11BGN2SForABand[0]; - *pInitTxRateIdx = RateSwitchTable11BGN2SForABand[1]; - - } - break; - } - - //else if ((pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && ((pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) - if ((pEntry->HTCapability.MCSSet[0] == 0xff) && ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->CommonCfg.TxStream == 1))) - {// 11N 1S AP - *ppTable = RateSwitchTable11N1S; - *pTableSize = RateSwitchTable11N1S[0]; - *pInitTxRateIdx = RateSwitchTable11N1S[1]; - - break; - } - - //else if ((pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0xff) && (pAd->Antenna.field.TxPath == 2)) - if ((pEntry->HTCapability.MCSSet[0] == 0xff) && (pEntry->HTCapability.MCSSet[1] == 0xff) && (pAd->CommonCfg.TxStream == 2)) - {// 11N 2S AP - if (pAd->LatchRfRegs.Channel <= 14) - { - *ppTable = RateSwitchTable11N2S; - *pTableSize = RateSwitchTable11N2S[0]; - *pInitTxRateIdx = RateSwitchTable11N2S[1]; - } - else - { - *ppTable = RateSwitchTable11N2SForABand; - *pTableSize = RateSwitchTable11N2SForABand[0]; - *pInitTxRateIdx = RateSwitchTable11N2SForABand[1]; - } - - break; - } -#endif // DOT11_N_SUPPORT // - //else if ((pAd->StaActive.SupRateLen == 4) && (pAd->StaActive.ExtRateLen == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) - if ((pEntry->RateLen == 4 || pAd->CommonCfg.PhyMode==PHY_11B) -#ifdef DOT11_N_SUPPORT - //Iverson mark for Adhoc b mode,sta will use rate 54 Mbps when connect with sta b/g/n mode - /* && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0)*/ -#endif // DOT11_N_SUPPORT // - ) - {// B only AP - *ppTable = RateSwitchTable11B; - *pTableSize = RateSwitchTable11B[0]; - *pInitTxRateIdx = RateSwitchTable11B[1]; - - break; - } - - //else if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen > 8) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) - if ((pEntry->RateLen > 8) -#ifdef DOT11_N_SUPPORT - && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0) -#endif // DOT11_N_SUPPORT // - ) - {// B/G mixed AP - *ppTable = RateSwitchTable11BG; - *pTableSize = RateSwitchTable11BG[0]; - *pInitTxRateIdx = RateSwitchTable11BG[1]; - - break; - } - - //else if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen == 8) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) - if ((pEntry->RateLen == 8) -#ifdef DOT11_N_SUPPORT - && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0) -#endif // DOT11_N_SUPPORT // - ) - {// G only AP - *ppTable = RateSwitchTable11G; - *pTableSize = RateSwitchTable11G[0]; - *pInitTxRateIdx = RateSwitchTable11G[1]; - - break; - } -#ifdef DOT11_N_SUPPORT -#endif // DOT11_N_SUPPORT // - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { -#ifdef DOT11_N_SUPPORT - //else if ((pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) - if ((pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0)) -#endif // DOT11_N_SUPPORT // - { // Legacy mode - if (pAd->CommonCfg.MaxTxRate <= RATE_11) - { - *ppTable = RateSwitchTable11B; - *pTableSize = RateSwitchTable11B[0]; - *pInitTxRateIdx = RateSwitchTable11B[1]; - } - else if ((pAd->CommonCfg.MaxTxRate > RATE_11) && (pAd->CommonCfg.MinTxRate > RATE_11)) - { - *ppTable = RateSwitchTable11G; - *pTableSize = RateSwitchTable11G[0]; - *pInitTxRateIdx = RateSwitchTable11G[1]; - - } - else - { - *ppTable = RateSwitchTable11BG; - *pTableSize = RateSwitchTable11BG[0]; - *pInitTxRateIdx = RateSwitchTable11BG[1]; - } - break; - } -#ifdef DOT11_N_SUPPORT - if (pAd->LatchRfRegs.Channel <= 14) - { - if (pAd->CommonCfg.TxStream == 1) - { - *ppTable = RateSwitchTable11N1S; - *pTableSize = RateSwitchTable11N1S[0]; - *pInitTxRateIdx = RateSwitchTable11N1S[1]; - DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode,default use 11N 1S AP \n")); - } - else - { - *ppTable = RateSwitchTable11N2S; - *pTableSize = RateSwitchTable11N2S[0]; - *pInitTxRateIdx = RateSwitchTable11N2S[1]; - DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode,default use 11N 2S AP \n")); - } - } - else - { - if (pAd->CommonCfg.TxStream == 1) - { - *ppTable = RateSwitchTable11N1S; - *pTableSize = RateSwitchTable11N1S[0]; - *pInitTxRateIdx = RateSwitchTable11N1S[1]; - DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode,default use 11N 1S AP \n")); - } - else - { - *ppTable = RateSwitchTable11N2SForABand; - *pTableSize = RateSwitchTable11N2SForABand[0]; - *pInitTxRateIdx = RateSwitchTable11N2SForABand[1]; - DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode,default use 11N 2S AP \n")); - } - } -#endif // DOT11_N_SUPPORT // - DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode (SupRateLen=%d, ExtRateLen=%d, MCSSet[0]=0x%x, MCSSet[1]=0x%x)\n", - pAd->StaActive.SupRateLen, pAd->StaActive.ExtRateLen, pAd->StaActive.SupportedPhyInfo.MCSSet[0], pAd->StaActive.SupportedPhyInfo.MCSSet[1])); - } -#endif // CONFIG_STA_SUPPORT // - } while(FALSE); -} - - -#ifdef CONFIG_STA_SUPPORT -VOID STAMlmePeriodicExec( - PRTMP_ADAPTER pAd) -{ - ULONG TxTotalCnt; - int i; - - - - - /* - We return here in ATE mode, because the statistics - that ATE need are not collected via this routine. - */ -#ifdef RALINK_ATE - if (ATE_ON(pAd)) - return; -#endif // RALINK_ATE // - -#ifdef RALINK_ATE - // It is supposed that we will never reach here in ATE mode. - ASSERT(!(ATE_ON(pAd))); - if (ATE_ON(pAd)) - return; -#endif // RALINK_ATE // - -#ifdef PCIE_PS_SUPPORT -// don't perform idle-power-save mechanism within 3 min after driver initialization. -// This can make rebooter test more robust -if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - if ((pAd->OpMode == OPMODE_STA) && (IDLE_ON(pAd)) - && (pAd->Mlme.SyncMachine.CurrState == SYNC_IDLE) - && (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) - && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) - { - if (IS_RT3090(pAd)|| IS_RT3572(pAd) || IS_RT3390(pAd)) - { - if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s::%d\n",__FUNCTION__,__LINE__)); - - RT28xxPciAsicRadioOff(pAd, GUI_IDLE_POWER_SAVE, 0); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("%s::%d\n",__FUNCTION__,__LINE__)); - AsicSendCommandToMcu(pAd, 0x30, PowerSafeCID, 0xff, 0x2); - // Wait command success - AsicCheckCommanOk(pAd, PowerSafeCID); - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); - DBGPRINT(RT_DEBUG_TRACE, ("PSM - rt30xx Issue Sleep command)\n")); - } - } - else if (pAd->Mlme.OneSecPeriodicRound > 180) - { - if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s::%d\n",__FUNCTION__,__LINE__)); - RT28xxPciAsicRadioOff(pAd, GUI_IDLE_POWER_SAVE, 0); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("%s::%d\n",__FUNCTION__,__LINE__)); - AsicSendCommandToMcu(pAd, 0x30, PowerSafeCID, 0xff, 0x02); - // Wait command success - AsicCheckCommanOk(pAd, PowerSafeCID); - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); - DBGPRINT(RT_DEBUG_TRACE, ("PSM - rt28xx Issue Sleep command)\n")); - } - } - } - else - { - DBGPRINT(RT_DEBUG_TRACE,("STAMlmePeriodicExec MMCHK - CommonCfg.Ssid[%d]=%c%c%c%c... MlmeAux.Ssid[%d]=%c%c%c%c...\n", - pAd->CommonCfg.SsidLen, pAd->CommonCfg.Ssid[0], pAd->CommonCfg.Ssid[1], pAd->CommonCfg.Ssid[2], pAd->CommonCfg.Ssid[3], - pAd->MlmeAux.SsidLen, pAd->MlmeAux.Ssid[0], pAd->MlmeAux.Ssid[1], pAd->MlmeAux.Ssid[2], pAd->MlmeAux.Ssid[3])); - } - } -#endif // PCIE_PS_SUPPORT // - - -#ifdef WPA_SUPPLICANT_SUPPORT - if (pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_DISABLE) -#endif // WPA_SUPPLICANT_SUPPORT // - { - // WPA MIC error should block association attempt for 60 seconds - if (pAd->StaCfg.bBlockAssoc && - RTMP_TIME_AFTER(pAd->Mlme.Now32, pAd->StaCfg.LastMicErrorTime + (60*OS_HZ))) - pAd->StaCfg.bBlockAssoc = FALSE; - } - - if ((pAd->PreMediaState != pAd->IndicateMediaState) && (pAd->CommonCfg.bWirelessEvent)) - { - if (pAd->IndicateMediaState == NdisMediaStateConnected) - { - RTMPSendWirelessEvent(pAd, IW_STA_LINKUP_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - } - pAd->PreMediaState = pAd->IndicateMediaState; - } - - - - - if (pAd->CommonCfg.PSPXlink && ADHOC_ON(pAd)) - { - } - else - { - AsicStaBbpTuning(pAd); - } - - TxTotalCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount + - pAd->RalinkCounters.OneSecTxRetryOkCount + - pAd->RalinkCounters.OneSecTxFailCount; - - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - // update channel quality for Roaming and UI LinkQuality display - MlmeCalculateChannelQuality(pAd, NULL, pAd->Mlme.Now32); - } - - // must be AFTER MlmeDynamicTxRateSwitching() because it needs to know if - // Radio is currently in noisy environment - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - AsicAdjustTxPower(pAd); - - if (INFRA_ON(pAd)) - { -#ifdef QOS_DLS_SUPPORT - // Check DLS time out, then tear down those session - RTMPCheckDLSTimeOut(pAd); -#endif // QOS_DLS_SUPPORT // - - // Is PSM bit consistent with user power management policy? - // This is the only place that will set PSM bit ON. - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - MlmeCheckPsmChange(pAd, pAd->Mlme.Now32); - - pAd->RalinkCounters.LastOneSecTotalTxCount = TxTotalCnt; - - if ((RTMP_TIME_AFTER(pAd->Mlme.Now32, pAd->StaCfg.LastBeaconRxTime + (1*OS_HZ))) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) && - (((TxTotalCnt + pAd->RalinkCounters.OneSecRxOkCnt) < 600))) - { - RTMPSetAGCInitValue(pAd, BW_20); - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - No BEACON. restore R66 to the low bound(%d) \n", (0x2E + GET_LNA_GAIN(pAd)))); - } - - //if ((pAd->RalinkCounters.OneSecTxNoRetryOkCount == 0) && - // (pAd->RalinkCounters.OneSecTxRetryOkCount == 0)) - { - if (pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable) - { - // When APSD is enabled, the period changes as 20 sec - if ((pAd->Mlme.OneSecPeriodicRound % 20) == 8) - RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, TRUE); - } - else - { - // Send out a NULL frame every 10 sec to inform AP that STA is still alive (Avoid being age out) - if ((pAd->Mlme.OneSecPeriodicRound % 10) == 8) - { - if (pAd->CommonCfg.bWmmCapable) - RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, TRUE); - else - RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, FALSE); - } - } - } - - if (CQI_IS_DEAD(pAd->Mlme.ChannelQuality)) - { - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - No BEACON. Dead CQI. Auto Recovery attempt #%ld\n", pAd->RalinkCounters.BadCQIAutoRecoveryCount)); - - // Lost AP, send disconnect & link down event - LinkDown(pAd, FALSE); - -#ifdef WPA_SUPPLICANT_SUPPORT -#ifndef NATIVE_WPA_SUPPLICANT_SUPPORT - //send disassociate event to wpa_supplicant - if (pAd->StaCfg.WpaSupplicantUP) { - RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, RT_DISASSOC_EVENT_FLAG, NULL, NULL, 0); - } -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // -#endif // WPA_SUPPLICANT_SUPPORT // - -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT - RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0); -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - - // RTMPPatchMacBbpBug(pAd); - MlmeAutoReconnectLastSSID(pAd); - } - else if (CQI_IS_BAD(pAd->Mlme.ChannelQuality)) - { - pAd->RalinkCounters.BadCQIAutoRecoveryCount ++; - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - Bad CQI. Auto Recovery attempt #%ld\n", pAd->RalinkCounters.BadCQIAutoRecoveryCount)); - MlmeAutoReconnectLastSSID(pAd); - } - - if (pAd->StaCfg.bAutoRoaming) - { - BOOLEAN rv = FALSE; - CHAR dBmToRoam = pAd->StaCfg.dBmToRoam; - CHAR MaxRssi = RTMPMaxRssi(pAd, - pAd->StaCfg.RssiSample.LastRssi0, - pAd->StaCfg.RssiSample.LastRssi1, - pAd->StaCfg.RssiSample.LastRssi2); - - // Scanning, ignore Roaming - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS) && - (pAd->Mlme.SyncMachine.CurrState == SYNC_IDLE) && - (MaxRssi <= dBmToRoam)) - { - DBGPRINT(RT_DEBUG_TRACE, ("Rssi=%d, dBmToRoam=%d\n", MaxRssi, (CHAR)dBmToRoam)); - - - // Add auto seamless roaming - if (rv == FALSE) - rv = MlmeCheckForFastRoaming(pAd); - - if (rv == FALSE) - { - if ((pAd->StaCfg.LastScanTime + 10 * OS_HZ) < pAd->Mlme.Now32) - { - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - Roaming, No eligable entry, try new scan!\n")); - pAd->StaCfg.ScanCnt = 2; - pAd->StaCfg.LastScanTime = pAd->Mlme.Now32; - MlmeAutoScan(pAd); - } - } - } - } - } - else if (ADHOC_ON(pAd)) - { - - // If all peers leave, and this STA becomes the last one in this IBSS, then change MediaState - // to DISCONNECTED. But still holding this IBSS (i.e. sending BEACON) so that other STAs can - // join later. - if (RTMP_TIME_AFTER(pAd->Mlme.Now32, pAd->StaCfg.LastBeaconRxTime + ADHOC_BEACON_LOST_TIME) && - OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - MLME_START_REQ_STRUCT StartReq; - - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - excessive BEACON lost, last STA in this IBSS, MediaState=Disconnected\n")); - LinkDown(pAd, FALSE); - - StartParmFill(pAd, &StartReq, (CHAR *)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, sizeof(MLME_START_REQ_STRUCT), &StartReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_START; - } - - for (i = 1; i < MAX_LEN_OF_MAC_TABLE; i++) - { - MAC_TABLE_ENTRY *pEntry = &pAd->MacTab.Content[i]; - - if (pEntry->ValidAsCLI == FALSE) - continue; - - if (RTMP_TIME_AFTER(pAd->Mlme.Now32, pEntry->LastBeaconRxTime + ADHOC_BEACON_LOST_TIME)) - MacTableDeleteEntry(pAd, pEntry->Aid, pEntry->Addr); - } - } - else // no INFRA nor ADHOC connection - { - - if (pAd->StaCfg.bScanReqIsFromWebUI && - RTMP_TIME_BEFORE(pAd->Mlme.Now32, pAd->StaCfg.LastScanTime + (30 * OS_HZ))) - goto SKIP_AUTO_SCAN_CONN; - else - pAd->StaCfg.bScanReqIsFromWebUI = FALSE; - - if ((pAd->StaCfg.bAutoReconnect == TRUE) - && RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_START_UP) - && (MlmeValidateSSID(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen) == TRUE)) - { - if ((pAd->ScanTab.BssNr==0) && (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE)) - { - MLME_SCAN_REQ_STRUCT ScanReq; - - if (RTMP_TIME_AFTER(pAd->Mlme.Now32, pAd->StaCfg.LastScanTime + (10 * OS_HZ))) - { - DBGPRINT(RT_DEBUG_TRACE, ("STAMlmePeriodicExec():CNTL - ScanTab.BssNr==0, start a new ACTIVE scan SSID[%s]\n", pAd->MlmeAux.AutoReconnectSsid)); - ScanParmFill(pAd, &ScanReq, (PSTRING) pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen, BSS_ANY, SCAN_ACTIVE); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; - // Reset Missed scan number - pAd->StaCfg.LastScanTime = pAd->Mlme.Now32; - } - else if (pAd->StaCfg.BssType == BSS_ADHOC) // Quit the forever scan when in a very clean room - MlmeAutoReconnectLastSSID(pAd); - } - else if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) - { - if ((pAd->Mlme.OneSecPeriodicRound % 7) == 0) - { - MlmeAutoScan(pAd); - pAd->StaCfg.LastScanTime = pAd->Mlme.Now32; - } - else - { -#ifdef CARRIER_DETECTION_SUPPORT // Roger sync Carrier - if (pAd->CommonCfg.CarrierDetect.Enable == TRUE) - { - if ((pAd->Mlme.OneSecPeriodicRound % 5) == 1) - MlmeAutoReconnectLastSSID(pAd); - } - else -#endif // CARRIER_DETECTION_SUPPORT // - MlmeAutoReconnectLastSSID(pAd); - } - } - } - } - -SKIP_AUTO_SCAN_CONN: - -#ifdef DOT11_N_SUPPORT - if ((pAd->MacTab.Content[BSSID_WCID].TXBAbitmap !=0) && (pAd->MacTab.fAnyBASession == FALSE)) - { - pAd->MacTab.fAnyBASession = TRUE; - AsicUpdateProtect(pAd, HT_FORCERTSCTS, ALLN_SETPROTECT, FALSE, FALSE); - } - else if ((pAd->MacTab.Content[BSSID_WCID].TXBAbitmap ==0) && (pAd->MacTab.fAnyBASession == TRUE)) - { - pAd->MacTab.fAnyBASession = FALSE; - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, FALSE, FALSE); - } -#endif // DOT11_N_SUPPORT // - - -#ifdef DOT11_N_SUPPORT -#ifdef DOT11N_DRAFT3 - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_SCAN_2040)) - TriEventCounterMaintenance(pAd); -#endif // DOT11N_DRAFT3 // -#endif // DOT11_N_SUPPORT // - - return; -} - -// Link down report -VOID LinkDownExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; - - if (pAd != NULL) - { - MLME_DISASSOC_REQ_STRUCT DisassocReq; - - if ((pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED) && - (INFRA_ON(pAd))) - { - DBGPRINT(RT_DEBUG_TRACE, ("LinkDownExec(): disassociate with current AP...\n")); - DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_DISASSOC_STA_LEAVING); - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, - sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; - - pAd->IndicateMediaState = NdisMediaStateDisconnected; - RTMP_IndicateMediaState(pAd); - pAd->ExtraInfo = GENERAL_LINK_DOWN; - } - } -} - -// IRQL = DISPATCH_LEVEL -VOID MlmeAutoScan( - IN PRTMP_ADAPTER pAd) -{ - // check CntlMachine.CurrState to avoid collision with NDIS SetOID request - if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) - { - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - Driver auto scan\n")); - MlmeEnqueue(pAd, - MLME_CNTL_STATE_MACHINE, - OID_802_11_BSSID_LIST_SCAN, - pAd->MlmeAux.AutoReconnectSsidLen, - pAd->MlmeAux.AutoReconnectSsid); - RTMP_MLME_HANDLER(pAd); - } -} - -// IRQL = DISPATCH_LEVEL -VOID MlmeAutoReconnectLastSSID( - IN PRTMP_ADAPTER pAd) -{ - if (pAd->StaCfg.bAutoConnectByBssid) - { - DBGPRINT(RT_DEBUG_TRACE, ("Driver auto reconnect to last OID_802_11_BSSID setting - %02X:%02X:%02X:%02X:%02X:%02X\n", - pAd->MlmeAux.Bssid[0], - pAd->MlmeAux.Bssid[1], - pAd->MlmeAux.Bssid[2], - pAd->MlmeAux.Bssid[3], - pAd->MlmeAux.Bssid[4], - pAd->MlmeAux.Bssid[5])); - - pAd->MlmeAux.Channel = pAd->CommonCfg.Channel; - MlmeEnqueue(pAd, - MLME_CNTL_STATE_MACHINE, - OID_802_11_BSSID, - MAC_ADDR_LEN, - pAd->MlmeAux.Bssid); - - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - - RTMP_MLME_HANDLER(pAd); - } - // check CntlMachine.CurrState to avoid collision with NDIS SetOID request - else if ((pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) && - (MlmeValidateSSID(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen) == TRUE)) - { - NDIS_802_11_SSID OidSsid; - OidSsid.SsidLength = pAd->MlmeAux.AutoReconnectSsidLen; - NdisMoveMemory(OidSsid.Ssid, pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen); - - DBGPRINT(RT_DEBUG_TRACE, ("Driver auto reconnect to last OID_802_11_SSID setting - %s, len - %d\n", pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen)); - MlmeEnqueue(pAd, - MLME_CNTL_STATE_MACHINE, - OID_802_11_SSID, - sizeof(NDIS_802_11_SSID), - &OidSsid); - RTMP_MLME_HANDLER(pAd); - } -} - - -/* - ========================================================================== - Description: - This routine checks if there're other APs out there capable for - roaming. Caller should call this routine only when Link up in INFRA mode - and channel quality is below CQI_GOOD_THRESHOLD. - - IRQL = DISPATCH_LEVEL - - Output: - ========================================================================== - */ -VOID MlmeCheckForRoaming( - IN PRTMP_ADAPTER pAd, - IN ULONG Now32) -{ - USHORT i; - BSS_TABLE *pRoamTab = &pAd->MlmeAux.RoamTab; - BSS_ENTRY *pBss; - - DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeCheckForRoaming\n")); - // put all roaming candidates into RoamTab, and sort in RSSI order - BssTableInit(pRoamTab); - for (i = 0; i < pAd->ScanTab.BssNr; i++) - { - pBss = &pAd->ScanTab.BssEntry[i]; - - if ((pBss->LastBeaconRxTime + pAd->StaCfg.BeaconLostTime) < Now32) - continue; // AP disappear - if (pBss->Rssi <= RSSI_THRESHOLD_FOR_ROAMING) - continue; // RSSI too weak. forget it. - if (MAC_ADDR_EQUAL(pBss->Bssid, pAd->CommonCfg.Bssid)) - continue; // skip current AP - if (pBss->Rssi < (pAd->StaCfg.RssiSample.LastRssi0 + RSSI_DELTA)) - continue; // only AP with stronger RSSI is eligible for roaming - - // AP passing all above rules is put into roaming candidate table - NdisMoveMemory(&pRoamTab->BssEntry[pRoamTab->BssNr], pBss, sizeof(BSS_ENTRY)); - pRoamTab->BssNr += 1; - } - - if (pRoamTab->BssNr > 0) - { - // check CntlMachine.CurrState to avoid collision with NDIS SetOID request - if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) - { - pAd->RalinkCounters.PoorCQIRoamingCount ++; - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - Roaming attempt #%ld\n", pAd->RalinkCounters.PoorCQIRoamingCount)); - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_MLME_ROAMING_REQ, 0, NULL); - RTMP_MLME_HANDLER(pAd); - } - } - DBGPRINT(RT_DEBUG_TRACE, ("<== MlmeCheckForRoaming(# of candidate= %d)\n",pRoamTab->BssNr)); -} - -/* - ========================================================================== - Description: - This routine checks if there're other APs out there capable for - roaming. Caller should call this routine only when link up in INFRA mode - and channel quality is below CQI_GOOD_THRESHOLD. - - IRQL = DISPATCH_LEVEL - - Output: - ========================================================================== - */ -BOOLEAN MlmeCheckForFastRoaming( - IN PRTMP_ADAPTER pAd) -{ - USHORT i; - BSS_TABLE *pRoamTab = &pAd->MlmeAux.RoamTab; - BSS_ENTRY *pBss; - - DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeCheckForFastRoaming\n")); - // put all roaming candidates into RoamTab, and sort in RSSI order - BssTableInit(pRoamTab); - for (i = 0; i < pAd->ScanTab.BssNr; i++) - { - pBss = &pAd->ScanTab.BssEntry[i]; - - if ((pBss->Rssi <= -50) && (pBss->Channel == pAd->CommonCfg.Channel)) - continue; // RSSI too weak. forget it. - if (MAC_ADDR_EQUAL(pBss->Bssid, pAd->CommonCfg.Bssid)) - continue; // skip current AP - if (!SSID_EQUAL(pBss->Ssid, pBss->SsidLen, pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen)) - continue; // skip different SSID - if (pBss->Rssi < (RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, pAd->StaCfg.RssiSample.LastRssi1, pAd->StaCfg.RssiSample.LastRssi2) + RSSI_DELTA)) - continue; // skip AP without better RSSI - - DBGPRINT(RT_DEBUG_TRACE, ("LastRssi0 = %d, pBss->Rssi = %d\n", RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, pAd->StaCfg.RssiSample.LastRssi1, pAd->StaCfg.RssiSample.LastRssi2), pBss->Rssi)); - // AP passing all above rules is put into roaming candidate table - NdisMoveMemory(&pRoamTab->BssEntry[pRoamTab->BssNr], pBss, sizeof(BSS_ENTRY)); - pRoamTab->BssNr += 1; - } - - DBGPRINT(RT_DEBUG_TRACE, ("<== MlmeCheckForFastRoaming (BssNr=%d)\n", pRoamTab->BssNr)); - if (pRoamTab->BssNr > 0) - { - // check CntlMachine.CurrState to avoid collision with NDIS SetOID request - if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) - { - pAd->RalinkCounters.PoorCQIRoamingCount ++; - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - Roaming attempt #%ld\n", pAd->RalinkCounters.PoorCQIRoamingCount)); - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_MLME_ROAMING_REQ, 0, NULL); - RTMP_MLME_HANDLER(pAd); - return TRUE; - } - } - - return FALSE; -} - -VOID MlmeSetTxRate( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PRTMP_TX_RATE_SWITCH pTxRate) -{ - UCHAR MaxMode = MODE_OFDM; - -#ifdef DOT11_N_SUPPORT - MaxMode = MODE_HTGREENFIELD; - - if (pTxRate->STBC && (pAd->StaCfg.MaxHTPhyMode.field.STBC) && (pAd->Antenna.field.TxPath == 2)) - pAd->StaCfg.HTPhyMode.field.STBC = STBC_USE; - else -#endif // DOT11_N_SUPPORT // - pAd->StaCfg.HTPhyMode.field.STBC = STBC_NONE; - - if (pTxRate->CurrMCS < MCS_AUTO) - pAd->StaCfg.HTPhyMode.field.MCS = pTxRate->CurrMCS; - - if (pAd->StaCfg.HTPhyMode.field.MCS > 7) - pAd->StaCfg.HTPhyMode.field.STBC = STBC_NONE; - - if (ADHOC_ON(pAd)) - { - // If peer adhoc is b-only mode, we can't send 11g rate. - pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; - pEntry->HTPhyMode.field.STBC = STBC_NONE; - - // - // For Adhoc MODE_CCK, driver will use AdhocBOnlyJoined flag to roll back to B only if necessary - // - pEntry->HTPhyMode.field.MODE = pTxRate->Mode; - pEntry->HTPhyMode.field.ShortGI = pAd->StaCfg.HTPhyMode.field.ShortGI; - pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - - // Patch speed error in status page - pAd->StaCfg.HTPhyMode.field.MODE = pEntry->HTPhyMode.field.MODE; - } - else - { - if (pTxRate->Mode <= MaxMode) - pAd->StaCfg.HTPhyMode.field.MODE = pTxRate->Mode; - -#ifdef DOT11_N_SUPPORT - if (pTxRate->ShortGI && (pAd->StaCfg.MaxHTPhyMode.field.ShortGI)) - pAd->StaCfg.HTPhyMode.field.ShortGI = GI_400; - else -#endif // DOT11_N_SUPPORT // - pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; - -#ifdef DOT11_N_SUPPORT - // Reexam each bandwidth's SGI support. - if (pAd->StaCfg.HTPhyMode.field.ShortGI == GI_400) - { - if ((pEntry->HTPhyMode.field.BW == BW_20) && (!CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_SGI20_CAPABLE))) - pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; - if ((pEntry->HTPhyMode.field.BW == BW_40) && (!CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_SGI40_CAPABLE))) - pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; - } - - // Turn RTS/CTS rate to 6Mbps. - if ((pEntry->HTPhyMode.field.MCS == 0) && (pAd->StaCfg.HTPhyMode.field.MCS != 0)) - { - pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - if (pAd->MacTab.fAnyBASession) - { - AsicUpdateProtect(pAd, HT_FORCERTSCTS, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); - } - else - { - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); - } - } - else if ((pEntry->HTPhyMode.field.MCS == 8) && (pAd->StaCfg.HTPhyMode.field.MCS != 8)) - { - pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - if (pAd->MacTab.fAnyBASession) - { - AsicUpdateProtect(pAd, HT_FORCERTSCTS, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); - } - else - { - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); - } - } - else if ((pEntry->HTPhyMode.field.MCS != 0) && (pAd->StaCfg.HTPhyMode.field.MCS == 0)) - { - AsicUpdateProtect(pAd, HT_RTSCTS_6M, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); - - } - else if ((pEntry->HTPhyMode.field.MCS != 8) && (pAd->StaCfg.HTPhyMode.field.MCS == 8)) - { - AsicUpdateProtect(pAd, HT_RTSCTS_6M, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); - } -#endif // DOT11_N_SUPPORT // - - pEntry->HTPhyMode.field.STBC = pAd->StaCfg.HTPhyMode.field.STBC; - pEntry->HTPhyMode.field.ShortGI = pAd->StaCfg.HTPhyMode.field.ShortGI; - pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - pEntry->HTPhyMode.field.MODE = pAd->StaCfg.HTPhyMode.field.MODE; -#ifdef DOT11_N_SUPPORT - if ((pAd->StaCfg.MaxHTPhyMode.field.MODE == MODE_HTGREENFIELD) && - pAd->WIFItestbed.bGreenField) - pEntry->HTPhyMode.field.MODE = MODE_HTGREENFIELD; -#endif // DOT11_N_SUPPORT // - } - - pAd->LastTxRate = (USHORT)(pEntry->HTPhyMode.word); -} - -/* - ========================================================================== - Description: - This routine calculates the acumulated TxPER of eaxh TxRate. And - according to the calculation result, change CommonCfg.TxRate which - is the stable TX Rate we expect the Radio situation could sustained. - - CommonCfg.TxRate will change dynamically within {RATE_1/RATE_6, MaxTxRate} - Output: - CommonCfg.TxRate - - - IRQL = DISPATCH_LEVEL - - NOTE: - call this routine every second - ========================================================================== - */ -VOID MlmeDynamicTxRateSwitching( - IN PRTMP_ADAPTER pAd) -{ - UCHAR UpRateIdx = 0, DownRateIdx = 0, CurrRateIdx; - ULONG i, AccuTxTotalCnt = 0, TxTotalCnt; - ULONG TxErrorRatio = 0; - BOOLEAN bTxRateChanged = FALSE, bUpgradeQuality = FALSE; - PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate = NULL; - PUCHAR pTable; - UCHAR TableSize = 0; - UCHAR InitTxRateIdx = 0, TrainUp, TrainDown; - CHAR Rssi, RssiOffset = 0; - TX_STA_CNT1_STRUC StaTx1; - TX_STA_CNT0_STRUC TxStaCnt0; - ULONG TxRetransmit = 0, TxSuccess = 0, TxFailCount = 0; - MAC_TABLE_ENTRY *pEntry; - RSSI_SAMPLE *pRssi = &pAd->StaCfg.RssiSample; - -#ifdef RALINK_ATE - if (ATE_ON(pAd)) - { - return; - } -#endif // RALINK_ATE // - - // - // walk through MAC table, see if need to change AP's TX rate toward each entry - // - for (i = 1; i < MAX_LEN_OF_MAC_TABLE; i++) - { - pEntry = &pAd->MacTab.Content[i]; - - // check if this entry need to switch rate automatically - if (RTMPCheckEntryEnableAutoRateSwitch(pAd, pEntry) == FALSE) - continue; - - if ((pAd->MacTab.Size == 1) || (pEntry->ValidAsDls)) - { - Rssi = RTMPMaxRssi(pAd, - pRssi->AvgRssi0, - pRssi->AvgRssi1, - pRssi->AvgRssi2); - - // Update statistic counter - RTMP_IO_READ32(pAd, TX_STA_CNT0, &TxStaCnt0.word); - RTMP_IO_READ32(pAd, TX_STA_CNT1, &StaTx1.word); - pAd->bUpdateBcnCntDone = TRUE; - TxRetransmit = StaTx1.field.TxRetransmit; - TxSuccess = StaTx1.field.TxSuccess; - TxFailCount = TxStaCnt0.field.TxFailCount; - TxTotalCnt = TxRetransmit + TxSuccess + TxFailCount; - - pAd->RalinkCounters.OneSecTxRetryOkCount += StaTx1.field.TxRetransmit; - pAd->RalinkCounters.OneSecTxNoRetryOkCount += StaTx1.field.TxSuccess; - pAd->RalinkCounters.OneSecTxFailCount += TxStaCnt0.field.TxFailCount; - pAd->WlanCounters.TransmittedFragmentCount.u.LowPart += StaTx1.field.TxSuccess; - pAd->WlanCounters.RetryCount.u.LowPart += StaTx1.field.TxRetransmit; - pAd->WlanCounters.FailedCount.u.LowPart += TxStaCnt0.field.TxFailCount; - - // if no traffic in the past 1-sec period, don't change TX rate, - // but clear all bad history. because the bad history may affect the next - // Chariot throughput test - AccuTxTotalCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount + - pAd->RalinkCounters.OneSecTxRetryOkCount + - pAd->RalinkCounters.OneSecTxFailCount; - - if (TxTotalCnt) - TxErrorRatio = ((TxRetransmit + TxFailCount) * 100) / TxTotalCnt; - } - else - { - if (INFRA_ON(pAd) && (i == 1)) - Rssi = RTMPMaxRssi(pAd, - pRssi->AvgRssi0, - pRssi->AvgRssi1, - pRssi->AvgRssi2); - else - Rssi = RTMPMaxRssi(pAd, - pEntry->RssiSample.AvgRssi0, - pEntry->RssiSample.AvgRssi1, - pEntry->RssiSample.AvgRssi2); - - TxTotalCnt = pEntry->OneSecTxNoRetryOkCount + - pEntry->OneSecTxRetryOkCount + - pEntry->OneSecTxFailCount; - - if (TxTotalCnt) - TxErrorRatio = ((pEntry->OneSecTxRetryOkCount + pEntry->OneSecTxFailCount) * 100) / TxTotalCnt; - } - - if (TxTotalCnt) - { - /* - Three AdHoc connections can not work normally if one AdHoc connection is disappeared from a heavy traffic environment generated by ping tool - We force to set LongRtyLimit and ShortRtyLimit to 0 to stop retransmitting packet, after a while, resoring original settings - */ - if (TxErrorRatio == 100) - { - TX_RTY_CFG_STRUC TxRtyCfg,TxRtyCfgtmp; - ULONG Index; - ULONG MACValue; - - RTMP_IO_READ32(pAd, TX_RTY_CFG, &TxRtyCfg.word); - TxRtyCfgtmp.word = TxRtyCfg.word; - TxRtyCfg.field.LongRtyLimit = 0x0; - TxRtyCfg.field.ShortRtyLimit = 0x0; - RTMP_IO_WRITE32(pAd, TX_RTY_CFG, TxRtyCfg.word); - - RTMPusecDelay(1); - - Index = 0; - MACValue = 0; - do - { - RTMP_IO_READ32(pAd, TXRXQ_PCNT, &MACValue); - if ((MACValue & 0xffffff) == 0) - break; - Index++; - RTMPusecDelay(1000); - }while((Index < 330)&&(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS))); - - RTMP_IO_READ32(pAd, TX_RTY_CFG, &TxRtyCfg.word); - TxRtyCfg.field.LongRtyLimit = TxRtyCfgtmp.field.LongRtyLimit; - TxRtyCfg.field.ShortRtyLimit = TxRtyCfgtmp.field.ShortRtyLimit; - RTMP_IO_WRITE32(pAd, TX_RTY_CFG, TxRtyCfg.word); - } - } - - CurrRateIdx = pEntry->CurrTxRateIndex; - - MlmeSelectTxRateTable(pAd, pEntry, &pTable, &TableSize, &InitTxRateIdx); - - if (CurrRateIdx >= TableSize) - { - CurrRateIdx = TableSize - 1; - } - - // When switch from Fixed rate -> auto rate, the REAL TX rate might be different from pAd->CommonCfg.TxRateIndex. - // So need to sync here. - pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(CurrRateIdx+1)*5]; - if ((pEntry->HTPhyMode.field.MCS != pCurrTxRate->CurrMCS) - //&& (pAd->StaCfg.bAutoTxRateSwitch == TRUE) - ) - { - - // Need to sync Real Tx rate and our record. - // Then return for next DRS. - pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(InitTxRateIdx+1)*5]; - pEntry->CurrTxRateIndex = InitTxRateIdx; - MlmeSetTxRate(pAd, pEntry, pCurrTxRate); - - // reset all OneSecTx counters - RESET_ONE_SEC_TX_CNT(pEntry); - continue; - } - - // decide the next upgrade rate and downgrade rate, if any - if ((CurrRateIdx > 0) && (CurrRateIdx < (TableSize - 1))) - { - UpRateIdx = CurrRateIdx + 1; - DownRateIdx = CurrRateIdx -1; - } - else if (CurrRateIdx == 0) - { - UpRateIdx = CurrRateIdx + 1; - DownRateIdx = CurrRateIdx; - } - else if (CurrRateIdx == (TableSize - 1)) - { - UpRateIdx = CurrRateIdx; - DownRateIdx = CurrRateIdx - 1; - } - - pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(CurrRateIdx+1)*5]; - -#ifdef DOT11_N_SUPPORT - if ((Rssi > -65) && (pCurrTxRate->Mode >= MODE_HTMIX)) - { - TrainUp = (pCurrTxRate->TrainUp + (pCurrTxRate->TrainUp >> 1)); - TrainDown = (pCurrTxRate->TrainDown + (pCurrTxRate->TrainDown >> 1)); - } - else -#endif // DOT11_N_SUPPORT // - { - TrainUp = pCurrTxRate->TrainUp; - TrainDown = pCurrTxRate->TrainDown; - } - - //pAd->DrsCounters.LastTimeTxRateChangeAction = pAd->DrsCounters.LastSecTxRateChangeAction; - - // - // Keep the last time TxRateChangeAction status. - // - pEntry->LastTimeTxRateChangeAction = pEntry->LastSecTxRateChangeAction; - - - - // - // CASE 1. when TX samples are fewer than 15, then decide TX rate solely on RSSI - // (criteria copied from RT2500 for Netopia case) - // - if (TxTotalCnt <= 15) - { - CHAR idx = 0; - UCHAR TxRateIdx; - UCHAR MCS0 = 0, MCS1 = 0, MCS2 = 0, MCS3 = 0, MCS4 = 0, MCS5 =0, MCS6 = 0, MCS7 = 0; - UCHAR MCS12 = 0, MCS13 = 0, MCS14 = 0, MCS15 = 0; - UCHAR MCS20 = 0, MCS21 = 0, MCS22 = 0, MCS23 = 0; // 3*3 - - // check the existence and index of each needed MCS - while (idx < pTable[0]) - { - pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(idx+1)*5]; - - if (pCurrTxRate->CurrMCS == MCS_0) - { - MCS0 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_1) - { - MCS1 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_2) - { - MCS2 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_3) - { - MCS3 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_4) - { - MCS4 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_5) - { - MCS5 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_6) - { - MCS6 = idx; - } - //else if (pCurrTxRate->CurrMCS == MCS_7) - else if ((pCurrTxRate->CurrMCS == MCS_7) && (pCurrTxRate->ShortGI == GI_800)) // prevent the highest MCS using short GI when 1T and low throughput - { - MCS7 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_12) - { - MCS12 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_13) - { - MCS13 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_14) - { - MCS14 = idx; - } - //else if ((pCurrTxRate->CurrMCS == MCS_15)/* && (pCurrTxRate->ShortGI == GI_800)*/) //we hope to use ShortGI as initial rate - else if ((pCurrTxRate->CurrMCS == MCS_15) && (pCurrTxRate->ShortGI == GI_800)) //we hope to use ShortGI as initial rate, however Atheros's chip has bugs when short GI - { - MCS15 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_20) // 3*3 - { - MCS20 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_21) - { - MCS21 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_22) - { - MCS22 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_23) - { - MCS23 = idx; - } - idx ++; - } - - if (pAd->LatchRfRegs.Channel <= 14) - { - if (pAd->NicConfig2.field.ExternalLNAForG) - { - RssiOffset = 2; - } - else - { - RssiOffset = 5; - } - } - else - { - if (pAd->NicConfig2.field.ExternalLNAForA) - { - RssiOffset = 5; - } - else - { - RssiOffset = 8; - } - } -#ifdef DOT11_N_SUPPORT - /*if (MCS15)*/ - if ((pTable == RateSwitchTable11BGN3S) || - (pTable == RateSwitchTable11N3S) || - (pTable == RateSwitchTable)) - {// N mode with 3 stream // 3*3 - if (MCS23 && (Rssi >= -70)) - TxRateIdx = MCS23; - else if (MCS22 && (Rssi >= -72)) - TxRateIdx = MCS22; - else if (MCS21 && (Rssi >= -76)) - TxRateIdx = MCS21; - else if (MCS20 && (Rssi >= -78)) - TxRateIdx = MCS20; - else if (MCS4 && (Rssi >= -82)) - TxRateIdx = MCS4; - else if (MCS3 && (Rssi >= -84)) - TxRateIdx = MCS3; - else if (MCS2 && (Rssi >= -86)) - TxRateIdx = MCS2; - else if (MCS1 && (Rssi >= -88)) - TxRateIdx = MCS1; - else - TxRateIdx = MCS0; - } -// else if ((pTable == RateSwitchTable11BGN2S) || (pTable == RateSwitchTable11BGN2SForABand) ||(pTable == RateSwitchTable11N2S) ||(pTable == RateSwitchTable11N2SForABand) || (pTable == RateSwitchTable)) - else if ((pTable == RateSwitchTable11BGN2S) || (pTable == RateSwitchTable11BGN2SForABand) ||(pTable == RateSwitchTable11N2S) ||(pTable == RateSwitchTable11N2SForABand)) // 3*3 - {// N mode with 2 stream - if (MCS15 && (Rssi >= (-70+RssiOffset))) - TxRateIdx = MCS15; - else if (MCS14 && (Rssi >= (-72+RssiOffset))) - TxRateIdx = MCS14; - else if (MCS13 && (Rssi >= (-76+RssiOffset))) - TxRateIdx = MCS13; - else if (MCS12 && (Rssi >= (-78+RssiOffset))) - TxRateIdx = MCS12; - else if (MCS4 && (Rssi >= (-82+RssiOffset))) - TxRateIdx = MCS4; - else if (MCS3 && (Rssi >= (-84+RssiOffset))) - TxRateIdx = MCS3; - else if (MCS2 && (Rssi >= (-86+RssiOffset))) - TxRateIdx = MCS2; - else if (MCS1 && (Rssi >= (-88+RssiOffset))) - TxRateIdx = MCS1; - else - TxRateIdx = MCS0; - } - else if ((pTable == RateSwitchTable11BGN1S) || (pTable == RateSwitchTable11N1S)) - {// N mode with 1 stream - if (MCS7 && (Rssi > (-72+RssiOffset))) - TxRateIdx = MCS7; - else if (MCS6 && (Rssi > (-74+RssiOffset))) - TxRateIdx = MCS6; - else if (MCS5 && (Rssi > (-77+RssiOffset))) - TxRateIdx = MCS5; - else if (MCS4 && (Rssi > (-79+RssiOffset))) - TxRateIdx = MCS4; - else if (MCS3 && (Rssi > (-81+RssiOffset))) - TxRateIdx = MCS3; - else if (MCS2 && (Rssi > (-83+RssiOffset))) - TxRateIdx = MCS2; - else if (MCS1 && (Rssi > (-86+RssiOffset))) - TxRateIdx = MCS1; - else - TxRateIdx = MCS0; - } - else -#endif // DOT11_N_SUPPORT // - {// Legacy mode - if (MCS7 && (Rssi > -70)) - TxRateIdx = MCS7; - else if (MCS6 && (Rssi > -74)) - TxRateIdx = MCS6; - else if (MCS5 && (Rssi > -78)) - TxRateIdx = MCS5; - else if (MCS4 && (Rssi > -82)) - TxRateIdx = MCS4; - else if (MCS4 == 0) // for B-only mode - TxRateIdx = MCS3; - else if (MCS3 && (Rssi > -85)) - TxRateIdx = MCS3; - else if (MCS2 && (Rssi > -87)) - TxRateIdx = MCS2; - else if (MCS1 && (Rssi > -90)) - TxRateIdx = MCS1; - else - TxRateIdx = MCS0; - } - - // if (TxRateIdx != pAd->CommonCfg.TxRateIndex) - { - pEntry->CurrTxRateIndex = TxRateIdx; - pNextTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(pEntry->CurrTxRateIndex+1)*5]; - MlmeSetTxRate(pAd, pEntry, pNextTxRate); - } - - NdisZeroMemory(pEntry->TxQuality, sizeof(USHORT) * MAX_STEP_OF_TX_RATE_SWITCH); - NdisZeroMemory(pEntry->PER, sizeof(UCHAR) * MAX_STEP_OF_TX_RATE_SWITCH); - pEntry->fLastSecAccordingRSSI = TRUE; - // reset all OneSecTx counters - RESET_ONE_SEC_TX_CNT(pEntry); - - continue; - } - - if (pEntry->fLastSecAccordingRSSI == TRUE) - { - pEntry->fLastSecAccordingRSSI = FALSE; - pEntry->LastSecTxRateChangeAction = 0; - // reset all OneSecTx counters - RESET_ONE_SEC_TX_CNT(pEntry); - - continue; - } - - do - { - BOOLEAN bTrainUpDown = FALSE; - - pEntry->CurrTxRateStableTime ++; - - // downgrade TX quality if PER >= Rate-Down threshold - if (TxErrorRatio >= TrainDown) - { - bTrainUpDown = TRUE; - pEntry->TxQuality[CurrRateIdx] = DRS_TX_QUALITY_WORST_BOUND; - } - // upgrade TX quality if PER <= Rate-Up threshold - else if (TxErrorRatio <= TrainUp) - { - bTrainUpDown = TRUE; - bUpgradeQuality = TRUE; - if (pEntry->TxQuality[CurrRateIdx]) - pEntry->TxQuality[CurrRateIdx] --; // quality very good in CurrRate - - if (pEntry->TxRateUpPenalty) - pEntry->TxRateUpPenalty --; - else if (pEntry->TxQuality[UpRateIdx]) - pEntry->TxQuality[UpRateIdx] --; // may improve next UP rate's quality - } - - pEntry->PER[CurrRateIdx] = (UCHAR)TxErrorRatio; - - if (bTrainUpDown) - { - // perform DRS - consider TxRate Down first, then rate up. - if ((CurrRateIdx != DownRateIdx) && (pEntry->TxQuality[CurrRateIdx] >= DRS_TX_QUALITY_WORST_BOUND)) - { - pEntry->CurrTxRateIndex = DownRateIdx; - } - else if ((CurrRateIdx != UpRateIdx) && (pEntry->TxQuality[UpRateIdx] <= 0)) - { - pEntry->CurrTxRateIndex = UpRateIdx; - } - } - } while (FALSE); - - // if rate-up happen, clear all bad history of all TX rates - if (pEntry->CurrTxRateIndex > CurrRateIdx) - { - pEntry->CurrTxRateStableTime = 0; - pEntry->TxRateUpPenalty = 0; - pEntry->LastSecTxRateChangeAction = 1; // rate UP - NdisZeroMemory(pEntry->TxQuality, sizeof(USHORT) * MAX_STEP_OF_TX_RATE_SWITCH); - NdisZeroMemory(pEntry->PER, sizeof(UCHAR) * MAX_STEP_OF_TX_RATE_SWITCH); - - // - // For TxRate fast train up - // - if (!pAd->StaCfg.StaQuickResponeForRateUpTimerRunning) - { - RTMPSetTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, 100); - - pAd->StaCfg.StaQuickResponeForRateUpTimerRunning = TRUE; - } - bTxRateChanged = TRUE; - } - // if rate-down happen, only clear DownRate's bad history - else if (pEntry->CurrTxRateIndex < CurrRateIdx) - { - pEntry->CurrTxRateStableTime = 0; - pEntry->TxRateUpPenalty = 0; // no penalty - pEntry->LastSecTxRateChangeAction = 2; // rate DOWN - pEntry->TxQuality[pEntry->CurrTxRateIndex] = 0; - pEntry->PER[pEntry->CurrTxRateIndex] = 0; - - // - // For TxRate fast train down - // - if (!pAd->StaCfg.StaQuickResponeForRateUpTimerRunning) - { - RTMPSetTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, 100); - - pAd->StaCfg.StaQuickResponeForRateUpTimerRunning = TRUE; - } - bTxRateChanged = TRUE; - } - else - { - pEntry->LastSecTxRateChangeAction = 0; // rate no change - bTxRateChanged = FALSE; - } - - pEntry->LastTxOkCount = TxSuccess; - - { - UCHAR tmpTxRate; - - // to fix tcp ack issue - if (!bTxRateChanged && (pAd->RalinkCounters.OneSecReceivedByteCount > (pAd->RalinkCounters.OneSecTransmittedByteCount * 5))) - { - tmpTxRate = DownRateIdx; - DBGPRINT_RAW(RT_DEBUG_TRACE,("DRS: Rx(%d) is 5 times larger than Tx(%d), use low rate (curr=%d, tmp=%d)\n", - pAd->RalinkCounters.OneSecReceivedByteCount, pAd->RalinkCounters.OneSecTransmittedByteCount, pEntry->CurrTxRateIndex, tmpTxRate)); - } - else - { - tmpTxRate = pEntry->CurrTxRateIndex; - } - - pNextTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(tmpTxRate+1)*5]; - if (bTxRateChanged && pNextTxRate) - { - MlmeSetTxRate(pAd, pEntry, pNextTxRate); - } - } - // reset all OneSecTx counters - RESET_ONE_SEC_TX_CNT(pEntry); - } -} - -/* - ======================================================================== - Routine Description: - Station side, Auto TxRate faster train up timer call back function. - - Arguments: - SystemSpecific1 - Not used. - FunctionContext - Pointer to our Adapter context. - SystemSpecific2 - Not used. - SystemSpecific3 - Not used. - - Return Value: - None - - ======================================================================== -*/ -VOID StaQuickResponeForRateUpExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)FunctionContext; - UCHAR UpRateIdx = 0, DownRateIdx = 0, CurrRateIdx = 0; - ULONG TxTotalCnt; - ULONG TxErrorRatio = 0; - BOOLEAN bTxRateChanged; //, bUpgradeQuality = FALSE; - PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate = NULL; - PUCHAR pTable; - UCHAR TableSize = 0; - UCHAR InitTxRateIdx = 0, TrainUp, TrainDown; - TX_STA_CNT1_STRUC StaTx1; - TX_STA_CNT0_STRUC TxStaCnt0; - CHAR Rssi, ratio; - ULONG TxRetransmit = 0, TxSuccess = 0, TxFailCount = 0; - MAC_TABLE_ENTRY *pEntry; - ULONG i; - - pAd->StaCfg.StaQuickResponeForRateUpTimerRunning = FALSE; - - // - // walk through MAC table, see if need to change AP's TX rate toward each entry - // - for (i = 1; i < MAX_LEN_OF_MAC_TABLE; i++) - { - pEntry = &pAd->MacTab.Content[i]; - - // check if this entry need to switch rate automatically - if (RTMPCheckEntryEnableAutoRateSwitch(pAd, pEntry) == FALSE) - continue; - - if (INFRA_ON(pAd) && (i == 1)) - Rssi = RTMPMaxRssi(pAd, - pAd->StaCfg.RssiSample.AvgRssi0, - pAd->StaCfg.RssiSample.AvgRssi1, - pAd->StaCfg.RssiSample.AvgRssi2); - else - Rssi = RTMPMaxRssi(pAd, - pEntry->RssiSample.AvgRssi0, - pEntry->RssiSample.AvgRssi1, - pEntry->RssiSample.AvgRssi2); - - CurrRateIdx = pAd->CommonCfg.TxRateIndex; - - MlmeSelectTxRateTable(pAd, pEntry, &pTable, &TableSize, &InitTxRateIdx); - - // decide the next upgrade rate and downgrade rate, if any - if ((CurrRateIdx > 0) && (CurrRateIdx < (TableSize - 1))) - { - UpRateIdx = CurrRateIdx + 1; - DownRateIdx = CurrRateIdx -1; - } - else if (CurrRateIdx == 0) - { - UpRateIdx = CurrRateIdx + 1; - DownRateIdx = CurrRateIdx; - } - else if (CurrRateIdx == (TableSize - 1)) - { - UpRateIdx = CurrRateIdx; - DownRateIdx = CurrRateIdx - 1; - } - - pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(CurrRateIdx+1)*5]; - -#ifdef DOT11_N_SUPPORT - if ((Rssi > -65) && (pCurrTxRate->Mode >= MODE_HTMIX)) - { - TrainUp = (pCurrTxRate->TrainUp + (pCurrTxRate->TrainUp >> 1)); - TrainDown = (pCurrTxRate->TrainDown + (pCurrTxRate->TrainDown >> 1)); - } - else -#endif // DOT11_N_SUPPORT // - { - TrainUp = pCurrTxRate->TrainUp; - TrainDown = pCurrTxRate->TrainDown; - } - - if (pAd->MacTab.Size == 1) - { - // Update statistic counter - RTMP_IO_READ32(pAd, TX_STA_CNT0, &TxStaCnt0.word); - RTMP_IO_READ32(pAd, TX_STA_CNT1, &StaTx1.word); - - TxRetransmit = StaTx1.field.TxRetransmit; - TxSuccess = StaTx1.field.TxSuccess; - TxFailCount = TxStaCnt0.field.TxFailCount; - TxTotalCnt = TxRetransmit + TxSuccess + TxFailCount; - - pAd->RalinkCounters.OneSecTxRetryOkCount += StaTx1.field.TxRetransmit; - pAd->RalinkCounters.OneSecTxNoRetryOkCount += StaTx1.field.TxSuccess; - pAd->RalinkCounters.OneSecTxFailCount += TxStaCnt0.field.TxFailCount; - pAd->WlanCounters.TransmittedFragmentCount.u.LowPart += StaTx1.field.TxSuccess; - pAd->WlanCounters.RetryCount.u.LowPart += StaTx1.field.TxRetransmit; - pAd->WlanCounters.FailedCount.u.LowPart += TxStaCnt0.field.TxFailCount; - - if (TxTotalCnt) - TxErrorRatio = ((TxRetransmit + TxFailCount) * 100) / TxTotalCnt; - } - else - { - TxTotalCnt = pEntry->OneSecTxNoRetryOkCount + - pEntry->OneSecTxRetryOkCount + - pEntry->OneSecTxFailCount; - - if (TxTotalCnt) - TxErrorRatio = ((pEntry->OneSecTxRetryOkCount + pEntry->OneSecTxFailCount) * 100) / TxTotalCnt; - } - - - // - // CASE 1. when TX samples are fewer than 15, then decide TX rate solely on RSSI - // (criteria copied from RT2500 for Netopia case) - // - if (TxTotalCnt <= 12) - { - NdisZeroMemory(pAd->DrsCounters.TxQuality, sizeof(USHORT) * MAX_STEP_OF_TX_RATE_SWITCH); - NdisZeroMemory(pAd->DrsCounters.PER, sizeof(UCHAR) * MAX_STEP_OF_TX_RATE_SWITCH); - - if ((pAd->DrsCounters.LastSecTxRateChangeAction == 1) && (CurrRateIdx != DownRateIdx)) - { - pAd->CommonCfg.TxRateIndex = DownRateIdx; - pAd->DrsCounters.TxQuality[CurrRateIdx] = DRS_TX_QUALITY_WORST_BOUND; - } - else if ((pAd->DrsCounters.LastSecTxRateChangeAction == 2) && (CurrRateIdx != UpRateIdx)) - { - pAd->CommonCfg.TxRateIndex = UpRateIdx; - } - - DBGPRINT_RAW(RT_DEBUG_TRACE,("QuickDRS: TxTotalCnt <= 15, train back to original rate \n")); - return; - } - - do - { - ULONG OneSecTxNoRetryOKRationCount; - - if (pAd->DrsCounters.LastTimeTxRateChangeAction == 0) - ratio = 5; - else - ratio = 4; - - // downgrade TX quality if PER >= Rate-Down threshold - if (TxErrorRatio >= TrainDown) - { - pAd->DrsCounters.TxQuality[CurrRateIdx] = DRS_TX_QUALITY_WORST_BOUND; - } - - pAd->DrsCounters.PER[CurrRateIdx] = (UCHAR)TxErrorRatio; - - OneSecTxNoRetryOKRationCount = (TxSuccess * ratio); - - // perform DRS - consider TxRate Down first, then rate up. - if ((pAd->DrsCounters.LastSecTxRateChangeAction == 1) && (CurrRateIdx != DownRateIdx)) - { - if ((pAd->DrsCounters.LastTxOkCount + 2) >= OneSecTxNoRetryOKRationCount) - { - pAd->CommonCfg.TxRateIndex = DownRateIdx; - pAd->DrsCounters.TxQuality[CurrRateIdx] = DRS_TX_QUALITY_WORST_BOUND; - - } - - } - else if ((pAd->DrsCounters.LastSecTxRateChangeAction == 2) && (CurrRateIdx != UpRateIdx)) - { - if ((TxErrorRatio >= 50) || (TxErrorRatio >= TrainDown)) - { - - } - else if ((pAd->DrsCounters.LastTxOkCount + 2) >= OneSecTxNoRetryOKRationCount) - { - pAd->CommonCfg.TxRateIndex = UpRateIdx; - } - } - }while (FALSE); - - // if rate-up happen, clear all bad history of all TX rates - if (pAd->CommonCfg.TxRateIndex > CurrRateIdx) - { - pAd->DrsCounters.TxRateUpPenalty = 0; - NdisZeroMemory(pAd->DrsCounters.TxQuality, sizeof(USHORT) * MAX_STEP_OF_TX_RATE_SWITCH); - NdisZeroMemory(pAd->DrsCounters.PER, sizeof(UCHAR) * MAX_STEP_OF_TX_RATE_SWITCH); - bTxRateChanged = TRUE; - } - // if rate-down happen, only clear DownRate's bad history - else if (pAd->CommonCfg.TxRateIndex < CurrRateIdx) - { - DBGPRINT_RAW(RT_DEBUG_TRACE,("QuickDRS: --TX rate from %d to %d \n", CurrRateIdx, pAd->CommonCfg.TxRateIndex)); - - pAd->DrsCounters.TxRateUpPenalty = 0; // no penalty - pAd->DrsCounters.TxQuality[pAd->CommonCfg.TxRateIndex] = 0; - pAd->DrsCounters.PER[pAd->CommonCfg.TxRateIndex] = 0; - bTxRateChanged = TRUE; - } - else - { - bTxRateChanged = FALSE; - } - - pNextTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(pAd->CommonCfg.TxRateIndex+1)*5]; - if (bTxRateChanged && pNextTxRate) - { - MlmeSetTxRate(pAd, pEntry, pNextTxRate); - } - } -} - -/* - ========================================================================== - Description: - This routine is executed periodically inside MlmePeriodicExec() after - association with an AP. - It checks if StaCfg.Psm is consistent with user policy (recorded in - StaCfg.WindowsPowerMode). If not, enforce user policy. However, - there're some conditions to consider: - 1. we don't support power-saving in ADHOC mode, so Psm=PWR_ACTIVE all - the time when Mibss==TRUE - 2. When link up in INFRA mode, Psm should not be switch to PWR_SAVE - if outgoing traffic available in TxRing or MgmtRing. - Output: - 1. change pAd->StaCfg.Psm to PWR_SAVE or leave it untouched - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID MlmeCheckPsmChange( - IN PRTMP_ADAPTER pAd, - IN ULONG Now32) -{ - ULONG PowerMode; - - // condition - - // 1. Psm maybe ON only happen in INFRASTRUCTURE mode - // 2. user wants either MAX_PSP or FAST_PSP - // 3. but current psm is not in PWR_SAVE - // 4. CNTL state machine is not doing SCANning - // 5. no TX SUCCESS event for the past 1-sec period - PowerMode = pAd->StaCfg.WindowsPowerMode; - - if (INFRA_ON(pAd) && - (PowerMode != Ndis802_11PowerModeCAM) && - (pAd->StaCfg.Psm == PWR_ACTIVE) && -// (! RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE)&& - RTMP_TEST_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP) - /*&& - (pAd->RalinkCounters.OneSecTxNoRetryOkCount == 0) && - (pAd->RalinkCounters.OneSecTxRetryOkCount == 0)*/) - { - NdisGetSystemUpTime(&pAd->Mlme.LastSendNULLpsmTime); - pAd->RalinkCounters.RxCountSinceLastNULL = 0; - RTMP_SET_PSM_BIT(pAd, PWR_SAVE); - if (!(pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable)) - { - RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, FALSE); - } - else - { - RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, TRUE); - } - } -} - -// IRQL = PASSIVE_LEVEL -// IRQL = DISPATCH_LEVEL -VOID MlmeSetPsmBit( - IN PRTMP_ADAPTER pAd, - IN USHORT psm) -{ - AUTO_RSP_CFG_STRUC csr4; - - pAd->StaCfg.Psm = psm; - RTMP_IO_READ32(pAd, AUTO_RSP_CFG, &csr4.word); - csr4.field.AckCtsPsmBit = (psm == PWR_SAVE)? 1:0; - RTMP_IO_WRITE32(pAd, AUTO_RSP_CFG, csr4.word); - DBGPRINT(RT_DEBUG_TRACE, ("MlmeSetPsmBit = %d\n", psm)); -} -#endif // CONFIG_STA_SUPPORT // - -/* - ========================================================================== - Description: - This routine calculates TxPER, RxPER of the past N-sec period. And - according to the calculation result, ChannelQuality is calculated here - to decide if current AP is still doing the job. - - If ChannelQuality is not good, a ROAMing attempt may be tried later. - Output: - StaCfg.ChannelQuality - 0..100 - - IRQL = DISPATCH_LEVEL - - NOTE: This routine decide channle quality based on RX CRC error ratio. - Caller should make sure a function call to NICUpdateRawCounters(pAd) - is performed right before this routine, so that this routine can decide - channel quality based on the most up-to-date information - ========================================================================== - */ -VOID MlmeCalculateChannelQuality( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pMacEntry, - IN ULONG Now32) -{ - ULONG TxOkCnt, TxCnt, TxPER, TxPRR; - ULONG RxCnt, RxPER; - UCHAR NorRssi; - CHAR MaxRssi; - RSSI_SAMPLE *pRssiSample = NULL; - UINT32 OneSecTxNoRetryOkCount = 0; - UINT32 OneSecTxRetryOkCount = 0; - UINT32 OneSecTxFailCount = 0; - UINT32 OneSecRxOkCnt = 0; - UINT32 OneSecRxFcsErrCnt = 0; - ULONG ChannelQuality = 0; // 0..100, Channel Quality Indication for Roaming -#ifdef CONFIG_STA_SUPPORT - ULONG BeaconLostTime = pAd->StaCfg.BeaconLostTime; -#endif // CONFIG_STA_SUPPORT // - -#ifdef CONFIG_STA_SUPPORT -#ifdef CARRIER_DETECTION_SUPPORT // Roger sync Carrier - // longer beacon lost time when carrier detection enabled - if (pAd->CommonCfg.CarrierDetect.Enable == TRUE) - { - BeaconLostTime = pAd->StaCfg.BeaconLostTime + (pAd->StaCfg.BeaconLostTime/2); - } -#endif // CARRIER_DETECTION_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - -#ifdef CONFIG_STA_SUPPORT - if (pAd->OpMode == OPMODE_STA) - { - pRssiSample = &pAd->StaCfg.RssiSample; - OneSecTxNoRetryOkCount = pAd->RalinkCounters.OneSecTxNoRetryOkCount; - OneSecTxRetryOkCount = pAd->RalinkCounters.OneSecTxRetryOkCount; - OneSecTxFailCount = pAd->RalinkCounters.OneSecTxFailCount; - OneSecRxOkCnt = pAd->RalinkCounters.OneSecRxOkCnt; - OneSecRxFcsErrCnt = pAd->RalinkCounters.OneSecRxFcsErrCnt; - } -#endif // CONFIG_STA_SUPPORT // - - MaxRssi = RTMPMaxRssi(pAd, pRssiSample->LastRssi0, - pRssiSample->LastRssi1, - pRssiSample->LastRssi2); - - // - // calculate TX packet error ratio and TX retry ratio - if too few TX samples, skip TX related statistics - // - TxOkCnt = OneSecTxNoRetryOkCount + OneSecTxRetryOkCount; - TxCnt = TxOkCnt + OneSecTxFailCount; - if (TxCnt < 5) - { - TxPER = 0; - TxPRR = 0; - } - else - { - TxPER = (OneSecTxFailCount * 100) / TxCnt; - TxPRR = ((TxCnt - OneSecTxNoRetryOkCount) * 100) / TxCnt; - } - - // - // calculate RX PER - don't take RxPER into consideration if too few sample - // - RxCnt = OneSecRxOkCnt + OneSecRxFcsErrCnt; - if (RxCnt < 5) - RxPER = 0; - else - RxPER = (OneSecRxFcsErrCnt * 100) / RxCnt; - - // - // decide ChannelQuality based on: 1)last BEACON received time, 2)last RSSI, 3)TxPER, and 4)RxPER - // -#ifdef CONFIG_STA_SUPPORT - if ((pAd->OpMode == OPMODE_STA) && - INFRA_ON(pAd) && - (OneSecTxNoRetryOkCount < 2) && // no heavy traffic - ((pAd->StaCfg.LastBeaconRxTime + BeaconLostTime) < Now32)) - { - DBGPRINT(RT_DEBUG_TRACE, ("BEACON lost > %ld msec with TxOkCnt=%ld -> CQI=0\n", BeaconLostTime, TxOkCnt)); - ChannelQuality = 0; - } - else -#endif // CONFIG_STA_SUPPORT // - { - // Normalize Rssi - if (MaxRssi > -40) - NorRssi = 100; - else if (MaxRssi < -90) - NorRssi = 0; - else - NorRssi = (MaxRssi + 90) * 2; - - // ChannelQuality = W1*RSSI + W2*TxPRR + W3*RxPER (RSSI 0..100), (TxPER 100..0), (RxPER 100..0) - ChannelQuality = (RSSI_WEIGHTING * NorRssi + - TX_WEIGHTING * (100 - TxPRR) + - RX_WEIGHTING* (100 - RxPER)) / 100; - } - - -#ifdef CONFIG_STA_SUPPORT - if (pAd->OpMode == OPMODE_STA) - pAd->Mlme.ChannelQuality = (ChannelQuality > 100) ? 100 : ChannelQuality; -#endif // CONFIG_STA_SUPPORT // - - -} - - -// IRQL = DISPATCH_LEVEL -VOID MlmeSetTxPreamble( - IN PRTMP_ADAPTER pAd, - IN USHORT TxPreamble) -{ - AUTO_RSP_CFG_STRUC csr4; - - // - // Always use Long preamble before verifiation short preamble functionality works well. - // Todo: remove the following line if short preamble functionality works - // - //TxPreamble = Rt802_11PreambleLong; - - RTMP_IO_READ32(pAd, AUTO_RSP_CFG, &csr4.word); - if (TxPreamble == Rt802_11PreambleLong) - { - DBGPRINT(RT_DEBUG_TRACE, ("MlmeSetTxPreamble (= LONG PREAMBLE)\n")); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); - csr4.field.AutoResponderPreamble = 0; - } - else - { - // NOTE: 1Mbps should always use long preamble - DBGPRINT(RT_DEBUG_TRACE, ("MlmeSetTxPreamble (= SHORT PREAMBLE)\n")); - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); - csr4.field.AutoResponderPreamble = 1; - } - - RTMP_IO_WRITE32(pAd, AUTO_RSP_CFG, csr4.word); -} - -/* - ========================================================================== - Description: - Update basic rate bitmap - ========================================================================== - */ - -VOID UpdateBasicRateBitmap( - IN PRTMP_ADAPTER pAdapter) -{ - INT i, j; - /* 1 2 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 */ - UCHAR rate[] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 }; - UCHAR *sup_p = pAdapter->CommonCfg.SupRate; - UCHAR *ext_p = pAdapter->CommonCfg.ExtRate; - ULONG bitmap = pAdapter->CommonCfg.BasicRateBitmap; - - - /* if A mode, always use fix BasicRateBitMap */ - //if (pAdapter->CommonCfg.Channel == PHY_11A) - if (pAdapter->CommonCfg.Channel > 14) - pAdapter->CommonCfg.BasicRateBitmap = 0x150; /* 6, 12, 24M */ - /* End of if */ - - if (pAdapter->CommonCfg.BasicRateBitmap > 4095) - { - /* (2 ^ MAX_LEN_OF_SUPPORTED_RATES) -1 */ - return; - } /* End of if */ - - for(i=0; iCommonCfg.DesireRate[i] & 0x7f) - { - case 2: Rate = RATE_1; num++; break; - case 4: Rate = RATE_2; num++; break; - case 11: Rate = RATE_5_5; num++; break; - case 22: Rate = RATE_11; num++; break; - case 12: Rate = RATE_6; num++; break; - case 18: Rate = RATE_9; num++; break; - case 24: Rate = RATE_12; num++; break; - case 36: Rate = RATE_18; num++; break; - case 48: Rate = RATE_24; num++; break; - case 72: Rate = RATE_36; num++; break; - case 96: Rate = RATE_48; num++; break; - case 108: Rate = RATE_54; num++; break; - //default: Rate = RATE_1; break; - } - if (MaxDesire < Rate) MaxDesire = Rate; - } - -//=========================================================================== -//=========================================================================== - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - pHtPhy = &pAd->StaCfg.HTPhyMode; - pMaxHtPhy = &pAd->StaCfg.MaxHTPhyMode; - pMinHtPhy = &pAd->StaCfg.MinHTPhyMode; - - auto_rate_cur_p = &pAd->StaCfg.bAutoTxRateSwitch; - HtMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS; - - if ((pAd->StaCfg.BssType == BSS_ADHOC) && - (pAd->CommonCfg.PhyMode == PHY_11B) && - (MaxDesire > RATE_11)) - { - MaxDesire = RATE_11; - } - } -#endif // CONFIG_STA_SUPPORT // - - pAd->CommonCfg.MaxDesiredRate = MaxDesire; - pMinHtPhy->word = 0; - pMaxHtPhy->word = 0; - pHtPhy->word = 0; - - // Auto rate switching is enabled only if more than one DESIRED RATES are - // specified; otherwise disabled - if (num <= 1) - { - //OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); - //pAd->CommonCfg.bAutoTxRateSwitch = FALSE; - *auto_rate_cur_p = FALSE; - } - else - { - //OPSTATUS_SET_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); - //pAd->CommonCfg.bAutoTxRateSwitch = TRUE; - *auto_rate_cur_p = TRUE; - } - - if (HtMcs != MCS_AUTO) - { - //OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); - //pAd->CommonCfg.bAutoTxRateSwitch = FALSE; - *auto_rate_cur_p = FALSE; - } - else - { - //OPSTATUS_SET_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); - //pAd->CommonCfg.bAutoTxRateSwitch = TRUE; - *auto_rate_cur_p = TRUE; - } - -#ifdef CONFIG_STA_SUPPORT - if ((ADHOC_ON(pAd) || INFRA_ON(pAd)) && (pAd->OpMode == OPMODE_STA)) - { - pSupRate = &pAd->StaActive.SupRate[0]; - pExtRate = &pAd->StaActive.ExtRate[0]; - SupRateLen = pAd->StaActive.SupRateLen; - ExtRateLen = pAd->StaActive.ExtRateLen; - } - else -#endif // CONFIG_STA_SUPPORT // - { - pSupRate = &pAd->CommonCfg.SupRate[0]; - pExtRate = &pAd->CommonCfg.ExtRate[0]; - SupRateLen = pAd->CommonCfg.SupRateLen; - ExtRateLen = pAd->CommonCfg.ExtRateLen; - } - - // find max supported rate - for (i=0; i Rate) MinSupport = Rate; - } - - for (i=0; i Rate) MinSupport = Rate; - } - - RTMP_IO_WRITE32(pAd, LEGACY_BASIC_RATE, BasicRateBitmap); - - // bug fix - // pAd->CommonCfg.BasicRateBitmap = BasicRateBitmap; - - // calculate the exptected ACK rate for each TX rate. This info is used to caculate - // the DURATION field of outgoing uniicast DATA/MGMT frame - for (i=0; iCommonCfg.ExpectedACKRate[i] = CurrBasicRate; - } - - DBGPRINT(RT_DEBUG_TRACE,("MlmeUpdateTxRates[MaxSupport = %d] = MaxDesire %d Mbps\n", RateIdToMbps[MaxSupport], RateIdToMbps[MaxDesire])); - // max tx rate = min {max desire rate, max supported rate} - if (MaxSupport < MaxDesire) - pAd->CommonCfg.MaxTxRate = MaxSupport; - else - pAd->CommonCfg.MaxTxRate = MaxDesire; - - pAd->CommonCfg.MinTxRate = MinSupport; - // 2003-07-31 john - 2500 doesn't have good sensitivity at high OFDM rates. to increase the success - // ratio of initial DHCP packet exchange, TX rate starts from a lower rate depending - // on average RSSI - // 1. RSSI >= -70db, start at 54 Mbps (short distance) - // 2. -70 > RSSI >= -75, start at 24 Mbps (mid distance) - // 3. -75 > RSSI, start at 11 Mbps (long distance) - //if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)/* && - // OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)*/) - if (*auto_rate_cur_p) - { - short dbm = 0; -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - dbm = pAd->StaCfg.RssiSample.AvgRssi0 - pAd->BbpRssiToDbmDelta; -#endif // CONFIG_STA_SUPPORT // - if (bLinkUp == TRUE) - pAd->CommonCfg.TxRate = RATE_24; - else - pAd->CommonCfg.TxRate = pAd->CommonCfg.MaxTxRate; - - if (dbm < -75) - pAd->CommonCfg.TxRate = RATE_11; - else if (dbm < -70) - pAd->CommonCfg.TxRate = RATE_24; - - // should never exceed MaxTxRate (consider 11B-only mode) - if (pAd->CommonCfg.TxRate > pAd->CommonCfg.MaxTxRate) - pAd->CommonCfg.TxRate = pAd->CommonCfg.MaxTxRate; - - pAd->CommonCfg.TxRateIndex = 0; - } - else - { - pAd->CommonCfg.TxRate = pAd->CommonCfg.MaxTxRate; - pHtPhy->field.MCS = (pAd->CommonCfg.MaxTxRate > 3) ? (pAd->CommonCfg.MaxTxRate - 4) : pAd->CommonCfg.MaxTxRate; - pHtPhy->field.MODE = (pAd->CommonCfg.MaxTxRate > 3) ? MODE_OFDM : MODE_CCK; - - pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.STBC = pHtPhy->field.STBC; - pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.ShortGI = pHtPhy->field.ShortGI; - pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MCS = pHtPhy->field.MCS; - pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE = pHtPhy->field.MODE; - } - - if (pAd->CommonCfg.TxRate <= RATE_11) - { - pMaxHtPhy->field.MODE = MODE_CCK; - pMaxHtPhy->field.MCS = pAd->CommonCfg.TxRate; - pMinHtPhy->field.MCS = pAd->CommonCfg.MinTxRate; - } - else - { - pMaxHtPhy->field.MODE = MODE_OFDM; - pMaxHtPhy->field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.TxRate]; - if (pAd->CommonCfg.MinTxRate >= RATE_6 && (pAd->CommonCfg.MinTxRate <= RATE_54)) - {pMinHtPhy->field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MinTxRate];} - else - {pMinHtPhy->field.MCS = pAd->CommonCfg.MinTxRate;} - } - - pHtPhy->word = (pMaxHtPhy->word); - if (bLinkUp && (pAd->OpMode == OPMODE_STA)) - { - pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word = pHtPhy->word; - pAd->MacTab.Content[BSSID_WCID].MaxHTPhyMode.word = pMaxHtPhy->word; - pAd->MacTab.Content[BSSID_WCID].MinHTPhyMode.word = pMinHtPhy->word; - } - else - { - switch (pAd->CommonCfg.PhyMode) - { - case PHY_11BG_MIXED: - case PHY_11B: -#ifdef DOT11_N_SUPPORT - case PHY_11BGN_MIXED: -#endif // DOT11_N_SUPPORT // - pAd->CommonCfg.MlmeRate = RATE_1; - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_CCK; - pAd->CommonCfg.MlmeTransmit.field.MCS = RATE_1; - -//#ifdef WIFI_TEST - pAd->CommonCfg.RtsRate = RATE_11; -//#else -// pAd->CommonCfg.RtsRate = RATE_1; -//#endif - break; - case PHY_11G: - case PHY_11A: -#ifdef DOT11_N_SUPPORT - case PHY_11AGN_MIXED: - case PHY_11GN_MIXED: - case PHY_11N_2_4G: - case PHY_11AN_MIXED: - case PHY_11N_5G: -#endif // DOT11_N_SUPPORT // - pAd->CommonCfg.MlmeRate = RATE_6; - pAd->CommonCfg.RtsRate = RATE_6; - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; - pAd->CommonCfg.MlmeTransmit.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; - break; - case PHY_11ABG_MIXED: -#ifdef DOT11_N_SUPPORT - case PHY_11ABGN_MIXED: -#endif // DOT11_N_SUPPORT // - if (pAd->CommonCfg.Channel <= 14) - { - pAd->CommonCfg.MlmeRate = RATE_1; - pAd->CommonCfg.RtsRate = RATE_1; - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_CCK; - pAd->CommonCfg.MlmeTransmit.field.MCS = RATE_1; - } - else - { - pAd->CommonCfg.MlmeRate = RATE_6; - pAd->CommonCfg.RtsRate = RATE_6; - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; - pAd->CommonCfg.MlmeTransmit.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; - } - break; - default: // error - pAd->CommonCfg.MlmeRate = RATE_6; - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; - pAd->CommonCfg.MlmeTransmit.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; - pAd->CommonCfg.RtsRate = RATE_1; - break; - } - // - // Keep Basic Mlme Rate. - // - pAd->MacTab.Content[MCAST_WCID].HTPhyMode.word = pAd->CommonCfg.MlmeTransmit.word; - if (pAd->CommonCfg.MlmeTransmit.field.MODE == MODE_OFDM) - pAd->MacTab.Content[MCAST_WCID].HTPhyMode.field.MCS = OfdmRateToRxwiMCS[RATE_24]; - else - pAd->MacTab.Content[MCAST_WCID].HTPhyMode.field.MCS = RATE_1; - pAd->CommonCfg.BasicMlmeRate = pAd->CommonCfg.MlmeRate; - } - - DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateTxRates (MaxDesire=%d, MaxSupport=%d, MaxTxRate=%d, MinRate=%d, Rate Switching =%d)\n", - RateIdToMbps[MaxDesire], RateIdToMbps[MaxSupport], RateIdToMbps[pAd->CommonCfg.MaxTxRate], RateIdToMbps[pAd->CommonCfg.MinTxRate], - /*OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)*/*auto_rate_cur_p)); - DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateTxRates (TxRate=%d, RtsRate=%d, BasicRateBitmap=0x%04lx)\n", - RateIdToMbps[pAd->CommonCfg.TxRate], RateIdToMbps[pAd->CommonCfg.RtsRate], BasicRateBitmap)); - DBGPRINT(RT_DEBUG_TRACE, ("MlmeUpdateTxRates (MlmeTransmit=0x%x, MinHTPhyMode=%x, MaxHTPhyMode=0x%x, HTPhyMode=0x%x)\n", - pAd->CommonCfg.MlmeTransmit.word, pAd->MacTab.Content[BSSID_WCID].MinHTPhyMode.word ,pAd->MacTab.Content[BSSID_WCID].MaxHTPhyMode.word ,pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word )); -} - -#ifdef DOT11_N_SUPPORT -/* - ========================================================================== - Description: - This function update HT Rate setting. - Input Wcid value is valid for 2 case : - 1. it's used for Station in infra mode that copy AP rate to Mactable. - 2. OR Station in adhoc mode to copy peer's HT rate to Mactable. - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID MlmeUpdateHtTxRates( - IN PRTMP_ADAPTER pAd, - IN UCHAR apidx) -{ - UCHAR StbcMcs; //j, StbcMcs, bitmask; - CHAR i; // 3*3 - RT_HT_CAPABILITY *pRtHtCap = NULL; - RT_HT_PHY_INFO *pActiveHtPhy = NULL; - ULONG BasicMCS; - UCHAR j, bitmask; - PRT_HT_PHY_INFO pDesireHtPhy = NULL; - PHTTRANSMIT_SETTING pHtPhy = NULL; - PHTTRANSMIT_SETTING pMaxHtPhy = NULL; - PHTTRANSMIT_SETTING pMinHtPhy = NULL; - BOOLEAN *auto_rate_cur_p; - - DBGPRINT(RT_DEBUG_TRACE,("MlmeUpdateHtTxRates===> \n")); - - auto_rate_cur_p = NULL; - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - pDesireHtPhy = &pAd->StaCfg.DesiredHtPhyInfo; - pActiveHtPhy = &pAd->StaCfg.DesiredHtPhyInfo; - pHtPhy = &pAd->StaCfg.HTPhyMode; - pMaxHtPhy = &pAd->StaCfg.MaxHTPhyMode; - pMinHtPhy = &pAd->StaCfg.MinHTPhyMode; - - auto_rate_cur_p = &pAd->StaCfg.bAutoTxRateSwitch; - } -#endif // CONFIG_STA_SUPPORT // - -#ifdef CONFIG_STA_SUPPORT - if ((ADHOC_ON(pAd) || INFRA_ON(pAd)) && (pAd->OpMode == OPMODE_STA)) - { - if (pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) - return; - - pRtHtCap = &pAd->StaActive.SupportedHtPhy; - pActiveHtPhy = &pAd->StaActive.SupportedPhyInfo; - StbcMcs = (UCHAR)pAd->MlmeAux.AddHtInfo.AddHtInfo3.StbcMcs; - BasicMCS =pAd->MlmeAux.AddHtInfo.MCSSet[0]+(pAd->MlmeAux.AddHtInfo.MCSSet[1]<<8)+(StbcMcs<<16); - if ((pAd->CommonCfg.DesiredHtPhy.TxSTBC) && (pRtHtCap->RxSTBC) && (pAd->Antenna.field.TxPath == 2)) - pMaxHtPhy->field.STBC = STBC_USE; - else - pMaxHtPhy->field.STBC = STBC_NONE; - } - else -#endif // CONFIG_STA_SUPPORT // - { - if (pDesireHtPhy->bHtEnable == FALSE) - return; - - pRtHtCap = &pAd->CommonCfg.DesiredHtPhy; - StbcMcs = (UCHAR)pAd->CommonCfg.AddHTInfo.AddHtInfo3.StbcMcs; - BasicMCS = pAd->CommonCfg.AddHTInfo.MCSSet[0]+(pAd->CommonCfg.AddHTInfo.MCSSet[1]<<8)+(StbcMcs<<16); - if ((pAd->CommonCfg.DesiredHtPhy.TxSTBC) && (pRtHtCap->RxSTBC) && (pAd->Antenna.field.TxPath == 2)) - pMaxHtPhy->field.STBC = STBC_USE; - else - pMaxHtPhy->field.STBC = STBC_NONE; - } - - // Decide MAX ht rate. - if ((pRtHtCap->GF) && (pAd->CommonCfg.DesiredHtPhy.GF)) - pMaxHtPhy->field.MODE = MODE_HTGREENFIELD; - else - pMaxHtPhy->field.MODE = MODE_HTMIX; - - if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth) && (pRtHtCap->ChannelWidth)) - pMaxHtPhy->field.BW = BW_40; - else - pMaxHtPhy->field.BW = BW_20; - - if (pMaxHtPhy->field.BW == BW_20) - pMaxHtPhy->field.ShortGI = (pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 & pRtHtCap->ShortGIfor20); - else - pMaxHtPhy->field.ShortGI = (pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 & pRtHtCap->ShortGIfor40); - - if (pDesireHtPhy->MCSSet[4] != 0) - { - pMaxHtPhy->field.MCS = 32; - } - - for (i=23; i>=0; i--) // 3*3 - { - j = i/8; - bitmask = (1<<(i-(j*8))); - - if ((pActiveHtPhy->MCSSet[j] & bitmask) && (pDesireHtPhy->MCSSet[j] & bitmask)) - { - pMaxHtPhy->field.MCS = i; - break; - } - - if (i==0) - break; - } - - // Copy MIN ht rate. rt2860??? - pMinHtPhy->field.BW = BW_20; - pMinHtPhy->field.MCS = 0; - pMinHtPhy->field.STBC = 0; - pMinHtPhy->field.ShortGI = 0; - //If STA assigns fixed rate. update to fixed here. -#ifdef CONFIG_STA_SUPPORT - if ( (pAd->OpMode == OPMODE_STA) && (pDesireHtPhy->MCSSet[0] != 0xff)) - { - if (pDesireHtPhy->MCSSet[4] != 0) - { - pMaxHtPhy->field.MCS = 32; - pMinHtPhy->field.MCS = 32; - DBGPRINT(RT_DEBUG_TRACE,("MlmeUpdateHtTxRates<=== Use Fixed MCS = %d\n",pMinHtPhy->field.MCS)); - } - - for (i=23; (CHAR)i >= 0; i--) // 3*3 - { - j = i/8; - bitmask = (1<<(i-(j*8))); - if ( (pDesireHtPhy->MCSSet[j] & bitmask) && (pActiveHtPhy->MCSSet[j] & bitmask)) - { - pMaxHtPhy->field.MCS = i; - pMinHtPhy->field.MCS = i; - break; - } - if (i==0) - break; - } - } -#endif // CONFIG_STA_SUPPORT // - - - // Decide ht rate - pHtPhy->field.STBC = pMaxHtPhy->field.STBC; - pHtPhy->field.BW = pMaxHtPhy->field.BW; - pHtPhy->field.MODE = pMaxHtPhy->field.MODE; - pHtPhy->field.MCS = pMaxHtPhy->field.MCS; - pHtPhy->field.ShortGI = pMaxHtPhy->field.ShortGI; - - // use default now. rt2860 - if (pDesireHtPhy->MCSSet[0] != 0xff) - *auto_rate_cur_p = FALSE; - else - *auto_rate_cur_p = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateHtTxRates<---.AMsduSize = %d \n", pAd->CommonCfg.DesiredHtPhy.AmsduSize )); - DBGPRINT(RT_DEBUG_TRACE,("TX: MCS[0] = %x (choose %d), BW = %d, ShortGI = %d, MODE = %d, \n", pActiveHtPhy->MCSSet[0],pHtPhy->field.MCS, - pHtPhy->field.BW, pHtPhy->field.ShortGI, pHtPhy->field.MODE)); - DBGPRINT(RT_DEBUG_TRACE,("MlmeUpdateHtTxRates<=== \n")); -} - - -VOID BATableInit( - IN PRTMP_ADAPTER pAd, - IN BA_TABLE *Tab) -{ - int i; - - Tab->numAsOriginator = 0; - Tab->numAsRecipient = 0; - Tab->numDoneOriginator = 0; - NdisAllocateSpinLock(&pAd->BATabLock); - for (i = 0; i < MAX_LEN_OF_BA_REC_TABLE; i++) - { - Tab->BARecEntry[i].REC_BA_Status = Recipient_NONE; - NdisAllocateSpinLock(&(Tab->BARecEntry[i].RxReRingLock)); - } - for (i = 0; i < MAX_LEN_OF_BA_ORI_TABLE; i++) - { - Tab->BAOriEntry[i].ORI_BA_Status = Originator_NONE; - } -} -#endif // DOT11_N_SUPPORT // - -// IRQL = DISPATCH_LEVEL -VOID MlmeRadioOff( - IN PRTMP_ADAPTER pAd) -{ - RTMP_MLME_RADIO_OFF(pAd); -} - -// IRQL = DISPATCH_LEVEL -VOID MlmeRadioOn( - IN PRTMP_ADAPTER pAd) -{ - RTMP_MLME_RADIO_ON(pAd); -} - -// =========================================================================================== -// bss_table.c -// =========================================================================================== - - -/*! \brief initialize BSS table - * \param p_tab pointer to the table - * \return none - * \pre - * \post - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - */ -VOID BssTableInit( - IN BSS_TABLE *Tab) -{ - int i; - - Tab->BssNr = 0; - Tab->BssOverlapNr = 0; - for (i = 0; i < MAX_LEN_OF_BSS_TABLE; i++) - { - NdisZeroMemory(&Tab->BssEntry[i], sizeof(BSS_ENTRY)); - Tab->BssEntry[i].Rssi = -127; // initial the rssi as a minimum value - } -} - - -/*! \brief search the BSS table by SSID - * \param p_tab pointer to the bss table - * \param ssid SSID string - * \return index of the table, BSS_NOT_FOUND if not in the table - * \pre - * \post - * \note search by sequential search - - IRQL = DISPATCH_LEVEL - - */ -ULONG BssTableSearch( - IN BSS_TABLE *Tab, - IN PUCHAR pBssid, - IN UCHAR Channel) -{ - UCHAR i; - - for (i = 0; i < Tab->BssNr; i++) - { - // - // Some AP that support A/B/G mode that may used the same BSSID on 11A and 11B/G. - // We should distinguish this case. - // - if ((((Tab->BssEntry[i].Channel <= 14) && (Channel <= 14)) || - ((Tab->BssEntry[i].Channel > 14) && (Channel > 14))) && - MAC_ADDR_EQUAL(Tab->BssEntry[i].Bssid, pBssid)) - { - return i; - } - } - return (ULONG)BSS_NOT_FOUND; -} - -ULONG BssSsidTableSearch( - IN BSS_TABLE *Tab, - IN PUCHAR pBssid, - IN PUCHAR pSsid, - IN UCHAR SsidLen, - IN UCHAR Channel) -{ - UCHAR i; - - for (i = 0; i < Tab->BssNr; i++) - { - // - // Some AP that support A/B/G mode that may used the same BSSID on 11A and 11B/G. - // We should distinguish this case. - // - if ((((Tab->BssEntry[i].Channel <= 14) && (Channel <= 14)) || - ((Tab->BssEntry[i].Channel > 14) && (Channel > 14))) && - MAC_ADDR_EQUAL(Tab->BssEntry[i].Bssid, pBssid) && - SSID_EQUAL(pSsid, SsidLen, Tab->BssEntry[i].Ssid, Tab->BssEntry[i].SsidLen)) - { - return i; - } - } - return (ULONG)BSS_NOT_FOUND; -} - -ULONG BssTableSearchWithSSID( - IN BSS_TABLE *Tab, - IN PUCHAR Bssid, - IN PUCHAR pSsid, - IN UCHAR SsidLen, - IN UCHAR Channel) -{ - UCHAR i; - - for (i = 0; i < Tab->BssNr; i++) - { - if ((((Tab->BssEntry[i].Channel <= 14) && (Channel <= 14)) || - ((Tab->BssEntry[i].Channel > 14) && (Channel > 14))) && - MAC_ADDR_EQUAL(&(Tab->BssEntry[i].Bssid), Bssid) && - (SSID_EQUAL(pSsid, SsidLen, Tab->BssEntry[i].Ssid, Tab->BssEntry[i].SsidLen) || - (NdisEqualMemory(pSsid, ZeroSsid, SsidLen)) || - (NdisEqualMemory(Tab->BssEntry[i].Ssid, ZeroSsid, Tab->BssEntry[i].SsidLen)))) - { - return i; - } - } - return (ULONG)BSS_NOT_FOUND; -} - - -ULONG BssSsidTableSearchBySSID( - IN BSS_TABLE *Tab, - IN PUCHAR pSsid, - IN UCHAR SsidLen) -{ - UCHAR i; - - for (i = 0; i < Tab->BssNr; i++) - { - if (SSID_EQUAL(pSsid, SsidLen, Tab->BssEntry[i].Ssid, Tab->BssEntry[i].SsidLen)) - { - return i; - } - } - return (ULONG)BSS_NOT_FOUND; -} - - -// IRQL = DISPATCH_LEVEL -VOID BssTableDeleteEntry( - IN OUT BSS_TABLE *Tab, - IN PUCHAR pBssid, - IN UCHAR Channel) -{ - UCHAR i, j; - - for (i = 0; i < Tab->BssNr; i++) - { - if ((Tab->BssEntry[i].Channel == Channel) && - (MAC_ADDR_EQUAL(Tab->BssEntry[i].Bssid, pBssid))) - { - for (j = i; j < Tab->BssNr - 1; j++) - { - NdisMoveMemory(&(Tab->BssEntry[j]), &(Tab->BssEntry[j + 1]), sizeof(BSS_ENTRY)); - } - NdisZeroMemory(&(Tab->BssEntry[Tab->BssNr - 1]), sizeof(BSS_ENTRY)); - Tab->BssNr -= 1; - return; - } - } -} - -#ifdef DOT11_N_SUPPORT -/* - ======================================================================== - Routine Description: - Delete the Originator Entry in BAtable. Or decrease numAs Originator by 1 if needed. - - Arguments: - // IRQL = DISPATCH_LEVEL - ======================================================================== -*/ -VOID BATableDeleteORIEntry( - IN OUT PRTMP_ADAPTER pAd, - IN BA_ORI_ENTRY *pBAORIEntry) -{ - - if (pBAORIEntry->ORI_BA_Status != Originator_NONE) - { - NdisAcquireSpinLock(&pAd->BATabLock); - if (pBAORIEntry->ORI_BA_Status == Originator_Done) - { - pAd->BATable.numAsOriginator -= 1; - DBGPRINT(RT_DEBUG_TRACE, ("BATableDeleteORIEntry numAsOriginator= %ld\n", pAd->BATable.numAsRecipient)); - // Erase Bitmap flag. - } - pAd->MacTab.Content[pBAORIEntry->Wcid].TXBAbitmap &= (~(1<<(pBAORIEntry->TID) )); // If STA mode, erase flag here - pAd->MacTab.Content[pBAORIEntry->Wcid].BAOriWcidArray[pBAORIEntry->TID] = 0; // If STA mode, erase flag here - pBAORIEntry->ORI_BA_Status = Originator_NONE; - pBAORIEntry->Token = 1; - // Not clear Sequence here. - NdisReleaseSpinLock(&pAd->BATabLock); - } -} -#endif // DOT11_N_SUPPORT // - -/*! \brief - * \param - * \return - * \pre - * \post - - IRQL = DISPATCH_LEVEL - - */ -VOID BssEntrySet( - IN PRTMP_ADAPTER pAd, - OUT BSS_ENTRY *pBss, - IN PUCHAR pBssid, - IN CHAR Ssid[], - IN UCHAR SsidLen, - IN UCHAR BssType, - IN USHORT BeaconPeriod, - IN PCF_PARM pCfParm, - IN USHORT AtimWin, - IN USHORT CapabilityInfo, - IN UCHAR SupRate[], - IN UCHAR SupRateLen, - IN UCHAR ExtRate[], - IN UCHAR ExtRateLen, - IN HT_CAPABILITY_IE *pHtCapability, - IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE - IN UCHAR HtCapabilityLen, - IN UCHAR AddHtInfoLen, - IN UCHAR NewExtChanOffset, - IN UCHAR Channel, - IN CHAR Rssi, - IN LARGE_INTEGER TimeStamp, - IN UCHAR CkipFlag, - IN PEDCA_PARM pEdcaParm, - IN PQOS_CAPABILITY_PARM pQosCapability, - IN PQBSS_LOAD_PARM pQbssLoad, - IN USHORT LengthVIE, - IN PNDIS_802_11_VARIABLE_IEs pVIE) -{ - COPY_MAC_ADDR(pBss->Bssid, pBssid); - // Default Hidden SSID to be TRUE, it will be turned to FALSE after coping SSID - pBss->Hidden = 1; - if (SsidLen > 0) - { - // For hidden SSID AP, it might send beacon with SSID len equal to 0 - // Or send beacon /probe response with SSID len matching real SSID length, - // but SSID is all zero. such as "00-00-00-00" with length 4. - // We have to prevent this case overwrite correct table - if (NdisEqualMemory(Ssid, ZeroSsid, SsidLen) == 0) - { - NdisZeroMemory(pBss->Ssid, MAX_LEN_OF_SSID); - NdisMoveMemory(pBss->Ssid, Ssid, SsidLen); - pBss->SsidLen = SsidLen; - pBss->Hidden = 0; - } - } - else - pBss->SsidLen = 0; - pBss->BssType = BssType; - pBss->BeaconPeriod = BeaconPeriod; - if (BssType == BSS_INFRA) - { - if (pCfParm->bValid) - { - pBss->CfpCount = pCfParm->CfpCount; - pBss->CfpPeriod = pCfParm->CfpPeriod; - pBss->CfpMaxDuration = pCfParm->CfpMaxDuration; - pBss->CfpDurRemaining = pCfParm->CfpDurRemaining; - } - } - else - { - pBss->AtimWin = AtimWin; - } - - pBss->CapabilityInfo = CapabilityInfo; - // The privacy bit indicate security is ON, it maight be WEP, TKIP or AES - // Combine with AuthMode, they will decide the connection methods. - pBss->Privacy = CAP_IS_PRIVACY_ON(pBss->CapabilityInfo); - ASSERT(SupRateLen <= MAX_LEN_OF_SUPPORTED_RATES); - if (SupRateLen <= MAX_LEN_OF_SUPPORTED_RATES) - NdisMoveMemory(pBss->SupRate, SupRate, SupRateLen); - else - NdisMoveMemory(pBss->SupRate, SupRate, MAX_LEN_OF_SUPPORTED_RATES); - pBss->SupRateLen = SupRateLen; - ASSERT(ExtRateLen <= MAX_LEN_OF_SUPPORTED_RATES); - NdisMoveMemory(pBss->ExtRate, ExtRate, ExtRateLen); - pBss->NewExtChanOffset = NewExtChanOffset; - pBss->ExtRateLen = ExtRateLen; - pBss->Channel = Channel; - pBss->CentralChannel = Channel; - pBss->Rssi = Rssi; - // Update CkipFlag. if not exists, the value is 0x0 - pBss->CkipFlag = CkipFlag; - - // New for microsoft Fixed IEs - NdisMoveMemory(pBss->FixIEs.Timestamp, &TimeStamp, 8); - pBss->FixIEs.BeaconInterval = BeaconPeriod; - pBss->FixIEs.Capabilities = CapabilityInfo; - - // New for microsoft Variable IEs - if (LengthVIE != 0) - { - pBss->VarIELen = LengthVIE; - NdisMoveMemory(pBss->VarIEs, pVIE, pBss->VarIELen); - } - else - { - pBss->VarIELen = 0; - } - - pBss->AddHtInfoLen = 0; - pBss->HtCapabilityLen = 0; -#ifdef DOT11_N_SUPPORT - if (HtCapabilityLen> 0) - { - pBss->HtCapabilityLen = HtCapabilityLen; - NdisMoveMemory(&pBss->HtCapability, pHtCapability, HtCapabilityLen); - if (AddHtInfoLen > 0) - { - pBss->AddHtInfoLen = AddHtInfoLen; - NdisMoveMemory(&pBss->AddHtInfo, pAddHtInfo, AddHtInfoLen); - - if ((pAddHtInfo->ControlChan > 2)&& (pAddHtInfo->AddHtInfo.ExtChanOffset == EXTCHA_BELOW) && (pHtCapability->HtCapInfo.ChannelWidth == BW_40)) - { - pBss->CentralChannel = pAddHtInfo->ControlChan - 2; - } - else if ((pAddHtInfo->AddHtInfo.ExtChanOffset == EXTCHA_ABOVE) && (pHtCapability->HtCapInfo.ChannelWidth == BW_40)) - { - pBss->CentralChannel = pAddHtInfo->ControlChan + 2; - } - } - } -#endif // DOT11_N_SUPPORT // - - BssCipherParse(pBss); - - // new for QOS - if (pEdcaParm) - NdisMoveMemory(&pBss->EdcaParm, pEdcaParm, sizeof(EDCA_PARM)); - else - pBss->EdcaParm.bValid = FALSE; - if (pQosCapability) - NdisMoveMemory(&pBss->QosCapability, pQosCapability, sizeof(QOS_CAPABILITY_PARM)); - else - pBss->QosCapability.bValid = FALSE; - if (pQbssLoad) - NdisMoveMemory(&pBss->QbssLoad, pQbssLoad, sizeof(QBSS_LOAD_PARM)); - else - pBss->QbssLoad.bValid = FALSE; - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - PEID_STRUCT pEid; - USHORT Length = 0; - - - NdisZeroMemory(&pBss->WpaIE.IE[0], MAX_CUSTOM_LEN); - NdisZeroMemory(&pBss->RsnIE.IE[0], MAX_CUSTOM_LEN); -#ifdef EXT_BUILD_CHANNEL_LIST - NdisZeroMemory(&pBss->CountryString[0], 3); - pBss->bHasCountryIE = FALSE; -#endif // EXT_BUILD_CHANNEL_LIST // - pEid = (PEID_STRUCT) pVIE; - while ((Length + 2 + (USHORT)pEid->Len) <= LengthVIE) - { - switch(pEid->Eid) - { - case IE_WPA: - if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4)) - { - if ((pEid->Len + 2) > MAX_CUSTOM_LEN) - { - pBss->WpaIE.IELen = 0; - break; - } - pBss->WpaIE.IELen = pEid->Len + 2; - NdisMoveMemory(pBss->WpaIE.IE, pEid, pBss->WpaIE.IELen); - } - break; - case IE_RSN: - if (NdisEqualMemory(pEid->Octet + 2, RSN_OUI, 3)) - { - if ((pEid->Len + 2) > MAX_CUSTOM_LEN) - { - pBss->RsnIE.IELen = 0; - break; - } - pBss->RsnIE.IELen = pEid->Len + 2; - NdisMoveMemory(pBss->RsnIE.IE, pEid, pBss->RsnIE.IELen); - } - break; -#ifdef EXT_BUILD_CHANNEL_LIST - case IE_COUNTRY: - NdisMoveMemory(&pBss->CountryString[0], pEid->Octet, 3); - pBss->bHasCountryIE = TRUE; - break; -#endif // EXT_BUILD_CHANNEL_LIST // - } - Length = Length + 2 + (USHORT)pEid->Len; // Eid[1] + Len[1]+ content[Len] - pEid = (PEID_STRUCT)((UCHAR*)pEid + 2 + pEid->Len); - } - } -#endif // CONFIG_STA_SUPPORT // -} - -/*! - * \brief insert an entry into the bss table - * \param p_tab The BSS table - * \param Bssid BSSID - * \param ssid SSID - * \param ssid_len Length of SSID - * \param bss_type - * \param beacon_period - * \param timestamp - * \param p_cf - * \param atim_win - * \param cap - * \param rates - * \param rates_len - * \param channel_idx - * \return none - * \pre - * \post - * \note If SSID is identical, the old entry will be replaced by the new one - - IRQL = DISPATCH_LEVEL - - */ -ULONG BssTableSetEntry( - IN PRTMP_ADAPTER pAd, - OUT BSS_TABLE *Tab, - IN PUCHAR pBssid, - IN CHAR Ssid[], - IN UCHAR SsidLen, - IN UCHAR BssType, - IN USHORT BeaconPeriod, - IN CF_PARM *CfParm, - IN USHORT AtimWin, - IN USHORT CapabilityInfo, - IN UCHAR SupRate[], - IN UCHAR SupRateLen, - IN UCHAR ExtRate[], - IN UCHAR ExtRateLen, - IN HT_CAPABILITY_IE *pHtCapability, - IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE - IN UCHAR HtCapabilityLen, - IN UCHAR AddHtInfoLen, - IN UCHAR NewExtChanOffset, - IN UCHAR ChannelNo, - IN CHAR Rssi, - IN LARGE_INTEGER TimeStamp, - IN UCHAR CkipFlag, - IN PEDCA_PARM pEdcaParm, - IN PQOS_CAPABILITY_PARM pQosCapability, - IN PQBSS_LOAD_PARM pQbssLoad, - IN USHORT LengthVIE, - IN PNDIS_802_11_VARIABLE_IEs pVIE) -{ - ULONG Idx; - - Idx = BssTableSearchWithSSID(Tab, pBssid, (UCHAR *)Ssid, SsidLen, ChannelNo); - if (Idx == BSS_NOT_FOUND) - { - if (Tab->BssNr >= MAX_LEN_OF_BSS_TABLE) - { - // - // It may happen when BSS Table was full. - // The desired AP will not be added into BSS Table - // In this case, if we found the desired AP then overwrite BSS Table. - // - if(!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, pBssid) || - SSID_EQUAL(pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, Ssid, SsidLen)) - { - Idx = Tab->BssOverlapNr; - BssEntrySet(pAd, &Tab->BssEntry[Idx], pBssid, Ssid, SsidLen, BssType, BeaconPeriod, CfParm, AtimWin, - CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen,pHtCapability, pAddHtInfo,HtCapabilityLen, AddHtInfoLen, - NewExtChanOffset, ChannelNo, Rssi, TimeStamp, CkipFlag, pEdcaParm, pQosCapability, pQbssLoad, LengthVIE, pVIE); - Tab->BssOverlapNr = (Tab->BssOverlapNr++) % MAX_LEN_OF_BSS_TABLE; - } - return Idx; - } - else - { - return BSS_NOT_FOUND; - } - } - Idx = Tab->BssNr; - BssEntrySet(pAd, &Tab->BssEntry[Idx], pBssid, Ssid, SsidLen, BssType, BeaconPeriod, CfParm, AtimWin, - CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen,pHtCapability, pAddHtInfo,HtCapabilityLen, AddHtInfoLen, - NewExtChanOffset, ChannelNo, Rssi, TimeStamp, CkipFlag, pEdcaParm, pQosCapability, pQbssLoad, LengthVIE, pVIE); - Tab->BssNr++; - } - else - { - /* avoid Hidden SSID form beacon to overwirite correct SSID from probe response */ - if ((SSID_EQUAL(Ssid, SsidLen, Tab->BssEntry[Idx].Ssid, Tab->BssEntry[Idx].SsidLen)) || - (NdisEqualMemory(Tab->BssEntry[Idx].Ssid, ZeroSsid, Tab->BssEntry[Idx].SsidLen))) - { - BssEntrySet(pAd, &Tab->BssEntry[Idx], pBssid, Ssid, SsidLen, BssType, BeaconPeriod,CfParm, AtimWin, - CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen,pHtCapability, pAddHtInfo,HtCapabilityLen, AddHtInfoLen, - NewExtChanOffset, ChannelNo, Rssi, TimeStamp, CkipFlag, pEdcaParm, pQosCapability, pQbssLoad, LengthVIE, pVIE); - } - } - - return Idx; -} - -#ifdef CONFIG_STA_SUPPORT -#ifdef DOT11_N_SUPPORT -#ifdef DOT11N_DRAFT3 -VOID TriEventInit( - IN PRTMP_ADAPTER pAd) -{ - UCHAR i; - - for (i = 0;i < MAX_TRIGGER_EVENT;i++) - pAd->CommonCfg.TriggerEventTab.EventA[i].bValid = FALSE; - - pAd->CommonCfg.TriggerEventTab.EventANo = 0; - pAd->CommonCfg.TriggerEventTab.EventBCountDown = 0; -} - -ULONG TriEventTableSetEntry( - IN PRTMP_ADAPTER pAd, - OUT TRIGGER_EVENT_TAB *Tab, - IN PUCHAR pBssid, - IN HT_CAPABILITY_IE *pHtCapability, - IN UCHAR HtCapabilityLen, - IN UCHAR RegClass, - IN UCHAR ChannelNo) -{ - // Event A - if (HtCapabilityLen == 0) - { - if (Tab->EventANo < MAX_TRIGGER_EVENT) - { - RTMPMoveMemory(Tab->EventA[Tab->EventANo].BSSID, pBssid, 6); - Tab->EventA[Tab->EventANo].bValid = TRUE; - Tab->EventA[Tab->EventANo].Channel = ChannelNo; - Tab->EventA[Tab->EventANo].CDCounter = pAd->CommonCfg.Dot11BssWidthChanTranDelay; - if (RegClass != 0) - { - // Beacon has Regulatory class IE. So use beacon's - Tab->EventA[Tab->EventANo].RegClass = RegClass; - } - else - { - // Use Station's Regulatory class instead. - if (pAd->StaActive.SupportedHtPhy.bHtEnable == TRUE) - { - if (pAd->CommonCfg.CentralChannel > pAd->CommonCfg.Channel) - { - Tab->EventA[Tab->EventANo].RegClass = 32; - } - else if (pAd->CommonCfg.CentralChannel < pAd->CommonCfg.Channel) - Tab->EventA[Tab->EventANo].RegClass = 33; - } - else - Tab->EventA[Tab->EventANo].RegClass = ??; - - } - - Tab->EventANo ++; - } - } - else if (pHtCapability->HtCapInfo.Intolerant40) - { - Tab->EventBCountDown = pAd->CommonCfg.Dot11BssWidthChanTranDelay; - } - -} - -/* - ======================================================================== - Routine Description: - Trigger Event table Maintainence called once every second. - - Arguments: - // IRQL = DISPATCH_LEVEL - ======================================================================== -*/ -VOID TriEventCounterMaintenance( - IN PRTMP_ADAPTER pAd) -{ - UCHAR i; - BOOLEAN bNotify = FALSE; - for (i = 0;i < MAX_TRIGGER_EVENT;i++) - { - if (pAd->CommonCfg.TriggerEventTab.EventA[i].bValid && (pAd->CommonCfg.TriggerEventTab.EventA[i].CDCounter > 0)) - { - pAd->CommonCfg.TriggerEventTab.EventA[i].CDCounter--; - if (pAd->CommonCfg.TriggerEventTab.EventA[i].CDCounter == 0) - { - pAd->CommonCfg.TriggerEventTab.EventA[i].bValid = FALSE; - pAd->CommonCfg.TriggerEventTab.EventANo --; - // Need to send 20/40 Coexistence Notify frame if has status change. - bNotify = TRUE; - } - } - } - if (pAd->CommonCfg.TriggerEventTab.EventBCountDown > 0) - { - pAd->CommonCfg.TriggerEventTab.EventBCountDown--; - if (pAd->CommonCfg.TriggerEventTab.EventBCountDown == 0) - bNotify = TRUE; - } - - if (bNotify == TRUE) - Update2040CoexistFrameAndNotify(pAd, BSSID_WCID, TRUE); -} -#endif // DOT11N_DRAFT3 // -#endif // DOT11_N_SUPPORT // - -// IRQL = DISPATCH_LEVEL -VOID BssTableSsidSort( - IN PRTMP_ADAPTER pAd, - OUT BSS_TABLE *OutTab, - IN CHAR Ssid[], - IN UCHAR SsidLen) -{ - INT i; - BssTableInit(OutTab); - - for (i = 0; i < pAd->ScanTab.BssNr; i++) - { - BSS_ENTRY *pInBss = &pAd->ScanTab.BssEntry[i]; - BOOLEAN bIsHiddenApIncluded = FALSE; - - if (((pAd->CommonCfg.bIEEE80211H == 1) && - (pAd->MlmeAux.Channel > 14) && - RadarChannelCheck(pAd, pInBss->Channel)) -#ifdef CARRIER_DETECTION_SUPPORT // Roger sync Carrier - || (pAd->CommonCfg.CarrierDetect.Enable == TRUE) -#endif // CARRIER_DETECTION_SUPPORT // - ) -{ - if (pInBss->Hidden) - bIsHiddenApIncluded = TRUE; -} - - if ((pInBss->BssType == pAd->StaCfg.BssType) && - (SSID_EQUAL(Ssid, SsidLen, pInBss->Ssid, pInBss->SsidLen) || bIsHiddenApIncluded)) - { - BSS_ENTRY *pOutBss = &OutTab->BssEntry[OutTab->BssNr]; - - -#ifdef EXT_BUILD_CHANNEL_LIST - // If no Country IE exists no Connection will be established when IEEE80211dClientMode is strict. - if ((pAd->StaCfg.IEEE80211dClientMode == Rt802_11_D_Strict) && - (pInBss->bHasCountryIE == FALSE)) - { - DBGPRINT(RT_DEBUG_TRACE,("StaCfg.IEEE80211dClientMode == Rt802_11_D_Strict, but this AP doesn't have country IE.\n")); - continue; - } -#endif // EXT_BUILD_CHANNEL_LIST // - -#ifdef DOT11_N_SUPPORT - // 2.4G/5G N only mode - if ((pInBss->HtCapabilityLen == 0) && - ((pAd->CommonCfg.PhyMode == PHY_11N_2_4G) || (pAd->CommonCfg.PhyMode == PHY_11N_5G))) - { - DBGPRINT(RT_DEBUG_TRACE,("STA is in N-only Mode, this AP don't have Ht capability in Beacon.\n")); - continue; - } -#endif // DOT11_N_SUPPORT // - - // New for WPA2 - // Check the Authmode first - if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - { - // Check AuthMode and AuthModeAux for matching, in case AP support dual-mode - if ((pAd->StaCfg.AuthMode != pInBss->AuthMode) && (pAd->StaCfg.AuthMode != pInBss->AuthModeAux)) - // None matched - continue; - - // Check cipher suite, AP must have more secured cipher than station setting - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) - { - // If it's not mixed mode, we should only let BSS pass with the same encryption - if (pInBss->WPA.bMixMode == FALSE) - if (pAd->StaCfg.WepStatus != pInBss->WPA.GroupCipher) - continue; - - // check group cipher - if ((pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) && - (pInBss->WPA.GroupCipher != Ndis802_11GroupWEP40Enabled) && - (pInBss->WPA.GroupCipher != Ndis802_11GroupWEP104Enabled)) - continue; - - // check pairwise cipher, skip if none matched - // If profile set to AES, let it pass without question. - // If profile set to TKIP, we must find one mateched - if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && - (pAd->StaCfg.WepStatus != pInBss->WPA.PairCipher) && - (pAd->StaCfg.WepStatus != pInBss->WPA.PairCipherAux)) - continue; - } - else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - // If it's not mixed mode, we should only let BSS pass with the same encryption - if (pInBss->WPA2.bMixMode == FALSE) - if (pAd->StaCfg.WepStatus != pInBss->WPA2.GroupCipher) - continue; - - // check group cipher - if ((pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) && - (pInBss->WPA2.GroupCipher != Ndis802_11GroupWEP40Enabled) && - (pInBss->WPA2.GroupCipher != Ndis802_11GroupWEP104Enabled)) - continue; - - // check pairwise cipher, skip if none matched - // If profile set to AES, let it pass without question. - // If profile set to TKIP, we must find one mateched - if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && - (pAd->StaCfg.WepStatus != pInBss->WPA2.PairCipher) && - (pAd->StaCfg.WepStatus != pInBss->WPA2.PairCipherAux)) - continue; - } - } - // Bss Type matched, SSID matched. - // We will check wepstatus for qualification Bss - else if (pAd->StaCfg.WepStatus != pInBss->WepStatus) - { - DBGPRINT(RT_DEBUG_TRACE,("StaCfg.WepStatus=%d, while pInBss->WepStatus=%d\n", pAd->StaCfg.WepStatus, pInBss->WepStatus)); - // - // For the SESv2 case, we will not qualify WepStatus. - // - if (!pInBss->bSES) - continue; - } - - // Since the AP is using hidden SSID, and we are trying to connect to ANY - // It definitely will fail. So, skip it. - // CCX also require not even try to connect it!! - if (SsidLen == 0) - continue; - -#ifdef DOT11_N_SUPPORT - // If both station and AP use 40MHz, still need to check if the 40MHZ band's legality in my country region - // If this 40MHz wideband is not allowed in my country list, use bandwidth 20MHZ instead, - if ((pInBss->CentralChannel != pInBss->Channel) && - (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)) - { - if (RTMPCheckChannel(pAd, pInBss->CentralChannel, pInBss->Channel) == FALSE) - { - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - SetCommonHT(pAd); - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40; - } - else - { - if (pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BAND_WIDTH_20) - { - SetCommonHT(pAd); - } - } - } -#endif // DOT11_N_SUPPORT // - - // copy matching BSS from InTab to OutTab - NdisMoveMemory(pOutBss, pInBss, sizeof(BSS_ENTRY)); - - OutTab->BssNr++; - } - else if ((pInBss->BssType == pAd->StaCfg.BssType) && (SsidLen == 0)) - { - BSS_ENTRY *pOutBss = &OutTab->BssEntry[OutTab->BssNr]; - - -#ifdef DOT11_N_SUPPORT - // 2.4G/5G N only mode - if ((pInBss->HtCapabilityLen == 0) && - ((pAd->CommonCfg.PhyMode == PHY_11N_2_4G) || (pAd->CommonCfg.PhyMode == PHY_11N_5G))) - { - DBGPRINT(RT_DEBUG_TRACE,("STA is in N-only Mode, this AP don't have Ht capability in Beacon.\n")); - continue; - } -#endif // DOT11_N_SUPPORT // - - // New for WPA2 - // Check the Authmode first - if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - { - // Check AuthMode and AuthModeAux for matching, in case AP support dual-mode - if ((pAd->StaCfg.AuthMode != pInBss->AuthMode) && (pAd->StaCfg.AuthMode != pInBss->AuthModeAux)) - // None matched - continue; - - // Check cipher suite, AP must have more secured cipher than station setting - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) - { - // If it's not mixed mode, we should only let BSS pass with the same encryption - if (pInBss->WPA.bMixMode == FALSE) - if (pAd->StaCfg.WepStatus != pInBss->WPA.GroupCipher) - continue; - - // check group cipher - if (pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) - continue; - - // check pairwise cipher, skip if none matched - // If profile set to AES, let it pass without question. - // If profile set to TKIP, we must find one mateched - if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && - (pAd->StaCfg.WepStatus != pInBss->WPA.PairCipher) && - (pAd->StaCfg.WepStatus != pInBss->WPA.PairCipherAux)) - continue; - } - else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - // If it's not mixed mode, we should only let BSS pass with the same encryption - if (pInBss->WPA2.bMixMode == FALSE) - if (pAd->StaCfg.WepStatus != pInBss->WPA2.GroupCipher) - continue; - - // check group cipher - if (pAd->StaCfg.WepStatus < pInBss->WPA2.GroupCipher) - continue; - - // check pairwise cipher, skip if none matched - // If profile set to AES, let it pass without question. - // If profile set to TKIP, we must find one mateched - if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && - (pAd->StaCfg.WepStatus != pInBss->WPA2.PairCipher) && - (pAd->StaCfg.WepStatus != pInBss->WPA2.PairCipherAux)) - continue; - } - } - // Bss Type matched, SSID matched. - // We will check wepstatus for qualification Bss - else if (pAd->StaCfg.WepStatus != pInBss->WepStatus) - continue; - -#ifdef DOT11_N_SUPPORT - // If both station and AP use 40MHz, still need to check if the 40MHZ band's legality in my country region - // If this 40MHz wideband is not allowed in my country list, use bandwidth 20MHZ instead, - if ((pInBss->CentralChannel != pInBss->Channel) && - (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)) - { - if (RTMPCheckChannel(pAd, pInBss->CentralChannel, pInBss->Channel) == FALSE) - { - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - SetCommonHT(pAd); - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40; - } - } -#endif // DOT11_N_SUPPORT // - - // copy matching BSS from InTab to OutTab - NdisMoveMemory(pOutBss, pInBss, sizeof(BSS_ENTRY)); - - OutTab->BssNr++; - } - - if (OutTab->BssNr >= MAX_LEN_OF_BSS_TABLE) - break; - } - - BssTableSortByRssi(OutTab); -} - - -// IRQL = DISPATCH_LEVEL -VOID BssTableSortByRssi( - IN OUT BSS_TABLE *OutTab) -{ - INT i, j; - BSS_ENTRY TmpBss; - - for (i = 0; i < OutTab->BssNr - 1; i++) - { - for (j = i+1; j < OutTab->BssNr; j++) - { - if (OutTab->BssEntry[j].Rssi > OutTab->BssEntry[i].Rssi) - { - NdisMoveMemory(&TmpBss, &OutTab->BssEntry[j], sizeof(BSS_ENTRY)); - NdisMoveMemory(&OutTab->BssEntry[j], &OutTab->BssEntry[i], sizeof(BSS_ENTRY)); - NdisMoveMemory(&OutTab->BssEntry[i], &TmpBss, sizeof(BSS_ENTRY)); - } - } - } -} -#endif // CONFIG_STA_SUPPORT // - - -VOID BssCipherParse( - IN OUT PBSS_ENTRY pBss) -{ - PEID_STRUCT pEid; - PUCHAR pTmp; - PRSN_IE_HEADER_STRUCT pRsnHeader; - PCIPHER_SUITE_STRUCT pCipher; - PAKM_SUITE_STRUCT pAKM; - USHORT Count; - INT Length; - NDIS_802_11_ENCRYPTION_STATUS TmpCipher; - - // - // WepStatus will be reset later, if AP announce TKIP or AES on the beacon frame. - // - if (pBss->Privacy) - { - pBss->WepStatus = Ndis802_11WEPEnabled; - } - else - { - pBss->WepStatus = Ndis802_11WEPDisabled; - } - // Set default to disable & open authentication before parsing variable IE - pBss->AuthMode = Ndis802_11AuthModeOpen; - pBss->AuthModeAux = Ndis802_11AuthModeOpen; - - // Init WPA setting - pBss->WPA.PairCipher = Ndis802_11WEPDisabled; - pBss->WPA.PairCipherAux = Ndis802_11WEPDisabled; - pBss->WPA.GroupCipher = Ndis802_11WEPDisabled; - pBss->WPA.RsnCapability = 0; - pBss->WPA.bMixMode = FALSE; - - // Init WPA2 setting - pBss->WPA2.PairCipher = Ndis802_11WEPDisabled; - pBss->WPA2.PairCipherAux = Ndis802_11WEPDisabled; - pBss->WPA2.GroupCipher = Ndis802_11WEPDisabled; - pBss->WPA2.RsnCapability = 0; - pBss->WPA2.bMixMode = FALSE; - - - Length = (INT) pBss->VarIELen; - - while (Length > 0) - { - // Parse cipher suite base on WPA1 & WPA2, they should be parsed differently - pTmp = ((PUCHAR) pBss->VarIEs) + pBss->VarIELen - Length; - pEid = (PEID_STRUCT) pTmp; - switch (pEid->Eid) - { - case IE_WPA: - if (NdisEqualMemory(pEid->Octet, SES_OUI, 3) && (pEid->Len == 7)) - { - pBss->bSES = TRUE; - break; - } - else if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4) != 1) - { - // if unsupported vendor specific IE - break; - } - // Skip OUI, version, and multicast suite - // This part should be improved in the future when AP supported multiple cipher suite. - // For now, it's OK since almost all APs have fixed cipher suite supported. - // pTmp = (PUCHAR) pEid->Octet; - pTmp += 11; - - // Cipher Suite Selectors from Spec P802.11i/D3.2 P26. - // Value Meaning - // 0 None - // 1 WEP-40 - // 2 Tkip - // 3 WRAP - // 4 AES - // 5 WEP-104 - // Parse group cipher - switch (*pTmp) - { - case 1: - pBss->WPA.GroupCipher = Ndis802_11GroupWEP40Enabled; - break; - case 5: - pBss->WPA.GroupCipher = Ndis802_11GroupWEP104Enabled; - break; - case 2: - pBss->WPA.GroupCipher = Ndis802_11Encryption2Enabled; - break; - case 4: - pBss->WPA.GroupCipher = Ndis802_11Encryption3Enabled; - break; - default: - break; - } - // number of unicast suite - pTmp += 1; - - // skip all unicast cipher suites - //Count = *(PUSHORT) pTmp; - Count = (pTmp[1]<<8) + pTmp[0]; - pTmp += sizeof(USHORT); - - // Parsing all unicast cipher suite - while (Count > 0) - { - // Skip OUI - pTmp += 3; - TmpCipher = Ndis802_11WEPDisabled; - switch (*pTmp) - { - case 1: - case 5: // Although WEP is not allowed in WPA related auth mode, we parse it anyway - TmpCipher = Ndis802_11Encryption1Enabled; - break; - case 2: - TmpCipher = Ndis802_11Encryption2Enabled; - break; - case 4: - TmpCipher = Ndis802_11Encryption3Enabled; - break; - default: - break; - } - if (TmpCipher > pBss->WPA.PairCipher) - { - // Move the lower cipher suite to PairCipherAux - pBss->WPA.PairCipherAux = pBss->WPA.PairCipher; - pBss->WPA.PairCipher = TmpCipher; - } - else - { - pBss->WPA.PairCipherAux = TmpCipher; - } - pTmp++; - Count--; - } - - // 4. get AKM suite counts - //Count = *(PUSHORT) pTmp; - Count = (pTmp[1]<<8) + pTmp[0]; - pTmp += sizeof(USHORT); - pTmp += 3; - - switch (*pTmp) - { - case 1: - // Set AP support WPA-enterprise mode - if (pBss->AuthMode == Ndis802_11AuthModeOpen) - pBss->AuthMode = Ndis802_11AuthModeWPA; - else - pBss->AuthModeAux = Ndis802_11AuthModeWPA; - break; - case 2: - // Set AP support WPA-PSK mode - if (pBss->AuthMode == Ndis802_11AuthModeOpen) - pBss->AuthMode = Ndis802_11AuthModeWPAPSK; - else - pBss->AuthModeAux = Ndis802_11AuthModeWPAPSK; - break; - default: - break; - } - pTmp += 1; - - // Fixed for WPA-None - if (pBss->BssType == BSS_ADHOC) - { - pBss->AuthMode = Ndis802_11AuthModeWPANone; - pBss->AuthModeAux = Ndis802_11AuthModeWPANone; - pBss->WepStatus = pBss->WPA.GroupCipher; - // Patched bugs for old driver - if (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled) - pBss->WPA.PairCipherAux = pBss->WPA.GroupCipher; - } - else - pBss->WepStatus = pBss->WPA.PairCipher; - - // Check the Pair & Group, if different, turn on mixed mode flag - if (pBss->WPA.GroupCipher != pBss->WPA.PairCipher) - pBss->WPA.bMixMode = TRUE; - - break; - - case IE_RSN: - pRsnHeader = (PRSN_IE_HEADER_STRUCT) pTmp; - - // 0. Version must be 1 - if (le2cpu16(pRsnHeader->Version) != 1) - break; - pTmp += sizeof(RSN_IE_HEADER_STRUCT); - - // 1. Check group cipher - pCipher = (PCIPHER_SUITE_STRUCT) pTmp; - if (!RTMPEqualMemory(pTmp, RSN_OUI, 3)) - break; - - // Parse group cipher - switch (pCipher->Type) - { - case 1: - pBss->WPA2.GroupCipher = Ndis802_11GroupWEP40Enabled; - break; - case 5: - pBss->WPA2.GroupCipher = Ndis802_11GroupWEP104Enabled; - break; - case 2: - pBss->WPA2.GroupCipher = Ndis802_11Encryption2Enabled; - break; - case 4: - pBss->WPA2.GroupCipher = Ndis802_11Encryption3Enabled; - break; - default: - break; - } - // set to correct offset for next parsing - pTmp += sizeof(CIPHER_SUITE_STRUCT); - - // 2. Get pairwise cipher counts - //Count = *(PUSHORT) pTmp; - Count = (pTmp[1]<<8) + pTmp[0]; - pTmp += sizeof(USHORT); - - // 3. Get pairwise cipher - // Parsing all unicast cipher suite - while (Count > 0) - { - // Skip OUI - pCipher = (PCIPHER_SUITE_STRUCT) pTmp; - TmpCipher = Ndis802_11WEPDisabled; - switch (pCipher->Type) - { - case 1: - case 5: // Although WEP is not allowed in WPA related auth mode, we parse it anyway - TmpCipher = Ndis802_11Encryption1Enabled; - break; - case 2: - TmpCipher = Ndis802_11Encryption2Enabled; - break; - case 4: - TmpCipher = Ndis802_11Encryption3Enabled; - break; - default: - break; - } - if (TmpCipher > pBss->WPA2.PairCipher) - { - // Move the lower cipher suite to PairCipherAux - pBss->WPA2.PairCipherAux = pBss->WPA2.PairCipher; - pBss->WPA2.PairCipher = TmpCipher; - } - else - { - pBss->WPA2.PairCipherAux = TmpCipher; - } - pTmp += sizeof(CIPHER_SUITE_STRUCT); - Count--; - } - - // 4. get AKM suite counts - //Count = *(PUSHORT) pTmp; - Count = (pTmp[1]<<8) + pTmp[0]; - pTmp += sizeof(USHORT); - - // 5. Get AKM ciphers - // Parsing all AKM ciphers - while (Count > 0) - { - pAKM = (PAKM_SUITE_STRUCT) pTmp; - if (!RTMPEqualMemory(pTmp, RSN_OUI, 3)) - break; - - switch (pAKM->Type) - { - case 1: - // Set AP support WPA-enterprise mode - if (pBss->AuthMode == Ndis802_11AuthModeOpen) - pBss->AuthMode = Ndis802_11AuthModeWPA2; - else - pBss->AuthModeAux = Ndis802_11AuthModeWPA2; - break; - case 2: - // Set AP support WPA-PSK mode - if (pBss->AuthMode == Ndis802_11AuthModeOpen) - pBss->AuthMode = Ndis802_11AuthModeWPA2PSK; - else - pBss->AuthModeAux = Ndis802_11AuthModeWPA2PSK; - break; - default: - if (pBss->AuthMode == Ndis802_11AuthModeOpen) - pBss->AuthMode = Ndis802_11AuthModeMax; - else - pBss->AuthModeAux = Ndis802_11AuthModeMax; - break; - } - pTmp += (Count * sizeof(AKM_SUITE_STRUCT)); - Count--; - } - - // Fixed for WPA-None - if (pBss->BssType == BSS_ADHOC) - { - pBss->AuthMode = Ndis802_11AuthModeWPANone; - pBss->AuthModeAux = Ndis802_11AuthModeWPANone; - pBss->WPA.PairCipherAux = pBss->WPA2.PairCipherAux; - pBss->WPA.GroupCipher = pBss->WPA2.GroupCipher; - pBss->WepStatus = pBss->WPA.GroupCipher; - // Patched bugs for old driver - if (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled) - pBss->WPA.PairCipherAux = pBss->WPA.GroupCipher; - } - pBss->WepStatus = pBss->WPA2.PairCipher; - - // 6. Get RSN capability - //pBss->WPA2.RsnCapability = *(PUSHORT) pTmp; - pBss->WPA2.RsnCapability = (pTmp[1]<<8) + pTmp[0]; - pTmp += sizeof(USHORT); - - // Check the Pair & Group, if different, turn on mixed mode flag - if (pBss->WPA2.GroupCipher != pBss->WPA2.PairCipher) - pBss->WPA2.bMixMode = TRUE; - - break; - default: - break; - } - Length -= (pEid->Len + 2); - } -} - -// =========================================================================================== -// mac_table.c -// =========================================================================================== - -/*! \brief generates a random mac address value for IBSS BSSID - * \param Addr the bssid location - * \return none - * \pre - * \post - */ -VOID MacAddrRandomBssid( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pAddr) -{ - INT i; - - for (i = 0; i < MAC_ADDR_LEN; i++) - { - pAddr[i] = RandomByte(pAd); - } - - pAddr[0] = (pAddr[0] & 0xfe) | 0x02; // the first 2 bits must be 01xxxxxxxx -} - -/*! \brief init the management mac frame header - * \param p_hdr mac header - * \param subtype subtype of the frame - * \param p_ds destination address, don't care if it is a broadcast address - * \return none - * \pre the station has the following information in the pAd->StaCfg - * - bssid - * - station address - * \post - * \note this function initializes the following field - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - */ -VOID MgtMacHeaderInit( - IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, - IN UCHAR SubType, - IN UCHAR ToDs, - IN PUCHAR pDA, - IN PUCHAR pBssid) -{ - NdisZeroMemory(pHdr80211, sizeof(HEADER_802_11)); - - pHdr80211->FC.Type = BTYPE_MGMT; - pHdr80211->FC.SubType = SubType; -// if (SubType == SUBTYPE_ACK) // sample, no use, it will conflict with ACTION frame sub type -// pHdr80211->FC.Type = BTYPE_CNTL; - pHdr80211->FC.ToDs = ToDs; - COPY_MAC_ADDR(pHdr80211->Addr1, pDA); -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - COPY_MAC_ADDR(pHdr80211->Addr2, pAd->CurrentAddress); -#endif // CONFIG_STA_SUPPORT // - COPY_MAC_ADDR(pHdr80211->Addr3, pBssid); -} - -// =========================================================================================== -// mem_mgmt.c -// =========================================================================================== - -/*!*************************************************************************** - * This routine build an outgoing frame, and fill all information specified - * in argument list to the frame body. The actual frame size is the summation - * of all arguments. - * input params: - * Buffer - pointer to a pre-allocated memory segment - * args - a list of pairs. - * NOTE NOTE NOTE!!!! the last argument must be NULL, otherwise this - * function will FAIL!!! - * return: - * Size of the buffer - * usage: - * MakeOutgoingFrame(Buffer, output_length, 2, &fc, 2, &dur, 6, p_addr1, 6,p_addr2, END_OF_ARGS); - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - ****************************************************************************/ -ULONG MakeOutgoingFrame( - OUT UCHAR *Buffer, - OUT ULONG *FrameLen, ...) -{ - UCHAR *p; - int leng; - ULONG TotLeng; - va_list Args; - - // calculates the total length - TotLeng = 0; - va_start(Args, FrameLen); - do - { - leng = va_arg(Args, int); - if (leng == END_OF_ARGS) - { - break; - } - p = va_arg(Args, PVOID); - NdisMoveMemory(&Buffer[TotLeng], p, leng); - TotLeng = TotLeng + leng; - } while(TRUE); - - va_end(Args); /* clean up */ - *FrameLen = TotLeng; - return TotLeng; -} - -// =========================================================================================== -// mlme_queue.c -// =========================================================================================== - -/*! \brief Initialize The MLME Queue, used by MLME Functions - * \param *Queue The MLME Queue - * \return Always Return NDIS_STATE_SUCCESS in this implementation - * \pre - * \post - * \note Because this is done only once (at the init stage), no need to be locked - - IRQL = PASSIVE_LEVEL - - */ -NDIS_STATUS MlmeQueueInit( - IN MLME_QUEUE *Queue) -{ - INT i; - - NdisAllocateSpinLock(&Queue->Lock); - - Queue->Num = 0; - Queue->Head = 0; - Queue->Tail = 0; - - for (i = 0; i < MAX_LEN_OF_MLME_QUEUE; i++) - { - Queue->Entry[i].Occupied = FALSE; - Queue->Entry[i].MsgLen = 0; - NdisZeroMemory(Queue->Entry[i].Msg, MGMT_DMA_BUFFER_SIZE); - } - - return NDIS_STATUS_SUCCESS; -} - -/*! \brief Enqueue a message for other threads, if they want to send messages to MLME thread - * \param *Queue The MLME Queue - * \param Machine The State Machine Id - * \param MsgType The Message Type - * \param MsgLen The Message length - * \param *Msg The message pointer - * \return TRUE if enqueue is successful, FALSE if the queue is full - * \pre - * \post - * \note The message has to be initialized - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - */ -BOOLEAN MlmeEnqueue( - IN PRTMP_ADAPTER pAd, - IN ULONG Machine, - IN ULONG MsgType, - IN ULONG MsgLen, - IN VOID *Msg) -{ - INT Tail; - MLME_QUEUE *Queue = (MLME_QUEUE *)&pAd->Mlme.Queue; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return FALSE; - - // First check the size, it MUST not exceed the mlme queue size - if (MsgLen > MGMT_DMA_BUFFER_SIZE) - { - DBGPRINT_ERR(("MlmeEnqueue: msg too large, size = %ld \n", MsgLen)); - return FALSE; - } - - if (MlmeQueueFull(Queue)) - { - return FALSE; - } - - NdisAcquireSpinLock(&(Queue->Lock)); - Tail = Queue->Tail; - Queue->Tail++; - Queue->Num++; - if (Queue->Tail == MAX_LEN_OF_MLME_QUEUE) - { - Queue->Tail = 0; - } - - Queue->Entry[Tail].Wcid = RESERVED_WCID; - Queue->Entry[Tail].Occupied = TRUE; - Queue->Entry[Tail].Machine = Machine; - Queue->Entry[Tail].MsgType = MsgType; - Queue->Entry[Tail].MsgLen = MsgLen; - - if (Msg != NULL) - { - NdisMoveMemory(Queue->Entry[Tail].Msg, Msg, MsgLen); - } - - NdisReleaseSpinLock(&(Queue->Lock)); - return TRUE; -} - -/*! \brief This function is used when Recv gets a MLME message - * \param *Queue The MLME Queue - * \param TimeStampHigh The upper 32 bit of timestamp - * \param TimeStampLow The lower 32 bit of timestamp - * \param Rssi The receiving RSSI strength - * \param MsgLen The length of the message - * \param *Msg The message pointer - * \return TRUE if everything ok, FALSE otherwise (like Queue Full) - * \pre - * \post - - IRQL = DISPATCH_LEVEL - - */ -BOOLEAN MlmeEnqueueForRecv( - IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN ULONG TimeStampHigh, - IN ULONG TimeStampLow, - IN UCHAR Rssi0, - IN UCHAR Rssi1, - IN UCHAR Rssi2, - IN ULONG MsgLen, - IN VOID *Msg, - IN UCHAR Signal) -{ - INT Tail, Machine; - PFRAME_802_11 pFrame = (PFRAME_802_11)Msg; - INT MsgType; - MLME_QUEUE *Queue = (MLME_QUEUE *)&pAd->Mlme.Queue; - -#ifdef RALINK_ATE - /* Nothing to do in ATE mode */ - if(ATE_ON(pAd)) - return FALSE; -#endif // RALINK_ATE // - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - { - DBGPRINT_ERR(("MlmeEnqueueForRecv: fRTMP_ADAPTER_HALT_IN_PROGRESS\n")); - return FALSE; - } - - // First check the size, it MUST not exceed the mlme queue size - if (MsgLen > MGMT_DMA_BUFFER_SIZE) - { - DBGPRINT_ERR(("MlmeEnqueueForRecv: frame too large, size = %ld \n", MsgLen)); - return FALSE; - } - - if (MlmeQueueFull(Queue)) - { - return FALSE; - } - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (!MsgTypeSubst(pAd, pFrame, &Machine, &MsgType)) - { - DBGPRINT_ERR(("MlmeEnqueueForRecv: un-recongnized mgmt->subtype=%d\n",pFrame->Hdr.FC.SubType)); - return FALSE; - } - } -#endif // CONFIG_STA_SUPPORT // - - // OK, we got all the informations, it is time to put things into queue - NdisAcquireSpinLock(&(Queue->Lock)); - Tail = Queue->Tail; - Queue->Tail++; - Queue->Num++; - if (Queue->Tail == MAX_LEN_OF_MLME_QUEUE) - { - Queue->Tail = 0; - } - Queue->Entry[Tail].Occupied = TRUE; - Queue->Entry[Tail].Machine = Machine; - Queue->Entry[Tail].MsgType = MsgType; - Queue->Entry[Tail].MsgLen = MsgLen; - Queue->Entry[Tail].TimeStamp.u.LowPart = TimeStampLow; - Queue->Entry[Tail].TimeStamp.u.HighPart = TimeStampHigh; - Queue->Entry[Tail].Rssi0 = Rssi0; - Queue->Entry[Tail].Rssi1 = Rssi1; - Queue->Entry[Tail].Rssi2 = Rssi2; - Queue->Entry[Tail].Signal = Signal; - Queue->Entry[Tail].Wcid = (UCHAR)Wcid; - - Queue->Entry[Tail].Channel = pAd->LatchRfRegs.Channel; - - if (Msg != NULL) - { - NdisMoveMemory(Queue->Entry[Tail].Msg, Msg, MsgLen); - } - - NdisReleaseSpinLock(&(Queue->Lock)); - - RTMP_MLME_HANDLER(pAd); - - return TRUE; -} - - -/*! \brief Dequeue a message from the MLME Queue - * \param *Queue The MLME Queue - * \param *Elem The message dequeued from MLME Queue - * \return TRUE if the Elem contains something, FALSE otherwise - * \pre - * \post - - IRQL = DISPATCH_LEVEL - - */ -BOOLEAN MlmeDequeue( - IN MLME_QUEUE *Queue, - OUT MLME_QUEUE_ELEM **Elem) -{ - NdisAcquireSpinLock(&(Queue->Lock)); - *Elem = &(Queue->Entry[Queue->Head]); - Queue->Num--; - Queue->Head++; - if (Queue->Head == MAX_LEN_OF_MLME_QUEUE) - { - Queue->Head = 0; - } - NdisReleaseSpinLock(&(Queue->Lock)); - return TRUE; -} - -// IRQL = DISPATCH_LEVEL -VOID MlmeRestartStateMachine( - IN PRTMP_ADAPTER pAd) -{ -#ifdef RTMP_MAC_PCI - MLME_QUEUE_ELEM *Elem = NULL; -#endif // RTMP_MAC_PCI // -#ifdef CONFIG_STA_SUPPORT - BOOLEAN Cancelled; -#endif // CONFIG_STA_SUPPORT // - - DBGPRINT(RT_DEBUG_TRACE, ("MlmeRestartStateMachine \n")); - -#ifdef RTMP_MAC_PCI - NdisAcquireSpinLock(&pAd->Mlme.TaskLock); - if(pAd->Mlme.bRunning) - { - NdisReleaseSpinLock(&pAd->Mlme.TaskLock); - return; - } - else - { - pAd->Mlme.bRunning = TRUE; - } - NdisReleaseSpinLock(&pAd->Mlme.TaskLock); - - // Remove all Mlme queues elements - while (!MlmeQueueEmpty(&pAd->Mlme.Queue)) - { - //From message type, determine which state machine I should drive - if (MlmeDequeue(&pAd->Mlme.Queue, &Elem)) - { - // free MLME element - Elem->Occupied = FALSE; - Elem->MsgLen = 0; - - } - else { - DBGPRINT_ERR(("MlmeRestartStateMachine: MlmeQueue empty\n")); - } - } -#endif // RTMP_MAC_PCI // - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { -#ifdef QOS_DLS_SUPPORT - UCHAR i; -#endif // QOS_DLS_SUPPORT // - // Cancel all timer events - // Be careful to cancel new added timer - RTMPCancelTimer(&pAd->MlmeAux.AssocTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.ReassocTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.DisassocTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.AuthTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &Cancelled); - -#ifdef QOS_DLS_SUPPORT - for (i=0; iStaCfg.DLSEntry[i].Timer, &Cancelled); - } -#endif // QOS_DLS_SUPPORT // - } -#endif // CONFIG_STA_SUPPORT // - - // Change back to original channel in case of doing scan - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - - // Resume MSDU which is turned off durning scan - RTMPResumeMsduTransmission(pAd); - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // Set all state machines back IDLE - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - pAd->Mlme.AuthRspMachine.CurrState = AUTH_RSP_IDLE; - pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; - pAd->Mlme.ActMachine.CurrState = ACT_IDLE; -#ifdef QOS_DLS_SUPPORT - pAd->Mlme.DlsMachine.CurrState = DLS_IDLE; -#endif // QOS_DLS_SUPPORT // - } -#endif // CONFIG_STA_SUPPORT // - -#ifdef RTMP_MAC_PCI - // Remove running state - NdisAcquireSpinLock(&pAd->Mlme.TaskLock); - pAd->Mlme.bRunning = FALSE; - NdisReleaseSpinLock(&pAd->Mlme.TaskLock); -#endif // RTMP_MAC_PCI // -} - -/*! \brief test if the MLME Queue is empty - * \param *Queue The MLME Queue - * \return TRUE if the Queue is empty, FALSE otherwise - * \pre - * \post - - IRQL = DISPATCH_LEVEL - - */ -BOOLEAN MlmeQueueEmpty( - IN MLME_QUEUE *Queue) -{ - BOOLEAN Ans; - - NdisAcquireSpinLock(&(Queue->Lock)); - Ans = (Queue->Num == 0); - NdisReleaseSpinLock(&(Queue->Lock)); - - return Ans; -} - -/*! \brief test if the MLME Queue is full - * \param *Queue The MLME Queue - * \return TRUE if the Queue is empty, FALSE otherwise - * \pre - * \post - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - */ -BOOLEAN MlmeQueueFull( - IN MLME_QUEUE *Queue) -{ - BOOLEAN Ans; - - NdisAcquireSpinLock(&(Queue->Lock)); - Ans = (Queue->Num == MAX_LEN_OF_MLME_QUEUE || Queue->Entry[Queue->Tail].Occupied); - NdisReleaseSpinLock(&(Queue->Lock)); - - return Ans; -} - -/*! \brief The destructor of MLME Queue - * \param - * \return - * \pre - * \post - * \note Clear Mlme Queue, Set Queue->Num to Zero. - - IRQL = PASSIVE_LEVEL - - */ -VOID MlmeQueueDestroy( - IN MLME_QUEUE *pQueue) -{ - NdisAcquireSpinLock(&(pQueue->Lock)); - pQueue->Num = 0; - pQueue->Head = 0; - pQueue->Tail = 0; - NdisReleaseSpinLock(&(pQueue->Lock)); - NdisFreeSpinLock(&(pQueue->Lock)); -} - - -/*! \brief To substitute the message type if the message is coming from external - * \param pFrame The frame received - * \param *Machine The state machine - * \param *MsgType the message type for the state machine - * \return TRUE if the substitution is successful, FALSE otherwise - * \pre - * \post - - IRQL = DISPATCH_LEVEL - - */ -#ifdef CONFIG_STA_SUPPORT -BOOLEAN MsgTypeSubst( - IN PRTMP_ADAPTER pAd, - IN PFRAME_802_11 pFrame, - OUT INT *Machine, - OUT INT *MsgType) -{ - USHORT Seq, Alg; - UCHAR EAPType; - PUCHAR pData; - - // Pointer to start of data frames including SNAP header - pData = (PUCHAR) pFrame + LENGTH_802_11; - - // The only data type will pass to this function is EAPOL frame - if (pFrame->Hdr.FC.Type == BTYPE_DATA) - { - { - *Machine = WPA_STATE_MACHINE; - EAPType = *((UCHAR*)pFrame + LENGTH_802_11 + LENGTH_802_1_H + 1); - return (WpaMsgTypeSubst(EAPType, (INT *) MsgType)); - } - } - - switch (pFrame->Hdr.FC.SubType) - { - case SUBTYPE_ASSOC_REQ: - *Machine = ASSOC_STATE_MACHINE; - *MsgType = MT2_PEER_ASSOC_REQ; - break; - case SUBTYPE_ASSOC_RSP: - *Machine = ASSOC_STATE_MACHINE; - *MsgType = MT2_PEER_ASSOC_RSP; - break; - case SUBTYPE_REASSOC_REQ: - *Machine = ASSOC_STATE_MACHINE; - *MsgType = MT2_PEER_REASSOC_REQ; - break; - case SUBTYPE_REASSOC_RSP: - *Machine = ASSOC_STATE_MACHINE; - *MsgType = MT2_PEER_REASSOC_RSP; - break; - case SUBTYPE_PROBE_REQ: - *Machine = SYNC_STATE_MACHINE; - *MsgType = MT2_PEER_PROBE_REQ; - break; - case SUBTYPE_PROBE_RSP: - *Machine = SYNC_STATE_MACHINE; - *MsgType = MT2_PEER_PROBE_RSP; - break; - case SUBTYPE_BEACON: - *Machine = SYNC_STATE_MACHINE; - *MsgType = MT2_PEER_BEACON; - break; - case SUBTYPE_ATIM: - *Machine = SYNC_STATE_MACHINE; - *MsgType = MT2_PEER_ATIM; - break; - case SUBTYPE_DISASSOC: - *Machine = ASSOC_STATE_MACHINE; - *MsgType = MT2_PEER_DISASSOC_REQ; - break; - case SUBTYPE_AUTH: - // get the sequence number from payload 24 Mac Header + 2 bytes algorithm - NdisMoveMemory(&Seq, &pFrame->Octet[2], sizeof(USHORT)); - NdisMoveMemory(&Alg, &pFrame->Octet[0], sizeof(USHORT)); - if (Seq == 1 || Seq == 3) - { - *Machine = AUTH_RSP_STATE_MACHINE; - *MsgType = MT2_PEER_AUTH_ODD; - } - else if (Seq == 2 || Seq == 4) - { - if (Alg == AUTH_MODE_OPEN || Alg == AUTH_MODE_KEY) - { - *Machine = AUTH_STATE_MACHINE; - *MsgType = MT2_PEER_AUTH_EVEN; - } - } - else - { - return FALSE; - } - break; - case SUBTYPE_DEAUTH: - *Machine = AUTH_RSP_STATE_MACHINE; - *MsgType = MT2_PEER_DEAUTH; - break; - case SUBTYPE_ACTION: - *Machine = ACTION_STATE_MACHINE; - // Sometimes Sta will return with category bytes with MSB = 1, if they receive catogory out of their support - if ((pFrame->Octet[0]&0x7F) > MAX_PEER_CATE_MSG) - { - *MsgType = MT2_ACT_INVALID; - } - else - { - *MsgType = (pFrame->Octet[0]&0x7F); - } - break; - default: - return FALSE; - break; - } - - return TRUE; -} -#endif // CONFIG_STA_SUPPORT // - -// =========================================================================================== -// state_machine.c -// =========================================================================================== - -/*! \brief Initialize the state machine. - * \param *S pointer to the state machine - * \param Trans State machine transition function - * \param StNr number of states - * \param MsgNr number of messages - * \param DefFunc default function, when there is invalid state/message combination - * \param InitState initial state of the state machine - * \param Base StateMachine base, internal use only - * \pre p_sm should be a legal pointer - * \post - - IRQL = PASSIVE_LEVEL - - */ -VOID StateMachineInit( - IN STATE_MACHINE *S, - IN STATE_MACHINE_FUNC Trans[], - IN ULONG StNr, - IN ULONG MsgNr, - IN STATE_MACHINE_FUNC DefFunc, - IN ULONG InitState, - IN ULONG Base) -{ - ULONG i, j; - - // set number of states and messages - S->NrState = StNr; - S->NrMsg = MsgNr; - S->Base = Base; - - S->TransFunc = Trans; - - // init all state transition to default function - for (i = 0; i < StNr; i++) - { - for (j = 0; j < MsgNr; j++) - { - S->TransFunc[i * MsgNr + j] = DefFunc; - } - } - - // set the starting state - S->CurrState = InitState; -} - -/*! \brief This function fills in the function pointer into the cell in the state machine - * \param *S pointer to the state machine - * \param St state - * \param Msg incoming message - * \param f the function to be executed when (state, message) combination occurs at the state machine - * \pre *S should be a legal pointer to the state machine, st, msg, should be all within the range, Base should be set in the initial state - * \post - - IRQL = PASSIVE_LEVEL - - */ -VOID StateMachineSetAction( - IN STATE_MACHINE *S, - IN ULONG St, - IN ULONG Msg, - IN STATE_MACHINE_FUNC Func) -{ - ULONG MsgIdx; - - MsgIdx = Msg - S->Base; - - if (St < S->NrState && MsgIdx < S->NrMsg) - { - // boundary checking before setting the action - S->TransFunc[St * S->NrMsg + MsgIdx] = Func; - } -} - -/*! \brief This function does the state transition - * \param *Adapter the NIC adapter pointer - * \param *S the state machine - * \param *Elem the message to be executed - * \return None - - IRQL = DISPATCH_LEVEL - - */ -VOID StateMachinePerformAction( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - IN MLME_QUEUE_ELEM *Elem) -{ - (*(S->TransFunc[S->CurrState * S->NrMsg + Elem->MsgType - S->Base]))(pAd, Elem); -} - -/* - ========================================================================== - Description: - The drop function, when machine executes this, the message is simply - ignored. This function does nothing, the message is freed in - StateMachinePerformAction() - ========================================================================== - */ -VOID Drop( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ -} - -// =========================================================================================== -// lfsr.c -// =========================================================================================== - -/* - ========================================================================== - Description: - - IRQL = PASSIVE_LEVEL - - ========================================================================== - */ -VOID LfsrInit( - IN PRTMP_ADAPTER pAd, - IN ULONG Seed) -{ - if (Seed == 0) - pAd->Mlme.ShiftReg = 1; - else - pAd->Mlme.ShiftReg = Seed; -} - -/* - ========================================================================== - Description: - ========================================================================== - */ -UCHAR RandomByte( - IN PRTMP_ADAPTER pAd) -{ - ULONG i; - UCHAR R, Result; - - R = 0; - - if (pAd->Mlme.ShiftReg == 0) - NdisGetSystemUpTime((ULONG *)&pAd->Mlme.ShiftReg); - - for (i = 0; i < 8; i++) - { - if (pAd->Mlme.ShiftReg & 0x00000001) - { - pAd->Mlme.ShiftReg = ((pAd->Mlme.ShiftReg ^ LFSR_MASK) >> 1) | 0x80000000; - Result = 1; - } - else - { - pAd->Mlme.ShiftReg = pAd->Mlme.ShiftReg >> 1; - Result = 0; - } - R = (R << 1) | Result; - } - - return R; -} - - -/* - ======================================================================== - - Routine Description: - Verify the support rate for different PHY type - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - IRQL = PASSIVE_LEVEL - - ======================================================================== -*/ -VOID RTMPCheckRates( - IN PRTMP_ADAPTER pAd, - IN OUT UCHAR SupRate[], - IN OUT UCHAR *SupRateLen) -{ - UCHAR RateIdx, i, j; - UCHAR NewRate[12], NewRateLen; - - NewRateLen = 0; - - if (pAd->CommonCfg.PhyMode == PHY_11B) - RateIdx = 4; - else - RateIdx = 12; - - // Check for support rates exclude basic rate bit - for (i = 0; i < *SupRateLen; i++) - for (j = 0; j < RateIdx; j++) - if ((SupRate[i] & 0x7f) == RateIdTo500Kbps[j]) - NewRate[NewRateLen++] = SupRate[i]; - - *SupRateLen = NewRateLen; - NdisMoveMemory(SupRate, NewRate, NewRateLen); -} - -#ifdef CONFIG_STA_SUPPORT -#ifdef DOT11_N_SUPPORT -BOOLEAN RTMPCheckChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR CentralChannel, - IN UCHAR Channel) -{ - UCHAR k; - UCHAR UpperChannel = 0, LowerChannel = 0; - UCHAR NoEffectChannelinList = 0; - - // Find upper and lower channel according to 40MHz current operation. - if (CentralChannel < Channel) - { - UpperChannel = Channel; - if (CentralChannel > 2) - LowerChannel = CentralChannel - 2; - else - return FALSE; - } - else if (CentralChannel > Channel) - { - UpperChannel = CentralChannel + 2; - LowerChannel = Channel; - } - - for (k = 0;k < pAd->ChannelListNum;k++) - { - if (pAd->ChannelList[k].Channel == UpperChannel) - { - NoEffectChannelinList ++; - } - if (pAd->ChannelList[k].Channel == LowerChannel) - { - NoEffectChannelinList ++; - } - } - - DBGPRINT(RT_DEBUG_TRACE,("Total Channel in Channel List = [%d]\n", NoEffectChannelinList)); - if (NoEffectChannelinList == 2) - return TRUE; - else - return FALSE; -} - -/* - ======================================================================== - - Routine Description: - Verify the support rate for HT phy type - - Arguments: - pAd Pointer to our adapter - - Return Value: - FALSE if pAd->CommonCfg.SupportedHtPhy doesn't accept the pHtCapability. (AP Mode) - - IRQL = PASSIVE_LEVEL - - ======================================================================== -*/ -BOOLEAN RTMPCheckHt( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN HT_CAPABILITY_IE *pHtCapability, - IN ADD_HT_INFO_IE *pAddHtInfo) -{ - if (Wcid >= MAX_LEN_OF_MAC_TABLE) - return FALSE; - - // If use AMSDU, set flag. - if (pAd->CommonCfg.DesiredHtPhy.AmsduEnable) - CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], fCLIENT_STATUS_AMSDU_INUSED); - // Save Peer Capability - if (pHtCapability->HtCapInfo.ShortGIfor20) - CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], fCLIENT_STATUS_SGI20_CAPABLE); - if (pHtCapability->HtCapInfo.ShortGIfor40) - CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], fCLIENT_STATUS_SGI40_CAPABLE); - if (pHtCapability->HtCapInfo.TxSTBC) - CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], fCLIENT_STATUS_TxSTBC_CAPABLE); - if (pHtCapability->HtCapInfo.RxSTBC) - CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], fCLIENT_STATUS_RxSTBC_CAPABLE); - if (pAd->CommonCfg.bRdg && pHtCapability->ExtHtCapInfo.RDGSupport) - { - CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], fCLIENT_STATUS_RDG_CAPABLE); - } - - if (Wcid < MAX_LEN_OF_MAC_TABLE) - { - pAd->MacTab.Content[Wcid].MpduDensity = pHtCapability->HtCapParm.MpduDensity; - } - - // Will check ChannelWidth for MCSSet[4] below - pAd->MlmeAux.HtCapability.MCSSet[4] = 0x1; - switch (pAd->CommonCfg.RxStream) - { - case 1: - pAd->MlmeAux.HtCapability.MCSSet[0] = 0xff; - pAd->MlmeAux.HtCapability.MCSSet[1] = 0x00; - pAd->MlmeAux.HtCapability.MCSSet[2] = 0x00; - pAd->MlmeAux.HtCapability.MCSSet[3] = 0x00; - break; - case 2: - pAd->MlmeAux.HtCapability.MCSSet[0] = 0xff; - pAd->MlmeAux.HtCapability.MCSSet[1] = 0xff; - pAd->MlmeAux.HtCapability.MCSSet[2] = 0x00; - pAd->MlmeAux.HtCapability.MCSSet[3] = 0x00; - break; - case 3: - pAd->MlmeAux.HtCapability.MCSSet[0] = 0xff; - pAd->MlmeAux.HtCapability.MCSSet[1] = 0xff; - pAd->MlmeAux.HtCapability.MCSSet[2] = 0xff; - pAd->MlmeAux.HtCapability.MCSSet[3] = 0x00; - break; - } - - pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth = pAddHtInfo->AddHtInfo.RecomWidth & pAd->CommonCfg.DesiredHtPhy.ChannelWidth; - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPCheckHt:: HtCapInfo.ChannelWidth=%d, RecomWidth=%d, DesiredHtPhy.ChannelWidth=%d, BW40MAvailForA/G=%d/%d, PhyMode=%d \n", - pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth, pAddHtInfo->AddHtInfo.RecomWidth, pAd->CommonCfg.DesiredHtPhy.ChannelWidth, - pAd->NicConfig2.field.BW40MAvailForA, pAd->NicConfig2.field.BW40MAvailForG, pAd->CommonCfg.PhyMode)); - - pAd->MlmeAux.HtCapability.HtCapInfo.GF = pHtCapability->HtCapInfo.GF &pAd->CommonCfg.DesiredHtPhy.GF; - - // Send Assoc Req with my HT capability. - pAd->MlmeAux.HtCapability.HtCapInfo.AMsduSize = pAd->CommonCfg.DesiredHtPhy.AmsduSize; - pAd->MlmeAux.HtCapability.HtCapInfo.MimoPs = pAd->CommonCfg.DesiredHtPhy.MimoPs; - pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor20 = (pAd->CommonCfg.DesiredHtPhy.ShortGIfor20) & (pHtCapability->HtCapInfo.ShortGIfor20); - pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor40 = (pAd->CommonCfg.DesiredHtPhy.ShortGIfor40) & (pHtCapability->HtCapInfo.ShortGIfor40); - pAd->MlmeAux.HtCapability.HtCapInfo.TxSTBC = (pAd->CommonCfg.DesiredHtPhy.TxSTBC)&(pHtCapability->HtCapInfo.RxSTBC); - pAd->MlmeAux.HtCapability.HtCapInfo.RxSTBC = (pAd->CommonCfg.DesiredHtPhy.RxSTBC)&(pHtCapability->HtCapInfo.TxSTBC); - pAd->MlmeAux.HtCapability.HtCapParm.MaxRAmpduFactor = pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor; - pAd->MlmeAux.HtCapability.HtCapParm.MpduDensity = pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity; - pAd->MlmeAux.HtCapability.ExtHtCapInfo.PlusHTC = pHtCapability->ExtHtCapInfo.PlusHTC; - pAd->MacTab.Content[Wcid].HTCapability.ExtHtCapInfo.PlusHTC = pHtCapability->ExtHtCapInfo.PlusHTC; - if (pAd->CommonCfg.bRdg) - { - pAd->MlmeAux.HtCapability.ExtHtCapInfo.RDGSupport = pHtCapability->ExtHtCapInfo.RDGSupport; - pAd->MlmeAux.HtCapability.ExtHtCapInfo.PlusHTC = 1; - } - - if (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_20) - pAd->MlmeAux.HtCapability.MCSSet[4] = 0x0; // BW20 can't transmit MCS32 - - COPY_AP_HTSETTINGS_FROM_BEACON(pAd, pHtCapability); - return TRUE; -} -#endif // DOT11_N_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - -/* - ======================================================================== - - Routine Description: - Verify the support rate for different PHY type - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - IRQL = PASSIVE_LEVEL - - ======================================================================== -*/ -VOID RTMPUpdateMlmeRate( - IN PRTMP_ADAPTER pAd) -{ - UCHAR MinimumRate; - UCHAR ProperMlmeRate; //= RATE_54; - UCHAR i, j, RateIdx = 12; //1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 - BOOLEAN bMatch = FALSE; - - switch (pAd->CommonCfg.PhyMode) - { - case PHY_11B: - ProperMlmeRate = RATE_11; - MinimumRate = RATE_1; - break; - case PHY_11BG_MIXED: -#ifdef DOT11_N_SUPPORT - case PHY_11ABGN_MIXED: - case PHY_11BGN_MIXED: -#endif // DOT11_N_SUPPORT // - if ((pAd->MlmeAux.SupRateLen == 4) && - (pAd->MlmeAux.ExtRateLen == 0)) - // B only AP - ProperMlmeRate = RATE_11; - else - ProperMlmeRate = RATE_24; - - if (pAd->MlmeAux.Channel <= 14) - MinimumRate = RATE_1; - else - MinimumRate = RATE_6; - break; - case PHY_11A: -#ifdef DOT11_N_SUPPORT - case PHY_11N_2_4G: // rt2860 need to check mlmerate for 802.11n - case PHY_11GN_MIXED: - case PHY_11AGN_MIXED: - case PHY_11AN_MIXED: - case PHY_11N_5G: -#endif // DOT11_N_SUPPORT // - ProperMlmeRate = RATE_24; - MinimumRate = RATE_6; - break; - case PHY_11ABG_MIXED: - ProperMlmeRate = RATE_24; - if (pAd->MlmeAux.Channel <= 14) - MinimumRate = RATE_1; - else - MinimumRate = RATE_6; - break; - default: // error - ProperMlmeRate = RATE_1; - MinimumRate = RATE_1; - break; - } - - for (i = 0; i < pAd->MlmeAux.SupRateLen; i++) - { - for (j = 0; j < RateIdx; j++) - { - if ((pAd->MlmeAux.SupRate[i] & 0x7f) == RateIdTo500Kbps[j]) - { - if (j == ProperMlmeRate) - { - bMatch = TRUE; - break; - } - } - } - - if (bMatch) - break; - } - - if (bMatch == FALSE) - { - for (i = 0; i < pAd->MlmeAux.ExtRateLen; i++) - { - for (j = 0; j < RateIdx; j++) - { - if ((pAd->MlmeAux.ExtRate[i] & 0x7f) == RateIdTo500Kbps[j]) - { - if (j == ProperMlmeRate) - { - bMatch = TRUE; - break; - } - } - } - - if (bMatch) - break; - } - } - - if (bMatch == FALSE) - { - ProperMlmeRate = MinimumRate; - } - - pAd->CommonCfg.MlmeRate = MinimumRate; - pAd->CommonCfg.RtsRate = ProperMlmeRate; - if (pAd->CommonCfg.MlmeRate >= RATE_6) - { - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; - pAd->CommonCfg.MlmeTransmit.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; - pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MODE = MODE_OFDM; - pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; - } - else - { - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_CCK; - pAd->CommonCfg.MlmeTransmit.field.MCS = pAd->CommonCfg.MlmeRate; - pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MODE = MODE_CCK; - pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MCS = pAd->CommonCfg.MlmeRate; - } - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPUpdateMlmeRate ==> MlmeTransmit = 0x%x \n" , pAd->CommonCfg.MlmeTransmit.word)); -} - -CHAR RTMPMaxRssi( - IN PRTMP_ADAPTER pAd, - IN CHAR Rssi0, - IN CHAR Rssi1, - IN CHAR Rssi2) -{ - CHAR larger = -127; - - if ((pAd->Antenna.field.RxPath == 1) && (Rssi0 != 0)) - { - larger = Rssi0; - } - - if ((pAd->Antenna.field.RxPath >= 2) && (Rssi1 != 0)) - { - larger = max(Rssi0, Rssi1); - } - - if ((pAd->Antenna.field.RxPath == 3) && (Rssi2 != 0)) - { - larger = max(larger, Rssi2); - } - - if (larger == -127) - larger = 0; - - return larger; -} - - -/* - ======================================================================== - Routine Description: - Periodic evaluate antenna link status - - Arguments: - pAd - Adapter pointer - - Return Value: - None - - ======================================================================== -*/ -VOID AsicEvaluateRxAnt( - IN PRTMP_ADAPTER pAd) -{ -#ifdef CONFIG_STA_SUPPORT - UCHAR BBPR3 = 0; -#endif // CONFIG_STA_SUPPORT // - -#ifdef RALINK_ATE - if (ATE_ON(pAd)) - return; -#endif // RALINK_ATE // - - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_RADIO_OFF | - fRTMP_ADAPTER_NIC_NOT_EXIST | - fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS) || - OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) -#ifdef RT3090 - || (pAd->bPCIclkOff == TRUE) -#endif // RT3090 // -#ifdef ANT_DIVERSITY_SUPPORT - || (pAd->EepromAccess) -#endif // ANT_DIVERSITY_SUPPORT // - ) - return; - -#ifdef ANT_DIVERSITY_SUPPORT - if ((pAd->NicConfig2.field.AntDiversity) && (pAd->CommonCfg.bRxAntDiversity == ANT_DIVERSITY_ENABLE)) - { - // two antenna selection mechanism- one is antenna diversity, the other is failed antenna remove - // one is antenna diversity:there is only one antenna can rx and tx - // the other is failed antenna remove:two physical antenna can rx and tx - DBGPRINT(RT_DEBUG_TRACE,("AntDiv - before evaluate Pair1-Ant (%d,%d)\n", - pAd->RxAnt.Pair1PrimaryRxAnt, pAd->RxAnt.Pair1SecondaryRxAnt)); - - AsicSetRxAnt(pAd, pAd->RxAnt.Pair1SecondaryRxAnt); - - pAd->RxAnt.EvaluatePeriod = 1; // 1:Means switch to SecondaryRxAnt, 0:Means switch to Pair1PrimaryRxAnt - pAd->RxAnt.FirstPktArrivedWhenEvaluate = FALSE; - pAd->RxAnt.RcvPktNumWhenEvaluate = 0; - - // a one-shot timer to end the evalution - // dynamic adjust antenna evaluation period according to the traffic - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - RTMPSetTimer(&pAd->Mlme.RxAntEvalTimer, 100); - else - RTMPSetTimer(&pAd->Mlme.RxAntEvalTimer, 300); - } - else -#endif // ANT_DIVERSITY_SUPPORT // - { -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - - if (pAd->StaCfg.Psm == PWR_SAVE) - return; - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBPR3); - BBPR3 &= (~0x18); - if(pAd->Antenna.field.RxPath == 3) - { - BBPR3 |= (0x10); - } - else if(pAd->Antenna.field.RxPath == 2) - { - BBPR3 |= (0x8); - } - else if(pAd->Antenna.field.RxPath == 1) - { - BBPR3 |= (0x0); - } - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBPR3); -#ifdef RTMP_MAC_PCI - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - pAd->StaCfg.BBPR3 = BBPR3; -#endif // RTMP_MAC_PCI // - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) - ) - { - ULONG TxTotalCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount + - pAd->RalinkCounters.OneSecTxRetryOkCount + - pAd->RalinkCounters.OneSecTxFailCount; - - // dynamic adjust antenna evaluation period according to the traffic - if (TxTotalCnt > 50) - { - RTMPSetTimer(&pAd->Mlme.RxAntEvalTimer, 20); - pAd->Mlme.bLowThroughput = FALSE; - } - else - { - RTMPSetTimer(&pAd->Mlme.RxAntEvalTimer, 300); - pAd->Mlme.bLowThroughput = TRUE; - } - } - } -#endif // CONFIG_STA_SUPPORT // - } -} - -/* - ======================================================================== - Routine Description: - After evaluation, check antenna link status - - Arguments: - pAd - Adapter pointer - - Return Value: - None - - ======================================================================== -*/ -VOID AsicRxAntEvalTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; - BOOLEAN bSwapAnt = FALSE; -#ifdef CONFIG_STA_SUPPORT - UCHAR BBPR3 = 0; - CHAR larger = -127, rssi0, rssi1, rssi2; -#endif // CONFIG_STA_SUPPORT // - -#ifdef RALINK_ATE - if (ATE_ON(pAd)) - return; -#endif // RALINK_ATE // - - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_RADIO_OFF | - fRTMP_ADAPTER_NIC_NOT_EXIST) || - OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) -#ifdef RT3090 - || (pAd->bPCIclkOff == TRUE) -#endif // RT3090 // -#ifdef ANT_DIVERSITY_SUPPORT - || (pAd->EepromAccess) -#endif // ANT_DIVERSITY_SUPPORT // - ) - return; - -#ifdef ANT_DIVERSITY_SUPPORT - if ((pAd->NicConfig2.field.AntDiversity) && (pAd->CommonCfg.bRxAntDiversity == ANT_DIVERSITY_ENABLE)) - { -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - if ((pAd->RxAnt.RcvPktNumWhenEvaluate != 0) && (pAd->RxAnt.Pair1AvgRssi[pAd->RxAnt.Pair1SecondaryRxAnt] >= pAd->RxAnt.Pair1AvgRssi[pAd->RxAnt.Pair1PrimaryRxAnt])) - bSwapAnt = TRUE; -#endif // CONFIG_STA_SUPPORT // - if (bSwapAnt == TRUE) - { - UCHAR temp; - - // - // select PrimaryRxAntPair - // Role change, Used Pair1SecondaryRxAnt as PrimaryRxAntPair. - // Since Pair1SecondaryRxAnt Quality good than Pair1PrimaryRxAnt - // - temp = pAd->RxAnt.Pair1PrimaryRxAnt; - pAd->RxAnt.Pair1PrimaryRxAnt = pAd->RxAnt.Pair1SecondaryRxAnt; - pAd->RxAnt.Pair1SecondaryRxAnt = temp; - -#ifdef CONFIG_STA_SUPPORT - pAd->RxAnt.Pair1LastAvgRssi = (pAd->RxAnt.Pair1AvgRssi[pAd->RxAnt.Pair1SecondaryRxAnt] >> 3); -#endif // CONFIG_STA_SUPPORT // -// pAd->RxAnt.EvaluateStableCnt = 0; - } - else - { - // if the evaluated antenna is not better than original, switch back to original antenna - AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); - pAd->RxAnt.EvaluateStableCnt ++; - } - - pAd->RxAnt.EvaluatePeriod = 0; // 1:Means switch to SecondaryRxAnt, 0:Means switch to Pair1PrimaryRxAnt - -#ifdef CONFIG_STA_SUPPORT - DBGPRINT(RT_DEBUG_TRACE,("AsicRxAntEvalAction::After Eval(fix in #%d), <%d, %d>, RcvPktNumWhenEvaluate=%ld\n", - pAd->RxAnt.Pair1PrimaryRxAnt, (pAd->RxAnt.Pair1AvgRssi[0] >> 3), (pAd->RxAnt.Pair1AvgRssi[1] >> 3), pAd->RxAnt.RcvPktNumWhenEvaluate)); -#endif // CONFIG_STA_SUPPORT // - } - else -#endif // ANT_DIVERSITY_SUPPORT // - { -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (pAd->StaCfg.Psm == PWR_SAVE) - return; - - - // if the traffic is low, use average rssi as the criteria - if (pAd->Mlme.bLowThroughput == TRUE) - { - rssi0 = pAd->StaCfg.RssiSample.LastRssi0; - rssi1 = pAd->StaCfg.RssiSample.LastRssi1; - rssi2 = pAd->StaCfg.RssiSample.LastRssi2; - } - else - { - rssi0 = pAd->StaCfg.RssiSample.AvgRssi0; - rssi1 = pAd->StaCfg.RssiSample.AvgRssi1; - rssi2 = pAd->StaCfg.RssiSample.AvgRssi2; - } - - if(pAd->Antenna.field.RxPath == 3) - { - larger = max(rssi0, rssi1); - - if (larger > (rssi2 + 20)) - pAd->Mlme.RealRxPath = 2; - else - pAd->Mlme.RealRxPath = 3; - } - else if(pAd->Antenna.field.RxPath == 2) - { - if (rssi0 > (rssi1 + 20)) - pAd->Mlme.RealRxPath = 1; - else - pAd->Mlme.RealRxPath = 2; - } - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBPR3); - BBPR3 &= (~0x18); - if(pAd->Mlme.RealRxPath == 3) - { - BBPR3 |= (0x10); - } - else if(pAd->Mlme.RealRxPath == 2) - { - BBPR3 |= (0x8); - } - else if(pAd->Mlme.RealRxPath == 1) - { - BBPR3 |= (0x0); - } - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBPR3); -#ifdef RTMP_MAC_PCI - pAd->StaCfg.BBPR3 = BBPR3; -#endif // RTMP_MAC_PCI // - } -#endif // CONFIG_STA_SUPPORT // - } -} - - -VOID APSDPeriodicExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; - - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - return; - - pAd->CommonCfg.TriggerTimerCount++; - -// Driver should not send trigger frame, it should be send by application layer -/* - if (pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable - && (pAd->CommonCfg.bNeedSendTriggerFrame || - (((pAd->CommonCfg.TriggerTimerCount%20) == 19) && (!pAd->CommonCfg.bAPSDAC_BE || !pAd->CommonCfg.bAPSDAC_BK || !pAd->CommonCfg.bAPSDAC_VI || !pAd->CommonCfg.bAPSDAC_VO)))) - { - DBGPRINT(RT_DEBUG_TRACE,("Sending trigger frame and enter service period when support APSD\n")); - RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, TRUE); - pAd->CommonCfg.bNeedSendTriggerFrame = FALSE; - pAd->CommonCfg.TriggerTimerCount = 0; - pAd->CommonCfg.bInServicePeriod = TRUE; - }*/ -} - -/* - ======================================================================== - Routine Description: - Set/reset MAC registers according to bPiggyBack parameter - - Arguments: - pAd - Adapter pointer - bPiggyBack - Enable / Disable Piggy-Back - - Return Value: - None - - ======================================================================== -*/ -VOID RTMPSetPiggyBack( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bPiggyBack) -{ - TX_LINK_CFG_STRUC TxLinkCfg; - - RTMP_IO_READ32(pAd, TX_LINK_CFG, &TxLinkCfg.word); - - TxLinkCfg.field.TxCFAckEn = bPiggyBack; - RTMP_IO_WRITE32(pAd, TX_LINK_CFG, TxLinkCfg.word); -} - -/* - ======================================================================== - Routine Description: - check if this entry need to switch rate automatically - - Arguments: - pAd - pEntry - - Return Value: - TURE - FALSE - - ======================================================================== -*/ -BOOLEAN RTMPCheckEntryEnableAutoRateSwitch( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry) -{ - BOOLEAN result = TRUE; - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // only associated STA counts - if (pEntry && (pEntry->ValidAsCLI) && (pEntry->Sst == SST_ASSOC)) - { - result = pAd->StaCfg.bAutoTxRateSwitch; - } - else - result = FALSE; - -#ifdef QOS_DLS_SUPPORT - if (pEntry && (pEntry->ValidAsDls)) - result = pAd->StaCfg.bAutoTxRateSwitch; -#endif // QOS_DLS_SUPPORT // - } -#endif // CONFIG_STA_SUPPORT // - - - - return result; -} - - -BOOLEAN RTMPAutoRateSwitchCheck( - IN PRTMP_ADAPTER pAd) -{ - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (pAd->StaCfg.bAutoTxRateSwitch) - return TRUE; - } -#endif // CONFIG_STA_SUPPORT // - return FALSE; -} - - -/* - ======================================================================== - Routine Description: - check if this entry need to fix tx legacy rate - - Arguments: - pAd - pEntry - - Return Value: - TURE - FALSE - - ======================================================================== -*/ -UCHAR RTMPStaFixedTxMode( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry) -{ - UCHAR tx_mode = FIXED_TXMODE_HT; - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - tx_mode = (UCHAR)pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode; - } -#endif // CONFIG_STA_SUPPORT // - - return tx_mode; -} - -/* - ======================================================================== - Routine Description: - Overwrite HT Tx Mode by Fixed Legency Tx Mode, if specified. - - Arguments: - pAd - pEntry - - Return Value: - TURE - FALSE - - ======================================================================== -*/ -VOID RTMPUpdateLegacyTxSetting( - UCHAR fixed_tx_mode, - PMAC_TABLE_ENTRY pEntry) -{ - HTTRANSMIT_SETTING TransmitSetting; - - if (fixed_tx_mode == FIXED_TXMODE_HT) - return; - - TransmitSetting.word = 0; - - TransmitSetting.field.MODE = pEntry->HTPhyMode.field.MODE; - TransmitSetting.field.MCS = pEntry->HTPhyMode.field.MCS; - - if (fixed_tx_mode == FIXED_TXMODE_CCK) - { - TransmitSetting.field.MODE = MODE_CCK; - // CCK mode allow MCS 0~3 - if (TransmitSetting.field.MCS > MCS_3) - TransmitSetting.field.MCS = MCS_3; - } - else - { - TransmitSetting.field.MODE = MODE_OFDM; - // OFDM mode allow MCS 0~7 - if (TransmitSetting.field.MCS > MCS_7) - TransmitSetting.field.MCS = MCS_7; - } - - if (pEntry->HTPhyMode.field.MODE >= TransmitSetting.field.MODE) - { - pEntry->HTPhyMode.word = TransmitSetting.word; - DBGPRINT(RT_DEBUG_TRACE, ("RTMPUpdateLegacyTxSetting : wcid-%d, MODE=%s, MCS=%d \n", - pEntry->Aid, GetPhyMode(pEntry->HTPhyMode.field.MODE), pEntry->HTPhyMode.field.MCS)); - } -} - -#ifdef CONFIG_STA_SUPPORT -/* - ========================================================================== - Description: - dynamic tune BBP R66 to find a balance between sensibility and - noise isolation - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AsicStaBbpTuning( - IN PRTMP_ADAPTER pAd) -{ - UCHAR OrigR66Value = 0, R66;//, R66UpperBound = 0x30, R66LowerBound = 0x30; - CHAR Rssi; - - // 2860C did not support Fase CCA, therefore can't tune - if (pAd->MACVersion == 0x28600100) - return; - - // - // work as a STA - // - if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) // no R66 tuning when SCANNING - return; - - if ((pAd->OpMode == OPMODE_STA) - && (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) - ) - && !(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) -#ifdef RTMP_MAC_PCI - && (pAd->bPCIclkOff == FALSE) -#endif // RTMP_MAC_PCI // - ) - { - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R66, &OrigR66Value); - R66 = OrigR66Value; - - if (pAd->Antenna.field.RxPath > 1) - Rssi = (pAd->StaCfg.RssiSample.AvgRssi0 + pAd->StaCfg.RssiSample.AvgRssi1) >> 1; - else - Rssi = pAd->StaCfg.RssiSample.AvgRssi0; - - if (pAd->LatchRfRegs.Channel <= 14) - { //BG band -#ifdef RT30xx - // RT3070 is a no LNA solution, it should have different control regarding to AGC gain control - // Otherwise, it will have some throughput side effect when low RSSI - - if (IS_RT3070(pAd)||IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) - { - if (Rssi > RSSI_FOR_MID_LOW_SENSIBILITY) - { - R66 = 0x1C + 2*GET_LNA_GAIN(pAd) + 0x20; - if (OrigR66Value != R66) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); - } - } - else - { - R66 = 0x1C + 2*GET_LNA_GAIN(pAd); - if (OrigR66Value != R66) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); - } - } - } - else -#endif // RT30xx // - { - if (Rssi > RSSI_FOR_MID_LOW_SENSIBILITY) - { - R66 = (0x2E + GET_LNA_GAIN(pAd)) + 0x10; - if (OrigR66Value != R66) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); - } - } - else - { - R66 = 0x2E + GET_LNA_GAIN(pAd); - if (OrigR66Value != R66) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); - } - } - } - } - else - { //A band - if (pAd->CommonCfg.BBPCurrentBW == BW_20) - { - if (Rssi > RSSI_FOR_MID_LOW_SENSIBILITY) - { - R66 = 0x32 + (GET_LNA_GAIN(pAd)*5)/3 + 0x10; - if (OrigR66Value != R66) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); - } - } - else - { - R66 = 0x32 + (GET_LNA_GAIN(pAd)*5)/3; - if (OrigR66Value != R66) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); - } - } - } - else - { - if (Rssi > RSSI_FOR_MID_LOW_SENSIBILITY) - { - R66 = 0x3A + (GET_LNA_GAIN(pAd)*5)/3 + 0x10; - if (OrigR66Value != R66) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); - } - } - else - { - R66 = 0x3A + (GET_LNA_GAIN(pAd)*5)/3; - if (OrigR66Value != R66) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); - } - } - } - } - - - } -} -#endif // CONFIG_STA_SUPPORT // - -VOID RTMPSetAGCInitValue( - IN PRTMP_ADAPTER pAd, - IN UCHAR BandWidth) -{ - UCHAR R66 = 0x30; - - if (pAd->LatchRfRegs.Channel <= 14) - { // BG band -#ifdef RT30xx - /* Gary was verified Amazon AP and find that RT307x has BBP_R66 invalid default value */ - - if (IS_RT3070(pAd)||IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) - { - R66 = 0x1C + 2*GET_LNA_GAIN(pAd); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); - } - else -#endif // RT30xx // - { - R66 = 0x2E + GET_LNA_GAIN(pAd); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); - } - } - else - { //A band - { - if (BandWidth == BW_20) - { - R66 = (UCHAR)(0x32 + (GET_LNA_GAIN(pAd)*5)/3); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); - } -#ifdef DOT11_N_SUPPORT - else - { - R66 = (UCHAR)(0x3A + (GET_LNA_GAIN(pAd)*5)/3); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); - } -#endif // DOT11_N_SUPPORT // - } - } - -} diff --git a/drivers/staging/rt3090/common/mlme_ex.c b/drivers/staging/rt3090/common/mlme_ex.c deleted file mode 100644 index d7fb7f58daee..000000000000 --- a/drivers/staging/rt3090/common/mlme_ex.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - mlme_ex.c - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Fonchi 2007-06-25 Extend original mlme APIs to support multi-entries -*/ - -#include "../rt_config.h" -#include "../mlme_ex_def.h" -//#include - - -// =========================================================================================== -// state_machine -// =========================================================================================== - -/*! \brief Initialize the state machine. - * \param *S pointer to the state machine - * \param Trans State machine transition function - * \param StNr number of states - * \param MsgNr number of messages - * \param DefFunc default function, when there is invalid state/message combination - * \param InitState initial state of the state machine - * \param Base StateMachine base, internal use only - * \pre p_sm should be a legal pointer - * \post - */ -VOID StateMachineInitEx( - IN STATE_MACHINE_EX *S, - IN STATE_MACHINE_FUNC_EX Trans[], - IN ULONG StNr, - IN ULONG MsgNr, - IN STATE_MACHINE_FUNC_EX DefFunc, - IN ULONG InitState, - IN ULONG Base) -{ - ULONG i, j; - - // set number of states and messages - S->NrState = StNr; - S->NrMsg = MsgNr; - S->Base = Base; - - S->TransFunc = Trans; - - // init all state transition to default function - for (i = 0; i < StNr; i++) - { - for (j = 0; j < MsgNr; j++) - { - S->TransFunc[i * MsgNr + j] = DefFunc; - } - } - - // set the starting state - S->CurrState = InitState; - - return; -} - -/*! \brief This function fills in the function pointer into the cell in the state machine - * \param *S pointer to the state machine - * \param St state - * \param Msg incoming message - * \param f the function to be executed when (state, message) combination occurs at the state machine - * \pre *S should be a legal pointer to the state machine, st, msg, should be all within the range, Base should be set in the initial state - * \post - */ -VOID StateMachineSetActionEx( - IN STATE_MACHINE_EX *S, - IN ULONG St, - IN ULONG Msg, - IN STATE_MACHINE_FUNC_EX Func) -{ - ULONG MsgIdx; - - MsgIdx = Msg - S->Base; - - if (St < S->NrState && MsgIdx < S->NrMsg) - { - // boundary checking before setting the action - S->TransFunc[St * S->NrMsg + MsgIdx] = Func; - } - - return; -} - -/*! \brief This function does the state transition - * \param *Adapter the NIC adapter pointer - * \param *S the state machine - * \param *Elem the message to be executed - * \return None - */ -VOID StateMachinePerformActionEx( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE_EX *S, - IN MLME_QUEUE_ELEM *Elem, - USHORT Idx, - PULONG pCurrState) -{ - if (S->TransFunc[(*pCurrState) * S->NrMsg + Elem->MsgType - S->Base]) - (*(S->TransFunc[(*pCurrState) * S->NrMsg + Elem->MsgType - S->Base]))(pAd, Elem, pCurrState, Idx); - - return; -} - -/*! \brief Enqueue a message for other threads, if they want to send messages to MLME thread - * \param *Queue The MLME Queue - * \param Machine The State Machine Id - * \param MsgType The Message Type - * \param MsgLen The Message length - * \param *Msg The message pointer - * \return TRUE if enqueue is successful, FALSE if the queue is full - * \pre - * \post - * \note The message has to be initialized - */ -BOOLEAN MlmeEnqueueEx( - IN PRTMP_ADAPTER pAd, - IN ULONG Machine, - IN ULONG MsgType, - IN ULONG MsgLen, - IN VOID *Msg, - IN USHORT Idx) -{ - INT Tail; - MLME_QUEUE *Queue = (MLME_QUEUE *)&pAd->Mlme.Queue; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) - return FALSE; - - - // First check the size, it MUST not exceed the mlme queue size - if (MsgLen > MAX_LEN_OF_MLME_BUFFER) - { - DBGPRINT_ERR(("MlmeEnqueueEx: msg too large, size = %ld \n", MsgLen)); - return FALSE; - } - - if (MlmeQueueFull(Queue)) - { - - return FALSE; - } - - RTMP_SEM_LOCK(&Queue->Lock); - Tail = Queue->Tail; - Queue->Tail++; - Queue->Num++; - if (Queue->Tail == MAX_LEN_OF_MLME_QUEUE) - { - Queue->Tail = 0; - } - Queue->Entry[Tail].Occupied = TRUE; - Queue->Entry[Tail].Machine = Machine; - Queue->Entry[Tail].MsgType = MsgType; - Queue->Entry[Tail].MsgLen = MsgLen; - Queue->Entry[Tail].Idx = Idx; - if (Msg != NULL) - NdisMoveMemory(Queue->Entry[Tail].Msg, Msg, MsgLen); - - RTMP_SEM_UNLOCK(&Queue->Lock); - - return TRUE; -} - -/* - ========================================================================== - Description: - The drop function, when machine executes this, the message is simply - ignored. This function does nothing, the message is freed in - StateMachinePerformAction() - ========================================================================== - */ -VOID DropEx( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem, - PULONG pCurrState, - USHORT Idx) -{ - return; -} diff --git a/drivers/staging/rt3090/common/netif_block.c b/drivers/staging/rt3090/common/netif_block.c deleted file mode 100644 index 2172957f4e41..000000000000 --- a/drivers/staging/rt3090/common/netif_block.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - */ -#ifdef BLOCK_NET_IF - -#include "../rt_config.h" -#include "../netif_block.h" - - -static NETIF_ENTRY freeNetIfEntryPool[FREE_NETIF_POOL_SIZE]; -static LIST_HEADER freeNetIfEntryList; - -void initblockQueueTab( - IN PRTMP_ADAPTER pAd) -{ - int i; - - initList(&freeNetIfEntryList); - for (i = 0; i < FREE_NETIF_POOL_SIZE; i++) - insertTailList(&freeNetIfEntryList, (PLIST_ENTRY)&freeNetIfEntryPool[i]); - - for (i=0; i < NUM_OF_TX_RING; i++) - initList(&pAd->blockQueueTab[i].NetIfList); - - return; -} - -BOOLEAN blockNetIf( - IN PBLOCK_QUEUE_ENTRY pBlockQueueEntry, - IN PNET_DEV pNetDev) -{ - PNETIF_ENTRY pNetIfEntry = NULL; - - if ((pNetIfEntry = (PNETIF_ENTRY)removeHeadList(&freeNetIfEntryList)) != NULL) - { - RTMP_OS_NETDEV_STOP_QUEUE(pNetDev); - pNetIfEntry->pNetDev = pNetDev; - insertTailList(&pBlockQueueEntry->NetIfList, (PLIST_ENTRY)pNetIfEntry); - - pBlockQueueEntry->SwTxQueueBlockFlag = TRUE; - DBGPRINT(RT_DEBUG_TRACE, ("RTMP_OS_NETDEV_STOP_QUEUE(%s)\n", RTMP_OS_NETDEV_GET_DEVNAME(pNetDev))); - } - else - return FALSE; - - return TRUE; -} - -VOID releaseNetIf( - IN PBLOCK_QUEUE_ENTRY pBlockQueueEntry) -{ - PNETIF_ENTRY pNetIfEntry = NULL; - PLIST_HEADER pNetIfList = &pBlockQueueEntry->NetIfList; - - while((pNetIfEntry = (PNETIF_ENTRY)removeHeadList(pNetIfList)) != NULL) - { - PNET_DEV pNetDev = pNetIfEntry->pNetDev; - RTMP_OS_NETDEV_WAKE_QUEUE(pNetDev); - insertTailList(&freeNetIfEntryList, (PLIST_ENTRY)pNetIfEntry); - - DBGPRINT(RT_DEBUG_TRACE, ("RTMP_OS_NETDEV_WAKE_QUEUE(%s)\n", RTMP_OS_NETDEV_GET_DEVNAME(pNetDev))); - } - pBlockQueueEntry->SwTxQueueBlockFlag = FALSE; - return; -} - - -VOID StopNetIfQueue( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket) -{ - PNET_DEV NetDev = NULL; - UCHAR IfIdx = 0; - BOOLEAN valid = FALSE; - -#ifdef APCLI_SUPPORT - if (RTMP_GET_PACKET_NET_DEVICE(pPacket) >= MIN_NET_DEVICE_FOR_APCLI) - { - IfIdx = (RTMP_GET_PACKET_NET_DEVICE(pPacket) - MIN_NET_DEVICE_FOR_APCLI) % MAX_APCLI_NUM; - NetDev = pAd->ApCfg.ApCliTab[IfIdx].dev; - } - else -#endif // APCLI_SUPPORT // -#ifdef WDS_SUPPORT - if (RTMP_GET_PACKET_NET_DEVICE(pPacket) >= MIN_NET_DEVICE_FOR_WDS) - { - IfIdx = (RTMP_GET_PACKET_NET_DEVICE(pPacket) - MIN_NET_DEVICE_FOR_WDS) % MAX_WDS_ENTRY; - NetDev = pAd->WdsTab.WdsEntry[IfIdx].dev; - } - else -#endif // WDS_SUPPORT // - { -#ifdef MBSS_SUPPORT - if (pAd->OpMode == OPMODE_AP) - { - IfIdx = (RTMP_GET_PACKET_NET_DEVICE(pPacket) - MIN_NET_DEVICE_FOR_MBSSID) % MAX_MBSSID_NUM; - NetDev = pAd->ApCfg.MBSSID[IfIdx].MSSIDDev; - } - else - { - IfIdx = MAIN_MBSSID; - NetDev = pAd->net_dev; - } -#else - IfIdx = MAIN_MBSSID; - NetDev = pAd->net_dev; -#endif - } - - // WMM support 4 software queues. - // One software queue full doesn't mean device have no capbility to transmit packet. - // So disable block Net-If queue function while WMM enable. -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - valid = (pAd->CommonCfg.bWmmCapable == TRUE) ? FALSE : TRUE; -#endif // CONFIG_STA_SUPPORT // - - if (valid) - blockNetIf(&pAd->blockQueueTab[QueIdx], NetDev); - return; -} - -#endif // BLOCK_NET_IF // diff --git a/drivers/staging/rt3090/common/rt_channel.c b/drivers/staging/rt3090/common/rt_channel.c deleted file mode 100644 index da2391e8b74b..000000000000 --- a/drivers/staging/rt3090/common/rt_channel.c +++ /dev/null @@ -1,1287 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* -*/ - -#include "../rt_config.h" - - -CH_FREQ_MAP CH_HZ_ID_MAP[]= - { - {1, 2412}, - {2, 2417}, - {3, 2422}, - {4, 2427}, - {5, 2432}, - {6, 2437}, - {7, 2442}, - {8, 2447}, - {9, 2452}, - {10, 2457}, - {11, 2462}, - {12, 2467}, - {13, 2472}, - {14, 2484}, - - /* UNII */ - {36, 5180}, - {40, 5200}, - {44, 5220}, - {48, 5240}, - {52, 5260}, - {56, 5280}, - {60, 5300}, - {64, 5320}, - {149, 5745}, - {153, 5765}, - {157, 5785}, - {161, 5805}, - {165, 5825}, - {167, 5835}, - {169, 5845}, - {171, 5855}, - {173, 5865}, - - /* HiperLAN2 */ - {100, 5500}, - {104, 5520}, - {108, 5540}, - {112, 5560}, - {116, 5580}, - {120, 5600}, - {124, 5620}, - {128, 5640}, - {132, 5660}, - {136, 5680}, - {140, 5700}, - - /* Japan MMAC */ - {34, 5170}, - {38, 5190}, - {42, 5210}, - {46, 5230}, - - /* Japan */ - {184, 4920}, - {188, 4940}, - {192, 4960}, - {196, 4980}, - - {208, 5040}, /* Japan, means J08 */ - {212, 5060}, /* Japan, means J12 */ - {216, 5080}, /* Japan, means J16 */ -}; - -INT CH_HZ_ID_MAP_NUM = (sizeof(CH_HZ_ID_MAP)/sizeof(CH_FREQ_MAP)); - -CH_REGION ChRegion[] = -{ - { // Antigua and Berbuda - "AG", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Argentina - "AR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Aruba - "AW", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Australia - "AU", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Austria - "AT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, TRUE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Bahamas - "BS", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Barbados - "BB", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Bermuda - "BM", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Brazil - "BR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 24, BOTH, FALSE}, // 5G, ch 100~140 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Belgium - "BE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 18, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 18, IDOR, FALSE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // Bulgaria - "BG", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, ODOR, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Canada - "CA", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Cayman IsLands - "KY", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Chile - "CL", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 20, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 20, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 5, 20, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // China - "CN", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Colombia - "CO", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Costa Rica - "CR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Cyprus - "CY", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Czech_Republic - "CZ", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // Denmark - "DK", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Dominican Republic - "DO", - CE, - { - { 1, 0, 20, BOTH, FALSE}, // 2.4 G, ch 0 - { 149, 4, 20, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Equador - "EC", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 100, 11, 27, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // El Salvador - "SV", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 30, BOTH, TRUE}, // 5G, ch 52~64 - { 149, 4, 36, BOTH, TRUE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Finland - "FI", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // France - "FR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // Germany - "DE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Greece - "GR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, ODOR, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Guam - "GU", - CE, - { - { 1, 11, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Guatemala - "GT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Haiti - "HT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Honduras - "HN", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Hong Kong - "HK", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, FALSE}, // 5G, ch 52~64 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Hungary - "HU", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // Iceland - "IS", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // India - "IN", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 149, 4, 24, IDOR, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Indonesia - "ID", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Ireland - "IE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, ODOR, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Israel - "IL", - CE, - { - { 1, 3, 20, IDOR, FALSE}, // 2.4 G, ch 1~3 - { 4, 6, 20, BOTH, FALSE}, // 2.4 G, ch 4~9 - { 10, 4, 20, IDOR, FALSE}, // 2.4 G, ch 10~13 - { 0}, // end - } - }, - - { // Italy - "IT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, ODOR, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Japan - "JP", - JAP, - { - { 1, 14, 20, BOTH, FALSE}, // 2.4 G, ch 1~14 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 0}, // end - } - }, - - { // Jordan - "JO", - CE, - { - { 1, 13, 20, IDOR, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 149, 4, 23, IDOR, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Latvia - "LV", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Liechtenstein - "LI", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Lithuania - "LT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Luxemburg - "LU", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Malaysia - "MY", - CE, - { - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 5, 20, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Malta - "MT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Marocco - "MA", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 24, IDOR, FALSE}, // 5G, ch 36~48 - { 0}, // end - } - }, - - { // Mexico - "MX", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 5, 30, IDOR, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Netherlands - "NL", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // New Zealand - "NZ", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 24, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Norway - "NO", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 24, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Peru - "PE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Portugal - "PT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Poland - "PL", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Romania - "RO", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Russia - "RU", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 149, 4, 20, IDOR, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Saudi Arabia - "SA", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 23, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Serbia_and_Montenegro - "CS", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 0}, // end - } - }, - - { // Singapore - "SG", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 20, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Slovakia - "SK", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Slovenia - "SI", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // South Africa - "ZA", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // South Korea - "KR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 20, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 20, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 8, 20, BOTH, FALSE}, // 5G, ch 100~128 - { 149, 4, 20, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Spain - "ES", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 17, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Sweden - "SE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Switzerland - "CH", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, TRUE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // Taiwan - "TW", - CE, - { - { 1, 11, 30, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 52, 4, 23, IDOR, FALSE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // Turkey - "TR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // UK - "GB", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 52~64 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Ukraine - "UA", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 0}, // end - } - }, - - { // United_Arab_Emirates - "AE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 0}, // end - } - }, - - { // United_States - "US", - CE, - { - { 1, 11, 30, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 36, 4, 17, IDOR, FALSE}, // 5G, ch 52~64 - { 52, 4, 24, BOTH, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Venezuela - "VE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Default - "", - CE, - { - { 1, 11, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 36, 4, 20, BOTH, FALSE}, // 5G, ch 52~64 - { 52, 4, 20, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 20, BOTH, FALSE}, // 5G, ch 100~140 - { 149, 5, 20, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, -}; - - -static PCH_REGION GetChRegion( - IN PUCHAR CntryCode) -{ - INT loop = 0; - PCH_REGION pChRegion = NULL; - - while (strcmp((PSTRING) ChRegion[loop].CountReg, "") != 0) - { - if (strncmp((PSTRING) ChRegion[loop].CountReg, (PSTRING) CntryCode, 2) == 0) - { - pChRegion = &ChRegion[loop]; - break; - } - loop++; - } - - if (pChRegion == NULL) - pChRegion = &ChRegion[loop]; - return pChRegion; -} - -static VOID ChBandCheck( - IN UCHAR PhyMode, - OUT PUCHAR pChType) -{ - switch(PhyMode) - { - case PHY_11A: -#ifdef DOT11_N_SUPPORT - case PHY_11AN_MIXED: -#endif // DOT11_N_SUPPORT // - *pChType = BAND_5G; - break; - case PHY_11ABG_MIXED: -#ifdef DOT11_N_SUPPORT - case PHY_11AGN_MIXED: - case PHY_11ABGN_MIXED: -#endif // DOT11_N_SUPPORT // - *pChType = BAND_BOTH; - break; - - default: - *pChType = BAND_24G; - break; - } -} - -static UCHAR FillChList( - IN PRTMP_ADAPTER pAd, - IN PCH_DESP pChDesp, - IN UCHAR Offset, - IN UCHAR increment) -{ - INT i, j, l; - UCHAR channel; - - j = Offset; - for (i = 0; i < pChDesp->NumOfCh; i++) - { - channel = pChDesp->FirstChannel + i * increment; - for (l=0; lTxPower[l].Channel) - { - pAd->ChannelList[j].Power = pAd->TxPower[l].Power; - pAd->ChannelList[j].Power2 = pAd->TxPower[l].Power2; - break; - } - } - if (l == MAX_NUM_OF_CHANNELS) - continue; - - pAd->ChannelList[j].Channel = pChDesp->FirstChannel + i * increment; - pAd->ChannelList[j].MaxTxPwr = pChDesp->MaxTxPwr; - pAd->ChannelList[j].DfsReq = pChDesp->DfsReq; - j++; - } - pAd->ChannelListNum = j; - - return j; -} - - -static inline VOID CreateChList( - IN PRTMP_ADAPTER pAd, - IN PCH_REGION pChRegion, - IN UCHAR Geography) -{ - INT i; - UCHAR offset = 0; - PCH_DESP pChDesp; - UCHAR ChType; - UCHAR increment; - - if (pChRegion == NULL) - return; - - ChBandCheck(pAd->CommonCfg.PhyMode, &ChType); - - for (i=0; i<10; i++) - { - pChDesp = &pChRegion->ChDesp[i]; - if (pChDesp->FirstChannel == 0) - break; - - if (ChType == BAND_5G) - { - if (pChDesp->FirstChannel <= 14) - continue; - } - else if (ChType == BAND_24G) - { - if (pChDesp->FirstChannel > 14) - continue; - } - - if ((pChDesp->Geography == BOTH) - || (pChDesp->Geography == Geography)) - { - if (pChDesp->FirstChannel > 14) - increment = 4; - else - increment = 1; - offset = FillChList(pAd, pChDesp, offset, increment); - } - } -} - - -VOID BuildChannelListEx( - IN PRTMP_ADAPTER pAd) -{ - PCH_REGION pChReg; - - pChReg = GetChRegion(pAd->CommonCfg.CountryCode); - CreateChList(pAd, pChReg, pAd->CommonCfg.Geography); -} - - -VOID BuildBeaconChList( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf, - OUT PULONG pBufLen) -{ - INT i; - ULONG TmpLen; - PCH_REGION pChRegion; - PCH_DESP pChDesp; - UCHAR ChType; - - pChRegion = GetChRegion(pAd->CommonCfg.CountryCode); - - if (pChRegion == NULL) - return; - - ChBandCheck(pAd->CommonCfg.PhyMode, &ChType); - *pBufLen = 0; - - for (i=0; i<10; i++) - { - pChDesp = &pChRegion->ChDesp[i]; - if (pChDesp->FirstChannel == 0) - break; - - if (ChType == BAND_5G) - { - if (pChDesp->FirstChannel <= 14) - continue; - } - else if (ChType == BAND_24G) - { - if (pChDesp->FirstChannel > 14) - continue; - } - - if ((pChDesp->Geography == BOTH) - || (pChDesp->Geography == pAd->CommonCfg.Geography)) - { - MakeOutgoingFrame(pBuf + *pBufLen, &TmpLen, - 1, &pChDesp->FirstChannel, - 1, &pChDesp->NumOfCh, - 1, &pChDesp->MaxTxPwr, - END_OF_ARGS); - *pBufLen += TmpLen; - } - } -} - - -#ifdef DOT11_N_SUPPORT -static BOOLEAN IsValidChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR channel) - -{ - INT i; - - for (i = 0; i < pAd->ChannelListNum; i++) - { - if (pAd->ChannelList[i].Channel == channel) - break; - } - - if (i == pAd->ChannelListNum) - return FALSE; - else - return TRUE; -} - - -static UCHAR GetExtCh( - IN UCHAR Channel, - IN UCHAR Direction) -{ - CHAR ExtCh; - - if (Direction == EXTCHA_ABOVE) - ExtCh = Channel + 4; - else - ExtCh = (Channel - 4) > 0 ? (Channel - 4) : 0; - - return ExtCh; -} - - -VOID N_ChannelCheck( - IN PRTMP_ADAPTER pAd) -{ - //UCHAR ChannelNum = pAd->ChannelListNum; - UCHAR Channel = pAd->CommonCfg.Channel; - - if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)) - { - if (Channel > 14) - { - if ((Channel == 36) || (Channel == 44) || (Channel == 52) || (Channel == 60) || (Channel == 100) || (Channel == 108) || - (Channel == 116) || (Channel == 124) || (Channel == 132) || (Channel == 149) || (Channel == 157)) - { - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE; - } - else if ((Channel == 40) || (Channel == 48) || (Channel == 56) || (Channel == 64) || (Channel == 104) || (Channel == 112) || - (Channel == 120) || (Channel == 128) || (Channel == 136) || (Channel == 153) || (Channel == 161)) - { - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW; - } - else - { - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - } - } - else - { - do - { - UCHAR ExtCh; - UCHAR Dir = pAd->CommonCfg.RegTransmitSetting.field.EXTCHA; - ExtCh = GetExtCh(Channel, Dir); - if (IsValidChannel(pAd, ExtCh)) - break; - - Dir = (Dir == EXTCHA_ABOVE) ? EXTCHA_BELOW : EXTCHA_ABOVE; - ExtCh = GetExtCh(Channel, Dir); - if (IsValidChannel(pAd, ExtCh)) - { - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = Dir; - break; - } - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - } while(FALSE); - - if (Channel == 14) - { - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - //pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_NONE; // We didn't set the ExtCh as NONE due to it'll set in RTMPSetHT() - } - } - } - - -} - - -VOID N_SetCenCh( - IN PRTMP_ADAPTER pAd) -{ - if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40) - { - if (pAd->CommonCfg.RegTransmitSetting.field.EXTCHA == EXTCHA_ABOVE) - { - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel + 2; - } - else - { - if (pAd->CommonCfg.Channel == 14) - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel - 1; - else - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel - 2; - } - } - else - { - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; - } -} -#endif // DOT11_N_SUPPORT // - - -UINT8 GetCuntryMaxTxPwr( - IN PRTMP_ADAPTER pAd, - IN UINT8 channel) -{ - int i; - for (i = 0; i < pAd->ChannelListNum; i++) - { - if (pAd->ChannelList[i].Channel == channel) - break; - } - - if (i == pAd->ChannelListNum) - return 0xff; - else - return pAd->ChannelList[i].MaxTxPwr; -} diff --git a/drivers/staging/rt3090/common/rt_rf.c b/drivers/staging/rt3090/common/rt_rf.c deleted file mode 100644 index 9d638f71dbe5..000000000000 --- a/drivers/staging/rt3090/common/rt_rf.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rt_rf.c - - Abstract: - Ralink Wireless driver RF related functions - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#include "../rt_config.h" - - -#ifdef RTMP_RF_RW_SUPPORT -/* - ======================================================================== - - Routine Description: Write RT30xx RF register through MAC - - Arguments: - - Return Value: - - IRQL = - - Note: - - ======================================================================== -*/ -NDIS_STATUS RT30xxWriteRFRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR regID, - IN UCHAR value) -{ - RF_CSR_CFG_STRUC rfcsr; - UINT i = 0; - - do - { - RTMP_IO_READ32(pAd, RF_CSR_CFG, &rfcsr.word); - - if (!rfcsr.field.RF_CSR_KICK) - break; - i++; - } - while ((i < RETRY_LIMIT) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); - - if ((i == RETRY_LIMIT) || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("Retry count exhausted or device removed!!!\n")); - return STATUS_UNSUCCESSFUL; - } - - rfcsr.field.RF_CSR_WR = 1; - rfcsr.field.RF_CSR_KICK = 1; - rfcsr.field.TESTCSR_RFACC_REGNUM = regID; - rfcsr.field.RF_CSR_DATA = value; - - RTMP_IO_WRITE32(pAd, RF_CSR_CFG, rfcsr.word); - - return NDIS_STATUS_SUCCESS; -} - - -/* - ======================================================================== - - Routine Description: Read RT30xx RF register through MAC - - Arguments: - - Return Value: - - IRQL = - - Note: - - ======================================================================== -*/ -NDIS_STATUS RT30xxReadRFRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR regID, - IN PUCHAR pValue) -{ - RF_CSR_CFG_STRUC rfcsr; - UINT i=0, k=0; - - for (i=0; ichipOps.AsicRfInit) - pAd->chipOps.AsicRfInit(pAd); -} - - -VOID RtmpChipOpsRFHook( - IN RTMP_ADAPTER *pAd) -{ - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; - - pChipOps->pRFRegTable = NULL; - pChipOps->AsicRfInit = NULL; - pChipOps->AsicRfTurnOn = NULL; - pChipOps->AsicRfTurnOff = NULL; - pChipOps->AsicReverseRfFromSleepMode = NULL; - pChipOps->AsicHaltAction = NULL; -#ifdef RT33xx -if (IS_RT3390(pAd) && (pAd->infType == RTMP_DEV_INF_PCI)) - { - pChipOps->pRFRegTable = RFRegTableOverRT3390; - pChipOps->AsicHaltAction = RT33xxHaltAction; - pChipOps->AsicRfTurnOff = RT33xxLoadRFSleepModeSetup; - pChipOps->AsicRfInit = NICInitRT3390RFRegisters; - pChipOps->AsicReverseRfFromSleepMode = RT33xxReverseRFSleepModeSetup; - } -#else // RT33xx // - /* We depends on RfICType and MACVersion to assign the corresponding operation callbacks. */ - -#ifdef RT30xx - if (IS_RT30xx(pAd)) - { - pChipOps->pRFRegTable = RT30xx_RFRegTable; - pChipOps->AsicHaltAction = RT30xxHaltAction; -#ifdef RT3090 - if (IS_RT3090(pAd) && (pAd->infType == RTMP_DEV_INF_PCI)) - { - pChipOps->AsicRfTurnOff = RT30xxLoadRFSleepModeSetup; - pChipOps->AsicRfInit = NICInitRT3090RFRegisters; - pChipOps->AsicReverseRfFromSleepMode = RT30xxReverseRFSleepModeSetup; - } -#endif // RT3090 // - } -#endif // RT30xx // -#endif // RT33xx // -} - -#endif // RTMP_RF_RW_SUPPORT // diff --git a/drivers/staging/rt3090/common/rtmp_init.c b/drivers/staging/rt3090/common/rtmp_init.c deleted file mode 100644 index 48b95b75b0d5..000000000000 --- a/drivers/staging/rt3090/common/rtmp_init.c +++ /dev/null @@ -1,3882 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rtmp_init.c - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#include "../rt_config.h" - - -UCHAR BIT8[] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80}; -char* CipherName[] = {"none","wep64","wep128","TKIP","AES","CKIP64","CKIP128"}; - -// -// BBP register initialization set -// -REG_PAIR BBPRegTable[] = { - {BBP_R65, 0x2C}, // fix rssi issue - {BBP_R66, 0x38}, // Also set this default value to pAd->BbpTuning.R66CurrentValue at initial - {BBP_R69, 0x12}, - {BBP_R70, 0xa}, // BBP_R70 will change to 0x8 in ApStartUp and LinkUp for rt2860C, otherwise value is 0xa - {BBP_R73, 0x10}, - {BBP_R81, 0x37}, - {BBP_R82, 0x62}, - {BBP_R83, 0x6A}, - {BBP_R84, 0x99}, // 0x19 is for rt2860E and after. This is for extension channel overlapping IOT. 0x99 is for rt2860D and before - {BBP_R86, 0x00}, // middle range issue, Rory @2008-01-28 - {BBP_R91, 0x04}, // middle range issue, Rory @2008-01-28 - {BBP_R92, 0x00}, // middle range issue, Rory @2008-01-28 - {BBP_R103, 0x00}, // near range high-power issue, requested from Gary @2008-0528 - {BBP_R105, 0x05}, // 0x05 is for rt2860E to turn on FEQ control. It is safe for rt2860D and before, because Bit 7:2 are reserved in rt2860D and before. - {BBP_R106, 0x35}, // for ShortGI throughput -}; -#define NUM_BBP_REG_PARMS (sizeof(BBPRegTable) / sizeof(REG_PAIR)) - - -// -// ASIC register initialization sets -// - -RTMP_REG_PAIR MACRegTable[] = { -#if defined(HW_BEACON_OFFSET) && (HW_BEACON_OFFSET == 0x200) - {BCN_OFFSET0, 0xf8f0e8e0}, /* 0x3800(e0), 0x3A00(e8), 0x3C00(f0), 0x3E00(f8), 512B for each beacon */ - {BCN_OFFSET1, 0x6f77d0c8}, /* 0x3200(c8), 0x3400(d0), 0x1DC0(77), 0x1BC0(6f), 512B for each beacon */ -#elif defined(HW_BEACON_OFFSET) && (HW_BEACON_OFFSET == 0x100) - {BCN_OFFSET0, 0xece8e4e0}, /* 0x3800, 0x3A00, 0x3C00, 0x3E00, 512B for each beacon */ - {BCN_OFFSET1, 0xfcf8f4f0}, /* 0x3800, 0x3A00, 0x3C00, 0x3E00, 512B for each beacon */ -#else - #error You must re-calculate new value for BCN_OFFSET0 & BCN_OFFSET1 in MACRegTable[]!!! -#endif // HW_BEACON_OFFSET // - - {LEGACY_BASIC_RATE, 0x0000013f}, // Basic rate set bitmap - {HT_BASIC_RATE, 0x00008003}, // Basic HT rate set , 20M, MCS=3, MM. Format is the same as in TXWI. - {MAC_SYS_CTRL, 0x00}, // 0x1004, , default Disable RX - {RX_FILTR_CFG, 0x17f97}, //0x1400 , RX filter control, - {BKOFF_SLOT_CFG, 0x209}, // default set short slot time, CC_DELAY_TIME should be 2 - //{TX_SW_CFG0, 0x40a06}, // Gary,2006-08-23 - {TX_SW_CFG0, 0x0}, // Gary,2008-05-21 for CWC test - {TX_SW_CFG1, 0x80606}, // Gary,2006-08-23 - {TX_LINK_CFG, 0x1020}, // Gary,2006-08-23 - //{TX_TIMEOUT_CFG, 0x00182090}, // CCK has some problem. So increase timieout value. 2006-10-09// MArvek RT - {TX_TIMEOUT_CFG, 0x000a2090}, // CCK has some problem. So increase timieout value. 2006-10-09// MArvek RT , Modify for 2860E ,2007-08-01 - {MAX_LEN_CFG, MAX_AGGREGATION_SIZE | 0x00001000}, // 0x3018, MAX frame length. Max PSDU = 16kbytes. - {LED_CFG, 0x7f031e46}, // Gary, 2006-08-23 - -//#ifdef CONFIG_AP_SUPPORT -// {WMM_AIFSN_CFG, 0x00001173}, -// {WMM_CWMIN_CFG, 0x00002344}, -// {WMM_CWMAX_CFG, 0x000034a6}, -// {WMM_TXOP0_CFG, 0x00100020}, -// {WMM_TXOP1_CFG, 0x002F0038}, -//#endif // CONFIG_AP_SUPPORT // - -//#ifdef CONFIG_STA_SUPPORT -// {WMM_AIFSN_CFG, 0x00002273}, -// {WMM_CWMIN_CFG, 0x00002344}, -// {WMM_CWMAX_CFG, 0x000034aa}, -//#endif // CONFIG_STA_SUPPORT // -#ifdef INF_AMAZON_SE - {PBF_MAX_PCNT, 0x1F3F6F6F}, //iverson modify for usb issue, 2008/09/19 - // 6F + 6F < total page count FE - // so that RX doesn't occupy TX's buffer space when WMM congestion. -#else - {PBF_MAX_PCNT, 0x1F3FBF9F}, //0x1F3f7f9f}, //Jan, 2006/04/20 -#endif // INF_AMAZON_SE // - //{TX_RTY_CFG, 0x6bb80408}, // Jan, 2006/11/16 -// WMM_ACM_SUPPORT -// {TX_RTY_CFG, 0x6bb80101}, // sample - {TX_RTY_CFG, 0x47d01f0f}, // Jan, 2006/11/16, Set TxWI->ACK =0 in Probe Rsp Modify for 2860E ,2007-08-03 - - {AUTO_RSP_CFG, 0x00000013}, // Initial Auto_Responder, because QA will turn off Auto-Responder - {CCK_PROT_CFG, 0x05740003 /*0x01740003*/}, // Initial Auto_Responder, because QA will turn off Auto-Responder. And RTS threshold is enabled. - {OFDM_PROT_CFG, 0x05740003 /*0x01740003*/}, // Initial Auto_Responder, because QA will turn off Auto-Responder. And RTS threshold is enabled. - {GF20_PROT_CFG, 0x01744004}, // set 19:18 --> Short NAV for MIMO PS - {GF40_PROT_CFG, 0x03F44084}, - {MM20_PROT_CFG, 0x01744004}, -#ifdef RTMP_MAC_PCI - {MM40_PROT_CFG, 0x03F54084}, -#endif // RTMP_MAC_PCI // - {TXOP_CTRL_CFG, 0x0000583f, /*0x0000243f*/ /*0x000024bf*/}, //Extension channel backoff. - {TX_RTS_CFG, 0x00092b20}, -//#ifdef WIFI_TEST - {EXP_ACK_TIME, 0x002400ca}, // default value -//#else -// {EXP_ACK_TIME, 0x005400ca}, // suggested by Gray @ 20070323 for 11n intel-sta throughput -//#endif // end - WIFI_TEST // -//#ifdef CONFIG_AP_SUPPORT -// {TBTT_SYNC_CFG, 0x00422000}, // TBTT_ADJUST(7:0) == 0 -// {TBTT_SYNC_CFG, 0x00012000}, // TBTT_ADJUST(7:0) == 0 -//#endif // CONFIG_AP_SUPPORT // - {TXOP_HLDR_ET, 0x00000002}, - - /* Jerry comments 2008/01/16: we use SIFS = 10us in CCK defaultly, but it seems that 10us - is too small for INTEL 2200bg card, so in MBSS mode, the delta time between beacon0 - and beacon1 is SIFS (10us), so if INTEL 2200bg card connects to BSS0, the ping - will always lost. So we change the SIFS of CCK from 10us to 16us. */ - {XIFS_TIME_CFG, 0x33a41010}, - {PWR_PIN_CFG, 0x00000003}, // patch for 2880-E -}; - - -#ifdef CONFIG_STA_SUPPORT -RTMP_REG_PAIR STAMACRegTable[] = { - {WMM_AIFSN_CFG, 0x00002273}, - {WMM_CWMIN_CFG, 0x00002344}, - {WMM_CWMAX_CFG, 0x000034aa}, -}; -#endif // CONFIG_STA_SUPPORT // - -#define NUM_MAC_REG_PARMS (sizeof(MACRegTable) / sizeof(RTMP_REG_PAIR)) -#ifdef CONFIG_STA_SUPPORT -#define NUM_STA_MAC_REG_PARMS (sizeof(STAMACRegTable) / sizeof(RTMP_REG_PAIR)) -#endif // CONFIG_STA_SUPPORT // - - -/* - ======================================================================== - - Routine Description: - Allocate RTMP_ADAPTER data block and do some initialization - - Arguments: - Adapter Pointer to our adapter - - Return Value: - NDIS_STATUS_SUCCESS - NDIS_STATUS_FAILURE - - IRQL = PASSIVE_LEVEL - - Note: - - ======================================================================== -*/ -NDIS_STATUS RTMPAllocAdapterBlock( - IN PVOID handle, - OUT PRTMP_ADAPTER *ppAdapter) -{ - PRTMP_ADAPTER pAd; - NDIS_STATUS Status; - INT index; - UCHAR *pBeaconBuf = NULL; - - DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPAllocAdapterBlock\n")); - - *ppAdapter = NULL; - - do - { - // Allocate RTMP_ADAPTER memory block - pBeaconBuf = kmalloc(MAX_BEACON_SIZE, MEM_ALLOC_FLAG); - if (pBeaconBuf == NULL) - { - Status = NDIS_STATUS_FAILURE; - DBGPRINT_ERR(("Failed to allocate memory - BeaconBuf!\n")); - break; - } - NdisZeroMemory(pBeaconBuf, MAX_BEACON_SIZE); - - Status = AdapterBlockAllocateMemory(handle, (PVOID *)&pAd); - if (Status != NDIS_STATUS_SUCCESS) - { - DBGPRINT_ERR(("Failed to allocate memory - ADAPTER\n")); - break; - } - pAd->BeaconBuf = pBeaconBuf; - DBGPRINT(RT_DEBUG_OFF, ("\n\n=== pAd = %p, size = %d ===\n\n", pAd, (UINT32)sizeof(RTMP_ADAPTER))); - - - // Init spin locks - NdisAllocateSpinLock(&pAd->MgmtRingLock); -#ifdef RTMP_MAC_PCI - NdisAllocateSpinLock(&pAd->RxRingLock); -#ifdef RT3090 -#ifdef CONFIG_STA_SUPPORT - NdisAllocateSpinLock(&pAd->McuCmdLock); -#endif // CONFIG_STA_SUPPORT // -#endif // RT3090 // -#endif // RTMP_MAC_PCI // - - for (index =0 ; index < NUM_OF_TX_RING; index++) - { - NdisAllocateSpinLock(&pAd->TxSwQueueLock[index]); - NdisAllocateSpinLock(&pAd->DeQueueLock[index]); - pAd->DeQueueRunning[index] = FALSE; - } - - NdisAllocateSpinLock(&pAd->irq_lock); - - - } while (FALSE); - - if ((Status != NDIS_STATUS_SUCCESS) && (pBeaconBuf)) - kfree(pBeaconBuf); - - *ppAdapter = pAd; - - DBGPRINT_S(Status, ("<-- RTMPAllocAdapterBlock, Status=%x\n", Status)); - return Status; -} - - -/* - ======================================================================== - - Routine Description: - Read initial Tx power per MCS and BW from EEPROM - - Arguments: - Adapter Pointer to our adapter - - Return Value: - None - - IRQL = PASSIVE_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPReadTxPwrPerRate( - IN PRTMP_ADAPTER pAd) -{ - ULONG data, Adata, Gdata; - USHORT i, value, value2; - INT Apwrdelta, Gpwrdelta; - UCHAR t1,t2,t3,t4; - BOOLEAN bApwrdeltaMinus = TRUE, bGpwrdeltaMinus = TRUE; - - // - // Get power delta for 20MHz and 40MHz. - // - DBGPRINT(RT_DEBUG_TRACE, ("Txpower per Rate\n")); - RT28xx_EEPROM_READ16(pAd, EEPROM_TXPOWER_DELTA, value2); - Apwrdelta = 0; - Gpwrdelta = 0; - - if ((value2 & 0xff) != 0xff) - { - if ((value2 & 0x80)) - Gpwrdelta = (value2&0xf); - - if ((value2 & 0x40)) - bGpwrdeltaMinus = FALSE; - else - bGpwrdeltaMinus = TRUE; - } - if ((value2 & 0xff00) != 0xff00) - { - if ((value2 & 0x8000)) - Apwrdelta = ((value2&0xf00)>>8); - - if ((value2 & 0x4000)) - bApwrdeltaMinus = FALSE; - else - bApwrdeltaMinus = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("Gpwrdelta = %x, Apwrdelta = %x .\n", Gpwrdelta, Apwrdelta)); - - // - // Get Txpower per MCS for 20MHz in 2.4G. - // - for (i=0; i<5; i++) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_TXPOWER_BYRATE_20MHZ_2_4G + i*4, value); - data = value; - if (bApwrdeltaMinus == FALSE) - { - t1 = (value&0xf)+(Apwrdelta); - if (t1 > 0xf) - t1 = 0xf; - t2 = ((value&0xf0)>>4)+(Apwrdelta); - if (t2 > 0xf) - t2 = 0xf; - t3 = ((value&0xf00)>>8)+(Apwrdelta); - if (t3 > 0xf) - t3 = 0xf; - t4 = ((value&0xf000)>>12)+(Apwrdelta); - if (t4 > 0xf) - t4 = 0xf; - } - else - { - if ((value&0xf) > Apwrdelta) - t1 = (value&0xf)-(Apwrdelta); - else - t1 = 0; - if (((value&0xf0)>>4) > Apwrdelta) - t2 = ((value&0xf0)>>4)-(Apwrdelta); - else - t2 = 0; - if (((value&0xf00)>>8) > Apwrdelta) - t3 = ((value&0xf00)>>8)-(Apwrdelta); - else - t3 = 0; - if (((value&0xf000)>>12) > Apwrdelta) - t4 = ((value&0xf000)>>12)-(Apwrdelta); - else - t4 = 0; - } - Adata = t1 + (t2<<4) + (t3<<8) + (t4<<12); - if (bGpwrdeltaMinus == FALSE) - { - t1 = (value&0xf)+(Gpwrdelta); - if (t1 > 0xf) - t1 = 0xf; - t2 = ((value&0xf0)>>4)+(Gpwrdelta); - if (t2 > 0xf) - t2 = 0xf; - t3 = ((value&0xf00)>>8)+(Gpwrdelta); - if (t3 > 0xf) - t3 = 0xf; - t4 = ((value&0xf000)>>12)+(Gpwrdelta); - if (t4 > 0xf) - t4 = 0xf; - } - else - { - if ((value&0xf) > Gpwrdelta) - t1 = (value&0xf)-(Gpwrdelta); - else - t1 = 0; - if (((value&0xf0)>>4) > Gpwrdelta) - t2 = ((value&0xf0)>>4)-(Gpwrdelta); - else - t2 = 0; - if (((value&0xf00)>>8) > Gpwrdelta) - t3 = ((value&0xf00)>>8)-(Gpwrdelta); - else - t3 = 0; - if (((value&0xf000)>>12) > Gpwrdelta) - t4 = ((value&0xf000)>>12)-(Gpwrdelta); - else - t4 = 0; - } - Gdata = t1 + (t2<<4) + (t3<<8) + (t4<<12); - - RT28xx_EEPROM_READ16(pAd, EEPROM_TXPOWER_BYRATE_20MHZ_2_4G + i*4 + 2, value); - if (bApwrdeltaMinus == FALSE) - { - t1 = (value&0xf)+(Apwrdelta); - if (t1 > 0xf) - t1 = 0xf; - t2 = ((value&0xf0)>>4)+(Apwrdelta); - if (t2 > 0xf) - t2 = 0xf; - t3 = ((value&0xf00)>>8)+(Apwrdelta); - if (t3 > 0xf) - t3 = 0xf; - t4 = ((value&0xf000)>>12)+(Apwrdelta); - if (t4 > 0xf) - t4 = 0xf; - } - else - { - if ((value&0xf) > Apwrdelta) - t1 = (value&0xf)-(Apwrdelta); - else - t1 = 0; - if (((value&0xf0)>>4) > Apwrdelta) - t2 = ((value&0xf0)>>4)-(Apwrdelta); - else - t2 = 0; - if (((value&0xf00)>>8) > Apwrdelta) - t3 = ((value&0xf00)>>8)-(Apwrdelta); - else - t3 = 0; - if (((value&0xf000)>>12) > Apwrdelta) - t4 = ((value&0xf000)>>12)-(Apwrdelta); - else - t4 = 0; - } - Adata |= ((t1<<16) + (t2<<20) + (t3<<24) + (t4<<28)); - if (bGpwrdeltaMinus == FALSE) - { - t1 = (value&0xf)+(Gpwrdelta); - if (t1 > 0xf) - t1 = 0xf; - t2 = ((value&0xf0)>>4)+(Gpwrdelta); - if (t2 > 0xf) - t2 = 0xf; - t3 = ((value&0xf00)>>8)+(Gpwrdelta); - if (t3 > 0xf) - t3 = 0xf; - t4 = ((value&0xf000)>>12)+(Gpwrdelta); - if (t4 > 0xf) - t4 = 0xf; - } - else - { - if ((value&0xf) > Gpwrdelta) - t1 = (value&0xf)-(Gpwrdelta); - else - t1 = 0; - if (((value&0xf0)>>4) > Gpwrdelta) - t2 = ((value&0xf0)>>4)-(Gpwrdelta); - else - t2 = 0; - if (((value&0xf00)>>8) > Gpwrdelta) - t3 = ((value&0xf00)>>8)-(Gpwrdelta); - else - t3 = 0; - if (((value&0xf000)>>12) > Gpwrdelta) - t4 = ((value&0xf000)>>12)-(Gpwrdelta); - else - t4 = 0; - } - Gdata |= ((t1<<16) + (t2<<20) + (t3<<24) + (t4<<28)); - data |= (value<<16); - - /* For 20M/40M Power Delta issue */ - pAd->Tx20MPwrCfgABand[i] = data; - pAd->Tx20MPwrCfgGBand[i] = data; - pAd->Tx40MPwrCfgABand[i] = Adata; - pAd->Tx40MPwrCfgGBand[i] = Gdata; - - if (data != 0xffffffff) - RTMP_IO_WRITE32(pAd, TX_PWR_CFG_0 + i*4, data); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("20MHz BW, 2.4G band-%lx, Adata = %lx, Gdata = %lx \n", data, Adata, Gdata)); - } -} - - -/* - ======================================================================== - - Routine Description: - Read initial channel power parameters from EEPROM - - Arguments: - Adapter Pointer to our adapter - - Return Value: - None - - IRQL = PASSIVE_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPReadChannelPwr( - IN PRTMP_ADAPTER pAd) -{ - UCHAR i, choffset; - EEPROM_TX_PWR_STRUC Power; - EEPROM_TX_PWR_STRUC Power2; - - // Read Tx power value for all channels - // Value from 1 - 0x7f. Default value is 24. - // Power value : 2.4G 0x00 (0) ~ 0x1F (31) - // : 5.5G 0xF9 (-7) ~ 0x0F (15) - - // 0. 11b/g, ch1 - ch 14 - for (i = 0; i < 7; i++) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_G_TX_PWR_OFFSET + i * 2, Power.word); - RT28xx_EEPROM_READ16(pAd, EEPROM_G_TX2_PWR_OFFSET + i * 2, Power2.word); - pAd->TxPower[i * 2].Channel = i * 2 + 1; - pAd->TxPower[i * 2 + 1].Channel = i * 2 + 2; - - if ((Power.field.Byte0 > 31) || (Power.field.Byte0 < 0)) - pAd->TxPower[i * 2].Power = DEFAULT_RF_TX_POWER; - else - pAd->TxPower[i * 2].Power = Power.field.Byte0; - - if ((Power.field.Byte1 > 31) || (Power.field.Byte1 < 0)) - pAd->TxPower[i * 2 + 1].Power = DEFAULT_RF_TX_POWER; - else - pAd->TxPower[i * 2 + 1].Power = Power.field.Byte1; - - if ((Power2.field.Byte0 > 31) || (Power2.field.Byte0 < 0)) - pAd->TxPower[i * 2].Power2 = DEFAULT_RF_TX_POWER; - else - pAd->TxPower[i * 2].Power2 = Power2.field.Byte0; - - if ((Power2.field.Byte1 > 31) || (Power2.field.Byte1 < 0)) - pAd->TxPower[i * 2 + 1].Power2 = DEFAULT_RF_TX_POWER; - else - pAd->TxPower[i * 2 + 1].Power2 = Power2.field.Byte1; - } - - // 1. U-NII lower/middle band: 36, 38, 40; 44, 46, 48; 52, 54, 56; 60, 62, 64 (including central frequency in BW 40MHz) - // 1.1 Fill up channel - choffset = 14; - for (i = 0; i < 4; i++) - { - pAd->TxPower[3 * i + choffset + 0].Channel = 36 + i * 8 + 0; - pAd->TxPower[3 * i + choffset + 0].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 0].Power2 = DEFAULT_RF_TX_POWER; - - pAd->TxPower[3 * i + choffset + 1].Channel = 36 + i * 8 + 2; - pAd->TxPower[3 * i + choffset + 1].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 1].Power2 = DEFAULT_RF_TX_POWER; - - pAd->TxPower[3 * i + choffset + 2].Channel = 36 + i * 8 + 4; - pAd->TxPower[3 * i + choffset + 2].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 2].Power2 = DEFAULT_RF_TX_POWER; - } - - // 1.2 Fill up power - for (i = 0; i < 6; i++) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_A_TX_PWR_OFFSET + i * 2, Power.word); - RT28xx_EEPROM_READ16(pAd, EEPROM_A_TX2_PWR_OFFSET + i * 2, Power2.word); - - if ((Power.field.Byte0 < 16) && (Power.field.Byte0 >= -7)) - pAd->TxPower[i * 2 + choffset + 0].Power = Power.field.Byte0; - - if ((Power.field.Byte1 < 16) && (Power.field.Byte1 >= -7)) - pAd->TxPower[i * 2 + choffset + 1].Power = Power.field.Byte1; - - if ((Power2.field.Byte0 < 16) && (Power2.field.Byte0 >= -7)) - pAd->TxPower[i * 2 + choffset + 0].Power2 = Power2.field.Byte0; - - if ((Power2.field.Byte1 < 16) && (Power2.field.Byte1 >= -7)) - pAd->TxPower[i * 2 + choffset + 1].Power2 = Power2.field.Byte1; - } - - // 2. HipperLAN 2 100, 102 ,104; 108, 110, 112; 116, 118, 120; 124, 126, 128; 132, 134, 136; 140 (including central frequency in BW 40MHz) - // 2.1 Fill up channel - choffset = 14 + 12; - for (i = 0; i < 5; i++) - { - pAd->TxPower[3 * i + choffset + 0].Channel = 100 + i * 8 + 0; - pAd->TxPower[3 * i + choffset + 0].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 0].Power2 = DEFAULT_RF_TX_POWER; - - pAd->TxPower[3 * i + choffset + 1].Channel = 100 + i * 8 + 2; - pAd->TxPower[3 * i + choffset + 1].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 1].Power2 = DEFAULT_RF_TX_POWER; - - pAd->TxPower[3 * i + choffset + 2].Channel = 100 + i * 8 + 4; - pAd->TxPower[3 * i + choffset + 2].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 2].Power2 = DEFAULT_RF_TX_POWER; - } - pAd->TxPower[3 * 5 + choffset + 0].Channel = 140; - pAd->TxPower[3 * 5 + choffset + 0].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * 5 + choffset + 0].Power2 = DEFAULT_RF_TX_POWER; - - // 2.2 Fill up power - for (i = 0; i < 8; i++) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_A_TX_PWR_OFFSET + (choffset - 14) + i * 2, Power.word); - RT28xx_EEPROM_READ16(pAd, EEPROM_A_TX2_PWR_OFFSET + (choffset - 14) + i * 2, Power2.word); - - if ((Power.field.Byte0 < 16) && (Power.field.Byte0 >= -7)) - pAd->TxPower[i * 2 + choffset + 0].Power = Power.field.Byte0; - - if ((Power.field.Byte1 < 16) && (Power.field.Byte1 >= -7)) - pAd->TxPower[i * 2 + choffset + 1].Power = Power.field.Byte1; - - if ((Power2.field.Byte0 < 16) && (Power2.field.Byte0 >= -7)) - pAd->TxPower[i * 2 + choffset + 0].Power2 = Power2.field.Byte0; - - if ((Power2.field.Byte1 < 16) && (Power2.field.Byte1 >= -7)) - pAd->TxPower[i * 2 + choffset + 1].Power2 = Power2.field.Byte1; - } - - // 3. U-NII upper band: 149, 151, 153; 157, 159, 161; 165, 167, 169; 171, 173 (including central frequency in BW 40MHz) - // 3.1 Fill up channel - choffset = 14 + 12 + 16; - /*for (i = 0; i < 2; i++)*/ - for (i = 0; i < 3; i++) - { - pAd->TxPower[3 * i + choffset + 0].Channel = 149 + i * 8 + 0; - pAd->TxPower[3 * i + choffset + 0].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 0].Power2 = DEFAULT_RF_TX_POWER; - - pAd->TxPower[3 * i + choffset + 1].Channel = 149 + i * 8 + 2; - pAd->TxPower[3 * i + choffset + 1].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 1].Power2 = DEFAULT_RF_TX_POWER; - - pAd->TxPower[3 * i + choffset + 2].Channel = 149 + i * 8 + 4; - pAd->TxPower[3 * i + choffset + 2].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 2].Power2 = DEFAULT_RF_TX_POWER; - } - pAd->TxPower[3 * 3 + choffset + 0].Channel = 171; - pAd->TxPower[3 * 3 + choffset + 0].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * 3 + choffset + 0].Power2 = DEFAULT_RF_TX_POWER; - - pAd->TxPower[3 * 3 + choffset + 1].Channel = 173; - pAd->TxPower[3 * 3 + choffset + 1].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * 3 + choffset + 1].Power2 = DEFAULT_RF_TX_POWER; - - // 3.2 Fill up power - /*for (i = 0; i < 4; i++)*/ - for (i = 0; i < 6; i++) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_A_TX_PWR_OFFSET + (choffset - 14) + i * 2, Power.word); - RT28xx_EEPROM_READ16(pAd, EEPROM_A_TX2_PWR_OFFSET + (choffset - 14) + i * 2, Power2.word); - - if ((Power.field.Byte0 < 16) && (Power.field.Byte0 >= -7)) - pAd->TxPower[i * 2 + choffset + 0].Power = Power.field.Byte0; - - if ((Power.field.Byte1 < 16) && (Power.field.Byte1 >= -7)) - pAd->TxPower[i * 2 + choffset + 1].Power = Power.field.Byte1; - - if ((Power2.field.Byte0 < 16) && (Power2.field.Byte0 >= -7)) - pAd->TxPower[i * 2 + choffset + 0].Power2 = Power2.field.Byte0; - - if ((Power2.field.Byte1 < 16) && (Power2.field.Byte1 >= -7)) - pAd->TxPower[i * 2 + choffset + 1].Power2 = Power2.field.Byte1; - } - - // 4. Print and Debug - /*choffset = 14 + 12 + 16 + 7;*/ - choffset = 14 + 12 + 16 + 11; - - -} - -/* - ======================================================================== - - Routine Description: - Read the following from the registry - 1. All the parameters - 2. NetworkAddres - - Arguments: - Adapter Pointer to our adapter - WrapperConfigurationContext For use by NdisOpenConfiguration - - Return Value: - NDIS_STATUS_SUCCESS - NDIS_STATUS_FAILURE - NDIS_STATUS_RESOURCES - - IRQL = PASSIVE_LEVEL - - Note: - - ======================================================================== -*/ -NDIS_STATUS NICReadRegParameters( - IN PRTMP_ADAPTER pAd, - IN NDIS_HANDLE WrapperConfigurationContext - ) -{ - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - DBGPRINT_S(Status, ("<-- NICReadRegParameters, Status=%x\n", Status)); - return Status; -} - - -/* - ======================================================================== - - Routine Description: - Read initial parameters from EEPROM - - Arguments: - Adapter Pointer to our adapter - - Return Value: - None - - IRQL = PASSIVE_LEVEL - - Note: - - ======================================================================== -*/ -VOID NICReadEEPROMParameters( - IN PRTMP_ADAPTER pAd, - IN PUCHAR mac_addr) -{ - UINT32 data = 0; - USHORT i, value, value2; - UCHAR TmpPhy; - EEPROM_TX_PWR_STRUC Power; - EEPROM_VERSION_STRUC Version; - EEPROM_ANTENNA_STRUC Antenna; - EEPROM_NIC_CONFIG2_STRUC NicConfig2; - - DBGPRINT(RT_DEBUG_TRACE, ("--> NICReadEEPROMParameters\n")); - - if (pAd->chipOps.eeinit) - pAd->chipOps.eeinit(pAd); -#ifdef RTMP_EFUSE_SUPPORT -#ifdef RT30xx - if(!pAd->bFroceEEPROMBuffer && pAd->bEEPROMFile) - { - DBGPRINT(RT_DEBUG_TRACE, ("--> NICReadEEPROMParameters::(Efuse)Load to EEPROM Buffer Mode\n")); - eFuseLoadEEPROM(pAd); - } -#endif // RT30xx // -#endif // RTMP_EFUSE_SUPPORT // - - // Init EEPROM Address Number, before access EEPROM; if 93c46, EEPROMAddressNum=6, else if 93c66, EEPROMAddressNum=8 - RTMP_IO_READ32(pAd, E2PROM_CSR, &data); - DBGPRINT(RT_DEBUG_TRACE, ("--> E2PROM_CSR = 0x%x\n", data)); - - if((data & 0x30) == 0) - pAd->EEPROMAddressNum = 6; // 93C46 - else if((data & 0x30) == 0x10) - pAd->EEPROMAddressNum = 8; // 93C66 - else - pAd->EEPROMAddressNum = 8; // 93C86 - DBGPRINT(RT_DEBUG_TRACE, ("--> EEPROMAddressNum = %d\n", pAd->EEPROMAddressNum )); - - // RT2860 MAC no longer auto load MAC address from E2PROM. Driver has to intialize - // MAC address registers according to E2PROM setting - if (mac_addr == NULL || - strlen((PSTRING) mac_addr) != 17 || - mac_addr[2] != ':' || mac_addr[5] != ':' || mac_addr[8] != ':' || - mac_addr[11] != ':' || mac_addr[14] != ':') - { - USHORT Addr01,Addr23,Addr45 ; - - RT28xx_EEPROM_READ16(pAd, 0x04, Addr01); - RT28xx_EEPROM_READ16(pAd, 0x06, Addr23); - RT28xx_EEPROM_READ16(pAd, 0x08, Addr45); - - pAd->PermanentAddress[0] = (UCHAR)(Addr01 & 0xff); - pAd->PermanentAddress[1] = (UCHAR)(Addr01 >> 8); - pAd->PermanentAddress[2] = (UCHAR)(Addr23 & 0xff); - pAd->PermanentAddress[3] = (UCHAR)(Addr23 >> 8); - pAd->PermanentAddress[4] = (UCHAR)(Addr45 & 0xff); - pAd->PermanentAddress[5] = (UCHAR)(Addr45 >> 8); - - DBGPRINT(RT_DEBUG_TRACE, ("Initialize MAC Address from E2PROM \n")); - } - else - { - INT j; - PSTRING macptr; - - macptr = (PSTRING) mac_addr; - - for (j=0; jPermanentAddress[j], 1); - macptr=macptr+3; - } - - DBGPRINT(RT_DEBUG_TRACE, ("Initialize MAC Address from module parameter \n")); - } - - - { - //more conveninet to test mbssid, so ap's bssid &0xf1 - if (pAd->PermanentAddress[0] == 0xff) - pAd->PermanentAddress[0] = RandomByte(pAd)&0xf8; - - //if (pAd->PermanentAddress[5] == 0xff) - // pAd->PermanentAddress[5] = RandomByte(pAd)&0xf8; - - DBGPRINT_RAW(RT_DEBUG_TRACE,("E2PROM MAC: =%02x:%02x:%02x:%02x:%02x:%02x\n", - pAd->PermanentAddress[0], pAd->PermanentAddress[1], - pAd->PermanentAddress[2], pAd->PermanentAddress[3], - pAd->PermanentAddress[4], pAd->PermanentAddress[5])); - if (pAd->bLocalAdminMAC == FALSE) - { - MAC_DW0_STRUC csr2; - MAC_DW1_STRUC csr3; - COPY_MAC_ADDR(pAd->CurrentAddress, pAd->PermanentAddress); - csr2.field.Byte0 = pAd->CurrentAddress[0]; - csr2.field.Byte1 = pAd->CurrentAddress[1]; - csr2.field.Byte2 = pAd->CurrentAddress[2]; - csr2.field.Byte3 = pAd->CurrentAddress[3]; - RTMP_IO_WRITE32(pAd, MAC_ADDR_DW0, csr2.word); - csr3.word = 0; - csr3.field.Byte4 = pAd->CurrentAddress[4]; - csr3.field.Byte5 = pAd->CurrentAddress[5]; - csr3.field.U2MeMask = 0xff; - RTMP_IO_WRITE32(pAd, MAC_ADDR_DW1, csr3.word); - DBGPRINT_RAW(RT_DEBUG_TRACE,("E2PROM MAC: =%02x:%02x:%02x:%02x:%02x:%02x\n", - PRINT_MAC(pAd->PermanentAddress))); - } - } - - // if not return early. cause fail at emulation. - // Init the channel number for TX channel power - RTMPReadChannelPwr(pAd); - - // if E2PROM version mismatch with driver's expectation, then skip - // all subsequent E2RPOM retieval and set a system error bit to notify GUI - RT28xx_EEPROM_READ16(pAd, EEPROM_VERSION_OFFSET, Version.word); - pAd->EepromVersion = Version.field.Version + Version.field.FaeReleaseNumber * 256; - DBGPRINT(RT_DEBUG_TRACE, ("E2PROM: Version = %d, FAE release #%d\n", Version.field.Version, Version.field.FaeReleaseNumber)); - - if (Version.field.Version > VALID_EEPROM_VERSION) - { - DBGPRINT_ERR(("E2PROM: WRONG VERSION 0x%x, should be %d\n",Version.field.Version, VALID_EEPROM_VERSION)); - /*pAd->SystemErrorBitmap |= 0x00000001; - - // hard-code default value when no proper E2PROM installed - pAd->bAutoTxAgcA = FALSE; - pAd->bAutoTxAgcG = FALSE; - - // Default the channel power - for (i = 0; i < MAX_NUM_OF_CHANNELS; i++) - pAd->TxPower[i].Power = DEFAULT_RF_TX_POWER; - - // Default the channel power - for (i = 0; i < MAX_NUM_OF_11JCHANNELS; i++) - pAd->TxPower11J[i].Power = DEFAULT_RF_TX_POWER; - - for(i = 0; i < NUM_EEPROM_BBP_PARMS; i++) - pAd->EEPROMDefaultValue[i] = 0xffff; - return; */ - } - - // Read BBP default value from EEPROM and store to array(EEPROMDefaultValue) in pAd - RT28xx_EEPROM_READ16(pAd, EEPROM_NIC1_OFFSET, value); - pAd->EEPROMDefaultValue[0] = value; - - RT28xx_EEPROM_READ16(pAd, EEPROM_NIC2_OFFSET, value); - pAd->EEPROMDefaultValue[1] = value; - - RT28xx_EEPROM_READ16(pAd, 0x38, value); // Country Region - pAd->EEPROMDefaultValue[2] = value; - - for(i = 0; i < 8; i++) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_BBP_BASE_OFFSET + i*2, value); - pAd->EEPROMDefaultValue[i+3] = value; - } - - // We have to parse NIC configuration 0 at here. - // If TSSI did not have preloaded value, it should reset the TxAutoAgc to false - // Therefore, we have to read TxAutoAgc control beforehand. - // Read Tx AGC control bit - Antenna.word = pAd->EEPROMDefaultValue[0]; - if (Antenna.word == 0xFFFF) - { -#ifdef RT30xx - if(IS_RT3090(pAd)|| IS_RT3390(pAd)) - { - Antenna.word = 0; - Antenna.field.RfIcType = RFIC_3020; - Antenna.field.TxPath = 1; - Antenna.field.RxPath = 1; - } - else -#endif // RT30xx // - { - - Antenna.word = 0; - Antenna.field.RfIcType = RFIC_2820; - Antenna.field.TxPath = 1; - Antenna.field.RxPath = 2; - DBGPRINT(RT_DEBUG_WARN, ("E2PROM error, hard code as 0x%04x\n", Antenna.word)); - } - } - - // Choose the desired Tx&Rx stream. - if ((pAd->CommonCfg.TxStream == 0) || (pAd->CommonCfg.TxStream > Antenna.field.TxPath)) - pAd->CommonCfg.TxStream = Antenna.field.TxPath; - - if ((pAd->CommonCfg.RxStream == 0) || (pAd->CommonCfg.RxStream > Antenna.field.RxPath)) - { - pAd->CommonCfg.RxStream = Antenna.field.RxPath; - - if ((pAd->MACVersion < RALINK_2883_VERSION) && - (pAd->CommonCfg.RxStream > 2)) - { - // only 2 Rx streams for RT2860 series - pAd->CommonCfg.RxStream = 2; - } - } - - // 3*3 - // read value from EEPROM and set them to CSR174 ~ 177 in chain0 ~ chain2 - // yet implement - for(i=0; i<3; i++) - { - } - - NicConfig2.word = pAd->EEPROMDefaultValue[1]; - - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if ((NicConfig2.word & 0x00ff) == 0xff) - { - NicConfig2.word &= 0xff00; - } - - if ((NicConfig2.word >> 8) == 0xff) - { - NicConfig2.word &= 0x00ff; - } - } -#endif // CONFIG_STA_SUPPORT // - - if (NicConfig2.field.DynamicTxAgcControl == 1) - pAd->bAutoTxAgcA = pAd->bAutoTxAgcG = TRUE; - else - pAd->bAutoTxAgcA = pAd->bAutoTxAgcG = FALSE; - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("NICReadEEPROMParameters: RxPath = %d, TxPath = %d\n", Antenna.field.RxPath, Antenna.field.TxPath)); - - // Save the antenna for future use - pAd->Antenna.word = Antenna.word; - - // Set the RfICType here, then we can initialize RFIC related operation callbacks - pAd->Mlme.RealRxPath = (UCHAR) Antenna.field.RxPath; - pAd->RfIcType = (UCHAR) Antenna.field.RfIcType; - -#ifdef RTMP_RF_RW_SUPPORT - RtmpChipOpsRFHook(pAd); -#endif // RTMP_RF_RW_SUPPORT // - - // - // Reset PhyMode if we don't support 802.11a - // Only RFIC_2850 & RFIC_2750 support 802.11a - // - if ((Antenna.field.RfIcType != RFIC_2850) - && (Antenna.field.RfIcType != RFIC_2750) - && (Antenna.field.RfIcType != RFIC_3052)) - { - if ((pAd->CommonCfg.PhyMode == PHY_11ABG_MIXED) || - (pAd->CommonCfg.PhyMode == PHY_11A)) - pAd->CommonCfg.PhyMode = PHY_11BG_MIXED; -#ifdef DOT11_N_SUPPORT - else if ((pAd->CommonCfg.PhyMode == PHY_11ABGN_MIXED) || - (pAd->CommonCfg.PhyMode == PHY_11AN_MIXED) || - (pAd->CommonCfg.PhyMode == PHY_11AGN_MIXED) || - (pAd->CommonCfg.PhyMode == PHY_11N_5G)) - pAd->CommonCfg.PhyMode = PHY_11BGN_MIXED; -#endif // DOT11_N_SUPPORT // - } - - // Read TSSI reference and TSSI boundary for temperature compensation. This is ugly - // 0. 11b/g - { - /* these are tempature reference value (0x00 ~ 0xFE) - ex: 0x00 0x15 0x25 0x45 0x88 0xA0 0xB5 0xD0 0xF0 - TssiPlusBoundaryG [4] [3] [2] [1] [0] (smaller) + - TssiMinusBoundaryG[0] [1] [2] [3] [4] (larger) */ - RT28xx_EEPROM_READ16(pAd, 0x6E, Power.word); - pAd->TssiMinusBoundaryG[4] = Power.field.Byte0; - pAd->TssiMinusBoundaryG[3] = Power.field.Byte1; - RT28xx_EEPROM_READ16(pAd, 0x70, Power.word); - pAd->TssiMinusBoundaryG[2] = Power.field.Byte0; - pAd->TssiMinusBoundaryG[1] = Power.field.Byte1; - RT28xx_EEPROM_READ16(pAd, 0x72, Power.word); - pAd->TssiRefG = Power.field.Byte0; /* reference value [0] */ - pAd->TssiPlusBoundaryG[1] = Power.field.Byte1; - RT28xx_EEPROM_READ16(pAd, 0x74, Power.word); - pAd->TssiPlusBoundaryG[2] = Power.field.Byte0; - pAd->TssiPlusBoundaryG[3] = Power.field.Byte1; - RT28xx_EEPROM_READ16(pAd, 0x76, Power.word); - pAd->TssiPlusBoundaryG[4] = Power.field.Byte0; - pAd->TxAgcStepG = Power.field.Byte1; - pAd->TxAgcCompensateG = 0; - pAd->TssiMinusBoundaryG[0] = pAd->TssiRefG; - pAd->TssiPlusBoundaryG[0] = pAd->TssiRefG; - - // Disable TxAgc if the based value is not right - if (pAd->TssiRefG == 0xff) - pAd->bAutoTxAgcG = FALSE; - - DBGPRINT(RT_DEBUG_TRACE,("E2PROM: G Tssi[-4 .. +4] = %d %d %d %d - %d -%d %d %d %d, step=%d, tuning=%d\n", - pAd->TssiMinusBoundaryG[4], pAd->TssiMinusBoundaryG[3], pAd->TssiMinusBoundaryG[2], pAd->TssiMinusBoundaryG[1], - pAd->TssiRefG, - pAd->TssiPlusBoundaryG[1], pAd->TssiPlusBoundaryG[2], pAd->TssiPlusBoundaryG[3], pAd->TssiPlusBoundaryG[4], - pAd->TxAgcStepG, pAd->bAutoTxAgcG)); - } - // 1. 11a - { - RT28xx_EEPROM_READ16(pAd, 0xD4, Power.word); - pAd->TssiMinusBoundaryA[4] = Power.field.Byte0; - pAd->TssiMinusBoundaryA[3] = Power.field.Byte1; - RT28xx_EEPROM_READ16(pAd, 0xD6, Power.word); - pAd->TssiMinusBoundaryA[2] = Power.field.Byte0; - pAd->TssiMinusBoundaryA[1] = Power.field.Byte1; - RT28xx_EEPROM_READ16(pAd, 0xD8, Power.word); - pAd->TssiRefA = Power.field.Byte0; - pAd->TssiPlusBoundaryA[1] = Power.field.Byte1; - RT28xx_EEPROM_READ16(pAd, 0xDA, Power.word); - pAd->TssiPlusBoundaryA[2] = Power.field.Byte0; - pAd->TssiPlusBoundaryA[3] = Power.field.Byte1; - RT28xx_EEPROM_READ16(pAd, 0xDC, Power.word); - pAd->TssiPlusBoundaryA[4] = Power.field.Byte0; - pAd->TxAgcStepA = Power.field.Byte1; - pAd->TxAgcCompensateA = 0; - pAd->TssiMinusBoundaryA[0] = pAd->TssiRefA; - pAd->TssiPlusBoundaryA[0] = pAd->TssiRefA; - - // Disable TxAgc if the based value is not right - if (pAd->TssiRefA == 0xff) - pAd->bAutoTxAgcA = FALSE; - - DBGPRINT(RT_DEBUG_TRACE,("E2PROM: A Tssi[-4 .. +4] = %d %d %d %d - %d -%d %d %d %d, step=%d, tuning=%d\n", - pAd->TssiMinusBoundaryA[4], pAd->TssiMinusBoundaryA[3], pAd->TssiMinusBoundaryA[2], pAd->TssiMinusBoundaryA[1], - pAd->TssiRefA, - pAd->TssiPlusBoundaryA[1], pAd->TssiPlusBoundaryA[2], pAd->TssiPlusBoundaryA[3], pAd->TssiPlusBoundaryA[4], - pAd->TxAgcStepA, pAd->bAutoTxAgcA)); - } - pAd->BbpRssiToDbmDelta = 0x0; - - // Read frequency offset setting for RF - RT28xx_EEPROM_READ16(pAd, EEPROM_FREQ_OFFSET, value); - if ((value & 0x00FF) != 0x00FF) - pAd->RfFreqOffset = (ULONG) (value & 0x00FF); - else - pAd->RfFreqOffset = 0; - DBGPRINT(RT_DEBUG_TRACE, ("E2PROM: RF FreqOffset=0x%lx \n", pAd->RfFreqOffset)); - - //CountryRegion byte offset (38h) - value = pAd->EEPROMDefaultValue[2] >> 8; // 2.4G band - value2 = pAd->EEPROMDefaultValue[2] & 0x00FF; // 5G band - - if ((value <= REGION_MAXIMUM_BG_BAND) && (value2 <= REGION_MAXIMUM_A_BAND)) - { - pAd->CommonCfg.CountryRegion = ((UCHAR) value) | 0x80; - pAd->CommonCfg.CountryRegionForABand = ((UCHAR) value2) | 0x80; - TmpPhy = pAd->CommonCfg.PhyMode; - pAd->CommonCfg.PhyMode = 0xff; - RTMPSetPhyMode(pAd, TmpPhy); -#ifdef DOT11_N_SUPPORT - SetCommonHT(pAd); -#endif // DOT11_N_SUPPORT // - } - - // - // Get RSSI Offset on EEPROM 0x9Ah & 0x9Ch. - // The valid value are (-10 ~ 10) - // - RT28xx_EEPROM_READ16(pAd, EEPROM_RSSI_BG_OFFSET, value); - pAd->BGRssiOffset0 = value & 0x00ff; - pAd->BGRssiOffset1 = (value >> 8); - RT28xx_EEPROM_READ16(pAd, EEPROM_RSSI_BG_OFFSET+2, value); - pAd->BGRssiOffset2 = value & 0x00ff; - pAd->ALNAGain1 = (value >> 8); - RT28xx_EEPROM_READ16(pAd, EEPROM_LNA_OFFSET, value); - pAd->BLNAGain = value & 0x00ff; - pAd->ALNAGain0 = (value >> 8); - - // Validate 11b/g RSSI_0 offset. - if ((pAd->BGRssiOffset0 < -10) || (pAd->BGRssiOffset0 > 10)) - pAd->BGRssiOffset0 = 0; - - // Validate 11b/g RSSI_1 offset. - if ((pAd->BGRssiOffset1 < -10) || (pAd->BGRssiOffset1 > 10)) - pAd->BGRssiOffset1 = 0; - - // Validate 11b/g RSSI_2 offset. - if ((pAd->BGRssiOffset2 < -10) || (pAd->BGRssiOffset2 > 10)) - pAd->BGRssiOffset2 = 0; - - RT28xx_EEPROM_READ16(pAd, EEPROM_RSSI_A_OFFSET, value); - pAd->ARssiOffset0 = value & 0x00ff; - pAd->ARssiOffset1 = (value >> 8); - RT28xx_EEPROM_READ16(pAd, (EEPROM_RSSI_A_OFFSET+2), value); - pAd->ARssiOffset2 = value & 0x00ff; - pAd->ALNAGain2 = (value >> 8); - - if (((UCHAR)pAd->ALNAGain1 == 0xFF) || (pAd->ALNAGain1 == 0x00)) - pAd->ALNAGain1 = pAd->ALNAGain0; - if (((UCHAR)pAd->ALNAGain2 == 0xFF) || (pAd->ALNAGain2 == 0x00)) - pAd->ALNAGain2 = pAd->ALNAGain0; - - // Validate 11a RSSI_0 offset. - if ((pAd->ARssiOffset0 < -10) || (pAd->ARssiOffset0 > 10)) - pAd->ARssiOffset0 = 0; - - // Validate 11a RSSI_1 offset. - if ((pAd->ARssiOffset1 < -10) || (pAd->ARssiOffset1 > 10)) - pAd->ARssiOffset1 = 0; - - //Validate 11a RSSI_2 offset. - if ((pAd->ARssiOffset2 < -10) || (pAd->ARssiOffset2 > 10)) - pAd->ARssiOffset2 = 0; - -#ifdef RT30xx - // - // Get TX mixer gain setting - // 0xff are invalid value - // Note: RT30xX default value is 0x00 and will program to RF_R17 only when this value is not zero. - // RT359X default value is 0x02 - // - if (IS_RT30xx(pAd) || IS_RT3572(pAd)) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_TXMIXER_GAIN_2_4G, value); - pAd->TxMixerGain24G = 0; - value &= 0x00ff; - if (value != 0xff) - { - value &= 0x07; - pAd->TxMixerGain24G = (UCHAR)value; - } - } -#endif // RT30xx // - - // - // Get LED Setting. - // - RT28xx_EEPROM_READ16(pAd, 0x3a, value); - pAd->LedCntl.word = (value>>8); - RT28xx_EEPROM_READ16(pAd, EEPROM_LED1_OFFSET, value); - pAd->Led1 = value; - RT28xx_EEPROM_READ16(pAd, EEPROM_LED2_OFFSET, value); - pAd->Led2 = value; - RT28xx_EEPROM_READ16(pAd, EEPROM_LED3_OFFSET, value); - pAd->Led3 = value; - - RTMPReadTxPwrPerRate(pAd); - -#ifdef SINGLE_SKU - RT28xx_EEPROM_READ16(pAd, EEPROM_DEFINE_MAX_TXPWR, pAd->CommonCfg.DefineMaxTxPwr); -#endif // SINGLE_SKU // - -#ifdef RT30xx -#ifdef RTMP_EFUSE_SUPPORT - RtmpEfuseSupportCheck(pAd); -#endif // RTMP_EFUSE_SUPPORT // -#endif // RT30xx // - - DBGPRINT(RT_DEBUG_TRACE, ("<-- NICReadEEPROMParameters\n")); -} - - -/* - ======================================================================== - - Routine Description: - Set default value from EEPROM - - Arguments: - Adapter Pointer to our adapter - - Return Value: - None - - IRQL = PASSIVE_LEVEL - - Note: - - ======================================================================== -*/ -VOID NICInitAsicFromEEPROM( - IN PRTMP_ADAPTER pAd) -{ -#ifdef CONFIG_STA_SUPPORT - UINT32 data = 0; - UCHAR BBPR1 = 0; -#endif // CONFIG_STA_SUPPORT // - USHORT i; -// EEPROM_ANTENNA_STRUC Antenna; - EEPROM_NIC_CONFIG2_STRUC NicConfig2; - UCHAR BBPR3 = 0; - - DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitAsicFromEEPROM\n")); - for(i = 3; i < NUM_EEPROM_BBP_PARMS; i++) - { - UCHAR BbpRegIdx, BbpValue; - - if ((pAd->EEPROMDefaultValue[i] != 0xFFFF) && (pAd->EEPROMDefaultValue[i] != 0)) - { - BbpRegIdx = (UCHAR)(pAd->EEPROMDefaultValue[i] >> 8); - BbpValue = (UCHAR)(pAd->EEPROMDefaultValue[i] & 0xff); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BbpRegIdx, BbpValue); - } - } - - - NicConfig2.word = pAd->EEPROMDefaultValue[1]; - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if ((NicConfig2.word & 0x00ff) == 0xff) - { - NicConfig2.word &= 0xff00; - } - - if ((NicConfig2.word >> 8) == 0xff) - { - NicConfig2.word &= 0x00ff; - } - } -#endif // CONFIG_STA_SUPPORT // - - // Save the antenna for future use - pAd->NicConfig2.word = NicConfig2.word; - -#ifdef RT30xx - // set default antenna as main - if (pAd->RfIcType == RFIC_3020) - AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); -#endif // RT30xx // - - // - // Send LED Setting to MCU. - // - if (pAd->LedCntl.word == 0xFF) - { - pAd->LedCntl.word = 0x01; - pAd->Led1 = 0x5555; - pAd->Led2 = 0x2221; - -#ifdef RTMP_MAC_PCI - pAd->Led3 = 0xA9F8; -#endif // RTMP_MAC_PCI // - } - - AsicSendCommandToMcu(pAd, 0x52, 0xff, (UCHAR)pAd->Led1, (UCHAR)(pAd->Led1 >> 8)); - AsicSendCommandToMcu(pAd, 0x53, 0xff, (UCHAR)pAd->Led2, (UCHAR)(pAd->Led2 >> 8)); - AsicSendCommandToMcu(pAd, 0x54, 0xff, (UCHAR)pAd->Led3, (UCHAR)(pAd->Led3 >> 8)); - AsicSendCommandToMcu(pAd, 0x51, 0xff, 0, pAd->LedCntl.field.Polarity); - - pAd->LedIndicatorStrength = 0xFF; - RTMPSetSignalLED(pAd, -100); // Force signal strength Led to be turned off, before link up - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // Read Hardware controlled Radio state enable bit - if (NicConfig2.field.HardwareRadioControl == 1) - { - pAd->StaCfg.bHardwareRadio = TRUE; - - // Read GPIO pin2 as Hardware controlled radio state - RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &data); - if ((data & 0x04) == 0) - { - pAd->StaCfg.bHwRadio = FALSE; - pAd->StaCfg.bRadio = FALSE; -// RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x00001818); - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - } - } - else - pAd->StaCfg.bHardwareRadio = FALSE; - - if (pAd->StaCfg.bRadio == FALSE) - { - RTMPSetLED(pAd, LED_RADIO_OFF); - } - else - { - RTMPSetLED(pAd, LED_RADIO_ON); -#ifdef RTMP_MAC_PCI -#ifdef RT3090 - AsicSendCommandToMcu(pAd, 0x30, PowerRadioOffCID, 0xff, 0x02); - AsicCheckCommanOk(pAd, PowerRadioOffCID); -#endif // RT3090 // -#ifndef RT3090 - AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02); -#endif // RT3090 // - AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x00); - // 2-1. wait command ok. - AsicCheckCommanOk(pAd, PowerWakeCID); -#endif // RTMP_MAC_PCI // - } - } -#ifdef RTMP_MAC_PCI -#ifdef RT30xx - if (IS_RT3090(pAd)|| IS_RT3572(pAd) || IS_RT3390(pAd)) - { - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; - if (pChipOps->AsicReverseRfFromSleepMode) - pChipOps->AsicReverseRfFromSleepMode(pAd); - } - // 3090 MCU Wakeup command needs more time to be stable. - // Before stable, don't issue other MCU command to prevent from firmware error. - - if ((IS_RT3090(pAd)|| IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - DBGPRINT(RT_DEBUG_TRACE,("%s::%d,release Mcu Lock\n",__FUNCTION__,__LINE__)); - RTMP_SEM_LOCK(&pAd->McuCmdLock); - pAd->brt30xxBanMcuCmd = FALSE; - RTMP_SEM_UNLOCK(&pAd->McuCmdLock); - } -#endif // RT30xx // -#endif // RTMP_MAC_PCI // -#endif // CONFIG_STA_SUPPORT // - - // Turn off patching for cardbus controller - if (NicConfig2.field.CardbusAcceleration == 1) - { -// pAd->bTest1 = TRUE; - } - - if (NicConfig2.field.DynamicTxAgcControl == 1) - pAd->bAutoTxAgcA = pAd->bAutoTxAgcG = TRUE; - else - pAd->bAutoTxAgcA = pAd->bAutoTxAgcG = FALSE; - // - // Since BBP has been progamed, to make sure BBP setting will be - // upate inside of AsicAntennaSelect, so reset to UNKNOWN_BAND!! - // - pAd->CommonCfg.BandState = UNKNOWN_BAND; - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBPR3); - BBPR3 &= (~0x18); - if(pAd->Antenna.field.RxPath == 3) - { - BBPR3 |= (0x10); - } - else if(pAd->Antenna.field.RxPath == 2) - { - BBPR3 |= (0x8); - } - else if(pAd->Antenna.field.RxPath == 1) - { - BBPR3 |= (0x0); - } - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBPR3); - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // Handle the difference when 1T - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &BBPR1); - if(pAd->Antenna.field.TxPath == 1) - { - BBPR1 &= (~0x18); - } - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R1, BBPR1); - - DBGPRINT(RT_DEBUG_TRACE, ("Use Hw Radio Control Pin=%d; if used Pin=%d;\n", - pAd->CommonCfg.bHardwareRadio, pAd->CommonCfg.bHardwareRadio)); - } -#endif // CONFIG_STA_SUPPORT // - - - DBGPRINT(RT_DEBUG_TRACE, ("TxPath = %d, RxPath = %d, RFIC=%d, Polar+LED mode=%x\n", - pAd->Antenna.field.TxPath, pAd->Antenna.field.RxPath, - pAd->RfIcType, pAd->LedCntl.word)); - DBGPRINT(RT_DEBUG_TRACE, ("<-- NICInitAsicFromEEPROM\n")); -} - -/* - ======================================================================== - - Routine Description: - Initialize NIC hardware - - Arguments: - Adapter Pointer to our adapter - - Return Value: - None - - IRQL = PASSIVE_LEVEL - - Note: - - ======================================================================== -*/ -NDIS_STATUS NICInitializeAdapter( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bHardReset) -{ - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - WPDMA_GLO_CFG_STRUC GloCfg; -#ifdef RTMP_MAC_PCI - UINT32 Value; - DELAY_INT_CFG_STRUC IntCfg; -#endif // RTMP_MAC_PCI // -// INT_MASK_CSR_STRUC IntMask; - ULONG i =0, j=0; - AC_TXOP_CSR0_STRUC csr0; - - DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitializeAdapter\n")); - - // 3. Set DMA global configuration except TX_DMA_EN and RX_DMA_EN bits: -retry: - i = 0; - do - { - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); - if ((GloCfg.field.TxDMABusy == 0) && (GloCfg.field.RxDMABusy == 0)) - break; - - RTMPusecDelay(1000); - i++; - }while ( i<100); - DBGPRINT(RT_DEBUG_TRACE, ("<== DMA offset 0x208 = 0x%x\n", GloCfg.word)); - GloCfg.word &= 0xff0; - GloCfg.field.EnTXWriteBackDDONE =1; - RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); - - // Record HW Beacon offset - pAd->BeaconOffset[0] = HW_BEACON_BASE0; - pAd->BeaconOffset[1] = HW_BEACON_BASE1; - pAd->BeaconOffset[2] = HW_BEACON_BASE2; - pAd->BeaconOffset[3] = HW_BEACON_BASE3; - pAd->BeaconOffset[4] = HW_BEACON_BASE4; - pAd->BeaconOffset[5] = HW_BEACON_BASE5; - pAd->BeaconOffset[6] = HW_BEACON_BASE6; - pAd->BeaconOffset[7] = HW_BEACON_BASE7; - - // - // write all shared Ring's base address into ASIC - // - - // asic simulation sequence put this ahead before loading firmware. - // pbf hardware reset -#ifdef RTMP_MAC_PCI - RTMP_IO_WRITE32(pAd, WPDMA_RST_IDX, 0x1003f); // 0x10000 for reset rx, 0x3f resets all 6 tx rings. - RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, 0xe1f); - RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, 0xe00); -#endif // RTMP_MAC_PCI // - - // Initialze ASIC for TX & Rx operation - if (NICInitializeAsic(pAd , bHardReset) != NDIS_STATUS_SUCCESS) - { - if (j++ == 0) - { - NICLoadFirmware(pAd); - goto retry; - } - return NDIS_STATUS_FAILURE; - } - - -#ifdef RTMP_MAC_PCI - // Write AC_BK base address register - Value = RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_AC_BK].Cell[0].AllocPa); - RTMP_IO_WRITE32(pAd, TX_BASE_PTR1, Value); - DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR1 : 0x%x\n", Value)); - - // Write AC_BE base address register - Value = RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_AC_BE].Cell[0].AllocPa); - RTMP_IO_WRITE32(pAd, TX_BASE_PTR0, Value); - DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR0 : 0x%x\n", Value)); - - // Write AC_VI base address register - Value = RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_AC_VI].Cell[0].AllocPa); - RTMP_IO_WRITE32(pAd, TX_BASE_PTR2, Value); - DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR2 : 0x%x\n", Value)); - - // Write AC_VO base address register - Value = RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_AC_VO].Cell[0].AllocPa); - RTMP_IO_WRITE32(pAd, TX_BASE_PTR3, Value); - DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR3 : 0x%x\n", Value)); - - // Write HCCA base address register - /* - Value = RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_HCCA].Cell[0].AllocPa); - RTMP_IO_WRITE32(pAd, TX_BASE_PTR4, Value); - DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR4 : 0x%x\n", Value)); - */ - - // Write MGMT_BASE_CSR register - Value = RTMP_GetPhysicalAddressLow(pAd->MgmtRing.Cell[0].AllocPa); - RTMP_IO_WRITE32(pAd, TX_BASE_PTR5, Value); - DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR5 : 0x%x\n", Value)); - - // Write RX_BASE_CSR register - Value = RTMP_GetPhysicalAddressLow(pAd->RxRing.Cell[0].AllocPa); - RTMP_IO_WRITE32(pAd, RX_BASE_PTR, Value); - DBGPRINT(RT_DEBUG_TRACE, ("--> RX_BASE_PTR : 0x%x\n", Value)); - - // Init RX Ring index pointer - pAd->RxRing.RxSwReadIdx = 0; - pAd->RxRing.RxCpuIdx = RX_RING_SIZE-1; - RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RxCpuIdx); - - // Init TX rings index pointer - { - for (i=0; iTxRing[i].TxSwFreeIdx = 0; - pAd->TxRing[i].TxCpuIdx = 0; - RTMP_IO_WRITE32(pAd, (TX_CTX_IDX0 + i * 0x10) , pAd->TxRing[i].TxCpuIdx); - } - } - - // init MGMT ring index pointer - pAd->MgmtRing.TxSwFreeIdx = 0; - pAd->MgmtRing.TxCpuIdx = 0; - RTMP_IO_WRITE32(pAd, TX_MGMTCTX_IDX, pAd->MgmtRing.TxCpuIdx); - - // - // set each Ring's SIZE into ASIC. Descriptor Size is fixed by design. - // - - // Write TX_RING_CSR0 register - Value = TX_RING_SIZE; - RTMP_IO_WRITE32(pAd, TX_MAX_CNT0, Value); - RTMP_IO_WRITE32(pAd, TX_MAX_CNT1, Value); - RTMP_IO_WRITE32(pAd, TX_MAX_CNT2, Value); - RTMP_IO_WRITE32(pAd, TX_MAX_CNT3, Value); - RTMP_IO_WRITE32(pAd, TX_MAX_CNT4, Value); - Value = MGMT_RING_SIZE; - RTMP_IO_WRITE32(pAd, TX_MGMTMAX_CNT, Value); - - // Write RX_RING_CSR register - Value = RX_RING_SIZE; - RTMP_IO_WRITE32(pAd, RX_MAX_CNT, Value); -#endif // RTMP_MAC_PCI // - - - // WMM parameter - csr0.word = 0; - RTMP_IO_WRITE32(pAd, WMM_TXOP0_CFG, csr0.word); - if (pAd->CommonCfg.PhyMode == PHY_11B) - { - csr0.field.Ac0Txop = 192; // AC_VI: 192*32us ~= 6ms - csr0.field.Ac1Txop = 96; // AC_VO: 96*32us ~= 3ms - } - else - { - csr0.field.Ac0Txop = 96; // AC_VI: 96*32us ~= 3ms - csr0.field.Ac1Txop = 48; // AC_VO: 48*32us ~= 1.5ms - } - RTMP_IO_WRITE32(pAd, WMM_TXOP1_CFG, csr0.word); - - -#ifdef RTMP_MAC_PCI - // 3. Set DMA global configuration except TX_DMA_EN and RX_DMA_EN bits: - i = 0; - do - { - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); - if ((GloCfg.field.TxDMABusy == 0) && (GloCfg.field.RxDMABusy == 0)) - break; - - RTMPusecDelay(1000); - i++; - }while ( i < 100); - - GloCfg.word &= 0xff0; - GloCfg.field.EnTXWriteBackDDONE =1; - RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); - - IntCfg.word = 0; - RTMP_IO_WRITE32(pAd, DELAY_INT_CFG, IntCfg.word); -#endif // RTMP_MAC_PCI // - - - // reset action - // Load firmware - // Status = NICLoadFirmware(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("<-- NICInitializeAdapter\n")); - return Status; -} - -/* - ======================================================================== - - Routine Description: - Initialize ASIC - - Arguments: - Adapter Pointer to our adapter - - Return Value: - None - - IRQL = PASSIVE_LEVEL - - Note: - - ======================================================================== -*/ -NDIS_STATUS NICInitializeAsic( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bHardReset) -{ - ULONG Index = 0; - UCHAR R0 = 0xff; - UINT32 MacCsr12 = 0, Counter = 0; -#ifdef RT30xx - UCHAR bbpreg=0; - UCHAR RFValue=0; -#endif // RT30xx // - USHORT KeyIdx; - INT i,apidx; - - DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitializeAsic\n")); - -#ifdef RTMP_MAC_PCI - RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x3); // To fix driver disable/enable hang issue when radio off - if (bHardReset == TRUE) - { - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x3); - } - else - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x1); - - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x0); - // Initialize MAC register to default value - for (Index = 0; Index < NUM_MAC_REG_PARMS; Index++) - { -#ifdef RT30xx - if ((MACRegTable[Index].Register == TX_SW_CFG0) && ( IS_RT3090(pAd) || IS_RT3390(pAd))) - { - MACRegTable[Index].Value = 0x00000400; - } -#endif // RT30xx // - RTMP_IO_WRITE32(pAd, MACRegTable[Index].Register, MACRegTable[Index].Value); - } - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - for (Index = 0; Index < NUM_STA_MAC_REG_PARMS; Index++) - { - RTMP_IO_WRITE32(pAd, STAMACRegTable[Index].Register, STAMACRegTable[Index].Value); - } - } -#endif // CONFIG_STA_SUPPORT // -#endif // RTMP_MAC_PCI // - - -#ifdef RT30xx - // Initialize RT3070 serial MAC registers which is different from RT2870 serial - if (IS_RT3090(pAd) || IS_RT3572(pAd)||IS_RT3390(pAd)) - { - RTMP_IO_WRITE32(pAd, TX_SW_CFG1, 0); - - // RT3071 version E has fixed this issue - if ((pAd->MACVersion & 0xffff) < 0x0211) - { - if (pAd->NicConfig2.field.DACTestBit == 1) - { - RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x2C); // To fix throughput drop drastically - } - else - { - RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x0F); // To fix throughput drop drastically - } - } - else - { - RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x0); - } - } - else if (IS_RT3070(pAd)) - { - if (((pAd->MACVersion & 0xffff) < 0x0201)) - { - RTMP_IO_WRITE32(pAd, TX_SW_CFG1, 0); - RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x2C); // To fix throughput drop drastically - } - else - { - RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0); - } - } -#endif // RT30xx // - - // - // Before program BBP, we need to wait BBP/RF get wake up. - // - Index = 0; - do - { - RTMP_IO_READ32(pAd, MAC_STATUS_CFG, &MacCsr12); - - if ((MacCsr12 & 0x03) == 0) // if BB.RF is stable - break; - - DBGPRINT(RT_DEBUG_TRACE, ("Check MAC_STATUS_CFG = Busy = %x\n", MacCsr12)); - RTMPusecDelay(1000); - } while (Index++ < 100); - - // The commands to firmware should be after these commands, these commands will init firmware - // PCI and USB are not the same because PCI driver needs to wait for PCI bus ready - RTMP_IO_WRITE32(pAd, H2M_BBP_AGENT, 0); // initialize BBP R/W access agent - RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CSR, 0); -#ifdef RT3090 - //2008/11/28:KH add to fix the dead rf frequency offset bug<-- - AsicSendCommandToMcu(pAd, 0x72, 0, 0, 0); - //2008/11/28:KH add to fix the dead rf frequency offset bug--> -#endif // RT3090 // - RTMPusecDelay(1000); - - // Read BBP register, make sure BBP is up and running before write new data - Index = 0; - do - { - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R0, &R0); - DBGPRINT(RT_DEBUG_TRACE, ("BBP version = %x\n", R0)); - } while ((++Index < 20) && ((R0 == 0xff) || (R0 == 0x00))); - //ASSERT(Index < 20); //this will cause BSOD on Check-build driver - - if ((R0 == 0xff) || (R0 == 0x00)) - return NDIS_STATUS_FAILURE; - - // Initialize BBP register to default value - for (Index = 0; Index < NUM_BBP_REG_PARMS; Index++) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBPRegTable[Index].Register, BBPRegTable[Index].Value); - } - -#ifdef RTMP_MAC_PCI - // TODO: shiang, check MACVersion, currently, rbus-based chip use this. - if (pAd->MACVersion == 0x28720200) - { - //UCHAR value; - ULONG value2; - - //disable MLD by Bruce 20080704 - //BBP_IO_READ8_BY_REG_ID(pAd, BBP_R105, &value); - //BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R105, value | 4); - - //Maximum PSDU length from 16K to 32K bytes - RTMP_IO_READ32(pAd, MAX_LEN_CFG, &value2); - value2 &= ~(0x3<<12); - value2 |= (0x2<<12); - RTMP_IO_WRITE32(pAd, MAX_LEN_CFG, value2); - } -#endif // RTMP_MAC_PCI // - - // for rt2860E and after, init BBP_R84 with 0x19. This is for extension channel overlapping IOT. - // RT3090 should not program BBP R84 to 0x19, otherwise TX will block. - //3070/71/72,3090,3090A( are included in RT30xx),3572,3390 - if (((pAd->MACVersion & 0xffff) != 0x0101) && !(IS_RT30xx(pAd)|| IS_RT3572(pAd) || IS_RT3390(pAd))) - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R84, 0x19); - -#ifdef RT30xx -// add by johnli, RF power sequence setup - if (IS_RT30xx(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) - { //update for RT3070/71/72/90/91/92,3572,3390. - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R79, 0x13); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R80, 0x05); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R81, 0x33); - } - - if (IS_RT3090(pAd)||IS_RT3390(pAd)) // RT309x, RT3071/72 - { - // enable DC filter - if ((pAd->MACVersion & 0xffff) >= 0x0211) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R103, 0xc0); - } - - // improve power consumption - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R138, &bbpreg); - if (pAd->Antenna.field.TxPath == 1) - { - // turn off tx DAC_1 - bbpreg = (bbpreg | 0x20); - } - - if (pAd->Antenna.field.RxPath == 1) - { - // turn off tx ADC_1 - bbpreg &= (~0x2); - } - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R138, bbpreg); - - // improve power consumption in RT3071 Ver.E - if ((pAd->MACVersion & 0xffff) >= 0x0211) - { - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R31, &bbpreg); - bbpreg &= (~0x3); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R31, bbpreg); - } - } - else if (IS_RT3070(pAd)) - { - if ((pAd->MACVersion & 0xffff) >= 0x0201) - { - // enable DC filter - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R103, 0xc0); - - // improve power consumption in RT3070 Ver.F - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R31, &bbpreg); - bbpreg &= (~0x3); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R31, bbpreg); - } - - // TX_LO1_en, RF R17 register Bit 3 to 0 - RT30xxReadRFRegister(pAd, RF_R17, &RFValue); - RFValue &= (~0x08); - // to fix rx long range issue - if (pAd->NicConfig2.field.ExternalLNAForG == 0) - { - RFValue |= 0x20; - } - // set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h - if (pAd->TxMixerGain24G >= 1) - { - RFValue &= (~0x7); // clean bit [2:0] - RFValue |= pAd->TxMixerGain24G; - } - RT30xxWriteRFRegister(pAd, RF_R17, RFValue); - } -// end johnli -#endif // RT30xx // - - if (pAd->MACVersion == 0x28600100) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x16); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x12); - } - - if (pAd->MACVersion >= RALINK_2880E_VERSION && pAd->MACVersion < RALINK_3070_VERSION) // 3*3 - { - // enlarge MAX_LEN_CFG - UINT32 csr; - RTMP_IO_READ32(pAd, MAX_LEN_CFG, &csr); - csr &= 0xFFF; - csr |= 0x2000; - RTMP_IO_WRITE32(pAd, MAX_LEN_CFG, csr); - } - - -#ifdef CONFIG_STA_SUPPORT - // Add radio off control - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (pAd->StaCfg.bRadio == FALSE) - { -// RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x00001818); - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - DBGPRINT(RT_DEBUG_TRACE, ("Set Radio Off\n")); - } - } -#endif // CONFIG_STA_SUPPORT // - - // Clear raw counters - RTMP_IO_READ32(pAd, RX_STA_CNT0, &Counter); - RTMP_IO_READ32(pAd, RX_STA_CNT1, &Counter); - RTMP_IO_READ32(pAd, RX_STA_CNT2, &Counter); - RTMP_IO_READ32(pAd, TX_STA_CNT0, &Counter); - RTMP_IO_READ32(pAd, TX_STA_CNT1, &Counter); - RTMP_IO_READ32(pAd, TX_STA_CNT2, &Counter); - - // ASIC will keep garbage value after boot - // Clear all shared key table when initial - // This routine can be ignored in radio-ON/OFF operation. - if (bHardReset) - { - for (KeyIdx = 0; KeyIdx < 4; KeyIdx++) - { - RTMP_IO_WRITE32(pAd, SHARED_KEY_MODE_BASE + 4*KeyIdx, 0); - } - - // Clear all pairwise key table when initial - for (KeyIdx = 0; KeyIdx < 256; KeyIdx++) - { - RTMP_IO_WRITE32(pAd, MAC_WCID_ATTRIBUTE_BASE + (KeyIdx * HW_WCID_ATTRI_SIZE), 1); - } - } - - // assert HOST ready bit -// RTMP_IO_WRITE32(pAd, MAC_CSR1, 0x0); // 2004-09-14 asked by Mark -// RTMP_IO_WRITE32(pAd, MAC_CSR1, 0x4); - - // It isn't necessary to clear this space when not hard reset. - if (bHardReset == TRUE) - { - // clear all on-chip BEACON frame space - for (apidx = 0; apidx < HW_BEACON_MAX_COUNT; apidx++) - { - for (i = 0; i < HW_BEACON_OFFSET>>2; i+=4) - RTMP_IO_WRITE32(pAd, pAd->BeaconOffset[apidx] + i, 0x00); - } - } - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // for rt2860E and after, init TXOP_CTRL_CFG with 0x583f. This is for extension channel overlapping IOT. - if ((pAd->MACVersion&0xffff) != 0x0101) - RTMP_IO_WRITE32(pAd, TXOP_CTRL_CFG, 0x583f); - } -#endif // CONFIG_STA_SUPPORT // - -#ifdef RT30xx -#ifdef NEW_FW - if (IS_RT3070(pAd) || IS_RT3572(pAd)||IS_RT3390(pAd)||IS_RT3090(pAd)) - { - // send 0x36 mcu command after 0x72 for RT3xxx to fix Radio-Off current leakage issue - RTMPusecDelay(200); - if (pAd->buseEfuse) - AsicSendCommandToMcu(pAd, 0x36, 0xff, 0xff, 0); - else - AsicSendCommandToMcu(pAd, 0x36, 0xff, 0xff, 0x04); - RTMPusecDelay(10); - } -#endif // NEW_FW // -#endif // RT30xx // - - DBGPRINT(RT_DEBUG_TRACE, ("<-- NICInitializeAsic\n")); - return NDIS_STATUS_SUCCESS; -} - -/* - ======================================================================== - - Routine Description: - Reset NIC Asics - - Arguments: - Adapter Pointer to our adapter - - Return Value: - None - - IRQL = PASSIVE_LEVEL - - Note: - Reset NIC to initial state AS IS system boot up time. - - ======================================================================== -*/ -VOID NICIssueReset( - IN PRTMP_ADAPTER pAd) -{ - UINT32 Value = 0; - DBGPRINT(RT_DEBUG_TRACE, ("--> NICIssueReset\n")); - - // Abort Tx, prevent ASIC from writing to Host memory - //RTMP_IO_WRITE32(pAd, TX_CNTL_CSR, 0x001f0000); - - // Disable Rx, register value supposed will remain after reset - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value &= (0xfffffff3); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - - // Issue reset and clear from reset state - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x03); // 2004-09-17 change from 0x01 - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x00); - - DBGPRINT(RT_DEBUG_TRACE, ("<-- NICIssueReset\n")); -} - -/* - ======================================================================== - - Routine Description: - Check ASIC registers and find any reason the system might hang - - Arguments: - Adapter Pointer to our adapter - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - ======================================================================== -*/ -BOOLEAN NICCheckForHang( - IN PRTMP_ADAPTER pAd) -{ - return (FALSE); -} - -VOID NICUpdateFifoStaCounters( - IN PRTMP_ADAPTER pAd) -{ - TX_STA_FIFO_STRUC StaFifo; - MAC_TABLE_ENTRY *pEntry; - UCHAR i = 0; - UCHAR pid = 0, wcid = 0; - CHAR reTry; - UCHAR succMCS; - -#ifdef RALINK_ATE - /* Nothing to do in ATE mode */ - if (ATE_ON(pAd)) - return; -#endif // RALINK_ATE // - - do - { - RTMP_IO_READ32(pAd, TX_STA_FIFO, &StaFifo.word); - - if (StaFifo.field.bValid == 0) - break; - - wcid = (UCHAR)StaFifo.field.wcid; - - - /* ignore NoACK and MGMT frame use 0xFF as WCID */ - if ((StaFifo.field.TxAckRequired == 0) || (wcid >= MAX_LEN_OF_MAC_TABLE)) - { - i++; - continue; - } - - /* PID store Tx MCS Rate */ - pid = (UCHAR)StaFifo.field.PidType; - - pEntry = &pAd->MacTab.Content[wcid]; - - pEntry->DebugFIFOCount++; - -#ifdef DOT11_N_SUPPORT - if (StaFifo.field.TxBF) // 3*3 - pEntry->TxBFCount++; -#endif // DOT11_N_SUPPORT // - -#ifdef UAPSD_AP_SUPPORT - UAPSD_SP_AUE_Handle(pAd, pEntry, StaFifo.field.TxSuccess); -#endif // UAPSD_AP_SUPPORT // - - if (!StaFifo.field.TxSuccess) - { - pEntry->FIFOCount++; - pEntry->OneSecTxFailCount++; - - if (pEntry->FIFOCount >= 1) - { - DBGPRINT(RT_DEBUG_TRACE, ("#")); -#ifdef DOT11_N_SUPPORT - pEntry->NoBADataCountDown = 64; -#endif // DOT11_N_SUPPORT // - - if(pEntry->PsMode == PWR_ACTIVE) - { -#ifdef DOT11_N_SUPPORT - int tid; - for (tid=0; tidAid, tid, FALSE, FALSE); - } -#endif // DOT11_N_SUPPORT // - - // Update the continuous transmission counter except PS mode - pEntry->ContinueTxFailCnt++; - -#ifdef WDS_SUPPORT - // fix WDS Jam issue - if((pEntry->ValidAsWDS == TRUE) - && (pEntry->LockEntryTx == FALSE) - && (pEntry->ContinueTxFailCnt >= pAd->ApCfg.EntryLifeCheck)) - { - DBGPRINT(RT_DEBUG_TRACE, ("Entry %02x:%02x:%02x:%02x:%02x:%02x Blocked!! (Fail Cnt = %d)\n", - pEntry->Addr[0],pEntry->Addr[1],pEntry->Addr[2],pEntry->Addr[3], - pEntry->Addr[4],pEntry->Addr[5],pEntry->ContinueTxFailCnt )); - - pEntry->LockEntryTx = TRUE; - } -#endif // WDS_SUPPORT // - } - else - { - // Clear the FIFOCount when sta in Power Save mode. Basically we assume - // this tx error happened due to sta just go to sleep. - pEntry->FIFOCount = 0; - pEntry->ContinueTxFailCnt = 0; - } - //pEntry->FIFOCount = 0; - } - //pEntry->bSendBAR = TRUE; - } - else - { -#ifdef DOT11_N_SUPPORT - if ((pEntry->PsMode != PWR_SAVE) && (pEntry->NoBADataCountDown > 0)) - { - pEntry->NoBADataCountDown--; - if (pEntry->NoBADataCountDown==0) - { - DBGPRINT(RT_DEBUG_TRACE, ("@\n")); - } - } -#endif // DOT11_N_SUPPORT // - pEntry->FIFOCount = 0; - pEntry->OneSecTxNoRetryOkCount++; - // update NoDataIdleCount when sucessful send packet to STA. - pEntry->NoDataIdleCount = 0; - pEntry->ContinueTxFailCnt = 0; -#ifdef WDS_SUPPORT - pEntry->LockEntryTx = FALSE; -#endif // WDS_SUPPORT // - } - - succMCS = StaFifo.field.SuccessRate & 0x7F; - - reTry = pid - succMCS; - - if (StaFifo.field.TxSuccess) - { - pEntry->TXMCSExpected[pid]++; - if (pid == succMCS) - { - pEntry->TXMCSSuccessful[pid]++; - } - else - { - pEntry->TXMCSAutoFallBack[pid][succMCS]++; - } - } - else - { - pEntry->TXMCSFailed[pid]++; - } - - if (reTry > 0) - { - if ((pid >= 12) && succMCS <=7) - { - reTry -= 4; - } - pEntry->OneSecTxRetryOkCount += reTry; - } - - i++; - // ASIC store 16 stack - } while ( i < (TX_RING_SIZE<<1) ); - -} - -/* - ======================================================================== - - Routine Description: - Read statistical counters from hardware registers and record them - in software variables for later on query - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - ======================================================================== -*/ -VOID NICUpdateRawCounters( - IN PRTMP_ADAPTER pAd) -{ - UINT32 OldValue;//, Value2; - //ULONG PageSum, OneSecTransmitCount; - //ULONG TxErrorRatio, Retry, Fail; - RX_STA_CNT0_STRUC RxStaCnt0; - RX_STA_CNT1_STRUC RxStaCnt1; - RX_STA_CNT2_STRUC RxStaCnt2; - TX_STA_CNT0_STRUC TxStaCnt0; - TX_STA_CNT1_STRUC StaTx1; - TX_STA_CNT2_STRUC StaTx2; - TX_AGG_CNT_STRUC TxAggCnt; - TX_AGG_CNT0_STRUC TxAggCnt0; - TX_AGG_CNT1_STRUC TxAggCnt1; - TX_AGG_CNT2_STRUC TxAggCnt2; - TX_AGG_CNT3_STRUC TxAggCnt3; - TX_AGG_CNT4_STRUC TxAggCnt4; - TX_AGG_CNT5_STRUC TxAggCnt5; - TX_AGG_CNT6_STRUC TxAggCnt6; - TX_AGG_CNT7_STRUC TxAggCnt7; - COUNTER_RALINK *pRalinkCounters; - - - pRalinkCounters = &pAd->RalinkCounters; - - RTMP_IO_READ32(pAd, RX_STA_CNT0, &RxStaCnt0.word); - RTMP_IO_READ32(pAd, RX_STA_CNT2, &RxStaCnt2.word); - - { - RTMP_IO_READ32(pAd, RX_STA_CNT1, &RxStaCnt1.word); - // Update RX PLCP error counter - pAd->PrivateInfo.PhyRxErrCnt += RxStaCnt1.field.PlcpErr; - // Update False CCA counter - pAd->RalinkCounters.OneSecFalseCCACnt += RxStaCnt1.field.FalseCca; - } - - // Update FCS counters - OldValue= pAd->WlanCounters.FCSErrorCount.u.LowPart; - pAd->WlanCounters.FCSErrorCount.u.LowPart += (RxStaCnt0.field.CrcErr); // >> 7); - if (pAd->WlanCounters.FCSErrorCount.u.LowPart < OldValue) - pAd->WlanCounters.FCSErrorCount.u.HighPart++; - - // Add FCS error count to private counters - pRalinkCounters->OneSecRxFcsErrCnt += RxStaCnt0.field.CrcErr; - OldValue = pRalinkCounters->RealFcsErrCount.u.LowPart; - pRalinkCounters->RealFcsErrCount.u.LowPart += RxStaCnt0.field.CrcErr; - if (pRalinkCounters->RealFcsErrCount.u.LowPart < OldValue) - pRalinkCounters->RealFcsErrCount.u.HighPart++; - - // Update Duplicate Rcv check - pRalinkCounters->DuplicateRcv += RxStaCnt2.field.RxDupliCount; - pAd->WlanCounters.FrameDuplicateCount.u.LowPart += RxStaCnt2.field.RxDupliCount; - // Update RX Overflow counter - pAd->Counters8023.RxNoBuffer += (RxStaCnt2.field.RxFifoOverflowCount); - - //pAd->RalinkCounters.RxCount = 0; - - - //if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED) || - // (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED) && (pAd->MacTab.Size != 1))) - if (!pAd->bUpdateBcnCntDone) - { - // Update BEACON sent count - RTMP_IO_READ32(pAd, TX_STA_CNT0, &TxStaCnt0.word); - RTMP_IO_READ32(pAd, TX_STA_CNT1, &StaTx1.word); - RTMP_IO_READ32(pAd, TX_STA_CNT2, &StaTx2.word); - pRalinkCounters->OneSecBeaconSentCnt += TxStaCnt0.field.TxBeaconCount; - pRalinkCounters->OneSecTxRetryOkCount += StaTx1.field.TxRetransmit; - pRalinkCounters->OneSecTxNoRetryOkCount += StaTx1.field.TxSuccess; - pRalinkCounters->OneSecTxFailCount += TxStaCnt0.field.TxFailCount; - pAd->WlanCounters.TransmittedFragmentCount.u.LowPart += StaTx1.field.TxSuccess; - pAd->WlanCounters.RetryCount.u.LowPart += StaTx1.field.TxRetransmit; - pAd->WlanCounters.FailedCount.u.LowPart += TxStaCnt0.field.TxFailCount; - } - - - //if (pAd->bStaFifoTest == TRUE) - { - RTMP_IO_READ32(pAd, TX_AGG_CNT, &TxAggCnt.word); - RTMP_IO_READ32(pAd, TX_AGG_CNT0, &TxAggCnt0.word); - RTMP_IO_READ32(pAd, TX_AGG_CNT1, &TxAggCnt1.word); - RTMP_IO_READ32(pAd, TX_AGG_CNT2, &TxAggCnt2.word); - RTMP_IO_READ32(pAd, TX_AGG_CNT3, &TxAggCnt3.word); - RTMP_IO_READ32(pAd, TX_AGG_CNT4, &TxAggCnt4.word); - RTMP_IO_READ32(pAd, TX_AGG_CNT5, &TxAggCnt5.word); - RTMP_IO_READ32(pAd, TX_AGG_CNT6, &TxAggCnt6.word); - RTMP_IO_READ32(pAd, TX_AGG_CNT7, &TxAggCnt7.word); - pRalinkCounters->TxAggCount += TxAggCnt.field.AggTxCount; - pRalinkCounters->TxNonAggCount += TxAggCnt.field.NonAggTxCount; - pRalinkCounters->TxAgg1MPDUCount += TxAggCnt0.field.AggSize1Count; - pRalinkCounters->TxAgg2MPDUCount += TxAggCnt0.field.AggSize2Count; - - pRalinkCounters->TxAgg3MPDUCount += TxAggCnt1.field.AggSize3Count; - pRalinkCounters->TxAgg4MPDUCount += TxAggCnt1.field.AggSize4Count; - pRalinkCounters->TxAgg5MPDUCount += TxAggCnt2.field.AggSize5Count; - pRalinkCounters->TxAgg6MPDUCount += TxAggCnt2.field.AggSize6Count; - - pRalinkCounters->TxAgg7MPDUCount += TxAggCnt3.field.AggSize7Count; - pRalinkCounters->TxAgg8MPDUCount += TxAggCnt3.field.AggSize8Count; - pRalinkCounters->TxAgg9MPDUCount += TxAggCnt4.field.AggSize9Count; - pRalinkCounters->TxAgg10MPDUCount += TxAggCnt4.field.AggSize10Count; - - pRalinkCounters->TxAgg11MPDUCount += TxAggCnt5.field.AggSize11Count; - pRalinkCounters->TxAgg12MPDUCount += TxAggCnt5.field.AggSize12Count; - pRalinkCounters->TxAgg13MPDUCount += TxAggCnt6.field.AggSize13Count; - pRalinkCounters->TxAgg14MPDUCount += TxAggCnt6.field.AggSize14Count; - - pRalinkCounters->TxAgg15MPDUCount += TxAggCnt7.field.AggSize15Count; - pRalinkCounters->TxAgg16MPDUCount += TxAggCnt7.field.AggSize16Count; - - // Calculate the transmitted A-MPDU count - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += TxAggCnt0.field.AggSize1Count; - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt0.field.AggSize2Count / 2); - - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt1.field.AggSize3Count / 3); - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt1.field.AggSize4Count / 4); - - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt2.field.AggSize5Count / 5); - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt2.field.AggSize6Count / 6); - - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt3.field.AggSize7Count / 7); - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt3.field.AggSize8Count / 8); - - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt4.field.AggSize9Count / 9); - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt4.field.AggSize10Count / 10); - - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt5.field.AggSize11Count / 11); - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt5.field.AggSize12Count / 12); - - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt6.field.AggSize13Count / 13); - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt6.field.AggSize14Count / 14); - - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt7.field.AggSize15Count / 15); - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt7.field.AggSize16Count / 16); - } - -#ifdef DBG_DIAGNOSE - { - RtmpDiagStruct *pDiag; - UCHAR ArrayCurIdx, i; - - pDiag = &pAd->DiagStruct; - ArrayCurIdx = pDiag->ArrayCurIdx; - - if (pDiag->inited == 0) - { - NdisZeroMemory(pDiag, sizeof(struct _RtmpDiagStrcut_)); - pDiag->ArrayStartIdx = pDiag->ArrayCurIdx = 0; - pDiag->inited = 1; - } - else - { - // Tx - pDiag->TxFailCnt[ArrayCurIdx] = TxStaCnt0.field.TxFailCount; - pDiag->TxAggCnt[ArrayCurIdx] = TxAggCnt.field.AggTxCount; - pDiag->TxNonAggCnt[ArrayCurIdx] = TxAggCnt.field.NonAggTxCount; - pDiag->TxAMPDUCnt[ArrayCurIdx][0] = TxAggCnt0.field.AggSize1Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][1] = TxAggCnt0.field.AggSize2Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][2] = TxAggCnt1.field.AggSize3Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][3] = TxAggCnt1.field.AggSize4Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][4] = TxAggCnt2.field.AggSize5Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][5] = TxAggCnt2.field.AggSize6Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][6] = TxAggCnt3.field.AggSize7Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][7] = TxAggCnt3.field.AggSize8Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][8] = TxAggCnt4.field.AggSize9Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][9] = TxAggCnt4.field.AggSize10Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][10] = TxAggCnt5.field.AggSize11Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][11] = TxAggCnt5.field.AggSize12Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][12] = TxAggCnt6.field.AggSize13Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][13] = TxAggCnt6.field.AggSize14Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][14] = TxAggCnt7.field.AggSize15Count; - pDiag->TxAMPDUCnt[ArrayCurIdx][15] = TxAggCnt7.field.AggSize16Count; - - pDiag->RxCrcErrCnt[ArrayCurIdx] = RxStaCnt0.field.CrcErr; - - INC_RING_INDEX(pDiag->ArrayCurIdx, DIAGNOSE_TIME); - ArrayCurIdx = pDiag->ArrayCurIdx; - for (i =0; i < 9; i++) - { - pDiag->TxDescCnt[ArrayCurIdx][i]= 0; - pDiag->TxSWQueCnt[ArrayCurIdx][i] =0; - pDiag->TxMcsCnt[ArrayCurIdx][i] = 0; - pDiag->RxMcsCnt[ArrayCurIdx][i] = 0; - } - pDiag->TxDataCnt[ArrayCurIdx] = 0; - pDiag->TxFailCnt[ArrayCurIdx] = 0; - pDiag->RxDataCnt[ArrayCurIdx] = 0; - pDiag->RxCrcErrCnt[ArrayCurIdx] = 0; -// for (i = 9; i < 16; i++) - for (i = 9; i < 24; i++) // 3*3 - { - pDiag->TxDescCnt[ArrayCurIdx][i] = 0; - pDiag->TxMcsCnt[ArrayCurIdx][i] = 0; - pDiag->RxMcsCnt[ArrayCurIdx][i] = 0; -} - - if (pDiag->ArrayCurIdx == pDiag->ArrayStartIdx) - INC_RING_INDEX(pDiag->ArrayStartIdx, DIAGNOSE_TIME); - } - - } -#endif // DBG_DIAGNOSE // - - -} - - -/* - ======================================================================== - - Routine Description: - Reset NIC from error - - Arguments: - Adapter Pointer to our adapter - - Return Value: - None - - IRQL = PASSIVE_LEVEL - - Note: - Reset NIC from error state - - ======================================================================== -*/ -VOID NICResetFromError( - IN PRTMP_ADAPTER pAd) -{ - // Reset BBP (according to alex, reset ASIC will force reset BBP - // Therefore, skip the reset BBP - // RTMP_IO_WRITE32(pAd, MAC_CSR1, 0x2); - - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x1); - // Remove ASIC from reset state - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x0); - - NICInitializeAdapter(pAd, FALSE); - NICInitAsicFromEEPROM(pAd); - - // Switch to current channel, since during reset process, the connection should remains on. - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); -} - - -NDIS_STATUS NICLoadFirmware( - IN PRTMP_ADAPTER pAd) -{ - NDIS_STATUS status = NDIS_STATUS_SUCCESS; - if (pAd->chipOps.loadFirmware) - status = pAd->chipOps.loadFirmware(pAd); - - return status; -} - - -/* - ======================================================================== - - Routine Description: - erase 8051 firmware image in MAC ASIC - - Arguments: - Adapter Pointer to our adapter - - IRQL = PASSIVE_LEVEL - - ======================================================================== -*/ -VOID NICEraseFirmware( - IN PRTMP_ADAPTER pAd) -{ - if (pAd->chipOps.eraseFirmware) - pAd->chipOps.eraseFirmware(pAd); - -}/* End of NICEraseFirmware */ - - -/* - ======================================================================== - - Routine Description: - Load Tx rate switching parameters - - Arguments: - Adapter Pointer to our adapter - - Return Value: - NDIS_STATUS_SUCCESS firmware image load ok - NDIS_STATUS_FAILURE image not found - - IRQL = PASSIVE_LEVEL - - Rate Table Format: - 1. (B0: Valid Item number) (B1:Initial item from zero) - 2. Item Number(Dec) Mode(Hex) Current MCS(Dec) TrainUp(Dec) TrainDown(Dec) - - ======================================================================== -*/ -NDIS_STATUS NICLoadRateSwitchingParams( - IN PRTMP_ADAPTER pAd) -{ - return NDIS_STATUS_SUCCESS; -} - - -/* - ======================================================================== - - Routine Description: - Compare two memory block - - Arguments: - pSrc1 Pointer to first memory address - pSrc2 Pointer to second memory address - - Return Value: - 0: memory is equal - 1: pSrc1 memory is larger - 2: pSrc2 memory is larger - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -ULONG RTMPCompareMemory( - IN PVOID pSrc1, - IN PVOID pSrc2, - IN ULONG Length) -{ - PUCHAR pMem1; - PUCHAR pMem2; - ULONG Index = 0; - - pMem1 = (PUCHAR) pSrc1; - pMem2 = (PUCHAR) pSrc2; - - for (Index = 0; Index < Length; Index++) - { - if (pMem1[Index] > pMem2[Index]) - return (1); - else if (pMem1[Index] < pMem2[Index]) - return (2); - } - - // Equal - return (0); -} - - -/* - ======================================================================== - - Routine Description: - Zero out memory block - - Arguments: - pSrc1 Pointer to memory address - Length Size - - Return Value: - None - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPZeroMemory( - IN PVOID pSrc, - IN ULONG Length) -{ - PUCHAR pMem; - ULONG Index = 0; - - pMem = (PUCHAR) pSrc; - - for (Index = 0; Index < Length; Index++) - { - pMem[Index] = 0x00; - } -} - - -/* - ======================================================================== - - Routine Description: - Copy data from memory block 1 to memory block 2 - - Arguments: - pDest Pointer to destination memory address - pSrc Pointer to source memory address - Length Copy size - - Return Value: - None - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPMoveMemory( - OUT PVOID pDest, - IN PVOID pSrc, - IN ULONG Length) -{ - PUCHAR pMem1; - PUCHAR pMem2; - UINT Index; - - ASSERT((Length==0) || (pDest && pSrc)); - - pMem1 = (PUCHAR) pDest; - pMem2 = (PUCHAR) pSrc; - - for (Index = 0; Index < Length; Index++) - { - pMem1[Index] = pMem2[Index]; - } -} - - -/* - ======================================================================== - - Routine Description: - Initialize port configuration structure - - Arguments: - Adapter Pointer to our adapter - - Return Value: - None - - IRQL = PASSIVE_LEVEL - - Note: - - ======================================================================== -*/ -VOID UserCfgInit( - IN PRTMP_ADAPTER pAd) -{ -// EDCA_PARM DefaultEdcaParm; - UINT key_index, bss_index; - - DBGPRINT(RT_DEBUG_TRACE, ("--> UserCfgInit\n")); - - // - // part I. intialize common configuration - // - - for(key_index=0; key_indexSharedKey[bss_index][key_index].KeyLen = 0; - pAd->SharedKey[bss_index][key_index].CipherAlg = CIPHER_NONE; - } - } - - pAd->EepromAccess = FALSE; - - pAd->Antenna.word = 0; - pAd->CommonCfg.BBPCurrentBW = BW_20; - - pAd->LedCntl.word = 0; -#ifdef RTMP_MAC_PCI - pAd->LedIndicatorStrength = 0; - pAd->RLnkCtrlOffset = 0; - pAd->HostLnkCtrlOffset = 0; -#ifdef CONFIG_STA_SUPPORT - pAd->StaCfg.PSControl.field.EnableNewPS=TRUE; - pAd->CheckDmaBusyCount = 0; -#endif // CONFIG_STA_SUPPORT // -#endif // RTMP_MAC_PCI // - - pAd->bAutoTxAgcA = FALSE; // Default is OFF - pAd->bAutoTxAgcG = FALSE; // Default is OFF - pAd->RfIcType = RFIC_2820; - - // Init timer for reset complete event - pAd->CommonCfg.CentralChannel = 1; - pAd->bForcePrintTX = FALSE; - pAd->bForcePrintRX = FALSE; - pAd->bStaFifoTest = FALSE; - pAd->bProtectionTest = FALSE; - /* - pAd->bHCCATest = FALSE; - pAd->bGenOneHCCA = FALSE; - */ - pAd->CommonCfg.Dsifs = 10; // in units of usec - pAd->CommonCfg.TxPower = 100; //mW - pAd->CommonCfg.TxPowerPercentage = 0xffffffff; // AUTO - pAd->CommonCfg.TxPowerDefault = 0xffffffff; // AUTO - pAd->CommonCfg.TxPreamble = Rt802_11PreambleAuto; // use Long preamble on TX by defaut - pAd->CommonCfg.bUseZeroToDisableFragment = FALSE; - pAd->CommonCfg.RtsThreshold = 2347; - pAd->CommonCfg.FragmentThreshold = 2346; - pAd->CommonCfg.UseBGProtection = 0; // 0: AUTO - pAd->CommonCfg.bEnableTxBurst = TRUE; //0; - pAd->CommonCfg.PhyMode = 0xff; // unknown - pAd->CommonCfg.BandState = UNKNOWN_BAND; - pAd->CommonCfg.RadarDetect.CSPeriod = 10; - pAd->CommonCfg.RadarDetect.CSCount = 0; - pAd->CommonCfg.RadarDetect.RDMode = RD_NORMAL_MODE; - - - -#ifdef TONE_RADAR_DETECT_SUPPORT -#ifdef CARRIER_DETECTION_SUPPORT - pAd->CommonCfg.CarrierDetect.delta = CARRIER_DETECT_DELTA; - pAd->CommonCfg.CarrierDetect.div_flag = CARRIER_DETECT_DIV_FLAG; - pAd->CommonCfg.CarrierDetect.criteria = CARRIER_DETECT_CRITIRIA; -#ifdef RT3090 - if(IS_RT3090A(pAd)) - pAd->CommonCfg.CarrierDetect.threshold = CARRIER_DETECT_THRESHOLD_3090A; - else -#endif // RT3090 // - pAd->CommonCfg.CarrierDetect.threshold = CARRIER_DETECT_THRESHOLD; -#endif // CARRIER_DETECTION_SUPPORT // -#endif // TONE_RADAR_DETECT_SUPPORT // - - pAd->CommonCfg.RadarDetect.ChMovingTime = 65; -#ifdef MERGE_ARCH_TEAM - pAd->CommonCfg.RadarDetect.LongPulseRadarTh = 2; - pAd->CommonCfg.RadarDetect.AvgRssiReq = -75; -#else // original rt28xx source code - pAd->CommonCfg.RadarDetect.LongPulseRadarTh = 3; -#endif // MERGE_ARCH_TEAM // - pAd->CommonCfg.bAPSDCapable = FALSE; - pAd->CommonCfg.bNeedSendTriggerFrame = FALSE; - pAd->CommonCfg.TriggerTimerCount = 0; - pAd->CommonCfg.bAPSDForcePowerSave = FALSE; - pAd->CommonCfg.bCountryFlag = FALSE; - pAd->CommonCfg.TxStream = 0; - pAd->CommonCfg.RxStream = 0; - - NdisZeroMemory(&pAd->BeaconTxWI, sizeof(pAd->BeaconTxWI)); - -#ifdef DOT11_N_SUPPORT - NdisZeroMemory(&pAd->CommonCfg.HtCapability, sizeof(pAd->CommonCfg.HtCapability)); - pAd->HTCEnable = FALSE; - pAd->bBroadComHT = FALSE; - pAd->CommonCfg.bRdg = FALSE; - -#ifdef DOT11N_DRAFT3 - pAd->CommonCfg.Dot11OBssScanPassiveDwell = dot11OBSSScanPassiveDwell; // Unit : TU. 5~1000 - pAd->CommonCfg.Dot11OBssScanActiveDwell = dot11OBSSScanActiveDwell; // Unit : TU. 10~1000 - pAd->CommonCfg.Dot11BssWidthTriggerScanInt = dot11BSSWidthTriggerScanInterval; // Unit : Second - pAd->CommonCfg.Dot11OBssScanPassiveTotalPerChannel = dot11OBSSScanPassiveTotalPerChannel; // Unit : TU. 200~10000 - pAd->CommonCfg.Dot11OBssScanActiveTotalPerChannel = dot11OBSSScanActiveTotalPerChannel; // Unit : TU. 20~10000 - pAd->CommonCfg.Dot11BssWidthChanTranDelayFactor = dot11BSSWidthChannelTransactionDelayFactor; - pAd->CommonCfg.Dot11OBssScanActivityThre = dot11BSSScanActivityThreshold; // Unit : percentage - pAd->CommonCfg.Dot11BssWidthChanTranDelay = (pAd->CommonCfg.Dot11BssWidthTriggerScanInt * pAd->CommonCfg.Dot11BssWidthChanTranDelayFactor); -#endif // DOT11N_DRAFT3 // - - NdisZeroMemory(&pAd->CommonCfg.AddHTInfo, sizeof(pAd->CommonCfg.AddHTInfo)); - pAd->CommonCfg.BACapability.field.MMPSmode = MMPS_ENABLE; - pAd->CommonCfg.BACapability.field.MpduDensity = 0; - pAd->CommonCfg.BACapability.field.Policy = IMMED_BA; - pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64; //32; - pAd->CommonCfg.BACapability.field.TxBAWinLimit = 64; //32; - DBGPRINT(RT_DEBUG_TRACE, ("--> UserCfgInit. BACapability = 0x%x\n", pAd->CommonCfg.BACapability.word)); - - pAd->CommonCfg.BACapability.field.AutoBA = FALSE; - BATableInit(pAd, &pAd->BATable); - - pAd->CommonCfg.bExtChannelSwitchAnnouncement = 1; - pAd->CommonCfg.bHTProtect = 1; - pAd->CommonCfg.bMIMOPSEnable = TRUE; - //2008/11/05:KH add to support Antenna power-saving of AP<-- - pAd->CommonCfg.bGreenAPEnable=FALSE; - pAd->CommonCfg.bBlockAntDivforGreenAP=FALSE; - //2008/11/05:KH add to support Antenna power-saving of AP--> - pAd->CommonCfg.bBADecline = FALSE; - pAd->CommonCfg.bDisableReordering = FALSE; - - if (pAd->MACVersion == 0x28720200) - { - pAd->CommonCfg.TxBASize = 13; //by Jerry recommend - }else{ - pAd->CommonCfg.TxBASize = 7; - } - - pAd->CommonCfg.REGBACapability.word = pAd->CommonCfg.BACapability.word; -#endif // DOT11_N_SUPPORT // - - //pAd->CommonCfg.HTPhyMode.field.BW = BW_20; - //pAd->CommonCfg.HTPhyMode.field.MCS = MCS_AUTO; - //pAd->CommonCfg.HTPhyMode.field.ShortGI = GI_800; - //pAd->CommonCfg.HTPhyMode.field.STBC = STBC_NONE; - pAd->CommonCfg.TxRate = RATE_6; - - pAd->CommonCfg.MlmeTransmit.field.MCS = MCS_RATE_6; - pAd->CommonCfg.MlmeTransmit.field.BW = BW_20; - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; - - pAd->CommonCfg.BeaconPeriod = 100; // in mSec - - - // - // part II. intialize STA specific configuration - // -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - RX_FILTER_SET_FLAG(pAd, fRX_FILTER_ACCEPT_DIRECT); - RX_FILTER_CLEAR_FLAG(pAd, fRX_FILTER_ACCEPT_MULTICAST); - RX_FILTER_SET_FLAG(pAd, fRX_FILTER_ACCEPT_BROADCAST); - RX_FILTER_SET_FLAG(pAd, fRX_FILTER_ACCEPT_ALL_MULTICAST); - - pAd->StaCfg.Psm = PWR_ACTIVE; - - pAd->StaCfg.OrigWepStatus = Ndis802_11EncryptionDisabled; - pAd->StaCfg.PairCipher = Ndis802_11EncryptionDisabled; - pAd->StaCfg.GroupCipher = Ndis802_11EncryptionDisabled; - pAd->StaCfg.bMixCipher = FALSE; - pAd->StaCfg.DefaultKeyId = 0; - - // 802.1x port control - pAd->StaCfg.PrivacyFilter = Ndis802_11PrivFilter8021xWEP; - pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - pAd->StaCfg.LastMicErrorTime = 0; - pAd->StaCfg.MicErrCnt = 0; - pAd->StaCfg.bBlockAssoc = FALSE; - pAd->StaCfg.WpaState = SS_NOTUSE; - - pAd->CommonCfg.NdisRadioStateOff = FALSE; // New to support microsoft disable radio with OID command - - pAd->StaCfg.RssiTrigger = 0; - NdisZeroMemory(&pAd->StaCfg.RssiSample, sizeof(RSSI_SAMPLE)); - pAd->StaCfg.RssiTriggerMode = RSSI_TRIGGERED_UPON_BELOW_THRESHOLD; - pAd->StaCfg.AtimWin = 0; - pAd->StaCfg.DefaultListenCount = 3;//default listen count; - pAd->StaCfg.BssType = BSS_INFRA; // BSS_INFRA or BSS_ADHOC or BSS_MONITOR - pAd->StaCfg.bScanReqIsFromWebUI = FALSE; - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_WAKEUP_NOW); - - pAd->StaCfg.bAutoTxRateSwitch = TRUE; - pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; - } - -#ifdef EXT_BUILD_CHANNEL_LIST - pAd->StaCfg.IEEE80211dClientMode = Rt802_11_D_None; -#endif // EXT_BUILD_CHANNEL_LIST // -#ifdef PCIE_PS_SUPPORT -pAd->brt30xxBanMcuCmd = FALSE; -pAd->b3090ESpecialChip = FALSE; -//KH Debug:the following must be removed -pAd->StaCfg.PSControl.field.rt30xxPowerMode=3; -pAd->StaCfg.PSControl.field.rt30xxForceASPMTest=0; -pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM=1; -#endif // PCIE_PS_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - - // global variables mXXXX used in MAC protocol state machines - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_ADHOC_ON); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_INFRA_ON); - - // PHY specification - pAd->CommonCfg.PhyMode = PHY_11BG_MIXED; // default PHY mode - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); // CCK use LONG preamble - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // user desired power mode - pAd->StaCfg.WindowsPowerMode = Ndis802_11PowerModeCAM; - pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeCAM; - pAd->StaCfg.bWindowsACCAMEnable = FALSE; - - RTMPInitTimer(pAd, &pAd->StaCfg.StaQuickResponeForRateUpTimer, GET_TIMER_FUNCTION(StaQuickResponeForRateUpExec), pAd, FALSE); - pAd->StaCfg.StaQuickResponeForRateUpTimerRunning = FALSE; - - // Patch for Ndtest - pAd->StaCfg.ScanCnt = 0; - - pAd->StaCfg.bHwRadio = TRUE; // Default Hardware Radio status is On - pAd->StaCfg.bSwRadio = TRUE; // Default Software Radio status is On - pAd->StaCfg.bRadio = TRUE; // bHwRadio && bSwRadio - pAd->StaCfg.bHardwareRadio = FALSE; // Default is OFF - pAd->StaCfg.bShowHiddenSSID = FALSE; // Default no show - - // Nitro mode control - pAd->StaCfg.bAutoReconnect = TRUE; - - // Save the init time as last scan time, the system should do scan after 2 seconds. - // This patch is for driver wake up from standby mode, system will do scan right away. - NdisGetSystemUpTime(&pAd->StaCfg.LastScanTime); - if (pAd->StaCfg.LastScanTime > 10 * OS_HZ) - pAd->StaCfg.LastScanTime -= (10 * OS_HZ); - - NdisZeroMemory(pAd->nickname, IW_ESSID_MAX_SIZE+1); -#ifdef RTMP_MAC_PCI - sprintf((PSTRING) pAd->nickname, "RT2860STA"); -#endif // RTMP_MAC_PCI // - RTMPInitTimer(pAd, &pAd->StaCfg.WpaDisassocAndBlockAssocTimer, GET_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc), pAd, FALSE); -#ifdef WPA_SUPPLICANT_SUPPORT - pAd->StaCfg.IEEE8021X = FALSE; - pAd->StaCfg.IEEE8021x_required_keys = FALSE; - pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_DISABLE; - pAd->StaCfg.bRSN_IE_FromWpaSupplicant = FALSE; -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT - pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_ENABLE; -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // -#endif // WPA_SUPPLICANT_SUPPORT // - - NdisZeroMemory(pAd->StaCfg.ReplayCounter, 8); - - - pAd->StaCfg.bAutoConnectByBssid = FALSE; - pAd->StaCfg.BeaconLostTime = BEACON_LOST_TIME; - NdisZeroMemory(pAd->StaCfg.WpaPassPhrase, 64); - pAd->StaCfg.WpaPassPhraseLen = 0; - pAd->StaCfg.bAutoRoaming = FALSE; - pAd->StaCfg.bForceTxBurst = FALSE; - } -#endif // CONFIG_STA_SUPPORT // - - // Default for extra information is not valid - pAd->ExtraInfo = EXTRA_INFO_CLEAR; - - // Default Config change flag - pAd->bConfigChanged = FALSE; - - // - // part III. AP configurations - // - - - // - // part IV. others - // - // dynamic BBP R66:sensibity tuning to overcome background noise - pAd->BbpTuning.bEnable = TRUE; - pAd->BbpTuning.FalseCcaLowerThreshold = 100; - pAd->BbpTuning.FalseCcaUpperThreshold = 512; - pAd->BbpTuning.R66Delta = 4; - pAd->Mlme.bEnableAutoAntennaCheck = TRUE; - - // - // Also initial R66CurrentValue, RTUSBResumeMsduTransmission might use this value. - // if not initial this value, the default value will be 0. - // - pAd->BbpTuning.R66CurrentValue = 0x38; - - pAd->Bbp94 = BBPR94_DEFAULT; - pAd->BbpForCCK = FALSE; - - // Default is FALSE for test bit 1 - //pAd->bTest1 = FALSE; - - // initialize MAC table and allocate spin lock - NdisZeroMemory(&pAd->MacTab, sizeof(MAC_TABLE)); - InitializeQueueHeader(&pAd->MacTab.McastPsQueue); - NdisAllocateSpinLock(&pAd->MacTabLock); - - //RTMPInitTimer(pAd, &pAd->RECBATimer, RECBATimerTimeout, pAd, TRUE); - //RTMPSetTimer(&pAd->RECBATimer, REORDER_EXEC_INTV); - -#ifdef RALINK_ATE - NdisZeroMemory(&pAd->ate, sizeof(ATE_INFO)); - pAd->ate.Mode = ATE_STOP; - pAd->ate.TxCount = 200;/* to exceed TX_RING_SIZE ... */ - pAd->ate.TxDoneCount = 0; - pAd->ate.RFFreqOffset = 0; - pAd->ate.TxLength = 1024; - pAd->ate.TxWI.ShortGI = 0;// LONG GI : 800 ns - pAd->ate.TxWI.PHYMODE = MODE_CCK; - pAd->ate.TxWI.MCS = 3; - pAd->ate.TxWI.BW = BW_20; - pAd->ate.Channel = 1; - pAd->ate.QID = QID_AC_BE; - pAd->ate.Addr1[0] = 0x00; - pAd->ate.Addr1[1] = 0x11; - pAd->ate.Addr1[2] = 0x22; - pAd->ate.Addr1[3] = 0xAA; - pAd->ate.Addr1[4] = 0xBB; - pAd->ate.Addr1[5] = 0xCC; - NdisMoveMemory(pAd->ate.Addr2, pAd->ate.Addr1, ETH_LENGTH_OF_ADDRESS); - NdisMoveMemory(pAd->ate.Addr3, pAd->ate.Addr1, ETH_LENGTH_OF_ADDRESS); - pAd->ate.bRxFER = 0; - pAd->ate.bQATxStart = FALSE; - pAd->ate.bQARxStart = FALSE; - -#ifdef RTMP_MAC_PCI - pAd->ate.bFWLoading = FALSE; -#endif // RTMP_MAC_PCI // - - -#ifdef RALINK_28xx_QA - pAd->ate.TxStatus = 0; - pAd->ate.AtePid = THREAD_PID_INIT_VALUE; -#endif // RALINK_28xx_QA // -#endif // RALINK_ATE // - - - pAd->CommonCfg.bWiFiTest = FALSE; -#ifdef RTMP_MAC_PCI - pAd->bPCIclkOff = FALSE; -#endif // RTMP_MAC_PCI // - -#ifdef CONFIG_STA_SUPPORT -RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); -#endif // CONFIG_STA_SUPPORT // -#ifdef ANT_DIVERSITY_SUPPORT - if ( pAd->CommonCfg.bRxAntDiversity == ANT_FIX_ANT2) - { - pAd->RxAnt.Pair1PrimaryRxAnt = 1; - pAd->RxAnt.Pair1SecondaryRxAnt = 0; - } - else // Default - { - pAd->RxAnt.Pair1PrimaryRxAnt = 0; - pAd->RxAnt.Pair1SecondaryRxAnt = 1; - } - pAd->RxAnt.EvaluatePeriod = 0; - pAd->RxAnt.RcvPktNumWhenEvaluate = 0; -#ifdef CONFIG_STA_SUPPORT - pAd->RxAnt.Pair1AvgRssi[0] = pAd->RxAnt.Pair1AvgRssi[1] = 0; -#endif // CONFIG_STA_SUPPORT // -#endif // AP_ANTENNA_DIVERSITY_SUPPORT // - - DBGPRINT(RT_DEBUG_TRACE, ("<-- UserCfgInit\n")); -} - -// IRQL = PASSIVE_LEVEL -UCHAR BtoH(STRING ch) -{ - if (ch >= '0' && ch <= '9') return (ch - '0'); // Handle numerals - if (ch >= 'A' && ch <= 'F') return (ch - 'A' + 0xA); // Handle capitol hex digits - if (ch >= 'a' && ch <= 'f') return (ch - 'a' + 0xA); // Handle small hex digits - return(255); -} - -// -// FUNCTION: AtoH(char *, UCHAR *, int) -// -// PURPOSE: Converts ascii string to network order hex -// -// PARAMETERS: -// src - pointer to input ascii string -// dest - pointer to output hex -// destlen - size of dest -// -// COMMENTS: -// -// 2 ascii bytes make a hex byte so must put 1st ascii byte of pair -// into upper nibble and 2nd ascii byte of pair into lower nibble. -// -// IRQL = PASSIVE_LEVEL - -void AtoH(PSTRING src, PUCHAR dest, int destlen) -{ - PSTRING srcptr; - PUCHAR destTemp; - - srcptr = src; - destTemp = (PUCHAR) dest; - - while(destlen--) - { - *destTemp = BtoH(*srcptr++) << 4; // Put 1st ascii byte in upper nibble. - *destTemp += BtoH(*srcptr++); // Add 2nd ascii byte to above. - destTemp++; - } -} - - -//+++Mark by shiang, not use now, need to remove after confirm -//---Mark by shiang, not use now, need to remove after confirm - - -/* - ======================================================================== - - Routine Description: - Init timer objects - - Arguments: - pAd Pointer to our adapter - pTimer Timer structure - pTimerFunc Function to execute when timer expired - Repeat Ture for period timer - - Return Value: - None - - Note: - - ======================================================================== -*/ -VOID RTMPInitTimer( - IN PRTMP_ADAPTER pAd, - IN PRALINK_TIMER_STRUCT pTimer, - IN PVOID pTimerFunc, - IN PVOID pData, - IN BOOLEAN Repeat) -{ - // - // Set Valid to TRUE for later used. - // It will crash if we cancel a timer or set a timer - // that we haven't initialize before. - // - pTimer->Valid = TRUE; - - pTimer->PeriodicType = Repeat; - pTimer->State = FALSE; - pTimer->cookie = (ULONG) pData; - -#ifdef RTMP_TIMER_TASK_SUPPORT - pTimer->pAd = pAd; -#endif // RTMP_TIMER_TASK_SUPPORT // - - RTMP_OS_Init_Timer(pAd, &pTimer->TimerObj, pTimerFunc, (PVOID) pTimer); -} - - -/* - ======================================================================== - - Routine Description: - Init timer objects - - Arguments: - pTimer Timer structure - Value Timer value in milliseconds - - Return Value: - None - - Note: - To use this routine, must call RTMPInitTimer before. - - ======================================================================== -*/ -VOID RTMPSetTimer( - IN PRALINK_TIMER_STRUCT pTimer, - IN ULONG Value) -{ - if (pTimer->Valid) - { - pTimer->TimerValue = Value; - pTimer->State = FALSE; - if (pTimer->PeriodicType == TRUE) - { - pTimer->Repeat = TRUE; - RTMP_SetPeriodicTimer(&pTimer->TimerObj, Value); - } - else - { - pTimer->Repeat = FALSE; - RTMP_OS_Add_Timer(&pTimer->TimerObj, Value); - } - } - else - { - DBGPRINT_ERR(("RTMPSetTimer failed, Timer hasn't been initialize!\n")); - } -} - - -/* - ======================================================================== - - Routine Description: - Init timer objects - - Arguments: - pTimer Timer structure - Value Timer value in milliseconds - - Return Value: - None - - Note: - To use this routine, must call RTMPInitTimer before. - - ======================================================================== -*/ -VOID RTMPModTimer( - IN PRALINK_TIMER_STRUCT pTimer, - IN ULONG Value) -{ - BOOLEAN Cancel; - - if (pTimer->Valid) - { - pTimer->TimerValue = Value; - pTimer->State = FALSE; - if (pTimer->PeriodicType == TRUE) - { - RTMPCancelTimer(pTimer, &Cancel); - RTMPSetTimer(pTimer, Value); - } - else - { - RTMP_OS_Mod_Timer(&pTimer->TimerObj, Value); - } - } - else - { - DBGPRINT_ERR(("RTMPModTimer failed, Timer hasn't been initialize!\n")); - } -} - - -/* - ======================================================================== - - Routine Description: - Cancel timer objects - - Arguments: - Adapter Pointer to our adapter - - Return Value: - None - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - Note: - 1.) To use this routine, must call RTMPInitTimer before. - 2.) Reset NIC to initial state AS IS system boot up time. - - ======================================================================== -*/ -VOID RTMPCancelTimer( - IN PRALINK_TIMER_STRUCT pTimer, - OUT BOOLEAN *pCancelled) -{ - if (pTimer->Valid) - { - if (pTimer->State == FALSE) - pTimer->Repeat = FALSE; - - RTMP_OS_Del_Timer(&pTimer->TimerObj, pCancelled); - - if (*pCancelled == TRUE) - pTimer->State = TRUE; - -#ifdef RTMP_TIMER_TASK_SUPPORT - // We need to go-through the TimerQ to findout this timer handler and remove it if - // it's still waiting for execution. - RtmpTimerQRemove(pTimer->pAd, pTimer); -#endif // RTMP_TIMER_TASK_SUPPORT // - } - else - { - DBGPRINT_ERR(("RTMPCancelTimer failed, Timer hasn't been initialize!\n")); - } -} - - -/* - ======================================================================== - - Routine Description: - Set LED Status - - Arguments: - pAd Pointer to our adapter - Status LED Status - - Return Value: - None - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPSetLED( - IN PRTMP_ADAPTER pAd, - IN UCHAR Status) -{ - //ULONG data; - UCHAR HighByte = 0; - UCHAR LowByte; - BOOLEAN bIgnored = FALSE; - -#ifdef RALINK_ATE - /* - In ATE mode of RT2860 AP/STA, we have erased 8051 firmware. - So LED mode is not supported when ATE is running. - */ - if (!IS_RT3572(pAd)) - { - if (ATE_ON(pAd)) - return; - } -#endif // RALINK_ATE // - - LowByte = pAd->LedCntl.field.LedMode&0x7f; - switch (Status) - { - case LED_LINK_DOWN: - HighByte = 0x20; - AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); - pAd->LedIndicatorStrength = 0; - break; - case LED_LINK_UP: - if (pAd->CommonCfg.Channel > 14) - HighByte = 0xa0; - else - HighByte = 0x60; - AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); - break; - case LED_RADIO_ON: - HighByte = 0x20; - AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); - break; - case LED_HALT: - LowByte = 0; // Driver sets MAC register and MAC controls LED - case LED_RADIO_OFF: - HighByte = 0; - AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); - break; - case LED_WPS: - HighByte = 0x10; - AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); - break; - case LED_ON_SITE_SURVEY: - HighByte = 0x08; - AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); - break; - case LED_POWER_UP: - HighByte = 0x04; - AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); - break; -#ifdef RALINK_ATE -#endif // RALINK_ATE // - default: - DBGPRINT(RT_DEBUG_WARN, ("RTMPSetLED::Unknown Status %d\n", Status)); - break; - } - - // - // Keep LED status for LED SiteSurvey mode. - // After SiteSurvey, we will set the LED mode to previous status. - // - if ((Status != LED_ON_SITE_SURVEY) && (Status != LED_POWER_UP) && (bIgnored == FALSE)) - pAd->LedStatus = Status; - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetLED::Mode=%d,HighByte=0x%02x,LowByte=0x%02x\n", pAd->LedCntl.field.LedMode, HighByte, LowByte)); -} - -/* - ======================================================================== - - Routine Description: - Set LED Signal Stregth - - Arguments: - pAd Pointer to our adapter - Dbm Signal Stregth - - Return Value: - None - - IRQL = PASSIVE_LEVEL - - Note: - Can be run on any IRQL level. - - According to Microsoft Zero Config Wireless Signal Stregth definition as belows. - <= -90 No Signal - <= -81 Very Low - <= -71 Low - <= -67 Good - <= -57 Very Good - > -57 Excellent - ======================================================================== -*/ -VOID RTMPSetSignalLED( - IN PRTMP_ADAPTER pAd, - IN NDIS_802_11_RSSI Dbm) -{ - UCHAR nLed = 0; - - if (pAd->LedCntl.field.LedMode == LED_MODE_SIGNAL_STREGTH) - { - if (Dbm <= -90) - nLed = 0; - else if (Dbm <= -81) - nLed = 1; - else if (Dbm <= -71) - nLed = 3; - else if (Dbm <= -67) - nLed = 7; - else if (Dbm <= -57) - nLed = 15; - else - nLed = 31; - - // - // Update Signal Stregth to firmware if changed. - // - if (pAd->LedIndicatorStrength != nLed) - { - AsicSendCommandToMcu(pAd, 0x51, 0xff, nLed, pAd->LedCntl.field.Polarity); - pAd->LedIndicatorStrength = nLed; - } - } -} - - - -/* - ======================================================================== - - Routine Description: - Enable RX - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - IRQL <= DISPATCH_LEVEL - - Note: - Before Enable RX, make sure you have enabled Interrupt. - ======================================================================== -*/ -VOID RTMPEnableRxTx( - IN PRTMP_ADAPTER pAd) -{ -// WPDMA_GLO_CFG_STRUC GloCfg; -// ULONG i = 0; - UINT32 rx_filter_flag; - - DBGPRINT(RT_DEBUG_TRACE, ("==> RTMPEnableRxTx\n")); - - // Enable Rx DMA. - RT28XXDMAEnable(pAd); - - // enable RX of MAC block - if (pAd->OpMode == OPMODE_AP) - { - rx_filter_flag = APNORMAL; - - - RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, rx_filter_flag); // enable RX of DMA block - } - else - { - if (pAd->CommonCfg.PSPXlink) - rx_filter_flag = PSPXLINK; - else - rx_filter_flag = STANORMAL; // Staion not drop control frame will fail WiFi Certification. - RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, rx_filter_flag); - } - - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0xc); - DBGPRINT(RT_DEBUG_TRACE, ("<== RTMPEnableRxTx\n")); -} - - -//+++Add by shiang, move from os/linux/rt_main_dev.c -void CfgInitHook(PRTMP_ADAPTER pAd) -{ - pAd->bBroadComHT = TRUE; -} - - -int rt28xx_init( - IN PRTMP_ADAPTER pAd, - IN PSTRING pDefaultMac, - IN PSTRING pHostName) -{ - UINT index; - UCHAR TmpPhy; - NDIS_STATUS Status; - UINT32 MacCsr0 = 0; - -#ifdef CONFIG_STA_SUPPORT -#ifdef RTMP_MAC_PCI - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // If dirver doesn't wake up firmware here, - // NICLoadFirmware will hang forever when interface is up again. - // RT2860 PCI - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) && - OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - AUTO_WAKEUP_STRUC AutoWakeupCfg; - AsicForceWakeup(pAd, TRUE); - AutoWakeupCfg.word = 0; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); - } - } -#endif // RTMP_MAC_PCI // -#endif // CONFIG_STA_SUPPORT // - - - // reset Adapter flags - RTMP_CLEAR_FLAGS(pAd); - - // Init BssTab & ChannelInfo tabbles for auto channel select. - -#ifdef DOT11_N_SUPPORT - // Allocate BA Reordering memory - ba_reordering_resource_init(pAd, MAX_REORDERING_MPDU_NUM); -#endif // DOT11_N_SUPPORT // - - // Make sure MAC gets ready. - index = 0; - do - { - RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0); - pAd->MACVersion = MacCsr0; - - if ((pAd->MACVersion != 0x00) && (pAd->MACVersion != 0xFFFFFFFF)) - break; - - RTMPusecDelay(10); - } while (index++ < 100); - DBGPRINT(RT_DEBUG_TRACE, ("MAC_CSR0 [ Ver:Rev=0x%08x]\n", pAd->MACVersion)); - -#ifdef RTMP_MAC_PCI -#ifdef PCIE_PS_SUPPORT - /*Iverson patch PCIE L1 issue to make sure that driver can be read,write ,BBP and RF register at pcie L.1 level */ - if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))&&OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - RTMP_IO_READ32(pAd, AUX_CTRL, &MacCsr0); - MacCsr0 |= 0x402; - RTMP_IO_WRITE32(pAd, AUX_CTRL, MacCsr0); - DBGPRINT(RT_DEBUG_TRACE, ("AUX_CTRL = 0x%x\n", MacCsr0)); - } -#endif // PCIE_PS_SUPPORT // - - // To fix driver disable/enable hang issue when radio off - RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x2); -#endif // RTMP_MAC_PCI // - - // Disable DMA - RT28XXDMADisable(pAd); - - - // Load 8051 firmware - Status = NICLoadFirmware(pAd); - if (Status != NDIS_STATUS_SUCCESS) - { - DBGPRINT_ERR(("NICLoadFirmware failed, Status[=0x%08x]\n", Status)); - goto err1; - } - - NICLoadRateSwitchingParams(pAd); - - // Disable interrupts here which is as soon as possible - // This statement should never be true. We might consider to remove it later -#ifdef RTMP_MAC_PCI - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) - { - RTMP_ASIC_INTERRUPT_DISABLE(pAd); - } -#endif // RTMP_MAC_PCI // - - Status = RTMPAllocTxRxRingMemory(pAd); - if (Status != NDIS_STATUS_SUCCESS) - { - DBGPRINT_ERR(("RTMPAllocDMAMemory failed, Status[=0x%08x]\n", Status)); - goto err1; - } - - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE); - - // initialize MLME - // - - Status = RtmpMgmtTaskInit(pAd); - if (Status != NDIS_STATUS_SUCCESS) - goto err2; - - Status = MlmeInit(pAd); - if (Status != NDIS_STATUS_SUCCESS) - { - DBGPRINT_ERR(("MlmeInit failed, Status[=0x%08x]\n", Status)); - goto err2; - } - - // Initialize pAd->StaCfg, pAd->ApCfg, pAd->CommonCfg to manufacture default - // - UserCfgInit(pAd); - Status = RtmpNetTaskInit(pAd); - if (Status != NDIS_STATUS_SUCCESS) - goto err3; - -// COPY_MAC_ADDR(pAd->ApCfg.MBSSID[apidx].Bssid, netif->hwaddr); -// pAd->bForcePrintTX = TRUE; - - CfgInitHook(pAd); - - -#ifdef BLOCK_NET_IF - initblockQueueTab(pAd); -#endif // BLOCK_NET_IF // - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - NdisAllocateSpinLock(&pAd->MacTabLock); -#endif // CONFIG_STA_SUPPORT // - - MeasureReqTabInit(pAd); - TpcReqTabInit(pAd); - - // - // Init the hardware, we need to init asic before read registry, otherwise mac register will be reset - // - Status = NICInitializeAdapter(pAd, TRUE); - if (Status != NDIS_STATUS_SUCCESS) - { - DBGPRINT_ERR(("NICInitializeAdapter failed, Status[=0x%08x]\n", Status)); - if (Status != NDIS_STATUS_SUCCESS) - goto err3; - } - - // Read parameters from Config File - Status = RTMPReadParametersHook(pAd); - - DBGPRINT(RT_DEBUG_OFF, ("1. Phy Mode = %d\n", pAd->CommonCfg.PhyMode)); - if (Status != NDIS_STATUS_SUCCESS) - { - DBGPRINT_ERR(("NICReadRegParameters failed, Status[=0x%08x]\n",Status)); - goto err4; - } - - - -#ifdef DOT11_N_SUPPORT - //Init Ba Capability parameters. -// RT28XX_BA_INIT(pAd); - pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity; - pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable; - pAd->CommonCfg.DesiredHtPhy.AmsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize; - pAd->CommonCfg.DesiredHtPhy.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode; - // UPdata to HT IE - pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode; - pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize; - pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity; -#endif // DOT11_N_SUPPORT // - - // after reading Registry, we now know if in AP mode or STA mode - - // Load 8051 firmware; crash when FW image not existent - // Status = NICLoadFirmware(pAd); - // if (Status != NDIS_STATUS_SUCCESS) - // break; - - DBGPRINT(RT_DEBUG_OFF, ("2. Phy Mode = %d\n", pAd->CommonCfg.PhyMode)); - - // We should read EEPROM for all cases. rt2860b - NICReadEEPROMParameters(pAd, (PUCHAR)pDefaultMac); -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // - - DBGPRINT(RT_DEBUG_OFF, ("3. Phy Mode = %d\n", pAd->CommonCfg.PhyMode)); - - NICInitAsicFromEEPROM(pAd); //rt2860b - - // Set PHY to appropriate mode - TmpPhy = pAd->CommonCfg.PhyMode; - pAd->CommonCfg.PhyMode = 0xff; - RTMPSetPhyMode(pAd, TmpPhy); -#ifdef DOT11_N_SUPPORT - SetCommonHT(pAd); -#endif // DOT11_N_SUPPORT // - - // No valid channels. - if (pAd->ChannelListNum == 0) - { - DBGPRINT(RT_DEBUG_ERROR, ("Wrong configuration. No valid channel found. Check \"ContryCode\" and \"ChannelGeography\" setting.\n")); - goto err4; - } - -#ifdef DOT11_N_SUPPORT - DBGPRINT(RT_DEBUG_OFF, ("MCS Set = %02x %02x %02x %02x %02x\n", pAd->CommonCfg.HtCapability.MCSSet[0], - pAd->CommonCfg.HtCapability.MCSSet[1], pAd->CommonCfg.HtCapability.MCSSet[2], - pAd->CommonCfg.HtCapability.MCSSet[3], pAd->CommonCfg.HtCapability.MCSSet[4])); -#endif // DOT11_N_SUPPORT // - -#ifdef RTMP_RF_RW_SUPPORT - //Init RT30xx RFRegisters after read RFIC type from EEPROM - NICInitRFRegisters(pAd); -#endif // RTMP_RF_RW_SUPPORT // - - - -// APInitialize(pAd); - -#ifdef IKANOS_VX_1X0 - VR_IKANOS_FP_Init(pAd->ApCfg.BssidNum, pAd->PermanentAddress); -#endif // IKANOS_VX_1X0 // - - // - // Initialize RF register to default value - // - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - - // 8051 firmware require the signal during booting time. - //2008/11/28:KH marked the following codes to patch Frequency offset bug - //AsicSendCommandToMcu(pAd, 0x72, 0xFF, 0x00, 0x00); - - if (pAd && (Status != NDIS_STATUS_SUCCESS)) - { - // - // Undo everything if it failed - // - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { -// NdisMDeregisterInterrupt(&pAd->Interrupt); - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE); - } -// RTMPFreeAdapter(pAd); // we will free it in disconnect() - } - else if (pAd) - { - // Microsoft HCT require driver send a disconnect event after driver initialization. - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); -// pAd->IndicateMediaState = NdisMediaStateDisconnected; - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_MEDIA_STATE_CHANGE); - - DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_DISCONNECT Event B!\n")); - - - }// end of else - - - // Set up the Mac address - RtmpOSNetDevAddrSet(pAd->net_dev, &pAd->CurrentAddress[0]); - - // Various AP function init - - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { -#ifdef WPA_SUPPLICANT_SUPPORT -#ifndef NATIVE_WPA_SUPPLICANT_SUPPORT - // send wireless event to wpa_supplicant for infroming interface up. - RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, RT_INTERFACE_UP, NULL, NULL, 0); -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // -#endif // WPA_SUPPLICANT_SUPPORT // - - } -#endif // CONFIG_STA_SUPPORT // - - - - DBGPRINT_S(Status, ("<==== rt28xx_init, Status=%x\n", Status)); - - return TRUE; - - -err4: -err3: - MlmeHalt(pAd); -err2: - RTMPFreeTxRxRingMemory(pAd); -err1: - -#ifdef DOT11_N_SUPPORT - os_free_mem(pAd, pAd->mpdu_blk_pool.mem); // free BA pool -#endif // DOT11_N_SUPPORT // - - // shall not set priv to NULL here because the priv didn't been free yet. - //net_dev->priv = 0; -#ifdef INF_AMAZON_SE -err0: -#endif // INF_AMAZON_SE // -#ifdef ST -err0: -#endif // ST // - - DBGPRINT(RT_DEBUG_ERROR, ("!!! rt28xx Initialized fail !!!\n")); - return FALSE; -} -//---Add by shiang, move from os/linux/rt_main_dev.c - - -static INT RtmpChipOpsRegister( - IN RTMP_ADAPTER *pAd, - IN INT infType) -{ - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; - int status; - - memset(pChipOps, 0, sizeof(RTMP_CHIP_OP)); - - /* set eeprom related hook functions */ - status = RtmpChipOpsEepromHook(pAd, infType); - - /* set mcu related hook functions */ - switch(infType) - { -#ifdef RTMP_PCI_SUPPORT - case RTMP_DEV_INF_PCI: - pChipOps->loadFirmware = RtmpAsicLoadFirmware; - pChipOps->eraseFirmware = RtmpAsicEraseFirmware; - pChipOps->sendCommandToMcu = RtmpAsicSendCommandToMcu; - break; -#endif // RTMP_PCI_SUPPORT // - - - default: - break; - } - - return status; -} - - -INT RtmpRaDevCtrlInit( - IN RTMP_ADAPTER *pAd, - IN RTMP_INF_TYPE infType) -{ - //VOID *handle; - - // Assign the interface type. We need use it when do register/EEPROM access. - pAd->infType = infType; - - -#ifdef CONFIG_STA_SUPPORT - pAd->OpMode = OPMODE_STA; - DBGPRINT(RT_DEBUG_TRACE, ("STA Driver version-%s\n", STA_DRIVER_VERSION)); -#endif // CONFIG_STA_SUPPORT // - - - - RtmpChipOpsRegister(pAd, infType); - -#ifdef MULTIPLE_CARD_SUPPORT -{ - extern BOOLEAN RTMP_CardInfoRead(PRTMP_ADAPTER pAd); - - // find its profile path - pAd->MC_RowID = -1; // use default profile path - RTMP_CardInfoRead(pAd); - - if (pAd->MC_RowID == -1) -#ifdef CONFIG_STA_SUPPORT - strcpy(pAd->MC_FileName, STA_PROFILE_PATH); -#endif // CONFIG_STA_SUPPORT // - - DBGPRINT(RT_DEBUG_TRACE, ("MC> ROW = %d, PATH = %s\n", pAd->MC_RowID, pAd->MC_FileName)); -} -#endif // MULTIPLE_CARD_SUPPORT // - - return 0; -} - - -BOOLEAN RtmpRaDevCtrlExit(IN RTMP_ADAPTER *pAd) -{ -#ifdef MULTIPLE_CARD_SUPPORT -extern UINT8 MC_CardUsed[MAX_NUM_OF_MULTIPLE_CARD]; - - if ((pAd->MC_RowID >= 0) && (pAd->MC_RowID <= MAX_NUM_OF_MULTIPLE_CARD)) - MC_CardUsed[pAd->MC_RowID] = 0; // not clear MAC address -#endif // MULTIPLE_CARD_SUPPORT // - - - RTMPFreeAdapter(pAd); - - return TRUE; -} - - -// not yet support MBSS -PNET_DEV get_netdev_from_bssid( - IN PRTMP_ADAPTER pAd, - IN UCHAR FromWhichBSSID) -{ - PNET_DEV dev_p = NULL; - - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - dev_p = pAd->net_dev; - } -#endif // CONFIG_STA_SUPPORT // - - ASSERT(dev_p); - return dev_p; /* return one of MBSS */ -} diff --git a/drivers/staging/rt3090/common/rtmp_mcu.c b/drivers/staging/rt3090/common/rtmp_mcu.c deleted file mode 100644 index 20319e69a94f..000000000000 --- a/drivers/staging/rt3090/common/rtmp_mcu.c +++ /dev/null @@ -1,560 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rtmp_mcu.c - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#include "../rt_config.h" -#include "../firmware.h" - -//#define BIN_IN_FILE /* use *.bin firmware */ - - -// New 8k byte firmware size for RT3071/RT3072 -#define FIRMWAREIMAGE_MAX_LENGTH 0x2000 -#define FIRMWAREIMAGE_LENGTH (sizeof (FirmwareImage_3090) / sizeof(UCHAR)) -#define FIRMWARE_MAJOR_VERSION 0 - -#define FIRMWAREIMAGEV1_LENGTH 0x1000 -#define FIRMWAREIMAGEV2_LENGTH 0x1000 - -#ifdef RTMP_MAC_PCI -#define FIRMWARE_MINOR_VERSION 2 -#endif // RTMP_MAC_PCI // - -const unsigned short ccitt_16Table[] = { - 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, - 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF, - 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6, - 0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE, - 0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485, - 0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D, - 0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4, - 0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC, - 0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823, - 0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B, - 0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12, - 0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A, - 0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41, - 0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49, - 0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70, - 0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78, - 0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F, - 0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067, - 0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E, - 0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256, - 0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D, - 0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, - 0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C, - 0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634, - 0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB, - 0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3, - 0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A, - 0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92, - 0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9, - 0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1, - 0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8, - 0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0 -}; -#define ByteCRC16(v, crc) \ - (unsigned short)((crc << 8) ^ ccitt_16Table[((crc >> 8) ^ (v)) & 255]) - -unsigned char BitReverse(unsigned char x) -{ - int i; - unsigned char Temp=0; - for(i=0; ; i++) - { - if(x & 0x80) Temp |= 0x80; - if(i==7) break; - x <<= 1; - Temp >>= 1; - } - return Temp; -} - - -/* - ======================================================================== - - Routine Description: - erase 8051 firmware image in MAC ASIC - - Arguments: - Adapter Pointer to our adapter - - IRQL = PASSIVE_LEVEL - - ======================================================================== -*/ -INT RtmpAsicEraseFirmware( - IN PRTMP_ADAPTER pAd) -{ - ULONG i; - - for(i=0; i %s\n", __FUNCTION__)); - - /* init */ - pFirmwareImage = NULL; - src = RTMP_FIRMWARE_FILE_NAME; - - RtmpOSFSInfoChange(&osFSInfo, TRUE); - - pAd->FirmwareVersion = (FIRMWARE_MAJOR_VERSION << 8) + \ - FIRMWARE_MINOR_VERSION; - - - /* allocate firmware buffer */ - pFirmwareImage = kmalloc(MAX_FIRMWARE_IMAGE_SIZE, MEM_ALLOC_FLAG); - if (pFirmwareImage == NULL) - { - /* allocate fail, use default firmware array in firmware.h */ - DBGPRINT(RT_DEBUG_ERROR, ("%s - Allocate memory fail!\n", __FUNCTION__)); - NICLF_DEFAULT_USE(); - } - else - { - /* allocate ok! zero the firmware buffer */ - memset(pFirmwareImage, 0x00, MAX_FIRMWARE_IMAGE_SIZE); - } /* End of if */ - - - /* if ok, read firmware file from *.bin file */ - if (flg_default_firm_use == FALSE) - { - do - { - /* open the bin file */ - srcf = RtmpOSFileOpen(src, O_RDONLY, 0); - - if (IS_FILE_OPEN_ERR(srcf)) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s - Error opening file %s\n", __FUNCTION__, src)); - NICLF_DEFAULT_USE(); - break; - } - - - /* read the firmware from the file *.bin */ - FileLength = RtmpOSFileRead(srcf, pFirmwareImage, MAX_FIRMWARE_IMAGE_SIZE); - if (FileLength != MAX_FIRMWARE_IMAGE_SIZE) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: error file length (=%d) in RT2860AP.BIN\n", - __FUNCTION__, FileLength)); - NICLF_DEFAULT_USE(); - break; - } - else - { - PUCHAR ptr = pFirmwareImage; - USHORT crc = 0xffff; - - - /* calculate firmware CRC */ - for(i=0; i<(MAX_FIRMWARE_IMAGE_SIZE-2); i++, ptr++) - crc = ByteCRC16(BitReverse(*ptr), crc); - /* End of for */ - - if ((pFirmwareImage[MAX_FIRMWARE_IMAGE_SIZE-2] != \ - (UCHAR)BitReverse((UCHAR)(crc>>8))) || - (pFirmwareImage[MAX_FIRMWARE_IMAGE_SIZE-1] != \ - (UCHAR)BitReverse((UCHAR)crc))) - { - /* CRC fail */ - DBGPRINT(RT_DEBUG_ERROR, ("%s: CRC = 0x%02x 0x%02x " - "error, should be 0x%02x 0x%02x\n", - __FUNCTION__, - pFirmwareImage[MAX_FIRMWARE_IMAGE_SIZE-2], - pFirmwareImage[MAX_FIRMWARE_IMAGE_SIZE-1], - (UCHAR)(crc>>8), (UCHAR)(crc))); - NICLF_DEFAULT_USE(); - break; - } - else - { - /* firmware is ok */ - pAd->FirmwareVersion = \ - (pFirmwareImage[MAX_FIRMWARE_IMAGE_SIZE-4] << 8) + - pFirmwareImage[MAX_FIRMWARE_IMAGE_SIZE-3]; - - /* check if firmware version of the file is too old */ - if ((pAd->FirmwareVersion) < \ - ((FIRMWARE_MAJOR_VERSION << 8) + - FIRMWARE_MINOR_VERSION)) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: firmware version too old!\n", __FUNCTION__)); - NICLF_DEFAULT_USE(); - break; - } /* End of if */ - } /* End of if */ - - DBGPRINT(RT_DEBUG_TRACE, - ("NICLoadFirmware: CRC ok, ver=%d.%d\n", - pFirmwareImage[MAX_FIRMWARE_IMAGE_SIZE-4], - pFirmwareImage[MAX_FIRMWARE_IMAGE_SIZE-3])); - } /* End of if (FileLength == MAX_FIRMWARE_IMAGE_SIZE) */ - break; - } while(TRUE); - - /* close firmware file */ - if (IS_FILE_OPEN_ERR(srcf)) - ; - else - { - retval = RtmpOSFileClose(srcf); - if (retval) - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error %d closing %s\n", -retval, src)); - } - } - } - - - /* write firmware to ASIC */ - if (flg_default_firm_use == TRUE) - { - /* use default fimeware, free allocated buffer */ - if (pFirmwareImage != NULL) - kfree(pFirmwareImage); - /* End of if */ - - /* use default *.bin array */ - pFirmwareImage = FirmwareImage; - FileLength = sizeof(FirmwareImage); - } /* End of if */ - - /* enable Host program ram write selection */ - RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, 0x10000); - - for(i=0; iMACVersion >> 16); - - pFirmwareImage = FirmwareImage_3090; - FileLength = sizeof(*pFirmwareImage); - - // New 8k byte firmware size for RT3071/RT3072 - //DBGPRINT(RT_DEBUG_TRACE, ("Usb Chip\n")); - if (FIRMWAREIMAGE_LENGTH == FIRMWAREIMAGE_MAX_LENGTH) - //The firmware image consists of two parts. One is the origianl and the other is the new. - //Use Second Part - { -#ifdef RTMP_MAC_PCI - if ((Version == 0x2860) || IS_RT3090(pAd)||IS_RT3390(pAd)) - { - pFirmwareImage = FirmwareImage_3090; - FileLength = FIRMWAREIMAGE_LENGTH; - } -#endif // RTMP_MAC_PCI // - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("KH: bin file should be 8KB.\n")); - Status = NDIS_STATUS_FAILURE; - } - - - RTMP_WRITE_FIRMWARE(pAd, pFirmwareImage, FileLength); - -#endif - - /* check if MCU is ready */ - Index = 0; - do - { - RTMP_IO_READ32(pAd, PBF_SYS_CTRL, &MacReg); - - if (MacReg & 0x80) - break; - - RTMPusecDelay(1000); - } while (Index++ < 1000); - - if (Index >= 1000) - { - DBGPRINT(RT_DEBUG_ERROR, ("NICLoadFirmware: MCU is not ready\n\n\n")); - Status = NDIS_STATUS_FAILURE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("<=== %s (status=%d)\n", __FUNCTION__, Status)); - - return Status; -} - - -INT RtmpAsicSendCommandToMcu( - IN PRTMP_ADAPTER pAd, - IN UCHAR Command, - IN UCHAR Token, - IN UCHAR Arg0, - IN UCHAR Arg1) -{ - HOST_CMD_CSR_STRUC H2MCmd; - H2M_MAILBOX_STRUC H2MMailbox; - ULONG i = 0; -#ifdef RTMP_MAC_PCI -#ifdef RALINK_ATE - static UINT32 j = 0; -#endif // RALINK_ATE // -#endif // RTMP_MAC_PCI // -#ifdef PCIE_PS_SUPPORT -#ifdef CONFIG_STA_SUPPORT - // 3090F power solution 3 has hw limitation that needs to ban all mcu command - // when firmware is in radio state. For other chip doesn't have this limitation. - if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - RTMP_SEM_LOCK(&pAd->McuCmdLock); - if ((pAd->brt30xxBanMcuCmd == TRUE) - && (Command != WAKE_MCU_CMD) && (Command != RFOFF_MCU_CMD)) - { - RTMP_SEM_UNLOCK(&pAd->McuCmdLock); - DBGPRINT(RT_DEBUG_TRACE, (" Ban Mcu Cmd %x in sleep mode\n", Command)); - return FALSE; - } - else if ((Command == SLEEP_MCU_CMD) - ||(Command == RFOFF_MCU_CMD)) - { - pAd->brt30xxBanMcuCmd = TRUE; - } - else if (Command != WAKE_MCU_CMD) - { - pAd->brt30xxBanMcuCmd = FALSE; - } - - RTMP_SEM_UNLOCK(&pAd->McuCmdLock); - - } - if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - && (Command == WAKE_MCU_CMD)) - { - - do - { - RTMP_IO_FORCE_READ32(pAd, H2M_MAILBOX_CSR, &H2MMailbox.word); - if (H2MMailbox.field.Owner == 0) - break; - - RTMPusecDelay(2); - DBGPRINT(RT_DEBUG_INFO, ("AsicSendCommanToMcu::Mail box is busy\n")); - } while(i++ < 100); - - if (i >= 100) - { - DBGPRINT_ERR(("H2M_MAILBOX still hold by MCU. command fail\n")); - return FALSE; - } - - H2MMailbox.field.Owner = 1; // pass ownership to MCU - H2MMailbox.field.CmdToken = Token; - H2MMailbox.field.HighByte = Arg1; - H2MMailbox.field.LowByte = Arg0; - RTMP_IO_FORCE_WRITE32(pAd, H2M_MAILBOX_CSR, H2MMailbox.word); - - H2MCmd.word = 0; - H2MCmd.field.HostCommand = Command; - RTMP_IO_FORCE_WRITE32(pAd, HOST_CMD_CSR, H2MCmd.word); - - - } - else -#endif // CONFIG_STA_SUPPORT // -#endif // PCIE_PS_SUPPORT // - { - do - { - RTMP_IO_READ32(pAd, H2M_MAILBOX_CSR, &H2MMailbox.word); - if (H2MMailbox.field.Owner == 0) - break; - - RTMPusecDelay(2); - } while(i++ < 100); - - if (i >= 100) - { -#ifdef RTMP_MAC_PCI -#ifdef RALINK_ATE - if (pAd->ate.bFWLoading == TRUE) - { - /* reloading firmware when received iwpriv cmd "ATE=ATESTOP" */ - if (j > 0) - { - if (j % 64 != 0) - { - ATEDBGPRINT(RT_DEBUG_ERROR, ("#")); - } - else - { - ATEDBGPRINT(RT_DEBUG_ERROR, ("\n")); - } - ++j; - } - else if (j == 0) - { - ATEDBGPRINT(RT_DEBUG_ERROR, ("Loading firmware. Please wait for a moment...\n")); - ++j; - } - } - else -#endif // RALINK_ATE // -#endif // RTMP_MAC_PCI // - { - DBGPRINT_ERR(("H2M_MAILBOX still hold by MCU. command fail\n")); - } - return FALSE; - } - -#ifdef RTMP_MAC_PCI -#ifdef RALINK_ATE - else if (pAd->ate.bFWLoading == TRUE) - { - /* reloading of firmware is completed */ - pAd->ate.bFWLoading = FALSE; - ATEDBGPRINT(RT_DEBUG_ERROR, ("\n")); - j = 0; - } -#endif // RALINK_ATE // -#endif // RTMP_MAC_PCI // - - H2MMailbox.field.Owner = 1; // pass ownership to MCU - H2MMailbox.field.CmdToken = Token; - H2MMailbox.field.HighByte = Arg1; - H2MMailbox.field.LowByte = Arg0; - RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CSR, H2MMailbox.word); - - H2MCmd.word = 0; - H2MCmd.field.HostCommand = Command; - RTMP_IO_WRITE32(pAd, HOST_CMD_CSR, H2MCmd.word); - - if (Command != 0x80) - { - } -} -#ifdef PCIE_PS_SUPPORT -#ifdef CONFIG_STA_SUPPORT - // 3090 MCU Wakeup command needs more time to be stable. - // Before stable, don't issue other MCU command to prevent from firmware error. - if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - && (Command == WAKE_MCU_CMD)) - { - RTMPusecDelay(2000); - //Put this is after RF programming. - //NdisAcquireSpinLock(&pAd->McuCmdLock); - //pAd->brt30xxBanMcuCmd = FALSE; - //NdisReleaseSpinLock(&pAd->McuCmdLock); - } -#endif // CONFIG_STA_SUPPORT // -#endif // PCIE_PS_SUPPORT // - - return TRUE; -} diff --git a/drivers/staging/rt3090/common/rtmp_timer.c b/drivers/staging/rt3090/common/rtmp_timer.c deleted file mode 100644 index 5253e8768145..000000000000 --- a/drivers/staging/rt3090/common/rtmp_timer.c +++ /dev/null @@ -1,327 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rtmp_timer.c - - Abstract: - task for timer handling - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Name Date Modification logs - Shiang Tu 08-28-2008 init version - -*/ - -#include "../rt_config.h" - - -BUILD_TIMER_FUNCTION(MlmePeriodicExec); -//BUILD_TIMER_FUNCTION(MlmeRssiReportExec); -BUILD_TIMER_FUNCTION(AsicRxAntEvalTimeout); -BUILD_TIMER_FUNCTION(APSDPeriodicExec); -BUILD_TIMER_FUNCTION(AsicRfTuningExec); - - -#ifdef CONFIG_STA_SUPPORT -BUILD_TIMER_FUNCTION(BeaconTimeout); -BUILD_TIMER_FUNCTION(ScanTimeout); -BUILD_TIMER_FUNCTION(AuthTimeout); -BUILD_TIMER_FUNCTION(AssocTimeout); -BUILD_TIMER_FUNCTION(ReassocTimeout); -BUILD_TIMER_FUNCTION(DisassocTimeout); -BUILD_TIMER_FUNCTION(LinkDownExec); -BUILD_TIMER_FUNCTION(StaQuickResponeForRateUpExec); -BUILD_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc); -#ifdef RTMP_MAC_PCI -BUILD_TIMER_FUNCTION(PsPollWakeExec); -BUILD_TIMER_FUNCTION(RadioOnExec); -#endif // RTMP_MAC_PCI // -#ifdef QOS_DLS_SUPPORT -BUILD_TIMER_FUNCTION(DlsTimeoutAction); -#endif // QOS_DLS_SUPPORT // - - -#endif // CONFIG_STA_SUPPORT // - - - -#if defined(AP_LED) || defined(STA_LED) -extern void LedCtrlMain( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); -BUILD_TIMER_FUNCTION(LedCtrlMain); -#endif - - -#ifdef RTMP_TIMER_TASK_SUPPORT -static void RtmpTimerQHandle(RTMP_ADAPTER *pAd) -{ -#ifndef KTHREAD_SUPPORT - int status; -#endif - RALINK_TIMER_STRUCT *pTimer; - RTMP_TIMER_TASK_ENTRY *pEntry; - unsigned long irqFlag; - RTMP_OS_TASK *pTask; - - - pTask = &pAd->timerTask; - while(!pTask->task_killed) - { - pTimer = NULL; - -#ifdef KTHREAD_SUPPORT - RTMP_WAIT_EVENT_INTERRUPTIBLE(pAd, pTask); -#else - RTMP_SEM_EVENT_WAIT(&(pTask->taskSema), status); -#endif - - if (pAd->TimerQ.status == RTMP_TASK_STAT_STOPED) - break; - - // event happened. - while(pAd->TimerQ.pQHead) - { - RTMP_INT_LOCK(&pAd->TimerQLock, irqFlag); - pEntry = pAd->TimerQ.pQHead; - if (pEntry) - { - pTimer = pEntry->pRaTimer; - - // update pQHead - pAd->TimerQ.pQHead = pEntry->pNext; - if (pEntry == pAd->TimerQ.pQTail) - pAd->TimerQ.pQTail = NULL; - - // return this queue entry to timerQFreeList. - pEntry->pNext = pAd->TimerQ.pQPollFreeList; - pAd->TimerQ.pQPollFreeList = pEntry; - } - RTMP_INT_UNLOCK(&pAd->TimerQLock, irqFlag); - - if (pTimer) - { - if ((pTimer->handle != NULL) && (!pAd->PM_FlgSuspend)) - pTimer->handle(NULL, (PVOID) pTimer->cookie, NULL, pTimer); - if ((pTimer->Repeat) && (pTimer->State == FALSE)) - RTMP_OS_Add_Timer(&pTimer->TimerObj, pTimer->TimerValue); - } - } - -#ifndef KTHREAD_SUPPORT - if (status != 0) - { - pAd->TimerQ.status = RTMP_TASK_STAT_STOPED; - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); - break; - } -#endif - } -} - - -INT RtmpTimerQThread( - IN OUT PVOID Context) -{ - RTMP_OS_TASK *pTask; - PRTMP_ADAPTER pAd; - - - pTask = (RTMP_OS_TASK *)Context; - pAd = (PRTMP_ADAPTER)pTask->priv; - - RtmpOSTaskCustomize(pTask); - - RtmpTimerQHandle(pAd); - - DBGPRINT(RT_DEBUG_TRACE,( "<---%s\n",__FUNCTION__)); -#ifndef KTHREAD_SUPPORT - pTask->taskPID = THREAD_PID_INIT_VALUE; -#endif - /* notify the exit routine that we're actually exiting now - * - * complete()/wait_for_completion() is similar to up()/down(), - * except that complete() is safe in the case where the structure - * is getting deleted in a parallel mode of execution (i.e. just - * after the down() -- that's necessary for the thread-shutdown - * case. - * - * complete_and_exit() goes even further than this -- it is safe in - * the case that the thread of the caller is going away (not just - * the structure) -- this is necessary for the module-remove case. - * This is important in preemption kernels, which transfer the flow - * of execution immediately upon a complete(). - */ - RtmpOSTaskNotifyToExit(pTask); - - return 0; - -} - - -RTMP_TIMER_TASK_ENTRY *RtmpTimerQInsert( - IN RTMP_ADAPTER *pAd, - IN RALINK_TIMER_STRUCT *pTimer) -{ - RTMP_TIMER_TASK_ENTRY *pQNode = NULL, *pQTail; - unsigned long irqFlags; - RTMP_OS_TASK *pTask = &pAd->timerTask; - - RTMP_INT_LOCK(&pAd->TimerQLock, irqFlags); - if (pAd->TimerQ.status & RTMP_TASK_CAN_DO_INSERT) - { - if(pAd->TimerQ.pQPollFreeList) - { - pQNode = pAd->TimerQ.pQPollFreeList; - pAd->TimerQ.pQPollFreeList = pQNode->pNext; - - pQNode->pRaTimer = pTimer; - pQNode->pNext = NULL; - - pQTail = pAd->TimerQ.pQTail; - if (pAd->TimerQ.pQTail != NULL) - pQTail->pNext = pQNode; - pAd->TimerQ.pQTail = pQNode; - if (pAd->TimerQ.pQHead == NULL) - pAd->TimerQ.pQHead = pQNode; - } - } - RTMP_INT_UNLOCK(&pAd->TimerQLock, irqFlags); - - if (pQNode) - { -#ifdef KTHREAD_SUPPORT - WAKE_UP(pTask); -#else - RTMP_SEM_EVENT_UP(&pTask->taskSema); -#endif - } - - return pQNode; -} - - -BOOLEAN RtmpTimerQRemove( - IN RTMP_ADAPTER *pAd, - IN RALINK_TIMER_STRUCT *pTimer) -{ - RTMP_TIMER_TASK_ENTRY *pNode, *pPrev = NULL; - unsigned long irqFlags; - - RTMP_INT_LOCK(&pAd->TimerQLock, irqFlags); - if (pAd->TimerQ.status >= RTMP_TASK_STAT_INITED) - { - pNode = pAd->TimerQ.pQHead; - while (pNode) - { - if (pNode->pRaTimer == pTimer) - break; - pPrev = pNode; - pNode = pNode->pNext; - } - - // Now move it to freeList queue. - if (pNode) - { - if (pNode == pAd->TimerQ.pQHead) - pAd->TimerQ.pQHead = pNode->pNext; - if (pNode == pAd->TimerQ.pQTail) - pAd->TimerQ.pQTail = pPrev; - if (pPrev != NULL) - pPrev->pNext = pNode->pNext; - - // return this queue entry to timerQFreeList. - pNode->pNext = pAd->TimerQ.pQPollFreeList; - pAd->TimerQ.pQPollFreeList = pNode; - } - } - RTMP_INT_UNLOCK(&pAd->TimerQLock, irqFlags); - - return TRUE; -} - - -void RtmpTimerQExit(RTMP_ADAPTER *pAd) -{ - RTMP_TIMER_TASK_ENTRY *pTimerQ; - unsigned long irqFlags; - - RTMP_INT_LOCK(&pAd->TimerQLock, irqFlags); - while (pAd->TimerQ.pQHead) - { - pTimerQ = pAd->TimerQ.pQHead; - pAd->TimerQ.pQHead = pTimerQ->pNext; - // remove the timeQ - } - pAd->TimerQ.pQPollFreeList = NULL; - os_free_mem(pAd, pAd->TimerQ.pTimerQPoll); - pAd->TimerQ.pQTail = NULL; - pAd->TimerQ.pQHead = NULL; -#ifndef KTHREAD_SUPPORT - pAd->TimerQ.status = RTMP_TASK_STAT_STOPED; -#endif - RTMP_INT_UNLOCK(&pAd->TimerQLock, irqFlags); - -} - - -void RtmpTimerQInit(RTMP_ADAPTER *pAd) -{ - int i; - RTMP_TIMER_TASK_ENTRY *pQNode, *pEntry; - unsigned long irqFlags; - - NdisAllocateSpinLock(&pAd->TimerQLock); - - NdisZeroMemory(&pAd->TimerQ, sizeof(pAd->TimerQ)); - - os_alloc_mem(pAd, &pAd->TimerQ.pTimerQPoll, sizeof(RTMP_TIMER_TASK_ENTRY) * TIMER_QUEUE_SIZE_MAX); - if (pAd->TimerQ.pTimerQPoll) - { - pEntry = NULL; - pQNode = (RTMP_TIMER_TASK_ENTRY *)pAd->TimerQ.pTimerQPoll; - NdisZeroMemory(pAd->TimerQ.pTimerQPoll, sizeof(RTMP_TIMER_TASK_ENTRY) * TIMER_QUEUE_SIZE_MAX); - - RTMP_INT_LOCK(&pAd->TimerQLock, irqFlags); - for (i = 0 ;i pNext = pEntry; - pEntry = pQNode; - pQNode++; - } - pAd->TimerQ.pQPollFreeList = pEntry; - pAd->TimerQ.pQHead = NULL; - pAd->TimerQ.pQTail = NULL; - pAd->TimerQ.status = RTMP_TASK_STAT_INITED; - RTMP_INT_UNLOCK(&pAd->TimerQLock, irqFlags); - } -} -#endif // RTMP_TIMER_TASK_SUPPORT // diff --git a/drivers/staging/rt3090/common/spectrum.c b/drivers/staging/rt3090/common/spectrum.c deleted file mode 100644 index 12d2125148ba..000000000000 --- a/drivers/staging/rt3090/common/spectrum.c +++ /dev/null @@ -1,2221 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - action.c - - Abstract: - Handle association related requests either from WSTA or from local MLME - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- - Fonchi Wu 2008 created for 802.11h - */ - -#include "../rt_config.h" -#include "../action.h" - - -/* The regulatory information in the USA (US) */ -DOT11_REGULATORY_INFORMATION USARegulatoryInfo[] = -{ -/* "regulatory class" "number of channels" "Max Tx Pwr" "channel list" */ - {0, {0, 0, {0}}}, // Invlid entry - {1, {4, 16, {36, 40, 44, 48}}}, - {2, {4, 23, {52, 56, 60, 64}}}, - {3, {4, 29, {149, 153, 157, 161}}}, - {4, {11, 23, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}}, - {5, {5, 30, {149, 153, 157, 161, 165}}}, - {6, {10, 14, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}}, - {7, {10, 27, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}}, - {8, {5, 17, {11, 13, 15, 17, 19}}}, - {9, {5, 30, {11, 13, 15, 17, 19}}}, - {10, {2, 20, {21, 25}}}, - {11, {2, 33, {21, 25}}}, - {12, {11, 30, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}}} -}; -#define USA_REGULATORY_INFO_SIZE (sizeof(USARegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION)) - - -/* The regulatory information in Europe */ -DOT11_REGULATORY_INFORMATION EuropeRegulatoryInfo[] = -{ -/* "regulatory class" "number of channels" "Max Tx Pwr" "channel list" */ - {0, {0, 0, {0}}}, // Invalid entry - {1, {4, 20, {36, 40, 44, 48}}}, - {2, {4, 20, {52, 56, 60, 64}}}, - {3, {11, 30, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}}, - {4, {13, 20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}} -}; -#define EU_REGULATORY_INFO_SIZE (sizeof(EuropeRegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION)) - - -/* The regulatory information in Japan */ -DOT11_REGULATORY_INFORMATION JapanRegulatoryInfo[] = -{ -/* "regulatory class" "number of channels" "Max Tx Pwr" "channel list" */ - {0, {0, 0, {0}}}, // Invalid entry - {1, {4, 22, {34, 38, 42, 46}}}, - {2, {3, 24, {8, 12, 16}}}, - {3, {3, 24, {8, 12, 16}}}, - {4, {3, 24, {8, 12, 16}}}, - {5, {3, 24, {8, 12, 16}}}, - {6, {3, 22, {8, 12, 16}}}, - {7, {4, 24, {184, 188, 192, 196}}}, - {8, {4, 24, {184, 188, 192, 196}}}, - {9, {4, 24, {184, 188, 192, 196}}}, - {10, {4, 24, {184, 188, 192, 196}}}, - {11, {4, 22, {184, 188, 192, 196}}}, - {12, {4, 24, {7, 8, 9, 11}}}, - {13, {4, 24, {7, 8, 9, 11}}}, - {14, {4, 24, {7, 8, 9, 11}}}, - {15, {4, 24, {7, 8, 9, 11}}}, - {16, {6, 24, {183, 184, 185, 187, 188, 189}}}, - {17, {6, 24, {183, 184, 185, 187, 188, 189}}}, - {18, {6, 24, {183, 184, 185, 187, 188, 189}}}, - {19, {6, 24, {183, 184, 185, 187, 188, 189}}}, - {20, {6, 17, {183, 184, 185, 187, 188, 189}}}, - {21, {6, 24, {6, 7, 8, 9, 10, 11}}}, - {22, {6, 24, {6, 7, 8, 9, 10, 11}}}, - {23, {6, 24, {6, 7, 8, 9, 10, 11}}}, - {24, {6, 24, {6, 7, 8, 9, 10, 11}}}, - {25, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}}}, - {26, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}}}, - {27, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}}}, - {28, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}}}, - {29, {8, 17, {182, 183, 184, 185, 186, 187, 188, 189}}}, - {30, {13, 23, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}}, - {31, {1, 23, {14}}}, - {32, {4, 22, {52, 56, 60, 64}}} -}; -#define JP_REGULATORY_INFO_SIZE (sizeof(JapanRegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION)) - - -CHAR RTMP_GetTxPwr( - IN PRTMP_ADAPTER pAd, - IN HTTRANSMIT_SETTING HTTxMode) -{ -typedef struct __TX_PWR_CFG -{ - UINT8 Mode; - UINT8 MCS; - UINT16 req; - UINT8 shift; - UINT32 BitMask; -} TX_PWR_CFG; - - UINT32 Value; - INT Idx; - UINT8 PhyMode; - CHAR CurTxPwr; - UINT8 TxPwrRef = 0; - CHAR DaltaPwr; - ULONG TxPwr[5]; - - - TX_PWR_CFG TxPwrCfg[] = { - {MODE_CCK, 0, 0, 4, 0x000000f0}, - {MODE_CCK, 1, 0, 0, 0x0000000f}, - {MODE_CCK, 2, 0, 12, 0x0000f000}, - {MODE_CCK, 3, 0, 8, 0x00000f00}, - - {MODE_OFDM, 0, 0, 20, 0x00f00000}, - {MODE_OFDM, 1, 0, 16, 0x000f0000}, - {MODE_OFDM, 2, 0, 28, 0xf0000000}, - {MODE_OFDM, 3, 0, 24, 0x0f000000}, - {MODE_OFDM, 4, 1, 4, 0x000000f0}, - {MODE_OFDM, 5, 1, 0, 0x0000000f}, - {MODE_OFDM, 6, 1, 12, 0x0000f000}, - {MODE_OFDM, 7, 1, 8, 0x00000f00} -#ifdef DOT11_N_SUPPORT - ,{MODE_HTMIX, 0, 1, 20, 0x00f00000}, - {MODE_HTMIX, 1, 1, 16, 0x000f0000}, - {MODE_HTMIX, 2, 1, 28, 0xf0000000}, - {MODE_HTMIX, 3, 1, 24, 0x0f000000}, - {MODE_HTMIX, 4, 2, 4, 0x000000f0}, - {MODE_HTMIX, 5, 2, 0, 0x0000000f}, - {MODE_HTMIX, 6, 2, 12, 0x0000f000}, - {MODE_HTMIX, 7, 2, 8, 0x00000f00}, - {MODE_HTMIX, 8, 2, 20, 0x00f00000}, - {MODE_HTMIX, 9, 2, 16, 0x000f0000}, - {MODE_HTMIX, 10, 2, 28, 0xf0000000}, - {MODE_HTMIX, 11, 2, 24, 0x0f000000}, - {MODE_HTMIX, 12, 3, 4, 0x000000f0}, - {MODE_HTMIX, 13, 3, 0, 0x0000000f}, - {MODE_HTMIX, 14, 3, 12, 0x0000f000}, - {MODE_HTMIX, 15, 3, 8, 0x00000f00} -#endif // DOT11_N_SUPPORT // - }; -#define MAX_TXPWR_TAB_SIZE (sizeof(TxPwrCfg) / sizeof(TX_PWR_CFG)) - -#ifdef SINGLE_SKU - CurTxPwr = pAd->CommonCfg.DefineMaxTxPwr; -#else - CurTxPwr = 19; -#endif - - /* check Tx Power setting from UI. */ - if (pAd->CommonCfg.TxPowerPercentage > 90) - ; - else if (pAd->CommonCfg.TxPowerPercentage > 60) /* reduce Pwr for 1 dB. */ - CurTxPwr -= 1; - else if (pAd->CommonCfg.TxPowerPercentage > 30) /* reduce Pwr for 3 dB. */ - CurTxPwr -= 3; - else if (pAd->CommonCfg.TxPowerPercentage > 15) /* reduce Pwr for 6 dB. */ - CurTxPwr -= 6; - else if (pAd->CommonCfg.TxPowerPercentage > 9) /* reduce Pwr for 9 dB. */ - CurTxPwr -= 9; - else /* reduce Pwr for 12 dB. */ - CurTxPwr -= 12; - - if (pAd->CommonCfg.BBPCurrentBW == BW_40) - { - if (pAd->CommonCfg.CentralChannel > 14) - { - TxPwr[0] = pAd->Tx40MPwrCfgABand[0]; - TxPwr[1] = pAd->Tx40MPwrCfgABand[1]; - TxPwr[2] = pAd->Tx40MPwrCfgABand[2]; - TxPwr[3] = pAd->Tx40MPwrCfgABand[3]; - TxPwr[4] = pAd->Tx40MPwrCfgABand[4]; - } - else - { - TxPwr[0] = pAd->Tx40MPwrCfgGBand[0]; - TxPwr[1] = pAd->Tx40MPwrCfgGBand[1]; - TxPwr[2] = pAd->Tx40MPwrCfgGBand[2]; - TxPwr[3] = pAd->Tx40MPwrCfgGBand[3]; - TxPwr[4] = pAd->Tx40MPwrCfgGBand[4]; - } - } - else - { - if (pAd->CommonCfg.Channel > 14) - { - TxPwr[0] = pAd->Tx20MPwrCfgABand[0]; - TxPwr[1] = pAd->Tx20MPwrCfgABand[1]; - TxPwr[2] = pAd->Tx20MPwrCfgABand[2]; - TxPwr[3] = pAd->Tx20MPwrCfgABand[3]; - TxPwr[4] = pAd->Tx20MPwrCfgABand[4]; - } - else - { - TxPwr[0] = pAd->Tx20MPwrCfgGBand[0]; - TxPwr[1] = pAd->Tx20MPwrCfgGBand[1]; - TxPwr[2] = pAd->Tx20MPwrCfgGBand[2]; - TxPwr[3] = pAd->Tx20MPwrCfgGBand[3]; - TxPwr[4] = pAd->Tx20MPwrCfgGBand[4]; - } - } - - - switch(HTTxMode.field.MODE) - { - case MODE_CCK: - case MODE_OFDM: - Value = TxPwr[1]; - TxPwrRef = (Value & 0x00000f00) >> 8; - - break; - -#ifdef DOT11_N_SUPPORT - case MODE_HTMIX: - case MODE_HTGREENFIELD: - if (pAd->CommonCfg.TxStream == 1) - { - Value = TxPwr[2]; - TxPwrRef = (Value & 0x00000f00) >> 8; - } - else if (pAd->CommonCfg.TxStream == 2) - { - Value = TxPwr[3]; - TxPwrRef = (Value & 0x00000f00) >> 8; - } - break; -#endif // DOT11_N_SUPPORT // - } - - PhyMode = -#ifdef DOT11_N_SUPPORT - (HTTxMode.field.MODE == MODE_HTGREENFIELD) - ? MODE_HTMIX : -#endif // DOT11_N_SUPPORT // - HTTxMode.field.MODE; - - for (Idx = 0; Idx < MAX_TXPWR_TAB_SIZE; Idx++) - { - if ((TxPwrCfg[Idx].Mode == PhyMode) - && (TxPwrCfg[Idx].MCS == HTTxMode.field.MCS)) - { - Value = TxPwr[TxPwrCfg[Idx].req]; - DaltaPwr = TxPwrRef - (CHAR)((Value & TxPwrCfg[Idx].BitMask) - >> TxPwrCfg[Idx].shift); - CurTxPwr -= DaltaPwr; - break; - } - } - - return CurTxPwr; -} - - -VOID MeasureReqTabInit( - IN PRTMP_ADAPTER pAd) -{ - NdisAllocateSpinLock(&pAd->CommonCfg.MeasureReqTabLock); - - pAd->CommonCfg.pMeasureReqTab = kmalloc(sizeof(MEASURE_REQ_TAB), GFP_ATOMIC); - if (pAd->CommonCfg.pMeasureReqTab) - NdisZeroMemory(pAd->CommonCfg.pMeasureReqTab, sizeof(MEASURE_REQ_TAB)); - else - DBGPRINT(RT_DEBUG_ERROR, ("%s Fail to alloc memory for pAd->CommonCfg.pMeasureReqTab.\n", __FUNCTION__)); - - return; -} - -VOID MeasureReqTabExit( - IN PRTMP_ADAPTER pAd) -{ - NdisFreeSpinLock(&pAd->CommonCfg.MeasureReqTabLock); - - if (pAd->CommonCfg.pMeasureReqTab) - kfree(pAd->CommonCfg.pMeasureReqTab); - pAd->CommonCfg.pMeasureReqTab = NULL; - - return; -} - -PMEASURE_REQ_ENTRY MeasureReqLookUp( - IN PRTMP_ADAPTER pAd, - IN UINT8 DialogToken) -{ - UINT HashIdx; - PMEASURE_REQ_TAB pTab = pAd->CommonCfg.pMeasureReqTab; - PMEASURE_REQ_ENTRY pEntry = NULL; - PMEASURE_REQ_ENTRY pPrevEntry = NULL; - - if (pTab == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: pMeasureReqTab doesn't exist.\n", __FUNCTION__)); - return NULL; - } - - RTMP_SEM_LOCK(&pAd->CommonCfg.MeasureReqTabLock); - - HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(DialogToken); - pEntry = pTab->Hash[HashIdx]; - - while (pEntry) - { - if (pEntry->DialogToken == DialogToken) - break; - else - { - pPrevEntry = pEntry; - pEntry = pEntry->pNext; - } - } - - RTMP_SEM_UNLOCK(&pAd->CommonCfg.MeasureReqTabLock); - - return pEntry; -} - -PMEASURE_REQ_ENTRY MeasureReqInsert( - IN PRTMP_ADAPTER pAd, - IN UINT8 DialogToken) -{ - INT i; - ULONG HashIdx; - PMEASURE_REQ_TAB pTab = pAd->CommonCfg.pMeasureReqTab; - PMEASURE_REQ_ENTRY pEntry = NULL, pCurrEntry; - ULONG Now; - - if(pTab == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: pMeasureReqTab doesn't exist.\n", __FUNCTION__)); - return NULL; - } - - pEntry = MeasureReqLookUp(pAd, DialogToken); - if (pEntry == NULL) - { - RTMP_SEM_LOCK(&pAd->CommonCfg.MeasureReqTabLock); - for (i = 0; i < MAX_MEASURE_REQ_TAB_SIZE; i++) - { - NdisGetSystemUpTime(&Now); - pEntry = &pTab->Content[i]; - - if ((pEntry->Valid == TRUE) - && RTMP_TIME_AFTER((unsigned long)Now, (unsigned long)(pEntry->lastTime + MQ_REQ_AGE_OUT))) - { - PMEASURE_REQ_ENTRY pPrevEntry = NULL; - ULONG HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(pEntry->DialogToken); - PMEASURE_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx]; - - // update Hash list - do - { - if (pProbeEntry == pEntry) - { - if (pPrevEntry == NULL) - { - pTab->Hash[HashIdx] = pEntry->pNext; - } - else - { - pPrevEntry->pNext = pEntry->pNext; - } - break; - } - - pPrevEntry = pProbeEntry; - pProbeEntry = pProbeEntry->pNext; - } while (pProbeEntry); - - NdisZeroMemory(pEntry, sizeof(MEASURE_REQ_ENTRY)); - pTab->Size--; - - break; - } - - if (pEntry->Valid == FALSE) - break; - } - - if (i < MAX_MEASURE_REQ_TAB_SIZE) - { - NdisGetSystemUpTime(&Now); - pEntry->lastTime = Now; - pEntry->Valid = TRUE; - pEntry->DialogToken = DialogToken; - pTab->Size++; - } - else - { - pEntry = NULL; - DBGPRINT(RT_DEBUG_ERROR, ("%s: pMeasureReqTab tab full.\n", __FUNCTION__)); - } - - // add this Neighbor entry into HASH table - if (pEntry) - { - HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(DialogToken); - if (pTab->Hash[HashIdx] == NULL) - { - pTab->Hash[HashIdx] = pEntry; - } - else - { - pCurrEntry = pTab->Hash[HashIdx]; - while (pCurrEntry->pNext != NULL) - pCurrEntry = pCurrEntry->pNext; - pCurrEntry->pNext = pEntry; - } - } - - RTMP_SEM_UNLOCK(&pAd->CommonCfg.MeasureReqTabLock); - } - - return pEntry; -} - -VOID MeasureReqDelete( - IN PRTMP_ADAPTER pAd, - IN UINT8 DialogToken) -{ - PMEASURE_REQ_TAB pTab = pAd->CommonCfg.pMeasureReqTab; - PMEASURE_REQ_ENTRY pEntry = NULL; - - if(pTab == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: pMeasureReqTab doesn't exist.\n", __FUNCTION__)); - return; - } - - // if empty, return - if (pTab->Size == 0) - { - DBGPRINT(RT_DEBUG_ERROR, ("pMeasureReqTab empty.\n")); - return; - } - - pEntry = MeasureReqLookUp(pAd, DialogToken); - if (pEntry != NULL) - { - PMEASURE_REQ_ENTRY pPrevEntry = NULL; - ULONG HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(pEntry->DialogToken); - PMEASURE_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx]; - - RTMP_SEM_LOCK(&pAd->CommonCfg.MeasureReqTabLock); - // update Hash list - do - { - if (pProbeEntry == pEntry) - { - if (pPrevEntry == NULL) - { - pTab->Hash[HashIdx] = pEntry->pNext; - } - else - { - pPrevEntry->pNext = pEntry->pNext; - } - break; - } - - pPrevEntry = pProbeEntry; - pProbeEntry = pProbeEntry->pNext; - } while (pProbeEntry); - - NdisZeroMemory(pEntry, sizeof(MEASURE_REQ_ENTRY)); - pTab->Size--; - - RTMP_SEM_UNLOCK(&pAd->CommonCfg.MeasureReqTabLock); - } - - return; -} - -VOID TpcReqTabInit( - IN PRTMP_ADAPTER pAd) -{ - NdisAllocateSpinLock(&pAd->CommonCfg.TpcReqTabLock); - - pAd->CommonCfg.pTpcReqTab = kmalloc(sizeof(TPC_REQ_TAB), GFP_ATOMIC); - if (pAd->CommonCfg.pTpcReqTab) - NdisZeroMemory(pAd->CommonCfg.pTpcReqTab, sizeof(TPC_REQ_TAB)); - else - DBGPRINT(RT_DEBUG_ERROR, ("%s Fail to alloc memory for pAd->CommonCfg.pTpcReqTab.\n", __FUNCTION__)); - - return; -} - -VOID TpcReqTabExit( - IN PRTMP_ADAPTER pAd) -{ - NdisFreeSpinLock(&pAd->CommonCfg.TpcReqTabLock); - - if (pAd->CommonCfg.pTpcReqTab) - kfree(pAd->CommonCfg.pTpcReqTab); - pAd->CommonCfg.pTpcReqTab = NULL; - - return; -} - -static PTPC_REQ_ENTRY TpcReqLookUp( - IN PRTMP_ADAPTER pAd, - IN UINT8 DialogToken) -{ - UINT HashIdx; - PTPC_REQ_TAB pTab = pAd->CommonCfg.pTpcReqTab; - PTPC_REQ_ENTRY pEntry = NULL; - PTPC_REQ_ENTRY pPrevEntry = NULL; - - if (pTab == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: pTpcReqTab doesn't exist.\n", __FUNCTION__)); - return NULL; - } - - RTMP_SEM_LOCK(&pAd->CommonCfg.TpcReqTabLock); - - HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(DialogToken); - pEntry = pTab->Hash[HashIdx]; - - while (pEntry) - { - if (pEntry->DialogToken == DialogToken) - break; - else - { - pPrevEntry = pEntry; - pEntry = pEntry->pNext; - } - } - - RTMP_SEM_UNLOCK(&pAd->CommonCfg.TpcReqTabLock); - - return pEntry; -} - - -static PTPC_REQ_ENTRY TpcReqInsert( - IN PRTMP_ADAPTER pAd, - IN UINT8 DialogToken) -{ - INT i; - ULONG HashIdx; - PTPC_REQ_TAB pTab = pAd->CommonCfg.pTpcReqTab; - PTPC_REQ_ENTRY pEntry = NULL, pCurrEntry; - ULONG Now; - - if(pTab == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: pTpcReqTab doesn't exist.\n", __FUNCTION__)); - return NULL; - } - - pEntry = TpcReqLookUp(pAd, DialogToken); - if (pEntry == NULL) - { - RTMP_SEM_LOCK(&pAd->CommonCfg.TpcReqTabLock); - for (i = 0; i < MAX_TPC_REQ_TAB_SIZE; i++) - { - NdisGetSystemUpTime(&Now); - pEntry = &pTab->Content[i]; - - if ((pEntry->Valid == TRUE) - && RTMP_TIME_AFTER((unsigned long)Now, (unsigned long)(pEntry->lastTime + TPC_REQ_AGE_OUT))) - { - PTPC_REQ_ENTRY pPrevEntry = NULL; - ULONG HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(pEntry->DialogToken); - PTPC_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx]; - - // update Hash list - do - { - if (pProbeEntry == pEntry) - { - if (pPrevEntry == NULL) - { - pTab->Hash[HashIdx] = pEntry->pNext; - } - else - { - pPrevEntry->pNext = pEntry->pNext; - } - break; - } - - pPrevEntry = pProbeEntry; - pProbeEntry = pProbeEntry->pNext; - } while (pProbeEntry); - - NdisZeroMemory(pEntry, sizeof(TPC_REQ_ENTRY)); - pTab->Size--; - - break; - } - - if (pEntry->Valid == FALSE) - break; - } - - if (i < MAX_TPC_REQ_TAB_SIZE) - { - NdisGetSystemUpTime(&Now); - pEntry->lastTime = Now; - pEntry->Valid = TRUE; - pEntry->DialogToken = DialogToken; - pTab->Size++; - } - else - { - pEntry = NULL; - DBGPRINT(RT_DEBUG_ERROR, ("%s: pTpcReqTab tab full.\n", __FUNCTION__)); - } - - // add this Neighbor entry into HASH table - if (pEntry) - { - HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(DialogToken); - if (pTab->Hash[HashIdx] == NULL) - { - pTab->Hash[HashIdx] = pEntry; - } - else - { - pCurrEntry = pTab->Hash[HashIdx]; - while (pCurrEntry->pNext != NULL) - pCurrEntry = pCurrEntry->pNext; - pCurrEntry->pNext = pEntry; - } - } - - RTMP_SEM_UNLOCK(&pAd->CommonCfg.TpcReqTabLock); - } - - return pEntry; -} - -static VOID TpcReqDelete( - IN PRTMP_ADAPTER pAd, - IN UINT8 DialogToken) -{ - PTPC_REQ_TAB pTab = pAd->CommonCfg.pTpcReqTab; - PTPC_REQ_ENTRY pEntry = NULL; - - if(pTab == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: pTpcReqTab doesn't exist.\n", __FUNCTION__)); - return; - } - - // if empty, return - if (pTab->Size == 0) - { - DBGPRINT(RT_DEBUG_ERROR, ("pTpcReqTab empty.\n")); - return; - } - - pEntry = TpcReqLookUp(pAd, DialogToken); - if (pEntry != NULL) - { - PTPC_REQ_ENTRY pPrevEntry = NULL; - ULONG HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(pEntry->DialogToken); - PTPC_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx]; - - RTMP_SEM_LOCK(&pAd->CommonCfg.TpcReqTabLock); - // update Hash list - do - { - if (pProbeEntry == pEntry) - { - if (pPrevEntry == NULL) - { - pTab->Hash[HashIdx] = pEntry->pNext; - } - else - { - pPrevEntry->pNext = pEntry->pNext; - } - break; - } - - pPrevEntry = pProbeEntry; - pProbeEntry = pProbeEntry->pNext; - } while (pProbeEntry); - - NdisZeroMemory(pEntry, sizeof(TPC_REQ_ENTRY)); - pTab->Size--; - - RTMP_SEM_UNLOCK(&pAd->CommonCfg.TpcReqTabLock); - } - - return; -} - -/* - ========================================================================== - Description: - Get Current TimeS tamp. - - Parametrs: - - Return : Current Time Stamp. - ========================================================================== - */ -static UINT64 GetCurrentTimeStamp( - IN PRTMP_ADAPTER pAd) -{ - // get current time stamp. - return 0; -} - -/* - ========================================================================== - Description: - Get Current Transmit Power. - - Parametrs: - - Return : Current Time Stamp. - ========================================================================== - */ -static UINT8 GetCurTxPwr( - IN PRTMP_ADAPTER pAd, - IN UINT8 Wcid) -{ - return 16; /* 16 dBm */ -} - -/* - ========================================================================== - Description: - Get Current Transmit Power. - - Parametrs: - - Return : Current Time Stamp. - ========================================================================== - */ -VOID InsertChannelRepIE( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN PSTRING pCountry, - IN UINT8 RegulatoryClass) -{ - ULONG TempLen; - UINT8 Len; - UINT8 IEId = IE_AP_CHANNEL_REPORT; - PUCHAR pChListPtr = NULL; - - Len = 1; - if (strncmp(pCountry, "US", 2) == 0) - { - if (RegulatoryClass >= USA_REGULATORY_INFO_SIZE) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: USA Unknow Requlatory class (%d)\n", - __FUNCTION__, RegulatoryClass)); - return; - } - - Len += USARegulatoryInfo[RegulatoryClass].ChannelSet.NumberOfChannels; - pChListPtr = USARegulatoryInfo[RegulatoryClass].ChannelSet.ChannelList; - } - else if (strncmp(pCountry, "JP", 2) == 0) - { - if (RegulatoryClass >= JP_REGULATORY_INFO_SIZE) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: JP Unknow Requlatory class (%d)\n", - __FUNCTION__, RegulatoryClass)); - return; - } - - Len += JapanRegulatoryInfo[RegulatoryClass].ChannelSet.NumberOfChannels; - pChListPtr = JapanRegulatoryInfo[RegulatoryClass].ChannelSet.ChannelList; - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: Unknow Country (%s)\n", - __FUNCTION__, pCountry)); - return; - } - - MakeOutgoingFrame(pFrameBuf, &TempLen, - 1, &IEId, - 1, &Len, - 1, &RegulatoryClass, - Len -1, pChListPtr, - END_OF_ARGS); - - *pFrameLen = *pFrameLen + TempLen; - - return; -} - -/* - ========================================================================== - Description: - Insert Dialog Token into frame. - - Parametrs: - 1. frame buffer pointer. - 2. frame length. - 3. Dialog token. - - Return : None. - ========================================================================== - */ -VOID InsertDialogToken( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 DialogToken) -{ - ULONG TempLen; - MakeOutgoingFrame(pFrameBuf, &TempLen, - 1, &DialogToken, - END_OF_ARGS); - - *pFrameLen = *pFrameLen + TempLen; - - return; -} - -/* - ========================================================================== - Description: - Insert TPC Request IE into frame. - - Parametrs: - 1. frame buffer pointer. - 2. frame length. - - Return : None. - ========================================================================== - */ - static VOID InsertTpcReqIE( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen) -{ - ULONG TempLen; - ULONG Len = 0; - UINT8 ElementID = IE_TPC_REQUEST; - - MakeOutgoingFrame(pFrameBuf, &TempLen, - 1, &ElementID, - 1, &Len, - END_OF_ARGS); - - *pFrameLen = *pFrameLen + TempLen; - - return; -} - -/* - ========================================================================== - Description: - Insert TPC Report IE into frame. - - Parametrs: - 1. frame buffer pointer. - 2. frame length. - 3. Transmit Power. - 4. Link Margin. - - Return : None. - ========================================================================== - */ -VOID InsertTpcReportIE( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 TxPwr, - IN UINT8 LinkMargin) -{ - ULONG TempLen; - ULONG Len = sizeof(TPC_REPORT_INFO); - UINT8 ElementID = IE_TPC_REPORT; - TPC_REPORT_INFO TpcReportIE; - - TpcReportIE.TxPwr = TxPwr; - TpcReportIE.LinkMargin = LinkMargin; - - MakeOutgoingFrame(pFrameBuf, &TempLen, - 1, &ElementID, - 1, &Len, - Len, &TpcReportIE, - END_OF_ARGS); - - *pFrameLen = *pFrameLen + TempLen; - - - return; -} - -/* - ========================================================================== - Description: - Insert Channel Switch Announcement IE into frame. - - Parametrs: - 1. frame buffer pointer. - 2. frame length. - 3. channel switch announcement mode. - 4. new selected channel. - 5. channel switch announcement count. - - Return : None. - ========================================================================== - */ -static VOID InsertChSwAnnIE( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 ChSwMode, - IN UINT8 NewChannel, - IN UINT8 ChSwCnt) -{ - ULONG TempLen; - ULONG Len = sizeof(CH_SW_ANN_INFO); - UINT8 ElementID = IE_CHANNEL_SWITCH_ANNOUNCEMENT; - CH_SW_ANN_INFO ChSwAnnIE; - - ChSwAnnIE.ChSwMode = ChSwMode; - ChSwAnnIE.Channel = NewChannel; - ChSwAnnIE.ChSwCnt = ChSwCnt; - - MakeOutgoingFrame(pFrameBuf, &TempLen, - 1, &ElementID, - 1, &Len, - Len, &ChSwAnnIE, - END_OF_ARGS); - - *pFrameLen = *pFrameLen + TempLen; - - - return; -} - -/* - ========================================================================== - Description: - Insert Measure Request IE into frame. - - Parametrs: - 1. frame buffer pointer. - 2. frame length. - 3. Measure Token. - 4. Measure Request Mode. - 5. Measure Request Type. - 6. Measure Channel. - 7. Measure Start time. - 8. Measure Duration. - - - Return : None. - ========================================================================== - */ -static VOID InsertMeasureReqIE( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 Len, - IN PMEASURE_REQ_INFO pMeasureReqIE) -{ - ULONG TempLen; - UINT8 ElementID = IE_MEASUREMENT_REQUEST; - - MakeOutgoingFrame(pFrameBuf, &TempLen, - 1, &ElementID, - 1, &Len, - sizeof(MEASURE_REQ_INFO), pMeasureReqIE, - END_OF_ARGS); - - *pFrameLen = *pFrameLen + TempLen; - - return; -} - -/* - ========================================================================== - Description: - Insert Measure Report IE into frame. - - Parametrs: - 1. frame buffer pointer. - 2. frame length. - 3. Measure Token. - 4. Measure Request Mode. - 5. Measure Request Type. - 6. Length of Report Infomation - 7. Pointer of Report Infomation Buffer. - - Return : None. - ========================================================================== - */ -static VOID InsertMeasureReportIE( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN PMEASURE_REPORT_INFO pMeasureReportIE, - IN UINT8 ReportLnfoLen, - IN PUINT8 pReportInfo) -{ - ULONG TempLen; - ULONG Len; - UINT8 ElementID = IE_MEASUREMENT_REPORT; - - Len = sizeof(MEASURE_REPORT_INFO) + ReportLnfoLen; - - MakeOutgoingFrame(pFrameBuf, &TempLen, - 1, &ElementID, - 1, &Len, - Len, pMeasureReportIE, - END_OF_ARGS); - - *pFrameLen = *pFrameLen + TempLen; - - if ((ReportLnfoLen > 0) && (pReportInfo != NULL)) - { - MakeOutgoingFrame(pFrameBuf + *pFrameLen, &TempLen, - ReportLnfoLen, pReportInfo, - END_OF_ARGS); - - *pFrameLen = *pFrameLen + TempLen; - } - return; -} - -/* - ========================================================================== - Description: - Prepare Measurement request action frame and enqueue it into - management queue waiting for transmition. - - Parametrs: - 1. the destination mac address of the frame. - - Return : None. - ========================================================================== - */ -VOID MakeMeasurementReqFrame( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pOutBuffer, - OUT PULONG pFrameLen, - IN UINT8 TotalLen, - IN UINT8 Category, - IN UINT8 Action, - IN UINT8 MeasureToken, - IN UINT8 MeasureReqMode, - IN UINT8 MeasureReqType, - IN UINT8 NumOfRepetitions) -{ - ULONG TempLen; - MEASURE_REQ_INFO MeasureReqIE; - - InsertActField(pAd, (pOutBuffer + *pFrameLen), pFrameLen, Category, Action); - - // fill Dialog Token - InsertDialogToken(pAd, (pOutBuffer + *pFrameLen), pFrameLen, MeasureToken); - - /* fill Number of repetitions. */ - if (Category == CATEGORY_RM) - { - MakeOutgoingFrame((pOutBuffer+*pFrameLen), &TempLen, - 2, &NumOfRepetitions, - END_OF_ARGS); - - *pFrameLen += TempLen; - } - - // prepare Measurement IE. - NdisZeroMemory(&MeasureReqIE, sizeof(MEASURE_REQ_INFO)); - MeasureReqIE.Token = MeasureToken; - MeasureReqIE.ReqMode.word = MeasureReqMode; - MeasureReqIE.ReqType = MeasureReqType; - InsertMeasureReqIE(pAd, (pOutBuffer+*pFrameLen), pFrameLen, - TotalLen, &MeasureReqIE); - - return; -} - -/* - ========================================================================== - Description: - Prepare Measurement report action frame and enqueue it into - management queue waiting for transmition. - - Parametrs: - 1. the destination mac address of the frame. - - Return : None. - ========================================================================== - */ -VOID EnqueueMeasurementRep( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UINT8 DialogToken, - IN UINT8 MeasureToken, - IN UINT8 MeasureReqMode, - IN UINT8 MeasureReqType, - IN UINT8 ReportInfoLen, - IN PUINT8 pReportInfo) -{ - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen; - HEADER_802_11 ActHdr; - MEASURE_REPORT_INFO MeasureRepIE; - - // build action frame header. - MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, - pAd->CurrentAddress); - - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __FUNCTION__)); - return; - } - NdisMoveMemory(pOutBuffer, (PCHAR)&ActHdr, sizeof(HEADER_802_11)); - FrameLen = sizeof(HEADER_802_11); - - InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_MRP); - - // fill Dialog Token - InsertDialogToken(pAd, (pOutBuffer + FrameLen), &FrameLen, DialogToken); - - // prepare Measurement IE. - NdisZeroMemory(&MeasureRepIE, sizeof(MEASURE_REPORT_INFO)); - MeasureRepIE.Token = MeasureToken; - MeasureRepIE.ReportMode = MeasureReqMode; - MeasureRepIE.ReportType = MeasureReqType; - InsertMeasureReportIE(pAd, (pOutBuffer + FrameLen), &FrameLen, &MeasureRepIE, ReportInfoLen, pReportInfo); - - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - - return; -} - -/* - ========================================================================== - Description: - Prepare TPC Request action frame and enqueue it into - management queue waiting for transmition. - - Parametrs: - 1. the destination mac address of the frame. - - Return : None. - ========================================================================== - */ -VOID EnqueueTPCReq( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UCHAR DialogToken) -{ - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen; - - HEADER_802_11 ActHdr; - - // build action frame header. - MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, - pAd->CurrentAddress); - - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __FUNCTION__)); - return; - } - NdisMoveMemory(pOutBuffer, (PCHAR)&ActHdr, sizeof(HEADER_802_11)); - FrameLen = sizeof(HEADER_802_11); - - InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_TPCRQ); - - // fill Dialog Token - InsertDialogToken(pAd, (pOutBuffer + FrameLen), &FrameLen, DialogToken); - - // Insert TPC Request IE. - InsertTpcReqIE(pAd, (pOutBuffer + FrameLen), &FrameLen); - - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - - return; -} - -/* - ========================================================================== - Description: - Prepare TPC Report action frame and enqueue it into - management queue waiting for transmition. - - Parametrs: - 1. the destination mac address of the frame. - - Return : None. - ========================================================================== - */ -VOID EnqueueTPCRep( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UINT8 DialogToken, - IN UINT8 TxPwr, - IN UINT8 LinkMargin) -{ - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen; - - HEADER_802_11 ActHdr; - - // build action frame header. - MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, - pAd->CurrentAddress); - - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __FUNCTION__)); - return; - } - NdisMoveMemory(pOutBuffer, (PCHAR)&ActHdr, sizeof(HEADER_802_11)); - FrameLen = sizeof(HEADER_802_11); - - InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_TPCRP); - - // fill Dialog Token - InsertDialogToken(pAd, (pOutBuffer + FrameLen), &FrameLen, DialogToken); - - // Insert TPC Request IE. - InsertTpcReportIE(pAd, (pOutBuffer + FrameLen), &FrameLen, TxPwr, LinkMargin); - - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - - return; -} - -/* - ========================================================================== - Description: - Prepare Channel Switch Announcement action frame and enqueue it into - management queue waiting for transmition. - - Parametrs: - 1. the destination mac address of the frame. - 2. Channel switch announcement mode. - 2. a New selected channel. - - Return : None. - ========================================================================== - */ -VOID EnqueueChSwAnn( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UINT8 ChSwMode, - IN UINT8 NewCh) -{ - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen; - - HEADER_802_11 ActHdr; - - // build action frame header. - MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, - pAd->CurrentAddress); - - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __FUNCTION__)); - return; - } - NdisMoveMemory(pOutBuffer, (PCHAR)&ActHdr, sizeof(HEADER_802_11)); - FrameLen = sizeof(HEADER_802_11); - - InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_CHANNEL_SWITCH); - - InsertChSwAnnIE(pAd, (pOutBuffer + FrameLen), &FrameLen, ChSwMode, NewCh, 0); - - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - - return; -} - -static BOOLEAN DfsRequirementCheck( - IN PRTMP_ADAPTER pAd, - IN UINT8 Channel) -{ - BOOLEAN Result = FALSE; - INT i; - - do - { - // check DFS procedure is running. - // make sure DFS procedure won't start twice. - if (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) - { - Result = FALSE; - break; - } - - // check the new channel carried from Channel Switch Announcemnet is valid. - for (i=0; iChannelListNum; i++) - { - if ((Channel == pAd->ChannelList[i].Channel) - &&(pAd->ChannelList[i].RemainingTimeForUse == 0)) - { - // found radar signal in the channel. the channel can't use at least for 30 minutes. - pAd->ChannelList[i].RemainingTimeForUse = 1800;//30 min = 1800 sec - Result = TRUE; - break; - } - } - } while(FALSE); - - return Result; -} - -VOID NotifyChSwAnnToPeerAPs( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pRA, - IN PUCHAR pTA, - IN UINT8 ChSwMode, - IN UINT8 Channel) -{ -#ifdef WDS_SUPPORT - if (!((pRA[0] & 0xff) == 0xff)) // is pRA a broadcase address. - { - INT i; - // info neighbor APs that Radar signal found throgh WDS link. - for (i = 0; i < MAX_WDS_ENTRY; i++) - { - if (ValidWdsEntry(pAd, i)) - { - PUCHAR pDA = pAd->WdsTab.WdsEntry[i].PeerWdsAddr; - - // DA equal to SA. have no necessary orignal AP which found Radar signal. - if (MAC_ADDR_EQUAL(pTA, pDA)) - continue; - - // send Channel Switch Action frame to info Neighbro APs. - EnqueueChSwAnn(pAd, pDA, ChSwMode, Channel); - } - } - } -#endif // WDS_SUPPORT // -} - -static VOID StartDFSProcedure( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel, - IN UINT8 ChSwMode) -{ - // start DFS procedure - pAd->CommonCfg.Channel = Channel; -#ifdef DOT11_N_SUPPORT - N_ChannelCheck(pAd); -#endif // DOT11_N_SUPPORT // - pAd->CommonCfg.RadarDetect.RDMode = RD_SWITCHING_MODE; - pAd->CommonCfg.RadarDetect.CSCount = 0; -} - -/* - ========================================================================== - Description: - Channel Switch Announcement action frame sanity check. - - Parametrs: - 1. MLME message containing the received frame - 2. message length. - 3. Channel switch announcement infomation buffer. - - - Return : None. - ========================================================================== - */ - -/* - Channel Switch Announcement IE. - +----+-----+-----------+------------+-----------+ - | ID | Len |Ch Sw Mode | New Ch Num | Ch Sw Cnt | - +----+-----+-----------+------------+-----------+ - 1 1 1 1 1 -*/ -static BOOLEAN PeerChSwAnnSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PCH_SW_ANN_INFO pChSwAnnInfo) -{ - PFRAME_802_11 Fr = (PFRAME_802_11)pMsg; - PUCHAR pFramePtr = Fr->Octet; - BOOLEAN result = FALSE; - PEID_STRUCT eid_ptr; - - // skip 802.11 header. - MsgLen -= sizeof(HEADER_802_11); - - // skip category and action code. - pFramePtr += 2; - MsgLen -= 2; - - if (pChSwAnnInfo == NULL) - return result; - - eid_ptr = (PEID_STRUCT)pFramePtr; - while (((UCHAR*)eid_ptr + eid_ptr->Len + 1) < ((PUCHAR)pFramePtr + MsgLen)) - { - switch(eid_ptr->Eid) - { - case IE_CHANNEL_SWITCH_ANNOUNCEMENT: - NdisMoveMemory(&pChSwAnnInfo->ChSwMode, eid_ptr->Octet, 1); - NdisMoveMemory(&pChSwAnnInfo->Channel, eid_ptr->Octet + 1, 1); - NdisMoveMemory(&pChSwAnnInfo->ChSwCnt, eid_ptr->Octet + 2, 1); - - result = TRUE; - break; - - default: - break; - } - eid_ptr = (PEID_STRUCT)((UCHAR*)eid_ptr + 2 + eid_ptr->Len); - } - - return result; -} - -/* - ========================================================================== - Description: - Measurement request action frame sanity check. - - Parametrs: - 1. MLME message containing the received frame - 2. message length. - 3. Measurement request infomation buffer. - - Return : None. - ========================================================================== - */ -static BOOLEAN PeerMeasureReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PUINT8 pDialogToken, - OUT PMEASURE_REQ_INFO pMeasureReqInfo, - OUT PMEASURE_REQ pMeasureReq) -{ - PFRAME_802_11 Fr = (PFRAME_802_11)pMsg; - PUCHAR pFramePtr = Fr->Octet; - BOOLEAN result = FALSE; - PEID_STRUCT eid_ptr; - PUCHAR ptr; - UINT64 MeasureStartTime; - UINT16 MeasureDuration; - - // skip 802.11 header. - MsgLen -= sizeof(HEADER_802_11); - - // skip category and action code. - pFramePtr += 2; - MsgLen -= 2; - - if (pMeasureReqInfo == NULL) - return result; - - NdisMoveMemory(pDialogToken, pFramePtr, 1); - pFramePtr += 1; - MsgLen -= 1; - - eid_ptr = (PEID_STRUCT)pFramePtr; - while (((UCHAR*)eid_ptr + eid_ptr->Len + 1) < ((PUCHAR)pFramePtr + MsgLen)) - { - switch(eid_ptr->Eid) - { - case IE_MEASUREMENT_REQUEST: - NdisMoveMemory(&pMeasureReqInfo->Token, eid_ptr->Octet, 1); - NdisMoveMemory(&pMeasureReqInfo->ReqMode.word, eid_ptr->Octet + 1, 1); - NdisMoveMemory(&pMeasureReqInfo->ReqType, eid_ptr->Octet + 2, 1); - ptr = (PUCHAR)(eid_ptr->Octet + 3); - NdisMoveMemory(&pMeasureReq->ChNum, ptr, 1); - NdisMoveMemory(&MeasureStartTime, ptr + 1, 8); - pMeasureReq->MeasureStartTime = SWAP64(MeasureStartTime); - NdisMoveMemory(&MeasureDuration, ptr + 9, 2); - pMeasureReq->MeasureDuration = SWAP16(MeasureDuration); - - result = TRUE; - break; - - default: - break; - } - eid_ptr = (PEID_STRUCT)((UCHAR*)eid_ptr + 2 + eid_ptr->Len); - } - - return result; -} - -/* - ========================================================================== - Description: - Measurement report action frame sanity check. - - Parametrs: - 1. MLME message containing the received frame - 2. message length. - 3. Measurement report infomation buffer. - 4. basic report infomation buffer. - - Return : None. - ========================================================================== - */ - -/* - Measurement Report IE. - +----+-----+-------+-------------+--------------+----------------+ - | ID | Len | Token | Report Mode | Measure Type | Measure Report | - +----+-----+-------+-------------+--------------+----------------+ - 1 1 1 1 1 variable - - Basic Report. - +--------+------------+----------+-----+ - | Ch Num | Start Time | Duration | Map | - +--------+------------+----------+-----+ - 1 8 2 1 - - Map Field Bit Format. - +-----+---------------+---------------------+-------+------------+----------+ - | Bss | OFDM Preamble | Unidentified signal | Radar | Unmeasured | Reserved | - +-----+---------------+---------------------+-------+------------+----------+ - 0 1 2 3 4 5-7 -*/ -static BOOLEAN PeerMeasureReportSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PUINT8 pDialogToken, - OUT PMEASURE_REPORT_INFO pMeasureReportInfo, - OUT PUINT8 pReportBuf) -{ - PFRAME_802_11 Fr = (PFRAME_802_11)pMsg; - PUCHAR pFramePtr = Fr->Octet; - BOOLEAN result = FALSE; - PEID_STRUCT eid_ptr; - PUCHAR ptr; - - // skip 802.11 header. - MsgLen -= sizeof(HEADER_802_11); - - // skip category and action code. - pFramePtr += 2; - MsgLen -= 2; - - if (pMeasureReportInfo == NULL) - return result; - - NdisMoveMemory(pDialogToken, pFramePtr, 1); - pFramePtr += 1; - MsgLen -= 1; - - eid_ptr = (PEID_STRUCT)pFramePtr; - while (((UCHAR*)eid_ptr + eid_ptr->Len + 1) < ((PUCHAR)pFramePtr + MsgLen)) - { - switch(eid_ptr->Eid) - { - case IE_MEASUREMENT_REPORT: - NdisMoveMemory(&pMeasureReportInfo->Token, eid_ptr->Octet, 1); - NdisMoveMemory(&pMeasureReportInfo->ReportMode, eid_ptr->Octet + 1, 1); - NdisMoveMemory(&pMeasureReportInfo->ReportType, eid_ptr->Octet + 2, 1); - if (pMeasureReportInfo->ReportType == RM_BASIC) - { - PMEASURE_BASIC_REPORT pReport = (PMEASURE_BASIC_REPORT)pReportBuf; - ptr = (PUCHAR)(eid_ptr->Octet + 3); - NdisMoveMemory(&pReport->ChNum, ptr, 1); - NdisMoveMemory(&pReport->MeasureStartTime, ptr + 1, 8); - NdisMoveMemory(&pReport->MeasureDuration, ptr + 9, 2); - NdisMoveMemory(&pReport->Map, ptr + 11, 1); - - } - else if (pMeasureReportInfo->ReportType == RM_CCA) - { - PMEASURE_CCA_REPORT pReport = (PMEASURE_CCA_REPORT)pReportBuf; - ptr = (PUCHAR)(eid_ptr->Octet + 3); - NdisMoveMemory(&pReport->ChNum, ptr, 1); - NdisMoveMemory(&pReport->MeasureStartTime, ptr + 1, 8); - NdisMoveMemory(&pReport->MeasureDuration, ptr + 9, 2); - NdisMoveMemory(&pReport->CCA_Busy_Fraction, ptr + 11, 1); - - } - else if (pMeasureReportInfo->ReportType == RM_RPI_HISTOGRAM) - { - PMEASURE_RPI_REPORT pReport = (PMEASURE_RPI_REPORT)pReportBuf; - ptr = (PUCHAR)(eid_ptr->Octet + 3); - NdisMoveMemory(&pReport->ChNum, ptr, 1); - NdisMoveMemory(&pReport->MeasureStartTime, ptr + 1, 8); - NdisMoveMemory(&pReport->MeasureDuration, ptr + 9, 2); - NdisMoveMemory(&pReport->RPI_Density, ptr + 11, 8); - } - result = TRUE; - break; - - default: - break; - } - eid_ptr = (PEID_STRUCT)((UCHAR*)eid_ptr + 2 + eid_ptr->Len); - } - - return result; -} - -/* - ========================================================================== - Description: - TPC Request action frame sanity check. - - Parametrs: - 1. MLME message containing the received frame - 2. message length. - 3. Dialog Token. - - Return : None. - ========================================================================== - */ -static BOOLEAN PeerTpcReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PUINT8 pDialogToken) -{ - PFRAME_802_11 Fr = (PFRAME_802_11)pMsg; - PUCHAR pFramePtr = Fr->Octet; - BOOLEAN result = FALSE; - PEID_STRUCT eid_ptr; - - MsgLen -= sizeof(HEADER_802_11); - - // skip category and action code. - pFramePtr += 2; - MsgLen -= 2; - - if (pDialogToken == NULL) - return result; - - NdisMoveMemory(pDialogToken, pFramePtr, 1); - pFramePtr += 1; - MsgLen -= 1; - - eid_ptr = (PEID_STRUCT)pFramePtr; - while (((UCHAR*)eid_ptr + eid_ptr->Len + 1) < ((PUCHAR)pFramePtr + MsgLen)) - { - switch(eid_ptr->Eid) - { - case IE_TPC_REQUEST: - result = TRUE; - break; - - default: - break; - } - eid_ptr = (PEID_STRUCT)((UCHAR*)eid_ptr + 2 + eid_ptr->Len); - } - - return result; -} - -/* - ========================================================================== - Description: - TPC Report action frame sanity check. - - Parametrs: - 1. MLME message containing the received frame - 2. message length. - 3. Dialog Token. - 4. TPC Report IE. - - Return : None. - ========================================================================== - */ -static BOOLEAN PeerTpcRepSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PUINT8 pDialogToken, - OUT PTPC_REPORT_INFO pTpcRepInfo) -{ - PFRAME_802_11 Fr = (PFRAME_802_11)pMsg; - PUCHAR pFramePtr = Fr->Octet; - BOOLEAN result = FALSE; - PEID_STRUCT eid_ptr; - - MsgLen -= sizeof(HEADER_802_11); - - // skip category and action code. - pFramePtr += 2; - MsgLen -= 2; - - if (pDialogToken == NULL) - return result; - - NdisMoveMemory(pDialogToken, pFramePtr, 1); - pFramePtr += 1; - MsgLen -= 1; - - eid_ptr = (PEID_STRUCT)pFramePtr; - while (((UCHAR*)eid_ptr + eid_ptr->Len + 1) < ((PUCHAR)pFramePtr + MsgLen)) - { - switch(eid_ptr->Eid) - { - case IE_TPC_REPORT: - NdisMoveMemory(&pTpcRepInfo->TxPwr, eid_ptr->Octet, 1); - NdisMoveMemory(&pTpcRepInfo->LinkMargin, eid_ptr->Octet + 1, 1); - result = TRUE; - break; - - default: - break; - } - eid_ptr = (PEID_STRUCT)((UCHAR*)eid_ptr + 2 + eid_ptr->Len); - } - - return result; -} - -/* - ========================================================================== - Description: - Channel Switch Announcement action frame handler. - - Parametrs: - Elme - MLME message containing the received frame - - Return : None. - ========================================================================== - */ -static VOID PeerChSwAnnAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - CH_SW_ANN_INFO ChSwAnnInfo; - PFRAME_802_11 pFr = (PFRAME_802_11)Elem->Msg; -#ifdef CONFIG_STA_SUPPORT - UCHAR index = 0, Channel = 0, NewChannel = 0; - ULONG Bssidx = 0; -#endif // CONFIG_STA_SUPPORT // - - NdisZeroMemory(&ChSwAnnInfo, sizeof(CH_SW_ANN_INFO)); - if (! PeerChSwAnnSanity(pAd, Elem->Msg, Elem->MsgLen, &ChSwAnnInfo)) - { - DBGPRINT(RT_DEBUG_TRACE, ("Invalid Channel Switch Action Frame.\n")); - return; - } - - -#ifdef CONFIG_STA_SUPPORT - if (pAd->OpMode == OPMODE_STA) - { - Bssidx = BssTableSearch(&pAd->ScanTab, pFr->Hdr.Addr3, pAd->CommonCfg.Channel); - if (Bssidx == BSS_NOT_FOUND) - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerChSwAnnAction - Bssidx is not found\n")); - return; - } - - DBGPRINT(RT_DEBUG_TRACE, ("\n****Bssidx is %d, Channel = %d\n", index, pAd->ScanTab.BssEntry[Bssidx].Channel)); - hex_dump("SSID",pAd->ScanTab.BssEntry[Bssidx].Bssid ,6); - - Channel = pAd->CommonCfg.Channel; - NewChannel = ChSwAnnInfo.Channel; - - if ((pAd->CommonCfg.bIEEE80211H == 1) && (NewChannel != 0) && (Channel != NewChannel)) - { - // Switching to channel 1 can prevent from rescanning the current channel immediately (by auto reconnection). - // In addition, clear the MLME queue and the scan table to discard the RX packets and previous scanning results. - AsicSwitchChannel(pAd, 1, FALSE); - AsicLockChannel(pAd, 1); - LinkDown(pAd, FALSE); - MlmeQueueInit(&pAd->Mlme.Queue); - BssTableInit(&pAd->ScanTab); - RTMPusecDelay(1000000); // use delay to prevent STA do reassoc - - // channel sanity check - for (index = 0 ; index < pAd->ChannelListNum; index++) - { - if (pAd->ChannelList[index].Channel == NewChannel) - { - pAd->ScanTab.BssEntry[Bssidx].Channel = NewChannel; - pAd->CommonCfg.Channel = NewChannel; - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - DBGPRINT(RT_DEBUG_TRACE, ("&&&&&&&&&&&&&&&&PeerChSwAnnAction - STA receive channel switch announcement IE (New Channel =%d)\n", NewChannel)); - break; - } - } - - if (index >= pAd->ChannelListNum) - { - DBGPRINT_ERR(("&&&&&&&&&&&&&&&&&&&&&&&&&&PeerChSwAnnAction(can not find New Channel=%d in ChannelList[%d]\n", pAd->CommonCfg.Channel, pAd->ChannelListNum)); - } - } - } -#endif // CONFIG_STA_SUPPORT // - - return; -} - - -/* - ========================================================================== - Description: - Measurement Request action frame handler. - - Parametrs: - Elme - MLME message containing the received frame - - Return : None. - ========================================================================== - */ -static VOID PeerMeasureReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - PFRAME_802_11 pFr = (PFRAME_802_11)Elem->Msg; - UINT8 DialogToken; - MEASURE_REQ_INFO MeasureReqInfo; - MEASURE_REQ MeasureReq; - MEASURE_REPORT_MODE ReportMode; - - if(PeerMeasureReqSanity(pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &MeasureReqInfo, &MeasureReq)) - { - ReportMode.word = 0; - ReportMode.field.Incapable = 1; - EnqueueMeasurementRep(pAd, pFr->Hdr.Addr2, DialogToken, MeasureReqInfo.Token, ReportMode.word, MeasureReqInfo.ReqType, 0, NULL); - } - - return; -} - -/* - ========================================================================== - Description: - Measurement Report action frame handler. - - Parametrs: - Elme - MLME message containing the received frame - - Return : None. - ========================================================================== - */ -static VOID PeerMeasureReportAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - MEASURE_REPORT_INFO MeasureReportInfo; - PFRAME_802_11 pFr = (PFRAME_802_11)Elem->Msg; - UINT8 DialogToken; - PUINT8 pMeasureReportInfo; - -// if (pAd->CommonCfg.bIEEE80211H != TRUE) -// return; - - if ((pMeasureReportInfo = kmalloc(sizeof(MEASURE_RPI_REPORT), GFP_ATOMIC)) == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s unable to alloc memory for measure report buffer (size=%d).\n", __FUNCTION__, sizeof(MEASURE_RPI_REPORT))); - return; - } - - NdisZeroMemory(&MeasureReportInfo, sizeof(MEASURE_REPORT_INFO)); - NdisZeroMemory(pMeasureReportInfo, sizeof(MEASURE_RPI_REPORT)); - if (PeerMeasureReportSanity(pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &MeasureReportInfo, pMeasureReportInfo)) - { - do { - PMEASURE_REQ_ENTRY pEntry = NULL; - - // Not a autonomous measure report. - // check the dialog token field. drop it if the dialog token doesn't match. - if ((DialogToken != 0) - && ((pEntry = MeasureReqLookUp(pAd, DialogToken)) == NULL)) - break; - - if (pEntry != NULL) - MeasureReqDelete(pAd, pEntry->DialogToken); - - if (MeasureReportInfo.ReportType == RM_BASIC) - { - PMEASURE_BASIC_REPORT pBasicReport = (PMEASURE_BASIC_REPORT)pMeasureReportInfo; - if ((pBasicReport->Map.field.Radar) - && (DfsRequirementCheck(pAd, pBasicReport->ChNum) == TRUE)) - { - NotifyChSwAnnToPeerAPs(pAd, pFr->Hdr.Addr1, pFr->Hdr.Addr2, 1, pBasicReport->ChNum); - StartDFSProcedure(pAd, pBasicReport->ChNum, 1); - } - } - } while (FALSE); - } - else - DBGPRINT(RT_DEBUG_TRACE, ("Invalid Measurement Report Frame.\n")); - - kfree(pMeasureReportInfo); - - return; -} - -/* - ========================================================================== - Description: - TPC Request action frame handler. - - Parametrs: - Elme - MLME message containing the received frame - - Return : None. - ========================================================================== - */ -static VOID PeerTpcReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - PFRAME_802_11 pFr = (PFRAME_802_11)Elem->Msg; - PUCHAR pFramePtr = pFr->Octet; - UINT8 DialogToken; - UINT8 TxPwr = GetCurTxPwr(pAd, Elem->Wcid); - UINT8 LinkMargin = 0; - CHAR RealRssi; - - // link margin: Ratio of the received signal power to the minimum desired by the station (STA). The - // STA may incorporate rate information and channel conditions, including interference, into its computation - // of link margin. - - RealRssi = RTMPMaxRssi(pAd, ConvertToRssi(pAd, Elem->Rssi0, RSSI_0), - ConvertToRssi(pAd, Elem->Rssi1, RSSI_1), - ConvertToRssi(pAd, Elem->Rssi2, RSSI_2)); - - // skip Category and action code. - pFramePtr += 2; - - // Dialog token. - NdisMoveMemory(&DialogToken, pFramePtr, 1); - - LinkMargin = (RealRssi / MIN_RCV_PWR); - if (PeerTpcReqSanity(pAd, Elem->Msg, Elem->MsgLen, &DialogToken)) - EnqueueTPCRep(pAd, pFr->Hdr.Addr2, DialogToken, TxPwr, LinkMargin); - - return; -} - -/* - ========================================================================== - Description: - TPC Report action frame handler. - - Parametrs: - Elme - MLME message containing the received frame - - Return : None. - ========================================================================== - */ -static VOID PeerTpcRepAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UINT8 DialogToken; - TPC_REPORT_INFO TpcRepInfo; - PTPC_REQ_ENTRY pEntry = NULL; - - NdisZeroMemory(&TpcRepInfo, sizeof(TPC_REPORT_INFO)); - if (PeerTpcRepSanity(pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &TpcRepInfo)) - { - if ((pEntry = TpcReqLookUp(pAd, DialogToken)) != NULL) - { - TpcReqDelete(pAd, pEntry->DialogToken); - DBGPRINT(RT_DEBUG_TRACE, ("%s: DialogToken=%x, TxPwr=%d, LinkMargin=%d\n", - __FUNCTION__, DialogToken, TpcRepInfo.TxPwr, TpcRepInfo.LinkMargin)); - } - } - - return; -} - -/* - ========================================================================== - Description: - Spectrun action frames Handler such as channel switch annoucement, - measurement report, measurement request actions frames. - - Parametrs: - Elme - MLME message containing the received frame - - Return : None. - ========================================================================== - */ -VOID PeerSpectrumAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - - UCHAR Action = Elem->Msg[LENGTH_802_11+1]; - - if (pAd->CommonCfg.bIEEE80211H != TRUE) - return; - - switch(Action) - { - case SPEC_MRQ: - // current rt2860 unable do such measure specified in Measurement Request. - // reject all measurement request. - PeerMeasureReqAction(pAd, Elem); - break; - - case SPEC_MRP: - PeerMeasureReportAction(pAd, Elem); - break; - - case SPEC_TPCRQ: - PeerTpcReqAction(pAd, Elem); - break; - - case SPEC_TPCRP: - PeerTpcRepAction(pAd, Elem); - break; - - case SPEC_CHANNEL_SWITCH: - -#ifdef DOT11N_DRAFT3 - { - SEC_CHA_OFFSET_IE Secondary; - CHA_SWITCH_ANNOUNCE_IE ChannelSwitch; - - // 802.11h only has Channel Switch Announcement IE. - RTMPMoveMemory(&ChannelSwitch, &Elem->Msg[LENGTH_802_11+4], sizeof (CHA_SWITCH_ANNOUNCE_IE)); - - // 802.11n D3.03 adds secondary channel offset element in the end. - if (Elem->MsgLen == (LENGTH_802_11 + 2 + sizeof (CHA_SWITCH_ANNOUNCE_IE) + sizeof (SEC_CHA_OFFSET_IE))) - { - RTMPMoveMemory(&Secondary, &Elem->Msg[LENGTH_802_11+9], sizeof (SEC_CHA_OFFSET_IE)); - } - else - { - Secondary.SecondaryChannelOffset = 0; - } - - if ((Elem->Msg[LENGTH_802_11+2] == IE_CHANNEL_SWITCH_ANNOUNCEMENT) && (Elem->Msg[LENGTH_802_11+3] == 3)) - { - ChannelSwitchAction(pAd, Elem->Wcid, ChannelSwitch.NewChannel, Secondary.SecondaryChannelOffset); - } - } -#endif // DOT11N_DRAFT3 // - - PeerChSwAnnAction(pAd, Elem); - break; - } - - return; -} - -/* - ========================================================================== - Description: - - Parametrs: - - Return : None. - ========================================================================== - */ -INT Set_MeasureReq_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UINT Aid = 1; - UINT ArgIdx; - PSTRING thisChar; - - MEASURE_REQ_MODE MeasureReqMode; - UINT8 MeasureReqToken = RandomByte(pAd); - UINT8 MeasureReqType = RM_BASIC; - UINT8 MeasureCh = 1; - UINT64 MeasureStartTime = GetCurrentTimeStamp(pAd); - MEASURE_REQ MeasureReq; - UINT8 TotalLen; - - HEADER_802_11 ActHdr; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen; - - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __FUNCTION__)); - goto END_OF_MEASURE_REQ; - } - - ArgIdx = 1; - while ((thisChar = strsep((char **)&arg, "-")) != NULL) - { - switch(ArgIdx) - { - case 1: // Aid. - Aid = (UINT8) simple_strtol(thisChar, 0, 16); - break; - - case 2: // Measurement Request Type. - MeasureReqType = simple_strtol(thisChar, 0, 16); - if (MeasureReqType > 3) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: unknow MeasureReqType(%d)\n", __FUNCTION__, MeasureReqType)); - goto END_OF_MEASURE_REQ; - } - break; - - case 3: // Measurement channel. - MeasureCh = (UINT8) simple_strtol(thisChar, 0, 16); - break; - } - ArgIdx++; - } - - DBGPRINT(RT_DEBUG_TRACE, ("%s::Aid = %d, MeasureReqType=%d MeasureCh=%d\n", __FUNCTION__, Aid, MeasureReqType, MeasureCh)); - if (!VALID_WCID(Aid)) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: unknow sta of Aid(%d)\n", __FUNCTION__, Aid)); - goto END_OF_MEASURE_REQ; - } - - MeasureReqMode.word = 0; - MeasureReqMode.field.Enable = 1; - - MeasureReqInsert(pAd, MeasureReqToken); - - // build action frame header. - MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pAd->MacTab.Content[Aid].Addr, - pAd->CurrentAddress); - - NdisMoveMemory(pOutBuffer, (PCHAR)&ActHdr, sizeof(HEADER_802_11)); - FrameLen = sizeof(HEADER_802_11); - - TotalLen = sizeof(MEASURE_REQ_INFO) + sizeof(MEASURE_REQ); - - MakeMeasurementReqFrame(pAd, pOutBuffer, &FrameLen, - sizeof(MEASURE_REQ_INFO), CATEGORY_RM, RM_BASIC, - MeasureReqToken, MeasureReqMode.word, - MeasureReqType, 0); - - MeasureReq.ChNum = MeasureCh; - MeasureReq.MeasureStartTime = cpu2le64(MeasureStartTime); - MeasureReq.MeasureDuration = cpu2le16(2000); - - { - ULONG TempLen; - MakeOutgoingFrame( pOutBuffer+FrameLen, &TempLen, - sizeof(MEASURE_REQ), &MeasureReq, - END_OF_ARGS); - FrameLen += TempLen; - } - - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, (UINT)FrameLen); - -END_OF_MEASURE_REQ: - MlmeFreeMemory(pAd, pOutBuffer); - - return TRUE; -} - -INT Set_TpcReq_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UINT Aid; - - UINT8 TpcReqToken = RandomByte(pAd); - - Aid = (UINT) simple_strtol(arg, 0, 16); - - DBGPRINT(RT_DEBUG_TRACE, ("%s::Aid = %d\n", __FUNCTION__, Aid)); - if (!VALID_WCID(Aid)) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: unknow sta of Aid(%d)\n", __FUNCTION__, Aid)); - return TRUE; - } - - TpcReqInsert(pAd, TpcReqToken); - - EnqueueTPCReq(pAd, pAd->MacTab.Content[Aid].Addr, TpcReqToken); - - return TRUE; -} diff --git a/drivers/staging/rt3090/config.mk b/drivers/staging/rt3090/config.mk deleted file mode 100644 index db4057121031..000000000000 --- a/drivers/staging/rt3090/config.mk +++ /dev/null @@ -1,187 +0,0 @@ -# Support ATE function -HAS_ATE=n - -# Support 28xx QA ATE function -HAS_28xx_QA=n - - -HAS_NINTENDO=n - -# Support LLTD function -HAS_LLTD=n - -# Support WDS function -HAS_WDS=n - -# Support AP-Client function -HAS_APCLI=n - -# Support Wpa_Supplicant -HAS_WPA_SUPPLICANT=y - -# Support Native WpaSupplicant for Network Maganger -HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y - -#Support Net interface block while Tx-Sw queue full -HAS_BLOCK_NET_IF=n - -#Support IGMP-Snooping function. -HAS_IGMP_SNOOP_SUPPORT=n - -#Support DFS function -HAS_DFS_SUPPORT=n - -#Support Carrier-Sense function -HAS_CS_SUPPORT=n - -# Support for STA Ethernet Converter -HAS_ETH_CONVERT_SUPPORT=n - -# Support user specific transmit rate of Multicast packet. -HAS_MCAST_RATE_SPECIFIC_SUPPORT=n - -# Support for Multiple Cards -HAS_MC_SUPPORT=n - -#Support for PCI-MSI -HAS_MSI_SUPPORT=n - - -#Support for IEEE802.11e DLS -HAS_QOS_DLS_SUPPORT=n - -#Support for EXT_CHANNEL -HAS_EXT_BUILD_CHANNEL_LIST=n - -#Support for IDS -HAS_IDS_SUPPORT=n - - -#Support for Net-SNMP -HAS_SNMP_SUPPORT=n - -#Support features of 802.11n Draft3 -HAS_DOT11N_DRAFT3_SUPPORT=n - -#Support features of Single SKU. -HAS_SINGLE_SKU_SUPPORT=n - -#Support features of 802.11n -HAS_DOT11_N_SUPPORT=y - - - -#Support for 2860/2880 co-exist -HAS_RT2880_RT2860_COEXIST=n - -HAS_KTHREAD_SUPPORT=n - - -#Support for Auto channel select enhance -HAS_AUTO_CH_SELECT_ENHANCE=n - -#Support bypass bridge -HAS_BG_FT_SUPPORT=n - -#Support Antenna Diversity -HAS_ANTENNA_DIVERSITY_SUPPORT=n -################################################# - -WFLAGS := -DAGGREGATION_SUPPORT -DPIGGYBACK_SUPPORT -DWMM_SUPPORT -DLINUX -Wall -Wstrict-prototypes -Wno-trigraphs -Wpointer-sign - -ifeq ($(HAS_KTHREAD_SUPPORT),y) -WFLAGS += -DKTHREAD_SUPPORT -endif - - -################################################# - -# config for STA mode - -WFLAGS += -DCONFIG_STA_SUPPORT -DDBG - -ifeq ($(HAS_WPA_SUPPLICANT),y) -WFLAGS += -DWPA_SUPPLICANT_SUPPORT -ifeq ($(HAS_NATIVE_WPA_SUPPLICANT_SUPPORT),y) -WFLAGS += -DNATIVE_WPA_SUPPLICANT_SUPPORT -endif -endif - - -ifeq ($(HAS_ETH_CONVERT_SUPPORT), y) -WFLAGS += -DETH_CONVERT_SUPPORT -DMAT_SUPPORT -endif - -ifeq ($(HAS_ATE),y) -WFLAGS += -DRALINK_ATE -ifeq ($(HAS_28xx_QA),y) -WFLAGS += -DRALINK_28xx_QA -endif -endif - - -ifeq ($(HAS_SNMP_SUPPORT),y) -WFLAGS += -DSNMP_SUPPORT -endif - -ifeq ($(HAS_QOS_DLS_SUPPORT),y) -WFLAGS += -DQOS_DLS_SUPPORT -endif - -ifeq ($(HAS_DOT11_N_SUPPORT),y) -WFLAGS += -DDOT11_N_SUPPORT -endif - -ifeq ($(HAS_CS_SUPPORT),y) -WFLAGS += -DCARRIER_DETECTION_SUPPORT -endif - -ifeq ($(HAS_ANTENNA_DIVERSITY_SUPPORT),y) -WFLAGS += -DANT_DIVERSITY_SUPPORT -endif - -################################################# - -################################################# - -# -# Common compiler flag -# - - - - - -ifeq ($(HAS_EXT_BUILD_CHANNEL_LIST),y) -WFLAGS += -DEXT_BUILD_CHANNEL_LIST -endif - -ifeq ($(HAS_IDS_SUPPORT),y) -WFLAGS += -DIDS_SUPPORT -endif - - -################################################# -# ChipSet specific definitions. -# -WFLAGS +=-DRTMP_MAC_PCI -DRT30xx -DRT3090 -DRTMP_PCI_SUPPORT -DRTMP_RF_RW_SUPPORT -DRTMP_EFUSE_SUPPORT -################################################# - - -ifeq ($(HAS_BLOCK_NET_IF),y) -WFLAGS += -DBLOCK_NET_IF -endif - -ifeq ($(HAS_DFS_SUPPORT),y) -WFLAGS += -DDFS_SUPPORT -endif - -ifeq ($(HAS_MC_SUPPORT),y) -WFLAGS += -DMULTIPLE_CARD_SUPPORT -endif - -ifeq ($(HAS_LLTD),y) -WFLAGS += -DLLTD_SUPPORT -endif - -EXTRA_CFLAGS := $(WFLAGS) diff --git a/drivers/staging/rt3090/crypt_hmac.h b/drivers/staging/rt3090/crypt_hmac.h deleted file mode 100644 index 557ca733d398..000000000000 --- a/drivers/staging/rt3090/crypt_hmac.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - crypt_hmac.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Eddy 2008/11/24 Create HMAC-SHA1, HMAC-SHA256 -*/ - -#ifndef __CRYPT_HMAC_H__ -#define __CRYPT_HMAC_H__ - -#ifdef CRYPT_TESTPLAN -#include "crypt_testplan.h" -#else -#include "rt_config.h" -#endif /* CRYPT_TESTPLAN */ - -#ifdef SHA1_SUPPORT -#define HMAC_SHA1_SUPPORT -VOID HMAC_SHA1 ( - IN const UINT8 Key[], - IN UINT KeyLen, - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 MAC[], - IN UINT MACLen); -#endif /* SHA1_SUPPORT */ - -#ifdef SHA256_SUPPORT -#define HMAC_SHA256_SUPPORT -VOID HMAC_SHA256 ( - IN const UINT8 Key[], - IN UINT KeyLen, - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 MAC[], - IN UINT MACLen); -#endif /* SHA256_SUPPORT */ - -#ifdef MD5_SUPPORT -#define HMAC_MD5_SUPPORT -VOID HMAC_MD5 ( - IN const UINT8 Key[], - IN UINT KeyLen, - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 MAC[], - IN UINT MACLen); -#endif /* MD5_SUPPORT */ - -#endif /* __CRYPT_HMAC_H__ */ diff --git a/drivers/staging/rt3090/crypt_md5.h b/drivers/staging/rt3090/crypt_md5.h deleted file mode 100644 index 7ee3f4233fad..000000000000 --- a/drivers/staging/rt3090/crypt_md5.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - crypt_md5.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Eddy 2008/11/24 Create md5 -*/ - -#ifndef __CRYPT_MD5_H__ -#define __CRYPT_MD5_H__ - -#ifdef CRYPT_TESTPLAN -#include "crypt_testplan.h" -#else -#include "rt_config.h" -#endif /* CRYPT_TESTPLAN */ - -/* Algorithm options */ -#define MD5_SUPPORT - -#ifdef MD5_SUPPORT -#define MD5_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ -#define MD5_DIGEST_SIZE 16 /* 128 bits = 16 bytes */ -typedef struct { - UINT32 HashValue[4]; - UINT64 MessageLen; - UINT8 Block[MD5_BLOCK_SIZE]; - UINT BlockLen; -} MD5_CTX_STRUC, *PMD5_CTX_STRUC; - -VOID MD5_Init ( - IN MD5_CTX_STRUC *pMD5_CTX); -VOID MD5_Hash ( - IN MD5_CTX_STRUC *pMD5_CTX); -VOID MD5_Append ( - IN MD5_CTX_STRUC *pMD5_CTX, - IN const UINT8 Message[], - IN UINT MessageLen); -VOID MD5_End ( - IN MD5_CTX_STRUC *pMD5_CTX, - OUT UINT8 DigestMessage[]); -VOID RT_MD5 ( - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 DigestMessage[]); -#endif /* MD5_SUPPORT */ - -#endif /* __CRYPT_MD5_H__ */ diff --git a/drivers/staging/rt3090/crypt_sha2.h b/drivers/staging/rt3090/crypt_sha2.h deleted file mode 100644 index 85c0403d725a..000000000000 --- a/drivers/staging/rt3090/crypt_sha2.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - crypt_sha2.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Eddy 2008/11/24 Create SHA1 - Eddy 2008/07/23 Create SHA256 -*/ - -#ifndef __CRYPT_SHA2_H__ -#define __CRYPT_SHA2_H__ - -#ifdef CRYPT_TESTPLAN -#include "crypt_testplan.h" -#else -#include "rt_config.h" -#endif /* CRYPT_TESTPLAN */ - -/* Algorithm options */ -#define SHA1_SUPPORT -#define SHA256_SUPPORT - -#ifdef SHA1_SUPPORT -#define SHA1_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ -#define SHA1_DIGEST_SIZE 20 /* 160 bits = 20 bytes */ -typedef struct _SHA1_CTX_STRUC { - UINT32 HashValue[5]; /* 5 = (SHA1_DIGEST_SIZE / 32) */ - UINT64 MessageLen; /* total size */ - UINT8 Block[SHA1_BLOCK_SIZE]; - UINT BlockLen; -} SHA1_CTX_STRUC, *PSHA1_CTX_STRUC; - -VOID SHA1_Init ( - IN SHA1_CTX_STRUC *pSHA_CTX); -VOID SHA1_Hash ( - IN SHA1_CTX_STRUC *pSHA_CTX); -VOID SHA1_Append ( - IN SHA1_CTX_STRUC *pSHA_CTX, - IN const UINT8 Message[], - IN UINT MessageLen); -VOID SHA1_End ( - IN SHA1_CTX_STRUC *pSHA_CTX, - OUT UINT8 DigestMessage[]); -VOID RT_SHA1 ( - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 DigestMessage[]); -#endif /* SHA1_SUPPORT */ - -#ifdef SHA256_SUPPORT -#define SHA256_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ -#define SHA256_DIGEST_SIZE 32 /* 256 bits = 32 bytes */ -typedef struct _SHA256_CTX_STRUC { - UINT32 HashValue[8]; /* 8 = (SHA256_DIGEST_SIZE / 32) */ - UINT64 MessageLen; /* total size */ - UINT8 Block[SHA256_BLOCK_SIZE]; - UINT BlockLen; -} SHA256_CTX_STRUC, *PSHA256_CTX_STRUC; - -VOID SHA256_Init ( - IN SHA256_CTX_STRUC *pSHA_CTX); -VOID SHA256_Hash ( - IN SHA256_CTX_STRUC *pSHA_CTX); -VOID SHA256_Append ( - IN SHA256_CTX_STRUC *pSHA_CTX, - IN const UINT8 Message[], - IN UINT MessageLen); -VOID SHA256_End ( - IN SHA256_CTX_STRUC *pSHA_CTX, - OUT UINT8 DigestMessage[]); -VOID RT_SHA256 ( - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 DigestMessage[]); -#endif /* SHA256_SUPPORT */ - -#endif /* __CRYPT_SHA2_H__ */ diff --git a/drivers/staging/rt3090/dfs.h b/drivers/staging/rt3090/dfs.h deleted file mode 100644 index 506468ea952f..000000000000 --- a/drivers/staging/rt3090/dfs.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - dfs.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Fonchi 03-12-2007 created -*/ - -#define RADAR_PULSE 1 -#define RADAR_WIDTH 2 - -#define WIDTH_RD_IDLE 0 -#define WIDTH_RD_CHECK 1 - - - -/************************************************************************* - * - * DFS Radar related definitions. - * - ************************************************************************/ -//#define CARRIER_DETECT_TASK_NUM 6 -//#define RADAR_DETECT_TASK_NUM 7 - -// McuRadarState && McuCarrierState for 2880-SW-MCU -#define FREE_FOR_TX 0 -#define WAIT_CTS_BEING_SENT 1 -#define DO_DETECTION 2 - -// McuRadarEvent -#define RADAR_EVENT_CTS_SENT 0x01 // Host signal MCU that CTS has been sent -#define RADAR_EVENT_CTS_CARRIER_SENT 0x02 // Host signal MCU that CTS has been sent (Carrier) -#define RADAR_EVENT_RADAR_DETECTING 0x04 // Radar detection is on going, carrier detection hold back -#define RADAR_EVENT_CARRIER_DETECTING 0x08 // Carrier detection is on going, radar detection hold back -#define RADAR_EVENT_WIDTH_RADAR 0x10 // BBP == 2 radar detected -#define RADAR_EVENT_CTS_KICKED 0x20 // Radar detection need to sent double CTS, first CTS sent - -// McuRadarCmd -#define DETECTION_STOP 0 -#define RADAR_DETECTION 1 -#define CARRIER_DETECTION 2 - - - -#ifdef TONE_RADAR_DETECT_SUPPORT -INT Set_CarrierCriteria_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg); -int Set_CarrierReCheck_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg); -INT Set_CarrierStopCheck_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg); -void NewCarrierDetectionStart(PRTMP_ADAPTER pAd); -void RTMPHandleRadarInterrupt(PRTMP_ADAPTER pAd); -VOID CSAsicDisableSync(IN PRTMP_ADAPTER pAd); -#endif // TONE_RADAR_DETECT_SUPPORT // - - -VOID BbpRadarDetectionStart( - IN PRTMP_ADAPTER pAd); - -VOID BbpRadarDetectionStop( - IN PRTMP_ADAPTER pAd); - -VOID RadarDetectionStart( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN CTS_Protect, - IN UINT8 CTSPeriod); - -VOID RadarDetectionStop( - IN PRTMP_ADAPTER pAd); - -VOID RadarDetectPeriodic( - IN PRTMP_ADAPTER pAd); - - -BOOLEAN RadarChannelCheck( - IN PRTMP_ADAPTER pAd, - IN UCHAR Ch); - -ULONG JapRadarType( - IN PRTMP_ADAPTER pAd); - -ULONG RTMPBbpReadRadarDuration( - IN PRTMP_ADAPTER pAd); - -ULONG RTMPReadRadarDuration( - IN PRTMP_ADAPTER pAd); - -VOID RTMPCleanRadarDuration( - IN PRTMP_ADAPTER pAd); - -VOID RTMPPrepareRDCTSFrame( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN ULONG Duration, - IN UCHAR RTSRate, - IN ULONG CTSBaseAddr, - IN UCHAR FrameGap); - -VOID RTMPPrepareRadarDetectParams( - IN PRTMP_ADAPTER pAd); - - -INT Set_ChMovingTime_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_LongPulseRadarTh_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); diff --git a/drivers/staging/rt3090/eeprom.h b/drivers/staging/rt3090/eeprom.h deleted file mode 100644 index ee0e807decb4..000000000000 --- a/drivers/staging/rt3090/eeprom.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - eeprom.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ -#ifndef __EEPROM_H__ -#define __EEPROM_H__ - - - -#ifdef RTMP_PCI_SUPPORT -/************************************************************************* - * Public function declarations for prom-based chipset - ************************************************************************/ -int rtmp_ee_prom_read16( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - OUT USHORT *pValue); - -int rtmp_ee_prom_write16( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT value); -#endif // RTMP_PCI_SUPPORT // - - - - - -#ifdef RT30xx -#ifdef RTMP_EFUSE_SUPPORT -int rtmp_ee_efuse_read16( - IN RTMP_ADAPTER *pAd, - IN USHORT Offset, - OUT USHORT *pValue); - -int rtmp_ee_efuse_write16( - IN RTMP_ADAPTER *pAd, - IN USHORT Offset, - IN USHORT data); -#endif // RTMP_EFUSE_SUPPORT // -#endif // RT30xx // - -/************************************************************************* - * Public function declarations for prom operation callback functions setting - ************************************************************************/ -INT RtmpChipOpsEepromHook( - IN RTMP_ADAPTER *pAd, - IN INT infType); - -#endif // __EEPROM_H__ // diff --git a/drivers/staging/rt3090/igmp_snoop.h b/drivers/staging/rt3090/igmp_snoop.h deleted file mode 100644 index 63f9692e0b35..000000000000 --- a/drivers/staging/rt3090/igmp_snoop.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - igmp_snoop.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - - -#ifndef __RTMP_IGMP_SNOOP_H__ -#define __RTMP_IGMP_SNOOP_H__ - -#include "link_list.h" - -#define IGMP_PROTOCOL_DESCRIPTOR 0x02 -#define IGMP_V1_MEMBERSHIP_REPORT 0x12 -#define IGMP_V2_MEMBERSHIP_REPORT 0x16 -#define IGMP_LEAVE_GROUP 0x17 -#define IGMP_V3_MEMBERSHIP_REPORT 0x22 - -#define MLD_V1_LISTENER_REPORT 131 -#define MLD_V1_LISTENER_DONE 132 -#define MLD_V2_LISTERNER_REPORT 143 - -#define IGMPMAC_TB_ENTRY_AGEOUT_TIME 120 * OS_HZ - -#define MULTICAST_ADDR_HASH_INDEX(Addr) (MAC_ADDR_HASH(Addr) % (MAX_LEN_OF_MULTICAST_FILTER_HASH_TABLE)) - -#define IS_MULTICAST_MAC_ADDR(Addr) ((((Addr[0]) & 0x01) == 0x01) && ((Addr[0]) != 0xff)) -#define IS_BROADCAST_MAC_ADDR(Addr) ((((Addr[0]) & 0xff) == 0xff)) - -VOID MulticastFilterTableInit( - IN PMULTICAST_FILTER_TABLE *ppMulticastFilterTable); - -VOID MultiCastFilterTableReset( - IN PMULTICAST_FILTER_TABLE *ppMulticastFilterTable); - -BOOLEAN MulticastFilterTableInsertEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pGrpId, - IN PUCHAR pMemberAddr, - IN PNET_DEV dev, - IN MulticastFilterEntryType type); - -BOOLEAN MulticastFilterTableDeleteEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pGrpId, - IN PUCHAR pMemberAddr, - IN PNET_DEV dev); - -PMULTICAST_FILTER_TABLE_ENTRY MulticastFilterTableLookup( - IN PMULTICAST_FILTER_TABLE pMulticastFilterTable, - IN PUCHAR pAddr, - IN PNET_DEV dev); - -BOOLEAN isIgmpPkt( - IN PUCHAR pDstMacAddr, - IN PUCHAR pIpHeader); - -VOID IGMPSnooping( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDstMacAddr, - IN PUCHAR pSrcMacAddr, - IN PUCHAR pIpHeader, - IN PNET_DEV pDev); - -BOOLEAN isMldPkt( - IN PUCHAR pDstMacAddr, - IN PUCHAR pIpHeader, - OUT UINT8 *pProtoType, - OUT PUCHAR *pMldHeader); - -VOID MLDSnooping( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDstMacAddr, - IN PUCHAR pSrcMacAddr, - IN PUCHAR pIpHeader, - IN PNET_DEV pDev); - -UCHAR IgmpMemberCnt( - IN PLIST_HEADER pList); - -VOID IgmpGroupDelMembers( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pMemberAddr, - IN PNET_DEV pDev); - -INT Set_IgmpSn_Enable_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_IgmpSn_AddEntry_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_IgmpSn_DelEntry_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_IgmpSn_TabDisplay_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -void rtmp_read_igmp_snoop_from_file( - IN PRTMP_ADAPTER pAd, - PSTRING tmpbuf, - PSTRING buffer); - -NDIS_STATUS IgmpPktInfoQuery( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pSrcBufVA, - IN PNDIS_PACKET pPacket, - IN UCHAR apidx, - OUT BOOLEAN *pInIgmpGroup, - OUT PMULTICAST_FILTER_TABLE_ENTRY *ppGroupEntry); - -NDIS_STATUS IgmpPktClone( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN UCHAR QueIdx, - IN PMULTICAST_FILTER_TABLE_ENTRY pGroupEntry); - -#endif /* __RTMP_IGMP_SNOOP_H__ */ diff --git a/drivers/staging/rt3090/ipv6.h b/drivers/staging/rt3090/ipv6.h deleted file mode 100644 index c34a5f2569dd..000000000000 --- a/drivers/staging/rt3090/ipv6.h +++ /dev/null @@ -1,215 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - ipv6.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#ifndef __IPV6_HDR_H_ -#define __IPV6_HDR_H_ - -#define IPV6_ADDR_LEN 16 -#define IPV6_HDR_LEN 40 - -// IPv6 address definition -#define IPV6_LINK_LOCAL_ADDR_PREFIX 0xFE8 -#define IPV6_SITE_LOCAL_ADDR_PREFIX 0xFEC -#define IPV6_LOCAL_ADDR_PREFIX 0xFE8 -#define IPV6_MULTICAST_ADDR_PREFIX 0xFF -#define IPV6_LOOPBACK_ADDR 0x1 -#define IPV6_UNSPECIFIED_ADDR 0x0 - -// defined as sequence in IPv6 header -#define IPV6_NEXT_HEADER_HOP_BY_HOP 0x00 // 0 -#define IPV6_NEXT_HEADER_DESTINATION 0x3c // 60 -#define IPV6_NEXT_HEADER_ROUTING 0x2b // 43 -#define IPV6_NEXT_HEADER_FRAGMENT 0x2c // 44 -#define IPV6_NEXT_HEADER_AUTHENTICATION 0x33 // 51 -#define IPV6_NEXT_HEADER_ENCAPSULATION 0x32 // 50, RFC-2406 -#define IPV6_NEXT_HEADER_NONE 0x3b // 59 - -#define IPV6_NEXT_HEADER_TCP 0x06 -#define IPV6_NEXT_HEADER_UDP 0x11 -#define IPV6_NEXT_HEADER_ICMPV6 0x3a - -// ICMPv6 msg type definition -#define ICMPV6_MSG_TYPE_ROUTER_SOLICITATION 0x85 // 133 -#define ROUTER_SOLICITATION_FIXED_LEN 8 - -#define ICMPV6_MSG_TYPE_ROUTER_ADVERTISEMENT 0x86 // 134 -#define ROUTER_ADVERTISEMENT_FIXED_LEN 16 - -#define ICMPV6_MSG_TYPE_NEIGHBOR_SOLICITATION 0x87 // 135 -#define NEIGHBOR_SOLICITATION_FIXED_LEN 24 - -#define ICMPV6_MSG_TYPE_NEIGHBOR_ADVERTISEMENT 0x88 // 136 -#define NEIGHBOR_ADVERTISEMENT_FIXED_LEN 24 - -#define ICMPV6_MSG_TYPE_REDIRECT 0x89 // 137 -#define REDIRECT_FIXED_LEN 40 - -/* IPv6 Address related structures */ -typedef struct rt_ipv6_addr_ -{ - union - { - UCHAR ipv6Addr8[16]; - USHORT ipv6Addr16[8]; - UINT32 ipv6Addr32[4]; - }addr; -#define ipv6_addr addr.ipv6Addr8 -#define ipv6_addr16 addr.ipv6Addr16 -#define ipv6_addr32 addr.ipv6Addr32 -}RT_IPV6_ADDR, *PRT_IPV6_ADDR; - - -#define PRINT_IPV6_ADDR(ipv6Addr) \ - OS_NTOHS((ipv6Addr).ipv6_addr16[0]), \ - OS_NTOHS((ipv6Addr).ipv6_addr16[1]), \ - OS_NTOHS((ipv6Addr).ipv6_addr16[2]), \ - OS_NTOHS((ipv6Addr).ipv6_addr16[3]), \ - OS_NTOHS((ipv6Addr).ipv6_addr16[4]), \ - OS_NTOHS((ipv6Addr).ipv6_addr16[5]), \ - OS_NTOHS((ipv6Addr).ipv6_addr16[6]), \ - OS_NTOHS((ipv6Addr).ipv6_addr16[7]) - - -/*IPv6 Header related structures */ -typedef struct PACKED _rt_ipv6_hdr_ -{ - UINT32 ver:4, - trafficClass:8, - flowLabel:20; - USHORT payload_len; - UCHAR nextHdr; - UCHAR hopLimit; - RT_IPV6_ADDR srcAddr; - RT_IPV6_ADDR dstAddr; -}RT_IPV6_HDR, *PRT_IPV6_HDR; - - -typedef struct PACKED _rt_ipv6_ext_hdr_ -{ - UCHAR nextProto; // Indicate the protocol type of next extension header. - UCHAR extHdrLen; // optional field for msg length of this extension header which didn't include the first "nextProto" field. - UCHAR octets[1]; // hook to extend header message body. -}RT_IPV6_EXT_HDR, *PRT_IPV6_EXT_HDR; - - -/* ICMPv6 related structures */ -typedef struct PACKED _rt_ipv6_icmpv6_hdr_ -{ - UCHAR type; - UCHAR code; - USHORT chksum; - UCHAR octets[1]; //hook to extend header message body. -}RT_ICMPV6_HDR, *PRT_ICMPV6_HDR; - - -typedef struct PACKED _rt_icmp6_option_hdr_ -{ - UCHAR type; - UCHAR len; - UCHAR octet[1]; -}RT_ICMPV6_OPTION_HDR, *PRT_ICMPV6_OPTION_HDR; - -typedef enum{ -// Defined ICMPv6 Option Types. - TYPE_SRC_LL_ADDR = 1, - TYPE_TGT_LL_ADDR = 2, - TYPE_PREFIX_INFO = 3, - TYPE_REDIRECTED_HDR = 4, - TYPE_MTU = 5, -}ICMPV6_OPTIONS_TYPE_DEF; - - -static inline BOOLEAN IPv6ExtHdrHandle( - RT_IPV6_EXT_HDR *pExtHdr, - UCHAR *pProto, - UINT32 *pOffset) -{ - UCHAR nextProto = 0xff; - UINT32 extLen = 0; - BOOLEAN status = TRUE; - - //printk("%s(): parsing the Extension Header with Protocol(0x%x):\n", __FUNCTION__, *pProto); - switch (*pProto) - { - case IPV6_NEXT_HEADER_HOP_BY_HOP: - // IPv6ExtHopByHopHandle(); - nextProto = pExtHdr->nextProto; - extLen = (pExtHdr->extHdrLen + 1) * 8; - break; - - case IPV6_NEXT_HEADER_DESTINATION: - // IPv6ExtDestHandle(); - nextProto = pExtHdr->nextProto; - extLen = (pExtHdr->extHdrLen + 1) * 8; - break; - - case IPV6_NEXT_HEADER_ROUTING: - // IPv6ExtRoutingHandle(); - nextProto = pExtHdr->nextProto; - extLen = (pExtHdr->extHdrLen + 1) * 8; - break; - - case IPV6_NEXT_HEADER_FRAGMENT: - // IPv6ExtFragmentHandle(); - nextProto = pExtHdr->nextProto; - extLen = 8; // The Fragment header length is fixed to 8 bytes. - break; - - case IPV6_NEXT_HEADER_AUTHENTICATION: - // IPV6_NEXT_HEADER_ENCAPSULATION: - /* - TODO: Not support. For encryption issue. - */ - nextProto = 0xFF; - status = FALSE; - break; - - default: - nextProto = 0xFF; - status = FALSE; - break; - } - - *pProto = nextProto; - *pOffset += extLen; - //printk("%s(): nextProto = 0x%x!, offset=0x%x!\n", __FUNCTION__, nextProto, offset); - - return status; - -} - -#endif // __IPV6_HDR_H_ // diff --git a/drivers/staging/rt3090/link_list.h b/drivers/staging/rt3090/link_list.h deleted file mode 100644 index 205b610bfb90..000000000000 --- a/drivers/staging/rt3090/link_list.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - */ - -#ifndef __LINK_LIST_H__ -#define __LINK_LIST_H__ - -typedef struct _LIST_ENTRY -{ - struct _LIST_ENTRY *pNext; -} LIST_ENTRY, *PLIST_ENTRY; - -typedef struct _LIST_HEADR -{ - PLIST_ENTRY pHead; - PLIST_ENTRY pTail; - UCHAR size; -} LIST_HEADER, *PLIST_HEADER; - -static inline VOID initList( - IN PLIST_HEADER pList) -{ - pList->pHead = pList->pTail = NULL; - pList->size = 0; - return; -} - -static inline VOID insertTailList( - IN PLIST_HEADER pList, - IN PLIST_ENTRY pEntry) -{ - pEntry->pNext = NULL; - if (pList->pTail) - pList->pTail->pNext = pEntry; - else - pList->pHead = pEntry; - pList->pTail = pEntry; - pList->size++; - - return; -} - -static inline PLIST_ENTRY removeHeadList( - IN PLIST_HEADER pList) -{ - PLIST_ENTRY pNext; - PLIST_ENTRY pEntry; - - pEntry = pList->pHead; - if (pList->pHead != NULL) - { - pNext = pList->pHead->pNext; - pList->pHead = pNext; - if (pNext == NULL) - pList->pTail = NULL; - pList->size--; - } - return pEntry; -} - -static inline int getListSize( - IN PLIST_HEADER pList) -{ - return pList->size; -} - -static inline PLIST_ENTRY delEntryList( - IN PLIST_HEADER pList, - IN PLIST_ENTRY pEntry) -{ - PLIST_ENTRY pCurEntry; - PLIST_ENTRY pPrvEntry; - - if(pList->pHead == NULL) - return NULL; - - if(pEntry == pList->pHead) - { - pCurEntry = pList->pHead; - pList->pHead = pCurEntry->pNext; - - if(pList->pHead == NULL) - pList->pTail = NULL; - - pList->size--; - return pCurEntry; - } - - pPrvEntry = pList->pHead; - pCurEntry = pPrvEntry->pNext; - while(pCurEntry != NULL) - { - if (pEntry == pCurEntry) - { - pPrvEntry->pNext = pCurEntry->pNext; - - if(pEntry == pList->pTail) - pList->pTail = pPrvEntry; - - pList->size--; - break; - } - pPrvEntry = pCurEntry; - pCurEntry = pPrvEntry->pNext; - } - - return pCurEntry; -} - -#endif // ___LINK_LIST_H__ // diff --git a/drivers/staging/rt3090/mac_pci.h b/drivers/staging/rt3090/mac_pci.h deleted file mode 100644 index bad04d43ebae..000000000000 --- a/drivers/staging/rt3090/mac_pci.h +++ /dev/null @@ -1,454 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - mac_pci.h - - Abstract: - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- - */ - -#ifndef __MAC_PCI_H__ -#define __MAC_PCI_H__ - -#include "rtmp_type.h" -#include "rtmp_mac.h" -#include "rtmp_phy.h" -#include "rtmp_iface.h" -#include "rtmp_dot11.h" - - -// -// Device ID & Vendor ID related definitions, -// NOTE: you should not add the new VendorID/DeviceID here unless you not sure it belongs to what chip. -// -#define NIC_PCI_VENDOR_ID 0x1814 -#define PCIBUS_INTEL_VENDOR 0x8086 - -#if !defined(PCI_CAP_ID_EXP) -#define PCI_CAP_ID_EXP 0x10 -#endif -#if !defined(PCI_EXP_LNKCTL) -#define PCI_EXP_LNKCTL 0x10 -#endif -#if !defined(PCI_CLASS_BRIDGE_PCI) -#define PCI_CLASS_BRIDGE_PCI 0x0604 -#endif - - - - - -#define TXINFO_SIZE 0 -#define RTMP_PKT_TAIL_PADDING 0 -#define fRTMP_ADAPTER_NEED_STOP_TX 0 - -#define AUX_CTRL 0x10c - -// -// TX descriptor format, Tx ring, Mgmt Ring -// -#ifdef RT_BIG_ENDIAN -typedef struct PACKED _TXD_STRUC { - // Word 0 - UINT32 SDPtr0; - // Word 1 - UINT32 DMADONE:1; - UINT32 LastSec0:1; - UINT32 SDLen0:14; - UINT32 Burst:1; - UINT32 LastSec1:1; - UINT32 SDLen1:14; - // Word 2 - UINT32 SDPtr1; - // Word 3 - UINT32 ICO:1; - UINT32 UCO:1; - UINT32 TCO:1; - UINT32 rsv:2; - UINT32 QSEL:2; // select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA - UINT32 WIV:1; // Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition - UINT32 rsv2:24; -} TXD_STRUC, *PTXD_STRUC; -#else -typedef struct PACKED _TXD_STRUC { - // Word 0 - UINT32 SDPtr0; - // Word 1 - UINT32 SDLen1:14; - UINT32 LastSec1:1; - UINT32 Burst:1; - UINT32 SDLen0:14; - UINT32 LastSec0:1; - UINT32 DMADONE:1; - //Word2 - UINT32 SDPtr1; - //Word3 - UINT32 rsv2:24; - UINT32 WIV:1; // Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition - UINT32 QSEL:2; // select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA - UINT32 rsv:2; - UINT32 TCO:1; // - UINT32 UCO:1; // - UINT32 ICO:1; // -} TXD_STRUC, *PTXD_STRUC; -#endif - - -// -// Rx descriptor format, Rx Ring -// -#ifdef RT_BIG_ENDIAN -typedef struct PACKED _RXD_STRUC{ - // Word 0 - UINT32 SDP0; - // Word 1 - UINT32 DDONE:1; - UINT32 LS0:1; - UINT32 SDL0:14; - UINT32 Rsv:2; - UINT32 SDL1:14; - // Word 2 - UINT32 SDP1; - // Word 3 - UINT32 Rsv1:13; - UINT32 PlcpRssil:1;// To be moved - UINT32 PlcpSignal:1; // To be moved - UINT32 Decrypted:1; // this frame is being decrypted. - UINT32 AMPDU:1; - UINT32 L2PAD:1; - UINT32 RSSI:1; - UINT32 HTC:1; - UINT32 AMSDU:1; // rx with 802.3 header, not 802.11 header. obsolete. - UINT32 CipherErr:2; // 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid - UINT32 Crc:1; // 1: CRC error - UINT32 MyBss:1; // 1: this frame belongs to the same BSSID - UINT32 Bcast:1; // 1: this is a broadcast frame - UINT32 Mcast:1; // 1: this is a multicast frame - UINT32 U2M:1; // 1: this RX frame is unicast to me - UINT32 FRAG:1; - UINT32 NULLDATA:1; - UINT32 DATA:1; - UINT32 BA:1; - -} RXD_STRUC, *PRXD_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC; -#else -typedef struct PACKED _RXD_STRUC{ - // Word 0 - UINT32 SDP0; - // Word 1 - UINT32 SDL1:14; - UINT32 Rsv:2; - UINT32 SDL0:14; - UINT32 LS0:1; - UINT32 DDONE:1; - // Word 2 - UINT32 SDP1; - // Word 3 - UINT32 BA:1; - UINT32 DATA:1; - UINT32 NULLDATA:1; - UINT32 FRAG:1; - UINT32 U2M:1; // 1: this RX frame is unicast to me - UINT32 Mcast:1; // 1: this is a multicast frame - UINT32 Bcast:1; // 1: this is a broadcast frame - UINT32 MyBss:1; // 1: this frame belongs to the same BSSID - UINT32 Crc:1; // 1: CRC error - UINT32 CipherErr:2; // 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid - UINT32 AMSDU:1; // rx with 802.3 header, not 802.11 header. - UINT32 HTC:1; - UINT32 RSSI:1; - UINT32 L2PAD:1; - UINT32 AMPDU:1; - UINT32 Decrypted:1; // this frame is being decrypted. - UINT32 PlcpSignal:1; // To be moved - UINT32 PlcpRssil:1;// To be moved - UINT32 Rsv1:13; -} RXD_STRUC, *PRXD_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC; -#endif - -#ifdef BIG_ENDIAN -typedef union _TX_ATTENUATION_CTRL_STRUC -{ - struct - { - ULONG Reserve1:20; - ULONG PCIE_PHY_TX_ATTEN_EN:1; - ULONG PCIE_PHY_TX_ATTEN_VALUE:3; - ULONG Reserve2:7; - ULONG RF_ISOLATION_ENABLE:1; - } field; - - ULONG word; -} TX_ATTENUATION_CTRL_STRUC, *PTX_ATTENUATION_CTRL_STRUC; -#else -typedef union _TX_ATTENUATION_CTRL_STRUC { - struct - { - ULONG RF_ISOLATION_ENABLE:1; - ULONG Reserve2:7; - ULONG PCIE_PHY_TX_ATTEN_VALUE:3; - ULONG PCIE_PHY_TX_ATTEN_EN:1; - ULONG Reserve1:20; - } field; - - ULONG word; -} TX_ATTENUATION_CTRL_STRUC, *PTX_ATTENUATION_CTRL_STRUC; -#endif -/* ----------------- EEPROM Related MACRO ----------------- */ - -// 8051 firmware image for RT2860 - base address = 0x4000 -#define FIRMWARE_IMAGE_BASE 0x2000 -#define MAX_FIRMWARE_IMAGE_SIZE 0x2000 // 8kbyte - - -/* ----------------- Frimware Related MACRO ----------------- */ -#define RTMP_WRITE_FIRMWARE(_pAd, _pFwImage, _FwLen) \ - do{ \ - ULONG _i, _firm; \ - RTMP_IO_WRITE32(_pAd, PBF_SYS_CTRL, 0x10000); \ - \ - for(_i=0; _i<_FwLen; _i+=4) \ - { \ - _firm = _pFwImage[_i] + \ - (_pFwImage[_i+3] << 24) + \ - (_pFwImage[_i+2] << 16) + \ - (_pFwImage[_i+1] << 8); \ - RTMP_IO_WRITE32(_pAd, FIRMWARE_IMAGE_BASE + _i, _firm); \ - } \ - RTMP_IO_WRITE32(_pAd, PBF_SYS_CTRL, 0x00000); \ - RTMP_IO_WRITE32(_pAd, PBF_SYS_CTRL, 0x00001); \ - \ - /* initialize BBP R/W access agent */ \ - RTMP_IO_WRITE32(_pAd, H2M_BBP_AGENT, 0); \ - RTMP_IO_WRITE32(_pAd, H2M_MAILBOX_CSR, 0); \ - }while(0) - - -/* ----------------- TX Related MACRO ----------------- */ -#define RTMP_START_DEQUEUE(pAd, QueIdx, irqFlags) do{}while(0) -#define RTMP_STOP_DEQUEUE(pAd, QueIdx, irqFlags) do{}while(0) - - -#define RTMP_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, freeNum, pPacket) \ - ((freeNum) >= (ULONG)(pTxBlk->TotalFragNum + RTMP_GET_PACKET_FRAGMENTS(pPacket) + 3)) /* rough estimate we will use 3 more descriptor. */ -#define RTMP_RELEASE_DESC_RESOURCE(pAd, QueIdx) \ - do{}while(0) - -#define NEED_QUEUE_BACK_FOR_AGG(pAd, QueIdx, freeNum, _TxFrameType) \ - (((freeNum != (TX_RING_SIZE-1)) && (pAd->TxSwQueue[QueIdx].Number == 0)) || (freeNum<3)) - //(((freeNum) != (TX_RING_SIZE-1)) && (pAd->TxSwQueue[QueIdx].Number == 1 /*0*/)) - - -#define HAL_KickOutMgmtTx(_pAd, _QueIdx, _pPacket, _pSrcBufVA, _SrcBufLen) \ - RtmpPCIMgmtKickOut(_pAd, _QueIdx, _pPacket, _pSrcBufVA, _SrcBufLen) - -#define HAL_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) \ - /* RtmpPCI_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber)*/ - -#define HAL_WriteTxResource(pAd, pTxBlk,bIsLast, pFreeNumber) \ - RtmpPCI_WriteSingleTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) - -#define HAL_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber) \ - RtmpPCI_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber) - -#define HAL_WriteMultiTxResource(pAd, pTxBlk,frameNum, pFreeNumber) \ - RtmpPCI_WriteMultiTxResource(pAd, pTxBlk, frameNum, pFreeNumber) - -#define HAL_FinalWriteTxResource(_pAd, _pTxBlk, _TotalMPDUSize, _FirstTxIdx) \ - RtmpPCI_FinalWriteTxResource(_pAd, _pTxBlk, _TotalMPDUSize, _FirstTxIdx) - -#define HAL_LastTxIdx(_pAd, _QueIdx,_LastTxIdx) \ - /*RtmpPCIDataLastTxIdx(_pAd, _QueIdx,_LastTxIdx)*/ - -#define HAL_KickOutTx(_pAd, _pTxBlk, _QueIdx) \ - RTMP_IO_WRITE32((_pAd), TX_CTX_IDX0+((_QueIdx)*0x10), (_pAd)->TxRing[(_QueIdx)].TxCpuIdx) -/* RtmpPCIDataKickOut(_pAd, _pTxBlk, _QueIdx)*/ - -#define HAL_KickOutNullFrameTx(_pAd, _QueIdx, _pNullFrame, _frameLen) \ - MiniportMMRequest(_pAd, _QueIdx, _pNullFrame, _frameLen) - -#define GET_TXRING_FREENO(_pAd, _QueIdx) \ - (_pAd->TxRing[_QueIdx].TxSwFreeIdx > _pAd->TxRing[_QueIdx].TxCpuIdx) ? \ - (_pAd->TxRing[_QueIdx].TxSwFreeIdx - _pAd->TxRing[_QueIdx].TxCpuIdx - 1) \ - : \ - (_pAd->TxRing[_QueIdx].TxSwFreeIdx + TX_RING_SIZE - _pAd->TxRing[_QueIdx].TxCpuIdx - 1); - - -#define GET_MGMTRING_FREENO(_pAd) \ - (_pAd->MgmtRing.TxSwFreeIdx > _pAd->MgmtRing.TxCpuIdx) ? \ - (_pAd->MgmtRing.TxSwFreeIdx - _pAd->MgmtRing.TxCpuIdx - 1) \ - : \ - (_pAd->MgmtRing.TxSwFreeIdx + MGMT_RING_SIZE - _pAd->MgmtRing.TxCpuIdx - 1); - - -/* ----------------- RX Related MACRO ----------------- */ - - -/* ----------------- ASIC Related MACRO ----------------- */ -// reset MAC of a station entry to 0x000000000000 -#define RTMP_STA_ENTRY_MAC_RESET(pAd, Wcid) \ - AsicDelWcidTab(pAd, Wcid); - -// add this entry into ASIC RX WCID search table -#define RTMP_STA_ENTRY_ADD(pAd, pEntry) \ - AsicUpdateRxWCIDTable(pAd, pEntry->Aid, pEntry->Addr); - -// add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet -// Set MAC register value according operation mode -#define RTMP_UPDATE_PROTECT(pAd) \ - AsicUpdateProtect(pAd, 0, (ALLN_SETPROTECT), TRUE, 0); -// end johnli - -// remove Pair-wise key material from ASIC -#define RTMP_STA_ENTRY_KEY_DEL(pAd, BssIdx, Wcid) \ - AsicRemovePairwiseKeyEntry(pAd, BssIdx, (UCHAR)Wcid); - -// add Client security information into ASIC WCID table and IVEIV table -#define RTMP_STA_SECURITY_INFO_ADD(pAd, apidx, KeyID, pEntry) \ - RTMPAddWcidAttributeEntry(pAd, apidx, KeyID, \ - pAd->SharedKey[apidx][KeyID].CipherAlg, pEntry); - -#define RTMP_SECURITY_KEY_ADD(pAd, apidx, KeyID, pEntry) \ - { /* update pairwise key information to ASIC Shared Key Table */ \ - AsicAddSharedKeyEntry(pAd, apidx, KeyID, \ - pAd->SharedKey[apidx][KeyID].CipherAlg, \ - pAd->SharedKey[apidx][KeyID].Key, \ - pAd->SharedKey[apidx][KeyID].TxMic, \ - pAd->SharedKey[apidx][KeyID].RxMic); \ - /* update ASIC WCID attribute table and IVEIV table */ \ - RTMPAddWcidAttributeEntry(pAd, apidx, KeyID, \ - pAd->SharedKey[apidx][KeyID].CipherAlg, \ - pEntry); } - - -// Insert the BA bitmap to ASIC for the Wcid entry -#define RTMP_ADD_BA_SESSION_TO_ASIC(_pAd, _Aid, _TID) \ - do{ \ - UINT32 _Value = 0, _Offset; \ - _Offset = MAC_WCID_BASE + (_Aid) * HW_WCID_ENTRY_SIZE + 4; \ - RTMP_IO_READ32((_pAd), _Offset, &_Value);\ - _Value |= (0x10000<<(_TID)); \ - RTMP_IO_WRITE32((_pAd), _Offset, _Value);\ - }while(0) - - -// Remove the BA bitmap from ASIC for the Wcid entry -// bitmap field starts at 0x10000 in ASIC WCID table -#define RTMP_DEL_BA_SESSION_FROM_ASIC(_pAd, _Wcid, _TID) \ - do{ \ - UINT32 _Value = 0, _Offset; \ - _Offset = MAC_WCID_BASE + (_Wcid) * HW_WCID_ENTRY_SIZE + 4; \ - RTMP_IO_READ32((_pAd), _Offset, &_Value); \ - _Value &= (~(0x10000 << (_TID))); \ - RTMP_IO_WRITE32((_pAd), _Offset, _Value); \ - }while(0) - - -/* ----------------- Interface Related MACRO ----------------- */ - -// -// Enable & Disable NIC interrupt via writing interrupt mask register -// Since it use ADAPTER structure, it have to be put after structure definition. -// -#define RTMP_ASIC_INTERRUPT_DISABLE(_pAd) \ - do{ \ - RTMP_IO_WRITE32((_pAd), INT_MASK_CSR, 0x0); /* 0: disable */ \ - RTMP_CLEAR_FLAG((_pAd), fRTMP_ADAPTER_INTERRUPT_ACTIVE); \ - }while(0) - -#define RTMP_ASIC_INTERRUPT_ENABLE(_pAd)\ - do{ \ - RTMP_IO_WRITE32((_pAd), INT_MASK_CSR, (_pAd)->int_enable_reg /*DELAYINTMASK*/); /* 1:enable */ \ - RTMP_SET_FLAG((_pAd), fRTMP_ADAPTER_INTERRUPT_ACTIVE); \ - }while(0) - - -#define RTMP_IRQ_INIT(pAd) \ - { pAd->int_enable_reg = ((DELAYINTMASK) | \ - (RxINT|TxDataInt|TxMgmtInt)) & ~(0x03); \ - pAd->int_disable_mask = 0; \ - pAd->int_pending = 0; } - -#define RTMP_IRQ_ENABLE(pAd) \ - { /* clear garbage ints */ \ - RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, 0xffffffff);\ - RTMP_ASIC_INTERRUPT_ENABLE(pAd); } - - -/* ----------------- MLME Related MACRO ----------------- */ -#define RTMP_MLME_HANDLER(pAd) MlmeHandler(pAd) - -#define RTMP_MLME_PRE_SANITY_CHECK(pAd) - -#define RTMP_MLME_STA_QUICK_RSP_WAKE_UP(pAd) \ - RTMPSetTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, 100); - -#define RTMP_MLME_RESET_STATE_MACHINE(pAd) \ - MlmeRestartStateMachine(pAd) - -#define RTMP_HANDLE_COUNTER_MEASURE(_pAd, _pEntry)\ - HandleCounterMeasure(_pAd, _pEntry) - -/* ----------------- Power Save Related MACRO ----------------- */ -#define RTMP_PS_POLL_ENQUEUE(pAd) EnqueuePsPoll(pAd) - - -// For RTMPPCIePowerLinkCtrlRestore () function -#define RESTORE_HALT 1 -#define RESTORE_WAKEUP 2 -#define RESTORE_CLOSE 3 - -#define PowerSafeCID 1 -#define PowerRadioOffCID 2 -#define PowerWakeCID 3 -#define CID0MASK 0x000000ff -#define CID1MASK 0x0000ff00 -#define CID2MASK 0x00ff0000 -#define CID3MASK 0xff000000 - - -#ifdef CONFIG_STA_SUPPORT -#define RTMP_STA_FORCE_WAKEUP(pAd, bFromTx) \ - RT28xxPciStaAsicForceWakeup(pAd, bFromTx); - -#define RTMP_STA_SLEEP_THEN_AUTO_WAKEUP(pAd, TbttNumToNextWakeUp) \ - RT28xxPciStaAsicSleepThenAutoWakeup(pAd, TbttNumToNextWakeUp); - -#define RTMP_SET_PSM_BIT(_pAd, _val) \ - MlmeSetPsmBit(_pAd, _val); -#endif // CONFIG_STA_SUPPORT // - -#define RTMP_MLME_RADIO_ON(pAd) \ - RT28xxPciMlmeRadioOn(pAd); - -#define RTMP_MLME_RADIO_OFF(pAd) \ - RT28xxPciMlmeRadioOFF(pAd); - -#endif //__MAC_PCI_H__ // diff --git a/drivers/staging/rt3090/mlme.h b/drivers/staging/rt3090/mlme.h deleted file mode 100644 index 233674397a73..000000000000 --- a/drivers/staging/rt3090/mlme.h +++ /dev/null @@ -1,1360 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - mlme.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - John Chang 2003-08-28 Created - John Chang 2004-09-06 modified for RT2600 -*/ -#ifndef __MLME_H__ -#define __MLME_H__ - -#include "rtmp_dot11.h" - -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // - - -// maximum supported capability information - -// ESS, IBSS, Privacy, Short Preamble, Spectrum mgmt, Short Slot -#define SUPPORTED_CAPABILITY_INFO 0x0533 - -#define END_OF_ARGS -1 -#define LFSR_MASK 0x80000057 -#define MLME_TASK_EXEC_INTV 100/*200*/ // -#define LEAD_TIME 5 -#define MLME_TASK_EXEC_MULTIPLE 10 /*5*/ // MLME_TASK_EXEC_MULTIPLE * MLME_TASK_EXEC_INTV = 1 sec -#define REORDER_EXEC_INTV 100 // 0.1 sec -//#define TBTT_PRELOAD_TIME 384 // usec. LomgPreamble + 24-byte at 1Mbps - -// The definition of Radar detection duration region -#define CE 0 -#define FCC 1 -#define JAP 2 -#define JAP_W53 3 -#define JAP_W56 4 -#define MAX_RD_REGION 5 - -#define BEACON_LOST_TIME 4 * OS_HZ // 2048 msec = 2 sec - -#define DLS_TIMEOUT 1200 // unit: msec -#define AUTH_TIMEOUT 300 // unit: msec -#define ASSOC_TIMEOUT 300 // unit: msec -#define JOIN_TIMEOUT 2000 // unit: msec -#define SHORT_CHANNEL_TIME 90 // unit: msec -#define MIN_CHANNEL_TIME 110 // unit: msec, for dual band scan -#define MAX_CHANNEL_TIME 140 // unit: msec, for single band scan -#define FAST_ACTIVE_SCAN_TIME 30 // Active scan waiting for probe response time -#define CW_MIN_IN_BITS 4 // actual CwMin = 2^CW_MIN_IN_BITS - 1 -#define LINK_DOWN_TIMEOUT 20000 // unit: msec -#define AUTO_WAKEUP_TIMEOUT 70 //unit: msec - - -#ifdef CONFIG_STA_SUPPORT -#define CW_MAX_IN_BITS 10 // actual CwMax = 2^CW_MAX_IN_BITS - 1 -#endif // CONFIG_STA_SUPPORT // - -#ifdef CONFIG_APSTA_MIXED_SUPPORT -extern UINT32 CW_MAX_IN_BITS; -#endif // CONFIG_APSTA_MIXED_SUPPORT // - -// Note: RSSI_TO_DBM_OFFSET has been changed to variable for new RF (2004-0720). -// SHould not refer to this constant anymore -//#define RSSI_TO_DBM_OFFSET 120 // for RT2530 RSSI-115 = dBm -#define RSSI_FOR_MID_TX_POWER -55 // -55 db is considered mid-distance -#define RSSI_FOR_LOW_TX_POWER -45 // -45 db is considered very short distance and - // eligible to use a lower TX power -#define RSSI_FOR_LOWEST_TX_POWER -30 -//#define MID_TX_POWER_DELTA 0 // 0 db from full TX power upon mid-distance to AP -#define LOW_TX_POWER_DELTA 6 // -3 db from full TX power upon very short distance. 1 grade is 0.5 db -#define LOWEST_TX_POWER_DELTA 16 // -8 db from full TX power upon shortest distance. 1 grade is 0.5 db - -#define RSSI_TRIGGERED_UPON_BELOW_THRESHOLD 0 -#define RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD 1 -#define RSSI_THRESHOLD_FOR_ROAMING 25 -#define RSSI_DELTA 5 - -// Channel Quality Indication -#define CQI_IS_GOOD(cqi) ((cqi) >= 50) -//#define CQI_IS_FAIR(cqi) (((cqi) >= 20) && ((cqi) < 50)) -#define CQI_IS_POOR(cqi) (cqi < 50) //(((cqi) >= 5) && ((cqi) < 20)) -#define CQI_IS_BAD(cqi) (cqi < 5) -#define CQI_IS_DEAD(cqi) (cqi == 0) - -// weighting factor to calculate Channel quality, total should be 100% -#define RSSI_WEIGHTING 50 -#define TX_WEIGHTING 30 -#define RX_WEIGHTING 20 - -//#define PEER_KEY_NOT_USED 0 -//#define PEER_KEY_64_BIT 64 -//#define PEER_KEY_128_BIT 128 - -//#define PEER_KEY_64BIT_LEN 8 -//#define PEER_KEY_128BIT_LEN 16 - -#define BSS_NOT_FOUND 0xFFFFFFFF - - -#ifdef CONFIG_STA_SUPPORT -#define MAX_LEN_OF_MLME_QUEUE 40 //10 -#endif // CONFIG_STA_SUPPORT // - -#define SCAN_PASSIVE 18 // scan with no probe request, only wait beacon and probe response -#define SCAN_ACTIVE 19 // scan with probe request, and wait beacon and probe response -#define SCAN_CISCO_PASSIVE 20 // Single channel passive scan -#define SCAN_CISCO_ACTIVE 21 // Single channel active scan -#define SCAN_CISCO_NOISE 22 // Single channel passive scan for noise histogram collection -#define SCAN_CISCO_CHANNEL_LOAD 23 // Single channel passive scan for channel load collection -#define FAST_SCAN_ACTIVE 24 // scan with probe request, and wait beacon and probe response - -#ifdef DOT11N_DRAFT3 -#define SCAN_2040_BSS_COEXIST 26 -#endif // DOT11N_DRAFT3 // - -//#define BSS_TABLE_EMPTY(x) ((x).BssNr == 0) -#define MAC_ADDR_IS_GROUP(Addr) (((Addr[0]) & 0x01)) -#define MAC_ADDR_HASH(Addr) (Addr[0] ^ Addr[1] ^ Addr[2] ^ Addr[3] ^ Addr[4] ^ Addr[5]) -#define MAC_ADDR_HASH_INDEX(Addr) (MAC_ADDR_HASH(Addr) % HASH_TABLE_SIZE) -#define TID_MAC_HASH(Addr,TID) (TID^Addr[0] ^ Addr[1] ^ Addr[2] ^ Addr[3] ^ Addr[4] ^ Addr[5]) -#define TID_MAC_HASH_INDEX(Addr,TID) (TID_MAC_HASH(Addr,TID) % HASH_TABLE_SIZE) - -// LED Control -// assoiation ON. one LED ON. another blinking when TX, OFF when idle -// no association, both LED off -#define ASIC_LED_ACT_ON(pAd) RTMP_IO_WRITE32(pAd, MAC_CSR14, 0x00031e46) -#define ASIC_LED_ACT_OFF(pAd) RTMP_IO_WRITE32(pAd, MAC_CSR14, 0x00001e46) - -// bit definition of the 2-byte pBEACON->Capability field -#define CAP_IS_ESS_ON(x) (((x) & 0x0001) != 0) -#define CAP_IS_IBSS_ON(x) (((x) & 0x0002) != 0) -#define CAP_IS_CF_POLLABLE_ON(x) (((x) & 0x0004) != 0) -#define CAP_IS_CF_POLL_REQ_ON(x) (((x) & 0x0008) != 0) -#define CAP_IS_PRIVACY_ON(x) (((x) & 0x0010) != 0) -#define CAP_IS_SHORT_PREAMBLE_ON(x) (((x) & 0x0020) != 0) -#define CAP_IS_PBCC_ON(x) (((x) & 0x0040) != 0) -#define CAP_IS_AGILITY_ON(x) (((x) & 0x0080) != 0) -#define CAP_IS_SPECTRUM_MGMT(x) (((x) & 0x0100) != 0) // 802.11e d9 -#define CAP_IS_QOS(x) (((x) & 0x0200) != 0) // 802.11e d9 -#define CAP_IS_SHORT_SLOT(x) (((x) & 0x0400) != 0) -#define CAP_IS_APSD(x) (((x) & 0x0800) != 0) // 802.11e d9 -#define CAP_IS_IMMED_BA(x) (((x) & 0x1000) != 0) // 802.11e d9 -#define CAP_IS_DSSS_OFDM(x) (((x) & 0x2000) != 0) -#define CAP_IS_DELAY_BA(x) (((x) & 0x4000) != 0) // 802.11e d9 - -#define CAP_GENERATE(ess,ibss,priv,s_pre,s_slot,spectrum) (((ess) ? 0x0001 : 0x0000) | ((ibss) ? 0x0002 : 0x0000) | ((priv) ? 0x0010 : 0x0000) | ((s_pre) ? 0x0020 : 0x0000) | ((s_slot) ? 0x0400 : 0x0000) | ((spectrum) ? 0x0100 : 0x0000)) - -//#define STA_QOS_CAPABILITY 0 // 1-byte. see 802.11e d9.0 for bit definition - -#define ERP_IS_NON_ERP_PRESENT(x) (((x) & 0x01) != 0) // 802.11g -#define ERP_IS_USE_PROTECTION(x) (((x) & 0x02) != 0) // 802.11g -#define ERP_IS_USE_BARKER_PREAMBLE(x) (((x) & 0x04) != 0) // 802.11g - -#define DRS_TX_QUALITY_WORST_BOUND 8// 3 // just test by gary -#define DRS_PENALTY 8 - -#define BA_NOTUSE 2 -//BA Policy subfiled value in ADDBA frame -#define IMMED_BA 1 -#define DELAY_BA 0 - -// BA Initiator subfield in DELBA frame -#define ORIGINATOR 1 -#define RECIPIENT 0 - -// ADDBA Status Code -#define ADDBA_RESULTCODE_SUCCESS 0 -#define ADDBA_RESULTCODE_REFUSED 37 -#define ADDBA_RESULTCODE_INVALID_PARAMETERS 38 - -// DELBA Reason Code -#define DELBA_REASONCODE_QSTA_LEAVING 36 -#define DELBA_REASONCODE_END_BA 37 -#define DELBA_REASONCODE_UNKNOWN_BA 38 -#define DELBA_REASONCODE_TIMEOUT 39 - -// reset all OneSecTx counters -#define RESET_ONE_SEC_TX_CNT(__pEntry) \ -if (((__pEntry)) != NULL) \ -{ \ - (__pEntry)->OneSecTxRetryOkCount = 0; \ - (__pEntry)->OneSecTxFailCount = 0; \ - (__pEntry)->OneSecTxNoRetryOkCount = 0; \ -} - -// -// 802.11 frame formats -// -// HT Capability INFO field in HT Cap IE . -typedef struct PACKED { -#ifdef RT_BIG_ENDIAN - USHORT LSIGTxopProSup:1; - USHORT Forty_Mhz_Intolerant:1; - USHORT PSMP:1; - USHORT CCKmodein40:1; - USHORT AMsduSize:1; - USHORT DelayedBA:1; //rt2860c not support - USHORT RxSTBC:2; - USHORT TxSTBC:1; - USHORT ShortGIfor40:1; //for40MHz - USHORT ShortGIfor20:1; - USHORT GF:1; //green field - USHORT MimoPs:2;//momi power safe - USHORT ChannelWidth:1; - USHORT AdvCoding:1; -#else - USHORT AdvCoding:1; - USHORT ChannelWidth:1; - USHORT MimoPs:2;//momi power safe - USHORT GF:1; //green field - USHORT ShortGIfor20:1; - USHORT ShortGIfor40:1; //for40MHz - USHORT TxSTBC:1; - USHORT RxSTBC:2; - USHORT DelayedBA:1; //rt2860c not support - USHORT AMsduSize:1; // only support as zero - USHORT CCKmodein40:1; - USHORT PSMP:1; - USHORT Forty_Mhz_Intolerant:1; - USHORT LSIGTxopProSup:1; -#endif /* !RT_BIG_ENDIAN */ -} HT_CAP_INFO, *PHT_CAP_INFO; - -// HT Capability INFO field in HT Cap IE . -typedef struct PACKED { -#ifdef RT_BIG_ENDIAN - UCHAR rsv:3;//momi power safe - UCHAR MpduDensity:3; - UCHAR MaxRAmpduFactor:2; -#else - UCHAR MaxRAmpduFactor:2; - UCHAR MpduDensity:3; - UCHAR rsv:3;//momi power safe -#endif /* !RT_BIG_ENDIAN */ -} HT_CAP_PARM, *PHT_CAP_PARM; - -// HT Capability INFO field in HT Cap IE . -typedef struct PACKED { - UCHAR MCSSet[10]; - UCHAR SupRate[2]; // unit : 1Mbps -#ifdef RT_BIG_ENDIAN - UCHAR rsv:3; - UCHAR MpduDensity:1; - UCHAR TxStream:2; - UCHAR TxRxNotEqual:1; - UCHAR TxMCSSetDefined:1; -#else - UCHAR TxMCSSetDefined:1; - UCHAR TxRxNotEqual:1; - UCHAR TxStream:2; - UCHAR MpduDensity:1; - UCHAR rsv:3; -#endif // RT_BIG_ENDIAN // - UCHAR rsv3[3]; -} HT_MCS_SET, *PHT_MCS_SET; - -// HT Capability INFO field in HT Cap IE . -typedef struct PACKED { -#ifdef RT_BIG_ENDIAN - USHORT rsv2:4; - USHORT RDGSupport:1; //reverse Direction Grant support - USHORT PlusHTC:1; //+HTC control field support - USHORT MCSFeedback:2; //0:no MCS feedback, 2:unsolicited MCS feedback, 3:Full MCS feedback, 1:rsv. - USHORT rsv:5;//momi power safe - USHORT TranTime:2; - USHORT Pco:1; -#else - USHORT Pco:1; - USHORT TranTime:2; - USHORT rsv:5;//momi power safe - USHORT MCSFeedback:2; //0:no MCS feedback, 2:unsolicited MCS feedback, 3:Full MCS feedback, 1:rsv. - USHORT PlusHTC:1; //+HTC control field support - USHORT RDGSupport:1; //reverse Direction Grant support - USHORT rsv2:4; -#endif /* RT_BIG_ENDIAN */ -} EXT_HT_CAP_INFO, *PEXT_HT_CAP_INFO; - -// HT Beamforming field in HT Cap IE . -typedef struct PACKED _HT_BF_CAP{ -#ifdef RT_BIG_ENDIAN - ULONG rsv:3; - ULONG ChanEstimation:2; - ULONG CSIRowBFSup:2; - ULONG ComSteerBFAntSup:2; - ULONG NoComSteerBFAntSup:2; - ULONG CSIBFAntSup:2; - ULONG MinGrouping:2; - ULONG ExpComBF:2; - ULONG ExpNoComBF:2; - ULONG ExpCSIFbk:2; - ULONG ExpComSteerCapable:1; - ULONG ExpNoComSteerCapable:1; - ULONG ExpCSICapable:1; - ULONG Calibration:2; - ULONG ImpTxBFCapable:1; - ULONG TxNDPCapable:1; - ULONG RxNDPCapable:1; - ULONG TxSoundCapable:1; - ULONG RxSoundCapable:1; - ULONG TxBFRecCapable:1; -#else - ULONG TxBFRecCapable:1; - ULONG RxSoundCapable:1; - ULONG TxSoundCapable:1; - ULONG RxNDPCapable:1; - ULONG TxNDPCapable:1; - ULONG ImpTxBFCapable:1; - ULONG Calibration:2; - ULONG ExpCSICapable:1; - ULONG ExpNoComSteerCapable:1; - ULONG ExpComSteerCapable:1; - ULONG ExpCSIFbk:2; - ULONG ExpNoComBF:2; - ULONG ExpComBF:2; - ULONG MinGrouping:2; - ULONG CSIBFAntSup:2; - ULONG NoComSteerBFAntSup:2; - ULONG ComSteerBFAntSup:2; - ULONG CSIRowBFSup:2; - ULONG ChanEstimation:2; - ULONG rsv:3; -#endif // RT_BIG_ENDIAN // -} HT_BF_CAP, *PHT_BF_CAP; - -// HT antenna selection field in HT Cap IE . -typedef struct PACKED _HT_AS_CAP{ -#ifdef RT_BIG_ENDIAN - UCHAR rsv:1; - UCHAR TxSoundPPDU:1; - UCHAR RxASel:1; - UCHAR AntIndFbk:1; - UCHAR ExpCSIFbk:1; - UCHAR AntIndFbkTxASEL:1; - UCHAR ExpCSIFbkTxASEL:1; - UCHAR AntSelect:1; -#else - UCHAR AntSelect:1; - UCHAR ExpCSIFbkTxASEL:1; - UCHAR AntIndFbkTxASEL:1; - UCHAR ExpCSIFbk:1; - UCHAR AntIndFbk:1; - UCHAR RxASel:1; - UCHAR TxSoundPPDU:1; - UCHAR rsv:1; -#endif // RT_BIG_ENDIAN // -} HT_AS_CAP, *PHT_AS_CAP; - -// Draft 1.0 set IE length 26, but is extensible.. -#define SIZE_HT_CAP_IE 26 -// The structure for HT Capability IE. -typedef struct PACKED _HT_CAPABILITY_IE{ - HT_CAP_INFO HtCapInfo; - HT_CAP_PARM HtCapParm; -// HT_MCS_SET HtMCSSet; - UCHAR MCSSet[16]; - EXT_HT_CAP_INFO ExtHtCapInfo; - HT_BF_CAP TxBFCap; // beamforming cap. rt2860c not support beamforming. - HT_AS_CAP ASCap; //antenna selection. -} HT_CAPABILITY_IE, *PHT_CAPABILITY_IE; - - -// 802.11n draft3 related structure definitions. -// 7.3.2.60 -#define dot11OBSSScanPassiveDwell 20 // in TU. min amount of time that the STA continously scans each channel when performing an active OBSS scan. -#define dot11OBSSScanActiveDwell 10 // in TU.min amount of time that the STA continously scans each channel when performing an passive OBSS scan. -#define dot11BSSWidthTriggerScanInterval 300 // in sec. max interval between scan operations to be performed to detect BSS channel width trigger events. -#define dot11OBSSScanPassiveTotalPerChannel 200 // in TU. min total amount of time that the STA scans each channel when performing a passive OBSS scan. -#define dot11OBSSScanActiveTotalPerChannel 20 //in TU. min total amount of time that the STA scans each channel when performing a active OBSS scan -#define dot11BSSWidthChannelTransactionDelayFactor 5 // min ratio between the delay time in performing a switch from 20MHz BSS to 20/40 BSS operation and the maximum - // interval between overlapping BSS scan operations. -#define dot11BSSScanActivityThreshold 25 // in %%, max total time that a STA may be active on the medium during a period of - // (dot11BSSWidthChannelTransactionDelayFactor * dot11BSSWidthTriggerScanInterval) seconds without - // being obligated to perform OBSS Scan operations. default is 25(== 0.25%) - -typedef struct PACKED _OVERLAP_BSS_SCAN_IE{ - USHORT ScanPassiveDwell; - USHORT ScanActiveDwell; - USHORT TriggerScanInt; // Trigger scan interval - USHORT PassiveTalPerChannel; // passive total per channel - USHORT ActiveTalPerChannel; // active total per channel - USHORT DelayFactor; // BSS width channel transition delay factor - USHORT ScanActThre; // Scan Activity threshold -}OVERLAP_BSS_SCAN_IE, *POVERLAP_BSS_SCAN_IE; - - -// 7.3.2.56. 20/40 Coexistence element used in Element ID = 72 = IE_2040_BSS_COEXIST -typedef union PACKED _BSS_2040_COEXIST_IE{ - struct PACKED { - #ifdef RT_BIG_ENDIAN - UCHAR rsv:5; - UCHAR BSS20WidthReq:1; - UCHAR Intolerant40:1; - UCHAR InfoReq:1; - #else - UCHAR InfoReq:1; - UCHAR Intolerant40:1; // Inter-BSS. set 1 when prohibits a receiving BSS from operating as a 20/40 Mhz BSS. - UCHAR BSS20WidthReq:1; // Intra-BSS set 1 when prohibits a receiving AP from operating its BSS as a 20/40MHz BSS. - UCHAR rsv:5; -#endif // RT_BIG_ENDIAN // - } field; - UCHAR word; -} BSS_2040_COEXIST_IE, *PBSS_2040_COEXIST_IE; - - -typedef struct _TRIGGER_EVENTA{ - BOOLEAN bValid; - UCHAR BSSID[6]; - UCHAR RegClass; // Regulatory Class - USHORT Channel; - ULONG CDCounter; // Maintain a seperate count down counter for each Event A. -} TRIGGER_EVENTA, *PTRIGGER_EVENTA; - -// 20/40 trigger event table -// If one Event A delete or created, or if Event B is detected or not detected, STA should send 2040BSSCoexistence to AP. -#define MAX_TRIGGER_EVENT 64 -typedef struct _TRIGGER_EVENT_TAB{ - UCHAR EventANo; - TRIGGER_EVENTA EventA[MAX_TRIGGER_EVENT]; - ULONG EventBCountDown; // Count down counter for Event B. -} TRIGGER_EVENT_TAB, *PTRIGGER_EVENT_TAB; - -// 7.3.27 20/40 Bss Coexistence Mgmt capability used in extended capabilities information IE( ID = 127 = IE_EXT_CAPABILITY). -// This is the first octet and was defined in 802.11n D3.03 and 802.11yD9.0 -typedef struct PACKED _EXT_CAP_INFO_ELEMENT{ -#ifdef RT_BIG_ENDIAN - UCHAR rsv2:5; - UCHAR ExtendChannelSwitch:1; - UCHAR rsv:1; - UCHAR BssCoexistMgmtSupport:1; -#else - UCHAR BssCoexistMgmtSupport:1; - UCHAR rsv:1; - UCHAR ExtendChannelSwitch:1; - UCHAR rsv2:5; -#endif // RT_BIG_ENDIAN // -}EXT_CAP_INFO_ELEMENT, *PEXT_CAP_INFO_ELEMENT; - - -// 802.11n 7.3.2.61 -typedef struct PACKED _BSS_2040_COEXIST_ELEMENT{ - UCHAR ElementID; // ID = IE_2040_BSS_COEXIST = 72 - UCHAR Len; - BSS_2040_COEXIST_IE BssCoexistIe; -}BSS_2040_COEXIST_ELEMENT, *PBSS_2040_COEXIST_ELEMENT; - - -//802.11n 7.3.2.59 -typedef struct PACKED _BSS_2040_INTOLERANT_CH_REPORT{ - UCHAR ElementID; // ID = IE_2040_BSS_INTOLERANT_REPORT = 73 - UCHAR Len; - UCHAR RegulatoryClass; - UCHAR ChList[0]; -}BSS_2040_INTOLERANT_CH_REPORT, *PBSS_2040_INTOLERANT_CH_REPORT; - - -// The structure for channel switch annoucement IE. This is in 802.11n D3.03 -typedef struct PACKED _CHA_SWITCH_ANNOUNCE_IE{ - UCHAR SwitchMode; //channel switch mode - UCHAR NewChannel; // - UCHAR SwitchCount; // -} CHA_SWITCH_ANNOUNCE_IE, *PCHA_SWITCH_ANNOUNCE_IE; - - -// The structure for channel switch annoucement IE. This is in 802.11n D3.03 -typedef struct PACKED _SEC_CHA_OFFSET_IE{ - UCHAR SecondaryChannelOffset; // 1: Secondary above, 3: Secondary below, 0: no Secondary -} SEC_CHA_OFFSET_IE, *PSEC_CHA_OFFSET_IE; - - -// This structure is extracted from struct RT_HT_CAPABILITY -typedef struct { - BOOLEAN bHtEnable; // If we should use ht rate. - BOOLEAN bPreNHt; // If we should use ht rate. - //Substract from HT Capability IE - UCHAR MCSSet[16]; -} RT_HT_PHY_INFO, *PRT_HT_PHY_INFO; - -//This structure substracts ralink supports from all 802.11n-related features. -//Features not listed here but contained in 802.11n spec are not supported in rt2860. -typedef struct { -#ifdef RT_BIG_ENDIAN - USHORT rsv:5; - USHORT AmsduSize:1; // Max receiving A-MSDU size - USHORT AmsduEnable:1; // Enable to transmit A-MSDU. Suggest disable. We should use A-MPDU to gain best benifit of 802.11n - USHORT RxSTBC:2; // 2 bits - USHORT TxSTBC:1; - USHORT ShortGIfor40:1; //for40MHz - USHORT ShortGIfor20:1; - USHORT GF:1; //green field - USHORT MimoPs:2;//mimo power safe MMPS_ - USHORT ChannelWidth:1; -#else - USHORT ChannelWidth:1; - USHORT MimoPs:2;//mimo power safe MMPS_ - USHORT GF:1; //green field - USHORT ShortGIfor20:1; - USHORT ShortGIfor40:1; //for40MHz - USHORT TxSTBC:1; - USHORT RxSTBC:2; // 2 bits - USHORT AmsduEnable:1; // Enable to transmit A-MSDU. Suggest disable. We should use A-MPDU to gain best benifit of 802.11n - USHORT AmsduSize:1; // Max receiving A-MSDU size - USHORT rsv:5; -#endif - - //Substract from Addiont HT INFO IE -#ifdef RT_BIG_ENDIAN - UCHAR RecomWidth:1; - UCHAR ExtChanOffset:2; // Please not the difference with following UCHAR NewExtChannelOffset; from 802.11n - UCHAR MpduDensity:3; - UCHAR MaxRAmpduFactor:2; -#else - UCHAR MaxRAmpduFactor:2; - UCHAR MpduDensity:3; - UCHAR ExtChanOffset:2; // Please not the difference with following UCHAR NewExtChannelOffset; from 802.11n - UCHAR RecomWidth:1; -#endif - -#ifdef RT_BIG_ENDIAN - USHORT rsv2:11; - USHORT OBSS_NonHTExist:1; - USHORT rsv3:1; - USHORT NonGfPresent:1; - USHORT OperaionMode:2; -#else - USHORT OperaionMode:2; - USHORT NonGfPresent:1; - USHORT rsv3:1; - USHORT OBSS_NonHTExist:1; - USHORT rsv2:11; -#endif - - // New Extension Channel Offset IE - UCHAR NewExtChannelOffset; - // Extension Capability IE = 127 - UCHAR BSSCoexist2040; -} RT_HT_CAPABILITY, *PRT_HT_CAPABILITY; - -// field in Addtional HT Information IE . -typedef struct PACKED { -#ifdef RT_BIG_ENDIAN - UCHAR SerInterGranu:3; - UCHAR S_PSMPSup:1; - UCHAR RifsMode:1; - UCHAR RecomWidth:1; - UCHAR ExtChanOffset:2; -#else - UCHAR ExtChanOffset:2; - UCHAR RecomWidth:1; - UCHAR RifsMode:1; - UCHAR S_PSMPSup:1; //Indicate support for scheduled PSMP - UCHAR SerInterGranu:3; //service interval granularity -#endif -} ADD_HTINFO, *PADD_HTINFO; - -typedef struct PACKED{ -#ifdef RT_BIG_ENDIAN - USHORT rsv2:11; - USHORT OBSS_NonHTExist:1; - USHORT rsv:1; - USHORT NonGfPresent:1; - USHORT OperaionMode:2; -#else - USHORT OperaionMode:2; - USHORT NonGfPresent:1; - USHORT rsv:1; - USHORT OBSS_NonHTExist:1; - USHORT rsv2:11; -#endif -} ADD_HTINFO2, *PADD_HTINFO2; - - -// TODO: Need sync with spec about the definition of StbcMcs. In Draft 3.03, it's reserved. -typedef struct PACKED{ -#ifdef RT_BIG_ENDIAN - USHORT rsv:4; - USHORT PcoPhase:1; - USHORT PcoActive:1; - USHORT LsigTxopProt:1; - USHORT STBCBeacon:1; - USHORT DualCTSProtect:1; - USHORT DualBeacon:1; - USHORT StbcMcs:6; -#else - USHORT StbcMcs:6; - USHORT DualBeacon:1; - USHORT DualCTSProtect:1; - USHORT STBCBeacon:1; - USHORT LsigTxopProt:1; // L-SIG TXOP protection full support - USHORT PcoActive:1; - USHORT PcoPhase:1; - USHORT rsv:4; -#endif // RT_BIG_ENDIAN // -} ADD_HTINFO3, *PADD_HTINFO3; - -#define SIZE_ADD_HT_INFO_IE 22 -typedef struct PACKED{ - UCHAR ControlChan; - ADD_HTINFO AddHtInfo; - ADD_HTINFO2 AddHtInfo2; - ADD_HTINFO3 AddHtInfo3; - UCHAR MCSSet[16]; // Basic MCS set -} ADD_HT_INFO_IE, *PADD_HT_INFO_IE; - -typedef struct PACKED{ - UCHAR NewExtChanOffset; -} NEW_EXT_CHAN_IE, *PNEW_EXT_CHAN_IE; - -typedef struct PACKED _FRAME_802_11 { - HEADER_802_11 Hdr; - UCHAR Octet[1]; -} FRAME_802_11, *PFRAME_802_11; - -// QoSNull embedding of management action. When HT Control MA field set to 1. -typedef struct PACKED _MA_BODY { - UCHAR Category; - UCHAR Action; - UCHAR Octet[1]; -} MA_BODY, *PMA_BODY; - -typedef struct PACKED _HEADER_802_3 { - UCHAR DAAddr1[MAC_ADDR_LEN]; - UCHAR SAAddr2[MAC_ADDR_LEN]; - UCHAR Octet[2]; -} HEADER_802_3, *PHEADER_802_3; -////Block ACK related format -// 2-byte BA Parameter field in DELBA frames to terminate an already set up bA -typedef struct PACKED{ -#ifdef RT_BIG_ENDIAN - USHORT TID:4; // value of TC os TS - USHORT Initiator:1; // 1: originator 0:recipient - USHORT Rsv:11; // always set to 0 -#else - USHORT Rsv:11; // always set to 0 - USHORT Initiator:1; // 1: originator 0:recipient - USHORT TID:4; // value of TC os TS -#endif /* !RT_BIG_ENDIAN */ -} DELBA_PARM, *PDELBA_PARM; - -// 2-byte BA Parameter Set field in ADDBA frames to signal parm for setting up a BA -typedef struct PACKED { -#ifdef RT_BIG_ENDIAN - USHORT BufSize:10; // number of buffe of size 2304 octetsr - USHORT TID:4; // value of TC os TS - USHORT BAPolicy:1; // 1: immediately BA 0:delayed BA - USHORT AMSDUSupported:1; // 0: not permitted 1: permitted -#else - USHORT AMSDUSupported:1; // 0: not permitted 1: permitted - USHORT BAPolicy:1; // 1: immediately BA 0:delayed BA - USHORT TID:4; // value of TC os TS - USHORT BufSize:10; // number of buffe of size 2304 octetsr -#endif /* !RT_BIG_ENDIAN */ -} BA_PARM, *PBA_PARM; - -// 2-byte BA Starting Seq CONTROL field -typedef union PACKED { - struct PACKED { -#ifdef RT_BIG_ENDIAN - USHORT StartSeq:12; // sequence number of the 1st MSDU for which this BAR is sent - USHORT FragNum:4; // always set to 0 -#else - USHORT FragNum:4; // always set to 0 - USHORT StartSeq:12; // sequence number of the 1st MSDU for which this BAR is sent -#endif /* RT_BIG_ENDIAN */ - } field; - USHORT word; -} BASEQ_CONTROL, *PBASEQ_CONTROL; - -//BAControl and BARControl are the same -// 2-byte BA CONTROL field in BA frame -typedef struct PACKED { -#ifdef RT_BIG_ENDIAN - USHORT TID:4; - USHORT Rsv:9; - USHORT Compressed:1; - USHORT MTID:1; //EWC V1.24 - USHORT ACKPolicy:1; // only related to N-Delayed BA. But not support in RT2860b. 0:NormalACK 1:No ACK -#else - USHORT ACKPolicy:1; // only related to N-Delayed BA. But not support in RT2860b. 0:NormalACK 1:No ACK - USHORT MTID:1; //EWC V1.24 - USHORT Compressed:1; - USHORT Rsv:9; - USHORT TID:4; -#endif /* !RT_BIG_ENDIAN */ -} BA_CONTROL, *PBA_CONTROL; - -// 2-byte BAR CONTROL field in BAR frame -typedef struct PACKED { -#ifdef RT_BIG_ENDIAN - USHORT TID:4; - USHORT Rsv1:9; - USHORT Compressed:1; - USHORT MTID:1; //if this bit1, use FRAME_MTBA_REQ, if 0, use FRAME_BA_REQ - USHORT ACKPolicy:1; -#else - USHORT ACKPolicy:1; // 0:normal ack, 1:no ack. - USHORT MTID:1; //if this bit1, use FRAME_MTBA_REQ, if 0, use FRAME_BA_REQ - USHORT Compressed:1; - USHORT Rsv1:9; - USHORT TID:4; -#endif /* !RT_BIG_ENDIAN */ -} BAR_CONTROL, *PBAR_CONTROL; - -// BARControl in MTBAR frame -typedef struct PACKED { -#ifdef RT_BIG_ENDIAN - USHORT NumTID:4; - USHORT Rsv1:9; - USHORT Compressed:1; - USHORT MTID:1; - USHORT ACKPolicy:1; -#else - USHORT ACKPolicy:1; - USHORT MTID:1; - USHORT Compressed:1; - USHORT Rsv1:9; - USHORT NumTID:4; -#endif /* !RT_BIG_ENDIAN */ -} MTBAR_CONTROL, *PMTBAR_CONTROL; - -typedef struct PACKED { -#ifdef RT_BIG_ENDIAN - USHORT TID:4; - USHORT Rsv1:12; -#else - USHORT Rsv1:12; - USHORT TID:4; -#endif /* !RT_BIG_ENDIAN */ -} PER_TID_INFO, *PPER_TID_INFO; - -typedef struct { - PER_TID_INFO PerTID; - BASEQ_CONTROL BAStartingSeq; -} EACH_TID, *PEACH_TID; - - -// BAREQ AND MTBAREQ have the same subtype BAR, 802.11n BAR use compressed bitmap. -typedef struct PACKED _FRAME_BA_REQ { - FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; - BAR_CONTROL BARControl; - BASEQ_CONTROL BAStartingSeq; -} FRAME_BA_REQ, *PFRAME_BA_REQ; - -typedef struct PACKED _FRAME_MTBA_REQ { - FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; - MTBAR_CONTROL MTBARControl; - PER_TID_INFO PerTIDInfo; - BASEQ_CONTROL BAStartingSeq; -} FRAME_MTBA_REQ, *PFRAME_MTBA_REQ; - -// Compressed format is mandantory in HT STA -typedef struct PACKED _FRAME_MTBA { - FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; - BA_CONTROL BAControl; - BASEQ_CONTROL BAStartingSeq; - UCHAR BitMap[8]; -} FRAME_MTBA, *PFRAME_MTBA; - -typedef struct PACKED _FRAME_PSMP_ACTION { - HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; - UCHAR Psmp; // 7.3.1.25 -} FRAME_PSMP_ACTION, *PFRAME_PSMP_ACTION; - -typedef struct PACKED _FRAME_ACTION_HDR { - HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; -} FRAME_ACTION_HDR, *PFRAME_ACTION_HDR; - -//Action Frame -//Action Frame Category:Spectrum, Action:Channel Switch. 7.3.2.20 -typedef struct PACKED _CHAN_SWITCH_ANNOUNCE { - UCHAR ElementID; // ID = IE_CHANNEL_SWITCH_ANNOUNCEMENT = 37 - UCHAR Len; - CHA_SWITCH_ANNOUNCE_IE CSAnnounceIe; -} CHAN_SWITCH_ANNOUNCE, *PCHAN_SWITCH_ANNOUNCE; - - -//802.11n : 7.3.2.20a -typedef struct PACKED _SECOND_CHAN_OFFSET { - UCHAR ElementID; // ID = IE_SECONDARY_CH_OFFSET = 62 - UCHAR Len; - SEC_CHA_OFFSET_IE SecChOffsetIe; -} SECOND_CHAN_OFFSET, *PSECOND_CHAN_OFFSET; - - -typedef struct PACKED _FRAME_SPETRUM_CS { - HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; - CHAN_SWITCH_ANNOUNCE CSAnnounce; - SECOND_CHAN_OFFSET SecondChannel; -} FRAME_SPETRUM_CS, *PFRAME_SPETRUM_CS; - - -typedef struct PACKED _FRAME_ADDBA_REQ { - HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; - UCHAR Token; // 1 - BA_PARM BaParm; // 2 - 10 - USHORT TimeOutValue; // 0 - 0 - BASEQ_CONTROL BaStartSeq; // 0-0 -} FRAME_ADDBA_REQ, *PFRAME_ADDBA_REQ; - -typedef struct PACKED _FRAME_ADDBA_RSP { - HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; - UCHAR Token; - USHORT StatusCode; - BA_PARM BaParm; //0 - 2 - USHORT TimeOutValue; -} FRAME_ADDBA_RSP, *PFRAME_ADDBA_RSP; - -typedef struct PACKED _FRAME_DELBA_REQ { - HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; - DELBA_PARM DelbaParm; - USHORT ReasonCode; -} FRAME_DELBA_REQ, *PFRAME_DELBA_REQ; - - -//7.2.1.7 -typedef struct PACKED _FRAME_BAR { - FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; - BAR_CONTROL BarControl; - BASEQ_CONTROL StartingSeq; -} FRAME_BAR, *PFRAME_BAR; - -//7.2.1.7 -typedef struct PACKED _FRAME_BA { - FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; - BAR_CONTROL BarControl; - BASEQ_CONTROL StartingSeq; - UCHAR bitmask[8]; -} FRAME_BA, *PFRAME_BA; - - -// Radio Measuement Request Frame Format -typedef struct PACKED _FRAME_RM_REQ_ACTION { - HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; - UCHAR Token; - USHORT Repetition; - UCHAR data[0]; -} FRAME_RM_REQ_ACTION, *PFRAME_RM_REQ_ACTION; - -typedef struct PACKED { - UCHAR ID; - UCHAR Length; - UCHAR ChannelSwitchMode; - UCHAR NewRegClass; - UCHAR NewChannelNum; - UCHAR ChannelSwitchCount; -} HT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE, *PHT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE; - - -// -// _Limit must be the 2**n - 1 -// _SEQ1 , _SEQ2 must be within 0 ~ _Limit -// -#define SEQ_STEPONE(_SEQ1, _SEQ2, _Limit) ((_SEQ1 == ((_SEQ2+1) & _Limit))) -#define SEQ_SMALLER(_SEQ1, _SEQ2, _Limit) (((_SEQ1-_SEQ2) & ((_Limit+1)>>1))) -#define SEQ_LARGER(_SEQ1, _SEQ2, _Limit) ((_SEQ1 != _SEQ2) && !(((_SEQ1-_SEQ2) & ((_Limit+1)>>1)))) -#define SEQ_WITHIN_WIN(_SEQ1, _SEQ2, _WIN, _Limit) (SEQ_LARGER(_SEQ1, _SEQ2, _Limit) && \ - SEQ_SMALLER(_SEQ1, ((_SEQ2+_WIN+1)&_Limit), _Limit)) - -// -// Contention-free parameter (without ID and Length) -// -typedef struct PACKED { - BOOLEAN bValid; // 1: variable contains valid value - UCHAR CfpCount; - UCHAR CfpPeriod; - USHORT CfpMaxDuration; - USHORT CfpDurRemaining; -} CF_PARM, *PCF_PARM; - -typedef struct _CIPHER_SUITE { - NDIS_802_11_ENCRYPTION_STATUS PairCipher; // Unicast cipher 1, this one has more secured cipher suite - NDIS_802_11_ENCRYPTION_STATUS PairCipherAux; // Unicast cipher 2 if AP announce two unicast cipher suite - NDIS_802_11_ENCRYPTION_STATUS GroupCipher; // Group cipher - USHORT RsnCapability; // RSN capability from beacon - BOOLEAN bMixMode; // Indicate Pair & Group cipher might be different -} CIPHER_SUITE, *PCIPHER_SUITE; - -// EDCA configuration from AP's BEACON/ProbeRsp -typedef struct { - BOOLEAN bValid; // 1: variable contains valid value - BOOLEAN bAdd; // 1: variable contains valid value - BOOLEAN bQAck; - BOOLEAN bQueueRequest; - BOOLEAN bTxopRequest; - BOOLEAN bAPSDCapable; -// BOOLEAN bMoreDataAck; - UCHAR EdcaUpdateCount; - UCHAR Aifsn[4]; // 0:AC_BK, 1:AC_BE, 2:AC_VI, 3:AC_VO - UCHAR Cwmin[4]; - UCHAR Cwmax[4]; - USHORT Txop[4]; // in unit of 32-us - BOOLEAN bACM[4]; // 1: Admission Control of AC_BK is mandattory -} EDCA_PARM, *PEDCA_PARM; - -// QBSS LOAD information from QAP's BEACON/ProbeRsp -typedef struct { - BOOLEAN bValid; // 1: variable contains valid value - USHORT StaNum; - UCHAR ChannelUtilization; - USHORT RemainingAdmissionControl; // in unit of 32-us -} QBSS_LOAD_PARM, *PQBSS_LOAD_PARM; - -// QBSS Info field in QSTA's assoc req -typedef struct PACKED { -#ifdef RT_BIG_ENDIAN - UCHAR Rsv2:1; - UCHAR MaxSPLength:2; - UCHAR Rsv1:1; - UCHAR UAPSD_AC_BE:1; - UCHAR UAPSD_AC_BK:1; - UCHAR UAPSD_AC_VI:1; - UCHAR UAPSD_AC_VO:1; -#else - UCHAR UAPSD_AC_VO:1; - UCHAR UAPSD_AC_VI:1; - UCHAR UAPSD_AC_BK:1; - UCHAR UAPSD_AC_BE:1; - UCHAR Rsv1:1; - UCHAR MaxSPLength:2; - UCHAR Rsv2:1; -#endif /* !RT_BIG_ENDIAN */ -} QBSS_STA_INFO_PARM, *PQBSS_STA_INFO_PARM; - -// QBSS Info field in QAP's Beacon/ProbeRsp -typedef struct PACKED { -#ifdef RT_BIG_ENDIAN - UCHAR UAPSD:1; - UCHAR Rsv:3; - UCHAR ParamSetCount:4; -#else - UCHAR ParamSetCount:4; - UCHAR Rsv:3; - UCHAR UAPSD:1; -#endif /* !RT_BIG_ENDIAN */ -} QBSS_AP_INFO_PARM, *PQBSS_AP_INFO_PARM; - -// QOS Capability reported in QAP's BEACON/ProbeRsp -// QOS Capability sent out in QSTA's AssociateReq/ReAssociateReq -typedef struct { - BOOLEAN bValid; // 1: variable contains valid value - BOOLEAN bQAck; - BOOLEAN bQueueRequest; - BOOLEAN bTxopRequest; -// BOOLEAN bMoreDataAck; - UCHAR EdcaUpdateCount; -} QOS_CAPABILITY_PARM, *PQOS_CAPABILITY_PARM; - -#ifdef CONFIG_STA_SUPPORT -typedef struct { - UCHAR IELen; - UCHAR IE[MAX_CUSTOM_LEN]; -} WPA_IE_; -#endif // CONFIG_STA_SUPPORT // - - -typedef struct { - UCHAR Bssid[MAC_ADDR_LEN]; - UCHAR Channel; - UCHAR CentralChannel; //Store the wide-band central channel for 40MHz. .used in 40MHz AP. Or this is the same as Channel. - UCHAR BssType; - USHORT AtimWin; - USHORT BeaconPeriod; - - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR ExtRateLen; - HT_CAPABILITY_IE HtCapability; - UCHAR HtCapabilityLen; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE - UCHAR AddHtInfoLen; - UCHAR NewExtChanOffset; - CHAR Rssi; - UCHAR Privacy; // Indicate security function ON/OFF. Don't mess up with auth mode. - UCHAR Hidden; - - USHORT DtimPeriod; - USHORT CapabilityInfo; - - USHORT CfpCount; - USHORT CfpPeriod; - USHORT CfpMaxDuration; - USHORT CfpDurRemaining; - UCHAR SsidLen; - CHAR Ssid[MAX_LEN_OF_SSID]; - - ULONG LastBeaconRxTime; // OS's timestamp - - BOOLEAN bSES; - - // New for WPA2 - CIPHER_SUITE WPA; // AP announced WPA cipher suite - CIPHER_SUITE WPA2; // AP announced WPA2 cipher suite - - // New for microsoft WPA support - NDIS_802_11_FIXED_IEs FixIEs; - NDIS_802_11_AUTHENTICATION_MODE AuthModeAux; // Addition mode for WPA2 / WPA capable AP - NDIS_802_11_AUTHENTICATION_MODE AuthMode; - NDIS_802_11_WEP_STATUS WepStatus; // Unicast Encryption Algorithm extract from VAR_IE - USHORT VarIELen; // Length of next VIE include EID & Length - UCHAR VarIEs[MAX_VIE_LEN]; - - // CCX Ckip information - UCHAR CkipFlag; - - // CCX 2 TSF - UCHAR PTSF[4]; // Parent TSF - UCHAR TTSF[8]; // Target TSF - - // 802.11e d9, and WMM - EDCA_PARM EdcaParm; - QOS_CAPABILITY_PARM QosCapability; - QBSS_LOAD_PARM QbssLoad; -#ifdef CONFIG_STA_SUPPORT - WPA_IE_ WpaIE; - WPA_IE_ RsnIE; -#ifdef EXT_BUILD_CHANNEL_LIST - UCHAR CountryString[3]; - BOOLEAN bHasCountryIE; -#endif // EXT_BUILD_CHANNEL_LIST // -#endif // CONFIG_STA_SUPPORT // - -} BSS_ENTRY, *PBSS_ENTRY; - -typedef struct { - UCHAR BssNr; - UCHAR BssOverlapNr; - BSS_ENTRY BssEntry[MAX_LEN_OF_BSS_TABLE]; -} BSS_TABLE, *PBSS_TABLE; - - -typedef struct _MLME_QUEUE_ELEM { - ULONG Machine; - ULONG MsgType; - ULONG MsgLen; - UCHAR Msg[MGMT_DMA_BUFFER_SIZE]; - LARGE_INTEGER TimeStamp; - UCHAR Rssi0; - UCHAR Rssi1; - UCHAR Rssi2; - UCHAR Signal; - UCHAR Channel; - UCHAR Wcid; - BOOLEAN Occupied; -#ifdef MLME_EX - USHORT Idx; -#endif // MLME_EX // -} MLME_QUEUE_ELEM, *PMLME_QUEUE_ELEM; - -typedef struct _MLME_QUEUE { - ULONG Num; - ULONG Head; - ULONG Tail; - NDIS_SPIN_LOCK Lock; - MLME_QUEUE_ELEM Entry[MAX_LEN_OF_MLME_QUEUE]; -} MLME_QUEUE, *PMLME_QUEUE; - -typedef VOID (*STATE_MACHINE_FUNC)(VOID *Adaptor, MLME_QUEUE_ELEM *Elem); - -typedef struct _STATE_MACHINE { - ULONG Base; - ULONG NrState; - ULONG NrMsg; - ULONG CurrState; - STATE_MACHINE_FUNC *TransFunc; -} STATE_MACHINE, *PSTATE_MACHINE; - - -// MLME AUX data structure that hold temporarliy settings during a connection attempt. -// Once this attemp succeeds, all settings will be copy to pAd->StaActive. -// A connection attempt (user set OID, roaming, CCX fast roaming,..) consists of -// several steps (JOIN, AUTH, ASSOC or REASSOC) and may fail at any step. We purposely -// separate this under-trial settings away from pAd->StaActive so that once -// this new attempt failed, driver can auto-recover back to the active settings. -typedef struct _MLME_AUX { - UCHAR BssType; - UCHAR Ssid[MAX_LEN_OF_SSID]; - UCHAR SsidLen; - UCHAR Bssid[MAC_ADDR_LEN]; - UCHAR AutoReconnectSsid[MAX_LEN_OF_SSID]; - UCHAR AutoReconnectSsidLen; - USHORT Alg; - UCHAR ScanType; - UCHAR Channel; - UCHAR CentralChannel; - USHORT Aid; - USHORT CapabilityInfo; - USHORT BeaconPeriod; - USHORT CfpMaxDuration; - USHORT CfpPeriod; - USHORT AtimWin; - - // Copy supported rate from desired AP's beacon. We are trying to match - // AP's supported and extended rate settings. - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen; - UCHAR ExtRateLen; - HT_CAPABILITY_IE HtCapability; - UCHAR HtCapabilityLen; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE - UCHAR NewExtChannelOffset; - //RT_HT_CAPABILITY SupportedHtPhy; - - // new for QOS - QOS_CAPABILITY_PARM APQosCapability; // QOS capability of the current associated AP - EDCA_PARM APEdcaParm; // EDCA parameters of the current associated AP - QBSS_LOAD_PARM APQbssLoad; // QBSS load of the current associated AP - - // new to keep Ralink specific feature - ULONG APRalinkIe; - - BSS_TABLE SsidBssTab; // AP list for the same SSID - BSS_TABLE RoamTab; // AP list eligible for roaming - ULONG BssIdx; - ULONG RoamIdx; - - BOOLEAN CurrReqIsFromNdis; - - RALINK_TIMER_STRUCT BeaconTimer, ScanTimer; - RALINK_TIMER_STRUCT AuthTimer; - RALINK_TIMER_STRUCT AssocTimer, ReassocTimer, DisassocTimer; - -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // -} MLME_AUX, *PMLME_AUX; - -typedef struct _MLME_ADDBA_REQ_STRUCT{ - UCHAR Wcid; // - UCHAR pAddr[MAC_ADDR_LEN]; - UCHAR BaBufSize; - USHORT TimeOutValue; - UCHAR TID; - UCHAR Token; - USHORT BaStartSeq; -} MLME_ADDBA_REQ_STRUCT, *PMLME_ADDBA_REQ_STRUCT; - - -typedef struct _MLME_DELBA_REQ_STRUCT{ - UCHAR Wcid; // - UCHAR Addr[MAC_ADDR_LEN]; - UCHAR TID; - UCHAR Initiator; -} MLME_DELBA_REQ_STRUCT, *PMLME_DELBA_REQ_STRUCT; - -// assoc struct is equal to reassoc -typedef struct _MLME_ASSOC_REQ_STRUCT{ - UCHAR Addr[MAC_ADDR_LEN]; - USHORT CapabilityInfo; - USHORT ListenIntv; - ULONG Timeout; -} MLME_ASSOC_REQ_STRUCT, *PMLME_ASSOC_REQ_STRUCT, MLME_REASSOC_REQ_STRUCT, *PMLME_REASSOC_REQ_STRUCT; - -typedef struct _MLME_DISASSOC_REQ_STRUCT{ - UCHAR Addr[MAC_ADDR_LEN]; - USHORT Reason; -} MLME_DISASSOC_REQ_STRUCT, *PMLME_DISASSOC_REQ_STRUCT; - -typedef struct _MLME_AUTH_REQ_STRUCT { - UCHAR Addr[MAC_ADDR_LEN]; - USHORT Alg; - ULONG Timeout; -} MLME_AUTH_REQ_STRUCT, *PMLME_AUTH_REQ_STRUCT; - -typedef struct _MLME_DEAUTH_REQ_STRUCT { - UCHAR Addr[MAC_ADDR_LEN]; - USHORT Reason; -} MLME_DEAUTH_REQ_STRUCT, *PMLME_DEAUTH_REQ_STRUCT; - -typedef struct { - ULONG BssIdx; -} MLME_JOIN_REQ_STRUCT; - -typedef struct _MLME_SCAN_REQ_STRUCT { - UCHAR Bssid[MAC_ADDR_LEN]; - UCHAR BssType; - UCHAR ScanType; - UCHAR SsidLen; - CHAR Ssid[MAX_LEN_OF_SSID]; -} MLME_SCAN_REQ_STRUCT, *PMLME_SCAN_REQ_STRUCT; - -typedef struct _MLME_START_REQ_STRUCT { - CHAR Ssid[MAX_LEN_OF_SSID]; - UCHAR SsidLen; -} MLME_START_REQ_STRUCT, *PMLME_START_REQ_STRUCT; - -#ifdef CONFIG_STA_SUPPORT -#ifdef QOS_DLS_SUPPORT -// structure for DLS -typedef struct _RT_802_11_DLS { - USHORT TimeOut; // Use to time out while slience, unit: second , set by UI - USHORT CountDownTimer; // Use to time out while slience,unit: second , used by driver only - NDIS_802_11_MAC_ADDRESS MacAddr; // set by UI - UCHAR Status; // 0: none , 1: wait STAkey, 2: finish DLS setup , set by driver only - BOOLEAN Valid; // 1: valid , 0: invalid , set by UI, use to setup or tear down DLS link - RALINK_TIMER_STRUCT Timer; // Use to time out while handshake - USHORT Sequence; - USHORT MacTabMatchWCID; // ASIC - BOOLEAN bHTCap; - PVOID pAd; -} RT_802_11_DLS, *PRT_802_11_DLS; - -typedef struct _MLME_DLS_REQ_STRUCT { - PRT_802_11_DLS pDLS; - USHORT Reason; -} MLME_DLS_REQ_STRUCT, *PMLME_DLS_REQ_STRUCT; -#endif // QOS_DLS_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - -typedef struct PACKED { - UCHAR Eid; - UCHAR Len; - UCHAR Octet[1]; -} EID_STRUCT,*PEID_STRUCT, BEACON_EID_STRUCT, *PBEACON_EID_STRUCT; - -typedef struct PACKED _RTMP_TX_RATE_SWITCH -{ - UCHAR ItemNo; -#ifdef RT_BIG_ENDIAN - UCHAR Rsv2:2; - UCHAR Mode:2; - UCHAR Rsv1:1; - UCHAR BW:1; - UCHAR ShortGI:1; - UCHAR STBC:1; -#else - UCHAR STBC:1; - UCHAR ShortGI:1; - UCHAR BW:1; - UCHAR Rsv1:1; - UCHAR Mode:2; - UCHAR Rsv2:2; -#endif - UCHAR CurrMCS; - UCHAR TrainUp; - UCHAR TrainDown; -} RRTMP_TX_RATE_SWITCH, *PRTMP_TX_RATE_SWITCH; - -// ========================== AP mlme.h =============================== -#define TBTT_PRELOAD_TIME 384 // usec. LomgPreamble + 24-byte at 1Mbps -#define DEFAULT_DTIM_PERIOD 1 - -// weighting factor to calculate Channel quality, total should be 100% -//#define RSSI_WEIGHTING 0 -//#define TX_WEIGHTING 40 -//#define RX_WEIGHTING 60 - -#define MAC_TABLE_AGEOUT_TIME 300 // unit: sec -#define MAC_TABLE_ASSOC_TIMEOUT 5 // unit: sec -#define MAC_TABLE_FULL(Tab) ((Tab).size == MAX_LEN_OF_MAC_TABLE) - -// AP shall drop the sta if contine Tx fail count reach it. -#define MAC_ENTRY_LIFE_CHECK_CNT 20 // packet cnt. - -// Value domain of pMacEntry->Sst -typedef enum _Sst { - SST_NOT_AUTH, // 0: equivalent to IEEE 802.11/1999 state 1 - SST_AUTH, // 1: equivalent to IEEE 802.11/1999 state 2 - SST_ASSOC // 2: equivalent to IEEE 802.11/1999 state 3 -} SST; - -// value domain of pMacEntry->AuthState -typedef enum _AuthState { - AS_NOT_AUTH, - AS_AUTH_OPEN, // STA has been authenticated using OPEN SYSTEM - AS_AUTH_KEY, // STA has been authenticated using SHARED KEY - AS_AUTHENTICATING // STA is waiting for AUTH seq#3 using SHARED KEY -} AUTH_STATE; - -//for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114 -typedef enum _ApWpaState { - AS_NOTUSE, // 0 - AS_DISCONNECT, // 1 - AS_DISCONNECTED, // 2 - AS_INITIALIZE, // 3 - AS_AUTHENTICATION, // 4 - AS_AUTHENTICATION2, // 5 - AS_INITPMK, // 6 - AS_INITPSK, // 7 - AS_PTKSTART, // 8 - AS_PTKINIT_NEGOTIATING, // 9 - AS_PTKINITDONE, // 10 - AS_UPDATEKEYS, // 11 - AS_INTEGRITY_FAILURE, // 12 - AS_KEYUPDATE, // 13 -} AP_WPA_STATE; - -// for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114 -typedef enum _GTKState { - REKEY_NEGOTIATING, - REKEY_ESTABLISHED, - KEYERROR, -} GTK_STATE; - -// for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114 -typedef enum _WpaGTKState { - SETKEYS, - SETKEYS_DONE, -} WPA_GTK_STATE; -// ====================== end of AP mlme.h ============================ - - -#endif // MLME_H__ diff --git a/drivers/staging/rt3090/mlme_ex.h b/drivers/staging/rt3090/mlme_ex.h deleted file mode 100644 index b3e94dc88375..000000000000 --- a/drivers/staging/rt3090/mlme_ex.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - mlme_ex.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Fonchi 2007-06-25 Extend original mlme APIs to support multi-entries -*/ -#ifndef __MLME_EX_H__ -#define __MLME_EX_H__ - -#include "mlme_ex_def.h" - - -VOID StateMachineInitEx( - IN STATE_MACHINE_EX *S, - IN STATE_MACHINE_FUNC_EX Trans[], - IN ULONG StNr, - IN ULONG MsgNr, - IN STATE_MACHINE_FUNC_EX DefFunc, - IN ULONG InitState, - IN ULONG Base); - -VOID StateMachineSetActionEx( - IN STATE_MACHINE_EX *S, - IN ULONG St, - IN ULONG Msg, - IN STATE_MACHINE_FUNC_EX Func); - -BOOLEAN isValidApCliIf( - SHORT Idx); - -VOID StateMachinePerformActionEx( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE_EX *S, - IN MLME_QUEUE_ELEM *Elem, - USHORT Idx, - PULONG pCurrState); - -BOOLEAN MlmeEnqueueEx( - IN PRTMP_ADAPTER pAd, - IN ULONG Machine, - IN ULONG MsgType, - IN ULONG MsgLen, - IN VOID *Msg, - IN USHORT Idx); - -VOID DropEx( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem, - PULONG pCurrState, - USHORT Idx); - -#endif /* __MLME_EX_H__ */ diff --git a/drivers/staging/rt3090/mlme_ex_def.h b/drivers/staging/rt3090/mlme_ex_def.h deleted file mode 100644 index ccd60b41614a..000000000000 --- a/drivers/staging/rt3090/mlme_ex_def.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - mlme_ex_def.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Fonchi 2007-06-25 Extend original mlme APIs to support multi-entries -*/ -#ifndef __MLME_EX_DEF_H__ -#define __MLME_EX_DEF_H__ - - -typedef VOID (*STATE_MACHINE_FUNC_EX)(VOID *Adaptor, MLME_QUEUE_ELEM *Elem, PULONG pCurrState, USHORT Idx); - -typedef struct _STA_STATE_MACHINE_EX -{ - ULONG Base; - ULONG NrState; - ULONG NrMsg; - ULONG CurrState; - STATE_MACHINE_FUNC_EX *TransFunc; -} STATE_MACHINE_EX, *PSTA_STATE_MACHINE_EX; - -#endif // __MLME_EX_DEF_H__ // diff --git a/drivers/staging/rt3090/netif_block.h b/drivers/staging/rt3090/netif_block.h deleted file mode 100644 index 9e753894f294..000000000000 --- a/drivers/staging/rt3090/netif_block.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - */ - -#ifndef __NET_IF_BLOCK_H__ -#define __NET_IF_BLOCK_H__ - -#include "link_list.h" -#include "rtmp.h" - -#define FREE_NETIF_POOL_SIZE 32 - -typedef struct _NETIF_ENTRY -{ - struct _NETIF_ENTRY *pNext; - PNET_DEV pNetDev; -} NETIF_ENTRY, *PNETIF_ENTRY; - -void initblockQueueTab( - IN PRTMP_ADAPTER pAd); - -BOOLEAN blockNetIf( - IN PBLOCK_QUEUE_ENTRY pBlockQueueEntry, - IN PNET_DEV pNetDev); - -VOID releaseNetIf( - IN PBLOCK_QUEUE_ENTRY pBlockQueueEntry); - -VOID StopNetIfQueue( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket); -#endif // __NET_IF_BLOCK_H__ diff --git a/drivers/staging/rt3090/oid.h b/drivers/staging/rt3090/oid.h deleted file mode 100644 index 25927c1322e3..000000000000 --- a/drivers/staging/rt3090/oid.h +++ /dev/null @@ -1,1015 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - oid.h - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Name Date Modification logs -*/ -#ifndef _OID_H_ -#define _OID_H_ - -//#include - -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif -// -// IEEE 802.11 Structures and definitions -// -#define MAX_TX_POWER_LEVEL 100 /* mW */ -#define MAX_RSSI_TRIGGER -10 /* dBm */ -#define MIN_RSSI_TRIGGER -200 /* dBm */ -#define MAX_FRAG_THRESHOLD 2346 /* byte count */ -#define MIN_FRAG_THRESHOLD 256 /* byte count */ -#define MAX_RTS_THRESHOLD 2347 /* byte count */ - -// new types for Media Specific Indications -// Extension channel offset -#define EXTCHA_NONE 0 -#define EXTCHA_ABOVE 0x1 -#define EXTCHA_BELOW 0x3 - -// BW -#define BAND_WIDTH_20 0 -#define BAND_WIDTH_40 1 -#define BAND_WIDTH_BOTH 2 -#define BAND_WIDTH_10 3 // 802.11j has 10MHz. This definition is for internal usage. doesn't fill in the IE or other field. -// SHORTGI -#define GAP_INTERVAL_400 1 // only support in HT mode -#define GAP_INTERVAL_800 0 -#define GAP_INTERVAL_BOTH 2 - -#define NdisMediaStateConnected 1 -#define NdisMediaStateDisconnected 0 - -#define NDIS_802_11_LENGTH_SSID 32 -#define NDIS_802_11_LENGTH_RATES 8 -#define NDIS_802_11_LENGTH_RATES_EX 16 -#define MAC_ADDR_LENGTH 6 -//#define MAX_NUM_OF_CHS 49 // 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL terminationc -#define MAX_NUM_OF_CHS 54 // 14 channels @2.4G + 12@UNII(lower/middle) + 16@HiperLAN2 + 11@UNII(upper) + 0 @Japan + 1 as NULL termination -#define MAX_NUMBER_OF_EVENT 10 // entry # in EVENT table -#define MAX_NUMBER_OF_MAC 32 // if MAX_MBSSID_NUM is 8, this value can't be larger than 211 -#define MAX_NUMBER_OF_ACL 64 -#define MAX_LENGTH_OF_SUPPORT_RATES 12 // 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 -#define MAX_NUMBER_OF_DLS_ENTRY 4 - - -#define RT_QUERY_SIGNAL_CONTEXT 0x0402 -#define RT_SET_IAPP_PID 0x0404 -#define RT_SET_APD_PID 0x0405 -#define RT_SET_DEL_MAC_ENTRY 0x0406 -#define RT_QUERY_EVENT_TABLE 0x0407 -// -// IEEE 802.11 OIDs -// -#define OID_GET_SET_TOGGLE 0x8000 -#define OID_GET_SET_FROM_UI 0x4000 - -#define OID_802_11_ADD_WEP 0x0112 -#define OID_802_11_DISASSOCIATE 0x0114 -#define OID_802_11_BSSID_LIST_SCAN 0x0508 -#define OID_802_11_SSID 0x0509 -#define OID_802_11_BSSID 0x050A -#define OID_802_11_MIC_FAILURE_REPORT_FRAME 0x0528 - -#define RT_OID_DEVICE_NAME 0x0607 -#define RT_OID_VERSION_INFO 0x0608 -#define OID_GEN_MEDIA_CONNECT_STATUS 0x060B -#define OID_GEN_RCV_OK 0x060F -#define OID_GEN_RCV_NO_BUFFER 0x0610 -//for WPA_SUPPLICANT_SUPPORT -#define OID_SET_COUNTERMEASURES 0x0616 -#define RT_OID_WPA_SUPPLICANT_SUPPORT 0x0621 -#define RT_OID_WE_VERSION_COMPILED 0x0622 -#define RT_OID_NEW_DRIVER 0x0623 - -#define RT_OID_DRIVER_DEVICE_NAME 0x0645 -#define RT_OID_QUERY_MULTIPLE_CARD_SUPPORT 0x0647 - -typedef enum _NDIS_802_11_STATUS_TYPE -{ - Ndis802_11StatusType_Authentication, - Ndis802_11StatusType_MediaStreamMode, - Ndis802_11StatusType_PMKID_CandidateList, - Ndis802_11StatusTypeMax // not a real type, defined as an upper bound -} NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE; - -typedef UCHAR NDIS_802_11_MAC_ADDRESS[6]; - -typedef struct _NDIS_802_11_STATUS_INDICATION -{ - NDIS_802_11_STATUS_TYPE StatusType; -} NDIS_802_11_STATUS_INDICATION, *PNDIS_802_11_STATUS_INDICATION; - -// mask for authentication/integrity fields -#define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f - -#define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01 -#define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02 -#define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06 -#define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E - -typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST -{ - ULONG Length; // Length of structure - NDIS_802_11_MAC_ADDRESS Bssid; - ULONG Flags; -} NDIS_802_11_AUTHENTICATION_REQUEST, *PNDIS_802_11_AUTHENTICATION_REQUEST; - -//Added new types for PMKID Candidate lists. -typedef struct _PMKID_CANDIDATE { - NDIS_802_11_MAC_ADDRESS BSSID; - ULONG Flags; -} PMKID_CANDIDATE, *PPMKID_CANDIDATE; - -typedef struct _NDIS_802_11_PMKID_CANDIDATE_LIST -{ - ULONG Version; // Version of the structure - ULONG NumCandidates; // No. of pmkid candidates - PMKID_CANDIDATE CandidateList[1]; -} NDIS_802_11_PMKID_CANDIDATE_LIST, *PNDIS_802_11_PMKID_CANDIDATE_LIST; - -//Flags for PMKID Candidate list structure -#define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01 - -// Added new types for OFDM 5G and 2.4G -typedef enum _NDIS_802_11_NETWORK_TYPE -{ - Ndis802_11FH, - Ndis802_11DS, - Ndis802_11OFDM5, - Ndis802_11OFDM24, - Ndis802_11Automode, - Ndis802_11OFDM5_N, - Ndis802_11OFDM24_N, - Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound -} NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE; - -typedef struct _NDIS_802_11_NETWORK_TYPE_LIST -{ - UINT NumberOfItems; // in list below, at least 1 - NDIS_802_11_NETWORK_TYPE NetworkType [1]; -} NDIS_802_11_NETWORK_TYPE_LIST, *PNDIS_802_11_NETWORK_TYPE_LIST; - -typedef enum _NDIS_802_11_POWER_MODE -{ - Ndis802_11PowerModeCAM, - Ndis802_11PowerModeMAX_PSP, - Ndis802_11PowerModeFast_PSP, - Ndis802_11PowerModeLegacy_PSP, - Ndis802_11PowerModeMax // not a real mode, defined as an upper bound -} NDIS_802_11_POWER_MODE, *PNDIS_802_11_POWER_MODE; - -typedef ULONG NDIS_802_11_TX_POWER_LEVEL; // in milliwatts - -// -// Received Signal Strength Indication -// -typedef LONG NDIS_802_11_RSSI; // in dBm - -typedef struct _NDIS_802_11_CONFIGURATION_FH -{ - ULONG Length; // Length of structure - ULONG HopPattern; // As defined by 802.11, MSB set - ULONG HopSet; // to one if non-802.11 - ULONG DwellTime; // units are Kusec -} NDIS_802_11_CONFIGURATION_FH, *PNDIS_802_11_CONFIGURATION_FH; - -typedef struct _NDIS_802_11_CONFIGURATION -{ - ULONG Length; // Length of structure - ULONG BeaconPeriod; // units are Kusec - ULONG ATIMWindow; // units are Kusec - ULONG DSConfig; // Frequency, units are kHz - NDIS_802_11_CONFIGURATION_FH FHConfig; -} NDIS_802_11_CONFIGURATION, *PNDIS_802_11_CONFIGURATION; - -typedef struct _NDIS_802_11_STATISTICS -{ - ULONG Length; // Length of structure - LARGE_INTEGER TransmittedFragmentCount; - LARGE_INTEGER MulticastTransmittedFrameCount; - LARGE_INTEGER FailedCount; - LARGE_INTEGER RetryCount; - LARGE_INTEGER MultipleRetryCount; - LARGE_INTEGER RTSSuccessCount; - LARGE_INTEGER RTSFailureCount; - LARGE_INTEGER ACKFailureCount; - LARGE_INTEGER FrameDuplicateCount; - LARGE_INTEGER ReceivedFragmentCount; - LARGE_INTEGER MulticastReceivedFrameCount; - LARGE_INTEGER FCSErrorCount; - LARGE_INTEGER TKIPLocalMICFailures; - LARGE_INTEGER TKIPRemoteMICErrors; - LARGE_INTEGER TKIPICVErrors; - LARGE_INTEGER TKIPCounterMeasuresInvoked; - LARGE_INTEGER TKIPReplays; - LARGE_INTEGER CCMPFormatErrors; - LARGE_INTEGER CCMPReplays; - LARGE_INTEGER CCMPDecryptErrors; - LARGE_INTEGER FourWayHandshakeFailures; -} NDIS_802_11_STATISTICS, *PNDIS_802_11_STATISTICS; - -typedef ULONG NDIS_802_11_KEY_INDEX; -typedef ULONGLONG NDIS_802_11_KEY_RSC; - -#define MAX_RADIUS_SRV_NUM 2 // 802.1x failover number - -typedef struct PACKED _RADIUS_SRV_INFO { - UINT32 radius_ip; - UINT32 radius_port; - UCHAR radius_key[64]; - UCHAR radius_key_len; -} RADIUS_SRV_INFO, *PRADIUS_SRV_INFO; - -typedef struct PACKED _RADIUS_KEY_INFO -{ - UCHAR radius_srv_num; - RADIUS_SRV_INFO radius_srv_info[MAX_RADIUS_SRV_NUM]; - UCHAR ieee8021xWEP; // dynamic WEP - UCHAR key_index; - UCHAR key_length; // length of key in bytes - UCHAR key_material[13]; -} RADIUS_KEY_INFO, *PRADIUS_KEY_INFO; - -// It's used by 802.1x daemon to require relative configuration -typedef struct PACKED _RADIUS_CONF -{ - UINT32 Length; // Length of this structure - UCHAR mbss_num; // indicate multiple BSS number - UINT32 own_ip_addr; - UINT32 retry_interval; - UINT32 session_timeout_interval; - UCHAR EAPifname[8][IFNAMSIZ]; - UCHAR EAPifname_len[8]; - UCHAR PreAuthifname[8][IFNAMSIZ]; - UCHAR PreAuthifname_len[8]; - RADIUS_KEY_INFO RadiusInfo[8]; -} RADIUS_CONF, *PRADIUS_CONF; - - - -#ifdef CONFIG_STA_SUPPORT -// Key mapping keys require a BSSID -typedef struct _NDIS_802_11_KEY -{ - UINT Length; // Length of this structure - UINT KeyIndex; - UINT KeyLength; // length of key in bytes - NDIS_802_11_MAC_ADDRESS BSSID; - NDIS_802_11_KEY_RSC KeyRSC; - UCHAR KeyMaterial[1]; // variable length depending on above field -} NDIS_802_11_KEY, *PNDIS_802_11_KEY; - -typedef struct _NDIS_802_11_PASSPHRASE -{ - UINT KeyLength; // length of key in bytes - NDIS_802_11_MAC_ADDRESS BSSID; - UCHAR KeyMaterial[1]; // variable length depending on above field -} NDIS_802_11_PASSPHRASE, *PNDIS_802_11_PASSPHRASE; -#endif // CONFIG_STA_SUPPORT // - -typedef struct _NDIS_802_11_REMOVE_KEY -{ - UINT Length; // Length of this structure - UINT KeyIndex; - NDIS_802_11_MAC_ADDRESS BSSID; -} NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY; - -typedef struct _NDIS_802_11_WEP -{ - UINT Length; // Length of this structure - UINT KeyIndex; // 0 is the per-client key, 1-N are the - // global keys - UINT KeyLength; // length of key in bytes - UCHAR KeyMaterial[1];// variable length depending on above field -} NDIS_802_11_WEP, *PNDIS_802_11_WEP; - - -typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE -{ - Ndis802_11IBSS, - Ndis802_11Infrastructure, - Ndis802_11AutoUnknown, - Ndis802_11Monitor, - Ndis802_11InfrastructureMax // Not a real value, defined as upper bound -} NDIS_802_11_NETWORK_INFRASTRUCTURE, *PNDIS_802_11_NETWORK_INFRASTRUCTURE; - -// Add new authentication modes -typedef enum _NDIS_802_11_AUTHENTICATION_MODE -{ - Ndis802_11AuthModeOpen, - Ndis802_11AuthModeShared, - Ndis802_11AuthModeAutoSwitch, - Ndis802_11AuthModeWPA, - Ndis802_11AuthModeWPAPSK, - Ndis802_11AuthModeWPANone, - Ndis802_11AuthModeWPA2, - Ndis802_11AuthModeWPA2PSK, - Ndis802_11AuthModeWPA1WPA2, - Ndis802_11AuthModeWPA1PSKWPA2PSK, - Ndis802_11AuthModeMax // Not a real mode, defined as upper bound -} NDIS_802_11_AUTHENTICATION_MODE, *PNDIS_802_11_AUTHENTICATION_MODE; - -typedef UCHAR NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; // Set of 8 data rates -typedef UCHAR NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; // Set of 16 data rates - -typedef struct PACKED _NDIS_802_11_SSID -{ - UINT SsidLength; // length of SSID field below, in bytes; - // this can be zero. - UCHAR Ssid[NDIS_802_11_LENGTH_SSID]; // SSID information field -} NDIS_802_11_SSID, *PNDIS_802_11_SSID; - - -typedef struct PACKED _NDIS_WLAN_BSSID -{ - ULONG Length; // Length of this structure - NDIS_802_11_MAC_ADDRESS MacAddress; // BSSID - UCHAR Reserved[2]; - NDIS_802_11_SSID Ssid; // SSID - ULONG Privacy; // WEP encryption requirement - NDIS_802_11_RSSI Rssi; // receive signal strength in dBm - NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; - NDIS_802_11_CONFIGURATION Configuration; - NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; - NDIS_802_11_RATES SupportedRates; -} NDIS_WLAN_BSSID, *PNDIS_WLAN_BSSID; - -typedef struct PACKED _NDIS_802_11_BSSID_LIST -{ - UINT NumberOfItems; // in list below, at least 1 - NDIS_WLAN_BSSID Bssid[1]; -} NDIS_802_11_BSSID_LIST, *PNDIS_802_11_BSSID_LIST; - -// Added Capabilities, IELength and IEs for each BSSID -typedef struct PACKED _NDIS_WLAN_BSSID_EX -{ - ULONG Length; // Length of this structure - NDIS_802_11_MAC_ADDRESS MacAddress; // BSSID - UCHAR Reserved[2]; - NDIS_802_11_SSID Ssid; // SSID - UINT Privacy; // WEP encryption requirement - NDIS_802_11_RSSI Rssi; // receive signal - // strength in dBm - NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; - NDIS_802_11_CONFIGURATION Configuration; - NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; - NDIS_802_11_RATES_EX SupportedRates; - ULONG IELength; - UCHAR IEs[1]; -} NDIS_WLAN_BSSID_EX, *PNDIS_WLAN_BSSID_EX; - -typedef struct PACKED _NDIS_802_11_BSSID_LIST_EX -{ - UINT NumberOfItems; // in list below, at least 1 - NDIS_WLAN_BSSID_EX Bssid[1]; -} NDIS_802_11_BSSID_LIST_EX, *PNDIS_802_11_BSSID_LIST_EX; - -typedef struct PACKED _NDIS_802_11_FIXED_IEs -{ - UCHAR Timestamp[8]; - USHORT BeaconInterval; - USHORT Capabilities; -} NDIS_802_11_FIXED_IEs, *PNDIS_802_11_FIXED_IEs; - -typedef struct _NDIS_802_11_VARIABLE_IEs -{ - UCHAR ElementID; - UCHAR Length; // Number of bytes in data field - UCHAR data[1]; -} NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs; - -typedef ULONG NDIS_802_11_FRAGMENTATION_THRESHOLD; - -typedef ULONG NDIS_802_11_RTS_THRESHOLD; - -typedef ULONG NDIS_802_11_ANTENNA; - -typedef enum _NDIS_802_11_PRIVACY_FILTER -{ - Ndis802_11PrivFilterAcceptAll, - Ndis802_11PrivFilter8021xWEP -} NDIS_802_11_PRIVACY_FILTER, *PNDIS_802_11_PRIVACY_FILTER; - -// Added new encryption types -// Also aliased typedef to new name -typedef enum _NDIS_802_11_WEP_STATUS -{ - Ndis802_11WEPEnabled, - Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled, - Ndis802_11WEPDisabled, - Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled, - Ndis802_11WEPKeyAbsent, - Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent, - Ndis802_11WEPNotSupported, - Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported, - Ndis802_11Encryption2Enabled, - Ndis802_11Encryption2KeyAbsent, - Ndis802_11Encryption3Enabled, - Ndis802_11Encryption3KeyAbsent, - Ndis802_11Encryption4Enabled, // TKIP or AES mix - Ndis802_11Encryption4KeyAbsent, - Ndis802_11GroupWEP40Enabled, - Ndis802_11GroupWEP104Enabled, -} NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS, - NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS; - -typedef enum _NDIS_802_11_RELOAD_DEFAULTS -{ - Ndis802_11ReloadWEPKeys -} NDIS_802_11_RELOAD_DEFAULTS, *PNDIS_802_11_RELOAD_DEFAULTS; - -#define NDIS_802_11_AI_REQFI_CAPABILITIES 1 -#define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2 -#define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4 - -#define NDIS_802_11_AI_RESFI_CAPABILITIES 1 -#define NDIS_802_11_AI_RESFI_STATUSCODE 2 -#define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4 - -typedef struct _NDIS_802_11_AI_REQFI -{ - USHORT Capabilities; - USHORT ListenInterval; - NDIS_802_11_MAC_ADDRESS CurrentAPAddress; -} NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI; - -typedef struct _NDIS_802_11_AI_RESFI -{ - USHORT Capabilities; - USHORT StatusCode; - USHORT AssociationId; -} NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI; - -typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION -{ - ULONG Length; - USHORT AvailableRequestFixedIEs; - NDIS_802_11_AI_REQFI RequestFixedIEs; - ULONG RequestIELength; - ULONG OffsetRequestIEs; - USHORT AvailableResponseFixedIEs; - NDIS_802_11_AI_RESFI ResponseFixedIEs; - ULONG ResponseIELength; - ULONG OffsetResponseIEs; -} NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION; - -typedef struct _NDIS_802_11_AUTHENTICATION_EVENT -{ - NDIS_802_11_STATUS_INDICATION Status; - NDIS_802_11_AUTHENTICATION_REQUEST Request[1]; -} NDIS_802_11_AUTHENTICATION_EVENT, *PNDIS_802_11_AUTHENTICATION_EVENT; - -/* -typedef struct _NDIS_802_11_TEST -{ - ULONG Length; - ULONG Type; - union - { - NDIS_802_11_AUTHENTICATION_EVENT AuthenticationEvent; - NDIS_802_11_RSSI RssiTrigger; - }; -} NDIS_802_11_TEST, *PNDIS_802_11_TEST; - */ - -// 802.11 Media stream constraints, associated with OID_802_11_MEDIA_STREAM_MODE -typedef enum _NDIS_802_11_MEDIA_STREAM_MODE -{ - Ndis802_11MediaStreamOff, - Ndis802_11MediaStreamOn, -} NDIS_802_11_MEDIA_STREAM_MODE, *PNDIS_802_11_MEDIA_STREAM_MODE; - -// PMKID Structures -typedef UCHAR NDIS_802_11_PMKID_VALUE[16]; - -#ifdef CONFIG_STA_SUPPORT -typedef struct _BSSID_INFO -{ - NDIS_802_11_MAC_ADDRESS BSSID; - NDIS_802_11_PMKID_VALUE PMKID; -} BSSID_INFO, *PBSSID_INFO; - -typedef struct _NDIS_802_11_PMKID -{ - UINT Length; - UINT BSSIDInfoCount; - BSSID_INFO BSSIDInfo[1]; -} NDIS_802_11_PMKID, *PNDIS_802_11_PMKID; -#endif // CONFIG_STA_SUPPORT // - - -typedef struct _NDIS_802_11_AUTHENTICATION_ENCRYPTION -{ - NDIS_802_11_AUTHENTICATION_MODE AuthModeSupported; - NDIS_802_11_ENCRYPTION_STATUS EncryptStatusSupported; -} NDIS_802_11_AUTHENTICATION_ENCRYPTION, *PNDIS_802_11_AUTHENTICATION_ENCRYPTION; - -typedef struct _NDIS_802_11_CAPABILITY -{ - ULONG Length; - ULONG Version; - ULONG NoOfPMKIDs; - ULONG NoOfAuthEncryptPairsSupported; - NDIS_802_11_AUTHENTICATION_ENCRYPTION AuthenticationEncryptionSupported[1]; -} NDIS_802_11_CAPABILITY, *PNDIS_802_11_CAPABILITY; - -#ifdef LINUX -#if WIRELESS_EXT <= 11 -#ifndef SIOCDEVPRIVATE -#define SIOCDEVPRIVATE 0x8BE0 -#endif -#define SIOCIWFIRSTPRIV SIOCDEVPRIVATE -#endif -#endif // LINUX // - - -#ifdef CONFIG_STA_SUPPORT -#define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x01) // Sync. with AP for wsc upnp daemon -#define RTPRIV_IOCTL_SET (SIOCIWFIRSTPRIV + 0x02) - -#ifdef RALINK_ATE -#ifdef RALINK_28xx_QA -#define RTPRIV_IOCTL_ATE (SIOCIWFIRSTPRIV + 0x08) -#endif // RALINK_28xx_QA // -#endif // RALINK_ATE // - -#define RTPRIV_IOCTL_STATISTICS (SIOCIWFIRSTPRIV + 0x09) -#define RTPRIV_IOCTL_ADD_PMKID_CACHE (SIOCIWFIRSTPRIV + 0x0A) -#define RTPRIV_IOCTL_RADIUS_DATA (SIOCIWFIRSTPRIV + 0x0C) -#define RTPRIV_IOCTL_GSITESURVEY (SIOCIWFIRSTPRIV + 0x0D) -#define RT_PRIV_IOCTL_EXT (SIOCIWFIRSTPRIV + 0x0E) // Sync. with RT61 (for wpa_supplicant) -#define RTPRIV_IOCTL_GET_MAC_TABLE (SIOCIWFIRSTPRIV + 0x0F) - -#define RTPRIV_IOCTL_SHOW (SIOCIWFIRSTPRIV + 0x11) -enum { - SHOW_CONN_STATUS = 4, - SHOW_DRVIER_VERION = 5, - SHOW_BA_INFO = 6, - SHOW_DESC_INFO = 7, - RAIO_OFF = 10, - RAIO_ON = 11, -#ifdef QOS_DLS_SUPPORT - SHOW_DLS_ENTRY_INFO = 19, -#endif // QOS_DLS_SUPPORT // - SHOW_CFG_VALUE = 20, - SHOW_ADHOC_ENTRY_INFO = 21, -}; - - -#endif // CONFIG_STA_SUPPORT // - - - -#ifdef SNMP_SUPPORT -//SNMP ieee 802dot11, kathy , 2008_0220 -// dot11res(3) -#define RT_OID_802_11_MANUFACTUREROUI 0x0700 -#define RT_OID_802_11_MANUFACTURERNAME 0x0701 -#define RT_OID_802_11_RESOURCETYPEIDNAME 0x0702 - -// dot11smt(1) -#define RT_OID_802_11_PRIVACYOPTIONIMPLEMENTED 0x0703 -#define RT_OID_802_11_POWERMANAGEMENTMODE 0x0704 -#define OID_802_11_WEPDEFAULTKEYVALUE 0x0705 // read , write -#define OID_802_11_WEPDEFAULTKEYID 0x0706 -#define RT_OID_802_11_WEPKEYMAPPINGLENGTH 0x0707 -#define OID_802_11_SHORTRETRYLIMIT 0x0708 -#define OID_802_11_LONGRETRYLIMIT 0x0709 -#define RT_OID_802_11_PRODUCTID 0x0710 -#define RT_OID_802_11_MANUFACTUREID 0x0711 - -// //dot11Phy(4) -#define OID_802_11_CURRENTCHANNEL 0x0712 - -//dot11mac -#define RT_OID_802_11_MAC_ADDRESS 0x0713 -#endif // SNMP_SUPPORT // - -#define OID_802_11_BUILD_CHANNEL_EX 0x0714 -#define OID_802_11_GET_CH_LIST 0x0715 -#define OID_802_11_GET_COUNTRY_CODE 0x0716 -#define OID_802_11_GET_CHANNEL_GEOGRAPHY 0x0717 - -//#define RT_OID_802_11_STATISTICS (OID_GET_SET_TOGGLE | OID_802_11_STATISTICS) - -#ifdef CONFIG_STA_SUPPORT -#define RT_OID_WSC_SET_PASSPHRASE 0x0740 // passphrase for wpa(2)-psk -#define RT_OID_WSC_DRIVER_AUTO_CONNECT 0x0741 -#define RT_OID_WSC_QUERY_DEFAULT_PROFILE 0x0742 -#define RT_OID_WSC_SET_CONN_BY_PROFILE_INDEX 0x0743 -#define RT_OID_WSC_SET_ACTION 0x0744 -#define RT_OID_WSC_SET_SSID 0x0745 -#define RT_OID_WSC_SET_PIN_CODE 0x0746 -#define RT_OID_WSC_SET_MODE 0x0747 // PIN or PBC -#define RT_OID_WSC_SET_CONF_MODE 0x0748 // Enrollee or Registrar -#define RT_OID_WSC_SET_PROFILE 0x0749 -#endif // CONFIG_STA_SUPPORT // -#define RT_OID_WSC_CONFIG_STATUS 0x074F -#define RT_OID_802_11_WSC_QUERY_PROFILE 0x0750 -// for consistency with RT61 -#define RT_OID_WSC_QUERY_STATUS 0x0751 -#define RT_OID_WSC_PIN_CODE 0x0752 -#define RT_OID_WSC_UUID 0x0753 -#define RT_OID_WSC_SET_SELECTED_REGISTRAR 0x0754 -#define RT_OID_WSC_EAPMSG 0x0755 -#define RT_OID_WSC_MANUFACTURER 0x0756 -#define RT_OID_WSC_MODEL_NAME 0x0757 -#define RT_OID_WSC_MODEL_NO 0x0758 -#define RT_OID_WSC_SERIAL_NO 0x0759 -#define RT_OID_WSC_MAC_ADDRESS 0x0760 - -#ifdef LLTD_SUPPORT -// for consistency with RT61 -#define RT_OID_GET_PHY_MODE 0x761 -#endif // LLTD_SUPPORT // - -#ifdef NINTENDO_AP -//#define RT_OID_NINTENDO 0x0D010770 -#define RT_OID_802_11_NINTENDO_GET_TABLE 0x0771 //((RT_OID_NINTENDO + 0x01) & 0xffff) -#define RT_OID_802_11_NINTENDO_SET_TABLE 0x0772 //((RT_OID_NINTENDO + 0x02) & 0xffff) -#define RT_OID_802_11_NINTENDO_CAPABLE 0x0773 //((RT_OID_NINTENDO + 0x03) & 0xffff) -#endif // NINTENDO_AP // - - -// New for MeetingHouse Api support -#define OID_MH_802_1X_SUPPORTED 0xFFEDC100 - -// MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!! -typedef union _HTTRANSMIT_SETTING { -#ifdef RT_BIG_ENDIAN - struct { - USHORT MODE:2; // Use definition MODE_xxx. -// USHORT rsv:3; - USHORT TxBF:1; - USHORT rsv:2; - USHORT STBC:2; //SPACE - USHORT ShortGI:1; - USHORT BW:1; //channel bandwidth 20MHz or 40 MHz - USHORT MCS:7; // MCS - } field; -#else - struct { - USHORT MCS:7; // MCS - USHORT BW:1; //channel bandwidth 20MHz or 40 MHz - USHORT ShortGI:1; - USHORT STBC:2; //SPACE -// USHORT rsv:3; - USHORT rsv:2; - USHORT TxBF:1; - USHORT MODE:2; // Use definition MODE_xxx. - } field; -#endif - USHORT word; - } HTTRANSMIT_SETTING, *PHTTRANSMIT_SETTING; - -typedef enum _RT_802_11_PREAMBLE { - Rt802_11PreambleLong, - Rt802_11PreambleShort, - Rt802_11PreambleAuto -} RT_802_11_PREAMBLE, *PRT_802_11_PREAMBLE; - -typedef enum _RT_802_11_PHY_MODE { - PHY_11BG_MIXED = 0, - PHY_11B, - PHY_11A, - PHY_11ABG_MIXED, - PHY_11G, -#ifdef DOT11_N_SUPPORT - PHY_11ABGN_MIXED, // both band 5 - PHY_11N_2_4G, // 11n-only with 2.4G band 6 - PHY_11GN_MIXED, // 2.4G band 7 - PHY_11AN_MIXED, // 5G band 8 - PHY_11BGN_MIXED, // if check 802.11b. 9 - PHY_11AGN_MIXED, // if check 802.11b. 10 - PHY_11N_5G, // 11n-only with 5G band 11 -#endif // DOT11_N_SUPPORT // -} RT_802_11_PHY_MODE; - - -// put all proprietery for-query objects here to reduce # of Query_OID -typedef struct _RT_802_11_LINK_STATUS { - ULONG CurrTxRate; // in units of 0.5Mbps - ULONG ChannelQuality; // 0..100 % - ULONG TxByteCount; // both ok and fail - ULONG RxByteCount; // both ok and fail - ULONG CentralChannel; // 40MHz central channel number -} RT_802_11_LINK_STATUS, *PRT_802_11_LINK_STATUS; - -typedef struct _RT_802_11_EVENT_LOG { - LARGE_INTEGER SystemTime; // timestammp via NdisGetCurrentSystemTime() - UCHAR Addr[MAC_ADDR_LENGTH]; - USHORT Event; // EVENT_xxx -} RT_802_11_EVENT_LOG, *PRT_802_11_EVENT_LOG; - -typedef struct _RT_802_11_EVENT_TABLE { - ULONG Num; - ULONG Rsv; // to align Log[] at LARGE_INEGER boundary - RT_802_11_EVENT_LOG Log[MAX_NUMBER_OF_EVENT]; -} RT_802_11_EVENT_TABLE, PRT_802_11_EVENT_TABLE; - -// MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!! -typedef union _MACHTTRANSMIT_SETTING { - struct { - USHORT MCS:7; // MCS - USHORT BW:1; //channel bandwidth 20MHz or 40 MHz - USHORT ShortGI:1; - USHORT STBC:2; //SPACE - USHORT rsv:3; - USHORT MODE:2; // Use definition MODE_xxx. - } field; - USHORT word; - } MACHTTRANSMIT_SETTING, *PMACHTTRANSMIT_SETTING; - -typedef struct _RT_802_11_MAC_ENTRY { - UCHAR Addr[MAC_ADDR_LENGTH]; - UCHAR Aid; - UCHAR Psm; // 0:PWR_ACTIVE, 1:PWR_SAVE - UCHAR MimoPs; // 0:MMPS_STATIC, 1:MMPS_DYNAMIC, 3:MMPS_Enabled - CHAR AvgRssi0; - CHAR AvgRssi1; - CHAR AvgRssi2; - UINT32 ConnectedTime; - MACHTTRANSMIT_SETTING TxRate; -} RT_802_11_MAC_ENTRY, *PRT_802_11_MAC_ENTRY; - -typedef struct _RT_802_11_MAC_TABLE { - ULONG Num; - RT_802_11_MAC_ENTRY Entry[MAX_NUMBER_OF_MAC]; -} RT_802_11_MAC_TABLE, *PRT_802_11_MAC_TABLE; - -// structure for query/set hardware register - MAC, BBP, RF register -typedef struct _RT_802_11_HARDWARE_REGISTER { - ULONG HardwareType; // 0:MAC, 1:BBP, 2:RF register, 3:EEPROM - ULONG Offset; // Q/S register offset addr - ULONG Data; // R/W data buffer -} RT_802_11_HARDWARE_REGISTER, *PRT_802_11_HARDWARE_REGISTER; - -typedef struct _RT_802_11_AP_CONFIG { - ULONG EnableTxBurst; // 0-disable, 1-enable - ULONG EnableTurboRate; // 0-disable, 1-enable 72/100mbps turbo rate - ULONG IsolateInterStaTraffic; // 0-disable, 1-enable isolation - ULONG HideSsid; // 0-disable, 1-enable hiding - ULONG UseBGProtection; // 0-AUTO, 1-always ON, 2-always OFF - ULONG UseShortSlotTime; // 0-no use, 1-use 9-us short slot time - ULONG Rsv1; // must be 0 - ULONG SystemErrorBitmap; // ignore upon SET, return system error upon QUERY -} RT_802_11_AP_CONFIG, *PRT_802_11_AP_CONFIG; - -// structure to query/set STA_CONFIG -typedef struct _RT_802_11_STA_CONFIG { - ULONG EnableTxBurst; // 0-disable, 1-enable - ULONG EnableTurboRate; // 0-disable, 1-enable 72/100mbps turbo rate - ULONG UseBGProtection; // 0-AUTO, 1-always ON, 2-always OFF - ULONG UseShortSlotTime; // 0-no use, 1-use 9-us short slot time when applicable - ULONG AdhocMode; // 0-11b rates only (WIFI spec), 1 - b/g mixed, 2 - g only - ULONG HwRadioStatus; // 0-OFF, 1-ON, default is 1, Read-Only - ULONG Rsv1; // must be 0 - ULONG SystemErrorBitmap; // ignore upon SET, return system error upon QUERY -} RT_802_11_STA_CONFIG, *PRT_802_11_STA_CONFIG; - -// -// For OID Query or Set about BA structure -// -typedef struct _OID_BACAP_STRUC { - UCHAR RxBAWinLimit; - UCHAR TxBAWinLimit; - UCHAR Policy; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid - UCHAR MpduDensity; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid - UCHAR AmsduEnable; //Enable AMSDU transmisstion - UCHAR AmsduSize; // 0:3839, 1:7935 bytes. UINT MSDUSizeToBytes[] = { 3839, 7935}; - UCHAR MMPSmode; // MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable - BOOLEAN AutoBA; // Auto BA will automatically -} OID_BACAP_STRUC, *POID_BACAP_STRUC; - -typedef struct _RT_802_11_ACL_ENTRY { - UCHAR Addr[MAC_ADDR_LENGTH]; - USHORT Rsv; -} RT_802_11_ACL_ENTRY, *PRT_802_11_ACL_ENTRY; - -typedef struct PACKED _RT_802_11_ACL { - ULONG Policy; // 0-disable, 1-positive list, 2-negative list - ULONG Num; - RT_802_11_ACL_ENTRY Entry[MAX_NUMBER_OF_ACL]; -} RT_802_11_ACL, *PRT_802_11_ACL; - -typedef struct _RT_802_11_WDS { - ULONG Num; - NDIS_802_11_MAC_ADDRESS Entry[24/*MAX_NUM_OF_WDS_LINK*/]; - ULONG KeyLength; - UCHAR KeyMaterial[32]; -} RT_802_11_WDS, *PRT_802_11_WDS; - -typedef struct _RT_802_11_TX_RATES_ { - UCHAR SupRateLen; - UCHAR SupRate[MAX_LENGTH_OF_SUPPORT_RATES]; - UCHAR ExtRateLen; - UCHAR ExtRate[MAX_LENGTH_OF_SUPPORT_RATES]; -} RT_802_11_TX_RATES, *PRT_802_11_TX_RATES; - - -// Definition of extra information code -#define GENERAL_LINK_UP 0x0 // Link is Up -#define GENERAL_LINK_DOWN 0x1 // Link is Down -#define HW_RADIO_OFF 0x2 // Hardware radio off -#define SW_RADIO_OFF 0x3 // Software radio off -#define AUTH_FAIL 0x4 // Open authentication fail -#define AUTH_FAIL_KEYS 0x5 // Shared authentication fail -#define ASSOC_FAIL 0x6 // Association failed -#define EAP_MIC_FAILURE 0x7 // Deauthencation because MIC failure -#define EAP_4WAY_TIMEOUT 0x8 // Deauthencation on 4-way handshake timeout -#define EAP_GROUP_KEY_TIMEOUT 0x9 // Deauthencation on group key handshake timeout -#define EAP_SUCCESS 0xa // EAP succeed -#define DETECT_RADAR_SIGNAL 0xb // Radar signal occur in current channel -#define EXTRA_INFO_MAX 0xb // Indicate Last OID - -#define EXTRA_INFO_CLEAR 0xffffffff - -// This is OID setting structure. So only GF or MM as Mode. This is valid when our wirelss mode has 802.11n in use. -typedef struct { - RT_802_11_PHY_MODE PhyMode; // - UCHAR TransmitNo; - UCHAR HtMode; //HTMODE_GF or HTMODE_MM - UCHAR ExtOffset; //extension channel above or below - UCHAR MCS; - UCHAR BW; - UCHAR STBC; - UCHAR SHORTGI; - UCHAR rsv; -} OID_SET_HT_PHYMODE, *POID_SET_HT_PHYMODE; - -#ifdef NINTENDO_AP -#define NINTENDO_MAX_ENTRY 16 -#define NINTENDO_SSID_NAME_LN 8 -#define NINTENDO_SSID_NAME "NWCUSBAP" -#define NINTENDO_PROBE_REQ_FLAG_MASK 0x03 -#define NINTENDO_PROBE_REQ_ON 0x01 -#define NINTENDO_PROBE_REQ_SIGNAL 0x02 -#define NINTENDO_PROBE_RSP_ON 0x01 -#define NINTENDO_SSID_NICKNAME_LN 20 - -#define NINTENDO_WEPKEY_LN 13 - -typedef struct _NINTENDO_SSID -{ - UCHAR NINTENDOFixChar[NINTENDO_SSID_NAME_LN]; - UCHAR zero1; - UCHAR registe; - UCHAR ID; - UCHAR zero2; - UCHAR NICKname[NINTENDO_SSID_NICKNAME_LN]; -} RT_NINTENDO_SSID, *PRT_NINTENDO_SSID; - -typedef struct _NINTENDO_ENTRY -{ - UCHAR NICKname[NINTENDO_SSID_NICKNAME_LN]; - UCHAR DS_Addr[ETH_LENGTH_OF_ADDRESS]; - UCHAR registe; - UCHAR UserSpaceAck; -} RT_NINTENDO_ENTRY, *PRT_NINTENDO_ENTRY; - -//RTPRIV_IOCTL_NINTENDO_GET_TABLE -//RTPRIV_IOCTL_NINTENDO_SET_TABLE -typedef struct _NINTENDO_TABLE -{ - UINT number; - RT_NINTENDO_ENTRY entry[NINTENDO_MAX_ENTRY]; -} RT_NINTENDO_TABLE, *PRT_NINTENDO_TABLE; - -//RTPRIV_IOCTL_NINTENDO_SEED_WEPKEY -typedef struct _NINTENDO_SEED_WEPKEY -{ - UCHAR seed[NINTENDO_SSID_NICKNAME_LN]; - UCHAR wepkey[16];//use 13 for 104 bits wep key -} RT_NINTENDO_SEED_WEPKEY, *PRT_NINTENDO_SEED_WEPKEY; -#endif // NINTENDO_AP // - -#ifdef LLTD_SUPPORT -typedef struct _RT_LLTD_ASSOICATION_ENTRY { - UCHAR Addr[ETH_LENGTH_OF_ADDRESS]; - unsigned short MOR; // maximum operational rate - UCHAR phyMode; -} RT_LLTD_ASSOICATION_ENTRY, *PRT_LLTD_ASSOICATION_ENTRY; - -typedef struct _RT_LLTD_ASSOICATION_TABLE { - unsigned int Num; - RT_LLTD_ASSOICATION_ENTRY Entry[MAX_NUMBER_OF_MAC]; -} RT_LLTD_ASSOICATION_TABLE, *PRT_LLTD_ASSOICATION_TABLE; -#endif // LLTD_SUPPORT // - -#ifdef CONFIG_STA_SUPPORT -#ifdef QOS_DLS_SUPPORT -//rt2860, kathy 2007-0118 -// structure for DLS -typedef struct _RT_802_11_DLS_UI { - USHORT TimeOut; // unit: second , set by UI - USHORT CountDownTimer; // unit: second , used by driver only - NDIS_802_11_MAC_ADDRESS MacAddr; // set by UI - UCHAR Status; // 0: none , 1: wait STAkey, 2: finish DLS setup , set by driver only - BOOLEAN Valid; // 1: valid , 0: invalid , set by UI, use to setup or tear down DLS link -} RT_802_11_DLS_UI, *PRT_802_11_DLS_UI; - -typedef struct _RT_802_11_DLS_INFO { - RT_802_11_DLS_UI Entry[MAX_NUMBER_OF_DLS_ENTRY]; - UCHAR num; -} RT_802_11_DLS_INFO, *PRT_802_11_DLS_INFO; - -typedef enum _RT_802_11_DLS_MODE { - DLS_NONE, - DLS_WAIT_KEY, - DLS_FINISH -} RT_802_11_DLS_MODE; -#endif // QOS_DLS_SUPPORT // - -#ifdef WPA_SUPPLICANT_SUPPORT -#ifndef NATIVE_WPA_SUPPLICANT_SUPPORT -#define RT_ASSOC_EVENT_FLAG 0x0101 -#define RT_DISASSOC_EVENT_FLAG 0x0102 -#define RT_REQIE_EVENT_FLAG 0x0103 -#define RT_RESPIE_EVENT_FLAG 0x0104 -#define RT_ASSOCINFO_EVENT_FLAG 0x0105 -#define RT_PMKIDCAND_FLAG 0x0106 -#define RT_INTERFACE_DOWN 0x0107 -#define RT_INTERFACE_UP 0x0108 -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // -#endif // WPA_SUPPLICANT_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - - - - -#define MAX_CUSTOM_LEN 128 - -#ifdef CONFIG_STA_SUPPORT -typedef enum _RT_802_11_D_CLIENT_MODE -{ - Rt802_11_D_None, - Rt802_11_D_Flexible, - Rt802_11_D_Strict, -} RT_802_11_D_CLIENT_MODE, *PRT_802_11_D_CLIENT_MODE; -#endif // CONFIG_STA_SUPPORT // - -typedef struct _RT_CHANNEL_LIST_INFO -{ - UCHAR ChannelList[MAX_NUM_OF_CHS]; // list all supported channels for site survey - UCHAR ChannelListNum; // number of channel in ChannelList[] -} RT_CHANNEL_LIST_INFO, *PRT_CHANNEL_LIST_INFO; - -// WSC configured credential -typedef struct _WSC_CREDENTIAL -{ - NDIS_802_11_SSID SSID; // mandatory - USHORT AuthType; // mandatory, 1: open, 2: wpa-psk, 4: shared, 8:wpa, 0x10: wpa2, 0x20: wpa2-psk - USHORT EncrType; // mandatory, 1: none, 2: wep, 4: tkip, 8: aes - UCHAR Key[64]; // mandatory, Maximum 64 byte - USHORT KeyLength; - UCHAR MacAddr[6]; // mandatory, AP MAC address - UCHAR KeyIndex; // optional, default is 1 - UCHAR Rsvd[3]; // Make alignment -} WSC_CREDENTIAL, *PWSC_CREDENTIAL; - -// WSC configured profiles -typedef struct _WSC_PROFILE -{ - UINT ProfileCnt; - UINT ApplyProfileIdx; // add by johnli, fix WPS test plan 5.1.1 - WSC_CREDENTIAL Profile[8]; // Support up to 8 profiles -} WSC_PROFILE, *PWSC_PROFILE; - - - -#endif // _OID_H_ diff --git a/drivers/staging/rt3090/pci_main_dev.c b/drivers/staging/rt3090/pci_main_dev.c deleted file mode 100644 index 1410156b90c6..000000000000 --- a/drivers/staging/rt3090/pci_main_dev.c +++ /dev/null @@ -1,1195 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - pci_main_dev.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Name Date Modification logs -*/ - - -#include "rt_config.h" -#include - -// Following information will be show when you run 'modinfo' -// *** If you have a solution for the bug in current version of driver, please mail to me. -// Otherwise post to forum in ralinktech's web site(www.ralinktech.com) and let all users help you. *** -MODULE_AUTHOR("Jett Chen "); -MODULE_DESCRIPTION("RT3090 Wireless Lan Linux Driver"); -MODULE_LICENSE("GPL"); - -// -// Function declarations -// -extern int rt28xx_close(IN struct net_device *net_dev); -extern int rt28xx_open(struct net_device *net_dev); - -static VOID __devexit rt2860_remove_one(struct pci_dev *pci_dev); -static INT __devinit rt2860_probe(struct pci_dev *pci_dev, const struct pci_device_id *ent); -static void __exit rt2860_cleanup_module(void); -static int __init rt2860_init_module(void); - - - static VOID RTMPInitPCIeDevice( - IN struct pci_dev *pci_dev, - IN PRTMP_ADAPTER pAd); - - -#ifdef CONFIG_PM -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) -#define pm_message_t u32 -#endif - -static int rt2860_suspend(struct pci_dev *pci_dev, pm_message_t state); -static int rt2860_resume(struct pci_dev *pci_dev); -#endif -#endif // CONFIG_PM // - -// -// Ralink PCI device table, include all supported chipsets -// -static struct pci_device_id rt2860_pci_tbl[] __devinitdata = -{ -#ifdef RT3090 - {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3090_PCIe_DEVICE_ID)}, - {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3091_PCIe_DEVICE_ID)}, - {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3092_PCIe_DEVICE_ID)}, - {PCI_DEVICE(0x1462, 0x891A)}, -#endif // RT3090 // -#ifdef RT3390 - {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3390_PCIe_DEVICE_ID)}, - {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3391_PCIe_DEVICE_ID)}, - {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3392_PCIe_DEVICE_ID)}, -#endif // RT3390 // - {0,} // terminate list -}; - -MODULE_DEVICE_TABLE(pci, rt2860_pci_tbl); -#ifdef CONFIG_STA_SUPPORT -#ifdef MODULE_VERSION -MODULE_VERSION(STA_DRIVER_VERSION); -#endif -#endif // CONFIG_STA_SUPPORT // - - -// -// Our PCI driver structure -// -static struct pci_driver rt2860_driver = -{ - name: "rt3090", - id_table: rt2860_pci_tbl, - probe: rt2860_probe, -#if LINUX_VERSION_CODE >= 0x20412 - remove: __devexit_p(rt2860_remove_one), -#else - remove: __devexit(rt2860_remove_one), -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) -#ifdef CONFIG_PM - suspend: rt2860_suspend, - resume: rt2860_resume, -#endif -#endif -}; - - -/*************************************************************************** - * - * PCI device initialization related procedures. - * - ***************************************************************************/ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) -#ifdef CONFIG_PM - -VOID RT2860RejectPendingPackets( - IN PRTMP_ADAPTER pAd) -{ - // clear PS packets - // clear TxSw packets -} - -static int rt2860_suspend( - struct pci_dev *pci_dev, - pm_message_t state) -{ - struct net_device *net_dev = pci_get_drvdata(pci_dev); - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)NULL; - INT32 retval = 0; - - - DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_suspend()\n")); - - if (net_dev == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("net_dev == NULL!\n")); - } - else - { - pAd = (PRTMP_ADAPTER)RTMP_OS_NETDEV_GET_PRIV(net_dev); - - /* we can not use IFF_UP because ra0 down but ra1 up */ - /* and 1 suspend/resume function for 1 module, not for each interface */ - /* so Linux will call suspend/resume function once */ - if (VIRTUAL_IF_NUM(pAd) > 0) - { - // avoid users do suspend after interface is down - - // stop interface - netif_carrier_off(net_dev); - netif_stop_queue(net_dev); - - // mark device as removed from system and therefore no longer available - netif_device_detach(net_dev); - - // mark halt flag - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - - // take down the device - rt28xx_close((PNET_DEV)net_dev); - - RT_MOD_DEC_USE_COUNT(); - } - } - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) - // reference to http://vovo2000.com/type-lab/linux/kernel-api/linux-kernel-api.html - // enable device to generate PME# when suspended - // pci_choose_state(): Choose the power state of a PCI device to be suspended - retval = pci_enable_wake(pci_dev, pci_choose_state(pci_dev, state), 1); - // save the PCI configuration space of a device before suspending - pci_save_state(pci_dev); - // disable PCI device after use - pci_disable_device(pci_dev); - - retval = pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)); -#endif - - DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_suspend()\n")); - return retval; -} - -static int rt2860_resume( - struct pci_dev *pci_dev) -{ - struct net_device *net_dev = pci_get_drvdata(pci_dev); - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)NULL; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) - INT32 retval; - - - // set the power state of a PCI device - // PCI has 4 power states, DO (normal) ~ D3(less power) - // in include/linux/pci.h, you can find that - // #define PCI_D0 ((pci_power_t __force) 0) - // #define PCI_D1 ((pci_power_t __force) 1) - // #define PCI_D2 ((pci_power_t __force) 2) - // #define PCI_D3hot ((pci_power_t __force) 3) - // #define PCI_D3cold ((pci_power_t __force) 4) - // #define PCI_UNKNOWN ((pci_power_t __force) 5) - // #define PCI_POWER_ERROR ((pci_power_t __force) -1) - retval = pci_set_power_state(pci_dev, PCI_D0); - - // restore the saved state of a PCI device - pci_restore_state(pci_dev); - - // initialize device before it's used by a driver - if (pci_enable_device(pci_dev)) - { - printk("pci enable fail!\n"); - return 0; - } -#endif - - DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_resume()\n")); - - if (net_dev == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("net_dev == NULL!\n")); - } - else - pAd = (PRTMP_ADAPTER)RTMP_OS_NETDEV_GET_PRIV(net_dev); - - if (pAd != NULL) - { - /* we can not use IFF_UP because ra0 down but ra1 up */ - /* and 1 suspend/resume function for 1 module, not for each interface */ - /* so Linux will call suspend/resume function once */ - if (VIRTUAL_IF_NUM(pAd) > 0) - { - // mark device as attached from system and restart if needed - netif_device_attach(net_dev); - - if (rt28xx_open((PNET_DEV)net_dev) != 0) - { - // open fail - DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_resume()\n")); - return 0; - } - - // increase MODULE use count - RT_MOD_INC_USE_COUNT(); - - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - - netif_start_queue(net_dev); - netif_carrier_on(net_dev); - netif_wake_queue(net_dev); - } - } - - DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_resume()\n")); - return 0; -} -#endif // CONFIG_PM // -#endif - - -static INT __init rt2860_init_module(VOID) -{ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) - return pci_register_driver(&rt2860_driver); -#else - return pci_module_init(&rt2860_driver); -#endif -} - - -// -// Driver module unload function -// -static VOID __exit rt2860_cleanup_module(VOID) -{ - pci_unregister_driver(&rt2860_driver); -} - -module_init(rt2860_init_module); -module_exit(rt2860_cleanup_module); - - -// -// PCI device probe & initialization function -// -static INT __devinit rt2860_probe( - IN struct pci_dev *pci_dev, - IN const struct pci_device_id *pci_id) -{ - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)NULL; - struct net_device *net_dev; - PVOID handle; - PSTRING print_name; - ULONG csr_addr; - INT rv = 0; - RTMP_OS_NETDEV_OP_HOOK netDevHook; - - DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_probe\n")); - -//PCIDevInit============================================== - // wake up and enable device - if ((rv = pci_enable_device(pci_dev))!= 0) - { - DBGPRINT(RT_DEBUG_ERROR, ("Enable PCI device failed, errno=%d!\n", rv)); - return rv; - } - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) - print_name = pci_dev ? pci_name(pci_dev) : "rt3090"; -#else - print_name = pci_dev ? pci_dev->slot_name : "rt3090"; -#endif // LINUX_VERSION_CODE // - - if ((rv = pci_request_regions(pci_dev, print_name)) != 0) - { - DBGPRINT(RT_DEBUG_ERROR, ("Request PCI resource failed, errno=%d!\n", rv)); - goto err_out; - } - - // map physical address to virtual address for accessing register - csr_addr = (unsigned long) ioremap(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); - if (!csr_addr) - { - DBGPRINT(RT_DEBUG_ERROR, ("ioremap failed for device %s, region 0x%lX @ 0x%lX\n", - print_name, (ULONG)pci_resource_len(pci_dev, 0), (ULONG)pci_resource_start(pci_dev, 0))); - goto err_out_free_res; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("%s: at 0x%lx, VA 0x%lx, IRQ %d. \n", print_name, - (ULONG)pci_resource_start(pci_dev, 0), (ULONG)csr_addr, pci_dev->irq)); - } - - // Set DMA master - pci_set_master(pci_dev); - - -//RtmpDevInit============================================== - // Allocate RTMP_ADAPTER adapter structure - handle = kmalloc(sizeof(struct os_cookie), GFP_KERNEL); - if (handle == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s(): Allocate memory for os handle failed!\n", __FUNCTION__)); - goto err_out_iounmap; - } - - ((POS_COOKIE)handle)->pci_dev = pci_dev; - - rv = RTMPAllocAdapterBlock(handle, &pAd); //shiang: we may need the pci_dev for allocate structure of "RTMP_ADAPTER" - if (rv != NDIS_STATUS_SUCCESS) - goto err_out_iounmap; - // Here are the RTMP_ADAPTER structure with pci-bus specific parameters. - pAd->CSRBaseAddress = (PUCHAR)csr_addr; - DBGPRINT(RT_DEBUG_ERROR, ("pAd->CSRBaseAddress =0x%lx, csr_addr=0x%lx!\n", (ULONG)pAd->CSRBaseAddress, csr_addr)); - RtmpRaDevCtrlInit(pAd, RTMP_DEV_INF_PCI); - - -//NetDevInit============================================== - net_dev = RtmpPhyNetDevInit(pAd, &netDevHook); - if (net_dev == NULL) - goto err_out_free_radev; - - // Here are the net_device structure with pci-bus specific parameters. - net_dev->irq = pci_dev->irq; // Interrupt IRQ number - net_dev->base_addr = csr_addr; // Save CSR virtual address and irq to device structure - pci_set_drvdata(pci_dev, net_dev); // Set driver data - -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT -/* for supporting Network Manager */ - /* Set the sysfs physical device reference for the network logical device - * if set prior to registration will cause a symlink during initialization. - */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) - SET_NETDEV_DEV(net_dev, &(pci_dev->dev)); -#endif -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - - -//All done, it's time to register the net device to linux kernel. - // Register this device - rv = RtmpOSNetDevAttach(net_dev, &netDevHook); - if (rv) - goto err_out_free_netdev; - -#ifdef CONFIG_STA_SUPPORT - pAd->StaCfg.OriDevType = net_dev->type; -#endif // CONFIG_STA_SUPPORT // -RTMPInitPCIeDevice(pci_dev, pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_probe\n")); - - return 0; // probe ok - - - /* --------------------------- ERROR HANDLE --------------------------- */ -err_out_free_netdev: - RtmpOSNetDevFree(net_dev); - -err_out_free_radev: - /* free RTMP_ADAPTER strcuture and os_cookie*/ - RTMPFreeAdapter(pAd); - -err_out_iounmap: - iounmap((void *)(csr_addr)); - release_mem_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); - -err_out_free_res: - pci_release_regions(pci_dev); - -err_out: - pci_disable_device(pci_dev); - - DBGPRINT(RT_DEBUG_ERROR, ("<=== rt2860_probe failed with rv = %d!\n", rv)); - - return -ENODEV; /* probe fail */ -} - - -static VOID __devexit rt2860_remove_one( - IN struct pci_dev *pci_dev) -{ - PNET_DEV net_dev = pci_get_drvdata(pci_dev); - RTMP_ADAPTER *pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev); - ULONG csr_addr = net_dev->base_addr; // pAd->CSRBaseAddress; - - DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_remove_one\n")); - - if (pAd != NULL) - { - // Unregister/Free all allocated net_device. - RtmpPhyNetDevExit(pAd, net_dev); - - // Unmap CSR base address - iounmap((char *)(csr_addr)); - - // release memory region - release_mem_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); - - // Free RTMP_ADAPTER related structures. - RtmpRaDevCtrlExit(pAd); - - } - else - { - // Unregister network device - RtmpOSNetDevDetach(net_dev); - - // Unmap CSR base address - iounmap((char *)(net_dev->base_addr)); - - // release memory region - release_mem_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); - } - - // Free the root net_device - RtmpOSNetDevFree(net_dev); - -} - - -/* -======================================================================== -Routine Description: - Check the chipset vendor/product ID. - -Arguments: - _dev_p Point to the PCI or USB device - -Return Value: - TRUE Check ok - FALSE Check fail - -Note: -======================================================================== -*/ -BOOLEAN RT28XXChipsetCheck( - IN void *_dev_p) -{ - /* always TRUE */ - return TRUE; -} - - - -/*************************************************************************** - * - * PCIe device initialization related procedures. - * - ***************************************************************************/ - static VOID RTMPInitPCIeDevice( - IN struct pci_dev *pci_dev, - IN PRTMP_ADAPTER pAd) -{ - USHORT device_id; - POS_COOKIE pObj; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - pci_read_config_word(pci_dev, PCI_DEVICE_ID, &device_id); - device_id = le2cpu16(device_id); - pObj->DeviceID = device_id; - if ( -#ifdef RT3090 - (device_id == NIC3090_PCIe_DEVICE_ID) || - (device_id == NIC3091_PCIe_DEVICE_ID) || - (device_id == NIC3092_PCIe_DEVICE_ID) || -#endif // RT3090 // - 0) - { - UINT32 MacCsr0 = 0, Index= 0; - do - { - RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0); - - if ((MacCsr0 != 0x00) && (MacCsr0 != 0xFFFFFFFF)) - break; - - RTMPusecDelay(10); - } while (Index++ < 100); - - // Support advanced power save after 2892/2790. - // MAC version at offset 0x1000 is 0x2872XXXX/0x2870XXXX(PCIe, USB, SDIO). - if ((MacCsr0&0xffff0000) != 0x28600000) - { - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_PCIE_DEVICE); - } - } -} - -#ifdef CONFIG_STA_SUPPORT -VOID RTMPInitPCIeLinkCtrlValue( - IN PRTMP_ADAPTER pAd) -{ - INT pos; - USHORT reg16, data2, PCIePowerSaveLevel, Configuration; - UINT32 MacValue; - BOOLEAN bFindIntel = FALSE; - POS_COOKIE pObj; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - return; - - DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __FUNCTION__)); - // Init EEPROM, and save settings - if (!(IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) - { - RT28xx_EEPROM_READ16(pAd, 0x22, PCIePowerSaveLevel); - pAd->PCIePowerSaveLevel = PCIePowerSaveLevel & 0xff; - pAd->LnkCtrlBitMask = 0; - if ((PCIePowerSaveLevel&0xff) == 0xff) - { - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_PCIE_DEVICE); - DBGPRINT(RT_DEBUG_TRACE, ("====> PCIePowerSaveLevel = 0x%x.\n", PCIePowerSaveLevel)); - return; - } - else - { - PCIePowerSaveLevel &= 0x3; - RT28xx_EEPROM_READ16(pAd, 0x24, data2); - - if( !(((data2&0xff00) == 0x9200) && ((data2&0x80) !=0)) ) - { - if (PCIePowerSaveLevel > 1 ) - PCIePowerSaveLevel = 1; - } - - DBGPRINT(RT_DEBUG_TRACE, ("====> Write 0x83 = 0x%x.\n", PCIePowerSaveLevel)); - AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSaveLevel, 0x00); - RT28xx_EEPROM_READ16(pAd, 0x22, PCIePowerSaveLevel); - PCIePowerSaveLevel &= 0xff; - PCIePowerSaveLevel = PCIePowerSaveLevel >> 6; - switch(PCIePowerSaveLevel) - { - case 0: // Only support L0 - pAd->LnkCtrlBitMask = 0; - break; - case 1: // Only enable L0s - pAd->LnkCtrlBitMask = 1; - break; - case 2: // enable L1, L0s - pAd->LnkCtrlBitMask = 3; - break; - case 3: // sync with host clk and enable L1, L0s - pAd->LnkCtrlBitMask = 0x103; - break; - } - RT28xx_EEPROM_READ16(pAd, 0x24, data2); - if ((PCIePowerSaveLevel&0xff) != 0xff) - { - PCIePowerSaveLevel &= 0x3; - - if( !(((data2&0xff00) == 0x9200) && ((data2&0x80) !=0)) ) - { - if (PCIePowerSaveLevel > 1 ) - PCIePowerSaveLevel = 1; - } - - DBGPRINT(RT_DEBUG_TRACE, ("====> rt28xx Write 0x83 Command = 0x%x.\n", PCIePowerSaveLevel)); - printk("\n\n\n%s:%d\n",__FUNCTION__,__LINE__); - - AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSaveLevel, 0x00); - } - DBGPRINT(RT_DEBUG_TRACE, ("====> LnkCtrlBitMask = 0x%x.\n", pAd->LnkCtrlBitMask)); - } - } - else if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) - { - UCHAR LinkCtrlSetting = 0; - - // Check 3090E special setting chip. - RT28xx_EEPROM_READ16(pAd, 0x24, data2); - if ((data2 == 0x9280) && ((pAd->MACVersion&0xffff) == 0x0211)) - { - pAd->b3090ESpecialChip = TRUE; - DBGPRINT_RAW(RT_DEBUG_ERROR,("Special 3090E chip \n")); - } - - RTMP_IO_READ32(pAd, AUX_CTRL, &MacValue); - //enable WAKE_PCIE function, which forces to enable PCIE clock when mpu interrupt asserting. - //Force PCIE 125MHz CLK to toggle - MacValue |= 0x402; - RTMP_IO_WRITE32(pAd, AUX_CTRL, MacValue); - DBGPRINT_RAW(RT_DEBUG_ERROR,(" AUX_CTRL = 0x%32x\n", MacValue)); - - - - // for RT30xx F and after, PCIe infterface, and for power solution 3 - if ((IS_VERSION_AFTER_F(pAd)) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode >= 2) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode <= 3)) - { - RTMP_IO_READ32(pAd, AUX_CTRL, &MacValue); - DBGPRINT_RAW(RT_DEBUG_ERROR,(" Read AUX_CTRL = 0x%x\n", MacValue)); - // turn on bit 12. - //enable 32KHz clock mode for power saving - MacValue |= 0x1000; - if (MacValue != 0xffffffff) - { - RTMP_IO_WRITE32(pAd, AUX_CTRL, MacValue); - DBGPRINT_RAW(RT_DEBUG_ERROR,(" Write AUX_CTRL = 0x%x\n", MacValue)); - // 1. if use PCIePowerSetting is 2 or 3, need to program OSC_CTRL to 0x3ff11. - MacValue = 0x3ff11; - RTMP_IO_WRITE32(pAd, OSC_CTRL, MacValue); - DBGPRINT_RAW(RT_DEBUG_ERROR,(" OSC_CTRL = 0x%x\n", MacValue)); - // 2. Write PCI register Clk ref bit - RTMPrt3xSetPCIePowerLinkCtrl(pAd); - } - else - { - // Error read Aux_Ctrl value. Force to use solution 1 - DBGPRINT(RT_DEBUG_ERROR,(" Error Value in AUX_CTRL = 0x%x\n", MacValue)); - pAd->StaCfg.PSControl.field.rt30xxPowerMode = 1; - DBGPRINT(RT_DEBUG_ERROR,(" Force to use power solution1 \n")); - } - } - // 1. read setting from inf file. - - PCIePowerSaveLevel = (USHORT)pAd->StaCfg.PSControl.field.rt30xxPowerMode; - DBGPRINT(RT_DEBUG_ERROR, ("====> rt30xx Read PowerLevelMode = 0x%x.\n", PCIePowerSaveLevel)); - // 2. Check EnableNewPS. - if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) - PCIePowerSaveLevel = 1; - - if (IS_VERSION_BEFORE_F(pAd) && (pAd->b3090ESpecialChip == FALSE)) - { - // Chip Version E only allow 1, So force set 1. - PCIePowerSaveLevel &= 0x1; - pAd->PCIePowerSaveLevel = (USHORT)PCIePowerSaveLevel; - DBGPRINT(RT_DEBUG_TRACE, ("====> rt30xx E Write 0x83 Command = 0x%x.\n", PCIePowerSaveLevel)); - - AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSaveLevel, 0x00); - } - else - { - // Chip Version F and after only allow 1 or 2 or 3. This might be modified after new chip version come out. - if (!((PCIePowerSaveLevel == 1) || (PCIePowerSaveLevel == 3))) - PCIePowerSaveLevel = 1; - DBGPRINT(RT_DEBUG_ERROR, ("====> rt30xx F Write 0x83 Command = 0x%x.\n", PCIePowerSaveLevel)); - pAd->PCIePowerSaveLevel = (USHORT)PCIePowerSaveLevel; - // for 3090F , we need to add high-byte arg for 0x83 command to indicate the link control setting in - // PCI Configuration Space. Because firmware can't read PCI Configuration Space - if ((pAd->Rt3xxRalinkLinkCtrl & 0x2) && (pAd->Rt3xxHostLinkCtrl & 0x2)) - { - LinkCtrlSetting = 1; - } - DBGPRINT(RT_DEBUG_TRACE, ("====> rt30xxF LinkCtrlSetting = 0x%x.\n", LinkCtrlSetting)); - AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSaveLevel, LinkCtrlSetting); - } - - } - - // Find Ralink PCIe Device's Express Capability Offset - pos = pci_find_capability(pObj->pci_dev, PCI_CAP_ID_EXP); - - if (pos != 0) - { - // Ralink PCIe Device's Link Control Register Offset - pAd->RLnkCtrlOffset = pos + PCI_EXP_LNKCTL; - pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, ®16); - Configuration = le2cpu16(reg16); - DBGPRINT(RT_DEBUG_TRACE, ("Read (Ralink PCIe Link Control Register) offset 0x%x = 0x%x\n", - pAd->RLnkCtrlOffset, Configuration)); - pAd->RLnkCtrlConfiguration = (Configuration & 0x103); - Configuration &= 0xfefc; - Configuration |= (0x0); - - RTMPFindHostPCIDev(pAd); - if (pObj->parent_pci_dev) - { - USHORT vendor_id; - - pci_read_config_word(pObj->parent_pci_dev, PCI_VENDOR_ID, &vendor_id); - vendor_id = le2cpu16(vendor_id); - if (vendor_id == PCIBUS_INTEL_VENDOR) - { - bFindIntel = TRUE; - RTMP_SET_PSFLAG(pAd, fRTMP_PS_TOGGLE_L1); - } - /* - else if ((vendor_id == PCIBUS_AMD_VENDOR1) - && (DeviceID == 0x96000000)) - { - //Verified 2792 Aspire 8530 AMD NB (S3/S4/CBoot/WBoot/Chariot) by customer and ourselves. - // So use L1 Toggle method in this NB. - bFindIntel = TRUE; - RTMP_SET_PSFLAG(pAd, fRTMP_PS_TOGGLE_L1); - DBGPRINT(RT_DEBUG_TRACE, ("PSM : Aspire 8530 AMD NB. Use L1 Toggle. \n")); - } - */ - // Find PCI-to-PCI Bridge Express Capability Offset - pos = pci_find_capability(pObj->parent_pci_dev, PCI_CAP_ID_EXP); - - if (pos != 0) - { - BOOLEAN bChange = FALSE; - // PCI-to-PCI Bridge Link Control Register Offset - pAd->HostLnkCtrlOffset = pos + PCI_EXP_LNKCTL; - pci_read_config_word(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, ®16); - Configuration = le2cpu16(reg16); - DBGPRINT(RT_DEBUG_TRACE, ("Read (Host PCI-to-PCI Bridge Link Control Register) offset 0x%x = 0x%x\n", - pAd->HostLnkCtrlOffset, Configuration)); - pAd->HostLnkCtrlConfiguration = (Configuration & 0x103); - Configuration &= 0xfefc; - Configuration |= (0x0); - - switch (pObj->DeviceID) - { -#ifdef RT3090 - case NIC3090_PCIe_DEVICE_ID: - case NIC3091_PCIe_DEVICE_ID: - case NIC3092_PCIe_DEVICE_ID: - if (bFindIntel == FALSE) - bChange = TRUE; - break; -#endif // RT3090 // - default: - break; - } - - if (bChange) - { - reg16 = cpu2le16(Configuration); - pci_write_config_word(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, reg16); - DBGPRINT(RT_DEBUG_TRACE, ("Write (Host PCI-to-PCI Bridge Link Control Register) offset 0x%x = 0x%x\n", - pAd->HostLnkCtrlOffset, Configuration)); - } - } - else - { - pAd->HostLnkCtrlOffset = 0; - DBGPRINT(RT_DEBUG_ERROR, ("%s: cannot find PCI-to-PCI Bridge PCI Express Capability!\n", __FUNCTION__)); - } - } - } - else - { - pAd->RLnkCtrlOffset = 0; - pAd->HostLnkCtrlOffset = 0; - DBGPRINT(RT_DEBUG_ERROR, ("%s: cannot find Ralink PCIe Device's PCI Express Capability!\n", __FUNCTION__)); - } - - if (bFindIntel == FALSE) - { - DBGPRINT(RT_DEBUG_TRACE, ("Doesn't find Intel PCI host controller. \n")); - // Doesn't switch L0, L1, So set PCIePowerSaveLevel to 0xff - pAd->PCIePowerSaveLevel = 0xff; - if ((pAd->RLnkCtrlOffset != 0) -#ifdef RT3090 - && ((pObj->DeviceID == NIC3090_PCIe_DEVICE_ID) - ||(pObj->DeviceID == NIC3091_PCIe_DEVICE_ID) - ||(pObj->DeviceID == NIC3092_PCIe_DEVICE_ID)) -#endif // RT3090 // - ) - { - pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, ®16); - Configuration = le2cpu16(reg16); - DBGPRINT(RT_DEBUG_TRACE, ("Read (Ralink 30xx PCIe Link Control Register) offset 0x%x = 0x%x\n", - pAd->RLnkCtrlOffset, Configuration)); - pAd->RLnkCtrlConfiguration = (Configuration & 0x103); - Configuration &= 0xfefc; - Configuration |= (0x0); - reg16 = cpu2le16(Configuration); - pci_write_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, reg16); - DBGPRINT(RT_DEBUG_TRACE, ("Write (Ralink PCIe Link Control Register) offset 0x%x = 0x%x\n", - pos + PCI_EXP_LNKCTL, Configuration)); - } - } -} - -VOID RTMPFindHostPCIDev( - IN PRTMP_ADAPTER pAd) -{ - USHORT reg16; - UCHAR reg8; - UINT DevFn; - PPCI_DEV pPci_dev; - POS_COOKIE pObj; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - return; - - DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __FUNCTION__)); - - pObj->parent_pci_dev = NULL; - if (pObj->pci_dev->bus->parent) - { - for (DevFn = 0; DevFn < 255; DevFn++) - { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - pPci_dev = pci_get_slot(pObj->pci_dev->bus->parent, DevFn); -#else - pPci_dev = pci_find_slot(pObj->pci_dev->bus->parent->number, DevFn); -#endif - if (pPci_dev) - { - pci_read_config_word(pPci_dev, PCI_CLASS_DEVICE, ®16); - reg16 = le2cpu16(reg16); - pci_read_config_byte(pPci_dev, PCI_CB_CARD_BUS, ®8); - if ((reg16 == PCI_CLASS_BRIDGE_PCI) && - (reg8 == pObj->pci_dev->bus->number)) - { - pObj->parent_pci_dev = pPci_dev; - } - } - } - } -} - -/* - ======================================================================== - - Routine Description: - - Arguments: - Level = RESTORE_HALT : Restore PCI host and Ralink PCIe Link Control field to its default value. - Level = Other Value : Restore from dot11 power save or radio off status. And force PCI host Link Control fields to 0x1 - - ======================================================================== -*/ -VOID RTMPPCIeLinkCtrlValueRestore( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level) -{ - USHORT PCIePowerSaveLevel, reg16; - USHORT Configuration; - POS_COOKIE pObj; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - return; - - // Check PSControl Configuration - if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) - return TRUE; - - //3090 will not execute the following codes. - // Check interface : If not PCIe interface, return. - -#ifdef RT3090 - if ((pObj->DeviceID == NIC3090_PCIe_DEVICE_ID) - ||(pObj->DeviceID == NIC3091_PCIe_DEVICE_ID) - ||(pObj->DeviceID == NIC3092_PCIe_DEVICE_ID)) - return; -#endif // RT3090 // - DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __FUNCTION__)); - PCIePowerSaveLevel = pAd->PCIePowerSaveLevel; - if ((PCIePowerSaveLevel&0xff) == 0xff) - { - DBGPRINT(RT_DEBUG_TRACE,("return \n")); - return; - } - - if (pObj->parent_pci_dev && (pAd->HostLnkCtrlOffset != 0)) - { - PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, Configuration); - if ((Configuration != 0) && - (Configuration != 0xFFFF)) - { - Configuration &= 0xfefc; - // If call from interface down, restore to orginial setting. - if (Level == RESTORE_CLOSE) - { - Configuration |= pAd->HostLnkCtrlConfiguration; - } - else - Configuration |= 0x0; - PCI_REG_WIRTE_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, Configuration); - DBGPRINT(RT_DEBUG_TRACE, ("Restore PCI host : offset 0x%x = 0x%x\n", pAd->HostLnkCtrlOffset, Configuration)); - } - else - DBGPRINT(RT_DEBUG_ERROR, ("Restore PCI host : PCI_REG_READ_WORD failed (Configuration = 0x%x)\n", Configuration)); - } - - if (pObj->pci_dev && (pAd->RLnkCtrlOffset != 0)) - { - PCI_REG_READ_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, Configuration); - if ((Configuration != 0) && - (Configuration != 0xFFFF)) - { - Configuration &= 0xfefc; - // If call from interface down, restore to orginial setting. - if (Level == RESTORE_CLOSE) - Configuration |= pAd->RLnkCtrlConfiguration; - else - Configuration |= 0x0; - PCI_REG_WIRTE_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, Configuration); - DBGPRINT(RT_DEBUG_TRACE, ("Restore Ralink : offset 0x%x = 0x%x\n", pAd->RLnkCtrlOffset, Configuration)); - } - else - DBGPRINT(RT_DEBUG_ERROR, ("Restore Ralink : PCI_REG_READ_WORD failed (Configuration = 0x%x)\n", Configuration)); - } - - DBGPRINT(RT_DEBUG_TRACE,("%s <===\n", __FUNCTION__)); -} - -/* - ======================================================================== - - Routine Description: - - Arguments: - Max : limit Host PCI and Ralink PCIe device's LINK CONTROL field's value. - Because now frequently set our device to mode 1 or mode 3 will cause problem. - - ======================================================================== -*/ -VOID RTMPPCIeLinkCtrlSetting( - IN PRTMP_ADAPTER pAd, - IN USHORT Max) -{ - USHORT PCIePowerSaveLevel, reg16; - USHORT Configuration; - POS_COOKIE pObj; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - return; - - // Check PSControl Configuration - if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) - return TRUE; - - // Check interface : If not PCIe interface, return. - //Block 3090 to enter the following function - -#ifdef RT3090 - if ((pObj->DeviceID == NIC3090_PCIe_DEVICE_ID) - ||(pObj->DeviceID == NIC3091_PCIe_DEVICE_ID) - ||(pObj->DeviceID == NIC3092_PCIe_DEVICE_ID)) - return; -#endif // RT3090 // - if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP)) - { - DBGPRINT(RT_DEBUG_INFO, ("RTMPPCIePowerLinkCtrl return on fRTMP_PS_CAN_GO_SLEEP flag\n")); - return; - } - DBGPRINT(RT_DEBUG_TRACE,("%s===>\n", __FUNCTION__)); - PCIePowerSaveLevel = pAd->PCIePowerSaveLevel; - if ((PCIePowerSaveLevel&0xff) == 0xff) - { - DBGPRINT(RT_DEBUG_TRACE,("return \n")); - return; - } - PCIePowerSaveLevel = PCIePowerSaveLevel>>6; - - // Skip non-exist deice right away - if (pObj->parent_pci_dev && (pAd->HostLnkCtrlOffset != 0)) - { - PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, Configuration); - switch (PCIePowerSaveLevel) - { - case 0: - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 00 - Configuration &= 0xfefc; - break; - case 1: - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 01 - Configuration &= 0xfefc; - Configuration |= 0x1; - break; - case 2: - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 - Configuration &= 0xfefc; - Configuration |= 0x3; - break; - case 3: - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 and bit 8 of LinkControl of 2892 to 1 - Configuration &= 0xfefc; - Configuration |= 0x103; - break; - } - PCI_REG_WIRTE_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, Configuration); - DBGPRINT(RT_DEBUG_TRACE, ("Write PCI host offset 0x%x = 0x%x\n", pAd->HostLnkCtrlOffset, Configuration)); - } - - if (pObj->pci_dev && (pAd->RLnkCtrlOffset != 0)) - { - // first 2892 chip not allow to frequently set mode 3. will cause hang problem. - if (PCIePowerSaveLevel > Max) - PCIePowerSaveLevel = Max; - - PCI_REG_READ_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, Configuration); - switch (PCIePowerSaveLevel) - { - case 0: - // No PCI power safe - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 00 . - Configuration &= 0xfefc; - break; - case 1: - // L0 - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 01 . - Configuration &= 0xfefc; - Configuration |= 0x1; - break; - case 2: - // L0 and L1 - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 - Configuration &= 0xfefc; - Configuration |= 0x3; - break; - case 3: - // L0 , L1 and clock management. - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 and bit 8 of LinkControl of 2892 to 1 - Configuration &= 0xfefc; - Configuration |= 0x103; - pAd->bPCIclkOff = TRUE; - break; - } - PCI_REG_WIRTE_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, Configuration); - DBGPRINT(RT_DEBUG_TRACE, ("Write Ralink device : offset 0x%x = 0x%x\n", pAd->RLnkCtrlOffset, Configuration)); - } - - DBGPRINT(RT_DEBUG_TRACE,("RTMPPCIePowerLinkCtrl <==============\n")); -} -/* - ======================================================================== - - Routine Description: - 1. Write a PCI register for rt30xx power solution 3 - - ======================================================================== -*/ -VOID RTMPrt3xSetPCIePowerLinkCtrl( - IN PRTMP_ADAPTER pAd) -{ - - ULONG HostConfiguration; - ULONG Configuration; - ULONG Vendor; - ULONG offset; - POS_COOKIE pObj; - INT pos; - USHORT reg16; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - DBGPRINT(RT_DEBUG_INFO, ("RTMPrt3xSetPCIePowerLinkCtrl.===> %x\n", pAd->StaCfg.PSControl.word)); - - // Check PSControl Configuration - if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) - return; - RTMPFindHostPCIDev(pAd); - if (pObj->parent_pci_dev) - { - USHORT vendor_id; - // Find PCI-to-PCI Bridge Express Capability Offset - pos = pci_find_capability(pObj->parent_pci_dev, PCI_CAP_ID_EXP); - - if (pos != 0) - { - pAd->HostLnkCtrlOffset = pos + PCI_EXP_LNKCTL; - } - // If configurared to turn on L1. - HostConfiguration = 0; - if (pAd->StaCfg.PSControl.field.rt30xxForceASPMTest == 1) - { - DBGPRINT(RT_DEBUG_TRACE, ("Enter,PSM : Force ASPM \n")); - - // Skip non-exist deice right away - if ((pAd->HostLnkCtrlOffset != 0)) - { - PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, HostConfiguration); - // Prepare Configuration to write to Host - HostConfiguration |= 0x3; - PCI_REG_WIRTE_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, HostConfiguration); - pAd->Rt3xxHostLinkCtrl = HostConfiguration; - // Because in rt30xxForceASPMTest Mode, Force turn on L0s, L1. - // Fix HostConfiguration bit0:1 = 0x3 for later use. - HostConfiguration = 0x3; - DBGPRINT(RT_DEBUG_TRACE, ("PSM : Force ASPM : Host device L1/L0s Value = 0x%x\n", HostConfiguration)); - } - } - else if (pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM == 1) - { - - // Skip non-exist deice right away - if ((pAd->HostLnkCtrlOffset != 0)) - { - PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, HostConfiguration); - pAd->Rt3xxHostLinkCtrl = HostConfiguration; - HostConfiguration &= 0x3; - DBGPRINT(RT_DEBUG_TRACE, ("PSM : Follow Host ASPM : Host device L1/L0s Value = 0x%x\n", HostConfiguration)); - } - } - } - // Prepare to write Ralink setting. - // Find Ralink PCIe Device's Express Capability Offset - pos = pci_find_capability(pObj->pci_dev, PCI_CAP_ID_EXP); - - if (pos != 0) - { - // Ralink PCIe Device's Link Control Register Offset - pAd->RLnkCtrlOffset = pos + PCI_EXP_LNKCTL; - pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, ®16); - Configuration = le2cpu16(reg16); - DBGPRINT(RT_DEBUG_TRACE, ("Read (Ralink PCIe Link Control Register) offset 0x%x = 0x%x\n", - pAd->RLnkCtrlOffset, Configuration)); - Configuration |= 0x100; - if ((pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM == 1) - || (pAd->StaCfg.PSControl.field.rt30xxForceASPMTest == 1)) - { - switch(HostConfiguration) - { - case 0: - Configuration &= 0xffffffc; - break; - case 1: - Configuration &= 0xffffffc; - Configuration |= 0x1; - break; - case 2: - Configuration &= 0xffffffc; - Configuration |= 0x2; - break; - case 3: - Configuration |= 0x3; - break; - } - } - reg16 = cpu2le16(Configuration); - pci_write_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, reg16); - pAd->Rt3xxRalinkLinkCtrl = Configuration; - DBGPRINT(RT_DEBUG_TRACE, ("PSM :Write Ralink device L1/L0s Value = 0x%x\n", Configuration)); - } - DBGPRINT(RT_DEBUG_INFO,("PSM :RTMPrt3xSetPCIePowerLinkCtrl <==============\n")); - -} - -#endif // CONFIG_STA_SUPPORT // diff --git a/drivers/staging/rt3090/rt3090.h b/drivers/staging/rt3090/rt3090.h deleted file mode 100644 index d325cb028c05..000000000000 --- a/drivers/staging/rt3090/rt3090.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rt3090.h - - Abstract: - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- - */ - -#ifndef __RT3090_H__ -#define __RT3090_H__ - -#ifdef RT3090 - -#ifndef RTMP_PCI_SUPPORT -#error "For RT3090, you should define the compile flag -DRTMP_PCI_SUPPORT" -#endif - -#ifndef RTMP_MAC_PCI -#error "For RT3090, you should define the compile flag -DRTMP_MAC_PCI" -#endif - -#ifndef RTMP_RF_RW_SUPPORT -#error "For RT3090, you should define the compile flag -DRTMP_RF_RW_SUPPORT" -#endif - -#ifndef RT30xx -#error "For RT3090, you should define the compile flag -DRT30xx" -#endif - -#ifdef CARRIER_DETECTION_SUPPORT -#define TONE_RADAR_DETECT_SUPPORT -#define CARRIER_SENSE_NEW_ALGO -#endif // CARRIER_DETECTION_SUPPORT // - -#define PCIE_PS_SUPPORT - -#include "mac_pci.h" -#include "rt30xx.h" - -// -// Device ID & Vendor ID, these values should match EEPROM value -// -#define NIC3090_PCIe_DEVICE_ID 0x3090 // 1T/1R miniCard -#define NIC3091_PCIe_DEVICE_ID 0x3091 // 1T/2R miniCard -#define NIC3092_PCIe_DEVICE_ID 0x3092 // 2T/2R miniCard - -#endif // RT3090 // - -#endif //__RT3090_H__ // diff --git a/drivers/staging/rt3090/rt30xx.h b/drivers/staging/rt3090/rt30xx.h deleted file mode 100644 index 70971a062607..000000000000 --- a/drivers/staging/rt3090/rt30xx.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rt30xx.h - - Abstract: - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- - */ - -#ifndef __RT30XX_H__ -#define __RT30XX_H__ - -#ifdef RT30xx - - -extern REG_PAIR RT30xx_RFRegTable[]; -extern UCHAR NUM_RF_REG_PARMS; - -#endif // RT30xx // - -#endif //__RT30XX_H__ // diff --git a/drivers/staging/rt3090/rt3370.h b/drivers/staging/rt3090/rt3370.h deleted file mode 100644 index bfa9006d059a..000000000000 --- a/drivers/staging/rt3090/rt3370.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rt3370.h - - Abstract: - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- - */ - -#ifndef __RT3370_H__ -#define __RT3370_H__ - -#ifdef RT3370 - - -#error "For RT3070, you should define the compile flag -DRTMP_USB_SUPPORT" - -#error "For RT3070, you should define the compile flag -DRTMP_MAC_USB" - -#ifndef RTMP_RF_RW_SUPPORT -#error "For RT3070, you should define the compile flag -DRTMP_RF_RW_SUPPORT" -#endif - -#ifndef RT33xx -#error "For RT3070, you should define the compile flag -DRT30xx" -#endif - -#include "mac_usb.h" -#include "rt33xx.h" - -// -// Device ID & Vendor ID, these values should match EEPROM value -// - -#endif // RT3370 // - -#endif //__RT3370_H__ // diff --git a/drivers/staging/rt3090/rt3390.h b/drivers/staging/rt3090/rt3390.h deleted file mode 100644 index 412ab3d32ab5..000000000000 --- a/drivers/staging/rt3090/rt3390.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rt3390.h - - Abstract: - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- - */ - -#ifndef __RT3390_H__ -#define __RT3390_H__ - -#ifdef RT3390 - -#ifndef RTMP_PCI_SUPPORT -#error "For RT3390, you should define the compile flag -DRTMP_PCI_SUPPORT" -#endif - -#ifndef RTMP_MAC_PCI -#error "For RT3390, you should define the compile flag -DRTMP_MAC_PCI" -#endif - -#ifndef RTMP_RF_RW_SUPPORT -#error "For RT3390, you should define the compile flag -DRTMP_RF_RW_SUPPORT" -#endif - -#ifndef RT30xx -#error "For RT3390, you should define the compile flag -DRT30xx" -#endif - -#ifdef CARRIER_DETECTION_SUPPORT -#define TONE_RADAR_DETECT_SUPPORT -#define CARRIER_SENSE_NEW_ALGO -#endif // CARRIER_DETECTION_SUPPORT // - -#define PCIE_PS_SUPPORT - -#include "mac_pci.h" -#include "rt33xx.h" - -// -// Device ID & Vendor ID, these values should match EEPROM value -// -#define NIC3390_PCIe_DEVICE_ID 0x3090 // 1T/1R miniCard -#define NIC3391_PCIe_DEVICE_ID 0x3091 // 1T/2R miniCard -#define NIC3392_PCIe_DEVICE_ID 0x3092 // 2T/2R miniCard - -#endif // RT3390 // - -#endif //__RT3390_H__ // diff --git a/drivers/staging/rt3090/rt33xx.h b/drivers/staging/rt3090/rt33xx.h deleted file mode 100644 index 6eb938860b77..000000000000 --- a/drivers/staging/rt3090/rt33xx.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rt33xx.h - - Abstract: - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- - */ - -#ifndef __RT33XX_H__ -#define __RT33XX_H__ - -#ifdef RT33xx - - -extern REG_PAIR RFRegTableOverRT3390[]; -extern UCHAR NUM_RF_REG_PARMS_OVER_RT3390; - -#endif // RT33xx // - -#endif //__RT33XX_H__ // diff --git a/drivers/staging/rt3090/rt_ate.c b/drivers/staging/rt3090/rt_ate.c deleted file mode 100644 index 259aae411628..000000000000 --- a/drivers/staging/rt3090/rt_ate.c +++ /dev/null @@ -1,6089 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - */ - -#include "rt_config.h" - -#ifdef RALINK_ATE - -#ifdef RT30xx -#define ATE_BBP_REG_NUM 168 -UCHAR restore_BBP[ATE_BBP_REG_NUM]={0}; -#endif // RT30xx // - -// 802.11 MAC Header, Type:Data, Length:24bytes -UCHAR TemplateFrame[24] = {0x08,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0x00,0xAA,0xBB,0x12,0x34,0x56,0x00,0x11,0x22,0xAA,0xBB,0xCC,0x00,0x00}; - -extern RTMP_RF_REGS RF2850RegTable[]; -extern UCHAR NUM_OF_2850_CHNL; - -extern FREQUENCY_ITEM FreqItems3020[]; -extern UCHAR NUM_OF_3020_CHNL; - - - - -static CHAR CCKRateTable[] = {0, 1, 2, 3, 8, 9, 10, 11, -1}; /* CCK Mode. */ -static CHAR OFDMRateTable[] = {0, 1, 2, 3, 4, 5, 6, 7, -1}; /* OFDM Mode. */ -static CHAR HTMIXRateTable[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -1}; /* HT Mix Mode. */ - -static INT TxDmaBusy( - IN PRTMP_ADAPTER pAd); - -static INT RxDmaBusy( - IN PRTMP_ADAPTER pAd); - -static VOID RtmpDmaEnable( - IN PRTMP_ADAPTER pAd, - IN INT Enable); - -static VOID BbpSoftReset( - IN PRTMP_ADAPTER pAd); - -static VOID RtmpRfIoWrite( - IN PRTMP_ADAPTER pAd); - -static INT ATESetUpFrame( - IN PRTMP_ADAPTER pAd, - IN UINT32 TxIdx); - -static INT ATETxPwrHandler( - IN PRTMP_ADAPTER pAd, - IN char index); - -static INT ATECmdHandler( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -#ifndef RT30xx -static int CheckMCSValid( - IN UCHAR Mode, - IN UCHAR Mcs); -#endif // RT30xx // - -#ifdef RT30xx -static int CheckMCSValid( - IN UCHAR Mode, - IN UCHAR Mcs, - IN BOOLEAN bRT2070); -#endif // RT30xx // - -#ifdef RTMP_MAC_PCI -static VOID ATEWriteTxWI( - IN PRTMP_ADAPTER pAd, - IN PTXWI_STRUC pOutTxWI, - IN BOOLEAN FRAG, - IN BOOLEAN CFACK, - IN BOOLEAN InsTimestamp, - IN BOOLEAN AMPDU, - IN BOOLEAN Ack, - IN BOOLEAN NSeq, // HW new a sequence. - IN UCHAR BASize, - IN UCHAR WCID, - IN ULONG Length, - IN UCHAR PID, - IN UCHAR TID, - IN UCHAR TxRate, - IN UCHAR Txopmode, - IN BOOLEAN CfAck, - IN HTTRANSMIT_SETTING *pTransmit); -#endif // RTMP_MAC_PCI // - - -static VOID SetJapanFilter( - IN PRTMP_ADAPTER pAd); - - -#ifdef RALINK_28xx_QA -static inline INT DO_RACFG_CMD_ATE_START( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_STOP( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_RF_WRITE_ALL( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_E2PROM_READ16( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_E2PROM_WRITE16( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_E2PROM_READ_ALL -( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_E2PROM_WRITE_ALL( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_IO_READ( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_IO_WRITE( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_IO_READ_BULK( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_BBP_READ8( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_BBP_WRITE8( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_BBP_READ_ALL( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_GET_NOISE_LEVEL( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_GET_COUNTER( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_CLEAR_COUNTER( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_TX_START( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_GET_TX_STATUS( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_TX_STOP( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_RX_START( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_RX_STOP( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_RX_STOP( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_START_TX_CARRIER( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_START_TX_CONT( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_START_TX_FRAME( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_SET_BW( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_SET_TX_POWER0( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_SET_TX_POWER1( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_SET_FREQ_OFFSET( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_GET_STATISTICS( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_RESET_COUNTER( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_SEL_TX_ANTENNA( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_SEL_RX_ANTENNA( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_SET_PREAMBLE( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_SET_CHANNEL( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_SET_ADDR1( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_SET_ADDR2( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_SET_ADDR3( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_SET_RATE( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_SET_TX_FRAME_LEN( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_SET_TX_FRAME_COUNT( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_START_RX_FRAME( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_E2PROM_READ_BULK( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_E2PROM_WRITE_BULK( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_IO_WRITE_BULK( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_BBP_READ_BULK( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -static inline INT DO_RACFG_CMD_ATE_BBP_WRITE_BULK( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg -); - -#endif // RALINK_28xx_QA // - - -#ifdef RTMP_MAC_PCI -static INT TxDmaBusy( - IN PRTMP_ADAPTER pAd) -{ - INT result; - WPDMA_GLO_CFG_STRUC GloCfg; - - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); // disable DMA - if (GloCfg.field.TxDMABusy) - result = 1; - else - result = 0; - - return result; -} - - -static INT RxDmaBusy( - IN PRTMP_ADAPTER pAd) -{ - INT result; - WPDMA_GLO_CFG_STRUC GloCfg; - - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); // disable DMA - if (GloCfg.field.RxDMABusy) - result = 1; - else - result = 0; - - return result; -} - - -static VOID RtmpDmaEnable( - IN PRTMP_ADAPTER pAd, - IN INT Enable) -{ - BOOLEAN value; - ULONG WaitCnt; - WPDMA_GLO_CFG_STRUC GloCfg; - - value = Enable > 0 ? 1 : 0; - - // check DMA is in busy mode. - WaitCnt = 0; - - while (TxDmaBusy(pAd) || RxDmaBusy(pAd)) - { - RTMPusecDelay(10); - if (WaitCnt++ > 100) - break; - } - - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); // disable DMA - GloCfg.field.EnableTxDMA = value; - GloCfg.field.EnableRxDMA = value; - RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); // abort all TX rings - RTMPusecDelay(5000); - - return; -} -#endif // RTMP_MAC_PCI // - - - - -static VOID BbpSoftReset( - IN PRTMP_ADAPTER pAd) -{ - UCHAR BbpData = 0; - - // Soft reset, set BBP R21 bit0=1->0 - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R21, &BbpData); - BbpData |= 0x00000001; //set bit0=1 - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R21, BbpData); - - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R21, &BbpData); - BbpData &= ~(0x00000001); //set bit0=0 - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R21, BbpData); - - return; -} - - -static VOID RtmpRfIoWrite( - IN PRTMP_ADAPTER pAd) -{ - // Set RF value 1's set R3[bit2] = [0] - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R1); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R2); - RTMP_RF_IO_WRITE32(pAd, (pAd->LatchRfRegs.R3 & (~0x04))); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R4); - - RTMPusecDelay(200); - - // Set RF value 2's set R3[bit2] = [1] - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R1); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R2); - RTMP_RF_IO_WRITE32(pAd, (pAd->LatchRfRegs.R3 | 0x04)); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R4); - - RTMPusecDelay(200); - - // Set RF value 3's set R3[bit2] = [0] - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R1); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R2); - RTMP_RF_IO_WRITE32(pAd, (pAd->LatchRfRegs.R3 & (~0x04))); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R4); - - return; -} - - -#ifdef RT30xx -static int CheckMCSValid( - UCHAR Mode, - UCHAR Mcs, - BOOLEAN bRT2070) -#endif // RT30xx // -#ifndef RT30xx -static int CheckMCSValid( - IN UCHAR Mode, - IN UCHAR Mcs) -#endif // RT30xx // -{ - INT i; - PCHAR pRateTab; - - switch (Mode) - { - case 0: - pRateTab = CCKRateTable; - break; - case 1: - pRateTab = OFDMRateTable; - break; - case 2: - case 3: -#ifdef RT30xx - if (bRT2070) - pRateTab = OFDMRateTable; - else -#endif // RT30xx // - pRateTab = HTMIXRateTable; - break; - default: - ATEDBGPRINT(RT_DEBUG_ERROR, ("unrecognizable Tx Mode %d\n", Mode)); - return -1; - break; - } - - i = 0; - while (pRateTab[i] != -1) - { - if (pRateTab[i] == Mcs) - return 0; - i++; - } - - return -1; -} - - -static INT ATETxPwrHandler( - IN PRTMP_ADAPTER pAd, - IN char index) -{ - ULONG R; - CHAR TxPower; - UCHAR Bbp94 = 0; - BOOLEAN bPowerReduce = FALSE; -#ifdef RTMP_RF_RW_SUPPORT - UCHAR RFValue; -#endif // RTMP_RF_RW_SUPPORT // -#ifdef RALINK_28xx_QA - if ((pAd->ate.bQATxStart == TRUE) || (pAd->ate.bQARxStart == TRUE)) - { - /* - When QA is used for Tx, pAd->ate.TxPower0/1 and real tx power - are not synchronized. - */ - return 0; - } - else -#endif // RALINK_28xx_QA // - { - TxPower = index == 0 ? pAd->ate.TxPower0 : pAd->ate.TxPower1; - - if (pAd->ate.Channel <= 14) - { - if (TxPower > 31) - { - - // R3, R4 can't large than 31 (0x24), 31 ~ 36 used by BBP 94 - R = 31; - if (TxPower <= 36) - Bbp94 = BBPR94_DEFAULT + (UCHAR)(TxPower - 31); - } - else if (TxPower < 0) - { - - // R3, R4 can't less than 0, -1 ~ -6 used by BBP 94 - R = 0; - if (TxPower >= -6) - Bbp94 = BBPR94_DEFAULT + TxPower; - } - else - { - // 0 ~ 31 - R = (ULONG) TxPower; - Bbp94 = BBPR94_DEFAULT; - } - - ATEDBGPRINT(RT_DEBUG_TRACE, ("%s (TxPower=%d, R=%ld, BBP_R94=%d)\n", __FUNCTION__, TxPower, R, Bbp94)); - } - else /* 5.5 GHz */ - { - if (TxPower > 15) - { - - // R3, R4 can't large than 15 (0x0F) - R = 15; - } - else if (TxPower < 0) - { - - // R3, R4 can't less than 0 - // -1 ~ -7 - ASSERT((TxPower >= -7)); - R = (ULONG)(TxPower + 7); - bPowerReduce = TRUE; - } - else - { - // 0 ~ 15 - R = (ULONG) TxPower; - } - - ATEDBGPRINT(RT_DEBUG_TRACE, ("%s (TxPower=%d, R=%lu)\n", __FUNCTION__, TxPower, R)); - } -//2008/09/10:KH adds to support 3070 ATE TX Power tunning real time<-- -#ifdef RTMP_RF_RW_SUPPORT - if (IS_RT30xx(pAd)) - { - // Set Tx Power - ATE_RF_IO_READ8_BY_REG_ID(pAd, RF_R12, (PUCHAR)&RFValue); - RFValue = (RFValue & 0xE0) | TxPower; - ATE_RF_IO_WRITE8_BY_REG_ID(pAd, RF_R12, (UCHAR)RFValue); - ATEDBGPRINT(RT_DEBUG_TRACE, ("3070 or 2070:%s (TxPower=%d, RFValue=%x)\n", __FUNCTION__, TxPower, RFValue)); - } - else -#endif // RTMP_RF_RW_SUPPORT // - { - if (pAd->ate.Channel <= 14) - { - if (index == 0) - { - // shift TX power control to correct RF(R3) register bit position - R = R << 9; - R |= (pAd->LatchRfRegs.R3 & 0xffffc1ff); - pAd->LatchRfRegs.R3 = R; - } - else - { - // shift TX power control to correct RF(R4) register bit position - R = R << 6; - R |= (pAd->LatchRfRegs.R4 & 0xfffff83f); - pAd->LatchRfRegs.R4 = R; - } - } - else /* 5.5GHz */ - { - if (bPowerReduce == FALSE) - { - if (index == 0) - { - // shift TX power control to correct RF(R3) register bit position - R = (R << 10) | (1 << 9); - R |= (pAd->LatchRfRegs.R3 & 0xffffc1ff); - pAd->LatchRfRegs.R3 = R; - } - else - { - // shift TX power control to correct RF(R4) register bit position - R = (R << 7) | (1 << 6); - R |= (pAd->LatchRfRegs.R4 & 0xfffff83f); - pAd->LatchRfRegs.R4 = R; - } - } - else - { - if (index == 0) - { - // shift TX power control to correct RF(R3) register bit position - R = (R << 10); - R |= (pAd->LatchRfRegs.R3 & 0xffffc1ff); - - /* Clear bit 9 of R3 to reduce 7dB. */ - pAd->LatchRfRegs.R3 = (R & (~(1 << 9))); - } - else - { - // shift TX power control to correct RF(R4) register bit position - R = (R << 7); - R |= (pAd->LatchRfRegs.R4 & 0xfffff83f); - - /* Clear bit 6 of R4 to reduce 7dB. */ - pAd->LatchRfRegs.R4 = (R & (~(1 << 6))); - } - } - } - RtmpRfIoWrite(pAd); - } -//2008/09/10:KH adds to support 3070 ATE TX Power tunning real time--> - - return 0; - } -} - - -/* -========================================================================== - Description: - Set ATE operation mode to - 0. ATESTART = Start ATE Mode - 1. ATESTOP = Stop ATE Mode - 2. TXCONT = Continuous Transmit - 3. TXCARR = Transmit Carrier - 4. TXFRAME = Transmit Frames - 5. RXFRAME = Receive Frames -#ifdef RALINK_28xx_QA - 6. TXSTOP = Stop Any Type of Transmition - 7. RXSTOP = Stop Receiving Frames -#endif // RALINK_28xx_QA // - Return: - TRUE if all parameters are OK, FALSE otherwise -========================================================================== -*/ -#ifdef RTMP_MAC_PCI -static INT ATECmdHandler( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UINT32 Value = 0; - UCHAR BbpData; - UINT32 MacData = 0; - PTXD_STRUC pTxD; - INT index; - UINT i = 0, atemode = 0; - PRXD_STRUC pRxD; - PRTMP_TX_RING pTxRing = &pAd->TxRing[QID_AC_BE]; - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; -#ifdef RT_BIG_ENDIAN - PTXD_STRUC pDestTxD; - TXD_STRUC TxD; -#endif - - ATEDBGPRINT(RT_DEBUG_TRACE, ("===> ATECmdHandler()\n")); - - ATEAsicSwitchChannel(pAd); - - /* empty function */ - AsicLockChannel(pAd, pAd->ate.Channel); - - RTMPusecDelay(5000); - - // read MAC_SYS_CTRL and backup MAC_SYS_CTRL value. - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &MacData); - - // Default value in BBP R22 is 0x0. - BbpData = 0; - - // clean bit4 to stop continuous Tx production test. - MacData &= 0xFFFFFFEF; - - // Enter ATE mode and set Tx/Rx Idle - if (!strcmp(arg, "ATESTART")) - { - ATEDBGPRINT(RT_DEBUG_TRACE, ("ATE: ATESTART\n")); - -#if defined(LINUX) || defined(VXWORKS) - // check if we have removed the firmware - if (!(ATE_ON(pAd))) - { - NICEraseFirmware(pAd); - } -#endif // defined(LINUX) || defined(VXWORKS) // - - atemode = pAd->ate.Mode; - pAd->ate.Mode = ATE_START; - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, MacData); - - if (atemode == ATE_TXCARR) - { - // No Carrier Test set BBP R22 bit7=0, bit6=0, bit[5~0]=0x0 - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R22, &BbpData); - BbpData &= 0xFFFFFF00; // clear bit7, bit6, bit[5~0] - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R22, BbpData); - } - else if (atemode == ATE_TXCARRSUPP) - { - // No Cont. TX set BBP R22 bit7=0 - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R22, &BbpData); - BbpData &= ~(1 << 7); // set bit7=0 - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R22, BbpData); - - // No Carrier Suppression set BBP R24 bit0=0 - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R24, &BbpData); - BbpData &= 0xFFFFFFFE; // clear bit0 - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, BbpData); - } - - /* - We should free some resource which was allocated - when ATE_TXFRAME , ATE_STOP, and ATE_TXCONT. - */ - else if ((atemode & ATE_TXFRAME) || (atemode == ATE_STOP)) - { - PRTMP_TX_RING pTxRing = &pAd->TxRing[QID_AC_BE]; - - if (atemode == ATE_TXCONT) - { - // No Cont. TX set BBP R22 bit7=0 - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R22, &BbpData); - BbpData &= ~(1 << 7); // set bit7=0 - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R22, BbpData); - } - - // Abort Tx, Rx DMA. - RtmpDmaEnable(pAd, 0); - for (i=0; iTxRing[QID_AC_BE].Cell[i].AllocVa; -#else - pDestTxD = (PTXD_STRUC)pAd->TxRing[QID_AC_BE].Cell[i].AllocVa; - TxD = *pDestTxD; - pTxD = &TxD; - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); -#endif - pTxD->DMADONE = 0; - pPacket = pTxRing->Cell[i].pNdisPacket; - - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - - // Always assign pNdisPacket as NULL after clear - pTxRing->Cell[i].pNdisPacket = NULL; - - pPacket = pTxRing->Cell[i].pNextNdisPacket; - - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - - // Always assign pNextNdisPacket as NULL after clear - pTxRing->Cell[i].pNextNdisPacket = NULL; -#ifdef RT_BIG_ENDIAN - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); - WriteBackToDescriptor((PUCHAR)pDestTxD, (PUCHAR)pTxD, FALSE, TYPE_TXD); -#endif - } - - // Start Tx, RX DMA - RtmpDmaEnable(pAd, 1); - } - - // reset Rx statistics. - pAd->ate.LastSNR0 = 0; - pAd->ate.LastSNR1 = 0; - pAd->ate.LastRssi0 = 0; - pAd->ate.LastRssi1 = 0; - pAd->ate.LastRssi2 = 0; - pAd->ate.AvgRssi0 = 0; - pAd->ate.AvgRssi1 = 0; - pAd->ate.AvgRssi2 = 0; - pAd->ate.AvgRssi0X8 = 0; - pAd->ate.AvgRssi1X8 = 0; - pAd->ate.AvgRssi2X8 = 0; - pAd->ate.NumOfAvgRssiSample = 0; - -#ifdef RALINK_28xx_QA - // Tx frame - pAd->ate.bQATxStart = FALSE; - pAd->ate.bQARxStart = FALSE; - pAd->ate.seq = 0; - - // counters - pAd->ate.U2M = 0; - pAd->ate.OtherData = 0; - pAd->ate.Beacon = 0; - pAd->ate.OtherCount = 0; - pAd->ate.TxAc0 = 0; - pAd->ate.TxAc1 = 0; - pAd->ate.TxAc2 = 0; - pAd->ate.TxAc3 = 0; - /*pAd->ate.TxHCCA = 0;*/ - pAd->ate.TxMgmt = 0; - pAd->ate.RSSI0 = 0; - pAd->ate.RSSI1 = 0; - pAd->ate.RSSI2 = 0; - pAd->ate.SNR0 = 0; - pAd->ate.SNR1 = 0; - - // control - pAd->ate.TxDoneCount = 0; - // TxStatus : 0 --> task is idle, 1 --> task is running - pAd->ate.TxStatus = 0; -#endif // RALINK_28xx_QA // - - // Soft reset BBP. - BbpSoftReset(pAd); - - -#ifdef CONFIG_STA_SUPPORT - /* LinkDown() has "AsicDisableSync();" and "RTMP_BBP_IO_R/W8_BY_REG_ID();" inside. */ -// LinkDown(pAd, FALSE); -// AsicEnableBssSync(pAd); - -#if defined(LINUX) || defined(VXWORKS) - RTMP_OS_NETDEV_STOP_QUEUE(pAd->net_dev); -#endif // defined(LINUX) || defined(VXWORKS) // - - /* - If we skip "LinkDown()", we should disable protection - to prevent from sending out RTS or CTS-to-self. - */ - ATEDisableAsicProtect(pAd); - RTMPStationStop(pAd); -#endif // CONFIG_STA_SUPPORT // - - /* Disable Tx */ - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value &= ~(1 << 2); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - - /* Disable Rx */ - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value &= ~(1 << 3); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - } - else if (!strcmp(arg, "ATESTOP")) - { - ATEDBGPRINT(RT_DEBUG_TRACE, ("ATE: ATESTOP\n")); - - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R22, BbpData); - - // recover the MAC_SYS_CTRL register back - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, MacData); - - // disable Tx, Rx - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value &= (0xfffffff3); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - - // abort Tx, RX DMA - RtmpDmaEnable(pAd, 0); - -#ifdef LINUX - pAd->ate.bFWLoading = TRUE; - - Status = NICLoadFirmware(pAd); - - if (Status != NDIS_STATUS_SUCCESS) - { - ATEDBGPRINT(RT_DEBUG_ERROR, ("NICLoadFirmware failed, Status[=0x%08x]\n", Status)); - return FALSE; - } -#endif // LINUX // - pAd->ate.Mode = ATE_STOP; - - /* - Even the firmware has been loaded, - we still could use ATE_BBP_IO_READ8_BY_REG_ID(). - But this is not suggested. - */ - BbpSoftReset(pAd); - - RTMP_ASIC_INTERRUPT_DISABLE(pAd); - - NICInitializeAdapter(pAd, TRUE); - - /* - Reinitialize Rx Ring before Rx DMA is enabled. - >>>RxCoherent<<< was gone ! - */ - for (index = 0; index < RX_RING_SIZE; index++) - { - pRxD = (PRXD_STRUC) pAd->RxRing.Cell[index].AllocVa; - pRxD->DDONE = 0; - } - - // We should read EEPROM for all cases. - NICReadEEPROMParameters(pAd, NULL); - NICInitAsicFromEEPROM(pAd); - - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - - /* empty function */ - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - - /* clear garbage interrupts */ - RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, 0xffffffff); - /* Enable Interrupt */ - RTMP_ASIC_INTERRUPT_ENABLE(pAd); - - /* restore RX_FILTR_CFG */ - -#ifdef CONFIG_STA_SUPPORT - /* restore RX_FILTR_CFG due to that QA maybe set it to 0x3 */ - RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, STANORMAL); -#endif // CONFIG_STA_SUPPORT // - - // Enable Tx - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value |= (1 << 2); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - - // Enable Tx, Rx DMA. - RtmpDmaEnable(pAd, 1); - - // Enable Rx - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value |= (1 << 3); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - - -#ifdef CONFIG_STA_SUPPORT - RTMPStationStart(pAd); -#endif // CONFIG_STA_SUPPORT // - -#if defined(LINUX) || defined(VXWORKS) - RTMP_OS_NETDEV_START_QUEUE(pAd->net_dev); -#endif // defined(LINUX) || defined(VXWORKS) // - } - else if (!strcmp(arg, "TXCARR")) - { - ATEDBGPRINT(RT_DEBUG_TRACE, ("ATE: TXCARR\n")); - pAd->ate.Mode = ATE_TXCARR; - - // QA has done the following steps if it is used. - if (pAd->ate.bQATxStart == FALSE) - { - // Soft reset BBP. - BbpSoftReset(pAd); - - // Carrier Test set BBP R22 bit7=1, bit6=1, bit[5~0]=0x01 - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R22, &BbpData); - BbpData &= 0xFFFFFF00; //clear bit7, bit6, bit[5~0] - BbpData |= 0x000000C1; //set bit7=1, bit6=1, bit[5~0]=0x01 - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R22, BbpData); - - // set MAC_SYS_CTRL(0x1004) Continuous Tx Production Test (bit4) = 1 - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value = Value | 0x00000010; - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - } - } - else if (!strcmp(arg, "TXCONT")) - { - if (pAd->ate.bQATxStart == TRUE) - { - /* - set MAC_SYS_CTRL(0x1004) bit4(Continuous Tx Production Test) - and bit2(MAC TX enable) back to zero. - */ - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &MacData); - MacData &= 0xFFFFFFEB; - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, MacData); - - // set BBP R22 bit7=0 - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R22, &BbpData); - BbpData &= 0xFFFFFF7F; //set bit7=0 - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R22, BbpData); - } - - /* - for TxCont mode. - Step 1: Send 50 packets first then wait for a moment. - Step 2: Send more 50 packet then start continue mode. - */ - ATEDBGPRINT(RT_DEBUG_TRACE, ("ATE: TXCONT\n")); - - // Step 1: send 50 packets first. - pAd->ate.Mode = ATE_TXCONT; - pAd->ate.TxCount = 50; - - /* Do it after Tx/Rx DMA is aborted. */ -// pAd->ate.TxDoneCount = 0; - - // Soft reset BBP. - BbpSoftReset(pAd); - - // Abort Tx, RX DMA. - RtmpDmaEnable(pAd, 0); - - // Fix can't smooth kick - { - RTMP_IO_READ32(pAd, TX_DTX_IDX0 + QID_AC_BE * 0x10, &pTxRing->TxDmaIdx); - pTxRing->TxSwFreeIdx = pTxRing->TxDmaIdx; - pTxRing->TxCpuIdx = pTxRing->TxDmaIdx; - RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + QID_AC_BE * 0x10, pTxRing->TxCpuIdx); - } - - pAd->ate.TxDoneCount = 0; - - /* Only needed if we have to send some normal frames. */ - SetJapanFilter(pAd); - - for (i = 0; (i < TX_RING_SIZE-1) && (i < pAd->ate.TxCount); i++) - { - PNDIS_PACKET pPacket; - UINT32 TxIdx = pTxRing->TxCpuIdx; - -#ifndef RT_BIG_ENDIAN - pTxD = (PTXD_STRUC)pTxRing->Cell[TxIdx].AllocVa; -#else - pDestTxD = (PTXD_STRUC)pTxRing->Cell[TxIdx].AllocVa; - TxD = *pDestTxD; - pTxD = &TxD; - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); -#endif - // Clean current cell. - pPacket = pTxRing->Cell[TxIdx].pNdisPacket; - - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - - // Always assign pNdisPacket as NULL after clear - pTxRing->Cell[TxIdx].pNdisPacket = NULL; - - pPacket = pTxRing->Cell[TxIdx].pNextNdisPacket; - - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - - // Always assign pNextNdisPacket as NULL after clear - pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; - -#ifdef RT_BIG_ENDIAN - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); - WriteBackToDescriptor((PUCHAR)pDestTxD, (PUCHAR)pTxD, FALSE, TYPE_TXD); -#endif - - if (ATESetUpFrame(pAd, TxIdx) != 0) - break; - - INC_RING_INDEX(pTxRing->TxCpuIdx, TX_RING_SIZE); - } - - // Setup frame format. - ATESetUpFrame(pAd, pTxRing->TxCpuIdx); - - // Start Tx, RX DMA. - RtmpDmaEnable(pAd, 1); - - // Enable Tx - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value |= (1 << 2); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - - // Disable Rx - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value &= ~(1 << 3); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - -#ifdef RALINK_28xx_QA - if (pAd->ate.bQATxStart == TRUE) - { - pAd->ate.TxStatus = 1; - } -#endif // RALINK_28xx_QA // - - // kick Tx-Ring - RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + QID_AC_BE * RINGREG_DIFF, pAd->TxRing[QID_AC_BE].TxCpuIdx); - - RTMPusecDelay(5000); - - - // Step 2: send more 50 packets then start continue mode. - // Abort Tx, RX DMA. - RtmpDmaEnable(pAd, 0); - - // Cont. TX set BBP R22 bit7=1 - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R22, &BbpData); - BbpData |= 0x00000080; //set bit7=1 - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R22, BbpData); - - pAd->ate.TxCount = 50; - - // Fix can't smooth kick - { - RTMP_IO_READ32(pAd, TX_DTX_IDX0 + QID_AC_BE * 0x10, &pTxRing->TxDmaIdx); - pTxRing->TxSwFreeIdx = pTxRing->TxDmaIdx; - pTxRing->TxCpuIdx = pTxRing->TxDmaIdx; - RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + QID_AC_BE * 0x10, pTxRing->TxCpuIdx); - } - - pAd->ate.TxDoneCount = 0; - - SetJapanFilter(pAd); - - for (i = 0; (i < TX_RING_SIZE-1) && (i < pAd->ate.TxCount); i++) - { - PNDIS_PACKET pPacket; - UINT32 TxIdx = pTxRing->TxCpuIdx; - -#ifndef RT_BIG_ENDIAN - pTxD = (PTXD_STRUC)pTxRing->Cell[TxIdx].AllocVa; -#else - pDestTxD = (PTXD_STRUC)pTxRing->Cell[TxIdx].AllocVa; - TxD = *pDestTxD; - pTxD = &TxD; - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); -#endif - // clean current cell. - pPacket = pTxRing->Cell[TxIdx].pNdisPacket; - - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - - // Always assign pNdisPacket as NULL after clear - pTxRing->Cell[TxIdx].pNdisPacket = NULL; - - pPacket = pTxRing->Cell[TxIdx].pNextNdisPacket; - - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - - // Always assign pNextNdisPacket as NULL after clear - pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; - -#ifdef RT_BIG_ENDIAN - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); - WriteBackToDescriptor((PUCHAR)pDestTxD, (PUCHAR)pTxD, FALSE, TYPE_TXD); -#endif - - if (ATESetUpFrame(pAd, TxIdx) != 0) - break; - - INC_RING_INDEX(pTxRing->TxCpuIdx, TX_RING_SIZE); - } - - ATESetUpFrame(pAd, pTxRing->TxCpuIdx); - - // Start Tx, RX DMA. - RtmpDmaEnable(pAd, 1); - - // Enable Tx - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value |= (1 << 2); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - - // Disable Rx - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value &= ~(1 << 3); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - -#ifdef RALINK_28xx_QA - if (pAd->ate.bQATxStart == TRUE) - { - pAd->ate.TxStatus = 1; - } -#endif // RALINK_28xx_QA // - - // kick Tx-Ring. - RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + QID_AC_BE * RINGREG_DIFF, pAd->TxRing[QID_AC_BE].TxCpuIdx); - - RTMPusecDelay(500); - - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &MacData); - MacData |= 0x00000010; - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, MacData); - } - else if (!strcmp(arg, "TXFRAME")) - { - ATEDBGPRINT(RT_DEBUG_TRACE, ("ATE: TXFRAME(Count=%d)\n", pAd->ate.TxCount)); - pAd->ate.Mode |= ATE_TXFRAME; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R22, BbpData); - - // Soft reset BBP. - BbpSoftReset(pAd); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, MacData); - - // Abort Tx, RX DMA. - RtmpDmaEnable(pAd, 0); - - // Fix can't smooth kick - { - RTMP_IO_READ32(pAd, TX_DTX_IDX0 + QID_AC_BE * 0x10, &pTxRing->TxDmaIdx); - pTxRing->TxSwFreeIdx = pTxRing->TxDmaIdx; - pTxRing->TxCpuIdx = pTxRing->TxDmaIdx; - RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + QID_AC_BE * 0x10, pTxRing->TxCpuIdx); - } - - pAd->ate.TxDoneCount = 0; - - SetJapanFilter(pAd); - - for (i = 0; (i < TX_RING_SIZE-1) && (i < pAd->ate.TxCount); i++) - { - PNDIS_PACKET pPacket; - UINT32 TxIdx = pTxRing->TxCpuIdx; - -#ifndef RT_BIG_ENDIAN - pTxD = (PTXD_STRUC)pTxRing->Cell[TxIdx].AllocVa; -#else - pDestTxD = (PTXD_STRUC)pTxRing->Cell[TxIdx].AllocVa; - TxD = *pDestTxD; - pTxD = &TxD; - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); -#endif - // Clean current cell. - pPacket = pTxRing->Cell[TxIdx].pNdisPacket; - - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - - // Always assign pNdisPacket as NULL after clear - pTxRing->Cell[TxIdx].pNdisPacket = NULL; - - pPacket = pTxRing->Cell[TxIdx].pNextNdisPacket; - - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - - // Always assign pNextNdisPacket as NULL after clear - pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; - -#ifdef RT_BIG_ENDIAN - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); - WriteBackToDescriptor((PUCHAR)pDestTxD, (PUCHAR)pTxD, FALSE, TYPE_TXD); -#endif - - if (ATESetUpFrame(pAd, TxIdx) != 0) - break; - - INC_RING_INDEX(pTxRing->TxCpuIdx, TX_RING_SIZE); - - } - - ATESetUpFrame(pAd, pTxRing->TxCpuIdx); - - // Start Tx, Rx DMA. - RtmpDmaEnable(pAd, 1); - - // Enable Tx - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value |= (1 << 2); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - -#ifdef RALINK_28xx_QA - // add this for LoopBack mode - if (pAd->ate.bQARxStart == FALSE) - { - // Disable Rx - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value &= ~(1 << 3); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - } - - if (pAd->ate.bQATxStart == TRUE) - { - pAd->ate.TxStatus = 1; - } -#else - // Disable Rx - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value &= ~(1 << 3); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); -#endif // RALINK_28xx_QA // - - RTMP_IO_READ32(pAd, TX_DTX_IDX0 + QID_AC_BE * RINGREG_DIFF, &pAd->TxRing[QID_AC_BE].TxDmaIdx); - // kick Tx-Ring. - RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + QID_AC_BE * RINGREG_DIFF, pAd->TxRing[QID_AC_BE].TxCpuIdx); - - pAd->RalinkCounters.KickTxCount++; - } -#ifdef RALINK_28xx_QA - else if (!strcmp(arg, "TXSTOP")) - { - ATEDBGPRINT(RT_DEBUG_TRACE, ("ATE: TXSTOP\n")); - atemode = pAd->ate.Mode; - pAd->ate.Mode &= ATE_TXSTOP; - pAd->ate.bQATxStart = FALSE; -// pAd->ate.TxDoneCount = pAd->ate.TxCount; - - if (atemode == ATE_TXCARR) - { - // No Carrier Test set BBP R22 bit7=0, bit6=0, bit[5~0]=0x0 - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R22, &BbpData); - BbpData &= 0xFFFFFF00; //clear bit7, bit6, bit[5~0] - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R22, BbpData); - } - else if (atemode == ATE_TXCARRSUPP) - { - // No Cont. TX set BBP R22 bit7=0 - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R22, &BbpData); - BbpData &= ~(1 << 7); //set bit7=0 - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R22, BbpData); - - // No Carrier Suppression set BBP R24 bit0=0 - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R24, &BbpData); - BbpData &= 0xFFFFFFFE; //clear bit0 - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, BbpData); - } - - /* - We should free some resource which was allocated - when ATE_TXFRAME, ATE_STOP, and ATE_TXCONT. - */ - else if ((atemode & ATE_TXFRAME) || (atemode == ATE_STOP)) - { - PRTMP_TX_RING pTxRing = &pAd->TxRing[QID_AC_BE]; - - if (atemode == ATE_TXCONT) - { - // No Cont. TX set BBP R22 bit7=0 - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R22, &BbpData); - BbpData &= ~(1 << 7); //set bit7=0 - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R22, BbpData); - } - - // Abort Tx, Rx DMA. - RtmpDmaEnable(pAd, 0); - - for (i=0; iTxRing[QID_AC_BE].Cell[i].AllocVa; -#else - pDestTxD = (PTXD_STRUC)pAd->TxRing[QID_AC_BE].Cell[i].AllocVa; - TxD = *pDestTxD; - pTxD = &TxD; - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); -#endif - pTxD->DMADONE = 0; - pPacket = pTxRing->Cell[i].pNdisPacket; - - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - - // Always assign pNdisPacket as NULL after clear - pTxRing->Cell[i].pNdisPacket = NULL; - - pPacket = pTxRing->Cell[i].pNextNdisPacket; - - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); - } - - // Always assign pNextNdisPacket as NULL after clear - pTxRing->Cell[i].pNextNdisPacket = NULL; -#ifdef RT_BIG_ENDIAN - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); - WriteBackToDescriptor((PUCHAR)pDestTxD, (PUCHAR)pTxD, FALSE, TYPE_TXD); -#endif - } - // Enable Tx, Rx DMA - RtmpDmaEnable(pAd, 1); - - } - - // TxStatus : 0 --> task is idle, 1 --> task is running - pAd->ate.TxStatus = 0; - - // Soft reset BBP. - BbpSoftReset(pAd); - - // Disable Tx - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value &= ~(1 << 2); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - } - else if (!strcmp(arg, "RXSTOP")) - { - ATEDBGPRINT(RT_DEBUG_TRACE, ("ATE: RXSTOP\n")); - atemode = pAd->ate.Mode; - pAd->ate.Mode &= ATE_RXSTOP; - pAd->ate.bQARxStart = FALSE; -// pAd->ate.TxDoneCount = pAd->ate.TxCount; - - if (atemode == ATE_TXCARR) - { - ; - } - else if (atemode == ATE_TXCARRSUPP) - { - ; - } - - /* - We should free some resource which was allocated - when ATE_TXFRAME, ATE_STOP, and ATE_TXCONT. - */ - else if ((atemode & ATE_TXFRAME) || (atemode == ATE_STOP)) - { - if (atemode == ATE_TXCONT) - { - ; - } - } - - // Soft reset BBP. - BbpSoftReset(pAd); - - // Disable Rx - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value &= ~(1 << 3); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - } -#endif // RALINK_28xx_QA // - else if (!strcmp(arg, "RXFRAME")) - { - ATEDBGPRINT(RT_DEBUG_TRACE, ("ATE: RXFRAME\n")); - - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R22, BbpData); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, MacData); - - pAd->ate.Mode |= ATE_RXFRAME; - - // Disable Tx of MAC block. - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value &= ~(1 << 2); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - - // Enable Rx of MAC block. - RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); - Value |= (1 << 3); - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - } - else - { - ATEDBGPRINT(RT_DEBUG_TRACE, ("ATE: Invalid arg!\n")); - return FALSE; - } - RTMPusecDelay(5000); - - ATEDBGPRINT(RT_DEBUG_TRACE, ("<=== ATECmdHandler()\n")); - - return TRUE; -} -/*=======================End of RTMP_MAC_PCI =======================*/ -#endif // RTMP_MAC_PCI // - - - - -INT Set_ATE_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - if (ATECmdHandler(pAd, arg)) - { - ATEDBGPRINT(RT_DEBUG_TRACE, ("Ralink: Set_ATE_Proc Success\n")); - - - return TRUE; - } - else - { - ATEDBGPRINT(RT_DEBUG_TRACE, ("Ralink: Set_ATE_Proc Failed\n")); - return FALSE; - } -} - - -/* -========================================================================== - Description: - Set ATE ADDR1=DA for TxFrame(AP : To DS = 0 ; From DS = 1) - or - Set ATE ADDR3=DA for TxFrame(STA : To DS = 1 ; From DS = 0) - - Return: - TRUE if all parameters are OK, FALSE otherwise -========================================================================== -*/ -INT Set_ATE_DA_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - PSTRING value; - INT i; - - // Mac address acceptable format 01:02:03:04:05:06 length 17 - if (strlen(arg) != 17) - return FALSE; - - for (i = 0, value = rstrtok(arg, ":"); value; value = rstrtok(NULL, ":")) - { - /* sanity check */ - if ((strlen(value) != 2) || (!isxdigit(*value)) || (!isxdigit(*(value+1)))) - { - return FALSE; - } - -#ifdef CONFIG_STA_SUPPORT - AtoH(value, &pAd->ate.Addr3[i++], 1); -#endif // CONFIG_STA_SUPPORT // - } - - /* sanity check */ - if (i != 6) - { - return FALSE; - } - -#ifdef CONFIG_STA_SUPPORT - ATEDBGPRINT(RT_DEBUG_TRACE, ("Set_ATE_DA_Proc (DA = %2X:%2X:%2X:%2X:%2X:%2X)\n", pAd->ate.Addr3[0], - pAd->ate.Addr3[1], pAd->ate.Addr3[2], pAd->ate.Addr3[3], pAd->ate.Addr3[4], pAd->ate.Addr3[5])); -#endif // CONFIG_STA_SUPPORT // - - ATEDBGPRINT(RT_DEBUG_TRACE, ("Ralink: Set_ATE_DA_Proc Success\n")); - - return TRUE; -} - - -/* -========================================================================== - Description: - Set ATE ADDR3=SA for TxFrame(AP : To DS = 0 ; From DS = 1) - or - Set ATE ADDR2=SA for TxFrame(STA : To DS = 1 ; From DS = 0) - - Return: - TRUE if all parameters are OK, FALSE otherwise -========================================================================== -*/ -INT Set_ATE_SA_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - PSTRING value; - INT i; - - // Mac address acceptable format 01:02:03:04:05:06 length 17 - if (strlen(arg) != 17) - return FALSE; - - for (i=0, value = rstrtok(arg, ":"); value; value = rstrtok(NULL, ":")) - { - /* sanity check */ - if ((strlen(value) != 2) || (!isxdigit(*value)) || (!isxdigit(*(value+1)))) - { - return FALSE; - } - -#ifdef CONFIG_STA_SUPPORT - AtoH(value, &pAd->ate.Addr2[i++], 1); -#endif // CONFIG_STA_SUPPORT // - } - - /* sanity check */ - if (i != 6) - { - return FALSE; - } - -#ifdef CONFIG_STA_SUPPORT - ATEDBGPRINT(RT_DEBUG_TRACE, ("Set_ATE_SA_Proc (SA = %2X:%2X:%2X:%2X:%2X:%2X)\n", pAd->ate.Addr2[0], - pAd->ate.Addr2[1], pAd->ate.Addr2[2], pAd->ate.Addr2[3], pAd->ate.Addr2[4], pAd->ate.Addr2[5])); -#endif // CONFIG_STA_SUPPORT // - - ATEDBGPRINT(RT_DEBUG_TRACE, ("Ralink: Set_ATE_SA_Proc Success\n")); - - return TRUE; -} - - -/* -========================================================================== - Description: - Set ATE ADDR2=BSSID for TxFrame(AP : To DS = 0 ; From DS = 1) - or - Set ATE ADDR1=BSSID for TxFrame(STA : To DS = 1 ; From DS = 0) - - Return: - TRUE if all parameters are OK, FALSE otherwise -========================================================================== -*/ -INT Set_ATE_BSSID_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - PSTRING value; - INT i; - - // Mac address acceptable format 01:02:03:04:05:06 length 17 - if (strlen(arg) != 17) - return FALSE; - - for (i=0, value = rstrtok(arg, ":"); value; value = rstrtok(NULL, ":")) - { - /* sanity check */ - if ((strlen(value) != 2) || (!isxdigit(*value)) || (!isxdigit(*(value+1)))) - { - return FALSE; - } - -#ifdef CONFIG_STA_SUPPORT - AtoH(value, &pAd->ate.Addr1[i++], 1); -#endif // CONFIG_STA_SUPPORT // - } - - /* sanity check */ - if(i != 6) - { - return FALSE; - } - -#ifdef CONFIG_STA_SUPPORT - ATEDBGPRINT(RT_DEBUG_TRACE, ("Set_ATE_BSSID_Proc (BSSID = %2X:%2X:%2X:%2X:%2X:%2X)\n", pAd->ate.Addr1[0], - pAd->ate.Addr1[1], pAd->ate.Addr1[2], pAd->ate.Addr1[3], pAd->ate.Addr1[4], pAd->ate.Addr1[5])); -#endif // CONFIG_STA_SUPPORT // - - ATEDBGPRINT(RT_DEBUG_TRACE, ("Ralink: Set_ATE_BSSID_Proc Success\n")); - - return TRUE; -} - - -/* -========================================================================== - Description: - Set ATE Tx Channel - - Return: - TRUE if all parameters are OK, FALSE otherwise -========================================================================== -*/ -INT Set_ATE_CHANNEL_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR channel; - - channel = simple_strtol(arg, 0, 10); - - // to allow A band channel : ((channel < 1) || (channel > 14)) - if ((channel < 1) || (channel > 216)) - { - ATEDBGPRINT(RT_DEBUG_ERROR, ("Set_ATE_CHANNEL_Proc::Out of range, it should be in range of 1~14.\n")); - return FALSE; - } - pAd->ate.Channel = channel; - - ATEDBGPRINT(RT_DEBUG_TRACE, ("Set_ATE_CHANNEL_Proc (ATE Channel = %d)\n", pAd->ate.Channel)); - ATEDBGPRINT(RT_DEBUG_TRACE, ("Ralink: Set_ATE_CHANNEL_Proc Success\n")); - - - return TRUE; -} - - -/* -========================================================================== - Description: - Set ATE Tx Power0 - - Return: - TRUE if all parameters are OK, FALSE otherwise -========================================================================== -*/ -INT Set_ATE_TX_POWER0_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - CHAR TxPower; - - TxPower = simple_strtol(arg, 0, 10); - - if (pAd->ate.Channel <= 14) - { - if ((TxPower > 31) || (TxPower < 0)) - { - ATEDBGPRINT(RT_DEBUG_ERROR, ("Set_ATE_TX_POWER0_Proc::Out of range (Value=%d)\n", TxPower)); - return FALSE; - } - } - else/* 5.5 GHz */ - { - if ((TxPower > 15) || (TxPower < -7)) - { - ATEDBGPRINT(RT_DEBUG_ERROR, ("Set_ATE_TX_POWER0_Proc::Out of range (Value=%d)\n", TxPower)); - return FALSE; - } - } - - pAd->ate.TxPower0 = TxPower; - ATETxPwrHandler(pAd, 0); - ATEDBGPRINT(RT_DEBUG_TRACE, ("Ralink: Set_ATE_TX_POWER0_Proc Success\n")); - - - return TRUE; -} - - -/* -========================================================================== - Description: - Set ATE Tx Power1 - - Return: - TRUE if all parameters are OK, FALSE otherwise -========================================================================== -*/ -INT Set_ATE_TX_POWER1_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - CHAR TxPower; - - TxPower = simple_strtol(arg, 0, 10); - - if (pAd->ate.Channel <= 14) - { - if ((TxPower > 31) || (TxPower < 0)) - { - ATEDBGPRINT(RT_DEBUG_ERROR, ("Set_ATE_TX_POWER1_Proc::Out of range (Value=%d)\n", TxPower)); - return FALSE; - } - } - else - { - if ((TxPower > 15) || (TxPower < -7)) - { - ATEDBGPRINT(RT_DEBUG_ERROR, ("Set_ATE_TX_POWER1_Proc::Out of range (Value=%d)\n", TxPower)); - return FALSE; - } - } - - pAd->ate.TxPower1 = TxPower; - ATETxPwrHandler(pAd, 1); - ATEDBGPRINT(RT_DEBUG_TRACE, ("Ralink: Set_ATE_TX_POWER1_Proc Success\n")); - - - return TRUE; -} - - -/* -========================================================================== - Description: - Set ATE Tx Antenna - - Return: - TRUE if all parameters are OK, FALSE otherwise -========================================================================== -*/ -INT Set_ATE_TX_Antenna_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - CHAR value; - - value = simple_strtol(arg, 0, 10); - - if ((value > 2) || (value < 0)) - { - ATEDBGPRINT(RT_DEBUG_ERROR, ("Set_ATE_TX_Antenna_Proc::Out of range (Value=%d)\n", value)); - return FALSE; - } - - pAd->ate.TxAntennaSel = value; - - ATEDBGPRINT(RT_DEBUG_TRACE, ("Set_ATE_TX_Antenna_Proc (Antenna = %d)\n", pAd->ate.TxAntennaSel)); - ATEDBGPRINT(RT_DEBUG_TRACE,("Ralink: Set_ATE_TX_Antenna_Proc Success\n")); - - // calibration power unbalance issues, merged from Arch Team - ATEAsicSwitchChannel(pAd); - - - return TRUE; -} - - -/* -========================================================================== - Description: - Set ATE Rx Antenna - - Return: - TRUE if all parameters are OK, FALSE otherwise -========================================================================== -*/ -INT Set_ATE_RX_Antenna_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - CHAR value; - - value = simple_strtol(arg, 0, 10); - - if ((value > 3) || (value < 0)) - { - ATEDBGPRINT(RT_DEBUG_ERROR, ("Set_ATE_RX_Antenna_Proc::Out of range (Value=%d)\n", value)); - return FALSE; - } - - pAd->ate.RxAntennaSel = value; - - ATEDBGPRINT(RT_DEBUG_TRACE, ("Set_ATE_RX_Antenna_Proc (Antenna = %d)\n", pAd->ate.RxAntennaSel)); - ATEDBGPRINT(RT_DEBUG_TRACE, ("Ralink: Set_ATE_RX_Antenna_Proc Success\n")); - - // calibration power unbalance issues, merged from Arch Team - ATEAsicSwitchChannel(pAd); - - - return TRUE; -} - - -/* -========================================================================== - Description: - Set ATE RF frequence offset - - Return: - TRUE if all parameters are OK, FALSE otherwise -========================================================================== -*/ -INT Set_ATE_TX_FREQOFFSET_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR RFFreqOffset = 0; - ULONG R4 = 0; - - RFFreqOffset = simple_strtol(arg, 0, 10); -#ifndef RTMP_RF_RW_SUPPORT - if (RFFreqOffset >= 64) -#endif // RTMP_RF_RW_SUPPORT // - /* RT35xx ATE will reuse this code segment. */ -#ifdef RTMP_RF_RW_SUPPORT -//2008/08/06: KH modified the limit of offset value from 65 to 95(0x5F) - if (RFFreqOffset >= 95) -#endif // RTMP_RF_RW_SUPPORT // - { - ATEDBGPRINT(RT_DEBUG_ERROR, ("Set_ATE_TX_FREQOFFSET_Proc::Out of range, it should be in range of 0~63.\n")); - return FALSE; - } - - pAd->ate.RFFreqOffset = RFFreqOffset; -#ifdef RTMP_RF_RW_SUPPORT - if (IS_RT30xx(pAd) || IS_RT3572(pAd)) - { - // Set RF offset - UCHAR RFValue; - ATE_RF_IO_READ8_BY_REG_ID(pAd, RF_R23, (PUCHAR)&RFValue); -//2008/08/06: KH modified "pAd->RFFreqOffset" to "pAd->ate.RFFreqOffset" - RFValue = ((RFValue & 0x80) | pAd->ate.RFFreqOffset); - ATE_RF_IO_WRITE8_BY_REG_ID(pAd, RF_R23, (UCHAR)RFValue); - } - else -#endif // RTMP_RF_RW_SUPPORT // - { - // RT28xx - // shift TX power control to correct RF register bit position - R4 = pAd->ate.RFFreqOffset << 15; - R4 |= (pAd->LatchRfRegs.R4 & ((~0x001f8000))); - pAd->LatchRfRegs.R4 = R4; - - RtmpRfIoWrite(pAd); - } - ATEDBGPRINT(RT_DEBUG_TRACE, ("Set_ATE_TX_FREQOFFSET_Proc (RFFreqOffset = %d)\n", pAd->ate.RFFreqOffset)); - ATEDBGPRINT(RT_DEBUG_TRACE, ("Ralink: Set_ATE_TX_FREQOFFSET_Proc Success\n")); - - - return TRUE; -} - - -/* -========================================================================== - Description: - Set ATE RF BW - - Return: - TRUE if all parameters are OK, FALSE otherwise -========================================================================== -*/ -INT Set_ATE_TX_BW_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - INT i; - UCHAR value = 0; - UCHAR BBPCurrentBW; - - BBPCurrentBW = simple_strtol(arg, 0, 10); - - if ((BBPCurrentBW == 0) -#ifdef RT30xx - || IS_RT2070(pAd) -#endif // RT30xx // - ) - { - pAd->ate.TxWI.BW = BW_20; - } - else - { - pAd->ate.TxWI.BW = BW_40; - } - - /* RT35xx ATE will reuse this code segment. */ - // Fix the error spectrum of CCK-40MHZ - // Turn on BBP 20MHz mode by request here. - if ((pAd->ate.TxWI.PHYMODE == MODE_CCK) && (pAd->ate.TxWI.BW == BW_40)) - { - ATEDBGPRINT(RT_DEBUG_ERROR, ("Set_ATE_TX_BW_Proc!! Warning!! CCK only supports 20MHZ!!\nBandwidth switch to 20\n")); - pAd->ate.TxWI.BW = BW_20; - } - - if (pAd->ate.TxWI.BW == BW_20) - { - if (pAd->ate.Channel <= 14) - { - for (i=0; i<5; i++) - { - if (pAd->Tx20MPwrCfgGBand[i] != 0xffffffff) - { - RTMP_IO_WRITE32(pAd, TX_PWR_CFG_0 + i*4, pAd->Tx20MPwrCfgGBand[i]); - RTMPusecDelay(5000); - } - } - } - else - { - for (i=0; i<5; i++) - { - if (pAd->Tx20MPwrCfgABand[i] != 0xffffffff) - { - RTMP_IO_WRITE32(pAd, TX_PWR_CFG_0 + i*4, pAd->Tx20MPwrCfgABand[i]); - RTMPusecDelay(5000); - } - } - } - - // Set BBP R4 bit[4:3]=0:0 - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &value); - value &= (~0x18); - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, value); - - - // Set BBP R66=0x3C - value = 0x3C; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, value); - - // Set BBP R68=0x0B - // to improve Rx sensitivity. - value = 0x0B; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R68, value); - // Set BBP R69=0x16 - value = 0x16; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, value); - // Set BBP R70=0x08 - value = 0x08; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, value); - // Set BBP R73=0x11 - value = 0x11; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, value); - - /* - If Channel=14, Bandwidth=20M and Mode=CCK, Set BBP R4 bit5=1 - (to set Japan filter coefficients). - This segment of code will only works when ATETXMODE and ATECHANNEL - were set to MODE_CCK and 14 respectively before ATETXBW is set to 0. - */ - if (pAd->ate.Channel == 14) - { - INT TxMode = pAd->ate.TxWI.PHYMODE; - - if (TxMode == MODE_CCK) - { - // when Channel==14 && Mode==CCK && BandWidth==20M, BBP R4 bit5=1 - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &value); - value |= 0x20; //set bit5=1 - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, value); - } - } - -#ifdef RT30xx - // set BW = 20 MHz - if (IS_RT30xx(pAd)) - ATE_RF_IO_WRITE8_BY_REG_ID(pAd, RF_R24, (UCHAR) pAd->Mlme.CaliBW20RfR24); - else -#endif // RT30xx // - // set BW = 20 MHz - { - pAd->LatchRfRegs.R4 &= ~0x00200000; - RtmpRfIoWrite(pAd); - } - - } - // If bandwidth = 40M, set RF Reg4 bit 21 = 0. - else if (pAd->ate.TxWI.BW == BW_40) - { - if (pAd->ate.Channel <= 14) - { - for (i=0; i<5; i++) - { - if (pAd->Tx40MPwrCfgGBand[i] != 0xffffffff) - { - RTMP_IO_WRITE32(pAd, TX_PWR_CFG_0 + i*4, pAd->Tx40MPwrCfgGBand[i]); - RTMPusecDelay(5000); - } - } - } - else - { - for (i=0; i<5; i++) - { - if (pAd->Tx40MPwrCfgABand[i] != 0xffffffff) - { - RTMP_IO_WRITE32(pAd, TX_PWR_CFG_0 + i*4, pAd->Tx40MPwrCfgABand[i]); - RTMPusecDelay(5000); - } - } -#ifdef DOT11_N_SUPPORT - if ((pAd->ate.TxWI.PHYMODE >= MODE_HTMIX) && (pAd->ate.TxWI.MCS == 7)) - { - value = 0x28; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R67, value); - } -#endif // DOT11_N_SUPPORT // - } - - // Set BBP R4 bit[4:3]=1:0 - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &value); - value &= (~0x18); - value |= 0x10; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, value); - - - // Set BBP R66=0x3C - value = 0x3C; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, value); - - // Set BBP R68=0x0C - // to improve Rx sensitivity - value = 0x0C; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R68, value); - // Set BBP R69=0x1A - value = 0x1A; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, value); - // Set BBP R70=0x0A - value = 0x0A; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, value); - // Set BBP R73=0x16 - value = 0x16; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, value); - - // If bandwidth = 40M, set RF Reg4 bit 21 = 1. -#ifdef RT30xx - // set BW = 40 MHz - if(IS_RT30xx(pAd)) - ATE_RF_IO_WRITE8_BY_REG_ID(pAd, RF_R24, (UCHAR) pAd->Mlme.CaliBW40RfR24); - else -#endif // RT30xx // - // set BW = 40 MHz - { - pAd->LatchRfRegs.R4 |= 0x00200000; - RtmpRfIoWrite(pAd); - } - } - - ATEDBGPRINT(RT_DEBUG_TRACE, ("Set_ATE_TX_BW_Proc (BBPCurrentBW = %d)\n", pAd->ate.TxWI.BW)); - ATEDBGPRINT(RT_DEBUG_TRACE, ("Ralink: Set_ATE_TX_BW_Proc Success\n")); - - - return TRUE; -} - - -/* -========================================================================== - Description: - Set ATE Tx frame length - - Return: - TRUE if all parameters are OK, FALSE otherwise -========================================================================== -*/ -INT Set_ATE_TX_LENGTH_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - pAd->ate.TxLength = simple_strtol(arg, 0, 10); - - if ((pAd->ate.TxLength < 24) || (pAd->ate.TxLength > (MAX_FRAME_SIZE - 34/* == 2312 */))) - { - pAd->ate.TxLength = (MAX_FRAME_SIZE - 34/* == 2312 */); - ATEDBGPRINT(RT_DEBUG_ERROR, ("Set_ATE_TX_LENGTH_Proc::Out of range, it should be in range of 24~%d.\n", (MAX_FRAME_SIZE - 34/* == 2312 */))); - return FALSE; - } - - ATEDBGPRINT(RT_DEBUG_TRACE, ("Set_ATE_TX_LENGTH_Proc (TxLength = %d)\n", pAd->ate.TxLength)); - ATEDBGPRINT(RT_DEBUG_TRACE, ("Ralink: Set_ATE_TX_LENGTH_Proc Success\n")); - - - return TRUE; -} - - -/* -========================================================================== - Description: - Set ATE Tx frame count - - Return: - TRUE if all parameters are OK, FALSE otherwise -========================================================================== -*/ -INT Set_ATE_TX_COUNT_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - pAd->ate.TxCount = simple_strtol(arg, 0, 10); - - ATEDBGPRINT(RT_DEBUG_TRACE, ("Set_ATE_TX_COUNT_Proc (TxCount = %d)\n", pAd->ate.TxCount)); - ATEDBGPRINT(RT_DEBUG_TRACE, ("Ralink: Set_ATE_TX_COUNT_Proc Success\n")); - - - return TRUE; -} - - -/* -========================================================================== - Description: - Set ATE Tx frame MCS - - Return: - TRUE if all parameters are OK, FALSE otherwise -========================================================================== -*/ -INT Set_ATE_TX_MCS_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR MCS; - INT result; - - MCS = simple_strtol(arg, 0, 10); -#ifndef RT30xx - result = CheckMCSValid(pAd->ate.TxWI.PHYMODE, MCS); -#endif // RT30xx // - - /* RT35xx ATE will reuse this code segment. */ -#ifdef RT30xx - result = CheckMCSValid(pAd->ate.TxWI.PHYMODE, MCS, IS_RT2070(pAd)); -#endif // RT30xx // - - - if (result != -1) - { - pAd->ate.TxWI.MCS = (UCHAR)MCS; - } - else - { - ATEDBGPRINT(RT_DEBUG_ERROR, ("Set_ATE_TX_MCS_Proc::Out of range, refer to rate table.\n")); - return FALSE; - } - - ATEDBGPRINT(RT_DEBUG_TRACE, ("Set_ATE_TX_MCS_Proc (MCS = %d)\n", pAd->ate.TxWI.MCS)); - ATEDBGPRINT(RT_DEBUG_TRACE, ("Ralink: Set_ATE_TX_MCS_Proc Success\n")); - - - return TRUE; -} - - -/* -========================================================================== - Description: - Set ATE Tx frame Mode - 0: MODE_CCK - 1: MODE_OFDM - 2: MODE_HTMIX - 3: MODE_HTGREENFIELD - - Return: - TRUE if all parameters are OK, FALSE otherwise -========================================================================== -*/ -INT Set_ATE_TX_MODE_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR BbpData = 0; - - pAd->ate.TxWI.PHYMODE = simple_strtol(arg, 0, 10); - - if (pAd->ate.TxWI.PHYMODE > 3) - { - pAd->ate.TxWI.PHYMODE = 0; - ATEDBGPRINT(RT_DEBUG_ERROR, ("Set_ATE_TX_MODE_Proc::Out of range.\nIt should be in range of 0~3\n")); - ATEDBGPRINT(RT_DEBUG_ERROR, ("0: CCK, 1: OFDM, 2: HT_MIX, 3: HT_GREEN_FIELD.\n")); - return FALSE; - } - - // Turn on BBP 20MHz mode by request here. - if (pAd->ate.TxWI.PHYMODE == MODE_CCK) - { - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BbpData); - BbpData &= (~0x18); - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BbpData); - pAd->ate.TxWI.BW = BW_20; - ATEDBGPRINT(RT_DEBUG_ERROR, ("Set_ATE_TX_MODE_Proc::CCK Only support 20MHZ. Switch to 20MHZ.\n")); - } - - ATEDBGPRINT(RT_DEBUG_TRACE, ("Set_ATE_TX_MODE_Proc (TxMode = %d)\n", pAd->ate.TxWI.PHYMODE)); - ATEDBGPRINT(RT_DEBUG_TRACE, ("Ralink: Set_ATE_TX_MODE_Proc Success\n")); - - - return TRUE; -} - - -/* -========================================================================== - Description: - Set ATE Tx frame GI - - Return: - TRUE if all parameters are OK, FALSE otherwise -========================================================================== -*/ -INT Set_ATE_TX_GI_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - pAd->ate.TxWI.ShortGI = simple_strtol(arg, 0, 10); - - if (pAd->ate.TxWI.ShortGI > 1) - { - pAd->ate.TxWI.ShortGI = 0; - ATEDBGPRINT(RT_DEBUG_ERROR, ("Set_ATE_TX_GI_Proc::Out of range\n")); - return FALSE; - } - - ATEDBGPRINT(RT_DEBUG_TRACE, ("Set_ATE_TX_GI_Proc (GI = %d)\n", pAd->ate.TxWI.ShortGI)); - ATEDBGPRINT(RT_DEBUG_TRACE, ("Ralink: Set_ATE_TX_GI_Proc Success\n")); - - - return TRUE; -} - - -INT Set_ATE_RX_FER_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - pAd->ate.bRxFER = simple_strtol(arg, 0, 10); - - if (pAd->ate.bRxFER == 1) - { - pAd->ate.RxCntPerSec = 0; - pAd->ate.RxTotalCnt = 0; - } - - ATEDBGPRINT(RT_DEBUG_TRACE, ("Set_ATE_RX_FER_Proc (bRxFER = %d)\n", pAd->ate.bRxFER)); - ATEDBGPRINT(RT_DEBUG_TRACE, ("Ralink: Set_ATE_RX_FER_Proc Success\n")); - - - return TRUE; -} - - -INT Set_ATE_Read_RF_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ -#ifdef RTMP_RF_RW_SUPPORT -//2008/07/10:KH add to support RT30xx ATE<-- - if (IS_RT30xx(pAd) || IS_RT3572(pAd)) - { - /* modify by WY for Read RF Reg. error */ - UCHAR RFValue; - INT index=0; - - for (index = 0; index < 32; index++) - { - ATE_RF_IO_READ8_BY_REG_ID(pAd, index, (PUCHAR)&RFValue); - ate_print("R%d=%d\n",index,RFValue); - } - } - else -//2008/07/10:KH add to support RT30xx ATE--> -#endif // RTMP_RF_RW_SUPPORT // - { - ate_print(KERN_EMERG "R1 = %lx\n", pAd->LatchRfRegs.R1); - ate_print(KERN_EMERG "R2 = %lx\n", pAd->LatchRfRegs.R2); - ate_print(KERN_EMERG "R3 = %lx\n", pAd->LatchRfRegs.R3); - ate_print(KERN_EMERG "R4 = %lx\n", pAd->LatchRfRegs.R4); - } - return TRUE; -} - - -INT Set_ATE_Write_RF1_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UINT32 value = (UINT32) simple_strtol(arg, 0, 16); - -#ifdef RTMP_RF_RW_SUPPORT -//2008/07/10:KH add to support 3070 ATE<-- - if (IS_RT30xx(pAd) || IS_RT3572(pAd)) - { - ate_print("Warning!! RT3xxx Don't Support !\n"); - return FALSE; - - } - else -//2008/07/10:KH add to support 3070 ATE--> -#endif // RTMP_RF_RW_SUPPORT // - { - pAd->LatchRfRegs.R1 = value; - RtmpRfIoWrite(pAd); - } - return TRUE; -} - - -INT Set_ATE_Write_RF2_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UINT32 value = (UINT32) simple_strtol(arg, 0, 16); - -#ifdef RTMP_RF_RW_SUPPORT -//2008/07/10:KH add to support 3070 ATE<-- - if (IS_RT30xx(pAd) || IS_RT3572(pAd)) - { - ate_print("Warning!! RT3xxx Don't Support !\n"); - return FALSE; - - } - else -//2008/07/10:KH add to support 3070 ATE--> -#endif // RTMP_RF_RW_SUPPORT // - { - pAd->LatchRfRegs.R2 = value; - RtmpRfIoWrite(pAd); - } - return TRUE; -} - - -INT Set_ATE_Write_RF3_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UINT32 value = simple_strtol(arg, 0, 16); - -#ifdef RTMP_RF_RW_SUPPORT -//2008/07/10:KH add to support 3070 ATE<-- - if (IS_RT30xx(pAd) || IS_RT3572(pAd)) - { - ate_print("Warning!! RT3xxx Don't Support !\n"); - return FALSE; - - } - else -//2008/07/10:KH add to support 3070 ATE--> -#endif // RTMP_RF_RW_SUPPORT // - { - pAd->LatchRfRegs.R3 = value; - RtmpRfIoWrite(pAd); - } - return TRUE; -} - - -INT Set_ATE_Write_RF4_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UINT32 value = (UINT32) simple_strtol(arg, 0, 16); - -#ifdef RTMP_RF_RW_SUPPORT -//2008/07/10:KH add to support 3070 ATE<-- - if (IS_RT30xx(pAd) || IS_RT3572(pAd)) - { - ate_print("Warning!! RT3xxx Don't Support !\n"); - return FALSE; - - } - else -//2008/07/10:KH add to support 3070 ATE--> -#endif // RTMP_RF_RW_SUPPORT // - { - pAd->LatchRfRegs.R4 = value; - RtmpRfIoWrite(pAd); - } - return TRUE; -} - - -/* -========================================================================== - Description: - Load and Write EEPROM from a binary file prepared in advance. - - Return: - TRUE if all parameters are OK, FALSE otherwise -========================================================================== -*/ -#if defined(LINUX) || defined(VXWORKS) -INT Set_ATE_Load_E2P_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - BOOLEAN ret = FALSE; - PSTRING src = EEPROM_BIN_FILE_NAME; - RTMP_OS_FD srcf; - INT32 retval; - USHORT WriteEEPROM[(EEPROM_SIZE/2)]; - INT FileLength = 0; - UINT32 value = (UINT32) simple_strtol(arg, 0, 10); - RTMP_OS_FS_INFO osFSInfo; - - ATEDBGPRINT(RT_DEBUG_ERROR, ("===> %s (value=%d)\n\n", __FUNCTION__, value)); - - if (value > 0) - { - /* zero the e2p buffer */ - NdisZeroMemory((PUCHAR)WriteEEPROM, EEPROM_SIZE); - - RtmpOSFSInfoChange(&osFSInfo, TRUE); - - do - { - /* open the bin file */ - srcf = RtmpOSFileOpen(src, O_RDONLY, 0); - - if (IS_FILE_OPEN_ERR(srcf)) - { - ate_print("%s - Error opening file %s\n", __FUNCTION__, src); - break; - } - - /* read the firmware from the file *.bin */ - FileLength = RtmpOSFileRead(srcf, (PSTRING)WriteEEPROM, EEPROM_SIZE); - - if (FileLength != EEPROM_SIZE) - { - ate_print("%s: error file length (=%d) in e2p.bin\n", - __FUNCTION__, FileLength); - break; - } - else - { - /* write the content of .bin file to EEPROM */ - rt_ee_write_all(pAd, WriteEEPROM); - ret = TRUE; - } - break; - } while(TRUE); - - /* close firmware file */ - if (IS_FILE_OPEN_ERR(srcf)) - { - ; - } - else - { - retval = RtmpOSFileClose(srcf); - - if (retval) - { - ATEDBGPRINT(RT_DEBUG_ERROR, ("--> Error %d closing %s\n", -retval, src)); - - } - } - - /* restore */ - RtmpOSFSInfoChange(&osFSInfo, FALSE); - } - - ATEDBGPRINT(RT_DEBUG_ERROR, ("<=== %s (ret=%d)\n", __FUNCTION__, ret)); - - return ret; - -} -#endif // defined(LINUX) || defined(VXWORKS) // - - - - -INT Set_ATE_Read_E2P_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - USHORT buffer[EEPROM_SIZE/2]; - USHORT *p; - int i; - - rt_ee_read_all(pAd, (USHORT *)buffer); - p = buffer; - for (i = 0; i < (EEPROM_SIZE/2); i++) - { - ate_print("%4.4x ", *p); - if (((i+1) % 16) == 0) - ate_print("\n"); - p++; - } - return TRUE; -} - - - - -INT Set_ATE_Show_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ate_print("Mode=%d\n", pAd->ate.Mode); - ate_print("TxPower0=%d\n", pAd->ate.TxPower0); - ate_print("TxPower1=%d\n", pAd->ate.TxPower1); - ate_print("TxAntennaSel=%d\n", pAd->ate.TxAntennaSel); - ate_print("RxAntennaSel=%d\n", pAd->ate.RxAntennaSel); - ate_print("BBPCurrentBW=%d\n", pAd->ate.TxWI.BW); - ate_print("GI=%d\n", pAd->ate.TxWI.ShortGI); - ate_print("MCS=%d\n", pAd->ate.TxWI.MCS); - ate_print("TxMode=%d\n", pAd->ate.TxWI.PHYMODE); - ate_print("Addr1=%02x:%02x:%02x:%02x:%02x:%02x\n", - pAd->ate.Addr1[0], pAd->ate.Addr1[1], pAd->ate.Addr1[2], pAd->ate.Addr1[3], pAd->ate.Addr1[4], pAd->ate.Addr1[5]); - ate_print("Addr2=%02x:%02x:%02x:%02x:%02x:%02x\n", - pAd->ate.Addr2[0], pAd->ate.Addr2[1], pAd->ate.Addr2[2], pAd->ate.Addr2[3], pAd->ate.Addr2[4], pAd->ate.Addr2[5]); - ate_print("Addr3=%02x:%02x:%02x:%02x:%02x:%02x\n", - pAd->ate.Addr3[0], pAd->ate.Addr3[1], pAd->ate.Addr3[2], pAd->ate.Addr3[3], pAd->ate.Addr3[4], pAd->ate.Addr3[5]); - ate_print("Channel=%d\n", pAd->ate.Channel); - ate_print("TxLength=%d\n", pAd->ate.TxLength); - ate_print("TxCount=%u\n", pAd->ate.TxCount); - ate_print("RFFreqOffset=%d\n", pAd->ate.RFFreqOffset); - ate_print(KERN_EMERG "Set_ATE_Show_Proc Success\n"); - return TRUE; -} - - -INT Set_ATE_Help_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ate_print("ATE=ATESTART, ATESTOP, TXCONT, TXCARR, TXFRAME, RXFRAME\n"); - ate_print("ATEDA\n"); - ate_print("ATESA\n"); - ate_print("ATEBSSID\n"); - ate_print("ATECHANNEL, range:0~14(unless A band !)\n"); - ate_print("ATETXPOW0, set power level of antenna 1.\n"); - ate_print("ATETXPOW1, set power level of antenna 2.\n"); - ate_print("ATETXANT, set TX antenna. 0:all, 1:antenna one, 2:antenna two.\n"); - ate_print("ATERXANT, set RX antenna.0:all, 1:antenna one, 2:antenna two, 3:antenna three.\n"); - ate_print("ATETXFREQOFFSET, set frequency offset, range 0~63\n"); - ate_print("ATETXBW, set BandWidth, 0:20MHz, 1:40MHz.\n"); - ate_print("ATETXLEN, set Frame length, range 24~%d\n", (MAX_FRAME_SIZE - 34/* == 2312 */)); - ate_print("ATETXCNT, set how many frame going to transmit.\n"); - ate_print("ATETXMCS, set MCS, reference to rate table.\n"); - ate_print("ATETXMODE, set Mode 0:CCK, 1:OFDM, 2:HT-Mix, 3:GreenField, reference to rate table.\n"); - ate_print("ATETXGI, set GI interval, 0:Long, 1:Short\n"); - ate_print("ATERXFER, 0:disable Rx Frame error rate. 1:enable Rx Frame error rate.\n"); - ate_print("ATERRF, show all RF registers.\n"); - ate_print("ATEWRF1, set RF1 register.\n"); - ate_print("ATEWRF2, set RF2 register.\n"); - ate_print("ATEWRF3, set RF3 register.\n"); - ate_print("ATEWRF4, set RF4 register.\n"); - ate_print("ATELDE2P, load EEPROM from .bin file.\n"); - ate_print("ATERE2P, display all EEPROM content.\n"); - ate_print("ATESHOW, display all parameters of ATE.\n"); - ate_print("ATEHELP, online help.\n"); - - return TRUE; -} - - - - -/* -========================================================================== - Description: - - AsicSwitchChannel() dedicated for ATE. - -========================================================================== -*/ -VOID ATEAsicSwitchChannel( - IN PRTMP_ADAPTER pAd) -{ - UINT32 R2 = 0, R3 = DEFAULT_RF_TX_POWER, R4 = 0, Value = 0; - CHAR TxPwer = 0, TxPwer2 = 0; - UCHAR index = 0, BbpValue = 0, R66 = 0x30; - RTMP_RF_REGS *RFRegTable; - UCHAR Channel = 0; - - RFRegTable = NULL; - -#ifdef RALINK_28xx_QA - // for QA mode, TX power values are passed from UI - if ((pAd->ate.bQATxStart == TRUE) || (pAd->ate.bQARxStart == TRUE)) - { - if (pAd->ate.Channel != pAd->LatchRfRegs.Channel) - { - pAd->ate.Channel = pAd->LatchRfRegs.Channel; - } - return; - } - else -#endif // RALINK_28xx_QA // - Channel = pAd->ate.Channel; - - // select antenna for RT3090 - AsicAntennaSelect(pAd, Channel); - - // fill Tx power value - TxPwer = pAd->ate.TxPower0; - TxPwer2 = pAd->ate.TxPower1; -#ifdef RT30xx -//2008/07/10:KH add to support 3070 ATE<-- - - /* - The RF programming sequence is difference between 3xxx and 2xxx. - The 3070 is 1T1R. Therefore, we don't need to set the number of Tx/Rx path - and the only job is to set the parameters of channels. - */ - if (IS_RT30xx(pAd) && ((pAd->RfIcType == RFIC_3020) || - (pAd->RfIcType == RFIC_3021) || (pAd->RfIcType == RFIC_3022) || - (pAd->RfIcType == RFIC_2020))) - { - /* modify by WY for Read RF Reg. error */ - UCHAR RFValue = 0; - - for (index = 0; index < NUM_OF_3020_CHNL; index++) - { - if (Channel == FreqItems3020[index].Channel) - { - // Programming channel parameters. - ATE_RF_IO_WRITE8_BY_REG_ID(pAd, RF_R02, FreqItems3020[index].N); - ATE_RF_IO_WRITE8_BY_REG_ID(pAd, RF_R03, FreqItems3020[index].K); - - ATE_RF_IO_READ8_BY_REG_ID(pAd, RF_R06, (PUCHAR)&RFValue); - RFValue = (RFValue & 0xFC) | FreqItems3020[index].R; - ATE_RF_IO_WRITE8_BY_REG_ID(pAd, RF_R06, (UCHAR)RFValue); - - // Set Tx Power. - ATE_RF_IO_READ8_BY_REG_ID(pAd, RF_R12, (PUCHAR)&RFValue); - RFValue = (RFValue & 0xE0) | TxPwer; - ATE_RF_IO_WRITE8_BY_REG_ID(pAd, RF_R12, (UCHAR)RFValue); - - // Set RF offset. - ATE_RF_IO_READ8_BY_REG_ID(pAd, RF_R23, (PUCHAR)&RFValue); - //2008/08/06: KH modified "pAd->RFFreqOffset" to "pAd->ate.RFFreqOffset" - RFValue = (RFValue & 0x80) | pAd->ate.RFFreqOffset; - ATE_RF_IO_WRITE8_BY_REG_ID(pAd, RF_R23, (UCHAR)RFValue); - - // Set BW. - if (pAd->ate.TxWI.BW == BW_40) - { - RFValue = pAd->Mlme.CaliBW40RfR24; -// DISABLE_11N_CHECK(pAd); - } - else - { - RFValue = pAd->Mlme.CaliBW20RfR24; - } - ATE_RF_IO_WRITE8_BY_REG_ID(pAd, RF_R24, (UCHAR)RFValue); - - // Enable RF tuning - ATE_RF_IO_READ8_BY_REG_ID(pAd, RF_R07, (PUCHAR)&RFValue); - RFValue = RFValue | 0x1; - ATE_RF_IO_WRITE8_BY_REG_ID(pAd, RF_R07, (UCHAR)RFValue); - - // latch channel for future usage - pAd->LatchRfRegs.Channel = Channel; - - break; - } - } - - ATEDBGPRINT(RT_DEBUG_TRACE, ("SwitchChannel#%d(RF=%d, Pwr0=%d, Pwr1=%d, %dT), N=0x%02X, K=0x%02X, R=0x%02X\n", - Channel, - pAd->RfIcType, - TxPwer, - TxPwer2, - pAd->Antenna.field.TxPath, - FreqItems3020[index].N, - FreqItems3020[index].K, - FreqItems3020[index].R)); - } - else -//2008/07/10:KH add to support 3070 ATE--> -#endif // RT30xx // - { - /* RT28xx */ - RFRegTable = RF2850RegTable; - - switch (pAd->RfIcType) - { - /* But only 2850 and 2750 support 5.5GHz band... */ - case RFIC_2820: - case RFIC_2850: - case RFIC_2720: - case RFIC_2750: - - for (index = 0; index < NUM_OF_2850_CHNL; index++) - { - if (Channel == RFRegTable[index].Channel) - { - R2 = RFRegTable[index].R2; - - // If TX path is 1, bit 14 = 1; - if (pAd->Antenna.field.TxPath == 1) - { - R2 |= 0x4000; - } - - if (pAd->Antenna.field.RxPath == 2) - { - switch (pAd->ate.RxAntennaSel) - { - case 1: - R2 |= 0x20040; - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BbpValue); - BbpValue &= 0xE4; - BbpValue |= 0x00; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BbpValue); - break; - case 2: - R2 |= 0x10040; - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BbpValue); - BbpValue &= 0xE4; - BbpValue |= 0x01; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BbpValue); - break; - default: - R2 |= 0x40; - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BbpValue); - BbpValue &= 0xE4; - /* Only enable two Antenna to receive. */ - BbpValue |= 0x08; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BbpValue); - break; - } - } - else if (pAd->Antenna.field.RxPath == 1) - { - // write 1 to off RxPath - R2 |= 0x20040; - } - - if (pAd->Antenna.field.TxPath == 2) - { - if (pAd->ate.TxAntennaSel == 1) - { - // If TX Antenna select is 1 , bit 14 = 1; Disable Ant 2 - R2 |= 0x4000; - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &BbpValue); - BbpValue &= 0xE7; // 11100111B - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R1, BbpValue); - } - else if (pAd->ate.TxAntennaSel == 2) - { - // If TX Antenna select is 2 , bit 15 = 1; Disable Ant 1 - R2 |= 0x8000; - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &BbpValue); - BbpValue &= 0xE7; - BbpValue |= 0x08; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R1, BbpValue); - } - else - { - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &BbpValue); - BbpValue &= 0xE7; - BbpValue |= 0x10; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R1, BbpValue); - } - } - if (pAd->Antenna.field.RxPath == 3) - { - switch (pAd->ate.RxAntennaSel) - { - case 1: - R2 |= 0x20040; - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BbpValue); - BbpValue &= 0xE4; - BbpValue |= 0x00; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BbpValue); - break; - case 2: - R2 |= 0x10040; - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BbpValue); - BbpValue &= 0xE4; - BbpValue |= 0x01; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BbpValue); - break; - case 3: - R2 |= 0x30000; - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BbpValue); - BbpValue &= 0xE4; - BbpValue |= 0x02; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BbpValue); - break; - default: - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BbpValue); - BbpValue &= 0xE4; - BbpValue |= 0x10; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BbpValue); - break; - } - } - - if (Channel > 14) - { - // initialize R3, R4 - R3 = (RFRegTable[index].R3 & 0xffffc1ff); - R4 = (RFRegTable[index].R4 & (~0x001f87c0)) | (pAd->ate.RFFreqOffset << 15); - - /* - According the Rory's suggestion to solve the middle range issue. - - 5.5G band power range : 0xF9~0X0F, TX0 Reg3 bit9/TX1 Reg4 bit6="0" - means the TX power reduce 7dB. - */ - // R3 - if ((TxPwer >= -7) && (TxPwer < 0)) - { - TxPwer = (7+TxPwer); - TxPwer = (TxPwer > 0xF) ? (0xF) : (TxPwer); - R3 |= (TxPwer << 10); - ATEDBGPRINT(RT_DEBUG_TRACE, ("ATEAsicSwitchChannel: TxPwer=%d \n", TxPwer)); - } - else - { - TxPwer = (TxPwer > 0xF) ? (0xF) : (TxPwer); - R3 |= (TxPwer << 10) | (1 << 9); - } - - // R4 - if ((TxPwer2 >= -7) && (TxPwer2 < 0)) - { - TxPwer2 = (7+TxPwer2); - TxPwer2 = (TxPwer2 > 0xF) ? (0xF) : (TxPwer2); - R4 |= (TxPwer2 << 7); - ATEDBGPRINT(RT_DEBUG_TRACE, ("ATEAsicSwitchChannel: TxPwer2=%d \n", TxPwer2)); - } - else - { - TxPwer2 = (TxPwer2 > 0xF) ? (0xF) : (TxPwer2); - R4 |= (TxPwer2 << 7) | (1 << 6); - } - } - else - { - // Set TX power0. - R3 = (RFRegTable[index].R3 & 0xffffc1ff) | (TxPwer << 9); - // Set frequency offset and TX power1. - R4 = (RFRegTable[index].R4 & (~0x001f87c0)) | (pAd->ate.RFFreqOffset << 15) | (TxPwer2 <<6); - } - - // based on BBP current mode before changing RF channel - if (pAd->ate.TxWI.BW == BW_40) - { - R4 |=0x200000; - } - - // Update variables. - pAd->LatchRfRegs.Channel = Channel; - pAd->LatchRfRegs.R1 = RFRegTable[index].R1; - pAd->LatchRfRegs.R2 = R2; - pAd->LatchRfRegs.R3 = R3; - pAd->LatchRfRegs.R4 = R4; - - RtmpRfIoWrite(pAd); - - break; - } - } - break; - - default: - break; - } - } - - // Change BBP setting during switch from a->g, g->a - if (Channel <= 14) - { - UINT32 TxPinCfg = 0x00050F0A;// 2007.10.09 by Brian : 0x0005050A ==> 0x00050F0A - - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R62, (0x37 - GET_LNA_GAIN(pAd))); - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R63, (0x37 - GET_LNA_GAIN(pAd))); - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R64, (0x37 - GET_LNA_GAIN(pAd))); - - /* For 1T/2R chip only... */ - if (pAd->NicConfig2.field.ExternalLNAForG) - { - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0x62); - } - else - { - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0x84); - } - - // According the Rory's suggestion to solve the middle range issue. - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R86, &BbpValue);// may be removed for RT35xx ++ - - ASSERT((BbpValue == 0x00)); - if ((BbpValue != 0x00)) - { - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R86, 0x00); - }// may be removed for RT35xx -- - - // 5.5 GHz band selection PIN, bit1 and bit2 are complement - RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value); - Value &= (~0x6); - Value |= (0x04); - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); - - // Turn off unused PA or LNA when only 1T or 1R. - if (pAd->Antenna.field.TxPath == 1) - { - TxPinCfg &= 0xFFFFFFF3; - } - if (pAd->Antenna.field.RxPath == 1) - { - TxPinCfg &= 0xFFFFF3FF; - } - - // calibration power unbalance issues - if (pAd->Antenna.field.TxPath == 2) - { - if (pAd->ate.TxAntennaSel == 1) - { - TxPinCfg &= 0xFFFFFFF7; - } - else if (pAd->ate.TxAntennaSel == 2) - { - TxPinCfg &= 0xFFFFFFFD; - } - } - - RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg); - } - else - { - UINT32 TxPinCfg = 0x00050F05;// 2007.10.09 by Brian : 0x00050505 ==> 0x00050F05 - - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R62, (0x37 - GET_LNA_GAIN(pAd))); - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R63, (0x37 - GET_LNA_GAIN(pAd))); - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R64, (0x37 - GET_LNA_GAIN(pAd))); - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0xF2); - - // According the Rory's suggestion to solve the middle range issue. - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R86, &BbpValue);// may be removed for RT35xx ++ - - ASSERT((BbpValue == 0x00)); - if ((BbpValue != 0x00)) - { - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R86, 0x00); - } - - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R91, &BbpValue); - ASSERT((BbpValue == 0x04)); - - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R92, &BbpValue); - ASSERT((BbpValue == 0x00));// may be removed for RT35xx -- - - // 5.5 GHz band selection PIN, bit1 and bit2 are complement - RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value); - Value &= (~0x6); - Value |= (0x02); - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); - - // Turn off unused PA or LNA when only 1T or 1R. - if (pAd->Antenna.field.TxPath == 1) - { - TxPinCfg &= 0xFFFFFFF3; - } - if (pAd->Antenna.field.RxPath == 1) - { - TxPinCfg &= 0xFFFFF3FF; - } - - RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg); - } - - - // R66 should be set according to Channel and use 20MHz when scanning - if (Channel <= 14) - { - // BG band - R66 = 0x2E + GET_LNA_GAIN(pAd); - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); - } - else - { - // 5.5 GHz band - if (pAd->ate.TxWI.BW == BW_20) - { - R66 = (UCHAR)(0x32 + (GET_LNA_GAIN(pAd)*5)/3); - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); - } - else - { - R66 = (UCHAR)(0x3A + (GET_LNA_GAIN(pAd)*5)/3); - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); - } - } - - /* - On 11A, We should delay and wait RF/BBP to be stable - and the appropriate time should be 1000 micro seconds. - - 2005/06/05 - On 11G, We also need this delay time. Otherwise it's difficult to pass the WHQL. - */ - RTMPusecDelay(1000); - -#ifndef RTMP_RF_RW_SUPPORT - if (Channel > 14) - { - // When 5.5GHz band the LSB of TxPwr will be used to reduced 7dB or not. - ATEDBGPRINT(RT_DEBUG_TRACE, ("SwitchChannel#%d(RF=%d, %dT) to , R1=0x%08lx, R2=0x%08lx, R3=0x%08lx, R4=0x%08lx\n", - Channel, - pAd->RfIcType, - pAd->Antenna.field.TxPath, - pAd->LatchRfRegs.R1, - pAd->LatchRfRegs.R2, - pAd->LatchRfRegs.R3, - pAd->LatchRfRegs.R4)); - } - else - { - ATEDBGPRINT(RT_DEBUG_TRACE, ("SwitchChannel#%d(RF=%d, Pwr0=%u, Pwr1=%u, %dT) to , R1=0x%08lx, R2=0x%08lx, R3=0x%08lx, R4=0x%08lx\n", - Channel, - pAd->RfIcType, - (R3 & 0x00003e00) >> 9, - (R4 & 0x000007c0) >> 6, - pAd->Antenna.field.TxPath, - pAd->LatchRfRegs.R1, - pAd->LatchRfRegs.R2, - pAd->LatchRfRegs.R3, - pAd->LatchRfRegs.R4)); - } -#endif // RTMP_RF_RW_SUPPORT // -} - - - -/* In fact, no one will call this routine so far ! */ - -/* -========================================================================== - Description: - Gives CCK TX rate 2 more dB TX power. - This routine works only in ATE mode. - - calculate desired Tx power in RF R3.Tx0~5, should consider - - 0. if current radio is a noisy environment (pAd->DrsCounters.fNoisyEnvironment) - 1. TxPowerPercentage - 2. auto calibration based on TSSI feedback - 3. extra 2 db for CCK - 4. -10 db upon very-short distance (AvgRSSI >= -40db) to AP - - NOTE: Since this routine requires the value of (pAd->DrsCounters.fNoisyEnvironment), - it should be called AFTER MlmeDynamicTxRateSwitching() -========================================================================== -*/ -VOID ATEAsicAdjustTxPower( - IN PRTMP_ADAPTER pAd) -{ - INT i, j; - CHAR DeltaPwr = 0; - BOOLEAN bAutoTxAgc = FALSE; - UCHAR TssiRef, *pTssiMinusBoundary, *pTssiPlusBoundary, TxAgcStep; - UCHAR BbpR49 = 0, idx; - PCHAR pTxAgcCompensate; - ULONG TxPwr[5]; - CHAR Value; - - /* no one calls this procedure so far */ - if (pAd->ate.TxWI.BW == BW_40) - { - if (pAd->ate.Channel > 14) - { - TxPwr[0] = pAd->Tx40MPwrCfgABand[0]; - TxPwr[1] = pAd->Tx40MPwrCfgABand[1]; - TxPwr[2] = pAd->Tx40MPwrCfgABand[2]; - TxPwr[3] = pAd->Tx40MPwrCfgABand[3]; - TxPwr[4] = pAd->Tx40MPwrCfgABand[4]; - } - else - { - TxPwr[0] = pAd->Tx40MPwrCfgGBand[0]; - TxPwr[1] = pAd->Tx40MPwrCfgGBand[1]; - TxPwr[2] = pAd->Tx40MPwrCfgGBand[2]; - TxPwr[3] = pAd->Tx40MPwrCfgGBand[3]; - TxPwr[4] = pAd->Tx40MPwrCfgGBand[4]; - } - } - else - { - if (pAd->ate.Channel > 14) - { - TxPwr[0] = pAd->Tx20MPwrCfgABand[0]; - TxPwr[1] = pAd->Tx20MPwrCfgABand[1]; - TxPwr[2] = pAd->Tx20MPwrCfgABand[2]; - TxPwr[3] = pAd->Tx20MPwrCfgABand[3]; - TxPwr[4] = pAd->Tx20MPwrCfgABand[4]; - } - else - { - TxPwr[0] = pAd->Tx20MPwrCfgGBand[0]; - TxPwr[1] = pAd->Tx20MPwrCfgGBand[1]; - TxPwr[2] = pAd->Tx20MPwrCfgGBand[2]; - TxPwr[3] = pAd->Tx20MPwrCfgGBand[3]; - TxPwr[4] = pAd->Tx20MPwrCfgGBand[4]; - } - } - - // TX power compensation for temperature variation based on TSSI. - // Do it per 4 seconds. - if (pAd->Mlme.OneSecPeriodicRound % 4 == 0) - { - if (pAd->ate.Channel <= 14) - { - /* bg channel */ - bAutoTxAgc = pAd->bAutoTxAgcG; - TssiRef = pAd->TssiRefG; - pTssiMinusBoundary = &pAd->TssiMinusBoundaryG[0]; - pTssiPlusBoundary = &pAd->TssiPlusBoundaryG[0]; - TxAgcStep = pAd->TxAgcStepG; - pTxAgcCompensate = &pAd->TxAgcCompensateG; - } - else - { - /* a channel */ - bAutoTxAgc = pAd->bAutoTxAgcA; - TssiRef = pAd->TssiRefA; - pTssiMinusBoundary = &pAd->TssiMinusBoundaryA[0]; - pTssiPlusBoundary = &pAd->TssiPlusBoundaryA[0]; - TxAgcStep = pAd->TxAgcStepA; - pTxAgcCompensate = &pAd->TxAgcCompensateA; - } - - if (bAutoTxAgc) - { - /* BbpR49 is unsigned char. */ - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R49, &BbpR49); - - /* (p) TssiPlusBoundaryG[0] = 0 = (m) TssiMinusBoundaryG[0] */ - /* compensate: +4 +3 +2 +1 0 -1 -2 -3 -4 * steps */ - /* step value is defined in pAd->TxAgcStepG for tx power value */ - - /* [4]+1+[4] p4 p3 p2 p1 o1 m1 m2 m3 m4 */ - /* ex: 0x00 0x15 0x25 0x45 0x88 0xA0 0xB5 0xD0 0xF0 - above value are examined in mass factory production */ - /* [4] [3] [2] [1] [0] [1] [2] [3] [4] */ - - /* plus is 0x10 ~ 0x40, minus is 0x60 ~ 0x90 */ - /* if value is between p1 ~ o1 or o1 ~ s1, no need to adjust tx power */ - /* if value is 0x65, tx power will be -= TxAgcStep*(2-1) */ - - if (BbpR49 > pTssiMinusBoundary[1]) - { - // Reading is larger than the reference value. - // Check for how large we need to decrease the Tx power. - for (idx = 1; idx < 5; idx++) - { - // Found the range. - if (BbpR49 <= pTssiMinusBoundary[idx]) - break; - } - - // The index is the step we should decrease, idx = 0 means there is nothing to compensate. -// if (R3 > (ULONG) (TxAgcStep * (idx-1))) - *pTxAgcCompensate = -(TxAgcStep * (idx-1)); -// else -// *pTxAgcCompensate = -((UCHAR)R3); - - DeltaPwr += (*pTxAgcCompensate); - ATEDBGPRINT(RT_DEBUG_TRACE, ("-- Tx Power, BBP R1=%x, TssiRef=%x, TxAgcStep=%x, step = -%d\n", - BbpR49, TssiRef, TxAgcStep, idx-1)); - } - else if (BbpR49 < pTssiPlusBoundary[1]) - { - // Reading is smaller than the reference value. - // Check for how large we need to increase the Tx power. - for (idx = 1; idx < 5; idx++) - { - // Found the range. - if (BbpR49 >= pTssiPlusBoundary[idx]) - break; - } - - // The index is the step we should increase, idx = 0 means there is nothing to compensate. - *pTxAgcCompensate = TxAgcStep * (idx-1); - DeltaPwr += (*pTxAgcCompensate); - ATEDBGPRINT(RT_DEBUG_TRACE, ("++ Tx Power, BBP R1=%x, TssiRef=%x, TxAgcStep=%x, step = +%d\n", - BbpR49, TssiRef, TxAgcStep, idx-1)); - } - else - { - *pTxAgcCompensate = 0; - ATEDBGPRINT(RT_DEBUG_TRACE, (" Tx Power, BBP R1=%x, TssiRef=%x, TxAgcStep=%x, step = +%d\n", - BbpR49, TssiRef, TxAgcStep, 0)); - } - } - } - else - { - if (pAd->ate.Channel <= 14) - { - bAutoTxAgc = pAd->bAutoTxAgcG; - pTxAgcCompensate = &pAd->TxAgcCompensateG; - } - else - { - bAutoTxAgc = pAd->bAutoTxAgcA; - pTxAgcCompensate = &pAd->TxAgcCompensateA; - } - - if (bAutoTxAgc) - DeltaPwr += (*pTxAgcCompensate); - } - - /* Calculate delta power based on the percentage specified from UI. */ - // E2PROM setting is calibrated for maximum TX power (i.e. 100%) - // We lower TX power here according to the percentage specified from UI. - if (pAd->CommonCfg.TxPowerPercentage == 0xffffffff) // AUTO TX POWER control - ; - else if (pAd->CommonCfg.TxPowerPercentage > 90) // 91 ~ 100% & AUTO, treat as 100% in terms of mW - ; - else if (pAd->CommonCfg.TxPowerPercentage > 60) // 61 ~ 90%, treat as 75% in terms of mW - { - DeltaPwr -= 1; - } - else if (pAd->CommonCfg.TxPowerPercentage > 30) // 31 ~ 60%, treat as 50% in terms of mW - { - DeltaPwr -= 3; - } - else if (pAd->CommonCfg.TxPowerPercentage > 15) // 16 ~ 30%, treat as 25% in terms of mW - { - DeltaPwr -= 6; - } - else if (pAd->CommonCfg.TxPowerPercentage > 9) // 10 ~ 15%, treat as 12.5% in terms of mW - { - DeltaPwr -= 9; - } - else // 0 ~ 9 %, treat as MIN(~3%) in terms of mW - { - DeltaPwr -= 12; - } - - /* Reset different new tx power for different TX rate. */ - for (i=0; i<5; i++) - { - if (TxPwr[i] != 0xffffffff) - { - for (j=0; j<8; j++) - { - Value = (CHAR)((TxPwr[i] >> j*4) & 0x0F); /* 0 ~ 15 */ - - if ((Value + DeltaPwr) < 0) - { - Value = 0; /* min */ - } - else if ((Value + DeltaPwr) > 0xF) - { - Value = 0xF; /* max */ - } - else - { - Value += DeltaPwr; /* temperature compensation */ - } - - /* fill new value to CSR offset */ - TxPwr[i] = (TxPwr[i] & ~(0x0000000F << j*4)) | (Value << j*4); - } - - /* write tx power value to CSR */ - /* TX_PWR_CFG_0 (8 tx rate) for TX power for OFDM 12M/18M - TX power for OFDM 6M/9M - TX power for CCK5.5M/11M - TX power for CCK1M/2M */ - /* TX_PWR_CFG_1 ~ TX_PWR_CFG_4 */ - RTMP_IO_WRITE32(pAd, TX_PWR_CFG_0 + i*4, TxPwr[i]); - - - } - } - -} - - -/* -======================================================================== - Routine Description: - Write TxWI for ATE mode. - - Return Value: - None -======================================================================== -*/ -#ifdef RTMP_MAC_PCI -static VOID ATEWriteTxWI( - IN PRTMP_ADAPTER pAd, - IN PTXWI_STRUC pOutTxWI, - IN BOOLEAN FRAG, - IN BOOLEAN CFACK, - IN BOOLEAN InsTimestamp, - IN BOOLEAN AMPDU, - IN BOOLEAN Ack, - IN BOOLEAN NSeq, // HW new a sequence. - IN UCHAR BASize, - IN UCHAR WCID, - IN ULONG Length, - IN UCHAR PID, - IN UCHAR TID, - IN UCHAR TxRate, - IN UCHAR Txopmode, - IN BOOLEAN CfAck, - IN HTTRANSMIT_SETTING *pTransmit) -{ - TXWI_STRUC TxWI; - PTXWI_STRUC pTxWI; - - // - // Always use Long preamble before verifiation short preamble functionality works well. - // Todo: remove the following line if short preamble functionality works - // - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); - NdisZeroMemory(&TxWI, TXWI_SIZE); - pTxWI = &TxWI; - - pTxWI->FRAG= FRAG; - - pTxWI->CFACK = CFACK; - pTxWI->TS= InsTimestamp; - pTxWI->AMPDU = AMPDU; - pTxWI->ACK = Ack; - pTxWI->txop= Txopmode; - - pTxWI->NSEQ = NSeq; - - // John tune the performace with Intel Client in 20 MHz performance - if ( BASize >7 ) - BASize =7; - - pTxWI->BAWinSize = BASize; - pTxWI->WirelessCliID = WCID; - pTxWI->MPDUtotalByteCount = Length; - pTxWI->PacketId = PID; - - // If CCK or OFDM, BW must be 20 - pTxWI->BW = (pTransmit->field.MODE <= MODE_OFDM) ? (BW_20) : (pTransmit->field.BW); - pTxWI->ShortGI = pTransmit->field.ShortGI; - pTxWI->STBC = pTransmit->field.STBC; - - pTxWI->MCS = pTransmit->field.MCS; - pTxWI->PHYMODE = pTransmit->field.MODE; - pTxWI->CFACK = CfAck; - pTxWI->MIMOps = 0; - pTxWI->MpduDensity = 0; - - pTxWI->PacketId = pTxWI->MCS; - NdisMoveMemory(pOutTxWI, &TxWI, sizeof(TXWI_STRUC)); - - return; -} -#endif // RTMP_MAC_PCI // - - - - -/* -======================================================================== - - Routine Description: - Disable protection for ATE. -======================================================================== -*/ -VOID ATEDisableAsicProtect( - IN PRTMP_ADAPTER pAd) -{ - PROT_CFG_STRUC ProtCfg, ProtCfg4; - UINT32 Protect[6]; - USHORT offset; - UCHAR i; - UINT32 MacReg = 0; - - // Config ASIC RTS threshold register - RTMP_IO_READ32(pAd, TX_RTS_CFG, &MacReg); - MacReg &= 0xFF0000FF; - MacReg |= (pAd->CommonCfg.RtsThreshold << 8); - RTMP_IO_WRITE32(pAd, TX_RTS_CFG, MacReg); - - // Initial common protection settings - RTMPZeroMemory(Protect, sizeof(Protect)); - ProtCfg4.word = 0; - ProtCfg.word = 0; - ProtCfg.field.TxopAllowGF40 = 1; - ProtCfg.field.TxopAllowGF20 = 1; - ProtCfg.field.TxopAllowMM40 = 1; - ProtCfg.field.TxopAllowMM20 = 1; - ProtCfg.field.TxopAllowOfdm = 1; - ProtCfg.field.TxopAllowCck = 1; - ProtCfg.field.RTSThEn = 1; - ProtCfg.field.ProtectNav = ASIC_SHORTNAV; - - // Handle legacy(B/G) protection - ProtCfg.field.ProtectRate = pAd->CommonCfg.RtsRate; - ProtCfg.field.ProtectCtrl = 0; - Protect[0] = ProtCfg.word; - Protect[1] = ProtCfg.word; - - // NO PROTECT - // 1.All STAs in the BSS are 20/40 MHz HT - // 2. in ai 20/40MHz BSS - // 3. all STAs are 20MHz in a 20MHz BSS - // Pure HT. no protection. - - // MM20_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 010111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4004 (OFDM 24M) - Protect[2] = 0x01744004; - - // MM40_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 111111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4084 (duplicate OFDM 24M) - Protect[3] = 0x03f44084; - - // CF20_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 010111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4004 (OFDM 24M) - Protect[4] = 0x01744004; - - // CF40_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 111111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4084 (duplicate OFDM 24M) - Protect[5] = 0x03f44084; - - pAd->CommonCfg.IOTestParm.bRTSLongProtOn = FALSE; - - offset = CCK_PROT_CFG; - for (i = 0;i < 6;i++) - RTMP_IO_WRITE32(pAd, offset + i*4, Protect[i]); - -} - - - - -/* There are two ways to convert Rssi */ -/* the way used with GET_LNA_GAIN() */ -CHAR ATEConvertToRssi( - IN PRTMP_ADAPTER pAd, - IN CHAR Rssi, - IN UCHAR RssiNumber) -{ - UCHAR RssiOffset, LNAGain; - - // Rssi equals to zero should be an invalid value - if (Rssi == 0) - return -99; - - LNAGain = GET_LNA_GAIN(pAd); - if (pAd->LatchRfRegs.Channel > 14) - { - if (RssiNumber == 0) - RssiOffset = pAd->ARssiOffset0; - else if (RssiNumber == 1) - RssiOffset = pAd->ARssiOffset1; - else - RssiOffset = pAd->ARssiOffset2; - } - else - { - if (RssiNumber == 0) - RssiOffset = pAd->BGRssiOffset0; - else if (RssiNumber == 1) - RssiOffset = pAd->BGRssiOffset1; - else - RssiOffset = pAd->BGRssiOffset2; - } - - return (-12 - RssiOffset - LNAGain - Rssi); -} - - -/* -======================================================================== - - Routine Description: - Set Japan filter coefficients if needed. - Note: - This routine should only be called when - entering TXFRAME mode or TXCONT mode. - -======================================================================== -*/ -static VOID SetJapanFilter( - IN PRTMP_ADAPTER pAd) -{ - UCHAR BbpData = 0; - - // - // If Channel=14 and Bandwidth=20M and Mode=CCK, set BBP R4 bit5=1 - // (Japan Tx filter coefficients)when (TXFRAME or TXCONT). - // - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BbpData); - - if ((pAd->ate.TxWI.PHYMODE == MODE_CCK) && (pAd->ate.Channel == 14) && (pAd->ate.TxWI.BW == BW_20)) - { - BbpData |= 0x20; // turn on - ATEDBGPRINT(RT_DEBUG_TRACE, ("SetJapanFilter!!!\n")); - } - else - { - BbpData &= 0xdf; // turn off - ATEDBGPRINT(RT_DEBUG_TRACE, ("ClearJapanFilter!!!\n")); - } - - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BbpData); -} - - -VOID ATESampleRssi( - IN PRTMP_ADAPTER pAd, - IN PRXWI_STRUC pRxWI) -{ - /* There are two ways to collect RSSI. */ -// pAd->LastRxRate = (USHORT)((pRxWI->MCS) + (pRxWI->BW <<7) + (pRxWI->ShortGI <<8)+ (pRxWI->PHYMODE <<14)) ; - if (pRxWI->RSSI0 != 0) - { - pAd->ate.LastRssi0 = ATEConvertToRssi(pAd, (CHAR) pRxWI->RSSI0, RSSI_0); - pAd->ate.AvgRssi0X8 = (pAd->ate.AvgRssi0X8 - pAd->ate.AvgRssi0) + pAd->ate.LastRssi0; - pAd->ate.AvgRssi0 = pAd->ate.AvgRssi0X8 >> 3; - } - if (pRxWI->RSSI1 != 0) - { - pAd->ate.LastRssi1 = ATEConvertToRssi(pAd, (CHAR) pRxWI->RSSI1, RSSI_1); - pAd->ate.AvgRssi1X8 = (pAd->ate.AvgRssi1X8 - pAd->ate.AvgRssi1) + pAd->ate.LastRssi1; - pAd->ate.AvgRssi1 = pAd->ate.AvgRssi1X8 >> 3; - } - if (pRxWI->RSSI2 != 0) - { - pAd->ate.LastRssi2 = ATEConvertToRssi(pAd, (CHAR) pRxWI->RSSI2, RSSI_2); - pAd->ate.AvgRssi2X8 = (pAd->ate.AvgRssi2X8 - pAd->ate.AvgRssi2) + pAd->ate.LastRssi2; - pAd->ate.AvgRssi2 = pAd->ate.AvgRssi2X8 >> 3; - } - - pAd->ate.LastSNR0 = (CHAR)(pRxWI->SNR0);// CHAR ==> UCHAR ? - pAd->ate.LastSNR1 = (CHAR)(pRxWI->SNR1);// CHAR ==> UCHAR ? - - pAd->ate.NumOfAvgRssiSample ++; -} - - -#ifdef CONFIG_STA_SUPPORT -VOID RTMPStationStop( - IN PRTMP_ADAPTER pAd) -{ -// BOOLEAN Cancelled; - - ATEDBGPRINT(RT_DEBUG_TRACE, ("==> RTMPStationStop\n")); - - // For rx statistics, we need to keep this timer running. -// RTMPCancelTimer(&pAd->Mlme.PeriodicTimer, &Cancelled); - - ATEDBGPRINT(RT_DEBUG_TRACE, ("<== RTMPStationStop\n")); -} - - -VOID RTMPStationStart( - IN PRTMP_ADAPTER pAd) -{ - ATEDBGPRINT(RT_DEBUG_TRACE, ("==> RTMPStationStart\n")); - -#ifdef RTMP_MAC_PCI - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - - /* We did not cancel this timer when entering ATE mode. */ -// RTMPSetTimer(&pAd->Mlme.PeriodicTimer, MLME_TASK_EXEC_INTV); -#endif // RTMP_MAC_PCI // - - ATEDBGPRINT(RT_DEBUG_TRACE, ("<== RTMPStationStart\n")); -} -#endif // CONFIG_STA_SUPPORT // - - -/* -========================================================================== - Description: - Setup Frame format. - NOTE: - This routine should only be used in ATE mode. -========================================================================== -*/ -#ifdef RTMP_MAC_PCI -static INT ATESetUpFrame( - IN PRTMP_ADAPTER pAd, - IN UINT32 TxIdx) -{ - UINT j; - PTXD_STRUC pTxD; -#ifdef RT_BIG_ENDIAN - PTXD_STRUC pDestTxD; - TXD_STRUC TxD; -#endif - PNDIS_PACKET pPacket; - PUCHAR pDest; - PVOID AllocVa; - NDIS_PHYSICAL_ADDRESS AllocPa; - HTTRANSMIT_SETTING TxHTPhyMode; - - PRTMP_TX_RING pTxRing = &pAd->TxRing[QID_AC_BE]; - PTXWI_STRUC pTxWI = (PTXWI_STRUC) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; - PUCHAR pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; - -#ifdef RALINK_28xx_QA - PHEADER_802_11 pHeader80211; -#endif // RALINK_28xx_QA // - - if (pAd->ate.bQATxStart == TRUE) - { - // always use QID_AC_BE and FIFO_EDCA - - // fill TxWI - TxHTPhyMode.field.BW = pAd->ate.TxWI.BW; - TxHTPhyMode.field.ShortGI = pAd->ate.TxWI.ShortGI; - TxHTPhyMode.field.STBC = 0; - TxHTPhyMode.field.MCS = pAd->ate.TxWI.MCS; - TxHTPhyMode.field.MODE = pAd->ate.TxWI.PHYMODE; - - ATEWriteTxWI(pAd, pTxWI, pAd->ate.TxWI.FRAG, pAd->ate.TxWI.CFACK, - pAd->ate.TxWI.TS, pAd->ate.TxWI.AMPDU, pAd->ate.TxWI.ACK, pAd->ate.TxWI.NSEQ, - pAd->ate.TxWI.BAWinSize, 0, pAd->ate.TxWI.MPDUtotalByteCount, pAd->ate.TxWI.PacketId, 0, 0, - pAd->ate.TxWI.txop/*IFS_HTTXOP*/, pAd->ate.TxWI.CFACK/*FALSE*/, &TxHTPhyMode); - } - else - { - TxHTPhyMode.field.BW = pAd->ate.TxWI.BW; - TxHTPhyMode.field.ShortGI = pAd->ate.TxWI.ShortGI; - TxHTPhyMode.field.STBC = 0; - TxHTPhyMode.field.MCS = pAd->ate.TxWI.MCS; - TxHTPhyMode.field.MODE = pAd->ate.TxWI.PHYMODE; - ATEWriteTxWI(pAd, pTxWI, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, - 4, 0, pAd->ate.TxLength, 0, 0, 0, IFS_HTTXOP, FALSE, &TxHTPhyMode); - } - - // fill 802.11 header -#ifdef RALINK_28xx_QA - if (pAd->ate.bQATxStart == TRUE) - { - NdisMoveMemory(pDMAHeaderBufVA+TXWI_SIZE, pAd->ate.Header, pAd->ate.HLen); - } - else -#endif // RALINK_28xx_QA // - { - NdisMoveMemory(pDMAHeaderBufVA+TXWI_SIZE, TemplateFrame, LENGTH_802_11); - NdisMoveMemory(pDMAHeaderBufVA+TXWI_SIZE+4, pAd->ate.Addr1, ETH_LENGTH_OF_ADDRESS); - NdisMoveMemory(pDMAHeaderBufVA+TXWI_SIZE+10, pAd->ate.Addr2, ETH_LENGTH_OF_ADDRESS); - NdisMoveMemory(pDMAHeaderBufVA+TXWI_SIZE+16, pAd->ate.Addr3, ETH_LENGTH_OF_ADDRESS); - } - -#ifdef RT_BIG_ENDIAN - RTMPFrameEndianChange(pAd, (((PUCHAR)pDMAHeaderBufVA)+TXWI_SIZE), DIR_READ, FALSE); -#endif // RT_BIG_ENDIAN // - - /* alloc buffer for payload */ -#ifdef RALINK_28xx_QA - if (pAd->ate.bQATxStart == TRUE) - { - pPacket = RTMP_AllocateRxPacketBuffer(pAd, pAd->ate.DLen + 0x100, FALSE, &AllocVa, &AllocPa); - } - else -#endif // RALINK_28xx_QA // - { - pPacket = RTMP_AllocateRxPacketBuffer(pAd, pAd->ate.TxLength, FALSE, &AllocVa, &AllocPa); - } - - if (pPacket == NULL) - { - pAd->ate.TxCount = 0; - ATEDBGPRINT(RT_DEBUG_TRACE, ("%s fail to alloc packet space.\n", __FUNCTION__)); - return -1; - } - pTxRing->Cell[TxIdx].pNextNdisPacket = pPacket; - - pDest = (PUCHAR) AllocVa; - -#ifdef RALINK_28xx_QA - if (pAd->ate.bQATxStart == TRUE) - { - RTPKT_TO_OSPKT(pPacket)->len = pAd->ate.DLen; - } - else -#endif // RALINK_28xx_QA // - { - RTPKT_TO_OSPKT(pPacket)->len = pAd->ate.TxLength - LENGTH_802_11; - } - - // prepare frame payload -#ifdef RALINK_28xx_QA - if (pAd->ate.bQATxStart == TRUE) - { - // copy pattern - if ((pAd->ate.PLen != 0)) - { - int j; - - for (j = 0; j < pAd->ate.DLen; j+=pAd->ate.PLen) - { - memcpy(RTPKT_TO_OSPKT(pPacket)->data + j, pAd->ate.Pattern, pAd->ate.PLen); - } - } - } - else -#endif // RALINK_28xx_QA // - { - for (j = 0; j < RTPKT_TO_OSPKT(pPacket)->len; j++) - { - pDest[j] = 0xA5; - } - } - - /* build Tx Descriptor */ -#ifndef RT_BIG_ENDIAN - pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; -#else - pDestTxD = (PTXD_STRUC)pTxRing->Cell[TxIdx].AllocVa; - TxD = *pDestTxD; - pTxD = &TxD; -#endif // !RT_BIG_ENDIAN // - -#ifdef RALINK_28xx_QA - if (pAd->ate.bQATxStart == TRUE) - { - // prepare TxD - NdisZeroMemory(pTxD, TXD_SIZE); - RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); - // build TX DESC - pTxD->SDPtr0 = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); - pTxD->SDLen0 = TXWI_SIZE + pAd->ate.HLen; - pTxD->LastSec0 = 0; - pTxD->SDPtr1 = AllocPa; - pTxD->SDLen1 = RTPKT_TO_OSPKT(pPacket)->len; - pTxD->LastSec1 = 1; - - pDest = (PUCHAR)pTxWI; - pDest += TXWI_SIZE; - pHeader80211 = (PHEADER_802_11)pDest; - - // modify sequence number... - if (pAd->ate.TxDoneCount == 0) - { - pAd->ate.seq = pHeader80211->Sequence; - } - else - pHeader80211->Sequence = ++pAd->ate.seq; - } - else -#endif // RALINK_28xx_QA // - { - NdisZeroMemory(pTxD, TXD_SIZE); - RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); - // build TX DESC - pTxD->SDPtr0 = RTMP_GetPhysicalAddressLow (pTxRing->Cell[TxIdx].DmaBuf.AllocPa); - pTxD->SDLen0 = TXWI_SIZE + LENGTH_802_11; - pTxD->LastSec0 = 0; - pTxD->SDPtr1 = AllocPa; - pTxD->SDLen1 = RTPKT_TO_OSPKT(pPacket)->len; - pTxD->LastSec1 = 1; - } - -#ifdef RT_BIG_ENDIAN - RTMPWIEndianChange((PUCHAR)pTxWI, TYPE_TXWI); - RTMPFrameEndianChange(pAd, (((PUCHAR)pDMAHeaderBufVA)+TXWI_SIZE), DIR_WRITE, FALSE); - RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD); - WriteBackToDescriptor((PUCHAR)pDestTxD, (PUCHAR)pTxD, FALSE, TYPE_TXD); -#endif // RT_BIG_ENDIAN // - - return 0; -} -/*=======================End of RTMP_MAC_PCI =======================*/ -#endif // RTMP_MAC_PCI // - - - - -VOID rt_ee_read_all(PRTMP_ADAPTER pAd, USHORT *Data) -{ - USHORT i; - USHORT value; - - - for (i = 0 ; i < EEPROM_SIZE/2 ; ) - { - /* "value" is especially for some compilers... */ - RT28xx_EEPROM_READ16(pAd, i*2, value); - Data[i] = value; - i++; - } -} - - -VOID rt_ee_write_all(PRTMP_ADAPTER pAd, USHORT *Data) -{ - USHORT i; - USHORT value; - - - for (i = 0 ; i < EEPROM_SIZE/2 ; ) - { - /* "value" is especially for some compilers... */ - value = Data[i]; - RT28xx_EEPROM_WRITE16(pAd, i*2, value); - i++; - } -} - - -#ifdef RALINK_28xx_QA -VOID ATE_QA_Statistics( - IN PRTMP_ADAPTER pAd, - IN PRXWI_STRUC pRxWI, - IN PRT28XX_RXD_STRUC pRxD, - IN PHEADER_802_11 pHeader) -{ - // update counter first - if (pHeader != NULL) - { - if (pHeader->FC.Type == BTYPE_DATA) - { - if (pRxD->U2M) - pAd->ate.U2M++; - else - pAd->ate.OtherData++; - } - else if (pHeader->FC.Type == BTYPE_MGMT) - { - if (pHeader->FC.SubType == SUBTYPE_BEACON) - pAd->ate.Beacon++; - else - pAd->ate.OtherCount++; - } - else if (pHeader->FC.Type == BTYPE_CNTL) - { - pAd->ate.OtherCount++; - } - } - pAd->ate.RSSI0 = pRxWI->RSSI0; - pAd->ate.RSSI1 = pRxWI->RSSI1; - pAd->ate.RSSI2 = pRxWI->RSSI2; - pAd->ate.SNR0 = pRxWI->SNR0; - pAd->ate.SNR1 = pRxWI->SNR1; -} - - -/* command id with Cmd Type == 0x0008(for 28xx)/0x0005(for iNIC) */ -#define RACFG_CMD_RF_WRITE_ALL 0x0000 -#define RACFG_CMD_E2PROM_READ16 0x0001 -#define RACFG_CMD_E2PROM_WRITE16 0x0002 -#define RACFG_CMD_E2PROM_READ_ALL 0x0003 -#define RACFG_CMD_E2PROM_WRITE_ALL 0x0004 -#define RACFG_CMD_IO_READ 0x0005 -#define RACFG_CMD_IO_WRITE 0x0006 -#define RACFG_CMD_IO_READ_BULK 0x0007 -#define RACFG_CMD_BBP_READ8 0x0008 -#define RACFG_CMD_BBP_WRITE8 0x0009 -#define RACFG_CMD_BBP_READ_ALL 0x000a -#define RACFG_CMD_GET_COUNTER 0x000b -#define RACFG_CMD_CLEAR_COUNTER 0x000c - -#define RACFG_CMD_RSV1 0x000d -#define RACFG_CMD_RSV2 0x000e -#define RACFG_CMD_RSV3 0x000f - -#define RACFG_CMD_TX_START 0x0010 -#define RACFG_CMD_GET_TX_STATUS 0x0011 -#define RACFG_CMD_TX_STOP 0x0012 -#define RACFG_CMD_RX_START 0x0013 -#define RACFG_CMD_RX_STOP 0x0014 -#define RACFG_CMD_GET_NOISE_LEVEL 0x0015 - -#define RACFG_CMD_ATE_START 0x0080 -#define RACFG_CMD_ATE_STOP 0x0081 - -#define RACFG_CMD_ATE_START_TX_CARRIER 0x0100 -#define RACFG_CMD_ATE_START_TX_CONT 0x0101 -#define RACFG_CMD_ATE_START_TX_FRAME 0x0102 -#define RACFG_CMD_ATE_SET_BW 0x0103 -#define RACFG_CMD_ATE_SET_TX_POWER0 0x0104 -#define RACFG_CMD_ATE_SET_TX_POWER1 0x0105 -#define RACFG_CMD_ATE_SET_FREQ_OFFSET 0x0106 -#define RACFG_CMD_ATE_GET_STATISTICS 0x0107 -#define RACFG_CMD_ATE_RESET_COUNTER 0x0108 -#define RACFG_CMD_ATE_SEL_TX_ANTENNA 0x0109 -#define RACFG_CMD_ATE_SEL_RX_ANTENNA 0x010a -#define RACFG_CMD_ATE_SET_PREAMBLE 0x010b -#define RACFG_CMD_ATE_SET_CHANNEL 0x010c -#define RACFG_CMD_ATE_SET_ADDR1 0x010d -#define RACFG_CMD_ATE_SET_ADDR2 0x010e -#define RACFG_CMD_ATE_SET_ADDR3 0x010f -#define RACFG_CMD_ATE_SET_RATE 0x0110 -#define RACFG_CMD_ATE_SET_TX_FRAME_LEN 0x0111 -#define RACFG_CMD_ATE_SET_TX_FRAME_COUNT 0x0112 -#define RACFG_CMD_ATE_START_RX_FRAME 0x0113 -#define RACFG_CMD_ATE_E2PROM_READ_BULK 0x0114 -#define RACFG_CMD_ATE_E2PROM_WRITE_BULK 0x0115 -#define RACFG_CMD_ATE_IO_WRITE_BULK 0x0116 -#define RACFG_CMD_ATE_BBP_READ_BULK 0x0117 -#define RACFG_CMD_ATE_BBP_WRITE_BULK 0x0118 -#define RACFG_CMD_ATE_RF_READ_BULK 0x0119 -#define RACFG_CMD_ATE_RF_WRITE_BULK 0x011a - - -static VOID memcpy_exl(PRTMP_ADAPTER pAd, UCHAR *dst, UCHAR *src, ULONG len); -static VOID memcpy_exs(PRTMP_ADAPTER pAd, UCHAR *dst, UCHAR *src, ULONG len); -static VOID RTMP_IO_READ_BULK(PRTMP_ADAPTER pAd, UCHAR *dst, UCHAR *src, UINT32 len); - - - -VOID RtmpDoAte( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq) -{ - USHORT Command_Id; - INT Status = NDIS_STATUS_SUCCESS; - struct ate_racfghdr *pRaCfg; - - - if ((pRaCfg = kmalloc(sizeof(struct ate_racfghdr), GFP_KERNEL)) == NULL) - { - Status = -EINVAL; - return; - } - - NdisZeroMemory(pRaCfg, sizeof(struct ate_racfghdr)); - - if (copy_from_user((PUCHAR)pRaCfg, wrq->u.data.pointer, wrq->u.data.length)) - { - Status = -EFAULT; - kfree(pRaCfg); - return; - } - - Command_Id = ntohs(pRaCfg->command_id); - - ATEDBGPRINT(RT_DEBUG_TRACE,("\n%s: Command_Id = 0x%04x !\n", __FUNCTION__, Command_Id)); - - switch (Command_Id) - { - /* We will get this command when QA starts. */ - case RACFG_CMD_ATE_START: - Status=DO_RACFG_CMD_ATE_START(pAdapter,wrq,pRaCfg); - break; - - /* We will get this command either QA is closed or ated is killed by user. */ - case RACFG_CMD_ATE_STOP: - Status=DO_RACFG_CMD_ATE_STOP(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_RF_WRITE_ALL: - Status=DO_RACFG_CMD_RF_WRITE_ALL(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_E2PROM_READ16: - Status=DO_RACFG_CMD_E2PROM_READ16(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_E2PROM_WRITE16: - Status=DO_RACFG_CMD_E2PROM_WRITE16(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_E2PROM_READ_ALL: - Status=DO_RACFG_CMD_E2PROM_READ_ALL(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_E2PROM_WRITE_ALL: - Status=DO_RACFG_CMD_E2PROM_WRITE_ALL(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_IO_READ: - Status=DO_RACFG_CMD_IO_READ(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_IO_WRITE: - Status=DO_RACFG_CMD_IO_WRITE(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_IO_READ_BULK: - Status=DO_RACFG_CMD_IO_READ_BULK(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_BBP_READ8: - Status=DO_RACFG_CMD_BBP_READ8(pAdapter,wrq,pRaCfg); - break; - case RACFG_CMD_BBP_WRITE8: - Status=DO_RACFG_CMD_BBP_WRITE8(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_BBP_READ_ALL: - Status=DO_RACFG_CMD_BBP_READ_ALL(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_E2PROM_READ_BULK: - Status=DO_RACFG_CMD_ATE_E2PROM_READ_BULK(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_E2PROM_WRITE_BULK: - Status=DO_RACFG_CMD_ATE_E2PROM_WRITE_BULK(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_IO_WRITE_BULK: - Status=DO_RACFG_CMD_ATE_IO_WRITE_BULK(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_BBP_READ_BULK: - Status=DO_RACFG_CMD_ATE_BBP_READ_BULK(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_BBP_WRITE_BULK: - Status=DO_RACFG_CMD_ATE_BBP_WRITE_BULK(pAdapter,wrq,pRaCfg); - break; - - - case RACFG_CMD_GET_NOISE_LEVEL: - Status=DO_RACFG_CMD_GET_NOISE_LEVEL(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_GET_COUNTER: - Status=DO_RACFG_CMD_GET_COUNTER(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_CLEAR_COUNTER: - Status=DO_RACFG_CMD_CLEAR_COUNTER(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_TX_START: - Status=DO_RACFG_CMD_TX_START(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_GET_TX_STATUS: - Status=DO_RACFG_CMD_GET_TX_STATUS(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_TX_STOP: - Status=DO_RACFG_CMD_TX_STOP(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_RX_START: - Status=DO_RACFG_CMD_RX_START(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_RX_STOP: - Status=DO_RACFG_CMD_RX_STOP(pAdapter,wrq,pRaCfg); - break; - - /* The following cases are for new ATE GUI(not QA). */ - /*==================================================*/ - case RACFG_CMD_ATE_START_TX_CARRIER: - Status=DO_RACFG_CMD_ATE_START_TX_CARRIER(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_START_TX_CONT: - Status=DO_RACFG_CMD_ATE_START_TX_CONT(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_START_TX_FRAME: - Status=DO_RACFG_CMD_ATE_START_TX_FRAME(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_SET_BW: - Status=DO_RACFG_CMD_ATE_SET_BW(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_SET_TX_POWER0: - Status=DO_RACFG_CMD_ATE_SET_TX_POWER0(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_SET_TX_POWER1: - Status=DO_RACFG_CMD_ATE_SET_TX_POWER1(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_SET_FREQ_OFFSET: - Status=DO_RACFG_CMD_ATE_SET_TX_POWER1(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_GET_STATISTICS: - Status=DO_RACFG_CMD_ATE_GET_STATISTICS(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_RESET_COUNTER: - Status=DO_RACFG_CMD_ATE_RESET_COUNTER(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_SEL_TX_ANTENNA: - Status=DO_RACFG_CMD_ATE_SEL_TX_ANTENNA(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_SEL_RX_ANTENNA: - Status=DO_RACFG_CMD_ATE_SEL_TX_ANTENNA(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_SET_PREAMBLE: - Status=DO_RACFG_CMD_ATE_SET_PREAMBLE(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_SET_CHANNEL: - Status=DO_RACFG_CMD_ATE_SET_CHANNEL(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_SET_ADDR1: - Status=DO_RACFG_CMD_ATE_SET_ADDR1(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_SET_ADDR2: - Status=DO_RACFG_CMD_ATE_SET_ADDR2(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_SET_ADDR3: - Status=DO_RACFG_CMD_ATE_SET_ADDR3(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_SET_RATE: - Status=DO_RACFG_CMD_ATE_SET_RATE(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_SET_TX_FRAME_LEN: - Status=DO_RACFG_CMD_ATE_SET_TX_FRAME_LEN(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_SET_TX_FRAME_COUNT: - Status=DO_RACFG_CMD_ATE_SET_TX_FRAME_COUNT(pAdapter,wrq,pRaCfg); - break; - - case RACFG_CMD_ATE_START_RX_FRAME: - Status=DO_RACFG_CMD_ATE_START_RX_FRAME(pAdapter,wrq,pRaCfg); - break; - default: - break; - } - - ASSERT(pRaCfg != NULL); - - if (pRaCfg != NULL) - kfree(pRaCfg); - - return; -} - - -VOID BubbleSort(INT32 n, INT32 a[]) -{ - INT32 k, j, temp; - - for (k = n-1; k>0; k--) - { - for (j = 0; j a[j+1]) - { - temp = a[j]; - a[j]=a[j+1]; - a[j+1]=temp; - } - } - } -} - - -VOID CalNoiseLevel(PRTMP_ADAPTER pAd, UCHAR channel, INT32 RSSI[3][10]) -{ - INT32 RSSI0, RSSI1, RSSI2; - CHAR Rssi0Offset, Rssi1Offset, Rssi2Offset; - UCHAR BbpR50Rssi0 = 0, BbpR51Rssi1 = 0, BbpR52Rssi2 = 0; - UCHAR Org_BBP66value = 0, Org_BBP69value = 0, Org_BBP70value = 0, data = 0; - USHORT LNA_Gain = 0; - INT32 j = 0; - UCHAR Org_Channel = pAd->ate.Channel; - USHORT GainValue = 0, OffsetValue = 0; - - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R66, &Org_BBP66value); - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R69, &Org_BBP69value); - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R70, &Org_BBP70value); - - //********************************************************************** - // Read the value of LNA gain and Rssi offset - //********************************************************************** - RT28xx_EEPROM_READ16(pAd, EEPROM_LNA_OFFSET, GainValue); - - // for Noise Level - if (channel <= 14) - { - LNA_Gain = GainValue & 0x00FF; - - RT28xx_EEPROM_READ16(pAd, EEPROM_RSSI_BG_OFFSET, OffsetValue); - Rssi0Offset = OffsetValue & 0x00FF; - Rssi1Offset = (OffsetValue & 0xFF00) >> 8; - RT28xx_EEPROM_READ16(pAd, (EEPROM_RSSI_BG_OFFSET + 2)/* 0x48 */, OffsetValue); - Rssi2Offset = OffsetValue & 0x00FF; - } - else - { - LNA_Gain = (GainValue & 0xFF00) >> 8; - - RT28xx_EEPROM_READ16(pAd, EEPROM_RSSI_A_OFFSET, OffsetValue); - Rssi0Offset = OffsetValue & 0x00FF; - Rssi1Offset = (OffsetValue & 0xFF00) >> 8; - RT28xx_EEPROM_READ16(pAd, (EEPROM_RSSI_A_OFFSET + 2)/* 0x4C */, OffsetValue); - Rssi2Offset = OffsetValue & 0x00FF; - } - //********************************************************************** - { - pAd->ate.Channel = channel; - ATEAsicSwitchChannel(pAd); - mdelay(5); - - data = 0x10; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, data); - data = 0x40; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, data); - data = 0x40; - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, data); - mdelay(5); - - // start Rx - pAd->ate.bQARxStart = TRUE; - Set_ATE_Proc(pAd, "RXFRAME"); - - mdelay(5); - - for (j = 0; j < 10; j++) - { - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R50, &BbpR50Rssi0); - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R51, &BbpR51Rssi1); - ATE_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R52, &BbpR52Rssi2); - - mdelay(10); - - // calculate RSSI 0 - if (BbpR50Rssi0 == 0) - { - RSSI0 = -100; - } - else - { - RSSI0 = (INT32)(-12 - BbpR50Rssi0 - LNA_Gain - Rssi0Offset); - } - RSSI[0][j] = RSSI0; - - if ( pAd->Antenna.field.RxPath >= 2 ) // 2R - { - // calculate RSSI 1 - if (BbpR51Rssi1 == 0) - { - RSSI1 = -100; - } - else - { - RSSI1 = (INT32)(-12 - BbpR51Rssi1 - LNA_Gain - Rssi1Offset); - } - RSSI[1][j] = RSSI1; - } - - if ( pAd->Antenna.field.RxPath >= 3 ) // 3R - { - // calculate RSSI 2 - if (BbpR52Rssi2 == 0) - RSSI2 = -100; - else - RSSI2 = (INT32)(-12 - BbpR52Rssi2 - LNA_Gain - Rssi2Offset); - - RSSI[2][j] = RSSI2; - } - } - - // stop Rx - Set_ATE_Proc(pAd, "RXSTOP"); - - mdelay(5); - - BubbleSort(10, RSSI[0]); // 1R - - if ( pAd->Antenna.field.RxPath >= 2 ) // 2R - { - BubbleSort(10, RSSI[1]); - } - - if ( pAd->Antenna.field.RxPath >= 3 ) // 3R - { - BubbleSort(10, RSSI[2]); - } - } - - pAd->ate.Channel = Org_Channel; - ATEAsicSwitchChannel(pAd); - - // restore original value - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, Org_BBP66value); - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, Org_BBP69value); - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, Org_BBP70value); - - return; -} - - -BOOLEAN SyncTxRxConfig(PRTMP_ADAPTER pAd, USHORT offset, UCHAR value) -{ - UCHAR tmp = 0, bbp_data = 0; - - if (ATE_ON(pAd)) - { - ATE_BBP_IO_READ8_BY_REG_ID(pAd, offset, &bbp_data); - } - else - { - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, offset, &bbp_data); - } - - /* confirm again */ - ASSERT(bbp_data == value); - - switch (offset) - { - case BBP_R1: - /* Need to synchronize tx configuration with legacy ATE. */ - tmp = (bbp_data & ((1 << 4) | (1 << 3))/* 0x18 */) >> 3; - switch (tmp) - { - /* The BBP R1 bit[4:3] = 2 :: Both DACs will be used by QA. */ - case 2: - /* All */ - pAd->ate.TxAntennaSel = 0; - break; - /* The BBP R1 bit[4:3] = 0 :: DAC 0 will be used by QA. */ - case 0: - /* Antenna one */ - pAd->ate.TxAntennaSel = 1; - break; - /* The BBP R1 bit[4:3] = 1 :: DAC 1 will be used by QA. */ - case 1: - /* Antenna two */ - pAd->ate.TxAntennaSel = 2; - break; - default: - DBGPRINT(RT_DEBUG_TRACE, ("%s -- Sth. wrong! : return FALSE; \n", __FUNCTION__)); - return FALSE; - } - break;/* case BBP_R1 */ - - case BBP_R3: - /* Need to synchronize rx configuration with legacy ATE. */ - tmp = (bbp_data & ((1 << 1) | (1 << 0))/* 0x03 */); - switch(tmp) - { - /* The BBP R3 bit[1:0] = 3 :: All ADCs will be used by QA. */ - case 3: - /* All */ - pAd->ate.RxAntennaSel = 0; - break; - /* - The BBP R3 bit[1:0] = 0 :: ADC 0 will be used by QA, - unless the BBP R3 bit[4:3] = 2 - */ - case 0: - /* Antenna one */ - pAd->ate.RxAntennaSel = 1; - tmp = ((bbp_data & ((1 << 4) | (1 << 3))/* 0x03 */) >> 3); - if (tmp == 2)// 3R - { - /* Default : All ADCs will be used by QA */ - pAd->ate.RxAntennaSel = 0; - } - break; - /* The BBP R3 bit[1:0] = 1 :: ADC 1 will be used by QA. */ - case 1: - /* Antenna two */ - pAd->ate.RxAntennaSel = 2; - break; - /* The BBP R3 bit[1:0] = 2 :: ADC 2 will be used by QA. */ - case 2: - /* Antenna three */ - pAd->ate.RxAntennaSel = 3; - break; - default: - DBGPRINT(RT_DEBUG_ERROR, ("%s -- Impossible! : return FALSE; \n", __FUNCTION__)); - return FALSE; - } - break;/* case BBP_R3 */ - - default: - DBGPRINT(RT_DEBUG_ERROR, ("%s -- Sth. wrong! : return FALSE; \n", __FUNCTION__)); - return FALSE; - - } - return TRUE; -} - - -static VOID memcpy_exl(PRTMP_ADAPTER pAd, UCHAR *dst, UCHAR *src, ULONG len) -{ - ULONG i, Value = 0; - ULONG *pDst, *pSrc; - UCHAR *p8; - - p8 = src; - pDst = (ULONG *) dst; - pSrc = (ULONG *) src; - - for (i = 0 ; i < (len/4); i++) - { - /* For alignment issue, we need a variable "Value". */ - memmove(&Value, pSrc, 4); - Value = htonl(Value); - memmove(pDst, &Value, 4); - pDst++; - pSrc++; - } - if ((len % 4) != 0) - { - /* wish that it will never reach here */ - memmove(&Value, pSrc, (len % 4)); - Value = htonl(Value); - memmove(pDst, &Value, (len % 4)); - } -} - - -static VOID memcpy_exs(PRTMP_ADAPTER pAd, UCHAR *dst, UCHAR *src, ULONG len) -{ - ULONG i; - UCHAR *pDst, *pSrc; - - pDst = dst; - pSrc = src; - - for (i = 0; i < (len/2); i++) - { - memmove(pDst, pSrc, 2); - *((USHORT *)pDst) = htons(*((USHORT *)pDst)); - pDst+=2; - pSrc+=2; - } - - if ((len % 2) != 0) - { - memmove(pDst, pSrc, 1); - } -} - - -static VOID RTMP_IO_READ_BULK(PRTMP_ADAPTER pAd, UCHAR *dst, UCHAR *src, UINT32 len) -{ - UINT32 i, Value; - UINT32 *pDst, *pSrc; - - pDst = (UINT32 *) dst; - pSrc = (UINT32 *) src; - - for (i = 0 ; i < (len/4); i++) - { - RTMP_IO_READ32(pAd, (ULONG)pSrc, &Value); - Value = htonl(Value); - memmove(pDst, &Value, 4); - pDst++; - pSrc++; - } - return; -} - - -INT Set_TxStop_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ATEDBGPRINT(RT_DEBUG_TRACE,("Set_TxStop_Proc\n")); - - if (Set_ATE_Proc(pAd, "TXSTOP")) - { - return TRUE; - } - else - { - return FALSE; - } -} - - -INT Set_RxStop_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ATEDBGPRINT(RT_DEBUG_TRACE,("Set_RxStop_Proc\n")); - - if (Set_ATE_Proc(pAd, "RXSTOP")) - { - return TRUE; - } - else - { - return FALSE; - } -} - - -#ifdef DBG -INT Set_EERead_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - USHORT buffer[EEPROM_SIZE/2]; - USHORT *p; - INT i; - - rt_ee_read_all(pAd, (USHORT *)buffer); - p = buffer; - - for (i = 0; i < (EEPROM_SIZE/2); i++) - { - ate_print(KERN_EMERG "%4.4x ", *p); - if (((i+1) % 16) == 0) - ate_print(KERN_EMERG "\n"); - p++; - } - - return TRUE; -} - - -INT Set_EEWrite_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - USHORT offset = 0, value; - PSTRING p2 = arg; - - while ((*p2 != ':') && (*p2 != '\0')) - { - p2++; - } - - if (*p2 == ':') - { - A2Hex(offset, arg); - A2Hex(value, p2 + 1); - } - else - { - A2Hex(value, arg); - } - - if (offset >= EEPROM_SIZE) - { - ate_print(KERN_EMERG "Offset can not exceed EEPROM_SIZE( == 0x%04x)\n", EEPROM_SIZE); - return FALSE; - } - - RT28xx_EEPROM_WRITE16(pAd, offset, value); - - return TRUE; -} - - -INT Set_BBPRead_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR value = 0, offset; - - A2Hex(offset, arg); - - if (ATE_ON(pAd)) - { - ATE_BBP_IO_READ8_BY_REG_ID(pAd, offset, &value); - } - else - { - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, offset, &value); - } - - ate_print(KERN_EMERG "%x\n", value); - - return TRUE; -} - - -INT Set_BBPWrite_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - USHORT offset = 0; - PSTRING p2 = arg; - UCHAR value; - - while ((*p2 != ':') && (*p2 != '\0')) - { - p2++; - } - - if (*p2 == ':') - { - A2Hex(offset, arg); - A2Hex(value, p2 + 1); - } - else - { - A2Hex(value, arg); - } - - if (ATE_ON(pAd)) - { - ATE_BBP_IO_WRITE8_BY_REG_ID(pAd, offset, value); - } - else - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, offset, value); - } - - return TRUE; -} - - -INT Set_RFWrite_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - PSTRING p2, p3, p4; - UINT32 R1, R2, R3, R4; - - p2 = arg; - - while ((*p2 != ':') && (*p2 != '\0')) - { - p2++; - } - - if (*p2 != ':') - return FALSE; - - p3 = p2 + 1; - - while((*p3 != ':') && (*p3 != '\0')) - { - p3++; - } - - if (*p3 != ':') - return FALSE; - - p4 = p3 + 1; - - while ((*p4 != ':') && (*p4 != '\0')) - { - p4++; - } - - if (*p4 != ':') - return FALSE; - - - A2Hex(R1, arg); - A2Hex(R2, p2 + 1); - A2Hex(R3, p3 + 1); - A2Hex(R4, p4 + 1); - - RTMP_RF_IO_WRITE32(pAd, R1); - RTMP_RF_IO_WRITE32(pAd, R2); - RTMP_RF_IO_WRITE32(pAd, R3); - RTMP_RF_IO_WRITE32(pAd, R4); - - return TRUE; -} -#endif // DBG // -#endif // RALINK_28xx_QA // - - - - -#ifdef RALINK_28xx_QA -#define LEN_OF_ARG 16 - -#define RESPONSE_TO_GUI(__pRaCfg, __pwrq, __Length, __Status) \ - (__pRaCfg)->length = htons((__Length)); \ - (__pRaCfg)->status = htons((__Status)); \ - (__pwrq)->u.data.length = sizeof((__pRaCfg)->magic_no) + sizeof((__pRaCfg)->command_type) \ - + sizeof((__pRaCfg)->command_id) + sizeof((__pRaCfg)->length) \ - + sizeof((__pRaCfg)->sequence) + ntohs((__pRaCfg)->length); \ - ATEDBGPRINT(RT_DEBUG_TRACE, ("wrq->u.data.length = %d\n", (__pwrq)->u.data.length)); \ - if (copy_to_user((__pwrq)->u.data.pointer, (UCHAR *)(__pRaCfg), (__pwrq)->u.data.length)) \ - { \ - ATEDBGPRINT(RT_DEBUG_ERROR, ("copy_to_user() fail in %s\n", __FUNCTION__)); \ - return (-EFAULT); \ - } \ - else \ - { \ - ATEDBGPRINT(RT_DEBUG_TRACE, ("%s is done !\n", __FUNCTION__)); \ - } - -static inline INT DO_RACFG_CMD_ATE_START( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_START\n")); - - /* Prepare feedback as soon as we can to avoid QA timeout. */ - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - Set_ATE_Proc(pAdapter, "ATESTART"); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_STOP( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - INT32 ret; - - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_STOP\n")); - - /* - Distinguish this command came from QA(via ate agent) - or ate agent according to the existence of pid in payload. - - No need to prepare feedback if this cmd came directly from ate agent, - not from QA. - */ - pRaCfg->length = ntohs(pRaCfg->length); - - if (pRaCfg->length == sizeof(pAdapter->ate.AtePid)) - { - /* - This command came from QA. - Get the pid of ATE agent. - */ - memcpy((UCHAR *)&pAdapter->ate.AtePid, - (&pRaCfg->data[0]) - 2/* == sizeof(pRaCfg->status) */, - sizeof(pAdapter->ate.AtePid)); - - /* Prepare feedback as soon as we can to avoid QA timeout. */ - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - /* - Kill ATE agent when leaving ATE mode. - - We must kill ATE agent first before setting ATESTOP, - or Microsoft will report sth. wrong. - */ - ret = KILL_THREAD_PID(pAdapter->ate.AtePid, SIGTERM, 1); - - if (ret) - { - ATEDBGPRINT(RT_DEBUG_ERROR, ("%s: unable to kill ate thread\n", pAdapter->net_dev->name)); - } - } - - - /* AP/STA might have in ATE_STOP mode due to cmd from QA. */ - if (ATE_ON(pAdapter)) - { - /* Someone has killed ate agent while QA GUI is still open. */ - Set_ATE_Proc(pAdapter, "ATESTOP"); - ATEDBGPRINT(RT_DEBUG_TRACE, ("RACFG_CMD_AP_START is done !\n")); - } - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_RF_WRITE_ALL( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - UINT32 R1, R2, R3, R4; - USHORT channel; - - memcpy(&R1, pRaCfg->data-2, 4); - memcpy(&R2, pRaCfg->data+2, 4); - memcpy(&R3, pRaCfg->data+6, 4); - memcpy(&R4, pRaCfg->data+10, 4); - memcpy(&channel, pRaCfg->data+14, 2); - - pAdapter->LatchRfRegs.R1 = ntohl(R1); - pAdapter->LatchRfRegs.R2 = ntohl(R2); - pAdapter->LatchRfRegs.R3 = ntohl(R3); - pAdapter->LatchRfRegs.R4 = ntohl(R4); - pAdapter->LatchRfRegs.Channel = ntohs(channel); - - RTMP_RF_IO_WRITE32(pAdapter, pAdapter->LatchRfRegs.R1); - RTMP_RF_IO_WRITE32(pAdapter, pAdapter->LatchRfRegs.R2); - RTMP_RF_IO_WRITE32(pAdapter, pAdapter->LatchRfRegs.R3); - RTMP_RF_IO_WRITE32(pAdapter, pAdapter->LatchRfRegs.R4); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_E2PROM_READ16( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - UINT16 offset=0, value=0; - USHORT tmp=0; - - offset = ntohs(pRaCfg->status); - - /* "tmp" is especially for some compilers... */ - RT28xx_EEPROM_READ16(pAdapter, offset, tmp); - value = tmp; - value = htons(value); - - ATEDBGPRINT(RT_DEBUG_TRACE,("EEPROM Read offset = 0x%04x, value = 0x%04x\n", offset, value)); - memcpy(pRaCfg->data, &value, 2); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status)+2, NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_E2PROM_WRITE16( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - USHORT offset, value; - - offset = ntohs(pRaCfg->status); - memcpy(&value, pRaCfg->data, 2); - value = ntohs(value); - RT28xx_EEPROM_WRITE16(pAdapter, offset, value); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_E2PROM_READ_ALL( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - USHORT buffer[EEPROM_SIZE/2]; - - rt_ee_read_all(pAdapter,(USHORT *)buffer); - memcpy_exs(pAdapter, pRaCfg->data, (UCHAR *)buffer, EEPROM_SIZE); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status)+EEPROM_SIZE, NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_E2PROM_WRITE_ALL( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - USHORT buffer[EEPROM_SIZE/2]; - - NdisZeroMemory((UCHAR *)buffer, EEPROM_SIZE); - memcpy_exs(pAdapter, (UCHAR *)buffer, (UCHAR *)&pRaCfg->status, EEPROM_SIZE); - rt_ee_write_all(pAdapter,(USHORT *)buffer); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_IO_READ( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - UINT32 offset; - UINT32 value; - - memcpy(&offset, &pRaCfg->status, 4); - offset = ntohl(offset); - - /* - We do not need the base address. - So just extract the offset out. - */ - offset &= 0x0000FFFF; - RTMP_IO_READ32(pAdapter, offset, &value); - value = htonl(value); - memcpy(pRaCfg->data, &value, 4); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status)+4, NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_IO_WRITE( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - UINT32 offset, value; - - memcpy(&offset, pRaCfg->data-2, 4); - memcpy(&value, pRaCfg->data+2, 4); - - offset = ntohl(offset); - - /* - We do not need the base address. - So just extract the offset out. - */ - offset &= 0x0000FFFF; - value = ntohl(value); - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_IO_WRITE: offset = %x, value = %x\n", offset, value)); - RTMP_IO_WRITE32(pAdapter, offset, value); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_IO_READ_BULK( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - UINT32 offset; - USHORT len; - - memcpy(&offset, &pRaCfg->status, 4); - offset = ntohl(offset); - - /* - We do not need the base address. - So just extract the offset out. - */ - offset &= 0x0000FFFF; - memcpy(&len, pRaCfg->data+2, 2); - len = ntohs(len); - - if (len > 371) - { - ATEDBGPRINT(RT_DEBUG_TRACE,("length requested is too large, make it smaller\n")); - pRaCfg->length = htons(2); - pRaCfg->status = htons(1); - return -EFAULT; - } - - RTMP_IO_READ_BULK(pAdapter, pRaCfg->data, (UCHAR *)offset, len*4);// unit in four bytes - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status)+(len*4), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_BBP_READ8( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - USHORT offset; - UCHAR value; - - value = 0; - offset = ntohs(pRaCfg->status); - - if (ATE_ON(pAdapter)) - { - ATE_BBP_IO_READ8_BY_REG_ID(pAdapter, offset, &value); - } - else - { - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, offset, &value); - } - - pRaCfg->data[0] = value; - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status)+1, NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_BBP_WRITE8( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - USHORT offset; - UCHAR value; - - offset = ntohs(pRaCfg->status); - memcpy(&value, pRaCfg->data, 1); - - if (ATE_ON(pAdapter)) - { - ATE_BBP_IO_WRITE8_BY_REG_ID(pAdapter, offset, value); - } - else - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, offset, value); - } - - if ((offset == BBP_R1) || (offset == BBP_R3)) - { - SyncTxRxConfig(pAdapter, offset, value); - } - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_BBP_READ_ALL( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - USHORT bbp_reg_index; - - for (bbp_reg_index = 0; bbp_reg_index < MAX_BBP_ID+1; bbp_reg_index++) - { - pRaCfg->data[bbp_reg_index] = 0; - - if (ATE_ON(pAdapter)) - { - ATE_BBP_IO_READ8_BY_REG_ID(pAdapter, bbp_reg_index, &pRaCfg->data[bbp_reg_index]); - } - else - { - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, bbp_reg_index, &pRaCfg->data[bbp_reg_index]); - } - } - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status)+MAX_BBP_ID+1, NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_GET_NOISE_LEVEL( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - UCHAR channel; - INT32 buffer[3][10];/* 3 : RxPath ; 10 : no. of per rssi samples */ - - channel = (ntohs(pRaCfg->status) & 0x00FF); - CalNoiseLevel(pAdapter, channel, buffer); - memcpy_exl(pAdapter, (UCHAR *)pRaCfg->data, (UCHAR *)&(buffer[0][0]), (sizeof(INT32)*3*10)); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status)+(sizeof(INT32)*3*10), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_GET_COUNTER( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - memcpy_exl(pAdapter, &pRaCfg->data[0], (UCHAR *)&pAdapter->ate.U2M, 4); - memcpy_exl(pAdapter, &pRaCfg->data[4], (UCHAR *)&pAdapter->ate.OtherData, 4); - memcpy_exl(pAdapter, &pRaCfg->data[8], (UCHAR *)&pAdapter->ate.Beacon, 4); - memcpy_exl(pAdapter, &pRaCfg->data[12], (UCHAR *)&pAdapter->ate.OtherCount, 4); - memcpy_exl(pAdapter, &pRaCfg->data[16], (UCHAR *)&pAdapter->ate.TxAc0, 4); - memcpy_exl(pAdapter, &pRaCfg->data[20], (UCHAR *)&pAdapter->ate.TxAc1, 4); - memcpy_exl(pAdapter, &pRaCfg->data[24], (UCHAR *)&pAdapter->ate.TxAc2, 4); - memcpy_exl(pAdapter, &pRaCfg->data[28], (UCHAR *)&pAdapter->ate.TxAc3, 4); - /*memcpy_exl(pAdapter, &pRaCfg->data[32], (UCHAR *)&pAdapter->ate.TxHCCA, 4);*/ - memcpy_exl(pAdapter, &pRaCfg->data[36], (UCHAR *)&pAdapter->ate.TxMgmt, 4); - memcpy_exl(pAdapter, &pRaCfg->data[40], (UCHAR *)&pAdapter->ate.RSSI0, 4); - memcpy_exl(pAdapter, &pRaCfg->data[44], (UCHAR *)&pAdapter->ate.RSSI1, 4); - memcpy_exl(pAdapter, &pRaCfg->data[48], (UCHAR *)&pAdapter->ate.RSSI2, 4); - memcpy_exl(pAdapter, &pRaCfg->data[52], (UCHAR *)&pAdapter->ate.SNR0, 4); - memcpy_exl(pAdapter, &pRaCfg->data[56], (UCHAR *)&pAdapter->ate.SNR1, 4); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status)+60, NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_CLEAR_COUNTER( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - pAdapter->ate.U2M = 0; - pAdapter->ate.OtherData = 0; - pAdapter->ate.Beacon = 0; - pAdapter->ate.OtherCount = 0; - pAdapter->ate.TxAc0 = 0; - pAdapter->ate.TxAc1 = 0; - pAdapter->ate.TxAc2 = 0; - pAdapter->ate.TxAc3 = 0; - /*pAdapter->ate.TxHCCA = 0;*/ - pAdapter->ate.TxMgmt = 0; - pAdapter->ate.TxDoneCount = 0; - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_TX_START( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - USHORT *p; - USHORT err = 1; - UCHAR Bbp22Value = 0, Bbp24Value = 0; - - if ((pAdapter->ate.TxStatus != 0) && (pAdapter->ate.Mode & ATE_TXFRAME)) - { - ATEDBGPRINT(RT_DEBUG_TRACE,("Ate Tx is already running, to run next Tx, you must stop it first\n")); - err = 2; - goto TX_START_ERROR; - } - else if ((pAdapter->ate.TxStatus != 0) && !(pAdapter->ate.Mode & ATE_TXFRAME)) - { - int i = 0; - - while ((i++ < 10) && (pAdapter->ate.TxStatus != 0)) - { - RTMPusecDelay(5000); - } - - /* force it to stop */ - pAdapter->ate.TxStatus = 0; - pAdapter->ate.TxDoneCount = 0; - pAdapter->ate.bQATxStart = FALSE; - } - - /* - If pRaCfg->length == 0, this "RACFG_CMD_TX_START" - is for Carrier test or Carrier Suppression. - */ - if (ntohs(pRaCfg->length) != 0) - { - /* get frame info */ - - NdisMoveMemory(&pAdapter->ate.TxWI, pRaCfg->data + 2, 16); -#ifdef RT_BIG_ENDIAN - RTMPWIEndianChange((PUCHAR)&pAdapter->ate.TxWI, TYPE_TXWI); -#endif // RT_BIG_ENDIAN // - - NdisMoveMemory(&pAdapter->ate.TxCount, pRaCfg->data + 18, 4); - pAdapter->ate.TxCount = ntohl(pAdapter->ate.TxCount); - - p = (USHORT *)(&pRaCfg->data[22]); - - /* always use QID_AC_BE */ - pAdapter->ate.QID = 0; - - p = (USHORT *)(&pRaCfg->data[24]); - pAdapter->ate.HLen = ntohs(*p); - - if (pAdapter->ate.HLen > 32) - { - ATEDBGPRINT(RT_DEBUG_ERROR,("pAdapter->ate.HLen > 32\n")); - err = 3; - goto TX_START_ERROR; - } - - NdisMoveMemory(&pAdapter->ate.Header, pRaCfg->data + 26, pAdapter->ate.HLen); - - pAdapter->ate.PLen = ntohs(pRaCfg->length) - (pAdapter->ate.HLen + 28); - - if (pAdapter->ate.PLen > 32) - { - ATEDBGPRINT(RT_DEBUG_ERROR,("pAdapter->ate.PLen > 32\n")); - err = 4; - goto TX_START_ERROR; - } - - NdisMoveMemory(&pAdapter->ate.Pattern, pRaCfg->data + 26 + pAdapter->ate.HLen, pAdapter->ate.PLen); - pAdapter->ate.DLen = pAdapter->ate.TxWI.MPDUtotalByteCount - pAdapter->ate.HLen; - } - - ATE_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R22, &Bbp22Value); - - switch (Bbp22Value) - { - case BBP22_TXFRAME: - { - if (pAdapter->ate.TxCount == 0) - { -#ifdef RTMP_MAC_PCI - pAdapter->ate.TxCount = 0xFFFFFFFF; -#endif // RTMP_MAC_PCI // - } - ATEDBGPRINT(RT_DEBUG_TRACE,("START TXFRAME\n")); - pAdapter->ate.bQATxStart = TRUE; - Set_ATE_Proc(pAdapter, "TXFRAME"); - } - break; - - case BBP22_TXCONT_OR_CARRSUPP: - { - ATEDBGPRINT(RT_DEBUG_TRACE,("BBP22_TXCONT_OR_CARRSUPP\n")); - ATE_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R24, &Bbp24Value); - - switch (Bbp24Value) - { - case BBP24_TXCONT: - { - ATEDBGPRINT(RT_DEBUG_TRACE,("START TXCONT\n")); - pAdapter->ate.bQATxStart = TRUE; - Set_ATE_Proc(pAdapter, "TXCONT"); - } - break; - - case BBP24_CARRSUPP: - { - ATEDBGPRINT(RT_DEBUG_TRACE,("START TXCARRSUPP\n")); - pAdapter->ate.bQATxStart = TRUE; - pAdapter->ate.Mode |= ATE_TXCARRSUPP; - } - break; - - default: - { - ATEDBGPRINT(RT_DEBUG_ERROR,("Unknown TX subtype !")); - } - break; - } - } - break; - - case BBP22_TXCARR: - { - ATEDBGPRINT(RT_DEBUG_TRACE,("START TXCARR\n")); - pAdapter->ate.bQATxStart = TRUE; - Set_ATE_Proc(pAdapter, "TXCARR"); - } - break; - - default: - { - ATEDBGPRINT(RT_DEBUG_ERROR,("Unknown Start TX subtype !")); - } - break; - } - - if (pAdapter->ate.bQATxStart == TRUE) - { - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - return NDIS_STATUS_SUCCESS; - } - -TX_START_ERROR: - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), err); - - return err; -} - - -static inline INT DO_RACFG_CMD_GET_TX_STATUS( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - UINT32 count=0; - - count = htonl(pAdapter->ate.TxDoneCount); - NdisMoveMemory(pRaCfg->data, &count, 4); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status)+4, NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_TX_STOP( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_TX_STOP\n")); - - Set_ATE_Proc(pAdapter, "TXSTOP"); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_RX_START( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_RX_START\n")); - - pAdapter->ate.bQARxStart = TRUE; - Set_ATE_Proc(pAdapter, "RXFRAME"); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_RX_STOP( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_RX_STOP\n")); - - Set_ATE_Proc(pAdapter, "RXSTOP"); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_START_TX_CARRIER( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_START_TX_CARRIER\n")); - - Set_ATE_Proc(pAdapter, "TXCARR"); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_START_TX_CONT( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_START_TX_CONT\n")); - - Set_ATE_Proc(pAdapter, "TXCONT"); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_START_TX_FRAME( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_START_TX_FRAME\n")); - - Set_ATE_Proc(pAdapter, "TXFRAME"); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_SET_BW( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - SHORT value = 0; - STRING str[LEN_OF_ARG]; - - NdisZeroMemory(str, LEN_OF_ARG); - - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_SET_BW\n")); - - memcpy((PUCHAR)&value, (PUCHAR)&(pRaCfg->status), 2); - value = ntohs(value); - sprintf((char *)str, "%d", value); - - Set_ATE_TX_BW_Proc(pAdapter, str); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_SET_TX_POWER0( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - SHORT value = 0; - STRING str[LEN_OF_ARG]; - - NdisZeroMemory(str, LEN_OF_ARG); - - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_SET_TX_POWER0\n")); - - memcpy((PUCHAR)&value, (PUCHAR)&(pRaCfg->status), 2); - value = ntohs(value); - sprintf((char *)str, "%d", value); - Set_ATE_TX_POWER0_Proc(pAdapter, str); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_SET_TX_POWER1( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - SHORT value = 0; - STRING str[LEN_OF_ARG]; - - NdisZeroMemory(str, LEN_OF_ARG); - - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_SET_TX_POWER1\n")); - - memcpy((PUCHAR)&value, (PUCHAR)&(pRaCfg->status), 2); - value = ntohs(value); - sprintf((char *)str, "%d", value); - Set_ATE_TX_POWER1_Proc(pAdapter, str); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_SET_FREQ_OFFSET( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - SHORT value = 0; - STRING str[LEN_OF_ARG]; - - NdisZeroMemory(str, LEN_OF_ARG); - - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_SET_FREQ_OFFSET\n")); - - memcpy((PUCHAR)&value, (PUCHAR)&(pRaCfg->status), 2); - value = ntohs(value); - sprintf((char *)str, "%d", value); - Set_ATE_TX_FREQOFFSET_Proc(pAdapter, str); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_GET_STATISTICS( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_GET_STATISTICS\n")); - - memcpy_exl(pAdapter, &pRaCfg->data[0], (UCHAR *)&pAdapter->ate.TxDoneCount, 4); - memcpy_exl(pAdapter, &pRaCfg->data[4], (UCHAR *)&pAdapter->WlanCounters.RetryCount.u.LowPart, 4); - memcpy_exl(pAdapter, &pRaCfg->data[8], (UCHAR *)&pAdapter->WlanCounters.FailedCount.u.LowPart, 4); - memcpy_exl(pAdapter, &pRaCfg->data[12], (UCHAR *)&pAdapter->WlanCounters.RTSSuccessCount.u.LowPart, 4); - memcpy_exl(pAdapter, &pRaCfg->data[16], (UCHAR *)&pAdapter->WlanCounters.RTSFailureCount.u.LowPart, 4); - memcpy_exl(pAdapter, &pRaCfg->data[20], (UCHAR *)&pAdapter->WlanCounters.ReceivedFragmentCount.QuadPart, 4); - memcpy_exl(pAdapter, &pRaCfg->data[24], (UCHAR *)&pAdapter->WlanCounters.FCSErrorCount.u.LowPart, 4); - memcpy_exl(pAdapter, &pRaCfg->data[28], (UCHAR *)&pAdapter->Counters8023.RxNoBuffer, 4); - memcpy_exl(pAdapter, &pRaCfg->data[32], (UCHAR *)&pAdapter->WlanCounters.FrameDuplicateCount.u.LowPart, 4); - memcpy_exl(pAdapter, &pRaCfg->data[36], (UCHAR *)&pAdapter->RalinkCounters.OneSecFalseCCACnt, 4); - - if (pAdapter->ate.RxAntennaSel == 0) - { - INT32 RSSI0 = 0; - INT32 RSSI1 = 0; - INT32 RSSI2 = 0; - - RSSI0 = (INT32)(pAdapter->ate.LastRssi0 - pAdapter->BbpRssiToDbmDelta); - RSSI1 = (INT32)(pAdapter->ate.LastRssi1 - pAdapter->BbpRssiToDbmDelta); - RSSI2 = (INT32)(pAdapter->ate.LastRssi2 - pAdapter->BbpRssiToDbmDelta); - memcpy_exl(pAdapter, &pRaCfg->data[40], (UCHAR *)&RSSI0, 4); - memcpy_exl(pAdapter, &pRaCfg->data[44], (UCHAR *)&RSSI1, 4); - memcpy_exl(pAdapter, &pRaCfg->data[48], (UCHAR *)&RSSI2, 4); - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status)+52, NDIS_STATUS_SUCCESS); - } - else - { - INT32 RSSI0 = 0; - - RSSI0 = (INT32)(pAdapter->ate.LastRssi0 - pAdapter->BbpRssiToDbmDelta); - memcpy_exl(pAdapter, &pRaCfg->data[40], (UCHAR *)&RSSI0, 4); - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status)+44, NDIS_STATUS_SUCCESS); - } - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_RESET_COUNTER( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - SHORT value = 1; - STRING str[LEN_OF_ARG]; - - NdisZeroMemory(str, LEN_OF_ARG); - - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_RESET_COUNTER\n")); - - sprintf((char *)str, "%d", value); - Set_ResetStatCounter_Proc(pAdapter, str); - - pAdapter->ate.TxDoneCount = 0; - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_SEL_TX_ANTENNA( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - SHORT value = 0; - STRING str[LEN_OF_ARG]; - - NdisZeroMemory(str, LEN_OF_ARG); - - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_SEL_TX_ANTENNA\n")); - - memcpy((PUCHAR)&value, (PUCHAR)&(pRaCfg->status), 2); - value = ntohs(value); - sprintf((char *)str, "%d", value); - Set_ATE_TX_Antenna_Proc(pAdapter, str); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_SEL_RX_ANTENNA( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - SHORT value = 0; - STRING str[LEN_OF_ARG]; - - NdisZeroMemory(str, LEN_OF_ARG); - - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_SEL_RX_ANTENNA\n")); - - memcpy((PUCHAR)&value, (PUCHAR)&(pRaCfg->status), 2); - value = ntohs(value); - sprintf((char *)str, "%d", value); - Set_ATE_RX_Antenna_Proc(pAdapter, str); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_SET_PREAMBLE( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - SHORT value = 0; - STRING str[LEN_OF_ARG]; - - NdisZeroMemory(str, LEN_OF_ARG); - - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_SET_PREAMBLE\n")); - - memcpy((PUCHAR)&value, (PUCHAR)&(pRaCfg->status), 2); - value = ntohs(value); - sprintf((char *)str, "%d", value); - Set_ATE_TX_MODE_Proc(pAdapter, str); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_SET_CHANNEL( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - SHORT value = 0; - STRING str[LEN_OF_ARG]; - - NdisZeroMemory(str, LEN_OF_ARG); - - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_SET_CHANNEL\n")); - - memcpy((PUCHAR)&value, (PUCHAR)&(pRaCfg->status), 2); - value = ntohs(value); - sprintf((char *)str, "%d", value); - Set_ATE_CHANNEL_Proc(pAdapter, str); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_SET_ADDR1( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_SET_ADDR1\n")); - - /* - Addr is an array of UCHAR, - so no need to perform endian swap. - */ - memcpy(pAdapter->ate.Addr1, (PUCHAR)(pRaCfg->data - 2), MAC_ADDR_LEN); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_SET_ADDR2( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_SET_ADDR2\n")); - - /* - Addr is an array of UCHAR, - so no need to perform endian swap. - */ - memcpy(pAdapter->ate.Addr2, (PUCHAR)(pRaCfg->data - 2), MAC_ADDR_LEN); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_SET_ADDR3( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_SET_ADDR3\n")); - - /* - Addr is an array of UCHAR, - so no need to perform endian swap. - */ - memcpy(pAdapter->ate.Addr3, (PUCHAR)(pRaCfg->data - 2), MAC_ADDR_LEN); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_SET_RATE( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - SHORT value = 0; - STRING str[LEN_OF_ARG]; - - NdisZeroMemory(str, LEN_OF_ARG); - - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_SET_RATE\n")); - - memcpy((PUCHAR)&value, (PUCHAR)&(pRaCfg->status), 2); - value = ntohs(value); - sprintf((char *)str, "%d", value); - Set_ATE_TX_MCS_Proc(pAdapter, str); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_SET_TX_FRAME_LEN( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - SHORT value = 0; - STRING str[LEN_OF_ARG]; - - NdisZeroMemory(str, LEN_OF_ARG); - - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_SET_TX_FRAME_LEN\n")); - - memcpy((PUCHAR)&value, (PUCHAR)&(pRaCfg->status), 2); - value = ntohs(value); - sprintf((char *)str, "%d", value); - Set_ATE_TX_LENGTH_Proc(pAdapter, str); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_SET_TX_FRAME_COUNT( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - USHORT value = 0; - STRING str[LEN_OF_ARG]; - - NdisZeroMemory(str, LEN_OF_ARG); - - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_ATE_SET_TX_FRAME_COUNT\n")); - - memcpy((PUCHAR)&value, (PUCHAR)&(pRaCfg->status), 2); - value = ntohs(value); - -#ifdef RTMP_MAC_PCI - /* TX_FRAME_COUNT == 0 means tx infinitely */ - if (value == 0) - { - /* Use TxCount = 0xFFFFFFFF to approximate the infinity. */ - pAdapter->ate.TxCount = 0xFFFFFFFF; - ATEDBGPRINT(RT_DEBUG_TRACE, ("Set_ATE_TX_COUNT_Proc (TxCount = %d)\n", pAdapter->ate.TxCount)); - ATEDBGPRINT(RT_DEBUG_TRACE, ("Ralink: Set_ATE_TX_COUNT_Proc Success\n")); - - - } - else -#endif // RTMP_MAC_PCI // - { - sprintf((char *)str, "%d", value); - Set_ATE_TX_COUNT_Proc(pAdapter, str); - } - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_START_RX_FRAME( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - ATEDBGPRINT(RT_DEBUG_TRACE,("RACFG_CMD_RX_START\n")); - - Set_ATE_Proc(pAdapter, "RXFRAME"); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_E2PROM_READ_BULK( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - USHORT offset; - USHORT len; - USHORT buffer[EEPROM_SIZE/2]; - - offset = ntohs(pRaCfg->status); - memcpy(&len, pRaCfg->data, 2); - len = ntohs(len); - - rt_ee_read_all(pAdapter, (USHORT *)buffer); - - if (offset + len <= EEPROM_SIZE) - memcpy_exs(pAdapter, pRaCfg->data, (UCHAR *)buffer+offset, len); - else - ATEDBGPRINT(RT_DEBUG_ERROR, ("exceed EEPROM size\n")); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status)+len, NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_E2PROM_WRITE_BULK( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - USHORT offset; - USHORT len; - USHORT buffer[EEPROM_SIZE/2]; - - offset = ntohs(pRaCfg->status); - memcpy(&len, pRaCfg->data, 2); - len = ntohs(len); - - rt_ee_read_all(pAdapter,(USHORT *)buffer); - memcpy_exs(pAdapter, (UCHAR *)buffer + offset, (UCHAR *)pRaCfg->data + 2, len); - rt_ee_write_all(pAdapter,(USHORT *)buffer); - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_IO_WRITE_BULK( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - UINT32 offset, i, value; - USHORT len; - - memcpy(&offset, &pRaCfg->status, 4); - offset = ntohl(offset); - memcpy(&len, pRaCfg->data+2, 2); - len = ntohs(len); - - for (i = 0; i < len; i += 4) - { - memcpy_exl(pAdapter, (UCHAR *)&value, pRaCfg->data+4+i, 4); - ATEDBGPRINT(RT_DEBUG_TRACE,("Write %x %x\n", offset + i, value)); - RTMP_IO_WRITE32(pAdapter, ((offset+i) & (0xffff)), value); - } - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_BBP_READ_BULK( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - USHORT offset; - USHORT len; - USHORT j; - - offset = ntohs(pRaCfg->status); - memcpy(&len, pRaCfg->data, 2); - len = ntohs(len); - - for (j = offset; j < (offset+len); j++) - { - pRaCfg->data[j - offset] = 0; - - if (pAdapter->ate.Mode == ATE_STOP) - { - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, j, &pRaCfg->data[j - offset]); - } - else - { - ATE_BBP_IO_READ8_BY_REG_ID(pAdapter, j, &pRaCfg->data[j - offset]); - } - } - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status)+len, NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -static inline INT DO_RACFG_CMD_ATE_BBP_WRITE_BULK( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq, - IN struct ate_racfghdr *pRaCfg) -{ - USHORT offset; - USHORT len; - USHORT j; - UCHAR *value; - - offset = ntohs(pRaCfg->status); - memcpy(&len, pRaCfg->data, 2); - len = ntohs(len); - - for (j = offset; j < (offset+len); j++) - { - value = pRaCfg->data + 2 + (j - offset); - if (pAdapter->ate.Mode == ATE_STOP) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, j, *value); - } - else - { - ATE_BBP_IO_WRITE8_BY_REG_ID(pAdapter, j, *value); - } - } - - RESPONSE_TO_GUI(pRaCfg, wrq, sizeof(pRaCfg->status), NDIS_STATUS_SUCCESS); - - return NDIS_STATUS_SUCCESS; -} - - -#endif // RALINK_28xx_QA // -#endif // RALINK_ATE // diff --git a/drivers/staging/rt3090/rt_ate.h b/drivers/staging/rt3090/rt_ate.h deleted file mode 100644 index 38d596162e74..000000000000 --- a/drivers/staging/rt3090/rt_ate.h +++ /dev/null @@ -1,314 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - */ - -#ifndef __ATE_H__ -#define __ATE_H__ - - -#ifdef LINUX -#define ate_print printk -#define ATEDBGPRINT DBGPRINT -#ifdef RTMP_MAC_PCI -#define EEPROM_SIZE 0x200 -#ifdef CONFIG_STA_SUPPORT -#define EEPROM_BIN_FILE_NAME "/etc/Wireless/RT2860STA/e2p.bin" -#endif // CONFIG_STA_SUPPORT // -#endif // RTMP_MAC_PCI // -#endif // LINUX // - - -#define ATE_ON(_p) (((_p)->ate.Mode) != ATE_STOP) - -#ifdef RTMP_MAC_PCI -#define ATE_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \ -{ \ - BBP_CSR_CFG_STRUC BbpCsr; \ - int j, k; \ - for (j=0; jBbpWriteLatch[_I]; \ - } \ -} - -#define ATE_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \ -{ \ - BBP_CSR_CFG_STRUC BbpCsr; \ - int BusyCnt; \ - for (BusyCnt=0; BusyCntBbpWriteLatch[_I] = _V; \ - break; \ - } \ - if (BusyCnt == MAX_BUSY_COUNT) \ - { \ - ATEDBGPRINT(RT_DEBUG_ERROR, ("BBP write R%d fail\n", _I)); \ - } \ -} -#endif // RTMP_MAC_PCI // - - -#ifdef RT30xx -#define ATE_RF_IO_READ8_BY_REG_ID(_A, _I, _pV) RTMP_RF_IO_READ8_BY_REG_ID(_A, _I, _pV) -#define ATE_RF_IO_WRITE8_BY_REG_ID(_A, _I, _V) RTMP_RF_IO_WRITE8_BY_REG_ID(_A, _I, _V) -#endif // RT30xx // - - -VOID rt_ee_read_all( - IN PRTMP_ADAPTER pAd, - OUT USHORT *Data); - -VOID rt_ee_write_all( - IN PRTMP_ADAPTER pAd, - IN USHORT *Data); - -INT Set_ATE_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_DA_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_SA_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_BSSID_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_CHANNEL_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_TX_POWER0_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_TX_POWER1_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_TX_Antenna_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_RX_Antenna_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_TX_FREQOFFSET_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_TX_BW_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_TX_LENGTH_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_TX_COUNT_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_TX_MCS_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_TX_MODE_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_TX_GI_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - - -INT Set_ATE_RX_FER_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_Read_RF_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_Write_RF1_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_Write_RF2_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_Write_RF3_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_Write_RF4_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_Load_E2P_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_Read_E2P_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - - -INT Set_ATE_Show_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ATE_Help_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -#ifdef RALINK_28xx_QA -VOID ATE_QA_Statistics( - IN PRTMP_ADAPTER pAd, - IN PRXWI_STRUC pRxWI, - IN PRT28XX_RXD_STRUC p28xxRxD, - IN PHEADER_802_11 pHeader); - -VOID RtmpDoAte( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq); - -VOID BubbleSort( - IN INT32 n, - IN INT32 a[]); - -VOID CalNoiseLevel( - IN PRTMP_ADAPTER pAdapter, - IN UCHAR channel, - OUT INT32 buffer[3][10]); - -BOOLEAN SyncTxRxConfig( - IN PRTMP_ADAPTER pAdapter, - IN USHORT offset, - IN UCHAR value); - -INT Set_TxStop_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_RxStop_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -#ifdef DBG -INT Set_EERead_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_EEWrite_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_BBPRead_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_BBPWrite_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_RFWrite_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); -#endif // DBG // -#endif // RALINK_28xx_QA // - - -VOID ATEAsicSwitchChannel( - IN PRTMP_ADAPTER pAd); - -VOID ATEAsicAdjustTxPower( - IN PRTMP_ADAPTER pAd); - -VOID ATEDisableAsicProtect( - IN PRTMP_ADAPTER pAd); - -CHAR ATEConvertToRssi( - IN PRTMP_ADAPTER pAd, - IN CHAR Rssi, - IN UCHAR RssiNumber); - -VOID ATESampleRssi( - IN PRTMP_ADAPTER pAd, - IN PRXWI_STRUC pRxWI); - - -#ifdef CONFIG_STA_SUPPORT -VOID RTMPStationStop( - IN PRTMP_ADAPTER pAd); - -VOID RTMPStationStart( - IN PRTMP_ADAPTER pAd); -#endif // CONFIG_STA_SUPPORT // -#endif // __ATE_H__ // diff --git a/drivers/staging/rt3090/rt_config.h b/drivers/staging/rt3090/rt_config.h deleted file mode 100644 index 005142dfa257..000000000000 --- a/drivers/staging/rt3090/rt_config.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rt_config.h - - Abstract: - Central header file to maintain all include files for all NDIS - miniport driver routines. - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Paul Lin 08-01-2002 created - -*/ -#ifndef __RT_CONFIG_H__ -#define __RT_CONFIG_H__ - -#include "rtmp_type.h" -#include "rtmp_os.h" - -#include "rtmp_def.h" -#include "rtmp_chip.h" -#include "rtmp_timer.h" - -#include "oid.h" -#include "mlme.h" -#include "wpa.h" -#include "crypt_md5.h" -#include "crypt_sha2.h" -#include "crypt_hmac.h" -#include "rtmp.h" -#include "ap.h" -#include "dfs.h" -#include "chlist.h" -#include "spectrum.h" - -#ifdef MLME_EX -#include "mlme_ex_def.h" -#include "mlme_ex.h" -#endif // MLME_EX // - -#include "eeprom.h" -#if defined(RTMP_PCI_SUPPORT) || defined(RTMP_USB_SUPPORT) -#include "rtmp_mcu.h" -#endif - - - -#undef AP_WSC_INCLUDED -#undef STA_WSC_INCLUDED -#undef WSC_INCLUDED - - - -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // - -#ifdef BLOCK_NET_IF -#include "netif_block.h" -#endif // BLOCK_NET_IF // - -#ifdef IGMP_SNOOP_SUPPORT -#include "igmp_snoop.h" -#endif // IGMP_SNOOP_SUPPORT // - -#ifdef RALINK_ATE -#include "rt_ate.h" -#endif // RALINK_ATE // - -#ifdef RALINK_28xx_QA -#ifndef RALINK_ATE -#error "For supporting QA GUI, please set HAS_ATE=y and HAS_28xx_QA=y." -#endif // RALINK_ATE // -#endif // RALINK_28xx_QA // - - - - -#if defined(AP_WSC_INCLUDED) || defined(STA_WSC_INCLUDED) -#define WSC_INCLUDED -#endif - - -#ifdef CONFIG_STA_SUPPORT -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT -#ifndef WPA_SUPPLICANT_SUPPORT -#error "Build for being controlled by NetworkManager or wext, please set HAS_WPA_SUPPLICANT=y and HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y" -#endif // WPA_SUPPLICANT_SUPPORT // -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - -#endif // CONFIG_STA_SUPPORT // - - - -#ifdef IKANOS_VX_1X0 -#include "vr_ikans.h" -#endif // IKANOS_VX_1X0 // - - - -#endif // __RT_CONFIG_H__ diff --git a/drivers/staging/rt3090/rt_linux.c b/drivers/staging/rt3090/rt_linux.c deleted file mode 100644 index 9b94aa6eb904..000000000000 --- a/drivers/staging/rt3090/rt_linux.c +++ /dev/null @@ -1,1624 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - */ - -#include -#include "rt_config.h" - -ULONG RTDebugLevel = RT_DEBUG_ERROR; - - -// for wireless system event message -char const *pWirelessSysEventText[IW_SYS_EVENT_TYPE_NUM] = { - // system status event - "had associated successfully", /* IW_ASSOC_EVENT_FLAG */ - "had disassociated", /* IW_DISASSOC_EVENT_FLAG */ - "had deauthenticated", /* IW_DEAUTH_EVENT_FLAG */ - "had been aged-out and disassociated", /* IW_AGEOUT_EVENT_FLAG */ - "occurred CounterMeasures attack", /* IW_COUNTER_MEASURES_EVENT_FLAG */ - "occurred replay counter different in Key Handshaking", /* IW_REPLAY_COUNTER_DIFF_EVENT_FLAG */ - "occurred RSNIE different in Key Handshaking", /* IW_RSNIE_DIFF_EVENT_FLAG */ - "occurred MIC different in Key Handshaking", /* IW_MIC_DIFF_EVENT_FLAG */ - "occurred ICV error in RX", /* IW_ICV_ERROR_EVENT_FLAG */ - "occurred MIC error in RX", /* IW_MIC_ERROR_EVENT_FLAG */ - "Group Key Handshaking timeout", /* IW_GROUP_HS_TIMEOUT_EVENT_FLAG */ - "Pairwise Key Handshaking timeout", /* IW_PAIRWISE_HS_TIMEOUT_EVENT_FLAG */ - "RSN IE sanity check failure", /* IW_RSNIE_SANITY_FAIL_EVENT_FLAG */ - "set key done in WPA/WPAPSK", /* IW_SET_KEY_DONE_WPA1_EVENT_FLAG */ - "set key done in WPA2/WPA2PSK", /* IW_SET_KEY_DONE_WPA2_EVENT_FLAG */ - "connects with our wireless client", /* IW_STA_LINKUP_EVENT_FLAG */ - "disconnects with our wireless client", /* IW_STA_LINKDOWN_EVENT_FLAG */ - "scan completed" /* IW_SCAN_COMPLETED_EVENT_FLAG */ - "scan terminate!! Busy!! Enqueue fail!!" /* IW_SCAN_ENQUEUE_FAIL_EVENT_FLAG */ - }; - -// for wireless IDS_spoof_attack event message -char const *pWirelessSpoofEventText[IW_SPOOF_EVENT_TYPE_NUM] = { - "detected conflict SSID", /* IW_CONFLICT_SSID_EVENT_FLAG */ - "detected spoofed association response", /* IW_SPOOF_ASSOC_RESP_EVENT_FLAG */ - "detected spoofed reassociation responses", /* IW_SPOOF_REASSOC_RESP_EVENT_FLAG */ - "detected spoofed probe response", /* IW_SPOOF_PROBE_RESP_EVENT_FLAG */ - "detected spoofed beacon", /* IW_SPOOF_BEACON_EVENT_FLAG */ - "detected spoofed disassociation", /* IW_SPOOF_DISASSOC_EVENT_FLAG */ - "detected spoofed authentication", /* IW_SPOOF_AUTH_EVENT_FLAG */ - "detected spoofed deauthentication", /* IW_SPOOF_DEAUTH_EVENT_FLAG */ - "detected spoofed unknown management frame", /* IW_SPOOF_UNKNOWN_MGMT_EVENT_FLAG */ - "detected replay attack" /* IW_REPLAY_ATTACK_EVENT_FLAG */ - }; - -// for wireless IDS_flooding_attack event message -char const *pWirelessFloodEventText[IW_FLOOD_EVENT_TYPE_NUM] = { - "detected authentication flooding", /* IW_FLOOD_AUTH_EVENT_FLAG */ - "detected association request flooding", /* IW_FLOOD_ASSOC_REQ_EVENT_FLAG */ - "detected reassociation request flooding", /* IW_FLOOD_REASSOC_REQ_EVENT_FLAG */ - "detected probe request flooding", /* IW_FLOOD_PROBE_REQ_EVENT_FLAG */ - "detected disassociation flooding", /* IW_FLOOD_DISASSOC_EVENT_FLAG */ - "detected deauthentication flooding", /* IW_FLOOD_DEAUTH_EVENT_FLAG */ - "detected 802.1x eap-request flooding" /* IW_FLOOD_EAP_REQ_EVENT_FLAG */ - }; - - -/* timeout -- ms */ -VOID RTMP_SetPeriodicTimer( - IN NDIS_MINIPORT_TIMER *pTimer, - IN unsigned long timeout) -{ - timeout = ((timeout*OS_HZ) / 1000); - pTimer->expires = jiffies + timeout; - add_timer(pTimer); -} - -/* convert NdisMInitializeTimer --> RTMP_OS_Init_Timer */ -VOID RTMP_OS_Init_Timer( - IN PRTMP_ADAPTER pAd, - IN NDIS_MINIPORT_TIMER *pTimer, - IN TIMER_FUNCTION function, - IN PVOID data) -{ - init_timer(pTimer); - pTimer->data = (unsigned long)data; - pTimer->function = function; -} - - -VOID RTMP_OS_Add_Timer( - IN NDIS_MINIPORT_TIMER *pTimer, - IN unsigned long timeout) -{ - if (timer_pending(pTimer)) - return; - - timeout = ((timeout*OS_HZ) / 1000); - pTimer->expires = jiffies + timeout; - add_timer(pTimer); -} - -VOID RTMP_OS_Mod_Timer( - IN NDIS_MINIPORT_TIMER *pTimer, - IN unsigned long timeout) -{ - timeout = ((timeout*OS_HZ) / 1000); - mod_timer(pTimer, jiffies + timeout); -} - -VOID RTMP_OS_Del_Timer( - IN NDIS_MINIPORT_TIMER *pTimer, - OUT BOOLEAN *pCancelled) -{ - if (timer_pending(pTimer)) - { - *pCancelled = del_timer_sync(pTimer); - } - else - { - *pCancelled = TRUE; - } - -} - -VOID RTMP_OS_Release_Packet( - IN PRTMP_ADAPTER pAd, - IN PQUEUE_ENTRY pEntry) -{ - //RTMPFreeNdisPacket(pAd, (struct sk_buff *)pEntry); -} - -// Unify all delay routine by using udelay -VOID RTMPusecDelay( - IN ULONG usec) -{ - ULONG i; - - for (i = 0; i < (usec / 50); i++) - udelay(50); - - if (usec % 50) - udelay(usec % 50); -} - -void RTMP_GetCurrentSystemTime(LARGE_INTEGER *time) -{ - time->u.LowPart = jiffies; -} - -// pAd MUST allow to be NULL -NDIS_STATUS os_alloc_mem( - IN RTMP_ADAPTER *pAd, - OUT UCHAR **mem, - IN ULONG size) -{ - *mem = (PUCHAR) kmalloc(size, GFP_ATOMIC); - if (*mem) - return (NDIS_STATUS_SUCCESS); - else - return (NDIS_STATUS_FAILURE); -} - -// pAd MUST allow to be NULL -NDIS_STATUS os_free_mem( - IN PRTMP_ADAPTER pAd, - IN PVOID mem) -{ - - ASSERT(mem); - kfree(mem); - return (NDIS_STATUS_SUCCESS); -} - - - - -PNDIS_PACKET RtmpOSNetPktAlloc( - IN RTMP_ADAPTER *pAd, - IN int size) -{ - struct sk_buff *skb; - /* Add 2 more bytes for ip header alignment*/ - skb = dev_alloc_skb(size+2); - - return ((PNDIS_PACKET)skb); -} - - -PNDIS_PACKET RTMP_AllocateFragPacketBuffer( - IN PRTMP_ADAPTER pAd, - IN ULONG Length) -{ - struct sk_buff *pkt; - - pkt = dev_alloc_skb(Length); - - if (pkt == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("can't allocate frag rx %ld size packet\n",Length)); - } - - if (pkt) - { - RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pkt), PKTSRC_NDIS); - } - - return (PNDIS_PACKET) pkt; -} - - -PNDIS_PACKET RTMP_AllocateTxPacketBuffer( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress) -{ - struct sk_buff *pkt; - - pkt = dev_alloc_skb(Length); - - if (pkt == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("can't allocate tx %ld size packet\n",Length)); - } - - if (pkt) - { - RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pkt), PKTSRC_NDIS); - *VirtualAddress = (PVOID) pkt->data; - } - else - { - *VirtualAddress = (PVOID) NULL; - } - - return (PNDIS_PACKET) pkt; -} - - -VOID build_tx_packet( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN PUCHAR pFrame, - IN ULONG FrameLen) -{ - - struct sk_buff *pTxPkt; - - ASSERT(pPacket); - pTxPkt = RTPKT_TO_OSPKT(pPacket); - - NdisMoveMemory(skb_put(pTxPkt, FrameLen), pFrame, FrameLen); -} - -VOID RTMPFreeAdapter( - IN PRTMP_ADAPTER pAd) -{ - POS_COOKIE os_cookie; - int index; - - os_cookie=(POS_COOKIE)pAd->OS_Cookie; - - if (pAd->BeaconBuf) - kfree(pAd->BeaconBuf); - - - NdisFreeSpinLock(&pAd->MgmtRingLock); - -#ifdef RTMP_MAC_PCI - NdisFreeSpinLock(&pAd->RxRingLock); -#ifdef RT3090 -NdisFreeSpinLock(&pAd->McuCmdLock); -#endif // RT3090 // -#endif // RTMP_MAC_PCI // - - for (index =0 ; index < NUM_OF_TX_RING; index++) - { - NdisFreeSpinLock(&pAd->TxSwQueueLock[index]); - NdisFreeSpinLock(&pAd->DeQueueLock[index]); - pAd->DeQueueRunning[index] = FALSE; - } - - NdisFreeSpinLock(&pAd->irq_lock); - - - vfree(pAd); // pci_free_consistent(os_cookie->pci_dev,sizeof(RTMP_ADAPTER),pAd,os_cookie->pAd_pa); - if (os_cookie) - kfree(os_cookie); -} - -BOOLEAN OS_Need_Clone_Packet(void) -{ - return (FALSE); -} - - - -/* - ======================================================================== - - Routine Description: - clone an input NDIS PACKET to another one. The new internally created NDIS PACKET - must have only one NDIS BUFFER - return - byte copied. 0 means can't create NDIS PACKET - NOTE: internally created NDIS_PACKET should be destroyed by RTMPFreeNdisPacket - - Arguments: - pAd Pointer to our adapter - pInsAMSDUHdr EWC A-MSDU format has extra 14-bytes header. if TRUE, insert this 14-byte hdr in front of MSDU. - *pSrcTotalLen return total packet length. This lenght is calculated with 802.3 format packet. - - Return Value: - NDIS_STATUS_SUCCESS - NDIS_STATUS_FAILURE - - Note: - - ======================================================================== -*/ -NDIS_STATUS RTMPCloneNdisPacket( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN pInsAMSDUHdr, - IN PNDIS_PACKET pInPacket, - OUT PNDIS_PACKET *ppOutPacket) -{ - - struct sk_buff *pkt; - - ASSERT(pInPacket); - ASSERT(ppOutPacket); - - // 1. Allocate a packet - pkt = dev_alloc_skb(2048); - - if (pkt == NULL) - { - return NDIS_STATUS_FAILURE; - } - - skb_put(pkt, GET_OS_PKT_LEN(pInPacket)); - NdisMoveMemory(pkt->data, GET_OS_PKT_DATAPTR(pInPacket), GET_OS_PKT_LEN(pInPacket)); - *ppOutPacket = OSPKT_TO_RTPKT(pkt); - - - RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pkt), PKTSRC_NDIS); - - printk("###Clone###\n"); - - return NDIS_STATUS_SUCCESS; -} - - -// the allocated NDIS PACKET must be freed via RTMPFreeNdisPacket() -NDIS_STATUS RTMPAllocateNdisPacket( - IN PRTMP_ADAPTER pAd, - OUT PNDIS_PACKET *ppPacket, - IN PUCHAR pHeader, - IN UINT HeaderLen, - IN PUCHAR pData, - IN UINT DataLen) -{ - PNDIS_PACKET pPacket; - ASSERT(pData); - ASSERT(DataLen); - - // 1. Allocate a packet - pPacket = (PNDIS_PACKET *) dev_alloc_skb(HeaderLen + DataLen + RTMP_PKT_TAIL_PADDING); - if (pPacket == NULL) - { - *ppPacket = NULL; -#ifdef DEBUG - printk("RTMPAllocateNdisPacket Fail\n\n"); -#endif - return NDIS_STATUS_FAILURE; - } - - // 2. clone the frame content - if (HeaderLen > 0) - NdisMoveMemory(GET_OS_PKT_DATAPTR(pPacket), pHeader, HeaderLen); - if (DataLen > 0) - NdisMoveMemory(GET_OS_PKT_DATAPTR(pPacket) + HeaderLen, pData, DataLen); - - // 3. update length of packet - skb_put(GET_OS_PKT_TYPE(pPacket), HeaderLen+DataLen); - - RTMP_SET_PACKET_SOURCE(pPacket, PKTSRC_NDIS); -// printk("%s : pPacket = %p, len = %d\n", __FUNCTION__, pPacket, GET_OS_PKT_LEN(pPacket)); - *ppPacket = pPacket; - return NDIS_STATUS_SUCCESS; -} - -/* - ======================================================================== - Description: - This routine frees a miniport internally allocated NDIS_PACKET and its - corresponding NDIS_BUFFER and allocated memory. - ======================================================================== -*/ -VOID RTMPFreeNdisPacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket) -{ - dev_kfree_skb_any(RTPKT_TO_OSPKT(pPacket)); -} - - -// IRQL = DISPATCH_LEVEL -// NOTE: we do have an assumption here, that Byte0 and Byte1 always reasid at the same -// scatter gather buffer -NDIS_STATUS Sniff2BytesFromNdisBuffer( - IN PNDIS_BUFFER pFirstBuffer, - IN UCHAR DesiredOffset, - OUT PUCHAR pByte0, - OUT PUCHAR pByte1) -{ - *pByte0 = *(PUCHAR)(pFirstBuffer + DesiredOffset); - *pByte1 = *(PUCHAR)(pFirstBuffer + DesiredOffset + 1); - - return NDIS_STATUS_SUCCESS; -} - - -void RTMP_QueryPacketInfo( - IN PNDIS_PACKET pPacket, - OUT PACKET_INFO *pPacketInfo, - OUT PUCHAR *pSrcBufVA, - OUT UINT *pSrcBufLen) -{ - pPacketInfo->BufferCount = 1; - pPacketInfo->pFirstBuffer = (PNDIS_BUFFER)GET_OS_PKT_DATAPTR(pPacket); - pPacketInfo->PhysicalBufferCount = 1; - pPacketInfo->TotalPacketLength = GET_OS_PKT_LEN(pPacket); - - *pSrcBufVA = GET_OS_PKT_DATAPTR(pPacket); - *pSrcBufLen = GET_OS_PKT_LEN(pPacket); -} - -void RTMP_QueryNextPacketInfo( - IN PNDIS_PACKET *ppPacket, - OUT PACKET_INFO *pPacketInfo, - OUT PUCHAR *pSrcBufVA, - OUT UINT *pSrcBufLen) -{ - PNDIS_PACKET pPacket = NULL; - - if (*ppPacket) - pPacket = GET_OS_PKT_NEXT(*ppPacket); - - if (pPacket) - { - pPacketInfo->BufferCount = 1; - pPacketInfo->pFirstBuffer = (PNDIS_BUFFER)GET_OS_PKT_DATAPTR(pPacket); - pPacketInfo->PhysicalBufferCount = 1; - pPacketInfo->TotalPacketLength = GET_OS_PKT_LEN(pPacket); - - *pSrcBufVA = GET_OS_PKT_DATAPTR(pPacket); - *pSrcBufLen = GET_OS_PKT_LEN(pPacket); - *ppPacket = GET_OS_PKT_NEXT(pPacket); - } - else - { - pPacketInfo->BufferCount = 0; - pPacketInfo->pFirstBuffer = NULL; - pPacketInfo->PhysicalBufferCount = 0; - pPacketInfo->TotalPacketLength = 0; - - *pSrcBufVA = NULL; - *pSrcBufLen = 0; - *ppPacket = NULL; - } -} - - -PNDIS_PACKET DuplicatePacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN UCHAR FromWhichBSSID) -{ - struct sk_buff *skb; - PNDIS_PACKET pRetPacket = NULL; - USHORT DataSize; - UCHAR *pData; - - DataSize = (USHORT) GET_OS_PKT_LEN(pPacket); - pData = (PUCHAR) GET_OS_PKT_DATAPTR(pPacket); - - - skb = skb_clone(RTPKT_TO_OSPKT(pPacket), MEM_ALLOC_FLAG); - if (skb) - { - skb->dev = get_netdev_from_bssid(pAd, FromWhichBSSID); - pRetPacket = OSPKT_TO_RTPKT(skb); - } - - - return pRetPacket; - -} - -PNDIS_PACKET duplicate_pkt( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, - IN ULONG DataSize, - IN UCHAR FromWhichBSSID) -{ - struct sk_buff *skb; - PNDIS_PACKET pPacket = NULL; - - - if ((skb = __dev_alloc_skb(HdrLen + DataSize + 2, MEM_ALLOC_FLAG)) != NULL) - { - skb_reserve(skb, 2); - NdisMoveMemory(skb_tail_pointer(skb), pHeader802_3, HdrLen); - skb_put(skb, HdrLen); - NdisMoveMemory(skb_tail_pointer(skb), pData, DataSize); - skb_put(skb, DataSize); - skb->dev = get_netdev_from_bssid(pAd, FromWhichBSSID); - pPacket = OSPKT_TO_RTPKT(skb); - } - - return pPacket; -} - - -#define TKIP_TX_MIC_SIZE 8 -PNDIS_PACKET duplicate_pkt_with_TKIP_MIC( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket) -{ - struct sk_buff *skb, *newskb; - - - skb = RTPKT_TO_OSPKT(pPacket); - if (skb_tailroom(skb) < TKIP_TX_MIC_SIZE) - { - // alloc a new skb and copy the packet - newskb = skb_copy_expand(skb, skb_headroom(skb), TKIP_TX_MIC_SIZE, GFP_ATOMIC); - dev_kfree_skb_any(skb); - if (newskb == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("Extend Tx.MIC for packet failed!, dropping packet!\n")); - return NULL; - } - skb = newskb; - } - - return OSPKT_TO_RTPKT(skb); - - -} - - - - -PNDIS_PACKET ClonePacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN PUCHAR pData, - IN ULONG DataSize) -{ - struct sk_buff *pRxPkt; - struct sk_buff *pClonedPkt; - - ASSERT(pPacket); - pRxPkt = RTPKT_TO_OSPKT(pPacket); - - // clone the packet - pClonedPkt = skb_clone(pRxPkt, MEM_ALLOC_FLAG); - - if (pClonedPkt) - { - // set the correct dataptr and data len - pClonedPkt->dev = pRxPkt->dev; - pClonedPkt->data = pData; - pClonedPkt->len = DataSize; - pClonedPkt->tail = pClonedPkt->data + pClonedPkt->len; - ASSERT(DataSize < 1530); - } - return pClonedPkt; -} - -// -// change OS packet DataPtr and DataLen -// -void update_os_packet_info( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) -{ - struct sk_buff *pOSPkt; - - ASSERT(pRxBlk->pRxPacket); - pOSPkt = RTPKT_TO_OSPKT(pRxBlk->pRxPacket); - - pOSPkt->dev = get_netdev_from_bssid(pAd, FromWhichBSSID); - pOSPkt->data = pRxBlk->pData; - pOSPkt->len = pRxBlk->DataSize; - pOSPkt->tail = pOSPkt->data + pOSPkt->len; -} - - -void wlan_802_11_to_802_3_packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN PUCHAR pHeader802_3, - IN UCHAR FromWhichBSSID) -{ - struct sk_buff *pOSPkt; - - ASSERT(pRxBlk->pRxPacket); - ASSERT(pHeader802_3); - - pOSPkt = RTPKT_TO_OSPKT(pRxBlk->pRxPacket); - - pOSPkt->dev = get_netdev_from_bssid(pAd, FromWhichBSSID); - pOSPkt->data = pRxBlk->pData; - pOSPkt->len = pRxBlk->DataSize; - pOSPkt->tail = pOSPkt->data + pOSPkt->len; - - // - // copy 802.3 header - // - // - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - NdisMoveMemory(skb_push(pOSPkt, LENGTH_802_3), pHeader802_3, LENGTH_802_3); -#endif // CONFIG_STA_SUPPORT // - } - - - -void announce_802_3_packet( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket) -{ - - struct sk_buff *pRxPkt; -#ifdef INF_AMAZON_PPA - int ret = 0; - unsigned int ppa_flags = 0; /* reserved for now */ -#endif // INF_AMAZON_PPA // - - ASSERT(pPacket); - - pRxPkt = RTPKT_TO_OSPKT(pPacket); - -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // - - /* Push up the protocol stack */ -#ifdef IKANOS_VX_1X0 - IKANOS_DataFrameRx(pAd, pRxPkt->dev, pRxPkt, pRxPkt->len); -#else -#ifdef INF_AMAZON_SE -#ifdef BG_FT_SUPPORT - BG_FTPH_PacketFromApHandle(pRxPkt); - return; -#endif // BG_FT_SUPPORT // -#endif // INF_AMAZON_SE // - pRxPkt->protocol = eth_type_trans(pRxPkt, pRxPkt->dev); - -#ifdef INF_AMAZON_PPA - if (ppa_hook_directpath_send_fn && pAd->PPAEnable==TRUE ) - { - memset(pRxPkt->head,0,pRxPkt->data-pRxPkt->head-14); - DBGPRINT(RT_DEBUG_TRACE, ("ppa_hook_directpath_send_fn rx :ret:%d headroom:%d dev:%s pktlen:%d<===\n",ret,skb_headroom(pRxPkt) - ,pRxPkt->dev->name,pRxPkt->len)); - hex_dump("rx packet", pRxPkt->data, 32); - ret = ppa_hook_directpath_send_fn(pAd->g_if_id, pRxPkt, pRxPkt->len, ppa_flags); - pRxPkt=NULL; - return; - - } -#endif // INF_AMAZON_PPA // - -//#ifdef CONFIG_5VT_ENHANCE -// *(int*)(pRxPkt->cb) = BRIDGE_TAG; -//#endif - - { - netif_rx(pRxPkt); - } - -#endif // IKANOS_VX_1X0 // -} - - -PRTMP_SCATTER_GATHER_LIST -rt_get_sg_list_from_packet(PNDIS_PACKET pPacket, RTMP_SCATTER_GATHER_LIST *sg) -{ - sg->NumberOfElements = 1; - sg->Elements[0].Address = GET_OS_PKT_DATAPTR(pPacket); - sg->Elements[0].Length = GET_OS_PKT_LEN(pPacket); - return (sg); -} - -void hex_dump(char *str, unsigned char *pSrcBufVA, unsigned int SrcBufLen) -{ - unsigned char *pt; - int x; - - if (RTDebugLevel < RT_DEBUG_TRACE) - return; - - pt = pSrcBufVA; - printk("%s: %p, len = %d\n",str, pSrcBufVA, SrcBufLen); - for (x=0; x= 15 - - //union iwreq_data wrqu; - PSTRING pBuf = NULL, pBufPtr = NULL; - USHORT event, type, BufLen; - UCHAR event_table_len = 0; - - type = Event_flag & 0xFF00; - event = Event_flag & 0x00FF; - - switch (type) - { - case IW_SYS_EVENT_FLAG_START: - event_table_len = IW_SYS_EVENT_TYPE_NUM; - break; - - case IW_SPOOF_EVENT_FLAG_START: - event_table_len = IW_SPOOF_EVENT_TYPE_NUM; - break; - - case IW_FLOOD_EVENT_FLAG_START: - event_table_len = IW_FLOOD_EVENT_TYPE_NUM; - break; - } - - if (event_table_len == 0) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s : The type(%0x02x) is not valid.\n", __FUNCTION__, type)); - return; - } - - if (event >= event_table_len) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s : The event(%0x02x) is not valid.\n", __FUNCTION__, event)); - return; - } - - //Allocate memory and copy the msg. - if((pBuf = kmalloc(IW_CUSTOM_MAX_LEN, GFP_ATOMIC)) != NULL) - { - //Prepare the payload - memset(pBuf, 0, IW_CUSTOM_MAX_LEN); - - pBufPtr = pBuf; - - if (pAddr) - pBufPtr += sprintf(pBufPtr, "(RT2860) STA(%02x:%02x:%02x:%02x:%02x:%02x) ", PRINT_MAC(pAddr)); - else if (BssIdx < MAX_MBSSID_NUM) - pBufPtr += sprintf(pBufPtr, "(RT2860) BSS(ra%d) ", BssIdx); - else - pBufPtr += sprintf(pBufPtr, "(RT2860) "); - - if (type == IW_SYS_EVENT_FLAG_START) - pBufPtr += sprintf(pBufPtr, "%s", pWirelessSysEventText[event]); - else if (type == IW_SPOOF_EVENT_FLAG_START) - pBufPtr += sprintf(pBufPtr, "%s (RSSI=%d)", pWirelessSpoofEventText[event], Rssi); - else if (type == IW_FLOOD_EVENT_FLAG_START) - pBufPtr += sprintf(pBufPtr, "%s", pWirelessFloodEventText[event]); - else - pBufPtr += sprintf(pBufPtr, "%s", "unknown event"); - - pBufPtr[pBufPtr - pBuf] = '\0'; - BufLen = pBufPtr - pBuf; - - RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, Event_flag, NULL, (PUCHAR)pBuf, BufLen); - //DBGPRINT(RT_DEBUG_TRACE, ("%s : %s\n", __FUNCTION__, pBuf)); - - kfree(pBuf); - } - else - DBGPRINT(RT_DEBUG_ERROR, ("%s : Can't allocate memory for wireless event.\n", __FUNCTION__)); -#else - DBGPRINT(RT_DEBUG_ERROR, ("%s : The Wireless Extension MUST be v15 or newer.\n", __FUNCTION__)); -#endif /* WIRELESS_EXT >= 15 */ -} - - - - -#ifdef CONFIG_STA_SUPPORT -void send_monitor_packets( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk) -{ - struct sk_buff *pOSPkt; - wlan_ng_prism2_header *ph; - int rate_index = 0; - USHORT header_len = 0; - UCHAR temp_header[40] = {0}; - - u_int32_t ralinkrate[256] = {2,4,11,22, 12,18,24,36,48,72,96, 108, 109, 110, 111, 112, 13, 26, 39, 52,78,104, 117, 130, 26, 52, 78,104, 156, 208, 234, 260, 27, 54,81,108,162, 216, 243, 270, // Last 38 - 54, 108, 162, 216, 324, 432, 486, 540, 14, 29, 43, 57, 87, 115, 130, 144, 29, 59,87,115, 173, 230,260, 288, 30, 60,90,120,180,240,270,300,60,120,180,240,360,480,540,600, 0,1,2,3,4,5,6,7,8,9,10, - 11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80}; - - - ASSERT(pRxBlk->pRxPacket); - if (pRxBlk->DataSize < 10) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s : Size is too small! (%d)\n", __FUNCTION__, pRxBlk->DataSize)); - goto err_free_sk_buff; - } - - if (pRxBlk->DataSize + sizeof(wlan_ng_prism2_header) > RX_BUFFER_AGGRESIZE) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s : Size is too large! (%d)\n", __FUNCTION__, pRxBlk->DataSize + sizeof(wlan_ng_prism2_header))); - goto err_free_sk_buff; - } - - pOSPkt = RTPKT_TO_OSPKT(pRxBlk->pRxPacket); - pOSPkt->dev = get_netdev_from_bssid(pAd, BSS0); - if (pRxBlk->pHeader->FC.Type == BTYPE_DATA) - { - pRxBlk->DataSize -= LENGTH_802_11; - if ((pRxBlk->pHeader->FC.ToDs == 1) && - (pRxBlk->pHeader->FC.FrDs == 1)) - header_len = LENGTH_802_11_WITH_ADDR4; - else - header_len = LENGTH_802_11; - - // QOS - if (pRxBlk->pHeader->FC.SubType & 0x08) - { - header_len += 2; - // Data skip QOS contorl field - pRxBlk->DataSize -=2; - } - - // Order bit: A-Ralink or HTC+ - if (pRxBlk->pHeader->FC.Order) - { - header_len += 4; - // Data skip HTC contorl field - pRxBlk->DataSize -= 4; - } - - // Copy Header - if (header_len <= 40) - NdisMoveMemory(temp_header, pRxBlk->pData, header_len); - - // skip HW padding - if (pRxBlk->RxD.L2PAD) - pRxBlk->pData += (header_len + 2); - else - pRxBlk->pData += header_len; - } //end if - - - if (pRxBlk->DataSize < pOSPkt->len) { - skb_trim(pOSPkt,pRxBlk->DataSize); - } else { - skb_put(pOSPkt,(pRxBlk->DataSize - pOSPkt->len)); - } //end if - - if ((pRxBlk->pData - pOSPkt->data) > 0) { - skb_put(pOSPkt,(pRxBlk->pData - pOSPkt->data)); - skb_pull(pOSPkt,(pRxBlk->pData - pOSPkt->data)); - } //end if - - if (skb_headroom(pOSPkt) < (sizeof(wlan_ng_prism2_header)+ header_len)) { - if (pskb_expand_head(pOSPkt, (sizeof(wlan_ng_prism2_header) + header_len), 0, GFP_ATOMIC)) { - DBGPRINT(RT_DEBUG_ERROR, ("%s : Reallocate header size of sk_buff fail!\n", __FUNCTION__)); - goto err_free_sk_buff; - } //end if - } //end if - - if (header_len > 0) - NdisMoveMemory(skb_push(pOSPkt, header_len), temp_header, header_len); - - ph = (wlan_ng_prism2_header *) skb_push(pOSPkt, sizeof(wlan_ng_prism2_header)); - NdisZeroMemory(ph, sizeof(wlan_ng_prism2_header)); - - ph->msgcode = DIDmsg_lnxind_wlansniffrm; - ph->msglen = sizeof(wlan_ng_prism2_header); - strcpy((PSTRING) ph->devname, (PSTRING) pAd->net_dev->name); - - ph->hosttime.did = DIDmsg_lnxind_wlansniffrm_hosttime; - ph->hosttime.status = 0; - ph->hosttime.len = 4; - ph->hosttime.data = jiffies; - - ph->mactime.did = DIDmsg_lnxind_wlansniffrm_mactime; - ph->mactime.status = 0; - ph->mactime.len = 0; - ph->mactime.data = 0; - - ph->istx.did = DIDmsg_lnxind_wlansniffrm_istx; - ph->istx.status = 0; - ph->istx.len = 0; - ph->istx.data = 0; - - ph->channel.did = DIDmsg_lnxind_wlansniffrm_channel; - ph->channel.status = 0; - ph->channel.len = 4; - - ph->channel.data = (u_int32_t)pAd->CommonCfg.Channel; - - ph->rssi.did = DIDmsg_lnxind_wlansniffrm_rssi; - ph->rssi.status = 0; - ph->rssi.len = 4; - ph->rssi.data = (u_int32_t)RTMPMaxRssi(pAd, ConvertToRssi(pAd, pRxBlk->pRxWI->RSSI0, RSSI_0), ConvertToRssi(pAd, pRxBlk->pRxWI->RSSI1, RSSI_1), ConvertToRssi(pAd, pRxBlk->pRxWI->RSSI2, RSSI_2));; - - ph->signal.did = DIDmsg_lnxind_wlansniffrm_signal; - ph->signal.status = 0; - ph->signal.len = 4; - ph->signal.data = 0; //rssi + noise; - - ph->noise.did = DIDmsg_lnxind_wlansniffrm_noise; - ph->noise.status = 0; - ph->noise.len = 4; - ph->noise.data = 0; - -#ifdef DOT11_N_SUPPORT - if (pRxBlk->pRxWI->PHYMODE >= MODE_HTMIX) - { - rate_index = 16 + ((UCHAR)pRxBlk->pRxWI->BW *16) + ((UCHAR)pRxBlk->pRxWI->ShortGI *32) + ((UCHAR)pRxBlk->pRxWI->MCS); - } - else -#endif // DOT11_N_SUPPORT // - if (pRxBlk->pRxWI->PHYMODE == MODE_OFDM) - rate_index = (UCHAR)(pRxBlk->pRxWI->MCS) + 4; - else - rate_index = (UCHAR)(pRxBlk->pRxWI->MCS); - if (rate_index < 0) - rate_index = 0; - if (rate_index > 255) - rate_index = 255; - - ph->rate.did = DIDmsg_lnxind_wlansniffrm_rate; - ph->rate.status = 0; - ph->rate.len = 4; - ph->rate.data = ralinkrate[rate_index]; - - ph->frmlen.did = DIDmsg_lnxind_wlansniffrm_frmlen; - ph->frmlen.status = 0; - ph->frmlen.len = 4; - ph->frmlen.data = (u_int32_t)pRxBlk->DataSize; - - - pOSPkt->pkt_type = PACKET_OTHERHOST; - pOSPkt->protocol = eth_type_trans(pOSPkt, pOSPkt->dev); - pOSPkt->ip_summed = CHECKSUM_NONE; - netif_rx(pOSPkt); - - return; - -err_free_sk_buff: - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); - return; - -} -#endif // CONFIG_STA_SUPPORT // - - - -/******************************************************************************* - - File open/close related functions. - - *******************************************************************************/ -RTMP_OS_FD RtmpOSFileOpen(char *pPath, int flag, int mode) -{ - struct file *filePtr; - - filePtr = filp_open(pPath, flag, 0); - if (IS_ERR(filePtr)) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s(): Error %ld opening %s\n", __FUNCTION__, -PTR_ERR(filePtr), pPath)); - } - - return (RTMP_OS_FD)filePtr; -} - -int RtmpOSFileClose(RTMP_OS_FD osfd) -{ - filp_close(osfd, NULL); - return 0; -} - - -void RtmpOSFileSeek(RTMP_OS_FD osfd, int offset) -{ - osfd->f_pos = offset; -} - - -int RtmpOSFileRead(RTMP_OS_FD osfd, char *pDataPtr, int readLen) -{ - // The object must have a read method - if (osfd->f_op && osfd->f_op->read) - { - return osfd->f_op->read(osfd, pDataPtr, readLen, &osfd->f_pos); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("no file read method\n")); - return -1; - } -} - - -int RtmpOSFileWrite(RTMP_OS_FD osfd, char *pDataPtr, int writeLen) -{ - return osfd->f_op->write(osfd, pDataPtr, (size_t)writeLen, &osfd->f_pos); -} - - -void RtmpOSFSInfoChange(RTMP_OS_FS_INFO *pOSFSInfo, BOOLEAN bSet) -{ - if (bSet) - { - // Save uid and gid used for filesystem access. - // Set user and group to 0 (root) -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) - pOSFSInfo->fsuid= current->fsuid; - pOSFSInfo->fsgid = current->fsgid; - current->fsuid = current->fsgid = 0; -#else - pOSFSInfo->fsuid = current_fsuid(); - pOSFSInfo->fsgid = current_fsgid(); -#endif - pOSFSInfo->fs = get_fs(); - set_fs(KERNEL_DS); - } - else - { - set_fs(pOSFSInfo->fs); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) - current->fsuid = pOSFSInfo->fsuid; - current->fsgid = pOSFSInfo->fsgid; -#endif - } -} - - - -/******************************************************************************* - - Task create/management/kill related functions. - - *******************************************************************************/ -NDIS_STATUS RtmpOSTaskKill( - IN RTMP_OS_TASK *pTask) -{ - RTMP_ADAPTER *pAd; - int ret = NDIS_STATUS_FAILURE; - - pAd = (RTMP_ADAPTER *)pTask->priv; - -#ifdef KTHREAD_SUPPORT - if (pTask->kthread_task) - { - kthread_stop(pTask->kthread_task); - ret = NDIS_STATUS_SUCCESS; - } -#else - CHECK_PID_LEGALITY(pTask->taskPID) - { - printk("Terminate the task(%s) with pid(%d)!\n", pTask->taskName, GET_PID_NUMBER(pTask->taskPID)); - mb(); - pTask->task_killed = 1; - mb(); - ret = KILL_THREAD_PID(pTask->taskPID, SIGTERM, 1); - if (ret) - { - printk(KERN_WARNING "kill task(%s) with pid(%d) failed(retVal=%d)!\n", - pTask->taskName, GET_PID_NUMBER(pTask->taskPID), ret); - } - else - { - wait_for_completion(&pTask->taskComplete); - pTask->taskPID = THREAD_PID_INIT_VALUE; - pTask->task_killed = 0; - ret = NDIS_STATUS_SUCCESS; - } - } -#endif - - return ret; - -} - - -INT RtmpOSTaskNotifyToExit( - IN RTMP_OS_TASK *pTask) -{ - -#ifndef KTHREAD_SUPPORT - complete_and_exit(&pTask->taskComplete, 0); -#endif - - return 0; -} - - -void RtmpOSTaskCustomize( - IN RTMP_OS_TASK *pTask) -{ - -#ifndef KTHREAD_SUPPORT - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) - daemonize((PSTRING)&pTask->taskName[0]/*"%s",pAd->net_dev->name*/); - - allow_signal(SIGTERM); - allow_signal(SIGKILL); - current->flags |= PF_NOFREEZE; -#else - unsigned long flags; - - daemonize(); - reparent_to_init(); - strcpy(current->comm, &pTask->taskName[0]); - - siginitsetinv(¤t->blocked, sigmask(SIGTERM) | sigmask(SIGKILL)); - - /* Allow interception of SIGKILL only - * Don't allow other signals to interrupt the transmission */ -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) - spin_lock_irqsave(¤t->sigmask_lock, flags); - flush_signals(current); - recalc_sigpending(current); - spin_unlock_irqrestore(¤t->sigmask_lock, flags); -#endif -#endif - - /* signal that we've started the thread */ - complete(&pTask->taskComplete); - -#endif -} - - -NDIS_STATUS RtmpOSTaskAttach( - IN RTMP_OS_TASK *pTask, - IN int (*fn)(void *), - IN void *arg) -{ - NDIS_STATUS status = NDIS_STATUS_SUCCESS; - pid_t pid_number = -1; - -#ifdef KTHREAD_SUPPORT - pTask->task_killed = 0; - pTask->kthread_task = NULL; - pTask->kthread_task = kthread_run(fn, arg, pTask->taskName); - if (IS_ERR(pTask->kthread_task)) - status = NDIS_STATUS_FAILURE; -#else - pid_number = kernel_thread(fn, arg, RTMP_OS_MGMT_TASK_FLAGS); - if (pid_number < 0) - { - DBGPRINT (RT_DEBUG_ERROR, ("Attach task(%s) failed!\n", pTask->taskName)); - status = NDIS_STATUS_FAILURE; - } - else - { - pTask->taskPID = GET_PID(pid_number); - - // Wait for the thread to start - wait_for_completion(&pTask->taskComplete); - status = NDIS_STATUS_SUCCESS; - } -#endif - return status; -} - - -NDIS_STATUS RtmpOSTaskInit( - IN RTMP_OS_TASK *pTask, - IN PSTRING pTaskName, - IN VOID *pPriv) -{ - int len; - - ASSERT(pTask); - -#ifndef KTHREAD_SUPPORT - NdisZeroMemory((PUCHAR)(pTask), sizeof(RTMP_OS_TASK)); -#endif - - len = strlen(pTaskName); - len = len > (RTMP_OS_TASK_NAME_LEN -1) ? (RTMP_OS_TASK_NAME_LEN-1) : len; - NdisMoveMemory(&pTask->taskName[0], pTaskName, len); - pTask->priv = pPriv; - -#ifndef KTHREAD_SUPPORT - RTMP_SEM_EVENT_INIT_LOCKED(&(pTask->taskSema)); - pTask->taskPID = THREAD_PID_INIT_VALUE; - - init_completion (&pTask->taskComplete); -#endif - - return NDIS_STATUS_SUCCESS; -} - - -void RTMP_IndicateMediaState( - IN PRTMP_ADAPTER pAd) -{ - if (pAd->CommonCfg.bWirelessEvent) - { - if (pAd->IndicateMediaState == NdisMediaStateConnected) - { - RTMPSendWirelessEvent(pAd, IW_STA_LINKUP_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - } - else - { - RTMPSendWirelessEvent(pAd, IW_STA_LINKDOWN_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - } - } -} - - -#if LINUX_VERSION_CODE <= 0x20402 // Red Hat 7.1 -//static struct net_device *alloc_netdev(int sizeof_priv, const char *mask, void (*setup)(struct net_device *)) //sample -struct net_device *alloc_netdev( - int sizeof_priv, - const char *mask, - void (*setup)(struct net_device *)) -{ - struct net_device *dev; - INT alloc_size; - - - /* ensure 32-byte alignment of the private area */ - alloc_size = sizeof (*dev) + sizeof_priv + 31; - - dev = (struct net_device *) kmalloc(alloc_size, GFP_KERNEL); - if (dev == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, - ("alloc_netdev: Unable to allocate device memory.\n")); - return NULL; - } - - memset(dev, 0, alloc_size); - - if (sizeof_priv) - dev->priv = (void *) (((long)(dev + 1) + 31) & ~31); - - setup(dev); - strcpy(dev->name, mask); - - return dev; -} -#endif // LINUX_VERSION_CODE // - - -int RtmpOSWrielessEventSend( - IN RTMP_ADAPTER *pAd, - IN UINT32 eventType, - IN INT flags, - IN PUCHAR pSrcMac, - IN PUCHAR pData, - IN UINT32 dataLen) -{ - union iwreq_data wrqu; - - memset(&wrqu, 0, sizeof(wrqu)); - - if (flags>-1) - wrqu.data.flags = flags; - - if (pSrcMac) - memcpy(wrqu.ap_addr.sa_data, pSrcMac, MAC_ADDR_LEN); - - if ((pData!= NULL) && (dataLen > 0)) - wrqu.data.length = dataLen; - - wireless_send_event(pAd->net_dev, eventType, &wrqu, (char *)pData); - return 0; -} - - -int RtmpOSNetDevAddrSet( - IN PNET_DEV pNetDev, - IN PUCHAR pMacAddr) -{ - struct net_device *net_dev; - RTMP_ADAPTER *pAd; - - net_dev = pNetDev; - //pAd = (RTMP_ADAPTER *)net_dev->priv; - pAd=RTMP_OS_NETDEV_GET_PRIV(pNetDev); - -#ifdef CONFIG_STA_SUPPORT - // work-around for the SuSE due to it has it's own interface name management system. - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - NdisZeroMemory(pAd->StaCfg.dev_name, 16); - NdisMoveMemory(pAd->StaCfg.dev_name, net_dev->name, strlen(net_dev->name)); - } -#endif // CONFIG_STA_SUPPORT // - - NdisMoveMemory(net_dev->dev_addr, pMacAddr, 6); - - return 0; -} - - - -/* - * Assign the network dev name for created Ralink WiFi interface. - */ -static int RtmpOSNetDevRequestName( - IN RTMP_ADAPTER *pAd, - IN PNET_DEV dev, - IN PSTRING pPrefixStr, - IN INT devIdx) -{ - PNET_DEV existNetDev; - STRING suffixName[IFNAMSIZ]; - STRING desiredName[IFNAMSIZ]; - int ifNameIdx, prefixLen, slotNameLen; - int Status; - - - prefixLen = strlen(pPrefixStr); - ASSERT((prefixLen < IFNAMSIZ)); - - for (ifNameIdx = devIdx; ifNameIdx < 32; ifNameIdx++) - { - memset(suffixName, 0, IFNAMSIZ); - memset(desiredName, 0, IFNAMSIZ); - strncpy(&desiredName[0], pPrefixStr, prefixLen); - -#ifdef MULTIPLE_CARD_SUPPORT - if (pAd->MC_RowID >= 0) - sprintf(suffixName, "%02d_%d", pAd->MC_RowID, ifNameIdx); - else -#endif // MULTIPLE_CARD_SUPPORT // - sprintf(suffixName, "%d", ifNameIdx); - - slotNameLen = strlen(suffixName); - ASSERT(((slotNameLen + prefixLen) < IFNAMSIZ)); - strcat(desiredName, suffixName); - - existNetDev = RtmpOSNetDevGetByName(dev, &desiredName[0]); - if (existNetDev == NULL) - break; - else - RtmpOSNetDeviceRefPut(existNetDev); - } - - if(ifNameIdx < 32) - { - strcpy(&dev->name[0], &desiredName[0]); - Status = NDIS_STATUS_SUCCESS; - } - else - { - DBGPRINT(RT_DEBUG_ERROR, - ("Cannot request DevName with preifx(%s) and in range(0~32) as suffix from OS!\n", pPrefixStr)); - Status = NDIS_STATUS_FAILURE; - } - - return Status; -} - - -void RtmpOSNetDevClose( - IN PNET_DEV pNetDev) -{ - dev_close(pNetDev); -} - - -void RtmpOSNetDevFree(PNET_DEV pNetDev) -{ - ASSERT(pNetDev); - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) - free_netdev(pNetDev); -#else - kfree(pNetDev); -#endif -} - - -INT RtmpOSNetDevAlloc( - IN PNET_DEV *new_dev_p, - IN UINT32 privDataSize) -{ - // assign it as null first. - *new_dev_p = NULL; - - DBGPRINT(RT_DEBUG_TRACE, ("Allocate a net device with private data size=%d!\n", privDataSize)); -#if LINUX_VERSION_CODE <= 0x20402 // Red Hat 7.1 - *new_dev_p = alloc_netdev(privDataSize, "eth%d", ether_setup); -#else - *new_dev_p = alloc_etherdev(privDataSize); -#endif // LINUX_VERSION_CODE // - - if (*new_dev_p) - return NDIS_STATUS_SUCCESS; - else - return NDIS_STATUS_FAILURE; -} - - -PNET_DEV RtmpOSNetDevGetByName(PNET_DEV pNetDev, PSTRING pDevName) -{ - PNET_DEV pTargetNetDev = NULL; - - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) - pTargetNetDev = dev_get_by_name(dev_net(pNetDev), pDevName); -#else - ASSERT(pNetDev); - pTargetNetDev = dev_get_by_name(pNetDev->nd_net, pDevName); -#endif -#else - pTargetNetDev = dev_get_by_name(pDevName); -#endif // KERNEL_VERSION(2,6,24) // - -#else - int devNameLen; - - devNameLen = strlen(pDevName); - ASSERT((devNameLen <= IFNAMSIZ)); - - for(pTargetNetDev=dev_base; pTargetNetDev!=NULL; pTargetNetDev=pTargetNetDev->next) - { - if (strncmp(pTargetNetDev->name, pDevName, devNameLen) == 0) - break; - } -#endif // KERNEL_VERSION(2,5,0) // - - return pTargetNetDev; -} - - -void RtmpOSNetDeviceRefPut(PNET_DEV pNetDev) -{ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) - /* - every time dev_get_by_name is called, and it has returned a valid struct - net_device*, dev_put should be called afterwards, because otherwise the - machine hangs when the device is unregistered (since dev->refcnt > 1). - */ - if(pNetDev) - dev_put(pNetDev); -#endif // LINUX_VERSION_CODE // -} - - -INT RtmpOSNetDevDestory( - IN RTMP_ADAPTER *pAd, - IN PNET_DEV pNetDev) -{ - - // TODO: Need to fix this - printk("WARNING: This function(%s) not implement yet!!!\n", __FUNCTION__); - return 0; -} - - -void RtmpOSNetDevDetach(PNET_DEV pNetDev) -{ - unregister_netdev(pNetDev); -} - - -int RtmpOSNetDevAttach( - IN PNET_DEV pNetDev, - IN RTMP_OS_NETDEV_OP_HOOK *pDevOpHook) -{ - int ret, rtnl_locked = FALSE; - - DBGPRINT(RT_DEBUG_TRACE, ("RtmpOSNetDevAttach()--->\n")); - // If we need hook some callback function to the net device structrue, now do it. - if (pDevOpHook) - { - PRTMP_ADAPTER pAd = RTMP_OS_NETDEV_GET_PRIV(pNetDev); - - pNetDev->netdev_ops = pDevOpHook->netdev_ops; - - /* OS specific flags, here we used to indicate if we are virtual interface */ - pNetDev->priv_flags = pDevOpHook->priv_flags; - -#if (WIRELESS_EXT < 21) && (WIRELESS_EXT >= 12) - pNetDev->get_wireless_stats = rt28xx_get_wireless_stats; -#endif - -#ifdef CONFIG_STA_SUPPORT -#if WIRELESS_EXT >= 12 - if (pAd->OpMode == OPMODE_STA) - { - pNetDev->wireless_handlers = &rt28xx_iw_handler_def; - } -#endif //WIRELESS_EXT >= 12 -#endif // CONFIG_STA_SUPPORT // - -#ifdef CONFIG_APSTA_MIXED_SUPPORT -#if WIRELESS_EXT >= 12 - if (pAd->OpMode == OPMODE_AP) - { - pNetDev->wireless_handlers = &rt28xx_ap_iw_handler_def; - } -#endif //WIRELESS_EXT >= 12 -#endif // CONFIG_APSTA_MIXED_SUPPORT // - - // copy the net device mac address to the net_device structure. - NdisMoveMemory(pNetDev->dev_addr, &pDevOpHook->devAddr[0], MAC_ADDR_LEN); - - rtnl_locked = pDevOpHook->needProtcted; - } - - if (rtnl_locked) - ret = register_netdevice(pNetDev); - else - ret = register_netdev(pNetDev); - - DBGPRINT(RT_DEBUG_TRACE, ("<---RtmpOSNetDevAttach(), ret=%d\n", ret)); - if (ret == 0) - return NDIS_STATUS_SUCCESS; - else - return NDIS_STATUS_FAILURE; -} - - -PNET_DEV RtmpOSNetDevCreate( - IN RTMP_ADAPTER *pAd, - IN INT devType, - IN INT devNum, - IN INT privMemSize, - IN PSTRING pNamePrefix) -{ - struct net_device *pNetDev = NULL; - int status; - - - /* allocate a new network device */ - status = RtmpOSNetDevAlloc(&pNetDev, 0 /*privMemSize*/); - if (status != NDIS_STATUS_SUCCESS) - { - /* allocation fail, exit */ - DBGPRINT(RT_DEBUG_ERROR, ("Allocate network device fail (%s)...\n", pNamePrefix)); - return NULL; - } - - - /* find a available interface name, max 32 interfaces */ - status = RtmpOSNetDevRequestName(pAd, pNetDev, pNamePrefix, devNum); - if (status != NDIS_STATUS_SUCCESS) - { - /* error! no any available ra name can be used! */ - DBGPRINT(RT_DEBUG_ERROR, ("Assign interface name (%s with suffix 0~32) failed...\n", pNamePrefix)); - RtmpOSNetDevFree(pNetDev); - - return NULL; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("The name of the new %s interface is %s...\n", pNamePrefix, pNetDev->name)); - } - - return pNetDev; -} diff --git a/drivers/staging/rt3090/rt_linux.h b/drivers/staging/rt3090/rt_linux.h deleted file mode 100644 index a970e780ef27..000000000000 --- a/drivers/staging/rt3090/rt_linux.h +++ /dev/null @@ -1,1034 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rt_linux.h - - Abstract: - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- -*/ - -#ifndef __RT_LINUX_H__ -#define __RT_LINUX_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef INF_AMAZON_PPA -#include -#include -#endif // INF_AMAZON_PPA // - -// load firmware -#define __KERNEL_SYSCALLS__ -#include -#include -#include -#include // for get_unaligned() - -#ifdef KTHREAD_SUPPORT -#include -#include -#endif // KTHREAD_SUPPORT // - -#undef AP_WSC_INCLUDED -#undef STA_WSC_INCLUDED -#undef WSC_INCLUDED - - -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // - - -#ifdef KTHREAD_SUPPORT -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4) -#error "This kerne version doesn't support kthread!!" -#endif -#endif // KTHREAD_SUPPORT // - -/*********************************************************************************** - * Profile related sections - ***********************************************************************************/ - - -#ifdef CONFIG_STA_SUPPORT -#ifdef RTMP_MAC_PCI -#define STA_PROFILE_PATH "/etc/Wireless/RT2860STA/RT2860STA.dat" -#define STA_DRIVER_VERSION "2.1.0.0" -#ifdef MULTIPLE_CARD_SUPPORT -#define CARD_INFO_PATH "/etc/Wireless/RT2860STA/RT2860STACard.dat" -#endif // MULTIPLE_CARD_SUPPORT // -#endif // RTMP_MAC_PCI // - - - -extern const struct iw_handler_def rt28xx_iw_handler_def; -#endif // CONFIG_STA_SUPPORT // - -#ifdef CONFIG_APSTA_MIXED_SUPPORT -extern const struct iw_handler_def rt28xx_ap_iw_handler_def; -#endif // CONFIG_APSTA_MIXED_SUPPORT // - -/*********************************************************************************** - * Compiler related definitions - ***********************************************************************************/ -#undef __inline -#define __inline static inline -#define IN -#define OUT -#define INOUT -#define NDIS_STATUS INT - - -/*********************************************************************************** - * OS Specific definitions and data structures - ***********************************************************************************/ -typedef struct pci_dev * PPCI_DEV; -typedef struct net_device * PNET_DEV; -typedef void * PNDIS_PACKET; -typedef char NDIS_PACKET; -typedef PNDIS_PACKET * PPNDIS_PACKET; -typedef dma_addr_t NDIS_PHYSICAL_ADDRESS; -typedef dma_addr_t * PNDIS_PHYSICAL_ADDRESS; -typedef void * NDIS_HANDLE; -typedef char * PNDIS_BUFFER; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) -typedef struct pid * RTMP_OS_PID; -#else -typedef pid_t RTMP_OS_PID; -#endif - -typedef struct semaphore RTMP_OS_SEM; - -#ifdef RTMP_MAC_PCI -#ifndef PCI_DEVICE -#define PCI_DEVICE(vend,dev) \ - .vendor = (vend), .device = (dev), \ - .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID -#endif // PCI_DEVICE // -#endif // RTMP_MAC_PCI // - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) -#define RT_MOD_INC_USE_COUNT() \ - if (!try_module_get(THIS_MODULE)) \ - { \ - DBGPRINT(RT_DEBUG_ERROR, ("%s: cannot reserve module\n", __FUNCTION__)); \ - return -1; \ - } - -#define RT_MOD_DEC_USE_COUNT() module_put(THIS_MODULE); -#else -#define RT_MOD_INC_USE_COUNT() MOD_INC_USE_COUNT; -#define RT_MOD_DEC_USE_COUNT() MOD_DEC_USE_COUNT; -#endif - -#define RTMP_INC_REF(_A) 0 -#define RTMP_DEC_REF(_A) 0 -#define RTMP_GET_REF(_A) 0 - - -#if WIRELESS_EXT >= 12 -// This function will be called when query /proc -struct iw_statistics *rt28xx_get_wireless_stats( - IN struct net_device *net_dev); -#endif - - -/*********************************************************************************** - * Network related constant definitions - ***********************************************************************************/ -#ifndef IFNAMSIZ -#define IFNAMSIZ 16 -#endif - -#define ETH_LENGTH_OF_ADDRESS 6 - -#define NDIS_STATUS_SUCCESS 0x00 -#define NDIS_STATUS_FAILURE 0x01 -#define NDIS_STATUS_INVALID_DATA 0x02 -#define NDIS_STATUS_RESOURCES 0x03 - -#define NDIS_SET_PACKET_STATUS(_p, _status) do{} while(0) -#define NdisWriteErrorLogEntry(_a, _b, _c, _d) do{} while(0) - -/* statistics counter */ -#define STATS_INC_RX_PACKETS(_pAd, _dev) -#define STATS_INC_TX_PACKETS(_pAd, _dev) - -#define STATS_INC_RX_BYTESS(_pAd, _dev, len) -#define STATS_INC_TX_BYTESS(_pAd, _dev, len) - -#define STATS_INC_RX_ERRORS(_pAd, _dev) -#define STATS_INC_TX_ERRORS(_pAd, _dev) - -#define STATS_INC_RX_DROPPED(_pAd, _dev) -#define STATS_INC_TX_DROPPED(_pAd, _dev) - - -/*********************************************************************************** - * Ralink Specific network related constant definitions - ***********************************************************************************/ -#define MIN_NET_DEVICE_FOR_AID 0x00 //0x00~0x3f -#define MIN_NET_DEVICE_FOR_MBSSID 0x00 //0x00,0x10,0x20,0x30 -#define MIN_NET_DEVICE_FOR_WDS 0x10 //0x40,0x50,0x60,0x70 -#define MIN_NET_DEVICE_FOR_APCLI 0x20 -#define MIN_NET_DEVICE_FOR_MESH 0x30 -#ifdef CONFIG_STA_SUPPORT -#define MIN_NET_DEVICE_FOR_DLS 0x40 -#endif // CONFIG_STA_SUPPORT // -#define NET_DEVICE_REAL_IDX_MASK 0x0f // for each operation mode, we maximum support 15 entities. - - -#ifdef CONFIG_STA_SUPPORT -#define NDIS_PACKET_TYPE_DIRECTED 0 -#define NDIS_PACKET_TYPE_MULTICAST 1 -#define NDIS_PACKET_TYPE_BROADCAST 2 -#define NDIS_PACKET_TYPE_ALL_MULTICAST 3 -#define NDIS_PACKET_TYPE_PROMISCUOUS 4 -#endif // CONFIG_STA_SUPPORT // - - -/*********************************************************************************** - * OS signaling related constant definitions - ***********************************************************************************/ - - -/*********************************************************************************** - * OS file operation related data structure definitions - ***********************************************************************************/ -typedef struct file* RTMP_OS_FD; - -typedef struct _RTMP_OS_FS_INFO_ -{ - int fsuid; - int fsgid; - mm_segment_t fs; -}RTMP_OS_FS_INFO; - -#define IS_FILE_OPEN_ERR(_fd) IS_ERR((_fd)) - - -/*********************************************************************************** - * OS semaphore related data structure and definitions - ***********************************************************************************/ -struct os_lock { - spinlock_t lock; - unsigned long flags; -}; - -typedef spinlock_t NDIS_SPIN_LOCK; - -// -// spin_lock enhanced for Nested spin lock -// -#define NdisAllocateSpinLock(__lock) \ -{ \ - spin_lock_init((spinlock_t *)(__lock)); \ -} - -#define NdisFreeSpinLock(lock) \ - do{}while(0) - - -#define RTMP_SEM_LOCK(__lock) \ -{ \ - spin_lock_bh((spinlock_t *)(__lock)); \ -} - -#define RTMP_SEM_UNLOCK(__lock) \ -{ \ - spin_unlock_bh((spinlock_t *)(__lock)); \ -} - - -// sample, use semaphore lock to replace IRQ lock, 2007/11/15 -#define RTMP_IRQ_LOCK(__lock, __irqflags) \ -{ \ - __irqflags = 0; \ - spin_lock_bh((spinlock_t *)(__lock)); \ - pAd->irq_disabled |= 1; \ -} - -#define RTMP_IRQ_UNLOCK(__lock, __irqflag) \ -{ \ - pAd->irq_disabled &= 0; \ - spin_unlock_bh((spinlock_t *)(__lock)); \ -} - -#define RTMP_INT_LOCK(__lock, __irqflags) \ -{ \ - spin_lock_irqsave((spinlock_t *)__lock, __irqflags); \ -} - -#define RTMP_INT_UNLOCK(__lock, __irqflag) \ -{ \ - spin_unlock_irqrestore((spinlock_t *)(__lock), ((unsigned long)__irqflag)); \ -} - -#define NdisAcquireSpinLock RTMP_SEM_LOCK -#define NdisReleaseSpinLock RTMP_SEM_UNLOCK - -#ifndef wait_event_interruptible_timeout -#define __wait_event_interruptible_timeout(wq, condition, ret) \ -do { \ - wait_queue_t __wait; \ - init_waitqueue_entry(&__wait, current); \ - add_wait_queue(&wq, &__wait); \ - for (;;) { \ - set_current_state(TASK_INTERRUPTIBLE); \ - if (condition) \ - break; \ - if (!signal_pending(current)) { \ - ret = schedule_timeout(ret); \ - if (!ret) \ - break; \ - continue; \ - } \ - ret = -ERESTARTSYS; \ - break; \ - } \ - current->state = TASK_RUNNING; \ - remove_wait_queue(&wq, &__wait); \ -} while (0) - -#define wait_event_interruptible_timeout(wq, condition, timeout) \ -({ \ - long __ret = timeout; \ - if (!(condition)) \ - __wait_event_interruptible_timeout(wq, condition, __ret); \ - __ret; \ -}) -#endif - -#define RTMP_SEM_EVENT_INIT_LOCKED(_pSema) sema_init((_pSema), 0) -#define RTMP_SEM_EVENT_INIT(_pSema) sema_init((_pSema), 1) -#define RTMP_SEM_EVENT_WAIT(_pSema, _status) ((_status) = down_interruptible((_pSema))) -#define RTMP_SEM_EVENT_UP(_pSema) up(_pSema) - -#ifdef KTHREAD_SUPPORT -#define RTMP_WAIT_EVENT_INTERRUPTIBLE(_pAd, _pTask) \ -{ \ - wait_event_interruptible(_pTask->kthread_q, \ - _pTask->kthread_running || kthread_should_stop()); \ - _pTask->kthread_running = FALSE; \ - if (kthread_should_stop()) \ - { \ - RTMP_SET_FLAG(_pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); \ - break; \ - } \ -} -#endif - -#ifdef KTHREAD_SUPPORT -#define WAKE_UP(_pTask) \ - do{ \ - if ((_pTask)->kthread_task) \ - { \ - (_pTask)->kthread_running = TRUE; \ - wake_up(&(_pTask)->kthread_q); \ - } \ - }while(0) -#endif - -/*********************************************************************************** - * OS Memory Access related data structure and definitions - ***********************************************************************************/ -#define MEM_ALLOC_FLAG (GFP_ATOMIC) //(GFP_DMA | GFP_ATOMIC) - -#define NdisMoveMemory(Destination, Source, Length) memmove(Destination, Source, Length) -#define NdisCopyMemory(Destination, Source, Length) memcpy(Destination, Source, Length) -#define NdisZeroMemory(Destination, Length) memset(Destination, 0, Length) -#define NdisFillMemory(Destination, Length, Fill) memset(Destination, Fill, Length) -#define NdisCmpMemory(Destination, Source, Length) memcmp(Destination, Source, Length) -#define NdisEqualMemory(Source1, Source2, Length) (!memcmp(Source1, Source2, Length)) -#define RTMPEqualMemory(Source1, Source2, Length) (!memcmp(Source1, Source2, Length)) - -#define MlmeAllocateMemory(_pAd, _ppVA) os_alloc_mem(_pAd, _ppVA, MGMT_DMA_BUFFER_SIZE) -#define MlmeFreeMemory(_pAd, _pVA) os_free_mem(_pAd, _pVA) - -#define COPY_MAC_ADDR(Addr1, Addr2) memcpy((Addr1), (Addr2), MAC_ADDR_LEN) - - -/*********************************************************************************** - * OS task related data structure and definitions - ***********************************************************************************/ -#define RTMP_OS_MGMT_TASK_FLAGS CLONE_VM - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) -typedef struct pid * THREAD_PID; -#define THREAD_PID_INIT_VALUE NULL -#define GET_PID(_v) find_get_pid((_v)) -#define GET_PID_NUMBER(_v) pid_nr((_v)) -#define CHECK_PID_LEGALITY(_pid) if (pid_nr((_pid)) >= 0) -#define KILL_THREAD_PID(_A, _B, _C) kill_pid((_A), (_B), (_C)) -#else -typedef pid_t THREAD_PID; -#define THREAD_PID_INIT_VALUE -1 -#define GET_PID(_v) (_v) -#define GET_PID_NUMBER(_v) (_v) -#define CHECK_PID_LEGALITY(_pid) if ((_pid) >= 0) -#define KILL_THREAD_PID(_A, _B, _C) kill_proc((_A), (_B), (_C)) -#endif - -typedef struct tasklet_struct RTMP_NET_TASK_STRUCT; -typedef struct tasklet_struct *PRTMP_NET_TASK_STRUCT; - - -/*********************************************************************************** - * Timer related definitions and data structures. - **********************************************************************************/ -#define OS_HZ HZ - -typedef struct timer_list NDIS_MINIPORT_TIMER; -typedef struct timer_list RTMP_OS_TIMER; -typedef void (*TIMER_FUNCTION)(unsigned long); - - -#define OS_WAIT(_time) \ -{ int _i; \ - long _loop = ((_time)/(1000/OS_HZ)) > 0 ? ((_time)/(1000/OS_HZ)) : 1;\ - wait_queue_head_t _wait; \ - init_waitqueue_head(&_wait); \ - for (_i=0; _i<(_loop); _i++) \ - wait_event_interruptible_timeout(_wait, 0, ONE_TICK); } - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) -#define RTMP_TIME_AFTER(a,b) \ - (typecheck(unsigned long, (unsigned long)a) && \ - typecheck(unsigned long, (unsigned long)b) && \ - ((long)(b) - (long)(a) < 0)) - -#define RTMP_TIME_AFTER_EQ(a,b) \ - (typecheck(unsigned long, (unsigned long)a) && \ - typecheck(unsigned long, (unsigned long)b) && \ - ((long)(a) - (long)(b) >= 0)) -#define RTMP_TIME_BEFORE(a,b) RTMP_TIME_AFTER_EQ(b,a) -#else -#define typecheck(type,x) \ -({ type __dummy; \ - typeof(x) __dummy2; \ - (void)(&__dummy == &__dummy2); \ - 1; \ -}) -#define RTMP_TIME_AFTER_EQ(a,b) \ - (typecheck(unsigned long, (unsigned long)a) && \ - typecheck(unsigned long, (unsigned long)b) && \ - ((long)(a) - (long)(b) >= 0)) -#define RTMP_TIME_BEFORE(a,b) RTMP_TIME_AFTER_EQ(b,a) -#define RTMP_TIME_AFTER(a,b) time_after(a, b) -#endif - -#define ONE_TICK 1 - -static inline void NdisGetSystemUpTime(ULONG *time) -{ - *time = jiffies; -} - - -/*********************************************************************************** - * OS specific cookie data structure binding to RTMP_ADAPTER - ***********************************************************************************/ - -struct os_cookie { -#ifdef RTMP_MAC_PCI - struct pci_dev *pci_dev; - struct pci_dev *parent_pci_dev; - USHORT DeviceID; - dma_addr_t pAd_pa; -#endif // RTMP_MAC_PCI // - - - RTMP_NET_TASK_STRUCT rx_done_task; - RTMP_NET_TASK_STRUCT mgmt_dma_done_task; - RTMP_NET_TASK_STRUCT ac0_dma_done_task; - RTMP_NET_TASK_STRUCT ac1_dma_done_task; - RTMP_NET_TASK_STRUCT ac2_dma_done_task; - RTMP_NET_TASK_STRUCT ac3_dma_done_task; - /*RTMP_NET_TASK_STRUCT hcca_dma_done_task;*/ - RTMP_NET_TASK_STRUCT tbtt_task; -#ifdef RTMP_MAC_PCI - RTMP_NET_TASK_STRUCT fifo_statistic_full_task; -#endif // RTMP_MAC_PCI // - - - - unsigned long apd_pid; //802.1x daemon pid - INT ioctl_if_type; - INT ioctl_if; -}; - -typedef struct os_cookie * POS_COOKIE; - - - -/*********************************************************************************** - * OS debugging and printing related definitions and data structure - ***********************************************************************************/ -#define PRINT_MAC(addr) \ - addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] - -#ifdef DBG -extern ULONG RTDebugLevel; - -#define DBGPRINT_RAW(Level, Fmt) \ -do{ \ - if (Level <= RTDebugLevel) \ - { \ - printk Fmt; \ - } \ -}while(0) - -#define DBGPRINT(Level, Fmt) DBGPRINT_RAW(Level, Fmt) - - -#define DBGPRINT_ERR(Fmt) \ -{ \ - printk("ERROR!!! "); \ - printk Fmt; \ -} - -#define DBGPRINT_S(Status, Fmt) \ -{ \ - printk Fmt; \ -} -#else -#define DBGPRINT(Level, Fmt) -#define DBGPRINT_RAW(Level, Fmt) -#define DBGPRINT_S(Status, Fmt) -#define DBGPRINT_ERR(Fmt) -#endif - -#undef ASSERT -#define ASSERT(x) \ -{ \ - if (!(x)) \ - { \ - printk(KERN_WARNING __FILE__ ":%d assert " #x "failed\n", __LINE__); \ - } \ -} - -void hex_dump(char *str, unsigned char *pSrcBufVA, unsigned int SrcBufLen); - - -/********************************************************************************************************* - The following code are not revised, temporary put it here. - *********************************************************************************************************/ - - -/*********************************************************************************** - * Device DMA Access related definitions and data structures. - **********************************************************************************/ -#ifdef RTMP_MAC_PCI -dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, int sd_idx, int direction); -void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int direction); - -#define PCI_MAP_SINGLE(_handle, _ptr, _size, _sd_idx, _dir) \ - linux_pci_map_single(_handle, _ptr, _size, _sd_idx, _dir) - -#define PCI_UNMAP_SINGLE(_handle, _ptr, _size, _dir) \ - linux_pci_unmap_single(_handle, _ptr, _size, _dir) - -#define PCI_ALLOC_CONSISTENT(_pci_dev, _size, _ptr) \ - pci_alloc_consistent(_pci_dev, _size, _ptr) - -#define PCI_FREE_CONSISTENT(_pci_dev, _size, _virtual_addr, _physical_addr) \ - pci_free_consistent(_pci_dev, _size, _virtual_addr, _physical_addr) - -#define DEV_ALLOC_SKB(_length) \ - dev_alloc_skb(_length) -#endif // RTMP_MAC_PCI // - - - -/* - * ULONG - * RTMP_GetPhysicalAddressLow( - * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); - */ -#define RTMP_GetPhysicalAddressLow(PhysicalAddress) (PhysicalAddress) - -/* - * ULONG - * RTMP_GetPhysicalAddressHigh( - * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); - */ -#define RTMP_GetPhysicalAddressHigh(PhysicalAddress) (0) - -/* - * VOID - * RTMP_SetPhysicalAddressLow( - * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, - * IN ULONG Value); - */ -#define RTMP_SetPhysicalAddressLow(PhysicalAddress, Value) \ - PhysicalAddress = Value; - -/* - * VOID - * RTMP_SetPhysicalAddressHigh( - * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, - * IN ULONG Value); - */ -#define RTMP_SetPhysicalAddressHigh(PhysicalAddress, Value) - -#define NdisMIndicateStatus(_w, _x, _y, _z) - - - -/*********************************************************************************** - * Device Register I/O Access related definitions and data structures. - **********************************************************************************/ -#ifdef RTMP_MAC_PCI -#if defined(INF_TWINPASS) || defined(INF_DANUBE) || defined(IKANOS_VX_1X0) -//Patch for ASIC turst read/write bug, needs to remove after metel fix -#define RTMP_IO_READ32(_A, _R, _pV) \ -{ \ - if ((_A)->bPCIclkOff == FALSE) \ - { \ - (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0))); \ - (*_pV = readl((void *)((_A)->CSRBaseAddress + (_R)))); \ - (*_pV = SWAP32(*((UINT32 *)(_pV)))); \ - } \ -} - -#define RTMP_IO_READ8(_A, _R, _pV) \ -{ \ - (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0))); \ - (*_pV = readb((void *)((_A)->CSRBaseAddress + (_R)))); \ -} - -#define RTMP_IO_WRITE32(_A, _R, _V) \ -{ \ - if ((_A)->bPCIclkOff == FALSE) \ - { \ - UINT32 _Val; \ - _Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ - _Val = SWAP32(_V); \ - writel(_Val, (void *)((_A)->CSRBaseAddress + (_R))); \ - } \ -} - -#define RTMP_IO_WRITE8(_A, _R, _V) \ -{ \ - UINT Val; \ - Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ - writeb((_V), (PUCHAR)((_A)->CSRBaseAddress + (_R))); \ -} - -#define RTMP_IO_WRITE16(_A, _R, _V) \ -{ \ - UINT Val; \ - Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ - writew(SWAP16((_V)), (PUSHORT)((_A)->CSRBaseAddress + (_R))); \ -} -#else -//Patch for ASIC turst read/write bug, needs to remove after metel fix -#define RTMP_IO_READ32(_A, _R, _pV) \ -{ \ - if ((_A)->bPCIclkOff == FALSE) \ - { \ - (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0))); \ - (*_pV = readl((void *)((_A)->CSRBaseAddress + (_R)))); \ - } \ - else \ - *_pV = 0; \ -} - -#define RTMP_IO_FORCE_READ32(_A, _R, _pV) \ -{ \ - (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0))); \ - (*_pV = readl((void *)((_A)->CSRBaseAddress + (_R)))); \ -} - -#define RTMP_IO_READ8(_A, _R, _pV) \ -{ \ - (*_pV = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0))); \ - (*_pV = readb((void *)((_A)->CSRBaseAddress + (_R)))); \ -} - -#define RTMP_IO_WRITE32(_A, _R, _V) \ -{ \ - if ((_A)->bPCIclkOff == FALSE) \ - { \ - UINT Val; \ - Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ - writel((_V), (void *)((_A)->CSRBaseAddress + (_R))); \ - } \ -} - -#define RTMP_IO_FORCE_WRITE32(_A, _R, _V) \ -{ \ - UINT Val; \ - Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ - writel(_V, (void *)((_A)->CSRBaseAddress + (_R))); \ -} - - - -#if defined(BRCM_6358) || defined(RALINK_2880) || defined(RALINK_3052) -#define RTMP_IO_WRITE8(_A, _R, _V) \ -{ \ - ULONG Val; \ - UCHAR _i; \ - _i = ((_R) & 0x3); \ - Val = readl((void *)((_A)->CSRBaseAddress + ((_R) - _i))); \ - Val = Val & (~(0x000000ff << ((_i)*8))); \ - Val = Val | ((ULONG)(_V) << ((_i)*8)); \ - writel((Val), (void *)((_A)->CSRBaseAddress + ((_R) - _i))); \ -} -#else -#define RTMP_IO_WRITE8(_A, _R, _V) \ -{ \ - UINT Val; \ - Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ - writeb((_V), (PUCHAR)((_A)->CSRBaseAddress + (_R))); \ -} -#endif // #if defined(BRCM_6358) || defined(RALINK_2880) // - -#define RTMP_IO_WRITE16(_A, _R, _V) \ -{ \ - UINT Val; \ - Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ - writew((_V), (PUSHORT)((_A)->CSRBaseAddress + (_R))); \ -} -#endif // #if defined(INF_TWINPASS) || defined(INF_DANUBE) || defined(IKANOS_VX_1X0) // -#endif // RTMP_MAC_PCI // - - - -/*********************************************************************************** - * Network Related data structure and marco definitions - ***********************************************************************************/ -#define PKTSRC_NDIS 0x7f -#define PKTSRC_DRIVER 0x0f - - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) -#define RTMP_OS_NETDEV_SET_PRIV(_pNetDev, _pPriv) ((_pNetDev)->priv = (_pPriv)) -#define RTMP_OS_NETDEV_GET_PRIV(_pNetDev) ((_pNetDev)->priv) -#else -#define RTMP_OS_NETDEV_SET_PRIV(_pNetDev, _pPriv) ((_pNetDev)->ml_priv = (_pPriv)) -#define RTMP_OS_NETDEV_GET_PRIV(_pNetDev) ((_pNetDev)->ml_priv) -#endif -#define RTMP_OS_NETDEV_GET_DEVNAME(_pNetDev) ((_pNetDev)->name) -#define RTMP_OS_NETDEV_GET_PHYADDR(_PNETDEV) ((_PNETDEV)->dev_addr) - -#define RTMP_OS_NETDEV_START_QUEUE(_pNetDev) netif_start_queue((_pNetDev)) -#define RTMP_OS_NETDEV_STOP_QUEUE(_pNetDev) netif_stop_queue((_pNetDev)) -#define RTMP_OS_NETDEV_WAKE_QUEUE(_pNetDev) netif_wake_queue((_pNetDev)) -#define RTMP_OS_NETDEV_CARRIER_OFF(_pNetDev) netif_carrier_off((_pNetDev)) - -#define QUEUE_ENTRY_TO_PACKET(pEntry) \ - (PNDIS_PACKET)(pEntry) - -#define PACKET_TO_QUEUE_ENTRY(pPacket) \ - (PQUEUE_ENTRY)(pPacket) - -#ifdef CONFIG_5VT_ENHANCE -#define BRIDGE_TAG 0x35564252 // depends on 5VT define in br_input.c -#endif - -#define GET_SG_LIST_FROM_PACKET(_p, _sc) \ - rt_get_sg_list_from_packet(_p, _sc) - -#define RELEASE_NDIS_PACKET(_pAd, _pPacket, _Status) \ -{ \ - RTMPFreeNdisPacket(_pAd, _pPacket); \ -} - -/* - * packet helper - * - convert internal rt packet to os packet or - * os packet to rt packet - */ -#define RTPKT_TO_OSPKT(_p) ((struct sk_buff *)(_p)) -#define OSPKT_TO_RTPKT(_p) ((PNDIS_PACKET)(_p)) - -#define GET_OS_PKT_DATAPTR(_pkt) \ - (RTPKT_TO_OSPKT(_pkt)->data) -#define SET_OS_PKT_DATAPTR(_pkt, _dataPtr) \ - (RTPKT_TO_OSPKT(_pkt)->data) = (_dataPtr) - -#define GET_OS_PKT_LEN(_pkt) \ - (RTPKT_TO_OSPKT(_pkt)->len) -#define SET_OS_PKT_LEN(_pkt, _len) \ - (RTPKT_TO_OSPKT(_pkt)->len) = (_len) - -#define GET_OS_PKT_DATATAIL(_pkt) \ - (RTPKT_TO_OSPKT(_pkt)->tail) -#define SET_OS_PKT_DATATAIL(_pkt, _start, _len) \ - ((RTPKT_TO_OSPKT(_pkt))->tail) = (PUCHAR)((_start) + (_len)) - -#define GET_OS_PKT_HEAD(_pkt) \ - (RTPKT_TO_OSPKT(_pkt)->head) - -#define GET_OS_PKT_END(_pkt) \ - (RTPKT_TO_OSPKT(_pkt)->end) - -#define GET_OS_PKT_NETDEV(_pkt) \ - (RTPKT_TO_OSPKT(_pkt)->dev) -#define SET_OS_PKT_NETDEV(_pkt, _pNetDev) \ - (RTPKT_TO_OSPKT(_pkt)->dev) = (_pNetDev) - -#define GET_OS_PKT_TYPE(_pkt) \ - (RTPKT_TO_OSPKT(_pkt)) - -#define GET_OS_PKT_NEXT(_pkt) \ - (RTPKT_TO_OSPKT(_pkt)->next) - - -#define OS_PKT_CLONED(_pkt) skb_cloned(RTPKT_TO_OSPKT(_pkt)) - -#define OS_NTOHS(_Val) \ - (ntohs(_Val)) -#define OS_HTONS(_Val) \ - (htons(_Val)) -#define OS_NTOHL(_Val) \ - (ntohl(_Val)) -#define OS_HTONL(_Val) \ - (htonl(_Val)) - -#define CB_OFF 10 - -// User Priority -#define RTMP_SET_PACKET_UP(_p, _prio) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+0] = _prio) -#define RTMP_GET_PACKET_UP(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+0]) - -// Fragment # -#define RTMP_SET_PACKET_FRAGMENTS(_p, _num) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+1] = _num) -#define RTMP_GET_PACKET_FRAGMENTS(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+1]) - -// 0x0 ~0x7f: TX to AP's own BSS which has the specified AID. if AID>127, set bit 7 in RTMP_SET_PACKET_EMACTAB too. -//(this value also as MAC(on-chip WCID) table index) -// 0x80~0xff: TX to a WDS link. b0~6: WDS index -#define RTMP_SET_PACKET_WCID(_p, _wdsidx) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+2] = _wdsidx) -#define RTMP_GET_PACKET_WCID(_p) ((UCHAR)(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+2])) - -// 0xff: PKTSRC_NDIS, others: local TX buffer index. This value affects how to a packet -#define RTMP_SET_PACKET_SOURCE(_p, _pktsrc) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+3] = _pktsrc) -#define RTMP_GET_PACKET_SOURCE(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+3]) - -// RTS/CTS-to-self protection method -#define RTMP_SET_PACKET_RTS(_p, _num) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+4] = _num) -#define RTMP_GET_PACKET_RTS(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+4]) -// see RTMP_S(G)ET_PACKET_EMACTAB - -// TX rate index -#define RTMP_SET_PACKET_TXRATE(_p, _rate) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+5] = _rate) -#define RTMP_GET_PACKET_TXRATE(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+5]) - -// From which Interface -#define RTMP_SET_PACKET_IF(_p, _ifdx) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+6] = _ifdx) -#define RTMP_GET_PACKET_IF(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+6]) -#define RTMP_SET_PACKET_NET_DEVICE_MBSSID(_p, _bss) RTMP_SET_PACKET_IF((_p), (_bss)) -#define RTMP_SET_PACKET_NET_DEVICE_WDS(_p, _bss) RTMP_SET_PACKET_IF((_p), ((_bss) + MIN_NET_DEVICE_FOR_WDS)) -#define RTMP_SET_PACKET_NET_DEVICE_APCLI(_p, _idx) RTMP_SET_PACKET_IF((_p), ((_idx) + MIN_NET_DEVICE_FOR_APCLI)) -#define RTMP_SET_PACKET_NET_DEVICE_MESH(_p, _idx) RTMP_SET_PACKET_IF((_p), ((_idx) + MIN_NET_DEVICE_FOR_MESH)) -#define RTMP_GET_PACKET_NET_DEVICE_MBSSID(_p) RTMP_GET_PACKET_IF((_p)) -#define RTMP_GET_PACKET_NET_DEVICE(_p) RTMP_GET_PACKET_IF((_p)) - -#define RTMP_SET_PACKET_MOREDATA(_p, _morebit) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+7] = _morebit) -#define RTMP_GET_PACKET_MOREDATA(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+7]) - - - - - -// -// Sepcific Pakcet Type definition -// -#define RTMP_PACKET_SPECIFIC_CB_OFFSET 11 - -#define RTMP_PACKET_SPECIFIC_DHCP 0x01 -#define RTMP_PACKET_SPECIFIC_EAPOL 0x02 -#define RTMP_PACKET_SPECIFIC_IPV4 0x04 -#define RTMP_PACKET_SPECIFIC_WAI 0x08 -#define RTMP_PACKET_SPECIFIC_VLAN 0x10 -#define RTMP_PACKET_SPECIFIC_LLCSNAP 0x20 - -//Specific -#define RTMP_SET_PACKET_SPECIFIC(_p, _flg) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] = _flg) - -//DHCP -#define RTMP_SET_PACKET_DHCP(_p, _flg) \ - do{ \ - if (_flg) \ - (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) |= (RTMP_PACKET_SPECIFIC_DHCP); \ - else \ - (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) &= (!RTMP_PACKET_SPECIFIC_DHCP); \ - }while(0) -#define RTMP_GET_PACKET_DHCP(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_DHCP) - -//EAPOL -#define RTMP_SET_PACKET_EAPOL(_p, _flg) \ - do{ \ - if (_flg) \ - (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) |= (RTMP_PACKET_SPECIFIC_EAPOL); \ - else \ - (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) &= (!RTMP_PACKET_SPECIFIC_EAPOL); \ - }while(0) -#define RTMP_GET_PACKET_EAPOL(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_EAPOL) - -//WAI -#define RTMP_SET_PACKET_WAI(_p, _flg) \ - do{ \ - if (_flg) \ - (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) |= (RTMP_PACKET_SPECIFIC_WAI); \ - else \ - (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) &= (!RTMP_PACKET_SPECIFIC_WAI); \ - }while(0) -#define RTMP_GET_PACKET_WAI(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_WAI) - -#define RTMP_GET_PACKET_LOWRATE(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & (RTMP_PACKET_SPECIFIC_EAPOL | RTMP_PACKET_SPECIFIC_DHCP | RTMP_PACKET_SPECIFIC_WAI)) - -//VLAN -#define RTMP_SET_PACKET_VLAN(_p, _flg) \ - do{ \ - if (_flg) \ - (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) |= (RTMP_PACKET_SPECIFIC_VLAN); \ - else \ - (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) &= (!RTMP_PACKET_SPECIFIC_VLAN); \ - }while(0) -#define RTMP_GET_PACKET_VLAN(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_VLAN) - -//LLC/SNAP -#define RTMP_SET_PACKET_LLCSNAP(_p, _flg) \ - do{ \ - if (_flg) \ - (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) |= (RTMP_PACKET_SPECIFIC_LLCSNAP); \ - else \ - (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) &= (!RTMP_PACKET_SPECIFIC_LLCSNAP); \ - }while(0) - -#define RTMP_GET_PACKET_LLCSNAP(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_LLCSNAP) - -// IP -#define RTMP_SET_PACKET_IPV4(_p, _flg) \ - do{ \ - if (_flg) \ - (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) |= (RTMP_PACKET_SPECIFIC_IPV4); \ - else \ - (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) &= (!RTMP_PACKET_SPECIFIC_IPV4); \ - }while(0) - -#define RTMP_GET_PACKET_IPV4(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_IPV4) - - -// If this flag is set, it indicates that this EAPoL frame MUST be clear. -#define RTMP_SET_PACKET_CLEAR_EAP_FRAME(_p, _flg) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+12] = _flg) -#define RTMP_GET_PACKET_CLEAR_EAP_FRAME(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+12]) - - - -/* use bit3 of cb[CB_OFF+16] */ - -#define RTMP_SET_PACKET_5VT(_p, _flg) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+22] = _flg) -#define RTMP_GET_PACKET_5VT(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+22]) - -#ifdef INF_AMAZON_SE -/* [CB_OFF+28], 1B, Iverson patch for WMM A5-T07 ,WirelessStaToWirelessSta do not bulk out aggregate */ -#define RTMP_SET_PACKET_NOBULKOUT(_p, _morebit) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+28] = _morebit) -#define RTMP_GET_PACKET_NOBULKOUT(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+28]) -#endif // INF_AMAZON_SE // -/* Max skb->cb = 48B = [CB_OFF+38] */ - - - -/*********************************************************************************** - * Other function prototypes definitions - ***********************************************************************************/ -void RTMP_GetCurrentSystemTime(LARGE_INTEGER *time); -int rt28xx_packet_xmit(struct sk_buff *skb); - - -void FlashWrite(UCHAR * p, ULONG a, ULONG b); -void FlashRead(UCHAR * p, ULONG a, ULONG b); - -#if LINUX_VERSION_CODE <= 0x20402 // Red Hat 7.1 -struct net_device *alloc_netdev(int sizeof_priv, const char *mask, void (*setup)(struct net_device *)); -#endif // LINUX_VERSION_CODE // - - -#ifdef RTMP_MAC_PCI -/* function declarations */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) -#define IRQ_HANDLE_TYPE irqreturn_t -#else -#define IRQ_HANDLE_TYPE void -#endif - -IRQ_HANDLE_TYPE -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) -rt2860_interrupt(int irq, void *dev_instance); -#else -rt2860_interrupt(int irq, void *dev_instance, struct pt_regs *regs); -#endif - -#endif // RTMP_MAC_PCI // - -INT rt28xx_ioctl( - IN PNET_DEV net_dev, - IN OUT struct ifreq *rq, - IN INT cmd); - - -#ifdef CONFIG_STA_SUPPORT -INT rt28xx_sta_ioctl( - IN PNET_DEV net_dev, - IN OUT struct ifreq *rq, - IN INT cmd); -#endif // CONFIG_STA_SUPPORT // - -extern int ra_mtd_write(int num, loff_t to, size_t len, const u_char *buf); -extern int ra_mtd_read(int num, loff_t from, size_t len, u_char *buf); - -#endif // __RT_LINUX_H__ // diff --git a/drivers/staging/rt3090/rt_main_dev.c b/drivers/staging/rt3090/rt_main_dev.c deleted file mode 100644 index 3307a5f36847..000000000000 --- a/drivers/staging/rt3090/rt_main_dev.c +++ /dev/null @@ -1,897 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rt_main_dev.c - - Abstract: - Create and register network interface. - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#include "rt_config.h" - - -#ifdef CONFIG_APSTA_MIXED_SUPPORT -UINT32 CW_MAX_IN_BITS; -#endif // CONFIG_APSTA_MIXED_SUPPORT // - -/*---------------------------------------------------------------------*/ -/* Private Variables Used */ -/*---------------------------------------------------------------------*/ - -PSTRING mac = ""; // default 00:00:00:00:00:00 -PSTRING hostname = ""; // default CMPC -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,12) -MODULE_PARM (mac, "s"); -#else -module_param (mac, charp, 0); -#endif -MODULE_PARM_DESC (mac, "rt28xx: wireless mac addr"); - - -/*---------------------------------------------------------------------*/ -/* Prototypes of Functions Used */ -/*---------------------------------------------------------------------*/ - -// public function prototype -int rt28xx_close(IN struct net_device *net_dev); -int rt28xx_open(struct net_device *net_dev); - -// private function prototype -static INT rt28xx_send_packets(IN struct sk_buff *skb_p, IN struct net_device *net_dev); - - -static struct net_device_stats *RT28xx_get_ether_stats( - IN struct net_device *net_dev); - -/* -======================================================================== -Routine Description: - Close raxx interface. - -Arguments: - *net_dev the raxx interface pointer - -Return Value: - 0 Open OK - otherwise Open Fail - -Note: - 1. if open fail, kernel will not call the close function. - 2. Free memory for - (1) Mlme Memory Handler: MlmeHalt() - (2) TX & RX: RTMPFreeTxRxRingMemory() - (3) BA Reordering: ba_reordering_resource_release() -======================================================================== -*/ -int MainVirtualIF_close(IN struct net_device *net_dev) -{ - RTMP_ADAPTER *pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev); - - // Sanity check for pAd - if (pAd == NULL) - return 0; // close ok - - netif_carrier_off(pAd->net_dev); - netif_stop_queue(pAd->net_dev); - - - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - BOOLEAN Cancelled; -#ifdef QOS_DLS_SUPPORT - // send DLS-TEAR_DOWN message, - if (pAd->CommonCfg.bDLSCapable) - { - UCHAR i; - - // tear down local dls table entry - for (i=0; iStaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH)) - { - RTMPSendDLSTearDownFrame(pAd, pAd->StaCfg.DLSEntry[i].MacAddr); - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - pAd->StaCfg.DLSEntry[i].Valid = FALSE; - } - } - - // tear down peer dls table entry - for (i=MAX_NUM_OF_INIT_DLS_ENTRY; iStaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH)) - { - RTMPSendDLSTearDownFrame(pAd, pAd->StaCfg.DLSEntry[i].MacAddr); - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - pAd->StaCfg.DLSEntry[i].Valid = FALSE; - } - } - RTMP_MLME_HANDLER(pAd); - } -#endif // QOS_DLS_SUPPORT // - - if (INFRA_ON(pAd) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) - { - MLME_DISASSOC_REQ_STRUCT DisReq; - MLME_QUEUE_ELEM *MsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); - - if (MsgElem) - { - COPY_MAC_ADDR(DisReq.Addr, pAd->CommonCfg.Bssid); - DisReq.Reason = REASON_DEAUTH_STA_LEAVING; - - MsgElem->Machine = ASSOC_STATE_MACHINE; - MsgElem->MsgType = MT2_MLME_DISASSOC_REQ; - MsgElem->MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT); - NdisMoveMemory(MsgElem->Msg, &DisReq, sizeof(MLME_DISASSOC_REQ_STRUCT)); - - // Prevent to connect AP again in STAMlmePeriodicExec - pAd->MlmeAux.AutoReconnectSsidLen= 32; - NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen); - - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC; - MlmeDisassocReqAction(pAd, MsgElem); - kfree(MsgElem); - } - - RTMPusecDelay(1000); - } - - RTMPCancelTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, &Cancelled); - RTMPCancelTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, &Cancelled); - -#ifdef WPA_SUPPLICANT_SUPPORT -#ifndef NATIVE_WPA_SUPPLICANT_SUPPORT - // send wireless event to wpa_supplicant for infroming interface down. - RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, RT_INTERFACE_DOWN, NULL, NULL, 0); -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // -#endif // WPA_SUPPLICANT_SUPPORT // - - - } -#endif // CONFIG_STA_SUPPORT // - - VIRTUAL_IF_DOWN(pAd); - - RT_MOD_DEC_USE_COUNT(); - - return 0; // close ok -} - -/* -======================================================================== -Routine Description: - Open raxx interface. - -Arguments: - *net_dev the raxx interface pointer - -Return Value: - 0 Open OK - otherwise Open Fail - -Note: - 1. if open fail, kernel will not call the close function. - 2. Free memory for - (1) Mlme Memory Handler: MlmeHalt() - (2) TX & RX: RTMPFreeTxRxRingMemory() - (3) BA Reordering: ba_reordering_resource_release() -======================================================================== -*/ -int MainVirtualIF_open(IN struct net_device *net_dev) -{ - RTMP_ADAPTER *pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev); - - // Sanity check for pAd - if (pAd == NULL) - return 0; // close ok - - if (VIRTUAL_IF_UP(pAd) != 0) - return -1; - - // increase MODULE use count - RT_MOD_INC_USE_COUNT(); - - netif_start_queue(net_dev); - netif_carrier_on(net_dev); - netif_wake_queue(net_dev); - - return 0; -} - -/* -======================================================================== -Routine Description: - Close raxx interface. - -Arguments: - *net_dev the raxx interface pointer - -Return Value: - 0 Open OK - otherwise Open Fail - -Note: - 1. if open fail, kernel will not call the close function. - 2. Free memory for - (1) Mlme Memory Handler: MlmeHalt() - (2) TX & RX: RTMPFreeTxRxRingMemory() - (3) BA Reordering: ba_reordering_resource_release() -======================================================================== -*/ -int rt28xx_close(IN PNET_DEV dev) -{ - struct net_device * net_dev = (struct net_device *)dev; - RTMP_ADAPTER *pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev); - BOOLEAN Cancelled; - UINT32 i = 0; - - - DBGPRINT(RT_DEBUG_TRACE, ("===> rt28xx_close\n")); - - Cancelled = FALSE; - // Sanity check for pAd - if (pAd == NULL) - return 0; // close ok - - - -#ifdef WDS_SUPPORT - WdsDown(pAd); -#endif // WDS_SUPPORT // - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { -#ifdef RTMP_MAC_PCI - RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_CLOSE); -#endif // RTMP_MAC_PCI // - - // If dirver doesn't wake up firmware here, - // NICLoadFirmware will hang forever when interface is up again. - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - AsicForceWakeup(pAd, TRUE); - } - - - MlmeRadioOff(pAd); -#ifdef RTMP_MAC_PCI - pAd->bPCIclkOff = FALSE; -#endif // RTMP_MAC_PCI // - } -#endif // CONFIG_STA_SUPPORT // - - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); - - for (i = 0 ; i < NUM_OF_TX_RING; i++) - { - while (pAd->DeQueueRunning[i] == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE, ("Waiting for TxQueue[%d] done..........\n", i)); - RTMPusecDelay(1000); - } - } - - - - // Stop Mlme state machine - MlmeHalt(pAd); - - // Close net tasklets - RtmpNetTaskExit(pAd); - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - MacTableReset(pAd); - } -#endif // CONFIG_STA_SUPPORT // - - - MeasureReqTabExit(pAd); - TpcReqTabExit(pAd); - - - // Close kernel threads - RtmpMgmtTaskExit(pAd); - -#ifdef RTMP_MAC_PCI - { - BOOLEAN brc; - // ULONG Value; - - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) - { - RTMP_ASIC_INTERRUPT_DISABLE(pAd); - } - - // Receive packets to clear DMA index after disable interrupt. - //RTMPHandleRxDoneInterrupt(pAd); - // put to radio off to save power when driver unload. After radiooff, can't write /read register. So need to finish all - // register access before Radio off. - - - brc=RT28xxPciAsicRadioOff(pAd, RTMP_HALT, 0); - -//In solution 3 of 3090F, the bPCIclkOff will be set to TRUE after calling RT28xxPciAsicRadioOff - pAd->bPCIclkOff = FALSE; - - if (brc==FALSE) - { - DBGPRINT(RT_DEBUG_ERROR,("%s call RT28xxPciAsicRadioOff fail !!\n", __FUNCTION__)); - } - } - - -/* - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) - { - RTMP_ASIC_INTERRUPT_DISABLE(pAd); - } - - // Disable Rx, register value supposed will remain after reset - NICIssueReset(pAd); -*/ -#endif // RTMP_MAC_PCI // - - // Free IRQ - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { -#ifdef RTMP_MAC_PCI - // Deregister interrupt function - RTMP_IRQ_RELEASE(net_dev) -#endif // RTMP_MAC_PCI // - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE); - } - - // Free Ring or USB buffers - RTMPFreeTxRxRingMemory(pAd); - - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); - -#ifdef DOT11_N_SUPPORT - // Free BA reorder resource - ba_reordering_resource_release(pAd); -#endif // DOT11_N_SUPPORT // - -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // - - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_START_UP); - -/*+++Modify by woody to solve the bulk fail+++*/ -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - } -#endif // CONFIG_STA_SUPPORT // - - DBGPRINT(RT_DEBUG_TRACE, ("<=== rt28xx_close\n")); - return 0; // close ok -} /* End of rt28xx_close */ - - -/* -======================================================================== -Routine Description: - Open raxx interface. - -Arguments: - *net_dev the raxx interface pointer - -Return Value: - 0 Open OK - otherwise Open Fail - -Note: -======================================================================== -*/ -int rt28xx_open(IN PNET_DEV dev) -{ - struct net_device * net_dev = (struct net_device *)dev; - PRTMP_ADAPTER pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev); - int retval = 0; - //POS_COOKIE pObj; - - - // Sanity check for pAd - if (pAd == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->priv will be NULL in 2rd open */ - return -1; - } - -#ifdef CONFIG_APSTA_MIXED_SUPPORT - if (pAd->OpMode == OPMODE_AP) - { - CW_MAX_IN_BITS = 6; - } - else if (pAd->OpMode == OPMODE_STA) - { - CW_MAX_IN_BITS = 10; - } -#endif // CONFIG_APSTA_MIXED_SUPPORT // - -#if WIRELESS_EXT >= 12 - if (net_dev->priv_flags == INT_MAIN) - { -#ifdef CONFIG_APSTA_MIXED_SUPPORT - if (pAd->OpMode == OPMODE_AP) - net_dev->wireless_handlers = (struct iw_handler_def *) &rt28xx_ap_iw_handler_def; -#endif // CONFIG_APSTA_MIXED_SUPPORT // -#ifdef CONFIG_STA_SUPPORT - if (pAd->OpMode == OPMODE_STA) - net_dev->wireless_handlers = (struct iw_handler_def *) &rt28xx_iw_handler_def; -#endif // CONFIG_STA_SUPPORT // - } -#endif // WIRELESS_EXT >= 12 // - - // Request interrupt service routine for PCI device - // register the interrupt routine with the os - RTMP_IRQ_REQUEST(net_dev); - - // Init IRQ parameters stored in pAd - RTMP_IRQ_INIT(pAd); - - // Chip & other init - if (rt28xx_init(pAd, mac, hostname) == FALSE) - goto err; - -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // - - // Enable Interrupt - RTMP_IRQ_ENABLE(pAd); - - // Now Enable RxTx - RTMPEnableRxTx(pAd); - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_START_UP); - - { - UINT32 reg = 0; - RTMP_IO_READ32(pAd, 0x1300, ®); // clear garbage interrupts - printk("0x1300 = %08x\n", reg); - } - - { -// u32 reg; -// UINT8 byte; -// u16 tmp; - -// RTMP_IO_READ32(pAd, XIFS_TIME_CFG, ®); - -// tmp = 0x0805; -// reg = (reg & 0xffff0000) | tmp; -// RTMP_IO_WRITE32(pAd, XIFS_TIME_CFG, reg); - - } - - -#ifdef CONFIG_STA_SUPPORT -#ifdef RTMP_MAC_PCI - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - RTMPInitPCIeLinkCtrlValue(pAd); -#endif // RTMP_MAC_PCI // -#endif // CONFIG_STA_SUPPORT // - - return (retval); - -err: -//+++Add by shiang, move from rt28xx_init() to here. - RTMP_IRQ_RELEASE(net_dev); -//---Add by shiang, move from rt28xx_init() to here. - return (-1); -} /* End of rt28xx_open */ - -static const struct net_device_ops rt3090_netdev_ops = { - .ndo_open = MainVirtualIF_open, - .ndo_stop = MainVirtualIF_close, - .ndo_do_ioctl = rt28xx_ioctl, - .ndo_get_stats = RT28xx_get_ether_stats, - .ndo_set_mac_address = eth_mac_addr, - .ndo_change_mtu = eth_change_mtu, -#ifdef IKANOS_VX_1X0 - .ndo_start_xmit = IKANOS_DataFramesTx, -#else - .ndo_start_xmit = rt28xx_send_packets, -#endif -}; - -PNET_DEV RtmpPhyNetDevInit( - IN RTMP_ADAPTER *pAd, - IN RTMP_OS_NETDEV_OP_HOOK *pNetDevHook) -{ - struct net_device *net_dev = NULL; -// NDIS_STATUS Status; - - net_dev = RtmpOSNetDevCreate(pAd, INT_MAIN, 0, sizeof(PRTMP_ADAPTER), INF_MAIN_DEV_NAME); - if (net_dev == NULL) - { - printk("RtmpPhyNetDevInit(): creation failed for main physical net device!\n"); - return NULL; - } - - NdisZeroMemory((unsigned char *)pNetDevHook, sizeof(RTMP_OS_NETDEV_OP_HOOK)); - pNetDevHook->netdev_ops = &rt3090_netdev_ops; - pNetDevHook->priv_flags = INT_MAIN; - pNetDevHook->needProtcted = FALSE; - - RTMP_OS_NETDEV_SET_PRIV(net_dev, pAd); - //net_dev->priv = (PVOID)pAd; - pAd->net_dev = net_dev; - - - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - SET_MODULE_OWNER(net_dev); -#endif - - netif_stop_queue(net_dev); - - return net_dev; - -} - - -/* -======================================================================== -Routine Description: - The entry point for Linux kernel sent packet to our driver. - -Arguments: - sk_buff *skb the pointer refer to a sk_buffer. - -Return Value: - 0 - -Note: - This function is the entry point of Tx Path for Os delivery packet to - our driver. You only can put OS-depened & STA/AP common handle procedures - in here. -======================================================================== -*/ -int rt28xx_packet_xmit(struct sk_buff *skb) -{ - struct net_device *net_dev = skb->dev; - PRTMP_ADAPTER pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev); - int status = 0; - PNDIS_PACKET pPacket = (PNDIS_PACKET) skb; - - /* RT2870STA does this in RTMPSendPackets() */ -#ifdef RALINK_ATE - if (ATE_ON(pAd)) - { - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_RESOURCES); - return 0; - } -#endif // RALINK_ATE // - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - // Drop send request since we are in monitor mode - if (MONITOR_ON(pAd)) - { - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - goto done; - } - } -#endif // CONFIG_STA_SUPPORT // - - // EapolStart size is 18 - if (skb->len < 14) - { - //printk("bad packet size: %d\n", pkt->len); - hex_dump("bad packet", skb->data, skb->len); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - goto done; - } - - - - RTMP_SET_PACKET_5VT(pPacket, 0); -// MiniportMMRequest(pAd, pkt->data, pkt->len); -#ifdef CONFIG_5VT_ENHANCE - if (*(int*)(skb->cb) == BRIDGE_TAG) { - RTMP_SET_PACKET_5VT(pPacket, 1); - } -#endif - - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - - STASendPackets((NDIS_HANDLE)pAd, (PPNDIS_PACKET) &pPacket, 1); - } - -#endif // CONFIG_STA_SUPPORT // - - status = 0; -done: - - return status; -} - - -/* -======================================================================== -Routine Description: - Send a packet to WLAN. - -Arguments: - skb_p points to our adapter - dev_p which WLAN network interface - -Return Value: - 0: transmit successfully - otherwise: transmit fail - -Note: -======================================================================== -*/ -static int rt28xx_send_packets( - IN struct sk_buff *skb_p, - IN struct net_device *net_dev) -{ - RTMP_ADAPTER *pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev); - - if (!(net_dev->flags & IFF_UP)) - { - RELEASE_NDIS_PACKET(pAd, (PNDIS_PACKET)skb_p, NDIS_STATUS_FAILURE); - return 0; - } - - NdisZeroMemory((PUCHAR)&skb_p->cb[CB_OFF], 15); - RTMP_SET_PACKET_NET_DEVICE_MBSSID(skb_p, MAIN_MBSSID); - - return rt28xx_packet_xmit(skb_p); -} - - -#if WIRELESS_EXT >= 12 -// This function will be called when query /proc -struct iw_statistics *rt28xx_get_wireless_stats( - IN struct net_device *net_dev) -{ - PRTMP_ADAPTER pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev); - - - - DBGPRINT(RT_DEBUG_TRACE, ("rt28xx_get_wireless_stats --->\n")); - - pAd->iw_stats.status = 0; // Status - device dependent for now - - // link quality -#ifdef CONFIG_STA_SUPPORT - if (pAd->OpMode == OPMODE_STA) - pAd->iw_stats.qual.qual = ((pAd->Mlme.ChannelQuality * 12)/10 + 10); -#endif // CONFIG_STA_SUPPORT // - - if(pAd->iw_stats.qual.qual > 100) - pAd->iw_stats.qual.qual = 100; - -#ifdef CONFIG_STA_SUPPORT - if (pAd->OpMode == OPMODE_STA) - { - pAd->iw_stats.qual.level = - RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, - pAd->StaCfg.RssiSample.LastRssi1, - pAd->StaCfg.RssiSample.LastRssi2); - } -#endif // CONFIG_STA_SUPPORT // - - pAd->iw_stats.qual.noise = pAd->BbpWriteLatch[66]; // noise level (dBm) - - pAd->iw_stats.qual.noise += 256 - 143; - pAd->iw_stats.qual.updated = 1; // Flags to know if updated -#ifdef IW_QUAL_DBM - pAd->iw_stats.qual.updated |= IW_QUAL_DBM; // Level + Noise are dBm -#endif // IW_QUAL_DBM // - - pAd->iw_stats.discard.nwid = 0; // Rx : Wrong nwid/essid - pAd->iw_stats.miss.beacon = 0; // Missed beacons/superframe - - DBGPRINT(RT_DEBUG_TRACE, ("<--- rt28xx_get_wireless_stats\n")); - return &pAd->iw_stats; -} -#endif // WIRELESS_EXT // - - -void tbtt_tasklet(unsigned long data) -{ -//#define MAX_TX_IN_TBTT (16) - -} - -INT rt28xx_ioctl( - IN PNET_DEV net_dev, - IN OUT struct ifreq *rq, - IN INT cmd) -{ - RTMP_ADAPTER *pAd = NULL; - INT ret = 0; - - pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev); - if (pAd == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->priv will be NULL in 2rd open */ - return -ENETDOWN; - } - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - ret = rt28xx_sta_ioctl(net_dev, rq, cmd); - } -#endif // CONFIG_STA_SUPPORT // - - return ret; -} - - -/* - ======================================================================== - - Routine Description: - return ethernet statistics counter - - Arguments: - net_dev Pointer to net_device - - Return Value: - net_device_stats* - - Note: - - ======================================================================== -*/ -static struct net_device_stats *RT28xx_get_ether_stats( - IN struct net_device *net_dev) -{ - RTMP_ADAPTER *pAd = NULL; - - if (net_dev) - pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev); - - if (pAd) - { - - pAd->stats.rx_packets = pAd->WlanCounters.ReceivedFragmentCount.QuadPart; - pAd->stats.tx_packets = pAd->WlanCounters.TransmittedFragmentCount.QuadPart; - - pAd->stats.rx_bytes = pAd->RalinkCounters.ReceivedByteCount; - pAd->stats.tx_bytes = pAd->RalinkCounters.TransmittedByteCount; - - pAd->stats.rx_errors = pAd->Counters8023.RxErrors; - pAd->stats.tx_errors = pAd->Counters8023.TxErrors; - - pAd->stats.rx_dropped = 0; - pAd->stats.tx_dropped = 0; - - pAd->stats.multicast = pAd->WlanCounters.MulticastReceivedFrameCount.QuadPart; // multicast packets received - pAd->stats.collisions = pAd->Counters8023.OneCollision + pAd->Counters8023.MoreCollisions; // Collision packets - - pAd->stats.rx_length_errors = 0; - pAd->stats.rx_over_errors = pAd->Counters8023.RxNoBuffer; // receiver ring buff overflow - pAd->stats.rx_crc_errors = 0;//pAd->WlanCounters.FCSErrorCount; // recved pkt with crc error - pAd->stats.rx_frame_errors = pAd->Counters8023.RcvAlignmentErrors; // recv'd frame alignment error - pAd->stats.rx_fifo_errors = pAd->Counters8023.RxNoBuffer; // recv'r fifo overrun - pAd->stats.rx_missed_errors = 0; // receiver missed packet - - // detailed tx_errors - pAd->stats.tx_aborted_errors = 0; - pAd->stats.tx_carrier_errors = 0; - pAd->stats.tx_fifo_errors = 0; - pAd->stats.tx_heartbeat_errors = 0; - pAd->stats.tx_window_errors = 0; - - // for cslip etc - pAd->stats.rx_compressed = 0; - pAd->stats.tx_compressed = 0; - - return &pAd->stats; - } - else - return NULL; -} - - -BOOLEAN RtmpPhyNetDevExit( - IN RTMP_ADAPTER *pAd, - IN PNET_DEV net_dev) -{ - - - -#ifdef INF_AMAZON_PPA - if (ppa_hook_directpath_register_dev_fn && pAd->PPAEnable==TRUE) - { - UINT status; - status=ppa_hook_directpath_register_dev_fn(&pAd->g_if_id, pAd->net_dev, NULL, PPA_F_DIRECTPATH_DEREGISTER); - printk("unregister PPA:g_if_id=%d status=%d\n",pAd->g_if_id,status); - } - kfree(pAd->pDirectpathCb); -#endif // INF_AMAZON_PPA // - - // Unregister network device - if (net_dev != NULL) - { - printk("RtmpOSNetDevDetach(): RtmpOSNetDeviceDetach(), dev->name=%s!\n", net_dev->name); - RtmpOSNetDevDetach(net_dev); - } - - return TRUE; - -} - - -/* -======================================================================== -Routine Description: - Allocate memory for adapter control block. - -Arguments: - pAd Pointer to our adapter - -Return Value: - NDIS_STATUS_SUCCESS - NDIS_STATUS_FAILURE - NDIS_STATUS_RESOURCES - -Note: -======================================================================== -*/ -NDIS_STATUS AdapterBlockAllocateMemory( - IN PVOID handle, - OUT PVOID *ppAd) -{ - - *ppAd = (PVOID)vmalloc(sizeof(RTMP_ADAPTER)); //pci_alloc_consistent(pci_dev, sizeof(RTMP_ADAPTER), phy_addr); - - if (*ppAd) - { - NdisZeroMemory(*ppAd, sizeof(RTMP_ADAPTER)); - ((PRTMP_ADAPTER)*ppAd)->OS_Cookie = handle; - return (NDIS_STATUS_SUCCESS); - } else { - return (NDIS_STATUS_FAILURE); - } -} diff --git a/drivers/staging/rt3090/rt_pci_rbus.c b/drivers/staging/rt3090/rt_pci_rbus.c deleted file mode 100644 index 29913191273b..000000000000 --- a/drivers/staging/rt3090/rt_pci_rbus.c +++ /dev/null @@ -1,989 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rt_pci_rbus.c - - Abstract: - Create and register network interface. - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#include "rt_config.h" -#include - - -IRQ_HANDLE_TYPE -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) -rt2860_interrupt(int irq, void *dev_instance); -#else -rt2860_interrupt(int irq, void *dev_instance, struct pt_regs *regs); -#endif - - -static void rx_done_tasklet(unsigned long data); -static void mgmt_dma_done_tasklet(unsigned long data); -static void ac0_dma_done_tasklet(unsigned long data); -static void ac1_dma_done_tasklet(unsigned long data); -static void ac2_dma_done_tasklet(unsigned long data); -static void ac3_dma_done_tasklet(unsigned long data); -/*static void hcca_dma_done_tasklet(unsigned long data);*/ -static void fifo_statistic_full_tasklet(unsigned long data); - - - -/*---------------------------------------------------------------------*/ -/* Symbol & Macro Definitions */ -/*---------------------------------------------------------------------*/ -#define RT2860_INT_RX_DLY (1<<0) // bit 0 -#define RT2860_INT_TX_DLY (1<<1) // bit 1 -#define RT2860_INT_RX_DONE (1<<2) // bit 2 -#define RT2860_INT_AC0_DMA_DONE (1<<3) // bit 3 -#define RT2860_INT_AC1_DMA_DONE (1<<4) // bit 4 -#define RT2860_INT_AC2_DMA_DONE (1<<5) // bit 5 -#define RT2860_INT_AC3_DMA_DONE (1<<6) // bit 6 -#define RT2860_INT_HCCA_DMA_DONE (1<<7) // bit 7 -#define RT2860_INT_MGMT_DONE (1<<8) // bit 8 -#ifdef TONE_RADAR_DETECT_SUPPORT -#define RT2860_INT_TONE_RADAR (1<<20) // bit 20 -#endif // TONE_RADAR_DETECT_SUPPORT // - -#define INT_RX RT2860_INT_RX_DONE - -#define INT_AC0_DLY (RT2860_INT_AC0_DMA_DONE) //| RT2860_INT_TX_DLY) -#define INT_AC1_DLY (RT2860_INT_AC1_DMA_DONE) //| RT2860_INT_TX_DLY) -#define INT_AC2_DLY (RT2860_INT_AC2_DMA_DONE) //| RT2860_INT_TX_DLY) -#define INT_AC3_DLY (RT2860_INT_AC3_DMA_DONE) //| RT2860_INT_TX_DLY) -#define INT_HCCA_DLY (RT2860_INT_HCCA_DMA_DONE) //| RT2860_INT_TX_DLY) -#define INT_MGMT_DLY RT2860_INT_MGMT_DONE -#ifdef TONE_RADAR_DETECT_SUPPORT -#define INT_TONE_RADAR (RT2860_INT_TONE_RADAR) -#endif // TONE_RADAR_DETECT_SUPPORT // - - -/*************************************************************************** - * - * Interface-depended memory allocation/Free related procedures. - * Mainly for Hardware TxDesc/RxDesc/MgmtDesc, DMA Memory for TxData/RxData, etc., - * - **************************************************************************/ -// Function for TxDesc Memory allocation. -void RTMP_AllocateTxDescMemory( - IN PRTMP_ADAPTER pAd, - IN UINT Index, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) -{ - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; - - *VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); - -} - - -// Function for MgmtDesc Memory allocation. -void RTMP_AllocateMgmtDescMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) -{ - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; - - *VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); - -} - - -// Function for RxDesc Memory allocation. -void RTMP_AllocateRxDescMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) -{ - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; - - *VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); - -} - - -// Function for free allocated Desc Memory. -void RTMP_FreeDescMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN PVOID VirtualAddress, - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress) -{ - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; - - pci_free_consistent(pObj->pci_dev, Length, VirtualAddress, PhysicalAddress); -} - - -// Function for TxData DMA Memory allocation. -void RTMP_AllocateFirstTxBuffer( - IN PRTMP_ADAPTER pAd, - IN UINT Index, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) -{ - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; - - *VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); -} - - -void RTMP_FreeFirstTxBuffer( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - IN PVOID VirtualAddress, - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress) -{ - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; - - pci_free_consistent(pObj->pci_dev, Length, VirtualAddress, PhysicalAddress); -} - - -/* - * FUNCTION: Allocate a common buffer for DMA - * ARGUMENTS: - * AdapterHandle: AdapterHandle - * Length: Number of bytes to allocate - * Cached: Whether or not the memory can be cached - * VirtualAddress: Pointer to memory is returned here - * PhysicalAddress: Physical address corresponding to virtual address - */ -void RTMP_AllocateSharedMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) -{ - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; - - *VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); -} - - -/* - * FUNCTION: Allocate a packet buffer for DMA - * ARGUMENTS: - * AdapterHandle: AdapterHandle - * Length: Number of bytes to allocate - * Cached: Whether or not the memory can be cached - * VirtualAddress: Pointer to memory is returned here - * PhysicalAddress: Physical address corresponding to virtual address - * Notes: - * Cached is ignored: always cached memory - */ -PNDIS_PACKET RTMP_AllocateRxPacketBuffer( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) -{ - struct sk_buff *pkt; - - pkt = dev_alloc_skb(Length); - - if (pkt == NULL) { - DBGPRINT(RT_DEBUG_ERROR, ("can't allocate rx %ld size packet\n",Length)); - } - - if (pkt) { - RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pkt), PKTSRC_NDIS); - *VirtualAddress = (PVOID) pkt->data; -//#ifdef CONFIG_5VT_ENHANCE -// *PhysicalAddress = PCI_MAP_SINGLE(pAd, *VirtualAddress, 1600, PCI_DMA_FROMDEVICE); -//#else - *PhysicalAddress = PCI_MAP_SINGLE(pAd, *VirtualAddress, Length, -1, PCI_DMA_FROMDEVICE); -//#endif - } else { - *VirtualAddress = (PVOID) NULL; - *PhysicalAddress = (NDIS_PHYSICAL_ADDRESS) NULL; - } - - return (PNDIS_PACKET) pkt; -} - - -VOID Invalid_Remaining_Packet( - IN PRTMP_ADAPTER pAd, - IN ULONG VirtualAddress) -{ - NDIS_PHYSICAL_ADDRESS PhysicalAddress; - - PhysicalAddress = PCI_MAP_SINGLE(pAd, (void *)(VirtualAddress+1600), RX_BUFFER_NORMSIZE-1600, -1, PCI_DMA_FROMDEVICE); -} - - -int RtmpOSIRQRequest(IN struct net_device *net_dev) -{ - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)(RTMP_OS_NETDEV_GET_PRIV(net_dev)); - int retval = 0; - - ASSERT(pAd); - - if (pAd->infType != RTMP_DEV_INF_RBUS) - { - POS_COOKIE _pObj = (POS_COOKIE)(pAd->OS_Cookie); - RTMP_MSI_ENABLE(pAd); - retval = request_irq(_pObj->pci_dev->irq, rt2860_interrupt, SA_SHIRQ, (net_dev)->name, (net_dev)); - if (retval != 0) - printk("RT2860: request_irq ERROR(%d)\n", retval); - } - else - { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) - if ((retval = request_irq(net_dev->irq, rt2860_interrupt, IRQF_SHARED, net_dev->name ,net_dev))) -#else - if ((retval = request_irq(net_dev->irq,rt2860_interrupt, SA_INTERRUPT, net_dev->name ,net_dev))) -#endif - { - printk("RT2860: request_irq ERROR(%d)\n", retval); - } - } - - return retval; - -} - - -int RtmpOSIRQRelease(IN struct net_device *net_dev) -{ - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)(RTMP_OS_NETDEV_GET_PRIV(net_dev)); - - ASSERT(pAd); - if (pAd->infType != RTMP_DEV_INF_RBUS) - { - POS_COOKIE pObj = (POS_COOKIE)(pAd->OS_Cookie); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) - synchronize_irq(pObj->pci_dev->irq); -#endif - free_irq(pObj->pci_dev->irq, (net_dev)); - RTMP_MSI_DISABLE(pAd); - } - else - { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) - synchronize_irq(net_dev->irq); -#endif - free_irq(net_dev->irq, (net_dev)); - } - - return 0; -} - - -NDIS_STATUS RtmpNetTaskInit(IN RTMP_ADAPTER *pAd) -{ - POS_COOKIE pObj; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - tasklet_init(&pObj->rx_done_task, rx_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->mgmt_dma_done_task, mgmt_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac0_dma_done_task, ac0_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac1_dma_done_task, ac1_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac2_dma_done_task, ac2_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac3_dma_done_task, ac3_dma_done_tasklet, (unsigned long)pAd); - /*tasklet_init(&pObj->hcca_dma_done_task, hcca_dma_done_tasklet, (unsigned long)pAd);*/ - tasklet_init(&pObj->tbtt_task, tbtt_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->fifo_statistic_full_task, fifo_statistic_full_tasklet, (unsigned long)pAd); - - return NDIS_STATUS_SUCCESS; -} - - -void RtmpNetTaskExit(IN RTMP_ADAPTER *pAd) -{ - POS_COOKIE pObj; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - tasklet_kill(&pObj->rx_done_task); - tasklet_kill(&pObj->mgmt_dma_done_task); - tasklet_kill(&pObj->ac0_dma_done_task); - tasklet_kill(&pObj->ac1_dma_done_task); - tasklet_kill(&pObj->ac2_dma_done_task); - tasklet_kill(&pObj->ac3_dma_done_task); - /*tasklet_kill(&pObj->hcca_dma_done_task);*/ - tasklet_kill(&pObj->tbtt_task); - tasklet_kill(&pObj->fifo_statistic_full_task); -} - - -NDIS_STATUS RtmpMgmtTaskInit(IN RTMP_ADAPTER *pAd) -{ - - - return NDIS_STATUS_SUCCESS; -} - - -/* -======================================================================== -Routine Description: - Close kernel threads. - -Arguments: - *pAd the raxx interface data pointer - -Return Value: - NONE - -Note: -======================================================================== -*/ -VOID RtmpMgmtTaskExit( - IN RTMP_ADAPTER *pAd) -{ - - - return; -} - - -static inline void rt2860_int_enable(PRTMP_ADAPTER pAd, unsigned int mode) -{ - u32 regValue; - - pAd->int_disable_mask &= ~(mode); - regValue = pAd->int_enable_reg & ~(pAd->int_disable_mask); - //if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); // 1:enable - } - //else - // DBGPRINT(RT_DEBUG_TRACE, ("fOP_STATUS_DOZE !\n")); - - if (regValue != 0) - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE); -} - - -static inline void rt2860_int_disable(PRTMP_ADAPTER pAd, unsigned int mode) -{ - u32 regValue; - - pAd->int_disable_mask |= mode; - regValue = pAd->int_enable_reg & ~(pAd->int_disable_mask); - RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); // 0: disable - - if (regValue == 0) - { - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE); - } -} - - -/*************************************************************************** - * - * tasklet related procedures. - * - **************************************************************************/ -static void mgmt_dma_done_tasklet(unsigned long data) -{ - unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - -// printk("mgmt_dma_done_process\n"); - IntSource.word = 0; - IntSource.field.MgmtDmaDone = 1; - pAd->int_pending &= ~INT_MGMT_DLY; - - RTMPHandleMgmtRingDmaDoneInterrupt(pAd); - - // if you use RTMP_SEM_LOCK, sometimes kernel will hang up, no any - // bug report output - RTMP_INT_LOCK(&pAd->irq_lock, flags); - /* - * double check to avoid lose of interrupts - */ - if (pAd->int_pending & INT_MGMT_DLY) - { - tasklet_hi_schedule(&pObj->mgmt_dma_done_task); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - return; - } - - /* enable TxDataInt again */ - rt2860_int_enable(pAd, INT_MGMT_DLY); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); -} - - -static void rx_done_tasklet(unsigned long data) -{ - unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - BOOLEAN bReschedule = 0; - POS_COOKIE pObj; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - -#ifdef UAPSD_AP_SUPPORT - UAPSD_TIMING_RECORD(pAd, UAPSD_TIMING_RECORD_TASKLET); -#endif // UAPSD_AP_SUPPORT // - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - pAd->int_pending &= ~(INT_RX); -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - bReschedule = STARxDoneInterruptHandle(pAd, 0); -#endif // CONFIG_STA_SUPPORT // - -#ifdef UAPSD_AP_SUPPORT - UAPSD_TIMING_RECORD_STOP(); -#endif // UAPSD_AP_SUPPORT // - - RTMP_INT_LOCK(&pAd->irq_lock, flags); - /* - * double check to avoid rotting packet - */ - if (pAd->int_pending & INT_RX || bReschedule) - { - tasklet_hi_schedule(&pObj->rx_done_task); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - return; - } - - /* enable RxINT again */ - rt2860_int_enable(pAd, INT_RX); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - -} - - -void fifo_statistic_full_tasklet(unsigned long data) -{ - unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - POS_COOKIE pObj; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - pAd->int_pending &= ~(FifoStaFullInt); - NICUpdateFifoStaCounters(pAd); - - RTMP_INT_LOCK(&pAd->irq_lock, flags); - /* - * double check to avoid rotting packet - */ - if (pAd->int_pending & FifoStaFullInt) - { - tasklet_hi_schedule(&pObj->fifo_statistic_full_task); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - return; - } - - /* enable RxINT again */ - - rt2860_int_enable(pAd, FifoStaFullInt); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - -} - - - - -static void ac3_dma_done_tasklet(unsigned long data) -{ - unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; - BOOLEAN bReschedule = 0; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - -// printk("ac0_dma_done_process\n"); - IntSource.word = 0; - IntSource.field.Ac3DmaDone = 1; - pAd->int_pending &= ~INT_AC3_DLY; - - bReschedule = RTMPHandleTxRingDmaDoneInterrupt(pAd, IntSource); - - RTMP_INT_LOCK(&pAd->irq_lock, flags); - /* - * double check to avoid lose of interrupts - */ - if ((pAd->int_pending & INT_AC3_DLY) || bReschedule) - { - tasklet_hi_schedule(&pObj->ac3_dma_done_task); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - return; - } - - /* enable TxDataInt again */ - rt2860_int_enable(pAd, INT_AC3_DLY); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); -} - - -static void ac2_dma_done_tasklet(unsigned long data) -{ - unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; - BOOLEAN bReschedule = 0; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - IntSource.word = 0; - IntSource.field.Ac2DmaDone = 1; - pAd->int_pending &= ~INT_AC2_DLY; - - bReschedule = RTMPHandleTxRingDmaDoneInterrupt(pAd, IntSource); - - RTMP_INT_LOCK(&pAd->irq_lock, flags); - - /* - * double check to avoid lose of interrupts - */ - if ((pAd->int_pending & INT_AC2_DLY) || bReschedule) - { - tasklet_hi_schedule(&pObj->ac2_dma_done_task); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - return; - } - - /* enable TxDataInt again */ - rt2860_int_enable(pAd, INT_AC2_DLY); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); -} - - -static void ac1_dma_done_tasklet(unsigned long data) -{ - unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; - BOOLEAN bReschedule = 0; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - -// printk("ac0_dma_done_process\n"); - IntSource.word = 0; - IntSource.field.Ac1DmaDone = 1; - pAd->int_pending &= ~INT_AC1_DLY; - - bReschedule = RTMPHandleTxRingDmaDoneInterrupt(pAd, IntSource); - - RTMP_INT_LOCK(&pAd->irq_lock, flags); - /* - * double check to avoid lose of interrupts - */ - if ((pAd->int_pending & INT_AC1_DLY) || bReschedule) - { - tasklet_hi_schedule(&pObj->ac1_dma_done_task); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - return; - } - - /* enable TxDataInt again */ - rt2860_int_enable(pAd, INT_AC1_DLY); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); -} - - -static void ac0_dma_done_tasklet(unsigned long data) -{ - unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; - BOOLEAN bReschedule = 0; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - -// printk("ac0_dma_done_process\n"); - IntSource.word = 0; - IntSource.field.Ac0DmaDone = 1; - pAd->int_pending &= ~INT_AC0_DLY; - -// RTMPHandleMgmtRingDmaDoneInterrupt(pAd); - bReschedule = RTMPHandleTxRingDmaDoneInterrupt(pAd, IntSource); - - RTMP_INT_LOCK(&pAd->irq_lock, flags); - /* - * double check to avoid lose of interrupts - */ - if ((pAd->int_pending & INT_AC0_DLY) || bReschedule) - { - tasklet_hi_schedule(&pObj->ac0_dma_done_task); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); - return; - } - - /* enable TxDataInt again */ - rt2860_int_enable(pAd, INT_AC0_DLY); - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); -} - - - - -/*************************************************************************** - * - * interrupt handler related procedures. - * - **************************************************************************/ -int print_int_count; - -IRQ_HANDLE_TYPE -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) -rt2860_interrupt(int irq, void *dev_instance) -#else -rt2860_interrupt(int irq, void *dev_instance, struct pt_regs *regs) -#endif -{ - struct net_device *net_dev = (struct net_device *) dev_instance; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) RTMP_OS_NETDEV_GET_PRIV(net_dev); - INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; - - pObj = (POS_COOKIE) pAd->OS_Cookie; - - - /* Note 03312008: we can not return here before - RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IntSource.word); - RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, IntSource.word); - Or kernel will panic after ifconfig ra0 down sometimes */ - - - // - // Inital the Interrupt source. - // - IntSource.word = 0x00000000L; -// McuIntSource.word = 0x00000000L; - - // - // Get the interrupt sources & saved to local variable - // - //RTMP_IO_READ32(pAd, where, &McuIntSource.word); - //RTMP_IO_WRITE32(pAd, , McuIntSource.word); - - // - // Flag fOP_STATUS_DOZE On, means ASIC put to sleep, elase means ASICK WakeUp - // And at the same time, clock maybe turned off that say there is no DMA service. - // when ASIC get to sleep. - // To prevent system hang on power saving. - // We need to check it before handle the INT_SOURCE_CSR, ASIC must be wake up. - // - // RT2661 => when ASIC is sleeping, MAC register cannot be read and written. - // RT2860 => when ASIC is sleeping, MAC register can be read and written. -// if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IntSource.word); - RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, IntSource.word); // write 1 to clear - } -// else -// DBGPRINT(RT_DEBUG_TRACE, (">>>fOP_STATUS_DOZE<<<\n")); - -// RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IsrAfterClear); -// RTMP_IO_READ32(pAd, MCU_INT_SOURCE_CSR, &McuIsrAfterClear); -// DBGPRINT(RT_DEBUG_INFO, ("====> RTMPHandleInterrupt(ISR=%08x,Mcu ISR=%08x, After clear ISR=%08x, MCU ISR=%08x)\n", -// IntSource.word, McuIntSource.word, IsrAfterClear, McuIsrAfterClear)); - - // Do nothing if Reset in progress - if (RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |fRTMP_ADAPTER_HALT_IN_PROGRESS))) - { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) - return IRQ_HANDLED; -#else - return; -#endif - } - - // - // Handle interrupt, walk through all bits - // Should start from highest priority interrupt - // The priority can be adjust by altering processing if statement - // - -#ifdef DBG - -#endif - - - pAd->bPCIclkOff = FALSE; - - // If required spinlock, each interrupt service routine has to acquire - // and release itself. - // - - // Do nothing if NIC doesn't exist - if (IntSource.word == 0xffffffff) - { - RTMP_SET_FLAG(pAd, (fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_HALT_IN_PROGRESS)); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) - return IRQ_HANDLED; -#else - return; -#endif - } - - if (IntSource.word & TxCoherent) - { - DBGPRINT(RT_DEBUG_ERROR, (">>>TxCoherent<<<\n")); - RTMPHandleRxCoherentInterrupt(pAd); - } - - if (IntSource.word & RxCoherent) - { - DBGPRINT(RT_DEBUG_ERROR, (">>>RxCoherent<<<\n")); - RTMPHandleRxCoherentInterrupt(pAd); - } - - if (IntSource.word & FifoStaFullInt) - { - if ((pAd->int_disable_mask & FifoStaFullInt) == 0) - { - /* mask FifoStaFullInt */ - rt2860_int_disable(pAd, FifoStaFullInt); - tasklet_hi_schedule(&pObj->fifo_statistic_full_task); - } - pAd->int_pending |= FifoStaFullInt; - } - - if (IntSource.word & INT_MGMT_DLY) - { - if ((pAd->int_disable_mask & INT_MGMT_DLY) ==0 ) - { - rt2860_int_disable(pAd, INT_MGMT_DLY); - tasklet_hi_schedule(&pObj->mgmt_dma_done_task); - } - pAd->int_pending |= INT_MGMT_DLY ; - } - - if (IntSource.word & INT_RX) - { - if ((pAd->int_disable_mask & INT_RX) == 0) - { - - /* mask RxINT */ - rt2860_int_disable(pAd, INT_RX); - tasklet_hi_schedule(&pObj->rx_done_task); - } - pAd->int_pending |= INT_RX; - } - - - if (IntSource.word & INT_AC3_DLY) - { - - if ((pAd->int_disable_mask & INT_AC3_DLY) == 0) - { - /* mask TxDataInt */ - rt2860_int_disable(pAd, INT_AC3_DLY); - tasklet_hi_schedule(&pObj->ac3_dma_done_task); - } - pAd->int_pending |= INT_AC3_DLY; - } - - if (IntSource.word & INT_AC2_DLY) - { - - if ((pAd->int_disable_mask & INT_AC2_DLY) == 0) - { - /* mask TxDataInt */ - rt2860_int_disable(pAd, INT_AC2_DLY); - tasklet_hi_schedule(&pObj->ac2_dma_done_task); - } - pAd->int_pending |= INT_AC2_DLY; - } - - if (IntSource.word & INT_AC1_DLY) - { - - pAd->int_pending |= INT_AC1_DLY; - - if ((pAd->int_disable_mask & INT_AC1_DLY) == 0) - { - /* mask TxDataInt */ - rt2860_int_disable(pAd, INT_AC1_DLY); - tasklet_hi_schedule(&pObj->ac1_dma_done_task); - } - - } - - if (IntSource.word & INT_AC0_DLY) - { - -/* - if (IntSource.word & 0x2) { - u32 reg; - RTMP_IO_READ32(pAd, DELAY_INT_CFG, ®); - printk("IntSource.word = %08x, DELAY_REG = %08x\n", IntSource.word, reg); - } -*/ - pAd->int_pending |= INT_AC0_DLY; - - if ((pAd->int_disable_mask & INT_AC0_DLY) == 0) - { - /* mask TxDataInt */ - rt2860_int_disable(pAd, INT_AC0_DLY); - tasklet_hi_schedule(&pObj->ac0_dma_done_task); - } - - } - - - if (IntSource.word & PreTBTTInt) - { - RTMPHandlePreTBTTInterrupt(pAd); - } - - if (IntSource.word & TBTTInt) - { - RTMPHandleTBTTInterrupt(pAd); - } - - - - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - if (IntSource.word & AutoWakeupInt) - RTMPHandleTwakeupInterrupt(pAd); - } -#endif // CONFIG_STA_SUPPORT // - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) - return IRQ_HANDLED; -#endif - -} - -/* - * invaild or writeback cache - * and convert virtual address to physical address - */ -dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, int sd_idx, int direction) -{ - PRTMP_ADAPTER pAd; - POS_COOKIE pObj; - - /* - ------ Porting Information ------ - > For Tx Alloc: - mgmt packets => sd_idx = 0 - SwIdx: pAd->MgmtRing.TxCpuIdx - pTxD : pAd->MgmtRing.Cell[SwIdx].AllocVa; - - data packets => sd_idx = 1 - TxIdx : pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx - QueIdx: pTxBlk->QueIdx - pTxD : pAd->TxRing[pTxBlk->QueIdx].Cell[TxIdx].AllocVa; - - > For Rx Alloc: - sd_idx = -1 - */ - - pAd = (PRTMP_ADAPTER)handle; - pObj = (POS_COOKIE)pAd->OS_Cookie; - - if (sd_idx == 1) - { - PTX_BLK pTxBlk; - pTxBlk = (PTX_BLK)ptr; - return pci_map_single(pObj->pci_dev, pTxBlk->pSrcBufData, pTxBlk->SrcBufLen, direction); - } - else - { - return pci_map_single(pObj->pci_dev, ptr, size, direction); - } - -} - -void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int direction) -{ - PRTMP_ADAPTER pAd; - POS_COOKIE pObj; - - pAd=(PRTMP_ADAPTER)handle; - pObj = (POS_COOKIE)pAd->OS_Cookie; - - pci_unmap_single(pObj->pci_dev, dma_addr, size, direction); - -} diff --git a/drivers/staging/rt3090/rt_profile.c b/drivers/staging/rt3090/rt_profile.c deleted file mode 100644 index 49a05901bad4..000000000000 --- a/drivers/staging/rt3090/rt_profile.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rt_profile.c - - Abstract: - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- - */ - -#include "rt_config.h" - - -NDIS_STATUS RTMPReadParametersHook( - IN PRTMP_ADAPTER pAd) -{ - PSTRING src = NULL; - RTMP_OS_FD srcf; - RTMP_OS_FS_INFO osFSInfo; - INT retval = NDIS_STATUS_FAILURE; - PSTRING buffer; - - buffer = kmalloc(MAX_INI_BUFFER_SIZE, MEM_ALLOC_FLAG); - if(buffer == NULL) - return NDIS_STATUS_FAILURE; - memset(buffer, 0x00, MAX_INI_BUFFER_SIZE); - - { - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - src = STA_PROFILE_PATH; - } -#endif // CONFIG_STA_SUPPORT // -#ifdef MULTIPLE_CARD_SUPPORT - src = (PSTRING)pAd->MC_FileName; -#endif // MULTIPLE_CARD_SUPPORT // - } - - if (src && *src) - { - RtmpOSFSInfoChange(&osFSInfo, TRUE); - srcf = RtmpOSFileOpen(src, O_RDONLY, 0); - if (IS_FILE_OPEN_ERR(srcf)) - { - DBGPRINT(RT_DEBUG_ERROR, ("Open file \"%s\" failed!\n", src)); - } - else - { - retval =RtmpOSFileRead(srcf, buffer, MAX_INI_BUFFER_SIZE); - if (retval > 0) - { - RTMPSetProfileParameters(pAd, buffer); - retval = NDIS_STATUS_SUCCESS; - } - else - DBGPRINT(RT_DEBUG_ERROR, ("Read file \"%s\" failed(errCode=%d)!\n", src, retval)); - - retval = RtmpOSFileClose(srcf); - if ( retval != 0) - { - retval = NDIS_STATUS_FAILURE; - DBGPRINT(RT_DEBUG_ERROR, ("Close file \"%s\" failed(errCode=%d)!\n", src, retval)); - } - } - - RtmpOSFSInfoChange(&osFSInfo, FALSE); - } - - kfree(buffer); - - return (retval); - -} diff --git a/drivers/staging/rt3090/rtmp.h b/drivers/staging/rt3090/rtmp.h deleted file mode 100644 index 8ef6d0bfdee6..000000000000 --- a/drivers/staging/rt3090/rtmp.h +++ /dev/null @@ -1,6873 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rtmp.h - - Abstract: - Miniport generic portion header file - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Paul Lin 2002-08-01 created - James Tan 2002-09-06 modified (Revise NTCRegTable) - John Chang 2004-09-06 modified for RT2600 -*/ -#ifndef __RTMP_H__ -#define __RTMP_H__ - -#include "link_list.h" -#include "spectrum_def.h" - -#include "rtmp_dot11.h" - -#ifdef MLME_EX -#include "mlme_ex_def.h" -#endif // MLME_EX // - -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // - -#undef AP_WSC_INCLUDED -#undef STA_WSC_INCLUDED -#undef WSC_INCLUDED - - -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // - -#if defined(AP_WSC_INCLUDED) || defined(STA_WSC_INCLUDED) -#define WSC_INCLUDED -#endif - - - - - -#include "rtmp_chip.h" - - - -typedef struct _RTMP_ADAPTER RTMP_ADAPTER; -typedef struct _RTMP_ADAPTER *PRTMP_ADAPTER; - -typedef struct _RTMP_CHIP_OP_ RTMP_CHIP_OP; - - -//#define DBG 1 - -//#define DBG_DIAGNOSE 1 - - -//+++Add by shiang for merge MiniportMMRequest() and MiniportDataMMRequest() into one function -#define MAX_DATAMM_RETRY 3 -#define MGMT_USE_QUEUE_FLAG 0x80 -//---Add by shiang for merge MiniportMMRequest() and MiniportDataMMRequest() into one function - -#define MAXSEQ (0xFFF) - - -#if defined(CONFIG_AP_SUPPORT) && defined(CONFIG_STA_SUPPORT) -#define IF_DEV_CONFIG_OPMODE_ON_AP(_pAd) if(_pAd->OpMode == OPMODE_AP) -#define IF_DEV_CONFIG_OPMODE_ON_STA(_pAd) if(_pAd->OpMode == OPMODE_STA) -#else -#define IF_DEV_CONFIG_OPMODE_ON_AP(_pAd) -#define IF_DEV_CONFIG_OPMODE_ON_STA(_pAd) -#endif - -extern unsigned char SNAP_AIRONET[]; -extern unsigned char CISCO_OUI[]; -extern UCHAR BaSizeArray[4]; - -extern UCHAR BROADCAST_ADDR[MAC_ADDR_LEN]; -extern UCHAR ZERO_MAC_ADDR[MAC_ADDR_LEN]; -extern ULONG BIT32[32]; -extern UCHAR BIT8[8]; -extern char* CipherName[]; -extern char* MCSToMbps[]; -extern UCHAR RxwiMCSToOfdmRate[12]; -extern UCHAR SNAP_802_1H[6]; -extern UCHAR SNAP_BRIDGE_TUNNEL[6]; -extern UCHAR SNAP_AIRONET[8]; -extern UCHAR CKIP_LLC_SNAP[8]; -extern UCHAR EAPOL_LLC_SNAP[8]; -extern UCHAR EAPOL[2]; -extern UCHAR IPX[2]; -extern UCHAR APPLE_TALK[2]; -extern UCHAR RateIdToPlcpSignal[12]; // see IEEE802.11a-1999 p.14 -extern UCHAR OfdmRateToRxwiMCS[]; -extern UCHAR OfdmSignalToRateId[16] ; -extern UCHAR default_cwmin[4]; -extern UCHAR default_cwmax[4]; -extern UCHAR default_sta_aifsn[4]; -extern UCHAR MapUserPriorityToAccessCategory[8]; - -extern USHORT RateUpPER[]; -extern USHORT RateDownPER[]; -extern UCHAR Phy11BNextRateDownward[]; -extern UCHAR Phy11BNextRateUpward[]; -extern UCHAR Phy11BGNextRateDownward[]; -extern UCHAR Phy11BGNextRateUpward[]; -extern UCHAR Phy11ANextRateDownward[]; -extern UCHAR Phy11ANextRateUpward[]; -extern CHAR RssiSafeLevelForTxRate[]; -extern UCHAR RateIdToMbps[]; -extern USHORT RateIdTo500Kbps[]; - -extern UCHAR CipherSuiteWpaNoneTkip[]; -extern UCHAR CipherSuiteWpaNoneTkipLen; - -extern UCHAR CipherSuiteWpaNoneAes[]; -extern UCHAR CipherSuiteWpaNoneAesLen; - -extern UCHAR SsidIe; -extern UCHAR SupRateIe; -extern UCHAR ExtRateIe; - -#ifdef DOT11_N_SUPPORT -extern UCHAR HtCapIe; -extern UCHAR AddHtInfoIe; -extern UCHAR NewExtChanIe; -#ifdef DOT11N_DRAFT3 -extern UCHAR ExtHtCapIe; -#endif // DOT11N_DRAFT3 // -#endif // DOT11_N_SUPPORT // - -extern UCHAR ErpIe; -extern UCHAR DsIe; -extern UCHAR TimIe; -extern UCHAR WpaIe; -extern UCHAR Wpa2Ie; -extern UCHAR IbssIe; -extern UCHAR Ccx2Ie; -extern UCHAR WapiIe; - -extern UCHAR WPA_OUI[]; -extern UCHAR RSN_OUI[]; -extern UCHAR WAPI_OUI[]; -extern UCHAR WME_INFO_ELEM[]; -extern UCHAR WME_PARM_ELEM[]; -extern UCHAR Ccx2QosInfo[]; -extern UCHAR Ccx2IeInfo[]; -extern UCHAR RALINK_OUI[]; -extern UCHAR PowerConstraintIE[]; - - -extern UCHAR RateSwitchTable[]; -extern UCHAR RateSwitchTable11B[]; -extern UCHAR RateSwitchTable11G[]; -extern UCHAR RateSwitchTable11BG[]; - -#ifdef DOT11_N_SUPPORT -extern UCHAR RateSwitchTable11BGN1S[]; -extern UCHAR RateSwitchTable11BGN2S[]; -extern UCHAR RateSwitchTable11BGN2SForABand[]; -extern UCHAR RateSwitchTable11N1S[]; -extern UCHAR RateSwitchTable11N2S[]; -extern UCHAR RateSwitchTable11N2SForABand[]; - -#ifdef CONFIG_STA_SUPPORT -extern UCHAR PRE_N_HT_OUI[]; -#endif // CONFIG_STA_SUPPORT // -#endif // DOT11_N_SUPPORT // - - -#ifdef RALINK_ATE -typedef struct _ATE_INFO { - UCHAR Mode; - CHAR TxPower0; - CHAR TxPower1; - CHAR TxAntennaSel; - CHAR RxAntennaSel; - TXWI_STRUC TxWI; // TXWI - USHORT QID; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; - UCHAR Addr3[MAC_ADDR_LEN]; - UCHAR Channel; - UINT32 TxLength; - UINT32 TxCount; - UINT32 TxDoneCount; // Tx DMA Done - UINT32 RFFreqOffset; - BOOLEAN bRxFER; // Show Rx Frame Error Rate - BOOLEAN bQATxStart; // Have compiled QA in and use it to ATE tx. - BOOLEAN bQARxStart; // Have compiled QA in and use it to ATE rx. -#ifdef RTMP_MAC_PCI - BOOLEAN bFWLoading; // Reload firmware when ATE is done. -#endif // RTMP_MAC_PCI // - UINT32 RxTotalCnt; - UINT32 RxCntPerSec; - - CHAR LastSNR0; // last received SNR - CHAR LastSNR1; // last received SNR for 2nd antenna - CHAR LastRssi0; // last received RSSI - CHAR LastRssi1; // last received RSSI for 2nd antenna - CHAR LastRssi2; // last received RSSI for 3rd antenna - CHAR AvgRssi0; // last 8 frames' average RSSI - CHAR AvgRssi1; // last 8 frames' average RSSI - CHAR AvgRssi2; // last 8 frames' average RSSI - SHORT AvgRssi0X8; // sum of last 8 frames' RSSI - SHORT AvgRssi1X8; // sum of last 8 frames' RSSI - SHORT AvgRssi2X8; // sum of last 8 frames' RSSI - - UINT32 NumOfAvgRssiSample; - - -#ifdef RALINK_28xx_QA - // Tx frame - USHORT HLen; // Header Length - USHORT PLen; // Pattern Length - UCHAR Header[32]; // Header buffer - UCHAR Pattern[32]; // Pattern buffer - USHORT DLen; // Data Length - USHORT seq; - UINT32 CID; - RTMP_OS_PID AtePid; - // counters - UINT32 U2M; - UINT32 OtherData; - UINT32 Beacon; - UINT32 OtherCount; - UINT32 TxAc0; - UINT32 TxAc1; - UINT32 TxAc2; - UINT32 TxAc3; - /*UINT32 TxHCCA;*/ - UINT32 TxMgmt; - UINT32 RSSI0; - UINT32 RSSI1; - UINT32 RSSI2; - UINT32 SNR0; - UINT32 SNR1; - // TxStatus : 0 --> task is idle, 1 --> task is running - UCHAR TxStatus; -#endif // RALINK_28xx_QA // -} ATE_INFO, *PATE_INFO; - -#ifdef RALINK_28xx_QA -struct ate_racfghdr { - UINT32 magic_no; - USHORT command_type; - USHORT command_id; - USHORT length; - USHORT sequence; - USHORT status; - UCHAR data[2046]; -} __attribute__((packed)); -#endif // RALINK_28xx_QA // -#endif // RALINK_ATE // - - -typedef struct _RSSI_SAMPLE { - CHAR LastRssi0; // last received RSSI - CHAR LastRssi1; // last received RSSI - CHAR LastRssi2; // last received RSSI - CHAR AvgRssi0; - CHAR AvgRssi1; - CHAR AvgRssi2; - SHORT AvgRssi0X8; - SHORT AvgRssi1X8; - SHORT AvgRssi2X8; -} RSSI_SAMPLE; - -// -// Queue structure and macros -// -typedef struct _QUEUE_ENTRY { - struct _QUEUE_ENTRY *Next; -} QUEUE_ENTRY, *PQUEUE_ENTRY; - -// Queue structure -typedef struct _QUEUE_HEADER { - PQUEUE_ENTRY Head; - PQUEUE_ENTRY Tail; - ULONG Number; -} QUEUE_HEADER, *PQUEUE_HEADER; - -#define InitializeQueueHeader(QueueHeader) \ -{ \ - (QueueHeader)->Head = (QueueHeader)->Tail = NULL; \ - (QueueHeader)->Number = 0; \ -} - -#define RemoveHeadQueue(QueueHeader) \ -(QueueHeader)->Head; \ -{ \ - PQUEUE_ENTRY pNext; \ - if ((QueueHeader)->Head != NULL) \ - { \ - pNext = (QueueHeader)->Head->Next; \ - (QueueHeader)->Head->Next = NULL; \ - (QueueHeader)->Head = pNext; \ - if (pNext == NULL) \ - (QueueHeader)->Tail = NULL; \ - (QueueHeader)->Number--; \ - } \ -} - -#define InsertHeadQueue(QueueHeader, QueueEntry) \ -{ \ - ((PQUEUE_ENTRY)QueueEntry)->Next = (QueueHeader)->Head; \ - (QueueHeader)->Head = (PQUEUE_ENTRY)(QueueEntry); \ - if ((QueueHeader)->Tail == NULL) \ - (QueueHeader)->Tail = (PQUEUE_ENTRY)(QueueEntry); \ - (QueueHeader)->Number++; \ -} - -#define InsertTailQueue(QueueHeader, QueueEntry) \ -{ \ - ((PQUEUE_ENTRY)QueueEntry)->Next = NULL; \ - if ((QueueHeader)->Tail) \ - (QueueHeader)->Tail->Next = (PQUEUE_ENTRY)(QueueEntry); \ - else \ - (QueueHeader)->Head = (PQUEUE_ENTRY)(QueueEntry); \ - (QueueHeader)->Tail = (PQUEUE_ENTRY)(QueueEntry); \ - (QueueHeader)->Number++; \ -} - -#define InsertTailQueueAc(pAd, pEntry, QueueHeader, QueueEntry) \ -{ \ - ((PQUEUE_ENTRY)QueueEntry)->Next = NULL; \ - if ((QueueHeader)->Tail) \ - (QueueHeader)->Tail->Next = (PQUEUE_ENTRY)(QueueEntry); \ - else \ - (QueueHeader)->Head = (PQUEUE_ENTRY)(QueueEntry); \ - (QueueHeader)->Tail = (PQUEUE_ENTRY)(QueueEntry); \ - (QueueHeader)->Number++; \ -} - - - -// -// Macros for flag and ref count operations -// -#define RTMP_SET_FLAG(_M, _F) ((_M)->Flags |= (_F)) -#define RTMP_CLEAR_FLAG(_M, _F) ((_M)->Flags &= ~(_F)) -#define RTMP_CLEAR_FLAGS(_M) ((_M)->Flags = 0) -#define RTMP_TEST_FLAG(_M, _F) (((_M)->Flags & (_F)) != 0) -#define RTMP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F)) -// Macro for power save flag. -#define RTMP_SET_PSFLAG(_M, _F) ((_M)->PSFlags |= (_F)) -#define RTMP_CLEAR_PSFLAG(_M, _F) ((_M)->PSFlags &= ~(_F)) -#define RTMP_CLEAR_PSFLAGS(_M) ((_M)->PSFlags = 0) -#define RTMP_TEST_PSFLAG(_M, _F) (((_M)->PSFlags & (_F)) != 0) -#define RTMP_TEST_PSFLAGS(_M, _F) (((_M)->PSFlags & (_F)) == (_F)) - -#define OPSTATUS_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags |= (_F)) -#define OPSTATUS_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags &= ~(_F)) -#define OPSTATUS_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.OpStatusFlags & (_F)) != 0) - -#define CLIENT_STATUS_SET_FLAG(_pEntry,_F) ((_pEntry)->ClientStatusFlags |= (_F)) -#define CLIENT_STATUS_CLEAR_FLAG(_pEntry,_F) ((_pEntry)->ClientStatusFlags &= ~(_F)) -#define CLIENT_STATUS_TEST_FLAG(_pEntry,_F) (((_pEntry)->ClientStatusFlags & (_F)) != 0) - -#define RX_FILTER_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter |= (_F)) -#define RX_FILTER_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter &= ~(_F)) -#define RX_FILTER_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.PacketFilter & (_F)) != 0) - -#ifdef CONFIG_STA_SUPPORT -#define STA_NO_SECURITY_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11EncryptionDisabled) -#define STA_WEP_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption1Enabled) -#define STA_TKIP_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) -#define STA_AES_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - -#define STA_TGN_WIFI_ON(_p) (_p->StaCfg.bTGnWifiTest == TRUE) -#endif // CONFIG_STA_SUPPORT // - -#define CKIP_KP_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x10) && ((_p)->StaCfg.bCkipCmicOn == TRUE)) -#define CKIP_CMIC_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x08) && ((_p)->StaCfg.bCkipCmicOn == TRUE)) - - -#define INC_RING_INDEX(_idx, _RingSize) \ -{ \ - (_idx) = (_idx+1) % (_RingSize); \ -} - - -#ifdef DOT11_N_SUPPORT -// StaActive.SupportedHtPhy.MCSSet is copied from AP beacon. Don't need to update here. -#define COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(_pAd) \ -{ \ - _pAd->StaActive.SupportedHtPhy.ChannelWidth = _pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth; \ - _pAd->StaActive.SupportedHtPhy.MimoPs = _pAd->MlmeAux.HtCapability.HtCapInfo.MimoPs; \ - _pAd->StaActive.SupportedHtPhy.GF = _pAd->MlmeAux.HtCapability.HtCapInfo.GF; \ - _pAd->StaActive.SupportedHtPhy.ShortGIfor20 = _pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor20; \ - _pAd->StaActive.SupportedHtPhy.ShortGIfor40 = _pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor40; \ - _pAd->StaActive.SupportedHtPhy.TxSTBC = _pAd->MlmeAux.HtCapability.HtCapInfo.TxSTBC; \ - _pAd->StaActive.SupportedHtPhy.RxSTBC = _pAd->MlmeAux.HtCapability.HtCapInfo.RxSTBC; \ - _pAd->StaActive.SupportedHtPhy.ExtChanOffset = _pAd->MlmeAux.AddHtInfo.AddHtInfo.ExtChanOffset; \ - _pAd->StaActive.SupportedHtPhy.RecomWidth = _pAd->MlmeAux.AddHtInfo.AddHtInfo.RecomWidth; \ - _pAd->StaActive.SupportedHtPhy.OperaionMode = _pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode; \ - _pAd->StaActive.SupportedHtPhy.NonGfPresent = _pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent; \ - NdisMoveMemory((_pAd)->MacTab.Content[BSSID_WCID].HTCapability.MCSSet, (_pAd)->StaActive.SupportedPhyInfo.MCSSet, sizeof(UCHAR) * 16);\ -} - -#define COPY_AP_HTSETTINGS_FROM_BEACON(_pAd, _pHtCapability) \ -{ \ - _pAd->MacTab.Content[BSSID_WCID].AMsduSize = (UCHAR)(_pHtCapability->HtCapInfo.AMsduSize); \ - _pAd->MacTab.Content[BSSID_WCID].MmpsMode= (UCHAR)(_pHtCapability->HtCapInfo.MimoPs); \ - _pAd->MacTab.Content[BSSID_WCID].MaxRAmpduFactor = (UCHAR)(_pHtCapability->HtCapParm.MaxRAmpduFactor); \ -} -#endif // DOT11_N_SUPPORT // - -// -// MACRO for 32-bit PCI register read / write -// -// Usage : RTMP_IO_READ32( -// PRTMP_ADAPTER pAd, -// ULONG Register_Offset, -// PULONG pValue) -// -// RTMP_IO_WRITE32( -// PRTMP_ADAPTER pAd, -// ULONG Register_Offset, -// ULONG Value) -// - - -// -// Common fragment list structure - Identical to the scatter gather frag list structure -// -//#define RTMP_SCATTER_GATHER_ELEMENT SCATTER_GATHER_ELEMENT -//#define PRTMP_SCATTER_GATHER_ELEMENT PSCATTER_GATHER_ELEMENT -#define NIC_MAX_PHYS_BUF_COUNT 8 - -typedef struct _RTMP_SCATTER_GATHER_ELEMENT { - PVOID Address; - ULONG Length; - PULONG Reserved; -} RTMP_SCATTER_GATHER_ELEMENT, *PRTMP_SCATTER_GATHER_ELEMENT; - - -typedef struct _RTMP_SCATTER_GATHER_LIST { - ULONG NumberOfElements; - PULONG Reserved; - RTMP_SCATTER_GATHER_ELEMENT Elements[NIC_MAX_PHYS_BUF_COUNT]; -} RTMP_SCATTER_GATHER_LIST, *PRTMP_SCATTER_GATHER_LIST; - - -// -// Some utility macros -// -#ifndef min -#define min(_a, _b) (((_a) < (_b)) ? (_a) : (_b)) -#endif - -#ifndef max -#define max(_a, _b) (((_a) > (_b)) ? (_a) : (_b)) -#endif - -#define GET_LNA_GAIN(_pAd) ((_pAd->LatchRfRegs.Channel <= 14) ? (_pAd->BLNAGain) : ((_pAd->LatchRfRegs.Channel <= 64) ? (_pAd->ALNAGain0) : ((_pAd->LatchRfRegs.Channel <= 128) ? (_pAd->ALNAGain1) : (_pAd->ALNAGain2)))) - -#define INC_COUNTER64(Val) (Val.QuadPart++) - -#define INFRA_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_INFRA_ON)) -#define ADHOC_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_ADHOC_ON)) -#define MONITOR_ON(_p) (((_p)->StaCfg.BssType) == BSS_MONITOR) -#define IDLE_ON(_p) (!INFRA_ON(_p) && !ADHOC_ON(_p)) - -// Check LEAP & CCKM flags -#define LEAP_ON(_p) (((_p)->StaCfg.LeapAuthMode) == CISCO_AuthModeLEAP) -#define LEAP_CCKM_ON(_p) ((((_p)->StaCfg.LeapAuthMode) == CISCO_AuthModeLEAP) && ((_p)->StaCfg.LeapAuthInfo.CCKM == TRUE)) - -// if orginal Ethernet frame contains no LLC/SNAP, then an extra LLC/SNAP encap is required -#define EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(_pBufVA, _pExtraLlcSnapEncap) \ -{ \ - if (((*(_pBufVA + 12) << 8) + *(_pBufVA + 13)) > 1500) \ - { \ - _pExtraLlcSnapEncap = SNAP_802_1H; \ - if (NdisEqualMemory(IPX, _pBufVA + 12, 2) || \ - NdisEqualMemory(APPLE_TALK, _pBufVA + 12, 2)) \ - { \ - _pExtraLlcSnapEncap = SNAP_BRIDGE_TUNNEL; \ - } \ - } \ - else \ - { \ - _pExtraLlcSnapEncap = NULL; \ - } \ -} - -// New Define for new Tx Path. -#define EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(_pBufVA, _pExtraLlcSnapEncap) \ -{ \ - if (((*(_pBufVA) << 8) + *(_pBufVA + 1)) > 1500) \ - { \ - _pExtraLlcSnapEncap = SNAP_802_1H; \ - if (NdisEqualMemory(IPX, _pBufVA, 2) || \ - NdisEqualMemory(APPLE_TALK, _pBufVA, 2)) \ - { \ - _pExtraLlcSnapEncap = SNAP_BRIDGE_TUNNEL; \ - } \ - } \ - else \ - { \ - _pExtraLlcSnapEncap = NULL; \ - } \ -} - - -#define MAKE_802_3_HEADER(_p, _pMac1, _pMac2, _pType) \ -{ \ - NdisMoveMemory(_p, _pMac1, MAC_ADDR_LEN); \ - NdisMoveMemory((_p + MAC_ADDR_LEN), _pMac2, MAC_ADDR_LEN); \ - NdisMoveMemory((_p + MAC_ADDR_LEN * 2), _pType, LENGTH_802_3_TYPE); \ -} - -// if pData has no LLC/SNAP (neither RFC1042 nor Bridge tunnel), keep it that way. -// else if the received frame is LLC/SNAP-encaped IPX or APPLETALK, preserve the LLC/SNAP field -// else remove the LLC/SNAP field from the result Ethernet frame -// Patch for WHQL only, which did not turn on Netbios but use IPX within its payload -// Note: -// _pData & _DataSize may be altered (remove 8-byte LLC/SNAP) by this MACRO -// _pRemovedLLCSNAP: pointer to removed LLC/SNAP; NULL is not removed -#define CONVERT_TO_802_3(_p8023hdr, _pDA, _pSA, _pData, _DataSize, _pRemovedLLCSNAP) \ -{ \ - char LLC_Len[2]; \ - \ - _pRemovedLLCSNAP = NULL; \ - if (NdisEqualMemory(SNAP_802_1H, _pData, 6) || \ - NdisEqualMemory(SNAP_BRIDGE_TUNNEL, _pData, 6)) \ - { \ - PUCHAR pProto = _pData + 6; \ - \ - if ((NdisEqualMemory(IPX, pProto, 2) || NdisEqualMemory(APPLE_TALK, pProto, 2)) && \ - NdisEqualMemory(SNAP_802_1H, _pData, 6)) \ - { \ - LLC_Len[0] = (UCHAR)(_DataSize / 256); \ - LLC_Len[1] = (UCHAR)(_DataSize % 256); \ - MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \ - } \ - else \ - { \ - MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, pProto); \ - _pRemovedLLCSNAP = _pData; \ - _DataSize -= LENGTH_802_1_H; \ - _pData += LENGTH_802_1_H; \ - } \ - } \ - else \ - { \ - LLC_Len[0] = (UCHAR)(_DataSize / 256); \ - LLC_Len[1] = (UCHAR)(_DataSize % 256); \ - MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \ - } \ -} - - -// Enqueue this frame to MLME engine -// We need to enqueue the whole frame because MLME need to pass data type -// information from 802.11 header -#ifdef RTMP_MAC_PCI -#define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \ -{ \ - UINT32 High32TSF, Low32TSF; \ - RTMP_IO_READ32(_pAd, TSF_TIMER_DW1, &High32TSF); \ - RTMP_IO_READ32(_pAd, TSF_TIMER_DW0, &Low32TSF); \ - MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (UCHAR)_Rssi0, (UCHAR)_Rssi1,(UCHAR)_Rssi2,_FrameSize, _pFrame, (UCHAR)_PlcpSignal); \ -} -#endif // RTMP_MAC_PCI // - -#define MAC_ADDR_EQUAL(pAddr1,pAddr2) RTMPEqualMemory((PVOID)(pAddr1), (PVOID)(pAddr2), MAC_ADDR_LEN) -#define SSID_EQUAL(ssid1, len1, ssid2, len2) ((len1==len2) && (RTMPEqualMemory(ssid1, ssid2, len1))) - -// -// Check if it is Japan W53(ch52,56,60,64) channel. -// -#define JapanChannelCheck(channel) ((channel == 52) || (channel == 56) || (channel == 60) || (channel == 64)) - -#ifdef CONFIG_STA_SUPPORT -#define STA_EXTRA_SETTING(_pAd) - -#define STA_PORT_SECURED(_pAd) \ -{ \ - BOOLEAN Cancelled; \ - (_pAd)->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; \ - NdisAcquireSpinLock(&((_pAd)->MacTabLock)); \ - (_pAd)->MacTab.Content[BSSID_WCID].PortSecured = (_pAd)->StaCfg.PortSecured; \ - (_pAd)->MacTab.Content[BSSID_WCID].PrivacyFilter = Ndis802_11PrivFilterAcceptAll;\ - NdisReleaseSpinLock(&(_pAd)->MacTabLock); \ - RTMPCancelTimer(&((_pAd)->Mlme.LinkDownTimer), &Cancelled);\ - STA_EXTRA_SETTING(_pAd); \ -} -#endif // CONFIG_STA_SUPPORT // - - - -// -// Data buffer for DMA operation, the buffer must be contiguous physical memory -// Both DMA to / from CPU use the same structure. -// -typedef struct _RTMP_DMABUF -{ - ULONG AllocSize; - PVOID AllocVa; // TxBuf virtual address - NDIS_PHYSICAL_ADDRESS AllocPa; // TxBuf physical address -} RTMP_DMABUF, *PRTMP_DMABUF; - - -// -// Control block (Descriptor) for all ring descriptor DMA operation, buffer must be -// contiguous physical memory. NDIS_PACKET stored the binding Rx packet descriptor -// which won't be released, driver has to wait until upper layer return the packet -// before giveing up this rx ring descriptor to ASIC. NDIS_BUFFER is assocaited pair -// to describe the packet buffer. For Tx, NDIS_PACKET stored the tx packet descriptor -// which driver should ACK upper layer when the tx is physically done or failed. -// -typedef struct _RTMP_DMACB -{ - ULONG AllocSize; // Control block size - PVOID AllocVa; // Control block virtual address - NDIS_PHYSICAL_ADDRESS AllocPa; // Control block physical address - PNDIS_PACKET pNdisPacket; - PNDIS_PACKET pNextNdisPacket; - - RTMP_DMABUF DmaBuf; // Associated DMA buffer structure -} RTMP_DMACB, *PRTMP_DMACB; - - -typedef struct _RTMP_TX_RING -{ - RTMP_DMACB Cell[TX_RING_SIZE]; - UINT32 TxCpuIdx; - UINT32 TxDmaIdx; - UINT32 TxSwFreeIdx; // software next free tx index -} RTMP_TX_RING, *PRTMP_TX_RING; - -typedef struct _RTMP_RX_RING -{ - RTMP_DMACB Cell[RX_RING_SIZE]; - UINT32 RxCpuIdx; - UINT32 RxDmaIdx; - INT32 RxSwReadIdx; // software next read index -} RTMP_RX_RING, *PRTMP_RX_RING; - -typedef struct _RTMP_MGMT_RING -{ - RTMP_DMACB Cell[MGMT_RING_SIZE]; - UINT32 TxCpuIdx; - UINT32 TxDmaIdx; - UINT32 TxSwFreeIdx; // software next free tx index -} RTMP_MGMT_RING, *PRTMP_MGMT_RING; - - -// -// Statistic counter structure -// -typedef struct _COUNTER_802_3 -{ - // General Stats - ULONG GoodTransmits; - ULONG GoodReceives; - ULONG TxErrors; - ULONG RxErrors; - ULONG RxNoBuffer; - - // Ethernet Stats - ULONG RcvAlignmentErrors; - ULONG OneCollision; - ULONG MoreCollisions; - -} COUNTER_802_3, *PCOUNTER_802_3; - -typedef struct _COUNTER_802_11 { - ULONG Length; - LARGE_INTEGER LastTransmittedFragmentCount; - LARGE_INTEGER TransmittedFragmentCount; - LARGE_INTEGER MulticastTransmittedFrameCount; - LARGE_INTEGER FailedCount; - LARGE_INTEGER RetryCount; - LARGE_INTEGER MultipleRetryCount; - LARGE_INTEGER RTSSuccessCount; - LARGE_INTEGER RTSFailureCount; - LARGE_INTEGER ACKFailureCount; - LARGE_INTEGER FrameDuplicateCount; - LARGE_INTEGER ReceivedFragmentCount; - LARGE_INTEGER MulticastReceivedFrameCount; - LARGE_INTEGER FCSErrorCount; -} COUNTER_802_11, *PCOUNTER_802_11; - -typedef struct _COUNTER_RALINK { - ULONG TransmittedByteCount; // both successful and failure, used to calculate TX throughput - ULONG ReceivedByteCount; // both CRC okay and CRC error, used to calculate RX throughput - ULONG BeenDisassociatedCount; - ULONG BadCQIAutoRecoveryCount; - ULONG PoorCQIRoamingCount; - ULONG MgmtRingFullCount; - ULONG RxCountSinceLastNULL; - ULONG RxCount; - ULONG RxRingErrCount; - ULONG KickTxCount; - ULONG TxRingErrCount; - LARGE_INTEGER RealFcsErrCount; - ULONG PendingNdisPacketCount; - - ULONG OneSecOsTxCount[NUM_OF_TX_RING]; - ULONG OneSecDmaDoneCount[NUM_OF_TX_RING]; - UINT32 OneSecTxDoneCount; - ULONG OneSecRxCount; - UINT32 OneSecTxAggregationCount; - UINT32 OneSecRxAggregationCount; - UINT32 OneSecReceivedByteCount; - UINT32 OneSecFrameDuplicateCount; - - UINT32 OneSecTransmittedByteCount; // both successful and failure, used to calculate TX throughput - UINT32 OneSecTxNoRetryOkCount; - UINT32 OneSecTxRetryOkCount; - UINT32 OneSecTxFailCount; - UINT32 OneSecFalseCCACnt; // CCA error count, for debug purpose, might move to global counter - UINT32 OneSecRxOkCnt; // RX without error - UINT32 OneSecRxOkDataCnt; // unicast-to-me DATA frame count - UINT32 OneSecRxFcsErrCnt; // CRC error - UINT32 OneSecBeaconSentCnt; - UINT32 LastOneSecTotalTxCount; // OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount - UINT32 LastOneSecRxOkDataCnt; // OneSecRxOkDataCnt - ULONG DuplicateRcv; - ULONG TxAggCount; - ULONG TxNonAggCount; - ULONG TxAgg1MPDUCount; - ULONG TxAgg2MPDUCount; - ULONG TxAgg3MPDUCount; - ULONG TxAgg4MPDUCount; - ULONG TxAgg5MPDUCount; - ULONG TxAgg6MPDUCount; - ULONG TxAgg7MPDUCount; - ULONG TxAgg8MPDUCount; - ULONG TxAgg9MPDUCount; - ULONG TxAgg10MPDUCount; - ULONG TxAgg11MPDUCount; - ULONG TxAgg12MPDUCount; - ULONG TxAgg13MPDUCount; - ULONG TxAgg14MPDUCount; - ULONG TxAgg15MPDUCount; - ULONG TxAgg16MPDUCount; - - LARGE_INTEGER TransmittedOctetsInAMSDU; - LARGE_INTEGER TransmittedAMSDUCount; - LARGE_INTEGER ReceivedOctesInAMSDUCount; - LARGE_INTEGER ReceivedAMSDUCount; - LARGE_INTEGER TransmittedAMPDUCount; - LARGE_INTEGER TransmittedMPDUsInAMPDUCount; - LARGE_INTEGER TransmittedOctetsInAMPDUCount; - LARGE_INTEGER MPDUInReceivedAMPDUCount; -} COUNTER_RALINK, *PCOUNTER_RALINK; - - -typedef struct _COUNTER_DRS { - // to record the each TX rate's quality. 0 is best, the bigger the worse. - USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH]; - UCHAR PER[MAX_STEP_OF_TX_RATE_SWITCH]; - UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition - ULONG CurrTxRateStableTime; // # of second in current TX rate - BOOLEAN fNoisyEnvironment; - BOOLEAN fLastSecAccordingRSSI; - UCHAR LastSecTxRateChangeAction; // 0: no change, 1:rate UP, 2:rate down - UCHAR LastTimeTxRateChangeAction; //Keep last time value of LastSecTxRateChangeAction - ULONG LastTxOkCount; -} COUNTER_DRS, *PCOUNTER_DRS; - - - - -/*************************************************************************** - * security key related data structure - **************************************************************************/ -typedef struct _CIPHER_KEY { - UCHAR Key[16]; // right now we implement 4 keys, 128 bits max - UCHAR RxMic[8]; // make alignment - UCHAR TxMic[8]; - UCHAR TxTsc[6]; // 48bit TSC value - UCHAR RxTsc[6]; // 48bit TSC value - UCHAR CipherAlg; // 0-none, 1:WEP64, 2:WEP128, 3:TKIP, 4:AES, 5:CKIP64, 6:CKIP128 - UCHAR KeyLen; -#ifdef CONFIG_STA_SUPPORT - UCHAR BssId[6]; -#endif // CONFIG_STA_SUPPORT // - // Key length for each key, 0: entry is invalid - UCHAR Type; // Indicate Pairwise/Group when reporting MIC error -} CIPHER_KEY, *PCIPHER_KEY; - - -// structure to define WPA Group Key Rekey Interval -typedef struct PACKED _RT_802_11_WPA_REKEY { - ULONG ReKeyMethod; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based - ULONG ReKeyInterval; // time-based: seconds, packet-based: kilo-packets -} RT_WPA_REKEY,*PRT_WPA_REKEY, RT_802_11_WPA_REKEY, *PRT_802_11_WPA_REKEY; - - - -typedef struct { - UCHAR Addr[MAC_ADDR_LEN]; - UCHAR ErrorCode[2]; //00 01-Invalid authentication type - //00 02-Authentication timeout - //00 03-Challenge from AP failed - //00 04-Challenge to AP failed - BOOLEAN Reported; -} ROGUEAP_ENTRY, *PROGUEAP_ENTRY; - -typedef struct { - UCHAR RogueApNr; - ROGUEAP_ENTRY RogueApEntry[MAX_LEN_OF_BSS_TABLE]; -} ROGUEAP_TABLE, *PROGUEAP_TABLE; - -// -// Cisco IAPP format -// -typedef struct _CISCO_IAPP_CONTENT_ -{ - USHORT Length; //IAPP Length - UCHAR MessageType; //IAPP type - UCHAR FunctionCode; //IAPP function type - UCHAR DestinaionMAC[MAC_ADDR_LEN]; - UCHAR SourceMAC[MAC_ADDR_LEN]; - USHORT Tag; //Tag(element IE) - Adjacent AP report - USHORT TagLength; //Length of element not including 4 byte header - UCHAR OUI[4]; //0x00, 0x40, 0x96, 0x00 - UCHAR PreviousAP[MAC_ADDR_LEN]; //MAC Address of access point - USHORT Channel; - USHORT SsidLen; - UCHAR Ssid[MAX_LEN_OF_SSID]; - USHORT Seconds; //Seconds that the client has been disassociated. -} CISCO_IAPP_CONTENT, *PCISCO_IAPP_CONTENT; - - -/* - * Fragment Frame structure - */ -typedef struct _FRAGMENT_FRAME { - PNDIS_PACKET pFragPacket; - ULONG RxSize; - USHORT Sequence; - USHORT LastFrag; - ULONG Flags; // Some extra frame information. bit 0: LLC presented -} FRAGMENT_FRAME, *PFRAGMENT_FRAME; - - -// -// Packet information for NdisQueryPacket -// -typedef struct _PACKET_INFO { - UINT PhysicalBufferCount; // Physical breaks of buffer descripor chained - UINT BufferCount ; // Number of Buffer descriptor chained - UINT TotalPacketLength ; // Self explained - PNDIS_BUFFER pFirstBuffer; // Pointer to first buffer descriptor -} PACKET_INFO, *PPACKET_INFO; - - -// -// Arcfour Structure Added by PaulWu -// -typedef struct _ARCFOUR -{ - UINT X; - UINT Y; - UCHAR STATE[256]; -} ARCFOURCONTEXT, *PARCFOURCONTEXT; - - -// -// Tkip Key structure which RC4 key & MIC calculation -// -typedef struct _TKIP_KEY_INFO { - UINT nBytesInM; // # bytes in M for MICKEY - ULONG IV16; - ULONG IV32; - ULONG K0; // for MICKEY Low - ULONG K1; // for MICKEY Hig - ULONG L; // Current state for MICKEY - ULONG R; // Current state for MICKEY - ULONG M; // Message accumulator for MICKEY - UCHAR RC4KEY[16]; - UCHAR MIC[8]; -} TKIP_KEY_INFO, *PTKIP_KEY_INFO; - - -// -// Private / Misc data, counters for driver internal use -// -typedef struct __PRIVATE_STRUC { - UINT SystemResetCnt; // System reset counter - UINT TxRingFullCnt; // Tx ring full occurrance number - UINT PhyRxErrCnt; // PHY Rx error count, for debug purpose, might move to global counter - // Variables for WEP encryption / decryption in rtmp_wep.c - UINT FCSCRC32; - ARCFOURCONTEXT WEPCONTEXT; - // Tkip stuff - TKIP_KEY_INFO Tx; - TKIP_KEY_INFO Rx; -} PRIVATE_STRUC, *PPRIVATE_STRUC; - - -/*************************************************************************** - * Channel and BBP related data structures - **************************************************************************/ -// structure to tune BBP R66 (BBP TUNING) -typedef struct _BBP_R66_TUNING { - BOOLEAN bEnable; - USHORT FalseCcaLowerThreshold; // default 100 - USHORT FalseCcaUpperThreshold; // default 512 - UCHAR R66Delta; - UCHAR R66CurrentValue; - BOOLEAN R66LowerUpperSelect; //Before LinkUp, Used LowerBound or UpperBound as R66 value. -} BBP_R66_TUNING, *PBBP_R66_TUNING; - -// structure to store channel TX power -typedef struct _CHANNEL_TX_POWER { - USHORT RemainingTimeForUse; //unit: sec - UCHAR Channel; -#ifdef DOT11N_DRAFT3 - BOOLEAN bEffectedChannel; // For BW 40 operating in 2.4GHz , the "effected channel" is the channel that is covered in 40Mhz. -#endif // DOT11N_DRAFT3 // - CHAR Power; - CHAR Power2; - UCHAR MaxTxPwr; - UCHAR DfsReq; -} CHANNEL_TX_POWER, *PCHANNEL_TX_POWER; - -// structure to store 802.11j channel TX power -typedef struct _CHANNEL_11J_TX_POWER { - UCHAR Channel; - UCHAR BW; // BW_10 or BW_20 - CHAR Power; - CHAR Power2; - USHORT RemainingTimeForUse; //unit: sec -} CHANNEL_11J_TX_POWER, *PCHANNEL_11J_TX_POWER; - -typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT { - UCHAR EvaluatePeriod; // 0:not evalute status, 1: evaluate status, 2: switching status - UCHAR EvaluateStableCnt; - UCHAR Pair1PrimaryRxAnt; // 0:Ant-E1, 1:Ant-E2 - UCHAR Pair1SecondaryRxAnt; // 0:Ant-E1, 1:Ant-E2 - UCHAR Pair2PrimaryRxAnt; // 0:Ant-E3, 1:Ant-E4 - UCHAR Pair2SecondaryRxAnt; // 0:Ant-E3, 1:Ant-E4 -#ifdef CONFIG_STA_SUPPORT - SHORT Pair1AvgRssi[2]; // AvgRssi[0]:E1, AvgRssi[1]:E2 - SHORT Pair2AvgRssi[2]; // AvgRssi[0]:E3, AvgRssi[1]:E4 -#endif // CONFIG_STA_SUPPORT // - SHORT Pair1LastAvgRssi; // - SHORT Pair2LastAvgRssi; // - ULONG RcvPktNumWhenEvaluate; - BOOLEAN FirstPktArrivedWhenEvaluate; - RALINK_TIMER_STRUCT RxAntDiversityTimer; -} SOFT_RX_ANT_DIVERSITY, *PSOFT_RX_ANT_DIVERSITY; - - -/*************************************************************************** - * structure for radar detection and channel switch - **************************************************************************/ -typedef struct _RADAR_DETECT_STRUCT { - //BOOLEAN IEEE80211H; // 0: disable, 1: enable IEEE802.11h - UCHAR CSCount; //Channel switch counter - UCHAR CSPeriod; //Channel switch period (beacon count) - UCHAR RDCount; //Radar detection counter - UCHAR RDMode; //Radar Detection mode - UCHAR RDDurRegion; //Radar detection duration region - UCHAR BBPR16; - UCHAR BBPR17; - UCHAR BBPR18; - UCHAR BBPR21; - UCHAR BBPR22; - UCHAR BBPR64; - ULONG InServiceMonitorCount; // unit: sec - UINT8 DfsSessionTime; -#ifdef DFS_FCC_BW40_FIX - CHAR DfsSessionFccOff; -#endif - BOOLEAN bFastDfs; - UINT8 ChMovingTime; - UINT8 LongPulseRadarTh; -#ifdef MERGE_ARCH_TEAM - CHAR AvgRssiReq; - ULONG DfsLowerLimit; - ULONG DfsUpperLimit; - UINT8 FixDfsLimit; - ULONG upperlimit; - ULONG lowerlimit; -#endif // MERGE_ARCH_TEAM // -} RADAR_DETECT_STRUCT, *PRADAR_DETECT_STRUCT; - -#ifdef CARRIER_DETECTION_SUPPORT -typedef enum CD_STATE_n -{ - CD_NORMAL, - CD_SILENCE, - CD_MAX_STATE -} CD_STATE; - -#ifdef TONE_RADAR_DETECT_SUPPORT -#define CARRIER_DETECT_RECHECK_TIME 3 - - -#ifdef CARRIER_SENSE_NEW_ALGO -#define CARRIER_DETECT_CRITIRIA 400 -#define CARRIER_DETECT_STOP_RATIO 0x11 -#define CARRIER_DETECT_STOP_RATIO_OLD_3090 2 -#endif // CARRIER_SENSE_NEW_ALGO // - - -#define CARRIER_DETECT_STOP_RECHECK_TIME 4 -#define CARRIER_DETECT_CRITIRIA_A 230 -#define CARRIER_DETECT_DELTA 7 -#define CARRIER_DETECT_DIV_FLAG 0 -#ifdef RT3090 -#define CARRIER_DETECT_THRESHOLD_3090A 0x1fffffff -#endif // RT3090 // -#ifdef RT3390 -#define CARRIER_DETECT_THRESHOLD 0x0fffffff -#endif // RT3390 // -#ifndef RT3390 -#define CARRIER_DETECT_THRESHOLD 0x0fffffff -#endif // RT3390 // -#endif // TONE_RADAR_DETECT_SUPPORT // - -typedef struct CARRIER_DETECTION_s -{ - BOOLEAN Enable; - UINT8 CDSessionTime; - UINT8 CDPeriod; - CD_STATE CD_State; -#ifdef TONE_RADAR_DETECT_SUPPORT - UINT8 delta; - UINT8 div_flag; - UINT32 threshold; - UINT8 recheck; - UINT8 recheck1; - UINT8 recheck2; - UINT32 TimeStamp; - UINT32 criteria; - UINT32 CarrierDebug; - ULONG idle_time; - ULONG busy_time; - ULONG Debug; -#endif // TONE_RADAR_DETECT_SUPPORT // -}CARRIER_DETECTION_STRUCT, *PCARRIER_DETECTION_STRUCT; -#endif // CARRIER_DETECTION_SUPPORT // - - -#ifdef NEW_DFS -typedef struct _NewDFSDebug -{ - UCHAR channel; - ULONG wait_time; - UCHAR delta_delay_range; - UCHAR delta_delay_step; - UCHAR EL_range; - UCHAR EL_step; - UCHAR EH_range; - UCHAR EH_step; - UCHAR WL_range; - UCHAR WL_step; - UCHAR WH_range; - UCHAR WH_step; - ULONG T_expected; - ULONG T_margin; - UCHAR start; - ULONG count; - ULONG idx; - -}NewDFSDebug, *pNewDFSDebug; - -#define NEW_DFS_FCC_5_ENT_NUM 5 -#define NEW_DFS_DBG_PORT_ENT_NUM_POWER 8 -#define NEW_DFS_DBG_PORT_ENT_NUM (1 << NEW_DFS_DBG_PORT_ENT_NUM_POWER) // CE Debug Port entry number, 256 -#define NEW_DFS_DBG_PORT_MASK 0xff - -// Matched Period definition -#define NEW_DFS_MPERIOD_ENT_NUM_POWER 8 -#define NEW_DFS_MPERIOD_ENT_NUM (1 << NEW_DFS_MPERIOD_ENT_NUM_POWER) // CE Period Table entry number, 512 -#define NEW_DFS_MAX_CHANNEL 4 - -typedef struct _NewDFSDebugPort{ - ULONG counter; - ULONG timestamp; - USHORT width; - USHORT start_idx; // start index to period table - USHORT end_idx; // end index to period table -}NewDFSDebugPort, *pNewDFSDebugPort; - -// Matched Period Table -typedef struct _NewDFSMPeriod{ - USHORT idx; - USHORT width; - USHORT idx2; - USHORT width2; - ULONG period; -}NewDFSMPeriod, *pNewDFSMPeriod; - -#endif // NEW_DFS // - - -typedef enum _ABGBAND_STATE_ { - UNKNOWN_BAND, - BG_BAND, - A_BAND, -} ABGBAND_STATE; - -#ifdef RTMP_MAC_PCI -#ifdef CONFIG_STA_SUPPORT -// Power save method control -typedef union _PS_CONTROL { - struct { - ULONG EnablePSinIdle:1; // Enable radio off when not connect to AP. radio on only when sitesurvey, - ULONG EnableNewPS:1; // Enable new Chip power save fucntion . New method can only be applied in chip version after 2872. and PCIe. - ULONG rt30xxPowerMode:2; // Power Level Mode for rt30xx chip - ULONG rt30xxFollowHostASPM:1; // Card Follows Host's setting for rt30xx chip. - ULONG rt30xxForceASPMTest:1; // Force enable L1 for rt30xx chip. This has higher priority than rt30xxFollowHostASPM Mode. - ULONG rsv:26; // Radio Measurement Enable - } field; - ULONG word; -} PS_CONTROL, *PPS_CONTROL; -#endif // CONFIG_STA_SUPPORT // -#endif // RTMP_MAC_PCI // -/*************************************************************************** - * structure for MLME state machine - **************************************************************************/ -typedef struct _MLME_STRUCT { -#ifdef CONFIG_STA_SUPPORT - // STA state machines - STATE_MACHINE CntlMachine; - STATE_MACHINE AssocMachine; - STATE_MACHINE AuthMachine; - STATE_MACHINE AuthRspMachine; - STATE_MACHINE SyncMachine; - STATE_MACHINE WpaPskMachine; - STATE_MACHINE LeapMachine; - STATE_MACHINE_FUNC AssocFunc[ASSOC_FUNC_SIZE]; - STATE_MACHINE_FUNC AuthFunc[AUTH_FUNC_SIZE]; - STATE_MACHINE_FUNC AuthRspFunc[AUTH_RSP_FUNC_SIZE]; - STATE_MACHINE_FUNC SyncFunc[SYNC_FUNC_SIZE]; -#endif // CONFIG_STA_SUPPORT // - STATE_MACHINE_FUNC ActFunc[ACT_FUNC_SIZE]; - // Action - STATE_MACHINE ActMachine; - - -#ifdef QOS_DLS_SUPPORT - STATE_MACHINE DlsMachine; - STATE_MACHINE_FUNC DlsFunc[DLS_FUNC_SIZE]; -#endif // QOS_DLS_SUPPORT // - - - // common WPA state machine - STATE_MACHINE WpaMachine; - STATE_MACHINE_FUNC WpaFunc[WPA_FUNC_SIZE]; - - - - ULONG ChannelQuality; // 0..100, Channel Quality Indication for Roaming - ULONG Now32; // latch the value of NdisGetSystemUpTime() - ULONG LastSendNULLpsmTime; - - BOOLEAN bRunning; - NDIS_SPIN_LOCK TaskLock; - MLME_QUEUE Queue; - - UINT ShiftReg; - - RALINK_TIMER_STRUCT PeriodicTimer; - RALINK_TIMER_STRUCT APSDPeriodicTimer; - RALINK_TIMER_STRUCT LinkDownTimer; - RALINK_TIMER_STRUCT LinkUpTimer; -#ifdef RTMP_MAC_PCI - UCHAR bPsPollTimerRunning; - RALINK_TIMER_STRUCT PsPollTimer; - RALINK_TIMER_STRUCT RadioOnOffTimer; -#endif // RTMP_MAC_PCI // - ULONG PeriodicRound; - ULONG OneSecPeriodicRound; - - UCHAR RealRxPath; - BOOLEAN bLowThroughput; - BOOLEAN bEnableAutoAntennaCheck; - RALINK_TIMER_STRUCT RxAntEvalTimer; - -#ifdef RT30xx - UCHAR CaliBW40RfR24; - UCHAR CaliBW20RfR24; -#endif // RT30xx // - -} MLME_STRUCT, *PMLME_STRUCT; - - -#ifdef DOT11_N_SUPPORT -/*************************************************************************** - * 802.11 N related data structures - **************************************************************************/ -struct reordering_mpdu -{ - struct reordering_mpdu *next; - PNDIS_PACKET pPacket; /* coverted to 802.3 frame */ - int Sequence; /* sequence number of MPDU */ - BOOLEAN bAMSDU; -}; - -struct reordering_list -{ - struct reordering_mpdu *next; - int qlen; -}; - -struct reordering_mpdu_pool -{ - PVOID mem; - NDIS_SPIN_LOCK lock; - struct reordering_list freelist; -}; - -typedef enum _REC_BLOCKACK_STATUS -{ - Recipient_NONE=0, - Recipient_USED, - Recipient_HandleRes, - Recipient_Accept -} REC_BLOCKACK_STATUS, *PREC_BLOCKACK_STATUS; - -typedef enum _ORI_BLOCKACK_STATUS -{ - Originator_NONE=0, - Originator_USED, - Originator_WaitRes, - Originator_Done -} ORI_BLOCKACK_STATUS, *PORI_BLOCKACK_STATUS; - -typedef struct _BA_ORI_ENTRY{ - UCHAR Wcid; - UCHAR TID; - UCHAR BAWinSize; - UCHAR Token; -// Sequence is to fill every outgoing QoS DATA frame's sequence field in 802.11 header. - USHORT Sequence; - USHORT TimeOutValue; - ORI_BLOCKACK_STATUS ORI_BA_Status; - RALINK_TIMER_STRUCT ORIBATimer; - PVOID pAdapter; -} BA_ORI_ENTRY, *PBA_ORI_ENTRY; - -typedef struct _BA_REC_ENTRY { - UCHAR Wcid; - UCHAR TID; - UCHAR BAWinSize; // 7.3.1.14. each buffer is capable of holding a max AMSDU or MSDU. - //UCHAR NumOfRxPkt; - //UCHAR Curindidx; // the head in the RX reordering buffer - USHORT LastIndSeq; -// USHORT LastIndSeqAtTimer; - USHORT TimeOutValue; - RALINK_TIMER_STRUCT RECBATimer; - ULONG LastIndSeqAtTimer; - ULONG nDropPacket; - ULONG rcvSeq; - REC_BLOCKACK_STATUS REC_BA_Status; -// UCHAR RxBufIdxUsed; - // corresponding virtual address for RX reordering packet storage. - //RTMP_REORDERDMABUF MAP_RXBuf[MAX_RX_REORDERBUF]; - NDIS_SPIN_LOCK RxReRingLock; // Rx Ring spinlock -// struct _BA_REC_ENTRY *pNext; - PVOID pAdapter; - struct reordering_list list; -} BA_REC_ENTRY, *PBA_REC_ENTRY; - - -typedef struct { - ULONG numAsRecipient; // I am recipient of numAsRecipient clients. These client are in the BARecEntry[] - ULONG numAsOriginator; // I am originator of numAsOriginator clients. These clients are in the BAOriEntry[] - ULONG numDoneOriginator; // count Done Originator sessions - BA_ORI_ENTRY BAOriEntry[MAX_LEN_OF_BA_ORI_TABLE]; - BA_REC_ENTRY BARecEntry[MAX_LEN_OF_BA_REC_TABLE]; -} BA_TABLE, *PBA_TABLE; - -//For QureyBATableOID use; -typedef struct PACKED _OID_BA_REC_ENTRY{ - UCHAR MACAddr[MAC_ADDR_LEN]; - UCHAR BaBitmap; // if (BaBitmap&(1<MaxHTPhyMode.field.MODE >= MODE_HTMIX) - -#define IS_HT_RATE(_pMacEntry) \ - (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX) - -#define PEER_IS_HT_RATE(_pMacEntry) \ - (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX) - -#endif // DOT11_N_SUPPORT // - - -//This structure is for all 802.11n card InterOptibilityTest action. Reset all Num every n second. (Details see MLMEPeriodic) -typedef struct _IOT_STRUC { - UCHAR Threshold[2]; - UCHAR ReorderTimeOutNum[MAX_LEN_OF_BA_REC_TABLE]; // compare with threshold[0] - UCHAR RefreshNum[MAX_LEN_OF_BA_REC_TABLE]; // compare with threshold[1] - ULONG OneSecInWindowCount; - ULONG OneSecFrameDuplicateCount; - ULONG OneSecOutWindowCount; - UCHAR DelOriAct; - UCHAR DelRecAct; - UCHAR RTSShortProt; - UCHAR RTSLongProt; - BOOLEAN bRTSLongProtOn; -#ifdef CONFIG_STA_SUPPORT - BOOLEAN bLastAtheros; - BOOLEAN bCurrentAtheros; - BOOLEAN bNowAtherosBurstOn; - BOOLEAN bNextDisableRxBA; - BOOLEAN bToggle; -#endif // CONFIG_STA_SUPPORT // -} IOT_STRUC, *PIOT_STRUC; - - -// This is the registry setting for 802.11n transmit setting. Used in advanced page. -typedef union _REG_TRANSMIT_SETTING { -#ifdef RT_BIG_ENDIAN - struct { - UINT32 rsv:13; - UINT32 EXTCHA:2; - UINT32 HTMODE:1; - UINT32 TRANSNO:2; - UINT32 STBC:1; //SPACE - UINT32 ShortGI:1; - UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz - UINT32 TxBF:1; // 3*3 - UINT32 rsv0:10; - //UINT32 MCS:7; // MCS - //UINT32 PhyMode:4; - } field; -#else - struct { - //UINT32 PhyMode:4; - //UINT32 MCS:7; // MCS - UINT32 rsv0:10; - UINT32 TxBF:1; - UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz - UINT32 ShortGI:1; - UINT32 STBC:1; //SPACE - UINT32 TRANSNO:2; - UINT32 HTMODE:1; - UINT32 EXTCHA:2; - UINT32 rsv:13; - } field; -#endif - UINT32 word; -} REG_TRANSMIT_SETTING, *PREG_TRANSMIT_SETTING; - - -typedef union _DESIRED_TRANSMIT_SETTING { -#ifdef RT_BIG_ENDIAN - struct { - USHORT rsv:3; - USHORT FixedTxMode:2; // If MCS isn't AUTO, fix rate in CCK, OFDM or HT mode. - USHORT PhyMode:4; - USHORT MCS:7; // MCS - } field; -#else - struct { - USHORT MCS:7; // MCS - USHORT PhyMode:4; - USHORT FixedTxMode:2; // If MCS isn't AUTO, fix rate in CCK, OFDM or HT mode. - USHORT rsv:3; - } field; -#endif - USHORT word; - } DESIRED_TRANSMIT_SETTING, *PDESIRED_TRANSMIT_SETTING; - - - - -/*************************************************************************** - * Multiple SSID related data structures - **************************************************************************/ -#define WLAN_MAX_NUM_OF_TIM ((MAX_LEN_OF_MAC_TABLE >> 3) + 1) /* /8 + 1 */ -#define WLAN_CT_TIM_BCMC_OFFSET 0 /* unit: 32B */ - -/* clear bcmc TIM bit */ -#define WLAN_MR_TIM_BCMC_CLEAR(apidx) \ - pAd->ApCfg.MBSSID[apidx].TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] &= ~BIT8[0]; - -/* set bcmc TIM bit */ -#define WLAN_MR_TIM_BCMC_SET(apidx) \ - pAd->ApCfg.MBSSID[apidx].TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] |= BIT8[0]; - -/* clear a station PS TIM bit */ -#define WLAN_MR_TIM_BIT_CLEAR(ad_p, apidx, wcid) \ - { UCHAR tim_offset = wcid >> 3; \ - UCHAR bit_offset = wcid & 0x7; \ - ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] &= (~BIT8[bit_offset]); } - -/* set a station PS TIM bit */ -#define WLAN_MR_TIM_BIT_SET(ad_p, apidx, wcid) \ - { UCHAR tim_offset = wcid >> 3; \ - UCHAR bit_offset = wcid & 0x7; \ - ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] |= BIT8[bit_offset]; } - - -// configuration common to OPMODE_AP as well as OPMODE_STA -typedef struct _COMMON_CONFIG { - - BOOLEAN bCountryFlag; - UCHAR CountryCode[3]; - UCHAR Geography; - UCHAR CountryRegion; // Enum of country region, 0:FCC, 1:IC, 2:ETSI, 3:SPAIN, 4:France, 5:MKK, 6:MKK1, 7:Israel - UCHAR CountryRegionForABand; // Enum of country region for A band - UCHAR PhyMode; // PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED - UCHAR DesiredPhyMode; // PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED - USHORT Dsifs; // in units of usec - ULONG PacketFilter; // Packet filter for receiving - UINT8 RegulatoryClass[MAX_NUM_OF_REGULATORY_CLASS]; - - CHAR Ssid[MAX_LEN_OF_SSID]; // NOT NULL-terminated - UCHAR SsidLen; // the actual ssid length in used - UCHAR LastSsidLen; // the actual ssid length in used - CHAR LastSsid[MAX_LEN_OF_SSID]; // NOT NULL-terminated - UCHAR LastBssid[MAC_ADDR_LEN]; - - UCHAR Bssid[MAC_ADDR_LEN]; - USHORT BeaconPeriod; - UCHAR Channel; - UCHAR CentralChannel; // Central Channel when using 40MHz is indicating. not real channel. - - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR ExtRateLen; - UCHAR DesireRate[MAX_LEN_OF_SUPPORTED_RATES]; // OID_802_11_DESIRED_RATES - UCHAR MaxDesiredRate; - UCHAR ExpectedACKRate[MAX_LEN_OF_SUPPORTED_RATES]; - - ULONG BasicRateBitmap; // backup basic ratebitmap - - BOOLEAN bAPSDCapable; - BOOLEAN bInServicePeriod; - BOOLEAN bAPSDAC_BE; - BOOLEAN bAPSDAC_BK; - BOOLEAN bAPSDAC_VI; - BOOLEAN bAPSDAC_VO; - - /* because TSPEC can modify the APSD flag, we need to keep the APSD flag - requested in association stage from the station; - we need to recover the APSD flag after the TSPEC is deleted. */ - BOOLEAN bACMAPSDBackup[4]; /* for delivery-enabled & trigger-enabled both */ - BOOLEAN bACMAPSDTr[4]; /* no use */ - - BOOLEAN bNeedSendTriggerFrame; - BOOLEAN bAPSDForcePowerSave; // Force power save mode, should only use in APSD-STAUT - ULONG TriggerTimerCount; - UCHAR MaxSPLength; - UCHAR BBPCurrentBW; // BW_10, BW_20, BW_40 - // move to MULTISSID_STRUCT for MBSS - //HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI. - REG_TRANSMIT_SETTING RegTransmitSetting; //registry transmit setting. this is for reading registry setting only. not useful. - //UCHAR FixedTxMode; // Fixed Tx Mode (CCK, OFDM), for HT fixed tx mode (GF, MIX) , refer to RegTransmitSetting.field.HTMode - UCHAR TxRate; // Same value to fill in TXD. TxRate is 6-bit - UCHAR MaxTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11 - UCHAR TxRateIndex; // Tx rate index in RateSwitchTable - UCHAR TxRateTableSize; // Valid Tx rate table size in RateSwitchTable - //BOOLEAN bAutoTxRateSwitch; - UCHAR MinTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11 - UCHAR RtsRate; // RATE_xxx - HTTRANSMIT_SETTING MlmeTransmit; // MGMT frame PHY rate setting when operatin at Ht rate. - UCHAR MlmeRate; // RATE_xxx, used to send MLME frames - UCHAR BasicMlmeRate; // Default Rate for sending MLME frames - - USHORT RtsThreshold; // in unit of BYTE - USHORT FragmentThreshold; // in unit of BYTE - - UCHAR TxPower; // in unit of mW - ULONG TxPowerPercentage; // 0~100 % - ULONG TxPowerDefault; // keep for TxPowerPercentage - UINT8 PwrConstraint; - -#ifdef DOT11_N_SUPPORT - BACAP_STRUC BACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 - BACAP_STRUC REGBACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 -#endif // DOT11_N_SUPPORT // - IOT_STRUC IOTestParm; // 802.11n InterOpbility Test Parameter; - ULONG TxPreamble; // Rt802_11PreambleLong, Rt802_11PreambleShort, Rt802_11PreambleAuto - BOOLEAN bUseZeroToDisableFragment; // Microsoft use 0 as disable - ULONG UseBGProtection; // 0: auto, 1: always use, 2: always not use - BOOLEAN bUseShortSlotTime; // 0: disable, 1 - use short slot (9us) - BOOLEAN bEnableTxBurst; // 1: enble TX PACKET BURST (when BA is established or AP is not a legacy WMM AP), 0: disable TX PACKET BURST - BOOLEAN bAggregationCapable; // 1: enable TX aggregation when the peer supports it - BOOLEAN bPiggyBackCapable; // 1: enable TX piggy-back according MAC's version - BOOLEAN bIEEE80211H; // 1: enable IEEE802.11h spec. - ULONG DisableOLBCDetect; // 0: enable OLBC detect; 1 disable OLBC detect - -#ifdef DOT11_N_SUPPORT - BOOLEAN bRdg; -#endif // DOT11_N_SUPPORT // - BOOLEAN bWmmCapable; // 0:disable WMM, 1:enable WMM - QOS_CAPABILITY_PARM APQosCapability; // QOS capability of the current associated AP - EDCA_PARM APEdcaParm; // EDCA parameters of the current associated AP - QBSS_LOAD_PARM APQbssLoad; // QBSS load of the current associated AP - UCHAR AckPolicy[4]; // ACK policy of the specified AC. see ACK_xxx -#ifdef CONFIG_STA_SUPPORT - BOOLEAN bDLSCapable; // 0:disable DLS, 1:enable DLS -#endif // CONFIG_STA_SUPPORT // - // a bitmap of BOOLEAN flags. each bit represent an operation status of a particular - // BOOLEAN control, either ON or OFF. These flags should always be accessed via - // OPSTATUS_TEST_FLAG(), OPSTATUS_SET_FLAG(), OP_STATUS_CLEAR_FLAG() macros. - // see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition - ULONG OpStatusFlags; - - BOOLEAN NdisRadioStateOff; //For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff. - ABGBAND_STATE BandState; // For setting BBP used on B/G or A mode. -#ifdef ANT_DIVERSITY_SUPPORT - UCHAR bRxAntDiversity; // 0:disable, 1:enable Software Rx Antenna Diversity. -#endif // ANT_DIVERSITY_SUPPORT // - - // IEEE802.11H--DFS. - RADAR_DETECT_STRUCT RadarDetect; - -#ifdef CARRIER_DETECTION_SUPPORT - CARRIER_DETECTION_STRUCT CarrierDetect; -#endif // CARRIER_DETECTION_SUPPORT // - -#ifdef DOT11_N_SUPPORT - // HT - UCHAR BASize; // USer desired BAWindowSize. Should not exceed our max capability - //RT_HT_CAPABILITY SupportedHtPhy; - RT_HT_CAPABILITY DesiredHtPhy; - HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHTInfo; // Useful as AP. - //This IE is used with channel switch announcement element when changing to a new 40MHz. - //This IE is included in channel switch ammouncement frames 7.4.1.5, beacons, probe Rsp. - NEW_EXT_CHAN_IE NewExtChanOffset; //7.3.2.20A, 1 if extension channel is above the control channel, 3 if below, 0 if not present - -#ifdef DOT11N_DRAFT3 - UCHAR Bss2040CoexistFlag; // bit 0: bBssCoexistTimerRunning, bit 1: NeedSyncAddHtInfo. - RALINK_TIMER_STRUCT Bss2040CoexistTimer; - - //This IE is used for 20/40 BSS Coexistence. - BSS_2040_COEXIST_IE BSS2040CoexistInfo; - // ====== 11n D3.0 =======================> - USHORT Dot11OBssScanPassiveDwell; // Unit : TU. 5~1000 - USHORT Dot11OBssScanActiveDwell; // Unit : TU. 10~1000 - USHORT Dot11BssWidthTriggerScanInt; // Unit : Second - USHORT Dot11OBssScanPassiveTotalPerChannel; // Unit : TU. 200~10000 - USHORT Dot11OBssScanActiveTotalPerChannel; // Unit : TU. 20~10000 - USHORT Dot11BssWidthChanTranDelayFactor; - USHORT Dot11OBssScanActivityThre; // Unit : percentage - - ULONG Dot11BssWidthChanTranDelay; // multiple of (Dot11BssWidthTriggerScanInt * Dot11BssWidthChanTranDelayFactor) - ULONG CountDownCtr; // CountDown Counter from (Dot11BssWidthTriggerScanInt * Dot11BssWidthChanTranDelayFactor) - - NDIS_SPIN_LOCK TriggerEventTabLock; - BSS_2040_COEXIST_IE LastBSSCoexist2040; - BSS_2040_COEXIST_IE BSSCoexist2040; - TRIGGER_EVENT_TAB TriggerEventTab; - UCHAR ChannelListIdx; - // <====== 11n D3.0 ======================= - BOOLEAN bOverlapScanning; -#endif // DOT11N_DRAFT3 // - - BOOLEAN bHTProtect; - BOOLEAN bMIMOPSEnable; - BOOLEAN bBADecline; -//2008/11/05: KH add to support Antenna power-saving of AP<-- - BOOLEAN bGreenAPEnable; - BOOLEAN bBlockAntDivforGreenAP; -//2008/11/05: KH add to support Antenna power-saving of AP--> - BOOLEAN bDisableReordering; - BOOLEAN bForty_Mhz_Intolerant; - BOOLEAN bExtChannelSwitchAnnouncement; - BOOLEAN bRcvBSSWidthTriggerEvents; - ULONG LastRcvBSSWidthTriggerEventsTime; - - UCHAR TxBASize; -#endif // DOT11_N_SUPPORT // - - // Enable wireless event - BOOLEAN bWirelessEvent; - BOOLEAN bWiFiTest; // Enable this parameter for WiFi test - - // Tx & Rx Stream number selection - UCHAR TxStream; - UCHAR RxStream; - - // transmit phy mode, trasmit rate for Multicast. -#ifdef MCAST_RATE_SPECIFIC - UCHAR McastTransmitMcs; - UCHAR McastTransmitPhyMode; -#endif // MCAST_RATE_SPECIFIC // - - BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled - - - - NDIS_SPIN_LOCK MeasureReqTabLock; - PMEASURE_REQ_TAB pMeasureReqTab; - - NDIS_SPIN_LOCK TpcReqTabLock; - PTPC_REQ_TAB pTpcReqTab; - - // transmit phy mode, trasmit rate for Multicast. -#ifdef MCAST_RATE_SPECIFIC - HTTRANSMIT_SETTING MCastPhyMode; -#endif // MCAST_RATE_SPECIFIC // - -#ifdef SINGLE_SKU - UINT16 DefineMaxTxPwr; -#endif // SINGLE_SKU // - - - BOOLEAN PSPXlink; // 0: Disable. 1: Enable - - -#if defined(RT305x)||defined(RT30xx) - // request by Gary, for High Power issue - UCHAR HighPowerPatchDisabled; -#endif - - BOOLEAN HT_DisallowTKIP; /* Restrict the encryption type in 11n HT mode */ -} COMMON_CONFIG, *PCOMMON_CONFIG; - - -#ifdef CONFIG_STA_SUPPORT -/* Modified by Wu Xi-Kun 4/21/2006 */ -// STA configuration and status -typedef struct _STA_ADMIN_CONFIG { - // GROUP 1 - - // User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe - // the user intended configuration, but not necessary fully equal to the final - // settings in ACTIVE BSS after negotiation/compromize with the BSS holder (either - // AP or IBSS holder). - // Once initialized, user configuration can only be changed via OID_xxx - UCHAR BssType; // BSS_INFRA or BSS_ADHOC - USHORT AtimWin; // used when starting a new IBSS - - // GROUP 2 - - // User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe - // the user intended configuration, and should be always applied to the final - // settings in ACTIVE BSS without compromising with the BSS holder. - // Once initialized, user configuration can only be changed via OID_xxx - UCHAR RssiTrigger; - UCHAR RssiTriggerMode; // RSSI_TRIGGERED_UPON_BELOW_THRESHOLD or RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD - USHORT DefaultListenCount; // default listen count; - ULONG WindowsPowerMode; // Power mode for AC power - ULONG WindowsBatteryPowerMode; // Power mode for battery if exists - BOOLEAN bWindowsACCAMEnable; // Enable CAM power mode when AC on - BOOLEAN bAutoReconnect; // Set to TRUE when setting OID_802_11_SSID with no matching BSSID - ULONG WindowsPowerProfile; // Windows power profile, for NDIS5.1 PnP - - // MIB:ieee802dot11.dot11smt(1).dot11StationConfigTable(1) - USHORT Psm; // power management mode (PWR_ACTIVE|PWR_SAVE) - USHORT DisassocReason; - UCHAR DisassocSta[MAC_ADDR_LEN]; - USHORT DeauthReason; - UCHAR DeauthSta[MAC_ADDR_LEN]; - USHORT AuthFailReason; - UCHAR AuthFailSta[MAC_ADDR_LEN]; - - NDIS_802_11_PRIVACY_FILTER PrivacyFilter; // PrivacyFilter enum for 802.1X - NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined - NDIS_802_11_WEP_STATUS WepStatus; - NDIS_802_11_WEP_STATUS OrigWepStatus; // Original wep status set from OID - - // Add to support different cipher suite for WPA2/WPA mode - NDIS_802_11_ENCRYPTION_STATUS GroupCipher; // Multicast cipher suite - NDIS_802_11_ENCRYPTION_STATUS PairCipher; // Unicast cipher suite - BOOLEAN bMixCipher; // Indicate current Pair & Group use different cipher suites - USHORT RsnCapability; - - NDIS_802_11_WEP_STATUS GroupKeyWepStatus; - - UCHAR WpaPassPhrase[64]; // WPA PSK pass phrase - UINT WpaPassPhraseLen; // the length of WPA PSK pass phrase - UCHAR PMK[32]; // WPA PSK mode PMK - UCHAR PTK[64]; // WPA PSK mode PTK - UCHAR GTK[32]; // GTK from authenticator - BSSID_INFO SavedPMK[PMKID_NO]; - UINT SavedPMKNum; // Saved PMKID number - - UCHAR DefaultKeyId; - - - // WPA 802.1x port control, WPA_802_1X_PORT_SECURED, WPA_802_1X_PORT_NOT_SECURED - UCHAR PortSecured; - - // For WPA countermeasures - ULONG LastMicErrorTime; // record last MIC error time - ULONG MicErrCnt; // Should be 0, 1, 2, then reset to zero (after disassoiciation). - BOOLEAN bBlockAssoc; // Block associate attempt for 60 seconds after counter measure occurred. - // For WPA-PSK supplicant state - WPA_STATE WpaState; // Default is SS_NOTUSE and handled by microsoft 802.1x - UCHAR ReplayCounter[8]; - UCHAR ANonce[32]; // ANonce for WPA-PSK from aurhenticator - UCHAR SNonce[32]; // SNonce for WPA-PSK - - UCHAR LastSNR0; // last received BEACON's SNR - UCHAR LastSNR1; // last received BEACON's SNR for 2nd antenna - RSSI_SAMPLE RssiSample; - ULONG NumOfAvgRssiSample; - - ULONG LastBeaconRxTime; // OS's timestamp of the last BEACON RX time - ULONG Last11bBeaconRxTime; // OS's timestamp of the last 11B BEACON RX time - ULONG Last11gBeaconRxTime; // OS's timestamp of the last 11G BEACON RX time - ULONG Last20NBeaconRxTime; // OS's timestamp of the last 20MHz N BEACON RX time - - ULONG LastScanTime; // Record last scan time for issue BSSID_SCAN_LIST - ULONG ScanCnt; // Scan counts since most recent SSID, BSSID, SCAN OID request - BOOLEAN bSwRadio; // Software controlled Radio On/Off, TRUE: On - BOOLEAN bHwRadio; // Hardware controlled Radio On/Off, TRUE: On - BOOLEAN bRadio; // Radio state, And of Sw & Hw radio state - BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled - BOOLEAN bShowHiddenSSID; // Show all known SSID in SSID list get operation - - // New for WPA, windows want us to to keep association information and - // Fixed IEs from last association response - NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo; - USHORT ReqVarIELen; // Length of next VIE include EID & Length - UCHAR ReqVarIEs[MAX_VIE_LEN]; // The content saved here should be little-endian format. - USHORT ResVarIELen; // Length of next VIE include EID & Length - UCHAR ResVarIEs[MAX_VIE_LEN]; - - UCHAR RSNIE_Len; - UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; // The content saved here should be little-endian format. - - ULONG CLBusyBytes; // Save the total bytes received durning channel load scan time - USHORT RPIDensity[8]; // Array for RPI density collection - - UCHAR RMReqCnt; // Number of measurement request saved. - UCHAR CurrentRMReqIdx; // Number of measurement request saved. - BOOLEAN ParallelReq; // Parallel measurement, only one request performed, - // It must be the same channel with maximum duration - USHORT ParallelDuration; // Maximum duration for parallel measurement - UCHAR ParallelChannel; // Only one channel with parallel measurement - USHORT IAPPToken; // IAPP dialog token - // Hack for channel load and noise histogram parameters - UCHAR NHFactor; // Parameter for Noise histogram - UCHAR CLFactor; // Parameter for channel load - - RALINK_TIMER_STRUCT StaQuickResponeForRateUpTimer; - BOOLEAN StaQuickResponeForRateUpTimerRunning; - - UCHAR DtimCount; // 0.. DtimPeriod-1 - UCHAR DtimPeriod; // default = 3 - -#ifdef QOS_DLS_SUPPORT - RT_802_11_DLS DLSEntry[MAX_NUM_OF_DLS_ENTRY]; - UCHAR DlsReplayCounter[8]; -#endif // QOS_DLS_SUPPORT // - //////////////////////////////////////////////////////////////////////////////////////// - // This is only for WHQL test. - BOOLEAN WhqlTest; - //////////////////////////////////////////////////////////////////////////////////////// - - RALINK_TIMER_STRUCT WpaDisassocAndBlockAssocTimer; - // Fast Roaming - BOOLEAN bAutoRoaming; // 0:disable auto roaming by RSSI, 1:enable auto roaming by RSSI - CHAR dBmToRoam; // the condition to roam when receiving Rssi less than this value. It's negative value. - -#ifdef WPA_SUPPLICANT_SUPPORT - BOOLEAN IEEE8021X; - BOOLEAN IEEE8021x_required_keys; - CIPHER_KEY DesireSharedKey[4]; // Record user desired WEP keys - UCHAR DesireSharedKeyId; - - // 0: driver ignores wpa_supplicant - // 1: wpa_supplicant initiates scanning and AP selection - // 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters - UCHAR WpaSupplicantUP; - UCHAR WpaSupplicantScanCount; - BOOLEAN bRSN_IE_FromWpaSupplicant; -#endif // WPA_SUPPLICANT_SUPPORT // - - CHAR dev_name[16]; - USHORT OriDevType; - - BOOLEAN bTGnWifiTest; - BOOLEAN bScanReqIsFromWebUI; - - HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI. - DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; - RT_HT_PHY_INFO DesiredHtPhyInfo; - BOOLEAN bAutoTxRateSwitch; - -#ifdef RTMP_MAC_PCI - UCHAR BBPR3; - // PS Control has 2 meanings for advanced power save function. - // 1. EnablePSinIdle : When no connection, always radio off except need to do site survey. - // 2. EnableNewPS : will save more current in sleep or radio off mode. - PS_CONTROL PSControl; -#endif // RTMP_MAC_PCI // - -#ifdef EXT_BUILD_CHANNEL_LIST - UCHAR IEEE80211dClientMode; - UCHAR StaOriCountryCode[3]; - UCHAR StaOriGeography; -#endif // EXT_BUILD_CHANNEL_LIST // - - - - BOOLEAN bAutoConnectByBssid; - ULONG BeaconLostTime; // seconds - BOOLEAN bForceTxBurst; // 1: force enble TX PACKET BURST, 0: disable -} STA_ADMIN_CONFIG, *PSTA_ADMIN_CONFIG; - -// This data structure keep the current active BSS/IBSS's configuration that this STA -// had agreed upon joining the network. Which means these parameters are usually decided -// by the BSS/IBSS creator instead of user configuration. Data in this data structurre -// is valid only when either ADHOC_ON(pAd) or INFRA_ON(pAd) is TRUE. -// Normally, after SCAN or failed roaming attempts, we need to recover back to -// the current active settings. -typedef struct _STA_ACTIVE_CONFIG { - USHORT Aid; - USHORT AtimWin; // in kusec; IBSS parameter set element - USHORT CapabilityInfo; - USHORT CfpMaxDuration; - USHORT CfpPeriod; - - // Copy supported rate from desired AP's beacon. We are trying to match - // AP's supported and extended rate settings. - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen; - UCHAR ExtRateLen; - // Copy supported ht from desired AP's beacon. We are trying to match - RT_HT_PHY_INFO SupportedPhyInfo; - RT_HT_CAPABILITY SupportedHtPhy; -} STA_ACTIVE_CONFIG, *PSTA_ACTIVE_CONFIG; - - - -#endif // CONFIG_STA_SUPPORT // - - - -typedef struct _MAC_TABLE_ENTRY { - //Choose 1 from ValidAsWDS and ValidAsCLI to validize. - BOOLEAN ValidAsCLI; // Sta mode, set this TRUE after Linkup,too. - BOOLEAN ValidAsWDS; // This is WDS Entry. only for AP mode. - BOOLEAN ValidAsApCli; //This is a AP-Client entry, only for AP mode which enable AP-Client functions. - BOOLEAN ValidAsMesh; - BOOLEAN ValidAsDls; // This is DLS Entry. only for STA mode. - BOOLEAN isCached; - BOOLEAN bIAmBadAtheros; // Flag if this is Atheros chip that has IOT problem. We need to turn on RTS/CTS protection. - - UCHAR EnqueueEapolStartTimerRunning; // Enqueue EAPoL-Start for triggering EAP SM - //jan for wpa - // record which entry revoke MIC Failure , if it leaves the BSS itself, AP won't update aMICFailTime MIB - UCHAR CMTimerRunning; - UCHAR apidx; // MBSS number - UCHAR RSNIE_Len; - UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; - UCHAR ANonce[LEN_KEY_DESC_NONCE]; - UCHAR SNonce[LEN_KEY_DESC_NONCE]; - UCHAR R_Counter[LEN_KEY_DESC_REPLAY]; - UCHAR PTK[64]; - UCHAR ReTryCounter; - RALINK_TIMER_STRUCT RetryTimer; - RALINK_TIMER_STRUCT EnqueueStartForPSKTimer; // A timer which enqueue EAPoL-Start for triggering PSK SM - NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined - NDIS_802_11_WEP_STATUS WepStatus; - NDIS_802_11_WEP_STATUS GroupKeyWepStatus; - AP_WPA_STATE WpaState; - GTK_STATE GTKState; - USHORT PortSecured; - NDIS_802_11_PRIVACY_FILTER PrivacyFilter; // PrivacyFilter enum for 802.1X - CIPHER_KEY PairwiseKey; - PVOID pAd; - INT PMKID_CacheIdx; - UCHAR PMKID[LEN_PMKID]; - - - UCHAR Addr[MAC_ADDR_LEN]; - UCHAR PsMode; - SST Sst; - AUTH_STATE AuthState; // for SHARED KEY authentication state machine used only - BOOLEAN IsReassocSta; // Indicate whether this is a reassociation procedure - USHORT Aid; - USHORT CapabilityInfo; - UCHAR LastRssi; - ULONG NoDataIdleCount; - UINT16 StationKeepAliveCount; // unit: second - ULONG PsQIdleCount; - QUEUE_HEADER PsQueue; - - UINT32 StaConnectTime; // the live time of this station since associated with AP - - -#ifdef DOT11_N_SUPPORT - BOOLEAN bSendBAR; - USHORT NoBADataCountDown; - - UINT32 CachedBuf[16]; // UINT (4 bytes) for alignment - UINT TxBFCount; // 3*3 -#endif // DOT11_N_SUPPORT // - UINT FIFOCount; - UINT DebugFIFOCount; - UINT DebugTxCount; - BOOLEAN bDlsInit; - - -//==================================================== -//WDS entry needs these -// if ValidAsWDS==TRUE, MatchWDSTabIdx is the index in WdsTab.MacTab - UINT MatchWDSTabIdx; - UCHAR MaxSupportedRate; - UCHAR CurrTxRate; - UCHAR CurrTxRateIndex; - // to record the each TX rate's quality. 0 is best, the bigger the worse. - USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH]; -// USHORT OneSecTxOkCount; - UINT32 OneSecTxNoRetryOkCount; - UINT32 OneSecTxRetryOkCount; - UINT32 OneSecTxFailCount; - UINT32 ContinueTxFailCnt; - UINT32 CurrTxRateStableTime; // # of second in current TX rate - UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition -#ifdef WDS_SUPPORT - BOOLEAN LockEntryTx; // TRUE = block to WDS Entry traffic, FALSE = not. - UINT32 TimeStamp_toTxRing; -#endif // WDS_SUPPORT // - -//==================================================== - - - -#ifdef CONFIG_STA_SUPPORT -#ifdef QOS_DLS_SUPPORT - UINT MatchDlsEntryIdx; // indicate the index in pAd->StaCfg.DLSEntry -#endif // QOS_DLS_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - - BOOLEAN fNoisyEnvironment; - BOOLEAN fLastSecAccordingRSSI; - UCHAR LastSecTxRateChangeAction; // 0: no change, 1:rate UP, 2:rate down - CHAR LastTimeTxRateChangeAction; //Keep last time value of LastSecTxRateChangeAction - ULONG LastTxOkCount; - UCHAR PER[MAX_STEP_OF_TX_RATE_SWITCH]; - - // a bitmap of BOOLEAN flags. each bit represent an operation status of a particular - // BOOLEAN control, either ON or OFF. These flags should always be accessed via - // CLIENT_STATUS_TEST_FLAG(), CLIENT_STATUS_SET_FLAG(), CLIENT_STATUS_CLEAR_FLAG() macros. - // see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition. fCLIENT_STATUS_AMSDU_INUSED - ULONG ClientStatusFlags; - - HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI. - -#ifdef DOT11_N_SUPPORT - // HT EWC MIMO-N used parameters - USHORT RXBAbitmap; // fill to on-chip RXWI_BA_BITMASK in 8.1.3RX attribute entry format - USHORT TXBAbitmap; // This bitmap as originator, only keep in software used to mark AMPDU bit in TXWI - USHORT TXAutoBAbitmap; - USHORT BADeclineBitmap; - USHORT BARecWcidArray[NUM_OF_TID]; // The mapping wcid of recipient session. if RXBAbitmap bit is masked - USHORT BAOriWcidArray[NUM_OF_TID]; // The mapping wcid of originator session. if TXBAbitmap bit is masked - USHORT BAOriSequence[NUM_OF_TID]; // The mapping wcid of originator session. if TXBAbitmap bit is masked - - // 802.11n features. - UCHAR MpduDensity; - UCHAR MaxRAmpduFactor; - UCHAR AMsduSize; - UCHAR MmpsMode; // MIMO power save more. - - HT_CAPABILITY_IE HTCapability; - -#ifdef DOT11N_DRAFT3 - UCHAR BSS2040CoexistenceMgmtSupport; -#endif // DOT11N_DRAFT3 // -#endif // DOT11_N_SUPPORT // - - BOOLEAN bAutoTxRateSwitch; - - UCHAR RateLen; - struct _MAC_TABLE_ENTRY *pNext; - USHORT TxSeq[NUM_OF_TID]; - USHORT NonQosDataSeq; - - RSSI_SAMPLE RssiSample; - - UINT32 TXMCSExpected[16]; - UINT32 TXMCSSuccessful[16]; - UINT32 TXMCSFailed[16]; - UINT32 TXMCSAutoFallBack[16][16]; - -#ifdef CONFIG_STA_SUPPORT - ULONG LastBeaconRxTime; -#endif // CONFIG_STA_SUPPORT // - - - - ULONG AssocDeadLine; - - - - ULONG ChannelQuality; // 0..100, Channel Quality Indication for Roaming - -} MAC_TABLE_ENTRY, *PMAC_TABLE_ENTRY; - -typedef struct _MAC_TABLE { - USHORT Size; - MAC_TABLE_ENTRY *Hash[HASH_TABLE_SIZE]; - MAC_TABLE_ENTRY Content[MAX_LEN_OF_MAC_TABLE]; - QUEUE_HEADER McastPsQueue; - ULONG PsQIdleCount; - BOOLEAN fAnyStationInPsm; - BOOLEAN fAnyStationBadAtheros; // Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip. - BOOLEAN fAnyTxOPForceDisable; // Check if it is necessary to disable BE TxOP - BOOLEAN fAllStationAsRalink; // Check if all stations are ralink-chipset -#ifdef DOT11_N_SUPPORT - BOOLEAN fAnyStationIsLegacy; // Check if I use legacy rate to transmit to my BSS Station/ - BOOLEAN fAnyStationNonGF; // Check if any Station can't support GF. - BOOLEAN fAnyStation20Only; // Check if any Station can't support GF. - BOOLEAN fAnyStationMIMOPSDynamic; // Check if any Station is MIMO Dynamic - BOOLEAN fAnyBASession; // Check if there is BA session. Force turn on RTS/CTS -//2008/10/28: KH add to support Antenna power-saving of AP<-- -//2008/10/28: KH add to support Antenna power-saving of AP--> -#endif // DOT11_N_SUPPORT // -} MAC_TABLE, *PMAC_TABLE; - - - - -#ifdef BLOCK_NET_IF -typedef struct _BLOCK_QUEUE_ENTRY -{ - BOOLEAN SwTxQueueBlockFlag; - LIST_HEADER NetIfList; -} BLOCK_QUEUE_ENTRY, *PBLOCK_QUEUE_ENTRY; -#endif // BLOCK_NET_IF // - - -struct wificonf -{ - BOOLEAN bShortGI; - BOOLEAN bGreenField; -}; - - -typedef struct _RTMP_DEV_INFO_ -{ - UCHAR chipName[16]; - RTMP_INF_TYPE infType; -}RTMP_DEV_INFO; - - -#ifdef DBG_DIAGNOSE -#define DIAGNOSE_TIME 10 // 10 sec -typedef struct _RtmpDiagStrcut_ -{ // Diagnosis Related element - unsigned char inited; - unsigned char qIdx; - unsigned char ArrayStartIdx; - unsigned char ArrayCurIdx; - // Tx Related Count - USHORT TxDataCnt[DIAGNOSE_TIME]; - USHORT TxFailCnt[DIAGNOSE_TIME]; -// USHORT TxDescCnt[DIAGNOSE_TIME][16]; // TxDesc queue length in scale of 0~14, >=15 - USHORT TxDescCnt[DIAGNOSE_TIME][24]; // 3*3 // TxDesc queue length in scale of 0~14, >=15 -// USHORT TxMcsCnt[DIAGNOSE_TIME][16]; // TxDate MCS Count in range from 0 to 15, step in 1. - USHORT TxMcsCnt[DIAGNOSE_TIME][24]; // 3*3 - USHORT TxSWQueCnt[DIAGNOSE_TIME][9]; // TxSwQueue length in scale of 0, 1, 2, 3, 4, 5, 6, 7, >=8 - - USHORT TxAggCnt[DIAGNOSE_TIME]; - USHORT TxNonAggCnt[DIAGNOSE_TIME]; -// USHORT TxAMPDUCnt[DIAGNOSE_TIME][16]; // 10 sec, TxDMA APMDU Aggregation count in range from 0 to 15, in setp of 1. - USHORT TxAMPDUCnt[DIAGNOSE_TIME][24]; // 3*3 // 10 sec, TxDMA APMDU Aggregation count in range from 0 to 15, in setp of 1. - USHORT TxRalinkCnt[DIAGNOSE_TIME]; // TxRalink Aggregation Count in 1 sec scale. - USHORT TxAMSDUCnt[DIAGNOSE_TIME]; // TxAMSUD Aggregation Count in 1 sec scale. - - // Rx Related Count - USHORT RxDataCnt[DIAGNOSE_TIME]; // Rx Total Data count. - USHORT RxCrcErrCnt[DIAGNOSE_TIME]; -// USHORT RxMcsCnt[DIAGNOSE_TIME][16]; // Rx MCS Count in range from 0 to 15, step in 1. - USHORT RxMcsCnt[DIAGNOSE_TIME][24]; // 3*3 -}RtmpDiagStruct; -#endif // DBG_DIAGNOSE // - - -struct _RTMP_CHIP_OP_ -{ - /* Calibration access related callback functions */ - int (*eeinit)(RTMP_ADAPTER *pAd); /* int (*eeinit)(RTMP_ADAPTER *pAd); */ - int (*eeread)(RTMP_ADAPTER *pAd, USHORT offset, PUSHORT pValue); /* int (*eeread)(RTMP_ADAPTER *pAd, int offset, PUSHORT pValue); */ - int (*eewrite)(RTMP_ADAPTER *pAd, USHORT offset, USHORT value);; /* int (*eewrite)(RTMP_ADAPTER *pAd, int offset, USHORT value); */ - - /* MCU related callback functions */ - int (*loadFirmware)(RTMP_ADAPTER *pAd); /* int (*loadFirmware)(RTMP_ADAPTER *pAd); */ - int (*eraseFirmware)(RTMP_ADAPTER *pAd); /* int (*eraseFirmware)(RTMP_ADAPTER *pAd); */ - int (*sendCommandToMcu)(RTMP_ADAPTER *pAd, UCHAR cmd, UCHAR token, UCHAR arg0, UCHAR arg1);; /* int (*sendCommandToMcu)(RTMP_ADAPTER *pAd, UCHAR cmd, UCHAR token, UCHAR arg0, UCHAR arg1); */ - - /* RF access related callback functions */ - REG_PAIR *pRFRegTable; - void (*AsicRfInit)(RTMP_ADAPTER *pAd); - void (*AsicRfTurnOn)(RTMP_ADAPTER *pAd); - void (*AsicRfTurnOff)(RTMP_ADAPTER *pAd); - void (*AsicReverseRfFromSleepMode)(RTMP_ADAPTER *pAd); - void (*AsicHaltAction)(RTMP_ADAPTER *pAd); -}; - - -// -// The miniport adapter structure -// -struct _RTMP_ADAPTER -{ - PVOID OS_Cookie; // save specific structure relative to OS - PNET_DEV net_dev; - ULONG VirtualIfCnt; - - RTMP_CHIP_OP chipOps; - USHORT ThisTbttNumToNextWakeUp; - -#ifdef INF_AMAZON_PPA - UINT32 g_if_id; - BOOLEAN PPAEnable; - PPA_DIRECTPATH_CB *pDirectpathCb; -#endif // INF_AMAZON_PPA // - -#ifdef RTMP_MAC_PCI -/*****************************************************************************************/ -/* PCI related parameters */ -/*****************************************************************************************/ - PUCHAR CSRBaseAddress; // PCI MMIO Base Address, all access will use - unsigned int irq_num; - - USHORT LnkCtrlBitMask; - USHORT RLnkCtrlConfiguration; - USHORT RLnkCtrlOffset; - USHORT HostLnkCtrlConfiguration; - USHORT HostLnkCtrlOffset; - USHORT PCIePowerSaveLevel; - ULONG Rt3xxHostLinkCtrl; // USed for 3090F chip - ULONG Rt3xxRalinkLinkCtrl; // USed for 3090F chip - USHORT DeviceID; // Read from PCI config - ULONG AccessBBPFailCount; - BOOLEAN bPCIclkOff; // flag that indicate if the PICE power status in Configuration SPace.. - BOOLEAN bPCIclkOffDisableTx; // - - BOOLEAN brt30xxBanMcuCmd; //when = 0xff means all commands are ok to set . - BOOLEAN b3090ESpecialChip; //3090E special chip that write EEPROM 0x24=0x9280. - ULONG CheckDmaBusyCount; // Check Interrupt Status Register Count. - - UINT int_enable_reg; - UINT int_disable_mask; - UINT int_pending; - - - RTMP_DMABUF TxBufSpace[NUM_OF_TX_RING]; // Shared memory of all 1st pre-allocated TxBuf associated with each TXD - RTMP_DMABUF RxDescRing; // Shared memory for RX descriptors - RTMP_DMABUF TxDescRing[NUM_OF_TX_RING]; // Shared memory for Tx descriptors - RTMP_TX_RING TxRing[NUM_OF_TX_RING]; // AC0~4 + HCCA -#endif // RTMP_MAC_PCI // - - - NDIS_SPIN_LOCK irq_lock; - UCHAR irq_disabled; - - -/*****************************************************************************************/ -/* RBUS related parameters */ -/*****************************************************************************************/ - - -/*****************************************************************************************/ -/* Both PCI/USB related parameters */ -/*****************************************************************************************/ - //RTMP_DEV_INFO chipInfo; - RTMP_INF_TYPE infType; - -/*****************************************************************************************/ -/* Driver Mgmt related parameters */ -/*****************************************************************************************/ - RTMP_OS_TASK mlmeTask; -#ifdef RTMP_TIMER_TASK_SUPPORT - // If you want use timer task to handle the timer related jobs, enable this. - RTMP_TIMER_TASK_QUEUE TimerQ; - NDIS_SPIN_LOCK TimerQLock; - RTMP_OS_TASK timerTask; -#endif // RTMP_TIMER_TASK_SUPPORT // - - -/*****************************************************************************************/ -/* Tx related parameters */ -/*****************************************************************************************/ - BOOLEAN DeQueueRunning[NUM_OF_TX_RING]; // for ensuring RTUSBDeQueuePacket get call once - NDIS_SPIN_LOCK DeQueueLock[NUM_OF_TX_RING]; - - - // resource for software backlog queues - QUEUE_HEADER TxSwQueue[NUM_OF_TX_RING]; // 4 AC + 1 HCCA - NDIS_SPIN_LOCK TxSwQueueLock[NUM_OF_TX_RING]; // TxSwQueue spinlock - - RTMP_DMABUF MgmtDescRing; // Shared memory for MGMT descriptors - RTMP_MGMT_RING MgmtRing; - NDIS_SPIN_LOCK MgmtRingLock; // Prio Ring spinlock - - -/*****************************************************************************************/ -/* Rx related parameters */ -/*****************************************************************************************/ - -#ifdef RTMP_MAC_PCI - RTMP_RX_RING RxRing; - NDIS_SPIN_LOCK RxRingLock; // Rx Ring spinlock -#ifdef RT3090 - NDIS_SPIN_LOCK McuCmdLock; //MCU Command Queue spinlock -#endif // RT3090 // -#endif // RTMP_MAC_PCI // - - - -/*****************************************************************************************/ -/* ASIC related parameters */ -/*****************************************************************************************/ - UINT32 MACVersion; // MAC version. Record rt2860C(0x28600100) or rt2860D (0x28600101).. - - // --------------------------- - // E2PROM - // --------------------------- - ULONG EepromVersion; // byte 0: version, byte 1: revision, byte 2~3: unused - ULONG FirmwareVersion; // byte 0: Minor version, byte 1: Major version, otherwise unused. - USHORT EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS]; - UCHAR EEPROMAddressNum; // 93c46=6 93c66=8 - BOOLEAN EepromAccess; - UCHAR EFuseTag; - - - // --------------------------- - // BBP Control - // --------------------------- -#ifdef MERGE_ARCH_TEAM - UCHAR BbpWriteLatch[256]; // record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID -#else - UCHAR BbpWriteLatch[140]; // record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID -#endif // MERGE_ARCH_TEAM // - CHAR BbpRssiToDbmDelta; // change from UCHAR to CHAR for high power - BBP_R66_TUNING BbpTuning; - - // ---------------------------- - // RFIC control - // ---------------------------- - UCHAR RfIcType; // RFIC_xxx - ULONG RfFreqOffset; // Frequency offset for channel switching - RTMP_RF_REGS LatchRfRegs; // latch th latest RF programming value since RF IC doesn't support READ - - EEPROM_ANTENNA_STRUC Antenna; // Since ANtenna definition is different for a & g. We need to save it for future reference. - EEPROM_NIC_CONFIG2_STRUC NicConfig2; - - // This soft Rx Antenna Diversity mechanism is used only when user set - // RX Antenna = DIVERSITY ON - SOFT_RX_ANT_DIVERSITY RxAnt; - - UCHAR RFProgSeq; - CHANNEL_TX_POWER TxPower[MAX_NUM_OF_CHANNELS]; // Store Tx power value for all channels. - CHANNEL_TX_POWER ChannelList[MAX_NUM_OF_CHANNELS]; // list all supported channels for site survey - CHANNEL_11J_TX_POWER TxPower11J[MAX_NUM_OF_11JCHANNELS]; // 802.11j channel and bw - CHANNEL_11J_TX_POWER ChannelList11J[MAX_NUM_OF_11JCHANNELS]; // list all supported channels for site survey - - UCHAR ChannelListNum; // number of channel in ChannelList[] - UCHAR Bbp94; - BOOLEAN BbpForCCK; - ULONG Tx20MPwrCfgABand[5]; - ULONG Tx20MPwrCfgGBand[5]; - ULONG Tx40MPwrCfgABand[5]; - ULONG Tx40MPwrCfgGBand[5]; - - BOOLEAN bAutoTxAgcA; // Enable driver auto Tx Agc control - UCHAR TssiRefA; // Store Tssi reference value as 25 temperature. - UCHAR TssiPlusBoundaryA[5]; // Tssi boundary for increase Tx power to compensate. - UCHAR TssiMinusBoundaryA[5]; // Tssi boundary for decrease Tx power to compensate. - UCHAR TxAgcStepA; // Store Tx TSSI delta increment / decrement value - CHAR TxAgcCompensateA; // Store the compensation (TxAgcStep * (idx-1)) - - BOOLEAN bAutoTxAgcG; // Enable driver auto Tx Agc control - UCHAR TssiRefG; // Store Tssi reference value as 25 temperature. - UCHAR TssiPlusBoundaryG[5]; // Tssi boundary for increase Tx power to compensate. - UCHAR TssiMinusBoundaryG[5]; // Tssi boundary for decrease Tx power to compensate. - UCHAR TxAgcStepG; // Store Tx TSSI delta increment / decrement value - CHAR TxAgcCompensateG; // Store the compensation (TxAgcStep * (idx-1)) - - CHAR BGRssiOffset0; // Store B/G RSSI#0 Offset value on EEPROM 0x46h - CHAR BGRssiOffset1; // Store B/G RSSI#1 Offset value - CHAR BGRssiOffset2; // Store B/G RSSI#2 Offset value - - CHAR ARssiOffset0; // Store A RSSI#0 Offset value on EEPROM 0x4Ah - CHAR ARssiOffset1; // Store A RSSI#1 Offset value - CHAR ARssiOffset2; // Store A RSSI#2 Offset value - - CHAR BLNAGain; // Store B/G external LNA#0 value on EEPROM 0x44h - CHAR ALNAGain0; // Store A external LNA#0 value for ch36~64 - CHAR ALNAGain1; // Store A external LNA#1 value for ch100~128 - CHAR ALNAGain2; // Store A external LNA#2 value for ch132~165 -#ifdef RT30xx - // for 3572 - UCHAR Bbp25; - UCHAR Bbp26; - - UCHAR TxMixerGain24G; // Tx mixer gain value from EEPROM to improve Tx EVM / Tx DAC, 2.4G - UCHAR TxMixerGain5G; -#endif // RT30xx // - // ---------------------------- - // LED control - // ---------------------------- - MCU_LEDCS_STRUC LedCntl; - USHORT Led1; // read from EEPROM 0x3c - USHORT Led2; // EEPROM 0x3e - USHORT Led3; // EEPROM 0x40 - UCHAR LedIndicatorStrength; - UCHAR RssiSingalstrengthOffet; - BOOLEAN bLedOnScanning; - UCHAR LedStatus; - -/*****************************************************************************************/ -/* 802.11 related parameters */ -/*****************************************************************************************/ - // outgoing BEACON frame buffer and corresponding TXD - TXWI_STRUC BeaconTxWI; - PUCHAR BeaconBuf; - USHORT BeaconOffset[HW_BEACON_MAX_COUNT]; - - // pre-build PS-POLL and NULL frame upon link up. for efficiency purpose. - PSPOLL_FRAME PsPollFrame; - HEADER_802_11 NullFrame; - - - - -//=========AP=========== - - -//=======STA=========== -#ifdef CONFIG_STA_SUPPORT - // ----------------------------------------------- - // STA specific configuration & operation status - // used only when pAd->OpMode == OPMODE_STA - // ----------------------------------------------- - STA_ADMIN_CONFIG StaCfg; // user desired settings - STA_ACTIVE_CONFIG StaActive; // valid only when ADHOC_ON(pAd) || INFRA_ON(pAd) - CHAR nickname[IW_ESSID_MAX_SIZE+1]; // nickname, only used in the iwconfig i/f - NDIS_MEDIA_STATE PreMediaState; -#endif // CONFIG_STA_SUPPORT // - -//=======Common=========== - // OP mode: either AP or STA - UCHAR OpMode; // OPMODE_STA, OPMODE_AP - - NDIS_MEDIA_STATE IndicateMediaState; // Base on Indication state, default is NdisMediaStateDisConnected - - - /* MAT related parameters */ - - // configuration: read from Registry & E2PROM - BOOLEAN bLocalAdminMAC; // Use user changed MAC - UCHAR PermanentAddress[MAC_ADDR_LEN]; // Factory default MAC address - UCHAR CurrentAddress[MAC_ADDR_LEN]; // User changed MAC address - - // ------------------------------------------------------ - // common configuration to both OPMODE_STA and OPMODE_AP - // ------------------------------------------------------ - COMMON_CONFIG CommonCfg; - MLME_STRUCT Mlme; - - // AP needs those vaiables for site survey feature. - MLME_AUX MlmeAux; // temporary settings used during MLME state machine - BSS_TABLE ScanTab; // store the latest SCAN result - - //About MacTab, the sta driver will use #0 and #1 for multicast and AP. - MAC_TABLE MacTab; // ASIC on-chip WCID entry table. At TX, ASIC always use key according to this on-chip table. - NDIS_SPIN_LOCK MacTabLock; - -#ifdef DOT11_N_SUPPORT - BA_TABLE BATable; - NDIS_SPIN_LOCK BATabLock; - RALINK_TIMER_STRUCT RECBATimer; -#endif // DOT11_N_SUPPORT // - - // encryption/decryption KEY tables - CIPHER_KEY SharedKey[MAX_MBSSID_NUM][4]; // STA always use SharedKey[BSS0][0..3] - - // RX re-assembly buffer for fragmentation - FRAGMENT_FRAME FragFrame; // Frame storage for fragment frame - - // various Counters - COUNTER_802_3 Counters8023; // 802.3 counters - COUNTER_802_11 WlanCounters; // 802.11 MIB counters - COUNTER_RALINK RalinkCounters; // Ralink propriety counters - COUNTER_DRS DrsCounters; // counters for Dynamic TX Rate Switching - PRIVATE_STRUC PrivateInfo; // Private information & counters - - // flags, see fRTMP_ADAPTER_xxx flags - ULONG Flags; // Represent current device status - ULONG PSFlags; // Power Save operation flag. - - // current TX sequence # - USHORT Sequence; - - // Control disconnect / connect event generation - //+++Didn't used anymore - ULONG LinkDownTime; - //--- - ULONG LastRxRate; - ULONG LastTxRate; - //+++Used only for Station - BOOLEAN bConfigChanged; // Config Change flag for the same SSID setting - //--- - - ULONG ExtraInfo; // Extra information for displaying status - ULONG SystemErrorBitmap; // b0: E2PROM version error - - //+++Didn't used anymore - ULONG MacIcVersion; // MAC/BBP serial interface issue solved after ver.D - //--- - - // --------------------------- - // System event log - // --------------------------- - RT_802_11_EVENT_TABLE EventTab; - - - BOOLEAN HTCEnable; - - /*****************************************************************************************/ - /* Statistic related parameters */ - /*****************************************************************************************/ - - BOOLEAN bUpdateBcnCntDone; - ULONG watchDogMacDeadlock; // prevent MAC/BBP into deadlock condition - // ---------------------------- - // DEBUG paramerts - // ---------------------------- - //ULONG DebugSetting[4]; - BOOLEAN bBanAllBaSetup; - BOOLEAN bPromiscuous; - - // ---------------------------- - // rt2860c emulation-use Parameters - // ---------------------------- - //ULONG rtsaccu[30]; - //ULONG ctsaccu[30]; - //ULONG cfendaccu[30]; - //ULONG bacontent[16]; - //ULONG rxint[RX_RING_SIZE+1]; - //UCHAR rcvba[60]; - BOOLEAN bLinkAdapt; - BOOLEAN bForcePrintTX; - BOOLEAN bForcePrintRX; - //BOOLEAN bDisablescanning; //defined in RT2870 USB - BOOLEAN bStaFifoTest; - BOOLEAN bProtectionTest; - /* - BOOLEAN bHCCATest; - BOOLEAN bGenOneHCCA; - */ - BOOLEAN bBroadComHT; - //+++Following add from RT2870 USB. - ULONG BulkOutReq; - ULONG BulkOutComplete; - ULONG BulkOutCompleteOther; - ULONG BulkOutCompleteCancel; // seems not use now? - ULONG BulkInReq; - ULONG BulkInComplete; - ULONG BulkInCompleteFail; - //--- - - struct wificonf WIFItestbed; - -#ifdef RALINK_ATE - ATE_INFO ate; -#endif // RALINK_ATE // - -#ifdef DOT11_N_SUPPORT - struct reordering_mpdu_pool mpdu_blk_pool; -#endif // DOT11_N_SUPPORT // - - ULONG OneSecondnonBEpackets; // record non BE packets per second - -#ifdef LINUX -#if WIRELESS_EXT >= 12 - struct iw_statistics iw_stats; -#endif - - struct net_device_stats stats; -#endif // LINUX // - -#ifdef BLOCK_NET_IF - BLOCK_QUEUE_ENTRY blockQueueTab[NUM_OF_TX_RING]; -#endif // BLOCK_NET_IF // - - - -#ifdef MULTIPLE_CARD_SUPPORT - INT32 MC_RowID; - STRING MC_FileName[256]; -#endif // MULTIPLE_CARD_SUPPORT // - - ULONG TbttTickCount; -#ifdef PCI_MSI_SUPPORT - BOOLEAN HaveMsi; -#endif // PCI_MSI_SUPPORT // - - - UCHAR is_on; - -#define TIME_BASE (1000000/OS_HZ) -#define TIME_ONE_SECOND (1000000/TIME_BASE) - UCHAR flg_be_adjust; - ULONG be_adjust_last_time; - -#ifdef NINTENDO_AP - NINDO_CTRL_BLOCK nindo_ctrl_block; -#endif // NINTENDO_AP // - - -#ifdef IKANOS_VX_1X0 - struct IKANOS_TX_INFO IkanosTxInfo; - struct IKANOS_TX_INFO IkanosRxInfo[MAX_MBSSID_NUM + MAX_WDS_ENTRY + MAX_APCLI_NUM + MAX_MESH_NUM]; -#endif // IKANOS_VX_1X0 // - - -#ifdef DBG_DIAGNOSE - RtmpDiagStruct DiagStruct; -#endif // DBG_DIAGNOSE // - - - UINT8 FlgCtsEnabled; - UINT8 PM_FlgSuspend; - -#ifdef RT30xx -#ifdef RTMP_EFUSE_SUPPORT - BOOLEAN bUseEfuse; - BOOLEAN bEEPROMFile; - BOOLEAN bFroceEEPROMBuffer; - UCHAR EEPROMImage[1024]; -#endif // RTMP_EFUSE_SUPPORT // -#endif // RT30xx // - -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // - -}; - - - -#ifdef TONE_RADAR_DETECT_SUPPORT -#define DELAYINTMASK 0x0013fffb -#define INTMASK 0x0013fffb -#define IndMask 0x0013fffc -#define RadarInt 0x00100000 -#else -#define DELAYINTMASK 0x0003fffb -#define INTMASK 0x0003fffb -#define IndMask 0x0003fffc -#endif // TONE_RADAR_DETECT_SUPPORT // - -#define RxINT 0x00000005 // Delayed Rx or indivi rx -#define TxDataInt 0x000000fa // Delayed Tx or indivi tx -#define TxMgmtInt 0x00000102 // Delayed Tx or indivi tx -#define TxCoherent 0x00020000 // tx coherent -#define RxCoherent 0x00010000 // rx coherent -#define McuCommand 0x00000200 // mcu -#define PreTBTTInt 0x00001000 // Pre-TBTT interrupt -#define TBTTInt 0x00000800 // TBTT interrupt -#define GPTimeOutInt 0x00008000 // GPtimeout interrupt -#define AutoWakeupInt 0x00004000 // AutoWakeupInt interrupt -#define FifoStaFullInt 0x00002000 // fifo statistics full interrupt - - -/*************************************************************************** - * Rx Path software control block related data structures - **************************************************************************/ -typedef struct _RX_BLK_ -{ -// RXD_STRUC RxD; // sample - RT28XX_RXD_STRUC RxD; - PRXWI_STRUC pRxWI; - PHEADER_802_11 pHeader; - PNDIS_PACKET pRxPacket; - UCHAR *pData; - USHORT DataSize; - USHORT Flags; - UCHAR UserPriority; // for calculate TKIP MIC using -} RX_BLK; - - -#define RX_BLK_SET_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags |= _flag) -#define RX_BLK_TEST_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags & _flag) -#define RX_BLK_CLEAR_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags &= ~(_flag)) - - -#define fRX_WDS 0x0001 -#define fRX_AMSDU 0x0002 -#define fRX_ARALINK 0x0004 -#define fRX_HTC 0x0008 -#define fRX_PAD 0x0010 -#define fRX_AMPDU 0x0020 -#define fRX_QOS 0x0040 -#define fRX_INFRA 0x0080 -#define fRX_EAP 0x0100 -#define fRX_MESH 0x0200 -#define fRX_APCLI 0x0400 -#define fRX_DLS 0x0800 -#define fRX_WPI 0x1000 - -#define LENGTH_AMSDU_SUBFRAMEHEAD 14 -#define LENGTH_ARALINK_SUBFRAMEHEAD 14 -#define LENGTH_ARALINK_HEADER_FIELD 2 - - -/*************************************************************************** - * Tx Path software control block related data structures - **************************************************************************/ -#define TX_UNKOWN_FRAME 0x00 -#define TX_MCAST_FRAME 0x01 -#define TX_LEGACY_FRAME 0x02 -#define TX_AMPDU_FRAME 0x04 -#define TX_AMSDU_FRAME 0x08 -#define TX_RALINK_FRAME 0x10 -#define TX_FRAG_FRAME 0x20 - - -// Currently the sizeof(TX_BLK) is 148 bytes. -typedef struct _TX_BLK_ -{ - UCHAR QueIdx; - UCHAR TxFrameType; // Indicate the Transmission type of the all frames in one batch - UCHAR TotalFrameNum; // Total frame number want to send-out in one batch - USHORT TotalFragNum; // Total frame fragments required in one batch - USHORT TotalFrameLen; // Total length of all frames want to send-out in one batch - - QUEUE_HEADER TxPacketList; - MAC_TABLE_ENTRY *pMacEntry; // NULL: packet with 802.11 RA field is multicast/broadcast address - HTTRANSMIT_SETTING *pTransmit; - - // Following structure used for the characteristics of a specific packet. - PNDIS_PACKET pPacket; - PUCHAR pSrcBufHeader; // Reference to the head of sk_buff->data - PUCHAR pSrcBufData; // Reference to the sk_buff->data, will changed depends on hanlding progresss - UINT SrcBufLen; // Length of packet payload which not including Layer 2 header - PUCHAR pExtraLlcSnapEncap; // NULL means no extra LLC/SNAP is required - UCHAR HeaderBuf[96]; // TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP - UCHAR MpduHeaderLen; // 802.11 header length NOT including the padding - UCHAR HdrPadLen; // recording Header Padding Length; - UCHAR apidx; // The interface associated to this packet - UCHAR Wcid; // The MAC entry associated to this packet - UCHAR UserPriority; // priority class of packet - UCHAR FrameGap; // what kind of IFS this packet use - UCHAR MpduReqNum; // number of fragments of this frame - UCHAR TxRate; // TODO: Obsoleted? Should change to MCS? - UCHAR CipherAlg; // cipher alogrithm - PCIPHER_KEY pKey; - - - - USHORT Flags; //See following definitions for detail. - - //YOU SHOULD NOT TOUCH IT! Following parameters are used for hardware-depended layer. - ULONG Priv; // Hardware specific value saved in here. - -} TX_BLK, *PTX_BLK; - - -#define fTX_bRtsRequired 0x0001 // Indicate if need send RTS frame for protection. Not used in RT2860/RT2870. -#define fTX_bAckRequired 0x0002 // the packet need ack response -#define fTX_bPiggyBack 0x0004 // Legacy device use Piggback or not -#define fTX_bHTRate 0x0008 // allow to use HT rate -#define fTX_bForceNonQoS 0x0010 // force to transmit frame without WMM-QoS in HT mode -#define fTX_bAllowFrag 0x0020 // allow to fragment the packet, A-MPDU, A-MSDU, A-Ralink is not allowed to fragment -#define fTX_bMoreData 0x0040 // there are more data packets in PowerSave Queue -#define fTX_bWMM 0x0080 // QOS Data -#define fTX_bClearEAPFrame 0x0100 - - - -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // - - - - -#define TX_BLK_SET_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags |= _flag) -#define TX_BLK_TEST_FLAG(_pTxBlk, _flag) (((_pTxBlk->Flags & _flag) == _flag) ? 1 : 0) -#define TX_BLK_CLEAR_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags &= ~(_flag)) - - - - -#ifdef RT_BIG_ENDIAN -/*************************************************************************** - * Endian conversion related functions - **************************************************************************/ -/* - ======================================================================== - - Routine Description: - Endian conversion of Tx/Rx descriptor . - - Arguments: - pAd Pointer to our adapter - pData Pointer to Tx/Rx descriptor - DescriptorType Direction of the frame - - Return Value: - None - - Note: - Call this function when read or update descriptor - ======================================================================== -*/ -static inline VOID RTMPWIEndianChange( - IN PUCHAR pData, - IN ULONG DescriptorType) -{ - int size; - int i; - - size = ((DescriptorType == TYPE_TXWI) ? TXWI_SIZE : RXWI_SIZE); - - if(DescriptorType == TYPE_TXWI) - { - *((UINT32 *)(pData)) = SWAP32(*((UINT32 *)(pData))); // Byte 0~3 - *((UINT32 *)(pData + 4)) = SWAP32(*((UINT32 *)(pData+4))); // Byte 4~7 - } - else - { - for(i=0; i < size/4 ; i++) - *(((UINT32 *)pData) +i) = SWAP32(*(((UINT32 *)pData)+i)); - } -} - - -#ifdef RTMP_MAC_PCI -static inline VOID WriteBackToDescriptor( - IN PUCHAR Dest, - IN PUCHAR Src, - IN BOOLEAN DoEncrypt, - IN ULONG DescriptorType) -{ - UINT32 *p1, *p2; - - p1 = ((UINT32 *)Dest); - p2 = ((UINT32 *)Src); - - *p1 = *p2; - *(p1+2) = *(p2+2); - *(p1+3) = *(p2+3); - *(p1+1) = *(p2+1); // Word 1; this must be written back last -} -#endif // RTMP_MAC_PCI // - - -/* - ======================================================================== - - Routine Description: - Endian conversion of Tx/Rx descriptor . - - Arguments: - pAd Pointer to our adapter - pData Pointer to Tx/Rx descriptor - DescriptorType Direction of the frame - - Return Value: - None - - Note: - Call this function when read or update descriptor - ======================================================================== -*/ -#ifdef RTMP_MAC_PCI -static inline VOID RTMPDescriptorEndianChange( - IN PUCHAR pData, - IN ULONG DescriptorType) -{ - *((UINT32 *)(pData)) = SWAP32(*((UINT32 *)(pData))); // Byte 0~3 - *((UINT32 *)(pData + 8)) = SWAP32(*((UINT32 *)(pData+8))); // Byte 8~11 - *((UINT32 *)(pData +12)) = SWAP32(*((UINT32 *)(pData + 12))); // Byte 12~15 - *((UINT32 *)(pData + 4)) = SWAP32(*((UINT32 *)(pData + 4))); // Byte 4~7, this must be swapped last -} -#endif // RTMP_MAC_PCI // - -/* - ======================================================================== - - Routine Description: - Endian conversion of all kinds of 802.11 frames . - - Arguments: - pAd Pointer to our adapter - pData Pointer to the 802.11 frame structure - Dir Direction of the frame - FromRxDoneInt Caller is from RxDone interrupt - - Return Value: - None - - Note: - Call this function when read or update buffer data - ======================================================================== -*/ -static inline VOID RTMPFrameEndianChange( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG Dir, - IN BOOLEAN FromRxDoneInt) -{ - PHEADER_802_11 pFrame; - PUCHAR pMacHdr; - - // swab 16 bit fields - Frame Control field - if(Dir == DIR_READ) - { - *(USHORT *)pData = SWAP16(*(USHORT *)pData); - } - - pFrame = (PHEADER_802_11) pData; - pMacHdr = (PUCHAR) pFrame; - - // swab 16 bit fields - Duration/ID field - *(USHORT *)(pMacHdr + 2) = SWAP16(*(USHORT *)(pMacHdr + 2)); - - // swab 16 bit fields - Sequence Control field - *(USHORT *)(pMacHdr + 22) = SWAP16(*(USHORT *)(pMacHdr + 22)); - - if(pFrame->FC.Type == BTYPE_MGMT) - { - switch(pFrame->FC.SubType) - { - case SUBTYPE_ASSOC_REQ: - case SUBTYPE_REASSOC_REQ: - // swab 16 bit fields - CapabilityInfo field - pMacHdr += sizeof(HEADER_802_11); - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - - // swab 16 bit fields - Listen Interval field - pMacHdr += 2; - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - break; - - case SUBTYPE_ASSOC_RSP: - case SUBTYPE_REASSOC_RSP: - // swab 16 bit fields - CapabilityInfo field - pMacHdr += sizeof(HEADER_802_11); - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - - // swab 16 bit fields - Status Code field - pMacHdr += 2; - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - - // swab 16 bit fields - AID field - pMacHdr += 2; - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - break; - - case SUBTYPE_AUTH: - // If from APHandleRxDoneInterrupt routine, it is still a encrypt format. - // The convertion is delayed to RTMPHandleDecryptionDoneInterrupt. - if(!FromRxDoneInt && pFrame->FC.Wep == 1) - break; - else - { - // swab 16 bit fields - Auth Alg No. field - pMacHdr += sizeof(HEADER_802_11); - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - - // swab 16 bit fields - Auth Seq No. field - pMacHdr += 2; - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - - // swab 16 bit fields - Status Code field - pMacHdr += 2; - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - } - break; - - case SUBTYPE_BEACON: - case SUBTYPE_PROBE_RSP: - // swab 16 bit fields - BeaconInterval field - pMacHdr += (sizeof(HEADER_802_11) + TIMESTAMP_LEN); - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - - // swab 16 bit fields - CapabilityInfo field - pMacHdr += sizeof(USHORT); - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - break; - - case SUBTYPE_DEAUTH: - case SUBTYPE_DISASSOC: - // swab 16 bit fields - Reason code field - pMacHdr += sizeof(HEADER_802_11); - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - break; - } - } - else if( pFrame->FC.Type == BTYPE_DATA ) - { - } - else if(pFrame->FC.Type == BTYPE_CNTL) - { - switch(pFrame->FC.SubType) - { - case SUBTYPE_BLOCK_ACK_REQ: - { - PFRAME_BA_REQ pBAReq = (PFRAME_BA_REQ)pFrame; - *(USHORT *)(&pBAReq->BARControl) = SWAP16(*(USHORT *)(&pBAReq->BARControl)); - pBAReq->BAStartingSeq.word = SWAP16(pBAReq->BAStartingSeq.word); - } - break; - case SUBTYPE_BLOCK_ACK: - // For Block Ack packet, the HT_CONTROL field is in the same offset with Addr3 - *(UINT32 *)(&pFrame->Addr3[0]) = SWAP32(*(UINT32 *)(&pFrame->Addr3[0])); - break; - - case SUBTYPE_ACK: - //For ACK packet, the HT_CONTROL field is in the same offset with Addr2 - *(UINT32 *)(&pFrame->Addr2[0])= SWAP32(*(UINT32 *)(&pFrame->Addr2[0])); - break; - } - } - else - { - DBGPRINT(RT_DEBUG_ERROR,("Invalid Frame Type!!!\n")); - } - - // swab 16 bit fields - Frame Control - if(Dir == DIR_WRITE) - { - *(USHORT *)pData = SWAP16(*(USHORT *)pData); - } -} -#endif // RT_BIG_ENDIAN // - - -/*************************************************************************** - * Other static inline function definitions - **************************************************************************/ -static inline VOID ConvertMulticastIP2MAC( - IN PUCHAR pIpAddr, - IN PUCHAR *ppMacAddr, - IN UINT16 ProtoType) -{ - if (pIpAddr == NULL) - return; - - if (ppMacAddr == NULL || *ppMacAddr == NULL) - return; - - switch (ProtoType) - { - case ETH_P_IPV6: -// memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS); - *(*ppMacAddr) = 0x33; - *(*ppMacAddr + 1) = 0x33; - *(*ppMacAddr + 2) = pIpAddr[12]; - *(*ppMacAddr + 3) = pIpAddr[13]; - *(*ppMacAddr + 4) = pIpAddr[14]; - *(*ppMacAddr + 5) = pIpAddr[15]; - break; - - case ETH_P_IP: - default: -// memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS); - *(*ppMacAddr) = 0x01; - *(*ppMacAddr + 1) = 0x00; - *(*ppMacAddr + 2) = 0x5e; - *(*ppMacAddr + 3) = pIpAddr[1] & 0x7f; - *(*ppMacAddr + 4) = pIpAddr[2]; - *(*ppMacAddr + 5) = pIpAddr[3]; - break; - } - - return; -} - - -char *GetPhyMode(int Mode); -char* GetBW(int BW); - - - -BOOLEAN RTMPCheckForHang( - IN NDIS_HANDLE MiniportAdapterContext); - -VOID RTMPHalt( - IN NDIS_HANDLE MiniportAdapterContext); - -// -// Private routines in rtmp_init.c -// -NDIS_STATUS RTMPAllocAdapterBlock( - IN PVOID handle, - OUT PRTMP_ADAPTER *ppAdapter); - -NDIS_STATUS RTMPAllocTxRxRingMemory( - IN PRTMP_ADAPTER pAd); - -NDIS_STATUS RTMPFindAdapter( - IN PRTMP_ADAPTER pAd, - IN NDIS_HANDLE WrapperConfigurationContext); - -NDIS_STATUS RTMPReadParametersHook( - IN PRTMP_ADAPTER pAd); - -NDIS_STATUS RTMPSetProfileParameters( - IN RTMP_ADAPTER *pAd, - IN PSTRING pBuffer); - -INT RTMPGetKeyParameter( - IN PSTRING key, - OUT PSTRING dest, - IN INT destsize, - IN PSTRING buffer, - IN BOOLEAN bTrimSpace); - -VOID RTMPFreeAdapter( - IN PRTMP_ADAPTER pAd); - -NDIS_STATUS NICReadRegParameters( - IN PRTMP_ADAPTER pAd, - IN NDIS_HANDLE WrapperConfigurationContext); - -#ifdef RTMP_RF_RW_SUPPORT -VOID NICInitRFRegisters( - IN PRTMP_ADAPTER pAd); - -VOID RtmpChipOpsRFHook( - IN RTMP_ADAPTER *pAd); - -NDIS_STATUS RT30xxWriteRFRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR regID, - IN UCHAR value); - -NDIS_STATUS RT30xxReadRFRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR regID, - IN PUCHAR pValue); -#endif // RTMP_RF_RW_SUPPORT // - -VOID NICReadEEPROMParameters( - IN PRTMP_ADAPTER pAd, - IN PUCHAR mac_addr); - -VOID NICInitAsicFromEEPROM( - IN PRTMP_ADAPTER pAd); - - -NDIS_STATUS NICInitializeAdapter( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bHardReset); - -NDIS_STATUS NICInitializeAsic( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bHardReset); - -VOID NICIssueReset( - IN PRTMP_ADAPTER pAd); - -VOID RTMPRingCleanUp( - IN PRTMP_ADAPTER pAd, - IN UCHAR RingType); - -VOID RxTest( - IN PRTMP_ADAPTER pAd); - -NDIS_STATUS DbgSendPacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket); - -VOID UserCfgInit( - IN PRTMP_ADAPTER pAd); - -VOID NICResetFromError( - IN PRTMP_ADAPTER pAd); - -NDIS_STATUS NICLoadFirmware( - IN PRTMP_ADAPTER pAd); - -VOID NICEraseFirmware( - IN PRTMP_ADAPTER pAd); - -NDIS_STATUS NICLoadRateSwitchingParams( - IN PRTMP_ADAPTER pAd); - -BOOLEAN NICCheckForHang( - IN PRTMP_ADAPTER pAd); - -VOID NICUpdateFifoStaCounters( - IN PRTMP_ADAPTER pAd); - -VOID NICUpdateRawCounters( - IN PRTMP_ADAPTER pAd); - -VOID RTMPZeroMemory( - IN PVOID pSrc, - IN ULONG Length); - -ULONG RTMPCompareMemory( - IN PVOID pSrc1, - IN PVOID pSrc2, - IN ULONG Length); - -VOID RTMPMoveMemory( - OUT PVOID pDest, - IN PVOID pSrc, - IN ULONG Length); - -VOID AtoH( - PSTRING src, - PUCHAR dest, - int destlen); - -UCHAR BtoH( - char ch); - -VOID RTMPPatchMacBbpBug( - IN PRTMP_ADAPTER pAd); - -VOID RTMPPatchCardBus( - IN PRTMP_ADAPTER pAdapter); - -VOID RTMPPatchRalinkCardBus( - IN PRTMP_ADAPTER pAdapter, - IN ULONG Bus); - -ULONG RTMPReadCBConfig( - IN ULONG Bus, - IN ULONG Slot, - IN ULONG Func, - IN ULONG Offset); - -VOID RTMPWriteCBConfig( - IN ULONG Bus, - IN ULONG Slot, - IN ULONG Func, - IN ULONG Offset, - IN ULONG Value); - -VOID RTMPInitTimer( - IN PRTMP_ADAPTER pAd, - IN PRALINK_TIMER_STRUCT pTimer, - IN PVOID pTimerFunc, - IN PVOID pData, - IN BOOLEAN Repeat); - -VOID RTMPSetTimer( - IN PRALINK_TIMER_STRUCT pTimer, - IN ULONG Value); - - -VOID RTMPModTimer( - IN PRALINK_TIMER_STRUCT pTimer, - IN ULONG Value); - -VOID RTMPCancelTimer( - IN PRALINK_TIMER_STRUCT pTimer, - OUT BOOLEAN *pCancelled); - -VOID RTMPSetLED( - IN PRTMP_ADAPTER pAd, - IN UCHAR Status); - -VOID RTMPSetSignalLED( - IN PRTMP_ADAPTER pAd, - IN NDIS_802_11_RSSI Dbm); - - -VOID RTMPEnableRxTx( - IN PRTMP_ADAPTER pAd); - -// -// prototype in action.c -// -VOID ActionStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - OUT STATE_MACHINE_FUNC Trans[]); - -VOID MlmeADDBAAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MlmeDELBAAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MlmeDLSAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MlmeInvalidAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MlmeQOSAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -#ifdef DOT11_N_SUPPORT -VOID PeerAddBAReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerAddBARspAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerDelBAAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerBAAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); -#endif // DOT11_N_SUPPORT // - -VOID SendPSMPAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR Psmp); - - -VOID PeerRMAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerPublicAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -#ifdef CONFIG_STA_SUPPORT -VOID StaPublicAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Bss2040Coexist); -#endif // CONFIG_STA_SUPPORT // - - -VOID PeerBSSTranAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -#ifdef DOT11_N_SUPPORT -VOID PeerHTAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); -#endif // DOT11_N_SUPPORT // - -VOID PeerQOSAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -#ifdef QOS_DLS_SUPPORT -VOID PeerDLSAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); -#endif // QOS_DLS_SUPPORT // - -#ifdef CONFIG_STA_SUPPORT -#ifdef QOS_DLS_SUPPORT -VOID DlsParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_DLS_REQ_STRUCT *pDlsReq, - IN PRT_802_11_DLS pDls, - IN USHORT reason); -#endif // QOS_DLS_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - -#ifdef DOT11_N_SUPPORT -VOID RECBATimerTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID ORIBATimerTimeout( - IN PRTMP_ADAPTER pAd); - -VOID SendRefreshBAR( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry); - -#ifdef DOT11N_DRAFT3 -VOID SendBSS2040CoexistMgmtAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR apidx, - IN UCHAR InfoReq); - -VOID SendNotifyBWActionFrame( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR apidx); - -BOOLEAN ChannelSwitchSanityCheck( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR NewChannel, - IN UCHAR Secondary); - -VOID ChannelSwitchAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR Channel, - IN UCHAR Secondary); - -ULONG BuildIntolerantChannelRep( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDest); - -VOID Update2040CoexistFrameAndNotify( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN BOOLEAN bAddIntolerantCha); - -VOID Send2040CoexistAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN BOOLEAN bAddIntolerantCha); -#endif // DOT11N_DRAFT3 // -#endif // DOT11_N_SUPPORT // - -VOID ActHeaderInit( - IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, - IN PUCHAR Addr1, - IN PUCHAR Addr2, - IN PUCHAR Addr3); - -VOID BarHeaderInit( - IN PRTMP_ADAPTER pAd, - IN OUT PFRAME_BAR pCntlBar, - IN PUCHAR pDA, - IN PUCHAR pSA); - -VOID InsertActField( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 Category, - IN UINT8 ActCode); - -BOOLEAN QosBADataParse( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bAMSDU, - IN PUCHAR p8023Header, - IN UCHAR WCID, - IN UCHAR TID, - IN USHORT Sequence, - IN UCHAR DataOffset, - IN USHORT Datasize, - IN UINT CurRxIndex); - -#ifdef DOT11_N_SUPPORT -BOOLEAN CntlEnqueueForRecv( - IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN ULONG MsgLen, - IN PFRAME_BA_REQ pMsg); - -VOID BaAutoManSwitch( - IN PRTMP_ADAPTER pAd); -#endif // DOT11_N_SUPPORT // - -VOID HTIOTCheck( - IN PRTMP_ADAPTER pAd, - IN UCHAR BatRecIdx); - -// -// Private routines in rtmp_data.c -// -BOOLEAN RTMPHandleRxDoneInterrupt( - IN PRTMP_ADAPTER pAd); - -VOID RTMPHandleTxDoneInterrupt( - IN PRTMP_ADAPTER pAd); - -BOOLEAN RTMPHandleTxRingDmaDoneInterrupt( - IN PRTMP_ADAPTER pAd, - IN INT_SOURCE_CSR_STRUC TxRingBitmap); - -VOID RTMPHandleMgmtRingDmaDoneInterrupt( - IN PRTMP_ADAPTER pAd); - -VOID RTMPHandleTBTTInterrupt( - IN PRTMP_ADAPTER pAd); - -VOID RTMPHandlePreTBTTInterrupt( - IN PRTMP_ADAPTER pAd); - -void RTMPHandleTwakeupInterrupt( - IN PRTMP_ADAPTER pAd); - -VOID RTMPHandleRxCoherentInterrupt( - IN PRTMP_ADAPTER pAd); - - -BOOLEAN TxFrameIsAggregatible( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pPrevAddr1, - IN PUCHAR p8023hdr); - -BOOLEAN PeerIsAggreOn( - IN PRTMP_ADAPTER pAd, - IN ULONG TxRate, - IN PMAC_TABLE_ENTRY pMacEntry); - - -NDIS_STATUS Sniff2BytesFromNdisBuffer( - IN PNDIS_BUFFER pFirstBuffer, - IN UCHAR DesiredOffset, - OUT PUCHAR pByte0, - OUT PUCHAR pByte1); - -NDIS_STATUS STASendPacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket); - -VOID STASendPackets( - IN NDIS_HANDLE MiniportAdapterContext, - IN PPNDIS_PACKET ppPacketArray, - IN UINT NumberOfPackets); - -VOID RTMPDeQueuePacket( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bIntContext, - IN UCHAR QueIdx, - IN UCHAR Max_Tx_Packets); - -NDIS_STATUS RTMPHardTransmit( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN UCHAR QueIdx, - OUT PULONG pFreeTXDLeft); - -NDIS_STATUS STAHardTransmit( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR QueIdx); - -VOID STARxEAPOLFrameIndicate( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID); - -NDIS_STATUS RTMPFreeTXDRequest( - IN PRTMP_ADAPTER pAd, - IN UCHAR RingType, - IN UCHAR NumberRequired, - IN PUCHAR FreeNumberIs); - -NDIS_STATUS MlmeHardTransmit( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket); - -NDIS_STATUS MlmeHardTransmitMgmtRing( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket); - -#ifdef RTMP_MAC_PCI -NDIS_STATUS MlmeHardTransmitTxRing( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket); - -NDIS_STATUS MlmeDataHardTransmit( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket); - -VOID RTMPWriteTxDescriptor( - IN PRTMP_ADAPTER pAd, - IN PTXD_STRUC pTxD, - IN BOOLEAN bWIV, - IN UCHAR QSEL); -#endif // RTMP_MAC_PCI // - -USHORT RTMPCalcDuration( - IN PRTMP_ADAPTER pAd, - IN UCHAR Rate, - IN ULONG Size); - -VOID RTMPWriteTxWI( - IN PRTMP_ADAPTER pAd, - IN PTXWI_STRUC pTxWI, - IN BOOLEAN FRAG, - IN BOOLEAN CFACK, - IN BOOLEAN InsTimestamp, - IN BOOLEAN AMPDU, - IN BOOLEAN Ack, - IN BOOLEAN NSeq, // HW new a sequence. - IN UCHAR BASize, - IN UCHAR WCID, - IN ULONG Length, - IN UCHAR PID, - IN UCHAR TID, - IN UCHAR TxRate, - IN UCHAR Txopmode, - IN BOOLEAN CfAck, - IN HTTRANSMIT_SETTING *pTransmit); - - -VOID RTMPWriteTxWI_Data( - IN PRTMP_ADAPTER pAd, - IN OUT PTXWI_STRUC pTxWI, - IN TX_BLK *pTxBlk); - - -VOID RTMPWriteTxWI_Cache( - IN PRTMP_ADAPTER pAd, - IN OUT PTXWI_STRUC pTxWI, - IN TX_BLK *pTxBlk); - -VOID RTMPSuspendMsduTransmission( - IN PRTMP_ADAPTER pAd); - -VOID RTMPResumeMsduTransmission( - IN PRTMP_ADAPTER pAd); - -NDIS_STATUS MiniportMMRequest( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PUCHAR pData, - IN UINT Length); - -//+++mark by shiang, now this function merge to MiniportMMRequest() -//---mark by shiang, now this function merge to MiniportMMRequest() - -VOID RTMPSendNullFrame( - IN PRTMP_ADAPTER pAd, - IN UCHAR TxRate, - IN BOOLEAN bQosNull); - -VOID RTMPSendDisassociationFrame( - IN PRTMP_ADAPTER pAd); - -VOID RTMPSendRTSFrame( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN unsigned int NextMpduSize, - IN UCHAR TxRate, - IN UCHAR RTSRate, - IN USHORT AckDuration, - IN UCHAR QueIdx, - IN UCHAR FrameGap); - - -NDIS_STATUS RTMPApplyPacketFilter( - IN PRTMP_ADAPTER pAd, - IN PRT28XX_RXD_STRUC pRxD, - IN PHEADER_802_11 pHeader); - -PQUEUE_HEADER RTMPCheckTxSwQueue( - IN PRTMP_ADAPTER pAd, - OUT UCHAR *QueIdx); - -#ifdef CONFIG_STA_SUPPORT -VOID RTMPReportMicError( - IN PRTMP_ADAPTER pAd, - IN PCIPHER_KEY pWpaKey); - -VOID WpaMicFailureReportFrame( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID WpaDisassocApAndBlockAssoc( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID WpaStaPairwiseKeySetting( - IN PRTMP_ADAPTER pAd); - -VOID WpaStaGroupKeySetting( - IN PRTMP_ADAPTER pAd); - -#endif // CONFIG_STA_SUPPORT // - -NDIS_STATUS RTMPCloneNdisPacket( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN pInsAMSDUHdr, - IN PNDIS_PACKET pInPacket, - OUT PNDIS_PACKET *ppOutPacket); - -NDIS_STATUS RTMPAllocateNdisPacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET *pPacket, - IN PUCHAR pHeader, - IN UINT HeaderLen, - IN PUCHAR pData, - IN UINT DataLen); - -VOID RTMPFreeNdisPacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket); - -BOOLEAN RTMPFreeTXDUponTxDmaDone( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx); - -BOOLEAN RTMPCheckDHCPFrame( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket); - - -BOOLEAN RTMPCheckEtherType( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket); - - -VOID RTMPCckBbpTuning( - IN PRTMP_ADAPTER pAd, - IN UINT TxRate); - -// -// Private routines in rtmp_wep.c -// -VOID RTMPInitWepEngine( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKey, - IN UCHAR KeyId, - IN UCHAR KeyLen, - IN PUCHAR pDest); - -VOID RTMPEncryptData( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pSrc, - IN PUCHAR pDest, - IN UINT Len); - -BOOLEAN RTMPDecryptData( - IN PRTMP_ADAPTER pAdapter, - IN PUCHAR pSrc, - IN UINT Len, - IN UINT idx); - -BOOLEAN RTMPSoftDecryptWEP( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, - IN PCIPHER_KEY pGroupKey); - -VOID RTMPSetICV( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDest); - -VOID ARCFOUR_INIT( - IN PARCFOURCONTEXT Ctx, - IN PUCHAR pKey, - IN UINT KeyLen); - -UCHAR ARCFOUR_BYTE( - IN PARCFOURCONTEXT Ctx); - -VOID ARCFOUR_DECRYPT( - IN PARCFOURCONTEXT Ctx, - IN PUCHAR pDest, - IN PUCHAR pSrc, - IN UINT Len); - -VOID ARCFOUR_ENCRYPT( - IN PARCFOURCONTEXT Ctx, - IN PUCHAR pDest, - IN PUCHAR pSrc, - IN UINT Len); - -VOID WPAARCFOUR_ENCRYPT( - IN PARCFOURCONTEXT Ctx, - IN PUCHAR pDest, - IN PUCHAR pSrc, - IN UINT Len); - -UINT RTMP_CALC_FCS32( - IN UINT Fcs, - IN PUCHAR Cp, - IN INT Len); - -// -// MLME routines -// - -// Asic/RF/BBP related functions - -VOID AsicAdjustTxPower( - IN PRTMP_ADAPTER pAd); - -VOID AsicUpdateProtect( - IN PRTMP_ADAPTER pAd, - IN USHORT OperaionMode, - IN UCHAR SetMask, - IN BOOLEAN bDisableBGProtect, - IN BOOLEAN bNonGFExist); - -VOID AsicSwitchChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel, - IN BOOLEAN bScan); - -VOID AsicLockChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel) ; - -VOID AsicAntennaSelect( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel); - -VOID AsicAntennaSetting( - IN PRTMP_ADAPTER pAd, - IN ABGBAND_STATE BandState); - -VOID AsicRfTuningExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -#ifdef CONFIG_STA_SUPPORT - -VOID AsicResetBBPAgent( - IN PRTMP_ADAPTER pAd); - -VOID AsicSleepThenAutoWakeup( - IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp); - -VOID AsicForceSleep( - IN PRTMP_ADAPTER pAd); - -VOID AsicForceWakeup( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bFromTx); -#endif // CONFIG_STA_SUPPORT // - -VOID AsicSetBssid( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pBssid); - -VOID AsicSetMcastWC( - IN PRTMP_ADAPTER pAd); - - -VOID AsicDelWcidTab( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid); - -VOID AsicEnableRDG( - IN PRTMP_ADAPTER pAd); - -VOID AsicDisableRDG( - IN PRTMP_ADAPTER pAd); - -VOID AsicDisableSync( - IN PRTMP_ADAPTER pAd); - -VOID AsicEnableBssSync( - IN PRTMP_ADAPTER pAd); - -VOID AsicEnableIbssSync( - IN PRTMP_ADAPTER pAd); - -VOID AsicSetEdcaParm( - IN PRTMP_ADAPTER pAd, - IN PEDCA_PARM pEdcaParm); - -VOID AsicSetSlotTime( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bUseShortSlotTime); - - -VOID AsicAddSharedKeyEntry( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssIndex, - IN UCHAR KeyIdx, - IN UCHAR CipherAlg, - IN PUCHAR pKey, - IN PUCHAR pTxMic, - IN PUCHAR pRxMic); - -VOID AsicRemoveSharedKeyEntry( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssIndex, - IN UCHAR KeyIdx); - -VOID AsicUpdateWCIDAttribute( - IN PRTMP_ADAPTER pAd, - IN USHORT WCID, - IN UCHAR BssIndex, - IN UCHAR CipherAlg, - IN BOOLEAN bUsePairewiseKeyTable); - -VOID AsicUpdateWCIDIVEIV( - IN PRTMP_ADAPTER pAd, - IN USHORT WCID, - IN ULONG uIV, - IN ULONG uEIV); - -VOID AsicUpdateRxWCIDTable( - IN PRTMP_ADAPTER pAd, - IN USHORT WCID, - IN PUCHAR pAddr); - -VOID AsicAddKeyEntry( - IN PRTMP_ADAPTER pAd, - IN USHORT WCID, - IN UCHAR BssIndex, - IN UCHAR KeyIdx, - IN PCIPHER_KEY pCipherKey, - IN BOOLEAN bUsePairewiseKeyTable, - IN BOOLEAN bTxKey); - -VOID AsicAddPairwiseKeyEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR WCID, - IN CIPHER_KEY *pCipherKey); - -VOID AsicRemovePairwiseKeyEntry( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssIdx, - IN UCHAR Wcid); - -BOOLEAN AsicSendCommandToMcu( - IN PRTMP_ADAPTER pAd, - IN UCHAR Command, - IN UCHAR Token, - IN UCHAR Arg0, - IN UCHAR Arg1); - - -#ifdef RTMP_MAC_PCI -BOOLEAN AsicCheckCommanOk( - IN PRTMP_ADAPTER pAd, - IN UCHAR Command); -#endif // RTMP_MAC_PCI // - -VOID MacAddrRandomBssid( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pAddr); - -VOID MgtMacHeaderInit( - IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, - IN UCHAR SubType, - IN UCHAR ToDs, - IN PUCHAR pDA, - IN PUCHAR pBssid); - -VOID MlmeRadioOff( - IN PRTMP_ADAPTER pAd); - -VOID MlmeRadioOn( - IN PRTMP_ADAPTER pAd); - - -VOID BssTableInit( - IN BSS_TABLE *Tab); - -#ifdef DOT11_N_SUPPORT -VOID BATableInit( - IN PRTMP_ADAPTER pAd, - IN BA_TABLE *Tab); -#endif // DOT11_N_SUPPORT // - -ULONG BssTableSearch( - IN BSS_TABLE *Tab, - IN PUCHAR pBssid, - IN UCHAR Channel); - -ULONG BssSsidTableSearch( - IN BSS_TABLE *Tab, - IN PUCHAR pBssid, - IN PUCHAR pSsid, - IN UCHAR SsidLen, - IN UCHAR Channel); - -ULONG BssTableSearchWithSSID( - IN BSS_TABLE *Tab, - IN PUCHAR Bssid, - IN PUCHAR pSsid, - IN UCHAR SsidLen, - IN UCHAR Channel); - -ULONG BssSsidTableSearchBySSID( - IN BSS_TABLE *Tab, - IN PUCHAR pSsid, - IN UCHAR SsidLen); - -VOID BssTableDeleteEntry( - IN OUT PBSS_TABLE pTab, - IN PUCHAR pBssid, - IN UCHAR Channel); - -#ifdef DOT11_N_SUPPORT -VOID BATableDeleteORIEntry( - IN OUT PRTMP_ADAPTER pAd, - IN BA_ORI_ENTRY *pBAORIEntry); - -VOID BATableDeleteRECEntry( - IN OUT PRTMP_ADAPTER pAd, - IN BA_REC_ENTRY *pBARECEntry); - -VOID BATableTearORIEntry( - IN OUT PRTMP_ADAPTER pAd, - IN UCHAR TID, - IN UCHAR Wcid, - IN BOOLEAN bForceDelete, - IN BOOLEAN ALL); - -VOID BATableTearRECEntry( - IN OUT PRTMP_ADAPTER pAd, - IN UCHAR TID, - IN UCHAR WCID, - IN BOOLEAN ALL); -#endif // DOT11_N_SUPPORT // - -VOID BssEntrySet( - IN PRTMP_ADAPTER pAd, - OUT PBSS_ENTRY pBss, - IN PUCHAR pBssid, - IN CHAR Ssid[], - IN UCHAR SsidLen, - IN UCHAR BssType, - IN USHORT BeaconPeriod, - IN PCF_PARM CfParm, - IN USHORT AtimWin, - IN USHORT CapabilityInfo, - IN UCHAR SupRate[], - IN UCHAR SupRateLen, - IN UCHAR ExtRate[], - IN UCHAR ExtRateLen, - IN HT_CAPABILITY_IE *pHtCapability, - IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE - IN UCHAR HtCapabilityLen, - IN UCHAR AddHtInfoLen, - IN UCHAR NewExtChanOffset, - IN UCHAR Channel, - IN CHAR Rssi, - IN LARGE_INTEGER TimeStamp, - IN UCHAR CkipFlag, - IN PEDCA_PARM pEdcaParm, - IN PQOS_CAPABILITY_PARM pQosCapability, - IN PQBSS_LOAD_PARM pQbssLoad, - IN USHORT LengthVIE, - IN PNDIS_802_11_VARIABLE_IEs pVIE); - -ULONG BssTableSetEntry( - IN PRTMP_ADAPTER pAd, - OUT PBSS_TABLE pTab, - IN PUCHAR pBssid, - IN CHAR Ssid[], - IN UCHAR SsidLen, - IN UCHAR BssType, - IN USHORT BeaconPeriod, - IN CF_PARM *CfParm, - IN USHORT AtimWin, - IN USHORT CapabilityInfo, - IN UCHAR SupRate[], - IN UCHAR SupRateLen, - IN UCHAR ExtRate[], - IN UCHAR ExtRateLen, - IN HT_CAPABILITY_IE *pHtCapability, - IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE - IN UCHAR HtCapabilityLen, - IN UCHAR AddHtInfoLen, - IN UCHAR NewExtChanOffset, - IN UCHAR Channel, - IN CHAR Rssi, - IN LARGE_INTEGER TimeStamp, - IN UCHAR CkipFlag, - IN PEDCA_PARM pEdcaParm, - IN PQOS_CAPABILITY_PARM pQosCapability, - IN PQBSS_LOAD_PARM pQbssLoad, - IN USHORT LengthVIE, - IN PNDIS_802_11_VARIABLE_IEs pVIE); - -#ifdef DOT11_N_SUPPORT -VOID BATableInsertEntry( - IN PRTMP_ADAPTER pAd, - IN USHORT Aid, - IN USHORT TimeOutValue, - IN USHORT StartingSeq, - IN UCHAR TID, - IN UCHAR BAWinSize, - IN UCHAR OriginatorStatus, - IN BOOLEAN IsRecipient); - -#ifdef DOT11N_DRAFT3 -VOID Bss2040CoexistTimeOut( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - - -VOID TriEventInit( - IN PRTMP_ADAPTER pAd); - -ULONG TriEventTableSetEntry( - IN PRTMP_ADAPTER pAd, - OUT TRIGGER_EVENT_TAB *Tab, - IN PUCHAR pBssid, - IN HT_CAPABILITY_IE *pHtCapability, - IN UCHAR HtCapabilityLen, - IN UCHAR RegClass, - IN UCHAR ChannelNo); - -VOID TriEventCounterMaintenance( - IN PRTMP_ADAPTER pAd); -#endif // DOT11N_DRAFT3 // -#endif // DOT11_N_SUPPORT // - -VOID BssTableSsidSort( - IN PRTMP_ADAPTER pAd, - OUT BSS_TABLE *OutTab, - IN CHAR Ssid[], - IN UCHAR SsidLen); - -VOID BssTableSortByRssi( - IN OUT BSS_TABLE *OutTab); - -VOID BssCipherParse( - IN OUT PBSS_ENTRY pBss); - -NDIS_STATUS MlmeQueueInit( - IN MLME_QUEUE *Queue); - -VOID MlmeQueueDestroy( - IN MLME_QUEUE *Queue); - -BOOLEAN MlmeEnqueue( - IN PRTMP_ADAPTER pAd, - IN ULONG Machine, - IN ULONG MsgType, - IN ULONG MsgLen, - IN VOID *Msg); - -BOOLEAN MlmeEnqueueForRecv( - IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN ULONG TimeStampHigh, - IN ULONG TimeStampLow, - IN UCHAR Rssi0, - IN UCHAR Rssi1, - IN UCHAR Rssi2, - IN ULONG MsgLen, - IN PVOID Msg, - IN UCHAR Signal); - - -BOOLEAN MlmeDequeue( - IN MLME_QUEUE *Queue, - OUT MLME_QUEUE_ELEM **Elem); - -VOID MlmeRestartStateMachine( - IN PRTMP_ADAPTER pAd); - -BOOLEAN MlmeQueueEmpty( - IN MLME_QUEUE *Queue); - -BOOLEAN MlmeQueueFull( - IN MLME_QUEUE *Queue); - -BOOLEAN MsgTypeSubst( - IN PRTMP_ADAPTER pAd, - IN PFRAME_802_11 pFrame, - OUT INT *Machine, - OUT INT *MsgType); - -VOID StateMachineInit( - IN STATE_MACHINE *Sm, - IN STATE_MACHINE_FUNC Trans[], - IN ULONG StNr, - IN ULONG MsgNr, - IN STATE_MACHINE_FUNC DefFunc, - IN ULONG InitState, - IN ULONG Base); - -VOID StateMachineSetAction( - IN STATE_MACHINE *S, - IN ULONG St, - ULONG Msg, - IN STATE_MACHINE_FUNC F); - -VOID StateMachinePerformAction( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - IN MLME_QUEUE_ELEM *Elem); - -VOID Drop( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID AssocStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *Sm, - OUT STATE_MACHINE_FUNC Trans[]); - -VOID ReassocTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID AssocTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID DisassocTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -//---------------------------------------------- -VOID MlmeDisassocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MlmeAssocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MlmeReassocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MlmeDisassocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerAssocRspAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerReassocRspAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerDisassocAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID DisassocTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID AssocTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID ReassocTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID Cls3errAction( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr); - -VOID InvalidStateWhenAssoc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID InvalidStateWhenReassoc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID InvalidStateWhenDisassociate( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - - -VOID ComposePsPoll( - IN PRTMP_ADAPTER pAd); - -VOID ComposeNullFrame( - IN PRTMP_ADAPTER pAd); - -VOID AssocPostProc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr2, - IN USHORT CapabilityInfo, - IN USHORT Aid, - IN UCHAR SupRate[], - IN UCHAR SupRateLen, - IN UCHAR ExtRate[], - IN UCHAR ExtRateLen, - IN PEDCA_PARM pEdcaParm, - IN HT_CAPABILITY_IE *pHtCapability, - IN UCHAR HtCapabilityLen, - IN ADD_HT_INFO_IE *pAddHtInfo); - -VOID AuthStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN PSTATE_MACHINE sm, - OUT STATE_MACHINE_FUNC Trans[]); - -VOID AuthTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID MlmeAuthReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerAuthRspAtSeq2Action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerAuthRspAtSeq4Action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID AuthTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID Cls2errAction( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr); - -VOID MlmeDeauthReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID InvalidStateWhenAuth( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -//============================================= - -VOID AuthRspStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN PSTATE_MACHINE Sm, - IN STATE_MACHINE_FUNC Trans[]); - -VOID PeerDeauthAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerAuthSimpleRspGenAndSend( - IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHdr80211, - IN USHORT Alg, - IN USHORT Seq, - IN USHORT Reason, - IN USHORT Status); - -// -// Private routines in dls.c -// - -#ifdef CONFIG_STA_SUPPORT -#ifdef QOS_DLS_SUPPORT -void DlsStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *Sm, - OUT STATE_MACHINE_FUNC Trans[]); - -VOID MlmeDlsReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerDlsReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerDlsRspAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MlmeDlsTearDownAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerDlsTearDownAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID RTMPCheckDLSTimeOut( - IN PRTMP_ADAPTER pAd); - -BOOLEAN RTMPRcvFrameDLSCheck( - IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHeader, - IN ULONG Len, - IN PRT28XX_RXD_STRUC pRxD); - -INT RTMPCheckDLSFrame( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA); - -VOID RTMPSendDLSTearDownFrame( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA); - -NDIS_STATUS RTMPSendSTAKeyRequest( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA); - -NDIS_STATUS RTMPSendSTAKeyHandShake( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA); - -VOID DlsTimeoutAction( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -BOOLEAN MlmeDlsReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PRT_802_11_DLS *pDLS, - OUT PUSHORT pReason); - -INT Set_DlsEntryInfo_Display_Proc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); - -MAC_TABLE_ENTRY *MacTableInsertDlsEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UINT DlsEntryIdx); - -BOOLEAN MacTableDeleteDlsEntry( - IN PRTMP_ADAPTER pAd, - IN USHORT wcid, - IN PUCHAR pAddr); - -MAC_TABLE_ENTRY *DlsEntryTableLookup( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN BOOLEAN bResetIdelCount); - -MAC_TABLE_ENTRY *DlsEntryTableLookupByWcid( - IN PRTMP_ADAPTER pAd, - IN UCHAR wcid, - IN PUCHAR pAddr, - IN BOOLEAN bResetIdelCount); - -INT Set_DlsAddEntry_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_DlsTearDownEntry_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); -#endif // QOS_DLS_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - -#ifdef QOS_DLS_SUPPORT -BOOLEAN PeerDlsReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pDA, - OUT PUCHAR pSA, - OUT USHORT *pCapabilityInfo, - OUT USHORT *pDlsTimeout, - OUT UCHAR *pRatesLen, - OUT UCHAR Rates[], - OUT UCHAR *pHtCapabilityLen, - OUT HT_CAPABILITY_IE *pHtCapability); - -BOOLEAN PeerDlsRspSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pDA, - OUT PUCHAR pSA, - OUT USHORT *pCapabilityInfo, - OUT USHORT *pStatus, - OUT UCHAR *pRatesLen, - OUT UCHAR Rates[], - OUT UCHAR *pHtCapabilityLen, - OUT HT_CAPABILITY_IE *pHtCapability); - -BOOLEAN PeerDlsTearDownSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pDA, - OUT PUCHAR pSA, - OUT USHORT *pReason); -#endif // QOS_DLS_SUPPORT // - -//======================================== - -VOID SyncStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *Sm, - OUT STATE_MACHINE_FUNC Trans[]); - -VOID BeaconTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID ScanTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID MlmeScanReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID InvalidStateWhenScan( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID InvalidStateWhenJoin( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID InvalidStateWhenStart( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerBeacon( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID EnqueueProbeRequest( - IN PRTMP_ADAPTER pAd); - -BOOLEAN ScanRunning( - IN PRTMP_ADAPTER pAd); -//========================================= - -VOID MlmeCntlInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - OUT STATE_MACHINE_FUNC Trans[]); - -VOID MlmeCntlMachinePerformAction( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - IN MLME_QUEUE_ELEM *Elem); - -VOID CntlIdleProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID CntlOidScanProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID CntlOidSsidProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM * Elem); - -VOID CntlOidRTBssidProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM * Elem); - -VOID CntlMlmeRoamingProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM * Elem); - -VOID CntlWaitDisassocProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID CntlWaitJoinProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID CntlWaitReassocProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID CntlWaitStartProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID CntlWaitAuthProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID CntlWaitAuthProc2( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID CntlWaitAssocProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -#ifdef QOS_DLS_SUPPORT -VOID CntlOidDLSSetupProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); -#endif // QOS_DLS_SUPPORT // - -VOID LinkUp( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssType); - -VOID LinkDown( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN IsReqFromAP); - -VOID IterateOnBssTab( - IN PRTMP_ADAPTER pAd); - -VOID IterateOnBssTab2( - IN PRTMP_ADAPTER pAd);; - -VOID JoinParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_JOIN_REQ_STRUCT *JoinReq, - IN ULONG BssIdx); - -VOID AssocParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_ASSOC_REQ_STRUCT *AssocReq, - IN PUCHAR pAddr, - IN USHORT CapabilityInfo, - IN ULONG Timeout, - IN USHORT ListenIntv); - -VOID ScanParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_SCAN_REQ_STRUCT *ScanReq, - IN STRING Ssid[], - IN UCHAR SsidLen, - IN UCHAR BssType, - IN UCHAR ScanType); - -VOID DisassocParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_DISASSOC_REQ_STRUCT *DisassocReq, - IN PUCHAR pAddr, - IN USHORT Reason); - -VOID StartParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_START_REQ_STRUCT *StartReq, - IN CHAR Ssid[], - IN UCHAR SsidLen); - -VOID AuthParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_AUTH_REQ_STRUCT *AuthReq, - IN PUCHAR pAddr, - IN USHORT Alg); - -VOID EnqueuePsPoll( - IN PRTMP_ADAPTER pAd); - -VOID EnqueueBeaconFrame( - IN PRTMP_ADAPTER pAd); - -VOID MlmeJoinReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MlmeScanReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MlmeStartReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID ScanTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID BeaconTimeoutAtJoinAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerBeaconAtScanAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerBeaconAtJoinAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerBeacon( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerProbeReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID ScanNextChannel( - IN PRTMP_ADAPTER pAd); - -ULONG MakeIbssBeacon( - IN PRTMP_ADAPTER pAd); - -VOID CCXAdjacentAPReport( - IN PRTMP_ADAPTER pAd); - -BOOLEAN MlmeScanReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT UCHAR *BssType, - OUT CHAR ssid[], - OUT UCHAR *SsidLen, - OUT UCHAR *ScanType); - -BOOLEAN PeerBeaconAndProbeRspSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - IN UCHAR MsgChannel, - OUT PUCHAR pAddr2, - OUT PUCHAR pBssid, - OUT CHAR Ssid[], - OUT UCHAR *pSsidLen, - OUT UCHAR *pBssType, - OUT USHORT *pBeaconPeriod, - OUT UCHAR *pChannel, - OUT UCHAR *pNewChannel, - OUT LARGE_INTEGER *pTimestamp, - OUT CF_PARM *pCfParm, - OUT USHORT *pAtimWin, - OUT USHORT *pCapabilityInfo, - OUT UCHAR *pErp, - OUT UCHAR *pDtimCount, - OUT UCHAR *pDtimPeriod, - OUT UCHAR *pBcastFlag, - OUT UCHAR *pMessageToMe, - OUT UCHAR SupRate[], - OUT UCHAR *pSupRateLen, - OUT UCHAR ExtRate[], - OUT UCHAR *pExtRateLen, - OUT UCHAR *pCkipFlag, - OUT UCHAR *pAironetCellPowerLimit, - OUT PEDCA_PARM pEdcaParm, - OUT PQBSS_LOAD_PARM pQbssLoad, - OUT PQOS_CAPABILITY_PARM pQosCapability, - OUT ULONG *pRalinkIe, - OUT UCHAR *pHtCapabilityLen, -#ifdef CONFIG_STA_SUPPORT - OUT UCHAR *pPreNHtCapabilityLen, -#endif // CONFIG_STA_SUPPORT // - OUT HT_CAPABILITY_IE *pHtCapability, - OUT UCHAR *AddHtInfoLen, - OUT ADD_HT_INFO_IE *AddHtInfo, - OUT UCHAR *NewExtChannel, - OUT USHORT *LengthVIE, - OUT PNDIS_802_11_VARIABLE_IEs pVIE); - -BOOLEAN PeerAddBAReqActionSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2); - -BOOLEAN PeerAddBARspActionSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen); - -BOOLEAN PeerDelBAActionSanity( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN VOID *pMsg, - IN ULONG MsgLen); - -BOOLEAN MlmeAssocReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pApAddr, - OUT USHORT *CapabilityInfo, - OUT ULONG *Timeout, - OUT USHORT *ListenIntv); - -BOOLEAN MlmeAuthReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr, - OUT ULONG *Timeout, - OUT USHORT *Alg); - -BOOLEAN MlmeStartReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT CHAR Ssid[], - OUT UCHAR *Ssidlen); - -BOOLEAN PeerAuthSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr, - OUT USHORT *Alg, - OUT USHORT *Seq, - OUT USHORT *Status, - OUT CHAR ChlgText[]); - -BOOLEAN PeerAssocRspSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *pCapabilityInfo, - OUT USHORT *pStatus, - OUT USHORT *pAid, - OUT UCHAR SupRate[], - OUT UCHAR *pSupRateLen, - OUT UCHAR ExtRate[], - OUT UCHAR *pExtRateLen, - OUT HT_CAPABILITY_IE *pHtCapability, - OUT ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE - OUT UCHAR *pHtCapabilityLen, - OUT UCHAR *pAddHtInfoLen, - OUT UCHAR *pNewExtChannelOffset, - OUT PEDCA_PARM pEdcaParm, - OUT UCHAR *pCkipFlag); - -BOOLEAN PeerDisassocSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *Reason); - -BOOLEAN PeerWpaMessageSanity( - IN PRTMP_ADAPTER pAd, - IN PEAPOL_PACKET pMsg, - IN ULONG MsgLen, - IN UCHAR MsgType, - IN MAC_TABLE_ENTRY *pEntry); - -BOOLEAN PeerDeauthSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *Reason); - -BOOLEAN PeerProbeReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT CHAR Ssid[], - OUT UCHAR *pSsidLen); - -BOOLEAN GetTimBit( - IN CHAR *Ptr, - IN USHORT Aid, - OUT UCHAR *TimLen, - OUT UCHAR *BcastFlag, - OUT UCHAR *DtimCount, - OUT UCHAR *DtimPeriod, - OUT UCHAR *MessageToMe); - -UCHAR ChannelSanity( - IN PRTMP_ADAPTER pAd, - IN UCHAR channel); - -NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity( - IN PBSS_ENTRY pBss); - - -BOOLEAN MlmeDelBAReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen); - -BOOLEAN MlmeAddBAReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2); - -ULONG MakeOutgoingFrame( - OUT UCHAR *Buffer, - OUT ULONG *Length, ...); - -VOID LfsrInit( - IN PRTMP_ADAPTER pAd, - IN ULONG Seed); - -UCHAR RandomByte( - IN PRTMP_ADAPTER pAd); - -VOID AsicUpdateAutoFallBackTable( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pTxRate); - -VOID MlmePeriodicExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID LinkDownExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID LinkUpExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID STAMlmePeriodicExec( - PRTMP_ADAPTER pAd); - -VOID MlmeAutoScan( - IN PRTMP_ADAPTER pAd); - -VOID MlmeAutoReconnectLastSSID( - IN PRTMP_ADAPTER pAd); - -BOOLEAN MlmeValidateSSID( - IN PUCHAR pSsid, - IN UCHAR SsidLen); - -VOID MlmeCheckForRoaming( - IN PRTMP_ADAPTER pAd, - IN ULONG Now32); - -BOOLEAN MlmeCheckForFastRoaming( - IN PRTMP_ADAPTER pAd); - -VOID MlmeDynamicTxRateSwitching( - IN PRTMP_ADAPTER pAd); - -VOID MlmeSetTxRate( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PRTMP_TX_RATE_SWITCH pTxRate); - -VOID MlmeSelectTxRateTable( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR *ppTable, - IN PUCHAR pTableSize, - IN PUCHAR pInitTxRateIdx); - -VOID MlmeCalculateChannelQuality( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pMacEntry, - IN ULONG Now); - -VOID MlmeCheckPsmChange( - IN PRTMP_ADAPTER pAd, - IN ULONG Now32); - -VOID MlmeSetPsmBit( - IN PRTMP_ADAPTER pAd, - IN USHORT psm); - -VOID MlmeSetTxPreamble( - IN PRTMP_ADAPTER pAd, - IN USHORT TxPreamble); - -VOID UpdateBasicRateBitmap( - IN PRTMP_ADAPTER pAd); - -VOID MlmeUpdateTxRates( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bLinkUp, - IN UCHAR apidx); - -#ifdef DOT11_N_SUPPORT -VOID MlmeUpdateHtTxRates( - IN PRTMP_ADAPTER pAd, - IN UCHAR apidx); -#endif // DOT11_N_SUPPORT // - -VOID RTMPCheckRates( - IN PRTMP_ADAPTER pAd, - IN OUT UCHAR SupRate[], - IN OUT UCHAR *SupRateLen); - -#ifdef CONFIG_STA_SUPPORT -BOOLEAN RTMPCheckChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR CentralChannel, - IN UCHAR Channel); -#endif // CONFIG_STA_SUPPORT // - -BOOLEAN RTMPCheckHt( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN OUT HT_CAPABILITY_IE *pHtCapability, - IN OUT ADD_HT_INFO_IE *pAddHtInfo); - -VOID StaQuickResponeForRateUpExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID AsicBbpTuning1( - IN PRTMP_ADAPTER pAd); - -VOID AsicBbpTuning2( - IN PRTMP_ADAPTER pAd); - -VOID RTMPUpdateMlmeRate( - IN PRTMP_ADAPTER pAd); - -CHAR RTMPMaxRssi( - IN PRTMP_ADAPTER pAd, - IN CHAR Rssi0, - IN CHAR Rssi1, - IN CHAR Rssi2); - -#ifdef RT30xx -VOID AsicSetRxAnt( - IN PRTMP_ADAPTER pAd, - IN UCHAR Ant); - -VOID RTMPFilterCalibration( - IN PRTMP_ADAPTER pAd); - -#ifdef RTMP_EFUSE_SUPPORT -//2008/09/11:KH add to support efuse<-- -INT set_eFuseGetFreeBlockCount_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT set_eFusedump_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT set_eFuseLoadFromBin_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -VOID eFusePhysicalReadRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - OUT USHORT* pData); - -int RtmpEfuseSupportCheck( - IN RTMP_ADAPTER *pAd); - -INT set_eFuseBufferModeWriteBack_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT eFuseLoadEEPROM( - IN PRTMP_ADAPTER pAd); - -INT eFuseWriteEeeppromBuf( - IN PRTMP_ADAPTER pAd); - -VOID eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, - PUINT EfuseFreeBlock); - -INT eFuse_init( - IN PRTMP_ADAPTER pAd); - -NTSTATUS eFuseRead( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - OUT PUCHAR pData, - IN USHORT Length); - -NTSTATUS eFuseWrite( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN PUCHAR pData, - IN USHORT length); -//2008/09/11:KH add to support efuse--> -#endif // RTMP_EFUSE_SUPPORT // - -// add by johnli, RF power sequence setup -VOID RT30xxLoadRFNormalModeSetup( - IN PRTMP_ADAPTER pAd); - -VOID RT30xxLoadRFSleepModeSetup( - IN PRTMP_ADAPTER pAd); - -VOID RT30xxReverseRFSleepModeSetup( - IN PRTMP_ADAPTER pAd); -// end johnli - - -#ifdef RT3090 -VOID NICInitRT3090RFRegisters( - IN RTMP_ADAPTER *pAd); -#endif // RT3090 // - -VOID RT30xxHaltAction( - IN PRTMP_ADAPTER pAd); - -VOID RT30xxSetRxAnt( - IN PRTMP_ADAPTER pAd, - IN UCHAR Ant); -#endif // RT30xx // -#ifdef RT33xx -VOID RT33xxLoadRFNormalModeSetup( - IN PRTMP_ADAPTER pAd); - -VOID RT33xxLoadRFSleepModeSetup( - IN PRTMP_ADAPTER pAd); - -VOID RT33xxReverseRFSleepModeSetup( - IN PRTMP_ADAPTER pAd); - -#ifdef RT3370 -VOID NICInitRT3370RFRegisters( - IN RTMP_ADAPTER *pAd); -#endif // RT3070 // - -#ifdef RT3390 -VOID NICInitRT3390RFRegisters( - IN RTMP_ADAPTER *pAd); -#endif // RT3090 // - -VOID RT33xxHaltAction( - IN PRTMP_ADAPTER pAd); - -VOID RT33xxSetRxAnt( - IN PRTMP_ADAPTER pAd, - IN UCHAR Ant); - -#endif // RT33xx // - - - -VOID AsicEvaluateRxAnt( - IN PRTMP_ADAPTER pAd); - -VOID AsicRxAntEvalTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID APSDPeriodicExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -BOOLEAN RTMPCheckEntryEnableAutoRateSwitch( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry); - -UCHAR RTMPStaFixedTxMode( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry); - -VOID RTMPUpdateLegacyTxSetting( - UCHAR fixed_tx_mode, - PMAC_TABLE_ENTRY pEntry); - -BOOLEAN RTMPAutoRateSwitchCheck( - IN PRTMP_ADAPTER pAd); - -NDIS_STATUS MlmeInit( - IN PRTMP_ADAPTER pAd); - -VOID MlmeHandler( - IN PRTMP_ADAPTER pAd); - -VOID MlmeHalt( - IN PRTMP_ADAPTER pAd); - -VOID MlmeResetRalinkCounters( - IN PRTMP_ADAPTER pAd); - -VOID BuildChannelList( - IN PRTMP_ADAPTER pAd); - -UCHAR FirstChannel( - IN PRTMP_ADAPTER pAd); - -UCHAR NextChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR channel); - -VOID ChangeToCellPowerLimit( - IN PRTMP_ADAPTER pAd, - IN UCHAR AironetCellPowerLimit); - -// -// Prototypes of function definition in rtmp_tkip.c -// -VOID RTMPInitTkipEngine( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pTKey, - IN UCHAR KeyId, - IN PUCHAR pTA, - IN PUCHAR pMICKey, - IN PUCHAR pTSC, - OUT PULONG pIV16, - OUT PULONG pIV32); - -VOID RTMPInitMICEngine( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKey, - IN PUCHAR pDA, - IN PUCHAR pSA, - IN UCHAR UserPriority, - IN PUCHAR pMICKey); - -BOOLEAN RTMPTkipCompareMICValue( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pSrc, - IN PUCHAR pDA, - IN PUCHAR pSA, - IN PUCHAR pMICKey, - IN UCHAR UserPriority, - IN UINT Len); - -VOID RTMPCalculateMICValue( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN PUCHAR pEncap, - IN PCIPHER_KEY pKey, - IN UCHAR apidx); - -BOOLEAN RTMPTkipCompareMICValueWithLLC( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pLLC, - IN PUCHAR pSrc, - IN PUCHAR pDA, - IN PUCHAR pSA, - IN PUCHAR pMICKey, - IN UINT Len); - -VOID RTMPTkipAppendByte( - IN PTKIP_KEY_INFO pTkip, - IN UCHAR uChar); - -VOID RTMPTkipAppend( - IN PTKIP_KEY_INFO pTkip, - IN PUCHAR pSrc, - IN UINT nBytes); - -VOID RTMPTkipGetMIC( - IN PTKIP_KEY_INFO pTkip); - -BOOLEAN RTMPSoftDecryptTKIP( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, - IN UCHAR UserPriority, - IN PCIPHER_KEY pWpaKey); - -BOOLEAN RTMPSoftDecryptAES( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, - IN PCIPHER_KEY pWpaKey); - - - -// -// Prototypes of function definition in cmm_info.c -// -INT RT_CfgSetCountryRegion( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg, - IN INT band); - -INT RT_CfgSetWirelessMode( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT RT_CfgSetShortSlot( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT RT_CfgSetWepKey( - IN PRTMP_ADAPTER pAd, - IN PSTRING keyString, - IN CIPHER_KEY *pSharedKey, - IN INT keyIdx); - -INT RT_CfgSetWPAPSKKey( - IN RTMP_ADAPTER *pAd, - IN PSTRING keyString, - IN UCHAR *pHashStr, - IN INT hashStrLen, - OUT PUCHAR pPMKBuf); - - - -// -// Prototypes of function definition in cmm_info.c -// -NDIS_STATUS RTMPWPARemoveKeyProc( - IN PRTMP_ADAPTER pAd, - IN PVOID pBuf); - -VOID RTMPWPARemoveAllKeys( - IN PRTMP_ADAPTER pAd); - -BOOLEAN RTMPCheckStrPrintAble( - IN CHAR *pInPutStr, - IN UCHAR strLen); - -VOID RTMPSetPhyMode( - IN PRTMP_ADAPTER pAd, - IN ULONG phymode); - -VOID RTMPUpdateHTIE( - IN RT_HT_CAPABILITY *pRtHt, - IN UCHAR *pMcsSet, - OUT HT_CAPABILITY_IE *pHtCapability, - OUT ADD_HT_INFO_IE *pAddHtInfo); - -VOID RTMPAddWcidAttributeEntry( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssIdx, - IN UCHAR KeyIdx, - IN UCHAR CipherAlg, - IN MAC_TABLE_ENTRY *pEntry); - -PSTRING GetEncryptType( - CHAR enc); - -PSTRING GetAuthMode( - CHAR auth); - - -VOID RTMPIndicateWPA2Status( - IN PRTMP_ADAPTER pAdapter); - -VOID RTMPOPModeSwitching( - IN PRTMP_ADAPTER pAd); - - -#ifdef DOT11_N_SUPPORT -VOID RTMPSetHT( - IN PRTMP_ADAPTER pAd, - IN OID_SET_HT_PHYMODE *pHTPhyMode); - -VOID RTMPSetIndividualHT( - IN PRTMP_ADAPTER pAd, - IN UCHAR apidx); -#endif // DOT11_N_SUPPORT // - -VOID RTMPSendWirelessEvent( - IN PRTMP_ADAPTER pAd, - IN USHORT Event_flag, - IN PUCHAR pAddr, - IN UCHAR BssIdx, - IN CHAR Rssi); - -VOID NICUpdateCntlCounters( - IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHeader, - IN UCHAR SubType, - IN PRXWI_STRUC pRxWI); - -VOID DBGPRINT_TX_RING( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx); - -VOID DBGPRINT_RX_RING( - IN PRTMP_ADAPTER pAd); - -CHAR ConvertToRssi( - IN PRTMP_ADAPTER pAd, - IN CHAR Rssi, - IN UCHAR RssiNumber); - - -#ifdef DOT11N_DRAFT3 -VOID BuildEffectedChannelList( - IN PRTMP_ADAPTER pAd); -#endif // DOT11N_DRAFT3 // - - -VOID APAsicEvaluateRxAnt( - IN PRTMP_ADAPTER pAd); - -#ifdef ANT_DIVERSITY_SUPPORT -VOID APAsicAntennaAvg( - IN PRTMP_ADAPTER pAd, - IN UCHAR AntSelect, - IN SHORT *RssiAvg); -#endif // ANT_DIVERSITY_SUPPORT // - -VOID APAsicRxAntEvalTimeout( - IN PRTMP_ADAPTER pAd); - -/*=================================== - Function prototype in cmm_wpa.c - =================================== */ -VOID RTMPToWirelessSta( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, - IN UINT DataLen, - IN BOOLEAN bClearFrame); - -VOID WpaDerivePTK( - IN PRTMP_ADAPTER pAd, - IN UCHAR *PMK, - IN UCHAR *ANonce, - IN UCHAR *AA, - IN UCHAR *SNonce, - IN UCHAR *SA, - OUT UCHAR *output, - IN UINT len); - -VOID GenRandom( - IN PRTMP_ADAPTER pAd, - IN UCHAR *macAddr, - OUT UCHAR *random); - -BOOLEAN RTMPCheckWPAframe( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR pData, - IN ULONG DataByteCount, - IN UCHAR FromWhichBSSID); - -VOID AES_GTK_KEY_UNWRAP( - IN UCHAR *key, - OUT UCHAR *plaintext, - IN UINT32 c_len, - IN UCHAR *ciphertext); - -BOOLEAN RTMPParseEapolKeyData( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKeyData, - IN UCHAR KeyDataLen, - IN UCHAR GroupKeyIndex, - IN UCHAR MsgType, - IN BOOLEAN bWPA2, - IN MAC_TABLE_ENTRY *pEntry); - -VOID ConstructEapolMsg( - IN PMAC_TABLE_ENTRY pEntry, - IN UCHAR GroupKeyWepStatus, - IN UCHAR MsgType, - IN UCHAR DefaultKeyIdx, - IN UCHAR *KeyNonce, - IN UCHAR *TxRSC, - IN UCHAR *GTK, - IN UCHAR *RSNIE, - IN UCHAR RSNIE_Len, - OUT PEAPOL_PACKET pMsg); - -NDIS_STATUS RTMPSoftDecryptBroadCastData( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN NDIS_802_11_ENCRYPTION_STATUS GroupCipher, - IN PCIPHER_KEY pShard_key); - -VOID RTMPMakeRSNIE( - IN PRTMP_ADAPTER pAd, - IN UINT AuthMode, - IN UINT WepStatus, - IN UCHAR apidx); - -// -// function prototype in ap_wpa.c -// -VOID RTMPGetTxTscFromAsic( - IN PRTMP_ADAPTER pAd, - IN UCHAR apidx, - OUT PUCHAR pTxTsc); - -VOID APInstallPairwiseKey( - PRTMP_ADAPTER pAd, - PMAC_TABLE_ENTRY pEntry); - -MAC_TABLE_ENTRY *PACInquiry( - IN PRTMP_ADAPTER pAd, - IN ULONG Wcid); - -UINT APValidateRSNIE( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR pRsnIe, - IN UCHAR rsnie_len); - -VOID HandleCounterMeasure( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry); - -VOID WPAStart4WayHS( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN ULONG TimeInterval); - -VOID WPAStart2WayGroupHS( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry); - -VOID PeerPairMsg1Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerPairMsg2Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerPairMsg3Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerPairMsg4Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerGroupMsg1Action( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerGroupMsg2Action( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN VOID *Msg, - IN UINT MsgLen); - -VOID CMTimerExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID WPARetryExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID EnqueueStartForPSKExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID RTMPHandleSTAKey( - IN PRTMP_ADAPTER pAdapter, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem); - -VOID PairDisAssocAction( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN USHORT Reason); - -VOID MlmeDeAuthAction( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN USHORT Reason); - -VOID GREKEYPeriodicExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID WpaDeriveGTK( - IN UCHAR *PMK, - IN UCHAR *GNonce, - IN UCHAR *AA, - OUT UCHAR *output, - IN UINT len); - -VOID AES_GTK_KEY_WRAP( - IN UCHAR *key, - IN UCHAR *plaintext, - IN UINT32 p_len, - OUT UCHAR *ciphertext); - -VOID AES_128_CMAC( - IN PUCHAR key, - IN PUCHAR input, - IN INT len, - OUT PUCHAR mac); - -VOID WpaSend( - IN PRTMP_ADAPTER pAdapter, - IN PUCHAR pPacket, - IN ULONG Len); - -VOID RTMPAddPMKIDCache( - IN PRTMP_ADAPTER pAd, - IN INT apidx, - IN PUCHAR pAddr, - IN UCHAR *PMKID, - IN UCHAR *PMK); - -INT RTMPSearchPMKIDCache( - IN PRTMP_ADAPTER pAd, - IN INT apidx, - IN PUCHAR pAddr); - -VOID RTMPDeletePMKIDCache( - IN PRTMP_ADAPTER pAd, - IN INT apidx, - IN INT idx); - -VOID RTMPMaintainPMKIDCache( - IN PRTMP_ADAPTER pAd); - -VOID RTMPSendTriggerFrame( - IN PRTMP_ADAPTER pAd, - IN PVOID pBuffer, - IN ULONG Length, - IN UCHAR TxRate, - IN BOOLEAN bQosNull); - -//typedef void (*TIMER_FUNCTION)(unsigned long); - - -/* timeout -- ms */ -VOID RTMP_SetPeriodicTimer( - IN NDIS_MINIPORT_TIMER *pTimer, - IN unsigned long timeout); - -VOID RTMP_OS_Init_Timer( - IN PRTMP_ADAPTER pAd, - IN NDIS_MINIPORT_TIMER *pTimer, - IN TIMER_FUNCTION function, - IN PVOID data); - -VOID RTMP_OS_Add_Timer( - IN NDIS_MINIPORT_TIMER *pTimer, - IN unsigned long timeout); - -VOID RTMP_OS_Mod_Timer( - IN NDIS_MINIPORT_TIMER *pTimer, - IN unsigned long timeout); - - -VOID RTMP_OS_Del_Timer( - IN NDIS_MINIPORT_TIMER *pTimer, - OUT BOOLEAN *pCancelled); - - -VOID RTMP_OS_Release_Packet( - IN PRTMP_ADAPTER pAd, - IN PQUEUE_ENTRY pEntry); - -VOID RTMPusecDelay( - IN ULONG usec); - -NDIS_STATUS os_alloc_mem( - IN RTMP_ADAPTER *pAd, - OUT UCHAR **mem, - IN ULONG size); - -NDIS_STATUS os_free_mem( - IN PRTMP_ADAPTER pAd, - IN PVOID mem); - - -void RTMP_AllocateSharedMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); - -VOID RTMPFreeTxRxRingMemory( - IN PRTMP_ADAPTER pAd); - -NDIS_STATUS AdapterBlockAllocateMemory( - IN PVOID handle, - OUT PVOID *ppAd); - -void RTMP_AllocateTxDescMemory( - IN PRTMP_ADAPTER pAd, - IN UINT Index, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); - -void RTMP_AllocateFirstTxBuffer( - IN PRTMP_ADAPTER pAd, - IN UINT Index, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); - -void RTMP_FreeFirstTxBuffer( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - IN PVOID VirtualAddress, - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); - -void RTMP_AllocateMgmtDescMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); - -void RTMP_AllocateRxDescMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); - -void RTMP_FreeDescMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN PVOID VirtualAddress, - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); - -PNDIS_PACKET RtmpOSNetPktAlloc( - IN RTMP_ADAPTER *pAd, - IN int size); - -PNDIS_PACKET RTMP_AllocateRxPacketBuffer( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); - -PNDIS_PACKET RTMP_AllocateTxPacketBuffer( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress); - -PNDIS_PACKET RTMP_AllocateFragPacketBuffer( - IN PRTMP_ADAPTER pAd, - IN ULONG Length); - -void RTMP_QueryPacketInfo( - IN PNDIS_PACKET pPacket, - OUT PACKET_INFO *pPacketInfo, - OUT PUCHAR *pSrcBufVA, - OUT UINT *pSrcBufLen); - -void RTMP_QueryNextPacketInfo( - IN PNDIS_PACKET *ppPacket, - OUT PACKET_INFO *pPacketInfo, - OUT PUCHAR *pSrcBufVA, - OUT UINT *pSrcBufLen); - - -BOOLEAN RTMP_FillTxBlkInfo( - IN RTMP_ADAPTER *pAd, - IN TX_BLK *pTxBlk); - - -PRTMP_SCATTER_GATHER_LIST -rt_get_sg_list_from_packet(PNDIS_PACKET pPacket, RTMP_SCATTER_GATHER_LIST *sg); - - - void announce_802_3_packet( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket); - - -UINT BA_Reorder_AMSDU_Annnounce( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket); - - -UINT Handle_AMSDU_Packet( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataSize, - IN UCHAR FromWhichBSSID); - - -void convert_802_11_to_802_3_packet( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN PUCHAR p8023hdr, - IN PUCHAR pData, - IN ULONG DataSize, - IN UCHAR FromWhichBSSID); - - -PNET_DEV get_netdev_from_bssid( - IN PRTMP_ADAPTER pAd, - IN UCHAR FromWhichBSSID); - - -PNDIS_PACKET duplicate_pkt( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, - IN ULONG DataSize, - IN UCHAR FromWhichBSSID); - - -PNDIS_PACKET duplicate_pkt_with_TKIP_MIC( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pOldPkt); - -PNDIS_PACKET duplicate_pkt_with_VLAN( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, - IN ULONG DataSize, - IN UCHAR FromWhichBSSID); - - -UCHAR VLAN_8023_Header_Copy( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - OUT PUCHAR pData, - IN UCHAR FromWhichBSSID); - -#ifdef DOT11_N_SUPPORT -void ba_flush_reordering_timeout_mpdus( - IN PRTMP_ADAPTER pAd, - IN PBA_REC_ENTRY pBAEntry, - IN ULONG Now32); - - -VOID BAOriSessionSetUp( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN UCHAR TID, - IN USHORT TimeOut, - IN ULONG DelayTime, - IN BOOLEAN isForced); - -VOID BASessionTearDownALL( - IN OUT PRTMP_ADAPTER pAd, - IN UCHAR Wcid); -#endif // DOT11_N_SUPPORT // - -BOOLEAN OS_Need_Clone_Packet(void); - - -VOID build_tx_packet( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN PUCHAR pFrame, - IN ULONG FrameLen); - - -VOID BAOriSessionTearDown( - IN OUT PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR TID, - IN BOOLEAN bPassive, - IN BOOLEAN bForceSend); - -VOID BARecSessionTearDown( - IN OUT PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR TID, - IN BOOLEAN bPassive); - -BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num); -void ba_reordering_resource_release(PRTMP_ADAPTER pAd); - - - -#ifdef NINTENDO_AP -VOID InitNINTENDO_TABLE( - IN PRTMP_ADAPTER pAd); - -UCHAR CheckNINTENDO_TABLE( - IN PRTMP_ADAPTER pAd, - PCHAR pDS_Ssid, - UCHAR DS_SsidLen, - PUCHAR pDS_Addr); - -UCHAR DelNINTENDO_ENTRY( - IN PRTMP_ADAPTER pAd, - UCHAR * pDS_Addr); - -VOID RTMPIoctlNintendoCapable( - IN PRTMP_ADAPTER pAd, - IN struct iwreq *wrq); - -VOID RTMPIoctlNintendoGetTable( - IN PRTMP_ADAPTER pAd, - IN struct iwreq *wrq); - -VOID RTMPIoctlNintendoSetTable( - IN PRTMP_ADAPTER pAd, - IN struct iwreq *wrq); - -#endif // NINTENDO_AP // - -BOOLEAN rtstrmactohex( - IN PSTRING s1, - IN PSTRING s2); - -BOOLEAN rtstrcasecmp( - IN PSTRING s1, - IN PSTRING s2); - -PSTRING rtstrstruncasecmp( - IN PSTRING s1, - IN PSTRING s2); - -PSTRING rtstrstr( - IN const PSTRING s1, - IN const PSTRING s2); - -PSTRING rstrtok( - IN PSTRING s, - IN const PSTRING ct); - -int rtinet_aton( - const PSTRING cp, - unsigned int *addr); - -////////// common ioctl functions ////////// -INT Set_DriverVersion_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_CountryRegion_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_CountryRegionABand_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_WirelessMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_Channel_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ShortSlot_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_TxPower_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_BGProtection_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_TxPreamble_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_RTSThreshold_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_FragThreshold_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_TxBurst_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -#ifdef AGGREGATION_SUPPORT -INT Set_PktAggregate_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); -#endif // AGGREGATION_SUPPORT // - -#ifdef INF_AMAZON_PPA -INT Set_INF_AMAZON_SE_PPA_Proc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); - -#endif // INF_AMAZON_PPA // - -INT Set_IEEE80211H_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -#ifdef DBG -INT Set_Debug_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); -#endif - -INT Show_DescInfo_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ResetStatCounter_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -#ifdef DOT11_N_SUPPORT -INT Set_BASetup_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_BADecline_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_BAOriTearDown_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_BARecTearDown_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtBw_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtMcs_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtGi_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtOpMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtStbc_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtHtc_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtExtcha_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtMpduDensity_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtBaWinSize_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtRdg_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtLinkAdapt_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtAmsdu_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtAutoBa_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtProtect_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtMimoPs_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - - -INT Set_ForceShortGI_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ForceGF_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT SetCommonHT( - IN PRTMP_ADAPTER pAd); - -INT Set_SendPSMPAction_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtMIMOPSmode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - - -INT Set_HtTxBASize_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtDisallowTKIP_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -#endif // DOT11_N_SUPPORT // - - - -#ifdef CONFIG_STA_SUPPORT -//Dls , kathy -VOID RTMPSendDLSTearDownFrame( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA); - -#ifdef DOT11_N_SUPPORT -//Block ACK -VOID QueryBATABLE( - IN PRTMP_ADAPTER pAd, - OUT PQUERYBA_TABLE pBAT); -#endif // DOT11_N_SUPPORT // - -#ifdef WPA_SUPPLICANT_SUPPORT -INT WpaCheckEapCode( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pFrame, - IN USHORT FrameLen, - IN USHORT OffSet); - -VOID WpaSendMicFailureToWpaSupplicant( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bUnicast); - -VOID SendAssocIEsToWpaSupplicant( - IN PRTMP_ADAPTER pAd); -#endif // WPA_SUPPLICANT_SUPPORT // - -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT -int wext_notify_event_assoc( - IN RTMP_ADAPTER *pAd); -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - -#endif // CONFIG_STA_SUPPORT // - - - -#ifdef DOT11_N_SUPPORT -VOID Handle_BSS_Width_Trigger_Events( - IN PRTMP_ADAPTER pAd); - -void build_ext_channel_switch_ie( - IN PRTMP_ADAPTER pAd, - IN HT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE *pIE); -#endif // DOT11_N_SUPPORT // - - -BOOLEAN APRxDoneInterruptHandle( - IN PRTMP_ADAPTER pAd); - -BOOLEAN STARxDoneInterruptHandle( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN argc); - -#ifdef DOT11_N_SUPPORT -// AMPDU packet indication -VOID Indicate_AMPDU_Packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID); - -// AMSDU packet indication -VOID Indicate_AMSDU_Packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID); -#endif // DOT11_N_SUPPORT // - -// Normal legacy Rx packet indication -VOID Indicate_Legacy_Packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID); - -VOID Indicate_EAPOL_Packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID); - -void update_os_packet_info( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID); - -void wlan_802_11_to_802_3_packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN PUCHAR pHeader802_3, - IN UCHAR FromWhichBSSID); - -UINT deaggregate_AMSDU_announce( - IN PRTMP_ADAPTER pAd, - PNDIS_PACKET pPacket, - IN PUCHAR pData, - IN ULONG DataSize); - - -#ifdef CONFIG_STA_SUPPORT -// remove LLC and get 802_3 Header -#define RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(_pRxBlk, _pHeader802_3) \ -{ \ - PUCHAR _pRemovedLLCSNAP = NULL, _pDA, _pSA; \ - \ - if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_MESH)) \ - { \ - _pDA = _pRxBlk->pHeader->Addr3; \ - _pSA = (PUCHAR)_pRxBlk->pHeader + sizeof(HEADER_802_11); \ - } \ - else \ - { \ - if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_INFRA)) \ - { \ - _pDA = _pRxBlk->pHeader->Addr1; \ - if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_DLS)) \ - _pSA = _pRxBlk->pHeader->Addr2; \ - else \ - _pSA = _pRxBlk->pHeader->Addr3; \ - } \ - else \ - { \ - _pDA = _pRxBlk->pHeader->Addr1; \ - _pSA = _pRxBlk->pHeader->Addr2; \ - } \ - } \ - \ - CONVERT_TO_802_3(_pHeader802_3, _pDA, _pSA, _pRxBlk->pData, \ - _pRxBlk->DataSize, _pRemovedLLCSNAP); \ -} -#endif // CONFIG_STA_SUPPORT // - - -BOOLEAN APFowardWirelessStaToWirelessSta( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN ULONG FromWhichBSSID); - -VOID Announce_or_Forward_802_3_Packet( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN UCHAR FromWhichBSSID); - -VOID Sta_Announce_or_Forward_802_3_Packet( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN UCHAR FromWhichBSSID); - - -#ifdef CONFIG_STA_SUPPORT -#define ANNOUNCE_OR_FORWARD_802_3_PACKET(_pAd, _pPacket, _FromWhichBSS)\ - Sta_Announce_or_Forward_802_3_Packet(_pAd, _pPacket, _FromWhichBSS); - //announce_802_3_packet(_pAd, _pPacket); -#endif // CONFIG_STA_SUPPORT // - - -PNDIS_PACKET DuplicatePacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN UCHAR FromWhichBSSID); - - -PNDIS_PACKET ClonePacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN PUCHAR pData, - IN ULONG DataSize); - - -// Normal, AMPDU or AMSDU -VOID CmmRxnonRalinkFrameIndicate( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID); - -VOID CmmRxRalinkFrameIndicate( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID); - -VOID Update_Rssi_Sample( - IN PRTMP_ADAPTER pAd, - IN RSSI_SAMPLE *pRssi, - IN PRXWI_STRUC pRxWI); - -PNDIS_PACKET GetPacketFromRxRing( - IN PRTMP_ADAPTER pAd, - OUT PRT28XX_RXD_STRUC pSaveRxD, - OUT BOOLEAN *pbReschedule, - IN OUT UINT32 *pRxPending); - -PNDIS_PACKET RTMPDeFragmentDataFrame( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk); - -//////////////////////////////////////// - -VOID RTMPIoctlGetSiteSurvey( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq); - - - - - -#ifdef SNMP_SUPPORT -//for snmp , kathy -typedef struct _DefaultKeyIdxValue -{ - UCHAR KeyIdx; - UCHAR Value[16]; -} DefaultKeyIdxValue, *PDefaultKeyIdxValue; -#endif - - -#ifdef CONFIG_STA_SUPPORT -enum { - DIDmsg_lnxind_wlansniffrm = 0x00000044, - DIDmsg_lnxind_wlansniffrm_hosttime = 0x00010044, - DIDmsg_lnxind_wlansniffrm_mactime = 0x00020044, - DIDmsg_lnxind_wlansniffrm_channel = 0x00030044, - DIDmsg_lnxind_wlansniffrm_rssi = 0x00040044, - DIDmsg_lnxind_wlansniffrm_sq = 0x00050044, - DIDmsg_lnxind_wlansniffrm_signal = 0x00060044, - DIDmsg_lnxind_wlansniffrm_noise = 0x00070044, - DIDmsg_lnxind_wlansniffrm_rate = 0x00080044, - DIDmsg_lnxind_wlansniffrm_istx = 0x00090044, - DIDmsg_lnxind_wlansniffrm_frmlen = 0x000A0044 -}; -enum { - P80211ENUM_msgitem_status_no_value = 0x00 -}; -enum { - P80211ENUM_truth_false = 0x00, - P80211ENUM_truth_true = 0x01 -}; - -/* Definition from madwifi */ -typedef struct { - UINT32 did; - UINT16 status; - UINT16 len; - UINT32 data; -} p80211item_uint32_t; - -typedef struct { - UINT32 msgcode; - UINT32 msglen; -#define WLAN_DEVNAMELEN_MAX 16 - UINT8 devname[WLAN_DEVNAMELEN_MAX]; - p80211item_uint32_t hosttime; - p80211item_uint32_t mactime; - p80211item_uint32_t channel; - p80211item_uint32_t rssi; - p80211item_uint32_t sq; - p80211item_uint32_t signal; - p80211item_uint32_t noise; - p80211item_uint32_t rate; - p80211item_uint32_t istx; - p80211item_uint32_t frmlen; -} wlan_ng_prism2_header; - -/* The radio capture header precedes the 802.11 header. */ -typedef struct PACKED _ieee80211_radiotap_header { - UINT8 it_version; /* Version 0. Only increases - * for drastic changes, - * introduction of compatible - * new fields does not count. - */ - UINT8 it_pad; - UINT16 it_len; /* length of the whole - * header in bytes, including - * it_version, it_pad, - * it_len, and data fields. - */ - UINT32 it_present; /* A bitmap telling which - * fields are present. Set bit 31 - * (0x80000000) to extend the - * bitmap by another 32 bits. - * Additional extensions are made - * by setting bit 31. - */ -}ieee80211_radiotap_header ; - -enum ieee80211_radiotap_type { - IEEE80211_RADIOTAP_TSFT = 0, - IEEE80211_RADIOTAP_FLAGS = 1, - IEEE80211_RADIOTAP_RATE = 2, - IEEE80211_RADIOTAP_CHANNEL = 3, - IEEE80211_RADIOTAP_FHSS = 4, - IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5, - IEEE80211_RADIOTAP_DBM_ANTNOISE = 6, - IEEE80211_RADIOTAP_LOCK_QUALITY = 7, - IEEE80211_RADIOTAP_TX_ATTENUATION = 8, - IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9, - IEEE80211_RADIOTAP_DBM_TX_POWER = 10, - IEEE80211_RADIOTAP_ANTENNA = 11, - IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, - IEEE80211_RADIOTAP_DB_ANTNOISE = 13 -}; - -#define WLAN_RADIOTAP_PRESENT ( \ - (1 << IEEE80211_RADIOTAP_TSFT) | \ - (1 << IEEE80211_RADIOTAP_FLAGS) | \ - (1 << IEEE80211_RADIOTAP_RATE) | \ - 0) - -typedef struct _wlan_radiotap_header { - ieee80211_radiotap_header wt_ihdr; - INT64 wt_tsft; - UINT8 wt_flags; - UINT8 wt_rate; -} wlan_radiotap_header; -/* Definition from madwifi */ - -void send_monitor_packets( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk); - - -VOID RTMPSetDesiredRates( - IN PRTMP_ADAPTER pAdapter, - IN LONG Rates); -#endif // CONFIG_STA_SUPPORT // - -INT Set_FixedTxMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -#ifdef CONFIG_APSTA_MIXED_SUPPORT -INT Set_OpMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); -#endif // CONFIG_APSTA_MIXED_SUPPORT // - -INT Set_LongRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_ShortRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -BOOLEAN RT28XXChipsetCheck( - IN void *_dev_p); - - -VOID RT28XXDMADisable( - IN RTMP_ADAPTER *pAd); - -VOID RT28XXDMAEnable( - IN RTMP_ADAPTER *pAd); - -VOID RT28xx_UpdateBeaconToAsic( - IN RTMP_ADAPTER * pAd, - IN INT apidx, - IN ULONG BeaconLen, - IN ULONG UpdatePos); - -int rt28xx_init( - IN PRTMP_ADAPTER pAd, - IN PSTRING pDefaultMac, - IN PSTRING pHostName); - -BOOLEAN RT28XXSecurityKeyAdd( - IN PRTMP_ADAPTER pAd, - IN ULONG apidx, - IN ULONG KeyIdx, - IN MAC_TABLE_ENTRY *pEntry); - -NDIS_STATUS RtmpNetTaskInit( - IN RTMP_ADAPTER *pAd); - -VOID RtmpNetTaskExit( - IN PRTMP_ADAPTER pAd); - -NDIS_STATUS RtmpMgmtTaskInit( - IN RTMP_ADAPTER *pAd); - -VOID RtmpMgmtTaskExit( - IN RTMP_ADAPTER *pAd); - -void tbtt_tasklet(unsigned long data); - - -PNET_DEV RtmpPhyNetDevInit( - IN RTMP_ADAPTER *pAd, - IN RTMP_OS_NETDEV_OP_HOOK *pNetHook); - -BOOLEAN RtmpPhyNetDevExit( - IN RTMP_ADAPTER *pAd, - IN PNET_DEV net_dev); - -INT RtmpRaDevCtrlInit( - IN RTMP_ADAPTER *pAd, - IN RTMP_INF_TYPE infType); - -BOOLEAN RtmpRaDevCtrlExit( - IN RTMP_ADAPTER *pAd); - - -#ifdef RTMP_MAC_PCI -// -// Function Prototype in cmm_data_pci.c -// -USHORT RtmpPCI_WriteTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN BOOLEAN bIsLast, - OUT USHORT *FreeNumber); - -USHORT RtmpPCI_WriteSingleTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN BOOLEAN bIsLast, - OUT USHORT *FreeNumber); - -USHORT RtmpPCI_WriteMultiTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR frameNum, - OUT USHORT *FreeNumber); - -USHORT RtmpPCI_WriteFragTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR fragNum, - OUT USHORT *FreeNumber); - -USHORT RtmpPCI_WriteSubTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN BOOLEAN bIsLast, - OUT USHORT *FreeNumber); - -VOID RtmpPCI_FinalWriteTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN USHORT totalMPDUSize, - IN USHORT FirstTxIdx); - -VOID RtmpPCIDataLastTxIdx( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN USHORT LastTxIdx); - -VOID RtmpPCIDataKickOut( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR QueIdx); - - -int RtmpPCIMgmtKickOut( - IN RTMP_ADAPTER *pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket, - IN PUCHAR pSrcBufVA, - IN UINT SrcBufLen); - - -NDIS_STATUS RTMPCheckRxError( - IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHeader, - IN PRXWI_STRUC pRxWI, - IN PRT28XX_RXD_STRUC pRxD); - -BOOLEAN RT28xxPciAsicRadioOff( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level, - IN USHORT TbttNumToNextWakeUp); - -BOOLEAN RT28xxPciAsicRadioOn( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level); - -#ifdef CONFIG_STA_SUPPORT -VOID RTMPInitPCIeLinkCtrlValue( - IN PRTMP_ADAPTER pAd); - -VOID RTMPFindHostPCIDev( - IN PRTMP_ADAPTER pAd); - -VOID RTMPPCIeLinkCtrlValueRestore( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level); - -VOID RTMPPCIeLinkCtrlSetting( - IN PRTMP_ADAPTER pAd, - IN USHORT Max); - -VOID RTMPrt3xSetPCIePowerLinkCtrl( - IN PRTMP_ADAPTER pAd); - - -VOID RT28xxPciStaAsicForceWakeup( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bFromTx); - -VOID RT28xxPciStaAsicSleepThenAutoWakeup( - IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp); - -VOID PsPollWakeExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID RadioOnExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); -#endif // CONFIG_STA_SUPPORT // - -VOID RT28xxPciMlmeRadioOn( - IN PRTMP_ADAPTER pAd); - -VOID RT28xxPciMlmeRadioOFF( - IN PRTMP_ADAPTER pAd); -#endif // RTMP_MAC_PCI // - -VOID AsicTurnOffRFClk( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel); - -VOID AsicTurnOnRFClk( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel); - - - -#ifdef RTMP_TIMER_TASK_SUPPORT -INT RtmpTimerQThread( - IN OUT PVOID Context); - -RTMP_TIMER_TASK_ENTRY *RtmpTimerQInsert( - IN RTMP_ADAPTER *pAd, - IN RALINK_TIMER_STRUCT *pTimer); - -BOOLEAN RtmpTimerQRemove( - IN RTMP_ADAPTER *pAd, - IN RALINK_TIMER_STRUCT *pTimer); - -void RtmpTimerQExit( - IN RTMP_ADAPTER *pAd); - -void RtmpTimerQInit( - IN RTMP_ADAPTER *pAd); -#endif // RTMP_TIMER_TASK_SUPPORT // - - - -//////////////////////////////////////// - -VOID QBSS_LoadInit( - IN RTMP_ADAPTER *pAd); - -UINT32 QBSS_LoadElementAppend( - IN RTMP_ADAPTER *pAd, - OUT UINT8 *buf_p); - -VOID QBSS_LoadUpdate( - IN RTMP_ADAPTER *pAd); - -/////////////////////////////////////// -INT RTMPShowCfgValue( - IN PRTMP_ADAPTER pAd, - IN PSTRING pName, - IN PSTRING pBuf); - -PSTRING RTMPGetRalinkAuthModeStr( - IN NDIS_802_11_AUTHENTICATION_MODE authMode); - -PSTRING RTMPGetRalinkEncryModeStr( - IN USHORT encryMode); -////////////////////////////////////// - -#ifdef CONFIG_STA_SUPPORT -VOID AsicStaBbpTuning( - IN PRTMP_ADAPTER pAd); - -BOOLEAN StaAddMacTableEntry( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN UCHAR MaxSupportedRateIn500Kbps, - IN HT_CAPABILITY_IE *pHtCapability, - IN UCHAR HtCapabilityLen, - IN ADD_HT_INFO_IE *pAddHtInfo, - IN UCHAR AddHtInfoLen, - IN USHORT CapabilityInfo); - - -BOOLEAN AUTH_ReqSend( - IN PRTMP_ADAPTER pAd, - IN PMLME_QUEUE_ELEM pElem, - IN PRALINK_TIMER_STRUCT pAuthTimer, - IN PSTRING pSMName, - IN USHORT SeqNo, - IN PUCHAR pNewElement, - IN ULONG ElementLen); -#endif // CONFIG_STA_SUPPORT // - -void RTMP_IndicateMediaState( - IN PRTMP_ADAPTER pAd); - -VOID ReSyncBeaconTime( - IN PRTMP_ADAPTER pAd); - -VOID RTMPSetAGCInitValue( - IN PRTMP_ADAPTER pAd, - IN UCHAR BandWidth); - -int rt28xx_close(IN PNET_DEV dev); -int rt28xx_open(IN PNET_DEV dev); - - -#define VIRTUAL_IF_INC(__pAd) ((__pAd)->VirtualIfCnt++) -#define VIRTUAL_IF_DEC(__pAd) ((__pAd)->VirtualIfCnt--) -#define VIRTUAL_IF_NUM(__pAd) ((__pAd)->VirtualIfCnt) - - -#ifdef LINUX -__inline INT VIRTUAL_IF_UP(PRTMP_ADAPTER pAd) -{ - if (VIRTUAL_IF_NUM(pAd) == 0) - { - if (rt28xx_open(pAd->net_dev) != 0) - { - DBGPRINT(RT_DEBUG_TRACE, ("rt28xx_open return fail!\n")); - return -1; - } - } - else - { - } - VIRTUAL_IF_INC(pAd); - return 0; -} - -__inline VOID VIRTUAL_IF_DOWN(PRTMP_ADAPTER pAd) -{ - VIRTUAL_IF_DEC(pAd); - if (VIRTUAL_IF_NUM(pAd) == 0) - rt28xx_close(pAd->net_dev); - return; -} -#endif // LINUX // - - - - -/* - OS Related funciton prototype definitions. - TODO: Maybe we need to move these function prototypes to other proper place. -*/ -int RtmpOSWrielessEventSend( - IN RTMP_ADAPTER *pAd, - IN UINT32 eventType, - IN INT flags, - IN PUCHAR pSrcMac, - IN PUCHAR pData, - IN UINT32 dataLen); - -int RtmpOSNetDevAddrSet( - IN PNET_DEV pNetDev, - IN PUCHAR pMacAddr); - -int RtmpOSNetDevAttach( - IN PNET_DEV pNetDev, - IN RTMP_OS_NETDEV_OP_HOOK *pDevOpHook); - -void RtmpOSNetDevClose( - IN PNET_DEV pNetDev); - -void RtmpOSNetDevDetach( - IN PNET_DEV pNetDev); - -INT RtmpOSNetDevAlloc( - IN PNET_DEV *pNewNetDev, - IN UINT32 privDataSize); - -void RtmpOSNetDevFree( - IN PNET_DEV pNetDev); - -PNET_DEV RtmpOSNetDevGetByName( - IN PNET_DEV pNetDev, - IN PSTRING pDevName); - -void RtmpOSNetDeviceRefPut( - IN PNET_DEV pNetDev); - -PNET_DEV RtmpOSNetDevCreate( - IN RTMP_ADAPTER *pAd, - IN INT devType, - IN INT devNum, - IN INT privMemSize, - IN PSTRING pNamePrefix); - -/* - Task operation related function prototypes -*/ -void RtmpOSTaskCustomize( - IN RTMP_OS_TASK *pTask); - -INT RtmpOSTaskNotifyToExit( - IN RTMP_OS_TASK *pTask); - -NDIS_STATUS RtmpOSTaskKill( - IN RTMP_OS_TASK *pTask); - -NDIS_STATUS RtmpOSTaskInit( - IN RTMP_OS_TASK *pTask, - PSTRING pTaskName, - VOID *pPriv); - -NDIS_STATUS RtmpOSTaskAttach( - IN RTMP_OS_TASK *pTask, - IN int (*fn)(void *), - IN void *arg); - - -/* - File operation related function prototypes -*/ -RTMP_OS_FD RtmpOSFileOpen( - IN char *pPath, - IN int flag, - IN int mode); - -int RtmpOSFileClose( - IN RTMP_OS_FD osfd); - -void RtmpOSFileSeek( - IN RTMP_OS_FD osfd, - IN int offset); - -int RtmpOSFileRead( - IN RTMP_OS_FD osfd, - IN char *pDataPtr, - IN int readLen); - -int RtmpOSFileWrite( - IN RTMP_OS_FD osfd, - IN char *pDataPtr, - IN int writeLen); - -void RtmpOSFSInfoChange( - IN RTMP_OS_FS_INFO *pOSFSInfo, - IN BOOLEAN bSet); - - -#endif // __RTMP_H__ diff --git a/drivers/staging/rt3090/rtmp_chip.h b/drivers/staging/rt3090/rtmp_chip.h deleted file mode 100644 index a0b4bf06cca0..000000000000 --- a/drivers/staging/rt3090/rtmp_chip.h +++ /dev/null @@ -1,355 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rtmp_chip.h - - Abstract: - Ralink Wireless Chip related definition & structures - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#ifndef __RTMP_CHIP_H__ -#define __RTMP_CHIP_H__ - -#include "rtmp_type.h" - -#ifdef RT3090 -#include "rt3090.h" -#endif // RT3090 // - -#ifdef RT3370 -#include "rt3370.h" -#endif // RT3370 // - -#ifdef RT3390 -#include "rt3390.h" -#endif // RT3390 // - -// We will have a cost down version which mac version is 0x3090xxxx -// -// RT3090A facts -// -// a) 2.4 GHz -// b) Replacement for RT3090 -// c) Internal LNA -// d) Interference over channel #14 -// e) New BBP features (e.g., SIG re-modulation) -// -#define IS_RT3090A(_pAd) ((((_pAd)->MACVersion & 0xffff0000) == 0x30900000)) - -// We will have a cost down version which mac version is 0x3090xxxx -#define IS_RT3090(_pAd) ((((_pAd)->MACVersion & 0xffff0000) == 0x30710000) || (IS_RT3090A(_pAd))) - -#define IS_RT3070(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x30700000) -#define IS_RT3071(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x30710000) -#define IS_RT2070(_pAd) (((_pAd)->RfIcType == RFIC_2020) || ((_pAd)->EFuseTag == 0x27)) - -#define IS_RT30xx(_pAd) (((_pAd)->MACVersion & 0xfff00000) == 0x30700000||IS_RT3090A(_pAd)) -//#define IS_RT305X(_pAd) ((_pAd)->MACVersion == 0x28720200) - -/* RT3572, 3592, 3562, 3062 share the same MAC version */ -#define IS_RT3572(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x35720000) -#define IS_VERSION_BEFORE_F(_pAd) (((_pAd)->MACVersion&0xffff) <= 0x0211) -// F version is 0x0212, E version is 0x0211. 309x can save more power after F version. -#define IS_VERSION_AFTER_F(_pAd) ((((_pAd)->MACVersion&0xffff) >= 0x0212) || (((_pAd)->b3090ESpecialChip == TRUE))) -// -// RT3390 facts -// -// a) Base on RT3090 (RF IC: RT3020) -// b) 2.4 GHz -// c) 1x1 -// d) Single chip -// e) Internal components: PA and LNA -// -//RT3390,RT3370 -#define IS_RT3390(_pAd) (((_pAd)->MACVersion & 0xFFFF0000) == 0x33900000) - -// ------------------------------------------------------ -// PCI registers - base address 0x0000 -// ------------------------------------------------------ -#define CHIP_PCI_CFG 0x0000 -#define CHIP_PCI_EECTRL 0x0004 -#define CHIP_PCI_MCUCTRL 0x0008 - -#define OPT_14 0x114 - -#define RETRY_LIMIT 10 - - - -// ------------------------------------------------------ -// BBP & RF definition -// ------------------------------------------------------ -#define BUSY 1 -#define IDLE 0 - - -//------------------------------------------------------------------------- -// EEPROM definition -//------------------------------------------------------------------------- -#define EEDO 0x08 -#define EEDI 0x04 -#define EECS 0x02 -#define EESK 0x01 -#define EERL 0x80 - -#define EEPROM_WRITE_OPCODE 0x05 -#define EEPROM_READ_OPCODE 0x06 -#define EEPROM_EWDS_OPCODE 0x10 -#define EEPROM_EWEN_OPCODE 0x13 - -#define NUM_EEPROM_BBP_PARMS 19 // Include NIC Config 0, 1, CR, TX ALC step, BBPs -#define NUM_EEPROM_TX_G_PARMS 7 -#define EEPROM_NIC1_OFFSET 0x34 // The address is from NIC config 0, not BBP register ID -#define EEPROM_NIC2_OFFSET 0x36 // The address is from NIC config 0, not BBP register ID -#define EEPROM_BBP_BASE_OFFSET 0xf0 // The address is from NIC config 0, not BBP register ID -#define EEPROM_G_TX_PWR_OFFSET 0x52 -#define EEPROM_G_TX2_PWR_OFFSET 0x60 -#define EEPROM_LED1_OFFSET 0x3c -#define EEPROM_LED2_OFFSET 0x3e -#define EEPROM_LED3_OFFSET 0x40 -#define EEPROM_LNA_OFFSET 0x44 -#define EEPROM_RSSI_BG_OFFSET 0x46 -#define EEPROM_TXMIXER_GAIN_2_4G 0x48 -#define EEPROM_RSSI_A_OFFSET 0x4a -#define EEPROM_TXMIXER_GAIN_5G 0x4c -#define EEPROM_DEFINE_MAX_TXPWR 0x4e -#define EEPROM_TXPOWER_BYRATE_20MHZ_2_4G 0xde // 20MHZ 2.4G tx power. -#define EEPROM_TXPOWER_BYRATE_40MHZ_2_4G 0xee // 40MHZ 2.4G tx power. -#define EEPROM_TXPOWER_BYRATE_20MHZ_5G 0xfa // 20MHZ 5G tx power. -#define EEPROM_TXPOWER_BYRATE_40MHZ_5G 0x10a // 40MHZ 5G tx power. -#define EEPROM_A_TX_PWR_OFFSET 0x78 -#define EEPROM_A_TX2_PWR_OFFSET 0xa6 -//#define EEPROM_Japan_TX_PWR_OFFSET 0x90 // 802.11j -//#define EEPROM_Japan_TX2_PWR_OFFSET 0xbe -//#define EEPROM_TSSI_REF_OFFSET 0x54 -//#define EEPROM_TSSI_DELTA_OFFSET 0x24 -//#define EEPROM_CCK_TX_PWR_OFFSET 0x62 -//#define EEPROM_CALIBRATE_OFFSET 0x7c -#define EEPROM_VERSION_OFFSET 0x02 -#define EEPROM_FREQ_OFFSET 0x3a -#define EEPROM_TXPOWER_BYRATE 0xde // 20MHZ power. -#define EEPROM_TXPOWER_DELTA 0x50 // 20MHZ AND 40 MHZ use different power. This is delta in 40MHZ. -#define VALID_EEPROM_VERSION 1 - - -/* - * EEPROM operation related marcos - */ -#define RT28xx_EEPROM_READ16(_pAd, _offset, _value) \ - (_pAd)->chipOps.eeread((RTMP_ADAPTER *)(_pAd), (USHORT)(_offset), (PUSHORT)&(_value)) - -#define RT28xx_EEPROM_WRITE16(_pAd, _offset, _value) \ - (_pAd)->chipOps.eewrite((RTMP_ADAPTER *)(_pAd), (USHORT)(_offset), (USHORT)(_value)) - - - -// ------------------------------------------------------------------- -// E2PROM data layout -// ------------------------------------------------------------------- - -// -// MCU_LEDCS: MCU LED Control Setting. -// -typedef union _MCU_LEDCS_STRUC { - struct { -#ifdef RT_BIG_ENDIAN - UCHAR Polarity:1; - UCHAR LedMode:7; -#else - UCHAR LedMode:7; - UCHAR Polarity:1; -#endif // RT_BIG_ENDIAN // - } field; - UCHAR word; -} MCU_LEDCS_STRUC, *PMCU_LEDCS_STRUC; - - -// -// EEPROM antenna select format -// -#ifdef RT_BIG_ENDIAN -typedef union _EEPROM_ANTENNA_STRUC { - struct { - USHORT Rsv:4; - USHORT RfIcType:4; // see E2PROM document - USHORT TxPath:4; // 1: 1T, 2: 2T - USHORT RxPath:4; // 1: 1R, 2: 2R, 3: 3R - } field; - USHORT word; -} EEPROM_ANTENNA_STRUC, *PEEPROM_ANTENNA_STRUC; -#else -typedef union _EEPROM_ANTENNA_STRUC { - struct { - USHORT RxPath:4; // 1: 1R, 2: 2R, 3: 3R - USHORT TxPath:4; // 1: 1T, 2: 2T - USHORT RfIcType:4; // see E2PROM document - USHORT Rsv:4; - } field; - USHORT word; -} EEPROM_ANTENNA_STRUC, *PEEPROM_ANTENNA_STRUC; -#endif - -#ifdef RT_BIG_ENDIAN -typedef union _EEPROM_NIC_CINFIG2_STRUC { - struct { - USHORT DACTestBit:1; // control if driver should patch the DAC issue - USHORT Rsv2:3; // must be 0 - USHORT AntDiversity:1; // Antenna diversity - USHORT Rsv1:1; // must be 0 - USHORT BW40MAvailForA:1; // 0:enable, 1:disable - USHORT BW40MAvailForG:1; // 0:enable, 1:disable - USHORT EnableWPSPBC:1; // WPS PBC Control bit - USHORT BW40MSidebandForA:1; - USHORT BW40MSidebandForG:1; - USHORT CardbusAcceleration:1; // !!! NOTE: 0 - enable, 1 - disable - USHORT ExternalLNAForA:1; // external LNA enable for 5G - USHORT ExternalLNAForG:1; // external LNA enable for 2.4G - USHORT DynamicTxAgcControl:1; // - USHORT HardwareRadioControl:1; // Whether RF is controlled by driver or HW. 1:enable hw control, 0:disable - } field; - USHORT word; -} EEPROM_NIC_CONFIG2_STRUC, *PEEPROM_NIC_CONFIG2_STRUC; -#else -typedef union _EEPROM_NIC_CINFIG2_STRUC { - struct { - USHORT HardwareRadioControl:1; // 1:enable, 0:disable - USHORT DynamicTxAgcControl:1; // - USHORT ExternalLNAForG:1; // - USHORT ExternalLNAForA:1; // external LNA enable for 2.4G - USHORT CardbusAcceleration:1; // !!! NOTE: 0 - enable, 1 - disable - USHORT BW40MSidebandForG:1; - USHORT BW40MSidebandForA:1; - USHORT EnableWPSPBC:1; // WPS PBC Control bit - USHORT BW40MAvailForG:1; // 0:enable, 1:disable - USHORT BW40MAvailForA:1; // 0:enable, 1:disable - USHORT Rsv1:1; // must be 0 - USHORT AntDiversity:1; // Antenna diversity - USHORT Rsv2:3; // must be 0 - USHORT DACTestBit:1; // control if driver should patch the DAC issue - } field; - USHORT word; -} EEPROM_NIC_CONFIG2_STRUC, *PEEPROM_NIC_CONFIG2_STRUC; -#endif - -// -// TX_PWR Value valid range 0xFA(-6) ~ 0x24(36) -// -#ifdef RT_BIG_ENDIAN -typedef union _EEPROM_TX_PWR_STRUC { - struct { - CHAR Byte1; // High Byte - CHAR Byte0; // Low Byte - } field; - USHORT word; -} EEPROM_TX_PWR_STRUC, *PEEPROM_TX_PWR_STRUC; -#else -typedef union _EEPROM_TX_PWR_STRUC { - struct { - CHAR Byte0; // Low Byte - CHAR Byte1; // High Byte - } field; - USHORT word; -} EEPROM_TX_PWR_STRUC, *PEEPROM_TX_PWR_STRUC; -#endif - -#ifdef RT_BIG_ENDIAN -typedef union _EEPROM_VERSION_STRUC { - struct { - UCHAR Version; // High Byte - UCHAR FaeReleaseNumber; // Low Byte - } field; - USHORT word; -} EEPROM_VERSION_STRUC, *PEEPROM_VERSION_STRUC; -#else -typedef union _EEPROM_VERSION_STRUC { - struct { - UCHAR FaeReleaseNumber; // Low Byte - UCHAR Version; // High Byte - } field; - USHORT word; -} EEPROM_VERSION_STRUC, *PEEPROM_VERSION_STRUC; -#endif - -#ifdef RT_BIG_ENDIAN -typedef union _EEPROM_LED_STRUC { - struct { - USHORT Rsvd:3; // Reserved - USHORT LedMode:5; // Led mode. - USHORT PolarityGPIO_4:1; // Polarity GPIO#4 setting. - USHORT PolarityGPIO_3:1; // Polarity GPIO#3 setting. - USHORT PolarityGPIO_2:1; // Polarity GPIO#2 setting. - USHORT PolarityGPIO_1:1; // Polarity GPIO#1 setting. - USHORT PolarityGPIO_0:1; // Polarity GPIO#0 setting. - USHORT PolarityACT:1; // Polarity ACT setting. - USHORT PolarityRDY_A:1; // Polarity RDY_A setting. - USHORT PolarityRDY_G:1; // Polarity RDY_G setting. - } field; - USHORT word; -} EEPROM_LED_STRUC, *PEEPROM_LED_STRUC; -#else -typedef union _EEPROM_LED_STRUC { - struct { - USHORT PolarityRDY_G:1; // Polarity RDY_G setting. - USHORT PolarityRDY_A:1; // Polarity RDY_A setting. - USHORT PolarityACT:1; // Polarity ACT setting. - USHORT PolarityGPIO_0:1; // Polarity GPIO#0 setting. - USHORT PolarityGPIO_1:1; // Polarity GPIO#1 setting. - USHORT PolarityGPIO_2:1; // Polarity GPIO#2 setting. - USHORT PolarityGPIO_3:1; // Polarity GPIO#3 setting. - USHORT PolarityGPIO_4:1; // Polarity GPIO#4 setting. - USHORT LedMode:5; // Led mode. - USHORT Rsvd:3; // Reserved - } field; - USHORT word; -} EEPROM_LED_STRUC, *PEEPROM_LED_STRUC; -#endif - -#ifdef RT_BIG_ENDIAN -typedef union _EEPROM_TXPOWER_DELTA_STRUC { - struct { - UCHAR TxPowerEnable:1;// Enable - UCHAR Type:1; // 1: plus the delta value, 0: minus the delta value - UCHAR DeltaValue:6; // Tx Power dalta value (MAX=4) - } field; - UCHAR value; -} EEPROM_TXPOWER_DELTA_STRUC, *PEEPROM_TXPOWER_DELTA_STRUC; -#else -typedef union _EEPROM_TXPOWER_DELTA_STRUC { - struct { - UCHAR DeltaValue:6; // Tx Power dalta value (MAX=4) - UCHAR Type:1; // 1: plus the delta value, 0: minus the delta value - UCHAR TxPowerEnable:1;// Enable - } field; - UCHAR value; -} EEPROM_TXPOWER_DELTA_STRUC, *PEEPROM_TXPOWER_DELTA_STRUC; -#endif - -#endif // __RTMP_CHIP_H__ // diff --git a/drivers/staging/rt3090/rtmp_def.h b/drivers/staging/rt3090/rtmp_def.h deleted file mode 100644 index aeb739d0935c..000000000000 --- a/drivers/staging/rt3090/rtmp_def.h +++ /dev/null @@ -1,1650 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rtmp_def.h - - Abstract: - Miniport related definition header - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Paul Lin 08-01-2002 created - John Chang 08-05-2003 add definition for 11g & other drafts -*/ -#ifndef __RTMP_DEF_H__ -#define __RTMP_DEF_H__ - -#include "oid.h" - -#undef AP_WSC_INCLUDED -#undef STA_WSC_INCLUDED -#undef WSC_INCLUDED - - -#ifdef CONFIG_STA_SUPPORT -#endif // CONFIG_STA_SUPPORT // - -#if defined(AP_WSC_INCLUDED) || defined(STA_WSC_INCLUDED) -#define WSC_INCLUDED -#endif -// -// Debug information verbosity: lower values indicate higher urgency -// -#define RT_DEBUG_OFF 0 -#define RT_DEBUG_ERROR 1 -#define RT_DEBUG_WARN 2 -#define RT_DEBUG_TRACE 3 -#define RT_DEBUG_INFO 4 -#define RT_DEBUG_LOUD 5 - -#define NIC_TAG ((ULONG)'0682') -#define NIC_DBG_STRING ("**RT28xx**") - -#ifdef SNMP_SUPPORT -// for snmp -// to get manufacturer OUI, kathy, 2008_0220 -#define ManufacturerOUI_LEN 3 -#define ManufacturerNAME ("Ralink Technology Company.") -#define ResourceTypeIdName ("Ralink_ID") -#endif - - -//#define PACKED - -#define RALINK_2883_VERSION ((UINT32)0x28830300) -#define RALINK_2880E_VERSION ((UINT32)0x28720200) -#define RALINK_3070_VERSION ((UINT32)0x30700200) - -#define MAX_RX_PKT_LEN 1520 - -// -// Entry number for each DMA descriptor ring -// - -#ifdef RTMP_MAC_PCI -#define TX_RING_SIZE 64 //64 -#define MGMT_RING_SIZE 128 -#define RX_RING_SIZE 128 //64 -#define MAX_TX_PROCESS TX_RING_SIZE //8 -#define MAX_DMA_DONE_PROCESS TX_RING_SIZE -#define MAX_TX_DONE_PROCESS TX_RING_SIZE //8 -#define LOCAL_TXBUF_SIZE 2 -#endif // RTMP_MAC_PCI // - -#define PCI_VIRT_TO_PHYS(__Addr) (((UINT32)(__Addr)) & 0x0FFFFFFF) - - -#ifdef MULTIPLE_CARD_SUPPORT -// MC: Multple Cards -#define MAX_NUM_OF_MULTIPLE_CARD 32 -#endif // MULTIPLE_CARD_SUPPORT // - -#define MAX_RX_PROCESS 128 //64 //32 -#define NUM_OF_LOCAL_TXBUF 2 -#define TXD_SIZE 16 -#define TXWI_SIZE 16 -#define RXD_SIZE 16 -#define RXWI_SIZE 16 -// TXINFO_SIZE + TXWI_SIZE + 802.11 Header Size + AMSDU sub frame header -#define TX_DMA_1ST_BUFFER_SIZE 96 // only the 1st physical buffer is pre-allocated -#define MGMT_DMA_BUFFER_SIZE 1536 //2048 -#define RX_BUFFER_AGGRESIZE 3840 //3904 //3968 //4096 //2048 //4096 -#define RX_BUFFER_NORMSIZE 3840 //3904 //3968 //4096 //2048 //4096 -#define TX_BUFFER_NORMSIZE RX_BUFFER_NORMSIZE -#define MAX_FRAME_SIZE 2346 // Maximum 802.11 frame size -#define MAX_AGGREGATION_SIZE 3840 //3904 //3968 //4096 -#define MAX_NUM_OF_TUPLE_CACHE 2 -#define MAX_MCAST_LIST_SIZE 32 -#define MAX_LEN_OF_VENDOR_DESC 64 -//#define MAX_SIZE_OF_MCAST_PSQ (NUM_OF_LOCAL_TXBUF >> 2) // AP won't spend more than 1/4 of total buffers on M/BCAST PSQ -#define MAX_SIZE_OF_MCAST_PSQ 32 - -#define MAX_RX_PROCESS_CNT (RX_RING_SIZE) - - -/* - WMM Note: If memory of your system is not much, please reduce the definition; - or when you do WMM test, the queue for low priority AC will be full, i.e. - TX_RING_SIZE + MAX_PACKETS_IN_QUEUE packets for the AC will be buffered in - WLAN, maybe no any packet buffer can be got in Ethernet driver. - - Sometimes no packet buffer can be got in Ethernet driver, the system will - send flow control packet to the sender to slow down its sending rate. - So no WMM can be saw in the air. -*/ - -/* - Need to use 64 in vxworks for test case WMM A5-T07 - Two dnlink (10Mbps) from a WMM station to a non-WMM station. - If use 256, queue is not enough. - And in rt_main_end.c, clConfig.clNum = RX_RING_SIZE * 3; is changed to - clConfig.clNum = RX_RING_SIZE * 4; -*/ -// TODO: For VxWorks the size is 256. Shall we cahnge the value as 256 for all OS????? -#define MAX_PACKETS_IN_QUEUE (512) //(512) // to pass WMM A5-WPAPSK - -#define MAX_PACKETS_IN_MCAST_PS_QUEUE 32 -#define MAX_PACKETS_IN_PS_QUEUE 128 //32 -#define WMM_NUM_OF_AC 4 /* AC0, AC1, AC2, and AC3 */ - - -#ifdef RTMP_EFUSE_SUPPORT -//2008/09/11:KH add to support efuse<-- -#define MAX_EEPROM_BIN_FILE_SIZE 1024 -#define EFUSE_BUFFER_PATH "/tmp/RT30xxEEPROM.bin" -//2008/09/11:KH add to support efuse--> -#endif // RTMP_EFUSE_SUPPORT // - -// RxFilter -#define STANORMAL 0x17f97 -#define APNORMAL 0x15f97 -#define PSPXLINK 0x17f93 -// -// RTMP_ADAPTER flags -// -#define fRTMP_ADAPTER_MAP_REGISTER 0x00000001 -#define fRTMP_ADAPTER_INTERRUPT_IN_USE 0x00000002 -#define fRTMP_ADAPTER_HARDWARE_ERROR 0x00000004 -#define fRTMP_ADAPTER_SCATTER_GATHER 0x00000008 -#define fRTMP_ADAPTER_SEND_PACKET_ERROR 0x00000010 -#define fRTMP_ADAPTER_MLME_RESET_IN_PROGRESS 0x00000020 -#define fRTMP_ADAPTER_HALT_IN_PROGRESS 0x00000040 -#define fRTMP_ADAPTER_RESET_IN_PROGRESS 0x00000080 -#define fRTMP_ADAPTER_NIC_NOT_EXIST 0x00000100 -#define fRTMP_ADAPTER_TX_RING_ALLOCATED 0x00000200 -#define fRTMP_ADAPTER_REMOVE_IN_PROGRESS 0x00000400 -#define fRTMP_ADAPTER_MIMORATE_INUSED 0x00000800 -#define fRTMP_ADAPTER_RX_RING_ALLOCATED 0x00001000 -#define fRTMP_ADAPTER_INTERRUPT_ACTIVE 0x00002000 -#define fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS 0x00004000 -#define fRTMP_ADAPTER_REASSOC_IN_PROGRESS 0x00008000 -#define fRTMP_ADAPTER_MEDIA_STATE_PENDING 0x00010000 -#define fRTMP_ADAPTER_RADIO_OFF 0x00020000 -#define fRTMP_ADAPTER_BULKOUT_RESET 0x00040000 -#define fRTMP_ADAPTER_BULKIN_RESET 0x00080000 -#define fRTMP_ADAPTER_RDG_ACTIVE 0x00100000 -#define fRTMP_ADAPTER_DYNAMIC_BE_TXOP_ACTIVE 0x00200000 -#define fRTMP_ADAPTER_SCAN_2040 0x04000000 -#define fRTMP_ADAPTER_RADIO_MEASUREMENT 0x08000000 - -#define fRTMP_ADAPTER_START_UP 0x10000000 //Devive already initialized and enabled Tx/Rx. -#define fRTMP_ADAPTER_MEDIA_STATE_CHANGE 0x20000000 -#define fRTMP_ADAPTER_IDLE_RADIO_OFF 0x40000000 - -// Lock bit for accessing different ring buffers -//#define fRTMP_ADAPTER_TX_RING_BUSY 0x80000000 -//#define fRTMP_ADAPTER_MGMT_RING_BUSY 0x40000000 -//#define fRTMP_ADAPTER_ATIM_RING_BUSY 0x20000000 -//#define fRTMP_ADAPTER_RX_RING_BUSY 0x10000000 - -// Lock bit for accessing different queue -//#define fRTMP_ADAPTER_TX_QUEUE_BUSY 0x08000000 -//#define fRTMP_ADAPTER_MGMT_QUEUE_BUSY 0x04000000 - -// -// STA operation status flags -// -#define fOP_STATUS_INFRA_ON 0x00000001 -#define fOP_STATUS_ADHOC_ON 0x00000002 -#define fOP_STATUS_BG_PROTECTION_INUSED 0x00000004 -#define fOP_STATUS_SHORT_SLOT_INUSED 0x00000008 -#define fOP_STATUS_SHORT_PREAMBLE_INUSED 0x00000010 -#define fOP_STATUS_RECEIVE_DTIM 0x00000020 -//#define fOP_STATUS_TX_RATE_SWITCH_ENABLED 0x00000040 -#define fOP_STATUS_MEDIA_STATE_CONNECTED 0x00000080 -#define fOP_STATUS_WMM_INUSED 0x00000100 -#define fOP_STATUS_AGGREGATION_INUSED 0x00000200 -#define fOP_STATUS_DOZE 0x00000400 // debug purpose -#define fOP_STATUS_PIGGYBACK_INUSED 0x00000800 // piggy-back, and aggregation -#define fOP_STATUS_APSD_INUSED 0x00001000 -#define fOP_STATUS_TX_AMSDU_INUSED 0x00002000 -#define fOP_STATUS_MAX_RETRY_ENABLED 0x00004000 -#define fOP_STATUS_WAKEUP_NOW 0x00008000 -#define fOP_STATUS_PCIE_DEVICE 0x00020000 - -// -// RTMP_ADAPTER PSFlags : related to advanced power save. -// -// Indicate whether driver can go to sleep mode from now. This flag is useful AFTER link up -#define fRTMP_PS_CAN_GO_SLEEP 0x00000001 -// Indicate whether driver has issue a LinkControl command to PCIe L1 -#define fRTMP_PS_SET_PCI_CLK_OFF_COMMAND 0x00000002 -// Indicate driver should disable kick off hardware to send packets from now. -#define fRTMP_PS_DISABLE_TX 0x00000004 -// Indicate driver should IMMEDIATELY fo to sleep after receiving AP's beacon in which doesn't indicate unicate nor multicast packets for me -//. This flag is used ONLY in RTMPHandleRxDoneInterrupt routine. -#define fRTMP_PS_GO_TO_SLEEP_NOW 0x00000008 -#define fRTMP_PS_TOGGLE_L1 0x00000010 // Use Toggle L1 mechanism for rt28xx PCIe -#ifdef RT3090 -#define WAKE_MCU_CMD 0x31 -#define SLEEP_MCU_CMD 0x30 -#define RFOFF_MCU_CMD 0x35 -#endif // RT3090 // -#ifdef DOT11N_DRAFT3 -#define fOP_STATUS_SCAN_2040 0x00040000 -#endif // DOT11N_DRAFT3 // - -#define CCKSETPROTECT 0x1 -#define OFDMSETPROTECT 0x2 -#define MM20SETPROTECT 0x4 -#define MM40SETPROTECT 0x8 -#define GF20SETPROTECT 0x10 -#define GR40SETPROTECT 0x20 -#define ALLN_SETPROTECT (GR40SETPROTECT | GF20SETPROTECT | MM40SETPROTECT | MM20SETPROTECT) - -// -// AP's client table operation status flags -// -#define fCLIENT_STATUS_WMM_CAPABLE 0x00000001 // CLIENT can parse QOS DATA frame -#define fCLIENT_STATUS_AGGREGATION_CAPABLE 0x00000002 // CLIENT can receive Ralink's proprietary TX aggregation frame -#define fCLIENT_STATUS_PIGGYBACK_CAPABLE 0x00000004 // CLIENT support piggy-back -#define fCLIENT_STATUS_AMSDU_INUSED 0x00000008 -#define fCLIENT_STATUS_SGI20_CAPABLE 0x00000010 -#define fCLIENT_STATUS_SGI40_CAPABLE 0x00000020 -#define fCLIENT_STATUS_TxSTBC_CAPABLE 0x00000040 -#define fCLIENT_STATUS_RxSTBC_CAPABLE 0x00000080 -#define fCLIENT_STATUS_HTC_CAPABLE 0x00000100 -#define fCLIENT_STATUS_RDG_CAPABLE 0x00000200 -#define fCLIENT_STATUS_MCSFEEDBACK_CAPABLE 0x00000400 -#define fCLIENT_STATUS_APSD_CAPABLE 0x00000800 /* UAPSD STATION */ - -#ifdef DOT11N_DRAFT3 -#define fCLIENT_STATUS_BSSCOEXIST_CAPABLE 0x00001000 -#endif // DOT11N_DRAFT3 // - -#define fCLIENT_STATUS_RALINK_CHIPSET 0x00100000 -// -// STA configuration flags -// -//#define fSTA_CFG_ENABLE_TX_BURST 0x00000001 - -// 802.11n Operating Mode Definition. 0-3 also used in ASICUPdateProtect switch case -#define HT_NO_PROTECT 0 -#define HT_LEGACY_PROTECT 1 -#define HT_40_PROTECT 2 -#define HT_2040_PROTECT 3 -#define HT_RTSCTS_6M 7 -//following is our own definition in order to turn on our ASIC protection register in INFRASTRUCTURE. -#define HT_ATHEROS 8 // rt2860c has problem with atheros chip. we need to turn on RTS/CTS . -#define HT_FORCERTSCTS 9 // Force turn on RTS/CTS first. then go to evaluate if this force RTS is necessary. - -// -// RX Packet Filter control flags. Apply on pAd->PacketFilter -// -#define fRX_FILTER_ACCEPT_DIRECT NDIS_PACKET_TYPE_DIRECTED -#define fRX_FILTER_ACCEPT_MULTICAST NDIS_PACKET_TYPE_MULTICAST -#define fRX_FILTER_ACCEPT_BROADCAST NDIS_PACKET_TYPE_BROADCAST -#define fRX_FILTER_ACCEPT_ALL_MULTICAST NDIS_PACKET_TYPE_ALL_MULTICAST -#define fRX_FILTER_ACCEPT_PROMISCUOUS NDIS_PACKET_TYPE_PROMISCUOUS - -// -// Error code section -// -// NDIS_ERROR_CODE_ADAPTER_NOT_FOUND -#define ERRLOG_READ_PCI_SLOT_FAILED 0x00000101L -#define ERRLOG_WRITE_PCI_SLOT_FAILED 0x00000102L -#define ERRLOG_VENDOR_DEVICE_NOMATCH 0x00000103L - -// NDIS_ERROR_CODE_ADAPTER_DISABLED -#define ERRLOG_BUS_MASTER_DISABLED 0x00000201L - -// NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION -#define ERRLOG_INVALID_SPEED_DUPLEX 0x00000301L -#define ERRLOG_SET_SECONDARY_FAILED 0x00000302L - -// NDIS_ERROR_CODE_OUT_OF_RESOURCES -#define ERRLOG_OUT_OF_MEMORY 0x00000401L -#define ERRLOG_OUT_OF_SHARED_MEMORY 0x00000402L -#define ERRLOG_OUT_OF_MAP_REGISTERS 0x00000403L -#define ERRLOG_OUT_OF_BUFFER_POOL 0x00000404L -#define ERRLOG_OUT_OF_NDIS_BUFFER 0x00000405L -#define ERRLOG_OUT_OF_PACKET_POOL 0x00000406L -#define ERRLOG_OUT_OF_NDIS_PACKET 0x00000407L -#define ERRLOG_OUT_OF_LOOKASIDE_MEMORY 0x00000408L - -// NDIS_ERROR_CODE_HARDWARE_FAILURE -#define ERRLOG_SELFTEST_FAILED 0x00000501L -#define ERRLOG_INITIALIZE_ADAPTER 0x00000502L -#define ERRLOG_REMOVE_MINIPORT 0x00000503L - -// NDIS_ERROR_CODE_RESOURCE_CONFLICT -#define ERRLOG_MAP_IO_SPACE 0x00000601L -#define ERRLOG_QUERY_ADAPTER_RESOURCES 0x00000602L -#define ERRLOG_NO_IO_RESOURCE 0x00000603L -#define ERRLOG_NO_INTERRUPT_RESOURCE 0x00000604L -#define ERRLOG_NO_MEMORY_RESOURCE 0x00000605L - - -// WDS definition -#define MAX_WDS_ENTRY 4 -#define WDS_PAIRWISE_KEY_OFFSET 60 // WDS links uses pairwise key#60 ~ 63 in ASIC pairwise key table - -#define WDS_DISABLE_MODE 0 -#define WDS_RESTRICT_MODE 1 -#define WDS_BRIDGE_MODE 2 -#define WDS_REPEATER_MODE 3 -#define WDS_LAZY_MODE 4 - - -#define MAX_MESH_NUM 0 - -#define MAX_APCLI_NUM 0 -#ifdef APCLI_SUPPORT -#undef MAX_APCLI_NUM -#define MAX_APCLI_NUM 1 -#endif // APCLI_SUPPORT // - -#define MAX_MBSSID_NUM 1 -#ifdef MBSS_SUPPORT -#undef MAX_MBSSID_NUM -#define MAX_MBSSID_NUM (8 - MAX_MESH_NUM - MAX_APCLI_NUM) -#endif // MBSS_SUPPORT // - -/* sanity check for apidx */ -#define MBSS_MR_APIDX_SANITY_CHECK(apidx) \ - { if (apidx > MAX_MBSSID_NUM) { \ - DBGPRINT(RT_DEBUG_ERROR, ("%s> Error! apidx = %d > MAX_MBSSID_NUM!\n", __FUNCTION__, apidx)); \ - apidx = MAIN_MBSSID; } } - -#define VALID_WCID(_wcid) ((_wcid) > 0 && (_wcid) < MAX_LEN_OF_MAC_TABLE ) - -#define MAIN_MBSSID 0 -#define FIRST_MBSSID 1 - - -#define MAX_BEACON_SIZE 512 -// If the MAX_MBSSID_NUM is larger than 6, -// it shall reserve some WCID space(wcid 222~253) for beacon frames. -// - these wcid 238~253 are reserved for beacon#6(ra6). -// - these wcid 222~237 are reserved for beacon#7(ra7). -#if defined(MAX_MBSSID_NUM) && (MAX_MBSSID_NUM == 8) -#define HW_RESERVED_WCID 222 -#elif defined(MAX_MBSSID_NUM) && (MAX_MBSSID_NUM == 7) -#define HW_RESERVED_WCID 238 -#else -#define HW_RESERVED_WCID 255 -#endif - -// Then dedicate wcid of DFS and Carrier-Sense. -#define DFS_CTS_WCID (HW_RESERVED_WCID - 1) -#define CS_CTS_WCID (HW_RESERVED_WCID - 2) -#define LAST_SPECIFIC_WCID (HW_RESERVED_WCID - 2) - -// If MAX_MBSSID_NUM is 8, the maximum available wcid for the associated STA is 211. -// If MAX_MBSSID_NUM is 7, the maximum available wcid for the associated STA is 228. -#define MAX_AVAILABLE_CLIENT_WCID (LAST_SPECIFIC_WCID - MAX_MBSSID_NUM - 1) - -// TX need WCID to find Cipher Key -// these wcid 212 ~ 219 are reserved for bc/mc packets if MAX_MBSSID_NUM is 8. -#define GET_GroupKey_WCID(__wcid, __bssidx) \ - { \ - __wcid = LAST_SPECIFIC_WCID - (MAX_MBSSID_NUM) + __bssidx; \ - } - -#define IsGroupKeyWCID(__wcid) (((__wcid) < LAST_SPECIFIC_WCID) && ((__wcid) >= (LAST_SPECIFIC_WCID - (MAX_MBSSID_NUM)))) - - -// definition to support multiple BSSID -#define BSS0 0 -#define BSS1 1 -#define BSS2 2 -#define BSS3 3 -#define BSS4 4 -#define BSS5 5 -#define BSS6 6 -#define BSS7 7 - - -//============================================================ -// Length definitions -#define PEER_KEY_NO 2 -#define MAC_ADDR_LEN 6 -#define TIMESTAMP_LEN 8 -#define MAX_LEN_OF_SUPPORTED_RATES MAX_LENGTH_OF_SUPPORT_RATES // 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 -#define MAX_NUM_OF_REGULATORY_CLASS 16 -#define MAX_LEN_OF_KEY 32 // 32 octets == 256 bits, Redefine for WPA -#define MAX_NUM_OF_CHANNELS MAX_NUM_OF_CHS // 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL termination -#define MAX_NUM_OF_11JCHANNELS 20 // 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL termination -#define MAX_LEN_OF_SSID 32 -#define CIPHER_TEXT_LEN 128 -#define HASH_TABLE_SIZE 256 -#define MAX_VIE_LEN 1024 // New for WPA cipher suite variable IE sizes. -#define MAX_SUPPORT_MCS 32 -#define MAX_NUM_OF_BBP_LATCH 140 -//============================================================ -// ASIC WCID Table definition. -//============================================================ -#define BSSID_WCID 1 // in infra mode, always put bssid with this WCID -#define MCAST_WCID 0x0 -#define BSS0Mcast_WCID 0x0 -#define BSS1Mcast_WCID 0xf8 -#define BSS2Mcast_WCID 0xf9 -#define BSS3Mcast_WCID 0xfa -#define BSS4Mcast_WCID 0xfb -#define BSS5Mcast_WCID 0xfc -#define BSS6Mcast_WCID 0xfd -#define BSS7Mcast_WCID 0xfe -#define RESERVED_WCID 0xff - -#define MAX_NUM_OF_ACL_LIST MAX_NUMBER_OF_ACL - -#define MAX_LEN_OF_MAC_TABLE MAX_NUMBER_OF_MAC // if MAX_MBSSID_NUM is 8, this value can't be larger than 211 - -#if MAX_LEN_OF_MAC_TABLE>MAX_AVAILABLE_CLIENT_WCID -#error MAX_LEN_OF_MAC_TABLE can not be larger than MAX_AVAILABLE_CLIENT_WCID!!!! -#endif - -#define MAX_NUM_OF_WDS_LINK_PERBSSID 3 -#define MAX_NUM_OF_WDS_LINK (MAX_NUM_OF_WDS_LINK_PERBSSID*MAX_MBSSID_NUM) -#define MAX_NUM_OF_EVENT MAX_NUMBER_OF_EVENT -#define WDS_LINK_START_WCID (MAX_LEN_OF_MAC_TABLE-1) - -#define NUM_OF_TID 8 -#define MAX_AID_BA 4 -#define MAX_LEN_OF_BA_REC_TABLE ((NUM_OF_TID * MAX_LEN_OF_MAC_TABLE)/2)// (NUM_OF_TID*MAX_AID_BA + 32) //Block ACK recipient -#define MAX_LEN_OF_BA_ORI_TABLE ((NUM_OF_TID * MAX_LEN_OF_MAC_TABLE)/2)// (NUM_OF_TID*MAX_AID_BA + 32) // Block ACK originator -#define MAX_LEN_OF_BSS_TABLE 64 -#define MAX_REORDERING_MPDU_NUM 512 - -// key related definitions -#define SHARE_KEY_NUM 4 -#define MAX_LEN_OF_SHARE_KEY 16 // byte count -#define MAX_LEN_OF_PEER_KEY 16 // byte count -#define PAIRWISE_KEY_NUM 64 // in MAC ASIC pairwise key table -#define GROUP_KEY_NUM 4 -#define PMK_LEN 32 -#define WDS_PAIRWISE_KEY_OFFSET 60 // WDS links uses pairwise key#60 ~ 63 in ASIC pairwise key table -#define PMKID_NO 4 // Number of PMKID saved supported -#define MAX_LEN_OF_MLME_BUFFER 2048 - -// power status related definitions -#define PWR_ACTIVE 0 -#define PWR_SAVE 1 -#define PWR_MMPS 2 //MIMO power save -//#define PWR_UNKNOWN 2 - -// Auth and Assoc mode related definitions -#define AUTH_MODE_OPEN 0x00 -#define AUTH_MODE_KEY 0x01 -//#define AUTH_MODE_AUTO_SWITCH 0x03 -//#define AUTH_MODE_DEAUTH 0x04 -//#define AUTH_MODE_UPLAYER 0x05 // reserved for 802.11i use - -// BSS Type definitions -#define BSS_ADHOC 0 // = Ndis802_11IBSS -#define BSS_INFRA 1 // = Ndis802_11Infrastructure -#define BSS_ANY 2 // = Ndis802_11AutoUnknown -#define BSS_MONITOR 3 // = Ndis802_11Monitor - - -// Reason code definitions -#define REASON_RESERVED 0 -#define REASON_UNSPECIFY 1 -#define REASON_NO_LONGER_VALID 2 -#define REASON_DEAUTH_STA_LEAVING 3 -#define REASON_DISASSOC_INACTIVE 4 -#define REASON_DISASSPC_AP_UNABLE 5 -#define REASON_CLS2ERR 6 -#define REASON_CLS3ERR 7 -#define REASON_DISASSOC_STA_LEAVING 8 -#define REASON_STA_REQ_ASSOC_NOT_AUTH 9 -#define REASON_INVALID_IE 13 -#define REASON_MIC_FAILURE 14 -#define REASON_4_WAY_TIMEOUT 15 -#define REASON_GROUP_KEY_HS_TIMEOUT 16 -#define REASON_IE_DIFFERENT 17 -#define REASON_MCIPHER_NOT_VALID 18 -#define REASON_UCIPHER_NOT_VALID 19 -#define REASON_AKMP_NOT_VALID 20 -#define REASON_UNSUPPORT_RSNE_VER 21 -#define REASON_INVALID_RSNE_CAP 22 -#define REASON_8021X_AUTH_FAIL 23 -#define REASON_CIPHER_SUITE_REJECTED 24 -#define REASON_DECLINED 37 - -#define REASON_QOS_UNSPECIFY 32 -#define REASON_QOS_LACK_BANDWIDTH 33 -#define REASON_POOR_CHANNEL_CONDITION 34 -#define REASON_QOS_OUTSIDE_TXOP_LIMITION 35 -#define REASON_QOS_QSTA_LEAVING_QBSS 36 -#define REASON_QOS_UNWANTED_MECHANISM 37 -#define REASON_QOS_MECH_SETUP_REQUIRED 38 -#define REASON_QOS_REQUEST_TIMEOUT 39 -#define REASON_QOS_CIPHER_NOT_SUPPORT 45 - -// Status code definitions -#define MLME_SUCCESS 0 -#define MLME_UNSPECIFY_FAIL 1 -#define MLME_CANNOT_SUPPORT_CAP 10 -#define MLME_REASSOC_DENY_ASSOC_EXIST 11 -#define MLME_ASSOC_DENY_OUT_SCOPE 12 -#define MLME_ALG_NOT_SUPPORT 13 -#define MLME_SEQ_NR_OUT_OF_SEQUENCE 14 -#define MLME_REJ_CHALLENGE_FAILURE 15 -#define MLME_REJ_TIMEOUT 16 -#define MLME_ASSOC_REJ_UNABLE_HANDLE_STA 17 -#define MLME_ASSOC_REJ_DATA_RATE 18 - -#define MLME_ASSOC_REJ_NO_EXT_RATE 22 -#define MLME_ASSOC_REJ_NO_EXT_RATE_PBCC 23 -#define MLME_ASSOC_REJ_NO_CCK_OFDM 24 - -#define MLME_QOS_UNSPECIFY 32 -#define MLME_REQUEST_DECLINED 37 -#define MLME_REQUEST_WITH_INVALID_PARAM 38 -#define MLME_INVALID_GROUP_CIPHER 41 -#define MLME_INVALID_PAIRWISE_CIPHER 42 -#define MLME_INVALID_AKMP 43 -#define MLME_DLS_NOT_ALLOW_IN_QBSS 48 -#define MLME_DEST_STA_NOT_IN_QBSS 49 -#define MLME_DEST_STA_IS_NOT_A_QSTA 50 - -#define MLME_INVALID_FORMAT 0x51 -#define MLME_FAIL_NO_RESOURCE 0x52 -#define MLME_STATE_MACHINE_REJECT 0x53 -#define MLME_MAC_TABLE_FAIL 0x54 - -// IE code -#define IE_SSID 0 -#define IE_SUPP_RATES 1 -#define IE_FH_PARM 2 -#define IE_DS_PARM 3 -#define IE_CF_PARM 4 -#define IE_TIM 5 -#define IE_IBSS_PARM 6 -#define IE_COUNTRY 7 // 802.11d -#define IE_802_11D_REQUEST 10 // 802.11d -#define IE_QBSS_LOAD 11 // 802.11e d9 -#define IE_EDCA_PARAMETER 12 // 802.11e d9 -#define IE_TSPEC 13 // 802.11e d9 -#define IE_TCLAS 14 // 802.11e d9 -#define IE_SCHEDULE 15 // 802.11e d9 -#define IE_CHALLENGE_TEXT 16 -#define IE_POWER_CONSTRAINT 32 // 802.11h d3.3 -#define IE_POWER_CAPABILITY 33 // 802.11h d3.3 -#define IE_TPC_REQUEST 34 // 802.11h d3.3 -#define IE_TPC_REPORT 35 // 802.11h d3.3 -#define IE_SUPP_CHANNELS 36 // 802.11h d3.3 -#define IE_CHANNEL_SWITCH_ANNOUNCEMENT 37 // 802.11h d3.3 -#define IE_MEASUREMENT_REQUEST 38 // 802.11h d3.3 -#define IE_MEASUREMENT_REPORT 39 // 802.11h d3.3 -#define IE_QUIET 40 // 802.11h d3.3 -#define IE_IBSS_DFS 41 // 802.11h d3.3 -#define IE_ERP 42 // 802.11g -#define IE_TS_DELAY 43 // 802.11e d9 -#define IE_TCLAS_PROCESSING 44 // 802.11e d9 -#define IE_QOS_CAPABILITY 46 // 802.11e d6 -#define IE_HT_CAP 45 // 802.11n d1. HT CAPABILITY. ELEMENT ID TBD -#define IE_AP_CHANNEL_REPORT 51 // 802.11k d6 -#define IE_HT_CAP2 52 // 802.11n d1. HT CAPABILITY. ELEMENT ID TBD -#define IE_RSN 48 // 802.11i d3.0 -#define IE_WPA2 48 // WPA2 -#define IE_EXT_SUPP_RATES 50 // 802.11g -#define IE_SUPP_REG_CLASS 59 // 802.11y. Supported regulatory classes. -#define IE_EXT_CHANNEL_SWITCH_ANNOUNCEMENT 60 // 802.11n -#define IE_ADD_HT 61 // 802.11n d1. ADDITIONAL HT CAPABILITY. ELEMENT ID TBD -#define IE_ADD_HT2 53 // 802.11n d1. ADDITIONAL HT CAPABILITY. ELEMENT ID TBD - - -// For 802.11n D3.03 -//#define IE_NEW_EXT_CHA_OFFSET 62 // 802.11n d1. New extension channel offset elemet -#define IE_SECONDARY_CH_OFFSET 62 // 802.11n D3.03 Secondary Channel Offset element -#define IE_WAPI 68 // WAPI information element -#define IE_2040_BSS_COEXIST 72 // 802.11n D3.0.3 -#define IE_2040_BSS_INTOLERANT_REPORT 73 // 802.11n D3.03 -#define IE_OVERLAPBSS_SCAN_PARM 74 // 802.11n D3.03 -#define IE_EXT_CAPABILITY 127 // 802.11n D3.03 - - -#define IE_WPA 221 // WPA -#define IE_VENDOR_SPECIFIC 221 // Wifi WMM (WME) - -#define OUI_BROADCOM_HT 51 // -#define OUI_BROADCOM_HTADD 52 // -#define OUI_PREN_HT_CAP 51 // -#define OUI_PREN_ADD_HT 52 // - -// CCX information -#define IE_AIRONET_CKIP 133 // CCX1.0 ID 85H for CKIP -#define IE_AP_TX_POWER 150 // CCX 2.0 for AP transmit power -#define IE_MEASUREMENT_CAPABILITY 221 // CCX 2.0 -#define IE_CCX_V2 221 -#define IE_AIRONET_IPADDRESS 149 // CCX ID 95H for IP Address -#define IE_AIRONET_CCKMREASSOC 156 // CCX ID 9CH for CCKM Reassociation Request element -#define CKIP_NEGOTIATION_LENGTH 30 -#define AIRONET_IPADDRESS_LENGTH 10 -#define AIRONET_CCKMREASSOC_LENGTH 24 - -// ======================================================== -// MLME state machine definition -// ======================================================== - -// STA MLME state mahcines -#define ASSOC_STATE_MACHINE 1 -#define AUTH_STATE_MACHINE 2 -#define AUTH_RSP_STATE_MACHINE 3 -#define SYNC_STATE_MACHINE 4 -#define MLME_CNTL_STATE_MACHINE 5 -#define WPA_PSK_STATE_MACHINE 6 -//#define LEAP_STATE_MACHINE 7 -#define AIRONET_STATE_MACHINE 8 -#define ACTION_STATE_MACHINE 9 - -// AP MLME state machines -#define AP_ASSOC_STATE_MACHINE 11 -#define AP_AUTH_STATE_MACHINE 12 -#define AP_SYNC_STATE_MACHINE 14 -#define AP_CNTL_STATE_MACHINE 15 -#define WSC_STATE_MACHINE 17 -#define WSC_UPNP_STATE_MACHINE 18 - - -#define WPA_STATE_MACHINE 23 - - -#ifdef QOS_DLS_SUPPORT -#define DLS_STATE_MACHINE 26 -#endif // QOS_DLS_SUPPORT // - -// -// STA's CONTROL/CONNECT state machine: states, events, total function # -// -#define CNTL_IDLE 0 -#define CNTL_WAIT_DISASSOC 1 -#define CNTL_WAIT_JOIN 2 -#define CNTL_WAIT_REASSOC 3 -#define CNTL_WAIT_START 4 -#define CNTL_WAIT_AUTH 5 -#define CNTL_WAIT_ASSOC 6 -#define CNTL_WAIT_AUTH2 7 -#define CNTL_WAIT_OID_LIST_SCAN 8 -#define CNTL_WAIT_OID_DISASSOC 9 - -#define MT2_ASSOC_CONF 34 -#define MT2_AUTH_CONF 35 -#define MT2_DEAUTH_CONF 36 -#define MT2_DISASSOC_CONF 37 -#define MT2_REASSOC_CONF 38 -#define MT2_PWR_MGMT_CONF 39 -#define MT2_JOIN_CONF 40 -#define MT2_SCAN_CONF 41 -#define MT2_START_CONF 42 -#define MT2_GET_CONF 43 -#define MT2_SET_CONF 44 -#define MT2_RESET_CONF 45 -#define MT2_FT_OTD_CONF 46 -#define MT2_MLME_ROAMING_REQ 52 - -#define CNTL_FUNC_SIZE 1 - -// -// STA's ASSOC state machine: states, events, total function # -// -#define ASSOC_IDLE 0 -#define ASSOC_WAIT_RSP 1 -#define REASSOC_WAIT_RSP 2 -#define DISASSOC_WAIT_RSP 3 -#define MAX_ASSOC_STATE 4 - -#define ASSOC_MACHINE_BASE 0 -#define MT2_MLME_ASSOC_REQ 0 -#define MT2_MLME_REASSOC_REQ 1 -#define MT2_MLME_DISASSOC_REQ 2 -#define MT2_PEER_DISASSOC_REQ 3 -#define MT2_PEER_ASSOC_REQ 4 -#define MT2_PEER_ASSOC_RSP 5 -#define MT2_PEER_REASSOC_REQ 6 -#define MT2_PEER_REASSOC_RSP 7 -#define MT2_DISASSOC_TIMEOUT 8 -#define MT2_ASSOC_TIMEOUT 9 -#define MT2_REASSOC_TIMEOUT 10 -#define MAX_ASSOC_MSG 11 - -#define ASSOC_FUNC_SIZE (MAX_ASSOC_STATE * MAX_ASSOC_MSG) - -// -// ACT state machine: states, events, total function # -// -#define ACT_IDLE 0 -#define MAX_ACT_STATE 1 - -#define ACT_MACHINE_BASE 0 - -//Those PEER_xx_CATE number is based on real Categary value in IEEE spec. Please don'es modify it by your self. -//Category -#define MT2_PEER_SPECTRUM_CATE 0 -#define MT2_PEER_QOS_CATE 1 -#define MT2_PEER_DLS_CATE 2 -#define MT2_PEER_BA_CATE 3 -#define MT2_PEER_PUBLIC_CATE 4 -#define MT2_PEER_RM_CATE 5 -/* "FT_CATEGORY_BSS_TRANSITION equal to 6" is defined file of "dot11r_ft.h" */ -#define MT2_PEER_HT_CATE 7 // 7.4.7 -#define MAX_PEER_CATE_MSG 7 - - -#define MT2_MLME_ADD_BA_CATE 8 -#define MT2_MLME_ORI_DELBA_CATE 9 -#define MT2_MLME_REC_DELBA_CATE 10 -#define MT2_MLME_QOS_CATE 11 -#define MT2_MLME_DLS_CATE 12 -#define MT2_ACT_INVALID 13 - -#define MAX_ACT_MSG 14 - - -//Category field -#define CATEGORY_SPECTRUM 0 -#define CATEGORY_QOS 1 -#define CATEGORY_DLS 2 -#define CATEGORY_BA 3 -#define CATEGORY_PUBLIC 4 -#define CATEGORY_RM 5 -#define CATEGORY_HT 7 - - -// DLS Action frame definition -#define ACTION_DLS_REQUEST 0 -#define ACTION_DLS_RESPONSE 1 -#define ACTION_DLS_TEARDOWN 2 - -//Spectrum Action field value 802.11h 7.4.1 -#define SPEC_MRQ 0 // Request -#define SPEC_MRP 1 //Report -#define SPEC_TPCRQ 2 -#define SPEC_TPCRP 3 -#define SPEC_CHANNEL_SWITCH 4 - - -//BA Action field value -#define ADDBA_REQ 0 -#define ADDBA_RESP 1 -#define DELBA 2 - -//Public's Action field value in Public Category. Some in 802.11y and some in 11n -#define ACTION_BSS_2040_COEXIST 0 // 11n -#define ACTION_DSE_ENABLEMENT 1 // 11y D9.0 -#define ACTION_DSE_DEENABLEMENT 2 // 11y D9.0 -#define ACTION_DSE_REG_LOCATION_ANNOUNCE 3 // 11y D9.0 -#define ACTION_EXT_CH_SWITCH_ANNOUNCE 4 // 11y D9.0 -#define ACTION_DSE_MEASUREMENT_REQ 5 // 11y D9.0 -#define ACTION_DSE_MEASUREMENT_REPORT 6 // 11y D9.0 -#define ACTION_MEASUREMENT_PILOT_ACTION 7 // 11y D9.0 -#define ACTION_DSE_POWER_CONSTRAINT 8 // 11y D9.0 - - -//HT Action field value -#define NOTIFY_BW_ACTION 0 -#define SMPS_ACTION 1 -#define PSMP_ACTION 2 -#define SETPCO_ACTION 3 -#define MIMO_CHA_MEASURE_ACTION 4 -#define MIMO_N_BEACONFORM 5 -#define MIMO_BEACONFORM 6 -#define ANTENNA_SELECT 7 -#define HT_INFO_EXCHANGE 8 - -#define ACT_FUNC_SIZE (MAX_ACT_STATE * MAX_ACT_MSG) -// -// STA's AUTHENTICATION state machine: states, evvents, total function # -// -#define AUTH_REQ_IDLE 0 -#define AUTH_WAIT_SEQ2 1 -#define AUTH_WAIT_SEQ4 2 -#define MAX_AUTH_STATE 3 - -#define AUTH_MACHINE_BASE 0 -#define MT2_MLME_AUTH_REQ 0 -#define MT2_PEER_AUTH_EVEN 1 -#define MT2_AUTH_TIMEOUT 2 -#define MAX_AUTH_MSG 3 - -#define AUTH_FUNC_SIZE (MAX_AUTH_STATE * MAX_AUTH_MSG) - -// -// STA's AUTH_RSP state machine: states, events, total function # -// -#define AUTH_RSP_IDLE 0 -#define AUTH_RSP_WAIT_CHAL 1 -#define MAX_AUTH_RSP_STATE 2 - -#define AUTH_RSP_MACHINE_BASE 0 -#define MT2_AUTH_CHALLENGE_TIMEOUT 0 -#define MT2_PEER_AUTH_ODD 1 -#define MT2_PEER_DEAUTH 2 -#define MAX_AUTH_RSP_MSG 3 - -#define AUTH_RSP_FUNC_SIZE (MAX_AUTH_RSP_STATE * MAX_AUTH_RSP_MSG) - -// -// STA's SYNC state machine: states, events, total function # -// -#define SYNC_IDLE 0 // merge NO_BSS,IBSS_IDLE,IBSS_ACTIVE and BSS in to 1 state -#define JOIN_WAIT_BEACON 1 -#define SCAN_LISTEN 2 -#define MAX_SYNC_STATE 3 - -#define SYNC_MACHINE_BASE 0 -#define MT2_MLME_SCAN_REQ 0 -#define MT2_MLME_JOIN_REQ 1 -#define MT2_MLME_START_REQ 2 -#define MT2_PEER_BEACON 3 -#define MT2_PEER_PROBE_RSP 4 -#define MT2_PEER_ATIM 5 -#define MT2_SCAN_TIMEOUT 6 -#define MT2_BEACON_TIMEOUT 7 -#define MT2_ATIM_TIMEOUT 8 -#define MT2_PEER_PROBE_REQ 9 -#define MAX_SYNC_MSG 10 - -#define SYNC_FUNC_SIZE (MAX_SYNC_STATE * MAX_SYNC_MSG) - -//Messages for the DLS state machine -#define DLS_IDLE 0 -#define MAX_DLS_STATE 1 - -#define DLS_MACHINE_BASE 0 -#define MT2_MLME_DLS_REQ 0 -#define MT2_PEER_DLS_REQ 1 -#define MT2_PEER_DLS_RSP 2 -#define MT2_MLME_DLS_TEAR_DOWN 3 -#define MT2_PEER_DLS_TEAR_DOWN 4 -#define MAX_DLS_MSG 5 - -#define DLS_FUNC_SIZE (MAX_DLS_STATE * MAX_DLS_MSG) - -// -// WSC State machine: states, events, total function # -// - -// -// AP's CONTROL/CONNECT state machine: states, events, total function # -// -#define AP_CNTL_FUNC_SIZE 1 - -// -// AP's ASSOC state machine: states, events, total function # -// -#define AP_ASSOC_IDLE 0 -#define AP_MAX_ASSOC_STATE 1 - -#define AP_ASSOC_MACHINE_BASE 0 -#define APMT2_MLME_DISASSOC_REQ 0 -#define APMT2_PEER_DISASSOC_REQ 1 -#define APMT2_PEER_ASSOC_REQ 2 -#define APMT2_PEER_REASSOC_REQ 3 -#define APMT2_CLS3ERR 4 -#define AP_MAX_ASSOC_MSG 5 - -#define AP_ASSOC_FUNC_SIZE (AP_MAX_ASSOC_STATE * AP_MAX_ASSOC_MSG) - -// -// AP's AUTHENTICATION state machine: states, events, total function # -// -#define AP_AUTH_REQ_IDLE 0 -#define AP_MAX_AUTH_STATE 1 - -#define AP_AUTH_MACHINE_BASE 0 -#define APMT2_MLME_DEAUTH_REQ 0 -#define APMT2_CLS2ERR 1 -#define APMT2_PEER_DEAUTH 2 -#define APMT2_PEER_AUTH_REQ 3 -#define APMT2_PEER_AUTH_CONFIRM 4 -#define AP_MAX_AUTH_MSG 5 - -#define AP_AUTH_FUNC_SIZE (AP_MAX_AUTH_STATE * AP_MAX_AUTH_MSG) - -// -// AP's SYNC state machine: states, events, total function # -// -#define AP_SYNC_IDLE 0 -#define AP_SCAN_LISTEN 1 -#define AP_MAX_SYNC_STATE 2 - -#define AP_SYNC_MACHINE_BASE 0 -#define APMT2_PEER_PROBE_REQ 0 -#define APMT2_PEER_BEACON 1 -#define APMT2_MLME_SCAN_REQ 2 -#define APMT2_PEER_PROBE_RSP 3 -#define APMT2_SCAN_TIMEOUT 4 -#define APMT2_MLME_SCAN_CNCL 5 -#define AP_MAX_SYNC_MSG 6 - -#define AP_SYNC_FUNC_SIZE (AP_MAX_SYNC_STATE * AP_MAX_SYNC_MSG) - -// -// Common WPA state machine: states, events, total function # -// -#define WPA_PTK 0 -#define MAX_WPA_PTK_STATE 1 - -#define WPA_MACHINE_BASE 0 -#define MT2_EAPPacket 0 -#define MT2_EAPOLStart 1 -#define MT2_EAPOLLogoff 2 -#define MT2_EAPOLKey 3 -#define MT2_EAPOLASFAlert 4 -#define MAX_WPA_MSG 5 - -#define WPA_FUNC_SIZE (MAX_WPA_PTK_STATE * MAX_WPA_MSG) - -#ifdef APCLI_SUPPORT -//ApCli authentication state machine -#define APCLI_AUTH_REQ_IDLE 0 -#define APCLI_AUTH_WAIT_SEQ2 1 -#define APCLI_AUTH_WAIT_SEQ4 2 -#define APCLI_MAX_AUTH_STATE 3 - -#define APCLI_AUTH_MACHINE_BASE 0 -#define APCLI_MT2_MLME_AUTH_REQ 0 -#define APCLI_MT2_MLME_DEAUTH_REQ 1 -#define APCLI_MT2_PEER_AUTH_EVEN 2 -#define APCLI_MT2_PEER_DEAUTH 3 -#define APCLI_MT2_AUTH_TIMEOUT 4 -#define APCLI_MAX_AUTH_MSG 5 - -#define APCLI_AUTH_FUNC_SIZE (APCLI_MAX_AUTH_STATE * APCLI_MAX_AUTH_MSG) - -//ApCli association state machine -#define APCLI_ASSOC_IDLE 0 -#define APCLI_ASSOC_WAIT_RSP 1 -#define APCLI_MAX_ASSOC_STATE 2 - -#define APCLI_ASSOC_MACHINE_BASE 0 -#define APCLI_MT2_MLME_ASSOC_REQ 0 -#define APCLI_MT2_MLME_DISASSOC_REQ 1 -#define APCLI_MT2_PEER_DISASSOC_REQ 2 -#define APCLI_MT2_PEER_ASSOC_RSP 3 -#define APCLI_MT2_ASSOC_TIMEOUT 4 -#define APCLI_MAX_ASSOC_MSG 5 - -#define APCLI_ASSOC_FUNC_SIZE (APCLI_MAX_ASSOC_STATE * APCLI_MAX_ASSOC_MSG) - -//ApCli sync state machine -#define APCLI_SYNC_IDLE 0 // merge NO_BSS,IBSS_IDLE,IBSS_ACTIVE and BSS in to 1 state -#define APCLI_JOIN_WAIT_PROBE_RSP 1 -#define APCLI_MAX_SYNC_STATE 2 - -#define APCLI_SYNC_MACHINE_BASE 0 -#define APCLI_MT2_MLME_PROBE_REQ 0 -#define APCLI_MT2_PEER_PROBE_RSP 1 -#define APCLI_MT2_PROBE_TIMEOUT 2 -#define APCLI_MAX_SYNC_MSG 3 - -#define APCLI_SYNC_FUNC_SIZE (APCLI_MAX_SYNC_STATE * APCLI_MAX_SYNC_MSG) - -//ApCli ctrl state machine -#define APCLI_CTRL_DISCONNECTED 0 // merge NO_BSS,IBSS_IDLE,IBSS_ACTIVE and BSS in to 1 state -#define APCLI_CTRL_PROBE 1 -#define APCLI_CTRL_AUTH 2 -#define APCLI_CTRL_AUTH_2 3 -#define APCLI_CTRL_ASSOC 4 -#define APCLI_CTRL_DEASSOC 5 -#define APCLI_CTRL_CONNECTED 6 -#define APCLI_MAX_CTRL_STATE 7 - -#define APCLI_CTRL_MACHINE_BASE 0 -#define APCLI_CTRL_JOIN_REQ 0 -#define APCLI_CTRL_PROBE_RSP 1 -#define APCLI_CTRL_AUTH_RSP 2 -#define APCLI_CTRL_DISCONNECT_REQ 3 -#define APCLI_CTRL_PEER_DISCONNECT_REQ 4 -#define APCLI_CTRL_ASSOC_RSP 5 -#define APCLI_CTRL_DEASSOC_RSP 6 -#define APCLI_CTRL_JOIN_REQ_TIMEOUT 7 -#define APCLI_CTRL_AUTH_REQ_TIMEOUT 8 -#define APCLI_CTRL_ASSOC_REQ_TIMEOUT 9 -#define APCLI_MAX_CTRL_MSG 10 - -#define APCLI_CTRL_FUNC_SIZE (APCLI_MAX_CTRL_STATE * APCLI_MAX_CTRL_MSG) - - -#endif // APCLI_SUPPORT // - - -// ============================================================================= - -// value domain of 802.11 header FC.Tyte, which is b3..b2 of the 1st-byte of MAC header -#define BTYPE_MGMT 0 -#define BTYPE_CNTL 1 -#define BTYPE_DATA 2 - -// value domain of 802.11 MGMT frame's FC.subtype, which is b7..4 of the 1st-byte of MAC header -#define SUBTYPE_ASSOC_REQ 0 -#define SUBTYPE_ASSOC_RSP 1 -#define SUBTYPE_REASSOC_REQ 2 -#define SUBTYPE_REASSOC_RSP 3 -#define SUBTYPE_PROBE_REQ 4 -#define SUBTYPE_PROBE_RSP 5 -#define SUBTYPE_BEACON 8 -#define SUBTYPE_ATIM 9 -#define SUBTYPE_DISASSOC 10 -#define SUBTYPE_AUTH 11 -#define SUBTYPE_DEAUTH 12 -#define SUBTYPE_ACTION 13 -#define SUBTYPE_ACTION_NO_ACK 14 - -// value domain of 802.11 CNTL frame's FC.subtype, which is b7..4 of the 1st-byte of MAC header -#define SUBTYPE_WRAPPER 7 -#define SUBTYPE_BLOCK_ACK_REQ 8 -#define SUBTYPE_BLOCK_ACK 9 -#define SUBTYPE_PS_POLL 10 -#define SUBTYPE_RTS 11 -#define SUBTYPE_CTS 12 -#define SUBTYPE_ACK 13 -#define SUBTYPE_CFEND 14 -#define SUBTYPE_CFEND_CFACK 15 - -// value domain of 802.11 DATA frame's FC.subtype, which is b7..4 of the 1st-byte of MAC header -#define SUBTYPE_DATA 0 -#define SUBTYPE_DATA_CFACK 1 -#define SUBTYPE_DATA_CFPOLL 2 -#define SUBTYPE_DATA_CFACK_CFPOLL 3 -#define SUBTYPE_NULL_FUNC 4 -#define SUBTYPE_CFACK 5 -#define SUBTYPE_CFPOLL 6 -#define SUBTYPE_CFACK_CFPOLL 7 -#define SUBTYPE_QDATA 8 -#define SUBTYPE_QDATA_CFACK 9 -#define SUBTYPE_QDATA_CFPOLL 10 -#define SUBTYPE_QDATA_CFACK_CFPOLL 11 -#define SUBTYPE_QOS_NULL 12 -#define SUBTYPE_QOS_CFACK 13 -#define SUBTYPE_QOS_CFPOLL 14 -#define SUBTYPE_QOS_CFACK_CFPOLL 15 - -// ACK policy of QOS Control field bit 6:5 -#define NORMAL_ACK 0x00 // b6:5 = 00 -#define NO_ACK 0x20 // b6:5 = 01 -#define NO_EXPLICIT_ACK 0x40 // b6:5 = 10 -#define BLOCK_ACK 0x60 // b6:5 = 11 - -// -// rtmp_data.c use these definition -// -#define LENGTH_802_11 24 -#define LENGTH_802_11_AND_H 30 -#define LENGTH_802_11_CRC_H 34 -#define LENGTH_802_11_CRC 28 -#define LENGTH_802_11_WITH_ADDR4 30 -#define LENGTH_802_3 14 -#define LENGTH_802_3_TYPE 2 -#define LENGTH_802_1_H 8 -#define LENGTH_EAPOL_H 4 -#define LENGTH_WMMQOS_H 2 -#define LENGTH_CRC 4 -#define MAX_SEQ_NUMBER 0x0fff -#define LENGTH_802_3_NO_TYPE 12 -#define LENGTH_802_1Q 4 /* VLAN related */ - -// STA_CSR4.field.TxResult -#define TX_RESULT_SUCCESS 0 -#define TX_RESULT_ZERO_LENGTH 1 -#define TX_RESULT_UNDER_RUN 2 -#define TX_RESULT_OHY_ERROR 4 -#define TX_RESULT_RETRY_FAIL 6 - -// All PHY rate summary in TXD -// Preamble MODE in TxD -#define MODE_CCK 0 -#define MODE_OFDM 1 -#ifdef DOT11_N_SUPPORT -#define MODE_HTMIX 2 -#define MODE_HTGREENFIELD 3 -#endif // DOT11_N_SUPPORT // -// MCS for CCK. BW.SGI.STBC are reserved -#define MCS_LONGP_RATE_1 0 // long preamble CCK 1Mbps -#define MCS_LONGP_RATE_2 1 // long preamble CCK 1Mbps -#define MCS_LONGP_RATE_5_5 2 -#define MCS_LONGP_RATE_11 3 -#define MCS_SHORTP_RATE_1 4 // long preamble CCK 1Mbps. short is forbidden in 1Mbps -#define MCS_SHORTP_RATE_2 5 // short preamble CCK 2Mbps -#define MCS_SHORTP_RATE_5_5 6 -#define MCS_SHORTP_RATE_11 7 -// To send duplicate legacy OFDM. set BW=BW_40. SGI.STBC are reserved -#define MCS_RATE_6 0 // legacy OFDM -#define MCS_RATE_9 1 // OFDM -#define MCS_RATE_12 2 // OFDM -#define MCS_RATE_18 3 // OFDM -#define MCS_RATE_24 4 // OFDM -#define MCS_RATE_36 5 // OFDM -#define MCS_RATE_48 6 // OFDM -#define MCS_RATE_54 7 // OFDM -// HT -#define MCS_0 0 // 1S -#define MCS_1 1 -#define MCS_2 2 -#define MCS_3 3 -#define MCS_4 4 -#define MCS_5 5 -#define MCS_6 6 -#define MCS_7 7 -#define MCS_8 8 // 2S -#define MCS_9 9 -#define MCS_10 10 -#define MCS_11 11 -#define MCS_12 12 -#define MCS_13 13 -#define MCS_14 14 -#define MCS_15 15 -#define MCS_16 16 // 3*3 -#define MCS_17 17 -#define MCS_18 18 -#define MCS_19 19 -#define MCS_20 20 -#define MCS_21 21 -#define MCS_22 22 -#define MCS_23 23 -#define MCS_32 32 -#define MCS_AUTO 33 - -#ifdef DOT11_N_SUPPORT -// OID_HTPHYMODE -// MODE -#define HTMODE_MM 0 -#define HTMODE_GF 1 -#endif // DOT11_N_SUPPORT // - -// Fixed Tx MODE - HT, CCK or OFDM -#define FIXED_TXMODE_HT 0 -#define FIXED_TXMODE_CCK 1 -#define FIXED_TXMODE_OFDM 2 -// BW -#define BW_20 BAND_WIDTH_20 -#define BW_40 BAND_WIDTH_40 -#define BW_BOTH BAND_WIDTH_BOTH -#define BW_10 BAND_WIDTH_10 // 802.11j has 10MHz. This definition is for internal usage. doesn't fill in the IE or other field. - -#ifdef DOT11_N_SUPPORT -// SHORTGI -#define GI_400 GAP_INTERVAL_400 // only support in HT mode -#define GI_BOTH GAP_INTERVAL_BOTH -#endif // DOT11_N_SUPPORT // -#define GI_800 GAP_INTERVAL_800 -// STBC -#define STBC_NONE 0 -#ifdef DOT11_N_SUPPORT -#define STBC_USE 1 // limited use in rt2860b phy -#define RXSTBC_ONE 1 // rx support of one spatial stream -#define RXSTBC_TWO 2 // rx support of 1 and 2 spatial stream -#define RXSTBC_THR 3 // rx support of 1~3 spatial stream -// MCS FEEDBACK -#define MCSFBK_NONE 0 // not support mcs feedback / -#define MCSFBK_RSV 1 // reserved -#define MCSFBK_UNSOLICIT 2 // only support unsolict mcs feedback -#define MCSFBK_MRQ 3 // response to both MRQ and unsolict mcs feedback - -// MIMO power safe -#define MMPS_STATIC 0 -#define MMPS_DYNAMIC 1 -#define MMPS_RSV 2 -#define MMPS_ENABLE 3 - - -// A-MSDU size -#define AMSDU_0 0 -#define AMSDU_1 1 - -#endif // DOT11_N_SUPPORT // - -// MCS use 7 bits -#define TXRATEMIMO 0x80 -#define TXRATEMCS 0x7F -#define TXRATEOFDM 0x7F -#define RATE_1 0 -#define RATE_2 1 -#define RATE_5_5 2 -#define RATE_11 3 -#define RATE_6 4 // OFDM -#define RATE_9 5 // OFDM -#define RATE_12 6 // OFDM -#define RATE_18 7 // OFDM -#define RATE_24 8 // OFDM -#define RATE_36 9 // OFDM -#define RATE_48 10 // OFDM -#define RATE_54 11 // OFDM -#define RATE_FIRST_OFDM_RATE RATE_6 -#define RATE_LAST_OFDM_RATE RATE_54 -#define RATE_6_5 12 // HT mix -#define RATE_13 13 // HT mix -#define RATE_19_5 14 // HT mix -#define RATE_26 15 // HT mix -#define RATE_39 16 // HT mix -#define RATE_52 17 // HT mix -#define RATE_58_5 18 // HT mix -#define RATE_65 19 // HT mix -#define RATE_78 20 // HT mix -#define RATE_104 21 // HT mix -#define RATE_117 22 // HT mix -#define RATE_130 23 // HT mix -//#define RATE_AUTO_SWITCH 255 // for StaCfg.FixedTxRate only -#define HTRATE_0 12 -#define RATE_FIRST_MM_RATE HTRATE_0 -#define RATE_FIRST_HT_RATE HTRATE_0 -#define RATE_LAST_HT_RATE HTRATE_0 - -// pTxWI->txop -#define IFS_HTTXOP 0 // The txop will be handles by ASIC. -#define IFS_PIFS 1 -#define IFS_SIFS 2 -#define IFS_BACKOFF 3 - -// pTxD->RetryMode -#define LONG_RETRY 1 -#define SHORT_RETRY 0 - -// Country Region definition -#define REGION_MINIMUM_BG_BAND 0 -#define REGION_0_BG_BAND 0 // 1-11 -#define REGION_1_BG_BAND 1 // 1-13 -#define REGION_2_BG_BAND 2 // 10-11 -#define REGION_3_BG_BAND 3 // 10-13 -#define REGION_4_BG_BAND 4 // 14 -#define REGION_5_BG_BAND 5 // 1-14 -#define REGION_6_BG_BAND 6 // 3-9 -#define REGION_7_BG_BAND 7 // 5-13 -#define REGION_31_BG_BAND 31 // 5-13 -#define REGION_MAXIMUM_BG_BAND 7 - -#define REGION_MINIMUM_A_BAND 0 -#define REGION_0_A_BAND 0 // 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165 -#define REGION_1_A_BAND 1 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 -#define REGION_2_A_BAND 2 // 36, 40, 44, 48, 52, 56, 60, 64 -#define REGION_3_A_BAND 3 // 52, 56, 60, 64, 149, 153, 157, 161 -#define REGION_4_A_BAND 4 // 149, 153, 157, 161, 165 -#define REGION_5_A_BAND 5 // 149, 153, 157, 161 -#define REGION_6_A_BAND 6 // 36, 40, 44, 48 -#define REGION_7_A_BAND 7 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173 -#define REGION_8_A_BAND 8 // 52, 56, 60, 64 -#define REGION_9_A_BAND 9 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165 -#define REGION_10_A_BAND 10 // 36, 40, 44, 48, 149, 153, 157, 161, 165 -#define REGION_11_A_BAND 11 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 149, 153, 157, 161 -#define REGION_12_A_BAND 12 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 -#define REGION_13_A_BAND 13 // 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161 -#define REGION_14_A_BAND 14 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 136, 140, 149, 153, 157, 161, 165 -#define REGION_15_A_BAND 15 // 149, 153, 157, 161, 165, 169, 173 -#define REGION_MAXIMUM_A_BAND 15 - -// pTxD->CipherAlg -#define CIPHER_NONE 0 -#define CIPHER_WEP64 1 -#define CIPHER_WEP128 2 -#define CIPHER_TKIP 3 -#define CIPHER_AES 4 -#define CIPHER_CKIP64 5 -#define CIPHER_CKIP128 6 -#define CIPHER_TKIP_NO_MIC 7 // MIC appended by driver: not a valid value in hardware key table -#define CIPHER_SMS4 8 - - -// LED Status. -#define LED_LINK_DOWN 0 -#define LED_LINK_UP 1 -#define LED_RADIO_OFF 2 -#define LED_RADIO_ON 3 -#define LED_HALT 4 -#define LED_WPS 5 -#define LED_ON_SITE_SURVEY 6 -#define LED_POWER_UP 7 - - -// value domain of pAd->LedCntl.LedMode and E2PROM -#define LED_MODE_DEFAULT 0 -#define LED_MODE_TWO_LED 1 -//#define LED_MODE_SIGNAL_STREGTH 8 // EEPROM define =8 -#define LED_MODE_SIGNAL_STREGTH 0x40 // EEPROM define = 64 - -// RC4 init value, used fro WEP & TKIP -#define PPPINITFCS32 0xffffffff /* Initial FCS value */ - -// value domain of pAd->StaCfg.PortSecured. 802.1X controlled port definition -#define WPA_802_1X_PORT_SECURED 1 -#define WPA_802_1X_PORT_NOT_SECURED 2 - -#define PAIRWISE_KEY 1 -#define GROUP_KEY 2 - -//definition of DRS -#define MAX_STEP_OF_TX_RATE_SWITCH 32 - - -// pre-allocated free NDIS PACKET/BUFFER poll for internal usage -#define MAX_NUM_OF_FREE_NDIS_PACKET 128 - -//Block ACK -#define MAX_TX_REORDERBUF 64 -#define MAX_RX_REORDERBUF 64 -#define DEFAULT_TX_TIMEOUT 30 -#define DEFAULT_RX_TIMEOUT 30 - -// definition of Recipient or Originator -#define I_RECIPIENT TRUE -#define I_ORIGINATOR FALSE - -#define DEFAULT_BBP_TX_POWER 0 -#define DEFAULT_RF_TX_POWER 5 - -#define MAX_INI_BUFFER_SIZE 4096 -#define MAX_PARAM_BUFFER_SIZE (2048) // enough for ACL (18*64) - //18 : the length of Mac address acceptable format "01:02:03:04:05:06;") - //64 : MAX_NUM_OF_ACL_LIST -// definition of pAd->OpMode -#define OPMODE_STA 0 -#define OPMODE_AP 1 -//#define OPMODE_L3_BRG 2 // as AP and STA at the same time - -#ifdef RT_BIG_ENDIAN -#define DIR_READ 0 -#define DIR_WRITE 1 -#define TYPE_TXD 0 -#define TYPE_RXD 1 -#define TYPE_TXINFO 0 -#define TYPE_RXINFO 1 -#define TYPE_TXWI 0 -#define TYPE_RXWI 1 -#endif - -// ========================= AP rtmp_def.h =========================== -// value domain for pAd->EventTab.Log[].Event -#define EVENT_RESET_ACCESS_POINT 0 // Log = "hh:mm:ss Restart Access Point" -#define EVENT_ASSOCIATED 1 // Log = "hh:mm:ss STA 00:01:02:03:04:05 associated" -#define EVENT_DISASSOCIATED 2 // Log = "hh:mm:ss STA 00:01:02:03:04:05 left this BSS" -#define EVENT_AGED_OUT 3 // Log = "hh:mm:ss STA 00:01:02:03:04:05 was aged-out and removed from this BSS" -#define EVENT_COUNTER_M 4 -#define EVENT_INVALID_PSK 5 -#define EVENT_MAX_EVENT_TYPE 6 -// ==== end of AP rtmp_def.h ============ - -// definition RSSI Number -#define RSSI_0 0 -#define RSSI_1 1 -#define RSSI_2 2 - -// definition of radar detection -#define RD_NORMAL_MODE 0 // Not found radar signal -#define RD_SWITCHING_MODE 1 // Found radar signal, and doing channel switch -#define RD_SILENCE_MODE 2 // After channel switch, need to be silence a while to ensure radar not found - -//Driver defined cid for mapping status and command. -#define SLEEPCID 0x11 -#define WAKECID 0x22 -#define QUERYPOWERCID 0x33 -#define OWNERMCU 0x1 -#define OWNERCPU 0x0 - -// MBSSID definition -#define ENTRY_NOT_FOUND 0xFF - - -/* After Linux 2.6.9, - * VLAN module use Private (from user) interface flags (netdevice->priv_flags). - * #define IFF_802_1Q_VLAN 0x1 -- 802.1Q VLAN device. in if.h - * ref to ip_sabotage_out() [ out->priv_flags & IFF_802_1Q_VLAN ] in br_netfilter.c - * - * For this reason, we MUST use EVEN value in priv_flags - */ -#define INT_MAIN 0x0100 -#define INT_MBSSID 0x0200 -#define INT_WDS 0x0300 -#define INT_APCLI 0x0400 -#define INT_MESH 0x0500 - -#define INF_MAIN_DEV_NAME "wlan" -#define INF_MBSSID_DEV_NAME "wlan" -#define INF_WDS_DEV_NAME "wds" -#define INF_APCLI_DEV_NAME "apcli" -#define INF_MESH_DEV_NAME "mesh" - -// Use bitmap to allow coexist of ATE_TXFRAME and ATE_RXFRAME(i.e.,to support LoopBack mode). -#ifdef RALINK_ATE -#define ATE_START 0x00 // Start ATE -#define ATE_STOP 0x80 // Stop ATE -#define ATE_TXCONT 0x05 // Continuous Transmit -#define ATE_TXCARR 0x09 // Transmit Carrier -#define ATE_TXCARRSUPP 0x11 // Transmit Carrier Suppression -#define ATE_TXFRAME 0x01 // Transmit Frames -#define ATE_RXFRAME 0x02 // Receive Frames -#ifdef RALINK_28xx_QA -#define ATE_TXSTOP 0xe2 // Stop Transmition(i.e., TXCONT, TXCARR, TXCARRSUPP, and TXFRAME) -#define ATE_RXSTOP 0xfd // Stop receiving Frames -#define BBP22_TXFRAME 0x00 // Transmit Frames -#define BBP22_TXCONT_OR_CARRSUPP 0x80 // Continuous Transmit or Carrier Suppression -#define BBP22_TXCARR 0xc1 // Transmit Carrier -#define BBP24_TXCONT 0x00 // Continuous Transmit -#define BBP24_CARRSUPP 0x01 // Carrier Suppression -#endif // RALINK_28xx_QA // -#endif // RALINK_ATE // - -// WEP Key TYPE -#define WEP_HEXADECIMAL_TYPE 0 -#define WEP_ASCII_TYPE 1 - - - -// WIRELESS EVENTS definition -/* Max number of char in custom event, refer to wireless_tools.28/wireless.20.h */ -#define IW_CUSTOM_MAX_LEN 255 /* In bytes */ - -// For system event - start -#define IW_SYS_EVENT_FLAG_START 0x0200 -#define IW_ASSOC_EVENT_FLAG 0x0200 -#define IW_DISASSOC_EVENT_FLAG 0x0201 -#define IW_DEAUTH_EVENT_FLAG 0x0202 -#define IW_AGEOUT_EVENT_FLAG 0x0203 -#define IW_COUNTER_MEASURES_EVENT_FLAG 0x0204 -#define IW_REPLAY_COUNTER_DIFF_EVENT_FLAG 0x0205 -#define IW_RSNIE_DIFF_EVENT_FLAG 0x0206 -#define IW_MIC_DIFF_EVENT_FLAG 0x0207 -#define IW_ICV_ERROR_EVENT_FLAG 0x0208 -#define IW_MIC_ERROR_EVENT_FLAG 0x0209 -#define IW_GROUP_HS_TIMEOUT_EVENT_FLAG 0x020A -#define IW_PAIRWISE_HS_TIMEOUT_EVENT_FLAG 0x020B -#define IW_RSNIE_SANITY_FAIL_EVENT_FLAG 0x020C -#define IW_SET_KEY_DONE_WPA1_EVENT_FLAG 0x020D -#define IW_SET_KEY_DONE_WPA2_EVENT_FLAG 0x020E -#define IW_STA_LINKUP_EVENT_FLAG 0x020F -#define IW_STA_LINKDOWN_EVENT_FLAG 0x0210 -#define IW_SCAN_COMPLETED_EVENT_FLAG 0x0211 -#define IW_SCAN_ENQUEUE_FAIL_EVENT_FLAG 0x0212 -// if add new system event flag, please upadte the IW_SYS_EVENT_FLAG_END -#define IW_SYS_EVENT_FLAG_END 0x0212 -#define IW_SYS_EVENT_TYPE_NUM (IW_SYS_EVENT_FLAG_END - IW_SYS_EVENT_FLAG_START + 1) -// For system event - end - -// For spoof attack event - start -#define IW_SPOOF_EVENT_FLAG_START 0x0300 -#define IW_CONFLICT_SSID_EVENT_FLAG 0x0300 -#define IW_SPOOF_ASSOC_RESP_EVENT_FLAG 0x0301 -#define IW_SPOOF_REASSOC_RESP_EVENT_FLAG 0x0302 -#define IW_SPOOF_PROBE_RESP_EVENT_FLAG 0x0303 -#define IW_SPOOF_BEACON_EVENT_FLAG 0x0304 -#define IW_SPOOF_DISASSOC_EVENT_FLAG 0x0305 -#define IW_SPOOF_AUTH_EVENT_FLAG 0x0306 -#define IW_SPOOF_DEAUTH_EVENT_FLAG 0x0307 -#define IW_SPOOF_UNKNOWN_MGMT_EVENT_FLAG 0x0308 -#define IW_REPLAY_ATTACK_EVENT_FLAG 0x0309 -// if add new spoof attack event flag, please upadte the IW_SPOOF_EVENT_FLAG_END -#define IW_SPOOF_EVENT_FLAG_END 0x0309 -#define IW_SPOOF_EVENT_TYPE_NUM (IW_SPOOF_EVENT_FLAG_END - IW_SPOOF_EVENT_FLAG_START + 1) -// For spoof attack event - end - -// For flooding attack event - start -#define IW_FLOOD_EVENT_FLAG_START 0x0400 -#define IW_FLOOD_AUTH_EVENT_FLAG 0x0400 -#define IW_FLOOD_ASSOC_REQ_EVENT_FLAG 0x0401 -#define IW_FLOOD_REASSOC_REQ_EVENT_FLAG 0x0402 -#define IW_FLOOD_PROBE_REQ_EVENT_FLAG 0x0403 -#define IW_FLOOD_DISASSOC_EVENT_FLAG 0x0404 -#define IW_FLOOD_DEAUTH_EVENT_FLAG 0x0405 -#define IW_FLOOD_EAP_REQ_EVENT_FLAG 0x0406 -// if add new flooding attack event flag, please upadte the IW_FLOOD_EVENT_FLAG_END -#define IW_FLOOD_EVENT_FLAG_END 0x0406 -#define IW_FLOOD_EVENT_TYPE_NUM (IW_FLOOD_EVENT_FLAG_END - IW_FLOOD_EVENT_FLAG_START + 1) -// For flooding attack - end - -// End - WIRELESS EVENTS definition - -#ifdef CONFIG_STA_SUPPORT -// definition for DLS, kathy -#define MAX_NUM_OF_INIT_DLS_ENTRY 1 -#define MAX_NUM_OF_DLS_ENTRY MAX_NUMBER_OF_DLS_ENTRY - -//Block ACK, kathy -#define MAX_TX_REORDERBUF 64 -#define MAX_RX_REORDERBUF 64 -#define DEFAULT_TX_TIMEOUT 30 -#define DEFAULT_RX_TIMEOUT 30 -#define MAX_BARECI_SESSION 8 - -#ifndef IW_ESSID_MAX_SIZE -/* Maximum size of the ESSID and pAd->nickname strings */ -#define IW_ESSID_MAX_SIZE 32 -#endif -#endif // CONFIG_STA_SUPPORT // - -#ifdef MCAST_RATE_SPECIFIC -#define MCAST_DISABLE 0 -#define MCAST_CCK 1 -#define MCAST_OFDM 2 -#define MCAST_HTMIX 3 -#endif // MCAST_RATE_SPECIFIC // - -// For AsicRadioOff/AsicRadioOn function -#define DOT11POWERSAVE 0 -#define GUIRADIO_OFF 1 -#define RTMP_HALT 2 -#define GUI_IDLE_POWER_SAVE 3 -// -- - - -// definition for WpaSupport flag -#define WPA_SUPPLICANT_DISABLE 0 -#define WPA_SUPPLICANT_ENABLE 1 -#define WPA_SUPPLICANT_ENABLE_WITH_WEB_UI 2 - -// definition for Antenna Diversity flag -#ifdef ANT_DIVERSITY_SUPPORT -enum ANT_DIVERSITY_TYPE { - ANT_DIVERSITY_DISABLE = 0, - ANT_DIVERSITY_ENABLE = 1, - ANT_FIX_ANT1 = 2, - ANT_FIX_ANT2 = 3 -}; -#endif // ANT_DIVERSITY_SUPPORT // - -// Endian byte swapping codes -#define SWAP16(x) \ - ((UINT16)( \ - (((UINT16)(x) & (UINT16) 0x00ffU) << 8) | \ - (((UINT16)(x) & (UINT16) 0xff00U) >> 8) )) - -#define SWAP32(x) \ - ((UINT32)( \ - (((UINT32)(x) & (UINT32) 0x000000ffUL) << 24) | \ - (((UINT32)(x) & (UINT32) 0x0000ff00UL) << 8) | \ - (((UINT32)(x) & (UINT32) 0x00ff0000UL) >> 8) | \ - (((UINT32)(x) & (UINT32) 0xff000000UL) >> 24) )) - -#define SWAP64(x) \ - ((UINT64)( \ - (UINT64)(((UINT64)(x) & (UINT64) 0x00000000000000ffULL) << 56) | \ - (UINT64)(((UINT64)(x) & (UINT64) 0x000000000000ff00ULL) << 40) | \ - (UINT64)(((UINT64)(x) & (UINT64) 0x0000000000ff0000ULL) << 24) | \ - (UINT64)(((UINT64)(x) & (UINT64) 0x00000000ff000000ULL) << 8) | \ - (UINT64)(((UINT64)(x) & (UINT64) 0x000000ff00000000ULL) >> 8) | \ - (UINT64)(((UINT64)(x) & (UINT64) 0x0000ff0000000000ULL) >> 24) | \ - (UINT64)(((UINT64)(x) & (UINT64) 0x00ff000000000000ULL) >> 40) | \ - (UINT64)(((UINT64)(x) & (UINT64) 0xff00000000000000ULL) >> 56) )) - -#ifdef RT_BIG_ENDIAN - -#define cpu2le64(x) SWAP64((x)) -#define le2cpu64(x) SWAP64((x)) -#define cpu2le32(x) SWAP32((x)) -#define le2cpu32(x) SWAP32((x)) -#define cpu2le16(x) SWAP16((x)) -#define le2cpu16(x) SWAP16((x)) -#define cpu2be64(x) ((UINT64)(x)) -#define be2cpu64(x) ((UINT64)(x)) -#define cpu2be32(x) ((UINT32)(x)) -#define be2cpu32(x) ((UINT32)(x)) -#define cpu2be16(x) ((UINT16)(x)) -#define be2cpu16(x) ((UINT16)(x)) - -#else // Little_Endian - -#define cpu2le64(x) ((UINT64)(x)) -#define le2cpu64(x) ((UINT64)(x)) -#define cpu2le32(x) ((UINT32)(x)) -#define le2cpu32(x) ((UINT32)(x)) -#define cpu2le16(x) ((UINT16)(x)) -#define le2cpu16(x) ((UINT16)(x)) -#define cpu2be64(x) SWAP64((x)) -#define be2cpu64(x) SWAP64((x)) -#define cpu2be32(x) SWAP32((x)) -#define be2cpu32(x) SWAP32((x)) -#define cpu2be16(x) SWAP16((x)) -#define be2cpu16(x) SWAP16((x)) - -#endif // RT_BIG_ENDIAN - -#define ABS(_x, _y) ((_x) > (_y)) ? ((_x) -(_y)) : ((_y) -(_x)) - - -#define A2Dec(_X, _p) \ -{ \ - UCHAR *p; \ - _X = 0; \ - p = _p; \ - while (((*p >= '0') && (*p <= '9'))) \ - { \ - if ((*p >= '0') && (*p <= '9')) \ - _X = _X * 10 + *p - 48; \ - p++; \ - } \ -} - - -#define A2Hex(_X, _p) \ -do{ \ - char *__p; \ - (_X) = 0; \ - __p = (char *)(_p); \ - while (((*__p >= 'a') && (*__p <= 'f')) || ((*__p >= 'A') && (*__p <= 'F')) || ((*__p >= '0') && (*__p <= '9'))) \ - { \ - if ((*__p >= 'a') && (*__p <= 'f')) \ - (_X) = (_X) * 16 + *__p - 87; \ - else if ((*__p >= 'A') && (*__p <= 'F')) \ - (_X) = (_X) * 16 + *__p - 55; \ - else if ((*__p >= '0') && (*__p <= '9')) \ - (_X) = (_X) * 16 + *__p - 48; \ - __p++; \ - } \ -}while(0) - -#endif // __RTMP_DEF_H__ diff --git a/drivers/staging/rt3090/rtmp_dot11.h b/drivers/staging/rt3090/rtmp_dot11.h deleted file mode 100644 index a637825afe9c..000000000000 --- a/drivers/staging/rt3090/rtmp_dot11.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* -*/ - -#ifndef __DOT11_BASE_H__ -#define __DOT11_BASE_H__ - -#include "rtmp_type.h" - - -// 4-byte HTC field. maybe included in any frame except non-QOS data frame. The Order bit must set 1. -typedef struct PACKED { -#ifdef RT_BIG_ENDIAN - UINT32 RDG:1; //RDG / More PPDU - UINT32 ACConstraint:1; //feedback request - UINT32 rsv:5; //calibration sequence - UINT32 ZLFAnnouce:1; // ZLF announcement - UINT32 CSISTEERING:2; //CSI/ STEERING - UINT32 FBKReq:2; //feedback request - UINT32 CalSeq:2; //calibration sequence - UINT32 CalPos:2; // calibration position - UINT32 MFBorASC:7; //Link adaptation feedback containing recommended MCS. 0x7f for no feedback or not available - UINT32 MFS:3; //SET to the received value of MRS. 0x111 for unsolicited MFB. - UINT32 MRSorASI:3; // MRQ Sequence identifier. unchanged during entire procedure. 0x000-0x110. - UINT32 MRQ:1; //MCS feedback. Request for a MCS feedback - UINT32 TRQ:1; //sounding request - UINT32 MA:1; //management action payload exist in (QoS Null+HTC) -#else - UINT32 MA:1; //management action payload exist in (QoS Null+HTC) - UINT32 TRQ:1; //sounding request - UINT32 MRQ:1; //MCS feedback. Request for a MCS feedback - UINT32 MRSorASI:3; // MRQ Sequence identifier. unchanged during entire procedure. 0x000-0x110. - UINT32 MFS:3; //SET to the received value of MRS. 0x111 for unsolicited MFB. - UINT32 MFBorASC:7; //Link adaptation feedback containing recommended MCS. 0x7f for no feedback or not available - UINT32 CalPos:2; // calibration position - UINT32 CalSeq:2; //calibration sequence - UINT32 FBKReq:2; //feedback request - UINT32 CSISTEERING:2; //CSI/ STEERING - UINT32 ZLFAnnouce:1; // ZLF announcement - UINT32 rsv:5; //calibration sequence - UINT32 ACConstraint:1; //feedback request - UINT32 RDG:1; //RDG / More PPDU -#endif /* !RT_BIG_ENDIAN */ -} HT_CONTROL, *PHT_CONTROL; - -// 2-byte QOS CONTROL field -typedef struct PACKED { -#ifdef RT_BIG_ENDIAN - USHORT Txop_QueueSize:8; - USHORT AMsduPresent:1; - USHORT AckPolicy:2; //0: normal ACK 1:No ACK 2:scheduled under MTBA/PSMP 3: BA - USHORT EOSP:1; - USHORT TID:4; -#else - USHORT TID:4; - USHORT EOSP:1; - USHORT AckPolicy:2; //0: normal ACK 1:No ACK 2:scheduled under MTBA/PSMP 3: BA - USHORT AMsduPresent:1; - USHORT Txop_QueueSize:8; -#endif /* !RT_BIG_ENDIAN */ -} QOS_CONTROL, *PQOS_CONTROL; - - -// 2-byte Frame control field -typedef struct PACKED { -#ifdef RT_BIG_ENDIAN - USHORT Order:1; // Strict order expected - USHORT Wep:1; // Wep data - USHORT MoreData:1; // More data bit - USHORT PwrMgmt:1; // Power management bit - USHORT Retry:1; // Retry status bit - USHORT MoreFrag:1; // More fragment bit - USHORT FrDs:1; // From DS indication - USHORT ToDs:1; // To DS indication - USHORT SubType:4; // MSDU subtype - USHORT Type:2; // MSDU type - USHORT Ver:2; // Protocol version -#else - USHORT Ver:2; // Protocol version - USHORT Type:2; // MSDU type - USHORT SubType:4; // MSDU subtype - USHORT ToDs:1; // To DS indication - USHORT FrDs:1; // From DS indication - USHORT MoreFrag:1; // More fragment bit - USHORT Retry:1; // Retry status bit - USHORT PwrMgmt:1; // Power management bit - USHORT MoreData:1; // More data bit - USHORT Wep:1; // Wep data - USHORT Order:1; // Strict order expected -#endif /* !RT_BIG_ENDIAN */ -} FRAME_CONTROL, *PFRAME_CONTROL; - -typedef struct PACKED _HEADER_802_11 { - FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; - UCHAR Addr3[MAC_ADDR_LEN]; -#ifdef RT_BIG_ENDIAN - USHORT Sequence:12; - USHORT Frag:4; -#else - USHORT Frag:4; - USHORT Sequence:12; -#endif /* !RT_BIG_ENDIAN */ - UCHAR Octet[0]; -} HEADER_802_11, *PHEADER_802_11; - -typedef struct PACKED _PSPOLL_FRAME { - FRAME_CONTROL FC; - USHORT Aid; - UCHAR Bssid[MAC_ADDR_LEN]; - UCHAR Ta[MAC_ADDR_LEN]; -} PSPOLL_FRAME, *PPSPOLL_FRAME; - -typedef struct PACKED _RTS_FRAME { - FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; -}RTS_FRAME, *PRTS_FRAME; - -#endif // __DOT11_BASE_H__ // diff --git a/drivers/staging/rt3090/rtmp_iface.h b/drivers/staging/rt3090/rtmp_iface.h deleted file mode 100644 index 168d0797fb6a..000000000000 --- a/drivers/staging/rt3090/rtmp_iface.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rt_iface.h - - Abstract: - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- - */ - -#ifndef __RTMP_IFACE_H__ -#define __RTMP_IFACE_H__ - -#ifdef RTMP_PCI_SUPPORT -#include "rtmp_pci.h" -#endif // RTMP_PCI_SUPPORT // - - -typedef struct _INF_PCI_CONFIG_ -{ - unsigned long CSRBaseAddress; // PCI MMIO Base Address, all access will use - unsigned int irq_num; -}INF_PCI_CONFIG; - - -typedef struct _INF_USB_CONFIG_ -{ - UINT8 BulkInEpAddr; // bulk-in endpoint address - UINT8 BulkOutEpAddr[6]; // bulk-out endpoint address -}INF_USB_CONFIG; - - -typedef struct _INF_RBUS_CONFIG_ -{ - unsigned long csr_addr; - unsigned int irq; -}INF_RBUS_CONFIG; - - -typedef enum _RTMP_INF_TYPE_ -{ - RTMP_DEV_INF_UNKNOWN = 0, - RTMP_DEV_INF_PCI = 1, - RTMP_DEV_INF_USB = 2, - RTMP_DEV_INF_RBUS = 4, -}RTMP_INF_TYPE; - - -typedef union _RTMP_INF_CONFIG_{ - struct _INF_PCI_CONFIG_ pciConfig; - struct _INF_USB_CONFIG_ usbConfig; - struct _INF_RBUS_CONFIG_ rbusConfig; -}RTMP_INF_CONFIG; - -#endif // __RTMP_IFACE_H__ // diff --git a/drivers/staging/rt3090/rtmp_mac.h b/drivers/staging/rt3090/rtmp_mac.h deleted file mode 100644 index c57b2959777e..000000000000 --- a/drivers/staging/rt3090/rtmp_mac.h +++ /dev/null @@ -1,2304 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rtmp_mac.h - - Abstract: - Ralink Wireless Chip MAC related definition & structures - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#ifndef __RTMP_MAC_H__ -#define __RTMP_MAC_H__ - - - -// ================================================================================= -// TX / RX ring descriptor format -// ================================================================================= - -// the first 24-byte in TXD is called TXINFO and will be DMAed to MAC block through TXFIFO. -// MAC block use this TXINFO to control the transmission behavior of this frame. -#define FIFO_MGMT 0 -#define FIFO_HCCA 1 -#define FIFO_EDCA 2 - - -// -// TXD Wireless Information format for Tx ring and Mgmt Ring -// -//txop : for txop mode -// 0:txop for the MPDU frame will be handles by ASIC by register -// 1/2/3:the MPDU frame is send after PIFS/backoff/SIFS -#ifdef RT_BIG_ENDIAN -typedef struct PACKED _TXWI_STRUC { - // Word 0 - UINT32 PHYMODE:2; - UINT32 TxBF:1; // 3*3 - UINT32 rsv2:1; -// UINT32 rsv2:2; - UINT32 Ifs:1; // - UINT32 STBC:2; //channel bandwidth 20MHz or 40 MHz - UINT32 ShortGI:1; - UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz - UINT32 MCS:7; - - UINT32 rsv:6; - UINT32 txop:2; //tx back off mode 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs only when previous frame exchange is successful. - UINT32 MpduDensity:3; - UINT32 AMPDU:1; - - UINT32 TS:1; - UINT32 CFACK:1; - UINT32 MIMOps:1; // the remote peer is in dynamic MIMO-PS mode - UINT32 FRAG:1; // 1 to inform TKIP engine this is a fragment. - // Word 1 - UINT32 PacketId:4; - UINT32 MPDUtotalByteCount:12; - UINT32 WirelessCliID:8; - UINT32 BAWinSize:6; - UINT32 NSEQ:1; - UINT32 ACK:1; - // Word 2 - UINT32 IV; - // Word 3 - UINT32 EIV; -} TXWI_STRUC, *PTXWI_STRUC; -#else -typedef struct PACKED _TXWI_STRUC { - // Word 0 - // ex: 00 03 00 40 means txop = 3, PHYMODE = 1 - UINT32 FRAG:1; // 1 to inform TKIP engine this is a fragment. - UINT32 MIMOps:1; // the remote peer is in dynamic MIMO-PS mode - UINT32 CFACK:1; - UINT32 TS:1; - - UINT32 AMPDU:1; - UINT32 MpduDensity:3; - UINT32 txop:2; //FOR "THIS" frame. 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs only when previous frame exchange is successful. - UINT32 rsv:6; - - UINT32 MCS:7; - UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz - UINT32 ShortGI:1; - UINT32 STBC:2; // 1: STBC support MCS =0-7, 2,3 : RESERVE - UINT32 Ifs:1; // -// UINT32 rsv2:2; //channel bandwidth 20MHz or 40 MHz - UINT32 rsv2:1; - UINT32 TxBF:1; // 3*3 - UINT32 PHYMODE:2; - // Word1 - // ex: 1c ff 38 00 means ACK=0, BAWinSize=7, MPDUtotalByteCount = 0x38 - UINT32 ACK:1; - UINT32 NSEQ:1; - UINT32 BAWinSize:6; - UINT32 WirelessCliID:8; - UINT32 MPDUtotalByteCount:12; - UINT32 PacketId:4; - //Word2 - UINT32 IV; - //Word3 - UINT32 EIV; -} TXWI_STRUC, *PTXWI_STRUC; -#endif - - -// -// RXWI wireless information format, in PBF. invisible in driver. -// -#ifdef RT_BIG_ENDIAN -typedef struct PACKED _RXWI_STRUC { - // Word 0 - UINT32 TID:4; - UINT32 MPDUtotalByteCount:12; - UINT32 UDF:3; - UINT32 BSSID:3; - UINT32 KeyIndex:2; - UINT32 WirelessCliID:8; - // Word 1 - UINT32 PHYMODE:2; // 1: this RX frame is unicast to me - UINT32 rsv:3; - UINT32 STBC:2; - UINT32 ShortGI:1; - UINT32 BW:1; - UINT32 MCS:7; - UINT32 SEQUENCE:12; - UINT32 FRAG:4; - // Word 2 - UINT32 rsv1:8; - UINT32 RSSI2:8; - UINT32 RSSI1:8; - UINT32 RSSI0:8; - // Word 3 - /*UINT32 rsv2:16;*/ - UINT32 rsv2:8; - UINT32 FOFFSET:8; // RT35xx - UINT32 SNR1:8; - UINT32 SNR0:8; -} RXWI_STRUC, *PRXWI_STRUC; -#else -typedef struct PACKED _RXWI_STRUC { - // Word 0 - UINT32 WirelessCliID:8; - UINT32 KeyIndex:2; - UINT32 BSSID:3; - UINT32 UDF:3; - UINT32 MPDUtotalByteCount:12; - UINT32 TID:4; - // Word 1 - UINT32 FRAG:4; - UINT32 SEQUENCE:12; - UINT32 MCS:7; - UINT32 BW:1; - UINT32 ShortGI:1; - UINT32 STBC:2; - UINT32 rsv:3; - UINT32 PHYMODE:2; // 1: this RX frame is unicast to me - //Word2 - UINT32 RSSI0:8; - UINT32 RSSI1:8; - UINT32 RSSI2:8; - UINT32 rsv1:8; - //Word3 - UINT32 SNR0:8; - UINT32 SNR1:8; - UINT32 FOFFSET:8; // RT35xx - UINT32 rsv2:8; - /*UINT32 rsv2:16;*/ -} RXWI_STRUC, *PRXWI_STRUC; -#endif - - -// ================================================================================= -// Register format -// ================================================================================= - - -// -// SCH/DMA registers - base address 0x0200 -// -// INT_SOURCE_CSR: Interrupt source register. Write one to clear corresponding bit -// -#define DMA_CSR0 0x200 -#define INT_SOURCE_CSR 0x200 -#ifdef RT_BIG_ENDIAN -typedef union _INT_SOURCE_CSR_STRUC { - struct { -#ifdef TONE_RADAR_DETECT_SUPPORT - UINT32 :11; - UINT32 RadarINT:1; - UINT32 rsv:2; -#else // original source code - UINT32 :14; -#endif // TONE_RADAR_DETECT_SUPPORT // - UINT32 TxCoherent:1; - UINT32 RxCoherent:1; - UINT32 GPTimer:1; - UINT32 AutoWakeup:1;//bit14 - UINT32 TXFifoStatusInt:1;//FIFO Statistics is full, sw should read 0x171c - UINT32 PreTBTT:1; - UINT32 TBTTInt:1; - UINT32 RxTxCoherent:1; - UINT32 MCUCommandINT:1; - UINT32 MgmtDmaDone:1; - UINT32 HccaDmaDone:1; - UINT32 Ac3DmaDone:1; - UINT32 Ac2DmaDone:1; - UINT32 Ac1DmaDone:1; - UINT32 Ac0DmaDone:1; - UINT32 RxDone:1; - UINT32 TxDelayINT:1; //delayed interrupt, not interrupt until several int or time limit hit - UINT32 RxDelayINT:1; //dealyed interrupt - } field; - UINT32 word; -} INT_SOURCE_CSR_STRUC, *PINT_SOURCE_CSR_STRUC; -#else -typedef union _INT_SOURCE_CSR_STRUC { - struct { - UINT32 RxDelayINT:1; - UINT32 TxDelayINT:1; - UINT32 RxDone:1; - UINT32 Ac0DmaDone:1;//4 - UINT32 Ac1DmaDone:1; - UINT32 Ac2DmaDone:1; - UINT32 Ac3DmaDone:1; - UINT32 HccaDmaDone:1; // bit7 - UINT32 MgmtDmaDone:1; - UINT32 MCUCommandINT:1;//bit 9 - UINT32 RxTxCoherent:1; - UINT32 TBTTInt:1; - UINT32 PreTBTT:1; - UINT32 TXFifoStatusInt:1;//FIFO Statistics is full, sw should read 0x171c - UINT32 AutoWakeup:1;//bit14 - UINT32 GPTimer:1; - UINT32 RxCoherent:1;//bit16 - UINT32 TxCoherent:1; -#ifdef TONE_RADAR_DETECT_SUPPORT - UINT32 rsv:2; - UINT32 RadarINT:1; - UINT32 :11; -#else - UINT32 :14; -#endif // TONE_RADAR_DETECT_SUPPORT // - } field; - UINT32 word; -} INT_SOURCE_CSR_STRUC, *PINT_SOURCE_CSR_STRUC; -#endif - -// -// INT_MASK_CSR: Interrupt MASK register. 1: the interrupt is mask OFF -// -#define INT_MASK_CSR 0x204 -#ifdef RT_BIG_ENDIAN -typedef union _INT_MASK_CSR_STRUC { - struct { - UINT32 TxCoherent:1; - UINT32 RxCoherent:1; -#ifdef TONE_RADAR_DETECT_SUPPORT - UINT32 :9; - UINT32 RadarINT:1; - UINT32 rsv:10; -#else - UINT32 :20; -#endif // TONE_RADAR_DETECT_SUPPORT // - UINT32 MCUCommandINT:1; - UINT32 MgmtDmaDone:1; - UINT32 HccaDmaDone:1; - UINT32 Ac3DmaDone:1; - UINT32 Ac2DmaDone:1; - UINT32 Ac1DmaDone:1; - UINT32 Ac0DmaDone:1; - UINT32 RxDone:1; - UINT32 TxDelay:1; - UINT32 RXDelay_INT_MSK:1; - } field; - UINT32 word; -}INT_MASK_CSR_STRUC, *PINT_MASK_CSR_STRUC; -#else -typedef union _INT_MASK_CSR_STRUC { - struct { - UINT32 RXDelay_INT_MSK:1; - UINT32 TxDelay:1; - UINT32 RxDone:1; - UINT32 Ac0DmaDone:1; - UINT32 Ac1DmaDone:1; - UINT32 Ac2DmaDone:1; - UINT32 Ac3DmaDone:1; - UINT32 HccaDmaDone:1; - UINT32 MgmtDmaDone:1; - UINT32 MCUCommandINT:1; -#ifdef TONE_RADAR_DETECT_SUPPORT - UINT32 rsv:10; - UINT32 RadarINT:1; - UINT32 :9; -#else - UINT32 :20; -#endif // TONE_RADAR_DETECT_SUPPORT // - UINT32 RxCoherent:1; - UINT32 TxCoherent:1; - } field; - UINT32 word; -} INT_MASK_CSR_STRUC, *PINT_MASK_CSR_STRUC; -#endif - -#define WPDMA_GLO_CFG 0x208 -#ifdef RT_BIG_ENDIAN -typedef union _WPDMA_GLO_CFG_STRUC { - struct { - UINT32 HDR_SEG_LEN:16; - UINT32 RXHdrScater:8; - UINT32 BigEndian:1; - UINT32 EnTXWriteBackDDONE:1; - UINT32 WPDMABurstSIZE:2; - UINT32 RxDMABusy:1; - UINT32 EnableRxDMA:1; - UINT32 TxDMABusy:1; - UINT32 EnableTxDMA:1; - } field; - UINT32 word; -}WPDMA_GLO_CFG_STRUC, *PWPDMA_GLO_CFG_STRUC; -#else -typedef union _WPDMA_GLO_CFG_STRUC { - struct { - UINT32 EnableTxDMA:1; - UINT32 TxDMABusy:1; - UINT32 EnableRxDMA:1; - UINT32 RxDMABusy:1; - UINT32 WPDMABurstSIZE:2; - UINT32 EnTXWriteBackDDONE:1; - UINT32 BigEndian:1; - UINT32 RXHdrScater:8; - UINT32 HDR_SEG_LEN:16; - } field; - UINT32 word; -} WPDMA_GLO_CFG_STRUC, *PWPDMA_GLO_CFG_STRUC; -#endif - -#define WPDMA_RST_IDX 0x20c -#ifdef RT_BIG_ENDIAN -typedef union _WPDMA_RST_IDX_STRUC { - struct { - UINT32 :15; - UINT32 RST_DRX_IDX0:1; - UINT32 rsv:10; - UINT32 RST_DTX_IDX5:1; - UINT32 RST_DTX_IDX4:1; - UINT32 RST_DTX_IDX3:1; - UINT32 RST_DTX_IDX2:1; - UINT32 RST_DTX_IDX1:1; - UINT32 RST_DTX_IDX0:1; - } field; - UINT32 word; -}WPDMA_RST_IDX_STRUC, *PWPDMA_RST_IDX_STRUC; -#else -typedef union _WPDMA_RST_IDX_STRUC { - struct { - UINT32 RST_DTX_IDX0:1; - UINT32 RST_DTX_IDX1:1; - UINT32 RST_DTX_IDX2:1; - UINT32 RST_DTX_IDX3:1; - UINT32 RST_DTX_IDX4:1; - UINT32 RST_DTX_IDX5:1; - UINT32 rsv:10; - UINT32 RST_DRX_IDX0:1; - UINT32 :15; - } field; - UINT32 word; -} WPDMA_RST_IDX_STRUC, *PWPDMA_RST_IDX_STRUC; -#endif -#define DELAY_INT_CFG 0x0210 -#ifdef RT_BIG_ENDIAN -typedef union _DELAY_INT_CFG_STRUC { - struct { - UINT32 TXDLY_INT_EN:1; - UINT32 TXMAX_PINT:7; - UINT32 TXMAX_PTIME:8; - UINT32 RXDLY_INT_EN:1; - UINT32 RXMAX_PINT:7; - UINT32 RXMAX_PTIME:8; - } field; - UINT32 word; -}DELAY_INT_CFG_STRUC, *PDELAY_INT_CFG_STRUC; -#else -typedef union _DELAY_INT_CFG_STRUC { - struct { - UINT32 RXMAX_PTIME:8; - UINT32 RXMAX_PINT:7; - UINT32 RXDLY_INT_EN:1; - UINT32 TXMAX_PTIME:8; - UINT32 TXMAX_PINT:7; - UINT32 TXDLY_INT_EN:1; - } field; - UINT32 word; -} DELAY_INT_CFG_STRUC, *PDELAY_INT_CFG_STRUC; -#endif -#define WMM_AIFSN_CFG 0x0214 -#ifdef RT_BIG_ENDIAN -typedef union _AIFSN_CSR_STRUC { - struct { - UINT32 Rsv:16; - UINT32 Aifsn3:4; // for AC_VO - UINT32 Aifsn2:4; // for AC_VI - UINT32 Aifsn1:4; // for AC_BK - UINT32 Aifsn0:4; // for AC_BE - } field; - UINT32 word; -} AIFSN_CSR_STRUC, *PAIFSN_CSR_STRUC; -#else -typedef union _AIFSN_CSR_STRUC { - struct { - UINT32 Aifsn0:4; // for AC_BE - UINT32 Aifsn1:4; // for AC_BK - UINT32 Aifsn2:4; // for AC_VI - UINT32 Aifsn3:4; // for AC_VO - UINT32 Rsv:16; - } field; - UINT32 word; -} AIFSN_CSR_STRUC, *PAIFSN_CSR_STRUC; -#endif -// -// CWMIN_CSR: CWmin for each EDCA AC -// -#define WMM_CWMIN_CFG 0x0218 -#ifdef RT_BIG_ENDIAN -typedef union _CWMIN_CSR_STRUC { - struct { - UINT32 Rsv:16; - UINT32 Cwmin3:4; // for AC_VO - UINT32 Cwmin2:4; // for AC_VI - UINT32 Cwmin1:4; // for AC_BK - UINT32 Cwmin0:4; // for AC_BE - } field; - UINT32 word; -} CWMIN_CSR_STRUC, *PCWMIN_CSR_STRUC; -#else -typedef union _CWMIN_CSR_STRUC { - struct { - UINT32 Cwmin0:4; // for AC_BE - UINT32 Cwmin1:4; // for AC_BK - UINT32 Cwmin2:4; // for AC_VI - UINT32 Cwmin3:4; // for AC_VO - UINT32 Rsv:16; - } field; - UINT32 word; -} CWMIN_CSR_STRUC, *PCWMIN_CSR_STRUC; -#endif - -// -// CWMAX_CSR: CWmin for each EDCA AC -// -#define WMM_CWMAX_CFG 0x021c -#ifdef RT_BIG_ENDIAN -typedef union _CWMAX_CSR_STRUC { - struct { - UINT32 Rsv:16; - UINT32 Cwmax3:4; // for AC_VO - UINT32 Cwmax2:4; // for AC_VI - UINT32 Cwmax1:4; // for AC_BK - UINT32 Cwmax0:4; // for AC_BE - } field; - UINT32 word; -} CWMAX_CSR_STRUC, *PCWMAX_CSR_STRUC; -#else -typedef union _CWMAX_CSR_STRUC { - struct { - UINT32 Cwmax0:4; // for AC_BE - UINT32 Cwmax1:4; // for AC_BK - UINT32 Cwmax2:4; // for AC_VI - UINT32 Cwmax3:4; // for AC_VO - UINT32 Rsv:16; - } field; - UINT32 word; -} CWMAX_CSR_STRUC, *PCWMAX_CSR_STRUC; -#endif - - -// -// AC_TXOP_CSR0: AC_BK/AC_BE TXOP register -// -#define WMM_TXOP0_CFG 0x0220 -#ifdef RT_BIG_ENDIAN -typedef union _AC_TXOP_CSR0_STRUC { - struct { - USHORT Ac1Txop; // for AC_BE, in unit of 32us - USHORT Ac0Txop; // for AC_BK, in unit of 32us - } field; - UINT32 word; -} AC_TXOP_CSR0_STRUC, *PAC_TXOP_CSR0_STRUC; -#else -typedef union _AC_TXOP_CSR0_STRUC { - struct { - USHORT Ac0Txop; // for AC_BK, in unit of 32us - USHORT Ac1Txop; // for AC_BE, in unit of 32us - } field; - UINT32 word; -} AC_TXOP_CSR0_STRUC, *PAC_TXOP_CSR0_STRUC; -#endif - -// -// AC_TXOP_CSR1: AC_VO/AC_VI TXOP register -// -#define WMM_TXOP1_CFG 0x0224 -#ifdef RT_BIG_ENDIAN -typedef union _AC_TXOP_CSR1_STRUC { - struct { - USHORT Ac3Txop; // for AC_VO, in unit of 32us - USHORT Ac2Txop; // for AC_VI, in unit of 32us - } field; - UINT32 word; -} AC_TXOP_CSR1_STRUC, *PAC_TXOP_CSR1_STRUC; -#else -typedef union _AC_TXOP_CSR1_STRUC { - struct { - USHORT Ac2Txop; // for AC_VI, in unit of 32us - USHORT Ac3Txop; // for AC_VO, in unit of 32us - } field; - UINT32 word; -} AC_TXOP_CSR1_STRUC, *PAC_TXOP_CSR1_STRUC; -#endif - - -#define RINGREG_DIFF 0x10 -#define GPIO_CTRL_CFG 0x0228 //MAC_CSR13 -#define MCU_CMD_CFG 0x022c -#define TX_BASE_PTR0 0x0230 //AC_BK base address -#define TX_MAX_CNT0 0x0234 -#define TX_CTX_IDX0 0x0238 -#define TX_DTX_IDX0 0x023c -#define TX_BASE_PTR1 0x0240 //AC_BE base address -#define TX_MAX_CNT1 0x0244 -#define TX_CTX_IDX1 0x0248 -#define TX_DTX_IDX1 0x024c -#define TX_BASE_PTR2 0x0250 //AC_VI base address -#define TX_MAX_CNT2 0x0254 -#define TX_CTX_IDX2 0x0258 -#define TX_DTX_IDX2 0x025c -#define TX_BASE_PTR3 0x0260 //AC_VO base address -#define TX_MAX_CNT3 0x0264 -#define TX_CTX_IDX3 0x0268 -#define TX_DTX_IDX3 0x026c -#define TX_BASE_PTR4 0x0270 //HCCA base address -#define TX_MAX_CNT4 0x0274 -#define TX_CTX_IDX4 0x0278 -#define TX_DTX_IDX4 0x027c -#define TX_BASE_PTR5 0x0280 //MGMT base address -#define TX_MAX_CNT5 0x0284 -#define TX_CTX_IDX5 0x0288 -#define TX_DTX_IDX5 0x028c -#define TX_MGMTMAX_CNT TX_MAX_CNT5 -#define TX_MGMTCTX_IDX TX_CTX_IDX5 -#define TX_MGMTDTX_IDX TX_DTX_IDX5 -#define RX_BASE_PTR 0x0290 //RX base address -#define RX_MAX_CNT 0x0294 -#define RX_CRX_IDX 0x0298 -#define RX_DRX_IDX 0x029c - - -#define USB_DMA_CFG 0x02a0 -#ifdef RT_BIG_ENDIAN -typedef union _USB_DMA_CFG_STRUC { - struct { - UINT32 TxBusy:1; //USB DMA TX FSM busy . debug only - UINT32 RxBusy:1; //USB DMA RX FSM busy . debug only - UINT32 EpoutValid:6; //OUT endpoint data valid. debug only - UINT32 TxBulkEn:1; //Enable USB DMA Tx - UINT32 RxBulkEn:1; //Enable USB DMA Rx - UINT32 RxBulkAggEn:1; //Enable Rx Bulk Aggregation - UINT32 TxopHalt:1; //Halt TXOP count down when TX buffer is full. - UINT32 TxClear:1; //Clear USB DMA TX path - UINT32 rsv:2; - UINT32 phyclear:1; //phy watch dog enable. write 1 - UINT32 RxBulkAggLmt:8; //Rx Bulk Aggregation Limit in unit of 1024 bytes - UINT32 RxBulkAggTOut:8; //Rx Bulk Aggregation TimeOut in unit of 33ns - } field; - UINT32 word; -} USB_DMA_CFG_STRUC, *PUSB_DMA_CFG_STRUC; -#else -typedef union _USB_DMA_CFG_STRUC { - struct { - UINT32 RxBulkAggTOut:8; //Rx Bulk Aggregation TimeOut in unit of 33ns - UINT32 RxBulkAggLmt:8; //Rx Bulk Aggregation Limit in unit of 256 bytes - UINT32 phyclear:1; //phy watch dog enable. write 1 - UINT32 rsv:2; - UINT32 TxClear:1; //Clear USB DMA TX path - UINT32 TxopHalt:1; //Halt TXOP count down when TX buffer is full. - UINT32 RxBulkAggEn:1; //Enable Rx Bulk Aggregation - UINT32 RxBulkEn:1; //Enable USB DMA Rx - UINT32 TxBulkEn:1; //Enable USB DMA Tx - UINT32 EpoutValid:6; //OUT endpoint data valid - UINT32 RxBusy:1; //USB DMA RX FSM busy - UINT32 TxBusy:1; //USB DMA TX FSM busy - } field; - UINT32 word; -} USB_DMA_CFG_STRUC, *PUSB_DMA_CFG_STRUC; -#endif - - -// -// 3 PBF registers -// -// -// Most are for debug. Driver doesn't touch PBF register. -#define PBF_SYS_CTRL 0x0400 -#define PBF_CFG 0x0408 -#define PBF_MAX_PCNT 0x040C -#define PBF_CTRL 0x0410 -#define PBF_INT_STA 0x0414 -#define PBF_INT_ENA 0x0418 -#define TXRXQ_PCNT 0x0438 -#define PBF_DBG 0x043c -#define PBF_CAP_CTRL 0x0440 - -#ifdef RT30xx -#ifdef RTMP_EFUSE_SUPPORT -// eFuse registers -#define EFUSE_CTRL 0x0580 -#define EFUSE_DATA0 0x0590 -#define EFUSE_DATA1 0x0594 -#define EFUSE_DATA2 0x0598 -#define EFUSE_DATA3 0x059c -#endif // RTMP_EFUSE_SUPPORT // -#endif // RT30xx // - -#define OSC_CTRL 0x5a4 -#define PCIE_PHY_TX_ATTENUATION_CTRL 0x05C8 -#define LDO_CFG0 0x05d4 -#define GPIO_SWITCH 0x05dc - - -// -// 4 MAC registers -// -// -// 4.1 MAC SYSTEM configuration registers (offset:0x1000) -// -#define MAC_CSR0 0x1000 -#ifdef RT_BIG_ENDIAN -typedef union _ASIC_VER_ID_STRUC { - struct { - USHORT ASICVer; // version : 2860 - USHORT ASICRev; // reversion : 0 - } field; - UINT32 word; -} ASIC_VER_ID_STRUC, *PASIC_VER_ID_STRUC; -#else -typedef union _ASIC_VER_ID_STRUC { - struct { - USHORT ASICRev; // reversion : 0 - USHORT ASICVer; // version : 2860 - } field; - UINT32 word; -} ASIC_VER_ID_STRUC, *PASIC_VER_ID_STRUC; -#endif -#define MAC_SYS_CTRL 0x1004 //MAC_CSR1 -#define MAC_ADDR_DW0 0x1008 // MAC ADDR DW0 -#define MAC_ADDR_DW1 0x100c // MAC ADDR DW1 -// -// MAC_CSR2: STA MAC register 0 -// -#ifdef RT_BIG_ENDIAN -typedef union _MAC_DW0_STRUC { - struct { - UCHAR Byte3; // MAC address byte 3 - UCHAR Byte2; // MAC address byte 2 - UCHAR Byte1; // MAC address byte 1 - UCHAR Byte0; // MAC address byte 0 - } field; - UINT32 word; -} MAC_DW0_STRUC, *PMAC_DW0_STRUC; -#else -typedef union _MAC_DW0_STRUC { - struct { - UCHAR Byte0; // MAC address byte 0 - UCHAR Byte1; // MAC address byte 1 - UCHAR Byte2; // MAC address byte 2 - UCHAR Byte3; // MAC address byte 3 - } field; - UINT32 word; -} MAC_DW0_STRUC, *PMAC_DW0_STRUC; -#endif - -// -// MAC_CSR3: STA MAC register 1 -// -#ifdef RT_BIG_ENDIAN -typedef union _MAC_DW1_STRUC { - struct { - UCHAR Rsvd1; - UCHAR U2MeMask; - UCHAR Byte5; // MAC address byte 5 - UCHAR Byte4; // MAC address byte 4 - } field; - UINT32 word; -} MAC_DW1_STRUC, *PMAC_DW1_STRUC; -#else -typedef union _MAC_DW1_STRUC { - struct { - UCHAR Byte4; // MAC address byte 4 - UCHAR Byte5; // MAC address byte 5 - UCHAR U2MeMask; - UCHAR Rsvd1; - } field; - UINT32 word; -} MAC_DW1_STRUC, *PMAC_DW1_STRUC; -#endif - -#define MAC_BSSID_DW0 0x1010 // MAC BSSID DW0 -#define MAC_BSSID_DW1 0x1014 // MAC BSSID DW1 - -// -// MAC_CSR5: BSSID register 1 -// -#ifdef RT_BIG_ENDIAN -typedef union _MAC_CSR5_STRUC { - struct { - USHORT Rsvd:11; - USHORT MBssBcnNum:3; - USHORT BssIdMode:2; // 0: one BSSID, 10: 4 BSSID, 01: 2 BSSID , 11: 8BSSID - UCHAR Byte5; // BSSID byte 5 - UCHAR Byte4; // BSSID byte 4 - } field; - UINT32 word; -} MAC_CSR5_STRUC, *PMAC_CSR5_STRUC; -#else -typedef union _MAC_CSR5_STRUC { - struct { - UCHAR Byte4; // BSSID byte 4 - UCHAR Byte5; // BSSID byte 5 - USHORT BssIdMask:2; // 0: one BSSID, 10: 4 BSSID, 01: 2 BSSID , 11: 8BSSID - USHORT MBssBcnNum:3; - USHORT Rsvd:11; - } field; - UINT32 word; -} MAC_CSR5_STRUC, *PMAC_CSR5_STRUC; -#endif - -#define MAX_LEN_CFG 0x1018 // rt2860b max 16k bytes. bit12:13 Maximum PSDU length (power factor) 0:2^13, 1:2^14, 2:2^15, 3:2^16 -#define BBP_CSR_CFG 0x101c // -// -// BBP_CSR_CFG: BBP serial control register -// -#ifdef RT_BIG_ENDIAN -typedef union _BBP_CSR_CFG_STRUC { - struct { - UINT32 :12; - UINT32 BBP_RW_MODE:1; // 0: use serial mode 1:parallel - UINT32 BBP_PAR_DUR:1; // 0: 4 MAC clock cycles 1: 8 MAC clock cycles - UINT32 Busy:1; // 1: ASIC is busy execute BBP programming. - UINT32 fRead:1; // 0: Write BBP, 1: Read BBP - UINT32 RegNum:8; // Selected BBP register - UINT32 Value:8; // Register value to program into BBP - } field; - UINT32 word; -} BBP_CSR_CFG_STRUC, *PBBP_CSR_CFG_STRUC; -#else -typedef union _BBP_CSR_CFG_STRUC { - struct { - UINT32 Value:8; // Register value to program into BBP - UINT32 RegNum:8; // Selected BBP register - UINT32 fRead:1; // 0: Write BBP, 1: Read BBP - UINT32 Busy:1; // 1: ASIC is busy execute BBP programming. - UINT32 BBP_PAR_DUR:1; // 0: 4 MAC clock cycles 1: 8 MAC clock cycles - UINT32 BBP_RW_MODE:1; // 0: use serial mode 1:parallel - UINT32 :12; - } field; - UINT32 word; -} BBP_CSR_CFG_STRUC, *PBBP_CSR_CFG_STRUC; -#endif -#define RF_CSR_CFG0 0x1020 -// -// RF_CSR_CFG: RF control register -// -#ifdef RT_BIG_ENDIAN -typedef union _RF_CSR_CFG0_STRUC { - struct { - UINT32 Busy:1; // 0: idle 1: 8busy - UINT32 Sel:1; // 0:RF_LE0 activate 1:RF_LE1 activate - UINT32 StandbyMode:1; // 0: high when stand by 1: low when standby - UINT32 bitwidth:5; // Selected BBP register - UINT32 RegIdAndContent:24; // Register value to program into BBP - } field; - UINT32 word; -} RF_CSR_CFG0_STRUC, *PRF_CSR_CFG0_STRUC; -#else -typedef union _RF_CSR_CFG0_STRUC { - struct { - UINT32 RegIdAndContent:24; // Register value to program into BBP - UINT32 bitwidth:5; // Selected BBP register - UINT32 StandbyMode:1; // 0: high when stand by 1: low when standby - UINT32 Sel:1; // 0:RF_LE0 activate 1:RF_LE1 activate - UINT32 Busy:1; // 0: idle 1: 8busy - } field; - UINT32 word; -} RF_CSR_CFG0_STRUC, *PRF_CSR_CFG0_STRUC; -#endif -#define RF_CSR_CFG1 0x1024 -#ifdef RT_BIG_ENDIAN -typedef union _RF_CSR_CFG1_STRUC { - struct { - UINT32 rsv:7; // 0: idle 1: 8busy - UINT32 RFGap:5; // Gap between BB_CONTROL_RF and RF_LE. 0: 3 system clock cycle (37.5usec) 1: 5 system clock cycle (62.5usec) - UINT32 RegIdAndContent:24; // Register value to program into BBP - } field; - UINT32 word; -} RF_CSR_CFG1_STRUC, *PRF_CSR_CFG1_STRUC; -#else -typedef union _RF_CSR_CFG1_STRUC { - struct { - UINT32 RegIdAndContent:24; // Register value to program into BBP - UINT32 RFGap:5; // Gap between BB_CONTROL_RF and RF_LE. 0: 3 system clock cycle (37.5usec) 1: 5 system clock cycle (62.5usec) - UINT32 rsv:7; // 0: idle 1: 8busy - } field; - UINT32 word; -} RF_CSR_CFG1_STRUC, *PRF_CSR_CFG1_STRUC; -#endif -#define RF_CSR_CFG2 0x1028 // -#ifdef RT_BIG_ENDIAN -typedef union _RF_CSR_CFG2_STRUC { - struct { - UINT32 rsv:8; // 0: idle 1: 8busy - UINT32 RegIdAndContent:24; // Register value to program into BBP - } field; - UINT32 word; -} RF_CSR_CFG2_STRUC, *PRF_CSR_CFG2_STRUC; -#else -typedef union _RF_CSR_CFG2_STRUC { - struct { - UINT32 RegIdAndContent:24; // Register value to program into BBP - UINT32 rsv:8; // 0: idle 1: 8busy - } field; - UINT32 word; -} RF_CSR_CFG2_STRUC, *PRF_CSR_CFG2_STRUC; -#endif -#define LED_CFG 0x102c // MAC_CSR14 -#ifdef RT_BIG_ENDIAN -typedef union _LED_CFG_STRUC { - struct { - UINT32 :1; - UINT32 LedPolar:1; // Led Polarity. 0: active low1: active high - UINT32 YLedMode:2; // yellow Led Mode - UINT32 GLedMode:2; // green Led Mode - UINT32 RLedMode:2; // red Led Mode 0: off1: blinking upon TX2: periodic slow blinking3: always on - UINT32 rsv:2; - UINT32 SlowBlinkPeriod:6; // slow blinking period. unit:1ms - UINT32 OffPeriod:8; // blinking off period unit 1ms - UINT32 OnPeriod:8; // blinking on period unit 1ms - } field; - UINT32 word; -} LED_CFG_STRUC, *PLED_CFG_STRUC; -#else -typedef union _LED_CFG_STRUC { - struct { - UINT32 OnPeriod:8; // blinking on period unit 1ms - UINT32 OffPeriod:8; // blinking off period unit 1ms - UINT32 SlowBlinkPeriod:6; // slow blinking period. unit:1ms - UINT32 rsv:2; - UINT32 RLedMode:2; // red Led Mode 0: off1: blinking upon TX2: periodic slow blinking3: always on - UINT32 GLedMode:2; // green Led Mode - UINT32 YLedMode:2; // yellow Led Mode - UINT32 LedPolar:1; // Led Polarity. 0: active low1: active high - UINT32 :1; - } field; - UINT32 word; -} LED_CFG_STRUC, *PLED_CFG_STRUC; -#endif -// -// 4.2 MAC TIMING configuration registers (offset:0x1100) -// -#define XIFS_TIME_CFG 0x1100 // MAC_CSR8 MAC_CSR9 -#ifdef RT_BIG_ENDIAN -typedef union _IFS_SLOT_CFG_STRUC { - struct { - UINT32 rsv:2; - UINT32 BBRxendEnable:1; // reference RXEND signal to begin XIFS defer - UINT32 EIFS:9; // unit 1us - UINT32 OfdmXifsTime:4; //OFDM SIFS. unit 1us. Applied after OFDM RX when MAC doesn't reference BBP signal BBRXEND - UINT32 OfdmSifsTime:8; // unit 1us. Applied after OFDM RX/TX - UINT32 CckmSifsTime:8; // unit 1us. Applied after CCK RX/TX - } field; - UINT32 word; -} IFS_SLOT_CFG_STRUC, *PIFS_SLOT_CFG_STRUC; -#else -typedef union _IFS_SLOT_CFG_STRUC { - struct { - UINT32 CckmSifsTime:8; // unit 1us. Applied after CCK RX/TX - UINT32 OfdmSifsTime:8; // unit 1us. Applied after OFDM RX/TX - UINT32 OfdmXifsTime:4; //OFDM SIFS. unit 1us. Applied after OFDM RX when MAC doesn't reference BBP signal BBRXEND - UINT32 EIFS:9; // unit 1us - UINT32 BBRxendEnable:1; // reference RXEND signal to begin XIFS defer - UINT32 rsv:2; - } field; - UINT32 word; -} IFS_SLOT_CFG_STRUC, *PIFS_SLOT_CFG_STRUC; -#endif - -#define BKOFF_SLOT_CFG 0x1104 // mac_csr9 last 8 bits -#define NAV_TIME_CFG 0x1108 // NAV (MAC_CSR15) -#define CH_TIME_CFG 0x110C // Count as channel busy -#define PBF_LIFE_TIMER 0x1110 //TX/RX MPDU timestamp timer (free run)Unit: 1us -#define BCN_TIME_CFG 0x1114 // TXRX_CSR9 - -#define BCN_OFFSET0 0x042C -#define BCN_OFFSET1 0x0430 - -// -// BCN_TIME_CFG : Synchronization control register -// -#ifdef RT_BIG_ENDIAN -typedef union _BCN_TIME_CFG_STRUC { - struct { - UINT32 TxTimestampCompensate:8; - UINT32 :3; - UINT32 bBeaconGen:1; // Enable beacon generator - UINT32 bTBTTEnable:1; - UINT32 TsfSyncMode:2; // Enable TSF sync, 00: disable, 01: infra mode, 10: ad-hoc mode - UINT32 bTsfTicking:1; // Enable TSF auto counting - UINT32 BeaconInterval:16; // in unit of 1/16 TU - } field; - UINT32 word; -} BCN_TIME_CFG_STRUC, *PBCN_TIME_CFG_STRUC; -#else -typedef union _BCN_TIME_CFG_STRUC { - struct { - UINT32 BeaconInterval:16; // in unit of 1/16 TU - UINT32 bTsfTicking:1; // Enable TSF auto counting - UINT32 TsfSyncMode:2; // Enable TSF sync, 00: disable, 01: infra mode, 10: ad-hoc mode - UINT32 bTBTTEnable:1; - UINT32 bBeaconGen:1; // Enable beacon generator - UINT32 :3; - UINT32 TxTimestampCompensate:8; - } field; - UINT32 word; -} BCN_TIME_CFG_STRUC, *PBCN_TIME_CFG_STRUC; -#endif -#define TBTT_SYNC_CFG 0x1118 // txrx_csr10 -#define TSF_TIMER_DW0 0x111C // Local TSF timer lsb 32 bits. Read-only -#define TSF_TIMER_DW1 0x1120 // msb 32 bits. Read-only. -#define TBTT_TIMER 0x1124 // TImer remains till next TBTT. Read-only. TXRX_CSR14 -#define INT_TIMER_CFG 0x1128 // -#define INT_TIMER_EN 0x112c // GP-timer and pre-tbtt Int enable -#define CH_IDLE_STA 0x1130 // channel idle time -#define CH_BUSY_STA 0x1134 // channle busy time -// -// 4.2 MAC POWER configuration registers (offset:0x1200) -// -#define MAC_STATUS_CFG 0x1200 // old MAC_CSR12 -#define PWR_PIN_CFG 0x1204 // old MAC_CSR12 -#define AUTO_WAKEUP_CFG 0x1208 // old MAC_CSR10 -// -// AUTO_WAKEUP_CFG: Manual power control / status register -// -#ifdef RT_BIG_ENDIAN -typedef union _AUTO_WAKEUP_STRUC { - struct { - UINT32 :16; - UINT32 EnableAutoWakeup:1; // 0:sleep, 1:awake - UINT32 NumofSleepingTbtt:7; // ForceWake has high privilege than PutToSleep when both set - UINT32 AutoLeadTime:8; - } field; - UINT32 word; -} AUTO_WAKEUP_STRUC, *PAUTO_WAKEUP_STRUC; -#else -typedef union _AUTO_WAKEUP_STRUC { - struct { - UINT32 AutoLeadTime:8; - UINT32 NumofSleepingTbtt:7; // ForceWake has high privilege than PutToSleep when both set - UINT32 EnableAutoWakeup:1; // 0:sleep, 1:awake - UINT32 :16; - } field; - UINT32 word; -} AUTO_WAKEUP_STRUC, *PAUTO_WAKEUP_STRUC; -#endif -// -// 4.3 MAC TX configuration registers (offset:0x1300) -// - -#define EDCA_AC0_CFG 0x1300 //AC_TXOP_CSR0 0x3474 -#define EDCA_AC1_CFG 0x1304 -#define EDCA_AC2_CFG 0x1308 -#define EDCA_AC3_CFG 0x130c -#ifdef RT_BIG_ENDIAN -typedef union _EDCA_AC_CFG_STRUC { - struct { - UINT32 :12; // - UINT32 Cwmax:4; //unit power of 2 - UINT32 Cwmin:4; // - UINT32 Aifsn:4; // # of slot time - UINT32 AcTxop:8; // in unit of 32us - } field; - UINT32 word; -} EDCA_AC_CFG_STRUC, *PEDCA_AC_CFG_STRUC; -#else -typedef union _EDCA_AC_CFG_STRUC { - struct { - UINT32 AcTxop:8; // in unit of 32us - UINT32 Aifsn:4; // # of slot time - UINT32 Cwmin:4; // - UINT32 Cwmax:4; //unit power of 2 - UINT32 :12; // - } field; - UINT32 word; -} EDCA_AC_CFG_STRUC, *PEDCA_AC_CFG_STRUC; -#endif - -#define EDCA_TID_AC_MAP 0x1310 -#define TX_PWR_CFG_0 0x1314 -#define TX_PWR_CFG_1 0x1318 -#define TX_PWR_CFG_2 0x131C -#define TX_PWR_CFG_3 0x1320 -#define TX_PWR_CFG_4 0x1324 -#define TX_PIN_CFG 0x1328 -#define TX_BAND_CFG 0x132c // 0x1 use upper 20MHz. 0 juse lower 20MHz -#define TX_SW_CFG0 0x1330 -#define TX_SW_CFG1 0x1334 -#define TX_SW_CFG2 0x1338 -#define TXOP_THRES_CFG 0x133c -#define TXOP_CTRL_CFG 0x1340 -#define TX_RTS_CFG 0x1344 - -#ifdef RT_BIG_ENDIAN -typedef union _TX_RTS_CFG_STRUC { - struct { - UINT32 rsv:7; - UINT32 RtsFbkEn:1; // enable rts rate fallback - UINT32 RtsThres:16; // unit:byte - UINT32 AutoRtsRetryLimit:8; - } field; - UINT32 word; -} TX_RTS_CFG_STRUC, *PTX_RTS_CFG_STRUC; -#else -typedef union _TX_RTS_CFG_STRUC { - struct { - UINT32 AutoRtsRetryLimit:8; - UINT32 RtsThres:16; // unit:byte - UINT32 RtsFbkEn:1; // enable rts rate fallback - UINT32 rsv:7; // 1: HT non-STBC control frame enable - } field; - UINT32 word; -} TX_RTS_CFG_STRUC, *PTX_RTS_CFG_STRUC; -#endif -#define TX_TIMEOUT_CFG 0x1348 -#ifdef RT_BIG_ENDIAN -typedef union _TX_TIMEOUT_CFG_STRUC { - struct { - UINT32 rsv2:8; - UINT32 TxopTimeout:8; //TXOP timeout value for TXOP truncation. It is recommended that (SLOT_TIME) > (TX_OP_TIMEOUT) > (RX_ACK_TIMEOUT) - UINT32 RxAckTimeout:8; // unit:slot. Used for TX precedure - UINT32 MpduLifeTime:4; // expiration time = 2^(9+MPDU LIFE TIME) us - UINT32 rsv:4; - } field; - UINT32 word; -} TX_TIMEOUT_CFG_STRUC, *PTX_TIMEOUT_CFG_STRUC; -#else -typedef union _TX_TIMEOUT_CFG_STRUC { - struct { - UINT32 rsv:4; - UINT32 MpduLifeTime:4; // expiration time = 2^(9+MPDU LIFE TIME) us - UINT32 RxAckTimeout:8; // unit:slot. Used for TX precedure - UINT32 TxopTimeout:8; //TXOP timeout value for TXOP truncation. It is recommended that (SLOT_TIME) > (TX_OP_TIMEOUT) > (RX_ACK_TIMEOUT) - UINT32 rsv2:8; // 1: HT non-STBC control frame enable - } field; - UINT32 word; -} TX_TIMEOUT_CFG_STRUC, *PTX_TIMEOUT_CFG_STRUC; -#endif -#define TX_RTY_CFG 0x134c -#ifdef RT_BIG_ENDIAN -typedef union PACKED _TX_RTY_CFG_STRUC { - struct { - UINT32 rsv:1; - UINT32 TxautoFBEnable:1; // Tx retry PHY rate auto fallback enable - UINT32 AggRtyMode:1; // Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer - UINT32 NonAggRtyMode:1; // Non-Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer - UINT32 LongRtyThre:12; // Long retry threshoold - UINT32 LongRtyLimit:8; //long retry limit - UINT32 ShortRtyLimit:8; // short retry limit - - } field; - UINT32 word; -} TX_RTY_CFG_STRUC, *PTX_RTY_CFG_STRUC; -#else -typedef union PACKED _TX_RTY_CFG_STRUC { - struct { - UINT32 ShortRtyLimit:8; // short retry limit - UINT32 LongRtyLimit:8; //long retry limit - UINT32 LongRtyThre:12; // Long retry threshoold - UINT32 NonAggRtyMode:1; // Non-Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer - UINT32 AggRtyMode:1; // Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer - UINT32 TxautoFBEnable:1; // Tx retry PHY rate auto fallback enable - UINT32 rsv:1; // 1: HT non-STBC control frame enable - } field; - UINT32 word; -} TX_RTY_CFG_STRUC, *PTX_RTY_CFG_STRUC; -#endif -#define TX_LINK_CFG 0x1350 -#ifdef RT_BIG_ENDIAN -typedef union PACKED _TX_LINK_CFG_STRUC { - struct PACKED { - UINT32 RemotMFS:8; //remote MCS feedback sequence number - UINT32 RemotMFB:8; // remote MCS feedback - UINT32 rsv:3; // - UINT32 TxCFAckEn:1; // Piggyback CF-ACK enable - UINT32 TxRDGEn:1; // RDG TX enable - UINT32 TxMRQEn:1; // MCS request TX enable - UINT32 RemoteUMFSEnable:1; // remote unsolicit MFB enable. 0: not apply remote remote unsolicit (MFS=7) - UINT32 MFBEnable:1; // TX apply remote MFB 1:enable - UINT32 RemoteMFBLifeTime:8; //remote MFB life time. unit : 32us - } field; - UINT32 word; -} TX_LINK_CFG_STRUC, *PTX_LINK_CFG_STRUC; -#else -typedef union PACKED _TX_LINK_CFG_STRUC { - struct PACKED { - UINT32 RemoteMFBLifeTime:8; //remote MFB life time. unit : 32us - UINT32 MFBEnable:1; // TX apply remote MFB 1:enable - UINT32 RemoteUMFSEnable:1; // remote unsolicit MFB enable. 0: not apply remote remote unsolicit (MFS=7) - UINT32 TxMRQEn:1; // MCS request TX enable - UINT32 TxRDGEn:1; // RDG TX enable - UINT32 TxCFAckEn:1; // Piggyback CF-ACK enable - UINT32 rsv:3; // - UINT32 RemotMFB:8; // remote MCS feedback - UINT32 RemotMFS:8; //remote MCS feedback sequence number - } field; - UINT32 word; -} TX_LINK_CFG_STRUC, *PTX_LINK_CFG_STRUC; -#endif -#define HT_FBK_CFG0 0x1354 -#ifdef RT_BIG_ENDIAN -typedef union PACKED _HT_FBK_CFG0_STRUC { - struct { - UINT32 HTMCS7FBK:4; - UINT32 HTMCS6FBK:4; - UINT32 HTMCS5FBK:4; - UINT32 HTMCS4FBK:4; - UINT32 HTMCS3FBK:4; - UINT32 HTMCS2FBK:4; - UINT32 HTMCS1FBK:4; - UINT32 HTMCS0FBK:4; - } field; - UINT32 word; -} HT_FBK_CFG0_STRUC, *PHT_FBK_CFG0_STRUC; -#else -typedef union PACKED _HT_FBK_CFG0_STRUC { - struct { - UINT32 HTMCS0FBK:4; - UINT32 HTMCS1FBK:4; - UINT32 HTMCS2FBK:4; - UINT32 HTMCS3FBK:4; - UINT32 HTMCS4FBK:4; - UINT32 HTMCS5FBK:4; - UINT32 HTMCS6FBK:4; - UINT32 HTMCS7FBK:4; - } field; - UINT32 word; -} HT_FBK_CFG0_STRUC, *PHT_FBK_CFG0_STRUC; -#endif -#define HT_FBK_CFG1 0x1358 -#ifdef RT_BIG_ENDIAN -typedef union _HT_FBK_CFG1_STRUC { - struct { - UINT32 HTMCS15FBK:4; - UINT32 HTMCS14FBK:4; - UINT32 HTMCS13FBK:4; - UINT32 HTMCS12FBK:4; - UINT32 HTMCS11FBK:4; - UINT32 HTMCS10FBK:4; - UINT32 HTMCS9FBK:4; - UINT32 HTMCS8FBK:4; - } field; - UINT32 word; -} HT_FBK_CFG1_STRUC, *PHT_FBK_CFG1_STRUC; -#else -typedef union _HT_FBK_CFG1_STRUC { - struct { - UINT32 HTMCS8FBK:4; - UINT32 HTMCS9FBK:4; - UINT32 HTMCS10FBK:4; - UINT32 HTMCS11FBK:4; - UINT32 HTMCS12FBK:4; - UINT32 HTMCS13FBK:4; - UINT32 HTMCS14FBK:4; - UINT32 HTMCS15FBK:4; - } field; - UINT32 word; -} HT_FBK_CFG1_STRUC, *PHT_FBK_CFG1_STRUC; -#endif -#define LG_FBK_CFG0 0x135c -#ifdef RT_BIG_ENDIAN -typedef union _LG_FBK_CFG0_STRUC { - struct { - UINT32 OFDMMCS7FBK:4; //initial value is 6 - UINT32 OFDMMCS6FBK:4; //initial value is 5 - UINT32 OFDMMCS5FBK:4; //initial value is 4 - UINT32 OFDMMCS4FBK:4; //initial value is 3 - UINT32 OFDMMCS3FBK:4; //initial value is 2 - UINT32 OFDMMCS2FBK:4; //initial value is 1 - UINT32 OFDMMCS1FBK:4; //initial value is 0 - UINT32 OFDMMCS0FBK:4; //initial value is 0 - } field; - UINT32 word; -} LG_FBK_CFG0_STRUC, *PLG_FBK_CFG0_STRUC; -#else -typedef union _LG_FBK_CFG0_STRUC { - struct { - UINT32 OFDMMCS0FBK:4; //initial value is 0 - UINT32 OFDMMCS1FBK:4; //initial value is 0 - UINT32 OFDMMCS2FBK:4; //initial value is 1 - UINT32 OFDMMCS3FBK:4; //initial value is 2 - UINT32 OFDMMCS4FBK:4; //initial value is 3 - UINT32 OFDMMCS5FBK:4; //initial value is 4 - UINT32 OFDMMCS6FBK:4; //initial value is 5 - UINT32 OFDMMCS7FBK:4; //initial value is 6 - } field; - UINT32 word; -} LG_FBK_CFG0_STRUC, *PLG_FBK_CFG0_STRUC; -#endif -#define LG_FBK_CFG1 0x1360 -#ifdef RT_BIG_ENDIAN -typedef union _LG_FBK_CFG1_STRUC { - struct { - UINT32 rsv:16; - UINT32 CCKMCS3FBK:4; //initial value is 2 - UINT32 CCKMCS2FBK:4; //initial value is 1 - UINT32 CCKMCS1FBK:4; //initial value is 0 - UINT32 CCKMCS0FBK:4; //initial value is 0 - } field; - UINT32 word; -} LG_FBK_CFG1_STRUC, *PLG_FBK_CFG1_STRUC; -#else -typedef union _LG_FBK_CFG1_STRUC { - struct { - UINT32 CCKMCS0FBK:4; //initial value is 0 - UINT32 CCKMCS1FBK:4; //initial value is 0 - UINT32 CCKMCS2FBK:4; //initial value is 1 - UINT32 CCKMCS3FBK:4; //initial value is 2 - UINT32 rsv:16; - } field; - UINT32 word; -} LG_FBK_CFG1_STRUC, *PLG_FBK_CFG1_STRUC; -#endif - - -//======================================================= -//================ Protection Paramater================================ -//======================================================= -#define CCK_PROT_CFG 0x1364 //CCK Protection -#define ASIC_SHORTNAV 1 -#define ASIC_LONGNAV 2 -#define ASIC_RTS 1 -#define ASIC_CTS 2 -#ifdef RT_BIG_ENDIAN -typedef union _PROT_CFG_STRUC { - struct { - UINT32 rsv:5; - UINT32 RTSThEn:1; //RTS threshold enable on CCK TX - UINT32 TxopAllowGF40:1; //CCK TXOP allowance.0:disallow. - UINT32 TxopAllowGF20:1; //CCK TXOP allowance.0:disallow. - UINT32 TxopAllowMM40:1; //CCK TXOP allowance.0:disallow. - UINT32 TxopAllowMM20:1; //CCK TXOP allowance. 0:disallow. - UINT32 TxopAllowOfdm:1; //CCK TXOP allowance.0:disallow. - UINT32 TxopAllowCck:1; //CCK TXOP allowance.0:disallow. - UINT32 ProtectNav:2; //TXOP protection type for CCK TX. 0:None, 1:ShortNAVprotect, 2:LongNAVProtect, 3:rsv - UINT32 ProtectCtrl:2; //Protection control frame type for CCK TX. 1:RTS/CTS, 2:CTS-to-self, 0:None, 3:rsv - UINT32 ProtectRate:16; //Protection control frame rate for CCK TX(RTS/CTS/CFEnd). - } field; - UINT32 word; -} PROT_CFG_STRUC, *PPROT_CFG_STRUC; -#else -typedef union _PROT_CFG_STRUC { - struct { - UINT32 ProtectRate:16; //Protection control frame rate for CCK TX(RTS/CTS/CFEnd). - UINT32 ProtectCtrl:2; //Protection control frame type for CCK TX. 1:RTS/CTS, 2:CTS-to-self, 0:None, 3:rsv - UINT32 ProtectNav:2; //TXOP protection type for CCK TX. 0:None, 1:ShortNAVprotect, 2:LongNAVProtect, 3:rsv - UINT32 TxopAllowCck:1; //CCK TXOP allowance.0:disallow. - UINT32 TxopAllowOfdm:1; //CCK TXOP allowance.0:disallow. - UINT32 TxopAllowMM20:1; //CCK TXOP allowance. 0:disallow. - UINT32 TxopAllowMM40:1; //CCK TXOP allowance.0:disallow. - UINT32 TxopAllowGF20:1; //CCK TXOP allowance.0:disallow. - UINT32 TxopAllowGF40:1; //CCK TXOP allowance.0:disallow. - UINT32 RTSThEn:1; //RTS threshold enable on CCK TX - UINT32 rsv:5; - } field; - UINT32 word; -} PROT_CFG_STRUC, *PPROT_CFG_STRUC; -#endif - -#define OFDM_PROT_CFG 0x1368 //OFDM Protection -#define MM20_PROT_CFG 0x136C //MM20 Protection -#define MM40_PROT_CFG 0x1370 //MM40 Protection -#define GF20_PROT_CFG 0x1374 //GF20 Protection -#define GF40_PROT_CFG 0x1378 //GR40 Protection -#define EXP_CTS_TIME 0x137C // -#define EXP_ACK_TIME 0x1380 // - -// -// 4.4 MAC RX configuration registers (offset:0x1400) -// -#define RX_FILTR_CFG 0x1400 //TXRX_CSR0 -#define AUTO_RSP_CFG 0x1404 //TXRX_CSR4 -// -// TXRX_CSR4: Auto-Responder/ -// -#ifdef RT_BIG_ENDIAN -typedef union _AUTO_RSP_CFG_STRUC { - struct { - UINT32 :24; - UINT32 AckCtsPsmBit:1; // Power bit value in conrtrol frame - UINT32 DualCTSEn:1; // Power bit value in conrtrol frame - UINT32 rsv:1; // Power bit value in conrtrol frame - UINT32 AutoResponderPreamble:1; // 0:long, 1:short preamble - UINT32 CTS40MRef:1; // Response CTS 40MHz duplicate mode - UINT32 CTS40MMode:1; // Response CTS 40MHz duplicate mode - UINT32 BACAckPolicyEnable:1; // 0:long, 1:short preamble - UINT32 AutoResponderEnable:1; - } field; - UINT32 word; -} AUTO_RSP_CFG_STRUC, *PAUTO_RSP_CFG_STRUC; -#else -typedef union _AUTO_RSP_CFG_STRUC { - struct { - UINT32 AutoResponderEnable:1; - UINT32 BACAckPolicyEnable:1; // 0:long, 1:short preamble - UINT32 CTS40MMode:1; // Response CTS 40MHz duplicate mode - UINT32 CTS40MRef:1; // Response CTS 40MHz duplicate mode - UINT32 AutoResponderPreamble:1; // 0:long, 1:short preamble - UINT32 rsv:1; // Power bit value in conrtrol frame - UINT32 DualCTSEn:1; // Power bit value in conrtrol frame - UINT32 AckCtsPsmBit:1; // Power bit value in conrtrol frame - UINT32 :24; - } field; - UINT32 word; -} AUTO_RSP_CFG_STRUC, *PAUTO_RSP_CFG_STRUC; -#endif - -#define LEGACY_BASIC_RATE 0x1408 // TXRX_CSR5 0x3054 -#define HT_BASIC_RATE 0x140c -#define HT_CTRL_CFG 0x1410 -#define SIFS_COST_CFG 0x1414 -#define RX_PARSER_CFG 0x1418 //Set NAV for all received frames - -// -// 4.5 MAC Security configuration (offset:0x1500) -// -#define TX_SEC_CNT0 0x1500 // -#define RX_SEC_CNT0 0x1504 // -#define CCMP_FC_MUTE 0x1508 // -// -// 4.6 HCCA/PSMP (offset:0x1600) -// -#define TXOP_HLDR_ADDR0 0x1600 -#define TXOP_HLDR_ADDR1 0x1604 -#define TXOP_HLDR_ET 0x1608 -#define QOS_CFPOLL_RA_DW0 0x160c -#define QOS_CFPOLL_A1_DW1 0x1610 -#define QOS_CFPOLL_QC 0x1614 -// -// 4.7 MAC Statistis registers (offset:0x1700) -// -#define RX_STA_CNT0 0x1700 // -#define RX_STA_CNT1 0x1704 // -#define RX_STA_CNT2 0x1708 // - -// -// RX_STA_CNT0_STRUC: RX PLCP error count & RX CRC error count -// -#ifdef RT_BIG_ENDIAN -typedef union _RX_STA_CNT0_STRUC { - struct { - USHORT PhyErr; - USHORT CrcErr; - } field; - UINT32 word; -} RX_STA_CNT0_STRUC, *PRX_STA_CNT0_STRUC; -#else -typedef union _RX_STA_CNT0_STRUC { - struct { - USHORT CrcErr; - USHORT PhyErr; - } field; - UINT32 word; -} RX_STA_CNT0_STRUC, *PRX_STA_CNT0_STRUC; -#endif - -// -// RX_STA_CNT1_STRUC: RX False CCA count & RX LONG frame count -// -#ifdef RT_BIG_ENDIAN -typedef union _RX_STA_CNT1_STRUC { - struct { - USHORT PlcpErr; - USHORT FalseCca; - } field; - UINT32 word; -} RX_STA_CNT1_STRUC, *PRX_STA_CNT1_STRUC; -#else -typedef union _RX_STA_CNT1_STRUC { - struct { - USHORT FalseCca; - USHORT PlcpErr; - } field; - UINT32 word; -} RX_STA_CNT1_STRUC, *PRX_STA_CNT1_STRUC; -#endif - -// -// RX_STA_CNT2_STRUC: -// -#ifdef RT_BIG_ENDIAN -typedef union _RX_STA_CNT2_STRUC { - struct { - USHORT RxFifoOverflowCount; - USHORT RxDupliCount; - } field; - UINT32 word; -} RX_STA_CNT2_STRUC, *PRX_STA_CNT2_STRUC; -#else -typedef union _RX_STA_CNT2_STRUC { - struct { - USHORT RxDupliCount; - USHORT RxFifoOverflowCount; - } field; - UINT32 word; -} RX_STA_CNT2_STRUC, *PRX_STA_CNT2_STRUC; -#endif -#define TX_STA_CNT0 0x170C // -// -// STA_CSR3: TX Beacon count -// -#ifdef RT_BIG_ENDIAN -typedef union _TX_STA_CNT0_STRUC { - struct { - USHORT TxBeaconCount; - USHORT TxFailCount; - } field; - UINT32 word; -} TX_STA_CNT0_STRUC, *PTX_STA_CNT0_STRUC; -#else -typedef union _TX_STA_CNT0_STRUC { - struct { - USHORT TxFailCount; - USHORT TxBeaconCount; - } field; - UINT32 word; -} TX_STA_CNT0_STRUC, *PTX_STA_CNT0_STRUC; -#endif -#define TX_STA_CNT1 0x1710 // -// -// TX_STA_CNT1: TX tx count -// -#ifdef RT_BIG_ENDIAN -typedef union _TX_STA_CNT1_STRUC { - struct { - USHORT TxRetransmit; - USHORT TxSuccess; - } field; - UINT32 word; -} TX_STA_CNT1_STRUC, *PTX_STA_CNT1_STRUC; -#else -typedef union _TX_STA_CNT1_STRUC { - struct { - USHORT TxSuccess; - USHORT TxRetransmit; - } field; - UINT32 word; -} TX_STA_CNT1_STRUC, *PTX_STA_CNT1_STRUC; -#endif -#define TX_STA_CNT2 0x1714 // -// -// TX_STA_CNT2: TX tx count -// -#ifdef RT_BIG_ENDIAN -typedef union _TX_STA_CNT2_STRUC { - struct { - USHORT TxUnderFlowCount; - USHORT TxZeroLenCount; - } field; - UINT32 word; -} TX_STA_CNT2_STRUC, *PTX_STA_CNT2_STRUC; -#else -typedef union _TX_STA_CNT2_STRUC { - struct { - USHORT TxZeroLenCount; - USHORT TxUnderFlowCount; - } field; - UINT32 word; -} TX_STA_CNT2_STRUC, *PTX_STA_CNT2_STRUC; -#endif -#define TX_STA_FIFO 0x1718 // -// -// TX_STA_FIFO_STRUC: TX Result for specific PID status fifo register -// -#ifdef RT_BIG_ENDIAN -typedef union PACKED _TX_STA_FIFO_STRUC { - struct { - UINT32 Reserve:2; - UINT32 TxBF:1; // 3*3 - UINT32 SuccessRate:13; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16. -// UINT32 SuccessRate:16; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16. - UINT32 wcid:8; //wireless client index - UINT32 TxAckRequired:1; // ack required - UINT32 TxAggre:1; // Tx is aggregated - UINT32 TxSuccess:1; // Tx success. whether success or not - UINT32 PidType:4; - UINT32 bValid:1; // 1:This register contains a valid TX result - } field; - UINT32 word; -} TX_STA_FIFO_STRUC, *PTX_STA_FIFO_STRUC; -#else -typedef union PACKED _TX_STA_FIFO_STRUC { - struct { - UINT32 bValid:1; // 1:This register contains a valid TX result - UINT32 PidType:4; - UINT32 TxSuccess:1; // Tx No retry success - UINT32 TxAggre:1; // Tx Retry Success - UINT32 TxAckRequired:1; // Tx fail - UINT32 wcid:8; //wireless client index -// UINT32 SuccessRate:16; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16. - UINT32 SuccessRate:13; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16. - UINT32 TxBF:1; - UINT32 Reserve:2; - } field; - UINT32 word; -} TX_STA_FIFO_STRUC, *PTX_STA_FIFO_STRUC; -#endif -// Debug counter -#define TX_AGG_CNT 0x171c -#ifdef RT_BIG_ENDIAN -typedef union _TX_AGG_CNT_STRUC { - struct { - USHORT AggTxCount; - USHORT NonAggTxCount; - } field; - UINT32 word; -} TX_AGG_CNT_STRUC, *PTX_AGG_CNT_STRUC; -#else -typedef union _TX_AGG_CNT_STRUC { - struct { - USHORT NonAggTxCount; - USHORT AggTxCount; - } field; - UINT32 word; -} TX_AGG_CNT_STRUC, *PTX_AGG_CNT_STRUC; -#endif -// Debug counter -#define TX_AGG_CNT0 0x1720 -#ifdef RT_BIG_ENDIAN -typedef union _TX_AGG_CNT0_STRUC { - struct { - USHORT AggSize2Count; - USHORT AggSize1Count; - } field; - UINT32 word; -} TX_AGG_CNT0_STRUC, *PTX_AGG_CNT0_STRUC; -#else -typedef union _TX_AGG_CNT0_STRUC { - struct { - USHORT AggSize1Count; - USHORT AggSize2Count; - } field; - UINT32 word; -} TX_AGG_CNT0_STRUC, *PTX_AGG_CNT0_STRUC; -#endif -// Debug counter -#define TX_AGG_CNT1 0x1724 -#ifdef RT_BIG_ENDIAN -typedef union _TX_AGG_CNT1_STRUC { - struct { - USHORT AggSize4Count; - USHORT AggSize3Count; - } field; - UINT32 word; -} TX_AGG_CNT1_STRUC, *PTX_AGG_CNT1_STRUC; -#else -typedef union _TX_AGG_CNT1_STRUC { - struct { - USHORT AggSize3Count; - USHORT AggSize4Count; - } field; - UINT32 word; -} TX_AGG_CNT1_STRUC, *PTX_AGG_CNT1_STRUC; -#endif -#define TX_AGG_CNT2 0x1728 -#ifdef RT_BIG_ENDIAN -typedef union _TX_AGG_CNT2_STRUC { - struct { - USHORT AggSize6Count; - USHORT AggSize5Count; - } field; - UINT32 word; -} TX_AGG_CNT2_STRUC, *PTX_AGG_CNT2_STRUC; -#else -typedef union _TX_AGG_CNT2_STRUC { - struct { - USHORT AggSize5Count; - USHORT AggSize6Count; - } field; - UINT32 word; -} TX_AGG_CNT2_STRUC, *PTX_AGG_CNT2_STRUC; -#endif -// Debug counter -#define TX_AGG_CNT3 0x172c -#ifdef RT_BIG_ENDIAN -typedef union _TX_AGG_CNT3_STRUC { - struct { - USHORT AggSize8Count; - USHORT AggSize7Count; - } field; - UINT32 word; -} TX_AGG_CNT3_STRUC, *PTX_AGG_CNT3_STRUC; -#else -typedef union _TX_AGG_CNT3_STRUC { - struct { - USHORT AggSize7Count; - USHORT AggSize8Count; - } field; - UINT32 word; -} TX_AGG_CNT3_STRUC, *PTX_AGG_CNT3_STRUC; -#endif -// Debug counter -#define TX_AGG_CNT4 0x1730 -#ifdef RT_BIG_ENDIAN -typedef union _TX_AGG_CNT4_STRUC { - struct { - USHORT AggSize10Count; - USHORT AggSize9Count; - } field; - UINT32 word; -} TX_AGG_CNT4_STRUC, *PTX_AGG_CNT4_STRUC; -#else -typedef union _TX_AGG_CNT4_STRUC { - struct { - USHORT AggSize9Count; - USHORT AggSize10Count; - } field; - UINT32 word; -} TX_AGG_CNT4_STRUC, *PTX_AGG_CNT4_STRUC; -#endif -#define TX_AGG_CNT5 0x1734 -#ifdef RT_BIG_ENDIAN -typedef union _TX_AGG_CNT5_STRUC { - struct { - USHORT AggSize12Count; - USHORT AggSize11Count; - } field; - UINT32 word; -} TX_AGG_CNT5_STRUC, *PTX_AGG_CNT5_STRUC; -#else -typedef union _TX_AGG_CNT5_STRUC { - struct { - USHORT AggSize11Count; - USHORT AggSize12Count; - } field; - UINT32 word; -} TX_AGG_CNT5_STRUC, *PTX_AGG_CNT5_STRUC; -#endif -#define TX_AGG_CNT6 0x1738 -#ifdef RT_BIG_ENDIAN -typedef union _TX_AGG_CNT6_STRUC { - struct { - USHORT AggSize14Count; - USHORT AggSize13Count; - } field; - UINT32 word; -} TX_AGG_CNT6_STRUC, *PTX_AGG_CNT6_STRUC; -#else -typedef union _TX_AGG_CNT6_STRUC { - struct { - USHORT AggSize13Count; - USHORT AggSize14Count; - } field; - UINT32 word; -} TX_AGG_CNT6_STRUC, *PTX_AGG_CNT6_STRUC; -#endif -#define TX_AGG_CNT7 0x173c -#ifdef RT_BIG_ENDIAN -typedef union _TX_AGG_CNT7_STRUC { - struct { - USHORT AggSize16Count; - USHORT AggSize15Count; - } field; - UINT32 word; -} TX_AGG_CNT7_STRUC, *PTX_AGG_CNT7_STRUC; -#else -typedef union _TX_AGG_CNT7_STRUC { - struct { - USHORT AggSize15Count; - USHORT AggSize16Count; - } field; - UINT32 word; -} TX_AGG_CNT7_STRUC, *PTX_AGG_CNT7_STRUC; -#endif -#define MPDU_DENSITY_CNT 0x1740 -#ifdef RT_BIG_ENDIAN -typedef union _MPDU_DEN_CNT_STRUC { - struct { - USHORT RXZeroDelCount; //RX zero length delimiter count - USHORT TXZeroDelCount; //TX zero length delimiter count - } field; - UINT32 word; -} MPDU_DEN_CNT_STRUC, *PMPDU_DEN_CNT_STRUC; -#else -typedef union _MPDU_DEN_CNT_STRUC { - struct { - USHORT TXZeroDelCount; //TX zero length delimiter count - USHORT RXZeroDelCount; //RX zero length delimiter count - } field; - UINT32 word; -} MPDU_DEN_CNT_STRUC, *PMPDU_DEN_CNT_STRUC; -#endif -// -// TXRX control registers - base address 0x3000 -// -// rt2860b UNKNOWN reg use R/O Reg Addr 0x77d0 first.. -#define TXRX_CSR1 0x77d0 - -// -// Security key table memory, base address = 0x1000 -// -#define MAC_WCID_BASE 0x1800 //8-bytes(use only 6-bytes) * 256 entry = -#define HW_WCID_ENTRY_SIZE 8 -#define PAIRWISE_KEY_TABLE_BASE 0x4000 // 32-byte * 256-entry = -byte -#define HW_KEY_ENTRY_SIZE 0x20 -#define PAIRWISE_IVEIV_TABLE_BASE 0x6000 // 8-byte * 256-entry = -byte -#define MAC_IVEIV_TABLE_BASE 0x6000 // 8-byte * 256-entry = -byte -#define HW_IVEIV_ENTRY_SIZE 8 -#define MAC_WCID_ATTRIBUTE_BASE 0x6800 // 4-byte * 256-entry = -byte -#define HW_WCID_ATTRI_SIZE 4 -#define WCID_RESERVED 0x6bfc -#define SHARED_KEY_TABLE_BASE 0x6c00 // 32-byte * 16-entry = 512-byte -#define SHARED_KEY_MODE_BASE 0x7000 // 32-byte * 16-entry = 512-byte -#define HW_SHARED_KEY_MODE_SIZE 4 -#define SHAREDKEYTABLE 0 -#define PAIRWISEKEYTABLE 1 - - -#ifdef RT_BIG_ENDIAN -typedef union _SHAREDKEY_MODE_STRUC { - struct { - UINT32 :1; - UINT32 Bss1Key3CipherAlg:3; - UINT32 :1; - UINT32 Bss1Key2CipherAlg:3; - UINT32 :1; - UINT32 Bss1Key1CipherAlg:3; - UINT32 :1; - UINT32 Bss1Key0CipherAlg:3; - UINT32 :1; - UINT32 Bss0Key3CipherAlg:3; - UINT32 :1; - UINT32 Bss0Key2CipherAlg:3; - UINT32 :1; - UINT32 Bss0Key1CipherAlg:3; - UINT32 :1; - UINT32 Bss0Key0CipherAlg:3; - } field; - UINT32 word; -} SHAREDKEY_MODE_STRUC, *PSHAREDKEY_MODE_STRUC; -#else -typedef union _SHAREDKEY_MODE_STRUC { - struct { - UINT32 Bss0Key0CipherAlg:3; - UINT32 :1; - UINT32 Bss0Key1CipherAlg:3; - UINT32 :1; - UINT32 Bss0Key2CipherAlg:3; - UINT32 :1; - UINT32 Bss0Key3CipherAlg:3; - UINT32 :1; - UINT32 Bss1Key0CipherAlg:3; - UINT32 :1; - UINT32 Bss1Key1CipherAlg:3; - UINT32 :1; - UINT32 Bss1Key2CipherAlg:3; - UINT32 :1; - UINT32 Bss1Key3CipherAlg:3; - UINT32 :1; - } field; - UINT32 word; -} SHAREDKEY_MODE_STRUC, *PSHAREDKEY_MODE_STRUC; -#endif -// 64-entry for pairwise key table -typedef struct _HW_WCID_ENTRY { // 8-byte per entry - UCHAR Address[6]; - UCHAR Rsv[2]; -} HW_WCID_ENTRY, PHW_WCID_ENTRY; - - -// ================================================================================= -// WCID format -// ================================================================================= -//7.1 WCID ENTRY format : 8bytes -typedef struct _WCID_ENTRY_STRUC { - UCHAR RXBABitmap7; // bit0 for TID8, bit7 for TID 15 - UCHAR RXBABitmap0; // bit0 for TID0, bit7 for TID 7 - UCHAR MAC[6]; // 0 for shared key table. 1 for pairwise key table -} WCID_ENTRY_STRUC, *PWCID_ENTRY_STRUC; - -//8.1.1 SECURITY KEY format : 8DW -// 32-byte per entry, total 16-entry for shared key table, 64-entry for pairwise key table -typedef struct _HW_KEY_ENTRY { // 32-byte per entry - UCHAR Key[16]; - UCHAR TxMic[8]; - UCHAR RxMic[8]; -} HW_KEY_ENTRY, *PHW_KEY_ENTRY; - -//8.1.2 IV/EIV format : 2DW - -//8.1.3 RX attribute entry format : 1DW -#ifdef RT_BIG_ENDIAN -typedef struct _MAC_ATTRIBUTE_STRUC { - UINT32 rsv:22; - UINT32 RXWIUDF:3; - UINT32 BSSIDIdx:3; //multipleBSS index for the WCID - UINT32 PairKeyMode:3; - UINT32 KeyTab:1; // 0 for shared key table. 1 for pairwise key table -} MAC_ATTRIBUTE_STRUC, *PMAC_ATTRIBUTE_STRUC; -#else -typedef struct _MAC_ATTRIBUTE_STRUC { - UINT32 KeyTab:1; // 0 for shared key table. 1 for pairwise key table - UINT32 PairKeyMode:3; - UINT32 BSSIDIdx:3; //multipleBSS index for the WCID - UINT32 RXWIUDF:3; - UINT32 rsv:22; -} MAC_ATTRIBUTE_STRUC, *PMAC_ATTRIBUTE_STRUC; -#endif - - -// ================================================================================= -// HOST-MCU communication data structure -// ================================================================================= - -// -// H2M_MAILBOX_CSR: Host-to-MCU Mailbox -// -#ifdef RT_BIG_ENDIAN -typedef union _H2M_MAILBOX_STRUC { - struct { - UINT32 Owner:8; - UINT32 CmdToken:8; // 0xff tells MCU not to report CmdDoneInt after excuting the command - UINT32 HighByte:8; - UINT32 LowByte:8; - } field; - UINT32 word; -} H2M_MAILBOX_STRUC, *PH2M_MAILBOX_STRUC; -#else -typedef union _H2M_MAILBOX_STRUC { - struct { - UINT32 LowByte:8; - UINT32 HighByte:8; - UINT32 CmdToken:8; - UINT32 Owner:8; - } field; - UINT32 word; -} H2M_MAILBOX_STRUC, *PH2M_MAILBOX_STRUC; -#endif - -// -// M2H_CMD_DONE_CSR: MCU-to-Host command complete indication -// -#ifdef RT_BIG_ENDIAN -typedef union _M2H_CMD_DONE_STRUC { - struct { - UINT32 CmdToken3; - UINT32 CmdToken2; - UINT32 CmdToken1; - UINT32 CmdToken0; - } field; - UINT32 word; -} M2H_CMD_DONE_STRUC, *PM2H_CMD_DONE_STRUC; -#else -typedef union _M2H_CMD_DONE_STRUC { - struct { - UINT32 CmdToken0; - UINT32 CmdToken1; - UINT32 CmdToken2; - UINT32 CmdToken3; - } field; - UINT32 word; -} M2H_CMD_DONE_STRUC, *PM2H_CMD_DONE_STRUC; -#endif - - -//NAV_TIME_CFG :NAV -#ifdef RT_BIG_ENDIAN -typedef union _NAV_TIME_CFG_STRUC { - struct { - USHORT rsv:6; - USHORT ZeroSifs:1; // Applied zero SIFS timer after OFDM RX 0: disable - USHORT Eifs:9; // in unit of 1-us - UCHAR SlotTime; // in unit of 1-us - UCHAR Sifs; // in unit of 1-us - } field; - UINT32 word; -} NAV_TIME_CFG_STRUC, *PNAV_TIME_CFG_STRUC; -#else -typedef union _NAV_TIME_CFG_STRUC { - struct { - UCHAR Sifs; // in unit of 1-us - UCHAR SlotTime; // in unit of 1-us - USHORT Eifs:9; // in unit of 1-us - USHORT ZeroSifs:1; // Applied zero SIFS timer after OFDM RX 0: disable - USHORT rsv:6; - } field; - UINT32 word; -} NAV_TIME_CFG_STRUC, *PNAV_TIME_CFG_STRUC; -#endif - - -// -// RX_FILTR_CFG: /RX configuration register -// -#ifdef RT_BIG_ENDIAN -typedef union RX_FILTR_CFG_STRUC { - struct { - UINT32 :15; - UINT32 DropRsvCntlType:1; - - UINT32 DropBAR:1; // - UINT32 DropBA:1; // - UINT32 DropPsPoll:1; // Drop Ps-Poll - UINT32 DropRts:1; // Drop Ps-Poll - - UINT32 DropCts:1; // Drop Ps-Poll - UINT32 DropAck:1; // Drop Ps-Poll - UINT32 DropCFEnd:1; // Drop Ps-Poll - UINT32 DropCFEndAck:1; // Drop Ps-Poll - - UINT32 DropDuplicate:1; // Drop duplicate frame - UINT32 DropBcast:1; // Drop broadcast frames - UINT32 DropMcast:1; // Drop multicast frames - UINT32 DropVerErr:1; // Drop version error frame - - UINT32 DropNotMyBSSID:1; // Drop fram ToDs bit is true - UINT32 DropNotToMe:1; // Drop not to me unicast frame - UINT32 DropPhyErr:1; // Drop physical error - UINT32 DropCRCErr:1; // Drop CRC error - } field; - UINT32 word; -} RX_FILTR_CFG_STRUC, *PRX_FILTR_CFG_STRUC; -#else -typedef union _RX_FILTR_CFG_STRUC { - struct { - UINT32 DropCRCErr:1; // Drop CRC error - UINT32 DropPhyErr:1; // Drop physical error - UINT32 DropNotToMe:1; // Drop not to me unicast frame - UINT32 DropNotMyBSSID:1; // Drop fram ToDs bit is true - - UINT32 DropVerErr:1; // Drop version error frame - UINT32 DropMcast:1; // Drop multicast frames - UINT32 DropBcast:1; // Drop broadcast frames - UINT32 DropDuplicate:1; // Drop duplicate frame - - UINT32 DropCFEndAck:1; // Drop Ps-Poll - UINT32 DropCFEnd:1; // Drop Ps-Poll - UINT32 DropAck:1; // Drop Ps-Poll - UINT32 DropCts:1; // Drop Ps-Poll - - UINT32 DropRts:1; // Drop Ps-Poll - UINT32 DropPsPoll:1; // Drop Ps-Poll - UINT32 DropBA:1; // - UINT32 DropBAR:1; // - - UINT32 DropRsvCntlType:1; - UINT32 :15; - } field; - UINT32 word; -} RX_FILTR_CFG_STRUC, *PRX_FILTR_CFG_STRUC; -#endif - - - - -// -// PHY_CSR4: RF serial control register -// -#ifdef RT_BIG_ENDIAN -typedef union _PHY_CSR4_STRUC { - struct { - UINT32 Busy:1; // 1: ASIC is busy execute RF programming. - UINT32 PLL_LD:1; // RF PLL_LD status - UINT32 IFSelect:1; // 1: select IF to program, 0: select RF to program - UINT32 NumberOfBits:5; // Number of bits used in RFRegValue (I:20, RFMD:22) - UINT32 RFRegValue:24; // Register value (include register id) serial out to RF/IF chip. - } field; - UINT32 word; -} PHY_CSR4_STRUC, *PPHY_CSR4_STRUC; -#else -typedef union _PHY_CSR4_STRUC { - struct { - UINT32 RFRegValue:24; // Register value (include register id) serial out to RF/IF chip. - UINT32 NumberOfBits:5; // Number of bits used in RFRegValue (I:20, RFMD:22) - UINT32 IFSelect:1; // 1: select IF to program, 0: select RF to program - UINT32 PLL_LD:1; // RF PLL_LD status - UINT32 Busy:1; // 1: ASIC is busy execute RF programming. - } field; - UINT32 word; -} PHY_CSR4_STRUC, *PPHY_CSR4_STRUC; -#endif - - -// -// SEC_CSR5: shared key table security mode register -// -#ifdef RT_BIG_ENDIAN -typedef union _SEC_CSR5_STRUC { - struct { - UINT32 :1; - UINT32 Bss3Key3CipherAlg:3; - UINT32 :1; - UINT32 Bss3Key2CipherAlg:3; - UINT32 :1; - UINT32 Bss3Key1CipherAlg:3; - UINT32 :1; - UINT32 Bss3Key0CipherAlg:3; - UINT32 :1; - UINT32 Bss2Key3CipherAlg:3; - UINT32 :1; - UINT32 Bss2Key2CipherAlg:3; - UINT32 :1; - UINT32 Bss2Key1CipherAlg:3; - UINT32 :1; - UINT32 Bss2Key0CipherAlg:3; - } field; - UINT32 word; -} SEC_CSR5_STRUC, *PSEC_CSR5_STRUC; -#else -typedef union _SEC_CSR5_STRUC { - struct { - UINT32 Bss2Key0CipherAlg:3; - UINT32 :1; - UINT32 Bss2Key1CipherAlg:3; - UINT32 :1; - UINT32 Bss2Key2CipherAlg:3; - UINT32 :1; - UINT32 Bss2Key3CipherAlg:3; - UINT32 :1; - UINT32 Bss3Key0CipherAlg:3; - UINT32 :1; - UINT32 Bss3Key1CipherAlg:3; - UINT32 :1; - UINT32 Bss3Key2CipherAlg:3; - UINT32 :1; - UINT32 Bss3Key3CipherAlg:3; - UINT32 :1; - } field; - UINT32 word; -} SEC_CSR5_STRUC, *PSEC_CSR5_STRUC; -#endif - - -// -// HOST_CMD_CSR: For HOST to interrupt embedded processor -// -#ifdef RT_BIG_ENDIAN -typedef union _HOST_CMD_CSR_STRUC { - struct { - UINT32 Rsv:24; - UINT32 HostCommand:8; - } field; - UINT32 word; -} HOST_CMD_CSR_STRUC, *PHOST_CMD_CSR_STRUC; -#else -typedef union _HOST_CMD_CSR_STRUC { - struct { - UINT32 HostCommand:8; - UINT32 Rsv:24; - } field; - UINT32 word; -} HOST_CMD_CSR_STRUC, *PHOST_CMD_CSR_STRUC; -#endif - - -// -// AIFSN_CSR: AIFSN for each EDCA AC -// - - - -// -// E2PROM_CSR: EEPROM control register -// -#ifdef RT_BIG_ENDIAN -typedef union _E2PROM_CSR_STRUC { - struct { - UINT32 Rsvd:25; - UINT32 LoadStatus:1; // 1:loading, 0:done - UINT32 Type:1; // 1: 93C46, 0:93C66 - UINT32 EepromDO:1; - UINT32 EepromDI:1; - UINT32 EepromCS:1; - UINT32 EepromSK:1; - UINT32 Reload:1; // Reload EEPROM content, write one to reload, self-cleared. - } field; - UINT32 word; -} E2PROM_CSR_STRUC, *PE2PROM_CSR_STRUC; -#else -typedef union _E2PROM_CSR_STRUC { - struct { - UINT32 Reload:1; // Reload EEPROM content, write one to reload, self-cleared. - UINT32 EepromSK:1; - UINT32 EepromCS:1; - UINT32 EepromDI:1; - UINT32 EepromDO:1; - UINT32 Type:1; // 1: 93C46, 0:93C66 - UINT32 LoadStatus:1; // 1:loading, 0:done - UINT32 Rsvd:25; - } field; - UINT32 word; -} E2PROM_CSR_STRUC, *PE2PROM_CSR_STRUC; -#endif - -// -// QOS_CSR0: TXOP holder address0 register -// -#ifdef RT_BIG_ENDIAN -typedef union _QOS_CSR0_STRUC { - struct { - UCHAR Byte3; // MAC address byte 3 - UCHAR Byte2; // MAC address byte 2 - UCHAR Byte1; // MAC address byte 1 - UCHAR Byte0; // MAC address byte 0 - } field; - UINT32 word; -} QOS_CSR0_STRUC, *PQOS_CSR0_STRUC; -#else -typedef union _QOS_CSR0_STRUC { - struct { - UCHAR Byte0; // MAC address byte 0 - UCHAR Byte1; // MAC address byte 1 - UCHAR Byte2; // MAC address byte 2 - UCHAR Byte3; // MAC address byte 3 - } field; - UINT32 word; -} QOS_CSR0_STRUC, *PQOS_CSR0_STRUC; -#endif - -// -// QOS_CSR1: TXOP holder address1 register -// -#ifdef RT_BIG_ENDIAN -typedef union _QOS_CSR1_STRUC { - struct { - UCHAR Rsvd1; - UCHAR Rsvd0; - UCHAR Byte5; // MAC address byte 5 - UCHAR Byte4; // MAC address byte 4 - } field; - UINT32 word; -} QOS_CSR1_STRUC, *PQOS_CSR1_STRUC; -#else -typedef union _QOS_CSR1_STRUC { - struct { - UCHAR Byte4; // MAC address byte 4 - UCHAR Byte5; // MAC address byte 5 - UCHAR Rsvd0; - UCHAR Rsvd1; - } field; - UINT32 word; -} QOS_CSR1_STRUC, *PQOS_CSR1_STRUC; -#endif - -#define RF_CSR_CFG 0x500 -#ifdef RT_BIG_ENDIAN -typedef union _RF_CSR_CFG_STRUC { - struct { - UINT Rsvd1:14; // Reserved - UINT RF_CSR_KICK:1; // kick RF register read/write - UINT RF_CSR_WR:1; // 0: read 1: write - UINT Rsvd2:3; // Reserved - UINT TESTCSR_RFACC_REGNUM:5; // RF register ID - UINT RF_CSR_DATA:8; // DATA - } field; - UINT word; -} RF_CSR_CFG_STRUC, *PRF_CSR_CFG_STRUC; -#else -typedef union _RF_CSR_CFG_STRUC { - struct { - UINT RF_CSR_DATA:8; // DATA - UINT TESTCSR_RFACC_REGNUM:5; // RF register ID - UINT Rsvd2:3; // Reserved - UINT RF_CSR_WR:1; // 0: read 1: write - UINT RF_CSR_KICK:1; // kick RF register read/write - UINT Rsvd1:14; // Reserved - } field; - UINT word; -} RF_CSR_CFG_STRUC, *PRF_CSR_CFG_STRUC; -#endif - - -// -// Other on-chip shared memory space, base = 0x2000 -// - -// CIS space - base address = 0x2000 -#define HW_CIS_BASE 0x2000 - -// Carrier-sense CTS frame base address. It's where mac stores carrier-sense frame for carrier-sense function. -#define HW_CS_CTS_BASE 0x7700 -// DFS CTS frame base address. It's where mac stores CTS frame for DFS. -#define HW_DFS_CTS_BASE 0x7780 -#define HW_CTS_FRAME_SIZE 0x80 - -// 2004-11-08 john - since NULL frame won't be that long (256 byte). We steal 16 tail bytes -// to save debugging settings -#define HW_DEBUG_SETTING_BASE 0x77f0 // 0x77f0~0x77ff total 16 bytes -#define HW_DEBUG_SETTING_BASE2 0x7770 // 0x77f0~0x77ff total 16 bytes - -// In order to support maximum 8 MBSS and its maximum length is 512 for each beacon -// Three section discontinue memory segments will be used. -// 1. The original region for BCN 0~3 -// 2. Extract memory from FCE table for BCN 4~5 -// 3. Extract memory from Pair-wise key table for BCN 6~7 -// It occupied those memory of wcid 238~253 for BCN 6 -// and wcid 222~237 for BCN 7 -#define HW_BEACON_MAX_SIZE 0x1000 /* unit: byte */ -#define HW_BEACON_BASE0 0x7800 -#define HW_BEACON_BASE1 0x7A00 -#define HW_BEACON_BASE2 0x7C00 -#define HW_BEACON_BASE3 0x7E00 -#define HW_BEACON_BASE4 0x7200 -#define HW_BEACON_BASE5 0x7400 -#define HW_BEACON_BASE6 0x5DC0 -#define HW_BEACON_BASE7 0x5BC0 - -#define HW_BEACON_MAX_COUNT 8 -#define HW_BEACON_OFFSET 0x0200 -#define HW_BEACON_CONTENT_LEN (HW_BEACON_OFFSET - TXWI_SIZE) - -// HOST-MCU shared memory - base address = 0x2100 -#define HOST_CMD_CSR 0x404 -#define H2M_MAILBOX_CSR 0x7010 -#define H2M_MAILBOX_CID 0x7014 -#define H2M_MAILBOX_STATUS 0x701c -#define H2M_INT_SRC 0x7024 -#define H2M_BBP_AGENT 0x7028 -#define M2H_CMD_DONE_CSR 0x000c -#define MCU_TXOP_ARRAY_BASE 0x000c // TODO: to be provided by Albert -#define MCU_TXOP_ENTRY_SIZE 32 // TODO: to be provided by Albert -#define MAX_NUM_OF_TXOP_ENTRY 16 // TODO: must be same with 8051 firmware -#define MCU_MBOX_VERSION 0x01 // TODO: to be confirmed by Albert -#define MCU_MBOX_VERSION_OFFSET 5 // TODO: to be provided by Albert - -// -// Host DMA registers - base address 0x200 . TX0-3=EDCAQid0-3, TX4=HCCA, TX5=MGMT, -// -// -// DMA RING DESCRIPTOR -// -#define E2PROM_CSR 0x0004 -#define IO_CNTL_CSR 0x77d0 - - - -// ================================================================ -// Tx / Rx / Mgmt ring descriptor definition -// ================================================================ - -// the following PID values are used to mark outgoing frame type in TXD->PID so that -// proper TX statistics can be collected based on these categories -// b3-2 of PID field - -#define PID_MGMT 0x05 -#define PID_BEACON 0x0c -#define PID_DATA_NORMALUCAST 0x02 -#define PID_DATA_AMPDU 0x04 -#define PID_DATA_NO_ACK 0x08 -#define PID_DATA_NOT_NORM_ACK 0x03 -// value domain of pTxD->HostQId (4-bit: 0~15) -#define QID_AC_BK 1 // meet ACI definition in 802.11e -#define QID_AC_BE 0 // meet ACI definition in 802.11e -#define QID_AC_VI 2 -#define QID_AC_VO 3 -#define QID_HCCA 4 -//#define NUM_OF_TX_RING 5 -#define NUM_OF_TX_RING 4 -#define QID_MGMT 13 -#define QID_RX 14 -#define QID_OTHER 15 - -#endif // __RTMP_MAC_H__ // diff --git a/drivers/staging/rt3090/rtmp_mcu.h b/drivers/staging/rt3090/rtmp_mcu.h deleted file mode 100644 index e1b2fee9e105..000000000000 --- a/drivers/staging/rt3090/rtmp_mcu.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rtmp_mcu.h - - Abstract: - Miniport header file for mcu related information - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#ifndef __RTMP_MCU_H__ -#define __RTMP_MCU_H__ - - -INT RtmpAsicEraseFirmware( - IN PRTMP_ADAPTER pAd); - -NDIS_STATUS RtmpAsicLoadFirmware( - IN PRTMP_ADAPTER pAd); - -INT RtmpAsicSendCommandToMcu( - IN PRTMP_ADAPTER pAd, - IN UCHAR Command, - IN UCHAR Token, - IN UCHAR Arg0, - IN UCHAR Arg1); - -#endif // __RTMP_MCU_H__ // diff --git a/drivers/staging/rt3090/rtmp_os.h b/drivers/staging/rt3090/rtmp_os.h deleted file mode 100644 index 5646b2dfd6a8..000000000000 --- a/drivers/staging/rt3090/rtmp_os.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rtmp_os.h - - Abstract: - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- - */ - - -#ifndef __RTMP_OS_H__ -#define __RTMP_OS_H__ - -#ifdef LINUX -#include "rt_linux.h" -#endif // LINUX // - - -/* - This data structure mainly strip some callback function defined in - "struct net_device" in kernel source "include/linux/netdevice.h". - - The definition of this data structure may various depends on different - OS. Use it carefully. -*/ -typedef struct _RTMP_OS_NETDEV_OP_HOOK_ -{ - const struct net_device_ops *netdev_ops; - void *priv; - int priv_flags; - unsigned char devAddr[6]; - unsigned char devName[16]; - unsigned char needProtcted; -}RTMP_OS_NETDEV_OP_HOOK, *PRTMP_OS_NETDEV_OP_HOOK; - - -typedef enum _RTMP_TASK_STATUS_ -{ - RTMP_TASK_STAT_UNKNOWN = 0, - RTMP_TASK_STAT_INITED = 1, - RTMP_TASK_STAT_RUNNING = 2, - RTMP_TASK_STAT_STOPED = 4, -}RTMP_TASK_STATUS; -#define RTMP_TASK_CAN_DO_INSERT (RTMP_TASK_STAT_INITED |RTMP_TASK_STAT_RUNNING) - -#define RTMP_OS_TASK_NAME_LEN 16 -typedef struct _RTMP_OS_TASK_ -{ - char taskName[RTMP_OS_TASK_NAME_LEN]; - void *priv; - //unsigned long taskFlags; - RTMP_TASK_STATUS taskStatus; -#ifndef KTHREAD_SUPPORT - RTMP_OS_SEM taskSema; - RTMP_OS_PID taskPID; - struct completion taskComplete; -#endif - unsigned char task_killed; -#ifdef KTHREAD_SUPPORT - struct task_struct *kthread_task; - wait_queue_head_t kthread_q; - BOOLEAN kthread_running; -#endif -}RTMP_OS_TASK; - -#endif // __RMTP_OS_H__ // diff --git a/drivers/staging/rt3090/rtmp_pci.h b/drivers/staging/rt3090/rtmp_pci.h deleted file mode 100644 index c2fed29058f4..000000000000 --- a/drivers/staging/rt3090/rtmp_pci.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* -*/ - - -#ifndef __RTMP_PCI_H__ -#define __RTMP_PCI_H__ - -#define RT28XX_HANDLE_DEV_ASSIGN(handle, dev_p) \ - ((POS_COOKIE)handle)->pci_dev = dev_p; - - -#ifdef LINUX -// set driver data -#define RT28XX_DRVDATA_SET(_a) pci_set_drvdata(_a, net_dev); - -#define RT28XX_PUT_DEVICE(dev_p) - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) -#define SA_SHIRQ IRQF_SHARED -#endif - -#ifdef PCI_MSI_SUPPORT -#define RTMP_MSI_ENABLE(_pAd) \ -{ POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \ - (_pAd)->HaveMsi = pci_enable_msi(_pObj->pci_dev) == 0 ? TRUE : FALSE; } - -#define RTMP_MSI_DISABLE(_pAd) \ -{ POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \ - if (_pAd->HaveMsi == TRUE) \ - pci_disable_msi(_pObj->pci_dev); \ - _pAd->HaveMsi = FALSE; } -#else -#define RTMP_MSI_ENABLE(_pAd) -#define RTMP_MSI_DISABLE(_pAd) -#endif // PCI_MSI_SUPPORT // - - -#define RTMP_PCI_DEV_UNMAP() \ -{ if (net_dev->base_addr) { \ - iounmap((void *)(net_dev->base_addr)); \ - release_mem_region(pci_resource_start(dev_p, 0), \ - pci_resource_len(dev_p, 0)); } \ - if (net_dev->irq) pci_release_regions(dev_p); } - - -#define RTMP_IRQ_REQUEST(net_dev) \ -{ PRTMP_ADAPTER _pAd = (PRTMP_ADAPTER)(RTMP_OS_NETDEV_GET_PRIV(net_dev)); \ - POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \ - RTMP_MSI_ENABLE(_pAd); \ - if ((retval = request_irq(_pObj->pci_dev->irq, \ - rt2860_interrupt, SA_SHIRQ, \ - (net_dev)->name, (net_dev)))) { \ - DBGPRINT(RT_DEBUG_ERROR, ("request_irq error(%d)\n", retval)); \ - return retval; } } - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) -#define RTMP_IRQ_RELEASE(net_dev) \ -{ PRTMP_ADAPTER _pAd = (PRTMP_ADAPTER)(RTMP_OS_NETDEV_GET_PRIV(net_dev)); \ - POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \ - synchronize_irq(_pObj->pci_dev->irq); \ - free_irq(_pObj->pci_dev->irq, (net_dev)); \ - RTMP_MSI_DISABLE(_pAd); } -#else -#define RTMP_IRQ_RELEASE(net_dev) \ -{ PRTMP_ADAPTER _pAd = (PRTMP_ADAPTER)(RTMP_OS_NETDEV_GET_PRIV(net_dev)); \ - POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \ - free_irq(_pObj->pci_dev->irq, (net_dev)); \ - RTMP_MSI_DISABLE(_pAd); } -#endif - -#define PCI_REG_READ_WORD(pci_dev, offset, Configuration) \ - if (pci_read_config_word(pci_dev, offset, ®16) == 0) \ - Configuration = le2cpu16(reg16); \ - else \ - Configuration = 0; - -#define PCI_REG_WIRTE_WORD(pci_dev, offset, Configuration) \ - reg16 = cpu2le16(Configuration); \ - pci_write_config_word(pci_dev, offset, reg16); \ - -#endif // LINUX // - - - - -#endif // __RTMP_PCI_H__ // diff --git a/drivers/staging/rt3090/rtmp_phy.h b/drivers/staging/rt3090/rtmp_phy.h deleted file mode 100644 index b9848cac282e..000000000000 --- a/drivers/staging/rt3090/rtmp_phy.h +++ /dev/null @@ -1,631 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rtmp_phy.h - - Abstract: - Ralink Wireless Chip PHY(BBP/RF) related definition & structures - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#ifndef __RTMP_PHY_H__ -#define __RTMP_PHY_H__ - - -/* - RF sections -*/ -#define RF_R00 0 -#define RF_R01 1 -#define RF_R02 2 -#define RF_R03 3 -#define RF_R04 4 -#define RF_R05 5 -#define RF_R06 6 -#define RF_R07 7 -#define RF_R08 8 -#define RF_R09 9 -#define RF_R10 10 -#define RF_R11 11 -#define RF_R12 12 -#define RF_R13 13 -#define RF_R14 14 -#define RF_R15 15 -#define RF_R16 16 -#define RF_R17 17 -#define RF_R18 18 -#define RF_R19 19 -#define RF_R20 20 -#define RF_R21 21 -#define RF_R22 22 -#define RF_R23 23 -#define RF_R24 24 -#define RF_R25 25 -#define RF_R26 26 -#define RF_R27 27 -#define RF_R28 28 -#define RF_R29 29 -#define RF_R30 30 -#define RF_R31 31 - - -// value domain of pAd->RfIcType -#define RFIC_2820 1 // 2.4G 2T3R -#define RFIC_2850 2 // 2.4G/5G 2T3R -#define RFIC_2720 3 // 2.4G 1T2R -#define RFIC_2750 4 // 2.4G/5G 1T2R -#define RFIC_3020 5 // 2.4G 1T1R -#define RFIC_2020 6 // 2.4G B/G -#define RFIC_3021 7 // 2.4G 1T2R -#define RFIC_3022 8 // 2.4G 2T2R -#define RFIC_3052 9 // 2.4G/5G 2T2R - -/* - BBP sections -*/ -#define BBP_R0 0 // version -#define BBP_R1 1 // TSSI -#define BBP_R2 2 // TX configure -#define BBP_R3 3 -#define BBP_R4 4 -#define BBP_R5 5 -#define BBP_R6 6 -#define BBP_R14 14 // RX configure -#define BBP_R16 16 -#define BBP_R17 17 // RX sensibility -#define BBP_R18 18 -#define BBP_R21 21 -#define BBP_R22 22 -#define BBP_R24 24 -#define BBP_R25 25 -#define BBP_R26 26 -#define BBP_R27 27 -#define BBP_R31 31 -#define BBP_R49 49 //TSSI -#define BBP_R50 50 -#define BBP_R51 51 -#define BBP_R52 52 -#define BBP_R55 55 -#define BBP_R62 62 // Rx SQ0 Threshold HIGH -#define BBP_R63 63 -#define BBP_R64 64 -#define BBP_R65 65 -#define BBP_R66 66 -#define BBP_R67 67 -#define BBP_R68 68 -#define BBP_R69 69 -#define BBP_R70 70 // Rx AGC SQ CCK Xcorr threshold -#define BBP_R73 73 -#define BBP_R75 75 -#define BBP_R77 77 -#define BBP_R78 78 -#define BBP_R79 79 -#define BBP_R80 80 -#define BBP_R81 81 -#define BBP_R82 82 -#define BBP_R83 83 -#define BBP_R84 84 -#define BBP_R86 86 -#define BBP_R91 91 -#define BBP_R92 92 -#define BBP_R94 94 // Tx Gain Control -#define BBP_R103 103 -#define BBP_R105 105 -#define BBP_R106 106 -#define BBP_R113 113 -#define BBP_R114 114 -#define BBP_R115 115 -#define BBP_R116 116 -#define BBP_R117 117 -#define BBP_R118 118 -#define BBP_R119 119 -#define BBP_R120 120 -#define BBP_R121 121 -#define BBP_R122 122 -#define BBP_R123 123 -#ifdef RT30xx -#define BBP_R138 138 // add by johnli, RF power sequence setup, ADC dynamic on/off control -#endif // RT30xx // - - -#define BBPR94_DEFAULT 0x06 // Add 1 value will gain 1db - - -#ifdef MERGE_ARCH_TEAM - #define MAX_BBP_ID 200 - #define MAX_BBP_MSG_SIZE 4096 -#else -#ifdef RT30xx - // edit by johnli, RF power sequence setup, add BBP R138 for ADC dynamic on/off control - #define MAX_BBP_ID 138 -#endif // RT30xx // -#ifndef RT30xx - #define MAX_BBP_ID 136 -#endif // RT30xx // - #define MAX_BBP_MSG_SIZE 2048 -#endif // MERGE_ARCH_TEAM // - - -// -// BBP & RF are using indirect access. Before write any value into it. -// We have to make sure there is no outstanding command pending via checking busy bit. -// -#define MAX_BUSY_COUNT 100 // Number of retry before failing access BBP & RF indirect register - -//#define PHY_TR_SWITCH_TIME 5 // usec - -//#define BBP_R17_LOW_SENSIBILITY 0x50 -//#define BBP_R17_MID_SENSIBILITY 0x41 -//#define BBP_R17_DYNAMIC_UP_BOUND 0x40 - -#define RSSI_FOR_VERY_LOW_SENSIBILITY -35 -#define RSSI_FOR_LOW_SENSIBILITY -58 -#define RSSI_FOR_MID_LOW_SENSIBILITY -80 -#define RSSI_FOR_MID_SENSIBILITY -90 - -/***************************************************************************** - RF register Read/Write marco definition - *****************************************************************************/ -#ifdef RTMP_MAC_PCI -#define RTMP_RF_IO_WRITE32(_A, _V) \ -{ \ - if ((_A)->bPCIclkOff == FALSE) \ - { \ - PHY_CSR4_STRUC _value; \ - ULONG _busyCnt = 0; \ - \ - do { \ - RTMP_IO_READ32((_A), RF_CSR_CFG0, &_value.word); \ - if (_value.field.Busy == IDLE) \ - break; \ - _busyCnt++; \ - }while (_busyCnt < MAX_BUSY_COUNT); \ - if(_busyCnt < MAX_BUSY_COUNT) \ - { \ - RTMP_IO_WRITE32((_A), RF_CSR_CFG0, (_V)); \ - } \ - } \ -} -#endif // RTMP_MAC_PCI // - - - -#ifdef RT30xx -#define RTMP_RF_IO_READ8_BY_REG_ID(_A, _I, _pV) RT30xxReadRFRegister(_A, _I, _pV) -#define RTMP_RF_IO_WRITE8_BY_REG_ID(_A, _I, _V) RT30xxWriteRFRegister(_A, _I, _V) -#endif // RT30xx // - - -/***************************************************************************** - BBP register Read/Write marco definitions. - we read/write the bbp value by register's ID. - Generate PER to test BA - *****************************************************************************/ -#ifdef RTMP_MAC_PCI -/* - basic marco for BBP read operation. - _pAd: the data structure pointer of RTMP_ADAPTER - _bbpID : the bbp register ID - _pV: data pointer used to save the value of queried bbp register. - _bViaMCU: if we need access the bbp via the MCU. -*/ -#define RTMP_BBP_IO_READ8(_pAd, _bbpID, _pV, _bViaMCU) \ - do{ \ - BBP_CSR_CFG_STRUC BbpCsr; \ - int _busyCnt, _secCnt, _regID; \ - \ - _regID = ((_bViaMCU) == TRUE ? H2M_BBP_AGENT : BBP_CSR_CFG); \ - for (_busyCnt=0; _busyCntBbpWriteLatch[_bbpID]; \ - if ((_bViaMCU) == TRUE) \ - { \ - RTMP_IO_READ32(_pAd, _regID, &BbpCsr.word); \ - BbpCsr.field.Busy = 0; \ - RTMP_IO_WRITE32(_pAd, _regID, BbpCsr.word); \ - } \ - } \ - }while(0) - -/* - This marco used for the BBP read operation which didn't need via MCU. -*/ -#define BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \ - RTMP_BBP_IO_READ8((_A), (_I), (_pV), FALSE) - -/* - This marco used for the BBP read operation which need via MCU. - But for some chipset which didn't have mcu (e.g., RBUS based chipset), we - will use this function too and didn't access the bbp register via the MCU. -*/ -#ifndef CONFIG_STA_SUPPORT -#define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \ - do{ \ - if ((_A)->bPCIclkOff == FALSE) \ - { \ - if ((_A)->infType == RTMP_DEV_INF_RBUS) \ - RTMP_BBP_IO_READ8((_A), (_I), (_pV), FALSE); \ - else \ - RTMP_BBP_IO_READ8((_A), (_I), (_pV), TRUE); \ - } \ - }while(0) -#endif // CONFIG_STA_SUPPORT // -#ifdef CONFIG_STA_SUPPORT -// Read BBP register by register's ID. Generate PER to test BA -#define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \ -{ \ - BBP_CSR_CFG_STRUC BbpCsr; \ - int i, k; \ - BOOLEAN brc; \ - BbpCsr.field.Busy = IDLE; \ - if ((IS_RT3090((_A)) || IS_RT3572((_A)) || IS_RT3390((_A))) && ((_A)->StaCfg.PSControl.field.rt30xxPowerMode == 3) \ - && ((_A)->StaCfg.PSControl.field.EnableNewPS == TRUE) \ - && ((_A)->bPCIclkOff == FALSE) \ - && ((_A)->brt30xxBanMcuCmd == FALSE)) \ - { \ - for (i=0; iStaCfg.PSControl.field.rt30xxPowerMode == 3) \ - && ((_A)->StaCfg.PSControl.field.EnableNewPS == TRUE)) \ - && ((_A)->bPCIclkOff == FALSE)) \ - { \ - for (i=0; ibrt30xxBanMcuCmd, (_I))); \ - *(_pV) = (_A)->BbpWriteLatch[_I]; \ - } \ - if ((BbpCsr.field.Busy == BUSY) || ((_A)->bPCIclkOff == TRUE)) \ - { \ - DBGPRINT_ERR(("BBP read R%d=0x%x fail\n", _I, BbpCsr.word)); \ - *(_pV) = (_A)->BbpWriteLatch[_I]; \ - } \ -} -#endif // CONFIG_STA_SUPPORT // - -/* - basic marco for BBP write operation. - _pAd: the data structure pointer of RTMP_ADAPTER - _bbpID : the bbp register ID - _pV: data used to save the value of queried bbp register. - _bViaMCU: if we need access the bbp via the MCU. -*/ -#define RTMP_BBP_IO_WRITE8(_pAd, _bbpID, _pV, _bViaMCU) \ - do{ \ - BBP_CSR_CFG_STRUC BbpCsr; \ - int _busyCnt, _regID; \ - \ - _regID = ((_bViaMCU) == TRUE ? H2M_BBP_AGENT : BBP_CSR_CFG); \ - for (_busyCnt=0; _busyCntOpMode == OPMODE_AP) \ - RTMPusecDelay(1000); \ - } \ - (_pAd)->BbpWriteLatch[_bbpID] = _pV; \ - break; \ - } \ - if (_busyCnt == MAX_BUSY_COUNT) \ - { \ - DBGPRINT_ERR(("BBP write R%d fail\n", _bbpID)); \ - if((_bViaMCU) == TRUE) \ - { \ - RTMP_IO_READ32(_pAd, H2M_BBP_AGENT, &BbpCsr.word); \ - BbpCsr.field.Busy = 0; \ - RTMP_IO_WRITE32(_pAd, H2M_BBP_AGENT, BbpCsr.word); \ - } \ - } \ - }while(0) - - -/* - This marco used for the BBP write operation which didn't need via MCU. -*/ -#define BBP_IO_WRITE8_BY_REG_ID(_A, _I, _pV) \ - RTMP_BBP_IO_WRITE8((_A), (_I), (_pV), FALSE) - -/* - This marco used for the BBP write operation which need via MCU. - But for some chipset which didn't have mcu (e.g., RBUS based chipset), we - will use this function too and didn't access the bbp register via the MCU. -*/ -#ifndef CONFIG_STA_SUPPORT -#define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _pV) \ - do{ \ - if ((_A)->bPCIclkOff == FALSE) \ - { \ - if ((_A)->infType == RTMP_DEV_INF_RBUS) \ - RTMP_BBP_IO_WRITE8((_A), (_I), (_pV), FALSE); \ - else \ - RTMP_BBP_IO_WRITE8((_A), (_I), (_pV), TRUE); \ - } \ - }while(0) -#endif // CONFIG_STA_SUPPORT // -#ifdef CONFIG_STA_SUPPORT -// Write BBP register by register's ID & value -#define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \ -{ \ - BBP_CSR_CFG_STRUC BbpCsr; \ - INT BusyCnt = 0; \ - BOOLEAN brc; \ - if (_I < MAX_NUM_OF_BBP_LATCH) \ - { \ - if ((IS_RT3090((_A)) || IS_RT3572((_A)) || IS_RT3390((_A))) && ((_A)->StaCfg.PSControl.field.rt30xxPowerMode == 3) \ - && ((_A)->StaCfg.PSControl.field.EnableNewPS == TRUE) \ - && ((_A)->bPCIclkOff == FALSE) \ - && ((_A)->brt30xxBanMcuCmd == FALSE)) \ - { \ - if (_A->AccessBBPFailCount > 20) \ - { \ - AsicResetBBPAgent(_A); \ - _A->AccessBBPFailCount = 0; \ - } \ - for (BusyCnt=0; BusyCntBbpWriteLatch[_I] = _V; \ - } \ - else \ - { \ - BbpCsr.field.Busy = 0; \ - RTMP_IO_WRITE32(_A, H2M_BBP_AGENT, BbpCsr.word); \ - } \ - break; \ - } \ - } \ - else if (!((IS_RT3090((_A)) || IS_RT3572((_A)) || IS_RT3390((_A))) && ((_A)->StaCfg.PSControl.field.rt30xxPowerMode == 3) \ - && ((_A)->StaCfg.PSControl.field.EnableNewPS == TRUE)) \ - && ((_A)->bPCIclkOff == FALSE)) \ - { \ - if (_A->AccessBBPFailCount > 20) \ - { \ - AsicResetBBPAgent(_A); \ - _A->AccessBBPFailCount = 0; \ - } \ - for (BusyCnt=0; BusyCntBbpWriteLatch[_I] = _V; \ - break; \ - } \ - } \ - else \ - { \ - DBGPRINT_ERR((" brt30xxBanMcuCmd = %d. Write BBP %d \n", (_A)->brt30xxBanMcuCmd, (_I))); \ - } \ - if ((BusyCnt == MAX_BUSY_COUNT) || ((_A)->bPCIclkOff == TRUE)) \ - { \ - if (BusyCnt == MAX_BUSY_COUNT) \ - (_A)->AccessBBPFailCount++; \ - DBGPRINT_ERR(("BBP write R%d=0x%x fail. BusyCnt= %d.bPCIclkOff = %d. \n", _I, BbpCsr.word, BusyCnt, (_A)->bPCIclkOff )); \ - } \ - } \ - else \ - { \ - DBGPRINT_ERR(("****** BBP_Write_Latch Buffer exceeds max boundry ****** \n")); \ - } \ -} -#endif // CONFIG_STA_SUPPORT // -#endif // RTMP_MAC_PCI // - - - -#ifdef RT30xx -//Need to collect each ant's rssi concurrently -//rssi1 is report to pair2 Ant and rss2 is reprot to pair1 Ant when 4 Ant -#define COLLECT_RX_ANTENNA_AVERAGE_RSSI(_pAd, _rssi1, _rssi2) \ -{ \ - SHORT AvgRssi; \ - UCHAR UsedAnt; \ - if (_pAd->RxAnt.EvaluatePeriod == 0) \ - { \ - UsedAnt = _pAd->RxAnt.Pair1PrimaryRxAnt; \ - AvgRssi = _pAd->RxAnt.Pair1AvgRssi[UsedAnt]; \ - if (AvgRssi < 0) \ - AvgRssi = AvgRssi - (AvgRssi >> 3) + _rssi1; \ - else \ - AvgRssi = _rssi1 << 3; \ - _pAd->RxAnt.Pair1AvgRssi[UsedAnt] = AvgRssi; \ - } \ - else \ - { \ - UsedAnt = _pAd->RxAnt.Pair1SecondaryRxAnt; \ - AvgRssi = _pAd->RxAnt.Pair1AvgRssi[UsedAnt]; \ - if ((AvgRssi < 0) && (_pAd->RxAnt.FirstPktArrivedWhenEvaluate)) \ - AvgRssi = AvgRssi - (AvgRssi >> 3) + _rssi1; \ - else \ - { \ - _pAd->RxAnt.FirstPktArrivedWhenEvaluate = TRUE; \ - AvgRssi = _rssi1 << 3; \ - } \ - _pAd->RxAnt.Pair1AvgRssi[UsedAnt] = AvgRssi; \ - _pAd->RxAnt.RcvPktNumWhenEvaluate++; \ - } \ -} - -#define RTMP_ASIC_MMPS_DISABLE(_pAd) \ - do{ \ - UCHAR _bbpData; \ - UINT32 _macData; \ - /* disable MMPS BBP control register */ \ - RTMP_BBP_IO_READ8_BY_REG_ID(_pAd, BBP_R3, &_bbpData); \ - _bbpData &= ~(0x04); /*bit 2*/ \ - RTMP_BBP_IO_WRITE8_BY_REG_ID(_pAd, BBP_R3, _bbpData); \ - \ - /* disable MMPS MAC control register */ \ - RTMP_IO_READ32(_pAd, 0x1210, &_macData); \ - _macData &= ~(0x09); /*bit 0, 3*/ \ - RTMP_IO_WRITE32(_pAd, 0x1210, _macData); \ - }while(0) - - -#define RTMP_ASIC_MMPS_ENABLE(_pAd) \ - do{ \ - UCHAR _bbpData; \ - UINT32 _macData; \ - /* enable MMPS BBP control register */ \ - RTMP_BBP_IO_READ8_BY_REG_ID(_pAd, BBP_R3, &_bbpData); \ - _bbpData |= (0x04); /*bit 2*/ \ - RTMP_BBP_IO_WRITE8_BY_REG_ID(_pAd, BBP_R3, _bbpData); \ - \ - /* enable MMPS MAC control register */ \ - RTMP_IO_READ32(_pAd, 0x1210, &_macData); \ - _macData |= (0x09); /*bit 0, 3*/ \ - RTMP_IO_WRITE32(_pAd, 0x1210, _macData); \ - }while(0) - -#endif // RT30xx // - -#endif // __RTMP_PHY_H__ // diff --git a/drivers/staging/rt3090/rtmp_timer.h b/drivers/staging/rt3090/rtmp_timer.h deleted file mode 100644 index dfac124ebf14..000000000000 --- a/drivers/staging/rt3090/rtmp_timer.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rtmp_timer.h - - Abstract: - Ralink Wireless Driver timer related data structures and delcarations - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Name Date Modification logs - Shiang Tu Aug-28-2008 init version - -*/ - -#ifndef __RTMP_TIMER_H__ -#define __RTMP_TIMER_H__ - -#include "rtmp_os.h" - - -#define DECLARE_TIMER_FUNCTION(_func) \ - void rtmp_timer_##_func(unsigned long data) - -#define GET_TIMER_FUNCTION(_func) \ - rtmp_timer_##_func - - -/* ----------------- Timer Related MARCO ---------------*/ -// In some os or chipset, we have a lot of timer functions and will read/write register, -// it's not allowed in Linux USB sub-system to do it ( because of sleep issue when -// submit to ctrl pipe). So we need a wrapper function to take care it. - -#ifdef RTMP_TIMER_TASK_SUPPORT -typedef VOID (*RTMP_TIMER_TASK_HANDLE)( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); -#endif // RTMP_TIMER_TASK_SUPPORT // - -typedef struct _RALINK_TIMER_STRUCT { - RTMP_OS_TIMER TimerObj; // Ndis Timer object - BOOLEAN Valid; // Set to True when call RTMPInitTimer - BOOLEAN State; // True if timer cancelled - BOOLEAN PeriodicType; // True if timer is periodic timer - BOOLEAN Repeat; // True if periodic timer - ULONG TimerValue; // Timer value in milliseconds - ULONG cookie; // os specific object -#ifdef RTMP_TIMER_TASK_SUPPORT - RTMP_TIMER_TASK_HANDLE handle; - void *pAd; -#endif // RTMP_TIMER_TASK_SUPPORT // -}RALINK_TIMER_STRUCT, *PRALINK_TIMER_STRUCT; - - -#ifdef RTMP_TIMER_TASK_SUPPORT -typedef struct _RTMP_TIMER_TASK_ENTRY_ -{ - RALINK_TIMER_STRUCT *pRaTimer; - struct _RTMP_TIMER_TASK_ENTRY_ *pNext; -}RTMP_TIMER_TASK_ENTRY; - - -#define TIMER_QUEUE_SIZE_MAX 128 -typedef struct _RTMP_TIMER_TASK_QUEUE_ -{ - unsigned int status; - unsigned char *pTimerQPoll; - RTMP_TIMER_TASK_ENTRY *pQPollFreeList; - RTMP_TIMER_TASK_ENTRY *pQHead; - RTMP_TIMER_TASK_ENTRY *pQTail; -}RTMP_TIMER_TASK_QUEUE; - -#define BUILD_TIMER_FUNCTION(_func) \ -void rtmp_timer_##_func(unsigned long data) \ -{ \ - PRALINK_TIMER_STRUCT _pTimer = (PRALINK_TIMER_STRUCT)data; \ - RTMP_TIMER_TASK_ENTRY *_pQNode; \ - RTMP_ADAPTER *_pAd; \ - \ - _pTimer->handle = _func; \ - _pAd = (RTMP_ADAPTER *)_pTimer->pAd; \ - _pQNode = RtmpTimerQInsert(_pAd, _pTimer); \ - if ((_pQNode == NULL) && (_pAd->TimerQ.status & RTMP_TASK_CAN_DO_INSERT)) \ - RTMP_OS_Add_Timer(&_pTimer->TimerObj, OS_HZ); \ -} -#else -#define BUILD_TIMER_FUNCTION(_func) \ -void rtmp_timer_##_func(unsigned long data) \ -{ \ - PRALINK_TIMER_STRUCT pTimer = (PRALINK_TIMER_STRUCT) data; \ - \ - _func(NULL, (PVOID) pTimer->cookie, NULL, pTimer); \ - if (pTimer->Repeat) \ - RTMP_OS_Add_Timer(&pTimer->TimerObj, pTimer->TimerValue); \ -} -#endif // RTMP_TIMER_TASK_SUPPORT // - - -DECLARE_TIMER_FUNCTION(MlmePeriodicExec); -DECLARE_TIMER_FUNCTION(MlmeRssiReportExec); -DECLARE_TIMER_FUNCTION(AsicRxAntEvalTimeout); -DECLARE_TIMER_FUNCTION(APSDPeriodicExec); -DECLARE_TIMER_FUNCTION(AsicRfTuningExec); - - -#ifdef CONFIG_STA_SUPPORT -DECLARE_TIMER_FUNCTION(BeaconTimeout); -DECLARE_TIMER_FUNCTION(ScanTimeout); -DECLARE_TIMER_FUNCTION(AuthTimeout); -DECLARE_TIMER_FUNCTION(AssocTimeout); -DECLARE_TIMER_FUNCTION(ReassocTimeout); -DECLARE_TIMER_FUNCTION(DisassocTimeout); -DECLARE_TIMER_FUNCTION(LinkDownExec); -DECLARE_TIMER_FUNCTION(StaQuickResponeForRateUpExec); -DECLARE_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc); -DECLARE_TIMER_FUNCTION(PsPollWakeExec); -DECLARE_TIMER_FUNCTION(RadioOnExec); - -#ifdef QOS_DLS_SUPPORT -DECLARE_TIMER_FUNCTION(DlsTimeoutAction); -#endif // QOS_DLS_SUPPORT // - - -#endif // CONFIG_STA_SUPPORT // - - - - -#if defined(AP_LED) || defined(STA_LED) -DECLARE_TIMER_FUNCTION(LedCtrlMain); -#endif - - - -#endif // __RTMP_TIMER_H__ // diff --git a/drivers/staging/rt3090/rtmp_type.h b/drivers/staging/rt3090/rtmp_type.h deleted file mode 100644 index d8b571e6f801..000000000000 --- a/drivers/staging/rt3090/rtmp_type.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rtmp_type.h - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Name Date Modification logs - Paul Lin 1-2-2004 -*/ - -#ifndef __RTMP_TYPE_H__ -#define __RTMP_TYPE_H__ - - -#define PACKED __attribute__ ((packed)) - -#ifdef LINUX -// Put platform dependent declaration here -// For example, linux type definition -typedef unsigned char UINT8; -typedef unsigned short UINT16; -typedef unsigned int UINT32; -typedef unsigned long long UINT64; -typedef int INT32; -typedef long long INT64; -#endif // LINUX // - -typedef unsigned char * PUINT8; -typedef unsigned short * PUINT16; -typedef unsigned int * PUINT32; -typedef unsigned long long * PUINT64; -typedef int * PINT32; -typedef long long * PINT64; - -// modified for fixing compile warning on Sigma 8634 platform -typedef char STRING; -typedef signed char CHAR; - -typedef signed short SHORT; -typedef signed int INT; -typedef signed long LONG; -typedef signed long long LONGLONG; - - -#ifdef LINUX -typedef unsigned char UCHAR; -typedef unsigned short USHORT; -typedef unsigned int UINT; -typedef unsigned long ULONG; -#endif // LINUX // -typedef unsigned long long ULONGLONG; - -typedef unsigned char BOOLEAN; -#ifdef LINUX -typedef void VOID; -#endif // LINUX // - -typedef char * PSTRING; -typedef VOID * PVOID; -typedef CHAR * PCHAR; -typedef UCHAR * PUCHAR; -typedef USHORT * PUSHORT; -typedef LONG * PLONG; -typedef ULONG * PULONG; -typedef UINT * PUINT; - -typedef unsigned int NDIS_MEDIA_STATE; - -typedef union _LARGE_INTEGER { - struct { - UINT LowPart; - INT32 HighPart; - } u; - INT64 QuadPart; -} LARGE_INTEGER; - - -// -// Register set pair for initialzation register set definition -// -typedef struct _RTMP_REG_PAIR -{ - ULONG Register; - ULONG Value; -} RTMP_REG_PAIR, *PRTMP_REG_PAIR; - -typedef struct _REG_PAIR -{ - UCHAR Register; - UCHAR Value; -} REG_PAIR, *PREG_PAIR; - -// -// Register set pair for initialzation register set definition -// -typedef struct _RTMP_RF_REGS -{ - UCHAR Channel; - ULONG R1; - ULONG R2; - ULONG R3; - ULONG R4; -} RTMP_RF_REGS, *PRTMP_RF_REGS; - -typedef struct _FREQUENCY_ITEM { - UCHAR Channel; - UCHAR N; - UCHAR R; - UCHAR K; -} FREQUENCY_ITEM, *PFREQUENCY_ITEM; - - -typedef int NTSTATUS; - - -#define STATUS_SUCCESS 0x00 -#define STATUS_UNSUCCESSFUL 0x01 - -#endif // __RTMP_TYPE_H__ // diff --git a/drivers/staging/rt3090/spectrum.h b/drivers/staging/rt3090/spectrum.h deleted file mode 100644 index be9bae5b88c2..000000000000 --- a/drivers/staging/rt3090/spectrum.h +++ /dev/null @@ -1,234 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - */ - -#ifndef __SPECTRUM_H__ -#define __SPECTRUM_H__ - -#include "rtmp_type.h" -#include "spectrum_def.h" - - -CHAR RTMP_GetTxPwr( - IN PRTMP_ADAPTER pAd, - IN HTTRANSMIT_SETTING HTTxMode); - -/* - ========================================================================== - Description: - Prepare Measurement request action frame and enqueue it into - management queue waiting for transmition. - - Parametrs: - 1. the destination mac address of the frame. - - Return : None. - ========================================================================== - */ -VOID MakeMeasurementReqFrame( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pOutBuffer, - OUT PULONG pFrameLen, - IN UINT8 TotalLen, - IN UINT8 Category, - IN UINT8 Action, - IN UINT8 MeasureToken, - IN UINT8 MeasureReqMode, - IN UINT8 MeasureReqType, - IN UINT8 NumOfRepetitions); - -/* - ========================================================================== - Description: - Prepare Measurement report action frame and enqueue it into - management queue waiting for transmition. - - Parametrs: - 1. the destination mac address of the frame. - - Return : None. - ========================================================================== - */ -VOID EnqueueMeasurementRep( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UINT8 DialogToken, - IN UINT8 MeasureToken, - IN UINT8 MeasureReqMode, - IN UINT8 MeasureReqType, - IN UINT8 ReportInfoLen, - IN PUINT8 pReportInfo); - -/* - ========================================================================== - Description: - Prepare TPC Request action frame and enqueue it into - management queue waiting for transmition. - - Parametrs: - 1. the destination mac address of the frame. - - Return : None. - ========================================================================== - */ -VOID EnqueueTPCReq( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UCHAR DialogToken); - -/* - ========================================================================== - Description: - Prepare TPC Report action frame and enqueue it into - management queue waiting for transmition. - - Parametrs: - 1. the destination mac address of the frame. - - Return : None. - ========================================================================== - */ -VOID EnqueueTPCRep( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UINT8 DialogToken, - IN UINT8 TxPwr, - IN UINT8 LinkMargin); - -/* - ========================================================================== - Description: - Prepare Channel Switch Announcement action frame and enqueue it into - management queue waiting for transmition. - - Parametrs: - 1. the destination mac address of the frame. - 2. Channel switch announcement mode. - 2. a New selected channel. - - Return : None. - ========================================================================== - */ -VOID EnqueueChSwAnn( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UINT8 ChSwMode, - IN UINT8 NewCh); - -/* - ========================================================================== - Description: - Spectrun action frames Handler such as channel switch annoucement, - measurement report, measurement request actions frames. - - Parametrs: - Elme - MLME message containing the received frame - - Return : None. - ========================================================================== - */ -VOID PeerSpectrumAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -/* - ========================================================================== - Description: - - Parametrs: - - Return : None. - ========================================================================== - */ -INT Set_MeasureReq_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_TpcReq_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_PwrConstraint( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - - -VOID MeasureReqTabInit( - IN PRTMP_ADAPTER pAd); - -VOID MeasureReqTabExit( - IN PRTMP_ADAPTER pAd); - -PMEASURE_REQ_ENTRY MeasureReqLookUp( - IN PRTMP_ADAPTER pAd, - IN UINT8 DialogToken); - -PMEASURE_REQ_ENTRY MeasureReqInsert( - IN PRTMP_ADAPTER pAd, - IN UINT8 DialogToken); - -VOID MeasureReqDelete( - IN PRTMP_ADAPTER pAd, - IN UINT8 DialogToken); - -VOID InsertChannelRepIE( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN PSTRING pCountry, - IN UINT8 RegulatoryClass); - -VOID InsertTpcReportIE( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 TxPwr, - IN UINT8 LinkMargin); - -VOID InsertDialogToken( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 DialogToken); - -VOID TpcReqTabInit( - IN PRTMP_ADAPTER pAd); - -VOID TpcReqTabExit( - IN PRTMP_ADAPTER pAd); - -VOID NotifyChSwAnnToPeerAPs( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pRA, - IN PUCHAR pTA, - IN UINT8 ChSwMode, - IN UINT8 Channel); - -VOID RguClass_BuildBcnChList( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf, - OUT PULONG pBufLen); -#endif // __SPECTRUM_H__ // diff --git a/drivers/staging/rt3090/spectrum_def.h b/drivers/staging/rt3090/spectrum_def.h deleted file mode 100644 index 0389b0921486..000000000000 --- a/drivers/staging/rt3090/spectrum_def.h +++ /dev/null @@ -1,257 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - spectrum_def.h - - Abstract: - Handle association related requests either from WSTA or from local MLME - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- - Fonchi Wu 2008 created for 802.11h - */ - -#ifndef __SPECTRUM_DEF_H__ -#define __SPECTRUM_DEF_H__ - - -#define MAX_MEASURE_REQ_TAB_SIZE 32 -#define MAX_HASH_MEASURE_REQ_TAB_SIZE MAX_MEASURE_REQ_TAB_SIZE - -#define MAX_TPC_REQ_TAB_SIZE 32 -#define MAX_HASH_TPC_REQ_TAB_SIZE MAX_TPC_REQ_TAB_SIZE - -#define MIN_RCV_PWR 100 /* Negative value ((dBm) */ - -#define TPC_REQ_AGE_OUT 500 /* ms */ -#define MQ_REQ_AGE_OUT 500 /* ms */ - -#define TPC_DIALOGTOKEN_HASH_INDEX(_DialogToken) ((_DialogToken) % MAX_HASH_TPC_REQ_TAB_SIZE) -#define MQ_DIALOGTOKEN_HASH_INDEX(_DialogToken) ((_DialogToken) % MAX_MEASURE_REQ_TAB_SIZE) - -typedef struct _MEASURE_REQ_ENTRY -{ - struct _MEASURE_REQ_ENTRY *pNext; - ULONG lastTime; - BOOLEAN Valid; - UINT8 DialogToken; - UINT8 MeasureDialogToken[3]; // 0:basic measure, 1: CCA measure, 2: RPI_Histogram measure. -} MEASURE_REQ_ENTRY, *PMEASURE_REQ_ENTRY; - -typedef struct _MEASURE_REQ_TAB -{ - UCHAR Size; - PMEASURE_REQ_ENTRY Hash[MAX_HASH_MEASURE_REQ_TAB_SIZE]; - MEASURE_REQ_ENTRY Content[MAX_MEASURE_REQ_TAB_SIZE]; -} MEASURE_REQ_TAB, *PMEASURE_REQ_TAB; - -typedef struct _TPC_REQ_ENTRY -{ - struct _TPC_REQ_ENTRY *pNext; - ULONG lastTime; - BOOLEAN Valid; - UINT8 DialogToken; -} TPC_REQ_ENTRY, *PTPC_REQ_ENTRY; - -typedef struct _TPC_REQ_TAB -{ - UCHAR Size; - PTPC_REQ_ENTRY Hash[MAX_HASH_TPC_REQ_TAB_SIZE]; - TPC_REQ_ENTRY Content[MAX_TPC_REQ_TAB_SIZE]; -} TPC_REQ_TAB, *PTPC_REQ_TAB; - - -/* The regulatory information */ -typedef struct _DOT11_CHANNEL_SET -{ - UCHAR NumberOfChannels; - UINT8 MaxTxPwr; - UCHAR ChannelList[16]; -} DOT11_CHANNEL_SET, *PDOT11_CHANNEL_SET; - -typedef struct _DOT11_REGULATORY_INFORMATION -{ - UCHAR RegulatoryClass; - DOT11_CHANNEL_SET ChannelSet; -} DOT11_REGULATORY_INFORMATION, *PDOT11_REGULATORY_INFORMATION; - - - -#define RM_TPC_REQ 0 -#define RM_MEASURE_REQ 1 - -#define RM_BASIC 0 -#define RM_CCA 1 -#define RM_RPI_HISTOGRAM 2 -#define RM_CH_LOAD 3 -#define RM_NOISE_HISTOGRAM 4 - - -typedef struct PACKED _TPC_REPORT_INFO -{ - UINT8 TxPwr; - UINT8 LinkMargin; -} TPC_REPORT_INFO, *PTPC_REPORT_INFO; - -typedef struct PACKED _CH_SW_ANN_INFO -{ - UINT8 ChSwMode; - UINT8 Channel; - UINT8 ChSwCnt; -} CH_SW_ANN_INFO, *PCH_SW_ANN_INFO; - -typedef union PACKED _MEASURE_REQ_MODE -{ -#ifdef RT_BIG_ENDIAN - struct PACKED - { - - UINT8 :3; - UINT8 DurationMandatory:1; - UINT8 Report:1; - UINT8 Request:1; - UINT8 Enable:1; - UINT8 Parallel:1; - } field; -#else - struct PACKED - { - UINT8 Parallel:1; - UINT8 Enable:1; - UINT8 Request:1; - UINT8 Report:1; - UINT8 DurationMandatory:1; - UINT8 :3; - } field; -#endif // RT_BIG_ENDIAN // - UINT8 word; -} MEASURE_REQ_MODE, *PMEASURE_REQ_MODE; - -typedef struct PACKED _MEASURE_REQ -{ - UINT8 ChNum; - UINT64 MeasureStartTime; - UINT16 MeasureDuration; -} MEASURE_REQ, *PMEASURE_REQ; - -typedef struct PACKED _MEASURE_REQ_INFO -{ - UINT8 Token; - MEASURE_REQ_MODE ReqMode; - UINT8 ReqType; - UINT8 Oct[0]; -} MEASURE_REQ_INFO, *PMEASURE_REQ_INFO; - -typedef union PACKED _MEASURE_BASIC_REPORT_MAP -{ -#ifdef RT_BIG_ENDIAN - struct PACKED - { - UINT8 Rev:3; - - UINT8 Unmeasure:1; - UINT8 Radar:1; - UINT8 UnidentifiedSignal:1; - UINT8 OfdmPreamble:1; - UINT8 BSS:1; - } field; -#else - struct PACKED - { - UINT8 BSS:1; - - UINT8 OfdmPreamble:1; - UINT8 UnidentifiedSignal:1; - UINT8 Radar:1; - UINT8 Unmeasure:1; - UINT8 Rev:3; - } field; -#endif // RT_BIG_ENDIAN // - UINT8 word; -} MEASURE_BASIC_REPORT_MAP, *PMEASURE_BASIC_REPORT_MAP; - -typedef struct PACKED _MEASURE_BASIC_REPORT -{ - UINT8 ChNum; - UINT64 MeasureStartTime; - UINT16 MeasureDuration; - MEASURE_BASIC_REPORT_MAP Map; -} MEASURE_BASIC_REPORT, *PMEASURE_BASIC_REPORT; - -typedef struct PACKED _MEASURE_CCA_REPORT -{ - UINT8 ChNum; - UINT64 MeasureStartTime; - UINT16 MeasureDuration; - UINT8 CCA_Busy_Fraction; -} MEASURE_CCA_REPORT, *PMEASURE_CCA_REPORT; - -typedef struct PACKED _MEASURE_RPI_REPORT -{ - UINT8 ChNum; - UINT64 MeasureStartTime; - UINT16 MeasureDuration; - UINT8 RPI_Density[8]; -} MEASURE_RPI_REPORT, *PMEASURE_RPI_REPORT; - -typedef union PACKED _MEASURE_REPORT_MODE -{ - struct PACKED - { -#ifdef RT_BIG_ENDIAN - UINT8 Rev:5; - UINT8 Refused:1; - UINT8 Incapable:1; - UINT8 Late:1; -#else - UINT8 Late:1; - UINT8 Incapable:1; - UINT8 Refused:1; - UINT8 Rev:5; -#endif // RT_BIG_ENDIAN // - } field; - UINT8 word; -} MEASURE_REPORT_MODE, *PMEASURE_REPORT_MODE; - -typedef struct PACKED _MEASURE_REPORT_INFO -{ - UINT8 Token; - UINT8 ReportMode; - UINT8 ReportType; - UINT8 Octect[0]; -} MEASURE_REPORT_INFO, *PMEASURE_REPORT_INFO; - -typedef struct PACKED _QUIET_INFO -{ - UINT8 QuietCnt; - UINT8 QuietPeriod; - UINT16 QuietDuration; - UINT16 QuietOffset; -} QUIET_INFO, *PQUIET_INFO; - -#endif // __SPECTRUM_DEF_H__ // diff --git a/drivers/staging/rt3090/sta/assoc.c b/drivers/staging/rt3090/sta/assoc.c deleted file mode 100644 index 012ed2b06083..000000000000 --- a/drivers/staging/rt3090/sta/assoc.c +++ /dev/null @@ -1,1673 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - assoc.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - John 2004-9-3 porting from RT2500 -*/ - -#include "../rt_config.h" - - -UCHAR CipherWpaTemplate[] = { - 0xdd, // WPA IE - 0x16, // Length - 0x00, 0x50, 0xf2, 0x01, // oui - 0x01, 0x00, // Version - 0x00, 0x50, 0xf2, 0x02, // Multicast - 0x01, 0x00, // Number of unicast - 0x00, 0x50, 0xf2, 0x02, // unicast - 0x01, 0x00, // number of authentication method - 0x00, 0x50, 0xf2, 0x01 // authentication - }; - -UCHAR CipherWpa2Template[] = { - 0x30, // RSN IE - 0x14, // Length - 0x01, 0x00, // Version - 0x00, 0x0f, 0xac, 0x02, // group cipher, TKIP - 0x01, 0x00, // number of pairwise - 0x00, 0x0f, 0xac, 0x02, // unicast - 0x01, 0x00, // number of authentication method - 0x00, 0x0f, 0xac, 0x02, // authentication - 0x00, 0x00, // RSN capability - }; - -UCHAR Ccx2IeInfo[] = { 0x00, 0x40, 0x96, 0x03, 0x02}; - -/* - ========================================================================== - Description: - association state machine init, including state transition and timer init - Parameters: - S - pointer to the association state machine - - IRQL = PASSIVE_LEVEL - - ========================================================================== - */ -VOID AssocStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - OUT STATE_MACHINE_FUNC Trans[]) -{ - StateMachineInit(S, Trans, MAX_ASSOC_STATE, MAX_ASSOC_MSG, (STATE_MACHINE_FUNC)Drop, ASSOC_IDLE, ASSOC_MACHINE_BASE); - - // first column - StateMachineSetAction(S, ASSOC_IDLE, MT2_MLME_ASSOC_REQ, (STATE_MACHINE_FUNC)MlmeAssocReqAction); - StateMachineSetAction(S, ASSOC_IDLE, MT2_MLME_REASSOC_REQ, (STATE_MACHINE_FUNC)MlmeReassocReqAction); - StateMachineSetAction(S, ASSOC_IDLE, MT2_MLME_DISASSOC_REQ, (STATE_MACHINE_FUNC)MlmeDisassocReqAction); - StateMachineSetAction(S, ASSOC_IDLE, MT2_PEER_DISASSOC_REQ, (STATE_MACHINE_FUNC)PeerDisassocAction); - - // second column - StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_MLME_ASSOC_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenAssoc); - StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_MLME_REASSOC_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenReassoc); - StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_MLME_DISASSOC_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenDisassociate); - StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_PEER_DISASSOC_REQ, (STATE_MACHINE_FUNC)PeerDisassocAction); - StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_PEER_ASSOC_RSP, (STATE_MACHINE_FUNC)PeerAssocRspAction); - // - // Patch 3Com AP MOde:3CRWE454G72 - // We send Assoc request frame to this AP, it always send Reassoc Rsp not Associate Rsp. - // - StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_PEER_REASSOC_RSP, (STATE_MACHINE_FUNC)PeerAssocRspAction); - StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_ASSOC_TIMEOUT, (STATE_MACHINE_FUNC)AssocTimeoutAction); - - // third column - StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_MLME_ASSOC_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenAssoc); - StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_MLME_REASSOC_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenReassoc); - StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_MLME_DISASSOC_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenDisassociate); - StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_PEER_DISASSOC_REQ, (STATE_MACHINE_FUNC)PeerDisassocAction); - StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_PEER_REASSOC_RSP, (STATE_MACHINE_FUNC)PeerReassocRspAction); - // - // Patch, AP doesn't send Reassociate Rsp frame to Station. - // - StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_PEER_ASSOC_RSP, (STATE_MACHINE_FUNC)PeerReassocRspAction); - StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_REASSOC_TIMEOUT, (STATE_MACHINE_FUNC)ReassocTimeoutAction); - - // fourth column - StateMachineSetAction(S, DISASSOC_WAIT_RSP, MT2_MLME_ASSOC_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenAssoc); - StateMachineSetAction(S, DISASSOC_WAIT_RSP, MT2_MLME_REASSOC_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenReassoc); - StateMachineSetAction(S, DISASSOC_WAIT_RSP, MT2_MLME_DISASSOC_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenDisassociate); - StateMachineSetAction(S, DISASSOC_WAIT_RSP, MT2_PEER_DISASSOC_REQ, (STATE_MACHINE_FUNC)PeerDisassocAction); - StateMachineSetAction(S, DISASSOC_WAIT_RSP, MT2_DISASSOC_TIMEOUT, (STATE_MACHINE_FUNC)DisassocTimeoutAction); - - // initialize the timer - RTMPInitTimer(pAd, &pAd->MlmeAux.AssocTimer, GET_TIMER_FUNCTION(AssocTimeout), pAd, FALSE); - RTMPInitTimer(pAd, &pAd->MlmeAux.ReassocTimer, GET_TIMER_FUNCTION(ReassocTimeout), pAd, FALSE); - RTMPInitTimer(pAd, &pAd->MlmeAux.DisassocTimer, GET_TIMER_FUNCTION(DisassocTimeout), pAd, FALSE); -} - -/* - ========================================================================== - Description: - Association timeout procedure. After association timeout, this function - will be called and it will put a message into the MLME queue - Parameters: - Standard timer parameters - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AssocTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_ASSOC_TIMEOUT, 0, NULL); - RTMP_MLME_HANDLER(pAd); -} - -/* - ========================================================================== - Description: - Reassociation timeout procedure. After reassociation timeout, this - function will be called and put a message into the MLME queue - Parameters: - Standard timer parameters - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID ReassocTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_REASSOC_TIMEOUT, 0, NULL); - RTMP_MLME_HANDLER(pAd); -} - -/* - ========================================================================== - Description: - Disassociation timeout procedure. After disassociation timeout, this - function will be called and put a message into the MLME queue - Parameters: - Standard timer parameters - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID DisassocTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_DISASSOC_TIMEOUT, 0, NULL); - RTMP_MLME_HANDLER(pAd); -} - -/* - ========================================================================== - Description: - mlme assoc req handling procedure - Parameters: - Adapter - Adapter pointer - Elem - MLME Queue Element - Pre: - the station has been authenticated and the following information is stored in the config - -# SSID - -# supported rates and their length - -# listen interval (Adapter->StaCfg.default_listen_count) - -# Transmit power (Adapter->StaCfg.tx_power) - Post : - -# An association request frame is generated and sent to the air - -# Association timer starts - -# Association state -> ASSOC_WAIT_RSP - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID MlmeAssocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR ApAddr[6]; - HEADER_802_11 AssocHdr; - UCHAR WmeIe[9] = {IE_VENDOR_SPECIFIC, 0x07, 0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00}; - USHORT ListenIntv; - ULONG Timeout; - USHORT CapabilityInfo; - BOOLEAN TimerCancelled; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - ULONG tmp; - USHORT VarIesOffset; - USHORT Status; - - // Block all authentication request durning WPA block period - if (pAd->StaCfg.bBlockAssoc == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - Block Assoc request durning WPA block period!\n")); - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - Status = MLME_STATE_MACHINE_REJECT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_ASSOC_CONF, 2, &Status); - } - // check sanity first - else if (MlmeAssocReqSanity(pAd, Elem->Msg, Elem->MsgLen, ApAddr, &CapabilityInfo, &Timeout, &ListenIntv)) - { - RTMPCancelTimer(&pAd->MlmeAux.AssocTimer, &TimerCancelled); - COPY_MAC_ADDR(pAd->MlmeAux.Bssid, ApAddr); - - // Get an unused nonpaged memory - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE,("ASSOC - MlmeAssocReqAction() allocate memory failed \n")); - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - Status = MLME_FAIL_NO_RESOURCE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_ASSOC_CONF, 2, &Status); - return; - } - - // Add by James 03/06/27 - pAd->StaCfg.AssocInfo.Length = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); - // Association don't need to report MAC address - pAd->StaCfg.AssocInfo.AvailableRequestFixedIEs = - NDIS_802_11_AI_REQFI_CAPABILITIES | NDIS_802_11_AI_REQFI_LISTENINTERVAL; - pAd->StaCfg.AssocInfo.RequestFixedIEs.Capabilities = CapabilityInfo; - pAd->StaCfg.AssocInfo.RequestFixedIEs.ListenInterval = ListenIntv; - // Only reassociate need this - //COPY_MAC_ADDR(pAd->StaCfg.AssocInfo.RequestFixedIEs.CurrentAPAddress, ApAddr); - pAd->StaCfg.AssocInfo.OffsetRequestIEs = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); - - NdisZeroMemory(pAd->StaCfg.ReqVarIEs, MAX_VIE_LEN); - // First add SSID - VarIesOffset = 0; - NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &SsidIe, 1); - VarIesOffset += 1; - NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &pAd->MlmeAux.SsidLen, 1); - VarIesOffset += 1; - NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); - VarIesOffset += pAd->MlmeAux.SsidLen; - - // Second add Supported rates - NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &SupRateIe, 1); - VarIesOffset += 1; - NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &pAd->MlmeAux.SupRateLen, 1); - VarIesOffset += 1; - NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, pAd->MlmeAux.SupRate, pAd->MlmeAux.SupRateLen); - VarIesOffset += pAd->MlmeAux.SupRateLen; - // End Add by James - - if ((pAd->CommonCfg.Channel > 14) && - (pAd->CommonCfg.bIEEE80211H == TRUE)) - CapabilityInfo |= 0x0100; - - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - Send ASSOC request...\n")); - MgtMacHeaderInit(pAd, &AssocHdr, SUBTYPE_ASSOC_REQ, 0, ApAddr, ApAddr); - - // Build basic frame first - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &AssocHdr, - 2, &CapabilityInfo, - 2, &ListenIntv, - 1, &SsidIe, - 1, &pAd->MlmeAux.SsidLen, - pAd->MlmeAux.SsidLen, pAd->MlmeAux.Ssid, - 1, &SupRateIe, - 1, &pAd->MlmeAux.SupRateLen, - pAd->MlmeAux.SupRateLen, pAd->MlmeAux.SupRate, - END_OF_ARGS); - - if (pAd->MlmeAux.ExtRateLen != 0) - { - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 1, &ExtRateIe, - 1, &pAd->MlmeAux.ExtRateLen, - pAd->MlmeAux.ExtRateLen, pAd->MlmeAux.ExtRate, - END_OF_ARGS); - FrameLen += tmp; - } - - -#ifdef DOT11_N_SUPPORT - // HT - if ((pAd->MlmeAux.HtCapabilityLen > 0) && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) - { - ULONG TmpLen; - UCHAR HtLen; - UCHAR BROADCOM[4] = {0x0, 0x90, 0x4c, 0x33}; - if (pAd->StaActive.SupportedPhyInfo.bPreNHt == TRUE) - { - HtLen = SIZE_HT_CAP_IE + 4; - MakeOutgoingFrame(pOutBuffer + FrameLen, &TmpLen, - 1, &WpaIe, - 1, &HtLen, - 4, &BROADCOM[0], - pAd->MlmeAux.HtCapabilityLen, &pAd->MlmeAux.HtCapability, - END_OF_ARGS); - } - else - { -#ifdef RT_BIG_ENDIAN - HT_CAPABILITY_IE HtCapabilityTmp; -#endif - -#ifndef RT_BIG_ENDIAN - MakeOutgoingFrame(pOutBuffer + FrameLen, &TmpLen, - 1, &HtCapIe, - 1, &pAd->MlmeAux.HtCapabilityLen, - pAd->MlmeAux.HtCapabilityLen, &pAd->MlmeAux.HtCapability, - END_OF_ARGS); -#else - NdisZeroMemory(&HtCapabilityTmp, sizeof(HT_CAPABILITY_IE)); - NdisMoveMemory(&HtCapabilityTmp, &pAd->MlmeAux.HtCapability, pAd->MlmeAux.HtCapabilityLen); - *(USHORT *)(&HtCapabilityTmp.HtCapInfo) = SWAP16(*(USHORT *)(&HtCapabilityTmp.HtCapInfo)); - *(USHORT *)(&HtCapabilityTmp.ExtHtCapInfo) = SWAP16(*(USHORT *)(&HtCapabilityTmp.ExtHtCapInfo)); - - MakeOutgoingFrame(pOutBuffer + FrameLen, &TmpLen, - 1, &HtCapIe, - 1, &pAd->MlmeAux.HtCapabilityLen, - pAd->MlmeAux.HtCapabilityLen,&HtCapabilityTmp, - END_OF_ARGS); -#endif - } - FrameLen += TmpLen; - } -#endif // DOT11_N_SUPPORT // - - // add Ralink proprietary IE to inform AP this STA is going to use AGGREGATION or PIGGY-BACK+AGGREGATION - // Case I: (Aggregation + Piggy-Back) - // 1. user enable aggregation, AND - // 2. Mac support piggy-back - // 3. AP annouces it's PIGGY-BACK+AGGREGATION-capable in BEACON - // Case II: (Aggregation) - // 1. user enable aggregation, AND - // 2. AP annouces it's AGGREGATION-capable in BEACON - if (pAd->CommonCfg.bAggregationCapable) - { - if ((pAd->CommonCfg.bPiggyBackCapable) && ((pAd->MlmeAux.APRalinkIe & 0x00000003) == 3)) - { - ULONG TmpLen; - UCHAR RalinkIe[9] = {IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x03, 0x00, 0x00, 0x00}; - MakeOutgoingFrame(pOutBuffer+FrameLen, &TmpLen, - 9, RalinkIe, - END_OF_ARGS); - FrameLen += TmpLen; - } - else if (pAd->MlmeAux.APRalinkIe & 0x00000001) - { - ULONG TmpLen; - UCHAR RalinkIe[9] = {IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x01, 0x00, 0x00, 0x00}; - MakeOutgoingFrame(pOutBuffer+FrameLen, &TmpLen, - 9, RalinkIe, - END_OF_ARGS); - FrameLen += TmpLen; - } - } - else - { - ULONG TmpLen; - UCHAR RalinkIe[9] = {IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x06, 0x00, 0x00, 0x00}; - MakeOutgoingFrame(pOutBuffer+FrameLen, &TmpLen, - 9, RalinkIe, - END_OF_ARGS); - FrameLen += TmpLen; - } - - if (pAd->MlmeAux.APEdcaParm.bValid) - { - if (pAd->CommonCfg.bAPSDCapable && pAd->MlmeAux.APEdcaParm.bAPSDCapable) - { - QBSS_STA_INFO_PARM QosInfo; - - NdisZeroMemory(&QosInfo, sizeof(QBSS_STA_INFO_PARM)); - QosInfo.UAPSD_AC_BE = pAd->CommonCfg.bAPSDAC_BE; - QosInfo.UAPSD_AC_BK = pAd->CommonCfg.bAPSDAC_BK; - QosInfo.UAPSD_AC_VI = pAd->CommonCfg.bAPSDAC_VI; - QosInfo.UAPSD_AC_VO = pAd->CommonCfg.bAPSDAC_VO; - QosInfo.MaxSPLength = pAd->CommonCfg.MaxSPLength; - WmeIe[8] |= *(PUCHAR)&QosInfo; - } - else - { - // The Parameter Set Count is set to ��0�� in the association request frames - // WmeIe[8] |= (pAd->MlmeAux.APEdcaParm.EdcaUpdateCount & 0x0f); - } - - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 9, &WmeIe[0], - END_OF_ARGS); - FrameLen += tmp; - } - - // - // Let WPA(#221) Element ID on the end of this association frame. - // Otherwise some AP will fail on parsing Element ID and set status fail on Assoc Rsp. - // For example: Put Vendor Specific IE on the front of WPA IE. - // This happens on AP (Model No:Linksys WRK54G) - // - if (((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) - ) - ) - { - UCHAR RSNIe = IE_WPA; - - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2)) - { - RSNIe = IE_WPA2; - } - -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT -#ifdef SIOCSIWGENIE - if ((pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_ENABLE) && - (pAd->StaCfg.bRSN_IE_FromWpaSupplicant == FALSE)) -#endif // SIOCSIWGENIE // -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, BSS0); - - // Check for WPA PMK cache list - if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) - { - INT idx; - BOOLEAN FoundPMK = FALSE; - // Search chched PMKID, append it if existed - for (idx = 0; idx < PMKID_NO; idx++) - { - if (NdisEqualMemory(ApAddr, &pAd->StaCfg.SavedPMK[idx].BSSID, 6)) - { - FoundPMK = TRUE; - break; - } - } - - if (FoundPMK) - { - // Set PMK number - *(PUSHORT) &pAd->StaCfg.RSN_IE[pAd->StaCfg.RSNIE_Len] = 1; - NdisMoveMemory(&pAd->StaCfg.RSN_IE[pAd->StaCfg.RSNIE_Len + 2], &pAd->StaCfg.SavedPMK[idx].PMKID, 16); - pAd->StaCfg.RSNIE_Len += 18; - } - } - -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT -#ifdef SIOCSIWGENIE - if ((pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) && - (pAd->StaCfg.bRSN_IE_FromWpaSupplicant == TRUE)) - { - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - pAd->StaCfg.RSNIE_Len, pAd->StaCfg.RSN_IE, - END_OF_ARGS); - } - else -#endif -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - { - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 1, &RSNIe, - 1, &pAd->StaCfg.RSNIE_Len, - pAd->StaCfg.RSNIE_Len, pAd->StaCfg.RSN_IE, - END_OF_ARGS); - } - - FrameLen += tmp; - -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT -#ifdef SIOCSIWGENIE - if ((pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_ENABLE) || - (pAd->StaCfg.bRSN_IE_FromWpaSupplicant == FALSE)) -#endif -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - { - // Append Variable IE - NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &RSNIe, 1); - VarIesOffset += 1; - NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &pAd->StaCfg.RSNIE_Len, 1); - VarIesOffset += 1; - } - NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, pAd->StaCfg.RSN_IE, pAd->StaCfg.RSNIE_Len); - VarIesOffset += pAd->StaCfg.RSNIE_Len; - - // Set Variable IEs Length - pAd->StaCfg.ReqVarIELen = VarIesOffset; - } - - - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - - RTMPSetTimer(&pAd->MlmeAux.AssocTimer, Timeout); - pAd->Mlme.AssocMachine.CurrState = ASSOC_WAIT_RSP; - } - else - { - DBGPRINT(RT_DEBUG_TRACE,("ASSOC - MlmeAssocReqAction() sanity check failed. BUG!!!!!! \n")); - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - Status = MLME_INVALID_FORMAT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_ASSOC_CONF, 2, &Status); - } - -} - -/* - ========================================================================== - Description: - mlme reassoc req handling procedure - Parameters: - Elem - - Pre: - -# SSID (Adapter->StaCfg.ssid[]) - -# BSSID (AP address, Adapter->StaCfg.bssid) - -# Supported rates (Adapter->StaCfg.supported_rates[]) - -# Supported rates length (Adapter->StaCfg.supported_rates_len) - -# Tx power (Adapter->StaCfg.tx_power) - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID MlmeReassocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR ApAddr[6]; - HEADER_802_11 ReassocHdr; - UCHAR WmeIe[9] = {IE_VENDOR_SPECIFIC, 0x07, 0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00}; - USHORT CapabilityInfo, ListenIntv; - ULONG Timeout; - ULONG FrameLen = 0; - BOOLEAN TimerCancelled; - NDIS_STATUS NStatus; - ULONG tmp; - PUCHAR pOutBuffer = NULL; - USHORT Status; - - // Block all authentication request durning WPA block period - if (pAd->StaCfg.bBlockAssoc == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - Block ReAssoc request durning WPA block period!\n")); - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - Status = MLME_STATE_MACHINE_REJECT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, &Status); - } - // the parameters are the same as the association - else if(MlmeAssocReqSanity(pAd, Elem->Msg, Elem->MsgLen, ApAddr, &CapabilityInfo, &Timeout, &ListenIntv)) - { - RTMPCancelTimer(&pAd->MlmeAux.ReassocTimer, &TimerCancelled); - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE,("ASSOC - MlmeReassocReqAction() allocate memory failed \n")); - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - Status = MLME_FAIL_NO_RESOURCE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, &Status); - return; - } - - COPY_MAC_ADDR(pAd->MlmeAux.Bssid, ApAddr); - - // make frame, use bssid as the AP address?? - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - Send RE-ASSOC request...\n")); - MgtMacHeaderInit(pAd, &ReassocHdr, SUBTYPE_REASSOC_REQ, 0, ApAddr, ApAddr); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &ReassocHdr, - 2, &CapabilityInfo, - 2, &ListenIntv, - MAC_ADDR_LEN, ApAddr, - 1, &SsidIe, - 1, &pAd->MlmeAux.SsidLen, - pAd->MlmeAux.SsidLen, pAd->MlmeAux.Ssid, - 1, &SupRateIe, - 1, &pAd->MlmeAux.SupRateLen, - pAd->MlmeAux.SupRateLen, pAd->MlmeAux.SupRate, - END_OF_ARGS); - - if (pAd->MlmeAux.ExtRateLen != 0) - { - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 1, &ExtRateIe, - 1, &pAd->MlmeAux.ExtRateLen, - pAd->MlmeAux.ExtRateLen, pAd->MlmeAux.ExtRate, - END_OF_ARGS); - FrameLen += tmp; - } - - - if (pAd->MlmeAux.APEdcaParm.bValid) - { - if (pAd->CommonCfg.bAPSDCapable && pAd->MlmeAux.APEdcaParm.bAPSDCapable) - { - QBSS_STA_INFO_PARM QosInfo; - - NdisZeroMemory(&QosInfo, sizeof(QBSS_STA_INFO_PARM)); - QosInfo.UAPSD_AC_BE = pAd->CommonCfg.bAPSDAC_BE; - QosInfo.UAPSD_AC_BK = pAd->CommonCfg.bAPSDAC_BK; - QosInfo.UAPSD_AC_VI = pAd->CommonCfg.bAPSDAC_VI; - QosInfo.UAPSD_AC_VO = pAd->CommonCfg.bAPSDAC_VO; - QosInfo.MaxSPLength = pAd->CommonCfg.MaxSPLength; - WmeIe[8] |= *(PUCHAR)&QosInfo; - } - - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 9, &WmeIe[0], - END_OF_ARGS); - FrameLen += tmp; - } - -#ifdef DOT11_N_SUPPORT - // HT - if ((pAd->MlmeAux.HtCapabilityLen > 0) && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) - { - ULONG TmpLen; - UCHAR HtLen; - UCHAR BROADCOM[4] = {0x0, 0x90, 0x4c, 0x33}; - if (pAd->StaActive.SupportedPhyInfo.bPreNHt == TRUE) - { - HtLen = SIZE_HT_CAP_IE + 4; - MakeOutgoingFrame(pOutBuffer + FrameLen, &TmpLen, - 1, &WpaIe, - 1, &HtLen, - 4, &BROADCOM[0], - pAd->MlmeAux.HtCapabilityLen, &pAd->MlmeAux.HtCapability, - END_OF_ARGS); - } - else - { - MakeOutgoingFrame(pOutBuffer + FrameLen, &TmpLen, - 1, &HtCapIe, - 1, &pAd->MlmeAux.HtCapabilityLen, - pAd->MlmeAux.HtCapabilityLen, &pAd->MlmeAux.HtCapability, - END_OF_ARGS); - } - FrameLen += TmpLen; - } -#endif // DOT11_N_SUPPORT // - - // add Ralink proprietary IE to inform AP this STA is going to use AGGREGATION or PIGGY-BACK+AGGREGATION - // Case I: (Aggregation + Piggy-Back) - // 1. user enable aggregation, AND - // 2. Mac support piggy-back - // 3. AP annouces it's PIGGY-BACK+AGGREGATION-capable in BEACON - // Case II: (Aggregation) - // 1. user enable aggregation, AND - // 2. AP annouces it's AGGREGATION-capable in BEACON - if (pAd->CommonCfg.bAggregationCapable) - { - if ((pAd->CommonCfg.bPiggyBackCapable) && ((pAd->MlmeAux.APRalinkIe & 0x00000003) == 3)) - { - ULONG TmpLen; - UCHAR RalinkIe[9] = {IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x03, 0x00, 0x00, 0x00}; - MakeOutgoingFrame(pOutBuffer+FrameLen, &TmpLen, - 9, RalinkIe, - END_OF_ARGS); - FrameLen += TmpLen; - } - else if (pAd->MlmeAux.APRalinkIe & 0x00000001) - { - ULONG TmpLen; - UCHAR RalinkIe[9] = {IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x01, 0x00, 0x00, 0x00}; - MakeOutgoingFrame(pOutBuffer+FrameLen, &TmpLen, - 9, RalinkIe, - END_OF_ARGS); - FrameLen += TmpLen; - } - } - else - { - ULONG TmpLen; - UCHAR RalinkIe[9] = {IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x04, 0x00, 0x00, 0x00}; - MakeOutgoingFrame(pOutBuffer+FrameLen, &TmpLen, - 9, RalinkIe, - END_OF_ARGS); - FrameLen += TmpLen; - } - - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - - RTMPSetTimer(&pAd->MlmeAux.ReassocTimer, Timeout); /* in mSec */ - pAd->Mlme.AssocMachine.CurrState = REASSOC_WAIT_RSP; - } - else - { - DBGPRINT(RT_DEBUG_TRACE,("ASSOC - MlmeReassocReqAction() sanity check failed. BUG!!!! \n")); - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - Status = MLME_INVALID_FORMAT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, &Status); - } -} - -/* - ========================================================================== - Description: - Upper layer issues disassoc request - Parameters: - Elem - - - IRQL = PASSIVE_LEVEL - - ========================================================================== - */ -VOID MlmeDisassocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - PMLME_DISASSOC_REQ_STRUCT pDisassocReq; - HEADER_802_11 DisassocHdr; - PHEADER_802_11 pDisassocHdr; - PUCHAR pOutBuffer = NULL; - ULONG FrameLen = 0; - NDIS_STATUS NStatus; - BOOLEAN TimerCancelled; - ULONG Timeout = 500; - USHORT Status; - -#ifdef QOS_DLS_SUPPORT - // send DLS-TEAR_DOWN message, - if (pAd->CommonCfg.bDLSCapable) - { - UCHAR i; - - // tear down local dls table entry - for (i=0; iStaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH)) - { - RTMPSendDLSTearDownFrame(pAd, pAd->StaCfg.DLSEntry[i].MacAddr); - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - pAd->StaCfg.DLSEntry[i].Valid = FALSE; - } - } - - // tear down peer dls table entry - for (i=MAX_NUM_OF_INIT_DLS_ENTRY; iStaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH)) - { - RTMPSendDLSTearDownFrame(pAd, pAd->StaCfg.DLSEntry[i].MacAddr); - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - pAd->StaCfg.DLSEntry[i].Valid = FALSE; - } - } - } -#endif // QOS_DLS_SUPPORT // - - // skip sanity check - pDisassocReq = (PMLME_DISASSOC_REQ_STRUCT)(Elem->Msg); - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - MlmeDisassocReqAction() allocate memory failed\n")); - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - Status = MLME_FAIL_NO_RESOURCE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DISASSOC_CONF, 2, &Status); - return; - } - - - - - RTMPCancelTimer(&pAd->MlmeAux.DisassocTimer, &TimerCancelled); - - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - Send DISASSOC request[BSSID::%02x:%02x:%02x:%02x:%02x:%02x (Reason=%d)\n", - pDisassocReq->Addr[0], pDisassocReq->Addr[1], pDisassocReq->Addr[2], - pDisassocReq->Addr[3], pDisassocReq->Addr[4], pDisassocReq->Addr[5], pDisassocReq->Reason)); - MgtMacHeaderInit(pAd, &DisassocHdr, SUBTYPE_DISASSOC, 0, pDisassocReq->Addr, pDisassocReq->Addr); // patch peap ttls switching issue - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11),&DisassocHdr, - 2, &pDisassocReq->Reason, - END_OF_ARGS); - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - - // To patch Instance and Buffalo(N) AP - // Driver has to send deauth to Instance AP, but Buffalo(N) needs to send disassoc to reset Authenticator's state machine - // Therefore, we send both of them. - pDisassocHdr = (PHEADER_802_11)pOutBuffer; - pDisassocHdr->FC.SubType = SUBTYPE_DEAUTH; - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - - MlmeFreeMemory(pAd, pOutBuffer); - - pAd->StaCfg.DisassocReason = REASON_DISASSOC_STA_LEAVING; - COPY_MAC_ADDR(pAd->StaCfg.DisassocSta, pDisassocReq->Addr); - - RTMPSetTimer(&pAd->MlmeAux.DisassocTimer, Timeout); /* in mSec */ - pAd->Mlme.AssocMachine.CurrState = DISASSOC_WAIT_RSP; - -#ifdef WPA_SUPPLICANT_SUPPORT -#ifndef NATIVE_WPA_SUPPLICANT_SUPPORT - if (pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) - { - //send disassociate event to wpa_supplicant - RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, RT_DISASSOC_EVENT_FLAG, NULL, NULL, 0); - } -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // -#endif // WPA_SUPPLICANT_SUPPORT // - -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT - RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0); -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - -} - -/* - ========================================================================== - Description: - peer sends assoc rsp back - Parameters: - Elme - MLME message containing the received frame - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID PeerAssocRspAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT CapabilityInfo, Status, Aid; - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], SupRateLen; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRateLen; - UCHAR Addr2[MAC_ADDR_LEN]; - BOOLEAN TimerCancelled; - UCHAR CkipFlag; - EDCA_PARM EdcaParm; - HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE - UCHAR HtCapabilityLen; - UCHAR AddHtInfoLen; - UCHAR NewExtChannelOffset = 0xff; - - if (PeerAssocRspSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &CapabilityInfo, &Status, &Aid, SupRate, &SupRateLen, ExtRate, &ExtRateLen, - &HtCapability,&AddHtInfo, &HtCapabilityLen,&AddHtInfoLen,&NewExtChannelOffset, &EdcaParm, &CkipFlag)) - { - // The frame is for me ? - if(MAC_ADDR_EQUAL(Addr2, pAd->MlmeAux.Bssid)) - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerAssocRspAction():ASSOC - receive ASSOC_RSP to me (status=%d)\n", Status)); -#ifdef DOT11_N_SUPPORT - DBGPRINT(RT_DEBUG_TRACE, ("PeerAssocRspAction():MacTable [%d].AMsduSize = %d. ClientStatusFlags = 0x%lx \n",Elem->Wcid, pAd->MacTab.Content[BSSID_WCID].AMsduSize, pAd->MacTab.Content[BSSID_WCID].ClientStatusFlags)); -#endif // DOT11_N_SUPPORT // - RTMPCancelTimer(&pAd->MlmeAux.AssocTimer, &TimerCancelled); - - - if(Status == MLME_SUCCESS) - { - UCHAR MaxSupportedRateIn500Kbps = 0; - UCHAR idx; - - // supported rates array may not be sorted. sort it and find the maximum rate - for (idx=0; idxMacTab.Content[BSSID_WCID], - MaxSupportedRateIn500Kbps, - &HtCapability, - HtCapabilityLen, - &AddHtInfo, - AddHtInfoLen, - CapabilityInfo); - } - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_ASSOC_CONF, 2, &Status); - } - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - PeerAssocRspAction() sanity check fail\n")); - } -} - -/* - ========================================================================== - Description: - peer sends reassoc rsp - Parametrs: - Elem - MLME message cntaining the received frame - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID PeerReassocRspAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT CapabilityInfo; - USHORT Status; - USHORT Aid; - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], SupRateLen; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRateLen; - UCHAR Addr2[MAC_ADDR_LEN]; - UCHAR CkipFlag; - BOOLEAN TimerCancelled; - EDCA_PARM EdcaParm; - HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE - UCHAR HtCapabilityLen; - UCHAR AddHtInfoLen; - UCHAR NewExtChannelOffset = 0xff; - - if(PeerAssocRspSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &CapabilityInfo, &Status, &Aid, SupRate, &SupRateLen, ExtRate, &ExtRateLen, - &HtCapability, &AddHtInfo, &HtCapabilityLen, &AddHtInfoLen,&NewExtChannelOffset, &EdcaParm, &CkipFlag)) - { - if(MAC_ADDR_EQUAL(Addr2, pAd->MlmeAux.Bssid)) // The frame is for me ? - { - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - receive REASSOC_RSP to me (status=%d)\n", Status)); - RTMPCancelTimer(&pAd->MlmeAux.ReassocTimer, &TimerCancelled); - - if(Status == MLME_SUCCESS) - { - // go to procedure listed on page 376 - AssocPostProc(pAd, Addr2, CapabilityInfo, Aid, SupRate, SupRateLen, ExtRate, ExtRateLen, - &EdcaParm, &HtCapability, HtCapabilityLen, &AddHtInfo); - -#ifdef WPA_SUPPLICANT_SUPPORT -#ifndef NATIVE_WPA_SUPPLICANT_SUPPORT - if (pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) - { - SendAssocIEsToWpaSupplicant(pAd); - RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, RT_ASSOC_EVENT_FLAG, NULL, NULL, 0); - } -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // -#endif // WPA_SUPPLICANT_SUPPORT // - -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT - { - wext_notify_event_assoc(pAd); - RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, &pAd->MlmeAux.Bssid[0], NULL, 0); - } -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - - } - - // CkipFlag is no use for reassociate - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, &Status); - } - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - PeerReassocRspAction() sanity check fail\n")); - } - -} - -/* - ========================================================================== - Description: - procedures on IEEE 802.11/1999 p.376 - Parametrs: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AssocPostProc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr2, - IN USHORT CapabilityInfo, - IN USHORT Aid, - IN UCHAR SupRate[], - IN UCHAR SupRateLen, - IN UCHAR ExtRate[], - IN UCHAR ExtRateLen, - IN PEDCA_PARM pEdcaParm, - IN HT_CAPABILITY_IE *pHtCapability, - IN UCHAR HtCapabilityLen, - IN ADD_HT_INFO_IE *pAddHtInfo) // AP might use this additional ht info IE -{ - ULONG Idx; - - pAd->MlmeAux.BssType = BSS_INFRA; - COPY_MAC_ADDR(pAd->MlmeAux.Bssid, pAddr2); - pAd->MlmeAux.Aid = Aid; - pAd->MlmeAux.CapabilityInfo = CapabilityInfo & SUPPORTED_CAPABILITY_INFO; - -#ifdef DOT11_N_SUPPORT - // Some HT AP might lost WMM IE. We add WMM ourselves. beacuase HT requires QoS on. - if ((HtCapabilityLen > 0) && (pEdcaParm->bValid == FALSE)) - { - pEdcaParm->bValid = TRUE; - pEdcaParm->Aifsn[0] = 3; - pEdcaParm->Aifsn[1] = 7; - pEdcaParm->Aifsn[2] = 2; - pEdcaParm->Aifsn[3] = 2; - - pEdcaParm->Cwmin[0] = 4; - pEdcaParm->Cwmin[1] = 4; - pEdcaParm->Cwmin[2] = 3; - pEdcaParm->Cwmin[3] = 2; - - pEdcaParm->Cwmax[0] = 10; - pEdcaParm->Cwmax[1] = 10; - pEdcaParm->Cwmax[2] = 4; - pEdcaParm->Cwmax[3] = 3; - - pEdcaParm->Txop[0] = 0; - pEdcaParm->Txop[1] = 0; - pEdcaParm->Txop[2] = 96; - pEdcaParm->Txop[3] = 48; - - } -#endif // DOT11_N_SUPPORT // - - NdisMoveMemory(&pAd->MlmeAux.APEdcaParm, pEdcaParm, sizeof(EDCA_PARM)); - - // filter out un-supported rates - pAd->MlmeAux.SupRateLen = SupRateLen; - NdisMoveMemory(pAd->MlmeAux.SupRate, SupRate, SupRateLen); - RTMPCheckRates(pAd, pAd->MlmeAux.SupRate, &pAd->MlmeAux.SupRateLen); - - // filter out un-supported rates - pAd->MlmeAux.ExtRateLen = ExtRateLen; - NdisMoveMemory(pAd->MlmeAux.ExtRate, ExtRate, ExtRateLen); - RTMPCheckRates(pAd, pAd->MlmeAux.ExtRate, &pAd->MlmeAux.ExtRateLen); - -#ifdef DOT11_N_SUPPORT - if (HtCapabilityLen > 0) - { - RTMPCheckHt(pAd, BSSID_WCID, pHtCapability, pAddHtInfo); - } - DBGPRINT(RT_DEBUG_TRACE, ("AssocPostProc===> AP.AMsduSize = %d. ClientStatusFlags = 0x%lx \n", pAd->MacTab.Content[BSSID_WCID].AMsduSize, pAd->MacTab.Content[BSSID_WCID].ClientStatusFlags)); - - DBGPRINT(RT_DEBUG_TRACE, ("AssocPostProc===> (Mmps=%d, AmsduSize=%d, )\n", - pAd->MacTab.Content[BSSID_WCID].MmpsMode, pAd->MacTab.Content[BSSID_WCID].AMsduSize)); -#endif // DOT11_N_SUPPORT // - - // Set New WPA information - Idx = BssTableSearch(&pAd->ScanTab, pAddr2, pAd->MlmeAux.Channel); - if (Idx == BSS_NOT_FOUND) - { - DBGPRINT_ERR(("ASSOC - Can't find BSS after receiving Assoc response\n")); - } - else - { - // Init variable - pAd->MacTab.Content[BSSID_WCID].RSNIE_Len = 0; - NdisZeroMemory(pAd->MacTab.Content[BSSID_WCID].RSN_IE, MAX_LEN_OF_RSNIE); - - // Store appropriate RSN_IE for WPA SM negotiation later - if ((pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) && (pAd->ScanTab.BssEntry[Idx].VarIELen != 0)) - { - PUCHAR pVIE; - USHORT len; - PEID_STRUCT pEid; - - pVIE = pAd->ScanTab.BssEntry[Idx].VarIEs; - len = pAd->ScanTab.BssEntry[Idx].VarIELen; - //KH need to check again - // Don't allow to go to sleep mode if authmode is WPA-related. - //This can make Authentication process more smoothly. - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); - - while (len > 0) - { - pEid = (PEID_STRUCT) pVIE; - // For WPA/WPAPSK - if ((pEid->Eid == IE_WPA) && (NdisEqualMemory(pEid->Octet, WPA_OUI, 4)) - && (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA || pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) - { - NdisMoveMemory(pAd->MacTab.Content[BSSID_WCID].RSN_IE, pVIE, (pEid->Len + 2)); - pAd->MacTab.Content[BSSID_WCID].RSNIE_Len = (pEid->Len + 2); - DBGPRINT(RT_DEBUG_TRACE, ("AssocPostProc===> Store RSN_IE for WPA SM negotiation \n")); - } - // For WPA2/WPA2PSK - else if ((pEid->Eid == IE_RSN) && (NdisEqualMemory(pEid->Octet + 2, RSN_OUI, 3)) - && (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2 || pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - NdisMoveMemory(pAd->MacTab.Content[BSSID_WCID].RSN_IE, pVIE, (pEid->Len + 2)); - pAd->MacTab.Content[BSSID_WCID].RSNIE_Len = (pEid->Len + 2); - DBGPRINT(RT_DEBUG_TRACE, ("AssocPostProc===> Store RSN_IE for WPA2 SM negotiation \n")); - } - - pVIE += (pEid->Len + 2); - len -= (pEid->Len + 2); - } - - - } - - if (pAd->MacTab.Content[BSSID_WCID].RSNIE_Len == 0) - { - DBGPRINT(RT_DEBUG_TRACE, ("AssocPostProc===> no RSN_IE \n")); - } - else - { - hex_dump("RSN_IE", pAd->MacTab.Content[BSSID_WCID].RSN_IE, pAd->MacTab.Content[BSSID_WCID].RSNIE_Len); - } - } -} - -/* - ========================================================================== - Description: - left part of IEEE 802.11/1999 p.374 - Parameters: - Elem - MLME message containing the received frame - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID PeerDisassocAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR Addr2[MAC_ADDR_LEN]; - USHORT Reason; - - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - PeerDisassocAction()\n")); - if(PeerDisassocSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Reason)) - { - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - PeerDisassocAction() Reason = %d\n", Reason)); - if (INFRA_ON(pAd) && MAC_ADDR_EQUAL(pAd->CommonCfg.Bssid, Addr2)) - { - - if (pAd->CommonCfg.bWirelessEvent) - { - RTMPSendWirelessEvent(pAd, IW_DISASSOC_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - } - - - LinkDown(pAd, TRUE); - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - -#ifdef WPA_SUPPLICANT_SUPPORT -#ifndef NATIVE_WPA_SUPPLICANT_SUPPORT - if (pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) - { - //send disassociate event to wpa_supplicant - RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, RT_DISASSOC_EVENT_FLAG, NULL, NULL, 0); - } -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // -#endif // WPA_SUPPLICANT_SUPPORT // - -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT - RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0); -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - } - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - PeerDisassocAction() sanity check fail\n")); - } - -} - -/* - ========================================================================== - Description: - what the state machine will do after assoc timeout - Parameters: - Elme - - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AssocTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - AssocTimeoutAction\n")); - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - Status = MLME_REJ_TIMEOUT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_ASSOC_CONF, 2, &Status); -} - -/* - ========================================================================== - Description: - what the state machine will do after reassoc timeout - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID ReassocTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - ReassocTimeoutAction\n")); - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - Status = MLME_REJ_TIMEOUT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, &Status); -} - -/* - ========================================================================== - Description: - what the state machine will do after disassoc timeout - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID DisassocTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - DisassocTimeoutAction\n")); - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - Status = MLME_SUCCESS; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DISASSOC_CONF, 2, &Status); -} - -VOID InvalidStateWhenAssoc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - InvalidStateWhenAssoc(state=%ld), reset ASSOC state machine\n", - pAd->Mlme.AssocMachine.CurrState)); - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - Status = MLME_STATE_MACHINE_REJECT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_ASSOC_CONF, 2, &Status); -} - -VOID InvalidStateWhenReassoc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - InvalidStateWhenReassoc(state=%ld), reset ASSOC state machine\n", - pAd->Mlme.AssocMachine.CurrState)); - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - Status = MLME_STATE_MACHINE_REJECT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, &Status); -} - -VOID InvalidStateWhenDisassociate( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - InvalidStateWhenDisassoc(state=%ld), reset ASSOC state machine\n", - pAd->Mlme.AssocMachine.CurrState)); - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - Status = MLME_STATE_MACHINE_REJECT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DISASSOC_CONF, 2, &Status); -} - -/* - ========================================================================== - Description: - right part of IEEE 802.11/1999 page 374 - Note: - This event should never cause ASSOC state machine perform state - transition, and has no relationship with CNTL machine. So we separate - this routine as a service outside of ASSOC state transition table. - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID Cls3errAction( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr) -{ - HEADER_802_11 DisassocHdr; - PHEADER_802_11 pDisassocHdr; - PUCHAR pOutBuffer = NULL; - ULONG FrameLen = 0; - NDIS_STATUS NStatus; - USHORT Reason = REASON_CLS3ERR; - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - return; - - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - Class 3 Error, Send DISASSOC frame\n")); - MgtMacHeaderInit(pAd, &DisassocHdr, SUBTYPE_DISASSOC, 0, pAddr, pAd->CommonCfg.Bssid); // patch peap ttls switching issue - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11),&DisassocHdr, - 2, &Reason, - END_OF_ARGS); - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - - // To patch Instance and Buffalo(N) AP - // Driver has to send deauth to Instance AP, but Buffalo(N) needs to send disassoc to reset Authenticator's state machine - // Therefore, we send both of them. - pDisassocHdr = (PHEADER_802_11)pOutBuffer; - pDisassocHdr->FC.SubType = SUBTYPE_DEAUTH; - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - - MlmeFreeMemory(pAd, pOutBuffer); - - pAd->StaCfg.DisassocReason = REASON_CLS3ERR; - COPY_MAC_ADDR(pAd->StaCfg.DisassocSta, pAddr); -} - -#ifdef WPA_SUPPLICANT_SUPPORT -#ifndef NATIVE_WPA_SUPPLICANT_SUPPORT -VOID SendAssocIEsToWpaSupplicant( - IN PRTMP_ADAPTER pAd) -{ - STRING custom[IW_CUSTOM_MAX] = {0}; - - if ((pAd->StaCfg.ReqVarIELen + 17) <= IW_CUSTOM_MAX) - { - sprintf(custom, "ASSOCINFO_ReqIEs="); - NdisMoveMemory(custom+17, pAd->StaCfg.ReqVarIEs, pAd->StaCfg.ReqVarIELen); - RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, RT_REQIE_EVENT_FLAG, NULL, (PUCHAR)custom, pAd->StaCfg.ReqVarIELen + 17); - - RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, RT_ASSOCINFO_EVENT_FLAG, NULL, NULL, 0); - } - else - DBGPRINT(RT_DEBUG_TRACE, ("pAd->StaCfg.ReqVarIELen + 17 > MAX_CUSTOM_LEN\n")); - - return; -} -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // -#endif // WPA_SUPPLICANT_SUPPORT // - -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT -int wext_notify_event_assoc( - IN RTMP_ADAPTER *pAd) -{ - char custom[IW_CUSTOM_MAX] = {0}; - -#if WIRELESS_EXT > 17 - if (pAd->StaCfg.ReqVarIELen <= IW_CUSTOM_MAX) - { - NdisMoveMemory(custom, pAd->StaCfg.ReqVarIEs, pAd->StaCfg.ReqVarIELen); - RtmpOSWrielessEventSend(pAd, IWEVASSOCREQIE, -1, NULL, custom, pAd->StaCfg.ReqVarIELen); - } - else - DBGPRINT(RT_DEBUG_TRACE, ("pAd->StaCfg.ReqVarIELen > MAX_CUSTOM_LEN\n")); -#else - int len; - - len = (pAd->StaCfg.ReqVarIELen*2) + 17; - if (len <= IW_CUSTOM_MAX) - { - UCHAR idx; - sprintf(custom, "ASSOCINFO(ReqIEs="); - for (idx=0; idxStaCfg.ReqVarIELen; idx++) - sprintf(custom, "%s%02x", custom, pAd->StaCfg.ReqVarIEs[idx]); - RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, -1, NULL, custom, len); - } - else - DBGPRINT(RT_DEBUG_TRACE, ("len(%d) > MAX_CUSTOM_LEN\n", len)); -#endif - - return 0; - -} -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - - -BOOLEAN StaAddMacTableEntry( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN UCHAR MaxSupportedRateIn500Kbps, - IN HT_CAPABILITY_IE *pHtCapability, - IN UCHAR HtCapabilityLen, - IN ADD_HT_INFO_IE *pAddHtInfo, - IN UCHAR AddHtInfoLen, - IN USHORT CapabilityInfo) -{ - UCHAR MaxSupportedRate = RATE_11; - - if (ADHOC_ON(pAd)) - CLIENT_STATUS_CLEAR_FLAG(pEntry, fCLIENT_STATUS_WMM_CAPABLE); - - switch (MaxSupportedRateIn500Kbps) - { - case 108: MaxSupportedRate = RATE_54; break; - case 96: MaxSupportedRate = RATE_48; break; - case 72: MaxSupportedRate = RATE_36; break; - case 48: MaxSupportedRate = RATE_24; break; - case 36: MaxSupportedRate = RATE_18; break; - case 24: MaxSupportedRate = RATE_12; break; - case 18: MaxSupportedRate = RATE_9; break; - case 12: MaxSupportedRate = RATE_6; break; - case 22: MaxSupportedRate = RATE_11; break; - case 11: MaxSupportedRate = RATE_5_5; break; - case 4: MaxSupportedRate = RATE_2; break; - case 2: MaxSupportedRate = RATE_1; break; - default: MaxSupportedRate = RATE_11; break; - } - - if ((pAd->CommonCfg.PhyMode == PHY_11G) && (MaxSupportedRate < RATE_FIRST_OFDM_RATE)) - return FALSE; - -#ifdef DOT11_N_SUPPORT - // 11n only - if (((pAd->CommonCfg.PhyMode == PHY_11N_2_4G) || (pAd->CommonCfg.PhyMode == PHY_11N_5G))&& (HtCapabilityLen == 0)) - return FALSE; -#endif // DOT11_N_SUPPORT // - - if (!pEntry) - return FALSE; - - NdisAcquireSpinLock(&pAd->MacTabLock); - if (pEntry) - { - pEntry->PortSecured = WPA_802_1X_PORT_SECURED; - if ((MaxSupportedRate < RATE_FIRST_OFDM_RATE) || - (pAd->CommonCfg.PhyMode == PHY_11B)) - { - pEntry->RateLen = 4; - if (MaxSupportedRate >= RATE_FIRST_OFDM_RATE) - MaxSupportedRate = RATE_11; - } - else - pEntry->RateLen = 12; - - pEntry->MaxHTPhyMode.word = 0; - pEntry->MinHTPhyMode.word = 0; - pEntry->HTPhyMode.word = 0; - pEntry->MaxSupportedRate = MaxSupportedRate; - if (pEntry->MaxSupportedRate < RATE_FIRST_OFDM_RATE) - { - pEntry->MaxHTPhyMode.field.MODE = MODE_CCK; - pEntry->MaxHTPhyMode.field.MCS = pEntry->MaxSupportedRate; - pEntry->MinHTPhyMode.field.MODE = MODE_CCK; - pEntry->MinHTPhyMode.field.MCS = pEntry->MaxSupportedRate; - pEntry->HTPhyMode.field.MODE = MODE_CCK; - pEntry->HTPhyMode.field.MCS = pEntry->MaxSupportedRate; - } - else - { - pEntry->MaxHTPhyMode.field.MODE = MODE_OFDM; - pEntry->MaxHTPhyMode.field.MCS = OfdmRateToRxwiMCS[pEntry->MaxSupportedRate]; - pEntry->MinHTPhyMode.field.MODE = MODE_OFDM; - pEntry->MinHTPhyMode.field.MCS = OfdmRateToRxwiMCS[pEntry->MaxSupportedRate]; - pEntry->HTPhyMode.field.MODE = MODE_OFDM; - pEntry->HTPhyMode.field.MCS = OfdmRateToRxwiMCS[pEntry->MaxSupportedRate]; - } - pEntry->CapabilityInfo = CapabilityInfo; - CLIENT_STATUS_CLEAR_FLAG(pEntry, fCLIENT_STATUS_AGGREGATION_CAPABLE); - CLIENT_STATUS_CLEAR_FLAG(pEntry, fCLIENT_STATUS_PIGGYBACK_CAPABLE); - } - -#ifdef DOT11_N_SUPPORT - NdisZeroMemory(&pEntry->HTCapability, sizeof(pEntry->HTCapability)); - // If this Entry supports 802.11n, upgrade to HT rate. - if ((HtCapabilityLen != 0) && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) - { - UCHAR j, bitmask; //k,bitmask; - CHAR i; - - if (ADHOC_ON(pAd)) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_WMM_CAPABLE); - if ((pHtCapability->HtCapInfo.GF) && (pAd->CommonCfg.DesiredHtPhy.GF)) - { - pEntry->MaxHTPhyMode.field.MODE = MODE_HTGREENFIELD; - } - else - { - pEntry->MaxHTPhyMode.field.MODE = MODE_HTMIX; - pAd->MacTab.fAnyStationNonGF = TRUE; - pAd->CommonCfg.AddHTInfo.AddHtInfo2.NonGfPresent = 1; - } - - if ((pHtCapability->HtCapInfo.ChannelWidth) && - (pAd->CommonCfg.DesiredHtPhy.ChannelWidth) && - ((pAd->StaCfg.BssType == BSS_INFRA) || ((pAd->StaCfg.BssType == BSS_ADHOC) && (pAddHtInfo->AddHtInfo.ExtChanOffset == pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset)))) - { - pEntry->MaxHTPhyMode.field.BW= BW_40; - pEntry->MaxHTPhyMode.field.ShortGI = ((pAd->CommonCfg.DesiredHtPhy.ShortGIfor40)&(pHtCapability->HtCapInfo.ShortGIfor40)); - } - else - { - pEntry->MaxHTPhyMode.field.BW = BW_20; - pEntry->MaxHTPhyMode.field.ShortGI = ((pAd->CommonCfg.DesiredHtPhy.ShortGIfor20)&(pHtCapability->HtCapInfo.ShortGIfor20)); - pAd->MacTab.fAnyStation20Only = TRUE; - } - - // 3*3 - if (pAd->MACVersion >= RALINK_2883_VERSION && pAd->MACVersion < RALINK_3070_VERSION) - pEntry->MaxHTPhyMode.field.TxBF = pAd->CommonCfg.RegTransmitSetting.field.TxBF; - - // find max fixed rate - for (i=23; i>=0; i--) // 3*3 - { - j = i/8; - bitmask = (1<<(i-(j*8))); - if ((pAd->StaCfg.DesiredHtPhyInfo.MCSSet[j] & bitmask) && (pHtCapability->MCSSet[j] & bitmask)) - { - pEntry->MaxHTPhyMode.field.MCS = i; - break; - } - if (i==0) - break; - } - - - if (pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) - { - if (pAd->StaCfg.DesiredTransmitSetting.field.MCS == 32) - { - // Fix MCS as HT Duplicated Mode - pEntry->MaxHTPhyMode.field.BW = 1; - pEntry->MaxHTPhyMode.field.MODE = MODE_HTMIX; - pEntry->MaxHTPhyMode.field.STBC = 0; - pEntry->MaxHTPhyMode.field.ShortGI = 0; - pEntry->MaxHTPhyMode.field.MCS = 32; - } - else if (pEntry->MaxHTPhyMode.field.MCS > pAd->StaCfg.HTPhyMode.field.MCS) - { - // STA supports fixed MCS - pEntry->MaxHTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - } - } - - pEntry->MaxHTPhyMode.field.STBC = (pHtCapability->HtCapInfo.RxSTBC & (pAd->CommonCfg.DesiredHtPhy.TxSTBC)); - pEntry->MpduDensity = pHtCapability->HtCapParm.MpduDensity; - pEntry->MaxRAmpduFactor = pHtCapability->HtCapParm.MaxRAmpduFactor; - pEntry->MmpsMode = (UCHAR)pHtCapability->HtCapInfo.MimoPs; - pEntry->AMsduSize = (UCHAR)pHtCapability->HtCapInfo.AMsduSize; - pEntry->HTPhyMode.word = pEntry->MaxHTPhyMode.word; - - if (pAd->CommonCfg.DesiredHtPhy.AmsduEnable && (pAd->CommonCfg.REGBACapability.field.AutoBA == FALSE)) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_AMSDU_INUSED); - if (pHtCapability->HtCapInfo.ShortGIfor20) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_SGI20_CAPABLE); - if (pHtCapability->HtCapInfo.ShortGIfor40) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_SGI40_CAPABLE); - if (pHtCapability->HtCapInfo.TxSTBC) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_TxSTBC_CAPABLE); - if (pHtCapability->HtCapInfo.RxSTBC) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_RxSTBC_CAPABLE); - if (pHtCapability->ExtHtCapInfo.PlusHTC) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_HTC_CAPABLE); - if (pAd->CommonCfg.bRdg && pHtCapability->ExtHtCapInfo.RDGSupport) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_RDG_CAPABLE); - if (pHtCapability->ExtHtCapInfo.MCSFeedback == 0x03) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_MCSFEEDBACK_CAPABLE); - NdisMoveMemory(&pEntry->HTCapability, pHtCapability, HtCapabilityLen); - } - else - { - pAd->MacTab.fAnyStationIsLegacy = TRUE; - } -#endif // DOT11_N_SUPPORT // - - pEntry->HTPhyMode.word = pEntry->MaxHTPhyMode.word; - pEntry->CurrTxRate = pEntry->MaxSupportedRate; - - // Set asic auto fall back - if (pAd->StaCfg.bAutoTxRateSwitch == TRUE) - { - PUCHAR pTable; - UCHAR TableSize = 0; - - MlmeSelectTxRateTable(pAd, pEntry, &pTable, &TableSize, &pEntry->CurrTxRateIndex); - pEntry->bAutoTxRateSwitch = TRUE; - } - else - { - pEntry->HTPhyMode.field.MODE = pAd->StaCfg.HTPhyMode.field.MODE; - pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - pEntry->bAutoTxRateSwitch = FALSE; - - // If the legacy mode is set, overwrite the transmit setting of this entry. - RTMPUpdateLegacyTxSetting((UCHAR)pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode, pEntry); - } - - pEntry->PortSecured = WPA_802_1X_PORT_SECURED; - pEntry->Sst = SST_ASSOC; - pEntry->AuthState = AS_AUTH_OPEN; - pEntry->AuthMode = pAd->StaCfg.AuthMode; - pEntry->WepStatus = pAd->StaCfg.WepStatus; - - NdisReleaseSpinLock(&pAd->MacTabLock); - -#ifdef WPA_SUPPLICANT_SUPPORT -#ifndef NATIVE_WPA_SUPPLICANT_SUPPORT - if (pAd->StaCfg.WpaSupplicantUP) - { - union iwreq_data wrqu; - - SendAssocIEsToWpaSupplicant(pAd); - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.data.flags = RT_ASSOC_EVENT_FLAG; - wireless_send_event(pAd->net_dev, IWEVCUSTOM, &wrqu, NULL); - } -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // -#endif // WPA_SUPPLICANT_SUPPORT // - -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT - { - union iwreq_data wrqu; - wext_notify_event_assoc(pAd); - - memset(wrqu.ap_addr.sa_data, 0, MAC_ADDR_LEN); - memcpy(wrqu.ap_addr.sa_data, pAd->MlmeAux.Bssid, MAC_ADDR_LEN); - wireless_send_event(pAd->net_dev, SIOCGIWAP, &wrqu, NULL); - - } -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - return TRUE; -} diff --git a/drivers/staging/rt3090/sta/auth.c b/drivers/staging/rt3090/sta/auth.c deleted file mode 100644 index 157e2999fa19..000000000000 --- a/drivers/staging/rt3090/sta/auth.c +++ /dev/null @@ -1,491 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - auth.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - John 2004-9-3 porting from RT2500 -*/ - -#include "../rt_config.h" - - -/* - ========================================================================== - Description: - authenticate state machine init, including state transition and timer init - Parameters: - Sm - pointer to the auth state machine - Note: - The state machine looks like this - - AUTH_REQ_IDLE AUTH_WAIT_SEQ2 AUTH_WAIT_SEQ4 - MT2_MLME_AUTH_REQ mlme_auth_req_action invalid_state_when_auth invalid_state_when_auth - MT2_PEER_AUTH_EVEN drop peer_auth_even_at_seq2_action peer_auth_even_at_seq4_action - MT2_AUTH_TIMEOUT Drop auth_timeout_action auth_timeout_action - - IRQL = PASSIVE_LEVEL - - ========================================================================== - */ - -void AuthStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *Sm, - OUT STATE_MACHINE_FUNC Trans[]) -{ - StateMachineInit(Sm, Trans, MAX_AUTH_STATE, MAX_AUTH_MSG, (STATE_MACHINE_FUNC)Drop, AUTH_REQ_IDLE, AUTH_MACHINE_BASE); - - // the first column - StateMachineSetAction(Sm, AUTH_REQ_IDLE, MT2_MLME_AUTH_REQ, (STATE_MACHINE_FUNC)MlmeAuthReqAction); - - // the second column - StateMachineSetAction(Sm, AUTH_WAIT_SEQ2, MT2_MLME_AUTH_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenAuth); - StateMachineSetAction(Sm, AUTH_WAIT_SEQ2, MT2_PEER_AUTH_EVEN, (STATE_MACHINE_FUNC)PeerAuthRspAtSeq2Action); - StateMachineSetAction(Sm, AUTH_WAIT_SEQ2, MT2_AUTH_TIMEOUT, (STATE_MACHINE_FUNC)AuthTimeoutAction); - - // the third column - StateMachineSetAction(Sm, AUTH_WAIT_SEQ4, MT2_MLME_AUTH_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenAuth); - StateMachineSetAction(Sm, AUTH_WAIT_SEQ4, MT2_PEER_AUTH_EVEN, (STATE_MACHINE_FUNC)PeerAuthRspAtSeq4Action); - StateMachineSetAction(Sm, AUTH_WAIT_SEQ4, MT2_AUTH_TIMEOUT, (STATE_MACHINE_FUNC)AuthTimeoutAction); - - RTMPInitTimer(pAd, &pAd->MlmeAux.AuthTimer, GET_TIMER_FUNCTION(AuthTimeout), pAd, FALSE); -} - -/* - ========================================================================== - Description: - function to be executed at timer thread when auth timer expires - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AuthTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; - - DBGPRINT(RT_DEBUG_TRACE,("AUTH - AuthTimeout\n")); - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - return; - - // send a de-auth to reset AP's state machine (Patch AP-Dir635) - if (pAd->Mlme.AuthMachine.CurrState == AUTH_WAIT_SEQ2) - Cls2errAction(pAd, pAd->MlmeAux.Bssid); - - - MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_AUTH_TIMEOUT, 0, NULL); - RTMP_MLME_HANDLER(pAd); -} - - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID MlmeAuthReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - if (AUTH_ReqSend(pAd, Elem, &pAd->MlmeAux.AuthTimer, "AUTH", 1, NULL, 0)) - pAd->Mlme.AuthMachine.CurrState = AUTH_WAIT_SEQ2; - else - { - USHORT Status; - - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - Status = MLME_INVALID_FORMAT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); - } -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID PeerAuthRspAtSeq2Action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR Addr2[MAC_ADDR_LEN]; - USHORT Seq, Status, RemoteStatus, Alg; - UCHAR ChlgText[CIPHER_TEXT_LEN]; - UCHAR CyperChlgText[CIPHER_TEXT_LEN + 8 + 8]; - UCHAR Element[2]; - HEADER_802_11 AuthHdr; - BOOLEAN TimerCancelled; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - USHORT Status2; - - if (PeerAuthSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Alg, &Seq, &Status, (PCHAR)ChlgText)) - { - if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, Addr2) && Seq == 2) - { - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Receive AUTH_RSP seq#2 to me (Alg=%d, Status=%d)\n", Alg, Status)); - RTMPCancelTimer(&pAd->MlmeAux.AuthTimer, &TimerCancelled); - - if (Status == MLME_SUCCESS) - { - // Authentication Mode "LEAP" has allow for CCX 1.X - if (pAd->MlmeAux.Alg == Ndis802_11AuthModeOpen) - { - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); - } - else - { - // 2. shared key, need to be challenged - Seq++; - RemoteStatus = MLME_SUCCESS; - - // Get an unused nonpaged memory - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - PeerAuthRspAtSeq2Action() allocate memory fail\n")); - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - Status2 = MLME_FAIL_NO_RESOURCE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status2); - return; - } - - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Send AUTH request seq#3...\n")); - MgtMacHeaderInit(pAd, &AuthHdr, SUBTYPE_AUTH, 0, Addr2, pAd->MlmeAux.Bssid); - AuthHdr.FC.Wep = 1; - // Encrypt challenge text & auth information - RTMPInitWepEngine( - pAd, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].Key, - pAd->StaCfg.DefaultKeyId, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].KeyLen, - CyperChlgText); - - Alg = cpu2le16(*(USHORT *)&Alg); - Seq = cpu2le16(*(USHORT *)&Seq); - RemoteStatus= cpu2le16(*(USHORT *)&RemoteStatus); - - RTMPEncryptData(pAd, (PUCHAR) &Alg, CyperChlgText + 4, 2); - RTMPEncryptData(pAd, (PUCHAR) &Seq, CyperChlgText + 6, 2); - RTMPEncryptData(pAd, (PUCHAR) &RemoteStatus, CyperChlgText + 8, 2); - Element[0] = 16; - Element[1] = 128; - RTMPEncryptData(pAd, Element, CyperChlgText + 10, 2); - RTMPEncryptData(pAd, ChlgText, CyperChlgText + 12, 128); - RTMPSetICV(pAd, CyperChlgText + 140); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &AuthHdr, - CIPHER_TEXT_LEN + 16, CyperChlgText, - END_OF_ARGS); - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - - RTMPSetTimer(&pAd->MlmeAux.AuthTimer, AUTH_TIMEOUT); - pAd->Mlme.AuthMachine.CurrState = AUTH_WAIT_SEQ4; - } - } - else - { - pAd->StaCfg.AuthFailReason = Status; - COPY_MAC_ADDR(pAd->StaCfg.AuthFailSta, Addr2); - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); - } - } - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - PeerAuthSanity() sanity check fail\n")); - } -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID PeerAuthRspAtSeq4Action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR Addr2[MAC_ADDR_LEN]; - USHORT Alg, Seq, Status; - CHAR ChlgText[CIPHER_TEXT_LEN]; - BOOLEAN TimerCancelled; - - if(PeerAuthSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Alg, &Seq, &Status, ChlgText)) - { - if(MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, Addr2) && Seq == 4) - { - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Receive AUTH_RSP seq#4 to me\n")); - RTMPCancelTimer(&pAd->MlmeAux.AuthTimer, &TimerCancelled); - - if (Status != MLME_SUCCESS) - { - pAd->StaCfg.AuthFailReason = Status; - COPY_MAC_ADDR(pAd->StaCfg.AuthFailSta, Addr2); - } - - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); - } - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - PeerAuthRspAtSeq4Action() sanity check fail\n")); - } -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID MlmeDeauthReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - MLME_DEAUTH_REQ_STRUCT *pInfo; - HEADER_802_11 DeauthHdr; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - USHORT Status; - - pInfo = (MLME_DEAUTH_REQ_STRUCT *)Elem->Msg; - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - MlmeDeauthReqAction() allocate memory fail\n")); - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - Status = MLME_FAIL_NO_RESOURCE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DEAUTH_CONF, 2, &Status); - return; - } - - - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Send DE-AUTH request (Reason=%d)...\n", pInfo->Reason)); - MgtMacHeaderInit(pAd, &DeauthHdr, SUBTYPE_DEAUTH, 0, pInfo->Addr, pAd->MlmeAux.Bssid); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11),&DeauthHdr, - 2, &pInfo->Reason, - END_OF_ARGS); - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - - pAd->StaCfg.DeauthReason = pInfo->Reason; - COPY_MAC_ADDR(pAd->StaCfg.DeauthSta, pInfo->Addr); - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - Status = MLME_SUCCESS; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DEAUTH_CONF, 2, &Status); - - // send wireless event - for deauthentication - if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_DEAUTH_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID AuthTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - AuthTimeoutAction\n")); - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - Status = MLME_REJ_TIMEOUT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID InvalidStateWhenAuth( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - InvalidStateWhenAuth (state=%ld), reset AUTH state machine\n", pAd->Mlme.AuthMachine.CurrState)); - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - Status = MLME_STATE_MACHINE_REJECT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); -} - -/* - ========================================================================== - Description: - Some STA/AP - Note: - This action should never trigger AUTH state transition, therefore we - separate it from AUTH state machine, and make it as a standalone service - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID Cls2errAction( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr) -{ - HEADER_802_11 DeauthHdr; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - USHORT Reason = REASON_CLS2ERR; - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - return; - - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Class 2 error, Send DEAUTH frame...\n")); - MgtMacHeaderInit(pAd, &DeauthHdr, SUBTYPE_DEAUTH, 0, pAddr, pAd->MlmeAux.Bssid); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11),&DeauthHdr, - 2, &Reason, - END_OF_ARGS); - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - - pAd->StaCfg.DeauthReason = Reason; - COPY_MAC_ADDR(pAd->StaCfg.DeauthSta, pAddr); -} - -BOOLEAN AUTH_ReqSend( - IN PRTMP_ADAPTER pAd, - IN PMLME_QUEUE_ELEM pElem, - IN PRALINK_TIMER_STRUCT pAuthTimer, - IN PSTRING pSMName, - IN USHORT SeqNo, - IN PUCHAR pNewElement, - IN ULONG ElementLen) -{ - USHORT Alg, Seq, Status; - UCHAR Addr[6]; - ULONG Timeout; - HEADER_802_11 AuthHdr; - BOOLEAN TimerCancelled; - NDIS_STATUS NStatus; - PUCHAR pOutBuffer = NULL; - ULONG FrameLen = 0, tmp = 0; - - // Block all authentication request durning WPA block period - if (pAd->StaCfg.bBlockAssoc == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s - Block Auth request durning WPA block period!\n", pSMName)); - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - Status = MLME_STATE_MACHINE_REJECT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); - } - else if(MlmeAuthReqSanity(pAd, pElem->Msg, pElem->MsgLen, Addr, &Timeout, &Alg)) - { - /* reset timer */ - RTMPCancelTimer(pAuthTimer, &TimerCancelled); - - COPY_MAC_ADDR(pAd->MlmeAux.Bssid, Addr); - pAd->MlmeAux.Alg = Alg; - Seq = SeqNo; - Status = MLME_SUCCESS; - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s - MlmeAuthReqAction(Alg:%d) allocate memory failed\n", pSMName, Alg)); - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - Status = MLME_FAIL_NO_RESOURCE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); - return FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("%s - Send AUTH request seq#1 (Alg=%d)...\n", pSMName, Alg)); - MgtMacHeaderInit(pAd, &AuthHdr, SUBTYPE_AUTH, 0, Addr, pAd->MlmeAux.Bssid); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11),&AuthHdr, - 2, &Alg, - 2, &Seq, - 2, &Status, - END_OF_ARGS); - - if (pNewElement && ElementLen) - { - MakeOutgoingFrame(pOutBuffer+FrameLen, &tmp, - ElementLen, pNewElement, - END_OF_ARGS); - FrameLen += tmp; - } - - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - - RTMPSetTimer(pAuthTimer, Timeout); - return TRUE; - } - else - { - DBGPRINT_ERR(("%s - MlmeAuthReqAction() sanity check failed\n", pSMName)); - return FALSE; - } - - return TRUE; -} diff --git a/drivers/staging/rt3090/sta/auth_rsp.c b/drivers/staging/rt3090/sta/auth_rsp.c deleted file mode 100644 index 207bfeada1e4..000000000000 --- a/drivers/staging/rt3090/sta/auth_rsp.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - auth_rsp.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - John 2004-10-1 copy from RT2560 -*/ - -#include "../rt_config.h" - - -/* - ========================================================================== - Description: - authentication state machine init procedure - Parameters: - Sm - the state machine - - IRQL = PASSIVE_LEVEL - - ========================================================================== - */ -VOID AuthRspStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN PSTATE_MACHINE Sm, - IN STATE_MACHINE_FUNC Trans[]) -{ - StateMachineInit(Sm, Trans, MAX_AUTH_RSP_STATE, MAX_AUTH_RSP_MSG, (STATE_MACHINE_FUNC)Drop, AUTH_RSP_IDLE, AUTH_RSP_MACHINE_BASE); - - // column 1 - StateMachineSetAction(Sm, AUTH_RSP_IDLE, MT2_PEER_DEAUTH, (STATE_MACHINE_FUNC)PeerDeauthAction); - - // column 2 - StateMachineSetAction(Sm, AUTH_RSP_WAIT_CHAL, MT2_PEER_DEAUTH, (STATE_MACHINE_FUNC)PeerDeauthAction); - -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID PeerAuthSimpleRspGenAndSend( - IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHdr80211, - IN USHORT Alg, - IN USHORT Seq, - IN USHORT Reason, - IN USHORT Status) -{ - HEADER_802_11 AuthHdr; - ULONG FrameLen = 0; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - - if (Reason != MLME_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("Peer AUTH fail...\n")); - return; - } - - //Get an unused nonpaged memory - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); - if (NStatus != NDIS_STATUS_SUCCESS) - return; - - DBGPRINT(RT_DEBUG_TRACE, ("Send AUTH response (seq#2)...\n")); - MgtMacHeaderInit(pAd, &AuthHdr, SUBTYPE_AUTH, 0, pHdr80211->Addr2, pAd->MlmeAux.Bssid); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &AuthHdr, - 2, &Alg, - 2, &Seq, - 2, &Reason, - END_OF_ARGS); - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID PeerDeauthAction( - IN PRTMP_ADAPTER pAd, - IN PMLME_QUEUE_ELEM Elem) -{ - UCHAR Addr2[MAC_ADDR_LEN]; - USHORT Reason; - - if (PeerDeauthSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Reason)) - { - if (INFRA_ON(pAd) - && MAC_ADDR_EQUAL(Addr2, pAd->CommonCfg.Bssid) - ) - { - DBGPRINT(RT_DEBUG_TRACE,("AUTH_RSP - receive DE-AUTH from our AP (Reason=%d)\n", Reason)); - - -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT - RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0); -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - - - // send wireless event - for deauthentication - if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_DEAUTH_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - - LinkDown(pAd, TRUE); - } - } - else - { - DBGPRINT(RT_DEBUG_TRACE,("AUTH_RSP - PeerDeauthAction() sanity check fail\n")); - } -} diff --git a/drivers/staging/rt3090/sta/connect.c b/drivers/staging/rt3090/sta/connect.c deleted file mode 100644 index 4aa35ee3ade1..000000000000 --- a/drivers/staging/rt3090/sta/connect.c +++ /dev/null @@ -1,2759 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - connect.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - John 2004-08-08 Major modification from RT2560 -*/ - -#include "../rt_config.h" - - -UCHAR CipherSuiteWpaNoneTkip[] = { - 0x00, 0x50, 0xf2, 0x01, // oui - 0x01, 0x00, // Version - 0x00, 0x50, 0xf2, 0x02, // Multicast - 0x01, 0x00, // Number of unicast - 0x00, 0x50, 0xf2, 0x02, // unicast - 0x01, 0x00, // number of authentication method - 0x00, 0x50, 0xf2, 0x00 // authentication - }; -UCHAR CipherSuiteWpaNoneTkipLen = (sizeof(CipherSuiteWpaNoneTkip) / sizeof(UCHAR)); - -UCHAR CipherSuiteWpaNoneAes[] = { - 0x00, 0x50, 0xf2, 0x01, // oui - 0x01, 0x00, // Version - 0x00, 0x50, 0xf2, 0x04, // Multicast - 0x01, 0x00, // Number of unicast - 0x00, 0x50, 0xf2, 0x04, // unicast - 0x01, 0x00, // number of authentication method - 0x00, 0x50, 0xf2, 0x00 // authentication - }; -UCHAR CipherSuiteWpaNoneAesLen = (sizeof(CipherSuiteWpaNoneAes) / sizeof(UCHAR)); - -// The following MACRO is called after 1. starting an new IBSS, 2. succesfully JOIN an IBSS, -// or 3. succesfully ASSOCIATE to a BSS, 4. successfully RE_ASSOCIATE to a BSS -// All settings successfuly negotiated furing MLME state machines become final settings -// and are copied to pAd->StaActive -#define COPY_SETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(_pAd) \ -{ \ - NdisZeroMemory((_pAd)->CommonCfg.Ssid, MAX_LEN_OF_SSID); \ - (_pAd)->CommonCfg.SsidLen = (_pAd)->MlmeAux.SsidLen; \ - NdisMoveMemory((_pAd)->CommonCfg.Ssid, (_pAd)->MlmeAux.Ssid, (_pAd)->MlmeAux.SsidLen); \ - COPY_MAC_ADDR((_pAd)->CommonCfg.Bssid, (_pAd)->MlmeAux.Bssid); \ - (_pAd)->CommonCfg.Channel = (_pAd)->MlmeAux.Channel; \ - (_pAd)->CommonCfg.CentralChannel = (_pAd)->MlmeAux.CentralChannel; \ - (_pAd)->StaActive.Aid = (_pAd)->MlmeAux.Aid; \ - (_pAd)->StaActive.AtimWin = (_pAd)->MlmeAux.AtimWin; \ - (_pAd)->StaActive.CapabilityInfo = (_pAd)->MlmeAux.CapabilityInfo; \ - (_pAd)->CommonCfg.BeaconPeriod = (_pAd)->MlmeAux.BeaconPeriod; \ - (_pAd)->StaActive.CfpMaxDuration = (_pAd)->MlmeAux.CfpMaxDuration; \ - (_pAd)->StaActive.CfpPeriod = (_pAd)->MlmeAux.CfpPeriod; \ - (_pAd)->StaActive.SupRateLen = (_pAd)->MlmeAux.SupRateLen; \ - NdisMoveMemory((_pAd)->StaActive.SupRate, (_pAd)->MlmeAux.SupRate, (_pAd)->MlmeAux.SupRateLen);\ - (_pAd)->StaActive.ExtRateLen = (_pAd)->MlmeAux.ExtRateLen; \ - NdisMoveMemory((_pAd)->StaActive.ExtRate, (_pAd)->MlmeAux.ExtRate, (_pAd)->MlmeAux.ExtRateLen);\ - NdisMoveMemory(&(_pAd)->CommonCfg.APEdcaParm, &(_pAd)->MlmeAux.APEdcaParm, sizeof(EDCA_PARM));\ - NdisMoveMemory(&(_pAd)->CommonCfg.APQosCapability, &(_pAd)->MlmeAux.APQosCapability, sizeof(QOS_CAPABILITY_PARM));\ - NdisMoveMemory(&(_pAd)->CommonCfg.APQbssLoad, &(_pAd)->MlmeAux.APQbssLoad, sizeof(QBSS_LOAD_PARM));\ - COPY_MAC_ADDR((_pAd)->MacTab.Content[BSSID_WCID].Addr, (_pAd)->MlmeAux.Bssid); \ - (_pAd)->MacTab.Content[BSSID_WCID].Aid = (_pAd)->MlmeAux.Aid; \ - (_pAd)->MacTab.Content[BSSID_WCID].PairwiseKey.CipherAlg = (_pAd)->StaCfg.PairCipher;\ - COPY_MAC_ADDR((_pAd)->MacTab.Content[BSSID_WCID].PairwiseKey.BssId, (_pAd)->MlmeAux.Bssid);\ - (_pAd)->MacTab.Content[BSSID_WCID].RateLen = (_pAd)->StaActive.SupRateLen + (_pAd)->StaActive.ExtRateLen;\ -} - -/* - ========================================================================== - Description: - - IRQL = PASSIVE_LEVEL - - ========================================================================== -*/ -VOID MlmeCntlInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - OUT STATE_MACHINE_FUNC Trans[]) -{ - // Control state machine differs from other state machines, the interface - // follows the standard interface - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID MlmeCntlMachinePerformAction( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - IN MLME_QUEUE_ELEM *Elem) -{ - switch(pAd->Mlme.CntlMachine.CurrState) - { - case CNTL_IDLE: - CntlIdleProc(pAd, Elem); - break; - case CNTL_WAIT_DISASSOC: - CntlWaitDisassocProc(pAd, Elem); - break; - case CNTL_WAIT_JOIN: - CntlWaitJoinProc(pAd, Elem); - break; - - // CNTL_WAIT_REASSOC is the only state in CNTL machine that does - // not triggered directly or indirectly by "RTMPSetInformation(OID_xxx)". - // Therefore not protected by NDIS's "only one outstanding OID request" - // rule. Which means NDIS may SET OID in the middle of ROAMing attempts. - // Current approach is to block new SET request at RTMPSetInformation() - // when CntlMachine.CurrState is not CNTL_IDLE - case CNTL_WAIT_REASSOC: - CntlWaitReassocProc(pAd, Elem); - break; - - case CNTL_WAIT_START: - CntlWaitStartProc(pAd, Elem); - break; - case CNTL_WAIT_AUTH: - CntlWaitAuthProc(pAd, Elem); - break; - case CNTL_WAIT_AUTH2: - CntlWaitAuthProc2(pAd, Elem); - break; - case CNTL_WAIT_ASSOC: - CntlWaitAssocProc(pAd, Elem); - break; - - case CNTL_WAIT_OID_LIST_SCAN: - if(Elem->MsgType == MT2_SCAN_CONF) - { - // Resume TxRing after SCANING complete. We hope the out-of-service time - // won't be too long to let upper layer time-out the waiting frames - RTMPResumeMsduTransmission(pAd); - - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - - // - // Set LED status to previous status. - // - if (pAd->bLedOnScanning) - { - pAd->bLedOnScanning = FALSE; - RTMPSetLED(pAd, pAd->LedStatus); - } -#ifdef DOT11N_DRAFT3 - // AP sent a 2040Coexistence mgmt frame, then station perform a scan, and then send back the respone. - if (pAd->CommonCfg.BSSCoexist2040.field.InfoReq == 1) - { - Update2040CoexistFrameAndNotify(pAd, BSSID_WCID, TRUE); - } -#endif // DOT11N_DRAFT3 // - } - break; - - case CNTL_WAIT_OID_DISASSOC: - if (Elem->MsgType == MT2_DISASSOC_CONF) - { - LinkDown(pAd, FALSE); - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - } - break; - default: - DBGPRINT_ERR(("!ERROR! CNTL - Illegal message type(=%ld)", Elem->MsgType)); - break; - } -} - - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID CntlIdleProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - MLME_DISASSOC_REQ_STRUCT DisassocReq; - - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) - return; - - switch(Elem->MsgType) - { - case OID_802_11_SSID: - CntlOidSsidProc(pAd, Elem); - break; - - case OID_802_11_BSSID: - CntlOidRTBssidProc(pAd,Elem); - break; - - case OID_802_11_BSSID_LIST_SCAN: - CntlOidScanProc(pAd,Elem); - break; - - case OID_802_11_DISASSOCIATE: - DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_DISASSOC_STA_LEAVING); - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC; -#ifdef WPA_SUPPLICANT_SUPPORT - if (pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_ENABLE_WITH_WEB_UI) -#endif // WPA_SUPPLICANT_SUPPORT // - { - // Set the AutoReconnectSsid to prevent it reconnect to old SSID - // Since calling this indicate user don't want to connect to that SSID anymore. - pAd->MlmeAux.AutoReconnectSsidLen= 32; - NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen); - } - break; - - case MT2_MLME_ROAMING_REQ: - CntlMlmeRoamingProc(pAd, Elem); - break; - - case OID_802_11_MIC_FAILURE_REPORT_FRAME: - WpaMicFailureReportFrame(pAd, Elem); - break; - -#ifdef QOS_DLS_SUPPORT - case RT_OID_802_11_SET_DLS_PARAM: - CntlOidDLSSetupProc(pAd, Elem); - break; -#endif // QOS_DLS_SUPPORT // - - default: - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Illegal message in CntlIdleProc(MsgType=%ld)\n",Elem->MsgType)); - break; - } -} - -VOID CntlOidScanProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - MLME_SCAN_REQ_STRUCT ScanReq; - ULONG BssIdx = BSS_NOT_FOUND; - BSS_ENTRY CurrBss; - -#ifdef RALINK_ATE -/* Disable scanning when ATE is running. */ - if (ATE_ON(pAd)) - return; -#endif // RALINK_ATE // - - - // record current BSS if network is connected. - // 2003-2-13 do not include current IBSS if this is the only STA in this IBSS. - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - BssIdx = BssSsidTableSearch(&pAd->ScanTab, pAd->CommonCfg.Bssid, (PUCHAR)pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen, pAd->CommonCfg.Channel); - if (BssIdx != BSS_NOT_FOUND) - { - NdisMoveMemory(&CurrBss, &pAd->ScanTab.BssEntry[BssIdx], sizeof(BSS_ENTRY)); - } - } - - // clean up previous SCAN result, add current BSS back to table if any - BssTableInit(&pAd->ScanTab); - if (BssIdx != BSS_NOT_FOUND) - { - // DDK Note: If the NIC is associated with a particular BSSID and SSID - // that are not contained in the list of BSSIDs generated by this scan, the - // BSSID description of the currently associated BSSID and SSID should be - // appended to the list of BSSIDs in the NIC's database. - // To ensure this, we append this BSS as the first entry in SCAN result - NdisMoveMemory(&pAd->ScanTab.BssEntry[0], &CurrBss, sizeof(BSS_ENTRY)); - pAd->ScanTab.BssNr = 1; - } - - ScanParmFill(pAd, &ScanReq, (PSTRING) Elem->Msg, Elem->MsgLen, BSS_ANY, SCAN_ACTIVE); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, - sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; -} - -/* - ========================================================================== - Description: - Before calling this routine, user desired SSID should already been - recorded in CommonCfg.Ssid[] - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID CntlOidSsidProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM * Elem) -{ - PNDIS_802_11_SSID pOidSsid = (NDIS_802_11_SSID *)Elem->Msg; - MLME_DISASSOC_REQ_STRUCT DisassocReq; - ULONG Now; - - - // Step 1. record the desired user settings to MlmeAux - NdisZeroMemory(pAd->MlmeAux.Ssid, MAX_LEN_OF_SSID); - NdisMoveMemory(pAd->MlmeAux.Ssid, pOidSsid->Ssid, pOidSsid->SsidLength); - pAd->MlmeAux.SsidLen = (UCHAR)pOidSsid->SsidLength; - NdisZeroMemory(pAd->MlmeAux.Bssid, MAC_ADDR_LEN); - pAd->MlmeAux.BssType = pAd->StaCfg.BssType; - - pAd->StaCfg.bAutoConnectByBssid = FALSE; - - // - // Update Reconnect Ssid, that user desired to connect. - // - NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, MAX_LEN_OF_SSID); - NdisMoveMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); - pAd->MlmeAux.AutoReconnectSsidLen = pAd->MlmeAux.SsidLen; - - // step 2. find all matching BSS in the lastest SCAN result (inBssTab) - // & log them into MlmeAux.SsidBssTab for later-on iteration. Sort by RSSI order - BssTableSsidSort(pAd, &pAd->MlmeAux.SsidBssTab, (PCHAR)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); - - DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - %d BSS of %d BSS match the desire (%d)SSID - %s\n", - pAd->MlmeAux.SsidBssTab.BssNr, pAd->ScanTab.BssNr, pAd->MlmeAux.SsidLen, pAd->MlmeAux.Ssid)); - NdisGetSystemUpTime(&Now); - - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) && - (pAd->CommonCfg.SsidLen == pAd->MlmeAux.SsidBssTab.BssEntry[0].SsidLen) && - NdisEqualMemory(pAd->CommonCfg.Ssid, pAd->MlmeAux.SsidBssTab.BssEntry[0].Ssid, pAd->CommonCfg.SsidLen) && - MAC_ADDR_EQUAL(pAd->CommonCfg.Bssid, pAd->MlmeAux.SsidBssTab.BssEntry[0].Bssid)) - { - // Case 1. already connected with an AP who has the desired SSID - // with highest RSSI - - // Add checking Mode "LEAP" for CCX 1.0 - if (((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) - ) && - (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED)) - { - // case 1.1 For WPA, WPA-PSK, if the 1x port is not secured, we have to redo - // connection process - DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - disassociate with current AP...\n")); - DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_DISASSOC_STA_LEAVING); - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, - sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; - } - else if (pAd->bConfigChanged == TRUE) - { - // case 1.2 Important Config has changed, we have to reconnect to the same AP - DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - disassociate with current AP Because config changed...\n")); - DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_DISASSOC_STA_LEAVING); - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, - sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; - } - else - { - // case 1.3. already connected to the SSID with highest RSSI. - DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - already with this BSSID. ignore this SET_SSID request\n")); - // - // (HCT 12.1) 1c_wlan_mediaevents required - // media connect events are indicated when associating with the same AP - // - if (INFRA_ON(pAd)) - { - // - // Since MediaState already is NdisMediaStateConnected - // We just indicate the connect event again to meet the WHQL required. - // - pAd->IndicateMediaState = NdisMediaStateConnected; - RTMP_IndicateMediaState(pAd); - pAd->ExtraInfo = GENERAL_LINK_UP; // Update extra information to link is up - } - - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT - RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, &pAd->MlmeAux.Bssid[0], NULL, 0); -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - } - } - else if (INFRA_ON(pAd)) - { - // - // For RT61 - // [88888] OID_802_11_SSID should have returned NDTEST_WEP_AP2(Returned: ) - // RT61 may lost SSID, and not connect to NDTEST_WEP_AP2 and will connect to NDTEST_WEP_AP2 by Autoreconnect - // But media status is connected, so the SSID not report correctly. - // - if (!SSID_EQUAL(pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen)) - { - // - // Different SSID means not Roaming case, so we let LinkDown() to Indicate a disconnect event. - // - pAd->MlmeAux.CurrReqIsFromNdis = TRUE; - } - // case 2. active INFRA association existent - // roaming is done within miniport driver, nothing to do with configuration - // utility. so upon a new SET(OID_802_11_SSID) is received, we just - // disassociate with the current associated AP, - // then perform a new association with this new SSID, no matter the - // new/old SSID are the same or not. - DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - disassociate with current AP...\n")); - DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_DISASSOC_STA_LEAVING); - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, - sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; - } - else - { - if (ADHOC_ON(pAd)) - { - DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - drop current ADHOC\n")); - LinkDown(pAd, FALSE); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); - pAd->IndicateMediaState = NdisMediaStateDisconnected; - RTMP_IndicateMediaState(pAd); - pAd->ExtraInfo = GENERAL_LINK_DOWN; - DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():NDIS_STATUS_MEDIA_DISCONNECT Event C!\n")); - } - - if ((pAd->MlmeAux.SsidBssTab.BssNr == 0) && - (pAd->StaCfg.bAutoReconnect == TRUE) && - (pAd->MlmeAux.BssType == BSS_INFRA) && - (MlmeValidateSSID(pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen) == TRUE) - ) - { - MLME_SCAN_REQ_STRUCT ScanReq; - - DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - No matching BSS, start a new scan\n")); - ScanParmFill(pAd, &ScanReq, (PSTRING) pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, BSS_ANY, SCAN_ACTIVE); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; - // Reset Missed scan number - pAd->StaCfg.LastScanTime = Now; - } - else - { - - pAd->MlmeAux.BssIdx = 0; - IterateOnBssTab(pAd); - } - } -} - - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID CntlOidRTBssidProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM * Elem) -{ - ULONG BssIdx; - PUCHAR pOidBssid = (PUCHAR)Elem->Msg; - MLME_DISASSOC_REQ_STRUCT DisassocReq; - MLME_JOIN_REQ_STRUCT JoinReq; - -#ifdef RALINK_ATE -/* No need to perform this routine when ATE is running. */ - if (ATE_ON(pAd)) - return; -#endif // RALINK_ATE // - - // record user desired settings - COPY_MAC_ADDR(pAd->MlmeAux.Bssid, pOidBssid); - pAd->MlmeAux.BssType = pAd->StaCfg.BssType; - - // find the desired BSS in the latest SCAN result table - BssIdx = BssTableSearch(&pAd->ScanTab, pOidBssid, pAd->MlmeAux.Channel); - if (BssIdx == BSS_NOT_FOUND) - { - MLME_SCAN_REQ_STRUCT ScanReq; - - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - BSSID not found. reply NDIS_STATUS_NOT_ACCEPTED\n")); - //pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - BSSID not found. start a new scan\n")); - ScanParmFill(pAd, &ScanReq, (PSTRING) pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, BSS_ANY, SCAN_ACTIVE); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; - // Reset Missed scan number - NdisGetSystemUpTime(&pAd->StaCfg.LastScanTime); - return; - } - - // - // Update Reconnect Ssid, that user desired to connect. - // - NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, MAX_LEN_OF_SSID); - pAd->MlmeAux.AutoReconnectSsidLen = pAd->ScanTab.BssEntry[BssIdx].SsidLen; - NdisMoveMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->ScanTab.BssEntry[BssIdx].Ssid, pAd->ScanTab.BssEntry[BssIdx].SsidLen); - - // copy the matched BSS entry from ScanTab to MlmeAux.SsidBssTab. Why? - // Because we need this entry to become the JOIN target in later on SYNC state machine - pAd->MlmeAux.BssIdx = 0; - pAd->MlmeAux.SsidBssTab.BssNr = 1; - NdisMoveMemory(&pAd->MlmeAux.SsidBssTab.BssEntry[0], &pAd->ScanTab.BssEntry[BssIdx], sizeof(BSS_ENTRY)); - - // Add SSID into MlmeAux for site surey joining hidden SSID - pAd->MlmeAux.SsidLen = pAd->ScanTab.BssEntry[BssIdx].SsidLen; - NdisMoveMemory(pAd->MlmeAux.Ssid, pAd->ScanTab.BssEntry[BssIdx].Ssid, pAd->MlmeAux.SsidLen); - - { - if (INFRA_ON(pAd)) - { - // disassoc from current AP first - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - disassociate with current AP ...\n")); - DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_DISASSOC_STA_LEAVING); - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, - sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); - - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; - } - else - { - if (ADHOC_ON(pAd)) - { - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - drop current ADHOC\n")); - LinkDown(pAd, FALSE); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); - pAd->IndicateMediaState = NdisMediaStateDisconnected; - RTMP_IndicateMediaState(pAd); - pAd->ExtraInfo = GENERAL_LINK_DOWN; - DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_DISCONNECT Event C!\n")); - } - - // Change the wepstatus to original wepstatus - pAd->StaCfg.WepStatus = pAd->StaCfg.OrigWepStatus; - pAd->StaCfg.PairCipher = pAd->StaCfg.OrigWepStatus; - pAd->StaCfg.GroupCipher = pAd->StaCfg.OrigWepStatus; - - // Check cipher suite, AP must have more secured cipher than station setting - // Set the Pairwise and Group cipher to match the intended AP setting - // We can only connect to AP with less secured cipher setting - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) - { - pAd->StaCfg.GroupCipher = pAd->ScanTab.BssEntry[BssIdx].WPA.GroupCipher; - - if (pAd->StaCfg.WepStatus == pAd->ScanTab.BssEntry[BssIdx].WPA.PairCipher) - pAd->StaCfg.PairCipher = pAd->ScanTab.BssEntry[BssIdx].WPA.PairCipher; - else if (pAd->ScanTab.BssEntry[BssIdx].WPA.PairCipherAux != Ndis802_11WEPDisabled) - pAd->StaCfg.PairCipher = pAd->ScanTab.BssEntry[BssIdx].WPA.PairCipherAux; - else // There is no PairCipher Aux, downgrade our capability to TKIP - pAd->StaCfg.PairCipher = Ndis802_11Encryption2Enabled; - } - else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - pAd->StaCfg.GroupCipher = pAd->ScanTab.BssEntry[BssIdx].WPA2.GroupCipher; - - if (pAd->StaCfg.WepStatus == pAd->ScanTab.BssEntry[BssIdx].WPA2.PairCipher) - pAd->StaCfg.PairCipher = pAd->ScanTab.BssEntry[BssIdx].WPA2.PairCipher; - else if (pAd->ScanTab.BssEntry[BssIdx].WPA2.PairCipherAux != Ndis802_11WEPDisabled) - pAd->StaCfg.PairCipher = pAd->ScanTab.BssEntry[BssIdx].WPA2.PairCipherAux; - else // There is no PairCipher Aux, downgrade our capability to TKIP - pAd->StaCfg.PairCipher = Ndis802_11Encryption2Enabled; - - // RSN capability - pAd->StaCfg.RsnCapability = pAd->ScanTab.BssEntry[BssIdx].WPA2.RsnCapability; - } - - // Set Mix cipher flag - pAd->StaCfg.bMixCipher = (pAd->StaCfg.PairCipher == pAd->StaCfg.GroupCipher) ? FALSE : TRUE; - /*if (pAd->StaCfg.bMixCipher == TRUE) - { - // If mix cipher, re-build RSNIE - RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, 0); - }*/ - // No active association, join the BSS immediately - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - joining %02x:%02x:%02x:%02x:%02x:%02x ...\n", - pOidBssid[0],pOidBssid[1],pOidBssid[2],pOidBssid[3],pOidBssid[4],pOidBssid[5])); - - JoinParmFill(pAd, &JoinReq, pAd->MlmeAux.BssIdx); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_JOIN_REQ, sizeof(MLME_JOIN_REQ_STRUCT), &JoinReq); - - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_JOIN; - } - } -} - -// Roaming is the only external request triggering CNTL state machine -// despite of other "SET OID" operation. All "SET OID" related oerations -// happen in sequence, because no other SET OID will be sent to this device -// until the the previous SET operation is complete (successful o failed). -// So, how do we quarantee this ROAMING request won't corrupt other "SET OID"? -// or been corrupted by other "SET OID"? -// -// IRQL = DISPATCH_LEVEL -VOID CntlMlmeRoamingProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR BBPValue = 0; - - DBGPRINT(RT_DEBUG_TRACE,("CNTL - Roaming in MlmeAux.RoamTab...\n")); - - { - //Let BBP register at 20MHz to do (fast) roaming. - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue &= (~0x18); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - - NdisMoveMemory(&pAd->MlmeAux.SsidBssTab, &pAd->MlmeAux.RoamTab, sizeof(pAd->MlmeAux.RoamTab)); - pAd->MlmeAux.SsidBssTab.BssNr = pAd->MlmeAux.RoamTab.BssNr; - - BssTableSortByRssi(&pAd->MlmeAux.SsidBssTab); - pAd->MlmeAux.BssIdx = 0; - IterateOnBssTab(pAd); - } -} - -#ifdef QOS_DLS_SUPPORT -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID CntlOidDLSSetupProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - PRT_802_11_DLS pDLS = (PRT_802_11_DLS)Elem->Msg; - MLME_DLS_REQ_STRUCT MlmeDlsReq; - INT i; - USHORT reason = REASON_UNSPECIFY; - - DBGPRINT(RT_DEBUG_TRACE,("CNTL - (OID set %02x:%02x:%02x:%02x:%02x:%02x with Valid=%d, Status=%d, TimeOut=%d, CountDownTimer=%d)\n", - pDLS->MacAddr[0], pDLS->MacAddr[1], pDLS->MacAddr[2], pDLS->MacAddr[3], pDLS->MacAddr[4], pDLS->MacAddr[5], - pDLS->Valid, pDLS->Status, pDLS->TimeOut, pDLS->CountDownTimer)); - - if (!pAd->CommonCfg.bDLSCapable) - return; - - // DLS will not be supported when Adhoc mode - if (INFRA_ON(pAd)) - { - for (i = 0; i < MAX_NUM_OF_DLS_ENTRY; i++) - { - if (pDLS->Valid && pAd->StaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH) && - (pDLS->TimeOut == pAd->StaCfg.DLSEntry[i].TimeOut) && MAC_ADDR_EQUAL(pDLS->MacAddr, pAd->StaCfg.DLSEntry[i].MacAddr)) - { - // 1. Same setting, just drop it - DBGPRINT(RT_DEBUG_TRACE,("CNTL - setting unchanged\n")); - break; - } - else if (!pDLS->Valid && pAd->StaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH) && - MAC_ADDR_EQUAL(pDLS->MacAddr, pAd->StaCfg.DLSEntry[i].MacAddr)) - { - // 2. Disable DLS link case, just tear down DLS link - reason = REASON_QOS_UNWANTED_MECHANISM; - pAd->StaCfg.DLSEntry[i].Valid = FALSE; - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - DlsParmFill(pAd, &MlmeDlsReq, &pAd->StaCfg.DLSEntry[i], reason); - MlmeEnqueue(pAd, DLS_STATE_MACHINE, MT2_MLME_DLS_TEAR_DOWN, sizeof(MLME_DLS_REQ_STRUCT), &MlmeDlsReq); - DBGPRINT(RT_DEBUG_TRACE,("CNTL - start tear down procedure\n")); - break; - } - else if ((i < MAX_NUM_OF_DLS_ENTRY) && pDLS->Valid && !pAd->StaCfg.DLSEntry[i].Valid) - { - // 3. Enable case, start DLS setup procedure - NdisMoveMemory(&pAd->StaCfg.DLSEntry[i], pDLS, sizeof(RT_802_11_DLS_UI)); - - //Update countdown timer - pAd->StaCfg.DLSEntry[i].CountDownTimer = pAd->StaCfg.DLSEntry[i].TimeOut; - DlsParmFill(pAd, &MlmeDlsReq, &pAd->StaCfg.DLSEntry[i], reason); - MlmeEnqueue(pAd, DLS_STATE_MACHINE, MT2_MLME_DLS_REQ, sizeof(MLME_DLS_REQ_STRUCT), &MlmeDlsReq); - DBGPRINT(RT_DEBUG_TRACE,("CNTL - DLS setup case\n")); - break; - } - else if ((i < MAX_NUM_OF_DLS_ENTRY) && pDLS->Valid && pAd->StaCfg.DLSEntry[i].Valid && - (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH) && !MAC_ADDR_EQUAL(pDLS->MacAddr, pAd->StaCfg.DLSEntry[i].MacAddr)) - { - // 4. update mac case, tear down old DLS and setup new DLS - reason = REASON_QOS_UNWANTED_MECHANISM; - pAd->StaCfg.DLSEntry[i].Valid = FALSE; - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - DlsParmFill(pAd, &MlmeDlsReq, &pAd->StaCfg.DLSEntry[i], reason); - MlmeEnqueue(pAd, DLS_STATE_MACHINE, MT2_MLME_DLS_TEAR_DOWN, sizeof(MLME_DLS_REQ_STRUCT), &MlmeDlsReq); - NdisMoveMemory(&pAd->StaCfg.DLSEntry[i], pDLS, sizeof(RT_802_11_DLS_UI)); - DlsParmFill(pAd, &MlmeDlsReq, &pAd->StaCfg.DLSEntry[i], reason); - MlmeEnqueue(pAd, DLS_STATE_MACHINE, MT2_MLME_DLS_REQ, sizeof(MLME_DLS_REQ_STRUCT), &MlmeDlsReq); - DBGPRINT(RT_DEBUG_TRACE,("CNTL - DLS tear down and restart case\n")); - break; - } - else if (pDLS->Valid && pAd->StaCfg.DLSEntry[i].Valid && - MAC_ADDR_EQUAL(pDLS->MacAddr, pAd->StaCfg.DLSEntry[i].MacAddr) && (pAd->StaCfg.DLSEntry[i].TimeOut != pDLS->TimeOut)) - { - // 5. update timeout case, start DLS setup procedure (no tear down) - pAd->StaCfg.DLSEntry[i].TimeOut = pDLS->TimeOut; - //Update countdown timer - pAd->StaCfg.DLSEntry[i].CountDownTimer = pAd->StaCfg.DLSEntry[i].TimeOut; - DlsParmFill(pAd, &MlmeDlsReq, &pAd->StaCfg.DLSEntry[i], reason); - MlmeEnqueue(pAd, DLS_STATE_MACHINE, MT2_MLME_DLS_REQ, sizeof(MLME_DLS_REQ_STRUCT), &MlmeDlsReq); - DBGPRINT(RT_DEBUG_TRACE,("CNTL - DLS update timeout case\n")); - break; - } - else if (pDLS->Valid && pAd->StaCfg.DLSEntry[i].Valid && - (pAd->StaCfg.DLSEntry[i].Status != DLS_FINISH) && MAC_ADDR_EQUAL(pDLS->MacAddr, pAd->StaCfg.DLSEntry[i].MacAddr)) - { - // 6. re-setup case, start DLS setup procedure (no tear down) - DlsParmFill(pAd, &MlmeDlsReq, &pAd->StaCfg.DLSEntry[i], reason); - MlmeEnqueue(pAd, DLS_STATE_MACHINE, MT2_MLME_DLS_REQ, sizeof(MLME_DLS_REQ_STRUCT), &MlmeDlsReq); - DBGPRINT(RT_DEBUG_TRACE,("CNTL - DLS retry setup procedure\n")); - break; - } - else - { - DBGPRINT(RT_DEBUG_WARN,("CNTL - DLS not changed in entry - %d - Valid=%d, Status=%d, TimeOut=%d\n", - i, pAd->StaCfg.DLSEntry[i].Valid, pAd->StaCfg.DLSEntry[i].Status, pAd->StaCfg.DLSEntry[i].TimeOut)); - } - } - } -} -#endif // QOS_DLS_SUPPORT // - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID CntlWaitDisassocProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - MLME_START_REQ_STRUCT StartReq; - - if (Elem->MsgType == MT2_DISASSOC_CONF) - { - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Dis-associate successful\n")); - - if (pAd->CommonCfg.bWirelessEvent) - { - RTMPSendWirelessEvent(pAd, IW_DISASSOC_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - } - - LinkDown(pAd, FALSE); - - // case 1. no matching BSS, and user wants ADHOC, so we just start a new one - if ((pAd->MlmeAux.SsidBssTab.BssNr==0) && (pAd->StaCfg.BssType == BSS_ADHOC)) - { - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - No matching BSS, start a new ADHOC (Ssid=%s)...\n",pAd->MlmeAux.Ssid)); - StartParmFill(pAd, &StartReq, (PCHAR)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, sizeof(MLME_START_REQ_STRUCT), &StartReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_START; - } - // case 2. try each matched BSS - else - { - pAd->MlmeAux.BssIdx = 0; - - IterateOnBssTab(pAd); - } - } -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID CntlWaitJoinProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Reason; - MLME_AUTH_REQ_STRUCT AuthReq; - - if (Elem->MsgType == MT2_JOIN_CONF) - { - NdisMoveMemory(&Reason, Elem->Msg, sizeof(USHORT)); - if (Reason == MLME_SUCCESS) - { - // 1. joined an IBSS, we are pretty much done here - if (pAd->MlmeAux.BssType == BSS_ADHOC) - { - // - // 5G bands rules of Japan: - // Ad hoc must be disabled in W53(ch52,56,60,64) channels. - // - if ( (pAd->CommonCfg.bIEEE80211H == 1) && - RadarChannelCheck(pAd, pAd->CommonCfg.Channel) - ) - { - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Channel=%d, Join adhoc on W53(52,56,60,64) Channels are not accepted\n", pAd->CommonCfg.Channel)); - return; - } - - LinkUp(pAd, BSS_ADHOC); - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - join the IBSS = %02x:%02x:%02x:%02x:%02x:%02x ...\n", - pAd->CommonCfg.Bssid[0],pAd->CommonCfg.Bssid[1],pAd->CommonCfg.Bssid[2], - pAd->CommonCfg.Bssid[3],pAd->CommonCfg.Bssid[4],pAd->CommonCfg.Bssid[5])); - - pAd->IndicateMediaState = NdisMediaStateConnected; - pAd->ExtraInfo = GENERAL_LINK_UP; - } - // 2. joined a new INFRA network, start from authentication - else - { - { - // either Ndis802_11AuthModeShared or Ndis802_11AuthModeAutoSwitch, try shared key first - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeShared) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeAutoSwitch)) - { - AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, AUTH_MODE_KEY); - } - else - { - AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, AUTH_MODE_OPEN); - } - MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_MLME_AUTH_REQ, - sizeof(MLME_AUTH_REQ_STRUCT), &AuthReq); - } - - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_AUTH; - } - } - else - { - // 3. failed, try next BSS - pAd->MlmeAux.BssIdx++; - IterateOnBssTab(pAd); - } - } -} - - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID CntlWaitStartProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Result; - - if (Elem->MsgType == MT2_START_CONF) - { - NdisMoveMemory(&Result, Elem->Msg, sizeof(USHORT)); - if (Result == MLME_SUCCESS) - { - // - // 5G bands rules of Japan: - // Ad hoc must be disabled in W53(ch52,56,60,64) channels. - // - if ( (pAd->CommonCfg.bIEEE80211H == 1) && - RadarChannelCheck(pAd, pAd->CommonCfg.Channel) - ) - { - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Channel=%d, Start adhoc on W53(52,56,60,64) Channels are not accepted\n", pAd->CommonCfg.Channel)); - return; - } -#ifdef DOT11_N_SUPPORT - NdisZeroMemory(&pAd->StaActive.SupportedPhyInfo.MCSSet[0], 16); - if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) - { - N_ChannelCheck(pAd); - SetCommonHT(pAd); - NdisMoveMemory(&pAd->MlmeAux.AddHtInfo, &pAd->CommonCfg.AddHTInfo, sizeof(ADD_HT_INFO_IE)); - RTMPCheckHt(pAd, BSSID_WCID, &pAd->CommonCfg.HtCapability, &pAd->CommonCfg.AddHTInfo); - pAd->StaActive.SupportedPhyInfo.bHtEnable = TRUE; - NdisMoveMemory(&pAd->StaActive.SupportedPhyInfo.MCSSet[0], &pAd->CommonCfg.HtCapability.MCSSet[0], 16); - COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(pAd); - - if ((pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth == BW_40) && - (pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset == EXTCHA_ABOVE)) - { - pAd->MlmeAux.CentralChannel = pAd->CommonCfg.Channel + 2; - } - else if ((pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth == BW_40) && - (pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset == EXTCHA_BELOW)) - { - pAd->MlmeAux.CentralChannel = pAd->CommonCfg.Channel - 2; - } - } - else -#endif // DOT11_N_SUPPORT // - { - pAd->StaActive.SupportedPhyInfo.bHtEnable = FALSE; - } - LinkUp(pAd, BSS_ADHOC); - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - // Before send beacon, driver need do radar detection - if ((pAd->CommonCfg.Channel > 14 ) - && (pAd->CommonCfg.bIEEE80211H == 1) - && RadarChannelCheck(pAd, pAd->CommonCfg.Channel)) - { - pAd->CommonCfg.RadarDetect.RDMode = RD_SILENCE_MODE; - pAd->CommonCfg.RadarDetect.RDCount = 0; -#ifdef DFS_SUPPORT - BbpRadarDetectionStart(pAd); -#endif // DFS_SUPPORT // - } - - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - start a new IBSS = %02x:%02x:%02x:%02x:%02x:%02x ...\n", - pAd->CommonCfg.Bssid[0],pAd->CommonCfg.Bssid[1],pAd->CommonCfg.Bssid[2], - pAd->CommonCfg.Bssid[3],pAd->CommonCfg.Bssid[4],pAd->CommonCfg.Bssid[5])); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Start IBSS fail. BUG!!!!!\n")); - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - } - } -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID CntlWaitAuthProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Reason; - MLME_ASSOC_REQ_STRUCT AssocReq; - MLME_AUTH_REQ_STRUCT AuthReq; - - if (Elem->MsgType == MT2_AUTH_CONF) - { - NdisMoveMemory(&Reason, Elem->Msg, sizeof(USHORT)); - if (Reason == MLME_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH OK\n")); - AssocParmFill(pAd, &AssocReq, pAd->MlmeAux.Bssid, pAd->MlmeAux.CapabilityInfo, - ASSOC_TIMEOUT, pAd->StaCfg.DefaultListenCount); - - { - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_ASSOC_REQ, - sizeof(MLME_ASSOC_REQ_STRUCT), &AssocReq); - - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_ASSOC; - } - } - else - { - // This fail may because of the AP already keep us in its MAC table without - // ageing-out. The previous authentication attempt must have let it remove us. - // so try Authentication again may help. For D-Link DWL-900AP+ compatibility. - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH FAIL, try again...\n")); - { - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeShared) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeAutoSwitch)) - { - // either Ndis802_11AuthModeShared or Ndis802_11AuthModeAutoSwitch, try shared key first - AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, AUTH_MODE_KEY); - } - else - { - AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, AUTH_MODE_OPEN); - } - MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_MLME_AUTH_REQ, - sizeof(MLME_AUTH_REQ_STRUCT), &AuthReq); - - } - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_AUTH2; - } - } -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID CntlWaitAuthProc2( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Reason; - MLME_ASSOC_REQ_STRUCT AssocReq; - MLME_AUTH_REQ_STRUCT AuthReq; - - if (Elem->MsgType == MT2_AUTH_CONF) - { - NdisMoveMemory(&Reason, Elem->Msg, sizeof(USHORT)); - if (Reason == MLME_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH OK\n")); - AssocParmFill(pAd, &AssocReq, pAd->MlmeAux.Bssid, pAd->MlmeAux.CapabilityInfo, - ASSOC_TIMEOUT, pAd->StaCfg.DefaultListenCount); - { - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_ASSOC_REQ, - sizeof(MLME_ASSOC_REQ_STRUCT), &AssocReq); - - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_ASSOC; - } - } - else - { - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeAutoSwitch) && - (pAd->MlmeAux.Alg == Ndis802_11AuthModeShared)) - { - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH FAIL, try OPEN system...\n")); - AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, Ndis802_11AuthModeOpen); - MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_MLME_AUTH_REQ, - sizeof(MLME_AUTH_REQ_STRUCT), &AuthReq); - - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_AUTH2; - } - else - { - // not success, try next BSS - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH FAIL, give up; try next BSS\n")); - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; //??????? - pAd->MlmeAux.BssIdx++; - IterateOnBssTab(pAd); - } - } - } -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID CntlWaitAssocProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Reason; - - if (Elem->MsgType == MT2_ASSOC_CONF) - { - NdisMoveMemory(&Reason, Elem->Msg, sizeof(USHORT)); - if (Reason == MLME_SUCCESS) - { - if (pAd->CommonCfg.bWirelessEvent) - { - RTMPSendWirelessEvent(pAd, IW_ASSOC_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - } - - LinkUp(pAd, BSS_INFRA); - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Association successful on BSS #%ld\n",pAd->MlmeAux.BssIdx)); - } - else - { - // not success, try next BSS - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Association fails on BSS #%ld\n",pAd->MlmeAux.BssIdx)); - pAd->MlmeAux.BssIdx++; - IterateOnBssTab(pAd); - } - } -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID CntlWaitReassocProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Result; - - if (Elem->MsgType == MT2_REASSOC_CONF) - { - NdisMoveMemory(&Result, Elem->Msg, sizeof(USHORT)); - if (Result == MLME_SUCCESS) - { - // send wireless event - for association - if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_ASSOC_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - - // - // NDIS requires a new Link UP indication but no Link Down for RE-ASSOC - // - LinkUp(pAd, BSS_INFRA); - - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Re-assocition successful on BSS #%ld\n", pAd->MlmeAux.RoamIdx)); - } - else - { - // reassoc failed, try to pick next BSS in the BSS Table - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Re-assocition fails on BSS #%ld\n", pAd->MlmeAux.RoamIdx)); - { - pAd->MlmeAux.RoamIdx++; - IterateOnBssTab2(pAd); - } - } - } -} - - -VOID AdhocTurnOnQos( - IN PRTMP_ADAPTER pAd) -{ -#define AC0_DEF_TXOP 0 -#define AC1_DEF_TXOP 0 -#define AC2_DEF_TXOP 94 -#define AC3_DEF_TXOP 47 - - // Turn on QOs if use HT rate. - if (pAd->CommonCfg.APEdcaParm.bValid == FALSE) - { - pAd->CommonCfg.APEdcaParm.bValid = TRUE; - pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3; - pAd->CommonCfg.APEdcaParm.Aifsn[1] = 7; - pAd->CommonCfg.APEdcaParm.Aifsn[2] = 1; - pAd->CommonCfg.APEdcaParm.Aifsn[3] = 1; - - pAd->CommonCfg.APEdcaParm.Cwmin[0] = 4; - pAd->CommonCfg.APEdcaParm.Cwmin[1] = 4; - pAd->CommonCfg.APEdcaParm.Cwmin[2] = 3; - pAd->CommonCfg.APEdcaParm.Cwmin[3] = 2; - - pAd->CommonCfg.APEdcaParm.Cwmax[0] = 10; - pAd->CommonCfg.APEdcaParm.Cwmax[1] = 6; - pAd->CommonCfg.APEdcaParm.Cwmax[2] = 4; - pAd->CommonCfg.APEdcaParm.Cwmax[3] = 3; - - pAd->CommonCfg.APEdcaParm.Txop[0] = 0; - pAd->CommonCfg.APEdcaParm.Txop[1] = 0; - pAd->CommonCfg.APEdcaParm.Txop[2] = AC2_DEF_TXOP; - pAd->CommonCfg.APEdcaParm.Txop[3] = AC3_DEF_TXOP; - } - AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm); -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID LinkUp( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssType) -{ - ULONG Now; - UINT32 Data; - BOOLEAN Cancelled; - UCHAR Value = 0, idx = 0, HashIdx = 0; - MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry = NULL; - - // Init ChannelQuality to prevent DEAD_CQI at initial LinkUp - pAd->Mlme.ChannelQuality = 50; - - pEntry = MacTableLookup(pAd, pAd->CommonCfg.Bssid); - if (pEntry) - { - MacTableDeleteEntry(pAd, pEntry->Aid, pEntry->Addr); - pEntry = NULL; - } - - - pEntry = &pAd->MacTab.Content[BSSID_WCID]; - - // - // ASSOC - DisassocTimeoutAction - // CNTL - Dis-associate successful - // !!! LINK DOWN !!! - // [88888] OID_802_11_SSID should have returned NDTEST_WEP_AP2(Returned: ) - // - // To prevent DisassocTimeoutAction to call Link down after we link up, - // cancel the DisassocTimer no matter what it start or not. - // - RTMPCancelTimer(&pAd->MlmeAux.DisassocTimer, &Cancelled); - - COPY_SETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(pAd); - -#ifdef DOT11_N_SUPPORT - COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(pAd); -#endif // DOT11_N_SUPPORT // - -#ifdef RTMP_MAC_PCI - // Before power save before link up function, We will force use 1R. - // So after link up, check Rx antenna # again. - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); - if(pAd->Antenna.field.RxPath == 3) - { - Value |= (0x10); - } - else if(pAd->Antenna.field.RxPath == 2) - { - Value |= (0x8); - } - else if(pAd->Antenna.field.RxPath == 1) - { - Value |= (0x0); - } - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); - pAd->StaCfg.BBPR3 = Value; -#endif // RTMP_MAC_PCI // - - if (BssType == BSS_ADHOC) - { - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_ADHOC_ON); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_INFRA_ON); - -#ifdef CARRIER_DETECTION_SUPPORT // Roger sync Carrier - // No carrier detection when adhoc - // CarrierDetectionStop(pAd); - pAd->CommonCfg.CarrierDetect.CD_State = CD_NORMAL; -#endif // CARRIER_DETECTION_SUPPORT // - -#ifdef DOT11_N_SUPPORT - if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) - AdhocTurnOnQos(pAd); -#endif // DOT11_N_SUPPORT // - - DBGPRINT(RT_DEBUG_TRACE, ("!!!Adhoc LINK UP !!! \n" )); - } - else - { - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_INFRA_ON); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_ADHOC_ON); - - DBGPRINT(RT_DEBUG_TRACE, ("!!!Infra LINK UP !!! \n" )); - } - - // 3*3 - // reset Tx beamforming bit - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value); - Value &= (~0x01); - Value |= pAd->CommonCfg.RegTransmitSetting.field.TxBF; - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value); - -#ifdef DOT11_N_SUPPORT - // Change to AP channel - if ((pAd->CommonCfg.CentralChannel > pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - // Must using 40MHz. - pAd->CommonCfg.BBPCurrentBW = BW_40; - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value); - Value &= (~0x18); - Value |= 0x10; - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value); - - // RX : control channel at lower - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); - Value &= (~0x20); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); -#ifdef RTMP_MAC_PCI - pAd->StaCfg.BBPR3 = Value; -#endif // RTMP_MAC_PCI // - - RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data); - Data &= 0xfffffffe; - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Data); - - if (pAd->MACVersion == 0x28600100) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x1A); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x0A); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x16); - DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" )); - } - - DBGPRINT(RT_DEBUG_TRACE, ("!!!40MHz Lower LINK UP !!! Control Channel at Below. Central = %d \n", pAd->CommonCfg.CentralChannel )); - } - else if ((pAd->CommonCfg.CentralChannel < pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - // Must using 40MHz. - pAd->CommonCfg.BBPCurrentBW = BW_40; - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value); - Value &= (~0x18); - Value |= 0x10; - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value); - - RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data); - Data |= 0x1; - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Data); - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); - Value |= (0x20); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); -#ifdef RTMP_MAC_PCI - pAd->StaCfg.BBPR3 = Value; -#endif // RTMP_MAC_PCI // - - if (pAd->MACVersion == 0x28600100) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x1A); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x0A); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x16); - DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" )); - } - - DBGPRINT(RT_DEBUG_TRACE, ("!!! 40MHz Upper LINK UP !!! Control Channel at UpperCentral = %d \n", pAd->CommonCfg.CentralChannel )); - } - else -#endif // DOT11_N_SUPPORT // - { - pAd->CommonCfg.BBPCurrentBW = BW_20; - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value); - Value &= (~0x18); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value); - - RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data); - Data &= 0xfffffffe; - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Data); - - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); - Value &= (~0x20); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); -#ifdef RTMP_MAC_PCI - pAd->StaCfg.BBPR3 = Value; -#endif // RTMP_MAC_PCI // - - if (pAd->MACVersion == 0x28600100) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x16); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x08); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x11); - DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" )); - } - - DBGPRINT(RT_DEBUG_TRACE, ("!!! 20MHz LINK UP !!! \n" )); - } - - RTMPSetAGCInitValue(pAd, pAd->CommonCfg.BBPCurrentBW); - // - // Save BBP_R66 value, it will be used in RTUSBResumeMsduTransmission - // - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R66, &pAd->BbpTuning.R66CurrentValue); - - DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK UP !!! (BssType=%d, AID=%d, ssid=%s, Channel=%d, CentralChannel = %d)\n", - BssType, pAd->StaActive.Aid, pAd->CommonCfg.Ssid, pAd->CommonCfg.Channel, pAd->CommonCfg.CentralChannel)); - -#ifdef DOT11_N_SUPPORT - DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK UP !!! (Density =%d, )\n", pAd->MacTab.Content[BSSID_WCID].MpduDensity)); -#endif // DOT11_N_SUPPORT // - - AsicSetBssid(pAd, pAd->CommonCfg.Bssid); - - AsicSetSlotTime(pAd, TRUE); - AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm); - - - // Call this for RTS protectionfor legacy rate, we will always enable RTS threshold, but normally it will not hit - AsicUpdateProtect(pAd, 0, (OFDMSETPROTECT | CCKSETPROTECT), TRUE, FALSE); - -#ifdef DOT11_N_SUPPORT - if ((pAd->StaActive.SupportedPhyInfo.bHtEnable == TRUE)) - { - // Update HT protectionfor based on AP's operating mode. - if (pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent == 1) - { - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, FALSE, TRUE); - } - else - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, FALSE, FALSE); - } -#endif // DOT11_N_SUPPORT // - - NdisZeroMemory(&pAd->DrsCounters, sizeof(COUNTER_DRS)); - - NdisGetSystemUpTime(&Now); - pAd->StaCfg.LastBeaconRxTime = Now; // last RX timestamp - - if ((pAd->CommonCfg.TxPreamble != Rt802_11PreambleLong) && - CAP_IS_SHORT_PREAMBLE_ON(pAd->StaActive.CapabilityInfo)) - { - MlmeSetTxPreamble(pAd, Rt802_11PreambleShort); - } - - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); - - if (pAd->CommonCfg.RadarDetect.RDMode == RD_SILENCE_MODE) - { -#ifdef DFS_SUPPORT - RadarDetectionStop(pAd); -#endif // DFS_SUPPORT // - } - pAd->CommonCfg.RadarDetect.RDMode = RD_NORMAL_MODE; - - if (BssType == BSS_ADHOC) - { - MakeIbssBeacon(pAd); - if ((pAd->CommonCfg.Channel > 14) - && (pAd->CommonCfg.bIEEE80211H == 1) - && RadarChannelCheck(pAd, pAd->CommonCfg.Channel)) - { - ; //Do nothing - } - else - { - AsicEnableIbssSync(pAd); - } - - // In ad hoc mode, use MAC table from index 1. - // p.s ASIC use all 0xff as termination of WCID table search.To prevent it's 0xff-ff-ff-ff-ff-ff, Write 0 here. - RTMP_IO_WRITE32(pAd, MAC_WCID_BASE, 0x00); - RTMP_IO_WRITE32(pAd, 0x1808, 0x00); - - // If WEP is enabled, add key material and cipherAlg into Asic - // Fill in Shared Key Table(offset: 0x6c00) and Shared Key Mode(offset: 0x7000) - - if (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled) - { - PUCHAR Key; - UCHAR CipherAlg; - - for (idx=0; idx < SHARE_KEY_NUM; idx++) - { - CipherAlg = pAd->SharedKey[BSS0][idx].CipherAlg; - Key = pAd->SharedKey[BSS0][idx].Key; - - if (pAd->SharedKey[BSS0][idx].KeyLen > 0) - { - // Set key material and cipherAlg to Asic - AsicAddSharedKeyEntry(pAd, BSS0, idx, CipherAlg, Key, NULL, NULL); - - if (idx == pAd->StaCfg.DefaultKeyId) - { - // Update WCID attribute table and IVEIV table for this group key table - RTMPAddWcidAttributeEntry(pAd, BSS0, idx, CipherAlg, NULL); - } - } - - - } - } - // If WPANone is enabled, add key material and cipherAlg into Asic - // Fill in Shared Key Table(offset: 0x6c00) and Shared Key Mode(offset: 0x7000) - else if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) - { - pAd->StaCfg.DefaultKeyId = 0; // always be zero - - NdisZeroMemory(&pAd->SharedKey[BSS0][0], sizeof(CIPHER_KEY)); - pAd->SharedKey[BSS0][0].KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pAd->SharedKey[BSS0][0].Key, pAd->StaCfg.PMK, LEN_TKIP_EK); - - if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) - { - NdisMoveMemory(pAd->SharedKey[BSS0][0].RxMic, &pAd->StaCfg.PMK[16], LEN_TKIP_RXMICK); - NdisMoveMemory(pAd->SharedKey[BSS0][0].TxMic, &pAd->StaCfg.PMK[16], LEN_TKIP_TXMICK); - } - - // Decide its ChiperAlg - if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) - pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_TKIP; - else if (pAd->StaCfg.PairCipher == Ndis802_11Encryption3Enabled) - pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_AES; - else - { - DBGPRINT(RT_DEBUG_TRACE, ("Unknow Cipher (=%d), set Cipher to AES\n", pAd->StaCfg.PairCipher)); - pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_AES; - } - - // Set key material and cipherAlg to Asic - AsicAddSharedKeyEntry(pAd, - BSS0, - 0, - pAd->SharedKey[BSS0][0].CipherAlg, - pAd->SharedKey[BSS0][0].Key, - pAd->SharedKey[BSS0][0].TxMic, - pAd->SharedKey[BSS0][0].RxMic); - - // Update WCID attribute table and IVEIV table for this group key table - RTMPAddWcidAttributeEntry(pAd, BSS0, 0, pAd->SharedKey[BSS0][0].CipherAlg, NULL); - - } - - } - else // BSS_INFRA - { - // Check the new SSID with last SSID - while (Cancelled == TRUE) - { - if (pAd->CommonCfg.LastSsidLen == pAd->CommonCfg.SsidLen) - { - if (RTMPCompareMemory(pAd->CommonCfg.LastSsid, pAd->CommonCfg.Ssid, pAd->CommonCfg.LastSsidLen) == 0) - { - // Link to the old one no linkdown is required. - break; - } - } - // Send link down event before set to link up - pAd->IndicateMediaState = NdisMediaStateDisconnected; - RTMP_IndicateMediaState(pAd); - pAd->ExtraInfo = GENERAL_LINK_DOWN; - DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_DISCONNECT Event AA!\n")); - break; - } - - // - // On WPA mode, Remove All Keys if not connect to the last BSSID - // Key will be set after 4-way handshake. - // - if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - { - ULONG IV; - - // Remove all WPA keys - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); - RTMPWPARemoveAllKeys(pAd); - pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - pAd->StaCfg.PrivacyFilter = Ndis802_11PrivFilter8021xWEP; - - // Fixed connection failed with Range Maximizer - 515 AP (Marvell Chip) when security is WPAPSK/TKIP - // If IV related values are too large in GroupMsg2, AP would ignore this message. - IV = 1; - IV |= (pAd->StaCfg.DefaultKeyId << 30); - AsicUpdateWCIDIVEIV(pAd, BSSID_WCID, IV, 0); - //RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); - } - - // NOTE: - // the decision of using "short slot time" or not may change dynamically due to - // new STA association to the AP. so we have to decide that upon parsing BEACON, not here - - // NOTE: - // the decision to use "RTC/CTS" or "CTS-to-self" protection or not may change dynamically - // due to new STA association to the AP. so we have to decide that upon parsing BEACON, not here - - ComposePsPoll(pAd); - ComposeNullFrame(pAd); - - AsicEnableBssSync(pAd); - - // Add BSSID to WCID search table - AsicUpdateRxWCIDTable(pAd, BSSID_WCID, pAd->CommonCfg.Bssid); - - // If WEP is enabled, add paiewise and shared key -#ifdef WPA_SUPPLICANT_SUPPORT - if (((pAd->StaCfg.WpaSupplicantUP)&& - (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled)&& - (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED)) || - ((pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_DISABLE)&& - (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled))) -#else - if (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled) -#endif // WPA_SUPPLICANT_SUPPORT // - { - PUCHAR Key; - UCHAR CipherAlg; - - for (idx=0; idx < SHARE_KEY_NUM; idx++) - { - CipherAlg = pAd->SharedKey[BSS0][idx].CipherAlg; - Key = pAd->SharedKey[BSS0][idx].Key; - - if (pAd->SharedKey[BSS0][idx].KeyLen > 0) - { - // Set key material and cipherAlg to Asic - AsicAddSharedKeyEntry(pAd, BSS0, idx, CipherAlg, Key, NULL, NULL); - - if (idx == pAd->StaCfg.DefaultKeyId) - { - // Assign group key info - RTMPAddWcidAttributeEntry(pAd, BSS0, idx, CipherAlg, NULL); - - pEntry->Aid = BSSID_WCID; - // Assign pairwise key info - RTMPAddWcidAttributeEntry(pAd, BSS0, idx, CipherAlg, pEntry); - } - } - } - } - - // only INFRASTRUCTURE mode need to indicate connectivity immediately; ADHOC mode - // should wait until at least 2 active nodes in this BSSID. - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); - - // For GUI ++ - if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA) - { - pAd->IndicateMediaState = NdisMediaStateConnected; - pAd->ExtraInfo = GENERAL_LINK_UP; - RTMP_IndicateMediaState(pAd); - } - else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) - { -#ifdef WPA_SUPPLICANT_SUPPORT - if (pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_DISABLE) -#endif // WPA_SUPPLICANT_SUPPORT // - RTMPSetTimer(&pAd->Mlme.LinkDownTimer, LINK_DOWN_TIMEOUT); - } - // -- - - // Add BSSID in my MAC Table. - NdisAcquireSpinLock(&pAd->MacTabLock); - // add this MAC entry into HASH table - if (pEntry) - { - HashIdx = MAC_ADDR_HASH_INDEX(pAd->CommonCfg.Bssid); - if (pAd->MacTab.Hash[HashIdx] == NULL) - { - pAd->MacTab.Hash[HashIdx] = pEntry; - } - else - { - pCurrEntry = pAd->MacTab.Hash[HashIdx]; - while (pCurrEntry->pNext != NULL) - { - pCurrEntry = pCurrEntry->pNext; - } - pCurrEntry->pNext = pEntry; - } - } - RTMPMoveMemory(pEntry->Addr, pAd->CommonCfg.Bssid, MAC_ADDR_LEN); - pEntry->Aid = BSSID_WCID; - pEntry->pAd = pAd; - pEntry->ValidAsCLI = TRUE; //Although this is bssid..still set ValidAsCl - pAd->MacTab.Size = 1; // infra mode always set MACtab size =1. - pEntry->Sst = SST_ASSOC; - pEntry->AuthState = SST_ASSOC; - pEntry->AuthMode = pAd->StaCfg.AuthMode; - pEntry->WepStatus = pAd->StaCfg.WepStatus; - if (pEntry->AuthMode < Ndis802_11AuthModeWPA) - { - pEntry->WpaState = AS_NOTUSE; - pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; - } - else - { - pEntry->WpaState = AS_PTKSTART; - pEntry->PrivacyFilter = Ndis802_11PrivFilter8021xWEP; - } - NdisReleaseSpinLock(&pAd->MacTabLock); - - DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK UP !!! ClientStatusFlags=%lx)\n", - pAd->MacTab.Content[BSSID_WCID].ClientStatusFlags)); - - - MlmeUpdateTxRates(pAd, TRUE, BSS0); -#ifdef DOT11_N_SUPPORT - MlmeUpdateHtTxRates(pAd, BSS0); - DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK UP !! (StaActive.bHtEnable =%d, )\n", pAd->StaActive.SupportedPhyInfo.bHtEnable)); -#endif // DOT11_N_SUPPORT // - - - if (pAd->CommonCfg.bAggregationCapable) - { - if ((pAd->CommonCfg.bPiggyBackCapable) && (pAd->MlmeAux.APRalinkIe & 0x00000003) == 3) - { - - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_PIGGYBACK_INUSED); - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_AGGREGATION_CAPABLE); - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_PIGGYBACK_CAPABLE); - RTMPSetPiggyBack(pAd, TRUE); - DBGPRINT(RT_DEBUG_TRACE, ("Turn on Piggy-Back\n")); - } - else if (pAd->MlmeAux.APRalinkIe & 0x00000001) - { - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_AGGREGATION_CAPABLE); - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); - } - } - - if (pAd->MlmeAux.APRalinkIe != 0x0) - { -#ifdef DOT11_N_SUPPORT - if (CLIENT_STATUS_TEST_FLAG(&pAd->MacTab.Content[BSSID_WCID], fCLIENT_STATUS_RDG_CAPABLE)) - { - AsicEnableRDG(pAd); - } -#endif // DOT11_N_SUPPORT // - OPSTATUS_SET_FLAG(pAd, fCLIENT_STATUS_RALINK_CHIPSET); - CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[BSSID_WCID], fCLIENT_STATUS_RALINK_CHIPSET); - } - else - { - OPSTATUS_CLEAR_FLAG(pAd, fCLIENT_STATUS_RALINK_CHIPSET); - CLIENT_STATUS_CLEAR_FLAG(&pAd->MacTab.Content[BSSID_WCID], fCLIENT_STATUS_RALINK_CHIPSET); - } - } - - -#ifdef DOT11_N_SUPPORT - DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_CONNECT Event B!.BACapability = %x. ClientStatusFlags = %lx\n", pAd->CommonCfg.BACapability.word, pAd->MacTab.Content[BSSID_WCID].ClientStatusFlags)); -#endif // DOT11_N_SUPPORT // - - // Set LED - RTMPSetLED(pAd, LED_LINK_UP); - - pAd->Mlme.PeriodicRound = 0; - pAd->Mlme.OneSecPeriodicRound = 0; - pAd->bConfigChanged = FALSE; // Reset config flag - pAd->ExtraInfo = GENERAL_LINK_UP; // Update extra information to link is up - - // Set asic auto fall back - { - PUCHAR pTable; - UCHAR TableSize = 0; - - MlmeSelectTxRateTable(pAd, &pAd->MacTab.Content[BSSID_WCID], &pTable, &TableSize, &pAd->CommonCfg.TxRateIndex); - AsicUpdateAutoFallBackTable(pAd, pTable); - } - - NdisAcquireSpinLock(&pAd->MacTabLock); - pEntry->HTPhyMode.word = pAd->StaCfg.HTPhyMode.word; - pEntry->MaxHTPhyMode.word = pAd->StaCfg.HTPhyMode.word; - if (pAd->StaCfg.bAutoTxRateSwitch == FALSE) - { - pEntry->bAutoTxRateSwitch = FALSE; -#ifdef DOT11_N_SUPPORT - if (pEntry->HTPhyMode.field.MCS == 32) - pEntry->HTPhyMode.field.ShortGI = GI_800; - - if ((pEntry->HTPhyMode.field.MCS > MCS_7) || (pEntry->HTPhyMode.field.MCS == 32)) - pEntry->HTPhyMode.field.STBC = STBC_NONE; -#endif // DOT11_N_SUPPORT // - // If the legacy mode is set, overwrite the transmit setting of this entry. - if (pEntry->HTPhyMode.field.MODE <= MODE_OFDM) - RTMPUpdateLegacyTxSetting((UCHAR)pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode, pEntry); - } - else - pEntry->bAutoTxRateSwitch = TRUE; - NdisReleaseSpinLock(&pAd->MacTabLock); - - // Let Link Status Page display first initial rate. - pAd->LastTxRate = (USHORT)(pEntry->HTPhyMode.word); - // Select DAC according to HT or Legacy - if (pAd->StaActive.SupportedPhyInfo.MCSSet[0] != 0x00) - { - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &Value); - Value &= (~0x18); - if (pAd->Antenna.field.TxPath == 2) - { - Value |= 0x10; - } - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R1, Value); - } - else - { - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &Value); - Value &= (~0x18); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R1, Value); - } - -#ifdef DOT11_N_SUPPORT - if (pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) - { - } - else if (pEntry->MaxRAmpduFactor == 0) - { - // If HT AP doesn't support MaxRAmpduFactor = 1, we need to set max PSDU to 0. - // Because our Init value is 1 at MACRegTable. - RTMP_IO_WRITE32(pAd, MAX_LEN_CFG, 0x0fff); - } -#endif // DOT11_N_SUPPORT // - - // Patch for Marvel AP to gain high throughput - // Need to set as following, - // 1. Set txop in register-EDCA_AC0_CFG as 0x60 - // 2. Set EnTXWriteBackDDONE in register-WPDMA_GLO_CFG as zero - // 3. PBF_MAX_PCNT as 0x1F3FBF9F - // 4. kick per two packets when dequeue - // - // Txop can only be modified when RDG is off, WMM is disable and TxBurst is enable - // - // if 1. Legacy AP WMM on, or 2. 11n AP, AMPDU disable. Force turn off burst no matter what bEnableTxBurst is. -#ifdef DOT11_N_SUPPORT - if (!((pAd->CommonCfg.RxStream == 1)&&(pAd->CommonCfg.TxStream == 1)) && - (pAd->StaCfg.bForceTxBurst == FALSE) && - (((pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED)) - || ((pAd->StaActive.SupportedPhyInfo.bHtEnable == TRUE) && (pAd->CommonCfg.BACapability.field.Policy == BA_NOTUSE)))) - { - RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &Data); - Data &= 0xFFFFFF00; - RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Data); - - RTMP_IO_WRITE32(pAd, PBF_MAX_PCNT, 0x1F3F7F9F); - DBGPRINT(RT_DEBUG_TRACE, ("Txburst 1\n")); - } - else -#endif // DOT11_N_SUPPORT // - if (pAd->CommonCfg.bEnableTxBurst) - { - RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &Data); - Data &= 0xFFFFFF00; - Data |= 0x60; - RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Data); - pAd->CommonCfg.IOTestParm.bNowAtherosBurstOn = TRUE; - - RTMP_IO_WRITE32(pAd, PBF_MAX_PCNT, 0x1F3FBF9F); - DBGPRINT(RT_DEBUG_TRACE, ("Txburst 2\n")); - } - else - { - RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &Data); - Data &= 0xFFFFFF00; - RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Data); - - RTMP_IO_WRITE32(pAd, PBF_MAX_PCNT, 0x1F3F7F9F); - DBGPRINT(RT_DEBUG_TRACE, ("Txburst 3\n")); - } - -#ifdef DOT11_N_SUPPORT - // Re-check to turn on TX burst or not. - if ((pAd->CommonCfg.IOTestParm.bLastAtheros == TRUE) && ((STA_WEP_ON(pAd))||(STA_TKIP_ON(pAd)))) - { - pAd->CommonCfg.IOTestParm.bNextDisableRxBA = TRUE; - if (pAd->CommonCfg.bEnableTxBurst) - { - UINT32 MACValue = 0; - // Force disable TXOP value in this case. The same action in MLMEUpdateProtect too. - // I didn't change PBF_MAX_PCNT setting. - RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &MACValue); - MACValue &= 0xFFFFFF00; - RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, MACValue); - pAd->CommonCfg.IOTestParm.bNowAtherosBurstOn = FALSE; - } - } - else - { - pAd->CommonCfg.IOTestParm.bNextDisableRxBA = FALSE; - } -#endif // DOT11_N_SUPPORT // - - pAd->CommonCfg.IOTestParm.bLastAtheros = FALSE; - COPY_MAC_ADDR(pAd->CommonCfg.LastBssid, pAd->CommonCfg.Bssid); - DBGPRINT(RT_DEBUG_TRACE, ("!!!pAd->bNextDisableRxBA= %d \n", pAd->CommonCfg.IOTestParm.bNextDisableRxBA)); - // BSSID add in one MAC entry too. Because in Tx, ASIC need to check Cipher and IV/EIV, BAbitmap - // Pther information in MACTab.Content[BSSID_WCID] is not necessary for driver. - // Note: As STA, The MACTab.Content[BSSID_WCID]. PairwiseKey and Shared Key for BSS0 are the same. - - if (pAd->StaCfg.WepStatus <= Ndis802_11WEPDisabled) - { -#ifdef WPA_SUPPLICANT_SUPPORT - if (pAd->StaCfg.WpaSupplicantUP && - (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled) && - (pAd->StaCfg.IEEE8021X == TRUE)) - ; - else -#endif // WPA_SUPPLICANT_SUPPORT // - { - pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - pAd->StaCfg.PrivacyFilter = Ndis802_11PrivFilterAcceptAll; - } - } - - NdisAcquireSpinLock(&pAd->MacTabLock); - pEntry->PortSecured = pAd->StaCfg.PortSecured; - NdisReleaseSpinLock(&pAd->MacTabLock); - - // - // Patch Atheros AP TX will breakdown issue. - // AP Model: DLink DWL-8200AP - // - if (INFRA_ON(pAd) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && STA_TKIP_ON(pAd)) - { - RTMP_IO_WRITE32(pAd, RX_PARSER_CFG, 0x01); - } - else - { - RTMP_IO_WRITE32(pAd, RX_PARSER_CFG, 0x00); - } - - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_GO_TO_SLEEP_NOW); - -#ifdef DOT11_N_SUPPORT -#ifdef DOT11N_DRAFT3 - if ((pAd->CommonCfg.BACapability.field.b2040CoexistScanSup) && (pAd->CommonCfg.Channel <= 11)) - { - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_SCAN_2040); - BuildEffectedChannelList(pAd); - } -#endif // DOT11N_DRAFT3 // -#endif // DOT11_N_SUPPORT // -} - -/* - ========================================================================== - - Routine Description: - Disconnect current BSSID - - Arguments: - pAd - Pointer to our adapter - IsReqFromAP - Request from AP - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - We need more information to know it's this requst from AP. - If yes! we need to do extra handling, for example, remove the WPA key. - Otherwise on 4-way handshaking will faied, since the WPA key didn't be - remove while auto reconnect. - Disconnect request from AP, it means we will start afresh 4-way handshaking - on WPA mode. - - ========================================================================== -*/ -VOID LinkDown( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN IsReqFromAP) -{ - UCHAR i, ByteValue = 0; - - BOOLEAN Cancelled; - - // Do nothing if monitor mode is on - if (MONITOR_ON(pAd)) - return; - -#ifdef RALINK_ATE - // Nothing to do in ATE mode. - if (ATE_ON(pAd)) - return; -#endif // RALINK_ATE // - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_GO_TO_SLEEP_NOW); - //Comment the codes, beasue the line 2291 call the same function. - //RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - // Not allow go to sleep within linkdown function. - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); - - if (pAd->CommonCfg.bWirelessEvent) - { - RTMPSendWirelessEvent(pAd, IW_STA_LINKDOWN_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - } - - DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK DOWN !!!\n")); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); - -#ifdef RTMP_MAC_PCI - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - BOOLEAN Cancelled; - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - } - - pAd->bPCIclkOff = FALSE; -#endif // RTMP_MAC_PCI // - - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) -|| RTMP_TEST_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND) - || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF)) - { - AUTO_WAKEUP_STRUC AutoWakeupCfg; - AsicForceWakeup(pAd, TRUE); - AutoWakeupCfg.word = 0; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); - } -#ifdef RTMP_MAC_PCI - pAd->bPCIclkOff = FALSE; -#endif // RTMP_MAC_PCI // - if (ADHOC_ON(pAd)) // Adhoc mode link down - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK DOWN 1!!!\n")); - - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_ADHOC_ON); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); - pAd->IndicateMediaState = NdisMediaStateDisconnected; - RTMP_IndicateMediaState(pAd); - pAd->ExtraInfo = GENERAL_LINK_DOWN; - BssTableDeleteEntry(&pAd->ScanTab, pAd->CommonCfg.Bssid, pAd->CommonCfg.Channel); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MacTab.Size=%d !!!\n", pAd->MacTab.Size)); - } - else // Infra structure mode - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK DOWN 2!!!\n")); - -#ifdef QOS_DLS_SUPPORT - // DLS tear down frame must be sent before link down - // send DLS-TEAR_DOWN message - if (pAd->CommonCfg.bDLSCapable) - { - // tear down local dls table entry - for (i=0; iStaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH)) - { - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - RTMPSendDLSTearDownFrame(pAd, pAd->StaCfg.DLSEntry[i].MacAddr); - } - } - - // tear down peer dls table entry - for (i=MAX_NUM_OF_INIT_DLS_ENTRY; iStaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH)) - { - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - RTMPSendDLSTearDownFrame(pAd, pAd->StaCfg.DLSEntry[i].MacAddr); - } - } - } -#endif // QOS_DLS_SUPPORT // - - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_INFRA_ON); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); - - // Saved last SSID for linkup comparison - pAd->CommonCfg.LastSsidLen = pAd->CommonCfg.SsidLen; - NdisMoveMemory(pAd->CommonCfg.LastSsid, pAd->CommonCfg.Ssid, pAd->CommonCfg.LastSsidLen); - COPY_MAC_ADDR(pAd->CommonCfg.LastBssid, pAd->CommonCfg.Bssid); - if (pAd->MlmeAux.CurrReqIsFromNdis == TRUE) - { - pAd->IndicateMediaState = NdisMediaStateDisconnected; - RTMP_IndicateMediaState(pAd); - pAd->ExtraInfo = GENERAL_LINK_DOWN; - DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_DISCONNECT Event A!\n")); - pAd->MlmeAux.CurrReqIsFromNdis = FALSE; - } - else - { - // - // If disassociation request is from NDIS, then we don't need to delete BSSID from entry. - // Otherwise lost beacon or receive De-Authentication from AP, - // then we should delete BSSID from BssTable. - // If we don't delete from entry, roaming will fail. - // - BssTableDeleteEntry(&pAd->ScanTab, pAd->CommonCfg.Bssid, pAd->CommonCfg.Channel); - } - - // restore back to - - // 1. long slot (20 us) or short slot (9 us) time - // 2. turn on/off RTS/CTS and/or CTS-to-self protection - // 3. short preamble - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_BG_PROTECTION_INUSED); - -#ifdef EXT_BUILD_CHANNEL_LIST - // Country IE of the AP will be evaluated and will be used. - if (pAd->StaCfg.IEEE80211dClientMode != Rt802_11_D_None) - { - NdisMoveMemory(&pAd->CommonCfg.CountryCode[0], &pAd->StaCfg.StaOriCountryCode[0], 2); - pAd->CommonCfg.Geography = pAd->StaCfg.StaOriGeography; - BuildChannelListEx(pAd); - } -#endif // EXT_BUILD_CHANNEL_LIST // - - } - - - for (i=1; iMacTab.Content[i].ValidAsCLI == TRUE) - MacTableDeleteEntry(pAd, pAd->MacTab.Content[i].Aid, pAd->MacTab.Content[i].Addr); - } - - AsicSetSlotTime(pAd, TRUE); //FALSE); - AsicSetEdcaParm(pAd, NULL); - - // Set LED - RTMPSetLED(pAd, LED_LINK_DOWN); - pAd->LedIndicatorStrength = 0xF0; - RTMPSetSignalLED(pAd, -100); // Force signal strength Led to be turned off, firmware is not done it. - - AsicDisableSync(pAd); - - pAd->Mlme.PeriodicRound = 0; - pAd->Mlme.OneSecPeriodicRound = 0; - - if (pAd->StaCfg.BssType == BSS_INFRA) - { - // Remove StaCfg Information after link down - NdisZeroMemory(pAd->CommonCfg.Bssid, MAC_ADDR_LEN); - NdisZeroMemory(pAd->CommonCfg.Ssid, MAX_LEN_OF_SSID); - pAd->CommonCfg.SsidLen = 0; - } -#ifdef DOT11_N_SUPPORT - NdisZeroMemory(&pAd->MlmeAux.HtCapability, sizeof(HT_CAPABILITY_IE)); - NdisZeroMemory(&pAd->MlmeAux.AddHtInfo, sizeof(ADD_HT_INFO_IE)); - pAd->MlmeAux.HtCapabilityLen = 0; - pAd->MlmeAux.NewExtChannelOffset = 0xff; -#endif // DOT11_N_SUPPORT // - - // Reset WPA-PSK state. Only reset when supplicant enabled - if (pAd->StaCfg.WpaState != SS_NOTUSE) - { - pAd->StaCfg.WpaState = SS_START; - // Clear Replay counter - NdisZeroMemory(pAd->StaCfg.ReplayCounter, 8); - -#ifdef QOS_DLS_SUPPORT - if (pAd->CommonCfg.bDLSCapable) - NdisZeroMemory(pAd->StaCfg.DlsReplayCounter, 8); -#endif // QOS_DLS_SUPPORT // - } - - // - // if link down come from AP, we need to remove all WPA keys on WPA mode. - // otherwise will cause 4-way handshaking failed, since the WPA key not empty. - // - if ((IsReqFromAP) && (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA)) - { - // Remove all WPA keys - RTMPWPARemoveAllKeys(pAd); - } - - // 802.1x port control -#ifdef WPA_SUPPLICANT_SUPPORT - // Prevent clear PortSecured here with static WEP - // NetworkManger set security policy first then set SSID to connect AP. - if (pAd->StaCfg.WpaSupplicantUP && - (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled) && - (pAd->StaCfg.IEEE8021X == FALSE)) - { - pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - } - else -#endif // WPA_SUPPLICANT_SUPPORT // - { - pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - pAd->StaCfg.PrivacyFilter = Ndis802_11PrivFilter8021xWEP; - } - - NdisAcquireSpinLock(&pAd->MacTabLock); - NdisZeroMemory(&pAd->MacTab, sizeof(MAC_TABLE)); - pAd->MacTab.Content[BSSID_WCID].PortSecured = pAd->StaCfg.PortSecured; - NdisReleaseSpinLock(&pAd->MacTabLock); - - pAd->StaCfg.MicErrCnt = 0; - - pAd->IndicateMediaState = NdisMediaStateDisconnected; - // Update extra information to link is up - pAd->ExtraInfo = GENERAL_LINK_DOWN; - - pAd->StaActive.SupportedPhyInfo.bHtEnable = FALSE; - - - // Clean association information - NdisZeroMemory(&pAd->StaCfg.AssocInfo, sizeof(NDIS_802_11_ASSOCIATION_INFORMATION)); - pAd->StaCfg.AssocInfo.Length = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); - pAd->StaCfg.ReqVarIELen = 0; - pAd->StaCfg.ResVarIELen = 0; - - // - // Reset RSSI value after link down - // - pAd->StaCfg.RssiSample.AvgRssi0 = 0; - pAd->StaCfg.RssiSample.AvgRssi0X8 = 0; - pAd->StaCfg.RssiSample.AvgRssi1 = 0; - pAd->StaCfg.RssiSample.AvgRssi1X8 = 0; - pAd->StaCfg.RssiSample.AvgRssi2 = 0; - pAd->StaCfg.RssiSample.AvgRssi2X8 = 0; - - // Restore MlmeRate - pAd->CommonCfg.MlmeRate = pAd->CommonCfg.BasicMlmeRate; - pAd->CommonCfg.RtsRate = pAd->CommonCfg.BasicMlmeRate; - -#ifdef DOT11_N_SUPPORT - // - // After Link down, reset piggy-back setting in ASIC. Disable RDG. - // - if (pAd->CommonCfg.BBPCurrentBW == BW_40) - { - pAd->CommonCfg.BBPCurrentBW = BW_20; - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &ByteValue); - ByteValue &= (~0x18); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, ByteValue); - } -#endif // DOT11_N_SUPPORT // - // Reset DAC - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &ByteValue); - ByteValue &= (~0x18); - if (pAd->Antenna.field.TxPath == 2) - { - ByteValue |= 0x10; - } - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R1, ByteValue); - - RTMPSetPiggyBack(pAd,FALSE); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_PIGGYBACK_INUSED); - -#ifdef DOT11_N_SUPPORT - pAd->CommonCfg.BACapability.word = pAd->CommonCfg.REGBACapability.word; -#endif // DOT11_N_SUPPORT // - - // Restore all settings in the following. - AsicUpdateProtect(pAd, 0, (ALLN_SETPROTECT|CCKSETPROTECT|OFDMSETPROTECT), TRUE, FALSE); - AsicDisableRDG(pAd); - pAd->CommonCfg.IOTestParm.bCurrentAtheros = FALSE; - pAd->CommonCfg.IOTestParm.bNowAtherosBurstOn = FALSE; - -#ifdef DOT11_N_SUPPORT -#ifdef DOT11N_DRAFT3 - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SCAN_2040); - pAd->CommonCfg.BSSCoexist2040.word = 0; - TriEventInit(pAd); - for (i = 0; i < (pAd->ChannelListNum - 1); i++) - { - pAd->ChannelList[i].bEffectedChannel = FALSE; - } -#endif // DOT11N_DRAFT3 // -#endif // DOT11_N_SUPPORT // - - RTMP_IO_WRITE32(pAd, MAX_LEN_CFG, 0x1fff); - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); -// Allow go to sleep after linkdown steps. - RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); -#ifdef WPA_SUPPLICANT_SUPPORT -#ifndef NATIVE_WPA_SUPPLICANT_SUPPORT - if (pAd->StaCfg.WpaSupplicantUP) { - //send disassociate event to wpa_supplicant - RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, RT_DISASSOC_EVENT_FLAG, NULL, NULL, 0); - } -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // -#endif // WPA_SUPPLICANT_SUPPORT // - -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT - RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0); -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - -#ifdef RT30xx - if ((IS_RT30xx(pAd) || IS_RT3090(pAd)||IS_RT3390(pAd)) - &&(pAd->Antenna.field.RxPath>1||pAd->Antenna.field.TxPath>1)) - { - RTMP_ASIC_MMPS_DISABLE(pAd); - } -#endif // RT30xx // - -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID IterateOnBssTab( - IN PRTMP_ADAPTER pAd) -{ - MLME_START_REQ_STRUCT StartReq; - MLME_JOIN_REQ_STRUCT JoinReq; - ULONG BssIdx; - - // Change the wepstatus to original wepstatus - pAd->StaCfg.WepStatus = pAd->StaCfg.OrigWepStatus; - pAd->StaCfg.PairCipher = pAd->StaCfg.OrigWepStatus; - pAd->StaCfg.GroupCipher = pAd->StaCfg.OrigWepStatus; - - BssIdx = pAd->MlmeAux.BssIdx; - if (BssIdx < pAd->MlmeAux.SsidBssTab.BssNr) - { - // Check cipher suite, AP must have more secured cipher than station setting - // Set the Pairwise and Group cipher to match the intended AP setting - // We can only connect to AP with less secured cipher setting - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) - { - pAd->StaCfg.GroupCipher = pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA.GroupCipher; - - if (pAd->StaCfg.WepStatus == pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA.PairCipher) - pAd->StaCfg.PairCipher = pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA.PairCipher; - else if (pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA.PairCipherAux != Ndis802_11WEPDisabled) - pAd->StaCfg.PairCipher = pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA.PairCipherAux; - else // There is no PairCipher Aux, downgrade our capability to TKIP - pAd->StaCfg.PairCipher = Ndis802_11Encryption2Enabled; - } - else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - pAd->StaCfg.GroupCipher = pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA2.GroupCipher; - - if (pAd->StaCfg.WepStatus == pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA2.PairCipher) - pAd->StaCfg.PairCipher = pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA2.PairCipher; - else if (pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA2.PairCipherAux != Ndis802_11WEPDisabled) - pAd->StaCfg.PairCipher = pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA2.PairCipherAux; - else // There is no PairCipher Aux, downgrade our capability to TKIP - pAd->StaCfg.PairCipher = Ndis802_11Encryption2Enabled; - - // RSN capability - pAd->StaCfg.RsnCapability = pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA2.RsnCapability; - } - - // Set Mix cipher flag - pAd->StaCfg.bMixCipher = (pAd->StaCfg.PairCipher == pAd->StaCfg.GroupCipher) ? FALSE : TRUE; - /*if (pAd->StaCfg.bMixCipher == TRUE) - { - // If mix cipher, re-build RSNIE - RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, 0); - }*/ - - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - iterate BSS %ld of %d\n", BssIdx, pAd->MlmeAux.SsidBssTab.BssNr)); - JoinParmFill(pAd, &JoinReq, BssIdx); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_JOIN_REQ, sizeof(MLME_JOIN_REQ_STRUCT), - &JoinReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_JOIN; - } - else if (pAd->StaCfg.BssType == BSS_ADHOC) - { - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - All BSS fail; start a new ADHOC (Ssid=%s)...\n",pAd->MlmeAux.Ssid)); - StartParmFill(pAd, &StartReq, (PCHAR)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, sizeof(MLME_START_REQ_STRUCT), &StartReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_START; - } - else // no more BSS - { - -#ifdef DOT11_N_SUPPORT -#endif // DOT11_N_SUPPORT // - { - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - All roaming failed, restore to channel %d, Total BSS[%02d]\n",pAd->CommonCfg.Channel, pAd->ScanTab.BssNr)); - } - - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - } -} - -// for re-association only -// IRQL = DISPATCH_LEVEL -VOID IterateOnBssTab2( - IN PRTMP_ADAPTER pAd) -{ - MLME_REASSOC_REQ_STRUCT ReassocReq; - ULONG BssIdx; - BSS_ENTRY *pBss; - - BssIdx = pAd->MlmeAux.RoamIdx; - pBss = &pAd->MlmeAux.RoamTab.BssEntry[BssIdx]; - - if (BssIdx < pAd->MlmeAux.RoamTab.BssNr) - { - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - iterate BSS %ld of %d\n", BssIdx, pAd->MlmeAux.RoamTab.BssNr)); - - AsicSwitchChannel(pAd, pBss->Channel, FALSE); - AsicLockChannel(pAd, pBss->Channel); - - // reassociate message has the same structure as associate message - AssocParmFill(pAd, &ReassocReq, pBss->Bssid, pBss->CapabilityInfo, - ASSOC_TIMEOUT, pAd->StaCfg.DefaultListenCount); - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_REASSOC_REQ, - sizeof(MLME_REASSOC_REQ_STRUCT), &ReassocReq); - - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_REASSOC; - } - else // no more BSS - { - -#ifdef DOT11_N_SUPPORT -#endif // DOT11_N_SUPPORT // - { - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - All roaming failed, restore to channel %d, Total BSS[%02d]\n",pAd->CommonCfg.Channel, pAd->ScanTab.BssNr)); - } - - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - } -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID JoinParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_JOIN_REQ_STRUCT *JoinReq, - IN ULONG BssIdx) -{ - JoinReq->BssIdx = BssIdx; -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID ScanParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_SCAN_REQ_STRUCT *ScanReq, - IN STRING Ssid[], - IN UCHAR SsidLen, - IN UCHAR BssType, - IN UCHAR ScanType) -{ - NdisZeroMemory(ScanReq->Ssid, MAX_LEN_OF_SSID); - ScanReq->SsidLen = SsidLen; - NdisMoveMemory(ScanReq->Ssid, Ssid, SsidLen); - ScanReq->BssType = BssType; - ScanReq->ScanType = ScanType; -} - -#ifdef QOS_DLS_SUPPORT -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID DlsParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_DLS_REQ_STRUCT *pDlsReq, - IN PRT_802_11_DLS pDls, - IN USHORT reason) -{ - pDlsReq->pDLS = pDls; - pDlsReq->Reason = reason; -} -#endif // QOS_DLS_SUPPORT // - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID StartParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_START_REQ_STRUCT *StartReq, - IN CHAR Ssid[], - IN UCHAR SsidLen) -{ - ASSERT(SsidLen <= MAX_LEN_OF_SSID); - NdisMoveMemory(StartReq->Ssid, Ssid, SsidLen); - StartReq->SsidLen = SsidLen; -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -VOID AuthParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_AUTH_REQ_STRUCT *AuthReq, - IN PUCHAR pAddr, - IN USHORT Alg) -{ - COPY_MAC_ADDR(AuthReq->Addr, pAddr); - AuthReq->Alg = Alg; - AuthReq->Timeout = AUTH_TIMEOUT; -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -#ifdef RTMP_MAC_PCI -VOID ComposePsPoll( - IN PRTMP_ADAPTER pAd) -{ - NdisZeroMemory(&pAd->PsPollFrame, sizeof(PSPOLL_FRAME)); - pAd->PsPollFrame.FC.Type = BTYPE_CNTL; - pAd->PsPollFrame.FC.SubType = SUBTYPE_PS_POLL; - pAd->PsPollFrame.Aid = pAd->StaActive.Aid | 0xC000; - COPY_MAC_ADDR(pAd->PsPollFrame.Bssid, pAd->CommonCfg.Bssid); - COPY_MAC_ADDR(pAd->PsPollFrame.Ta, pAd->CurrentAddress); -} - -// IRQL = DISPATCH_LEVEL -VOID ComposeNullFrame( - IN PRTMP_ADAPTER pAd) -{ - NdisZeroMemory(&pAd->NullFrame, sizeof(HEADER_802_11)); - pAd->NullFrame.FC.Type = BTYPE_DATA; - pAd->NullFrame.FC.SubType = SUBTYPE_NULL_FUNC; - pAd->NullFrame.FC.ToDs = 1; - COPY_MAC_ADDR(pAd->NullFrame.Addr1, pAd->CommonCfg.Bssid); - COPY_MAC_ADDR(pAd->NullFrame.Addr2, pAd->CurrentAddress); - COPY_MAC_ADDR(pAd->NullFrame.Addr3, pAd->CommonCfg.Bssid); -} -#endif // RTMP_MAC_PCI // - - - - -/* - ========================================================================== - Description: - Pre-build a BEACON frame in the shared memory - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - ========================================================================== -*/ -ULONG MakeIbssBeacon( - IN PRTMP_ADAPTER pAd) -{ - UCHAR DsLen = 1, IbssLen = 2; - UCHAR LocalErpIe[3] = {IE_ERP, 1, 0x04}; - HEADER_802_11 BcnHdr; - USHORT CapabilityInfo; - LARGE_INTEGER FakeTimestamp; - ULONG FrameLen = 0; - PTXWI_STRUC pTxWI = &pAd->BeaconTxWI; - UCHAR *pBeaconFrame = pAd->BeaconBuf; - BOOLEAN Privacy; - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen = 0; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR ExtRateLen = 0; - UCHAR RSNIe = IE_WPA; - - if ((pAd->CommonCfg.PhyMode == PHY_11B) && (pAd->CommonCfg.Channel <= 14)) - { - SupRate[0] = 0x82; // 1 mbps - SupRate[1] = 0x84; // 2 mbps - SupRate[2] = 0x8b; // 5.5 mbps - SupRate[3] = 0x96; // 11 mbps - SupRateLen = 4; - ExtRateLen = 0; - } - else if (pAd->CommonCfg.Channel > 14) - { - SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate - SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps - SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate - SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps - SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate - SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps - SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps - SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps - SupRateLen = 8; - ExtRateLen = 0; - - // - // Also Update MlmeRate & RtsRate for G only & A only - // - pAd->CommonCfg.MlmeRate = RATE_6; - pAd->CommonCfg.RtsRate = RATE_6; - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; - pAd->CommonCfg.MlmeTransmit.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; - pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MODE = MODE_OFDM; - pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; - } - else - { - SupRate[0] = 0x82; // 1 mbps - SupRate[1] = 0x84; // 2 mbps - SupRate[2] = 0x8b; // 5.5 mbps - SupRate[3] = 0x96; // 11 mbps - SupRateLen = 4; - - ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps, - ExtRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps - ExtRate[2] = 0x18; // 12 mbps, in units of 0.5 Mbps, - ExtRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps - ExtRate[4] = 0x30; // 24 mbps, in units of 0.5 Mbps, - ExtRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps - ExtRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps - ExtRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps - ExtRateLen = 8; - } - - pAd->StaActive.SupRateLen = SupRateLen; - NdisMoveMemory(pAd->StaActive.SupRate, SupRate, SupRateLen); - pAd->StaActive.ExtRateLen = ExtRateLen; - NdisMoveMemory(pAd->StaActive.ExtRate, ExtRate, ExtRateLen); - - // compose IBSS beacon frame - MgtMacHeaderInit(pAd, &BcnHdr, SUBTYPE_BEACON, 0, BROADCAST_ADDR, pAd->CommonCfg.Bssid); - Privacy = (pAd->StaCfg.WepStatus == Ndis802_11Encryption1Enabled) || - (pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) || - (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled); - CapabilityInfo = CAP_GENERATE(0, 1, Privacy, (pAd->CommonCfg.TxPreamble == Rt802_11PreambleShort), 0, 0); - - MakeOutgoingFrame(pBeaconFrame, &FrameLen, - sizeof(HEADER_802_11), &BcnHdr, - TIMESTAMP_LEN, &FakeTimestamp, - 2, &pAd->CommonCfg.BeaconPeriod, - 2, &CapabilityInfo, - 1, &SsidIe, - 1, &pAd->CommonCfg.SsidLen, - pAd->CommonCfg.SsidLen, pAd->CommonCfg.Ssid, - 1, &SupRateIe, - 1, &SupRateLen, - SupRateLen, SupRate, - 1, &DsIe, - 1, &DsLen, - 1, &pAd->CommonCfg.Channel, - 1, &IbssIe, - 1, &IbssLen, - 2, &pAd->StaActive.AtimWin, - END_OF_ARGS); - - // add ERP_IE and EXT_RAE IE of in 802.11g - if (ExtRateLen) - { - ULONG tmp; - - MakeOutgoingFrame(pBeaconFrame + FrameLen, &tmp, - 3, LocalErpIe, - 1, &ExtRateIe, - 1, &ExtRateLen, - ExtRateLen, ExtRate, - END_OF_ARGS); - FrameLen += tmp; - } - - // If adhoc secruity is set for WPA-None, append the cipher suite IE - if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) - { - ULONG tmp; - RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, BSS0); - - MakeOutgoingFrame(pBeaconFrame + FrameLen, &tmp, - 1, &RSNIe, - 1, &pAd->StaCfg.RSNIE_Len, - pAd->StaCfg.RSNIE_Len, pAd->StaCfg.RSN_IE, - END_OF_ARGS); - FrameLen += tmp; - } - -#ifdef DOT11_N_SUPPORT - if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) - { - ULONG TmpLen; - UCHAR HtLen, HtLen1; - -#ifdef RT_BIG_ENDIAN - HT_CAPABILITY_IE HtCapabilityTmp; - ADD_HT_INFO_IE addHTInfoTmp; - USHORT b2lTmp, b2lTmp2; -#endif - - // add HT Capability IE - HtLen = sizeof(pAd->CommonCfg.HtCapability); - HtLen1 = sizeof(pAd->CommonCfg.AddHTInfo); -#ifndef RT_BIG_ENDIAN - MakeOutgoingFrame(pBeaconFrame+FrameLen, &TmpLen, - 1, &HtCapIe, - 1, &HtLen, - HtLen, &pAd->CommonCfg.HtCapability, - 1, &AddHtInfoIe, - 1, &HtLen1, - HtLen1, &pAd->CommonCfg.AddHTInfo, - END_OF_ARGS); -#else - NdisMoveMemory(&HtCapabilityTmp, &pAd->CommonCfg.HtCapability, HtLen); - *(USHORT *)(&HtCapabilityTmp.HtCapInfo) = SWAP16(*(USHORT *)(&HtCapabilityTmp.HtCapInfo)); - *(USHORT *)(&HtCapabilityTmp.ExtHtCapInfo) = SWAP16(*(USHORT *)(&HtCapabilityTmp.ExtHtCapInfo)); - - NdisMoveMemory(&addHTInfoTmp, &pAd->CommonCfg.AddHTInfo, HtLen1); - *(USHORT *)(&addHTInfoTmp.AddHtInfo2) = SWAP16(*(USHORT *)(&addHTInfoTmp.AddHtInfo2)); - *(USHORT *)(&addHTInfoTmp.AddHtInfo3) = SWAP16(*(USHORT *)(&addHTInfoTmp.AddHtInfo3)); - - MakeOutgoingFrame(pBeaconFrame+FrameLen, &TmpLen, - 1, &HtCapIe, - 1, &HtLen, - HtLen, &HtCapabilityTmp, - 1, &AddHtInfoIe, - 1, &HtLen1, - HtLen1, &addHTInfoTmp, - END_OF_ARGS); -#endif - FrameLen += TmpLen; - } -#endif // DOT11_N_SUPPORT // - - //beacon use reserved WCID 0xff - if (pAd->CommonCfg.Channel > 14) - { - RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, 0, 0xff, FrameLen, - PID_MGMT, PID_BEACON, RATE_1, IFS_HTTXOP, FALSE, &pAd->CommonCfg.MlmeTransmit); - } - else - { - // Set to use 1Mbps for Adhoc beacon. - HTTRANSMIT_SETTING Transmit; - Transmit.word = 0; - RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, 0, 0xff, FrameLen, - PID_MGMT, PID_BEACON, RATE_1, IFS_HTTXOP, FALSE, &Transmit); - } - -#ifdef RT_BIG_ENDIAN - RTMPFrameEndianChange(pAd, pBeaconFrame, DIR_WRITE, FALSE); - RTMPWIEndianChange((PUCHAR)pTxWI, TYPE_TXWI); -#endif - - DBGPRINT(RT_DEBUG_TRACE, ("MakeIbssBeacon (len=%ld), SupRateLen=%d, ExtRateLen=%d, Channel=%d, PhyMode=%d\n", - FrameLen, SupRateLen, ExtRateLen, pAd->CommonCfg.Channel, pAd->CommonCfg.PhyMode)); - return FrameLen; -} diff --git a/drivers/staging/rt3090/sta/dls.c b/drivers/staging/rt3090/sta/dls.c deleted file mode 100644 index 306e16fdeeae..000000000000 --- a/drivers/staging/rt3090/sta/dls.c +++ /dev/null @@ -1,2207 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - dls.c - - Abstract: - Handle WMM-DLS state machine - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Rory Chen 02-14-2006 - Arvin Tai 06-03-2008 Modified for RT28xx - */ - -#include "../rt_config.h" - - -/* - ========================================================================== - Description: - dls state machine init, including state transition and timer init - Parameters: - Sm - pointer to the dls state machine - Note: - The state machine looks like this - - DLS_IDLE - MT2_MLME_DLS_REQUEST MlmeDlsReqAction - MT2_PEER_DLS_REQUEST PeerDlsReqAction - MT2_PEER_DLS_RESPONSE PeerDlsRspAction - MT2_MLME_DLS_TEARDOWN MlmeTearDownAction - MT2_PEER_DLS_TEARDOWN PeerTearDownAction - - IRQL = PASSIVE_LEVEL - - ========================================================================== - */ -void DlsStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *Sm, - OUT STATE_MACHINE_FUNC Trans[]) -{ - UCHAR i; - - StateMachineInit(Sm, (STATE_MACHINE_FUNC*)Trans, MAX_DLS_STATE, MAX_DLS_MSG, (STATE_MACHINE_FUNC)Drop, DLS_IDLE, DLS_MACHINE_BASE); - - // the first column - StateMachineSetAction(Sm, DLS_IDLE, MT2_MLME_DLS_REQ, (STATE_MACHINE_FUNC)MlmeDlsReqAction); - StateMachineSetAction(Sm, DLS_IDLE, MT2_PEER_DLS_REQ, (STATE_MACHINE_FUNC)PeerDlsReqAction); - StateMachineSetAction(Sm, DLS_IDLE, MT2_PEER_DLS_RSP, (STATE_MACHINE_FUNC)PeerDlsRspAction); - StateMachineSetAction(Sm, DLS_IDLE, MT2_MLME_DLS_TEAR_DOWN, (STATE_MACHINE_FUNC)MlmeDlsTearDownAction); - StateMachineSetAction(Sm, DLS_IDLE, MT2_PEER_DLS_TEAR_DOWN, (STATE_MACHINE_FUNC)PeerDlsTearDownAction); - - for (i=0; iStaCfg.DLSEntry[i].pAd = pAd; - RTMPInitTimer(pAd, &pAd->StaCfg.DLSEntry[i].Timer, GET_TIMER_FUNCTION(DlsTimeoutAction), pAd, FALSE); - } -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID MlmeDlsReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - HEADER_802_11 DlsReqHdr; - PRT_802_11_DLS pDLS = NULL; - UCHAR Category = CATEGORY_DLS; - UCHAR Action = ACTION_DLS_REQUEST; - ULONG tmp; - USHORT reason; - ULONG Timeout; - BOOLEAN TimerCancelled; - - if(!MlmeDlsReqSanity(pAd, Elem->Msg, Elem->MsgLen, &pDLS, &reason)) - return; - - DBGPRINT(RT_DEBUG_TRACE,("DLS - MlmeDlsReqAction() \n")); - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_ERROR,("DLS - MlmeDlsReqAction() allocate memory failed \n")); - return; - } - - ActHeaderInit(pAd, &DlsReqHdr, pAd->CommonCfg.Bssid, pAd->CurrentAddress, pAd->CommonCfg.Bssid); - - // Build basic frame first - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &DlsReqHdr, - 1, &Category, - 1, &Action, - 6, &pDLS->MacAddr, - 6, pAd->CurrentAddress, - 2, &pAd->StaActive.CapabilityInfo, - 2, &pDLS->TimeOut, - 1, &SupRateIe, - 1, &pAd->MlmeAux.SupRateLen, - pAd->MlmeAux.SupRateLen, pAd->MlmeAux.SupRate, - END_OF_ARGS); - - if (pAd->MlmeAux.ExtRateLen != 0) - { - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 1, &ExtRateIe, - 1, &pAd->MlmeAux.ExtRateLen, - pAd->MlmeAux.ExtRateLen, pAd->MlmeAux.ExtRate, - END_OF_ARGS); - FrameLen += tmp; - } - -#ifdef DOT11_N_SUPPORT - if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) - { - UCHAR HtLen; - -#ifdef RT_BIG_ENDIAN - HT_CAPABILITY_IE HtCapabilityTmp; -#endif - - // add HT Capability IE - HtLen = sizeof(HT_CAPABILITY_IE); -#ifndef RT_BIG_ENDIAN - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 1, &HtCapIe, - 1, &HtLen, - HtLen, &pAd->CommonCfg.HtCapability, - END_OF_ARGS); -#else - NdisMoveMemory(&HtCapabilityTmp, &pAd->CommonCfg.HtCapability, HtLen); - *(USHORT *)(&HtCapabilityTmp.HtCapInfo) = SWAP16(*(USHORT *)(&HtCapabilityTmp.HtCapInfo)); - *(USHORT *)(&HtCapabilityTmp.ExtHtCapInfo) = SWAP16(*(USHORT *)(&HtCapabilityTmp.ExtHtCapInfo)); - - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 1, &HtCapIe, - 1, &HtLen, - HtLen, &HtCapabilityTmp, - END_OF_ARGS); -#endif - FrameLen = FrameLen + tmp; - } -#endif // DOT11_N_SUPPORT // - - RTMPCancelTimer(&pDLS->Timer, &TimerCancelled); - Timeout = DLS_TIMEOUT; - RTMPSetTimer(&pDLS->Timer, Timeout); - - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID PeerDlsReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - USHORT StatusCode = MLME_SUCCESS; - HEADER_802_11 DlsRspHdr; - UCHAR Category = CATEGORY_DLS; - UCHAR Action = ACTION_DLS_RESPONSE; - ULONG tmp; - USHORT CapabilityInfo; - UCHAR DA[MAC_ADDR_LEN], SA[MAC_ADDR_LEN]; - USHORT DLSTimeOut; - SHORT i; - ULONG Timeout; - BOOLEAN TimerCancelled; - PRT_802_11_DLS pDLS = NULL; - UCHAR MaxSupportedRateIn500Kbps = 0; - UCHAR SupportedRatesLen; - UCHAR SupportedRates[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR HtCapabilityLen; - HT_CAPABILITY_IE HtCapability; - - if (!PeerDlsReqSanity(pAd, Elem->Msg, Elem->MsgLen, DA, SA, &CapabilityInfo, &DLSTimeOut, - &SupportedRatesLen, &SupportedRates[0], &HtCapabilityLen, &HtCapability)) - return; - - // supported rates array may not be sorted. sort it and find the maximum rate - for (i = 0; i < SupportedRatesLen; i++) - { - if (MaxSupportedRateIn500Kbps < (SupportedRates[i] & 0x7f)) - MaxSupportedRateIn500Kbps = SupportedRates[i] & 0x7f; - } - - DBGPRINT(RT_DEBUG_TRACE,("DLS - PeerDlsReqAction() from %02x:%02x:%02x:%02x:%02x:%02x\n", SA[0], SA[1], SA[2], SA[3], SA[4], SA[5])); - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_ERROR,("DLS - PeerDlsReqAction() allocate memory failed \n")); - return; - } - - if (!INFRA_ON(pAd)) - { - StatusCode = MLME_REQUEST_DECLINED; - } - else if (!pAd->CommonCfg.bWmmCapable) - { - StatusCode = MLME_DEST_STA_IS_NOT_A_QSTA; - } - else if (!pAd->CommonCfg.bDLSCapable) - { - StatusCode = MLME_REQUEST_DECLINED; - } - else - { - // find table to update parameters - for (i = (MAX_NUM_OF_DLS_ENTRY-1); i >= 0; i--) - { - if (pAd->StaCfg.DLSEntry[i].Valid && MAC_ADDR_EQUAL(SA, pAd->StaCfg.DLSEntry[i].MacAddr)) - { - if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - pAd->StaCfg.DLSEntry[i].Status = DLS_WAIT_KEY; - else - { - RTMPCancelTimer(&pAd->StaCfg.DLSEntry[i].Timer, &TimerCancelled); - pAd->StaCfg.DLSEntry[i].Status = DLS_FINISH; - } - - pAd->StaCfg.DLSEntry[i].Sequence = 0; - pAd->StaCfg.DLSEntry[i].TimeOut = DLSTimeOut; - pAd->StaCfg.DLSEntry[i].CountDownTimer = DLSTimeOut; - if (HtCapabilityLen != 0) - pAd->StaCfg.DLSEntry[i].bHTCap = TRUE; - else - pAd->StaCfg.DLSEntry[i].bHTCap = FALSE; - pDLS = &pAd->StaCfg.DLSEntry[i]; - break; - } - } - - // can not find in table, create a new one - if (i < 0) - { - DBGPRINT(RT_DEBUG_TRACE,("DLS - PeerDlsReqAction() can not find same entry \n")); - for (i=(MAX_NUM_OF_DLS_ENTRY - 1); i >= MAX_NUM_OF_INIT_DLS_ENTRY; i--) - { - if (!pAd->StaCfg.DLSEntry[i].Valid) - { - MAC_TABLE_ENTRY *pEntry; - UCHAR MaxSupportedRate = RATE_11; - - if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - { - pAd->StaCfg.DLSEntry[i].Status = DLS_WAIT_KEY; - } - else - { - RTMPCancelTimer(&pAd->StaCfg.DLSEntry[i].Timer, &TimerCancelled); - pAd->StaCfg.DLSEntry[i].Status = DLS_FINISH; - } - - pAd->StaCfg.DLSEntry[i].Sequence = 0; - pAd->StaCfg.DLSEntry[i].Valid = TRUE; - pAd->StaCfg.DLSEntry[i].TimeOut = DLSTimeOut; - pAd->StaCfg.DLSEntry[i].CountDownTimer = DLSTimeOut; - NdisMoveMemory(pAd->StaCfg.DLSEntry[i].MacAddr, SA, MAC_ADDR_LEN); - if (HtCapabilityLen != 0) - pAd->StaCfg.DLSEntry[i].bHTCap = TRUE; - else - pAd->StaCfg.DLSEntry[i].bHTCap = FALSE; - pDLS = &pAd->StaCfg.DLSEntry[i]; - pEntry = MacTableInsertDlsEntry(pAd, SA, i); - - switch (MaxSupportedRateIn500Kbps) - { - case 108: MaxSupportedRate = RATE_54; break; - case 96: MaxSupportedRate = RATE_48; break; - case 72: MaxSupportedRate = RATE_36; break; - case 48: MaxSupportedRate = RATE_24; break; - case 36: MaxSupportedRate = RATE_18; break; - case 24: MaxSupportedRate = RATE_12; break; - case 18: MaxSupportedRate = RATE_9; break; - case 12: MaxSupportedRate = RATE_6; break; - case 22: MaxSupportedRate = RATE_11; break; - case 11: MaxSupportedRate = RATE_5_5; break; - case 4: MaxSupportedRate = RATE_2; break; - case 2: MaxSupportedRate = RATE_1; break; - default: MaxSupportedRate = RATE_11; break; - } - - pEntry->MaxSupportedRate = min(pAd->CommonCfg.MaxTxRate, MaxSupportedRate); - - if (pEntry->MaxSupportedRate < RATE_FIRST_OFDM_RATE) - { - pEntry->MaxHTPhyMode.field.MODE = MODE_CCK; - pEntry->MaxHTPhyMode.field.MCS = pEntry->MaxSupportedRate; - pEntry->MinHTPhyMode.field.MODE = MODE_CCK; - pEntry->MinHTPhyMode.field.MCS = pEntry->MaxSupportedRate; - pEntry->HTPhyMode.field.MODE = MODE_CCK; - pEntry->HTPhyMode.field.MCS = pEntry->MaxSupportedRate; - } - else - { - pEntry->MaxHTPhyMode.field.MODE = MODE_OFDM; - pEntry->MaxHTPhyMode.field.MCS = OfdmRateToRxwiMCS[pEntry->MaxSupportedRate]; - pEntry->MinHTPhyMode.field.MODE = MODE_OFDM; - pEntry->MinHTPhyMode.field.MCS = OfdmRateToRxwiMCS[pEntry->MaxSupportedRate]; - pEntry->HTPhyMode.field.MODE = MODE_OFDM; - pEntry->HTPhyMode.field.MCS = OfdmRateToRxwiMCS[pEntry->MaxSupportedRate]; - } - - pEntry->MaxHTPhyMode.field.BW = BW_20; - pEntry->MinHTPhyMode.field.BW = BW_20; - -#ifdef DOT11_N_SUPPORT - pEntry->HTCapability.MCSSet[0] = 0; - pEntry->HTCapability.MCSSet[1] = 0; - - // If this Entry supports 802.11n, upgrade to HT rate. - if ((HtCapabilityLen != 0) && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) - { - UCHAR j, bitmask; //k,bitmask; - CHAR ii; - - DBGPRINT(RT_DEBUG_TRACE, ("DLS - PeerDlsReqAction() Receive Peer HT Capable STA from %02x:%02x:%02x:%02x:%02x:%02x\n", - SA[0], SA[1], SA[2], SA[3], SA[4], SA[5])); - - if ((HtCapability.HtCapInfo.GF) && (pAd->CommonCfg.DesiredHtPhy.GF)) - { - pEntry->MaxHTPhyMode.field.MODE = MODE_HTGREENFIELD; - } - else - { - pEntry->MaxHTPhyMode.field.MODE = MODE_HTMIX; - pAd->MacTab.fAnyStationNonGF = TRUE; - pAd->CommonCfg.AddHTInfo.AddHtInfo2.NonGfPresent = 1; - } - - if ((HtCapability.HtCapInfo.ChannelWidth) && (pAd->CommonCfg.DesiredHtPhy.ChannelWidth)) - { - pEntry->MaxHTPhyMode.field.BW= BW_40; - pEntry->MaxHTPhyMode.field.ShortGI = ((pAd->CommonCfg.DesiredHtPhy.ShortGIfor40)&(HtCapability.HtCapInfo.ShortGIfor40)); - } - else - { - pEntry->MaxHTPhyMode.field.BW = BW_20; - pEntry->MaxHTPhyMode.field.ShortGI = ((pAd->CommonCfg.DesiredHtPhy.ShortGIfor20)&(HtCapability.HtCapInfo.ShortGIfor20)); - pAd->MacTab.fAnyStation20Only = TRUE; - } - - // find max fixed rate - for (ii=15; ii>=0; ii--) - { - j = ii/8; - bitmask = (1<<(ii-(j*8))); - if ( (pAd->StaCfg.DesiredHtPhyInfo.MCSSet[j]&bitmask) && (HtCapability.MCSSet[j]&bitmask)) - { - pEntry->MaxHTPhyMode.field.MCS = ii; - break; - } - if (ii==0) - break; - } - - - if (pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) - { - - DBGPRINT(RT_DEBUG_OFF, ("@@@ pAd->CommonCfg.RegTransmitSetting.field.MCS = %d\n", - pAd->StaCfg.DesiredTransmitSetting.field.MCS)); - if (pAd->StaCfg.DesiredTransmitSetting.field.MCS == 32) - { - // Fix MCS as HT Duplicated Mode - pEntry->MaxHTPhyMode.field.BW = 1; - pEntry->MaxHTPhyMode.field.MODE = MODE_HTMIX; - pEntry->MaxHTPhyMode.field.STBC = 0; - pEntry->MaxHTPhyMode.field.ShortGI = 0; - pEntry->MaxHTPhyMode.field.MCS = 32; - } - else if (pEntry->MaxHTPhyMode.field.MCS > pAd->StaCfg.HTPhyMode.field.MCS) - { - // STA supports fixed MCS - pEntry->MaxHTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - } - } - - pEntry->MaxHTPhyMode.field.STBC = (HtCapability.HtCapInfo.RxSTBC & (pAd->CommonCfg.DesiredHtPhy.TxSTBC)); - pEntry->MpduDensity = HtCapability.HtCapParm.MpduDensity; - pEntry->MaxRAmpduFactor = HtCapability.HtCapParm.MaxRAmpduFactor; - pEntry->MmpsMode = (UCHAR)HtCapability.HtCapInfo.MimoPs; - pEntry->AMsduSize = (UCHAR)HtCapability.HtCapInfo.AMsduSize; - pEntry->HTPhyMode.word = pEntry->MaxHTPhyMode.word; - - if (HtCapability.HtCapInfo.ShortGIfor20) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_SGI20_CAPABLE); - if (HtCapability.HtCapInfo.ShortGIfor40) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_SGI40_CAPABLE); - if (HtCapability.HtCapInfo.TxSTBC) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_TxSTBC_CAPABLE); - if (HtCapability.HtCapInfo.RxSTBC) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_RxSTBC_CAPABLE); - if (HtCapability.ExtHtCapInfo.PlusHTC) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_HTC_CAPABLE); - if (pAd->CommonCfg.bRdg && HtCapability.ExtHtCapInfo.RDGSupport) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_RDG_CAPABLE); - if (HtCapability.ExtHtCapInfo.MCSFeedback == 0x03) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_MCSFEEDBACK_CAPABLE); - - NdisMoveMemory(&pEntry->HTCapability, &HtCapability, sizeof(HT_CAPABILITY_IE)); - } -#endif // DOT11_N_SUPPORT // - - pEntry->HTPhyMode.word = pEntry->MaxHTPhyMode.word; - pEntry->CurrTxRate = pEntry->MaxSupportedRate; - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_WMM_CAPABLE); - - if (pAd->StaCfg.bAutoTxRateSwitch == TRUE) - { - PUCHAR pTable; - UCHAR TableSize = 0; - - MlmeSelectTxRateTable(pAd, pEntry, &pTable, &TableSize, &pEntry->CurrTxRateIndex); - pEntry->bAutoTxRateSwitch = TRUE; - } - else - { - pEntry->HTPhyMode.field.MODE = pAd->StaCfg.HTPhyMode.field.MODE; - pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - pEntry->bAutoTxRateSwitch = FALSE; - - RTMPUpdateLegacyTxSetting((UCHAR)pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode, pEntry); - } - pEntry->RateLen = SupportedRatesLen; - - break; - } - } - } - StatusCode = MLME_SUCCESS; - - // can not find in table, create a new one - if (i < 0) - { - StatusCode = MLME_QOS_UNSPECIFY; - DBGPRINT(RT_DEBUG_ERROR,("DLS - PeerDlsReqAction() DLSEntry table full(only can support %d DLS session) \n", MAX_NUM_OF_DLS_ENTRY - MAX_NUM_OF_INIT_DLS_ENTRY)); - } - else - { - DBGPRINT(RT_DEBUG_TRACE,("DLS - PeerDlsReqAction() use entry(%d) %02x:%02x:%02x:%02x:%02x:%02x\n", - i, SA[0], SA[1], SA[2], SA[3], SA[4], SA[5])); - } - } - - ActHeaderInit(pAd, &DlsRspHdr, pAd->CommonCfg.Bssid, pAd->CurrentAddress, pAd->CommonCfg.Bssid); - - // Build basic frame first - if (StatusCode == MLME_SUCCESS) - { - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &DlsRspHdr, - 1, &Category, - 1, &Action, - 2, &StatusCode, - 6, SA, - 6, pAd->CurrentAddress, - 2, &pAd->StaActive.CapabilityInfo, - 1, &SupRateIe, - 1, &pAd->MlmeAux.SupRateLen, - pAd->MlmeAux.SupRateLen, pAd->MlmeAux.SupRate, - END_OF_ARGS); - - if (pAd->MlmeAux.ExtRateLen != 0) - { - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 1, &ExtRateIe, - 1, &pAd->MlmeAux.ExtRateLen, - pAd->MlmeAux.ExtRateLen, pAd->MlmeAux.ExtRate, - END_OF_ARGS); - FrameLen += tmp; - } - -#ifdef DOT11_N_SUPPORT - if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) - { - UCHAR HtLen; - -#ifdef RT_BIG_ENDIAN - HT_CAPABILITY_IE HtCapabilityTmp; -#endif - - // add HT Capability IE - HtLen = sizeof(HT_CAPABILITY_IE); -#ifndef RT_BIG_ENDIAN - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 1, &HtCapIe, - 1, &HtLen, - HtLen, &pAd->CommonCfg.HtCapability, - END_OF_ARGS); -#else - NdisMoveMemory(&HtCapabilityTmp, &pAd->CommonCfg.HtCapability, HtLen); - *(USHORT *)(&HtCapabilityTmp.HtCapInfo) = SWAP16(*(USHORT *)(&HtCapabilityTmp.HtCapInfo)); - *(USHORT *)(&HtCapabilityTmp.ExtHtCapInfo) = SWAP16(*(USHORT *)(&HtCapabilityTmp.ExtHtCapInfo)); - - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 1, &HtCapIe, - 1, &HtLen, - HtLen, &HtCapabilityTmp, - END_OF_ARGS); -#endif - FrameLen = FrameLen + tmp; - } -#endif // DOT11_N_SUPPORT // - - if (pDLS && (pDLS->Status != DLS_FINISH)) - { - RTMPCancelTimer(&pDLS->Timer, &TimerCancelled); - Timeout = DLS_TIMEOUT; - RTMPSetTimer(&pDLS->Timer, Timeout); - } - } - else - { - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &DlsRspHdr, - 1, &Category, - 1, &Action, - 2, &StatusCode, - 6, SA, - 6, pAd->CurrentAddress, - END_OF_ARGS); - } - - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID PeerDlsRspAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT CapabilityInfo; - UCHAR DA[MAC_ADDR_LEN], SA[MAC_ADDR_LEN]; - USHORT StatusCode; - SHORT i; - BOOLEAN TimerCancelled; - UCHAR MaxSupportedRateIn500Kbps = 0; - UCHAR SupportedRatesLen; - UCHAR SupportedRates[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR HtCapabilityLen; - HT_CAPABILITY_IE HtCapability; - - if (!pAd->CommonCfg.bDLSCapable) - return; - - if (!INFRA_ON(pAd)) - return; - - if (!PeerDlsRspSanity(pAd, Elem->Msg, Elem->MsgLen, DA, SA, &CapabilityInfo, &StatusCode, - &SupportedRatesLen, &SupportedRates[0], &HtCapabilityLen, &HtCapability)) - return; - - // supported rates array may not be sorted. sort it and find the maximum rate - for (i=0; iStaCfg.DLSEntry[i].Valid && MAC_ADDR_EQUAL(SA, pAd->StaCfg.DLSEntry[i].MacAddr)) - { - if (StatusCode == MLME_SUCCESS) - { - MAC_TABLE_ENTRY *pEntry; - UCHAR MaxSupportedRate = RATE_11; - - pEntry = MacTableInsertDlsEntry(pAd, SA, i); - - switch (MaxSupportedRateIn500Kbps) - { - case 108: MaxSupportedRate = RATE_54; break; - case 96: MaxSupportedRate = RATE_48; break; - case 72: MaxSupportedRate = RATE_36; break; - case 48: MaxSupportedRate = RATE_24; break; - case 36: MaxSupportedRate = RATE_18; break; - case 24: MaxSupportedRate = RATE_12; break; - case 18: MaxSupportedRate = RATE_9; break; - case 12: MaxSupportedRate = RATE_6; break; - case 22: MaxSupportedRate = RATE_11; break; - case 11: MaxSupportedRate = RATE_5_5; break; - case 4: MaxSupportedRate = RATE_2; break; - case 2: MaxSupportedRate = RATE_1; break; - default: MaxSupportedRate = RATE_11; break; - } - - pEntry->MaxSupportedRate = min(pAd->CommonCfg.MaxTxRate, MaxSupportedRate); - - if (pEntry->MaxSupportedRate < RATE_FIRST_OFDM_RATE) - { - pEntry->MaxHTPhyMode.field.MODE = MODE_CCK; - pEntry->MaxHTPhyMode.field.MCS = pEntry->MaxSupportedRate; - pEntry->MinHTPhyMode.field.MODE = MODE_CCK; - pEntry->MinHTPhyMode.field.MCS = pEntry->MaxSupportedRate; - pEntry->HTPhyMode.field.MODE = MODE_CCK; - pEntry->HTPhyMode.field.MCS = pEntry->MaxSupportedRate; - } - else - { - pEntry->MaxHTPhyMode.field.MODE = MODE_OFDM; - pEntry->MaxHTPhyMode.field.MCS = OfdmRateToRxwiMCS[pEntry->MaxSupportedRate]; - pEntry->MinHTPhyMode.field.MODE = MODE_OFDM; - pEntry->MinHTPhyMode.field.MCS = OfdmRateToRxwiMCS[pEntry->MaxSupportedRate]; - pEntry->HTPhyMode.field.MODE = MODE_OFDM; - pEntry->HTPhyMode.field.MCS = OfdmRateToRxwiMCS[pEntry->MaxSupportedRate]; - } - - pEntry->MaxHTPhyMode.field.BW = BW_20; - pEntry->MinHTPhyMode.field.BW = BW_20; - -#ifdef DOT11_N_SUPPORT - pEntry->HTCapability.MCSSet[0] = 0; - pEntry->HTCapability.MCSSet[1] = 0; - - // If this Entry supports 802.11n, upgrade to HT rate. - if ((HtCapabilityLen != 0) && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) - { - UCHAR j, bitmask; //k,bitmask; - CHAR ii; - - DBGPRINT(RT_DEBUG_OFF, ("DLS - PeerDlsRspAction Receive Peer HT Capable STA from %02x:%02x:%02x:%02x:%02x:%02x\n", - SA[0], SA[1], SA[2], SA[3], SA[4], SA[5])); - - if ((HtCapability.HtCapInfo.GF) && (pAd->CommonCfg.DesiredHtPhy.GF)) - { - pEntry->MaxHTPhyMode.field.MODE = MODE_HTGREENFIELD; - } - else - { - pEntry->MaxHTPhyMode.field.MODE = MODE_HTMIX; - pAd->MacTab.fAnyStationNonGF = TRUE; - pAd->CommonCfg.AddHTInfo.AddHtInfo2.NonGfPresent = 1; - } - - if ((HtCapability.HtCapInfo.ChannelWidth) && (pAd->CommonCfg.DesiredHtPhy.ChannelWidth)) - { - pEntry->MaxHTPhyMode.field.BW= BW_40; - pEntry->MaxHTPhyMode.field.ShortGI = ((pAd->CommonCfg.DesiredHtPhy.ShortGIfor40)&(HtCapability.HtCapInfo.ShortGIfor40)); - } - else - { - pEntry->MaxHTPhyMode.field.BW = BW_20; - pEntry->MaxHTPhyMode.field.ShortGI = ((pAd->CommonCfg.DesiredHtPhy.ShortGIfor20)&(HtCapability.HtCapInfo.ShortGIfor20)); - pAd->MacTab.fAnyStation20Only = TRUE; - } - - // find max fixed rate - for (ii=15; ii>=0; ii--) - { - j = ii/8; - bitmask = (1<<(ii-(j*8))); - if ( (pAd->StaCfg.DesiredHtPhyInfo.MCSSet[j]&bitmask) && (HtCapability.MCSSet[j]&bitmask)) - { - pEntry->MaxHTPhyMode.field.MCS = ii; - break; - } - if (ii==0) - break; - } - - if (pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) - { - if (pAd->StaCfg.DesiredTransmitSetting.field.MCS == 32) - { - // Fix MCS as HT Duplicated Mode - pEntry->MaxHTPhyMode.field.BW = 1; - pEntry->MaxHTPhyMode.field.MODE = MODE_HTMIX; - pEntry->MaxHTPhyMode.field.STBC = 0; - pEntry->MaxHTPhyMode.field.ShortGI = 0; - pEntry->MaxHTPhyMode.field.MCS = 32; - } - else if (pEntry->MaxHTPhyMode.field.MCS > pAd->StaCfg.HTPhyMode.field.MCS) - { - // STA supports fixed MCS - pEntry->MaxHTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - } - } - - pEntry->MaxHTPhyMode.field.STBC = (HtCapability.HtCapInfo.RxSTBC & (pAd->CommonCfg.DesiredHtPhy.TxSTBC)); - pEntry->MpduDensity = HtCapability.HtCapParm.MpduDensity; - pEntry->MaxRAmpduFactor = HtCapability.HtCapParm.MaxRAmpduFactor; - pEntry->MmpsMode = (UCHAR)HtCapability.HtCapInfo.MimoPs; - pEntry->AMsduSize = (UCHAR)HtCapability.HtCapInfo.AMsduSize; - pEntry->HTPhyMode.word = pEntry->MaxHTPhyMode.word; - - if (HtCapability.HtCapInfo.ShortGIfor20) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_SGI20_CAPABLE); - if (HtCapability.HtCapInfo.ShortGIfor40) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_SGI40_CAPABLE); - if (HtCapability.HtCapInfo.TxSTBC) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_TxSTBC_CAPABLE); - if (HtCapability.HtCapInfo.RxSTBC) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_RxSTBC_CAPABLE); - if (HtCapability.ExtHtCapInfo.PlusHTC) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_HTC_CAPABLE); - if (pAd->CommonCfg.bRdg && HtCapability.ExtHtCapInfo.RDGSupport) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_RDG_CAPABLE); - if (HtCapability.ExtHtCapInfo.MCSFeedback == 0x03) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_MCSFEEDBACK_CAPABLE); - - NdisMoveMemory(&pEntry->HTCapability, &HtCapability, sizeof(HT_CAPABILITY_IE)); - } -#endif // DOT11_N_SUPPORT // - pEntry->HTPhyMode.word = pEntry->MaxHTPhyMode.word; - pEntry->CurrTxRate = pEntry->MaxSupportedRate; - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_WMM_CAPABLE); - - if (pAd->StaCfg.bAutoTxRateSwitch == TRUE) - { - PUCHAR pTable; - UCHAR TableSize = 0; - - MlmeSelectTxRateTable(pAd, pEntry, &pTable, &TableSize, &pEntry->CurrTxRateIndex); - pEntry->bAutoTxRateSwitch = TRUE; - } - else - { - pEntry->HTPhyMode.field.MODE = pAd->StaCfg.HTPhyMode.field.MODE; - pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - pEntry->bAutoTxRateSwitch = FALSE; - - RTMPUpdateLegacyTxSetting((UCHAR)pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode, pEntry); - } - pEntry->RateLen = SupportedRatesLen; - - if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - { - // If support WPA or WPA2, start STAKey hand shake, - // If failed hand shake, just tear down peer DLS - if (RTMPSendSTAKeyRequest(pAd, pAd->StaCfg.DLSEntry[i].MacAddr) != NDIS_STATUS_SUCCESS) - { - MLME_DLS_REQ_STRUCT MlmeDlsReq; - USHORT reason = REASON_QOS_CIPHER_NOT_SUPPORT; - - DlsParmFill(pAd, &MlmeDlsReq, &pAd->StaCfg.DLSEntry[i], reason); - MlmeEnqueue(pAd, DLS_STATE_MACHINE, MT2_MLME_DLS_TEAR_DOWN, sizeof(MLME_DLS_REQ_STRUCT), &MlmeDlsReq); - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - pAd->StaCfg.DLSEntry[i].Valid = FALSE; - DBGPRINT(RT_DEBUG_ERROR,("DLS - PeerDlsRspAction failed when call RTMPSendSTAKeyRequest \n")); - } - else - { - pAd->StaCfg.DLSEntry[i].Status = DLS_WAIT_KEY; - DBGPRINT(RT_DEBUG_TRACE,("DLS - waiting for STAKey handshake procedure\n")); - } - } - else - { - RTMPCancelTimer(&pAd->StaCfg.DLSEntry[i].Timer, &TimerCancelled); - pAd->StaCfg.DLSEntry[i].Status = DLS_FINISH; - DBGPRINT(RT_DEBUG_TRACE,("DLS - PeerDlsRspAction() from %02x:%02x:%02x:%02x:%02x:%02x Succeed with WEP or no security\n", SA[0], SA[1], SA[2], SA[3], SA[4], SA[5])); - } - - //initialize seq no for DLS frames. - pAd->StaCfg.DLSEntry[i].Sequence = 0; - if (HtCapabilityLen != 0) - pAd->StaCfg.DLSEntry[i].bHTCap = TRUE; - else - pAd->StaCfg.DLSEntry[i].bHTCap = FALSE; - } - else - { - // DLS setup procedure failed. - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - pAd->StaCfg.DLSEntry[i].Valid = FALSE; - RTMPCancelTimer(&pAd->StaCfg.DLSEntry[i].Timer, &TimerCancelled); - DBGPRINT(RT_DEBUG_ERROR,("DLS - PeerDlsRspAction failed with StatusCode=%d \n", StatusCode)); - } - } - } - - if (i >= MAX_NUM_OF_INIT_DLS_ENTRY) - { - DBGPRINT(RT_DEBUG_TRACE,("DLS - PeerDlsRspAction() update timeout value \n")); - for (i=(MAX_NUM_OF_DLS_ENTRY-1); i>=MAX_NUM_OF_INIT_DLS_ENTRY; i--) - { - if (pAd->StaCfg.DLSEntry[i].Valid && MAC_ADDR_EQUAL(SA, pAd->StaCfg.DLSEntry[i].MacAddr)) - { - if (StatusCode == MLME_SUCCESS) - { - MAC_TABLE_ENTRY *pEntry; - UCHAR MaxSupportedRate = RATE_11; - - pEntry = MacTableInsertDlsEntry(pAd, SA, i); - - switch (MaxSupportedRateIn500Kbps) - { - case 108: MaxSupportedRate = RATE_54; break; - case 96: MaxSupportedRate = RATE_48; break; - case 72: MaxSupportedRate = RATE_36; break; - case 48: MaxSupportedRate = RATE_24; break; - case 36: MaxSupportedRate = RATE_18; break; - case 24: MaxSupportedRate = RATE_12; break; - case 18: MaxSupportedRate = RATE_9; break; - case 12: MaxSupportedRate = RATE_6; break; - case 22: MaxSupportedRate = RATE_11; break; - case 11: MaxSupportedRate = RATE_5_5; break; - case 4: MaxSupportedRate = RATE_2; break; - case 2: MaxSupportedRate = RATE_1; break; - default: MaxSupportedRate = RATE_11; break; - } - - pEntry->MaxSupportedRate = min(pAd->CommonCfg.MaxTxRate, MaxSupportedRate); - - if (pEntry->MaxSupportedRate < RATE_FIRST_OFDM_RATE) - { - pEntry->MaxHTPhyMode.field.MODE = MODE_CCK; - pEntry->MaxHTPhyMode.field.MCS = pEntry->MaxSupportedRate; - pEntry->MinHTPhyMode.field.MODE = MODE_CCK; - pEntry->MinHTPhyMode.field.MCS = pEntry->MaxSupportedRate; - pEntry->HTPhyMode.field.MODE = MODE_CCK; - pEntry->HTPhyMode.field.MCS = pEntry->MaxSupportedRate; - } - else - { - pEntry->MaxHTPhyMode.field.MODE = MODE_OFDM; - pEntry->MaxHTPhyMode.field.MCS = OfdmRateToRxwiMCS[pEntry->MaxSupportedRate]; - pEntry->MinHTPhyMode.field.MODE = MODE_OFDM; - pEntry->MinHTPhyMode.field.MCS = OfdmRateToRxwiMCS[pEntry->MaxSupportedRate]; - pEntry->HTPhyMode.field.MODE = MODE_OFDM; - pEntry->HTPhyMode.field.MCS = OfdmRateToRxwiMCS[pEntry->MaxSupportedRate]; - } - - pEntry->MaxHTPhyMode.field.BW = BW_20; - pEntry->MinHTPhyMode.field.BW = BW_20; - -#ifdef DOT11_N_SUPPORT - pEntry->HTCapability.MCSSet[0] = 0; - pEntry->HTCapability.MCSSet[1] = 0; - - // If this Entry supports 802.11n, upgrade to HT rate. - if ((HtCapabilityLen != 0) && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) - { - UCHAR j, bitmask; //k,bitmask; - CHAR ii; - - DBGPRINT(RT_DEBUG_TRACE, ("DLS - PeerDlsRspAction Receive Peer HT Capable STA from %02x:%02x:%02x:%02x:%02x:%02x\n", - SA[0], SA[1], SA[2], SA[3], SA[4], SA[5])); - - if ((HtCapability.HtCapInfo.GF) && (pAd->CommonCfg.DesiredHtPhy.GF)) - { - pEntry->MaxHTPhyMode.field.MODE = MODE_HTGREENFIELD; - } - else - { - pEntry->MaxHTPhyMode.field.MODE = MODE_HTMIX; - pAd->MacTab.fAnyStationNonGF = TRUE; - pAd->CommonCfg.AddHTInfo.AddHtInfo2.NonGfPresent = 1; - } - - if ((HtCapability.HtCapInfo.ChannelWidth) && (pAd->CommonCfg.DesiredHtPhy.ChannelWidth)) - { - pEntry->MaxHTPhyMode.field.BW= BW_40; - pEntry->MaxHTPhyMode.field.ShortGI = ((pAd->CommonCfg.DesiredHtPhy.ShortGIfor40)&(HtCapability.HtCapInfo.ShortGIfor40)); - } - else - { - pEntry->MaxHTPhyMode.field.BW = BW_20; - pEntry->MaxHTPhyMode.field.ShortGI = ((pAd->CommonCfg.DesiredHtPhy.ShortGIfor20)&(HtCapability.HtCapInfo.ShortGIfor20)); - pAd->MacTab.fAnyStation20Only = TRUE; - } - - // find max fixed rate - for (ii=15; ii>=0; ii--) - { - j = ii/8; - bitmask = (1<<(ii-(j*8))); - if ( (pAd->StaCfg.DesiredHtPhyInfo.MCSSet[j]&bitmask) && (HtCapability.MCSSet[j]&bitmask)) - { - pEntry->MaxHTPhyMode.field.MCS = ii; - break; - } - if (ii==0) - break; - } - - if (pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) - { - DBGPRINT(RT_DEBUG_OFF, ("@@@ pAd->CommonCfg.RegTransmitSetting.field.MCS = %d\n", - pAd->StaCfg.DesiredTransmitSetting.field.MCS)); - if (pAd->StaCfg.DesiredTransmitSetting.field.MCS == 32) - { - // Fix MCS as HT Duplicated Mode - pEntry->MaxHTPhyMode.field.BW = 1; - pEntry->MaxHTPhyMode.field.MODE = MODE_HTMIX; - pEntry->MaxHTPhyMode.field.STBC = 0; - pEntry->MaxHTPhyMode.field.ShortGI = 0; - pEntry->MaxHTPhyMode.field.MCS = 32; - } - else if (pEntry->MaxHTPhyMode.field.MCS > pAd->StaCfg.HTPhyMode.field.MCS) - { - // STA supports fixed MCS - pEntry->MaxHTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - } - } - - pEntry->MaxHTPhyMode.field.STBC = (HtCapability.HtCapInfo.RxSTBC & (pAd->CommonCfg.DesiredHtPhy.TxSTBC)); - pEntry->MpduDensity = HtCapability.HtCapParm.MpduDensity; - pEntry->MaxRAmpduFactor = HtCapability.HtCapParm.MaxRAmpduFactor; - pEntry->MmpsMode = (UCHAR)HtCapability.HtCapInfo.MimoPs; - pEntry->AMsduSize = (UCHAR)HtCapability.HtCapInfo.AMsduSize; - pEntry->HTPhyMode.word = pEntry->MaxHTPhyMode.word; - - if (HtCapability.HtCapInfo.ShortGIfor20) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_SGI20_CAPABLE); - if (HtCapability.HtCapInfo.ShortGIfor40) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_SGI40_CAPABLE); - if (HtCapability.HtCapInfo.TxSTBC) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_TxSTBC_CAPABLE); - if (HtCapability.HtCapInfo.RxSTBC) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_RxSTBC_CAPABLE); - if (HtCapability.ExtHtCapInfo.PlusHTC) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_HTC_CAPABLE); - if (pAd->CommonCfg.bRdg && HtCapability.ExtHtCapInfo.RDGSupport) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_RDG_CAPABLE); - if (HtCapability.ExtHtCapInfo.MCSFeedback == 0x03) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_MCSFEEDBACK_CAPABLE); - - NdisMoveMemory(&pEntry->HTCapability, &HtCapability, sizeof(HT_CAPABILITY_IE)); - } -#endif // DOT11_N_SUPPORT // - - pEntry->HTPhyMode.word = pEntry->MaxHTPhyMode.word; - pEntry->CurrTxRate = pEntry->MaxSupportedRate; - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_WMM_CAPABLE); - - if (pAd->StaCfg.bAutoTxRateSwitch == TRUE) - { - PUCHAR pTable; - UCHAR TableSize = 0; - - MlmeSelectTxRateTable(pAd, pEntry, &pTable, &TableSize, &pEntry->CurrTxRateIndex); - pEntry->bAutoTxRateSwitch = TRUE; - } - else - { - pEntry->HTPhyMode.field.MODE = pAd->StaCfg.HTPhyMode.field.MODE; - pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - pEntry->bAutoTxRateSwitch = FALSE; - - RTMPUpdateLegacyTxSetting((UCHAR)pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode, pEntry); - } - pEntry->RateLen = SupportedRatesLen; - - if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - { - // If support WPA or WPA2, start STAKey hand shake, - // If failed hand shake, just tear down peer DLS - if (RTMPSendSTAKeyRequest(pAd, pAd->StaCfg.DLSEntry[i].MacAddr) != NDIS_STATUS_SUCCESS) - { - MLME_DLS_REQ_STRUCT MlmeDlsReq; - USHORT reason = REASON_QOS_CIPHER_NOT_SUPPORT; - - DlsParmFill(pAd, &MlmeDlsReq, &pAd->StaCfg.DLSEntry[i], reason); - MlmeEnqueue(pAd, DLS_STATE_MACHINE, MT2_MLME_DLS_TEAR_DOWN, sizeof(MLME_DLS_REQ_STRUCT), &MlmeDlsReq); - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - pAd->StaCfg.DLSEntry[i].Valid = FALSE; - DBGPRINT(RT_DEBUG_ERROR,("DLS - PeerDlsRspAction failed when call RTMPSendSTAKeyRequest \n")); - } - else - { - pAd->StaCfg.DLSEntry[i].Status = DLS_WAIT_KEY; - DBGPRINT(RT_DEBUG_TRACE,("DLS - waiting for STAKey handshake procedure\n")); - } - } - else - { - RTMPCancelTimer(&pAd->StaCfg.DLSEntry[i].Timer, &TimerCancelled); - pAd->StaCfg.DLSEntry[i].Status = DLS_FINISH; - DBGPRINT(RT_DEBUG_TRACE,("DLS - PeerDlsRspAction() from %02x:%02x:%02x:%02x:%02x:%02x Succeed with WEP or no security\n", SA[0], SA[1], SA[2], SA[3], SA[4], SA[5])); - } - pAd->StaCfg.DLSEntry[i].Sequence = 0; - if (HtCapabilityLen != 0) - pAd->StaCfg.DLSEntry[i].bHTCap = TRUE; - else - pAd->StaCfg.DLSEntry[i].bHTCap = FALSE; - } - else - { - // DLS setup procedure failed. - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - pAd->StaCfg.DLSEntry[i].Valid = FALSE; - RTMPCancelTimer(&pAd->StaCfg.DLSEntry[i].Timer, &TimerCancelled); - DBGPRINT(RT_DEBUG_ERROR,("DLS - PeerDlsRspAction failed with StatusCode=%d \n", StatusCode)); - } - } - } - } -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID MlmeDlsTearDownAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - UCHAR Category = CATEGORY_DLS; - UCHAR Action = ACTION_DLS_TEARDOWN; - USHORT ReasonCode = REASON_QOS_UNSPECIFY; - HEADER_802_11 DlsTearDownHdr; - PRT_802_11_DLS pDLS; - BOOLEAN TimerCancelled; - UCHAR i; - - if(!MlmeDlsReqSanity(pAd, Elem->Msg, Elem->MsgLen, &pDLS, &ReasonCode)) - return; - - DBGPRINT(RT_DEBUG_TRACE,("DLS - MlmeDlsTearDownAction() with ReasonCode=%d \n", ReasonCode)); - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_ERROR,("DLS - MlmeDlsTearDownAction() allocate memory failed \n")); - return; - } - - ActHeaderInit(pAd, &DlsTearDownHdr, pAd->CommonCfg.Bssid, pAd->CurrentAddress, pAd->CommonCfg.Bssid); - - // Build basic frame first - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &DlsTearDownHdr, - 1, &Category, - 1, &Action, - 6, &pDLS->MacAddr, - 6, pAd->CurrentAddress, - 2, &ReasonCode, - END_OF_ARGS); - - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - RTMPCancelTimer(&pDLS->Timer, &TimerCancelled); - - // Remove key in local dls table entry - for (i = 0; i < MAX_NUM_OF_INIT_DLS_ENTRY; i++) - { - if (MAC_ADDR_EQUAL(pDLS->MacAddr, pAd->StaCfg.DLSEntry[i].MacAddr)) - { - MacTableDeleteDlsEntry(pAd, pAd->StaCfg.DLSEntry[i].MacTabMatchWCID, pAd->StaCfg.DLSEntry[i].MacAddr); - } - } - - // clear peer dls table entry - for (i = MAX_NUM_OF_INIT_DLS_ENTRY; i < MAX_NUM_OF_DLS_ENTRY; i++) - { - if (MAC_ADDR_EQUAL(pDLS->MacAddr, pAd->StaCfg.DLSEntry[i].MacAddr)) - { - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - pAd->StaCfg.DLSEntry[i].Valid = FALSE; - RTMPCancelTimer(&pAd->StaCfg.DLSEntry[i].Timer, &TimerCancelled); - MacTableDeleteDlsEntry(pAd, pAd->StaCfg.DLSEntry[i].MacTabMatchWCID, pAd->StaCfg.DLSEntry[i].MacAddr); - } - } -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID PeerDlsTearDownAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR DA[MAC_ADDR_LEN], SA[MAC_ADDR_LEN]; - USHORT ReasonCode; - UINT i; - BOOLEAN TimerCancelled; - - if (!pAd->CommonCfg.bDLSCapable) - return; - - if (!INFRA_ON(pAd)) - return; - - if (!PeerDlsTearDownSanity(pAd, Elem->Msg, Elem->MsgLen, DA, SA, &ReasonCode)) - return; - - DBGPRINT(RT_DEBUG_TRACE,("DLS - PeerDlsTearDownAction() from %02x:%02x:%02x:%02x:%02x:%02x with ReasonCode=%d\n", SA[0], SA[1], SA[2], SA[3], SA[4], SA[5], ReasonCode)); - - // clear local dls table entry - for (i=0; iStaCfg.DLSEntry[i].Valid && MAC_ADDR_EQUAL(SA, pAd->StaCfg.DLSEntry[i].MacAddr)) - { - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - pAd->StaCfg.DLSEntry[i].Valid = FALSE; - RTMPCancelTimer(&pAd->StaCfg.DLSEntry[i].Timer, &TimerCancelled); - //AsicDelWcidTab(pAd, pAd->StaCfg.DLSEntry[i].MacTabMatchWCID); - //AsicRemovePairwiseKeyEntry(pAd, BSS0, pAd->StaCfg.DLSEntry[i].MacTabMatchWCID); - MacTableDeleteDlsEntry(pAd, pAd->StaCfg.DLSEntry[i].MacTabMatchWCID, pAd->StaCfg.DLSEntry[i].MacAddr); - } - } - - // clear peer dls table entry - for (i=MAX_NUM_OF_INIT_DLS_ENTRY; iStaCfg.DLSEntry[i].Valid && MAC_ADDR_EQUAL(SA, pAd->StaCfg.DLSEntry[i].MacAddr)) - { - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - pAd->StaCfg.DLSEntry[i].Valid = FALSE; - RTMPCancelTimer(&pAd->StaCfg.DLSEntry[i].Timer, &TimerCancelled); - //AsicDelWcidTab(pAd, pAd->StaCfg.DLSEntry[i].MacTabMatchWCID); - //AsicRemovePairwiseKeyEntry(pAd, BSS0, pAd->StaCfg.DLSEntry[i].MacTabMatchWCID); - MacTableDeleteDlsEntry(pAd, pAd->StaCfg.DLSEntry[i].MacTabMatchWCID, pAd->StaCfg.DLSEntry[i].MacAddr); - } - } -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID RTMPCheckDLSTimeOut( - IN PRTMP_ADAPTER pAd) -{ - ULONG i; - MLME_DLS_REQ_STRUCT MlmeDlsReq; - USHORT reason = REASON_QOS_UNSPECIFY; - - if (! pAd->CommonCfg.bDLSCapable) - return; - - if (! INFRA_ON(pAd)) - return; - - // If timeout value is equaled to zero, it means always not be timeout. - - // update local dls table entry - for (i=0; iStaCfg.DLSEntry[i].Valid) && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH) - && (pAd->StaCfg.DLSEntry[i].TimeOut != 0)) - { - pAd->StaCfg.DLSEntry[i].CountDownTimer --; - - if (pAd->StaCfg.DLSEntry[i].CountDownTimer == 0) - { - reason = REASON_QOS_REQUEST_TIMEOUT; - pAd->StaCfg.DLSEntry[i].Valid = FALSE; - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - DlsParmFill(pAd, &MlmeDlsReq, &pAd->StaCfg.DLSEntry[i], reason); - MlmeEnqueue(pAd, DLS_STATE_MACHINE, MT2_MLME_DLS_TEAR_DOWN, sizeof(MLME_DLS_REQ_STRUCT), &MlmeDlsReq); - } - } - } - - // update peer dls table entry - for (i=MAX_NUM_OF_INIT_DLS_ENTRY; iStaCfg.DLSEntry[i].Valid) && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH) - && (pAd->StaCfg.DLSEntry[i].TimeOut != 0)) - { - pAd->StaCfg.DLSEntry[i].CountDownTimer --; - - if (pAd->StaCfg.DLSEntry[i].CountDownTimer == 0) - { - reason = REASON_QOS_REQUEST_TIMEOUT; - pAd->StaCfg.DLSEntry[i].Valid = FALSE; - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - DlsParmFill(pAd, &MlmeDlsReq, &pAd->StaCfg.DLSEntry[i], reason); - MlmeEnqueue(pAd, DLS_STATE_MACHINE, MT2_MLME_DLS_TEAR_DOWN, sizeof(MLME_DLS_REQ_STRUCT), &MlmeDlsReq); - } - } - } -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -BOOLEAN RTMPRcvFrameDLSCheck( - IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHeader, - IN ULONG Len, - IN PRT28XX_RXD_STRUC pRxD) -{ - ULONG i; - BOOLEAN bFindEntry = FALSE; - BOOLEAN bSTAKeyFrame = FALSE; - PEAPOL_PACKET pEap; - PUCHAR pProto, pAddr = NULL; - PUCHAR pSTAKey = NULL; - UCHAR ZeroReplay[LEN_KEY_DESC_REPLAY]; - UCHAR Mic[16], OldMic[16]; - UCHAR digest[80]; - UCHAR DlsPTK[80]; - UCHAR temp[64]; - BOOLEAN TimerCancelled; - CIPHER_KEY PairwiseKey; - - - if (! pAd->CommonCfg.bDLSCapable) - return bSTAKeyFrame; - - if (! INFRA_ON(pAd)) - return bSTAKeyFrame; - - if (Len < LENGTH_802_11 + 6 + 2) /* LENGTH_802_11 + LLC + EAPOL protocol type */ - return bSTAKeyFrame; - - pProto = (PUCHAR)pHeader + LENGTH_802_11; - - if ((pHeader->FC.SubType & 0x08)) - pProto += 2; /* QOS Control field */ - - /* Skip 4-bytes for HTC */ - if (pHeader->FC.Order && (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED))) - { - pProto += 4; - } - - /* L2PAD bit on will pad 2 bytes at LLC */ - if (pRxD->L2PAD) - { - pProto += 2; - } - - pProto += 6; /* 0xAA 0xAA 0xAA 0x00 0x00 0x00 */ - - if ((!(pHeader->FC.SubType & 0x08)) && (!RTMPEqualMemory(EAPOL, pProto, 2))) - return bSTAKeyFrame; - - pAddr = pHeader->Addr2; - - if (RTMPEqualMemory(EAPOL, pProto, 2) && (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA)) - { - pEap = (PEAPOL_PACKET) (pProto + 2); - - DBGPRINT(RT_DEBUG_TRACE,("DLS - Sniff Len=%ld, DataLen=%d, KeyMic=%d, Install=%d, KeyAck=%d, Secure=%d, EKD_DL=%d, Error=%d, Request=%d\n", Len, - (LENGTH_802_11 + 6 + 2 + 2 + sizeof(EAPOL_PACKET) - MAX_LEN_OF_RSNIE + 16), - pEap->KeyDesc.KeyInfo.KeyMic, - pEap->KeyDesc.KeyInfo.Install, - pEap->KeyDesc.KeyInfo.KeyAck, - pEap->KeyDesc.KeyInfo.Secure, - pEap->KeyDesc.KeyInfo.EKD_DL, - pEap->KeyDesc.KeyInfo.Error, - pEap->KeyDesc.KeyInfo.Request)); - - if ((Len >= (LENGTH_802_11 + 6 + 2 + 2 + sizeof(EAPOL_PACKET) - MAX_LEN_OF_RSNIE + 16)) && pEap->KeyDesc.KeyInfo.KeyMic - && pEap->KeyDesc.KeyInfo.Install && pEap->KeyDesc.KeyInfo.KeyAck && pEap->KeyDesc.KeyInfo.Secure - && pEap->KeyDesc.KeyInfo.EKD_DL && !pEap->KeyDesc.KeyInfo.Error && !pEap->KeyDesc.KeyInfo.Request) - { - // First validate replay counter, only accept message with larger replay counter - // Let equal pass, some AP start with all zero replay counter - NdisZeroMemory(ZeroReplay, LEN_KEY_DESC_REPLAY); - if ((RTMPCompareMemory(pEap->KeyDesc.ReplayCounter, pAd->StaCfg.ReplayCounter, LEN_KEY_DESC_REPLAY) != 1) && - (RTMPCompareMemory(pEap->KeyDesc.ReplayCounter, ZeroReplay, LEN_KEY_DESC_REPLAY) != 0)) - return bSTAKeyFrame; - - //RTMPMoveMemory(pAd->StaCfg.ReplayCounter, pEap->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - RTMPMoveMemory(pAd->StaCfg.DlsReplayCounter, pEap->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - DBGPRINT(RT_DEBUG_TRACE,("DLS - Sniff replay counter (%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x) Len=%ld, KeyDataLen=%d\n", - pAd->StaCfg.ReplayCounter[0], pAd->StaCfg.ReplayCounter[1], pAd->StaCfg.ReplayCounter[2], - pAd->StaCfg.ReplayCounter[3], pAd->StaCfg.ReplayCounter[4], pAd->StaCfg.ReplayCounter[5], - pAd->StaCfg.ReplayCounter[6], pAd->StaCfg.ReplayCounter[7], Len, pEap->KeyDesc.KeyData[1])); - - // put these code segment to get the replay counter - if (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED) - return bSTAKeyFrame; - - // Check MIC value - // Save the MIC and replace with zero - // use proprietary PTK - NdisZeroMemory(temp, 64); - NdisMoveMemory(temp, "IEEE802.11 WIRELESS ACCESS POINT", 32); - WpaDerivePTK(pAd, temp, temp, pAd->CommonCfg.Bssid, temp, pAd->CurrentAddress, DlsPTK, LEN_PTK); - - NdisMoveMemory(OldMic, pEap->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); - NdisZeroMemory(pEap->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); - if (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { - // AES - HMAC_SHA1(DlsPTK, LEN_EAP_MICK, (PUCHAR) pEap, pEap->Body_Len[1] + 4, digest, SHA1_DIGEST_SIZE); - NdisMoveMemory(Mic, digest, LEN_KEY_DESC_MIC); - } - else - { - HMAC_MD5(DlsPTK, LEN_EAP_MICK, (PUCHAR) pEap, pEap->Body_Len[1] + 4, Mic, MD5_DIGEST_SIZE); - } - - if (!NdisEqualMemory(OldMic, Mic, LEN_KEY_DESC_MIC)) - { - DBGPRINT(RT_DEBUG_ERROR, ("MIC Different in Msg1 of STAKey handshake! \n")); - return bSTAKeyFrame; - } - else - DBGPRINT(RT_DEBUG_TRACE, ("MIC VALID in Msg1 of STAKey handshake! \n")); - if ((pEap->KeyDesc.KeyData[0] == 0xDD) && (pEap->KeyDesc.KeyData[2] == 0x00) && (pEap->KeyDesc.KeyData[3] == 0x0C) - && (pEap->KeyDesc.KeyData[4] == 0x43) && (pEap->KeyDesc.KeyData[5] == 0x02)) - { - pAddr = pEap->KeyDesc.KeyData + 8; // Tpe(1), Len(1), OUI(3), DataType(1), Reserved(2) - pSTAKey = pEap->KeyDesc.KeyData + 14; // Tpe(1), Len(1), OUI(3), DataType(1), Reserved(2), STAKey_Mac_Addr(6) - - DBGPRINT(RT_DEBUG_TRACE,("DLS - Receive STAKey Message-1 from %02x:%02x:%02x:%02x:%02x:%02x Len=%ld, KeyDataLen=%d\n", - pAddr[0], pAddr[1], pAddr[2], pAddr[3], pAddr[4], pAddr[5], Len, pEap->KeyDesc.KeyData[1])); - - bSTAKeyFrame = TRUE; - } - - } - else if (Len >= (LENGTH_802_11 + 6 + 2 + 2 + sizeof(EAPOL_PACKET) - MAX_LEN_OF_RSNIE)) - { - RTMPMoveMemory(pAd->StaCfg.DlsReplayCounter, pEap->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - DBGPRINT(RT_DEBUG_TRACE,("DLS - Sniff replay counter 2(%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x) Len=%ld, KeyDataLen=%d\n", - pAd->StaCfg.ReplayCounter[0], pAd->StaCfg.ReplayCounter[1], pAd->StaCfg.ReplayCounter[2], - pAd->StaCfg.ReplayCounter[3], pAd->StaCfg.ReplayCounter[4], pAd->StaCfg.ReplayCounter[5], - pAd->StaCfg.ReplayCounter[6], pAd->StaCfg.ReplayCounter[7], Len, pEap->KeyDesc.KeyData[1])); - } - } - - // If timeout value is equaled to zero, it means always not be timeout. - // update local dls table entry - for (i= 0; i < MAX_NUM_OF_INIT_DLS_ENTRY; i++) - { - if (pAd->StaCfg.DLSEntry[i].Valid && MAC_ADDR_EQUAL(pAddr, pAd->StaCfg.DLSEntry[i].MacAddr)) - { - if (bSTAKeyFrame) - { - PMAC_TABLE_ENTRY pEntry; - - // STAKey frame, add pairwise key table - pAd->StaCfg.DLSEntry[i].Status = DLS_FINISH; - RTMPCancelTimer(&pAd->StaCfg.DLSEntry[i].Timer, &TimerCancelled); - - PairwiseKey.KeyLen = LEN_TKIP_EK; - NdisMoveMemory(PairwiseKey.Key, &pSTAKey[0], LEN_TKIP_EK); - NdisMoveMemory(PairwiseKey.TxMic, &pSTAKey[16], LEN_TKIP_RXMICK); - NdisMoveMemory(PairwiseKey.RxMic, &pSTAKey[24], LEN_TKIP_TXMICK); - - //PairwiseKey.CipherAlg = pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg; - if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) - PairwiseKey.CipherAlg = CIPHER_TKIP; - else if (pAd->StaCfg.PairCipher == Ndis802_11Encryption3Enabled) - PairwiseKey.CipherAlg = CIPHER_AES; - - pEntry = DlsEntryTableLookup(pAd, pAd->StaCfg.DLSEntry[i].MacAddr, TRUE); - //AsicAddKeyEntry(pAd, (USHORT)(i + 2), BSS0, 0, &PairwiseKey, TRUE, TRUE); // reserve 0 for multicast, 1 for unicast - //AsicUpdateRxWCIDTable(pAd, (USHORT)(i + 2), pAddr); - // Add Pair-wise key to Asic -#ifdef RTMP_MAC_PCI - AsicAddPairwiseKeyEntry(pAd, - pAd->StaCfg.DLSEntry[i].MacAddr, - (UCHAR)pAd->StaCfg.DLSEntry[i].MacTabMatchWCID, - &PairwiseKey); - - RTMPAddWcidAttributeEntry(pAd, - BSS0, - 0, - PairwiseKey.CipherAlg, - pEntry); - -#endif // RTMP_MAC_PCI // - NdisMoveMemory(&pEntry->PairwiseKey, &PairwiseKey, sizeof(CIPHER_KEY)); - DBGPRINT(RT_DEBUG_TRACE,("DLS - Receive STAKey Message-1 (Peer STA MAC Address STAKey) \n")); - - RTMPSendSTAKeyHandShake(pAd, pAd->StaCfg.DLSEntry[i].MacAddr); - - DBGPRINT(RT_DEBUG_TRACE,("DLS - Finish STAKey handshake procedure (Initiator side)\n")); - } - else - { - // Data frame, update timeout value - if (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH) - { - pAd->StaCfg.DLSEntry[i].CountDownTimer = pAd->StaCfg.DLSEntry[i].TimeOut; - //AsicUpdateRxWCIDTable(pAd, (USHORT)(i + 2), pAddr); - } - } - - bFindEntry = TRUE; - } - } - - // update peer dls table entry - for (i=MAX_NUM_OF_INIT_DLS_ENTRY; iStaCfg.DLSEntry[i].Valid && MAC_ADDR_EQUAL(pAddr, pAd->StaCfg.DLSEntry[i].MacAddr)) - { - if (bSTAKeyFrame) - { - PMAC_TABLE_ENTRY pEntry = NULL; - - // STAKey frame, add pairwise key table, and send STAkey Msg-2 - pAd->StaCfg.DLSEntry[i].Status = DLS_FINISH; - RTMPCancelTimer(&pAd->StaCfg.DLSEntry[i].Timer, &TimerCancelled); - - PairwiseKey.KeyLen = LEN_TKIP_EK; - NdisMoveMemory(PairwiseKey.Key, &pSTAKey[0], LEN_TKIP_EK); - NdisMoveMemory(PairwiseKey.TxMic, &pSTAKey[16], LEN_TKIP_RXMICK); - NdisMoveMemory(PairwiseKey.RxMic, &pSTAKey[24], LEN_TKIP_TXMICK); - - //PairwiseKey.CipherAlg = pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg; - if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) - PairwiseKey.CipherAlg = CIPHER_TKIP; - else if (pAd->StaCfg.PairCipher == Ndis802_11Encryption3Enabled) - PairwiseKey.CipherAlg = CIPHER_AES; - - pEntry = DlsEntryTableLookup(pAd, pAd->StaCfg.DLSEntry[i].MacAddr, TRUE); - //AsicAddKeyEntry(pAd, (USHORT)(i + 2), BSS0, 0, &PairwiseKey, TRUE, TRUE); // reserve 0 for multicast, 1 for unicast - //AsicUpdateRxWCIDTable(pAd, (USHORT)(i + 2), pAddr); - // Add Pair-wise key to Asic -#ifdef RTMP_MAC_PCI - AsicAddPairwiseKeyEntry(pAd, - pAd->StaCfg.DLSEntry[i].MacAddr, - (UCHAR)pAd->StaCfg.DLSEntry[i].MacTabMatchWCID, - &PairwiseKey); - - RTMPAddWcidAttributeEntry(pAd, - BSS0, - 0, - PairwiseKey.CipherAlg, - pEntry); -#endif // RTMP_MAC_PCI // - NdisMoveMemory(&pEntry->PairwiseKey, &PairwiseKey, sizeof(CIPHER_KEY)); - DBGPRINT(RT_DEBUG_TRACE,("DLS - Receive STAKey Message-1 (Initiator STA MAC Address STAKey)\n")); - - // If support WPA or WPA2, start STAKey hand shake, - // If failed hand shake, just tear down peer DLS - if (RTMPSendSTAKeyHandShake(pAd, pAddr) != NDIS_STATUS_SUCCESS) - { - MLME_DLS_REQ_STRUCT MlmeDlsReq; - USHORT reason = REASON_QOS_CIPHER_NOT_SUPPORT; - - pAd->StaCfg.DLSEntry[i].Valid = FALSE; - pAd->StaCfg.DLSEntry[i].Status = DLS_NONE; - DlsParmFill(pAd, &MlmeDlsReq, &pAd->StaCfg.DLSEntry[i], reason); - MlmeEnqueue(pAd, DLS_STATE_MACHINE, MT2_MLME_DLS_TEAR_DOWN, sizeof(MLME_DLS_REQ_STRUCT), &MlmeDlsReq); - } - else - { - DBGPRINT(RT_DEBUG_TRACE,("DLS - Finish STAKey handshake procedure (Peer side)\n")); - } - } - else - { - // Data frame, update timeout value - if (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH) - { - pAd->StaCfg.DLSEntry[i].CountDownTimer = pAd->StaCfg.DLSEntry[i].TimeOut; - } - } - - bFindEntry = TRUE; - } - } - - - return bSTAKeyFrame; -} - -/* - ======================================================================== - - Routine Description: - Check if the frame can be sent through DLS direct link interface - - Arguments: - pAd Pointer to adapter - - Return Value: - DLS entry index - - Note: - - ======================================================================== -*/ -INT RTMPCheckDLSFrame( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA) -{ - INT rval = -1; - INT i; - - if (!pAd->CommonCfg.bDLSCapable) - return rval; - - if (!INFRA_ON(pAd)) - return rval; - - do{ - // check local dls table entry - for (i=0; iStaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH) && - MAC_ADDR_EQUAL(pDA, pAd->StaCfg.DLSEntry[i].MacAddr)) - { - rval = i; - break; - } - } - - // check peer dls table entry - for (i=MAX_NUM_OF_INIT_DLS_ENTRY; iStaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH) && - MAC_ADDR_EQUAL(pDA, pAd->StaCfg.DLSEntry[i].MacAddr)) - { - rval = i; - break; - } - } - } while (FALSE); - - return rval; -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID RTMPSendDLSTearDownFrame( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA) -{ - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - HEADER_802_11 DlsTearDownHdr; - ULONG FrameLen = 0; - USHORT Reason = REASON_QOS_QSTA_LEAVING_QBSS; - UCHAR Category = CATEGORY_DLS; - UCHAR Action = ACTION_DLS_TEARDOWN; - UCHAR i = 0; - - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) - return; - - DBGPRINT(RT_DEBUG_TRACE, ("Send DLS TearDown Frame \n")); - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_ERROR,("ASSOC - RTMPSendDLSTearDownFrame() allocate memory failed \n")); - return; - } - - ActHeaderInit(pAd, &DlsTearDownHdr, pAd->CommonCfg.Bssid, pAd->CurrentAddress, pAd->CommonCfg.Bssid); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &DlsTearDownHdr, - 1, &Category, - 1, &Action, - 6, pDA, - 6, pAd->CurrentAddress, - 2, &Reason, - END_OF_ARGS); - - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - - // Remove key in local dls table entry - for (i = 0; i < MAX_NUM_OF_INIT_DLS_ENTRY; i++) - { - if (pAd->StaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH) - && MAC_ADDR_EQUAL(pDA, pAd->StaCfg.DLSEntry[i].MacAddr)) - { - MacTableDeleteDlsEntry(pAd, pAd->StaCfg.DLSEntry[i].MacTabMatchWCID, pAd->StaCfg.DLSEntry[i].MacAddr); - } - } - - // Remove key in peer dls table entry - for (i=MAX_NUM_OF_INIT_DLS_ENTRY; iStaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH) - && MAC_ADDR_EQUAL(pDA, pAd->StaCfg.DLSEntry[i].MacAddr)) - { - MacTableDeleteDlsEntry(pAd, pAd->StaCfg.DLSEntry[i].MacTabMatchWCID, pAd->StaCfg.DLSEntry[i].MacAddr); - } - } - - DBGPRINT(RT_DEBUG_TRACE, ("Send DLS TearDown Frame and remove key in (i=%d) \n", i)); -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -NDIS_STATUS RTMPSendSTAKeyRequest( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA) -{ - UCHAR Header802_3[14]; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - EAPOL_PACKET Packet; - UCHAR Mic[16]; - UCHAR digest[80]; - PUCHAR pOutBuffer = NULL; - PNDIS_PACKET pNdisPacket; - UCHAR temp[64]; - UCHAR DlsPTK[80]; - - DBGPRINT(RT_DEBUG_TRACE,("DLS - RTMPSendSTAKeyRequest() to %02x:%02x:%02x:%02x:%02x:%02x\n", pDA[0], pDA[1], pDA[2], pDA[3], pDA[4], pDA[5])); - - pAd->Sequence ++; - MAKE_802_3_HEADER(Header802_3, pAd->CommonCfg.Bssid, pAd->CurrentAddress, EAPOL); - - // Zero message body - NdisZeroMemory(&Packet, sizeof(Packet)); - Packet.ProVer = EAPOL_VER; - Packet.ProType = EAPOLKey; - Packet.Body_Len[1] = sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE + 6 + MAC_ADDR_LEN; // data field contain KDE andPeer MAC address - - // STAKey Message is as EAPOL-Key(1,1,0,0,G/0,0,0, MIC, 0,Peer MAC KDE) - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) - { - Packet.KeyDesc.Type = WPA1_KEY_DESC; - } - else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - Packet.KeyDesc.Type = WPA2_KEY_DESC; - } - - // Key descriptor version - Packet.KeyDesc.KeyInfo.KeyDescVer = - (((pAd->StaCfg.PairCipher == Ndis802_11Encryption3Enabled) || (pAd->StaCfg.GroupCipher == Ndis802_11Encryption3Enabled)) ? (DESC_TYPE_AES) : (DESC_TYPE_TKIP)); - - Packet.KeyDesc.KeyInfo.KeyMic = 1; - Packet.KeyDesc.KeyInfo.Secure = 1; - Packet.KeyDesc.KeyInfo.Request = 1; - - Packet.KeyDesc.KeyDataLen[1] = 12; - - // use our own OUI to distinguish proprietary with standard. - Packet.KeyDesc.KeyData[0] = 0xDD; - Packet.KeyDesc.KeyData[1] = 0x0A; - Packet.KeyDesc.KeyData[2] = 0x00; - Packet.KeyDesc.KeyData[3] = 0x0C; - Packet.KeyDesc.KeyData[4] = 0x43; - Packet.KeyDesc.KeyData[5] = 0x03; - NdisMoveMemory(&Packet.KeyDesc.KeyData[6], pDA, MAC_ADDR_LEN); - - NdisMoveMemory(Packet.KeyDesc.ReplayCounter, pAd->StaCfg.DlsReplayCounter, LEN_KEY_DESC_REPLAY); - - // Allocate buffer for transmitting message - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); - if (NStatus != NDIS_STATUS_SUCCESS) - return NStatus; - - // Prepare EAPOL frame for MIC calculation - // Be careful, only EAPOL frame is counted for MIC calculation - MakeOutgoingFrame(pOutBuffer, &FrameLen, - Packet.Body_Len[1] + 4, &Packet, - END_OF_ARGS); - - // use proprietary PTK - NdisZeroMemory(temp, 64); - NdisMoveMemory(temp, "IEEE802.11 WIRELESS ACCESS POINT", 32); - WpaDerivePTK(pAd, temp, temp, pAd->CommonCfg.Bssid, temp, pAd->CurrentAddress, DlsPTK, LEN_PTK); - - // calculate MIC - if (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { - // AES - NdisZeroMemory(digest, sizeof(digest)); - HMAC_SHA1(DlsPTK, LEN_EAP_MICK, pOutBuffer, FrameLen, digest, SHA1_DIGEST_SIZE); - NdisMoveMemory(Packet.KeyDesc.KeyMic, digest, LEN_KEY_DESC_MIC); - } - else - { - NdisZeroMemory(Mic, sizeof(Mic)); - HMAC_MD5(DlsPTK, LEN_EAP_MICK, pOutBuffer, FrameLen, Mic, MD5_DIGEST_SIZE); - NdisMoveMemory(Packet.KeyDesc.KeyMic, Mic, LEN_KEY_DESC_MIC); - } - - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(Header802_3), Header802_3, - Packet.Body_Len[1] + 4, &Packet, - END_OF_ARGS); - - NStatus = RTMPAllocateNdisPacket(pAd, &pNdisPacket, NULL, 0, pOutBuffer, FrameLen); - if (NStatus == NDIS_STATUS_SUCCESS) - { - RTMP_SET_PACKET_WCID(pNdisPacket, BSSID_WCID); - STASendPacket(pAd, pNdisPacket); - RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); - } - - MlmeFreeMemory(pAd, pOutBuffer); - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSendSTAKeyRequest- Send STAKey request (NStatus=%x, FrameLen=%ld)\n", NStatus, FrameLen)); - - return NStatus; -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -NDIS_STATUS RTMPSendSTAKeyHandShake( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA) -{ - UCHAR Header802_3[14]; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - EAPOL_PACKET Packet; - UCHAR Mic[16]; - UCHAR digest[80]; - PUCHAR pOutBuffer = NULL; - PNDIS_PACKET pNdisPacket; - UCHAR temp[64]; - UCHAR DlsPTK[80]; // Due to dirver can not get PTK, use proprietary PTK - - DBGPRINT(RT_DEBUG_TRACE,("DLS - RTMPSendSTAKeyHandShake() to %02x:%02x:%02x:%02x:%02x:%02x\n", pDA[0], pDA[1], pDA[2], pDA[3], pDA[4], pDA[5])); - - pAd->Sequence ++; - MAKE_802_3_HEADER(Header802_3, pAd->CommonCfg.Bssid, pAd->CurrentAddress, EAPOL); - - // Zero message body - NdisZeroMemory(&Packet, sizeof(Packet)); - Packet.ProVer = EAPOL_VER; - Packet.ProType = EAPOLKey; - Packet.Body_Len[1] = sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE + 6 + MAC_ADDR_LEN; // data field contain KDE and Peer MAC address - - // STAKey Message is as EAPOL-Key(1,1,0,0,G/0,0,0, MIC, 0,Peer MAC KDE) - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) - { - Packet.KeyDesc.Type = WPA1_KEY_DESC; - } - else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - Packet.KeyDesc.Type = WPA2_KEY_DESC; - } - - // Key descriptor version - Packet.KeyDesc.KeyInfo.KeyDescVer = - (((pAd->StaCfg.PairCipher == Ndis802_11Encryption3Enabled) || (pAd->StaCfg.GroupCipher == Ndis802_11Encryption3Enabled)) ? (DESC_TYPE_AES) : (DESC_TYPE_TKIP)); - - Packet.KeyDesc.KeyInfo.KeyMic = 1; - Packet.KeyDesc.KeyInfo.Secure = 1; - - Packet.KeyDesc.KeyDataLen[1] = 12; - - // use our own OUI to distinguish proprietary with standard. - Packet.KeyDesc.KeyData[0] = 0xDD; - Packet.KeyDesc.KeyData[1] = 0x0A; - Packet.KeyDesc.KeyData[2] = 0x00; - Packet.KeyDesc.KeyData[3] = 0x0C; - Packet.KeyDesc.KeyData[4] = 0x43; - Packet.KeyDesc.KeyData[5] = 0x03; - NdisMoveMemory(&Packet.KeyDesc.KeyData[6], pDA, MAC_ADDR_LEN); - - NdisMoveMemory(Packet.KeyDesc.ReplayCounter, pAd->StaCfg.DlsReplayCounter, LEN_KEY_DESC_REPLAY); - - // Allocate buffer for transmitting message - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); - if (NStatus != NDIS_STATUS_SUCCESS) - return NStatus; - - // Prepare EAPOL frame for MIC calculation - // Be careful, only EAPOL frame is counted for MIC calculation - MakeOutgoingFrame(pOutBuffer, &FrameLen, - Packet.Body_Len[1] + 4, &Packet, - END_OF_ARGS); - - // use proprietary PTK - NdisZeroMemory(temp, 64); - NdisMoveMemory(temp, "IEEE802.11 WIRELESS ACCESS POINT", 32); - WpaDerivePTK(pAd, temp, temp, pAd->CommonCfg.Bssid, temp, pAd->CurrentAddress, DlsPTK, LEN_PTK); - - // calculate MIC - if (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { - // AES - NdisZeroMemory(digest, sizeof(digest)); - HMAC_SHA1(DlsPTK, LEN_EAP_MICK, pOutBuffer, FrameLen, digest, SHA1_DIGEST_SIZE); - NdisMoveMemory(Packet.KeyDesc.KeyMic, digest, LEN_KEY_DESC_MIC); - } - else - { - NdisZeroMemory(Mic, sizeof(Mic)); - HMAC_MD5(DlsPTK, LEN_EAP_MICK, pOutBuffer, FrameLen, Mic, MD5_DIGEST_SIZE); - NdisMoveMemory(Packet.KeyDesc.KeyMic, Mic, LEN_KEY_DESC_MIC); - } - - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(Header802_3), Header802_3, - Packet.Body_Len[1] + 4, &Packet, - END_OF_ARGS); - - NStatus = RTMPAllocateNdisPacket(pAd, &pNdisPacket, NULL, 0, pOutBuffer, FrameLen); - if (NStatus == NDIS_STATUS_SUCCESS) - { - RTMP_SET_PACKET_WCID(pNdisPacket, BSSID_WCID); - STASendPacket(pAd, pNdisPacket); - RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); - } - - MlmeFreeMemory(pAd, pOutBuffer); - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSendSTAKeyHandShake- Send STAKey Message-2 (NStatus=%x, FrameLen=%ld)\n", NStatus, FrameLen)); - - return NStatus; -} - -VOID DlsTimeoutAction( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - MLME_DLS_REQ_STRUCT MlmeDlsReq; - USHORT reason; - PRT_802_11_DLS pDLS = (PRT_802_11_DLS)FunctionContext; - PRTMP_ADAPTER pAd = pDLS->pAd; - - DBGPRINT(RT_DEBUG_TRACE, ("DlsTimeout - Tear down DLS links (%02x:%02x:%02x:%02x:%02x:%02x)\n", - pDLS->MacAddr[0], pDLS->MacAddr[1], pDLS->MacAddr[2], pDLS->MacAddr[3], pDLS->MacAddr[4], pDLS->MacAddr[5])); - - if ((pDLS) && (pDLS->Valid)) - { - reason = REASON_QOS_REQUEST_TIMEOUT; - pDLS->Valid = FALSE; - pDLS->Status = DLS_NONE; - DlsParmFill(pAd, &MlmeDlsReq, pDLS, reason); - MlmeEnqueue(pAd, DLS_STATE_MACHINE, MT2_MLME_DLS_TEAR_DOWN, sizeof(MLME_DLS_REQ_STRUCT), &MlmeDlsReq); - RTMP_MLME_HANDLER(pAd); - } -} - -/* -================================================================ -Description : because DLS and CLI share the same WCID table in ASIC. -Mesh entry also insert to pAd->MacTab.content[]. Such is marked as ValidAsDls = TRUE. -Also fills the pairwise key. -Because front MAX_AID_BA entries have direct mapping to BAEntry, which is only used as CLI. So we insert Dls -from index MAX_AID_BA. -================================================================ -*/ -MAC_TABLE_ENTRY *MacTableInsertDlsEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UINT DlsEntryIdx) -{ - PMAC_TABLE_ENTRY pEntry = NULL; - - DBGPRINT(RT_DEBUG_TRACE, ("====> MacTableInsertDlsEntry\n")); - // if FULL, return - if (pAd->MacTab.Size >= MAX_LEN_OF_MAC_TABLE) - return NULL; - - do - { - if((pEntry = DlsEntryTableLookup(pAd, pAddr, TRUE)) != NULL) - break; - - // allocate one MAC entry - pEntry = MacTableInsertEntry(pAd, pAddr, DlsEntryIdx + MIN_NET_DEVICE_FOR_DLS, TRUE); - if (pEntry) - { - pAd->StaCfg.DLSEntry[DlsEntryIdx].MacTabMatchWCID = pEntry->Aid; - pEntry->MatchDlsEntryIdx = DlsEntryIdx; - pEntry->AuthMode = pAd->StaCfg.AuthMode; - pEntry->WepStatus = pAd->StaCfg.WepStatus; - pEntry->PortSecured = WPA_802_1X_PORT_SECURED; - - DBGPRINT(RT_DEBUG_TRACE, ("MacTableInsertDlsEntry - allocate entry #%d, Total= %d\n",pEntry->Aid, pAd->MacTab.Size)); - - // If legacy WEP is used, set pair-wise cipherAlg into WCID attribute table for this entry - if ((pEntry->ValidAsDls) && (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled)) - { - UCHAR KeyIdx = 0; - UCHAR CipherAlg = 0; - - KeyIdx = pAd->StaCfg.DefaultKeyId; - - CipherAlg = pAd->SharedKey[BSS0][KeyIdx].CipherAlg; - - RTMPAddWcidAttributeEntry(pAd, - BSS0, - pAd->StaCfg.DefaultKeyId, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg, - pEntry); - } - - break; - } - } while(FALSE); - - DBGPRINT(RT_DEBUG_TRACE, ("<==== MacTableInsertDlsEntry\n")); - - return pEntry; -} - - -/* - ========================================================================== - Description: - Delete all Mesh Entry in pAd->MacTab - ========================================================================== - */ -BOOLEAN MacTableDeleteDlsEntry( - IN PRTMP_ADAPTER pAd, - IN USHORT wcid, - IN PUCHAR pAddr) -{ - DBGPRINT(RT_DEBUG_TRACE, ("====> MacTableDeleteDlsEntry\n")); - - if (!VALID_WCID(wcid)) - return FALSE; - - MacTableDeleteEntry(pAd, wcid, pAddr); - - DBGPRINT(RT_DEBUG_TRACE, ("<==== MacTableDeleteDlsEntry\n")); - - return TRUE; -} - -MAC_TABLE_ENTRY *DlsEntryTableLookup( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN BOOLEAN bResetIdelCount) -{ - ULONG HashIdx; - MAC_TABLE_ENTRY *pEntry = NULL; - - RTMP_SEM_LOCK(&pAd->MacTabLock); - HashIdx = MAC_ADDR_HASH_INDEX(pAddr); - pEntry = pAd->MacTab.Hash[HashIdx]; - - while (pEntry) - { - if ((pEntry->ValidAsDls == TRUE) - && MAC_ADDR_EQUAL(pEntry->Addr, pAddr)) - { - if(bResetIdelCount) - pEntry->NoDataIdleCount = 0; - break; - } - else - pEntry = pEntry->pNext; - } - - RTMP_SEM_UNLOCK(&pAd->MacTabLock); - return pEntry; -} - -MAC_TABLE_ENTRY *DlsEntryTableLookupByWcid( - IN PRTMP_ADAPTER pAd, - IN UCHAR wcid, - IN PUCHAR pAddr, - IN BOOLEAN bResetIdelCount) -{ - ULONG DLsIndex; - PMAC_TABLE_ENTRY pCurEntry = NULL; - PMAC_TABLE_ENTRY pEntry = NULL; - - if (!VALID_WCID(wcid)) - return NULL; - - RTMP_SEM_LOCK(&pAd->MacTabLock); - - do - { - pCurEntry = &pAd->MacTab.Content[wcid]; - - DLsIndex = 0xff; - if ((pCurEntry) && (pCurEntry->ValidAsDls== TRUE)) - { - DLsIndex = pCurEntry->MatchDlsEntryIdx; - } - - if (DLsIndex == 0xff) - break; - - if (MAC_ADDR_EQUAL(pCurEntry->Addr, pAddr)) - { - if(bResetIdelCount) - pCurEntry->NoDataIdleCount = 0; - pEntry = pCurEntry; - break; - } - } while(FALSE); - - RTMP_SEM_UNLOCK(&pAd->MacTabLock); - - return pEntry; -} - -INT Set_DlsEntryInfo_Display_Proc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) -{ - INT i; - - DBGPRINT(RT_DEBUG_OFF, ("\n%-19s%-8s\n", "MAC", "TIMEOUT\n")); - for (i=0; iStaCfg.DLSEntry[i].Valid) && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH)) - { - PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[pAd->StaCfg.DLSEntry[i].MacTabMatchWCID]; - - DBGPRINT(RT_DEBUG_OFF, ("%02x:%02x:%02x:%02x:%02x:%02x ", - pAd->StaCfg.DLSEntry[i].MacAddr[0], pAd->StaCfg.DLSEntry[i].MacAddr[1], pAd->StaCfg.DLSEntry[i].MacAddr[2], - pAd->StaCfg.DLSEntry[i].MacAddr[3], pAd->StaCfg.DLSEntry[i].MacAddr[4], pAd->StaCfg.DLSEntry[i].MacAddr[5])); - DBGPRINT(RT_DEBUG_OFF, ("%-8d\n", pAd->StaCfg.DLSEntry[i].TimeOut)); - - DBGPRINT(RT_DEBUG_OFF, ("\n")); - DBGPRINT(RT_DEBUG_OFF, ("\n%-19s%-4s%-4s%-4s%-4s%-7s%-7s%-7s","MAC", "AID", "BSS", "PSM", "WMM", "RSSI0", "RSSI1", "RSSI2")); -#ifdef DOT11_N_SUPPORT - DBGPRINT(RT_DEBUG_OFF, ("%-8s%-10s%-6s%-6s%-6s%-6s", "MIMOPS", "PhMd", "BW", "MCS", "SGI", "STBC")); -#endif // DOT11_N_SUPPORT // - DBGPRINT(RT_DEBUG_OFF, ("\n%02X:%02X:%02X:%02X:%02X:%02X ", - pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2], - pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5])); - DBGPRINT(RT_DEBUG_OFF, ("%-4d", (int)pEntry->Aid)); - DBGPRINT(RT_DEBUG_OFF, ("%-4d", (int)pEntry->apidx)); - DBGPRINT(RT_DEBUG_OFF, ("%-4d", (int)pEntry->PsMode)); - DBGPRINT(RT_DEBUG_OFF, ("%-4d", (int)CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_WMM_CAPABLE))); - DBGPRINT(RT_DEBUG_OFF, ("%-7d", pEntry->RssiSample.AvgRssi0)); - DBGPRINT(RT_DEBUG_OFF, ("%-7d", pEntry->RssiSample.AvgRssi1)); - DBGPRINT(RT_DEBUG_OFF, ("%-7d", pEntry->RssiSample.AvgRssi2)); -#ifdef DOT11_N_SUPPORT - DBGPRINT(RT_DEBUG_OFF, ("%-8d", (int)pEntry->MmpsMode)); - DBGPRINT(RT_DEBUG_OFF, ("%-10s", GetPhyMode(pEntry->HTPhyMode.field.MODE))); - DBGPRINT(RT_DEBUG_OFF, ("%-6s", GetBW(pEntry->HTPhyMode.field.BW))); - DBGPRINT(RT_DEBUG_OFF, ("%-6d", pEntry->HTPhyMode.field.MCS)); - DBGPRINT(RT_DEBUG_OFF, ("%-6d", pEntry->HTPhyMode.field.ShortGI)); - DBGPRINT(RT_DEBUG_OFF, ("%-6d", pEntry->HTPhyMode.field.STBC)); -#endif // DOT11_N_SUPPORT // - DBGPRINT(RT_DEBUG_OFF, ("%-10d, %d, %d%%\n", pEntry->DebugFIFOCount, pEntry->DebugTxCount, - (pEntry->DebugTxCount) ? ((pEntry->DebugTxCount-pEntry->DebugFIFOCount)*100/pEntry->DebugTxCount) : 0)); - DBGPRINT(RT_DEBUG_OFF, ("\n")); - - } - } - - return TRUE; -} - -INT Set_DlsAddEntry_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR mac[MAC_ADDR_LEN]; - USHORT Timeout; - PSTRING token; - STRING sepValue[] = ":", DASH = '-'; - INT i; - RT_802_11_DLS Dls; - - if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and timeout value in decimal format. - return FALSE; - - token = strchr(arg, DASH); - if ((token != NULL) && (strlen(token)>1)) - { - Timeout = (USHORT) simple_strtol((token+1), 0, 10); - - *token = '\0'; - for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++) - { - if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1)))) - return FALSE; - AtoH(token, (&mac[i]), 1); - } - if(i != 6) - return FALSE; - - DBGPRINT(RT_DEBUG_OFF, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%d", mac[0], mac[1], - mac[2], mac[3], mac[4], mac[5], (int)Timeout)); - - NdisZeroMemory(&Dls, sizeof(RT_802_11_DLS)); - Dls.TimeOut = Timeout; - COPY_MAC_ADDR(Dls.MacAddr, mac); - Dls.Valid = 1; - - MlmeEnqueue(pAd, - MLME_CNTL_STATE_MACHINE, - RT_OID_802_11_SET_DLS_PARAM, - sizeof(RT_802_11_DLS), - &Dls); - - return TRUE; - } - - return FALSE; - -} - -INT Set_DlsTearDownEntry_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR macAddr[MAC_ADDR_LEN]; - PSTRING value; - INT i; - RT_802_11_DLS Dls; - - if(strlen(arg) != 17) //Mac address acceptable format 01:02:03:04:05:06 length 17 - return FALSE; - - for (i=0, value = rstrtok(arg,":"); value; value = rstrtok(NULL,":")) - { - if((strlen(value) != 2) || (!isxdigit(*value)) || (!isxdigit(*(value+1))) ) - return FALSE; //Invalid - - AtoH(value, &macAddr[i++], 2); - } - - DBGPRINT(RT_DEBUG_OFF, ("\n%02x:%02x:%02x:%02x:%02x:%02x", macAddr[0], macAddr[1], - macAddr[2], macAddr[3], macAddr[4], macAddr[5])); - - NdisZeroMemory(&Dls, sizeof(RT_802_11_DLS)); - COPY_MAC_ADDR(Dls.MacAddr, macAddr); - Dls.Valid = 0; - - MlmeEnqueue(pAd, - MLME_CNTL_STATE_MACHINE, - RT_OID_802_11_SET_DLS_PARAM, - sizeof(RT_802_11_DLS), - &Dls); - - return TRUE; -} diff --git a/drivers/staging/rt3090/sta/rtmp_ckipmic.c b/drivers/staging/rt3090/sta/rtmp_ckipmic.c deleted file mode 100644 index 5f6dbd7cf057..000000000000 --- a/drivers/staging/rt3090/sta/rtmp_ckipmic.c +++ /dev/null @@ -1,579 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rtmp_ckipmic.c - - Abstract: - Data path subroutines - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#include "../rt_config.h" -#include "../rtmp_ckipmic.h" - - -#define MIC_ACCUM(v) pContext->accum += (ULONGLONG)v * RTMPMicGetCoefficient(pContext) -#define GB(p,i,s) ( ((ULONG) *((UCHAR*)(p)+i) ) << (s) ) -#define GETBIG32(p) GB(p,0,24)|GB(p,1,16)|GB(p,2,8)|GB(p,3,0) - -/*****************************/ -/******** SBOX Table *********/ -/*****************************/ - -UCHAR SboxTable[256] = -{ - 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, - 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, - 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, - 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, - 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, - 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, - 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, - 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, - 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, - 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, - 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, - 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, - 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, - 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, - 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, - 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, - 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, - 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, - 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, - 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, - 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, - 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, - 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, - 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, - 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, - 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, - 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, - 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, - 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, - 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, - 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, - 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 -}; - -/*===========================================================================*/ -/*=================== CKIP KEY PERMUTATION ==================================*/ -/*===========================================================================*/ - -/* 2-byte by 2-byte subset of the full AES table */ -static const USHORT Sbox[256] = -{ - 0xC6A5,0xF884,0xEE99,0xF68D,0xFF0D,0xD6BD,0xDEB1,0x9154, - 0x6050,0x0203,0xCEA9,0x567D,0xE719,0xB562,0x4DE6,0xEC9A, - 0x8F45,0x1F9D,0x8940,0xFA87,0xEF15,0xB2EB,0x8EC9,0xFB0B, - 0x41EC,0xB367,0x5FFD,0x45EA,0x23BF,0x53F7,0xE496,0x9B5B, - 0x75C2,0xE11C,0x3DAE,0x4C6A,0x6C5A,0x7E41,0xF502,0x834F, - 0x685C,0x51F4,0xD134,0xF908,0xE293,0xAB73,0x6253,0x2A3F, - 0x080C,0x9552,0x4665,0x9D5E,0x3028,0x37A1,0x0A0F,0x2FB5, - 0x0E09,0x2436,0x1B9B,0xDF3D,0xCD26,0x4E69,0x7FCD,0xEA9F, - 0x121B,0x1D9E,0x5874,0x342E,0x362D,0xDCB2,0xB4EE,0x5BFB, - 0xA4F6,0x764D,0xB761,0x7DCE,0x527B,0xDD3E,0x5E71,0x1397, - 0xA6F5,0xB968,0x0000,0xC12C,0x4060,0xE31F,0x79C8,0xB6ED, - 0xD4BE,0x8D46,0x67D9,0x724B,0x94DE,0x98D4,0xB0E8,0x854A, - 0xBB6B,0xC52A,0x4FE5,0xED16,0x86C5,0x9AD7,0x6655,0x1194, - 0x8ACF,0xE910,0x0406,0xFE81,0xA0F0,0x7844,0x25BA,0x4BE3, - 0xA2F3,0x5DFE,0x80C0,0x058A,0x3FAD,0x21BC,0x7048,0xF104, - 0x63DF,0x77C1,0xAF75,0x4263,0x2030,0xE51A,0xFD0E,0xBF6D, - 0x814C,0x1814,0x2635,0xC32F,0xBEE1,0x35A2,0x88CC,0x2E39, - 0x9357,0x55F2,0xFC82,0x7A47,0xC8AC,0xBAE7,0x322B,0xE695, - 0xC0A0,0x1998,0x9ED1,0xA37F,0x4466,0x547E,0x3BAB,0x0B83, - 0x8CCA,0xC729,0x6BD3,0x283C,0xA779,0xBCE2,0x161D,0xAD76, - 0xDB3B,0x6456,0x744E,0x141E,0x92DB,0x0C0A,0x486C,0xB8E4, - 0x9F5D,0xBD6E,0x43EF,0xC4A6,0x39A8,0x31A4,0xD337,0xF28B, - 0xD532,0x8B43,0x6E59,0xDAB7,0x018C,0xB164,0x9CD2,0x49E0, - 0xD8B4,0xACFA,0xF307,0xCF25,0xCAAF,0xF48E,0x47E9,0x1018, - 0x6FD5,0xF088,0x4A6F,0x5C72,0x3824,0x57F1,0x73C7,0x9751, - 0xCB23,0xA17C,0xE89C,0x3E21,0x96DD,0x61DC,0x0D86,0x0F85, - 0xE090,0x7C42,0x71C4,0xCCAA,0x90D8,0x0605,0xF701,0x1C12, - 0xC2A3,0x6A5F,0xAEF9,0x69D0,0x1791,0x9958,0x3A27,0x27B9, - 0xD938,0xEB13,0x2BB3,0x2233,0xD2BB,0xA970,0x0789,0x33A7, - 0x2DB6,0x3C22,0x1592,0xC920,0x8749,0xAAFF,0x5078,0xA57A, - 0x038F,0x59F8,0x0980,0x1A17,0x65DA,0xD731,0x84C6,0xD0B8, - 0x82C3,0x29B0,0x5A77,0x1E11,0x7BCB,0xA8FC,0x6DD6,0x2C3A - }; - -#define Lo8(v16) ((v16) & 0xFF) -#define Hi8(v16) (((v16) >> 8) & 0xFF) -#define u16Swap(i) ( (((i) >> 8) & 0xFF) | (((i) << 8) & 0xFF00) ) -#define _S_(i) (Sbox[Lo8(i)] ^ u16Swap(Sbox[Hi8(i)])) - -#define rotLeft_1(x) ((((x) << 1) | ((x) >> 15)) & 0xFFFF) -VOID CKIP_key_permute - ( - OUT UCHAR *PK, /* output permuted key */ - IN UCHAR *CK, /* input CKIP key */ - IN UCHAR toDsFromDs, /* input toDs/FromDs bits */ - IN UCHAR *piv /* input pointer to IV */ - ) -{ - int i; - USHORT H[2], tmp; /* H=32-bits of per-packet hash value */ - USHORT L[8], R[8]; /* L=u16 array of CK, R=u16 array of PK */ - - /* build L from input key */ - memset(L, 0, sizeof(L)); - for (i=0; i<16; i++) { - L[i>>1] |= ( ((USHORT)(CK[i])) << ( i & 1 ? 8 : 0) ); - } - - H[0] = (((USHORT)piv[0]) << 8) + piv[1]; - H[1] = ( ((USHORT)toDsFromDs) << 8) | piv[2]; - - for (i=0; i<8; i++) { - H[0] ^= L[i]; /* 16-bits of key material */ - tmp = _S_(H[0]); /* 16x16 permutation */ - H[0] = tmp ^ H[1]; /* set up for next round */ - H[1] = tmp; - R[i] = H[0]; /* store into key array */ - } - - /* sweep in the other direction */ - tmp=L[0]; - for (i=7; i>0; i--) { - R[i] = tmp = rotLeft_1(tmp) + R[i]; - } - - /* IV of the permuted key is unchanged */ - PK[0] = piv[0]; - PK[1] = piv[1]; - PK[2] = piv[2]; - - /* key portion of the permuted key is changed */ - for (i=3; i<16; i++) { - PK[i] = (UCHAR) (R[i>>1] >> (i & 1 ? 8 : 0)); - } -} - -/* prepare for calculation of a new mic */ -VOID RTMPCkipMicInit( - IN PMIC_CONTEXT pContext, - IN PUCHAR CK) -{ - /* prepare for new mic calculation */ - NdisMoveMemory(pContext->CK, CK, sizeof(pContext->CK)); - pContext->accum = 0; - pContext->position = 0; -} - -/* add some bytes to the mic calculation */ -VOID RTMPMicUpdate( - IN PMIC_CONTEXT pContext, - IN PUCHAR pOctets, - IN INT len) -{ - INT byte_position; - ULONG val; - - byte_position = (pContext->position & 3); - while (len > 0) { - /* build a 32-bit word for MIC multiply accumulate */ - do { - if (len == 0) return; - pContext->part[byte_position++] = *pOctets++; - pContext->position++; - len--; - } while (byte_position < 4); - /* have a full 32-bit word to process */ - val = GETBIG32(&pContext->part[0]); - MIC_ACCUM(val); - byte_position = 0; - } -} - -ULONG RTMPMicGetCoefficient( - IN PMIC_CONTEXT pContext) -{ - UCHAR aes_counter[16]; - INT coeff_position; - UCHAR *p; - - coeff_position = (pContext->position - 1) >> 2; - if ( (coeff_position & 3) == 0) { - /* fetching the first coefficient -- get new 16-byte aes counter output */ - u32 counter = (coeff_position >> 2); - - /* new counter value */ - memset(&aes_counter[0], 0, sizeof(aes_counter)); - aes_counter[15] = (UINT8)(counter >> 0); - aes_counter[14] = (UINT8)(counter >> 8); - aes_counter[13] = (UINT8)(counter >> 16); - aes_counter[12] = (UINT8)(counter >> 24); - - RTMPAesEncrypt(&pContext->CK[0], &aes_counter[0], pContext->coefficient); - } - p = &(pContext->coefficient[ (coeff_position & 3) << 2 ]); - return GETBIG32(p); -} - -/****************************************/ -/* aes128k128d() */ -/* Performs a 128 bit AES encrypt with */ -/* 128 bit data. */ -/****************************************/ -VOID xor_128( - IN PUCHAR a, - IN PUCHAR b, - OUT PUCHAR out) -{ - INT i; - - for (i=0;i<16; i++) - { - out[i] = a[i] ^ b[i]; - } -} - -UCHAR RTMPCkipSbox( - IN UCHAR a) -{ - return SboxTable[(int)a]; -} - -VOID xor_32( - IN PUCHAR a, - IN PUCHAR b, - OUT PUCHAR out) -{ - INT i; - - for (i=0;i<4; i++) - { - out[i] = a[i] ^ b[i]; - } -} - -VOID next_key( - IN PUCHAR key, - IN INT round) -{ - UCHAR rcon; - UCHAR sbox_key[4]; - UCHAR rcon_table[12] = - { - 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, - 0x1b, 0x36, 0x36, 0x36 - }; - - sbox_key[0] = RTMPCkipSbox(key[13]); - sbox_key[1] = RTMPCkipSbox(key[14]); - sbox_key[2] = RTMPCkipSbox(key[15]); - sbox_key[3] = RTMPCkipSbox(key[12]); - - rcon = rcon_table[round]; - - xor_32(&key[0], sbox_key, &key[0]); - key[0] = key[0] ^ rcon; - - xor_32(&key[4], &key[0], &key[4]); - xor_32(&key[8], &key[4], &key[8]); - xor_32(&key[12], &key[8], &key[12]); -} - -VOID byte_sub( - IN PUCHAR in, - OUT PUCHAR out) -{ - INT i; - - for (i=0; i< 16; i++) - { - out[i] = RTMPCkipSbox(in[i]); - } -} - -VOID shift_row( - IN PUCHAR in, - OUT PUCHAR out) -{ - out[0] = in[0]; - out[1] = in[5]; - out[2] = in[10]; - out[3] = in[15]; - out[4] = in[4]; - out[5] = in[9]; - out[6] = in[14]; - out[7] = in[3]; - out[8] = in[8]; - out[9] = in[13]; - out[10] = in[2]; - out[11] = in[7]; - out[12] = in[12]; - out[13] = in[1]; - out[14] = in[6]; - out[15] = in[11]; -} - -VOID mix_column( - IN PUCHAR in, - OUT PUCHAR out) -{ - INT i; - UCHAR add1b[4]; - UCHAR add1bf7[4]; - UCHAR rotl[4]; - UCHAR swap_halfs[4]; - UCHAR andf7[4]; - UCHAR rotr[4]; - UCHAR temp[4]; - UCHAR tempb[4]; - - for (i=0 ; i<4; i++) - { - if ((in[i] & 0x80)== 0x80) - add1b[i] = 0x1b; - else - add1b[i] = 0x00; - } - - swap_halfs[0] = in[2]; /* Swap halfs */ - swap_halfs[1] = in[3]; - swap_halfs[2] = in[0]; - swap_halfs[3] = in[1]; - - rotl[0] = in[3]; /* Rotate left 8 bits */ - rotl[1] = in[0]; - rotl[2] = in[1]; - rotl[3] = in[2]; - - andf7[0] = in[0] & 0x7f; - andf7[1] = in[1] & 0x7f; - andf7[2] = in[2] & 0x7f; - andf7[3] = in[3] & 0x7f; - - for (i = 3; i>0; i--) /* logical shift left 1 bit */ - { - andf7[i] = andf7[i] << 1; - if ((andf7[i-1] & 0x80) == 0x80) - { - andf7[i] = (andf7[i] | 0x01); - } - } - andf7[0] = andf7[0] << 1; - andf7[0] = andf7[0] & 0xfe; - - xor_32(add1b, andf7, add1bf7); - - xor_32(in, add1bf7, rotr); - - temp[0] = rotr[0]; /* Rotate right 8 bits */ - rotr[0] = rotr[1]; - rotr[1] = rotr[2]; - rotr[2] = rotr[3]; - rotr[3] = temp[0]; - - xor_32(add1bf7, rotr, temp); - xor_32(swap_halfs, rotl,tempb); - xor_32(temp, tempb, out); -} - -VOID RTMPAesEncrypt( - IN PUCHAR key, - IN PUCHAR data, - IN PUCHAR ciphertext) -{ - INT round; - INT i; - UCHAR intermediatea[16]; - UCHAR intermediateb[16]; - UCHAR round_key[16]; - - for(i=0; i<16; i++) round_key[i] = key[i]; - - for (round = 0; round < 11; round++) - { - if (round == 0) - { - xor_128(round_key, data, ciphertext); - next_key(round_key, round); - } - else if (round == 10) - { - byte_sub(ciphertext, intermediatea); - shift_row(intermediatea, intermediateb); - xor_128(intermediateb, round_key, ciphertext); - } - else /* 1 - 9 */ - { - byte_sub(ciphertext, intermediatea); - shift_row(intermediatea, intermediateb); - mix_column(&intermediateb[0], &intermediatea[0]); - mix_column(&intermediateb[4], &intermediatea[4]); - mix_column(&intermediateb[8], &intermediatea[8]); - mix_column(&intermediateb[12], &intermediatea[12]); - xor_128(intermediatea, round_key, ciphertext); - next_key(round_key, round); - } - } - -} - -/* calculate the mic */ -VOID RTMPMicFinal( - IN PMIC_CONTEXT pContext, - OUT UCHAR digest[4]) -{ - INT byte_position; - ULONG val; - ULONGLONG sum, utmp; - LONGLONG stmp; - - /* deal with partial 32-bit word left over from last update */ - if ( (byte_position = (pContext->position & 3)) != 0) { - /* have a partial word in part to deal with -- zero unused bytes */ - do { - pContext->part[byte_position++] = 0; - pContext->position++; - } while (byte_position < 4); - val = GETBIG32(&pContext->part[0]); - MIC_ACCUM(val); - } - - /* reduce the accumulated u64 to a 32-bit MIC */ - sum = pContext->accum; - stmp = (sum & 0xffffffffL) - ((sum >> 32) * 15); - utmp = (stmp & 0xffffffffL) - ((stmp >> 32) * 15); - sum = utmp & 0xffffffffL; - if (utmp > 0x10000000fL) - sum -= 15; - - val = (ULONG)sum; - digest[0] = (UCHAR)((val>>24) & 0xFF); - digest[1] = (UCHAR) ((val>>16) & 0xFF); - digest[2] = (UCHAR) ((val>>8) & 0xFF); - digest[3] = (UCHAR)((val>>0) & 0xFF); -} - -VOID RTMPCkipInsertCMIC( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pMIC, - IN PUCHAR p80211hdr, - IN PNDIS_PACKET pPacket, - IN PCIPHER_KEY pKey, - IN PUCHAR mic_snap) -{ - PACKET_INFO PacketInfo; - PUCHAR pSrcBufVA; - ULONG SrcBufLen; - PUCHAR pDA, pSA, pProto; - UCHAR bigethlen[2]; - UCHAR ckip_ck[16]; - MIC_CONTEXT mic_ctx; - USHORT payloadlen; - UCHAR i; - - if (pKey == NULL) - { - DBGPRINT_ERR(("RTMPCkipInsertCMIC, Before to form the CKIP key (CK), pKey can't be NULL\n")); - return; - } - - switch (*(p80211hdr+1) & 3) - { - case 0: /* FromDs=0, ToDs=0 */ - pDA = p80211hdr+4; - pSA = p80211hdr+10; - break; - case 1: /* FromDs=0, ToDs=1 */ - pDA = p80211hdr+16; - pSA = p80211hdr+10; - break; - case 2: /* FromDs=1, ToDs=0 */ - pDA = p80211hdr+4; - pSA = p80211hdr+16; - break; - case 3: /* FromDs=1, ToDs=1 */ - pDA = p80211hdr+16; - pSA = p80211hdr+24; - break; - } - - RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); - - if (SrcBufLen < LENGTH_802_3) - return; - - pProto = pSrcBufVA + 12; - payloadlen = PacketInfo.TotalPacketLength - LENGTH_802_3 + 18; // CKIP_LLC(8)+CMIC(4)+TxSEQ(4)+PROTO(2)=18 - - bigethlen[0] = (unsigned char)(payloadlen >> 8); - bigethlen[1] = (unsigned char)payloadlen; - - // - // Encryption Key expansion to form the CKIP Key (CKIP_CK). - // - if (pKey->KeyLen < 16) - { - for(i = 0; i < (16 / pKey->KeyLen); i++) - { - NdisMoveMemory(ckip_ck + i * pKey->KeyLen, - pKey->Key, - pKey->KeyLen); - } - NdisMoveMemory(ckip_ck + i * pKey->KeyLen, - pKey->Key, - 16 - (i * pKey->KeyLen)); - } - else - { - NdisMoveMemory(ckip_ck, pKey->Key, pKey->KeyLen); - } - RTMPCkipMicInit(&mic_ctx, ckip_ck); - RTMPMicUpdate(&mic_ctx, pDA, MAC_ADDR_LEN); // MIC <-- DA - RTMPMicUpdate(&mic_ctx, pSA, MAC_ADDR_LEN); // MIC <-- SA - RTMPMicUpdate(&mic_ctx, bigethlen, 2); // MIC <-- payload length starting from CKIP SNAP - RTMPMicUpdate(&mic_ctx, mic_snap, 8); // MIC <-- snap header - RTMPMicUpdate(&mic_ctx, pAd->StaCfg.TxSEQ, 4); // MIC <-- TxSEQ - RTMPMicUpdate(&mic_ctx, pProto, 2); // MIC <-- Protocol - - pSrcBufVA += LENGTH_802_3; - SrcBufLen -= LENGTH_802_3; - - // Mic <-- original payload. loop until all payload processed - do - { - if (SrcBufLen > 0) - RTMPMicUpdate(&mic_ctx, pSrcBufVA, SrcBufLen); - - NdisGetNextBuffer(PacketInfo.pFirstBuffer, &PacketInfo.pFirstBuffer); - if (PacketInfo.pFirstBuffer) - { - NDIS_QUERY_BUFFER(PacketInfo.pFirstBuffer, &pSrcBufVA, &SrcBufLen); - } - else - break; - } while (TRUE); - - RTMPMicFinal(&mic_ctx, pMIC); // update MIC -} diff --git a/drivers/staging/rt3090/sta/rtmp_data.c b/drivers/staging/rt3090/sta/rtmp_data.c deleted file mode 100644 index 559136409ff2..000000000000 --- a/drivers/staging/rt3090/sta/rtmp_data.c +++ /dev/null @@ -1,2661 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rtmp_data.c - - Abstract: - Data path subroutines - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- -*/ - -#include "../rt_config.h" - - -VOID STARxEAPOLFrameIndicate( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) -{ - PRT28XX_RXD_STRUC pRxD = &(pRxBlk->RxD); - PRXWI_STRUC pRxWI = pRxBlk->pRxWI; - UCHAR *pTmpBuf; - - -#ifdef WPA_SUPPLICANT_SUPPORT - if (pAd->StaCfg.WpaSupplicantUP) - { - // All EAPoL frames have to pass to upper layer (ex. WPA_SUPPLICANT daemon) - // TBD : process fragmented EAPol frames - { - // In 802.1x mode, if the received frame is EAP-SUCCESS packet, turn on the PortSecured variable - if ( pAd->StaCfg.IEEE8021X == TRUE && - (EAP_CODE_SUCCESS == WpaCheckEapCode(pAd, pRxBlk->pData, pRxBlk->DataSize, LENGTH_802_1_H))) - { - PUCHAR Key; - UCHAR CipherAlg; - int idx = 0; - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("Receive EAP-SUCCESS Packet\n")); - //pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - STA_PORT_SECURED(pAd); - - if (pAd->StaCfg.IEEE8021x_required_keys == FALSE) - { - idx = pAd->StaCfg.DesireSharedKeyId; - CipherAlg = pAd->StaCfg.DesireSharedKey[idx].CipherAlg; - Key = pAd->StaCfg.DesireSharedKey[idx].Key; - - if (pAd->StaCfg.DesireSharedKey[idx].KeyLen > 0) - { -#ifdef RTMP_MAC_PCI - MAC_TABLE_ENTRY *pEntry = &pAd->MacTab.Content[BSSID_WCID]; - - // Set key material and cipherAlg to Asic - AsicAddSharedKeyEntry(pAd, BSS0, idx, CipherAlg, Key, NULL, NULL); - - // Assign group key info - RTMPAddWcidAttributeEntry(pAd, BSS0, idx, CipherAlg, NULL); - - // Assign pairwise key info - RTMPAddWcidAttributeEntry(pAd, BSS0, idx, CipherAlg, pEntry); - - pAd->IndicateMediaState = NdisMediaStateConnected; - pAd->ExtraInfo = GENERAL_LINK_UP; -#endif // RTMP_MAC_PCI // - // For Preventing ShardKey Table is cleared by remove key procedure. - pAd->SharedKey[BSS0][idx].CipherAlg = CipherAlg; - pAd->SharedKey[BSS0][idx].KeyLen = pAd->StaCfg.DesireSharedKey[idx].KeyLen; - NdisMoveMemory(pAd->SharedKey[BSS0][idx].Key, - pAd->StaCfg.DesireSharedKey[idx].Key, - pAd->StaCfg.DesireSharedKey[idx].KeyLen); - } - } - } - - Indicate_Legacy_Packet(pAd, pRxBlk, FromWhichBSSID); - return; - } - } - else -#endif // WPA_SUPPLICANT_SUPPORT // - { - // Special DATA frame that has to pass to MLME - // 1. Cisco Aironet frames for CCX2. We need pass it to MLME for special process - // 2. EAPOL handshaking frames when driver supplicant enabled, pass to MLME for special process - { - pTmpBuf = pRxBlk->pData - LENGTH_802_11; - NdisMoveMemory(pTmpBuf, pRxBlk->pHeader, LENGTH_802_11); - REPORT_MGMT_FRAME_TO_MLME(pAd, pRxWI->WirelessCliID, pTmpBuf, pRxBlk->DataSize + LENGTH_802_11, pRxWI->RSSI0, pRxWI->RSSI1, pRxWI->RSSI2, pRxD->PlcpSignal); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("!!! report EAPOL/AIRONET DATA to MLME (len=%d) !!!\n", pRxBlk->DataSize)); - } - } - - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); - return; - -} - -VOID STARxDataFrameAnnounce( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) -{ - - // non-EAP frame - if (!RTMPCheckWPAframe(pAd, pEntry, pRxBlk->pData, pRxBlk->DataSize, FromWhichBSSID)) - { - - { - // drop all non-EAP DATA frame before - // this client's Port-Access-Control is secured - if (pRxBlk->pHeader->FC.Wep) - { - // unsupported cipher suite - if (pAd->StaCfg.WepStatus == Ndis802_11EncryptionDisabled) - { - // release packet - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); - return; - } - } - else - { - // encryption in-use but receive a non-EAPOL clear text frame, drop it - if ((pAd->StaCfg.WepStatus != Ndis802_11EncryptionDisabled) && - (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED)) - { - // release packet - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); - return; - } - } - } - RX_BLK_CLEAR_FLAG(pRxBlk, fRX_EAP); - - - if (!RX_BLK_TEST_FLAG(pRxBlk, fRX_ARALINK)) - { - // Normal legacy, AMPDU or AMSDU - CmmRxnonRalinkFrameIndicate(pAd, pRxBlk, FromWhichBSSID); - - } - else - { - // ARALINK - CmmRxRalinkFrameIndicate(pAd, pEntry, pRxBlk, FromWhichBSSID); - } -#ifdef QOS_DLS_SUPPORT - RX_BLK_CLEAR_FLAG(pRxBlk, fRX_DLS); -#endif // QOS_DLS_SUPPORT // - } - else - { - RX_BLK_SET_FLAG(pRxBlk, fRX_EAP); -#ifdef DOT11_N_SUPPORT - if (RX_BLK_TEST_FLAG(pRxBlk, fRX_AMPDU) && (pAd->CommonCfg.bDisableReordering == 0)) - { - Indicate_AMPDU_Packet(pAd, pRxBlk, FromWhichBSSID); - } - else -#endif // DOT11_N_SUPPORT // - { - // Determin the destination of the EAP frame - // to WPA state machine or upper layer - STARxEAPOLFrameIndicate(pAd, pEntry, pRxBlk, FromWhichBSSID); - } - } -} - - -// For TKIP frame, calculate the MIC value -BOOLEAN STACheckTkipMICValue( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN RX_BLK *pRxBlk) -{ - PHEADER_802_11 pHeader = pRxBlk->pHeader; - UCHAR *pData = pRxBlk->pData; - USHORT DataSize = pRxBlk->DataSize; - UCHAR UserPriority = pRxBlk->UserPriority; - PCIPHER_KEY pWpaKey; - UCHAR *pDA, *pSA; - - pWpaKey = &pAd->SharedKey[BSS0][pRxBlk->pRxWI->KeyIndex]; - - pDA = pHeader->Addr1; - if (RX_BLK_TEST_FLAG(pRxBlk, fRX_INFRA)) - { - pSA = pHeader->Addr3; - } - else - { - pSA = pHeader->Addr2; - } - - if (RTMPTkipCompareMICValue(pAd, - pData, - pDA, - pSA, - pWpaKey->RxMic, - UserPriority, - DataSize) == FALSE) - { - DBGPRINT_RAW(RT_DEBUG_ERROR,("Rx MIC Value error 2\n")); - -#ifdef WPA_SUPPLICANT_SUPPORT - if (pAd->StaCfg.WpaSupplicantUP) - { - WpaSendMicFailureToWpaSupplicant(pAd, (pWpaKey->Type == PAIRWISEKEY) ? TRUE : FALSE); - } - else -#endif // WPA_SUPPLICANT_SUPPORT // - { - RTMPReportMicError(pAd, pWpaKey); - } - - // release packet - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); - return FALSE; - } - - return TRUE; -} - - -// -// All Rx routines use RX_BLK structure to hande rx events -// It is very important to build pRxBlk attributes -// 1. pHeader pointer to 802.11 Header -// 2. pData pointer to payload including LLC (just skip Header) -// 3. set payload size including LLC to DataSize -// 4. set some flags with RX_BLK_SET_FLAG() -// -VOID STAHandleRxDataFrame( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk) -{ - PRT28XX_RXD_STRUC pRxD = &(pRxBlk->RxD); - PRXWI_STRUC pRxWI = pRxBlk->pRxWI; - PHEADER_802_11 pHeader = pRxBlk->pHeader; - PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; - BOOLEAN bFragment = FALSE; - MAC_TABLE_ENTRY *pEntry = NULL; - UCHAR FromWhichBSSID = BSS0; - UCHAR UserPriority = 0; - - { - // before LINK UP, all DATA frames are rejected - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - // release packet - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); - return; - } - -#ifdef QOS_DLS_SUPPORT - //if ((pHeader->FC.FrDs == 0) && (pHeader->FC.ToDs == 0)) - if (RTMPRcvFrameDLSCheck(pAd, pHeader, pRxWI->MPDUtotalByteCount, pRxD)) - { - return; - } -#endif // QOS_DLS_SUPPORT // - - // Drop not my BSS frames - if (pRxD->MyBss == 0) - { - { - // release packet - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); - return; - } - } - - pAd->RalinkCounters.RxCountSinceLastNULL++; - if (pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable && (pHeader->FC.SubType & 0x08)) - { - UCHAR *pData; - DBGPRINT(RT_DEBUG_INFO,("bAPSDCapable\n")); - - // Qos bit 4 - pData = (PUCHAR)pHeader + LENGTH_802_11; - if ((*pData >> 4) & 0x01) - { - DBGPRINT(RT_DEBUG_INFO,("RxDone- Rcv EOSP frame, driver may fall into sleep\n")); - pAd->CommonCfg.bInServicePeriod = FALSE; - - // Force driver to fall into sleep mode when rcv EOSP frame - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - USHORT TbttNumToNextWakeUp; - USHORT NextDtim = pAd->StaCfg.DtimPeriod; - ULONG Now; - - NdisGetSystemUpTime(&Now); - NextDtim -= (USHORT)(Now - pAd->StaCfg.LastBeaconRxTime)/pAd->CommonCfg.BeaconPeriod; - - TbttNumToNextWakeUp = pAd->StaCfg.DefaultListenCount; - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM) && (TbttNumToNextWakeUp > NextDtim)) - TbttNumToNextWakeUp = NextDtim; - - RTMP_SET_PSM_BIT(pAd, PWR_SAVE); - // if WMM-APSD is failed, try to disable following line - AsicSleepThenAutoWakeup(pAd, TbttNumToNextWakeUp); - } - } - - if ((pHeader->FC.MoreData) && (pAd->CommonCfg.bInServicePeriod)) - { - DBGPRINT(RT_DEBUG_TRACE,("Sending another trigger frame when More Data bit is set to 1\n")); - } - } - - // Drop NULL, CF-ACK(no data), CF-POLL(no data), and CF-ACK+CF-POLL(no data) data frame - if ((pHeader->FC.SubType & 0x04)) // bit 2 : no DATA - { - // release packet - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); - return; - } - - // Drop not my BSS frame (we can not only check the MyBss bit in RxD) -#ifdef QOS_DLS_SUPPORT - if (!pAd->CommonCfg.bDLSCapable) - { -#endif // QOS_DLS_SUPPORT // - if (INFRA_ON(pAd)) - { - // Infrastructure mode, check address 2 for BSSID - if (!RTMPEqualMemory(&pHeader->Addr2, &pAd->CommonCfg.Bssid, 6)) - { - // Receive frame not my BSSID - // release packet - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); - return; - } - } - else // Ad-Hoc mode or Not associated - { - // Ad-Hoc mode, check address 3 for BSSID - if (!RTMPEqualMemory(&pHeader->Addr3, &pAd->CommonCfg.Bssid, 6)) - { - // Receive frame not my BSSID - // release packet - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); - return; - } - } -#ifdef QOS_DLS_SUPPORT - } -#endif // QOS_DLS_SUPPORT // - - // - // find pEntry - // - if (pRxWI->WirelessCliID < MAX_LEN_OF_MAC_TABLE) - { - pEntry = &pAd->MacTab.Content[pRxWI->WirelessCliID]; - - } - else - { - // 1. release packet if infra mode - // 2. new a pEntry if ad-hoc mode - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); - return; - } - - // infra or ad-hoc - if (INFRA_ON(pAd)) - { - RX_BLK_SET_FLAG(pRxBlk, fRX_INFRA); -#ifdef QOS_DLS_SUPPORT - if ((pHeader->FC.FrDs == 0) && (pHeader->FC.ToDs == 0)) - RX_BLK_SET_FLAG(pRxBlk, fRX_DLS); - else -#endif // QOS_DLS_SUPPORT // - ASSERT(pRxWI->WirelessCliID == BSSID_WCID); - } - - // check Atheros Client - if ((pEntry->bIAmBadAtheros == FALSE) && (pRxD->AMPDU == 1) && (pHeader->FC.Retry )) - { - pEntry->bIAmBadAtheros = TRUE; - pAd->CommonCfg.IOTestParm.bCurrentAtheros = TRUE; - pAd->CommonCfg.IOTestParm.bLastAtheros = TRUE; - if (!STA_AES_ON(pAd)) - { - AsicUpdateProtect(pAd, 8, ALLN_SETPROTECT, TRUE, FALSE); - } - } - } - - pRxBlk->pData = (UCHAR *)pHeader; - - // - // update RxBlk->pData, DataSize - // 802.11 Header, QOS, HTC, Hw Padding - // - - // 1. skip 802.11 HEADER - { - pRxBlk->pData += LENGTH_802_11; - pRxBlk->DataSize -= LENGTH_802_11; - } - - // 2. QOS - if (pHeader->FC.SubType & 0x08) - { - RX_BLK_SET_FLAG(pRxBlk, fRX_QOS); - UserPriority = *(pRxBlk->pData) & 0x0f; - // bit 7 in QoS Control field signals the HT A-MSDU format - if ((*pRxBlk->pData) & 0x80) - { - RX_BLK_SET_FLAG(pRxBlk, fRX_AMSDU); - } - - // skip QOS contorl field - pRxBlk->pData += 2; - pRxBlk->DataSize -=2; - } - pRxBlk->UserPriority = UserPriority; - - /* check if need to resend PS Poll when received packet with MoreData = 1 */ - if ((pAd->StaCfg.Psm == PWR_SAVE) && (pHeader->FC.MoreData == 1)) - { - if ((((UserPriority == 0) || (UserPriority == 3)) && - pAd->CommonCfg.bAPSDAC_BE == 0) || - (((UserPriority == 1) || (UserPriority == 2)) && - pAd->CommonCfg.bAPSDAC_BK == 0) || - (((UserPriority == 4) || (UserPriority == 5)) && - pAd->CommonCfg.bAPSDAC_VI == 0) || - (((UserPriority == 6) || (UserPriority == 7)) && - pAd->CommonCfg.bAPSDAC_VO == 0)) - { - /* non-UAPSD delivery-enabled AC */ - RTMP_PS_POLL_ENQUEUE(pAd); - } - } - - // 3. Order bit: A-Ralink or HTC+ - if (pHeader->FC.Order) - { -#ifdef AGGREGATION_SUPPORT - if ((pRxWI->PHYMODE <= MODE_OFDM) && (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED))) - { - RX_BLK_SET_FLAG(pRxBlk, fRX_ARALINK); - } - else -#endif // AGGREGATION_SUPPORT // - { -#ifdef DOT11_N_SUPPORT - RX_BLK_SET_FLAG(pRxBlk, fRX_HTC); - // skip HTC contorl field - pRxBlk->pData += 4; - pRxBlk->DataSize -= 4; -#endif // DOT11_N_SUPPORT // - } - } - - // 4. skip HW padding - if (pRxD->L2PAD) - { - // just move pData pointer - // because DataSize excluding HW padding - RX_BLK_SET_FLAG(pRxBlk, fRX_PAD); - pRxBlk->pData += 2; - } - -#ifdef DOT11_N_SUPPORT - if (pRxD->BA) - { - RX_BLK_SET_FLAG(pRxBlk, fRX_AMPDU); - } -#endif // DOT11_N_SUPPORT // - - - // - // Case I Process Broadcast & Multicast data frame - // - if (pRxD->Bcast || pRxD->Mcast) - { - INC_COUNTER64(pAd->WlanCounters.MulticastReceivedFrameCount); - - // Drop Mcast/Bcast frame with fragment bit on - if (pHeader->FC.MoreFrag) - { - // release packet - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); - return; - } - - // Filter out Bcast frame which AP relayed for us - if (pHeader->FC.FrDs && MAC_ADDR_EQUAL(pHeader->Addr3, pAd->CurrentAddress)) - { - // release packet - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); - return; - } - - Indicate_Legacy_Packet(pAd, pRxBlk, FromWhichBSSID); - return; - } - else if (pRxD->U2M) - { - pAd->LastRxRate = (USHORT)((pRxWI->MCS) + (pRxWI->BW <<7) + (pRxWI->ShortGI <<8)+ (pRxWI->PHYMODE <<14)) ; - - -#ifdef QOS_DLS_SUPPORT - if (RX_BLK_TEST_FLAG(pRxBlk, fRX_DLS)) - { - MAC_TABLE_ENTRY *pDlsEntry = NULL; - - pDlsEntry = DlsEntryTableLookupByWcid(pAd, pRxWI->WirelessCliID, pHeader->Addr2, TRUE); - if(pDlsEntry) - Update_Rssi_Sample(pAd, &pDlsEntry->RssiSample, pRxWI); - } - else -#endif // QOS_DLS_SUPPORT // - if (ADHOC_ON(pAd)) - { - pEntry = MacTableLookup(pAd, pHeader->Addr2); - if (pEntry) - Update_Rssi_Sample(pAd, &pEntry->RssiSample, pRxWI); - } - - - Update_Rssi_Sample(pAd, &pAd->StaCfg.RssiSample, pRxWI); - - pAd->StaCfg.LastSNR0 = (UCHAR)(pRxWI->SNR0); - pAd->StaCfg.LastSNR1 = (UCHAR)(pRxWI->SNR1); - - pAd->RalinkCounters.OneSecRxOkDataCnt++; - - - if (!((pHeader->Frag == 0) && (pHeader->FC.MoreFrag == 0))) - { - // re-assemble the fragmented packets - // return complete frame (pRxPacket) or NULL - bFragment = TRUE; - pRxPacket = RTMPDeFragmentDataFrame(pAd, pRxBlk); - } - - if (pRxPacket) - { - pEntry = &pAd->MacTab.Content[pRxWI->WirelessCliID]; - - // process complete frame - if (bFragment && (pRxD->Decrypted) && (pEntry->WepStatus == Ndis802_11Encryption2Enabled)) - { - // Minus MIC length - pRxBlk->DataSize -= 8; - - // For TKIP frame, calculate the MIC value - if (STACheckTkipMICValue(pAd, pEntry, pRxBlk) == FALSE) - { - return; - } - } - - STARxDataFrameAnnounce(pAd, pEntry, pRxBlk, FromWhichBSSID); - return; - } - else - { - // just return - // because RTMPDeFragmentDataFrame() will release rx packet, - // if packet is fragmented - return; - } - } - - ASSERT(0); - // release packet - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); -} - -VOID STAHandleRxMgmtFrame( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk) -{ - PRT28XX_RXD_STRUC pRxD = &(pRxBlk->RxD); - PRXWI_STRUC pRxWI = pRxBlk->pRxWI; - PHEADER_802_11 pHeader = pRxBlk->pHeader; - PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; - - do - { - - - /* check if need to resend PS Poll when received packet with MoreData = 1 */ - if ((pAd->StaCfg.Psm == PWR_SAVE) && (pHeader->FC.MoreData == 1)) - { - /* for UAPSD, all management frames will be VO priority */ - if (pAd->CommonCfg.bAPSDAC_VO == 0) - { - /* non-UAPSD delivery-enabled AC */ - RTMP_PS_POLL_ENQUEUE(pAd); - } - } - - /* TODO: if MoreData == 0, station can go to sleep */ - - - // We should collect RSSI not only U2M data but also my beacon - if ((pHeader->FC.SubType == SUBTYPE_BEACON) && (MAC_ADDR_EQUAL(&pAd->CommonCfg.Bssid, &pHeader->Addr2)) - && (pAd->RxAnt.EvaluatePeriod == 0)) - { - Update_Rssi_Sample(pAd, &pAd->StaCfg.RssiSample, pRxWI); - - pAd->StaCfg.LastSNR0 = (UCHAR)(pRxWI->SNR0); - pAd->StaCfg.LastSNR1 = (UCHAR)(pRxWI->SNR1); - } - -#ifdef RT30xx -#ifdef ANT_DIVERSITY_SUPPORT - // collect rssi information for antenna diversity - if ((pAd->NicConfig2.field.AntDiversity) && - (pAd->CommonCfg.bRxAntDiversity != ANT_DIVERSITY_DISABLE)) - { - if ((pRxD->U2M) || ((pHeader->FC.SubType == SUBTYPE_BEACON) && (MAC_ADDR_EQUAL(&pAd->CommonCfg.Bssid, &pHeader->Addr2)))) - { - COLLECT_RX_ANTENNA_AVERAGE_RSSI(pAd, ConvertToRssi(pAd, (UCHAR)pRxWI->RSSI0, RSSI_0), 0); //Note: RSSI2 not used on RT73 - pAd->StaCfg.NumOfAvgRssiSample ++; - } - } -#endif // ANT_DIVERSITY_SUPPORT // -#endif // RT30xx // - - // First check the size, it MUST not exceed the mlme queue size - if (pRxWI->MPDUtotalByteCount > MGMT_DMA_BUFFER_SIZE) - { - DBGPRINT_ERR(("STAHandleRxMgmtFrame: frame too large, size = %d \n", pRxWI->MPDUtotalByteCount)); - break; - } - - REPORT_MGMT_FRAME_TO_MLME(pAd, pRxWI->WirelessCliID, pHeader, pRxWI->MPDUtotalByteCount, - pRxWI->RSSI0, pRxWI->RSSI1, pRxWI->RSSI2, pRxD->PlcpSignal); - } while (FALSE); - - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_SUCCESS); -} - -VOID STAHandleRxControlFrame( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk) -{ -#ifdef DOT11_N_SUPPORT - PRXWI_STRUC pRxWI = pRxBlk->pRxWI; -#endif // DOT11_N_SUPPORT // - PHEADER_802_11 pHeader = pRxBlk->pHeader; - PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; - - switch (pHeader->FC.SubType) - { - case SUBTYPE_BLOCK_ACK_REQ: -#ifdef DOT11_N_SUPPORT - { - CntlEnqueueForRecv(pAd, pRxWI->WirelessCliID, (pRxWI->MPDUtotalByteCount), (PFRAME_BA_REQ)pHeader); - } - break; -#endif // DOT11_N_SUPPORT // - case SUBTYPE_BLOCK_ACK: - case SUBTYPE_ACK: - default: - break; - } - - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); -} - - -/* - ======================================================================== - - Routine Description: - Process RxDone interrupt, running in DPC level - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - This routine has to maintain Rx ring read pointer. - Need to consider QOS DATA format when converting to 802.3 - ======================================================================== -*/ -BOOLEAN STARxDoneInterruptHandle( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN argc) -{ - NDIS_STATUS Status; - UINT32 RxProcessed, RxPending; - BOOLEAN bReschedule = FALSE; - RT28XX_RXD_STRUC *pRxD; - UCHAR *pData; - PRXWI_STRUC pRxWI; - PNDIS_PACKET pRxPacket; - PHEADER_802_11 pHeader; - RX_BLK RxCell; - - RxProcessed = RxPending = 0; - - // process whole rx ring - while (1) - { - - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF | - fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST) || - !RTMP_TEST_FLAG(pAd,fRTMP_ADAPTER_START_UP)) - { - break; - } - -#ifdef RTMP_MAC_PCI - if (RxProcessed++ > MAX_RX_PROCESS_CNT) - { - // need to reschedule rx handle - bReschedule = TRUE; - break; - } -#endif // RTMP_MAC_PCI // - - RxProcessed ++; // test - - // 1. allocate a new data packet into rx ring to replace received packet - // then processing the received packet - // 2. the callee must take charge of release of packet - // 3. As far as driver is concerned , - // the rx packet must - // a. be indicated to upper layer or - // b. be released if it is discarded - pRxPacket = GetPacketFromRxRing(pAd, &(RxCell.RxD), &bReschedule, &RxPending); - if (pRxPacket == NULL) - { - // no more packet to process - break; - } - - // get rx ring descriptor - pRxD = &(RxCell.RxD); - // get rx data buffer - pData = GET_OS_PKT_DATAPTR(pRxPacket); - pRxWI = (PRXWI_STRUC) pData; - pHeader = (PHEADER_802_11) (pData+RXWI_SIZE) ; - -#ifdef RT_BIG_ENDIAN - RTMPFrameEndianChange(pAd, (PUCHAR)pHeader, DIR_READ, TRUE); - RTMPWIEndianChange((PUCHAR)pRxWI, TYPE_RXWI); -#endif - - // build RxCell - RxCell.pRxWI = pRxWI; - RxCell.pHeader = pHeader; - RxCell.pRxPacket = pRxPacket; - RxCell.pData = (UCHAR *) pHeader; - RxCell.DataSize = pRxWI->MPDUtotalByteCount; - RxCell.Flags = 0; - - // Increase Total receive byte counter after real data received no mater any error or not - pAd->RalinkCounters.ReceivedByteCount += pRxWI->MPDUtotalByteCount; - pAd->RalinkCounters.OneSecReceivedByteCount += pRxWI->MPDUtotalByteCount; - pAd->RalinkCounters.RxCount ++; - - INC_COUNTER64(pAd->WlanCounters.ReceivedFragmentCount); - - if (pRxWI->MPDUtotalByteCount < 14) - Status = NDIS_STATUS_FAILURE; - - if (MONITOR_ON(pAd)) - { - send_monitor_packets(pAd, &RxCell); - break; - } - - /* STARxDoneInterruptHandle() is called in rtusb_bulk.c */ -#ifdef RALINK_ATE - if (ATE_ON(pAd)) - { - pAd->ate.RxCntPerSec++; - ATESampleRssi(pAd, pRxWI); -#ifdef RALINK_28xx_QA - if (pAd->ate.bQARxStart == TRUE) - { - /* (*pRxD) has been swapped in GetPacketFromRxRing() */ - ATE_QA_Statistics(pAd, pRxWI, pRxD, pHeader); - } -#endif // RALINK_28xx_QA // - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_SUCCESS); - continue; - } -#endif // RALINK_ATE // - - // Check for all RxD errors - Status = RTMPCheckRxError(pAd, pHeader, pRxWI, pRxD); - - // Handle the received frame - if (Status == NDIS_STATUS_SUCCESS) - { - switch (pHeader->FC.Type) - { - // CASE I, receive a DATA frame - case BTYPE_DATA: - { - // process DATA frame - STAHandleRxDataFrame(pAd, &RxCell); - } - break; - // CASE II, receive a MGMT frame - case BTYPE_MGMT: - { - STAHandleRxMgmtFrame(pAd, &RxCell); - } - break; - // CASE III. receive a CNTL frame - case BTYPE_CNTL: - { - STAHandleRxControlFrame(pAd, &RxCell); - } - break; - // discard other type - default: - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); - break; - } - } - else - { - pAd->Counters8023.RxErrors++; - // discard this frame - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); - } - } - - return bReschedule; -} - -/* - ======================================================================== - - Routine Description: - Arguments: - pAd Pointer to our adapter - - IRQL = DISPATCH_LEVEL - - ======================================================================== -*/ -VOID RTMPHandleTwakeupInterrupt( - IN PRTMP_ADAPTER pAd) -{ - AsicForceWakeup(pAd, FALSE); -} - -/* -======================================================================== -Routine Description: - Early checking and OS-depened parsing for Tx packet send to our STA driver. - -Arguments: - NDIS_HANDLE MiniportAdapterContext Pointer refer to the device handle, i.e., the pAd. - PPNDIS_PACKET ppPacketArray The packet array need to do transmission. - UINT NumberOfPackets Number of packet in packet array. - -Return Value: - NONE - -Note: - This function do early checking and classification for send-out packet. - You only can put OS-depened & STA related code in here. -======================================================================== -*/ -VOID STASendPackets( - IN NDIS_HANDLE MiniportAdapterContext, - IN PPNDIS_PACKET ppPacketArray, - IN UINT NumberOfPackets) -{ - UINT Index; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) MiniportAdapterContext; - PNDIS_PACKET pPacket; - BOOLEAN allowToSend = FALSE; - - - for (Index = 0; Index < NumberOfPackets; Index++) - { - pPacket = ppPacketArray[Index]; - - do - { - - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) - { - // Drop send request since hardware is in reset state - break; - } - else if (!INFRA_ON(pAd) && !ADHOC_ON(pAd)) - { - // Drop send request since there are no physical connection yet - break; - } - else - { - // Record that orignal packet source is from NDIS layer,so that - // later on driver knows how to release this NDIS PACKET -#ifdef QOS_DLS_SUPPORT - MAC_TABLE_ENTRY *pEntry; - PUCHAR pSrcBufVA = GET_OS_PKT_DATAPTR(pPacket); - - pEntry = MacTableLookup(pAd, pSrcBufVA); - if (pEntry && (pEntry->ValidAsDls == TRUE)) - { - RTMP_SET_PACKET_WCID(pPacket, pEntry->Aid); - } - else -#endif // QOS_DLS_SUPPORT // - RTMP_SET_PACKET_WCID(pPacket, 0); // this field is useless when in STA mode - RTMP_SET_PACKET_SOURCE(pPacket, PKTSRC_NDIS); - NDIS_SET_PACKET_STATUS(pPacket, NDIS_STATUS_PENDING); - pAd->RalinkCounters.PendingNdisPacketCount++; - - allowToSend = TRUE; - } - } while(FALSE); - - if (allowToSend == TRUE) - STASendPacket(pAd, pPacket); - else - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - } - - // Dequeue outgoing frames from TxSwQueue[] and process it - RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); - -} - - -/* -======================================================================== -Routine Description: - This routine is used to do packet parsing and classification for Tx packet - to STA device, and it will en-queue packets to our TxSwQueue depends on AC - class. - -Arguments: - pAd Pointer to our adapter - pPacket Pointer to send packet - -Return Value: - NDIS_STATUS_SUCCESS If succes to queue the packet into TxSwQueue. - NDIS_STATUS_FAILURE If failed to do en-queue. - -Note: - You only can put OS-indepened & STA related code in here. -======================================================================== -*/ -NDIS_STATUS STASendPacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket) -{ - PACKET_INFO PacketInfo; - PUCHAR pSrcBufVA; - UINT SrcBufLen; - UINT AllowFragSize; - UCHAR NumberOfFrag; - UCHAR RTSRequired; - UCHAR QueIdx, UserPriority; - MAC_TABLE_ENTRY *pEntry = NULL; - unsigned int IrqFlags; - UCHAR FlgIsIP = 0; - UCHAR Rate; - - // Prepare packet information structure for buffer descriptor - // chained within a single NDIS packet. - RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); - - if (pSrcBufVA == NULL) - { - DBGPRINT(RT_DEBUG_ERROR,("STASendPacket --> pSrcBufVA == NULL !!!SrcBufLen=%x\n",SrcBufLen)); - // Resourece is low, system did not allocate virtual address - // return NDIS_STATUS_FAILURE directly to upper layer - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - return NDIS_STATUS_FAILURE; - } - - - if (SrcBufLen < 14) - { - DBGPRINT(RT_DEBUG_ERROR,("STASendPacket --> Ndis Packet buffer error !!!\n")); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - return (NDIS_STATUS_FAILURE); - } - - // In HT rate adhoc mode, A-MPDU is often used. So need to lookup BA Table and MAC Entry. - // Note multicast packets in adhoc also use BSSID_WCID index. - { - if(INFRA_ON(pAd)) - { -#ifdef QOS_DLS_SUPPORT - USHORT tmpWcid; - - tmpWcid = RTMP_GET_PACKET_WCID(pPacket); - if (VALID_WCID(tmpWcid) && - (pAd->MacTab.Content[tmpWcid].ValidAsDls== TRUE)) - { - pEntry = &pAd->MacTab.Content[tmpWcid]; - Rate = pAd->MacTab.Content[tmpWcid].CurrTxRate; - } - else -#endif // QOS_DLS_SUPPORT // - { - pEntry = &pAd->MacTab.Content[BSSID_WCID]; - RTMP_SET_PACKET_WCID(pPacket, BSSID_WCID); - Rate = pAd->CommonCfg.TxRate; - } - } - else if (ADHOC_ON(pAd)) - { - if (*pSrcBufVA & 0x01) - { - RTMP_SET_PACKET_WCID(pPacket, MCAST_WCID); - pEntry = &pAd->MacTab.Content[MCAST_WCID]; - } - else - { - pEntry = MacTableLookup(pAd, pSrcBufVA); - } - Rate = pAd->CommonCfg.TxRate; - } - } - - if (!pEntry) - { - DBGPRINT(RT_DEBUG_ERROR,("STASendPacket->Cannot find pEntry(%2x:%2x:%2x:%2x:%2x:%2x) in MacTab!\n", PRINT_MAC(pSrcBufVA))); - // Resourece is low, system did not allocate virtual address - // return NDIS_STATUS_FAILURE directly to upper layer - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - return NDIS_STATUS_FAILURE; - } - - if (ADHOC_ON(pAd) - ) - { - RTMP_SET_PACKET_WCID(pPacket, (UCHAR)pEntry->Aid); - } - - // - // Check the Ethernet Frame type of this packet, and set the RTMP_SET_PACKET_SPECIFIC flags. - // Here we set the PACKET_SPECIFIC flags(LLC, VLAN, DHCP/ARP, EAPOL). - RTMPCheckEtherType(pAd, pPacket); - - - - // - // WPA 802.1x secured port control - drop all non-802.1x frame before port secured - // - if (((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) -#ifdef WPA_SUPPLICANT_SUPPORT - || (pAd->StaCfg.IEEE8021X == TRUE) -#endif // WPA_SUPPLICANT_SUPPORT // - ) - && ((pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED) || (pAd->StaCfg.MicErrCnt >= 2)) - && (RTMP_GET_PACKET_EAPOL(pPacket)== FALSE) - ) - { - DBGPRINT(RT_DEBUG_TRACE,("STASendPacket --> Drop packet before port secured !!!\n")); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - - return (NDIS_STATUS_FAILURE); - } - - - // STEP 1. Decide number of fragments required to deliver this MSDU. - // The estimation here is not very accurate because difficult to - // take encryption overhead into consideration here. The result - // "NumberOfFrag" is then just used to pre-check if enough free - // TXD are available to hold this MSDU. - - - if (*pSrcBufVA & 0x01) // fragmentation not allowed on multicast & broadcast - NumberOfFrag = 1; - else if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED)) - NumberOfFrag = 1; // Aggregation overwhelms fragmentation - else if (CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_AMSDU_INUSED)) - NumberOfFrag = 1; // Aggregation overwhelms fragmentation -#ifdef DOT11_N_SUPPORT - else if ((pAd->StaCfg.HTPhyMode.field.MODE == MODE_HTMIX) || (pAd->StaCfg.HTPhyMode.field.MODE == MODE_HTGREENFIELD)) - NumberOfFrag = 1; // MIMO RATE overwhelms fragmentation -#endif // DOT11_N_SUPPORT // - else - { - // The calculated "NumberOfFrag" is a rough estimation because of various - // encryption/encapsulation overhead not taken into consideration. This number is just - // used to make sure enough free TXD are available before fragmentation takes place. - // In case the actual required number of fragments of an NDIS packet - // excceeds "NumberOfFrag"caculated here and not enough free TXD available, the - // last fragment (i.e. last MPDU) will be dropped in RTMPHardTransmit() due to out of - // resource, and the NDIS packet will be indicated NDIS_STATUS_FAILURE. This should - // rarely happen and the penalty is just like a TX RETRY fail. Affordable. - - AllowFragSize = (pAd->CommonCfg.FragmentThreshold) - LENGTH_802_11 - LENGTH_CRC; - NumberOfFrag = ((PacketInfo.TotalPacketLength - LENGTH_802_3 + LENGTH_802_1_H) / AllowFragSize) + 1; - // To get accurate number of fragmentation, Minus 1 if the size just match to allowable fragment size - if (((PacketInfo.TotalPacketLength - LENGTH_802_3 + LENGTH_802_1_H) % AllowFragSize) == 0) - { - NumberOfFrag--; - } - } - - // Save fragment number to Ndis packet reserved field - RTMP_SET_PACKET_FRAGMENTS(pPacket, NumberOfFrag); - - - // STEP 2. Check the requirement of RTS: - // If multiple fragment required, RTS is required only for the first fragment - // if the fragment size large than RTS threshold - // For RT28xx, Let ASIC send RTS/CTS -// RTMP_SET_PACKET_RTS(pPacket, 0); - if (NumberOfFrag > 1) - RTSRequired = (pAd->CommonCfg.FragmentThreshold > pAd->CommonCfg.RtsThreshold) ? 1 : 0; - else - RTSRequired = (PacketInfo.TotalPacketLength > pAd->CommonCfg.RtsThreshold) ? 1 : 0; - - // Save RTS requirement to Ndis packet reserved field - RTMP_SET_PACKET_RTS(pPacket, RTSRequired); - RTMP_SET_PACKET_TXRATE(pPacket, pAd->CommonCfg.TxRate); - - // - // STEP 3. Traffic classification. outcome = - // - UserPriority = 0; - QueIdx = QID_AC_BE; - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && - CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_WMM_CAPABLE)) - { - USHORT Protocol; - UCHAR LlcSnapLen = 0, Byte0, Byte1; - do - { - // get Ethernet protocol field - Protocol = (USHORT)((pSrcBufVA[12] << 8) + pSrcBufVA[13]); - if (Protocol <= 1500) - { - // get Ethernet protocol field from LLC/SNAP - if (Sniff2BytesFromNdisBuffer(PacketInfo.pFirstBuffer, LENGTH_802_3 + 6, &Byte0, &Byte1) != NDIS_STATUS_SUCCESS) - break; - - Protocol = (USHORT)((Byte0 << 8) + Byte1); - LlcSnapLen = 8; - } - - // always AC_BE for non-IP packet - if (Protocol != 0x0800) - break; - - // get IP header - if (Sniff2BytesFromNdisBuffer(PacketInfo.pFirstBuffer, LENGTH_802_3 + LlcSnapLen, &Byte0, &Byte1) != NDIS_STATUS_SUCCESS) - break; - - // return AC_BE if packet is not IPv4 - if ((Byte0 & 0xf0) != 0x40) - break; - - FlgIsIP = 1; - UserPriority = (Byte1 & 0xe0) >> 5; - QueIdx = MapUserPriorityToAccessCategory[UserPriority]; - - // TODO: have to check ACM bit. apply TSPEC if ACM is ON - // TODO: downgrade UP & QueIdx before passing ACM - /* - Under WMM ACM control, we dont need to check the bit; - Or when a TSPEC is built for VO but we will change to issue - BA session for BE here, so we will not use BA to send VO packets. - */ - if (pAd->CommonCfg.APEdcaParm.bACM[QueIdx]) - { - UserPriority = 0; - QueIdx = QID_AC_BE; - } - } while (FALSE); - } - - RTMP_SET_PACKET_UP(pPacket, UserPriority); - - - - // Make sure SendTxWait queue resource won't be used by other threads - RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); - if (pAd->TxSwQueue[QueIdx].Number >= MAX_PACKETS_IN_QUEUE) - { - RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); -#ifdef BLOCK_NET_IF - StopNetIfQueue(pAd, QueIdx, pPacket); -#endif // BLOCK_NET_IF // - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - - return NDIS_STATUS_FAILURE; - } - else - { - InsertTailQueueAc(pAd, pEntry, &pAd->TxSwQueue[QueIdx], PACKET_TO_QUEUE_ENTRY(pPacket)); - } - RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); - -#ifdef DOT11_N_SUPPORT - if ((pAd->CommonCfg.BACapability.field.AutoBA == TRUE)&& - IS_HT_STA(pEntry)) - { - //PMAC_TABLE_ENTRY pMacEntry = &pAd->MacTab.Content[BSSID_WCID]; - if (((pEntry->TXBAbitmap & (1<BADeclineBitmap & (1<PortSecured == WPA_802_1X_PORT_SECURED) - // For IOT compatibility, if - // 1. It is Ralink chip or - // 2. It is OPEN or AES mode, - // then BA session can be bulit. - && ((pEntry->ValidAsCLI && pAd->MlmeAux.APRalinkIe != 0x0) || - (pEntry->WepStatus != Ndis802_11WEPEnabled && pEntry->WepStatus != Ndis802_11Encryption2Enabled)) - ) - { - BAOriSessionSetUp(pAd, pEntry, UserPriority, 0, 10, FALSE); - } - } -#endif // DOT11_N_SUPPORT // - - pAd->RalinkCounters.OneSecOsTxCount[QueIdx]++; // TODO: for debug only. to be removed - return NDIS_STATUS_SUCCESS; -} - - -/* - ======================================================================== - - Routine Description: - This subroutine will scan through releative ring descriptor to find - out avaliable free ring descriptor and compare with request size. - - Arguments: - pAd Pointer to our adapter - QueIdx Selected TX Ring - - Return Value: - NDIS_STATUS_FAILURE Not enough free descriptor - NDIS_STATUS_SUCCESS Enough free descriptor - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -#ifdef RTMP_MAC_PCI -NDIS_STATUS RTMPFreeTXDRequest( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN UCHAR NumberRequired, - IN PUCHAR FreeNumberIs) -{ - ULONG FreeNumber = 0; - NDIS_STATUS Status = NDIS_STATUS_FAILURE; - - switch (QueIdx) - { - case QID_AC_BK: - case QID_AC_BE: - case QID_AC_VI: - case QID_AC_VO: - /*case QID_HCCA:*/ - if (pAd->TxRing[QueIdx].TxSwFreeIdx > pAd->TxRing[QueIdx].TxCpuIdx) - FreeNumber = pAd->TxRing[QueIdx].TxSwFreeIdx - pAd->TxRing[QueIdx].TxCpuIdx - 1; - else - FreeNumber = pAd->TxRing[QueIdx].TxSwFreeIdx + TX_RING_SIZE - pAd->TxRing[QueIdx].TxCpuIdx - 1; - - if (FreeNumber >= NumberRequired) - Status = NDIS_STATUS_SUCCESS; - break; - - case QID_MGMT: - if (pAd->MgmtRing.TxSwFreeIdx > pAd->MgmtRing.TxCpuIdx) - FreeNumber = pAd->MgmtRing.TxSwFreeIdx - pAd->MgmtRing.TxCpuIdx - 1; - else - FreeNumber = pAd->MgmtRing.TxSwFreeIdx + MGMT_RING_SIZE - pAd->MgmtRing.TxCpuIdx - 1; - - if (FreeNumber >= NumberRequired) - Status = NDIS_STATUS_SUCCESS; - break; - - default: - DBGPRINT(RT_DEBUG_ERROR,("RTMPFreeTXDRequest::Invalid QueIdx(=%d)\n", QueIdx)); - break; - } - *FreeNumberIs = (UCHAR)FreeNumber; - - return (Status); -} -#endif // RTMP_MAC_PCI // - - - -VOID RTMPSendDisassociationFrame( - IN PRTMP_ADAPTER pAd) -{ -} - -VOID RTMPSendNullFrame( - IN PRTMP_ADAPTER pAd, - IN UCHAR TxRate, - IN BOOLEAN bQosNull) -{ - UCHAR NullFrame[48]; - ULONG Length; - PHEADER_802_11 pHeader_802_11; - - -#ifdef RALINK_ATE - if(ATE_ON(pAd)) - { - return; - } -#endif // RALINK_ATE // - - // WPA 802.1x secured port control - if (((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) -#ifdef WPA_SUPPLICANT_SUPPORT - || (pAd->StaCfg.IEEE8021X == TRUE) -#endif - ) && - (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED)) - { - return; - } - - NdisZeroMemory(NullFrame, 48); - Length = sizeof(HEADER_802_11); - - pHeader_802_11 = (PHEADER_802_11) NullFrame; - - pHeader_802_11->FC.Type = BTYPE_DATA; - pHeader_802_11->FC.SubType = SUBTYPE_NULL_FUNC; - pHeader_802_11->FC.ToDs = 1; - COPY_MAC_ADDR(pHeader_802_11->Addr1, pAd->CommonCfg.Bssid); - COPY_MAC_ADDR(pHeader_802_11->Addr2, pAd->CurrentAddress); - COPY_MAC_ADDR(pHeader_802_11->Addr3, pAd->CommonCfg.Bssid); - - if (pAd->CommonCfg.bAPSDForcePowerSave) - { - pHeader_802_11->FC.PwrMgmt = PWR_SAVE; - } - else - { - pHeader_802_11->FC.PwrMgmt = (pAd->StaCfg.Psm == PWR_SAVE) ? 1: 0; - } - pHeader_802_11->Duration = pAd->CommonCfg.Dsifs + RTMPCalcDuration(pAd, TxRate, 14); - - pAd->Sequence++; - pHeader_802_11->Sequence = pAd->Sequence; - - // Prepare QosNull function frame - if (bQosNull) - { - pHeader_802_11->FC.SubType = SUBTYPE_QOS_NULL; - - // copy QOS control bytes - NullFrame[Length] = 0; - NullFrame[Length+1] = 0; - Length += 2;// if pad with 2 bytes for alignment, APSD will fail - } - - HAL_KickOutNullFrameTx(pAd, 0, NullFrame, Length); - -} - -// IRQL = DISPATCH_LEVEL -VOID RTMPSendRTSFrame( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN unsigned int NextMpduSize, - IN UCHAR TxRate, - IN UCHAR RTSRate, - IN USHORT AckDuration, - IN UCHAR QueIdx, - IN UCHAR FrameGap) -{ -} - - - -// -------------------------------------------------------- -// FIND ENCRYPT KEY AND DECIDE CIPHER ALGORITHM -// Find the WPA key, either Group or Pairwise Key -// LEAP + TKIP also use WPA key. -// -------------------------------------------------------- -// Decide WEP bit and cipher suite to be used. Same cipher suite should be used for whole fragment burst -// In Cisco CCX 2.0 Leap Authentication -// WepStatus is Ndis802_11Encryption1Enabled but the key will use PairwiseKey -// Instead of the SharedKey, SharedKey Length may be Zero. -VOID STAFindCipherAlgorithm( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk) -{ - NDIS_802_11_ENCRYPTION_STATUS Cipher; // To indicate cipher used for this packet - UCHAR CipherAlg = CIPHER_NONE; // cipher alogrithm - UCHAR KeyIdx = 0xff; - PUCHAR pSrcBufVA; - PCIPHER_KEY pKey = NULL; - - pSrcBufVA = GET_OS_PKT_DATAPTR(pTxBlk->pPacket); - - { - // Select Cipher - if ((*pSrcBufVA & 0x01) && (ADHOC_ON(pAd))) - Cipher = pAd->StaCfg.GroupCipher; // Cipher for Multicast or Broadcast - else - Cipher = pAd->StaCfg.PairCipher; // Cipher for Unicast - - if (RTMP_GET_PACKET_EAPOL(pTxBlk->pPacket)) - { - ASSERT(pAd->SharedKey[BSS0][0].CipherAlg <= CIPHER_CKIP128); - - // 4-way handshaking frame must be clear - if (!(TX_BLK_TEST_FLAG(pTxBlk, fTX_bClearEAPFrame)) && (pAd->SharedKey[BSS0][0].CipherAlg) && - (pAd->SharedKey[BSS0][0].KeyLen)) - { - CipherAlg = pAd->SharedKey[BSS0][0].CipherAlg; - KeyIdx = 0; - } - } - else if (Cipher == Ndis802_11Encryption1Enabled) - { - KeyIdx = pAd->StaCfg.DefaultKeyId; - } - else if ((Cipher == Ndis802_11Encryption2Enabled) || - (Cipher == Ndis802_11Encryption3Enabled)) - { - if ((*pSrcBufVA & 0x01) && (ADHOC_ON(pAd))) // multicast - KeyIdx = pAd->StaCfg.DefaultKeyId; - else if (pAd->SharedKey[BSS0][0].KeyLen) - KeyIdx = 0; - else - KeyIdx = pAd->StaCfg.DefaultKeyId; - } - - if (KeyIdx == 0xff) - CipherAlg = CIPHER_NONE; - else if ((Cipher == Ndis802_11EncryptionDisabled) || (pAd->SharedKey[BSS0][KeyIdx].KeyLen == 0)) - CipherAlg = CIPHER_NONE; -#ifdef WPA_SUPPLICANT_SUPPORT - else if ( pAd->StaCfg.WpaSupplicantUP && - (Cipher == Ndis802_11Encryption1Enabled) && - (pAd->StaCfg.IEEE8021X == TRUE) && - (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED)) - CipherAlg = CIPHER_NONE; -#endif // WPA_SUPPLICANT_SUPPORT // - else - { - //Header_802_11.FC.Wep = 1; - CipherAlg = pAd->SharedKey[BSS0][KeyIdx].CipherAlg; - pKey = &pAd->SharedKey[BSS0][KeyIdx]; - } - } - - pTxBlk->CipherAlg = CipherAlg; - pTxBlk->pKey = pKey; -} - - -VOID STABuildCommon802_11Header( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk) -{ - - HEADER_802_11 *pHeader_802_11; -#ifdef QOS_DLS_SUPPORT - BOOLEAN bDLSFrame = FALSE; - INT DlsEntryIndex = 0; -#endif // QOS_DLS_SUPPORT // - - // - // MAKE A COMMON 802.11 HEADER - // - - // normal wlan header size : 24 octets - pTxBlk->MpduHeaderLen = sizeof(HEADER_802_11); - - pHeader_802_11 = (HEADER_802_11 *) &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; - - NdisZeroMemory(pHeader_802_11, sizeof(HEADER_802_11)); - - pHeader_802_11->FC.FrDs = 0; - pHeader_802_11->FC.Type = BTYPE_DATA; - pHeader_802_11->FC.SubType = ((TX_BLK_TEST_FLAG(pTxBlk, fTX_bWMM)) ? SUBTYPE_QDATA : SUBTYPE_DATA); - -#ifdef QOS_DLS_SUPPORT - if (INFRA_ON(pAd)) - { - // Check if the frame can be sent through DLS direct link interface - // If packet can be sent through DLS, then force aggregation disable. (Hard to determine peer STA's capability) - DlsEntryIndex = RTMPCheckDLSFrame(pAd, pTxBlk->pSrcBufHeader); - if (DlsEntryIndex >= 0) - bDLSFrame = TRUE; - else - bDLSFrame = FALSE; - } -#endif // QOS_DLS_SUPPORT // - - if (pTxBlk->pMacEntry) - { - if (TX_BLK_TEST_FLAG(pTxBlk, fTX_bForceNonQoS)) - { - pHeader_802_11->Sequence = pTxBlk->pMacEntry->NonQosDataSeq; - pTxBlk->pMacEntry->NonQosDataSeq = (pTxBlk->pMacEntry->NonQosDataSeq+1) & MAXSEQ; - } - else - { - { - pHeader_802_11->Sequence = pTxBlk->pMacEntry->TxSeq[pTxBlk->UserPriority]; - pTxBlk->pMacEntry->TxSeq[pTxBlk->UserPriority] = (pTxBlk->pMacEntry->TxSeq[pTxBlk->UserPriority]+1) & MAXSEQ; - } - } - } - else - { - pHeader_802_11->Sequence = pAd->Sequence; - pAd->Sequence = (pAd->Sequence+1) & MAXSEQ; // next sequence - } - - pHeader_802_11->Frag = 0; - - pHeader_802_11->FC.MoreData = TX_BLK_TEST_FLAG(pTxBlk, fTX_bMoreData); - - { - if (INFRA_ON(pAd)) - { -#ifdef QOS_DLS_SUPPORT - if (bDLSFrame) - { - COPY_MAC_ADDR(pHeader_802_11->Addr1, pTxBlk->pSrcBufHeader); - COPY_MAC_ADDR(pHeader_802_11->Addr2, pAd->CurrentAddress); - COPY_MAC_ADDR(pHeader_802_11->Addr3, pAd->CommonCfg.Bssid); - pHeader_802_11->FC.ToDs = 0; - } - else -#endif // QOS_DLS_SUPPORT // - { - COPY_MAC_ADDR(pHeader_802_11->Addr1, pAd->CommonCfg.Bssid); - COPY_MAC_ADDR(pHeader_802_11->Addr2, pAd->CurrentAddress); - COPY_MAC_ADDR(pHeader_802_11->Addr3, pTxBlk->pSrcBufHeader); - pHeader_802_11->FC.ToDs = 1; - } - } - else if (ADHOC_ON(pAd)) - { - COPY_MAC_ADDR(pHeader_802_11->Addr1, pTxBlk->pSrcBufHeader); - COPY_MAC_ADDR(pHeader_802_11->Addr2, pAd->CurrentAddress); - COPY_MAC_ADDR(pHeader_802_11->Addr3, pAd->CommonCfg.Bssid); - pHeader_802_11->FC.ToDs = 0; - } - } - - if (pTxBlk->CipherAlg != CIPHER_NONE) - pHeader_802_11->FC.Wep = 1; - - // ----------------------------------------------------------------- - // STEP 2. MAKE A COMMON 802.11 HEADER SHARED BY ENTIRE FRAGMENT BURST. Fill sequence later. - // ----------------------------------------------------------------- - if (pAd->CommonCfg.bAPSDForcePowerSave) - pHeader_802_11->FC.PwrMgmt = PWR_SAVE; - else - pHeader_802_11->FC.PwrMgmt = (pAd->StaCfg.Psm == PWR_SAVE); -} - -#ifdef DOT11_N_SUPPORT -VOID STABuildCache802_11Header( - IN RTMP_ADAPTER *pAd, - IN TX_BLK *pTxBlk, - IN UCHAR *pHeader) -{ - MAC_TABLE_ENTRY *pMacEntry; - PHEADER_802_11 pHeader80211; - - pHeader80211 = (PHEADER_802_11)pHeader; - pMacEntry = pTxBlk->pMacEntry; - - // - // Update the cached 802.11 HEADER - // - - // normal wlan header size : 24 octets - pTxBlk->MpduHeaderLen = sizeof(HEADER_802_11); - - // More Bit - pHeader80211->FC.MoreData = TX_BLK_TEST_FLAG(pTxBlk, fTX_bMoreData); - - // Sequence - pHeader80211->Sequence = pMacEntry->TxSeq[pTxBlk->UserPriority]; - pMacEntry->TxSeq[pTxBlk->UserPriority] = (pMacEntry->TxSeq[pTxBlk->UserPriority]+1) & MAXSEQ; - - { - // Check if the frame can be sent through DLS direct link interface - // If packet can be sent through DLS, then force aggregation disable. (Hard to determine peer STA's capability) -#ifdef QOS_DLS_SUPPORT - BOOLEAN bDLSFrame = FALSE; - INT DlsEntryIndex = 0; - - DlsEntryIndex = RTMPCheckDLSFrame(pAd, pTxBlk->pSrcBufHeader); - if (DlsEntryIndex >= 0) - bDLSFrame = TRUE; - else - bDLSFrame = FALSE; -#endif // QOS_DLS_SUPPORT // - - // The addr3 of normal packet send from DS is Dest Mac address. -#ifdef QOS_DLS_SUPPORT - if (bDLSFrame) - { - COPY_MAC_ADDR(pHeader80211->Addr1, pTxBlk->pSrcBufHeader); - COPY_MAC_ADDR(pHeader80211->Addr3, pAd->CommonCfg.Bssid); - pHeader80211->FC.ToDs = 0; - } - else -#endif // QOS_DLS_SUPPORT // - if (ADHOC_ON(pAd)) - COPY_MAC_ADDR(pHeader80211->Addr3, pAd->CommonCfg.Bssid); - else - COPY_MAC_ADDR(pHeader80211->Addr3, pTxBlk->pSrcBufHeader); - } - - // ----------------------------------------------------------------- - // STEP 2. MAKE A COMMON 802.11 HEADER SHARED BY ENTIRE FRAGMENT BURST. Fill sequence later. - // ----------------------------------------------------------------- - if (pAd->CommonCfg.bAPSDForcePowerSave) - pHeader80211->FC.PwrMgmt = PWR_SAVE; - else - pHeader80211->FC.PwrMgmt = (pAd->StaCfg.Psm == PWR_SAVE); -} -#endif // DOT11_N_SUPPORT // - -static inline PUCHAR STA_Build_ARalink_Frame_Header( - IN RTMP_ADAPTER *pAd, - IN TX_BLK *pTxBlk) -{ - PUCHAR pHeaderBufPtr; - HEADER_802_11 *pHeader_802_11; - PNDIS_PACKET pNextPacket; - UINT32 nextBufLen; - PQUEUE_ENTRY pQEntry; - - STAFindCipherAlgorithm(pAd, pTxBlk); - STABuildCommon802_11Header(pAd, pTxBlk); - - - pHeaderBufPtr = &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; - pHeader_802_11 = (HEADER_802_11 *) pHeaderBufPtr; - - // steal "order" bit to mark "aggregation" - pHeader_802_11->FC.Order = 1; - - // skip common header - pHeaderBufPtr += pTxBlk->MpduHeaderLen; - - if (TX_BLK_TEST_FLAG(pTxBlk, fTX_bWMM)) - { - // - // build QOS Control bytes - // - *pHeaderBufPtr = (pTxBlk->UserPriority & 0x0F); - - *(pHeaderBufPtr+1) = 0; - pHeaderBufPtr +=2; - pTxBlk->MpduHeaderLen += 2; - } - - // padding at front of LLC header. LLC header should at 4-bytes aligment. - pTxBlk->HdrPadLen = (ULONG)pHeaderBufPtr; - pHeaderBufPtr = (PUCHAR)ROUND_UP(pHeaderBufPtr, 4); - pTxBlk->HdrPadLen = (ULONG)(pHeaderBufPtr - pTxBlk->HdrPadLen); - - // For RA Aggregation, - // put the 2nd MSDU length(extra 2-byte field) after QOS_CONTROL in little endian format - pQEntry = pTxBlk->TxPacketList.Head; - pNextPacket = QUEUE_ENTRY_TO_PACKET(pQEntry); - nextBufLen = GET_OS_PKT_LEN(pNextPacket); - if (RTMP_GET_PACKET_VLAN(pNextPacket)) - nextBufLen -= LENGTH_802_1Q; - - *pHeaderBufPtr = (UCHAR)nextBufLen & 0xff; - *(pHeaderBufPtr+1) = (UCHAR)(nextBufLen >> 8); - - pHeaderBufPtr += 2; - pTxBlk->MpduHeaderLen += 2; - - return pHeaderBufPtr; - -} - -#ifdef DOT11_N_SUPPORT -static inline PUCHAR STA_Build_AMSDU_Frame_Header( - IN RTMP_ADAPTER *pAd, - IN TX_BLK *pTxBlk) -{ - PUCHAR pHeaderBufPtr;//, pSaveBufPtr; - HEADER_802_11 *pHeader_802_11; - - - STAFindCipherAlgorithm(pAd, pTxBlk); - STABuildCommon802_11Header(pAd, pTxBlk); - - pHeaderBufPtr = &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; - pHeader_802_11 = (HEADER_802_11 *) pHeaderBufPtr; - - // skip common header - pHeaderBufPtr += pTxBlk->MpduHeaderLen; - - // - // build QOS Control bytes - // - *pHeaderBufPtr = (pTxBlk->UserPriority & 0x0F); - - // - // A-MSDU packet - // - *pHeaderBufPtr |= 0x80; - - *(pHeaderBufPtr+1) = 0; - pHeaderBufPtr +=2; - pTxBlk->MpduHeaderLen += 2; - - //pSaveBufPtr = pHeaderBufPtr; - - // - // padding at front of LLC header - // LLC header should locate at 4-octets aligment - // - // @@@ MpduHeaderLen excluding padding @@@ - // - pTxBlk->HdrPadLen = (ULONG)pHeaderBufPtr; - pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); - pTxBlk->HdrPadLen = (ULONG)(pHeaderBufPtr - pTxBlk->HdrPadLen); - - return pHeaderBufPtr; - -} - - -VOID STA_AMPDU_Frame_Tx( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk) -{ - HEADER_802_11 *pHeader_802_11; - PUCHAR pHeaderBufPtr; - USHORT FreeNumber; - MAC_TABLE_ENTRY *pMacEntry; - BOOLEAN bVLANPkt; - PQUEUE_ENTRY pQEntry; - - ASSERT(pTxBlk); - - while(pTxBlk->TxPacketList.Head) - { - pQEntry = RemoveHeadQueue(&pTxBlk->TxPacketList); - pTxBlk->pPacket = QUEUE_ENTRY_TO_PACKET(pQEntry); - if ( RTMP_FillTxBlkInfo(pAd, pTxBlk) != TRUE) - { - RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_FAILURE); - continue; - } - - bVLANPkt = (RTMP_GET_PACKET_VLAN(pTxBlk->pPacket) ? TRUE : FALSE); - - pMacEntry = pTxBlk->pMacEntry; - if (pMacEntry->isCached) - { - // NOTE: Please make sure the size of pMacEntry->CachedBuf[] is smaller than pTxBlk->HeaderBuf[]!!!! - NdisMoveMemory((PUCHAR)&pTxBlk->HeaderBuf[TXINFO_SIZE], (PUCHAR)&pMacEntry->CachedBuf[0], TXWI_SIZE + sizeof(HEADER_802_11)); - pHeaderBufPtr = (PUCHAR)(&pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]); - STABuildCache802_11Header(pAd, pTxBlk, pHeaderBufPtr); - } - else - { - STAFindCipherAlgorithm(pAd, pTxBlk); - STABuildCommon802_11Header(pAd, pTxBlk); - - pHeaderBufPtr = &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; - } - - - pHeader_802_11 = (HEADER_802_11 *) pHeaderBufPtr; - - // skip common header - pHeaderBufPtr += pTxBlk->MpduHeaderLen; - - // - // build QOS Control bytes - // - *pHeaderBufPtr = (pTxBlk->UserPriority & 0x0F); - *(pHeaderBufPtr+1) = 0; - pHeaderBufPtr +=2; - pTxBlk->MpduHeaderLen += 2; - - // - // build HTC+ - // HTC control filed following QoS field - // - if ((pAd->CommonCfg.bRdg == TRUE) && CLIENT_STATUS_TEST_FLAG(pTxBlk->pMacEntry, fCLIENT_STATUS_RDG_CAPABLE)) - { - if (pMacEntry->isCached == FALSE) - { - // mark HTC bit - pHeader_802_11->FC.Order = 1; - - NdisZeroMemory(pHeaderBufPtr, 4); - *(pHeaderBufPtr+3) |= 0x80; - } - pHeaderBufPtr += 4; - pTxBlk->MpduHeaderLen += 4; - } - - //pTxBlk->MpduHeaderLen = pHeaderBufPtr - pTxBlk->HeaderBuf - TXWI_SIZE - TXINFO_SIZE; - ASSERT(pTxBlk->MpduHeaderLen >= 24); - - // skip 802.3 header - pTxBlk->pSrcBufData = pTxBlk->pSrcBufHeader + LENGTH_802_3; - pTxBlk->SrcBufLen -= LENGTH_802_3; - - // skip vlan tag - if (bVLANPkt) - { - pTxBlk->pSrcBufData += LENGTH_802_1Q; - pTxBlk->SrcBufLen -= LENGTH_802_1Q; - } - - // - // padding at front of LLC header - // LLC header should locate at 4-octets aligment - // - // @@@ MpduHeaderLen excluding padding @@@ - // - pTxBlk->HdrPadLen = (ULONG)pHeaderBufPtr; - pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); - pTxBlk->HdrPadLen = (ULONG)(pHeaderBufPtr - pTxBlk->HdrPadLen); - - { - - // - // Insert LLC-SNAP encapsulation - 8 octets - // - EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(pTxBlk->pSrcBufData-2, pTxBlk->pExtraLlcSnapEncap); - if (pTxBlk->pExtraLlcSnapEncap) - { - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pExtraLlcSnapEncap, 6); - pHeaderBufPtr += 6; - // get 2 octets (TypeofLen) - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufData-2, 2); - pHeaderBufPtr += 2; - pTxBlk->MpduHeaderLen += LENGTH_802_1_H; - } - - } - - if (pMacEntry->isCached) - { - RTMPWriteTxWI_Cache(pAd, (PTXWI_STRUC)(&pTxBlk->HeaderBuf[TXINFO_SIZE]), pTxBlk); - } - else - { - RTMPWriteTxWI_Data(pAd, (PTXWI_STRUC)(&pTxBlk->HeaderBuf[TXINFO_SIZE]), pTxBlk); - - NdisZeroMemory((PUCHAR)(&pMacEntry->CachedBuf[0]), sizeof(pMacEntry->CachedBuf)); - NdisMoveMemory((PUCHAR)(&pMacEntry->CachedBuf[0]), (PUCHAR)(&pTxBlk->HeaderBuf[TXINFO_SIZE]), (pHeaderBufPtr - (PUCHAR)(&pTxBlk->HeaderBuf[TXINFO_SIZE]))); - pMacEntry->isCached = TRUE; - } - - // calculate Transmitted AMPDU count and ByteCount - { - pAd->RalinkCounters.TransmittedMPDUsInAMPDUCount.u.LowPart ++; - pAd->RalinkCounters.TransmittedOctetsInAMPDUCount.QuadPart += pTxBlk->SrcBufLen; - } - - //FreeNumber = GET_TXRING_FREENO(pAd, QueIdx); - - HAL_WriteTxResource(pAd, pTxBlk, TRUE, &FreeNumber); - - // - // Kick out Tx - // - if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_DISABLE_TX)) - HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); - - pAd->RalinkCounters.KickTxCount++; - pAd->RalinkCounters.OneSecTxDoneCount++; - } - -} - - -VOID STA_AMSDU_Frame_Tx( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk) -{ - PUCHAR pHeaderBufPtr; - USHORT FreeNumber; - USHORT subFramePayloadLen = 0; // AMSDU Subframe length without AMSDU-Header / Padding. - USHORT totalMPDUSize=0; - UCHAR *subFrameHeader; - UCHAR padding = 0; - USHORT FirstTx = 0, LastTxIdx = 0; - BOOLEAN bVLANPkt; - int frameNum = 0; - PQUEUE_ENTRY pQEntry; - - - ASSERT(pTxBlk); - - ASSERT((pTxBlk->TxPacketList.Number > 1)); - - while(pTxBlk->TxPacketList.Head) - { - pQEntry = RemoveHeadQueue(&pTxBlk->TxPacketList); - pTxBlk->pPacket = QUEUE_ENTRY_TO_PACKET(pQEntry); - if (RTMP_FillTxBlkInfo(pAd, pTxBlk) != TRUE) - { - RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_FAILURE); - continue; - } - - bVLANPkt = (RTMP_GET_PACKET_VLAN(pTxBlk->pPacket) ? TRUE : FALSE); - - // skip 802.3 header - pTxBlk->pSrcBufData = pTxBlk->pSrcBufHeader + LENGTH_802_3; - pTxBlk->SrcBufLen -= LENGTH_802_3; - - // skip vlan tag - if (bVLANPkt) - { - pTxBlk->pSrcBufData += LENGTH_802_1Q; - pTxBlk->SrcBufLen -= LENGTH_802_1Q; - } - - if (frameNum == 0) - { - pHeaderBufPtr = STA_Build_AMSDU_Frame_Header(pAd, pTxBlk); - - // NOTE: TxWI->MPDUtotalByteCount will be updated after final frame was handled. - RTMPWriteTxWI_Data(pAd, (PTXWI_STRUC)(&pTxBlk->HeaderBuf[TXINFO_SIZE]), pTxBlk); - } - else - { - pHeaderBufPtr = &pTxBlk->HeaderBuf[0]; - padding = ROUND_UP(LENGTH_AMSDU_SUBFRAMEHEAD + subFramePayloadLen, 4) - (LENGTH_AMSDU_SUBFRAMEHEAD + subFramePayloadLen); - NdisZeroMemory(pHeaderBufPtr, padding + LENGTH_AMSDU_SUBFRAMEHEAD); - pHeaderBufPtr += padding; - pTxBlk->MpduHeaderLen = padding; - } - - // - // A-MSDU subframe - // DA(6)+SA(6)+Length(2) + LLC/SNAP Encap - // - subFrameHeader = pHeaderBufPtr; - subFramePayloadLen = pTxBlk->SrcBufLen; - - NdisMoveMemory(subFrameHeader, pTxBlk->pSrcBufHeader, 12); - - - pHeaderBufPtr += LENGTH_AMSDU_SUBFRAMEHEAD; - pTxBlk->MpduHeaderLen += LENGTH_AMSDU_SUBFRAMEHEAD; - - - // - // Insert LLC-SNAP encapsulation - 8 octets - // - EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(pTxBlk->pSrcBufData-2, pTxBlk->pExtraLlcSnapEncap); - - subFramePayloadLen = pTxBlk->SrcBufLen; - - if (pTxBlk->pExtraLlcSnapEncap) - { - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pExtraLlcSnapEncap, 6); - pHeaderBufPtr += 6; - // get 2 octets (TypeofLen) - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufData-2, 2); - pHeaderBufPtr += 2; - pTxBlk->MpduHeaderLen += LENGTH_802_1_H; - subFramePayloadLen += LENGTH_802_1_H; - } - - // update subFrame Length field - subFrameHeader[12] = (subFramePayloadLen & 0xFF00) >> 8; - subFrameHeader[13] = subFramePayloadLen & 0xFF; - - totalMPDUSize += pTxBlk->MpduHeaderLen + pTxBlk->SrcBufLen; - - if (frameNum ==0) - FirstTx = HAL_WriteMultiTxResource(pAd, pTxBlk, frameNum, &FreeNumber); - else - LastTxIdx = HAL_WriteMultiTxResource(pAd, pTxBlk, frameNum, &FreeNumber); - - frameNum++; - - pAd->RalinkCounters.KickTxCount++; - pAd->RalinkCounters.OneSecTxDoneCount++; - - // calculate Transmitted AMSDU Count and ByteCount - { - pAd->RalinkCounters.TransmittedAMSDUCount.u.LowPart ++; - pAd->RalinkCounters.TransmittedOctetsInAMSDU.QuadPart += totalMPDUSize; - } - - } - - HAL_FinalWriteTxResource(pAd, pTxBlk, totalMPDUSize, FirstTx); - HAL_LastTxIdx(pAd, pTxBlk->QueIdx, LastTxIdx); - - // - // Kick out Tx - // - if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_DISABLE_TX)) - HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); -} -#endif // DOT11_N_SUPPORT // - -VOID STA_Legacy_Frame_Tx( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk) -{ - HEADER_802_11 *pHeader_802_11; - PUCHAR pHeaderBufPtr; - USHORT FreeNumber; - BOOLEAN bVLANPkt; - PQUEUE_ENTRY pQEntry; - - ASSERT(pTxBlk); - - - pQEntry = RemoveHeadQueue(&pTxBlk->TxPacketList); - pTxBlk->pPacket = QUEUE_ENTRY_TO_PACKET(pQEntry); - if (RTMP_FillTxBlkInfo(pAd, pTxBlk) != TRUE) - { - RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_FAILURE); - return; - } - - if (pTxBlk->TxFrameType == TX_MCAST_FRAME) - { - INC_COUNTER64(pAd->WlanCounters.MulticastTransmittedFrameCount); - } - - if (RTMP_GET_PACKET_RTS(pTxBlk->pPacket)) - TX_BLK_SET_FLAG(pTxBlk, fTX_bRtsRequired); - else - TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bRtsRequired); - - bVLANPkt = (RTMP_GET_PACKET_VLAN(pTxBlk->pPacket) ? TRUE : FALSE); - - if (pTxBlk->TxRate < pAd->CommonCfg.MinTxRate) - pTxBlk->TxRate = pAd->CommonCfg.MinTxRate; - - STAFindCipherAlgorithm(pAd, pTxBlk); - STABuildCommon802_11Header(pAd, pTxBlk); - - - // skip 802.3 header - pTxBlk->pSrcBufData = pTxBlk->pSrcBufHeader + LENGTH_802_3; - pTxBlk->SrcBufLen -= LENGTH_802_3; - - // skip vlan tag - if (bVLANPkt) - { - pTxBlk->pSrcBufData += LENGTH_802_1Q; - pTxBlk->SrcBufLen -= LENGTH_802_1Q; - } - - pHeaderBufPtr = &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; - pHeader_802_11 = (HEADER_802_11 *) pHeaderBufPtr; - - // skip common header - pHeaderBufPtr += pTxBlk->MpduHeaderLen; - - if (TX_BLK_TEST_FLAG(pTxBlk, fTX_bWMM)) - { - // - // build QOS Control bytes - // - *(pHeaderBufPtr) = ((pTxBlk->UserPriority & 0x0F) | (pAd->CommonCfg.AckPolicy[pTxBlk->QueIdx]<<5)); - *(pHeaderBufPtr+1) = 0; - pHeaderBufPtr +=2; - pTxBlk->MpduHeaderLen += 2; - } - - // The remaining content of MPDU header should locate at 4-octets aligment - pTxBlk->HdrPadLen = (ULONG)pHeaderBufPtr; - pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); - pTxBlk->HdrPadLen = (ULONG)(pHeaderBufPtr - pTxBlk->HdrPadLen); - - { - - // - // Insert LLC-SNAP encapsulation - 8 octets - // - // - // if original Ethernet frame contains no LLC/SNAP, - // then an extra LLC/SNAP encap is required - // - EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(pTxBlk->pSrcBufHeader, pTxBlk->pExtraLlcSnapEncap); - if (pTxBlk->pExtraLlcSnapEncap) - { - UCHAR vlan_size; - - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pExtraLlcSnapEncap, 6); - pHeaderBufPtr += 6; - // skip vlan tag - vlan_size = (bVLANPkt) ? LENGTH_802_1Q : 0; - // get 2 octets (TypeofLen) - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufHeader+12+vlan_size, 2); - pHeaderBufPtr += 2; - pTxBlk->MpduHeaderLen += LENGTH_802_1_H; - } - - } - - // - // prepare for TXWI - // use Wcid as Key Index - // - - RTMPWriteTxWI_Data(pAd, (PTXWI_STRUC)(&pTxBlk->HeaderBuf[TXINFO_SIZE]), pTxBlk); - - //FreeNumber = GET_TXRING_FREENO(pAd, QueIdx); - - HAL_WriteTxResource(pAd, pTxBlk, TRUE, &FreeNumber); - - pAd->RalinkCounters.KickTxCount++; - pAd->RalinkCounters.OneSecTxDoneCount++; - - // - // Kick out Tx - // - if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_DISABLE_TX)) - HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); -} - - -VOID STA_ARalink_Frame_Tx( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk) -{ - PUCHAR pHeaderBufPtr; - USHORT FreeNumber; - USHORT totalMPDUSize=0; - USHORT FirstTx, LastTxIdx; - int frameNum = 0; - BOOLEAN bVLANPkt; - PQUEUE_ENTRY pQEntry; - - - ASSERT(pTxBlk); - - ASSERT((pTxBlk->TxPacketList.Number== 2)); - - - FirstTx = LastTxIdx = 0; // Is it ok init they as 0? - while(pTxBlk->TxPacketList.Head) - { - pQEntry = RemoveHeadQueue(&pTxBlk->TxPacketList); - pTxBlk->pPacket = QUEUE_ENTRY_TO_PACKET(pQEntry); - - if (RTMP_FillTxBlkInfo(pAd, pTxBlk) != TRUE) - { - RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_FAILURE); - continue; - } - - bVLANPkt = (RTMP_GET_PACKET_VLAN(pTxBlk->pPacket) ? TRUE : FALSE); - - // skip 802.3 header - pTxBlk->pSrcBufData = pTxBlk->pSrcBufHeader + LENGTH_802_3; - pTxBlk->SrcBufLen -= LENGTH_802_3; - - // skip vlan tag - if (bVLANPkt) - { - pTxBlk->pSrcBufData += LENGTH_802_1Q; - pTxBlk->SrcBufLen -= LENGTH_802_1Q; - } - - if (frameNum == 0) - { // For first frame, we need to create the 802.11 header + padding(optional) + RA-AGG-LEN + SNAP Header - - pHeaderBufPtr = STA_Build_ARalink_Frame_Header(pAd, pTxBlk); - - // It's ok write the TxWI here, because the TxWI->MPDUtotalByteCount - // will be updated after final frame was handled. - RTMPWriteTxWI_Data(pAd, (PTXWI_STRUC)(&pTxBlk->HeaderBuf[TXINFO_SIZE]), pTxBlk); - - - // - // Insert LLC-SNAP encapsulation - 8 octets - // - EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(pTxBlk->pSrcBufData-2, pTxBlk->pExtraLlcSnapEncap); - - if (pTxBlk->pExtraLlcSnapEncap) - { - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pExtraLlcSnapEncap, 6); - pHeaderBufPtr += 6; - // get 2 octets (TypeofLen) - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufData-2, 2); - pHeaderBufPtr += 2; - pTxBlk->MpduHeaderLen += LENGTH_802_1_H; - } - } - else - { // For second aggregated frame, we need create the 802.3 header to headerBuf, because PCI will copy it to SDPtr0. - - pHeaderBufPtr = &pTxBlk->HeaderBuf[0]; - pTxBlk->MpduHeaderLen = 0; - - // A-Ralink sub-sequent frame header is the same as 802.3 header. - // DA(6)+SA(6)+FrameType(2) - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufHeader, 12); - pHeaderBufPtr += 12; - // get 2 octets (TypeofLen) - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufData-2, 2); - pHeaderBufPtr += 2; - pTxBlk->MpduHeaderLen = LENGTH_ARALINK_SUBFRAMEHEAD; - } - - totalMPDUSize += pTxBlk->MpduHeaderLen + pTxBlk->SrcBufLen; - - //FreeNumber = GET_TXRING_FREENO(pAd, QueIdx); - if (frameNum ==0) - FirstTx = HAL_WriteMultiTxResource(pAd, pTxBlk, frameNum, &FreeNumber); - else - LastTxIdx = HAL_WriteMultiTxResource(pAd, pTxBlk, frameNum, &FreeNumber); - - frameNum++; - - pAd->RalinkCounters.OneSecTxAggregationCount++; - pAd->RalinkCounters.KickTxCount++; - pAd->RalinkCounters.OneSecTxDoneCount++; - - } - - HAL_FinalWriteTxResource(pAd, pTxBlk, totalMPDUSize, FirstTx); - HAL_LastTxIdx(pAd, pTxBlk->QueIdx, LastTxIdx); - - // - // Kick out Tx - // - if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_DISABLE_TX)) - HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); - -} - - -VOID STA_Fragment_Frame_Tx( - IN RTMP_ADAPTER *pAd, - IN TX_BLK *pTxBlk) -{ - HEADER_802_11 *pHeader_802_11; - PUCHAR pHeaderBufPtr; - USHORT FreeNumber; - UCHAR fragNum = 0; - PACKET_INFO PacketInfo; - USHORT EncryptionOverhead = 0; - UINT32 FreeMpduSize, SrcRemainingBytes; - USHORT AckDuration; - UINT NextMpduSize; - BOOLEAN bVLANPkt; - PQUEUE_ENTRY pQEntry; - HTTRANSMIT_SETTING *pTransmit; - - - ASSERT(pTxBlk); - - pQEntry = RemoveHeadQueue(&pTxBlk->TxPacketList); - pTxBlk->pPacket = QUEUE_ENTRY_TO_PACKET(pQEntry); - if (RTMP_FillTxBlkInfo(pAd, pTxBlk) != TRUE) - { - RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_FAILURE); - return; - } - - ASSERT(TX_BLK_TEST_FLAG(pTxBlk, fTX_bAllowFrag)); - bVLANPkt = (RTMP_GET_PACKET_VLAN(pTxBlk->pPacket) ? TRUE : FALSE); - - STAFindCipherAlgorithm(pAd, pTxBlk); - STABuildCommon802_11Header(pAd, pTxBlk); - - if (pTxBlk->CipherAlg == CIPHER_TKIP) - { - pTxBlk->pPacket = duplicate_pkt_with_TKIP_MIC(pAd, pTxBlk->pPacket); - if (pTxBlk->pPacket == NULL) - return; - RTMP_QueryPacketInfo(pTxBlk->pPacket, &PacketInfo, &pTxBlk->pSrcBufHeader, &pTxBlk->SrcBufLen); - } - - // skip 802.3 header - pTxBlk->pSrcBufData = pTxBlk->pSrcBufHeader + LENGTH_802_3; - pTxBlk->SrcBufLen -= LENGTH_802_3; - - - // skip vlan tag - if (bVLANPkt) - { - pTxBlk->pSrcBufData += LENGTH_802_1Q; - pTxBlk->SrcBufLen -= LENGTH_802_1Q; - } - - pHeaderBufPtr = &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; - pHeader_802_11 = (HEADER_802_11 *)pHeaderBufPtr; - - - // skip common header - pHeaderBufPtr += pTxBlk->MpduHeaderLen; - - if (TX_BLK_TEST_FLAG(pTxBlk, fTX_bWMM)) - { - // - // build QOS Control bytes - // - *pHeaderBufPtr = (pTxBlk->UserPriority & 0x0F); - - *(pHeaderBufPtr+1) = 0; - pHeaderBufPtr +=2; - pTxBlk->MpduHeaderLen += 2; - } - - // - // padding at front of LLC header - // LLC header should locate at 4-octets aligment - // - pTxBlk->HdrPadLen = (ULONG)pHeaderBufPtr; - pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); - pTxBlk->HdrPadLen = (ULONG)(pHeaderBufPtr - pTxBlk->HdrPadLen); - - - - // - // Insert LLC-SNAP encapsulation - 8 octets - // - // - // if original Ethernet frame contains no LLC/SNAP, - // then an extra LLC/SNAP encap is required - // - EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(pTxBlk->pSrcBufHeader, pTxBlk->pExtraLlcSnapEncap); - if (pTxBlk->pExtraLlcSnapEncap) - { - UCHAR vlan_size; - - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pExtraLlcSnapEncap, 6); - pHeaderBufPtr += 6; - // skip vlan tag - vlan_size = (bVLANPkt) ? LENGTH_802_1Q : 0; - // get 2 octets (TypeofLen) - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufHeader+12+vlan_size, 2); - pHeaderBufPtr += 2; - pTxBlk->MpduHeaderLen += LENGTH_802_1_H; - } - - - // If TKIP is used and fragmentation is required. Driver has to - // append TKIP MIC at tail of the scatter buffer - // MAC ASIC will only perform IV/EIV/ICV insertion but no TKIP MIC - if (pTxBlk->CipherAlg == CIPHER_TKIP) - { - RTMPCalculateMICValue(pAd, pTxBlk->pPacket, pTxBlk->pExtraLlcSnapEncap, pTxBlk->pKey, 0); - - // NOTE: DON'T refer the skb->len directly after following copy. Becasue the length is not adjust - // to correct lenght, refer to pTxBlk->SrcBufLen for the packet length in following progress. - NdisMoveMemory(pTxBlk->pSrcBufData + pTxBlk->SrcBufLen, &pAd->PrivateInfo.Tx.MIC[0], 8); - //skb_put((RTPKT_TO_OSPKT(pTxBlk->pPacket))->tail, 8); - pTxBlk->SrcBufLen += 8; - pTxBlk->TotalFrameLen += 8; - pTxBlk->CipherAlg = CIPHER_TKIP_NO_MIC; - } - - // - // calcuate the overhead bytes that encryption algorithm may add. This - // affects the calculate of "duration" field - // - if ((pTxBlk->CipherAlg == CIPHER_WEP64) || (pTxBlk->CipherAlg == CIPHER_WEP128)) - EncryptionOverhead = 8; //WEP: IV[4] + ICV[4]; - else if (pTxBlk->CipherAlg == CIPHER_TKIP_NO_MIC) - EncryptionOverhead = 12;//TKIP: IV[4] + EIV[4] + ICV[4], MIC will be added to TotalPacketLength - else if (pTxBlk->CipherAlg == CIPHER_TKIP) - EncryptionOverhead = 20;//TKIP: IV[4] + EIV[4] + ICV[4] + MIC[8] - else if (pTxBlk->CipherAlg == CIPHER_AES) - EncryptionOverhead = 16; // AES: IV[4] + EIV[4] + MIC[8] - else - EncryptionOverhead = 0; - - pTransmit = pTxBlk->pTransmit; - // Decide the TX rate - if (pTransmit->field.MODE == MODE_CCK) - pTxBlk->TxRate = pTransmit->field.MCS; - else if (pTransmit->field.MODE == MODE_OFDM) - pTxBlk->TxRate = pTransmit->field.MCS + RATE_FIRST_OFDM_RATE; - else - pTxBlk->TxRate = RATE_6_5; - - // decide how much time an ACK/CTS frame will consume in the air - if (pTxBlk->TxRate <= RATE_LAST_OFDM_RATE) - AckDuration = RTMPCalcDuration(pAd, pAd->CommonCfg.ExpectedACKRate[pTxBlk->TxRate], 14); - else - AckDuration = RTMPCalcDuration(pAd, RATE_6_5, 14); - - // Init the total payload length of this frame. - SrcRemainingBytes = pTxBlk->SrcBufLen; - - pTxBlk->TotalFragNum = 0xff; - - do { - - FreeMpduSize = pAd->CommonCfg.FragmentThreshold - LENGTH_CRC; - - FreeMpduSize -= pTxBlk->MpduHeaderLen; - - if (SrcRemainingBytes <= FreeMpduSize) - { // this is the last or only fragment - - pTxBlk->SrcBufLen = SrcRemainingBytes; - - pHeader_802_11->FC.MoreFrag = 0; - pHeader_802_11->Duration = pAd->CommonCfg.Dsifs + AckDuration; - - // Indicate the lower layer that this's the last fragment. - pTxBlk->TotalFragNum = fragNum; - } - else - { // more fragment is required - - pTxBlk->SrcBufLen = FreeMpduSize; - - NextMpduSize = min(((UINT)SrcRemainingBytes - pTxBlk->SrcBufLen), ((UINT)pAd->CommonCfg.FragmentThreshold)); - pHeader_802_11->FC.MoreFrag = 1; - pHeader_802_11->Duration = (3 * pAd->CommonCfg.Dsifs) + (2 * AckDuration) + RTMPCalcDuration(pAd, pTxBlk->TxRate, NextMpduSize + EncryptionOverhead); - } - - if (fragNum == 0) - pTxBlk->FrameGap = IFS_HTTXOP; - else - pTxBlk->FrameGap = IFS_SIFS; - - RTMPWriteTxWI_Data(pAd, (PTXWI_STRUC)(&pTxBlk->HeaderBuf[TXINFO_SIZE]), pTxBlk); - - HAL_WriteFragTxResource(pAd, pTxBlk, fragNum, &FreeNumber); - - pAd->RalinkCounters.KickTxCount++; - pAd->RalinkCounters.OneSecTxDoneCount++; - - // Update the frame number, remaining size of the NDIS packet payload. - - // space for 802.11 header. - if (fragNum == 0 && pTxBlk->pExtraLlcSnapEncap) - pTxBlk->MpduHeaderLen -= LENGTH_802_1_H; - - fragNum++; - SrcRemainingBytes -= pTxBlk->SrcBufLen; - pTxBlk->pSrcBufData += pTxBlk->SrcBufLen; - - pHeader_802_11->Frag++; // increase Frag # - - }while(SrcRemainingBytes > 0); - - // - // Kick out Tx - // - if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_DISABLE_TX)) - HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); -} - - -#define RELEASE_FRAMES_OF_TXBLK(_pAd, _pTxBlk, _pQEntry, _Status) \ - while(_pTxBlk->TxPacketList.Head) \ - { \ - _pQEntry = RemoveHeadQueue(&_pTxBlk->TxPacketList); \ - RELEASE_NDIS_PACKET(_pAd, QUEUE_ENTRY_TO_PACKET(_pQEntry), _Status); \ - } - - -/* - ======================================================================== - - Routine Description: - Copy frame from waiting queue into relative ring buffer and set - appropriate ASIC register to kick hardware encryption before really - sent out to air. - - Arguments: - pAd Pointer to our adapter - PNDIS_PACKET Pointer to outgoing Ndis frame - NumberOfFrag Number of fragment required - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -NDIS_STATUS STAHardTransmit( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR QueIdx) -{ - NDIS_PACKET *pPacket; - PQUEUE_ENTRY pQEntry; - - // --------------------------------------------- - // STEP 0. DO SANITY CHECK AND SOME EARLY PREPARATION. - // --------------------------------------------- - // - ASSERT(pTxBlk->TxPacketList.Number); - if (pTxBlk->TxPacketList.Head == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("pTxBlk->TotalFrameNum == %ld!\n", pTxBlk->TxPacketList.Number)); - return NDIS_STATUS_FAILURE; - } - - pPacket = QUEUE_ENTRY_TO_PACKET(pTxBlk->TxPacketList.Head); - - - // ------------------------------------------------------------------ - // STEP 1. WAKE UP PHY - // outgoing frame always wakeup PHY to prevent frame lost and - // turn off PSM bit to improve performance - // ------------------------------------------------------------------ - // not to change PSM bit, just send this frame out? - if ((pAd->StaCfg.Psm == PWR_SAVE) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - DBGPRINT_RAW(RT_DEBUG_INFO, ("AsicForceWakeup At HardTx\n")); -#ifdef RTMP_MAC_PCI - AsicForceWakeup(pAd, TRUE); -#endif // RTMP_MAC_PCI // - } - - // It should not change PSM bit, when APSD turn on. - if ((!(pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable) && (pAd->CommonCfg.bAPSDForcePowerSave == FALSE)) - || (RTMP_GET_PACKET_EAPOL(pTxBlk->pPacket)) - || (RTMP_GET_PACKET_WAI(pTxBlk->pPacket))) - { - if ((pAd->StaCfg.Psm == PWR_SAVE) && - (pAd->StaCfg.WindowsPowerMode == Ndis802_11PowerModeFast_PSP)) - RTMP_SET_PSM_BIT(pAd, PWR_ACTIVE); - } - - switch (pTxBlk->TxFrameType) - { -#ifdef DOT11_N_SUPPORT - case TX_AMPDU_FRAME: - STA_AMPDU_Frame_Tx(pAd, pTxBlk); - break; - case TX_AMSDU_FRAME: - STA_AMSDU_Frame_Tx(pAd, pTxBlk); - break; -#endif // DOT11_N_SUPPORT // - case TX_LEGACY_FRAME: - STA_Legacy_Frame_Tx(pAd, pTxBlk); - break; - case TX_MCAST_FRAME: - STA_Legacy_Frame_Tx(pAd, pTxBlk); - break; - case TX_RALINK_FRAME: - STA_ARalink_Frame_Tx(pAd, pTxBlk); - break; - case TX_FRAG_FRAME: - STA_Fragment_Frame_Tx(pAd, pTxBlk); - break; - default: - { - // It should not happened! - DBGPRINT(RT_DEBUG_ERROR, ("Send a pacekt was not classified!! It should not happen!\n")); - while(pTxBlk->TxPacketList.Number) - { - pQEntry = RemoveHeadQueue(&pTxBlk->TxPacketList); - pPacket = QUEUE_ENTRY_TO_PACKET(pQEntry); - if (pPacket) - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - } - } - break; - } - - return (NDIS_STATUS_SUCCESS); - -} - -ULONG HashBytesPolynomial(UCHAR *value, unsigned int len) -{ - unsigned char *word = value; - unsigned int ret = 0; - unsigned int i; - - for(i=0; i < len; i++) - { - int mod = i % 32; - ret ^=(unsigned int) (word[i]) << mod; - ret ^=(unsigned int) (word[i]) >> (32 - mod); - } - return ret; -} - -VOID Sta_Announce_or_Forward_802_3_Packet( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN UCHAR FromWhichBSSID) -{ - if (TRUE - ) - { - announce_802_3_packet(pAd, pPacket); - } - else - { - // release packet - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - } -} diff --git a/drivers/staging/rt3090/sta/sanity.c b/drivers/staging/rt3090/sta/sanity.c deleted file mode 100644 index aeda15bd5bca..000000000000 --- a/drivers/staging/rt3090/sta/sanity.c +++ /dev/null @@ -1,382 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - sanity.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - John Chang 2004-09-01 add WMM support -*/ - -#include "../rt_config.h" - - -extern UCHAR CISCO_OUI[]; - -extern UCHAR WPA_OUI[]; -extern UCHAR RSN_OUI[]; -extern UCHAR WME_INFO_ELEM[]; -extern UCHAR WME_PARM_ELEM[]; -extern UCHAR Ccx2QosInfo[]; -extern UCHAR RALINK_OUI[]; -extern UCHAR BROADCOM_OUI[]; - -/* - ========================================================================== - Description: - MLME message sanity check - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== - */ -BOOLEAN MlmeStartReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT CHAR Ssid[], - OUT UCHAR *pSsidLen) -{ - MLME_START_REQ_STRUCT *Info; - - Info = (MLME_START_REQ_STRUCT *)(Msg); - - if (Info->SsidLen > MAX_LEN_OF_SSID) - { - DBGPRINT(RT_DEBUG_TRACE, ("MlmeStartReqSanity fail - wrong SSID length\n")); - return FALSE; - } - - *pSsidLen = Info->SsidLen; - NdisMoveMemory(Ssid, Info->Ssid, *pSsidLen); - - return TRUE; -} - -/* - ========================================================================== - Description: - MLME message sanity check - Return: - TRUE if all parameters are OK, FALSE otherwise - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -BOOLEAN PeerAssocRspSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *pCapabilityInfo, - OUT USHORT *pStatus, - OUT USHORT *pAid, - OUT UCHAR SupRate[], - OUT UCHAR *pSupRateLen, - OUT UCHAR ExtRate[], - OUT UCHAR *pExtRateLen, - OUT HT_CAPABILITY_IE *pHtCapability, - OUT ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE - OUT UCHAR *pHtCapabilityLen, - OUT UCHAR *pAddHtInfoLen, - OUT UCHAR *pNewExtChannelOffset, - OUT PEDCA_PARM pEdcaParm, - OUT UCHAR *pCkipFlag) -{ - CHAR IeType, *Ptr; - PFRAME_802_11 pFrame = (PFRAME_802_11)pMsg; - PEID_STRUCT pEid; - ULONG Length = 0; - - *pNewExtChannelOffset = 0xff; - *pHtCapabilityLen = 0; - *pAddHtInfoLen = 0; - COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); - Ptr = (PCHAR)pFrame->Octet; - Length += LENGTH_802_11; - - NdisMoveMemory(pCapabilityInfo, &pFrame->Octet[0], 2); - Length += 2; - NdisMoveMemory(pStatus, &pFrame->Octet[2], 2); - Length += 2; - *pCkipFlag = 0; - *pExtRateLen = 0; - pEdcaParm->bValid = FALSE; - - if (*pStatus != MLME_SUCCESS) - return TRUE; - - NdisMoveMemory(pAid, &pFrame->Octet[4], 2); - Length += 2; - - // Aid already swaped byte order in RTMPFrameEndianChange() for big endian platform - *pAid = (*pAid) & 0x3fff; // AID is low 14-bit - - // -- get supported rates from payload and advance the pointer - IeType = pFrame->Octet[6]; - *pSupRateLen = pFrame->Octet[7]; - if ((IeType != IE_SUPP_RATES) || (*pSupRateLen > MAX_LEN_OF_SUPPORTED_RATES)) - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerAssocRspSanity fail - wrong SupportedRates IE\n")); - return FALSE; - } - else - NdisMoveMemory(SupRate, &pFrame->Octet[8], *pSupRateLen); - - - Length = Length + 2 + *pSupRateLen; - - // many AP implement proprietary IEs in non-standard order, we'd better - // tolerate mis-ordered IEs to get best compatibility - pEid = (PEID_STRUCT) &pFrame->Octet[8 + (*pSupRateLen)]; - - // get variable fields from payload and advance the pointer - while ((Length + 2 + pEid->Len) <= MsgLen) - { - switch (pEid->Eid) - { - case IE_EXT_SUPP_RATES: - if (pEid->Len <= MAX_LEN_OF_SUPPORTED_RATES) - { - NdisMoveMemory(ExtRate, pEid->Octet, pEid->Len); - *pExtRateLen = pEid->Len; - } - break; - - case IE_HT_CAP: - case IE_HT_CAP2: - if (pEid->Len >= SIZE_HT_CAP_IE) //Note: allow extension.!! - { - NdisMoveMemory(pHtCapability, pEid->Octet, SIZE_HT_CAP_IE); - - *(USHORT *)(&pHtCapability->HtCapInfo) = cpu2le16(*(USHORT *)(&pHtCapability->HtCapInfo)); - *(USHORT *)(&pHtCapability->ExtHtCapInfo) = cpu2le16(*(USHORT *)(&pHtCapability->ExtHtCapInfo)); - - *pHtCapabilityLen = SIZE_HT_CAP_IE; - } - else - { - DBGPRINT(RT_DEBUG_WARN, ("PeerAssocRspSanity - wrong IE_HT_CAP. \n")); - } - - break; -#ifdef DOT11_N_SUPPORT - case IE_ADD_HT: - case IE_ADD_HT2: - if (pEid->Len >= sizeof(ADD_HT_INFO_IE)) - { - // This IE allows extension, but we can ignore extra bytes beyond our knowledge , so only - // copy first sizeof(ADD_HT_INFO_IE) - NdisMoveMemory(pAddHtInfo, pEid->Octet, sizeof(ADD_HT_INFO_IE)); - - *(USHORT *)(&pAddHtInfo->AddHtInfo2) = cpu2le16(*(USHORT *)(&pAddHtInfo->AddHtInfo2)); - *(USHORT *)(&pAddHtInfo->AddHtInfo3) = cpu2le16(*(USHORT *)(&pAddHtInfo->AddHtInfo3)); - - *pAddHtInfoLen = SIZE_ADD_HT_INFO_IE; - } - else - { - DBGPRINT(RT_DEBUG_WARN, ("PeerAssocRspSanity - wrong IE_ADD_HT. \n")); - } - - break; - case IE_SECONDARY_CH_OFFSET: - if (pEid->Len == 1) - { - *pNewExtChannelOffset = pEid->Octet[0]; - } - else - { - DBGPRINT(RT_DEBUG_WARN, ("PeerAssocRspSanity - wrong IE_SECONDARY_CH_OFFSET. \n")); - } -#endif // DOT11_N_SUPPORT // - break; - - case IE_VENDOR_SPECIFIC: - // handle WME PARAMTER ELEMENT - if (NdisEqualMemory(pEid->Octet, WME_PARM_ELEM, 6) && (pEid->Len == 24)) - { - PUCHAR ptr; - int i; - - // parsing EDCA parameters - pEdcaParm->bValid = TRUE; - pEdcaParm->bQAck = FALSE; // pEid->Octet[0] & 0x10; - pEdcaParm->bQueueRequest = FALSE; // pEid->Octet[0] & 0x20; - pEdcaParm->bTxopRequest = FALSE; // pEid->Octet[0] & 0x40; - //pEdcaParm->bMoreDataAck = FALSE; // pEid->Octet[0] & 0x80; - pEdcaParm->EdcaUpdateCount = pEid->Octet[6] & 0x0f; - pEdcaParm->bAPSDCapable = (pEid->Octet[6] & 0x80) ? 1 : 0; - ptr = (PUCHAR)&pEid->Octet[8]; - for (i=0; i<4; i++) - { - UCHAR aci = (*ptr & 0x60) >> 5; // b5~6 is AC INDEX - pEdcaParm->bACM[aci] = (((*ptr) & 0x10) == 0x10); // b5 is ACM - pEdcaParm->Aifsn[aci] = (*ptr) & 0x0f; // b0~3 is AIFSN - pEdcaParm->Cwmin[aci] = *(ptr+1) & 0x0f; // b0~4 is Cwmin - pEdcaParm->Cwmax[aci] = *(ptr+1) >> 4; // b5~8 is Cwmax - pEdcaParm->Txop[aci] = *(ptr+2) + 256 * (*(ptr+3)); // in unit of 32-us - ptr += 4; // point to next AC - } - } - break; - default: - DBGPRINT(RT_DEBUG_TRACE, ("PeerAssocRspSanity - ignore unrecognized EID = %d\n", pEid->Eid)); - break; - } - - Length = Length + 2 + pEid->Len; - pEid = (PEID_STRUCT)((UCHAR*)pEid + 2 + pEid->Len); - } - - - return TRUE; -} - -/* - ========================================================================== - Description: - MLME message sanity check - Return: - TRUE if all parameters are OK, FALSE otherwise - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -BOOLEAN PeerProbeReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT CHAR Ssid[], - OUT UCHAR *pSsidLen) -{ - UCHAR Idx; - UCHAR RateLen; - CHAR IeType; - PFRAME_802_11 pFrame = (PFRAME_802_11)Msg; - - COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); - - if ((pFrame->Octet[0] != IE_SSID) || (pFrame->Octet[1] > MAX_LEN_OF_SSID)) - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerProbeReqSanity fail - wrong SSID IE(Type=%d,Len=%d)\n",pFrame->Octet[0],pFrame->Octet[1])); - return FALSE; - } - - *pSsidLen = pFrame->Octet[1]; - NdisMoveMemory(Ssid, &pFrame->Octet[2], *pSsidLen); - - Idx = *pSsidLen + 2; - - // -- get supported rates from payload and advance the pointer - IeType = pFrame->Octet[Idx]; - RateLen = pFrame->Octet[Idx + 1]; - if (IeType != IE_SUPP_RATES) - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerProbeReqSanity fail - wrong SupportRates IE(Type=%d,Len=%d)\n",pFrame->Octet[Idx],pFrame->Octet[Idx+1])); - return FALSE; - } - else - { - if ((pAd->CommonCfg.PhyMode == PHY_11G) && (RateLen < 8)) - return (FALSE); - } - - return TRUE; -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -BOOLEAN GetTimBit( - IN CHAR *Ptr, - IN USHORT Aid, - OUT UCHAR *TimLen, - OUT UCHAR *BcastFlag, - OUT UCHAR *DtimCount, - OUT UCHAR *DtimPeriod, - OUT UCHAR *MessageToMe) -{ - UCHAR BitCntl, N1, N2, MyByte, MyBit; - CHAR *IdxPtr; - - IdxPtr = Ptr; - - IdxPtr ++; - *TimLen = *IdxPtr; - - // get DTIM Count from TIM element - IdxPtr ++; - *DtimCount = *IdxPtr; - - // get DTIM Period from TIM element - IdxPtr++; - *DtimPeriod = *IdxPtr; - - // get Bitmap Control from TIM element - IdxPtr++; - BitCntl = *IdxPtr; - - if ((*DtimCount == 0) && (BitCntl & 0x01)) - *BcastFlag = TRUE; - else - *BcastFlag = FALSE; - - // Parse Partial Virtual Bitmap from TIM element - N1 = BitCntl & 0xfe; // N1 is the first bitmap byte# - N2 = *TimLen - 4 + N1; // N2 is the last bitmap byte# - - if ((Aid < (N1 << 3)) || (Aid >= ((N2 + 1) << 3))) - *MessageToMe = FALSE; - else - { - MyByte = (Aid >> 3) - N1; // my byte position in the bitmap byte-stream - MyBit = Aid % 16 - ((MyByte & 0x01)? 8:0); - - IdxPtr += (MyByte + 1); - - //if (*IdxPtr) - // DBGPRINT(RT_DEBUG_WARN, ("TIM bitmap = 0x%02x\n", *IdxPtr)); - - if (*IdxPtr & (0x01 << MyBit)) - *MessageToMe = TRUE; - else - *MessageToMe = FALSE; - } - - return TRUE; -} diff --git a/drivers/staging/rt3090/sta/sync.c b/drivers/staging/rt3090/sta/sync.c deleted file mode 100644 index 2520e038cb82..000000000000 --- a/drivers/staging/rt3090/sta/sync.c +++ /dev/null @@ -1,1840 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - sync.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - John Chang 2004-09-01 modified for rt2561/2661 - Jan Lee 2006-08-01 modified for rt2860 for 802.11n -*/ - -#include "../rt_config.h" - - -#define ADHOC_ENTRY_BEACON_LOST_TIME (2*OS_HZ) // 2 sec - -/* - ========================================================================== - Description: - The sync state machine, - Parameters: - Sm - pointer to the state machine - Note: - the state machine looks like the following - - ========================================================================== - */ -VOID SyncStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *Sm, - OUT STATE_MACHINE_FUNC Trans[]) -{ - StateMachineInit(Sm, Trans, MAX_SYNC_STATE, MAX_SYNC_MSG, (STATE_MACHINE_FUNC)Drop, SYNC_IDLE, SYNC_MACHINE_BASE); - - // column 1 - StateMachineSetAction(Sm, SYNC_IDLE, MT2_MLME_SCAN_REQ, (STATE_MACHINE_FUNC)MlmeScanReqAction); - StateMachineSetAction(Sm, SYNC_IDLE, MT2_MLME_JOIN_REQ, (STATE_MACHINE_FUNC)MlmeJoinReqAction); - StateMachineSetAction(Sm, SYNC_IDLE, MT2_MLME_START_REQ, (STATE_MACHINE_FUNC)MlmeStartReqAction); - StateMachineSetAction(Sm, SYNC_IDLE, MT2_PEER_BEACON, (STATE_MACHINE_FUNC)PeerBeacon); - StateMachineSetAction(Sm, SYNC_IDLE, MT2_PEER_PROBE_REQ, (STATE_MACHINE_FUNC)PeerProbeReqAction); - - //column 2 - StateMachineSetAction(Sm, JOIN_WAIT_BEACON, MT2_MLME_SCAN_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenScan); - StateMachineSetAction(Sm, JOIN_WAIT_BEACON, MT2_MLME_JOIN_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenJoin); - StateMachineSetAction(Sm, JOIN_WAIT_BEACON, MT2_MLME_START_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenStart); - StateMachineSetAction(Sm, JOIN_WAIT_BEACON, MT2_PEER_BEACON, (STATE_MACHINE_FUNC)PeerBeaconAtJoinAction); - StateMachineSetAction(Sm, JOIN_WAIT_BEACON, MT2_BEACON_TIMEOUT, (STATE_MACHINE_FUNC)BeaconTimeoutAtJoinAction); - - // column 3 - StateMachineSetAction(Sm, SCAN_LISTEN, MT2_MLME_SCAN_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenScan); - StateMachineSetAction(Sm, SCAN_LISTEN, MT2_MLME_JOIN_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenJoin); - StateMachineSetAction(Sm, SCAN_LISTEN, MT2_MLME_START_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenStart); - StateMachineSetAction(Sm, SCAN_LISTEN, MT2_PEER_BEACON, (STATE_MACHINE_FUNC)PeerBeaconAtScanAction); - StateMachineSetAction(Sm, SCAN_LISTEN, MT2_PEER_PROBE_RSP, (STATE_MACHINE_FUNC)PeerBeaconAtScanAction); - StateMachineSetAction(Sm, SCAN_LISTEN, MT2_SCAN_TIMEOUT, (STATE_MACHINE_FUNC)ScanTimeoutAction); - - // timer init - RTMPInitTimer(pAd, &pAd->MlmeAux.BeaconTimer, GET_TIMER_FUNCTION(BeaconTimeout), pAd, FALSE); - RTMPInitTimer(pAd, &pAd->MlmeAux.ScanTimer, GET_TIMER_FUNCTION(ScanTimeout), pAd, FALSE); -} - -/* - ========================================================================== - Description: - Beacon timeout handler, executed in timer thread - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID BeaconTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; - - DBGPRINT(RT_DEBUG_TRACE,("SYNC - BeaconTimeout\n")); - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) - return; - -#ifdef DOT11_N_SUPPORT - if ((pAd->CommonCfg.BBPCurrentBW == BW_40) - ) - { - UCHAR BBPValue = 0; - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue &= (~0x18); - BBPValue |= 0x10; - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - End of SCAN, restore to 40MHz channel %d, Total BSS[%02d]\n",pAd->CommonCfg.CentralChannel, pAd->ScanTab.BssNr)); - } -#endif // DOT11_N_SUPPORT // - - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_BEACON_TIMEOUT, 0, NULL); - RTMP_MLME_HANDLER(pAd); -} - -/* - ========================================================================== - Description: - Scan timeout handler, executed in timer thread - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID ScanTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; - - - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) - return; - - if (MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_SCAN_TIMEOUT, 0, NULL)) - { - RTMP_MLME_HANDLER(pAd); -} - else - { - // To prevent SyncMachine.CurrState is SCAN_LISTEN forever. - pAd->MlmeAux.Channel = 0; - ScanNextChannel(pAd); - if (pAd->CommonCfg.bWirelessEvent) - { - RTMPSendWirelessEvent(pAd, IW_SCAN_ENQUEUE_FAIL_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - } - } -} - -/* - ========================================================================== - Description: - MLME SCAN req state machine procedure - ========================================================================== - */ -VOID MlmeScanReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR Ssid[MAX_LEN_OF_SSID], SsidLen, ScanType, BssType, BBPValue = 0; - BOOLEAN TimerCancelled; - ULONG Now; - USHORT Status; - PHEADER_802_11 pHdr80211; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - - // Check the total scan tries for one single OID command - // If this is the CCX 2.0 Case, skip that! - if ( !RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_START_UP)) - { - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - MlmeScanReqAction before Startup\n")); - return; - } - - // Increase the scan retry counters. - pAd->StaCfg.ScanCnt++; - -#ifdef RTMP_MAC_PCI - if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) && - (IDLE_ON(pAd)) && - (pAd->StaCfg.bRadio == TRUE) && - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) - { - if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) - { - AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x02); - AsicCheckCommanOk(pAd, PowerWakeCID); - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); - DBGPRINT(RT_DEBUG_TRACE, ("PSM - Issue Wake up command \n")); - } - else - { - RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); - } - } -#endif // RTMP_MAC_PCI // - - // first check the parameter sanity - if (MlmeScanReqSanity(pAd, - Elem->Msg, - Elem->MsgLen, - &BssType, - (PCHAR)Ssid, - &SsidLen, - &ScanType)) - { - - // Check for channel load and noise hist request - // Suspend MSDU only at scan request, not the last two mentioned - // Suspend MSDU transmission here - RTMPSuspendMsduTransmission(pAd); - - // - // To prevent data lost. - // Send an NULL data with turned PSM bit on to current associated AP before SCAN progress. - // And should send an NULL data with turned PSM bit off to AP, when scan progress done - // - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) && (INFRA_ON(pAd))) - { - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); - if (NStatus == NDIS_STATUS_SUCCESS) - { - pHdr80211 = (PHEADER_802_11) pOutBuffer; - MgtMacHeaderInit(pAd, pHdr80211, SUBTYPE_NULL_FUNC, 1, pAd->CommonCfg.Bssid, pAd->CommonCfg.Bssid); - pHdr80211->Duration = 0; - pHdr80211->FC.Type = BTYPE_DATA; - pHdr80211->FC.PwrMgmt = PWR_SAVE; - - // Send using priority queue - MiniportMMRequest(pAd, 0, pOutBuffer, sizeof(HEADER_802_11)); - DBGPRINT(RT_DEBUG_TRACE, ("MlmeScanReqAction -- Send PSM Data frame for off channel RM\n")); - MlmeFreeMemory(pAd, pOutBuffer); - RTMPusecDelay(5000); - } - } - - NdisGetSystemUpTime(&Now); - pAd->StaCfg.LastScanTime = Now; - // reset all the timers - RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &TimerCancelled); - RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &TimerCancelled); - - // record desired BSS parameters - pAd->MlmeAux.BssType = BssType; - pAd->MlmeAux.ScanType = ScanType; - pAd->MlmeAux.SsidLen = SsidLen; - NdisZeroMemory(pAd->MlmeAux.Ssid, MAX_LEN_OF_SSID); - NdisMoveMemory(pAd->MlmeAux.Ssid, Ssid, SsidLen); - - // start from the first channel - pAd->MlmeAux.Channel = FirstChannel(pAd); - - // Let BBP register at 20MHz to do scan - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue &= (~0x18); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - BBP R4 to 20MHz.l\n")); - ScanNextChannel(pAd); - } - else - { - DBGPRINT_ERR(("SYNC - MlmeScanReqAction() sanity check fail\n")); - pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; - Status = MLME_INVALID_FORMAT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_SCAN_CONF, 2, &Status); - } -} - -/* - ========================================================================== - Description: - MLME JOIN req state machine procedure - ========================================================================== - */ -VOID MlmeJoinReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR BBPValue = 0; - BSS_ENTRY *pBss; - BOOLEAN TimerCancelled; - HEADER_802_11 Hdr80211; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - PUCHAR pOutBuffer = NULL; - PUCHAR pSupRate = NULL; - UCHAR SupRateLen; - PUCHAR pExtRate = NULL; - UCHAR ExtRateLen; - UCHAR ASupRate[] = {0x8C, 0x12, 0x98, 0x24, 0xb0, 0x48, 0x60, 0x6C}; - UCHAR ASupRateLen = sizeof(ASupRate)/sizeof(UCHAR); - MLME_JOIN_REQ_STRUCT *pInfo = (MLME_JOIN_REQ_STRUCT *)(Elem->Msg); - - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - MlmeJoinReqAction(BSS #%ld)\n", pInfo->BssIdx)); - -#ifdef RTMP_MAC_PCI - if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) && - (IDLE_ON(pAd)) && - (pAd->StaCfg.bRadio == TRUE) && - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) - { - RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); - } -#endif // RTMP_MAC_PCI // - - // reset all the timers - RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &TimerCancelled); - RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &TimerCancelled); - - pBss = &pAd->MlmeAux.SsidBssTab.BssEntry[pInfo->BssIdx]; - - // record the desired SSID & BSSID we're waiting for - COPY_MAC_ADDR(pAd->MlmeAux.Bssid, pBss->Bssid); - - // If AP's SSID is not hidden, it is OK for updating ssid to MlmeAux again. - if (pBss->Hidden == 0) - { - RTMPZeroMemory(pAd->MlmeAux.Ssid, MAX_LEN_OF_SSID); - NdisMoveMemory(pAd->MlmeAux.Ssid, pBss->Ssid, pBss->SsidLen); - pAd->MlmeAux.SsidLen = pBss->SsidLen; - } - - pAd->MlmeAux.BssType = pBss->BssType; - pAd->MlmeAux.Channel = pBss->Channel; - pAd->MlmeAux.CentralChannel = pBss->CentralChannel; - -#ifdef EXT_BUILD_CHANNEL_LIST - // Country IE of the AP will be evaluated and will be used. - if ((pAd->StaCfg.IEEE80211dClientMode != Rt802_11_D_None) && - (pBss->bHasCountryIE == TRUE)) - { - NdisMoveMemory(&pAd->CommonCfg.CountryCode[0], &pBss->CountryString[0], 2); - if (pBss->CountryString[2] == 'I') - pAd->CommonCfg.Geography = IDOR; - else if (pBss->CountryString[2] == 'O') - pAd->CommonCfg.Geography = ODOR; - else - pAd->CommonCfg.Geography = BOTH; - BuildChannelListEx(pAd); - } -#endif // EXT_BUILD_CHANNEL_LIST // - - // Let BBP register at 20MHz to do scan - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue &= (~0x18); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - BBP R4 to 20MHz.l\n")); - - // switch channel and waiting for beacon timer - AsicSwitchChannel(pAd, pAd->MlmeAux.Channel, FALSE); - AsicLockChannel(pAd, pAd->MlmeAux.Channel); - - - RTMPSetTimer(&pAd->MlmeAux.BeaconTimer, JOIN_TIMEOUT); - - do - { - if (((pAd->CommonCfg.bIEEE80211H == 1) && - (pAd->MlmeAux.Channel > 14) && - RadarChannelCheck(pAd, pAd->MlmeAux.Channel)) -#ifdef CARRIER_DETECTION_SUPPORT // Roger sync Carrier - || (pAd->CommonCfg.CarrierDetect.Enable == TRUE) -#endif // CARRIER_DETECTION_SUPPORT // - ) - { - // - // We can't send any Probe request frame to meet 802.11h. - // - if (pBss->Hidden == 0) - break; - } - - // - // send probe request - // - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); - if (NStatus == NDIS_STATUS_SUCCESS) - { - if (pAd->MlmeAux.Channel <= 14) - { - pSupRate = pAd->CommonCfg.SupRate; - SupRateLen = pAd->CommonCfg.SupRateLen; - pExtRate = pAd->CommonCfg.ExtRate; - ExtRateLen = pAd->CommonCfg.ExtRateLen; - } - else - { - // - // Overwrite Support Rate, CCK rate are not allowed - // - pSupRate = ASupRate; - SupRateLen = ASupRateLen; - ExtRateLen = 0; - } - - if (pAd->MlmeAux.BssType == BSS_INFRA) - MgtMacHeaderInit(pAd, &Hdr80211, SUBTYPE_PROBE_REQ, 0, pAd->MlmeAux.Bssid, pAd->MlmeAux.Bssid); - else - MgtMacHeaderInit(pAd, &Hdr80211, SUBTYPE_PROBE_REQ, 0, BROADCAST_ADDR, BROADCAST_ADDR); - - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &Hdr80211, - 1, &SsidIe, - 1, &pAd->MlmeAux.SsidLen, - pAd->MlmeAux.SsidLen, pAd->MlmeAux.Ssid, - 1, &SupRateIe, - 1, &SupRateLen, - SupRateLen, pSupRate, - END_OF_ARGS); - - if (ExtRateLen) - { - ULONG Tmp; - MakeOutgoingFrame(pOutBuffer + FrameLen, &Tmp, - 1, &ExtRateIe, - 1, &ExtRateLen, - ExtRateLen, pExtRate, - END_OF_ARGS); - FrameLen += Tmp; - } - - - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - } - } while (FALSE); - - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - Switch to ch %d, Wait BEACON from %02x:%02x:%02x:%02x:%02x:%02x\n", - pBss->Channel, pBss->Bssid[0], pBss->Bssid[1], pBss->Bssid[2], pBss->Bssid[3], pBss->Bssid[4], pBss->Bssid[5])); - - pAd->Mlme.SyncMachine.CurrState = JOIN_WAIT_BEACON; -} - -/* - ========================================================================== - Description: - MLME START Request state machine procedure, starting an IBSS - ========================================================================== - */ -VOID MlmeStartReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR Ssid[MAX_LEN_OF_SSID], SsidLen; - BOOLEAN TimerCancelled; - - // New for WPA security suites - UCHAR VarIE[MAX_VIE_LEN]; // Total VIE length = MAX_VIE_LEN - -5 - NDIS_802_11_VARIABLE_IEs *pVIE = NULL; - LARGE_INTEGER TimeStamp; - BOOLEAN Privacy; - USHORT Status; - - // Init Variable IE structure - pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; - pVIE->Length = 0; - TimeStamp.u.LowPart = 0; - TimeStamp.u.HighPart = 0; - - if (MlmeStartReqSanity(pAd, Elem->Msg, Elem->MsgLen, (PCHAR)Ssid, &SsidLen)) - { - // reset all the timers - RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &TimerCancelled); - RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &TimerCancelled); - - // - // Start a new IBSS. All IBSS parameters are decided now.... - // - DBGPRINT(RT_DEBUG_TRACE, ("MlmeStartReqAction - Start a new IBSS. All IBSS parameters are decided now.... \n")); - pAd->MlmeAux.BssType = BSS_ADHOC; - NdisMoveMemory(pAd->MlmeAux.Ssid, Ssid, SsidLen); - pAd->MlmeAux.SsidLen = SsidLen; - - // generate a radom number as BSSID - MacAddrRandomBssid(pAd, pAd->MlmeAux.Bssid); - DBGPRINT(RT_DEBUG_TRACE, ("MlmeStartReqAction - generate a radom number as BSSID \n")); - - Privacy = (pAd->StaCfg.WepStatus == Ndis802_11Encryption1Enabled) || - (pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) || - (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled); - pAd->MlmeAux.CapabilityInfo = CAP_GENERATE(0,1,Privacy, (pAd->CommonCfg.TxPreamble == Rt802_11PreambleShort), 1, 0); - pAd->MlmeAux.BeaconPeriod = pAd->CommonCfg.BeaconPeriod; - pAd->MlmeAux.AtimWin = pAd->StaCfg.AtimWin; - pAd->MlmeAux.Channel = pAd->CommonCfg.Channel; - - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; - pAd->MlmeAux.CentralChannel = pAd->CommonCfg.CentralChannel; - - pAd->MlmeAux.SupRateLen= pAd->CommonCfg.SupRateLen; - NdisMoveMemory(pAd->MlmeAux.SupRate, pAd->CommonCfg.SupRate, MAX_LEN_OF_SUPPORTED_RATES); - RTMPCheckRates(pAd, pAd->MlmeAux.SupRate, &pAd->MlmeAux.SupRateLen); - pAd->MlmeAux.ExtRateLen = pAd->CommonCfg.ExtRateLen; - NdisMoveMemory(pAd->MlmeAux.ExtRate, pAd->CommonCfg.ExtRate, MAX_LEN_OF_SUPPORTED_RATES); - RTMPCheckRates(pAd, pAd->MlmeAux.ExtRate, &pAd->MlmeAux.ExtRateLen); -#ifdef DOT11_N_SUPPORT - if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) - { - RTMPUpdateHTIE(&pAd->CommonCfg.DesiredHtPhy, &pAd->StaCfg.DesiredHtPhyInfo.MCSSet[0], &pAd->MlmeAux.HtCapability, &pAd->MlmeAux.AddHtInfo); - pAd->MlmeAux.HtCapabilityLen = sizeof(HT_CAPABILITY_IE); - // Not turn pAd->StaActive.SupportedHtPhy.bHtEnable = TRUE here. - DBGPRINT(RT_DEBUG_TRACE, ("SYNC -pAd->StaActive.SupportedHtPhy.bHtEnable = TRUE\n")); - } - else -#endif // DOT11_N_SUPPORT // - { - pAd->MlmeAux.HtCapabilityLen = 0; - pAd->StaActive.SupportedPhyInfo.bHtEnable = FALSE; - NdisZeroMemory(&pAd->StaActive.SupportedPhyInfo.MCSSet[0], 16); - } - // temporarily not support QOS in IBSS - NdisZeroMemory(&pAd->MlmeAux.APEdcaParm, sizeof(EDCA_PARM)); - NdisZeroMemory(&pAd->MlmeAux.APQbssLoad, sizeof(QBSS_LOAD_PARM)); - NdisZeroMemory(&pAd->MlmeAux.APQosCapability, sizeof(QOS_CAPABILITY_PARM)); - - AsicSwitchChannel(pAd, pAd->MlmeAux.Channel, FALSE); - AsicLockChannel(pAd, pAd->MlmeAux.Channel); - - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - MlmeStartReqAction(ch= %d,sup rates= %d, ext rates=%d)\n", - pAd->MlmeAux.Channel, pAd->MlmeAux.SupRateLen, pAd->MlmeAux.ExtRateLen)); - - pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; - Status = MLME_SUCCESS; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_START_CONF, 2, &Status); - } - else - { - DBGPRINT_ERR(("SYNC - MlmeStartReqAction() sanity check fail.\n")); - pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; - Status = MLME_INVALID_FORMAT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_START_CONF, 2, &Status); - } -} - -/* - ========================================================================== - Description: - peer sends beacon back when scanning - ========================================================================== - */ -VOID PeerBeaconAtScanAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR Bssid[MAC_ADDR_LEN], Addr2[MAC_ADDR_LEN]; - UCHAR Ssid[MAX_LEN_OF_SSID], BssType, Channel, NewChannel, - SsidLen, DtimCount, DtimPeriod, BcastFlag, MessageToMe; - CF_PARM CfParm; - USHORT BeaconPeriod, AtimWin, CapabilityInfo; - PFRAME_802_11 pFrame; - LARGE_INTEGER TimeStamp; - UCHAR Erp; - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen, ExtRateLen; - USHORT LenVIE; - UCHAR CkipFlag; - UCHAR AironetCellPowerLimit; - EDCA_PARM EdcaParm; - QBSS_LOAD_PARM QbssLoad; - QOS_CAPABILITY_PARM QosCapability; - ULONG RalinkIe; - UCHAR VarIE[MAX_VIE_LEN]; // Total VIE length = MAX_VIE_LEN - -5 - NDIS_802_11_VARIABLE_IEs *pVIE = NULL; - HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE - UCHAR HtCapabilityLen = 0, PreNHtCapabilityLen = 0; - UCHAR AddHtInfoLen; - UCHAR NewExtChannelOffset = 0xff; - - - // NdisFillMemory(Ssid, MAX_LEN_OF_SSID, 0x00); - pFrame = (PFRAME_802_11) Elem->Msg; - // Init Variable IE structure - pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; - pVIE->Length = 0; -#ifdef DOT11_N_SUPPORT - RTMPZeroMemory(&HtCapability, sizeof(HtCapability)); - RTMPZeroMemory(&AddHtInfo, sizeof(ADD_HT_INFO_IE)); -#endif // DOT11_N_SUPPORT // - - if (PeerBeaconAndProbeRspSanity(pAd, - Elem->Msg, - Elem->MsgLen, - Elem->Channel, - Addr2, - Bssid, - (PCHAR)Ssid, - &SsidLen, - &BssType, - &BeaconPeriod, - &Channel, - &NewChannel, - &TimeStamp, - &CfParm, - &AtimWin, - &CapabilityInfo, - &Erp, - &DtimCount, - &DtimPeriod, - &BcastFlag, - &MessageToMe, - SupRate, - &SupRateLen, - ExtRate, - &ExtRateLen, - &CkipFlag, - &AironetCellPowerLimit, - &EdcaParm, - &QbssLoad, - &QosCapability, - &RalinkIe, - &HtCapabilityLen, - &PreNHtCapabilityLen, - &HtCapability, - &AddHtInfoLen, - &AddHtInfo, - &NewExtChannelOffset, - &LenVIE, - pVIE)) - { - ULONG Idx; - CHAR Rssi = 0; - - Idx = BssTableSearch(&pAd->ScanTab, Bssid, Channel); - if (Idx != BSS_NOT_FOUND) - Rssi = pAd->ScanTab.BssEntry[Idx].Rssi; - - Rssi = RTMPMaxRssi(pAd, ConvertToRssi(pAd, Elem->Rssi0, RSSI_0), ConvertToRssi(pAd, Elem->Rssi1, RSSI_1), ConvertToRssi(pAd, Elem->Rssi2, RSSI_2)); - - -#ifdef DOT11_N_SUPPORT - if ((HtCapabilityLen > 0) || (PreNHtCapabilityLen > 0)) - HtCapabilityLen = SIZE_HT_CAP_IE; -#endif // DOT11_N_SUPPORT // - - Idx = BssTableSetEntry(pAd, &pAd->ScanTab, Bssid, (PCHAR)Ssid, SsidLen, BssType, BeaconPeriod, - &CfParm, AtimWin, CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen, &HtCapability, - &AddHtInfo, HtCapabilityLen, AddHtInfoLen, NewExtChannelOffset, Channel, Rssi, TimeStamp, CkipFlag, - &EdcaParm, &QosCapability, &QbssLoad, LenVIE, pVIE); -#ifdef DOT11_N_SUPPORT -#ifdef DOT11N_DRAFT3 - if (pAd->ChannelList[pAd->CommonCfg.ChannelListIdx].bEffectedChannel == TRUE) - { - UCHAR RegClass; - PeerBeaconAndProbeRspSanity2(pAd, Elem->Msg, Elem->MsgLen, &RegClass); - TriEventTableSetEntry(pAd, &pAd->CommonCfg.TriggerEventTab, Bssid, &HtCapability, HtCapabilityLen, RegClass, Channel); - } -#endif // DOT11N_DRAFT3 // -#endif // DOT11_N_SUPPORT // - if (Idx != BSS_NOT_FOUND) - { - NdisMoveMemory(pAd->ScanTab.BssEntry[Idx].PTSF, &Elem->Msg[24], 4); - NdisMoveMemory(&pAd->ScanTab.BssEntry[Idx].TTSF[0], &Elem->TimeStamp.u.LowPart, 4); - NdisMoveMemory(&pAd->ScanTab.BssEntry[Idx].TTSF[4], &Elem->TimeStamp.u.LowPart, 4); - } - - } - // sanity check fail, ignored -} - -/* - ========================================================================== - Description: - When waiting joining the (I)BSS, beacon received from external - ========================================================================== - */ -VOID PeerBeaconAtJoinAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR Bssid[MAC_ADDR_LEN], Addr2[MAC_ADDR_LEN]; - UCHAR Ssid[MAX_LEN_OF_SSID], SsidLen, BssType, Channel, MessageToMe, - DtimCount, DtimPeriod, BcastFlag, NewChannel; - LARGE_INTEGER TimeStamp; - USHORT BeaconPeriod, AtimWin, CapabilityInfo; - CF_PARM Cf; - BOOLEAN TimerCancelled; - UCHAR Erp; - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen, ExtRateLen; - UCHAR CkipFlag; - USHORT LenVIE; - UCHAR AironetCellPowerLimit; - EDCA_PARM EdcaParm; - QBSS_LOAD_PARM QbssLoad; - QOS_CAPABILITY_PARM QosCapability; - USHORT Status; - UCHAR VarIE[MAX_VIE_LEN]; // Total VIE length = MAX_VIE_LEN - -5 - NDIS_802_11_VARIABLE_IEs *pVIE = NULL; - ULONG RalinkIe; - ULONG Idx; - HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE - UCHAR HtCapabilityLen = 0, PreNHtCapabilityLen = 0; - UCHAR AddHtInfoLen; - UCHAR NewExtChannelOffset = 0xff; -#ifdef DOT11_N_SUPPORT - UCHAR CentralChannel; - BOOLEAN bAllowNrate = FALSE; -#endif // DOT11_N_SUPPORT // - - // Init Variable IE structure - pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; - pVIE->Length = 0; - RTMPZeroMemory(&HtCapability, sizeof(HtCapability)); - RTMPZeroMemory(&AddHtInfo, sizeof(ADD_HT_INFO_IE)); - - - if (PeerBeaconAndProbeRspSanity(pAd, - Elem->Msg, - Elem->MsgLen, - Elem->Channel, - Addr2, - Bssid, - (PCHAR)Ssid, - &SsidLen, - &BssType, - &BeaconPeriod, - &Channel, - &NewChannel, - &TimeStamp, - &Cf, - &AtimWin, - &CapabilityInfo, - &Erp, - &DtimCount, - &DtimPeriod, - &BcastFlag, - &MessageToMe, - SupRate, - &SupRateLen, - ExtRate, - &ExtRateLen, - &CkipFlag, - &AironetCellPowerLimit, - &EdcaParm, - &QbssLoad, - &QosCapability, - &RalinkIe, - &HtCapabilityLen, - &PreNHtCapabilityLen, - &HtCapability, - &AddHtInfoLen, - &AddHtInfo, - &NewExtChannelOffset, - &LenVIE, - pVIE)) - { - // Disqualify 11b only adhoc when we are in 11g only adhoc mode - if ((BssType == BSS_ADHOC) && (pAd->CommonCfg.PhyMode == PHY_11G) && ((SupRateLen+ExtRateLen)< 12)) - return; - - // BEACON from desired BSS/IBSS found. We should be able to decide most - // BSS parameters here. - // Q. But what happen if this JOIN doesn't conclude a successful ASSOCIATEION? - // Do we need to receover back all parameters belonging to previous BSS? - // A. Should be not. There's no back-door recover to previous AP. It still need - // a new JOIN-AUTH-ASSOC sequence. - if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, Bssid)) - { - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - receive desired BEACON at JoinWaitBeacon... Channel = %d\n", Channel)); - RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &TimerCancelled); - - // Update RSSI to prevent No signal display when cards first initialized - pAd->StaCfg.RssiSample.LastRssi0 = ConvertToRssi(pAd, Elem->Rssi0, RSSI_0); - pAd->StaCfg.RssiSample.LastRssi1 = ConvertToRssi(pAd, Elem->Rssi1, RSSI_1); - pAd->StaCfg.RssiSample.LastRssi2 = ConvertToRssi(pAd, Elem->Rssi2, RSSI_2); - pAd->StaCfg.RssiSample.AvgRssi0 = pAd->StaCfg.RssiSample.LastRssi0; - pAd->StaCfg.RssiSample.AvgRssi0X8 = pAd->StaCfg.RssiSample.AvgRssi0 << 3; - pAd->StaCfg.RssiSample.AvgRssi1 = pAd->StaCfg.RssiSample.LastRssi1; - pAd->StaCfg.RssiSample.AvgRssi1X8 = pAd->StaCfg.RssiSample.AvgRssi1 << 3; - pAd->StaCfg.RssiSample.AvgRssi2 = pAd->StaCfg.RssiSample.LastRssi2; - pAd->StaCfg.RssiSample.AvgRssi2X8 = pAd->StaCfg.RssiSample.AvgRssi2 << 3; - - // - // We need to check if SSID only set to any, then we can record the current SSID. - // Otherwise will cause hidden SSID association failed. - // - if (pAd->MlmeAux.SsidLen == 0) - { - NdisMoveMemory(pAd->MlmeAux.Ssid, Ssid, SsidLen); - pAd->MlmeAux.SsidLen = SsidLen; - } - else - { - Idx = BssSsidTableSearch(&pAd->ScanTab, Bssid, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, Channel); - - if (Idx == BSS_NOT_FOUND) - { - CHAR Rssi = 0; - Rssi = RTMPMaxRssi(pAd, ConvertToRssi(pAd, Elem->Rssi0, RSSI_0), ConvertToRssi(pAd, Elem->Rssi1, RSSI_1), ConvertToRssi(pAd, Elem->Rssi2, RSSI_2)); - Idx = BssTableSetEntry(pAd, &pAd->ScanTab, Bssid, (CHAR *) Ssid, SsidLen, BssType, BeaconPeriod, - &Cf, AtimWin, CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen, &HtCapability, - &AddHtInfo, HtCapabilityLen, AddHtInfoLen, NewExtChannelOffset, Channel, Rssi, TimeStamp, CkipFlag, - &EdcaParm, &QosCapability, &QbssLoad, LenVIE, pVIE); - if (Idx != BSS_NOT_FOUND) - { - NdisMoveMemory(pAd->ScanTab.BssEntry[Idx].PTSF, &Elem->Msg[24], 4); - NdisMoveMemory(&pAd->ScanTab.BssEntry[Idx].TTSF[0], &Elem->TimeStamp.u.LowPart, 4); - NdisMoveMemory(&pAd->ScanTab.BssEntry[Idx].TTSF[4], &Elem->TimeStamp.u.LowPart, 4); - CapabilityInfo = pAd->ScanTab.BssEntry[Idx].CapabilityInfo; - } - } - else - { - // - // Multiple SSID case, used correct CapabilityInfo - // - CapabilityInfo = pAd->ScanTab.BssEntry[Idx].CapabilityInfo; - } - } - NdisMoveMemory(pAd->MlmeAux.Bssid, Bssid, MAC_ADDR_LEN); - pAd->MlmeAux.CapabilityInfo = CapabilityInfo & SUPPORTED_CAPABILITY_INFO; - pAd->MlmeAux.BssType = BssType; - pAd->MlmeAux.BeaconPeriod = BeaconPeriod; - pAd->MlmeAux.Channel = Channel; - pAd->MlmeAux.AtimWin = AtimWin; - pAd->MlmeAux.CfpPeriod = Cf.CfpPeriod; - pAd->MlmeAux.CfpMaxDuration = Cf.CfpMaxDuration; - pAd->MlmeAux.APRalinkIe = RalinkIe; - - // Copy AP's supported rate to MlmeAux for creating assoication request - // Also filter out not supported rate - pAd->MlmeAux.SupRateLen = SupRateLen; - NdisMoveMemory(pAd->MlmeAux.SupRate, SupRate, SupRateLen); - RTMPCheckRates(pAd, pAd->MlmeAux.SupRate, &pAd->MlmeAux.SupRateLen); - pAd->MlmeAux.ExtRateLen = ExtRateLen; - NdisMoveMemory(pAd->MlmeAux.ExtRate, ExtRate, ExtRateLen); - RTMPCheckRates(pAd, pAd->MlmeAux.ExtRate, &pAd->MlmeAux.ExtRateLen); - - NdisZeroMemory(pAd->StaActive.SupportedPhyInfo.MCSSet, 16); - - -#ifdef DOT11_N_SUPPORT - if (((pAd->StaCfg.WepStatus != Ndis802_11WEPEnabled) && (pAd->StaCfg.WepStatus != Ndis802_11Encryption2Enabled)) - || (pAd->CommonCfg.HT_DisallowTKIP == FALSE)) - { - bAllowNrate = TRUE; - } - - pAd->MlmeAux.NewExtChannelOffset = NewExtChannelOffset; - pAd->MlmeAux.HtCapabilityLen = HtCapabilityLen; - - RTMPZeroMemory(&pAd->MlmeAux.HtCapability, SIZE_HT_CAP_IE); - // filter out un-supported ht rates - if (((HtCapabilityLen > 0) || (PreNHtCapabilityLen > 0)) && - ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && (bAllowNrate))) - { - RTMPMoveMemory(&pAd->MlmeAux.AddHtInfo, &AddHtInfo, SIZE_ADD_HT_INFO_IE); - - // StaActive.SupportedHtPhy.MCSSet stores Peer AP's 11n Rx capability - NdisMoveMemory(pAd->StaActive.SupportedPhyInfo.MCSSet, HtCapability.MCSSet, 16); - pAd->MlmeAux.NewExtChannelOffset = NewExtChannelOffset; - pAd->MlmeAux.HtCapabilityLen = SIZE_HT_CAP_IE; - pAd->StaActive.SupportedPhyInfo.bHtEnable = TRUE; - if (PreNHtCapabilityLen > 0) - pAd->StaActive.SupportedPhyInfo.bPreNHt = TRUE; - RTMPCheckHt(pAd, BSSID_WCID, &HtCapability, &AddHtInfo); - // Copy AP Parameter to StaActive. This is also in LinkUp. - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAtJoinAction! (MpduDensity=%d, MaxRAmpduFactor=%d, BW=%d)\n", - pAd->StaActive.SupportedHtPhy.MpduDensity, pAd->StaActive.SupportedHtPhy.MaxRAmpduFactor, HtCapability.HtCapInfo.ChannelWidth)); - - if (AddHtInfoLen > 0) - { - CentralChannel = AddHtInfo.ControlChan; - // Check again the Bandwidth capability of this AP. - if ((AddHtInfo.ControlChan > 2)&& (AddHtInfo.AddHtInfo.ExtChanOffset == EXTCHA_BELOW) && (HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - CentralChannel = AddHtInfo.ControlChan - 2; - } - else if ((AddHtInfo.AddHtInfo.ExtChanOffset == EXTCHA_ABOVE) && (HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - CentralChannel = AddHtInfo.ControlChan + 2; - } - - // Check Error . - if (pAd->MlmeAux.CentralChannel != CentralChannel) - DBGPRINT(RT_DEBUG_ERROR, ("PeerBeaconAtJoinAction HT===>Beacon Central Channel = %d, Control Channel = %d. Mlmeaux CentralChannel = %d\n", CentralChannel, AddHtInfo.ControlChan, pAd->MlmeAux.CentralChannel)); - - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAtJoinAction HT===>Central Channel = %d, Control Channel = %d, .\n", CentralChannel, AddHtInfo.ControlChan)); - - } - - } - else -#endif // DOT11_N_SUPPORT // - { - // To prevent error, let legacy AP must have same CentralChannel and Channel. - if ((HtCapabilityLen == 0) && (PreNHtCapabilityLen == 0)) - pAd->MlmeAux.CentralChannel = pAd->MlmeAux.Channel; - - pAd->StaActive.SupportedPhyInfo.bHtEnable = FALSE; - pAd->MlmeAux.NewExtChannelOffset = 0xff; - RTMPZeroMemory(&pAd->MlmeAux.HtCapability, SIZE_HT_CAP_IE); - pAd->MlmeAux.HtCapabilityLen = 0; - RTMPZeroMemory(&pAd->MlmeAux.AddHtInfo, SIZE_ADD_HT_INFO_IE); - } - - RTMPUpdateMlmeRate(pAd); - - // copy QOS related information - if ((pAd->CommonCfg.bWmmCapable) -#ifdef DOT11_N_SUPPORT - || (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) -#endif // DOT11_N_SUPPORT // - ) - { - NdisMoveMemory(&pAd->MlmeAux.APEdcaParm, &EdcaParm, sizeof(EDCA_PARM)); - NdisMoveMemory(&pAd->MlmeAux.APQbssLoad, &QbssLoad, sizeof(QBSS_LOAD_PARM)); - NdisMoveMemory(&pAd->MlmeAux.APQosCapability, &QosCapability, sizeof(QOS_CAPABILITY_PARM)); - } - else - { - NdisZeroMemory(&pAd->MlmeAux.APEdcaParm, sizeof(EDCA_PARM)); - NdisZeroMemory(&pAd->MlmeAux.APQbssLoad, sizeof(QBSS_LOAD_PARM)); - NdisZeroMemory(&pAd->MlmeAux.APQosCapability, sizeof(QOS_CAPABILITY_PARM)); - } - - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - after JOIN, SupRateLen=%d, ExtRateLen=%d\n", - pAd->MlmeAux.SupRateLen, pAd->MlmeAux.ExtRateLen)); - - if (AironetCellPowerLimit != 0xFF) - { - //We need to change our TxPower for CCX 2.0 AP Control of Client Transmit Power - ChangeToCellPowerLimit(pAd, AironetCellPowerLimit); - } - else //Used the default TX Power Percentage. - pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault; - - pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; - Status = MLME_SUCCESS; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_JOIN_CONF, 2, &Status); - } - // not to me BEACON, ignored - } - // sanity check fail, ignore this frame -} - -/* - ========================================================================== - Description: - receive BEACON from peer - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID PeerBeacon( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR Bssid[MAC_ADDR_LEN], Addr2[MAC_ADDR_LEN]; - CHAR Ssid[MAX_LEN_OF_SSID]; - CF_PARM CfParm; - UCHAR SsidLen, MessageToMe=0, BssType, Channel, NewChannel, index=0; - UCHAR DtimCount=0, DtimPeriod=0, BcastFlag=0; - USHORT CapabilityInfo, AtimWin, BeaconPeriod; - LARGE_INTEGER TimeStamp; - USHORT TbttNumToNextWakeUp; - UCHAR Erp; - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen, ExtRateLen; - UCHAR CkipFlag; - USHORT LenVIE; - UCHAR AironetCellPowerLimit; - EDCA_PARM EdcaParm; - QBSS_LOAD_PARM QbssLoad; - QOS_CAPABILITY_PARM QosCapability; - ULONG RalinkIe; - // New for WPA security suites - UCHAR VarIE[MAX_VIE_LEN]; // Total VIE length = MAX_VIE_LEN - -5 - NDIS_802_11_VARIABLE_IEs *pVIE = NULL; - HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE - UCHAR HtCapabilityLen, PreNHtCapabilityLen; - UCHAR AddHtInfoLen; - UCHAR NewExtChannelOffset = 0xff; - - -#ifdef RALINK_ATE - if (ATE_ON(pAd)) - { - return; - } -#endif // RALINK_ATE // - - if (!(INFRA_ON(pAd) || ADHOC_ON(pAd) - )) - return; - - // Init Variable IE structure - pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; - pVIE->Length = 0; - RTMPZeroMemory(&HtCapability, sizeof(HtCapability)); - RTMPZeroMemory(&AddHtInfo, sizeof(ADD_HT_INFO_IE)); - - if (PeerBeaconAndProbeRspSanity(pAd, - Elem->Msg, - Elem->MsgLen, - Elem->Channel, - Addr2, - Bssid, - Ssid, - &SsidLen, - &BssType, - &BeaconPeriod, - &Channel, - &NewChannel, - &TimeStamp, - &CfParm, - &AtimWin, - &CapabilityInfo, - &Erp, - &DtimCount, - &DtimPeriod, - &BcastFlag, - &MessageToMe, - SupRate, - &SupRateLen, - ExtRate, - &ExtRateLen, - &CkipFlag, - &AironetCellPowerLimit, - &EdcaParm, - &QbssLoad, - &QosCapability, - &RalinkIe, - &HtCapabilityLen, - &PreNHtCapabilityLen, - &HtCapability, - &AddHtInfoLen, - &AddHtInfo, - &NewExtChannelOffset, - &LenVIE, - pVIE)) - { - BOOLEAN is_my_bssid, is_my_ssid; - ULONG Bssidx, Now; - BSS_ENTRY *pBss; - CHAR RealRssi = RTMPMaxRssi(pAd, ConvertToRssi(pAd, Elem->Rssi0, RSSI_0), ConvertToRssi(pAd, Elem->Rssi1, RSSI_1), ConvertToRssi(pAd, Elem->Rssi2, RSSI_2)); - - is_my_bssid = MAC_ADDR_EQUAL(Bssid, pAd->CommonCfg.Bssid)? TRUE : FALSE; - is_my_ssid = SSID_EQUAL(Ssid, SsidLen, pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen)? TRUE:FALSE; - - - // ignore BEACON not for my SSID - if ((! is_my_ssid) && (! is_my_bssid)) - return; - - // It means STA waits disassoc completely from this AP, ignores this beacon. - if (pAd->Mlme.CntlMachine.CurrState == CNTL_WAIT_DISASSOC) - return; - -#ifdef DOT11_N_SUPPORT - // Copy Control channel for this BSSID. - if (AddHtInfoLen != 0) - Channel = AddHtInfo.ControlChan; - - if ((HtCapabilityLen > 0) || (PreNHtCapabilityLen > 0)) - HtCapabilityLen = SIZE_HT_CAP_IE; -#endif // DOT11_N_SUPPORT // - - // - // Housekeeping "SsidBssTab" table for later-on ROAMing usage. - // - Bssidx = BssTableSearch(&pAd->ScanTab, Bssid, Channel); - if (Bssidx == BSS_NOT_FOUND) - { - // discover new AP of this network, create BSS entry - Bssidx = BssTableSetEntry(pAd, &pAd->ScanTab, Bssid, Ssid, SsidLen, BssType, BeaconPeriod, - &CfParm, AtimWin, CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen, - &HtCapability, &AddHtInfo,HtCapabilityLen,AddHtInfoLen,NewExtChannelOffset, Channel, - RealRssi, TimeStamp, CkipFlag, &EdcaParm, &QosCapability, - &QbssLoad, LenVIE, pVIE); - if (Bssidx == BSS_NOT_FOUND) // return if BSS table full - return; - - NdisMoveMemory(pAd->ScanTab.BssEntry[Bssidx].PTSF, &Elem->Msg[24], 4); - NdisMoveMemory(&pAd->ScanTab.BssEntry[Bssidx].TTSF[0], &Elem->TimeStamp.u.LowPart, 4); - NdisMoveMemory(&pAd->ScanTab.BssEntry[Bssidx].TTSF[4], &Elem->TimeStamp.u.LowPart, 4); - - - - } - - if ((pAd->CommonCfg.bIEEE80211H == 1) && (NewChannel != 0) && (Channel != NewChannel)) - { - // Switching to channel 1 can prevent from rescanning the current channel immediately (by auto reconnection). - // In addition, clear the MLME queue and the scan table to discard the RX packets and previous scanning results. - AsicSwitchChannel(pAd, 1, FALSE); - AsicLockChannel(pAd, 1); - LinkDown(pAd, FALSE); - MlmeQueueInit(&pAd->Mlme.Queue); - BssTableInit(&pAd->ScanTab); - RTMPusecDelay(1000000); // use delay to prevent STA do reassoc - - // channel sanity check - for (index = 0 ; index < pAd->ChannelListNum; index++) - { - if (pAd->ChannelList[index].Channel == NewChannel) - { - pAd->ScanTab.BssEntry[Bssidx].Channel = NewChannel; - pAd->CommonCfg.Channel = NewChannel; - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeacon - STA receive channel switch announcement IE (New Channel =%d)\n", NewChannel)); - break; - } - } - - if (index >= pAd->ChannelListNum) - { - DBGPRINT_ERR(("PeerBeacon(can not find New Channel=%d in ChannelList[%d]\n", pAd->CommonCfg.Channel, pAd->ChannelListNum)); - } - } - - // if the ssid matched & bssid unmatched, we should select the bssid with large value. - // This might happened when two STA start at the same time - if ((! is_my_bssid) && ADHOC_ON(pAd)) - { - INT i; - - // Add the safeguard against the mismatch of adhoc wep status - if (pAd->StaCfg.WepStatus != pAd->ScanTab.BssEntry[Bssidx].WepStatus) - { - return; - } - - // collapse into the ADHOC network which has bigger BSSID value. - for (i = 0; i < 6; i++) - { - if (Bssid[i] > pAd->CommonCfg.Bssid[i]) - { - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - merge to the IBSS with bigger BSSID=%02x:%02x:%02x:%02x:%02x:%02x\n", - Bssid[0], Bssid[1], Bssid[2], Bssid[3], Bssid[4], Bssid[5])); - AsicDisableSync(pAd); - COPY_MAC_ADDR(pAd->CommonCfg.Bssid, Bssid); - AsicSetBssid(pAd, pAd->CommonCfg.Bssid); - MakeIbssBeacon(pAd); // re-build BEACON frame - AsicEnableIbssSync(pAd); // copy BEACON frame to on-chip memory - is_my_bssid = TRUE; - break; - } - else if (Bssid[i] < pAd->CommonCfg.Bssid[i]) - break; - } - } - - - NdisGetSystemUpTime(&Now); - pBss = &pAd->ScanTab.BssEntry[Bssidx]; - pBss->Rssi = RealRssi; // lastest RSSI - pBss->LastBeaconRxTime = Now; // last RX timestamp - - // - // BEACON from my BSSID - either IBSS or INFRA network - // - if (is_my_bssid) - { - RXWI_STRUC RxWI; - - pAd->StaCfg.DtimCount = DtimCount; - pAd->StaCfg.DtimPeriod = DtimPeriod; - pAd->StaCfg.LastBeaconRxTime = Now; - - - RxWI.RSSI0 = Elem->Rssi0; - RxWI.RSSI1 = Elem->Rssi1; - RxWI.RSSI2 = Elem->Rssi2; - - Update_Rssi_Sample(pAd, &pAd->StaCfg.RssiSample, &RxWI); - if (AironetCellPowerLimit != 0xFF) - { - // - // We get the Cisco (ccx) "TxPower Limit" required - // Changed to appropriate TxPower Limit for Ciso Compatible Extensions - // - ChangeToCellPowerLimit(pAd, AironetCellPowerLimit); - } - else - { - // - // AironetCellPowerLimit equal to 0xFF means the Cisco (ccx) "TxPower Limit" not exist. - // Used the default TX Power Percentage, that set from UI. - // - pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault; - } - - if (ADHOC_ON(pAd) && (CAP_IS_IBSS_ON(CapabilityInfo))) - { - UCHAR MaxSupportedRateIn500Kbps = 0; - UCHAR idx; - MAC_TABLE_ENTRY *pEntry; - - // supported rates array may not be sorted. sort it and find the maximum rate - for (idx=0; idxWcid == RESERVED_WCID)) || - (pEntry && ((pEntry->LastBeaconRxTime + ADHOC_ENTRY_BEACON_LOST_TIME) < Now))) - { - if (pEntry == NULL) - // Another adhoc joining, add to our MAC table. - pEntry = MacTableInsertEntry(pAd, Addr2, BSS0, FALSE); - - if (StaAddMacTableEntry(pAd, - pEntry, - MaxSupportedRateIn500Kbps, - &HtCapability, - HtCapabilityLen, - &AddHtInfo, - AddHtInfoLen, - CapabilityInfo) == FALSE) - { - DBGPRINT(RT_DEBUG_TRACE, ("ADHOC - Add Entry failed.\n")); - return; - } - - if (pEntry && - (Elem->Wcid == RESERVED_WCID)) - { - idx = pAd->StaCfg.DefaultKeyId; - RTMP_STA_SECURITY_INFO_ADD(pAd, BSS0, idx, pEntry); - } - } - - if (pEntry && pEntry->ValidAsCLI) - pEntry->LastBeaconRxTime = Now; - - // At least another peer in this IBSS, declare MediaState as CONNECTED - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); - - pAd->IndicateMediaState = NdisMediaStateConnected; - RTMP_IndicateMediaState(pAd); - pAd->ExtraInfo = GENERAL_LINK_UP; - AsicSetBssid(pAd, pAd->CommonCfg.Bssid); - - // 2003/03/12 - john - // Make sure this entry in "ScanTab" table, thus complies to Microsoft's policy that - // "site survey" result should always include the current connected network. - // - Bssidx = BssTableSearch(&pAd->ScanTab, Bssid, Channel); - if (Bssidx == BSS_NOT_FOUND) - { - Bssidx = BssTableSetEntry(pAd, &pAd->ScanTab, Bssid, Ssid, SsidLen, BssType, BeaconPeriod, - &CfParm, AtimWin, CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen, &HtCapability, - &AddHtInfo, HtCapabilityLen, AddHtInfoLen, NewExtChannelOffset, Channel, RealRssi, TimeStamp, 0, - &EdcaParm, &QosCapability, &QbssLoad, LenVIE, pVIE); - } - DBGPRINT(RT_DEBUG_TRACE, ("ADHOC fOP_STATUS_MEDIA_STATE_CONNECTED.\n")); - } - } - - if (INFRA_ON(pAd)) - { - BOOLEAN bUseShortSlot, bUseBGProtection; - - // decide to use/change to - - // 1. long slot (20 us) or short slot (9 us) time - // 2. turn on/off RTS/CTS and/or CTS-to-self protection - // 3. short preamble - - //bUseShortSlot = pAd->CommonCfg.bUseShortSlotTime && CAP_IS_SHORT_SLOT(CapabilityInfo); - bUseShortSlot = CAP_IS_SHORT_SLOT(CapabilityInfo); - if (bUseShortSlot != OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED)) - AsicSetSlotTime(pAd, bUseShortSlot); - - bUseBGProtection = (pAd->CommonCfg.UseBGProtection == 1) || // always use - ((pAd->CommonCfg.UseBGProtection == 0) && ERP_IS_USE_PROTECTION(Erp)); - - if (pAd->CommonCfg.Channel > 14) // always no BG protection in A-band. falsely happened when switching A/G band to a dual-band AP - bUseBGProtection = FALSE; - - if (bUseBGProtection != OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_BG_PROTECTION_INUSED)) - { - if (bUseBGProtection) - { - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_BG_PROTECTION_INUSED); - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, (OFDMSETPROTECT|CCKSETPROTECT|ALLN_SETPROTECT),FALSE,(pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent == 1)); - } - else - { - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_BG_PROTECTION_INUSED); - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, (OFDMSETPROTECT|CCKSETPROTECT|ALLN_SETPROTECT),TRUE,(pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent == 1)); - } - - DBGPRINT(RT_DEBUG_WARN, ("SYNC - AP changed B/G protection to %d\n", bUseBGProtection)); - } - -#ifdef DOT11_N_SUPPORT - // check Ht protection mode. and adhere to the Non-GF device indication by AP. - if ((AddHtInfoLen != 0) && - ((AddHtInfo.AddHtInfo2.OperaionMode != pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode) || - (AddHtInfo.AddHtInfo2.NonGfPresent != pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent))) - { - pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent = AddHtInfo.AddHtInfo2.NonGfPresent; - pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode = AddHtInfo.AddHtInfo2.OperaionMode; - if (pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent == 1) - { - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, FALSE, TRUE); - } - else - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, FALSE, FALSE); - - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - AP changed N OperaionMode to %d\n", pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode)); - } -#endif // DOT11_N_SUPPORT // - - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED) && - ERP_IS_USE_BARKER_PREAMBLE(Erp)) - { - MlmeSetTxPreamble(pAd, Rt802_11PreambleLong); - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - AP forced to use LONG preamble\n")); - } - - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && - (EdcaParm.bValid == TRUE) && - (EdcaParm.EdcaUpdateCount != pAd->CommonCfg.APEdcaParm.EdcaUpdateCount)) - { - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - AP change EDCA parameters(from %d to %d)\n", - pAd->CommonCfg.APEdcaParm.EdcaUpdateCount, - EdcaParm.EdcaUpdateCount)); - AsicSetEdcaParm(pAd, &EdcaParm); - } - - // copy QOS related information - NdisMoveMemory(&pAd->CommonCfg.APQbssLoad, &QbssLoad, sizeof(QBSS_LOAD_PARM)); - NdisMoveMemory(&pAd->CommonCfg.APQosCapability, &QosCapability, sizeof(QOS_CAPABILITY_PARM)); - } - - // only INFRASTRUCTURE mode support power-saving feature - if ((INFRA_ON(pAd) && (pAd->StaCfg.Psm == PWR_SAVE)) || (pAd->CommonCfg.bAPSDForcePowerSave)) - { - UCHAR FreeNumber; - // 1. AP has backlogged unicast-to-me frame, stay AWAKE, send PSPOLL - // 2. AP has backlogged broadcast/multicast frame and we want those frames, stay AWAKE - // 3. we have outgoing frames in TxRing or MgmtRing, better stay AWAKE - // 4. Psm change to PWR_SAVE, but AP not been informed yet, we better stay AWAKE - // 5. otherwise, put PHY back to sleep to save battery. - if (MessageToMe) - { -#ifdef RTMP_MAC_PCI - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - // Restore to correct BBP R3 value - if (pAd->Antenna.field.RxPath > 1) - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, pAd->StaCfg.BBPR3); - // Turn clk to 80Mhz. - } -#endif // RTMP_MAC_PCI // - if (pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable && - pAd->CommonCfg.bAPSDAC_BE && pAd->CommonCfg.bAPSDAC_BK && pAd->CommonCfg.bAPSDAC_VI && pAd->CommonCfg.bAPSDAC_VO) - { - pAd->CommonCfg.bNeedSendTriggerFrame = TRUE; - } - else - RTMP_PS_POLL_ENQUEUE(pAd); - } - else if (BcastFlag && (DtimCount == 0) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM)) - { -#ifdef RTMP_MAC_PCI - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - if (pAd->Antenna.field.RxPath > 1) - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, pAd->StaCfg.BBPR3); - } -#endif // RTMP_MAC_PCI // - } - else if ((pAd->TxSwQueue[QID_AC_BK].Number != 0) || - (pAd->TxSwQueue[QID_AC_BE].Number != 0) || - (pAd->TxSwQueue[QID_AC_VI].Number != 0) || - (pAd->TxSwQueue[QID_AC_VO].Number != 0) || - (RTMPFreeTXDRequest(pAd, QID_AC_BK, TX_RING_SIZE - 1, &FreeNumber) != NDIS_STATUS_SUCCESS) || - (RTMPFreeTXDRequest(pAd, QID_AC_BE, TX_RING_SIZE - 1, &FreeNumber) != NDIS_STATUS_SUCCESS) || - (RTMPFreeTXDRequest(pAd, QID_AC_VI, TX_RING_SIZE - 1, &FreeNumber) != NDIS_STATUS_SUCCESS) || - (RTMPFreeTXDRequest(pAd, QID_AC_VO, TX_RING_SIZE - 1, &FreeNumber) != NDIS_STATUS_SUCCESS) || - (RTMPFreeTXDRequest(pAd, QID_MGMT, MGMT_RING_SIZE - 1, &FreeNumber) != NDIS_STATUS_SUCCESS)) - { - // TODO: consider scheduled HCCA. might not be proper to use traditional DTIM-based power-saving scheme - // can we cheat here (i.e. just check MGMT & AC_BE) for better performance? -#ifdef RTMP_MAC_PCI - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - if (pAd->Antenna.field.RxPath > 1) - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, pAd->StaCfg.BBPR3); - } -#endif // RTMP_MAC_PCI // - } - else - { - if ((pAd->CommonCfg.bACMAPSDTr[QID_AC_VO]) || - (pAd->CommonCfg.bACMAPSDTr[QID_AC_VI]) || - (pAd->CommonCfg.bACMAPSDTr[QID_AC_BK]) || - (pAd->CommonCfg.bACMAPSDTr[QID_AC_BE])) - { - /* - WMM Spec v1.0 3.6.2.4, - The WMM STA shall remain awake until it receives a - QoS Data or Null frame addressed to it, with the - EOSP subfield in QoS Control field set to 1. - - So we can not sleep here or we will suffer a case: - - PS Management Frame --> - Trigger frame --> - Beacon (TIM=0) (Beacon is closer to Trig frame) --> - Station goes to sleep --> - AP delivery queued UAPSD packets --> - Station can NOT receive the reply - - Maybe we need a timeout timer to avoid that we do - NOT receive the EOSP frame. - - We can not use More Data to check if SP is ended - due to MaxSPLength. - */ - } - else - { - USHORT NextDtim = DtimCount; - - - if (NextDtim == 0) - NextDtim = DtimPeriod; - - TbttNumToNextWakeUp = pAd->StaCfg.DefaultListenCount; - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM) && (TbttNumToNextWakeUp > NextDtim)) - TbttNumToNextWakeUp = NextDtim; - - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - // Set a flag to go to sleep . Then after parse this RxDoneInterrupt, will go to sleep mode. - pAd->ThisTbttNumToNextWakeUp = TbttNumToNextWakeUp; - AsicSleepThenAutoWakeup(pAd, pAd->ThisTbttNumToNextWakeUp); - - } - } - } - } - } - // not my BSSID, ignore it - } - // sanity check fail, ignore this frame -} - -/* - ========================================================================== - Description: - Receive PROBE REQ from remote peer when operating in IBSS mode - ========================================================================== - */ -VOID PeerProbeReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - UCHAR Addr2[MAC_ADDR_LEN]; - CHAR Ssid[MAX_LEN_OF_SSID]; - UCHAR SsidLen; -#ifdef DOT11_N_SUPPORT - UCHAR HtLen, AddHtLen, NewExtLen; -#endif // DOT11_N_SUPPORT // - HEADER_802_11 ProbeRspHdr; - NDIS_STATUS NStatus; - PUCHAR pOutBuffer = NULL; - ULONG FrameLen = 0; - LARGE_INTEGER FakeTimestamp; - UCHAR DsLen = 1, IbssLen = 2; - UCHAR LocalErpIe[3] = {IE_ERP, 1, 0}; - BOOLEAN Privacy; - USHORT CapabilityInfo; - UCHAR RSNIe = IE_WPA; - - if (! ADHOC_ON(pAd)) - return; - - if (PeerProbeReqSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, Ssid, &SsidLen)) - { - if ((SsidLen == 0) || SSID_EQUAL(Ssid, SsidLen, pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen)) - { - // allocate and send out ProbeRsp frame - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - return; - - //pAd->StaCfg.AtimWin = 0; // ?????? - - Privacy = (pAd->StaCfg.WepStatus == Ndis802_11Encryption1Enabled) || - (pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) || - (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled); - CapabilityInfo = CAP_GENERATE(0, 1, Privacy, (pAd->CommonCfg.TxPreamble == Rt802_11PreambleShort), 0, 0); - - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &ProbeRspHdr, - TIMESTAMP_LEN, &FakeTimestamp, - 2, &pAd->CommonCfg.BeaconPeriod, - 2, &CapabilityInfo, - 1, &SsidIe, - 1, &pAd->CommonCfg.SsidLen, - pAd->CommonCfg.SsidLen, pAd->CommonCfg.Ssid, - 1, &SupRateIe, - 1, &pAd->StaActive.SupRateLen, - pAd->StaActive.SupRateLen, pAd->StaActive.SupRate, - 1, &DsIe, - 1, &DsLen, - 1, &pAd->CommonCfg.Channel, - 1, &IbssIe, - 1, &IbssLen, - 2, &pAd->StaActive.AtimWin, - END_OF_ARGS); - - if (pAd->StaActive.ExtRateLen) - { - ULONG tmp; - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 3, LocalErpIe, - 1, &ExtRateIe, - 1, &pAd->StaActive.ExtRateLen, - pAd->StaActive.ExtRateLen, &pAd->StaActive.ExtRate, - END_OF_ARGS); - FrameLen += tmp; - } - - // If adhoc secruity is set for WPA-None, append the cipher suite IE - if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) - { - ULONG tmp; - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 1, &RSNIe, - 1, &pAd->StaCfg.RSNIE_Len, - pAd->StaCfg.RSNIE_Len, pAd->StaCfg.RSN_IE, - END_OF_ARGS); - FrameLen += tmp; - } -#ifdef DOT11_N_SUPPORT - if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) - { - ULONG TmpLen; - UCHAR BROADCOM[4] = {0x0, 0x90, 0x4c, 0x33}; - HtLen = sizeof(pAd->CommonCfg.HtCapability); - AddHtLen = sizeof(pAd->CommonCfg.AddHTInfo); - NewExtLen = 1; - //New extension channel offset IE is included in Beacon, Probe Rsp or channel Switch Announcement Frame - if (pAd->bBroadComHT == TRUE) - { - MakeOutgoingFrame(pOutBuffer + FrameLen, &TmpLen, - 1, &WpaIe, - 4, &BROADCOM[0], - pAd->MlmeAux.HtCapabilityLen, &pAd->MlmeAux.HtCapability, - END_OF_ARGS); - } - else - { - MakeOutgoingFrame(pOutBuffer + FrameLen, &TmpLen, - 1, &HtCapIe, - 1, &HtLen, - sizeof(HT_CAPABILITY_IE), &pAd->CommonCfg.HtCapability, - 1, &AddHtInfoIe, - 1, &AddHtLen, - sizeof(ADD_HT_INFO_IE), &pAd->CommonCfg.AddHTInfo, - 1, &NewExtChanIe, - 1, &NewExtLen, - sizeof(NEW_EXT_CHAN_IE), &pAd->CommonCfg.NewExtChanOffset, - END_OF_ARGS); - } - FrameLen += TmpLen; - } -#endif // DOT11_N_SUPPORT // - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - } - } -} - -VOID BeaconTimeoutAtJoinAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - BeaconTimeoutAtJoinAction\n")); - pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; - Status = MLME_REJ_TIMEOUT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_JOIN_CONF, 2, &Status); -} - -/* - ========================================================================== - Description: - Scan timeout procedure. basically add channel index by 1 and rescan - ========================================================================== - */ -VOID ScanTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - pAd->MlmeAux.Channel = NextChannel(pAd, pAd->MlmeAux.Channel); - - // Only one channel scanned for CISCO beacon request - if ((pAd->MlmeAux.ScanType == SCAN_CISCO_ACTIVE) || - (pAd->MlmeAux.ScanType == SCAN_CISCO_PASSIVE) || - (pAd->MlmeAux.ScanType == SCAN_CISCO_NOISE) || - (pAd->MlmeAux.ScanType == SCAN_CISCO_CHANNEL_LOAD)) - pAd->MlmeAux.Channel = 0; - - // this routine will stop if pAd->MlmeAux.Channel == 0 - ScanNextChannel(pAd); -} - -/* - ========================================================================== - Description: - ========================================================================== - */ -VOID InvalidStateWhenScan( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("AYNC - InvalidStateWhenScan(state=%ld). Reset SYNC machine\n", pAd->Mlme.SyncMachine.CurrState)); - pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; - Status = MLME_STATE_MACHINE_REJECT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_SCAN_CONF, 2, &Status); -} - -/* - ========================================================================== - Description: - ========================================================================== - */ -VOID InvalidStateWhenJoin( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("InvalidStateWhenJoin(state=%ld). Reset SYNC machine\n", pAd->Mlme.SyncMachine.CurrState)); - pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; - Status = MLME_STATE_MACHINE_REJECT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_JOIN_CONF, 2, &Status); -} - -/* - ========================================================================== - Description: - ========================================================================== - */ -VOID InvalidStateWhenStart( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("InvalidStateWhenStart(state=%ld). Reset SYNC machine\n", pAd->Mlme.SyncMachine.CurrState)); - pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; - Status = MLME_STATE_MACHINE_REJECT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_START_CONF, 2, &Status); -} - -/* - ========================================================================== - Description: - - IRQL = DISPATCH_LEVEL - - ========================================================================== - */ -VOID EnqueuePsPoll( - IN PRTMP_ADAPTER pAd) -{ -#ifdef RALINK_ATE - if (ATE_ON(pAd)) - { - return; - } -#endif // RALINK_ATE // - - - if (pAd->StaCfg.WindowsPowerMode == Ndis802_11PowerModeLegacy_PSP) - pAd->PsPollFrame.FC.PwrMgmt = PWR_SAVE; - MiniportMMRequest(pAd, 0, (PUCHAR)&pAd->PsPollFrame, sizeof(PSPOLL_FRAME)); -} - - -/* - ========================================================================== - Description: - ========================================================================== - */ -VOID EnqueueProbeRequest( - IN PRTMP_ADAPTER pAd) -{ - NDIS_STATUS NState; - PUCHAR pOutBuffer; - ULONG FrameLen = 0; - HEADER_802_11 Hdr80211; - - DBGPRINT(RT_DEBUG_TRACE, ("force out a ProbeRequest ...\n")); - - NState = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NState == NDIS_STATUS_SUCCESS) - { - MgtMacHeaderInit(pAd, &Hdr80211, SUBTYPE_PROBE_REQ, 0, BROADCAST_ADDR, BROADCAST_ADDR); - - // this ProbeRequest explicitly specify SSID to reduce unwanted ProbeResponse - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &Hdr80211, - 1, &SsidIe, - 1, &pAd->CommonCfg.SsidLen, - pAd->CommonCfg.SsidLen, pAd->CommonCfg.Ssid, - 1, &SupRateIe, - 1, &pAd->StaActive.SupRateLen, - pAd->StaActive.SupRateLen, pAd->StaActive.SupRate, - END_OF_ARGS); - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - } - -} - -#ifdef DOT11_N_SUPPORT -#ifdef DOT11N_DRAFT3 -VOID BuildEffectedChannelList( - IN PRTMP_ADAPTER pAd) -{ - UCHAR EChannel[11]; - UCHAR i, j, k; - UCHAR UpperChannel = 0, LowerChannel = 0; - - RTMPZeroMemory(EChannel, 11); - i = 0; - // Find upper channel and lower channel. - if (pAd->CommonCfg.CentralChannel < pAd->CommonCfg.Channel) - { - UpperChannel = pAd->CommonCfg.Channel; - LowerChannel = pAd->CommonCfg.CentralChannel; - } - else if (pAd->CommonCfg.CentralChannel > pAd->CommonCfg.Channel) - { - UpperChannel = pAd->CommonCfg.CentralChannel; - LowerChannel = pAd->CommonCfg.Channel; - } - else - { - return; - } - - // Record channels that is below lower channel.. - if (LowerChannel > 1) - { - EChannel[0] = LowerChannel - 1; - i = 1; - if (LowerChannel > 2) - { - EChannel[1] = LowerChannel - 2; - i = 2; - if (LowerChannel > 3) - { - EChannel[2] = LowerChannel - 3; - i = 3; - } - } - } - // Record channels that is between lower channel and upper channel. - for (k = LowerChannel;k < UpperChannel;k++) - { - EChannel[i] = k; - i++; - } - // Record channels that is above upper channel.. - if (LowerChannel < 11) - { - EChannel[i] = UpperChannel + 1; - i++; - if (LowerChannel < 10) - { - EChannel[i] = LowerChannel + 2; - i++; - if (LowerChannel < 9) - { - EChannel[i] = LowerChannel + 3; - i++; - } - } - } - // - for (j = 0;j < i;j++) - { - for (k = 0;k < pAd->ChannelListNum;k++) - { - if (pAd->ChannelList[k].Channel == EChannel[j]) - { - pAd->ChannelList[k].bEffectedChannel = TRUE; - DBGPRINT(RT_DEBUG_TRACE,(" EffectedChannel( =%d)\n", EChannel[j])); - break; - } - } - } -} -#endif // DOT11N_DRAFT3 // -#endif // DOT11_N_SUPPORT // - -BOOLEAN ScanRunning( - IN PRTMP_ADAPTER pAd) -{ - return (pAd->Mlme.SyncMachine.CurrState == SCAN_LISTEN) ? TRUE : FALSE; -} diff --git a/drivers/staging/rt3090/sta/wpa.c b/drivers/staging/rt3090/sta/wpa.c deleted file mode 100644 index 2dbdba541c3f..000000000000 --- a/drivers/staging/rt3090/sta/wpa.c +++ /dev/null @@ -1,396 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - wpa.c - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Jan Lee 03-07-22 Initial - Paul Lin 03-11-28 Modify for supplicant -*/ - -#include "../rt_config.h" - - -void inc_byte_array(UCHAR *counter, int len); - -/* - ======================================================================== - - Routine Description: - Process MIC error indication and record MIC error timer. - - Arguments: - pAd Pointer to our adapter - pWpaKey Pointer to the WPA key structure - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPReportMicError( - IN PRTMP_ADAPTER pAd, - IN PCIPHER_KEY pWpaKey) -{ - ULONG Now; - UCHAR unicastKey = (pWpaKey->Type == PAIRWISE_KEY ? 1:0); - - // Record Last MIC error time and count - NdisGetSystemUpTime(&Now); - if (pAd->StaCfg.MicErrCnt == 0) - { - pAd->StaCfg.MicErrCnt++; - pAd->StaCfg.LastMicErrorTime = Now; - NdisZeroMemory(pAd->StaCfg.ReplayCounter, 8); - } - else if (pAd->StaCfg.MicErrCnt == 1) - { - if ((pAd->StaCfg.LastMicErrorTime + (60 * OS_HZ)) < Now) - { - // Update Last MIC error time, this did not violate two MIC errors within 60 seconds - pAd->StaCfg.LastMicErrorTime = Now; - } - else - { - - if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_COUNTER_MEASURES_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - - pAd->StaCfg.LastMicErrorTime = Now; - // Violate MIC error counts, MIC countermeasures kicks in - pAd->StaCfg.MicErrCnt++; - // We shall block all reception - // We shall clean all Tx ring and disassoicate from AP after next EAPOL frame - // - // No necessary to clean all Tx ring, on RTMPHardTransmit will stop sending non-802.1X EAPOL packets - // if pAd->StaCfg.MicErrCnt greater than 2. - // - // RTMPRingCleanUp(pAd, QID_AC_BK); - // RTMPRingCleanUp(pAd, QID_AC_BE); - // RTMPRingCleanUp(pAd, QID_AC_VI); - // RTMPRingCleanUp(pAd, QID_AC_VO); - // RTMPRingCleanUp(pAd, QID_HCCA); - } - } - else - { - // MIC error count >= 2 - // This should not happen - ; - } - MlmeEnqueue(pAd, - MLME_CNTL_STATE_MACHINE, - OID_802_11_MIC_FAILURE_REPORT_FRAME, - 1, - &unicastKey); - - if (pAd->StaCfg.MicErrCnt == 2) - { - RTMPSetTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, 100); - } -} - - -#ifdef WPA_SUPPLICANT_SUPPORT -#define LENGTH_EAP_H 4 -// If the received frame is EAP-Packet ,find out its EAP-Code (Request(0x01), Response(0x02), Success(0x03), Failure(0x04)). -INT WpaCheckEapCode( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pFrame, - IN USHORT FrameLen, - IN USHORT OffSet) -{ - - PUCHAR pData; - INT result = 0; - - if( FrameLen < OffSet + LENGTH_EAPOL_H + LENGTH_EAP_H ) - return result; - - pData = pFrame + OffSet; // skip offset bytes - - if(*(pData+1) == EAPPacket) // 802.1x header - Packet Type - { - result = *(pData+4); // EAP header - Code - } - - return result; -} - -VOID WpaSendMicFailureToWpaSupplicant( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bUnicast) -{ - char custom[IW_CUSTOM_MAX] = {0}; - - sprintf(custom, "MLME-MICHAELMICFAILURE.indication"); - if(bUnicast) - sprintf(custom, "%s unicast", custom); - - RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, -1, NULL, (PUCHAR)custom, strlen(custom)); - - return; -} -#endif // WPA_SUPPLICANT_SUPPORT // - -VOID WpaMicFailureReportFrame( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) -{ - PUCHAR pOutBuffer = NULL; - UCHAR Header802_3[14]; - ULONG FrameLen = 0; - EAPOL_PACKET Packet; - UCHAR Mic[16]; - BOOLEAN bUnicast; - - DBGPRINT(RT_DEBUG_TRACE, ("WpaMicFailureReportFrame ----->\n")); - - bUnicast = (Elem->Msg[0] == 1 ? TRUE:FALSE); - pAd->Sequence = ((pAd->Sequence) + 1) & (MAX_SEQ_NUMBER); - - // init 802.3 header and Fill Packet - MAKE_802_3_HEADER(Header802_3, pAd->CommonCfg.Bssid, pAd->CurrentAddress, EAPOL); - - NdisZeroMemory(&Packet, sizeof(Packet)); - Packet.ProVer = EAPOL_VER; - Packet.ProType = EAPOLKey; - - Packet.KeyDesc.Type = WPA1_KEY_DESC; - - // Request field presented - Packet.KeyDesc.KeyInfo.Request = 1; - - if(pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { - Packet.KeyDesc.KeyInfo.KeyDescVer = 2; - } - else // TKIP - { - Packet.KeyDesc.KeyInfo.KeyDescVer = 1; - } - - Packet.KeyDesc.KeyInfo.KeyType = (bUnicast ? PAIRWISEKEY : GROUPKEY); - - // KeyMic field presented - Packet.KeyDesc.KeyInfo.KeyMic = 1; - - // Error field presented - Packet.KeyDesc.KeyInfo.Error = 1; - - // Update packet length after decide Key data payload - SET_UINT16_TO_ARRARY(Packet.Body_Len, LEN_EAPOL_KEY_MSG) - - // Key Replay Count - NdisMoveMemory(Packet.KeyDesc.ReplayCounter, pAd->StaCfg.ReplayCounter, LEN_KEY_DESC_REPLAY); - inc_byte_array(pAd->StaCfg.ReplayCounter, 8); - - // Convert to little-endian format. - *((USHORT *)&Packet.KeyDesc.KeyInfo) = cpu2le16(*((USHORT *)&Packet.KeyDesc.KeyInfo)); - - - MlmeAllocateMemory(pAd, (PUCHAR *)&pOutBuffer); // allocate memory - if(pOutBuffer == NULL) - { - return; - } - - // Prepare EAPOL frame for MIC calculation - // Be careful, only EAPOL frame is counted for MIC calculation - MakeOutgoingFrame(pOutBuffer, &FrameLen, - CONV_ARRARY_TO_UINT16(Packet.Body_Len) + 4, &Packet, - END_OF_ARGS); - - // Prepare and Fill MIC value - NdisZeroMemory(Mic, sizeof(Mic)); - if(pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { // AES - UCHAR digest[20] = {0}; - HMAC_SHA1(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, digest, SHA1_DIGEST_SIZE); - NdisMoveMemory(Mic, digest, LEN_KEY_DESC_MIC); - } - else - { // TKIP - HMAC_MD5(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, Mic, MD5_DIGEST_SIZE); - } - NdisMoveMemory(Packet.KeyDesc.KeyMic, Mic, LEN_KEY_DESC_MIC); - - // copy frame to Tx ring and send MIC failure report frame to authenticator - RTMPToWirelessSta(pAd, &pAd->MacTab.Content[BSSID_WCID], - Header802_3, LENGTH_802_3, - (PUCHAR)&Packet, - CONV_ARRARY_TO_UINT16(Packet.Body_Len) + 4, FALSE); - - MlmeFreeMemory(pAd, (PUCHAR)pOutBuffer); - - DBGPRINT(RT_DEBUG_TRACE, ("WpaMicFailureReportFrame <-----\n")); -} - -/** from wpa_supplicant - * inc_byte_array - Increment arbitrary length byte array by one - * @counter: Pointer to byte array - * @len: Length of the counter in bytes - * - * This function increments the last byte of the counter by one and continues - * rolling over to more significant bytes if the byte was incremented from - * 0xff to 0x00. - */ -void inc_byte_array(UCHAR *counter, int len) -{ - int pos = len - 1; - while (pos >= 0) { - counter[pos]++; - if (counter[pos] != 0) - break; - pos--; - } -} - -VOID WpaDisassocApAndBlockAssoc( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - RTMP_ADAPTER *pAd = (PRTMP_ADAPTER)FunctionContext; - MLME_DISASSOC_REQ_STRUCT DisassocReq; - - // disassoc from current AP first - DBGPRINT(RT_DEBUG_TRACE, ("RTMPReportMicError - disassociate with current AP after sending second continuous EAPOL frame\n")); - DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_MIC_FAILURE); - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); - - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; - pAd->StaCfg.bBlockAssoc = TRUE; -} - -VOID WpaStaPairwiseKeySetting( - IN PRTMP_ADAPTER pAd) -{ - PCIPHER_KEY pSharedKey; - PMAC_TABLE_ENTRY pEntry; - - pEntry = &pAd->MacTab.Content[BSSID_WCID]; - - // Pairwise key shall use key#0 - pSharedKey = &pAd->SharedKey[BSS0][0]; - - NdisMoveMemory(pAd->StaCfg.PTK, pEntry->PTK, LEN_PTK); - - // Prepare pair-wise key information into shared key table - NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); - pSharedKey->KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pSharedKey->Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); - NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_RXMICK); - NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); - - // Decide its ChiperAlg - if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) - pSharedKey->CipherAlg = CIPHER_TKIP; - else if (pAd->StaCfg.PairCipher == Ndis802_11Encryption3Enabled) - pSharedKey->CipherAlg = CIPHER_AES; - else - pSharedKey->CipherAlg = CIPHER_NONE; - - // Update these related information to MAC_TABLE_ENTRY - NdisMoveMemory(pEntry->PairwiseKey.Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); - NdisMoveMemory(pEntry->PairwiseKey.RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_RXMICK); - NdisMoveMemory(pEntry->PairwiseKey.TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); - pEntry->PairwiseKey.CipherAlg = pSharedKey->CipherAlg; - - // Update pairwise key information to ASIC Shared Key Table - AsicAddSharedKeyEntry(pAd, - BSS0, - 0, - pSharedKey->CipherAlg, - pSharedKey->Key, - pSharedKey->TxMic, - pSharedKey->RxMic); - - // Update ASIC WCID attribute table and IVEIV table - RTMPAddWcidAttributeEntry(pAd, - BSS0, - 0, - pSharedKey->CipherAlg, - pEntry); - STA_PORT_SECURED(pAd); - pAd->IndicateMediaState = NdisMediaStateConnected; - - DBGPRINT(RT_DEBUG_TRACE, ("%s : AID(%d) port secured\n", __FUNCTION__, pEntry->Aid)); - -} - -VOID WpaStaGroupKeySetting( - IN PRTMP_ADAPTER pAd) -{ - PCIPHER_KEY pSharedKey; - - pSharedKey = &pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId]; - - // Prepare pair-wise key information into shared key table - NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); - pSharedKey->KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pSharedKey->Key, pAd->StaCfg.GTK, LEN_TKIP_EK); - NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.GTK[16], LEN_TKIP_RXMICK); - NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.GTK[24], LEN_TKIP_TXMICK); - - // Update Shared Key CipherAlg - pSharedKey->CipherAlg = CIPHER_NONE; - if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption2Enabled) - pSharedKey->CipherAlg = CIPHER_TKIP; - else if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption3Enabled) - pSharedKey->CipherAlg = CIPHER_AES; - else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP40Enabled) - pSharedKey->CipherAlg = CIPHER_WEP64; - else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP104Enabled) - pSharedKey->CipherAlg = CIPHER_WEP128; - - // Update group key information to ASIC Shared Key Table - AsicAddSharedKeyEntry(pAd, - BSS0, - pAd->StaCfg.DefaultKeyId, - pSharedKey->CipherAlg, - pSharedKey->Key, - pSharedKey->TxMic, - pSharedKey->RxMic); - - // Update ASIC WCID attribute table and IVEIV table - RTMPAddWcidAttributeEntry(pAd, - BSS0, - pAd->StaCfg.DefaultKeyId, - pSharedKey->CipherAlg, - NULL); - -} diff --git a/drivers/staging/rt3090/sta_ioctl.c b/drivers/staging/rt3090/sta_ioctl.c deleted file mode 100644 index e419fb1d5ee4..000000000000 --- a/drivers/staging/rt3090/sta_ioctl.c +++ /dev/null @@ -1,4477 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - sta_ioctl.c - - Abstract: - IOCTL related subroutines - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Rory Chen 01-03-2003 created - Rory Chen 02-14-2005 modify to support RT61 -*/ - -#include "rt_config.h" - -#ifdef DBG -extern ULONG RTDebugLevel; -#endif - -#define NR_WEP_KEYS 4 -#define WEP_SMALL_KEY_LEN (40/8) -#define WEP_LARGE_KEY_LEN (104/8) - -#define GROUP_KEY_NO 4 - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) -#define IWE_STREAM_ADD_EVENT(_A, _B, _C, _D, _E) iwe_stream_add_event(_A, _B, _C, _D, _E) -#define IWE_STREAM_ADD_POINT(_A, _B, _C, _D, _E) iwe_stream_add_point(_A, _B, _C, _D, _E) -#define IWE_STREAM_ADD_VALUE(_A, _B, _C, _D, _E, _F) iwe_stream_add_value(_A, _B, _C, _D, _E, _F) -#else -#define IWE_STREAM_ADD_EVENT(_A, _B, _C, _D, _E) iwe_stream_add_event(_B, _C, _D, _E) -#define IWE_STREAM_ADD_POINT(_A, _B, _C, _D, _E) iwe_stream_add_point(_B, _C, _D, _E) -#define IWE_STREAM_ADD_VALUE(_A, _B, _C, _D, _E, _F) iwe_stream_add_value(_B, _C, _D, _E, _F) -#endif - -extern UCHAR CipherWpa2Template[]; - -typedef struct PACKED _RT_VERSION_INFO{ - UCHAR DriverVersionW; - UCHAR DriverVersionX; - UCHAR DriverVersionY; - UCHAR DriverVersionZ; - UINT DriverBuildYear; - UINT DriverBuildMonth; - UINT DriverBuildDay; -} RT_VERSION_INFO, *PRT_VERSION_INFO; - -struct iw_priv_args privtab[] = { -{ RTPRIV_IOCTL_SET, - IW_PRIV_TYPE_CHAR | 1024, 0, - "set"}, - -{ RTPRIV_IOCTL_SHOW, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, - ""}, -/* --- sub-ioctls definitions --- */ - { SHOW_CONN_STATUS, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "connStatus" }, - { SHOW_DRVIER_VERION, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "driverVer" }, - { SHOW_BA_INFO, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "bainfo" }, - { SHOW_DESC_INFO, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "descinfo" }, - { RAIO_OFF, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "radio_off" }, - { RAIO_ON, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "radio_on" }, -#ifdef QOS_DLS_SUPPORT - { SHOW_DLS_ENTRY_INFO, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "dlsentryinfo" }, -#endif // QOS_DLS_SUPPORT // - { SHOW_CFG_VALUE, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "show" }, - { SHOW_ADHOC_ENTRY_INFO, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "adhocEntry" }, -/* --- sub-ioctls relations --- */ - -{ RTPRIV_IOCTL_STATISTICS, - 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, - "stat"}, -{ RTPRIV_IOCTL_GSITESURVEY, - 0, IW_PRIV_TYPE_CHAR | 1024, - "get_site_survey"}, - - -}; - -static __s32 ralinkrate[] = - {2, 4, 11, 22, // CCK - 12, 18, 24, 36, 48, 72, 96, 108, // OFDM - 13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78, 104, 156, 208, 234, 260, // 20MHz, 800ns GI, MCS: 0 ~ 15 - 39, 78, 117, 156, 234, 312, 351, 390, // 20MHz, 800ns GI, MCS: 16 ~ 23 - 27, 54, 81, 108, 162, 216, 243, 270, 54, 108, 162, 216, 324, 432, 486, 540, // 40MHz, 800ns GI, MCS: 0 ~ 15 - 81, 162, 243, 324, 486, 648, 729, 810, // 40MHz, 800ns GI, MCS: 16 ~ 23 - 14, 29, 43, 57, 87, 115, 130, 144, 29, 59, 87, 115, 173, 230, 260, 288, // 20MHz, 400ns GI, MCS: 0 ~ 15 - 43, 87, 130, 173, 260, 317, 390, 433, // 20MHz, 400ns GI, MCS: 16 ~ 23 - 30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 480, 540, 600, // 40MHz, 400ns GI, MCS: 0 ~ 15 - 90, 180, 270, 360, 540, 720, 810, 900}; - - - -INT Set_SSID_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -#ifdef WMM_SUPPORT -INT Set_WmmCapable_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); -#endif - -INT Set_NetworkType_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_AuthMode_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_EncrypType_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_DefaultKeyID_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_Key1_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_Key2_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_Key3_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_Key4_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_WPAPSK_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - - -INT Set_PSMode_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -#ifdef RT3090 -INT Set_PCIePSLevel_Proc( -IN PRTMP_ADAPTER pAdapter, -IN PUCHAR arg); -#endif // RT3090 // -#ifdef WPA_SUPPLICANT_SUPPORT -INT Set_Wpa_Support( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); -#endif // WPA_SUPPLICANT_SUPPORT // - -NDIS_STATUS RTMPWPANoneAddKeyProc( - IN PRTMP_ADAPTER pAd, - IN PVOID pBuf); - -INT Set_FragTest_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -#ifdef DOT11_N_SUPPORT -INT Set_TGnWifiTest_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); -#endif // DOT11_N_SUPPORT // - -INT Set_LongRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_ShortRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -#ifdef EXT_BUILD_CHANNEL_LIST -INT Set_Ieee80211dClientMode_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); -#endif // EXT_BUILD_CHANNEL_LIST // - -#ifdef CARRIER_DETECTION_SUPPORT -INT Set_CarrierDetect_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); -#endif // CARRIER_DETECTION_SUPPORT // - -INT Show_Adhoc_MacTable_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING extra); - -#ifdef RTMP_RF_RW_SUPPORT -VOID RTMPIoctlRF( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq); -#endif // RTMP_RF_RW_SUPPORT // - - -INT Set_BeaconLostTime_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_AutoRoaming_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_SiteSurvey_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ForceTxBurst_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -#ifdef ANT_DIVERSITY_SUPPORT -INT Set_Antenna_Proc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); -#endif // ANT_DIVERSITY_SUPPORT // - -static struct { - PSTRING name; - INT (*set_proc)(PRTMP_ADAPTER pAdapter, PSTRING arg); -} *PRTMP_PRIVATE_SET_PROC, RTMP_PRIVATE_SUPPORT_PROC[] = { - {"DriverVersion", Set_DriverVersion_Proc}, - {"CountryRegion", Set_CountryRegion_Proc}, - {"CountryRegionABand", Set_CountryRegionABand_Proc}, - {"SSID", Set_SSID_Proc}, - {"WirelessMode", Set_WirelessMode_Proc}, - {"TxBurst", Set_TxBurst_Proc}, - {"TxPreamble", Set_TxPreamble_Proc}, - {"TxPower", Set_TxPower_Proc}, - {"Channel", Set_Channel_Proc}, - {"BGProtection", Set_BGProtection_Proc}, - {"RTSThreshold", Set_RTSThreshold_Proc}, - {"FragThreshold", Set_FragThreshold_Proc}, -#ifdef DOT11_N_SUPPORT - {"HtBw", Set_HtBw_Proc}, - {"HtMcs", Set_HtMcs_Proc}, - {"HtGi", Set_HtGi_Proc}, - {"HtOpMode", Set_HtOpMode_Proc}, - {"HtExtcha", Set_HtExtcha_Proc}, - {"HtMpduDensity", Set_HtMpduDensity_Proc}, - {"HtBaWinSize", Set_HtBaWinSize_Proc}, - {"HtRdg", Set_HtRdg_Proc}, - {"HtAmsdu", Set_HtAmsdu_Proc}, - {"HtAutoBa", Set_HtAutoBa_Proc}, - {"HtBaDecline", Set_BADecline_Proc}, - {"HtProtect", Set_HtProtect_Proc}, - {"HtMimoPs", Set_HtMimoPs_Proc}, - {"HtDisallowTKIP", Set_HtDisallowTKIP_Proc}, -#endif // DOT11_N_SUPPORT // - -#ifdef AGGREGATION_SUPPORT - {"PktAggregate", Set_PktAggregate_Proc}, -#endif // AGGREGATION_SUPPORT // - -#ifdef WMM_SUPPORT - {"WmmCapable", Set_WmmCapable_Proc}, -#endif - {"IEEE80211H", Set_IEEE80211H_Proc}, - {"NetworkType", Set_NetworkType_Proc}, - {"AuthMode", Set_AuthMode_Proc}, - {"EncrypType", Set_EncrypType_Proc}, - {"DefaultKeyID", Set_DefaultKeyID_Proc}, - {"Key1", Set_Key1_Proc}, - {"Key2", Set_Key2_Proc}, - {"Key3", Set_Key3_Proc}, - {"Key4", Set_Key4_Proc}, - {"WPAPSK", Set_WPAPSK_Proc}, - {"ResetCounter", Set_ResetStatCounter_Proc}, - {"PSMode", Set_PSMode_Proc}, -#ifdef DBG - {"Debug", Set_Debug_Proc}, -#endif // DBG // - -#ifdef RALINK_ATE - {"ATE", Set_ATE_Proc}, - {"ATEDA", Set_ATE_DA_Proc}, - {"ATESA", Set_ATE_SA_Proc}, - {"ATEBSSID", Set_ATE_BSSID_Proc}, - {"ATECHANNEL", Set_ATE_CHANNEL_Proc}, - {"ATETXPOW0", Set_ATE_TX_POWER0_Proc}, - {"ATETXPOW1", Set_ATE_TX_POWER1_Proc}, - {"ATETXANT", Set_ATE_TX_Antenna_Proc}, - {"ATERXANT", Set_ATE_RX_Antenna_Proc}, - {"ATETXFREQOFFSET", Set_ATE_TX_FREQOFFSET_Proc}, - {"ATETXBW", Set_ATE_TX_BW_Proc}, - {"ATETXLEN", Set_ATE_TX_LENGTH_Proc}, - {"ATETXCNT", Set_ATE_TX_COUNT_Proc}, - {"ATETXMCS", Set_ATE_TX_MCS_Proc}, - {"ATETXMODE", Set_ATE_TX_MODE_Proc}, - {"ATETXGI", Set_ATE_TX_GI_Proc}, - {"ATERXFER", Set_ATE_RX_FER_Proc}, - {"ATERRF", Set_ATE_Read_RF_Proc}, - {"ATEWRF1", Set_ATE_Write_RF1_Proc}, - {"ATEWRF2", Set_ATE_Write_RF2_Proc}, - {"ATEWRF3", Set_ATE_Write_RF3_Proc}, - {"ATEWRF4", Set_ATE_Write_RF4_Proc}, - {"ATELDE2P", Set_ATE_Load_E2P_Proc}, - {"ATERE2P", Set_ATE_Read_E2P_Proc}, - {"ATESHOW", Set_ATE_Show_Proc}, - {"ATEHELP", Set_ATE_Help_Proc}, - -#ifdef RALINK_28xx_QA - {"TxStop", Set_TxStop_Proc}, - {"RxStop", Set_RxStop_Proc}, -#endif // RALINK_28xx_QA // -#endif // RALINK_ATE // - -#ifdef WPA_SUPPLICANT_SUPPORT - {"WpaSupport", Set_Wpa_Support}, -#endif // WPA_SUPPLICANT_SUPPORT // - - - - - - {"FixedTxMode", Set_FixedTxMode_Proc}, -#ifdef CONFIG_APSTA_MIXED_SUPPORT - {"OpMode", Set_OpMode_Proc}, -#endif // CONFIG_APSTA_MIXED_SUPPORT // -#ifdef DOT11_N_SUPPORT - {"TGnWifiTest", Set_TGnWifiTest_Proc}, - {"ForceGF", Set_ForceGF_Proc}, -#endif // DOT11_N_SUPPORT // -#ifdef QOS_DLS_SUPPORT - {"DlsAddEntry", Set_DlsAddEntry_Proc}, - {"DlsTearDownEntry", Set_DlsTearDownEntry_Proc}, -#endif // QOS_DLS_SUPPORT // - {"LongRetry", Set_LongRetryLimit_Proc}, - {"ShortRetry", Set_ShortRetryLimit_Proc}, -#ifdef EXT_BUILD_CHANNEL_LIST - {"11dClientMode", Set_Ieee80211dClientMode_Proc}, -#endif // EXT_BUILD_CHANNEL_LIST // -#ifdef CARRIER_DETECTION_SUPPORT - {"CarrierDetect", Set_CarrierDetect_Proc}, -#endif // CARRIER_DETECTION_SUPPORT // - - -//2008/09/11:KH add to support efuse<-- -#ifdef RT30xx -#ifdef RTMP_EFUSE_SUPPORT - {"efuseFreeNumber", set_eFuseGetFreeBlockCount_Proc}, - {"efuseDump", set_eFusedump_Proc}, - {"efuseLoadFromBin", set_eFuseLoadFromBin_Proc}, - {"efuseBufferModeWriteBack", set_eFuseBufferModeWriteBack_Proc}, -#endif // RTMP_EFUSE_SUPPORT // -#ifdef ANT_DIVERSITY_SUPPORT - {"ant", Set_Antenna_Proc}, -#endif // ANT_DIVERSITY_SUPPORT // -#endif // RT30xx // -//2008/09/11:KH add to support efuse--> - - {"BeaconLostTime", Set_BeaconLostTime_Proc}, - {"AutoRoaming", Set_AutoRoaming_Proc}, - {"SiteSurvey", Set_SiteSurvey_Proc}, - {"ForceTxBurst", Set_ForceTxBurst_Proc}, - - {NULL,} -}; - - -VOID RTMPAddKey( - IN PRTMP_ADAPTER pAd, - IN PNDIS_802_11_KEY pKey) -{ - ULONG KeyIdx; - MAC_TABLE_ENTRY *pEntry; - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPAddKey ------>\n")); - - if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - { - if (pKey->KeyIndex & 0x80000000) - { - if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) - { - NdisZeroMemory(pAd->StaCfg.PMK, 32); - NdisMoveMemory(pAd->StaCfg.PMK, pKey->KeyMaterial, pKey->KeyLength); - goto end; - } - // Update PTK - NdisZeroMemory(&pAd->SharedKey[BSS0][0], sizeof(CIPHER_KEY)); - pAd->SharedKey[BSS0][0].KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pAd->SharedKey[BSS0][0].Key, pKey->KeyMaterial, LEN_TKIP_EK); -#ifdef WPA_SUPPLICANT_SUPPORT - if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) - { - NdisMoveMemory(pAd->SharedKey[BSS0][0].RxMic, pKey->KeyMaterial + LEN_TKIP_EK, LEN_TKIP_TXMICK); - NdisMoveMemory(pAd->SharedKey[BSS0][0].TxMic, pKey->KeyMaterial + LEN_TKIP_EK + LEN_TKIP_TXMICK, LEN_TKIP_RXMICK); - } - else -#endif // WPA_SUPPLICANT_SUPPORT // - { - NdisMoveMemory(pAd->SharedKey[BSS0][0].TxMic, pKey->KeyMaterial + LEN_TKIP_EK, LEN_TKIP_TXMICK); - NdisMoveMemory(pAd->SharedKey[BSS0][0].RxMic, pKey->KeyMaterial + LEN_TKIP_EK + LEN_TKIP_TXMICK, LEN_TKIP_RXMICK); - } - - // Decide its ChiperAlg - if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) - pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_TKIP; - else if (pAd->StaCfg.PairCipher == Ndis802_11Encryption3Enabled) - pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_AES; - else - pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_NONE; - - // Update these related information to MAC_TABLE_ENTRY - pEntry = &pAd->MacTab.Content[BSSID_WCID]; - NdisMoveMemory(pEntry->PairwiseKey.Key, pAd->SharedKey[BSS0][0].Key, LEN_TKIP_EK); - NdisMoveMemory(pEntry->PairwiseKey.RxMic, pAd->SharedKey[BSS0][0].RxMic, LEN_TKIP_RXMICK); - NdisMoveMemory(pEntry->PairwiseKey.TxMic, pAd->SharedKey[BSS0][0].TxMic, LEN_TKIP_TXMICK); - pEntry->PairwiseKey.CipherAlg = pAd->SharedKey[BSS0][0].CipherAlg; - - // Update pairwise key information to ASIC Shared Key Table - AsicAddSharedKeyEntry(pAd, - BSS0, - 0, - pAd->SharedKey[BSS0][0].CipherAlg, - pAd->SharedKey[BSS0][0].Key, - pAd->SharedKey[BSS0][0].TxMic, - pAd->SharedKey[BSS0][0].RxMic); - - // Update ASIC WCID attribute table and IVEIV table - RTMPAddWcidAttributeEntry(pAd, - BSS0, - 0, - pAd->SharedKey[BSS0][0].CipherAlg, - pEntry); - - if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA2) - { - // set 802.1x port control - //pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - STA_PORT_SECURED(pAd); - - // Indicate Connected for GUI - pAd->IndicateMediaState = NdisMediaStateConnected; - } - } - else - { - // Update GTK - pAd->StaCfg.DefaultKeyId = (pKey->KeyIndex & 0xFF); - NdisZeroMemory(&pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId], sizeof(CIPHER_KEY)); - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].Key, pKey->KeyMaterial, LEN_TKIP_EK); -#ifdef WPA_SUPPLICANT_SUPPORT - if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption2Enabled) - { - NdisMoveMemory(pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].RxMic, pKey->KeyMaterial + LEN_TKIP_EK, LEN_TKIP_TXMICK); - NdisMoveMemory(pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].TxMic, pKey->KeyMaterial + LEN_TKIP_EK + LEN_TKIP_TXMICK, LEN_TKIP_RXMICK); - } - else -#endif // WPA_SUPPLICANT_SUPPORT // - { - NdisMoveMemory(pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].TxMic, pKey->KeyMaterial + LEN_TKIP_EK, LEN_TKIP_TXMICK); - NdisMoveMemory(pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].RxMic, pKey->KeyMaterial + LEN_TKIP_EK + LEN_TKIP_TXMICK, LEN_TKIP_RXMICK); - } - - // Update Shared Key CipherAlg - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_NONE; - if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption2Enabled) - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_TKIP; - else if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption3Enabled) - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_AES; - - // Update group key information to ASIC Shared Key Table - AsicAddSharedKeyEntry(pAd, - BSS0, - pAd->StaCfg.DefaultKeyId, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].Key, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].TxMic, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].RxMic); - - // Update ASIC WCID attribute table and IVEIV table - RTMPAddWcidAttributeEntry(pAd, - BSS0, - pAd->StaCfg.DefaultKeyId, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg, - NULL); - - // set 802.1x port control - //pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - STA_PORT_SECURED(pAd); - - // Indicate Connected for GUI - pAd->IndicateMediaState = NdisMediaStateConnected; - } - } - else // dynamic WEP from wpa_supplicant - { - UCHAR CipherAlg; - PUCHAR Key; - - if(pKey->KeyLength == 32) - goto end; - - KeyIdx = pKey->KeyIndex & 0x0fffffff; - - if (KeyIdx < 4) - { - // it is a default shared key, for Pairwise key setting - if (pKey->KeyIndex & 0x80000000) - { - pEntry = MacTableLookup(pAd, pKey->BSSID); - - if (pEntry) - { - DBGPRINT(RT_DEBUG_TRACE, ("RTMPAddKey: Set Pair-wise Key\n")); - - // set key material and key length - pEntry->PairwiseKey.KeyLen = (UCHAR)pKey->KeyLength; - NdisMoveMemory(pEntry->PairwiseKey.Key, &pKey->KeyMaterial, pKey->KeyLength); - - // set Cipher type - if (pKey->KeyLength == 5) - pEntry->PairwiseKey.CipherAlg = CIPHER_WEP64; - else - pEntry->PairwiseKey.CipherAlg = CIPHER_WEP128; - - // Add Pair-wise key to Asic - AsicAddPairwiseKeyEntry( - pAd, - pEntry->Addr, - (UCHAR)pEntry->Aid, - &pEntry->PairwiseKey); - - // update WCID attribute table and IVEIV table for this entry - RTMPAddWcidAttributeEntry( - pAd, - BSS0, - KeyIdx, // The value may be not zero - pEntry->PairwiseKey.CipherAlg, - pEntry); - - } - } - else - { - // Default key for tx (shared key) - pAd->StaCfg.DefaultKeyId = (UCHAR) KeyIdx; - - // set key material and key length - pAd->SharedKey[BSS0][KeyIdx].KeyLen = (UCHAR) pKey->KeyLength; - NdisMoveMemory(pAd->SharedKey[BSS0][KeyIdx].Key, &pKey->KeyMaterial, pKey->KeyLength); - - // Set Ciper type - if (pKey->KeyLength == 5) - pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_WEP64; - else - pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_WEP128; - - CipherAlg = pAd->SharedKey[BSS0][KeyIdx].CipherAlg; - Key = pAd->SharedKey[BSS0][KeyIdx].Key; - - // Set Group key material to Asic - AsicAddSharedKeyEntry(pAd, BSS0, KeyIdx, CipherAlg, Key, NULL, NULL); - - // Update WCID attribute table and IVEIV table for this group key table - RTMPAddWcidAttributeEntry(pAd, BSS0, KeyIdx, CipherAlg, NULL); - - } - } - } -end: - return; -} - -char * rtstrchr(const char * s, int c) -{ - for(; *s != (char) c; ++s) - if (*s == '\0') - return NULL; - return (char *) s; -} - -/* -This is required for LinEX2004/kernel2.6.7 to provide iwlist scanning function -*/ - -int -rt_ioctl_giwname(struct net_device *dev, - struct iw_request_info *info, - char *name, char *extra) -{ - -#ifdef RTMP_MAC_PCI - strncpy(name, "RT2860 Wireless", IFNAMSIZ); -#endif // RTMP_MAC_PCI // - return 0; -} - -int rt_ioctl_siwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *freq, char *extra) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - int chan = -1; - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - - if (freq->e > 1) - return -EINVAL; - - if((freq->e == 0) && (freq->m <= 1000)) - chan = freq->m; // Setting by channel number - else - MAP_KHZ_TO_CHANNEL_ID( (freq->m /100) , chan); // Setting by frequency - search the table , like 2.412G, 2.422G, - - if (ChannelSanity(pAdapter, chan) == TRUE) - { - pAdapter->CommonCfg.Channel = chan; - DBGPRINT(RT_DEBUG_ERROR, ("==>rt_ioctl_siwfreq::SIOCSIWFREQ[cmd=0x%x] (Channel=%d)\n", SIOCSIWFREQ, pAdapter->CommonCfg.Channel)); - } - else - return -EINVAL; - - return 0; -} - - -int rt_ioctl_giwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *freq, char *extra) -{ - PRTMP_ADAPTER pAdapter = NULL; - UCHAR ch; - ULONG m = 2412000; - - pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->priv will be NULL in 2rd open */ - return -ENETDOWN; - } - - ch = pAdapter->CommonCfg.Channel; - - DBGPRINT(RT_DEBUG_TRACE,("==>rt_ioctl_giwfreq %d\n", ch)); - - MAP_CHANNEL_ID_TO_KHZ(ch, m); - freq->m = m * 100; - freq->e = 1; - return 0; -} - - -int rt_ioctl_siwmode(struct net_device *dev, - struct iw_request_info *info, - __u32 *mode, char *extra) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - switch (*mode) - { - case IW_MODE_ADHOC: - Set_NetworkType_Proc(pAdapter, "Adhoc"); - break; - case IW_MODE_INFRA: - Set_NetworkType_Proc(pAdapter, "Infra"); - break; -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20)) - case IW_MODE_MONITOR: - Set_NetworkType_Proc(pAdapter, "Monitor"); - break; -#endif - default: - DBGPRINT(RT_DEBUG_TRACE, ("===>rt_ioctl_siwmode::SIOCSIWMODE (unknown %d)\n", *mode)); - return -EINVAL; - } - - // Reset Ralink supplicant to not use, it will be set to start when UI set PMK key - pAdapter->StaCfg.WpaState = SS_NOTUSE; - - return 0; -} - - -int rt_ioctl_giwmode(struct net_device *dev, - struct iw_request_info *info, - __u32 *mode, char *extra) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->priv will be NULL in 2rd open */ - return -ENETDOWN; - } - - if (ADHOC_ON(pAdapter)) - *mode = IW_MODE_ADHOC; - else if (INFRA_ON(pAdapter)) - *mode = IW_MODE_INFRA; -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20)) - else if (MONITOR_ON(pAdapter)) - { - *mode = IW_MODE_MONITOR; - } -#endif - else - *mode = IW_MODE_AUTO; - - DBGPRINT(RT_DEBUG_TRACE, ("==>rt_ioctl_giwmode(mode=%d)\n", *mode)); - return 0; -} - -int rt_ioctl_siwsens(struct net_device *dev, - struct iw_request_info *info, - char *name, char *extra) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - return 0; -} - -int rt_ioctl_giwsens(struct net_device *dev, - struct iw_request_info *info, - char *name, char *extra) -{ - return 0; -} - -int rt_ioctl_giwrange(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - struct iw_range *range = (struct iw_range *) extra; - u16 val; - int i; - - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->priv will be NULL in 2rd open */ - return -ENETDOWN; - } - - DBGPRINT(RT_DEBUG_TRACE ,("===>rt_ioctl_giwrange\n")); - data->length = sizeof(struct iw_range); - memset(range, 0, sizeof(struct iw_range)); - - range->txpower_capa = IW_TXPOW_DBM; - - if (INFRA_ON(pAdapter)||ADHOC_ON(pAdapter)) - { - range->min_pmp = 1 * 1024; - range->max_pmp = 65535 * 1024; - range->min_pmt = 1 * 1024; - range->max_pmt = 1000 * 1024; - range->pmp_flags = IW_POWER_PERIOD; - range->pmt_flags = IW_POWER_TIMEOUT; - range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | - IW_POWER_UNICAST_R | IW_POWER_ALL_R; - } - - range->we_version_compiled = WIRELESS_EXT; - range->we_version_source = 14; - - range->retry_capa = IW_RETRY_LIMIT; - range->retry_flags = IW_RETRY_LIMIT; - range->min_retry = 0; - range->max_retry = 255; - - range->num_channels = pAdapter->ChannelListNum; - - val = 0; - for (i = 1; i <= range->num_channels; i++) - { - u32 m = 2412000; - range->freq[val].i = pAdapter->ChannelList[i-1].Channel; - MAP_CHANNEL_ID_TO_KHZ(pAdapter->ChannelList[i-1].Channel, m); - range->freq[val].m = m * 100; /* OS_HZ */ - - range->freq[val].e = 1; - val++; - if (val == IW_MAX_FREQUENCIES) - break; - } - range->num_frequency = val; - - range->max_qual.qual = 100; /* what is correct max? This was not - * documented exactly. At least - * 69 has been observed. */ - range->max_qual.level = 0; /* dB */ - range->max_qual.noise = 0; /* dB */ - - /* What would be suitable values for "average/typical" qual? */ - range->avg_qual.qual = 20; - range->avg_qual.level = -60; - range->avg_qual.noise = -95; - range->sensitivity = 3; - - range->max_encoding_tokens = NR_WEP_KEYS; - range->num_encoding_sizes = 2; - range->encoding_size[0] = 5; - range->encoding_size[1] = 13; - - range->min_rts = 0; - range->max_rts = 2347; - range->min_frag = 256; - range->max_frag = 2346; - -#if WIRELESS_EXT > 17 - /* IW_ENC_CAPA_* bit field */ - range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | - IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; -#endif - - return 0; -} - -int rt_ioctl_siwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, char *extra) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - NDIS_802_11_MAC_ADDRESS Bssid; - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { - RTMP_MLME_RESET_STATE_MACHINE(pAdapter); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); - } - - // tell CNTL state machine to call NdisMSetInformationComplete() after completing - // this request, because this request is initiated by NDIS. - pAdapter->MlmeAux.CurrReqIsFromNdis = FALSE; - // Prevent to connect AP again in STAMlmePeriodicExec - pAdapter->MlmeAux.AutoReconnectSsidLen= 32; - - memset(Bssid, 0, MAC_ADDR_LEN); - memcpy(Bssid, ap_addr->sa_data, MAC_ADDR_LEN); - MlmeEnqueue(pAdapter, - MLME_CNTL_STATE_MACHINE, - OID_802_11_BSSID, - sizeof(NDIS_802_11_MAC_ADDRESS), - (VOID *)&Bssid); - - DBGPRINT(RT_DEBUG_TRACE, ("IOCTL::SIOCSIWAP %02x:%02x:%02x:%02x:%02x:%02x\n", - Bssid[0], Bssid[1], Bssid[2], Bssid[3], Bssid[4], Bssid[5])); - - return 0; -} - -int rt_ioctl_giwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, char *extra) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->priv will be NULL in 2rd open */ - return -ENETDOWN; - } - - if (INFRA_ON(pAdapter) || ADHOC_ON(pAdapter)) - { - ap_addr->sa_family = ARPHRD_ETHER; - memcpy(ap_addr->sa_data, &pAdapter->CommonCfg.Bssid, ETH_ALEN); - } -#ifdef WPA_SUPPLICANT_SUPPORT - // Add for RT2870 - else if (pAdapter->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) - { - ap_addr->sa_family = ARPHRD_ETHER; - memcpy(ap_addr->sa_data, &pAdapter->MlmeAux.Bssid, ETH_ALEN); - } -#endif // WPA_SUPPLICANT_SUPPORT // - else - { - DBGPRINT(RT_DEBUG_TRACE, ("IOCTL::SIOCGIWAP(=EMPTY)\n")); - return -ENOTCONN; - } - - return 0; -} - -/* - * Units are in db above the noise floor. That means the - * rssi values reported in the tx/rx descriptors in the - * driver are the SNR expressed in db. - * - * If you assume that the noise floor is -95, which is an - * excellent assumption 99.5 % of the time, then you can - * derive the absolute signal level (i.e. -95 + rssi). - * There are some other slight factors to take into account - * depending on whether the rssi measurement is from 11b, - * 11g, or 11a. These differences are at most 2db and - * can be documented. - * - * NB: various calculations are based on the orinoco/wavelan - * drivers for compatibility - */ -static void set_quality(PRTMP_ADAPTER pAdapter, - struct iw_quality *iq, - signed char rssi) -{ - __u8 ChannelQuality; - - // Normalize Rssi - if (rssi >= -50) - ChannelQuality = 100; - else if (rssi >= -80) // between -50 ~ -80dbm - ChannelQuality = (__u8)(24 + ((rssi + 80) * 26)/10); - else if (rssi >= -90) // between -80 ~ -90dbm - ChannelQuality = (__u8)((rssi + 90) * 26)/10; - else - ChannelQuality = 0; - - iq->qual = (__u8)ChannelQuality; - - iq->level = (__u8)(rssi); - iq->noise = (pAdapter->BbpWriteLatch[66] > pAdapter->BbpTuning.FalseCcaUpperThreshold) ? ((__u8)pAdapter->BbpTuning.FalseCcaUpperThreshold) : ((__u8) pAdapter->BbpWriteLatch[66]); // noise level (dBm) - iq->noise += 256 - 143; - iq->updated = pAdapter->iw_stats.qual.updated; -} - -int rt_ioctl_iwaplist(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - - struct sockaddr addr[IW_MAX_AP]; - struct iw_quality qual[IW_MAX_AP]; - int i; - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - data->length = 0; - return 0; - //return -ENETDOWN; - } - - for (i = 0; i = pAdapter->ScanTab.BssNr) - break; - addr[i].sa_family = ARPHRD_ETHER; - memcpy(addr[i].sa_data, &pAdapter->ScanTab.BssEntry[i].Bssid, MAC_ADDR_LEN); - set_quality(pAdapter, &qual[i], pAdapter->ScanTab.BssEntry[i].Rssi); - } - data->length = i; - memcpy(extra, &addr, i*sizeof(addr[0])); - data->flags = 1; /* signal quality present (sort of) */ - memcpy(extra + i*sizeof(addr[0]), &qual, i*sizeof(qual[i])); - - return 0; -} - -#ifdef SIOCGIWSCAN -int rt_ioctl_siwscan(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - - ULONG Now; - int Status = NDIS_STATUS_SUCCESS; - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - if (MONITOR_ON(pAdapter)) - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! Driver is in Monitor Mode now !!!\n")); - return -EINVAL; - } - - -#ifdef WPA_SUPPLICANT_SUPPORT - if (pAdapter->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) - { - pAdapter->StaCfg.WpaSupplicantScanCount++; - } -#endif // WPA_SUPPLICANT_SUPPORT // - - pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE; - if (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - return NDIS_STATUS_SUCCESS; - do{ - Now = jiffies; - -#ifdef WPA_SUPPLICANT_SUPPORT - if ((pAdapter->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) && - (pAdapter->StaCfg.WpaSupplicantScanCount > 3)) - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! WpaSupplicantScanCount > 3\n")); - Status = NDIS_STATUS_SUCCESS; - break; - } -#endif // WPA_SUPPLICANT_SUPPORT // - - if ((OPSTATUS_TEST_FLAG(pAdapter, fOP_STATUS_MEDIA_STATE_CONNECTED)) && - ((pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || - (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) && - (pAdapter->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED)) - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! Link UP, Port Not Secured! ignore this set::OID_802_11_BSSID_LIST_SCAN\n")); - Status = NDIS_STATUS_SUCCESS; - break; - } - - if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { - RTMP_MLME_RESET_STATE_MACHINE(pAdapter); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); - } - - // tell CNTL state machine to call NdisMSetInformationComplete() after completing - // this request, because this request is initiated by NDIS. - pAdapter->MlmeAux.CurrReqIsFromNdis = FALSE; - // Reset allowed scan retries - pAdapter->StaCfg.ScanCnt = 0; - pAdapter->StaCfg.LastScanTime = Now; - - MlmeEnqueue(pAdapter, - MLME_CNTL_STATE_MACHINE, - OID_802_11_BSSID_LIST_SCAN, - 0, - NULL); - - Status = NDIS_STATUS_SUCCESS; - RTMP_MLME_HANDLER(pAdapter); - }while(0); - return NDIS_STATUS_SUCCESS; -} - -int rt_ioctl_giwscan(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - int i=0; - PSTRING current_ev = extra, previous_ev = extra; - PSTRING end_buf; - PSTRING current_val; - STRING custom[MAX_CUSTOM_LEN] = {0}; -#ifndef IWEVGENIE - unsigned char idx; -#endif // IWEVGENIE // - struct iw_event iwe; - - if (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - { - /* - * Still scanning, indicate the caller should try again. - */ - return -EAGAIN; - } - - -#ifdef WPA_SUPPLICANT_SUPPORT - if (pAdapter->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) - { - pAdapter->StaCfg.WpaSupplicantScanCount = 0; - } -#endif // WPA_SUPPLICANT_SUPPORT // - - if (pAdapter->ScanTab.BssNr == 0) - { - data->length = 0; - return 0; - } - -#if WIRELESS_EXT >= 17 - if (data->length > 0) - end_buf = extra + data->length; - else - end_buf = extra + IW_SCAN_MAX_DATA; -#else - end_buf = extra + IW_SCAN_MAX_DATA; -#endif - - for (i = 0; i < pAdapter->ScanTab.BssNr; i++) - { - if (current_ev >= end_buf) - { -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif - } - - //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, &pAdapter->ScanTab.BssEntry[i].Bssid, ETH_ALEN); - - previous_ev = current_ev; - current_ev = IWE_STREAM_ADD_EVENT(info, current_ev,end_buf, &iwe, IW_EV_ADDR_LEN); - if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif - - /* - Protocol: - it will show scanned AP's WirelessMode . - it might be - 802.11a - 802.11a/n - 802.11g/n - 802.11b/g/n - 802.11g - 802.11b/g - */ - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWNAME; - - - { - PBSS_ENTRY pBssEntry=&pAdapter->ScanTab.BssEntry[i]; - BOOLEAN isGonly=FALSE; - int rateCnt=0; - - if (pBssEntry->Channel>14) - { - if (pBssEntry->HtCapabilityLen!=0) - strcpy(iwe.u.name,"802.11a/n"); - else - strcpy(iwe.u.name,"802.11a"); - } - else - { - /* - if one of non B mode rate is set supported rate . it mean G only. - */ - for (rateCnt=0;rateCntSupRateLen;rateCnt++) - { - /* - 6Mbps(140) 9Mbps(146) and >=12Mbps(152) are supported rate , it mean G only. - */ - if (pBssEntry->SupRate[rateCnt]==140 || pBssEntry->SupRate[rateCnt]==146 || pBssEntry->SupRate[rateCnt]>=152) - isGonly=TRUE; - } - - for (rateCnt=0;rateCntExtRateLen;rateCnt++) - { - if (pBssEntry->ExtRate[rateCnt]==140 || pBssEntry->ExtRate[rateCnt]==146 || pBssEntry->ExtRate[rateCnt]>=152) - isGonly=TRUE; - } - - - if (pBssEntry->HtCapabilityLen!=0) - { - if (isGonly==TRUE) - strcpy(iwe.u.name,"802.11g/n"); - else - strcpy(iwe.u.name,"802.11b/g/n"); - } - else - { - if (isGonly==TRUE) - strcpy(iwe.u.name,"802.11g"); - else - { - if (pBssEntry->SupRateLen==4 && pBssEntry->ExtRateLen==0) - strcpy(iwe.u.name,"802.11b"); - else - strcpy(iwe.u.name,"802.11b/g"); - } - } - } - } - - previous_ev = current_ev; - current_ev = IWE_STREAM_ADD_EVENT(info, current_ev,end_buf, &iwe, IW_EV_ADDR_LEN); - if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif - - //ESSID - //================================ - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWESSID; - iwe.u.data.length = pAdapter->ScanTab.BssEntry[i].SsidLen; - iwe.u.data.flags = 1; - - previous_ev = current_ev; - current_ev = IWE_STREAM_ADD_POINT(info, current_ev,end_buf, &iwe, (PSTRING) pAdapter->ScanTab.BssEntry[i].Ssid); - if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif - - //Network Type - //================================ - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWMODE; - if (pAdapter->ScanTab.BssEntry[i].BssType == Ndis802_11IBSS) - { - iwe.u.mode = IW_MODE_ADHOC; - } - else if (pAdapter->ScanTab.BssEntry[i].BssType == Ndis802_11Infrastructure) - { - iwe.u.mode = IW_MODE_INFRA; - } - else - { - iwe.u.mode = IW_MODE_AUTO; - } - iwe.len = IW_EV_UINT_LEN; - - previous_ev = current_ev; - current_ev = IWE_STREAM_ADD_EVENT(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN); - if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif - - //Channel and Frequency - //================================ - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWFREQ; - if (INFRA_ON(pAdapter) || ADHOC_ON(pAdapter)) - iwe.u.freq.m = pAdapter->ScanTab.BssEntry[i].Channel; - else - iwe.u.freq.m = pAdapter->ScanTab.BssEntry[i].Channel; - iwe.u.freq.e = 0; - iwe.u.freq.i = 0; - - previous_ev = current_ev; - current_ev = IWE_STREAM_ADD_EVENT(info, current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); - if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif - - //Add quality statistics - //================================ - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVQUAL; - iwe.u.qual.level = 0; - iwe.u.qual.noise = 0; - set_quality(pAdapter, &iwe.u.qual, pAdapter->ScanTab.BssEntry[i].Rssi); - current_ev = IWE_STREAM_ADD_EVENT(info, current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); - if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif - - //Encyption key - //================================ - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWENCODE; - if (CAP_IS_PRIVACY_ON (pAdapter->ScanTab.BssEntry[i].CapabilityInfo )) - iwe.u.data.flags =IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - else - iwe.u.data.flags = IW_ENCODE_DISABLED; - - previous_ev = current_ev; - current_ev = IWE_STREAM_ADD_POINT(info, current_ev, end_buf,&iwe, (char *)pAdapter->SharedKey[BSS0][(iwe.u.data.flags & IW_ENCODE_INDEX)-1].Key); - if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif - - //Bit Rate - //================================ - if (pAdapter->ScanTab.BssEntry[i].SupRateLen) - { - UCHAR tmpRate = pAdapter->ScanTab.BssEntry[i].SupRate[pAdapter->ScanTab.BssEntry[i].SupRateLen-1]; - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWRATE; - current_val = current_ev + IW_EV_LCP_LEN; - if (tmpRate == 0x82) - iwe.u.bitrate.value = 1 * 1000000; - else if (tmpRate == 0x84) - iwe.u.bitrate.value = 2 * 1000000; - else if (tmpRate == 0x8B) - iwe.u.bitrate.value = 5.5 * 1000000; - else if (tmpRate == 0x96) - iwe.u.bitrate.value = 11 * 1000000; - else - iwe.u.bitrate.value = (tmpRate/2) * 1000000; - - if (tmpRate == 0x6c && pAdapter->ScanTab.BssEntry[i].HtCapabilityLen > 0) - { - int rate_count = sizeof(ralinkrate)/sizeof(__s32); - HT_CAP_INFO capInfo = pAdapter->ScanTab.BssEntry[i].HtCapability.HtCapInfo; - int shortGI = capInfo.ChannelWidth ? capInfo.ShortGIfor40 : capInfo.ShortGIfor20; - int maxMCS = pAdapter->ScanTab.BssEntry[i].HtCapability.MCSSet[1] ? 15 : 7; - int rate_index = 12 + ((UCHAR)capInfo.ChannelWidth * 24) + ((UCHAR)shortGI *48) + ((UCHAR)maxMCS); - if (rate_index < 0) - rate_index = 0; - if (rate_index > rate_count) - rate_index = rate_count; - iwe.u.bitrate.value = ralinkrate[rate_index] * 500000; - } - - iwe.u.bitrate.disabled = 0; - 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; - else -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif - } - -#ifdef IWEVGENIE - //WPA IE - if (pAdapter->ScanTab.BssEntry[i].WpaIE.IELen > 0) - { - memset(&iwe, 0, sizeof(iwe)); - memset(&custom[0], 0, MAX_CUSTOM_LEN); - memcpy(custom, &(pAdapter->ScanTab.BssEntry[i].WpaIE.IE[0]), - pAdapter->ScanTab.BssEntry[i].WpaIE.IELen); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = pAdapter->ScanTab.BssEntry[i].WpaIE.IELen; - current_ev = IWE_STREAM_ADD_POINT(info, current_ev, end_buf, &iwe, custom); - if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif - } - - //WPA2 IE - if (pAdapter->ScanTab.BssEntry[i].RsnIE.IELen > 0) - { - memset(&iwe, 0, sizeof(iwe)); - memset(&custom[0], 0, MAX_CUSTOM_LEN); - memcpy(custom, &(pAdapter->ScanTab.BssEntry[i].RsnIE.IE[0]), - pAdapter->ScanTab.BssEntry[i].RsnIE.IELen); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = pAdapter->ScanTab.BssEntry[i].RsnIE.IELen; - current_ev = IWE_STREAM_ADD_POINT(info, current_ev, end_buf, &iwe, custom); - if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif - } -#else - //WPA IE - //================================ - if (pAdapter->ScanTab.BssEntry[i].WpaIE.IELen > 0) - { - NdisZeroMemory(&iwe, sizeof(iwe)); - memset(&custom[0], 0, MAX_CUSTOM_LEN); - iwe.cmd = IWEVCUSTOM; - iwe.u.data.length = (pAdapter->ScanTab.BssEntry[i].WpaIE.IELen * 2) + 7; - NdisMoveMemory(custom, "wpa_ie=", 7); - for (idx = 0; idx < pAdapter->ScanTab.BssEntry[i].WpaIE.IELen; idx++) - sprintf(custom, "%s%02x", custom, pAdapter->ScanTab.BssEntry[i].WpaIE.IE[idx]); - previous_ev = current_ev; - current_ev = IWE_STREAM_ADD_POINT(info, current_ev, end_buf, &iwe, custom); - if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif - } - - //WPA2 IE - if (pAdapter->ScanTab.BssEntry[i].RsnIE.IELen > 0) - { - NdisZeroMemory(&iwe, sizeof(iwe)); - memset(&custom[0], 0, MAX_CUSTOM_LEN); - iwe.cmd = IWEVCUSTOM; - iwe.u.data.length = (pAdapter->ScanTab.BssEntry[i].RsnIE.IELen * 2) + 7; - NdisMoveMemory(custom, "rsn_ie=", 7); - for (idx = 0; idx < pAdapter->ScanTab.BssEntry[i].RsnIE.IELen; idx++) - sprintf(custom, "%s%02x", custom, pAdapter->ScanTab.BssEntry[i].RsnIE.IE[idx]); - previous_ev = current_ev; - current_ev = IWE_STREAM_ADD_POINT(info, current_ev, end_buf, &iwe, custom); - if (current_ev == previous_ev) -#if WIRELESS_EXT >= 17 - return -E2BIG; -#else - break; -#endif - } -#endif // IWEVGENIE // - } - - data->length = current_ev - extra; - pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE; - DBGPRINT(RT_DEBUG_ERROR ,("===>rt_ioctl_giwscan. %d(%d) BSS returned, data->length = %d\n",i , pAdapter->ScanTab.BssNr, data->length)); - return 0; -} -#endif - -int rt_ioctl_siwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *essid) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - if (data->flags) - { - PSTRING pSsidString = NULL; - - // Includes null character. - if (data->length > (IW_ESSID_MAX_SIZE + 1)) - return -E2BIG; - - pSsidString = kmalloc(MAX_LEN_OF_SSID+1, MEM_ALLOC_FLAG); - if (pSsidString) - { - NdisZeroMemory(pSsidString, MAX_LEN_OF_SSID+1); - NdisMoveMemory(pSsidString, essid, data->length); - if (Set_SSID_Proc(pAdapter, pSsidString) == FALSE) - return -EINVAL; - } - else - return -ENOMEM; - } - else - { - // ANY ssid - if (Set_SSID_Proc(pAdapter, "") == FALSE) - return -EINVAL; - } - return 0; -} - -int rt_ioctl_giwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *essid) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->priv will be NULL in 2rd open */ - return -ENETDOWN; - } - - data->flags = 1; - if (MONITOR_ON(pAdapter)) - { - data->length = 0; - return 0; - } - - if (OPSTATUS_TEST_FLAG(pAdapter, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - DBGPRINT(RT_DEBUG_TRACE ,("MediaState is connected\n")); - data->length = pAdapter->CommonCfg.SsidLen; - memcpy(essid, pAdapter->CommonCfg.Ssid, pAdapter->CommonCfg.SsidLen); - } - else - {//the ANY ssid was specified - data->length = 0; - DBGPRINT(RT_DEBUG_TRACE ,("MediaState is not connected, ess\n")); - } - - return 0; - -} - -int rt_ioctl_siwnickn(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *nickname) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE ,("INFO::Network is down!\n")); - return -ENETDOWN; - } - - if (data->length > IW_ESSID_MAX_SIZE) - return -EINVAL; - - memset(pAdapter->nickname, 0, IW_ESSID_MAX_SIZE + 1); - memcpy(pAdapter->nickname, nickname, data->length); - - - return 0; -} - -int rt_ioctl_giwnickn(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *nickname) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->priv will be NULL in 2rd open */ - return -ENETDOWN; - } - - if (data->length > strlen((PSTRING) pAdapter->nickname) + 1) - data->length = strlen((PSTRING) pAdapter->nickname) + 1; - if (data->length > 0) { - memcpy(nickname, pAdapter->nickname, data->length-1); - nickname[data->length-1] = '\0'; - } - return 0; -} - -int rt_ioctl_siwrts(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rts, char *extra) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - u16 val; - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - if (rts->disabled) - val = MAX_RTS_THRESHOLD; - else if (rts->value < 0 || rts->value > MAX_RTS_THRESHOLD) - return -EINVAL; - else if (rts->value == 0) - val = MAX_RTS_THRESHOLD; - else - val = rts->value; - - if (val != pAdapter->CommonCfg.RtsThreshold) - pAdapter->CommonCfg.RtsThreshold = val; - - return 0; -} - -int rt_ioctl_giwrts(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rts, char *extra) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->priv will be NULL in 2rd open */ - return -ENETDOWN; - } - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - rts->value = pAdapter->CommonCfg.RtsThreshold; - rts->disabled = (rts->value == MAX_RTS_THRESHOLD); - rts->fixed = 1; - - return 0; -} - -int rt_ioctl_siwfrag(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *frag, char *extra) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - u16 val; - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - if (frag->disabled) - val = MAX_FRAG_THRESHOLD; - else if (frag->value >= MIN_FRAG_THRESHOLD || frag->value <= MAX_FRAG_THRESHOLD) - val = __cpu_to_le16(frag->value & ~0x1); /* even numbers only */ - else if (frag->value == 0) - val = MAX_FRAG_THRESHOLD; - else - return -EINVAL; - - pAdapter->CommonCfg.FragmentThreshold = val; - return 0; -} - -int rt_ioctl_giwfrag(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *frag, char *extra) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->priv will be NULL in 2rd open */ - return -ENETDOWN; - } - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - frag->value = pAdapter->CommonCfg.FragmentThreshold; - frag->disabled = (frag->value == MAX_FRAG_THRESHOLD); - frag->fixed = 1; - - return 0; -} - -#define MAX_WEP_KEY_SIZE 13 -#define MIN_WEP_KEY_SIZE 5 -int rt_ioctl_siwencode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, char *extra) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - if ((erq->length == 0) && - (erq->flags & IW_ENCODE_DISABLED)) - { - pAdapter->StaCfg.PairCipher = Ndis802_11WEPDisabled; - pAdapter->StaCfg.GroupCipher = Ndis802_11WEPDisabled; - pAdapter->StaCfg.WepStatus = Ndis802_11WEPDisabled; - pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; - goto done; - } - else if (erq->flags & IW_ENCODE_RESTRICTED || erq->flags & IW_ENCODE_OPEN) - { - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - STA_PORT_SECURED(pAdapter); - pAdapter->StaCfg.PairCipher = Ndis802_11WEPEnabled; - pAdapter->StaCfg.GroupCipher = Ndis802_11WEPEnabled; - pAdapter->StaCfg.WepStatus = Ndis802_11WEPEnabled; - pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; - if (erq->flags & IW_ENCODE_RESTRICTED) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeShared; - else - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; - } - - if (erq->length > 0) - { - int keyIdx = (erq->flags & IW_ENCODE_INDEX) - 1; - /* Check the size of the key */ - if (erq->length > MAX_WEP_KEY_SIZE) - { - return -EINVAL; - } - /* Check key index */ - if ((keyIdx < 0) || (keyIdx >= NR_WEP_KEYS)) - { - DBGPRINT(RT_DEBUG_TRACE ,("==>rt_ioctl_siwencode::Wrong keyIdx=%d! Using default key instead (%d)\n", - keyIdx, pAdapter->StaCfg.DefaultKeyId)); - - //Using default key - keyIdx = pAdapter->StaCfg.DefaultKeyId; - } - else - pAdapter->StaCfg.DefaultKeyId = keyIdx; - - NdisZeroMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, 16); - - if (erq->length == MAX_WEP_KEY_SIZE) - { - pAdapter->SharedKey[BSS0][keyIdx].KeyLen = MAX_WEP_KEY_SIZE; - pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = CIPHER_WEP128; - } - else if (erq->length == MIN_WEP_KEY_SIZE) - { - pAdapter->SharedKey[BSS0][keyIdx].KeyLen = MIN_WEP_KEY_SIZE; - pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = CIPHER_WEP64; - } - else - /* Disable the key */ - pAdapter->SharedKey[BSS0][keyIdx].KeyLen = 0; - - /* Check if the key is not marked as invalid */ - if(!(erq->flags & IW_ENCODE_NOKEY)) - { - /* Copy the key in the driver */ - NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, extra, erq->length); - } - } - else - { - /* Do we want to just set the transmit key index ? */ - int index = (erq->flags & IW_ENCODE_INDEX) - 1; - if ((index >= 0) && (index < 4)) - { - pAdapter->StaCfg.DefaultKeyId = index; - } - else - /* Don't complain if only change the mode */ - if (!(erq->flags & IW_ENCODE_MODE)) - return -EINVAL; - } - -done: - DBGPRINT(RT_DEBUG_TRACE ,("==>rt_ioctl_siwencode::erq->flags=%x\n",erq->flags)); - DBGPRINT(RT_DEBUG_TRACE ,("==>rt_ioctl_siwencode::AuthMode=%x\n",pAdapter->StaCfg.AuthMode)); - DBGPRINT(RT_DEBUG_TRACE ,("==>rt_ioctl_siwencode::DefaultKeyId=%x, KeyLen = %d\n",pAdapter->StaCfg.DefaultKeyId , pAdapter->SharedKey[BSS0][pAdapter->StaCfg.DefaultKeyId].KeyLen)); - DBGPRINT(RT_DEBUG_TRACE ,("==>rt_ioctl_siwencode::WepStatus=%x\n",pAdapter->StaCfg.WepStatus)); - return 0; -} - -int -rt_ioctl_giwencode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, char *key) -{ - int kid; - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->priv will be NULL in 2rd open */ - return -ENETDOWN; - } - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - kid = erq->flags & IW_ENCODE_INDEX; - DBGPRINT(RT_DEBUG_TRACE, ("===>rt_ioctl_giwencode %d\n", erq->flags & IW_ENCODE_INDEX)); - - if (pAdapter->StaCfg.WepStatus == Ndis802_11WEPDisabled) - { - erq->length = 0; - erq->flags = IW_ENCODE_DISABLED; - } - else if ((kid > 0) && (kid <=4)) - { - // copy wep key - erq->flags = kid ; /* NB: base 1 */ - if (erq->length > pAdapter->SharedKey[BSS0][kid-1].KeyLen) - erq->length = pAdapter->SharedKey[BSS0][kid-1].KeyLen; - memcpy(key, pAdapter->SharedKey[BSS0][kid-1].Key, erq->length); - //if ((kid == pAdapter->PortCfg.DefaultKeyId)) - //erq->flags |= IW_ENCODE_ENABLED; /* XXX */ - if (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeShared) - erq->flags |= IW_ENCODE_RESTRICTED; /* XXX */ - else - erq->flags |= IW_ENCODE_OPEN; /* XXX */ - - } - else if (kid == 0) - { - if (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeShared) - erq->flags |= IW_ENCODE_RESTRICTED; /* XXX */ - else - erq->flags |= IW_ENCODE_OPEN; /* XXX */ - erq->length = pAdapter->SharedKey[BSS0][pAdapter->StaCfg.DefaultKeyId].KeyLen; - memcpy(key, pAdapter->SharedKey[BSS0][pAdapter->StaCfg.DefaultKeyId].Key, erq->length); - // copy default key ID - if (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeShared) - erq->flags |= IW_ENCODE_RESTRICTED; /* XXX */ - else - erq->flags |= IW_ENCODE_OPEN; /* XXX */ - erq->flags = pAdapter->StaCfg.DefaultKeyId + 1; /* NB: base 1 */ - erq->flags |= IW_ENCODE_ENABLED; /* XXX */ - } - - return 0; - -} - -static int -rt_ioctl_setparam(struct net_device *dev, struct iw_request_info *info, - void *w, char *extra) -{ - PRTMP_ADAPTER pAdapter; - POS_COOKIE pObj; - PSTRING this_char = extra; - PSTRING value; - int Status=0; - - pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - if (pAdapter == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->priv will be NULL in 2rd open */ - return -ENETDOWN; - } - - pObj = (POS_COOKIE) pAdapter->OS_Cookie; - { - pObj->ioctl_if_type = INT_MAIN; - pObj->ioctl_if = MAIN_MBSSID; - } - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - if (!*this_char) - return -EINVAL; - - if ((value = rtstrchr(this_char, '=')) != NULL) - *value++ = 0; - - if (!value && (strcmp(this_char, "SiteSurvey") != 0)) - return -EINVAL; - else - goto SET_PROC; - - // reject setting nothing besides ANY ssid(ssidLen=0) - if (!*value && (strcmp(this_char, "SSID") != 0)) - return -EINVAL; - -SET_PROC: - for (PRTMP_PRIVATE_SET_PROC = RTMP_PRIVATE_SUPPORT_PROC; PRTMP_PRIVATE_SET_PROC->name; PRTMP_PRIVATE_SET_PROC++) - { - if (strcmp(this_char, PRTMP_PRIVATE_SET_PROC->name) == 0) - { - if(!PRTMP_PRIVATE_SET_PROC->set_proc(pAdapter, value)) - { //FALSE:Set private failed then return Invalid argument - Status = -EINVAL; - } - break; //Exit for loop. - } - } - - if(PRTMP_PRIVATE_SET_PROC->name == NULL) - { //Not found argument - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("===>rt_ioctl_setparam:: (iwpriv) Not Support Set Command [%s=%s]\n", this_char, value)); - } - - return Status; -} - - -static int -rt_private_get_statistics(struct net_device *dev, struct iw_request_info *info, - struct iw_point *wrq, char *extra) -{ - INT Status = 0; - PRTMP_ADAPTER pAd = RTMP_OS_NETDEV_GET_PRIV(dev); - - if (extra == NULL) - { - wrq->length = 0; - return -EIO; - } - - memset(extra, 0x00, IW_PRIV_SIZE_MASK); - sprintf(extra, "\n\n"); - -#ifdef RALINK_ATE - if (ATE_ON(pAd)) - { - sprintf(extra+strlen(extra), "Tx success = %ld\n", (ULONG)pAd->ate.TxDoneCount); - //sprintf(extra+strlen(extra), "Tx success without retry = %ld\n", (ULONG)pAd->ate.TxDoneCount); - } - else -#endif // RALINK_ATE // - { - sprintf(extra+strlen(extra), "Tx success = %ld\n", (ULONG)pAd->WlanCounters.TransmittedFragmentCount.QuadPart); - sprintf(extra+strlen(extra), "Tx success without retry = %ld\n", (ULONG)pAd->WlanCounters.TransmittedFragmentCount.QuadPart - (ULONG)pAd->WlanCounters.RetryCount.QuadPart); - } - sprintf(extra+strlen(extra), "Tx success after retry = %ld\n", (ULONG)pAd->WlanCounters.RetryCount.QuadPart); - sprintf(extra+strlen(extra), "Tx fail to Rcv ACK after retry = %ld\n", (ULONG)pAd->WlanCounters.FailedCount.QuadPart); - sprintf(extra+strlen(extra), "RTS Success Rcv CTS = %ld\n", (ULONG)pAd->WlanCounters.RTSSuccessCount.QuadPart); - sprintf(extra+strlen(extra), "RTS Fail Rcv CTS = %ld\n", (ULONG)pAd->WlanCounters.RTSFailureCount.QuadPart); - - sprintf(extra+strlen(extra), "Rx success = %ld\n", (ULONG)pAd->WlanCounters.ReceivedFragmentCount.QuadPart); - sprintf(extra+strlen(extra), "Rx with CRC = %ld\n", (ULONG)pAd->WlanCounters.FCSErrorCount.QuadPart); - sprintf(extra+strlen(extra), "Rx drop due to out of resource = %ld\n", (ULONG)pAd->Counters8023.RxNoBuffer); - sprintf(extra+strlen(extra), "Rx duplicate frame = %ld\n", (ULONG)pAd->WlanCounters.FrameDuplicateCount.QuadPart); - - sprintf(extra+strlen(extra), "False CCA (one second) = %ld\n", (ULONG)pAd->RalinkCounters.OneSecFalseCCACnt); - -#ifdef RALINK_ATE - if (ATE_ON(pAd)) - { - if (pAd->ate.RxAntennaSel == 0) - { - sprintf(extra+strlen(extra), "RSSI-A = %ld\n", (LONG)(pAd->ate.LastRssi0 - pAd->BbpRssiToDbmDelta)); - sprintf(extra+strlen(extra), "RSSI-B (if available) = %ld\n", (LONG)(pAd->ate.LastRssi1 - pAd->BbpRssiToDbmDelta)); - sprintf(extra+strlen(extra), "RSSI-C (if available) = %ld\n\n", (LONG)(pAd->ate.LastRssi2 - pAd->BbpRssiToDbmDelta)); - } - else - { - sprintf(extra+strlen(extra), "RSSI = %ld\n", (LONG)(pAd->ate.LastRssi0 - pAd->BbpRssiToDbmDelta)); - } - } - else -#endif // RALINK_ATE // - { - sprintf(extra+strlen(extra), "RSSI-A = %ld\n", (LONG)(pAd->StaCfg.RssiSample.LastRssi0 - pAd->BbpRssiToDbmDelta)); - sprintf(extra+strlen(extra), "RSSI-B (if available) = %ld\n", (LONG)(pAd->StaCfg.RssiSample.LastRssi1 - pAd->BbpRssiToDbmDelta)); - sprintf(extra+strlen(extra), "RSSI-C (if available) = %ld\n\n", (LONG)(pAd->StaCfg.RssiSample.LastRssi2 - pAd->BbpRssiToDbmDelta)); - } -#ifdef WPA_SUPPLICANT_SUPPORT - sprintf(extra+strlen(extra), "WpaSupplicantUP = %d\n\n", pAd->StaCfg.WpaSupplicantUP); -#endif // WPA_SUPPLICANT_SUPPORT // - - - - wrq->length = strlen(extra) + 1; // 1: size of '\0' - DBGPRINT(RT_DEBUG_TRACE, ("<== rt_private_get_statistics, wrq->length = %d\n", wrq->length)); - - return Status; -} - -#ifdef DOT11_N_SUPPORT -void getBaInfo( - IN PRTMP_ADAPTER pAd, - IN PSTRING pOutBuf) -{ - INT i, j; - BA_ORI_ENTRY *pOriBAEntry; - BA_REC_ENTRY *pRecBAEntry; - - for (i=0; iMacTab.Content[i]; - if (((pEntry->ValidAsCLI || pEntry->ValidAsApCli) && (pEntry->Sst == SST_ASSOC)) - || (pEntry->ValidAsWDS) || (pEntry->ValidAsMesh)) - { - sprintf(pOutBuf, "%s\n%02X:%02X:%02X:%02X:%02X:%02X (Aid = %d) (AP) -\n", - pOutBuf, - pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2], - pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5], pEntry->Aid); - - sprintf(pOutBuf, "%s[Recipient]\n", pOutBuf); - for (j=0; j < NUM_OF_TID; j++) - { - if (pEntry->BARecWcidArray[j] != 0) - { - pRecBAEntry =&pAd->BATable.BARecEntry[pEntry->BARecWcidArray[j]]; - sprintf(pOutBuf, "%sTID=%d, BAWinSize=%d, LastIndSeq=%d, ReorderingPkts=%d\n", pOutBuf, j, pRecBAEntry->BAWinSize, pRecBAEntry->LastIndSeq, pRecBAEntry->list.qlen); - } - } - sprintf(pOutBuf, "%s\n", pOutBuf); - - sprintf(pOutBuf, "%s[Originator]\n", pOutBuf); - for (j=0; j < NUM_OF_TID; j++) - { - if (pEntry->BAOriWcidArray[j] != 0) - { - pOriBAEntry =&pAd->BATable.BAOriEntry[pEntry->BAOriWcidArray[j]]; - sprintf(pOutBuf, "%sTID=%d, BAWinSize=%d, StartSeq=%d, CurTxSeq=%d\n", pOutBuf, j, pOriBAEntry->BAWinSize, pOriBAEntry->Sequence, pEntry->TxSeq[j]); - } - } - sprintf(pOutBuf, "%s\n\n", pOutBuf); - } - if (strlen(pOutBuf) > (IW_PRIV_SIZE_MASK - 30)) - break; - } - - return; -} -#endif // DOT11_N_SUPPORT // - -static int -rt_private_show(struct net_device *dev, struct iw_request_info *info, - struct iw_point *wrq, PSTRING extra) -{ - INT Status = 0; - PRTMP_ADAPTER pAd; - POS_COOKIE pObj; - u32 subcmd = wrq->flags; - - pAd = RTMP_OS_NETDEV_GET_PRIV(dev); - if (pAd == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->priv will be NULL in 2rd open */ - return -ENETDOWN; - } - - pObj = (POS_COOKIE) pAd->OS_Cookie; - if (extra == NULL) - { - wrq->length = 0; - return -EIO; - } - memset(extra, 0x00, IW_PRIV_SIZE_MASK); - - { - pObj->ioctl_if_type = INT_MAIN; - pObj->ioctl_if = MAIN_MBSSID; - } - - switch(subcmd) - { - - case SHOW_CONN_STATUS: - if (MONITOR_ON(pAd)) - { -#ifdef DOT11_N_SUPPORT - if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED && - pAd->CommonCfg.RegTransmitSetting.field.BW) - sprintf(extra, "Monitor Mode(CentralChannel %d)\n", pAd->CommonCfg.CentralChannel); - else -#endif // DOT11_N_SUPPORT // - sprintf(extra, "Monitor Mode(Channel %d)\n", pAd->CommonCfg.Channel); - } - else - { - if (pAd->IndicateMediaState == NdisMediaStateConnected) - { - if (INFRA_ON(pAd)) - { - sprintf(extra, "Connected(AP: %s[%02X:%02X:%02X:%02X:%02X:%02X])\n", - pAd->CommonCfg.Ssid, - pAd->CommonCfg.Bssid[0], - pAd->CommonCfg.Bssid[1], - pAd->CommonCfg.Bssid[2], - pAd->CommonCfg.Bssid[3], - pAd->CommonCfg.Bssid[4], - pAd->CommonCfg.Bssid[5]); - DBGPRINT(RT_DEBUG_TRACE ,("Ssid=%s ,Ssidlen = %d\n",pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen)); - } - else if (ADHOC_ON(pAd)) - sprintf(extra, "Connected\n"); - } - else - { - sprintf(extra, "Disconnected\n"); - DBGPRINT(RT_DEBUG_TRACE ,("ConnStatus is not connected\n")); - } - } - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; - case SHOW_DRVIER_VERION: - sprintf(extra, "Driver version-%s, %s %s\n", STA_DRIVER_VERSION, __DATE__, __TIME__ ); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; -#ifdef DOT11_N_SUPPORT - case SHOW_BA_INFO: - getBaInfo(pAd, extra); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; -#endif // DOT11_N_SUPPORT // - case SHOW_DESC_INFO: - { - Show_DescInfo_Proc(pAd, NULL); - wrq->length = 0; // 1: size of '\0' - } - break; - case RAIO_OFF: - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - { - if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { - RTMP_MLME_RESET_STATE_MACHINE(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); - } - } - pAd->StaCfg.bSwRadio = FALSE; - if (pAd->StaCfg.bRadio != (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio)) - { - pAd->StaCfg.bRadio = (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio); - if (pAd->StaCfg.bRadio == FALSE) - { - MlmeRadioOff(pAd); - // Update extra information - pAd->ExtraInfo = SW_RADIO_OFF; - } - } - sprintf(extra, "Radio Off\n"); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; - case RAIO_ON: - pAd->StaCfg.bSwRadio = TRUE; - //if (pAd->StaCfg.bRadio != (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio)) - { - pAd->StaCfg.bRadio = (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio); - if (pAd->StaCfg.bRadio == TRUE) - { - MlmeRadioOn(pAd); - // Update extra information - pAd->ExtraInfo = EXTRA_INFO_CLEAR; - } - } - sprintf(extra, "Radio On\n"); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; - - -#ifdef QOS_DLS_SUPPORT - case SHOW_DLS_ENTRY_INFO: - { - Set_DlsEntryInfo_Display_Proc(pAd, NULL); - wrq->length = 0; // 1: size of '\0' - } - break; -#endif // QOS_DLS_SUPPORT // - - case SHOW_CFG_VALUE: - { - Status = RTMPShowCfgValue(pAd, (PSTRING) wrq->pointer, extra); - if (Status == 0) - wrq->length = strlen(extra) + 1; // 1: size of '\0' - } - break; - case SHOW_ADHOC_ENTRY_INFO: - Show_Adhoc_MacTable_Proc(pAd, extra); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; - default: - DBGPRINT(RT_DEBUG_TRACE, ("%s - unknow subcmd = %d\n", __FUNCTION__, subcmd)); - break; - } - - return Status; -} - -#ifdef SIOCSIWMLME -int rt_ioctl_siwmlme(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra) -{ - PRTMP_ADAPTER pAd = RTMP_OS_NETDEV_GET_PRIV(dev); - struct iw_mlme *pMlme = (struct iw_mlme *)wrqu->data.pointer; - MLME_QUEUE_ELEM MsgElem; - MLME_DISASSOC_REQ_STRUCT DisAssocReq; - MLME_DEAUTH_REQ_STRUCT DeAuthReq; - - DBGPRINT(RT_DEBUG_TRACE, ("====> %s\n", __FUNCTION__)); - - if (pMlme == NULL) - return -EINVAL; - - switch(pMlme->cmd) - { -#ifdef IW_MLME_DEAUTH - case IW_MLME_DEAUTH: - DBGPRINT(RT_DEBUG_TRACE, ("====> %s - IW_MLME_DEAUTH\n", __FUNCTION__)); - COPY_MAC_ADDR(DeAuthReq.Addr, pAd->CommonCfg.Bssid); - DeAuthReq.Reason = pMlme->reason_code; - MsgElem.MsgLen = sizeof(MLME_DEAUTH_REQ_STRUCT); - NdisMoveMemory(MsgElem.Msg, &DeAuthReq, sizeof(MLME_DEAUTH_REQ_STRUCT)); - MlmeDeauthReqAction(pAd, &MsgElem); - if (INFRA_ON(pAd)) - { - LinkDown(pAd, FALSE); - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - } - break; -#endif // IW_MLME_DEAUTH // -#ifdef IW_MLME_DISASSOC - case IW_MLME_DISASSOC: - DBGPRINT(RT_DEBUG_TRACE, ("====> %s - IW_MLME_DISASSOC\n", __FUNCTION__)); - COPY_MAC_ADDR(DisAssocReq.Addr, pAd->CommonCfg.Bssid); - DisAssocReq.Reason = pMlme->reason_code; - - MsgElem.Machine = ASSOC_STATE_MACHINE; - MsgElem.MsgType = MT2_MLME_DISASSOC_REQ; - MsgElem.MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT); - NdisMoveMemory(MsgElem.Msg, &DisAssocReq, sizeof(MLME_DISASSOC_REQ_STRUCT)); - - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC; - MlmeDisassocReqAction(pAd, &MsgElem); - break; -#endif // IW_MLME_DISASSOC // - default: - DBGPRINT(RT_DEBUG_TRACE, ("====> %s - Unknow Command\n", __FUNCTION__)); - break; - } - - return 0; -} -#endif // SIOCSIWMLME // - -#if WIRELESS_EXT > 17 -int rt_ioctl_siwauth(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - struct iw_param *param = &wrqu->param; - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - switch (param->flags & IW_AUTH_INDEX) { - case IW_AUTH_WPA_VERSION: - if (param->value == IW_AUTH_WPA_VERSION_WPA) - { - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPAPSK; - if (pAdapter->StaCfg.BssType == BSS_ADHOC) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPANone; - } - else if (param->value == IW_AUTH_WPA_VERSION_WPA2) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPA2PSK; - - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_WPA_VERSION - param->value = %d!\n", __FUNCTION__, param->value)); - break; - case IW_AUTH_CIPHER_PAIRWISE: - if (param->value == IW_AUTH_CIPHER_NONE) - { - pAdapter->StaCfg.WepStatus = Ndis802_11WEPDisabled; - pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; - pAdapter->StaCfg.PairCipher = Ndis802_11WEPDisabled; - } - else if (param->value == IW_AUTH_CIPHER_WEP40 || - param->value == IW_AUTH_CIPHER_WEP104) - { - pAdapter->StaCfg.WepStatus = Ndis802_11WEPEnabled; - pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; - pAdapter->StaCfg.PairCipher = Ndis802_11WEPEnabled; -#ifdef WPA_SUPPLICANT_SUPPORT - pAdapter->StaCfg.IEEE8021X = FALSE; -#endif // WPA_SUPPLICANT_SUPPORT // - } - else if (param->value == IW_AUTH_CIPHER_TKIP) - { - pAdapter->StaCfg.WepStatus = Ndis802_11Encryption2Enabled; - pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; - pAdapter->StaCfg.PairCipher = Ndis802_11Encryption2Enabled; - } - else if (param->value == IW_AUTH_CIPHER_CCMP) - { - pAdapter->StaCfg.WepStatus = Ndis802_11Encryption3Enabled; - pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; - pAdapter->StaCfg.PairCipher = Ndis802_11Encryption3Enabled; - } - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_CIPHER_PAIRWISE - param->value = %d!\n", __FUNCTION__, param->value)); - break; - case IW_AUTH_CIPHER_GROUP: - if (param->value == IW_AUTH_CIPHER_NONE) - { - pAdapter->StaCfg.GroupCipher = Ndis802_11WEPDisabled; - } - else if (param->value == IW_AUTH_CIPHER_WEP40 || - param->value == IW_AUTH_CIPHER_WEP104) - { - pAdapter->StaCfg.GroupCipher = Ndis802_11WEPEnabled; - } - else if (param->value == IW_AUTH_CIPHER_TKIP) - { - pAdapter->StaCfg.GroupCipher = Ndis802_11Encryption2Enabled; - } - else if (param->value == IW_AUTH_CIPHER_CCMP) - { - pAdapter->StaCfg.GroupCipher = Ndis802_11Encryption3Enabled; - } - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_CIPHER_GROUP - param->value = %d!\n", __FUNCTION__, param->value)); - break; - case IW_AUTH_KEY_MGMT: - if (param->value == IW_AUTH_KEY_MGMT_802_1X) - { - if (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) - { - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPA; -#ifdef WPA_SUPPLICANT_SUPPORT - pAdapter->StaCfg.IEEE8021X = FALSE; -#endif // WPA_SUPPLICANT_SUPPORT // - } - else if (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) - { - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPA2; -#ifdef WPA_SUPPLICANT_SUPPORT - pAdapter->StaCfg.IEEE8021X = FALSE; -#endif // WPA_SUPPLICANT_SUPPORT // - } -#ifdef WPA_SUPPLICANT_SUPPORT - else - // WEP 1x - pAdapter->StaCfg.IEEE8021X = TRUE; -#endif // WPA_SUPPLICANT_SUPPORT // - } - else if (param->value == 0) - { - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - STA_PORT_SECURED(pAdapter); - } - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_KEY_MGMT - param->value = %d!\n", __FUNCTION__, param->value)); - break; - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - break; - case IW_AUTH_PRIVACY_INVOKED: - /*if (param->value == 0) - { - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; - pAdapter->StaCfg.WepStatus = Ndis802_11WEPDisabled; - pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; - pAdapter->StaCfg.PairCipher = Ndis802_11WEPDisabled; - pAdapter->StaCfg.GroupCipher = Ndis802_11WEPDisabled; - }*/ - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_PRIVACY_INVOKED - param->value = %d!\n", __FUNCTION__, param->value)); - break; - case IW_AUTH_DROP_UNENCRYPTED: - if (param->value != 0) - pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - else - { - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - STA_PORT_SECURED(pAdapter); - } - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_WPA_VERSION - param->value = %d!\n", __FUNCTION__, param->value)); - break; - case IW_AUTH_80211_AUTH_ALG: - if (param->value & IW_AUTH_ALG_SHARED_KEY) - { - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeShared; - } - else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM) - { - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; - } - else - return -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_80211_AUTH_ALG - param->value = %d!\n", __FUNCTION__, param->value)); - break; - case IW_AUTH_WPA_ENABLED: - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_WPA_ENABLED - Driver supports WPA!(param->value = %d)\n", __FUNCTION__, param->value)); - break; - default: - return -EOPNOTSUPP; -} - - return 0; -} - -int rt_ioctl_giwauth(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - struct iw_param *param = &wrqu->param; - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - switch (param->flags & IW_AUTH_INDEX) { - case IW_AUTH_DROP_UNENCRYPTED: - param->value = (pAdapter->StaCfg.WepStatus == Ndis802_11WEPDisabled) ? 0 : 1; - break; - - case IW_AUTH_80211_AUTH_ALG: - param->value = (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeShared) ? IW_AUTH_ALG_SHARED_KEY : IW_AUTH_ALG_OPEN_SYSTEM; - break; - - case IW_AUTH_WPA_ENABLED: - param->value = (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) ? 1 : 0; - break; - - default: - return -EOPNOTSUPP; - } - DBGPRINT(RT_DEBUG_TRACE, ("rt_ioctl_giwauth::param->value = %d!\n", param->value)); - return 0; -} - -void fnSetCipherKey( - IN PRTMP_ADAPTER pAdapter, - IN INT keyIdx, - IN UCHAR CipherAlg, - IN BOOLEAN bGTK, - IN struct iw_encode_ext *ext) -{ - NdisZeroMemory(&pAdapter->SharedKey[BSS0][keyIdx], sizeof(CIPHER_KEY)); - pAdapter->SharedKey[BSS0][keyIdx].KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, ext->key, LEN_TKIP_EK); - NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].TxMic, ext->key + LEN_TKIP_EK, LEN_TKIP_TXMICK); - NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].RxMic, ext->key + LEN_TKIP_EK + LEN_TKIP_TXMICK, LEN_TKIP_RXMICK); - pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = CipherAlg; - - // Update group key information to ASIC Shared Key Table - AsicAddSharedKeyEntry(pAdapter, - BSS0, - keyIdx, - pAdapter->SharedKey[BSS0][keyIdx].CipherAlg, - pAdapter->SharedKey[BSS0][keyIdx].Key, - pAdapter->SharedKey[BSS0][keyIdx].TxMic, - pAdapter->SharedKey[BSS0][keyIdx].RxMic); - - if (bGTK) - // Update ASIC WCID attribute table and IVEIV table - RTMPAddWcidAttributeEntry(pAdapter, - BSS0, - keyIdx, - pAdapter->SharedKey[BSS0][keyIdx].CipherAlg, - NULL); - else - // Update ASIC WCID attribute table and IVEIV table - RTMPAddWcidAttributeEntry(pAdapter, - BSS0, - keyIdx, - pAdapter->SharedKey[BSS0][keyIdx].CipherAlg, - &pAdapter->MacTab.Content[BSSID_WCID]); -} - -int rt_ioctl_siwencodeext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra) - { - PRTMP_ADAPTER pAdapter = RTMP_OS_NETDEV_GET_PRIV(dev); - struct iw_point *encoding = &wrqu->encoding; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int keyIdx, alg = ext->alg; - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - if (encoding->flags & IW_ENCODE_DISABLED) - { - keyIdx = (encoding->flags & IW_ENCODE_INDEX) - 1; - // set BSSID wcid entry of the Pair-wise Key table as no-security mode - AsicRemovePairwiseKeyEntry(pAdapter, BSS0, BSSID_WCID); - pAdapter->SharedKey[BSS0][keyIdx].KeyLen = 0; - pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = CIPHER_NONE; - AsicRemoveSharedKeyEntry(pAdapter, 0, (UCHAR)keyIdx); - NdisZeroMemory(&pAdapter->SharedKey[BSS0][keyIdx], sizeof(CIPHER_KEY)); - DBGPRINT(RT_DEBUG_TRACE, ("%s::Remove all keys!(encoding->flags = %x)\n", __FUNCTION__, encoding->flags)); - } - else - { - // Get Key Index and convet to our own defined key index - keyIdx = (encoding->flags & IW_ENCODE_INDEX) - 1; - if((keyIdx < 0) || (keyIdx >= NR_WEP_KEYS)) - return -EINVAL; - - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) - { - pAdapter->StaCfg.DefaultKeyId = keyIdx; - DBGPRINT(RT_DEBUG_TRACE, ("%s::DefaultKeyId = %d\n", __FUNCTION__, pAdapter->StaCfg.DefaultKeyId)); - } - - switch (alg) { - case IW_ENCODE_ALG_NONE: - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_ENCODE_ALG_NONE\n", __FUNCTION__)); - break; - case IW_ENCODE_ALG_WEP: - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_ENCODE_ALG_WEP - ext->key_len = %d, keyIdx = %d\n", __FUNCTION__, ext->key_len, keyIdx)); - if (ext->key_len == MAX_WEP_KEY_SIZE) - { - pAdapter->SharedKey[BSS0][keyIdx].KeyLen = MAX_WEP_KEY_SIZE; - pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = CIPHER_WEP128; - } - else if (ext->key_len == MIN_WEP_KEY_SIZE) - { - pAdapter->SharedKey[BSS0][keyIdx].KeyLen = MIN_WEP_KEY_SIZE; - pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = CIPHER_WEP64; - } - else - return -EINVAL; - - NdisZeroMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, 16); - NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, ext->key, ext->key_len); - - if (pAdapter->StaCfg.GroupCipher == Ndis802_11GroupWEP40Enabled || - pAdapter->StaCfg.GroupCipher == Ndis802_11GroupWEP104Enabled) - { - // Set Group key material to Asic - AsicAddSharedKeyEntry(pAdapter, BSS0, keyIdx, pAdapter->SharedKey[BSS0][keyIdx].CipherAlg, pAdapter->SharedKey[BSS0][keyIdx].Key, NULL, NULL); - // Update WCID attribute table and IVEIV table for this group key table - RTMPAddWcidAttributeEntry(pAdapter, BSS0, keyIdx, pAdapter->SharedKey[BSS0][keyIdx].CipherAlg, NULL); - STA_PORT_SECURED(pAdapter); - // Indicate Connected for GUI - pAdapter->IndicateMediaState = NdisMediaStateConnected; - } - break; - case IW_ENCODE_ALG_TKIP: - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_ENCODE_ALG_TKIP - keyIdx = %d, ext->key_len = %d\n", __FUNCTION__, keyIdx, ext->key_len)); - if (ext->key_len == 32) - { - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) - { - fnSetCipherKey(pAdapter, keyIdx, CIPHER_TKIP, FALSE, ext); - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA2) - { - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - STA_PORT_SECURED(pAdapter); - pAdapter->IndicateMediaState = NdisMediaStateConnected; - } - } - else if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) - { - fnSetCipherKey(pAdapter, keyIdx, CIPHER_TKIP, TRUE, ext); - - // set 802.1x port control - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - STA_PORT_SECURED(pAdapter); - pAdapter->IndicateMediaState = NdisMediaStateConnected; - } - } - else - return -EINVAL; - break; - case IW_ENCODE_ALG_CCMP: - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) - { - fnSetCipherKey(pAdapter, keyIdx, CIPHER_AES, FALSE, ext); - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA2) - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - STA_PORT_SECURED(pAdapter); - pAdapter->IndicateMediaState = NdisMediaStateConnected; - } - else if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) - { - fnSetCipherKey(pAdapter, keyIdx, CIPHER_AES, TRUE, ext); - - // set 802.1x port control - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - STA_PORT_SECURED(pAdapter); - pAdapter->IndicateMediaState = NdisMediaStateConnected; - } - break; - default: - return -EINVAL; - } - } - - return 0; -} - -int -rt_ioctl_giwencodeext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - PRTMP_ADAPTER pAd = RTMP_OS_NETDEV_GET_PRIV(dev); - PCHAR pKey = NULL; - struct iw_point *encoding = &wrqu->encoding; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int idx, max_key_len; - - DBGPRINT(RT_DEBUG_TRACE ,("===> rt_ioctl_giwencodeext\n")); - - max_key_len = encoding->length - sizeof(*ext); - if (max_key_len < 0) - return -EINVAL; - - idx = encoding->flags & IW_ENCODE_INDEX; - if (idx) - { - if (idx < 1 || idx > 4) - return -EINVAL; - idx--; - - if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) || - (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled)) - { - if (idx != pAd->StaCfg.DefaultKeyId) - { - ext->key_len = 0; - return 0; - } - } - } - else - idx = pAd->StaCfg.DefaultKeyId; - - encoding->flags = idx + 1; - memset(ext, 0, sizeof(*ext)); - - ext->key_len = 0; - switch(pAd->StaCfg.WepStatus) { - case Ndis802_11WEPDisabled: - ext->alg = IW_ENCODE_ALG_NONE; - encoding->flags |= IW_ENCODE_DISABLED; - break; - case Ndis802_11WEPEnabled: - ext->alg = IW_ENCODE_ALG_WEP; - if (pAd->SharedKey[BSS0][idx].KeyLen > max_key_len) - return -E2BIG; - else - { - ext->key_len = pAd->SharedKey[BSS0][idx].KeyLen; - pKey = (PCHAR)&(pAd->SharedKey[BSS0][idx].Key[0]); - } - break; - case Ndis802_11Encryption2Enabled: - case Ndis802_11Encryption3Enabled: - if (pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) - ext->alg = IW_ENCODE_ALG_TKIP; - else - ext->alg = IW_ENCODE_ALG_CCMP; - - if (max_key_len < 32) - return -E2BIG; - else - { - ext->key_len = 32; - pKey = (PCHAR)&pAd->StaCfg.PMK[0]; - } - break; - default: - return -EINVAL; - } - - if (ext->key_len && pKey) - { - encoding->flags |= IW_ENCODE_ENABLED; - memcpy(ext->key, pKey, ext->key_len); - } - - return 0; -} - -#ifdef SIOCSIWGENIE -int rt_ioctl_siwgenie(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - PRTMP_ADAPTER pAd = RTMP_OS_NETDEV_GET_PRIV(dev); - - DBGPRINT(RT_DEBUG_TRACE ,("===> rt_ioctl_siwgenie\n")); -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT - pAd->StaCfg.bRSN_IE_FromWpaSupplicant = FALSE; -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - if (wrqu->data.length > MAX_LEN_OF_RSNIE || - (wrqu->data.length && extra == NULL)) - return -EINVAL; - - if (wrqu->data.length) - { - pAd->StaCfg.RSNIE_Len = wrqu->data.length; - NdisMoveMemory(&pAd->StaCfg.RSN_IE[0], extra, pAd->StaCfg.RSNIE_Len); -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT - pAd->StaCfg.bRSN_IE_FromWpaSupplicant = TRUE; -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - } - else - { - pAd->StaCfg.RSNIE_Len = 0; - NdisZeroMemory(&pAd->StaCfg.RSN_IE[0], MAX_LEN_OF_RSNIE); - } - - return 0; -} -#endif // SIOCSIWGENIE // - -int rt_ioctl_giwgenie(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - PRTMP_ADAPTER pAd = RTMP_OS_NETDEV_GET_PRIV(dev); - - if ((pAd->StaCfg.RSNIE_Len == 0) || - (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA)) - { - wrqu->data.length = 0; - return 0; - } - -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT -#ifdef SIOCSIWGENIE - if (pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) - { - if (wrqu->data.length < pAd->StaCfg.RSNIE_Len) - return -E2BIG; - - wrqu->data.length = pAd->StaCfg.RSNIE_Len; - memcpy(extra, &pAd->StaCfg.RSN_IE[0], pAd->StaCfg.RSNIE_Len); - } - else -#endif // SIOCSIWGENIE // -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - { - UCHAR RSNIe = IE_WPA; - - if (wrqu->data.length < (pAd->StaCfg.RSNIE_Len + 2)) // ID, Len - return -E2BIG; - wrqu->data.length = pAd->StaCfg.RSNIE_Len + 2; - - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2)) - RSNIe = IE_RSN; - - extra[0] = (char)RSNIe; - extra[1] = pAd->StaCfg.RSNIE_Len; - memcpy(extra+2, &pAd->StaCfg.RSN_IE[0], pAd->StaCfg.RSNIE_Len); - } - - return 0; -} - -int rt_ioctl_siwpmksa(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra) -{ - PRTMP_ADAPTER pAd = RTMP_OS_NETDEV_GET_PRIV(dev); - struct iw_pmksa *pPmksa = (struct iw_pmksa *)wrqu->data.pointer; - INT CachedIdx = 0, idx = 0; - - if (pPmksa == NULL) - return -EINVAL; - - DBGPRINT(RT_DEBUG_TRACE ,("===> rt_ioctl_siwpmksa\n")); - switch(pPmksa->cmd) - { - case IW_PMKSA_FLUSH: - NdisZeroMemory(pAd->StaCfg.SavedPMK, sizeof(BSSID_INFO)*PMKID_NO); - DBGPRINT(RT_DEBUG_TRACE ,("rt_ioctl_siwpmksa - IW_PMKSA_FLUSH\n")); - break; - case IW_PMKSA_REMOVE: - for (CachedIdx = 0; CachedIdx < pAd->StaCfg.SavedPMKNum; CachedIdx++) - { - // compare the BSSID - if (NdisEqualMemory(pPmksa->bssid.sa_data, pAd->StaCfg.SavedPMK[CachedIdx].BSSID, MAC_ADDR_LEN)) - { - NdisZeroMemory(pAd->StaCfg.SavedPMK[CachedIdx].BSSID, MAC_ADDR_LEN); - NdisZeroMemory(pAd->StaCfg.SavedPMK[CachedIdx].PMKID, 16); - for (idx = CachedIdx; idx < (pAd->StaCfg.SavedPMKNum - 1); idx++) - { - NdisMoveMemory(&pAd->StaCfg.SavedPMK[idx].BSSID[0], &pAd->StaCfg.SavedPMK[idx+1].BSSID[0], MAC_ADDR_LEN); - NdisMoveMemory(&pAd->StaCfg.SavedPMK[idx].PMKID[0], &pAd->StaCfg.SavedPMK[idx+1].PMKID[0], 16); - } - pAd->StaCfg.SavedPMKNum--; - break; - } - } - - DBGPRINT(RT_DEBUG_TRACE ,("rt_ioctl_siwpmksa - IW_PMKSA_REMOVE\n")); - break; - case IW_PMKSA_ADD: - for (CachedIdx = 0; CachedIdx < pAd->StaCfg.SavedPMKNum; CachedIdx++) - { - // compare the BSSID - if (NdisEqualMemory(pPmksa->bssid.sa_data, pAd->StaCfg.SavedPMK[CachedIdx].BSSID, MAC_ADDR_LEN)) - break; - } - - // Found, replace it - if (CachedIdx < PMKID_NO) - { - DBGPRINT(RT_DEBUG_OFF, ("Update PMKID, idx = %d\n", CachedIdx)); - NdisMoveMemory(&pAd->StaCfg.SavedPMK[CachedIdx].BSSID[0], pPmksa->bssid.sa_data, MAC_ADDR_LEN); - NdisMoveMemory(&pAd->StaCfg.SavedPMK[CachedIdx].PMKID[0], pPmksa->pmkid, 16); - pAd->StaCfg.SavedPMKNum++; - } - // Not found, replace the last one - else - { - // Randomly replace one - CachedIdx = (pPmksa->bssid.sa_data[5] % PMKID_NO); - DBGPRINT(RT_DEBUG_OFF, ("Update PMKID, idx = %d\n", CachedIdx)); - NdisMoveMemory(&pAd->StaCfg.SavedPMK[CachedIdx].BSSID[0], pPmksa->bssid.sa_data, MAC_ADDR_LEN); - NdisMoveMemory(&pAd->StaCfg.SavedPMK[CachedIdx].PMKID[0], pPmksa->pmkid, 16); - } - - DBGPRINT(RT_DEBUG_TRACE ,("rt_ioctl_siwpmksa - IW_PMKSA_ADD\n")); - break; - default: - DBGPRINT(RT_DEBUG_TRACE ,("rt_ioctl_siwpmksa - Unknow Command!!\n")); - break; - } - - return 0; -} -#endif // #if WIRELESS_EXT > 17 - -int rt_ioctl_siwrate(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - PRTMP_ADAPTER pAd = RTMP_OS_NETDEV_GET_PRIV(dev); - UINT32 rate = wrqu->bitrate.value, fixed = wrqu->bitrate.fixed; - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("rt_ioctl_siwrate::Network is down!\n")); - return -ENETDOWN; - } - - DBGPRINT(RT_DEBUG_TRACE, ("rt_ioctl_siwrate::(rate = %d, fixed = %d)\n", rate, fixed)); - /* rate = -1 => auto rate - rate = X, fixed = 1 => (fixed rate X) - */ - if (rate == -1) - { - //Auto Rate - pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; - pAd->StaCfg.bAutoTxRateSwitch = TRUE; - if ((pAd->CommonCfg.PhyMode <= PHY_11G) || - (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE <= MODE_OFDM)) - RTMPSetDesiredRates(pAd, -1); - -#ifdef DOT11_N_SUPPORT - SetCommonHT(pAd); -#endif // DOT11_N_SUPPORT // - } - else - { - if (fixed) - { - pAd->StaCfg.bAutoTxRateSwitch = FALSE; - if ((pAd->CommonCfg.PhyMode <= PHY_11G) || - (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE <= MODE_OFDM)) - RTMPSetDesiredRates(pAd, rate); - else - { - pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; -#ifdef DOT11_N_SUPPORT - SetCommonHT(pAd); -#endif // DOT11_N_SUPPORT // - } - DBGPRINT(RT_DEBUG_TRACE, ("rt_ioctl_siwrate::(HtMcs=%d)\n",pAd->StaCfg.DesiredTransmitSetting.field.MCS)); - } - else - { - // TODO: rate = X, fixed = 0 => (rates <= X) - return -EOPNOTSUPP; - } - } - - return 0; -} - -int rt_ioctl_giwrate(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - PRTMP_ADAPTER pAd = RTMP_OS_NETDEV_GET_PRIV(dev); - int rate_index = 0, rate_count = 0; - HTTRANSMIT_SETTING ht_setting; -/* Remove to global variable - __s32 ralinkrate[] = - {2, 4, 11, 22, // CCK - 12, 18, 24, 36, 48, 72, 96, 108, // OFDM - 13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78, 104, 156, 208, 234, 260, // 20MHz, 800ns GI, MCS: 0 ~ 15 - 39, 78, 117, 156, 234, 312, 351, 390, // 20MHz, 800ns GI, MCS: 16 ~ 23 - 27, 54, 81, 108, 162, 216, 243, 270, 54, 108, 162, 216, 324, 432, 486, 540, // 40MHz, 800ns GI, MCS: 0 ~ 15 - 81, 162, 243, 324, 486, 648, 729, 810, // 40MHz, 800ns GI, MCS: 16 ~ 23 - 14, 29, 43, 57, 87, 115, 130, 144, 29, 59, 87, 115, 173, 230, 260, 288, // 20MHz, 400ns GI, MCS: 0 ~ 15 - 43, 87, 130, 173, 260, 317, 390, 433, // 20MHz, 400ns GI, MCS: 16 ~ 23 - 30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 480, 540, 600, // 40MHz, 400ns GI, MCS: 0 ~ 15 - 90, 180, 270, 360, 540, 720, 810, 900}; // 40MHz, 400ns GI, MCS: 16 ~ 23 -*/ - - rate_count = sizeof(ralinkrate)/sizeof(__s32); - //check if the interface is down - if(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - if ((pAd->StaCfg.bAutoTxRateSwitch == FALSE) && - (INFRA_ON(pAd)) && - ((pAd->CommonCfg.PhyMode <= PHY_11G) || (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE <= MODE_OFDM))) - ht_setting.word = pAd->StaCfg.HTPhyMode.word; - else - ht_setting.word = pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word; - -#ifdef DOT11_N_SUPPORT - if (ht_setting.field.MODE >= MODE_HTMIX) - { -// rate_index = 12 + ((UCHAR)ht_setting.field.BW *16) + ((UCHAR)ht_setting.field.ShortGI *32) + ((UCHAR)ht_setting.field.MCS); - rate_index = 12 + ((UCHAR)ht_setting.field.BW *24) + ((UCHAR)ht_setting.field.ShortGI *48) + ((UCHAR)ht_setting.field.MCS); - } - else -#endif // DOT11_N_SUPPORT // - if (ht_setting.field.MODE == MODE_OFDM) - rate_index = (UCHAR)(ht_setting.field.MCS) + 4; - else if (ht_setting.field.MODE == MODE_CCK) - rate_index = (UCHAR)(ht_setting.field.MCS); - - if (rate_index < 0) - rate_index = 0; - - if (rate_index > rate_count) - rate_index = rate_count; - - wrqu->bitrate.value = ralinkrate[rate_index] * 500000; - wrqu->bitrate.disabled = 0; - - return 0; -} - -static const iw_handler rt_handler[] = -{ - (iw_handler) NULL, /* SIOCSIWCOMMIT */ - (iw_handler) rt_ioctl_giwname, /* SIOCGIWNAME */ - (iw_handler) NULL, /* SIOCSIWNWID */ - (iw_handler) NULL, /* SIOCGIWNWID */ - (iw_handler) rt_ioctl_siwfreq, /* SIOCSIWFREQ */ - (iw_handler) rt_ioctl_giwfreq, /* SIOCGIWFREQ */ - (iw_handler) rt_ioctl_siwmode, /* SIOCSIWMODE */ - (iw_handler) rt_ioctl_giwmode, /* SIOCGIWMODE */ - (iw_handler) NULL, /* SIOCSIWSENS */ - (iw_handler) NULL, /* SIOCGIWSENS */ - (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */ - (iw_handler) rt_ioctl_giwrange, /* SIOCGIWRANGE */ - (iw_handler) NULL /* not used */, /* SIOCSIWPRIV */ - (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */ - (iw_handler) NULL /* not used */, /* SIOCSIWSTATS */ - (iw_handler) rt28xx_get_wireless_stats /* kernel code */, /* SIOCGIWSTATS */ - (iw_handler) NULL, /* SIOCSIWSPY */ - (iw_handler) NULL, /* SIOCGIWSPY */ - (iw_handler) NULL, /* SIOCSIWTHRSPY */ - (iw_handler) NULL, /* SIOCGIWTHRSPY */ - (iw_handler) rt_ioctl_siwap, /* SIOCSIWAP */ - (iw_handler) rt_ioctl_giwap, /* SIOCGIWAP */ -#ifdef SIOCSIWMLME - (iw_handler) rt_ioctl_siwmlme, /* SIOCSIWMLME */ -#else - (iw_handler) NULL, /* SIOCSIWMLME */ -#endif // SIOCSIWMLME // - (iw_handler) rt_ioctl_iwaplist, /* SIOCGIWAPLIST */ -#ifdef SIOCGIWSCAN - (iw_handler) rt_ioctl_siwscan, /* SIOCSIWSCAN */ - (iw_handler) rt_ioctl_giwscan, /* SIOCGIWSCAN */ -#else - (iw_handler) NULL, /* SIOCSIWSCAN */ - (iw_handler) NULL, /* SIOCGIWSCAN */ -#endif /* SIOCGIWSCAN */ - (iw_handler) rt_ioctl_siwessid, /* SIOCSIWESSID */ - (iw_handler) rt_ioctl_giwessid, /* SIOCGIWESSID */ - (iw_handler) rt_ioctl_siwnickn, /* SIOCSIWNICKN */ - (iw_handler) rt_ioctl_giwnickn, /* SIOCGIWNICKN */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) rt_ioctl_siwrate, /* SIOCSIWRATE */ - (iw_handler) rt_ioctl_giwrate, /* SIOCGIWRATE */ - (iw_handler) rt_ioctl_siwrts, /* SIOCSIWRTS */ - (iw_handler) rt_ioctl_giwrts, /* SIOCGIWRTS */ - (iw_handler) rt_ioctl_siwfrag, /* SIOCSIWFRAG */ - (iw_handler) rt_ioctl_giwfrag, /* SIOCGIWFRAG */ - (iw_handler) NULL, /* SIOCSIWTXPOW */ - (iw_handler) NULL, /* SIOCGIWTXPOW */ - (iw_handler) NULL, /* SIOCSIWRETRY */ - (iw_handler) NULL, /* SIOCGIWRETRY */ - (iw_handler) rt_ioctl_siwencode, /* SIOCSIWENCODE */ - (iw_handler) rt_ioctl_giwencode, /* SIOCGIWENCODE */ - (iw_handler) NULL, /* SIOCSIWPOWER */ - (iw_handler) NULL, /* SIOCGIWPOWER */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ -#if WIRELESS_EXT > 17 - (iw_handler) rt_ioctl_siwgenie, /* SIOCSIWGENIE */ - (iw_handler) rt_ioctl_giwgenie, /* SIOCGIWGENIE */ - (iw_handler) rt_ioctl_siwauth, /* SIOCSIWAUTH */ - (iw_handler) rt_ioctl_giwauth, /* SIOCGIWAUTH */ - (iw_handler) rt_ioctl_siwencodeext, /* SIOCSIWENCODEEXT */ - (iw_handler) rt_ioctl_giwencodeext, /* SIOCGIWENCODEEXT */ - (iw_handler) rt_ioctl_siwpmksa, /* SIOCSIWPMKSA */ -#endif -}; - -static const iw_handler rt_priv_handlers[] = { - (iw_handler) NULL, /* + 0x00 */ - (iw_handler) NULL, /* + 0x01 */ - (iw_handler) rt_ioctl_setparam, /* + 0x02 */ - (iw_handler) NULL, /* + 0x03 */ - (iw_handler) NULL, /* + 0x04 */ - (iw_handler) NULL, /* + 0x05 */ - (iw_handler) NULL, /* + 0x06 */ - (iw_handler) NULL, /* + 0x07 */ - (iw_handler) NULL, /* + 0x08 */ - (iw_handler) rt_private_get_statistics, /* + 0x09 */ - (iw_handler) NULL, /* + 0x0A */ - (iw_handler) NULL, /* + 0x0B */ - (iw_handler) NULL, /* + 0x0C */ - (iw_handler) NULL, /* + 0x0D */ - (iw_handler) NULL, /* + 0x0E */ - (iw_handler) NULL, /* + 0x0F */ - (iw_handler) NULL, /* + 0x10 */ - (iw_handler) rt_private_show, /* + 0x11 */ - (iw_handler) NULL, /* + 0x12 */ - (iw_handler) NULL, /* + 0x13 */ - (iw_handler) NULL, /* + 0x14 */ - (iw_handler) NULL, /* + 0x15 */ - (iw_handler) NULL, /* + 0x16 */ - (iw_handler) NULL, /* + 0x17 */ - (iw_handler) NULL, /* + 0x18 */ -}; - -const struct iw_handler_def rt28xx_iw_handler_def = -{ -#define N(a) (sizeof (a) / sizeof (a[0])) - .standard = (iw_handler *) rt_handler, - .num_standard = sizeof(rt_handler) / sizeof(iw_handler), - .private = (iw_handler *) rt_priv_handlers, - .num_private = N(rt_priv_handlers), - .private_args = (struct iw_priv_args *) privtab, - .num_private_args = N(privtab), -#if IW_HANDLER_VERSION >= 7 - .get_wireless_stats = rt28xx_get_wireless_stats, -#endif -}; - -INT rt28xx_sta_ioctl( - IN struct net_device *net_dev, - IN OUT struct ifreq *rq, - IN INT cmd) -{ - POS_COOKIE pObj; - RTMP_ADAPTER *pAd = NULL; - struct iwreq *wrq = (struct iwreq *) rq; - BOOLEAN StateMachineTouched = FALSE; - INT Status = NDIS_STATUS_SUCCESS; - - pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev); - if (pAd == NULL) - { - /* if 1st open fail, pAd will be free; - So the net_dev->priv will be NULL in 2rd open */ - return -ENETDOWN; - } - pObj = (POS_COOKIE) pAd->OS_Cookie; - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { -#ifdef CONFIG_APSTA_MIXED_SUPPORT - if (wrq->u.data.pointer == NULL) - { - return Status; - } - - if (strstr(wrq->u.data.pointer, "OpMode") == NULL) -#endif // CONFIG_APSTA_MIXED_SUPPORT // - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - } - - { // determine this ioctl command is comming from which interface. - pObj->ioctl_if_type = INT_MAIN; - pObj->ioctl_if = MAIN_MBSSID; - } - - switch(cmd) - { -#ifdef RALINK_ATE -#ifdef RALINK_28xx_QA - case RTPRIV_IOCTL_ATE: - { - RtmpDoAte(pAd, wrq); - } - break; -#endif // RALINK_28xx_QA // -#endif // RALINK_ATE // - case SIOCGIFHWADDR: - DBGPRINT(RT_DEBUG_TRACE, ("IOCTL::SIOCGIFHWADDR\n")); - memcpy(wrq->u.name, pAd->CurrentAddress, ETH_ALEN); - break; - case SIOCGIWNAME: - { - char *name=&wrq->u.name[0]; - rt_ioctl_giwname(net_dev, NULL, name, NULL); - break; - } - case SIOCGIWESSID: //Get ESSID - { - struct iw_point *essid=&wrq->u.essid; - rt_ioctl_giwessid(net_dev, NULL, essid, essid->pointer); - break; - } - case SIOCSIWESSID: //Set ESSID - { - struct iw_point *essid=&wrq->u.essid; - rt_ioctl_siwessid(net_dev, NULL, essid, essid->pointer); - break; - } - case SIOCSIWNWID: // set network id (the cell) - case SIOCGIWNWID: // get network id - Status = -EOPNOTSUPP; - break; - case SIOCSIWFREQ: //set channel/frequency (Hz) - { - struct iw_freq *freq=&wrq->u.freq; - rt_ioctl_siwfreq(net_dev, NULL, freq, NULL); - break; - } - case SIOCGIWFREQ: // get channel/frequency (Hz) - { - struct iw_freq *freq=&wrq->u.freq; - rt_ioctl_giwfreq(net_dev, NULL, freq, NULL); - break; - } - case SIOCSIWNICKN: //set node name/nickname - { - //struct iw_point *data=&wrq->u.data; - //rt_ioctl_siwnickn(net_dev, NULL, data, NULL); - break; - } - case SIOCGIWNICKN: //get node name/nickname - { - struct iw_point *erq = NULL; - erq = &wrq->u.data; - erq->length = strlen((PSTRING) pAd->nickname); - Status = copy_to_user(erq->pointer, pAd->nickname, erq->length); - break; - } - case SIOCGIWRATE: //get default bit rate (bps) - rt_ioctl_giwrate(net_dev, NULL, &wrq->u, NULL); - break; - case SIOCSIWRATE: //set default bit rate (bps) - rt_ioctl_siwrate(net_dev, NULL, &wrq->u, NULL); - break; - case SIOCGIWRTS: // get RTS/CTS threshold (bytes) - { - struct iw_param *rts=&wrq->u.rts; - rt_ioctl_giwrts(net_dev, NULL, rts, NULL); - break; - } - case SIOCSIWRTS: //set RTS/CTS threshold (bytes) - { - struct iw_param *rts=&wrq->u.rts; - rt_ioctl_siwrts(net_dev, NULL, rts, NULL); - break; - } - case SIOCGIWFRAG: //get fragmentation thr (bytes) - { - struct iw_param *frag=&wrq->u.frag; - rt_ioctl_giwfrag(net_dev, NULL, frag, NULL); - break; - } - case SIOCSIWFRAG: //set fragmentation thr (bytes) - { - struct iw_param *frag=&wrq->u.frag; - rt_ioctl_siwfrag(net_dev, NULL, frag, NULL); - break; - } - case SIOCGIWENCODE: //get encoding token & mode - { - struct iw_point *erq=&wrq->u.encoding; - if(erq) - rt_ioctl_giwencode(net_dev, NULL, erq, erq->pointer); - break; - } - case SIOCSIWENCODE: //set encoding token & mode - { - struct iw_point *erq=&wrq->u.encoding; - if(erq) - rt_ioctl_siwencode(net_dev, NULL, erq, erq->pointer); - break; - } - case SIOCGIWAP: //get access point MAC addresses - { - struct sockaddr *ap_addr=&wrq->u.ap_addr; - rt_ioctl_giwap(net_dev, NULL, ap_addr, ap_addr->sa_data); - break; - } - case SIOCSIWAP: //set access point MAC addresses - { - struct sockaddr *ap_addr=&wrq->u.ap_addr; - rt_ioctl_siwap(net_dev, NULL, ap_addr, ap_addr->sa_data); - break; - } - case SIOCGIWMODE: //get operation mode - { - __u32 *mode=&wrq->u.mode; - rt_ioctl_giwmode(net_dev, NULL, mode, NULL); - break; - } - case SIOCSIWMODE: //set operation mode - { - __u32 *mode=&wrq->u.mode; - rt_ioctl_siwmode(net_dev, NULL, mode, NULL); - break; - } - case SIOCGIWSENS: //get sensitivity (dBm) - case SIOCSIWSENS: //set sensitivity (dBm) - case SIOCGIWPOWER: //get Power Management settings - case SIOCSIWPOWER: //set Power Management settings - case SIOCGIWTXPOW: //get transmit power (dBm) - case SIOCSIWTXPOW: //set transmit power (dBm) - case SIOCGIWRANGE: //Get range of parameters - case SIOCGIWRETRY: //get retry limits and lifetime - case SIOCSIWRETRY: //set retry limits and lifetime - case RT_PRIV_IOCTL: - case RT_PRIV_IOCTL_EXT: - Status = -EOPNOTSUPP; - break; - case SIOCGIWPRIV: - if (wrq->u.data.pointer) - { - if ( access_ok(VERIFY_WRITE, wrq->u.data.pointer, sizeof(privtab)) != TRUE) - break; - wrq->u.data.length = sizeof(privtab) / sizeof(privtab[0]); - if (copy_to_user(wrq->u.data.pointer, privtab, sizeof(privtab))) - Status = -EFAULT; - } - break; - case RTPRIV_IOCTL_SET: - if(access_ok(VERIFY_READ, wrq->u.data.pointer, wrq->u.data.length) != TRUE) - break; - rt_ioctl_setparam(net_dev, NULL, NULL, wrq->u.data.pointer); - break; - case RTPRIV_IOCTL_GSITESURVEY: - RTMPIoctlGetSiteSurvey(pAd, wrq); - break; - case SIOCETHTOOL: - break; - default: - DBGPRINT(RT_DEBUG_ERROR, ("IOCTL::unknown IOCTL's cmd = 0x%08x\n", cmd)); - Status = -EOPNOTSUPP; - break; - } - - if(StateMachineTouched) // Upper layer sent a MLME-related operations - RTMP_MLME_HANDLER(pAd); - - return Status; -} - -/* - ========================================================================== - Description: - Set SSID - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_SSID_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - NDIS_802_11_SSID Ssid, *pSsid=NULL; - BOOLEAN StateMachineTouched = FALSE; - int success = TRUE; - - if( strlen(arg) <= MAX_LEN_OF_SSID) - { - NdisZeroMemory(&Ssid, sizeof(NDIS_802_11_SSID)); - if (strlen(arg) != 0) - { - NdisMoveMemory(Ssid.Ssid, arg, strlen(arg)); - Ssid.SsidLength = strlen(arg); - } - else //ANY ssid - { - Ssid.SsidLength = 0; - memcpy(Ssid.Ssid, "", 0); - pAdapter->StaCfg.BssType = BSS_INFRA; - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; - pAdapter->StaCfg.WepStatus = Ndis802_11EncryptionDisabled; - } - pSsid = &Ssid; - - if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { - RTMP_MLME_RESET_STATE_MACHINE(pAdapter); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); - } - - if ((pAdapter->StaCfg.WpaPassPhraseLen >= 8) && - (pAdapter->StaCfg.WpaPassPhraseLen <= 64)) - { - STRING passphrase_str[65] = {0}; - UCHAR keyMaterial[40]; - - RTMPMoveMemory(passphrase_str, pAdapter->StaCfg.WpaPassPhrase, pAdapter->StaCfg.WpaPassPhraseLen); - RTMPZeroMemory(pAdapter->StaCfg.PMK, 32); - if (pAdapter->StaCfg.WpaPassPhraseLen == 64) - { - AtoH((PSTRING) pAdapter->StaCfg.WpaPassPhrase, pAdapter->StaCfg.PMK, 32); - } - else - { - PasswordHash((PSTRING) pAdapter->StaCfg.WpaPassPhrase, Ssid.Ssid, Ssid.SsidLength, keyMaterial); - NdisMoveMemory(pAdapter->StaCfg.PMK, keyMaterial, 32); - } - } - - pAdapter->MlmeAux.CurrReqIsFromNdis = TRUE; - pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE; - pAdapter->bConfigChanged = TRUE; - - MlmeEnqueue(pAdapter, - MLME_CNTL_STATE_MACHINE, - OID_802_11_SSID, - sizeof(NDIS_802_11_SSID), - (VOID *)pSsid); - - StateMachineTouched = TRUE; - DBGPRINT(RT_DEBUG_TRACE, ("Set_SSID_Proc::(Len=%d,Ssid=%s)\n", Ssid.SsidLength, Ssid.Ssid)); - } - else - success = FALSE; - - if (StateMachineTouched) // Upper layer sent a MLME-related operations - RTMP_MLME_HANDLER(pAdapter); - - return success; -} - -#ifdef WMM_SUPPORT -/* - ========================================================================== - Description: - Set WmmCapable Enable or Disable - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_WmmCapable_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - BOOLEAN bWmmCapable; - - bWmmCapable = simple_strtol(arg, 0, 10); - - if ((bWmmCapable == 1) - ) - pAd->CommonCfg.bWmmCapable = TRUE; - else if (bWmmCapable == 0) - pAd->CommonCfg.bWmmCapable = FALSE; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_WmmCapable_Proc::(bWmmCapable=%d)\n", - pAd->CommonCfg.bWmmCapable)); - - return TRUE; -} -#endif // WMM_SUPPORT // - -/* - ========================================================================== - Description: - Set Network Type(Infrastructure/Adhoc mode) - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_NetworkType_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - UINT32 Value = 0; - - if (strcmp(arg, "Adhoc") == 0) - { - if (pAdapter->StaCfg.BssType != BSS_ADHOC) - { - // Config has changed - pAdapter->bConfigChanged = TRUE; - if (MONITOR_ON(pAdapter)) - { - RTMP_IO_WRITE32(pAdapter, RX_FILTR_CFG, STANORMAL); - RTMP_IO_READ32(pAdapter, MAC_SYS_CTRL, &Value); - Value &= (~0x80); - RTMP_IO_WRITE32(pAdapter, MAC_SYS_CTRL, Value); - OPSTATUS_CLEAR_FLAG(pAdapter, fOP_STATUS_MEDIA_STATE_CONNECTED); - pAdapter->StaCfg.bAutoReconnect = TRUE; - LinkDown(pAdapter, FALSE); - } - if (INFRA_ON(pAdapter)) - { - //BOOLEAN Cancelled; - // Set the AutoReconnectSsid to prevent it reconnect to old SSID - // Since calling this indicate user don't want to connect to that SSID anymore. - pAdapter->MlmeAux.AutoReconnectSsidLen= 32; - NdisZeroMemory(pAdapter->MlmeAux.AutoReconnectSsid, pAdapter->MlmeAux.AutoReconnectSsidLen); - - LinkDown(pAdapter, FALSE); - - DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_DISCONNECT Event BB!\n")); - } - } - pAdapter->StaCfg.BssType = BSS_ADHOC; - pAdapter->net_dev->type = pAdapter->StaCfg.OriDevType; - DBGPRINT(RT_DEBUG_TRACE, ("===>Set_NetworkType_Proc::(AD-HOC)\n")); - } - else if (strcmp(arg, "Infra") == 0) - { - if (pAdapter->StaCfg.BssType != BSS_INFRA) - { - // Config has changed - pAdapter->bConfigChanged = TRUE; - if (MONITOR_ON(pAdapter)) - { - RTMP_IO_WRITE32(pAdapter, RX_FILTR_CFG, STANORMAL); - RTMP_IO_READ32(pAdapter, MAC_SYS_CTRL, &Value); - Value &= (~0x80); - RTMP_IO_WRITE32(pAdapter, MAC_SYS_CTRL, Value); - OPSTATUS_CLEAR_FLAG(pAdapter, fOP_STATUS_MEDIA_STATE_CONNECTED); - pAdapter->StaCfg.bAutoReconnect = TRUE; - LinkDown(pAdapter, FALSE); - } - if (ADHOC_ON(pAdapter)) - { - // Set the AutoReconnectSsid to prevent it reconnect to old SSID - // Since calling this indicate user don't want to connect to that SSID anymore. - pAdapter->MlmeAux.AutoReconnectSsidLen= 32; - NdisZeroMemory(pAdapter->MlmeAux.AutoReconnectSsid, pAdapter->MlmeAux.AutoReconnectSsidLen); - - LinkDown(pAdapter, FALSE); - } - } - pAdapter->StaCfg.BssType = BSS_INFRA; - pAdapter->net_dev->type = pAdapter->StaCfg.OriDevType; - DBGPRINT(RT_DEBUG_TRACE, ("===>Set_NetworkType_Proc::(INFRA)\n")); - } - else if (strcmp(arg, "Monitor") == 0) - { - UCHAR bbpValue = 0; - BCN_TIME_CFG_STRUC csr; - OPSTATUS_CLEAR_FLAG(pAdapter, fOP_STATUS_INFRA_ON); - OPSTATUS_CLEAR_FLAG(pAdapter, fOP_STATUS_ADHOC_ON); - OPSTATUS_SET_FLAG(pAdapter, fOP_STATUS_MEDIA_STATE_CONNECTED); - // disable all periodic state machine - pAdapter->StaCfg.bAutoReconnect = FALSE; - // reset all mlme state machine - RTMP_MLME_RESET_STATE_MACHINE(pAdapter); - DBGPRINT(RT_DEBUG_TRACE, ("fOP_STATUS_MEDIA_STATE_CONNECTED \n")); - if (pAdapter->CommonCfg.CentralChannel == 0) - { -#ifdef DOT11_N_SUPPORT - if (pAdapter->CommonCfg.PhyMode == PHY_11AN_MIXED) - pAdapter->CommonCfg.CentralChannel = 36; - else -#endif // DOT11_N_SUPPORT // - pAdapter->CommonCfg.CentralChannel = 6; - } -#ifdef DOT11_N_SUPPORT - else - N_ChannelCheck(pAdapter); -#endif // DOT11_N_SUPPORT // - -#ifdef DOT11_N_SUPPORT - if (pAdapter->CommonCfg.PhyMode >= PHY_11ABGN_MIXED && - pAdapter->CommonCfg.RegTransmitSetting.field.BW == BW_40 && - pAdapter->CommonCfg.RegTransmitSetting.field.EXTCHA == EXTCHA_ABOVE) - { - // 40MHz ,control channel at lower - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R4, &bbpValue); - bbpValue &= (~0x18); - bbpValue |= 0x10; - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R4, bbpValue); - pAdapter->CommonCfg.BBPCurrentBW = BW_40; - // RX : control channel at lower - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R3, &bbpValue); - bbpValue &= (~0x20); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R3, bbpValue); - - RTMP_IO_READ32(pAdapter, TX_BAND_CFG, &Value); - Value &= 0xfffffffe; - RTMP_IO_WRITE32(pAdapter, TX_BAND_CFG, Value); - pAdapter->CommonCfg.CentralChannel = pAdapter->CommonCfg.Channel + 2; - AsicSwitchChannel(pAdapter, pAdapter->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAdapter, pAdapter->CommonCfg.CentralChannel); - DBGPRINT(RT_DEBUG_TRACE, ("BW_40 ,control_channel(%d), CentralChannel(%d) \n", - pAdapter->CommonCfg.Channel, - pAdapter->CommonCfg.CentralChannel)); - } - else if (pAdapter->CommonCfg.PhyMode >= PHY_11ABGN_MIXED && - pAdapter->CommonCfg.RegTransmitSetting.field.BW == BW_40 && - pAdapter->CommonCfg.RegTransmitSetting.field.EXTCHA == EXTCHA_BELOW) - { - // 40MHz ,control channel at upper - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R4, &bbpValue); - bbpValue &= (~0x18); - bbpValue |= 0x10; - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R4, bbpValue); - pAdapter->CommonCfg.BBPCurrentBW = BW_40; - RTMP_IO_READ32(pAdapter, TX_BAND_CFG, &Value); - Value |= 0x1; - RTMP_IO_WRITE32(pAdapter, TX_BAND_CFG, Value); - - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R3, &bbpValue); - bbpValue |= (0x20); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R3, bbpValue); - pAdapter->CommonCfg.CentralChannel = pAdapter->CommonCfg.Channel - 2; - AsicSwitchChannel(pAdapter, pAdapter->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAdapter, pAdapter->CommonCfg.CentralChannel); - DBGPRINT(RT_DEBUG_TRACE, ("BW_40 ,control_channel(%d), CentralChannel(%d) \n", - pAdapter->CommonCfg.Channel, - pAdapter->CommonCfg.CentralChannel)); - } - else -#endif // DOT11_N_SUPPORT // - { - // 20MHz - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R4, &bbpValue); - bbpValue &= (~0x18); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R4, bbpValue); - pAdapter->CommonCfg.BBPCurrentBW = BW_20; - AsicSwitchChannel(pAdapter, pAdapter->CommonCfg.Channel, FALSE); - AsicLockChannel(pAdapter, pAdapter->CommonCfg.Channel); - DBGPRINT(RT_DEBUG_TRACE, ("BW_20, Channel(%d)\n", pAdapter->CommonCfg.Channel)); - } - // Enable Rx with promiscuous reception - RTMP_IO_WRITE32(pAdapter, RX_FILTR_CFG, 0x3); - // ASIC supporsts sniffer function with replacing RSSI with timestamp. - //RTMP_IO_READ32(pAdapter, MAC_SYS_CTRL, &Value); - //Value |= (0x80); - //RTMP_IO_WRITE32(pAdapter, MAC_SYS_CTRL, Value); - // disable sync - RTMP_IO_READ32(pAdapter, BCN_TIME_CFG, &csr.word); - csr.field.bBeaconGen = 0; - csr.field.bTBTTEnable = 0; - csr.field.TsfSyncMode = 0; - RTMP_IO_WRITE32(pAdapter, BCN_TIME_CFG, csr.word); - - pAdapter->StaCfg.BssType = BSS_MONITOR; - pAdapter->net_dev->type = ARPHRD_IEEE80211_PRISM; //ARPHRD_IEEE80211; // IEEE80211 - DBGPRINT(RT_DEBUG_TRACE, ("===>Set_NetworkType_Proc::(MONITOR)\n")); - } - - // Reset Ralink supplicant to not use, it will be set to start when UI set PMK key - pAdapter->StaCfg.WpaState = SS_NOTUSE; - - DBGPRINT(RT_DEBUG_TRACE, ("Set_NetworkType_Proc::(NetworkType=%d)\n", pAdapter->StaCfg.BssType)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Authentication mode - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_AuthMode_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - if ((strcmp(arg, "WEPAUTO") == 0) || (strcmp(arg, "wepauto") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeAutoSwitch; - else if ((strcmp(arg, "OPEN") == 0) || (strcmp(arg, "open") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; - else if ((strcmp(arg, "SHARED") == 0) || (strcmp(arg, "shared") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeShared; - else if ((strcmp(arg, "WPAPSK") == 0) || (strcmp(arg, "wpapsk") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPAPSK; - else if ((strcmp(arg, "WPANONE") == 0) || (strcmp(arg, "wpanone") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPANone; - else if ((strcmp(arg, "WPA2PSK") == 0) || (strcmp(arg, "wpa2psk") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPA2PSK; -#ifdef WPA_SUPPLICANT_SUPPORT - else if ((strcmp(arg, "WPA") == 0) || (strcmp(arg, "wpa") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPA; - else if ((strcmp(arg, "WPA2") == 0) || (strcmp(arg, "wpa2") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPA2; -#endif // WPA_SUPPLICANT_SUPPORT // - else - return FALSE; - - pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - - DBGPRINT(RT_DEBUG_TRACE, ("Set_AuthMode_Proc::(AuthMode=%d)\n", pAdapter->StaCfg.AuthMode)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Encryption Type - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_EncrypType_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - if ((strcmp(arg, "NONE") == 0) || (strcmp(arg, "none") == 0)) - { - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - pAdapter->StaCfg.WepStatus = Ndis802_11WEPDisabled; - pAdapter->StaCfg.PairCipher = Ndis802_11WEPDisabled; - pAdapter->StaCfg.GroupCipher = Ndis802_11WEPDisabled; - } - else if ((strcmp(arg, "WEP") == 0) || (strcmp(arg, "wep") == 0)) - { - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - pAdapter->StaCfg.WepStatus = Ndis802_11WEPEnabled; - pAdapter->StaCfg.PairCipher = Ndis802_11WEPEnabled; - pAdapter->StaCfg.GroupCipher = Ndis802_11WEPEnabled; - } - else if ((strcmp(arg, "TKIP") == 0) || (strcmp(arg, "tkip") == 0)) - { - if (pAdapter->StaCfg.AuthMode < Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - pAdapter->StaCfg.WepStatus = Ndis802_11Encryption2Enabled; - pAdapter->StaCfg.PairCipher = Ndis802_11Encryption2Enabled; - pAdapter->StaCfg.GroupCipher = Ndis802_11Encryption2Enabled; - } - else if ((strcmp(arg, "AES") == 0) || (strcmp(arg, "aes") == 0)) - { - if (pAdapter->StaCfg.AuthMode < Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - pAdapter->StaCfg.WepStatus = Ndis802_11Encryption3Enabled; - pAdapter->StaCfg.PairCipher = Ndis802_11Encryption3Enabled; - pAdapter->StaCfg.GroupCipher = Ndis802_11Encryption3Enabled; - } - else - return FALSE; - - pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; - - DBGPRINT(RT_DEBUG_TRACE, ("Set_EncrypType_Proc::(EncrypType=%d)\n", pAdapter->StaCfg.WepStatus)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Default Key ID - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_DefaultKeyID_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - ULONG KeyIdx; - - KeyIdx = simple_strtol(arg, 0, 10); - if((KeyIdx >= 1 ) && (KeyIdx <= 4)) - pAdapter->StaCfg.DefaultKeyId = (UCHAR) (KeyIdx - 1 ); - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_DefaultKeyID_Proc::(DefaultKeyID=%d)\n", pAdapter->StaCfg.DefaultKeyId)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set WEP KEY1 - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Key1_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - int KeyLen; - int i; - UCHAR CipherAlg=CIPHER_WEP64; - - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - KeyLen = strlen(arg); - - switch (KeyLen) - { - case 5: //wep 40 Ascii type - pAdapter->SharedKey[BSS0][0].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][0].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key1_Proc::(Key1=%s and type=%s)\n", arg, "Ascii")); - break; - case 10: //wep 40 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][0].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][0].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key1_Proc::(Key1=%s and type=%s)\n", arg, "Hex")); - break; - case 13: //wep 104 Ascii type - pAdapter->SharedKey[BSS0][0].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][0].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key1_Proc::(Key1=%s and type=%s)\n", arg, "Ascii")); - break; - case 26: //wep 104 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][0].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][0].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key1_Proc::(Key1=%s and type=%s)\n", arg, "Hex")); - break; - default: //Invalid argument - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key1_Proc::Invalid argument (=%s)\n", arg)); - return FALSE; - } - - pAdapter->SharedKey[BSS0][0].CipherAlg = CipherAlg; - - // Set keys (into ASIC) - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - ; // not support - else // Old WEP stuff - { - AsicAddSharedKeyEntry(pAdapter, - 0, - 0, - pAdapter->SharedKey[BSS0][0].CipherAlg, - pAdapter->SharedKey[BSS0][0].Key, - NULL, - NULL); - } - - return TRUE; -} -/* - ========================================================================== - - Description: - Set WEP KEY2 - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Key2_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - int KeyLen; - int i; - UCHAR CipherAlg=CIPHER_WEP64; - - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - KeyLen = strlen(arg); - - switch (KeyLen) - { - case 5: //wep 40 Ascii type - pAdapter->SharedKey[BSS0][1].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][1].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key2_Proc::(Key2=%s and type=%s)\n", arg, "Ascii")); - break; - case 10: //wep 40 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][1].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][1].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key2_Proc::(Key2=%s and type=%s)\n", arg, "Hex")); - break; - case 13: //wep 104 Ascii type - pAdapter->SharedKey[BSS0][1].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][1].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key2_Proc::(Key2=%s and type=%s)\n", arg, "Ascii")); - break; - case 26: //wep 104 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][1].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][1].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key2_Proc::(Key2=%s and type=%s)\n", arg, "Hex")); - break; - default: //Invalid argument - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key2_Proc::Invalid argument (=%s)\n", arg)); - return FALSE; - } - pAdapter->SharedKey[BSS0][1].CipherAlg = CipherAlg; - - // Set keys (into ASIC) - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - ; // not support - else // Old WEP stuff - { - AsicAddSharedKeyEntry(pAdapter, - 0, - 1, - pAdapter->SharedKey[BSS0][1].CipherAlg, - pAdapter->SharedKey[BSS0][1].Key, - NULL, - NULL); - } - - return TRUE; -} -/* - ========================================================================== - Description: - Set WEP KEY3 - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Key3_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - int KeyLen; - int i; - UCHAR CipherAlg=CIPHER_WEP64; - - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - KeyLen = strlen(arg); - - switch (KeyLen) - { - case 5: //wep 40 Ascii type - pAdapter->SharedKey[BSS0][2].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][2].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key3_Proc::(Key3=%s and type=Ascii)\n", arg)); - break; - case 10: //wep 40 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][2].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][2].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key3_Proc::(Key3=%s and type=Hex)\n", arg)); - break; - case 13: //wep 104 Ascii type - pAdapter->SharedKey[BSS0][2].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][2].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key3_Proc::(Key3=%s and type=Ascii)\n", arg)); - break; - case 26: //wep 104 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][2].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][2].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key3_Proc::(Key3=%s and type=Hex)\n", arg)); - break; - default: //Invalid argument - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key3_Proc::Invalid argument (=%s)\n", arg)); - return FALSE; - } - pAdapter->SharedKey[BSS0][2].CipherAlg = CipherAlg; - - // Set keys (into ASIC) - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - ; // not support - else // Old WEP stuff - { - AsicAddSharedKeyEntry(pAdapter, - 0, - 2, - pAdapter->SharedKey[BSS0][2].CipherAlg, - pAdapter->SharedKey[BSS0][2].Key, - NULL, - NULL); - } - - return TRUE; -} -/* - ========================================================================== - Description: - Set WEP KEY4 - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Key4_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - int KeyLen; - int i; - UCHAR CipherAlg=CIPHER_WEP64; - - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - KeyLen = strlen(arg); - - switch (KeyLen) - { - case 5: //wep 40 Ascii type - pAdapter->SharedKey[BSS0][3].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][3].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key4_Proc::(Key4=%s and type=%s)\n", arg, "Ascii")); - break; - case 10: //wep 40 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][3].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][3].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key4_Proc::(Key4=%s and type=%s)\n", arg, "Hex")); - break; - case 13: //wep 104 Ascii type - pAdapter->SharedKey[BSS0][3].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][3].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key4_Proc::(Key4=%s and type=%s)\n", arg, "Ascii")); - break; - case 26: //wep 104 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][3].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][3].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key4_Proc::(Key4=%s and type=%s)\n", arg, "Hex")); - break; - default: //Invalid argument - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key4_Proc::Invalid argument (=%s)\n", arg)); - return FALSE; - } - pAdapter->SharedKey[BSS0][3].CipherAlg = CipherAlg; - - // Set keys (into ASIC) - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - ; // not support - else // Old WEP stuff - { - AsicAddSharedKeyEntry(pAdapter, - 0, - 3, - pAdapter->SharedKey[BSS0][3].CipherAlg, - pAdapter->SharedKey[BSS0][3].Key, - NULL, - NULL); - } - - return TRUE; -} - -/* - ========================================================================== - Description: - Set WPA PSK key - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_WPAPSK_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - int status; - - if ((pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPAPSK) && - (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPA2PSK) && - (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPANone) - ) - return TRUE; // do nothing - - DBGPRINT(RT_DEBUG_TRACE, ("Set_WPAPSK_Proc::(WPAPSK=%s)\n", arg)); - - status = RT_CfgSetWPAPSKKey(pAd, arg, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, pAd->StaCfg.PMK); - if (status == FALSE) - { - DBGPRINT(RT_DEBUG_TRACE, ("Set_WPAPSK_Proc(): Set key failed!\n")); - return FALSE; - } - NdisZeroMemory(pAd->StaCfg.WpaPassPhrase, 64); - NdisMoveMemory(pAd->StaCfg.WpaPassPhrase, arg, strlen(arg)); - pAd->StaCfg.WpaPassPhraseLen = (UINT)strlen(arg); - - - - if(pAd->StaCfg.BssType == BSS_ADHOC && - pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) - { - pAd->StaCfg.WpaState = SS_NOTUSE; - } - else - { - // Start STA supplicant state machine - pAd->StaCfg.WpaState = SS_START; - } - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Power Saving mode - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_PSMode_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - if (pAdapter->StaCfg.BssType == BSS_INFRA) - { - if ((strcmp(arg, "Max_PSP") == 0) || - (strcmp(arg, "max_psp") == 0) || - (strcmp(arg, "MAX_PSP") == 0)) - { - // do NOT turn on PSM bit here, wait until MlmeCheckPsmChange() - // to exclude certain situations. - if (pAdapter->StaCfg.bWindowsACCAMEnable == FALSE) - pAdapter->StaCfg.WindowsPowerMode = Ndis802_11PowerModeMAX_PSP; - pAdapter->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeMAX_PSP; - OPSTATUS_SET_FLAG(pAdapter, fOP_STATUS_RECEIVE_DTIM); - pAdapter->StaCfg.DefaultListenCount = 5; - - } - else if ((strcmp(arg, "Fast_PSP") == 0) || - (strcmp(arg, "fast_psp") == 0) || - (strcmp(arg, "FAST_PSP") == 0)) - { - // do NOT turn on PSM bit here, wait until MlmeCheckPsmChange() - // to exclude certain situations. - OPSTATUS_SET_FLAG(pAdapter, fOP_STATUS_RECEIVE_DTIM); - if (pAdapter->StaCfg.bWindowsACCAMEnable == FALSE) - pAdapter->StaCfg.WindowsPowerMode = Ndis802_11PowerModeFast_PSP; - pAdapter->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeFast_PSP; - pAdapter->StaCfg.DefaultListenCount = 3; - } - else if ((strcmp(arg, "Legacy_PSP") == 0) || - (strcmp(arg, "legacy_psp") == 0) || - (strcmp(arg, "LEGACY_PSP") == 0)) - { - // do NOT turn on PSM bit here, wait until MlmeCheckPsmChange() - // to exclude certain situations. - OPSTATUS_SET_FLAG(pAdapter, fOP_STATUS_RECEIVE_DTIM); - if (pAdapter->StaCfg.bWindowsACCAMEnable == FALSE) - pAdapter->StaCfg.WindowsPowerMode = Ndis802_11PowerModeLegacy_PSP; - pAdapter->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeLegacy_PSP; - pAdapter->StaCfg.DefaultListenCount = 3; - } - else - { - //Default Ndis802_11PowerModeCAM - // clear PSM bit immediately - RTMP_SET_PSM_BIT(pAdapter, PWR_ACTIVE); - OPSTATUS_SET_FLAG(pAdapter, fOP_STATUS_RECEIVE_DTIM); - if (pAdapter->StaCfg.bWindowsACCAMEnable == FALSE) - pAdapter->StaCfg.WindowsPowerMode = Ndis802_11PowerModeCAM; - pAdapter->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeCAM; - } - - DBGPRINT(RT_DEBUG_TRACE, ("Set_PSMode_Proc::(PSMode=%ld)\n", pAdapter->StaCfg.WindowsPowerMode)); - } - else - return FALSE; - - - return TRUE; -} -//Add to suport the function which clould dynamicallly enable/disable PCIe Power Saving - -#ifdef WPA_SUPPLICANT_SUPPORT -/* - ========================================================================== - Description: - Set WpaSupport flag. - Value: - 0: Driver ignore wpa_supplicant. - 1: wpa_supplicant initiates scanning and AP selection. - 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters. - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Wpa_Support( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - - if ( simple_strtol(arg, 0, 10) == 0) - pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_DISABLE; - else if ( simple_strtol(arg, 0, 10) == 1) - pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_ENABLE; - else if ( simple_strtol(arg, 0, 10) == 2) - pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_ENABLE_WITH_WEB_UI; - else - pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_DISABLE; - - DBGPRINT(RT_DEBUG_TRACE, ("Set_Wpa_Support::(WpaSupplicantUP=%d)\n", pAd->StaCfg.WpaSupplicantUP)); - - return TRUE; -} -#endif // WPA_SUPPLICANT_SUPPORT // - -INT Set_TGnWifiTest_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - if (simple_strtol(arg, 0, 10) == 0) - pAd->StaCfg.bTGnWifiTest = FALSE; - else - pAd->StaCfg.bTGnWifiTest = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_TGnWifiTest_Proc::(bTGnWifiTest=%d)\n", pAd->StaCfg.bTGnWifiTest)); - return TRUE; -} - -#ifdef EXT_BUILD_CHANNEL_LIST -INT Set_Ieee80211dClientMode_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - if (simple_strtol(arg, 0, 10) == 0) - pAdapter->StaCfg.IEEE80211dClientMode = Rt802_11_D_None; - else if (simple_strtol(arg, 0, 10) == 1) - pAdapter->StaCfg.IEEE80211dClientMode = Rt802_11_D_Flexible; - else if (simple_strtol(arg, 0, 10) == 2) - pAdapter->StaCfg.IEEE80211dClientMode = Rt802_11_D_Strict; - else - return FALSE; - - DBGPRINT(RT_DEBUG_TRACE, ("Set_Ieee802dMode_Proc::(IEEEE0211dMode=%d)\n", pAdapter->StaCfg.IEEE80211dClientMode)); - return TRUE; -} -#endif // EXT_BUILD_CHANNEL_LIST // - -#ifdef CARRIER_DETECTION_SUPPORT -INT Set_CarrierDetect_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - if (simple_strtol(arg, 0, 10) == 0) - pAd->CommonCfg.CarrierDetect.Enable = FALSE; - else - pAd->CommonCfg.CarrierDetect.Enable = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_CarrierDetect_Proc::(CarrierDetect.Enable=%d)\n", pAd->CommonCfg.CarrierDetect.Enable)); - return TRUE; -} -#endif // CARRIER_DETECTION_SUPPORT // - - -INT Show_Adhoc_MacTable_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING extra) -{ - INT i; - - sprintf(extra, "\n"); - -#ifdef DOT11_N_SUPPORT - sprintf(extra, "%sHT Operating Mode : %d\n", extra, pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode); -#endif // DOT11_N_SUPPORT // - - sprintf(extra, "%s\n%-19s%-4s%-4s%-7s%-7s%-7s%-10s%-6s%-6s%-6s%-6s\n", extra, - "MAC", "AID", "BSS", "RSSI0", "RSSI1", "RSSI2", "PhMd", "BW", "MCS", "SGI", "STBC"); - - for (i=1; iMacTab.Content[i]; - - if (strlen(extra) > (IW_PRIV_SIZE_MASK - 30)) - break; - if ((pEntry->ValidAsCLI || pEntry->ValidAsApCli) && (pEntry->Sst == SST_ASSOC)) - { - sprintf(extra, "%s%02X:%02X:%02X:%02X:%02X:%02X ", extra, - pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2], - pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]); - sprintf(extra, "%s%-4d", extra, (int)pEntry->Aid); - sprintf(extra, "%s%-4d", extra, (int)pEntry->apidx); - sprintf(extra, "%s%-7d", extra, pEntry->RssiSample.AvgRssi0); - sprintf(extra, "%s%-7d", extra, pEntry->RssiSample.AvgRssi1); - sprintf(extra, "%s%-7d", extra, pEntry->RssiSample.AvgRssi2); - sprintf(extra, "%s%-10s", extra, GetPhyMode(pEntry->HTPhyMode.field.MODE)); - sprintf(extra, "%s%-6s", extra, GetBW(pEntry->HTPhyMode.field.BW)); - sprintf(extra, "%s%-6d", extra, pEntry->HTPhyMode.field.MCS); - sprintf(extra, "%s%-6d", extra, pEntry->HTPhyMode.field.ShortGI); - sprintf(extra, "%s%-6d", extra, pEntry->HTPhyMode.field.STBC); - sprintf(extra, "%s%-10d, %d, %d%%\n", extra, pEntry->DebugFIFOCount, pEntry->DebugTxCount, - (pEntry->DebugTxCount) ? ((pEntry->DebugTxCount-pEntry->DebugFIFOCount)*100/pEntry->DebugTxCount) : 0); - sprintf(extra, "%s\n", extra); - } - } - - return TRUE; -} - - -INT Set_BeaconLostTime_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG ltmp = (ULONG)simple_strtol(arg, 0, 10); - - if ((ltmp != 0) && (ltmp <= 60)) - pAd->StaCfg.BeaconLostTime = (ltmp * OS_HZ); - - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_BeaconLostTime_Proc::(BeaconLostTime=%ld)\n", pAd->StaCfg.BeaconLostTime)); - return TRUE; -} - -INT Set_AutoRoaming_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - if (simple_strtol(arg, 0, 10) == 0) - pAd->StaCfg.bAutoRoaming = FALSE; - else - pAd->StaCfg.bAutoRoaming = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_AutoRoaming_Proc::(bAutoRoaming=%d)\n", pAd->StaCfg.bAutoRoaming)); - return TRUE; -} - - -/* - ========================================================================== - Description: - Issue a site survey command to driver - Arguments: - pAdapter Pointer to our adapter - wrq Pointer to the ioctl argument - - Return Value: - None - - Note: - Usage: - 1.) iwpriv ra0 set site_survey - ========================================================================== -*/ -INT Set_SiteSurvey_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - NDIS_802_11_SSID Ssid; - - //check if the interface is down - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - if (MONITOR_ON(pAd)) - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! Driver is in Monitor Mode now !!!\n")); - return -EINVAL; - } - - RTMPZeroMemory(&Ssid, sizeof(NDIS_802_11_SSID)); - Ssid.SsidLength = 0; - if ((arg != NULL) && - (strlen(arg) <= MAX_LEN_OF_SSID)) - { - RTMPMoveMemory(Ssid.Ssid, arg, strlen(arg)); - Ssid.SsidLength = strlen(arg); - } - - pAd->StaCfg.bScanReqIsFromWebUI = TRUE; - - if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { - RTMP_MLME_RESET_STATE_MACHINE(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); - } - - // tell CNTL state machine to call NdisMSetInformationComplete() after completing - // this request, because this request is initiated by NDIS. - pAd->MlmeAux.CurrReqIsFromNdis = FALSE; - // Reset allowed scan retries - pAd->StaCfg.ScanCnt = 0; - NdisGetSystemUpTime(&pAd->StaCfg.LastScanTime); - - MlmeEnqueue(pAd, - MLME_CNTL_STATE_MACHINE, - OID_802_11_BSSID_LIST_SCAN, - Ssid.SsidLength, - Ssid.Ssid); - - RTMP_MLME_HANDLER(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_SiteSurvey_Proc\n")); - - return TRUE; -} - -INT Set_ForceTxBurst_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - if (simple_strtol(arg, 0, 10) == 0) - pAd->StaCfg.bForceTxBurst = FALSE; - else - pAd->StaCfg.bForceTxBurst = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_ForceTxBurst_Proc::(bForceTxBurst=%d)\n", pAd->StaCfg.bForceTxBurst)); - return TRUE; -} - -#ifdef ANT_DIVERSITY_SUPPORT -INT Set_Antenna_Proc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR arg) -{ - UCHAR UsedAnt; - DBGPRINT(RT_DEBUG_TRACE, ("==> Set_Antenna_Proc *******************\n")); - - if(simple_strtol(arg, 0, 10) <= 3) - UsedAnt = simple_strtol(arg, 0, 10); - - pAd->CommonCfg.bRxAntDiversity = UsedAnt; // Auto switch - if (UsedAnt == ANT_DIVERSITY_ENABLE) - { - pAd->RxAnt.EvaluateStableCnt = 0; - DBGPRINT(RT_DEBUG_TRACE, ("<== Set_Antenna_Proc(Auto Switch Mode), (%d,%d)\n", pAd->RxAnt.Pair1PrimaryRxAnt, pAd->RxAnt.Pair1SecondaryRxAnt)); - } - /* 2: Fix in the PHY Antenna CON1*/ - if (UsedAnt == ANT_FIX_ANT1) - { - AsicSetRxAnt(pAd, 0); - DBGPRINT(RT_DEBUG_TRACE, ("<== Set_Antenna_Proc(Fix in Ant CON1), (%d,%d)\n", pAd->RxAnt.Pair1PrimaryRxAnt, pAd->RxAnt.Pair1SecondaryRxAnt)); - } - /* 3: Fix in the PHY Antenna CON2*/ - if (UsedAnt == ANT_FIX_ANT2) - { - AsicSetRxAnt(pAd, 1); - DBGPRINT(RT_DEBUG_TRACE, ("<== Set_Antenna_Proc(Fix in Ant CON2), (%d,%d)\n", pAd->RxAnt.Pair1PrimaryRxAnt, pAd->RxAnt.Pair1SecondaryRxAnt)); - } - - return TRUE; -} -#endif // ANT_DIVERSITY_SUPPORT // \ No newline at end of file diff --git a/drivers/staging/rt3090/vr_ikans.h b/drivers/staging/rt3090/vr_ikans.h deleted file mode 100644 index 16bff3bec43b..000000000000 --- a/drivers/staging/rt3090/vr_ikans.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - vr_ikans.h - - Abstract: - Handle association related requests either from WSTA or from local MLME - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- - Sample Lin 01-28-2008 Created - */ - -#ifndef __VR_IKANS_H__ -#define __VR_IKANS_H__ - -#ifndef MODULE_IKANOS -#define IKANOS_EXTERN extern -#else -#define IKANOS_EXTERN -#endif // MODULE_IKANOS // - -#ifdef IKANOS_VX_1X0 - typedef void (*IkanosWlanTxCbFuncP)(void *, void *); - - struct IKANOS_TX_INFO - { - struct net_device *netdev; - IkanosWlanTxCbFuncP *fp; - }; -#endif // IKANOS_VX_1X0 // - - -IKANOS_EXTERN void VR_IKANOS_FP_Init(UINT8 BssNum, UINT8 *pApMac); - -IKANOS_EXTERN INT32 IKANOS_DataFramesTx(struct sk_buff *pSkb, - struct net_device *pNetDev); - -IKANOS_EXTERN void IKANOS_DataFrameRx(PRTMP_ADAPTER pAd, - void *pRxParam, - struct sk_buff *pSkb, - UINT32 Length); - -#endif // __VR_IKANS_H__ // - -/* End of vr_ikans.h */ diff --git a/drivers/staging/rt3090/wpa.h b/drivers/staging/rt3090/wpa.h deleted file mode 100644 index 8baa28774e30..000000000000 --- a/drivers/staging/rt3090/wpa.h +++ /dev/null @@ -1,447 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - wpa.h - - Abstract: - - Revision History: - Who When What - -------- ---------- ---------------------------------------------- - Name Date Modification logs -*/ - -#ifndef __WPA_H__ -#define __WPA_H__ - -// EAPOL Key descripter frame format related length -#define LEN_KEY_DESC_NONCE 32 -#define LEN_KEY_DESC_IV 16 -#define LEN_KEY_DESC_RSC 8 -#define LEN_KEY_DESC_ID 8 -#define LEN_KEY_DESC_REPLAY 8 -#define LEN_KEY_DESC_MIC 16 - -// The length is the EAPoL-Key frame except key data field. -// Please refer to 802.11i-2004 ,Figure 43u in p.78 -#define LEN_EAPOL_KEY_MSG (sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE) - -// EAP Code Type. -#define EAP_CODE_REQUEST 1 -#define EAP_CODE_RESPONSE 2 -#define EAP_CODE_SUCCESS 3 -#define EAP_CODE_FAILURE 4 - -// EAPOL frame Protocol Version -#define EAPOL_VER 1 -#define EAPOL_VER2 2 - -// EAPOL-KEY Descriptor Type -#define WPA1_KEY_DESC 0xfe -#define WPA2_KEY_DESC 0x02 - -// Key Descriptor Version of Key Information -#define DESC_TYPE_TKIP 1 -#define DESC_TYPE_AES 2 - -#define LEN_MSG1_2WAY 0x7f -#define MAX_LEN_OF_EAP_HS 256 - -#define LEN_MASTER_KEY 32 - -// EAPOL EK, MK -#define LEN_EAP_EK 16 -#define LEN_EAP_MICK 16 -#define LEN_EAP_KEY ((LEN_EAP_EK)+(LEN_EAP_MICK)) -// TKIP key related -#define LEN_PMKID 16 -#define LEN_TKIP_EK 16 -#define LEN_TKIP_RXMICK 8 -#define LEN_TKIP_TXMICK 8 -#define LEN_AES_EK 16 -#define LEN_AES_KEY LEN_AES_EK -#define LEN_TKIP_KEY ((LEN_TKIP_EK)+(LEN_TKIP_RXMICK)+(LEN_TKIP_TXMICK)) -#define TKIP_AP_TXMICK_OFFSET ((LEN_EAP_KEY)+(LEN_TKIP_EK)) -#define TKIP_AP_RXMICK_OFFSET (TKIP_AP_TXMICK_OFFSET+LEN_TKIP_TXMICK) -#define TKIP_GTK_LENGTH ((LEN_TKIP_EK)+(LEN_TKIP_RXMICK)+(LEN_TKIP_TXMICK)) -#define LEN_PTK ((LEN_EAP_KEY)+(LEN_TKIP_KEY)) -#define MIN_LEN_OF_GTK 5 -#define LEN_PMK 32 -#define LEN_PMK_NAME 16 -#define LEN_NONCE 32 - -// RSN IE Length definition -#define MAX_LEN_OF_RSNIE 255 -#define MIN_LEN_OF_RSNIE 8 - -#define KEY_LIFETIME 3600 - -//EAP Packet Type -#define EAPPacket 0 -#define EAPOLStart 1 -#define EAPOLLogoff 2 -#define EAPOLKey 3 -#define EAPOLASFAlert 4 -#define EAPTtypeMax 5 - -#define EAPOL_MSG_INVALID 0 -#define EAPOL_PAIR_MSG_1 1 -#define EAPOL_PAIR_MSG_2 2 -#define EAPOL_PAIR_MSG_3 3 -#define EAPOL_PAIR_MSG_4 4 -#define EAPOL_GROUP_MSG_1 5 -#define EAPOL_GROUP_MSG_2 6 - -#define PAIRWISEKEY 1 -#define GROUPKEY 0 - -// Retry timer counter initial value -#define PEER_MSG1_RETRY_TIMER_CTR 0 -#define PEER_MSG3_RETRY_TIMER_CTR 10 -#define GROUP_MSG1_RETRY_TIMER_CTR 20 - -// WPA mechanism retry timer interval -#define PEER_MSG1_RETRY_EXEC_INTV 1000 // 1 sec -#define PEER_MSG3_RETRY_EXEC_INTV 3000 // 3 sec -#define GROUP_KEY_UPDATE_EXEC_INTV 1000 // 1 sec -#define PEER_GROUP_KEY_UPDATE_INIV 2000 // 2 sec - -#define ENQUEUE_EAPOL_START_TIMER 200 // 200 ms - -// group rekey interval -#define TIME_REKEY 0 -#define PKT_REKEY 1 -#define DISABLE_REKEY 2 -#define MAX_REKEY 2 - -#define MAX_REKEY_INTER 0x3ffffff - -#define GROUP_SUITE 0 -#define PAIRWISE_SUITE 1 -#define AKM_SUITE 2 -#define PMKID_LIST 3 - - -#define EAPOL_START_DISABLE 0 -#define EAPOL_START_PSK 1 -#define EAPOL_START_1X 2 - -#define MIX_CIPHER_WPA_TKIP_ON(x) (((x) & 0x08) != 0) -#define MIX_CIPHER_WPA_AES_ON(x) (((x) & 0x04) != 0) -#define MIX_CIPHER_WPA2_TKIP_ON(x) (((x) & 0x02) != 0) -#define MIX_CIPHER_WPA2_AES_ON(x) (((x) & 0x01) != 0) - -#ifndef ROUND_UP -#define ROUND_UP(__x, __y) \ - (((ULONG)((__x)+((__y)-1))) & ((ULONG)~((__y)-1))) -#endif - -#define SET_UINT16_TO_ARRARY(_V, _LEN) \ -{ \ - _V[0] = (_LEN & 0xFF00) >> 8; \ - _V[1] = (_LEN & 0xFF); \ -} - -#define INC_UINT16_TO_ARRARY(_V, _LEN) \ -{ \ - UINT16 var_len; \ - \ - var_len = (_V[0]<<8) | (_V[1]); \ - var_len += _LEN; \ - \ - _V[0] = (var_len & 0xFF00) >> 8; \ - _V[1] = (var_len & 0xFF); \ -} - -#define CONV_ARRARY_TO_UINT16(_V) ((_V[0]<<8) | (_V[1])) - - -#define ADD_ONE_To_64BIT_VAR(_V) \ -{ \ - UCHAR cnt = LEN_KEY_DESC_REPLAY; \ - do \ - { \ - cnt--; \ - _V[cnt]++; \ - if (cnt == 0) \ - break; \ - }while (_V[cnt] == 0); \ -} - -#define IS_WPA_CAPABILITY(a) (((a) >= Ndis802_11AuthModeWPA) && ((a) <= Ndis802_11AuthModeWPA1PSKWPA2PSK)) - -// EAPOL Key Information definition within Key descriptor format -typedef struct PACKED _KEY_INFO -{ -#ifdef RT_BIG_ENDIAN - UCHAR KeyAck:1; - UCHAR Install:1; - UCHAR KeyIndex:2; - UCHAR KeyType:1; - UCHAR KeyDescVer:3; - UCHAR Rsvd:3; - UCHAR EKD_DL:1; // EKD for AP; DL for STA - UCHAR Request:1; - UCHAR Error:1; - UCHAR Secure:1; - UCHAR KeyMic:1; -#else - UCHAR KeyMic:1; - UCHAR Secure:1; - UCHAR Error:1; - UCHAR Request:1; - UCHAR EKD_DL:1; // EKD for AP; DL for STA - UCHAR Rsvd:3; - UCHAR KeyDescVer:3; - UCHAR KeyType:1; - UCHAR KeyIndex:2; - UCHAR Install:1; - UCHAR KeyAck:1; -#endif -} KEY_INFO, *PKEY_INFO; - -// EAPOL Key descriptor format -typedef struct PACKED _KEY_DESCRIPTER -{ - UCHAR Type; - KEY_INFO KeyInfo; - UCHAR KeyLength[2]; - UCHAR ReplayCounter[LEN_KEY_DESC_REPLAY]; - UCHAR KeyNonce[LEN_KEY_DESC_NONCE]; - UCHAR KeyIv[LEN_KEY_DESC_IV]; - UCHAR KeyRsc[LEN_KEY_DESC_RSC]; - UCHAR KeyId[LEN_KEY_DESC_ID]; - UCHAR KeyMic[LEN_KEY_DESC_MIC]; - UCHAR KeyDataLen[2]; - UCHAR KeyData[MAX_LEN_OF_RSNIE]; -} KEY_DESCRIPTER, *PKEY_DESCRIPTER; - -typedef struct PACKED _EAPOL_PACKET -{ - UCHAR ProVer; - UCHAR ProType; - UCHAR Body_Len[2]; - KEY_DESCRIPTER KeyDesc; -} EAPOL_PACKET, *PEAPOL_PACKET; - -//802.11i D10 page 83 -typedef struct PACKED _GTK_ENCAP -{ -#ifndef RT_BIG_ENDIAN - UCHAR Kid:2; - UCHAR tx:1; - UCHAR rsv:5; - UCHAR rsv1; -#else - UCHAR rsv:5; - UCHAR tx:1; - UCHAR Kid:2; - UCHAR rsv1; -#endif - UCHAR GTK[TKIP_GTK_LENGTH]; -} GTK_ENCAP, *PGTK_ENCAP; - -typedef struct PACKED _KDE_ENCAP -{ - UCHAR Type; - UCHAR Len; - UCHAR OUI[3]; - UCHAR DataType; - GTK_ENCAP GTKEncap; -} KDE_ENCAP, *PKDE_ENCAP; - -// For WPA1 -typedef struct PACKED _RSNIE { - UCHAR oui[4]; - USHORT version; - UCHAR mcast[4]; - USHORT ucount; - struct PACKED { - UCHAR oui[4]; - }ucast[1]; -} RSNIE, *PRSNIE; - -// For WPA2 -typedef struct PACKED _RSNIE2 { - USHORT version; - UCHAR mcast[4]; - USHORT ucount; - struct PACKED { - UCHAR oui[4]; - }ucast[1]; -} RSNIE2, *PRSNIE2; - -// AKM Suite -typedef struct PACKED _RSNIE_AUTH { - USHORT acount; - struct PACKED { - UCHAR oui[4]; - }auth[1]; -} RSNIE_AUTH,*PRSNIE_AUTH; - -typedef union PACKED _RSN_CAPABILITIES { - struct PACKED { -#ifdef RT_BIG_ENDIAN - USHORT Rsvd:10; - USHORT GTKSA_R_Counter:2; - USHORT PTKSA_R_Counter:2; - USHORT No_Pairwise:1; - USHORT PreAuth:1; -#else - USHORT PreAuth:1; - USHORT No_Pairwise:1; - USHORT PTKSA_R_Counter:2; - USHORT GTKSA_R_Counter:2; - USHORT Rsvd:10; -#endif - } field; - USHORT word; -} RSN_CAPABILITIES, *PRSN_CAPABILITIES; - -typedef struct PACKED _EAP_HDR { - UCHAR ProVer; - UCHAR ProType; - UCHAR Body_Len[2]; - UCHAR code; - UCHAR identifier; - UCHAR length[2]; // including code and identifier, followed by length-2 octets of data -} EAP_HDR, *PEAP_HDR; - -// For supplicant state machine states. 802.11i Draft 4.1, p. 97 -// We simplified it -typedef enum _WpaState -{ - SS_NOTUSE, // 0 - SS_START, // 1 - SS_WAIT_MSG_3, // 2 - SS_WAIT_GROUP, // 3 - SS_FINISH, // 4 - SS_KEYUPDATE, // 5 -} WPA_STATE; - -// -// The definition of the cipher combination -// -// bit3 bit2 bit1 bit0 -// +------------+------------+ -// | WPA | WPA2 | -// +------+-----+------+-----+ -// | TKIP | AES | TKIP | AES | -// | 0 | 1 | 1 | 0 | -> 0x06 -// | 0 | 1 | 1 | 1 | -> 0x07 -// | 1 | 0 | 0 | 1 | -> 0x09 -// | 1 | 0 | 1 | 1 | -> 0x0B -// | 1 | 1 | 0 | 1 | -> 0x0D -// | 1 | 1 | 1 | 0 | -> 0x0E -// | 1 | 1 | 1 | 1 | -> 0x0F -// +------+-----+------+-----+ -// -typedef enum _WpaMixPairCipher -{ - MIX_CIPHER_NOTUSE = 0x00, - WPA_NONE_WPA2_TKIPAES = 0x03, // WPA2-TKIPAES - WPA_AES_WPA2_TKIP = 0x06, - WPA_AES_WPA2_TKIPAES = 0x07, - WPA_TKIP_WPA2_AES = 0x09, - WPA_TKIP_WPA2_TKIPAES = 0x0B, - WPA_TKIPAES_WPA2_NONE = 0x0C, // WPA-TKIPAES - WPA_TKIPAES_WPA2_AES = 0x0D, - WPA_TKIPAES_WPA2_TKIP = 0x0E, - WPA_TKIPAES_WPA2_TKIPAES = 0x0F, -} WPA_MIX_PAIR_CIPHER; - -typedef struct PACKED _RSN_IE_HEADER_STRUCT { - UCHAR Eid; - UCHAR Length; - USHORT Version; // Little endian format -} RSN_IE_HEADER_STRUCT, *PRSN_IE_HEADER_STRUCT; - -// Cipher suite selector types -typedef struct PACKED _CIPHER_SUITE_STRUCT { - UCHAR Oui[3]; - UCHAR Type; -} CIPHER_SUITE_STRUCT, *PCIPHER_SUITE_STRUCT; - -// Authentication and Key Management suite selector -typedef struct PACKED _AKM_SUITE_STRUCT { - UCHAR Oui[3]; - UCHAR Type; -} AKM_SUITE_STRUCT, *PAKM_SUITE_STRUCT; - -// RSN capability -typedef struct PACKED _RSN_CAPABILITY { - USHORT Rsv:10; - USHORT GTKSAReplayCnt:2; - USHORT PTKSAReplayCnt:2; - USHORT NoPairwise:1; - USHORT PreAuth:1; -} RSN_CAPABILITY, *PRSN_CAPABILITY; - - -/*======================================== - The prototype is defined in cmm_wpa.c - ========================================*/ -BOOLEAN WpaMsgTypeSubst( - IN UCHAR EAPType, - OUT INT *MsgType); - -VOID PRF( - IN UCHAR *key, - IN INT key_len, - IN UCHAR *prefix, - IN INT prefix_len, - IN UCHAR *data, - IN INT data_len, - OUT UCHAR *output, - IN INT len); - -int PasswordHash( - char *password, - unsigned char *ssid, - int ssidlength, - unsigned char *output); - -PUINT8 GetSuiteFromRSNIE( - IN PUINT8 rsnie, - IN UINT rsnie_len, - IN UINT8 type, - OUT UINT8 *count); - -VOID WpaShowAllsuite( - IN PUINT8 rsnie, - IN UINT rsnie_len); - -VOID RTMPInsertRSNIE( - IN PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN PUINT8 rsnie_ptr, - IN UINT8 rsnie_len, - IN PUINT8 pmkid_ptr, - IN UINT8 pmkid_len); - - -#endif -- GitLab From 9dbeb8967262f2e6777441318780f224261ec410 Mon Sep 17 00:00:00 2001 From: Vasilis Liaskovitis Date: Tue, 22 Sep 2009 01:11:56 -0500 Subject: [PATCH 009/235] Staging: b3dfg: remove check for pci bus master Remove unneccesary check for pci master in enable_transmission() Signed-off-by: Vasilis Liaskovitis Signed-off-by: Greg Kroah-Hartman --- drivers/staging/b3dfg/b3dfg.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/staging/b3dfg/b3dfg.c b/drivers/staging/b3dfg/b3dfg.c index cda26bb493b3..4a43c51c172a 100644 --- a/drivers/staging/b3dfg/b3dfg.c +++ b/drivers/staging/b3dfg/b3dfg.c @@ -468,7 +468,6 @@ static int get_wand_status(struct b3dfg_dev *fgdev, int __user *arg) static int enable_transmission(struct b3dfg_dev *fgdev) { - u16 command; unsigned long flags; struct device *dev = &fgdev->pdev->dev; @@ -480,17 +479,6 @@ static int enable_transmission(struct b3dfg_dev *fgdev) return -EINVAL; } - /* - * Check we're a bus master. - * TODO: I think we can remove this having added the pci_set_master call - */ - pci_read_config_word(fgdev->pdev, PCI_COMMAND, &command); - if (!(command & PCI_COMMAND_MASTER)) { - dev_err(dev, "not a bus master, force-enabling\n"); - pci_write_config_word(fgdev->pdev, PCI_COMMAND, - command | PCI_COMMAND_MASTER); - } - spin_lock_irqsave(&fgdev->buffer_lock, flags); /* Handle racing enable_transmission calls. */ -- GitLab From d722a51007f60d173262e176157e6d9c58ef2cd0 Mon Sep 17 00:00:00 2001 From: Frederik Deweerdt Date: Tue, 15 Sep 2009 09:29:43 +0000 Subject: [PATCH 010/235] Staging: line6 driver.c: factorize code and cleanups - Factorize the code from line6_send_raw_message and line6_send_program into line6_send - Minor style cleanups Signed-off-by: Frederik Deweerdt Signed-off-by: Greg Kroah-Hartman --- drivers/staging/line6/driver.c | 103 +++++++++++++++++---------------- 1 file changed, 54 insertions(+), 49 deletions(-) diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c index f188ecee502f..e4078a92d399 100644 --- a/drivers/staging/line6/driver.c +++ b/drivers/staging/line6/driver.c @@ -168,19 +168,19 @@ static void line6_dump_urb(struct urb *urb) #endif /* - Send raw message in pieces of wMaxPacketSize bytes. + Send raw message in pieces of max_packet_size bytes. */ int line6_send_raw_message(struct usb_line6 *line6, const char *buffer, int size) { int i, done = 0; + int actual_size; #if DO_DUMP_URB_SEND line6_write_hexdump(line6, 'S', buffer, size); #endif - for (i = 0; i < size; i += line6->max_packet_size) { - int partial; + for (i = 0; i < size; i += actual_size) { const char *frag_buf = buffer + i; int frag_size = min(line6->max_packet_size, size - i); int retval; @@ -189,7 +189,7 @@ int line6_send_raw_message(struct usb_line6 *line6, const char *buffer, usb_sndintpipe(line6->usbdev, line6->ep_control_write), (char *)frag_buf, frag_size, - &partial, LINE6_TIMEOUT * HZ); + &actual_size, LINE6_TIMEOUT * HZ); if (retval) { dev_err(line6->ifcdev, @@ -197,7 +197,7 @@ int line6_send_raw_message(struct usb_line6 *line6, const char *buffer, break; } - done += frag_size; + done += actual_size; } return done; @@ -395,17 +395,44 @@ static void line6_data_received(struct urb *urb) line6_start_listen(line6); } +static int line6_send(struct usb_line6 *line6, unsigned char *buf, size_t len) +{ + int retval; + unsigned int partial; + +#if DO_DUMP_URB_SEND + line6_write_hexdump(line6, 'S', buf, len); +#endif + + retval = usb_interrupt_msg(line6->usbdev, + usb_sndintpipe(line6->usbdev, + line6->ep_control_write), + buf, len, &partial, + LINE6_TIMEOUT * HZ); + + if (retval) { + dev_err(line6->ifcdev, + "usb_interrupt_msg failed (%d)\n", retval); + } + + if (partial != len) { + dev_err(line6->ifcdev, + "usb_interrupt_msg sent partial message (%d)\n", + retval); + } + + return retval; +} + /* Send channel number (i.e., switch to a different sound). */ int line6_send_program(struct usb_line6 *line6, int value) { - int retval; unsigned char *buffer; - unsigned int partial; - - buffer = kmalloc(2, GFP_KERNEL); + size_t len = 2; + buffer = kmalloc(len, GFP_KERNEL); if (!buffer) { dev_err(line6->ifcdev, "out of memory\n"); return -ENOMEM; @@ -414,20 +441,7 @@ int line6_send_program(struct usb_line6 *line6, int value) buffer[0] = LINE6_PROGRAM_CHANGE | LINE6_CHANNEL_HOST; buffer[1] = value; -#if DO_DUMP_URB_SEND - line6_write_hexdump(line6, 'S', buffer, 2); -#endif - - retval = usb_interrupt_msg(line6->usbdev, - usb_sndintpipe(line6->usbdev, - line6->ep_control_write), - buffer, 2, &partial, LINE6_TIMEOUT * HZ); - - if (retval) - dev_err(line6->ifcdev, "usb_interrupt_msg failed (%d)\n", retval); - - kfree(buffer); - return retval; + return line6_send(line6, buffer, len); } /* @@ -435,12 +449,10 @@ int line6_send_program(struct usb_line6 *line6, int value) */ int line6_transmit_parameter(struct usb_line6 *line6, int param, int value) { - int retval; unsigned char *buffer; - unsigned int partial; - - buffer = kmalloc(3, GFP_KERNEL); + size_t len = 3; + buffer = kmalloc(len, GFP_KERNEL); if (!buffer) { dev_err(line6->ifcdev, "out of memory\n"); return -ENOMEM; @@ -450,19 +462,7 @@ int line6_transmit_parameter(struct usb_line6 *line6, int param, int value) buffer[1] = param; buffer[2] = value; -#if DO_DUMP_URB_SEND - line6_write_hexdump(line6, 'S', buffer, 3); -#endif - - retval = usb_interrupt_msg(line6->usbdev, - usb_sndintpipe(line6->usbdev, line6->ep_control_write), - buffer, 3, &partial, LINE6_TIMEOUT * HZ); - - if (retval) - dev_err(line6->ifcdev, "usb_interrupt_msg failed (%d)\n", retval); - - kfree(buffer); - return retval; + return line6_send(line6, buffer, len); } /* @@ -476,8 +476,10 @@ int line6_read_data(struct usb_line6 *line6, int address, void *data, size_t dat /* query the serial number: */ ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67, - USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, - (datalen << 8) | 0x21, address, NULL, 0, LINE6_TIMEOUT * HZ); + USB_TYPE_VENDOR | USB_RECIP_DEVICE + | USB_DIR_OUT, + (datalen << 8) | 0x21, address, + NULL, 0, LINE6_TIMEOUT * HZ); if (ret < 0) { dev_err(line6->ifcdev, "read request failed (error %d)\n", ret); @@ -496,9 +498,7 @@ int line6_read_data(struct usb_line6 *line6, int address, void *data, size_t dat "receive length failed (error %d)\n", ret); return ret; } - } - while (len == 0xff) - ; + } while (len == 0xff); if (len != datalen) { /* should be equal or something went wrong */ @@ -682,10 +682,14 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_ return -ENODEV; /* check vendor and product id */ - for (devtype = ARRAY_SIZE(line6_id_table) - 1; devtype--;) - if ((le16_to_cpu(usbdev->descriptor.idVendor) == line6_id_table[devtype].idVendor) && - (le16_to_cpu(usbdev->descriptor.idProduct) == line6_id_table[devtype].idProduct)) + for (devtype = ARRAY_SIZE(line6_id_table) - 1; devtype--;) { + u16 vendor = le16_to_cpu(usbdev->descriptor.idVendor); + u16 product = le16_to_cpu(usbdev->descriptor.idProduct); + + if (vendor == line6_id_table[devtype].idVendor + && product == line6_id_table[devtype].idProduct) break; + } if (devtype < 0) return -ENODEV; @@ -1036,9 +1040,10 @@ static void line6_disconnect(struct usb_interface *interface) dev_info(&interface->dev, "Line6 %s now disconnected\n", line6->properties->name); - for (i = LINE6_MAX_DEVICES; i--;) + for (i = LINE6_MAX_DEVICES; i--;) { if (line6_devices[i] == line6) line6_devices[i] = NULL; + } } line6_destruct(interface); -- GitLab From 034f58575982e473c808e501b5223274b14743c7 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Thu, 12 Nov 2009 15:46:01 -0800 Subject: [PATCH 011/235] Staging: line6: fix printk formats Fix printk format warnings in line6/pod.c; sizeof() is of type size_t, so use %zu. drivers/staging/line6/pod.c:581: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigned int' drivers/staging/line6/pod.c:693: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigned int' Signed-off-by: Randy Dunlap Signed-off-by: Greg Kroah-Hartman --- drivers/staging/line6/pod.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c index 4c5b9d584000..5f5fc025cb79 100644 --- a/drivers/staging/line6/pod.c +++ b/drivers/staging/line6/pod.c @@ -579,7 +579,7 @@ static ssize_t pod_set_dump(struct device *dev, struct device_attribute *attr, if (count != sizeof(pod->prog_data)) { dev_err(pod->line6.ifcdev, - "data block must be exactly %d bytes\n", + "data block must be exactly %zu bytes\n", sizeof(pod->prog_data)); return -EINVAL; } @@ -691,7 +691,7 @@ static ssize_t pod_set_dump_buf(struct device *dev, if (count != sizeof(pod->prog_data)) { dev_err(pod->line6.ifcdev, - "data block must be exactly %d bytes\n", + "data block must be exactly %zu bytes\n", sizeof(pod->prog_data)); return -EINVAL; } -- GitLab From 45af4977174e91ca5ee67802978e5ea02b087fe1 Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 15 Nov 2009 22:17:50 -0600 Subject: [PATCH 012/235] staging: line6: Lindent and fix checkpatch warnings in playback.c Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/line6/playback.c | 95 ++++++++++++++++++++------------ 1 file changed, 61 insertions(+), 34 deletions(-) diff --git a/drivers/staging/line6/playback.c b/drivers/staging/line6/playback.c index acb06126a6a5..4192cd9d96d5 100644 --- a/drivers/staging/line6/playback.c +++ b/drivers/staging/line6/playback.c @@ -20,7 +20,6 @@ #include "pod.h" #include "playback.h" - /* Software stereo volume control. */ @@ -30,7 +29,7 @@ static void change_volume(struct urb *urb_out, int volume[], int chn = 0; if (volume[0] == 256 && volume[1] == 256) - return; /* maximum volume - no change */ + return; /* maximum volume - no change */ if (bytes_per_frame == 4) { short *p, *buf_end; @@ -68,13 +67,17 @@ static int submit_audio_out_urb(struct snd_pcm_substream *substream) int i, urb_size, urb_frames; struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); const int bytes_per_frame = line6pcm->properties->bytes_per_frame; - const int frame_increment = line6pcm->properties->snd_line6_rates.rats[0].num_min; - const int frame_factor = line6pcm->properties->snd_line6_rates.rats[0].den * (USB_INTERVALS_PER_SECOND / LINE6_ISO_INTERVAL); + const int frame_increment = + line6pcm->properties->snd_line6_rates.rats[0].num_min; + const int frame_factor = + line6pcm->properties->snd_line6_rates.rats[0].den * + (USB_INTERVALS_PER_SECOND / LINE6_ISO_INTERVAL); struct snd_pcm_runtime *runtime = substream->runtime; struct urb *urb_out; spin_lock_irqsave(&line6pcm->lock_audio_out, flags); - index = find_first_zero_bit(&line6pcm->active_urb_out, LINE6_ISO_BUFFERS); + index = + find_first_zero_bit(&line6pcm->active_urb_out, LINE6_ISO_BUFFERS); if (index < 0 || index >= LINE6_ISO_BUFFERS) { spin_unlock_irqrestore(&line6pcm->lock_audio_out, flags); @@ -88,7 +91,8 @@ static int submit_audio_out_urb(struct snd_pcm_substream *substream) for (i = 0; i < LINE6_ISO_PACKETS; ++i) { /* compute frame size for given sampling rate */ int n, fs; - struct usb_iso_packet_descriptor *fout = &urb_out->iso_frame_desc[i]; + struct usb_iso_packet_descriptor *fout = + &urb_out->iso_frame_desc[i]; line6pcm->count_out += frame_increment; n = line6pcm->count_out / frame_factor; line6pcm->count_out -= n * frame_factor; @@ -106,21 +110,31 @@ static int submit_audio_out_urb(struct snd_pcm_substream *substream) } else { if (line6pcm->pos_out + urb_frames > runtime->buffer_size) { /* - The transferred area goes over buffer boundary, - copy the data to the temp buffer. - */ + The transferred area goes over buffer boundary, + copy the data to the temp buffer. + */ int len; len = runtime->buffer_size - line6pcm->pos_out; urb_out->transfer_buffer = line6pcm->wrap_out; if (len > 0) { - memcpy(line6pcm->wrap_out, runtime->dma_area + line6pcm->pos_out * bytes_per_frame, len * bytes_per_frame); - memcpy(line6pcm->wrap_out + len * bytes_per_frame, runtime->dma_area, (urb_frames - len) * bytes_per_frame); - } else - dev_err(s2m(substream), "driver bug: len = %d\n", len); /* this is somewhat paranoid */ + memcpy(line6pcm->wrap_out, + runtime->dma_area + + line6pcm->pos_out * bytes_per_frame, + len * bytes_per_frame); + memcpy(line6pcm->wrap_out + + len * bytes_per_frame, runtime->dma_area, + (urb_frames - len) * bytes_per_frame); + } else { + /* this is somewhat paranoid */ + dev_err(s2m(substream), + "driver bug: len = %d\n", len); + } } else { /* set the buffer pointer */ - urb_out->transfer_buffer = runtime->dma_area + line6pcm->pos_out * bytes_per_frame; + urb_out->transfer_buffer = + runtime->dma_area + + line6pcm->pos_out * bytes_per_frame; } } @@ -133,15 +147,19 @@ static int submit_audio_out_urb(struct snd_pcm_substream *substream) #if DO_DUMP_PCM_SEND for (i = 0; i < LINE6_ISO_PACKETS; ++i) { - struct usb_iso_packet_descriptor *fout = &urb_out->iso_frame_desc[i]; - line6_write_hexdump(line6pcm->line6, 'P', urb_out->transfer_buffer + fout->offset, fout->length); + struct usb_iso_packet_descriptor *fout = + &urb_out->iso_frame_desc[i]; + line6_write_hexdump(line6pcm->line6, 'P', + urb_out->transfer_buffer + fout->offset, + fout->length); } #endif if (usb_submit_urb(urb_out, GFP_ATOMIC) == 0) set_bit(index, &line6pcm->active_urb_out); else - dev_err(s2m(substream), "URB out #%d submission failed\n", index); + dev_err(s2m(substream), "URB out #%d submission failed\n", + index); spin_unlock_irqrestore(&line6pcm->lock_audio_out, flags); return 0; @@ -181,7 +199,7 @@ static void unlink_audio_out_urbs(struct snd_line6_pcm *line6pcm) } /* - Wait until unlinking of all currently active playback URBs has been finished. + Wait until unlinking of all currently active playback URBs has been finished. */ static void wait_clear_audio_out_urbs(struct snd_line6_pcm *line6pcm) { @@ -224,7 +242,8 @@ static void audio_out_callback(struct urb *urb) int i, index, length = 0, shutdown = 0; unsigned long flags; - struct snd_pcm_substream *substream = (struct snd_pcm_substream *)urb->context; + struct snd_pcm_substream *substream = + (struct snd_pcm_substream *)urb->context; struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime = substream->runtime; @@ -234,13 +253,14 @@ static void audio_out_callback(struct urb *urb) break; if (index < 0) - return; /* URB has been unlinked asynchronously */ + return; /* URB has been unlinked asynchronously */ for (i = LINE6_ISO_PACKETS; i--;) length += urb->iso_frame_desc[i].length; spin_lock_irqsave(&line6pcm->lock_audio_out, flags); - line6pcm->pos_out_done += length / line6pcm->properties->bytes_per_frame; + line6pcm->pos_out_done += + length / line6pcm->properties->bytes_per_frame; if (line6pcm->pos_out_done >= runtime->buffer_size) line6pcm->pos_out_done -= runtime->buffer_size; @@ -276,7 +296,8 @@ static int snd_line6_playback_open(struct snd_pcm_substream *substream) struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); err = snd_pcm_hw_constraint_ratdens(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, - (&line6pcm->properties->snd_line6_rates)); + (&line6pcm->properties-> + snd_line6_rates)); if (err < 0) return err; @@ -291,7 +312,8 @@ static int snd_line6_playback_close(struct snd_pcm_substream *substream) } /* hw_params playback callback */ -static int snd_line6_playback_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) +static int snd_line6_playback_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) { int ret; struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); @@ -349,7 +371,8 @@ int snd_line6_playback_trigger(struct snd_pcm_substream *substream, int cmd) err = submit_audio_out_all_urbs(substream); if (err < 0) { - clear_bit(BIT_RUNNING_PLAYBACK, &line6pcm->flags); + clear_bit(BIT_RUNNING_PLAYBACK, + &line6pcm->flags); return err; } } @@ -387,14 +410,14 @@ snd_line6_playback_pointer(struct snd_pcm_substream *substream) /* playback operators */ struct snd_pcm_ops snd_line6_playback_ops = { - .open = snd_line6_playback_open, - .close = snd_line6_playback_close, - .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_line6_playback_hw_params, - .hw_free = snd_line6_playback_hw_free, - .prepare = snd_line6_prepare, - .trigger = snd_line6_trigger, - .pointer = snd_line6_playback_pointer, + .open = snd_line6_playback_open, + .close = snd_line6_playback_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = snd_line6_playback_hw_params, + .hw_free = snd_line6_playback_hw_free, + .prepare = snd_line6_prepare, + .trigger = snd_line6_trigger, + .pointer = snd_line6_playback_pointer, }; int create_audio_out_urbs(struct snd_line6_pcm *line6pcm) @@ -406,7 +429,8 @@ int create_audio_out_urbs(struct snd_line6_pcm *line6pcm) struct urb *urb; /* URB for audio out: */ - urb = line6pcm->urb_audio_out[i] = usb_alloc_urb(LINE6_ISO_PACKETS, GFP_KERNEL); + urb = line6pcm->urb_audio_out[i] = + usb_alloc_urb(LINE6_ISO_PACKETS, GFP_KERNEL); if (urb == NULL) { dev_err(line6pcm->line6->ifcdev, "Out of memory\n"); @@ -414,7 +438,10 @@ int create_audio_out_urbs(struct snd_line6_pcm *line6pcm) } urb->dev = line6pcm->line6->usbdev; - urb->pipe = usb_sndisocpipe(line6pcm->line6->usbdev, line6pcm->ep_audio_write & USB_ENDPOINT_NUMBER_MASK); + urb->pipe = + usb_sndisocpipe(line6pcm->line6->usbdev, + line6pcm-> + ep_audio_write & USB_ENDPOINT_NUMBER_MASK); urb->transfer_flags = URB_ISO_ASAP; urb->start_frame = -1; urb->number_of_packets = LINE6_ISO_PACKETS; -- GitLab From 7f66fe58cea91d60870bb7e80ba777aa233f206d Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 15 Nov 2009 22:17:51 -0600 Subject: [PATCH 013/235] staging: line6: Fix checkpatch errors in playback.c Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/line6/playback.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/line6/playback.c b/drivers/staging/line6/playback.c index 4192cd9d96d5..3431f5cd2852 100644 --- a/drivers/staging/line6/playback.c +++ b/drivers/staging/line6/playback.c @@ -138,7 +138,8 @@ static int submit_audio_out_urb(struct snd_pcm_substream *substream) } } - if ((line6pcm->pos_out += urb_frames) >= runtime->buffer_size) + line6pcm->pos_out += urb_frames; + if (line6pcm->pos_out >= runtime->buffer_size) line6pcm->pos_out -= runtime->buffer_size; urb_out->transfer_buffer_length = urb_size; @@ -281,7 +282,8 @@ static void audio_out_callback(struct urb *urb) if (!shutdown) { submit_audio_out_urb(substream); - if ((line6pcm->bytes_out += length) >= line6pcm->period_out) { + line6pcm->bytes_out += length; + if (line6pcm->bytes_out >= line6pcm->period_out) { line6pcm->bytes_out -= line6pcm->period_out; snd_pcm_period_elapsed(substream); } -- GitLab From e0645d634666ec6c9970d0addb5982788e13e435 Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 15 Nov 2009 22:17:52 -0600 Subject: [PATCH 014/235] staging: line6: Lindent and fix checkpatch warnings in capture.c Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/line6/capture.c | 95 ++++++++++++++++++++++----------- 1 file changed, 63 insertions(+), 32 deletions(-) diff --git a/drivers/staging/line6/capture.c b/drivers/staging/line6/capture.c index ea2060b4919d..7009f395a237 100644 --- a/drivers/staging/line6/capture.c +++ b/drivers/staging/line6/capture.c @@ -20,7 +20,6 @@ #include "pod.h" #include "capture.h" - /* Find a free URB and submit it. */ @@ -33,7 +32,8 @@ static int submit_audio_in_urb(struct snd_pcm_substream *substream) struct urb *urb_in; spin_lock_irqsave(&line6pcm->lock_audio_in, flags); - index = find_first_zero_bit(&line6pcm->active_urb_in, LINE6_ISO_BUFFERS); + index = + find_first_zero_bit(&line6pcm->active_urb_in, LINE6_ISO_BUFFERS); if (index >= LINE6_ISO_BUFFERS) { spin_unlock_irqrestore(&line6pcm->lock_audio_in, flags); @@ -45,20 +45,24 @@ static int submit_audio_in_urb(struct snd_pcm_substream *substream) urb_size = 0; for (i = 0; i < LINE6_ISO_PACKETS; ++i) { - struct usb_iso_packet_descriptor *fin = &urb_in->iso_frame_desc[i]; + struct usb_iso_packet_descriptor *fin = + &urb_in->iso_frame_desc[i]; fin->offset = urb_size; fin->length = line6pcm->max_packet_size; urb_size += line6pcm->max_packet_size; } - urb_in->transfer_buffer = line6pcm->buffer_in + index * LINE6_ISO_PACKETS * line6pcm->max_packet_size; + urb_in->transfer_buffer = + line6pcm->buffer_in + + index * LINE6_ISO_PACKETS * line6pcm->max_packet_size; urb_in->transfer_buffer_length = urb_size; urb_in->context = substream; if (usb_submit_urb(urb_in, GFP_ATOMIC) == 0) set_bit(index, &line6pcm->active_urb_in); else - dev_err(s2m(substream), "URB in #%d submission failed\n", index); + dev_err(s2m(substream), "URB in #%d submission failed\n", + index); spin_unlock_irqrestore(&line6pcm->lock_audio_in, flags); return 0; @@ -143,7 +147,8 @@ static void audio_in_callback(struct urb *urb) int frames; unsigned long flags; - struct snd_pcm_substream *substream = (struct snd_pcm_substream *)urb->context; + struct snd_pcm_substream *substream = + (struct snd_pcm_substream *)urb->context; struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); const int bytes_per_frame = line6pcm->properties->bytes_per_frame; struct snd_pcm_runtime *runtime = substream->runtime; @@ -155,8 +160,11 @@ static void audio_in_callback(struct urb *urb) #if DO_DUMP_PCM_RECEIVE for (i = 0; i < LINE6_ISO_PACKETS; ++i) { - struct usb_iso_packet_descriptor *fout = &urb->iso_frame_desc[i]; - line6_write_hexdump(line6pcm->line6, 'C', urb->transfer_buffer + fout->offset, fout->length); + struct usb_iso_packet_descriptor *fout = + &urb->iso_frame_desc[i]; + line6_write_hexdump(line6pcm->line6, 'C', + urb->transfer_buffer + fout->offset, + fout->length); } #endif @@ -179,25 +187,40 @@ static void audio_in_callback(struct urb *urb) if (fsize > 0) { frames = fsize / bytes_per_frame; - if (line6pcm->pos_in_done + frames > runtime->buffer_size) { + if (line6pcm->pos_in_done + frames > + runtime->buffer_size) { /* - The transferred area goes over buffer boundary, - copy two separate chunks. - */ + The transferred area goes over buffer + boundary, copy two separate chunks. + */ int len; - len = runtime->buffer_size - line6pcm->pos_in_done; + len = + runtime->buffer_size - + line6pcm->pos_in_done; if (len > 0) { - memcpy(runtime->dma_area + line6pcm->pos_in_done * bytes_per_frame, fbuf, len * bytes_per_frame); - memcpy(runtime->dma_area, fbuf + len * bytes_per_frame, (frames - len) * bytes_per_frame); - } else - dev_err(s2m(substream), "driver bug: len = %d\n", len); /* this is somewhat paranoid */ + memcpy(runtime->dma_area + + line6pcm->pos_in_done * + bytes_per_frame, fbuf, + len * bytes_per_frame); + memcpy(runtime->dma_area, + fbuf + len * bytes_per_frame, + (frames - + len) * bytes_per_frame); + } else { + /* this is somewhat paranoid */ + dev_err(s2m(substream), + "driver bug: len = %d\n", len); + } } else { /* copy single chunk */ - memcpy(runtime->dma_area + line6pcm->pos_in_done * bytes_per_frame, fbuf, fsize * bytes_per_frame); + memcpy(runtime->dma_area + + line6pcm->pos_in_done * bytes_per_frame, + fbuf, fsize * bytes_per_frame); } - if ((line6pcm->pos_in_done += frames) >= runtime->buffer_size) + if ((line6pcm->pos_in_done += + frames) >= runtime->buffer_size) line6pcm->pos_in_done -= runtime->buffer_size; } } @@ -228,7 +251,8 @@ static int snd_line6_capture_open(struct snd_pcm_substream *substream) err = snd_pcm_hw_constraint_ratdens(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, - (&line6pcm->properties->snd_line6_rates)); + (&line6pcm->properties-> + snd_line6_rates)); if (err < 0) return err; @@ -267,7 +291,9 @@ static int snd_line6_capture_hw_params(struct snd_pcm_substream *substream, return ret; line6pcm->period_in = params_period_bytes(hw_params); - line6pcm->buffer_in = kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS * LINE6_ISO_PACKET_SIZE_MAX, GFP_KERNEL); + line6pcm->buffer_in = + kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS * + LINE6_ISO_PACKET_SIZE_MAX, GFP_KERNEL); if (!line6pcm->buffer_in) { dev_err(s2m(substream), "cannot malloc buffer_in\n"); @@ -302,7 +328,8 @@ int snd_line6_capture_trigger(struct snd_pcm_substream *substream, int cmd) err = submit_audio_in_all_urbs(substream); if (err < 0) { - clear_bit(BIT_RUNNING_CAPTURE, &line6pcm->flags); + clear_bit(BIT_RUNNING_CAPTURE, + &line6pcm->flags); return err; } } @@ -332,14 +359,14 @@ snd_line6_capture_pointer(struct snd_pcm_substream *substream) /* capture operators */ struct snd_pcm_ops snd_line6_capture_ops = { - .open = snd_line6_capture_open, - .close = snd_line6_capture_close, - .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_line6_capture_hw_params, - .hw_free = snd_line6_capture_hw_free, - .prepare = snd_line6_prepare, - .trigger = snd_line6_trigger, - .pointer = snd_line6_capture_pointer, + .open = snd_line6_capture_open, + .close = snd_line6_capture_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = snd_line6_capture_hw_params, + .hw_free = snd_line6_capture_hw_free, + .prepare = snd_line6_prepare, + .trigger = snd_line6_trigger, + .pointer = snd_line6_capture_pointer, }; int create_audio_in_urbs(struct snd_line6_pcm *line6pcm) @@ -351,7 +378,8 @@ int create_audio_in_urbs(struct snd_line6_pcm *line6pcm) struct urb *urb; /* URB for audio in: */ - urb = line6pcm->urb_audio_in[i] = usb_alloc_urb(LINE6_ISO_PACKETS, GFP_KERNEL); + urb = line6pcm->urb_audio_in[i] = + usb_alloc_urb(LINE6_ISO_PACKETS, GFP_KERNEL); if (urb == NULL) { dev_err(line6pcm->line6->ifcdev, "Out of memory\n"); @@ -359,7 +387,10 @@ int create_audio_in_urbs(struct snd_line6_pcm *line6pcm) } urb->dev = line6pcm->line6->usbdev; - urb->pipe = usb_rcvisocpipe(line6pcm->line6->usbdev, line6pcm->ep_audio_read & USB_ENDPOINT_NUMBER_MASK); + urb->pipe = + usb_rcvisocpipe(line6pcm->line6->usbdev, + line6pcm-> + ep_audio_read & USB_ENDPOINT_NUMBER_MASK); urb->transfer_flags = URB_ISO_ASAP; urb->start_frame = -1; urb->number_of_packets = LINE6_ISO_PACKETS; -- GitLab From df30c0f0730647f428e54bd0305246292a5cdcb2 Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 15 Nov 2009 22:17:53 -0600 Subject: [PATCH 015/235] staging: line6: Fix checkpatch errors in capture.c Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/line6/capture.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/line6/capture.c b/drivers/staging/line6/capture.c index 7009f395a237..fd4890de8dbc 100644 --- a/drivers/staging/line6/capture.c +++ b/drivers/staging/line6/capture.c @@ -219,8 +219,8 @@ static void audio_in_callback(struct urb *urb) fbuf, fsize * bytes_per_frame); } - if ((line6pcm->pos_in_done += - frames) >= runtime->buffer_size) + line6pcm->pos_in_done += frames; + if (line6pcm->pos_in_done >= runtime->buffer_size) line6pcm->pos_in_done -= runtime->buffer_size; } } @@ -235,7 +235,8 @@ static void audio_in_callback(struct urb *urb) if (!shutdown) { submit_audio_in_urb(substream); - if ((line6pcm->bytes_in += length) >= line6pcm->period_in) { + line6pcm->bytes_in += length; + if (line6pcm->bytes_in >= line6pcm->period_in) { line6pcm->bytes_in -= line6pcm->period_in; snd_pcm_period_elapsed(substream); } -- GitLab From acdc102181212481f94d0483f5a7a7f9f6cbafd3 Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 15 Nov 2009 22:17:54 -0600 Subject: [PATCH 016/235] staging: line6: Lindent control.c Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/line6/control.c | 471 +++++++++++++++++++++----------- 1 file changed, 314 insertions(+), 157 deletions(-) diff --git a/drivers/staging/line6/control.c b/drivers/staging/line6/control.c index 23ad08e17f84..cfc6543311f3 100644 --- a/drivers/staging/line6/control.c +++ b/drivers/staging/line6/control.c @@ -41,7 +41,6 @@ static ssize_t prefix ## _set_ ## param(struct device *dev, \ #define VARIAX_PARAM_R(type, param) LINE6_PARAM_R(VARIAX, variax, type, param) #define VARIAX_PARAM_RW(type, param) LINE6_PARAM_RW(VARIAX, variax, type, param) - static ssize_t pod_get_param_int(struct device *dev, char *buf, int param) { struct usb_interface *interface = to_usb_interface(dev); @@ -52,7 +51,8 @@ static ssize_t pod_get_param_int(struct device *dev, char *buf, int param) return sprintf(buf, "%d\n", pod->prog_data.control[param]); } -static ssize_t pod_set_param_int(struct device *dev, const char *buf, size_t count, int param) +static ssize_t pod_set_param_int(struct device *dev, const char *buf, + size_t count, int param) { struct usb_interface *interface = to_usb_interface(dev); struct usb_line6_pod *pod = usb_get_intfdata(interface); @@ -74,13 +74,13 @@ static ssize_t variax_get_param_int(struct device *dev, char *buf, int param) static ssize_t variax_get_param_float(struct device *dev, char *buf, int param) { /* - We do our own floating point handling here since floats in the - kernel are problematic for at least two reasons: - many distros - are still shipped with binary kernels optimized for the ancient - 80386 without FPU - - there isn't a printf("%f") - (see http://www.kernelthread.com/publications/faq/335.html) - */ + We do our own floating point handling here since floats in the + kernel are problematic for at least two reasons: - many distros + are still shipped with binary kernels optimized for the ancient + 80386 without FPU + - there isn't a printf("%f") + (see http://www.kernelthread.com/publications/faq/335.html) + */ static const int BIAS = 0x7f; static const int OFFSET = 0xf; @@ -110,10 +110,13 @@ static ssize_t variax_get_param_float(struct device *dev, char *buf, int param) part_frac = (mantissa << (32 + exponent)) & 0xffffffff; } - part_frac = (part_frac / ((1UL << 31) / (PRECISION / 2 * 10)) + 5) / 10; + part_frac = + (part_frac / ((1UL << 31) / (PRECISION / 2 * 10)) + 5) / 10; } - len += sprintf(buf + len, "%s%d.%03d\n", ((p[0] & 0x80) ? "-" : ""), part_int, part_frac); + len += + sprintf(buf + len, "%s%d.%03d\n", ((p[0] & 0x80) ? "-" : ""), + part_int, part_frac); return len; } @@ -260,127 +263,246 @@ VARIAX_PARAM_R(float, mix1); VARIAX_PARAM_R(int, pickup_wiring); static DEVICE_ATTR(tweak, S_IWUGO | S_IRUGO, pod_get_tweak, pod_set_tweak); -static DEVICE_ATTR(wah_position, S_IWUGO | S_IRUGO, pod_get_wah_position, pod_set_wah_position); -static DEVICE_ATTR(compression_gain, S_IWUGO | S_IRUGO, pod_get_compression_gain, pod_set_compression_gain); -static DEVICE_ATTR(vol_pedal_position, S_IWUGO | S_IRUGO, pod_get_vol_pedal_position, pod_set_vol_pedal_position); -static DEVICE_ATTR(compression_threshold, S_IWUGO | S_IRUGO, pod_get_compression_threshold, pod_set_compression_threshold); +static DEVICE_ATTR(wah_position, S_IWUGO | S_IRUGO, pod_get_wah_position, + pod_set_wah_position); +static DEVICE_ATTR(compression_gain, S_IWUGO | S_IRUGO, + pod_get_compression_gain, pod_set_compression_gain); +static DEVICE_ATTR(vol_pedal_position, S_IWUGO | S_IRUGO, + pod_get_vol_pedal_position, pod_set_vol_pedal_position); +static DEVICE_ATTR(compression_threshold, S_IWUGO | S_IRUGO, + pod_get_compression_threshold, + pod_set_compression_threshold); static DEVICE_ATTR(pan, S_IWUGO | S_IRUGO, pod_get_pan, pod_set_pan); -static DEVICE_ATTR(amp_model_setup, S_IWUGO | S_IRUGO, pod_get_amp_model_setup, pod_set_amp_model_setup); -static DEVICE_ATTR(amp_model, S_IWUGO | S_IRUGO, pod_get_amp_model, pod_set_amp_model); +static DEVICE_ATTR(amp_model_setup, S_IWUGO | S_IRUGO, pod_get_amp_model_setup, + pod_set_amp_model_setup); +static DEVICE_ATTR(amp_model, S_IWUGO | S_IRUGO, pod_get_amp_model, + pod_set_amp_model); static DEVICE_ATTR(drive, S_IWUGO | S_IRUGO, pod_get_drive, pod_set_drive); static DEVICE_ATTR(bass, S_IWUGO | S_IRUGO, pod_get_bass, pod_set_bass); static DEVICE_ATTR(mid, S_IWUGO | S_IRUGO, pod_get_mid, pod_set_mid); static DEVICE_ATTR(lowmid, S_IWUGO | S_IRUGO, pod_get_lowmid, pod_set_lowmid); static DEVICE_ATTR(treble, S_IWUGO | S_IRUGO, pod_get_treble, pod_set_treble); -static DEVICE_ATTR(highmid, S_IWUGO | S_IRUGO, pod_get_highmid, pod_set_highmid); -static DEVICE_ATTR(chan_vol, S_IWUGO | S_IRUGO, pod_get_chan_vol, pod_set_chan_vol); -static DEVICE_ATTR(reverb_mix, S_IWUGO | S_IRUGO, pod_get_reverb_mix, pod_set_reverb_mix); -static DEVICE_ATTR(effect_setup, S_IWUGO | S_IRUGO, pod_get_effect_setup, pod_set_effect_setup); -static DEVICE_ATTR(band_1_frequency, S_IWUGO | S_IRUGO, pod_get_band_1_frequency, pod_set_band_1_frequency); -static DEVICE_ATTR(presence, S_IWUGO | S_IRUGO, pod_get_presence, pod_set_presence); -static DEVICE_ATTR2(treble__bass, treble, S_IWUGO | S_IRUGO, pod_get_treble__bass, pod_set_treble__bass); -static DEVICE_ATTR(noise_gate_enable, S_IWUGO | S_IRUGO, pod_get_noise_gate_enable, pod_set_noise_gate_enable); -static DEVICE_ATTR(gate_threshold, S_IWUGO | S_IRUGO, pod_get_gate_threshold, pod_set_gate_threshold); -static DEVICE_ATTR(gate_decay_time, S_IWUGO | S_IRUGO, pod_get_gate_decay_time, pod_set_gate_decay_time); -static DEVICE_ATTR(stomp_enable, S_IWUGO | S_IRUGO, pod_get_stomp_enable, pod_set_stomp_enable); -static DEVICE_ATTR(comp_enable, S_IWUGO | S_IRUGO, pod_get_comp_enable, pod_set_comp_enable); -static DEVICE_ATTR(stomp_time, S_IWUGO | S_IRUGO, pod_get_stomp_time, pod_set_stomp_time); -static DEVICE_ATTR(delay_enable, S_IWUGO | S_IRUGO, pod_get_delay_enable, pod_set_delay_enable); -static DEVICE_ATTR(mod_param_1, S_IWUGO | S_IRUGO, pod_get_mod_param_1, pod_set_mod_param_1); -static DEVICE_ATTR(delay_param_1, S_IWUGO | S_IRUGO, pod_get_delay_param_1, pod_set_delay_param_1); -static DEVICE_ATTR(delay_param_1_note_value, S_IWUGO | S_IRUGO, pod_get_delay_param_1_note_value, pod_set_delay_param_1_note_value); -static DEVICE_ATTR2(band_2_frequency__bass, band_2_frequency, S_IWUGO | S_IRUGO, pod_get_band_2_frequency__bass, pod_set_band_2_frequency__bass); -static DEVICE_ATTR(delay_param_2, S_IWUGO | S_IRUGO, pod_get_delay_param_2, pod_set_delay_param_2); -static DEVICE_ATTR(delay_volume_mix, S_IWUGO | S_IRUGO, pod_get_delay_volume_mix, pod_set_delay_volume_mix); -static DEVICE_ATTR(delay_param_3, S_IWUGO | S_IRUGO, pod_get_delay_param_3, pod_set_delay_param_3); -static DEVICE_ATTR(reverb_enable, S_IWUGO | S_IRUGO, pod_get_reverb_enable, pod_set_reverb_enable); -static DEVICE_ATTR(reverb_type, S_IWUGO | S_IRUGO, pod_get_reverb_type, pod_set_reverb_type); -static DEVICE_ATTR(reverb_decay, S_IWUGO | S_IRUGO, pod_get_reverb_decay, pod_set_reverb_decay); -static DEVICE_ATTR(reverb_tone, S_IWUGO | S_IRUGO, pod_get_reverb_tone, pod_set_reverb_tone); -static DEVICE_ATTR(reverb_pre_delay, S_IWUGO | S_IRUGO, pod_get_reverb_pre_delay, pod_set_reverb_pre_delay); -static DEVICE_ATTR(reverb_pre_post, S_IWUGO | S_IRUGO, pod_get_reverb_pre_post, pod_set_reverb_pre_post); -static DEVICE_ATTR(band_2_frequency, S_IWUGO | S_IRUGO, pod_get_band_2_frequency, pod_set_band_2_frequency); -static DEVICE_ATTR2(band_3_frequency__bass, band_3_frequency, S_IWUGO | S_IRUGO, pod_get_band_3_frequency__bass, pod_set_band_3_frequency__bass); -static DEVICE_ATTR(wah_enable, S_IWUGO | S_IRUGO, pod_get_wah_enable, pod_set_wah_enable); -static DEVICE_ATTR(modulation_lo_cut, S_IWUGO | S_IRUGO, pod_get_modulation_lo_cut, pod_set_modulation_lo_cut); -static DEVICE_ATTR(delay_reverb_lo_cut, S_IWUGO | S_IRUGO, pod_get_delay_reverb_lo_cut, pod_set_delay_reverb_lo_cut); -static DEVICE_ATTR(volume_pedal_minimum, S_IWUGO | S_IRUGO, pod_get_volume_pedal_minimum, pod_set_volume_pedal_minimum); -static DEVICE_ATTR(eq_pre_post, S_IWUGO | S_IRUGO, pod_get_eq_pre_post, pod_set_eq_pre_post); -static DEVICE_ATTR(volume_pre_post, S_IWUGO | S_IRUGO, pod_get_volume_pre_post, pod_set_volume_pre_post); -static DEVICE_ATTR(di_model, S_IWUGO | S_IRUGO, pod_get_di_model, pod_set_di_model); -static DEVICE_ATTR(di_delay, S_IWUGO | S_IRUGO, pod_get_di_delay, pod_set_di_delay); -static DEVICE_ATTR(mod_enable, S_IWUGO | S_IRUGO, pod_get_mod_enable, pod_set_mod_enable); -static DEVICE_ATTR(mod_param_1_note_value, S_IWUGO | S_IRUGO, pod_get_mod_param_1_note_value, pod_set_mod_param_1_note_value); -static DEVICE_ATTR(mod_param_2, S_IWUGO | S_IRUGO, pod_get_mod_param_2, pod_set_mod_param_2); -static DEVICE_ATTR(mod_param_3, S_IWUGO | S_IRUGO, pod_get_mod_param_3, pod_set_mod_param_3); -static DEVICE_ATTR(mod_param_4, S_IWUGO | S_IRUGO, pod_get_mod_param_4, pod_set_mod_param_4); -static DEVICE_ATTR(mod_param_5, S_IWUGO | S_IRUGO, pod_get_mod_param_5, pod_set_mod_param_5); -static DEVICE_ATTR(mod_volume_mix, S_IWUGO | S_IRUGO, pod_get_mod_volume_mix, pod_set_mod_volume_mix); -static DEVICE_ATTR(mod_pre_post, S_IWUGO | S_IRUGO, pod_get_mod_pre_post, pod_set_mod_pre_post); -static DEVICE_ATTR(modulation_model, S_IWUGO | S_IRUGO, pod_get_modulation_model, pod_set_modulation_model); -static DEVICE_ATTR(band_3_frequency, S_IWUGO | S_IRUGO, pod_get_band_3_frequency, pod_set_band_3_frequency); -static DEVICE_ATTR2(band_4_frequency__bass, band_4_frequency, S_IWUGO | S_IRUGO, pod_get_band_4_frequency__bass, pod_set_band_4_frequency__bass); -static DEVICE_ATTR(mod_param_1_double_precision, S_IWUGO | S_IRUGO, pod_get_mod_param_1_double_precision, pod_set_mod_param_1_double_precision); -static DEVICE_ATTR(delay_param_1_double_precision, S_IWUGO | S_IRUGO, pod_get_delay_param_1_double_precision, pod_set_delay_param_1_double_precision); -static DEVICE_ATTR(eq_enable, S_IWUGO | S_IRUGO, pod_get_eq_enable, pod_set_eq_enable); +static DEVICE_ATTR(highmid, S_IWUGO | S_IRUGO, pod_get_highmid, + pod_set_highmid); +static DEVICE_ATTR(chan_vol, S_IWUGO | S_IRUGO, pod_get_chan_vol, + pod_set_chan_vol); +static DEVICE_ATTR(reverb_mix, S_IWUGO | S_IRUGO, pod_get_reverb_mix, + pod_set_reverb_mix); +static DEVICE_ATTR(effect_setup, S_IWUGO | S_IRUGO, pod_get_effect_setup, + pod_set_effect_setup); +static DEVICE_ATTR(band_1_frequency, S_IWUGO | S_IRUGO, + pod_get_band_1_frequency, pod_set_band_1_frequency); +static DEVICE_ATTR(presence, S_IWUGO | S_IRUGO, pod_get_presence, + pod_set_presence); +static DEVICE_ATTR2(treble__bass, treble, S_IWUGO | S_IRUGO, + pod_get_treble__bass, pod_set_treble__bass); +static DEVICE_ATTR(noise_gate_enable, S_IWUGO | S_IRUGO, + pod_get_noise_gate_enable, pod_set_noise_gate_enable); +static DEVICE_ATTR(gate_threshold, S_IWUGO | S_IRUGO, pod_get_gate_threshold, + pod_set_gate_threshold); +static DEVICE_ATTR(gate_decay_time, S_IWUGO | S_IRUGO, pod_get_gate_decay_time, + pod_set_gate_decay_time); +static DEVICE_ATTR(stomp_enable, S_IWUGO | S_IRUGO, pod_get_stomp_enable, + pod_set_stomp_enable); +static DEVICE_ATTR(comp_enable, S_IWUGO | S_IRUGO, pod_get_comp_enable, + pod_set_comp_enable); +static DEVICE_ATTR(stomp_time, S_IWUGO | S_IRUGO, pod_get_stomp_time, + pod_set_stomp_time); +static DEVICE_ATTR(delay_enable, S_IWUGO | S_IRUGO, pod_get_delay_enable, + pod_set_delay_enable); +static DEVICE_ATTR(mod_param_1, S_IWUGO | S_IRUGO, pod_get_mod_param_1, + pod_set_mod_param_1); +static DEVICE_ATTR(delay_param_1, S_IWUGO | S_IRUGO, pod_get_delay_param_1, + pod_set_delay_param_1); +static DEVICE_ATTR(delay_param_1_note_value, S_IWUGO | S_IRUGO, + pod_get_delay_param_1_note_value, + pod_set_delay_param_1_note_value); +static DEVICE_ATTR2(band_2_frequency__bass, band_2_frequency, S_IWUGO | S_IRUGO, + pod_get_band_2_frequency__bass, + pod_set_band_2_frequency__bass); +static DEVICE_ATTR(delay_param_2, S_IWUGO | S_IRUGO, pod_get_delay_param_2, + pod_set_delay_param_2); +static DEVICE_ATTR(delay_volume_mix, S_IWUGO | S_IRUGO, + pod_get_delay_volume_mix, pod_set_delay_volume_mix); +static DEVICE_ATTR(delay_param_3, S_IWUGO | S_IRUGO, pod_get_delay_param_3, + pod_set_delay_param_3); +static DEVICE_ATTR(reverb_enable, S_IWUGO | S_IRUGO, pod_get_reverb_enable, + pod_set_reverb_enable); +static DEVICE_ATTR(reverb_type, S_IWUGO | S_IRUGO, pod_get_reverb_type, + pod_set_reverb_type); +static DEVICE_ATTR(reverb_decay, S_IWUGO | S_IRUGO, pod_get_reverb_decay, + pod_set_reverb_decay); +static DEVICE_ATTR(reverb_tone, S_IWUGO | S_IRUGO, pod_get_reverb_tone, + pod_set_reverb_tone); +static DEVICE_ATTR(reverb_pre_delay, S_IWUGO | S_IRUGO, + pod_get_reverb_pre_delay, pod_set_reverb_pre_delay); +static DEVICE_ATTR(reverb_pre_post, S_IWUGO | S_IRUGO, pod_get_reverb_pre_post, + pod_set_reverb_pre_post); +static DEVICE_ATTR(band_2_frequency, S_IWUGO | S_IRUGO, + pod_get_band_2_frequency, pod_set_band_2_frequency); +static DEVICE_ATTR2(band_3_frequency__bass, band_3_frequency, S_IWUGO | S_IRUGO, + pod_get_band_3_frequency__bass, + pod_set_band_3_frequency__bass); +static DEVICE_ATTR(wah_enable, S_IWUGO | S_IRUGO, pod_get_wah_enable, + pod_set_wah_enable); +static DEVICE_ATTR(modulation_lo_cut, S_IWUGO | S_IRUGO, + pod_get_modulation_lo_cut, pod_set_modulation_lo_cut); +static DEVICE_ATTR(delay_reverb_lo_cut, S_IWUGO | S_IRUGO, + pod_get_delay_reverb_lo_cut, pod_set_delay_reverb_lo_cut); +static DEVICE_ATTR(volume_pedal_minimum, S_IWUGO | S_IRUGO, + pod_get_volume_pedal_minimum, pod_set_volume_pedal_minimum); +static DEVICE_ATTR(eq_pre_post, S_IWUGO | S_IRUGO, pod_get_eq_pre_post, + pod_set_eq_pre_post); +static DEVICE_ATTR(volume_pre_post, S_IWUGO | S_IRUGO, pod_get_volume_pre_post, + pod_set_volume_pre_post); +static DEVICE_ATTR(di_model, S_IWUGO | S_IRUGO, pod_get_di_model, + pod_set_di_model); +static DEVICE_ATTR(di_delay, S_IWUGO | S_IRUGO, pod_get_di_delay, + pod_set_di_delay); +static DEVICE_ATTR(mod_enable, S_IWUGO | S_IRUGO, pod_get_mod_enable, + pod_set_mod_enable); +static DEVICE_ATTR(mod_param_1_note_value, S_IWUGO | S_IRUGO, + pod_get_mod_param_1_note_value, + pod_set_mod_param_1_note_value); +static DEVICE_ATTR(mod_param_2, S_IWUGO | S_IRUGO, pod_get_mod_param_2, + pod_set_mod_param_2); +static DEVICE_ATTR(mod_param_3, S_IWUGO | S_IRUGO, pod_get_mod_param_3, + pod_set_mod_param_3); +static DEVICE_ATTR(mod_param_4, S_IWUGO | S_IRUGO, pod_get_mod_param_4, + pod_set_mod_param_4); +static DEVICE_ATTR(mod_param_5, S_IWUGO | S_IRUGO, pod_get_mod_param_5, + pod_set_mod_param_5); +static DEVICE_ATTR(mod_volume_mix, S_IWUGO | S_IRUGO, pod_get_mod_volume_mix, + pod_set_mod_volume_mix); +static DEVICE_ATTR(mod_pre_post, S_IWUGO | S_IRUGO, pod_get_mod_pre_post, + pod_set_mod_pre_post); +static DEVICE_ATTR(modulation_model, S_IWUGO | S_IRUGO, + pod_get_modulation_model, pod_set_modulation_model); +static DEVICE_ATTR(band_3_frequency, S_IWUGO | S_IRUGO, + pod_get_band_3_frequency, pod_set_band_3_frequency); +static DEVICE_ATTR2(band_4_frequency__bass, band_4_frequency, S_IWUGO | S_IRUGO, + pod_get_band_4_frequency__bass, + pod_set_band_4_frequency__bass); +static DEVICE_ATTR(mod_param_1_double_precision, S_IWUGO | S_IRUGO, + pod_get_mod_param_1_double_precision, + pod_set_mod_param_1_double_precision); +static DEVICE_ATTR(delay_param_1_double_precision, S_IWUGO | S_IRUGO, + pod_get_delay_param_1_double_precision, + pod_set_delay_param_1_double_precision); +static DEVICE_ATTR(eq_enable, S_IWUGO | S_IRUGO, pod_get_eq_enable, + pod_set_eq_enable); static DEVICE_ATTR(tap, S_IWUGO | S_IRUGO, pod_get_tap, pod_set_tap); -static DEVICE_ATTR(volume_tweak_pedal_assign, S_IWUGO | S_IRUGO, pod_get_volume_tweak_pedal_assign, pod_set_volume_tweak_pedal_assign); -static DEVICE_ATTR(band_5_frequency, S_IWUGO | S_IRUGO, pod_get_band_5_frequency, pod_set_band_5_frequency); +static DEVICE_ATTR(volume_tweak_pedal_assign, S_IWUGO | S_IRUGO, + pod_get_volume_tweak_pedal_assign, + pod_set_volume_tweak_pedal_assign); +static DEVICE_ATTR(band_5_frequency, S_IWUGO | S_IRUGO, + pod_get_band_5_frequency, pod_set_band_5_frequency); static DEVICE_ATTR(tuner, S_IWUGO | S_IRUGO, pod_get_tuner, pod_set_tuner); -static DEVICE_ATTR(mic_selection, S_IWUGO | S_IRUGO, pod_get_mic_selection, pod_set_mic_selection); -static DEVICE_ATTR(cabinet_model, S_IWUGO | S_IRUGO, pod_get_cabinet_model, pod_set_cabinet_model); -static DEVICE_ATTR(stomp_model, S_IWUGO | S_IRUGO, pod_get_stomp_model, pod_set_stomp_model); -static DEVICE_ATTR(roomlevel, S_IWUGO | S_IRUGO, pod_get_roomlevel, pod_set_roomlevel); -static DEVICE_ATTR(band_4_frequency, S_IWUGO | S_IRUGO, pod_get_band_4_frequency, pod_set_band_4_frequency); -static DEVICE_ATTR(band_6_frequency, S_IWUGO | S_IRUGO, pod_get_band_6_frequency, pod_set_band_6_frequency); -static DEVICE_ATTR(stomp_param_1_note_value, S_IWUGO | S_IRUGO, pod_get_stomp_param_1_note_value, pod_set_stomp_param_1_note_value); -static DEVICE_ATTR(stomp_param_2, S_IWUGO | S_IRUGO, pod_get_stomp_param_2, pod_set_stomp_param_2); -static DEVICE_ATTR(stomp_param_3, S_IWUGO | S_IRUGO, pod_get_stomp_param_3, pod_set_stomp_param_3); -static DEVICE_ATTR(stomp_param_4, S_IWUGO | S_IRUGO, pod_get_stomp_param_4, pod_set_stomp_param_4); -static DEVICE_ATTR(stomp_param_5, S_IWUGO | S_IRUGO, pod_get_stomp_param_5, pod_set_stomp_param_5); -static DEVICE_ATTR(stomp_param_6, S_IWUGO | S_IRUGO, pod_get_stomp_param_6, pod_set_stomp_param_6); -static DEVICE_ATTR(amp_switch_select, S_IWUGO | S_IRUGO, pod_get_amp_switch_select, pod_set_amp_switch_select); -static DEVICE_ATTR(delay_param_4, S_IWUGO | S_IRUGO, pod_get_delay_param_4, pod_set_delay_param_4); -static DEVICE_ATTR(delay_param_5, S_IWUGO | S_IRUGO, pod_get_delay_param_5, pod_set_delay_param_5); -static DEVICE_ATTR(delay_pre_post, S_IWUGO | S_IRUGO, pod_get_delay_pre_post, pod_set_delay_pre_post); -static DEVICE_ATTR(delay_model, S_IWUGO | S_IRUGO, pod_get_delay_model, pod_set_delay_model); -static DEVICE_ATTR(delay_verb_model, S_IWUGO | S_IRUGO, pod_get_delay_verb_model, pod_set_delay_verb_model); -static DEVICE_ATTR(tempo_msb, S_IWUGO | S_IRUGO, pod_get_tempo_msb, pod_set_tempo_msb); -static DEVICE_ATTR(tempo_lsb, S_IWUGO | S_IRUGO, pod_get_tempo_lsb, pod_set_tempo_lsb); -static DEVICE_ATTR(wah_model, S_IWUGO | S_IRUGO, pod_get_wah_model, pod_set_wah_model); -static DEVICE_ATTR(bypass_volume, S_IWUGO | S_IRUGO, pod_get_bypass_volume, pod_set_bypass_volume); -static DEVICE_ATTR(fx_loop_on_off, S_IWUGO | S_IRUGO, pod_get_fx_loop_on_off, pod_set_fx_loop_on_off); -static DEVICE_ATTR(tweak_param_select, S_IWUGO | S_IRUGO, pod_get_tweak_param_select, pod_set_tweak_param_select); -static DEVICE_ATTR(amp1_engage, S_IWUGO | S_IRUGO, pod_get_amp1_engage, pod_set_amp1_engage); -static DEVICE_ATTR(band_1_gain, S_IWUGO | S_IRUGO, pod_get_band_1_gain, pod_set_band_1_gain); -static DEVICE_ATTR2(band_2_gain__bass, band_2_gain, S_IWUGO | S_IRUGO, pod_get_band_2_gain__bass, pod_set_band_2_gain__bass); -static DEVICE_ATTR(band_2_gain, S_IWUGO | S_IRUGO, pod_get_band_2_gain, pod_set_band_2_gain); -static DEVICE_ATTR2(band_3_gain__bass, band_3_gain, S_IWUGO | S_IRUGO, pod_get_band_3_gain__bass, pod_set_band_3_gain__bass); -static DEVICE_ATTR(band_3_gain, S_IWUGO | S_IRUGO, pod_get_band_3_gain, pod_set_band_3_gain); -static DEVICE_ATTR2(band_4_gain__bass, band_4_gain, S_IWUGO | S_IRUGO, pod_get_band_4_gain__bass, pod_set_band_4_gain__bass); -static DEVICE_ATTR2(band_5_gain__bass, band_5_gain, S_IWUGO | S_IRUGO, pod_get_band_5_gain__bass, pod_set_band_5_gain__bass); -static DEVICE_ATTR(band_4_gain, S_IWUGO | S_IRUGO, pod_get_band_4_gain, pod_set_band_4_gain); -static DEVICE_ATTR2(band_6_gain__bass, band_6_gain, S_IWUGO | S_IRUGO, pod_get_band_6_gain__bass, pod_set_band_6_gain__bass); +static DEVICE_ATTR(mic_selection, S_IWUGO | S_IRUGO, pod_get_mic_selection, + pod_set_mic_selection); +static DEVICE_ATTR(cabinet_model, S_IWUGO | S_IRUGO, pod_get_cabinet_model, + pod_set_cabinet_model); +static DEVICE_ATTR(stomp_model, S_IWUGO | S_IRUGO, pod_get_stomp_model, + pod_set_stomp_model); +static DEVICE_ATTR(roomlevel, S_IWUGO | S_IRUGO, pod_get_roomlevel, + pod_set_roomlevel); +static DEVICE_ATTR(band_4_frequency, S_IWUGO | S_IRUGO, + pod_get_band_4_frequency, pod_set_band_4_frequency); +static DEVICE_ATTR(band_6_frequency, S_IWUGO | S_IRUGO, + pod_get_band_6_frequency, pod_set_band_6_frequency); +static DEVICE_ATTR(stomp_param_1_note_value, S_IWUGO | S_IRUGO, + pod_get_stomp_param_1_note_value, + pod_set_stomp_param_1_note_value); +static DEVICE_ATTR(stomp_param_2, S_IWUGO | S_IRUGO, pod_get_stomp_param_2, + pod_set_stomp_param_2); +static DEVICE_ATTR(stomp_param_3, S_IWUGO | S_IRUGO, pod_get_stomp_param_3, + pod_set_stomp_param_3); +static DEVICE_ATTR(stomp_param_4, S_IWUGO | S_IRUGO, pod_get_stomp_param_4, + pod_set_stomp_param_4); +static DEVICE_ATTR(stomp_param_5, S_IWUGO | S_IRUGO, pod_get_stomp_param_5, + pod_set_stomp_param_5); +static DEVICE_ATTR(stomp_param_6, S_IWUGO | S_IRUGO, pod_get_stomp_param_6, + pod_set_stomp_param_6); +static DEVICE_ATTR(amp_switch_select, S_IWUGO | S_IRUGO, + pod_get_amp_switch_select, pod_set_amp_switch_select); +static DEVICE_ATTR(delay_param_4, S_IWUGO | S_IRUGO, pod_get_delay_param_4, + pod_set_delay_param_4); +static DEVICE_ATTR(delay_param_5, S_IWUGO | S_IRUGO, pod_get_delay_param_5, + pod_set_delay_param_5); +static DEVICE_ATTR(delay_pre_post, S_IWUGO | S_IRUGO, pod_get_delay_pre_post, + pod_set_delay_pre_post); +static DEVICE_ATTR(delay_model, S_IWUGO | S_IRUGO, pod_get_delay_model, + pod_set_delay_model); +static DEVICE_ATTR(delay_verb_model, S_IWUGO | S_IRUGO, + pod_get_delay_verb_model, pod_set_delay_verb_model); +static DEVICE_ATTR(tempo_msb, S_IWUGO | S_IRUGO, pod_get_tempo_msb, + pod_set_tempo_msb); +static DEVICE_ATTR(tempo_lsb, S_IWUGO | S_IRUGO, pod_get_tempo_lsb, + pod_set_tempo_lsb); +static DEVICE_ATTR(wah_model, S_IWUGO | S_IRUGO, pod_get_wah_model, + pod_set_wah_model); +static DEVICE_ATTR(bypass_volume, S_IWUGO | S_IRUGO, pod_get_bypass_volume, + pod_set_bypass_volume); +static DEVICE_ATTR(fx_loop_on_off, S_IWUGO | S_IRUGO, pod_get_fx_loop_on_off, + pod_set_fx_loop_on_off); +static DEVICE_ATTR(tweak_param_select, S_IWUGO | S_IRUGO, + pod_get_tweak_param_select, pod_set_tweak_param_select); +static DEVICE_ATTR(amp1_engage, S_IWUGO | S_IRUGO, pod_get_amp1_engage, + pod_set_amp1_engage); +static DEVICE_ATTR(band_1_gain, S_IWUGO | S_IRUGO, pod_get_band_1_gain, + pod_set_band_1_gain); +static DEVICE_ATTR2(band_2_gain__bass, band_2_gain, S_IWUGO | S_IRUGO, + pod_get_band_2_gain__bass, pod_set_band_2_gain__bass); +static DEVICE_ATTR(band_2_gain, S_IWUGO | S_IRUGO, pod_get_band_2_gain, + pod_set_band_2_gain); +static DEVICE_ATTR2(band_3_gain__bass, band_3_gain, S_IWUGO | S_IRUGO, + pod_get_band_3_gain__bass, pod_set_band_3_gain__bass); +static DEVICE_ATTR(band_3_gain, S_IWUGO | S_IRUGO, pod_get_band_3_gain, + pod_set_band_3_gain); +static DEVICE_ATTR2(band_4_gain__bass, band_4_gain, S_IWUGO | S_IRUGO, + pod_get_band_4_gain__bass, pod_set_band_4_gain__bass); +static DEVICE_ATTR2(band_5_gain__bass, band_5_gain, S_IWUGO | S_IRUGO, + pod_get_band_5_gain__bass, pod_set_band_5_gain__bass); +static DEVICE_ATTR(band_4_gain, S_IWUGO | S_IRUGO, pod_get_band_4_gain, + pod_set_band_4_gain); +static DEVICE_ATTR2(band_6_gain__bass, band_6_gain, S_IWUGO | S_IRUGO, + pod_get_band_6_gain__bass, pod_set_band_6_gain__bass); static DEVICE_ATTR(body, S_IRUGO, variax_get_body, line6_nop_write); -static DEVICE_ATTR(pickup1_enable, S_IRUGO, variax_get_pickup1_enable, line6_nop_write); -static DEVICE_ATTR(pickup1_type, S_IRUGO, variax_get_pickup1_type, line6_nop_write); -static DEVICE_ATTR(pickup1_position, S_IRUGO, variax_get_pickup1_position, line6_nop_write); -static DEVICE_ATTR(pickup1_angle, S_IRUGO, variax_get_pickup1_angle, line6_nop_write); -static DEVICE_ATTR(pickup1_level, S_IRUGO, variax_get_pickup1_level, line6_nop_write); -static DEVICE_ATTR(pickup2_enable, S_IRUGO, variax_get_pickup2_enable, line6_nop_write); -static DEVICE_ATTR(pickup2_type, S_IRUGO, variax_get_pickup2_type, line6_nop_write); -static DEVICE_ATTR(pickup2_position, S_IRUGO, variax_get_pickup2_position, line6_nop_write); -static DEVICE_ATTR(pickup2_angle, S_IRUGO, variax_get_pickup2_angle, line6_nop_write); -static DEVICE_ATTR(pickup2_level, S_IRUGO, variax_get_pickup2_level, line6_nop_write); -static DEVICE_ATTR(pickup_phase, S_IRUGO, variax_get_pickup_phase, line6_nop_write); -static DEVICE_ATTR(capacitance, S_IRUGO, variax_get_capacitance, line6_nop_write); -static DEVICE_ATTR(tone_resistance, S_IRUGO, variax_get_tone_resistance, line6_nop_write); -static DEVICE_ATTR(volume_resistance, S_IRUGO, variax_get_volume_resistance, line6_nop_write); +static DEVICE_ATTR(pickup1_enable, S_IRUGO, variax_get_pickup1_enable, + line6_nop_write); +static DEVICE_ATTR(pickup1_type, S_IRUGO, variax_get_pickup1_type, + line6_nop_write); +static DEVICE_ATTR(pickup1_position, S_IRUGO, variax_get_pickup1_position, + line6_nop_write); +static DEVICE_ATTR(pickup1_angle, S_IRUGO, variax_get_pickup1_angle, + line6_nop_write); +static DEVICE_ATTR(pickup1_level, S_IRUGO, variax_get_pickup1_level, + line6_nop_write); +static DEVICE_ATTR(pickup2_enable, S_IRUGO, variax_get_pickup2_enable, + line6_nop_write); +static DEVICE_ATTR(pickup2_type, S_IRUGO, variax_get_pickup2_type, + line6_nop_write); +static DEVICE_ATTR(pickup2_position, S_IRUGO, variax_get_pickup2_position, + line6_nop_write); +static DEVICE_ATTR(pickup2_angle, S_IRUGO, variax_get_pickup2_angle, + line6_nop_write); +static DEVICE_ATTR(pickup2_level, S_IRUGO, variax_get_pickup2_level, + line6_nop_write); +static DEVICE_ATTR(pickup_phase, S_IRUGO, variax_get_pickup_phase, + line6_nop_write); +static DEVICE_ATTR(capacitance, S_IRUGO, variax_get_capacitance, + line6_nop_write); +static DEVICE_ATTR(tone_resistance, S_IRUGO, variax_get_tone_resistance, + line6_nop_write); +static DEVICE_ATTR(volume_resistance, S_IRUGO, variax_get_volume_resistance, + line6_nop_write); static DEVICE_ATTR(taper, S_IRUGO, variax_get_taper, line6_nop_write); static DEVICE_ATTR(tone_dump, S_IRUGO, variax_get_tone_dump, line6_nop_write); static DEVICE_ATTR(save_tone, S_IRUGO, variax_get_save_tone, line6_nop_write); -static DEVICE_ATTR(volume_dump, S_IRUGO, variax_get_volume_dump, line6_nop_write); -static DEVICE_ATTR(tuning_enable, S_IRUGO, variax_get_tuning_enable, line6_nop_write); +static DEVICE_ATTR(volume_dump, S_IRUGO, variax_get_volume_dump, + line6_nop_write); +static DEVICE_ATTR(tuning_enable, S_IRUGO, variax_get_tuning_enable, + line6_nop_write); static DEVICE_ATTR(tuning6, S_IRUGO, variax_get_tuning6, line6_nop_write); static DEVICE_ATTR(tuning5, S_IRUGO, variax_get_tuning5, line6_nop_write); static DEVICE_ATTR(tuning4, S_IRUGO, variax_get_tuning4, line6_nop_write); @@ -399,7 +521,8 @@ static DEVICE_ATTR(mix4, S_IRUGO, variax_get_mix4, line6_nop_write); static DEVICE_ATTR(mix3, S_IRUGO, variax_get_mix3, line6_nop_write); static DEVICE_ATTR(mix2, S_IRUGO, variax_get_mix2, line6_nop_write); static DEVICE_ATTR(mix1, S_IRUGO, variax_get_mix1, line6_nop_write); -static DEVICE_ATTR(pickup_wiring, S_IRUGO, variax_get_pickup_wiring, line6_nop_write); +static DEVICE_ATTR(pickup_wiring, S_IRUGO, variax_get_pickup_wiring, + line6_nop_write); int pod_create_files(int firmware, int type, struct device *dev) { @@ -407,7 +530,8 @@ int pod_create_files(int firmware, int type, struct device *dev) CHECK_RETURN(device_create_file(dev, &dev_attr_tweak)); CHECK_RETURN(device_create_file(dev, &dev_attr_wah_position)); if ((type & (LINE6_BITS_PODXTALL)) != 0) - CHECK_RETURN(device_create_file(dev, &dev_attr_compression_gain)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_compression_gain)); CHECK_RETURN(device_create_file(dev, &dev_attr_vol_pedal_position)); CHECK_RETURN(device_create_file(dev, &dev_attr_compression_threshold)); CHECK_RETURN(device_create_file(dev, &dev_attr_pan)); @@ -429,7 +553,8 @@ int pod_create_files(int firmware, int type, struct device *dev) CHECK_RETURN(device_create_file(dev, &dev_attr_reverb_mix)); CHECK_RETURN(device_create_file(dev, &dev_attr_effect_setup)); if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_band_1_frequency)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_band_1_frequency)); if ((type & (LINE6_BITS_PODXTALL)) != 0) CHECK_RETURN(device_create_file(dev, &dev_attr_presence)); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) @@ -443,10 +568,12 @@ int pod_create_files(int firmware, int type, struct device *dev) CHECK_RETURN(device_create_file(dev, &dev_attr_delay_enable)); CHECK_RETURN(device_create_file(dev, &dev_attr_mod_param_1)); CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_1)); - CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_1_note_value)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_delay_param_1_note_value)); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_band_2_frequency__bass)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_band_2_frequency__bass)); CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_2)); CHECK_RETURN(device_create_file(dev, &dev_attr_delay_volume_mix)); CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_3)); @@ -459,26 +586,34 @@ int pod_create_files(int firmware, int type, struct device *dev) if ((type & (LINE6_BITS_PODXTALL)) != 0) CHECK_RETURN(device_create_file(dev, &dev_attr_reverb_tone)); if ((type & (LINE6_BITS_PODXTALL)) != 0) - CHECK_RETURN(device_create_file(dev, &dev_attr_reverb_pre_delay)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_reverb_pre_delay)); if ((type & (LINE6_BITS_PODXTALL)) != 0) - CHECK_RETURN(device_create_file(dev, &dev_attr_reverb_pre_post)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_reverb_pre_post)); if ((type & (LINE6_BITS_PODXTALL)) != 0) if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_band_2_frequency)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_band_2_frequency)); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_band_3_frequency__bass)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_band_3_frequency__bass)); CHECK_RETURN(device_create_file(dev, &dev_attr_wah_enable)); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) - CHECK_RETURN(device_create_file(dev, &dev_attr_modulation_lo_cut)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_modulation_lo_cut)); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) - CHECK_RETURN(device_create_file(dev, &dev_attr_delay_reverb_lo_cut)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_delay_reverb_lo_cut)); if ((type & (LINE6_BITS_PODXTALL)) != 0) if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_volume_pedal_minimum)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_volume_pedal_minimum)); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_eq_pre_post)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_eq_pre_post)); CHECK_RETURN(device_create_file(dev, &dev_attr_volume_pre_post)); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) CHECK_RETURN(device_create_file(dev, &dev_attr_di_model)); @@ -496,19 +631,25 @@ int pod_create_files(int firmware, int type, struct device *dev) CHECK_RETURN(device_create_file(dev, &dev_attr_modulation_model)); if ((type & (LINE6_BITS_PODXTALL)) != 0) if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_band_3_frequency)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_band_3_frequency)); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_band_4_frequency__bass)); - CHECK_RETURN(device_create_file(dev, &dev_attr_mod_param_1_double_precision)); - CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_1_double_precision)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_band_4_frequency__bass)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_mod_param_1_double_precision)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_delay_param_1_double_precision)); if (firmware >= 200) CHECK_RETURN(device_create_file(dev, &dev_attr_eq_enable)); CHECK_RETURN(device_create_file(dev, &dev_attr_tap)); - CHECK_RETURN(device_create_file(dev, &dev_attr_volume_tweak_pedal_assign)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_volume_tweak_pedal_assign)); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_band_5_frequency)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_band_5_frequency)); CHECK_RETURN(device_create_file(dev, &dev_attr_tuner)); CHECK_RETURN(device_create_file(dev, &dev_attr_mic_selection)); CHECK_RETURN(device_create_file(dev, &dev_attr_cabinet_model)); @@ -516,25 +657,30 @@ int pod_create_files(int firmware, int type, struct device *dev) CHECK_RETURN(device_create_file(dev, &dev_attr_roomlevel)); if ((type & (LINE6_BITS_PODXTALL)) != 0) if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_band_4_frequency)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_band_4_frequency)); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_band_6_frequency)); - CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_param_1_note_value)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_band_6_frequency)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_stomp_param_1_note_value)); CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_param_2)); CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_param_3)); CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_param_4)); CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_param_5)); CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_param_6)); if ((type & (LINE6_BITS_LIVE)) != 0) - CHECK_RETURN(device_create_file(dev, &dev_attr_amp_switch_select)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_amp_switch_select)); CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_4)); CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_5)); CHECK_RETURN(device_create_file(dev, &dev_attr_delay_pre_post)); if ((type & (LINE6_BITS_PODXTALL)) != 0) CHECK_RETURN(device_create_file(dev, &dev_attr_delay_model)); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) - CHECK_RETURN(device_create_file(dev, &dev_attr_delay_verb_model)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_delay_verb_model)); CHECK_RETURN(device_create_file(dev, &dev_attr_tempo_msb)); CHECK_RETURN(device_create_file(dev, &dev_attr_tempo_lsb)); if (firmware >= 300) @@ -549,29 +695,37 @@ int pod_create_files(int firmware, int type, struct device *dev) CHECK_RETURN(device_create_file(dev, &dev_attr_band_1_gain)); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_band_2_gain__bass)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_band_2_gain__bass)); if ((type & (LINE6_BITS_PODXTALL)) != 0) if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_band_2_gain)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_band_2_gain)); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_band_3_gain__bass)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_band_3_gain__bass)); if ((type & (LINE6_BITS_PODXTALL)) != 0) if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_band_3_gain)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_band_3_gain)); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_band_4_gain__bass)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_band_4_gain__bass)); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_band_5_gain__bass)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_band_5_gain__bass)); if ((type & (LINE6_BITS_PODXTALL)) != 0) if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_band_4_gain)); + CHECK_RETURN(device_create_file + (dev, &dev_attr_band_4_gain)); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) if (firmware >= 200) - CHECK_RETURN(device_create_file(dev, &dev_attr_band_6_gain__bass)); - return 0; + CHECK_RETURN(device_create_file + (dev, &dev_attr_band_6_gain__bass)); + return 0; } void pod_remove_files(int firmware, int type, struct device *dev) @@ -618,7 +772,8 @@ void pod_remove_files(int firmware, int type, struct device *dev) device_remove_file(dev, &dev_attr_delay_param_1_note_value); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) if (firmware >= 200) - device_remove_file(dev, &dev_attr_band_2_frequency__bass); + device_remove_file(dev, + &dev_attr_band_2_frequency__bass); device_remove_file(dev, &dev_attr_delay_param_2); device_remove_file(dev, &dev_attr_delay_volume_mix); device_remove_file(dev, &dev_attr_delay_param_3); @@ -639,7 +794,8 @@ void pod_remove_files(int firmware, int type, struct device *dev) device_remove_file(dev, &dev_attr_band_2_frequency); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) if (firmware >= 200) - device_remove_file(dev, &dev_attr_band_3_frequency__bass); + device_remove_file(dev, + &dev_attr_band_3_frequency__bass); device_remove_file(dev, &dev_attr_wah_enable); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) device_remove_file(dev, &dev_attr_modulation_lo_cut); @@ -671,7 +827,8 @@ void pod_remove_files(int firmware, int type, struct device *dev) device_remove_file(dev, &dev_attr_band_3_frequency); if ((type & (LINE6_BITS_BASSPODXTALL)) != 0) if (firmware >= 200) - device_remove_file(dev, &dev_attr_band_4_frequency__bass); + device_remove_file(dev, + &dev_attr_band_4_frequency__bass); device_remove_file(dev, &dev_attr_mod_param_1_double_precision); device_remove_file(dev, &dev_attr_delay_param_1_double_precision); if (firmware >= 200) @@ -790,7 +947,7 @@ int variax_create_files(int firmware, int type, struct device *dev) CHECK_RETURN(device_create_file(dev, &dev_attr_mix2)); CHECK_RETURN(device_create_file(dev, &dev_attr_mix1)); CHECK_RETURN(device_create_file(dev, &dev_attr_pickup_wiring)); - return 0; + return 0; } void variax_remove_files(int firmware, int type, struct device *dev) -- GitLab From 2a20bf6f1a945994f5c43308b6dd8b7058e2c290 Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 15 Nov 2009 22:17:55 -0600 Subject: [PATCH 017/235] staging: line6: Fix some checkpatch warnings in control.c Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/line6/control.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/staging/line6/control.c b/drivers/staging/line6/control.c index cfc6543311f3..2d98935f7b0b 100644 --- a/drivers/staging/line6/control.c +++ b/drivers/staging/line6/control.c @@ -22,18 +22,18 @@ struct device_attribute dev_attr_##_name1 = __ATTR(_name2, _mode, _show, _store) #define LINE6_PARAM_R(PREFIX, prefix, type, param) \ -static ssize_t prefix ## _get_ ## param(struct device *dev, \ +static ssize_t prefix##_get_##param(struct device *dev, \ struct device_attribute *attr, char *buf) \ { \ - return prefix ## _get_param_ ## type(dev, buf, PREFIX ## _ ## param); \ + return prefix##_get_param_##type(dev, buf, PREFIX##_##param); \ } #define LINE6_PARAM_RW(PREFIX, prefix, type, param) \ LINE6_PARAM_R(PREFIX, prefix, type, param); \ -static ssize_t prefix ## _set_ ## param(struct device *dev, \ +static ssize_t prefix##_set_##param(struct device *dev, \ struct device_attribute *attr, const char *buf, size_t count) \ { \ - return prefix ## _set_param_ ## type(dev, buf, count, PREFIX ## _ ## param); \ + return prefix##_set_param_##type(dev, buf, count, PREFIX##_##param); \ } #define POD_PARAM_R(type, param) LINE6_PARAM_R(POD, pod, type, param) @@ -727,6 +727,7 @@ int pod_create_files(int firmware, int type, struct device *dev) (dev, &dev_attr_band_6_gain__bass)); return 0; } +EXPORT_SYMBOL(pod_create_files); void pod_remove_files(int firmware, int type, struct device *dev) { @@ -901,8 +902,6 @@ void pod_remove_files(int firmware, int type, struct device *dev) if (firmware >= 200) device_remove_file(dev, &dev_attr_band_6_gain__bass); } - -EXPORT_SYMBOL(pod_create_files); EXPORT_SYMBOL(pod_remove_files); int variax_create_files(int firmware, int type, struct device *dev) @@ -949,6 +948,7 @@ int variax_create_files(int firmware, int type, struct device *dev) CHECK_RETURN(device_create_file(dev, &dev_attr_pickup_wiring)); return 0; } +EXPORT_SYMBOL(variax_create_files); void variax_remove_files(int firmware, int type, struct device *dev) { @@ -992,6 +992,4 @@ void variax_remove_files(int firmware, int type, struct device *dev) device_remove_file(dev, &dev_attr_mix1); device_remove_file(dev, &dev_attr_pickup_wiring); } - -EXPORT_SYMBOL(variax_create_files); EXPORT_SYMBOL(variax_remove_files); -- GitLab From 49da3dd935c52542ef21daa585c01401867dddad Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 15 Nov 2009 22:17:56 -0600 Subject: [PATCH 018/235] staging: line6: Convert simple_strtoul() to strict_strtoul in control.c Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/line6/control.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/staging/line6/control.c b/drivers/staging/line6/control.c index 2d98935f7b0b..0b598526de62 100644 --- a/drivers/staging/line6/control.c +++ b/drivers/staging/line6/control.c @@ -56,7 +56,13 @@ static ssize_t pod_set_param_int(struct device *dev, const char *buf, { struct usb_interface *interface = to_usb_interface(dev); struct usb_line6_pod *pod = usb_get_intfdata(interface); - int value = simple_strtoul(buf, NULL, 10); + unsigned long value; + int retval; + + retval = strict_strtoul(buf, 10, &value); + if (retval) + return retval; + pod_transmit_parameter(pod, param, value); return count; } -- GitLab From afb9091dd3c58a6d83e8afac7afff8a8bfe8c97a Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 15 Nov 2009 22:17:57 -0600 Subject: [PATCH 019/235] staging: line6: Fix checkpatch warnings in pcm.c Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/line6/pcm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/line6/pcm.c b/drivers/staging/line6/pcm.c index fc4113f33159..dd98121eb80b 100644 --- a/drivers/staging/line6/pcm.c +++ b/drivers/staging/line6/pcm.c @@ -156,7 +156,8 @@ static int snd_line6_new_pcm(struct snd_line6_pcm *line6pcm) strcpy(pcm->name, line6pcm->line6->properties->name); /* set operators */ - snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_line6_playback_ops); + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, + &snd_line6_playback_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_line6_capture_ops); /* pre-allocation of buffers */ -- GitLab From 63a4a8bad9715421e9efdfba6455c7a25d1be6e7 Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 15 Nov 2009 22:17:58 -0600 Subject: [PATCH 020/235] staging: line6: Lindent and fix some checkpatch warnings in toneport.c Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/line6/toneport.c | 99 ++++++++++++++++---------------- 1 file changed, 49 insertions(+), 50 deletions(-) diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c index eaa1229002aa..84bf29c33515 100644 --- a/drivers/staging/line6/toneport.c +++ b/drivers/staging/line6/toneport.c @@ -17,10 +17,8 @@ #include "playback.h" #include "toneport.h" - static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2); - static struct snd_ratden toneport_ratden = { .num_min = 44100, .num_max = 44100, @@ -29,47 +27,44 @@ static struct snd_ratden toneport_ratden = { }; static struct line6_pcm_properties toneport_pcm_properties = { - .snd_line6_playback_hw = { - .info = (SNDRV_PCM_INFO_MMAP | - SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_MMAP_VALID | - SNDRV_PCM_INFO_PAUSE | - SNDRV_PCM_INFO_SYNC_START), - .formats = SNDRV_PCM_FMTBIT_S16_LE, - .rates = SNDRV_PCM_RATE_KNOT, - .rate_min = 44100, - .rate_max = 44100, - .channels_min = 2, - .channels_max = 2, - .buffer_bytes_max = 60000, - .period_bytes_min = 180 * 4, - .period_bytes_max = 8192, - .periods_min = 1, - .periods_max = 1024 - }, - .snd_line6_capture_hw = { - .info = (SNDRV_PCM_INFO_MMAP | - SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_MMAP_VALID | - SNDRV_PCM_INFO_SYNC_START), - .formats = SNDRV_PCM_FMTBIT_S16_LE, - .rates = SNDRV_PCM_RATE_KNOT, - .rate_min = 44100, - .rate_max = 44100, - .channels_min = 2, - .channels_max = 2, - .buffer_bytes_max = 60000, - .period_bytes_min = 188 * 4, - .period_bytes_max = 8192, - .periods_min = 1, - .periods_max = 1024 - }, + .snd_line6_playback_hw = { + .info = (SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_PAUSE | + SNDRV_PCM_INFO_SYNC_START), + .formats = SNDRV_PCM_FMTBIT_S16_LE, + .rates = SNDRV_PCM_RATE_KNOT, + .rate_min = 44100, + .rate_max = 44100, + .channels_min = 2, + .channels_max = 2, + .buffer_bytes_max = 60000, + .period_bytes_min = 180 * 4, + .period_bytes_max = 8192, + .periods_min = 1, + .periods_max = 1024}, + .snd_line6_capture_hw = { + .info = (SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_SYNC_START), + .formats = SNDRV_PCM_FMTBIT_S16_LE, + .rates = SNDRV_PCM_RATE_KNOT, + .rate_min = 44100, + .rate_max = 44100, + .channels_min = 2, + .channels_max = 2, + .buffer_bytes_max = 60000, + .period_bytes_min = 188 * 4, + .period_bytes_max = 8192, + .periods_min = 1, + .periods_max = 1024}, .snd_line6_rates = { - .nrats = 1, - .rats = &toneport_ratden - }, + .nrats = 1, + .rats = &toneport_ratden}, .bytes_per_frame = 4 }; @@ -117,9 +112,10 @@ static ssize_t toneport_set_led_green(struct device *dev, return count; } -static DEVICE_ATTR(led_red, S_IWUGO | S_IRUGO, line6_nop_read, toneport_set_led_red); -static DEVICE_ATTR(led_green, S_IWUGO | S_IRUGO, line6_nop_read, toneport_set_led_green); - +static DEVICE_ATTR(led_red, S_IWUGO | S_IRUGO, line6_nop_read, + toneport_set_led_red); +static DEVICE_ATTR(led_green, S_IWUGO | S_IRUGO, line6_nop_read, + toneport_set_led_green); static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2) { @@ -196,16 +192,18 @@ int toneport_init(struct usb_interface *interface, line6_write_data(line6, 0x80c6, &ticks, 4); /* - seems to work without the first two... - */ + seems to work without the first two... + */ /* toneport_send_cmd(usbdev, 0x0201, 0x0002); */ /* toneport_send_cmd(usbdev, 0x0801, 0x0000); */ /* only one that works for me; on GP, TP might be different? */ toneport_send_cmd(usbdev, 0x0301, 0x0000); if (usbdev->descriptor.idProduct != LINE6_DEVID_GUITARPORT) { - CHECK_RETURN(device_create_file(&interface->dev, &dev_attr_led_red)); - CHECK_RETURN(device_create_file(&interface->dev, &dev_attr_led_green)); + CHECK_RETURN(device_create_file + (&interface->dev, &dev_attr_led_red)); + CHECK_RETURN(device_create_file + (&interface->dev, &dev_attr_led_green)); toneport_update_led(&usbdev->dev); } @@ -223,7 +221,8 @@ void toneport_disconnect(struct usb_interface *interface) return; toneport = usb_get_intfdata(interface); - if (toneport->line6.usbdev->descriptor.idProduct != LINE6_DEVID_GUITARPORT) { + if (toneport->line6.usbdev->descriptor.idProduct != + LINE6_DEVID_GUITARPORT) { device_remove_file(&interface->dev, &dev_attr_led_red); device_remove_file(&interface->dev, &dev_attr_led_green); } -- GitLab From bb950a169d98ac9a2b8a899f95ed5d784c14f3cc Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 15 Nov 2009 22:17:59 -0600 Subject: [PATCH 021/235] staging: line6: Convert simple_strtol to strict_strtol in toneport.c Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/line6/toneport.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c index 84bf29c33515..e6770ea17936 100644 --- a/drivers/staging/line6/toneport.c +++ b/drivers/staging/line6/toneport.c @@ -96,8 +96,14 @@ static ssize_t toneport_set_led_red(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - char *c; - led_red = simple_strtol(buf, &c, 10); + int retval; + long value; + + retval = strict_strtol(buf, 10, &value); + if (retval) + return retval; + + led_red = value; toneport_update_led(dev); return count; } @@ -106,8 +112,14 @@ static ssize_t toneport_set_led_green(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - char *c; - led_green = simple_strtol(buf, &c, 10); + int retval; + long value; + + retval = strict_strtol(buf, 10, &value); + if (retval) + return retval; + + led_green = value; toneport_update_led(dev); return count; } -- GitLab From c0e6e7c1b2409fd4968b256ae1d979e6df14b3f1 Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 15 Nov 2009 22:18:00 -0600 Subject: [PATCH 022/235] staging: line6: Convert simple_strtoul to strict_strtoul in variax.c Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/line6/variax.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/drivers/staging/line6/variax.c b/drivers/staging/line6/variax.c index f9d96984733a..48d834b0fa1b 100644 --- a/drivers/staging/line6/variax.c +++ b/drivers/staging/line6/variax.c @@ -184,7 +184,12 @@ static ssize_t variax_set_volume(struct device *dev, const char *buf, size_t count) { struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); - int value = simple_strtoul(buf, NULL, 10); + unsigned long value; + int ret; + + ret = strict_strtoul(buf, 10, &value); + if (ret) + return ret; if (line6_transmit_parameter(&variax->line6, VARIAXMIDI_volume, value) == 0) @@ -211,7 +216,12 @@ static ssize_t variax_set_model(struct device *dev, const char *buf, size_t count) { struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); - int value = simple_strtoul(buf, NULL, 10); + unsigned long value; + int ret; + + ret = strict_strtoul(buf, 10, &value); + if (ret) + return ret; if (line6_send_program(&variax->line6, value) == 0) variax->model = value; @@ -237,8 +247,14 @@ static ssize_t variax_set_active(struct device *dev, const char *buf, size_t count) { struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); - int value = simple_strtoul(buf, NULL, 10) ? 1 : 0; - variax->buffer_activate[VARIAX_OFFSET_ACTIVATE] = value; + unsigned long value; + int ret; + + ret = strict_strtoul(buf, 10, &value); + if (ret) + return ret; + + variax->buffer_activate[VARIAX_OFFSET_ACTIVATE] = value ? 1: 0; line6_send_raw_message_async(&variax->line6, variax->buffer_activate, sizeof(variax_activate)); return count; @@ -262,7 +278,12 @@ static ssize_t variax_set_tone(struct device *dev, const char *buf, size_t count) { struct usb_line6_variax *variax = usb_get_intfdata(to_usb_interface(dev)); - int value = simple_strtoul(buf, NULL, 10); + unsigned long value; + int ret; + + ret = strict_strtoul(buf, 10, &value); + if (ret) + return ret; if (line6_transmit_parameter(&variax->line6, VARIAXMIDI_tone, value) == 0) -- GitLab From 7e4d5c13d8048ed37f94dbcdf54228b404a775c7 Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 15 Nov 2009 22:18:01 -0600 Subject: [PATCH 023/235] staging: line6: Convert simple_strtoul to strict_strtoul in pod.c Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/line6/pod.c | 56 +++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c index 5f5fc025cb79..685c529950eb 100644 --- a/drivers/staging/line6/pod.c +++ b/drivers/staging/line6/pod.c @@ -422,13 +422,21 @@ void pod_transmit_parameter(struct usb_line6_pod *pod, int param, int value) /* Resolve value to memory location. */ -static void pod_resolve(const char *buf, short block0, short block1, unsigned char *location) +static int pod_resolve(const char *buf, short block0, short block1, unsigned char *location) { - int value = simple_strtoul(buf, NULL, 10); - short block = (value < 0x40) ? block0 : block1; + unsigned long value; + short block; + int ret; + + ret = strict_strtoul(buf, 10, &value); + if (ret) + return ret; + + block = (value < 0x40) ? block0 : block1; value &= 0x3f; location[0] = block >> 7; location[1] = value | (block & 0x7f); + return 0; } /* @@ -438,14 +446,20 @@ static ssize_t pod_send_store_command(struct device *dev, const char *buf, size_ { struct usb_interface *interface = to_usb_interface(dev); struct usb_line6_pod *pod = usb_get_intfdata(interface); - + int ret; int size = 3 + sizeof(pod->prog_data_buf); char *sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_STORE, size); + if (!sysex) return 0; sysex[SYSEX_DATA_OFS] = 5; /* see pod_dump() */ - pod_resolve(buf, block0, block1, sysex + SYSEX_DATA_OFS + 1); + ret = pod_resolve(buf, block0, block1, sysex + SYSEX_DATA_OFS + 1); + if (ret) { + kfree(sysex); + return ret; + } + memcpy(sysex + SYSEX_DATA_OFS + 3, &pod->prog_data_buf, sizeof(pod->prog_data_buf)); line6_send_sysex_message(&pod->line6, sysex, size); @@ -461,13 +475,18 @@ static ssize_t pod_send_retrieve_command(struct device *dev, const char *buf, si { struct usb_interface *interface = to_usb_interface(dev); struct usb_line6_pod *pod = usb_get_intfdata(interface); + int ret; int size = 4; char *sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_DUMPMEM, size); if (!sysex) return 0; - pod_resolve(buf, block0, block1, sysex + SYSEX_DATA_OFS); + ret = pod_resolve(buf, block0, block1, sysex + SYSEX_DATA_OFS); + if (ret) { + kfree(sysex); + return ret; + } sysex[SYSEX_DATA_OFS + 2] = 0; sysex[SYSEX_DATA_OFS + 3] = 0; line6_dump_started(&pod->dumpreq, POD_DUMP_MEMORY); @@ -526,7 +545,13 @@ static ssize_t pod_set_channel(struct device *dev, { struct usb_interface *interface = to_usb_interface(dev); struct usb_line6_pod *pod = usb_get_intfdata(interface); - int value = simple_strtoul(buf, NULL, 10); + unsigned long value; + int ret; + + ret = strict_strtoul(buf, 10, &value); + if (ret) + return ret; + pod_send_channel(pod, value); return count; } @@ -645,6 +670,8 @@ static ssize_t pod_set_system_param(struct usb_line6_pod *pod, const char *buf, char *sysex; static const int size = 5; unsigned short value; + unsigned long result; + int ret; if (((pod->prog_data.control[POD_tuner] & 0x40) == 0) && tuner) return -EINVAL; @@ -653,7 +680,12 @@ static ssize_t pod_set_system_param(struct usb_line6_pod *pod, const char *buf, sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_SYSTEM, size); if (!sysex) return 0; - value = simple_strtoul(buf, NULL, 10) & mask; + + ret = strict_strtoul(buf, 10, &result); + if (ret) + return ret; + + value = result & mask; sysex[SYSEX_DATA_OFS] = code; sysex[SYSEX_DATA_OFS + 1] = (value >> 12) & 0x0f; sysex[SYSEX_DATA_OFS + 2] = (value >> 8) & 0x0f; @@ -812,7 +844,13 @@ static ssize_t pod_set_midi_postprocess(struct device *dev, { struct usb_interface *interface = to_usb_interface(dev); struct usb_line6_pod *pod = usb_get_intfdata(interface); - int value = simple_strtoul(buf, NULL, 10); + unsigned long value; + int ret; + + ret = strict_strtoul(buf, 10, &value); + if (ret) + return ret; + pod->midi_postprocess = value ? 1 : 0; return count; } -- GitLab From 334a33d81016a391b1f8c75d482eebb8bb7362fb Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 15 Nov 2009 22:18:02 -0600 Subject: [PATCH 024/235] staging: line6: Convert simple_strtoul to strict_strtoul in midi.c Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/line6/midi.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/staging/line6/midi.c b/drivers/staging/line6/midi.c index 89a2b17e9caf..6ef4455d87d8 100644 --- a/drivers/staging/line6/midi.c +++ b/drivers/staging/line6/midi.c @@ -318,7 +318,13 @@ static ssize_t midi_set_midi_mask_transmit(struct device *dev, { struct usb_interface *interface = to_usb_interface(dev); struct usb_line6 *line6 = usb_get_intfdata(interface); - int value = simple_strtoul(buf, NULL, 10); + unsigned long value; + int ret; + + ret = strict_strtoul(buf, 10, &value); + if (ret) + return ret; + line6->line6midi->midi_mask_transmit = value; return count; } @@ -344,7 +350,13 @@ static ssize_t midi_set_midi_mask_receive(struct device *dev, { struct usb_interface *interface = to_usb_interface(dev); struct usb_line6 *line6 = usb_get_intfdata(interface); - int value = simple_strtoul(buf, NULL, 10); + unsigned long value; + int ret; + + ret = strict_strtoul(buf, 10, &value); + if (ret) + return ret; + line6->line6midi->midi_mask_receive = value; return count; } -- GitLab From 155b44aae0ed9a0f9aecc8c528ba5bc3b26f8377 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 21 Sep 2009 11:35:45 -0700 Subject: [PATCH 025/235] Staging: comedi: 8253: fix coding style error The line was too long. Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/8253.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/8253.h b/drivers/staging/comedi/drivers/8253.h index c2ea2d96f1cc..0bb35db4ea3b 100644 --- a/drivers/staging/comedi/drivers/8253.h +++ b/drivers/staging/comedi/drivers/8253.h @@ -206,7 +206,8 @@ static inline void i8253_cascade_ns_to_timer_2div(int i8253_osc_base, } *nanosec = div1 * div2 * i8253_osc_base; - *d1 = div1 & 0xffff; /* masking is done since counter maps zero to 0x10000 */ + /* masking is done since counter maps zero to 0x10000 */ + *d1 = div1 & 0xffff; *d2 = div2 & 0xffff; return; } -- GitLab From 228ec3402130b158ccd0e690ac5c4a0b27317786 Mon Sep 17 00:00:00 2001 From: Ben Kero Date: Wed, 23 Sep 2009 02:49:05 -0700 Subject: [PATCH 026/235] Staging: comedi: 8255: Fix coding style error EXPORT_SYMBOL's in the wrong place. Unnecessary {}s Signed-off-by: Ben Kero Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/8255.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 0a50864767e4..10f488f0e5ee 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -132,6 +132,7 @@ void subdev_8255_interrupt(struct comedi_device *dev, comedi_event(dev, s); } +EXPORT_SYMBOL(subdev_8255_interrupt); static int subdev_8255_cb(int dir, int port, int data, unsigned long arg) { @@ -179,15 +180,14 @@ static int subdev_8255_insn_config(struct comedi_device *dev, unsigned int bits; mask = 1 << CR_CHAN(insn->chanspec); - if (mask & 0x0000ff) { + if (mask & 0x0000ff) bits = 0x0000ff; - } else if (mask & 0x00ff00) { + else if (mask & 0x00ff00) bits = 0x00ff00; - } else if (mask & 0x0f0000) { + else if (mask & 0x0f0000) bits = 0x0f0000; - } else { + else bits = 0xf00000; - } switch (data[0]) { case INSN_CONFIG_DIO_INPUT: @@ -333,11 +333,10 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, return -ENOMEM; CALLBACK_ARG = arg; - if (cb == NULL) { + if (cb == NULL) CALLBACK_FUNC = subdev_8255_cb; - } else { + else CALLBACK_FUNC = cb; - } s->insn_bits = subdev_8255_insn; s->insn_config = subdev_8255_insn_config; @@ -347,6 +346,7 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, return 0; } +EXPORT_SYMBOL(subdev_8255_init); int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice *s, int (*cb) (int, int, int, unsigned long), @@ -366,6 +366,7 @@ int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice *s, return 0; } +EXPORT_SYMBOL(subdev_8255_init_irq); void subdev_8255_cleanup(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -378,6 +379,7 @@ void subdev_8255_cleanup(struct comedi_device *dev, struct comedi_subdevice *s) kfree(s->private); } } +EXPORT_SYMBOL(subdev_8255_cleanup); /* @@ -448,8 +450,3 @@ static int dev_8255_detach(struct comedi_device *dev) return 0; } - -EXPORT_SYMBOL(subdev_8255_init); -EXPORT_SYMBOL(subdev_8255_init_irq); -EXPORT_SYMBOL(subdev_8255_cleanup); -EXPORT_SYMBOL(subdev_8255_interrupt); -- GitLab From d43d27abf7a2e8388bb0b1d9bf33bd427bc2137a Mon Sep 17 00:00:00 2001 From: Mithlesh Thukral Date: Mon, 21 Sep 2009 11:53:27 -0700 Subject: [PATCH 027/235] Staging: comedi: drivers.c: checkpatch fix Fix a checkpatch.pl error. Fix struct * foo to struct *foo Signed-off-by: Mithlesh Thukral Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index dc53aeeac68f..c2a632d31c61 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -387,7 +387,7 @@ static int insn_rw_emulate_bits(struct comedi_device *dev, return 1; } -static inline unsigned long uvirt_to_kva(pgd_t * pgd, unsigned long adr) +static inline unsigned long uvirt_to_kva(pgd_t *pgd, unsigned long adr) { unsigned long ret = 0UL; pmd_t *pmd; -- GitLab From becdaa83c4e12127fd61373707bea11e751234af Mon Sep 17 00:00:00 2001 From: Vlatko Kosturjak Date: Mon, 21 Sep 2009 21:32:40 +0200 Subject: [PATCH 028/235] Staging: comedi: adl_pci6208: code styling fix Fix a checkpatch.pl errors. Signed-off-by: Vlatko Kosturjak Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci6208.c | 53 ++++++++++++-------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 8e1befc448a3..6925faaf5293 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -133,9 +133,11 @@ static int pci6208_ao_winsn(struct comedi_device *dev, static int pci6208_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -/* static int pci6208_dio_insn_bits(struct comedi_device *dev,struct comedi_subdevice *s, */ +/* static int pci6208_dio_insn_bits (struct comedi_device *dev, + * struct comedi_subdevice *s, */ /* struct comedi_insn *insn,unsigned int *data); */ -/* static int pci6208_dio_insn_config(struct comedi_device *dev,struct comedi_subdevice *s, */ +/* static int pci6208_dio_insn_config(struct comedi_device *dev, + * struct comedi_subdevice *s, */ /* struct comedi_insn *insn,unsigned int *data); */ /* @@ -151,7 +153,7 @@ static int pci6208_attach(struct comedi_device *dev, int retval; unsigned long io_base; - printk("comedi%d: pci6208: ", dev->minor); + printk(KERN_INFO "comedi%d: pci6208: ", dev->minor); retval = alloc_private(dev, sizeof(struct pci6208_private)); if (retval < 0) @@ -195,7 +197,7 @@ static int pci6208_attach(struct comedi_device *dev, /* s->insn_bits = pci6208_dio_insn_bits; */ /* s->insn_config = pci6208_dio_insn_config; */ - printk("attached\n"); + printk(KERN_INFO "attached\n"); return 1; } @@ -210,12 +212,11 @@ static int pci6208_attach(struct comedi_device *dev, */ static int pci6208_detach(struct comedi_device *dev) { - printk("comedi%d: pci6208: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: pci6208: remove\n", dev->minor); if (devpriv && devpriv->pci_dev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pci_dev); - } pci_dev_put(devpriv->pci_dev); } @@ -266,7 +267,8 @@ static int pci6208_ao_rinsn(struct comedi_device *dev, * useful to applications if you implement the insn_bits interface. * This allows packed reading/writing of the DIO channels. The * comedi core can convert between insn_bits and insn_read/write */ -/* static int pci6208_dio_insn_bits(struct comedi_device *dev,struct comedi_subdevice *s, */ +/* static int pci6208_dio_insn_bits(struct comedi_device *dev, + * struct comedi_subdevice *s, */ /* struct comedi_insn *insn,unsigned int *data) */ /* { */ /* if(insn->n!=2)return -EINVAL; */ @@ -290,7 +292,8 @@ static int pci6208_ao_rinsn(struct comedi_device *dev, /* return 2; */ /* } */ -/* static int pci6208_dio_insn_config(struct comedi_device *dev,struct comedi_subdevice *s, */ +/* static int pci6208_dio_insn_config(struct comedi_device *dev, + * struct comedi_subdevice *s, */ /* struct comedi_insn *insn,unsigned int *data) */ /* { */ /* int chan=CR_CHAN(insn->chanspec); */ @@ -320,10 +323,16 @@ static int pci6208_find_device(struct comedi_device *dev, int bus, int slot) pci_dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pci_dev)) { if (pci_dev->vendor == PCI_VENDOR_ID_ADLINK) { for (i = 0; i < ARRAY_SIZE(pci6208_boards); i++) { - if (pci6208_boards[i].dev_id == pci_dev->device) { - /* was a particular bus/slot requested? */ + if (pci6208_boards[i].dev_id == + pci_dev->device) { + /* + * was a particular bus/slot requested? + */ if ((bus != 0) || (slot != 0)) { - /* are we on the wrong bus/slot? */ + /* + * are we on the + * wrong bus/slot? + */ if (pci_dev->bus->number != bus || PCI_SLOT(pci_dev->devfn) @@ -338,8 +347,9 @@ static int pci6208_find_device(struct comedi_device *dev, int bus, int slot) } } - printk("comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", - dev->minor, bus, slot); + printk(KERN_ERR "comedi%d: no supported board found! " + "(req. bus/slot : %d/%d)\n", + dev->minor, bus, slot); return -EIO; found: @@ -368,17 +378,20 @@ pci6208_pci_setup(struct pci_dev *pci_dev, unsigned long *io_base_ptr, /* Enable PCI device and request regions */ if (comedi_pci_enable(pci_dev, PCI6208_DRIVER_NAME) < 0) { - printk - ("comedi%d: Failed to enable PCI device and request regions\n", - dev_minor); + printk(KERN_ERR "comedi%d: Failed to enable PCI device " + "and request regions\n", + dev_minor); return -EIO; } - /* Read local configuration register base address [PCI_BASE_ADDRESS #1]. */ + /* Read local configuration register + * base address [PCI_BASE_ADDRESS #1]. + */ lcr_io_base = pci_resource_start(pci_dev, 1); lcr_io_range = pci_resource_len(pci_dev, 1); - printk("comedi%d: local config registers at address 0x%4lx [0x%4lx]\n", - dev_minor, lcr_io_base, lcr_io_range); + printk(KERN_INFO "comedi%d: local config registers at address" + " 0x%4lx [0x%4lx]\n", + dev_minor, lcr_io_base, lcr_io_range); /* Read PCI6208 register base address [PCI_BASE_ADDRESS #2]. */ io_base = pci_resource_start(pci_dev, 2); -- GitLab From 8642fc4e2bd5e310eeacc4da8e88746deebf2310 Mon Sep 17 00:00:00 2001 From: Shane Warden Date: Mon, 21 Sep 2009 11:51:44 -0700 Subject: [PATCH 029/235] Staging: comedi: ni_labpc.h: Fixed line lengths of some trailing comments. Signed-off-by: Shane Warden Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_labpc.h | 52 +++++++++++++++++------ 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_labpc.h b/drivers/staging/comedi/drivers/ni_labpc.h index 82596345dcf4..422cee58a967 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.h +++ b/drivers/staging/comedi/drivers/ni_labpc.h @@ -38,19 +38,27 @@ struct labpc_board_struct { int device_id; /* device id for pci and pcmcia boards */ int ai_speed; /* maximum input speed in nanoseconds */ enum labpc_bustype bustype; /* ISA/PCI/etc. */ - enum labpc_register_layout register_layout; /* 1200 has extra registers compared to pc+ */ + + /* 1200 has extra registers compared to pc+ */ + enum labpc_register_layout register_layout; int has_ao; /* has analog output true/false */ const struct comedi_lrange *ai_range_table; const int *ai_range_code; const int *ai_range_is_unipolar; - unsigned ai_scan_up:1; /* board can auto scan up in ai channels, not just down */ - unsigned memory_mapped_io:1; /* uses memory mapped io instead of ioports */ + + /* board can auto scan up in ai channels, not just down */ + unsigned ai_scan_up:1; + + /* uses memory mapped io instead of ioports */ + unsigned memory_mapped_io:1; }; struct labpc_private { struct mite_struct *mite; /* for mite chip on pci-1200 */ - volatile unsigned long long count; /* number of data points left to be taken */ - unsigned int ao_value[NUM_AO_CHAN]; /* software copy of analog output values */ + /* number of data points left to be taken */ + volatile unsigned long long count; + /* software copy of analog output values */ + unsigned int ao_value[NUM_AO_CHAN]; /* software copys of bits written to command registers */ volatile unsigned int command1_bits; volatile unsigned int command2_bits; @@ -61,16 +69,34 @@ struct labpc_private { /* store last read of board status registers */ volatile unsigned int status1_bits; volatile unsigned int status2_bits; - unsigned int divisor_a0; /* value to load into board's counter a0 (conversion pacing) for timed conversions */ - unsigned int divisor_b0; /* value to load into board's counter b0 (master) for timed conversions */ - unsigned int divisor_b1; /* value to load into board's counter b1 (scan pacing) for timed conversions */ + /* + * value to load into board's counter a0 (conversion pacing) for timed + * conversions + */ + unsigned int divisor_a0; + /* + * value to load into board's counter b0 (master) for timed conversions + */ + unsigned int divisor_b0; + /* + * value to load into board's counter b1 (scan pacing) for timed + * conversions + */ + unsigned int divisor_b1; unsigned int dma_chan; /* dma channel to use */ u16 *dma_buffer; /* buffer ai will dma into */ - unsigned int dma_transfer_size; /* transfer size in bytes for current transfer */ - enum transfer_type current_transfer; /* we are using dma/fifo-half-full/etc. */ - unsigned int eeprom_data[EEPROM_SIZE]; /* stores contents of board's eeprom */ - unsigned int caldac[16]; /* stores settings of calibration dacs */ - /* function pointers so we can use inb/outb or readb/writeb as appropriate */ + /* transfer size in bytes for current transfer */ + unsigned int dma_transfer_size; + /* we are using dma/fifo-half-full/etc. */ + enum transfer_type current_transfer; + /* stores contents of board's eeprom */ + unsigned int eeprom_data[EEPROM_SIZE]; + /* stores settings of calibration dacs */ + unsigned int caldac[16]; + /* + * function pointers so we can use inb/outb or readb/writeb as + * appropriate + */ unsigned int (*read_byte) (unsigned long address); void (*write_byte) (unsigned int byte, unsigned long address); }; -- GitLab From b79eb4c113b539c23d5bac8d58b55690892e31e5 Mon Sep 17 00:00:00 2001 From: Bart Massey Date: Mon, 21 Sep 2009 11:32:36 -0700 Subject: [PATCH 030/235] Staging: comedi: ni_labbc_cs: cleaned up debug define a bit Signed-off-by: Bart Massey Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_labpc_cs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index 7d514b3ee754..db6e05e2ebba 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c @@ -59,8 +59,7 @@ NI manuals: */ -#undef LABPC_DEBUG - /* #define LABPC_DEBUG *//* enable debugging messages */ +#undef LABPC_DEBUG /* debugging messages */ #include "../comedidev.h" -- GitLab From 962331810fffda3e9ee474fbd9d748ee32ecc1f6 Mon Sep 17 00:00:00 2001 From: Bart Massey Date: Mon, 21 Sep 2009 11:33:06 -0700 Subject: [PATCH 031/235] Staging: comedi: ni_labpc_cs: removed null initialization of static Signed-off-by: Bart Massey Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_labpc_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index db6e05e2ebba..bf6ce0284af3 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c @@ -76,7 +76,7 @@ NI manuals: #include #include -static struct pcmcia_device *pcmcia_cur_dev = NULL; +static struct pcmcia_device *pcmcia_cur_dev; static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it); -- GitLab From 92c4bad75cef701af881c8caffa1b02f7891a295 Mon Sep 17 00:00:00 2001 From: Bart Massey Date: Mon, 21 Sep 2009 11:38:07 -0700 Subject: [PATCH 032/235] Staging: comedi: ni_labpc_cs: removed null check from kfree Signed-off-by: Bart Massey Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_labpc_cs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index bf6ce0284af3..300ecb2ac9ec 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c @@ -272,9 +272,8 @@ static void labpc_cs_detach(struct pcmcia_device *link) labpc_release(link); } - /* This points to the parent local_info_t struct */ - if (link->priv) - kfree(link->priv); + /* This points to the parent local_info_t struct (may be null) */ + kfree(link->priv); } /* labpc_cs_detach */ -- GitLab From 63a4eca57cacd9043da71287590525261563a1f2 Mon Sep 17 00:00:00 2001 From: Bart Massey Date: Mon, 21 Sep 2009 11:48:52 -0700 Subject: [PATCH 033/235] Staging: comedi: ni_labpc_cs: wrapped long comments Signed-off-by: Bart Massey Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_labpc_cs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index 300ecb2ac9ec..0b963bb3328b 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c @@ -83,7 +83,8 @@ static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it); static const struct labpc_board_struct labpc_cs_boards[] = { { .name = "daqcard-1200", - .device_id = 0x103, /* 0x10b is manufacturer id, 0x103 is device id */ + .device_id = 0x103, /* 0x10b is manufacturer id, + 0x103 is device id */ .ai_speed = 10000, .bustype = pcmcia_bustype, .register_layout = labpc_1200_layout, -- GitLab From f36624369ff2922f3aa8b5cef0376bcec759ebef Mon Sep 17 00:00:00 2001 From: Shane Warden Date: Tue, 22 Sep 2009 16:13:02 -0700 Subject: [PATCH 034/235] Staging: comedi: comedi_compat32: Fixed checkpatch.pl issues Signed-off-by: Shane Warden Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_compat32.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c index 9810e37845c7..e2d7e6975263 100644 --- a/drivers/staging/comedi/comedi_compat32.c +++ b/drivers/staging/comedi/comedi_compat32.c @@ -27,7 +27,7 @@ #define __NO_VERSION__ #include "comedi.h" #include -#include +#include #include "comedi_compat32.h" @@ -186,8 +186,8 @@ static int compat_rangeinfo(struct file *file, unsigned long arg) } /* Copy 32-bit cmd structure to native cmd structure. */ -static int get_compat_cmd(struct comedi_cmd __user * cmd, - struct comedi32_cmd_struct __user * cmd32) +static int get_compat_cmd(struct comedi_cmd __user *cmd, + struct comedi32_cmd_struct __user *cmd32) { int err; union { @@ -237,8 +237,8 @@ static int get_compat_cmd(struct comedi_cmd __user * cmd, } /* Copy native cmd structure to 32-bit cmd structure. */ -static int put_compat_cmd(struct comedi32_cmd_struct __user * cmd32, - struct comedi_cmd __user * cmd) +static int put_compat_cmd(struct comedi32_cmd_struct __user *cmd32, + struct comedi_cmd __user *cmd) { int err; unsigned int temp; @@ -328,8 +328,8 @@ static int compat_cmdtest(struct file *file, unsigned long arg) } /* Copy 32-bit insn structure to native insn structure. */ -static int get_compat_insn(struct comedi_insn __user * insn, - struct comedi32_insn_struct __user * insn32) +static int get_compat_insn(struct comedi_insn __user *insn, + struct comedi32_insn_struct __user *insn32) { int err; union { @@ -372,9 +372,9 @@ static int compat_insnlist(struct file *file, unsigned long arg) insnlist32 = compat_ptr(arg); /* Get 32-bit insnlist structure. */ - if (!access_ok(VERIFY_READ, insnlist32, sizeof(*insnlist32))) { + if (!access_ok(VERIFY_READ, insnlist32, sizeof(*insnlist32))) return -EFAULT; - } + err = 0; err |= __get_user(n_insns, &insnlist32->n_insns); err |= __get_user(uptr, &insnlist32->insns); @@ -387,9 +387,9 @@ static int compat_insnlist(struct file *file, unsigned long arg) insn[n_insns])); /* Set native insnlist structure. */ - if (!access_ok(VERIFY_WRITE, &s->insnlist, sizeof(s->insnlist))) { + if (!access_ok(VERIFY_WRITE, &s->insnlist, sizeof(s->insnlist))) return -EFAULT; - } + err |= __put_user(n_insns, &s->insnlist.n_insns); err |= __put_user(&s->insn[0], &s->insnlist.insns); if (err) -- GitLab From 62eeae93080f1189894b7933d07e5f62461d1cd4 Mon Sep 17 00:00:00 2001 From: Shane Warden Date: Tue, 22 Sep 2009 16:13:04 -0700 Subject: [PATCH 035/235] Staging: comedi: comedidev.h: Fixed checkpatch.pl issues Signed-off-by: Shane Warden Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedidev.h | 60 +++++++++++++++++------------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index e8a5f7d33e7a..ebdccfdf220e 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -49,7 +49,8 @@ } while (0) #define COMEDI_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) -#define COMEDI_VERSION_CODE COMEDI_VERSION(COMEDI_MAJORVERSION, COMEDI_MINORVERSION, COMEDI_MICROVERSION) +#define COMEDI_VERSION_CODE COMEDI_VERSION(COMEDI_MAJORVERSION, \ + COMEDI_MINORVERSION, COMEDI_MICROVERSION) #define COMEDI_RELEASE VERSION #define COMEDI_INITCLEANUP_NOMODULE(x) \ @@ -58,12 +59,12 @@ static void __exit x ## _cleanup_module(void) \ {comedi_driver_unregister(&(x)); } \ module_init(x ## _init_module); \ - module_exit(x ## _cleanup_module); \ + module_exit(x ## _cleanup_module); #define COMEDI_MODULE_MACROS \ MODULE_AUTHOR("Comedi http://www.comedi.org"); \ MODULE_DESCRIPTION("Comedi low-level driver"); \ - MODULE_LICENSE("GPL"); \ + MODULE_LICENSE("GPL"); #define COMEDI_INITCLEANUP(x) \ COMEDI_MODULE_MACROS \ @@ -75,7 +76,8 @@ { \ return comedi_pci_auto_config(dev, comedi_driver.driver_name); \ } \ - static void __devexit comedi_driver ## _pci_remove(struct pci_dev *dev) \ + static void __devexit comedi_driver ## _pci_remove(\ + struct pci_dev *dev) \ { \ comedi_pci_auto_unconfig(dev); \ } \ @@ -91,7 +93,8 @@ retval = comedi_driver_register(&comedi_driver); \ if (retval < 0) \ return retval; \ - comedi_driver ## _pci_driver.name = (char *)comedi_driver.driver_name; \ + comedi_driver ## _pci_driver.name = \ + (char *)comedi_driver.driver_name; \ return pci_register_driver(&comedi_driver ## _pci_driver); \ } \ static void __exit comedi_driver ## _cleanup_module(void) \ @@ -170,14 +173,15 @@ struct comedi_subdevice { struct comedi_cmd *); int (*poll) (struct comedi_device *, struct comedi_subdevice *); int (*cancel) (struct comedi_device *, struct comedi_subdevice *); - /* int (*do_lock)(struct comedi_device *,struct comedi_subdevice *); */ - /* int (*do_unlock)(struct comedi_device *,struct comedi_subdevice *); */ + /* int (*do_lock)(struct comedi_device *, struct comedi_subdevice *); */ + /* int (*do_unlock)(struct comedi_device *, \ + struct comedi_subdevice *); */ /* called when the buffer changes */ - int (*buf_change) (struct comedi_device * dev, - struct comedi_subdevice * s, unsigned long new_size); + int (*buf_change) (struct comedi_device *dev, + struct comedi_subdevice *s, unsigned long new_size); - void (*munge) (struct comedi_device * dev, struct comedi_subdevice * s, + void (*munge) (struct comedi_device *dev, struct comedi_subdevice *s, void *data, unsigned int num_bytes, unsigned int start_chan_index); enum dma_data_direction async_dma_dir; @@ -198,16 +202,22 @@ struct comedi_async { void *prealloc_buf; /* pre-allocated buffer */ unsigned int prealloc_bufsz; /* buffer size, in bytes */ - struct comedi_buf_page *buf_page_list; /* virtual and dma address of each page */ + /* virtual and dma address of each page */ + struct comedi_buf_page *buf_page_list; unsigned n_buf_pages; /* num elements in buf_page_list */ unsigned int max_bufsize; /* maximum buffer size, bytes */ - unsigned int mmap_count; /* current number of mmaps of prealloc_buf */ - - unsigned int buf_write_count; /* byte count for writer (write completed) */ - unsigned int buf_write_alloc_count; /* byte count for writer (allocated for writing) */ - unsigned int buf_read_count; /* byte count for reader (read completed) */ - unsigned int buf_read_alloc_count; /* byte count for reader (allocated for reading) */ + /* current number of mmaps of prealloc_buf */ + unsigned int mmap_count; + + /* byte count for writer (write completed) */ + unsigned int buf_write_count; + /* byte count for writer (allocated for writing) */ + unsigned int buf_write_alloc_count; + /* byte count for reader (read completed) */ + unsigned int buf_read_count; + /* byte count for reader (allocated for reading) */ + unsigned int buf_read_alloc_count; unsigned int buf_write_ptr; /* buffer marker for writer */ unsigned int buf_read_ptr; /* buffer marker for reader */ @@ -233,7 +243,7 @@ struct comedi_async { int (*cb_func) (unsigned int flags, void *); void *cb_arg; - int (*inttrig) (struct comedi_device * dev, struct comedi_subdevice * s, + int (*inttrig) (struct comedi_device *dev, struct comedi_subdevice *s, unsigned int x); }; @@ -283,8 +293,8 @@ struct comedi_device { struct fasync_struct *async_queue; - void (*open) (struct comedi_device * dev); - void (*close) (struct comedi_device * dev); + void (*open) (struct comedi_device *dev); + void (*close) (struct comedi_device *dev); }; struct comedi_device_file_info { @@ -318,9 +328,8 @@ static const unsigned COMEDI_SUBDEVICE_MINOR_OFFSET = 1; struct comedi_device_file_info *comedi_get_device_file_info(unsigned minor); -static inline struct comedi_subdevice *comedi_get_read_subdevice(const struct - comedi_device_file_info - *info) +static inline struct comedi_subdevice *comedi_get_read_subdevice( + const struct comedi_device_file_info *info) { if (info->read_subdevice) return info->read_subdevice; @@ -329,9 +338,8 @@ static inline struct comedi_subdevice *comedi_get_read_subdevice(const struct return info->device->read_subdev; } -static inline struct comedi_subdevice *comedi_get_write_subdevice(const struct - comedi_device_file_info - *info) +static inline struct comedi_subdevice *comedi_get_write_subdevice( + const struct comedi_device_file_info *info) { if (info->write_subdevice) return info->write_subdevice; -- GitLab From d1a044083c2d09cc146f97dc2a1e7b31dc63fbfb Mon Sep 17 00:00:00 2001 From: Allison Randal Date: Thu, 24 Sep 2009 00:19:43 -0700 Subject: [PATCH 036/235] Staging: comdi: ni_at_ao.c: fix coding style error The line was too long, used braces on single line for loop body. Signed-off-by: Allison Randal Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_at_ao.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_at_ao.c b/drivers/staging/comedi/drivers/ni_at_ao.c index 8adb23739846..3778565c1f6b 100644 --- a/drivers/staging/comedi/drivers/ni_at_ao.c +++ b/drivers/staging/comedi/drivers/ni_at_ao.c @@ -32,7 +32,8 @@ Configuration options: [0] - I/O port base address [1] - IRQ (unused) [2] - DMA (unused) - [3] - analog output range, set by jumpers on hardware (0 for -10 to 10V bipolar, 1 for 0V to 10V unipolar) + [3] - analog output range, set by jumpers on hardware (0 for -10 to 10V + bipolar, 1 for 0V to 10V unipolar) */ /* @@ -431,9 +432,8 @@ static int atao_calib_insn_read(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { int i; - for (i = 0; i < insn->n; i++) { + for (i = 0; i < insn->n; i++) data[i] = 0; /* XXX */ - } return insn->n; } -- GitLab From 5256fb8818917d7c70b192dd11194a0126772bd1 Mon Sep 17 00:00:00 2001 From: matt mooney Date: Wed, 30 Sep 2009 19:24:00 -0700 Subject: [PATCH 037/235] Staging: comedi: mite.c: fix coding style - drivers/mite.c: added KERN_ facility level to printk - moved EXPORT_SYMBOL macro to follow function/variable Signed-off-by: matt mooney Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/mite.c | 231 ++++++++++++++------------ 1 file changed, 121 insertions(+), 110 deletions(-) diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index e652f3b270b1..188f58042746 100644 --- a/drivers/staging/comedi/drivers/mite.c +++ b/drivers/staging/comedi/drivers/mite.c @@ -64,6 +64,7 @@ MODULE_LICENSE("GPL"); struct mite_struct *mite_devices; +EXPORT_SYMBOL(mite_devices); #define TOP_OF_PAGE(x) ((x)|(~(PAGE_MASK))) @@ -80,7 +81,7 @@ void mite_init(void) mite = kzalloc(sizeof(*mite), GFP_KERNEL); if (!mite) { - printk("mite: allocation failed\n"); + printk(KERN_ERR "mite: allocation failed\n"); pci_dev_put(pcidev); return; } @@ -99,14 +100,14 @@ void mite_init(void) static void dump_chip_signature(u32 csigr_bits) { - printk - ("mite: version = %i, type = %i, mite mode = %i, interface mode = %i\n", - mite_csigr_version(csigr_bits), mite_csigr_type(csigr_bits), - mite_csigr_mmode(csigr_bits), mite_csigr_imode(csigr_bits)); - printk - ("mite: num channels = %i, write post fifo depth = %i, wins = %i, iowins = %i\n", - mite_csigr_dmac(csigr_bits), mite_csigr_wpdep(csigr_bits), - mite_csigr_wins(csigr_bits), mite_csigr_iowins(csigr_bits)); + printk(KERN_INFO "mite: version = %i, type = %i, mite mode = %i," + "interface mode = %i\n", + mite_csigr_version(csigr_bits), mite_csigr_type(csigr_bits), + mite_csigr_mmode(csigr_bits), mite_csigr_imode(csigr_bits)); + printk(KERN_INFO "mite: num channels = %i, write post fifo depth = %i," + "wins = %i, iowins = %i\n", + mite_csigr_dmac(csigr_bits), mite_csigr_wpdep(csigr_bits), + mite_csigr_wins(csigr_bits), mite_csigr_iowins(csigr_bits)); } unsigned mite_fifo_size(struct mite_struct *mite, unsigned channel) @@ -126,7 +127,7 @@ int mite_setup2(struct mite_struct *mite, unsigned use_iodwbsr_1) unsigned unknown_dma_burst_bits; if (comedi_pci_enable(mite->pcidev, "mite")) { - printk("error enabling mite and requesting io regions\n"); + printk(KERN_ERR "error enabling mite and requesting io regions\n"); return -EIO; } pci_set_master(mite->pcidev); @@ -135,27 +136,30 @@ int mite_setup2(struct mite_struct *mite, unsigned use_iodwbsr_1) mite->mite_phys_addr = addr; mite->mite_io_addr = ioremap(addr, PCI_MITE_SIZE); if (!mite->mite_io_addr) { - printk("failed to remap mite io memory address\n"); + printk(KERN_ERR "Failed to remap mite io memory address\n"); return -ENOMEM; } - printk("MITE:0x%08llx mapped to %p ", + printk(KERN_INFO "MITE:0x%08llx mapped to %p ", (unsigned long long)mite->mite_phys_addr, mite->mite_io_addr); addr = pci_resource_start(mite->pcidev, 1); mite->daq_phys_addr = addr; length = pci_resource_len(mite->pcidev, 1); - /* In case of a 660x board, DAQ size is 8k instead of 4k (see as shown by lspci output) */ + /* + * In case of a 660x board, DAQ size is 8k instead of 4k + * (see as shown by lspci output) + */ mite->daq_io_addr = ioremap(mite->daq_phys_addr, length); if (!mite->daq_io_addr) { - printk("failed to remap daq io memory address\n"); + printk(KERN_ERR "Failed to remap daq io memory address\n"); return -ENOMEM; } - printk("DAQ:0x%08llx mapped to %p\n", + printk(KERN_INFO "DAQ:0x%08llx mapped to %p\n", (unsigned long long)mite->daq_phys_addr, mite->daq_io_addr); if (use_iodwbsr_1) { writel(0, mite->mite_io_addr + MITE_IODWBSR); - printk("mite: using I/O Window Base Size register 1\n"); + printk(KERN_INFO "mite: using I/O Window Base Size register 1\n"); writel(mite->daq_phys_addr | WENAB | MITE_IODWBSR_1_WSIZE_bits(length), mite->mite_io_addr + MITE_IODWBSR_1); @@ -164,11 +168,12 @@ int mite_setup2(struct mite_struct *mite, unsigned use_iodwbsr_1) writel(mite->daq_phys_addr | WENAB, mite->mite_io_addr + MITE_IODWBSR); } - /* make sure dma bursts work. I got this from running a bus analyzer - on a pxi-6281 and a pxi-6713. 6713 powered up with register value - of 0x61f and bursts worked. 6281 powered up with register value of - 0x1f and bursts didn't work. The NI windows driver reads the register, - then does a bitwise-or of 0x600 with it and writes it back. + /* + * make sure dma bursts work. I got this from running a bus analyzer + * on a pxi-6281 and a pxi-6713. 6713 powered up with register value + * of 0x61f and bursts worked. 6281 powered up with register value of + * 0x1f and bursts didn't work. The NI windows driver reads the + * register, then does a bitwise-or of 0x600 with it and writes it back. */ unknown_dma_burst_bits = readl(mite->mite_io_addr + MITE_UNKNOWN_DMA_BURST_REG); @@ -179,9 +184,9 @@ int mite_setup2(struct mite_struct *mite, unsigned use_iodwbsr_1) csigr_bits = readl(mite->mite_io_addr + MITE_CSIGR); mite->num_channels = mite_csigr_dmac(csigr_bits); if (mite->num_channels > MAX_MITE_DMA_CHANNELS) { - printk - ("mite: bug? chip claims to have %i dma channels. Setting to %i.\n", - mite->num_channels, MAX_MITE_DMA_CHANNELS); + printk(KERN_WARNING "mite: bug? chip claims to have %i dma " + "channels. Setting to %i.\n", + mite->num_channels, MAX_MITE_DMA_CHANNELS); mite->num_channels = MAX_MITE_DMA_CHANNELS; } dump_chip_signature(csigr_bits); @@ -194,16 +199,18 @@ int mite_setup2(struct mite_struct *mite, unsigned use_iodwbsr_1) mite->mite_io_addr + MITE_CHCR(i)); } mite->fifo_size = mite_fifo_size(mite, 0); - printk("mite: fifo size is %i.\n", mite->fifo_size); + printk(KERN_INFO "mite: fifo size is %i.\n", mite->fifo_size); mite->used = 1; return 0; } +EXPORT_SYMBOL(mite_setup2); int mite_setup(struct mite_struct *mite) { return mite_setup2(mite, 0); } +EXPORT_SYMBOL(mite_setup); void mite_cleanup(void) { @@ -238,22 +245,23 @@ void mite_unsetup(struct mite_struct *mite) mite->used = 0; } +EXPORT_SYMBOL(mite_unsetup); void mite_list_devices(void) { struct mite_struct *mite, *next; - printk("Available NI device IDs:"); + printk(KERN_INFO "Available NI device IDs:"); if (mite_devices) for (mite = mite_devices; mite; mite = next) { next = mite->next; - printk(" 0x%04x", mite_device_id(mite)); + printk(KERN_INFO " 0x%04x", mite_device_id(mite)); if (mite->used) - printk("(used)"); + printk(KERN_INFO "(used)"); } - printk("\n"); - + printk(KERN_INFO "\n"); } +EXPORT_SYMBOL(mite_list_devices); struct mite_channel *mite_request_channel_in_range(struct mite_struct *mite, struct @@ -265,7 +273,9 @@ struct mite_channel *mite_request_channel_in_range(struct mite_struct *mite, unsigned long flags; struct mite_channel *channel = NULL; - /* spin lock so mite_release_channel can be called safely from interrupts */ + /* spin lock so mite_release_channel can be called safely + * from interrupts + */ spin_lock_irqsave(&mite->lock, flags); for (i = min_channel; i <= max_channel; ++i) { if (mite->channel_allocated[i] == 0) { @@ -278,6 +288,7 @@ struct mite_channel *mite_request_channel_in_range(struct mite_struct *mite, spin_unlock_irqrestore(&mite->lock, flags); return channel; } +EXPORT_SYMBOL(mite_request_channel_in_range); void mite_release_channel(struct mite_channel *mite_chan) { @@ -289,8 +300,10 @@ void mite_release_channel(struct mite_channel *mite_chan) if (mite->channel_allocated[mite_chan->channel]) { mite_dma_disarm(mite_chan); mite_dma_reset(mite_chan); -/* disable all channel's interrupts (do it after disarm/reset so -MITE_CHCR reg isn't changed while dma is still active!) */ + /* + * disable all channel's interrupts (do it after disarm/reset so + * MITE_CHCR reg isn't changed while dma is still active!) + */ writel(CHCR_CLR_DMA_IE | CHCR_CLR_LINKP_IE | CHCR_CLR_SAR_IE | CHCR_CLR_DONE_IE | CHCR_CLR_MRDY_IE | CHCR_CLR_DRDY_IE | @@ -302,6 +315,7 @@ MITE_CHCR reg isn't changed while dma is still active!) */ } spin_unlock_irqrestore(&mite->lock, flags); } +EXPORT_SYMBOL(mite_release_channel); void mite_dma_arm(struct mite_channel *mite_chan) { @@ -310,8 +324,10 @@ void mite_dma_arm(struct mite_channel *mite_chan) unsigned long flags; MDPRINTK("mite_dma_arm ch%i\n", channel); - /* memory barrier is intended to insure any twiddling with the buffer - is done before writing to the mite to arm dma transfer */ + /* + * memory barrier is intended to insure any twiddling with the buffer + * is done before writing to the mite to arm dma transfer + */ smp_mb(); /* arm */ chor = CHOR_START; @@ -322,6 +338,7 @@ void mite_dma_arm(struct mite_channel *mite_chan) spin_unlock_irqrestore(&mite->lock, flags); /* mite_dma_tcr(mite, channel); */ } +EXPORT_SYMBOL(mite_dma_arm); /**************************************/ @@ -354,7 +371,7 @@ int mite_buf_change(struct mite_dma_descriptor_ring *ring, n_links * sizeof(struct mite_dma_descriptor), &ring->descriptors_dma_addr, GFP_KERNEL); if (!ring->descriptors) { - printk("mite: ring buffer allocation failed\n"); + printk(KERN_ERR "mite: ring buffer allocation failed\n"); return -ENOMEM; } ring->n_links = n_links; @@ -370,11 +387,14 @@ int mite_buf_change(struct mite_dma_descriptor_ring *ring, } ring->descriptors[n_links - 1].next = cpu_to_le32(ring->descriptors_dma_addr); - /* barrier is meant to insure that all the writes to the dma descriptors - have completed before the dma controller is commanded to read them */ + /* + * barrier is meant to insure that all the writes to the dma descriptors + * have completed before the dma controller is commanded to read them + */ smp_wmb(); return 0; } +EXPORT_SYMBOL(mite_buf_change); void mite_prep_dma(struct mite_channel *mite_chan, unsigned int num_device_bits, unsigned int num_memory_bits) @@ -395,16 +415,19 @@ void mite_prep_dma(struct mite_channel *mite_chan, * Link Complete Interrupt: interrupt every time a link * in MITE_RING is completed. This can generate a lot of * extra interrupts, but right now we update the values - * of buf_int_ptr and buf_int_count at each interrupt. A + * of buf_int_ptr and buf_int_count at each interrupt. A * better method is to poll the MITE before each user * "read()" to calculate the number of bytes available. */ chcr |= CHCR_SET_LC_IE; if (num_memory_bits == 32 && num_device_bits == 16) { - /* Doing a combined 32 and 16 bit byteswap gets the 16 bit samples into the fifo in the right order. - Tested doing 32 bit memory to 16 bit device transfers to the analog out of a pxi-6281, - which has mite version = 1, type = 4. This also works for dma reads from the counters - on e-series boards. */ + /* + * Doing a combined 32 and 16 bit byteswap gets the 16 bit + * samples into the fifo in the right order. Tested doing 32 bit + * memory to 16 bit device transfers to the analog out of a + * pxi-6281, which has mite version = 1, type = 4. This also + * works for dma reads from the counters on e-series boards. + */ chcr |= CHCR_BYTE_SWAP_DEVICE | CHCR_BYTE_SWAP_MEMORY; } if (mite_chan->dir == COMEDI_INPUT) @@ -425,7 +448,8 @@ void mite_prep_dma(struct mite_channel *mite_chan, mcr |= CR_PSIZE32; break; default: - printk("mite: bug! invalid mem bit width for dma transfer\n"); + printk(KERN_WARNING "mite: bug! invalid mem bit width for dma " + "transfer\n"); break; } writel(mcr, mite->mite_io_addr + MITE_MCR(mite_chan->channel)); @@ -444,7 +468,8 @@ void mite_prep_dma(struct mite_channel *mite_chan, dcr |= CR_PSIZE32; break; default: - printk("mite: bug! invalid dev bit width for dma transfer\n"); + printk(KERN_WARNING "mite: bug! invalid dev bit width for dma " + "transfer\n"); break; } writel(dcr, mite->mite_io_addr + MITE_DCR(mite_chan->channel)); @@ -462,6 +487,7 @@ void mite_prep_dma(struct mite_channel *mite_chan, MDPRINTK("exit mite_prep_dma\n"); } +EXPORT_SYMBOL(mite_prep_dma); u32 mite_device_bytes_transferred(struct mite_channel *mite_chan) { @@ -469,48 +495,53 @@ u32 mite_device_bytes_transferred(struct mite_channel *mite_chan) return readl(mite->mite_io_addr + MITE_DAR(mite_chan->channel)); } -u32 mite_bytes_in_transit(struct mite_channel * mite_chan) +u32 mite_bytes_in_transit(struct mite_channel *mite_chan) { struct mite_struct *mite = mite_chan->mite; return readl(mite->mite_io_addr + MITE_FCR(mite_chan->channel)) & 0x000000FF; } +EXPORT_SYMBOL(mite_bytes_in_transit); -/* returns lower bound for number of bytes transferred from device to memory */ -u32 mite_bytes_written_to_memory_lb(struct mite_channel * mite_chan) +/* returns lower bound for number of bytes transferred from device to memory */ +u32 mite_bytes_written_to_memory_lb(struct mite_channel *mite_chan) { u32 device_byte_count; device_byte_count = mite_device_bytes_transferred(mite_chan); return device_byte_count - mite_bytes_in_transit(mite_chan); } +EXPORT_SYMBOL(mite_bytes_written_to_memory_lb); -/* returns upper bound for number of bytes transferred from device to memory */ -u32 mite_bytes_written_to_memory_ub(struct mite_channel * mite_chan) +/* returns upper bound for number of bytes transferred from device to memory */ +u32 mite_bytes_written_to_memory_ub(struct mite_channel *mite_chan) { u32 in_transit_count; in_transit_count = mite_bytes_in_transit(mite_chan); return mite_device_bytes_transferred(mite_chan) - in_transit_count; } +EXPORT_SYMBOL(mite_bytes_written_to_memory_ub); -/* returns lower bound for number of bytes read from memory for transfer to device */ -u32 mite_bytes_read_from_memory_lb(struct mite_channel * mite_chan) +/* returns lower bound for number of bytes read from memory to device */ +u32 mite_bytes_read_from_memory_lb(struct mite_channel *mite_chan) { u32 device_byte_count; device_byte_count = mite_device_bytes_transferred(mite_chan); return device_byte_count + mite_bytes_in_transit(mite_chan); } +EXPORT_SYMBOL(mite_bytes_read_from_memory_lb); -/* returns upper bound for number of bytes read from memory for transfer to device */ -u32 mite_bytes_read_from_memory_ub(struct mite_channel * mite_chan) +/* returns upper bound for number of bytes read from memory to device */ +u32 mite_bytes_read_from_memory_ub(struct mite_channel *mite_chan) { u32 in_transit_count; in_transit_count = mite_bytes_in_transit(mite_chan); return mite_device_bytes_transferred(mite_chan) + in_transit_count; } +EXPORT_SYMBOL(mite_bytes_read_from_memory_ub); unsigned mite_dma_tcr(struct mite_channel *mite_chan) { @@ -525,6 +556,7 @@ unsigned mite_dma_tcr(struct mite_channel *mite_chan) return tcr; } +EXPORT_SYMBOL(mite_dma_tcr); void mite_dma_disarm(struct mite_channel *mite_chan) { @@ -535,6 +567,7 @@ void mite_dma_disarm(struct mite_channel *mite_chan) chor = CHOR_ABORT; writel(chor, mite->mite_io_addr + MITE_CHOR(mite_chan->channel)); } +EXPORT_SYMBOL(mite_dma_disarm); int mite_sync_input_dma(struct mite_channel *mite_chan, struct comedi_async *async) @@ -544,7 +577,7 @@ int mite_sync_input_dma(struct mite_channel *mite_chan, const unsigned bytes_per_scan = cfc_bytes_per_scan(async->subdevice); old_alloc_count = async->buf_write_alloc_count; - /* write alloc as much as we can */ + /* write alloc as much as we can */ comedi_buf_write_alloc(async, async->prealloc_bufsz); nbytes = mite_bytes_written_to_memory_lb(mite_chan); @@ -571,6 +604,7 @@ int mite_sync_input_dma(struct mite_channel *mite_chan, async->events |= COMEDI_CB_BLOCK; return 0; } +EXPORT_SYMBOL(mite_sync_input_dma); int mite_sync_output_dma(struct mite_channel *mite_chan, struct comedi_async *async) @@ -593,7 +627,7 @@ int mite_sync_output_dma(struct mite_channel *mite_chan, (int)(nbytes_ub - stop_count) > 0) nbytes_ub = stop_count; if ((int)(nbytes_ub - old_alloc_count) > 0) { - printk("mite: DMA underrun\n"); + printk(KERN_ERR "mite: DMA underrun\n"); async->events |= COMEDI_CB_OVERFLOW; return -1; } @@ -607,6 +641,7 @@ int mite_sync_output_dma(struct mite_channel *mite_chan, } return 0; } +EXPORT_SYMBOL(mite_sync_output_dma); unsigned mite_get_status(struct mite_channel *mite_chan) { @@ -625,6 +660,7 @@ unsigned mite_get_status(struct mite_channel *mite_chan) spin_unlock_irqrestore(&mite->lock, flags); return status; } +EXPORT_SYMBOL(mite_get_status); int mite_done(struct mite_channel *mite_chan) { @@ -638,6 +674,7 @@ int mite_done(struct mite_channel *mite_chan) spin_unlock_irqrestore(&mite->lock, flags); return done; } +EXPORT_SYMBOL(mite_done); #ifdef DEBUG_MITE @@ -719,46 +756,51 @@ void mite_dump_regs(struct mite_channel *mite_chan) unsigned long addr = 0; unsigned long temp = 0; - printk("mite_dump_regs ch%i\n", mite_chan->channel); - printk("mite address is =0x%08lx\n", mite_io_addr); + printk(KERN_DEBUG "mite_dump_regs ch%i\n", mite_chan->channel); + printk(KERN_DEBUG "mite address is =0x%08lx\n", mite_io_addr); addr = mite_io_addr + MITE_CHOR(channel); - printk("mite status[CHOR]at 0x%08lx =0x%08lx\n", addr, temp = - readl(addr)); + printk(KERN_DEBUG "mite status[CHOR]at 0x%08lx =0x%08lx\n", addr, + temp = readl(addr)); mite_decode(mite_CHOR_strings, temp); addr = mite_io_addr + MITE_CHCR(channel); - printk("mite status[CHCR]at 0x%08lx =0x%08lx\n", addr, temp = - readl(addr)); + printk(KERN_DEBUG "mite status[CHCR]at 0x%08lx =0x%08lx\n", addr, + temp = readl(addr)); mite_decode(mite_CHCR_strings, temp); addr = mite_io_addr + MITE_TCR(channel); - printk("mite status[TCR] at 0x%08lx =0x%08x\n", addr, readl(addr)); - addr = mite_io_addr + MITE_MCR(channel); - printk("mite status[MCR] at 0x%08lx =0x%08lx\n", addr, temp = + printk(KERN_DEBUG "mite status[TCR] at 0x%08lx =0x%08x\n", addr, readl(addr)); + addr = mite_io_addr + MITE_MCR(channel); + printk(KERN_DEBUG "mite status[MCR] at 0x%08lx =0x%08lx\n", addr, + temp = readl(addr)); mite_decode(mite_MCR_strings, temp); addr = mite_io_addr + MITE_MAR(channel); - printk("mite status[MAR] at 0x%08lx =0x%08x\n", addr, readl(addr)); - addr = mite_io_addr + MITE_DCR(channel); - printk("mite status[DCR] at 0x%08lx =0x%08lx\n", addr, temp = + printk(KERN_DEBUG "mite status[MAR] at 0x%08lx =0x%08x\n", addr, readl(addr)); + addr = mite_io_addr + MITE_DCR(channel); + printk(KERN_DEBUG "mite status[DCR] at 0x%08lx =0x%08lx\n", addr, + temp = readl(addr)); mite_decode(mite_DCR_strings, temp); addr = mite_io_addr + MITE_DAR(channel); - printk("mite status[DAR] at 0x%08lx =0x%08x\n", addr, readl(addr)); - addr = mite_io_addr + MITE_LKCR(channel); - printk("mite status[LKCR]at 0x%08lx =0x%08lx\n", addr, temp = + printk(KERN_DEBUG "mite status[DAR] at 0x%08lx =0x%08x\n", addr, readl(addr)); + addr = mite_io_addr + MITE_LKCR(channel); + printk(KERN_DEBUG "mite status[LKCR]at 0x%08lx =0x%08lx\n", addr, + temp = readl(addr)); mite_decode(mite_LKCR_strings, temp); addr = mite_io_addr + MITE_LKAR(channel); - printk("mite status[LKAR]at 0x%08lx =0x%08x\n", addr, readl(addr)); - - addr = mite_io_addr + MITE_CHSR(channel); - printk("mite status[CHSR]at 0x%08lx =0x%08lx\n", addr, temp = + printk(KERN_DEBUG "mite status[LKAR]at 0x%08lx =0x%08x\n", addr, readl(addr)); + addr = mite_io_addr + MITE_CHSR(channel); + printk(KERN_DEBUG "mite status[CHSR]at 0x%08lx =0x%08lx\n", addr, + temp = readl(addr)); mite_decode(mite_CHSR_strings, temp); addr = mite_io_addr + MITE_FCR(channel); - printk("mite status[FCR] at 0x%08lx =0x%08x\n\n", addr, readl(addr)); + printk(KERN_DEBUG "mite status[FCR] at 0x%08lx =0x%08x\n\n", addr, + readl(addr)); } +EXPORT_SYMBOL(mite_dump_regs); static void mite_decode(char **bit_str, unsigned int bits) { @@ -766,10 +808,11 @@ static void mite_decode(char **bit_str, unsigned int bits) for (i = 31; i >= 0; i--) { if (bits & (1 << i)) - printk(" %s", bit_str[i]); + printk(KERN_DEBUG " %s", bit_str[i]); } - printk("\n"); + printk(KERN_DEBUG "\n"); } +EXPORT_SYMBOL(mite_decode); #endif #ifdef MODULE @@ -785,36 +828,4 @@ void __exit cleanup_module(void) { mite_cleanup(); } - -EXPORT_SYMBOL(mite_dma_tcr); -EXPORT_SYMBOL(mite_dma_arm); -EXPORT_SYMBOL(mite_dma_disarm); -EXPORT_SYMBOL(mite_sync_input_dma); -EXPORT_SYMBOL(mite_sync_output_dma); -EXPORT_SYMBOL(mite_setup); -EXPORT_SYMBOL(mite_setup2); -EXPORT_SYMBOL(mite_unsetup); -#if 0 -EXPORT_SYMBOL(mite_kvmem_segment_load); -EXPORT_SYMBOL(mite_ll_from_kvmem); -EXPORT_SYMBOL(mite_setregs); -#endif -EXPORT_SYMBOL(mite_devices); -EXPORT_SYMBOL(mite_list_devices); -EXPORT_SYMBOL(mite_request_channel_in_range); -EXPORT_SYMBOL(mite_release_channel); -EXPORT_SYMBOL(mite_prep_dma); -EXPORT_SYMBOL(mite_buf_change); -EXPORT_SYMBOL(mite_bytes_written_to_memory_lb); -EXPORT_SYMBOL(mite_bytes_written_to_memory_ub); -EXPORT_SYMBOL(mite_bytes_read_from_memory_lb); -EXPORT_SYMBOL(mite_bytes_read_from_memory_ub); -EXPORT_SYMBOL(mite_bytes_in_transit); -EXPORT_SYMBOL(mite_get_status); -EXPORT_SYMBOL(mite_done); -#ifdef DEBUG_MITE -EXPORT_SYMBOL(mite_decode); -EXPORT_SYMBOL(mite_dump_regs); -#endif - #endif -- GitLab From 120be77b880f39dffd95342494866685488ae1f6 Mon Sep 17 00:00:00 2001 From: matt mooney Date: Wed, 30 Sep 2009 19:25:02 -0700 Subject: [PATCH 038/235] Staging: comedi: mite.h: deletion of unused functions drivers/mite.h: removed declared but undefined functions mite_ll_from_kvmem and mite_setregs Signed-off-by: matt mooney Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/mite.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/mite.h b/drivers/staging/comedi/drivers/mite.h index 0518fadc4daa..9d5049f8fa85 100644 --- a/drivers/staging/comedi/drivers/mite.h +++ b/drivers/staging/comedi/drivers/mite.h @@ -163,13 +163,6 @@ u32 mite_bytes_in_transit(struct mite_channel *mite_chan); unsigned mite_get_status(struct mite_channel *mite_chan); int mite_done(struct mite_channel *mite_chan); -#if 0 -unsigned long mite_ll_from_kvmem(struct mite_struct *mite, - struct comedi_async *async, int len); -void mite_setregs(struct mite_struct *mite, unsigned long ll_start, int chan, - int dir); -#endif - void mite_prep_dma(struct mite_channel *mite_chan, unsigned int num_device_bits, unsigned int num_memory_bits); int mite_buf_change(struct mite_dma_descriptor_ring *ring, -- GitLab From 2c146810e30f7818e95a90e36725c23facef833a Mon Sep 17 00:00:00 2001 From: Bruce Jones Date: Thu, 24 Sep 2009 14:59:52 -0700 Subject: [PATCH 039/235] Staging: comedi: ni_atmio16d: fix formating errors Correct formatting errors - in this case line length and spaces before parens. Signed-off-by: Bruce Jones Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_atmio16d.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_atmio16d.c b/drivers/staging/comedi/drivers/ni_atmio16d.c index 901833d9b772..1e35ed692059 100644 --- a/drivers/staging/comedi/drivers/ni_atmio16d.c +++ b/drivers/staging/comedi/drivers/ni_atmio16d.c @@ -200,8 +200,8 @@ struct atmio16d_private { enum { dac_2comp, dac_straight } dac0_coding, dac1_coding; const struct comedi_lrange *ao_range_type_list[2]; unsigned int ao_readback[2]; - unsigned int com_reg_1_state; /* current state of command register 1 */ - unsigned int com_reg_2_state; /* current state of command register 2 */ + unsigned int com_reg_1_state; /* current state of command register 1 */ + unsigned int com_reg_2_state; /* current state of command register 2 */ }; static void reset_counters(struct comedi_device *dev) @@ -324,7 +324,7 @@ static int atmio16d_ai_cmdtest(struct comedi_device *dev, if (err) return 1; - /* step 2: make sure trigger sources are unique and mutually compatible */ + /* step 2: make sure trigger sources are unique & mutually compatible */ /* note that mutual compatiblity is not an issue here */ if (cmd->scan_begin_src != TRIG_FOLLOW && cmd->scan_begin_src != TRIG_EXT && @@ -436,10 +436,10 @@ static int atmio16d_ai_cmd(struct comedi_device *dev, } else if (cmd->convert_arg < 655360000) { base_clock = CLOCK_100_KHZ; timer = cmd->convert_arg / 10000; - } else if (cmd->convert_arg <= 0xffffffff /* 6553600000 */ ) { + } else if (cmd->convert_arg <= 0xffffffff /* 6553600000 */) { base_clock = CLOCK_10_KHZ; timer = cmd->convert_arg / 100000; - } else if (cmd->convert_arg <= 0xffffffff /* 65536000000 */ ) { + } else if (cmd->convert_arg <= 0xffffffff /* 65536000000 */) { base_clock = CLOCK_1_KHZ; timer = cmd->convert_arg / 1000000; } @@ -504,10 +504,10 @@ static int atmio16d_ai_cmd(struct comedi_device *dev, } else if (cmd->scan_begin_arg < 655360000) { base_clock = CLOCK_100_KHZ; timer = cmd->scan_begin_arg / 10000; - } else if (cmd->scan_begin_arg < 0xffffffff /* 6553600000 */ ) { + } else if (cmd->scan_begin_arg < 0xffffffff /* 6553600000 */) { base_clock = CLOCK_10_KHZ; timer = cmd->scan_begin_arg / 100000; - } else if (cmd->scan_begin_arg < 0xffffffff /* 65536000000 */ ) { + } else if (cmd->scan_begin_arg < 0xffffffff /* 65536000000 */) { base_clock = CLOCK_1_KHZ; timer = cmd->scan_begin_arg / 1000000; } -- GitLab From 988da29c48ca2fc1144a2f11ca7f78c32b6da83b Mon Sep 17 00:00:00 2001 From: Bruce Jones Date: Thu, 24 Sep 2009 15:01:35 -0700 Subject: [PATCH 040/235] Staging: comedi: ni_atmio16d: brace fixes Fix improper use of braces in drivers/staging/comedi/drivers/ni_atmio16d.c Signed-off-by: Bruce Jones Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_atmio16d.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_atmio16d.c b/drivers/staging/comedi/drivers/ni_atmio16d.c index 1e35ed692059..d76663fabd8f 100644 --- a/drivers/staging/comedi/drivers/ni_atmio16d.c +++ b/drivers/staging/comedi/drivers/ni_atmio16d.c @@ -586,9 +586,8 @@ static int atmio16d_ai_insn_read(struct comedi_device *dev, /* read the data now */ data[i] = inw(dev->iobase + AD_FIFO_REG); /* change to two's complement if need be */ - if (devpriv->adc_coding == adc_2comp) { + if (devpriv->adc_coding == adc_2comp) data[i] ^= 0x800; - } break; } if (status & STAT_AD_OVERFLOW) { @@ -618,10 +617,8 @@ static int atmio16d_ao_insn_read(struct comedi_device *dev, printk("atmio16d_ao_insn_read\n"); #endif - for (i = 0; i < insn->n; i++) { + for (i = 0; i < insn->n; i++) data[i] = devpriv->ao_readback[CR_CHAN(insn->chanspec)]; - } - return i; } @@ -642,15 +639,13 @@ static int atmio16d_ao_insn_write(struct comedi_device *dev, d = data[i]; switch (chan) { case 0: - if (devpriv->dac0_coding == dac_2comp) { + if (devpriv->dac0_coding == dac_2comp) d ^= 0x800; - } outw(d, dev->iobase + DAC0_REG); break; case 1: - if (devpriv->dac1_coding == dac_2comp) { + if (devpriv->dac1_coding == dac_2comp) d ^= 0x800; - } outw(d, dev->iobase + DAC1_REG); break; default: @@ -855,11 +850,10 @@ static int atmio16d_attach(struct comedi_device *dev, /* 8255 subdevice */ s++; - if (boardtype->has_8255) { + if (boardtype->has_8255) subdev_8255_init(dev, s, NULL, dev->iobase); - } else { + else s->type = COMEDI_SUBD_UNUSED; - } /* don't yet know how to deal with counter/timers */ #if 0 -- GitLab From ce5ade4f74139aad964ee4c15017a5725e3d3511 Mon Sep 17 00:00:00 2001 From: Bruce Jones Date: Thu, 24 Sep 2009 15:02:36 -0700 Subject: [PATCH 041/235] Staging: comedi: nt_atmio16d: space and tab fixes Turn spaces into tabs to keep scripts/checkpatch.pl happy. The actual changes here are in a comment, so the script is just being silly. Signed-off-by: Bruce Jones Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_atmio16d.c | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_atmio16d.c b/drivers/staging/comedi/drivers/ni_atmio16d.c index d76663fabd8f..c8876dce570f 100644 --- a/drivers/staging/comedi/drivers/ni_atmio16d.c +++ b/drivers/staging/comedi/drivers/ni_atmio16d.c @@ -700,29 +700,29 @@ static int atmio16d_dio_insn_config(struct comedi_device *dev, /* options[0] - I/O port options[1] - MIO irq - 0 == no irq - N == irq N {3,4,5,6,7,9,10,11,12,14,15} + 0 == no irq + N == irq N {3,4,5,6,7,9,10,11,12,14,15} options[2] - DIO irq - 0 == no irq - N == irq N {3,4,5,6,7,9} + 0 == no irq + N == irq N {3,4,5,6,7,9} options[3] - DMA1 channel - 0 == no DMA - N == DMA N {5,6,7} + 0 == no DMA + N == DMA N {5,6,7} options[4] - DMA2 channel - 0 == no DMA - N == DMA N {5,6,7} + 0 == no DMA + N == DMA N {5,6,7} options[5] - a/d mux - 0=differential, 1=single + 0=differential, 1=single options[6] - a/d range - 0=bipolar10, 1=bipolar5, 2=unipolar10 + 0=bipolar10, 1=bipolar5, 2=unipolar10 options[7] - dac0 range - 0=bipolar, 1=unipolar + 0=bipolar, 1=unipolar options[8] - dac0 reference - 0=internal, 1=external + 0=internal, 1=external options[9] - dac0 coding - 0=2's comp, 1=straight binary + 0=2's comp, 1=straight binary options[10] - dac1 range options[11] - dac1 reference -- GitLab From 3c9cd618b9aa829dce14880d2ea1e12ea886c2c9 Mon Sep 17 00:00:00 2001 From: Bruce Jones Date: Thu, 24 Sep 2009 15:03:36 -0700 Subject: [PATCH 042/235] Staging: comedi: ni_atmio16d: printk fixups Fix improper use of printks in this driver. Most are debug messages under a DEBUG #ifdef, a few are info/warnings that should get logged for driver error conditions. Signed-off-by: Bruce Jones Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_atmio16d.c | 30 +++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_atmio16d.c b/drivers/staging/comedi/drivers/ni_atmio16d.c index c8876dce570f..3af879ab0e2f 100644 --- a/drivers/staging/comedi/drivers/ni_atmio16d.c +++ b/drivers/staging/comedi/drivers/ni_atmio16d.c @@ -279,7 +279,9 @@ static irqreturn_t atmio16d_interrupt(int irq, void *d) struct comedi_device *dev = d; struct comedi_subdevice *s = dev->subdevices + 0; -/* printk("atmio16d_interrupt!\n"); */ +#ifdef DEBUG1 + printk(KERN_DEBUG "atmio16d_interrupt!\n"); +#endif comedi_buf_put(s->async, inw(dev->iobase + AD_FIFO_REG)); @@ -293,7 +295,7 @@ static int atmio16d_ai_cmdtest(struct comedi_device *dev, { int err = 0, tmp; #ifdef DEBUG1 - printk("atmio16d_ai_cmdtest\n"); + printk(KERN_DEBUG "atmio16d_ai_cmdtest\n"); #endif /* make sure triggers are valid */ tmp = cmd->start_src; @@ -397,7 +399,7 @@ static int atmio16d_ai_cmd(struct comedi_device *dev, unsigned int sample_count, tmp, chan, gain; int i; #ifdef DEBUG1 - printk("atmio16d_ai_cmd\n"); + printk(KERN_DEBUG "atmio16d_ai_cmd\n"); #endif /* This is slowly becoming a working command interface. * * It is still uber-experimental */ @@ -559,7 +561,7 @@ static int atmio16d_ai_insn_read(struct comedi_device *dev, int status; #ifdef DEBUG1 - printk("atmio16d_ai_insn_read\n"); + printk(KERN_DEBUG "atmio16d_ai_insn_read\n"); #endif chan = CR_CHAN(insn->chanspec); gain = CR_RANGE(insn->chanspec); @@ -580,7 +582,7 @@ static int atmio16d_ai_insn_read(struct comedi_device *dev, /* check conversion status */ status = inw(dev->iobase + STAT_REG); #ifdef DEBUG1 - printk("status=%x\n", status); + printk(KERN_DEBUG "status=%x\n", status); #endif if (status & STAT_AD_CONVAVAIL) { /* read the data now */ @@ -591,7 +593,7 @@ static int atmio16d_ai_insn_read(struct comedi_device *dev, break; } if (status & STAT_AD_OVERFLOW) { - printk("atmio16d: a/d FIFO overflow\n"); + printk(KERN_INFO "atmio16d: a/d FIFO overflow\n"); outw(0, dev->iobase + AD_CLEAR_REG); return -ETIME; @@ -599,7 +601,7 @@ static int atmio16d_ai_insn_read(struct comedi_device *dev, } /* end waiting, now check if it timed out */ if (t == ATMIO16D_TIMEOUT) { - printk("atmio16d: timeout\n"); + printk(KERN_INFO "atmio16d: timeout\n"); return -ETIME; } @@ -614,7 +616,7 @@ static int atmio16d_ao_insn_read(struct comedi_device *dev, { int i; #ifdef DEBUG1 - printk("atmio16d_ao_insn_read\n"); + printk(KERN_DEBUG "atmio16d_ao_insn_read\n"); #endif for (i = 0; i < insn->n; i++) @@ -630,7 +632,7 @@ static int atmio16d_ao_insn_write(struct comedi_device *dev, int chan; int d; #ifdef DEBUG1 - printk("atmio16d_ao_insn_write\n"); + printk(KERN_DEBUG "atmio16d_ao_insn_write\n"); #endif chan = CR_CHAN(insn->chanspec); @@ -740,7 +742,7 @@ static int atmio16d_attach(struct comedi_device *dev, /* make sure the address range is free and allocate it */ iobase = it->options[0]; - printk("comedi%d: atmio16d: 0x%04lx ", dev->minor, iobase); + printk(KERN_INFO "comedi%d: atmio16d: 0x%04lx ", dev->minor, iobase); if (!request_region(iobase, ATMIO16D_SIZE, "ni_atmio16d")) { printk("I/O port conflict\n"); return -EIO; @@ -767,13 +769,13 @@ static int atmio16d_attach(struct comedi_device *dev, ret = request_irq(irq, atmio16d_interrupt, 0, "atmio16d", dev); if (ret < 0) { - printk("failed to allocate irq %u\n", irq); + printk(KERN_INFO "failed to allocate irq %u\n", irq); return ret; } dev->irq = irq; - printk("( irq = %u )\n", irq); + printk(KERN_INFO "( irq = %u )\n", irq); } else { - printk("( no irq )"); + printk(KERN_INFO "( no irq )"); } /* set device options */ @@ -870,7 +872,7 @@ static int atmio16d_attach(struct comedi_device *dev, static int atmio16d_detach(struct comedi_device *dev) { - printk("comedi%d: atmio16d: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: atmio16d: remove\n", dev->minor); if (dev->subdevices && boardtype->has_8255) subdev_8255_cleanup(dev, dev->subdevices + 3); -- GitLab From 6dd60bc62988fab9977b7fd0cd14eedc6e27eecd Mon Sep 17 00:00:00 2001 From: Bruce Jones Date: Thu, 24 Sep 2009 15:39:52 -0700 Subject: [PATCH 043/235] Staging: comedi: vmk80xx: cleanup formatting Clean up formatting of a struct initializer, as per the standard conventions. Signed-off-by: Bruce Jones Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/vmk80xx.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c index c335040778f0..c34a0b9141e2 100644 --- a/drivers/staging/comedi/drivers/vmk80xx.c +++ b/drivers/staging/comedi/drivers/vmk80xx.c @@ -76,18 +76,18 @@ enum { }; static struct usb_device_id vmk80xx_id_table[] = { - {USB_DEVICE(0x10cf, 0x5500),.driver_info = DEVICE_VMK8055}, - {USB_DEVICE(0x10cf, 0x5501),.driver_info = DEVICE_VMK8055}, - {USB_DEVICE(0x10cf, 0x5502),.driver_info = DEVICE_VMK8055}, - {USB_DEVICE(0x10cf, 0x5503),.driver_info = DEVICE_VMK8055}, - {USB_DEVICE(0x10cf, 0x8061),.driver_info = DEVICE_VMK8061}, - {USB_DEVICE(0x10cf, 0x8062),.driver_info = DEVICE_VMK8061}, - {USB_DEVICE(0x10cf, 0x8063),.driver_info = DEVICE_VMK8061}, - {USB_DEVICE(0x10cf, 0x8064),.driver_info = DEVICE_VMK8061}, - {USB_DEVICE(0x10cf, 0x8065),.driver_info = DEVICE_VMK8061}, - {USB_DEVICE(0x10cf, 0x8066),.driver_info = DEVICE_VMK8061}, - {USB_DEVICE(0x10cf, 0x8067),.driver_info = DEVICE_VMK8061}, - {USB_DEVICE(0x10cf, 0x8068),.driver_info = DEVICE_VMK8061}, + {USB_DEVICE(0x10cf, 0x5500), .driver_info = DEVICE_VMK8055}, + {USB_DEVICE(0x10cf, 0x5501), .driver_info = DEVICE_VMK8055}, + {USB_DEVICE(0x10cf, 0x5502), .driver_info = DEVICE_VMK8055}, + {USB_DEVICE(0x10cf, 0x5503), .driver_info = DEVICE_VMK8055}, + {USB_DEVICE(0x10cf, 0x8061), .driver_info = DEVICE_VMK8061}, + {USB_DEVICE(0x10cf, 0x8062), .driver_info = DEVICE_VMK8061}, + {USB_DEVICE(0x10cf, 0x8063), .driver_info = DEVICE_VMK8061}, + {USB_DEVICE(0x10cf, 0x8064), .driver_info = DEVICE_VMK8061}, + {USB_DEVICE(0x10cf, 0x8065), .driver_info = DEVICE_VMK8061}, + {USB_DEVICE(0x10cf, 0x8066), .driver_info = DEVICE_VMK8061}, + {USB_DEVICE(0x10cf, 0x8067), .driver_info = DEVICE_VMK8061}, + {USB_DEVICE(0x10cf, 0x8068), .driver_info = DEVICE_VMK8061}, {} /* terminating entry */ }; -- GitLab From 2829db3eecf54ac32a870617742ebfeb1a515f43 Mon Sep 17 00:00:00 2001 From: Shane Warden Date: Tue, 22 Sep 2009 16:13:03 -0700 Subject: [PATCH 044/235] Staging: comedi: comedi_compat32.h: Fixed checkpatch.pl issues Signed-off-by: Shane Warden Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_compat32.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/comedi_compat32.h b/drivers/staging/comedi/comedi_compat32.h index fd0f8a3125a1..75d942cd73b5 100644 --- a/drivers/staging/comedi/comedi_compat32.h +++ b/drivers/staging/comedi/comedi_compat32.h @@ -28,7 +28,9 @@ #define _COMEDI_COMPAT32_H #include -#include /* For HAVE_COMPAT_IOCTL and HAVE_UNLOCKED_IOCTL */ + +/* For HAVE_COMPAT_IOCTL and HAVE_UNLOCKED_IOCTL */ +#include #ifdef CONFIG_COMPAT -- GitLab From 0dfd69bfdbf9de7021e81443c0c195f7da208a7d Mon Sep 17 00:00:00 2001 From: Bruce Jones Date: Tue, 29 Sep 2009 10:26:29 -0700 Subject: [PATCH 045/235] Staging: comedi: acl7225b.c: CodingStyle printk fixups Clean up the printk's in this driver. Signed-off-by: Bruce Jones Cc: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/acl7225b.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/acl7225b.c b/drivers/staging/comedi/drivers/acl7225b.c index c3652ef19a5f..e20c3542c069 100644 --- a/drivers/staging/comedi/drivers/acl7225b.c +++ b/drivers/staging/comedi/drivers/acl7225b.c @@ -94,10 +94,11 @@ static int acl7225b_attach(struct comedi_device *dev, iobase = it->options[0]; iorange = this_board->io_range; - printk("comedi%d: acl7225b: board=%s 0x%04x ", dev->minor, + printk(KERN_INFO "comedi%d: acl7225b: board=%s 0x%04x\n", dev->minor, this_board->name, iobase); if (!request_region(iobase, iorange, "acl7225b")) { - printk("I/O port conflict\n"); + printk(KERN_ERR "comedi%d: request_region failed - I/O port conflict\n", + dev->minor); return -EIO; } dev->board_name = this_board->name; @@ -137,14 +138,12 @@ static int acl7225b_attach(struct comedi_device *dev, s->range_table = &range_digital; s->private = (void *)ACL7225_DI_LO; - printk("\n"); - return 0; } static int acl7225b_detach(struct comedi_device *dev) { - printk("comedi%d: acl7225b: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: acl7225b: remove\n", dev->minor); if (dev->iobase) release_region(dev->iobase, this_board->io_range); -- GitLab From 1ab1774f12c4157e47e063e9c73fd8a6520afa6d Mon Sep 17 00:00:00 2001 From: Bruce Jones Date: Tue, 29 Sep 2009 10:43:29 -0700 Subject: [PATCH 046/235] Staging: comedi: adl_pci7296: CodingStyle cleanup Fix up printk's and other simple coding style issues. Signed-off-by: Bruce Jones Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci7296.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci7296.c b/drivers/staging/comedi/drivers/adl_pci7296.c index 4de6fadec78b..8602865ae6b7 100644 --- a/drivers/staging/comedi/drivers/adl_pci7296.c +++ b/drivers/staging/comedi/drivers/adl_pci7296.c @@ -82,8 +82,7 @@ static int adl_pci7296_attach(struct comedi_device *dev, int bus, slot; int ret; - printk("comedi: attempt to attach...\n"); - printk("comedi%d: adl_pci7432\n", dev->minor); + printk(KERN_INFO "comedi%d: attach adl_pci7432\n", dev->minor); dev->board_name = "pci7432"; bus = it->options[0]; @@ -110,14 +109,14 @@ static int adl_pci7296_attach(struct comedi_device *dev, } devpriv->pci_dev = pcidev; if (comedi_pci_enable(pcidev, "adl_pci7296") < 0) { - printk - ("comedi%d: Failed to enable PCI device and request regions\n", + printk(KERN_ERR "comedi%d: Failed to enable PCI device and request regions\n", dev->minor); return -EIO; } dev->iobase = pci_resource_start(pcidev, 2); - printk("comedi: base addr %4lx\n", dev->iobase); + printk(KERN_INFO "comedi: base addr %4lx\n", + dev->iobase); /* four 8255 digital io subdevices */ s = dev->subdevices + 0; @@ -145,25 +144,25 @@ static int adl_pci7296_attach(struct comedi_device *dev, if (ret < 0) return ret; - printk("attached\n"); + printk(KERN_DEBUG "comedi%d: adl_pci7432 attached\n", + dev->minor); return 1; } } - printk("comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", + printk(KERN_ERR "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", dev->minor, bus, slot); return -EIO; } static int adl_pci7296_detach(struct comedi_device *dev) { - printk("comedi%d: pci7432: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: pci7432: remove\n", dev->minor); if (devpriv && devpriv->pci_dev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pci_dev); - } pci_dev_put(devpriv->pci_dev); } /* detach four 8255 digital io subdevices */ -- GitLab From ff492d38bab77ca53b02d3a54a03b5d6ca97490a Mon Sep 17 00:00:00 2001 From: Bruce Jones Date: Tue, 29 Sep 2009 10:56:57 -0700 Subject: [PATCH 047/235] Staging: comedi: adl_pci7432: coding style cleanup Correct coding style problems in this file. Signed-off-by: Bruce Jones Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci7432.c | 32 +++++++++----------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci7432.c b/drivers/staging/comedi/drivers/adl_pci7432.c index e0844c69be77..b5a9499e438c 100644 --- a/drivers/staging/comedi/drivers/adl_pci7432.c +++ b/drivers/staging/comedi/drivers/adl_pci7432.c @@ -90,8 +90,7 @@ static int adl_pci7432_attach(struct comedi_device *dev, struct comedi_subdevice *s; int bus, slot; - printk("comedi: attempt to attach...\n"); - printk("comedi%d: adl_pci7432\n", dev->minor); + printk(KERN_INFO "comedi%d: attach adl_pci7432\n", dev->minor); dev->board_name = "pci7432"; bus = it->options[0]; @@ -118,13 +117,13 @@ static int adl_pci7432_attach(struct comedi_device *dev, } devpriv->pci_dev = pcidev; if (comedi_pci_enable(pcidev, "adl_pci7432") < 0) { - printk - ("comedi%d: Failed to enable PCI device and request regions\n", + printk(KERN_ERR "comedi%d: Failed to enable PCI device and request regions\n", dev->minor); return -EIO; } dev->iobase = pci_resource_start(pcidev, 2); - printk("comedi: base addr %4lx\n", dev->iobase); + printk(KERN_INFO "comedi: base addr %4lx\n", + dev->iobase); s = dev->subdevices + 0; s->type = COMEDI_SUBD_DI; @@ -148,25 +147,24 @@ static int adl_pci7432_attach(struct comedi_device *dev, s->range_table = &range_digital; s->insn_bits = adl_pci7432_do_insn_bits; - printk("comedi: attached\n"); - + printk(KERN_DEBUG "comedi%d: adl_pci7432 attached\n", + dev->minor); return 1; } } - printk("comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", + printk(KERN_ERR "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", dev->minor, bus, slot); return -EIO; } static int adl_pci7432_detach(struct comedi_device *dev) { - printk("comedi%d: pci7432: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: pci7432: remove\n", dev->minor); if (devpriv && devpriv->pci_dev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pci_dev); - } pci_dev_put(devpriv->pci_dev); } @@ -178,8 +176,8 @@ static int adl_pci7432_do_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - printk("comedi: pci7432_do_insn_bits called\n"); - printk("comedi: data0: %8x data1: %8x\n", data[0], data[1]); + printk(KERN_DEBUG "comedi: pci7432_do_insn_bits called\n"); + printk(KERN_DEBUG "comedi: data0: %8x data1: %8x\n", data[0], data[1]); if (insn->n != 2) return -EINVAL; @@ -188,7 +186,7 @@ static int adl_pci7432_do_insn_bits(struct comedi_device *dev, s->state &= ~data[0]; s->state |= (data[0] & data[1]); - printk("comedi: out: %8x on iobase %4lx\n", s->state, + printk(KERN_DEBUG "comedi: out: %8x on iobase %4lx\n", s->state, dev->iobase + PCI7432_DO); outl(s->state & 0xffffffff, dev->iobase + PCI7432_DO); } @@ -200,14 +198,14 @@ static int adl_pci7432_di_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - printk("comedi: pci7432_di_insn_bits called\n"); - printk("comedi: data0: %8x data1: %8x\n", data[0], data[1]); + printk(KERN_DEBUG "comedi: pci7432_di_insn_bits called\n"); + printk(KERN_DEBUG "comedi: data0: %8x data1: %8x\n", data[0], data[1]); if (insn->n != 2) return -EINVAL; data[1] = inl(dev->iobase + PCI7432_DI) & 0xffffffff; - printk("comedi: data1 %8x\n", data[1]); + printk(KERN_DEBUG "comedi: data1 %8x\n", data[1]); return 2; } -- GitLab From abdedefed70a6b5f20e40d3d5847a6d9c605bf4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevyn-Alexandre=20Par=C3=A9?= Date: Fri, 25 Sep 2009 19:32:16 -0700 Subject: [PATCH 048/235] Staging: comedi: amplc_pc263.c: fix coding style issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kevyn-Alexandre Paré Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_pc263.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index c62a7e1f81bd..c3e60a36f6c2 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -117,7 +117,8 @@ MODULE_DEVICE_TABLE(pci, pc263_pci_table); /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, - feel free to suggest moving the variable to the struct comedi_device struct. */ + feel free to suggest moving the variable to the struct comedi_device struct. +*/ #ifdef CONFIG_COMEDI_PCI struct pc263_private { /* PCI device. */ @@ -281,7 +282,8 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) ret = comedi_pci_enable(pci_dev, PC263_DRIVER_NAME); if (ret < 0) { printk(KERN_ERR - "comedi%d: error! cannot enable PCI device and request regions!\n", + "comedi%d: error! cannot enable PCI device and " + "request regions!\n", dev->minor); return ret; } -- GitLab From 56f5f24d1b5fd4562bc83cc9a06cc7c817141b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevyn-Alexandre=20Par=C3=A9?= Date: Fri, 25 Sep 2009 19:32:17 -0700 Subject: [PATCH 049/235] Staging: comedi: amplc_pc263.c: more coding style fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kevyn-Alexandre Paré Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_pc263.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index c3e60a36f6c2..15808e95ceab 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -292,9 +292,8 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) #endif { ret = pc263_request_region(dev->minor, iobase, PC263_IO_SIZE); - if (ret < 0) { + if (ret < 0) return ret; - } } dev->iobase = iobase; @@ -352,21 +351,18 @@ static int pc263_detach(struct comedi_device *dev) PC263_DRIVER_NAME); #ifdef CONFIG_COMEDI_PCI - if (devpriv) + if (devpriv) { #endif - { #ifdef CONFIG_COMEDI_PCI if (devpriv->pci_dev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pci_dev); - } pci_dev_put(devpriv->pci_dev); } else #endif { - if (dev->iobase) { + if (dev->iobase) release_region(dev->iobase, PC263_IO_SIZE); - } } } if (dev->board_name) { -- GitLab From 828684f9a6e096f9150bad523c43b75d74b9badd Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 29 Sep 2009 11:23:44 +0200 Subject: [PATCH 050/235] Staging: comedi: trivial fix of a very frequent spelling mistake something-bility is spelled as something-blity so a grep for 'blit' would find these lines this is so trivial that I didn't split it by subsystem / copy additional maintainers - all changes are to comments The only purpose is to get fewer false positives when grepping around the kernel sources. Signed-off-by: Dirk Hohndel Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_das16_cs.c | 2 +- drivers/staging/comedi/drivers/cb_pcidda.c | 2 +- drivers/staging/comedi/drivers/dmm32at.c | 2 +- drivers/staging/comedi/drivers/dt2814.c | 2 +- drivers/staging/comedi/drivers/dt282x.c | 4 ++-- drivers/staging/comedi/drivers/ni_atmio16d.c | 2 +- drivers/staging/comedi/drivers/ni_mio_common.c | 2 +- drivers/staging/comedi/drivers/ni_pcidio.c | 2 +- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 2 +- drivers/staging/comedi/drivers/rtd520.c | 2 +- drivers/staging/comedi/drivers/s626.c | 2 +- drivers/staging/comedi/drivers/skel.c | 2 +- drivers/staging/comedi/drivers/usbdux.c | 4 ++-- 13 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 39923cb388be..b47b3b1ba350 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -372,7 +372,7 @@ static int das16cs_ai_cmdtest(struct comedi_device *dev, /* step 2: make sure trigger sources are unique and mutually compatible */ - /* note that mutual compatiblity is not an issue here */ + /* note that mutual compatibility is not an issue here */ if (cmd->scan_begin_src != TRIG_TIMER && cmd->scan_begin_src != TRIG_EXT) err++; diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index 7a5d46ef1b77..782357732eed 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -497,7 +497,7 @@ static int cb_pcidda_ai_cmdtest(struct comedi_device *dev, /* step 2: make sure trigger sources are unique and mutually compatible */ - /* note that mutual compatiblity is not an issue here */ + /* note that mutual compatibility is not an issue here */ if (cmd->scan_begin_src != TRIG_TIMER && cmd->scan_begin_src != TRIG_EXT) err++; diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index aeec1ee9ad6b..9db9a467c8f8 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -629,7 +629,7 @@ static int dmm32at_ai_cmdtest(struct comedi_device *dev, /* step 2: make sure trigger sources are unique and mutually compatible */ - /* note that mutual compatiblity is not an issue here */ + /* note that mutual compatibility is not an issue here */ if (cmd->scan_begin_src != TRIG_TIMER && cmd->scan_begin_src != TRIG_EXT) err++; diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c index 0364bbf178e1..e1b73752f607 100644 --- a/drivers/staging/comedi/drivers/dt2814.c +++ b/drivers/staging/comedi/drivers/dt2814.c @@ -175,7 +175,7 @@ static int dt2814_ai_cmdtest(struct comedi_device *dev, /* step 2: make sure trigger sources are unique and mutually compatible */ - /* note that mutual compatiblity is not an issue here */ + /* note that mutual compatibility is not an issue here */ if (cmd->stop_src != TRIG_TIMER && cmd->stop_src != TRIG_EXT) err++; diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index a4c96c02fa2b..99ca294b1ec5 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -777,7 +777,7 @@ static int dt282x_ai_cmdtest(struct comedi_device *dev, /* step 2: make sure trigger sources are unique and mutually compatible */ - /* note that mutual compatiblity is not an issue here */ + /* note that mutual compatibility is not an issue here */ if (cmd->scan_begin_src != TRIG_FOLLOW && cmd->scan_begin_src != TRIG_EXT) err++; @@ -1050,7 +1050,7 @@ static int dt282x_ao_cmdtest(struct comedi_device *dev, /* step 2: make sure trigger sources are unique and mutually compatible */ - /* note that mutual compatiblity is not an issue here */ + /* note that mutual compatibility is not an issue here */ if (cmd->stop_src != TRIG_COUNT && cmd->stop_src != TRIG_NONE) err++; diff --git a/drivers/staging/comedi/drivers/ni_atmio16d.c b/drivers/staging/comedi/drivers/ni_atmio16d.c index 3af879ab0e2f..cf4f241f210a 100644 --- a/drivers/staging/comedi/drivers/ni_atmio16d.c +++ b/drivers/staging/comedi/drivers/ni_atmio16d.c @@ -327,7 +327,7 @@ static int atmio16d_ai_cmdtest(struct comedi_device *dev, return 1; /* step 2: make sure trigger sources are unique & mutually compatible */ - /* note that mutual compatiblity is not an issue here */ + /* note that mutual compatibility is not an issue here */ if (cmd->scan_begin_src != TRIG_FOLLOW && cmd->scan_begin_src != TRIG_EXT && cmd->scan_begin_src != TRIG_TIMER) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 753ee0512342..d6d49c3bbf1c 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -2207,7 +2207,7 @@ static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, /* step 2: make sure trigger sources are unique and mutually compatible */ - /* note that mutual compatiblity is not an issue here */ + /* note that mutual compatibility is not an issue here */ if (cmd->start_src != TRIG_NOW && cmd->start_src != TRIG_INT && cmd->start_src != TRIG_EXT) err++; diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index d544698f2414..2d88a5be65ff 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -795,7 +795,7 @@ static int ni_pcidio_cmdtest(struct comedi_device *dev, /* step 2: make sure trigger sources are unique and mutually compatible */ - /* note that mutual compatiblity is not an issue here */ + /* note that mutual compatibility is not an issue here */ if (cmd->start_src != TRIG_NOW && cmd->start_src != TRIG_INT) err++; if (cmd->scan_begin_src != TRIG_TIMER && diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index 5256fd933162..3325f24448b5 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -489,7 +489,7 @@ static int daqp_ai_cmdtest(struct comedi_device *dev, /* step 2: make sure trigger sources are unique and mutually compatible */ - /* note that mutual compatiblity is not an issue here */ + /* note that mutual compatibility is not an issue here */ if (cmd->scan_begin_src != TRIG_TIMER && cmd->scan_begin_src != TRIG_FOLLOW) err++; diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index f35cce597140..8626658e778c 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -1768,7 +1768,7 @@ static int rtd_ai_cmdtest(struct comedi_device *dev, /* step 2: make sure trigger sources are unique and mutually compatible */ - /* note that mutual compatiblity is not an issue here */ + /* note that mutual compatibility is not an issue here */ if (cmd->scan_begin_src != TRIG_TIMER && cmd->scan_begin_src != TRIG_EXT) { err++; diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 80d2787d1063..fdd7ab954d8c 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -1926,7 +1926,7 @@ static int s626_ai_cmdtest(struct comedi_device *dev, /* step 2: make sure trigger sources are unique and mutually compatible */ - /* note that mutual compatiblity is not an issue here */ + /* note that mutual compatibility is not an issue here */ if (cmd->scan_begin_src != TRIG_TIMER && cmd->scan_begin_src != TRIG_EXT && cmd->scan_begin_src != TRIG_FOLLOW) diff --git a/drivers/staging/comedi/drivers/skel.c b/drivers/staging/comedi/drivers/skel.c index 3dee62aa2d7b..aba57d93dd3d 100644 --- a/drivers/staging/comedi/drivers/skel.c +++ b/drivers/staging/comedi/drivers/skel.c @@ -399,7 +399,7 @@ static int skel_ai_cmdtest(struct comedi_device *dev, /* step 2: make sure trigger sources are unique and mutually compatible */ - /* note that mutual compatiblity is not an issue here */ + /* note that mutual compatibility is not an issue here */ if (cmd->scan_begin_src != TRIG_TIMER && cmd->scan_begin_src != TRIG_EXT) err++; diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index cca4e869f0ec..cec028e0db13 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -979,7 +979,7 @@ static int usbdux_ai_cmdtest(struct comedi_device *dev, /* * step 2: make sure trigger sources are unique and mutually compatible - * note that mutual compatiblity is not an issue here + * note that mutual compatibility is not an issue here */ if (cmd->scan_begin_src != TRIG_FOLLOW && cmd->scan_begin_src != TRIG_EXT && @@ -1557,7 +1557,7 @@ static int usbdux_ao_cmdtest(struct comedi_device *dev, /* * step 2: make sure trigger sources are unique and mutually compatible - * note that mutual compatiblity is not an issue here + * note that mutual compatibility is not an issue here */ if (cmd->scan_begin_src != TRIG_FOLLOW && cmd->scan_begin_src != TRIG_EXT && -- GitLab From b055d0d3c74a7b9bbf18806b2814632a9da922f3 Mon Sep 17 00:00:00 2001 From: Daniel Patrick Johnson Date: Wed, 7 Oct 2009 23:52:25 +0000 Subject: [PATCH 051/235] Staging: comedi: ni_mio_cs.c: coding style cleanup Signed-off-by: Daniel Patrick Johnson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_mio_cs.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c index d692f4bb47ea..dc4849a40c97 100644 --- a/drivers/staging/comedi/drivers/ni_mio_cs.c +++ b/drivers/staging/comedi/drivers/ni_mio_cs.c @@ -250,9 +250,8 @@ static int mio_cs_detach(struct comedi_device *dev) /* PCMCIA layer frees the IO region */ - if (dev->irq) { + if (dev->irq) free_irq(dev->irq, dev); - } return 0; } @@ -293,9 +292,8 @@ static void cs_detach(struct pcmcia_device *link) { DPRINTK("cs_detach(link=%p)\n", link); - if (link->dev_node) { + if (link->dev_node) cs_release(link); - } } static int mio_cs_suspend(struct pcmcia_device *link) @@ -387,9 +385,8 @@ static int mio_cs_attach(struct comedi_device *dev, struct comedi_devconfig *it) } printk("\n"); printk(" board fingerprint (windowed):"); - for (i = 0; i < 10; i++) { + for (i = 0; i < 10; i++) printk(" 0x%04x", win_in(i)); - } printk("\n"); } #endif -- GitLab From 22d89f4abfe492ac347a41e053151e4a6c2787aa Mon Sep 17 00:00:00 2001 From: Daniel Patrick Johnson Date: Wed, 14 Oct 2009 02:04:21 +0000 Subject: [PATCH 052/235] Staging: Comedi: pcm_common: Fixed all checkpatch issues Signed-off-by: Daniel Patrick Johnson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcm_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcm_common.c b/drivers/staging/comedi/drivers/pcm_common.c index ebd9838232af..52c2a6698214 100644 --- a/drivers/staging/comedi/drivers/pcm_common.c +++ b/drivers/staging/comedi/drivers/pcm_common.c @@ -41,7 +41,8 @@ int comedi_pcm_cmdtest(struct comedi_device *dev, if (err) return 1; - /* step 2: make sure trigger sources are unique and mutually compatible */ + /* step 2: make sure trigger sources are unique and + * mutually compatible */ /* these tests are true if more than one _src bit is set */ if ((cmd->start_src & (cmd->start_src - 1)) != 0) @@ -107,5 +108,4 @@ int comedi_pcm_cmdtest(struct comedi_device *dev, return 0; } - EXPORT_SYMBOL(comedi_pcm_cmdtest); -- GitLab From d2d08955e77a84a0a022dfa9e6f4b4b6c6773281 Mon Sep 17 00:00:00 2001 From: Daniel Patrick Johnson Date: Wed, 14 Oct 2009 02:04:23 +0000 Subject: [PATCH 053/235] Staging: comedi: pcmmio: Coding style cleanup Signed-off-by: Daniel Patrick Johnson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcmmio.c | 121 ++++++++++++++++-------- 1 file changed, 82 insertions(+), 39 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index d812c2c3af12..c764b28fb319 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -32,8 +32,10 @@ Winsystems. This board is a PC-104 based I/O board. It contains four subdevices: subdevice 0 - 16 channels of 16-bit AI subdevice 1 - 8 channels of 16-bit AO - subdevice 2 - first 24 channels of the 48 channel of DIO (with edge-triggered interrupt support) - subdevice 3 - last 24 channels of the 48 channel DIO (no interrupt support for this bank of channels) + subdevice 2 - first 24 channels of the 48 channel of DIO + (with edge-triggered interrupt support) + subdevice 3 - last 24 channels of the 48 channel DIO + (no interrupt support for this bank of channels) Some notes: @@ -70,7 +72,8 @@ four subdevices: Configuration Options: [0] - I/O port base address - [1] - IRQ (optional -- for edge-detect interrupt support only, leave out if you don't need this feature) + [1] - IRQ (optional -- for edge-detect interrupt support only, + leave out if you don't need this feature) */ #include @@ -115,9 +118,11 @@ Configuration Options: #define REG_PORT4 0x4 #define REG_PORT5 0x5 #define REG_INT_PENDING 0x6 -#define REG_PAGELOCK 0x7 /* page selector register, upper 2 bits select a page - and bits 0-5 are used to 'lock down' a particular - port above to make it readonly. */ +#define REG_PAGELOCK 0x7 /* + * page selector register, upper 2 bits select + * a page and bits 0-5 are used to 'lock down' + * a particular port above to make it readonly. + */ #define REG_POL0 0x8 #define REG_POL1 0x9 #define REG_POL2 0xA @@ -134,7 +139,7 @@ Configuration Options: #define REG_PAGE_BITOFFSET 6 #define REG_LOCK_BITOFFSET 0 #define REG_PAGE_MASK (~((0x1<asics[asic].num = asic; devpriv->asics[asic].iobase = dev->iobase + 16 + asic * ASIC_IOSIZE; - devpriv->asics[asic].irq = 0; /* this gets actually set at the end of - this function when we - request_irqs */ + /* + * this gets actually set at the end of this function when we + * request_irqs + */ + devpriv->asics[asic].irq = 0; spin_lock_init(&devpriv->asics[asic].spinlock); } @@ -463,7 +492,10 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (thisasic_chanct < CHANS_PER_PORT * INTR_PORTS_PER_ASIC && subpriv->dio.intr.asic < 0) { - /* this is an interrupt subdevice, so setup the struct */ + /* + * this is an interrupt subdevice, + * so setup the struct + */ subpriv->dio.intr.asic = asic; subpriv->dio.intr.active = 0; subpriv->dio.intr.stop_count = 0; @@ -484,7 +516,11 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) chans_left -= s->n_chan; if (!chans_left) { - asic = 0; /* reset the asic to our first asic, to do intr subdevs */ + /* + * reset the asic to our first asic, + * to do intr subdevs + */ + asic = 0; port = 0; } @@ -507,8 +543,10 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->asics[asic].irq = irq[asic]; } - dev->irq = irq[0]; /* grr.. wish comedi dev struct supported multiple - irqs.. */ + dev->irq = irq[0]; /* + * grr.. wish comedi dev struct supported + * multiple irqs.. + */ if (irq[0]) { printk("irq: %u ", irq[0]); @@ -604,9 +642,14 @@ static int pcmmio_dio_insn_bits(struct comedi_device *dev, #endif if (write_mask_byte) { - /* this byte has some write_bits -- so set the output lines */ - byte &= ~write_mask_byte; /* clear bits for write mask */ - byte |= ~data_byte & write_mask_byte; /* set to inverted data_byte */ + /* + * this byte has some write_bits + * -- so set the output lines + */ + /* clear bits for write mask */ + byte &= ~write_mask_byte; + /* set to inverted data_byte */ + byte |= ~data_byte & write_mask_byte; /* Write out the new digital output state */ outb(byte, ioaddr); } -- GitLab From 013f230c4f2622cbbc736c50223b49bced024655 Mon Sep 17 00:00:00 2001 From: Daniel Patrick Johnson Date: Wed, 14 Oct 2009 02:04:24 +0000 Subject: [PATCH 054/235] Staging: comedi: pcmmio: more coding style cleanup Signed-off-by: Daniel Patrick Johnson Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcmmio.c | 110 +++++++++++++++++------- 1 file changed, 77 insertions(+), 33 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index c764b28fb319..35ba93989a36 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -713,9 +713,11 @@ static int pcmmio_dio_insn_config(struct comedi_device *dev, byte &= ~(1 << bit_no); /**< set input channel to '0' */ - /* write out byte -- this is the only time we actually affect the - hardware as all channels are implicitly output -- but input - channels are set to float-high */ + /* + * write out byte -- this is the only time we actually affect + * the hardware as all channels are implicitly output + * -- but input channels are set to float-high + */ outb(byte, ioaddr); /* save to io_bits */ @@ -769,8 +771,8 @@ static void init_asics(struct comedi_device *dev) outb(0xff, baseaddr + REG_ENAB0); */ /* END DEBUG */ - switch_page(dev, asic, 0); /* switch back to default page 0 */ - + /* switch back to default page 0 */ + switch_page(dev, asic, 0); } } @@ -849,7 +851,10 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d) REG_INT_ID0 + port); if (io_lines_with_edges) - /* clear pending interrupt */ + /* + * clear pending + * interrupt + */ outb(0, iobase + REG_INT_ID0 + port); @@ -868,14 +873,21 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d) if (triggered) { struct comedi_subdevice *s; - /* TODO here: dispatch io lines to subdevs with commands.. */ + /* + * TODO here: dispatch io lines to subdevs + * with commands.. + */ printk ("PCMMIO DEBUG: got edge detect interrupt %d asic %d which_chans: %06x\n", irq, asic, triggered); for (s = dev->subdevices + 2; s < dev->subdevices + dev->n_subdevices; ++s) { - if (subpriv->dio.intr.asic == asic) { /* this is an interrupt subdev, and it matches this asic! */ + /* + * this is an interrupt subdev, + * and it matches this asic! + */ + if (subpriv->dio.intr.asic == asic) { unsigned long flags; unsigned oldevents; @@ -910,9 +922,8 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d) n < len; n++) { ch = CR_CHAN(s->async->cmd.chanlist[n]); - if (mytrig & (1U << ch)) { + if (mytrig & (1U << ch)) val |= (1U << n); - } } /* Write the scan to the buffer. */ if (comedi_buf_put(s->async, ((short *)&val)[0]) @@ -920,8 +931,7 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d) comedi_buf_put (s->async, ((short *) - &val)[1])) - { + &val)[1])) { s->async->events |= (COMEDI_CB_BLOCK | COMEDI_CB_EOS); } else { /* Overflow! Stop acquisition!! */ @@ -1024,9 +1034,16 @@ static int pcmmio_start_intr(struct comedi_device *dev, 1) << subpriv->dio.intr.first_chan; subpriv->dio.intr.enabled_mask = bits; - { /* the below code configures the board to use a specific IRQ from 0-15. */ + { + /* + * the below code configures the board + * to use a specific IRQ from 0-15. + */ unsigned char b; - /* set resource enable register to enable IRQ operation */ + /* + * set resource enable register + * to enable IRQ operation + */ outb(1 << 4, dev->iobase + 3); /* set bits 0-3 of b to the irq number from 0-15 */ b = dev->irq & ((1 << 4) - 1); @@ -1080,14 +1097,12 @@ pcmmio_inttrig_start_intr(struct comedi_device *dev, struct comedi_subdevice *s, spin_lock_irqsave(&subpriv->dio.intr.spinlock, flags); s->async->inttrig = 0; - if (subpriv->dio.intr.active) { + if (subpriv->dio.intr.active) event = pcmmio_start_intr(dev, s); - } spin_unlock_irqrestore(&subpriv->dio.intr.spinlock, flags); - if (event) { + if (event) comedi_event(dev, s); - } return 1; } @@ -1129,9 +1144,8 @@ static int pcmmio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) } spin_unlock_irqrestore(&subpriv->dio.intr.spinlock, flags); - if (event) { + if (event) comedi_event(dev, s); - } return 0; } @@ -1179,17 +1193,32 @@ static int ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, short sample, adc_adjust = 0; if (chan > 7) - chan -= 8, iooffset = 4; /* use the second dword for channels > 7 */ + chan -= 8, iooffset = 4; /* + * use the second dword + * for channels > 7 + */ if (aref != AREF_DIFF) { aref = AREF_GROUND; - command_byte |= 1 << 7; /* set bit 7 to indicate single-ended */ + command_byte |= 1 << 7; /* + * set bit 7 to indicate + * single-ended + */ } if (range < 2) - adc_adjust = 0x8000; /* bipolar ranges (-5,5 .. -10,10 need to be adjusted -- that is.. they need to wrap around by adding 0x8000 */ + adc_adjust = 0x8000; /* + * bipolar ranges + * (-5,5 .. -10,10 need to be + * adjusted -- that is.. they + * need to wrap around by + * adding 0x8000 + */ if (chan % 2) { - command_byte |= 1 << 6; /* odd-numbered channels have bit 6 set */ + command_byte |= 1 << 6; /* + * odd-numbered channels + * have bit 6 set + */ } /* select the channel, bits 4-5 == chan/2 */ @@ -1199,16 +1228,22 @@ static int ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, command_byte |= (range & 0x3) << 2; /* need to do this twice to make sure mux settled */ - outb(command_byte, iobase + iooffset + 2); /* chan/range/aref select */ + /* chan/range/aref select */ + outb(command_byte, iobase + iooffset + 2); - adc_wait_ready(iobase + iooffset); /* wait for the adc to say it finised the conversion */ + /* wait for the adc to say it finised the conversion */ + adc_wait_ready(iobase + iooffset); - outb(command_byte, iobase + iooffset + 2); /* select the chan/range/aref AGAIN */ + /* select the chan/range/aref AGAIN */ + outb(command_byte, iobase + iooffset + 2); adc_wait_ready(iobase + iooffset); - sample = inb(iobase + iooffset + 0); /* read data lo byte */ - sample |= inb(iobase + iooffset + 1) << 8; /* read data hi byte */ + /* read data lo byte */ + sample = inb(iobase + iooffset + 0); + + /* read data hi byte */ + sample |= inb(iobase + iooffset + 1) << 8; sample += adc_adjust; /* adjustment .. munge data */ data[n] = sample; } @@ -1270,15 +1305,24 @@ static int ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, wait_dac_ready(iobase + iooffset); - outb(data[n] & 0xff, iobase + iooffset + 0); /* low order byte */ - outb((data[n] >> 8) & 0xff, iobase + iooffset + 1); /* high order byte */ - command_byte = 0x70 | (chan << 1); /* set bit 4 of command byte to indicate data is loaded and trigger conversion */ + /* low order byte */ + outb(data[n] & 0xff, iobase + iooffset + 0); + + /* high order byte */ + outb((data[n] >> 8) & 0xff, iobase + iooffset + 1); + + /* + * set bit 4 of command byte to indicate + * data is loaded and trigger conversion + */ + command_byte = 0x70 | (chan << 1); /* trigger converion */ outb(command_byte, iobase + iooffset + 2); wait_dac_ready(iobase + iooffset); - subpriv->ao.shadow_samples[chan] = data[n]; /* save to shadow register for ao_rinsn */ + /* save to shadow register for ao_rinsn */ + subpriv->ao.shadow_samples[chan] = data[n]; } } return n; -- GitLab From 00a1855c21ab1efc71db98b0a87ea3d0ee7b8d92 Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 18 Oct 2009 15:32:15 -0500 Subject: [PATCH 055/235] staging: comedi: Remove check for HAVE_UNLOCKED_IOCTL All new kernels have unlocked_ioctl so we don't need to check. Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_compat32.c | 10 ---------- drivers/staging/comedi/comedi_fops.c | 9 --------- drivers/staging/comedi/drivers/serial2002.c | 9 ++------- 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c index e2d7e6975263..04682d38e302 100644 --- a/drivers/staging/comedi/comedi_compat32.c +++ b/drivers/staging/comedi/comedi_compat32.c @@ -101,22 +101,12 @@ static int translated_ioctl(struct file *file, unsigned int cmd, if (!file->f_op) return -ENOTTY; -#ifdef HAVE_UNLOCKED_IOCTL if (file->f_op->unlocked_ioctl) { int rc = (int)(*file->f_op->unlocked_ioctl) (file, cmd, arg); if (rc == -ENOIOCTLCMD) rc = -ENOTTY; return rc; } -#endif - if (file->f_op->ioctl) { - int rc; - lock_kernel(); - rc = (*file->f_op->ioctl) (file->f_dentry->d_inode, - file, cmd, arg); - unlock_kernel(); - return rc; - } return -ENOTTY; } diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index aaad76e0a76a..a79b37f591ae 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -110,13 +110,8 @@ static struct device_attribute dev_attr_read_buffer_kb; static struct device_attribute dev_attr_max_write_buffer_kb; static struct device_attribute dev_attr_write_buffer_kb; -#ifdef HAVE_UNLOCKED_IOCTL static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -#else -static int comedi_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg) -#endif { const unsigned minor = iminor(file->f_dentry->d_inode); struct comedi_device_file_info *dev_file_info = @@ -1867,11 +1862,7 @@ static int comedi_fasync(int fd, struct file *file, int on) const struct file_operations comedi_fops = { .owner = THIS_MODULE, -#ifdef HAVE_UNLOCKED_IOCTL .unlocked_ioctl = comedi_unlocked_ioctl, -#else - .ioctl = comedi_ioctl, -#endif #ifdef HAVE_COMPAT_IOCTL .compat_ioctl = comedi_compat_ioctl, #endif diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c index 82aa86e718b2..e7c13eba983b 100644 --- a/drivers/staging/comedi/drivers/serial2002.c +++ b/drivers/staging/comedi/drivers/serial2002.c @@ -125,14 +125,9 @@ struct serial_data { static long tty_ioctl(struct file *f, unsigned op, unsigned long param) { -#ifdef HAVE_UNLOCKED_IOCTL - if (f->f_op->unlocked_ioctl) { + if (f->f_op->unlocked_ioctl) return f->f_op->unlocked_ioctl(f, op, param); - } -#endif - if (f->f_op->ioctl) { - return f->f_op->ioctl(f->f_dentry->d_inode, f, op, param); - } + return -ENOSYS; } -- GitLab From 5d7ae225540a98b6ee7ab1447c6a1eed89c219cd Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 18 Oct 2009 15:32:16 -0500 Subject: [PATCH 056/235] Staging: comedi: remove check for HAVE_COMPAT_IOCTL All new kernels have support for compat_ioctl so remove the check and support for older kernels. Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_compat32.c | 108 ----------------------- drivers/staging/comedi/comedi_compat32.h | 16 ---- drivers/staging/comedi/comedi_fops.c | 6 -- 3 files changed, 130 deletions(-) diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c index 04682d38e302..47cf0a1e09cf 100644 --- a/drivers/staging/comedi/comedi_compat32.c +++ b/drivers/staging/comedi/comedi_compat32.c @@ -33,10 +33,6 @@ #ifdef CONFIG_COMPAT -#ifndef HAVE_COMPAT_IOCTL -#include /* for (un)register_ioctl32_conversion */ -#endif - #define COMEDI32_CHANINFO _IOR(CIO, 3, struct comedi32_chaninfo_struct) #define COMEDI32_RANGEINFO _IOR(CIO, 8, struct comedi32_rangeinfo_struct) /* N.B. COMEDI32_CMD and COMEDI_CMD ought to use _IOWR, not _IOR. @@ -462,8 +458,6 @@ static inline int raw_ioctl(struct file *file, unsigned int cmd, return rc; } -#ifdef HAVE_COMPAT_IOCTL /* defined in 2.6.11 onwards */ - /* compat_ioctl file operation. */ /* Returns -ENOIOCTLCMD for unrecognised ioctl codes. */ long comedi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) @@ -471,106 +465,4 @@ long comedi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return raw_ioctl(file, cmd, arg); } -#else /* HAVE_COMPAT_IOCTL */ - -/* - * Brain-dead ioctl compatibility for 2.6.10 and earlier. - * - * It's brain-dead because cmd numbers need to be unique system-wide! - * The comedi driver could end up attempting to execute ioctls for non-Comedi - * devices because it registered the system-wide cmd code first. Similarly, - * another driver could end up attempting to execute ioctls for a Comedi - * device because it registered the cmd code first. Chaos ensues. - */ - -/* Handler for all 32-bit ioctl codes registered by this driver. */ -static int mapped_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg, - struct file *file) -{ - int rc; - - /* Make sure we are dealing with a Comedi device. */ - if (imajor(file->f_dentry->d_inode) != COMEDI_MAJOR) - return -ENOTTY; - - rc = raw_ioctl(file, cmd, arg); - /* Do not return -ENOIOCTLCMD. */ - if (rc == -ENOIOCTLCMD) - rc = -ENOTTY; - - return rc; -} - -struct ioctl32_map { - unsigned int cmd; - int (*handler) (unsigned int, unsigned int, unsigned long, - struct file *); - int registered; -}; - -static struct ioctl32_map comedi_ioctl32_map[] = { - {COMEDI_DEVCONFIG, mapped_ioctl, 0}, - {COMEDI_DEVINFO, mapped_ioctl, 0}, - {COMEDI_SUBDINFO, mapped_ioctl, 0}, - {COMEDI_BUFCONFIG, mapped_ioctl, 0}, - {COMEDI_BUFINFO, mapped_ioctl, 0}, - {COMEDI_LOCK, mapped_ioctl, 0}, - {COMEDI_UNLOCK, mapped_ioctl, 0}, - {COMEDI_CANCEL, mapped_ioctl, 0}, - {COMEDI_POLL, mapped_ioctl, 0}, - {COMEDI32_CHANINFO, mapped_ioctl, 0}, - {COMEDI32_RANGEINFO, mapped_ioctl, 0}, - {COMEDI32_CMD, mapped_ioctl, 0}, - {COMEDI32_CMDTEST, mapped_ioctl, 0}, - {COMEDI32_INSNLIST, mapped_ioctl, 0}, - {COMEDI32_INSN, mapped_ioctl, 0}, -}; - -#define NUM_IOCTL32_MAPS ARRAY_SIZE(comedi_ioctl32_map) - -/* Register system-wide 32-bit ioctl handlers. */ -void comedi_register_ioctl32(void) -{ - int n, rc; - - for (n = 0; n < NUM_IOCTL32_MAPS; n++) { - rc = register_ioctl32_conversion(comedi_ioctl32_map[n].cmd, - comedi_ioctl32_map[n].handler); - if (rc) { - printk(KERN_WARNING - "comedi: failed to register 32-bit " - "compatible ioctl handler for 0x%X - " - "expect bad things to happen!\n", - comedi_ioctl32_map[n].cmd); - } - comedi_ioctl32_map[n].registered = !rc; - } -} - -/* Unregister system-wide 32-bit ioctl translations. */ -void comedi_unregister_ioctl32(void) -{ - int n, rc; - - for (n = 0; n < NUM_IOCTL32_MAPS; n++) { - if (comedi_ioctl32_map[n].registered) { - rc = unregister_ioctl32_conversion(comedi_ioctl32_map - [n].cmd, - comedi_ioctl32_map - [n].handler); - if (rc) { - printk(KERN_ERR - "comedi: failed to unregister 32-bit " - "compatible ioctl handler for 0x%X - " - "expect kernel Oops!\n", - comedi_ioctl32_map[n].cmd); - } else { - comedi_ioctl32_map[n].registered = 0; - } - } - } -} - -#endif /* HAVE_COMPAT_IOCTL */ - #endif /* CONFIG_COMPAT */ diff --git a/drivers/staging/comedi/comedi_compat32.h b/drivers/staging/comedi/comedi_compat32.h index 75d942cd73b5..0340a8949c6b 100644 --- a/drivers/staging/comedi/comedi_compat32.h +++ b/drivers/staging/comedi/comedi_compat32.h @@ -28,32 +28,16 @@ #define _COMEDI_COMPAT32_H #include - -/* For HAVE_COMPAT_IOCTL and HAVE_UNLOCKED_IOCTL */ #include #ifdef CONFIG_COMPAT -#ifdef HAVE_COMPAT_IOCTL - extern long comedi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg); -#define comedi_register_ioctl32() do {} while (0) -#define comedi_unregister_ioctl32() do {} while (0) - -#else /* HAVE_COMPAT_IOCTL */ - -#define comedi_compat_ioctl 0 /* NULL */ -extern void comedi_register_ioctl32(void); -extern void comedi_unregister_ioctl32(void); - -#endif /* HAVE_COMPAT_IOCTL */ #else /* CONFIG_COMPAT */ #define comedi_compat_ioctl 0 /* NULL */ -#define comedi_register_ioctl32() do {} while (0) -#define comedi_unregister_ioctl32() do {} while (0) #endif /* CONFIG_COMPAT */ diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index a79b37f591ae..8117748ad5a5 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -1863,9 +1863,7 @@ static int comedi_fasync(int fd, struct file *file, int on) const struct file_operations comedi_fops = { .owner = THIS_MODULE, .unlocked_ioctl = comedi_unlocked_ioctl, -#ifdef HAVE_COMPAT_IOCTL .compat_ioctl = comedi_compat_ioctl, -#endif .open = comedi_open, .release = comedi_close, .read = comedi_read, @@ -1950,8 +1948,6 @@ static int __init comedi_init(void) } } - comedi_register_ioctl32(); - return 0; } @@ -1968,8 +1964,6 @@ static void __exit comedi_cleanup(void) unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS); comedi_proc_cleanup(); - - comedi_unregister_ioctl32(); } module_init(comedi_init); -- GitLab From a6279bc9e4dfb30bef8e3e1f41df8e877ecd3e30 Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 18 Oct 2009 15:32:17 -0500 Subject: [PATCH 057/235] Staging: comedi: Don't check for -ENOIOCTLCMD unlocked_ioctl() never returns -ENOIOCTLCMD so remove the check. Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_compat32.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c index 47cf0a1e09cf..a9fdcda5db7a 100644 --- a/drivers/staging/comedi/comedi_compat32.c +++ b/drivers/staging/comedi/comedi_compat32.c @@ -97,12 +97,9 @@ static int translated_ioctl(struct file *file, unsigned int cmd, if (!file->f_op) return -ENOTTY; - if (file->f_op->unlocked_ioctl) { - int rc = (int)(*file->f_op->unlocked_ioctl) (file, cmd, arg); - if (rc == -ENOIOCTLCMD) - rc = -ENOTTY; - return rc; - } + if (file->f_op->unlocked_ioctl) + return file->f_op->unlocked_ioctl(file, cmd, arg); + return -ENOTTY; } -- GitLab From 37a110c04965e23e12bf00370e9ec61e99cc25b8 Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 18 Oct 2009 15:32:18 -0500 Subject: [PATCH 058/235] Staging: comedi: remove __cplusplus check c++ isn't supported in the kernel. Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/comedi/comedi.h b/drivers/staging/comedi/comedi.h index 957b6405dfa7..ccc5cdc008c6 100644 --- a/drivers/staging/comedi/comedi.h +++ b/drivers/staging/comedi/comedi.h @@ -24,10 +24,6 @@ #ifndef _COMEDI_H #define _COMEDI_H -#ifdef __cplusplus -extern "C" { -#endif - #define COMEDI_MAJORVERSION 0 #define COMEDI_MINORVERSION 7 #define COMEDI_MICROVERSION 76 @@ -871,8 +867,4 @@ INSN_CONFIG_ARM */ AMPLC_DIO_GAT_RESERVED7 }; -#ifdef __cplusplus -} -#endif - #endif /* _COMEDI_H */ -- GitLab From d1babfd46609a3380ca4e8df97568e7da9b02eab Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 18 Oct 2009 15:32:19 -0500 Subject: [PATCH 059/235] Staging: comedi: remove EXTERN macro since it is not used Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/s626.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/s626.h b/drivers/staging/comedi/drivers/s626.h index 1d04922ea16c..d02742a95294 100644 --- a/drivers/staging/comedi/drivers/s626.h +++ b/drivers/staging/comedi/drivers/s626.h @@ -76,14 +76,6 @@ #define FALSE (0) #endif -#if !defined(EXTERN) -#if defined(__cplusplus) -#define EXTERN extern "C" -#else -#define EXTERN extern -#endif -#endif - #if !defined(INLINE) #define INLINE static __inline #endif -- GitLab From bacf58a80330b540b5156aa27b9a796b6b3baae2 Mon Sep 17 00:00:00 2001 From: "BRAGA, Bruno" Date: Thu, 22 Oct 2009 11:55:36 +0900 Subject: [PATCH 060/235] Staging: comedi: adl_pci8164 coding style fixes Corrected coding style: - excessive curly braces - printk without KERN_* logging - 80+ chars per line of code Signed-off-by: BRAGA, Bruno Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci8164.c | 37 ++++++++++---------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci8164.c b/drivers/staging/comedi/drivers/adl_pci8164.c index 43745ec94ab5..da256a1e0b4d 100644 --- a/drivers/staging/comedi/drivers/adl_pci8164.c +++ b/drivers/staging/comedi/drivers/adl_pci8164.c @@ -35,6 +35,7 @@ Configuration Options: */ #include "../comedidev.h" +#include #include #include "comedi_fc.h" #include "comedi_pci.h" @@ -128,8 +129,8 @@ static int adl_pci8164_attach(struct comedi_device *dev, struct comedi_subdevice *s; int bus, slot; - printk("comedi: attempt to attach...\n"); - printk("comedi%d: adl_pci8164\n", dev->minor); + printk(KERN_INFO "comedi: attempt to attach...\n"); + printk(KERN_INFO "comedi%d: adl_pci8164\n", dev->minor); dev->board_name = "pci8164"; bus = it->options[0]; @@ -150,19 +151,18 @@ static int adl_pci8164_attach(struct comedi_device *dev, if (bus || slot) { /* requested particular bus/slot */ if (pcidev->bus->number != bus - || PCI_SLOT(pcidev->devfn) != slot) { + || PCI_SLOT(pcidev->devfn) != slot) continue; - } } devpriv->pci_dev = pcidev; if (comedi_pci_enable(pcidev, "adl_pci8164") < 0) { - printk - ("comedi%d: Failed to enable PCI device and request regions\n", - dev->minor); + printk(KERN_ERR "comedi%d: Failed to enable " + "PCI device and request regions\n", dev->minor); return -EIO; } dev->iobase = pci_resource_start(pcidev, 2); - printk("comedi: base addr %4lx\n", dev->iobase); + printk(KERN_DEBUG "comedi: base addr %4lx\n", + dev->iobase); s = dev->subdevices + 0; s->type = COMEDI_SUBD_PROC; @@ -204,25 +204,24 @@ static int adl_pci8164_attach(struct comedi_device *dev, s->insn_read = adl_pci8164_insn_read_buf1; s->insn_write = adl_pci8164_insn_write_buf1; - printk("comedi: attached\n"); + printk(KERN_INFO "comedi: attached\n"); return 1; } } - printk("comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", - dev->minor, bus, slot); + printk(KERN_ERR "comedi%d: no supported board found!" + "(req. bus/slot : %d/%d)\n", dev->minor, bus, slot); return -EIO; } static int adl_pci8164_detach(struct comedi_device *dev) { - printk("comedi%d: pci8164: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: pci8164: remove\n", dev->minor); if (devpriv && devpriv->pci_dev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pci_dev); - } pci_dev_put(devpriv->pci_dev); } @@ -267,8 +266,9 @@ static void adl_pci8164_insn_read(struct comedi_device *dev, } data[0] = inw(dev->iobase + axis_reg + offset); - printk("comedi: pci8164 %s read -> %04X:%04X on axis %s\n", action, - data[0], data[1], axisname); + printk(KERN_DEBUG "comedi: pci8164 %s read -> " + "%04X:%04X on axis %s\n", + action, data[0], data[1], axisname); } static int adl_pci8164_insn_read_msts(struct comedi_device *dev, @@ -347,8 +347,9 @@ static void adl_pci8164_insn_out(struct comedi_device *dev, outw(data[0], dev->iobase + axis_reg + offset); - printk("comedi: pci8164 %s write -> %04X:%04X on axis %s\n", action, - data[0], data[1], axisname); + printk(KERN_DEBUG "comedi: pci8164 %s write -> " + "%04X:%04X on axis %s\n", + action, data[0], data[1], axisname); } -- GitLab From 446176a7430f4dc311cda2200cd94336acbd0a6e Mon Sep 17 00:00:00 2001 From: Klaas van Gend Date: Thu, 22 Oct 2009 07:50:59 +0200 Subject: [PATCH 061/235] staging: comedi: multiq3: remove warning on braces Remove braces in if statements to make the file exhibit less warnings when checked using checkpatch.pl. Signed-off-by: Klaas van Gend Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/multiq3.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/multiq3.c b/drivers/staging/comedi/drivers/multiq3.c index 5d6af9c459db..3aa9f23d344c 100644 --- a/drivers/staging/comedi/drivers/multiq3.c +++ b/drivers/staging/comedi/drivers/multiq3.c @@ -144,9 +144,8 @@ static int multiq3_ao_insn_read(struct comedi_device *dev, int i; int chan = CR_CHAN(insn->chanspec); - for (i = 0; i < insn->n; i++) { + for (i = 0; i < insn->n; i++) data[i] = devpriv->ao_readback[chan]; - } return i; } @@ -262,11 +261,10 @@ static int multiq3_attach(struct comedi_device *dev, dev->iobase = iobase; irq = it->options[1]; - if (irq) { + if (irq) printk("comedi%d: irq = %u ignored\n", dev->minor, irq); - } else { + else printk("comedi%d: no irq\n", dev->minor); - } dev->board_name = "multiq3"; result = alloc_subdevices(dev, 5); if (result < 0) @@ -332,12 +330,10 @@ static int multiq3_detach(struct comedi_device *dev) { printk("comedi%d: multiq3: remove\n", dev->minor); - if (dev->iobase) { + if (dev->iobase) release_region(dev->iobase, MULTIQ3_SIZE); - } - if (dev->irq) { + if (dev->irq) free_irq(dev->irq, dev); - } return 0; } -- GitLab From c5dba43b6056e83de5d95e4e17c34ad7a479aaa7 Mon Sep 17 00:00:00 2001 From: Klaas van Gend Date: Thu, 22 Oct 2009 07:51:00 +0200 Subject: [PATCH 062/235] staging: comedi: multiq3: add KERN_ Add KERN_ to printk statements to reduce the number of warnings shown by checkpatch.pl. Signed-off-by: Klaas van Gend Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/multiq3.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/multiq3.c b/drivers/staging/comedi/drivers/multiq3.c index 3aa9f23d344c..6b22f0f8f06a 100644 --- a/drivers/staging/comedi/drivers/multiq3.c +++ b/drivers/staging/comedi/drivers/multiq3.c @@ -252,9 +252,9 @@ static int multiq3_attach(struct comedi_device *dev, struct comedi_subdevice *s; iobase = it->options[0]; - printk("comedi%d: multiq3: 0x%04lx ", dev->minor, iobase); + printk(KERN_INFO "comedi%d: multiq3: 0x%04lx ", dev->minor, iobase); if (!request_region(iobase, MULTIQ3_SIZE, "multiq3")) { - printk("comedi%d: I/O port conflict\n", dev->minor); + printk(KERN_ERR "comedi%d: I/O port conflict\n", dev->minor); return -EIO; } @@ -262,9 +262,10 @@ static int multiq3_attach(struct comedi_device *dev, irq = it->options[1]; if (irq) - printk("comedi%d: irq = %u ignored\n", dev->minor, irq); + printk(KERN_WARNING "comedi%d: irq = %u ignored\n", + dev->minor, irq); else - printk("comedi%d: no irq\n", dev->minor); + printk(KERN_WARNING "comedi%d: no irq\n", dev->minor); dev->board_name = "multiq3"; result = alloc_subdevices(dev, 5); if (result < 0) @@ -328,7 +329,7 @@ static int multiq3_attach(struct comedi_device *dev, static int multiq3_detach(struct comedi_device *dev) { - printk("comedi%d: multiq3: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: multiq3: remove\n", dev->minor); if (dev->iobase) release_region(dev->iobase, MULTIQ3_SIZE); -- GitLab From dc8af06898c4326cee1739e2bc100bed2b601721 Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Fri, 23 Oct 2009 12:26:25 +0200 Subject: [PATCH 063/235] Staging: comedi: addi-data: Cleanup redundant tests on unsigned The variables are unsigned so the test `>= 0' is always true, In these cases the other part of the test catch wrapped values. Signed-off-by: Roel Kluin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c | 3 +-- drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c | 2 +- drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c | 2 +- drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c | 2 +- drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c | 2 +- drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.c | 4 ++-- drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.c | 2 +- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 5 ++--- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c | 2 +- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c | 2 +- 10 files changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c index ccb109a851f2..0af12fd2a40a 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c @@ -1386,8 +1386,7 @@ int i_APCI1710_ReadChronoValue(struct comedi_device *dev, /* Test the timout parameter */ /*****************************/ - if ((ui_TimeOut >= 0) - && (ui_TimeOut <= 65535UL)) { + if (ui_TimeOut <= 65535UL) { for (;;) { /*******************/ diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c index e9021cd4d341..723a97bab44c 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c @@ -150,7 +150,7 @@ int i_APCI1032_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdev unsigned int ui_TmpValue = 0; unsigned int ui_Channel; ui_Channel = CR_CHAN(insn->chanspec); - if (ui_Channel >= 0 && ui_Channel <= 31) { + if (ui_Channel <= 31) { ui_TmpValue = (unsigned int) inl(devpriv->iobase + APCI1032_DIGITAL_IP); /* * since only 1 channel reqd to bring it to last bit it is rotated 8 diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c index 236b8a31c824..36b929ffecbd 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c @@ -968,7 +968,7 @@ int i_APCI1500_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_sub switch (data[0]) { case 0: - if (ui_Channel >= 0 && ui_Channel <= 15) { + if (ui_Channel <= 15) { ui_TmpValue = (unsigned int) inw(devpriv->i_IobaseAddon + APCI1500_DIGITAL_IP); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c index 38416356628d..866eb8d75820 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c @@ -79,7 +79,7 @@ int i_APCI1516_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdev unsigned int ui_TmpValue = 0; unsigned int ui_Channel; ui_Channel = CR_CHAN(insn->chanspec); - if (ui_Channel >= 0 && ui_Channel <= 7) { + if (ui_Channel <= 7) { ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI1516_DIGITAL_IP); /* since only 1 channel reqd to bring it to last bit it is rotated */ /* 8 +(chan - 1) times then ANDed with 1 for last bit. */ diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index 3a47c3034229..3ae663bc754e 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -154,7 +154,7 @@ int i_APCI1564_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdev unsigned int ui_Channel; ui_Channel = CR_CHAN(insn->chanspec); - if (ui_Channel >= 0 && ui_Channel <= 31) { + if (ui_Channel <= 31) { ui_TmpValue = (unsigned int) inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP); /* diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.c index 457917f292b7..d348cd5687aa 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.c @@ -117,7 +117,7 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subde unsigned int ui_NoOfChannel; unsigned int ui_Temp, ui_Temp1; ui_NoOfChannel = CR_CHAN(insn->chanspec); - if ((ui_NoOfChannel < 0) || (ui_NoOfChannel > 15)) { + if (ui_NoOfChannel > 15) { comedi_error(dev, "Invalid Channel Numbers !!!, Channel Numbers must be between 0 and 15\n"); return -EINVAL; @@ -272,7 +272,7 @@ int i_APCI2016_BitsDigitalOutput(struct comedi_device *dev, struct comedi_subdev unsigned int ui_Temp; unsigned int ui_NoOfChannel; ui_NoOfChannel = CR_CHAN(insn->chanspec); - if ((ui_NoOfChannel < 0) || (ui_NoOfChannel > 15)) { + if (ui_NoOfChannel > 15) { comedi_error(dev, "Invalid Channel Numbers !!!, Channel Numbers must be between 0 and 15\n"); return -EINVAL; diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.c index a853c62a4fd9..aa159dccc36a 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.c @@ -79,7 +79,7 @@ int i_APCI2200_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdev unsigned int ui_TmpValue = 0; unsigned int ui_Channel; ui_Channel = CR_CHAN(insn->chanspec); - if (ui_Channel >= 0 && ui_Channel <= 7) { + if (ui_Channel <= 7) { ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI2200_DIGITAL_IP); *data = (ui_TmpValue >> ui_Channel) & 0x1; } /* if(ui_Channel >= 0 && ui_Channel <=7) */ diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 169cee41b871..222b5499dc0e 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -2350,7 +2350,7 @@ int i_APCI3120_InsnReadDigitalInput(struct comedi_device *dev, ui_Chan = CR_CHAN(insn->chanspec); /* channel specified */ /* this_board->i_hwdrv_InsnReadDigitalInput(dev,ui_Chan,data); */ - if (ui_Chan >= 0 && ui_Chan <= 3) { + if (ui_Chan <= 3) { ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI3120_RD_STATUS); /* @@ -2539,8 +2539,7 @@ int i_APCI3120_InsnWriteDigitalOutput(struct comedi_device *dev, "Not a valid Data !!! ,Data should be 1 or 0\n"); return -EINVAL; } - if ((ui_NoOfChannel > (this_board->i_NbrDoChannel - 1)) - || (ui_NoOfChannel < 0)) { + if (ui_NoOfChannel > this_board->i_NbrDoChannel - 1) { comedi_error(dev, "This board doesn't have specified channel !!! \n"); return -EINVAL; diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c index 010697fa2936..98c23872e374 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c @@ -461,7 +461,7 @@ int i_APCI3200_GetChannelCalibrationValue(struct comedi_device *dev, if (s_BoardInfos[dev->minor].i_ConnectionType == 1) { /* if diff */ - if ((ui_Channel_num >= 0) && (ui_Channel_num <= 1)) + if (ui_Channel_num <= 1) i_DiffChannel = ui_Channel_num, i_Module = 0; else if ((ui_Channel_num >= 2) && (ui_Channel_num <= 3)) i_DiffChannel = ui_Channel_num - 2, i_Module = 1; diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c index 338727879827..1d1e5fc2ea9a 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c @@ -148,7 +148,7 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev, /* Test the convert time value */ /*******************************/ - if ((dw_ReloadValue >= 0) && (dw_ReloadValue <= 65535)) { + if (dw_ReloadValue <= 65535) { dw_TestReloadValue = dw_ReloadValue; if (b_TimeBase == 1) { -- GitLab From a69fba9e379b67c7fb54012547200f4517447bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevyn-Alexandre=20Par=C3=A9?= Date: Fri, 23 Oct 2009 17:34:17 -0400 Subject: [PATCH 064/235] Staging: comedi: pcl726: fix coding style issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kevyn-Alexandre Paré Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcl726.c | 41 ++++++++++++------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcl726.c b/drivers/staging/comedi/drivers/pcl726.c index ccadd095f630..6a1a9790a907 100644 --- a/drivers/staging/comedi/drivers/pcl726.c +++ b/drivers/staging/comedi/drivers/pcl726.c @@ -39,27 +39,27 @@ Interrupts are not supported. Options for PCL-726: [0] - IO Base [2]...[7] - D/A output range for channel 1-6: - 0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V, - 4: 4-20mA, 5: unknown (external reference) + 0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V, + 4: 4-20mA, 5: unknown (external reference) Options for PCL-727: [0] - IO Base [2]...[13] - D/A output range for channel 1-12: - 0: 0-5V, 1: 0-10V, 2: +/-5V, - 3: 4-20mA + 0: 0-5V, 1: 0-10V, 2: +/-5V, + 3: 4-20mA Options for PCL-728 and ACL-6128: [0] - IO Base [2], [3] - D/A output range for channel 1 and 2: - 0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V, - 4: 4-20mA, 5: 0-20mA + 0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V, + 4: 4-20mA, 5: 0-20mA Options for ACL-6126: [0] - IO Base [1] - IRQ (0=disable, 3, 5, 6, 7, 9, 10, 11, 12, 15) (currently ignored) [2]...[7] - D/A output range for channel 1-6: - 0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V, - 4: 4-20mA + 0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V, + 4: 4-20mA */ /* @@ -127,7 +127,8 @@ struct pcl726_board { int di_lo; int do_hi; int do_lo; - const struct comedi_lrange *const *range_type_list; /* list of supported ranges */ + const struct comedi_lrange *const *range_type_list; + /* list of supported ranges */ }; static const struct pcl726_board boardtypes[] = { @@ -204,9 +205,8 @@ static int pcl726_ao_insn_read(struct comedi_device *dev, int chan = CR_CHAN(insn->chanspec); int n; - for (n = 0; n < insn->n; n++) { + for (n = 0; n < insn->n; n++) data[n] = devpriv->ao_readback[chan]; - } return n; } @@ -256,10 +256,10 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it) iobase = it->options[0]; iorange = this_board->io_range; - printk("comedi%d: pcl726: board=%s, 0x%03lx ", dev->minor, + printk(KERN_WARNING "comedi%d: pcl726: board=%s, 0x%03lx ", dev->minor, this_board->name, iobase); if (!request_region(iobase, iorange, "pcl726")) { - printk("I/O port conflict\n"); + printk(KERN_WARNING "I/O port conflict\n"); return -EIO; } @@ -283,16 +283,16 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->first_chan = 2; if (irq) { /* we want to use IRQ */ if (((1 << irq) & boardtypes[board].IRQbits) == 0) { - printk - (", IRQ %d is out of allowed range, DISABLING IT", - irq); + printk(KERN_WARNING + ", IRQ %d is out of allowed range," + " DISABLING IT", irq); irq = 0; /* Bad IRQ */ } else { if (request_irq(irq, interrupt_pcl818, 0, "pcl726", dev)) { - printk - (", unable to allocate IRQ %d, DISABLING IT", - irq); + printk(KERN_WARNING + ", unable to allocate IRQ %d," + " DISABLING IT", irq); irq = 0; /* Can't use IRQ */ } else { printk(", irq=%d", irq); @@ -372,9 +372,8 @@ static int pcl726_detach(struct comedi_device *dev) /* printk("comedi%d: pcl726: remove\n",dev->minor); */ #ifdef ACL6126_IRQ - if (dev->irq) { + if (dev->irq) free_irq(dev->irq, dev); - } #endif if (dev->iobase) -- GitLab From d62a01d861b0d47b1ff16bdfa0f31580d5083c95 Mon Sep 17 00:00:00 2001 From: Klaas van Gend Date: Wed, 28 Oct 2009 02:01:07 +0100 Subject: [PATCH 065/235] Staging: comedi: comedi_fc: checkpatch.pl fixes This patch fixes all warnings as issued by checkpatch.pl. Signed-off-by: Klaas van Gend Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_fc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_fc.c b/drivers/staging/comedi/drivers/comedi_fc.c index f781154734ad..63be619dd606 100644 --- a/drivers/staging/comedi/drivers/comedi_fc.c +++ b/drivers/staging/comedi/drivers/comedi_fc.c @@ -53,7 +53,7 @@ unsigned int cfc_write_array_to_buffer(struct comedi_subdevice *subd, retval = comedi_buf_write_alloc(async, num_bytes); if (retval != num_bytes) { - printk("comedi: buffer overrun\n"); + printk(KERN_WARNING "comedi: buffer overrun\n"); async->events |= COMEDI_CB_OVERFLOW; return 0; } @@ -65,7 +65,6 @@ unsigned int cfc_write_array_to_buffer(struct comedi_subdevice *subd, return num_bytes; } - EXPORT_SYMBOL(cfc_write_array_to_buffer); unsigned int cfc_read_array_from_buffer(struct comedi_subdevice *subd, @@ -84,7 +83,6 @@ unsigned int cfc_read_array_from_buffer(struct comedi_subdevice *subd, return num_bytes; } - EXPORT_SYMBOL(cfc_read_array_from_buffer); unsigned int cfc_handle_events(struct comedi_device *dev, @@ -102,7 +100,6 @@ unsigned int cfc_handle_events(struct comedi_device *dev, return events; } - EXPORT_SYMBOL(cfc_handle_events); MODULE_AUTHOR("Frank Mori Hess "); -- GitLab From a8c5c198c757c187a904d01b9d74af7d9d91df7f Mon Sep 17 00:00:00 2001 From: Klaas van Gend Date: Wed, 28 Oct 2009 02:01:08 +0100 Subject: [PATCH 066/235] Staging: comedi: drivers: ni_6527: fixup checkpatch.pl warnings This patch fixes all warnings as issued by checkpatch.pl. Note that I had to modify some of the logging messages to make that possible. Signed-off-by: Klaas van Gend Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_6527.c | 33 ++++++++++-------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c index b37ef37c2d2d..653b4c8700af 100644 --- a/drivers/staging/comedi/drivers/ni_6527.c +++ b/drivers/staging/comedi/drivers/ni_6527.c @@ -273,7 +273,8 @@ static int ni6527_intr_cmdtest(struct comedi_device *dev, if (err) return 1; - /* step 2: make sure trigger sources are unique and mutually compatible */ + /* step 2: make sure trigger sources are unique and */ + /* are mutually compatible */ if (err) return 2; @@ -377,7 +378,7 @@ static int ni6527_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct comedi_subdevice *s; int ret; - printk("comedi%d: ni6527:", dev->minor); + printk(KERN_INFO "comedi%d: ni6527\n", dev->minor); ret = alloc_private(dev, sizeof(struct ni6527_private)); if (ret < 0) @@ -389,14 +390,13 @@ static int ni6527_attach(struct comedi_device *dev, struct comedi_devconfig *it) ret = mite_setup(devpriv->mite); if (ret < 0) { - printk("error setting up mite\n"); + printk(KERN_ERR "comedi: error setting up mite\n"); return ret; } dev->board_name = this_board->name; - printk(" %s", dev->board_name); - - printk(" ID=0x%02x", readb(devpriv->mite->daq_io_addr + ID_Register)); + printk(KERN_INFO "comedi board: %s, ID=0x%02x\n", dev->board_name, + readb(devpriv->mite->daq_io_addr + ID_Register)); ret = alloc_subdevices(dev, 3); if (ret < 0) @@ -415,7 +415,7 @@ static int ni6527_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->type = COMEDI_SUBD_DO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE; s->n_chan = 24; - s->range_table = &range_unknown; /* FIXME: actually conductance */ + s->range_table = &range_unknown; /* FIXME: actually conductance */ s->maxdata = 1; s->insn_bits = ni6527_do_insn_bits; @@ -442,30 +442,25 @@ static int ni6527_attach(struct comedi_device *dev, struct comedi_devconfig *it) ret = request_irq(mite_irq(devpriv->mite), ni6527_interrupt, IRQF_SHARED, "ni6527", dev); - if (ret < 0) { - printk(" irq not available"); - } else + if (ret < 0) + printk(KERN_WARNING "comedi i6527 irq not available\n"); + else dev->irq = mite_irq(devpriv->mite); - printk("\n"); - return 0; } static int ni6527_detach(struct comedi_device *dev) { - if (devpriv && devpriv->mite && devpriv->mite->daq_io_addr) { + if (devpriv && devpriv->mite && devpriv->mite->daq_io_addr) writeb(0x00, devpriv->mite->daq_io_addr + Master_Interrupt_Control); - } - if (dev->irq) { + if (dev->irq) free_irq(dev->irq, dev); - } - if (devpriv && devpriv->mite) { + if (devpriv && devpriv->mite) mite_unsetup(devpriv->mite); - } return 0; } @@ -491,7 +486,7 @@ static int ni6527_find_device(struct comedi_device *dev, int bus, int slot) } } } - printk("no device found\n"); + printk(KERN_ERR "comedi 6527: no device found\n"); mite_list_devices(); return -EIO; } -- GitLab From 92e462c3a576a3fd7d7bed144d405ed1a4284ad8 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 21 Oct 2009 01:05:42 -0700 Subject: [PATCH 067/235] Staging: comedi: gsc_hpdi: style fixes printk Style cleanup in staging based on Greg's tutorial / checkpatch Add printk KERN_ facility level (KERN_WARNING seemed appropriate for all) Signed-off-by: Dirk Hohndel Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/gsc_hpdi.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c index 0bb30162e92c..396fa89a5a6e 100644 --- a/drivers/staging/comedi/drivers/gsc_hpdi.c +++ b/drivers/staging/comedi/drivers/gsc_hpdi.c @@ -110,7 +110,8 @@ enum hpdi_registers { int command_channel_valid(unsigned int channel) { if (channel == 0 || channel > 6) { - printk("gsc_hpdi: bug! invalid cable command channel\n"); + printk(KERN_WARNING + "gsc_hpdi: bug! invalid cable command channel\n"); return 0; } return 1; @@ -560,7 +561,7 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it) int i; int retval; - printk("comedi%d: gsc_hpdi\n", dev->minor); + printk(KERN_WARNING "comedi%d: gsc_hpdi\n", dev->minor); if (alloc_private(dev, sizeof(struct hpdi_private)) < 0) return -ENOMEM; @@ -588,11 +589,12 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it) } while (pcidev != NULL); } if (dev->board_ptr == NULL) { - printk("gsc_hpdi: no hpdi card found\n"); + printk(KERN_WARNING "gsc_hpdi: no hpdi card found\n"); return -EIO; } - printk("gsc_hpdi: found %s on bus %i, slot %i\n", board(dev)->name, + printk(KERN_WARNING + "gsc_hpdi: found %s on bus %i, slot %i\n", board(dev)->name, pcidev->bus->number, PCI_SLOT(pcidev->devfn)); if (comedi_pci_enable(pcidev, driver_hpdi.driver_name)) { @@ -618,7 +620,7 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it) ioremap(priv(dev)->hpdi_phys_iobase, pci_resource_len(pcidev, HPDI_BADDRINDEX)); if (!priv(dev)->plx9080_iobase || !priv(dev)->hpdi_iobase) { - printk(" failed to remap io memory\n"); + printk(KERN_WARNING " failed to remap io memory\n"); return -ENOMEM; } @@ -630,12 +632,13 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* get irq */ if (request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED, driver_hpdi.driver_name, dev)) { - printk(" unable to allocate irq %u\n", pcidev->irq); + printk(KERN_WARNING + " unable to allocate irq %u\n", pcidev->irq); return -EINVAL; } dev->irq = pcidev->irq; - printk(" irq %u\n", dev->irq); + printk(KERN_WARNING " irq %u\n", dev->irq); /* alocate pci dma buffers */ for (i = 0; i < NUM_DMA_BUFFERS; i++) { @@ -653,7 +656,8 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it) &priv(dev)-> dma_desc_phys_addr); if (priv(dev)->dma_desc_phys_addr & 0xf) { - printk(" dma descriptors not quad-word aligned (bug)\n"); + printk(KERN_WARNING + " dma descriptors not quad-word aligned (bug)\n"); return -EIO; } @@ -672,7 +676,7 @@ static int hpdi_detach(struct comedi_device *dev) { unsigned int i; - printk("comedi%d: gsc_hpdi: remove\n", dev->minor); + printk(KERN_WARNING "comedi%d: gsc_hpdi: remove\n", dev->minor); if (dev->irq) free_irq(dev->irq, dev); -- GitLab From 95a2572f95d5f78ef9fe28c200b21ad2b4b1e0c0 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 21 Oct 2009 01:05:43 -0700 Subject: [PATCH 068/235] Staging: comedi: gsc_hpdi: Fix style issues Style cleanup in staging based on Greg's tutorial / checkpatch Fix 80 char line length (where useful) - includes two changes to code to make it more logical / readable Remove {} around single line blocks Signed-off-by: Dirk Hohndel Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/gsc_hpdi.c | 100 +++++++++++----------- 1 file changed, 49 insertions(+), 51 deletions(-) diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c index 396fa89a5a6e..346d4c7c0d11 100644 --- a/drivers/staging/comedi/drivers/gsc_hpdi.c +++ b/drivers/staging/comedi/drivers/gsc_hpdi.c @@ -143,7 +143,8 @@ enum board_control_bits { RX_FIFO_RESET_BIT = 0x4, TX_ENABLE_BIT = 0x10, RX_ENABLE_BIT = 0x20, - DEMAND_DMA_DIRECTION_TX_BIT = 0x40, /* for channel 0, channel 1 can only transmit (when present) */ + DEMAND_DMA_DIRECTION_TX_BIT = 0x40, + /* for ch 0, ch 1 can only transmit (when present) */ LINE_VALID_ON_STATUS_VALID_BIT = 0x80, START_TX_BIT = 0x10, CABLE_THROTTLE_ENABLE_BIT = 0x20, @@ -421,9 +422,11 @@ static void init_plx9080(struct comedi_device *dev) bits |= PLX_DMA_EN_READYIN_BIT; /* enable dma chaining */ bits |= PLX_EN_CHAIN_BIT; - /* enable interrupt on dma done (probably don't need this, since chain never finishes) */ + /* enable interrupt on dma done + * (probably don't need this, since chain never finishes) */ bits |= PLX_EN_DMA_DONE_INTR_BIT; - /* don't increment local address during transfers (we are transferring from a fixed fifo register) */ + /* don't increment local address during transfers + * (we are transferring from a fixed fifo register) */ bits |= PLX_LOCAL_ADDR_CONST_BIT; /* route dma interrupt to pci bus */ bits |= PLX_DMA_INTR_PCI_BIT; @@ -680,38 +683,35 @@ static int hpdi_detach(struct comedi_device *dev) if (dev->irq) free_irq(dev->irq, dev); - if (priv(dev)) { - if (priv(dev)->hw_dev) { - if (priv(dev)->plx9080_iobase) { - disable_plx_interrupts(dev); - iounmap((void *)priv(dev)->plx9080_iobase); - } - if (priv(dev)->hpdi_iobase) - iounmap((void *)priv(dev)->hpdi_iobase); - /* free pci dma buffers */ - for (i = 0; i < NUM_DMA_BUFFERS; i++) { - if (priv(dev)->dio_buffer[i]) - pci_free_consistent(priv(dev)->hw_dev, - DMA_BUFFER_SIZE, - priv(dev)-> - dio_buffer[i], - priv - (dev)->dio_buffer_phys_addr - [i]); - } - /* free dma descriptors */ - if (priv(dev)->dma_desc) + if ((priv(dev)) && (priv(dev)->hw_dev)) { + if (priv(dev)->plx9080_iobase) { + disable_plx_interrupts(dev); + iounmap((void *)priv(dev)->plx9080_iobase); + } + if (priv(dev)->hpdi_iobase) + iounmap((void *)priv(dev)->hpdi_iobase); + /* free pci dma buffers */ + for (i = 0; i < NUM_DMA_BUFFERS; i++) { + if (priv(dev)->dio_buffer[i]) pci_free_consistent(priv(dev)->hw_dev, - sizeof(struct plx_dma_desc) - * NUM_DMA_DESCRIPTORS, - priv(dev)->dma_desc, + DMA_BUFFER_SIZE, priv(dev)-> - dma_desc_phys_addr); - if (priv(dev)->hpdi_phys_iobase) { - comedi_pci_disable(priv(dev)->hw_dev); - } - pci_dev_put(priv(dev)->hw_dev); + dio_buffer[i], + priv + (dev)->dio_buffer_phys_addr + [i]); } + /* free dma descriptors */ + if (priv(dev)->dma_desc) + pci_free_consistent(priv(dev)->hw_dev, + sizeof(struct plx_dma_desc) + * NUM_DMA_DESCRIPTORS, + priv(dev)->dma_desc, + priv(dev)-> + dma_desc_phys_addr); + if (priv(dev)->hpdi_phys_iobase) + comedi_pci_disable(priv(dev)->hw_dev); + pci_dev_put(priv(dev)->hw_dev); } return 0; } @@ -814,15 +814,16 @@ static int di_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, if (err) return 4; - if (cmd->chanlist) { - for (i = 1; i < cmd->chanlist_len; i++) { - if (CR_CHAN(cmd->chanlist[i]) != i) { - /* XXX could support 8 channels or 16 channels */ - comedi_error(dev, - "chanlist must be channels 0 to 31 in order"); - err++; - break; - } + if (!cmd->chanlist) + return 0; + + for (i = 1; i < cmd->chanlist_len; i++) { + if (CR_CHAN(cmd->chanlist[i]) != i) { + /* XXX could support 8 or 16 channels */ + comedi_error(dev, + "chanlist must be ch 0 to 31 in order"); + err++; + break; } } @@ -835,9 +836,9 @@ static int di_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, static int hpdi_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { - if (priv(dev)->dio_config_output) { + if (priv(dev)->dio_config_output) return -EINVAL; - } else + else return di_cmd_test(dev, s, cmd); } @@ -903,9 +904,9 @@ static int di_cmd(struct comedi_device *dev, struct comedi_subdevice *s) static int hpdi_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { - if (priv(dev)->dio_config_output) { + if (priv(dev)->dio_config_output) return -EINVAL; - } else + else return di_cmd(dev, s); } @@ -967,14 +968,12 @@ static irqreturn_t handle_interrupt(int irq, void *d) uint8_t dma0_status, dma1_status; unsigned long flags; - if (!dev->attached) { + if (!dev->attached) return IRQ_NONE; - } plx_status = readl(priv(dev)->plx9080_iobase + PLX_INTRCS_REG); - if ((plx_status & (ICS_DMA0_A | ICS_DMA1_A | ICS_LIA)) == 0) { + if ((plx_status & (ICS_DMA0_A | ICS_DMA1_A | ICS_LIA)) == 0) return IRQ_NONE; - } hpdi_intr_status = readl(priv(dev)->hpdi_iobase + INTERRUPT_STATUS_REG); hpdi_board_status = readl(priv(dev)->hpdi_iobase + BOARD_STATUS_REG); @@ -994,9 +993,8 @@ static irqreturn_t handle_interrupt(int irq, void *d) priv(dev)->plx9080_iobase + PLX_DMA0_CS_REG); DEBUG_PRINT("dma0 status 0x%x\n", dma0_status); - if (dma0_status & PLX_DMA_EN_BIT) { + if (dma0_status & PLX_DMA_EN_BIT) drain_dma_buffers(dev, 0); - } DEBUG_PRINT(" cleared dma ch0 interrupt\n"); } spin_unlock_irqrestore(&dev->spinlock, flags); -- GitLab From 64ca6a7eb1f55a6d25443ff8918d5aae00093fe5 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 21 Oct 2009 01:05:44 -0700 Subject: [PATCH 069/235] Staging: comedi: gsc_hdpi: style fixes static function Convert external function to static Signed-off-by: Dirk Hohndel Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/gsc_hpdi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c index 346d4c7c0d11..51f12bf45cf1 100644 --- a/drivers/staging/comedi/drivers/gsc_hpdi.c +++ b/drivers/staging/comedi/drivers/gsc_hpdi.c @@ -55,7 +55,7 @@ support could be added to this driver. static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it); static int hpdi_detach(struct comedi_device *dev); -void abort_dma(struct comedi_device *dev, unsigned int channel); +static void abort_dma(struct comedi_device *dev, unsigned int channel); static int hpdi_cmd(struct comedi_device *dev, struct comedi_subdevice *s); static int hpdi_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd); @@ -1044,7 +1044,7 @@ static irqreturn_t handle_interrupt(int irq, void *d) return IRQ_HANDLED; } -void abort_dma(struct comedi_device *dev, unsigned int channel) +static void abort_dma(struct comedi_device *dev, unsigned int channel) { unsigned long flags; -- GitLab From a622afcb7e4c7d24bb29b07e82fd8b7fcd81c0c0 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 21 Oct 2009 01:05:45 -0700 Subject: [PATCH 070/235] Staging: comedi: icp_multi: white space style fixes no code changes, just fixing white space, line length, etc Signed-off-by: Dirk Hohndel Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/icp_multi.c | 250 +++++++++++---------- 1 file changed, 126 insertions(+), 124 deletions(-) diff --git a/drivers/staging/comedi/drivers/icp_multi.c b/drivers/staging/comedi/drivers/icp_multi.c index 7a67fff42358..27a9ae9c7f25 100644 --- a/drivers/staging/comedi/drivers/icp_multi.c +++ b/drivers/staging/comedi/drivers/icp_multi.c @@ -46,7 +46,7 @@ There are 4 x 12-bit Analogue Outputs. Ranges : 5V, 10V, +/-5V, +/-10V Options: [0] - PCI bus number - if bus number and slot number are 0, - then driver search for first unused card + then driver search for first unused card [1] - PCI slot number */ @@ -176,13 +176,13 @@ static const struct boardtype boardtypes[] = { #define n_boardtypes (sizeof(boardtypes)/sizeof(struct boardtype)) static struct comedi_driver driver_icp_multi = { -driver_name:"icp_multi", -module:THIS_MODULE, -attach:icp_multi_attach, -detach:icp_multi_detach, -num_names:n_boardtypes, -board_name:&boardtypes[0].name, -offset:sizeof(struct boardtype), +driver_name: "icp_multi", +module : THIS_MODULE, +attach : icp_multi_attach, +detach : icp_multi_detach, +num_names : n_boardtypes, +board_name : &boardtypes[0].name, +offset : sizeof(struct boardtype), }; COMEDI_INITCLEANUP(driver_icp_multi); @@ -234,18 +234,18 @@ static int icp_multi_reset(struct comedi_device *dev); /* ============================================================================== - Name: icp_multi_insn_read_ai +Name: icp_multi_insn_read_ai - Description: - This function reads a single analogue input. +Description: + This function reads a single analogue input. - Parameters: - struct comedi_device *dev Pointer to current device structure - struct comedi_subdevice *s Pointer to current subdevice structure - struct comedi_insn *insn Pointer to current comedi instruction - unsigned int *data Pointer to analogue input data +Parameters: + struct comedi_device *dev Pointer to current device structure + struct comedi_subdevice *s Pointer to current subdevice structure + struct comedi_insn *insn Pointer to current comedi instruction + unsigned int *data Pointer to analogue input data - Returns:int Nmuber of instructions executed +Returns:int Nmuber of instructions executed ============================================================================== */ @@ -266,7 +266,7 @@ static int icp_multi_insn_read_ai(struct comedi_device *dev, devpriv->IntStatus |= ADC_READY; writew(devpriv->IntStatus, devpriv->io_addr + ICP_MULTI_INT_STAT); - /* Set up appropriate channel, mode and range data, for specified channel */ + /* Set up appropriate channel, mode and range data, for specified ch */ setup_channel_list(dev, s, &insn->chanspec, 1); #ifdef ICP_MULTI_EXTDEBUG @@ -356,18 +356,18 @@ conv_finish: /* ============================================================================== - Name: icp_multi_insn_write_ao +Name: icp_multi_insn_write_ao - Description: - This function writes a single analogue output. +Description: + This function writes a single analogue output. - Parameters: - struct comedi_device *dev Pointer to current device structure - struct comedi_subdevice *s Pointer to current subdevice structure - struct comedi_insn *insn Pointer to current comedi instruction - unsigned int *data Pointer to analogue output data +Parameters: + struct comedi_device *dev Pointer to current device structure + struct comedi_subdevice *s Pointer to current subdevice structure + struct comedi_insn *insn Pointer to current comedi instruction + unsigned int *data Pointer to analogue output data - Returns:int Nmuber of instructions executed +Returns:int Nmuber of instructions executed ============================================================================== */ @@ -404,7 +404,8 @@ static int icp_multi_insn_write_ao(struct comedi_device *dev, writew(devpriv->DacCmdStatus, devpriv->io_addr + ICP_MULTI_DAC_CSR); for (n = 0; n < insn->n; n++) { - /* Wait for analogue output data register to be ready for new data, or get fed up waiting */ + /* Wait for analogue output data register to be + * ready for new data, or get fed up waiting */ timeout = 100; while (timeout--) { if (!(readw(devpriv->io_addr + @@ -467,18 +468,18 @@ dac_ready: /* ============================================================================== - Name: icp_multi_insn_read_ao +Name: icp_multi_insn_read_ao - Description: - This function reads a single analogue output. +Description: + This function reads a single analogue output. - Parameters: - struct comedi_device *dev Pointer to current device structure - struct comedi_subdevice *s Pointer to current subdevice structure - struct comedi_insn *insn Pointer to current comedi instruction - unsigned int *data Pointer to analogue output data +Parameters: + struct comedi_device *dev Pointer to current device structure + struct comedi_subdevice *s Pointer to current subdevice structure + struct comedi_insn *insn Pointer to current comedi instruction + unsigned int *data Pointer to analogue output data - Returns:int Nmuber of instructions executed +Returns:int Nmuber of instructions executed ============================================================================== */ @@ -501,18 +502,18 @@ static int icp_multi_insn_read_ao(struct comedi_device *dev, /* ============================================================================== - Name: icp_multi_insn_bits_di +Name: icp_multi_insn_bits_di - Description: - This function reads the digital inputs. +Description: + This function reads the digital inputs. - Parameters: - struct comedi_device *dev Pointer to current device structure - struct comedi_subdevice *s Pointer to current subdevice structure - struct comedi_insn *insn Pointer to current comedi instruction - unsigned int *data Pointer to analogue output data +Parameters: + struct comedi_device *dev Pointer to current device structure + struct comedi_subdevice *s Pointer to current subdevice structure + struct comedi_insn *insn Pointer to current comedi instruction + unsigned int *data Pointer to analogue output data - Returns:int Nmuber of instructions executed +Returns:int Nmuber of instructions executed ============================================================================== */ @@ -528,18 +529,18 @@ static int icp_multi_insn_bits_di(struct comedi_device *dev, /* ============================================================================== - Name: icp_multi_insn_bits_do +Name: icp_multi_insn_bits_do - Description: - This function writes the appropriate digital outputs. +Description: + This function writes the appropriate digital outputs. - Parameters: - struct comedi_device *dev Pointer to current device structure - struct comedi_subdevice *s Pointer to current subdevice structure - struct comedi_insn *insn Pointer to current comedi instruction - unsigned int *data Pointer to analogue output data +Parameters: + struct comedi_device *dev Pointer to current device structure + struct comedi_subdevice *s Pointer to current subdevice structure + struct comedi_insn *insn Pointer to current comedi instruction + unsigned int *data Pointer to analogue output data - Returns:int Nmuber of instructions executed +Returns:int Nmuber of instructions executed ============================================================================== */ @@ -571,18 +572,18 @@ static int icp_multi_insn_bits_do(struct comedi_device *dev, /* ============================================================================== - Name: icp_multi_insn_read_ctr +Name: icp_multi_insn_read_ctr - Description: - This function reads the specified counter. +Description: + This function reads the specified counter. - Parameters: - struct comedi_device *dev Pointer to current device structure - struct comedi_subdevice *s Pointer to current subdevice structure - struct comedi_insn *insn Pointer to current comedi instruction - unsigned int *data Pointer to counter data +Parameters: + struct comedi_device *dev Pointer to current device structure + struct comedi_subdevice *s Pointer to current subdevice structure + struct comedi_insn *insn Pointer to current comedi instruction + unsigned int *data Pointer to counter data - Returns:int Nmuber of instructions executed +Returns:int Nmuber of instructions executed ============================================================================== */ @@ -596,18 +597,18 @@ static int icp_multi_insn_read_ctr(struct comedi_device *dev, /* ============================================================================== - Name: icp_multi_insn_write_ctr +Name: icp_multi_insn_write_ctr - Description: - This function write to the specified counter. +Description: + This function write to the specified counter. - Parameters: - struct comedi_device *dev Pointer to current device structure - struct comedi_subdevice *s Pointer to current subdevice structure - struct comedi_insn *insn Pointer to current comedi instruction - unsigned int *data Pointer to counter data +Parameters: + struct comedi_device *dev Pointer to current device structure + struct comedi_subdevice *s Pointer to current subdevice structure + struct comedi_insn *insn Pointer to current comedi instruction + unsigned int *data Pointer to counter data - Returns:int Nmuber of instructions executed +Returns:int Nmuber of instructions executed ============================================================================== */ @@ -622,15 +623,15 @@ static int icp_multi_insn_write_ctr(struct comedi_device *dev, /* ============================================================================== - Name: interrupt_service_icp_multi +Name: interrupt_service_icp_multi - Description: - This function is the interrupt service routine for all - interrupts generated by the icp multi board. +Description: + This function is the interrupt service routine for all + interrupts generated by the icp multi board. - Parameters: - int irq - void *d Pointer to current device +Parameters: + int irq + void *d Pointer to current device ============================================================================== */ @@ -688,20 +689,20 @@ static irqreturn_t interrupt_service_icp_multi(int irq, void *d) /* ============================================================================== - Name: check_channel_list +Name: check_channel_list - Description: - This function checks if the channel list, provided by user - is built correctly +Description: + This function checks if the channel list, provided by user + is built correctly - Parameters: - struct comedi_device *dev Pointer to current sevice structure - struct comedi_subdevice *s Pointer to current subdevice structure - unsigned int *chanlist Pointer to packed channel list - unsigned int n_chan Number of channels to scan +Parameters: + struct comedi_device *dev Pointer to current sevice structure + struct comedi_subdevice *s Pointer to current subdevice structure + unsigned int *chanlist Pointer to packed channel list + unsigned int n_chan Number of channels to scan - Returns:int 0 = failure - 1 = success +Returns:int 0 = failure + 1 = success ============================================================================== */ @@ -743,20 +744,20 @@ static int check_channel_list(struct comedi_device *dev, /* ============================================================================== - Name: setup_channel_list +Name: setup_channel_list - Description: - This function sets the appropriate channel selection, - differential input mode and range bits in the ADC Command/ - Status register. +Description: + This function sets the appropriate channel selection, + differential input mode and range bits in the ADC Command/ + Status register. - Parameters: - struct comedi_device *dev Pointer to current sevice structure - struct comedi_subdevice *s Pointer to current subdevice structure - unsigned int *chanlist Pointer to packed channel list - unsigned int n_chan Number of channels to scan +Parameters: + struct comedi_device *dev Pointer to current sevice structure + struct comedi_subdevice *s Pointer to current subdevice structure + unsigned int *chanlist Pointer to packed channel list + unsigned int n_chan Number of channels to scan - Returns:Void +Returns:Void ============================================================================== */ @@ -786,7 +787,8 @@ static void setup_channel_list(struct comedi_device *dev, chanprog &= 0x000f; } - /* Clear channel, range and input mode bits in A/D command/status register */ + /* Clear channel, range and input mode bits + * in A/D command/status register */ devpriv->AdcCmdStatus &= 0xf00f; /* Set channel number and differential mode status bit */ @@ -818,15 +820,15 @@ static void setup_channel_list(struct comedi_device *dev, /* ============================================================================== - Name: icp_multi_reset +Name: icp_multi_reset - Description: - This function resets the icp multi device to a 'safe' state +Description: + This function resets the icp multi device to a 'safe' state - Parameters: - struct comedi_device *dev Pointer to current sevice structure +Parameters: + struct comedi_device *dev Pointer to current sevice structure - Returns:int 0 = success +Returns:int 0 = success ============================================================================== */ @@ -874,17 +876,17 @@ static int icp_multi_reset(struct comedi_device *dev) /* ============================================================================== - Name: icp_multi_attach +Name: icp_multi_attach - Description: - This function sets up all the appropriate data for the current - device. +Description: + This function sets up all the appropriate data for the current + device. - Parameters: - struct comedi_device *dev Pointer to current device structure - struct comedi_devconfig *it Pointer to current device configuration +Parameters: + struct comedi_device *dev Pointer to current device structure + struct comedi_devconfig *it Pointer to current device configuration - Returns:int 0 = success +Returns:int 0 = success ============================================================================== */ @@ -1072,16 +1074,16 @@ static int icp_multi_attach(struct comedi_device *dev, /* ============================================================================== - Name: icp_multi_detach +Name: icp_multi_detach - Description: - This function releases all the resources used by the current - device. +Description: + This function releases all the resources used by the current + device. - Parameters: - struct comedi_device *dev Pointer to current device structure +Parameters: + struct comedi_device *dev Pointer to current device structure - Returns:int 0 = success +Returns:int 0 = success ============================================================================== */ -- GitLab From ca5edf2f4ad1d40b8aaa5fe60630c21525b5c948 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 21 Oct 2009 01:05:46 -0700 Subject: [PATCH 071/235] Staging: comedi: icp_multi: fix style issue printk add KERN_ facility to printk (mostly KERN_DEBUG, some KERN_WARNING) Signed-off-by: Dirk Hohndel Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/icp_multi.c | 93 +++++++++++++--------- 1 file changed, 55 insertions(+), 38 deletions(-) diff --git a/drivers/staging/comedi/drivers/icp_multi.c b/drivers/staging/comedi/drivers/icp_multi.c index 27a9ae9c7f25..d6ca6ccb85bc 100644 --- a/drivers/staging/comedi/drivers/icp_multi.c +++ b/drivers/staging/comedi/drivers/icp_multi.c @@ -256,7 +256,7 @@ static int icp_multi_insn_read_ai(struct comedi_device *dev, int n, timeout; #ifdef ICP_MULTI_EXTDEBUG - printk("icp multi EDBG: BGN: icp_multi_insn_read_ai(...)\n"); + printk(KERN_DEBUG "icp multi EDBG: BGN: icp_multi_insn_read_ai(...)\n"); #endif /* Disable A/D conversion ready interrupt */ devpriv->IntEnable &= ~ADC_READY; @@ -270,7 +270,7 @@ static int icp_multi_insn_read_ai(struct comedi_device *dev, setup_channel_list(dev, s, &insn->chanspec, 1); #ifdef ICP_MULTI_EXTDEBUG - printk("icp_multi A ST=%4x IO=%p\n", + printk(KERN_DEBUG "icp_multi A ST=%4x IO=%p\n", readw(devpriv->io_addr + ICP_MULTI_ADC_CSR), devpriv->io_addr + ICP_MULTI_ADC_CSR); #endif @@ -283,14 +283,14 @@ static int icp_multi_insn_read_ai(struct comedi_device *dev, devpriv->AdcCmdStatus &= ~ADC_ST; #ifdef ICP_MULTI_EXTDEBUG - printk("icp multi B n=%d ST=%4x\n", n, + printk(KERN_DEBUG "icp multi B n=%d ST=%4x\n", n, readw(devpriv->io_addr + ICP_MULTI_ADC_CSR)); #endif udelay(1); #ifdef ICP_MULTI_EXTDEBUG - printk("icp multi C n=%d ST=%4x\n", n, + printk(KERN_DEBUG "icp multi C n=%d ST=%4x\n", n, readw(devpriv->io_addr + ICP_MULTI_ADC_CSR)); #endif @@ -303,7 +303,8 @@ static int icp_multi_insn_read_ai(struct comedi_device *dev, #ifdef ICP_MULTI_EXTDEBUG if (!(timeout % 10)) - printk("icp multi D n=%d tm=%d ST=%4x\n", n, + printk(KERN_DEBUG + "icp multi D n=%d tm=%d ST=%4x\n", n, timeout, readw(devpriv->io_addr + ICP_MULTI_ADC_CSR)); @@ -328,9 +329,9 @@ static int icp_multi_insn_read_ai(struct comedi_device *dev, data[n] = 0; #ifdef ICP_MULTI_EXTDEBUG - printk - ("icp multi EDBG: END: icp_multi_insn_read_ai(...) n=%d\n", - n); + printk(KERN_DEBUG + "icp multi EDBG: END: icp_multi_insn_read_ai(...) n=%d\n", + n); #endif return -ETIME; @@ -348,7 +349,8 @@ conv_finish: writew(devpriv->IntStatus, devpriv->io_addr + ICP_MULTI_INT_STAT); #ifdef ICP_MULTI_EXTDEBUG - printk("icp multi EDBG: END: icp_multi_insn_read_ai(...) n=%d\n", n); + printk(KERN_DEBUG + "icp multi EDBG: END: icp_multi_insn_read_ai(...) n=%d\n", n); #endif return n; } @@ -378,7 +380,8 @@ static int icp_multi_insn_write_ao(struct comedi_device *dev, int n, chan, range, timeout; #ifdef ICP_MULTI_EXTDEBUG - printk("icp multi EDBG: BGN: icp_multi_insn_write_ao(...)\n"); + printk(KERN_DEBUG + "icp multi EDBG: BGN: icp_multi_insn_write_ao(...)\n"); #endif /* Disable D/A conversion ready interrupt */ devpriv->IntEnable &= ~DAC_READY; @@ -414,7 +417,8 @@ static int icp_multi_insn_write_ao(struct comedi_device *dev, #ifdef ICP_MULTI_EXTDEBUG if (!(timeout % 10)) - printk("icp multi A n=%d tm=%d ST=%4x\n", n, + printk(KERN_DEBUG + "icp multi A n=%d tm=%d ST=%4x\n", n, timeout, readw(devpriv->io_addr + ICP_MULTI_DAC_CSR)); @@ -439,8 +443,8 @@ static int icp_multi_insn_write_ao(struct comedi_device *dev, devpriv->ao_data[chan] = 0; #ifdef ICP_MULTI_EXTDEBUG - printk - ("icp multi EDBG: END: icp_multi_insn_write_ao(...) n=%d\n", + printk(KERN_DEBUG + "icp multi EDBG: END: icp_multi_insn_write_ao(...) n=%d\n", n); #endif return -ETIME; @@ -460,7 +464,8 @@ dac_ready: } #ifdef ICP_MULTI_EXTDEBUG - printk("icp multi EDBG: END: icp_multi_insn_write_ao(...) n=%d\n", n); + printk(KERN_DEBUG + "icp multi EDBG: END: icp_multi_insn_write_ao(...) n=%d\n", n); #endif return n; } @@ -549,14 +554,14 @@ static int icp_multi_insn_bits_do(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { #ifdef ICP_MULTI_EXTDEBUG - printk("icp multi EDBG: BGN: icp_multi_insn_bits_do(...)\n"); + printk(KERN_DEBUG "icp multi EDBG: BGN: icp_multi_insn_bits_do(...)\n"); #endif if (data[0]) { s->state &= ~data[0]; s->state |= (data[0] & data[1]); - printk("Digital outputs = %4x \n", s->state); + printk(KERN_DEBUG "Digital outputs = %4x \n", s->state); writew(s->state, devpriv->io_addr + ICP_MULTI_DO); } @@ -564,7 +569,7 @@ static int icp_multi_insn_bits_do(struct comedi_device *dev, data[1] = readw(devpriv->io_addr + ICP_MULTI_DI); #ifdef ICP_MULTI_EXTDEBUG - printk("icp multi EDBG: END: icp_multi_insn_bits_do(...)\n"); + printk(KERN_DEBUG "icp multi EDBG: END: icp_multi_insn_bits_do(...)\n"); #endif return 2; } @@ -641,7 +646,8 @@ static irqreturn_t interrupt_service_icp_multi(int irq, void *d) int int_no; #ifdef ICP_MULTI_EXTDEBUG - printk("icp multi EDBG: BGN: interrupt_service_icp_multi(%d,...)\n", + printk(KERN_DEBUG + "icp multi EDBG: BGN: interrupt_service_icp_multi(%d,...)\n", irq); #endif @@ -652,7 +658,8 @@ static irqreturn_t interrupt_service_icp_multi(int irq, void *d) return IRQ_NONE; #ifdef ICP_MULTI_EXTDEBUG - printk("icp multi EDBG: interrupt_service_icp_multi() ST: %4x\n", + printk(KERN_DEBUG + "icp multi EDBG: interrupt_service_icp_multi() ST: %4x\n", readw(devpriv->io_addr + ICP_MULTI_INT_STAT)); #endif @@ -680,7 +687,8 @@ static irqreturn_t interrupt_service_icp_multi(int irq, void *d) } #ifdef ICP_MULTI_EXTDEBUG - printk("icp multi EDBG: END: interrupt_service_icp_multi(...)\n"); + printk(KERN_DEBUG + "icp multi EDBG: END: interrupt_service_icp_multi(...)\n"); #endif return IRQ_HANDLED; } @@ -713,7 +721,8 @@ static int check_channel_list(struct comedi_device *dev, unsigned int i; #ifdef ICP_MULTI_EXTDEBUG - printk("icp multi EDBG: check_channel_list(...,%d)\n", n_chan); + printk(KERN_DEBUG + "icp multi EDBG: check_channel_list(...,%d)\n", n_chan); #endif /* Check that we at least have one channel to check */ if (n_chan < 1) { @@ -726,7 +735,7 @@ static int check_channel_list(struct comedi_device *dev, if (CR_AREF(chanlist[i]) == AREF_DIFF) { if (CR_CHAN(chanlist[i]) > this_board->n_aichand) { comedi_error(dev, - "Incorrect differential ai channel number"); + "Incorrect differential ai ch-nr"); return 0; } } else { @@ -769,7 +778,8 @@ static void setup_channel_list(struct comedi_device *dev, unsigned int diff; #ifdef ICP_MULTI_EXTDEBUG - printk("icp multi EDBG: setup_channel_list(...,%d)\n", n_chan); + printk(KERN_DEBUG + "icp multi EDBG: setup_channel_list(...,%d)\n", n_chan); #endif devpriv->act_chanlist_len = n_chan; devpriv->act_chanlist_pos = 0; @@ -810,7 +820,8 @@ static void setup_channel_list(struct comedi_device *dev, devpriv->io_addr + ICP_MULTI_ADC_CSR); #ifdef ICP_MULTI_EXTDEBUG - printk("GS: %2d. [%4x]=%4x %4x\n", i, chanprog, range, + printk(KERN_DEBUG + "GS: %2d. [%4x]=%4x %4x\n", i, chanprog, range, devpriv->act_chanlist[i]); #endif } @@ -837,7 +848,8 @@ static int icp_multi_reset(struct comedi_device *dev) unsigned int i; #ifdef ICP_MULTI_EXTDEBUG - printk("icp_multi EDBG: BGN: icp_multi_reset(...)\n"); + printk(KERN_DEBUG + "icp_multi EDBG: BGN: icp_multi_reset(...)\n"); #endif /* Clear INT enables and requests */ writew(0, devpriv->io_addr + ICP_MULTI_INT_EN); @@ -868,7 +880,8 @@ static int icp_multi_reset(struct comedi_device *dev) writew(0, devpriv->io_addr + ICP_MULTI_DO); #ifdef ICP_MULTI_EXTDEBUG - printk("icp multi EDBG: END: icp_multi_reset(...)\n"); + printk(KERN_DEBUG + "icp multi EDBG: END: icp_multi_reset(...)\n"); #endif return 0; } @@ -900,7 +913,8 @@ static int icp_multi_attach(struct comedi_device *dev, resource_size_t io_addr[5], iobase; unsigned char pci_bus, pci_slot, pci_func; - printk("icp_multi EDBG: BGN: icp_multi_attach(...)\n"); + printk(KERN_WARNING + "icp_multi EDBG: BGN: icp_multi_attach(...)\n"); /* Alocate private data storage space */ ret = alloc_private(dev, sizeof(struct icp_multi_private)); @@ -918,7 +932,8 @@ static int icp_multi_attach(struct comedi_device *dev, ); } - printk("Anne's comedi%d: icp_multi: board=%s", dev->minor, + printk(KERN_WARNING + "Anne's comedi%d: icp_multi: board=%s", dev->minor, this_board->name); card = select_and_alloc_pci_card(PCI_VENDOR_ID_ICP, @@ -932,24 +947,26 @@ static int icp_multi_attach(struct comedi_device *dev, if ((pci_card_data(card, &pci_bus, &pci_slot, &pci_func, &io_addr[0], &irq)) < 0) { - printk(" - Can't get configuration data!\n"); + printk(KERN_WARNING " - Can't get configuration data!\n"); return -EIO; } iobase = io_addr[2]; devpriv->phys_iobase = iobase; - printk(", b:s:f=%d:%d:%d, io=0x%8llx \n", pci_bus, pci_slot, pci_func, + printk(KERN_WARNING + ", b:s:f=%d:%d:%d, io=0x%8llx \n", pci_bus, pci_slot, pci_func, (unsigned long long)iobase); devpriv->io_addr = ioremap(iobase, ICP_MULTI_SIZE); if (devpriv->io_addr == NULL) { - printk("ioremap failed.\n"); + printk(KERN_WARNING "ioremap failed.\n"); return -ENOMEM; } #ifdef ICP_MULTI_EXTDEBUG - printk("0x%08llx mapped to %p, ", (unsigned long long)iobase, + printk(KERN_DEBUG + "0x%08llx mapped to %p, ", (unsigned long long)iobase, devpriv->io_addr); #endif @@ -977,20 +994,20 @@ static int icp_multi_attach(struct comedi_device *dev, if (irq) { if (request_irq(irq, interrupt_service_icp_multi, IRQF_SHARED, "Inova Icp Multi", dev)) { - printk - (", unable to allocate IRQ %u, DISABLING IT", + printk(KERN_WARNING + "unable to allocate IRQ %u, DISABLING IT", irq); irq = 0; /* Can't use IRQ */ } else - printk(", irq=%u", irq); + printk(KERN_WARNING ", irq=%u", irq); } else - printk(", IRQ disabled"); + printk(KERN_WARNING ", IRQ disabled"); } else irq = 0; dev->irq = irq; - printk(".\n"); + printk(KERN_WARNING ".\n"); subdev = 0; @@ -1065,7 +1082,7 @@ static int icp_multi_attach(struct comedi_device *dev, devpriv->valid = 1; #ifdef ICP_MULTI_EXTDEBUG - printk("icp multi EDBG: END: icp_multi_attach(...)\n"); + printk(KERN_DEBUG "icp multi EDBG: END: icp_multi_attach(...)\n"); #endif return 0; -- GitLab From 932b3ee7e3ebdf3f6362aee7de52b8b4e9c4ff6a Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 21 Oct 2009 01:05:47 -0700 Subject: [PATCH 072/235] Staging: comedi: icp_multi: don't init static don't initialize static variable to 0 Signed-off-by: Dirk Hohndel Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/icp_multi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/icp_multi.c b/drivers/staging/comedi/drivers/icp_multi.c index d6ca6ccb85bc..fa0e48173bd4 100644 --- a/drivers/staging/comedi/drivers/icp_multi.c +++ b/drivers/staging/comedi/drivers/icp_multi.c @@ -133,7 +133,7 @@ static int icp_multi_detach(struct comedi_device *dev); Data & Structure declarations ============================================================================== */ -static unsigned short pci_list_builded = 0; /*>0 list of card is known */ +static unsigned short pci_list_builded; /*>0 list of card is known */ struct boardtype { const char *name; /* driver name */ -- GitLab From dc1fe479413996629df9ab10b9f4749ba60ae637 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 21 Oct 2009 01:05:48 -0700 Subject: [PATCH 073/235] Staging: comedi: ii_pci20kc: white space fixes No code changes - left some 80 char violations alone as folding those lines would have made code less readable Signed-off-by: Dirk Hohndel Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ii_pci20kc.c | 44 ++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/staging/comedi/drivers/ii_pci20kc.c b/drivers/staging/comedi/drivers/ii_pci20kc.c index 24df2453e683..6885714be993 100644 --- a/drivers/staging/comedi/drivers/ii_pci20kc.c +++ b/drivers/staging/comedi/drivers/ii_pci20kc.c @@ -23,7 +23,8 @@ * no extern trigger implemented * * NOT WORKING (but soon) only 4 on-board differential channels supported - * NOT WORKING (but soon) only ONE di-port and ONE do-port supported instead of 4 digital ports + * NOT WORKING (but soon) only ONE di-port and ONE do-port supported + * instead of 4 digital ports * di-port == Port 0 * do-port == Port 1 * @@ -63,17 +64,17 @@ Options: options for PCI-20006M: first: Analog output channel 0 range configuration - 0 bipolar 10 (-10V -- +10V) - 1 unipolar 10 (0V -- +10V) - 2 bipolar 5 (-5V -- 5V) + 0 bipolar 10 (-10V -- +10V) + 1 unipolar 10 (0V -- +10V) + 2 bipolar 5 (-5V -- 5V) second: Analog output channel 1 range configuration options for PCI-20341M: first: Analog input gain configuration - 0 1 - 1 10 - 2 100 - 3 200 + 0 1 + 1 10 + 2 100 + 3 200 */ /* XXX needs to use ioremap() for compatibility with 2.4 kernels. Should also @@ -95,12 +96,12 @@ options for PCI-20341M: #define PCI20000_DIO_3 0xc1 #define PCI20000_DIO_CONTROL_01 0x83 /* port 0, 1 control */ #define PCI20000_DIO_CONTROL_23 0xc3 /* port 2, 3 control */ -#define PCI20000_DIO_BUFFER 0x82 /* buffer direction and enable */ +#define PCI20000_DIO_BUFFER 0x82 /* buffer direction & enable */ #define PCI20000_DIO_EOC 0xef /* even port, control output */ #define PCI20000_DIO_OOC 0xfd /* odd port, control output */ #define PCI20000_DIO_EIC 0x90 /* even port, control input */ #define PCI20000_DIO_OIC 0x82 /* odd port, control input */ -#define DIO_CAND 0x12 /* and bit 1, bit 4 of control */ +#define DIO_CAND 0x12 /* and bit 1 & 4 of control */ #define DIO_BE 0x01 /* buffer: port enable */ #define DIO_BO 0x04 /* buffer: output */ #define DIO_BI 0x05 /* buffer: input */ @@ -137,7 +138,8 @@ union pci20xxx_subdev_private { void *iobase; struct { void *iobase; - const struct comedi_lrange *ao_range_list[2]; /* range of channels of ao module */ + const struct comedi_lrange *ao_range_list[2]; + /* range of channels of ao module */ unsigned int last_data[2]; } pci20006; struct { @@ -339,7 +341,8 @@ static int pci20006_insn_write(struct comedi_device *dev, unsigned int boarddata; sdp->pci20006.last_data[CR_CHAN(insn->chanspec)] = data[0]; - boarddata = (((unsigned int)data[0] + 0x8000) & 0xffff); /* comedi-data -> board-data */ + boarddata = (((unsigned int)data[0] + 0x8000) & 0xffff); + /* comedi-data -> board-data */ lo = (boarddata & 0xff); hi = ((boarddata >> 8) & 0xff); @@ -373,8 +376,7 @@ static const int pci20341_settling_time[] = { 0x58, 0x58, 0x93, 0x99 }; static const struct comedi_lrange range_bipolar0_5 = { 1, {BIP_RANGE(0.5)} }; static const struct comedi_lrange range_bipolar0_05 = { 1, {BIP_RANGE(0.05)} }; -static const struct comedi_lrange range_bipolar0_025 = - { 1, {BIP_RANGE(0.025)} }; +static const struct comedi_lrange range_bipolar0_025 = { 1, {BIP_RANGE(0.025)} }; static const struct comedi_lrange *const pci20341_ranges[] = { &range_bipolar5, @@ -502,20 +504,18 @@ static int pci20xxx_dio_insn_config(struct comedi_device *dev, int mask, bits; mask = 1 << CR_CHAN(insn->chanspec); - if (mask & 0x000000ff) { + if (mask & 0x000000ff) bits = 0x000000ff; - } else if (mask & 0x0000ff00) { + else if (mask & 0x0000ff00) bits = 0x0000ff00; - } else if (mask & 0x00ff0000) { + else if (mask & 0x00ff0000) bits = 0x00ff0000; - } else { + else bits = 0xff000000; - } - if (data[0]) { + if (data[0]) s->io_bits |= bits; - } else { + else s->io_bits &= ~bits; - } pci20xxx_dio_config(dev, s); return 1; -- GitLab From 13ccea3ff07cabcc48eb5e953eec24141b7be9d6 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 21 Oct 2009 01:05:49 -0700 Subject: [PATCH 074/235] Staging: comedi: ii_pci_20kc: fix style printk add KERN_ facility to printk (mostly KERN_INFO, some KERN_WARNING) I think I found a bug - commented on it but didn't change as it's just in a printk (off by 1 error in output) Signed-off-by: Dirk Hohndel Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ii_pci20kc.c | 39 +++++++++++---------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/drivers/staging/comedi/drivers/ii_pci20kc.c b/drivers/staging/comedi/drivers/ii_pci20kc.c index 6885714be993..e26c1b88ebeb 100644 --- a/drivers/staging/comedi/drivers/ii_pci20kc.c +++ b/drivers/staging/comedi/drivers/ii_pci20kc.c @@ -226,14 +226,13 @@ static int pci20xxx_attach(struct comedi_device *dev, /* Check PCI-20001 C-2A Carrier Board ID */ if ((readb(devpriv->ioaddr) & PCI20000_ID) != PCI20000_ID) { - printk("comedi%d: ii_pci20kc", dev->minor); - printk - (" PCI-20001 C-2A Carrier Board at base=0x%p not found !\n", - devpriv->ioaddr); + printk(KERN_WARNING "comedi%d: ii_pci20kc PCI-20001" + " C-2A Carrier Board at base=0x%p not found !\n", + dev->minor, devpriv->ioaddr); return -EINVAL; } - printk("comedi%d:\n", dev->minor); - printk("ii_pci20kc: PCI-20001 C-2A at base=0x%p\n", devpriv->ioaddr); + printk(KERN_INFO "comedi%d: ii_pci20kc: PCI-20001 C-2A at base=0x%p\n", + dev->minor, devpriv->ioaddr); for (i = 0; i < PCI20000_MODULES; i++) { s = dev->subdevices + i; @@ -246,21 +245,23 @@ static int pci20xxx_attach(struct comedi_device *dev, devpriv->ioaddr + (i + 1) * PCI20000_OFFSET; pci20006_init(dev, s, it->options[2 * i + 2], it->options[2 * i + 3]); - printk("comedi%d: ii_pci20kc", dev->minor); - printk(" PCI-20006 module in slot %d \n", i + 1); + printk(KERN_INFO "comedi%d: " + "ii_pci20kc PCI-20006 module in slot %d \n", + dev->minor, i + 1); break; case PCI20341_ID: sdp->pci20341.iobase = devpriv->ioaddr + (i + 1) * PCI20000_OFFSET; pci20341_init(dev, s, it->options[2 * i + 2], it->options[2 * i + 3]); - printk("comedi%d: ii_pci20kc", dev->minor); - printk(" PCI-20341 module in slot %d \n", i + 1); + printk(KERN_INFO "comedi%d: " + "ii_pci20kc PCI-20341 module in slot %d \n", + dev->minor, i + 1); break; default: - printk - ("ii_pci20kc: unknown module code 0x%02x in slot %d: module disabled\n", - id, i); + printk(KERN_WARNING "ii_pci20kc: unknown module " + "code 0x%02x in slot %d: module disabled\n", + id, i); /* XXX this looks like a bug! i + 1 ?? */ /* fall through */ case PCI20xxx_EMPTY_ID: s->type = COMEDI_SUBD_UNUSED; @@ -276,7 +277,7 @@ static int pci20xxx_attach(struct comedi_device *dev, static int pci20xxx_detach(struct comedi_device *dev) { - printk("comedi%d: pci20xxx: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: pci20xxx: remove\n", dev->minor); return 0; } @@ -358,7 +359,8 @@ static int pci20006_insn_write(struct comedi_device *dev, writeb(0x00, sdp->iobase + PCI20006_STROBE1); break; default: - printk(" comedi%d: pci20xxx: ao channel Error!\n", dev->minor); + printk(KERN_WARNING + " comedi%d: pci20xxx: ao channel Error!\n", dev->minor); return -EINVAL; } @@ -449,9 +451,10 @@ static int pci20341_insn_read(struct comedi_device *dev, eoc = readb(sdp->iobase + PCI20341_STATUS_REG); } if (j >= 100) { - printk - ("comedi%d: pci20xxx: AI interrupt channel %i polling exit !\n", - dev->minor, i); + printk(KERN_WARNING + "comedi%d: pci20xxx: " + "AI interrupt channel %i polling exit !\n", + dev->minor, i); return -EINVAL; } lo = readb(sdp->iobase + PCI20341_LDATA); -- GitLab From 26ac87851aa65f6bc58c2d1aa9162951a1dcd999 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 21 Oct 2009 01:05:50 -0700 Subject: [PATCH 075/235] Staging: comedi: ke_counter: fix style issues 80 char limit (where useful) braces around single line block KERN_ facility for printk Signed-off-by: Dirk Hohndel Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ke_counter.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/ke_counter.c b/drivers/staging/comedi/drivers/ke_counter.c index c145e829108f..73b0445e310f 100644 --- a/drivers/staging/comedi/drivers/ke_counter.c +++ b/drivers/staging/comedi/drivers/ke_counter.c @@ -192,12 +192,14 @@ static int cnt_attach(struct comedi_device *dev, struct comedi_devconfig *it) } } } - printk("comedi%d: no supported board found! (req. bus/slot: %d/%d)\n", + printk(KERN_WARNING + "comedi%d: no supported board found! (req. bus/slot: %d/%d)\n", dev->minor, it->options[0], it->options[1]); return -EIO; found: - printk("comedi%d: found %s at PCI bus %d, slot %d\n", dev->minor, + printk(KERN_INFO + "comedi%d: found %s at PCI bus %d, slot %d\n", dev->minor, board->name, pci_device->bus->number, PCI_SLOT(pci_device->devfn)); devpriv->pcidev = pci_device; @@ -206,9 +208,9 @@ found: /* enable PCI device and request regions */ error = comedi_pci_enable(pci_device, CNT_DRIVER_NAME); if (error < 0) { - printk - ("comedi%d: failed to enable PCI device and request regions!\n", - dev->minor); + printk(KERN_WARNING "comedi%d: " + "failed to enable PCI device and request regions!\n", + dev->minor); return error; } @@ -239,7 +241,8 @@ found: outb(0, dev->iobase + 0x20); outb(0, dev->iobase + 0x40); - printk("comedi%d: " CNT_DRIVER_NAME " attached.\n", dev->minor); + printk(KERN_INFO "comedi%d: " CNT_DRIVER_NAME " attached.\n", + dev->minor); return 0; } @@ -248,11 +251,11 @@ found: static int cnt_detach(struct comedi_device *dev) { if (devpriv && devpriv->pcidev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pcidev); - } pci_dev_put(devpriv->pcidev); } - printk("comedi%d: " CNT_DRIVER_NAME " remove\n", dev->minor); + printk(KERN_INFO "comedi%d: " CNT_DRIVER_NAME " remove\n", + dev->minor); return 0; } -- GitLab From ea25371a78c33e276527361d3ab19393d558b2fd Mon Sep 17 00:00:00 2001 From: Bernd Porr Date: Mon, 16 Nov 2009 01:12:02 +0000 Subject: [PATCH 076/235] Staging: comedi: fix usbdux timeout bug I've fixed a bug in the USBDUX driver which caused timeouts while sending commands to the boards. This was mainly because of one bulk transfer which had a timeout of 1ms (!). I've now set all timeouts to 1000ms. From: Bernd Porr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbdux.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index cec028e0db13..f2dab1a4d41b 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -1,4 +1,4 @@ -#define DRIVER_VERSION "v2.2" +#define DRIVER_VERSION "v2.3" #define DRIVER_AUTHOR "Bernd Porr, BerndPorr@f2s.com" #define DRIVER_DESC "Stirling/ITL USB-DUX -- Bernd.Porr@f2s.com" /* @@ -80,6 +80,7 @@ sampling rate. If you sample two channels you get 4kHz and so on. * 2.0: PWM seems to be stable and is not interfering with the other functions * 2.1: changed PWM API * 2.2: added firmware kernel request to fix an udev problem + * 2.3: corrected a bug in bulk timeouts which were far too short * */ @@ -101,8 +102,8 @@ sampling rate. If you sample two channels you get 4kHz and so on. #define BOARDNAME "usbdux" -/* timeout for the USB-transfer */ -#define EZTIMEOUT 30 +/* timeout for the USB-transfer in ms*/ +#define BULK_TIMEOUT 1000 /* constants for "firmware" upload and download */ #define USBDUXSUB_FIRMWARE 0xA0 @@ -750,7 +751,7 @@ static int usbduxsub_start(struct usbduxsub *usbduxsub) /* Length */ 1, /* Timeout */ - EZTIMEOUT); + BULK_TIMEOUT); if (errcode < 0) { dev_err(&usbduxsub->interface->dev, "comedi_: control msg failed (start)\n"); @@ -780,7 +781,7 @@ static int usbduxsub_stop(struct usbduxsub *usbduxsub) /* Length */ 1, /* Timeout */ - EZTIMEOUT); + BULK_TIMEOUT); if (errcode < 0) { dev_err(&usbduxsub->interface->dev, "comedi_: control msg failed (stop)\n"); @@ -810,7 +811,7 @@ static int usbduxsub_upload(struct usbduxsub *usbduxsub, /* length */ len, /* timeout */ - EZTIMEOUT); + BULK_TIMEOUT); dev_dbg(&usbduxsub->interface->dev, "comedi_: result=%d\n", errcode); if (errcode < 0) { dev_err(&usbduxsub->interface->dev, "comedi_: upload failed\n"); @@ -1110,7 +1111,7 @@ static int send_dux_commands(struct usbduxsub *this_usbduxsub, int cmd_type) usb_sndbulkpipe(this_usbduxsub->usbdev, COMMAND_OUT_EP), this_usbduxsub->dux_commands, SIZEOFDUXBUFFER, - &nsent, 10); + &nsent, BULK_TIMEOUT); if (result < 0) dev_err(&this_usbduxsub->interface->dev, "comedi%d: " "could not transmit dux_command to the usb-device, " @@ -1130,7 +1131,7 @@ static int receive_dux_commands(struct usbduxsub *this_usbduxsub, int command) usb_rcvbulkpipe(this_usbduxsub->usbdev, COMMAND_IN_EP), this_usbduxsub->insnBuffer, SIZEINSNBUF, - &nrec, 1); + &nrec, BULK_TIMEOUT); if (result < 0) { dev_err(&this_usbduxsub->interface->dev, "comedi%d: " "insn: USB error %d while receiving DUX command" -- GitLab From 67a6efb1f86eb51e4b702c4e8e735ca24e3427d8 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 20 Nov 2009 11:32:36 +0000 Subject: [PATCH 077/235] Staging: comedi: serial2002: decrease stack usage 512 bytes of stack can be saved in serial_2002_open() by modifying 'struct config_t'. A short int suffices for the 'kind' and 'bits' members. (Actually, a char would suffice, but wouldn't save any more stack than a short int.) Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/serial2002.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c index e7c13eba983b..db37dcdd98b6 100644 --- a/drivers/staging/comedi/drivers/serial2002.c +++ b/drivers/staging/comedi/drivers/serial2002.c @@ -404,8 +404,8 @@ static void serial_2002_open(struct comedi_device *dev) } else { struct config_t { - int kind; - int bits; + short int kind; + short int bits; int min; int max; }; -- GitLab From 48b1aff5b93521c5ad90842bef52b218ac50a4ab Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 20 Nov 2009 11:32:37 +0000 Subject: [PATCH 078/235] Staging: comedi: initialize divisor variables The i8253_cascade_ns_to_timer_2div() function (and i8253_cascade_ns_to_timer macro) checks the old values *d1 and *d2 for correctness as a heuristic before calculating new values. Don't call the function with uninitialized values in *d1 and *d2. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 2 +- drivers/staging/comedi/drivers/adv_pci1710.c | 4 ++-- drivers/staging/comedi/drivers/cb_das16_cs.c | 4 ++-- drivers/staging/comedi/drivers/pcl711.c | 1 + drivers/staging/comedi/drivers/pcl816.c | 2 +- drivers/staging/comedi/drivers/pcl818.c | 6 +++--- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 1ee4b6a91c1f..791ea8334e1e 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -780,7 +780,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, struct comedi_cmd *cmd) { int err = 0; - int tmp, divisor1, divisor2; + int tmp, divisor1 = 0, divisor2 = 0; /* step 1: make sure trigger sources are trivially valid */ diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index f0ae4c06fe95..951e57949f7f 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -830,7 +830,7 @@ static irqreturn_t interrupt_service_pci1710(int irq, void *d) static int pci171x_ai_docmd_and_mode(int mode, struct comedi_device *dev, struct comedi_subdevice *s) { - unsigned int divisor1, divisor2; + unsigned int divisor1 = 0, divisor2 = 0; unsigned int seglen; DPRINTK("adv_pci1710 EDBG: BGN: pci171x_ai_docmd_and_mode(%d,...)\n", @@ -934,7 +934,7 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev, struct comedi_cmd *cmd) { int err = 0; - int tmp, divisor1, divisor2; + int tmp, divisor1 = 0, divisor2 = 0; DPRINTK("adv_pci1710 EDBG: BGN: pci171x_ai_cmdtest(...)\n"); #ifdef PCI171X_EXTDEBUG diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index b47b3b1ba350..bc375e73abc1 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -452,7 +452,7 @@ static int das16cs_ai_cmdtest(struct comedi_device *dev, /* step 4: fix up any arguments */ if (cmd->scan_begin_src == TRIG_TIMER) { - unsigned int div1, div2; + unsigned int div1 = 0, div2 = 0; tmp = cmd->scan_begin_arg; i8253_cascade_ns_to_timer(100, &div1, &div2, @@ -462,7 +462,7 @@ static int das16cs_ai_cmdtest(struct comedi_device *dev, err++; } if (cmd->convert_src == TRIG_TIMER) { - unsigned int div1, div2; + unsigned int div1 = 0, div2 = 0; tmp = cmd->convert_arg; i8253_cascade_ns_to_timer(100, &div1, &div2, diff --git a/drivers/staging/comedi/drivers/pcl711.c b/drivers/staging/comedi/drivers/pcl711.c index dd9db069a932..4914784f6995 100644 --- a/drivers/staging/comedi/drivers/pcl711.c +++ b/drivers/staging/comedi/drivers/pcl711.c @@ -407,6 +407,7 @@ static int pcl711_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) * 0xb4 = Select Counter 2 | LSB/MSB | Mode=2 | Binary */ + timer1 = timer2 = 0; i8253_cascade_ns_to_timer(i8253_osc_base, &timer1, &timer2, &cmd->scan_begin_arg, TRIG_ROUND_NEAREST); diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index fa2414500a07..f9a0dac79eca 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -472,7 +472,7 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { int err = 0; - int tmp, divisor1, divisor2; + int tmp, divisor1 = 0, divisor2 = 0; DEBUG(printk("pcl816 pcl812_ai_cmdtest\n"); pcl816_cmdtest_out(-1, cmd); ); diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index e95229b13118..819dd838b075 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -970,7 +970,7 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device *dev, struct comedi_subdevice *s) { struct comedi_cmd *cmd = &s->async->cmd; - int divisor1, divisor2; + int divisor1 = 0, divisor2 = 0; unsigned int seglen; printk("pcl818_ai_cmd_mode()\n"); @@ -1089,7 +1089,7 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device *dev, static int pcl818_ao_mode13(int mode, struct comedi_device *dev, struct comedi_subdevice *s, comedi_trig * it) { - int divisor1, divisor2; + int divisor1 = 0, divisor2 = 0; if (!dev->irq) { comedi_error(dev, "IRQ not defined!"); @@ -1287,7 +1287,7 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { int err = 0; - int tmp, divisor1, divisor2; + int tmp, divisor1 = 0, divisor2 = 0; /* step 1: make sure trigger sources are trivially valid */ -- GitLab From efdf83c1763156220a74c8f2755c1a6fa1e1c26b Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 20 Nov 2009 11:32:38 +0000 Subject: [PATCH 079/235] Staging: comedi: pcl816: update convert_src mask for AI cmdtest The COMEDI_CMDTEST ioctl needs to clear unsupported bits in the struct comedi_cmd's convert_src and other *_src members. This needs fixing in the pcl816 driver's AI cmdtest. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcl816.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index f9a0dac79eca..1b1708a58b67 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -488,7 +488,9 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, if (!cmd->scan_begin_src || tmp != cmd->scan_begin_src) err++; - if (!(cmd->convert_src & (TRIG_EXT | TRIG_TIMER))) + tmp = cmd->convert_src; + cmd->convert_src &= TRIG_EXT | TRIG_TIMER; + if (!cmd->convert_src || tmp != cmd->convert_src) err++; tmp = cmd->scan_end_src; -- GitLab From 644bf7b5983cf2540b57a5b25b775cb3c1e8e943 Mon Sep 17 00:00:00 2001 From: Nitin Gupta Date: Tue, 22 Sep 2009 10:26:52 +0530 Subject: [PATCH 080/235] Staging: xvmalloc memory allocator * Features: - Low metadata overhead (just 4 bytes per object) - O(1) Alloc/Free - except when we have to call system page allocator to get additional memory. - Very low fragmentation: In all tests, xvmalloc memory usage is within 12% of "Ideal". - Pool based allocator: Each pool can grow and shrink. - It maps pages only when required. So, it does not hog vmalloc area which is very small on 32-bit systems. SLUB allocator could not be used due to fragmentation issues: http://code.google.com/p/compcache/wiki/AllocatorsComparison Data here shows kmalloc using ~43% more memory than TLSF and xvMalloc is showed ~2% more space efficiency than TLSF (due to smaller metadata). Creating various kmem_caches can reduce space efficiency gap but still problem of being limited to low memory exists. Also, it depends on allocating higher order pages to reduce fragmentation - this is not acceptable for ramzswap as it is used under memory crunch (its a swap device!). SLOB allocator could not be used do to reasons mentioned here: http://lkml.org/lkml/2009/3/18/210 * Implementation: It uses two-level bitmap search to find free list containing block of correct size. This idea is taken from TLSF (Two-Level Segregate Fit) allocator and is well explained in its paper (see [Links] below). * Limitations: - Poor scalability: No per-cpu data structures (work in progress). [Links] 1. Details and Performance data: http://code.google.com/p/compcache/wiki/xvMalloc http://code.google.com/p/compcache/wiki/xvMallocPerformance 2. TLSF memory allocator: home: http://rtportal.upv.es/rtmalloc/ paper: http://rtportal.upv.es/rtmalloc/files/MRBC_2008.pdf Signed-off-by: Nitin Gupta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ramzswap/xvmalloc.c | 507 ++++++++++++++++++++++++ drivers/staging/ramzswap/xvmalloc.h | 30 ++ drivers/staging/ramzswap/xvmalloc_int.h | 86 ++++ 3 files changed, 623 insertions(+) create mode 100644 drivers/staging/ramzswap/xvmalloc.c create mode 100644 drivers/staging/ramzswap/xvmalloc.h create mode 100644 drivers/staging/ramzswap/xvmalloc_int.h diff --git a/drivers/staging/ramzswap/xvmalloc.c b/drivers/staging/ramzswap/xvmalloc.c new file mode 100644 index 000000000000..b3e986c33141 --- /dev/null +++ b/drivers/staging/ramzswap/xvmalloc.c @@ -0,0 +1,507 @@ +/* + * xvmalloc memory allocator + * + * Copyright (C) 2008, 2009 Nitin Gupta + * + * This code is released using a dual license strategy: BSD/GPL + * You can choose the licence that better fits your requirements. + * + * Released under the terms of 3-clause BSD License + * Released under the terms of GNU General Public License Version 2.0 + */ + +#include +#include +#include +#include +#include +#include + +#include "xvmalloc.h" +#include "xvmalloc_int.h" + +static void stat_inc(u64 *value) +{ + *value = *value + 1; +} + +static void stat_dec(u64 *value) +{ + *value = *value - 1; +} + +static int test_flag(struct block_header *block, enum blockflags flag) +{ + return block->prev & BIT(flag); +} + +static void set_flag(struct block_header *block, enum blockflags flag) +{ + block->prev |= BIT(flag); +} + +static void clear_flag(struct block_header *block, enum blockflags flag) +{ + block->prev &= ~BIT(flag); +} + +/* + * Given pair, provide a derefrencable pointer. + * This is called from xv_malloc/xv_free path, so it + * needs to be fast. + */ +static void *get_ptr_atomic(struct page *page, u16 offset, enum km_type type) +{ + unsigned char *base; + + base = kmap_atomic(page, type); + return base + offset; +} + +static void put_ptr_atomic(void *ptr, enum km_type type) +{ + kunmap_atomic(ptr, type); +} + +static u32 get_blockprev(struct block_header *block) +{ + return block->prev & PREV_MASK; +} + +static void set_blockprev(struct block_header *block, u16 new_offset) +{ + block->prev = new_offset | (block->prev & FLAGS_MASK); +} + +static struct block_header *BLOCK_NEXT(struct block_header *block) +{ + return (struct block_header *) + ((char *)block + block->size + XV_ALIGN); +} + +/* + * Get index of free list containing blocks of maximum size + * which is less than or equal to given size. + */ +static u32 get_index_for_insert(u32 size) +{ + if (unlikely(size > XV_MAX_ALLOC_SIZE)) + size = XV_MAX_ALLOC_SIZE; + size &= ~FL_DELTA_MASK; + return (size - XV_MIN_ALLOC_SIZE) >> FL_DELTA_SHIFT; +} + +/* + * Get index of free list having blocks of size greater than + * or equal to requested size. + */ +static u32 get_index(u32 size) +{ + if (unlikely(size < XV_MIN_ALLOC_SIZE)) + size = XV_MIN_ALLOC_SIZE; + size = ALIGN(size, FL_DELTA); + return (size - XV_MIN_ALLOC_SIZE) >> FL_DELTA_SHIFT; +} + +/** + * find_block - find block of at least given size + * @pool: memory pool to search from + * @size: size of block required + * @page: page containing required block + * @offset: offset within the page where block is located. + * + * Searches two level bitmap to locate block of at least + * the given size. If such a block is found, it provides + * to identify this block and returns index + * in freelist where we found this block. + * Otherwise, returns 0 and params are not touched. + */ +static u32 find_block(struct xv_pool *pool, u32 size, + struct page **page, u32 *offset) +{ + ulong flbitmap, slbitmap; + u32 flindex, slindex, slbitstart; + + /* There are no free blocks in this pool */ + if (!pool->flbitmap) + return 0; + + /* Get freelist index correspoding to this size */ + slindex = get_index(size); + slbitmap = pool->slbitmap[slindex / BITS_PER_LONG]; + slbitstart = slindex % BITS_PER_LONG; + + /* + * If freelist is not empty at this index, we found the + * block - head of this list. This is approximate best-fit match. + */ + if (test_bit(slbitstart, &slbitmap)) { + *page = pool->freelist[slindex].page; + *offset = pool->freelist[slindex].offset; + return slindex; + } + + /* + * No best-fit found. Search a bit further in bitmap for a free block. + * Second level bitmap consists of series of 32-bit chunks. Search + * further in the chunk where we expected a best-fit, starting from + * index location found above. + */ + slbitstart++; + slbitmap >>= slbitstart; + + /* Skip this search if we were already at end of this bitmap chunk */ + if ((slbitstart != BITS_PER_LONG) && slbitmap) { + slindex += __ffs(slbitmap) + 1; + *page = pool->freelist[slindex].page; + *offset = pool->freelist[slindex].offset; + return slindex; + } + + /* Now do a full two-level bitmap search to find next nearest fit */ + flindex = slindex / BITS_PER_LONG; + + flbitmap = (pool->flbitmap) >> (flindex + 1); + if (!flbitmap) + return 0; + + flindex += __ffs(flbitmap) + 1; + slbitmap = pool->slbitmap[flindex]; + slindex = (flindex * BITS_PER_LONG) + __ffs(slbitmap); + *page = pool->freelist[slindex].page; + *offset = pool->freelist[slindex].offset; + + return slindex; +} + +/* + * Insert block at in freelist of given pool. + * freelist used depends on block size. + */ +static void insert_block(struct xv_pool *pool, struct page *page, u32 offset, + struct block_header *block) +{ + u32 flindex, slindex; + struct block_header *nextblock; + + slindex = get_index_for_insert(block->size); + flindex = slindex / BITS_PER_LONG; + + block->link.prev_page = 0; + block->link.prev_offset = 0; + block->link.next_page = pool->freelist[slindex].page; + block->link.next_offset = pool->freelist[slindex].offset; + pool->freelist[slindex].page = page; + pool->freelist[slindex].offset = offset; + + if (block->link.next_page) { + nextblock = get_ptr_atomic(block->link.next_page, + block->link.next_offset, KM_USER1); + nextblock->link.prev_page = page; + nextblock->link.prev_offset = offset; + put_ptr_atomic(nextblock, KM_USER1); + } + + __set_bit(slindex % BITS_PER_LONG, &pool->slbitmap[flindex]); + __set_bit(flindex, &pool->flbitmap); +} + +/* + * Remove block from head of freelist. Index 'slindex' identifies the freelist. + */ +static void remove_block_head(struct xv_pool *pool, + struct block_header *block, u32 slindex) +{ + struct block_header *tmpblock; + u32 flindex = slindex / BITS_PER_LONG; + + pool->freelist[slindex].page = block->link.next_page; + pool->freelist[slindex].offset = block->link.next_offset; + block->link.prev_page = 0; + block->link.prev_offset = 0; + + if (!pool->freelist[slindex].page) { + __clear_bit(slindex % BITS_PER_LONG, &pool->slbitmap[flindex]); + if (!pool->slbitmap[flindex]) + __clear_bit(flindex, &pool->flbitmap); + } else { + /* + * DEBUG ONLY: We need not reinitialize freelist head previous + * pointer to 0 - we never depend on its value. But just for + * sanity, lets do it. + */ + tmpblock = get_ptr_atomic(pool->freelist[slindex].page, + pool->freelist[slindex].offset, KM_USER1); + tmpblock->link.prev_page = 0; + tmpblock->link.prev_offset = 0; + put_ptr_atomic(tmpblock, KM_USER1); + } +} + +/* + * Remove block from freelist. Index 'slindex' identifies the freelist. + */ +static void remove_block(struct xv_pool *pool, struct page *page, u32 offset, + struct block_header *block, u32 slindex) +{ + u32 flindex; + struct block_header *tmpblock; + + if (pool->freelist[slindex].page == page + && pool->freelist[slindex].offset == offset) { + remove_block_head(pool, block, slindex); + return; + } + + flindex = slindex / BITS_PER_LONG; + + if (block->link.prev_page) { + tmpblock = get_ptr_atomic(block->link.prev_page, + block->link.prev_offset, KM_USER1); + tmpblock->link.next_page = block->link.next_page; + tmpblock->link.next_offset = block->link.next_offset; + put_ptr_atomic(tmpblock, KM_USER1); + } + + if (block->link.next_page) { + tmpblock = get_ptr_atomic(block->link.next_page, + block->link.next_offset, KM_USER1); + tmpblock->link.prev_page = block->link.prev_page; + tmpblock->link.prev_offset = block->link.prev_offset; + put_ptr_atomic(tmpblock, KM_USER1); + } +} + +/* + * Allocate a page and add it freelist of given pool. + */ +static int grow_pool(struct xv_pool *pool, gfp_t flags) +{ + struct page *page; + struct block_header *block; + + page = alloc_page(flags); + if (unlikely(!page)) + return -ENOMEM; + + stat_inc(&pool->total_pages); + + spin_lock(&pool->lock); + block = get_ptr_atomic(page, 0, KM_USER0); + + block->size = PAGE_SIZE - XV_ALIGN; + set_flag(block, BLOCK_FREE); + clear_flag(block, PREV_FREE); + set_blockprev(block, 0); + + insert_block(pool, page, 0, block); + + put_ptr_atomic(block, KM_USER0); + spin_unlock(&pool->lock); + + return 0; +} + +/* + * Create a memory pool. Allocates freelist, bitmaps and other + * per-pool metadata. + */ +struct xv_pool *xv_create_pool(void) +{ + u32 ovhd_size; + struct xv_pool *pool; + + ovhd_size = roundup(sizeof(*pool), PAGE_SIZE); + pool = kzalloc(ovhd_size, GFP_KERNEL); + if (!pool) + return NULL; + + spin_lock_init(&pool->lock); + + return pool; +} + +void xv_destroy_pool(struct xv_pool *pool) +{ + kfree(pool); +} + +/** + * xv_malloc - Allocate block of given size from pool. + * @pool: pool to allocate from + * @size: size of block to allocate + * @page: page no. that holds the object + * @offset: location of object within page + * + * On success, identifies block allocated + * and 0 is returned. On failure, is set to + * 0 and -ENOMEM is returned. + * + * Allocation requests with size > XV_MAX_ALLOC_SIZE will fail. + */ +int xv_malloc(struct xv_pool *pool, u32 size, struct page **page, + u32 *offset, gfp_t flags) +{ + int error; + u32 index, tmpsize, origsize, tmpoffset; + struct block_header *block, *tmpblock; + + *page = NULL; + *offset = 0; + origsize = size; + + if (unlikely(!size || size > XV_MAX_ALLOC_SIZE)) + return -ENOMEM; + + size = ALIGN(size, XV_ALIGN); + + spin_lock(&pool->lock); + + index = find_block(pool, size, page, offset); + + if (!*page) { + spin_unlock(&pool->lock); + if (flags & GFP_NOWAIT) + return -ENOMEM; + error = grow_pool(pool, flags); + if (unlikely(error)) + return error; + + spin_lock(&pool->lock); + index = find_block(pool, size, page, offset); + } + + if (!*page) { + spin_unlock(&pool->lock); + return -ENOMEM; + } + + block = get_ptr_atomic(*page, *offset, KM_USER0); + + remove_block_head(pool, block, index); + + /* Split the block if required */ + tmpoffset = *offset + size + XV_ALIGN; + tmpsize = block->size - size; + tmpblock = (struct block_header *)((char *)block + size + XV_ALIGN); + if (tmpsize) { + tmpblock->size = tmpsize - XV_ALIGN; + set_flag(tmpblock, BLOCK_FREE); + clear_flag(tmpblock, PREV_FREE); + + set_blockprev(tmpblock, *offset); + if (tmpblock->size >= XV_MIN_ALLOC_SIZE) + insert_block(pool, *page, tmpoffset, tmpblock); + + if (tmpoffset + XV_ALIGN + tmpblock->size != PAGE_SIZE) { + tmpblock = BLOCK_NEXT(tmpblock); + set_blockprev(tmpblock, tmpoffset); + } + } else { + /* This block is exact fit */ + if (tmpoffset != PAGE_SIZE) + clear_flag(tmpblock, PREV_FREE); + } + + block->size = origsize; + clear_flag(block, BLOCK_FREE); + + put_ptr_atomic(block, KM_USER0); + spin_unlock(&pool->lock); + + *offset += XV_ALIGN; + + return 0; +} + +/* + * Free block identified with + */ +void xv_free(struct xv_pool *pool, struct page *page, u32 offset) +{ + void *page_start; + struct block_header *block, *tmpblock; + + offset -= XV_ALIGN; + + spin_lock(&pool->lock); + + page_start = get_ptr_atomic(page, 0, KM_USER0); + block = (struct block_header *)((char *)page_start + offset); + + /* Catch double free bugs */ + BUG_ON(test_flag(block, BLOCK_FREE)); + + block->size = ALIGN(block->size, XV_ALIGN); + + tmpblock = BLOCK_NEXT(block); + if (offset + block->size + XV_ALIGN == PAGE_SIZE) + tmpblock = NULL; + + /* Merge next block if its free */ + if (tmpblock && test_flag(tmpblock, BLOCK_FREE)) { + /* + * Blocks smaller than XV_MIN_ALLOC_SIZE + * are not inserted in any free list. + */ + if (tmpblock->size >= XV_MIN_ALLOC_SIZE) { + remove_block(pool, page, + offset + block->size + XV_ALIGN, tmpblock, + get_index_for_insert(tmpblock->size)); + } + block->size += tmpblock->size + XV_ALIGN; + } + + /* Merge previous block if its free */ + if (test_flag(block, PREV_FREE)) { + tmpblock = (struct block_header *)((char *)(page_start) + + get_blockprev(block)); + offset = offset - tmpblock->size - XV_ALIGN; + + if (tmpblock->size >= XV_MIN_ALLOC_SIZE) + remove_block(pool, page, offset, tmpblock, + get_index_for_insert(tmpblock->size)); + + tmpblock->size += block->size + XV_ALIGN; + block = tmpblock; + } + + /* No used objects in this page. Free it. */ + if (block->size == PAGE_SIZE - XV_ALIGN) { + put_ptr_atomic(page_start, KM_USER0); + spin_unlock(&pool->lock); + + __free_page(page); + stat_dec(&pool->total_pages); + return; + } + + set_flag(block, BLOCK_FREE); + if (block->size >= XV_MIN_ALLOC_SIZE) + insert_block(pool, page, offset, block); + + if (offset + block->size + XV_ALIGN != PAGE_SIZE) { + tmpblock = BLOCK_NEXT(block); + set_flag(tmpblock, PREV_FREE); + set_blockprev(tmpblock, offset); + } + + put_ptr_atomic(page_start, KM_USER0); + spin_unlock(&pool->lock); +} + +u32 xv_get_object_size(void *obj) +{ + struct block_header *blk; + + blk = (struct block_header *)((char *)(obj) - XV_ALIGN); + return blk->size; +} + +/* + * Returns total memory used by allocator (userdata + metadata) + */ +u64 xv_get_total_size_bytes(struct xv_pool *pool) +{ + return pool->total_pages << PAGE_SHIFT; +} diff --git a/drivers/staging/ramzswap/xvmalloc.h b/drivers/staging/ramzswap/xvmalloc.h new file mode 100644 index 000000000000..010c6fe5e173 --- /dev/null +++ b/drivers/staging/ramzswap/xvmalloc.h @@ -0,0 +1,30 @@ +/* + * xvmalloc memory allocator + * + * Copyright (C) 2008, 2009 Nitin Gupta + * + * This code is released using a dual license strategy: BSD/GPL + * You can choose the licence that better fits your requirements. + * + * Released under the terms of 3-clause BSD License + * Released under the terms of GNU General Public License Version 2.0 + */ + +#ifndef _XV_MALLOC_H_ +#define _XV_MALLOC_H_ + +#include + +struct xv_pool; + +struct xv_pool *xv_create_pool(void); +void xv_destroy_pool(struct xv_pool *pool); + +int xv_malloc(struct xv_pool *pool, u32 size, struct page **page, + u32 *offset, gfp_t flags); +void xv_free(struct xv_pool *pool, struct page *page, u32 offset); + +u32 xv_get_object_size(void *obj); +u64 xv_get_total_size_bytes(struct xv_pool *pool); + +#endif diff --git a/drivers/staging/ramzswap/xvmalloc_int.h b/drivers/staging/ramzswap/xvmalloc_int.h new file mode 100644 index 000000000000..03c1a652a3aa --- /dev/null +++ b/drivers/staging/ramzswap/xvmalloc_int.h @@ -0,0 +1,86 @@ +/* + * xvmalloc memory allocator + * + * Copyright (C) 2008, 2009 Nitin Gupta + * + * This code is released using a dual license strategy: BSD/GPL + * You can choose the licence that better fits your requirements. + * + * Released under the terms of 3-clause BSD License + * Released under the terms of GNU General Public License Version 2.0 + */ + +#ifndef _XV_MALLOC_INT_H_ +#define _XV_MALLOC_INT_H_ + +#include +#include + +/* User configurable params */ + +/* Must be power of two */ +#define XV_ALIGN_SHIFT 2 +#define XV_ALIGN (1 << XV_ALIGN_SHIFT) +#define XV_ALIGN_MASK (XV_ALIGN - 1) + +/* This must be greater than sizeof(link_free) */ +#define XV_MIN_ALLOC_SIZE 32 +#define XV_MAX_ALLOC_SIZE (PAGE_SIZE - XV_ALIGN) + +/* Free lists are separated by FL_DELTA bytes */ +#define FL_DELTA_SHIFT 3 +#define FL_DELTA (1 << FL_DELTA_SHIFT) +#define FL_DELTA_MASK (FL_DELTA - 1) +#define NUM_FREE_LISTS ((XV_MAX_ALLOC_SIZE - XV_MIN_ALLOC_SIZE) \ + / FL_DELTA + 1) + +#define MAX_FLI DIV_ROUND_UP(NUM_FREE_LISTS, BITS_PER_LONG) + +/* End of user params */ + +enum blockflags { + BLOCK_FREE, + PREV_FREE, + __NR_BLOCKFLAGS, +}; + +#define FLAGS_MASK XV_ALIGN_MASK +#define PREV_MASK (~FLAGS_MASK) + +struct freelist_entry { + struct page *page; + u16 offset; + u16 pad; +}; + +struct link_free { + struct page *prev_page; + struct page *next_page; + u16 prev_offset; + u16 next_offset; +}; + +struct block_header { + union { + /* This common header must be ALIGN bytes */ + u8 common[XV_ALIGN]; + struct { + u16 size; + u16 prev; + }; + }; + struct link_free link; +}; + +struct xv_pool { + ulong flbitmap; + ulong slbitmap[MAX_FLI]; + spinlock_t lock; + + struct freelist_entry freelist[NUM_FREE_LISTS]; + + /* stats */ + u64 total_pages; +}; + +#endif -- GitLab From 306b0c957f3f0e7da6551652abbfe17b560173ce Mon Sep 17 00:00:00 2001 From: Nitin Gupta Date: Tue, 22 Sep 2009 10:26:53 +0530 Subject: [PATCH 081/235] Staging: virtual block device driver (ramzswap) Creates RAM based block devices (/dev/ramzswapX) which can be used (only) as swap disks. Pages swapped to these are compressed and stored in memory itself. The module is called ramzswap.ko. It depends on: - xvmalloc memory allocator (compiled with this driver) - lzo_compress.ko - lzo_decompress.ko See ramzswap.txt for usage details. Signed-off-by: Nitin Gupta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/ramzswap/Kconfig | 21 + drivers/staging/ramzswap/Makefile | 3 + drivers/staging/ramzswap/ramzswap_drv.c | 1435 +++++++++++++++++++++ drivers/staging/ramzswap/ramzswap_drv.h | 171 +++ drivers/staging/ramzswap/ramzswap_ioctl.h | 49 + 7 files changed, 1682 insertions(+) create mode 100644 drivers/staging/ramzswap/Kconfig create mode 100644 drivers/staging/ramzswap/Makefile create mode 100644 drivers/staging/ramzswap/ramzswap_drv.c create mode 100644 drivers/staging/ramzswap/ramzswap_drv.h create mode 100644 drivers/staging/ramzswap/ramzswap_ioctl.h diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 37ec2138d385..f012304e22a8 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -123,6 +123,8 @@ source "drivers/staging/sep/Kconfig" source "drivers/staging/iio/Kconfig" +source "drivers/staging/ramzswap/Kconfig" + source "drivers/staging/strip/Kconfig" source "drivers/staging/arlan/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index ff7222d7ed8f..0c0dd53e5027 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -43,6 +43,7 @@ obj-$(CONFIG_VME_BUS) += vme/ obj-$(CONFIG_RAR_REGISTER) += rar/ obj-$(CONFIG_DX_SEP) += sep/ obj-$(CONFIG_IIO) += iio/ +obj-$(CONFIG_RAMZSWAP) += ramzswap/ obj-$(CONFIG_STRIP) += strip/ obj-$(CONFIG_ARLAN) += arlan/ obj-$(CONFIG_WAVELAN) += wavelan/ diff --git a/drivers/staging/ramzswap/Kconfig b/drivers/staging/ramzswap/Kconfig new file mode 100644 index 000000000000..24e25691fae2 --- /dev/null +++ b/drivers/staging/ramzswap/Kconfig @@ -0,0 +1,21 @@ +config RAMZSWAP + tristate "Compressed in-memory swap device (ramzswap)" + depends on SWAP + select LZO_COMPRESS + select LZO_DECOMPRESS + default n + help + Creates virtual block devices which can be used (only) as a swap + disks. Pages swapped to these disks are compressed and stored in + memory itself. + + See ramzswap.txt for more information. + Project home: http://compcache.googlecode.com/ + +config RAMZSWAP_STATS + bool "Enable ramzswap stats" + depends on RAMZSWAP + default y + help + Enable statistics collection for ramzswap. This adds only a minimal + overhead. In unsure, say Y. diff --git a/drivers/staging/ramzswap/Makefile b/drivers/staging/ramzswap/Makefile new file mode 100644 index 000000000000..507d7dc3b864 --- /dev/null +++ b/drivers/staging/ramzswap/Makefile @@ -0,0 +1,3 @@ +ramzswap-objs := ramzswap_drv.o xvmalloc.o + +obj-$(CONFIG_RAMZSWAP) += ramzswap.o diff --git a/drivers/staging/ramzswap/ramzswap_drv.c b/drivers/staging/ramzswap/ramzswap_drv.c new file mode 100644 index 000000000000..b839f05efbce --- /dev/null +++ b/drivers/staging/ramzswap/ramzswap_drv.c @@ -0,0 +1,1435 @@ +/* + * Compressed RAM based swap device + * + * Copyright (C) 2008, 2009 Nitin Gupta + * + * This code is released using a dual license strategy: BSD/GPL + * You can choose the licence that better fits your requirements. + * + * Released under the terms of 3-clause BSD License + * Released under the terms of GNU General Public License Version 2.0 + * + * Project home: http://compcache.googlecode.com + */ + +#define KMSG_COMPONENT "ramzswap" +#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ramzswap_drv.h" + +/* Globals */ +static int ramzswap_major; +static struct ramzswap *devices; + +/* + * Pages that compress to larger than this size are + * forwarded to backing swap, if present or stored + * uncompressed in memory otherwise. + */ +static unsigned int max_zpage_size; + +/* Module params (documentation at end) */ +static unsigned int num_devices; + +static int rzs_test_flag(struct ramzswap *rzs, u32 index, + enum rzs_pageflags flag) +{ + return rzs->table[index].flags & BIT(flag); +} + +static void rzs_set_flag(struct ramzswap *rzs, u32 index, + enum rzs_pageflags flag) +{ + rzs->table[index].flags |= BIT(flag); +} + +static void rzs_clear_flag(struct ramzswap *rzs, u32 index, + enum rzs_pageflags flag) +{ + rzs->table[index].flags &= ~BIT(flag); +} + +static int page_zero_filled(void *ptr) +{ + unsigned int pos; + unsigned long *page; + + page = (unsigned long *)ptr; + + for (pos = 0; pos != PAGE_SIZE / sizeof(*page); pos++) { + if (page[pos]) + return 0; + } + + return 1; +} + +/* + * memlimit cannot be greater than backing disk size. + */ +static void ramzswap_set_memlimit(struct ramzswap *rzs, size_t totalram_bytes) +{ + int memlimit_valid = 1; + + if (!rzs->memlimit) { + pr_info("Memory limit not set.\n"); + memlimit_valid = 0; + } + + if (rzs->memlimit > rzs->disksize) { + pr_info("Memory limit cannot be greater than " + "disksize: limit=%zu, disksize=%zu\n", + rzs->memlimit, rzs->disksize); + memlimit_valid = 0; + } + + if (!memlimit_valid) { + size_t mempart, disksize; + pr_info("Using default: smaller of (%u%% of RAM) and " + "(backing disk size).\n", + default_memlimit_perc_ram); + mempart = default_memlimit_perc_ram * (totalram_bytes / 100); + disksize = rzs->disksize; + rzs->memlimit = mempart > disksize ? disksize : mempart; + } + + if (rzs->memlimit > totalram_bytes / 2) { + pr_info( + "Its not advisable setting limit more than half of " + "size of memory since we expect a 2:1 compression ratio. " + "Limit represents amount of *compressed* data we can keep " + "in memory!\n" + "\tMemory Size: %zu kB\n" + "\tLimit you selected: %zu kB\n" + "Continuing anyway ...\n", + totalram_bytes >> 10, rzs->memlimit >> 10 + ); + } + + rzs->memlimit &= PAGE_MASK; + BUG_ON(!rzs->memlimit); +} + +static void ramzswap_set_disksize(struct ramzswap *rzs, size_t totalram_bytes) +{ + if (!rzs->disksize) { + pr_info( + "disk size not provided. You can use disksize_kb module " + "param to specify size.\nUsing default: (%u%% of RAM).\n", + default_disksize_perc_ram + ); + rzs->disksize = default_disksize_perc_ram * + (totalram_bytes / 100); + } + + if (rzs->disksize > 2 * (totalram_bytes)) { + pr_info( + "There is little point creating a ramzswap of greater than " + "twice the size of memory since we expect a 2:1 compression " + "ratio. Note that ramzswap uses about 0.1%% of the size of " + "the swap device when not in use so a huge ramzswap is " + "wasteful.\n" + "\tMemory Size: %zu kB\n" + "\tSize you selected: %zu kB\n" + "Continuing anyway ...\n", + totalram_bytes >> 10, rzs->disksize + ); + } + + rzs->disksize &= PAGE_MASK; +} + +/* + * Swap header (1st page of swap device) contains information + * to indentify it as a swap partition. Prepare such a header + * for ramzswap device (ramzswap0) so that swapon can identify + * it as swap partition. In case backing swap device is provided, + * copy its swap header. + */ +static int setup_swap_header(struct ramzswap *rzs, union swap_header *s) +{ + int ret = 0; + struct page *page; + struct address_space *mapping; + union swap_header *backing_swap_header; + + /* + * There is no backing swap device. Create a swap header + * that is acceptable by swapon. + */ + if (!rzs->backing_swap) { + s->info.version = 1; + s->info.last_page = (rzs->disksize >> PAGE_SHIFT) - 1; + s->info.nr_badpages = 0; + memcpy(s->magic.magic, "SWAPSPACE2", 10); + return 0; + } + + /* + * We have a backing swap device. Copy its swap header + * to ramzswap device header. If this header contains + * invalid information (backing device not a swap + * partition, etc.), swapon will fail for ramzswap + * which is correct behavior - we don't want to swap + * over filesystem partition! + */ + + /* Read the backing swap header (code from sys_swapon) */ + mapping = rzs->swap_file->f_mapping; + if (!mapping->a_ops->readpage) { + ret = -EINVAL; + goto out; + } + + page = read_mapping_page(mapping, 0, rzs->swap_file); + if (IS_ERR(page)) { + ret = PTR_ERR(page); + goto out; + } + + backing_swap_header = kmap(page); + memcpy(s, backing_swap_header, sizeof(*s)); + if (s->info.nr_badpages) { + pr_info("Cannot use backing swap with bad pages (%u)\n", + s->info.nr_badpages); + ret = -EINVAL; + } + /* + * ramzswap disksize equals number of usable pages in backing + * swap. Set last_page in swap header to match this disksize + * ('last_page' means 0-based index of last usable swap page). + */ + s->info.last_page = (rzs->disksize >> PAGE_SHIFT) - 1; + kunmap(page); + +out: + return ret; +} + +static void ramzswap_flush_dcache_page(struct page *page) +{ +#ifdef CONFIG_ARM + int flag = 0; + /* + * Ugly hack to get flush_dcache_page() work on ARM. + * page_mapping(page) == NULL after clearing this swap cache flag. + * Without clearing this flag, flush_dcache_page() will simply set + * "PG_dcache_dirty" bit and return. + */ + if (PageSwapCache(page)) { + flag = 1; + ClearPageSwapCache(page); + } +#endif + flush_dcache_page(page); +#ifdef CONFIG_ARM + if (flag) + SetPageSwapCache(page); +#endif +} + +void ramzswap_ioctl_get_stats(struct ramzswap *rzs, + struct ramzswap_ioctl_stats *s) +{ + strncpy(s->backing_swap_name, rzs->backing_swap_name, + MAX_SWAP_NAME_LEN - 1); + s->backing_swap_name[MAX_SWAP_NAME_LEN - 1] = '\0'; + + s->disksize = rzs->disksize; + s->memlimit = rzs->memlimit; + +#if defined(CONFIG_RAMZSWAP_STATS) + { + struct ramzswap_stats *rs = &rzs->stats; + size_t succ_writes, mem_used; + unsigned int good_compress_perc = 0, no_compress_perc = 0; + + mem_used = xv_get_total_size_bytes(rzs->mem_pool) + + (rs->pages_expand << PAGE_SHIFT); + succ_writes = rs->num_writes - rs->failed_writes; + + if (succ_writes && rs->pages_stored) { + good_compress_perc = rs->good_compress * 100 + / rs->pages_stored; + no_compress_perc = rs->pages_expand * 100 + / rs->pages_stored; + } + + s->num_reads = rs->num_reads; + s->num_writes = rs->num_writes; + s->failed_reads = rs->failed_reads; + s->failed_writes = rs->failed_writes; + s->invalid_io = rs->invalid_io; + s->pages_zero = rs->pages_zero; + + s->good_compress_pct = good_compress_perc; + s->pages_expand_pct = no_compress_perc; + + s->pages_stored = rs->pages_stored; + s->pages_used = mem_used >> PAGE_SHIFT; + s->orig_data_size = rs->pages_stored << PAGE_SHIFT; + s->compr_data_size = rs->compr_size; + s->mem_used_total = mem_used; + + s->bdev_num_reads = rs->bdev_num_reads; + s->bdev_num_writes = rs->bdev_num_writes; + } +#endif /* CONFIG_RAMZSWAP_STATS */ +} + +static int add_backing_swap_extent(struct ramzswap *rzs, + pgoff_t phy_pagenum, + pgoff_t num_pages) +{ + unsigned int idx; + struct list_head *head; + struct page *curr_page, *new_page; + unsigned int extents_per_page = PAGE_SIZE / + sizeof(struct ramzswap_backing_extent); + + idx = rzs->num_extents % extents_per_page; + if (!idx) { + new_page = alloc_page(__GFP_ZERO); + if (!new_page) + return -ENOMEM; + + if (rzs->num_extents) { + curr_page = virt_to_page(rzs->curr_extent); + head = &curr_page->lru; + } else { + head = &rzs->backing_swap_extent_list; + } + + list_add(&new_page->lru, head); + rzs->curr_extent = page_address(new_page); + } + + rzs->curr_extent->phy_pagenum = phy_pagenum; + rzs->curr_extent->num_pages = num_pages; + + pr_debug("add_extent: idx=%u, phy_pgnum=%lu, num_pgs=%lu, " + "pg_last=%lu, curr_ext=%p\n", idx, phy_pagenum, num_pages, + phy_pagenum + num_pages - 1, rzs->curr_extent); + + if (idx != extents_per_page - 1) + rzs->curr_extent++; + + return 0; +} + +static int setup_backing_swap_extents(struct ramzswap *rzs, + struct inode *inode, unsigned long *num_pages) +{ + int ret = 0; + unsigned blkbits; + unsigned blocks_per_page; + pgoff_t contig_pages = 0, total_pages = 0; + pgoff_t pagenum = 0, prev_pagenum = 0; + sector_t probe_block = 0; + sector_t last_block; + + blkbits = inode->i_blkbits; + blocks_per_page = PAGE_SIZE >> blkbits; + + last_block = i_size_read(inode) >> blkbits; + while (probe_block + blocks_per_page <= last_block) { + unsigned block_in_page; + sector_t first_block; + + first_block = bmap(inode, probe_block); + if (first_block == 0) + goto bad_bmap; + + /* It must be PAGE_SIZE aligned on-disk */ + if (first_block & (blocks_per_page - 1)) { + probe_block++; + goto probe_next; + } + + /* All blocks within this page must be contiguous on disk */ + for (block_in_page = 1; block_in_page < blocks_per_page; + block_in_page++) { + sector_t block; + + block = bmap(inode, probe_block + block_in_page); + if (block == 0) + goto bad_bmap; + if (block != first_block + block_in_page) { + /* Discontiguity */ + probe_block++; + goto probe_next; + } + } + + /* + * We found a PAGE_SIZE length, PAGE_SIZE aligned + * run of blocks. + */ + pagenum = first_block >> (PAGE_SHIFT - blkbits); + + if (total_pages && (pagenum != prev_pagenum + 1)) { + ret = add_backing_swap_extent(rzs, prev_pagenum - + (contig_pages - 1), contig_pages); + if (ret < 0) + goto out; + rzs->num_extents++; + contig_pages = 0; + } + total_pages++; + contig_pages++; + prev_pagenum = pagenum; + probe_block += blocks_per_page; + +probe_next: + continue; + } + + if (contig_pages) { + pr_debug("adding last extent: pagenum=%lu, " + "contig_pages=%lu\n", pagenum, contig_pages); + ret = add_backing_swap_extent(rzs, + prev_pagenum - (contig_pages - 1), contig_pages); + if (ret < 0) + goto out; + rzs->num_extents++; + } + if (!rzs->num_extents) { + pr_err("No swap extents found!\n"); + ret = -EINVAL; + } + + if (!ret) { + *num_pages = total_pages; + pr_info("Found %lu extents containing %luk\n", + rzs->num_extents, *num_pages << (PAGE_SHIFT - 10)); + } + goto out; + +bad_bmap: + pr_err("Backing swapfile has holes\n"); + ret = -EINVAL; +out: + while (ret && !list_empty(&rzs->backing_swap_extent_list)) { + struct page *page; + struct list_head *entry = rzs->backing_swap_extent_list.next; + page = list_entry(entry, struct page, lru); + list_del(entry); + __free_page(page); + } + return ret; +} + +static void map_backing_swap_extents(struct ramzswap *rzs) +{ + struct ramzswap_backing_extent *se; + struct page *table_page, *se_page; + unsigned long num_pages, num_table_pages, entry; + unsigned long se_idx, span; + unsigned entries_per_page = PAGE_SIZE / sizeof(*rzs->table); + unsigned extents_per_page = PAGE_SIZE / sizeof(*se); + + /* True for block device */ + if (!rzs->num_extents) + return; + + se_page = list_entry(rzs->backing_swap_extent_list.next, + struct page, lru); + se = page_address(se_page); + span = se->num_pages; + num_pages = rzs->disksize >> PAGE_SHIFT; + num_table_pages = DIV_ROUND_UP(num_pages * sizeof(*rzs->table), + PAGE_SIZE); + + entry = 0; + se_idx = 0; + while (num_table_pages--) { + table_page = vmalloc_to_page(&rzs->table[entry]); + while (span <= entry) { + se_idx++; + if (se_idx == rzs->num_extents) + BUG(); + + if (!(se_idx % extents_per_page)) { + se_page = list_entry(se_page->lru.next, + struct page, lru); + se = page_address(se_page); + } else + se++; + + span += se->num_pages; + } + table_page->mapping = (struct address_space *)se; + table_page->private = se->num_pages - (span - entry); + pr_debug("map_table: entry=%lu, span=%lu, map=%p, priv=%lu\n", + entry, span, table_page->mapping, table_page->private); + entry += entries_per_page; + } +} + +/* + * Check if value of backing_swap module param is sane. + * Claim this device and set ramzswap size equal to + * size of this block device. + */ +static int setup_backing_swap(struct ramzswap *rzs) +{ + int ret = 0; + size_t disksize; + unsigned long num_pages = 0; + struct inode *inode; + struct file *swap_file; + struct address_space *mapping; + struct block_device *bdev = NULL; + + if (!rzs->backing_swap_name[0]) { + pr_debug("backing_swap param not given\n"); + goto out; + } + + pr_info("Using backing swap device: %s\n", rzs->backing_swap_name); + + swap_file = filp_open(rzs->backing_swap_name, + O_RDWR | O_LARGEFILE, 0); + if (IS_ERR(swap_file)) { + pr_err("Error opening backing device: %s\n", + rzs->backing_swap_name); + ret = -EINVAL; + goto out; + } + + mapping = swap_file->f_mapping; + inode = mapping->host; + + if (S_ISBLK(inode->i_mode)) { + bdev = I_BDEV(inode); + ret = bd_claim(bdev, setup_backing_swap); + if (ret < 0) { + bdev = NULL; + goto bad_param; + } + disksize = i_size_read(inode); + } else if (S_ISREG(inode->i_mode)) { + bdev = inode->i_sb->s_bdev; + if (IS_SWAPFILE(inode)) { + ret = -EBUSY; + goto bad_param; + } + ret = setup_backing_swap_extents(rzs, inode, &num_pages); + if (ret < 0) + goto bad_param; + disksize = num_pages << PAGE_SHIFT; + } else { + goto bad_param; + } + + rzs->swap_file = swap_file; + rzs->backing_swap = bdev; + rzs->disksize = disksize; + BUG_ON(!rzs->disksize); + + return 0; + +bad_param: + if (bdev) + bd_release(bdev); + filp_close(swap_file, NULL); + +out: + rzs->backing_swap = NULL; + return ret; +} + +/* + * Map logical page number 'pagenum' to physical page number + * on backing swap device. For block device, this is a nop. + */ +u32 map_backing_swap_page(struct ramzswap *rzs, u32 pagenum) +{ + u32 skip_pages, entries_per_page; + size_t delta, se_offset, skipped; + struct page *table_page, *se_page; + struct ramzswap_backing_extent *se; + + if (!rzs->num_extents) + return pagenum; + + entries_per_page = PAGE_SIZE / sizeof(*rzs->table); + + table_page = vmalloc_to_page(&rzs->table[pagenum]); + se = (struct ramzswap_backing_extent *)table_page->mapping; + se_page = virt_to_page(se); + + skip_pages = pagenum - (pagenum / entries_per_page * entries_per_page); + se_offset = table_page->private + skip_pages; + + if (se_offset < se->num_pages) + return se->phy_pagenum + se_offset; + + skipped = se->num_pages - table_page->private; + do { + struct ramzswap_backing_extent *se_base; + u32 se_entries_per_page = PAGE_SIZE / sizeof(*se); + + /* Get next swap extent */ + se_base = (struct ramzswap_backing_extent *) + page_address(se_page); + if (se - se_base == se_entries_per_page - 1) { + se_page = list_entry(se_page->lru.next, + struct page, lru); + se = page_address(se_page); + } else { + se++; + } + + skipped += se->num_pages; + } while (skipped < skip_pages); + + delta = skipped - skip_pages; + se_offset = se->num_pages - delta; + + return se->phy_pagenum + se_offset; +} + +static void ramzswap_free_page(struct ramzswap *rzs, size_t index) +{ + u32 clen; + void *obj; + + struct page *page = rzs->table[index].page; + u32 offset = rzs->table[index].offset; + + if (unlikely(!page)) { + if (rzs_test_flag(rzs, index, RZS_ZERO)) { + rzs_clear_flag(rzs, index, RZS_ZERO); + stat_dec(rzs->stats.pages_zero); + } + return; + } + + if (unlikely(rzs_test_flag(rzs, index, RZS_UNCOMPRESSED))) { + clen = PAGE_SIZE; + __free_page(page); + rzs_clear_flag(rzs, index, RZS_UNCOMPRESSED); + stat_dec(rzs->stats.pages_expand); + goto out; + } + + obj = kmap_atomic(page, KM_USER0) + offset; + clen = xv_get_object_size(obj) - sizeof(struct zobj_header); + kunmap_atomic(obj, KM_USER0); + + xv_free(rzs->mem_pool, page, offset); + if (clen <= PAGE_SIZE / 2) + stat_dec(rzs->stats.good_compress); + +out: + rzs->stats.compr_size -= clen; + stat_dec(rzs->stats.pages_stored); + + rzs->table[index].page = NULL; + rzs->table[index].offset = 0; +} + +static int handle_zero_page(struct bio *bio) +{ + void *user_mem; + struct page *page = bio->bi_io_vec[0].bv_page; + + user_mem = kmap_atomic(page, KM_USER0); + memset(user_mem, 0, PAGE_SIZE); + kunmap_atomic(user_mem, KM_USER0); + + ramzswap_flush_dcache_page(page); + + set_bit(BIO_UPTODATE, &bio->bi_flags); + bio_endio(bio, 0); + return 0; +} + +static int handle_uncompressed_page(struct ramzswap *rzs, struct bio *bio) +{ + u32 index; + struct page *page; + unsigned char *user_mem, *cmem; + + page = bio->bi_io_vec[0].bv_page; + index = bio->bi_sector >> SECTORS_PER_PAGE_SHIFT; + + user_mem = kmap_atomic(page, KM_USER0); + cmem = kmap_atomic(rzs->table[index].page, KM_USER1) + + rzs->table[index].offset; + + memcpy(user_mem, cmem, PAGE_SIZE); + kunmap_atomic(user_mem, KM_USER0); + kunmap_atomic(cmem, KM_USER1); + + ramzswap_flush_dcache_page(page); + + set_bit(BIO_UPTODATE, &bio->bi_flags); + bio_endio(bio, 0); + return 0; +} + + +/* + * Called when request page is not present in ramzswap. + * Its either in backing swap device (if present) or + * this is an attempt to read before any previous write + * to this location - this happens due to readahead when + * swap device is read from user-space (e.g. during swapon) + */ +static int handle_ramzswap_fault(struct ramzswap *rzs, struct bio *bio) +{ + /* + * Always forward such requests to backing swap + * device (if present) + */ + if (rzs->backing_swap) { + u32 pagenum; + stat_dec(rzs->stats.num_reads); + stat_inc(rzs->stats.bdev_num_reads); + bio->bi_bdev = rzs->backing_swap; + + /* + * In case backing swap is a file, find the right offset within + * the file corresponding to logical position 'index'. For block + * device, this is a nop. + */ + pagenum = bio->bi_sector >> SECTORS_PER_PAGE_SHIFT; + bio->bi_sector = map_backing_swap_page(rzs, pagenum) + << SECTORS_PER_PAGE_SHIFT; + return 1; + } + + /* + * Its unlikely event in case backing dev is + * not present + */ + pr_debug("Read before write on swap device: " + "sector=%lu, size=%u, offset=%u\n", + (ulong)(bio->bi_sector), bio->bi_size, + bio->bi_io_vec[0].bv_offset); + + /* Do nothing. Just return success */ + set_bit(BIO_UPTODATE, &bio->bi_flags); + bio_endio(bio, 0); + return 0; +} + +static int ramzswap_read(struct ramzswap *rzs, struct bio *bio) +{ + int ret; + u32 index; + size_t clen; + struct page *page; + struct zobj_header *zheader; + unsigned char *user_mem, *cmem; + + stat_inc(rzs->stats.num_reads); + + page = bio->bi_io_vec[0].bv_page; + index = bio->bi_sector >> SECTORS_PER_PAGE_SHIFT; + + if (rzs_test_flag(rzs, index, RZS_ZERO)) + return handle_zero_page(bio); + + /* Requested page is not present in compressed area */ + if (!rzs->table[index].page) + return handle_ramzswap_fault(rzs, bio); + + /* Page is stored uncompressed since its incompressible */ + if (unlikely(rzs_test_flag(rzs, index, RZS_UNCOMPRESSED))) + return handle_uncompressed_page(rzs, bio); + + user_mem = kmap_atomic(page, KM_USER0); + clen = PAGE_SIZE; + + cmem = kmap_atomic(rzs->table[index].page, KM_USER1) + + rzs->table[index].offset; + + ret = lzo1x_decompress_safe( + cmem + sizeof(*zheader), + xv_get_object_size(cmem) - sizeof(*zheader), + user_mem, &clen); + + kunmap_atomic(user_mem, KM_USER0); + kunmap_atomic(cmem, KM_USER1); + + /* should NEVER happen */ + if (unlikely(ret != LZO_E_OK)) { + pr_err("Decompression failed! err=%d, page=%u\n", + ret, index); + stat_inc(rzs->stats.failed_reads); + goto out; + } + + ramzswap_flush_dcache_page(page); + + set_bit(BIO_UPTODATE, &bio->bi_flags); + bio_endio(bio, 0); + return 0; + +out: + bio_io_error(bio); + return 0; +} + +static int ramzswap_write(struct ramzswap *rzs, struct bio *bio) +{ + int ret, fwd_write_request = 0; + u32 offset, index; + size_t clen; + struct zobj_header *zheader; + struct page *page, *page_store; + unsigned char *user_mem, *cmem, *src; + + stat_inc(rzs->stats.num_writes); + + page = bio->bi_io_vec[0].bv_page; + index = bio->bi_sector >> SECTORS_PER_PAGE_SHIFT; + + src = rzs->compress_buffer; + + /* + * System swaps to same sector again when the stored page + * is no longer referenced by any process. So, its now safe + * to free the memory that was allocated for this page. + */ + if (rzs->table[index].page) + ramzswap_free_page(rzs, index); + + /* + * No memory ia allocated for zero filled pages. + * Simply clear zero page flag. + */ + if (rzs_test_flag(rzs, index, RZS_ZERO)) { + stat_dec(rzs->stats.pages_zero); + rzs_clear_flag(rzs, index, RZS_ZERO); + } + + mutex_lock(&rzs->lock); + + user_mem = kmap_atomic(page, KM_USER0); + if (page_zero_filled(user_mem)) { + kunmap_atomic(user_mem, KM_USER0); + mutex_unlock(&rzs->lock); + stat_inc(rzs->stats.pages_zero); + rzs_set_flag(rzs, index, RZS_ZERO); + + set_bit(BIO_UPTODATE, &bio->bi_flags); + bio_endio(bio, 0); + return 0; + } + + if (rzs->backing_swap && + (rzs->stats.compr_size > rzs->memlimit - PAGE_SIZE)) { + kunmap_atomic(user_mem, KM_USER0); + mutex_unlock(&rzs->lock); + fwd_write_request = 1; + goto out; + } + + ret = lzo1x_1_compress(user_mem, PAGE_SIZE, src, &clen, + rzs->compress_workmem); + + kunmap_atomic(user_mem, KM_USER0); + + if (unlikely(ret != LZO_E_OK)) { + mutex_unlock(&rzs->lock); + pr_err("Compression failed! err=%d\n", ret); + stat_inc(rzs->stats.failed_writes); + goto out; + } + + /* + * Page is incompressible. Forward it to backing swap + * if present. Otherwise, store it as-is (uncompressed) + * since we do not want to return too many swap write + * errors which has side effect of hanging the system. + */ + if (unlikely(clen > max_zpage_size)) { + if (rzs->backing_swap) { + mutex_unlock(&rzs->lock); + fwd_write_request = 1; + goto out; + } + + clen = PAGE_SIZE; + page_store = alloc_page(GFP_NOIO | __GFP_HIGHMEM); + if (unlikely(!page_store)) { + mutex_unlock(&rzs->lock); + pr_info("Error allocating memory for incompressible " + "page: %u\n", index); + stat_inc(rzs->stats.failed_writes); + goto out; + } + + offset = 0; + rzs_set_flag(rzs, index, RZS_UNCOMPRESSED); + stat_inc(rzs->stats.pages_expand); + rzs->table[index].page = page_store; + src = kmap_atomic(page, KM_USER0); + goto memstore; + } + + if (xv_malloc(rzs->mem_pool, clen + sizeof(*zheader), + &rzs->table[index].page, &offset, + GFP_NOIO | __GFP_HIGHMEM)) { + mutex_unlock(&rzs->lock); + pr_info("Error allocating memory for compressed " + "page: %u, size=%zu\n", index, clen); + stat_inc(rzs->stats.failed_writes); + if (rzs->backing_swap) + fwd_write_request = 1; + goto out; + } + +memstore: + rzs->table[index].offset = offset; + + cmem = kmap_atomic(rzs->table[index].page, KM_USER1) + + rzs->table[index].offset; + +#if 0 + /* Back-reference needed for memory defragmentation */ + if (!rzs_test_flag(rzs, index, RZS_UNCOMPRESSED)) { + zheader = (struct zobj_header *)cmem; + zheader->table_idx = index; + cmem += sizeof(*zheader); + } +#endif + + memcpy(cmem, src, clen); + + kunmap_atomic(cmem, KM_USER1); + if (unlikely(rzs_test_flag(rzs, index, RZS_UNCOMPRESSED))) + kunmap_atomic(src, KM_USER0); + + /* Update stats */ + rzs->stats.compr_size += clen; + stat_inc(rzs->stats.pages_stored); + if (clen <= PAGE_SIZE / 2) + stat_inc(rzs->stats.good_compress); + + mutex_unlock(&rzs->lock); + + set_bit(BIO_UPTODATE, &bio->bi_flags); + bio_endio(bio, 0); + return 0; + +out: + if (fwd_write_request) { + stat_inc(rzs->stats.bdev_num_writes); + bio->bi_bdev = rzs->backing_swap; +#if 0 + /* + * TODO: We currently have linear mapping of ramzswap and + * backing swap sectors. This is not desired since we want + * to optimize writes to backing swap to minimize disk seeks + * or have effective wear leveling (for SSDs). Also, a + * non-linear mapping is required to implement compressed + * on-disk swapping. + */ + bio->bi_sector = get_backing_swap_page() + << SECTORS_PER_PAGE_SHIFT; +#endif + /* + * In case backing swap is a file, find the right offset within + * the file corresponding to logical position 'index'. For block + * device, this is a nop. + */ + bio->bi_sector = map_backing_swap_page(rzs, index) + << SECTORS_PER_PAGE_SHIFT; + return 1; + } + + bio_io_error(bio); + return 0; +} + + +/* + * Check if request is within bounds and page aligned. + */ +static inline int valid_swap_request(struct ramzswap *rzs, struct bio *bio) +{ + if (unlikely( + (bio->bi_sector >= (rzs->disksize >> SECTOR_SHIFT)) || + (bio->bi_sector & (SECTORS_PER_PAGE - 1)) || + (bio->bi_vcnt != 1) || + (bio->bi_size != PAGE_SIZE) || + (bio->bi_io_vec[0].bv_offset != 0))) { + + return 0; + } + + /* swap request is valid */ + return 1; +} + +/* + * Handler function for all ramzswap I/O requests. + */ +static int ramzswap_make_request(struct request_queue *queue, struct bio *bio) +{ + int ret = 0; + struct ramzswap *rzs = queue->queuedata; + + if (unlikely(!rzs->init_done)) { + bio_io_error(bio); + return 0; + } + + if (!valid_swap_request(rzs, bio)) { + stat_inc(rzs->stats.invalid_io); + bio_io_error(bio); + return 0; + } + + switch (bio_data_dir(bio)) { + case READ: + ret = ramzswap_read(rzs, bio); + break; + + case WRITE: + ret = ramzswap_write(rzs, bio); + break; + } + + return ret; +} + +static void reset_device(struct ramzswap *rzs) +{ + int is_backing_blkdev = 0; + size_t index, num_pages; + unsigned entries_per_page; + unsigned long num_table_pages, entry = 0; + + if (rzs->backing_swap && !rzs->num_extents) + is_backing_blkdev = 1; + + num_pages = rzs->disksize >> PAGE_SHIFT; + + /* Free various per-device buffers */ + kfree(rzs->compress_workmem); + free_pages((unsigned long)rzs->compress_buffer, 1); + + rzs->compress_workmem = NULL; + rzs->compress_buffer = NULL; + + /* Free all pages that are still in this ramzswap device */ + for (index = 0; index < num_pages; index++) { + struct page *page; + u16 offset; + + page = rzs->table[index].page; + offset = rzs->table[index].offset; + + if (!page) + continue; + + if (unlikely(rzs_test_flag(rzs, index, RZS_UNCOMPRESSED))) + __free_page(page); + else + xv_free(rzs->mem_pool, page, offset); + } + + entries_per_page = PAGE_SIZE / sizeof(*rzs->table); + num_table_pages = DIV_ROUND_UP(num_pages * sizeof(*rzs->table), + PAGE_SIZE); + /* + * Set page->mapping to NULL for every table page. + * Otherwise, we will hit bad_page() during free. + */ + while (rzs->num_extents && num_table_pages--) { + struct page *page; + page = vmalloc_to_page(&rzs->table[entry]); + page->mapping = NULL; + entry += entries_per_page; + } + vfree(rzs->table); + rzs->table = NULL; + + xv_destroy_pool(rzs->mem_pool); + rzs->mem_pool = NULL; + + /* Free all swap extent pages */ + while (!list_empty(&rzs->backing_swap_extent_list)) { + struct page *page; + struct list_head *entry; + entry = rzs->backing_swap_extent_list.next; + page = list_entry(entry, struct page, lru); + list_del(entry); + __free_page(page); + } + INIT_LIST_HEAD(&rzs->backing_swap_extent_list); + rzs->num_extents = 0; + + /* Close backing swap device, if present */ + if (rzs->backing_swap) { + if (is_backing_blkdev) + bd_release(rzs->backing_swap); + filp_close(rzs->swap_file, NULL); + rzs->backing_swap = NULL; + } + + /* Reset stats */ + memset(&rzs->stats, 0, sizeof(rzs->stats)); + + rzs->disksize = 0; + rzs->memlimit = 0; + + /* Back to uninitialized state */ + rzs->init_done = 0; +} + +static int ramzswap_ioctl_init_device(struct ramzswap *rzs) +{ + int ret; + size_t num_pages; + struct page *page; + union swap_header *swap_header; + + if (rzs->init_done) { + pr_info("Device already initialized!\n"); + return -EBUSY; + } + + ret = setup_backing_swap(rzs); + if (ret) + goto fail; + + if (rzs->backing_swap) + ramzswap_set_memlimit(rzs, totalram_pages << PAGE_SHIFT); + else + ramzswap_set_disksize(rzs, totalram_pages << PAGE_SHIFT); + + rzs->compress_workmem = kzalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL); + if (!rzs->compress_workmem) { + pr_err("Error allocating compressor working memory!\n"); + ret = -ENOMEM; + goto fail; + } + + rzs->compress_buffer = (void *)__get_free_pages(__GFP_ZERO, 1); + if (!rzs->compress_buffer) { + pr_err("Error allocating compressor buffer space\n"); + ret = -ENOMEM; + goto fail; + } + + num_pages = rzs->disksize >> PAGE_SHIFT; + rzs->table = vmalloc(num_pages * sizeof(*rzs->table)); + if (!rzs->table) { + pr_err("Error allocating ramzswap address table\n"); + /* To prevent accessing table entries during cleanup */ + rzs->disksize = 0; + ret = -ENOMEM; + goto fail; + } + memset(rzs->table, 0, num_pages * sizeof(*rzs->table)); + + map_backing_swap_extents(rzs); + + page = alloc_page(__GFP_ZERO); + if (!page) { + pr_err("Error allocating swap header page\n"); + ret = -ENOMEM; + goto fail; + } + rzs->table[0].page = page; + rzs_set_flag(rzs, 0, RZS_UNCOMPRESSED); + + swap_header = kmap(page); + ret = setup_swap_header(rzs, swap_header); + kunmap(page); + if (ret) { + pr_err("Error setting swap header\n"); + goto fail; + } + + set_capacity(rzs->disk, rzs->disksize >> SECTOR_SHIFT); + + /* + * We have ident mapping of sectors for ramzswap and + * and the backing swap device. So, this queue flag + * should be according to backing dev. + */ + if (!rzs->backing_swap || + blk_queue_nonrot(rzs->backing_swap->bd_disk->queue)) + queue_flag_set_unlocked(QUEUE_FLAG_NONROT, rzs->disk->queue); + + rzs->mem_pool = xv_create_pool(); + if (!rzs->mem_pool) { + pr_err("Error creating memory pool\n"); + ret = -ENOMEM; + goto fail; + } + + /* + * Pages that compress to size greater than this are forwarded + * to physical swap disk (if backing dev is provided) + * TODO: make this configurable + */ + if (rzs->backing_swap) + max_zpage_size = max_zpage_size_bdev; + else + max_zpage_size = max_zpage_size_nobdev; + pr_debug("Max compressed page size: %u bytes\n", max_zpage_size); + + rzs->init_done = 1; + + pr_debug("Initialization done!\n"); + return 0; + +fail: + reset_device(rzs); + + pr_err("Initialization failed: err=%d\n", ret); + return ret; +} + +static int ramzswap_ioctl_reset_device(struct ramzswap *rzs) +{ + if (rzs->init_done) + reset_device(rzs); + + return 0; +} + +static int ramzswap_ioctl(struct block_device *bdev, fmode_t mode, + unsigned int cmd, unsigned long arg) +{ + int ret = 0; + size_t disksize_kb, memlimit_kb; + + struct ramzswap *rzs = bdev->bd_disk->private_data; + + switch (cmd) { + case RZSIO_SET_DISKSIZE_KB: + if (rzs->init_done) { + ret = -EBUSY; + goto out; + } + if (copy_from_user(&disksize_kb, (void *)arg, + _IOC_SIZE(cmd))) { + ret = -EFAULT; + goto out; + } + rzs->disksize = disksize_kb << 10; + pr_info("Disk size set to %zu kB\n", disksize_kb); + break; + + case RZSIO_SET_MEMLIMIT_KB: + if (rzs->init_done) { + /* TODO: allow changing memlimit */ + ret = -EBUSY; + goto out; + } + if (copy_from_user(&memlimit_kb, (void *)arg, + _IOC_SIZE(cmd))) { + ret = -EFAULT; + goto out; + } + rzs->memlimit = memlimit_kb << 10; + pr_info("Memory limit set to %zu kB\n", memlimit_kb); + break; + + case RZSIO_SET_BACKING_SWAP: + if (rzs->init_done) { + ret = -EBUSY; + goto out; + } + + if (copy_from_user(&rzs->backing_swap_name, (void *)arg, + _IOC_SIZE(cmd))) { + ret = -EFAULT; + goto out; + } + rzs->backing_swap_name[MAX_SWAP_NAME_LEN - 1] = '\0'; + pr_info("Backing swap set to %s\n", rzs->backing_swap_name); + break; + + case RZSIO_GET_STATS: + { + struct ramzswap_ioctl_stats *stats; + if (!rzs->init_done) { + ret = -ENOTTY; + goto out; + } + stats = kzalloc(sizeof(*stats), GFP_KERNEL); + if (!stats) { + ret = -ENOMEM; + goto out; + } + ramzswap_ioctl_get_stats(rzs, stats); + if (copy_to_user((void *)arg, stats, sizeof(*stats))) { + kfree(stats); + ret = -EFAULT; + goto out; + } + kfree(stats); + break; + } + case RZSIO_INIT: + ret = ramzswap_ioctl_init_device(rzs); + break; + + case RZSIO_RESET: + /* Do not reset an active device! */ + if (bdev->bd_holders) { + ret = -EBUSY; + goto out; + } + ret = ramzswap_ioctl_reset_device(rzs); + break; + + default: + pr_info("Invalid ioctl %u\n", cmd); + ret = -ENOTTY; + } + +out: + return ret; +} + +static struct block_device_operations ramzswap_devops = { + .ioctl = ramzswap_ioctl, + .owner = THIS_MODULE, +}; + +static void create_device(struct ramzswap *rzs, int device_id) +{ + mutex_init(&rzs->lock); + INIT_LIST_HEAD(&rzs->backing_swap_extent_list); + + rzs->queue = blk_alloc_queue(GFP_KERNEL); + if (!rzs->queue) { + pr_err("Error allocating disk queue for device %d\n", + device_id); + return; + } + + blk_queue_make_request(rzs->queue, ramzswap_make_request); + rzs->queue->queuedata = rzs; + + /* gendisk structure */ + rzs->disk = alloc_disk(1); + if (!rzs->disk) { + blk_cleanup_queue(rzs->queue); + pr_warning("Error allocating disk structure for device %d\n", + device_id); + return; + } + + rzs->disk->major = ramzswap_major; + rzs->disk->first_minor = device_id; + rzs->disk->fops = &ramzswap_devops; + rzs->disk->queue = rzs->queue; + rzs->disk->private_data = rzs; + snprintf(rzs->disk->disk_name, 16, "ramzswap%d", device_id); + + /* + * Actual capacity set using RZSIO_SET_DISKSIZE_KB ioctl + * or set equal to backing swap device (if provided) + */ + set_capacity(rzs->disk, 0); + add_disk(rzs->disk); + + rzs->init_done = 0; +} + +static void destroy_device(struct ramzswap *rzs) +{ + if (rzs->disk) { + del_gendisk(rzs->disk); + put_disk(rzs->disk); + } + + if (rzs->queue) + blk_cleanup_queue(rzs->queue); +} + +static int __init ramzswap_init(void) +{ + int i, ret; + + if (num_devices > max_num_devices) { + pr_warning("Invalid value for num_devices: %u\n", + num_devices); + return -EINVAL; + } + + ramzswap_major = register_blkdev(0, "ramzswap"); + if (ramzswap_major <= 0) { + pr_warning("Unable to get major number\n"); + return -EBUSY; + } + + if (!num_devices) { + pr_info("num_devices not specified. Using default: 1\n"); + num_devices = 1; + } + + /* Allocate the device array and initialize each one */ + pr_info("Creating %u devices ...\n", num_devices); + devices = kzalloc(num_devices * sizeof(struct ramzswap), GFP_KERNEL); + if (!devices) { + ret = -ENOMEM; + goto out; + } + + for (i = 0; i < num_devices; i++) + create_device(&devices[i], i); + + return 0; +out: + unregister_blkdev(ramzswap_major, "ramzswap"); + return ret; +} + +static void __exit ramzswap_exit(void) +{ + int i; + struct ramzswap *rzs; + + for (i = 0; i < num_devices; i++) { + rzs = &devices[i]; + + destroy_device(rzs); + if (rzs->init_done) + reset_device(rzs); + } + + unregister_blkdev(ramzswap_major, "ramzswap"); + + kfree(devices); + pr_debug("Cleanup done!\n"); +} + +module_param(num_devices, uint, 0); +MODULE_PARM_DESC(num_devices, "Number of ramzswap devices"); + +module_init(ramzswap_init); +module_exit(ramzswap_exit); + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_AUTHOR("Nitin Gupta "); +MODULE_DESCRIPTION("Compressed RAM Based Swap Device"); diff --git a/drivers/staging/ramzswap/ramzswap_drv.h b/drivers/staging/ramzswap/ramzswap_drv.h new file mode 100644 index 000000000000..a6ea240935b6 --- /dev/null +++ b/drivers/staging/ramzswap/ramzswap_drv.h @@ -0,0 +1,171 @@ +/* + * Compressed RAM based swap device + * + * Copyright (C) 2008, 2009 Nitin Gupta + * + * This code is released using a dual license strategy: BSD/GPL + * You can choose the licence that better fits your requirements. + * + * Released under the terms of 3-clause BSD License + * Released under the terms of GNU General Public License Version 2.0 + * + * Project home: http://compcache.googlecode.com + */ + +#ifndef _RAMZSWAP_DRV_H_ +#define _RAMZSWAP_DRV_H_ + +#include "ramzswap_ioctl.h" +#include "xvmalloc.h" + +/* + * Some arbitrary value. This is just to catch + * invalid value for num_devices module parameter. + */ +static const unsigned max_num_devices = 32; + +/* + * Stored at beginning of each compressed object. + * + * It stores back-reference to table entry which points to this + * object. This is required to support memory defragmentation or + * migrating compressed pages to backing swap disk. + */ +struct zobj_header { +#if 0 + u32 table_idx; +#endif +}; + +/*-- Configurable parameters */ + +/* Default ramzswap disk size: 25% of total RAM */ +static const unsigned default_disksize_perc_ram = 25; +static const unsigned default_memlimit_perc_ram = 15; + +/* + * Max compressed page size when backing device is provided. + * Pages that compress to size greater than this are sent to + * physical swap disk. + */ +static const unsigned max_zpage_size_bdev = PAGE_SIZE / 2; + +/* + * Max compressed page size when there is no backing dev. + * Pages that compress to size greater than this are stored + * uncompressed in memory. + */ +static const unsigned max_zpage_size_nobdev = PAGE_SIZE / 4 * 3; + +/* + * NOTE: max_zpage_size_{bdev,nobdev} sizes must be + * less than or equal to: + * XV_MAX_ALLOC_SIZE - sizeof(struct zobj_header) + * since otherwise xv_malloc would always return failure. + */ + +/*-- End of configurable params */ + +#define SECTOR_SHIFT 9 +#define SECTOR_SIZE (1 << SECTOR_SHIFT) +#define SECTORS_PER_PAGE_SHIFT (PAGE_SHIFT - SECTOR_SHIFT) +#define SECTORS_PER_PAGE (1 << SECTORS_PER_PAGE_SHIFT) + +/* Debugging and Stats */ +#if defined(CONFIG_RAMZSWAP_STATS) +#define stat_inc(stat) ((stat)++) +#define stat_dec(stat) ((stat)--) +#else +#define stat_inc(x) +#define stat_dec(x) +#endif + +/* Flags for ramzswap pages (table[page_no].flags) */ +enum rzs_pageflags { + /* Page is stored uncompressed */ + RZS_UNCOMPRESSED, + + /* Page consists entirely of zeros */ + RZS_ZERO, + + __NR_RZS_PAGEFLAGS, +}; + +/*-- Data structures */ + +/* + * Allocated for each swap slot, indexed by page no. + * These table entries must fit exactly in a page. + */ +struct table { + struct page *page; + u16 offset; + u8 count; /* object ref count (not yet used) */ + u8 flags; +} __attribute__((aligned(4)));; + +/* + * Swap extent information in case backing swap is a regular + * file. These extent entries must fit exactly in a page. + */ +struct ramzswap_backing_extent { + pgoff_t phy_pagenum; + pgoff_t num_pages; +} __attribute__((aligned(4))); + +struct ramzswap_stats { + /* basic stats */ + size_t compr_size; /* compressed size of pages stored - + * needed to enforce memlimit */ + /* more stats */ +#if defined(CONFIG_RAMZSWAP_STATS) + u64 num_reads; /* failed + successful */ + u64 num_writes; /* --do-- */ + u64 failed_reads; /* can happen when memory is too low */ + u64 failed_writes; /* should NEVER! happen */ + u64 invalid_io; /* non-swap I/O requests */ + u32 pages_zero; /* no. of zero filled pages */ + u32 pages_stored; /* no. of pages currently stored */ + u32 good_compress; /* % of pages with compression ratio<=50% */ + u32 pages_expand; /* % of incompressible pages */ + u64 bdev_num_reads; /* no. of reads on backing dev */ + u64 bdev_num_writes; /* no. of writes on backing dev */ +#endif +}; + +struct ramzswap { + struct xv_pool *mem_pool; + void *compress_workmem; + void *compress_buffer; + struct table *table; + struct mutex lock; + struct request_queue *queue; + struct gendisk *disk; + int init_done; + /* + * This is limit on compressed data size (stats.compr_size) + * Its applicable only when backing swap device is present. + */ + size_t memlimit; /* bytes */ + /* + * This is limit on amount of *uncompressed* worth of data + * we can hold. When backing swap device is provided, it is + * set equal to device size. + */ + size_t disksize; /* bytes */ + + struct ramzswap_stats stats; + + /* backing swap device info */ + struct ramzswap_backing_extent *curr_extent; + struct list_head backing_swap_extent_list; + unsigned long num_extents; + char backing_swap_name[MAX_SWAP_NAME_LEN]; + struct block_device *backing_swap; + struct file *swap_file; +}; + +/*-- */ + +#endif + diff --git a/drivers/staging/ramzswap/ramzswap_ioctl.h b/drivers/staging/ramzswap/ramzswap_ioctl.h new file mode 100644 index 000000000000..c713a09af580 --- /dev/null +++ b/drivers/staging/ramzswap/ramzswap_ioctl.h @@ -0,0 +1,49 @@ +/* + * Compressed RAM based swap device + * + * Copyright (C) 2008, 2009 Nitin Gupta + * + * This code is released using a dual license strategy: BSD/GPL + * You can choose the licence that better fits your requirements. + * + * Released under the terms of 3-clause BSD License + * Released under the terms of GNU General Public License Version 2.0 + * + * Project home: http://compcache.googlecode.com + */ + +#ifndef _RAMZSWAP_IOCTL_H_ +#define _RAMZSWAP_IOCTL_H_ + +#define MAX_SWAP_NAME_LEN 128 + +struct ramzswap_ioctl_stats { + char backing_swap_name[MAX_SWAP_NAME_LEN]; + u64 memlimit; /* only applicable if backing swap present */ + u64 disksize; /* user specified or equal to backing swap + * size (if present) */ + u64 num_reads; /* failed + successful */ + u64 num_writes; /* --do-- */ + u64 failed_reads; /* can happen when memory is too low */ + u64 failed_writes; /* should NEVER! happen */ + u64 invalid_io; /* non-swap I/O requests */ + u32 pages_zero; /* no. of zero filled pages */ + u32 good_compress_pct; /* no. of pages with compression ratio<=50% */ + u32 pages_expand_pct; /* no. of incompressible pages */ + u32 pages_stored; + u32 pages_used; + u64 orig_data_size; + u64 compr_data_size; + u64 mem_used_total; + u64 bdev_num_reads; /* no. of reads on backing dev */ + u64 bdev_num_writes; /* no. of writes on backing dev */ +} __attribute__ ((packed, aligned(4))); + +#define RZSIO_SET_DISKSIZE_KB _IOW('z', 0, size_t) +#define RZSIO_SET_MEMLIMIT_KB _IOW('z', 1, size_t) +#define RZSIO_SET_BACKING_SWAP _IOW('z', 2, unsigned char[MAX_SWAP_NAME_LEN]) +#define RZSIO_GET_STATS _IOR('z', 3, struct ramzswap_ioctl_stats) +#define RZSIO_INIT _IO('z', 4) +#define RZSIO_RESET _IO('z', 5) + +#endif -- GitLab From 47f9afb38f0de2f153deea34bf1ef5c778815f2e Mon Sep 17 00:00:00 2001 From: Nitin Gupta Date: Tue, 22 Sep 2009 10:26:54 +0530 Subject: [PATCH 082/235] Staging: ramzswap: documentation Short guide on how to setup and use ramzswap. Signed-off-by: Nitin Gupta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ramzswap/ramzswap.txt | 51 +++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 drivers/staging/ramzswap/ramzswap.txt diff --git a/drivers/staging/ramzswap/ramzswap.txt b/drivers/staging/ramzswap/ramzswap.txt new file mode 100644 index 000000000000..e9f1619505a0 --- /dev/null +++ b/drivers/staging/ramzswap/ramzswap.txt @@ -0,0 +1,51 @@ +ramzswap: Compressed RAM based swap device +------------------------------------------- + +Project home: http://compcache.googlecode.com/ + +* Introduction + +It creates RAM based block devices which can be used (only) as swap disks. +Pages swapped to these devices are compressed and stored in memory itself. +See project home for use cases, performance numbers and a lot more. + +Individual ramzswap devices are configured and initialized using rzscontrol +userspace utility as shown in examples below. See rzscontrol man page for more +details. + +* Usage + +Following shows a typical sequence of steps for using ramzswap. + +1) Load Modules: + modprobe ramzswap num_devices=4 + This creates 4 (uninitialized) devices: /dev/ramzswap{0,1,2,3} + (num_devices parameter is optional. Default: 1) + +2) Initialize: + Use rzscontrol utility to configure and initialize individual + ramzswap devices. Example: + rzscontrol /dev/ramzswap2 --init # uses default value of disksize_kb + + *See rzscontrol man page for more details and examples* + +3) Activate: + swapon /dev/ramzswap2 # or any other initialized ramzswap device + +4) Stats: + rzscontrol /dev/ramzswap2 --stats + +5) Deactivate: + swapoff /dev/ramzswap2 + +6) Reset: + rzscontrol /dev/ramzswap2 --reset + (This frees all the memory allocated for this device). + + +Please report any problems at: + - Mailing list: linux-mm-cc at laptop dot org + - Issue tracker: http://code.google.com/p/compcache/issues/list + +Nitin Gupta +ngupta@vflare.org -- GitLab From 224f0ef4e20327ab108e6a11ebc3a92f337c5e85 Mon Sep 17 00:00:00 2001 From: Nitin Gupta Date: Tue, 22 Sep 2009 15:32:33 +0530 Subject: [PATCH 083/235] Staging: ramzswap: add TODO file TODO file for ramzswap. Signed-off-by: Nitin Gupta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ramzswap/TODO | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 drivers/staging/ramzswap/TODO diff --git a/drivers/staging/ramzswap/TODO b/drivers/staging/ramzswap/TODO new file mode 100644 index 000000000000..bac40d6cb9f1 --- /dev/null +++ b/drivers/staging/ramzswap/TODO @@ -0,0 +1,6 @@ +TODO: + - Add support for swap notifiers + - Remove CONFIG_ARM hack + +Please send patches to Greg Kroah-Hartman and +Nitin Gupta -- GitLab From 3c0d44643cbeb125171685a10d9cdeba24336e62 Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Tue, 29 Sep 2009 01:34:14 +0200 Subject: [PATCH 084/235] Staging: et131x: adding __init/__exit macros Trivial patch which adds the __init/__exit macros to the module_init/ module_exit functions of ./staging/et131x/et131x_initpci.c Greg, please have a look at the small patch and either pull it through your staging tree, or please ack' it so Jiri can pull it through the trivial tree. Signed-off-by: Peter Huewe Acked-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et131x_initpci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c index 9db205667262..5ec0d5b59cba 100644 --- a/drivers/staging/et131x/et131x_initpci.c +++ b/drivers/staging/et131x/et131x_initpci.c @@ -989,7 +989,7 @@ static struct pci_driver et131x_driver = { * * Returns 0 on success, errno on failure (as defined in errno.h) */ -static int et131x_init_module(void) +static int __init et131x_init_module(void) { if (et131x_speed_set < PARM_SPEED_DUPLEX_MIN || et131x_speed_set > PARM_SPEED_DUPLEX_MAX) { @@ -1002,7 +1002,7 @@ static int et131x_init_module(void) /** * et131x_cleanup_module - The entry point called on driver cleanup */ -static void et131x_cleanup_module(void) +static void __exit et131x_cleanup_module(void) { pci_unregister_driver(&et131x_driver); } -- GitLab From 64ed20165f3523402465ed465476e0457765a30f Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Tue, 29 Sep 2009 01:40:59 +0200 Subject: [PATCH 085/235] Staging: cx25821: adding __init/__exit macros Trivial patch which adds the __init/__exit macros to the module_init/ module_exit functions of ./staging/cx25821/cx25821-core.c Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman --- drivers/staging/cx25821/cx25821-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/cx25821/cx25821-core.c b/drivers/staging/cx25821/cx25821-core.c index 8aceae5a072e..67f689de4daa 100644 --- a/drivers/staging/cx25821/cx25821-core.c +++ b/drivers/staging/cx25821/cx25821-core.c @@ -1521,7 +1521,7 @@ static struct pci_driver cx25821_pci_driver = { .resume = NULL, }; -static int cx25821_init(void) +static int __init cx25821_init(void) { INIT_LIST_HEAD(&cx25821_devlist); printk(KERN_INFO "cx25821 driver version %d.%d.%d loaded\n", @@ -1530,7 +1530,7 @@ static int cx25821_init(void) return pci_register_driver(&cx25821_pci_driver); } -static void cx25821_fini(void) +static void __exit cx25821_fini(void) { pci_unregister_driver(&cx25821_pci_driver); } -- GitLab From 24e4688632c8ae95760cb917ee5f42348fa22cbf Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Tue, 29 Sep 2009 01:49:00 +0200 Subject: [PATCH 086/235] Staging: p9auth: adding __init/__exit macros Trivial patch which adds the __init/__exit macros to the module_init/ module_exit functions of drivers/staging/p9auth/p9auth.c Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman --- drivers/staging/p9auth/p9auth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/p9auth/p9auth.c b/drivers/staging/p9auth/p9auth.c index 8ccfff723eec..db7962621210 100644 --- a/drivers/staging/p9auth/p9auth.c +++ b/drivers/staging/p9auth/p9auth.c @@ -334,6 +334,7 @@ static const struct file_operations cap_fops = { .release = cap_release, }; +/* no __exit here because it can be called by the init function */ static void cap_cleanup_module(void) { int i; @@ -360,7 +361,7 @@ static void cap_setup_cdev(struct cap_dev *dev, int index) printk(KERN_NOTICE "Error %d adding cap%d", err, index); } -static int cap_init_module(void) +static int __init cap_init_module(void) { int result, i; dev_t dev = 0; -- GitLab From 73d3f6652a153a33648a2213c03e292809cc9ddb Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Tue, 29 Sep 2009 01:53:16 +0200 Subject: [PATCH 087/235] Staging: phison: adding __init/__exit macros Trivial patch which adds the __init/__exit macros to the module_init/ module_exit functions of drivers/staging/phison/phison.c Signed-off-by: Peter Huewe Signed-off-by: Greg Kroah-Hartman --- drivers/staging/phison/phison.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/phison/phison.c b/drivers/staging/phison/phison.c index 270ebcb681a2..3817d7497049 100644 --- a/drivers/staging/phison/phison.c +++ b/drivers/staging/phison/phison.c @@ -87,12 +87,12 @@ static struct pci_driver phison_pci_driver = { #endif }; -static int phison_ide_init(void) +static int __init phison_ide_init(void) { return pci_register_driver(&phison_pci_driver); } -static void phison_ide_exit(void) +static void __exit phison_ide_exit(void) { pci_unregister_driver(&phison_pci_driver); } -- GitLab From 7e0463839cbde150fe7d767e9a91bea0d17bcde5 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Sun, 4 Oct 2009 19:32:27 -0700 Subject: [PATCH 088/235] Staging: iio: kconfig and make edits Fix spelling, typos, indentation in iio Kconfig files. Signed-off-by: Randy Dunlap Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/Kconfig | 10 +++++----- drivers/staging/iio/trigger/Kconfig | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/iio/Kconfig b/drivers/staging/iio/Kconfig index 4586650d65c3..ace99f6d1166 100644 --- a/drivers/staging/iio/Kconfig +++ b/drivers/staging/iio/Kconfig @@ -8,7 +8,7 @@ menuconfig IIO ---help--- The industrial I/O subsystem provides a unified framework for drivers for many different types of embedded sensors using a - number of different physical interfaces (i2c, spi etc). See + number of different physical interfaces (i2c, spi, etc). See Documentation/industrialio for more information. if IIO @@ -23,10 +23,10 @@ if IIO_RING_BUFFER config IIO_SW_RING tristate "Industrial I/O lock free software ring" help - example software ring buffer implementation. The design aim - of this particular realization was to minize write locking - with the intention that some devices would be able to write - in interrupt context. + Example software ring buffer implementation. The design aim + of this particular realization was to minimize write locking + with the intention that some devices would be able to write + in interrupt context. endif # IIO_RINGBUFFER diff --git a/drivers/staging/iio/trigger/Kconfig b/drivers/staging/iio/trigger/Kconfig index fdd9301271a4..d842a584a3af 100644 --- a/drivers/staging/iio/trigger/Kconfig +++ b/drivers/staging/iio/trigger/Kconfig @@ -9,13 +9,13 @@ config IIO_PERIODIC_RTC_TRIGGER tristate "Periodic RTC triggers" depends on RTC_CLASS help - Provides support for using periodic capable real time - clocks as IIO triggers. + Provides support for using periodic capable real time + clocks as IIO triggers. config IIO_GPIO_TRIGGER tristate "GPIO trigger" depends on GENERIC_GPIO help - Provides support for using GPIO pins as IIO triggers. + Provides support for using GPIO pins as IIO triggers. endif # IIO_TRIGGER -- GitLab From 4c572605085d65b7cf4f5b36ccac0f30866d19f9 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Sun, 4 Oct 2009 19:34:02 -0700 Subject: [PATCH 089/235] Staging: iio: lots of doc fixes Fix iio header files kernel-doc notation errors, spelling, typos, indentation, grammar, etc. It would also be good if these function names were spelled correctly, but I didn't change them: iio_push_or_escallate_ring_event() iio_trigger_dettach_poll_func() Signed-off-by: Randy Dunlap Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/chrdev.h | 4 +- drivers/staging/iio/iio.h | 36 ++++---- drivers/staging/iio/ring_generic.h | 73 ++++++++++------ drivers/staging/iio/ring_sw.h | 68 ++++++++++----- drivers/staging/iio/sysfs.h | 114 +++++++++++++++++++------ drivers/staging/iio/trigger.h | 35 +++++--- drivers/staging/iio/trigger_consumer.h | 8 +- 7 files changed, 228 insertions(+), 110 deletions(-) diff --git a/drivers/staging/iio/chrdev.h b/drivers/staging/iio/chrdev.h index 8bc64bf08459..f42bafb3a894 100644 --- a/drivers/staging/iio/chrdev.h +++ b/drivers/staging/iio/chrdev.h @@ -75,10 +75,12 @@ struct iio_shared_ev_pointer { * @current_events: number of events in detected list * @id: indentifier to allow the event interface to know which * physical line it corresponds to + * @attr: this chrdev's minor number sysfs attribute * @owner: ensure the driver module owns the file, not iio * @private: driver specific data * @_name: used internally to store the sysfs name for minor id * attribute + * @_attrname: the event interface's attribute name */ struct iio_event_interface { struct device dev; @@ -105,7 +107,7 @@ struct iio_event_interface { * @handler: event handler function - called on event if this * event_handler is enabled. * - * Each device has one list of these per interrupt line + * Each device has one list of these per interrupt line. **/ struct iio_event_handler_list { struct list_head list; diff --git a/drivers/staging/iio/iio.h b/drivers/staging/iio/iio.h index 25ccb809221e..71dbfe12b579 100644 --- a/drivers/staging/iio/iio.h +++ b/drivers/staging/iio/iio.h @@ -166,7 +166,7 @@ static inline int iio_scan_mask_clear(struct iio_dev *dev_info, int bit) * @bit: which number scan element is this **/ static inline int iio_scan_mask_count_to_right(struct iio_dev *dev_info, -int bit) + int bit) { int count = 0; int mask = (1 << bit); @@ -239,7 +239,7 @@ void iio_unregister_interrupt_line(struct iio_dev *dev_info, * @dev_info: IIO device structure * @ev_line: Which event line (hardware interrupt) * @ev_code: What event - * @timestamp: When the event occured + * @timestamp: When the event occurred **/ int iio_push_event(struct iio_dev *dev_info, int ev_line, @@ -248,11 +248,11 @@ int iio_push_event(struct iio_dev *dev_info, /** * struct iio_work_cont - container for when singleton handler case matters - * @ws: [DEVICE]work_struct when not only possible event - * @ws_nocheck: [DEVICE]work_struct when only possible event - * @address: [DEVICE]associated register address - * @mask: [DEVICE]associated mask for identifying event source - * @st: [DEVICE]device specific state information + * @ws: [DEVICE] work_struct when not only possible event + * @ws_nocheck: [DEVICE] work_struct when only possible event + * @address: [DEVICE] associated register address + * @mask: [DEVICE] associated mask for identifying event source + * @st: [DEVICE] device specific state information **/ struct iio_work_cont { struct work_struct ws; @@ -273,9 +273,9 @@ struct iio_work_cont { * @cont: the work container * @_checkfunc: function called when there are multiple possible int sources * @_nocheckfunc: function for when there is only one int source - * @_add: driver dependant, typically a register address - * @_mask: driver dependant, typically a bit mask for a register - * @_st: driver dependant, typically pointer to a device state structure + * @_add: driver dependent, typically a register address + * @_mask: driver dependent, typically a bit mask for a register + * @_st: driver dependent, typically pointer to a device state structure **/ static inline void iio_init_work_cont(struct iio_work_cont *cont, @@ -290,7 +290,7 @@ iio_init_work_cont(struct iio_work_cont *cont, cont->st = _st; } /** - * __iio_push_event() tries to add an event to the list associated with a chrdev + * __iio_push_event() - tries to add an event to the list associated with a chrdev * @ev_int: the event interface to which we are pushing the event * @ev_code: the outgoing event code * @timestamp: timestamp of the event @@ -302,8 +302,8 @@ int __iio_push_event(struct iio_event_interface *ev_int, struct iio_shared_ev_pointer* shared_pointer_p); /** - * __iio_change_event() change an event code in case of event escallation - * @ev: the evnet to be changed + * __iio_change_event() - change an event code in case of event escalation + * @ev: the event to be changed * @ev_code: new event code * @timestamp: new timestamp **/ @@ -312,7 +312,7 @@ void __iio_change_event(struct iio_detected_event_list *ev, s64 timestamp); /** - * iio_setup_ev_int() Configure an event interface (chrdev) + * iio_setup_ev_int() - configure an event interface (chrdev) * @name: name used for resulting sysfs directory etc. * @ev_int: interface we are configuring * @owner: module that is responsible for registering this ev_int @@ -343,7 +343,7 @@ extern dev_t iio_devt; extern struct class iio_class; /** - * iio_put_device() - reference counted deallocated of struct device + * iio_put_device() - reference counted deallocation of struct device * @dev: the iio_device containing the device **/ static inline void iio_put_device(struct iio_dev *dev) @@ -353,7 +353,7 @@ static inline void iio_put_device(struct iio_dev *dev) }; /** - * to_iio_dev() - get iio_dev for which we have have the struct device + * to_iio_dev() - get iio_dev for which we have the struct device * @d: the struct device **/ static inline struct iio_dev *to_iio_dev(struct device *d) @@ -377,6 +377,7 @@ struct iio_dev *iio_allocate_device(void); /** * iio_free_device() - free an iio_dev from a driver + * @dev: the iio_dev associated with the device **/ void iio_free_device(struct iio_dev *dev); @@ -395,7 +396,8 @@ int iio_device_get_chrdev_minor(void); void iio_device_free_chrdev_minor(int val); /** - * iio_ring_enabled() helper function to test if any form of ring enabled + * iio_ring_enabled() - helper function to test if any form of ring is enabled + * @dev_info: IIO device info structure for device **/ static inline bool iio_ring_enabled(struct iio_dev *dev_info) { diff --git a/drivers/staging/iio/ring_generic.h b/drivers/staging/iio/ring_generic.h index d9261897f332..93b91b28a02f 100644 --- a/drivers/staging/iio/ring_generic.h +++ b/drivers/staging/iio/ring_generic.h @@ -25,9 +25,12 @@ int iio_push_ring_event(struct iio_ring_buffer *ring_buf, int event_code, s64 timestamp); /** - * iio_push_or_escallate_ring_event() - escallate or add as appropriate + * iio_push_or_escallate_ring_event() - escalate or add as appropriate + * @ring_buf: ring buffer that is the event source + * @event_code: event indentification code + * @timestamp: time of event * - * Typical usecase is to escallate a 50% ring full to 75% full if noone has yet + * Typical usecase is to escalate a 50% ring full to 75% full if noone has yet * read the first event. Clearly the 50% full is no longer of interest in * typical use case. **/ @@ -37,10 +40,6 @@ int iio_push_or_escallate_ring_event(struct iio_ring_buffer *ring_buf, /** * struct iio_ring_access_funcs - access functions for ring buffers. - * @create: perform allocation - * @init: get ring buffer ready for use - * @_exit: reverse steps in init - * @_free: deallocate ring buffer * @mark_in_use: reference counting, typically to prevent module removal * @unmark_in_use: reduce reference count when no longer using ring buffer * @store_to: actually store stuff to the ring buffer @@ -60,7 +59,7 @@ int iio_push_or_escallate_ring_event(struct iio_ring_buffer *ring_buf, * * The purpose of this structure is to make the ring buffer element * modular as event for a given driver, different usecases may require - * different ring designs (space efficiency vs speed for example. + * different ring designs (space efficiency vs speed for example). * * It is worth noting that a given ring implementation may only support a small * proportion of these functions. The core code 'should' cope fine with any of @@ -91,23 +90,25 @@ struct iio_ring_access_funcs { /** * struct iio_ring_buffer - general ring buffer structure - * @length: [DEVICE]number of datums in ring - * @bpd: [DEVICE]size of individual datum including timestamp - * @loopcount: [INTERN]number of times the ring has looped - * @access_minor_name: [INTERN]store of name of the access chrdev minor number - * sysfs attribute - * @access_handler: [INTERN]chrdev access handling - * @event_minor_name: [INTERN]store of name of the event chrdev minor number - * sysfs attribute - * @ev_int: [INTERN]chrdev interface for the event chrdev - * @shared_ev_pointer: [INTERN]the shared event pointer to allow escalation of + * @dev: ring buffer device struct + * @access_dev: system device struct for the chrdev + * @indio_dev: industrial I/O device structure + * @owner: module that owns the ring buffer (for ref counting) + * @id: unique id number + * @access_id: device id number + * @length: [DEVICE] number of datums in ring + * @bpd: [DEVICE] size of individual datum including timestamp + * @loopcount: [INTERN] number of times the ring has looped + * @access_handler: [INTERN] chrdev access handling + * @ev_int: [INTERN] chrdev interface for the event chrdev + * @shared_ev_pointer: [INTERN] the shared event pointer to allow escalation of * events - * @ring_access: [DRIVER]ring access functions associated with the + * @access: [DRIVER] ring access functions associated with the * implementation. - * @ring_prenable: [DRIVER] function to run prior to marking ring enabled - * @ring_postenable: [DRIVER] function to run after marking ring enabled - * @ring_predisable: [DRIVER] function to run prior to marking ring disabled - * @ring_postdisable: [DRIVER] function to run after marking ring disabled + * @preenable: [DRIVER] function to run prior to marking ring enabled + * @postenable: [DRIVER] function to run after marking ring enabled + * @predisable: [DRIVER] function to run prior to marking ring disabled + * @postdisable: [DRIVER] function to run after marking ring disabled **/ struct iio_ring_buffer { struct device dev; @@ -133,7 +134,10 @@ void iio_ring_buffer_init(struct iio_ring_buffer *ring, struct iio_dev *dev_info); /** - * __iio_init_ring_buffer() - initialize common elements of ring buffers. + * __iio_init_ring_buffer() - initialize common elements of ring buffers + * @ring: ring buffer that is the event source + * @bytes_per_datum: size of individual datum including timestamp + * @length: number of datums in ring **/ static inline void __iio_init_ring_buffer(struct iio_ring_buffer *ring, int bytes_per_datum, int length) @@ -171,7 +175,11 @@ struct iio_scan_el { container_of(_dev_attr, struct iio_scan_el, dev_attr); /** - * iio_scan_el_store() - sysfs scan element selection interface. + * iio_scan_el_store() - sysfs scan element selection interface + * @dev: the target device + * @attr: the device attribute that is being processed + * @buf: input from userspace + * @len: length of input * * A generic function used to enable various scan elements. In some * devices explicit read commands for each channel mean this is merely @@ -184,12 +192,15 @@ ssize_t iio_scan_el_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len); /** * iio_scal_el_show() - sysfs interface to query whether a scan element is - * is enabled or not. + * is enabled or not + * @dev: the target device + * @attr: the device attribute that is being processed + * @buf: output buffer **/ ssize_t iio_scan_el_show(struct device *dev, struct device_attribute *attr, char *buf); /** - * IIO_SCAN_EL: - declare and initialize a scan element without control func + * IIO_SCAN_EL - declare and initialize a scan element without control func * @_name: identifying name. Resulting struct is iio_scan_el_##_name, * sysfs element, scan_en_##_name. * @_number: unique id number for the scan element. @@ -214,8 +225,14 @@ ssize_t iio_scan_el_ts_store(struct device *dev, struct device_attribute *attr, ssize_t iio_scan_el_ts_show(struct device *dev, struct device_attribute *attr, char *buf); /** - * IIO_SCAN_EL_C: - declare and initialize a scan element with a control func + * IIO_SCAN_EL_C - declare and initialize a scan element with a control func * + * @_name: identifying name. Resulting struct is iio_scan_el_##_name, + * sysfs element, scan_en_##_name. + * @_number: unique id number for the scan element. + * @_bits: number of bits in the scan element result (used in mixed bit + * length devices). + * @_label: indentification variable used by drivers. Often a reg address. * @_controlfunc: function used to notify hardware of whether state changes **/ #define IIO_SCAN_EL_C(_name, _number, _bits, _label, _controlfunc) \ @@ -230,7 +247,7 @@ ssize_t iio_scan_el_ts_show(struct device *dev, struct device_attribute *attr, .set_state = _controlfunc, \ } /** - * IIO_SCAN_EL_TIMESTAMP: - declare a special scan element for timestamps + * IIO_SCAN_EL_TIMESTAMP - declare a special scan element for timestamps * * Odd one out. Handled slightly differently from other scan elements. **/ diff --git a/drivers/staging/iio/ring_sw.h b/drivers/staging/iio/ring_sw.h index ae70ee0538fb..f0b86f02cd80 100644 --- a/drivers/staging/iio/ring_sw.h +++ b/drivers/staging/iio/ring_sw.h @@ -36,52 +36,65 @@ #if defined CONFIG_IIO_SW_RING || defined CONFIG_IIO_SW_RING_MODULE /** - * iio_create_sw_rb() software ring buffer allocation + * iio_create_sw_rb() - software ring buffer allocation * @r: pointer to ring buffer pointer **/ int iio_create_sw_rb(struct iio_ring_buffer **r); /** - * iio_init_sw_rb() initialize the software ring buffer + * iio_init_sw_rb() - initialize the software ring buffer * @r: pointer to a software ring buffer created by an - * iio_create_sw_rb call. + * iio_create_sw_rb call + * @indio_dev: industrial I/O device structure **/ int iio_init_sw_rb(struct iio_ring_buffer *r, struct iio_dev *indio_dev); + /** - * iio_exit_sw_rb() reverse what was done in iio_init_sw_rb + * iio_exit_sw_rb() - reverse what was done in iio_init_sw_rb + * @r: pointer to a software ring buffer created by an + * iio_create_sw_rb call **/ void iio_exit_sw_rb(struct iio_ring_buffer *r); /** - * iio_free_sw_rb() free memory occupied by the core ring buffer struct + * iio_free_sw_rb() - free memory occupied by the core ring buffer struct + * @r: pointer to a software ring buffer created by an + * iio_create_sw_rb call **/ void iio_free_sw_rb(struct iio_ring_buffer *r); /** - * iio_mark_sw_rb_in_use() reference counting to prevent incorrect chances + * iio_mark_sw_rb_in_use() - reference counting to prevent incorrect chances + * @r: pointer to a software ring buffer created by an + * iio_create_sw_rb call **/ void iio_mark_sw_rb_in_use(struct iio_ring_buffer *r); /** - * iio_unmark_sw_rb_in_use() notify the ring buffer that we don't care anymore + * iio_unmark_sw_rb_in_use() - notify the ring buffer that we don't care anymore + * @r: pointer to a software ring buffer created by an + * iio_create_sw_rb call **/ void iio_unmark_sw_rb_in_use(struct iio_ring_buffer *r); /** - * iio_read_last_from_sw_rb() attempt to read the last stored datum from the rb + * iio_read_last_from_sw_rb() - attempt to read the last stored datum from the rb + * @r: pointer to a software ring buffer created by an + * iio_create_sw_rb call + * @data: where to store the last datum **/ int iio_read_last_from_sw_rb(struct iio_ring_buffer *r, u8 *data); /** - * iio_store_to_sw_rb() store a new datum to the ring buffer - * @rb: pointer to ring buffer instance - * @data: the datum to be stored including timestamp if relevant. - * @timestamp: timestamp which will be attached to buffer events if relevant. + * iio_store_to_sw_rb() - store a new datum to the ring buffer + * @r: pointer to ring buffer instance + * @data: the datum to be stored including timestamp if relevant + * @timestamp: timestamp which will be attached to buffer events if relevant **/ int iio_store_to_sw_rb(struct iio_ring_buffer *r, u8 *data, s64 timestamp); /** - * iio_rip_sw_rb() attempt to read data from the ring buffer + * iio_rip_sw_rb() - attempt to read data from the ring buffer * @r: ring buffer instance * @count: number of datum's to try and read * @data: where the data will be stored. @@ -94,38 +107,53 @@ int iio_rip_sw_rb(struct iio_ring_buffer *r, int *dead_offset); /** - * iio_request_update_sw_rb() update params if update needed + * iio_request_update_sw_rb() - update params if update needed + * @r: pointer to a software ring buffer created by an + * iio_create_sw_rb call **/ int iio_request_update_sw_rb(struct iio_ring_buffer *r); /** - * iio_mark_update_needed_sw_rb() tell the ring buffer it needs a param update + * iio_mark_update_needed_sw_rb() - tell the ring buffer it needs a param update + * @r: pointer to a software ring buffer created by an + * iio_create_sw_rb call **/ int iio_mark_update_needed_sw_rb(struct iio_ring_buffer *r); /** - * iio_get_bpd_sw_rb() get the datum size in bytes + * iio_get_bpd_sw_rb() - get the datum size in bytes + * @r: pointer to a software ring buffer created by an + * iio_create_sw_rb call **/ int iio_get_bpd_sw_rb(struct iio_ring_buffer *r); /** - * iio_set_bpd_sw_rb() set the datum size in bytes + * iio_set_bpd_sw_rb() - set the datum size in bytes + * @r: pointer to a software ring buffer created by an + * iio_create_sw_rb call + * @bpd: bytes per datum value **/ int iio_set_bpd_sw_rb(struct iio_ring_buffer *r, size_t bpd); /** - * iio_get_length_sw_rb() get how many datums the rb may contain + * iio_get_length_sw_rb() - get how many datums the rb may contain + * @r: pointer to a software ring buffer created by an + * iio_create_sw_rb call **/ int iio_get_length_sw_rb(struct iio_ring_buffer *r); /** - * iio_set_length_sw_rb() set how many datums the rb may contain + * iio_set_length_sw_rb() - set how many datums the rb may contain + * @r: pointer to a software ring buffer created by an + * iio_create_sw_rb call + * @length: max number of data items for the ring buffer **/ int iio_set_length_sw_rb(struct iio_ring_buffer *r, int length); /** - * iio_ring_sw_register_funcs() helper function to set up rb access + * iio_ring_sw_register_funcs() - helper function to set up rb access + * @ra: pointer to @iio_ring_access_funcs **/ static inline void iio_ring_sw_register_funcs(struct iio_ring_access_funcs *ra) { diff --git a/drivers/staging/iio/sysfs.h b/drivers/staging/iio/sysfs.h index bfe4055c0ed2..e501e1338e11 100644 --- a/drivers/staging/iio/sysfs.h +++ b/drivers/staging/iio/sysfs.h @@ -15,7 +15,7 @@ #include "iio.h" /** - * struct iio_event_attribute - event control attribute + * struct iio_event_attr - event control attribute * @dev_attr: underlying device attribute * @mask: mask for the event when detecting * @listel: list header to allow addition to list of event handlers @@ -54,6 +54,7 @@ __init_iio_chrdev_minor_attr(struct iio_chrdev_minor_attr *minor_attr, * struct iio_dev_attr - iio specific device attribute * @dev_attr: underlying device attribute * @address: associated register address + * @val2: secondary attribute value */ struct iio_dev_attr { struct device_attribute dev_attr; @@ -71,6 +72,8 @@ ssize_t iio_read_const_attr(struct device *dev, /** * struct iio_const_attr - constant device specific attribute * often used for things like available modes + * @string: attribute string + * @dev_attr: underlying device attribute */ struct iio_const_attr { const char *string; @@ -80,7 +83,7 @@ struct iio_const_attr { #define to_iio_const_attr(_dev_attr) \ container_of(_dev_attr, struct iio_const_attr, dev_attr) -/* Some attributes will be hard coded (device dependant) and not require an +/* Some attributes will be hard coded (device dependent) and not require an address, in these cases pass a negative */ #define IIO_ATTR(_name, _mode, _show, _store, _addr) \ { .dev_attr = __ATTR(_name, _mode, _show, _store), \ @@ -108,102 +111,130 @@ struct iio_const_attr { /* Generic attributes of onetype or another */ /** - * IIO_DEV_ATTR_REG: revision number for the device + * IIO_DEV_ATTR_REV - revision number for the device + * @_show: output method for the attribute * * Very much device dependent. **/ #define IIO_DEV_ATTR_REV(_show) \ IIO_DEVICE_ATTR(revision, S_IRUGO, _show, NULL, 0) + /** - * IIO_DEV_ATTR_NAME: chip type dependant identifier + * IIO_DEV_ATTR_NAME - chip type dependent identifier + * @_show: output method for the attribute **/ #define IIO_DEV_ATTR_NAME(_show) \ IIO_DEVICE_ATTR(name, S_IRUGO, _show, NULL, 0) /** - * IIO_DEV_ATTR_SAMP_FREQ: sets any internal clock frequency + * IIO_DEV_ATTR_SAMP_FREQ - sets any internal clock frequency + * @_mode: sysfs file mode/permissions + * @_show: output method for the attribute + * @_store: input method for the attribute **/ #define IIO_DEV_ATTR_SAMP_FREQ(_mode, _show, _store) \ IIO_DEVICE_ATTR(sampling_frequency, _mode, _show, _store, 0) /** - * IIO_DEV_ATTR_AVAIL_SAMP_FREQ: list available sampling frequencies. + * IIO_DEV_ATTR_AVAIL_SAMP_FREQ - list available sampling frequencies + * @_show: output method for the attribute * - * May be mode dependant on some devices + * May be mode dependent on some devices **/ #define IIO_DEV_ATTR_AVAIL_SAMP_FREQ(_show) \ IIO_DEVICE_ATTR(available_sampling_frequency, S_IRUGO, _show, NULL, 0) /** - * IIO_DEV_ATTR_CONST_AVAIL_SAMP_FREQ: list available sampling frequencies. + * IIO_CONST_ATTR_AVAIL_SAMP_FREQ - list available sampling frequencies + * @_string: frequency string for the attribute * * Constant version **/ #define IIO_CONST_ATTR_AVAIL_SAMP_FREQ(_string) \ IIO_CONST_ATTR(available_sampling_frequency, _string) + /** - * IIO_DEV_ATTR_SCAN_MODE: select a scan mode + * IIO_DEV_ATTR_SCAN_MODE - select a scan mode + * @_mode: sysfs file mode/permissions + * @_show: output method for the attribute + * @_store: input method for the attribute * * This is used when only certain combinations of inputs may be read in one * scan. **/ #define IIO_DEV_ATTR_SCAN_MODE(_mode, _show, _store) \ IIO_DEVICE_ATTR(scan_mode, _mode, _show, _store, 0) + /** - * IIO_DEV_ATTR_AVAIL_SCAN_MODES: list available scan modes + * IIO_DEV_ATTR_AVAIL_SCAN_MODES - list available scan modes + * @_show: output method for the attribute **/ #define IIO_DEV_ATTR_AVAIL_SCAN_MODES(_show) \ IIO_DEVICE_ATTR(available_scan_modes, S_IRUGO, _show, NULL, 0) /** - * IIO_DEV_ATTR_SCAN: result of scan of multiple channels + * IIO_DEV_ATTR_SCAN - result of scan of multiple channels + * @_show: output method for the attribute **/ #define IIO_DEV_ATTR_SCAN(_show) \ IIO_DEVICE_ATTR(scan, S_IRUGO, _show, NULL, 0); /** - * IIO_DEV_ATTR_INPUT: direct read of a single input channel + * IIO_DEV_ATTR_INPUT - direct read of a single input channel + * @_number: input channel number + * @_show: output method for the attribute **/ #define IIO_DEV_ATTR_INPUT(_number, _show) \ IIO_DEVICE_ATTR(in##_number, S_IRUGO, _show, NULL, _number) - /** - * IIO_DEV_ATTR_SW_RING_ENABLE: enable software ring buffer + * IIO_DEV_ATTR_SW_RING_ENABLE - enable software ring buffer + * @_show: output method for the attribute + * @_store: input method for the attribute * - * Success may be dependant on attachment of trigger previously + * Success may be dependent on attachment of trigger previously. **/ #define IIO_DEV_ATTR_SW_RING_ENABLE(_show, _store) \ IIO_DEVICE_ATTR(sw_ring_enable, S_IRUGO | S_IWUSR, _show, _store, 0) /** - * IIO_DEV_ATTR_HW_RING_ENABLE: enable hardware ring buffer + * IIO_DEV_ATTR_HW_RING_ENABLE - enable hardware ring buffer + * @_show: output method for the attribute + * @_store: input method for the attribute * - * This is a different attribute from the software one as one can invision + * This is a different attribute from the software one as one can envision * schemes where a combination of the two may be used. **/ #define IIO_DEV_ATTR_HW_RING_ENABLE(_show, _store) \ IIO_DEVICE_ATTR(hw_ring_enable, S_IRUGO | S_IWUSR, _show, _store, 0) /** - * IIO_DEV_ATTR_BPSE: set number of bits per scan element + * IIO_DEV_ATTR_BPSE - set number of bits per scan element + * @_mode: sysfs file mode/permissions + * @_show: output method for the attribute + * @_store: input method for the attribute **/ #define IIO_DEV_ATTR_BPSE(_mode, _show, _store) \ IIO_DEVICE_ATTR(bpse, _mode, _show, _store, 0) /** - * IIO_DEV_ATTR_BPSE_AVAILABLE: no of bits per scan element supported + * IIO_DEV_ATTR_BPSE_AVAILABLE - number of bits per scan element supported + * @_show: output method for the attribute **/ #define IIO_DEV_ATTR_BPSE_AVAILABLE(_show) \ IIO_DEVICE_ATTR(bpse_available, S_IRUGO, _show, NULL, 0) /** - * IIO_DEV_ATTR_TEMP: many sensors have auxiliary temperature sensors + * IIO_DEV_ATTR_TEMP - many sensors have auxiliary temperature sensors + * @_show: output method for the attribute **/ #define IIO_DEV_ATTR_TEMP(_show) \ IIO_DEVICE_ATTR(temp, S_IRUGO, _show, NULL, 0) + /** - * IIO_EVENT_SH: generic shared event handler + * IIO_EVENT_SH - generic shared event handler + * @_name: event name + * @_handler: handler function to be called * * This is used in cases where more than one event may result from a single * handler. Often the case that some alarm register must be read and multiple @@ -221,8 +252,14 @@ struct iio_const_attr { .prev = &iio_event_##_name.list, \ }, \ }; + /** - * IIO_EVENT_ATTR_SH: generic shared event attribute + * IIO_EVENT_ATTR_SH - generic shared event attribute + * @_name: event name + * @_ev_list: event handler list + * @_show: output method for the attribute + * @_store: input method for the attribute + * @_mask: mask used when detecting the event * * An attribute with an associated IIO_EVENT_SH **/ @@ -235,7 +272,12 @@ struct iio_const_attr { .listel = &_ev_list }; /** - * IIO_EVENT_ATTR: non shared event attribute + * IIO_EVENT_ATTR - non-shared event attribute + * @_name: event name + * @_show: output method for the attribute + * @_store: input method for the attribute + * @_mask: mask used when detecting the event + * @_handler: handler function to be called **/ #define IIO_EVENT_ATTR(_name, _show, _store, _mask, _handler) \ static struct iio_event_handler_list \ @@ -251,10 +293,14 @@ struct iio_const_attr { .listel = &iio_event_##_name }; \ /** - * IIO_EVENT_ATTR_DATA_RDY: event driven by data ready signal + * IIO_EVENT_ATTR_DATA_RDY - event driven by data ready signal + * @_show: output method for the attribute + * @_store: input method for the attribute + * @_mask: mask used when detecting the event + * @_handler: handler function to be called * * Not typically implemented in devices where full triggering support - * has been implemented + * has been implemented. **/ #define IIO_EVENT_ATTR_DATA_RDY(_show, _store, _mask, _handler) \ IIO_EVENT_ATTR(data_rdy, _show, _store, _mask, _handler) @@ -269,19 +315,31 @@ struct iio_const_attr { #define IIO_EVENT_CODE_DEVICE_SPECIFIC 1000 /** - * IIO_EVENT_ATTR_RING_50_FULL: ring buffer event to indicate 50% full + * IIO_EVENT_ATTR_RING_50_FULL - ring buffer event to indicate 50% full + * @_show: output method for the attribute + * @_store: input method for the attribute + * @_mask: mask used when detecting the event + * @_handler: handler function to be called **/ #define IIO_EVENT_ATTR_RING_50_FULL(_show, _store, _mask, _handler) \ IIO_EVENT_ATTR(ring_50_full, _show, _store, _mask, _handler) /** - * IIO_EVENT_ATTR_RING_50_FULL_SH: shared ring event to indicate 50% full + * IIO_EVENT_ATTR_RING_50_FULL_SH - shared ring event to indicate 50% full + * @_evlist: event handler list + * @_show: output method for the attribute + * @_store: input method for the attribute + * @_mask: mask used when detecting the event **/ #define IIO_EVENT_ATTR_RING_50_FULL_SH(_evlist, _show, _store, _mask) \ IIO_EVENT_ATTR_SH(ring_50_full, _evlist, _show, _store, _mask) /** - * IIO_EVENT_ATTR_RING_75_FULL_SH: shared ring event to indicate 75% full + * IIO_EVENT_ATTR_RING_75_FULL_SH - shared ring event to indicate 75% full + * @_evlist: event handler list + * @_show: output method for the attribute + * @_store: input method for the attribute + * @_mask: mask used when detecting the event **/ #define IIO_EVENT_ATTR_RING_75_FULL_SH(_evlist, _show, _store, _mask) \ IIO_EVENT_ATTR_SH(ring_75_full, _evlist, _show, _store, _mask) diff --git a/drivers/staging/iio/trigger.h b/drivers/staging/iio/trigger.h index 8284098c9589..784e7b6fac1c 100644 --- a/drivers/staging/iio/trigger.h +++ b/drivers/staging/iio/trigger.h @@ -19,16 +19,18 @@ * @id: [INTERN] unique id number * @name: [DRIVER] unique name * @dev: [DRIVER] associated device (if relevant) - * @sysfs_dev: [INTERN] sysfs relevant device * @private_data: [DRIVER] device specific data * @list: [INTERN] used in maintenance of global trigger list * @alloc_list: [DRIVER] used for driver specific trigger list - * @poll_func_list_lock:[INTERN] protection of the polling function list + * @pollfunc_list_lock: [INTERN] protection of the polling function list * @pollfunc_list: [INTERN] list of functions to run on trigger. * @control_attrs: [DRIVER] sysfs attributes relevant to trigger type - * @set_trigger_state: [DRIVER] switch on/off the trigger on demand * @timestamp: [INTERN] timestamp usesd by some trigs (e.g. datardy) * @owner: [DRIVER] used to monitor usage count of the trigger. + * @use_count: use count for the trigger + * @set_trigger_state: [DRIVER] switch on/off the trigger on demand + * @try_reenable: function to reenable the trigger when the + * use count is zero (may be NULL) **/ struct iio_trigger { int id; @@ -68,6 +70,9 @@ static inline void iio_get_trigger(struct iio_trigger *trig) /** * iio_trigger_read_name() - sysfs access function to get the trigger name + * @dev: the system device + * @attr: device attributes for the device + * @buf: output buffer to store the trigger name **/ ssize_t iio_trigger_read_name(struct device *dev, struct device_attribute *attr, @@ -79,6 +84,8 @@ ssize_t iio_trigger_read_name(struct device *dev, /** * iio_trigger_find_by_name() - search global trigger list + * @name: trigger name to search for + * @len: trigger name string length to compare **/ struct iio_trigger *iio_trigger_find_by_name(const char *name, size_t len); @@ -90,32 +97,35 @@ int iio_trigger_register(struct iio_trigger *trig_info); /** * iio_trigger_unregister() - unregister a trigger from the core + * @trig_info: trigger to be unregistered **/ void iio_trigger_unregister(struct iio_trigger *trig_info); /** * iio_trigger_attach_poll_func() - add a function pair to be run on trigger * @trig: trigger to which the function pair are being added - * @pf: poll function pair + * @pf: poll function pair **/ int iio_trigger_attach_poll_func(struct iio_trigger *trig, struct iio_poll_func *pf); /** * iio_trigger_dettach_poll_func() - remove function pair from those to be - * run on trigger. - * @trig: trigger from which the function is being removed. + * run on trigger + * @trig: trigger from which the function is being removed * @pf: poll function pair **/ int iio_trigger_dettach_poll_func(struct iio_trigger *trig, struct iio_poll_func *pf); /** - * iio_trigger_poll() - called on a trigger occuring + * iio_trigger_poll() - called on a trigger occurring + * @trig: trigger which occurred + * * Typically called in relevant hardware interrupt handler. **/ -void iio_trigger_poll(struct iio_trigger *); -void iio_trigger_notify_done(struct iio_trigger *); +void iio_trigger_poll(struct iio_trigger *trig); +void iio_trigger_notify_done(struct iio_trigger *trig); /** * struct iio_poll_func - poll function pair @@ -127,11 +137,10 @@ void iio_trigger_notify_done(struct iio_trigger *); * control on sensor supporting it. * @poll_func_main: function in here is run after all immediates. * Reading from sensor etc typically involves - * scheduling - * from here. + * scheduling from here. * - * The two stage approach used here only important when multiple sensors are - * being triggered by a single trigger. This really comes into it's own with + * The two stage approach used here is only important when multiple sensors are + * being triggered by a single trigger. This really comes into its own with * simultaneous sampling devices where a simple latch command can be used to * make the device store the values on all inputs. **/ diff --git a/drivers/staging/iio/trigger_consumer.h b/drivers/staging/iio/trigger_consumer.h index 4c7f527dc79f..a02d70b0d24a 100644 --- a/drivers/staging/iio/trigger_consumer.h +++ b/drivers/staging/iio/trigger_consumer.h @@ -10,12 +10,13 @@ #ifdef CONFIG_IIO_TRIGGER /** - * iio_device_register_trigger_consumer() - set up an iio_dev to use triggers. + * iio_device_register_trigger_consumer() - set up an iio_dev to use triggers * @dev_info: iio_dev associated with the device that will consume the trigger **/ int iio_device_register_trigger_consumer(struct iio_dev *dev_info); + /** - * iio_device_unregister_trigger_consumer() - reverse the registration process. + * iio_device_unregister_trigger_consumer() - reverse the registration process * @dev_info: iio_dev associated with the device that consumed the trigger **/ int iio_device_unregister_trigger_consumer(struct iio_dev *dev_info); @@ -23,13 +24,14 @@ int iio_device_unregister_trigger_consumer(struct iio_dev *dev_info); #else /** - * iio_device_register_trigger_consumer() - set up an iio_dev to use triggers. + * iio_device_register_trigger_consumer() - set up an iio_dev to use triggers * @dev_info: iio_dev associated with the device that will consume the trigger **/ int iio_device_register_trigger_consumer(struct iio_dev *dev_info) { return 0; }; + /** * iio_device_unregister_trigger_consumer() - reverse the registration process * @dev_info: iio_dev associated with the device that consumed the trigger -- GitLab From e12274ba0ca0d9c7e175c419964dbdbe2fd671f8 Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Thu, 5 Nov 2009 15:09:00 +0900 Subject: [PATCH 090/235] Staging: iio: Fix up the module build. Both the max1363 and lis3l02dq modules rely on IIO trigger support in their ring buffer implementations, which is presently a separate config option. In the case of IIO_RING_BUFFER=y and IIO_TRIGGER=n, we end up with the following: ERROR: "iio_trigger_attach_poll_func" [drivers/staging/iio/adc/max1363.ko] undefined! ERROR: "iio_trigger_dettach_poll_func" [drivers/staging/iio/adc/max1363.ko] undefined! ERROR: "iio_trigger_unregister" [drivers/staging/iio/accel/lis3l02dq.ko] undefined! ERROR: "iio_trigger_notify_done" [drivers/staging/iio/accel/lis3l02dq.ko] undefined! ERROR: "iio_trigger_read_name" [drivers/staging/iio/accel/lis3l02dq.ko] undefined! ERROR: "iio_trigger_poll" [drivers/staging/iio/accel/lis3l02dq.ko] undefined! ERROR: "iio_trigger_attach_poll_func" [drivers/staging/iio/accel/lis3l02dq.ko] undefined! ERROR: "iio_trigger_register" [drivers/staging/iio/accel/lis3l02dq.ko] undefined! ERROR: "iio_free_trigger" [drivers/staging/iio/accel/lis3l02dq.ko] undefined! ERROR: "iio_trigger_dettach_poll_func" [drivers/staging/iio/accel/lis3l02dq.ko] undefined! ERROR: "iio_allocate_trigger" [drivers/staging/iio/accel/lis3l02dq.ko] undefined! make[1]: *** [__modpost] Error 1 make: *** [modules] Error 2 This adds an IIO_TRIGGER select for these two drivers conditional on IIO ring buffer support. Caught with an SH randconfig in -next. Signed-off-by: Paul Mundt Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/accel/Kconfig | 1 + drivers/staging/iio/adc/Kconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/staging/iio/accel/Kconfig b/drivers/staging/iio/accel/Kconfig index fef3da48276c..40446636d79b 100644 --- a/drivers/staging/iio/accel/Kconfig +++ b/drivers/staging/iio/accel/Kconfig @@ -13,6 +13,7 @@ config KXSD9 config LIS3L02DQ tristate "ST Microelectronics LIS3L02DQ Accelerometer Driver" depends on SPI + select IIO_TRIGGER if IIO_RING_BUFFER help Say yes here to build SPI support for the ST microelectronics accelerometer. The driver supplies direct access via sysfs files diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig index b8c2858585f9..a2f1626eab41 100644 --- a/drivers/staging/iio/adc/Kconfig +++ b/drivers/staging/iio/adc/Kconfig @@ -6,6 +6,7 @@ comment "Analog to digital convertors" config MAX1363 tristate "MAXIM max1363 ADC driver" depends on I2C + select IIO_TRIGGER if IIO_RING_BUFFER help Say yes here to build support for many MAXIM i2c analog to digital convertors (ADC). (max1361, max1362, max1363, max1364, max1136, -- GitLab From 72c71f4827d1f724e8d44677367ed8e924e69de9 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 19 Sep 2009 21:49:03 +0200 Subject: [PATCH 091/235] Staging: slicoss: remove duplicate structure field initialization The definition of slic_netdev_ops has initializations of a local function and eth_mac_addr for its ndo_set_mac_address field. This change uses only the local function. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ identifier I, s, fld; position p0,p; expression E; @@ struct I s =@p0 { ... .fld@p = E, ...}; @s@ identifier I, s, r.fld; position r.p0,p; expression E; @@ struct I s =@p0 { ... .fld@p = E, ...}; @script:python@ p0 << r.p0; fld << r.fld; ps << s.p; pr << r.p; @@ if int(ps[0].line)!=int(pr[0].line) or int(ps[0].column)!=int(pr[0].column): cocci.print_main(fld,p0) // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/slicoss/slicoss.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index e67a130f9e46..5b191afc1442 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -354,7 +354,6 @@ static const struct net_device_ops slic_netdev_ops = { .ndo_get_stats = slic_get_stats, .ndo_set_multicast_list = slic_mcast_set_list, .ndo_validate_addr = eth_validate_addr, - .ndo_set_mac_address = eth_mac_addr, .ndo_change_mtu = eth_change_mtu, }; -- GitLab From 53f8aeef7d85046b826fb02e45a97bd6d74e6910 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:46:24 +0100 Subject: [PATCH 092/235] Staging: et131x: kill SUCCESS and FAILURE defines Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_eeprom.c | 20 ++++++++++---------- drivers/staging/et131x/et1310_eeprom.h | 9 ++------- drivers/staging/et131x/et1310_phy.h | 3 --- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/staging/et131x/et1310_eeprom.c b/drivers/staging/et131x/et1310_eeprom.c index c853a2c243a8..520a7c938c39 100644 --- a/drivers/staging/et131x/et1310_eeprom.c +++ b/drivers/staging/et131x/et1310_eeprom.c @@ -146,7 +146,7 @@ * @addr: the address to write * @data: the value to write * - * Returns SUCCESS or FAILURE + * Returns 1 for a successful write. */ int EepromWriteByte(struct et131x_adapter *etdev, u32 addr, u8 data) { @@ -227,7 +227,7 @@ int EepromWriteByte(struct et131x_adapter *etdev, u32 addr, u8 data) } if (err || (index >= MAX_NUM_REGISTER_POLLS)) - return FAILURE; + return 0; /* Step 2: */ control = 0; @@ -235,7 +235,7 @@ int EepromWriteByte(struct et131x_adapter *etdev, u32 addr, u8 data) if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET, control)) { - return FAILURE; + return 0; } i2c_wack = 1; @@ -334,7 +334,7 @@ int EepromWriteByte(struct et131x_adapter *etdev, u32 addr, u8 data) index++; } - return writeok ? SUCCESS : FAILURE; + return writeok; } /** @@ -345,7 +345,7 @@ int EepromWriteByte(struct et131x_adapter *etdev, u32 addr, u8 data) * @eeprom_id: the ID of the EEPROM * @addrmode: how the EEPROM is to be accessed * - * Returns SUCCESS or FAILURE + * Returns 1 for a successful read */ int EepromReadByte(struct et131x_adapter *etdev, u32 addr, u8 *pdata) { @@ -409,7 +409,7 @@ int EepromReadByte(struct et131x_adapter *etdev, u32 addr, u8 *pdata) } if (err || (index >= MAX_NUM_REGISTER_POLLS)) - return FAILURE; + return 0; /* Step 2: */ control = 0; @@ -417,14 +417,14 @@ int EepromReadByte(struct et131x_adapter *etdev, u32 addr, u8 *pdata) if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET, control)) { - return FAILURE; + return 0; } /* Step 3: */ if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER_OFFSET, addr)) { - return FAILURE; + return 0; } /* Step 4: */ @@ -446,10 +446,10 @@ int EepromReadByte(struct et131x_adapter *etdev, u32 addr, u8 *pdata) } if (err || (index >= MAX_NUM_REGISTER_POLLS)) - return FAILURE; + return 0; /* Step 6: */ *pdata = EXTRACT_DATA_REGISTER(dword1); - return (status & LBCIF_STATUS_ACK_ERROR) ? FAILURE : SUCCESS; + return (status & LBCIF_STATUS_ACK_ERROR) ? 0 : 1; } diff --git a/drivers/staging/et131x/et1310_eeprom.h b/drivers/staging/et131x/et1310_eeprom.h index d8ac9a0439e2..b329623ace9f 100644 --- a/drivers/staging/et131x/et1310_eeprom.h +++ b/drivers/staging/et131x/et1310_eeprom.h @@ -61,17 +61,12 @@ #include "et1310_address_map.h" -#ifndef SUCCESS -#define SUCCESS 0 -#define FAILURE 1 -#endif - /* Forward declaration of the private adapter structure */ struct et131x_adapter; -int32_t EepromWriteByte(struct et131x_adapter *adapter, u32 unAddress, +int EepromWriteByte(struct et131x_adapter *adapter, u32 unAddress, u8 bData); -int32_t EepromReadByte(struct et131x_adapter *adapter, u32 unAddress, +int EepromReadByte(struct et131x_adapter *adapter, u32 unAddress, u8 *pbData); #endif /* _ET1310_EEPROM_H_ */ diff --git a/drivers/staging/et131x/et1310_phy.h b/drivers/staging/et131x/et1310_phy.h index 080656c6142c..6978b25c7e13 100644 --- a/drivers/staging/et131x/et1310_phy.h +++ b/drivers/staging/et131x/et1310_phy.h @@ -61,9 +61,6 @@ #include "et1310_address_map.h" -#define TRUEPHY_SUCCESS 0 -#define TRUEPHY_FAILURE 1 - /* MI Register Addresses */ #define MI_CONTROL_REG 0 #define MI_STATUS_REG 1 -- GitLab From b802ce0c705f537286da6084ec6503ba41bf7a0a Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:46:59 +0100 Subject: [PATCH 093/235] Staging: et131x: tidy eeprom code up Turn this one into something resembling a clean Linux driver Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_eeprom.c | 379 ++++++++---------------- drivers/staging/et131x/et1310_eeprom.h | 38 ++- drivers/staging/et131x/et131x_initpci.c | 6 +- 3 files changed, 158 insertions(+), 265 deletions(-) diff --git a/drivers/staging/et131x/et1310_eeprom.c b/drivers/staging/et131x/et1310_eeprom.c index 520a7c938c39..a80b3df5b960 100644 --- a/drivers/staging/et131x/et1310_eeprom.c +++ b/drivers/staging/et131x/et1310_eeprom.c @@ -95,198 +95,120 @@ #include "et1310_tx.h" -/* - * EEPROM Defines - */ - -/* LBCIF Register Groups (addressed via 32-bit offsets) */ -#define LBCIF_DWORD0_GROUP_OFFSET 0xAC -#define LBCIF_DWORD1_GROUP_OFFSET 0xB0 - -/* LBCIF Registers (addressed via 8-bit offsets) */ -#define LBCIF_ADDRESS_REGISTER_OFFSET 0xAC -#define LBCIF_DATA_REGISTER_OFFSET 0xB0 -#define LBCIF_CONTROL_REGISTER_OFFSET 0xB1 -#define LBCIF_STATUS_REGISTER_OFFSET 0xB2 -/* LBCIF Control Register Bits */ -#define LBCIF_CONTROL_SEQUENTIAL_READ 0x01 -#define LBCIF_CONTROL_PAGE_WRITE 0x02 -#define LBCIF_CONTROL_UNUSED1 0x04 -#define LBCIF_CONTROL_EEPROM_RELOAD 0x08 -#define LBCIF_CONTROL_UNUSED2 0x10 -#define LBCIF_CONTROL_TWO_BYTE_ADDR 0x20 -#define LBCIF_CONTROL_I2C_WRITE 0x40 -#define LBCIF_CONTROL_LBCIF_ENABLE 0x80 +static int eeprom_wait_ready(struct pci_dev *pdev, u32 *status) +{ + u32 reg; + int i; -/* LBCIF Status Register Bits */ -#define LBCIF_STATUS_PHY_QUEUE_AVAIL 0x01 -#define LBCIF_STATUS_I2C_IDLE 0x02 -#define LBCIF_STATUS_ACK_ERROR 0x04 -#define LBCIF_STATUS_GENERAL_ERROR 0x08 -#define LBCIF_STATUS_UNUSED 0x30 -#define LBCIF_STATUS_CHECKSUM_ERROR 0x40 -#define LBCIF_STATUS_EEPROM_PRESENT 0x80 + /* + * 1. Check LBCIF Status Register for bits 6 & 3:2 all equal to 0 and + * bits 7,1:0 both equal to 1, at least once after reset. + * Subsequent operations need only to check that bits 1:0 are equal + * to 1 prior to starting a single byte read/write + */ -/* Miscellaneous Constraints */ -#define MAX_NUM_REGISTER_POLLS 1000 -#define MAX_NUM_WRITE_RETRIES 2 + for (i = 0; i < MAX_NUM_REGISTER_POLLS; i++) { + /* Read registers grouped in DWORD1 */ + if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP, ®)) + return -EIO; + + /* I2C idle and Phy Queue Avail both true */ + if ((reg & 0x3000) == 0x3000) { + if (status) + *status = reg; + return reg & 0xFF; + } + } + return -ETIMEDOUT; +} -/* - * Define macros that allow individual register values to be extracted from a - * DWORD1 register grouping - */ -#define EXTRACT_DATA_REGISTER(x) (u8)(x & 0xFF) -#define EXTRACT_STATUS_REGISTER(x) (u8)((x >> 16) & 0xFF) -#define EXTRACT_CONTROL_REG(x) (u8)((x >> 8) & 0xFF) /** - * EepromWriteByte - Write a byte to the ET1310's EEPROM + * eeprom_write - Write a byte to the ET1310's EEPROM * @etdev: pointer to our private adapter structure * @addr: the address to write * @data: the value to write * * Returns 1 for a successful write. */ -int EepromWriteByte(struct et131x_adapter *etdev, u32 addr, u8 data) +int eeprom_write(struct et131x_adapter *etdev, u32 addr, u8 data) { struct pci_dev *pdev = etdev->pdev; - int index; + int index = 0; int retries; int err = 0; int i2c_wack = 0; int writeok = 0; - u8 control; - u8 status = 0; - u32 dword1 = 0; + u32 status; u32 val = 0; /* - * The following excerpt is from "Serial EEPROM HW Design - * Specification" Version 0.92 (9/20/2004): - * - * Single Byte Writes - * * For an EEPROM, an I2C single byte write is defined as a START * condition followed by the device address, EEPROM address, one byte * of data and a STOP condition. The STOP condition will trigger the * EEPROM's internally timed write cycle to the nonvolatile memory. * All inputs are disabled during this write cycle and the EEPROM will * not respond to any access until the internal write is complete. - * The steps to execute a single byte write are as follows: - * - * 1. Check LBCIF Status Register for bits 6 & 3:2 all equal to 0 and - * bits 7,1:0 both equal to 1, at least once after reset. - * Subsequent operations need only to check that bits 1:0 are - * equal to 1 prior to starting a single byte write. - * + */ + + err = eeprom_wait_ready(pdev, NULL); + if (err) + return err; + + /* * 2. Write to the LBCIF Control Register: bit 7=1, bit 6=1, bit 3=0, * and bits 1:0 both =0. Bit 5 should be set according to the * type of EEPROM being accessed (1=two byte addressing, 0=one * byte addressing). - * - * 3. Write the address to the LBCIF Address Register. - * - * 4. Write the data to the LBCIF Data Register (the I2C write will - * begin). - * - * 5. Monitor bit 1:0 of the LBCIF Status Register. When bits 1:0 are - * both equal to 1, the I2C write has completed and the internal - * write cycle of the EEPROM is about to start. (bits 1:0 = 01 is - * a legal state while waiting from both equal to 1, but bits - * 1:0 = 10 is invalid and implies that something is broken). - * - * 6. Check bit 3 of the LBCIF Status Register. If equal to 1, an - * error has occurred. - * - * 7. Check bit 2 of the LBCIF Status Register. If equal to 1 an ACK - * error has occurred on the address phase of the write. This - * could be due to an actual hardware failure or the EEPROM may - * still be in its internal write cycle from a previous write. - * This write operation was ignored and must be repeated later. - * - * 8. Set bit 6 of the LBCIF Control Register = 0. If another write is - * required, go to step 1. */ - - /* Step 1: */ - for (index = 0; index < MAX_NUM_REGISTER_POLLS; index++) { - /* Read registers grouped in DWORD1 */ - if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP_OFFSET, - &dword1)) { - err = 1; - break; - } - - status = EXTRACT_STATUS_REGISTER(dword1); - - if (status & LBCIF_STATUS_PHY_QUEUE_AVAIL && - status & LBCIF_STATUS_I2C_IDLE) - /* bits 1:0 are equal to 1 */ - break; - } - - if (err || (index >= MAX_NUM_REGISTER_POLLS)) - return 0; - - /* Step 2: */ - control = 0; - control |= LBCIF_CONTROL_LBCIF_ENABLE | LBCIF_CONTROL_I2C_WRITE; - - if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET, - control)) { - return 0; - } + if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER, + LBCIF_CONTROL_LBCIF_ENABLE | LBCIF_CONTROL_I2C_WRITE)) + return -EIO; i2c_wack = 1; /* Prepare EEPROM address for Step 3 */ for (retries = 0; retries < MAX_NUM_WRITE_RETRIES; retries++) { - /* Step 3:*/ - if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER_OFFSET, - addr)) { - break; - } - - /* Step 4: */ - if (pci_write_config_byte(pdev, LBCIF_DATA_REGISTER_OFFSET, - data)) { + /* Write the address to the LBCIF Address Register */ + if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER, addr)) break; - } - - /* Step 5: */ - for (index = 0; index < MAX_NUM_REGISTER_POLLS; index++) { - /* Read registers grouped in DWORD1 */ - if (pci_read_config_dword(pdev, - LBCIF_DWORD1_GROUP_OFFSET, - &dword1)) { - err = 1; - break; - } - - status = EXTRACT_STATUS_REGISTER(dword1); - - if (status & LBCIF_STATUS_PHY_QUEUE_AVAIL && - status & LBCIF_STATUS_I2C_IDLE) { - /* I2C write complete */ - break; - } - } - - if (err || (index >= MAX_NUM_REGISTER_POLLS)) + /* + * Write the data to the LBCIF Data Register (the I2C write + * will begin). + */ + if (pci_write_config_byte(pdev, LBCIF_DATA_REGISTER, data)) break; + /* + * Monitor bit 1:0 of the LBCIF Status Register. When bits + * 1:0 are both equal to 1, the I2C write has completed and the + * internal write cycle of the EEPROM is about to start. + * (bits 1:0 = 01 is a legal state while waiting from both + * equal to 1, but bits 1:0 = 10 is invalid and implies that + * something is broken). + */ + err = eeprom_wait_ready(pdev, &status); + if (err < 0) + return 0; /* - * Step 6: Don't break here if we are revision 1, this is - * so we do a blind write for load bug. + * Check bit 3 of the LBCIF Status Register. If equal to 1, + * an error has occurred.Don't break here if we are revision + * 1, this is so we do a blind write for load bug. */ - if (status & LBCIF_STATUS_GENERAL_ERROR - && etdev->pdev->revision == 0) { + if ((status & LBCIF_STATUS_GENERAL_ERROR) + && etdev->pdev->revision == 0) break; - } - /* Step 7 */ + /* + * Check bit 2 of the LBCIF Status Register. If equal to 1 an + * ACK error has occurred on the address phase of the write. + * This could be due to an actual hardware failure or the + * EEPROM may still be in its internal write cycle from a + * previous write. This write operation was ignored and must be + *repeated later. + */ if (status & LBCIF_STATUS_ACK_ERROR) { /* * This could be due to an actual hardware failure @@ -302,43 +224,38 @@ int EepromWriteByte(struct et131x_adapter *etdev, u32 addr, u8 data) break; } - /* Step 8: */ + /* + * Set bit 6 of the LBCIF Control Register = 0. + */ udelay(10); - index = 0; - while (i2c_wack) { - control &= ~LBCIF_CONTROL_I2C_WRITE; - if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET, - control)) { + while (i2c_wack) { + if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER, + LBCIF_CONTROL_LBCIF_ENABLE)) writeok = 0; - } /* Do read until internal ACK_ERROR goes away meaning write * completed */ do { pci_write_config_dword(pdev, - LBCIF_ADDRESS_REGISTER_OFFSET, + LBCIF_ADDRESS_REGISTER, addr); do { pci_read_config_dword(pdev, - LBCIF_DATA_REGISTER_OFFSET, &val); + LBCIF_DATA_REGISTER, &val); } while ((val & 0x00010000) == 0); } while (val & 0x00040000); - control = EXTRACT_CONTROL_REG(val); - - if (control != 0xC0 || index == 10000) + if ((val & 0xFF00) != 0xC000 || index == 10000) break; - index++; } - - return writeok; + return writeok ? 0 : -EIO; } /** - * EepromReadByte - Read a byte from the ET1310's EEPROM + * eeprom_read - Read a byte from the ET1310's EEPROM * @etdev: pointer to our private adapter structure * @addr: the address from which to read * @pdata: a pointer to a byte in which to store the value of the read @@ -347,109 +264,51 @@ int EepromWriteByte(struct et131x_adapter *etdev, u32 addr, u8 data) * * Returns 1 for a successful read */ -int EepromReadByte(struct et131x_adapter *etdev, u32 addr, u8 *pdata) +int eeprom_read(struct et131x_adapter *etdev, u32 addr, u8 *pdata) { struct pci_dev *pdev = etdev->pdev; - int index; - int err = 0; - u8 control; - u8 status = 0; - u32 dword1 = 0; + int err; + u32 status; /* - * The following excerpt is from "Serial EEPROM HW Design - * Specification" Version 0.92 (9/20/2004): - * - * Single Byte Reads - * * A single byte read is similar to the single byte write, with the * exception of the data flow: - * - * 1. Check LBCIF Status Register for bits 6 & 3:2 all equal to 0 and - * bits 7,1:0 both equal to 1, at least once after reset. - * Subsequent operations need only to check that bits 1:0 are equal - * to 1 prior to starting a single byte read. - * - * 2. Write to the LBCIF Control Register: bit 7=1, bit 6=0, bit 3=0, - * and bits 1:0 both =0. Bit 5 should be set according to the type - * of EEPROM being accessed (1=two byte addressing, 0=one byte - * addressing). - * - * 3. Write the address to the LBCIF Address Register (I2C read will - * begin). - * - * 4. Monitor bit 0 of the LBCIF Status Register. When =1, I2C read - * is complete. (if bit 1 =1 and bit 0 stays =0, a hardware failure - * has occurred). - * - * 5. Check bit 2 of the LBCIF Status Register. If =1, then an error - * has occurred. The data that has been returned from the PHY may - * be invalid. - * - * 6. Regardless of error status, read data byte from LBCIF Data - * Register. If another byte is required, go to step 1. */ - /* Step 1: */ - for (index = 0; index < MAX_NUM_REGISTER_POLLS; index++) { - /* Read registers grouped in DWORD1 */ - if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP_OFFSET, - &dword1)) { - err = 1; - break; - } - - status = EXTRACT_STATUS_REGISTER(dword1); - - if (status & LBCIF_STATUS_PHY_QUEUE_AVAIL && - status & LBCIF_STATUS_I2C_IDLE) { - /* bits 1:0 are equal to 1 */ - break; - } - } - - if (err || (index >= MAX_NUM_REGISTER_POLLS)) - return 0; - - /* Step 2: */ - control = 0; - control |= LBCIF_CONTROL_LBCIF_ENABLE; - - if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER_OFFSET, - control)) { - return 0; - } - - /* Step 3: */ - - if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER_OFFSET, - addr)) { - return 0; - } - - /* Step 4: */ - for (index = 0; index < MAX_NUM_REGISTER_POLLS; index++) { - /* Read registers grouped in DWORD1 */ - if (pci_read_config_dword(pdev, LBCIF_DWORD1_GROUP_OFFSET, - &dword1)) { - err = 1; - break; - } - - status = EXTRACT_STATUS_REGISTER(dword1); - - if (status & LBCIF_STATUS_PHY_QUEUE_AVAIL - && status & LBCIF_STATUS_I2C_IDLE) { - /* I2C read complete */ - break; - } - } - - if (err || (index >= MAX_NUM_REGISTER_POLLS)) - return 0; - - /* Step 6: */ - *pdata = EXTRACT_DATA_REGISTER(dword1); - - return (status & LBCIF_STATUS_ACK_ERROR) ? 0 : 1; + err = eeprom_wait_ready(pdev, NULL); + if (err) + return err; + /* + * Write to the LBCIF Control Register: bit 7=1, bit 6=0, bit 3=0, + * and bits 1:0 both =0. Bit 5 should be set according to the type + * of EEPROM being accessed (1=two byte addressing, 0=one byte + * addressing). + */ + if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER, + LBCIF_CONTROL_LBCIF_ENABLE)) + return -EIO; + /* + * Write the address to the LBCIF Address Register (I2C read will + * begin). + */ + if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER, addr)) + return -EIO; + /* + * Monitor bit 0 of the LBCIF Status Register. When = 1, I2C read + * is complete. (if bit 1 =1 and bit 0 stays = 0, a hardware failure + * has occurred). + */ + err = eeprom_wait_ready(pdev, &status); + if (err < 0) + return err; + /* + * Regardless of error status, read data byte from LBCIF Data + * Register. + */ + *pdata = err; + /* + * Check bit 2 of the LBCIF Status Register. If = 1, + * then an error has occurred. + */ + return (status & LBCIF_STATUS_ACK_ERROR) ? -EIO : 0; } diff --git a/drivers/staging/et131x/et1310_eeprom.h b/drivers/staging/et131x/et1310_eeprom.h index b329623ace9f..eaa5c1f20d8f 100644 --- a/drivers/staging/et131x/et1310_eeprom.h +++ b/drivers/staging/et131x/et1310_eeprom.h @@ -61,12 +61,46 @@ #include "et1310_address_map.h" +/* + * EEPROM Defines + */ + +/* LBCIF Register Groups (addressed via 32-bit offsets) */ +#define LBCIF_DWORD0_GROUP 0xAC +#define LBCIF_DWORD1_GROUP 0xB0 + +/* LBCIF Registers (addressed via 8-bit offsets) */ +#define LBCIF_ADDRESS_REGISTER 0xAC +#define LBCIF_DATA_REGISTER 0xB0 +#define LBCIF_CONTROL_REGISTER 0xB1 +#define LBCIF_STATUS_REGISTER 0xB2 + +/* LBCIF Control Register Bits */ +#define LBCIF_CONTROL_SEQUENTIAL_READ 0x01 +#define LBCIF_CONTROL_PAGE_WRITE 0x02 +#define LBCIF_CONTROL_EEPROM_RELOAD 0x08 +#define LBCIF_CONTROL_TWO_BYTE_ADDR 0x20 +#define LBCIF_CONTROL_I2C_WRITE 0x40 +#define LBCIF_CONTROL_LBCIF_ENABLE 0x80 + +/* LBCIF Status Register Bits */ +#define LBCIF_STATUS_PHY_QUEUE_AVAIL 0x01 +#define LBCIF_STATUS_I2C_IDLE 0x02 +#define LBCIF_STATUS_ACK_ERROR 0x04 +#define LBCIF_STATUS_GENERAL_ERROR 0x08 +#define LBCIF_STATUS_CHECKSUM_ERROR 0x40 +#define LBCIF_STATUS_EEPROM_PRESENT 0x80 + +/* Miscellaneous Constraints */ +#define MAX_NUM_REGISTER_POLLS 1000 +#define MAX_NUM_WRITE_RETRIES 2 + /* Forward declaration of the private adapter structure */ struct et131x_adapter; -int EepromWriteByte(struct et131x_adapter *adapter, u32 unAddress, +int eeprom_write(struct et131x_adapter *adapter, u32 unAddress, u8 bData); -int EepromReadByte(struct et131x_adapter *adapter, u32 unAddress, +int eeprom_read(struct et131x_adapter *adapter, u32 unAddress, u8 *pbData); #endif /* _ET1310_EEPROM_H_ */ diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c index 5ec0d5b59cba..cc1957ba1474 100644 --- a/drivers/staging/et131x/et131x_initpci.c +++ b/drivers/staging/et131x/et131x_initpci.c @@ -199,7 +199,7 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev) * corruption seen with 1310 B Silicon */ for (nLoop = 0; nLoop < 3; nLoop++) { - EepromWriteByte(adapter, nLoop, temp[nLoop]); + eeprom_write(adapter, nLoop, temp[nLoop]); } } @@ -219,8 +219,8 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev) /* Read the EEPROM for information regarding LED behavior. Refer to * ET1310_phy.c, et131x_xcvr_init(), for its use. */ - EepromReadByte(adapter, 0x70, &adapter->eepromData[0]); - EepromReadByte(adapter, 0x71, &adapter->eepromData[1]); + eeprom_read(adapter, 0x70, &adapter->eepromData[0]); + eeprom_read(adapter, 0x71, &adapter->eepromData[1]); if (adapter->eepromData[0] != 0xcd) /* Disable all optional features */ -- GitLab From 4e02b4b57df1ac5e040e9b70391dfcc2929c9958 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:47:22 +0100 Subject: [PATCH 094/235] Staging: et131x: extract the eeprom setup logic from initpci This puts all the eeprom handling in one place and cleans up the interfaces Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_eeprom.c | 73 ++++++++++++++++++++++++- drivers/staging/et131x/et1310_eeprom.h | 5 +- drivers/staging/et131x/et131x_initpci.c | 67 +---------------------- 3 files changed, 73 insertions(+), 72 deletions(-) diff --git a/drivers/staging/et131x/et1310_eeprom.c b/drivers/staging/et131x/et1310_eeprom.c index a80b3df5b960..bcca1f86f516 100644 --- a/drivers/staging/et131x/et1310_eeprom.c +++ b/drivers/staging/et131x/et1310_eeprom.c @@ -132,7 +132,7 @@ static int eeprom_wait_ready(struct pci_dev *pdev, u32 *status) * * Returns 1 for a successful write. */ -int eeprom_write(struct et131x_adapter *etdev, u32 addr, u8 data) +static int eeprom_write(struct et131x_adapter *etdev, u32 addr, u8 data) { struct pci_dev *pdev = etdev->pdev; int index = 0; @@ -264,7 +264,7 @@ int eeprom_write(struct et131x_adapter *etdev, u32 addr, u8 data) * * Returns 1 for a successful read */ -int eeprom_read(struct et131x_adapter *etdev, u32 addr, u8 *pdata) +static int eeprom_read(struct et131x_adapter *etdev, u32 addr, u8 *pdata) { struct pci_dev *pdev = etdev->pdev; int err; @@ -312,3 +312,72 @@ int eeprom_read(struct et131x_adapter *etdev, u32 addr, u8 *pdata) */ return (status & LBCIF_STATUS_ACK_ERROR) ? -EIO : 0; } + +int et131x_init_eeprom(struct et131x_adapter *etdev) +{ + struct pci_dev *pdev = etdev->pdev; + u8 eestatus; + + /* We first need to check the EEPROM Status code located at offset + * 0xB2 of config space + */ + pci_read_config_byte(pdev, ET1310_PCI_EEPROM_STATUS, + &eestatus); + + /* THIS IS A WORKAROUND: + * I need to call this function twice to get my card in a + * LG M1 Express Dual running. I tried also a msleep before this + * function, because I thougth there could be some time condidions + * but it didn't work. Call the whole function twice also work. + */ + if (pci_read_config_byte(pdev, ET1310_PCI_EEPROM_STATUS, &eestatus)) { + dev_err(&pdev->dev, + "Could not read PCI config space for EEPROM Status\n"); + return -EIO; + } + + /* Determine if the error(s) we care about are present. If they are + * present we need to fail. + */ + if (eestatus & 0x4C) { + int write_failed = 0; + if (pdev->revision == 0x01) { + int i; + static const u8 eedata[4] = { 0xFE, 0x13, 0x10, 0xFF }; + + /* Re-write the first 4 bytes if we have an eeprom + * present and the revision id is 1, this fixes the + * corruption seen with 1310 B Silicon + */ + for (i = 0; i < 3; i++) + if (eeprom_write(etdev, i, eedata[i]) < 0) + write_failed = 1; + } + if (pdev->revision != 0x01 || write_failed) { + dev_err(&pdev->dev, + "Fatal EEPROM Status Error - 0x%04x\n", eestatus); + + /* This error could mean that there was an error + * reading the eeprom or that the eeprom doesn't exist. + * We will treat each case the same and not try to gather + * additional information that normally would come from the + * eeprom, like MAC Address + */ + etdev->has_eeprom = 0; + return -EIO; + } + } + etdev->has_eeprom = 1; + + /* Read the EEPROM for information regarding LED behavior. Refer to + * ET1310_phy.c, et131x_xcvr_init(), for its use. + */ + eeprom_read(etdev, 0x70, &etdev->eepromData[0]); + eeprom_read(etdev, 0x71, &etdev->eepromData[1]); + + if (etdev->eepromData[0] != 0xcd) + /* Disable all optional features */ + etdev->eepromData[1] = 0x00; + + return 0; +} diff --git a/drivers/staging/et131x/et1310_eeprom.h b/drivers/staging/et131x/et1310_eeprom.h index eaa5c1f20d8f..6a6c6a632a8f 100644 --- a/drivers/staging/et131x/et1310_eeprom.h +++ b/drivers/staging/et131x/et1310_eeprom.h @@ -98,9 +98,6 @@ /* Forward declaration of the private adapter structure */ struct et131x_adapter; -int eeprom_write(struct et131x_adapter *adapter, u32 unAddress, - u8 bData); -int eeprom_read(struct et131x_adapter *adapter, u32 unAddress, - u8 *pbData); +int et131x_init_eeprom(struct et131x_adapter *etdev); #endif /* _ET1310_EEPROM_H_ */ diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c index cc1957ba1474..363162cf9881 100644 --- a/drivers/staging/et131x/et131x_initpci.c +++ b/drivers/staging/et131x/et131x_initpci.c @@ -140,10 +140,8 @@ MODULE_PARM_DESC(et131x_speed_set, int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev) { int result; - uint8_t eepromStat; uint8_t maxPayload = 0; uint8_t read_size_reg; - u8 rev; /* Allow disabling of Non-Maskable Interrupts in I/O space, to * support validation. @@ -160,71 +158,8 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev) outb(ET1310_NMI_DISABLE, RegisterVal); } - /* We first need to check the EEPROM Status code located at offset - * 0xB2 of config space - */ - result = pci_read_config_byte(pdev, ET1310_PCI_EEPROM_STATUS, - &eepromStat); - - /* THIS IS A WORKAROUND: - * I need to call this function twice to get my card in a - * LG M1 Express Dual running. I tried also a msleep before this - * function, because I thougth there could be some time condidions - * but it didn't work. Call the whole function twice also work. - */ - result = pci_read_config_byte(pdev, ET1310_PCI_EEPROM_STATUS, - &eepromStat); - if (result != PCIBIOS_SUCCESSFUL) { - dev_err(&pdev->dev, "Could not read PCI config space for " - "EEPROM Status\n"); - return -EIO; - } - - /* Determine if the error(s) we care about are present. If they are - * present, we need to fail. - */ - if (eepromStat & 0x4C) { - result = pci_read_config_byte(pdev, PCI_REVISION_ID, &rev); - if (result != PCIBIOS_SUCCESSFUL) { - dev_err(&pdev->dev, - "Could not read PCI config space for " - "Revision ID\n"); - return -EIO; - } else if (rev == 0x01) { - int32_t nLoop; - uint8_t temp[4] = { 0xFE, 0x13, 0x10, 0xFF }; - - /* Re-write the first 4 bytes if we have an eeprom - * present and the revision id is 1, this fixes the - * corruption seen with 1310 B Silicon - */ - for (nLoop = 0; nLoop < 3; nLoop++) { - eeprom_write(adapter, nLoop, temp[nLoop]); - } - } - - dev_err(&pdev->dev, "Fatal EEPROM Status Error - 0x%04x\n", eepromStat); - - /* This error could mean that there was an error reading the - * eeprom or that the eeprom doesn't exist. We will treat - * each case the same and not try to gather additional - * information that normally would come from the eeprom, like - * MAC Address - */ - adapter->has_eeprom = 0; + if (et131x_init_eeprom(adapter) < 0) return -EIO; - } else - adapter->has_eeprom = 1; - - /* Read the EEPROM for information regarding LED behavior. Refer to - * ET1310_phy.c, et131x_xcvr_init(), for its use. - */ - eeprom_read(adapter, 0x70, &adapter->eepromData[0]); - eeprom_read(adapter, 0x71, &adapter->eepromData[1]); - - if (adapter->eepromData[0] != 0xcd) - /* Disable all optional features */ - adapter->eepromData[1] = 0x00; /* Let's set up the PORT LOGIC Register. First we need to know what * the max_payload_size is -- GitLab From 7f2bf9488db14c67778cee6b5204ecf3629e1ec2 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:47:29 +0100 Subject: [PATCH 095/235] Staging: et131x: Kill the NoPhyAccess variable Another write once "variable" Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_tx.c | 3 +-- drivers/staging/et131x/et131x_adapter.h | 1 - drivers/staging/et131x/et131x_isr.c | 3 --- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c index 94f7752e2ccc..b19d5069a033 100644 --- a/drivers/staging/et131x/et1310_tx.c +++ b/drivers/staging/et131x/et1310_tx.c @@ -368,8 +368,7 @@ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev) * if( MP_SHOULD_FAIL_SEND( etdev ) || * etdev->DriverNoPhyAccess ) */ - if (MP_SHOULD_FAIL_SEND(etdev) || etdev->DriverNoPhyAccess - || !netif_carrier_ok(netdev)) { + if (MP_SHOULD_FAIL_SEND(etdev) || !netif_carrier_ok(netdev)) { dev_kfree_skb_any(skb); skb = NULL; diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h index 1dfe06f1b1a7..83ddcd503ebd 100644 --- a/drivers/staging/et131x/et131x_adapter.h +++ b/drivers/staging/et131x/et131x_adapter.h @@ -248,7 +248,6 @@ struct et131x_adapter { NETIF_STATUS_MEDIA_DISCONNECT, NETIF_STATUS_MAX } MediaState; - u8 DriverNoPhyAccess; /* Minimize init-time */ struct timer_list ErrorTimer; diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c index f80189d7cb6d..80fa7a36e694 100644 --- a/drivers/staging/et131x/et131x_isr.c +++ b/drivers/staging/et131x/et131x_isr.c @@ -109,9 +109,6 @@ void et131x_enable_interrupts(struct et131x_adapter *adapter) else mask = INT_MASK_ENABLE_NO_FLOW; - if (adapter->DriverNoPhyAccess) - mask |= ET_INTR_PHY; - adapter->CachedMaskValue = mask; writel(mask, &adapter->regs->global.int_mask); } -- GitLab From c431e3c06424499c24378fda546827b7caa79800 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:47:41 +0100 Subject: [PATCH 096/235] Staging: et131x: tidy up initpci code Perform some easy tidying so we can see what needs to be done next Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et131x_initpci.c | 436 ++++++++++-------------- drivers/staging/et131x/et131x_initpci.h | 2 +- drivers/staging/et131x/et131x_netdev.c | 6 +- 3 files changed, 192 insertions(+), 252 deletions(-) diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c index 363162cf9881..7b1e912f3ab2 100644 --- a/drivers/staging/et131x/et131x_initpci.c +++ b/drivers/staging/et131x/et131x_initpci.c @@ -132,16 +132,60 @@ MODULE_PARM_DESC(et131x_speed_set, "Set Link speed and dublex manually (0-5) [0] \n 1 : 10Mb Half-Duplex \n 2 : 10Mb Full-Duplex \n 3 : 100Mb Half-Duplex \n 4 : 100Mb Full-Duplex \n 5 : 1000Mb Full-Duplex \n 0 : Auto Speed Auto Dublex"); /** - * et131x_find_adapter - Find the adapter and get all the assigned resources + * et131x_hwaddr_init - set up the MAC Address on the ET1310 * @adapter: pointer to our private adapter structure + */ +void et131x_hwaddr_init(struct et131x_adapter *adapter) +{ + /* If have our default mac from init and no mac address from + * EEPROM then we need to generate the last octet and set it on the + * device + */ + if (adapter->PermanentAddress[0] == 0x00 && + adapter->PermanentAddress[1] == 0x00 && + adapter->PermanentAddress[2] == 0x00 && + adapter->PermanentAddress[3] == 0x00 && + adapter->PermanentAddress[4] == 0x00 && + adapter->PermanentAddress[5] == 0x00) { + /* + * We need to randomly generate the last octet so we + * decrease our chances of setting the mac address to + * same as another one of our cards in the system + */ + get_random_bytes(&adapter->CurrentAddress[5], 1); + /* + * We have the default value in the register we are + * working with so we need to copy the current + * address into the permanent address + */ + memcpy(adapter->PermanentAddress, + adapter->CurrentAddress, ETH_ALEN); + } else { + /* We do not have an override address, so set the + * current address to the permanent address and add + * it to the device + */ + memcpy(adapter->CurrentAddress, + adapter->PermanentAddress, ETH_ALEN); + } +} + + +/** + * et131x_pci_init - initial PCI setup + * @adapter: pointer to our private adapter structure + * @pdev: our PCI device * - * Returns 0 on success, errno on failure (as defined in errno.h) + * Perform the initial setup of PCI registers and if possible initialise + * the MAC address. At this point the I/O registers have yet to be mapped */ -int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev) + +static int et131x_pci_init(struct et131x_adapter *adapter, + struct pci_dev *pdev) { - int result; - uint8_t maxPayload = 0; - uint8_t read_size_reg; + int i; + u8 max_payload; + u8 read_size_reg; /* Allow disabling of Non-Maskable Interrupts in I/O space, to * support validation. @@ -164,31 +208,27 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev) /* Let's set up the PORT LOGIC Register. First we need to know what * the max_payload_size is */ - result = pci_read_config_byte(pdev, ET1310_PCI_MAX_PYLD, &maxPayload); - if (result != PCIBIOS_SUCCESSFUL) { + if (pci_read_config_byte(pdev, ET1310_PCI_MAX_PYLD, &max_payload)) { dev_err(&pdev->dev, "Could not read PCI config space for Max Payload Size\n"); return -EIO; } /* Program the Ack/Nak latency and replay timers */ - maxPayload &= 0x07; /* Only the lower 3 bits are valid */ + max_payload &= 0x07; /* Only the lower 3 bits are valid */ - if (maxPayload < 2) { - const uint16_t AckNak[2] = { 0x76, 0xD0 }; - const uint16_t Replay[2] = { 0x1E0, 0x2ED }; + if (max_payload < 2) { + static const u16 AckNak[2] = { 0x76, 0xD0 }; + static const u16 Replay[2] = { 0x1E0, 0x2ED }; - result = pci_write_config_word(pdev, ET1310_PCI_ACK_NACK, - AckNak[maxPayload]); - if (result != PCIBIOS_SUCCESSFUL) { + if (pci_write_config_word(pdev, ET1310_PCI_ACK_NACK, + AckNak[max_payload])) { dev_err(&pdev->dev, "Could not write PCI config space for ACK/NAK\n"); return -EIO; } - - result = pci_write_config_word(pdev, ET1310_PCI_REPLAY, - Replay[maxPayload]); - if (result != PCIBIOS_SUCCESSFUL) { + if (pci_write_config_word(pdev, ET1310_PCI_REPLAY, + Replay[max_payload])) { dev_err(&pdev->dev, "Could not write PCI config space for Replay Timer\n"); return -EIO; @@ -198,16 +238,14 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev) /* l0s and l1 latency timers. We are using default values. * Representing 001 for L0s and 010 for L1 */ - result = pci_write_config_byte(pdev, ET1310_PCI_L0L1LATENCY, 0x11); - if (result != PCIBIOS_SUCCESSFUL) { + if (pci_write_config_byte(pdev, ET1310_PCI_L0L1LATENCY, 0x11)) { dev_err(&pdev->dev, "Could not write PCI config space for Latency Timers\n"); return -EIO; } /* Change the max read size to 2k */ - result = pci_read_config_byte(pdev, 0x51, &read_size_reg); - if (result != PCIBIOS_SUCCESSFUL) { + if (pci_read_config_byte(pdev, 0x51, &read_size_reg)) { dev_err(&pdev->dev, "Could not read PCI config space for Max read size\n"); return -EIO; @@ -216,8 +254,7 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev) read_size_reg &= 0x8f; read_size_reg |= 0x40; - result = pci_write_config_byte(pdev, 0x51, read_size_reg); - if (result != PCIBIOS_SUCCESSFUL) { + if (pci_write_config_byte(pdev, 0x51, read_size_reg)) { dev_err(&pdev->dev, "Could not write PCI config space for Max read size\n"); return -EIO; @@ -226,19 +263,19 @@ int et131x_find_adapter(struct et131x_adapter *adapter, struct pci_dev *pdev) /* Get MAC address from config space if an eeprom exists, otherwise * the MAC address there will not be valid */ - if (adapter->has_eeprom) { - int i; - - for (i = 0; i < ETH_ALEN; i++) { - result = pci_read_config_byte( - pdev, ET1310_PCI_MAC_ADDRESS + i, - adapter->PermanentAddress + i); - if (result != PCIBIOS_SUCCESSFUL) { - dev_err(&pdev->dev, ";Could not read PCI config space for MAC address\n"); - return -EIO; - } + if (!adapter->has_eeprom) { + et131x_hwaddr_init(adapter); + return 0; + } + + for (i = 0; i < ETH_ALEN; i++) { + if (pci_read_config_byte(pdev, ET1310_PCI_MAC_ADDRESS + i, + adapter->PermanentAddress + i)) { + dev_err(&pdev->dev, "Could not read PCI config space for MAC address\n"); + return -EIO; } } + memcpy(adapter->CurrentAddress, adapter->PermanentAddress, ETH_ALEN); return 0; } @@ -432,45 +469,6 @@ int et131x_adapter_setup(struct et131x_adapter *etdev) ; return status; } -/** - * et131x_setup_hardware_properties - set up the MAC Address on the ET1310 - * @adapter: pointer to our private adapter structure - */ -void et131x_setup_hardware_properties(struct et131x_adapter *adapter) -{ - /* If have our default mac from registry and no mac address from - * EEPROM then we need to generate the last octet and set it on the - * device - */ - if (adapter->PermanentAddress[0] == 0x00 && - adapter->PermanentAddress[1] == 0x00 && - adapter->PermanentAddress[2] == 0x00 && - adapter->PermanentAddress[3] == 0x00 && - adapter->PermanentAddress[4] == 0x00 && - adapter->PermanentAddress[5] == 0x00) { - /* - * We need to randomly generate the last octet so we - * decrease our chances of setting the mac address to - * same as another one of our cards in the system - */ - get_random_bytes(&adapter->CurrentAddress[5], 1); - /* - * We have the default value in the register we are - * working with so we need to copy the current - * address into the permanent address - */ - memcpy(adapter->PermanentAddress, - adapter->CurrentAddress, ETH_ALEN); - } else { - /* We do not have an override address, so set the - * current address to the permanent address and add - * it to the device - */ - memcpy(adapter->CurrentAddress, - adapter->PermanentAddress, ETH_ALEN); - } -} - /** * et131x_soft_reset - Issue a soft reset to the hardware, complete for ET1310 * @adapter: pointer to our private adapter structure @@ -523,36 +521,32 @@ void et131x_align_allocated_memory(struct et131x_adapter *adapter, */ int et131x_adapter_memory_alloc(struct et131x_adapter *adapter) { - int status = 0; - - do { - /* Allocate memory for the Tx Ring */ - status = et131x_tx_dma_memory_alloc(adapter); - if (status != 0) { - dev_err(&adapter->pdev->dev, - "et131x_tx_dma_memory_alloc FAILED\n"); - break; - } + int status; - /* Receive buffer memory allocation */ - status = et131x_rx_dma_memory_alloc(adapter); - if (status != 0) { - dev_err(&adapter->pdev->dev, - "et131x_rx_dma_memory_alloc FAILED\n"); - et131x_tx_dma_memory_free(adapter); - break; - } + /* Allocate memory for the Tx Ring */ + status = et131x_tx_dma_memory_alloc(adapter); + if (status != 0) { + dev_err(&adapter->pdev->dev, + "et131x_tx_dma_memory_alloc FAILED\n"); + return status; + } + /* Receive buffer memory allocation */ + status = et131x_rx_dma_memory_alloc(adapter); + if (status != 0) { + dev_err(&adapter->pdev->dev, + "et131x_rx_dma_memory_alloc FAILED\n"); + et131x_tx_dma_memory_free(adapter); + return status; + } - /* Init receive data structures */ - status = et131x_init_recv(adapter); - if (status != 0) { - dev_err(&adapter->pdev->dev, - "et131x_init_recv FAILED\n"); - et131x_tx_dma_memory_free(adapter); - et131x_rx_dma_memory_free(adapter); - break; - } - } while (0); + /* Init receive data structures */ + status = et131x_init_recv(adapter); + if (status != 0) { + dev_err(&adapter->pdev->dev, + "et131x_init_recv FAILED\n"); + et131x_tx_dma_memory_free(adapter); + et131x_rx_dma_memory_free(adapter); + } return status; } @@ -567,22 +561,51 @@ void et131x_adapter_memory_free(struct et131x_adapter *adapter) et131x_rx_dma_memory_free(adapter); } + + /** - * et131x_config_parse + * et131x_adapter_init * @etdev: pointer to the private adapter struct + * @pdev: pointer to the PCI device * - * Parses a configuration from some location (module parameters, for example) - * into the private adapter struct. This really has no sensible analogy in - * Linux as sysfs parameters are dynamic. Several things that were hee could - * go into sysfs, but other stuff like speed handling is part of the mii - * interfaces/ethtool. + * Initialize the data structures for the et131x_adapter object and link + * them together with the platform provided device structures. */ -void et131x_config_parse(struct et131x_adapter *etdev) + + +static struct et131x_adapter *et131x_adapter_init(struct net_device *netdev, + struct pci_dev *pdev) { static const u8 default_mac[] = { 0x00, 0x05, 0x3d, 0x00, 0x02, 0x00 }; static const u8 duplex[] = { 0, 1, 2, 1, 2, 2 }; static const u16 speed[] = { 0, 10, 10, 100, 100, 1000 }; + struct et131x_adapter *etdev; + + /* Setup the fundamental net_device and private adapter structure elements */ + SET_NETDEV_DEV(netdev, &pdev->dev); + + /* Allocate private adapter struct and copy in relevant information */ + etdev = netdev_priv(netdev); + etdev->pdev = pci_dev_get(pdev); + etdev->netdev = netdev; + + /* Do the same for the netdev struct */ + netdev->irq = pdev->irq; + netdev->base_addr = pci_resource_start(pdev, 0); + + /* Initialize spinlocks here */ + spin_lock_init(&etdev->Lock); + spin_lock_init(&etdev->TCBSendQLock); + spin_lock_init(&etdev->TCBReadyQLock); + spin_lock_init(&etdev->SendHWLock); + spin_lock_init(&etdev->SendWaitLock); + spin_lock_init(&etdev->RcvLock); + spin_lock_init(&etdev->RcvPendLock); + spin_lock_init(&etdev->FbrLock); + spin_lock_init(&etdev->PHYLock); + + /* Parse configuration parameters into the private adapter struct */ if (et131x_speed_set) dev_info(&etdev->pdev->dev, "Speed set manually to : %d \n", et131x_speed_set); @@ -609,40 +632,10 @@ void et131x_config_parse(struct et131x_adapter *etdev) etdev->AiForceSpeed = speed[etdev->SpeedDuplex]; etdev->AiForceDpx = duplex[etdev->SpeedDuplex]; /* Auto FDX */ -} - -/** - * et131x_pci_remove - * @pdev: a pointer to the device's pci_dev structure - * - * Registered in the pci_driver structure, this function is called when the - * PCI subsystem detects that a PCI device which matches the information - * contained in the pci_device_id table has been removed. - */ - -void __devexit et131x_pci_remove(struct pci_dev *pdev) -{ - struct net_device *netdev; - struct et131x_adapter *adapter; - - /* Retrieve the net_device pointer from the pci_dev struct, as well - * as the private adapter struct - */ - netdev = (struct net_device *) pci_get_drvdata(pdev); - adapter = netdev_priv(netdev); - - /* Perform device cleanup */ - unregister_netdev(netdev); - et131x_adapter_memory_free(adapter); - iounmap(adapter->regs); - pci_dev_put(adapter->pdev); - free_netdev(netdev); - pci_release_regions(pdev); - pci_disable_device(pdev); + return etdev; } - /** * et131x_pci_setup - Perform device initialization * @pdev: a pointer to the device's pci_dev structure @@ -656,34 +649,31 @@ void __devexit et131x_pci_remove(struct pci_dev *pdev) * a device insertion routine. */ -int __devinit et131x_pci_setup(struct pci_dev *pdev, +static int __devinit et131x_pci_setup(struct pci_dev *pdev, const struct pci_device_id *ent) { - int result = 0; + int result = -EBUSY; int pm_cap; bool pci_using_dac; - struct net_device *netdev = NULL; - struct et131x_adapter *adapter = NULL; + struct net_device *netdev; + struct et131x_adapter *adapter; /* Enable the device via the PCI subsystem */ - result = pci_enable_device(pdev); - if (result != 0) { - dev_err(&adapter->pdev->dev, + if (pci_enable_device(pdev) != 0) { + dev_err(&pdev->dev, "pci_enable_device() failed\n"); - goto out; + return -EIO; } /* Perform some basic PCI checks */ if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { - dev_err(&adapter->pdev->dev, + dev_err(&pdev->dev, "Can't find PCI device's base address\n"); - result = -ENODEV; - goto out; + goto err_disable; } - result = pci_request_regions(pdev, DRIVER_NAME); - if (result != 0) { - dev_err(&adapter->pdev->dev, + if (pci_request_regions(pdev, DRIVER_NAME)) { + dev_err(&pdev->dev, "Can't get PCI resources\n"); goto err_disable; } @@ -698,27 +688,26 @@ int __devinit et131x_pci_setup(struct pci_dev *pdev, */ pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM); if (pm_cap == 0) { - dev_err(&adapter->pdev->dev, + dev_err(&pdev->dev, "Cannot find Power Management capabilities\n"); result = -EIO; goto err_release_res; } /* Check the DMA addressing support of this device */ - if (!pci_set_dma_mask(pdev, 0xffffffffffffffffULL)) { + if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { pci_using_dac = true; - result = - pci_set_consistent_dma_mask(pdev, 0xffffffffffffffffULL); + result = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); if (result != 0) { dev_err(&pdev->dev, "Unable to obtain 64 bit DMA for consistent allocations\n"); goto err_release_res; } - } else if (!pci_set_dma_mask(pdev, 0xffffffffULL)) { + } else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { pci_using_dac = false; } else { - dev_err(&adapter->pdev->dev, + dev_err(&pdev->dev, "No usable DMA addressing method\n"); result = -EIO; goto err_release_res; @@ -727,87 +716,22 @@ int __devinit et131x_pci_setup(struct pci_dev *pdev, /* Allocate netdev and private adapter structs */ netdev = et131x_device_alloc(); if (netdev == NULL) { - dev_err(&adapter->pdev->dev, - "Couldn't alloc netdev struct\n"); + dev_err(&pdev->dev, "Couldn't alloc netdev struct\n"); result = -ENOMEM; goto err_release_res; } - - /* Setup the fundamental net_device and private adapter structure elements */ - SET_NETDEV_DEV(netdev, &pdev->dev); - /* - if (pci_using_dac) { - netdev->features |= NETIF_F_HIGHDMA; - } - */ - - /* - * NOTE - Turn this on when we're ready to deal with SG-DMA - * - * NOTE: According to "Linux Device Drivers", 3rd ed, Rubini et al, - * if checksumming is not performed in HW, then the kernel will not - * use SG. - * From pp 510-511: - * - * "Note that the kernel does not perform scatter/gather I/O to your - * device if it does not also provide some form of checksumming as - * well. The reason is that, if the kernel has to make a pass over a - * fragmented ("nonlinear") packet to calculate the checksum, it - * might as well copy the data and coalesce the packet at the same - * time." - * - * This has been verified by setting the flags below and still not - * receiving a scattered buffer from the network stack, so leave it - * off until checksums are calculated in HW. - */ - /* netdev->features |= NETIF_F_SG; */ - /* netdev->features |= NETIF_F_NO_CSUM; */ - /* netdev->features |= NETIF_F_LLTX; */ - - /* Allocate private adapter struct and copy in relevant information */ - adapter = netdev_priv(netdev); - adapter->pdev = pci_dev_get(pdev); - adapter->netdev = netdev; - - /* Do the same for the netdev struct */ - netdev->irq = pdev->irq; - netdev->base_addr = pdev->resource[0].start; - - /* Initialize spinlocks here */ - spin_lock_init(&adapter->Lock); - spin_lock_init(&adapter->TCBSendQLock); - spin_lock_init(&adapter->TCBReadyQLock); - spin_lock_init(&adapter->SendHWLock); - spin_lock_init(&adapter->SendWaitLock); - spin_lock_init(&adapter->RcvLock); - spin_lock_init(&adapter->RcvPendLock); - spin_lock_init(&adapter->FbrLock); - spin_lock_init(&adapter->PHYLock); - - /* Parse configuration parameters into the private adapter struct */ - et131x_config_parse(adapter); - - /* Find the physical adapter - * - * NOTE: This is the equivalent of the MpFindAdapter() routine; can we - * lump it's init with the device specific init below into a - * single init function? - */ - /* while (et131x_find_adapter(adapter, pdev) != 0); */ - et131x_find_adapter(adapter, pdev); + adapter = et131x_adapter_init(netdev, pdev); + /* Initialise the PCI setup for the device */ + et131x_pci_init(adapter, pdev); /* Map the bus-relative registers to system virtual memory */ - - adapter->regs = ioremap_nocache(pci_resource_start(pdev, 0), - pci_resource_len(pdev, 0)); + adapter->regs = pci_ioremap_bar(pdev, 0); if (adapter->regs == NULL) { dev_err(&pdev->dev, "Cannot map device registers\n"); result = -ENOMEM; goto err_free_dev; } - /* Perform device-specific initialization here (See code below) */ - /* If Phy COMA mode was enabled when we went down, disable it here. */ writel(ET_PMCSR_INIT, &adapter->regs->global.pm_csr); @@ -827,20 +751,12 @@ int __devinit et131x_pci_setup(struct pci_dev *pdev, /* Init send data structures */ et131x_init_send(adapter); - /* Register the interrupt - * - * NOTE - This is being done in the open routine, where most other - * Linux drivers setup IRQ handlers. Make sure device - * interrupts are not turned on before the IRQ is registered!! - * - * What we will do here is setup the task structure for the - * ISR's deferred handler + /* + * Set up the task structure for the ISR's deferred handler */ INIT_WORK(&adapter->task, et131x_isr_handler); - /* Determine MAC Address, and copy into the net_device struct */ - et131x_setup_hardware_properties(adapter); - + /* Copy address into the net_device struct */ memcpy(netdev->dev_addr, adapter->CurrentAddress, ETH_ALEN); /* Setup et1310 as per the documentation */ @@ -879,10 +795,7 @@ int __devinit et131x_pci_setup(struct pci_dev *pdev, * been initialized, just in case it needs to be quickly restored. */ pci_set_drvdata(pdev, netdev); - pci_save_state(adapter->pdev); - -out: return result; err_mem_free: @@ -896,7 +809,37 @@ err_release_res: pci_release_regions(pdev); err_disable: pci_disable_device(pdev); - goto out; + return result; +} + +/** + * et131x_pci_remove + * @pdev: a pointer to the device's pci_dev structure + * + * Registered in the pci_driver structure, this function is called when the + * PCI subsystem detects that a PCI device which matches the information + * contained in the pci_device_id table has been removed. + */ + +static void __devexit et131x_pci_remove(struct pci_dev *pdev) +{ + struct net_device *netdev; + struct et131x_adapter *adapter; + + /* Retrieve the net_device pointer from the pci_dev struct, as well + * as the private adapter struct + */ + netdev = (struct net_device *) pci_get_drvdata(pdev); + adapter = netdev_priv(netdev); + + /* Perform device cleanup */ + unregister_netdev(netdev); + et131x_adapter_memory_free(adapter); + iounmap(adapter->regs); + pci_dev_put(adapter->pdev); + free_netdev(netdev); + pci_release_regions(pdev); + pci_disable_device(pdev); } static struct pci_device_id et131x_pci_table[] __devinitdata = { @@ -945,7 +888,6 @@ static void __exit et131x_cleanup_module(void) module_init(et131x_init_module); module_exit(et131x_cleanup_module); - /* Modinfo parameters (filled out using defines from et131x_version.h) */ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_INFO); diff --git a/drivers/staging/et131x/et131x_initpci.h b/drivers/staging/et131x/et131x_initpci.h index 8131d6a65c2a..7269569a874b 100644 --- a/drivers/staging/et131x/et131x_initpci.h +++ b/drivers/staging/et131x/et131x_initpci.h @@ -67,7 +67,7 @@ void et131x_align_allocated_memory(struct et131x_adapter *adapter, int et131x_adapter_setup(struct et131x_adapter *adapter); int et131x_adapter_memory_alloc(struct et131x_adapter *adapter); void et131x_adapter_memory_free(struct et131x_adapter *adapter); -void et131x_setup_hardware_properties(struct et131x_adapter *adapter); +void et131x_hwaddr_init(struct et131x_adapter *adapter); void et131x_soft_reset(struct et131x_adapter *adapter); #endif /* __ET131X_INITPCI_H__ */ diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c index 8c7612f63f91..8d84286fb6b1 100644 --- a/drivers/staging/et131x/et131x_netdev.c +++ b/drivers/staging/et131x/et131x_netdev.c @@ -622,7 +622,7 @@ int et131x_change_mtu(struct net_device *netdev, int new_mtu) et131x_init_send(adapter); - et131x_setup_hardware_properties(adapter); + et131x_hwaddr_init(adapter); memcpy(netdev->dev_addr, adapter->CurrentAddress, ETH_ALEN); /* Init the device with the new settings */ @@ -709,9 +709,7 @@ int et131x_set_mac_addr(struct net_device *netdev, void *new_mac) et131x_init_send(adapter); - et131x_setup_hardware_properties(adapter); - /* memcpy( netdev->dev_addr, adapter->CurrentAddress, ETH_ALEN ); */ - /* blux: no, do not override our nice address */ + et131x_hwaddr_init(adapter); /* Init the device with the new settings */ et131x_adapter_setup(adapter); -- GitLab From abc449970a0016bf19e920c0666a89b2c7b57a24 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:47:48 +0100 Subject: [PATCH 097/235] Staging: et131x: kill NMI hacks The NMI code is in the shipped driver for "validation". We won't be doing chip validation and we have proper core nmi handling so this can go. Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et131x_adapter.h | 1 - drivers/staging/et131x/et131x_defs.h | 1 - drivers/staging/et131x/et131x_initpci.c | 28 ------------------------- 3 files changed, 30 deletions(-) diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h index 83ddcd503ebd..bd53cb9dacac 100644 --- a/drivers/staging/et131x/et131x_adapter.h +++ b/drivers/staging/et131x/et131x_adapter.h @@ -235,7 +235,6 @@ struct et131x_adapter { u32 RegistryJumboPacket; /* Max supported ethernet packet size */ /* Validation helpers */ - u8 RegistryNMIDisable; u8 RegistryPhyLoopbk; /* Enable Phy loopback */ /* Derived from the registry: */ diff --git a/drivers/staging/et131x/et131x_defs.h b/drivers/staging/et131x/et131x_defs.h index f98dca5fd26b..d81fc77a501f 100644 --- a/drivers/staging/et131x/et131x_defs.h +++ b/drivers/staging/et131x/et131x_defs.h @@ -102,7 +102,6 @@ /* Some offsets in PCI config space that are actually used. */ #define ET1310_PCI_MAX_PYLD 0x4C -#define ET1310_NMI_DISABLE 0x61 #define ET1310_PCI_MAC_ADDRESS 0xA4 #define ET1310_PCI_EEPROM_STATUS 0xB2 #define ET1310_PCI_ACK_NACK 0xC0 diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c index 7b1e912f3ab2..db1ce58ba6a7 100644 --- a/drivers/staging/et131x/et131x_initpci.c +++ b/drivers/staging/et131x/et131x_initpci.c @@ -106,17 +106,6 @@ #define PARM_SPEED_DUPLEX_MIN 0 #define PARM_SPEED_DUPLEX_MAX 5 -/* Module parameter for disabling NMI - * et131x_nmi_disable : - * Disable NMI (0-2) [0] - * 0 : - * 1 : - * 2 : - */ -static u32 et131x_nmi_disable; /* 0-2 */ -module_param(et131x_nmi_disable, uint, 0); -MODULE_PARM_DESC(et131x_nmi_disable, "Disable NMI (0-2) [0]"); - /* Module parameter for manual speed setting * Set Link speed and dublex manually (0-5) [0] * 1 : 10Mb Half-Duplex @@ -187,21 +176,6 @@ static int et131x_pci_init(struct et131x_adapter *adapter, u8 max_payload; u8 read_size_reg; - /* Allow disabling of Non-Maskable Interrupts in I/O space, to - * support validation. - */ - if (adapter->RegistryNMIDisable) { - uint8_t RegisterVal; - - RegisterVal = inb(ET1310_NMI_DISABLE); - RegisterVal &= 0xf3; - - if (adapter->RegistryNMIDisable == 2) - RegisterVal |= 0xc; - - outb(ET1310_NMI_DISABLE, RegisterVal); - } - if (et131x_init_eeprom(adapter) < 0) return -EIO; @@ -613,8 +587,6 @@ static struct et131x_adapter *et131x_adapter_init(struct net_device *netdev, etdev->SpeedDuplex = et131x_speed_set; etdev->RegistryJumboPacket = 1514; /* 1514-9216 */ - etdev->RegistryNMIDisable = et131x_nmi_disable; - /* Set the MAC address to a default */ memcpy(etdev->CurrentAddress, default_mac, ETH_ALEN); -- GitLab From 5f1377d42bb89988fd9c86a92d1985320ff5053e Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:47:55 +0100 Subject: [PATCH 098/235] Staging: et131x: PHY loopback cannot be set (and isn't useful for us anyway) Remove the stuff that falls out from this always being zero. Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_mac.c | 9 +--- drivers/staging/et131x/et1310_phy.c | 10 +--- drivers/staging/et131x/et1310_rx.c | 51 +++++++++---------- drivers/staging/et131x/et1310_tx.c | 15 ++---- drivers/staging/et131x/et131x_adapter.h | 2 - drivers/staging/et131x/et131x_initpci.c | 66 +++++++++---------------- 6 files changed, 56 insertions(+), 97 deletions(-) diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c index f81e1cba8547..35e1bcf961bf 100644 --- a/drivers/staging/et131x/et1310_mac.c +++ b/drivers/staging/et131x/et1310_mac.c @@ -221,13 +221,8 @@ void ConfigMACRegs2(struct et131x_adapter *etdev) */ cfg2.bits.len_check = 0x1; - if (etdev->RegistryPhyLoopbk == false) { - cfg2.bits.pad_crc = 0x1; - cfg2.bits.crc_enable = 0x1; - } else { - cfg2.bits.pad_crc = 0; - cfg2.bits.crc_enable = 0; - } + cfg2.bits.pad_crc = 0x1; + cfg2.bits.crc_enable = 0x1; /* 1 - full duplex, 0 - half-duplex */ cfg2.bits.full_duplex = etdev->duplex_mode; diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c index dd199bdb9eff..bdd16215dc12 100644 --- a/drivers/staging/et131x/et1310_phy.c +++ b/drivers/staging/et131x/et1310_phy.c @@ -469,9 +469,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev, spin_unlock_irqrestore(&etdev->Lock, flags); - /* Don't indicate state if we're in loopback mode */ - if (etdev->RegistryPhyLoopbk == false) - netif_carrier_on(etdev->netdev); + netif_carrier_on(etdev->netdev); } else { dev_warn(&etdev->pdev->dev, "Link down - cable problem ?\n"); @@ -504,11 +502,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev, spin_unlock_irqrestore(&etdev->Lock, flags); - /* Only indicate state if we're in loopback - * mode - */ - if (etdev->RegistryPhyLoopbk == false) - netif_carrier_off(etdev->netdev); + netif_carrier_off(etdev->netdev); } etdev->linkspeed = 0; diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c index 10e21db57ac3..c0695b041f30 100644 --- a/drivers/staging/et131x/et1310_rx.c +++ b/drivers/staging/et131x/et1310_rx.c @@ -807,40 +807,35 @@ void et131x_rx_dma_disable(struct et131x_adapter *etdev) */ void et131x_rx_dma_enable(struct et131x_adapter *etdev) { - if (etdev->RegistryPhyLoopbk) - /* RxDMA is disabled for loopback operation. */ - writel(0x1, &etdev->regs->rxdma.csr.value); - else { /* Setup the receive dma configuration register for normal operation */ - RXDMA_CSR_t csr = { 0 }; - - csr.bits.fbr1_enable = 1; - if (etdev->RxRing.Fbr1BufferSize == 4096) - csr.bits.fbr1_size = 1; - else if (etdev->RxRing.Fbr1BufferSize == 8192) - csr.bits.fbr1_size = 2; - else if (etdev->RxRing.Fbr1BufferSize == 16384) - csr.bits.fbr1_size = 3; + RXDMA_CSR_t csr = { 0 }; + + csr.bits.fbr1_enable = 1; + if (etdev->RxRing.Fbr1BufferSize == 4096) + csr.bits.fbr1_size = 1; + else if (etdev->RxRing.Fbr1BufferSize == 8192) + csr.bits.fbr1_size = 2; + else if (etdev->RxRing.Fbr1BufferSize == 16384) + csr.bits.fbr1_size = 3; #ifdef USE_FBR0 - csr.bits.fbr0_enable = 1; - if (etdev->RxRing.Fbr0BufferSize == 256) - csr.bits.fbr0_size = 1; - else if (etdev->RxRing.Fbr0BufferSize == 512) - csr.bits.fbr0_size = 2; - else if (etdev->RxRing.Fbr0BufferSize == 1024) - csr.bits.fbr0_size = 3; + csr.bits.fbr0_enable = 1; + if (etdev->RxRing.Fbr0BufferSize == 256) + csr.bits.fbr0_size = 1; + else if (etdev->RxRing.Fbr0BufferSize == 512) + csr.bits.fbr0_size = 2; + else if (etdev->RxRing.Fbr0BufferSize == 1024) + csr.bits.fbr0_size = 3; #endif - writel(csr.value, &etdev->regs->rxdma.csr.value); + writel(csr.value, &etdev->regs->rxdma.csr.value); + csr.value = readl(&etdev->regs->rxdma.csr.value); + if (csr.bits.halt_status != 0) { + udelay(5); csr.value = readl(&etdev->regs->rxdma.csr.value); if (csr.bits.halt_status != 0) { - udelay(5); - csr.value = readl(&etdev->regs->rxdma.csr.value); - if (csr.bits.halt_status != 0) { - dev_err(&etdev->pdev->dev, - "RX Dma failed to exit halt state. CSR 0x%08x\n", - csr.value); - } + dev_err(&etdev->pdev->dev, + "RX Dma failed to exit halt state. CSR 0x%08x\n", + csr.value); } } } diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c index b19d5069a033..f4812a8ba37a 100644 --- a/drivers/staging/et131x/et1310_tx.c +++ b/drivers/staging/et131x/et1310_tx.c @@ -279,16 +279,11 @@ void et131x_tx_dma_disable(struct et131x_adapter *etdev) */ void et131x_tx_dma_enable(struct et131x_adapter *etdev) { - u32 csr = ET_TXDMA_SNGL_EPKT; - if (etdev->RegistryPhyLoopbk) - /* TxDMA is disabled for loopback operation. */ - csr |= ET_TXDMA_CSR_HALT; - else - /* Setup the transmit dma configuration register for normal - * operation - */ - csr |= PARM_DMA_CACHE_DEF << ET_TXDMA_CACHE_SHIFT; - writel(csr, &etdev->regs->txdma.csr); + /* Setup the transmit dma configuration register for normal + * operation + */ + writel(ET_TXDMA_SNGL_EPKT|(PARM_DMA_CACHE_DEF << ET_TXDMA_CACHE_SHIFT), + &etdev->regs->txdma.csr); } /** diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h index bd53cb9dacac..2a213ac1c78f 100644 --- a/drivers/staging/et131x/et131x_adapter.h +++ b/drivers/staging/et131x/et131x_adapter.h @@ -234,8 +234,6 @@ struct et131x_adapter { u32 RegistryRxMemEnd; /* Size of internal rx memory */ u32 RegistryJumboPacket; /* Max supported ethernet packet size */ - /* Validation helpers */ - u8 RegistryPhyLoopbk; /* Enable Phy loopback */ /* Derived from the registry: */ u8 AiForceDpx; /* duplex setting */ diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c index db1ce58ba6a7..b76fa73395e8 100644 --- a/drivers/staging/et131x/et131x_initpci.c +++ b/drivers/staging/et131x/et131x_initpci.c @@ -329,52 +329,34 @@ void ConfigGlobalRegs(struct et131x_adapter *etdev) { struct _GLOBAL_t __iomem *regs = &etdev->regs->global; - if (etdev->RegistryPhyLoopbk == false) { - if (etdev->RegistryJumboPacket < 2048) { - /* Tx / RxDMA and Tx/Rx MAC interfaces have a 1k word - * block of RAM that the driver can split between Tx - * and Rx as it desires. Our default is to split it - * 50/50: - */ - writel(0, ®s->rxq_start_addr); - writel(PARM_RX_MEM_END_DEF, ®s->rxq_end_addr); - writel(PARM_RX_MEM_END_DEF + 1, ®s->txq_start_addr); - writel(INTERNAL_MEM_SIZE - 1, ®s->txq_end_addr); - } else if (etdev->RegistryJumboPacket < 8192) { - /* For jumbo packets > 2k but < 8k, split 50-50. */ - writel(0, ®s->rxq_start_addr); - writel(INTERNAL_MEM_RX_OFFSET, ®s->rxq_end_addr); - writel(INTERNAL_MEM_RX_OFFSET + 1, ®s->txq_start_addr); - writel(INTERNAL_MEM_SIZE - 1, ®s->txq_end_addr); - } else { - /* 9216 is the only packet size greater than 8k that - * is available. The Tx buffer has to be big enough - * for one whole packet on the Tx side. We'll make - * the Tx 9408, and give the rest to Rx - */ - writel(0x0000, ®s->rxq_start_addr); - writel(0x01b3, ®s->rxq_end_addr); - writel(0x01b4, ®s->txq_start_addr); - writel(INTERNAL_MEM_SIZE - 1,®s->txq_end_addr); - } - - /* Initialize the loopback register. Disable all loopbacks. */ - writel(0, ®s->loopback); + writel(0, ®s->rxq_start_addr); + writel(INTERNAL_MEM_SIZE - 1, ®s->txq_end_addr); + + if (etdev->RegistryJumboPacket < 2048) { + /* Tx / RxDMA and Tx/Rx MAC interfaces have a 1k word + * block of RAM that the driver can split between Tx + * and Rx as it desires. Our default is to split it + * 50/50: + */ + writel(PARM_RX_MEM_END_DEF, ®s->rxq_end_addr); + writel(PARM_RX_MEM_END_DEF + 1, ®s->txq_start_addr); + } else if (etdev->RegistryJumboPacket < 8192) { + /* For jumbo packets > 2k but < 8k, split 50-50. */ + writel(INTERNAL_MEM_RX_OFFSET, ®s->rxq_end_addr); + writel(INTERNAL_MEM_RX_OFFSET + 1, ®s->txq_start_addr); } else { - /* For PHY Line loopback, the memory is configured as if Tx - * and Rx both have all the memory. This is because the - * RxMAC will write data into the space, and the TxMAC will - * read it out. + /* 9216 is the only packet size greater than 8k that + * is available. The Tx buffer has to be big enough + * for one whole packet on the Tx side. We'll make + * the Tx 9408, and give the rest to Rx */ - writel(0, ®s->rxq_start_addr); - writel(INTERNAL_MEM_SIZE - 1, ®s->rxq_end_addr); - writel(0, ®s->txq_start_addr); - writel(INTERNAL_MEM_SIZE - 1, ®s->txq_end_addr); - - /* Initialize the loopback register (MAC loopback). */ - writel(ET_LOOP_MAC, ®s->loopback); + writel(0x01b3, ®s->rxq_end_addr); + writel(0x01b4, ®s->txq_start_addr); } + /* Initialize the loopback register. Disable all loopbacks. */ + writel(0, ®s->loopback); + /* MSI Register */ writel(0, ®s->msi_config); -- GitLab From 10643efffaef252da174bb0cf2e78b201ea1856d Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:48:02 +0100 Subject: [PATCH 099/235] Staging: et131x: rxstat is not used Turn it into a u32 and document the fields in a comment instead Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_rx.h | 36 +++++++++++------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/drivers/staging/et131x/et1310_rx.h b/drivers/staging/et131x/et1310_rx.h index 72a522985270..b02fac8cd3cd 100644 --- a/drivers/staging/et131x/et1310_rx.h +++ b/drivers/staging/et131x/et1310_rx.h @@ -209,36 +209,26 @@ typedef struct _PKT_STAT_DESC_t { /* Typedefs for the RX DMA status word */ /* - * RXSTAT_WORD0_t structure holds part of the status bits of the Rx DMA engine + * rx status word 0 holds part of the status bits of the Rx DMA engine * that get copied out to memory by the ET-1310. Word 0 is a 32 bit word - * whichcontains Free Buffer ring 0 and 1 available offset. + * which contains the Free Buffer ring 0 and 1 available offset. + * + * bit 0-9 FBR1 offset + * bit 10 Wrap flag for FBR1 + * bit 16-25 FBR0 offset + * bit 26 Wrap flag for FBR0 */ -typedef union _rxstat_word0_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 FBR1unused:5; /* bits 27-31 */ - u32 FBR1wrap:1; /* bit 26 */ - u32 FBR1offset:10; /* bits 16-25 */ - u32 FBR0unused:5; /* bits 11-15 */ - u32 FBR0wrap:1; /* bit 10 */ - u32 FBR0offset:10; /* bits 0-9 */ -#else - u32 FBR0offset:10; /* bits 0-9 */ - u32 FBR0wrap:1; /* bit 10 */ - u32 FBR0unused:5; /* bits 11-15 */ - u32 FBR1offset:10; /* bits 16-25 */ - u32 FBR1wrap:1; /* bit 26 */ - u32 FBR1unused:5; /* bits 27-31 */ -#endif - } bits; -} RXSTAT_WORD0_t, *PRXSTAT_WORD0_t; /* * RXSTAT_WORD1_t structure holds part of the status bits of the Rx DMA engine * that get copied out to memory by the ET-1310. Word 3 is a 32 bit word * which contains the Packet Status Ring available offset. */ + +#define RXSTAT1_OFFSET 16 +#define RXSTAT1_MASK 0xFFF +#define RXSTAT1_WRAP 0x10000000 + typedef union _rxstat_word1_t { u32 value; struct { @@ -261,7 +251,7 @@ typedef union _rxstat_word1_t { * it sits in free memory, and is pointed to by 0x101c / 0x1020 */ typedef struct _rx_status_block_t { - RXSTAT_WORD0_t Word0; + u32 Word0; RXSTAT_WORD1_t Word1; } RX_STATUS_BLOCK_t, *PRX_STATUS_BLOCK_t; -- GitLab From b44207ab43e052aa26b47ea829d46d3a8520d2d2 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:48:16 +0100 Subject: [PATCH 100/235] Staging: et131x: clean up word 3 definition This is basically not really used so turn it into a u32 and comment the format for reference Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_tx.c | 12 +++--- drivers/staging/et131x/et1310_tx.h | 62 +++++++++--------------------- 2 files changed, 25 insertions(+), 49 deletions(-) diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c index f4812a8ba37a..5938dfa539a3 100644 --- a/drivers/staging/et131x/et1310_tx.c +++ b/drivers/staging/et131x/et1310_tx.c @@ -603,16 +603,16 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) { if (++etdev->TxRing.TxPacketsSinceLastinterrupt == PARM_TX_NUM_BUFS_DEF) { - CurDesc[FragmentNumber - 1].word3.value = 0x5; + /* Last element & Interrupt flag */ + CurDesc[FragmentNumber - 1].word3 = 0x5; etdev->TxRing.TxPacketsSinceLastinterrupt = 0; - } else { - CurDesc[FragmentNumber - 1].word3.value = 0x1; + } else { /* Last element */ + CurDesc[FragmentNumber - 1].word3 = 0x1; } } else { - CurDesc[FragmentNumber - 1].word3.value = 0x5; + CurDesc[FragmentNumber - 1].word3 = 0x5; } - - CurDesc[0].word3.bits.f = 1; + CurDesc[0].word3 |= 2; /* First element flag */ pMpTcb->WrIndexStart = etdev->TxRing.txDmaReadyToSend; pMpTcb->PacketStaleCount = 0; diff --git a/drivers/staging/et131x/et1310_tx.h b/drivers/staging/et131x/et1310_tx.h index ad0372121de0..142b6ea86060 100644 --- a/drivers/staging/et131x/et1310_tx.h +++ b/drivers/staging/et131x/et1310_tx.h @@ -84,56 +84,32 @@ typedef union _txdesc_word2_t { } TXDESC_WORD2_t, *PTXDESC_WORD2_t; /* - * TXDESC_WORD3_t structure holds part of the control bits in the Tx Descriptor - * ring for the ET-1310 + * word 3 of the control bits in the Tx Descriptor ring for the + * ET-1310 + * + * 0: last packet in the sequence + * 1: first packet in the sequence + * 2: interrupt the processor when this pkt sent + * 3: Control word - no packet data + * 4: Issue half-duplex backpressure : XON/XOFF + * 5: send pause frame + * 6: Tx frame has error + * 7: append CRC + * 8: MAC override + * 9: pad packet + * 10: Packet is a Huge packet + * 11: append VLAN tag + * 12: IP checksum assist + * 13: TCP checksum assist + * 14: UDP checksum assist */ -typedef union _txdesc_word3_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 unused:17; /* bits 15-31 */ - u32 udpa:1; /* bit 14(UDP checksum assist) */ - u32 tcpa:1; /* bit 13(TCP checksum assist) */ - u32 ipa:1; /* bit 12(IP checksum assist) */ - u32 vlan:1; /* bit 11(append VLAN tag) */ - u32 hp:1; /* bit 10(Packet is a Huge packet) */ - u32 pp:1; /* bit 9(pad packet) */ - u32 mac:1; /* bit 8(MAC override) */ - u32 crc:1; /* bit 7(append CRC) */ - u32 e:1; /* bit 6(Tx frame has error) */ - u32 pf:1; /* bit 5(send pause frame) */ - u32 bp:1; /* bit 4(Issue half-duplex backpressure (XON/XOFF) */ - u32 cw:1; /* bit 3(Control word - no packet data) */ - u32 ir:1; /* bit 2(interrupt the processor when this pkt sent) */ - u32 f:1; /* bit 1(first packet in the sequence) */ - u32 l:1; /* bit 0(last packet in the sequence) */ -#else - u32 l:1; /* bit 0(last packet in the sequence) */ - u32 f:1; /* bit 1(first packet in the sequence) */ - u32 ir:1; /* bit 2(interrupt the processor when this pkt sent) */ - u32 cw:1; /* bit 3(Control word - no packet data) */ - u32 bp:1; /* bit 4(Issue half-duplex backpressure (XON/XOFF) */ - u32 pf:1; /* bit 5(send pause frame) */ - u32 e:1; /* bit 6(Tx frame has error) */ - u32 crc:1; /* bit 7(append CRC) */ - u32 mac:1; /* bit 8(MAC override) */ - u32 pp:1; /* bit 9(pad packet) */ - u32 hp:1; /* bit 10(Packet is a Huge packet) */ - u32 vlan:1; /* bit 11(append VLAN tag) */ - u32 ipa:1; /* bit 12(IP checksum assist) */ - u32 tcpa:1; /* bit 13(TCP checksum assist) */ - u32 udpa:1; /* bit 14(UDP checksum assist) */ - u32 unused:17; /* bits 15-31 */ -#endif /* _BIT_FIELDS_HTOL */ - } bits; -} TXDESC_WORD3_t, *PTXDESC_WORD3_t; /* TX_DESC_ENTRY_t is sructure representing each descriptor on the ring */ typedef struct _tx_desc_entry_t { u32 DataBufferPtrHigh; u32 DataBufferPtrLow; TXDESC_WORD2_t word2; /* control words how to xmit the */ - TXDESC_WORD3_t word3; /* data (detailed above) */ + u32 word3; /* data (detailed above) */ } TX_DESC_ENTRY_t, *PTX_DESC_ENTRY_t; -- GitLab From fb70ed67107e04005d36f6f462bb048bf9cbe373 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:48:25 +0100 Subject: [PATCH 101/235] Staging: et131x: clean up WORD2 usage A little more complex but again move the structure and typedef into into the documentation Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_tx.c | 23 ++++++++++----------- drivers/staging/et131x/et1310_tx.h | 33 ++++++++---------------------- 2 files changed, 20 insertions(+), 36 deletions(-) diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c index 5938dfa539a3..7926004172d3 100644 --- a/drivers/staging/et131x/et1310_tx.c +++ b/drivers/staging/et131x/et1310_tx.c @@ -516,9 +516,10 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) */ if ((pPacket->len - pPacket->data_len) <= 1514) { CurDesc[FragmentNumber].DataBufferPtrHigh = 0; - CurDesc[FragmentNumber].word2.bits. - length_in_bytes = - pPacket->len - pPacket->data_len; + /* Low 16bits are length, high is vlan and + unused currently so zero */ + CurDesc[FragmentNumber].word2 = + pPacket->len - pPacket->data_len; /* NOTE: Here, the dma_addr_t returned from * pci_map_single() is implicitly cast as a @@ -536,9 +537,8 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) PCI_DMA_TODEVICE); } else { CurDesc[FragmentNumber].DataBufferPtrHigh = 0; - CurDesc[FragmentNumber].word2.bits. - length_in_bytes = - ((pPacket->len - pPacket->data_len) / 2); + CurDesc[FragmentNumber].word2 = + (pPacket->len - pPacket->data_len) / 2; /* NOTE: Here, the dma_addr_t returned from * pci_map_single() is implicitly cast as a @@ -556,9 +556,8 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) PCI_DMA_TODEVICE); CurDesc[FragmentNumber].DataBufferPtrHigh = 0; - CurDesc[FragmentNumber].word2.bits. - length_in_bytes = - ((pPacket->len - pPacket->data_len) / 2); + CurDesc[FragmentNumber].word2 = + (pPacket->len - pPacket->data_len) / 2; /* NOTE: Here, the dma_addr_t returned from * pci_map_single() is implicitly cast as a @@ -579,8 +578,8 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) } } else { CurDesc[FragmentNumber].DataBufferPtrHigh = 0; - CurDesc[FragmentNumber].word2.bits.length_in_bytes = - pFragList[loopIndex - 1].size; + CurDesc[FragmentNumber].word2 = + pFragList[loopIndex - 1].size; /* NOTE: Here, the dma_addr_t returned from * pci_map_page() is implicitly cast as a uint32_t. @@ -724,7 +723,7 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev, pci_unmap_single(etdev->pdev, desc->DataBufferPtrLow, - desc->word2.value, PCI_DMA_TODEVICE); + desc->word2, PCI_DMA_TODEVICE); add_10bit(&pMpTcb->WrIndexStart, 1); if (INDEX10(pMpTcb->WrIndexStart) >= diff --git a/drivers/staging/et131x/et1310_tx.h b/drivers/staging/et131x/et1310_tx.h index 142b6ea86060..e2e131413cf1 100644 --- a/drivers/staging/et131x/et1310_tx.h +++ b/drivers/staging/et131x/et1310_tx.h @@ -63,29 +63,14 @@ /* Typedefs for Tx Descriptor Ring */ /* - * TXDESC_WORD2_t structure holds part of the control bits in the Tx Descriptor - * ring for the ET-1310 - */ -typedef union _txdesc_word2_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 vlan_prio:3; /* bits 29-31(VLAN priority) */ - u32 vlan_cfi:1; /* bit 28(cfi) */ - u32 vlan_tag:12; /* bits 16-27(VLAN tag) */ - u32 length_in_bytes:16; /* bits 0-15(packet length) */ -#else - u32 length_in_bytes:16; /* bits 0-15(packet length) */ - u32 vlan_tag:12; /* bits 16-27(VLAN tag) */ - u32 vlan_cfi:1; /* bit 28(cfi) */ - u32 vlan_prio:3; /* bits 29-31(VLAN priority) */ -#endif /* _BIT_FIELDS_HTOL */ - } bits; -} TXDESC_WORD2_t, *PTXDESC_WORD2_t; - -/* - * word 3 of the control bits in the Tx Descriptor ring for the - * ET-1310 + * word 2 of the control bits in the Tx Descriptor ring for the ET-1310 + * + * 0-15: length of packet + * 16-27: VLAN tag + * 28: VLAN CFI + * 29-31: VLAN priority + * + * word 3 of the control bits in the Tx Descriptor ring for the ET-1310 * * 0: last packet in the sequence * 1: first packet in the sequence @@ -108,7 +93,7 @@ typedef union _txdesc_word2_t { typedef struct _tx_desc_entry_t { u32 DataBufferPtrHigh; u32 DataBufferPtrLow; - TXDESC_WORD2_t word2; /* control words how to xmit the */ + u32 word2; /* control words how to xmit the */ u32 word3; /* data (detailed above) */ } TX_DESC_ENTRY_t, *PTX_DESC_ENTRY_t; -- GitLab From b711b2e0fa6589f22ba53464bc1b49e4702eda5b Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:48:33 +0100 Subject: [PATCH 102/235] Staging: et131x: tidy up names for the TX structures Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_tx.c | 456 ++++++++++++------------ drivers/staging/et131x/et1310_tx.h | 51 ++- drivers/staging/et131x/et131x_adapter.h | 6 +- drivers/staging/et131x/et131x_isr.c | 12 +- drivers/staging/et131x/et131x_netdev.c | 28 +- 5 files changed, 275 insertions(+), 278 deletions(-) diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c index 7926004172d3..8beb029fab1c 100644 --- a/drivers/staging/et131x/et1310_tx.c +++ b/drivers/staging/et131x/et1310_tx.c @@ -97,10 +97,10 @@ static void et131x_update_tcb_list(struct et131x_adapter *etdev); static void et131x_check_send_wait_list(struct et131x_adapter *etdev); static inline void et131x_free_send_packet(struct et131x_adapter *etdev, - PMP_TCB pMpTcb); + struct tcb *tcb); static int et131x_send_packet(struct sk_buff *skb, struct et131x_adapter *etdev); -static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb); +static int nic_send_packet(struct et131x_adapter *etdev, struct tcb *tcb); /** * et131x_tx_dma_memory_alloc @@ -117,12 +117,12 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb); int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter) { int desc_size = 0; - TX_RING_t *tx_ring = &adapter->TxRing; + struct tx_ring *tx_ring = &adapter->tx_ring; /* Allocate memory for the TCB's (Transmit Control Block) */ - adapter->TxRing.MpTcbMem = (MP_TCB *)kcalloc(NUM_TCB, sizeof(MP_TCB), - GFP_ATOMIC | GFP_DMA); - if (!adapter->TxRing.MpTcbMem) { + adapter->tx_ring.MpTcbMem = (struct tcb *) + kcalloc(NUM_TCB, sizeof(struct tcb), GFP_ATOMIC | GFP_DMA); + if (!adapter->tx_ring.MpTcbMem) { dev_err(&adapter->pdev->dev, "Cannot alloc memory for TCBs\n"); return -ENOMEM; } @@ -130,11 +130,11 @@ int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter) /* Allocate enough memory for the Tx descriptor ring, and allocate * some extra so that the ring can be aligned on a 4k boundary. */ - desc_size = (sizeof(TX_DESC_ENTRY_t) * NUM_DESC_PER_RING_TX) + 4096 - 1; - tx_ring->pTxDescRingVa = - (PTX_DESC_ENTRY_t) pci_alloc_consistent(adapter->pdev, desc_size, - &tx_ring->pTxDescRingPa); - if (!adapter->TxRing.pTxDescRingVa) { + desc_size = (sizeof(struct tx_desc) * NUM_DESC_PER_RING_TX) + 4096 - 1; + tx_ring->tx_desc_ring = + (struct tx_desc *) pci_alloc_consistent(adapter->pdev, desc_size, + &tx_ring->tx_desc_ring_pa); + if (!adapter->tx_ring.tx_desc_ring) { dev_err(&adapter->pdev->dev, "Cannot alloc memory for Tx Ring\n"); return -ENOMEM; } @@ -146,20 +146,20 @@ int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter) * are ever returned, make sure the high part is retrieved here before * storing the adjusted address. */ - tx_ring->pTxDescRingAdjustedPa = tx_ring->pTxDescRingPa; + tx_ring->pTxDescRingAdjustedPa = tx_ring->tx_desc_ring_pa; /* Align Tx Descriptor Ring on a 4k (0x1000) byte boundary */ et131x_align_allocated_memory(adapter, &tx_ring->pTxDescRingAdjustedPa, &tx_ring->TxDescOffset, 0x0FFF); - tx_ring->pTxDescRingVa += tx_ring->TxDescOffset; + tx_ring->tx_desc_ring += tx_ring->TxDescOffset; /* Allocate memory for the Tx status block */ tx_ring->pTxStatusVa = pci_alloc_consistent(adapter->pdev, sizeof(TX_STATUS_BLOCK_t), &tx_ring->pTxStatusPa); - if (!adapter->TxRing.pTxStatusPa) { + if (!adapter->tx_ring.pTxStatusPa) { dev_err(&adapter->pdev->dev, "Cannot alloc memory for Tx status block\n"); return -ENOMEM; @@ -169,7 +169,7 @@ int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter) tx_ring->pTxDummyBlkVa = pci_alloc_consistent(adapter->pdev, NIC_MIN_PACKET_SIZE, &tx_ring->pTxDummyBlkPa); - if (!adapter->TxRing.pTxDummyBlkPa) { + if (!adapter->tx_ring.pTxDummyBlkPa) { dev_err(&adapter->pdev->dev, "Cannot alloc memory for Tx dummy buffer\n"); return -ENOMEM; @@ -188,43 +188,43 @@ void et131x_tx_dma_memory_free(struct et131x_adapter *adapter) { int desc_size = 0; - if (adapter->TxRing.pTxDescRingVa) { + if (adapter->tx_ring.tx_desc_ring) { /* Free memory relating to Tx rings here */ - adapter->TxRing.pTxDescRingVa -= adapter->TxRing.TxDescOffset; + adapter->tx_ring.tx_desc_ring -= adapter->tx_ring.TxDescOffset; - desc_size = - (sizeof(TX_DESC_ENTRY_t) * NUM_DESC_PER_RING_TX) + 4096 - 1; + desc_size = (sizeof(struct tx_desc) * NUM_DESC_PER_RING_TX) + + 4096 - 1; pci_free_consistent(adapter->pdev, desc_size, - adapter->TxRing.pTxDescRingVa, - adapter->TxRing.pTxDescRingPa); + adapter->tx_ring.tx_desc_ring, + adapter->tx_ring.tx_desc_ring_pa); - adapter->TxRing.pTxDescRingVa = NULL; + adapter->tx_ring.tx_desc_ring = NULL; } /* Free memory for the Tx status block */ - if (adapter->TxRing.pTxStatusVa) { + if (adapter->tx_ring.pTxStatusVa) { pci_free_consistent(adapter->pdev, sizeof(TX_STATUS_BLOCK_t), - adapter->TxRing.pTxStatusVa, - adapter->TxRing.pTxStatusPa); + adapter->tx_ring.pTxStatusVa, + adapter->tx_ring.pTxStatusPa); - adapter->TxRing.pTxStatusVa = NULL; + adapter->tx_ring.pTxStatusVa = NULL; } /* Free memory for the dummy buffer */ - if (adapter->TxRing.pTxDummyBlkVa) { + if (adapter->tx_ring.pTxDummyBlkVa) { pci_free_consistent(adapter->pdev, NIC_MIN_PACKET_SIZE, - adapter->TxRing.pTxDummyBlkVa, - adapter->TxRing.pTxDummyBlkPa); + adapter->tx_ring.pTxDummyBlkVa, + adapter->tx_ring.pTxDummyBlkPa); - adapter->TxRing.pTxDummyBlkVa = NULL; + adapter->tx_ring.pTxDummyBlkVa = NULL; } - /* Free the memory for MP_TCB structures */ - kfree(adapter->TxRing.MpTcbMem); + /* Free the memory for the tcb structures */ + kfree(adapter->tx_ring.MpTcbMem); } /** @@ -236,9 +236,9 @@ void ConfigTxDmaRegs(struct et131x_adapter *etdev) struct _TXDMA_t __iomem *txdma = &etdev->regs->txdma; /* Load the hardware with the start of the transmit descriptor ring. */ - writel((uint32_t) (etdev->TxRing.pTxDescRingAdjustedPa >> 32), + writel((u32) (etdev->tx_ring.pTxDescRingAdjustedPa >> 32), &txdma->pr_base_hi); - writel((uint32_t) etdev->TxRing.pTxDescRingAdjustedPa, + writel((u32) etdev->tx_ring.pTxDescRingAdjustedPa, &txdma->pr_base_lo); /* Initialise the transmit DMA engine */ @@ -252,12 +252,12 @@ void ConfigTxDmaRegs(struct et131x_adapter *etdev) * storing the adjusted address. */ writel(0, &txdma->dma_wb_base_hi); - writel(etdev->TxRing.pTxStatusPa, &txdma->dma_wb_base_lo); + writel(etdev->tx_ring.pTxStatusPa, &txdma->dma_wb_base_lo); - memset(etdev->TxRing.pTxStatusVa, 0, sizeof(TX_STATUS_BLOCK_t)); + memset(etdev->tx_ring.pTxStatusVa, 0, sizeof(TX_STATUS_BLOCK_t)); writel(0, &txdma->service_request); - etdev->TxRing.txDmaReadyToSend = 0; + etdev->tx_ring.txDmaReadyToSend = 0; } /** @@ -292,39 +292,39 @@ void et131x_tx_dma_enable(struct et131x_adapter *etdev) */ void et131x_init_send(struct et131x_adapter *adapter) { - PMP_TCB pMpTcb; - uint32_t TcbCount; - TX_RING_t *tx_ring; + struct tcb *tcb; + u32 count; + struct tx_ring *tx_ring; /* Setup some convenience pointers */ - tx_ring = &adapter->TxRing; - pMpTcb = adapter->TxRing.MpTcbMem; + tx_ring = &adapter->tx_ring; + tcb = adapter->tx_ring.MpTcbMem; - tx_ring->TCBReadyQueueHead = pMpTcb; + tx_ring->TCBReadyQueueHead = tcb; /* Go through and set up each TCB */ - for (TcbCount = 0; TcbCount < NUM_TCB; TcbCount++) { - memset(pMpTcb, 0, sizeof(MP_TCB)); + for (count = 0; count < NUM_TCB; count++) { + memset(tcb, 0, sizeof(struct tcb)); /* Set the link pointer in HW TCB to the next TCB in the * chain. If this is the last TCB in the chain, also set the * tail pointer. */ - if (TcbCount < NUM_TCB - 1) { - pMpTcb->Next = pMpTcb + 1; + if (count < NUM_TCB - 1) { + tcb->Next = tcb + 1; } else { - tx_ring->TCBReadyQueueTail = pMpTcb; - pMpTcb->Next = (PMP_TCB) NULL; + tx_ring->TCBReadyQueueTail = tcb; + tcb->Next = NULL; } - pMpTcb++; + tcb++; } /* Curr send queue should now be empty */ - tx_ring->CurrSendHead = (PMP_TCB) NULL; - tx_ring->CurrSendTail = (PMP_TCB) NULL; + tx_ring->CurrSendHead = NULL; + tx_ring->CurrSendTail = NULL; - INIT_LIST_HEAD(&adapter->TxRing.SendWaitQueue); + INIT_LIST_HEAD(&adapter->tx_ring.SendWaitQueue); } /** @@ -348,7 +348,7 @@ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev) */ /* Queue is not empty or TCB is not available */ - if (!list_empty(&etdev->TxRing.SendWaitQueue) || + if (!list_empty(&etdev->tx_ring.SendWaitQueue) || MP_TCB_RESOURCES_NOT_AVAILABLE(etdev)) { /* NOTE: If there's an error on send, no need to queue the * packet under Linux; if we just send an error up to the @@ -404,86 +404,85 @@ static int et131x_send_packet(struct sk_buff *skb, struct et131x_adapter *etdev) { int status = 0; - PMP_TCB pMpTcb = NULL; + struct tcb *tcb = NULL; uint16_t *shbufva; unsigned long flags; /* All packets must have at least a MAC address and a protocol type */ - if (skb->len < ETH_HLEN) { + if (skb->len < ETH_HLEN) return -EIO; - } /* Get a TCB for this packet */ spin_lock_irqsave(&etdev->TCBReadyQLock, flags); - pMpTcb = etdev->TxRing.TCBReadyQueueHead; + tcb = etdev->tx_ring.TCBReadyQueueHead; - if (pMpTcb == NULL) { + if (tcb == NULL) { spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags); return -ENOMEM; } - etdev->TxRing.TCBReadyQueueHead = pMpTcb->Next; + etdev->tx_ring.TCBReadyQueueHead = tcb->Next; - if (etdev->TxRing.TCBReadyQueueHead == NULL) - etdev->TxRing.TCBReadyQueueTail = NULL; + if (etdev->tx_ring.TCBReadyQueueHead == NULL) + etdev->tx_ring.TCBReadyQueueTail = NULL; spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags); - pMpTcb->PacketLength = skb->len; - pMpTcb->Packet = skb; + tcb->PacketLength = skb->len; + tcb->Packet = skb; if ((skb->data != NULL) && ((skb->len - skb->data_len) >= 6)) { shbufva = (uint16_t *) skb->data; if ((shbufva[0] == 0xffff) && (shbufva[1] == 0xffff) && (shbufva[2] == 0xffff)) { - pMpTcb->Flags |= fMP_DEST_BROAD; + tcb->Flags |= fMP_DEST_BROAD; } else if ((shbufva[0] & 0x3) == 0x0001) { - pMpTcb->Flags |= fMP_DEST_MULTI; + tcb->Flags |= fMP_DEST_MULTI; } } - pMpTcb->Next = NULL; + tcb->Next = NULL; /* Call the NIC specific send handler. */ if (status == 0) - status = nic_send_packet(etdev, pMpTcb); + status = nic_send_packet(etdev, tcb); if (status != 0) { spin_lock_irqsave(&etdev->TCBReadyQLock, flags); - if (etdev->TxRing.TCBReadyQueueTail) { - etdev->TxRing.TCBReadyQueueTail->Next = pMpTcb; + if (etdev->tx_ring.TCBReadyQueueTail) { + etdev->tx_ring.TCBReadyQueueTail->Next = tcb; } else { /* Apparently ready Q is empty. */ - etdev->TxRing.TCBReadyQueueHead = pMpTcb; + etdev->tx_ring.TCBReadyQueueHead = tcb; } - etdev->TxRing.TCBReadyQueueTail = pMpTcb; + etdev->tx_ring.TCBReadyQueueTail = tcb; spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags); return status; } - WARN_ON(etdev->TxRing.nBusySend > NUM_TCB); + WARN_ON(etdev->tx_ring.nBusySend > NUM_TCB); return 0; } /** * nic_send_packet - NIC specific send handler for version B silicon. * @etdev: pointer to our adapter - * @pMpTcb: pointer to MP_TCB + * @tcb: pointer to struct tcb * * Returns 0 or errno. */ -static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) +static int nic_send_packet(struct et131x_adapter *etdev, struct tcb *tcb) { - uint32_t loopIndex; - TX_DESC_ENTRY_t CurDesc[24]; - uint32_t FragmentNumber = 0; - uint32_t thiscopy, remainder; - struct sk_buff *pPacket = pMpTcb->Packet; - uint32_t FragListCount = skb_shinfo(pPacket)->nr_frags + 1; - struct skb_frag_struct *pFragList = &skb_shinfo(pPacket)->frags[0]; + u32 i; + struct tx_desc desc[24]; /* 24 x 16 byte */ + u32 frag = 0; + u32 thiscopy, remainder; + struct sk_buff *skb = tcb->Packet; + u32 nr_frags = skb_shinfo(skb)->nr_frags + 1; + struct skb_frag_struct *frags = &skb_shinfo(skb)->frags[0]; unsigned long flags; /* Part of the optimizations of this send routine restrict us to @@ -494,17 +493,16 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) * number of fragments. If needed, we can call this function, * although it is less efficient. */ - if (FragListCount > 23) { + if (nr_frags > 23) return -EIO; - } - memset(CurDesc, 0, sizeof(TX_DESC_ENTRY_t) * (FragListCount + 1)); + memset(desc, 0, sizeof(struct tx_desc) * (nr_frags + 1)); - for (loopIndex = 0; loopIndex < FragListCount; loopIndex++) { + for (i = 0; i < nr_frags; i++) { /* If there is something in this element, lets get a * descriptor from the ring and get the necessary data */ - if (loopIndex == 0) { + if (i == 0) { /* If the fragments are smaller than a standard MTU, * then map them to a single descriptor in the Tx * Desc ring. However, if they're larger, as is @@ -514,165 +512,165 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) * This will work until we determine why the hardware * doesn't seem to like large fragments. */ - if ((pPacket->len - pPacket->data_len) <= 1514) { - CurDesc[FragmentNumber].DataBufferPtrHigh = 0; + if ((skb->len - skb->data_len) <= 1514) { + desc[frag].addr_hi = 0; /* Low 16bits are length, high is vlan and unused currently so zero */ - CurDesc[FragmentNumber].word2 = - pPacket->len - pPacket->data_len; + desc[frag].len_vlan = + skb->len - skb->data_len; /* NOTE: Here, the dma_addr_t returned from * pci_map_single() is implicitly cast as a - * uint32_t. Although dma_addr_t can be + * u32. Although dma_addr_t can be * 64-bit, the address returned by * pci_map_single() is always 32-bit * addressable (as defined by the pci/dma * subsystem) */ - CurDesc[FragmentNumber++].DataBufferPtrLow = + desc[frag++].addr_lo = pci_map_single(etdev->pdev, - pPacket->data, - pPacket->len - - pPacket->data_len, + skb->data, + skb->len - + skb->data_len, PCI_DMA_TODEVICE); } else { - CurDesc[FragmentNumber].DataBufferPtrHigh = 0; - CurDesc[FragmentNumber].word2 = - (pPacket->len - pPacket->data_len) / 2; + desc[frag].addr_hi = 0; + desc[frag].len_vlan = + (skb->len - skb->data_len) / 2; /* NOTE: Here, the dma_addr_t returned from * pci_map_single() is implicitly cast as a - * uint32_t. Although dma_addr_t can be + * u32. Although dma_addr_t can be * 64-bit, the address returned by * pci_map_single() is always 32-bit * addressable (as defined by the pci/dma * subsystem) */ - CurDesc[FragmentNumber++].DataBufferPtrLow = + desc[frag++].addr_lo = pci_map_single(etdev->pdev, - pPacket->data, - ((pPacket->len - - pPacket->data_len) / 2), + skb->data, + ((skb->len - + skb->data_len) / 2), PCI_DMA_TODEVICE); - CurDesc[FragmentNumber].DataBufferPtrHigh = 0; + desc[frag].addr_hi = 0; - CurDesc[FragmentNumber].word2 = - (pPacket->len - pPacket->data_len) / 2; + desc[frag].len_vlan = + (skb->len - skb->data_len) / 2; /* NOTE: Here, the dma_addr_t returned from * pci_map_single() is implicitly cast as a - * uint32_t. Although dma_addr_t can be + * u32. Although dma_addr_t can be * 64-bit, the address returned by * pci_map_single() is always 32-bit * addressable (as defined by the pci/dma * subsystem) */ - CurDesc[FragmentNumber++].DataBufferPtrLow = + desc[frag++].addr_lo = pci_map_single(etdev->pdev, - pPacket->data + - ((pPacket->len - - pPacket->data_len) / 2), - ((pPacket->len - - pPacket->data_len) / 2), + skb->data + + ((skb->len - + skb->data_len) / 2), + ((skb->len - + skb->data_len) / 2), PCI_DMA_TODEVICE); } } else { - CurDesc[FragmentNumber].DataBufferPtrHigh = 0; - CurDesc[FragmentNumber].word2 = - pFragList[loopIndex - 1].size; + desc[frag].addr_hi = 0; + desc[frag].len_vlan = + frags[i - 1].size; /* NOTE: Here, the dma_addr_t returned from - * pci_map_page() is implicitly cast as a uint32_t. + * pci_map_page() is implicitly cast as a u32. * Although dma_addr_t can be 64-bit, the address * returned by pci_map_page() is always 32-bit * addressable (as defined by the pci/dma subsystem) */ - CurDesc[FragmentNumber++].DataBufferPtrLow = + desc[frag++].addr_lo = pci_map_page(etdev->pdev, - pFragList[loopIndex - 1].page, - pFragList[loopIndex - 1].page_offset, - pFragList[loopIndex - 1].size, + frags[i - 1].page, + frags[i - 1].page_offset, + frags[i - 1].size, PCI_DMA_TODEVICE); } } - if (FragmentNumber == 0) + if (frag == 0) return -EIO; if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) { - if (++etdev->TxRing.TxPacketsSinceLastinterrupt == + if (++etdev->tx_ring.TxPacketsSinceLastinterrupt == PARM_TX_NUM_BUFS_DEF) { /* Last element & Interrupt flag */ - CurDesc[FragmentNumber - 1].word3 = 0x5; - etdev->TxRing.TxPacketsSinceLastinterrupt = 0; + desc[frag - 1].flags = 0x5; + etdev->tx_ring.TxPacketsSinceLastinterrupt = 0; } else { /* Last element */ - CurDesc[FragmentNumber - 1].word3 = 0x1; + desc[frag - 1].flags = 0x1; } } else { - CurDesc[FragmentNumber - 1].word3 = 0x5; + desc[frag - 1].flags = 0x5; } - CurDesc[0].word3 |= 2; /* First element flag */ + desc[0].flags |= 2; /* First element flag */ - pMpTcb->WrIndexStart = etdev->TxRing.txDmaReadyToSend; - pMpTcb->PacketStaleCount = 0; + tcb->WrIndexStart = etdev->tx_ring.txDmaReadyToSend; + tcb->PacketStaleCount = 0; spin_lock_irqsave(&etdev->SendHWLock, flags); thiscopy = NUM_DESC_PER_RING_TX - - INDEX10(etdev->TxRing.txDmaReadyToSend); + INDEX10(etdev->tx_ring.txDmaReadyToSend); - if (thiscopy >= FragmentNumber) { + if (thiscopy >= frag) { remainder = 0; - thiscopy = FragmentNumber; + thiscopy = frag; } else { - remainder = FragmentNumber - thiscopy; + remainder = frag - thiscopy; } - memcpy(etdev->TxRing.pTxDescRingVa + - INDEX10(etdev->TxRing.txDmaReadyToSend), CurDesc, - sizeof(TX_DESC_ENTRY_t) * thiscopy); + memcpy(etdev->tx_ring.tx_desc_ring + + INDEX10(etdev->tx_ring.txDmaReadyToSend), desc, + sizeof(struct tx_desc) * thiscopy); - add_10bit(&etdev->TxRing.txDmaReadyToSend, thiscopy); + add_10bit(&etdev->tx_ring.txDmaReadyToSend, thiscopy); - if (INDEX10(etdev->TxRing.txDmaReadyToSend)== 0 || - INDEX10(etdev->TxRing.txDmaReadyToSend) == NUM_DESC_PER_RING_TX) { - etdev->TxRing.txDmaReadyToSend &= ~ET_DMA10_MASK; - etdev->TxRing.txDmaReadyToSend ^= ET_DMA10_WRAP; + if (INDEX10(etdev->tx_ring.txDmaReadyToSend)== 0 || + INDEX10(etdev->tx_ring.txDmaReadyToSend) == NUM_DESC_PER_RING_TX) { + etdev->tx_ring.txDmaReadyToSend &= ~ET_DMA10_MASK; + etdev->tx_ring.txDmaReadyToSend ^= ET_DMA10_WRAP; } if (remainder) { - memcpy(etdev->TxRing.pTxDescRingVa, - CurDesc + thiscopy, - sizeof(TX_DESC_ENTRY_t) * remainder); + memcpy(etdev->tx_ring.tx_desc_ring, + desc + thiscopy, + sizeof(struct tx_desc) * remainder); - add_10bit(&etdev->TxRing.txDmaReadyToSend, remainder); + add_10bit(&etdev->tx_ring.txDmaReadyToSend, remainder); } - if (INDEX10(etdev->TxRing.txDmaReadyToSend) == 0) { - if (etdev->TxRing.txDmaReadyToSend) - pMpTcb->WrIndex = NUM_DESC_PER_RING_TX - 1; + if (INDEX10(etdev->tx_ring.txDmaReadyToSend) == 0) { + if (etdev->tx_ring.txDmaReadyToSend) + tcb->WrIndex = NUM_DESC_PER_RING_TX - 1; else - pMpTcb->WrIndex= ET_DMA10_WRAP | (NUM_DESC_PER_RING_TX - 1); + tcb->WrIndex= ET_DMA10_WRAP | (NUM_DESC_PER_RING_TX - 1); } else - pMpTcb->WrIndex = etdev->TxRing.txDmaReadyToSend - 1; + tcb->WrIndex = etdev->tx_ring.txDmaReadyToSend - 1; spin_lock(&etdev->TCBSendQLock); - if (etdev->TxRing.CurrSendTail) - etdev->TxRing.CurrSendTail->Next = pMpTcb; + if (etdev->tx_ring.CurrSendTail) + etdev->tx_ring.CurrSendTail->Next = tcb; else - etdev->TxRing.CurrSendHead = pMpTcb; + etdev->tx_ring.CurrSendHead = tcb; - etdev->TxRing.CurrSendTail = pMpTcb; + etdev->tx_ring.CurrSendTail = tcb; - WARN_ON(pMpTcb->Next != NULL); + WARN_ON(tcb->Next != NULL); - etdev->TxRing.nBusySend++; + etdev->tx_ring.nBusySend++; spin_unlock(&etdev->TCBSendQLock); /* Write the new write pointer back to the device. */ - writel(etdev->TxRing.txDmaReadyToSend, + writel(etdev->tx_ring.txDmaReadyToSend, &etdev->regs->txdma.service_request); /* For Gig only, we use Tx Interrupt coalescing. Enable the software @@ -689,72 +687,72 @@ static int nic_send_packet(struct et131x_adapter *etdev, PMP_TCB pMpTcb) /** - * et131x_free_send_packet - Recycle a MP_TCB, complete the packet if necessary + * et131x_free_send_packet - Recycle a struct tcb * @etdev: pointer to our adapter - * @pMpTcb: pointer to MP_TCB + * @tcb: pointer to struct tcb * + * Complete the packet if necessary * Assumption - Send spinlock has been acquired */ inline void et131x_free_send_packet(struct et131x_adapter *etdev, - PMP_TCB pMpTcb) + struct tcb *tcb) { unsigned long flags; - TX_DESC_ENTRY_t *desc = NULL; + struct tx_desc *desc = NULL; struct net_device_stats *stats = &etdev->net_stats; - if (pMpTcb->Flags & fMP_DEST_BROAD) + if (tcb->Flags & fMP_DEST_BROAD) atomic_inc(&etdev->Stats.brdcstxmt); - else if (pMpTcb->Flags & fMP_DEST_MULTI) + else if (tcb->Flags & fMP_DEST_MULTI) atomic_inc(&etdev->Stats.multixmt); else atomic_inc(&etdev->Stats.unixmt); - if (pMpTcb->Packet) { - stats->tx_bytes += pMpTcb->Packet->len; + if (tcb->Packet) { + stats->tx_bytes += tcb->Packet->len; /* Iterate through the TX descriptors on the ring * corresponding to this packet and umap the fragments * they point to */ do { - desc = - (TX_DESC_ENTRY_t *) (etdev->TxRing.pTxDescRingVa + - INDEX10(pMpTcb->WrIndexStart)); + desc =(struct tx_desc *) (etdev->tx_ring.tx_desc_ring + + INDEX10(tcb->WrIndexStart)); pci_unmap_single(etdev->pdev, - desc->DataBufferPtrLow, - desc->word2, PCI_DMA_TODEVICE); + desc->addr_lo, + desc->len_vlan, PCI_DMA_TODEVICE); - add_10bit(&pMpTcb->WrIndexStart, 1); - if (INDEX10(pMpTcb->WrIndexStart) >= + add_10bit(&tcb->WrIndexStart, 1); + if (INDEX10(tcb->WrIndexStart) >= NUM_DESC_PER_RING_TX) { - pMpTcb->WrIndexStart &= ~ET_DMA10_MASK; - pMpTcb->WrIndexStart ^= ET_DMA10_WRAP; + tcb->WrIndexStart &= ~ET_DMA10_MASK; + tcb->WrIndexStart ^= ET_DMA10_WRAP; } - } while (desc != (etdev->TxRing.pTxDescRingVa + - INDEX10(pMpTcb->WrIndex))); + } while (desc != (etdev->tx_ring.tx_desc_ring + + INDEX10(tcb->WrIndex))); - dev_kfree_skb_any(pMpTcb->Packet); + dev_kfree_skb_any(tcb->Packet); } - memset(pMpTcb, 0, sizeof(MP_TCB)); + memset(tcb, 0, sizeof(struct tcb)); /* Add the TCB to the Ready Q */ spin_lock_irqsave(&etdev->TCBReadyQLock, flags); etdev->Stats.opackets++; - if (etdev->TxRing.TCBReadyQueueTail) { - etdev->TxRing.TCBReadyQueueTail->Next = pMpTcb; + if (etdev->tx_ring.TCBReadyQueueTail) { + etdev->tx_ring.TCBReadyQueueTail->Next = tcb; } else { /* Apparently ready Q is empty. */ - etdev->TxRing.TCBReadyQueueHead = pMpTcb; + etdev->tx_ring.TCBReadyQueueHead = tcb; } - etdev->TxRing.TCBReadyQueueTail = pMpTcb; + etdev->tx_ring.TCBReadyQueueTail = tcb; spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags); - WARN_ON(etdev->TxRing.nBusySend < 0); + WARN_ON(etdev->tx_ring.nBusySend < 0); } /** @@ -765,52 +763,52 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev, */ void et131x_free_busy_send_packets(struct et131x_adapter *etdev) { - PMP_TCB pMpTcb; + struct tcb *tcb; struct list_head *entry; unsigned long flags; - uint32_t FreeCounter = 0; + u32 freed = 0; - while (!list_empty(&etdev->TxRing.SendWaitQueue)) { + while (!list_empty(&etdev->tx_ring.SendWaitQueue)) { spin_lock_irqsave(&etdev->SendWaitLock, flags); - etdev->TxRing.nWaitSend--; + etdev->tx_ring.nWaitSend--; spin_unlock_irqrestore(&etdev->SendWaitLock, flags); - entry = etdev->TxRing.SendWaitQueue.next; + entry = etdev->tx_ring.SendWaitQueue.next; } - etdev->TxRing.nWaitSend = 0; + etdev->tx_ring.nWaitSend = 0; /* Any packets being sent? Check the first TCB on the send list */ spin_lock_irqsave(&etdev->TCBSendQLock, flags); - pMpTcb = etdev->TxRing.CurrSendHead; + tcb = etdev->tx_ring.CurrSendHead; - while ((pMpTcb != NULL) && (FreeCounter < NUM_TCB)) { - PMP_TCB pNext = pMpTcb->Next; + while ((tcb != NULL) && (freed < NUM_TCB)) { + struct tcb *pNext = tcb->Next; - etdev->TxRing.CurrSendHead = pNext; + etdev->tx_ring.CurrSendHead = pNext; if (pNext == NULL) - etdev->TxRing.CurrSendTail = NULL; + etdev->tx_ring.CurrSendTail = NULL; - etdev->TxRing.nBusySend--; + etdev->tx_ring.nBusySend--; spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); - FreeCounter++; - et131x_free_send_packet(etdev, pMpTcb); + freed++; + et131x_free_send_packet(etdev, tcb); spin_lock_irqsave(&etdev->TCBSendQLock, flags); - pMpTcb = etdev->TxRing.CurrSendHead; + tcb = etdev->tx_ring.CurrSendHead; } - WARN_ON(FreeCounter == NUM_TCB); + WARN_ON(freed == NUM_TCB); spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); - etdev->TxRing.nBusySend = 0; + etdev->tx_ring.nBusySend = 0; } /** @@ -844,53 +842,53 @@ void et131x_handle_send_interrupt(struct et131x_adapter *etdev) static void et131x_update_tcb_list(struct et131x_adapter *etdev) { unsigned long flags; - u32 ServiceComplete; - PMP_TCB pMpTcb; + u32 serviced; + struct tcb * tcb; u32 index; - ServiceComplete = readl(&etdev->regs->txdma.NewServiceComplete); - index = INDEX10(ServiceComplete); + serviced = readl(&etdev->regs->txdma.NewServiceComplete); + index = INDEX10(serviced); /* Has the ring wrapped? Process any descriptors that do not have * the same "wrap" indicator as the current completion indicator */ spin_lock_irqsave(&etdev->TCBSendQLock, flags); - pMpTcb = etdev->TxRing.CurrSendHead; + tcb = etdev->tx_ring.CurrSendHead; - while (pMpTcb && - ((ServiceComplete ^ pMpTcb->WrIndex) & ET_DMA10_WRAP) && - index < INDEX10(pMpTcb->WrIndex)) { - etdev->TxRing.nBusySend--; - etdev->TxRing.CurrSendHead = pMpTcb->Next; - if (pMpTcb->Next == NULL) - etdev->TxRing.CurrSendTail = NULL; + while (tcb && + ((serviced ^ tcb->WrIndex) & ET_DMA10_WRAP) && + index < INDEX10(tcb->WrIndex)) { + etdev->tx_ring.nBusySend--; + etdev->tx_ring.CurrSendHead = tcb->Next; + if (tcb->Next == NULL) + etdev->tx_ring.CurrSendTail = NULL; spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); - et131x_free_send_packet(etdev, pMpTcb); + et131x_free_send_packet(etdev, tcb); spin_lock_irqsave(&etdev->TCBSendQLock, flags); /* Goto the next packet */ - pMpTcb = etdev->TxRing.CurrSendHead; + tcb = etdev->tx_ring.CurrSendHead; } - while (pMpTcb && - !((ServiceComplete ^ pMpTcb->WrIndex) & ET_DMA10_WRAP) - && index > (pMpTcb->WrIndex & ET_DMA10_MASK)) { - etdev->TxRing.nBusySend--; - etdev->TxRing.CurrSendHead = pMpTcb->Next; - if (pMpTcb->Next == NULL) - etdev->TxRing.CurrSendTail = NULL; + while (tcb && + !((serviced ^ tcb->WrIndex) & ET_DMA10_WRAP) + && index > (tcb->WrIndex & ET_DMA10_MASK)) { + etdev->tx_ring.nBusySend--; + etdev->tx_ring.CurrSendHead = tcb->Next; + if (tcb->Next == NULL) + etdev->tx_ring.CurrSendTail = NULL; spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); - et131x_free_send_packet(etdev, pMpTcb); + et131x_free_send_packet(etdev, tcb); spin_lock_irqsave(&etdev->TCBSendQLock, flags); /* Goto the next packet */ - pMpTcb = etdev->TxRing.CurrSendHead; + tcb = etdev->tx_ring.CurrSendHead; } /* Wake up the queue when we hit a low-water mark */ - if (etdev->TxRing.nBusySend <= (NUM_TCB / 3)) + if (etdev->tx_ring.nBusySend <= (NUM_TCB / 3)) netif_wake_queue(etdev->netdev); spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); @@ -909,13 +907,13 @@ static void et131x_check_send_wait_list(struct et131x_adapter *etdev) spin_lock_irqsave(&etdev->SendWaitLock, flags); - while (!list_empty(&etdev->TxRing.SendWaitQueue) && + while (!list_empty(&etdev->tx_ring.SendWaitQueue) && MP_TCB_RESOURCES_AVAILABLE(etdev)) { struct list_head *entry; - entry = etdev->TxRing.SendWaitQueue.next; + entry = etdev->tx_ring.SendWaitQueue.next; - etdev->TxRing.nWaitSend--; + etdev->tx_ring.nWaitSend--; } spin_unlock_irqrestore(&etdev->SendWaitLock, flags); diff --git a/drivers/staging/et131x/et1310_tx.h b/drivers/staging/et131x/et1310_tx.h index e2e131413cf1..56b7e2c058ec 100644 --- a/drivers/staging/et131x/et1310_tx.h +++ b/drivers/staging/et131x/et1310_tx.h @@ -89,14 +89,13 @@ * 14: UDP checksum assist */ -/* TX_DESC_ENTRY_t is sructure representing each descriptor on the ring */ -typedef struct _tx_desc_entry_t { - u32 DataBufferPtrHigh; - u32 DataBufferPtrLow; - u32 word2; /* control words how to xmit the */ - u32 word3; /* data (detailed above) */ -} TX_DESC_ENTRY_t, *PTX_DESC_ENTRY_t; - +/* struct tx_desc represents each descriptor on the ring */ +struct tx_desc { + u32 addr_hi; + u32 addr_lo; + u32 len_vlan; /* control words how to xmit the */ + u32 flags; /* data (detailed above) */ +}; /* Typedefs for Tx DMA engine status writeback */ @@ -120,8 +119,8 @@ typedef union _tx_status_block_t { } TX_STATUS_BLOCK_t, *PTX_STATUS_BLOCK_t; /* TCB (Transmit Control Block) */ -typedef struct _MP_TCB { - struct _MP_TCB *Next; +struct tcb { + struct tcb *Next; u32 Flags; u32 Count; u32 PacketStaleCount; @@ -129,7 +128,7 @@ typedef struct _MP_TCB { u32 PacketLength; u32 WrIndex; u32 WrIndexStart; -} MP_TCB, *PMP_TCB; +}; /* Structure to hold the skb's in a list */ typedef struct tx_skb_list_elem { @@ -137,14 +136,14 @@ typedef struct tx_skb_list_elem { struct sk_buff *skb; } TX_SKB_LIST_ELEM, *PTX_SKB_LIST_ELEM; -/* TX_RING_t is sructure representing our local reference(s) to the ring */ -typedef struct _tx_ring_t { +/* Structure representing our local reference(s) to the ring */ +struct tx_ring { /* TCB (Transmit Control Block) memory and lists */ - PMP_TCB MpTcbMem; + struct tcb *MpTcbMem; /* List of TCBs that are ready to be used */ - PMP_TCB TCBReadyQueueHead; - PMP_TCB TCBReadyQueueTail; + struct tcb *TCBReadyQueueHead; + struct tcb *TCBReadyQueueTail; /* list of TCBs that are currently being sent. NOTE that access to all * three of these (including nBusySend) are controlled via the @@ -152,19 +151,19 @@ typedef struct _tx_ring_t { * decrementing nBusySend, or any queue manipulation on CurrSendHead / * Tail */ - PMP_TCB CurrSendHead; - PMP_TCB CurrSendTail; - int32_t nBusySend; + struct tcb *CurrSendHead; + struct tcb *CurrSendTail; + int nBusySend; /* List of packets (not TCBs) that were queued for lack of resources */ struct list_head SendWaitQueue; - int32_t nWaitSend; + int nWaitSend; /* The actual descriptor ring */ - PTX_DESC_ENTRY_t pTxDescRingVa; - dma_addr_t pTxDescRingPa; - uint64_t pTxDescRingAdjustedPa; - uint64_t TxDescOffset; + struct tx_desc *tx_desc_ring; + dma_addr_t tx_desc_ring_pa; + u64 pTxDescRingAdjustedPa; + u64 TxDescOffset; /* ReadyToSend indicates where we last wrote to in the descriptor ring. */ u32 txDmaReadyToSend; @@ -180,8 +179,8 @@ typedef struct _tx_ring_t { TXMAC_ERR_t TxMacErr; /* Variables to track the Tx interrupt coalescing features */ - int32_t TxPacketsSinceLastinterrupt; -} TX_RING_t, *PTX_RING_t; + int TxPacketsSinceLastinterrupt; +}; /* Forward declaration of the frag-list for the following prototypes */ typedef struct _MP_FRAG_LIST MP_FRAG_LIST, *PMP_FRAG_LIST; diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h index 2a213ac1c78f..283d08aa31e6 100644 --- a/drivers/staging/et131x/et131x_adapter.h +++ b/drivers/staging/et131x/et131x_adapter.h @@ -101,8 +101,8 @@ #define LO_MARK_PERCENT_FOR_RX 15 /* Macros specific to the private adapter structure */ -#define MP_TCB_RESOURCES_AVAILABLE(_M) ((_M)->TxRing.nBusySend < NUM_TCB) -#define MP_TCB_RESOURCES_NOT_AVAILABLE(_M) ((_M)->TxRing.nBusySend >= NUM_TCB) +#define MP_TCB_RESOURCES_AVAILABLE(_M) ((_M)->tx_ring.nBusySend < NUM_TCB) +#define MP_TCB_RESOURCES_NOT_AVAILABLE(_M) ((_M)->tx_ring.nBusySend >= NUM_TCB) #define MP_SHOULD_FAIL_SEND(_M) ((_M)->Flags & fMP_ADAPTER_FAIL_SEND_MASK) @@ -255,7 +255,7 @@ struct et131x_adapter { MI_BMSR_t Bmsr; /* Tx Memory Variables */ - TX_RING_t TxRing; + struct tx_ring tx_ring; /* Rx Memory Variables */ RX_RING_t RxRing; diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c index 80fa7a36e694..c22067baa8a8 100644 --- a/drivers/staging/et131x/et131x_isr.c +++ b/drivers/staging/et131x/et131x_isr.c @@ -179,15 +179,15 @@ irqreturn_t et131x_isr(int irq, void *dev_id) /* This is our interrupt, so process accordingly */ if (status & ET_INTR_WATCHDOG) { - PMP_TCB pMpTcb = adapter->TxRing.CurrSendHead; + struct tcb *tcb = adapter->tx_ring.CurrSendHead; - if (pMpTcb) - if (++pMpTcb->PacketStaleCount > 1) + if (tcb) + if (++tcb->PacketStaleCount > 1) status |= ET_INTR_TXDMA_ISR; if (adapter->RxRing.UnfinishedReceives) status |= ET_INTR_RXDMA_XFR_DONE; - else if (pMpTcb == NULL) + else if (tcb == NULL) writel(0, &adapter->regs->global.watchdog_timer); status &= ~ET_INTR_WATCHDOG; @@ -397,7 +397,7 @@ void et131x_isr_handler(struct work_struct *work) /* Let's move on to the TxMac */ if (status & ET_INTR_TXMAC) { - etdev->TxRing.TxMacErr.value = + etdev->tx_ring.TxMacErr.value = readl(&iomem->txmac.err.value); /* @@ -412,7 +412,7 @@ void et131x_isr_handler(struct work_struct *work) */ dev_warn(&etdev->pdev->dev, "TXMAC interrupt, error 0x%08x\n", - etdev->TxRing.TxMacErr.value); + etdev->tx_ring.TxMacErr.value); /* If we are debugging, we want to see this error, * otherwise we just want the device to be reset and diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c index 8d84286fb6b1..93dbed47c2e8 100644 --- a/drivers/staging/et131x/et131x_netdev.c +++ b/drivers/staging/et131x/et131x_netdev.c @@ -519,7 +519,7 @@ int et131x_tx(struct sk_buff *skb, struct net_device *netdev) void et131x_tx_timeout(struct net_device *netdev) { struct et131x_adapter *etdev = netdev_priv(netdev); - PMP_TCB pMpTcb; + struct tcb *tcb; unsigned long flags; /* Just skip this part if the adapter is doing link detection */ @@ -541,28 +541,28 @@ void et131x_tx_timeout(struct net_device *netdev) /* Is send stuck? */ spin_lock_irqsave(&etdev->TCBSendQLock, flags); - pMpTcb = etdev->TxRing.CurrSendHead; + tcb = etdev->tx_ring.CurrSendHead; - if (pMpTcb != NULL) { - pMpTcb->Count++; + if (tcb != NULL) { + tcb->Count++; - if (pMpTcb->Count > NIC_SEND_HANG_THRESHOLD) { - TX_DESC_ENTRY_t StuckDescriptors[10]; + if (tcb->Count > NIC_SEND_HANG_THRESHOLD) { + struct tx_desc stuck[10]; - if (INDEX10(pMpTcb->WrIndex) > 7) { - memcpy(StuckDescriptors, - etdev->TxRing.pTxDescRingVa + - INDEX10(pMpTcb->WrIndex) - 6, - sizeof(TX_DESC_ENTRY_t) * 10); + if (INDEX10(tcb->WrIndex) > 7) { + memcpy(stuck, + etdev->tx_ring.tx_desc_ring + + INDEX10(tcb->WrIndex) - 6, + sizeof(struct tx_desc) * 10); } spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); dev_warn(&etdev->pdev->dev, - "Send stuck - reset. pMpTcb->WrIndex %x, Flags 0x%08x\n", - pMpTcb->WrIndex, - pMpTcb->Flags); + "Send stuck - reset. tcb->WrIndex %x, Flags 0x%08x\n", + tcb->WrIndex, + tcb->Flags); et131x_close(netdev); et131x_open(netdev); -- GitLab From 63841ad24775f1ac83c134b1e44d51fe19afbbb6 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:48:42 +0100 Subject: [PATCH 103/235] Staging: et131x: the stuck descriptor copy is never used Say goodbye to it Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et131x_netdev.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c index 93dbed47c2e8..7c55f5d52d5c 100644 --- a/drivers/staging/et131x/et131x_netdev.c +++ b/drivers/staging/et131x/et131x_netdev.c @@ -547,15 +547,6 @@ void et131x_tx_timeout(struct net_device *netdev) tcb->Count++; if (tcb->Count > NIC_SEND_HANG_THRESHOLD) { - struct tx_desc stuck[10]; - - if (INDEX10(tcb->WrIndex) > 7) { - memcpy(stuck, - etdev->tx_ring.tx_desc_ring + - INDEX10(tcb->WrIndex) - 6, - sizeof(struct tx_desc) * 10); - } - spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); -- GitLab From 9c60684b723906691e814e1bcfadb9f32bf2cc4d Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:48:49 +0100 Subject: [PATCH 104/235] Staging: et131x: pci_alloc_consistent DMA alignment is guaranteed So we can remove this alignment work. Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_rx.c | 50 +++++++----------------------- drivers/staging/et131x/et1310_rx.h | 4 --- drivers/staging/et131x/et1310_tx.c | 17 ++-------- drivers/staging/et131x/et1310_tx.h | 2 -- 4 files changed, 14 insertions(+), 59 deletions(-) diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c index c0695b041f30..8f22bb969e89 100644 --- a/drivers/staging/et131x/et1310_rx.c +++ b/drivers/staging/et131x/et1310_rx.c @@ -342,7 +342,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) sizeof(PKT_STAT_DESC_t) * adapter->RxRing.PsrNumEntries; rx_ring->pPSRingVa = pci_alloc_consistent(adapter->pdev, - pktStatRingSize + 0x0fff, + pktStatRingSize, &rx_ring->pPSRingPa); if (!rx_ring->pPSRingVa) { @@ -350,45 +350,26 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) "Cannot alloc memory for Packet Status Ring\n"); return -ENOMEM; } + printk("PSR %lx\n", (unsigned long) rx_ring->pPSRingPa); - /* Save physical address - * + /* * NOTE : pci_alloc_consistent(), used above to alloc DMA regions, * ALWAYS returns SAC (32-bit) addresses. If DAC (64-bit) addresses * are ever returned, make sure the high part is retrieved here before * storing the adjusted address. */ - rx_ring->pPSRingRealPa = rx_ring->pPSRingPa; - - /* Align Packet Status Ring on a 4K boundary */ - et131x_align_allocated_memory(adapter, - &rx_ring->pPSRingRealPa, - &rx_ring->pPSRingOffset, 0x0FFF); - - rx_ring->pPSRingVa = (void *)((uint8_t *) rx_ring->pPSRingVa + - rx_ring->pPSRingOffset); /* Allocate an area of memory for writeback of status information */ rx_ring->pRxStatusVa = pci_alloc_consistent(adapter->pdev, - sizeof(RX_STATUS_BLOCK_t) + - 0x7, &rx_ring->pRxStatusPa); + sizeof(RX_STATUS_BLOCK_t), + &rx_ring->pRxStatusPa); if (!rx_ring->pRxStatusVa) { dev_err(&adapter->pdev->dev, "Cannot alloc memory for Status Block\n"); return -ENOMEM; } - - /* Save physical address */ - rx_ring->RxStatusRealPA = rx_ring->pRxStatusPa; - - /* Align write back on an 8 byte boundary */ - et131x_align_allocated_memory(adapter, - &rx_ring->RxStatusRealPA, - &rx_ring->RxStatusOffset, 0x07); - - rx_ring->pRxStatusVa = (void *)((uint8_t *) rx_ring->pRxStatusVa + - rx_ring->RxStatusOffset); rx_ring->NumRfd = NIC_DEFAULT_NUM_RFD; + printk("PRS %lx\n", (unsigned long)rx_ring->pRxStatusPa); /* Recv * pci_pool_create initializes a lookaside list. After successful @@ -523,14 +504,10 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) /* Free Packet Status Ring */ if (rx_ring->pPSRingVa) { - rx_ring->pPSRingVa = (void *)((uint8_t *) rx_ring->pPSRingVa - - rx_ring->pPSRingOffset); - pktStatRingSize = sizeof(PKT_STAT_DESC_t) * adapter->RxRing.PsrNumEntries; - pci_free_consistent(adapter->pdev, - pktStatRingSize + 0x0fff, + pci_free_consistent(adapter->pdev, pktStatRingSize, rx_ring->pPSRingVa, rx_ring->pPSRingPa); rx_ring->pPSRingVa = NULL; @@ -538,11 +515,8 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) /* Free area of memory for the writeback of status information */ if (rx_ring->pRxStatusVa) { - rx_ring->pRxStatusVa = (void *)((uint8_t *) - rx_ring->pRxStatusVa - rx_ring->RxStatusOffset); - pci_free_consistent(adapter->pdev, - sizeof(RX_STATUS_BLOCK_t) + 0x7, + sizeof(RX_STATUS_BLOCK_t), rx_ring->pRxStatusVa, rx_ring->pRxStatusPa); rx_ring->pRxStatusVa = NULL; @@ -675,18 +649,18 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) * are ever returned, make sure the high part is retrieved here * before storing the adjusted address. */ - writel((uint32_t) (pRxLocal->RxStatusRealPA >> 32), + writel((uint32_t) ((u64)pRxLocal->pRxStatusPa >> 32), &rx_dma->dma_wb_base_hi); - writel((uint32_t) pRxLocal->RxStatusRealPA, &rx_dma->dma_wb_base_lo); + writel((uint32_t) pRxLocal->pRxStatusPa, &rx_dma->dma_wb_base_lo); memset(pRxLocal->pRxStatusVa, 0, sizeof(RX_STATUS_BLOCK_t)); /* Set the address and parameters of the packet status ring into the * 1310's registers */ - writel((uint32_t) (pRxLocal->pPSRingRealPa >> 32), + writel((uint32_t) ((u64)pRxLocal->pPSRingPa >> 32), &rx_dma->psr_base_hi); - writel((uint32_t) pRxLocal->pPSRingRealPa, &rx_dma->psr_base_lo); + writel((uint32_t) pRxLocal->pPSRingPa, &rx_dma->psr_base_lo); writel(pRxLocal->PsrNumEntries - 1, &rx_dma->psr_num_des.value); writel(0, &rx_dma->psr_full_offset.value); diff --git a/drivers/staging/et131x/et1310_rx.h b/drivers/staging/et131x/et1310_rx.h index b02fac8cd3cd..03e859b43111 100644 --- a/drivers/staging/et131x/et1310_rx.h +++ b/drivers/staging/et131x/et1310_rx.h @@ -309,15 +309,11 @@ typedef struct _rx_ring_t { void *pPSRingVa; dma_addr_t pPSRingPa; - uint64_t pPSRingRealPa; - uint64_t pPSRingOffset; RXDMA_PSR_FULL_OFFSET_t local_psr_full; u32 PsrNumEntries; void *pRxStatusVa; dma_addr_t pRxStatusPa; - uint64_t RxStatusRealPA; - uint64_t RxStatusOffset; struct list_head RecvBufferPool; diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c index 8beb029fab1c..b2e4950b002a 100644 --- a/drivers/staging/et131x/et1310_tx.c +++ b/drivers/staging/et131x/et1310_tx.c @@ -146,15 +146,6 @@ int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter) * are ever returned, make sure the high part is retrieved here before * storing the adjusted address. */ - tx_ring->pTxDescRingAdjustedPa = tx_ring->tx_desc_ring_pa; - - /* Align Tx Descriptor Ring on a 4k (0x1000) byte boundary */ - et131x_align_allocated_memory(adapter, - &tx_ring->pTxDescRingAdjustedPa, - &tx_ring->TxDescOffset, 0x0FFF); - - tx_ring->tx_desc_ring += tx_ring->TxDescOffset; - /* Allocate memory for the Tx status block */ tx_ring->pTxStatusVa = pci_alloc_consistent(adapter->pdev, sizeof(TX_STATUS_BLOCK_t), @@ -190,16 +181,12 @@ void et131x_tx_dma_memory_free(struct et131x_adapter *adapter) if (adapter->tx_ring.tx_desc_ring) { /* Free memory relating to Tx rings here */ - adapter->tx_ring.tx_desc_ring -= adapter->tx_ring.TxDescOffset; - desc_size = (sizeof(struct tx_desc) * NUM_DESC_PER_RING_TX) + 4096 - 1; - pci_free_consistent(adapter->pdev, desc_size, adapter->tx_ring.tx_desc_ring, adapter->tx_ring.tx_desc_ring_pa); - adapter->tx_ring.tx_desc_ring = NULL; } @@ -236,9 +223,9 @@ void ConfigTxDmaRegs(struct et131x_adapter *etdev) struct _TXDMA_t __iomem *txdma = &etdev->regs->txdma; /* Load the hardware with the start of the transmit descriptor ring. */ - writel((u32) (etdev->tx_ring.pTxDescRingAdjustedPa >> 32), + writel((u32) ((u64)etdev->tx_ring.tx_desc_ring_pa >> 32), &txdma->pr_base_hi); - writel((u32) etdev->tx_ring.pTxDescRingAdjustedPa, + writel((u32) etdev->tx_ring.tx_desc_ring_pa, &txdma->pr_base_lo); /* Initialise the transmit DMA engine */ diff --git a/drivers/staging/et131x/et1310_tx.h b/drivers/staging/et131x/et1310_tx.h index 56b7e2c058ec..9a31e97405e8 100644 --- a/drivers/staging/et131x/et1310_tx.h +++ b/drivers/staging/et131x/et1310_tx.h @@ -162,8 +162,6 @@ struct tx_ring { /* The actual descriptor ring */ struct tx_desc *tx_desc_ring; dma_addr_t tx_desc_ring_pa; - u64 pTxDescRingAdjustedPa; - u64 TxDescOffset; /* ReadyToSend indicates where we last wrote to in the descriptor ring. */ u32 txDmaReadyToSend; -- GitLab From 4fbdf811bca06f2ebb374ebc763aea6c2b83f14e Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:48:57 +0100 Subject: [PATCH 105/235] Staging: et131x: first pass RX cleanup Sort out the variable naming and clean up types and obvious trivia Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_rx.c | 414 ++++++++++++++--------------- 1 file changed, 205 insertions(+), 209 deletions(-) diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c index 8f22bb969e89..5d17abdf7119 100644 --- a/drivers/staging/et131x/et1310_rx.c +++ b/drivers/staging/et131x/et1310_rx.c @@ -106,9 +106,9 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd); */ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) { - uint32_t OuterLoop, InnerLoop; - uint32_t bufsize; - uint32_t pktStatRingSize, FBRChunkSize; + u32 i, j; + u32 bufsize; + u32 pktStatRingSize, FBRChunkSize; RX_RING_t *rx_ring; /* Setup some convenience pointers */ @@ -227,11 +227,11 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) rx_ring->Fbr0offset); #endif - for (OuterLoop = 0; OuterLoop < (rx_ring->Fbr1NumEntries / FBR_CHUNKS); - OuterLoop++) { - uint64_t Fbr1Offset; - uint64_t Fbr1TempPa; - uint32_t Fbr1Align; + for (i = 0; i < (rx_ring->Fbr1NumEntries / FBR_CHUNKS); + i++) { + u64 Fbr1Offset; + u64 Fbr1TempPa; + u32 Fbr1Align; /* This code allocates an area of memory big enough for N * free buffers + (buffer_size - 1) so that the buffers can @@ -247,39 +247,39 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) FBRChunkSize = (FBR_CHUNKS * rx_ring->Fbr1BufferSize) + Fbr1Align - 1; - rx_ring->Fbr1MemVa[OuterLoop] = + rx_ring->Fbr1MemVa[i] = pci_alloc_consistent(adapter->pdev, FBRChunkSize, - &rx_ring->Fbr1MemPa[OuterLoop]); + &rx_ring->Fbr1MemPa[i]); - if (!rx_ring->Fbr1MemVa[OuterLoop]) { + if (!rx_ring->Fbr1MemVa[i]) { dev_err(&adapter->pdev->dev, "Could not alloc memory\n"); return -ENOMEM; } /* See NOTE in "Save Physical Address" comment above */ - Fbr1TempPa = rx_ring->Fbr1MemPa[OuterLoop]; + Fbr1TempPa = rx_ring->Fbr1MemPa[i]; et131x_align_allocated_memory(adapter, &Fbr1TempPa, &Fbr1Offset, (Fbr1Align - 1)); - for (InnerLoop = 0; InnerLoop < FBR_CHUNKS; InnerLoop++) { - uint32_t index = (OuterLoop * FBR_CHUNKS) + InnerLoop; + for (j = 0; j < FBR_CHUNKS; j++) { + u32 index = (i * FBR_CHUNKS) + j; /* Save the Virtual address of this index for quick * access later */ rx_ring->Fbr[1]->Va[index] = - (uint8_t *) rx_ring->Fbr1MemVa[OuterLoop] + - (InnerLoop * rx_ring->Fbr1BufferSize) + Fbr1Offset; + (uint8_t *) rx_ring->Fbr1MemVa[i] + + (j * rx_ring->Fbr1BufferSize) + Fbr1Offset; /* now store the physical address in the descriptor * so the device can access it */ rx_ring->Fbr[1]->PAHigh[index] = - (uint32_t) (Fbr1TempPa >> 32); - rx_ring->Fbr[1]->PALow[index] = (uint32_t) Fbr1TempPa; + (u32) (Fbr1TempPa >> 32); + rx_ring->Fbr[1]->PALow[index] = (u32) Fbr1TempPa; Fbr1TempPa += rx_ring->Fbr1BufferSize; @@ -292,40 +292,40 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) #ifdef USE_FBR0 /* Same for FBR0 (if in use) */ - for (OuterLoop = 0; OuterLoop < (rx_ring->Fbr0NumEntries / FBR_CHUNKS); - OuterLoop++) { - uint64_t Fbr0Offset; - uint64_t Fbr0TempPa; + for (i = 0; i < (rx_ring->Fbr0NumEntries / FBR_CHUNKS); + i++) { + u64 Fbr0Offset; + u64 Fbr0TempPa; FBRChunkSize = ((FBR_CHUNKS + 1) * rx_ring->Fbr0BufferSize) - 1; - rx_ring->Fbr0MemVa[OuterLoop] = + rx_ring->Fbr0MemVa[i] = pci_alloc_consistent(adapter->pdev, FBRChunkSize, - &rx_ring->Fbr0MemPa[OuterLoop]); + &rx_ring->Fbr0MemPa[i]); - if (!rx_ring->Fbr0MemVa[OuterLoop]) { + if (!rx_ring->Fbr0MemVa[i]) { dev_err(&adapter->pdev->dev, "Could not alloc memory\n"); return -ENOMEM; } /* See NOTE in "Save Physical Address" comment above */ - Fbr0TempPa = rx_ring->Fbr0MemPa[OuterLoop]; + Fbr0TempPa = rx_ring->Fbr0MemPa[i]; et131x_align_allocated_memory(adapter, &Fbr0TempPa, &Fbr0Offset, rx_ring->Fbr0BufferSize - 1); - for (InnerLoop = 0; InnerLoop < FBR_CHUNKS; InnerLoop++) { - uint32_t index = (OuterLoop * FBR_CHUNKS) + InnerLoop; + for (j = 0; j < FBR_CHUNKS; j++) { + u32 index = (i * FBR_CHUNKS) + j; rx_ring->Fbr[0]->Va[index] = - (uint8_t *) rx_ring->Fbr0MemVa[OuterLoop] + - (InnerLoop * rx_ring->Fbr0BufferSize) + Fbr0Offset; + (uint8_t *) rx_ring->Fbr0MemVa[i] + + (j * rx_ring->Fbr0BufferSize) + Fbr0Offset; rx_ring->Fbr[0]->PAHigh[index] = - (uint32_t) (Fbr0TempPa >> 32); - rx_ring->Fbr[0]->PALow[index] = (uint32_t) Fbr0TempPa; + (u32) (Fbr0TempPa >> 32); + rx_ring->Fbr[0]->PALow[index] = (u32) Fbr0TempPa; Fbr0TempPa += rx_ring->Fbr0BufferSize; @@ -400,10 +400,10 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) */ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) { - uint32_t index; - uint32_t bufsize; - uint32_t pktStatRingSize; - PMP_RFD pMpRfd; + u32 index; + u32 bufsize; + u32 pktStatRingSize; + PMP_RFD rfd; RX_RING_t *rx_ring; /* Setup some convenience pointers */ @@ -413,18 +413,18 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) WARN_ON(rx_ring->nReadyRecv != rx_ring->NumRfd); while (!list_empty(&rx_ring->RecvList)) { - pMpRfd = (MP_RFD *) list_entry(rx_ring->RecvList.next, + rfd = (MP_RFD *) list_entry(rx_ring->RecvList.next, MP_RFD, list_node); - list_del(&pMpRfd->list_node); - et131x_rfd_resources_free(adapter, pMpRfd); + list_del(&rfd->list_node); + et131x_rfd_resources_free(adapter, rfd); } while (!list_empty(&rx_ring->RecvPendingList)) { - pMpRfd = (MP_RFD *) list_entry(rx_ring->RecvPendingList.next, + rfd = (MP_RFD *) list_entry(rx_ring->RecvPendingList.next, MP_RFD, list_node); - list_del(&pMpRfd->list_node); - et131x_rfd_resources_free(adapter, pMpRfd); + list_del(&rfd->list_node); + et131x_rfd_resources_free(adapter, rfd); } /* Free Free Buffer Ring 1 */ @@ -433,7 +433,7 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) for (index = 0; index < (rx_ring->Fbr1NumEntries / FBR_CHUNKS); index++) { if (rx_ring->Fbr1MemVa[index]) { - uint32_t Fbr1Align; + u32 Fbr1Align; if (rx_ring->Fbr1BufferSize > 4096) Fbr1Align = 4096; @@ -552,49 +552,49 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) int et131x_init_recv(struct et131x_adapter *adapter) { int status = -ENOMEM; - PMP_RFD pMpRfd = NULL; - uint32_t RfdCount; - uint32_t TotalNumRfd = 0; + PMP_RFD rfd = NULL; + u32 rfdct; + u32 numrfd = 0; RX_RING_t *rx_ring = NULL; /* Setup some convenience pointers */ rx_ring = (RX_RING_t *) &adapter->RxRing; /* Setup each RFD */ - for (RfdCount = 0; RfdCount < rx_ring->NumRfd; RfdCount++) { - pMpRfd = (MP_RFD *) kmem_cache_alloc(rx_ring->RecvLookaside, + for (rfdct = 0; rfdct < rx_ring->NumRfd; rfdct++) { + rfd = (MP_RFD *) kmem_cache_alloc(rx_ring->RecvLookaside, GFP_ATOMIC | GFP_DMA); - if (!pMpRfd) { + if (!rfd) { dev_err(&adapter->pdev->dev, "Couldn't alloc RFD out of kmem_cache\n"); status = -ENOMEM; continue; } - status = et131x_rfd_resources_alloc(adapter, pMpRfd); + status = et131x_rfd_resources_alloc(adapter, rfd); if (status != 0) { dev_err(&adapter->pdev->dev, "Couldn't alloc packet for RFD\n"); - kmem_cache_free(rx_ring->RecvLookaside, pMpRfd); + kmem_cache_free(rx_ring->RecvLookaside, rfd); continue; } /* Add this RFD to the RecvList */ - list_add_tail(&pMpRfd->list_node, &rx_ring->RecvList); + list_add_tail(&rfd->list_node, &rx_ring->RecvList); /* Increment both the available RFD's, and the total RFD's. */ rx_ring->nReadyRecv++; - TotalNumRfd++; + numrfd++; } - if (TotalNumRfd > NIC_MIN_NUM_RFD) + if (numrfd > NIC_MIN_NUM_RFD) status = 0; - rx_ring->NumRfd = TotalNumRfd; + rx_ring->NumRfd = numrfd; if (status != 0) { - kmem_cache_free(rx_ring->RecvLookaside, pMpRfd); + kmem_cache_free(rx_ring->RecvLookaside, rfd); dev_err(&adapter->pdev->dev, "Allocation problems in et131x_init_recv\n"); } @@ -604,13 +604,13 @@ int et131x_init_recv(struct et131x_adapter *adapter) /** * et131x_rfd_resources_alloc * @adapter: pointer to our private adapter structure - * @pMpRfd: pointer to a RFD + * @rfd: pointer to a RFD * * Returns 0 on success and errno on failure (as defined in errno.h) */ -int et131x_rfd_resources_alloc(struct et131x_adapter *adapter, MP_RFD *pMpRfd) +int et131x_rfd_resources_alloc(struct et131x_adapter *adapter, MP_RFD *rfd) { - pMpRfd->Packet = NULL; + rfd->Packet = NULL; return 0; } @@ -618,12 +618,12 @@ int et131x_rfd_resources_alloc(struct et131x_adapter *adapter, MP_RFD *pMpRfd) /** * et131x_rfd_resources_free - Free the packet allocated for the given RFD * @adapter: pointer to our private adapter structure - * @pMpRfd: pointer to a RFD + * @rfd: pointer to a RFD */ -void et131x_rfd_resources_free(struct et131x_adapter *adapter, MP_RFD *pMpRfd) +void et131x_rfd_resources_free(struct et131x_adapter *adapter, MP_RFD *rfd) { - pMpRfd->Packet = NULL; - kmem_cache_free(adapter->RxRing.RecvLookaside, pMpRfd); + rfd->Packet = NULL; + kmem_cache_free(adapter->RxRing.RecvLookaside, rfd); } /** @@ -633,9 +633,9 @@ void et131x_rfd_resources_free(struct et131x_adapter *adapter, MP_RFD *pMpRfd) void ConfigRxDmaRegs(struct et131x_adapter *etdev) { struct _RXDMA_t __iomem *rx_dma = &etdev->regs->rxdma; - struct _rx_ring_t *pRxLocal = &etdev->RxRing; + struct _rx_ring_t *rx_local = &etdev->RxRing; PFBR_DESC_t fbr_entry; - uint32_t entry; + u32 entry; RXDMA_PSR_NUM_DES_t psr_num_des; unsigned long flags; @@ -649,19 +649,19 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) * are ever returned, make sure the high part is retrieved here * before storing the adjusted address. */ - writel((uint32_t) ((u64)pRxLocal->pRxStatusPa >> 32), + writel((u32) ((u64)rx_local->pRxStatusPa >> 32), &rx_dma->dma_wb_base_hi); - writel((uint32_t) pRxLocal->pRxStatusPa, &rx_dma->dma_wb_base_lo); + writel((u32) rx_local->pRxStatusPa, &rx_dma->dma_wb_base_lo); - memset(pRxLocal->pRxStatusVa, 0, sizeof(RX_STATUS_BLOCK_t)); + memset(rx_local->pRxStatusVa, 0, sizeof(RX_STATUS_BLOCK_t)); /* Set the address and parameters of the packet status ring into the * 1310's registers */ - writel((uint32_t) ((u64)pRxLocal->pPSRingPa >> 32), + writel((u32) ((u64)rx_local->pPSRingPa >> 32), &rx_dma->psr_base_hi); - writel((uint32_t) pRxLocal->pPSRingPa, &rx_dma->psr_base_lo); - writel(pRxLocal->PsrNumEntries - 1, &rx_dma->psr_num_des.value); + writel((u32) rx_local->pPSRingPa, &rx_dma->psr_base_lo); + writel(rx_local->PsrNumEntries - 1, &rx_dma->psr_num_des.value); writel(0, &rx_dma->psr_full_offset.value); psr_num_des.value = readl(&rx_dma->psr_num_des.value); @@ -671,14 +671,14 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) spin_lock_irqsave(&etdev->RcvLock, flags); /* These local variables track the PSR in the adapter structure */ - pRxLocal->local_psr_full.bits.psr_full = 0; - pRxLocal->local_psr_full.bits.psr_full_wrap = 0; + rx_local->local_psr_full.bits.psr_full = 0; + rx_local->local_psr_full.bits.psr_full_wrap = 0; /* Now's the best time to initialize FBR1 contents */ - fbr_entry = (PFBR_DESC_t) pRxLocal->pFbr1RingVa; - for (entry = 0; entry < pRxLocal->Fbr1NumEntries; entry++) { - fbr_entry->addr_hi = pRxLocal->Fbr[1]->PAHigh[entry]; - fbr_entry->addr_lo = pRxLocal->Fbr[1]->PALow[entry]; + fbr_entry = (PFBR_DESC_t) rx_local->pFbr1RingVa; + for (entry = 0; entry < rx_local->Fbr1NumEntries; entry++) { + fbr_entry->addr_hi = rx_local->Fbr[1]->PAHigh[entry]; + fbr_entry->addr_lo = rx_local->Fbr[1]->PALow[entry]; fbr_entry->word2.bits.bi = entry; fbr_entry++; } @@ -686,38 +686,38 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) /* Set the address and parameters of Free buffer ring 1 (and 0 if * required) into the 1310's registers */ - writel((uint32_t) (pRxLocal->Fbr1Realpa >> 32), &rx_dma->fbr1_base_hi); - writel((uint32_t) pRxLocal->Fbr1Realpa, &rx_dma->fbr1_base_lo); - writel(pRxLocal->Fbr1NumEntries - 1, &rx_dma->fbr1_num_des.value); + writel((u32) (rx_local->Fbr1Realpa >> 32), &rx_dma->fbr1_base_hi); + writel((u32) rx_local->Fbr1Realpa, &rx_dma->fbr1_base_lo); + writel(rx_local->Fbr1NumEntries - 1, &rx_dma->fbr1_num_des.value); writel(ET_DMA10_WRAP, &rx_dma->fbr1_full_offset); /* This variable tracks the free buffer ring 1 full position, so it * has to match the above. */ - pRxLocal->local_Fbr1_full = ET_DMA10_WRAP; - writel(((pRxLocal->Fbr1NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, + rx_local->local_Fbr1_full = ET_DMA10_WRAP; + writel(((rx_local->Fbr1NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, &rx_dma->fbr1_min_des.value); #ifdef USE_FBR0 /* Now's the best time to initialize FBR0 contents */ - fbr_entry = (PFBR_DESC_t) pRxLocal->pFbr0RingVa; - for (entry = 0; entry < pRxLocal->Fbr0NumEntries; entry++) { - fbr_entry->addr_hi = pRxLocal->Fbr[0]->PAHigh[entry]; - fbr_entry->addr_lo = pRxLocal->Fbr[0]->PALow[entry]; + fbr_entry = (PFBR_DESC_t) rx_local->pFbr0RingVa; + for (entry = 0; entry < rx_local->Fbr0NumEntries; entry++) { + fbr_entry->addr_hi = rx_local->Fbr[0]->PAHigh[entry]; + fbr_entry->addr_lo = rx_local->Fbr[0]->PALow[entry]; fbr_entry->word2.bits.bi = entry; fbr_entry++; } - writel((uint32_t) (pRxLocal->Fbr0Realpa >> 32), &rx_dma->fbr0_base_hi); - writel((uint32_t) pRxLocal->Fbr0Realpa, &rx_dma->fbr0_base_lo); - writel(pRxLocal->Fbr0NumEntries - 1, &rx_dma->fbr0_num_des.value); + writel((u32) (rx_local->Fbr0Realpa >> 32), &rx_dma->fbr0_base_hi); + writel((u32) rx_local->Fbr0Realpa, &rx_dma->fbr0_base_lo); + writel(rx_local->Fbr0NumEntries - 1, &rx_dma->fbr0_num_des.value); writel(ET_DMA10_WRAP, &rx_dma->fbr0_full_offset); /* This variable tracks the free buffer ring 0 full position, so it * has to match the above. */ - pRxLocal->local_Fbr0_full = ET_DMA10_WRAP; - writel(((pRxLocal->Fbr0NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, + rx_local->local_Fbr0_full = ET_DMA10_WRAP; + writel(((rx_local->Fbr0NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, &rx_dma->fbr0_min_des.value); #endif @@ -818,7 +818,7 @@ void et131x_rx_dma_enable(struct et131x_adapter *etdev) * nic_rx_pkts - Checks the hardware for available packets * @etdev: pointer to our adapter * - * Returns pMpRfd, a pointer to our MPRFD. + * Returns rfd, a pointer to our MPRFD. * * Checks the hardware for available packets, using completion ring * If packets are available, it gets an RFD from the RecvList, attaches @@ -827,119 +827,119 @@ void et131x_rx_dma_enable(struct et131x_adapter *etdev) */ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev) { - struct _rx_ring_t *pRxLocal = &etdev->RxRing; - PRX_STATUS_BLOCK_t pRxStatusBlock; - PPKT_STAT_DESC_t pPSREntry; - PMP_RFD pMpRfd; - uint32_t nIndex; - uint8_t *pBufVa; + struct _rx_ring_t *rx_local = &etdev->RxRing; + PRX_STATUS_BLOCK_t status; + PPKT_STAT_DESC_t psr; + PMP_RFD rfd; + u32 i; + uint8_t *buf; unsigned long flags; struct list_head *element; - uint8_t ringIndex; - uint16_t bufferIndex; - uint32_t localLen; + uint8_t rindex; + uint16_t bindex; + u32 len; PKT_STAT_DESC_WORD0_t Word0; /* RX Status block is written by the DMA engine prior to every * interrupt. It contains the next to be used entry in the Packet * Status Ring, and also the two Free Buffer rings. */ - pRxStatusBlock = (PRX_STATUS_BLOCK_t) pRxLocal->pRxStatusVa; + status = (PRX_STATUS_BLOCK_t) rx_local->pRxStatusVa; - if (pRxStatusBlock->Word1.bits.PSRoffset == - pRxLocal->local_psr_full.bits.psr_full && - pRxStatusBlock->Word1.bits.PSRwrap == - pRxLocal->local_psr_full.bits.psr_full_wrap) { + if (status->Word1.bits.PSRoffset == + rx_local->local_psr_full.bits.psr_full && + status->Word1.bits.PSRwrap == + rx_local->local_psr_full.bits.psr_full_wrap) { /* Looks like this ring is not updated yet */ return NULL; } /* The packet status ring indicates that data is available. */ - pPSREntry = (PPKT_STAT_DESC_t) (pRxLocal->pPSRingVa) + - pRxLocal->local_psr_full.bits.psr_full; + psr = (PPKT_STAT_DESC_t) (rx_local->pPSRingVa) + + rx_local->local_psr_full.bits.psr_full; /* Grab any information that is required once the PSR is * advanced, since we can no longer rely on the memory being * accurate */ - localLen = pPSREntry->word1.bits.length; - ringIndex = (uint8_t) pPSREntry->word1.bits.ri; - bufferIndex = (uint16_t) pPSREntry->word1.bits.bi; - Word0 = pPSREntry->word0; + len = psr->word1.bits.length; + rindex = (uint8_t) psr->word1.bits.ri; + bindex = (uint16_t) psr->word1.bits.bi; + Word0 = psr->word0; /* Indicate that we have used this PSR entry. */ - if (++pRxLocal->local_psr_full.bits.psr_full > - pRxLocal->PsrNumEntries - 1) { - pRxLocal->local_psr_full.bits.psr_full = 0; - pRxLocal->local_psr_full.bits.psr_full_wrap ^= 1; + if (++rx_local->local_psr_full.bits.psr_full > + rx_local->PsrNumEntries - 1) { + rx_local->local_psr_full.bits.psr_full = 0; + rx_local->local_psr_full.bits.psr_full_wrap ^= 1; } - writel(pRxLocal->local_psr_full.value, + writel(rx_local->local_psr_full.value, &etdev->regs->rxdma.psr_full_offset.value); #ifndef USE_FBR0 - if (ringIndex != 1) { + if (rindex != 1) { return NULL; } #endif #ifdef USE_FBR0 - if (ringIndex > 1 || - (ringIndex == 0 && - bufferIndex > pRxLocal->Fbr0NumEntries - 1) || - (ringIndex == 1 && - bufferIndex > pRxLocal->Fbr1NumEntries - 1)) + if (rindex > 1 || + (rindex == 0 && + bindex > rx_local->Fbr0NumEntries - 1) || + (rindex == 1 && + bindex > rx_local->Fbr1NumEntries - 1)) #else - if (ringIndex != 1 || - bufferIndex > pRxLocal->Fbr1NumEntries - 1) + if (rindex != 1 || + bindex > rx_local->Fbr1NumEntries - 1) #endif { /* Illegal buffer or ring index cannot be used by S/W*/ dev_err(&etdev->pdev->dev, "NICRxPkts PSR Entry %d indicates " "length of %d and/or bad bi(%d)\n", - pRxLocal->local_psr_full.bits.psr_full, - localLen, bufferIndex); + rx_local->local_psr_full.bits.psr_full, + len, bindex); return NULL; } /* Get and fill the RFD. */ spin_lock_irqsave(&etdev->RcvLock, flags); - pMpRfd = NULL; - element = pRxLocal->RecvList.next; - pMpRfd = (PMP_RFD) list_entry(element, MP_RFD, list_node); + rfd = NULL; + element = rx_local->RecvList.next; + rfd = (PMP_RFD) list_entry(element, MP_RFD, list_node); - if (pMpRfd == NULL) { + if (rfd == NULL) { spin_unlock_irqrestore(&etdev->RcvLock, flags); return NULL; } - list_del(&pMpRfd->list_node); - pRxLocal->nReadyRecv--; + list_del(&rfd->list_node); + rx_local->nReadyRecv--; spin_unlock_irqrestore(&etdev->RcvLock, flags); - pMpRfd->bufferindex = bufferIndex; - pMpRfd->ringindex = ringIndex; + rfd->bufferindex = bindex; + rfd->ringindex = rindex; /* In V1 silicon, there is a bug which screws up filtering of * runt packets. Therefore runt packet filtering is disabled * in the MAC and the packets are dropped here. They are * also counted here. */ - if (localLen < (NIC_MIN_PACKET_SIZE + 4)) { + if (len < (NIC_MIN_PACKET_SIZE + 4)) { etdev->Stats.other_errors++; - localLen = 0; + len = 0; } - if (localLen) { + if (len) { if (etdev->ReplicaPhyLoopbk == 1) { - pBufVa = pRxLocal->Fbr[ringIndex]->Va[bufferIndex]; + buf = rx_local->Fbr[rindex]->Va[bindex]; - if (memcmp(&pBufVa[6], &etdev->CurrentAddress[0], + if (memcmp(&buf[6], &etdev->CurrentAddress[0], ETH_ALEN) == 0) { - if (memcmp(&pBufVa[42], "Replica packet", + if (memcmp(&buf[42], "Replica packet", ETH_HLEN)) { etdev->ReplicaPhyLoopbkPF = 1; } @@ -959,28 +959,28 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev) if ((etdev->PacketFilter & ET131X_PACKET_TYPE_MULTICAST) && !(etdev->PacketFilter & ET131X_PACKET_TYPE_PROMISCUOUS) && !(etdev->PacketFilter & ET131X_PACKET_TYPE_ALL_MULTICAST)) { - pBufVa = pRxLocal->Fbr[ringIndex]-> - Va[bufferIndex]; + buf = rx_local->Fbr[rindex]-> + Va[bindex]; /* Loop through our list to see if the * destination address of this packet * matches one in our list. */ - for (nIndex = 0; - nIndex < etdev->MCAddressCount; - nIndex++) { - if (pBufVa[0] == - etdev->MCList[nIndex][0] - && pBufVa[1] == - etdev->MCList[nIndex][1] - && pBufVa[2] == - etdev->MCList[nIndex][2] - && pBufVa[3] == - etdev->MCList[nIndex][3] - && pBufVa[4] == - etdev->MCList[nIndex][4] - && pBufVa[5] == - etdev->MCList[nIndex][5]) { + for (i = 0; + i < etdev->MCAddressCount; + i++) { + if (buf[0] == + etdev->MCList[i][0] + && buf[1] == + etdev->MCList[i][1] + && buf[2] == + etdev->MCList[i][2] + && buf[3] == + etdev->MCList[i][3] + && buf[4] == + etdev->MCList[i][4] + && buf[5] == + etdev->MCList[i][5]) { break; } } @@ -993,11 +993,11 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev) * so we free our RFD when we return * from this function. */ - if (nIndex == etdev->MCAddressCount) - localLen = 0; + if (i == etdev->MCAddressCount) + len = 0; } - if (localLen > 0) + if (len > 0) etdev->Stats.multircv++; } else if (Word0.value & ALCATEL_BROADCAST_PKT) etdev->Stats.brdcstrcv++; @@ -1010,24 +1010,24 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev) etdev->Stats.unircv++; } - if (localLen > 0) { + if (len > 0) { struct sk_buff *skb = NULL; - /* pMpRfd->PacketSize = localLen - 4; */ - pMpRfd->PacketSize = localLen; + /* rfd->PacketSize = len - 4; */ + rfd->PacketSize = len; - skb = dev_alloc_skb(pMpRfd->PacketSize + 2); + skb = dev_alloc_skb(rfd->PacketSize + 2); if (!skb) { dev_err(&etdev->pdev->dev, "Couldn't alloc an SKB for Rx\n"); return NULL; } - etdev->net_stats.rx_bytes += pMpRfd->PacketSize; + etdev->net_stats.rx_bytes += rfd->PacketSize; - memcpy(skb_put(skb, pMpRfd->PacketSize), - pRxLocal->Fbr[ringIndex]->Va[bufferIndex], - pMpRfd->PacketSize); + memcpy(skb_put(skb, rfd->PacketSize), + rx_local->Fbr[rindex]->Va[bindex], + rfd->PacketSize); skb->dev = etdev->netdev; skb->protocol = eth_type_trans(skb, etdev->netdev); @@ -1035,11 +1035,11 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev) netif_rx(skb); } else { - pMpRfd->PacketSize = 0; + rfd->PacketSize = 0; } - nic_return_rfd(etdev, pMpRfd); - return pMpRfd; + nic_return_rfd(etdev, rfd); + return rfd; } /** @@ -1050,7 +1050,7 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev) */ void et131x_reset_recv(struct et131x_adapter *etdev) { - PMP_RFD pMpRfd; + PMP_RFD rfd; struct list_head *element; WARN_ON(list_empty(&etdev->RxRing.RecvList)); @@ -1061,9 +1061,9 @@ void et131x_reset_recv(struct et131x_adapter *etdev) while (!list_empty(&etdev->RxRing.RecvPendingList)) { element = etdev->RxRing.RecvPendingList.next; - pMpRfd = (PMP_RFD) list_entry(element, MP_RFD, list_node); + rfd = (PMP_RFD) list_entry(element, MP_RFD, list_node); - list_move_tail(&pMpRfd->list_node, &etdev->RxRing.RecvList); + list_move_tail(&rfd->list_node, &etdev->RxRing.RecvList); } } @@ -1075,27 +1075,24 @@ void et131x_reset_recv(struct et131x_adapter *etdev) */ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev) { - PMP_RFD pMpRfd = NULL; - struct sk_buff *PacketArray[NUM_PACKETS_HANDLED]; - PMP_RFD RFDFreeArray[NUM_PACKETS_HANDLED]; - uint32_t PacketArrayCount = 0; - uint32_t PacketsToHandle; - uint32_t PacketFreeCount = 0; - bool TempUnfinishedRec = false; - - PacketsToHandle = NUM_PACKETS_HANDLED; + PMP_RFD rfd = NULL; + struct sk_buff *packets[NUM_PACKETS_HANDLED]; + PMP_RFD freed[NUM_PACKETS_HANDLED]; + u32 count = 0; + u32 nfree = 0; + bool done = true; /* Process up to available RFD's */ - while (PacketArrayCount < PacketsToHandle) { + while (count < NUM_PACKETS_HANDLED) { if (list_empty(&etdev->RxRing.RecvList)) { WARN_ON(etdev->RxRing.nReadyRecv != 0); - TempUnfinishedRec = true; + done = false; break; } - pMpRfd = nic_rx_pkts(etdev); + rfd = nic_rx_pkts(etdev); - if (pMpRfd == NULL) + if (rfd == NULL) break; /* Do not receive any packets until a filter has been set. @@ -1105,7 +1102,7 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev) */ if (!etdev->PacketFilter || !(etdev->Flags & fMP_ADAPTER_LINK_DETECTION) || - pMpRfd->PacketSize == 0) { + rfd->PacketSize == 0) { continue; } @@ -1123,25 +1120,24 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev) * pending list anyway. */ } else { - RFDFreeArray[PacketFreeCount] = pMpRfd; - PacketFreeCount++; + freed[nfree] = rfd; + nfree++; dev_warn(&etdev->pdev->dev, "RFD's are running out\n"); } - PacketArray[PacketArrayCount] = pMpRfd->Packet; - PacketArrayCount++; + packets[count] = rfd->Packet; + count++; } - if ((PacketArrayCount == NUM_PACKETS_HANDLED) || TempUnfinishedRec) { + if (count == NUM_PACKETS_HANDLED || !done) { etdev->RxRing.UnfinishedReceives = true; writel(PARM_TX_TIME_INT_DEF * NANO_IN_A_MICRO, &etdev->regs->global.watchdog_timer); - } else { + } else /* Watchdog timer will disable itself if appropriate. */ etdev->RxRing.UnfinishedReceives = false; - } } static inline u32 bump_fbr(u32 *fbr, u32 limit) @@ -1165,14 +1161,14 @@ static inline u32 bump_fbr(u32 *fbr, u32 limit) /** * NICReturnRFD - Recycle a RFD and put it back onto the receive list * @etdev: pointer to our adapter - * @pMpRfd: pointer to the RFD + * @rfd: pointer to the RFD */ -void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd) +void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD rfd) { struct _rx_ring_t *rx_local = &etdev->RxRing; struct _RXDMA_t __iomem *rx_dma = &etdev->regs->rxdma; - uint16_t bi = pMpRfd->bufferindex; - uint8_t ri = pMpRfd->ringindex; + uint16_t bi = rfd->bufferindex; + uint8_t ri = rfd->ringindex; unsigned long flags; /* We don't use any of the OOB data besides status. Otherwise, we @@ -1186,7 +1182,7 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd) spin_lock_irqsave(&etdev->FbrLock, flags); if (ri == 1) { - PFBR_DESC_t pNextDesc = + PFBR_DESC_t next = (PFBR_DESC_t) (rx_local->pFbr1RingVa) + INDEX10(rx_local->local_Fbr1_full); @@ -1194,9 +1190,9 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd) * the PA / Buffer Index for the returned buffer into * the oldest (next to be freed)FBR entry */ - pNextDesc->addr_hi = rx_local->Fbr[1]->PAHigh[bi]; - pNextDesc->addr_lo = rx_local->Fbr[1]->PALow[bi]; - pNextDesc->word2.value = bi; + next->addr_hi = rx_local->Fbr[1]->PAHigh[bi]; + next->addr_lo = rx_local->Fbr[1]->PALow[bi]; + next->word2.value = bi; writel(bump_fbr(&rx_local->local_Fbr1_full, rx_local->Fbr1NumEntries - 1), @@ -1204,7 +1200,7 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd) } #ifdef USE_FBR0 else { - PFBR_DESC_t pNextDesc = + PFBR_DESC_t next = (PFBR_DESC_t) rx_local->pFbr0RingVa + INDEX10(rx_local->local_Fbr0_full); @@ -1212,9 +1208,9 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd) * the PA / Buffer Index for the returned buffer into * the oldest (next to be freed) FBR entry */ - pNextDesc->addr_hi = rx_local->Fbr[0]->PAHigh[bi]; - pNextDesc->addr_lo = rx_local->Fbr[0]->PALow[bi]; - pNextDesc->word2.value = bi; + next->addr_hi = rx_local->Fbr[0]->PAHigh[bi]; + next->addr_lo = rx_local->Fbr[0]->PALow[bi]; + next->word2.value = bi; writel(bump_fbr(&rx_local->local_Fbr0_full, rx_local->Fbr0NumEntries - 1), @@ -1231,7 +1227,7 @@ void nic_return_rfd(struct et131x_adapter *etdev, PMP_RFD pMpRfd) * our list */ spin_lock_irqsave(&etdev->RcvLock, flags); - list_add_tail(&pMpRfd->list_node, &rx_local->RecvList); + list_add_tail(&rfd->list_node, &rx_local->RecvList); rx_local->nReadyRecv++; spin_unlock_irqrestore(&etdev->RcvLock, flags); -- GitLab From 7f59b1bfa3149c81b332a8c2c3935111d97a5b20 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:49:04 +0100 Subject: [PATCH 106/235] Staging: et131x: Clean up the receive arrays We don't use them for anything having stripped out the debug gunge in the original driver. Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_rx.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c index 5d17abdf7119..f8fee252a944 100644 --- a/drivers/staging/et131x/et1310_rx.c +++ b/drivers/staging/et131x/et1310_rx.c @@ -1076,10 +1076,7 @@ void et131x_reset_recv(struct et131x_adapter *etdev) void et131x_handle_recv_interrupt(struct et131x_adapter *etdev) { PMP_RFD rfd = NULL; - struct sk_buff *packets[NUM_PACKETS_HANDLED]; - PMP_RFD freed[NUM_PACKETS_HANDLED]; u32 count = 0; - u32 nfree = 0; bool done = true; /* Process up to available RFD's */ @@ -1110,24 +1107,10 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev) etdev->Stats.ipackets++; /* Set the status on the packet, either resources or success */ - if (etdev->RxRing.nReadyRecv >= RFD_LOW_WATER_MARK) { - /* Put this RFD on the pending list - * - * NOTE: nic_rx_pkts() above is already returning the - * RFD to the RecvList, so don't additionally do that - * here. - * Besides, we don't really need (at this point) the - * pending list anyway. - */ - } else { - freed[nfree] = rfd; - nfree++; - + if (etdev->RxRing.nReadyRecv < RFD_LOW_WATER_MARK) { dev_warn(&etdev->pdev->dev, "RFD's are running out\n"); } - - packets[count] = rfd->Packet; count++; } -- GitLab From f432c55e14e3eae2258c0f222b8631255bcc0031 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:49:13 +0100 Subject: [PATCH 107/235] Staging: et131x: fold up simple wrapper functions Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_rx.c | 39 ++++-------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c index f8fee252a944..c6097b25f8bb 100644 --- a/drivers/staging/et131x/et1310_rx.c +++ b/drivers/staging/et131x/et1310_rx.c @@ -417,14 +417,16 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) MP_RFD, list_node); list_del(&rfd->list_node); - et131x_rfd_resources_free(adapter, rfd); + rfd->Packet = NULL; + kmem_cache_free(adapter->RxRing.RecvLookaside, rfd); } while (!list_empty(&rx_ring->RecvPendingList)) { rfd = (MP_RFD *) list_entry(rx_ring->RecvPendingList.next, MP_RFD, list_node); list_del(&rfd->list_node); - et131x_rfd_resources_free(adapter, rfd); + rfd->Packet = NULL; + kmem_cache_free(adapter->RxRing.RecvLookaside, rfd); } /* Free Free Buffer Ring 1 */ @@ -572,13 +574,7 @@ int et131x_init_recv(struct et131x_adapter *adapter) continue; } - status = et131x_rfd_resources_alloc(adapter, rfd); - if (status != 0) { - dev_err(&adapter->pdev->dev, - "Couldn't alloc packet for RFD\n"); - kmem_cache_free(rx_ring->RecvLookaside, rfd); - continue; - } + rfd->Packet = NULL; /* Add this RFD to the RecvList */ list_add_tail(&rfd->list_node, &rx_ring->RecvList); @@ -601,31 +597,6 @@ int et131x_init_recv(struct et131x_adapter *adapter) return status; } -/** - * et131x_rfd_resources_alloc - * @adapter: pointer to our private adapter structure - * @rfd: pointer to a RFD - * - * Returns 0 on success and errno on failure (as defined in errno.h) - */ -int et131x_rfd_resources_alloc(struct et131x_adapter *adapter, MP_RFD *rfd) -{ - rfd->Packet = NULL; - - return 0; -} - -/** - * et131x_rfd_resources_free - Free the packet allocated for the given RFD - * @adapter: pointer to our private adapter structure - * @rfd: pointer to a RFD - */ -void et131x_rfd_resources_free(struct et131x_adapter *adapter, MP_RFD *rfd) -{ - rfd->Packet = NULL; - kmem_cache_free(adapter->RxRing.RecvLookaside, rfd); -} - /** * ConfigRxDmaRegs - Start of Rx_DMA init sequence * @etdev: pointer to our adapter structure -- GitLab From 116badfe08c0ab8bcd54492a73b23bacb218ef54 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:49:21 +0100 Subject: [PATCH 108/235] Staging: et131x: Remove old SendWaitQueue code The Linux driver doesn't keep a pending queue as the old one did. so we can remove all the code related to it. Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_tx.c | 52 ++----------------------- drivers/staging/et131x/et1310_tx.h | 4 -- drivers/staging/et131x/et131x_adapter.h | 1 - drivers/staging/et131x/et131x_initpci.c | 1 - 4 files changed, 4 insertions(+), 54 deletions(-) diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c index b2e4950b002a..4aabfa312265 100644 --- a/drivers/staging/et131x/et1310_tx.c +++ b/drivers/staging/et131x/et1310_tx.c @@ -95,7 +95,6 @@ static void et131x_update_tcb_list(struct et131x_adapter *etdev); -static void et131x_check_send_wait_list(struct et131x_adapter *etdev); static inline void et131x_free_send_packet(struct et131x_adapter *etdev, struct tcb *tcb); static int et131x_send_packet(struct sk_buff *skb, @@ -310,8 +309,6 @@ void et131x_init_send(struct et131x_adapter *adapter) /* Curr send queue should now be empty */ tx_ring->CurrSendHead = NULL; tx_ring->CurrSendTail = NULL; - - INIT_LIST_HEAD(&adapter->tx_ring.SendWaitQueue); } /** @@ -334,9 +331,8 @@ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev) * to Tx, so the PacketCount and it's array used makes no sense here */ - /* Queue is not empty or TCB is not available */ - if (!list_empty(&etdev->tx_ring.SendWaitQueue) || - MP_TCB_RESOURCES_NOT_AVAILABLE(etdev)) { + /* TCB is not available */ + if (MP_TCB_RESOURCES_NOT_AVAILABLE(etdev)) { /* NOTE: If there's an error on send, no need to queue the * packet under Linux; if we just send an error up to the * netif layer, it will resend the skb to us. @@ -392,7 +388,7 @@ static int et131x_send_packet(struct sk_buff *skb, { int status = 0; struct tcb *tcb = NULL; - uint16_t *shbufva; + u16 *shbufva; unsigned long flags; /* All packets must have at least a MAC address and a protocol type */ @@ -420,7 +416,7 @@ static int et131x_send_packet(struct sk_buff *skb, tcb->Packet = skb; if ((skb->data != NULL) && ((skb->len - skb->data_len) >= 6)) { - shbufva = (uint16_t *) skb->data; + shbufva = (u16 *) skb->data; if ((shbufva[0] == 0xffff) && (shbufva[1] == 0xffff) && (shbufva[2] == 0xffff)) { @@ -755,17 +751,6 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev) unsigned long flags; u32 freed = 0; - while (!list_empty(&etdev->tx_ring.SendWaitQueue)) { - spin_lock_irqsave(&etdev->SendWaitLock, flags); - - etdev->tx_ring.nWaitSend--; - spin_unlock_irqrestore(&etdev->SendWaitLock, flags); - - entry = etdev->tx_ring.SendWaitQueue.next; - } - - etdev->tx_ring.nWaitSend = 0; - /* Any packets being sent? Check the first TCB on the send list */ spin_lock_irqsave(&etdev->TCBSendQLock, flags); @@ -811,11 +796,6 @@ void et131x_handle_send_interrupt(struct et131x_adapter *etdev) { /* Mark as completed any packets which have been sent by the device. */ et131x_update_tcb_list(etdev); - - /* If we queued any transmits because we didn't have any TCBs earlier, - * dequeue and send those packets now, as long as we have free TCBs. - */ - et131x_check_send_wait_list(etdev); } /** @@ -881,27 +861,3 @@ static void et131x_update_tcb_list(struct et131x_adapter *etdev) spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); } -/** - * et131x_check_send_wait_list - Helper routine for the interrupt handler - * @etdev: pointer to our adapter - * - * Takes packets from the send wait queue and posts them to the device (if - * room available). - */ -static void et131x_check_send_wait_list(struct et131x_adapter *etdev) -{ - unsigned long flags; - - spin_lock_irqsave(&etdev->SendWaitLock, flags); - - while (!list_empty(&etdev->tx_ring.SendWaitQueue) && - MP_TCB_RESOURCES_AVAILABLE(etdev)) { - struct list_head *entry; - - entry = etdev->tx_ring.SendWaitQueue.next; - - etdev->tx_ring.nWaitSend--; - } - - spin_unlock_irqrestore(&etdev->SendWaitLock, flags); -} diff --git a/drivers/staging/et131x/et1310_tx.h b/drivers/staging/et131x/et1310_tx.h index 9a31e97405e8..44ea9bb05b27 100644 --- a/drivers/staging/et131x/et1310_tx.h +++ b/drivers/staging/et131x/et1310_tx.h @@ -155,10 +155,6 @@ struct tx_ring { struct tcb *CurrSendTail; int nBusySend; - /* List of packets (not TCBs) that were queued for lack of resources */ - struct list_head SendWaitQueue; - int nWaitSend; - /* The actual descriptor ring */ struct tx_desc *tx_desc_ring; dma_addr_t tx_desc_ring_pa; diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h index 283d08aa31e6..a512f62469f4 100644 --- a/drivers/staging/et131x/et131x_adapter.h +++ b/drivers/staging/et131x/et131x_adapter.h @@ -203,7 +203,6 @@ struct et131x_adapter { spinlock_t TCBSendQLock; spinlock_t TCBReadyQLock; spinlock_t SendHWLock; - spinlock_t SendWaitLock; spinlock_t RcvLock; spinlock_t RcvPendLock; diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c index b76fa73395e8..6ac7502a4054 100644 --- a/drivers/staging/et131x/et131x_initpci.c +++ b/drivers/staging/et131x/et131x_initpci.c @@ -555,7 +555,6 @@ static struct et131x_adapter *et131x_adapter_init(struct net_device *netdev, spin_lock_init(&etdev->TCBSendQLock); spin_lock_init(&etdev->TCBReadyQLock); spin_lock_init(&etdev->SendHWLock); - spin_lock_init(&etdev->SendWaitLock); spin_lock_init(&etdev->RcvLock); spin_lock_init(&etdev->RcvPendLock); spin_lock_init(&etdev->FbrLock); -- GitLab From c1996fc2ee1df6ecefe9f950f196cfc9b1d403e4 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:49:29 +0100 Subject: [PATCH 109/235] Staging: et131x: tidy up a bit further Clean up the minor uglies left from the previous work Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_tx.c | 67 ++++++------------------- drivers/staging/et131x/et131x_adapter.h | 6 --- 2 files changed, 16 insertions(+), 57 deletions(-) diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c index 4aabfa312265..5fe72ba652f8 100644 --- a/drivers/staging/et131x/et1310_tx.c +++ b/drivers/staging/et131x/et1310_tx.c @@ -94,7 +94,6 @@ #include "et1310_tx.h" -static void et131x_update_tcb_list(struct et131x_adapter *etdev); static inline void et131x_free_send_packet(struct et131x_adapter *etdev, struct tcb *tcb); static int et131x_send_packet(struct sk_buff *skb, @@ -230,15 +229,10 @@ void ConfigTxDmaRegs(struct et131x_adapter *etdev) /* Initialise the transmit DMA engine */ writel(NUM_DESC_PER_RING_TX - 1, &txdma->pr_num_des.value); - /* Load the completion writeback physical address - * - * NOTE: pci_alloc_consistent(), used above to alloc DMA regions, - * ALWAYS returns SAC (32-bit) addresses. If DAC (64-bit) addresses - * are ever returned, make sure the high part is retrieved here before - * storing the adjusted address. - */ - writel(0, &txdma->dma_wb_base_hi); - writel(etdev->tx_ring.pTxStatusPa, &txdma->dma_wb_base_lo); + /* Load the completion writeback physical address */ + writel((u32)((u64)etdev->tx_ring.pTxStatusPa >> 32), + &txdma->dma_wb_base_hi); + writel((u32)etdev->tx_ring.pTxStatusPa, &txdma->dma_wb_base_lo); memset(etdev->tx_ring.pTxStatusVa, 0, sizeof(TX_STATUS_BLOCK_t)); @@ -279,7 +273,7 @@ void et131x_tx_dma_enable(struct et131x_adapter *etdev) void et131x_init_send(struct et131x_adapter *adapter) { struct tcb *tcb; - u32 count; + u32 ct; struct tx_ring *tx_ring; /* Setup some convenience pointers */ @@ -289,23 +283,22 @@ void et131x_init_send(struct et131x_adapter *adapter) tx_ring->TCBReadyQueueHead = tcb; /* Go through and set up each TCB */ - for (count = 0; count < NUM_TCB; count++) { + for (ct = 0; ct < NUM_TCB; ct++) { memset(tcb, 0, sizeof(struct tcb)); /* Set the link pointer in HW TCB to the next TCB in the * chain. If this is the last TCB in the chain, also set the * tail pointer. */ - if (count < NUM_TCB - 1) { + if (ct < NUM_TCB - 1) tcb->Next = tcb + 1; - } else { + else { tx_ring->TCBReadyQueueTail = tcb; tcb->Next = NULL; } tcb++; } - /* Curr send queue should now be empty */ tx_ring->CurrSendHead = NULL; tx_ring->CurrSendTail = NULL; @@ -332,7 +325,7 @@ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev) */ /* TCB is not available */ - if (MP_TCB_RESOURCES_NOT_AVAILABLE(etdev)) { + if (etdev->tx_ring.nBusySend >= NUM_TCB) { /* NOTE: If there's an error on send, no need to queue the * packet under Linux; if we just send an error up to the * netif layer, it will resend the skb to us. @@ -342,26 +335,15 @@ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev) /* We need to see if the link is up; if it's not, make the * netif layer think we're good and drop the packet */ - /* - * if( MP_SHOULD_FAIL_SEND( etdev ) || - * etdev->DriverNoPhyAccess ) - */ - if (MP_SHOULD_FAIL_SEND(etdev) || !netif_carrier_ok(netdev)) { + if ((etdev->Flags & fMP_ADAPTER_FAIL_SEND_MASK) || + !netif_carrier_ok(netdev)) { dev_kfree_skb_any(skb); skb = NULL; etdev->net_stats.tx_dropped++; } else { status = et131x_send_packet(skb, etdev); - - if (status == -ENOMEM) { - - /* NOTE: If there's an error on send, no need - * to queue the packet under Linux; if we just - * send an error up to the netif layer, it - * will resend the skb to us. - */ - } else if (status != 0) { + if (status != 0 && status != -ENOMEM) { /* On any other error, make netif think we're * OK and drop the packet */ @@ -386,7 +368,7 @@ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev) static int et131x_send_packet(struct sk_buff *skb, struct et131x_adapter *etdev) { - int status = 0; + int status; struct tcb *tcb = NULL; u16 *shbufva; unsigned long flags; @@ -429,8 +411,7 @@ static int et131x_send_packet(struct sk_buff *skb, tcb->Next = NULL; /* Call the NIC specific send handler. */ - if (status == 0) - status = nic_send_packet(etdev, tcb); + status = nic_send_packet(etdev, tcb); if (status != 0) { spin_lock_irqsave(&etdev->TCBReadyQLock, flags); @@ -725,12 +706,11 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev, etdev->Stats.opackets++; - if (etdev->tx_ring.TCBReadyQueueTail) { + if (etdev->tx_ring.TCBReadyQueueTail) etdev->tx_ring.TCBReadyQueueTail->Next = tcb; - } else { + else /* Apparently ready Q is empty. */ etdev->tx_ring.TCBReadyQueueHead = tcb; - } etdev->tx_ring.TCBReadyQueueTail = tcb; @@ -747,7 +727,6 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev, void et131x_free_busy_send_packets(struct et131x_adapter *etdev) { struct tcb *tcb; - struct list_head *entry; unsigned long flags; u32 freed = 0; @@ -793,20 +772,6 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev) * Assumption - Send spinlock has been acquired */ void et131x_handle_send_interrupt(struct et131x_adapter *etdev) -{ - /* Mark as completed any packets which have been sent by the device. */ - et131x_update_tcb_list(etdev); -} - -/** - * et131x_update_tcb_list - Helper routine for Send Interrupt handler - * @etdev: pointer to our adapter - * - * Re-claims the send resources and completes sends. Can also be called as - * part of the NIC send routine when the "ServiceComplete" indication has - * wrapped. - */ -static void et131x_update_tcb_list(struct et131x_adapter *etdev) { unsigned long flags; u32 serviced; diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h index a512f62469f4..cc5a6ba55dcf 100644 --- a/drivers/staging/et131x/et131x_adapter.h +++ b/drivers/staging/et131x/et131x_adapter.h @@ -100,12 +100,6 @@ #define LO_MARK_PERCENT_FOR_PSR 15 #define LO_MARK_PERCENT_FOR_RX 15 -/* Macros specific to the private adapter structure */ -#define MP_TCB_RESOURCES_AVAILABLE(_M) ((_M)->tx_ring.nBusySend < NUM_TCB) -#define MP_TCB_RESOURCES_NOT_AVAILABLE(_M) ((_M)->tx_ring.nBusySend >= NUM_TCB) - -#define MP_SHOULD_FAIL_SEND(_M) ((_M)->Flags & fMP_ADAPTER_FAIL_SEND_MASK) - /* Counters for error rate monitoring */ typedef struct _MP_ERR_COUNTERS { u32 PktCountTxPackets; -- GitLab From 9251d71a4ec3e20189bb182cdc3af00f1152da81 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:49:36 +0100 Subject: [PATCH 110/235] Staging: et131x: Clean up the tx ring init Keep this small change separate for bisectability Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_tx.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c index 5fe72ba652f8..e9f30b5a3564 100644 --- a/drivers/staging/et131x/et1310_tx.c +++ b/drivers/staging/et131x/et1310_tx.c @@ -282,23 +282,19 @@ void et131x_init_send(struct et131x_adapter *adapter) tx_ring->TCBReadyQueueHead = tcb; - /* Go through and set up each TCB */ - for (ct = 0; ct < NUM_TCB; ct++) { - memset(tcb, 0, sizeof(struct tcb)); + memset(tcb, 0, sizeof(struct tcb) * NUM_TCB); + /* Go through and set up each TCB */ + for (ct = 0; ct++ < NUM_TCB; tcb++) { /* Set the link pointer in HW TCB to the next TCB in the * chain. If this is the last TCB in the chain, also set the * tail pointer. */ - if (ct < NUM_TCB - 1) - tcb->Next = tcb + 1; - else { - tx_ring->TCBReadyQueueTail = tcb; - tcb->Next = NULL; - } + tcb->Next = tcb + 1; - tcb++; - } + tcb--; + tx_ring->TCBReadyQueueTail = tcb; + tcb->Next = NULL; /* Curr send queue should now be empty */ tx_ring->CurrSendHead = NULL; tx_ring->CurrSendTail = NULL; -- GitLab From c78732ad75b3917f6a93292be1612527d9c0be9d Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:49:45 +0100 Subject: [PATCH 111/235] Staging: et131x: Clean up tx naming Clean up the names to be Linux like Remove the unused pad buffer Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_tx.c | 234 +++++++++++-------------- drivers/staging/et131x/et1310_tx.h | 87 +++------ drivers/staging/et131x/et131x_isr.c | 4 +- drivers/staging/et131x/et131x_netdev.c | 10 +- 4 files changed, 142 insertions(+), 193 deletions(-) diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c index e9f30b5a3564..b2b4b6884469 100644 --- a/drivers/staging/et131x/et1310_tx.c +++ b/drivers/staging/et131x/et1310_tx.c @@ -118,9 +118,9 @@ int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter) struct tx_ring *tx_ring = &adapter->tx_ring; /* Allocate memory for the TCB's (Transmit Control Block) */ - adapter->tx_ring.MpTcbMem = (struct tcb *) + adapter->tx_ring.tcb_ring = (struct tcb *) kcalloc(NUM_TCB, sizeof(struct tcb), GFP_ATOMIC | GFP_DMA); - if (!adapter->tx_ring.MpTcbMem) { + if (!adapter->tx_ring.tcb_ring) { dev_err(&adapter->pdev->dev, "Cannot alloc memory for TCBs\n"); return -ENOMEM; } @@ -145,25 +145,14 @@ int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter) * storing the adjusted address. */ /* Allocate memory for the Tx status block */ - tx_ring->pTxStatusVa = pci_alloc_consistent(adapter->pdev, - sizeof(TX_STATUS_BLOCK_t), - &tx_ring->pTxStatusPa); - if (!adapter->tx_ring.pTxStatusPa) { + tx_ring->tx_status = pci_alloc_consistent(adapter->pdev, + sizeof(u32), + &tx_ring->tx_status_pa); + if (!adapter->tx_ring.tx_status_pa) { dev_err(&adapter->pdev->dev, "Cannot alloc memory for Tx status block\n"); return -ENOMEM; } - - /* Allocate memory for a dummy buffer */ - tx_ring->pTxDummyBlkVa = pci_alloc_consistent(adapter->pdev, - NIC_MIN_PACKET_SIZE, - &tx_ring->pTxDummyBlkPa); - if (!adapter->tx_ring.pTxDummyBlkPa) { - dev_err(&adapter->pdev->dev, - "Cannot alloc memory for Tx dummy buffer\n"); - return -ENOMEM; - } - return 0; } @@ -189,27 +178,16 @@ void et131x_tx_dma_memory_free(struct et131x_adapter *adapter) } /* Free memory for the Tx status block */ - if (adapter->tx_ring.pTxStatusVa) { - pci_free_consistent(adapter->pdev, - sizeof(TX_STATUS_BLOCK_t), - adapter->tx_ring.pTxStatusVa, - adapter->tx_ring.pTxStatusPa); - - adapter->tx_ring.pTxStatusVa = NULL; - } - - /* Free memory for the dummy buffer */ - if (adapter->tx_ring.pTxDummyBlkVa) { + if (adapter->tx_ring.tx_status) { pci_free_consistent(adapter->pdev, - NIC_MIN_PACKET_SIZE, - adapter->tx_ring.pTxDummyBlkVa, - adapter->tx_ring.pTxDummyBlkPa); + sizeof(u32), + adapter->tx_ring.tx_status, + adapter->tx_ring.tx_status_pa); - adapter->tx_ring.pTxDummyBlkVa = NULL; + adapter->tx_ring.tx_status = NULL; } - /* Free the memory for the tcb structures */ - kfree(adapter->tx_ring.MpTcbMem); + kfree(adapter->tx_ring.tcb_ring); } /** @@ -230,14 +208,14 @@ void ConfigTxDmaRegs(struct et131x_adapter *etdev) writel(NUM_DESC_PER_RING_TX - 1, &txdma->pr_num_des.value); /* Load the completion writeback physical address */ - writel((u32)((u64)etdev->tx_ring.pTxStatusPa >> 32), + writel((u32)((u64)etdev->tx_ring.tx_status_pa >> 32), &txdma->dma_wb_base_hi); - writel((u32)etdev->tx_ring.pTxStatusPa, &txdma->dma_wb_base_lo); + writel((u32)etdev->tx_ring.tx_status_pa, &txdma->dma_wb_base_lo); - memset(etdev->tx_ring.pTxStatusVa, 0, sizeof(TX_STATUS_BLOCK_t)); + *etdev->tx_ring.tx_status = 0; writel(0, &txdma->service_request); - etdev->tx_ring.txDmaReadyToSend = 0; + etdev->tx_ring.send_idx = 0; } /** @@ -278,26 +256,26 @@ void et131x_init_send(struct et131x_adapter *adapter) /* Setup some convenience pointers */ tx_ring = &adapter->tx_ring; - tcb = adapter->tx_ring.MpTcbMem; + tcb = adapter->tx_ring.tcb_ring; - tx_ring->TCBReadyQueueHead = tcb; + tx_ring->tcb_qhead = tcb; memset(tcb, 0, sizeof(struct tcb) * NUM_TCB); /* Go through and set up each TCB */ - for (ct = 0; ct++ < NUM_TCB; tcb++) { + for (ct = 0; ct++ < NUM_TCB; tcb++) /* Set the link pointer in HW TCB to the next TCB in the * chain. If this is the last TCB in the chain, also set the * tail pointer. */ - tcb->Next = tcb + 1; + tcb->next = tcb + 1; tcb--; - tx_ring->TCBReadyQueueTail = tcb; - tcb->Next = NULL; + tx_ring->tcb_qtail = tcb; + tcb->next = NULL; /* Curr send queue should now be empty */ - tx_ring->CurrSendHead = NULL; - tx_ring->CurrSendTail = NULL; + tx_ring->send_head = NULL; + tx_ring->send_tail = NULL; } /** @@ -321,7 +299,7 @@ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev) */ /* TCB is not available */ - if (etdev->tx_ring.nBusySend >= NUM_TCB) { + if (etdev->tx_ring.used >= NUM_TCB) { /* NOTE: If there's an error on send, no need to queue the * packet under Linux; if we just send an error up to the * netif layer, it will resend the skb to us. @@ -376,35 +354,35 @@ static int et131x_send_packet(struct sk_buff *skb, /* Get a TCB for this packet */ spin_lock_irqsave(&etdev->TCBReadyQLock, flags); - tcb = etdev->tx_ring.TCBReadyQueueHead; + tcb = etdev->tx_ring.tcb_qhead; if (tcb == NULL) { spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags); return -ENOMEM; } - etdev->tx_ring.TCBReadyQueueHead = tcb->Next; + etdev->tx_ring.tcb_qhead = tcb->next; - if (etdev->tx_ring.TCBReadyQueueHead == NULL) - etdev->tx_ring.TCBReadyQueueTail = NULL; + if (etdev->tx_ring.tcb_qhead == NULL) + etdev->tx_ring.tcb_qtail = NULL; spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags); - tcb->PacketLength = skb->len; - tcb->Packet = skb; + tcb->len = skb->len; + tcb->skb = skb; if ((skb->data != NULL) && ((skb->len - skb->data_len) >= 6)) { shbufva = (u16 *) skb->data; if ((shbufva[0] == 0xffff) && (shbufva[1] == 0xffff) && (shbufva[2] == 0xffff)) { - tcb->Flags |= fMP_DEST_BROAD; + tcb->flags |= fMP_DEST_BROAD; } else if ((shbufva[0] & 0x3) == 0x0001) { - tcb->Flags |= fMP_DEST_MULTI; + tcb->flags |= fMP_DEST_MULTI; } } - tcb->Next = NULL; + tcb->next = NULL; /* Call the NIC specific send handler. */ status = nic_send_packet(etdev, tcb); @@ -412,18 +390,18 @@ static int et131x_send_packet(struct sk_buff *skb, if (status != 0) { spin_lock_irqsave(&etdev->TCBReadyQLock, flags); - if (etdev->tx_ring.TCBReadyQueueTail) { - etdev->tx_ring.TCBReadyQueueTail->Next = tcb; + if (etdev->tx_ring.tcb_qtail) { + etdev->tx_ring.tcb_qtail->next = tcb; } else { /* Apparently ready Q is empty. */ - etdev->tx_ring.TCBReadyQueueHead = tcb; + etdev->tx_ring.tcb_qhead = tcb; } - etdev->tx_ring.TCBReadyQueueTail = tcb; + etdev->tx_ring.tcb_qtail = tcb; spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags); return status; } - WARN_ON(etdev->tx_ring.nBusySend > NUM_TCB); + WARN_ON(etdev->tx_ring.used > NUM_TCB); return 0; } @@ -440,7 +418,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, struct tcb *tcb) struct tx_desc desc[24]; /* 24 x 16 byte */ u32 frag = 0; u32 thiscopy, remainder; - struct sk_buff *skb = tcb->Packet; + struct sk_buff *skb = tcb->skb; u32 nr_frags = skb_shinfo(skb)->nr_frags + 1; struct skb_frag_struct *frags = &skb_shinfo(skb)->frags[0]; unsigned long flags; @@ -558,26 +536,26 @@ static int nic_send_packet(struct et131x_adapter *etdev, struct tcb *tcb) return -EIO; if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) { - if (++etdev->tx_ring.TxPacketsSinceLastinterrupt == + if (++etdev->tx_ring.since_irq == PARM_TX_NUM_BUFS_DEF) { /* Last element & Interrupt flag */ desc[frag - 1].flags = 0x5; - etdev->tx_ring.TxPacketsSinceLastinterrupt = 0; + etdev->tx_ring.since_irq = 0; } else { /* Last element */ desc[frag - 1].flags = 0x1; } - } else { + } else desc[frag - 1].flags = 0x5; - } + desc[0].flags |= 2; /* First element flag */ - tcb->WrIndexStart = etdev->tx_ring.txDmaReadyToSend; - tcb->PacketStaleCount = 0; + tcb->index_start = etdev->tx_ring.send_idx; + tcb->stale = 0; spin_lock_irqsave(&etdev->SendHWLock, flags); thiscopy = NUM_DESC_PER_RING_TX - - INDEX10(etdev->tx_ring.txDmaReadyToSend); + INDEX10(etdev->tx_ring.send_idx); if (thiscopy >= frag) { remainder = 0; @@ -587,15 +565,15 @@ static int nic_send_packet(struct et131x_adapter *etdev, struct tcb *tcb) } memcpy(etdev->tx_ring.tx_desc_ring + - INDEX10(etdev->tx_ring.txDmaReadyToSend), desc, + INDEX10(etdev->tx_ring.send_idx), desc, sizeof(struct tx_desc) * thiscopy); - add_10bit(&etdev->tx_ring.txDmaReadyToSend, thiscopy); + add_10bit(&etdev->tx_ring.send_idx, thiscopy); - if (INDEX10(etdev->tx_ring.txDmaReadyToSend)== 0 || - INDEX10(etdev->tx_ring.txDmaReadyToSend) == NUM_DESC_PER_RING_TX) { - etdev->tx_ring.txDmaReadyToSend &= ~ET_DMA10_MASK; - etdev->tx_ring.txDmaReadyToSend ^= ET_DMA10_WRAP; + if (INDEX10(etdev->tx_ring.send_idx)== 0 || + INDEX10(etdev->tx_ring.send_idx) == NUM_DESC_PER_RING_TX) { + etdev->tx_ring.send_idx &= ~ET_DMA10_MASK; + etdev->tx_ring.send_idx ^= ET_DMA10_WRAP; } if (remainder) { @@ -603,34 +581,34 @@ static int nic_send_packet(struct et131x_adapter *etdev, struct tcb *tcb) desc + thiscopy, sizeof(struct tx_desc) * remainder); - add_10bit(&etdev->tx_ring.txDmaReadyToSend, remainder); + add_10bit(&etdev->tx_ring.send_idx, remainder); } - if (INDEX10(etdev->tx_ring.txDmaReadyToSend) == 0) { - if (etdev->tx_ring.txDmaReadyToSend) - tcb->WrIndex = NUM_DESC_PER_RING_TX - 1; + if (INDEX10(etdev->tx_ring.send_idx) == 0) { + if (etdev->tx_ring.send_idx) + tcb->index = NUM_DESC_PER_RING_TX - 1; else - tcb->WrIndex= ET_DMA10_WRAP | (NUM_DESC_PER_RING_TX - 1); + tcb->index= ET_DMA10_WRAP | (NUM_DESC_PER_RING_TX - 1); } else - tcb->WrIndex = etdev->tx_ring.txDmaReadyToSend - 1; + tcb->index = etdev->tx_ring.send_idx - 1; spin_lock(&etdev->TCBSendQLock); - if (etdev->tx_ring.CurrSendTail) - etdev->tx_ring.CurrSendTail->Next = tcb; + if (etdev->tx_ring.send_tail) + etdev->tx_ring.send_tail->next = tcb; else - etdev->tx_ring.CurrSendHead = tcb; + etdev->tx_ring.send_head = tcb; - etdev->tx_ring.CurrSendTail = tcb; + etdev->tx_ring.send_tail = tcb; - WARN_ON(tcb->Next != NULL); + WARN_ON(tcb->next != NULL); - etdev->tx_ring.nBusySend++; + etdev->tx_ring.used++; spin_unlock(&etdev->TCBSendQLock); /* Write the new write pointer back to the device. */ - writel(etdev->tx_ring.txDmaReadyToSend, + writel(etdev->tx_ring.send_idx, &etdev->regs->txdma.service_request); /* For Gig only, we use Tx Interrupt coalescing. Enable the software @@ -661,15 +639,15 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev, struct tx_desc *desc = NULL; struct net_device_stats *stats = &etdev->net_stats; - if (tcb->Flags & fMP_DEST_BROAD) + if (tcb->flags & fMP_DEST_BROAD) atomic_inc(&etdev->Stats.brdcstxmt); - else if (tcb->Flags & fMP_DEST_MULTI) + else if (tcb->flags & fMP_DEST_MULTI) atomic_inc(&etdev->Stats.multixmt); else atomic_inc(&etdev->Stats.unixmt); - if (tcb->Packet) { - stats->tx_bytes += tcb->Packet->len; + if (tcb->skb) { + stats->tx_bytes += tcb->skb->len; /* Iterate through the TX descriptors on the ring * corresponding to this packet and umap the fragments @@ -677,22 +655,22 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev, */ do { desc =(struct tx_desc *) (etdev->tx_ring.tx_desc_ring + - INDEX10(tcb->WrIndexStart)); + INDEX10(tcb->index_start)); pci_unmap_single(etdev->pdev, desc->addr_lo, desc->len_vlan, PCI_DMA_TODEVICE); - add_10bit(&tcb->WrIndexStart, 1); - if (INDEX10(tcb->WrIndexStart) >= + add_10bit(&tcb->index_start, 1); + if (INDEX10(tcb->index_start) >= NUM_DESC_PER_RING_TX) { - tcb->WrIndexStart &= ~ET_DMA10_MASK; - tcb->WrIndexStart ^= ET_DMA10_WRAP; + tcb->index_start &= ~ET_DMA10_MASK; + tcb->index_start ^= ET_DMA10_WRAP; } } while (desc != (etdev->tx_ring.tx_desc_ring + - INDEX10(tcb->WrIndex))); + INDEX10(tcb->index))); - dev_kfree_skb_any(tcb->Packet); + dev_kfree_skb_any(tcb->skb); } memset(tcb, 0, sizeof(struct tcb)); @@ -702,16 +680,16 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev, etdev->Stats.opackets++; - if (etdev->tx_ring.TCBReadyQueueTail) - etdev->tx_ring.TCBReadyQueueTail->Next = tcb; + if (etdev->tx_ring.tcb_qtail) + etdev->tx_ring.tcb_qtail->next = tcb; else /* Apparently ready Q is empty. */ - etdev->tx_ring.TCBReadyQueueHead = tcb; + etdev->tx_ring.tcb_qhead = tcb; - etdev->tx_ring.TCBReadyQueueTail = tcb; + etdev->tx_ring.tcb_qtail = tcb; spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags); - WARN_ON(etdev->tx_ring.nBusySend < 0); + WARN_ON(etdev->tx_ring.used < 0); } /** @@ -729,17 +707,17 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev) /* Any packets being sent? Check the first TCB on the send list */ spin_lock_irqsave(&etdev->TCBSendQLock, flags); - tcb = etdev->tx_ring.CurrSendHead; + tcb = etdev->tx_ring.send_head; while ((tcb != NULL) && (freed < NUM_TCB)) { - struct tcb *pNext = tcb->Next; + struct tcb *next = tcb->next; - etdev->tx_ring.CurrSendHead = pNext; + etdev->tx_ring.send_head = next; - if (pNext == NULL) - etdev->tx_ring.CurrSendTail = NULL; + if (next == NULL) + etdev->tx_ring.send_tail = NULL; - etdev->tx_ring.nBusySend--; + etdev->tx_ring.used--; spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); @@ -748,14 +726,14 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev) spin_lock_irqsave(&etdev->TCBSendQLock, flags); - tcb = etdev->tx_ring.CurrSendHead; + tcb = etdev->tx_ring.send_head; } WARN_ON(freed == NUM_TCB); spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); - etdev->tx_ring.nBusySend = 0; + etdev->tx_ring.used = 0; } /** @@ -782,41 +760,41 @@ void et131x_handle_send_interrupt(struct et131x_adapter *etdev) */ spin_lock_irqsave(&etdev->TCBSendQLock, flags); - tcb = etdev->tx_ring.CurrSendHead; + tcb = etdev->tx_ring.send_head; while (tcb && - ((serviced ^ tcb->WrIndex) & ET_DMA10_WRAP) && - index < INDEX10(tcb->WrIndex)) { - etdev->tx_ring.nBusySend--; - etdev->tx_ring.CurrSendHead = tcb->Next; - if (tcb->Next == NULL) - etdev->tx_ring.CurrSendTail = NULL; + ((serviced ^ tcb->index) & ET_DMA10_WRAP) && + index < INDEX10(tcb->index)) { + etdev->tx_ring.used--; + etdev->tx_ring.send_head = tcb->next; + if (tcb->next == NULL) + etdev->tx_ring.send_tail = NULL; spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); et131x_free_send_packet(etdev, tcb); spin_lock_irqsave(&etdev->TCBSendQLock, flags); /* Goto the next packet */ - tcb = etdev->tx_ring.CurrSendHead; + tcb = etdev->tx_ring.send_head; } while (tcb && - !((serviced ^ tcb->WrIndex) & ET_DMA10_WRAP) - && index > (tcb->WrIndex & ET_DMA10_MASK)) { - etdev->tx_ring.nBusySend--; - etdev->tx_ring.CurrSendHead = tcb->Next; - if (tcb->Next == NULL) - etdev->tx_ring.CurrSendTail = NULL; + !((serviced ^ tcb->index) & ET_DMA10_WRAP) + && index > (tcb->index & ET_DMA10_MASK)) { + etdev->tx_ring.used--; + etdev->tx_ring.send_head = tcb->next; + if (tcb->next == NULL) + etdev->tx_ring.send_tail = NULL; spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); et131x_free_send_packet(etdev, tcb); spin_lock_irqsave(&etdev->TCBSendQLock, flags); /* Goto the next packet */ - tcb = etdev->tx_ring.CurrSendHead; + tcb = etdev->tx_ring.send_head; } /* Wake up the queue when we hit a low-water mark */ - if (etdev->tx_ring.nBusySend <= (NUM_TCB / 3)) + if (etdev->tx_ring.used <= (NUM_TCB / 3)) netif_wake_queue(etdev->netdev); spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); diff --git a/drivers/staging/et131x/et1310_tx.h b/drivers/staging/et131x/et1310_tx.h index 44ea9bb05b27..3e2f281e2186 100644 --- a/drivers/staging/et131x/et1310_tx.h +++ b/drivers/staging/et131x/et1310_tx.h @@ -97,100 +97,71 @@ struct tx_desc { u32 flags; /* data (detailed above) */ }; -/* Typedefs for Tx DMA engine status writeback */ - /* - * TX_STATUS_BLOCK_t is sructure representing the status of the Tx DMA engine - * it sits in free memory, and is pointed to by 0x101c / 0x1020 + * The status of the Tx DMA engine it sits in free memory, and is pointed to + * by 0x101c / 0x1020. This is a DMA10 type */ -typedef union _tx_status_block_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 unused:21; /* bits 11-31 */ - u32 serv_cpl_wrap:1; /* bit 10 */ - u32 serv_cpl:10; /* bits 0-9 */ -#else - u32 serv_cpl:10; /* bits 0-9 */ - u32 serv_cpl_wrap:1; /* bit 10 */ - u32 unused:21; /* bits 11-31 */ -#endif - } bits; -} TX_STATUS_BLOCK_t, *PTX_STATUS_BLOCK_t; - -/* TCB (Transmit Control Block) */ + +/* TCB (Transmit Control Block: Host Side) */ struct tcb { - struct tcb *Next; - u32 Flags; - u32 Count; - u32 PacketStaleCount; - struct sk_buff *Packet; - u32 PacketLength; - u32 WrIndex; - u32 WrIndexStart; + struct tcb *next; /* Next entry in ring */ + u32 flags; /* Our flags for the packet */ + u32 count; + u32 stale; /* Used to spot stuck/lost packets */ + struct sk_buff *skb; /* Network skb we are tied to */ + u32 len; + u32 index; + u32 index_start; }; -/* Structure to hold the skb's in a list */ -typedef struct tx_skb_list_elem { - struct list_head skb_list_elem; - struct sk_buff *skb; -} TX_SKB_LIST_ELEM, *PTX_SKB_LIST_ELEM; - /* Structure representing our local reference(s) to the ring */ struct tx_ring { /* TCB (Transmit Control Block) memory and lists */ - struct tcb *MpTcbMem; + struct tcb *tcb_ring; /* List of TCBs that are ready to be used */ - struct tcb *TCBReadyQueueHead; - struct tcb *TCBReadyQueueTail; + struct tcb *tcb_qhead; + struct tcb *tcb_qtail; /* list of TCBs that are currently being sent. NOTE that access to all - * three of these (including nBusySend) are controlled via the + * three of these (including used) are controlled via the * TCBSendQLock. This lock should be secured prior to incementing / - * decrementing nBusySend, or any queue manipulation on CurrSendHead / + * decrementing used, or any queue manipulation on send_head / * Tail */ - struct tcb *CurrSendHead; - struct tcb *CurrSendTail; - int nBusySend; + struct tcb *send_head; + struct tcb *send_tail; + int used; /* The actual descriptor ring */ struct tx_desc *tx_desc_ring; dma_addr_t tx_desc_ring_pa; /* ReadyToSend indicates where we last wrote to in the descriptor ring. */ - u32 txDmaReadyToSend; + u32 send_idx; /* The location of the write-back status block */ - PTX_STATUS_BLOCK_t pTxStatusVa; - dma_addr_t pTxStatusPa; - - /* A Block of zeroes used to pad packets that are less than 60 bytes */ - void *pTxDummyBlkVa; - dma_addr_t pTxDummyBlkPa; + u32 *tx_status; + dma_addr_t tx_status_pa; TXMAC_ERR_t TxMacErr; /* Variables to track the Tx interrupt coalescing features */ - int TxPacketsSinceLastinterrupt; + int since_irq; }; -/* Forward declaration of the frag-list for the following prototypes */ -typedef struct _MP_FRAG_LIST MP_FRAG_LIST, *PMP_FRAG_LIST; - /* Forward declaration of the private adapter structure */ struct et131x_adapter; /* PROTOTYPES for et1310_tx.c */ int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter); void et131x_tx_dma_memory_free(struct et131x_adapter *adapter); -void ConfigTxDmaRegs(struct et131x_adapter *pAdapter); +void ConfigTxDmaRegs(struct et131x_adapter *adapter); void et131x_init_send(struct et131x_adapter *adapter); -void et131x_tx_dma_disable(struct et131x_adapter *pAdapter); -void et131x_tx_dma_enable(struct et131x_adapter *pAdapter); -void et131x_handle_send_interrupt(struct et131x_adapter *pAdapter); -void et131x_free_busy_send_packets(struct et131x_adapter *pAdapter); +void et131x_tx_dma_disable(struct et131x_adapter *adapter); +void et131x_tx_dma_enable(struct et131x_adapter *adapter); +void et131x_handle_send_interrupt(struct et131x_adapter *adapter); +void et131x_free_busy_send_packets(struct et131x_adapter *adapter); int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev); #endif /* __ET1310_TX_H__ */ diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c index c22067baa8a8..b6dab8c76993 100644 --- a/drivers/staging/et131x/et131x_isr.c +++ b/drivers/staging/et131x/et131x_isr.c @@ -179,10 +179,10 @@ irqreturn_t et131x_isr(int irq, void *dev_id) /* This is our interrupt, so process accordingly */ if (status & ET_INTR_WATCHDOG) { - struct tcb *tcb = adapter->tx_ring.CurrSendHead; + struct tcb *tcb = adapter->tx_ring.send_head; if (tcb) - if (++tcb->PacketStaleCount > 1) + if (++tcb->stale > 1) status |= ET_INTR_TXDMA_ISR; if (adapter->RxRing.UnfinishedReceives) diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c index 7c55f5d52d5c..24d97b4fa6fb 100644 --- a/drivers/staging/et131x/et131x_netdev.c +++ b/drivers/staging/et131x/et131x_netdev.c @@ -541,19 +541,19 @@ void et131x_tx_timeout(struct net_device *netdev) /* Is send stuck? */ spin_lock_irqsave(&etdev->TCBSendQLock, flags); - tcb = etdev->tx_ring.CurrSendHead; + tcb = etdev->tx_ring.send_head; if (tcb != NULL) { - tcb->Count++; + tcb->count++; - if (tcb->Count > NIC_SEND_HANG_THRESHOLD) { + if (tcb->count > NIC_SEND_HANG_THRESHOLD) { spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); dev_warn(&etdev->pdev->dev, "Send stuck - reset. tcb->WrIndex %x, Flags 0x%08x\n", - tcb->WrIndex, - tcb->Flags); + tcb->index, + tcb->flags); et131x_close(netdev); et131x_open(netdev); -- GitLab From fb034f841dae4b811901a23194484eaf62b60026 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:49:52 +0100 Subject: [PATCH 112/235] Staging: et131x: kill unused tcb fields Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_tx.c | 1 - drivers/staging/et131x/et1310_tx.h | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c index b2b4b6884469..a59818567ded 100644 --- a/drivers/staging/et131x/et1310_tx.c +++ b/drivers/staging/et131x/et1310_tx.c @@ -368,7 +368,6 @@ static int et131x_send_packet(struct sk_buff *skb, spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags); - tcb->len = skb->len; tcb->skb = skb; if ((skb->data != NULL) && ((skb->len - skb->data_len) >= 6)) { diff --git a/drivers/staging/et131x/et1310_tx.h b/drivers/staging/et131x/et1310_tx.h index 3e2f281e2186..eced34a3cf2d 100644 --- a/drivers/staging/et131x/et1310_tx.h +++ b/drivers/staging/et131x/et1310_tx.h @@ -106,11 +106,10 @@ struct tx_desc { struct tcb { struct tcb *next; /* Next entry in ring */ u32 flags; /* Our flags for the packet */ - u32 count; + u32 count; /* Used to spot stuck/lost packets */ u32 stale; /* Used to spot stuck/lost packets */ struct sk_buff *skb; /* Network skb we are tied to */ - u32 len; - u32 index; + u32 index; /* Ring indexes */ u32 index_start; }; -- GitLab From 1458d82b459198b16805eca54877ef16204cd33c Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:49:58 +0100 Subject: [PATCH 113/235] Staging: et131x: Bring tx into coding style Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_tx.c | 50 ++++++++++++++++-------------- drivers/staging/et131x/et1310_tx.h | 4 +-- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c index a59818567ded..d0c71db6c57c 100644 --- a/drivers/staging/et131x/et1310_tx.c +++ b/drivers/staging/et131x/et1310_tx.c @@ -133,7 +133,8 @@ int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter) (struct tx_desc *) pci_alloc_consistent(adapter->pdev, desc_size, &tx_ring->tx_desc_ring_pa); if (!adapter->tx_ring.tx_desc_ring) { - dev_err(&adapter->pdev->dev, "Cannot alloc memory for Tx Ring\n"); + dev_err(&adapter->pdev->dev, + "Cannot alloc memory for Tx Ring\n"); return -ENOMEM; } @@ -169,7 +170,7 @@ void et131x_tx_dma_memory_free(struct et131x_adapter *adapter) if (adapter->tx_ring.tx_desc_ring) { /* Free memory relating to Tx rings here */ desc_size = (sizeof(struct tx_desc) * NUM_DESC_PER_RING_TX) - + 4096 - 1; + + 4096 - 1; pci_free_consistent(adapter->pdev, desc_size, adapter->tx_ring.tx_desc_ring, @@ -193,6 +194,9 @@ void et131x_tx_dma_memory_free(struct et131x_adapter *adapter) /** * ConfigTxDmaRegs - Set up the tx dma section of the JAGCore. * @etdev: pointer to our private adapter structure + * + * Configure the transmit engine with the ring buffers we have created + * and prepare it for use. */ void ConfigTxDmaRegs(struct et131x_adapter *etdev) { @@ -265,11 +269,11 @@ void et131x_init_send(struct et131x_adapter *adapter) /* Go through and set up each TCB */ for (ct = 0; ct++ < NUM_TCB; tcb++) /* Set the link pointer in HW TCB to the next TCB in the - * chain. If this is the last TCB in the chain, also set the - * tail pointer. + * chain */ tcb->next = tcb + 1; + /* Set the tail pointer */ tcb--; tx_ring->tcb_qtail = tcb; tcb->next = NULL; @@ -370,7 +374,7 @@ static int et131x_send_packet(struct sk_buff *skb, tcb->skb = skb; - if ((skb->data != NULL) && ((skb->len - skb->data_len) >= 6)) { + if (skb->data != NULL && skb->len - skb->data_len >= 6) { shbufva = (u16 *) skb->data; if ((shbufva[0] == 0xffff) && @@ -389,12 +393,11 @@ static int et131x_send_packet(struct sk_buff *skb, if (status != 0) { spin_lock_irqsave(&etdev->TCBReadyQLock, flags); - if (etdev->tx_ring.tcb_qtail) { + if (etdev->tx_ring.tcb_qtail) etdev->tx_ring.tcb_qtail->next = tcb; - } else { + else /* Apparently ready Q is empty. */ etdev->tx_ring.tcb_qhead = tcb; - } etdev->tx_ring.tcb_qtail = tcb; spin_unlock_irqrestore(&etdev->TCBReadyQLock, flags); @@ -535,9 +538,8 @@ static int nic_send_packet(struct et131x_adapter *etdev, struct tcb *tcb) return -EIO; if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) { - if (++etdev->tx_ring.since_irq == - PARM_TX_NUM_BUFS_DEF) { - /* Last element & Interrupt flag */ + if (++etdev->tx_ring.since_irq == PARM_TX_NUM_BUFS_DEF) { + /* Last element & Interrupt flag */ desc[frag - 1].flags = 0x5; etdev->tx_ring.since_irq = 0; } else { /* Last element */ @@ -569,10 +571,10 @@ static int nic_send_packet(struct et131x_adapter *etdev, struct tcb *tcb) add_10bit(&etdev->tx_ring.send_idx, thiscopy); - if (INDEX10(etdev->tx_ring.send_idx)== 0 || - INDEX10(etdev->tx_ring.send_idx) == NUM_DESC_PER_RING_TX) { - etdev->tx_ring.send_idx &= ~ET_DMA10_MASK; - etdev->tx_ring.send_idx ^= ET_DMA10_WRAP; + if (INDEX10(etdev->tx_ring.send_idx) == 0 || + INDEX10(etdev->tx_ring.send_idx) == NUM_DESC_PER_RING_TX) { + etdev->tx_ring.send_idx &= ~ET_DMA10_MASK; + etdev->tx_ring.send_idx ^= ET_DMA10_WRAP; } if (remainder) { @@ -587,7 +589,7 @@ static int nic_send_packet(struct et131x_adapter *etdev, struct tcb *tcb) if (etdev->tx_ring.send_idx) tcb->index = NUM_DESC_PER_RING_TX - 1; else - tcb->index= ET_DMA10_WRAP | (NUM_DESC_PER_RING_TX - 1); + tcb->index = ET_DMA10_WRAP|(NUM_DESC_PER_RING_TX - 1); } else tcb->index = etdev->tx_ring.send_idx - 1; @@ -653,8 +655,8 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev, * they point to */ do { - desc =(struct tx_desc *) (etdev->tx_ring.tx_desc_ring + - INDEX10(tcb->index_start)); + desc = (struct tx_desc *)(etdev->tx_ring.tx_desc_ring + + INDEX10(tcb->index_start)); pci_unmap_single(etdev->pdev, desc->addr_lo, @@ -662,9 +664,9 @@ inline void et131x_free_send_packet(struct et131x_adapter *etdev, add_10bit(&tcb->index_start, 1); if (INDEX10(tcb->index_start) >= - NUM_DESC_PER_RING_TX) { - tcb->index_start &= ~ET_DMA10_MASK; - tcb->index_start ^= ET_DMA10_WRAP; + NUM_DESC_PER_RING_TX) { + tcb->index_start &= ~ET_DMA10_MASK; + tcb->index_start ^= ET_DMA10_WRAP; } } while (desc != (etdev->tx_ring.tx_desc_ring + INDEX10(tcb->index))); @@ -708,7 +710,7 @@ void et131x_free_busy_send_packets(struct et131x_adapter *etdev) tcb = etdev->tx_ring.send_head; - while ((tcb != NULL) && (freed < NUM_TCB)) { + while (tcb != NULL && freed < NUM_TCB) { struct tcb *next = tcb->next; etdev->tx_ring.send_head = next; @@ -748,7 +750,7 @@ void et131x_handle_send_interrupt(struct et131x_adapter *etdev) { unsigned long flags; u32 serviced; - struct tcb * tcb; + struct tcb *tcb; u32 index; serviced = readl(&etdev->regs->txdma.NewServiceComplete); @@ -793,7 +795,7 @@ void et131x_handle_send_interrupt(struct et131x_adapter *etdev) } /* Wake up the queue when we hit a low-water mark */ - if (etdev->tx_ring.used <= (NUM_TCB / 3)) + if (etdev->tx_ring.used <= NUM_TCB / 3) netif_wake_queue(etdev->netdev); spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); diff --git a/drivers/staging/et131x/et1310_tx.h b/drivers/staging/et131x/et1310_tx.h index eced34a3cf2d..60bb2c8a3063 100644 --- a/drivers/staging/et131x/et1310_tx.h +++ b/drivers/staging/et131x/et1310_tx.h @@ -126,7 +126,7 @@ struct tx_ring { * three of these (including used) are controlled via the * TCBSendQLock. This lock should be secured prior to incementing / * decrementing used, or any queue manipulation on send_head / - * Tail + * tail */ struct tcb *send_head; struct tcb *send_tail; @@ -136,7 +136,7 @@ struct tx_ring { struct tx_desc *tx_desc_ring; dma_addr_t tx_desc_ring_pa; - /* ReadyToSend indicates where we last wrote to in the descriptor ring. */ + /* send_idx indicates where we last wrote to in the descriptor ring. */ u32 send_idx; /* The location of the write-back status block */ -- GitLab From ceef1a5e0ebc3418c8dbd8644195cce3bcb6949f Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:50:05 +0100 Subject: [PATCH 114/235] Staging: et131x: tx ring mac error is only used as a local So make it a local Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_tx.h | 4 +--- drivers/staging/et131x/et131x_isr.c | 5 ++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/et131x/et1310_tx.h b/drivers/staging/et131x/et1310_tx.h index 60bb2c8a3063..4f0ea81978f5 100644 --- a/drivers/staging/et131x/et1310_tx.h +++ b/drivers/staging/et131x/et1310_tx.h @@ -143,9 +143,7 @@ struct tx_ring { u32 *tx_status; dma_addr_t tx_status_pa; - TXMAC_ERR_t TxMacErr; - - /* Variables to track the Tx interrupt coalescing features */ + /* Packets since the last IRQ: used for interrupt coalescing */ int since_irq; }; diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c index b6dab8c76993..ccd9bc22e185 100644 --- a/drivers/staging/et131x/et131x_isr.c +++ b/drivers/staging/et131x/et131x_isr.c @@ -397,8 +397,7 @@ void et131x_isr_handler(struct work_struct *work) /* Let's move on to the TxMac */ if (status & ET_INTR_TXMAC) { - etdev->tx_ring.TxMacErr.value = - readl(&iomem->txmac.err.value); + u32 err = readl(&iomem->txmac.err.value); /* * When any of the errors occur and TXMAC generates @@ -412,7 +411,7 @@ void et131x_isr_handler(struct work_struct *work) */ dev_warn(&etdev->pdev->dev, "TXMAC interrupt, error 0x%08x\n", - etdev->tx_ring.TxMacErr.value); + err); /* If we are debugging, we want to see this error, * otherwise we just want the device to be reset and -- GitLab From 5720f17502cefac0c80d5ce64bf4e345e957b0fc Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:50:12 +0100 Subject: [PATCH 115/235] Staging: et131x: Kill the RX pending list As with tx there was a pending list Linux doesn't use Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_rx.c | 22 ---------------------- drivers/staging/et131x/et1310_rx.h | 1 - 2 files changed, 23 deletions(-) diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c index c6097b25f8bb..4c4555dffd1f 100644 --- a/drivers/staging/et131x/et1310_rx.c +++ b/drivers/staging/et131x/et1310_rx.c @@ -390,7 +390,6 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) * lists now. */ INIT_LIST_HEAD(&rx_ring->RecvList); - INIT_LIST_HEAD(&rx_ring->RecvPendingList); return 0; } @@ -421,14 +420,6 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) kmem_cache_free(adapter->RxRing.RecvLookaside, rfd); } - while (!list_empty(&rx_ring->RecvPendingList)) { - rfd = (MP_RFD *) list_entry(rx_ring->RecvPendingList.next, - MP_RFD, list_node); - list_del(&rfd->list_node); - rfd->Packet = NULL; - kmem_cache_free(adapter->RxRing.RecvLookaside, rfd); - } - /* Free Free Buffer Ring 1 */ if (rx_ring->pFbr1RingVa) { /* First the packet memory */ @@ -1021,21 +1012,8 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev) */ void et131x_reset_recv(struct et131x_adapter *etdev) { - PMP_RFD rfd; - struct list_head *element; - WARN_ON(list_empty(&etdev->RxRing.RecvList)); - /* Take all the RFD's from the pending list, and stick them on the - * RecvList. - */ - while (!list_empty(&etdev->RxRing.RecvPendingList)) { - element = etdev->RxRing.RecvPendingList.next; - - rfd = (PMP_RFD) list_entry(element, MP_RFD, list_node); - - list_move_tail(&rfd->list_node, &etdev->RxRing.RecvList); - } } /** diff --git a/drivers/staging/et131x/et1310_rx.h b/drivers/staging/et131x/et1310_rx.h index 03e859b43111..b71c43205a7f 100644 --- a/drivers/staging/et131x/et1310_rx.h +++ b/drivers/staging/et131x/et1310_rx.h @@ -319,7 +319,6 @@ typedef struct _rx_ring_t { /* RECV */ struct list_head RecvList; - struct list_head RecvPendingList; u32 nReadyRecv; u32 NumRfd; -- GitLab From d8fd9d7ecf3d7fa46567088125a011587802921d Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:50:20 +0100 Subject: [PATCH 116/235] Staging: et131x: Kill the RX skb list element - it isn't used Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_rx.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/staging/et131x/et1310_rx.h b/drivers/staging/et131x/et1310_rx.h index b71c43205a7f..a11bd8b0872e 100644 --- a/drivers/staging/et131x/et1310_rx.h +++ b/drivers/staging/et131x/et1310_rx.h @@ -271,15 +271,6 @@ typedef enum { FOUR_PACKET_INTERRUPT } eRX_INTERRUPT_STATE_t, *PeRX_INTERRUPT_STATE_t; -/* - * Structure to hold the skb's in a list - */ -typedef struct rx_skb_list_elem { - struct list_head skb_list_elem; - dma_addr_t dma_addr; - struct sk_buff *skb; -} RX_SKB_LIST_ELEM, *PRX_SKB_LIST_ELEM; - /* * RX_RING_t is sructure representing the adaptor's local reference(s) to the * rings -- GitLab From 308e93e0a36676f22060b3a4cf0135497b32e9f2 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:50:26 +0100 Subject: [PATCH 117/235] Staging: et131x: Clean the IPG types up Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_address_map.h | 31 ++++++--------------- drivers/staging/et131x/et1310_mac.c | 10 +++---- 2 files changed, 12 insertions(+), 29 deletions(-) diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index 2c3d65a622a7..885b90b3c6ed 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h @@ -1388,29 +1388,14 @@ typedef union _MAC_CFG2_t { /* * structure for Interpacket gap reg in mac address map. * located at address 0x5008 + * + * 31: reserved + * 30-24: non B2B ipg 1 + * 23: undefined + * 22-16: non B2B ipg 2 + * 15-8: Min ifg enforce + * 7-0: B2B ipg */ -typedef union _MAC_IPG_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 reserved:1; /* bit 31 */ - u32 non_B2B_ipg_1:7; /* bits 24-30 */ - u32 undefined2:1; /* bit 23 */ - u32 non_B2B_ipg_2:7; /* bits 16-22 */ - u32 min_ifg_enforce:8; /* bits 8-15 */ - u32 undefined1:1; /* bit 7 */ - u32 B2B_ipg:7; /* bits 0-6 */ -#else - u32 B2B_ipg:7; /* bits 0-6 */ - u32 undefined1:1; /* bit 7 */ - u32 min_ifg_enforce:8; /* bits 8-15 */ - u32 non_B2B_ipg_2:7; /* bits 16-22 */ - u32 undefined2:1; /* bit 23 */ - u32 non_B2B_ipg_1:7; /* bits 24-30 */ - u32 reserved:1; /* bit 31 */ -#endif - } bits; -} MAC_IPG_t, *PMAC_IPG_t; /* * structure for half duplex reg in mac address map. @@ -1731,7 +1716,7 @@ typedef union _MAC_STATION_ADDR2_t { typedef struct _MAC_t { /* Location: */ MAC_CFG1_t cfg1; /* 0x5000 */ MAC_CFG2_t cfg2; /* 0x5004 */ - MAC_IPG_t ipg; /* 0x5008 */ + u32 ipg; /* 0x5008 */ MAC_HFDP_t hfdp; /* 0x500C */ MAC_MAX_FM_LEN_t max_fm_len; /* 0x5010 */ u32 rsv1; /* 0x5014 */ diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c index 35e1bcf961bf..1176bc6c5928 100644 --- a/drivers/staging/et131x/et1310_mac.c +++ b/drivers/staging/et131x/et1310_mac.c @@ -101,7 +101,7 @@ void ConfigMACRegs1(struct et131x_adapter *etdev) struct _MAC_t __iomem *pMac = &etdev->regs->mac; MAC_STATION_ADDR1_t station1; MAC_STATION_ADDR2_t station2; - MAC_IPG_t ipg; + u32 ipg; MAC_HFDP_t hfdp; MII_MGMT_CFG_t mii_mgmt_cfg; @@ -111,11 +111,9 @@ void ConfigMACRegs1(struct et131x_adapter *etdev) writel(0xC00F0000, &pMac->cfg1.value); /* Next lets configure the MAC Inter-packet gap register */ - ipg.bits.non_B2B_ipg_1 = 0x38; /* 58d */ - ipg.bits.non_B2B_ipg_2 = 0x58; /* 88d */ - ipg.bits.min_ifg_enforce = 0x50; /* 80d */ - ipg.bits.B2B_ipg = 0x60; /* 96d */ - writel(ipg.value, &pMac->ipg.value); + ipg = 0x38005860; /* IPG1 0x38 IPG2 0x58 B2B 0x60 */ + ipg |= 0x50 << 8; /* ifg enforce 0x50 */ + writel(ipg, &pMac->ipg); /* Next lets configure the MAC Half Duplex register */ hfdp.bits.alt_beb_trunc = 0xA; -- GitLab From c2f6118a3009b3606cc6e77b474a46ce4075b0a2 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:50:32 +0100 Subject: [PATCH 118/235] Staging: et131x: Clean up the half duplex control reg types Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_address_map.h | 41 ++++++--------------- drivers/staging/et131x/et1310_mac.c | 11 +----- 2 files changed, 13 insertions(+), 39 deletions(-) diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index 885b90b3c6ed..3ef4260b4f73 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h @@ -1395,38 +1395,19 @@ typedef union _MAC_CFG2_t { * 22-16: non B2B ipg 2 * 15-8: Min ifg enforce * 7-0: B2B ipg - */ - -/* + * * structure for half duplex reg in mac address map. * located at address 0x500C + * 31-24: reserved + * 23-20: Alt BEB trunc + * 19: Alt BEB enable + * 18: BP no backoff + * 17: no backoff + * 16: excess defer + * 15-12: re-xmit max + * 11-10: reserved + * 9-0: collision window */ -typedef union _MAC_HFDP_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 reserved2:8; /* bits 24-31 */ - u32 alt_beb_trunc:4; /* bits 23-20 */ - u32 alt_beb_enable:1; /* bit 19 */ - u32 bp_no_backoff:1; /* bit 18 */ - u32 no_backoff:1; /* bit 17 */ - u32 excess_defer:1; /* bit 16 */ - u32 rexmit_max:4; /* bits 12-15 */ - u32 reserved1:2; /* bits 10-11 */ - u32 coll_window:10; /* bits 0-9 */ -#else - u32 coll_window:10; /* bits 0-9 */ - u32 reserved1:2; /* bits 10-11 */ - u32 rexmit_max:4; /* bits 12-15 */ - u32 excess_defer:1; /* bit 16 */ - u32 no_backoff:1; /* bit 17 */ - u32 bp_no_backoff:1; /* bit 18 */ - u32 alt_beb_enable:1; /* bit 19 */ - u32 alt_beb_trunc:4; /* bits 23-20 */ - u32 reserved2:8; /* bits 24-31 */ -#endif - } bits; -} MAC_HFDP_t, *PMAC_HFDP_t; /* * structure for Maximum Frame Length reg in mac address map. @@ -1717,7 +1698,7 @@ typedef struct _MAC_t { /* Location: */ MAC_CFG1_t cfg1; /* 0x5000 */ MAC_CFG2_t cfg2; /* 0x5004 */ u32 ipg; /* 0x5008 */ - MAC_HFDP_t hfdp; /* 0x500C */ + u32 hfdp; /* 0x500C */ MAC_MAX_FM_LEN_t max_fm_len; /* 0x5010 */ u32 rsv1; /* 0x5014 */ u32 rsv2; /* 0x5018 */ diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c index 1176bc6c5928..7ac8209a686b 100644 --- a/drivers/staging/et131x/et1310_mac.c +++ b/drivers/staging/et131x/et1310_mac.c @@ -102,7 +102,6 @@ void ConfigMACRegs1(struct et131x_adapter *etdev) MAC_STATION_ADDR1_t station1; MAC_STATION_ADDR2_t station2; u32 ipg; - MAC_HFDP_t hfdp; MII_MGMT_CFG_t mii_mgmt_cfg; /* First we need to reset everything. Write to MAC configuration @@ -116,14 +115,8 @@ void ConfigMACRegs1(struct et131x_adapter *etdev) writel(ipg, &pMac->ipg); /* Next lets configure the MAC Half Duplex register */ - hfdp.bits.alt_beb_trunc = 0xA; - hfdp.bits.alt_beb_enable = 0x0; - hfdp.bits.bp_no_backoff = 0x0; - hfdp.bits.no_backoff = 0x0; - hfdp.bits.excess_defer = 0x1; - hfdp.bits.rexmit_max = 0xF; - hfdp.bits.coll_window = 0x37; /* 55d */ - writel(hfdp.value, &pMac->hfdp.value); + /* BEB trunc 0xA, Ex Defer, Rexmit 0xF Coll 0x37 */ + writel(0x00A1F037, &pMac->hfdp); /* Next lets configure the MAC Interface Control register */ writel(0, &pMac->if_ctrl.value); -- GitLab From eccdd88fa00ec30fa15a7555b5e010e178c35e2a Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:50:39 +0100 Subject: [PATCH 119/235] Staging: et131x: Clean up the MII_MGMT type Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_address_map.h | 29 ++++++--------------- drivers/staging/et131x/et1310_mac.c | 7 +---- 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index 3ef4260b4f73..423030f1df82 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h @@ -1452,27 +1452,14 @@ typedef union _MAC_TEST_t { /* * structure for MII Management Configuration reg in mac address map. * located at address 0x5020 + * + * 31: reset MII mgmt + * 30-6: unused + * 5: scan auto increment + * 4: preamble supress + * 3: undefined + * 2-0: mgmt clock reset */ -typedef union _MII_MGMT_CFG_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 reset_mii_mgmt:1; /* bit 31 */ - u32 reserved:25; /* bits 6-30 */ - u32 scan_auto_incremt:1; /* bit 5 */ - u32 preamble_suppress:1; /* bit 4 */ - u32 undefined:1; /* bit 3 */ - u32 mgmt_clk_reset:3; /* bits 0-2 */ -#else - u32 mgmt_clk_reset:3; /* bits 0-2 */ - u32 undefined:1; /* bit 3 */ - u32 preamble_suppress:1; /* bit 4 */ - u32 scan_auto_incremt:1; /* bit 5 */ - u32 reserved:25; /* bits 6-30 */ - u32 reset_mii_mgmt:1; /* bit 31 */ -#endif - } bits; -} MII_MGMT_CFG_t, *PMII_MGMT_CFG_t; /* * structure for MII Management Command reg in mac address map. @@ -1703,7 +1690,7 @@ typedef struct _MAC_t { /* Location: */ u32 rsv1; /* 0x5014 */ u32 rsv2; /* 0x5018 */ MAC_TEST_t mac_test; /* 0x501C */ - MII_MGMT_CFG_t mii_mgmt_cfg; /* 0x5020 */ + u32 mii_mgmt_cfg; /* 0x5020 */ MII_MGMT_CMD_t mii_mgmt_cmd; /* 0x5024 */ MII_MGMT_ADDR_t mii_mgmt_addr; /* 0x5028 */ MII_MGMT_CTRL_t mii_mgmt_ctrl; /* 0x502C */ diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c index 7ac8209a686b..712a49ed410f 100644 --- a/drivers/staging/et131x/et1310_mac.c +++ b/drivers/staging/et131x/et1310_mac.c @@ -102,7 +102,6 @@ void ConfigMACRegs1(struct et131x_adapter *etdev) MAC_STATION_ADDR1_t station1; MAC_STATION_ADDR2_t station2; u32 ipg; - MII_MGMT_CFG_t mii_mgmt_cfg; /* First we need to reset everything. Write to MAC configuration * register 1 to perform reset. @@ -122,11 +121,7 @@ void ConfigMACRegs1(struct et131x_adapter *etdev) writel(0, &pMac->if_ctrl.value); /* Let's move on to setting up the mii management configuration */ - mii_mgmt_cfg.bits.reset_mii_mgmt = 0; - mii_mgmt_cfg.bits.scan_auto_incremt = 0; - mii_mgmt_cfg.bits.preamble_suppress = 0; - mii_mgmt_cfg.bits.mgmt_clk_reset = 0x7; - writel(mii_mgmt_cfg.value, &pMac->mii_mgmt_cfg.value); + writel(0x07, &pMac->mii_mgmt_cfg); /* Clock reset 0x7 */ /* Next lets configure the MAC Station Address register. These * values are read from the EEPROM during initialization and stored -- GitLab From c9835d97e9fa06ac0741beaa04fc3f431bcd294c Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:50:45 +0100 Subject: [PATCH 120/235] Staging: et131x: Clean up MAC_CFG types Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_address_map.h | 112 +++++++------------- drivers/staging/et131x/et1310_mac.c | 67 +++++------- drivers/staging/et131x/et131x_initpci.c | 6 +- 3 files changed, 68 insertions(+), 117 deletions(-) diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index 423030f1df82..5a7d9ccf1659 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h @@ -1308,82 +1308,48 @@ typedef struct _RXMAC_t { /* Location: */ /* * structure for configuration #1 reg in mac address map. * located at address 0x5000 - */ -typedef union _MAC_CFG1_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 soft_reset:1; /* bit 31 */ - u32 sim_reset:1; /* bit 30 */ - u32 reserved3:10; /* bits 20-29 */ - u32 reset_rx_mc:1; /* bit 19 */ - u32 reset_tx_mc:1; /* bit 18 */ - u32 reset_rx_fun:1; /* bit 17 */ - u32 reset_tx_fun:1; /* bit 16 */ - u32 reserved2:7; /* bits 9-15 */ - u32 loop_back:1; /* bit 8 */ - u32 reserved1:2; /* bits 6-7 */ - u32 rx_flow:1; /* bit 5 */ - u32 tx_flow:1; /* bit 4 */ - u32 syncd_rx_en:1; /* bit 3 */ - u32 rx_enable:1; /* bit 2 */ - u32 syncd_tx_en:1; /* bit 1 */ - u32 tx_enable:1; /* bit 0 */ -#else - u32 tx_enable:1; /* bit 0 */ - u32 syncd_tx_en:1; /* bit 1 */ - u32 rx_enable:1; /* bit 2 */ - u32 syncd_rx_en:1; /* bit 3 */ - u32 tx_flow:1; /* bit 4 */ - u32 rx_flow:1; /* bit 5 */ - u32 reserved1:2; /* bits 6-7 */ - u32 loop_back:1; /* bit 8 */ - u32 reserved2:7; /* bits 9-15 */ - u32 reset_tx_fun:1; /* bit 16 */ - u32 reset_rx_fun:1; /* bit 17 */ - u32 reset_tx_mc:1; /* bit 18 */ - u32 reset_rx_mc:1; /* bit 19 */ - u32 reserved3:10; /* bits 20-29 */ - u32 sim_reset:1; /* bit 30 */ - u32 soft_reset:1; /* bit 31 */ -#endif - } bits; -} MAC_CFG1_t, *PMAC_CFG1_t; + * + * 31: soft reset + * 30: sim reset + * 29-20: reserved + * 19: reset rx mc + * 18: reset tx mc + * 17: reset rx func + * 16: reset tx fnc + * 15-9: reserved + * 8: loopback + * 7-6: reserved + * 5: rx flow + * 4: tx flow + * 3: syncd rx en + * 2: rx enable + * 1: syncd tx en + * 0: tx enable + */ + +#define CFG1_LOOPBACK 0x00000100 +#define CFG1_RX_FLOW 0x00000020 +#define CFG1_TX_FLOW 0x00000010 +#define CFG1_RX_ENABLE 0x00000004 +#define CFG1_TX_ENABLE 0x00000001 +#define CFG1_WAIT 0x0000000A /* RX & TX syncd */ /* * structure for configuration #2 reg in mac address map. * located at address 0x5004 + * 31-16: reserved + * 15-12: preamble + * 11-10: reserved + * 9-8: if mode + * 7-6: reserved + * 5: huge frame + * 4: length check + * 3: undefined + * 2: pad crc + * 1: crc enable + * 0: full duplex */ -typedef union _MAC_CFG2_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 reserved3:16; /* bits 16-31 */ - u32 preamble_len:4; /* bits 12-15 */ - u32 reserved2:2; /* bits 10-11 */ - u32 if_mode:2; /* bits 8-9 */ - u32 reserved1:2; /* bits 6-7 */ - u32 huge_frame:1; /* bit 5 */ - u32 len_check:1; /* bit 4 */ - u32 undefined:1; /* bit 3 */ - u32 pad_crc:1; /* bit 2 */ - u32 crc_enable:1; /* bit 1 */ - u32 full_duplex:1; /* bit 0 */ -#else - u32 full_duplex:1; /* bit 0 */ - u32 crc_enable:1; /* bit 1 */ - u32 pad_crc:1; /* bit 2 */ - u32 undefined:1; /* bit 3 */ - u32 len_check:1; /* bit 4 */ - u32 huge_frame:1; /* bit 5 */ - u32 reserved1:2; /* bits 6-7 */ - u32 if_mode:2; /* bits 8-9 */ - u32 reserved2:2; /* bits 10-11 */ - u32 preamble_len:4; /* bits 12-15 */ - u32 reserved3:16; /* bits 16-31 */ -#endif - } bits; -} MAC_CFG2_t, *PMAC_CFG2_t; + /* * structure for Interpacket gap reg in mac address map. @@ -1682,8 +1648,8 @@ typedef union _MAC_STATION_ADDR2_t { * MAC Module of JAGCore Address Mapping */ typedef struct _MAC_t { /* Location: */ - MAC_CFG1_t cfg1; /* 0x5000 */ - MAC_CFG2_t cfg2; /* 0x5004 */ + u32 cfg1; /* 0x5000 */ + u32 cfg2; /* 0x5004 */ u32 ipg; /* 0x5008 */ u32 hfdp; /* 0x500C */ MAC_MAX_FM_LEN_t max_fm_len; /* 0x5010 */ diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c index 712a49ed410f..ad32a13a3b32 100644 --- a/drivers/staging/et131x/et1310_mac.c +++ b/drivers/staging/et131x/et1310_mac.c @@ -106,7 +106,7 @@ void ConfigMACRegs1(struct et131x_adapter *etdev) /* First we need to reset everything. Write to MAC configuration * register 1 to perform reset. */ - writel(0xC00F0000, &pMac->cfg1.value); + writel(0xC00F0000, &pMac->cfg1); /* Next lets configure the MAC Inter-packet gap register */ ipg = 0x38005860; /* IPG1 0x38 IPG2 0x58 B2B 0x60 */ @@ -149,7 +149,7 @@ void ConfigMACRegs1(struct et131x_adapter *etdev) writel(etdev->RegistryJumboPacket + 4, &pMac->max_fm_len.value); /* clear out MAC config reset */ - writel(0, &pMac->cfg1.value); + writel(0, &pMac->cfg1); } /** @@ -160,74 +160,59 @@ void ConfigMACRegs2(struct et131x_adapter *etdev) { int32_t delay = 0; struct _MAC_t __iomem *pMac = &etdev->regs->mac; - MAC_CFG1_t cfg1; - MAC_CFG2_t cfg2; + u32 cfg1; + u32 cfg2; MAC_IF_CTRL_t ifctrl; TXMAC_CTL_t ctl; ctl.value = readl(&etdev->regs->txmac.ctl.value); - cfg1.value = readl(&pMac->cfg1.value); - cfg2.value = readl(&pMac->cfg2.value); + cfg1 = readl(&pMac->cfg1); + cfg2 = readl(&pMac->cfg2); ifctrl.value = readl(&pMac->if_ctrl.value); + /* Set up the if mode bits */ + cfg2 &= ~0x300; if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) { - cfg2.bits.if_mode = 0x2; + cfg2 |= 0x200; ifctrl.bits.phy_mode = 0x0; } else { - cfg2.bits.if_mode = 0x1; + cfg2 |= 0x100; ifctrl.bits.phy_mode = 0x1; } /* We need to enable Rx/Tx */ - cfg1.bits.rx_enable = 0x1; - cfg1.bits.tx_enable = 0x1; - - /* Set up flow control */ - cfg1.bits.tx_flow = 0x1; - - if ((etdev->FlowControl == RxOnly) || - (etdev->FlowControl == Both)) { - cfg1.bits.rx_flow = 0x1; - } else { - cfg1.bits.rx_flow = 0x0; - } - + cfg1 |= CFG1_RX_ENABLE|CFG1_TX_ENABLE|CFG1_TX_FLOW; /* Initialize loop back to off */ - cfg1.bits.loop_back = 0; - - writel(cfg1.value, &pMac->cfg1.value); + cfg1 &= ~(CFG1_LOOPBACK|CFG1_RX_FLOW); + if (etdev->FlowControl == RxOnly || etdev->FlowControl == Both) + cfg1 |= CFG1_RX_FLOW; + writel(cfg1, &pMac->cfg1); /* Now we need to initialize the MAC Configuration 2 register */ - cfg2.bits.preamble_len = 0x7; - cfg2.bits.huge_frame = 0x0; - /* LENGTH FIELD CHECKING bit4: Set this bit to cause the MAC to check - * the frame's length field to ensure it matches the actual data - * field length. Clear this bit if no length field checking is - * desired. Its default is 0. - */ - cfg2.bits.len_check = 0x1; + /* preamble 7, check length, huge frame off, pad crc, crc enable + full duplex off */ + cfg2 |= 0x7016; + cfg2 &= ~0x0021; - cfg2.bits.pad_crc = 0x1; - cfg2.bits.crc_enable = 0x1; + /* Turn on duplex if needed */ + if (etdev->duplex_mode) + cfg2 |= 0x01; - /* 1 - full duplex, 0 - half-duplex */ - cfg2.bits.full_duplex = etdev->duplex_mode; ifctrl.bits.ghd_mode = !etdev->duplex_mode; writel(ifctrl.value, &pMac->if_ctrl.value); - writel(cfg2.value, &pMac->cfg2.value); + writel(cfg2, &pMac->cfg2); do { udelay(10); delay++; - cfg1.value = readl(&pMac->cfg1.value); - } while ((!cfg1.bits.syncd_rx_en || !cfg1.bits.syncd_tx_en) && - delay < 100); + cfg1 = readl(&pMac->cfg1); + } while ((cfg1 & CFG1_WAIT) != CFG1_WAIT && delay < 100); if (delay == 100) { dev_warn(&etdev->pdev->dev, "Syncd bits did not respond correctly cfg1 word 0x%08x\n", - cfg1.value); + cfg1); } /* Enable TXMAC */ diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c index 6ac7502a4054..0892b6a538db 100644 --- a/drivers/staging/et131x/et131x_initpci.c +++ b/drivers/staging/et131x/et131x_initpci.c @@ -432,12 +432,12 @@ int et131x_adapter_setup(struct et131x_adapter *etdev) void et131x_soft_reset(struct et131x_adapter *adapter) { /* Disable MAC Core */ - writel(0xc00f0000, &adapter->regs->mac.cfg1.value); + writel(0xc00f0000, &adapter->regs->mac.cfg1); /* Set everything to a reset value */ writel(0x7F, &adapter->regs->global.sw_reset); - writel(0x000f0000, &adapter->regs->mac.cfg1.value); - writel(0x00000000, &adapter->regs->mac.cfg1.value); + writel(0x000f0000, &adapter->regs->mac.cfg1); + writel(0x00000000, &adapter->regs->mac.cfg1); } /** -- GitLab From cc5dc29c65575125a694ed67bbdee7895c7055f9 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:50:51 +0100 Subject: [PATCH 121/235] Staging: et131x: clean up MAX_FM type Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_address_map.h | 16 ++-------------- drivers/staging/et131x/et1310_mac.c | 2 +- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index 5a7d9ccf1659..ab111a3456d1 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h @@ -1377,20 +1377,8 @@ typedef struct _RXMAC_t { /* Location: */ /* * structure for Maximum Frame Length reg in mac address map. - * located at address 0x5010 + * located at address 0x5010: bits 0-15 hold the length. */ -typedef union _MAC_MAX_FM_LEN_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 reserved:16; /* bits 16-31 */ - u32 max_len:16; /* bits 0-15 */ -#else - u32 max_len:16; /* bits 0-15 */ - u32 reserved:16; /* bits 16-31 */ -#endif - } bits; -} MAC_MAX_FM_LEN_t, *PMAC_MAX_FM_LEN_t; /* * structure for Reserve 1 reg in mac address map. @@ -1652,7 +1640,7 @@ typedef struct _MAC_t { /* Location: */ u32 cfg2; /* 0x5004 */ u32 ipg; /* 0x5008 */ u32 hfdp; /* 0x500C */ - MAC_MAX_FM_LEN_t max_fm_len; /* 0x5010 */ + u32 max_fm_len; /* 0x5010 */ u32 rsv1; /* 0x5014 */ u32 rsv2; /* 0x5018 */ MAC_TEST_t mac_test; /* 0x501C */ diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c index ad32a13a3b32..ae7cee43a165 100644 --- a/drivers/staging/et131x/et1310_mac.c +++ b/drivers/staging/et131x/et1310_mac.c @@ -146,7 +146,7 @@ void ConfigMACRegs1(struct et131x_adapter *etdev) * Packets larger than (RegistryJumboPacket) that do not contain a * VLAN ID will be dropped by the Rx function. */ - writel(etdev->RegistryJumboPacket + 4, &pMac->max_fm_len.value); + writel(etdev->RegistryJumboPacket + 4, &pMac->max_fm_len); /* clear out MAC config reset */ writel(0, &pMac->cfg1); -- GitLab From 4ea30f84c5d28fb17ef6ac91f1952545db6774c3 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:50:58 +0100 Subject: [PATCH 122/235] Staging: et131x: kill off MAC_TEST_t It isn't used anyway Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_address_map.h | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index ab111a3456d1..0c5f6e2a5092 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h @@ -1389,19 +1389,8 @@ typedef struct _RXMAC_t { /* Location: */ /* * structure for Test reg in mac address map. * located at address 0x501C + * test: bits 0-2, rest unused */ -typedef union _MAC_TEST_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 unused:29; /* bits 3-31 */ - u32 mac_test:3; /* bits 0-2 */ -#else - u32 mac_test:3; /* bits 0-2 */ - u32 unused:29; /* bits 3-31 */ -#endif - } bits; -} MAC_TEST_t, *PMAC_TEST_t; /* * structure for MII Management Configuration reg in mac address map. @@ -1643,7 +1632,7 @@ typedef struct _MAC_t { /* Location: */ u32 max_fm_len; /* 0x5010 */ u32 rsv1; /* 0x5014 */ u32 rsv2; /* 0x5018 */ - MAC_TEST_t mac_test; /* 0x501C */ + u32 mac_test; /* 0x501C */ u32 mii_mgmt_cfg; /* 0x5020 */ MII_MGMT_CMD_t mii_mgmt_cmd; /* 0x5024 */ MII_MGMT_ADDR_t mii_mgmt_addr; /* 0x5028 */ -- GitLab From 57aed3b4383a5c16217f805daf1bc93777ad9b39 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:51:04 +0100 Subject: [PATCH 123/235] Staging: et131x: Clean up MII control Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_address_map.h | 99 +++++---------------- drivers/staging/et131x/et1310_phy.c | 85 +++++++----------- 2 files changed, 56 insertions(+), 128 deletions(-) diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index 0c5f6e2a5092..d4652e9e1225 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h @@ -1407,97 +1407,46 @@ typedef struct _RXMAC_t { /* Location: */ /* * structure for MII Management Command reg in mac address map. * located at address 0x5024 + * bit 1: scan cycle + * bit 0: read cycle */ -typedef union _MII_MGMT_CMD_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 reserved:30; /* bits 2-31 */ - u32 scan_cycle:1; /* bit 1 */ - u32 read_cycle:1; /* bit 0 */ -#else - u32 read_cycle:1; /* bit 0 */ - u32 scan_cycle:1; /* bit 1 */ - u32 reserved:30; /* bits 2-31 */ -#endif - } bits; -} MII_MGMT_CMD_t, *PMII_MGMT_CMD_t; /* * structure for MII Management Address reg in mac address map. * located at address 0x5028 + * 31-13: reserved + * 12-8: phy addr + * 7-5: reserved + * 4-0: register */ -typedef union _MII_MGMT_ADDR_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 reserved2:19; /* bit 13-31 */ - u32 phy_addr:5; /* bits 8-12 */ - u32 reserved1:3; /* bits 5-7 */ - u32 reg_addr:5; /* bits 0-4 */ -#else - u32 reg_addr:5; /* bits 0-4 */ - u32 reserved1:3; /* bits 5-7 */ - u32 phy_addr:5; /* bits 8-12 */ - u32 reserved2:19; /* bit 13-31 */ -#endif - } bits; -} MII_MGMT_ADDR_t, *PMII_MGMT_ADDR_t; + +#define MII_ADDR(phy,reg) ((phy) << 8 | (reg)) /* * structure for MII Management Control reg in mac address map. * located at address 0x502C + * 31-16: reserved + * 15-0: phy control */ -typedef union _MII_MGMT_CTRL_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 reserved:16; /* bits 16-31 */ - u32 phy_ctrl:16; /* bits 0-15 */ -#else - u32 phy_ctrl:16; /* bits 0-15 */ - u32 reserved:16; /* bits 16-31 */ -#endif - } bits; -} MII_MGMT_CTRL_t, *PMII_MGMT_CTRL_t; /* * structure for MII Management Status reg in mac address map. * located at address 0x5030 + * 31-16: reserved + * 15-0: phy control */ -typedef union _MII_MGMT_STAT_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 reserved:16; /* bits 16-31 */ - u32 phy_stat:16; /* bits 0-15 */ -#else - u32 phy_stat:16; /* bits 0-15 */ - u32 reserved:16; /* bits 16-31 */ -#endif - } bits; -} MII_MGMT_STAT_t, *PMII_MGMT_STAT_t; /* * structure for MII Management Indicators reg in mac address map. * located at address 0x5034 + * 31-3: reserved + * 2: not valid + * 1: scanning + * 0: busy */ -typedef union _MII_MGMT_INDICATOR_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 reserved:29; /* bits 3-31 */ - u32 not_valid:1; /* bit 2 */ - u32 scanning:1; /* bit 1 */ - u32 busy:1; /* bit 0 */ -#else - u32 busy:1; /* bit 0 */ - u32 scanning:1; /* bit 1 */ - u32 not_valid:1; /* bit 2 */ - u32 reserved:29; /* bits 3-31 */ -#endif - } bits; -} MII_MGMT_INDICATOR_t, *PMII_MGMT_INDICATOR_t; + +#define MGMT_BUSY 0x00000001 /* busy */ +#define MGMT_WAIT 0x00000005 /* busy | not valid */ /* * structure for Interface Control reg in mac address map. @@ -1634,11 +1583,11 @@ typedef struct _MAC_t { /* Location: */ u32 rsv2; /* 0x5018 */ u32 mac_test; /* 0x501C */ u32 mii_mgmt_cfg; /* 0x5020 */ - MII_MGMT_CMD_t mii_mgmt_cmd; /* 0x5024 */ - MII_MGMT_ADDR_t mii_mgmt_addr; /* 0x5028 */ - MII_MGMT_CTRL_t mii_mgmt_ctrl; /* 0x502C */ - MII_MGMT_STAT_t mii_mgmt_stat; /* 0x5030 */ - MII_MGMT_INDICATOR_t mii_mgmt_indicator; /* 0x5034 */ + u32 mii_mgmt_cmd; /* 0x5024 */ + u32 mii_mgmt_addr; /* 0x5028 */ + u32 mii_mgmt_ctrl; /* 0x502C */ + u32 mii_mgmt_stat; /* 0x5030 */ + u32 mii_mgmt_indicator; /* 0x5034 */ MAC_IF_CTRL_t if_ctrl; /* 0x5038 */ MAC_IF_STAT_t if_stat; /* 0x503C */ MAC_STATION_ADDR1_t station_addr_1; /* 0x5040 */ diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c index bdd16215dc12..6b77c541df2c 100644 --- a/drivers/staging/et131x/et1310_phy.c +++ b/drivers/staging/et131x/et1310_phy.c @@ -115,69 +115,55 @@ int PhyMiRead(struct et131x_adapter *adapter, uint8_t xcvrAddr, struct _MAC_t __iomem *mac = &adapter->regs->mac; int status = 0; uint32_t delay; - MII_MGMT_ADDR_t miiAddr; - MII_MGMT_CMD_t miiCmd; - MII_MGMT_INDICATOR_t miiIndicator; + u32 miiAddr; + u32 miiCmd; + u32 miiIndicator; /* Save a local copy of the registers we are dealing with so we can * set them back */ - miiAddr.value = readl(&mac->mii_mgmt_addr.value); - miiCmd.value = readl(&mac->mii_mgmt_cmd.value); + miiAddr = readl(&mac->mii_mgmt_addr); + miiCmd = readl(&mac->mii_mgmt_cmd); /* Stop the current operation */ - writel(0, &mac->mii_mgmt_cmd.value); + writel(0, &mac->mii_mgmt_cmd); /* Set up the register we need to read from on the correct PHY */ - { - MII_MGMT_ADDR_t mii_mgmt_addr = { 0 }; - - mii_mgmt_addr.bits.phy_addr = xcvrAddr; - mii_mgmt_addr.bits.reg_addr = xcvrReg; - writel(mii_mgmt_addr.value, &mac->mii_mgmt_addr.value); - } + writel(MII_ADDR(xcvrAddr, xcvrReg), &mac->mii_mgmt_addr); /* Kick the read cycle off */ delay = 0; - writel(0x1, &mac->mii_mgmt_cmd.value); + writel(0x1, &mac->mii_mgmt_cmd); do { udelay(50); delay++; - miiIndicator.value = readl(&mac->mii_mgmt_indicator.value); - } while ((miiIndicator.bits.not_valid || miiIndicator.bits.busy) && - delay < 50); + miiIndicator = readl(&mac->mii_mgmt_indicator); + } while ((miiIndicator & MGMT_WAIT) && delay < 50); /* If we hit the max delay, we could not read the register */ - if (delay >= 50) { + if (delay == 50) { dev_warn(&adapter->pdev->dev, "xcvrReg 0x%08x could not be read\n", xcvrReg); dev_warn(&adapter->pdev->dev, "status is 0x%08x\n", - miiIndicator.value); + miiIndicator); status = -EIO; } /* If we hit here we were able to read the register and we need to - * return the value to the caller - */ - /* TODO: make this stuff a simple readw()?! */ - { - MII_MGMT_STAT_t mii_mgmt_stat; - - mii_mgmt_stat.value = readl(&mac->mii_mgmt_stat.value); - *value = (uint16_t) mii_mgmt_stat.bits.phy_stat; - } + * return the value to the caller */ + *value = readl(&mac->mii_mgmt_stat) & 0xFFFF; /* Stop the read operation */ - writel(0, &mac->mii_mgmt_cmd.value); + writel(0, &mac->mii_mgmt_cmd); /* set the registers we touched back to the state at which we entered * this function */ - writel(miiAddr.value, &mac->mii_mgmt_addr.value); - writel(miiCmd.value, &mac->mii_mgmt_cmd.value); + writel(miiAddr, &mac->mii_mgmt_addr); + writel(miiCmd, &mac->mii_mgmt_cmd); return status; } @@ -196,37 +182,31 @@ int MiWrite(struct et131x_adapter *adapter, uint8_t xcvrReg, uint16_t value) int status = 0; uint8_t xcvrAddr = adapter->Stats.xcvr_addr; uint32_t delay; - MII_MGMT_ADDR_t miiAddr; - MII_MGMT_CMD_t miiCmd; - MII_MGMT_INDICATOR_t miiIndicator; + u32 miiAddr; + u32 miiCmd; + u32 miiIndicator; /* Save a local copy of the registers we are dealing with so we can * set them back */ - miiAddr.value = readl(&mac->mii_mgmt_addr.value); - miiCmd.value = readl(&mac->mii_mgmt_cmd.value); + miiAddr = readl(&mac->mii_mgmt_addr); + miiCmd = readl(&mac->mii_mgmt_cmd); /* Stop the current operation */ - writel(0, &mac->mii_mgmt_cmd.value); + writel(0, &mac->mii_mgmt_cmd); /* Set up the register we need to write to on the correct PHY */ - { - MII_MGMT_ADDR_t mii_mgmt_addr; - - mii_mgmt_addr.bits.phy_addr = xcvrAddr; - mii_mgmt_addr.bits.reg_addr = xcvrReg; - writel(mii_mgmt_addr.value, &mac->mii_mgmt_addr.value); - } + writel(MII_ADDR(xcvrAddr, xcvrReg), &mac->mii_mgmt_addr); /* Add the value to write to the registers to the mac */ - writel(value, &mac->mii_mgmt_ctrl.value); + writel(value, &mac->mii_mgmt_ctrl); delay = 0; do { udelay(50); delay++; - miiIndicator.value = readl(&mac->mii_mgmt_indicator.value); - } while (miiIndicator.bits.busy && delay < 100); + miiIndicator = readl(&mac->mii_mgmt_indicator); + } while ((miiIndicator & MGMT_BUSY) && delay < 100); /* If we hit the max delay, we could not write the register */ if (delay == 100) { @@ -235,23 +215,22 @@ int MiWrite(struct et131x_adapter *adapter, uint8_t xcvrReg, uint16_t value) dev_warn(&adapter->pdev->dev, "xcvrReg 0x%08x could not be written", xcvrReg); dev_warn(&adapter->pdev->dev, "status is 0x%08x\n", - miiIndicator.value); + miiIndicator); dev_warn(&adapter->pdev->dev, "command is 0x%08x\n", - readl(&mac->mii_mgmt_cmd.value)); + readl(&mac->mii_mgmt_cmd)); MiRead(adapter, xcvrReg, &TempValue); status = -EIO; } - /* Stop the write operation */ - writel(0, &mac->mii_mgmt_cmd.value); + writel(0, &mac->mii_mgmt_cmd); /* set the registers we touched back to the state at which we entered * this function */ - writel(miiAddr.value, &mac->mii_mgmt_addr.value); - writel(miiCmd.value, &mac->mii_mgmt_cmd.value); + writel(miiAddr, &mac->mii_mgmt_addr); + writel(miiCmd, &mac->mii_mgmt_cmd); return status; } -- GitLab From 1210db957aa4f213259fd4dc92fd6e9e8cfc3187 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:51:10 +0100 Subject: [PATCH 124/235] Staging: et131x: phy clean up Clean up the phy code a bit so we can see what needs doing. This involves moving blocks around and making stuff static Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_phy.c | 1158 ++++++++++++++------------- drivers/staging/et131x/et1310_phy.h | 30 +- 2 files changed, 582 insertions(+), 606 deletions(-) diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c index 6b77c541df2c..c1aedbb2469a 100644 --- a/drivers/staging/et131x/et1310_phy.c +++ b/drivers/staging/et131x/et1310_phy.c @@ -109,12 +109,12 @@ static int et131x_xcvr_init(struct et131x_adapter *adapter); * * Returns 0 on success, errno on failure (as defined in errno.h) */ -int PhyMiRead(struct et131x_adapter *adapter, uint8_t xcvrAddr, - uint8_t xcvrReg, uint16_t *value) +int PhyMiRead(struct et131x_adapter *adapter, u8 xcvrAddr, + u8 xcvrReg, u16 *value) { struct _MAC_t __iomem *mac = &adapter->regs->mac; int status = 0; - uint32_t delay; + u32 delay; u32 miiAddr; u32 miiCmd; u32 miiIndicator; @@ -174,14 +174,16 @@ int PhyMiRead(struct et131x_adapter *adapter, uint8_t xcvrAddr, * @xcvrReg: the register to read * @value: 16-bit value to write * + * FIXME: one caller in netdev still + * * Return 0 on success, errno on failure (as defined in errno.h) */ -int MiWrite(struct et131x_adapter *adapter, uint8_t xcvrReg, uint16_t value) +int MiWrite(struct et131x_adapter *adapter, u8 xcvrReg, u16 value) { struct _MAC_t __iomem *mac = &adapter->regs->mac; int status = 0; - uint8_t xcvrAddr = adapter->Stats.xcvr_addr; - uint32_t delay; + u8 xcvrAddr = adapter->Stats.xcvr_addr; + u32 delay; u32 miiAddr; u32 miiCmd; u32 miiIndicator; @@ -210,7 +212,7 @@ int MiWrite(struct et131x_adapter *adapter, uint8_t xcvrReg, uint16_t value) /* If we hit the max delay, we could not write the register */ if (delay == 100) { - uint16_t TempValue; + u16 TempValue; dev_warn(&adapter->pdev->dev, "xcvrReg 0x%08x could not be written", xcvrReg); @@ -244,22 +246,22 @@ int MiWrite(struct et131x_adapter *adapter, uint8_t xcvrReg, uint16_t value) int et131x_xcvr_find(struct et131x_adapter *adapter) { int status = -ENODEV; - uint8_t xcvr_addr; + u8 xcvr_addr; MI_IDR1_t idr1; MI_IDR2_t idr2; - uint32_t xcvr_id; + u32 xcvr_id; /* We need to get xcvr id and address we just get the first one */ for (xcvr_addr = 0; xcvr_addr < 32; xcvr_addr++) { /* Read the ID from the PHY */ PhyMiRead(adapter, xcvr_addr, - (uint8_t) offsetof(MI_REGS_t, idr1), + (u8) offsetof(MI_REGS_t, idr1), &idr1.value); PhyMiRead(adapter, xcvr_addr, - (uint8_t) offsetof(MI_REGS_t, idr2), + (u8) offsetof(MI_REGS_t, idr2), &idr2.value); - xcvr_id = (uint32_t) ((idr1.value << 16) | idr2.value); + xcvr_id = (u32) ((idr1.value << 16) | idr2.value); if ((idr1.value != 0) && (idr1.value != 0xffff)) { adapter->Stats.xcvr_id = xcvr_id; @@ -290,279 +292,317 @@ int et131x_setphy_normal(struct et131x_adapter *adapter) return status; } -/** - * et131x_xcvr_init - Init the phy if we are setting it into force mode - * @adapter: pointer to our private adapter structure - * - * Returns 0 on success, errno on failure (as defined in errno.h) - */ -static int et131x_xcvr_init(struct et131x_adapter *adapter) +void ET1310_PhyReset(struct et131x_adapter *etdev) { - int status = 0; - MI_IMR_t imr; - MI_ISR_t isr; - MI_LCR2_t lcr2; + MiWrite(etdev, PHY_CONTROL, 0x8000); +} - /* Zero out the adapter structure variable representing BMSR */ - adapter->Bmsr.value = 0; +void ET1310_PhyPowerDown(struct et131x_adapter *etdev, bool down) +{ + u16 data; - MiRead(adapter, (uint8_t) offsetof(MI_REGS_t, isr), &isr.value); + MiRead(etdev, PHY_CONTROL, &data); - MiRead(adapter, (uint8_t) offsetof(MI_REGS_t, imr), &imr.value); + if (down == false) { + /* Power UP */ + data &= ~0x0800; + MiWrite(etdev, PHY_CONTROL, data); + } else { + /* Power DOWN */ + data |= 0x0800; + MiWrite(etdev, PHY_CONTROL, data); + } +} - /* Set the link status interrupt only. Bad behavior when link status - * and auto neg are set, we run into a nested interrupt problem - */ - imr.bits.int_en = 0x1; - imr.bits.link_status = 0x1; - imr.bits.autoneg_status = 0x1; +static void ET1310_PhyAutoNeg(struct et131x_adapter *etdev, bool enable) +{ + u16 data; - MiWrite(adapter, (uint8_t) offsetof(MI_REGS_t, imr), imr.value); + MiRead(etdev, PHY_CONTROL, &data); - /* Set the LED behavior such that LED 1 indicates speed (off = - * 10Mbits, blink = 100Mbits, on = 1000Mbits) and LED 2 indicates - * link and activity (on for link, blink off for activity). - * - * NOTE: Some customizations have been added here for specific - * vendors; The LED behavior is now determined by vendor data in the - * EEPROM. However, the above description is the default. - */ - if ((adapter->eepromData[1] & 0x4) == 0) { - MiRead(adapter, (uint8_t) offsetof(MI_REGS_t, lcr2), - &lcr2.value); - if ((adapter->eepromData[1] & 0x8) == 0) - lcr2.bits.led_tx_rx = 0x3; - else - lcr2.bits.led_tx_rx = 0x4; - lcr2.bits.led_link = 0xa; - MiWrite(adapter, (uint8_t) offsetof(MI_REGS_t, lcr2), - lcr2.value); + if (enable == true) { + /* Autonegotiation ON */ + data |= 0x1000; + MiWrite(etdev, PHY_CONTROL, data); + } else { + /* Autonegotiation OFF */ + data &= ~0x1000; + MiWrite(etdev, PHY_CONTROL, data); } +} - /* Determine if we need to go into a force mode and set it */ - if (adapter->AiForceSpeed == 0 && adapter->AiForceDpx == 0) { - if ((adapter->RegistryFlowControl == TxOnly) || - (adapter->RegistryFlowControl == Both)) { - ET1310_PhyAccessMiBit(adapter, - TRUEPHY_BIT_SET, 4, 11, NULL); - } else { - ET1310_PhyAccessMiBit(adapter, - TRUEPHY_BIT_CLEAR, 4, 11, NULL); - } - - if (adapter->RegistryFlowControl == Both) { - ET1310_PhyAccessMiBit(adapter, - TRUEPHY_BIT_SET, 4, 10, NULL); - } else { - ET1310_PhyAccessMiBit(adapter, - TRUEPHY_BIT_CLEAR, 4, 10, NULL); - } +static void ET1310_PhyDuplexMode(struct et131x_adapter *etdev, u16 duplex) +{ + u16 data; - /* Set the phy to autonegotiation */ - ET1310_PhyAutoNeg(adapter, true); + MiRead(etdev, PHY_CONTROL, &data); - /* NOTE - Do we need this? */ - ET1310_PhyAccessMiBit(adapter, TRUEPHY_BIT_SET, 0, 9, NULL); - return status; + if (duplex == TRUEPHY_DUPLEX_FULL) { + /* Set Full Duplex */ + data |= 0x100; + MiWrite(etdev, PHY_CONTROL, data); } else { - ET1310_PhyAutoNeg(adapter, false); + /* Set Half Duplex */ + data &= ~0x100; + MiWrite(etdev, PHY_CONTROL, data); + } +} - /* Set to the correct force mode. */ - if (adapter->AiForceDpx != 1) { - if ((adapter->RegistryFlowControl == TxOnly) || - (adapter->RegistryFlowControl == Both)) { - ET1310_PhyAccessMiBit(adapter, - TRUEPHY_BIT_SET, 4, 11, - NULL); - } else { - ET1310_PhyAccessMiBit(adapter, - TRUEPHY_BIT_CLEAR, 4, 11, - NULL); - } +static void ET1310_PhySpeedSelect(struct et131x_adapter *etdev, u16 speed) +{ + u16 data; - if (adapter->RegistryFlowControl == Both) { - ET1310_PhyAccessMiBit(adapter, - TRUEPHY_BIT_SET, 4, 10, - NULL); - } else { - ET1310_PhyAccessMiBit(adapter, - TRUEPHY_BIT_CLEAR, 4, 10, - NULL); - } - } else { - ET1310_PhyAccessMiBit(adapter, - TRUEPHY_BIT_CLEAR, 4, 10, NULL); - ET1310_PhyAccessMiBit(adapter, - TRUEPHY_BIT_CLEAR, 4, 11, NULL); - } + /* Read the PHY control register */ + MiRead(etdev, PHY_CONTROL, &data); - switch (adapter->AiForceSpeed) { - case 10: - if (adapter->AiForceDpx == 1) - TPAL_SetPhy10HalfDuplex(adapter); - else if (adapter->AiForceDpx == 2) - TPAL_SetPhy10FullDuplex(adapter); - else - TPAL_SetPhy10Force(adapter); - break; - case 100: - if (adapter->AiForceDpx == 1) - TPAL_SetPhy100HalfDuplex(adapter); - else if (adapter->AiForceDpx == 2) - TPAL_SetPhy100FullDuplex(adapter); - else - TPAL_SetPhy100Force(adapter); - break; - case 1000: - TPAL_SetPhy1000FullDuplex(adapter); - break; - } + /* Clear all Speed settings (Bits 6, 13) */ + data &= ~0x2040; - return status; + /* Reset the speed bits based on user selection */ + switch (speed) { + case TRUEPHY_SPEED_10MBPS: + /* Bits already cleared above, do nothing */ + break; + + case TRUEPHY_SPEED_100MBPS: + /* 100M == Set bit 13 */ + data |= 0x2000; + break; + + case TRUEPHY_SPEED_1000MBPS: + default: + data |= 0x0040; + break; } + + /* Write back the new speed */ + MiWrite(etdev, PHY_CONTROL, data); } -void et131x_Mii_check(struct et131x_adapter *etdev, - MI_BMSR_t bmsr, MI_BMSR_t bmsr_ints) +static void ET1310_PhyLinkStatus(struct et131x_adapter *etdev, + u8 *link_status, + u32 *autoneg, + u32 *linkspeed, + u32 *duplex_mode, + u32 *mdi_mdix, + u32 *masterslave, u32 *polarity) { - uint8_t link_status; - uint32_t autoneg_status; - uint32_t speed; - uint32_t duplex; - uint32_t mdi_mdix; - uint32_t masterslave; - uint32_t polarity; - unsigned long flags; + u16 mistatus = 0; + u16 is1000BaseT = 0; + u16 vmi_phystatus = 0; + u16 control = 0; - if (bmsr_ints.bits.link_status) { - if (bmsr.bits.link_status) { - etdev->PoMgmt.TransPhyComaModeOnBoot = 20; + MiRead(etdev, PHY_STATUS, &mistatus); + MiRead(etdev, PHY_1000_STATUS, &is1000BaseT); + MiRead(etdev, PHY_PHY_STATUS, &vmi_phystatus); + MiRead(etdev, PHY_CONTROL, &control); - /* Update our state variables and indicate the - * connected state - */ - spin_lock_irqsave(&etdev->Lock, flags); + if (link_status) { + *link_status = + (unsigned char)((vmi_phystatus & 0x0040) ? 1 : 0); + } - etdev->MediaState = NETIF_STATUS_MEDIA_CONNECT; - etdev->Flags &= ~fMP_ADAPTER_LINK_DETECTION; + if (autoneg) { + *autoneg = + (control & 0x1000) ? ((vmi_phystatus & 0x0020) ? + TRUEPHY_ANEG_COMPLETE : + TRUEPHY_ANEG_NOT_COMPLETE) : + TRUEPHY_ANEG_DISABLED; + } - spin_unlock_irqrestore(&etdev->Lock, flags); + if (linkspeed) + *linkspeed = (vmi_phystatus & 0x0300) >> 8; - netif_carrier_on(etdev->netdev); - } else { - dev_warn(&etdev->pdev->dev, - "Link down - cable problem ?\n"); + if (duplex_mode) + *duplex_mode = (vmi_phystatus & 0x0080) >> 7; - if (etdev->linkspeed == TRUEPHY_SPEED_10MBPS) { - /* NOTE - Is there a way to query this without - * TruePHY? - * && TRU_QueryCoreType(etdev->hTruePhy, 0) == EMI_TRUEPHY_A13O) { - */ - uint16_t Register18; + if (mdi_mdix) + /* NOTE: Need to complete this */ + *mdi_mdix = 0; - MiRead(etdev, 0x12, &Register18); - MiWrite(etdev, 0x12, Register18 | 0x4); - MiWrite(etdev, 0x10, Register18 | 0x8402); - MiWrite(etdev, 0x11, Register18 | 511); - MiWrite(etdev, 0x12, Register18); - } + if (masterslave) { + *masterslave = + (is1000BaseT & 0x4000) ? TRUEPHY_CFG_MASTER : + TRUEPHY_CFG_SLAVE; + } - /* For the first N seconds of life, we are in "link - * detection" When we are in this state, we should - * only report "connected". When the LinkDetection - * Timer expires, we can report disconnected (handled - * in the LinkDetectionDPC). - */ - if (!(etdev->Flags & fMP_ADAPTER_LINK_DETECTION) || - (etdev->MediaState == NETIF_STATUS_MEDIA_DISCONNECT)) { - spin_lock_irqsave(&etdev->Lock, flags); - etdev->MediaState = - NETIF_STATUS_MEDIA_DISCONNECT; - spin_unlock_irqrestore(&etdev->Lock, - flags); + if (polarity) { + *polarity = + (vmi_phystatus & 0x0400) ? TRUEPHY_POLARITY_INVERTED : + TRUEPHY_POLARITY_NORMAL; + } +} - netif_carrier_off(etdev->netdev); - } +static void ET1310_PhyAndOrReg(struct et131x_adapter *etdev, + u16 regnum, u16 andMask, u16 orMask) +{ + u16 reg; - etdev->linkspeed = 0; - etdev->duplex_mode = 0; + /* Read the requested register */ + MiRead(etdev, regnum, ®); - /* Free the packets being actively sent & stopped */ - et131x_free_busy_send_packets(etdev); + /* Apply the AND mask */ + reg &= andMask; - /* Re-initialize the send structures */ - et131x_init_send(etdev); + /* Apply the OR mask */ + reg |= orMask; - /* Reset the RFD list and re-start RU */ - et131x_reset_recv(etdev); + /* Write the value back to the register */ + MiWrite(etdev, regnum, reg); +} - /* - * Bring the device back to the state it was during - * init prior to autonegotiation being complete. This - * way, when we get the auto-neg complete interrupt, - * we can complete init by calling ConfigMacREGS2. - */ - et131x_soft_reset(etdev); +/* Still used from _mac */ +void ET1310_PhyAccessMiBit(struct et131x_adapter *etdev, u16 action, + u16 regnum, u16 bitnum, u8 *value) +{ + u16 reg; + u16 mask = 0; - /* Setup ET1310 as per the documentation */ - et131x_adapter_setup(etdev); + /* Create a mask to isolate the requested bit */ + mask = 0x0001 << bitnum; - /* Setup the PHY into coma mode until the cable is - * plugged back in - */ - if (etdev->RegistryPhyComa == 1) - EnablePhyComa(etdev); - } + /* Read the requested register */ + MiRead(etdev, regnum, ®); + + switch (action) { + case TRUEPHY_BIT_READ: + if (value != NULL) + *value = (reg & mask) >> bitnum; + break; + + case TRUEPHY_BIT_SET: + reg |= mask; + MiWrite(etdev, regnum, reg); + break; + + case TRUEPHY_BIT_CLEAR: + reg &= ~mask; + MiWrite(etdev, regnum, reg); + break; + + default: + break; } +} - if (bmsr_ints.bits.auto_neg_complete || - (etdev->AiForceDpx == 3 && bmsr_ints.bits.link_status)) { - if (bmsr.bits.auto_neg_complete || etdev->AiForceDpx == 3) { - ET1310_PhyLinkStatus(etdev, - &link_status, &autoneg_status, - &speed, &duplex, &mdi_mdix, - &masterslave, &polarity); +void ET1310_PhyAdvertise1000BaseT(struct et131x_adapter *etdev, + u16 duplex) +{ + u16 data; - etdev->linkspeed = speed; - etdev->duplex_mode = duplex; + /* Read the PHY 1000 Base-T Control Register */ + MiRead(etdev, PHY_1000_CONTROL, &data); - etdev->PoMgmt.TransPhyComaModeOnBoot = 20; + /* Clear Bits 8,9 */ + data &= ~0x0300; - if (etdev->linkspeed == TRUEPHY_SPEED_10MBPS) { - /* - * NOTE - Is there a way to query this without - * TruePHY? - * && TRU_QueryCoreType(etdev->hTruePhy, 0)== EMI_TRUEPHY_A13O) { - */ - uint16_t Register18; + switch (duplex) { + case TRUEPHY_ADV_DUPLEX_NONE: + /* Duplex already cleared, do nothing */ + break; - MiRead(etdev, 0x12, &Register18); - MiWrite(etdev, 0x12, Register18 | 0x4); - MiWrite(etdev, 0x10, Register18 | 0x8402); - MiWrite(etdev, 0x11, Register18 | 511); - MiWrite(etdev, 0x12, Register18); - } + case TRUEPHY_ADV_DUPLEX_FULL: + /* Set Bit 9 */ + data |= 0x0200; + break; - ConfigFlowControl(etdev); + case TRUEPHY_ADV_DUPLEX_HALF: + /* Set Bit 8 */ + data |= 0x0100; + break; - if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS && - etdev->RegistryJumboPacket > 2048) - ET1310_PhyAndOrReg(etdev, 0x16, 0xcfff, - 0x2000); + case TRUEPHY_ADV_DUPLEX_BOTH: + default: + data |= 0x0300; + break; + } - SetRxDmaTimer(etdev); - ConfigMACRegs2(etdev); - } + /* Write back advertisement */ + MiWrite(etdev, PHY_1000_CONTROL, data); +} + +static void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *etdev, + u16 duplex) +{ + u16 data; + + /* Read the Autonegotiation Register (10/100) */ + MiRead(etdev, PHY_AUTO_ADVERTISEMENT, &data); + + /* Clear bits 7,8 */ + data &= ~0x0180; + + switch (duplex) { + case TRUEPHY_ADV_DUPLEX_NONE: + /* Duplex already cleared, do nothing */ + break; + + case TRUEPHY_ADV_DUPLEX_FULL: + /* Set Bit 8 */ + data |= 0x0100; + break; + + case TRUEPHY_ADV_DUPLEX_HALF: + /* Set Bit 7 */ + data |= 0x0080; + break; + + case TRUEPHY_ADV_DUPLEX_BOTH: + default: + /* Set Bits 7,8 */ + data |= 0x0180; + break; + } + + /* Write back advertisement */ + MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, data); +} + +static void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *etdev, + u16 duplex) +{ + u16 data; + + /* Read the Autonegotiation Register (10/100) */ + MiRead(etdev, PHY_AUTO_ADVERTISEMENT, &data); + + /* Clear bits 5,6 */ + data &= ~0x0060; + + switch (duplex) { + case TRUEPHY_ADV_DUPLEX_NONE: + /* Duplex already cleared, do nothing */ + break; + + case TRUEPHY_ADV_DUPLEX_FULL: + /* Set Bit 6 */ + data |= 0x0040; + break; + + case TRUEPHY_ADV_DUPLEX_HALF: + /* Set Bit 5 */ + data |= 0x0020; + break; + + case TRUEPHY_ADV_DUPLEX_BOTH: + default: + /* Set Bits 5,6 */ + data |= 0x0060; + break; } + + /* Write back advertisement */ + MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, data); } + /** * TPAL_SetPhy10HalfDuplex - Force the phy into 10 Base T Half Duplex mode. * @etdev: pointer to the adapter structure * * Also sets the MAC so it is syncd up properly */ -void TPAL_SetPhy10HalfDuplex(struct et131x_adapter *etdev) +static void TPAL_SetPhy10HalfDuplex(struct et131x_adapter *etdev) { /* Power down PHY */ ET1310_PhyPowerDown(etdev, 1); @@ -585,7 +625,7 @@ void TPAL_SetPhy10HalfDuplex(struct et131x_adapter *etdev) * * Also sets the MAC so it is syncd up properly */ -void TPAL_SetPhy10FullDuplex(struct et131x_adapter *etdev) +static void TPAL_SetPhy10FullDuplex(struct et131x_adapter *etdev) { /* Power down PHY */ ET1310_PhyPowerDown(etdev, 1); @@ -606,7 +646,7 @@ void TPAL_SetPhy10FullDuplex(struct et131x_adapter *etdev) * TPAL_SetPhy10Force - Force Base-T FD mode WITHOUT using autonegotiation * @etdev: pointer to the adapter structure */ -void TPAL_SetPhy10Force(struct et131x_adapter *etdev) +static void TPAL_SetPhy10Force(struct et131x_adapter *etdev) { /* Power down PHY */ ET1310_PhyPowerDown(etdev, 1); @@ -635,7 +675,7 @@ void TPAL_SetPhy10Force(struct et131x_adapter *etdev) * * Also sets the MAC so it is syncd up properly. */ -void TPAL_SetPhy100HalfDuplex(struct et131x_adapter *etdev) +static void TPAL_SetPhy100HalfDuplex(struct et131x_adapter *etdev) { /* Power down PHY */ ET1310_PhyPowerDown(etdev, 1); @@ -661,7 +701,7 @@ void TPAL_SetPhy100HalfDuplex(struct et131x_adapter *etdev) * * Also sets the MAC so it is syncd up properly */ -void TPAL_SetPhy100FullDuplex(struct et131x_adapter *etdev) +static void TPAL_SetPhy100FullDuplex(struct et131x_adapter *etdev) { /* Power down PHY */ ET1310_PhyPowerDown(etdev, 1); @@ -682,7 +722,7 @@ void TPAL_SetPhy100FullDuplex(struct et131x_adapter *etdev) * TPAL_SetPhy100Force - Force 100 BaseT FD mode WITHOUT using autonegotiation * @etdev: pointer to the adapter structure */ -void TPAL_SetPhy100Force(struct et131x_adapter *etdev) +static void TPAL_SetPhy100Force(struct et131x_adapter *etdev) { /* Power down PHY */ ET1310_PhyPowerDown(etdev, 1); @@ -711,7 +751,7 @@ void TPAL_SetPhy100Force(struct et131x_adapter *etdev) * * Also sets the MAC so it is syncd up properly. */ -void TPAL_SetPhy1000FullDuplex(struct et131x_adapter *etdev) +static void TPAL_SetPhy1000FullDuplex(struct et131x_adapter *etdev) { /* Power down PHY */ ET1310_PhyPowerDown(etdev, 1); @@ -732,7 +772,7 @@ void TPAL_SetPhy1000FullDuplex(struct et131x_adapter *etdev) * TPAL_SetPhyAutoNeg - Set phy to autonegotiation mode. * @etdev: pointer to the adapter structure */ -void TPAL_SetPhyAutoNeg(struct et131x_adapter *etdev) +static void TPAL_SetPhyAutoNeg(struct et131x_adapter *etdev) { /* Power down PHY */ ET1310_PhyPowerDown(etdev, 1); @@ -755,418 +795,380 @@ void TPAL_SetPhyAutoNeg(struct et131x_adapter *etdev) } -/* - * The routines which follow provide low-level access to the PHY, and are used - * primarily by the routines above (although there are a few places elsewhere - * in the driver where this level of access is required). - */ - -static const uint16_t ConfigPhy[25][2] = { - /* Reg Value Register */ - /* Addr */ - {0x880B, 0x0926}, /* AfeIfCreg4B1000Msbs */ - {0x880C, 0x0926}, /* AfeIfCreg4B100Msbs */ - {0x880D, 0x0926}, /* AfeIfCreg4B10Msbs */ - {0x880E, 0xB4D3}, /* AfeIfCreg4B1000Lsbs */ - {0x880F, 0xB4D3}, /* AfeIfCreg4B100Lsbs */ - {0x8810, 0xB4D3}, /* AfeIfCreg4B10Lsbs */ +/** + * et131x_xcvr_init - Init the phy if we are setting it into force mode + * @adapter: pointer to our private adapter structure + * + * Returns 0 on success, errno on failure (as defined in errno.h) + */ +static int et131x_xcvr_init(struct et131x_adapter *adapter) +{ + int status = 0; + MI_IMR_t imr; + MI_ISR_t isr; + MI_LCR2_t lcr2; - {0x8805, 0xB03E}, /* AfeIfCreg3B1000Msbs */ - {0x8806, 0xB03E}, /* AfeIfCreg3B100Msbs */ - {0x8807, 0xFF00}, /* AfeIfCreg3B10Msbs */ + /* Zero out the adapter structure variable representing BMSR */ + adapter->Bmsr.value = 0; - {0x8808, 0xE090}, /* AfeIfCreg3B1000Lsbs */ - {0x8809, 0xE110}, /* AfeIfCreg3B100Lsbs */ - {0x880A, 0x0000}, /* AfeIfCreg3B10Lsbs */ + MiRead(adapter, (u8) offsetof(MI_REGS_t, isr), &isr.value); - {0x300D, 1}, /* DisableNorm */ + MiRead(adapter, (u8) offsetof(MI_REGS_t, imr), &imr.value); - {0x280C, 0x0180}, /* LinkHoldEnd */ + /* Set the link status interrupt only. Bad behavior when link status + * and auto neg are set, we run into a nested interrupt problem + */ + imr.bits.int_en = 0x1; + imr.bits.link_status = 0x1; + imr.bits.autoneg_status = 0x1; - {0x1C21, 0x0002}, /* AlphaM */ + MiWrite(adapter, (u8) offsetof(MI_REGS_t, imr), imr.value); - {0x3821, 6}, /* FfeLkgTx0 */ - {0x381D, 1}, /* FfeLkg1g4 */ - {0x381E, 1}, /* FfeLkg1g5 */ - {0x381F, 1}, /* FfeLkg1g6 */ - {0x3820, 1}, /* FfeLkg1g7 */ + /* Set the LED behavior such that LED 1 indicates speed (off = + * 10Mbits, blink = 100Mbits, on = 1000Mbits) and LED 2 indicates + * link and activity (on for link, blink off for activity). + * + * NOTE: Some customizations have been added here for specific + * vendors; The LED behavior is now determined by vendor data in the + * EEPROM. However, the above description is the default. + */ + if ((adapter->eepromData[1] & 0x4) == 0) { + MiRead(adapter, (u8) offsetof(MI_REGS_t, lcr2), + &lcr2.value); + if ((adapter->eepromData[1] & 0x8) == 0) + lcr2.bits.led_tx_rx = 0x3; + else + lcr2.bits.led_tx_rx = 0x4; + lcr2.bits.led_link = 0xa; + MiWrite(adapter, (u8) offsetof(MI_REGS_t, lcr2), + lcr2.value); + } - {0x8402, 0x01F0}, /* Btinact */ - {0x800E, 20}, /* LftrainTime */ - {0x800F, 24}, /* DvguardTime */ - {0x8010, 46}, /* IdlguardTime */ + /* Determine if we need to go into a force mode and set it */ + if (adapter->AiForceSpeed == 0 && adapter->AiForceDpx == 0) { + if (adapter->RegistryFlowControl == TxOnly || + adapter->RegistryFlowControl == Both) + ET1310_PhyAccessMiBit(adapter, + TRUEPHY_BIT_SET, 4, 11, NULL); + else + ET1310_PhyAccessMiBit(adapter, + TRUEPHY_BIT_CLEAR, 4, 11, NULL); - {0, 0} + if (adapter->RegistryFlowControl == Both) + ET1310_PhyAccessMiBit(adapter, + TRUEPHY_BIT_SET, 4, 10, NULL); + else + ET1310_PhyAccessMiBit(adapter, + TRUEPHY_BIT_CLEAR, 4, 10, NULL); -}; + /* Set the phy to autonegotiation */ + ET1310_PhyAutoNeg(adapter, true); -/* condensed version of the phy initialization routine */ -void ET1310_PhyInit(struct et131x_adapter *etdev) -{ - uint16_t data, index; + /* NOTE - Do we need this? */ + ET1310_PhyAccessMiBit(adapter, TRUEPHY_BIT_SET, 0, 9, NULL); + return status; + } else { + ET1310_PhyAutoNeg(adapter, false); - if (etdev == NULL) - return; - - /* get the identity (again ?) */ - MiRead(etdev, PHY_ID_1, &data); - MiRead(etdev, PHY_ID_2, &data); - - /* what does this do/achieve ? */ - MiRead(etdev, PHY_MPHY_CONTROL_REG, &data); /* should read 0002 */ - MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0006); - - /* read modem register 0402, should I do something with the return - data ? */ - MiWrite(etdev, PHY_INDEX_REG, 0x0402); - MiRead(etdev, PHY_DATA_REG, &data); - - /* what does this do/achieve ? */ - MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002); - - /* get the identity (again ?) */ - MiRead(etdev, PHY_ID_1, &data); - MiRead(etdev, PHY_ID_2, &data); - - /* what does this achieve ? */ - MiRead(etdev, PHY_MPHY_CONTROL_REG, &data); /* should read 0002 */ - MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0006); - - /* read modem register 0402, should I do something with - the return data? */ - MiWrite(etdev, PHY_INDEX_REG, 0x0402); - MiRead(etdev, PHY_DATA_REG, &data); - - MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002); - - /* what does this achieve (should return 0x1040) */ - MiRead(etdev, PHY_CONTROL, &data); - MiRead(etdev, PHY_MPHY_CONTROL_REG, &data); /* should read 0002 */ - MiWrite(etdev, PHY_CONTROL, 0x1840); - - MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0007); - - /* here the writing of the array starts.... */ - index = 0; - while (ConfigPhy[index][0] != 0x0000) { - /* write value */ - MiWrite(etdev, PHY_INDEX_REG, ConfigPhy[index][0]); - MiWrite(etdev, PHY_DATA_REG, ConfigPhy[index][1]); - - /* read it back */ - MiWrite(etdev, PHY_INDEX_REG, ConfigPhy[index][0]); - MiRead(etdev, PHY_DATA_REG, &data); - - /* do a check on the value read back ? */ - index++; - } - /* here the writing of the array ends... */ - - MiRead(etdev, PHY_CONTROL, &data); /* 0x1840 */ - MiRead(etdev, PHY_MPHY_CONTROL_REG, &data);/* should read 0007 */ - MiWrite(etdev, PHY_CONTROL, 0x1040); - MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002); -} - -void ET1310_PhyReset(struct et131x_adapter *etdev) -{ - MiWrite(etdev, PHY_CONTROL, 0x8000); -} - -void ET1310_PhyPowerDown(struct et131x_adapter *etdev, bool down) -{ - uint16_t data; - - MiRead(etdev, PHY_CONTROL, &data); - - if (down == false) { - /* Power UP */ - data &= ~0x0800; - MiWrite(etdev, PHY_CONTROL, data); - } else { - /* Power DOWN */ - data |= 0x0800; - MiWrite(etdev, PHY_CONTROL, data); - } -} + /* Set to the correct force mode. */ + if (adapter->AiForceDpx != 1) { + if (adapter->RegistryFlowControl == TxOnly || + adapter->RegistryFlowControl == Both) + ET1310_PhyAccessMiBit(adapter, + TRUEPHY_BIT_SET, 4, 11, + NULL); + else + ET1310_PhyAccessMiBit(adapter, + TRUEPHY_BIT_CLEAR, 4, 11, + NULL); -void ET1310_PhyAutoNeg(struct et131x_adapter *etdev, bool enable) -{ - uint16_t data; + if (adapter->RegistryFlowControl == Both) + ET1310_PhyAccessMiBit(adapter, + TRUEPHY_BIT_SET, 4, 10, + NULL); + else + ET1310_PhyAccessMiBit(adapter, + TRUEPHY_BIT_CLEAR, 4, 10, + NULL); + } else { + ET1310_PhyAccessMiBit(adapter, + TRUEPHY_BIT_CLEAR, 4, 10, NULL); + ET1310_PhyAccessMiBit(adapter, + TRUEPHY_BIT_CLEAR, 4, 11, NULL); + } - MiRead(etdev, PHY_CONTROL, &data); + switch (adapter->AiForceSpeed) { + case 10: + if (adapter->AiForceDpx == 1) + TPAL_SetPhy10HalfDuplex(adapter); + else if (adapter->AiForceDpx == 2) + TPAL_SetPhy10FullDuplex(adapter); + else + TPAL_SetPhy10Force(adapter); + break; + case 100: + if (adapter->AiForceDpx == 1) + TPAL_SetPhy100HalfDuplex(adapter); + else if (adapter->AiForceDpx == 2) + TPAL_SetPhy100FullDuplex(adapter); + else + TPAL_SetPhy100Force(adapter); + break; + case 1000: + TPAL_SetPhy1000FullDuplex(adapter); + break; + } - if (enable == true) { - /* Autonegotiation ON */ - data |= 0x1000; - MiWrite(etdev, PHY_CONTROL, data); - } else { - /* Autonegotiation OFF */ - data &= ~0x1000; - MiWrite(etdev, PHY_CONTROL, data); + return status; } } -void ET1310_PhyDuplexMode(struct et131x_adapter *etdev, uint16_t duplex) +void et131x_Mii_check(struct et131x_adapter *etdev, + MI_BMSR_t bmsr, MI_BMSR_t bmsr_ints) { - uint16_t data; + u8 link_status; + u32 autoneg_status; + u32 speed; + u32 duplex; + u32 mdi_mdix; + u32 masterslave; + u32 polarity; + unsigned long flags; - MiRead(etdev, PHY_CONTROL, &data); + if (bmsr_ints.bits.link_status) { + if (bmsr.bits.link_status) { + etdev->PoMgmt.TransPhyComaModeOnBoot = 20; - if (duplex == TRUEPHY_DUPLEX_FULL) { - /* Set Full Duplex */ - data |= 0x100; - MiWrite(etdev, PHY_CONTROL, data); - } else { - /* Set Half Duplex */ - data &= ~0x100; - MiWrite(etdev, PHY_CONTROL, data); - } -} + /* Update our state variables and indicate the + * connected state + */ + spin_lock_irqsave(&etdev->Lock, flags); -void ET1310_PhySpeedSelect(struct et131x_adapter *etdev, uint16_t speed) -{ - uint16_t data; + etdev->MediaState = NETIF_STATUS_MEDIA_CONNECT; + etdev->Flags &= ~fMP_ADAPTER_LINK_DETECTION; - /* Read the PHY control register */ - MiRead(etdev, PHY_CONTROL, &data); + spin_unlock_irqrestore(&etdev->Lock, flags); - /* Clear all Speed settings (Bits 6, 13) */ - data &= ~0x2040; + netif_carrier_on(etdev->netdev); + } else { + dev_warn(&etdev->pdev->dev, + "Link down - cable problem ?\n"); - /* Reset the speed bits based on user selection */ - switch (speed) { - case TRUEPHY_SPEED_10MBPS: - /* Bits already cleared above, do nothing */ - break; + if (etdev->linkspeed == TRUEPHY_SPEED_10MBPS) { + /* NOTE - Is there a way to query this without + * TruePHY? + * && TRU_QueryCoreType(etdev->hTruePhy, 0) == EMI_TRUEPHY_A13O) { + */ + u16 Register18; - case TRUEPHY_SPEED_100MBPS: - /* 100M == Set bit 13 */ - data |= 0x2000; - break; + MiRead(etdev, 0x12, &Register18); + MiWrite(etdev, 0x12, Register18 | 0x4); + MiWrite(etdev, 0x10, Register18 | 0x8402); + MiWrite(etdev, 0x11, Register18 | 511); + MiWrite(etdev, 0x12, Register18); + } - case TRUEPHY_SPEED_1000MBPS: - default: - data |= 0x0040; - break; - } + /* For the first N seconds of life, we are in "link + * detection" When we are in this state, we should + * only report "connected". When the LinkDetection + * Timer expires, we can report disconnected (handled + * in the LinkDetectionDPC). + */ + if (!(etdev->Flags & fMP_ADAPTER_LINK_DETECTION) || + (etdev->MediaState == NETIF_STATUS_MEDIA_DISCONNECT)) { + spin_lock_irqsave(&etdev->Lock, flags); + etdev->MediaState = + NETIF_STATUS_MEDIA_DISCONNECT; + spin_unlock_irqrestore(&etdev->Lock, + flags); - /* Write back the new speed */ - MiWrite(etdev, PHY_CONTROL, data); -} + netif_carrier_off(etdev->netdev); + } -void ET1310_PhyAdvertise1000BaseT(struct et131x_adapter *etdev, - uint16_t duplex) -{ - uint16_t data; + etdev->linkspeed = 0; + etdev->duplex_mode = 0; - /* Read the PHY 1000 Base-T Control Register */ - MiRead(etdev, PHY_1000_CONTROL, &data); + /* Free the packets being actively sent & stopped */ + et131x_free_busy_send_packets(etdev); - /* Clear Bits 8,9 */ - data &= ~0x0300; + /* Re-initialize the send structures */ + et131x_init_send(etdev); - switch (duplex) { - case TRUEPHY_ADV_DUPLEX_NONE: - /* Duplex already cleared, do nothing */ - break; + /* Reset the RFD list and re-start RU */ + et131x_reset_recv(etdev); - case TRUEPHY_ADV_DUPLEX_FULL: - /* Set Bit 9 */ - data |= 0x0200; - break; + /* + * Bring the device back to the state it was during + * init prior to autonegotiation being complete. This + * way, when we get the auto-neg complete interrupt, + * we can complete init by calling ConfigMacREGS2. + */ + et131x_soft_reset(etdev); - case TRUEPHY_ADV_DUPLEX_HALF: - /* Set Bit 8 */ - data |= 0x0100; - break; + /* Setup ET1310 as per the documentation */ + et131x_adapter_setup(etdev); - case TRUEPHY_ADV_DUPLEX_BOTH: - default: - data |= 0x0300; - break; + /* Setup the PHY into coma mode until the cable is + * plugged back in + */ + if (etdev->RegistryPhyComa == 1) + EnablePhyComa(etdev); + } } - /* Write back advertisement */ - MiWrite(etdev, PHY_1000_CONTROL, data); -} + if (bmsr_ints.bits.auto_neg_complete || + (etdev->AiForceDpx == 3 && bmsr_ints.bits.link_status)) { + if (bmsr.bits.auto_neg_complete || etdev->AiForceDpx == 3) { + ET1310_PhyLinkStatus(etdev, + &link_status, &autoneg_status, + &speed, &duplex, &mdi_mdix, + &masterslave, &polarity); -void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *etdev, - uint16_t duplex) -{ - uint16_t data; + etdev->linkspeed = speed; + etdev->duplex_mode = duplex; - /* Read the Autonegotiation Register (10/100) */ - MiRead(etdev, PHY_AUTO_ADVERTISEMENT, &data); + etdev->PoMgmt.TransPhyComaModeOnBoot = 20; - /* Clear bits 7,8 */ - data &= ~0x0180; + if (etdev->linkspeed == TRUEPHY_SPEED_10MBPS) { + /* + * NOTE - Is there a way to query this without + * TruePHY? + * && TRU_QueryCoreType(etdev->hTruePhy, 0)== EMI_TRUEPHY_A13O) { + */ + u16 Register18; - switch (duplex) { - case TRUEPHY_ADV_DUPLEX_NONE: - /* Duplex already cleared, do nothing */ - break; + MiRead(etdev, 0x12, &Register18); + MiWrite(etdev, 0x12, Register18 | 0x4); + MiWrite(etdev, 0x10, Register18 | 0x8402); + MiWrite(etdev, 0x11, Register18 | 511); + MiWrite(etdev, 0x12, Register18); + } - case TRUEPHY_ADV_DUPLEX_FULL: - /* Set Bit 8 */ - data |= 0x0100; - break; + ConfigFlowControl(etdev); - case TRUEPHY_ADV_DUPLEX_HALF: - /* Set Bit 7 */ - data |= 0x0080; - break; + if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS && + etdev->RegistryJumboPacket > 2048) + ET1310_PhyAndOrReg(etdev, 0x16, 0xcfff, + 0x2000); - case TRUEPHY_ADV_DUPLEX_BOTH: - default: - /* Set Bits 7,8 */ - data |= 0x0180; - break; + SetRxDmaTimer(etdev); + ConfigMACRegs2(etdev); + } } - - /* Write back advertisement */ - MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, data); } -void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *etdev, - uint16_t duplex) -{ - uint16_t data; - - /* Read the Autonegotiation Register (10/100) */ - MiRead(etdev, PHY_AUTO_ADVERTISEMENT, &data); - - /* Clear bits 5,6 */ - data &= ~0x0060; +/* + * The routines which follow provide low-level access to the PHY, and are used + * primarily by the routines above (although there are a few places elsewhere + * in the driver where this level of access is required). + */ - switch (duplex) { - case TRUEPHY_ADV_DUPLEX_NONE: - /* Duplex already cleared, do nothing */ - break; +static const u16 ConfigPhy[25][2] = { + /* Reg Value Register */ + /* Addr */ + {0x880B, 0x0926}, /* AfeIfCreg4B1000Msbs */ + {0x880C, 0x0926}, /* AfeIfCreg4B100Msbs */ + {0x880D, 0x0926}, /* AfeIfCreg4B10Msbs */ - case TRUEPHY_ADV_DUPLEX_FULL: - /* Set Bit 6 */ - data |= 0x0040; - break; + {0x880E, 0xB4D3}, /* AfeIfCreg4B1000Lsbs */ + {0x880F, 0xB4D3}, /* AfeIfCreg4B100Lsbs */ + {0x8810, 0xB4D3}, /* AfeIfCreg4B10Lsbs */ - case TRUEPHY_ADV_DUPLEX_HALF: - /* Set Bit 5 */ - data |= 0x0020; - break; + {0x8805, 0xB03E}, /* AfeIfCreg3B1000Msbs */ + {0x8806, 0xB03E}, /* AfeIfCreg3B100Msbs */ + {0x8807, 0xFF00}, /* AfeIfCreg3B10Msbs */ - case TRUEPHY_ADV_DUPLEX_BOTH: - default: - /* Set Bits 5,6 */ - data |= 0x0060; - break; - } + {0x8808, 0xE090}, /* AfeIfCreg3B1000Lsbs */ + {0x8809, 0xE110}, /* AfeIfCreg3B100Lsbs */ + {0x880A, 0x0000}, /* AfeIfCreg3B10Lsbs */ - /* Write back advertisement */ - MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, data); -} + {0x300D, 1}, /* DisableNorm */ -void ET1310_PhyLinkStatus(struct et131x_adapter *etdev, - uint8_t *link_status, - uint32_t *autoneg, - uint32_t *linkspeed, - uint32_t *duplex_mode, - uint32_t *mdi_mdix, - uint32_t *masterslave, uint32_t *polarity) -{ - uint16_t mistatus = 0; - uint16_t is1000BaseT = 0; - uint16_t vmi_phystatus = 0; - uint16_t control = 0; + {0x280C, 0x0180}, /* LinkHoldEnd */ - MiRead(etdev, PHY_STATUS, &mistatus); - MiRead(etdev, PHY_1000_STATUS, &is1000BaseT); - MiRead(etdev, PHY_PHY_STATUS, &vmi_phystatus); - MiRead(etdev, PHY_CONTROL, &control); + {0x1C21, 0x0002}, /* AlphaM */ - if (link_status) { - *link_status = - (unsigned char)((vmi_phystatus & 0x0040) ? 1 : 0); - } + {0x3821, 6}, /* FfeLkgTx0 */ + {0x381D, 1}, /* FfeLkg1g4 */ + {0x381E, 1}, /* FfeLkg1g5 */ + {0x381F, 1}, /* FfeLkg1g6 */ + {0x3820, 1}, /* FfeLkg1g7 */ - if (autoneg) { - *autoneg = - (control & 0x1000) ? ((vmi_phystatus & 0x0020) ? - TRUEPHY_ANEG_COMPLETE : - TRUEPHY_ANEG_NOT_COMPLETE) : - TRUEPHY_ANEG_DISABLED; - } + {0x8402, 0x01F0}, /* Btinact */ + {0x800E, 20}, /* LftrainTime */ + {0x800F, 24}, /* DvguardTime */ + {0x8010, 46}, /* IdlguardTime */ - if (linkspeed) - *linkspeed = (vmi_phystatus & 0x0300) >> 8; + {0, 0} - if (duplex_mode) - *duplex_mode = (vmi_phystatus & 0x0080) >> 7; +}; - if (mdi_mdix) - /* NOTE: Need to complete this */ - *mdi_mdix = 0; +/* condensed version of the phy initialization routine */ +void ET1310_PhyInit(struct et131x_adapter *etdev) +{ + u16 data, index; - if (masterslave) { - *masterslave = - (is1000BaseT & 0x4000) ? TRUEPHY_CFG_MASTER : - TRUEPHY_CFG_SLAVE; - } + if (etdev == NULL) + return; - if (polarity) { - *polarity = - (vmi_phystatus & 0x0400) ? TRUEPHY_POLARITY_INVERTED : - TRUEPHY_POLARITY_NORMAL; - } -} + /* get the identity (again ?) */ + MiRead(etdev, PHY_ID_1, &data); + MiRead(etdev, PHY_ID_2, &data); -void ET1310_PhyAndOrReg(struct et131x_adapter *etdev, - uint16_t regnum, uint16_t andMask, uint16_t orMask) -{ - uint16_t reg; + /* what does this do/achieve ? */ + MiRead(etdev, PHY_MPHY_CONTROL_REG, &data); /* should read 0002 */ + MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0006); - /* Read the requested register */ - MiRead(etdev, regnum, ®); + /* read modem register 0402, should I do something with the return + data ? */ + MiWrite(etdev, PHY_INDEX_REG, 0x0402); + MiRead(etdev, PHY_DATA_REG, &data); - /* Apply the AND mask */ - reg &= andMask; + /* what does this do/achieve ? */ + MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002); - /* Apply the OR mask */ - reg |= orMask; + /* get the identity (again ?) */ + MiRead(etdev, PHY_ID_1, &data); + MiRead(etdev, PHY_ID_2, &data); - /* Write the value back to the register */ - MiWrite(etdev, regnum, reg); -} + /* what does this achieve ? */ + MiRead(etdev, PHY_MPHY_CONTROL_REG, &data); /* should read 0002 */ + MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0006); -void ET1310_PhyAccessMiBit(struct et131x_adapter *etdev, uint16_t action, - uint16_t regnum, uint16_t bitnum, uint8_t *value) -{ - uint16_t reg; - uint16_t mask = 0; + /* read modem register 0402, should I do something with + the return data? */ + MiWrite(etdev, PHY_INDEX_REG, 0x0402); + MiRead(etdev, PHY_DATA_REG, &data); - /* Create a mask to isolate the requested bit */ - mask = 0x0001 << bitnum; + MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002); - /* Read the requested register */ - MiRead(etdev, regnum, ®); + /* what does this achieve (should return 0x1040) */ + MiRead(etdev, PHY_CONTROL, &data); + MiRead(etdev, PHY_MPHY_CONTROL_REG, &data); /* should read 0002 */ + MiWrite(etdev, PHY_CONTROL, 0x1840); - switch (action) { - case TRUEPHY_BIT_READ: - if (value != NULL) - *value = (reg & mask) >> bitnum; - break; + MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0007); - case TRUEPHY_BIT_SET: - reg |= mask; - MiWrite(etdev, regnum, reg); - break; + /* here the writing of the array starts.... */ + index = 0; + while (ConfigPhy[index][0] != 0x0000) { + /* write value */ + MiWrite(etdev, PHY_INDEX_REG, ConfigPhy[index][0]); + MiWrite(etdev, PHY_DATA_REG, ConfigPhy[index][1]); - case TRUEPHY_BIT_CLEAR: - reg &= ~mask; - MiWrite(etdev, regnum, reg); - break; + /* read it back */ + MiWrite(etdev, PHY_INDEX_REG, ConfigPhy[index][0]); + MiRead(etdev, PHY_DATA_REG, &data); - default: - break; + /* do a check on the value read back ? */ + index++; } + /* here the writing of the array ends... */ + + MiRead(etdev, PHY_CONTROL, &data); /* 0x1840 */ + MiRead(etdev, PHY_MPHY_CONTROL_REG, &data);/* should read 0007 */ + MiWrite(etdev, PHY_CONTROL, 0x1040); + MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002); } + diff --git a/drivers/staging/et131x/et1310_phy.h b/drivers/staging/et131x/et1310_phy.h index 6978b25c7e13..0ea12378fdaa 100644 --- a/drivers/staging/et131x/et1310_phy.h +++ b/drivers/staging/et131x/et1310_phy.h @@ -739,25 +739,15 @@ typedef union _MI_LCR2_t { /* Forward declaration of the private adapter structure */ struct et131x_adapter; -/* OS Specific Functions*/ -void TPAL_SetPhy10HalfDuplex(struct et131x_adapter *adapter); -void TPAL_SetPhy10FullDuplex(struct et131x_adapter *adapter); -void TPAL_SetPhy10Force(struct et131x_adapter *pAdapter); -void TPAL_SetPhy100HalfDuplex(struct et131x_adapter *adapter); -void TPAL_SetPhy100FullDuplex(struct et131x_adapter *adapter); -void TPAL_SetPhy100Force(struct et131x_adapter *pAdapter); -void TPAL_SetPhy1000FullDuplex(struct et131x_adapter *adapter); -void TPAL_SetPhyAutoNeg(struct et131x_adapter *adapter); - /* Prototypes for ET1310_phy.c */ int et131x_xcvr_find(struct et131x_adapter *adapter); int et131x_setphy_normal(struct et131x_adapter *adapter); -int32_t PhyMiRead(struct et131x_adapter *adapter, - u8 xcvrAddr, u8 xcvrReg, u16 *value); /* static inline function does not work because et131x_adapter is not always * defined */ +int PhyMiRead(struct et131x_adapter *adapter, u8 xcvrAddr, + u8 xcvrReg, u16 *value); #define MiRead(adapter, xcvrReg, value) \ PhyMiRead((adapter), (adapter)->Stats.xcvr_addr, (xcvrReg), (value)) @@ -857,24 +847,8 @@ void SetPhy_10BaseTHalfDuplex(struct et131x_adapter *adapter); void ET1310_PhyInit(struct et131x_adapter *adapter); void ET1310_PhyReset(struct et131x_adapter *adapter); void ET1310_PhyPowerDown(struct et131x_adapter *adapter, bool down); -void ET1310_PhyAutoNeg(struct et131x_adapter *adapter, bool enable); -void ET1310_PhyDuplexMode(struct et131x_adapter *adapter, u16 duplex); -void ET1310_PhySpeedSelect(struct et131x_adapter *adapter, u16 speed); void ET1310_PhyAdvertise1000BaseT(struct et131x_adapter *adapter, u16 duplex); -void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *adapter, - u16 duplex); -void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *adapter, - u16 duplex); -void ET1310_PhyLinkStatus(struct et131x_adapter *adapter, - u8 *Link_status, - u32 *autoneg, - u32 *linkspeed, - u32 *duplex_mode, - u32 *mdi_mdix, - u32 *masterslave, u32 *polarity); -void ET1310_PhyAndOrReg(struct et131x_adapter *adapter, - u16 regnum, u16 andMask, u16 orMask); void ET1310_PhyAccessMiBit(struct et131x_adapter *adapter, u16 action, u16 regnum, u16 bitnum, u8 *value); -- GitLab From e1bc58459aa23ec4e8f1e1aa2cacae215d04a949 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Oct 2009 15:51:17 +0100 Subject: [PATCH 125/235] Staging: et131x: Clean up the phy code, especially dup stuff Fold in the TPAL stuff and remove the duplication Clean up other stuff where we do un-needed work or have verbose implementations Comment some of the functions as we go Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_phy.c | 622 ++++++++++------------------ drivers/staging/et131x/et1310_phy.h | 2 +- 2 files changed, 215 insertions(+), 409 deletions(-) diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c index c1aedbb2469a..6ecad619f779 100644 --- a/drivers/staging/et131x/et1310_phy.c +++ b/drivers/staging/et131x/et1310_phy.c @@ -98,21 +98,21 @@ #include "et1310_mac.h" /* Prototypes for functions with local scope */ -static int et131x_xcvr_init(struct et131x_adapter *adapter); +static void et131x_xcvr_init(struct et131x_adapter *etdev); /** * PhyMiRead - Read from the PHY through the MII Interface on the MAC - * @adapter: pointer to our private adapter structure + * @etdev: pointer to our private adapter structure * @xcvrAddr: the address of the transciever * @xcvrReg: the register to read * @value: pointer to a 16-bit value in which the value will be stored * * Returns 0 on success, errno on failure (as defined in errno.h) */ -int PhyMiRead(struct et131x_adapter *adapter, u8 xcvrAddr, +int PhyMiRead(struct et131x_adapter *etdev, u8 xcvrAddr, u8 xcvrReg, u16 *value) { - struct _MAC_t __iomem *mac = &adapter->regs->mac; + struct _MAC_t __iomem *mac = &etdev->regs->mac; int status = 0; u32 delay; u32 miiAddr; @@ -144,9 +144,9 @@ int PhyMiRead(struct et131x_adapter *adapter, u8 xcvrAddr, /* If we hit the max delay, we could not read the register */ if (delay == 50) { - dev_warn(&adapter->pdev->dev, + dev_warn(&etdev->pdev->dev, "xcvrReg 0x%08x could not be read\n", xcvrReg); - dev_warn(&adapter->pdev->dev, "status is 0x%08x\n", + dev_warn(&etdev->pdev->dev, "status is 0x%08x\n", miiIndicator); status = -EIO; @@ -170,7 +170,7 @@ int PhyMiRead(struct et131x_adapter *adapter, u8 xcvrAddr, /** * MiWrite - Write to a PHY register through the MII interface of the MAC - * @adapter: pointer to our private adapter structure + * @etdev: pointer to our private adapter structure * @xcvrReg: the register to read * @value: 16-bit value to write * @@ -178,11 +178,11 @@ int PhyMiRead(struct et131x_adapter *adapter, u8 xcvrAddr, * * Return 0 on success, errno on failure (as defined in errno.h) */ -int MiWrite(struct et131x_adapter *adapter, u8 xcvrReg, u16 value) +int MiWrite(struct et131x_adapter *etdev, u8 xcvrReg, u16 value) { - struct _MAC_t __iomem *mac = &adapter->regs->mac; + struct _MAC_t __iomem *mac = &etdev->regs->mac; int status = 0; - u8 xcvrAddr = adapter->Stats.xcvr_addr; + u8 xcvrAddr = etdev->Stats.xcvr_addr; u32 delay; u32 miiAddr; u32 miiCmd; @@ -214,14 +214,14 @@ int MiWrite(struct et131x_adapter *adapter, u8 xcvrReg, u16 value) if (delay == 100) { u16 TempValue; - dev_warn(&adapter->pdev->dev, + dev_warn(&etdev->pdev->dev, "xcvrReg 0x%08x could not be written", xcvrReg); - dev_warn(&adapter->pdev->dev, "status is 0x%08x\n", + dev_warn(&etdev->pdev->dev, "status is 0x%08x\n", miiIndicator); - dev_warn(&adapter->pdev->dev, "command is 0x%08x\n", + dev_warn(&etdev->pdev->dev, "command is 0x%08x\n", readl(&mac->mii_mgmt_cmd)); - MiRead(adapter, xcvrReg, &TempValue); + MiRead(etdev, xcvrReg, &TempValue); status = -EIO; } @@ -239,13 +239,12 @@ int MiWrite(struct et131x_adapter *adapter, u8 xcvrReg, u16 value) /** * et131x_xcvr_find - Find the PHY ID - * @adapter: pointer to our private adapter structure + * @etdev: pointer to our private adapter structure * * Returns 0 on success, errno on failure (as defined in errno.h) */ -int et131x_xcvr_find(struct et131x_adapter *adapter) +int et131x_xcvr_find(struct et131x_adapter *etdev) { - int status = -ENODEV; u8 xcvr_addr; MI_IDR1_t idr1; MI_IDR2_t idr2; @@ -254,42 +253,22 @@ int et131x_xcvr_find(struct et131x_adapter *adapter) /* We need to get xcvr id and address we just get the first one */ for (xcvr_addr = 0; xcvr_addr < 32; xcvr_addr++) { /* Read the ID from the PHY */ - PhyMiRead(adapter, xcvr_addr, + PhyMiRead(etdev, xcvr_addr, (u8) offsetof(MI_REGS_t, idr1), &idr1.value); - PhyMiRead(adapter, xcvr_addr, + PhyMiRead(etdev, xcvr_addr, (u8) offsetof(MI_REGS_t, idr2), &idr2.value); xcvr_id = (u32) ((idr1.value << 16) | idr2.value); - if ((idr1.value != 0) && (idr1.value != 0xffff)) { - adapter->Stats.xcvr_id = xcvr_id; - adapter->Stats.xcvr_addr = xcvr_addr; - - status = 0; - break; + if (idr1.value != 0 && idr1.value != 0xffff) { + etdev->Stats.xcvr_id = xcvr_id; + etdev->Stats.xcvr_addr = xcvr_addr; + return 0; } } - return status; -} - -/** - * et131x_setphy_normal - Set PHY for normal operation. - * @adapter: pointer to our private adapter structure - * - * Used by Power Management to force the PHY into 10 Base T half-duplex mode, - * when going to D3 in WOL mode. Also used during initialization to set the - * PHY for normal operation. - */ -int et131x_setphy_normal(struct et131x_adapter *adapter) -{ - int status; - - /* Make sure the PHY is powered up */ - ET1310_PhyPowerDown(adapter, 0); - status = et131x_xcvr_init(adapter); - return status; + return -ENODEV; } void ET1310_PhyReset(struct et131x_adapter *etdev) @@ -297,88 +276,105 @@ void ET1310_PhyReset(struct et131x_adapter *etdev) MiWrite(etdev, PHY_CONTROL, 0x8000); } +/** + * ET1310_PhyPowerDown - PHY power control + * @etdev: device to control + * @down: true for off/false for back on + * + * one hundred, ten, one thousand megs + * How would you like to have your LAN accessed + * Can't you see that this code processed + * Phy power, phy power.. + */ + void ET1310_PhyPowerDown(struct et131x_adapter *etdev, bool down) { u16 data; MiRead(etdev, PHY_CONTROL, &data); - - if (down == false) { - /* Power UP */ - data &= ~0x0800; - MiWrite(etdev, PHY_CONTROL, data); - } else { - /* Power DOWN */ + data &= ~0x0800; /* Power UP */ + if (down) /* Power DOWN */ data |= 0x0800; - MiWrite(etdev, PHY_CONTROL, data); - } + MiWrite(etdev, PHY_CONTROL, data); } +/** + * ET130_PhyAutoNEg - autonegotiate control + * @etdev: device to control + * @enabe: autoneg on/off + * + * Set up the autonegotiation state according to whether we will be + * negotiating the state or forcing a speed. + */ + static void ET1310_PhyAutoNeg(struct et131x_adapter *etdev, bool enable) { u16 data; MiRead(etdev, PHY_CONTROL, &data); - - if (enable == true) { - /* Autonegotiation ON */ - data |= 0x1000; - MiWrite(etdev, PHY_CONTROL, data); - } else { - /* Autonegotiation OFF */ - data &= ~0x1000; - MiWrite(etdev, PHY_CONTROL, data); - } + data &= ~0x1000; /* Autonegotiation OFF */ + if (enable) + data |= 0x1000; /* Autonegotiation ON */ + MiWrite(etdev, PHY_CONTROL, data); } +/** + * ET130_PhyDuplexMode - duplex control + * @etdev: device to control + * @duplex: duplex on/off + * + * Set up the duplex state on the PHY + */ + static void ET1310_PhyDuplexMode(struct et131x_adapter *etdev, u16 duplex) { u16 data; MiRead(etdev, PHY_CONTROL, &data); - - if (duplex == TRUEPHY_DUPLEX_FULL) { - /* Set Full Duplex */ - data |= 0x100; - MiWrite(etdev, PHY_CONTROL, data); - } else { - /* Set Half Duplex */ - data &= ~0x100; - MiWrite(etdev, PHY_CONTROL, data); - } + data &= ~0x100; /* Set Half Duplex */ + if (duplex == TRUEPHY_DUPLEX_FULL) + data |= 0x100; /* Set Full Duplex */ + MiWrite(etdev, PHY_CONTROL, data); } +/** + * ET130_PhySpeedSelect - speed control + * @etdev: device to control + * @duplex: duplex on/off + * + * Set the speed of our PHY. + */ + static void ET1310_PhySpeedSelect(struct et131x_adapter *etdev, u16 speed) { u16 data; + static const u16 bits[3]={0x0000, 0x2000, 0x0040}; /* Read the PHY control register */ MiRead(etdev, PHY_CONTROL, &data); - /* Clear all Speed settings (Bits 6, 13) */ data &= ~0x2040; - - /* Reset the speed bits based on user selection */ - switch (speed) { - case TRUEPHY_SPEED_10MBPS: - /* Bits already cleared above, do nothing */ - break; - - case TRUEPHY_SPEED_100MBPS: - /* 100M == Set bit 13 */ - data |= 0x2000; - break; - - case TRUEPHY_SPEED_1000MBPS: - default: - data |= 0x0040; - break; - } - /* Write back the new speed */ - MiWrite(etdev, PHY_CONTROL, data); + MiWrite(etdev, PHY_CONTROL, data | bits[speed]); } +/** + * ET1310_PhyLinkStatus - read link state + * @etdev: device to read + * @link_status: reported link state + * @autoneg: reported autonegotiation state (complete/incomplete/disabled) + * @linkspeed: returnedlink speed in use + * @duplex_mode: reported half/full duplex state + * @mdi_mdix: not yet working + * @masterslave: report whether we are master or slave + * @polarity: link polarity + * + * I can read your lan like a magazine + * I see if your up + * I know your link speed + * I see all the setting that you'd rather keep + */ + static void ET1310_PhyLinkStatus(struct et131x_adapter *etdev, u8 *link_status, u32 *autoneg, @@ -397,40 +393,20 @@ static void ET1310_PhyLinkStatus(struct et131x_adapter *etdev, MiRead(etdev, PHY_PHY_STATUS, &vmi_phystatus); MiRead(etdev, PHY_CONTROL, &control); - if (link_status) { - *link_status = - (unsigned char)((vmi_phystatus & 0x0040) ? 1 : 0); - } - - if (autoneg) { - *autoneg = - (control & 0x1000) ? ((vmi_phystatus & 0x0020) ? + *link_status = (vmi_phystatus & 0x0040) ? 1 : 0; + *autoneg = (control & 0x1000) ? ((vmi_phystatus & 0x0020) ? TRUEPHY_ANEG_COMPLETE : TRUEPHY_ANEG_NOT_COMPLETE) : TRUEPHY_ANEG_DISABLED; - } - - if (linkspeed) - *linkspeed = (vmi_phystatus & 0x0300) >> 8; - - if (duplex_mode) - *duplex_mode = (vmi_phystatus & 0x0080) >> 7; - - if (mdi_mdix) - /* NOTE: Need to complete this */ - *mdi_mdix = 0; - - if (masterslave) { - *masterslave = - (is1000BaseT & 0x4000) ? TRUEPHY_CFG_MASTER : - TRUEPHY_CFG_SLAVE; - } - - if (polarity) { - *polarity = - (vmi_phystatus & 0x0400) ? TRUEPHY_POLARITY_INVERTED : - TRUEPHY_POLARITY_NORMAL; - } + *linkspeed = (vmi_phystatus & 0x0300) >> 8; + *duplex_mode = (vmi_phystatus & 0x0080) >> 7; + /* NOTE: Need to complete this */ + *mdi_mdix = 0; + + *masterslave = (is1000BaseT & 0x4000) ? + TRUEPHY_CFG_MASTER : TRUEPHY_CFG_SLAVE; + *polarity = (vmi_phystatus & 0x0400) ? + TRUEPHY_POLARITY_INVERTED : TRUEPHY_POLARITY_NORMAL; } static void ET1310_PhyAndOrReg(struct et131x_adapter *etdev, @@ -438,46 +414,33 @@ static void ET1310_PhyAndOrReg(struct et131x_adapter *etdev, { u16 reg; - /* Read the requested register */ MiRead(etdev, regnum, ®); - - /* Apply the AND mask */ reg &= andMask; - - /* Apply the OR mask */ reg |= orMask; - - /* Write the value back to the register */ MiWrite(etdev, regnum, reg); } -/* Still used from _mac */ +/* Still used from _mac for BIT_READ */ void ET1310_PhyAccessMiBit(struct et131x_adapter *etdev, u16 action, u16 regnum, u16 bitnum, u8 *value) { u16 reg; - u16 mask = 0; - - /* Create a mask to isolate the requested bit */ - mask = 0x0001 << bitnum; + u16 mask = 0x0001 << bitnum; /* Read the requested register */ MiRead(etdev, regnum, ®); switch (action) { case TRUEPHY_BIT_READ: - if (value != NULL) - *value = (reg & mask) >> bitnum; + *value = (reg & mask) >> bitnum; break; case TRUEPHY_BIT_SET: - reg |= mask; - MiWrite(etdev, regnum, reg); + MiWrite(etdev, regnum, reg | mask); break; case TRUEPHY_BIT_CLEAR: - reg &= ~mask; - MiWrite(etdev, regnum, reg); + MiWrite(etdev, regnum, reg & ~mask); break; default: @@ -595,226 +558,38 @@ static void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *etdev, MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, data); } - /** - * TPAL_SetPhy10HalfDuplex - Force the phy into 10 Base T Half Duplex mode. - * @etdev: pointer to the adapter structure - * - * Also sets the MAC so it is syncd up properly - */ -static void TPAL_SetPhy10HalfDuplex(struct et131x_adapter *etdev) -{ - /* Power down PHY */ - ET1310_PhyPowerDown(etdev, 1); - - /* First we need to turn off all other advertisement */ - ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - - ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - - /* Set our advertise values accordingly */ - ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_HALF); - - /* Power up PHY */ - ET1310_PhyPowerDown(etdev, 0); -} - -/** - * TPAL_SetPhy10FullDuplex - Force the phy into 10 Base T Full Duplex mode. - * @etdev: pointer to the adapter structure - * - * Also sets the MAC so it is syncd up properly - */ -static void TPAL_SetPhy10FullDuplex(struct et131x_adapter *etdev) -{ - /* Power down PHY */ - ET1310_PhyPowerDown(etdev, 1); - - /* First we need to turn off all other advertisement */ - ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - - ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - - /* Set our advertise values accordingly */ - ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL); - - /* Power up PHY */ - ET1310_PhyPowerDown(etdev, 0); -} - -/** - * TPAL_SetPhy10Force - Force Base-T FD mode WITHOUT using autonegotiation - * @etdev: pointer to the adapter structure - */ -static void TPAL_SetPhy10Force(struct et131x_adapter *etdev) -{ - /* Power down PHY */ - ET1310_PhyPowerDown(etdev, 1); - - /* Disable autoneg */ - ET1310_PhyAutoNeg(etdev, false); - - /* Disable all advertisement */ - ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - - /* Force 10 Mbps */ - ET1310_PhySpeedSelect(etdev, TRUEPHY_SPEED_10MBPS); - - /* Force Full duplex */ - ET1310_PhyDuplexMode(etdev, TRUEPHY_DUPLEX_FULL); - - /* Power up PHY */ - ET1310_PhyPowerDown(etdev, 0); -} - -/** - * TPAL_SetPhy100HalfDuplex - Force 100 Base T Half Duplex mode. - * @etdev: pointer to the adapter structure - * - * Also sets the MAC so it is syncd up properly. - */ -static void TPAL_SetPhy100HalfDuplex(struct et131x_adapter *etdev) -{ - /* Power down PHY */ - ET1310_PhyPowerDown(etdev, 1); - - /* first we need to turn off all other advertisement */ - ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - - ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - - /* Set our advertise values accordingly */ - ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_HALF); - - /* Set speed */ - ET1310_PhySpeedSelect(etdev, TRUEPHY_SPEED_100MBPS); - - /* Power up PHY */ - ET1310_PhyPowerDown(etdev, 0); -} - -/** - * TPAL_SetPhy100FullDuplex - Force 100 Base T Full Duplex mode. - * @etdev: pointer to the adapter structure - * - * Also sets the MAC so it is syncd up properly - */ -static void TPAL_SetPhy100FullDuplex(struct et131x_adapter *etdev) -{ - /* Power down PHY */ - ET1310_PhyPowerDown(etdev, 1); - - /* First we need to turn off all other advertisement */ - ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - - ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - - /* Set our advertise values accordingly */ - ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL); - - /* Power up PHY */ - ET1310_PhyPowerDown(etdev, 0); -} - -/** - * TPAL_SetPhy100Force - Force 100 BaseT FD mode WITHOUT using autonegotiation - * @etdev: pointer to the adapter structure - */ -static void TPAL_SetPhy100Force(struct et131x_adapter *etdev) -{ - /* Power down PHY */ - ET1310_PhyPowerDown(etdev, 1); - - /* Disable autoneg */ - ET1310_PhyAutoNeg(etdev, false); - - /* Disable all advertisement */ - ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - - /* Force 100 Mbps */ - ET1310_PhySpeedSelect(etdev, TRUEPHY_SPEED_100MBPS); - - /* Force Full duplex */ - ET1310_PhyDuplexMode(etdev, TRUEPHY_DUPLEX_FULL); - - /* Power up PHY */ - ET1310_PhyPowerDown(etdev, 0); -} - -/** - * TPAL_SetPhy1000FullDuplex - Force 1000 Base T Full Duplex mode - * @etdev: pointer to the adapter structure + * et131x_setphy_normal - Set PHY for normal operation. + * @etdev: pointer to our private adapter structure * - * Also sets the MAC so it is syncd up properly. - */ -static void TPAL_SetPhy1000FullDuplex(struct et131x_adapter *etdev) -{ - /* Power down PHY */ - ET1310_PhyPowerDown(etdev, 1); - - /* first we need to turn off all other advertisement */ - ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - - ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - - /* set our advertise values accordingly */ - ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL); - - /* power up PHY */ - ET1310_PhyPowerDown(etdev, 0); -} - -/** - * TPAL_SetPhyAutoNeg - Set phy to autonegotiation mode. - * @etdev: pointer to the adapter structure + * Used by Power Management to force the PHY into 10 Base T half-duplex mode, + * when going to D3 in WOL mode. Also used during initialization to set the + * PHY for normal operation. */ -static void TPAL_SetPhyAutoNeg(struct et131x_adapter *etdev) +void et131x_setphy_normal(struct et131x_adapter *etdev) { - /* Power down PHY */ - ET1310_PhyPowerDown(etdev, 1); - - /* Turn on advertisement of all capabilities */ - ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_BOTH); - - ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_BOTH); - - if (etdev->pdev->device != ET131X_PCI_DEVICE_ID_FAST) - ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL); - else - ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - - /* Make sure auto-neg is ON (it is disabled in FORCE modes) */ - ET1310_PhyAutoNeg(etdev, true); - - /* Power up PHY */ + /* Make sure the PHY is powered up */ ET1310_PhyPowerDown(etdev, 0); + et131x_xcvr_init(etdev); } - /** * et131x_xcvr_init - Init the phy if we are setting it into force mode - * @adapter: pointer to our private adapter structure + * @etdev: pointer to our private adapter structure * - * Returns 0 on success, errno on failure (as defined in errno.h) */ -static int et131x_xcvr_init(struct et131x_adapter *adapter) +static void et131x_xcvr_init(struct et131x_adapter *etdev) { - int status = 0; MI_IMR_t imr; MI_ISR_t isr; MI_LCR2_t lcr2; /* Zero out the adapter structure variable representing BMSR */ - adapter->Bmsr.value = 0; - - MiRead(adapter, (u8) offsetof(MI_REGS_t, isr), &isr.value); + etdev->Bmsr.value = 0; - MiRead(adapter, (u8) offsetof(MI_REGS_t, imr), &imr.value); + MiRead(etdev, (u8) offsetof(MI_REGS_t, isr), &isr.value); + MiRead(etdev, (u8) offsetof(MI_REGS_t, imr), &imr.value); /* Set the link status interrupt only. Bad behavior when link status * and auto neg are set, we run into a nested interrupt problem @@ -823,7 +598,7 @@ static int et131x_xcvr_init(struct et131x_adapter *adapter) imr.bits.link_status = 0x1; imr.bits.autoneg_status = 0x1; - MiWrite(adapter, (u8) offsetof(MI_REGS_t, imr), imr.value); + MiWrite(etdev, (u8) offsetof(MI_REGS_t, imr), imr.value); /* Set the LED behavior such that LED 1 indicates speed (off = * 10Mbits, blink = 100Mbits, on = 1000Mbits) and LED 2 indicates @@ -833,95 +608,126 @@ static int et131x_xcvr_init(struct et131x_adapter *adapter) * vendors; The LED behavior is now determined by vendor data in the * EEPROM. However, the above description is the default. */ - if ((adapter->eepromData[1] & 0x4) == 0) { - MiRead(adapter, (u8) offsetof(MI_REGS_t, lcr2), + if ((etdev->eepromData[1] & 0x4) == 0) { + MiRead(etdev, (u8) offsetof(MI_REGS_t, lcr2), &lcr2.value); - if ((adapter->eepromData[1] & 0x8) == 0) + if ((etdev->eepromData[1] & 0x8) == 0) lcr2.bits.led_tx_rx = 0x3; else lcr2.bits.led_tx_rx = 0x4; lcr2.bits.led_link = 0xa; - MiWrite(adapter, (u8) offsetof(MI_REGS_t, lcr2), + MiWrite(etdev, (u8) offsetof(MI_REGS_t, lcr2), lcr2.value); } /* Determine if we need to go into a force mode and set it */ - if (adapter->AiForceSpeed == 0 && adapter->AiForceDpx == 0) { - if (adapter->RegistryFlowControl == TxOnly || - adapter->RegistryFlowControl == Both) - ET1310_PhyAccessMiBit(adapter, + if (etdev->AiForceSpeed == 0 && etdev->AiForceDpx == 0) { + if (etdev->RegistryFlowControl == TxOnly || + etdev->RegistryFlowControl == Both) + ET1310_PhyAccessMiBit(etdev, TRUEPHY_BIT_SET, 4, 11, NULL); else - ET1310_PhyAccessMiBit(adapter, + ET1310_PhyAccessMiBit(etdev, TRUEPHY_BIT_CLEAR, 4, 11, NULL); - if (adapter->RegistryFlowControl == Both) - ET1310_PhyAccessMiBit(adapter, + if (etdev->RegistryFlowControl == Both) + ET1310_PhyAccessMiBit(etdev, TRUEPHY_BIT_SET, 4, 10, NULL); else - ET1310_PhyAccessMiBit(adapter, + ET1310_PhyAccessMiBit(etdev, TRUEPHY_BIT_CLEAR, 4, 10, NULL); /* Set the phy to autonegotiation */ - ET1310_PhyAutoNeg(adapter, true); + ET1310_PhyAutoNeg(etdev, true); /* NOTE - Do we need this? */ - ET1310_PhyAccessMiBit(adapter, TRUEPHY_BIT_SET, 0, 9, NULL); - return status; + ET1310_PhyAccessMiBit(etdev, TRUEPHY_BIT_SET, 0, 9, NULL); + return; + } + + ET1310_PhyAutoNeg(etdev, false); + + /* Set to the correct force mode. */ + if (etdev->AiForceDpx != 1) { + if (etdev->RegistryFlowControl == TxOnly || + etdev->RegistryFlowControl == Both) + ET1310_PhyAccessMiBit(etdev, + TRUEPHY_BIT_SET, 4, 11, NULL); + else + ET1310_PhyAccessMiBit(etdev, + TRUEPHY_BIT_CLEAR, 4, 11, NULL); + + if (etdev->RegistryFlowControl == Both) + ET1310_PhyAccessMiBit(etdev, + TRUEPHY_BIT_SET, 4, 10, NULL); + else + ET1310_PhyAccessMiBit(etdev, + TRUEPHY_BIT_CLEAR, 4, 10, NULL); } else { - ET1310_PhyAutoNeg(adapter, false); - - /* Set to the correct force mode. */ - if (adapter->AiForceDpx != 1) { - if (adapter->RegistryFlowControl == TxOnly || - adapter->RegistryFlowControl == Both) - ET1310_PhyAccessMiBit(adapter, - TRUEPHY_BIT_SET, 4, 11, - NULL); - else - ET1310_PhyAccessMiBit(adapter, - TRUEPHY_BIT_CLEAR, 4, 11, - NULL); - - if (adapter->RegistryFlowControl == Both) - ET1310_PhyAccessMiBit(adapter, - TRUEPHY_BIT_SET, 4, 10, - NULL); - else - ET1310_PhyAccessMiBit(adapter, - TRUEPHY_BIT_CLEAR, 4, 10, - NULL); + ET1310_PhyAccessMiBit(etdev, TRUEPHY_BIT_CLEAR, 4, 10, NULL); + ET1310_PhyAccessMiBit(etdev, TRUEPHY_BIT_CLEAR, 4, 11, NULL); + } + ET1310_PhyPowerDown(etdev, 1); + switch (etdev->AiForceSpeed) { + case 10: + /* First we need to turn off all other advertisement */ + ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); + ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); + if (etdev->AiForceDpx == 1) { + /* Set our advertise values accordingly */ + ET1310_PhyAdvertise10BaseT(etdev, + TRUEPHY_ADV_DUPLEX_HALF); + } else if (etdev->AiForceDpx == 2) { + /* Set our advertise values accordingly */ + ET1310_PhyAdvertise10BaseT(etdev, + TRUEPHY_ADV_DUPLEX_FULL); } else { - ET1310_PhyAccessMiBit(adapter, - TRUEPHY_BIT_CLEAR, 4, 10, NULL); - ET1310_PhyAccessMiBit(adapter, - TRUEPHY_BIT_CLEAR, 4, 11, NULL); + /* Disable autoneg */ + ET1310_PhyAutoNeg(etdev, false); + /* Disable rest of the advertisements */ + ET1310_PhyAdvertise10BaseT(etdev, + TRUEPHY_ADV_DUPLEX_NONE); + /* Force 10 Mbps */ + ET1310_PhySpeedSelect(etdev, TRUEPHY_SPEED_10MBPS); + /* Force Full duplex */ + ET1310_PhyDuplexMode(etdev, TRUEPHY_DUPLEX_FULL); } - - switch (adapter->AiForceSpeed) { - case 10: - if (adapter->AiForceDpx == 1) - TPAL_SetPhy10HalfDuplex(adapter); - else if (adapter->AiForceDpx == 2) - TPAL_SetPhy10FullDuplex(adapter); - else - TPAL_SetPhy10Force(adapter); - break; - case 100: - if (adapter->AiForceDpx == 1) - TPAL_SetPhy100HalfDuplex(adapter); - else if (adapter->AiForceDpx == 2) - TPAL_SetPhy100FullDuplex(adapter); - else - TPAL_SetPhy100Force(adapter); - break; - case 1000: - TPAL_SetPhy1000FullDuplex(adapter); - break; + break; + case 100: + /* first we need to turn off all other advertisement */ + ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); + ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); + if (etdev->AiForceDpx == 1) { + /* Set our advertise values accordingly */ + ET1310_PhyAdvertise100BaseT(etdev, + TRUEPHY_ADV_DUPLEX_HALF); + /* Set speed */ + ET1310_PhySpeedSelect(etdev, TRUEPHY_SPEED_100MBPS); + } else if (etdev->AiForceDpx == 2) { + /* Set our advertise values accordingly */ + ET1310_PhyAdvertise100BaseT(etdev, + TRUEPHY_ADV_DUPLEX_FULL); + } else { + /* Disable autoneg */ + ET1310_PhyAutoNeg(etdev, false); + /* Disable other advertisement */ + ET1310_PhyAdvertise100BaseT(etdev, + TRUEPHY_ADV_DUPLEX_NONE); + /* Force 100 Mbps */ + ET1310_PhySpeedSelect(etdev, TRUEPHY_SPEED_100MBPS); + /* Force Full duplex */ + ET1310_PhyDuplexMode(etdev, TRUEPHY_DUPLEX_FULL); } - - return status; + break; + case 1000: + /* first we need to turn off all other advertisement */ + ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); + ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); + /* set our advertise values accordingly */ + ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL); + break; } + ET1310_PhyPowerDown(etdev, 0); } void et131x_Mii_check(struct et131x_adapter *etdev, diff --git a/drivers/staging/et131x/et1310_phy.h b/drivers/staging/et131x/et1310_phy.h index 0ea12378fdaa..758b9b251715 100644 --- a/drivers/staging/et131x/et1310_phy.h +++ b/drivers/staging/et131x/et1310_phy.h @@ -741,7 +741,7 @@ struct et131x_adapter; /* Prototypes for ET1310_phy.c */ int et131x_xcvr_find(struct et131x_adapter *adapter); -int et131x_setphy_normal(struct et131x_adapter *adapter); +void et131x_setphy_normal(struct et131x_adapter *adapter); /* static inline function does not work because et131x_adapter is not always * defined -- GitLab From 16fbf4cba0880c31445d6414abbd7a1c51466b1f Mon Sep 17 00:00:00 2001 From: Vijay Kumar B Date: Mon, 21 Sep 2009 11:23:54 +0530 Subject: [PATCH 126/235] Staging: poch: Parameter to enable synthetic counter Adds a parameter that causes the hardware to synthesize Rx values using a counter. Signed-off-by: Vijay Kumar B. Signed-off-by: Greg Kroah-Hartman --- drivers/staging/poch/poch.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/staging/poch/poch.c b/drivers/staging/poch/poch.c index 2eb8e3d43c4d..1308c7bada8a 100644 --- a/drivers/staging/poch/poch.c +++ b/drivers/staging/poch/poch.c @@ -245,6 +245,11 @@ struct poch_dev { struct device *dev; }; +static int synth_rx; +module_param(synth_rx, bool, 0600); +MODULE_PARM_DESC(synth_rx, + "Synthesize received values using a counter. Default: No"); + static dev_t poch_first_dev; static struct class *poch_cls; static DEFINE_IDR(poch_ids); @@ -827,9 +832,11 @@ static int poch_open(struct inode *inode, struct file *filp) fpga + FPGA_TX_CTL_REG); } else { /* Flush RX FIFO and output data to cardbus. */ - iowrite32(FPGA_RX_CTL_CONT_CAP - | FPGA_RX_CTL_FIFO_FLUSH, - fpga + FPGA_RX_CTL_REG); + u32 ctl_val = FPGA_RX_CTL_CONT_CAP | FPGA_RX_CTL_FIFO_FLUSH; + if (synth_rx) + ctl_val |= FPGA_RX_CTL_SYNTH_DATA; + + iowrite32(ctl_val, fpga + FPGA_RX_CTL_REG); } atomic_inc(&channel->inited); -- GitLab From b01faf05740884f915dd1b8652d8af1b6f458ccc Mon Sep 17 00:00:00 2001 From: Vijay Kumar B Date: Mon, 21 Sep 2009 11:23:55 +0530 Subject: [PATCH 127/235] Staging: poch: Fetch Flush IOCTL interface Change user space interface to an IOCTL based interface instead of a memory mapped circular buffer. The circular buffer had some serious cache(?) issues and never worked. Signed-off-by: Vijay Kumar B. Signed-off-by: Greg Kroah-Hartman --- drivers/staging/poch/poch.c | 58 +++++++++++++++++++++++++++++++++++-- drivers/staging/poch/poch.h | 9 ++++++ 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/drivers/staging/poch/poch.c b/drivers/staging/poch/poch.c index 1308c7bada8a..6b4aa5f1d51d 100644 --- a/drivers/staging/poch/poch.c +++ b/drivers/staging/poch/poch.c @@ -201,6 +201,8 @@ struct channel_info { struct page *header_pg; unsigned long header_size; + /* Last group consumed by user space. */ + unsigned int consumed; /* Last group indicated as 'complete' to user space. */ unsigned int transfer; @@ -589,6 +591,7 @@ static int poch_channel_init(struct channel_info *channel, if (ret != 0) goto out; + channel->consumed = 0; channel->transfer = 0; /* Allocate memory to hold group information. */ @@ -1033,6 +1036,51 @@ static int poch_ioctl(struct inode *inode, struct file *filp, break; } break; + case POCH_IOC_CONSUME: + { + int available; + int nfetch; + unsigned int from; + unsigned int count; + unsigned int i, j; + struct poch_consume consume; + struct poch_consume *uconsume; + + uconsume = argp; + ret = copy_from_user(&consume, uconsume, sizeof(consume)); + if (ret) + return ret; + + spin_lock_irq(&channel->group_offsets_lock); + + channel->consumed += consume.nflush; + channel->consumed %= channel->group_count; + + available = channel->transfer - channel->consumed; + if (available < 0) + available += channel->group_count; + + from = channel->consumed; + + spin_unlock_irq(&channel->group_offsets_lock); + + nfetch = consume.nfetch; + count = min(available, nfetch); + + for (i = 0; i < count; i++) { + j = (from + i) % channel->group_count; + ret = put_user(channel->groups[j].user_offset, + &consume.offsets[i]); + if (ret) + return -EFAULT; + } + + ret = put_user(count, &uconsume->nfetch); + if (ret) + return -EFAULT; + + break; + } case POCH_IOC_GET_COUNTERS: if (!access_ok(VERIFY_WRITE, argp, sizeof(struct poch_counters))) return -EFAULT; @@ -1108,12 +1156,18 @@ static void poch_irq_dma(struct channel_info *channel) for (i = 0; i < groups_done; i++) { j = (prev_transfer + i) % channel->group_count; group_offsets[j] = groups[j].user_offset; + + channel->transfer += 1; + channel->transfer %= channel->group_count; + + if (channel->transfer == channel->consumed) { + channel->consumed += 1; + channel->consumed %= channel->group_count; + } } spin_unlock(&channel->group_offsets_lock); - channel->transfer = curr_transfer; - wake_up_interruptible(&channel->wq); } diff --git a/drivers/staging/poch/poch.h b/drivers/staging/poch/poch.h index 51a2d145798e..ba1490b4252b 100644 --- a/drivers/staging/poch/poch.h +++ b/drivers/staging/poch/poch.h @@ -19,6 +19,12 @@ struct poch_counters { __u32 pll_unlock; }; +struct poch_consume { + __u32 __user *offsets; + __u32 nfetch; + __u32 nflush; +}; + #define POCH_IOC_NUM '9' #define POCH_IOC_TRANSFER_START _IO(POCH_IOC_NUM, 0) @@ -27,3 +33,6 @@ struct poch_counters { struct poch_counters) #define POCH_IOC_SYNC_GROUP_FOR_USER _IO(POCH_IOC_NUM, 3) #define POCH_IOC_SYNC_GROUP_FOR_DEVICE _IO(POCH_IOC_NUM, 4) + +#define POCH_IOC_CONSUME _IOWR(POCH_IOC_NUM, 5, \ + struct poch_consume) -- GitLab From 7e72a85e07cab448a5779cf1ee851b850930ec9f Mon Sep 17 00:00:00 2001 From: Vijay Kumar B Date: Mon, 21 Sep 2009 11:23:56 +0530 Subject: [PATCH 128/235] Staging: poch: Increase groups per interrupt Increase groups per interrupt to reduce hogging of the CPU. Signed-off-by: Vijay Kumar B. Signed-off-by: Greg Kroah-Hartman --- drivers/staging/poch/poch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/poch/poch.c b/drivers/staging/poch/poch.c index 6b4aa5f1d51d..1637c281ea3c 100644 --- a/drivers/staging/poch/poch.c +++ b/drivers/staging/poch/poch.c @@ -483,7 +483,7 @@ static void channel_dma_init(struct channel_info *channel) fpga + block_count_reg); iowrite32(channel->group_count, fpga + group_count_reg); /* FIXME: Hardcoded groups per int. Get it from sysfs? */ - iowrite32(1, fpga + groups_per_int_reg); + iowrite32(16, fpga + groups_per_int_reg); /* Unlock PCI address? Not defined in the data sheet, but used * in the reference code by Redrapids. -- GitLab From dad1740133ffe49ae44044f97e4cbfcb42f037b1 Mon Sep 17 00:00:00 2001 From: Vijay Kumar Date: Mon, 21 Sep 2009 11:23:57 +0530 Subject: [PATCH 129/235] Staging: poch: Parameter to enable loopback Enable setting of loopback through module parameter. Signed-off-by: Vijay Kumar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/poch/poch.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/staging/poch/poch.c b/drivers/staging/poch/poch.c index 1637c281ea3c..babd881809a9 100644 --- a/drivers/staging/poch/poch.c +++ b/drivers/staging/poch/poch.c @@ -252,6 +252,11 @@ module_param(synth_rx, bool, 0600); MODULE_PARM_DESC(synth_rx, "Synthesize received values using a counter. Default: No"); +static int loopback; +module_param(loopback, bool, 0600); +MODULE_PARM_DESC(loopback, + "Enable hardware loopback of trasnmitted data. Default: No"); + static dev_t poch_first_dev; static struct class *poch_cls; static DEFINE_IDR(poch_ids); @@ -830,9 +835,14 @@ static int poch_open(struct inode *inode, struct file *filp) if (channel->dir == CHANNEL_DIR_TX) { /* Flush TX FIFO and output data from cardbus. */ - iowrite32(FPGA_TX_CTL_FIFO_FLUSH - | FPGA_TX_CTL_OUTPUT_CARDBUS, - fpga + FPGA_TX_CTL_REG); + u32 ctl_val = 0; + + ctl_val |= FPGA_TX_CTL_FIFO_FLUSH; + ctl_val |= FPGA_TX_CTL_OUTPUT_CARDBUS; + if (loopback) + ctl_val |= FPGA_TX_CTL_LOOPBACK; + + iowrite32(ctl_val, fpga + FPGA_TX_CTL_REG); } else { /* Flush RX FIFO and output data to cardbus. */ u32 ctl_val = FPGA_RX_CTL_CONT_CAP | FPGA_RX_CTL_FIFO_FLUSH; -- GitLab From 92d450336eedf4c671f37c931fa8ccc28c6be3a9 Mon Sep 17 00:00:00 2001 From: Vijay Kumar B Date: Mon, 21 Sep 2009 11:23:58 +0530 Subject: [PATCH 130/235] Staging: poch: Remove circular buffer header Remove the circular buffer header. Which has been superseded by the ioctl consume interface. Signed-off-by: Vijay Kumar B Signed-off-by: Greg Kroah-Hartman --- drivers/staging/poch/README | 1 - drivers/staging/poch/poch.c | 109 +++--------------------------------- drivers/staging/poch/poch.h | 6 -- 3 files changed, 8 insertions(+), 108 deletions(-) diff --git a/drivers/staging/poch/README b/drivers/staging/poch/README index 842afd464993..600121f7d671 100644 --- a/drivers/staging/poch/README +++ b/drivers/staging/poch/README @@ -1,7 +1,6 @@ TODO: - Rx block size is limited to < 2048, hardware bug? - Group size is limited to < page size, kernel alloc/mmap API issues - - fix/workaround cache issues in circular buffer header - test whether Tx is transmitting data from provided buffers - handle device unplug case - handle temperature above threshold diff --git a/drivers/staging/poch/poch.c b/drivers/staging/poch/poch.c index babd881809a9..9095158fb1b3 100644 --- a/drivers/staging/poch/poch.c +++ b/drivers/staging/poch/poch.c @@ -197,9 +197,6 @@ struct channel_info { /* Contains the header and circular buffer exported to userspace. */ spinlock_t group_offsets_lock; - struct poch_cbuf_header *header; - struct page *header_pg; - unsigned long header_size; /* Last group consumed by user space. */ unsigned int consumed; @@ -329,14 +326,12 @@ static ssize_t show_mmap_size(struct device *dev, int len; unsigned long mmap_size; unsigned long group_pages; - unsigned long header_pages; unsigned long total_group_pages; group_pages = npages(channel->group_size); - header_pages = npages(channel->header_size); total_group_pages = group_pages * channel->group_count; - mmap_size = (header_pages + total_group_pages) * PAGE_SIZE; + mmap_size = total_group_pages * PAGE_SIZE; len = sprintf(buf, "%lu\n", mmap_size); return len; } @@ -369,10 +364,8 @@ static int poch_channel_alloc_groups(struct channel_info *channel) { unsigned long i; unsigned long group_pages; - unsigned long header_pages; group_pages = npages(channel->group_size); - header_pages = npages(channel->header_size); for (i = 0; i < channel->group_count; i++) { struct poch_group_info *group; @@ -402,8 +395,7 @@ static int poch_channel_alloc_groups(struct channel_info *channel) * this? */ group->dma_addr = page_to_pfn(group->pg) * PAGE_SIZE; - group->user_offset = - (header_pages + (i * group_pages)) * PAGE_SIZE; + group->user_offset = (i * group_pages) * PAGE_SIZE; printk(KERN_INFO PFX "%ld: user_offset: 0x%lx\n", i, group->user_offset); @@ -525,56 +517,6 @@ static void channel_dma_init(struct channel_info *channel) } -static int poch_channel_alloc_header(struct channel_info *channel) -{ - struct poch_cbuf_header *header = channel->header; - unsigned long group_offset_size; - unsigned long tot_group_offsets_size; - - /* Allocate memory to hold header exported userspace */ - group_offset_size = sizeof(header->group_offsets[0]); - tot_group_offsets_size = group_offset_size * channel->group_count; - channel->header_size = sizeof(*header) + tot_group_offsets_size; - channel->header_pg = alloc_pages(GFP_KERNEL | __GFP_ZERO, - get_order(channel->header_size)); - if (!channel->header_pg) - return -ENOMEM; - - channel->header = page_address(channel->header_pg); - - return 0; -} - -static void poch_channel_free_header(struct channel_info *channel) -{ - unsigned int order; - - order = get_order(channel->header_size); - __free_pages(channel->header_pg, order); -} - -static void poch_channel_init_header(struct channel_info *channel) -{ - int i; - struct poch_group_info *groups; - s32 *group_offsets; - - channel->header->group_size_bytes = channel->group_size; - channel->header->group_count = channel->group_count; - - spin_lock_init(&channel->group_offsets_lock); - - group_offsets = channel->header->group_offsets; - groups = channel->groups; - - for (i = 0; i < channel->group_count; i++) { - if (channel->dir == CHANNEL_DIR_RX) - group_offsets[i] = -1; - else - group_offsets[i] = groups[i].user_offset; - } -} - static void __poch_channel_clear_counters(struct channel_info *channel) { channel->counters.pll_unlock = 0; @@ -617,12 +559,6 @@ static int poch_channel_init(struct channel_info *channel, goto out_free_group_info; } - ret = poch_channel_alloc_header(channel); - if (ret) { - dev_err(dev, "error allocating user space header\n"); - goto out_free_groups; - } - channel->fpga_iomem = poch_dev->fpga_iomem; channel->bridge_iomem = poch_dev->bridge_iomem; channel->iomem_lock = &poch_dev->iomem_lock; @@ -630,14 +566,8 @@ static int poch_channel_init(struct channel_info *channel, __poch_channel_clear_counters(channel); - printk(KERN_WARNING "poch_channel_init_header\n"); - - poch_channel_init_header(channel); - return 0; - out_free_groups: - poch_channel_free_groups(channel); out_free_group_info: kfree(channel->groups); out: @@ -881,7 +811,6 @@ static int poch_release(struct inode *inode, struct file *filp) } atomic_dec(&channel->inited); - poch_channel_free_header(channel); poch_channel_free_groups(channel); kfree(channel->groups); atomic_inc(&channel->free); @@ -890,7 +819,7 @@ static int poch_release(struct inode *inode, struct file *filp) } /* - * Map the header and the group buffers, to user space. + * Map the the group buffers, to user space. */ static int poch_mmap(struct file *filp, struct vm_area_struct *vma) { @@ -900,7 +829,6 @@ static int poch_mmap(struct file *filp, struct vm_area_struct *vma) unsigned long size; unsigned long group_pages; - unsigned long header_pages; unsigned long total_group_pages; int pg_num; @@ -917,30 +845,16 @@ static int poch_mmap(struct file *filp, struct vm_area_struct *vma) } group_pages = npages(channel->group_size); - header_pages = npages(channel->header_size); total_group_pages = group_pages * channel->group_count; size = vma->vm_end - vma->vm_start; - if (size != (header_pages + total_group_pages) * PAGE_SIZE) { + if (size != total_group_pages * PAGE_SIZE) { printk(KERN_WARNING PFX "required %lu bytes\n", size); return -EINVAL; } start = vma->vm_start; - /* FIXME: Cleanup required on failure? */ - pg = channel->header_pg; - for (pg_num = 0; pg_num < header_pages; pg_num++, pg++) { - printk(KERN_DEBUG PFX "page_count: %d\n", page_count(pg)); - printk(KERN_DEBUG PFX "%d: header: 0x%lx\n", pg_num, start); - ret = vm_insert_page(vma, start, pg); - if (ret) { - printk(KERN_DEBUG "vm_insert 1 failed at %lx\n", start); - return ret; - } - start += PAGE_SIZE; - } - for (i = 0; i < channel->group_count; i++) { pg = channel->groups[i].pg; for (pg_num = 0; pg_num < group_pages; pg_num++, pg++) { @@ -967,20 +881,16 @@ static int poch_mmap(struct file *filp, struct vm_area_struct *vma) */ static int poch_channel_available(struct channel_info *channel) { - int i; + int available = 0; spin_lock_irq(&channel->group_offsets_lock); - for (i = 0; i < channel->group_count; i++) { - if (channel->header->group_offsets[i] != -1) { - spin_unlock_irq(&channel->group_offsets_lock); - return 1; - } - } + if (channel->consumed != channel->transfer) + available = 1; spin_unlock_irq(&channel->group_offsets_lock); - return 0; + return available; } static unsigned int poch_poll(struct file *filp, poll_table *pt) @@ -1138,7 +1048,6 @@ static void poch_irq_dma(struct channel_info *channel) long groups_done; unsigned long i, j; struct poch_group_info *groups; - s32 *group_offsets; u32 curr_group_reg; if (!atomic_read(&channel->inited)) @@ -1158,14 +1067,12 @@ static void poch_irq_dma(struct channel_info *channel) if (groups_done <= 0) groups_done += channel->group_count; - group_offsets = channel->header->group_offsets; groups = channel->groups; spin_lock(&channel->group_offsets_lock); for (i = 0; i < groups_done; i++) { j = (prev_transfer + i) % channel->group_count; - group_offsets[j] = groups[j].user_offset; channel->transfer += 1; channel->transfer %= channel->group_count; diff --git a/drivers/staging/poch/poch.h b/drivers/staging/poch/poch.h index ba1490b4252b..bf622448ac8c 100644 --- a/drivers/staging/poch/poch.h +++ b/drivers/staging/poch/poch.h @@ -7,12 +7,6 @@ * include/linux for final version. * */ -struct poch_cbuf_header { - __s32 group_size_bytes; - __s32 group_count; - __s32 group_offsets[0]; -}; - struct poch_counters { __u32 fifo_empty; __u32 fifo_overflow; -- GitLab From 949d6ae745ba2fa34bc983bb808c814898d5b77d Mon Sep 17 00:00:00 2001 From: Vijay Kumar B Date: Mon, 21 Sep 2009 11:23:59 +0530 Subject: [PATCH 131/235] Staging: poch: Include linux/types.h Include linux/types.h in poch.h, so that poch.h can be included in user application header files. Signed-off-by: Vijay Kumar B. Signed-off-by: Greg Kroah-Hartman --- drivers/staging/poch/poch.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/poch/poch.h b/drivers/staging/poch/poch.h index bf622448ac8c..8b08385861fd 100644 --- a/drivers/staging/poch/poch.h +++ b/drivers/staging/poch/poch.h @@ -7,6 +7,9 @@ * include/linux for final version. * */ + +#include + struct poch_counters { __u32 fifo_empty; __u32 fifo_overflow; -- GitLab From 763a998fb2d93ff86a8d1bf7bad84f640f668727 Mon Sep 17 00:00:00 2001 From: Vijay Kumar B Date: Mon, 21 Sep 2009 11:24:00 +0530 Subject: [PATCH 132/235] Staging: poch: Add sample Rx code Add sample code Rx to README. Signed-off-by: Vijay Kumar B Signed-off-by: Greg Kroah-Hartman --- drivers/staging/poch/README | 123 ++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/drivers/staging/poch/README b/drivers/staging/poch/README index 600121f7d671..ac76ff969a2f 100644 --- a/drivers/staging/poch/README +++ b/drivers/staging/poch/README @@ -9,5 +9,128 @@ TODO: - audit userspace interfaces - get reserved major/minor if needed +Sample Code: + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +struct pconsume { + uint32_t * offsets; + uint32_t nfetch; + uint32_t nflush; +}; + +uint32_t offsets[10]; + +void process_group(unsigned char *buf, uint32_t size) +{ + uint16_t *buf16 = (uint16_t *)buf; + + printf("RX: %p %u %04x %04x %04x %04x %04x %04x\n", buf, size, + buf16[0], buf16[1], buf16[2], buf16[3], buf16[4], buf16[5]); +} + +int main() +{ + struct sysfs_attribute *attr; + char *path; + int ret; + unsigned long mmap_size; + int fd; + unsigned char *cbuf; + + uint32_t nflush; + struct pollfd poll_fds; + int count = 0; + int i; + + path = "/sys/class/pocketchange/poch0/ch0/block_size"; + attr = sysfs_open_attribute(path); + ret = sysfs_write_attribute(attr, "256", strlen("256")); + if (ret == -1) + error(1, errno, "error writing attribute %s", path); + sysfs_close_attribute(attr); + + path = "/sys/class/pocketchange/poch0/ch0/group_size"; + attr = sysfs_open_attribute(path); + ret = sysfs_write_attribute(attr, "4096", strlen("4096")); + if (ret == -1) + error(1, errno, "error writing attribute %s", path); + sysfs_close_attribute(attr); + + path = "/sys/class/pocketchange/poch0/ch0/group_count"; + attr = sysfs_open_attribute(path); + ret = sysfs_write_attribute(attr, "64", strlen("64")); + if (ret == -1) + error(1, errno, "error writing attribute %s", path); + sysfs_close_attribute(attr); + + fd = open("/dev/ch0", O_RDWR); + if (fd == -1) + error(1, errno, "error opening device node"); + + path = "/sys/class/pocketchange/poch0/ch0/mmap_size"; + attr = sysfs_open_attribute(path); + ret = sysfs_read_attribute(attr); + if (ret == -1) + error(1, errno, "error reading attribute %s", path); + printf("%s", attr->value); + sscanf(attr->value, "%lu", &mmap_size); + sysfs_close_attribute(attr); + + cbuf = mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, + MAP_PRIVATE, fd, 0); + if (cbuf == MAP_FAILED) + error(1, errno, "error mapping DMA buffers"); + + ret = ioctl(fd, POCH_IOC_TRANSFER_START, 0); + if (ret == -1) + error(1, errno, "error starting transfer"); + + nflush = 0; + while (1) { + struct pconsume consume; + + consume.offsets = offsets; + consume.nfetch = 10; + consume.nflush = nflush; + + ret = ioctl(fd, POCH_IOC_CONSUME, &consume); + if (ret == -1) + error(1, errno, "error consuming groups"); + + nflush = consume.nfetch; + + for (i = 0; i < nflush; i++) { + process_group(cbuf + consume.offsets[i], 4096); + + count++; + if (count == 1000) + break; + } + + if (count == 1000) + break; + } + + ret = ioctl(fd, POCH_IOC_TRANSFER_STOP, 0); + if (ret == -1) + error(1, errno, "error starting transfer"); + + return 0; +} + Please send patches to Greg Kroah-Hartman and Vijay Kumar and Jaya Kumar -- GitLab From 090679c9e859a82f8bf089b115ae7c510d486742 Mon Sep 17 00:00:00 2001 From: Huang Weiyi Date: Thu, 17 Sep 2009 21:25:21 +0800 Subject: [PATCH 133/235] Staging: rtl8187se: remove unused #include Remove unused #include ('s) in drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c Signed-off-by: Huang Weiyi Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c | 1 - drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c | 1 - drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c | 1 - 3 files changed, 3 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c index 5e2e79b1e341..f882dd8cf9b5 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c index e2945db61795..dde1f2e0cf32 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c @@ -47,7 +47,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c index a08b97a09512..6aad48fe2e18 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c @@ -30,7 +30,6 @@ ******************************************************************************/ #include -#include #include #include -- GitLab From 349f535cbd14308f1934d9b20c4c214cb49c9001 Mon Sep 17 00:00:00 2001 From: Huang Weiyi Date: Thu, 17 Sep 2009 21:25:37 +0800 Subject: [PATCH 134/235] Staging: rtl8187su: remove unused #include Remove unused #include ('s) in drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c drivers/staging/rtl8192su/ieee80211/ieee80211_tx.c drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c Signed-off-by: Huang Weiyi Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c | 1 - drivers/staging/rtl8192su/ieee80211/ieee80211_tx.c | 1 - drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c | 1 - 3 files changed, 3 deletions(-) diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c index 8e56f97a8f57..ac223cef1d33 100644 --- a/drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_tx.c index 47ff0efb6370..60621d6b2a6b 100644 --- a/drivers/staging/rtl8192su/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_tx.c @@ -47,7 +47,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c index 6146c6435dde..85c7e96b622d 100644 --- a/drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c +++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c @@ -30,7 +30,6 @@ ******************************************************************************/ #include -#include #include #include -- GitLab From 68c0bdff7ac903421f224e080499c51cd5287f97 Mon Sep 17 00:00:00 2001 From: Henk de Groot Date: Sun, 27 Sep 2009 11:12:52 +0200 Subject: [PATCH 135/235] Staging: wlags49_h2: add Agere driver for HERMES II and HERMES II.5 chipsets WLAN driver for cards using the HERMES II and HERMES II.5 chipset Based on Agere Systems Linux LKM Wireless Driver Source Code, Version 7.22; complies with Open Source BSD License. The software is a modified version of wl_lkm_722_abg.tar.gz from the Agere Systems website, addapted for Ubuntu 9.04 and modified to fit in the current Linux kernel (2.6.31). Modified for kernel 2.6 by Henk de Groot Based on 7.18 version by Andrey Borzenkov $Revision: 39 $ Signed-off-by: Henk de Groot Cc: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/Kconfig | 4 + drivers/staging/Makefile | 2 + drivers/staging/wlags49_h2/Kconfig | 8 + drivers/staging/wlags49_h2/Makefile | 81 + drivers/staging/wlags49_h2/README.ubuntu | 180 + drivers/staging/wlags49_h2/README.wlags49 | 641 +++ drivers/staging/wlags49_h2/WARNING.txt | 3 + drivers/staging/wlags49_h2/ap_h2.c | 3337 +++++++++++++ drivers/staging/wlags49_h2/ap_h25.c | 4094 ++++++++++++++++ drivers/staging/wlags49_h2/debug.h | 229 + drivers/staging/wlags49_h2/dhf.c | 390 ++ drivers/staging/wlags49_h2/dhf.h | 226 + drivers/staging/wlags49_h2/dhfcfg.h | 175 + drivers/staging/wlags49_h2/hcf.c | 4881 +++++++++++++++++++ drivers/staging/wlags49_h2/hcf.h | 405 ++ drivers/staging/wlags49_h2/hcfcfg.h | 2344 +++++++++ drivers/staging/wlags49_h2/hcfdef.h | 809 ++++ drivers/staging/wlags49_h2/man/wlags49.4 | 734 +++ drivers/staging/wlags49_h2/mdd.h | 1156 +++++ drivers/staging/wlags49_h2/mmd.c | 251 + drivers/staging/wlags49_h2/mmd.h | 78 + drivers/staging/wlags49_h2/sta_h2.c | 4480 ++++++++++++++++++ drivers/staging/wlags49_h2/sta_h25.c | 5255 +++++++++++++++++++++ drivers/staging/wlags49_h2/wl_cs.c | 715 +++ drivers/staging/wlags49_h2/wl_cs.h | 112 + drivers/staging/wlags49_h2/wl_enc.c | 248 + drivers/staging/wlags49_h2/wl_enc.h | 135 + drivers/staging/wlags49_h2/wl_if.h | 232 + drivers/staging/wlags49_h2/wl_internal.h | 1073 +++++ drivers/staging/wlags49_h2/wl_main.c | 3878 +++++++++++++++ drivers/staging/wlags49_h2/wl_main.h | 155 + drivers/staging/wlags49_h2/wl_netdev.c | 2085 ++++++++ drivers/staging/wlags49_h2/wl_netdev.h | 171 + drivers/staging/wlags49_h2/wl_pci.c | 1596 +++++++ drivers/staging/wlags49_h2/wl_pci.h | 126 + drivers/staging/wlags49_h2/wl_priv.c | 2095 ++++++++ drivers/staging/wlags49_h2/wl_priv.h | 138 + drivers/staging/wlags49_h2/wl_profile.c | 1128 +++++ drivers/staging/wlags49_h2/wl_profile.h | 104 + drivers/staging/wlags49_h2/wl_sysfs.c | 135 + drivers/staging/wlags49_h2/wl_sysfs.h | 7 + drivers/staging/wlags49_h2/wl_util.c | 1604 +++++++ drivers/staging/wlags49_h2/wl_util.h | 119 + drivers/staging/wlags49_h2/wl_version.h | 193 + drivers/staging/wlags49_h2/wl_wext.c | 4138 ++++++++++++++++ drivers/staging/wlags49_h2/wl_wext.h | 113 + drivers/staging/wlags49_h25/Kconfig | 8 + drivers/staging/wlags49_h25/Makefile | 81 + drivers/staging/wlags49_h25/README.txt | 30 + drivers/staging/wlags49_h25/ap_h25.c | 2 + drivers/staging/wlags49_h25/debug.h | 2 + drivers/staging/wlags49_h25/dhf.c | 2 + drivers/staging/wlags49_h25/dhf.h | 2 + drivers/staging/wlags49_h25/dhfcfg.h | 2 + drivers/staging/wlags49_h25/hcf.c | 2 + drivers/staging/wlags49_h25/hcf.h | 2 + drivers/staging/wlags49_h25/hcfcfg.h | 2 + drivers/staging/wlags49_h25/hcfdef.h | 2 + drivers/staging/wlags49_h25/mdd.h | 2 + drivers/staging/wlags49_h25/mmd.c | 2 + drivers/staging/wlags49_h25/mmd.h | 2 + drivers/staging/wlags49_h25/sta_h25.c | 2 + drivers/staging/wlags49_h25/wl_cs.c | 2 + drivers/staging/wlags49_h25/wl_cs.h | 2 + drivers/staging/wlags49_h25/wl_enc.c | 2 + drivers/staging/wlags49_h25/wl_enc.h | 2 + drivers/staging/wlags49_h25/wl_if.h | 2 + drivers/staging/wlags49_h25/wl_internal.h | 2 + drivers/staging/wlags49_h25/wl_main.c | 2 + drivers/staging/wlags49_h25/wl_main.h | 2 + drivers/staging/wlags49_h25/wl_netdev.c | 2 + drivers/staging/wlags49_h25/wl_netdev.h | 2 + drivers/staging/wlags49_h25/wl_priv.c | 2 + drivers/staging/wlags49_h25/wl_priv.h | 2 + drivers/staging/wlags49_h25/wl_profile.c | 2 + drivers/staging/wlags49_h25/wl_profile.h | 2 + drivers/staging/wlags49_h25/wl_sysfs.c | 2 + drivers/staging/wlags49_h25/wl_sysfs.h | 2 + drivers/staging/wlags49_h25/wl_util.c | 2 + drivers/staging/wlags49_h25/wl_util.h | 2 + drivers/staging/wlags49_h25/wl_version.h | 2 + drivers/staging/wlags49_h25/wl_wext.c | 2 + drivers/staging/wlags49_h25/wl_wext.h | 2 + 83 files changed, 50250 insertions(+) create mode 100644 drivers/staging/wlags49_h2/Kconfig create mode 100644 drivers/staging/wlags49_h2/Makefile create mode 100644 drivers/staging/wlags49_h2/README.ubuntu create mode 100644 drivers/staging/wlags49_h2/README.wlags49 create mode 100644 drivers/staging/wlags49_h2/WARNING.txt create mode 100644 drivers/staging/wlags49_h2/ap_h2.c create mode 100644 drivers/staging/wlags49_h2/ap_h25.c create mode 100644 drivers/staging/wlags49_h2/debug.h create mode 100644 drivers/staging/wlags49_h2/dhf.c create mode 100644 drivers/staging/wlags49_h2/dhf.h create mode 100644 drivers/staging/wlags49_h2/dhfcfg.h create mode 100644 drivers/staging/wlags49_h2/hcf.c create mode 100644 drivers/staging/wlags49_h2/hcf.h create mode 100644 drivers/staging/wlags49_h2/hcfcfg.h create mode 100644 drivers/staging/wlags49_h2/hcfdef.h create mode 100644 drivers/staging/wlags49_h2/man/wlags49.4 create mode 100644 drivers/staging/wlags49_h2/mdd.h create mode 100644 drivers/staging/wlags49_h2/mmd.c create mode 100644 drivers/staging/wlags49_h2/mmd.h create mode 100644 drivers/staging/wlags49_h2/sta_h2.c create mode 100644 drivers/staging/wlags49_h2/sta_h25.c create mode 100644 drivers/staging/wlags49_h2/wl_cs.c create mode 100644 drivers/staging/wlags49_h2/wl_cs.h create mode 100644 drivers/staging/wlags49_h2/wl_enc.c create mode 100644 drivers/staging/wlags49_h2/wl_enc.h create mode 100644 drivers/staging/wlags49_h2/wl_if.h create mode 100644 drivers/staging/wlags49_h2/wl_internal.h create mode 100644 drivers/staging/wlags49_h2/wl_main.c create mode 100644 drivers/staging/wlags49_h2/wl_main.h create mode 100644 drivers/staging/wlags49_h2/wl_netdev.c create mode 100644 drivers/staging/wlags49_h2/wl_netdev.h create mode 100644 drivers/staging/wlags49_h2/wl_pci.c create mode 100644 drivers/staging/wlags49_h2/wl_pci.h create mode 100644 drivers/staging/wlags49_h2/wl_priv.c create mode 100644 drivers/staging/wlags49_h2/wl_priv.h create mode 100644 drivers/staging/wlags49_h2/wl_profile.c create mode 100644 drivers/staging/wlags49_h2/wl_profile.h create mode 100644 drivers/staging/wlags49_h2/wl_sysfs.c create mode 100644 drivers/staging/wlags49_h2/wl_sysfs.h create mode 100644 drivers/staging/wlags49_h2/wl_util.c create mode 100644 drivers/staging/wlags49_h2/wl_util.h create mode 100644 drivers/staging/wlags49_h2/wl_version.h create mode 100644 drivers/staging/wlags49_h2/wl_wext.c create mode 100644 drivers/staging/wlags49_h2/wl_wext.h create mode 100644 drivers/staging/wlags49_h25/Kconfig create mode 100644 drivers/staging/wlags49_h25/Makefile create mode 100644 drivers/staging/wlags49_h25/README.txt create mode 100644 drivers/staging/wlags49_h25/ap_h25.c create mode 100644 drivers/staging/wlags49_h25/debug.h create mode 100644 drivers/staging/wlags49_h25/dhf.c create mode 100644 drivers/staging/wlags49_h25/dhf.h create mode 100644 drivers/staging/wlags49_h25/dhfcfg.h create mode 100644 drivers/staging/wlags49_h25/hcf.c create mode 100644 drivers/staging/wlags49_h25/hcf.h create mode 100644 drivers/staging/wlags49_h25/hcfcfg.h create mode 100644 drivers/staging/wlags49_h25/hcfdef.h create mode 100644 drivers/staging/wlags49_h25/mdd.h create mode 100644 drivers/staging/wlags49_h25/mmd.c create mode 100644 drivers/staging/wlags49_h25/mmd.h create mode 100644 drivers/staging/wlags49_h25/sta_h25.c create mode 100644 drivers/staging/wlags49_h25/wl_cs.c create mode 100644 drivers/staging/wlags49_h25/wl_cs.h create mode 100644 drivers/staging/wlags49_h25/wl_enc.c create mode 100644 drivers/staging/wlags49_h25/wl_enc.h create mode 100644 drivers/staging/wlags49_h25/wl_if.h create mode 100644 drivers/staging/wlags49_h25/wl_internal.h create mode 100644 drivers/staging/wlags49_h25/wl_main.c create mode 100644 drivers/staging/wlags49_h25/wl_main.h create mode 100644 drivers/staging/wlags49_h25/wl_netdev.c create mode 100644 drivers/staging/wlags49_h25/wl_netdev.h create mode 100644 drivers/staging/wlags49_h25/wl_priv.c create mode 100644 drivers/staging/wlags49_h25/wl_priv.h create mode 100644 drivers/staging/wlags49_h25/wl_profile.c create mode 100644 drivers/staging/wlags49_h25/wl_profile.h create mode 100644 drivers/staging/wlags49_h25/wl_sysfs.c create mode 100644 drivers/staging/wlags49_h25/wl_sysfs.h create mode 100644 drivers/staging/wlags49_h25/wl_util.c create mode 100644 drivers/staging/wlags49_h25/wl_util.h create mode 100644 drivers/staging/wlags49_h25/wl_version.h create mode 100644 drivers/staging/wlags49_h25/wl_wext.c create mode 100644 drivers/staging/wlags49_h25/wl_wext.h diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index f012304e22a8..56b275073cee 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -125,6 +125,10 @@ source "drivers/staging/iio/Kconfig" source "drivers/staging/ramzswap/Kconfig" +source "drivers/staging/wlags49_h2/Kconfig" + +source "drivers/staging/wlags49_h25/Kconfig" + source "drivers/staging/strip/Kconfig" source "drivers/staging/arlan/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 0c0dd53e5027..9852d449a047 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -44,6 +44,8 @@ obj-$(CONFIG_RAR_REGISTER) += rar/ obj-$(CONFIG_DX_SEP) += sep/ obj-$(CONFIG_IIO) += iio/ obj-$(CONFIG_RAMZSWAP) += ramzswap/ +obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/ +obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/ obj-$(CONFIG_STRIP) += strip/ obj-$(CONFIG_ARLAN) += arlan/ obj-$(CONFIG_WAVELAN) += wavelan/ diff --git a/drivers/staging/wlags49_h2/Kconfig b/drivers/staging/wlags49_h2/Kconfig new file mode 100644 index 000000000000..f9978fc40d4b --- /dev/null +++ b/drivers/staging/wlags49_h2/Kconfig @@ -0,0 +1,8 @@ +config WLAGS49_H2 + tristate "Agere Systems HERMES II Wireless PC Card Model 0110" + depends on WLAN_80211 && WIRELESS_EXT + ---help--- + Driver for wireless cards using Agere's HERMES II chipset + which are identified with Manufacture ID: 0156,0003 + The software is a modified version of wl_lkm_722_abg.tar.gz + from the Agere Systems website, addapted for Ubuntu 9.04. diff --git a/drivers/staging/wlags49_h2/Makefile b/drivers/staging/wlags49_h2/Makefile new file mode 100644 index 000000000000..25d0a8a9ce30 --- /dev/null +++ b/drivers/staging/wlags49_h2/Makefile @@ -0,0 +1,81 @@ +# +# Makefile for wlags49_h2_cs.ko and wlags49_h25_cs.ko +# +# Default build for Hermes-II base cards (possibly identified with +# "manfid: 0x0156, 0x0003" in "pccardctl ident" output), comment +# -DHERMES25 below +# +# If you want to build for Hermes-II.5 base cards (possibly identified with +# "manfid: 0x0156, 0x0004" in "pccardctl ident" output), uncomment +# -DHERMES25 below +# +# If you want to build AP support (untested), comment out -DSTA_ONLY + +INSTALLDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless +EXTRA_CFLAGS += -I$(KERNELDIR)/include +EXTRA_CFLAGS += -I$(src) \ + -DBUS_PCMCIA \ + -DUSE_WPA \ + -DUSE_WEXT \ + -DSTA_ONLY \ + -DWVLAN_49 \ +# -DHERMES25 \ +# -DDBG \ +# -DDBG_LVL=5 \ +# -DUSE_UIL \ +# -DUSE_PROFILE \ + +ifeq ($(findstring HERMES25,$(EXTRA_CFLAGS)),) +WLNAME := wlags49_h2_cs +$(WLNAME)-y := sta_h2.o +ifeq ($(findstring STA_ONLY,$(EXTRA_CFLAGS)),) +$(WLNAME)-y += ap_h2.o +endif +else +WLNAME=wlags49_h25_cs +$(WLNAME)-y := sta_h25.o +ifeq ($(findstring STA_ONLY,$(EXTRA_CFLAGS)),) +$(WLNAME)-y += ap_h25.o +endif +endif + +# If KERNELRELEASE is defined, we've been invoked from the +# kernel build system and can use its language. +ifneq ($(KERNELRELEASE),) + +obj-m += $(WLNAME).o + +$(WLNAME)-y += wl_profile.o \ + wl_wext.o \ + wl_priv.o \ + wl_main.o \ + wl_enc.o \ + wl_util.o \ + wl_netdev.o \ + wl_cs.o \ + mmd.o \ + hcf.o \ + dhf.o + +$(WLNAME)-$(CONFIG_SYSFS) += wl_sysfs.o + +# Otherwise we were called directly from the command +# line; invoke the kernel build system. +else + KERNELDIR ?= /lib/modules/$(shell uname -r)/build + PWD := $(shell pwd) + +default: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules +endif + +clean: + rm -fr *.o *.ko *.mod.c *.mod.o .*.*.cmd Module.symvers \ + Module.markers modules.order .tmp_versions + +install: default + -rmmod $(WLNAME) + install -d $(INSTALLDIR) + install -m 0644 -o root -g root $(WLNAME).ko $(INSTALLDIR) + /sbin/depmod -aq + diff --git a/drivers/staging/wlags49_h2/README.ubuntu b/drivers/staging/wlags49_h2/README.ubuntu new file mode 100644 index 000000000000..47beaec86e4a --- /dev/null +++ b/drivers/staging/wlags49_h2/README.ubuntu @@ -0,0 +1,180 @@ +======================================================================= +WLAN driver for cards using the HERMES II and HERMES II.5 chipset + +HERMES II Card + +PCMCIA Info: "Agere Systems" "Wireless PC Card Model 0110" + Manufacture ID: 0156,0003 + +HERMES II.5 Card + +PCMCIA Info: "Linksys" "WCF54G_Wireless-G_CompactFlash_Card" + Manufacture ID: 0156,0004 + +Based on Agere Systems Linux LKM Wireless Driver Source Code, +Version 7.22; complies with Open Source BSD License. +======================================================================= + +DESCRIPTION + +The software is a modified version of wl_lkm_722_abg.tar.gz from the +Agere Systems website, addapted for Ubuntu 9.04. + +Modified for kernel 2.6 by Henk de Groot +Based on 7.18 version by Andrey Borzenkov $Revision: 39 $ + +INSTALLATION + +Unpack in a new directory. + +Open a terminal screen. + +Change directory to the source directory + +Type command + +make + +and wait until it is finshed. Now you have build the module +wlags49_h2_cs; this module is meant for a HERMES II card. + +The driver is tested with a Thomson SpeedTouch 110 Wireless PC Card. +For the test Station mode was used with WEP. The driver is supposed +to support WAP and as accesspoint that is NOT tested. + +If you have a card using the HERMES II.5 chip you have to make +changes to the Makefile and uncomment -DHERMES25. This will build +driver wlags49_h25_cs. + +Note: You can detemine the type with command "pccardctrl info" + MANIFID: 0156,0002 = HERMES - not supported by this driver + MANIFID: 0156,0003 = HERMES II (Wireless B) + MANIFID: 0156,0004 = HERMES II.5 (Wireless B/G) + +After succesfull compile type command + +sudo make install + +to install the module. + +Now the card should be recognized. It should be able to configure +and use the card with NetworkManager. Wpa_supplicant also works, as does +manual configuration using the iwconfig/iwlist programs. + +Note: I only tested Station mode with WEP but if I didn't break anything +WPA and AP mode should also work; note however that WPA was experimental +in the original Agere driver! + +Note: to compile as AP change the makefile and remove the line +-DSTA_ONLY \ + +(or comment it, but in that case make sure to move it after all the + flags you want to use) + +CHANGES + +The HCF functions to control the card are virtually unchanged, the only +changes are meant to fix compiler warnings. The only real change is in +HCF_WAIT_WHILE which now has a udelay(2) added to give a small delay. + +The linux driver files (wl_xxxx.c) are changed in the following ways: +- Addaptations of Andrey Borzenkov applied to 7.22 source +- Alterations to avoid most HCF_ASSERTs +-- Switching interrupts off and on in the HCF +-- Bugfixes, things that were aparently wrong like reporting link status + change which checked a variable that was not changed in HCF anymore. +-- Used on WEP but setting keys via SIOCSIWENCODEEXT was not supported +-- Recovery actions added + +The major problem was the order in which calls can be made. The original +looks like a traditonal UNIX driver. To call an "ioctl" function you +have to "open" the device first to get a handle and after "close" no +"ioctl" function can be called anymore. With the 2.6 driver this all +changed; the former ioctl functions are now called before "open" and +after "close", which was not expected. One of the problems was enable/ +disable of interrupts in the HCF. Interrupt handling starts at "open" +so if a former "ioctl" routinge is called before "open" or after "close" +then nothing should be done with interrupt switching in the HCF. Once +this was solved most HCF_ASSERTS went away. + +The last point, recovery actions added, needs some clarification. +Starting the card works most of the time, but unfortunately not always. +At a few times recovery code was added; when the card starts to +misbehave or the communication between the HCF and the card is +out of sync and the HCF enters DEFUNCT mode everything is reset and +reinitialized. Note, hcf.c contains a lot of documentation. It takes +some time but slowly some things become clear. Also some unresolved +issues are mentioned in hcf.c, so there are still unknown bugs. + +The card problems are almost in all cases when starting up and before +the first association with an AP, once the card is in operation it +seems to stay that way; when debugging no HCF_ASSERTS appear anymore. +Note: some HCF_ASSERTS still appear, in a number of cases it is a real +error, for example at card removal the missing card is detected. + +LICENSE + +The Agere Systems license applies. This is why I include the original +README.wlags49. The instructions in that file are bogus now. I also +include the man page. Eventhough setting parameters on the module +does not work anymore but it provides some information about all the +settings. + +I have not have personal contact with Agere, but others have. Agere +agreed to make their software available under the BSD licence. +This driver is based on the 7.22 version. + +The following was mailed by Agere to Andrey Borzenkov about this: + + --- Begin Message --- + + * From: TJ + * Date: Mon, 05 Feb 2007 19:28:59 +0000 + + Hi Andrey, + + I've got some good news for you/us/the world of Hermes :) + + I got a reply from the legal representative at Agere confirming that + their source-code is BSD licensed, and I've included the contents of the + email here. + + I hope this re-assures you so that your excellent work on the drivers + can be made widely available for other hackers to work with. + + Regards, + + TJ. + + --------- + On Mon, 2007-02-05 at 13:54 -0500, Pathare, Viren M (Viren) wrote: + + + "I would like to confirm that the two drivers; Linux LKM Wireless Driver + Source Code, Version 7.18 and Linux LKM Wireless Driver Source Code, + Version 7.22 comply with Open Source BSD License. Therefore the source + code can be distributed in unmodified or modified form consistent with + the terms of the license. + + The Linux driver architecture was based on two modules, the MSF (Module + specific functions) and the HCF (Hardware Control Functions). Included + in the HCF is run-time firmware (binary format) which is downloaded into + the RAM of the Hermes 1/2/2.5 WMAC. + + This hex coded firmware is not based on any open source software and + hence it is not subject to any Open Source License. The firmware was + developed by Agere and runs on the DISC processor embedded within the + Hermes 1/2/2.5 Wireless MAC devices. + + Hope this helps. + + Sincerely, + + Viren Pathare + Intellectual Property Licensing Manager + Agere" + + + + --- End Message --- + diff --git a/drivers/staging/wlags49_h2/README.wlags49 b/drivers/staging/wlags49_h2/README.wlags49 new file mode 100644 index 000000000000..7586fd09adc9 --- /dev/null +++ b/drivers/staging/wlags49_h2/README.wlags49 @@ -0,0 +1,641 @@ +============================================================================== +Agere Systems Inc. July 2004 +Readme for Linux Driver Source for Wavelan Version: 7.22-abg +============================================================================== + +This text file includes update information, installation instructions, +limitations to the current version of the product, and suggestions to solve +known issues or problems. + + +TABLE OF CONTENTS. + +1. DESCRIPTION +2. SYSTEM REQUIREMENTS +3. NEW IN THIS RELEASE +4. INSTALLATION NOTES +5. TECHNICAL CONSTRAINTS +6. KNOWN ISSUES +7. TECHNICAL SUPPORT + +------------------------------------------------------------------------------ +1. DESCRIPTION + + With this package, you can build and install a Wireless driver for a + specific Linux kernel. + + The driver in this package supports the network interface cards based on: + - WL60010, a.k.a. Hermes-II + - WL60040, a.k.a. Hermes-II.5 + + Although derived from the Hermes-I/II Linux driver, this release ONLY + Supports Hermes-II/II.5 chipsets. Hermes-I is no longer supported. + + The software is distributed in a compressed source file archive: + - wl_lkm_7_22_abg.tar.gz + + Because this release supports more than one Hermes CPU and bus + architecture, a naming convention is used for the resulting binaries that + can be built from this source code. Driver binaries are named as follows: + + wlags49__.o + + where 'wlags49' denotes an Agere WaveLan Linux build, + + is: 'h2' for Hermes-II, 'h25' for Hermes-II.5 + + is: 'cs' for Card Services (PCMCIA, Compact Flash), PCI for + PCI or MiniPCI. + + For example, a driver built for Hermes-II Card Services (PCMCIA/Compact + Flash) is named wlags49_h2_cs.o, whereas a driver built for Hermes-II + MiniPCI is named wlags49_h2_pci.o. + The following software is included with this distribution: + + General information: + * README.wlags49 This file + * LICENSE.wlags49 License + * wlags49.mk Top level Makefile + * Build Script to build driver + * Install Script to install driver + + Driver source: + * wireless/ MSF source + * hcf/ HCF and F/W source + * wireless/wlags49_cs.mk Driver Makefile, PC Card + * wireless/wlags49_pci.mk Driver Makefile, PCI + * include/hcf/debug.h Driver debug support + * include/hcf/hcfcfg.h Header to configure HCF + * include/wireless/*.h Driver source headers + + Driver online manual page: + * man/wlags49.4 Driver manual page + + PCMCIA configuration update: + * etc/wlags49.conf Add-on config file + * etc/wlags49.mk config update Makefile + * etc/wlags49.patch config update patch file + + The driver is build up of 2 modules: + - a higher module called Module Specific Functions (MSF), which contains + the functions of the driver that are network driver interface and + Operating System specific. + - a lower module called Hardware Control Functions (HCF), which contains + the functions to interface to the Network Interface Card (NIC). The HCF + provides for all WaveLAN NIC types one standard interface to the MSF. + This I/F is called the Wireless Connection Interface (WCI) and is the + subject of a seperate document (025726). + + The HCF directory contains firmware images to allow the card to operate in + either station (STA) or Access Point (AP) mode. In the build process, the + files fw_h2.c and fw_h25.c are used for Hermes-II and Hermes-II.5 + respectively. The firmware images in this release are identified as: + - HII Station F/W: fw_h2.c.sta + - HII.5 Station F/W: fw_h25.c.sta + - HII AccesPoint F/W: fw_h2.c.ap + - HII.5 AccesPoint F/W: fw_h25.c.ap + To build a STA or AP mode driver, the suffix .sta or .ap must be removed. + The files as distributed by this release build STA drivers by default. + +------------------------------------------------------------------------------ +2. SYSTEM REQUIREMENTS + +2.1 Operating System + + This software can be compiled and installed with Linux kernel versions + 2.4.x. Although this driver should compile for other CPUs as well, as of + the date of this release, no CPU architectures other than x86 have been + verified. + + wl_lkm_7_22_abg is tested with the following Linux Distributions: + * Red Hat version 9.0 + * Suse version 9.0 + + If you're building for PC Card or Compact Flash, you need the Card Services + from David Hinds. + + wl_lkm_7_22_abg is tested with: + * pcmcia-cs-3.2.7.tar.gz + +2.2 Free Disk Space + + To compile the software you need to have the full set of Linux kernel + source files installed, as well as a sane build environment which includes + all tools necessary for compiling and linking code. Depending on the exact + version of the kernel, you need approximately 150 MB of free disk space. + Once compiled, the driver uses about 150-200 KB. Please note, this size is + approximate and can vary depending on which version of the driver is built. + In addition, adding debug tracing support increases this size. + +------------------------------------------------------------------------------ +3. NEW IN THIS RELEASE + +Version 7.22 abg - July 28, 2004 + +------------------------------------------------------------------------------ +4. INSTALLATION NOTES + + The driver files for the Linux driver are not "ready" for direct + installation onto any Linux computer. To build and install the driver you + need some expertise on the Linux operating system in general and the type + and version installed of the kernel installed on your computer. With this + knowledge you can use the driver source files provided to build your own + Linux driver for your specific computer and kernel. + +4.1 Before you start + + 1) Determine the type and version of the Linux kernel of your computer and + check whether it meets the system requirements listed in section 2 of this + README. + + 2) If you're building for PC Card or Compact Flash, read the Linux + PCMCIA-HOWTO by David Hinds. This document is probably provided on the + CD-ROM of your Linux distribution. You can download the latest version + from: + + http://pcmcia-cs.sourceforge.net + + Please read the section titled "Prerequisites and kernel setup" of the + PCMCIA-HOWTO. + +4.2 Build the driver for PC Card / Compact Flash + + 1) Obtain a copy of the Linux PCMCIA package from a CD-ROM of your Linux + distribution or download the latest version. + For your convenience, the Agere Systems Wireless CD-ROM contains a copy of + the PCMCIA package in sub-directory: Xtras/Linux/PCMCIA + + 2) To unpack the Linux PCMCIA package, copy it to the current working + directory and type: + % tar xzvf pcmcia-cs-x.y.z.tar.gz + % mv pcmcia-cs-x.y.z pcmcia-cs + + Note: If you use the archive supplied on the CDROM, use archive name + "pc3_2_1.tgz" instead of "pcmcia-cs-3.2.7.tar.gz". + + Note: even though PCMCIA code exists in the kernel source tree, the PCMCIA + Card Services package needs to be unpacked locally to build drivers based + on it. + + 3) Extract the wlags49 distribution archive on top of the Linux PCMCIA + package. + % cd pcmcia-cs + % tar xzvf ../wl_lkm_7_22_abg.tar.gz + + 4) To build and install the driver, follow the procedure below: + % ./Configure + + Answer the presented questions. Usually the default answers are OK and + pressing "Enter" is enough. + On newer RedHat systems, however, you should specify "/usr/src/linux-2.4" + as the Linux source directory instead of the default "/usr/src/linux". + + For more detailed information on configuration, building and installing, + see the PCMCIA-HOWTO. + + To build the default drivers, which support Hermes-II in station mode, run + the Build script: + % ./Build + + This script determines whether your system uses in-kernel PCMCIA and either + builds the full PCMCIA package or just the driver. + + Before installing the driver with the Install script, you must become + 'root': + % su + .. + % ./Install + + This script determines whether your system uses in-kernel PCMCIA and either + installs the full PCMCIA package or just the driver. + + 5) If it becomes necessary to clean the build, issue the following + commands: + % make clean + % make -C lib clean + +4.3 Build the driver for PCI + + 1) Extract the wlags49 to the current working directory. + % tar xzvf wl_lkm_7_22.tar.gz + + Note: there is no need to unpack the driver source into a PCMCIA build + directory. + + 2) To build the PCI driver: + % make -f wlags49.mk wlags49_h2_pci + or + % make -f wlags49.mk wlags49_h25_pci + + 3) Install the driver. + % insmod ./wireless/wlags49_h25.o + + 4) If it becomes necessary to clean the build. + % make -f wlags49.mk pci_clean + +4.4 Configure your Wireless PC Card + + There are 3 ways to configure the driver + - module parameters (/etc/pcmcia/config.opts) + - wireless extension (/etc/pcmcia/wireless.opts) + - Agere configuration file (/etc/agere/iwconfig-eth#) + + +4.4.1 Configure through /etc/pcmcia/config.opts + + To use this method, make sure that /etc/pcmcia/wireless.opts file is either + absent or contains blank parameter values as shown below. + + *,*,*,00:60:1D:*|*,*,*,00:02:2D:*) + INFO="" + ESSID="" + MODE="" + KEY="" + ;; + + 1) To configure the Wireless PC Card, please refer to: + * The online manual page (wlags49.4) + % man wlags49 + * The network adapter sections of the PCMCIA documentation. + % more PCMCIA-HOWTO + + 2) Use an editor to configure the module parameters: + # vi /etc/pcmcia/config.opts + + a) To connect your computer to a wireless infrastructure that includes + access points such as the AP-1000 or AP-500, you need to identify the + network name of the wireless infrastructure. + + For example if your infrastructure uses the network name "My Network", + edit the config.opts file to include the following: + + module "" opts "network_name=My\ Network" + + Notice that the space character needs to be escaped with a backslash. + + b) To connect your computer to a Residential Gateway RG-1000, you need + to know the RG ID (=network_name) and the encryption key. You can find + the RG ID on a small label on the rear of the unit. + + For example if your RG-1000 has ID 225ccf and you did not change the + encryption key yet, edit the config.opts file to include the following: + + module "" opts "network_name=\"225ccf\" key_1=\"25ccf\" + enable_encryption=Y" + + If you changed your encryption key, you should specify this key as key_1 + on the parameter line. + + c) To connect your computer to a peer-to-peer network, in an environment + without access points, the IBSS mode is recommended. + + For example to connect to a peer-to-peer network called "My Network", + enter the following in the config.opts file: + + module "" opts "create_ibss=Y network_name=My\ Network" + + d) Optionally you can also include a "Station Name" value that can be + used to indentify your computer on the wireless network. + + For example if you wish to name your computer "Wave1" when connecting it + to a wireless infrastructure, edit the config.opts file to include the + following: + + module "" opts "network_name=Ocean station_name=Wave1" + + e) To connect your computer to an Ad-Hoc workgroup of wireless + computers, enter the following in the config.opts file: + + module "" opts "port_type=3" + + Note that the "Ad-Hoc Demo Mode" is not the recommended mode for a + peer-to-peer network. The configuration of this non-interoperable mode + is only explained here for special applications (e.g. research, or + compatibility with other / previous WaveLAN/IEEE products). + + The IBSS mode described in c) is the preferred and interoperable mode + for creating a peer-to-peer network. + + 3) Use an editor to modify the network options for your adapter. + # vi /etc/pcmcia/network.opts + + The parameters need to be correct for the connected network. Check with + your system administrator for the correct network information. Refer to + the PCMCIA-HOWTO for more configuration information. + + For example: + *,*,*,*) + IF_PORT="" + BOOTP="n" + IPADDR="10.0.0.5" + NETMASK="255.255.255.0" + NETWORK="10.0.0.0" + BROADCAST="10.0.0.255" + GATEWAY="10.0.0.1" + DOMAIN="domain.org" + DNS_1="dns1.domain.org" + ;; + + RedHat and Suse do not use the network.opts to configure the driver. + Instead RedHat uses a GUI-based tool called 'neat' ('net.cfg' in older + versions) and SuSE Linux uses 'YaST'. These tools creates scripts, like + ifcfg-eth0, in the directory /etc/sysconfig/network-scripts. Using the + default GNOME menu, you can start netcfg from: Programs->System->Network + Configuration. + + 4) Restart the PCMCIA services. + # /etc/rc.d/rc.pcmcia restart + or + # /etc/rc.d/init.d/pcmcia restart + + + For a more detailed description about the various configuration options and + definitions, please consult the Wireless documentation. + +4.4.2 Configure through /etc/pcmcia/wireless.opts + + This driver has support for the "Wireless Extensions". This interface + allows the "Wireless Tools" to get statistics from the driver and allows to + change the configuration of the driver on the fly. + + The latest versions of the PCMCIA package contain scripts that use the + wireless extension to configure the driver as an alternative to the + configuration through module parameters as described in section 4.4.1. + Read the /etc/pcmcia/wireless.opts file for the theory of operation. When + the driver is configured, go to section 4.4.1 step 3 to configure the + network parameters. + + For more information, refer to the following WEB pages: + http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Linux.Wireless.Extensions.html + http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html + +4.4.3 Configure through /etc/agere/iwconfig-eth# + + In addition to using either the module options or the wireless extensions + methods to configure a wireless device, this version of the software also + supports an Agere specific implementation. This was done because: + * Module options configures multiple devices the same. + * Wireless extensions parameters do not cover all of the available options + in the driver. + + For each wireless ethernet device (identified by eth, where n is a + positive integer), a file /etc/agere/iwconfig-eth can be created which + contains configuration information for a wireless device. For example, the + file /etc/agere/iwconfig-eth1 is the config file for eth1. This file should + contain Key/Value pairs in the format: + + = + + where is the parameter to configure and is the value to + assign it. For example, if the config file /etc/agere/iwconfig-eth1 + described above contains the following: + + DesiredSSID=some_network + EnableEncryption=Y + Key1=net01 + TxKey=1 + + this configures eth1 to associate to the ESSID 'some_network' with + encryption on, where the the first encryption key is 'net01' and the key to + use for encryption is Key 1. + + Note that this only works on Agere hardware which uses this driver. For + other wireless drivers, or non-wireless devices, this file can be present, + but has no effect. + + Please refer to the man page for more information on this configuration + file and the parameters that can be set. + + +4.5 Configuring your Wireless PCI card + + Note that the above method of configuring the card using + /etc/pcmcia/config.opts is only valid for PCMCIA/CF cards. For [mini]PCI + and CardBus cards, refer to your system's documentation on modules.conf to + load the driver with the proper options for a given wireless ethernet + interface. In addition, network configuration tools like 'netcfg', 'neat', + or 'YaST' (see Section 4.4.1, Step 3) can be used to configure the miniPCI + card. Lastly, the Agere configuration file described in Section 4.4.3 may + also be used for [mini]PCI and CardBus devices. + +4.6 Troubleshooting + + When the Wireless PC Card is inserted, the card manager emit beeps in + different tones to indicate success or failure of particular configuration + steps. + a) Two high beeps + - The card was identified and configured successfully. + b) One high beep followed by a low beep + - The card was identified, but could not be configured. + - Examine the system log (dmesg) for PCMCIA error or warning messages. + c) One low beep + - The card could not be identified. + - Execute "cardctl ident" to display the adapter PnP information. + Verify the PnP information matches an entry in the PCMCIA + configuration file (/etc/pcmcia/config). + - Examine the system log (dmesg) for PCMCIA error or warning messages. + + The Wireless PC Card has two LEDs that indicate the state of the adapter + and network. + * Power LED (toward the middle of the adapter) + - This LED indicates power has been applied, and the card is + functional. In normal operation mode with Card Power Management + disabled, it is steady-on. With Card Power Management enabled, it + blinks rapidly (several times per second). + * Transmit/Receive LED (closer to the edge of the adapter) + - This LED flashes when it detects transmit or receive packets. + + * Both LEDs blink at the same time every 10 seconds. + - The adapter was unable to make contact with the named wireless + network. Verify the network_name, in the config.opts file matches the + network name of the access point. + * LEDs indicate normal operation with the Power LED + steady-on or blinking rapidly and Transmit/Receive LED flashing, but no + traffic. + - If the network is operating in normal mode (ie. port_type = 0 or not + specified), and a network_name has been specified, verify the + workstation network parameters (ifconfig, route, etc.) are correct + for the wireless network. + - If the network is operating in Ad-Hoc (peer-to-peer) mode (ie. + port_type = 3), the adapter needs another workstation/adapter to + communicate with. Verify the network parameters on both of the + workstations (ifconfig, route, etc.) are correct. + + Refer to the online manual page for additional configuration, feature and + support information. + % man wlags49 + or + % man 4 wlags49 + or + % nroff -man wlags49.4 | more + +4.7 Identifying the software + + This section explains how to identify the version of this software once it + is unpacked or installed. + + The Linux Driver Source/Library distribution consist of two main + components, the driver source and the HCF module. + + * To quickly identify the version of the source, type: + % grep DRV.*VERSION include/wireless/wl_version.h + #define DRV_MAJOR_VERSION 7 + #define DRV_MINOR_VERSION 22 + + * To identify the revision of the HCF library contained in the driver, + type: + % grep HCF.Revision hcf/hcf.c + #define HCF_VERSION TEXT( "HCF$Revision: 1.8 $" ) + + To identify a compiled wlags49 driver, go to the directory where the driver + is located. Card Services drivers (wlags49_h2_cs.o and wlags49_h25_cs.o) + are located in: + /lib/modules//pcmcia + + PCI drivers (wlags49_h2.o) are located in: + /lib/modules//kernel/drivers/net + + * To retrieve the version of the source used to compile the driver, type: + % strings .o | grep Agere + v7.22-abg-Beta for PCMCIA + v7.22-abg-Beta for PCI + + * Likewise, to retrieve the revision of the HCF used to compile the driver, + type: + % strings .o | grep Revision + HCF$Revision: 5.15 + + At startup the wlags49 driver reports its version in the system log file + (/var/log/messages). + +------------------------------------------------------------------------------ +5. TECHNICAL CONSTRAINTS + + At the time of release of this software, the following constraints are + identified: + +5.1 Using the ISA adapter + + Description: To allow operation in desktop computers Agere also provides an + optional ISA bus to PC Card adapter (also referred to as "swapbox"). + + This ISA Adapter can be configured for two different I/O Address values: + * 3E2 (factory-set default) + * 3E0 + + Impact: By default the i82365 module of the Linux pcmcia package only + probes at 3E0. + + Actions: + 1) Read the manual page on the probing of the i82365 module, by typing the + command: + man i82365 + + 2) Apply one of the two following options: + a) Change the I/O address strapping of the ISA adapter by replacing the + jumper on the ISA adapter. The correct jumper setting is pictured in + the electronic "Wireless ISA Adapter, Getting Started Guide" provided + on the Wireless Software CD-ROM. This guide is provided in Adobe's + Acrobat PDF format. + + b) Alternatively, you can load the i82365 module with the + "extra_sockets" parameter set to 1. + + On a RedHat 5.x thru 7.x, system, put this in the file + "/etc/sysconfig/pcmcia": + PCMCIA=yes + PCIC=i82365 + PCIC_OPTS="extra_sockets=1" + CORE_OPTS= + CARDMGR_OPTS= + + For other Linux distributions, you are advised to consult the + "PCMCIA-HOWTO" notes for information about changing the I/O Address + probing. + +5.2 Using the PCI Adapter + + Description: To allow operation in desktop computers Agere also provides an + optional PCI bus to PC Card adapter (also referred to as "swapbox"). + + For correct interrupt assignment, the system should support PCIBIOS 2.2. + It is recommended to use PCMCIA package version 3.2.7 or higher. + + The default configuration of the interrupt routing method of the PCI + Adapter's TI CardBus Controller is incorrect. + + Actions: + 1) Read the manual page on the "Options specific for TI CardBus + Controllers" of the i82365 module, by typing the command: + man i82365 + + 2) Load the i82365 module with the "irq_mode" parameter set to 0. + On a RedHat 5.x thru 7.x system, put this in the file + "/etc/sysconfig/pcmcia": + PCMCIA=yes + PCIC=i82365 + PCIC_OPTS="irq_mode=0" + CORE_OPTS= + CARDMGR_OPTS= + + For the location of the PCMCIA scripts on other Linux distributions, you + are advised to consult the "PCMCIA-HOWTO", "Notes about specific Linux + distributions". + +------------------------------------------------------------------------------ +6. KNOWN ISSUES + + This is the current list of known issues for this release, and will be + addressed in the near future: + + 1. This driver release contains a version of Hermes-II.5 firmware which + REQUIRES calibrated cards. If there is no calibration data present in the + PDA of the hardware, the firmware does not operate. + + 2. WDS is not yet supported. + + 3. DMA is not yet supported. + + 4. WPA is not yet supported. + + 5. 32-bits I/O is not yet supported. + + 6. The current Build script also builds the PCI drivers. + + 7. The current Install script also copies the PCI drivers to the lib + directory. + + 8. If F/W files are required from outside this release, the entry points + inside these F/W files have to be renamed from "ap" and "station" to + "fw_image" and they have to be renamed to fw_h2.c and fw_h25.c for + Hermes-II and Hermes-II.5. + +------------------------------------------------------------------------------ +7. TECHNICAL SUPPORT + +7.1 Finding Information + + On the Agere Systems Web Site you can find the most recent device drivers, + software updates and user documentation. + + World Wide Web: http://www.agere.com + +7.2 Contact Technical Support + + If you encounter problems when installing or using this product, or would + like information about our other "Wireless" products, please contact your + local Authorized "Wireless" Reseller or Agere Systems sales office. + + Addresses and telephone numbers of the Agere Systems sales offices are + listed on our Agere Systems web site. + + When contacting Technical Support, please use the Problem Report Form and + send it to us by Fax or E-Mail. The Problem Report Form 'REPORT.TXT' + (Plain text format) is included on the disk. Alternatively, you can + download the Problem Report Form from the Agere Systems web site. + + Include Product Name, Serial Number and software version number with each + request to help the Support Group helping you. + +============================================================================== + END OF FILE diff --git a/drivers/staging/wlags49_h2/WARNING.txt b/drivers/staging/wlags49_h2/WARNING.txt new file mode 100644 index 000000000000..5d12973ba19c --- /dev/null +++ b/drivers/staging/wlags49_h2/WARNING.txt @@ -0,0 +1,3 @@ +These sources are shared with the wlags49_h25 driver. Some files are even +exclusively used by that driver. Do not delete them here without looking +at that other driver. diff --git a/drivers/staging/wlags49_h2/ap_h2.c b/drivers/staging/wlags49_h2/ap_h2.c new file mode 100644 index 000000000000..f5123d2cb4c1 --- /dev/null +++ b/drivers/staging/wlags49_h2/ap_h2.c @@ -0,0 +1,3337 @@ +/* + * File: ap_h24.236 + * + * Abstract: This file contains memory image 'fw_image'. + * + * Contents: Total size of the memory image: 51010 bytes. + * Total number of blocks: 4 blocks. + * Block 1 : load address 00000060, 326 bytes. + * Block 2 : load address 00000C16, 6424 bytes. + * Block 3 : load address 001E252E, 444 bytes. + * Block 4 : load address 001F4000, 43816 bytes. + * + * Identity: component id: 32 (variant 2) version 2.36 + * + * Compatibility: + * supplying interface 8 (variant 2) : 2 - 4 + * acting on interface 1 (variant 4) : 6 - 7 + * acting on interface 1 (variant 5) : 6 - 7 + * acting on interface 1 (variant 6) : 6 - 7 + * acting on interface 2 (variant 2) : 1 - 2 + * + * Generated: by g:\fw\fupu3.exe version 4.26 + * + * Commandline: g:\fw\fupu3.exe /f=4 /n=fw_image /i=t2023600.hex + */ + + +#include "hcfcfg.h" // to get hcf_16 etc defined as well as + // possible settings which inluence mdd.h or dhf.h +#include "mdd.h" //to get COMP_ID_STA etc defined +#include "dhf.h" //used to be "fhfmem.h", to get memblock,plugrecord, + +static const hcf_8 fw_image_1_data[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x0D, 0x00, 0x00, + 0x3A, 0x0C, 0x00, 0x00, 0x3A, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC8, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, + 0x0A, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xEA, 0x00, 0x00, 0xFF, 0x07, 0x02, 0x00, 0x64, 0x00, 0x64, 0x00, 0x10, 0x27, 0x10, 0x27, + 0x14, 0x00, 0xD0, 0x07, 0xD0, 0x07, 0x10, 0x27, 0x2F, 0x00, 0x32, 0x00, 0x32, 0x00, 0x05, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x10, 0x27, 0x05, 0x00, 0x00, 0x02, 0x00, 0x02, 0x13, 0x00, 0x0A, 0x00, + 0x07, 0x00, 0x03, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x09, 0x2B, 0x09, 0x2B, 0x09, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x00, 0x14, 0x01, 0x00, 0x40, 0x00, 0x32, 0x00, 0x32, 0x00, + 0x0A, 0x00, 0x02, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + +}; /* fw_image_1_data */ + +static const hcf_8 fw_image_2_data[] = { + 0x9B, 0xA7, 0x00, 0x0A, 0x10, 0x01, 0x68, 0xA4, 0xB0, 0x01, 0x84, 0x01, 0x30, 0x33, 0x31, 0x33, + 0x44, 0x44, 0x30, 0x33, 0x31, 0x33, 0x30, 0x33, 0x31, 0x33, 0x32, 0x33, 0x32, 0x33, 0x90, 0x00, + 0x78, 0x04, 0xAE, 0xE4, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, + 0x0C, 0x0D, 0x0E, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA5, 0xC6, 0x84, 0xF8, 0x99, 0xEE, + 0x8D, 0xF6, 0x0D, 0xFF, 0xBD, 0xD6, 0xB1, 0xDE, 0x54, 0x91, 0x50, 0x60, 0x03, 0x02, 0xA9, 0xCE, + 0x7D, 0x56, 0x19, 0xE7, 0x62, 0xB5, 0xE6, 0x4D, 0x9A, 0xEC, 0x45, 0x8F, 0x9D, 0x1F, 0x40, 0x89, + 0x87, 0xFA, 0x15, 0xEF, 0xEB, 0xB2, 0xC9, 0x8E, 0x0B, 0xFB, 0xEC, 0x41, 0x67, 0xB3, 0xFD, 0x5F, + 0xEA, 0x45, 0xBF, 0x23, 0xF7, 0x53, 0x96, 0xE4, 0x5B, 0x9B, 0xC2, 0x75, 0x1C, 0xE1, 0xAE, 0x3D, + 0x6A, 0x4C, 0x5A, 0x6C, 0x41, 0x7E, 0x02, 0xF5, 0x4F, 0x83, 0x5C, 0x68, 0xF4, 0x51, 0x34, 0xD1, + 0x08, 0xF9, 0x93, 0xE2, 0x73, 0xAB, 0x53, 0x62, 0x3F, 0x2A, 0x0C, 0x08, 0x52, 0x95, 0x65, 0x46, + 0x5E, 0x9D, 0x28, 0x30, 0xA1, 0x37, 0x0F, 0x0A, 0xB5, 0x2F, 0x09, 0x0E, 0x36, 0x24, 0x9B, 0x1B, + 0x3D, 0xDF, 0x26, 0xCD, 0x69, 0x4E, 0xCD, 0x7F, 0x9F, 0xEA, 0x1B, 0x12, 0x9E, 0x1D, 0x74, 0x58, + 0x2E, 0x34, 0x2D, 0x36, 0xB2, 0xDC, 0xEE, 0xB4, 0xFB, 0x5B, 0xF6, 0xA4, 0x4D, 0x76, 0x61, 0xB7, + 0xCE, 0x7D, 0x7B, 0x52, 0x3E, 0xDD, 0x71, 0x5E, 0x97, 0x13, 0xF5, 0xA6, 0x68, 0xB9, 0x00, 0x00, + 0x2C, 0xC1, 0x60, 0x40, 0x1F, 0xE3, 0xC8, 0x79, 0xED, 0xB6, 0xBE, 0xD4, 0x46, 0x8D, 0xD9, 0x67, + 0x4B, 0x72, 0xDE, 0x94, 0xD4, 0x98, 0xE8, 0xB0, 0x4A, 0x85, 0x6B, 0xBB, 0x2A, 0xC5, 0xE5, 0x4F, + 0x16, 0xED, 0xC5, 0x86, 0xD7, 0x9A, 0x55, 0x66, 0x94, 0x11, 0xCF, 0x8A, 0x10, 0xE9, 0x06, 0x04, + 0x81, 0xFE, 0xF0, 0xA0, 0x44, 0x78, 0xBA, 0x25, 0xE3, 0x4B, 0xF3, 0xA2, 0xFE, 0x5D, 0xC0, 0x80, + 0x8A, 0x05, 0xAD, 0x3F, 0xBC, 0x21, 0x48, 0x70, 0x04, 0xF1, 0xDF, 0x63, 0xC1, 0x77, 0x75, 0xAF, + 0x63, 0x42, 0x30, 0x20, 0x1A, 0xE5, 0x0E, 0xFD, 0x6D, 0xBF, 0x4C, 0x81, 0x14, 0x18, 0x35, 0x26, + 0x2F, 0xC3, 0xE1, 0xBE, 0xA2, 0x35, 0xCC, 0x88, 0x39, 0x2E, 0x57, 0x93, 0xF2, 0x55, 0x82, 0xFC, + 0x47, 0x7A, 0xAC, 0xC8, 0xE7, 0xBA, 0x2B, 0x32, 0x95, 0xE6, 0xA0, 0xC0, 0x98, 0x19, 0xD1, 0x9E, + 0x7F, 0xA3, 0x66, 0x44, 0x7E, 0x54, 0xAB, 0x3B, 0x83, 0x0B, 0xCA, 0x8C, 0x29, 0xC7, 0xD3, 0x6B, + 0x3C, 0x28, 0x79, 0xA7, 0xE2, 0xBC, 0x1D, 0x16, 0x76, 0xAD, 0x3B, 0xDB, 0x56, 0x64, 0x4E, 0x74, + 0x1E, 0x14, 0xDB, 0x92, 0x0A, 0x0C, 0x6C, 0x48, 0xE4, 0xB8, 0x5D, 0x9F, 0x6E, 0xBD, 0xEF, 0x43, + 0xA6, 0xC4, 0xA8, 0x39, 0xA4, 0x31, 0x37, 0xD3, 0x8B, 0xF2, 0x32, 0xD5, 0x43, 0x8B, 0x59, 0x6E, + 0xB7, 0xDA, 0x8C, 0x01, 0x64, 0xB1, 0xD2, 0x9C, 0xE0, 0x49, 0xB4, 0xD8, 0xFA, 0xAC, 0x07, 0xF3, + 0x25, 0xCF, 0xAF, 0xCA, 0x8E, 0xF4, 0xE9, 0x47, 0x18, 0x10, 0xD5, 0x6F, 0x88, 0xF0, 0x6F, 0x4A, + 0x72, 0x5C, 0x24, 0x38, 0xF1, 0x57, 0xC7, 0x73, 0x51, 0x97, 0x23, 0xCB, 0x7C, 0xA1, 0x9C, 0xE8, + 0x21, 0x3E, 0xDD, 0x96, 0xDC, 0x61, 0x86, 0x0D, 0x85, 0x0F, 0x90, 0xE0, 0x42, 0x7C, 0xC4, 0x71, + 0xAA, 0xCC, 0xD8, 0x90, 0x05, 0x06, 0x01, 0xF7, 0x12, 0x1C, 0xA3, 0xC2, 0x5F, 0x6A, 0xF9, 0xAE, + 0xD0, 0x69, 0x91, 0x17, 0x58, 0x99, 0x27, 0x3A, 0xB9, 0x27, 0x38, 0xD9, 0x13, 0xEB, 0xB3, 0x2B, + 0x33, 0x22, 0xBB, 0xD2, 0x70, 0xA9, 0x89, 0x07, 0xA7, 0x33, 0xB6, 0x2D, 0x22, 0x3C, 0x92, 0x15, + 0x20, 0xC9, 0x49, 0x87, 0xFF, 0xAA, 0x78, 0x50, 0x7A, 0xA5, 0x8F, 0x03, 0xF8, 0x59, 0x80, 0x09, + 0x17, 0x1A, 0xDA, 0x65, 0x31, 0xD7, 0xC6, 0x84, 0xB8, 0xD0, 0xC3, 0x82, 0xB0, 0x29, 0x77, 0x5A, + 0x11, 0x1E, 0xCB, 0x7B, 0xFC, 0xA8, 0xD6, 0x6D, 0x3A, 0x2C, 0x00, 0x30, 0x00, 0x31, 0x00, 0x33, + 0x00, 0x34, 0x00, 0x35, 0x00, 0x36, 0x00, 0x37, 0x00, 0x38, 0x00, 0x38, 0x00, 0x3A, 0x00, 0x3B, + 0x00, 0x3C, 0x00, 0x3D, 0x00, 0x3E, 0x00, 0x3F, 0x00, 0x3F, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0A, 0x02, 0x14, + 0x05, 0x32, 0x0B, 0x37, 0x08, 0x50, 0x0B, 0x6E, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x3F, 0x00, + 0x0C, 0x00, 0x30, 0x00, 0x03, 0x00, 0x0F, 0x00, 0x3E, 0x00, 0x3C, 0x00, 0x02, 0x00, 0x04, 0x00, + 0x0A, 0x00, 0x0B, 0x00, 0x10, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x63, 0x00, 0x20, 0x00, 0x63, 0x00, 0x63, 0x00, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x10, + 0x9E, 0x10, 0x56, 0x10, 0x98, 0x10, 0x5C, 0x10, 0x92, 0x10, 0x62, 0x10, 0x8C, 0x10, 0x68, 0x10, + 0x86, 0x10, 0x6E, 0x10, 0x80, 0x10, 0x74, 0x10, 0x7A, 0x10, 0x07, 0x01, 0x00, 0x00, 0x0A, 0x22, + 0x00, 0x04, 0x08, 0x01, 0x00, 0x00, 0x0A, 0x26, 0x00, 0x04, 0x09, 0x01, 0x00, 0x00, 0x0A, 0x2A, + 0x00, 0x04, 0x0A, 0x01, 0x00, 0x00, 0x0A, 0x2E, 0x00, 0x04, 0x0B, 0x01, 0x00, 0x00, 0x10, 0x24, + 0x04, 0x04, 0x0C, 0x01, 0x00, 0x00, 0x10, 0x28, 0x04, 0x04, 0x0D, 0x01, 0x00, 0x00, 0x10, 0x2C, + 0x04, 0x04, 0x0E, 0x01, 0x00, 0x00, 0x10, 0x30, 0x04, 0x04, 0x0F, 0x01, 0x00, 0x00, 0x16, 0x34, + 0x08, 0x04, 0x10, 0x01, 0x00, 0x00, 0x16, 0x38, 0x08, 0x04, 0x11, 0x01, 0x00, 0x00, 0x16, 0x3C, + 0x08, 0x04, 0x12, 0x01, 0x00, 0x00, 0x16, 0x40, 0x08, 0x04, 0x13, 0x01, 0x00, 0x00, 0x17, 0x64, + 0x0C, 0x0B, 0x14, 0x01, 0x00, 0x00, 0x17, 0x68, 0x0C, 0x0B, 0x15, 0x01, 0x00, 0x00, 0x17, 0x6C, + 0x0C, 0x0B, 0x16, 0x01, 0x00, 0x00, 0x17, 0x70, 0x0C, 0x0B, 0x17, 0x01, 0x00, 0x00, 0x17, 0x74, + 0x0C, 0x0B, 0x18, 0x01, 0x00, 0x00, 0x17, 0x78, 0x0C, 0x0B, 0x19, 0x01, 0x00, 0x00, 0x17, 0x7C, + 0x0C, 0x0B, 0x1A, 0x01, 0x00, 0x00, 0x17, 0x80, 0x0C, 0x0B, 0x1B, 0x01, 0x00, 0x00, 0x17, 0x84, + 0x0C, 0x0B, 0x1C, 0x01, 0x00, 0x00, 0x17, 0x88, 0x0C, 0x0B, 0x1D, 0x01, 0x00, 0x00, 0x17, 0x8C, + 0x0C, 0x0B, 0x1E, 0x01, 0x00, 0x00, 0x1D, 0x95, 0x17, 0x04, 0x1F, 0x01, 0x00, 0x00, 0x1D, 0x99, + 0x17, 0x04, 0x20, 0x01, 0x00, 0x00, 0x1D, 0x9D, 0x17, 0x04, 0x21, 0x01, 0x00, 0x00, 0x1D, 0xA1, + 0x17, 0x04, 0x22, 0x01, 0x00, 0x00, 0x0E, 0xA5, 0x00, 0x00, 0xC0, 0x10, 0xE0, 0x10, 0x00, 0x11, + 0x20, 0x11, 0x78, 0x11, 0xC8, 0x10, 0xE8, 0x10, 0x08, 0x11, 0x28, 0x11, 0x80, 0x11, 0xD0, 0x10, + 0xF0, 0x10, 0x10, 0x11, 0x30, 0x11, 0x88, 0x11, 0xD8, 0x10, 0xF8, 0x10, 0x18, 0x11, 0x38, 0x11, + 0x90, 0x11, 0x40, 0x11, 0x48, 0x11, 0x50, 0x11, 0x58, 0x11, 0x60, 0x11, 0x68, 0x11, 0x70, 0x11, + 0x98, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD2, 0x14, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xEB, 0xBA, 0xEB, + 0xDF, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, + 0x57, 0xEB, 0x90, 0xF1, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0xD6, 0xED, + 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, + 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x2F, 0xEE, + 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, + 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0xA4, 0xED, 0xBE, 0xED, + 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x57, 0xEB, 0x7F, 0xF4, 0x19, 0xEC, + 0x2C, 0xEC, 0xDC, 0xEC, 0xE0, 0xEC, 0x57, 0xEB, 0x57, 0xEB, 0x8F, 0xED, 0x84, 0xE3, 0x59, 0xE3, + 0xD7, 0xE3, 0x28, 0xE4, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xEB, 0xF6, 0xEB, 0x72, 0xF0, 0x72, 0xF0, + 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFC, 0x89, 0xEE, 0x45, 0xF0, 0x5A, 0x00, 0x02, 0x00, 0xF9, 0xFF, + 0x89, 0xEE, 0x9F, 0xEE, 0xCC, 0x00, 0x02, 0x00, 0xF7, 0xFF, 0x89, 0xEE, 0x9F, 0xEE, 0xB6, 0x1F, + 0x06, 0x00, 0xF0, 0xFF, 0x89, 0xEE, 0x73, 0xEE, 0x00, 0x00, 0x00, 0x02, 0xF6, 0xFF, 0x89, 0xEE, + 0x9F, 0xEE, 0x6C, 0x00, 0x02, 0x00, 0xF4, 0xFF, 0x89, 0xEE, 0x9F, 0xEE, 0x6A, 0x01, 0x02, 0x00, + 0xF5, 0xFF, 0x89, 0xEE, 0x4E, 0xF0, 0xA8, 0x1F, 0x02, 0x00, 0xE0, 0xFF, 0x89, 0xEE, 0x9F, 0xEE, + 0xEE, 0x21, 0x02, 0x00, 0xE1, 0xFF, 0x89, 0xEE, 0x9F, 0xEE, 0xF0, 0x21, 0x02, 0x00, 0xE2, 0xFF, + 0x89, 0xEE, 0x9F, 0xEE, 0xF2, 0x21, 0x02, 0x00, 0xE3, 0xFF, 0x89, 0xEE, 0x9F, 0xEE, 0xEA, 0x21, + 0x02, 0x00, 0x03, 0xFC, 0x89, 0xEE, 0xE5, 0xEF, 0x7C, 0x21, 0x02, 0x00, 0x04, 0xFC, 0x89, 0xEE, + 0x99, 0xEE, 0xBE, 0x1F, 0x22, 0x00, 0x06, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, 0xA6, 0x1F, 0x02, 0x00, + 0x07, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, 0x02, 0x20, 0x02, 0x00, 0x0E, 0xFC, 0x89, 0xEE, 0xF7, 0xEF, + 0x0C, 0x20, 0x22, 0x00, 0xB1, 0xFC, 0x89, 0xEE, 0x58, 0xF2, 0x2C, 0x21, 0x02, 0x00, 0x20, 0xFC, + 0x89, 0xEE, 0x9F, 0xEE, 0x32, 0x20, 0x02, 0x00, 0x25, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, 0x3C, 0x20, + 0x02, 0x00, 0x26, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, 0x3E, 0x20, 0x02, 0x00, 0x27, 0xFC, 0x89, 0xEE, + 0x9F, 0xEE, 0x40, 0x20, 0x02, 0x00, 0xB2, 0xFC, 0x89, 0xEE, 0x99, 0xEE, 0x50, 0x21, 0x22, 0x00, + 0xC1, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, 0x98, 0x21, 0x20, 0x00, 0xB0, 0xFC, 0x69, 0xEE, 0x5D, 0xF2, + 0x00, 0x00, 0x00, 0x00, 0xC4, 0xFC, 0x69, 0xEE, 0x68, 0xF0, 0x00, 0x00, 0x08, 0x00, 0xC8, 0xFC, + 0x69, 0xEE, 0x63, 0xF0, 0x00, 0x00, 0x08, 0x00, 0xB4, 0xFC, 0x69, 0xEE, 0x9B, 0xF2, 0x00, 0x00, + 0x00, 0x00, 0xB6, 0xFC, 0x69, 0xEE, 0x4E, 0xF3, 0x00, 0x00, 0x00, 0x00, 0xB7, 0xFC, 0x69, 0xEE, + 0x90, 0xF3, 0x00, 0x00, 0x00, 0x00, 0xB8, 0xFC, 0x69, 0xEE, 0xED, 0xF3, 0x00, 0x00, 0x00, 0x00, + 0xB5, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, 0xE6, 0x21, 0x02, 0x00, 0xB9, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, + 0xE8, 0x21, 0x02, 0x00, 0x90, 0xFD, 0x89, 0xEE, 0x73, 0xEE, 0xEC, 0x21, 0x02, 0x00, 0x23, 0xFC, + 0x89, 0xEE, 0x9F, 0xEE, 0x38, 0x20, 0x02, 0x00, 0x29, 0xFC, 0x48, 0xEF, 0xF5, 0xEE, 0x00, 0x00, + 0x00, 0x00, 0xC2, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, 0x74, 0x21, 0x02, 0x00, 0x32, 0xFC, 0x89, 0xEE, + 0x9F, 0xEE, 0x60, 0x01, 0x02, 0x00, 0x33, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, 0x62, 0x01, 0x02, 0x00, + 0x10, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, 0xAE, 0x1F, 0x02, 0x00, 0x11, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, + 0x46, 0x20, 0x06, 0x00, 0x12, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, 0x4C, 0x20, 0x06, 0x00, 0x13, 0xFC, + 0x89, 0xEE, 0x9F, 0xEE, 0x52, 0x20, 0x06, 0x00, 0x14, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, 0x58, 0x20, + 0x06, 0x00, 0x15, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, 0x5E, 0x20, 0x06, 0x00, 0x16, 0xFC, 0x89, 0xEE, + 0x9F, 0xEE, 0x64, 0x20, 0x06, 0x00, 0x17, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, 0x2E, 0x20, 0x02, 0x00, + 0x83, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, 0x6E, 0x01, 0x02, 0x00, 0x97, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, + 0x6C, 0x01, 0x02, 0x00, 0x98, 0xFC, 0x31, 0xF0, 0x1F, 0xF0, 0xE4, 0x00, 0x02, 0x00, 0x99, 0xFC, + 0x31, 0xF0, 0x1F, 0xF0, 0xE4, 0x02, 0x02, 0x00, 0x9A, 0xFC, 0x31, 0xF0, 0x1F, 0xF0, 0xE4, 0x04, + 0x02, 0x00, 0x9B, 0xFC, 0x31, 0xF0, 0x1F, 0xF0, 0xE4, 0x06, 0x02, 0x00, 0x9C, 0xFC, 0x31, 0xF0, + 0x1F, 0xF0, 0xE4, 0x08, 0x02, 0x00, 0x9D, 0xFC, 0x31, 0xF0, 0x1F, 0xF0, 0xE4, 0x0A, 0x02, 0x00, + 0x18, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, 0x30, 0x20, 0x02, 0x00, 0x22, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, + 0x36, 0x20, 0x02, 0x00, 0x24, 0xFC, 0x89, 0xEE, 0x9F, 0xEE, 0x3A, 0x20, 0x02, 0x00, 0xC0, 0xFC, + 0x69, 0xEE, 0x61, 0xF0, 0x00, 0x00, 0x06, 0x00, 0x9E, 0xFC, 0x89, 0xEE, 0x17, 0xF0, 0x70, 0x01, + 0x02, 0x00, 0x9F, 0xFC, 0x31, 0xF0, 0x1F, 0xF0, 0xE6, 0x00, 0x02, 0x00, 0xA0, 0xFC, 0x31, 0xF0, + 0x1F, 0xF0, 0xE6, 0x02, 0x02, 0x00, 0xA1, 0xFC, 0x31, 0xF0, 0x1F, 0xF0, 0xE6, 0x04, 0x02, 0x00, + 0xA2, 0xFC, 0x31, 0xF0, 0x1F, 0xF0, 0xE6, 0x06, 0x02, 0x00, 0xA3, 0xFC, 0x31, 0xF0, 0x1F, 0xF0, + 0xE6, 0x08, 0x02, 0x00, 0xA4, 0xFC, 0x31, 0xF0, 0x1F, 0xF0, 0xE6, 0x0A, 0x02, 0x00, 0x20, 0xFD, + 0xBA, 0xEE, 0x73, 0xEE, 0x53, 0xF5, 0x08, 0x00, 0x21, 0xFD, 0xBA, 0xEE, 0x73, 0xEE, 0x57, 0xF5, + 0x0A, 0x00, 0x22, 0xFD, 0xBA, 0xEE, 0x73, 0xEE, 0x5C, 0xF5, 0x16, 0x00, 0x23, 0xFD, 0xBA, 0xEE, + 0x73, 0xEE, 0x67, 0xF5, 0x0A, 0x00, 0x10, 0xFD, 0x89, 0xEE, 0x73, 0xEE, 0x34, 0x01, 0x02, 0x00, + 0x45, 0xFD, 0x89, 0xEE, 0x73, 0xEE, 0xCC, 0x00, 0x02, 0x00, 0x47, 0xFD, 0x89, 0xEE, 0x73, 0xEE, + 0x38, 0x01, 0x02, 0x00, 0x48, 0xFD, 0x9E, 0xEF, 0x73, 0xEE, 0x60, 0x01, 0x02, 0x00, 0x49, 0xFD, + 0x9E, 0xEF, 0x73, 0xEE, 0x62, 0x01, 0x02, 0x00, 0x4A, 0xFD, 0x89, 0xEE, 0x73, 0xEE, 0x58, 0x01, + 0x02, 0x00, 0x4B, 0xFD, 0x89, 0xEE, 0x73, 0xEE, 0x5A, 0x01, 0x02, 0x00, 0x4D, 0xFD, 0xBA, 0xEE, + 0x73, 0xEE, 0x6C, 0xF5, 0x04, 0x00, 0x4F, 0xFD, 0xB2, 0xEF, 0x73, 0xEE, 0x80, 0x21, 0x02, 0x00, + 0xC0, 0xFD, 0xBA, 0xEE, 0x73, 0xEE, 0x6E, 0xF5, 0x02, 0x00, 0xC2, 0xFD, 0xA8, 0xEF, 0x73, 0xEE, + 0x00, 0x00, 0x02, 0x00, 0xC3, 0xFD, 0xBA, 0xEE, 0x73, 0xEE, 0x6F, 0xF5, 0x02, 0x00, 0x40, 0xFD, + 0xB2, 0xEE, 0x73, 0xEE, 0x78, 0x01, 0x02, 0x00, 0x24, 0xFD, 0xD8, 0xEF, 0x73, 0xEE, 0x00, 0x00, + 0x02, 0x00, 0x91, 0xFD, 0x89, 0xEE, 0x73, 0xEE, 0x86, 0x1B, 0x02, 0x00, 0x93, 0xFD, 0x89, 0xEE, + 0x73, 0xEE, 0x8C, 0x1B, 0x02, 0x00, 0xC1, 0xFD, 0x89, 0xEE, 0x73, 0xEE, 0xCA, 0x00, 0x02, 0x00, + 0xC6, 0xFD, 0xE7, 0xEE, 0x73, 0xEE, 0x8E, 0x21, 0x0A, 0x00, 0x89, 0xFD, 0x5F, 0xEF, 0x73, 0xEE, + 0x00, 0x00, 0x00, 0x00, 0x8A, 0xFD, 0xD7, 0xEE, 0x73, 0xEE, 0xC0, 0x21, 0x24, 0x00, 0x46, 0xFD, + 0x89, 0xEE, 0x73, 0xEE, 0x7A, 0x01, 0x06, 0x00, 0x86, 0xFD, 0x89, 0xEE, 0x73, 0xEE, 0xB6, 0x1F, + 0x06, 0x00, 0x87, 0xFD, 0x89, 0xEE, 0x73, 0xEE, 0xB8, 0x21, 0x06, 0x00, 0x8B, 0xFD, 0x7A, 0xF3, + 0x73, 0xEE, 0x00, 0x00, 0x12, 0x00, 0x8E, 0xFD, 0x89, 0xEE, 0x73, 0xEE, 0xB8, 0x12, 0x02, 0x00, + 0x80, 0xFD, 0xBC, 0xEF, 0x73, 0xEE, 0x1C, 0x00, 0x02, 0x00, 0x81, 0xFD, 0xBC, 0xEF, 0x73, 0xEE, + 0x1C, 0x02, 0x02, 0x00, 0x82, 0xFD, 0xBC, 0xEF, 0x73, 0xEE, 0x1C, 0x04, 0x02, 0x00, 0x83, 0xFD, + 0xBC, 0xEF, 0x73, 0xEE, 0x1C, 0x06, 0x02, 0x00, 0x84, 0xFD, 0xBC, 0xEF, 0x73, 0xEE, 0x1C, 0x08, + 0x02, 0x00, 0x85, 0xFD, 0xBC, 0xEF, 0x73, 0xEE, 0x1C, 0x0A, 0x02, 0x00, 0x00, 0xF1, 0x46, 0x00, + 0x2D, 0xEE, 0xF8, 0x00, 0x00, 0x03, 0x8A, 0xEA, 0x1F, 0x00, 0x36, 0x01, 0xCA, 0x00, 0x96, 0x01, + 0xCE, 0x00, 0xFC, 0x00, 0x78, 0x01, 0xDA, 0x1E, 0x1A, 0x01, 0x86, 0x1B, 0xC8, 0x00, 0x00, 0x00, + 0xCE, 0x12, 0x00, 0x00, 0xD2, 0x14, 0x14, 0x01, 0x03, 0x00, 0xAE, 0x00, 0xE4, 0x00, 0x3C, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x77, 0xB4, 0xEA, 0xB3, 0x26, 0xB5, 0x2F, 0xB5, 0xFB, 0xB3, 0xA4, 0xB4, 0x69, 0xB4, 0xE7, 0xC5, + 0x4A, 0xC5, 0xE7, 0xC5, 0xBE, 0xC5, 0x54, 0xC5, 0x48, 0xC5, 0x06, 0xC6, 0x17, 0xC6, 0x17, 0xC6, + 0x17, 0xC6, 0x20, 0xC6, 0x3B, 0xC6, 0x98, 0xC6, 0xB4, 0xC6, 0xBF, 0xC5, 0xD2, 0xC5, 0xA6, 0xC5, + 0x10, 0x00, 0x12, 0x00, 0x13, 0x00, 0x20, 0x00, 0x21, 0x00, 0x22, 0x00, 0x30, 0x00, 0x31, 0x00, + 0x32, 0x00, 0x33, 0x00, 0x34, 0x00, 0x35, 0x00, 0x36, 0x00, 0x37, 0x00, 0x38, 0x00, 0x39, 0x00, + 0x3A, 0x00, 0x00, 0x00, 0x14, 0x01, 0x14, 0x01, 0x14, 0x01, 0x14, 0x01, 0x14, 0x01, 0x14, 0x01, + 0x14, 0x01, 0x14, 0x01, 0xF3, 0x02, 0xAD, 0x03, 0x60, 0x04, 0x04, 0x05, 0x07, 0x06, 0x08, 0x07, + 0x0A, 0x08, 0x16, 0x09, 0x44, 0x0A, 0x04, 0x0B, 0x40, 0x0C, 0x80, 0x0D, 0x00, 0x0E, 0x84, 0x0F, + 0x01, 0x10, 0x10, 0x11, 0x02, 0x14, 0x40, 0x20, 0x32, 0x21, 0x32, 0x22, 0x04, 0x23, 0x01, 0x24, + 0x0F, 0x25, 0x00, 0x26, 0x00, 0x27, 0x00, 0x28, 0x00, 0x29, 0x00, 0x2A, 0x01, 0x2B, 0x06, 0x2C, + 0x00, 0x38, 0x00, 0x39, 0xD6, 0x3A, 0x00, 0x3B, 0x00, 0x3C, 0x14, 0x3D, 0x7F, 0x3E, 0x00, 0x3F, + 0x68, 0x40, 0x75, 0x41, 0x07, 0x42, 0x07, 0x43, 0x00, 0x45, 0x3B, 0x4A, 0x00, 0x4B, 0x00, 0x4C, + 0x0F, 0x4D, 0x02, 0x75, 0x00, 0x76, 0x80, 0x00, 0x08, 0x01, 0x09, 0x01, 0x09, 0x01, 0x0A, 0x01, + 0x0A, 0x01, 0x0B, 0x01, 0x0B, 0x01, 0x0C, 0x01, 0x0C, 0x01, 0x0D, 0x01, 0x0D, 0x01, 0x0E, 0x01, + 0x0E, 0x01, 0x0F, 0x01, 0x0F, 0x01, 0x10, 0x01, 0x10, 0x01, 0x11, 0x01, 0x11, 0x01, 0x12, 0x01, + 0x12, 0x01, 0x13, 0x01, 0x13, 0x01, 0x14, 0x01, 0x14, 0x01, 0x15, 0x01, 0x15, 0x01, 0x16, 0x01, + 0x16, 0x01, 0x17, 0x01, 0x17, 0x01, 0x18, 0x01, 0x18, 0x01, 0x19, 0x01, 0x19, 0x01, 0x4D, 0x01, + 0x4D, 0x01, 0x4E, 0x01, 0x4E, 0x01, 0x4F, 0x01, 0x4F, 0x01, 0x50, 0x01, 0x50, 0x01, 0x51, 0x01, + 0x51, 0x01, 0x52, 0x01, 0x52, 0x01, 0x53, 0x01, 0x53, 0x01, 0x54, 0x01, 0x54, 0x01, 0x65, 0x01, + 0x65, 0x01, 0x66, 0x01, 0x66, 0x01, 0x67, 0x01, 0x67, 0x01, 0x68, 0x01, 0x68, 0x01, 0x69, 0x01, + 0x69, 0x01, 0x6A, 0x01, 0x6A, 0x01, 0x6B, 0x01, 0x6B, 0x01, 0x6C, 0x01, 0x6C, 0x01, 0x6D, 0x01, + 0x6D, 0x01, 0x6E, 0x01, 0x6E, 0x01, 0x6F, 0x01, 0x6F, 0x01, 0x70, 0x01, 0x70, 0x01, 0x71, 0x01, + 0x71, 0x01, 0x72, 0x01, 0x72, 0x01, 0x73, 0x01, 0x73, 0x01, 0x74, 0x01, 0x74, 0x01, 0x75, 0x01, + 0x75, 0x01, 0x76, 0x01, 0x76, 0x01, 0x77, 0x01, 0x77, 0x01, 0x78, 0x01, 0x78, 0x01, 0x79, 0x01, + 0x79, 0x01, 0x7A, 0x01, 0x7A, 0x01, 0x7B, 0x01, 0x7B, 0x01, 0x7C, 0x01, 0x7C, 0x01, 0x7D, 0x01, + 0x7D, 0x01, 0x7E, 0x01, 0x7E, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, + 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, + 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, + 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x80, 0x12, 0x80, 0x12, 0x80, 0x12, 0x80, 0x12, + 0x80, 0x12, 0x80, 0x12, 0x80, 0x12, 0x80, 0x12, 0x80, 0x12, 0x80, 0x12, 0x80, 0x12, 0x80, 0x12, + 0x80, 0x12, 0x80, 0x12, 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, + 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, + 0x51, 0x44, 0x51, 0x44, 0x51, 0x44, 0x51, 0x44, 0x51, 0x44, 0x51, 0x44, 0x51, 0x44, 0x51, 0x44, + 0x51, 0x44, 0x51, 0x44, 0x51, 0x44, 0x51, 0x44, 0x51, 0x44, 0x51, 0x44, 0x22, 0x46, 0x22, 0x46, + 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, + 0x22, 0x46, 0x23, 0x46, 0x23, 0x46, 0x23, 0x46, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, + 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, + 0x1C, 0x47, 0x1D, 0x47, 0x9A, 0x48, 0xDA, 0x48, 0x1A, 0x48, 0x5A, 0x48, 0x9A, 0x48, 0xDA, 0x48, + 0x1A, 0x48, 0x5A, 0x48, 0x9A, 0x48, 0xDA, 0x48, 0x1A, 0x48, 0x5A, 0x48, 0x9A, 0x48, 0x33, 0x48, + 0x78, 0x49, 0x78, 0x49, 0x79, 0x49, 0x79, 0x49, 0x79, 0x49, 0x79, 0x49, 0x7A, 0x49, 0x7A, 0x49, + 0x7A, 0x49, 0x7A, 0x49, 0x7B, 0x49, 0x7B, 0x49, 0x7B, 0x49, 0x7C, 0x49, 0x32, 0x00, 0x46, 0x00, + 0x5A, 0x00, 0x6E, 0x00, 0x82, 0x00, 0x96, 0x00, 0xAA, 0x00, 0xBE, 0x00, 0xD2, 0x00, 0xE6, 0x00, + 0xFA, 0x00, 0x0E, 0x01, 0x22, 0x01, 0x52, 0x01, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, + 0x04, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x02, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x15, 0x00, 0x6E, 0x6F, 0x6E, 0x2D, 0x73, 0x70, + 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x53, 0x53, 0x49, 0x44, 0x20, 0x21, 0x21, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x09, 0x00, 0x00, + 0x01, 0x00, 0x64, 0x00, 0x64, 0x00, 0x00, 0x00, 0x48, 0x45, 0x52, 0x4D, 0x45, 0x53, 0x20, 0x32, + 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x15, 0x00, 0x6E, 0x6F, 0x6E, 0x2D, 0x73, 0x70, + 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x53, 0x53, 0x49, 0x44, 0x20, 0x21, 0x21, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x09, 0x00, 0x00, + 0x01, 0x00, 0x64, 0x00, 0x64, 0x00, 0x00, 0x00, 0x48, 0x45, 0x52, 0x4D, 0x45, 0x53, 0x20, 0x32, + 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x69, 0x72, 0x73, 0x74, 0x20, + 0x57, 0x61, 0x76, 0x65, 0x4C, 0x41, 0x4E, 0x20, 0x49, 0x49, 0x20, 0x53, 0x53, 0x49, 0x44, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x02, 0x01, 0x82, 0x84, 0x8B, 0x96, 0x00, 0x00, + 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xDD, 0x00, 0x50, 0xF2, 0x01, + 0x01, 0x00, 0x00, 0x50, 0xF2, 0x05, 0x02, 0x00, 0x00, 0x50, 0xF2, 0x02, 0x00, 0x50, 0xF2, 0x04, + 0x02, 0x00, 0x00, 0x50, 0xF2, 0x00, 0x00, 0x50, 0xF2, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x04, 0x00, + 0x15, 0x00, 0x02, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x04, 0x00, 0x10, 0x00, 0x02, 0x00, + 0x01, 0x00, 0x04, 0x00, 0x15, 0x00, 0x20, 0x00, 0x11, 0x00, 0x20, 0x00, 0x1E, 0x1F, 0x8E, 0x21, + 0x00, 0x23, 0xDA, 0x22, 0x04, 0x23, 0xC0, 0x21, 0xFF, 0xFF, 0xFF, 0xFF, 0x34, 0x23, 0x00, 0x00, + 0x50, 0x21, 0x8E, 0x21, 0xFF, 0xFF, 0x00, 0x00, 0x1E, 0x1F, 0x8E, 0x21, 0x00, 0x23, 0xFF, 0xFF, + 0x04, 0x23, 0xC0, 0x21, 0xFF, 0xFF, 0xFF, 0xFF, 0x34, 0x23, 0x00, 0x00, 0x8E, 0x21, 0x3C, 0x23, + 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x00, 0x06, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, + 0x00, 0x60, 0x1D, 0x00, 0x00, 0x00, 0x0D, 0x81, 0x00, 0x60, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + +}; /* fw_image_2_data */ + +static const hcf_8 fw_image_3_data[] = { + 0x3F, 0x41, 0xA5, 0x4C, 0x50, 0x37, 0x04, 0x00, 0x01, 0xB9, 0x41, 0x5F, 0xB5, 0x60, 0x55, 0xE0, + 0x0C, 0x60, 0x10, 0x62, 0xA2, 0xD3, 0x01, 0x60, 0x01, 0x65, 0xD4, 0x80, 0x5A, 0xD1, 0x0F, 0x02, + 0x5A, 0xD3, 0x3E, 0x60, 0x00, 0x66, 0xE0, 0x87, 0x40, 0x4A, 0xEA, 0x60, 0x88, 0x61, 0x64, 0x44, + 0xC8, 0x84, 0x0C, 0x63, 0xAA, 0x46, 0x58, 0xD0, 0xAA, 0x46, 0x59, 0xD8, 0xFB, 0x1F, 0x08, 0x60, + 0x00, 0x63, 0xFA, 0x60, 0x00, 0x65, 0xBD, 0xD3, 0xA3, 0xD3, 0x02, 0xA8, 0xD4, 0x80, 0x61, 0x02, + 0x60, 0x02, 0x26, 0x60, 0x6A, 0x61, 0x3C, 0x60, 0x00, 0x66, 0x41, 0x4B, 0x2B, 0x41, 0x26, 0x60, + 0xB2, 0x7C, 0xD1, 0x80, 0xA1, 0xD2, 0x25, 0x05, 0x59, 0xD0, 0x60, 0x45, 0x59, 0xD2, 0x44, 0x47, + 0xE0, 0x87, 0x40, 0x4A, 0x59, 0xD2, 0x59, 0x8B, 0x40, 0x4C, 0x08, 0x60, 0x00, 0x63, 0xBE, 0xD3, + 0xBD, 0xD1, 0xEC, 0x18, 0xD4, 0x80, 0xEA, 0x18, 0x03, 0x03, 0xC3, 0x83, 0xC3, 0x83, 0xF7, 0x01, + 0x67, 0x44, 0xC0, 0x84, 0xE0, 0x85, 0x2C, 0x44, 0xD4, 0x80, 0x63, 0x41, 0x01, 0x06, 0x65, 0x44, + 0xC8, 0x83, 0xAA, 0x46, 0x59, 0xD1, 0x27, 0xD8, 0x5A, 0x87, 0xFC, 0x1F, 0xAA, 0x46, 0x2B, 0x41, + 0xD5, 0x01, 0x26, 0x60, 0xB2, 0x61, 0x41, 0x4B, 0x2B, 0x41, 0x26, 0x60, 0xEA, 0x7C, 0xD1, 0x80, + 0xA1, 0xD2, 0x27, 0x05, 0x59, 0xD0, 0x60, 0x45, 0x59, 0xD2, 0x44, 0x47, 0xE0, 0x87, 0x40, 0x4A, + 0x59, 0xD2, 0x59, 0x8B, 0x40, 0x4C, 0x08, 0x60, 0x00, 0x63, 0xBE, 0xD3, 0xBD, 0xD1, 0xEC, 0x18, + 0xD4, 0x80, 0xEA, 0x18, 0x03, 0x03, 0xC3, 0x83, 0xC3, 0x83, 0xF7, 0x01, 0x04, 0xA3, 0xA3, 0xD1, + 0x5A, 0x88, 0x2C, 0x43, 0xD3, 0x80, 0xFF, 0xFF, 0x01, 0x06, 0x64, 0x43, 0xCF, 0x83, 0xAA, 0x46, + 0x60, 0xFE, 0x28, 0xD1, 0x5E, 0x88, 0x27, 0xD8, 0x5A, 0x87, 0xFB, 0x1F, 0x20, 0xFE, 0xAA, 0x46, + 0xD3, 0x01, 0xB8, 0xFE, 0xB9, 0xFE, 0xBA, 0xFE, 0xBB, 0xFE, 0xBD, 0xFE, 0xBF, 0xFE, 0x21, 0x60, + 0x80, 0x62, 0xA2, 0xD3, 0x12, 0x63, 0x60, 0x40, 0x01, 0x27, 0x05, 0x00, 0x0B, 0x60, 0xEA, 0x62, + 0x00, 0x64, 0x5A, 0xDB, 0xFE, 0x1F, 0xA2, 0x60, 0x49, 0x78, 0xFF, 0xFF, 0xF1, 0xFF, 0x94, 0x48, + 0x1F, 0x00, 0x04, 0x00, 0xF2, 0xFF, 0x98, 0x48, 0x1F, 0x00, 0x04, 0x00, 0xFB, 0xFF, 0xA0, 0x48, + 0x1F, 0x00, 0x04, 0x00, 0xF1, 0xFF, 0xF2, 0x4D, 0x1F, 0x00, 0x04, 0x00, 0xF2, 0xFF, 0xF6, 0x4D, + 0x1F, 0x00, 0x04, 0x00, 0xFB, 0xFF, 0xFE, 0x4D, 0x1F, 0x00, 0x04, 0x00, 0x86, 0xFD, 0xB6, 0x1F, + 0x00, 0x00, 0x06, 0x00, 0x10, 0xFD, 0x34, 0x01, 0x00, 0x00, 0x02, 0x00, 0x14, 0xFD, 0x7E, 0x21, + 0x00, 0x00, 0x0A, 0x00, 0x20, 0xFA, 0xFA, 0x1D, 0x00, 0x00, 0x0E, 0x00, 0x21, 0xFA, 0xDE, 0x1D, + 0x00, 0x00, 0x0E, 0x00, 0x22, 0xFA, 0x16, 0x1E, 0x00, 0x00, 0x0E, 0x00, 0x23, 0xFA, 0xCA, 0x1C, + 0x00, 0x00, 0x01, 0x00, 0x24, 0xFA, 0xBE, 0x1E, 0x00, 0x00, 0x0E, 0x00, 0x25, 0xFA, 0xDE, 0x1C, + 0x00, 0x00, 0x80, 0x00, 0x26, 0xFA, 0xC4, 0x1C, 0x00, 0x00, 0x01, 0x00, + +}; /* fw_image_3_data */ + +static const hcf_8 fw_image_4_data[] = { + 0xA6, 0x60, 0x25, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA6, 0x60, 0x0B, 0x78, 0x41, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA6, 0x60, 0x11, 0x78, 0xC4, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA5, 0x60, 0x61, 0x78, 0x43, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x44, 0xFF, 0x20, 0x54, 0xCD, 0xE2, 0xA6, 0x60, 0x23, 0x78, 0x08, 0xE1, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA6, 0x60, 0x25, 0x78, 0x44, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA6, 0x60, 0x25, 0x78, 0x46, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA6, 0x60, 0x25, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xAC, 0x60, 0x81, 0x78, 0x4C, 0x4E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xAC, 0x60, 0x18, 0x78, 0x4C, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC4, 0xE2, 0x84, 0xFF, 0x22, 0x58, 0x82, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA7, 0x60, 0xC4, 0x78, 0x43, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xE4, 0xE2, 0xAC, 0x60, 0x31, 0x78, 0x95, 0xF3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xBF, 0x60, 0x76, 0x78, 0x64, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xAC, 0x60, 0x8C, 0x78, 0xA4, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xAC, 0x60, 0x72, 0x78, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB2, 0x60, 0xD1, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB2, 0x60, 0xFE, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB1, 0x60, 0x90, 0x78, 0x42, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB1, 0x60, 0xC0, 0x78, 0x43, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB1, 0x60, 0xC0, 0x78, 0x44, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB4, 0x60, 0x73, 0x78, 0x45, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB1, 0x60, 0xC3, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x60, 0x83, 0x64, 0x80, 0x29, 0x09, 0xFB, 0xB2, 0x60, 0x99, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC0, 0x60, 0x29, 0x78, 0x40, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xBF, 0x60, 0xB4, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xBE, 0x60, 0x78, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xBD, 0x60, 0xE8, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB5, 0x60, 0x96, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA1, 0xFF, 0xFF, 0xFF, 0x83, 0x3E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC0, 0x60, 0x9F, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0x41, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0x42, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0xB0, 0xFF, 0xB1, 0xFF, 0x40, 0xFF, 0x43, 0xFF, 0xC0, 0x60, 0x9A, 0x78, 0x44, 0xFF, 0xFF, 0x01, + 0xC0, 0x60, 0x9F, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0xC6, 0x60, 0x66, 0x78, 0x45, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0xC0, 0x60, 0x9A, 0x78, 0x84, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0xC0, 0x60, 0x99, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0xC7, 0x60, 0x26, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xE5, 0x60, 0x0E, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC7, 0x60, 0x2E, 0x78, 0x42, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC7, 0x60, 0x2E, 0x78, 0x24, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xE3, 0x60, 0x45, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC7, 0x60, 0x2E, 0x78, 0x44, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC7, 0x60, 0x2E, 0x78, 0x84, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC7, 0x60, 0x2E, 0x78, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xEB, 0x60, 0x5B, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xEB, 0x60, 0x87, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xEB, 0x60, 0xA0, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xEB, 0x60, 0x84, 0x78, 0x28, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xEB, 0x60, 0x84, 0x78, 0x44, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xEB, 0x60, 0x84, 0x78, 0x45, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xEB, 0x60, 0x84, 0x78, 0x46, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x60, 0x87, 0x64, 0x80, 0x29, 0x09, 0xFB, 0x47, 0xFF, 0xEB, 0x60, 0x84, 0x78, 0xFF, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x87, 0xF3, 0x88, 0xF3, 0xDC, 0x81, 0x00, 0x7C, 0x01, 0x00, 0x00, 0xFA, 0x60, 0x46, 0xFE, 0x63, + 0xA3, 0xD8, 0xFE, 0x1F, 0xCD, 0x81, 0xD8, 0x84, 0xF8, 0x02, 0x87, 0xF3, 0x88, 0xF5, 0xDC, 0x81, + 0x80, 0x67, 0x40, 0x4A, 0x14, 0x60, 0x02, 0x65, 0x01, 0x7C, 0x07, 0x18, 0x2A, 0x43, 0x02, 0xFC, + 0x5F, 0x8A, 0x8E, 0xF8, 0x70, 0xF8, 0x00, 0xF4, 0xF8, 0x01, 0x2E, 0x58, 0xFF, 0xFF, 0x89, 0xF5, + 0x06, 0x64, 0x66, 0x43, 0x00, 0x7C, 0x63, 0x46, 0xFE, 0x63, 0xA3, 0xD8, 0xFE, 0x1F, 0xCC, 0x84, + 0x66, 0x43, 0xDB, 0x83, 0xF8, 0x02, 0x14, 0x60, 0x02, 0x65, 0x09, 0x60, 0x2B, 0x7C, 0x89, 0xF3, + 0x06, 0x61, 0x60, 0x46, 0x01, 0x63, 0x72, 0xF8, 0x00, 0xFC, 0x63, 0x47, 0x06, 0xFA, 0x72, 0xF8, + 0x8E, 0xF8, 0xDF, 0x83, 0x66, 0x44, 0xCD, 0x81, 0x02, 0xA6, 0xF5, 0x02, 0x89, 0xF3, 0x06, 0x61, + 0x60, 0x46, 0x03, 0x7C, 0x73, 0xF8, 0x66, 0x44, 0xCD, 0x81, 0x02, 0xA6, 0xFB, 0x02, 0x2E, 0x58, + 0xFF, 0xFF, 0x3F, 0x40, 0x40, 0x26, 0x0A, 0x00, 0x42, 0x60, 0x09, 0xE0, 0x3F, 0x40, 0x01, 0x2A, + 0x03, 0x00, 0x60, 0x60, 0x1C, 0xE0, 0x02, 0x00, 0x80, 0x60, 0x1C, 0xE0, 0x40, 0xEC, 0x00, 0xED, + 0x02, 0xEE, 0x80, 0x60, 0x58, 0xEC, 0x80, 0x60, 0x00, 0xED, 0x80, 0x60, 0x82, 0xEE, 0xC0, 0x60, + 0x59, 0xEC, 0xC0, 0x60, 0x07, 0xED, 0xAD, 0x4F, 0xFE, 0xB4, 0xA0, 0x5D, 0x00, 0xF3, 0x28, 0xFB, + 0x40, 0x44, 0xA4, 0x60, 0x5D, 0x7C, 0x20, 0xF9, 0xA5, 0x60, 0x48, 0x7C, 0x21, 0xF9, 0xA7, 0x60, + 0x30, 0x7C, 0x22, 0xF9, 0xB0, 0x60, 0xCD, 0x7C, 0x23, 0xF9, 0xB5, 0x60, 0x6C, 0x7C, 0x24, 0xF9, + 0xC0, 0x60, 0x88, 0x7C, 0x25, 0xF9, 0xC6, 0x60, 0xE0, 0x7C, 0x26, 0xF9, 0x91, 0x60, 0x00, 0xE8, + 0x28, 0xE8, 0x44, 0x60, 0x02, 0xE6, 0x00, 0x64, 0x40, 0x52, 0x10, 0x60, 0x04, 0xE6, 0x08, 0x60, + 0x00, 0x63, 0xFA, 0x60, 0x00, 0x65, 0xBD, 0xD3, 0xBD, 0xD3, 0x02, 0xA8, 0xD4, 0x80, 0x47, 0x02, + 0x46, 0x02, 0xDB, 0x83, 0xFA, 0x60, 0x27, 0x65, 0x5B, 0xD3, 0xBF, 0xD1, 0x1A, 0x18, 0xC3, 0x83, + 0xD4, 0x80, 0xC3, 0x83, 0xF9, 0x02, 0xDB, 0x83, 0xD3, 0x83, 0xD3, 0x86, 0x64, 0x41, 0xCD, 0x81, + 0xA6, 0xD1, 0xDA, 0x86, 0x1C, 0x60, 0x68, 0x65, 0x00, 0x60, 0x72, 0x63, 0xA5, 0xD3, 0xDA, 0x85, + 0x90, 0x84, 0xFF, 0x27, 0x02, 0x00, 0xA2, 0xD9, 0x01, 0x00, 0xF8, 0x1F, 0xCD, 0x81, 0xFF, 0xFF, + 0xEF, 0x02, 0x08, 0x60, 0x06, 0x63, 0xFA, 0x60, 0x28, 0x65, 0x5B, 0xD3, 0xBF, 0xD1, 0x0B, 0x18, + 0xC3, 0x83, 0xD4, 0x80, 0xC3, 0x83, 0xF9, 0x02, 0xBF, 0xD3, 0x21, 0x60, 0x72, 0x62, 0x0E, 0xB4, + 0xE0, 0x84, 0xE0, 0x84, 0xA2, 0xDB, 0x08, 0x60, 0x06, 0x63, 0xFD, 0x60, 0x0C, 0x65, 0x5B, 0xD3, + 0xBF, 0xD1, 0x0D, 0x18, 0xC3, 0x83, 0xD4, 0x80, 0xC3, 0x83, 0xF9, 0x02, 0xFA, 0xA3, 0xA3, 0xD3, + 0x02, 0x60, 0x00, 0x65, 0xF7, 0xA0, 0xFC, 0xA0, 0x0A, 0x05, 0x01, 0x05, 0x00, 0x00, 0x21, 0x60, + 0x00, 0x65, 0x3F, 0x43, 0x3F, 0x43, 0x21, 0x60, 0x00, 0x65, 0xC0, 0x60, 0x8F, 0xEE, 0xB7, 0x84, + 0x40, 0x5F, 0x00, 0x60, 0x30, 0xE2, 0x00, 0x60, 0x50, 0xE2, 0x00, 0x60, 0x79, 0xE2, 0x00, 0x60, + 0x90, 0xE2, 0x01, 0x60, 0xD0, 0xE2, 0x01, 0x60, 0xF0, 0xE2, 0x01, 0x60, 0xB0, 0xE2, 0x26, 0x64, + 0x35, 0xFB, 0x01, 0x60, 0x30, 0x64, 0x0A, 0xA4, 0x38, 0xFB, 0x60, 0x45, 0x00, 0x60, 0xF8, 0x64, + 0x0A, 0xA4, 0x39, 0xFB, 0x35, 0xF1, 0x0A, 0x64, 0xC4, 0x84, 0x36, 0xFB, 0xC0, 0x84, 0x0A, 0xA4, + 0x37, 0xFB, 0x09, 0x60, 0x2A, 0x64, 0x99, 0xFB, 0x82, 0xFF, 0x92, 0xFF, 0x5C, 0x41, 0x5C, 0x46, + 0x5C, 0x47, 0x00, 0xE1, 0xA7, 0x60, 0x9B, 0x63, 0x0C, 0x60, 0x16, 0x64, 0xA0, 0xDD, 0x87, 0xFF, + 0x97, 0xFF, 0x0C, 0x60, 0x02, 0x64, 0x40, 0x5A, 0x06, 0xA4, 0x40, 0x5B, 0x5C, 0x5E, 0x5C, 0x51, + 0x1F, 0x60, 0xAA, 0x62, 0xA2, 0xD3, 0x65, 0xFB, 0x21, 0x60, 0xEC, 0x61, 0x27, 0x7C, 0xA1, 0xD9, + 0x25, 0x60, 0x2E, 0x63, 0x7F, 0xA3, 0xE3, 0x87, 0x00, 0x7F, 0x8A, 0xFB, 0x02, 0x60, 0x80, 0x66, + 0x22, 0x60, 0x22, 0x64, 0x77, 0x60, 0x77, 0x63, 0x00, 0xFA, 0x01, 0xFC, 0x00, 0xF0, 0x01, 0xF0, + 0xD0, 0x80, 0xD3, 0x80, 0x1E, 0x02, 0x1D, 0x02, 0x06, 0x60, 0x80, 0x65, 0x45, 0x4A, 0xAA, 0x46, + 0x00, 0xFC, 0x01, 0xFA, 0xAA, 0x46, 0x00, 0xF0, 0x2A, 0x41, 0x50, 0x65, 0xD3, 0x80, 0xCD, 0x84, + 0x13, 0x03, 0x0A, 0x60, 0x80, 0x65, 0x45, 0x4A, 0xAA, 0x46, 0x00, 0xFC, 0x01, 0xFA, 0xAA, 0x46, + 0x00, 0xF0, 0x65, 0x41, 0xC8, 0x65, 0xD3, 0x80, 0xCD, 0x84, 0x06, 0x03, 0x12, 0x60, 0x7F, 0x64, + 0x03, 0x00, 0x10, 0x65, 0x02, 0x60, 0x7F, 0x64, 0x65, 0x43, 0x87, 0xFD, 0x1B, 0x60, 0x72, 0x62, + 0xA2, 0xDD, 0x07, 0x61, 0xC5, 0x81, 0xE1, 0x85, 0xD4, 0x84, 0x8B, 0xFB, 0xDC, 0x84, 0x89, 0xFB, + 0x0C, 0xA4, 0x88, 0xFB, 0x1B, 0x60, 0x74, 0x62, 0xA2, 0xDB, 0xA2, 0x60, 0x58, 0x4E, 0x1F, 0x78, + 0xFF, 0xFF, 0xA2, 0x60, 0x58, 0x4E, 0x00, 0x78, 0xFF, 0xFF, 0x8B, 0xF1, 0x8A, 0xF3, 0x7C, 0x63, + 0x8D, 0xFB, 0x60, 0x46, 0x01, 0xFC, 0xDC, 0x84, 0xD0, 0x80, 0x00, 0xFA, 0xFA, 0x04, 0x8E, 0xFB, + 0x60, 0x46, 0x00, 0x64, 0x00, 0xFA, 0x63, 0x44, 0x80, 0x7F, 0x01, 0xFA, 0x8B, 0xF3, 0x8A, 0xF1, + 0xDC, 0x84, 0xD0, 0x84, 0x8C, 0xFB, 0x03, 0x60, 0x26, 0x61, 0xB3, 0x60, 0x58, 0x4D, 0x64, 0x78, + 0xFF, 0xFF, 0x66, 0x44, 0x2E, 0xFB, 0x82, 0xFF, 0x40, 0x42, 0x87, 0xFF, 0x8C, 0xF3, 0x94, 0xFB, + 0x00, 0x64, 0x12, 0x60, 0xC8, 0x63, 0xA3, 0xDB, 0x00, 0x64, 0x40, 0x50, 0x63, 0xFF, 0x66, 0xFF, + 0x65, 0xFF, 0x64, 0xFF, 0x61, 0xFF, 0x62, 0xFF, 0x49, 0x60, 0x02, 0xE1, 0x52, 0x60, 0x02, 0xE1, + 0x5B, 0x60, 0x02, 0xE1, 0x65, 0x60, 0x02, 0xE1, 0x6C, 0x60, 0x02, 0xE1, 0x76, 0x60, 0x02, 0xE1, + 0x41, 0x60, 0x02, 0xE1, 0x04, 0x65, 0x21, 0x60, 0x7E, 0x64, 0x44, 0xD3, 0xEA, 0x60, 0x58, 0x4E, + 0x78, 0x78, 0xFF, 0xFF, 0x1C, 0x60, 0x04, 0x65, 0x0C, 0x64, 0xA5, 0xDB, 0xA3, 0x60, 0xED, 0x64, + 0x80, 0xFB, 0x2D, 0xFF, 0x0A, 0x61, 0x41, 0x4B, 0x09, 0x60, 0x08, 0x61, 0xB3, 0x60, 0x58, 0x4D, + 0x64, 0x78, 0xFF, 0xFF, 0xF0, 0x67, 0x0E, 0xFA, 0x1B, 0x60, 0xE0, 0x62, 0x1B, 0x60, 0xC4, 0x64, + 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x2B, 0x41, + 0x4D, 0x8B, 0xFF, 0xFF, 0xE9, 0x02, 0x0A, 0x61, 0x41, 0x4B, 0x09, 0x60, 0x08, 0x61, 0xB3, 0x60, + 0x58, 0x4D, 0x64, 0x78, 0xFF, 0xFF, 0x1B, 0x60, 0xE0, 0x62, 0x1B, 0x60, 0xB8, 0x64, 0xA2, 0xDB, + 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x2B, 0x41, 0x4D, 0x8B, + 0xFF, 0xFF, 0xEB, 0x02, 0xEB, 0x60, 0x4E, 0x78, 0xFF, 0xFF, 0x00, 0xEA, 0x00, 0xEB, 0x50, 0x60, + 0x03, 0xEA, 0x51, 0x60, 0x13, 0xEA, 0x52, 0x60, 0x30, 0xEA, 0x53, 0x60, 0x40, 0xEA, 0x54, 0x60, + 0x52, 0xEA, 0x55, 0x60, 0x6D, 0xEA, 0x56, 0x60, 0x71, 0xEA, 0x57, 0x60, 0x8B, 0xEA, 0x58, 0x60, + 0x47, 0xEA, 0x59, 0x60, 0xA0, 0xEA, 0x5A, 0x60, 0xB2, 0xEA, 0x5B, 0x60, 0xC1, 0xEA, 0x5C, 0x60, + 0xD7, 0xEA, 0x5D, 0x60, 0xEB, 0xEA, 0x5E, 0x60, 0xA0, 0xEA, 0x50, 0x60, 0x36, 0xEB, 0x51, 0x60, + 0x37, 0xEB, 0x52, 0x60, 0x20, 0xEB, 0x53, 0x60, 0xE4, 0xEB, 0x54, 0x60, 0x34, 0xEB, 0x55, 0x60, + 0x58, 0xEB, 0x56, 0x60, 0x48, 0xEB, 0x57, 0x60, 0xD0, 0xEB, 0x58, 0x60, 0xC3, 0xEB, 0x59, 0x60, + 0xFC, 0xEB, 0x5A, 0x60, 0x34, 0xEB, 0x5B, 0x60, 0x58, 0xEB, 0x5C, 0x60, 0xC0, 0xEB, 0x5D, 0x60, + 0xD0, 0xEB, 0x5E, 0x60, 0x91, 0xEB, 0x00, 0xEA, 0x00, 0xEB, 0xE0, 0x60, 0x02, 0xEA, 0xE0, 0x60, + 0x03, 0xEB, 0xA0, 0x60, 0x00, 0xEB, 0xB0, 0x60, 0x00, 0xEB, 0xAB, 0x48, 0x40, 0x3B, 0x01, 0x00, + 0xFC, 0x01, 0x00, 0xEB, 0x03, 0x60, 0x02, 0x62, 0x62, 0x44, 0xA2, 0xDB, 0x0F, 0x64, 0x60, 0x7F, + 0xA0, 0x5A, 0x80, 0x60, 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, 0xD1, 0x60, 0x00, 0xEA, 0x3F, 0x40, + 0x40, 0x26, 0x08, 0x00, 0x00, 0x60, 0x18, 0x64, 0x00, 0x60, 0x00, 0x65, 0x94, 0x84, 0xA0, 0x50, + 0x1D, 0x60, 0x19, 0xE2, 0x24, 0x44, 0xFF, 0xB4, 0x04, 0xFB, 0x50, 0x60, 0x00, 0x64, 0x05, 0xFB, + 0x10, 0x60, 0x10, 0x75, 0xEB, 0x60, 0x84, 0x78, 0xFF, 0xFF, 0x80, 0xFF, 0x90, 0xFF, 0x98, 0xFF, + 0x23, 0x60, 0x5C, 0x63, 0x20, 0x44, 0xBD, 0xDB, 0x21, 0x44, 0xBD, 0xDB, 0x22, 0x44, 0xBD, 0xDB, + 0x23, 0x44, 0xBD, 0xDB, 0x24, 0x44, 0xBD, 0xDB, 0x25, 0x44, 0xBD, 0xDB, 0x26, 0x44, 0xBD, 0xDB, + 0x27, 0x44, 0xBD, 0xDB, 0x28, 0x44, 0xBD, 0xDB, 0x29, 0x44, 0xBD, 0xDB, 0x2A, 0x44, 0xBD, 0xDB, + 0x2B, 0x44, 0xBD, 0xDB, 0x2C, 0x44, 0xBD, 0xDB, 0x2D, 0x44, 0xBD, 0xDB, 0x2E, 0x44, 0xBD, 0xDB, + 0x2F, 0x44, 0xBD, 0xDB, 0x23, 0x60, 0x50, 0x64, 0xA0, 0xDD, 0x24, 0x60, 0x7C, 0x63, 0x23, 0x60, + 0x52, 0x64, 0xA0, 0xDD, 0x23, 0x60, 0x54, 0x63, 0x30, 0x44, 0xA3, 0xDB, 0x23, 0x60, 0x56, 0x63, + 0x31, 0x44, 0xA3, 0xDB, 0x23, 0x60, 0x58, 0x63, 0x32, 0x44, 0xA3, 0xDB, 0x23, 0x60, 0x5A, 0x63, + 0x33, 0x44, 0xA3, 0xDB, 0x81, 0xFF, 0x91, 0xFF, 0x58, 0x51, 0x48, 0x00, 0x82, 0xFF, 0x92, 0xFF, + 0x58, 0x51, 0x44, 0x00, 0x83, 0xFF, 0x93, 0xFF, 0x58, 0x51, 0x40, 0x00, 0x84, 0xFF, 0x94, 0xFF, + 0x58, 0x51, 0x3C, 0x00, 0x85, 0xFF, 0x95, 0xFF, 0x58, 0x51, 0x38, 0x00, 0x86, 0xFF, 0x96, 0xFF, + 0x58, 0x51, 0x34, 0x00, 0x87, 0xFF, 0x97, 0xFF, 0x58, 0x51, 0x30, 0x00, 0x80, 0xFF, 0x90, 0xFF, + 0x99, 0xFF, 0x23, 0x60, 0x50, 0x64, 0xA0, 0xD1, 0x30, 0x44, 0x64, 0x43, 0xBD, 0xDB, 0x31, 0x44, + 0xBD, 0xDB, 0x32, 0x44, 0xBD, 0xDB, 0x33, 0x44, 0xBD, 0xDB, 0x34, 0x44, 0xBD, 0xDB, 0x35, 0x44, + 0xBD, 0xDB, 0x36, 0x44, 0xBD, 0xDB, 0x37, 0x44, 0xBD, 0xDB, 0x38, 0x44, 0xBD, 0xDB, 0x39, 0x44, + 0xBD, 0xDB, 0x3A, 0x44, 0xBD, 0xDB, 0x3B, 0x44, 0xBD, 0xDB, 0x3C, 0x44, 0xBD, 0xDB, 0x3D, 0x44, + 0xBD, 0xDB, 0x3E, 0x44, 0xBD, 0xDB, 0x3F, 0x44, 0xBD, 0xDB, 0xE3, 0x60, 0x50, 0x64, 0x0A, 0xFB, + 0x40, 0x21, 0xFE, 0x01, 0xA1, 0xFF, 0xFF, 0xFF, 0x78, 0x01, 0xFF, 0xFF, 0x42, 0x50, 0x40, 0x53, + 0x23, 0x60, 0x52, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x40, 0x52, 0x33, 0x44, 0x32, 0x42, 0xA2, 0xDB, + 0xDA, 0x82, 0xA2, 0xDD, 0xDA, 0x83, 0x65, 0x44, 0xBD, 0xDB, 0x61, 0x44, 0xBD, 0xDB, 0x66, 0x44, + 0xBD, 0xDB, 0xBD, 0xD9, 0x30, 0x44, 0xBD, 0xDB, 0x99, 0xFF, 0xA4, 0x4C, 0xBD, 0xDB, 0xA5, 0x4C, + 0xBD, 0xDB, 0xA0, 0x4C, 0xBD, 0xDB, 0xA1, 0x4C, 0xBD, 0xDB, 0x98, 0xFF, 0x23, 0x60, 0x52, 0x64, + 0xA0, 0xDD, 0x23, 0x60, 0x54, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x40, 0x50, 0x23, 0x60, 0x58, 0x62, + 0xA2, 0xD3, 0xFF, 0xFF, 0x40, 0x52, 0x23, 0x60, 0x5A, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x40, 0x53, + 0x31, 0x41, 0x23, 0x60, 0x56, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x40, 0x51, 0x23, 0x60, 0x50, 0x62, + 0xA2, 0xD3, 0xFF, 0xFF, 0x60, 0x43, 0x20, 0x44, 0xBD, 0xDB, 0x21, 0x44, 0xBD, 0xDB, 0x22, 0x44, + 0xBD, 0xDB, 0x23, 0x44, 0xBD, 0xDB, 0x24, 0x44, 0xBD, 0xDB, 0x25, 0x44, 0xBD, 0xDB, 0x26, 0x44, + 0xBD, 0xDB, 0x27, 0x44, 0xBD, 0xDB, 0x28, 0x44, 0xBD, 0xDB, 0x29, 0x44, 0xBD, 0xDB, 0x2A, 0x44, + 0xBD, 0xDB, 0x2B, 0x44, 0xBD, 0xDB, 0x2C, 0x44, 0xBD, 0xDB, 0x2D, 0x44, 0xBD, 0xDB, 0x2E, 0x44, + 0xBD, 0xDB, 0x2F, 0x44, 0xBD, 0xDB, 0x23, 0x60, 0x50, 0x64, 0xA0, 0xDD, 0x61, 0x58, 0xFF, 0xFF, + 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, 0x07, 0x02, 0x62, 0xFF, 0x63, 0xFF, 0x64, 0xFF, 0x65, 0xFF, + 0x66, 0xFF, 0xBF, 0xFE, 0xA1, 0xFF, 0x82, 0xFF, 0x88, 0xFF, 0x6C, 0x40, 0x41, 0xFF, 0xC4, 0xE2, + 0x43, 0xFF, 0x5C, 0x49, 0x08, 0xE1, 0xA5, 0x60, 0x5E, 0x78, 0xFF, 0xFF, 0xA1, 0xFF, 0x98, 0xFF, + 0x80, 0x3E, 0x9F, 0xFE, 0x03, 0x04, 0xA6, 0x60, 0x28, 0x78, 0xFF, 0xFF, 0xE2, 0xFE, 0x40, 0x05, + 0xE0, 0xFE, 0x5B, 0x05, 0xE1, 0xFE, 0xF2, 0x04, 0x29, 0x40, 0x08, 0x26, 0xEF, 0x01, 0x72, 0x44, + 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0x95, 0xF3, 0xE8, 0x85, 0xFF, 0xB7, + 0xE0, 0x84, 0xE0, 0x84, 0xB4, 0x85, 0x73, 0x44, 0xD4, 0x84, 0x10, 0x65, 0xD4, 0x80, 0xFF, 0xFF, + 0x26, 0x04, 0x3F, 0x40, 0x40, 0x26, 0x13, 0x00, 0x0B, 0x60, 0xF8, 0x62, 0xA2, 0xD1, 0x00, 0x60, + 0x10, 0x64, 0x90, 0x84, 0xA0, 0x50, 0xF8, 0xA2, 0xA2, 0xD1, 0x0A, 0x60, 0x19, 0x64, 0x90, 0x84, + 0xA0, 0x52, 0x06, 0xA2, 0xA2, 0xD1, 0x46, 0x60, 0x09, 0x64, 0x90, 0x84, 0xA0, 0x50, 0xD2, 0xF4, + 0x25, 0x60, 0x16, 0x7C, 0x63, 0x40, 0x01, 0x26, 0x08, 0x00, 0xA4, 0xD3, 0xFF, 0xFF, 0x01, 0xB4, + 0xFF, 0xFF, 0x03, 0x02, 0xAD, 0x4F, 0xFE, 0xB4, 0xA0, 0x5D, 0x02, 0xEE, 0xBD, 0xFE, 0xBE, 0x01, + 0x21, 0x46, 0x5E, 0x62, 0x9A, 0xFF, 0x07, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x06, 0x25, 0x10, 0x00, + 0xA2, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0x62, 0x62, 0x01, 0x5D, 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, + 0x7A, 0xDC, 0x44, 0xFF, 0x06, 0x25, 0x04, 0x00, 0x0E, 0xE1, 0x02, 0x60, 0x01, 0xE1, 0x9E, 0x01, + 0x62, 0xFF, 0xC4, 0xE2, 0x41, 0xFF, 0x0A, 0xE1, 0x99, 0x01, 0xC8, 0x74, 0xCD, 0xE2, 0x29, 0x44, + 0x08, 0xBC, 0x40, 0x49, 0x05, 0xE1, 0x25, 0x60, 0x18, 0x63, 0xA3, 0xD3, 0xD2, 0xF3, 0x06, 0x18, + 0x28, 0x40, 0x08, 0x2A, 0x05, 0x00, 0x28, 0x40, 0x48, 0x36, 0x02, 0x00, 0x02, 0xBC, 0xD2, 0xFB, + 0x3F, 0x40, 0x01, 0x2B, 0xFF, 0xFF, 0xA1, 0xFF, 0x67, 0x4C, 0x06, 0x61, 0xCD, 0x81, 0x04, 0x25, + 0x30, 0x00, 0x87, 0x4C, 0xFB, 0x02, 0x28, 0x40, 0x40, 0x2B, 0x02, 0x00, 0x15, 0x60, 0x6F, 0x6B, + 0xF3, 0x60, 0xA0, 0x64, 0x04, 0x25, 0x25, 0x00, 0x80, 0x4C, 0x30, 0x64, 0x3A, 0xDB, 0x44, 0xFF, + 0x04, 0x25, 0x1F, 0x00, 0x04, 0x60, 0x00, 0x65, 0x25, 0x44, 0x37, 0x36, 0xB4, 0x84, 0x6E, 0x36, + 0xB4, 0x84, 0x80, 0x4E, 0x24, 0x41, 0x04, 0x25, 0x14, 0x00, 0x61, 0x4C, 0x64, 0xA1, 0x61, 0x54, + 0xA1, 0xFF, 0xFF, 0xFF, 0x04, 0x25, 0x0D, 0x00, 0x67, 0x4E, 0x07, 0x64, 0x1C, 0xFB, 0x00, 0xE1, + 0x02, 0x60, 0x01, 0xE1, 0x53, 0x01, 0x33, 0xF3, 0xFD, 0x11, 0xFC, 0x18, 0x40, 0x64, 0x3A, 0xDB, + 0x0A, 0x00, 0xC4, 0xE2, 0x27, 0x44, 0x20, 0x2A, 0x04, 0x00, 0x42, 0x64, 0x3A, 0xDB, 0x67, 0x4C, + 0x02, 0x00, 0x41, 0x64, 0x3A, 0xDB, 0x62, 0xFF, 0x08, 0xE1, 0xE2, 0xFE, 0x72, 0x52, 0x5C, 0x49, + 0x32, 0x7B, 0x4D, 0xE2, 0x3B, 0x01, 0x08, 0xE1, 0x39, 0x01, 0xA1, 0xFF, 0x98, 0xFF, 0x80, 0x3E, + 0x00, 0x60, 0x46, 0x74, 0xCD, 0xE2, 0x04, 0xE1, 0x02, 0x60, 0x00, 0xE1, 0x3F, 0x44, 0x40, 0x26, + 0x0B, 0x00, 0x01, 0x2A, 0x05, 0x00, 0x42, 0x60, 0x09, 0xE0, 0x60, 0x60, 0x1C, 0xE0, 0x04, 0x00, + 0x42, 0x60, 0x09, 0xE0, 0x80, 0x60, 0x1C, 0xE0, 0x04, 0x29, 0xFE, 0x01, 0xC4, 0xE2, 0x43, 0x64, + 0x3A, 0xDB, 0x83, 0xF3, 0xFF, 0xFF, 0x60, 0x41, 0x3F, 0x44, 0x02, 0x27, 0x84, 0x00, 0x20, 0x2B, + 0xFF, 0x01, 0x80, 0xE1, 0x95, 0x60, 0x80, 0xE7, 0x61, 0x40, 0x40, 0x2B, 0x0D, 0x00, 0x05, 0x63, + 0xA7, 0x60, 0x58, 0x4F, 0x1D, 0x78, 0xFF, 0xFF, 0x28, 0x63, 0xFF, 0xFF, 0xFE, 0x1F, 0x01, 0x63, + 0xA7, 0x60, 0x58, 0x4F, 0x1D, 0x78, 0xFF, 0xFF, 0xFF, 0xB1, 0xCD, 0x81, 0xE1, 0x85, 0x1E, 0x60, + 0xA2, 0x64, 0x44, 0xD1, 0xFF, 0xFF, 0x64, 0x43, 0xA7, 0x60, 0x58, 0x4F, 0x1D, 0x78, 0xFF, 0xFF, + 0x00, 0x60, 0x00, 0x63, 0xA7, 0x60, 0x58, 0x4F, 0x1D, 0x78, 0xFF, 0xFF, 0x1E, 0x60, 0xBE, 0x61, + 0x21, 0x60, 0x72, 0x62, 0xA2, 0xD3, 0x45, 0xD1, 0x47, 0xBC, 0xE0, 0x84, 0x62, 0x45, 0x64, 0x5F, + 0xE8, 0x83, 0xA7, 0x60, 0x58, 0x4F, 0x1D, 0x78, 0xFF, 0xFF, 0x82, 0xF3, 0xCD, 0xE2, 0x60, 0x54, + 0x04, 0xE1, 0x04, 0x29, 0xFE, 0x01, 0xC4, 0xE2, 0x15, 0x60, 0xA2, 0xE7, 0x38, 0x69, 0xFF, 0xFF, + 0x68, 0x44, 0x01, 0x16, 0xFD, 0x01, 0x01, 0x2A, 0x36, 0x00, 0x03, 0x60, 0x80, 0x7C, 0xA3, 0x83, + 0x21, 0x60, 0x72, 0x62, 0xA2, 0xD1, 0x43, 0xBB, 0xB3, 0x83, 0x95, 0x60, 0x80, 0xE7, 0xA7, 0x60, + 0x58, 0x4F, 0x1D, 0x78, 0xFF, 0xFF, 0xE3, 0x83, 0x15, 0x60, 0xA2, 0xE7, 0x38, 0x69, 0xFF, 0xFF, + 0x68, 0x41, 0x01, 0x16, 0xFD, 0x01, 0x63, 0x47, 0x61, 0x40, 0x01, 0x2A, 0x03, 0x00, 0x00, 0x3A, + 0xCC, 0x84, 0x02, 0x00, 0x07, 0x3A, 0xDC, 0x84, 0xFF, 0xB4, 0xA5, 0xDB, 0x60, 0x47, 0xE8, 0x84, + 0x47, 0x65, 0x21, 0x60, 0x72, 0x62, 0xA2, 0xD3, 0xB4, 0x85, 0xB4, 0x83, 0x80, 0xE1, 0x95, 0x60, + 0x80, 0xE7, 0xA7, 0x60, 0x58, 0x4F, 0x1D, 0x78, 0xFF, 0xFF, 0x82, 0xF3, 0xCD, 0xE2, 0x60, 0x54, + 0x04, 0x29, 0xFE, 0x01, 0xC4, 0xE2, 0x83, 0xF3, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x2B, 0x04, 0x00, + 0xA6, 0x60, 0xF6, 0x78, 0xFF, 0xFF, 0xFF, 0x01, 0x83, 0xF3, 0x80, 0xE1, 0xCC, 0x84, 0xE0, 0x85, + 0x15, 0x60, 0xA2, 0xE7, 0x1D, 0x60, 0xDE, 0x64, 0x58, 0x4F, 0x4F, 0x00, 0x1D, 0x60, 0xFA, 0x64, + 0x58, 0x4F, 0x4B, 0x00, 0x1E, 0x60, 0x16, 0x64, 0x58, 0x4F, 0x47, 0x00, 0x1E, 0x60, 0x32, 0x64, + 0x58, 0x4F, 0x43, 0x00, 0x1E, 0x60, 0x4E, 0x64, 0x58, 0x4F, 0x3F, 0x00, 0x1E, 0x60, 0x6A, 0x64, + 0x58, 0x4F, 0x3B, 0x00, 0x1E, 0x60, 0x86, 0x64, 0x58, 0x4F, 0x37, 0x00, 0x01, 0x68, 0xFF, 0x6A, + 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x3F, 0x44, 0x20, 0x27, 0x00, 0x00, 0x3F, 0x40, 0x40, 0x26, + 0x08, 0x00, 0x00, 0x60, 0x18, 0x64, 0x00, 0x60, 0x00, 0x65, 0x94, 0x84, 0xA0, 0x50, 0x1D, 0x60, + 0x19, 0xE2, 0xC4, 0xE2, 0x00, 0x63, 0x82, 0xFD, 0x32, 0x7B, 0x4D, 0xE2, 0xBF, 0xFE, 0xC4, 0xE2, + 0x41, 0xFF, 0xE0, 0xFE, 0xE1, 0xFE, 0xE2, 0xFE, 0x43, 0xFF, 0x44, 0xFF, 0x46, 0xFF, 0x84, 0xF3, + 0x62, 0xFF, 0x60, 0x40, 0x05, 0x36, 0x2D, 0xFF, 0x07, 0x36, 0xD5, 0xFE, 0x08, 0xE1, 0x88, 0x60, + 0x85, 0x71, 0x8D, 0xE2, 0xA5, 0x60, 0x5E, 0x78, 0xFF, 0xFF, 0x50, 0xEC, 0x63, 0x4A, 0xFF, 0xFF, + 0x01, 0x16, 0xFE, 0x01, 0x40, 0xEC, 0x2F, 0x58, 0xFF, 0xFF, 0x44, 0xD3, 0x80, 0x7C, 0x60, 0x48, + 0x60, 0x47, 0x00, 0x7F, 0xB0, 0x8A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x2F, 0x58, 0xFF, 0xFF, + 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, 0x02, 0x02, 0xA1, 0xFF, 0xFF, 0xFF, 0x82, 0xFF, 0x88, 0xFF, + 0x48, 0xE2, 0x01, 0x70, 0xAE, 0xF1, 0x00, 0x6B, 0x89, 0xFF, 0x64, 0x54, 0x88, 0xFF, 0x9F, 0xFE, + 0x02, 0x05, 0x64, 0x44, 0x60, 0x54, 0xCD, 0xE2, 0xC2, 0x64, 0x3A, 0xDB, 0xBC, 0xFF, 0xB5, 0xFF, + 0x1D, 0xFF, 0x26, 0x44, 0x02, 0xB4, 0x40, 0x46, 0x3C, 0x44, 0x00, 0xBC, 0xFF, 0xFF, 0x06, 0x03, + 0x27, 0x40, 0x26, 0x22, 0x03, 0x00, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x27, 0x44, 0x20, 0x2A, + 0x04, 0x00, 0xA0, 0x60, 0x00, 0xEA, 0xB0, 0x60, 0x00, 0xEA, 0x5C, 0x4D, 0x27, 0x44, 0x18, 0xB4, + 0x40, 0x47, 0x00, 0xE1, 0x6C, 0x40, 0x44, 0xE2, 0xC4, 0xE2, 0x47, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, + 0x32, 0xF1, 0x08, 0x29, 0x09, 0x00, 0x64, 0x40, 0x07, 0x22, 0x06, 0x00, 0x43, 0xFF, 0x27, 0x44, + 0x10, 0xBC, 0x40, 0x47, 0x00, 0x64, 0x32, 0xFB, 0x31, 0x41, 0x3C, 0x44, 0x01, 0xB1, 0x00, 0xBC, + 0x0A, 0x02, 0x09, 0x03, 0x32, 0xF3, 0x00, 0x7C, 0x01, 0xB4, 0xFF, 0xFF, 0x04, 0x03, 0x32, 0xF9, + 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x48, 0x60, 0x2D, 0x7D, 0x08, 0x60, 0x00, 0x6B, 0x00, 0x64, + 0x33, 0xFB, 0x0C, 0x60, 0x16, 0x64, 0xA0, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0x32, 0xF3, 0x08, 0x29, + 0x0A, 0x00, 0x60, 0x40, 0x07, 0x22, 0x07, 0x00, 0xFE, 0xB4, 0x32, 0xFB, 0x27, 0x44, 0x10, 0xBC, + 0xF7, 0xB4, 0x40, 0x47, 0x43, 0xFF, 0x00, 0x64, 0x3A, 0xDB, 0x01, 0x60, 0x08, 0xE1, 0x31, 0x40, + 0x01, 0x2A, 0x04, 0x00, 0x00, 0x64, 0x33, 0xFB, 0x01, 0x60, 0x0A, 0xE1, 0xE5, 0xFE, 0x13, 0x05, + 0x27, 0x44, 0x10, 0x26, 0x13, 0x00, 0x9F, 0xFE, 0x02, 0x04, 0x02, 0xE1, 0x06, 0x00, 0x3E, 0xE1, + 0x31, 0x44, 0x01, 0x2A, 0x02, 0x00, 0x04, 0x0A, 0xBF, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, + 0xAF, 0x60, 0x19, 0x78, 0xFF, 0xFF, 0xA8, 0x60, 0x09, 0x78, 0xFF, 0xFF, 0x27, 0x44, 0x08, 0x26, + 0xFF, 0xFF, 0xBF, 0x60, 0x2A, 0x78, 0xFF, 0xFF, 0x48, 0xF3, 0x32, 0xF1, 0x00, 0x63, 0x64, 0x40, + 0x03, 0x22, 0x3D, 0x00, 0x31, 0x40, 0x08, 0x26, 0xF4, 0x01, 0xCD, 0xE2, 0x84, 0xE1, 0x70, 0x41, + 0xAD, 0x80, 0x71, 0x40, 0x80, 0x27, 0xED, 0x12, 0x03, 0x03, 0xBF, 0x60, 0x7C, 0x78, 0xFF, 0xFF, + 0xA1, 0xFF, 0xFF, 0xFF, 0xC4, 0xE2, 0x32, 0xFD, 0x60, 0x40, 0x01, 0x2A, 0xDF, 0x01, 0x00, 0x63, + 0x32, 0xFD, 0x6C, 0x40, 0x3C, 0x46, 0x3E, 0xF2, 0x2A, 0xF0, 0x27, 0x41, 0x44, 0x48, 0x20, 0xB9, + 0x01, 0xB4, 0xF7, 0xB1, 0x0A, 0x03, 0x64, 0x40, 0x08, 0x27, 0x07, 0x00, 0x0F, 0x60, 0x92, 0x63, + 0x00, 0x64, 0x45, 0xFB, 0x46, 0xFB, 0xBD, 0xDB, 0xA3, 0xDB, 0xCB, 0x0A, 0x41, 0x47, 0x3F, 0x40, + 0x01, 0x2B, 0x04, 0x00, 0xF6, 0xFE, 0x67, 0x4C, 0x05, 0x60, 0x69, 0x6B, 0x02, 0xE1, 0x01, 0x60, + 0x08, 0xE1, 0xF0, 0xFE, 0x84, 0xFF, 0xBF, 0x60, 0xAD, 0x64, 0x40, 0x42, 0x82, 0xFF, 0xE5, 0xFE, + 0x03, 0x04, 0xAC, 0x60, 0x41, 0x78, 0xFF, 0xFF, 0xE4, 0xFE, 0x0A, 0x04, 0x1D, 0xFF, 0x00, 0xEB, + 0x60, 0x7F, 0xA0, 0x5A, 0x80, 0x60, 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, 0xD1, 0x60, 0x00, 0xEA, + 0x43, 0xFF, 0xE6, 0xFE, 0x03, 0x05, 0xA7, 0x60, 0x9B, 0x78, 0xFF, 0xFF, 0x3C, 0x44, 0x60, 0x46, + 0x0F, 0xF0, 0x40, 0x42, 0x64, 0x40, 0x01, 0x2A, 0x03, 0x00, 0xAB, 0x60, 0x03, 0x78, 0xFF, 0xFF, + 0x0B, 0x64, 0x3A, 0xDB, 0x1C, 0x42, 0x22, 0x46, 0x13, 0xF2, 0xFF, 0x65, 0x60, 0x47, 0x2A, 0xF2, + 0x40, 0x45, 0x40, 0x48, 0x04, 0x2B, 0x17, 0x00, 0x16, 0xF2, 0x1D, 0xF2, 0x40, 0x43, 0x0F, 0xF2, + 0x40, 0x44, 0x25, 0x5E, 0x3F, 0x40, 0x01, 0x27, 0x40, 0x45, 0x0F, 0x64, 0x14, 0xF0, 0x35, 0xF2, + 0xA0, 0x82, 0x0F, 0xB4, 0xCA, 0x85, 0xD4, 0x80, 0x10, 0xF2, 0x01, 0x02, 0x2B, 0xFA, 0x27, 0x44, + 0x40, 0xBC, 0x40, 0x47, 0x13, 0x00, 0x17, 0xF2, 0x2C, 0xF0, 0x40, 0x43, 0x1B, 0xF2, 0x1D, 0xFA, + 0x40, 0x44, 0x64, 0x40, 0x01, 0x2A, 0x02, 0x00, 0xAB, 0xFC, 0x05, 0x00, 0x28, 0x40, 0xA4, 0x36, + 0x02, 0x00, 0x11, 0xF2, 0x2B, 0xFA, 0x27, 0x44, 0xBF, 0xB4, 0x40, 0x47, 0x28, 0x40, 0x40, 0x2B, + 0xFF, 0xFF, 0xAF, 0x60, 0x2E, 0x78, 0xFF, 0xFF, 0x22, 0x46, 0x2C, 0xF0, 0x27, 0x44, 0xDF, 0xB4, + 0x40, 0x47, 0xB5, 0xFF, 0xBC, 0xFF, 0x47, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0x48, 0x60, 0x2D, 0x7D, + 0x08, 0x60, 0x00, 0x6B, 0x64, 0x40, 0x01, 0x2A, 0x01, 0x00, 0x13, 0x00, 0x2A, 0xF0, 0x01, 0x65, + 0x64, 0x40, 0xA4, 0x3A, 0x04, 0x65, 0x27, 0x44, 0x34, 0x87, 0x36, 0xF3, 0xB4, 0xFF, 0x60, 0x5B, + 0x4D, 0xE2, 0x04, 0x64, 0x3A, 0xDB, 0x01, 0x60, 0x0A, 0xE1, 0x2B, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, + 0x81, 0x3E, 0x06, 0x64, 0x3A, 0xDB, 0x22, 0x46, 0x01, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0xBF, 0x60, + 0x85, 0x78, 0xFF, 0xFF, 0xB5, 0xFF, 0xA1, 0xFF, 0x6C, 0x40, 0x3F, 0x40, 0x01, 0x2B, 0x03, 0x00, + 0x67, 0x4C, 0x05, 0x60, 0x69, 0x6B, 0x02, 0xE1, 0x01, 0x60, 0x08, 0xE1, 0xC4, 0xE2, 0x08, 0x64, + 0x3A, 0xDB, 0xF0, 0xFE, 0x25, 0x46, 0x01, 0xF2, 0x61, 0x45, 0xD4, 0x9E, 0x21, 0x46, 0x16, 0xFA, + 0x2A, 0x44, 0x72, 0x45, 0x24, 0xFA, 0x95, 0xF3, 0x06, 0x04, 0xE4, 0xE2, 0xDC, 0x9C, 0x29, 0x40, + 0x01, 0x26, 0x64, 0x44, 0x95, 0xF9, 0x25, 0xFA, 0x96, 0xF3, 0x02, 0x04, 0xDC, 0x84, 0x96, 0xFB, + 0x28, 0xFA, 0x97, 0xF3, 0x02, 0x04, 0xDC, 0x84, 0x97, 0xFB, 0x29, 0xFA, 0x2D, 0x44, 0x04, 0x2A, + 0x06, 0x00, 0x28, 0x40, 0xA4, 0x36, 0x03, 0x00, 0xA9, 0x60, 0xC9, 0x78, 0xFF, 0xFF, 0x94, 0xFC, + 0x1F, 0x60, 0x9A, 0x65, 0xA5, 0xD1, 0x28, 0x44, 0x08, 0x2A, 0x51, 0x00, 0x03, 0x2B, 0x01, 0x00, + 0x4E, 0x00, 0x64, 0x40, 0x00, 0x36, 0x4B, 0x00, 0x32, 0xF2, 0x2F, 0xF0, 0x50, 0xFE, 0x01, 0x2A, + 0x03, 0x00, 0x01, 0x61, 0x8F, 0xF3, 0x31, 0x00, 0xD0, 0x80, 0x33, 0xF2, 0x30, 0xF0, 0x34, 0xF2, + 0xD0, 0x80, 0x31, 0xF0, 0xFF, 0xFF, 0xD0, 0x80, 0x60, 0x47, 0x34, 0x0C, 0xFF, 0xB4, 0x12, 0x60, + 0xCE, 0x65, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0xFF, 0xFF, 0x31, 0x18, 0x60, 0x43, 0x50, 0xFE, + 0x66, 0x41, 0x32, 0xF0, 0x63, 0x46, 0x03, 0xF2, 0x61, 0x46, 0xD0, 0x80, 0x33, 0xF0, 0x63, 0x46, + 0x04, 0xF2, 0x61, 0x46, 0xD0, 0x80, 0x34, 0xF0, 0x63, 0x46, 0x05, 0xF2, 0xFF, 0xFF, 0xD0, 0x80, + 0xFF, 0xFF, 0x04, 0x0C, 0x00, 0xF2, 0x61, 0x46, 0x1A, 0x18, 0xE8, 0x01, 0x06, 0xF0, 0x8F, 0xF3, + 0x61, 0x46, 0x02, 0x61, 0x64, 0x40, 0x02, 0x2A, 0x12, 0x00, 0xFC, 0xA0, 0xFF, 0xFF, 0x04, 0x0E, + 0x61, 0x44, 0x14, 0xFA, 0x11, 0xFC, 0x0B, 0x00, 0x2C, 0xF2, 0x2F, 0xFA, 0x2D, 0xF2, 0x30, 0xFA, + 0x2E, 0xF2, 0x31, 0xFA, 0x1D, 0xFF, 0x26, 0x44, 0x02, 0xBC, 0x40, 0x46, 0x20, 0x00, 0x26, 0x43, + 0x84, 0xBB, 0xFC, 0xB3, 0x21, 0x46, 0x01, 0x5D, 0x0F, 0xFC, 0x5C, 0x46, 0x25, 0x44, 0x06, 0xFA, + 0x05, 0xFF, 0x27, 0x44, 0x01, 0x2A, 0x13, 0x00, 0x50, 0xFE, 0x28, 0x40, 0x08, 0x3A, 0x12, 0x00, + 0x2F, 0xF2, 0x30, 0xF0, 0x60, 0x43, 0x31, 0xF2, 0x22, 0x46, 0x64, 0x41, 0x2C, 0xF0, 0x2D, 0xF0, + 0xD3, 0x80, 0x2E, 0xF0, 0xD1, 0x80, 0xD0, 0x80, 0x27, 0x44, 0x09, 0x0C, 0x03, 0x00, 0x27, 0x44, + 0x06, 0x22, 0x05, 0x00, 0xB8, 0xB4, 0x40, 0x47, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0xD4, 0x64, + 0x40, 0x48, 0x0D, 0x64, 0x3A, 0xDB, 0x21, 0x46, 0x1C, 0xF2, 0x62, 0xF1, 0xFF, 0xB4, 0xD0, 0x80, + 0xFF, 0xFF, 0x01, 0x06, 0x64, 0x44, 0x40, 0x45, 0x0A, 0x36, 0x70, 0x64, 0x14, 0x36, 0x38, 0x64, + 0x37, 0x3A, 0x03, 0x00, 0x04, 0x7F, 0x40, 0x45, 0x15, 0x64, 0x6E, 0x3A, 0x03, 0x00, 0x84, 0x7F, + 0x40, 0x45, 0x0B, 0x64, 0x40, 0x44, 0x00, 0x63, 0x28, 0x44, 0xA4, 0x36, 0x07, 0x00, 0x04, 0x2B, + 0x05, 0x00, 0x30, 0xF3, 0x24, 0x45, 0xD4, 0x84, 0xCA, 0x65, 0xD4, 0x83, 0xD4, 0x64, 0x1A, 0x00, + 0x0F, 0x64, 0x3A, 0xDB, 0x21, 0x46, 0x70, 0x63, 0x1C, 0xF2, 0xCA, 0x65, 0x40, 0x45, 0x0A, 0x36, + 0x70, 0x64, 0x14, 0x36, 0x38, 0x64, 0x37, 0x3A, 0x03, 0x00, 0x04, 0x7F, 0x40, 0x45, 0x15, 0x64, + 0x6E, 0x3A, 0x03, 0x00, 0x84, 0x7F, 0x40, 0x45, 0x0B, 0x64, 0x40, 0x44, 0x2B, 0xF2, 0xC4, 0x85, + 0xD4, 0x83, 0xC4, 0x64, 0x40, 0x48, 0x2F, 0xF0, 0xB0, 0xF0, 0xB1, 0xF2, 0x00, 0xE1, 0xA1, 0xFF, + 0xFF, 0xFF, 0x80, 0x4E, 0x83, 0x4C, 0x9A, 0xFF, 0x84, 0x4C, 0x85, 0x4C, 0x81, 0x4C, 0xA1, 0xFF, + 0x98, 0xFF, 0x87, 0x4F, 0x87, 0x4C, 0x87, 0x4F, 0x87, 0x4D, 0x87, 0x4C, 0x01, 0x08, 0x01, 0x00, + 0xFF, 0xFF, 0x87, 0x4C, 0x87, 0x4C, 0x87, 0x4C, 0x87, 0x4C, 0xFF, 0xFF, 0xFF, 0xFF, 0x6A, 0x44, + 0xBC, 0xFF, 0xC4, 0xE2, 0x0C, 0x74, 0x04, 0xE1, 0xA1, 0xFF, 0x35, 0xF3, 0xC4, 0xE2, 0x60, 0x54, + 0x89, 0xFF, 0x13, 0x74, 0x88, 0xFF, 0xB5, 0xFF, 0x47, 0xFF, 0x29, 0x44, 0xF7, 0xB4, 0x40, 0x49, + 0xB7, 0xFF, 0xB4, 0xFF, 0x48, 0x60, 0x2D, 0x7D, 0x08, 0x60, 0x00, 0x6B, 0x27, 0x44, 0x01, 0x2A, + 0x05, 0x00, 0xFE, 0xB4, 0x40, 0x47, 0xA8, 0x60, 0x89, 0x78, 0xFF, 0xFF, 0xA7, 0x60, 0x8E, 0x78, + 0xFF, 0xFF, 0x28, 0x40, 0xB4, 0x3A, 0x09, 0x00, 0x27, 0x44, 0x07, 0x22, 0x05, 0x00, 0xF8, 0xB4, + 0x40, 0x47, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x9B, 0x01, 0x28, 0x44, 0xD4, 0x36, 0x03, 0x00, + 0xAA, 0x60, 0xEA, 0x78, 0xFF, 0xFF, 0x48, 0xE2, 0x27, 0x44, 0xFB, 0xB4, 0x40, 0x47, 0x21, 0x60, + 0x98, 0x63, 0xA3, 0xD3, 0xB5, 0x60, 0x58, 0x4D, 0xE3, 0x78, 0xFF, 0xFF, 0x34, 0xFB, 0x1C, 0x42, + 0x22, 0x46, 0x2A, 0xF0, 0xF7, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDA, 0x60, 0x40, 0x40, 0x2B, + 0xCC, 0x00, 0x22, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x22, 0x26, 0x42, 0x00, 0x01, 0x26, 0x03, 0x00, + 0x04, 0x26, 0x07, 0x00, 0xC2, 0x00, 0x04, 0x2B, 0xC0, 0x00, 0x88, 0xF3, 0xFF, 0xFF, 0x60, 0x46, + 0x01, 0x00, 0x07, 0xF4, 0x47, 0xF2, 0xFF, 0xFF, 0xDC, 0x84, 0x47, 0xFA, 0x0D, 0x60, 0x3E, 0x62, + 0x80, 0xFF, 0xC4, 0x60, 0x78, 0x44, 0x02, 0xA4, 0xA2, 0xDB, 0x7D, 0x78, 0xFF, 0xFF, 0x82, 0xFF, + 0x88, 0xF3, 0x66, 0x5C, 0xD0, 0x80, 0x00, 0x7C, 0x07, 0x03, 0x66, 0x43, 0x22, 0x46, 0x22, 0xF2, + 0x63, 0x46, 0x60, 0x40, 0x01, 0x2A, 0x01, 0x00, 0x3C, 0xF1, 0x47, 0xF0, 0x64, 0x41, 0x64, 0x47, + 0xFF, 0xB4, 0x60, 0x5F, 0x20, 0xBC, 0x80, 0x26, 0x80, 0xAC, 0x60, 0x47, 0x22, 0x46, 0x3A, 0xFA, + 0x64, 0x44, 0x20, 0x7F, 0x34, 0x94, 0x3B, 0xFA, 0x08, 0x60, 0x00, 0xEA, 0x0F, 0x64, 0x60, 0x7F, + 0xA0, 0x5A, 0x80, 0x60, 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, 0xD1, 0x60, 0x00, 0xEA, 0x85, 0x00, + 0x2A, 0xF2, 0x00, 0x60, 0x7C, 0x62, 0x60, 0x40, 0x40, 0x2B, 0x27, 0x00, 0xA2, 0xD3, 0x00, 0x61, + 0x60, 0xFE, 0xA0, 0xD3, 0xDE, 0x82, 0xA2, 0xD1, 0xFF, 0xFF, 0x20, 0xFE, 0x64, 0x5F, 0xDC, 0x84, + 0xF1, 0x81, 0xC0, 0x2B, 0x04, 0x00, 0x80, 0x2A, 0x02, 0x00, 0x7F, 0xA4, 0xDC, 0x84, 0xFF, 0x3B, + 0x03, 0x00, 0x60, 0x47, 0xDC, 0x87, 0x01, 0x61, 0xC0, 0x80, 0x00, 0x36, 0xDC, 0x84, 0x4E, 0xDB, + 0x60, 0xFE, 0xDA, 0x82, 0xA2, 0xD1, 0xFF, 0xFF, 0xC1, 0x84, 0xF0, 0x22, 0x10, 0xA4, 0xF0, 0x2A, + 0x01, 0x00, 0x00, 0x64, 0xA2, 0xDB, 0xFF, 0xFF, 0x20, 0xFE, 0x00, 0x60, 0x7C, 0x62, 0xA2, 0xD3, + 0xFF, 0xFF, 0xA0, 0xD3, 0x5A, 0xD1, 0x3A, 0xFA, 0x3B, 0xF8, 0x74, 0x62, 0xA2, 0xD0, 0xFF, 0xFF, + 0x64, 0x44, 0xE0, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xE1, 0x7F, 0x5A, 0xD0, 0xA0, 0x5A, 0x64, 0x44, + 0xE2, 0x7F, 0xA0, 0x5A, 0x00, 0x60, 0x80, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xA0, 0xD1, 0x5A, 0xD1, + 0x64, 0x45, 0x64, 0x44, 0xE3, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xE4, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, + 0x64, 0x44, 0xE5, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xE6, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, + 0xE7, 0x7F, 0xA0, 0x5A, 0x65, 0x40, 0x0D, 0x3A, 0x1C, 0x00, 0x64, 0x47, 0xE8, 0x7F, 0x5A, 0xD1, + 0xA0, 0x5A, 0x64, 0x44, 0xE9, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xEA, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, + 0x64, 0x44, 0xEB, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xEC, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, + 0xED, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xEE, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xEF, 0x7F, + 0xA0, 0x5A, 0x08, 0x60, 0x00, 0xEA, 0x65, 0x44, 0x02, 0xA4, 0x60, 0x7F, 0xA0, 0x5A, 0x80, 0x60, + 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, 0xD1, 0x60, 0x00, 0xEA, 0x0B, 0xF2, 0xFF, 0xFF, 0x7F, 0xB4, + 0x0C, 0xF0, 0x04, 0x02, 0x64, 0x46, 0x00, 0xF0, 0x04, 0x64, 0x22, 0x46, 0x03, 0xFA, 0x60, 0x41, + 0x64, 0x46, 0x01, 0xF2, 0xFC, 0xA1, 0x61, 0x45, 0xD4, 0x84, 0xFF, 0xFF, 0x08, 0x02, 0x00, 0xF0, + 0x04, 0x63, 0x64, 0x46, 0x01, 0xF2, 0x22, 0x46, 0x1A, 0xFA, 0x03, 0xFC, 0x02, 0x00, 0x22, 0x46, + 0x1A, 0xFA, 0x35, 0xF2, 0x04, 0xF8, 0xDC, 0x84, 0x35, 0xFA, 0x14, 0xF2, 0x0F, 0xB5, 0x0F, 0xB4, + 0xCC, 0x84, 0x94, 0x80, 0x04, 0x60, 0x00, 0x65, 0x2A, 0xF2, 0x01, 0x02, 0x94, 0x84, 0x2A, 0xFA, + 0x95, 0xFC, 0x06, 0x00, 0xC4, 0x3A, 0x07, 0x00, 0x27, 0x44, 0xFD, 0xB4, 0x40, 0x47, 0x48, 0xE2, + 0xA8, 0x60, 0x28, 0x78, 0xFF, 0xFF, 0x28, 0x44, 0x04, 0x26, 0x05, 0x00, 0x68, 0x3A, 0x03, 0x00, + 0x32, 0x44, 0x00, 0x27, 0x03, 0x00, 0xA7, 0x60, 0x9B, 0x78, 0xFF, 0xFF, 0x0A, 0x64, 0x3A, 0xDB, + 0xA7, 0x60, 0x9B, 0x78, 0xFF, 0xFF, 0x0E, 0x64, 0x3A, 0xDB, 0x10, 0x60, 0x00, 0x65, 0x3C, 0x46, + 0x2A, 0xF2, 0x13, 0xF0, 0xA4, 0x84, 0xB4, 0xBC, 0x40, 0x48, 0x62, 0xF1, 0x64, 0x47, 0xFF, 0xB4, + 0x60, 0x45, 0xD0, 0x80, 0x70, 0x61, 0x01, 0x06, 0x64, 0x44, 0x0A, 0x36, 0x70, 0x64, 0x14, 0x36, + 0x38, 0x64, 0x37, 0x36, 0x15, 0x64, 0x6E, 0x36, 0x0B, 0x64, 0x40, 0x4E, 0xA0, 0x63, 0x0A, 0x64, + 0x65, 0x40, 0x0A, 0x36, 0x03, 0x00, 0x38, 0x61, 0x14, 0x64, 0xEB, 0x83, 0x40, 0x45, 0x43, 0x44, + 0x02, 0x60, 0x5E, 0x65, 0x2A, 0xF2, 0x2B, 0xF2, 0x60, 0x40, 0x04, 0x2B, 0x04, 0x00, 0x2E, 0x45, + 0xD4, 0x85, 0xC5, 0x84, 0x05, 0x00, 0x1B, 0xF0, 0xC5, 0x84, 0xC0, 0x84, 0x2E, 0x45, 0xC4, 0x84, + 0x60, 0x43, 0x28, 0x44, 0x00, 0xE1, 0xA1, 0xFF, 0x80, 0x4E, 0x83, 0x4C, 0x9A, 0xFF, 0x56, 0x62, + 0x7A, 0xD4, 0x7A, 0xD4, 0x7A, 0xD4, 0x5C, 0x62, 0x7A, 0xD4, 0x7A, 0xD4, 0x7A, 0xD4, 0xA1, 0xFF, + 0x98, 0xFF, 0x87, 0x4F, 0x87, 0x4C, 0x87, 0x4F, 0x87, 0x4D, 0x87, 0x4C, 0x01, 0x08, 0x01, 0x00, + 0xFF, 0xFF, 0x87, 0x4C, 0x87, 0x4C, 0x87, 0x4C, 0x87, 0x4C, 0xFF, 0xFF, 0xFF, 0xFF, 0x6A, 0x44, + 0xBC, 0xFF, 0xB5, 0xFF, 0x47, 0xFF, 0x27, 0x44, 0x02, 0xBC, 0x40, 0x47, 0x36, 0xF3, 0xB7, 0xFF, + 0xB4, 0xFF, 0x48, 0x60, 0x2D, 0x7D, 0x08, 0x60, 0x00, 0x6B, 0x60, 0x5B, 0x4D, 0xE2, 0xA8, 0x60, + 0x81, 0x78, 0xFF, 0xFF, 0x21, 0x46, 0xB5, 0xFF, 0xBC, 0xFF, 0x47, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, + 0x48, 0x60, 0x2D, 0x7D, 0x08, 0x60, 0x00, 0x6B, 0x26, 0x43, 0x25, 0x44, 0x06, 0xFA, 0x2A, 0x44, + 0x72, 0x45, 0x24, 0xFA, 0x95, 0xF3, 0x06, 0x04, 0xE4, 0xE2, 0xDC, 0x9C, 0x29, 0x40, 0x01, 0x26, + 0x64, 0x44, 0x95, 0xF9, 0x25, 0xFA, 0x96, 0xF3, 0x02, 0x04, 0xDC, 0x84, 0x96, 0xFB, 0x28, 0xFA, + 0x97, 0xF3, 0x02, 0x04, 0xDC, 0x84, 0x97, 0xFB, 0x29, 0xFA, 0x2D, 0x40, 0x01, 0x2A, 0x0E, 0x00, + 0x1D, 0xFF, 0x26, 0x44, 0x02, 0xBC, 0x40, 0x46, 0x27, 0x44, 0x07, 0x22, 0x05, 0x00, 0xF8, 0xB4, + 0x40, 0x47, 0x06, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x30, 0xF1, 0x50, 0x00, 0xFC, 0xB3, 0x32, 0x40, + 0x01, 0x2A, 0x06, 0x00, 0x0A, 0xBB, 0x0F, 0xFC, 0xCB, 0xFE, 0xA7, 0x60, 0x9B, 0x78, 0xFF, 0xFF, + 0x2D, 0x44, 0x04, 0x26, 0x02, 0x00, 0x0F, 0xFC, 0x05, 0xFF, 0x30, 0xF1, 0x27, 0x44, 0x05, 0x22, + 0x2D, 0x00, 0xFA, 0xB4, 0x40, 0x47, 0x2D, 0x44, 0x10, 0x2A, 0x24, 0x00, 0x28, 0x40, 0xD4, 0x3A, + 0x21, 0x00, 0x31, 0x40, 0x08, 0x26, 0x00, 0x7C, 0x2B, 0x44, 0xD0, 0x80, 0x70, 0x45, 0x02, 0x28, + 0x64, 0x44, 0xC4, 0x84, 0xFF, 0xFF, 0x04, 0x24, 0x00, 0xB4, 0x60, 0x50, 0x08, 0x28, 0x01, 0x00, + 0x20, 0x29, 0x6D, 0xE2, 0x12, 0x60, 0xC0, 0x63, 0x1D, 0xF0, 0xC0, 0x64, 0xC0, 0x84, 0xA3, 0xD1, + 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xC0, 0x84, 0xA3, 0xDB, 0xA8, 0x60, + 0x89, 0x78, 0xFF, 0xFF, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x07, 0x00, 0x02, 0x2A, 0x05, 0x00, + 0xFD, 0xB4, 0x40, 0x47, 0x06, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x05, 0x64, 0x3A, 0xDB, 0x28, 0x44, + 0xA4, 0x3A, 0x04, 0x00, 0x39, 0xF1, 0x25, 0x44, 0x0A, 0x36, 0x38, 0xF1, 0x31, 0x40, 0x08, 0x26, + 0x00, 0x7C, 0x2B, 0x44, 0xD0, 0x80, 0x70, 0x45, 0x02, 0x28, 0x64, 0x44, 0xC4, 0x84, 0xFF, 0xFF, + 0x04, 0x24, 0x00, 0xB4, 0x28, 0x40, 0xE4, 0x36, 0x00, 0xB4, 0x60, 0x50, 0x08, 0x28, 0x01, 0x00, + 0x20, 0x29, 0x6D, 0xE2, 0xA7, 0x60, 0x8E, 0x78, 0xFF, 0xFF, 0x21, 0x46, 0xB5, 0xFF, 0xBC, 0xFF, + 0x47, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0x48, 0x60, 0x2D, 0x7D, 0x08, 0x60, 0x00, 0x6B, 0x27, 0x44, + 0x07, 0x22, 0x05, 0x00, 0xF8, 0xB4, 0x40, 0x47, 0x06, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0xEA, 0x01, + 0x27, 0x44, 0x05, 0x22, 0x09, 0x00, 0xBA, 0xB4, 0x40, 0x47, 0x3C, 0x46, 0x02, 0x64, 0x31, 0xFB, + 0xC0, 0xFE, 0xA7, 0x60, 0x9B, 0x78, 0xFF, 0xFF, 0x27, 0x44, 0x02, 0x2A, 0x06, 0x00, 0xFD, 0xB4, + 0x40, 0x47, 0x06, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0xF4, 0x01, 0xF3, 0x0A, 0x7C, 0x50, 0x6D, 0xE2, + 0xF0, 0x01, 0x72, 0x45, 0xDC, 0x84, 0x95, 0xFB, 0x11, 0x64, 0x3A, 0xDB, 0x96, 0xF3, 0x06, 0x04, + 0xDC, 0x84, 0x96, 0xFB, 0x97, 0xF3, 0x02, 0x04, 0xDC, 0x84, 0x97, 0xFB, 0xA7, 0x60, 0xA6, 0x78, + 0xFF, 0xFF, 0x00, 0x61, 0x12, 0x64, 0x3A, 0xDB, 0x16, 0x60, 0xBA, 0x63, 0xBD, 0xD3, 0x72, 0x45, + 0x44, 0x8A, 0x02, 0x28, 0x02, 0x00, 0xE4, 0xE2, 0xDD, 0x81, 0x02, 0x28, 0x02, 0x00, 0xE4, 0xE2, + 0xDD, 0x81, 0xBD, 0xD3, 0x95, 0xF1, 0x61, 0x45, 0xC0, 0x84, 0x00, 0x61, 0x02, 0x24, 0x01, 0xB9, + 0xC4, 0x84, 0x60, 0x55, 0x2A, 0x52, 0x95, 0xFB, 0x02, 0x24, 0x01, 0xB9, 0xBD, 0xD3, 0x96, 0xF1, + 0x61, 0x45, 0xC0, 0x84, 0x00, 0x61, 0x02, 0x24, 0x01, 0xB9, 0xC4, 0x84, 0x96, 0xFB, 0x02, 0x24, + 0x01, 0xB9, 0xBD, 0xD3, 0x97, 0xF1, 0x61, 0x45, 0xC0, 0x84, 0xC4, 0x84, 0x97, 0xFB, 0xA8, 0x60, + 0x0C, 0x78, 0xFF, 0xFF, 0xAE, 0x01, 0xA1, 0xFF, 0xFF, 0xFF, 0x01, 0x25, 0x09, 0x00, 0x04, 0x25, + 0x03, 0x00, 0x47, 0xFF, 0x32, 0x74, 0xA5, 0x01, 0xC4, 0xE2, 0xAF, 0x60, 0x19, 0x78, 0xFF, 0xFF, + 0x4C, 0x4E, 0x47, 0xFF, 0x32, 0x74, 0xCD, 0xE2, 0xAC, 0x60, 0x8F, 0x78, 0x00, 0x61, 0x10, 0x64, + 0x3A, 0xDB, 0xA7, 0x60, 0x9B, 0x78, 0xFF, 0xFF, 0xA7, 0x60, 0x9B, 0x78, 0xFF, 0xFF, 0x5C, 0x4D, + 0x26, 0x44, 0x02, 0x26, 0x0C, 0x00, 0x3E, 0x46, 0x09, 0xF2, 0x1E, 0x41, 0x03, 0x1B, 0xAE, 0x60, + 0xCB, 0x78, 0xFF, 0xFF, 0x40, 0x5E, 0xFD, 0xFB, 0x21, 0x44, 0x02, 0x64, 0x40, 0x46, 0x41, 0x5D, + 0x21, 0x46, 0x00, 0xF2, 0x46, 0x45, 0x87, 0xFC, 0x4C, 0xE2, 0x01, 0x64, 0x33, 0xFB, 0x01, 0x60, + 0x0E, 0xE1, 0x03, 0xE1, 0x3F, 0x40, 0x01, 0x27, 0x00, 0x00, 0x21, 0x69, 0xB6, 0xFF, 0xA1, 0xFF, + 0x6C, 0x5E, 0xB6, 0xFF, 0xB7, 0xFF, 0x60, 0x5C, 0x20, 0x64, 0x3A, 0xDB, 0x68, 0x43, 0x26, 0xFC, + 0x22, 0x69, 0x64, 0x44, 0xA1, 0xFF, 0xFF, 0xFF, 0x6C, 0x5F, 0x60, 0x43, 0x26, 0xF2, 0xFF, 0xFF, + 0x68, 0x5F, 0x26, 0xFA, 0x3A, 0x69, 0x1D, 0xFC, 0x2E, 0x44, 0x36, 0xF1, 0x1C, 0xFA, 0xC3, 0x94, + 0xCD, 0xE2, 0x2E, 0x44, 0x14, 0x36, 0x12, 0x00, 0x0A, 0x36, 0x0F, 0x00, 0x63, 0x45, 0xE3, 0x83, + 0xE3, 0x83, 0xC7, 0x83, 0xE3, 0x83, 0xC7, 0x83, 0xFF, 0xFF, 0x37, 0x36, 0x05, 0x00, 0x6E, 0x36, + 0x04, 0x00, 0xAE, 0x60, 0xE3, 0x78, 0xFF, 0xFF, 0xEB, 0x83, 0xEB, 0x83, 0xEB, 0x83, 0xEB, 0x83, + 0xFF, 0xFF, 0x80, 0x27, 0xCF, 0x83, 0x1B, 0xFC, 0x01, 0x64, 0x4F, 0xFB, 0xA1, 0xFF, 0x1C, 0xF2, + 0x29, 0x41, 0xF9, 0x81, 0x52, 0x4A, 0x71, 0x89, 0x68, 0x5F, 0x27, 0xFA, 0x6C, 0x40, 0x03, 0x15, + 0xAE, 0x60, 0xF4, 0x78, 0xFF, 0xFF, 0x88, 0x60, 0x85, 0x71, 0x8D, 0xE2, 0x99, 0xF1, 0xFC, 0xA3, + 0xD3, 0x80, 0x43, 0x43, 0x03, 0x04, 0xAE, 0x60, 0xEB, 0x78, 0xFF, 0xFF, 0x32, 0x40, 0x01, 0x2A, + 0x4C, 0x00, 0x9A, 0xFF, 0x23, 0x43, 0x18, 0x61, 0xA1, 0xFF, 0x8C, 0x44, 0xCB, 0x83, 0x2A, 0xFA, + 0x40, 0x48, 0x40, 0x27, 0x04, 0xA1, 0x60, 0x40, 0x03, 0x2B, 0x01, 0x00, 0x06, 0xA1, 0x88, 0xB0, + 0x88, 0x36, 0xD9, 0x81, 0x62, 0x45, 0x23, 0x44, 0x54, 0x94, 0x28, 0x40, 0x04, 0x26, 0x00, 0x64, + 0x3F, 0xFA, 0xC9, 0x81, 0x65, 0x42, 0x7A, 0xDC, 0x00, 0xB9, 0xFD, 0x1C, 0x00, 0xF4, 0x6E, 0x61, + 0x10, 0x62, 0x14, 0x02, 0x05, 0x1D, 0x12, 0x1E, 0x0C, 0x00, 0x00, 0xF4, 0x7C, 0x61, 0x02, 0x62, + 0x7A, 0xDC, 0x63, 0x40, 0xFD, 0x1C, 0xF9, 0x1D, 0xFF, 0xB1, 0x08, 0x1E, 0x02, 0x02, 0x00, 0xF4, + 0x02, 0x62, 0xB6, 0xFF, 0xB7, 0xFF, 0xA1, 0xFF, 0x6C, 0x44, 0x5A, 0xDA, 0x98, 0xFF, 0x01, 0x60, + 0x08, 0xE1, 0x81, 0xE1, 0xA1, 0xFF, 0x6C, 0x40, 0xA1, 0xFF, 0x47, 0xFF, 0x26, 0x44, 0xFD, 0xB4, + 0x84, 0xBC, 0x01, 0x15, 0x7F, 0xB4, 0x40, 0x46, 0xA1, 0xFF, 0x6C, 0x40, 0x14, 0x63, 0x01, 0x11, + 0x01, 0x00, 0xFD, 0x1F, 0xAE, 0x60, 0x61, 0x78, 0xFF, 0xFF, 0x9A, 0xFF, 0x54, 0x63, 0x12, 0x64, + 0x40, 0x46, 0x00, 0x64, 0x0F, 0xFA, 0xA1, 0xFF, 0xCB, 0xF1, 0x12, 0x61, 0x50, 0xFE, 0x8C, 0x44, + 0xCC, 0xF0, 0xBD, 0xDA, 0x40, 0x48, 0x04, 0x26, 0x40, 0x00, 0xA1, 0xFF, 0x8C, 0x44, 0xBD, 0xDA, + 0x30, 0xFB, 0x6C, 0x44, 0xBD, 0xDA, 0xFF, 0xFF, 0x01, 0x26, 0x24, 0x00, 0xD0, 0x80, 0xA1, 0xFF, + 0x8C, 0x44, 0x6C, 0x5C, 0xF2, 0xFE, 0xBD, 0xDA, 0xCD, 0xF3, 0xD4, 0x80, 0xD0, 0x80, 0xBD, 0xD8, + 0x2D, 0x44, 0x15, 0x0C, 0x32, 0x40, 0x02, 0x2A, 0x07, 0x00, 0x28, 0x42, 0x0C, 0xB2, 0x08, 0x3A, + 0x03, 0x00, 0x10, 0xBC, 0x40, 0x4D, 0x4D, 0x00, 0x03, 0x0A, 0xAE, 0x60, 0xF9, 0x78, 0xFF, 0xFF, + 0x11, 0xBC, 0x40, 0x4D, 0x28, 0x45, 0xBF, 0x60, 0xFF, 0x64, 0x24, 0x88, 0x42, 0x00, 0x30, 0xBC, + 0x40, 0x4D, 0x3F, 0x00, 0x20, 0xB9, 0x5C, 0x8E, 0xA1, 0xFF, 0x8C, 0x44, 0xBD, 0xDA, 0xDC, 0x9C, + 0x6C, 0x44, 0xF2, 0xFE, 0xBD, 0xDA, 0x08, 0x28, 0x44, 0x4E, 0xDC, 0x84, 0x2E, 0x5C, 0xB0, 0x84, + 0xEF, 0xB1, 0x08, 0x24, 0x40, 0xB9, 0x41, 0x46, 0x2C, 0x00, 0x8C, 0x44, 0x04, 0x61, 0xBD, 0xDA, + 0x50, 0xFE, 0x80, 0x27, 0x00, 0x64, 0x30, 0xFB, 0x8C, 0x44, 0xBD, 0xDA, 0xD0, 0x80, 0x8C, 0x44, + 0xBD, 0xDA, 0xD4, 0x80, 0x00, 0x65, 0x8C, 0x44, 0xCD, 0xF1, 0xBD, 0xDA, 0xD0, 0x80, 0x28, 0x44, + 0x03, 0x0C, 0xA0, 0x2A, 0x0A, 0x00, 0x11, 0x00, 0x10, 0x65, 0x60, 0x40, 0xC4, 0x36, 0x04, 0x00, + 0xD4, 0x3A, 0x08, 0x00, 0x27, 0x40, 0x40, 0x26, 0x30, 0x65, 0x00, 0x64, 0x3F, 0xFA, 0x46, 0x4E, + 0x35, 0x8D, 0x5F, 0x00, 0x40, 0x26, 0xF9, 0x01, 0x30, 0x65, 0x9D, 0xDC, 0x9D, 0xDC, 0x9D, 0xDC, + 0xF4, 0x01, 0x00, 0xE1, 0x23, 0x43, 0xE8, 0xA3, 0x6A, 0x62, 0x9A, 0xFF, 0xA1, 0xFF, 0x28, 0x44, + 0x03, 0x2B, 0x04, 0x00, 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0x28, 0x44, 0x88, 0xB0, 0x88, 0x2A, + 0x03, 0x00, 0x70, 0x62, 0x7A, 0xDC, 0x28, 0x44, 0x40, 0x2B, 0x13, 0x00, 0x72, 0x62, 0x7A, 0xDC, + 0x04, 0xE6, 0x7A, 0xDC, 0x3B, 0xF2, 0xFF, 0xFF, 0xFF, 0xFF, 0x20, 0x2B, 0x02, 0x00, 0x7A, 0xDC, + 0x7A, 0xDC, 0x08, 0x60, 0x00, 0xEB, 0xFC, 0xA3, 0x25, 0xFF, 0x3F, 0xFC, 0x04, 0xA3, 0xB0, 0xFF, + 0x01, 0x00, 0x3F, 0xFC, 0xCF, 0x83, 0xDF, 0x83, 0x04, 0x02, 0x00, 0xF4, 0x10, 0x62, 0x6C, 0x61, + 0x1F, 0x00, 0x27, 0x03, 0xCB, 0x83, 0xFF, 0x60, 0xFE, 0x65, 0x0E, 0xA3, 0xA7, 0x84, 0xF2, 0xA3, + 0x00, 0xF4, 0x10, 0x62, 0x6C, 0x61, 0x7A, 0xDC, 0xFE, 0x1C, 0x03, 0x1D, 0x7C, 0xA8, 0xD9, 0x81, + 0x0A, 0x02, 0x00, 0xF4, 0x02, 0x62, 0xA7, 0x84, 0x7A, 0x61, 0x7A, 0xDC, 0xFE, 0x1C, 0xF9, 0x1D, + 0x7C, 0xA8, 0xD9, 0x81, 0xF6, 0x03, 0xFF, 0xB1, 0x0C, 0x1E, 0x02, 0x02, 0x00, 0xF4, 0x02, 0x62, + 0xA1, 0xFF, 0x01, 0x60, 0x0C, 0xE1, 0xB6, 0xFF, 0xB7, 0xFF, 0xA1, 0xFF, 0xCD, 0x81, 0x6C, 0x44, + 0x5A, 0xDA, 0x98, 0xFF, 0x00, 0xE6, 0x7C, 0x44, 0x33, 0xFB, 0x01, 0x60, 0x0C, 0xE1, 0x83, 0xE1, + 0xA1, 0xFF, 0x8C, 0x44, 0x46, 0x45, 0xA1, 0xFF, 0x14, 0x63, 0x01, 0x10, 0xFE, 0x1F, 0x01, 0x60, + 0x08, 0xE1, 0x0A, 0x64, 0x60, 0x54, 0x47, 0xFF, 0x50, 0x4B, 0x67, 0x50, 0x69, 0xE2, 0x6A, 0x40, + 0x40, 0x2B, 0x01, 0x15, 0x29, 0x00, 0x6C, 0x40, 0x28, 0x40, 0x03, 0x26, 0x15, 0x00, 0x31, 0x40, + 0x20, 0x2A, 0x03, 0x00, 0x28, 0x40, 0x50, 0x3A, 0x0F, 0x00, 0x2D, 0x44, 0x20, 0x2A, 0x0C, 0x00, + 0x2B, 0x44, 0xAC, 0x80, 0x28, 0x40, 0xB4, 0x3A, 0x03, 0x00, 0x02, 0x03, 0x30, 0xFB, 0x04, 0x00, + 0x2B, 0x50, 0xA8, 0x60, 0x92, 0x78, 0x04, 0xE1, 0x04, 0xE1, 0xA1, 0xFF, 0x35, 0xF1, 0x26, 0x44, + 0x64, 0x54, 0xCD, 0xE2, 0x84, 0xBC, 0x2D, 0x40, 0x0C, 0x22, 0xFD, 0xB4, 0x40, 0x46, 0x23, 0x64, + 0x3A, 0xDB, 0xAB, 0x60, 0x6A, 0x78, 0xFF, 0xFF, 0x27, 0x40, 0x26, 0x22, 0x04, 0x00, 0x02, 0x64, + 0x31, 0xFB, 0xC0, 0xFE, 0xFF, 0xFF, 0x6C, 0x40, 0xB7, 0xFF, 0xB4, 0xFF, 0x48, 0x60, 0x2D, 0x7D, + 0x08, 0x60, 0x00, 0x6B, 0x37, 0xF3, 0x2B, 0x45, 0xD4, 0x80, 0xFF, 0xFF, 0x02, 0x28, 0x65, 0x44, + 0x60, 0x50, 0xA0, 0x4C, 0x20, 0xBC, 0xFF, 0xB4, 0xA0, 0x51, 0x35, 0xF1, 0x74, 0x44, 0xC0, 0x94, + 0x32, 0x40, 0x02, 0x2A, 0x18, 0x00, 0x28, 0x44, 0xA4, 0x36, 0x04, 0x00, 0x0C, 0xB4, 0xFF, 0xFF, + 0x04, 0x36, 0x11, 0x00, 0x26, 0x43, 0xFD, 0xB3, 0x04, 0xBB, 0x43, 0x46, 0x01, 0x2A, 0x03, 0x00, + 0x28, 0x47, 0x40, 0xBF, 0x40, 0x48, 0x0A, 0xBB, 0x0F, 0xFC, 0x50, 0x4B, 0x67, 0x50, 0x00, 0x64, + 0x30, 0xFB, 0x05, 0xFF, 0xC6, 0x01, 0x24, 0x64, 0x3A, 0xDB, 0x28, 0x44, 0x04, 0x2A, 0x03, 0x00, + 0xA7, 0x60, 0x8E, 0x78, 0xFF, 0xFF, 0x1D, 0xFF, 0x48, 0xE2, 0x27, 0x44, 0x06, 0x22, 0x05, 0x00, + 0xF9, 0xB4, 0x40, 0x47, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x26, 0x40, 0x10, 0x2A, 0x18, 0x00, + 0x26, 0xF2, 0xFF, 0xFF, 0x60, 0x47, 0xFF, 0xB4, 0xC0, 0xA0, 0xFF, 0xFF, 0x11, 0x0E, 0x98, 0xF1, + 0x1E, 0x60, 0xF8, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, + 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, + 0xAC, 0x60, 0x05, 0x78, 0xFF, 0xFF, 0x98, 0xF1, 0x1E, 0x60, 0xFA, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, + 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, + 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x2A, 0x64, 0x3A, 0xDB, 0x5C, 0x41, 0x87, 0xE1, + 0xA1, 0xFF, 0x6C, 0x40, 0x02, 0x00, 0x29, 0x64, 0x3A, 0xDB, 0x01, 0x60, 0x08, 0xE1, 0x87, 0xE1, + 0xA1, 0xFF, 0x6C, 0x40, 0x11, 0x00, 0x1F, 0x60, 0x0C, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, + 0xFF, 0xFF, 0x08, 0x28, 0xA2, 0xDB, 0xF1, 0x01, 0x01, 0x60, 0x08, 0xE1, 0x21, 0x64, 0x3A, 0xDB, + 0x03, 0x00, 0x01, 0x60, 0x08, 0xE1, 0x6C, 0x40, 0x00, 0x64, 0x33, 0xFB, 0x32, 0x74, 0x40, 0x63, + 0x01, 0x16, 0xFE, 0x01, 0x01, 0x68, 0x01, 0x11, 0x09, 0x00, 0xA7, 0x6A, 0x22, 0x64, 0x3A, 0xDB, + 0x03, 0x60, 0xC9, 0x63, 0x01, 0x11, 0x02, 0x00, 0x6C, 0x40, 0xFC, 0x1F, 0x6C, 0x40, 0xB5, 0xFF, + 0x6C, 0x40, 0xBC, 0xFF, 0x6C, 0x40, 0xB7, 0xFF, 0xB4, 0xFF, 0x48, 0x60, 0x2D, 0x7D, 0x08, 0x60, + 0x00, 0x6B, 0x03, 0x0A, 0xA7, 0x60, 0x9B, 0x78, 0xFF, 0xFF, 0x01, 0x64, 0x4F, 0xFB, 0x27, 0x44, + 0x06, 0x22, 0x06, 0x00, 0xF9, 0xB4, 0x40, 0x47, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x48, 0xE2, + 0x27, 0x64, 0x3A, 0xDB, 0xB3, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, 0x54, 0x62, 0x22, 0x46, + 0xA2, 0xD0, 0x16, 0x63, 0x7C, 0x41, 0x44, 0x48, 0x80, 0x36, 0x04, 0x61, 0x28, 0x40, 0x50, 0x36, + 0x04, 0x61, 0x41, 0x4E, 0x28, 0x44, 0xA4, 0x36, 0x0E, 0x63, 0x12, 0x60, 0xC2, 0x62, 0xA2, 0xD1, + 0x24, 0x44, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xC0, 0x84, 0xA2, 0xDB, + 0x9A, 0xFF, 0xA1, 0xFF, 0x54, 0x62, 0xA2, 0xD2, 0xFF, 0xFF, 0x6A, 0x40, 0x80, 0x4E, 0x7A, 0xD4, + 0x7A, 0xD4, 0x7A, 0xD4, 0x7A, 0xD4, 0x7A, 0xD4, 0x7A, 0xD4, 0x7A, 0xD4, 0xFF, 0xFF, 0x01, 0x1D, + 0x78, 0x00, 0x7A, 0xD4, 0x7A, 0xD4, 0x7A, 0xD4, 0x7A, 0xD4, 0x28, 0x40, 0x03, 0x2B, 0x04, 0x00, + 0x7A, 0xD4, 0x7A, 0xD4, 0x7A, 0xD4, 0x6A, 0x40, 0x70, 0x62, 0x28, 0x44, 0x88, 0xB0, 0x88, 0x36, + 0x7A, 0xD4, 0x28, 0x40, 0x40, 0x2B, 0x0B, 0x00, 0x72, 0x62, 0x7A, 0xD4, 0x7A, 0xD4, 0xA2, 0xD2, + 0xFF, 0xFF, 0x60, 0x40, 0x20, 0x2B, 0x02, 0x00, 0x7A, 0xD4, 0x7A, 0xD4, 0x46, 0x00, 0x23, 0x43, + 0xCF, 0x83, 0xDF, 0x83, 0x02, 0x03, 0x55, 0x03, 0x04, 0x00, 0x03, 0xF0, 0x04, 0xF4, 0x64, 0x42, + 0x37, 0x00, 0x2E, 0x40, 0x04, 0x2A, 0x21, 0x00, 0xA1, 0xFF, 0x02, 0xFE, 0x10, 0x25, 0x42, 0xFE, + 0x72, 0x45, 0x65, 0x4C, 0x95, 0xF3, 0x03, 0x04, 0xE4, 0xE2, 0xDC, 0x84, 0x95, 0xFB, 0xA1, 0xFF, + 0x80, 0x4C, 0x96, 0xF3, 0x02, 0x04, 0xDC, 0x84, 0x96, 0xFB, 0x80, 0x4C, 0x97, 0xF3, 0x02, 0x04, + 0xDC, 0x84, 0x97, 0xFB, 0x80, 0x4C, 0x5C, 0x4E, 0xF8, 0xA3, 0x03, 0xF2, 0x9A, 0xF2, 0x04, 0xF4, + 0xFF, 0xB1, 0xF8, 0xA1, 0x06, 0xA4, 0x60, 0x42, 0x09, 0x00, 0x03, 0xF2, 0x9A, 0xF2, 0x04, 0xF4, + 0xC8, 0x82, 0xFF, 0xB1, 0x03, 0x00, 0x00, 0xF4, 0x81, 0xF2, 0xFF, 0xB1, 0x7A, 0xD4, 0xFF, 0xFF, + 0xFD, 0x1C, 0xF9, 0x1D, 0xFF, 0xB1, 0x17, 0x1E, 0x02, 0x02, 0x00, 0xF4, 0xDA, 0x82, 0xDA, 0x82, + 0xA2, 0xD2, 0xA1, 0xFF, 0x09, 0x74, 0x80, 0x4D, 0x0E, 0x00, 0x03, 0xF2, 0x9A, 0xF2, 0x04, 0xF4, + 0x23, 0x43, 0xA1, 0xFF, 0xA0, 0xD2, 0xFE, 0xA1, 0xCB, 0x83, 0x80, 0x4E, 0xAF, 0x83, 0x02, 0x1D, + 0x02, 0x03, 0xED, 0x01, 0xE3, 0x01, 0xA1, 0xFF, 0x28, 0x40, 0x40, 0x2B, 0x02, 0x00, 0x9C, 0x4E, + 0x9C, 0x4C, 0xA1, 0xFF, 0xDA, 0x83, 0x66, 0x44, 0x22, 0x46, 0x0C, 0xFA, 0x0B, 0xFC, 0x87, 0x4F, + 0x87, 0x4C, 0x87, 0x4F, 0x87, 0x4D, 0x87, 0x4C, 0x01, 0x08, 0x01, 0x00, 0xFF, 0xFF, 0x87, 0x4C, + 0x87, 0x4C, 0x87, 0x4C, 0x87, 0x4C, 0xFF, 0xFF, 0xFF, 0xFF, 0x6A, 0x44, 0xBC, 0xFF, 0x01, 0x60, + 0x08, 0xE1, 0x0C, 0x74, 0x04, 0xE1, 0xA1, 0xFF, 0x35, 0xF3, 0xC4, 0xE2, 0x60, 0x54, 0x89, 0xFF, + 0x13, 0x74, 0x88, 0xFF, 0x29, 0x44, 0xF7, 0xB4, 0x40, 0x49, 0x34, 0x64, 0x3A, 0xDB, 0x06, 0xE1, + 0x47, 0xFF, 0xA8, 0x60, 0x64, 0x78, 0xFF, 0xFF, 0xFF, 0x01, 0x08, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, + 0x43, 0xFF, 0x01, 0x60, 0x00, 0xE1, 0x28, 0xF3, 0x47, 0xFF, 0x60, 0x40, 0x07, 0x37, 0x4B, 0x00, + 0x05, 0x3B, 0x04, 0x00, 0xFF, 0x0A, 0x80, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x29, 0xF5, 0x2A, 0xF3, + 0x47, 0xFF, 0x3F, 0xF0, 0x01, 0x1B, 0x01, 0x64, 0x60, 0x56, 0xAD, 0xE2, 0xB5, 0xFF, 0x6C, 0x40, + 0x40, 0xE1, 0xA1, 0xFF, 0x00, 0xF4, 0x6E, 0x61, 0x12, 0x62, 0x64, 0x43, 0x01, 0xE1, 0x03, 0x64, + 0xE2, 0xD0, 0xC9, 0x81, 0x64, 0x4C, 0xCC, 0x84, 0xDA, 0x82, 0xFA, 0x02, 0x01, 0x60, 0x00, 0x6B, + 0x9A, 0xFF, 0xCA, 0x82, 0x03, 0x00, 0x00, 0xF4, 0x81, 0xF2, 0xFF, 0xFF, 0x7A, 0xD0, 0xA1, 0xFF, + 0x64, 0x4C, 0xFC, 0x1C, 0xF8, 0x1D, 0x00, 0xB9, 0x06, 0x1E, 0x02, 0x02, 0x00, 0xF4, 0xDA, 0x82, + 0x5A, 0xD2, 0xA1, 0xFF, 0x60, 0x4D, 0x3F, 0x40, 0x02, 0x2B, 0x08, 0x00, 0x28, 0xF3, 0xA5, 0x60, + 0xC4, 0x65, 0x60, 0x40, 0x0E, 0x3B, 0x02, 0x00, 0x80, 0x4C, 0xFE, 0x01, 0xA1, 0xFF, 0x87, 0x4E, + 0x87, 0x4C, 0x87, 0x4C, 0x87, 0x4C, 0x87, 0x4C, 0x67, 0x4C, 0xFF, 0xFF, 0xBC, 0xFF, 0x00, 0xE1, + 0xD5, 0xFE, 0xA1, 0xFF, 0xFF, 0xFF, 0x00, 0x64, 0x40, 0x46, 0x60, 0x41, 0xB5, 0xFF, 0xB7, 0xFF, + 0xB4, 0xFF, 0x29, 0xF5, 0x3F, 0xF0, 0x24, 0xF2, 0x44, 0x43, 0x40, 0x44, 0x00, 0xF4, 0xF3, 0x60, + 0xA0, 0x65, 0x10, 0x62, 0x5A, 0xD2, 0xD9, 0x81, 0xD4, 0x80, 0xFF, 0xFF, 0xFB, 0x02, 0x61, 0x45, + 0x24, 0x44, 0xD4, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xFD, 0xA5, 0x48, 0x60, 0x00, 0x64, + 0xC4, 0x9D, 0x0D, 0x60, 0x00, 0x6B, 0x24, 0x44, 0xC0, 0x83, 0xBB, 0xFF, 0x29, 0xF5, 0x01, 0xE1, + 0x00, 0xF4, 0x6C, 0x61, 0x10, 0x62, 0x05, 0x00, 0x00, 0xF4, 0x01, 0xF2, 0xFF, 0xFF, 0x60, 0x41, + 0x04, 0x62, 0xA1, 0xFF, 0xFF, 0xFF, 0x01, 0x10, 0x1A, 0x00, 0x26, 0x44, 0x01, 0x26, 0x0C, 0x00, + 0x24, 0x44, 0xC8, 0x84, 0x40, 0x44, 0x02, 0x03, 0x6C, 0x45, 0xF3, 0x01, 0x03, 0x15, 0x01, 0x64, + 0x05, 0xFA, 0x15, 0x00, 0x6C, 0x45, 0xED, 0x01, 0x23, 0x44, 0xC8, 0x84, 0x40, 0x43, 0x02, 0x03, + 0x6C, 0x45, 0xE7, 0x01, 0x00, 0x64, 0x01, 0x15, 0x01, 0x64, 0x6C, 0x45, 0x05, 0xFB, 0xE2, 0xD2, + 0xDA, 0x82, 0xC9, 0x81, 0x60, 0x4C, 0xDD, 0x1C, 0xD7, 0x03, 0xBC, 0xFF, 0xDA, 0x01, 0x00, 0xE1, + 0xD5, 0xFE, 0xA1, 0xFF, 0xFF, 0xFF, 0x08, 0xE1, 0xA1, 0xFF, 0x67, 0x4C, 0x43, 0xFF, 0xAD, 0x4F, + 0x02, 0xBC, 0x00, 0x7F, 0xA0, 0x5D, 0x01, 0xE1, 0x01, 0x60, 0x69, 0x6B, 0xA5, 0x60, 0xC4, 0x64, + 0x60, 0x4C, 0xBB, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x60, 0x4C, 0xA1, 0xFF, 0xFF, 0xFF, 0x60, 0x4C, + 0xFC, 0x01, 0x29, 0xF3, 0x2A, 0xF1, 0x07, 0xB5, 0x04, 0xE1, 0x65, 0x41, 0x64, 0x54, 0xCD, 0xE2, + 0x95, 0x81, 0xA1, 0x5D, 0xA1, 0xFF, 0xFF, 0xFF, 0xF9, 0x01, 0x00, 0xE1, 0x30, 0x40, 0x02, 0x36, + 0xA1, 0xFF, 0x83, 0xFF, 0x8D, 0xFF, 0x5C, 0x44, 0x5C, 0x43, 0x5C, 0x42, 0x5C, 0x41, 0x5C, 0x40, + 0xAC, 0xFF, 0xAD, 0xFF, 0xE7, 0xE1, 0xB1, 0x60, 0xC0, 0x78, 0xFF, 0xFF, 0x10, 0x61, 0x7F, 0x60, + 0xC0, 0x64, 0xA0, 0x80, 0x7F, 0x67, 0x02, 0x63, 0x26, 0x02, 0x98, 0xFE, 0x1A, 0x05, 0x1B, 0x60, + 0xB8, 0x62, 0xA2, 0xD5, 0x0E, 0xF2, 0x15, 0x18, 0x02, 0x18, 0x09, 0xF4, 0xFB, 0x01, 0x23, 0x44, + 0x00, 0xA8, 0x08, 0x7E, 0x0A, 0x02, 0x66, 0x44, 0x11, 0xFB, 0x46, 0x43, 0x23, 0x47, 0x80, 0xBF, + 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, 0x08, 0xB9, 0x10, 0x7E, 0x00, 0x7F, 0x0E, 0xFA, 0x00, 0x67, + 0x0A, 0x00, 0x20, 0x44, 0xDC, 0x85, 0x0F, 0xB4, 0xF6, 0xA0, 0x7F, 0x67, 0x07, 0x63, 0x03, 0x05, + 0x45, 0x40, 0x00, 0x67, 0xD8, 0xFE, 0xFF, 0x27, 0x05, 0xFD, 0x0A, 0x7E, 0x04, 0xFB, 0x61, 0x55, + 0x4A, 0x00, 0x28, 0xFB, 0x01, 0xF3, 0x29, 0xFB, 0x44, 0x46, 0x40, 0x45, 0x10, 0x61, 0x7E, 0x60, + 0xC0, 0x64, 0xA0, 0x80, 0x7F, 0x67, 0x02, 0x63, 0x31, 0x02, 0xB3, 0x60, 0x58, 0x4F, 0x22, 0x78, + 0xFF, 0xFF, 0x7F, 0x67, 0x03, 0x63, 0x2A, 0x02, 0x26, 0x40, 0x01, 0x2B, 0x24, 0x00, 0x98, 0xFE, + 0x19, 0x05, 0x1B, 0x60, 0xB8, 0x62, 0xA2, 0xD5, 0x0E, 0xF2, 0x14, 0x18, 0x02, 0x18, 0x09, 0xF4, + 0xFB, 0x01, 0x23, 0x44, 0x00, 0xA8, 0x08, 0x7E, 0x0A, 0x02, 0x66, 0x44, 0x11, 0xFB, 0x46, 0x43, + 0x23, 0x47, 0x80, 0xBF, 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, 0x08, 0xB9, 0x10, 0x7E, 0x00, 0x7F, + 0x0E, 0xFA, 0x09, 0x00, 0x20, 0x44, 0xDC, 0x85, 0x0F, 0xB4, 0xF6, 0xA0, 0x7F, 0x67, 0x07, 0x63, + 0x05, 0x05, 0x45, 0x40, 0xD8, 0xFE, 0x00, 0x67, 0xD0, 0xFE, 0xD9, 0xFE, 0xFF, 0x27, 0x05, 0xFD, + 0x0B, 0x7E, 0x04, 0xFB, 0x12, 0x60, 0xC8, 0x63, 0xA3, 0xD3, 0xFF, 0xFF, 0x20, 0xB0, 0x80, 0xBC, + 0x08, 0x28, 0xA3, 0xDB, 0x61, 0x55, 0x63, 0x00, 0x04, 0xB5, 0x82, 0xB5, 0x25, 0x02, 0x04, 0x03, + 0x20, 0x44, 0x7F, 0xB4, 0x40, 0x40, 0xA3, 0xD3, 0x99, 0xFE, 0x04, 0x04, 0x02, 0xBC, 0xFE, 0xB4, + 0xA3, 0xDB, 0x56, 0x00, 0xBC, 0xF3, 0x20, 0x40, 0x80, 0x26, 0x52, 0x00, 0xA3, 0xD3, 0xFF, 0xA0, + 0xF8, 0xB4, 0x02, 0x02, 0xA3, 0xDB, 0x1C, 0x00, 0x04, 0xBC, 0xBF, 0xB4, 0xA3, 0xDB, 0x08, 0xB0, + 0x01, 0x64, 0x08, 0x24, 0x02, 0x64, 0x28, 0xFB, 0x20, 0x44, 0x80, 0xBC, 0x40, 0x40, 0xD0, 0xFE, + 0x3F, 0x00, 0xBF, 0xB4, 0xA3, 0xDB, 0x3C, 0x00, 0x40, 0xB0, 0xFF, 0xFF, 0xFA, 0x02, 0xF8, 0xB4, + 0xA3, 0xDB, 0x08, 0xB5, 0x07, 0x7C, 0x01, 0x02, 0xBC, 0xF9, 0x20, 0x44, 0x7F, 0xB4, 0x40, 0x40, + 0x12, 0x60, 0xC8, 0x63, 0xA3, 0xD3, 0xFF, 0xFF, 0x20, 0xB5, 0x07, 0xB5, 0x08, 0x28, 0xC4, 0x02, + 0x99, 0xFE, 0x26, 0x05, 0x20, 0x44, 0x80, 0x26, 0x23, 0x00, 0x20, 0x2A, 0x00, 0x00, 0x40, 0x2A, + 0x1F, 0x00, 0xBF, 0xB4, 0x40, 0x40, 0x09, 0x00, 0xA8, 0xFF, 0x20, 0x44, 0x99, 0xFE, 0x02, 0x05, + 0x80, 0x2A, 0x03, 0x00, 0x40, 0xBC, 0x40, 0x40, 0x13, 0x00, 0x00, 0xF1, 0x80, 0xBC, 0x40, 0x40, + 0x64, 0x44, 0xE0, 0x84, 0xE8, 0x84, 0x0A, 0x36, 0x29, 0x01, 0x0B, 0x36, 0x5A, 0x01, 0x28, 0xFB, + 0x01, 0xF1, 0x29, 0xF9, 0x02, 0xF1, 0x2A, 0xF9, 0x03, 0xF1, 0x2B, 0xF9, 0xD0, 0xFE, 0xAE, 0xFF, + 0xA1, 0xFF, 0xFF, 0xFF, 0x82, 0x3E, 0x75, 0x44, 0x02, 0xB0, 0x01, 0xB0, 0x28, 0x02, 0xDC, 0x02, + 0x04, 0xB0, 0x08, 0xB0, 0x0B, 0x02, 0x20, 0x02, 0x40, 0x26, 0xA7, 0xFF, 0x8C, 0xFF, 0x75, 0x40, + 0x80, 0x2B, 0x01, 0x00, 0xAB, 0xFF, 0x75, 0x44, 0x8D, 0xFF, 0xEA, 0x01, 0x0A, 0xF3, 0xAA, 0xFF, + 0x60, 0x40, 0x20, 0x2B, 0x02, 0x00, 0x60, 0xFF, 0x0D, 0x00, 0x01, 0x26, 0x0C, 0x00, 0xC0, 0x60, + 0x00, 0x7C, 0xA0, 0x84, 0x80, 0x3B, 0x02, 0x00, 0xC0, 0x67, 0x03, 0x00, 0x40, 0x3B, 0x02, 0x00, + 0x00, 0x67, 0x0A, 0xFB, 0xD5, 0x01, 0xD4, 0x01, 0xAB, 0xFF, 0x00, 0x00, 0xD1, 0x01, 0x79, 0x63, + 0xFF, 0xFF, 0xFF, 0x1F, 0xA9, 0xFF, 0x77, 0x44, 0x60, 0x57, 0x10, 0x60, 0x00, 0x75, 0x40, 0x4A, + 0x01, 0x2A, 0x1C, 0x00, 0x24, 0x44, 0xAC, 0x86, 0x08, 0xF2, 0x18, 0x03, 0x1B, 0x60, 0xBE, 0x65, + 0xD4, 0x80, 0x0E, 0xF2, 0x02, 0x03, 0xA5, 0xD5, 0x04, 0x00, 0x01, 0xBC, 0x0E, 0xFA, 0x09, 0xF4, + 0xD1, 0xFE, 0x46, 0x44, 0x0B, 0x18, 0x66, 0x44, 0x10, 0xFB, 0x66, 0x47, 0x20, 0xBF, 0x3B, 0x42, + 0x04, 0xA2, 0xA2, 0xDB, 0x0E, 0xF2, 0x01, 0x75, 0x10, 0xBC, 0x0E, 0xFA, 0x2A, 0x44, 0x08, 0x2A, + 0x18, 0x00, 0x23, 0x44, 0x00, 0xA8, 0x5C, 0x43, 0x14, 0x03, 0x1B, 0x60, 0xB8, 0x62, 0xA2, 0xD5, + 0x01, 0x00, 0x09, 0xF4, 0x0E, 0xF2, 0x0D, 0x18, 0x08, 0xB0, 0x18, 0xAC, 0xFA, 0x03, 0x0E, 0xFA, + 0x66, 0x43, 0x11, 0xFD, 0x46, 0x43, 0x23, 0x47, 0x80, 0xBF, 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, + 0x08, 0x75, 0x2A, 0x44, 0x06, 0x22, 0x2D, 0x00, 0x22, 0x44, 0x00, 0xA8, 0x60, 0x46, 0x0E, 0xF2, + 0x28, 0x03, 0x10, 0xB0, 0x01, 0xBC, 0x03, 0x02, 0x00, 0x64, 0x40, 0x42, 0x22, 0x00, 0x0E, 0xFA, + 0xD1, 0xFE, 0x1B, 0x60, 0xB2, 0x64, 0x40, 0x47, 0x58, 0x4F, 0x80, 0x00, 0x46, 0x42, 0x19, 0x02, + 0x22, 0x47, 0x40, 0xBF, 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, 0x23, 0xF2, 0x66, 0x43, 0x00, 0xA8, + 0x0E, 0xF2, 0x08, 0x02, 0x60, 0x40, 0x02, 0x2A, 0xE4, 0x01, 0x12, 0xFD, 0x10, 0x64, 0x0E, 0xFA, + 0x02, 0x75, 0x07, 0x00, 0x60, 0x40, 0x04, 0x2A, 0xDC, 0x01, 0x12, 0xFD, 0x10, 0x64, 0x0E, 0xFA, + 0x04, 0x75, 0x2A, 0x44, 0x80, 0x2A, 0x19, 0x00, 0x21, 0x44, 0xAC, 0x86, 0x0E, 0xF2, 0x15, 0x03, + 0x01, 0xBC, 0x0E, 0xFA, 0xD1, 0xFE, 0x1B, 0x60, 0xCA, 0x64, 0x40, 0x47, 0x58, 0x4F, 0x56, 0x00, + 0x46, 0x41, 0x0B, 0x02, 0x21, 0x47, 0x10, 0xBF, 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, 0x0E, 0xF2, + 0x66, 0x43, 0x08, 0xFD, 0x10, 0xBC, 0x0E, 0xFA, 0x80, 0x75, 0x2A, 0x44, 0x10, 0xB0, 0x20, 0x44, + 0x15, 0x03, 0x7F, 0xB4, 0x40, 0x40, 0x12, 0x60, 0xC8, 0x63, 0xA3, 0xD3, 0xFF, 0xFF, 0x20, 0xB0, + 0x80, 0xB0, 0x09, 0x03, 0x08, 0x03, 0x40, 0xBC, 0x7F, 0xB4, 0x04, 0xB0, 0xA3, 0xDB, 0x03, 0x03, + 0x20, 0x44, 0x80, 0xBC, 0x40, 0x40, 0xB1, 0x60, 0x90, 0x78, 0xFF, 0xFF, 0xB1, 0x60, 0xC0, 0x78, + 0xFF, 0xFF, 0xE8, 0xFE, 0x14, 0x05, 0xEA, 0xFE, 0x24, 0x05, 0xE9, 0xFE, 0x1C, 0x05, 0xE7, 0xFE, + 0x09, 0x05, 0x47, 0xFF, 0x20, 0x44, 0x0F, 0x22, 0x03, 0x00, 0xCC, 0x84, 0x40, 0x40, 0x0F, 0x22, + 0xB8, 0xFE, 0xEC, 0x01, 0x23, 0x41, 0x00, 0xB9, 0x5C, 0x4A, 0xE8, 0x02, 0x6E, 0x01, 0x24, 0x41, + 0x00, 0xB9, 0x1B, 0x60, 0xBE, 0x65, 0x45, 0x47, 0xE1, 0x02, 0x58, 0x4F, 0x0F, 0x00, 0xDE, 0x02, + 0x5C, 0x4A, 0x46, 0x44, 0x50, 0x01, 0x22, 0x41, 0x00, 0xB9, 0x5C, 0x4A, 0x08, 0x24, 0x81, 0x01, + 0xD5, 0x01, 0x21, 0x41, 0x00, 0xB9, 0x5C, 0x4A, 0xA6, 0x03, 0xD0, 0x01, 0x27, 0xD3, 0x03, 0x00, + 0x10, 0xB0, 0x09, 0xF2, 0x04, 0x03, 0xAC, 0x86, 0x0E, 0xF2, 0xFA, 0x02, 0x08, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x0E, 0xF3, 0x0F, 0x60, 0xFE, 0x65, 0x0C, 0xF3, 0x24, 0x86, 0x24, 0x46, 0x60, 0x40, + 0xFB, 0x3B, 0x07, 0x00, 0x80, 0x26, 0x02, 0x00, 0x23, 0x46, 0x03, 0x4C, 0x46, 0x61, 0x3A, 0x65, + 0x0C, 0x00, 0x2E, 0xF3, 0x40, 0x45, 0xF8, 0x2B, 0x02, 0x00, 0x40, 0x45, 0x03, 0x00, 0x58, 0x4F, + 0x39, 0x00, 0x07, 0x02, 0x58, 0x4F, 0x45, 0x00, 0x04, 0x05, 0x66, 0x50, 0x65, 0x52, 0x61, 0x51, + 0x09, 0x00, 0x26, 0x47, 0x00, 0xBF, 0x0E, 0xFB, 0x2E, 0xF5, 0x05, 0xF0, 0x80, 0x60, 0x64, 0x50, + 0x00, 0x72, 0x7E, 0x71, 0xAC, 0xFF, 0xB1, 0x60, 0xC0, 0x78, 0xFF, 0xFF, 0x8E, 0xFF, 0x0F, 0xF3, + 0x0F, 0x60, 0xFE, 0x65, 0x24, 0x86, 0x0D, 0xF3, 0x2E, 0xF3, 0x40, 0x45, 0xF8, 0x2B, 0x02, 0x00, + 0x40, 0x45, 0x03, 0x00, 0x58, 0x4F, 0x16, 0x00, 0x07, 0x02, 0x58, 0x4F, 0x22, 0x00, 0x04, 0x05, + 0x66, 0x50, 0x65, 0x52, 0x61, 0x51, 0x09, 0x00, 0x26, 0x47, 0x00, 0xBF, 0x0F, 0xFB, 0x2E, 0xF5, + 0x05, 0xF0, 0x80, 0x60, 0x64, 0x50, 0x00, 0x72, 0x7E, 0x71, 0x8D, 0xFF, 0xAD, 0xFF, 0xB1, 0x60, + 0xC0, 0x78, 0xFF, 0xFF, 0x25, 0x44, 0x8A, 0xF1, 0x8B, 0xF1, 0xD0, 0x80, 0xD0, 0x80, 0x07, 0x04, + 0x01, 0x06, 0x05, 0x00, 0x25, 0x46, 0x01, 0xF0, 0x03, 0x67, 0xA0, 0x85, 0x94, 0x80, 0x2F, 0x58, + 0xFF, 0xFF, 0x25, 0x46, 0x26, 0x41, 0x46, 0x63, 0x01, 0xF2, 0xFF, 0xFF, 0xFF, 0xB5, 0xD5, 0x81, + 0x00, 0xF2, 0x05, 0x04, 0x04, 0x63, 0x60, 0x46, 0xF7, 0x1B, 0x42, 0xFE, 0x0D, 0x00, 0x61, 0x44, + 0xC5, 0x81, 0x63, 0x45, 0xC5, 0x81, 0x9C, 0x84, 0xDC, 0x84, 0x01, 0xF2, 0xF0, 0x85, 0xF0, 0x80, + 0x65, 0x44, 0xF8, 0x85, 0xFF, 0xFF, 0x02, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xA2, 0xFF, 0x1B, 0x60, + 0xD0, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xAC, 0x86, 0x0E, 0xF2, 0x07, 0x03, 0x00, 0xA8, 0x09, 0xF2, + 0xFA, 0x02, 0x01, 0x67, 0x0E, 0xFA, 0x08, 0xFE, 0x17, 0x00, 0x8C, 0xF3, 0xFF, 0xFF, 0xD8, 0xA0, + 0x00, 0xB4, 0x12, 0x06, 0x09, 0x60, 0x08, 0x61, 0x41, 0x4A, 0x7C, 0xA1, 0x0E, 0xA1, 0xA2, 0xFF, + 0xB3, 0x60, 0x58, 0x4E, 0x97, 0x78, 0xFF, 0xFF, 0xA3, 0xFF, 0x06, 0x03, 0x2A, 0x43, 0xB3, 0x60, + 0x58, 0x4E, 0xB8, 0x78, 0xFF, 0xFF, 0x08, 0xFE, 0xA3, 0xFF, 0x2D, 0x58, 0xFF, 0xFF, 0x41, 0x4A, + 0x7C, 0xA1, 0x0E, 0xA1, 0xA2, 0xFF, 0xB3, 0x60, 0x58, 0x4E, 0x97, 0x78, 0xFF, 0xFF, 0x07, 0x03, + 0x2A, 0x43, 0xB3, 0x60, 0x58, 0x4E, 0xB8, 0x78, 0xFF, 0xFF, 0x08, 0xFE, 0x0D, 0x00, 0x1B, 0x60, + 0xD0, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xAC, 0x86, 0x0E, 0xF2, 0x06, 0x03, 0x00, 0xA8, 0x09, 0xF2, + 0xFA, 0x02, 0x01, 0x67, 0x0E, 0xFA, 0x08, 0xFE, 0xA3, 0xFF, 0x2D, 0x58, 0xFF, 0xFF, 0x8D, 0xF3, + 0x7C, 0x63, 0x00, 0xBE, 0x40, 0x45, 0x1A, 0x03, 0x00, 0x65, 0x65, 0x44, 0xDC, 0x85, 0x84, 0xA1, + 0x00, 0xF2, 0x06, 0x06, 0x01, 0xFC, 0x00, 0xA8, 0x60, 0x46, 0xF7, 0x02, 0x40, 0x45, 0x0E, 0x00, + 0x8C, 0xF3, 0x00, 0x63, 0xD4, 0x84, 0x8C, 0xFB, 0x80, 0x60, 0x7C, 0x64, 0x01, 0xFA, 0x00, 0xF0, + 0x00, 0xFC, 0xD3, 0x80, 0x8D, 0xF9, 0x02, 0x02, 0x8E, 0xF9, 0x08, 0xFE, 0x2E, 0x58, 0xFF, 0xFF, + 0x66, 0x44, 0x25, 0x46, 0x05, 0xFA, 0x06, 0xFA, 0x01, 0xF0, 0x03, 0x67, 0x02, 0xFC, 0xB0, 0x84, + 0x3A, 0x7E, 0x01, 0xFA, 0x12, 0x64, 0x03, 0xFA, 0x00, 0xF0, 0x04, 0xF8, 0x00, 0x64, 0x0C, 0x61, + 0x10, 0x63, 0x59, 0xDA, 0xFE, 0x1F, 0x2E, 0x58, 0xFF, 0xFF, 0x27, 0x43, 0xE3, 0x81, 0xE9, 0x81, + 0x03, 0x05, 0x16, 0x03, 0x00, 0x61, 0x01, 0x00, 0xE4, 0x63, 0x61, 0x46, 0xBF, 0xD2, 0x27, 0x45, + 0xDC, 0x84, 0xA2, 0xDA, 0xBE, 0xD2, 0x25, 0x46, 0x88, 0xF8, 0x04, 0x1B, 0x25, 0x44, 0x61, 0x46, + 0xA3, 0xDA, 0x04, 0x00, 0x0A, 0xFA, 0x60, 0x46, 0x25, 0x44, 0x09, 0xFA, 0x61, 0x46, 0xBE, 0xDA, + 0x2F, 0x58, 0xFF, 0xFF, 0x25, 0x44, 0x00, 0xA8, 0x07, 0x4B, 0x0C, 0x03, 0x58, 0x4F, 0x33, 0x00, + 0x0B, 0x47, 0x1B, 0x60, 0xC4, 0x65, 0x27, 0x44, 0xD4, 0x80, 0x00, 0x64, 0x01, 0x02, 0x0F, 0xFA, + 0x58, 0x4F, 0xD3, 0x01, 0x70, 0x00, 0x25, 0x43, 0xE3, 0x84, 0x7C, 0x41, 0x02, 0x04, 0xE8, 0x81, + 0xE4, 0x63, 0x61, 0x46, 0xA3, 0xD2, 0x00, 0x7C, 0x40, 0x45, 0xBF, 0xD8, 0xA3, 0xD8, 0xBE, 0xD8, + 0x27, 0x42, 0x5A, 0xD3, 0x25, 0x5C, 0x60, 0x41, 0x02, 0x1B, 0x27, 0xD9, 0x05, 0x00, 0x25, 0x46, + 0x0A, 0xFA, 0x61, 0x46, 0x25, 0x44, 0x09, 0xFA, 0x25, 0x44, 0x27, 0x43, 0x00, 0x61, 0x60, 0x46, + 0x09, 0xF2, 0x08, 0xFC, 0x00, 0xA8, 0xDD, 0x81, 0xFA, 0x02, 0xBF, 0xD1, 0x66, 0x44, 0xBE, 0xDB, + 0xC1, 0x84, 0xBF, 0xDB, 0x48, 0x00, 0x25, 0x46, 0xE4, 0x63, 0x08, 0xF2, 0x89, 0xF2, 0x1E, 0x18, + 0x40, 0x47, 0xE0, 0x84, 0xE8, 0x85, 0x02, 0x05, 0xE8, 0x83, 0x00, 0x65, 0x65, 0x46, 0xBF, 0xD2, + 0x61, 0x5C, 0xCC, 0x84, 0xA2, 0xDA, 0x25, 0x46, 0x0A, 0xF2, 0x00, 0xB9, 0x65, 0x46, 0x08, 0x24, + 0xBE, 0xDA, 0x02, 0x1B, 0xA3, 0xD8, 0x02, 0x00, 0x60, 0x46, 0x89, 0xFA, 0x00, 0xB9, 0x61, 0x46, + 0x08, 0x28, 0x0A, 0xFA, 0x25, 0x46, 0x89, 0xFC, 0x8A, 0xFC, 0x88, 0xFC, 0x2F, 0x58, 0xFF, 0xFF, + 0x00, 0x61, 0x28, 0x65, 0x25, 0x43, 0x8E, 0xF3, 0xAF, 0x83, 0x00, 0xBE, 0x18, 0x03, 0x02, 0x03, + 0x00, 0xFC, 0x01, 0x00, 0x8D, 0xFD, 0x63, 0x46, 0x65, 0x44, 0xCC, 0x85, 0x00, 0xF2, 0x07, 0x02, + 0x8E, 0xF5, 0x00, 0x64, 0x00, 0xFA, 0xDE, 0x60, 0xAF, 0x64, 0x09, 0xFB, 0x08, 0x00, 0x66, 0x43, + 0x00, 0xBE, 0xDD, 0x81, 0xF1, 0x02, 0x8C, 0xF1, 0x8E, 0xFD, 0xC1, 0x84, 0x8C, 0xFB, 0x2E, 0x58, + 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x45, 0x29, 0x43, 0xFC, 0xA3, 0x66, 0x44, 0xBD, 0xDB, 0x25, 0x44, + 0xBD, 0xDB, 0x00, 0x64, 0xBD, 0xDB, 0x03, 0x61, 0x0E, 0x65, 0x1B, 0x60, 0xD8, 0x63, 0x43, 0x49, + 0xA3, 0xD3, 0x06, 0xA3, 0x00, 0xA8, 0xCD, 0x81, 0x04, 0x02, 0xF9, 0x02, 0xB1, 0x60, 0xC0, 0x78, + 0xFF, 0xFF, 0x01, 0x26, 0xE6, 0x01, 0xD4, 0x80, 0x60, 0x45, 0xE3, 0x05, 0xF6, 0xA3, 0xBD, 0xD1, + 0xBD, 0xD1, 0x44, 0x47, 0x44, 0x48, 0x44, 0x45, 0x1C, 0x60, 0x16, 0x64, 0x44, 0xD7, 0xFF, 0xFF, + 0xFF, 0xFF, 0x48, 0xFE, 0x8D, 0xF5, 0x8C, 0xF3, 0x0D, 0x18, 0xCC, 0x84, 0x8C, 0xFB, 0x80, 0x60, + 0x7C, 0x64, 0x01, 0xFA, 0x00, 0x64, 0x00, 0xF0, 0x00, 0xFA, 0xD0, 0x80, 0x8D, 0xF9, 0x02, 0x02, + 0x8E, 0xF9, 0x08, 0xFE, 0x2E, 0x58, 0xFF, 0xFF, 0x1B, 0x60, 0x88, 0x63, 0x0D, 0x65, 0x00, 0x61, + 0x41, 0x48, 0xA3, 0xD3, 0x06, 0xA3, 0xAC, 0x86, 0x00, 0x61, 0x09, 0x03, 0x00, 0xF2, 0x09, 0xF0, + 0xAC, 0x86, 0x00, 0xF2, 0xDD, 0x81, 0xFC, 0x02, 0x64, 0x44, 0xAC, 0x86, 0xF6, 0x01, 0x61, 0x44, + 0x25, 0x46, 0x27, 0xDA, 0x65, 0x44, 0x28, 0x45, 0x45, 0x88, 0xCC, 0x85, 0x5A, 0x87, 0xE9, 0x02, + 0x00, 0x64, 0x27, 0xDA, 0x5A, 0xDA, 0x5A, 0x87, 0x88, 0xF3, 0x87, 0xF1, 0x02, 0xA4, 0x60, 0x46, + 0x60, 0x45, 0x00, 0x61, 0x1E, 0xF2, 0xFF, 0xFF, 0xAC, 0x86, 0x00, 0xF2, 0x04, 0x03, 0xAC, 0x86, + 0x00, 0xF2, 0xDD, 0x81, 0xFC, 0x02, 0x65, 0x44, 0x02, 0xA5, 0x65, 0x46, 0x64, 0x44, 0xCC, 0x9C, + 0xFF, 0xFF, 0xF0, 0x02, 0x61, 0x44, 0x25, 0x46, 0x27, 0xDA, 0x5A, 0x87, 0x28, 0x45, 0x45, 0x88, + 0x88, 0xF3, 0x87, 0xF1, 0x02, 0xA4, 0x60, 0x46, 0x60, 0x45, 0x00, 0x61, 0x72, 0xF2, 0xFF, 0xFF, + 0xAC, 0x86, 0x00, 0xF2, 0x09, 0x03, 0x00, 0xF2, 0x09, 0xF0, 0xAC, 0x86, 0x00, 0xF2, 0xDD, 0x81, + 0xFC, 0x02, 0x64, 0x44, 0xAC, 0x86, 0xF6, 0x01, 0x65, 0x44, 0x02, 0xA5, 0x65, 0x46, 0x64, 0x44, + 0xCC, 0x9C, 0x61, 0x44, 0xEB, 0x02, 0x25, 0x46, 0x27, 0xDA, 0x5A, 0x87, 0x28, 0x45, 0x45, 0x88, + 0x06, 0x60, 0x40, 0x65, 0x8D, 0xF3, 0x01, 0x61, 0xAC, 0x86, 0x00, 0xF2, 0x03, 0x03, 0xD5, 0x80, + 0xDD, 0x81, 0xFA, 0x04, 0xCD, 0x84, 0x25, 0x46, 0x27, 0xDA, 0x28, 0x45, 0xC4, 0x84, 0x5A, 0xDA, + 0xDA, 0x81, 0x8C, 0xF1, 0x59, 0xD8, 0x1B, 0x60, 0x86, 0x64, 0x18, 0x63, 0xA0, 0xD1, 0x06, 0xA4, + 0x59, 0xD8, 0xFC, 0x1F, 0x00, 0x64, 0x59, 0xDA, 0x59, 0xDA, 0x01, 0x60, 0x1C, 0x64, 0x0A, 0x63, + 0x58, 0xD1, 0x59, 0xD8, 0xFD, 0x1F, 0x7E, 0xF1, 0x59, 0xD8, 0x45, 0x01, 0x07, 0x4B, 0xB4, 0x60, + 0x58, 0x4F, 0x23, 0x78, 0xFF, 0xFF, 0x0B, 0x47, 0x58, 0x4F, 0x21, 0x00, 0x3C, 0x01, 0x07, 0x4B, + 0xB4, 0x60, 0x58, 0x4F, 0x23, 0x78, 0xFF, 0xFF, 0x0B, 0x47, 0x27, 0x44, 0x00, 0xBE, 0x08, 0xF0, + 0x15, 0x03, 0x64, 0x42, 0x4A, 0xD3, 0x09, 0xF2, 0xDC, 0x83, 0xA2, 0xDD, 0x25, 0x43, 0x09, 0xFC, + 0x63, 0x46, 0x27, 0x43, 0x0A, 0xFC, 0x09, 0xFA, 0x08, 0xF8, 0x00, 0xA8, 0x66, 0x43, 0x03, 0x02, + 0x64, 0x44, 0x58, 0xDD, 0x03, 0x00, 0x60, 0x46, 0x25, 0x44, 0x0A, 0xFA, 0x1C, 0x01, 0x27, 0x43, + 0xE3, 0x81, 0xE9, 0x81, 0x03, 0x05, 0x16, 0x03, 0x00, 0x61, 0x01, 0x00, 0xE4, 0x63, 0x61, 0x46, + 0xBF, 0xD2, 0x27, 0x45, 0xDC, 0x84, 0xA2, 0xDA, 0xA3, 0xD2, 0x25, 0x46, 0x88, 0xF8, 0x04, 0x1B, + 0x25, 0x44, 0x61, 0x46, 0xBE, 0xDA, 0x04, 0x00, 0x09, 0xFA, 0x60, 0x46, 0x25, 0x44, 0x0A, 0xFA, + 0x61, 0x46, 0xA3, 0xDA, 0x2F, 0x58, 0xFF, 0xFF, 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, 0x03, 0x02, + 0x28, 0xE2, 0x40, 0xFF, 0xA1, 0xFF, 0x84, 0xFF, 0xBF, 0x60, 0xAD, 0x64, 0x40, 0x42, 0xB5, 0x60, + 0xA2, 0x64, 0x40, 0x40, 0x9D, 0xF3, 0x66, 0xFB, 0x0F, 0x60, 0x9A, 0x63, 0xAA, 0xF3, 0xBD, 0xDB, + 0x00, 0x60, 0x9A, 0x64, 0xBD, 0xDB, 0x02, 0x64, 0xBD, 0xDB, 0x04, 0x64, 0xA3, 0xDB, 0x5C, 0x49, + 0x0A, 0x64, 0x40, 0x4B, 0x5C, 0x5C, 0x01, 0x60, 0x39, 0xE2, 0x04, 0x60, 0x00, 0x7A, 0x89, 0xFF, + 0x03, 0x60, 0xFF, 0x73, 0x88, 0xFF, 0xB5, 0x60, 0xA2, 0x78, 0xFF, 0xFF, 0xA0, 0xFE, 0x07, 0x05, + 0xA3, 0xFE, 0x07, 0x05, 0xA1, 0xFE, 0x50, 0x05, 0x60, 0x64, 0x3B, 0xDB, 0x10, 0x00, 0x20, 0x58, + 0xFF, 0xFF, 0xFA, 0x01, 0x12, 0x60, 0xCC, 0x63, 0xA3, 0xD3, 0xFF, 0xFF, 0xFB, 0xB4, 0xA3, 0xDB, + 0xA0, 0x4C, 0x59, 0xBC, 0xFF, 0xB4, 0xA0, 0x51, 0xA0, 0x4C, 0x7D, 0xB4, 0xA0, 0x51, 0xA1, 0xFF, + 0xFF, 0xFF, 0x83, 0x3E, 0x40, 0x60, 0x0B, 0x65, 0x2B, 0x44, 0x00, 0x63, 0xE8, 0x80, 0xF8, 0x84, + 0x02, 0x24, 0x94, 0x84, 0xF3, 0x83, 0xCD, 0x81, 0xFF, 0xFF, 0xF8, 0x02, 0xDF, 0x83, 0x2F, 0x58, + 0x40, 0x4B, 0x00, 0x62, 0x01, 0x64, 0xD4, 0x80, 0xE0, 0x84, 0x1A, 0x03, 0xD4, 0x80, 0xE0, 0x84, + 0x15, 0x03, 0x61, 0x44, 0x11, 0x61, 0xE0, 0x84, 0xCD, 0x81, 0xFD, 0x04, 0x01, 0x00, 0xE0, 0x84, + 0xF2, 0x82, 0xFF, 0xFF, 0x02, 0x24, 0xC6, 0x82, 0x02, 0x28, 0xD6, 0x82, 0xE2, 0x80, 0xCD, 0x81, + 0x02, 0x28, 0x01, 0xBC, 0xF4, 0x02, 0x01, 0x2A, 0xC6, 0x82, 0x03, 0x00, 0xE9, 0x81, 0xF2, 0x82, + 0x61, 0x44, 0x2D, 0x58, 0xFF, 0xFF, 0x00, 0xA8, 0x10, 0x61, 0x04, 0x03, 0xF0, 0x84, 0xCD, 0x81, + 0xFD, 0x04, 0x61, 0x44, 0x2D, 0x58, 0xFF, 0xFF, 0x00, 0x64, 0x3B, 0xDB, 0x16, 0x60, 0xA8, 0x63, + 0xBD, 0xD3, 0xA3, 0xD1, 0x60, 0x40, 0x04, 0x3A, 0x2D, 0x00, 0x00, 0x64, 0x4A, 0xDB, 0x1B, 0x60, + 0x88, 0x63, 0xA3, 0xD3, 0x46, 0x43, 0xAC, 0x86, 0x3C, 0x45, 0x23, 0x03, 0xD4, 0x80, 0x07, 0xF2, + 0x02, 0x02, 0x09, 0xF2, 0xF8, 0x01, 0xD0, 0x80, 0x09, 0xF2, 0xF5, 0x02, 0x60, 0x43, 0x80, 0x67, + 0xB0, 0x81, 0x1B, 0x60, 0xDA, 0x62, 0x61, 0x44, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x09, 0x60, 0x08, 0x65, 0x0E, 0xF2, 0x02, 0xF2, 0x60, 0x40, + 0xF0, 0x37, 0x05, 0x00, 0x90, 0xF3, 0xD4, 0x80, 0xCC, 0x84, 0x01, 0x02, 0x90, 0xFB, 0x63, 0x44, + 0xDA, 0x01, 0x23, 0x46, 0x3C, 0x44, 0xAC, 0x80, 0xFF, 0xFF, 0x89, 0x02, 0x6A, 0xF3, 0x6B, 0xF3, + 0x02, 0xA8, 0x02, 0xA8, 0x08, 0x02, 0x00, 0x64, 0x6C, 0xFB, 0x6A, 0xFB, 0x6B, 0xFB, 0x00, 0x64, + 0x6D, 0xFB, 0xCA, 0xFE, 0x97, 0x00, 0x03, 0x02, 0x00, 0x64, 0x6B, 0xFB, 0xCA, 0xFE, 0x01, 0x64, + 0x3B, 0xDB, 0x1B, 0x60, 0x8E, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x35, 0x03, + 0x2C, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x26, 0x8A, 0x00, 0x2E, 0xF2, 0x12, 0x60, 0xCE, 0x65, + 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, + 0x16, 0x18, 0x61, 0x46, 0x2E, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, + 0x2D, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x2C, 0xF0, 0x63, 0x46, + 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0x88, 0xF3, + 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x63, 0x02, 0x66, 0x45, 0x63, 0x46, 0x06, 0xF2, 0x65, 0x46, + 0x80, 0xB0, 0x09, 0xF2, 0x5C, 0x03, 0xAC, 0x86, 0xCA, 0x01, 0x6B, 0xF3, 0xFF, 0xFF, 0x01, 0xA8, + 0xFF, 0xFF, 0x50, 0x02, 0x1B, 0x60, 0xA0, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, + 0x0F, 0x03, 0x77, 0xF1, 0x07, 0xF2, 0xFF, 0xFF, 0xD0, 0x80, 0x09, 0xF2, 0x03, 0x02, 0xAC, 0x86, + 0x07, 0xF2, 0xFA, 0x02, 0x03, 0x02, 0x00, 0x64, 0x77, 0xFB, 0xEC, 0x01, 0x46, 0x5C, 0x3F, 0x00, + 0x1B, 0x60, 0xA6, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x01, 0x03, 0x37, 0x02, + 0x6C, 0xF3, 0xFF, 0xFF, 0x01, 0xA8, 0xFF, 0xFF, 0x14, 0x02, 0x1B, 0x60, 0x94, 0x62, 0xA2, 0xD3, + 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x0B, 0x03, 0x2A, 0xF0, 0x20, 0x67, 0x09, 0xF2, 0xB0, 0x83, + 0x00, 0xA8, 0x00, 0x64, 0x02, 0x03, 0x2A, 0xFC, 0x01, 0x00, 0x6C, 0xFB, 0x20, 0x00, 0x00, 0x64, + 0x6C, 0xFB, 0x1B, 0x60, 0x88, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x12, 0x03, + 0x2A, 0xF0, 0x08, 0x67, 0xA0, 0x80, 0xFF, 0xFF, 0x12, 0x03, 0x77, 0xF1, 0x07, 0xF2, 0xFF, 0xFF, + 0xD0, 0x80, 0x09, 0xF2, 0x03, 0x02, 0xAC, 0x86, 0x07, 0xF2, 0xFA, 0x02, 0x08, 0x02, 0x00, 0x64, + 0x77, 0xFB, 0xE7, 0x01, 0x00, 0x64, 0x77, 0xFB, 0xB5, 0x60, 0xA2, 0x78, 0xFF, 0xFF, 0x66, 0x44, + 0xFC, 0xFB, 0x46, 0x5C, 0x21, 0x60, 0x98, 0x63, 0xA3, 0xD3, 0xB5, 0x60, 0x58, 0x4D, 0xE3, 0x78, + 0xFF, 0xFF, 0x0D, 0xF2, 0x60, 0x5C, 0x64, 0x5F, 0x0D, 0xFA, 0x07, 0xF0, 0x2A, 0xF2, 0xFF, 0xFF, + 0x77, 0xF9, 0x60, 0x40, 0x08, 0x2B, 0x05, 0x00, 0x00, 0x64, 0x48, 0xFB, 0xB8, 0x60, 0x2D, 0x78, + 0xFF, 0xFF, 0x00, 0x64, 0xD0, 0x80, 0x88, 0xF3, 0x07, 0x02, 0x23, 0xF0, 0x04, 0x64, 0xB0, 0x84, + 0xA2, 0xDA, 0xBD, 0x60, 0x28, 0x78, 0xFF, 0xFF, 0xD0, 0x80, 0xB8, 0xF3, 0x03, 0x03, 0x60, 0x40, + 0x03, 0x3A, 0x00, 0x00, 0x2A, 0xF2, 0x00, 0x63, 0x40, 0x47, 0x50, 0x36, 0x01, 0x00, 0x01, 0x63, + 0x48, 0xFD, 0x4A, 0xF3, 0x35, 0xFA, 0x10, 0xA4, 0x4A, 0xFB, 0x00, 0x64, 0x15, 0xFA, 0x16, 0xFA, + 0x0F, 0xFA, 0xFF, 0xFF, 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, 0x0E, 0xF0, 0x63, 0x46, 0x00, 0x7F, + 0x64, 0x5E, 0x4B, 0xFB, 0x64, 0x44, 0x00, 0x7E, 0xBB, 0xFB, 0x07, 0xF0, 0x88, 0xF3, 0xFF, 0xFF, + 0xD0, 0x80, 0xFF, 0xFF, 0x03, 0x03, 0xBB, 0xF3, 0xBA, 0xFB, 0x60, 0x41, 0x03, 0xF2, 0x00, 0xF4, + 0x01, 0xF2, 0xFC, 0xA5, 0x00, 0x7F, 0xD4, 0x84, 0x27, 0x45, 0x3C, 0x46, 0x1A, 0xFA, 0x22, 0x63, + 0x7B, 0x60, 0xFF, 0x64, 0xA4, 0x84, 0x03, 0x2B, 0x1C, 0x63, 0x2A, 0xFA, 0x60, 0x40, 0xA4, 0x36, + 0x14, 0x63, 0x43, 0x4C, 0x00, 0x7C, 0x22, 0xF8, 0x64, 0x41, 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, + 0x36, 0xF2, 0x63, 0x46, 0xFF, 0xB4, 0x22, 0xFA, 0x60, 0x40, 0x00, 0x36, 0x8E, 0x00, 0x2A, 0xF2, + 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x3A, 0x89, 0x00, 0x03, 0xF2, 0x00, 0xF4, 0xA0, 0xD2, 0xAA, 0x60, + 0xAA, 0x65, 0x5A, 0xD0, 0xD4, 0x80, 0x03, 0x64, 0x0A, 0x02, 0xD0, 0x80, 0x00, 0x64, 0x5A, 0xD0, + 0x06, 0x02, 0xD0, 0x80, 0xF8, 0x7F, 0xD0, 0x80, 0x01, 0x03, 0x01, 0x02, 0x01, 0x61, 0x62, 0x43, + 0x46, 0x43, 0x3C, 0x46, 0x07, 0xF4, 0x36, 0xF2, 0xFF, 0xFF, 0xA3, 0x46, 0x60, 0x40, 0x22, 0x26, + 0x45, 0x00, 0x60, 0x45, 0x63, 0x42, 0x5A, 0xD0, 0xCD, 0x81, 0x3C, 0x46, 0x14, 0x02, 0x64, 0x44, + 0x88, 0x3A, 0x11, 0x00, 0x8E, 0x3B, 0x0F, 0x00, 0x65, 0x44, 0x01, 0x26, 0x5E, 0x00, 0x04, 0x26, + 0x03, 0x00, 0x10, 0x26, 0x01, 0x00, 0x2D, 0x00, 0xA3, 0x46, 0x37, 0xF2, 0xFF, 0xFF, 0x60, 0x40, + 0x80, 0x2B, 0x53, 0x00, 0x3A, 0x00, 0xA3, 0x46, 0x65, 0x44, 0x01, 0x26, 0x0B, 0x00, 0x04, 0x26, + 0x03, 0x00, 0x10, 0x26, 0x01, 0x00, 0x1D, 0x00, 0x37, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x27, + 0x2C, 0x00, 0x17, 0x00, 0x88, 0xF3, 0xFF, 0xFF, 0x60, 0x46, 0x36, 0xF2, 0x66, 0x43, 0xFF, 0xB4, + 0x3C, 0x46, 0x22, 0xF0, 0x60, 0x47, 0xB0, 0x84, 0x22, 0xFA, 0x63, 0x46, 0x37, 0xF0, 0x60, 0x40, + 0x04, 0x27, 0x03, 0x00, 0x10, 0x27, 0x01, 0x00, 0x04, 0x00, 0x64, 0x40, 0x80, 0x27, 0x15, 0x00, + 0x00, 0x00, 0x3C, 0x46, 0x02, 0x65, 0xBC, 0x60, 0x58, 0x78, 0xFF, 0xFF, 0xCD, 0x81, 0x63, 0x42, + 0x5A, 0xD0, 0x3C, 0x46, 0x0A, 0x02, 0x64, 0x44, 0x88, 0x3A, 0x07, 0x00, 0x77, 0x37, 0x1D, 0x00, + 0x78, 0x37, 0x1B, 0x00, 0x8E, 0x37, 0x19, 0x00, 0xF1, 0x01, 0x3C, 0x46, 0x22, 0xF0, 0x80, 0x67, + 0xB0, 0x84, 0xA2, 0xDA, 0xFF, 0xFF, 0x3F, 0xF2, 0x3E, 0xF0, 0x08, 0xA4, 0x60, 0x41, 0x22, 0xF2, + 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x26, 0x03, 0x00, 0x04, 0x26, 0x03, 0x00, 0x06, 0x00, 0x04, 0x2B, + 0x04, 0x00, 0x61, 0x44, 0x64, 0x40, 0x10, 0x26, 0x3F, 0xFA, 0x3C, 0x46, 0x2C, 0xF2, 0x27, 0x40, + 0x01, 0x27, 0x32, 0xF2, 0xB5, 0xF1, 0x60, 0x40, 0x01, 0x26, 0x53, 0x00, 0x09, 0x60, 0x00, 0x64, + 0xD0, 0x80, 0x3F, 0xF2, 0x09, 0x06, 0x2C, 0x45, 0xC4, 0x84, 0xD0, 0x80, 0x40, 0x4A, 0x40, 0x06, + 0x60, 0x43, 0x64, 0x44, 0x54, 0x88, 0x18, 0x00, 0x60, 0x45, 0x1F, 0x60, 0x9C, 0x64, 0xA0, 0xD3, + 0xBB, 0xF3, 0x00, 0xBC, 0x60, 0x47, 0xEC, 0xA0, 0x33, 0x03, 0x32, 0x07, 0x2C, 0x44, 0xC4, 0x81, + 0x02, 0x60, 0x1C, 0x65, 0x45, 0x4A, 0xD5, 0x80, 0x2C, 0x45, 0x2A, 0x06, 0x27, 0x40, 0x04, 0x27, + 0x30, 0x00, 0x2A, 0x43, 0xD7, 0x85, 0x45, 0x48, 0xB6, 0xF1, 0x0F, 0xF2, 0xD3, 0x80, 0x01, 0x65, + 0x01, 0x07, 0x00, 0x65, 0xB4, 0x84, 0x0F, 0xFA, 0x00, 0x63, 0x3F, 0xF2, 0x28, 0x45, 0x60, 0x41, + 0xD4, 0x84, 0xDF, 0x83, 0xFC, 0x07, 0x14, 0xFC, 0x61, 0x44, 0x01, 0x36, 0x02, 0x00, 0x09, 0x3A, + 0x06, 0x00, 0x28, 0x44, 0x48, 0x88, 0x2A, 0x44, 0xC8, 0x83, 0x43, 0x4A, 0xE5, 0x01, 0x17, 0xFA, + 0x04, 0x60, 0x00, 0x64, 0x27, 0x45, 0xB4, 0x84, 0x2A, 0xFA, 0x28, 0x43, 0x16, 0xFC, 0x0D, 0x00, + 0x3F, 0xF2, 0x2C, 0x45, 0xB6, 0xF1, 0xC4, 0x81, 0xD1, 0x80, 0x0F, 0xF2, 0x01, 0x06, 0x01, 0xBC, + 0x0F, 0xFA, 0x3F, 0xF2, 0x17, 0xFA, 0x01, 0x64, 0x14, 0xFA, 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, + 0x0E, 0xF0, 0x63, 0x46, 0x00, 0x7F, 0x64, 0x5E, 0x4B, 0xFB, 0x64, 0x44, 0x00, 0x7E, 0xBB, 0xFB, + 0x62, 0xF1, 0x60, 0x43, 0x60, 0x47, 0xD0, 0x80, 0xC0, 0x65, 0x01, 0x06, 0x64, 0x44, 0x0A, 0x36, + 0x70, 0x64, 0x14, 0x36, 0x38, 0x64, 0x37, 0x36, 0x15, 0x64, 0x6E, 0x36, 0x0B, 0x64, 0x44, 0x86, + 0x2A, 0xF2, 0x07, 0xF0, 0x60, 0x40, 0xB0, 0x3A, 0x03, 0x00, 0x40, 0x3B, 0x01, 0x00, 0x12, 0x00, + 0x0C, 0xB4, 0x08, 0x3A, 0x55, 0x00, 0x22, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x2B, 0x50, 0x00, + 0x17, 0xF2, 0x22, 0xF0, 0xFF, 0xFF, 0x64, 0x40, 0x22, 0x22, 0x04, 0x00, 0x00, 0xA8, 0x01, 0xA8, + 0x47, 0x03, 0x46, 0x03, 0x3C, 0x46, 0x2A, 0xF0, 0x40, 0x67, 0xB0, 0x84, 0xA2, 0xDA, 0x60, 0x45, + 0x22, 0xF2, 0xFF, 0xFF, 0x60, 0x43, 0x60, 0x40, 0x01, 0x26, 0x03, 0x00, 0x04, 0x26, 0x0A, 0x00, + 0x02, 0x00, 0x04, 0x27, 0x07, 0x00, 0x65, 0x44, 0x2A, 0x65, 0x60, 0x40, 0x03, 0x2B, 0x24, 0x65, + 0x45, 0x4C, 0x2E, 0x00, 0x65, 0x44, 0x2E, 0x65, 0x60, 0x40, 0x03, 0x2B, 0x28, 0x65, 0x45, 0x4C, + 0x07, 0xF0, 0x88, 0xF3, 0xFF, 0xFF, 0xD0, 0x80, 0x00, 0x7C, 0x03, 0x03, 0x63, 0x40, 0x01, 0x2A, + 0x01, 0x00, 0x3D, 0xF1, 0x2A, 0xF2, 0xFF, 0xFF, 0x08, 0xB0, 0x3E, 0xF2, 0x19, 0x03, 0x60, 0x47, + 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0x03, 0xB4, 0xD0, 0x80, 0xFF, 0xFF, 0x11, 0x03, 0x1B, 0x60, + 0xD4, 0x62, 0x1B, 0x60, 0xAC, 0x64, 0xA2, 0xDB, 0x3C, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0x5C, 0x5C, 0xFC, 0xFC, 0xCE, 0xFE, 0xB5, 0x60, 0xEC, 0x78, 0xFF, 0xFF, + 0xBB, 0xF1, 0x2C, 0x45, 0x64, 0x43, 0x17, 0xF2, 0x4B, 0xF1, 0xC4, 0x84, 0xE0, 0x84, 0xE0, 0x84, + 0xE0, 0x81, 0x63, 0x40, 0x37, 0x37, 0xE1, 0x81, 0x64, 0x45, 0xB5, 0x60, 0x58, 0x4D, 0xC1, 0x78, + 0xFF, 0xFF, 0xAE, 0x82, 0xFC, 0xA2, 0x0A, 0x03, 0x63, 0x40, 0x6E, 0x3B, 0x06, 0x00, 0x60, 0x41, + 0x04, 0x0D, 0x63, 0x44, 0x80, 0x7E, 0xBB, 0xFB, 0x61, 0x44, 0xDC, 0x84, 0x2B, 0xF0, 0x1B, 0xFA, + 0x64, 0x44, 0x80, 0x27, 0x34, 0x00, 0x16, 0xF2, 0x0F, 0xF0, 0xAC, 0x84, 0x2C, 0x45, 0x29, 0x03, + 0x4B, 0xF1, 0xC4, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x81, 0x63, 0x40, 0x37, 0x37, 0xE1, 0x81, + 0x64, 0x45, 0x0F, 0xF0, 0xB5, 0x60, 0x58, 0x4D, 0xC1, 0x78, 0xFF, 0xFF, 0xAE, 0x82, 0xFC, 0xA2, + 0x0A, 0x03, 0x63, 0x40, 0x6E, 0x3B, 0x06, 0x00, 0x60, 0x41, 0x04, 0x0D, 0x80, 0x67, 0xB0, 0x84, + 0x0F, 0xFA, 0x61, 0x44, 0xDC, 0x84, 0x1D, 0xFA, 0xDE, 0x65, 0xC4, 0x85, 0x26, 0x41, 0xE1, 0x81, + 0xC5, 0x84, 0x2B, 0xFA, 0x1B, 0xF0, 0xDE, 0x64, 0xC0, 0x85, 0x26, 0x44, 0xE0, 0x84, 0xC4, 0x84, + 0x10, 0xFA, 0x26, 0x44, 0x2C, 0xF0, 0x0A, 0xA4, 0x64, 0x40, 0x01, 0x26, 0x00, 0x64, 0x11, 0xFA, + 0xBB, 0xF3, 0x13, 0xFA, 0xFF, 0xFF, 0x0D, 0xF2, 0x3E, 0xF0, 0x60, 0x47, 0xFF, 0xB4, 0x64, 0x41, + 0x01, 0xB1, 0x01, 0x63, 0x1D, 0x02, 0x60, 0x41, 0xFF, 0x22, 0x04, 0x00, 0xB5, 0x60, 0x58, 0x4F, + 0xB2, 0x78, 0xFF, 0xFF, 0x0F, 0x60, 0x92, 0x64, 0xA0, 0xDD, 0x21, 0x60, 0x98, 0x62, 0xA2, 0xD3, + 0xB5, 0x60, 0x58, 0x4D, 0xE3, 0x78, 0xFF, 0xFF, 0x60, 0x41, 0x01, 0x63, 0x61, 0x40, 0xFF, 0x22, + 0x04, 0x00, 0xB5, 0x60, 0x58, 0x4F, 0xB2, 0x78, 0xFF, 0xFF, 0x0F, 0x60, 0x94, 0x64, 0xA0, 0xDD, + 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x40, 0x27, 0x03, 0x00, 0xBA, 0x60, 0x4A, 0x78, 0xFF, 0xFF, + 0x22, 0xF2, 0x46, 0x43, 0x60, 0x40, 0x22, 0x26, 0x8B, 0x00, 0x01, 0x26, 0x05, 0x00, 0x04, 0x26, + 0x0C, 0x00, 0xBA, 0x60, 0x4A, 0x78, 0xFF, 0xFF, 0x04, 0x27, 0x03, 0x00, 0xBA, 0x60, 0x4A, 0x78, + 0xFF, 0xFF, 0x88, 0xF3, 0xFF, 0xFF, 0x60, 0x46, 0x02, 0x00, 0x07, 0xF4, 0xFF, 0xFF, 0xA3, 0x46, + 0x2A, 0xF2, 0xA3, 0x46, 0x60, 0x40, 0x08, 0x27, 0x3B, 0x00, 0x88, 0xF3, 0x66, 0x5C, 0xD0, 0x80, + 0x37, 0xF0, 0x08, 0x03, 0x64, 0x40, 0x10, 0x2A, 0x12, 0x00, 0xFF, 0x60, 0xEF, 0x64, 0xA0, 0x84, + 0x37, 0xFA, 0x24, 0x00, 0x3D, 0xF3, 0x01, 0x61, 0x60, 0x43, 0xCF, 0x83, 0xE1, 0x81, 0xFD, 0x0D, + 0xE9, 0x81, 0xA1, 0x80, 0xFF, 0xFF, 0x03, 0x03, 0x91, 0x84, 0x37, 0xFA, 0x17, 0x00, 0x47, 0xF2, + 0xFF, 0xFF, 0x10, 0xA0, 0xFF, 0xFF, 0x02, 0x04, 0xFF, 0x60, 0xFF, 0x64, 0xDC, 0x84, 0x47, 0xFA, + 0x46, 0xF2, 0x16, 0x04, 0xDC, 0x84, 0x46, 0xFA, 0x45, 0xF2, 0x08, 0x04, 0xDC, 0x84, 0x45, 0xFA, + 0x05, 0x04, 0x37, 0xF2, 0xFF, 0xFF, 0xE0, 0x84, 0xE8, 0x84, 0x37, 0xFA, 0x0D, 0x60, 0x3E, 0x62, + 0x80, 0xFF, 0x78, 0x44, 0x03, 0xA4, 0xA2, 0xDB, 0xC4, 0x60, 0x05, 0x78, 0xFF, 0xFF, 0x84, 0xFF, + 0x0D, 0x60, 0x3E, 0x62, 0x80, 0xFF, 0x78, 0x44, 0x03, 0xA4, 0xA2, 0xDB, 0xC4, 0x60, 0x7D, 0x78, + 0xFF, 0xFF, 0x84, 0xFF, 0x88, 0xF3, 0x66, 0x5C, 0xD0, 0x80, 0x00, 0x7C, 0x07, 0x03, 0x66, 0x43, + 0x3C, 0x46, 0x22, 0xF2, 0x63, 0x46, 0x60, 0x40, 0x01, 0x2A, 0x01, 0x00, 0x3C, 0xF1, 0x47, 0xF0, + 0x64, 0x41, 0x64, 0x47, 0xFF, 0xB4, 0x60, 0x5F, 0x20, 0xBC, 0x80, 0x26, 0x80, 0xAC, 0x60, 0x47, + 0xA3, 0x46, 0x3A, 0xFA, 0x64, 0x44, 0x20, 0x7F, 0x34, 0x94, 0x3B, 0xFA, 0xA3, 0x46, 0x46, 0xF2, + 0x45, 0xF0, 0xA3, 0x46, 0x3C, 0xFA, 0x3D, 0xF8, 0x08, 0x60, 0x00, 0xEA, 0x0F, 0x64, 0x60, 0x7F, + 0xA0, 0x5A, 0x80, 0x60, 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, 0xD1, 0x60, 0x00, 0xEA, 0x8A, 0x00, + 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x27, 0x35, 0x00, 0x2A, 0xF2, 0x00, 0x60, 0x7C, 0x62, + 0x60, 0x40, 0x40, 0x2B, 0x27, 0x00, 0xA2, 0xD3, 0x00, 0x61, 0x60, 0xFE, 0xA0, 0xD3, 0xDE, 0x82, + 0xA2, 0xD1, 0xFF, 0xFF, 0x20, 0xFE, 0x64, 0x5F, 0xDC, 0x84, 0xF1, 0x81, 0xC0, 0x2B, 0x04, 0x00, + 0x80, 0x2A, 0x02, 0x00, 0x7F, 0xA4, 0xDC, 0x84, 0xFF, 0x3B, 0x03, 0x00, 0x60, 0x47, 0xDC, 0x87, + 0x01, 0x61, 0xC0, 0x80, 0x00, 0x36, 0xDC, 0x84, 0x4E, 0xDB, 0x60, 0xFE, 0xDA, 0x82, 0xA2, 0xD1, + 0xFF, 0xFF, 0xC1, 0x84, 0xF0, 0x22, 0x10, 0xA4, 0xF0, 0x2A, 0x01, 0x00, 0x00, 0x64, 0xA2, 0xDB, + 0xFF, 0xFF, 0x20, 0xFE, 0x00, 0x60, 0x7C, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xA0, 0xD3, 0x5A, 0xD1, + 0x3A, 0xFA, 0x3B, 0xF8, 0x74, 0x62, 0xA2, 0xD0, 0xFF, 0xFF, 0x64, 0x44, 0xE0, 0x7F, 0xA0, 0x5A, + 0x64, 0x47, 0xE1, 0x7F, 0x5A, 0xD0, 0xA0, 0x5A, 0x64, 0x44, 0xE2, 0x7F, 0xA0, 0x5A, 0x00, 0x60, + 0x80, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xA0, 0xD1, 0x5A, 0xD1, 0x64, 0x45, 0x64, 0x44, 0xE3, 0x7F, + 0xA0, 0x5A, 0x64, 0x47, 0xE4, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xE5, 0x7F, 0xA0, 0x5A, + 0x64, 0x47, 0xE6, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xE7, 0x7F, 0xA0, 0x5A, 0x65, 0x40, + 0x0D, 0x3A, 0x1C, 0x00, 0x64, 0x47, 0xE8, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xE9, 0x7F, + 0xA0, 0x5A, 0x64, 0x47, 0xEA, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xEB, 0x7F, 0xA0, 0x5A, + 0x64, 0x47, 0xEC, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xED, 0x7F, 0xA0, 0x5A, 0x64, 0x47, + 0xEE, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xEF, 0x7F, 0xA0, 0x5A, 0x08, 0x60, 0x00, 0xEA, + 0x65, 0x44, 0x02, 0xA4, 0x60, 0x7F, 0xA0, 0x5A, 0x80, 0x60, 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, + 0xD1, 0x60, 0x00, 0xEA, 0x02, 0x64, 0x3B, 0xDB, 0xBD, 0x60, 0xEB, 0x78, 0xFF, 0xFF, 0x66, 0x44, + 0xFC, 0xFB, 0x07, 0xF0, 0x00, 0x64, 0xD0, 0x80, 0x88, 0xF3, 0x17, 0x03, 0xD0, 0x80, 0x66, 0x41, + 0x64, 0x46, 0x6F, 0xF2, 0x61, 0x46, 0x6D, 0x03, 0x60, 0x40, 0x00, 0x36, 0x6A, 0x00, 0x47, 0xF1, + 0x07, 0xF0, 0x64, 0x40, 0x02, 0x26, 0x01, 0x00, 0x0B, 0x00, 0x03, 0x12, 0xBB, 0x60, 0x4E, 0x78, + 0xFF, 0xFF, 0xFC, 0x0A, 0xBC, 0x60, 0x48, 0x78, 0xFF, 0xFF, 0xBC, 0x60, 0x48, 0x78, 0xFF, 0xFF, + 0x3E, 0xF2, 0x60, 0x45, 0x60, 0x47, 0x07, 0xB0, 0x00, 0x3A, 0x01, 0x00, 0xA6, 0x00, 0x65, 0x44, + 0x60, 0x40, 0x01, 0x36, 0x4E, 0x00, 0x02, 0x36, 0x4F, 0x00, 0x03, 0x36, 0x2D, 0x00, 0x04, 0x36, + 0x3E, 0x00, 0x52, 0x00, 0x00, 0x64, 0x4C, 0xFB, 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, 0xFF, 0xFF, + 0x05, 0x7E, 0x6F, 0xFA, 0x61, 0x46, 0x00, 0x65, 0x65, 0x43, 0x66, 0x41, 0x64, 0x46, 0x70, 0xF2, + 0x8C, 0xFA, 0x00, 0xA8, 0x6F, 0xF2, 0x15, 0x03, 0x60, 0x47, 0xFF, 0xB5, 0x70, 0xF2, 0x00, 0xBB, + 0xFF, 0xA0, 0x07, 0x03, 0x0E, 0x06, 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0x02, 0x02, 0xFB, 0x04, + 0x08, 0x00, 0xB9, 0x81, 0xE8, 0x84, 0xD9, 0x81, 0xFD, 0x04, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, + 0x0E, 0xFA, 0x0C, 0xF4, 0xFF, 0xFF, 0x1D, 0x00, 0x4C, 0xF3, 0xFF, 0xFF, 0xDC, 0x84, 0x4C, 0xFB, + 0xAB, 0xF3, 0x60, 0x45, 0xD4, 0x80, 0xFF, 0xFF, 0x14, 0x02, 0x1C, 0x60, 0x0C, 0x62, 0x0F, 0x60, + 0x96, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0xC3, 0x01, 0x4C, 0xF3, + 0x66, 0x41, 0xDC, 0x84, 0x4C, 0xFB, 0x64, 0x46, 0x6F, 0xF2, 0xFF, 0xFF, 0x03, 0x7E, 0x6F, 0xFA, + 0x61, 0x46, 0xBC, 0x60, 0x48, 0x78, 0xFF, 0xFF, 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, 0xFF, 0xFF, + 0x01, 0x7E, 0x6F, 0xFA, 0x61, 0x46, 0xF5, 0x01, 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, 0x8C, 0xFA, + 0x60, 0x47, 0x70, 0xF2, 0xFF, 0xB5, 0x08, 0x18, 0xE4, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0x03, 0x02, + 0xFB, 0x04, 0x01, 0x64, 0x01, 0x00, 0x00, 0x64, 0x0C, 0xF4, 0x00, 0xA8, 0xFF, 0xFF, 0xE4, 0x02, + 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, 0xFF, 0xFF, 0x60, 0x47, 0x70, 0xF2, 0xFF, 0xB5, 0x61, 0x46, + 0x00, 0xA8, 0xFF, 0xFF, 0x29, 0x03, 0xE0, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0xFC, 0x03, 0x66, 0x41, + 0x64, 0x46, 0x70, 0xFA, 0x61, 0x46, 0x01, 0x65, 0x65, 0x43, 0x66, 0x41, 0x64, 0x46, 0x70, 0xF2, + 0x8C, 0xFA, 0x00, 0xA8, 0x6F, 0xF2, 0x15, 0x03, 0x60, 0x47, 0xFF, 0xB5, 0x70, 0xF2, 0x00, 0xBB, + 0xFF, 0xA0, 0x07, 0x03, 0x0E, 0x06, 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0x02, 0x02, 0xFB, 0x04, + 0x08, 0x00, 0xB9, 0x81, 0xE8, 0x84, 0xD9, 0x81, 0xFD, 0x04, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, + 0x0E, 0xFA, 0x0C, 0xF4, 0xFF, 0xFF, 0xA3, 0x01, 0xA2, 0x01, 0x65, 0x44, 0x60, 0x40, 0x01, 0x36, + 0xA8, 0x01, 0x02, 0x36, 0x01, 0x00, 0xA5, 0x01, 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, 0xFF, 0xFF, + 0x01, 0x7E, 0x6F, 0xFA, 0x61, 0x46, 0x00, 0x65, 0x65, 0x43, 0x66, 0x41, 0x64, 0x46, 0x70, 0xF2, + 0x8C, 0xFA, 0x00, 0xA8, 0x6F, 0xF2, 0x15, 0x03, 0x60, 0x47, 0xFF, 0xB5, 0x70, 0xF2, 0x00, 0xBB, + 0xFF, 0xA0, 0x07, 0x03, 0x0E, 0x06, 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0x02, 0x02, 0xFB, 0x04, + 0x08, 0x00, 0xB9, 0x81, 0xE8, 0x84, 0xD9, 0x81, 0xFD, 0x04, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, + 0x0E, 0xFA, 0x0C, 0xF4, 0xFF, 0xFF, 0xBC, 0x60, 0x48, 0x78, 0xFF, 0xFF, 0x3E, 0xF2, 0x60, 0x45, + 0x60, 0x47, 0x07, 0xB0, 0x00, 0x3A, 0x01, 0x00, 0xA3, 0x00, 0x65, 0x44, 0x60, 0x40, 0x01, 0x36, + 0x0B, 0x00, 0x02, 0x36, 0x14, 0x00, 0x03, 0x36, 0x47, 0x00, 0x04, 0x36, 0x5E, 0x00, 0x05, 0x36, + 0x0E, 0x00, 0xBC, 0x60, 0x48, 0x78, 0xFF, 0xFF, 0x07, 0xF0, 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, + 0xFF, 0xFF, 0x02, 0x7E, 0x6F, 0xFA, 0x61, 0x46, 0xBC, 0x60, 0x48, 0x78, 0xFF, 0xFF, 0x07, 0xF0, + 0x01, 0x65, 0x65, 0x43, 0x66, 0x41, 0x64, 0x46, 0x70, 0xF2, 0x8C, 0xFA, 0x00, 0xA8, 0x6F, 0xF2, + 0x15, 0x03, 0x60, 0x47, 0xFF, 0xB5, 0x70, 0xF2, 0x00, 0xBB, 0xFF, 0xA0, 0x07, 0x03, 0x0E, 0x06, + 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0x02, 0x02, 0xFB, 0x04, 0x08, 0x00, 0xB9, 0x81, 0xE8, 0x84, + 0xD9, 0x81, 0xFD, 0x04, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, 0x0E, 0xFA, 0x0C, 0xF4, 0xFF, 0xFF, + 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, 0x00, 0x63, 0x03, 0x7E, 0x6F, 0xFA, 0x61, 0x46, 0x4C, 0xFD, + 0x1C, 0x60, 0x0C, 0x62, 0x0F, 0x60, 0x96, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0xBC, 0x60, 0x48, 0x78, 0xFF, 0xFF, 0x66, 0x41, 0x64, 0x46, 0x70, 0xF2, 0x4C, 0xF3, + 0x02, 0xB0, 0x61, 0x46, 0xCC, 0x84, 0x05, 0x03, 0x04, 0x28, 0x4C, 0xFB, 0xBC, 0x60, 0x48, 0x78, + 0xFF, 0xFF, 0x04, 0x28, 0x4C, 0xFB, 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, 0xFF, 0xFF, 0x04, 0x7E, + 0x6F, 0xFA, 0x61, 0x46, 0xBC, 0x60, 0x48, 0x78, 0xFF, 0xFF, 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, + 0xFF, 0xFF, 0x60, 0x47, 0xFF, 0xB5, 0x70, 0xF2, 0x61, 0x46, 0xFF, 0xA0, 0xFF, 0xFF, 0x2F, 0x06, + 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0x02, 0x02, 0xFB, 0x04, 0x29, 0x00, 0x64, 0x46, 0x70, 0xFA, + 0x01, 0x65, 0x65, 0x43, 0x66, 0x41, 0x64, 0x46, 0x70, 0xF2, 0x8C, 0xFA, 0x00, 0xA8, 0x6F, 0xF2, + 0x15, 0x03, 0x60, 0x47, 0xFF, 0xB5, 0x70, 0xF2, 0x00, 0xBB, 0xFF, 0xA0, 0x07, 0x03, 0x0E, 0x06, + 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0x02, 0x02, 0xFB, 0x04, 0x08, 0x00, 0xB9, 0x81, 0xE8, 0x84, + 0xD9, 0x81, 0xFD, 0x04, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, 0x0E, 0xFA, 0x0C, 0xF4, 0xFF, 0xFF, + 0x6F, 0xF2, 0x00, 0x63, 0x03, 0x7E, 0x6F, 0xFA, 0x3C, 0x46, 0x4C, 0xFD, 0x51, 0x00, 0x50, 0x00, + 0x65, 0x44, 0x60, 0x40, 0x01, 0x36, 0x03, 0x00, 0x02, 0x36, 0x12, 0x00, 0x49, 0x00, 0x66, 0x41, + 0x64, 0x46, 0x70, 0xF2, 0x61, 0x46, 0x01, 0xB0, 0xFF, 0xFF, 0x42, 0x02, 0x07, 0xF0, 0x66, 0x41, + 0x64, 0x46, 0x6F, 0xF2, 0xFF, 0xFF, 0x02, 0x7E, 0x6F, 0xFA, 0x61, 0x46, 0x39, 0x00, 0x38, 0x00, + 0x07, 0xF0, 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, 0xFF, 0xFF, 0x01, 0x7E, 0x6F, 0xFA, 0x60, 0x47, + 0xFF, 0xB5, 0x70, 0xF2, 0x61, 0x46, 0xFF, 0xA0, 0xFF, 0xFF, 0xF1, 0x06, 0xE8, 0x84, 0xA4, 0x80, + 0xFF, 0xFF, 0x02, 0x02, 0xFB, 0x04, 0xEB, 0x01, 0x66, 0x41, 0x64, 0x46, 0x70, 0xFA, 0x61, 0x46, + 0x00, 0x65, 0x65, 0x43, 0x66, 0x41, 0x64, 0x46, 0x70, 0xF2, 0x8C, 0xFA, 0x00, 0xA8, 0x6F, 0xF2, + 0x15, 0x03, 0x60, 0x47, 0xFF, 0xB5, 0x70, 0xF2, 0x00, 0xBB, 0xFF, 0xA0, 0x07, 0x03, 0x0E, 0x06, + 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0x02, 0x02, 0xFB, 0x04, 0x08, 0x00, 0xB9, 0x81, 0xE8, 0x84, + 0xD9, 0x81, 0xFD, 0x04, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, 0x0E, 0xFA, 0x0C, 0xF4, 0xFF, 0xFF, + 0x03, 0x64, 0x3B, 0xDB, 0xCA, 0xFE, 0x47, 0xF1, 0x01, 0x65, 0x32, 0x40, 0x04, 0x27, 0x08, 0x00, + 0x2C, 0xF2, 0x64, 0x45, 0x02, 0x22, 0x04, 0x00, 0x60, 0x40, 0x01, 0x26, 0x01, 0x00, 0xEC, 0x00, + 0x14, 0xF2, 0x65, 0x40, 0x01, 0x26, 0x1D, 0x00, 0x60, 0x45, 0x05, 0x64, 0x3B, 0xDB, 0x65, 0x44, + 0xCC, 0x85, 0x98, 0xF1, 0x1E, 0x60, 0xDE, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xD8, 0x80, 0xC4, 0x84, + 0x0B, 0x03, 0x07, 0x05, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x09, 0x04, 0xC6, 0xFE, + 0x07, 0x00, 0x00, 0x64, 0xB8, 0x84, 0xA2, 0xDB, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, + 0xAF, 0x00, 0x60, 0x41, 0x2A, 0xF0, 0x00, 0x60, 0x0C, 0x64, 0xA0, 0x84, 0x04, 0x36, 0x02, 0x00, + 0x0C, 0x3A, 0x01, 0x00, 0xA5, 0x00, 0x61, 0x45, 0x60, 0x41, 0x98, 0xF1, 0x1E, 0x60, 0xDE, 0x64, + 0xA0, 0xD3, 0xFF, 0xFF, 0xD8, 0x80, 0xC4, 0x84, 0x0B, 0x03, 0x07, 0x05, 0xDC, 0x80, 0xD0, 0x80, + 0x04, 0x03, 0xA2, 0xDB, 0x09, 0x04, 0xC6, 0xFE, 0x07, 0x00, 0x00, 0x64, 0xB8, 0x84, 0xA2, 0xDB, + 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x61, 0x40, 0x08, 0x36, 0x01, 0x00, 0x88, 0x00, + 0x14, 0xF2, 0x1C, 0x65, 0x60, 0x41, 0x00, 0x63, 0xCD, 0x81, 0xC7, 0x83, 0xFD, 0x02, 0x3F, 0xF0, + 0x2C, 0xF2, 0xC3, 0x83, 0x60, 0x40, 0x01, 0x2A, 0x29, 0x00, 0x98, 0xF1, 0x1E, 0x60, 0xDC, 0x64, + 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, + 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x98, 0xF1, 0x1E, 0x60, + 0xE2, 0x64, 0xA0, 0xD3, 0x63, 0x45, 0xD8, 0x80, 0xC4, 0x84, 0x0B, 0x03, 0x07, 0x05, 0xDC, 0x80, + 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x09, 0x04, 0xC6, 0xFE, 0x07, 0x00, 0x00, 0x64, 0xB8, 0x84, + 0xA2, 0xDB, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x52, 0x00, 0x98, 0xF1, 0x1E, 0x60, + 0xDA, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, + 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x98, 0xF1, + 0x1E, 0x60, 0xE0, 0x64, 0xA0, 0xD3, 0x63, 0x45, 0xD8, 0x80, 0xC4, 0x84, 0x0B, 0x03, 0x07, 0x05, + 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x09, 0x04, 0xC6, 0xFE, 0x07, 0x00, 0x00, 0x64, + 0xB8, 0x84, 0xA2, 0xDB, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x15, 0xF2, 0xFF, 0xFF, + 0x0F, 0xB4, 0x00, 0xA8, 0x01, 0xA8, 0x24, 0x03, 0x12, 0x03, 0x98, 0xF1, 0x1E, 0x60, 0xE8, 0x64, + 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, + 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x11, 0x00, 0x98, 0xF1, + 0x1E, 0x60, 0xE6, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, + 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, + 0x04, 0x64, 0x3B, 0xDB, 0x07, 0xF0, 0x66, 0x41, 0x64, 0x46, 0x06, 0xF0, 0xFF, 0x60, 0x5F, 0x64, + 0xA0, 0x84, 0x06, 0xFA, 0x61, 0x46, 0x1B, 0x60, 0xD4, 0x62, 0x1B, 0x60, 0xAC, 0x64, 0xA2, 0xDB, + 0x3C, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x5C, 0x5C, 0xFC, 0xFC, + 0xCE, 0xFE, 0xB5, 0x60, 0xEC, 0x78, 0xFF, 0xFF, 0x1F, 0x60, 0x64, 0x62, 0xA2, 0xD3, 0x07, 0xF4, + 0x06, 0xF2, 0x02, 0xA8, 0x3C, 0x46, 0x10, 0x03, 0x10, 0xB0, 0x2A, 0xF2, 0x0D, 0x03, 0x0E, 0xF2, + 0x0C, 0xB0, 0x60, 0x40, 0xF0, 0x37, 0x20, 0xBC, 0x02, 0x03, 0xFE, 0x7F, 0x0E, 0xFA, 0x23, 0xF0, + 0x10, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0xCC, 0x01, 0x0F, 0xF0, 0x15, 0xF2, 0x64, 0x41, 0x01, 0x2A, + 0x02, 0x00, 0xB1, 0xF1, 0x09, 0x00, 0x03, 0x65, 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, 0x06, 0xF0, + 0x63, 0x46, 0xB0, 0xF1, 0x64, 0x40, 0x10, 0x2A, 0x64, 0x45, 0xDC, 0x84, 0xD4, 0x80, 0x15, 0xFA, + 0x3B, 0x07, 0x61, 0x40, 0x01, 0x2A, 0x09, 0x00, 0x1F, 0x60, 0x0E, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, + 0xDC, 0x84, 0xFF, 0xFF, 0x08, 0x28, 0xA2, 0xDB, 0x08, 0x00, 0x1F, 0x60, 0x10, 0x64, 0xA0, 0xD3, + 0xFF, 0xFF, 0xDC, 0x84, 0xFF, 0xFF, 0x08, 0x28, 0xA2, 0xDB, 0x2A, 0xF0, 0x08, 0x67, 0xB0, 0x84, + 0xA2, 0xDA, 0x08, 0xF0, 0x1B, 0x60, 0x8E, 0x64, 0xD0, 0x80, 0x07, 0xF2, 0x46, 0x43, 0x88, 0xF1, + 0x06, 0x03, 0x60, 0x46, 0x86, 0xF4, 0xD0, 0x80, 0x80, 0xBB, 0x01, 0x03, 0x06, 0xFC, 0x23, 0x46, + 0x3E, 0xF2, 0x00, 0x63, 0x01, 0xB0, 0x43, 0x5C, 0xFC, 0xFC, 0x0B, 0x03, 0x1B, 0x60, 0xDA, 0x62, + 0x1B, 0x60, 0xA6, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0xB5, 0x60, 0xEC, 0x78, 0xFF, 0xFF, 0x00, 0x64, 0x49, 0xFB, 0x98, 0xF1, 0x1E, 0x60, + 0xE8, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, + 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x98, 0xF1, + 0x1E, 0x60, 0xEA, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, + 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, + 0x21, 0x60, 0x98, 0x63, 0xA3, 0xD3, 0xB5, 0x60, 0x58, 0x4D, 0xE3, 0x78, 0xFF, 0xFF, 0x0D, 0xF2, + 0x60, 0x5C, 0x64, 0x5F, 0x0D, 0xFA, 0x23, 0xF0, 0x01, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0x07, 0xF0, + 0x66, 0x41, 0x64, 0x46, 0x06, 0xF2, 0x7F, 0x65, 0xA4, 0x9E, 0x06, 0xFA, 0x61, 0x46, 0x40, 0x01, + 0xBE, 0x60, 0x70, 0x78, 0xFF, 0xFF, 0x21, 0x64, 0x3B, 0xDB, 0x31, 0xF3, 0x01, 0x63, 0xC4, 0xB4, + 0x31, 0xFB, 0x32, 0xFD, 0xBE, 0x60, 0x1C, 0x62, 0x42, 0x40, 0xA0, 0x4C, 0x40, 0xBC, 0x7D, 0xB4, + 0xA0, 0x51, 0xA0, 0xFE, 0x1A, 0xFF, 0x1B, 0x60, 0xA0, 0x64, 0x08, 0xF0, 0x07, 0xF0, 0xD0, 0x80, + 0x1B, 0x60, 0xA6, 0x62, 0x14, 0x02, 0xA2, 0xD3, 0x01, 0x63, 0xAC, 0x86, 0x07, 0xF2, 0x0F, 0x03, + 0xD0, 0x80, 0x09, 0xF2, 0xFA, 0x02, 0x23, 0xFC, 0x1B, 0x60, 0xD4, 0x62, 0x1B, 0x60, 0xAC, 0x64, + 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x3C, 0x46, + 0x06, 0x64, 0xA1, 0xFF, 0x49, 0xFB, 0x83, 0x3E, 0x31, 0xF3, 0x87, 0x60, 0x80, 0x61, 0x1D, 0xF0, + 0x60, 0x40, 0x01, 0x2A, 0x15, 0x00, 0xFE, 0xB4, 0x31, 0xFB, 0x00, 0x64, 0x49, 0xFB, 0x01, 0x64, + 0x47, 0xFB, 0x21, 0x60, 0x98, 0x63, 0xA3, 0xD3, 0xB5, 0x60, 0x58, 0x4D, 0xE3, 0x78, 0xFF, 0xFF, + 0x00, 0x71, 0x64, 0x5F, 0x0D, 0xFA, 0x40, 0x64, 0x3B, 0xDB, 0xBE, 0x60, 0x70, 0x78, 0xFF, 0xFF, + 0x02, 0x2A, 0x1B, 0x00, 0xD1, 0x91, 0x8D, 0xE2, 0x41, 0x64, 0x3B, 0xDB, 0x31, 0xF3, 0x21, 0x60, + 0xA0, 0x63, 0xFD, 0xB4, 0x31, 0xFB, 0xA3, 0xD3, 0xB5, 0x60, 0x58, 0x4D, 0xE3, 0x78, 0xFF, 0xFF, + 0x02, 0x63, 0x60, 0x5C, 0x0D, 0xF2, 0x47, 0xFD, 0xFF, 0xB5, 0x60, 0x47, 0xD0, 0x80, 0xDC, 0x84, + 0x1F, 0x03, 0x60, 0x47, 0xB4, 0x84, 0x0D, 0xFA, 0x1B, 0x00, 0x08, 0x2A, 0x07, 0x00, 0x42, 0x64, + 0x3B, 0xDB, 0x31, 0xF3, 0xFF, 0xFF, 0xF7, 0xB4, 0x31, 0xFB, 0x12, 0x00, 0x10, 0x2A, 0x09, 0x00, + 0x43, 0x64, 0x3B, 0xDB, 0x31, 0xF3, 0xFF, 0xFF, 0xEF, 0xB4, 0x31, 0xFB, 0xBD, 0x60, 0xEB, 0x78, + 0xFF, 0xFF, 0x44, 0x64, 0x3B, 0xDB, 0x31, 0xF3, 0xFF, 0xFF, 0xDF, 0xB4, 0x31, 0xFB, 0x00, 0x00, + 0x2A, 0x64, 0x3B, 0xDB, 0xB5, 0x60, 0xA2, 0x64, 0x40, 0x40, 0xBA, 0x60, 0x4F, 0x78, 0xFF, 0xFF, + 0x12, 0x60, 0xCC, 0x63, 0xA3, 0xD3, 0xFF, 0xFF, 0x02, 0xB5, 0x04, 0xB5, 0x04, 0x03, 0x03, 0x03, + 0xBE, 0x60, 0xF7, 0x78, 0xFF, 0xFF, 0xEB, 0x60, 0x58, 0x4E, 0x24, 0x78, 0xFF, 0xFF, 0x31, 0x40, + 0x01, 0x2A, 0x29, 0x00, 0x9D, 0xFE, 0x27, 0x04, 0x26, 0x0A, 0x9F, 0xFE, 0x24, 0x05, 0x85, 0xFF, + 0x20, 0x44, 0x84, 0xFF, 0x40, 0x26, 0x1F, 0x00, 0x3F, 0x40, 0x20, 0x2B, 0x1C, 0x00, 0x38, 0x69, + 0xFF, 0xFF, 0x68, 0x44, 0x01, 0x16, 0xFD, 0x01, 0x01, 0x2A, 0x15, 0x00, 0x1F, 0x60, 0x1A, 0x64, + 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xFF, 0xFF, 0x08, 0x28, 0xA2, 0xDB, 0x65, 0xF1, 0x02, 0x60, + 0xEE, 0x64, 0x82, 0xFB, 0xFF, 0xFF, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0x83, 0xFB, 0x04, 0x64, + 0x84, 0xFB, 0xDF, 0xFE, 0x19, 0xFF, 0x10, 0x64, 0x3B, 0xDB, 0x66, 0xF3, 0x73, 0x45, 0xE0, 0x84, + 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x93, 0x75, 0xF1, 0xC9, 0xFE, 0x64, 0x40, 0x01, 0x26, 0x3D, 0x00, + 0x49, 0xF3, 0x3C, 0x46, 0x33, 0x18, 0xCC, 0x84, 0x49, 0xFB, 0x30, 0x02, 0xBF, 0x60, 0xAD, 0x64, + 0x40, 0x42, 0xFC, 0xFC, 0x00, 0x64, 0x5C, 0x5C, 0x32, 0xFB, 0x82, 0xFF, 0x5C, 0x47, 0x84, 0xFF, + 0x62, 0xFF, 0x1F, 0x60, 0x0A, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xFF, 0xFF, 0x08, 0x28, + 0xA2, 0xDB, 0x2A, 0xF2, 0x07, 0xF0, 0x0C, 0xB4, 0x08, 0x3A, 0x07, 0x00, 0x66, 0x41, 0x64, 0x46, + 0x06, 0xF0, 0xFF, 0x60, 0xDF, 0x64, 0xA0, 0x84, 0x06, 0xFA, 0x23, 0xF0, 0x01, 0x64, 0xB0, 0x84, + 0xA2, 0xDA, 0x1B, 0x60, 0xD4, 0x62, 0x1B, 0x60, 0xAC, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0xCE, 0xFE, 0x06, 0x00, 0x66, 0xF3, + 0x73, 0x45, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x93, 0x12, 0x60, 0xC8, 0x63, 0xA3, 0xD3, + 0xAD, 0x49, 0x20, 0xB5, 0x08, 0xB1, 0x23, 0x03, 0xE1, 0x81, 0x10, 0xB5, 0x95, 0x81, 0x60, 0x41, + 0x18, 0x02, 0x12, 0x60, 0xCA, 0x7C, 0xA4, 0xD3, 0xFF, 0xFF, 0xCC, 0x84, 0xA4, 0xDB, 0x17, 0x02, + 0x0A, 0x64, 0xA4, 0xDB, 0x61, 0x44, 0x07, 0xB4, 0xFF, 0xFF, 0x11, 0x02, 0x08, 0xB1, 0xE1, 0x81, + 0x95, 0x81, 0xA3, 0xD3, 0x0C, 0x03, 0x08, 0xAC, 0x01, 0xBC, 0xA3, 0xDB, 0xFF, 0xFF, 0x13, 0xFF, + 0x06, 0x00, 0x10, 0xAC, 0xA3, 0xDB, 0x12, 0x60, 0xCA, 0x63, 0x0A, 0x7C, 0xA3, 0xD9, 0xB5, 0x60, + 0xAF, 0x78, 0xFF, 0xFF, 0x46, 0xF3, 0x45, 0xF1, 0x05, 0x1B, 0x64, 0x44, 0x03, 0x1B, 0x0F, 0x60, + 0x92, 0x62, 0xA2, 0xD3, 0x45, 0xFB, 0x00, 0x63, 0x46, 0xFD, 0x60, 0x41, 0x25, 0x64, 0x3B, 0xDB, + 0x27, 0x44, 0xEF, 0xB4, 0x40, 0x47, 0x00, 0xB9, 0x71, 0x40, 0x80, 0x27, 0x01, 0x12, 0x19, 0x03, + 0xBF, 0x60, 0x4D, 0x62, 0x84, 0xFF, 0x42, 0x42, 0x82, 0xFF, 0xA0, 0x4C, 0x14, 0xBC, 0xFF, 0xB4, + 0xA0, 0x51, 0x1F, 0x0A, 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, 0x70, 0x44, 0xAC, 0x80, 0x19, 0x0A, + 0x71, 0x40, 0x80, 0x27, 0xF7, 0x12, 0x45, 0xF3, 0x27, 0x02, 0x03, 0x18, 0xCC, 0x84, 0x45, 0xFB, + 0xF1, 0x02, 0x06, 0x0A, 0xA0, 0x4C, 0xFB, 0xB4, 0xA0, 0x51, 0xA7, 0x60, 0xDF, 0x78, 0xFF, 0xFF, + 0x84, 0xFF, 0xBF, 0x60, 0x2A, 0x64, 0x40, 0x42, 0x82, 0xFF, 0xA0, 0x4C, 0x14, 0xBC, 0xFF, 0xB4, + 0xA0, 0x51, 0xAF, 0x60, 0x19, 0x78, 0xFF, 0xFF, 0x3C, 0x44, 0xAC, 0x80, 0x32, 0xF1, 0x12, 0x03, + 0x64, 0x40, 0x07, 0x22, 0x0F, 0x00, 0xA7, 0x60, 0xC1, 0x78, 0xFF, 0xFF, 0xA0, 0x4C, 0x1C, 0xBC, + 0xDF, 0xB4, 0xA0, 0x51, 0xF1, 0x01, 0x06, 0x00, 0x28, 0x64, 0x3A, 0xDB, 0xA0, 0x4C, 0x30, 0xBC, + 0xF3, 0xB4, 0xA0, 0x51, 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, 0x28, 0x64, 0x3B, 0xDB, 0x0F, 0x60, + 0x94, 0x62, 0xA2, 0xD3, 0x32, 0x40, 0x02, 0x27, 0x16, 0x00, 0x46, 0xFB, 0x14, 0x18, 0xBF, 0x60, + 0x9B, 0x64, 0x84, 0xFF, 0x40, 0x42, 0x82, 0xFF, 0xA0, 0x4C, 0x14, 0xBC, 0xF7, 0xB4, 0xA0, 0x51, + 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, 0x70, 0x44, 0xAC, 0x80, 0x46, 0xF3, 0xCA, 0x0A, 0xDC, 0x02, + 0xCC, 0x84, 0x46, 0xFB, 0xF5, 0x02, 0x84, 0xFF, 0xBF, 0x60, 0xAD, 0x64, 0x40, 0x42, 0x82, 0xFF, + 0x27, 0x44, 0x08, 0xBC, 0x40, 0x47, 0xBB, 0xE1, 0x04, 0x00, 0x3A, 0xE1, 0x31, 0x40, 0x01, 0x26, + 0xBB, 0xE1, 0xA7, 0x60, 0xB5, 0x78, 0xFF, 0xFF, 0x24, 0xE2, 0x2D, 0xF3, 0x2C, 0xF3, 0x00, 0xBD, + 0xCC, 0x84, 0x08, 0x03, 0x2C, 0xFB, 0x06, 0x02, 0x65, 0x44, 0x2C, 0xFB, 0x8A, 0xFF, 0x80, 0x60, + 0x00, 0x75, 0x88, 0xFF, 0xD2, 0xF3, 0x31, 0x40, 0x01, 0x2A, 0x44, 0x00, 0x60, 0x43, 0x04, 0xB0, + 0x02, 0xB0, 0x08, 0x24, 0x16, 0x02, 0x29, 0x44, 0xFF, 0xFF, 0x00, 0xA8, 0xCC, 0x81, 0x0E, 0x03, + 0x41, 0x49, 0x37, 0x02, 0x63, 0x40, 0x08, 0x2A, 0x09, 0x00, 0xF7, 0xB3, 0x25, 0x60, 0x1C, 0x7C, + 0xA4, 0xD1, 0xAD, 0x4F, 0xFD, 0xB4, 0xA0, 0x5D, 0x44, 0x49, 0x2B, 0x00, 0x63, 0x40, 0x02, 0x2A, + 0x14, 0x00, 0x25, 0x60, 0x1E, 0x64, 0xA0, 0xD3, 0x25, 0x60, 0x1A, 0x7C, 0xA4, 0xDB, 0x40, 0x49, + 0x25, 0x60, 0x20, 0x64, 0xA0, 0xD3, 0x25, 0x60, 0x1C, 0x7C, 0xA4, 0xDB, 0x0C, 0xBB, 0xFD, 0xB3, + 0xAD, 0x4F, 0x02, 0xBC, 0x00, 0x7F, 0xA0, 0x5D, 0x14, 0x00, 0x25, 0x60, 0x22, 0x64, 0xA0, 0xD3, + 0x25, 0x60, 0x1A, 0x7C, 0x0E, 0x18, 0xA4, 0xDB, 0x40, 0x49, 0x25, 0x60, 0x24, 0x64, 0xA0, 0xD3, + 0x25, 0x60, 0x1C, 0x7C, 0xA4, 0xDB, 0x08, 0xBB, 0xFB, 0xB3, 0xAD, 0x4F, 0x02, 0xBC, 0x00, 0x7F, + 0xA0, 0x5D, 0xD2, 0xFD, 0x01, 0x60, 0x0C, 0x61, 0xA1, 0xD3, 0x61, 0x43, 0x17, 0x18, 0x58, 0xD3, + 0x62, 0x41, 0x03, 0x18, 0xCC, 0x84, 0xA1, 0xDB, 0x11, 0x00, 0x49, 0xD3, 0xA3, 0xDB, 0x06, 0xA1, + 0xA1, 0xD3, 0x59, 0xD1, 0x60, 0x45, 0xA5, 0xD3, 0x59, 0xD1, 0xB0, 0x84, 0xA5, 0xDB, 0x64, 0x44, + 0x06, 0x36, 0xCD, 0xFE, 0x07, 0x36, 0xD6, 0xFE, 0xE5, 0x01, 0x23, 0x46, 0xB5, 0x60, 0xAF, 0x78, + 0xFF, 0xFF, 0x46, 0x43, 0x1C, 0x60, 0x0A, 0x61, 0xA1, 0xD3, 0x59, 0xD1, 0x06, 0x1B, 0x59, 0xD3, + 0x59, 0xD1, 0x03, 0x1B, 0x59, 0xD3, 0x59, 0xD1, 0xF0, 0x18, 0x00, 0x63, 0x49, 0xDD, 0x60, 0x40, + 0x02, 0x36, 0x11, 0x00, 0x03, 0x36, 0x32, 0x00, 0x01, 0x36, 0x08, 0x00, 0x05, 0x3A, 0xEA, 0x01, + 0xA4, 0xD3, 0x5A, 0xD3, 0x9C, 0x85, 0xA4, 0x84, 0xA2, 0xDB, 0xE4, 0x01, 0x01, 0x60, 0x0C, 0x61, + 0x00, 0x64, 0xA1, 0xDB, 0xDF, 0x01, 0xC0, 0x60, 0x4F, 0x64, 0x40, 0x45, 0x22, 0x00, 0x01, 0x60, + 0x0C, 0x66, 0xA6, 0xD3, 0x04, 0xA1, 0x60, 0x43, 0xA1, 0xD3, 0xC9, 0x81, 0x60, 0x45, 0x00, 0xBB, + 0xA1, 0xDB, 0xBE, 0xD3, 0x09, 0x03, 0xD4, 0x84, 0x9C, 0x84, 0xDC, 0x84, 0xFF, 0xFF, 0x04, 0x0E, + 0xA3, 0xD1, 0x63, 0x46, 0x64, 0x43, 0xF2, 0x01, 0x9C, 0x84, 0xDC, 0x85, 0x49, 0xDD, 0x61, 0x44, + 0x00, 0xBB, 0xA6, 0xDB, 0x02, 0x03, 0x65, 0x44, 0xBE, 0xDB, 0xBC, 0x01, 0xC0, 0x60, 0x2A, 0x64, + 0x40, 0x45, 0x01, 0x60, 0x0C, 0x66, 0xA6, 0xD3, 0xFF, 0xFF, 0xD0, 0x80, 0x0F, 0x18, 0x02, 0x03, + 0x60, 0x46, 0xF9, 0x01, 0x58, 0xD3, 0xA4, 0xD3, 0x60, 0x45, 0x00, 0x63, 0xA4, 0xDD, 0x05, 0x18, + 0x58, 0xD3, 0xFF, 0xFF, 0xC4, 0x83, 0xA2, 0xDD, 0xCA, 0x84, 0xA6, 0xDB, 0x25, 0x58, 0x64, 0x41, + 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, 0x06, 0x02, 0x40, 0xFF, 0x42, 0xFF, 0x43, 0xFF, 0x44, 0xFF, + 0x45, 0xFF, 0xA1, 0xFF, 0x88, 0xFF, 0x85, 0xFF, 0x21, 0xE1, 0x5C, 0x40, 0xC0, 0x60, 0x9A, 0x78, + 0xFF, 0xFF, 0x43, 0xFF, 0x39, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x84, 0x3E, 0xFB, 0x01, 0xA0, 0x4C, + 0x3D, 0x46, 0x2A, 0xF2, 0x46, 0x4D, 0x10, 0x25, 0x0E, 0x00, 0x09, 0xE1, 0xA1, 0xFF, 0x66, 0x40, + 0x0F, 0xF2, 0x01, 0x29, 0x02, 0x00, 0x40, 0xFF, 0x0A, 0xBC, 0xA2, 0xDA, 0x08, 0x25, 0xE9, 0x01, + 0xCB, 0xFE, 0x5C, 0x5D, 0xE7, 0x01, 0x44, 0xFF, 0x03, 0x2B, 0x21, 0x00, 0x89, 0xF3, 0x06, 0x61, + 0x60, 0x43, 0x66, 0x45, 0x31, 0xF0, 0x63, 0x46, 0x05, 0xF2, 0x65, 0x46, 0xD0, 0x80, 0x30, 0xF0, + 0x0F, 0x02, 0x63, 0x46, 0x04, 0xF2, 0x65, 0x46, 0xD0, 0x80, 0x2F, 0xF0, 0x09, 0x02, 0x63, 0x46, + 0x03, 0xF2, 0x65, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x03, 0x02, 0xFF, 0xFF, 0x48, 0xFE, 0x06, 0x00, + 0xCD, 0x81, 0x02, 0xA3, 0xE7, 0x02, 0x88, 0xF1, 0x08, 0xFE, 0x64, 0x43, 0x26, 0x03, 0x31, 0xF2, + 0x12, 0x60, 0xCE, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, + 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x31, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, + 0x0C, 0x02, 0x61, 0x46, 0x30, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, + 0x2F, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, + 0xE8, 0x1B, 0x88, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x07, 0xFC, 0x3F, 0xF2, 0x09, 0x60, + 0xB0, 0x65, 0xD4, 0x80, 0x2A, 0xF2, 0xA1, 0x05, 0x08, 0x25, 0x93, 0x01, 0x00, 0x64, 0x0D, 0x60, + 0x2C, 0x61, 0x40, 0x4B, 0xA1, 0xDB, 0x2D, 0x46, 0x3B, 0xF2, 0x88, 0xF1, 0x87, 0xF4, 0x60, 0x40, + 0x20, 0x2B, 0x12, 0x00, 0xD3, 0x80, 0x2C, 0xF0, 0x90, 0x03, 0x07, 0xF4, 0x64, 0x40, 0x01, 0x26, + 0x88, 0xF5, 0xB6, 0xF4, 0x2D, 0x46, 0x04, 0x64, 0x04, 0xB3, 0x22, 0xFA, 0x04, 0x03, 0xC2, 0x60, + 0x11, 0x78, 0xFF, 0xFF, 0x01, 0x00, 0xE0, 0x00, 0x74, 0x62, 0xA2, 0xD0, 0xFF, 0xFF, 0x64, 0x44, + 0xE0, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xE1, 0x7F, 0x5A, 0xD0, 0xA0, 0x5B, 0x64, 0x44, 0xE2, 0x7F, + 0xA0, 0x5B, 0x64, 0x47, 0x7C, 0x5F, 0xE8, 0x84, 0xE8, 0x85, 0x0C, 0x60, 0x3A, 0x64, 0x44, 0xD3, + 0x5A, 0xD1, 0x03, 0x1B, 0xC2, 0x60, 0x04, 0x78, 0xFF, 0xFF, 0x60, 0x45, 0x64, 0x44, 0xE3, 0x7F, + 0xA0, 0x5B, 0x64, 0x47, 0xE4, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, 0x64, 0x44, 0xE5, 0x7F, 0xA0, 0x5B, + 0x64, 0x47, 0xE6, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, 0x64, 0x44, 0xE7, 0x7F, 0xA0, 0x5B, 0x65, 0x40, + 0x0D, 0x3A, 0x1C, 0x00, 0x64, 0x47, 0xE8, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, 0x64, 0x44, 0xE9, 0x7F, + 0xA0, 0x5B, 0x64, 0x47, 0xEA, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, 0x64, 0x44, 0xEB, 0x7F, 0xA0, 0x5B, + 0x64, 0x47, 0xEC, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, 0x64, 0x44, 0xED, 0x7F, 0xA0, 0x5B, 0x64, 0x47, + 0xEE, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, 0x64, 0x44, 0xEF, 0x7F, 0xA0, 0x5B, 0x65, 0x44, 0xD8, 0x84, + 0x08, 0x25, 0x78, 0x00, 0x60, 0x7F, 0xA0, 0x5B, 0x80, 0x60, 0x00, 0xEB, 0xA0, 0x60, 0x00, 0xEB, + 0xD1, 0x60, 0x00, 0xEB, 0x3F, 0xF2, 0x04, 0x65, 0xC4, 0x83, 0x0A, 0xE1, 0xB3, 0xFF, 0x9A, 0xFF, + 0xCB, 0x83, 0x00, 0xF4, 0x10, 0x62, 0x6C, 0x61, 0x0E, 0xA3, 0xAB, 0x84, 0xF2, 0xA3, 0xA1, 0xFF, + 0x08, 0x00, 0x00, 0xF4, 0x81, 0xF2, 0x02, 0x62, 0xC9, 0x81, 0xAB, 0x84, 0xA1, 0xFF, 0x01, 0x00, + 0xA2, 0xDC, 0x7A, 0xD4, 0xFD, 0x1C, 0xA2, 0xDC, 0x08, 0x25, 0x54, 0x00, 0xF2, 0x1D, 0x7C, 0xA8, + 0xD9, 0x81, 0xEF, 0x03, 0xFF, 0xB1, 0x09, 0x1E, 0x02, 0x02, 0x00, 0xF4, 0x02, 0x62, 0x5A, 0xD2, + 0x89, 0xFF, 0x80, 0x4F, 0x6F, 0x44, 0xA2, 0xDA, 0x88, 0xFF, 0x98, 0xFF, 0x09, 0xE1, 0xA1, 0xFF, + 0x3D, 0x46, 0x08, 0x25, 0x3F, 0x00, 0x40, 0xFF, 0x0F, 0xF0, 0x0A, 0x64, 0xB0, 0x84, 0x18, 0x14, + 0xF7, 0xB4, 0xA2, 0xDA, 0x0D, 0x60, 0x2C, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, + 0x0C, 0x00, 0xD1, 0xF5, 0xD0, 0xF4, 0x0D, 0x60, 0x2C, 0x61, 0x59, 0xD1, 0x37, 0xF8, 0x05, 0x64, + 0x59, 0xD1, 0xCC, 0x84, 0xBD, 0xD8, 0xFC, 0x02, 0x2D, 0x46, 0xC0, 0x60, 0xB0, 0x78, 0xFF, 0xFF, + 0xA2, 0xDA, 0x2D, 0x46, 0x3B, 0xF0, 0xFF, 0xFF, 0x64, 0x40, 0x20, 0x2B, 0x18, 0x00, 0xD1, 0xF5, + 0xB7, 0xF0, 0x2A, 0x44, 0xA4, 0x84, 0xFF, 0xFF, 0x2F, 0x26, 0x10, 0x00, 0x2D, 0x46, 0x64, 0x44, + 0x3A, 0xF0, 0xBC, 0xF0, 0x64, 0x5F, 0x3D, 0xF0, 0x07, 0xF4, 0xD0, 0xF4, 0xFF, 0xFF, 0x08, 0xA3, + 0x5B, 0xD8, 0x65, 0x5C, 0x5B, 0xD8, 0x5B, 0xDA, 0x2D, 0x46, 0x01, 0x00, 0x2D, 0x46, 0xC0, 0x60, + 0xB0, 0x78, 0xFF, 0xFF, 0x98, 0xFF, 0x43, 0xFF, 0x40, 0xFF, 0xB0, 0xFF, 0xB1, 0xFF, 0x2D, 0x46, + 0x0D, 0x60, 0x2C, 0x61, 0xA1, 0xD3, 0x2D, 0x46, 0x60, 0x40, 0x01, 0x2A, 0x0A, 0x00, 0xD1, 0xF5, + 0xD0, 0xF4, 0x59, 0xD1, 0x37, 0xF8, 0x05, 0x64, 0x59, 0xD1, 0xCC, 0x84, 0xBD, 0xD8, 0xFC, 0x02, + 0x2D, 0x46, 0xC0, 0x60, 0x9A, 0x78, 0xFF, 0xFF, 0x98, 0xFF, 0x09, 0xE1, 0xA1, 0xFF, 0x3D, 0x46, + 0x08, 0x25, 0xE0, 0x01, 0x0F, 0xF2, 0x40, 0xFF, 0x02, 0xBC, 0xA2, 0xDA, 0xC0, 0x60, 0xB0, 0x78, + 0xFF, 0xFF, 0x00, 0x64, 0x0D, 0x60, 0x2C, 0x62, 0xA2, 0xDB, 0x04, 0x64, 0x22, 0xFA, 0x87, 0xF4, + 0x88, 0xF1, 0xFF, 0xFF, 0xD3, 0x80, 0x3B, 0xF2, 0xE7, 0x03, 0x60, 0x47, 0xC0, 0xB7, 0x02, 0xFE, + 0xF0, 0x84, 0xF0, 0x84, 0xF0, 0x84, 0x00, 0xA8, 0x40, 0x4A, 0x16, 0x03, 0xE0, 0x81, 0x61, 0x43, + 0x42, 0xFE, 0x00, 0x64, 0xF0, 0x84, 0xFE, 0x1F, 0x40, 0x4A, 0xE1, 0x84, 0xE0, 0x84, 0x2D, 0x46, + 0x07, 0xF4, 0xE0, 0x81, 0x37, 0xF0, 0x2A, 0x47, 0x0C, 0x60, 0x7A, 0x63, 0xA0, 0x84, 0x47, 0x9C, + 0x10, 0x03, 0x7C, 0x44, 0xA0, 0x63, 0x11, 0x00, 0x20, 0x64, 0x40, 0x4A, 0x63, 0x46, 0x37, 0xF0, + 0x66, 0x44, 0x64, 0x40, 0x80, 0x2B, 0x05, 0x00, 0x00, 0x60, 0x70, 0x7C, 0x00, 0x60, 0x90, 0x63, + 0x04, 0x00, 0x2D, 0x46, 0xC2, 0x60, 0x04, 0x78, 0xFF, 0xFF, 0x2D, 0x46, 0xCE, 0xFB, 0xCF, 0xF9, + 0xD0, 0xFD, 0x07, 0xF2, 0xD1, 0xFB, 0x60, 0x46, 0x37, 0xF0, 0x2A, 0x44, 0x0D, 0x60, 0x2C, 0x62, + 0x5A, 0xD9, 0x00, 0x65, 0x45, 0x4B, 0xA0, 0x84, 0xFF, 0xFF, 0x3F, 0x22, 0x05, 0x00, 0x90, 0x84, + 0x37, 0xFA, 0x01, 0x64, 0x40, 0x4B, 0x21, 0x00, 0xAD, 0x46, 0x0A, 0xA3, 0x3D, 0xF2, 0xAD, 0x46, + 0xA3, 0xD0, 0xAD, 0x46, 0xD0, 0x80, 0x3C, 0xF2, 0xAD, 0x46, 0x02, 0x03, 0x16, 0x07, 0x14, 0x04, + 0x5B, 0xD0, 0xAD, 0x46, 0xD0, 0x80, 0x3B, 0xF2, 0x03, 0x03, 0xAD, 0x46, 0x0E, 0x07, 0x0C, 0x04, + 0x3A, 0xF0, 0xAD, 0x46, 0x5B, 0xD0, 0x64, 0x5F, 0xD0, 0x80, 0x2B, 0x44, 0x18, 0x07, 0x04, 0x03, + 0xD0, 0x84, 0x10, 0xA4, 0xFF, 0xFF, 0x13, 0x07, 0x7F, 0x01, 0x01, 0x64, 0x0D, 0x60, 0x2C, 0x62, + 0xA2, 0xDB, 0x2D, 0x46, 0x0D, 0x60, 0x3C, 0x62, 0x80, 0xFF, 0x78, 0x44, 0x03, 0xA4, 0xA2, 0xDB, + 0xC2, 0x60, 0xAA, 0x78, 0xFF, 0xFF, 0x85, 0xFF, 0x2D, 0x46, 0x08, 0x25, 0x53, 0x01, 0x2D, 0x46, + 0x0D, 0x60, 0x3C, 0x62, 0x80, 0xFF, 0x78, 0x44, 0x03, 0xA4, 0xA2, 0xDB, 0xC3, 0x60, 0x33, 0x78, + 0xFF, 0xFF, 0x85, 0xFF, 0x2D, 0x46, 0x08, 0x25, 0x45, 0x01, 0x00, 0x60, 0x0F, 0x64, 0xC1, 0x60, + 0x70, 0x78, 0xFF, 0xFF, 0x07, 0xF4, 0x66, 0x41, 0x03, 0xF2, 0x04, 0xF2, 0x40, 0x42, 0x05, 0xF2, + 0x40, 0x43, 0x40, 0x44, 0x61, 0x46, 0x3C, 0xF2, 0x3D, 0xF2, 0x40, 0x40, 0x40, 0x41, 0x0D, 0x60, + 0x70, 0x65, 0x00, 0x61, 0xCF, 0xF1, 0xCE, 0xF5, 0x44, 0x4C, 0x2C, 0x5C, 0xE9, 0x80, 0x00, 0x64, + 0xF0, 0x84, 0xF0, 0x84, 0xC0, 0x83, 0xBD, 0xD2, 0x24, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x20, 0x44, 0x40, 0x80, 0xDB, 0x83, 0xBD, 0xD2, 0x20, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x21, 0x44, 0x40, 0x81, 0xDB, 0x83, 0xBD, 0xD2, 0x21, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x22, 0x44, 0x40, 0x82, 0xDB, 0x83, 0xBD, 0xD2, 0x22, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x23, 0x44, 0x40, 0x83, 0xF2, 0xA3, 0xBD, 0xD2, 0x23, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x24, 0x44, 0xC0, 0x9C, 0x41, 0x84, 0xDD, 0x81, 0x08, 0x2A, 0xA7, 0x01, 0x0D, 0x60, 0x2E, 0x61, + 0x05, 0x64, 0xD0, 0xF4, 0xD1, 0xF5, 0xFE, 0xA3, 0x5B, 0xD0, 0xCC, 0x84, 0x59, 0xD9, 0xFC, 0x02, + 0xD0, 0xF3, 0xD1, 0xF5, 0x60, 0x42, 0x20, 0x44, 0xA2, 0xDA, 0x21, 0x44, 0x5A, 0xDA, 0x22, 0x44, + 0x5A, 0xDA, 0x23, 0x44, 0x5A, 0xDA, 0x24, 0x44, 0x5A, 0xDA, 0x61, 0x46, 0x0D, 0x60, 0x3C, 0x62, + 0xA2, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0x66, 0x41, 0xD0, 0xF3, 0xD1, 0xF5, 0xA0, 0xD2, 0x5A, 0xD0, + 0x40, 0x40, 0x44, 0x41, 0x5A, 0xD2, 0x5A, 0xD0, 0x40, 0x42, 0x5A, 0xD0, 0x44, 0x43, 0x61, 0x46, + 0xBA, 0xF0, 0x3B, 0xF2, 0x44, 0x44, 0x65, 0x5F, 0x40, 0x85, 0xCF, 0xF4, 0xCE, 0xF5, 0x43, 0x4C, + 0x0D, 0x60, 0x70, 0x65, 0xBD, 0xD2, 0x25, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, + 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x20, 0x44, + 0x40, 0x80, 0xBD, 0xD2, 0x20, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x21, 0x44, 0x40, 0x81, + 0xBD, 0xD2, 0x21, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x22, 0x44, 0x40, 0x82, 0xBD, 0xD2, + 0x22, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x23, 0x44, 0x40, 0x83, 0xBD, 0xD2, 0x23, 0x5C, + 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, + 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x24, 0x44, 0x40, 0x84, 0xBD, 0xD2, 0x24, 0x5C, 0x90, 0x9C, + 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x47, 0x90, 0x9C, 0x25, 0x44, 0x40, 0x85, 0x61, 0x46, 0x3A, 0xF0, 0xFF, 0xFF, 0x64, 0x44, + 0xE0, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xE1, 0x7F, 0x5A, 0xD0, 0xA0, 0x5B, 0x64, 0x44, 0xE2, 0x7F, + 0xA0, 0x5B, 0x64, 0x47, 0xCE, 0xF5, 0xBD, 0xD2, 0x25, 0x5C, 0x90, 0x84, 0xE8, 0x80, 0xF8, 0x84, + 0x20, 0x5C, 0x40, 0x80, 0x20, 0x44, 0xE4, 0x7F, 0xA0, 0x5B, 0x20, 0x47, 0xE5, 0x7F, 0xA0, 0x5B, + 0xBD, 0xD2, 0x20, 0x5C, 0x90, 0x84, 0xE8, 0x80, 0xF8, 0x84, 0x21, 0x5C, 0x40, 0x81, 0x21, 0x44, + 0xE6, 0x7F, 0xA0, 0x5B, 0x21, 0x47, 0xE7, 0x7F, 0xA0, 0x5B, 0x21, 0x44, 0xE8, 0x80, 0xF8, 0x84, + 0x22, 0x5C, 0x40, 0x82, 0x22, 0x44, 0xE8, 0x7F, 0xA0, 0x5B, 0x22, 0x47, 0xE9, 0x7F, 0xA0, 0x5B, + 0x22, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x23, 0x5C, 0x40, 0x83, 0x23, 0x44, 0xEA, 0x7F, 0xA0, 0x5B, + 0x23, 0x47, 0xEB, 0x7F, 0xA0, 0x5B, 0x23, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x24, 0x5C, 0x40, 0x84, + 0x24, 0x44, 0xEC, 0x7F, 0xA0, 0x5B, 0x24, 0x47, 0xED, 0x7F, 0xA0, 0x5B, 0x24, 0x44, 0xE8, 0x80, + 0xF8, 0x84, 0x25, 0x5C, 0x40, 0x85, 0x25, 0x44, 0xEE, 0x7F, 0xA0, 0x5B, 0x25, 0x47, 0xEF, 0x7F, + 0xA0, 0x5B, 0x2C, 0x43, 0xA3, 0xD2, 0x25, 0x5C, 0x90, 0x81, 0xE9, 0x84, 0xE3, 0x7F, 0xA0, 0x5B, + 0x0D, 0x60, 0x3C, 0x62, 0xA2, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0xCB, 0xF3, 0x5A, 0xD3, 0x40, 0x48, + 0x5A, 0xD3, 0x40, 0x49, 0x40, 0x4A, 0x00, 0x60, 0x70, 0x7C, 0x44, 0x4D, 0x45, 0xF2, 0x46, 0xF2, + 0x40, 0x47, 0x40, 0x46, 0x0D, 0x60, 0x70, 0x65, 0x00, 0x61, 0x2D, 0x5C, 0xE9, 0x80, 0x00, 0x64, + 0xF0, 0x84, 0xF0, 0x84, 0xC0, 0x83, 0xBD, 0xD2, 0x2A, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x26, 0x44, 0x40, 0x86, 0xDB, 0x83, 0xBD, 0xD2, 0x26, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x27, 0x44, 0x40, 0x87, 0xDB, 0x83, 0xBD, 0xD2, 0x27, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x28, 0x44, 0x40, 0x88, 0xDB, 0x83, 0xBD, 0xD2, 0x28, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x29, 0x44, 0x40, 0x89, 0xF2, 0xA3, 0xBD, 0xD2, 0x29, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x2A, 0x44, 0xC0, 0x9C, 0x41, 0x8A, 0xDD, 0x81, 0x08, 0x2A, 0xA7, 0x01, 0x26, 0x44, 0x40, 0xFA, + 0x27, 0x44, 0x41, 0xFA, 0x28, 0x44, 0x42, 0xFA, 0x29, 0x44, 0x43, 0xFA, 0x2A, 0x44, 0x44, 0xFA, + 0x0D, 0x60, 0x3E, 0x62, 0xA2, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x60, 0x80, 0x7C, 0x44, 0x4D, + 0x2D, 0x42, 0xA2, 0xD2, 0x5A, 0xD0, 0x40, 0x46, 0x44, 0x47, 0x5A, 0xD2, 0x5A, 0xD0, 0x40, 0x48, + 0x5A, 0xD0, 0x44, 0x49, 0x47, 0xF2, 0x44, 0x4A, 0x40, 0x8B, 0x60, 0x5C, 0x64, 0x47, 0xE0, 0x7F, + 0xA0, 0x5A, 0xFF, 0xB4, 0x20, 0xBC, 0x7F, 0xB4, 0xE1, 0x7F, 0xA0, 0x5A, 0x64, 0x44, 0xE2, 0x7F, + 0xA0, 0x5A, 0x00, 0x60, 0x70, 0x63, 0x0D, 0x60, 0x70, 0x65, 0xBD, 0xD2, 0x2B, 0x5C, 0x90, 0x9C, + 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x47, 0x90, 0x9C, 0x26, 0x44, 0x40, 0x86, 0xBD, 0xD2, 0x26, 0x5C, 0x90, 0x9C, 0x64, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, + 0x90, 0x9C, 0x27, 0x44, 0x40, 0x87, 0xBD, 0xD2, 0x27, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x28, 0x44, 0x40, 0x88, 0xBD, 0xD2, 0x28, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, + 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x29, 0x44, + 0x40, 0x89, 0xBD, 0xD2, 0x29, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x2A, 0x44, 0x40, 0x8A, + 0xBD, 0xD2, 0x2A, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x2B, 0x44, 0x40, 0x8B, 0xBD, 0xD2, + 0x2B, 0x5C, 0x90, 0x84, 0xE8, 0x80, 0xF8, 0x84, 0x26, 0x5C, 0x40, 0x86, 0x26, 0x44, 0xE4, 0x7F, + 0xA0, 0x5A, 0x26, 0x47, 0xE5, 0x7F, 0xA0, 0x5A, 0xBD, 0xD2, 0x26, 0x5C, 0x90, 0x84, 0xE8, 0x80, + 0xF8, 0x84, 0x27, 0x5C, 0x40, 0x87, 0x27, 0x44, 0xE6, 0x7F, 0xA0, 0x5A, 0x27, 0x47, 0xE7, 0x7F, + 0xA0, 0x5A, 0x27, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x28, 0x5C, 0x40, 0x88, 0x28, 0x44, 0xE8, 0x7F, + 0xA0, 0x5A, 0x28, 0x47, 0xE9, 0x7F, 0xA0, 0x5A, 0x28, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x29, 0x5C, + 0x40, 0x89, 0x29, 0x44, 0xEA, 0x7F, 0xA0, 0x5A, 0x29, 0x47, 0xEB, 0x7F, 0xA0, 0x5A, 0x29, 0x44, + 0xE8, 0x80, 0xF8, 0x84, 0x2A, 0x5C, 0x40, 0x8A, 0x2A, 0x44, 0xEC, 0x7F, 0xA0, 0x5A, 0x2A, 0x47, + 0xED, 0x7F, 0xA0, 0x5A, 0x2A, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x2B, 0x5C, 0x40, 0x8B, 0x2B, 0x44, + 0xEE, 0x7F, 0xA0, 0x5A, 0x2B, 0x47, 0xEF, 0x7F, 0xA0, 0x5A, 0x38, 0xF0, 0x2B, 0x44, 0x90, 0x84, + 0xE8, 0x84, 0xE3, 0x7F, 0xA0, 0x5A, 0x0D, 0x60, 0x3E, 0x62, 0xA2, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, + 0x42, 0xFF, 0x40, 0xFF, 0xDD, 0xFE, 0xAD, 0x4F, 0x00, 0x7F, 0x01, 0xBC, 0xA0, 0x5D, 0x00, 0xEE, + 0x19, 0x61, 0xCD, 0x81, 0xFF, 0xFF, 0xFD, 0x02, 0x43, 0x45, 0x20, 0x44, 0x60, 0xBC, 0x40, 0x40, + 0x02, 0x60, 0xEE, 0x63, 0x65, 0xF3, 0x82, 0xFD, 0x40, 0x7F, 0x83, 0xFB, 0x05, 0x64, 0x84, 0xFB, + 0xDF, 0xFE, 0x19, 0xFF, 0xC5, 0x60, 0x6D, 0x64, 0x3F, 0x40, 0x01, 0x2B, 0x02, 0x00, 0xC5, 0x60, + 0x6D, 0x64, 0x85, 0xFB, 0xC0, 0x60, 0x9A, 0x78, 0xFF, 0xFF, 0x04, 0xEE, 0xAD, 0x4F, 0x00, 0x7F, + 0x01, 0xBC, 0xA0, 0x5D, 0x19, 0x61, 0xCD, 0x81, 0xFF, 0xFF, 0xFD, 0x02, 0xAD, 0x4F, 0x00, 0x7F, + 0x01, 0xBC, 0xA0, 0x5D, 0x00, 0xEE, 0x15, 0x60, 0xA2, 0xE7, 0x1C, 0x60, 0x68, 0x63, 0x1C, 0x60, + 0xDC, 0x65, 0xDF, 0xFE, 0x80, 0xE1, 0xBD, 0xD3, 0xFF, 0xFF, 0x60, 0x48, 0x60, 0x47, 0x80, 0xBC, + 0x00, 0x7F, 0x60, 0x4A, 0xD7, 0x80, 0xA1, 0xFF, 0xFF, 0xFF, 0xF5, 0x02, 0x1C, 0x60, 0xDC, 0x63, + 0x1D, 0x60, 0xDE, 0x65, 0xBD, 0xD3, 0xFF, 0xFF, 0x60, 0x48, 0x60, 0x47, 0x80, 0xBC, 0x00, 0x7F, + 0x60, 0x4A, 0xD7, 0x80, 0xA1, 0xFF, 0xFF, 0xFF, 0xF5, 0x02, 0x3F, 0x40, 0x20, 0x2B, 0x00, 0x00, + 0x01, 0x68, 0xFF, 0x6A, 0xBF, 0xFE, 0xC6, 0x60, 0x55, 0x78, 0xFF, 0xFF, 0x3F, 0x40, 0x20, 0x2B, + 0xAD, 0x00, 0x01, 0x16, 0xFE, 0x01, 0x38, 0x69, 0xA1, 0xFF, 0xFF, 0xFF, 0x68, 0x44, 0x01, 0x2A, + 0xA5, 0x00, 0x1F, 0x60, 0x1A, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xFF, 0xFF, 0x08, 0x28, + 0xA2, 0xDB, 0x65, 0xF1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x9C, 0x01, 0x00, 0x65, 0xF1, 0xDD, 0xFE, + 0xAD, 0x4F, 0x00, 0x7F, 0x01, 0xBC, 0xA0, 0x5D, 0x00, 0xEE, 0x43, 0x45, 0x20, 0x44, 0x20, 0xBC, + 0x40, 0x40, 0x02, 0x60, 0xEE, 0x64, 0x82, 0xFB, 0x83, 0xF9, 0x05, 0x64, 0x84, 0xFB, 0xDF, 0xFE, + 0x19, 0xFF, 0x83, 0x00, 0x20, 0x44, 0x20, 0xBC, 0x40, 0x40, 0x43, 0x45, 0xA4, 0xD1, 0xDA, 0x83, + 0xC3, 0x85, 0x80, 0xE1, 0xDF, 0xFE, 0xBD, 0xD3, 0xFF, 0xFF, 0x60, 0x48, 0x60, 0x47, 0x80, 0xBC, + 0x00, 0x7F, 0x60, 0x4A, 0xD7, 0x80, 0xA1, 0xFF, 0xF6, 0x02, 0xBF, 0xFE, 0x6E, 0x00, 0x3F, 0x40, + 0x40, 0x26, 0x13, 0x00, 0x0B, 0x60, 0xF8, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x10, 0x64, 0x90, 0x84, + 0xA0, 0x50, 0xF8, 0xA2, 0xA2, 0xD1, 0x0A, 0x60, 0x19, 0x64, 0x90, 0x84, 0xA0, 0x52, 0x06, 0xA2, + 0xA2, 0xD1, 0x46, 0x60, 0x09, 0x64, 0x90, 0x84, 0xA0, 0x50, 0xAD, 0x4F, 0xFE, 0xB4, 0xA0, 0x5D, + 0xAD, 0x4F, 0xFD, 0xB4, 0xA0, 0x5D, 0x02, 0xEE, 0xBD, 0xFE, 0x50, 0x00, 0x80, 0xE1, 0x01, 0x16, + 0xFE, 0x01, 0x64, 0x48, 0x92, 0x6A, 0xA1, 0xFF, 0xFF, 0xFF, 0x68, 0x40, 0x1F, 0x60, 0x08, 0x64, + 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xFF, 0xFF, 0x08, 0x28, 0xA2, 0xDB, 0x3F, 0x00, 0x80, 0xE1, + 0x01, 0x16, 0xFE, 0x01, 0x01, 0x68, 0xA7, 0x6A, 0xA1, 0xFF, 0xFF, 0xFF, 0x68, 0x40, 0x36, 0x00, + 0x20, 0x44, 0x20, 0xBC, 0x40, 0x40, 0x80, 0xE1, 0x64, 0x46, 0x01, 0x16, 0xFE, 0x01, 0x21, 0x69, + 0xA1, 0xFF, 0xFF, 0xFF, 0x68, 0x5E, 0x01, 0x16, 0xFE, 0x01, 0x22, 0x69, 0xA1, 0xFF, 0xFF, 0xFF, + 0x68, 0x5F, 0x26, 0xFA, 0x1C, 0xF2, 0x01, 0x16, 0xFE, 0x01, 0x3A, 0x69, 0xA1, 0xFF, 0xFF, 0xFF, + 0x68, 0x5F, 0x27, 0xFA, 0x1B, 0x00, 0x20, 0x44, 0x20, 0xBC, 0x40, 0x40, 0x43, 0x45, 0xBE, 0xD5, + 0xA4, 0xD2, 0x5A, 0x86, 0xEF, 0xA0, 0x11, 0x61, 0x01, 0x06, 0x60, 0x41, 0x1C, 0x60, 0x46, 0x63, + 0x80, 0xE1, 0xBD, 0xD3, 0x26, 0x42, 0x01, 0x16, 0xFE, 0x01, 0x60, 0x49, 0xA1, 0xFF, 0xFF, 0xFF, + 0x68, 0x44, 0xCD, 0x81, 0xA2, 0xDA, 0x5A, 0x86, 0xF4, 0x02, 0x25, 0x43, 0x21, 0xE1, 0x00, 0x64, + 0xBF, 0xDB, 0x20, 0x44, 0x20, 0x2A, 0x07, 0x00, 0x07, 0xB4, 0x04, 0x36, 0xC3, 0xFE, 0x06, 0x36, + 0xCC, 0xFE, 0x07, 0x36, 0xD5, 0xFE, 0x20, 0x44, 0xD8, 0xB4, 0x40, 0x40, 0x20, 0x44, 0x40, 0x2A, + 0x07, 0x00, 0x9F, 0xFE, 0x1E, 0x05, 0xBF, 0xB4, 0x40, 0x40, 0x85, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, + 0x1B, 0x60, 0xE6, 0x63, 0xBD, 0xD3, 0x02, 0x61, 0x17, 0x1B, 0x04, 0xA3, 0xBD, 0xD3, 0x02, 0x61, + 0x13, 0x1B, 0x04, 0xA3, 0xBD, 0xD3, 0x02, 0x61, 0x0F, 0x1B, 0x04, 0xA3, 0xBD, 0xD3, 0x04, 0x61, + 0x0B, 0x1B, 0x04, 0xA3, 0xBD, 0xD3, 0x06, 0x61, 0x07, 0x1B, 0x04, 0xA3, 0xBD, 0xD3, 0x07, 0x61, + 0x03, 0x1B, 0xC0, 0x60, 0x9A, 0x78, 0xFF, 0xFF, 0xA3, 0xD1, 0x40, 0x44, 0x20, 0x44, 0x07, 0xB5, + 0xD4, 0x85, 0x35, 0x80, 0x24, 0x45, 0x1C, 0x60, 0x22, 0x64, 0x44, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, + 0x80, 0xE1, 0x43, 0x45, 0x20, 0x44, 0x20, 0xBC, 0x40, 0x40, 0x64, 0x43, 0xBD, 0xD3, 0xBD, 0xD1, + 0x40, 0x44, 0x10, 0x27, 0x10, 0x00, 0xFF, 0x60, 0x7F, 0x65, 0x15, 0x60, 0xA2, 0x64, 0x24, 0x40, + 0x08, 0x2B, 0xA4, 0x84, 0xA0, 0x57, 0xFF, 0xFF, 0x64, 0x49, 0xFF, 0xFF, 0x68, 0x44, 0x01, 0x16, + 0xFD, 0x01, 0x00, 0x7F, 0xA3, 0xDB, 0xA1, 0x01, 0x80, 0xE1, 0x43, 0x45, 0x20, 0x44, 0x20, 0xBC, + 0x40, 0x40, 0x64, 0x43, 0xBD, 0xD3, 0xBD, 0xD1, 0x40, 0x44, 0x10, 0x2B, 0x11, 0x00, 0xA3, 0xD3, + 0xFF, 0xFF, 0x15, 0x60, 0x80, 0xE7, 0x24, 0x40, 0x07, 0x27, 0x02, 0x00, 0x50, 0xEC, 0x00, 0x00, + 0x60, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x24, 0x40, 0x20, 0x2B, 0x40, 0xEC, 0x0F, 0x00, + 0x15, 0x60, 0x22, 0x64, 0x24, 0x40, 0x08, 0x27, 0x80, 0xBC, 0xA3, 0xD3, 0xA0, 0x57, 0x60, 0x48, + 0x64, 0x44, 0x80, 0xBC, 0xFF, 0xB4, 0x60, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x75, 0x01, + 0xA2, 0xFF, 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, 0x01, 0x02, 0xA1, 0xFF, 0x86, 0xFF, 0x88, 0xFF, + 0x5C, 0x46, 0x5C, 0x49, 0x5C, 0x40, 0xDE, 0x60, 0x58, 0x4F, 0xE2, 0x78, 0xFF, 0xFF, 0xCE, 0x60, + 0x58, 0x4F, 0x00, 0x78, 0xFF, 0xFF, 0xE7, 0x60, 0x58, 0x4F, 0xBE, 0x78, 0xFF, 0xFF, 0xDB, 0x60, + 0x58, 0x4F, 0x3B, 0x78, 0xFF, 0xFF, 0x13, 0xE1, 0xA3, 0xFF, 0xC7, 0x60, 0x2E, 0x78, 0xFF, 0xFF, + 0xDC, 0x60, 0x87, 0x78, 0xFF, 0xFF, 0x0F, 0x60, 0xCE, 0x62, 0xA2, 0xD1, 0x80, 0x60, 0x00, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x22, 0x00, 0x75, 0xF3, 0x31, 0x40, 0x01, 0x2A, 0x1E, 0x00, + 0xDC, 0x84, 0x01, 0xB4, 0x75, 0xFB, 0x09, 0x02, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x00, 0x60, + 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x11, 0x00, 0x0F, 0x60, 0xDC, 0x62, 0xA2, 0xD1, + 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x08, 0x00, 0xA9, 0xFE, 0xE4, 0x05, + 0xAB, 0xFE, 0x07, 0x05, 0xA8, 0xFE, 0xD4, 0x05, 0xAA, 0xFE, 0xD5, 0x05, 0xA1, 0xFF, 0xFF, 0xFF, + 0x85, 0x3E, 0x1B, 0x60, 0xC4, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x03, 0x02, + 0xC7, 0x60, 0x2E, 0x78, 0xFF, 0xFF, 0x26, 0x45, 0xD4, 0x80, 0x0F, 0xF0, 0xF9, 0x03, 0x64, 0x44, + 0x70, 0xB0, 0x70, 0x2A, 0x14, 0x00, 0x1F, 0x60, 0x18, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, + 0xFF, 0xFF, 0x08, 0x28, 0xA2, 0xDB, 0xA2, 0xFF, 0x8F, 0xF3, 0xFF, 0xFF, 0xCC, 0x84, 0xFE, 0xA0, + 0x8F, 0xFB, 0x01, 0x07, 0xD4, 0xFE, 0xA3, 0xFF, 0xCB, 0x60, 0xBC, 0x78, 0xFF, 0xFF, 0x64, 0x40, + 0x02, 0x26, 0x09, 0x00, 0x66, 0x45, 0x09, 0xF4, 0x0F, 0xF2, 0x02, 0x18, 0x65, 0x46, 0xE3, 0x1B, + 0x00, 0x64, 0x40, 0x46, 0xCB, 0x01, 0xA2, 0xFF, 0x8F, 0xF3, 0x46, 0x46, 0xCC, 0x84, 0xFE, 0xA0, + 0x8F, 0xFB, 0x01, 0x07, 0xD4, 0xFE, 0xA3, 0xFF, 0x0F, 0xF0, 0xA3, 0xFC, 0x64, 0x44, 0x80, 0x26, + 0x22, 0x00, 0x98, 0xF1, 0x1E, 0x60, 0xF8, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, + 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, + 0x00, 0x75, 0x88, 0xFF, 0x32, 0x44, 0x01, 0x2A, 0x03, 0x00, 0x07, 0x60, 0x01, 0x64, 0x04, 0x00, + 0x02, 0x2A, 0x06, 0x00, 0x00, 0x60, 0x01, 0x64, 0x23, 0xFA, 0xCB, 0x60, 0xC8, 0x78, 0xFF, 0xFF, + 0xCB, 0x60, 0xBC, 0x78, 0xFF, 0xFF, 0x08, 0x26, 0x3F, 0x00, 0x2A, 0xF2, 0x60, 0x63, 0x60, 0x40, + 0x02, 0x2B, 0x66, 0x63, 0xBE, 0xD2, 0x69, 0xF1, 0xA3, 0xD2, 0xD0, 0x80, 0x68, 0xF1, 0x18, 0x02, + 0xBF, 0xD2, 0xD0, 0x80, 0x67, 0xF1, 0x14, 0x02, 0xD0, 0x80, 0xFF, 0xFF, 0x11, 0x02, 0x98, 0xF1, + 0x1F, 0x60, 0x04, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, + 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, + 0x32, 0x44, 0x01, 0x2A, 0x03, 0x00, 0x07, 0x60, 0x02, 0x64, 0x04, 0x00, 0x02, 0x2A, 0x06, 0x00, + 0x00, 0x60, 0x02, 0x64, 0x23, 0xFA, 0xCB, 0x60, 0xC8, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0xFF, 0xFF, + 0x60, 0x40, 0xB0, 0x3A, 0x06, 0x00, 0x00, 0x60, 0x02, 0x64, 0x23, 0xFA, 0xC8, 0x60, 0x6D, 0x78, + 0xFF, 0xFF, 0xCB, 0x60, 0xBC, 0x78, 0xFF, 0xFF, 0x32, 0x44, 0x01, 0x2A, 0x4A, 0x00, 0x20, 0x60, + 0x6C, 0x63, 0xBF, 0xD3, 0x00, 0x65, 0xB4, 0x81, 0xDB, 0x83, 0x3D, 0x03, 0xBF, 0xD3, 0xA3, 0xD3, + 0x40, 0x48, 0xBE, 0xD3, 0x40, 0x4A, 0x2E, 0xF0, 0x40, 0x4C, 0xD0, 0x80, 0x2D, 0xF0, 0x08, 0x02, + 0x2A, 0x44, 0xD0, 0x80, 0x2C, 0xF0, 0x04, 0x02, 0x28, 0x44, 0xD0, 0x80, 0xFF, 0xFF, 0x2B, 0x03, + 0x31, 0xF0, 0x2C, 0x44, 0xD0, 0x80, 0x30, 0xF0, 0x08, 0x02, 0x2A, 0x44, 0xD0, 0x80, 0x2F, 0xF0, + 0x04, 0x02, 0x28, 0x44, 0xD0, 0x80, 0xFF, 0xFF, 0x1E, 0x03, 0x34, 0xF0, 0x2C, 0x44, 0xD0, 0x80, + 0x33, 0xF0, 0x08, 0x02, 0x2A, 0x44, 0xD0, 0x80, 0x32, 0xF0, 0x04, 0x02, 0x28, 0x44, 0xD0, 0x80, + 0xFF, 0xFF, 0x11, 0x03, 0x38, 0xF0, 0x2C, 0x44, 0xD0, 0x80, 0x37, 0xF0, 0x08, 0x02, 0x2A, 0x44, + 0xD0, 0x80, 0x36, 0xF0, 0x04, 0x02, 0x28, 0x44, 0xD0, 0x80, 0xFF, 0xFF, 0x04, 0x03, 0xFA, 0xA1, + 0x06, 0xA3, 0xB7, 0x03, 0xC3, 0x01, 0x07, 0x60, 0x00, 0x64, 0x23, 0xFA, 0xCB, 0x60, 0xC8, 0x78, + 0xFF, 0xFF, 0x2A, 0xF2, 0x0F, 0xF0, 0x60, 0x45, 0xA4, 0x36, 0x08, 0x00, 0x0C, 0xB4, 0x04, 0x36, + 0x02, 0x00, 0x0C, 0x3A, 0x06, 0x00, 0xCB, 0x60, 0xBC, 0x78, 0xFF, 0xFF, 0xC9, 0x60, 0x42, 0x78, + 0xFF, 0xFF, 0x26, 0xF2, 0x50, 0xF1, 0x60, 0x47, 0x00, 0x7E, 0xD0, 0x84, 0x1F, 0xA4, 0x06, 0x0E, + 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0x07, 0x00, 0xC2, 0xA4, 0xE8, 0x84, + 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x87, 0xF8, 0xBF, 0xC0, 0x84, 0xA2, 0xDB, 0x0F, 0xF0, + 0x65, 0x40, 0x40, 0x2B, 0x22, 0x00, 0x32, 0x40, 0x08, 0x26, 0x1F, 0x00, 0x07, 0xF4, 0x36, 0xF2, + 0xFF, 0xFF, 0x37, 0xB4, 0x26, 0x46, 0x19, 0x02, 0x2C, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x26, + 0x11, 0x00, 0x98, 0xF1, 0x1E, 0x60, 0xFE, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, + 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, + 0x00, 0x75, 0x88, 0xFF, 0xCB, 0x60, 0xBC, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0x64, 0x40, 0x60, 0x26, + 0x03, 0x00, 0xC9, 0x60, 0x1A, 0x78, 0xFF, 0xFF, 0x60, 0x40, 0x40, 0x3A, 0xF3, 0x01, 0x98, 0xF1, + 0x1E, 0x60, 0xF2, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, + 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, + 0x27, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x3B, 0x12, 0x00, 0x98, 0xF1, 0x1F, 0x60, 0x00, 0x64, + 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, + 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x13, 0x00, 0x02, 0x3B, + 0x11, 0x00, 0x98, 0xF1, 0x1F, 0x60, 0x02, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, + 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, + 0x00, 0x75, 0x88, 0xFF, 0x2A, 0xF2, 0x28, 0x41, 0x40, 0xA8, 0x01, 0xB1, 0x02, 0x02, 0x5F, 0x02, + 0x89, 0x00, 0x60, 0x40, 0x08, 0x2A, 0x2B, 0x00, 0x98, 0xF1, 0x1E, 0x60, 0xF0, 0x64, 0xA0, 0xD3, + 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, + 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x1B, 0xF2, 0xFF, 0xFF, 0x60, 0x45, + 0x98, 0xF1, 0x1E, 0x60, 0xF6, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xD8, 0x80, 0xC4, 0x84, 0x0B, 0x03, + 0x07, 0x05, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x09, 0x04, 0xC6, 0xFE, 0x07, 0x00, + 0x00, 0x64, 0xB8, 0x84, 0xA2, 0xDB, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x0F, 0xF2, + 0xFF, 0xFF, 0x60, 0x40, 0x40, 0x26, 0x28, 0x00, 0x32, 0x44, 0x02, 0x26, 0x25, 0x00, 0x10, 0x2B, + 0x26, 0x00, 0x20, 0x60, 0x6C, 0x63, 0xBF, 0xD3, 0x2C, 0xF0, 0x00, 0xA8, 0x60, 0x41, 0x0D, 0x03, + 0x50, 0xFE, 0xBD, 0xD3, 0x2D, 0xF0, 0xD0, 0x80, 0xBD, 0xD3, 0x2E, 0xF0, 0xD0, 0x80, 0xBD, 0xD3, + 0x2C, 0xF0, 0xD0, 0x80, 0xFA, 0xA1, 0x10, 0x0C, 0xF3, 0x02, 0x50, 0xFE, 0x60, 0x60, 0x01, 0x64, + 0xD0, 0x80, 0x2D, 0xF0, 0x1D, 0x64, 0xD0, 0x80, 0x2E, 0xF0, 0x01, 0x64, 0xD0, 0x80, 0xFF, 0xFF, + 0x03, 0x0C, 0xCB, 0x60, 0xBC, 0x78, 0xFF, 0xFF, 0x32, 0x40, 0x40, 0x2A, 0x00, 0x00, 0xCB, 0x60, + 0xB6, 0x78, 0xFF, 0xFF, 0x32, 0x40, 0x40, 0x26, 0xFA, 0x01, 0x2A, 0xF0, 0xFF, 0xFF, 0x64, 0x40, + 0x08, 0x2A, 0x20, 0x00, 0x32, 0x40, 0x02, 0x2A, 0x1D, 0x00, 0x03, 0x67, 0xA0, 0x84, 0x00, 0x37, + 0x64, 0x63, 0x60, 0x40, 0x02, 0x37, 0x5E, 0x63, 0x60, 0x40, 0x01, 0x37, 0x58, 0x63, 0x60, 0x40, + 0x03, 0x37, 0x0D, 0x00, 0xBD, 0xD2, 0x67, 0xF1, 0xBD, 0xD2, 0xD0, 0x80, 0x68, 0xF1, 0x07, 0x02, + 0xD0, 0x80, 0xBD, 0xD2, 0x69, 0xF1, 0x03, 0x02, 0xD0, 0x80, 0xFF, 0xFF, 0x03, 0x03, 0xCB, 0x60, + 0xBC, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0x87, 0xF4, 0x60, 0x40, 0x03, 0x2B, 0x31, 0x00, 0x89, 0xF3, + 0x06, 0x61, 0x60, 0x43, 0x66, 0x45, 0x31, 0xF0, 0x63, 0x46, 0x05, 0xF2, 0x65, 0x46, 0xD0, 0x80, + 0x30, 0xF0, 0x0F, 0x02, 0x63, 0x46, 0x04, 0xF2, 0x65, 0x46, 0xD0, 0x80, 0x2F, 0xF0, 0x09, 0x02, + 0x63, 0x46, 0x03, 0xF2, 0x65, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x03, 0x02, 0xFF, 0xFF, 0x48, 0xFE, + 0x06, 0x00, 0xCD, 0x81, 0x02, 0xA3, 0xE7, 0x02, 0x88, 0xF1, 0x08, 0xFE, 0x64, 0x43, 0x03, 0x03, + 0xCB, 0x60, 0xBC, 0x78, 0xFF, 0xFF, 0x43, 0x43, 0x23, 0x46, 0x06, 0xF0, 0x26, 0x46, 0x07, 0x67, + 0xA0, 0x84, 0x23, 0xFA, 0x64, 0x40, 0x02, 0x26, 0x2B, 0x00, 0xCB, 0x60, 0xBC, 0x78, 0xFF, 0xFF, + 0x26, 0x1B, 0x31, 0xF2, 0x12, 0x60, 0xCE, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, + 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x31, 0xF0, 0x63, 0x46, + 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x30, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, + 0x06, 0x02, 0x61, 0x46, 0x2F, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, + 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0x88, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x43, 0x43, + 0x07, 0xFC, 0x43, 0x43, 0x02, 0xFE, 0x1D, 0xF0, 0x12, 0x60, 0xC0, 0x62, 0xC0, 0x64, 0xC0, 0x84, + 0xA2, 0xD1, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xC0, 0x84, 0xA2, 0xDB, + 0x63, 0x45, 0x2A, 0xF2, 0x35, 0xF0, 0x60, 0x40, 0xA4, 0x36, 0x0B, 0x00, 0x08, 0x2B, 0x0C, 0x00, + 0x23, 0x46, 0x22, 0xF2, 0x26, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x06, 0x02, 0xCB, 0x60, 0xBC, 0x78, + 0xFF, 0xFF, 0xCB, 0x60, 0xB6, 0x78, 0xFF, 0xFF, 0x23, 0x46, 0x1E, 0xF2, 0x26, 0x46, 0x44, 0x4C, + 0x0F, 0x26, 0x19, 0x00, 0x00, 0xBC, 0x40, 0x45, 0x0B, 0x03, 0x00, 0x64, 0x23, 0x46, 0x1E, 0xFA, + 0x26, 0x46, 0xA2, 0xFF, 0xB4, 0x60, 0x58, 0x4E, 0x48, 0x78, 0xFF, 0xFF, 0xA3, 0xFF, 0x26, 0x46, + 0x2A, 0xF0, 0x2C, 0x44, 0x64, 0x40, 0x04, 0x27, 0x06, 0x00, 0x23, 0x46, 0x22, 0xFA, 0x26, 0x46, + 0xCA, 0x60, 0xB6, 0x78, 0xFF, 0xFF, 0x3F, 0xF2, 0x02, 0xFA, 0xA2, 0xFF, 0x16, 0xF0, 0xFF, 0xFF, + 0x64, 0x44, 0x01, 0x26, 0xDC, 0x9C, 0x93, 0xF3, 0x2A, 0xF2, 0xDC, 0x83, 0x93, 0xFD, 0x06, 0xF4, + 0x01, 0xF8, 0x26, 0x46, 0x60, 0x40, 0x40, 0x2B, 0x18, 0x00, 0x64, 0x44, 0x00, 0x65, 0xFF, 0xB4, + 0xFC, 0xA4, 0x06, 0xF0, 0x03, 0x03, 0x64, 0x46, 0x0C, 0x0D, 0x02, 0x65, 0x26, 0x46, 0x00, 0xF2, + 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, 0x02, 0x03, 0x60, 0x46, 0xF9, 0x01, 0x01, 0xF2, 0xFF, 0xFF, + 0xD4, 0x84, 0x01, 0xFA, 0x66, 0x44, 0x26, 0x46, 0x06, 0xFA, 0x06, 0xF4, 0x00, 0xF2, 0x80, 0xFC, + 0x40, 0x45, 0xB4, 0x60, 0x58, 0x4E, 0x48, 0x78, 0xFF, 0xFF, 0xA3, 0xFF, 0x26, 0x46, 0x2C, 0x44, + 0x0F, 0x26, 0x10, 0x00, 0x23, 0x46, 0x22, 0xFA, 0x26, 0x44, 0x1E, 0xFA, 0x26, 0x46, 0x1B, 0x60, + 0xDA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0x6F, 0x00, 0xA3, 0x46, 0x22, 0xF2, 0x60, 0x45, 0xDC, 0x84, 0xD4, 0x80, 0x22, 0xFA, + 0xA3, 0x46, 0x6C, 0x02, 0x2A, 0xF0, 0xA3, 0x46, 0x1E, 0xF2, 0xA3, 0x46, 0x00, 0xBC, 0x00, 0xF2, + 0x01, 0x02, 0x64, 0x00, 0x44, 0x4C, 0x3F, 0xF0, 0x60, 0x43, 0x23, 0x46, 0x1E, 0xF4, 0x09, 0x60, + 0x00, 0x65, 0x3F, 0xF2, 0x26, 0x46, 0xC0, 0x84, 0xD4, 0x80, 0x60, 0x45, 0x57, 0x07, 0x80, 0xFC, + 0x1B, 0xF2, 0x06, 0xF2, 0x60, 0x41, 0x23, 0x46, 0x1E, 0xF4, 0x1B, 0xF0, 0x06, 0xF0, 0xC1, 0x81, + 0x06, 0xFA, 0x05, 0xFA, 0x9B, 0xFA, 0x65, 0x44, 0x3F, 0xFA, 0x64, 0x46, 0x00, 0xFC, 0x63, 0x46, + 0x01, 0xF2, 0x10, 0x61, 0xF2, 0xA4, 0x01, 0xFA, 0xC8, 0x83, 0x02, 0x64, 0x59, 0xD0, 0x58, 0xD8, + 0xFD, 0x1F, 0x06, 0x45, 0x1B, 0x60, 0xDA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x25, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xA2, 0xFF, 0x00, 0xF4, 0x01, 0xF0, 0x0A, 0x18, + 0x70, 0x67, 0xA0, 0x80, 0xF0, 0x67, 0x06, 0x03, 0xC0, 0x84, 0x01, 0xFA, 0x25, 0x46, 0x25, 0x44, + 0x80, 0xFC, 0x05, 0xFA, 0xB4, 0x60, 0x58, 0x4E, 0x48, 0x78, 0xFF, 0xFF, 0xD4, 0xFE, 0xA3, 0xFF, + 0x2C, 0x44, 0x04, 0x27, 0x16, 0x00, 0x23, 0x46, 0x1E, 0xF2, 0x9E, 0xFC, 0x60, 0x46, 0x46, 0x46, + 0x3F, 0xF2, 0x00, 0xF4, 0x60, 0x47, 0x08, 0xFA, 0x26, 0x46, 0x2C, 0x43, 0x2A, 0xFC, 0x06, 0xF4, + 0x00, 0x64, 0x00, 0xFA, 0x01, 0xF0, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0x01, 0xFA, 0x26, 0x46, + 0x1D, 0x00, 0x00, 0x66, 0x46, 0x46, 0xC7, 0x60, 0x31, 0x78, 0xFF, 0xFF, 0xA3, 0x46, 0x1E, 0xF0, + 0x9E, 0xFC, 0x00, 0x63, 0x33, 0x85, 0xA3, 0x46, 0x0D, 0x03, 0xA3, 0x46, 0x22, 0xF2, 0x0F, 0x65, + 0xA4, 0x85, 0xD4, 0x84, 0x22, 0xFA, 0xA3, 0x46, 0xA2, 0xFF, 0xB4, 0x60, 0x58, 0x4E, 0x48, 0x78, + 0xFF, 0xFF, 0xA3, 0xFF, 0x26, 0x46, 0xCB, 0x60, 0xBC, 0x78, 0xFF, 0xFF, 0x07, 0xF0, 0x88, 0xF3, + 0xFF, 0xFF, 0xD0, 0x80, 0x64, 0x46, 0x6F, 0xF2, 0x26, 0x46, 0x50, 0x03, 0x60, 0x40, 0x00, 0x36, + 0x4D, 0x00, 0x64, 0x46, 0x0E, 0xF2, 0x26, 0x46, 0x60, 0x47, 0xFF, 0xB5, 0x27, 0xF2, 0xFF, 0xFF, + 0xFF, 0xB4, 0xD4, 0x80, 0xFF, 0xFF, 0x42, 0x06, 0x64, 0x46, 0x6F, 0xF2, 0x26, 0x46, 0x60, 0x47, + 0xFF, 0xB5, 0x65, 0x41, 0x0F, 0x60, 0xA2, 0x65, 0x00, 0x64, 0xE9, 0x81, 0xD8, 0x84, 0xFD, 0x02, + 0xC8, 0x84, 0x60, 0x43, 0x44, 0xD1, 0xFF, 0xFF, 0x64, 0x47, 0xFF, 0xB5, 0x27, 0xF2, 0xFF, 0xFF, + 0xFF, 0xB4, 0xD4, 0x80, 0x64, 0x44, 0x06, 0x06, 0x07, 0xF0, 0xFF, 0xFF, 0x64, 0x46, 0x0E, 0xFA, + 0x26, 0x46, 0x19, 0x00, 0x00, 0x61, 0x27, 0xF0, 0x0F, 0x60, 0xA2, 0x65, 0x61, 0x43, 0x45, 0xD3, + 0x64, 0x41, 0xFF, 0xB1, 0x61, 0x45, 0x60, 0x47, 0xFF, 0xB4, 0xDB, 0x83, 0xD4, 0x80, 0x63, 0x41, + 0xF3, 0x02, 0xCB, 0x83, 0x63, 0x41, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, 0x07, 0xF0, 0xFF, 0xFF, + 0x64, 0x46, 0x0E, 0xFA, 0x26, 0x46, 0xAF, 0x84, 0xE8, 0x81, 0x05, 0x03, 0x00, 0x60, 0x01, 0x64, + 0xCD, 0x81, 0xE0, 0x84, 0xFD, 0x02, 0x64, 0x46, 0x70, 0xFA, 0x26, 0x46, 0x2A, 0xF2, 0x32, 0xF0, + 0x60, 0x40, 0x08, 0x2A, 0x5C, 0x00, 0x01, 0x2B, 0x2F, 0x00, 0x64, 0x40, 0x01, 0x2A, 0x2C, 0x00, + 0x98, 0xF1, 0x1E, 0x60, 0xF0, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, + 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, + 0x88, 0xFF, 0x1B, 0xF2, 0xFF, 0xFF, 0x60, 0x45, 0x98, 0xF1, 0x1E, 0x60, 0xF6, 0x64, 0xA0, 0xD3, + 0xFF, 0xFF, 0xD8, 0x80, 0xC4, 0x84, 0x0B, 0x03, 0x07, 0x05, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, + 0xA2, 0xDB, 0x09, 0x04, 0xC6, 0xFE, 0x07, 0x00, 0x00, 0x64, 0xB8, 0x84, 0xA2, 0xDB, 0x8A, 0xFF, + 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x2B, 0x00, 0x98, 0xF1, 0x1E, 0x60, 0xEE, 0x64, 0xA0, 0xD3, + 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, + 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x1B, 0xF2, 0xFF, 0xFF, 0x60, 0x45, + 0x98, 0xF1, 0x1E, 0x60, 0xF4, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xD8, 0x80, 0xC4, 0x84, 0x0B, 0x03, + 0x07, 0x05, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x09, 0x04, 0xC6, 0xFE, 0x07, 0x00, + 0x00, 0x64, 0xB8, 0x84, 0xA2, 0xDB, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x07, 0xF4, + 0xFF, 0xFF, 0x22, 0xF2, 0x26, 0x46, 0x0F, 0xB4, 0xDC, 0x85, 0x98, 0xF1, 0x1E, 0x60, 0xF2, 0x64, + 0xA0, 0xD3, 0xFF, 0xFF, 0xD8, 0x80, 0xC4, 0x84, 0x0B, 0x03, 0x07, 0x05, 0xDC, 0x80, 0xD0, 0x80, + 0x04, 0x03, 0xA2, 0xDB, 0x09, 0x04, 0xC6, 0xFE, 0x07, 0x00, 0x00, 0x64, 0xB8, 0x84, 0xA2, 0xDB, + 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x27, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x3B, + 0x12, 0x00, 0x98, 0xF1, 0x1F, 0x60, 0x00, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, + 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, + 0x00, 0x75, 0x88, 0xFF, 0x13, 0x00, 0x02, 0x3B, 0x11, 0x00, 0x98, 0xF1, 0x1F, 0x60, 0x02, 0x64, + 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, + 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0xCC, 0x60, 0x06, 0x78, + 0xFF, 0xFF, 0xC7, 0x60, 0x31, 0x78, 0xFF, 0xFF, 0x1B, 0x60, 0xDA, 0x64, 0x40, 0x4B, 0xF0, 0x60, + 0x58, 0x4D, 0x75, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0xC7, 0x60, 0x31, 0x78, 0xFF, 0xFF, + 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0xBE, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xF8, 0xFE, 0x00, 0x66, 0x46, 0x46, 0xC7, 0x60, 0x31, 0x78, + 0xFF, 0xFF, 0x2A, 0xF2, 0x58, 0x63, 0x60, 0x47, 0x01, 0x27, 0x64, 0x63, 0x25, 0x60, 0x26, 0x62, + 0x61, 0x5C, 0xA2, 0xD9, 0xBD, 0xD0, 0xBD, 0xD0, 0x64, 0x45, 0x64, 0x41, 0xBD, 0xD0, 0x00, 0xF4, + 0x04, 0xF8, 0x83, 0xFA, 0x82, 0xF8, 0xA6, 0x46, 0x02, 0xB0, 0x5E, 0x63, 0x04, 0x03, 0x64, 0x63, + 0x03, 0xB0, 0x02, 0x3A, 0x6C, 0x63, 0x3F, 0xF2, 0xBD, 0xD0, 0xBD, 0xD0, 0x64, 0x45, 0x64, 0x41, + 0xBD, 0xD0, 0xA6, 0x46, 0x07, 0xF8, 0x86, 0xFA, 0x85, 0xF8, 0x60, 0x47, 0x08, 0xFA, 0x25, 0x60, + 0x26, 0x62, 0xA2, 0xD1, 0x26, 0x46, 0x64, 0x41, 0x2F, 0x58, 0xFF, 0xFF, 0x2A, 0xF2, 0x2C, 0xF0, + 0x31, 0x40, 0x20, 0x26, 0x09, 0x00, 0x60, 0x40, 0xA4, 0x36, 0x21, 0x00, 0x08, 0x26, 0x07, 0x00, + 0x7E, 0xF1, 0xCC, 0x60, 0xCF, 0x78, 0xFF, 0xFF, 0xCC, 0x60, 0xFF, 0x78, 0xFF, 0xFF, 0x64, 0x40, + 0x01, 0x26, 0x12, 0x00, 0x3F, 0xF0, 0x32, 0x40, 0x10, 0x2A, 0x0A, 0x00, 0x64, 0x41, 0x60, 0x40, + 0x40, 0x27, 0x06, 0x00, 0xCD, 0x81, 0xDD, 0x81, 0x03, 0x03, 0x02, 0x03, 0x01, 0x61, 0x01, 0x00, + 0x00, 0x61, 0x60, 0x40, 0x18, 0x3A, 0x03, 0x00, 0xCD, 0x60, 0x3B, 0x78, 0xFF, 0xFF, 0x07, 0xF2, + 0x88, 0xF1, 0x66, 0x45, 0xD0, 0x80, 0x60, 0x46, 0x06, 0xF2, 0x65, 0x46, 0x03, 0x03, 0xFF, 0xFF, + 0x02, 0x26, 0x07, 0x00, 0xDA, 0x60, 0x58, 0x4F, 0xDB, 0x78, 0xFF, 0xFF, 0xCD, 0x60, 0x37, 0x78, + 0xFF, 0xFF, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0xA4, 0x3A, 0x07, 0x00, 0xDD, 0x60, 0x58, 0x4F, + 0x45, 0x78, 0xFF, 0xFF, 0xCD, 0x60, 0x37, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0xCB, 0x60, 0x58, 0x4F, + 0xD9, 0x78, 0xFF, 0xFF, 0x3F, 0xF2, 0x06, 0x65, 0xD4, 0x80, 0x60, 0x43, 0x52, 0x04, 0x00, 0xF4, + 0xAA, 0x60, 0xAA, 0x65, 0x09, 0xF2, 0x0A, 0xF0, 0xD4, 0x80, 0x03, 0x64, 0x4A, 0x02, 0xD0, 0x80, + 0x00, 0x64, 0x0B, 0xF0, 0x46, 0x02, 0x64, 0x45, 0xD4, 0x80, 0xF8, 0x7F, 0x08, 0x02, 0x0C, 0xF0, + 0x26, 0x46, 0x64, 0x45, 0x23, 0xF0, 0x20, 0x67, 0xB0, 0x84, 0xA2, 0xDA, 0x0B, 0x00, 0xD4, 0x80, + 0x1D, 0x60, 0x60, 0x64, 0x11, 0x02, 0x0C, 0xF0, 0x26, 0x46, 0x64, 0x45, 0x23, 0xF0, 0x40, 0x67, + 0xB0, 0x84, 0xA2, 0xDA, 0x65, 0x44, 0x88, 0x3A, 0x2C, 0x00, 0x77, 0x37, 0x03, 0x00, 0x78, 0x37, + 0x01, 0x00, 0x8E, 0x37, 0x00, 0x61, 0x25, 0x00, 0xD4, 0x80, 0x08, 0x65, 0x22, 0x02, 0xD7, 0x80, + 0x01, 0x60, 0x00, 0x64, 0x0C, 0xF0, 0x1D, 0x04, 0xD0, 0x80, 0x0D, 0xF0, 0x1A, 0x02, 0x26, 0x46, + 0x14, 0xF2, 0x01, 0x63, 0x02, 0xA8, 0x64, 0x47, 0x14, 0x03, 0x7F, 0xB4, 0xFD, 0xA0, 0x06, 0x03, + 0x10, 0x07, 0x23, 0xF0, 0x60, 0x67, 0xB0, 0x84, 0xA2, 0xDA, 0x6A, 0x00, 0xD2, 0xF3, 0xFF, 0xFF, + 0x02, 0xBC, 0xD2, 0xFB, 0xE5, 0x60, 0x58, 0x4F, 0x94, 0x78, 0xFF, 0xFF, 0xCD, 0x60, 0x37, 0x78, + 0xFF, 0xFF, 0x26, 0x46, 0x61, 0x40, 0x01, 0x2A, 0x12, 0x00, 0x98, 0xF1, 0x1F, 0x60, 0x06, 0x64, + 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, + 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x7C, 0x00, 0xDD, 0x60, + 0x58, 0x4F, 0x45, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0xFF, 0xFF, 0xFF, 0xFF, 0x48, 0x36, 0x73, 0x00, + 0xCD, 0x60, 0x58, 0x4F, 0x48, 0x78, 0xFF, 0xFF, 0xCD, 0x60, 0x37, 0x78, 0xFF, 0xFF, 0x60, 0x40, + 0x0C, 0x26, 0x69, 0x00, 0x64, 0x40, 0x01, 0x2A, 0x66, 0x00, 0xB0, 0x3A, 0x05, 0x00, 0xD1, 0x60, + 0x58, 0x4F, 0x80, 0x78, 0xFF, 0xFF, 0x5B, 0x00, 0x00, 0x3A, 0x05, 0x00, 0xD4, 0x60, 0x58, 0x4F, + 0xF3, 0x78, 0xFF, 0xFF, 0x54, 0x00, 0x20, 0x3A, 0x05, 0x00, 0xD4, 0x60, 0x58, 0x4F, 0xF3, 0x78, + 0xFF, 0xFF, 0x4D, 0x00, 0xC0, 0x3A, 0x05, 0x00, 0xDA, 0x60, 0x58, 0x4F, 0x48, 0x78, 0xFF, 0xFF, + 0x46, 0x00, 0xA0, 0x3A, 0x05, 0x00, 0xDA, 0x60, 0x58, 0x4F, 0xA6, 0x78, 0xFF, 0xFF, 0x3F, 0x00, + 0x40, 0x3A, 0x0D, 0x00, 0xE1, 0x60, 0x58, 0x4F, 0x10, 0x78, 0xFF, 0xFF, 0x38, 0x00, 0x60, 0x40, + 0x50, 0x3A, 0x05, 0x00, 0xEA, 0x60, 0x58, 0x4F, 0xF5, 0x78, 0xFF, 0xFF, 0x30, 0x00, 0x33, 0x00, + 0xD2, 0xF3, 0xFF, 0xFF, 0x02, 0xBC, 0xD2, 0xFB, 0x2A, 0xF2, 0x3B, 0xF0, 0x60, 0x40, 0x40, 0x2B, + 0x19, 0x00, 0x22, 0xF2, 0xFF, 0xFF, 0x04, 0xB4, 0xFF, 0xFF, 0x14, 0x03, 0xC0, 0x60, 0x00, 0x64, + 0x64, 0x40, 0x20, 0x2B, 0x0F, 0x00, 0xA0, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0x23, 0xF2, + 0x10, 0xBD, 0xB4, 0x9C, 0x3F, 0xF2, 0x23, 0xF8, 0xF8, 0xA4, 0x3F, 0xFA, 0x00, 0xF4, 0x60, 0x47, + 0x08, 0xFA, 0x26, 0x46, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0xBE, 0x64, 0xA2, 0xDB, 0x26, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xF8, 0xFE, 0x0C, 0x00, 0x66, 0x44, + 0x00, 0xA8, 0xFF, 0xFF, 0x0A, 0x03, 0x26, 0x46, 0x1B, 0x60, 0xDA, 0x64, 0x40, 0x4B, 0xF0, 0x60, + 0x58, 0x4D, 0x75, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0xCB, 0x60, 0xB9, 0x78, 0xFF, 0xFF, + 0x14, 0xF2, 0x00, 0x7C, 0x3E, 0xF8, 0xCC, 0x84, 0xCC, 0x84, 0x19, 0x03, 0x60, 0x02, 0x11, 0xF2, + 0x07, 0xFA, 0xAC, 0xF3, 0x19, 0xFA, 0xCD, 0x60, 0x58, 0x4E, 0xE4, 0x78, 0xFF, 0xFF, 0x1B, 0x60, + 0xDA, 0x62, 0x1B, 0x60, 0x9A, 0x64, 0xA2, 0xDB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0xC8, 0xFE, 0xF2, 0x64, 0x3B, 0x42, 0x4A, 0xDB, 0x79, 0x00, 0xA2, 0xFF, + 0x46, 0x45, 0xB4, 0x60, 0x58, 0x4E, 0x91, 0x78, 0xFF, 0xFF, 0xA3, 0xFF, 0x11, 0x03, 0x7E, 0x63, + 0x46, 0x4B, 0x25, 0x46, 0xA3, 0xD0, 0x2B, 0x46, 0xA3, 0xD8, 0xFB, 0x1F, 0x89, 0xFC, 0x8A, 0xFC, + 0x88, 0xFC, 0x05, 0x18, 0x64, 0x46, 0x01, 0xF0, 0x10, 0x67, 0xC0, 0x84, 0x01, 0xFA, 0x08, 0xFE, + 0x2B, 0x46, 0x46, 0x46, 0x25, 0x46, 0xCD, 0x60, 0x58, 0x4E, 0xE4, 0x78, 0xFF, 0xFF, 0x1F, 0x60, + 0x8E, 0x62, 0xA2, 0xD3, 0x88, 0xF3, 0x00, 0xA8, 0x07, 0xFA, 0x0F, 0x03, 0x1B, 0x60, 0xDA, 0x62, + 0x1B, 0x60, 0x94, 0x64, 0xA2, 0xDB, 0x25, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0xF3, 0x64, 0x3B, 0x42, 0x4A, 0xDB, 0x0E, 0x00, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, + 0x88, 0x64, 0xA2, 0xDB, 0x25, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xF4, 0x64, 0x3B, 0x42, 0x4A, 0xDB, 0x26, 0x44, 0x00, 0xA8, 0xC1, 0xFE, 0x31, 0x03, 0xD2, 0xF3, + 0xFF, 0xFF, 0x02, 0xBC, 0xD2, 0xFB, 0x26, 0x46, 0x2A, 0xF2, 0x3B, 0xF0, 0x60, 0x40, 0x40, 0x2B, + 0x18, 0x00, 0x64, 0x40, 0x20, 0x2B, 0x15, 0x00, 0x22, 0xF2, 0xFF, 0xFF, 0x04, 0xB4, 0xFF, 0xFF, + 0x10, 0x03, 0xC0, 0x67, 0xA0, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0x23, 0xF2, 0x10, 0xBD, + 0xB4, 0x9C, 0x3F, 0xF2, 0x23, 0xF8, 0xF8, 0xA4, 0x3F, 0xFA, 0x00, 0xF4, 0x60, 0x47, 0x08, 0xFA, + 0x26, 0x46, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0xBE, 0x64, 0xA2, 0xDB, 0x26, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xF8, 0xFE, 0xF1, 0x64, 0x3B, 0x42, 0x4A, 0xDB, + 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x2A, 0xF2, 0x82, 0x60, 0xFF, 0x65, 0xA4, 0x87, + 0x02, 0xBF, 0x2A, 0xFA, 0x1C, 0xF2, 0x13, 0xFA, 0x32, 0xF2, 0x2C, 0xFA, 0x33, 0xF2, 0x2D, 0xFA, + 0x34, 0xF2, 0x2E, 0xFA, 0x2F, 0xF2, 0x32, 0xFA, 0x30, 0xF2, 0x33, 0xFA, 0x31, 0xF2, 0x34, 0xFA, + 0x67, 0xF3, 0x2F, 0xFA, 0x68, 0xF3, 0x30, 0xFA, 0x69, 0xF3, 0x31, 0xFA, 0x2E, 0x58, 0xFF, 0xFF, + 0x0F, 0x60, 0xF8, 0x62, 0xD0, 0x60, 0x7B, 0x64, 0xA2, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0x1F, 0x60, + 0x62, 0x63, 0x20, 0x60, 0x02, 0x62, 0xA2, 0xD3, 0xA3, 0xDB, 0x1E, 0x63, 0x1F, 0x60, 0x6C, 0x61, + 0x20, 0x60, 0x0C, 0x64, 0x58, 0xD1, 0x59, 0xD9, 0xFD, 0x1F, 0x1F, 0x60, 0x8E, 0x63, 0x20, 0x60, + 0x2E, 0x62, 0xA2, 0xD3, 0xA3, 0xDB, 0x1F, 0x60, 0x90, 0x63, 0x20, 0x60, 0x30, 0x62, 0xA2, 0xD3, + 0xA3, 0xDB, 0x1F, 0x60, 0x9A, 0x63, 0x20, 0x60, 0x3A, 0x62, 0xA2, 0xD3, 0xA3, 0xDB, 0x1F, 0x60, + 0x9C, 0x63, 0x20, 0x60, 0x3C, 0x62, 0xA2, 0xD3, 0xA3, 0xDB, 0x1F, 0x60, 0x9E, 0x63, 0x20, 0x60, + 0x3E, 0x62, 0xA2, 0xD3, 0xA3, 0xDB, 0x1F, 0x60, 0xA0, 0x63, 0x20, 0x60, 0x40, 0x62, 0xA2, 0xD3, + 0xA3, 0xDB, 0x1F, 0x60, 0x92, 0x63, 0x20, 0x60, 0x32, 0x62, 0xA2, 0xD3, 0xA3, 0xDB, 0x1F, 0x60, + 0x94, 0x63, 0x20, 0x60, 0x34, 0x62, 0xA2, 0xD3, 0xA3, 0xDB, 0x1F, 0x60, 0x96, 0x63, 0x20, 0x60, + 0x36, 0x62, 0xA2, 0xD3, 0xA3, 0xDB, 0x1F, 0x60, 0xB6, 0x63, 0xBD, 0xD1, 0xCB, 0xF9, 0x67, 0xF9, + 0xBD, 0xD1, 0xCC, 0xF9, 0x68, 0xF9, 0xA3, 0xD1, 0xCD, 0xF9, 0x69, 0xF9, 0x01, 0x64, 0x6B, 0xFB, + 0x1F, 0x60, 0xA8, 0x62, 0xA2, 0xD3, 0xC4, 0xFB, 0x00, 0x63, 0x4A, 0xFD, 0x5A, 0xFD, 0x6C, 0xFD, + 0x6D, 0xFD, 0x21, 0x60, 0x82, 0x64, 0xA0, 0xD3, 0xEA, 0x60, 0x58, 0x4E, 0x78, 0x78, 0xFF, 0xFF, + 0x21, 0x60, 0x80, 0x64, 0xA0, 0xD1, 0x1F, 0x60, 0x92, 0x62, 0xA2, 0xD3, 0xFF, 0x60, 0xE7, 0x65, + 0x32, 0x41, 0xA5, 0x81, 0xFF, 0xA0, 0xFF, 0xFF, 0x01, 0x03, 0x0B, 0x00, 0x08, 0x65, 0xB5, 0x81, + 0x1F, 0x60, 0x96, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, 0x02, 0x00, 0x10, 0x65, + 0xB5, 0x81, 0x41, 0x52, 0x88, 0xF5, 0x32, 0x44, 0x10, 0xB0, 0xFF, 0xFF, 0x0B, 0x03, 0x21, 0x60, + 0x2C, 0x62, 0xA2, 0xD3, 0x06, 0xF0, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0x80, 0xBF, + 0xB0, 0x84, 0x06, 0xFA, 0x1F, 0x60, 0x92, 0x62, 0xA2, 0xD3, 0x22, 0x7C, 0xFF, 0xA0, 0xFD, 0xA0, + 0x05, 0x06, 0x03, 0x03, 0xFE, 0xA0, 0x04, 0x7C, 0x01, 0x02, 0x36, 0xF8, 0x0E, 0xF0, 0x0F, 0x60, + 0xA2, 0x65, 0x20, 0x60, 0x38, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xFE, 0xA0, 0x03, 0xA8, 0x11, 0x06, + 0x5F, 0xF1, 0x06, 0x02, 0x64, 0x44, 0x08, 0x2A, 0x09, 0x00, 0x06, 0x64, 0x44, 0xD3, 0x0D, 0x00, + 0x64, 0x44, 0x20, 0x2A, 0x03, 0x00, 0x0A, 0x64, 0x44, 0xD3, 0x07, 0x00, 0x01, 0x64, 0x44, 0xD3, + 0x04, 0x00, 0xE8, 0x84, 0xE0, 0x84, 0x44, 0xD3, 0x00, 0x00, 0x0E, 0xFA, 0x1F, 0x60, 0x9E, 0x62, + 0xA2, 0xD1, 0x20, 0x44, 0x20, 0xB5, 0x64, 0x41, 0x00, 0xB9, 0xD4, 0x84, 0x08, 0x28, 0x20, 0xBC, + 0x40, 0x40, 0x11, 0x60, 0xF0, 0x61, 0xA1, 0xD3, 0xFF, 0xFF, 0x00, 0xB8, 0x10, 0x60, 0x0C, 0x65, + 0x0D, 0x03, 0x11, 0x60, 0xF8, 0x63, 0xC5, 0xF3, 0xA3, 0xD1, 0xE0, 0x84, 0xC4, 0x84, 0xA0, 0xD3, + 0xFF, 0xFF, 0x01, 0xB0, 0xFF, 0xFF, 0x02, 0x02, 0xC5, 0xF9, 0x65, 0xF9, 0xC5, 0xF3, 0x01, 0x61, + 0xCC, 0x84, 0xFF, 0xFF, 0x02, 0x03, 0xE1, 0x81, 0xFB, 0x01, 0x9A, 0xF3, 0x61, 0x45, 0xA4, 0x80, + 0xFF, 0xFF, 0x0B, 0x02, 0x00, 0xB8, 0x01, 0x63, 0x08, 0x03, 0xE8, 0x84, 0xFF, 0xFF, 0x02, 0x24, + 0x02, 0x00, 0xDF, 0x83, 0xFA, 0x01, 0xC5, 0xFD, 0x65, 0xFD, 0x0A, 0x64, 0x25, 0x60, 0x1E, 0x63, + 0xA3, 0xDB, 0x01, 0x64, 0x25, 0x60, 0x20, 0x63, 0xA3, 0xDB, 0xB6, 0xF1, 0x09, 0x60, 0x2A, 0x64, + 0xD0, 0x80, 0x03, 0x64, 0x01, 0x06, 0x06, 0x64, 0xB0, 0xFB, 0x0F, 0x60, 0xD6, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0xDE, 0xFE, 0x0B, 0x04, 0x0F, 0x60, 0xD8, 0x62, 0x40, 0x60, 0x00, 0x64, 0xA2, 0xDB, + 0xCF, 0x60, 0x05, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD6, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x65, 0xF1, 0x1C, 0x60, 0x00, 0x62, 0xA2, 0xD9, 0x08, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x2D, 0xFF, 0x0F, 0x60, 0xD8, 0x62, 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xCF, 0x60, + 0x2D, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD6, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0xBE, 0xFE, 0x0F, 0x60, 0xCE, 0x62, 0xA2, 0xD1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x20, 0x44, 0x01, 0x65, 0x34, 0x80, 0x1F, 0x60, 0xA6, 0x64, 0xA0, 0xD3, + 0xC3, 0xFB, 0x60, 0x40, 0x05, 0x3A, 0x03, 0x00, 0xEB, 0x60, 0x1A, 0x61, 0x11, 0x00, 0x04, 0x3A, + 0x03, 0x00, 0xEB, 0x60, 0x0E, 0x61, 0x0C, 0x00, 0x03, 0x3A, 0x03, 0x00, 0xEB, 0x60, 0x02, 0x61, + 0x07, 0x00, 0x02, 0x3A, 0x03, 0x00, 0xEA, 0x60, 0xF6, 0x61, 0x02, 0x00, 0xEA, 0x60, 0xEA, 0x61, + 0x3E, 0x60, 0x00, 0x66, 0x01, 0x60, 0x78, 0x64, 0x0A, 0x63, 0x59, 0xD0, 0x58, 0xD9, 0xFD, 0x1F, + 0x00, 0x66, 0xC4, 0xF3, 0x60, 0x41, 0x00, 0xA8, 0xFA, 0xA1, 0x01, 0x03, 0xA1, 0xDB, 0x01, 0x60, + 0x7A, 0x63, 0x16, 0x60, 0xC4, 0x61, 0xBD, 0xD3, 0xFF, 0xFF, 0x20, 0x7F, 0xA1, 0xDB, 0xBD, 0xD3, + 0xFF, 0xFF, 0x21, 0x7F, 0x59, 0xDB, 0xA3, 0xD3, 0xFF, 0xFF, 0x22, 0x7F, 0x59, 0xDB, 0x0F, 0x60, + 0xD6, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0B, 0x04, 0x0F, 0x60, 0xD8, 0x62, 0x40, 0x60, + 0x00, 0x64, 0xA2, 0xDB, 0xCF, 0x60, 0x77, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x1C, 0x60, 0x00, 0x62, 0x16, 0x60, 0xC2, 0x64, 0xA2, 0xDB, 0x20, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x2D, 0xFF, 0x0F, 0x60, 0xD8, 0x62, 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xCF, 0x60, 0x9C, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD6, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x65, 0xF1, 0x1C, 0x60, 0x00, 0x62, 0xA2, 0xD9, 0x08, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, + 0x0F, 0x60, 0xD8, 0x62, 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xCF, 0x60, 0xB3, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD6, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xBE, 0xFE, + 0x0F, 0x60, 0xCE, 0x62, 0xA2, 0xD1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x20, 0x40, 0x20, 0x2A, 0x04, 0x00, 0xEB, 0x60, 0x58, 0x4E, 0x16, 0x78, 0xFF, 0xFF, 0x0F, 0x60, + 0xD6, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x4E, 0xF3, 0xFF, 0xFF, 0x13, 0x1B, 0x1F, 0x60, 0xAE, 0x64, + 0xA0, 0xD3, 0xC7, 0xFB, 0x1F, 0x60, 0x1E, 0x65, 0x1F, 0x60, 0xBC, 0x61, 0x1F, 0x60, 0x1C, 0x64, + 0x20, 0x63, 0x59, 0xD1, 0x58, 0xD9, 0xA5, 0xD9, 0xDA, 0x85, 0xFB, 0x1F, 0xD0, 0x60, 0x62, 0x78, + 0xFF, 0xFF, 0x20, 0x60, 0x40, 0x63, 0xE0, 0x84, 0xE0, 0x85, 0xC4, 0x85, 0xC7, 0x83, 0xFE, 0xA5, + 0x89, 0xF3, 0xFF, 0xFF, 0xC4, 0x84, 0x66, 0x45, 0x60, 0x46, 0x60, 0x41, 0xBD, 0xD1, 0x03, 0xF8, + 0xBD, 0xD1, 0x04, 0xF8, 0xA3, 0xD1, 0x05, 0xF8, 0x06, 0xF2, 0xFF, 0xFF, 0x02, 0x7E, 0x06, 0xFA, + 0x5F, 0xF3, 0x60, 0xFB, 0x73, 0xF0, 0x63, 0xF9, 0x66, 0x43, 0x21, 0x60, 0x2C, 0x62, 0x32, 0x40, + 0x08, 0x2A, 0x09, 0x00, 0xA2, 0xD3, 0x06, 0xF0, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, + 0x80, 0xBF, 0xB0, 0x84, 0x06, 0xFA, 0x63, 0x44, 0x63, 0xF3, 0x60, 0x45, 0x66, 0x41, 0x65, 0x46, + 0x8C, 0xFA, 0x60, 0x40, 0x01, 0x36, 0x06, 0x00, 0x02, 0x36, 0x04, 0x00, 0x04, 0x36, 0x02, 0x00, + 0x05, 0x3A, 0x02, 0x00, 0x00, 0x64, 0x01, 0x00, 0x01, 0x64, 0x6F, 0xFA, 0x5F, 0xF3, 0x60, 0xF1, + 0xFF, 0xFF, 0xA0, 0x84, 0x65, 0x43, 0x02, 0x02, 0x5F, 0xF3, 0xFF, 0xFF, 0x60, 0x41, 0x0F, 0x60, + 0xAE, 0x65, 0x63, 0xF3, 0xFF, 0xFF, 0xE0, 0x84, 0x44, 0xD3, 0x61, 0x45, 0xA4, 0x80, 0xFF, 0xFF, + 0x04, 0x02, 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0xFC, 0x03, 0xA4, 0x84, 0x61, 0xFB, 0x6F, 0xF0, + 0x60, 0x47, 0x90, 0x84, 0x6F, 0xFA, 0x60, 0x47, 0x60, 0x45, 0x80, 0x64, 0xE8, 0x84, 0xA4, 0x80, + 0xFF, 0xFF, 0xFC, 0x03, 0xA4, 0x84, 0x70, 0xF0, 0x70, 0xFA, 0x00, 0x61, 0xE8, 0x84, 0xFF, 0xFF, + 0x02, 0x05, 0xDD, 0x81, 0xFB, 0x01, 0xE1, 0x81, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, 0x0E, 0xFA, + 0x66, 0x43, 0x0C, 0xF4, 0xC5, 0xFE, 0x0F, 0x60, 0xD6, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x0F, 0x60, + 0xD8, 0x62, 0x00, 0x60, 0x30, 0x64, 0xA2, 0xDB, 0xCF, 0x60, 0xC7, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x4E, 0xDF, 0x60, 0x58, 0x4F, 0x13, 0x78, 0xFF, 0xFF, 0x0E, 0x4F, + 0x0F, 0x4E, 0xDC, 0x60, 0x58, 0x4F, 0x6B, 0x78, 0xFF, 0xFF, 0x0E, 0x4F, 0x0F, 0x4E, 0xDB, 0x60, + 0x58, 0x4F, 0xE8, 0x78, 0xFF, 0xFF, 0x0E, 0x4F, 0x0F, 0x4E, 0xDB, 0x60, 0x58, 0x4F, 0x42, 0x78, + 0xFF, 0xFF, 0x0E, 0x4F, 0xD7, 0x01, 0x4E, 0xF3, 0x7E, 0xF5, 0x60, 0x40, 0xFF, 0x22, 0x0A, 0x00, + 0x89, 0xF1, 0xCC, 0x84, 0xE0, 0x84, 0xC0, 0x86, 0x06, 0xF2, 0xFF, 0xFF, 0x00, 0x7E, 0x06, 0xFA, + 0x7E, 0xF5, 0x08, 0x00, 0x0F, 0x60, 0xF4, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x11, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x4E, 0xF3, 0x66, 0x40, 0xFF, 0x22, 0x05, 0x00, 0xFF, 0x22, 0x37, 0x00, + 0xD1, 0x60, 0x30, 0x78, 0xFF, 0xFF, 0x02, 0x64, 0x6A, 0xFB, 0xFF, 0xFF, 0xC1, 0xFE, 0x6A, 0xF3, + 0x00, 0x65, 0xD4, 0x80, 0x4E, 0xF3, 0x0F, 0x03, 0x0F, 0x60, 0xD6, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x0F, 0x60, 0xD8, 0x62, 0x80, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xD0, 0x60, 0x9F, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD6, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, + 0x0B, 0x04, 0x0F, 0x60, 0xD8, 0x62, 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xD0, 0x60, 0xB3, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x1C, 0x60, 0x00, 0x62, 0x06, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x2D, 0xFF, 0x20, 0x44, 0x01, 0xB5, 0x54, 0x80, 0xDA, 0xFE, 0xBE, 0xFE, 0x88, 0xF1, + 0x02, 0x64, 0x87, 0xF3, 0xC0, 0x83, 0x40, 0x48, 0x76, 0xFD, 0xE4, 0x60, 0x58, 0x4E, 0x9D, 0x78, + 0xFF, 0xFF, 0x28, 0x44, 0x4C, 0x88, 0x76, 0xF3, 0x02, 0x65, 0xC4, 0x83, 0xF5, 0x02, 0xA2, 0x60, + 0x58, 0x4E, 0x00, 0x78, 0xFF, 0xFF, 0x14, 0x60, 0xD0, 0x62, 0x14, 0x60, 0xD2, 0x64, 0xA2, 0xDB, + 0x00, 0x64, 0x4A, 0xDB, 0x01, 0x60, 0xFE, 0x63, 0x12, 0x60, 0xCC, 0x61, 0x00, 0x64, 0x59, 0xDB, + 0xFE, 0x1F, 0x7E, 0xF1, 0x1B, 0x60, 0x9A, 0x61, 0x64, 0x40, 0xFF, 0x26, 0x39, 0x00, 0xD1, 0x60, + 0x58, 0x4E, 0x33, 0x78, 0xFF, 0xFF, 0x1B, 0x60, 0x88, 0x61, 0xD1, 0x60, 0x58, 0x4E, 0x33, 0x78, + 0xFF, 0xFF, 0x1B, 0x60, 0x8E, 0x61, 0xD1, 0x60, 0x58, 0x4E, 0x33, 0x78, 0xFF, 0xFF, 0x1B, 0x60, + 0xA0, 0x61, 0xD1, 0x60, 0x58, 0x4E, 0x33, 0x78, 0xFF, 0xFF, 0x1B, 0x60, 0xA6, 0x61, 0xD1, 0x60, + 0x58, 0x4E, 0x33, 0x78, 0xFF, 0xFF, 0x1B, 0x60, 0xB2, 0x61, 0xD1, 0x60, 0x58, 0x4E, 0x33, 0x78, + 0xFF, 0xFF, 0x1B, 0x60, 0xBE, 0x61, 0xD1, 0x60, 0x58, 0x4E, 0x33, 0x78, 0xFF, 0xFF, 0x1B, 0x60, + 0xAC, 0x61, 0xD1, 0x60, 0x58, 0x4E, 0x33, 0x78, 0xFF, 0xFF, 0x1B, 0x60, 0x94, 0x61, 0xD1, 0x60, + 0x58, 0x4E, 0x5F, 0x78, 0xFF, 0xFF, 0x0F, 0x60, 0xD6, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x5A, 0xDB, + 0xC5, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xA1, 0xD3, 0x0E, 0x57, 0x24, 0x00, 0x0E, 0xF2, 0x44, 0x4C, + 0x80, 0xB0, 0x10, 0xB0, 0x0B, 0x03, 0x1B, 0x60, 0xDA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x66, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x13, 0x00, 0x12, 0x02, 0xF0, 0x37, + 0x09, 0x00, 0x02, 0xF0, 0x09, 0x60, 0x08, 0x64, 0xD0, 0x80, 0xA2, 0xFF, 0x90, 0xF3, 0x02, 0x02, + 0xCC, 0x84, 0x90, 0xFB, 0x1B, 0x60, 0xDA, 0x64, 0x40, 0x4B, 0xF0, 0x60, 0x58, 0x4D, 0x75, 0x78, + 0xFF, 0xFF, 0x2C, 0x44, 0xAC, 0x86, 0x09, 0xF0, 0xD9, 0x02, 0x37, 0x58, 0xFF, 0xFF, 0xA1, 0xD3, + 0x0E, 0x57, 0x19, 0x00, 0x0E, 0xF2, 0x44, 0x4C, 0x80, 0xB0, 0x10, 0xB0, 0x0B, 0x03, 0x1B, 0x60, + 0xDA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0x08, 0x00, 0x07, 0x02, 0x1B, 0x60, 0xDA, 0x64, 0x40, 0x4B, 0xF0, 0x60, 0x58, 0x4D, + 0x75, 0x78, 0xFF, 0xFF, 0x2C, 0x44, 0xAC, 0x86, 0x09, 0xF0, 0xE4, 0x02, 0x37, 0x58, 0xFF, 0xFF, + 0x00, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0xB0, 0x64, 0x2A, 0xFA, 0x2F, 0xF2, 0x2C, 0xFA, 0x30, 0xF2, + 0x2D, 0xFA, 0x31, 0xF2, 0x2E, 0xFA, 0xCB, 0xF3, 0x2F, 0xFA, 0xCC, 0xF3, 0x30, 0xFA, 0xCD, 0xF3, + 0x31, 0xFA, 0x67, 0xF3, 0x32, 0xFA, 0x68, 0xF3, 0x33, 0xFA, 0x69, 0xF3, 0x34, 0xFA, 0xAC, 0xF1, + 0x19, 0xF8, 0x06, 0x63, 0x3F, 0xFC, 0x1C, 0xF2, 0x13, 0xFA, 0x00, 0x64, 0x3E, 0xFA, 0x07, 0xF2, + 0x88, 0xF1, 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, 0x0C, 0x03, 0x60, 0x46, 0x06, 0xF2, 0x26, 0x46, + 0x01, 0xB0, 0xFF, 0xFF, 0x03, 0x02, 0xD3, 0x60, 0x64, 0x78, 0xFF, 0xFF, 0xD4, 0x60, 0xBA, 0x78, + 0xFF, 0xFF, 0x00, 0xF4, 0x0A, 0xF2, 0x09, 0xF2, 0xFF, 0xA0, 0x00, 0xA0, 0x13, 0x02, 0xFF, 0xA0, + 0x04, 0x03, 0x08, 0x03, 0xD1, 0x60, 0xD5, 0x78, 0xFF, 0xFF, 0x02, 0x64, 0x55, 0xFB, 0xD1, 0x60, + 0xE0, 0x78, 0xFF, 0xFF, 0x01, 0x63, 0x32, 0x40, 0x08, 0x2A, 0x0F, 0x00, 0x55, 0xFD, 0xD1, 0x60, + 0xE0, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x00, 0xF4, 0x0A, 0xF2, 0x0E, 0x63, 0x01, 0xA4, 0x0A, 0xFA, + 0x0B, 0xFC, 0x43, 0x59, 0xD4, 0x60, 0x93, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x00, 0xF4, 0x0A, 0xF2, + 0x0D, 0x63, 0x01, 0xA4, 0x0A, 0xFA, 0x0B, 0xFC, 0x43, 0x59, 0xD4, 0x60, 0x93, 0x78, 0xFF, 0xFF, + 0x88, 0xF5, 0x00, 0xF2, 0x26, 0x46, 0x00, 0xA0, 0x2E, 0xF0, 0x37, 0x03, 0x66, 0x41, 0x12, 0x60, + 0xCE, 0x65, 0x64, 0x47, 0x00, 0x7F, 0x88, 0xF1, 0xE0, 0x84, 0x44, 0xD3, 0x64, 0x43, 0x11, 0x18, + 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xFC, 0x1B, 0x66, 0x44, 0x64, 0x46, 0x80, 0xF0, 0x60, 0x46, + 0x80, 0xF8, 0x65, 0x46, 0x65, 0x43, 0x80, 0xF0, 0x01, 0xFA, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, + 0x0B, 0x00, 0x64, 0x46, 0x62, 0x43, 0x00, 0xF2, 0xA3, 0xDB, 0x60, 0x46, 0x80, 0xF0, 0x81, 0xFC, + 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x60, 0x43, 0x61, 0x46, 0x87, 0xF1, 0x14, 0x60, 0xCE, 0x61, + 0xA1, 0xD3, 0xDA, 0x81, 0xD0, 0x80, 0xDC, 0x9C, 0x05, 0x05, 0xA1, 0xD3, 0x4A, 0xD9, 0xA0, 0xDD, + 0xDA, 0x9C, 0xA1, 0xD9, 0xD3, 0x60, 0x2D, 0x78, 0xFF, 0xFF, 0x14, 0x60, 0xCE, 0x64, 0xA0, 0xD3, + 0xFF, 0xFF, 0x62, 0x18, 0x14, 0x60, 0xCE, 0x64, 0x04, 0xA5, 0xA0, 0xD1, 0x72, 0x44, 0xFF, 0xB4, + 0x64, 0x40, 0xE0, 0x22, 0x1F, 0xB4, 0x64, 0x40, 0xF8, 0x22, 0x07, 0xB4, 0x02, 0x00, 0x03, 0x04, + 0xD0, 0x84, 0xD0, 0x80, 0xFC, 0x01, 0xE0, 0x84, 0x44, 0xD3, 0xFF, 0xFF, 0x60, 0x43, 0x66, 0x41, + 0x63, 0x46, 0x05, 0xF2, 0x00, 0xF0, 0x81, 0xF0, 0x02, 0x18, 0x64, 0x46, 0x81, 0xF8, 0x07, 0x1B, + 0x12, 0x60, 0xCE, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD9, 0x02, 0x00, 0x65, 0x46, + 0x00, 0xF8, 0x88, 0xF3, 0x63, 0x45, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xD4, 0x80, 0x01, 0x18, + 0xFA, 0x04, 0x80, 0xF8, 0x65, 0x46, 0x00, 0xFA, 0x06, 0xF2, 0xFF, 0xFF, 0x00, 0x7E, 0x06, 0xFA, + 0x61, 0x46, 0x2E, 0xF0, 0x66, 0x41, 0x12, 0x60, 0xCE, 0x65, 0x64, 0x47, 0x00, 0x7F, 0x88, 0xF1, + 0xE0, 0x84, 0x44, 0xD3, 0x64, 0x43, 0x11, 0x18, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xFC, 0x1B, + 0x66, 0x44, 0x64, 0x46, 0x80, 0xF0, 0x60, 0x46, 0x80, 0xF8, 0x65, 0x46, 0x65, 0x43, 0x80, 0xF0, + 0x01, 0xFA, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x0B, 0x00, 0x64, 0x46, 0x62, 0x43, 0x00, 0xF2, + 0xA3, 0xDB, 0x60, 0x46, 0x80, 0xF0, 0x81, 0xFC, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x60, 0x43, + 0x61, 0x46, 0xD3, 0x60, 0x2D, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x02, 0x61, 0xB3, 0x60, 0x58, 0x4D, + 0x77, 0x78, 0xFF, 0xFF, 0x87, 0xF1, 0x72, 0x44, 0xFF, 0xB4, 0xD0, 0x80, 0xFF, 0xFF, 0x02, 0x04, + 0xD0, 0x84, 0xFB, 0x01, 0xE0, 0x83, 0x88, 0xF3, 0x02, 0xA3, 0x43, 0x93, 0x66, 0x44, 0x00, 0xA8, + 0x56, 0xFD, 0x37, 0x03, 0x00, 0x64, 0x2B, 0xFA, 0x00, 0x60, 0xC0, 0x64, 0x2A, 0xFA, 0x66, 0x45, + 0x63, 0x46, 0x03, 0xF2, 0x04, 0xF0, 0x85, 0xF2, 0x65, 0x46, 0x2C, 0xFA, 0x2D, 0xF8, 0xAE, 0xFA, + 0xCB, 0xF3, 0x2F, 0xFA, 0x32, 0xFA, 0xCC, 0xF3, 0x30, 0xFA, 0x33, 0xFA, 0xCD, 0xF3, 0x31, 0xFA, + 0x34, 0xFA, 0xAC, 0xF1, 0x19, 0xF8, 0xFF, 0x67, 0x0E, 0xFA, 0x66, 0x45, 0x63, 0x46, 0x0E, 0xF2, + 0x65, 0x46, 0x02, 0x63, 0x00, 0x7E, 0x13, 0xFA, 0x3F, 0xFC, 0x00, 0x64, 0x3E, 0xFA, 0x88, 0xF3, + 0x07, 0xFA, 0x66, 0x41, 0x00, 0xF4, 0x05, 0x64, 0x09, 0xFA, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, + 0x8E, 0x64, 0xA2, 0xDB, 0x61, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xC1, 0xFE, 0x56, 0xF3, 0xA3, 0xFF, 0x60, 0x43, 0xE4, 0x60, 0x58, 0x4E, 0x9D, 0x78, 0xFF, 0xFF, + 0x56, 0xF3, 0xFF, 0xFF, 0x40, 0x58, 0x03, 0x65, 0xE2, 0x60, 0x58, 0x4E, 0x86, 0x78, 0xFF, 0xFF, + 0x56, 0xF3, 0x26, 0x46, 0x60, 0x43, 0x66, 0x41, 0x63, 0x46, 0x05, 0xF2, 0x00, 0xF0, 0x81, 0xF0, + 0x02, 0x18, 0x64, 0x46, 0x81, 0xF8, 0x07, 0x1B, 0x12, 0x60, 0xCE, 0x65, 0x60, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD9, 0x02, 0x00, 0x65, 0x46, 0x00, 0xF8, 0x88, 0xF3, 0x63, 0x45, 0x60, 0x46, + 0x00, 0xF2, 0xFF, 0xFF, 0xD4, 0x80, 0x01, 0x18, 0xFA, 0x04, 0x80, 0xF8, 0x65, 0x46, 0x00, 0xFA, + 0x06, 0xF2, 0xFF, 0xFF, 0x00, 0x7E, 0x06, 0xFA, 0x61, 0x46, 0x2E, 0xF0, 0x66, 0x41, 0x12, 0x60, + 0xCE, 0x65, 0x64, 0x47, 0x00, 0x7F, 0x88, 0xF1, 0xE0, 0x84, 0x44, 0xD3, 0x64, 0x43, 0x11, 0x18, + 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xFC, 0x1B, 0x66, 0x44, 0x64, 0x46, 0x80, 0xF0, 0x60, 0x46, + 0x80, 0xF8, 0x65, 0x46, 0x65, 0x43, 0x80, 0xF0, 0x01, 0xFA, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, + 0x0B, 0x00, 0x64, 0x46, 0x62, 0x43, 0x00, 0xF2, 0xA3, 0xDB, 0x60, 0x46, 0x80, 0xF0, 0x81, 0xFC, + 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x60, 0x43, 0x61, 0x46, 0x2C, 0xF2, 0x2D, 0xF0, 0xAE, 0xF2, + 0x66, 0x45, 0x63, 0x46, 0x03, 0xFA, 0x04, 0xF8, 0x55, 0xF3, 0x85, 0xFA, 0xFF, 0xA0, 0x65, 0x46, + 0x03, 0x03, 0xD4, 0x60, 0xD6, 0x78, 0xFF, 0xFF, 0x95, 0xF3, 0x66, 0x45, 0x63, 0x46, 0x1B, 0xFA, + 0x65, 0x46, 0xBA, 0x65, 0x60, 0x44, 0xC4, 0x85, 0x01, 0x60, 0xFE, 0x61, 0x00, 0x64, 0x80, 0x63, + 0xC7, 0x85, 0x94, 0x84, 0x59, 0xDB, 0xFC, 0x1F, 0x00, 0x60, 0x88, 0x64, 0x3F, 0xFA, 0x00, 0xF4, + 0x02, 0x64, 0x0A, 0xFA, 0x00, 0x64, 0x0B, 0xFA, 0x80, 0x7F, 0x10, 0x7E, 0x0C, 0xFA, 0x1A, 0x65, + 0x80, 0x61, 0x02, 0x60, 0x00, 0x63, 0x0F, 0x4E, 0xF2, 0x60, 0x58, 0x4F, 0x4A, 0x78, 0xFF, 0xFF, + 0x0E, 0x4F, 0xD4, 0x60, 0xA7, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x23, 0xF0, 0x00, 0x60, 0x02, 0x64, + 0xA0, 0x80, 0x00, 0xF4, 0x03, 0x03, 0xD4, 0x60, 0x50, 0x78, 0xFF, 0xFF, 0x09, 0xF2, 0xFF, 0xFF, + 0xFF, 0xA0, 0x00, 0xA0, 0x0C, 0x03, 0x03, 0x03, 0xD3, 0x60, 0xCC, 0x78, 0xFF, 0xFF, 0x0A, 0xF2, + 0x26, 0x46, 0xFF, 0xA0, 0x87, 0xF4, 0x10, 0x02, 0xD4, 0x60, 0xD6, 0x78, 0xFF, 0xFF, 0x0A, 0xF2, + 0xFF, 0xFF, 0xFF, 0xA0, 0xFD, 0xA0, 0x02, 0x03, 0x04, 0x03, 0x06, 0x00, 0xD4, 0x60, 0x0C, 0x78, + 0xFF, 0xFF, 0xD4, 0x60, 0x17, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x87, 0xF4, 0x66, 0x41, 0x63, 0x46, + 0x05, 0xF2, 0x00, 0xF0, 0x81, 0xF0, 0x02, 0x18, 0x64, 0x46, 0x81, 0xF8, 0x07, 0x1B, 0x12, 0x60, + 0xCE, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD9, 0x02, 0x00, 0x65, 0x46, 0x00, 0xF8, + 0x88, 0xF3, 0x63, 0x45, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xD4, 0x80, 0x01, 0x18, 0xFA, 0x04, + 0x80, 0xF8, 0x65, 0x46, 0x00, 0xFA, 0x06, 0xF2, 0xFF, 0xFF, 0x00, 0x7E, 0x06, 0xFA, 0x61, 0x46, + 0x14, 0x60, 0xD0, 0x62, 0xA2, 0xD3, 0xDA, 0x81, 0x60, 0x45, 0xD5, 0x80, 0xA1, 0xD1, 0x11, 0x03, + 0xD3, 0x80, 0xD9, 0x81, 0xFA, 0x02, 0xC9, 0x81, 0xC8, 0x85, 0xD5, 0x80, 0xA5, 0xD3, 0x08, 0x28, + 0xA1, 0xDB, 0x14, 0x60, 0xD0, 0x62, 0x65, 0x44, 0xA2, 0xDB, 0x4A, 0xD3, 0xFF, 0xFF, 0xCC, 0x84, + 0xA2, 0xDB, 0xD1, 0x60, 0xCA, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x87, 0xF4, 0x66, 0x41, 0x63, 0x46, + 0x05, 0xF2, 0x00, 0xF0, 0x81, 0xF0, 0x02, 0x18, 0x64, 0x46, 0x81, 0xF8, 0x07, 0x1B, 0x12, 0x60, + 0xCE, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD9, 0x02, 0x00, 0x65, 0x46, 0x00, 0xF8, + 0x88, 0xF3, 0x63, 0x45, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xD4, 0x80, 0x01, 0x18, 0xFA, 0x04, + 0x80, 0xF8, 0x65, 0x46, 0x00, 0xFA, 0x06, 0xF2, 0xFF, 0xFF, 0x00, 0x7E, 0x06, 0xFA, 0x61, 0x46, + 0x14, 0x60, 0xD0, 0x62, 0xA2, 0xD3, 0xDA, 0x81, 0x60, 0x45, 0xD5, 0x80, 0xA1, 0xD1, 0x11, 0x03, + 0xD3, 0x80, 0xD9, 0x81, 0xFA, 0x02, 0xC9, 0x81, 0xC8, 0x85, 0xD5, 0x80, 0xA5, 0xD3, 0x08, 0x28, + 0xA1, 0xDB, 0x14, 0x60, 0xD0, 0x62, 0x65, 0x44, 0xA2, 0xDB, 0x4A, 0xD3, 0xFF, 0xFF, 0xCC, 0x84, + 0xA2, 0xDB, 0xD1, 0x60, 0xD5, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x32, 0x44, 0x08, 0xB0, 0x87, 0xF4, + 0x03, 0x02, 0xD1, 0x60, 0xD5, 0x78, 0xFF, 0xFF, 0xD3, 0x60, 0x3C, 0x78, 0xFF, 0xFF, 0x32, 0x44, + 0x26, 0x46, 0x08, 0xB0, 0x07, 0xF2, 0x03, 0x02, 0xD1, 0x60, 0xD5, 0x78, 0xFF, 0xFF, 0x60, 0x46, + 0x1B, 0xF2, 0x26, 0x46, 0xBA, 0x65, 0x60, 0x44, 0xC4, 0x85, 0x01, 0x60, 0xFE, 0x61, 0x00, 0x64, + 0x80, 0x63, 0xC7, 0x85, 0x94, 0x84, 0x59, 0xDB, 0xFC, 0x1F, 0x00, 0xF4, 0x01, 0x60, 0xFE, 0x61, + 0x7E, 0x65, 0x18, 0x63, 0x5B, 0xD2, 0x59, 0xD1, 0xFF, 0xFF, 0xD0, 0x80, 0xD7, 0x80, 0x18, 0x02, + 0xF9, 0x02, 0x00, 0xF4, 0x02, 0x63, 0x0E, 0x65, 0x5B, 0xD2, 0x59, 0xD1, 0xFF, 0xFF, 0xD0, 0x80, + 0xD7, 0x80, 0x0E, 0x02, 0xF9, 0x02, 0x26, 0x46, 0x07, 0xF4, 0x06, 0xF2, 0xFF, 0xFF, 0x01, 0x7E, + 0x06, 0xFA, 0x26, 0x46, 0x00, 0xF4, 0x04, 0x64, 0x0A, 0xFA, 0x00, 0x64, 0x0B, 0xFA, 0x57, 0x00, + 0x26, 0x46, 0x87, 0xF4, 0x66, 0x41, 0x63, 0x46, 0x05, 0xF2, 0x00, 0xF0, 0x81, 0xF0, 0x02, 0x18, + 0x64, 0x46, 0x81, 0xF8, 0x07, 0x1B, 0x12, 0x60, 0xCE, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, + 0x44, 0xD9, 0x02, 0x00, 0x65, 0x46, 0x00, 0xF8, 0x88, 0xF3, 0x63, 0x45, 0x60, 0x46, 0x00, 0xF2, + 0xFF, 0xFF, 0xD4, 0x80, 0x01, 0x18, 0xFA, 0x04, 0x80, 0xF8, 0x65, 0x46, 0x00, 0xFA, 0x06, 0xF2, + 0xFF, 0xFF, 0x00, 0x7E, 0x06, 0xFA, 0x61, 0x46, 0x14, 0x60, 0xD0, 0x62, 0xA2, 0xD3, 0xDA, 0x81, + 0x60, 0x45, 0xD5, 0x80, 0xA1, 0xD1, 0x11, 0x03, 0xD3, 0x80, 0xD9, 0x81, 0xFA, 0x02, 0xC9, 0x81, + 0xC8, 0x85, 0xD5, 0x80, 0xA5, 0xD3, 0x08, 0x28, 0xA1, 0xDB, 0x14, 0x60, 0xD0, 0x62, 0x65, 0x44, + 0xA2, 0xDB, 0x4A, 0xD3, 0xFF, 0xFF, 0xCC, 0x84, 0xA2, 0xDB, 0x00, 0xF4, 0x04, 0x64, 0x0A, 0xFA, + 0x0F, 0x64, 0x0B, 0xFA, 0x40, 0x59, 0x02, 0x60, 0x00, 0x61, 0x41, 0x58, 0x26, 0x46, 0x2C, 0xF2, + 0xA1, 0xDB, 0x2D, 0xF2, 0x59, 0xDB, 0x2E, 0xF2, 0x59, 0xDB, 0x03, 0x65, 0xE2, 0x60, 0x58, 0x4E, + 0x5B, 0x78, 0xFF, 0xFF, 0x03, 0x65, 0xE2, 0x60, 0x58, 0x4E, 0x86, 0x78, 0xFF, 0xFF, 0x26, 0x46, + 0x88, 0xF3, 0x07, 0xFA, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0x8E, 0x64, 0xA2, 0xDB, 0x26, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x00, 0x66, 0x46, 0x46, + 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0xF4, 0x0A, 0xF2, 0x09, 0xF2, 0xFF, 0xA0, 0x00, 0xA0, 0x06, 0x02, + 0xFF, 0xA0, 0x07, 0x03, 0x09, 0x03, 0xD3, 0x60, 0xCC, 0x78, 0xFF, 0xFF, 0xD3, 0x60, 0x8C, 0x78, + 0xFF, 0xFF, 0xD4, 0x60, 0xDB, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x07, 0xF4, 0x06, 0xF2, 0x66, 0x43, + 0x00, 0x7E, 0x06, 0xFA, 0x26, 0x46, 0xD3, 0x60, 0x3C, 0x78, 0xFF, 0xFF, 0x63, 0x46, 0x06, 0xF2, + 0xFF, 0xFF, 0x01, 0x7E, 0x06, 0xFA, 0x26, 0x46, 0x88, 0xF3, 0x07, 0xFA, 0x00, 0xF4, 0x02, 0x64, + 0x0A, 0xFA, 0x00, 0x64, 0x0B, 0xFA, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0x8E, 0x64, 0xA2, 0xDB, + 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x00, 0x66, + 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x16, 0x60, 0xAC, 0x7C, 0x2A, 0xF2, 0xA4, 0xDB, 0x22, 0x60, + 0x2A, 0x63, 0xFF, 0xB4, 0x01, 0x61, 0x00, 0x60, 0x10, 0x7C, 0xA3, 0xDB, 0x60, 0x40, 0x00, 0x36, + 0x03, 0x00, 0x02, 0x61, 0x00, 0x60, 0x30, 0x7C, 0x41, 0x47, 0x2A, 0xF8, 0x2F, 0xF2, 0x2C, 0xFA, + 0x30, 0xF2, 0x2D, 0xFA, 0x31, 0xF2, 0x2E, 0xFA, 0xCB, 0xF3, 0x2F, 0xFA, 0xCC, 0xF3, 0x30, 0xFA, + 0xCD, 0xF3, 0x31, 0xFA, 0x67, 0xF3, 0x32, 0xFA, 0x68, 0xF3, 0x33, 0xFA, 0x69, 0xF3, 0x34, 0xFA, + 0xAC, 0xF1, 0x19, 0xF8, 0x00, 0x7C, 0x3E, 0xF8, 0x1C, 0xF0, 0x13, 0xF8, 0x07, 0xF2, 0x88, 0xF1, + 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, 0x03, 0x02, 0xD9, 0x60, 0xA3, 0x78, 0xFF, 0xFF, 0x40, 0x4B, + 0xAB, 0x46, 0x06, 0xF2, 0xAB, 0x46, 0x00, 0xF4, 0x01, 0xB0, 0xFF, 0xFF, 0x03, 0x02, 0xD9, 0x60, + 0xA3, 0x78, 0xFF, 0xFF, 0x22, 0x60, 0x2C, 0x63, 0x09, 0xF2, 0xBD, 0xDB, 0x43, 0x44, 0x10, 0xB0, + 0x80, 0x60, 0x00, 0x63, 0x0D, 0x03, 0x1F, 0x60, 0x92, 0x62, 0xA2, 0xD1, 0xFF, 0xFF, 0x64, 0x44, + 0xFE, 0x26, 0x08, 0x00, 0x32, 0x40, 0x08, 0x26, 0x06, 0x00, 0xDA, 0x60, 0x02, 0x78, 0xFF, 0xFF, + 0x32, 0x40, 0x10, 0x2A, 0x00, 0x63, 0xAB, 0x46, 0x06, 0xF0, 0x7F, 0x60, 0xFF, 0x64, 0xA0, 0x84, + 0x63, 0x45, 0xB4, 0x84, 0x06, 0xFA, 0xAB, 0x46, 0x0A, 0xF0, 0x56, 0xF9, 0x24, 0x43, 0xBD, 0xD9, + 0x43, 0x44, 0x01, 0x63, 0x32, 0x40, 0x10, 0x26, 0x10, 0xBB, 0x1F, 0x60, 0x92, 0x62, 0xA2, 0xD3, + 0xFF, 0xFF, 0x60, 0x40, 0xFE, 0x26, 0x10, 0xBB, 0x09, 0xFC, 0x27, 0x44, 0xFE, 0xA0, 0xFF, 0xFF, + 0x03, 0x03, 0xD5, 0x60, 0xFE, 0x78, 0xFF, 0xFF, 0x16, 0x60, 0xA2, 0x64, 0x24, 0x43, 0x0B, 0xF0, + 0xA0, 0xD9, 0xBD, 0xD9, 0x0C, 0xF0, 0x58, 0xD9, 0xBD, 0xD9, 0x0D, 0xF0, 0x58, 0xD9, 0xBD, 0xD9, + 0x43, 0x44, 0x1C, 0x65, 0x2D, 0x61, 0x02, 0x60, 0x00, 0x63, 0xA5, 0xD0, 0xDA, 0x85, 0x64, 0x44, + 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, 0x05, 0x03, 0x64, 0x47, 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, + 0xF4, 0x02, 0x02, 0x60, 0x02, 0x61, 0xA1, 0xD3, 0xFF, 0xFF, 0xE0, 0x84, 0x04, 0xA5, 0xC5, 0x81, + 0xA1, 0xD3, 0x00, 0x65, 0x60, 0x43, 0x59, 0xD3, 0xFF, 0xFF, 0x7F, 0xB4, 0x02, 0x3A, 0x02, 0x00, + 0x01, 0x64, 0x15, 0x00, 0x04, 0x3A, 0x02, 0x00, 0x02, 0x64, 0x11, 0x00, 0x0A, 0x3A, 0x02, 0x00, + 0x04, 0x64, 0x0D, 0x00, 0x0B, 0x3A, 0x02, 0x00, 0x08, 0x64, 0x09, 0x00, 0x10, 0x3A, 0x02, 0x00, + 0x10, 0x64, 0x05, 0x00, 0x16, 0x3A, 0x02, 0x00, 0x20, 0x64, 0x01, 0x00, 0x00, 0x64, 0xCF, 0x83, + 0xB4, 0x85, 0xE1, 0x02, 0x65, 0x44, 0x60, 0xFB, 0xB8, 0xF3, 0x2B, 0x45, 0x66, 0x41, 0x65, 0x46, + 0x8C, 0xFA, 0x60, 0x40, 0x01, 0x36, 0x06, 0x00, 0x02, 0x36, 0x04, 0x00, 0x04, 0x36, 0x02, 0x00, + 0x05, 0x3A, 0x02, 0x00, 0x00, 0x64, 0x01, 0x00, 0x01, 0x64, 0x6F, 0xFA, 0x5F, 0xF3, 0x60, 0xF1, + 0xFF, 0xFF, 0xA0, 0x84, 0x65, 0x43, 0x02, 0x02, 0x5F, 0xF3, 0xFF, 0xFF, 0x60, 0x41, 0x0F, 0x60, + 0xAE, 0x65, 0xB8, 0xF3, 0xFF, 0xFF, 0xE0, 0x84, 0x44, 0xD3, 0x61, 0x45, 0xA4, 0x80, 0xFF, 0xFF, + 0x04, 0x02, 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0xFC, 0x03, 0xA4, 0x84, 0x61, 0xFB, 0x6F, 0xF0, + 0x60, 0x47, 0x90, 0x84, 0x6F, 0xFA, 0x60, 0x47, 0x60, 0x45, 0x80, 0x64, 0xE8, 0x84, 0xA4, 0x80, + 0xFF, 0xFF, 0xFC, 0x03, 0xA4, 0x84, 0x70, 0xF0, 0x70, 0xFA, 0x00, 0x61, 0xE8, 0x84, 0xFF, 0xFF, + 0x02, 0x05, 0xDD, 0x81, 0xFB, 0x01, 0xE1, 0x81, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, 0x0E, 0xFA, + 0x66, 0x43, 0x0C, 0xF4, 0xFF, 0xFF, 0xD6, 0x60, 0x80, 0x78, 0xFF, 0xFF, 0x16, 0x65, 0x2D, 0x61, + 0x02, 0x60, 0x00, 0x63, 0xA5, 0xD0, 0xDA, 0x85, 0x64, 0x44, 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, + 0x05, 0x03, 0x64, 0x47, 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, 0xF4, 0x02, 0x02, 0x60, 0x02, 0x61, + 0xA1, 0xD3, 0xFF, 0xFF, 0xE0, 0x84, 0x04, 0xA5, 0xC5, 0x81, 0xA1, 0xD3, 0x00, 0x65, 0x60, 0x43, + 0x59, 0xD3, 0xFF, 0xFF, 0x7F, 0xB4, 0x02, 0x3A, 0x02, 0x00, 0x01, 0x64, 0x15, 0x00, 0x04, 0x3A, + 0x02, 0x00, 0x02, 0x64, 0x11, 0x00, 0x0A, 0x3A, 0x02, 0x00, 0x04, 0x64, 0x0D, 0x00, 0x0B, 0x3A, + 0x02, 0x00, 0x08, 0x64, 0x09, 0x00, 0x10, 0x3A, 0x02, 0x00, 0x10, 0x64, 0x05, 0x00, 0x16, 0x3A, + 0x02, 0x00, 0x20, 0x64, 0x01, 0x00, 0x00, 0x64, 0xCF, 0x83, 0xB4, 0x85, 0xE1, 0x02, 0x65, 0x44, + 0x60, 0xFB, 0xB8, 0xF3, 0x2B, 0x45, 0x66, 0x41, 0x65, 0x46, 0x8C, 0xFA, 0x60, 0x40, 0x01, 0x36, + 0x06, 0x00, 0x02, 0x36, 0x04, 0x00, 0x04, 0x36, 0x02, 0x00, 0x05, 0x3A, 0x02, 0x00, 0x00, 0x64, + 0x01, 0x00, 0x01, 0x64, 0x6F, 0xFA, 0x5F, 0xF3, 0x60, 0xF1, 0xFF, 0xFF, 0xA0, 0x84, 0x65, 0x43, + 0x02, 0x02, 0x5F, 0xF3, 0xFF, 0xFF, 0x60, 0x41, 0x0F, 0x60, 0xAE, 0x65, 0xB8, 0xF3, 0xFF, 0xFF, + 0xE0, 0x84, 0x44, 0xD3, 0x61, 0x45, 0xA4, 0x80, 0xFF, 0xFF, 0x04, 0x02, 0xE8, 0x84, 0xA4, 0x80, + 0xFF, 0xFF, 0xFC, 0x03, 0xA4, 0x84, 0x61, 0xFB, 0x6F, 0xF0, 0x60, 0x47, 0x90, 0x84, 0x6F, 0xFA, + 0x60, 0x47, 0x60, 0x45, 0x80, 0x64, 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0xFC, 0x03, 0xA4, 0x84, + 0x70, 0xF0, 0x70, 0xFA, 0x00, 0x61, 0xE8, 0x84, 0xFF, 0xFF, 0x02, 0x05, 0xDD, 0x81, 0xFB, 0x01, + 0xE1, 0x81, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, 0x0E, 0xFA, 0x66, 0x43, 0x0C, 0xF4, 0xFF, 0xFF, + 0x26, 0x46, 0x3F, 0xF2, 0x00, 0xF4, 0x16, 0x65, 0x27, 0x40, 0x02, 0x3A, 0x03, 0x00, 0x1C, 0x65, + 0xF6, 0xA4, 0x01, 0x00, 0xFC, 0xA4, 0x24, 0x43, 0x22, 0x60, 0x82, 0x61, 0x5D, 0x91, 0x51, 0x90, + 0xFF, 0xFF, 0x04, 0x28, 0x60, 0x41, 0xCD, 0x84, 0x4C, 0x91, 0x60, 0x43, 0x60, 0xFE, 0xA5, 0xD2, + 0xDE, 0x85, 0x7F, 0x26, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0x5D, 0x93, 0xA3, 0xDB, 0x5D, 0x93, + 0xA5, 0xD2, 0xF6, 0x1F, 0x5D, 0x93, 0x20, 0xFE, 0xDF, 0x83, 0x22, 0x60, 0x28, 0x7C, 0x03, 0x1E, + 0x60, 0xFE, 0xBD, 0xDF, 0x20, 0xFE, 0x22, 0x60, 0x2C, 0x64, 0x53, 0x93, 0xA4, 0xDD, 0x26, 0x46, + 0x00, 0xF4, 0x1F, 0x60, 0x90, 0x64, 0xA0, 0xD3, 0x00, 0x63, 0x00, 0xB8, 0x0A, 0xFC, 0x03, 0x02, + 0xD7, 0x60, 0x14, 0x78, 0xFF, 0xFF, 0x0B, 0xF2, 0x27, 0x40, 0x02, 0x3A, 0x02, 0x00, 0x0E, 0xF2, + 0xFF, 0xFF, 0x60, 0x47, 0x00, 0x3A, 0x26, 0x00, 0x60, 0x41, 0x00, 0x36, 0x23, 0x00, 0xE0, 0xA0, + 0xDA, 0x85, 0x20, 0x07, 0x1F, 0x60, 0x1E, 0x63, 0xA3, 0xD1, 0x65, 0x42, 0xD1, 0x80, 0x1F, 0x60, + 0x20, 0x63, 0x18, 0x02, 0x50, 0xFE, 0x61, 0x40, 0xFE, 0x22, 0x08, 0x00, 0x62, 0x45, 0xBD, 0xD3, + 0xA5, 0xD0, 0xDA, 0x82, 0xD0, 0x80, 0xC9, 0x81, 0xF6, 0x0C, 0x0C, 0x00, 0x61, 0x40, 0x00, 0x36, + 0x33, 0x00, 0x62, 0x45, 0xA3, 0xD3, 0xA5, 0xD0, 0xFF, 0xFF, 0x90, 0x80, 0xFF, 0x26, 0x02, 0x00, + 0xDE, 0x82, 0x2A, 0x00, 0x0C, 0x63, 0x0A, 0xFC, 0x00, 0x64, 0x09, 0xFA, 0x0B, 0xFA, 0x01, 0x7E, + 0x0C, 0xFA, 0x26, 0x46, 0x08, 0x64, 0x3F, 0xFA, 0x07, 0xF2, 0x88, 0xF1, 0x40, 0x58, 0x07, 0xF8, + 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0x8E, 0x64, 0xA2, 0xDB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0xDA, 0x60, 0x1E, 0x78, 0xFF, 0xFF, 0x20, 0xFE, + 0x21, 0x60, 0xE2, 0x61, 0xA1, 0xD3, 0xFF, 0xFF, 0x22, 0xB0, 0xFF, 0xFF, 0x03, 0x03, 0xD8, 0x60, + 0x9F, 0x78, 0xFF, 0xFF, 0x01, 0x63, 0xD7, 0x01, 0x1F, 0x60, 0x92, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, + 0xFF, 0xA4, 0xFF, 0xFF, 0x0C, 0x20, 0x0D, 0x00, 0xD8, 0x60, 0x9F, 0x78, 0xFF, 0xFF, 0x20, 0xFE, + 0x28, 0x46, 0x2A, 0x41, 0xFF, 0xB1, 0x60, 0xFE, 0x82, 0x64, 0xA1, 0xDA, 0xFF, 0xFF, 0x20, 0xFE, + 0x15, 0x00, 0x21, 0x60, 0xEE, 0x61, 0xA1, 0xDF, 0xD9, 0x81, 0xA1, 0xDF, 0xD9, 0x81, 0xA1, 0xDF, + 0x04, 0xA1, 0xA1, 0xDF, 0xD9, 0x81, 0xA1, 0xDF, 0xD9, 0x81, 0xA1, 0xDF, 0xD9, 0x81, 0xA1, 0xDF, + 0x2B, 0x46, 0x37, 0xF2, 0x7F, 0x60, 0xCF, 0x65, 0xA4, 0x84, 0xA2, 0xDA, 0x26, 0x46, 0x3F, 0xF2, + 0x00, 0xF4, 0x27, 0x40, 0x02, 0x3A, 0x40, 0x00, 0x60, 0x43, 0xF6, 0xA3, 0x00, 0x60, 0x1B, 0x61, + 0x00, 0x60, 0xDD, 0x65, 0x60, 0xFE, 0x81, 0xA1, 0x7F, 0xA1, 0x02, 0x06, 0x00, 0xF4, 0x03, 0x61, + 0xDD, 0x81, 0xA1, 0xD2, 0xCF, 0x83, 0xD4, 0x80, 0x2D, 0x03, 0x17, 0x03, 0xCF, 0x83, 0x61, 0x44, + 0x80, 0xA0, 0x28, 0x03, 0x02, 0x02, 0x00, 0xF4, 0x03, 0x61, 0xDD, 0x81, 0xA1, 0xD2, 0xCF, 0x83, + 0x81, 0xA1, 0x20, 0x03, 0x05, 0x07, 0x7F, 0xA1, 0xCC, 0x84, 0xDD, 0x81, 0xE4, 0x03, 0xF7, 0x01, + 0x00, 0xF4, 0x00, 0xB8, 0x04, 0x61, 0xE4, 0x03, 0xF2, 0x01, 0x01, 0x60, 0xFF, 0x63, 0x46, 0x48, + 0x41, 0x4A, 0xDD, 0x81, 0xA1, 0xD0, 0xDF, 0x83, 0xA3, 0xD9, 0x64, 0x44, 0xDD, 0x81, 0xA1, 0xD0, + 0xDF, 0x83, 0xA3, 0xD9, 0xCC, 0x84, 0x81, 0xA1, 0x05, 0x03, 0x7F, 0xA1, 0xF7, 0x04, 0x00, 0xF4, + 0x03, 0x61, 0xF4, 0x01, 0x20, 0xFE, 0x3F, 0x00, 0x60, 0x43, 0xFC, 0xA3, 0x00, 0x60, 0x15, 0x61, + 0x00, 0x60, 0xDD, 0x65, 0x60, 0xFE, 0x81, 0xA1, 0x7F, 0xA1, 0x02, 0x06, 0x00, 0xF4, 0x03, 0x61, + 0xDD, 0x81, 0xA1, 0xD2, 0xCF, 0x83, 0xD4, 0x80, 0x2D, 0x03, 0x17, 0x03, 0xCF, 0x83, 0x61, 0x44, + 0x80, 0xA0, 0x28, 0x03, 0x02, 0x02, 0x00, 0xF4, 0x03, 0x61, 0xDD, 0x81, 0xA1, 0xD2, 0xCF, 0x83, + 0x81, 0xA1, 0x20, 0x03, 0x05, 0x07, 0x7F, 0xA1, 0xCC, 0x84, 0xDD, 0x81, 0xE4, 0x03, 0xF7, 0x01, + 0x00, 0xF4, 0x00, 0xB8, 0x04, 0x61, 0xE4, 0x03, 0xF2, 0x01, 0x01, 0x60, 0xFF, 0x63, 0x46, 0x48, + 0x41, 0x4A, 0xDD, 0x81, 0xA1, 0xD0, 0xDF, 0x83, 0xA3, 0xD9, 0x64, 0x44, 0xDD, 0x81, 0xA1, 0xD0, + 0xDF, 0x83, 0xA3, 0xD9, 0xCC, 0x84, 0x81, 0xA1, 0x05, 0x03, 0x7F, 0xA1, 0xF7, 0x04, 0x00, 0xF4, + 0x03, 0x61, 0xF4, 0x01, 0x20, 0xFE, 0x00, 0xBB, 0x02, 0x60, 0x00, 0x61, 0x08, 0x24, 0xD7, 0x00, + 0x60, 0xFE, 0xA1, 0xD3, 0xFF, 0xFF, 0xFA, 0xA4, 0xFF, 0xFF, 0x01, 0x05, 0x50, 0x01, 0xDD, 0x81, + 0xA1, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0x00, 0x3A, 0x4A, 0x01, 0xDD, 0x81, 0xA1, 0xD1, 0xFF, 0xFF, + 0x64, 0x40, 0x50, 0x3A, 0x44, 0x01, 0xDD, 0x81, 0xA1, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0xF2, 0x3A, + 0x3E, 0x01, 0xDD, 0x81, 0xA1, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x3A, 0x20, 0x01, 0xDD, 0x81, + 0xA1, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x3A, 0x1A, 0x01, 0xDD, 0x81, 0xA1, 0xD1, 0xFF, 0xFF, + 0x64, 0x40, 0x00, 0x3A, 0x14, 0x01, 0x60, 0x5C, 0x00, 0x36, 0x30, 0x00, 0x00, 0x64, 0xD8, 0x60, + 0x58, 0x4E, 0xC4, 0x78, 0xFF, 0xFF, 0x21, 0x60, 0xF6, 0x62, 0xA2, 0xDB, 0x64, 0x40, 0x00, 0x36, + 0x2B, 0x00, 0xDD, 0x81, 0xA1, 0xD3, 0xDD, 0x81, 0xD8, 0x60, 0x58, 0x4E, 0xC4, 0x78, 0xFF, 0xFF, + 0x21, 0x60, 0xF8, 0x62, 0xA2, 0xDB, 0x64, 0x40, 0x00, 0x36, 0x24, 0x00, 0xDD, 0x81, 0xA1, 0xD3, + 0xDD, 0x81, 0xD8, 0x60, 0x58, 0x4E, 0xC4, 0x78, 0xFF, 0xFF, 0x21, 0x60, 0xFA, 0x62, 0xA2, 0xDB, + 0x64, 0x40, 0x00, 0x36, 0x1D, 0x00, 0xDD, 0x81, 0xA1, 0xD1, 0x21, 0x60, 0xFC, 0x62, 0xA2, 0xD9, + 0xDD, 0x81, 0xA1, 0xD1, 0x21, 0x60, 0xFD, 0x62, 0xA2, 0xD9, 0x19, 0x00, 0x20, 0xFE, 0x21, 0x60, + 0xF6, 0x62, 0x00, 0x60, 0x04, 0x64, 0xA2, 0xDB, 0x20, 0xFE, 0x21, 0x60, 0xF8, 0x62, 0x00, 0x60, + 0x04, 0x64, 0xA2, 0xDB, 0x20, 0xFE, 0x21, 0x60, 0xFA, 0x62, 0x00, 0x60, 0x02, 0x64, 0xA2, 0xDB, + 0x20, 0xFE, 0x21, 0x60, 0xFC, 0x62, 0x00, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0x00, 0x00, 0x20, 0xFE, + 0x21, 0x60, 0xE2, 0x62, 0xA2, 0xD1, 0x21, 0x60, 0xF6, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xA0, 0x84, + 0xFF, 0xFF, 0x10, 0x26, 0x09, 0x00, 0x04, 0x26, 0x09, 0x00, 0x20, 0x26, 0x09, 0x00, 0x02, 0x26, + 0x09, 0x00, 0xD7, 0x60, 0x07, 0x78, 0xFF, 0xFF, 0x10, 0x7C, 0x05, 0x00, 0x04, 0x7C, 0x03, 0x00, + 0x20, 0x7C, 0x01, 0x00, 0x02, 0x7C, 0x21, 0x60, 0xEE, 0x61, 0xA1, 0xD9, 0x21, 0x60, 0xE4, 0x61, + 0xA1, 0xD1, 0x21, 0x60, 0xF8, 0x61, 0xA1, 0xD3, 0x21, 0x60, 0xEE, 0x61, 0xA0, 0x84, 0xA1, 0xD1, + 0xFF, 0xFF, 0x10, 0x26, 0x07, 0x00, 0x04, 0x26, 0x07, 0x00, 0x01, 0x26, 0x0D, 0x00, 0xD7, 0x60, + 0x07, 0x78, 0xFF, 0xFF, 0x10, 0x7C, 0x09, 0x00, 0x64, 0x40, 0x10, 0x22, 0x03, 0x00, 0xD7, 0x60, + 0x07, 0x78, 0xFF, 0xFF, 0x04, 0x7C, 0x01, 0x00, 0x01, 0x7C, 0x21, 0x60, 0xF0, 0x61, 0xA1, 0xD9, + 0x21, 0x60, 0xE6, 0x61, 0xA1, 0xD1, 0x21, 0x60, 0xFA, 0x61, 0xA1, 0xD3, 0xFF, 0xFF, 0xA0, 0x84, + 0x02, 0x26, 0x07, 0x00, 0x04, 0x26, 0x07, 0x00, 0x01, 0x26, 0x07, 0x00, 0xD7, 0x60, 0x07, 0x78, + 0xFF, 0xFF, 0x02, 0x7C, 0x03, 0x00, 0x04, 0x7C, 0x01, 0x00, 0x20, 0x7C, 0x21, 0x60, 0xF2, 0x61, + 0xA1, 0xD9, 0x21, 0x60, 0xFC, 0x61, 0xA1, 0xD1, 0x21, 0x60, 0xF4, 0x61, 0xA1, 0xD9, 0x21, 0x60, + 0xF2, 0x61, 0xA1, 0xD3, 0xFF, 0xFF, 0x60, 0x47, 0x21, 0x60, 0xF0, 0x61, 0xA1, 0xD1, 0xFF, 0xFF, + 0xB0, 0x84, 0x1F, 0x60, 0x92, 0x62, 0xA2, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x36, 0x22, 0xBC, + 0xAB, 0x46, 0x36, 0xFA, 0xAB, 0x46, 0x21, 0x60, 0xEE, 0x61, 0xA1, 0xD3, 0x1F, 0x60, 0x92, 0x62, + 0xA2, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x36, 0x22, 0xBC, 0x88, 0xF1, 0x66, 0x41, 0x64, 0x46, + 0x36, 0xFA, 0xFF, 0xFF, 0x61, 0x46, 0x50, 0x00, 0x21, 0x60, 0xFE, 0x62, 0xA2, 0xDB, 0xE0, 0x84, + 0xE0, 0x84, 0x03, 0x02, 0x01, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x02, 0xA5, 0x64, 0x44, 0xD4, 0x9C, + 0x22, 0x60, 0x00, 0x62, 0xA2, 0xD9, 0x22, 0x60, 0x02, 0x62, 0xA2, 0xDF, 0xDD, 0x81, 0xA1, 0xD1, + 0x00, 0x65, 0x64, 0x40, 0x00, 0x3A, 0x01, 0x65, 0xDD, 0x81, 0xA1, 0xD1, 0xFF, 0xFF, 0x64, 0x40, + 0x50, 0x3A, 0x01, 0x65, 0xDD, 0x81, 0xA1, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0xF2, 0x3A, 0x01, 0x65, + 0xDD, 0x81, 0xA1, 0xD1, 0x65, 0x40, 0x00, 0x3A, 0x18, 0x00, 0x00, 0x60, 0x00, 0x65, 0x64, 0x40, + 0x00, 0x36, 0x01, 0x65, 0x64, 0x40, 0x01, 0x36, 0x02, 0x65, 0x64, 0x40, 0x02, 0x36, 0x04, 0x65, + 0x64, 0x40, 0x04, 0x36, 0x10, 0x65, 0x64, 0x40, 0x05, 0x36, 0x20, 0x65, 0x65, 0x5C, 0x22, 0x60, + 0x02, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xB0, 0x84, 0xA2, 0xDB, 0x21, 0x60, 0xFE, 0x62, 0xA2, 0xD3, + 0xFF, 0xFF, 0xFF, 0xA4, 0xA2, 0xDB, 0xCA, 0x02, 0x22, 0x60, 0x02, 0x62, 0xA2, 0xD3, 0x22, 0x60, + 0x00, 0x62, 0xA2, 0xD1, 0x2E, 0x58, 0xFF, 0xFF, 0xAB, 0x46, 0x82, 0xF0, 0xC0, 0x67, 0xB4, 0x84, + 0xAB, 0x46, 0x0B, 0xFA, 0x1F, 0x60, 0xA0, 0x64, 0xA0, 0xD1, 0x22, 0x60, 0xD4, 0x7C, 0x04, 0x1B, + 0xFF, 0x60, 0xFF, 0x63, 0xA4, 0xDD, 0x29, 0x00, 0x23, 0x60, 0x3C, 0x63, 0xA4, 0xDD, 0xDB, 0x83, + 0x60, 0xFE, 0x00, 0x64, 0xBD, 0xDB, 0x60, 0x64, 0xBD, 0xDB, 0x1D, 0x64, 0xBD, 0xDB, 0xC3, 0xF3, + 0xBD, 0xDB, 0xFF, 0xFF, 0x20, 0xFE, 0x01, 0x60, 0x78, 0x64, 0x06, 0x61, 0x58, 0xD1, 0xFF, 0xFF, + 0x60, 0xFE, 0xBD, 0xD9, 0x20, 0xFE, 0xCD, 0x81, 0x61, 0x40, 0x08, 0x28, 0xF7, 0x01, 0xB7, 0xF1, + 0xFF, 0xFF, 0x64, 0x47, 0x60, 0xFE, 0xBD, 0xD9, 0xBD, 0xDB, 0x20, 0xFE, 0x1F, 0x60, 0x9C, 0x64, + 0xA0, 0xD1, 0x60, 0xFE, 0xBD, 0xD9, 0xFF, 0xFF, 0x20, 0xFE, 0x22, 0x60, 0xD2, 0x64, 0x40, 0x48, + 0x18, 0x61, 0x26, 0x46, 0x00, 0xF4, 0xFF, 0x60, 0xF2, 0x64, 0xE1, 0x60, 0x58, 0x4D, 0xE5, 0x78, + 0xFF, 0xFF, 0x26, 0x46, 0x3F, 0xFC, 0x2B, 0x46, 0x56, 0xF1, 0x16, 0x60, 0xAC, 0x61, 0x1B, 0xF8, + 0xA1, 0xD1, 0x10, 0x60, 0x00, 0x64, 0xA0, 0x80, 0x06, 0xF2, 0x0C, 0x03, 0x10, 0xBC, 0x06, 0xFA, + 0x87, 0xF3, 0x00, 0x60, 0xE2, 0x62, 0xA2, 0xD3, 0x60, 0x45, 0xD4, 0x80, 0xDC, 0x84, 0x07, 0x07, + 0xA2, 0xDB, 0x05, 0x00, 0x10, 0xB5, 0xFF, 0xFF, 0x02, 0x03, 0xD4, 0x84, 0x06, 0xFA, 0x07, 0xF2, + 0x66, 0x45, 0x60, 0x46, 0x06, 0xF2, 0x65, 0x46, 0x02, 0xB0, 0xFF, 0xFF, 0x12, 0x03, 0x26, 0x46, + 0x88, 0xF3, 0x07, 0xFA, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0x8E, 0x64, 0xA2, 0xDB, 0x26, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x00, 0x66, 0x46, 0x46, + 0x4C, 0x00, 0x26, 0x46, 0x88, 0xF3, 0x07, 0xFA, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0x8E, 0x64, + 0xA2, 0xDB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, + 0x00, 0x66, 0x46, 0x46, 0x1A, 0x00, 0x00, 0x60, 0xC0, 0x64, 0x2A, 0xFA, 0x02, 0x64, 0x3F, 0xFA, + 0x88, 0xF3, 0x07, 0xFA, 0x00, 0xF4, 0x09, 0x64, 0x09, 0xFA, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, + 0x8E, 0x64, 0xA2, 0xDB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xC1, 0xFE, 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x2B, 0x43, 0x14, 0x60, 0xD0, 0x62, + 0xA2, 0xD3, 0xDA, 0x81, 0x60, 0x45, 0xD5, 0x80, 0xA1, 0xD1, 0x11, 0x03, 0xD3, 0x80, 0xD9, 0x81, + 0xFA, 0x02, 0xC9, 0x81, 0xC8, 0x85, 0xD5, 0x80, 0xA5, 0xD3, 0x08, 0x28, 0xA1, 0xDB, 0x14, 0x60, + 0xD0, 0x62, 0x65, 0x44, 0xA2, 0xDB, 0x4A, 0xD3, 0xFF, 0xFF, 0xCC, 0x84, 0xA2, 0xDB, 0xAB, 0x46, + 0x06, 0xF2, 0xFF, 0xFF, 0x02, 0xBC, 0x06, 0xFA, 0xAB, 0x46, 0xAB, 0x46, 0x0F, 0x60, 0xFF, 0x64, + 0x02, 0xF0, 0x72, 0xF1, 0xA0, 0x84, 0xD0, 0x80, 0x02, 0xFA, 0xAB, 0x46, 0x01, 0x06, 0x72, 0xFB, + 0x27, 0x41, 0x01, 0xB1, 0xFF, 0xFF, 0x08, 0x03, 0x2B, 0x46, 0x0B, 0x58, 0x01, 0x65, 0xE2, 0x60, + 0x58, 0x4E, 0x86, 0x78, 0xFF, 0xFF, 0x0A, 0x00, 0x2B, 0x46, 0x0B, 0x58, 0x16, 0x60, 0xA2, 0x64, + 0x40, 0x59, 0x02, 0x65, 0xE2, 0x60, 0x58, 0x4E, 0x86, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, + 0x2F, 0x58, 0xFF, 0xFF, 0x26, 0x46, 0x00, 0xF4, 0x00, 0x64, 0x09, 0xFA, 0x0B, 0xFA, 0x01, 0x7E, + 0x0C, 0xFA, 0x0A, 0x64, 0x0A, 0xFA, 0x26, 0x46, 0x08, 0x64, 0x3F, 0xFA, 0x07, 0xF2, 0x88, 0xF1, + 0x40, 0x58, 0x07, 0xF8, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0x8E, 0x64, 0xA2, 0xDB, 0x26, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0xFF, 0x60, 0xFD, 0x65, + 0x38, 0x46, 0x06, 0xF2, 0xFF, 0xFF, 0xA4, 0x83, 0x06, 0xFC, 0x02, 0xB0, 0x26, 0x46, 0x1C, 0x03, + 0x38, 0x43, 0x87, 0xF1, 0x14, 0x60, 0xCE, 0x61, 0xA1, 0xD3, 0xDA, 0x81, 0xD0, 0x80, 0xDC, 0x9C, + 0x05, 0x05, 0xA1, 0xD3, 0x4A, 0xD9, 0xA0, 0xDD, 0xDA, 0x9C, 0xA1, 0xD9, 0x02, 0x60, 0x00, 0x61, + 0x2C, 0xF2, 0xA1, 0xDB, 0x2D, 0xF2, 0x41, 0x58, 0x59, 0xDB, 0x2E, 0xF2, 0x59, 0xDB, 0x03, 0x65, + 0xE2, 0x60, 0x58, 0x4E, 0x86, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, + 0x07, 0xF2, 0x88, 0xF1, 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, 0x02, 0x02, 0x2F, 0x58, 0xFF, 0xFF, + 0x40, 0x47, 0x07, 0xF2, 0x66, 0x45, 0x60, 0x46, 0x06, 0xF2, 0x65, 0x46, 0x02, 0xB0, 0xFF, 0xFF, + 0x1B, 0x02, 0x27, 0x43, 0x14, 0x60, 0xD0, 0x62, 0xA2, 0xD3, 0xDA, 0x81, 0x60, 0x45, 0xD5, 0x80, + 0xA1, 0xD1, 0x11, 0x03, 0xD3, 0x80, 0xD9, 0x81, 0xFA, 0x02, 0xC9, 0x81, 0xC8, 0x85, 0xD5, 0x80, + 0xA5, 0xD3, 0x08, 0x28, 0xA1, 0xDB, 0x14, 0x60, 0xD0, 0x62, 0x65, 0x44, 0xA2, 0xDB, 0x4A, 0xD3, + 0xFF, 0xFF, 0xCC, 0x84, 0xA2, 0xDB, 0x0C, 0x00, 0x27, 0x44, 0x40, 0x58, 0x03, 0x65, 0xE2, 0x60, + 0x58, 0x4E, 0x86, 0x78, 0xFF, 0xFF, 0x27, 0x43, 0xE4, 0x60, 0x58, 0x4E, 0x9D, 0x78, 0xFF, 0xFF, + 0x26, 0x46, 0x87, 0xF4, 0x66, 0x41, 0x63, 0x46, 0x05, 0xF2, 0x00, 0xF0, 0x81, 0xF0, 0x02, 0x18, + 0x64, 0x46, 0x81, 0xF8, 0x07, 0x1B, 0x12, 0x60, 0xCE, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, + 0x44, 0xD9, 0x02, 0x00, 0x65, 0x46, 0x00, 0xF8, 0x88, 0xF3, 0x63, 0x45, 0x60, 0x46, 0x00, 0xF2, + 0xFF, 0xFF, 0xD4, 0x80, 0x01, 0x18, 0xFA, 0x04, 0x80, 0xF8, 0x65, 0x46, 0x00, 0xFA, 0x06, 0xF2, + 0xFF, 0xFF, 0x00, 0x7E, 0x06, 0xFA, 0x61, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x07, 0xF2, 0x88, 0xF1, + 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, 0x02, 0x02, 0x2F, 0x58, 0xFF, 0xFF, 0x40, 0x47, 0x07, 0xF2, + 0x66, 0x45, 0x60, 0x46, 0x06, 0xF2, 0x65, 0x46, 0x02, 0xB0, 0xFF, 0xFF, 0x02, 0x02, 0x2F, 0x58, + 0xFF, 0xFF, 0x27, 0x46, 0x06, 0xF0, 0xFF, 0x60, 0xED, 0x64, 0xA0, 0x84, 0x06, 0xFA, 0x27, 0x43, + 0x87, 0xF1, 0x14, 0x60, 0xCE, 0x61, 0xA1, 0xD3, 0xDA, 0x81, 0xD0, 0x80, 0xDC, 0x9C, 0x05, 0x05, + 0xA1, 0xD3, 0x4A, 0xD9, 0xA0, 0xDD, 0xDA, 0x9C, 0xA1, 0xD9, 0x07, 0x58, 0x03, 0x65, 0xE2, 0x60, + 0x58, 0x4E, 0x86, 0x78, 0xFF, 0xFF, 0x27, 0x43, 0xE4, 0x60, 0x58, 0x4E, 0x9D, 0x78, 0xFF, 0xFF, + 0x26, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x26, 0x46, 0x2F, 0xF2, 0x2C, 0xFA, 0x30, 0xF2, 0x2D, 0xFA, + 0x31, 0xF2, 0x2E, 0xFA, 0xCB, 0xF3, 0x2F, 0xFA, 0xCC, 0xF3, 0x30, 0xFA, 0xCD, 0xF3, 0x31, 0xFA, + 0x67, 0xF3, 0x32, 0xFA, 0x68, 0xF3, 0x33, 0xFA, 0x69, 0xF3, 0x34, 0xFA, 0xAC, 0xF1, 0x19, 0xF8, + 0x1C, 0xF2, 0x13, 0xFA, 0x02, 0x63, 0x3F, 0xFC, 0x00, 0x64, 0x3E, 0xFA, 0x02, 0x60, 0x00, 0x61, + 0x2C, 0xF2, 0xA1, 0xDB, 0x2D, 0xF2, 0x41, 0x58, 0x59, 0xDB, 0x2E, 0xF2, 0x59, 0xDB, 0x06, 0x63, + 0x07, 0xF2, 0x88, 0xF1, 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, 0x0D, 0x02, 0x43, 0x59, 0x02, 0x65, + 0xE2, 0x60, 0x58, 0x4E, 0x5B, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0xC0, 0x64, 0x2A, 0xFA, 0x00, 0xF4, + 0x06, 0x64, 0x09, 0xFA, 0x15, 0x00, 0x07, 0xF2, 0x66, 0x45, 0x60, 0x46, 0x06, 0xF2, 0x65, 0x46, + 0x02, 0xB0, 0xFF, 0xFF, 0x1E, 0x02, 0x07, 0x63, 0x43, 0x59, 0x01, 0x65, 0xE2, 0x60, 0x58, 0x4E, + 0x5B, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0xA0, 0x64, 0x2A, 0xFA, 0x00, 0xF4, 0x07, 0x64, 0x09, 0xFA, + 0x26, 0x46, 0x88, 0xF3, 0x07, 0xFA, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0x8E, 0x64, 0xA2, 0xDB, + 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x00, 0x66, + 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xFE, 0x62, 0xDB, 0x60, 0xB0, 0x64, 0xA2, 0xDB, + 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x60, 0x03, 0x64, 0xA2, 0xDB, 0xDB, 0x60, + 0x4D, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xE8, 0x62, 0xA2, 0xD1, + 0x00, 0x60, 0x02, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x5A, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x72, 0xF3, + 0x88, 0xF5, 0xDC, 0x81, 0x66, 0x43, 0x02, 0xA3, 0x63, 0x46, 0xCD, 0x81, 0x06, 0xF2, 0xED, 0x03, + 0x60, 0x40, 0x08, 0x2A, 0xF7, 0x01, 0x0C, 0xAC, 0x06, 0xFA, 0x46, 0x49, 0x00, 0x60, 0x02, 0x61, + 0xB3, 0x60, 0x58, 0x4D, 0x77, 0x78, 0xFF, 0xFF, 0xE0, 0x03, 0x25, 0x60, 0x2C, 0x61, 0xA1, 0xD3, + 0xFF, 0xFF, 0x03, 0x1B, 0x00, 0x60, 0xA0, 0x64, 0x02, 0x00, 0x00, 0x60, 0xC0, 0x64, 0x2A, 0xFA, + 0xAB, 0xFC, 0x66, 0x45, 0x29, 0x44, 0x07, 0xFA, 0x29, 0x46, 0x03, 0xF2, 0x04, 0xF0, 0x85, 0xF2, + 0x65, 0x46, 0x2C, 0xFA, 0x2D, 0xF8, 0xAE, 0xFA, 0xCB, 0xF3, 0x2F, 0xFA, 0x32, 0xFA, 0xCC, 0xF3, + 0x30, 0xFA, 0x33, 0xFA, 0xCD, 0xF3, 0x31, 0xFA, 0x34, 0xFA, 0xAC, 0xF1, 0x19, 0xF8, 0x18, 0x67, + 0x0E, 0xFA, 0x66, 0x45, 0x63, 0x46, 0x0E, 0xF2, 0x65, 0x46, 0x00, 0x7E, 0x13, 0xFA, 0x02, 0x63, + 0x3F, 0xFC, 0x00, 0x64, 0x3E, 0xFA, 0x66, 0x41, 0x00, 0xF4, 0x25, 0x60, 0x28, 0x62, 0xA2, 0xD3, + 0xFF, 0xFF, 0x09, 0xFA, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0x9A, 0x64, 0xA2, 0xDB, 0x61, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC8, 0xFE, 0x9E, 0x01, 0x92, 0x01, + 0x0F, 0x60, 0xE8, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x5A, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0x07, 0xF0, + 0xFF, 0xFF, 0x64, 0x43, 0x14, 0x60, 0xD0, 0x62, 0xA2, 0xD3, 0xDA, 0x81, 0x60, 0x45, 0xD5, 0x80, + 0xA1, 0xD1, 0x04, 0x03, 0xD3, 0x80, 0xD9, 0x81, 0xFA, 0x02, 0x09, 0x00, 0xA1, 0xDD, 0x14, 0x60, + 0xD0, 0x62, 0xD9, 0x84, 0xA2, 0xDB, 0x4A, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xA2, 0xDB, 0x66, 0x45, + 0x63, 0x46, 0x06, 0xF2, 0xFF, 0x60, 0x01, 0x7C, 0xA0, 0x9C, 0x06, 0xF8, 0x65, 0x46, 0x71, 0xF3, + 0x60, 0x40, 0x10, 0x2A, 0x03, 0x00, 0xCC, 0x84, 0x80, 0x2B, 0x71, 0xFB, 0x0F, 0x60, 0xE8, 0x62, + 0xA2, 0xD1, 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x0F, 0x60, 0xDC, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x0F, 0x60, 0xDE, 0x62, 0x00, 0x60, 0x02, 0x64, + 0xA2, 0xDB, 0xDB, 0x60, 0xF7, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x71, 0xF3, + 0x72, 0xF3, 0x00, 0xA8, 0x60, 0x88, 0x50, 0x03, 0xE0, 0x83, 0x6C, 0x03, 0xCB, 0x83, 0x88, 0xF3, + 0x73, 0xF1, 0x02, 0xA4, 0x40, 0x47, 0x64, 0x45, 0x27, 0x46, 0x72, 0xF4, 0x12, 0xF2, 0x40, 0x18, + 0xD4, 0x80, 0x02, 0x64, 0x3D, 0x07, 0x23, 0xFA, 0x2A, 0xF2, 0x0E, 0xF2, 0x0C, 0xB0, 0x02, 0xF0, + 0x0D, 0x02, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0x8E, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0xE6, 0x01, 0x60, 0x40, 0xF0, 0x37, + 0x08, 0x00, 0x09, 0x60, 0x08, 0x64, 0xD0, 0x80, 0xA2, 0xFF, 0x90, 0xF3, 0x02, 0x02, 0xDC, 0x84, + 0x90, 0xFB, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0xAC, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xA3, 0xFF, 0xCE, 0xFE, 0x98, 0xF1, 0x1E, 0x60, + 0xEC, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, + 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0xBC, 0x01, + 0x27, 0x44, 0x02, 0xA4, 0x40, 0x47, 0xB8, 0x1F, 0x28, 0x43, 0xCB, 0x83, 0x88, 0xF3, 0x1A, 0x0E, + 0x02, 0xA4, 0x40, 0x4C, 0x43, 0x48, 0x2C, 0x46, 0x1E, 0xF2, 0x73, 0xF1, 0xAC, 0x86, 0x12, 0xF2, + 0x0C, 0x03, 0xD0, 0x80, 0xFF, 0xFF, 0x09, 0x07, 0x1B, 0x60, 0xDA, 0x64, 0x40, 0x4B, 0xF0, 0x60, + 0x58, 0x4D, 0x75, 0x78, 0xFF, 0xFF, 0x2C, 0x46, 0x9E, 0xFC, 0x2C, 0x44, 0x02, 0xA4, 0x28, 0x43, + 0x40, 0x4C, 0xE8, 0x1F, 0x7D, 0x01, 0x01, 0x63, 0x66, 0xF3, 0xAC, 0xF3, 0x00, 0xBD, 0xAC, 0x81, + 0x06, 0x03, 0x05, 0x03, 0xB5, 0x60, 0x58, 0x4D, 0xC1, 0x78, 0xFF, 0xFF, 0x60, 0x43, 0x5B, 0xFD, + 0x3E, 0x63, 0x16, 0x60, 0x60, 0x61, 0x00, 0x64, 0x59, 0xDB, 0xFE, 0x1F, 0x71, 0xFB, 0x72, 0xFB, + 0x16, 0x60, 0xA8, 0x65, 0x00, 0x64, 0xA5, 0xDB, 0x5A, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0x1B, 0x60, + 0x9A, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x03, 0x02, 0xC7, 0x60, 0x2E, 0x78, + 0xFF, 0xFF, 0x07, 0xF0, 0x66, 0x45, 0x64, 0x46, 0x1B, 0xF2, 0x65, 0x46, 0x64, 0x45, 0x5B, 0xF1, + 0xE0, 0x84, 0x73, 0xF1, 0xC0, 0x84, 0xC0, 0x84, 0x12, 0xFA, 0x2C, 0xF2, 0x71, 0xF3, 0x60, 0x40, + 0x01, 0x2A, 0x36, 0x00, 0x00, 0xA8, 0x1F, 0x60, 0x8E, 0x62, 0xA2, 0xD3, 0x37, 0x03, 0x00, 0xA8, + 0xFF, 0xFF, 0x34, 0x03, 0xDE, 0x60, 0x58, 0x4D, 0x6B, 0x78, 0xFF, 0xFF, 0x25, 0x46, 0x09, 0x60, + 0x08, 0x61, 0xA2, 0xFF, 0x0E, 0xF2, 0x02, 0xF0, 0x60, 0x40, 0xF0, 0x37, 0x0D, 0x00, 0x92, 0xF3, + 0x90, 0xF3, 0xDC, 0x83, 0xD1, 0x80, 0x92, 0xFD, 0x0C, 0x03, 0x8C, 0xF3, 0xCC, 0x83, 0xD8, 0xA0, + 0x90, 0xFD, 0x07, 0x04, 0xD4, 0xFE, 0x05, 0x00, 0xD1, 0x80, 0x93, 0xF3, 0x02, 0x03, 0xDC, 0x84, + 0x93, 0xFB, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0x94, 0x64, 0xA2, 0xDB, 0x25, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xA3, 0xFF, 0xDC, 0x60, 0x87, 0x78, 0xFF, 0xFF, + 0x66, 0x41, 0x65, 0x46, 0x06, 0xF2, 0x61, 0x46, 0x60, 0x40, 0x10, 0x2A, 0x4C, 0x00, 0x80, 0x67, + 0xB4, 0x81, 0x1B, 0x60, 0xDA, 0x62, 0x61, 0x44, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xDE, 0x60, 0x58, 0x4D, 0x6B, 0x78, 0xFF, 0xFF, 0x25, 0x46, + 0x2A, 0xF2, 0x09, 0x60, 0x08, 0x61, 0x0C, 0xB0, 0xA2, 0xFF, 0x17, 0x03, 0x0E, 0xF2, 0x02, 0xF0, + 0x60, 0x40, 0xF0, 0x37, 0x0D, 0x00, 0x90, 0xF3, 0x92, 0xF3, 0xCC, 0x83, 0xD1, 0x80, 0x90, 0xFD, + 0x0C, 0x03, 0x8C, 0xF3, 0xDC, 0x83, 0xD8, 0xA0, 0x92, 0xFD, 0x07, 0x04, 0xD4, 0xFE, 0x05, 0x00, + 0xD1, 0x80, 0x93, 0xF3, 0x02, 0x03, 0xDC, 0x84, 0x93, 0xFB, 0x07, 0xF0, 0x0A, 0xF2, 0xA3, 0xFF, + 0x64, 0x45, 0x30, 0x1B, 0x66, 0x41, 0x65, 0x46, 0x02, 0xF0, 0x61, 0x46, 0x0F, 0x60, 0xFF, 0x61, + 0xA1, 0x84, 0x60, 0x41, 0xE9, 0x81, 0xE9, 0x81, 0xE9, 0x81, 0xE1, 0x82, 0x07, 0xB4, 0x01, 0x61, + 0x03, 0x03, 0xCC, 0x84, 0xE1, 0x81, 0xFD, 0x02, 0x16, 0x60, 0x62, 0x65, 0x46, 0xD1, 0x61, 0x44, + 0xB0, 0x84, 0xA2, 0xDB, 0x17, 0x00, 0x1B, 0x60, 0x8E, 0x61, 0x2A, 0xF2, 0x3E, 0xF2, 0x0C, 0xB0, + 0x01, 0xB0, 0x05, 0x03, 0x1B, 0x60, 0xA0, 0x61, 0x02, 0x02, 0x1B, 0x60, 0x88, 0x61, 0x1B, 0x60, + 0xDA, 0x62, 0x61, 0x44, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0xC1, 0xFE, 0xDC, 0x60, 0x87, 0x78, 0xFF, 0xFF, 0x07, 0xF0, 0x2B, 0xF2, 0x2A, 0xF2, + 0x60, 0x41, 0x44, 0x49, 0x60, 0x45, 0xA4, 0x3A, 0x0D, 0x00, 0x61, 0x40, 0xC0, 0x3B, 0x7B, 0x00, + 0xA9, 0x46, 0x06, 0xF2, 0xA9, 0x46, 0x60, 0x40, 0x20, 0x26, 0x75, 0x00, 0x20, 0xBC, 0xA9, 0x46, + 0x06, 0xFA, 0xA9, 0x46, 0xA9, 0x46, 0x06, 0xF0, 0xA9, 0x46, 0x65, 0x40, 0x10, 0x2B, 0x6E, 0x00, + 0x64, 0x40, 0x10, 0x2A, 0x36, 0x00, 0x65, 0x40, 0xA4, 0x3A, 0x65, 0x00, 0x29, 0x45, 0x65, 0x46, + 0x72, 0xF2, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x04, 0x02, 0x78, 0x00, 0xDE, 0x60, 0x51, 0x78, + 0xFF, 0xFF, 0x09, 0xF2, 0x2A, 0xF0, 0x00, 0xA8, 0x20, 0x67, 0x02, 0x03, 0xB0, 0x84, 0x2A, 0xFA, + 0x0E, 0xF2, 0x02, 0xF0, 0x60, 0x40, 0xF0, 0x37, 0x08, 0x00, 0x09, 0x60, 0x08, 0x64, 0xD0, 0x80, + 0xA2, 0xFF, 0x90, 0xF3, 0x02, 0x02, 0xDC, 0x84, 0x90, 0xFB, 0x3E, 0xF2, 0xA3, 0xFF, 0x01, 0xB0, + 0x1B, 0x60, 0xA0, 0x61, 0x02, 0x02, 0x1B, 0x60, 0x8E, 0x61, 0x1B, 0x60, 0xDA, 0x62, 0x61, 0x44, + 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, + 0x17, 0x00, 0x10, 0x64, 0xB0, 0x84, 0xDF, 0x65, 0xA4, 0x9E, 0xA9, 0x46, 0x06, 0xFA, 0xA9, 0x46, + 0xA2, 0xFF, 0x16, 0x60, 0xA8, 0x62, 0x04, 0x64, 0xA2, 0xDB, 0x29, 0x44, 0x5A, 0xDB, 0x71, 0xF3, + 0xC1, 0xFE, 0xD4, 0xFE, 0x87, 0xF1, 0xA3, 0xFF, 0xD0, 0x80, 0xDC, 0x84, 0x01, 0x07, 0x71, 0xFB, + 0xA9, 0x46, 0x72, 0xF2, 0xA9, 0x46, 0x65, 0x18, 0xA9, 0x46, 0x02, 0xF0, 0xA9, 0x46, 0x0F, 0x60, + 0xFF, 0x61, 0xA1, 0x84, 0x60, 0x41, 0xE9, 0x81, 0xE9, 0x81, 0xE9, 0x81, 0xE1, 0x82, 0x07, 0xB4, + 0x01, 0x61, 0x03, 0x03, 0xCC, 0x84, 0xE1, 0x81, 0xFD, 0x02, 0x16, 0x60, 0x62, 0x65, 0x46, 0xD1, + 0xFF, 0xFF, 0xB1, 0x84, 0xA2, 0xDB, 0xDE, 0x60, 0x68, 0x78, 0xFF, 0xFF, 0x64, 0x40, 0x10, 0x2A, + 0xFA, 0x01, 0xFF, 0x60, 0xEF, 0x64, 0xA0, 0x84, 0xA9, 0x46, 0x06, 0xFA, 0xA9, 0x46, 0x65, 0x41, + 0x71, 0xF3, 0x29, 0x45, 0xCC, 0x84, 0x80, 0x2B, 0x71, 0xFB, 0x65, 0x46, 0x72, 0xF2, 0xFF, 0xFF, + 0x00, 0xA8, 0x60, 0x46, 0x37, 0x02, 0x61, 0x40, 0xA4, 0x3A, 0xE5, 0x01, 0x00, 0x60, 0x3A, 0x61, + 0xB3, 0x60, 0x58, 0x4D, 0x77, 0x78, 0xFF, 0xFF, 0x81, 0x03, 0x02, 0x60, 0x48, 0x64, 0x2A, 0xFA, + 0xCB, 0xF1, 0x2F, 0xF8, 0xCC, 0xF1, 0x30, 0xF8, 0xCD, 0xF1, 0x31, 0xF8, 0x67, 0xF1, 0x32, 0xF8, + 0x68, 0xF1, 0x33, 0xF8, 0x69, 0xF1, 0x34, 0xF8, 0xA9, 0x46, 0x03, 0xF2, 0x04, 0xF0, 0x85, 0xF0, + 0xA9, 0x46, 0x2C, 0xFA, 0x2D, 0xF8, 0xAE, 0xF8, 0xAC, 0xF1, 0x19, 0xF8, 0xFF, 0x67, 0x0E, 0xFA, + 0x00, 0x64, 0x3E, 0xFA, 0x3F, 0xFA, 0x29, 0x44, 0x07, 0xFA, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, + 0x8E, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xC1, 0xFE, 0x37, 0x00, 0x80, 0x67, 0xB4, 0x83, 0x2A, 0xF2, 0x09, 0x60, 0x08, 0x65, 0x0C, 0xB0, + 0x09, 0xF0, 0x0D, 0x02, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0x8E, 0x64, 0xA2, 0xDB, 0x66, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x9D, 0x18, 0x64, 0x46, 0x3E, 0xF2, + 0xA2, 0xFF, 0x01, 0xB0, 0x1B, 0x60, 0xA0, 0x61, 0x02, 0x02, 0x1B, 0x60, 0x88, 0x61, 0x02, 0xF2, + 0x0E, 0xF0, 0xD4, 0x80, 0x09, 0xF4, 0x06, 0x02, 0x90, 0xF3, 0x64, 0x40, 0xF0, 0x37, 0x02, 0x00, + 0xDC, 0x84, 0x90, 0xFB, 0x66, 0x44, 0x00, 0xA8, 0xFF, 0xFF, 0xF1, 0x02, 0x1B, 0x60, 0xDA, 0x62, + 0x61, 0x44, 0xA2, 0xDB, 0x5A, 0xDD, 0x08, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, + 0xA3, 0xFF, 0xA9, 0x46, 0x02, 0xF0, 0xA9, 0x46, 0x0F, 0x60, 0xFF, 0x61, 0xA1, 0x84, 0x60, 0x41, + 0xE9, 0x81, 0xE9, 0x81, 0xE9, 0x81, 0xE1, 0x82, 0x07, 0xB4, 0x01, 0x61, 0x03, 0x03, 0xCC, 0x84, + 0xE1, 0x81, 0xFD, 0x02, 0x16, 0x60, 0x62, 0x65, 0x46, 0xD3, 0x9D, 0x85, 0xA4, 0x84, 0xA2, 0xDB, + 0x26, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x46, 0x45, 0x3F, 0xF2, 0x05, 0x48, 0x00, 0xA8, 0x60, 0x41, + 0x66, 0x44, 0x0B, 0x03, 0x0E, 0xA1, 0x00, 0xF2, 0x42, 0xFE, 0xAC, 0x86, 0x01, 0xF2, 0x1F, 0x03, + 0x7F, 0xB5, 0xD5, 0x81, 0x66, 0x44, 0xF7, 0x07, 0x25, 0x46, 0x05, 0xF0, 0x06, 0xFA, 0x05, 0xFA, + 0xD0, 0x80, 0x64, 0x43, 0x13, 0x03, 0x60, 0x46, 0x01, 0xF0, 0x80, 0x67, 0xB0, 0x84, 0x01, 0xFA, + 0x00, 0xF0, 0x00, 0x64, 0x00, 0xFA, 0x44, 0x45, 0xA2, 0xFF, 0xB4, 0x60, 0x58, 0x4E, 0x48, 0x78, + 0xFF, 0xFF, 0xA3, 0xFF, 0x08, 0x45, 0x25, 0x46, 0x01, 0x64, 0x02, 0xFA, 0x02, 0xFE, 0x2D, 0x58, + 0xFF, 0xFF, 0x23, 0xF2, 0x07, 0xF0, 0x10, 0xB0, 0x10, 0xAC, 0x3B, 0x03, 0x23, 0xFA, 0x80, 0x67, + 0xB0, 0x81, 0x1B, 0x60, 0xDA, 0x62, 0x61, 0x44, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x04, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x46, 0x45, 0x64, 0x46, 0x02, 0xF0, 0x0F, 0x60, 0xFF, 0x61, + 0xA1, 0x84, 0x60, 0x41, 0xE9, 0x81, 0xE9, 0x81, 0xE9, 0x81, 0xE1, 0x82, 0x07, 0xB4, 0x01, 0x61, + 0x03, 0x03, 0xCC, 0x84, 0xE1, 0x81, 0xFD, 0x02, 0x16, 0x60, 0x62, 0x65, 0x46, 0xD1, 0xFF, 0xFF, + 0xB1, 0x84, 0xA2, 0xDB, 0x9B, 0xF2, 0x25, 0x46, 0xE1, 0x81, 0x5B, 0xF1, 0x73, 0xF1, 0xC1, 0x81, + 0xC1, 0x81, 0x92, 0xFA, 0xA2, 0xFF, 0x02, 0xF0, 0x09, 0x60, 0x08, 0x61, 0xD1, 0x80, 0x0E, 0xF2, + 0x05, 0x02, 0x90, 0xF3, 0x20, 0xB0, 0xCC, 0x84, 0x01, 0x02, 0x90, 0xFB, 0xA3, 0xFF, 0x48, 0xFE, + 0x07, 0x00, 0x0E, 0xF2, 0x08, 0xFE, 0xF0, 0x7F, 0x60, 0x40, 0x20, 0x2A, 0x00, 0x7F, 0x0E, 0xFA, + 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x60, 0xA0, 0x61, 0xB3, 0x60, 0x58, 0x4D, 0x77, 0x78, 0xFF, 0xFF, + 0x66, 0x44, 0x57, 0xFB, 0x04, 0x64, 0x03, 0xFA, 0x80, 0x64, 0x2A, 0xFA, 0xAC, 0xF1, 0x19, 0xF8, + 0x00, 0x64, 0x3E, 0xFA, 0x00, 0x60, 0x80, 0x64, 0x0E, 0xFA, 0x88, 0xF1, 0x07, 0xF8, 0x67, 0x44, + 0x2C, 0xFA, 0x2D, 0xFA, 0x2E, 0xFA, 0x0F, 0x60, 0xF6, 0x62, 0xE1, 0x60, 0x9E, 0x64, 0xA2, 0xDB, + 0x10, 0x60, 0x02, 0x62, 0xE0, 0x60, 0x0D, 0x64, 0xA2, 0xDB, 0x16, 0x60, 0xB2, 0x63, 0x65, 0x44, + 0xBD, 0xDB, 0x10, 0x60, 0x04, 0x64, 0xBD, 0xDB, 0x02, 0x64, 0xBD, 0xDB, 0x06, 0x64, 0xA3, 0xDB, + 0xE6, 0x60, 0x5A, 0x78, 0xFF, 0xFF, 0xE6, 0x60, 0x58, 0x4D, 0x66, 0x78, 0xFF, 0xFF, 0x57, 0xF5, + 0xCB, 0xF1, 0x2F, 0xF8, 0xCC, 0xF1, 0x30, 0xF8, 0xCD, 0xF1, 0x31, 0xF8, 0x67, 0xF1, 0x32, 0xF8, + 0x68, 0xF1, 0x33, 0xF8, 0x69, 0xF1, 0x34, 0xF8, 0x1F, 0x60, 0x92, 0x62, 0xA2, 0xD1, 0x01, 0x64, + 0x64, 0x40, 0xFE, 0x26, 0x10, 0xBC, 0x32, 0x40, 0x10, 0x26, 0x10, 0xBC, 0x23, 0x60, 0x4C, 0x62, + 0xA2, 0xDB, 0x1F, 0x60, 0x90, 0x62, 0xA2, 0xD1, 0x1F, 0x60, 0x1E, 0x64, 0x02, 0x18, 0x1F, 0x60, + 0x40, 0x64, 0x22, 0x60, 0xA2, 0x62, 0xA2, 0xDB, 0x22, 0x60, 0xBE, 0x62, 0xA2, 0xDB, 0x21, 0x60, + 0xC6, 0x61, 0x20, 0x60, 0x32, 0x62, 0xA2, 0xD3, 0x22, 0x60, 0x82, 0x65, 0xFE, 0xA4, 0xE0, 0x84, + 0x02, 0x05, 0x67, 0x44, 0x99, 0x00, 0xE0, 0x84, 0xC4, 0x85, 0x21, 0x60, 0xEC, 0x62, 0xA2, 0xD3, + 0xA5, 0xD1, 0xDA, 0x85, 0x21, 0x60, 0xE4, 0x62, 0xA0, 0x83, 0xA2, 0xDD, 0xA5, 0xD1, 0x21, 0x60, + 0xE2, 0x62, 0xA0, 0x83, 0xA2, 0xDD, 0x21, 0x60, 0xC0, 0x61, 0xDD, 0x60, 0x06, 0x64, 0xA1, 0xDB, + 0x06, 0xA1, 0x21, 0x60, 0xEA, 0x62, 0xA2, 0xD3, 0x21, 0x60, 0xE2, 0x62, 0x60, 0x40, 0xFD, 0xA0, + 0xA2, 0xD3, 0x74, 0x03, 0x50, 0x60, 0x00, 0x7C, 0x60, 0x40, 0x02, 0x2A, 0x03, 0x00, 0x01, 0x60, + 0xF2, 0x63, 0x0E, 0x00, 0x04, 0x2A, 0x03, 0x00, 0x02, 0x60, 0xF2, 0x63, 0x09, 0x00, 0x10, 0x2A, + 0x03, 0x00, 0x04, 0x60, 0xF2, 0x63, 0x04, 0x00, 0x20, 0x2A, 0x04, 0x00, 0x05, 0x60, 0xF2, 0x63, + 0x59, 0xD9, 0x59, 0xDD, 0x21, 0x60, 0xEA, 0x62, 0xA2, 0xD3, 0x21, 0x60, 0xE4, 0x62, 0xFE, 0xA0, + 0xA2, 0xD3, 0x54, 0x03, 0x00, 0x60, 0x00, 0x63, 0x59, 0xDD, 0x61, 0x45, 0x60, 0x40, 0x01, 0x2A, + 0x04, 0x00, 0x00, 0x60, 0xF2, 0x63, 0x59, 0xD9, 0x59, 0xDD, 0x60, 0x40, 0x02, 0x2A, 0x04, 0x00, + 0x01, 0x60, 0xF2, 0x63, 0x59, 0xD9, 0x59, 0xDD, 0x60, 0x40, 0x04, 0x2A, 0x04, 0x00, 0x02, 0x60, + 0xF2, 0x63, 0x59, 0xD9, 0x59, 0xDD, 0x60, 0x40, 0x10, 0x2A, 0x04, 0x00, 0x04, 0x60, 0xF2, 0x63, + 0x59, 0xD9, 0x59, 0xDD, 0x60, 0x40, 0x20, 0x2A, 0x04, 0x00, 0x05, 0x60, 0xF2, 0x63, 0x59, 0xD9, + 0x59, 0xDD, 0xD5, 0x83, 0xEB, 0x83, 0xEB, 0x83, 0xA5, 0xDD, 0x21, 0x60, 0xEA, 0x62, 0xA2, 0xD3, + 0x21, 0x60, 0xE6, 0x62, 0xFF, 0xA0, 0xA2, 0xD3, 0x21, 0x03, 0x00, 0x60, 0x00, 0x63, 0x59, 0xDD, + 0x61, 0x45, 0x60, 0x40, 0x01, 0x2A, 0x04, 0x00, 0x00, 0x60, 0xF2, 0x63, 0x59, 0xD9, 0x59, 0xDD, + 0x60, 0x40, 0x02, 0x2A, 0x04, 0x00, 0x01, 0x60, 0xF2, 0x63, 0x59, 0xD9, 0x59, 0xDD, 0x60, 0x40, + 0x04, 0x2A, 0x04, 0x00, 0x02, 0x60, 0xF2, 0x63, 0x59, 0xD9, 0x59, 0xDD, 0xD5, 0x83, 0xEB, 0x83, + 0xEB, 0x83, 0xA5, 0xDD, 0x21, 0x60, 0xE8, 0x62, 0xA2, 0xD1, 0x59, 0xD9, 0x21, 0x60, 0xC0, 0x65, + 0xD5, 0x84, 0xDD, 0x7F, 0xA5, 0xDB, 0x65, 0x44, 0x22, 0x60, 0xAC, 0x62, 0xA2, 0xDB, 0x22, 0x60, + 0xC8, 0x62, 0xA2, 0xDB, 0x57, 0xF5, 0xCB, 0xF3, 0xCC, 0xF1, 0x00, 0x63, 0xC0, 0x87, 0xCD, 0xF1, + 0x5A, 0xFD, 0xC0, 0x85, 0x65, 0x47, 0xC4, 0x84, 0x07, 0xB5, 0x1C, 0x60, 0x10, 0x62, 0x16, 0x60, + 0xAE, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x0F, 0x60, 0xD0, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x0F, 0x60, 0xD2, 0x62, 0x00, 0x60, 0x02, 0x64, 0xA2, 0xDB, 0xE0, 0x60, + 0x17, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, + 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, + 0xD0, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x57, 0xF5, 0x00, 0x64, 0x95, 0xFB, 0x96, 0xFB, 0x97, 0xFB, + 0x75, 0xFB, 0x66, 0xF3, 0x00, 0x75, 0x00, 0x72, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x93, 0xC7, 0xF3, + 0xED, 0xE2, 0xCC, 0x84, 0x5A, 0xFB, 0x0F, 0x60, 0xD2, 0x62, 0x00, 0x60, 0x04, 0x64, 0xA2, 0xDB, + 0xE0, 0x60, 0x36, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD0, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x65, 0xF1, 0x23, 0x60, 0x02, 0x62, 0xA2, 0xD9, 0x22, 0x60, 0xAA, 0x65, + 0xE2, 0x60, 0x58, 0x4D, 0x2F, 0x78, 0xFF, 0xFF, 0xE1, 0x60, 0x58, 0x4D, 0xA8, 0x78, 0xFF, 0xFF, + 0xE2, 0x60, 0x58, 0x4D, 0x49, 0x78, 0xFF, 0xFF, 0x57, 0xF5, 0x00, 0xF4, 0x66, 0xF1, 0x06, 0xF8, + 0x23, 0x60, 0x4C, 0x62, 0xA2, 0xD3, 0x07, 0xFA, 0x22, 0x60, 0xA2, 0x64, 0x40, 0x48, 0x10, 0x61, + 0x00, 0x60, 0x00, 0x64, 0xE1, 0x60, 0x58, 0x4D, 0xE5, 0x78, 0xFF, 0xFF, 0x57, 0xF5, 0x3F, 0xFC, + 0x5A, 0xF3, 0xC7, 0xF1, 0xAC, 0x83, 0x01, 0x64, 0x02, 0x02, 0x6C, 0xFB, 0x64, 0x43, 0x1B, 0x60, + 0xDA, 0x62, 0x1B, 0x60, 0x8E, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x04, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0xCF, 0x83, 0x73, 0xF3, 0x5A, 0xFD, 0xDC, 0x84, 0x73, 0xFB, + 0x5C, 0xF3, 0xFF, 0xFF, 0xCC, 0x84, 0x5C, 0xFB, 0x03, 0x03, 0xE1, 0x60, 0x0A, 0x78, 0xFF, 0xFF, + 0x0A, 0x64, 0x5C, 0xFB, 0xA2, 0x4C, 0x20, 0x27, 0xF8, 0x01, 0x46, 0x60, 0x50, 0x65, 0x72, 0x44, + 0xD4, 0x80, 0xFF, 0xFF, 0xF2, 0x04, 0x5D, 0xFB, 0x40, 0x48, 0x95, 0xF3, 0x5E, 0xFB, 0x40, 0x4A, + 0x96, 0xF3, 0x97, 0xF3, 0x40, 0x4C, 0x60, 0x41, 0x66, 0xF1, 0x40, 0x63, 0xAD, 0x80, 0xF0, 0xA3, + 0x09, 0x02, 0x3C, 0x03, 0x2C, 0x41, 0x2A, 0x44, 0x40, 0x4C, 0x28, 0x44, 0x40, 0x4A, 0x00, 0x64, + 0x40, 0x48, 0xF4, 0x01, 0xD1, 0x80, 0x01, 0x02, 0x31, 0x04, 0x10, 0xA3, 0x80, 0x60, 0x00, 0x65, + 0xA5, 0x80, 0xCF, 0x83, 0x08, 0x02, 0x28, 0x44, 0x60, 0x88, 0x2A, 0x44, 0x70, 0x8A, 0x2C, 0x44, + 0x70, 0x8C, 0xF1, 0x81, 0xF5, 0x01, 0xE7, 0xA3, 0x64, 0x44, 0x00, 0xA0, 0x00, 0x62, 0x02, 0x02, + 0x00, 0x61, 0x1C, 0x00, 0xE0, 0x84, 0xDE, 0x82, 0xFD, 0x04, 0x42, 0xFE, 0xF8, 0x84, 0x62, 0x45, + 0xC7, 0x83, 0x60, 0x45, 0x02, 0xFE, 0xD5, 0x84, 0x02, 0x05, 0x01, 0x05, 0x61, 0x44, 0xCF, 0x83, + 0x60, 0x41, 0x08, 0x03, 0x28, 0x44, 0x60, 0x88, 0x2A, 0x44, 0x70, 0x8A, 0x2C, 0x44, 0x70, 0x8C, + 0xF1, 0x81, 0xF1, 0x01, 0xCE, 0x82, 0xE9, 0x81, 0xFD, 0x02, 0xF1, 0x81, 0x61, 0x44, 0x00, 0xA8, + 0xFF, 0xFF, 0x30, 0x03, 0x73, 0x40, 0x5D, 0xF3, 0xFF, 0xFF, 0x60, 0x47, 0xE8, 0x84, 0xE8, 0x84, + 0x5E, 0xF3, 0x3F, 0xB5, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, + 0xB4, 0x84, 0x61, 0x45, 0xD4, 0x84, 0xC0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x81, + 0x64, 0x44, 0x73, 0x45, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x85, 0x61, 0x44, 0xD4, 0x80, + 0xFF, 0xFF, 0x10, 0x03, 0x60, 0x53, 0xD4, 0x84, 0xFF, 0xFF, 0x75, 0xF3, 0xFF, 0xFF, 0xDC, 0x84, + 0x01, 0xB4, 0x75, 0xFB, 0x1F, 0x60, 0x14, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xFF, 0xFF, + 0x08, 0x28, 0xA2, 0xDB, 0xE6, 0x60, 0xA3, 0x78, 0xFF, 0xFF, 0xC1, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x04, 0x64, 0x03, 0xFA, 0x00, 0xF4, 0x09, 0xF2, 0xFF, 0xFF, 0x60, 0x47, 0x00, 0x3A, 0x1C, 0x00, + 0x60, 0x43, 0x00, 0x36, 0x1C, 0x00, 0xE0, 0xA0, 0xDA, 0x85, 0x16, 0x07, 0x1F, 0x60, 0x1E, 0x61, + 0xA1, 0xD1, 0xFF, 0xFF, 0xD3, 0x80, 0xCB, 0x83, 0x0F, 0x02, 0x07, 0x0E, 0x59, 0xD3, 0xA5, 0xD0, + 0xDA, 0x85, 0xD0, 0x80, 0xFF, 0xFF, 0x08, 0x02, 0xF9, 0x1F, 0x13, 0x1E, 0xA5, 0xD0, 0x59, 0xD3, + 0xFF, 0xFF, 0x90, 0x80, 0xFF, 0x22, 0x0D, 0x00, 0xE1, 0x60, 0x9C, 0x78, 0xFF, 0xFF, 0x1F, 0x60, + 0x90, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, 0x03, 0x00, 0x1F, 0x60, 0x40, 0x64, + 0x02, 0x00, 0x1F, 0x60, 0x1E, 0x64, 0x22, 0x60, 0xBE, 0x62, 0xA2, 0xDB, 0x26, 0x46, 0x2F, 0xF2, + 0x2C, 0xFA, 0x30, 0xF2, 0x2D, 0xFA, 0x31, 0xF2, 0x2E, 0xFA, 0xCB, 0xF1, 0x2F, 0xF8, 0xCC, 0xF1, + 0x30, 0xF8, 0xCD, 0xF1, 0x31, 0xF8, 0x67, 0xF1, 0x32, 0xF8, 0x68, 0xF1, 0x33, 0xF8, 0x69, 0xF1, + 0x34, 0xF8, 0x50, 0x63, 0x2A, 0xFC, 0xAC, 0xF3, 0x19, 0xFA, 0x00, 0x64, 0x3E, 0xFA, 0x88, 0xF3, + 0x07, 0xFA, 0x00, 0xF4, 0x66, 0xF1, 0x06, 0xF8, 0x23, 0x60, 0x4C, 0x62, 0xA2, 0xD3, 0x07, 0xFA, + 0x22, 0x60, 0xC6, 0x65, 0xE2, 0x60, 0x58, 0x4D, 0x2F, 0x78, 0xFF, 0xFF, 0x22, 0x60, 0xBE, 0x64, + 0x40, 0x48, 0x10, 0x61, 0x00, 0x60, 0x00, 0x64, 0xE1, 0x60, 0x58, 0x4D, 0xE5, 0x78, 0xFF, 0xFF, + 0x26, 0x46, 0x3F, 0xFC, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0x8E, 0x64, 0xA2, 0xDB, 0x26, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x20, 0x44, 0x80, 0x26, + 0x11, 0x00, 0x80, 0xBC, 0x40, 0x40, 0x00, 0x64, 0x95, 0xFB, 0x96, 0xFB, 0x97, 0xFB, 0x75, 0xFB, + 0x66, 0xF3, 0x00, 0x75, 0x00, 0x72, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x93, 0xC7, 0xF3, 0xED, 0xE2, + 0xCC, 0x84, 0x5A, 0xFB, 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD0, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x5A, 0xDB, 0x00, 0x64, 0x73, 0xFB, 0x75, 0xFB, 0x2F, 0x58, 0xFF, 0xFF, + 0x3E, 0x63, 0x16, 0x60, 0x60, 0x61, 0x59, 0xD1, 0x61, 0x46, 0x08, 0x1B, 0xFC, 0x1F, 0x22, 0x60, + 0xDE, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x01, 0x65, 0x00, 0x61, 0x17, 0x00, 0x16, 0x60, 0xA2, 0x61, + 0x49, 0xD1, 0xCB, 0x83, 0xFD, 0x18, 0x63, 0x41, 0x04, 0xA1, 0x61, 0x45, 0x66, 0x43, 0x22, 0x60, + 0xDE, 0x64, 0xDC, 0x84, 0x60, 0xFE, 0xA3, 0xD1, 0xDF, 0x83, 0xA0, 0xD9, 0xCD, 0x81, 0x20, 0xFE, + 0xF8, 0x02, 0x66, 0x44, 0x16, 0x60, 0x62, 0x7C, 0xD0, 0x81, 0x5A, 0xF3, 0xC7, 0xF1, 0x22, 0x60, + 0xDC, 0x63, 0x00, 0xA0, 0x64, 0x5F, 0xBD, 0xDB, 0x1B, 0x60, 0x94, 0x66, 0xA6, 0xD1, 0x02, 0x02, + 0x01, 0x18, 0x01, 0xB9, 0x61, 0x44, 0x60, 0xFE, 0xA3, 0xDB, 0xFC, 0xA3, 0x65, 0x44, 0x03, 0xA4, + 0xA3, 0xDB, 0xFF, 0xFF, 0x20, 0xFE, 0x2D, 0x58, 0xFF, 0xFF, 0x23, 0x60, 0x4E, 0x62, 0xA2, 0xDB, + 0xCD, 0x81, 0x28, 0xD3, 0x5A, 0x88, 0xDC, 0x83, 0x39, 0x18, 0xFB, 0x03, 0x61, 0x40, 0x7F, 0x3A, + 0x07, 0x00, 0x23, 0x60, 0x4E, 0x62, 0xA2, 0xD3, 0x03, 0x61, 0x7C, 0xA4, 0xA2, 0xDB, 0x00, 0xF4, + 0x60, 0xFE, 0xA3, 0xD1, 0xDD, 0x81, 0xA1, 0xD8, 0x61, 0x40, 0x7F, 0x3A, 0x09, 0x00, 0x20, 0xFE, + 0x23, 0x60, 0x4E, 0x62, 0xA2, 0xD3, 0x03, 0x61, 0x7C, 0xA4, 0xA2, 0xDB, 0x00, 0xF4, 0x60, 0xFE, + 0xCF, 0x83, 0xA3, 0xD3, 0xDD, 0x81, 0xA1, 0xDA, 0xFF, 0xB4, 0x00, 0x7F, 0x15, 0x03, 0xDB, 0x83, + 0x61, 0x40, 0x7F, 0x3A, 0x0B, 0x00, 0x20, 0xFE, 0x60, 0x45, 0x23, 0x60, 0x4E, 0x62, 0xA2, 0xD3, + 0x03, 0x61, 0x7C, 0xA4, 0xA2, 0xDB, 0x65, 0x44, 0x00, 0xF4, 0x60, 0xFE, 0xA3, 0xD1, 0xDF, 0x83, + 0xDD, 0x81, 0xCC, 0x84, 0xA1, 0xD8, 0xEC, 0x02, 0x20, 0xFE, 0xC3, 0x01, 0x23, 0x60, 0x4E, 0x62, + 0xA2, 0xD1, 0xFD, 0xA1, 0xFF, 0xB1, 0xC1, 0x83, 0xA2, 0xDD, 0x2D, 0x58, 0xFF, 0xFF, 0x67, 0x5C, + 0x11, 0x60, 0xF0, 0x61, 0xA1, 0xD3, 0xA5, 0xD9, 0x12, 0x18, 0x60, 0x43, 0x23, 0x60, 0x04, 0x64, + 0xA5, 0xDB, 0x60, 0xFE, 0xA0, 0xDD, 0xFF, 0xFF, 0x20, 0xFE, 0xDC, 0x84, 0xCF, 0x83, 0xE3, 0x83, + 0x59, 0xD1, 0xDC, 0x84, 0x60, 0xFE, 0xA0, 0xD9, 0xFF, 0xFF, 0x20, 0xFE, 0xF9, 0x1F, 0x2D, 0x58, + 0xFF, 0xFF, 0x20, 0x40, 0x20, 0x2A, 0x0D, 0x00, 0x12, 0x60, 0xB8, 0x62, 0xA2, 0xD1, 0x50, 0xF3, + 0x23, 0x60, 0x39, 0x63, 0x60, 0xFE, 0xA3, 0xD9, 0xDF, 0x83, 0x60, 0x47, 0xA3, 0xDB, 0xFF, 0xFF, + 0x20, 0xFE, 0x2D, 0x58, 0xFF, 0xFF, 0x0E, 0x57, 0x32, 0x40, 0x40, 0x26, 0x25, 0x00, 0x45, 0x48, + 0x00, 0x60, 0x10, 0x61, 0xB3, 0x60, 0x58, 0x4D, 0x77, 0x78, 0xFF, 0xFF, 0x1D, 0x03, 0xF2, 0x60, + 0x02, 0x64, 0x24, 0xFA, 0x00, 0x60, 0x48, 0x61, 0x28, 0x44, 0x59, 0xDA, 0x03, 0x64, 0x38, 0x43, + 0xBD, 0xD1, 0xCC, 0x84, 0x59, 0xD8, 0xFC, 0x02, 0x39, 0x44, 0x59, 0xDA, 0x06, 0x64, 0x23, 0xFA, + 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0xCA, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xFA, 0xFE, 0x37, 0x58, 0xFF, 0xFF, 0x0E, 0x57, 0x32, 0x40, + 0x40, 0x26, 0x51, 0x00, 0x45, 0x48, 0x00, 0x60, 0x68, 0x61, 0xB3, 0x60, 0x58, 0x4D, 0x77, 0x78, + 0xFF, 0xFF, 0x49, 0x03, 0xF2, 0x60, 0x01, 0x64, 0x24, 0xFA, 0x02, 0x60, 0x00, 0x61, 0x46, 0x4A, + 0x38, 0x44, 0x54, 0x94, 0x03, 0x64, 0x01, 0x02, 0x09, 0x00, 0x06, 0x63, 0x4A, 0x61, 0x38, 0x46, + 0xBD, 0xD0, 0xCC, 0x84, 0x2A, 0x46, 0x59, 0xD8, 0xFA, 0x02, 0x06, 0x00, 0xDA, 0x81, 0x38, 0x43, + 0xBD, 0xD1, 0xCC, 0x84, 0x59, 0xD8, 0xFC, 0x02, 0x05, 0x63, 0x28, 0x44, 0x02, 0xA8, 0x25, 0xFA, + 0x07, 0x02, 0x03, 0x64, 0x39, 0x43, 0xBD, 0xD1, 0xCC, 0x84, 0x59, 0xD8, 0xFC, 0x02, 0x08, 0x63, + 0x22, 0x60, 0x28, 0x7C, 0x28, 0x44, 0x03, 0xA8, 0xA4, 0xD3, 0x0F, 0x03, 0xE8, 0x85, 0xC7, 0x85, + 0x60, 0x43, 0xFE, 0xA3, 0x22, 0x60, 0x2A, 0x64, 0x58, 0xD1, 0xD9, 0x81, 0xA1, 0xD8, 0x7E, 0x2A, + 0x02, 0x00, 0x00, 0xF4, 0x02, 0x61, 0xF8, 0x1F, 0x65, 0x43, 0x2A, 0x46, 0x23, 0xFC, 0x1B, 0x60, + 0xDA, 0x62, 0x1B, 0x60, 0xCA, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0xFA, 0xFE, 0x37, 0x58, 0xFF, 0xFF, 0x0E, 0x57, 0x32, 0x40, 0x40, 0x26, + 0x1C, 0x00, 0x45, 0x48, 0x00, 0x60, 0x06, 0x61, 0xB3, 0x60, 0x58, 0x4D, 0x77, 0x78, 0xFF, 0xFF, + 0x14, 0x03, 0x02, 0x64, 0x23, 0xFA, 0xF2, 0x60, 0x00, 0x64, 0x5A, 0xDA, 0x28, 0x44, 0x5A, 0xDA, + 0xFF, 0xFF, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0xCA, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xFA, 0xFE, 0x37, 0x58, 0xFF, 0xFF, 0xA2, 0xFF, + 0x32, 0x40, 0x40, 0x26, 0x3E, 0x00, 0x7C, 0xF3, 0x67, 0x43, 0xDC, 0x84, 0xCC, 0x84, 0x39, 0x03, + 0x60, 0x46, 0x0A, 0x02, 0x7C, 0xFD, 0x00, 0x60, 0x46, 0x61, 0xB3, 0x60, 0x58, 0x4D, 0x77, 0x78, + 0xFF, 0xFF, 0x66, 0x44, 0x7C, 0xFB, 0x2E, 0x03, 0x46, 0x4B, 0x1E, 0x60, 0xD8, 0x61, 0x18, 0x64, + 0x23, 0xFA, 0xF1, 0x60, 0x00, 0x64, 0x24, 0xFA, 0x4A, 0x65, 0xA2, 0xFF, 0x2C, 0x63, 0x00, 0x64, + 0x59, 0xD1, 0xA2, 0xDB, 0xA5, 0xD8, 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, + 0xF7, 0x1F, 0x12, 0x63, 0x59, 0xD1, 0xA5, 0xD8, 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, + 0x04, 0x65, 0xF8, 0x1F, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0xCA, 0x64, 0xA2, 0xDB, 0x2B, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xFA, 0xFE, 0xA6, 0xFE, 0x00, 0x64, + 0x7C, 0xFB, 0xA3, 0xFF, 0xC7, 0x60, 0x2E, 0x78, 0xFF, 0xFF, 0xA6, 0xFE, 0xB8, 0x05, 0xA7, 0xFE, + 0x0A, 0x05, 0xA5, 0xFE, 0x03, 0x04, 0xE3, 0x60, 0xD3, 0x78, 0xFF, 0xFF, 0xA4, 0xFE, 0xF2, 0x04, + 0xE4, 0x60, 0x69, 0x78, 0xFF, 0xFF, 0x36, 0x45, 0x17, 0x60, 0x52, 0x64, 0x44, 0xD7, 0xFF, 0xFF, + 0xFF, 0xFF, 0x28, 0xF3, 0x7E, 0xF1, 0x60, 0x47, 0x07, 0xB4, 0x4E, 0xFB, 0x01, 0x61, 0x03, 0x03, + 0xCC, 0x84, 0xE1, 0x81, 0xFD, 0x02, 0x9D, 0x84, 0xA1, 0x80, 0xA0, 0x83, 0x1A, 0x03, 0x7E, 0xFD, + 0x0F, 0x60, 0xF4, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x7E, 0xF1, 0x31, 0x44, 0x64, 0x40, 0xFF, 0x26, 0x09, 0x00, 0xFE, 0xB4, 0x40, 0x51, 0x01, 0x7C, + 0xBC, 0xF9, 0x49, 0xF3, 0x01, 0x63, 0x60, 0x40, 0xFF, 0x26, 0x49, 0xFD, 0xC7, 0x60, 0x2E, 0x78, + 0xFF, 0xFF, 0xE3, 0x60, 0xD3, 0x78, 0xFF, 0xFF, 0x1F, 0x60, 0xB6, 0x63, 0xBD, 0xD3, 0xBD, 0xD1, + 0xBD, 0xD1, 0xB0, 0x84, 0xB0, 0x84, 0xFF, 0xFF, 0x07, 0x02, 0x6B, 0xFB, 0x31, 0x44, 0xFE, 0xB4, + 0x40, 0x51, 0x0D, 0x64, 0x05, 0xFB, 0x3F, 0x00, 0x28, 0xF3, 0x7E, 0xF1, 0x60, 0x47, 0x64, 0x41, + 0x07, 0xB1, 0x07, 0xB4, 0x08, 0x24, 0x67, 0x4C, 0x4E, 0xFB, 0x01, 0x61, 0x03, 0x03, 0xCC, 0x84, + 0xE1, 0x81, 0xFD, 0x02, 0xA1, 0x80, 0xB1, 0x83, 0x2E, 0x02, 0x7E, 0xFD, 0x1F, 0x60, 0xAA, 0x62, + 0xA2, 0xD3, 0xC5, 0xFB, 0x65, 0xFB, 0x7E, 0xF3, 0xFF, 0xFF, 0xCC, 0x85, 0xA4, 0x80, 0x7E, 0xFB, + 0x17, 0x02, 0x1B, 0x60, 0xC4, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x46, 0x5E, + 0x31, 0x44, 0x01, 0xBC, 0x40, 0x51, 0xED, 0xE2, 0x0F, 0x4E, 0xCE, 0x60, 0x58, 0x4F, 0x07, 0x78, + 0xFF, 0xFF, 0x0E, 0x4F, 0x01, 0x65, 0xE2, 0x60, 0x58, 0x4E, 0xDD, 0x78, 0xFF, 0xFF, 0x08, 0x00, + 0x0F, 0x60, 0xD6, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x10, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0xE5, 0x60, 0x16, 0x78, 0xFF, 0xFF, 0xD7, 0xFE, 0xC7, 0x60, 0x2E, 0x78, 0xFF, 0xFF, 0x2E, 0xF5, + 0x27, 0xF2, 0x12, 0x60, 0xCE, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, + 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x27, 0xF0, 0x63, 0x46, 0xD0, 0x80, + 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x26, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, + 0x61, 0x46, 0x25, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, + 0x63, 0x46, 0xE8, 0x1B, 0x88, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x28, 0x02, 0x14, 0x60, + 0xD0, 0x62, 0xA2, 0xD3, 0xDA, 0x81, 0x60, 0x45, 0xD5, 0x80, 0xA1, 0xD1, 0x04, 0x03, 0xD3, 0x80, + 0xD9, 0x81, 0xFA, 0x02, 0x09, 0x00, 0xA1, 0xDD, 0x14, 0x60, 0xD0, 0x62, 0xD9, 0x84, 0xA2, 0xDB, + 0x4A, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xA2, 0xDB, 0x66, 0x45, 0x63, 0x46, 0x06, 0xF2, 0xFF, 0x60, + 0x01, 0x7C, 0xA0, 0x9C, 0x06, 0xF8, 0x65, 0x46, 0x71, 0xF3, 0x60, 0x40, 0x10, 0x2A, 0x03, 0x00, + 0xCC, 0x84, 0x80, 0x2B, 0x71, 0xFB, 0xE4, 0x60, 0x58, 0x4E, 0x9D, 0x78, 0xFF, 0xFF, 0xAB, 0x01, + 0x2E, 0xF5, 0x25, 0x60, 0x28, 0x61, 0x28, 0xF0, 0xFF, 0xFF, 0xA1, 0xD9, 0x27, 0xF2, 0x12, 0x60, + 0xCE, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, + 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x27, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, + 0x61, 0x46, 0x26, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x25, 0xF0, + 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, + 0x88, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x13, 0x02, 0x63, 0x46, 0x06, 0xF2, 0xFF, 0xFF, + 0x02, 0xB0, 0x08, 0xBC, 0x0D, 0x03, 0x06, 0xFA, 0xE4, 0x60, 0x58, 0x4E, 0x9D, 0x78, 0xFF, 0xFF, + 0x0F, 0x60, 0xE8, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x6A, 0x01, 0x7E, 0xF1, 0xFF, 0xFF, 0x64, 0x41, 0x07, 0xB1, 0xFF, 0xFF, 0x08, 0x24, 0x67, 0x4C, + 0x1B, 0x60, 0xC4, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x46, 0x5E, 0x1F, 0x60, + 0xAA, 0x62, 0xA2, 0xD3, 0xC5, 0xFB, 0x65, 0xFB, 0x1F, 0x60, 0xB6, 0x63, 0xBD, 0xD1, 0xCB, 0xF9, + 0x67, 0xF9, 0xBD, 0xD1, 0xCC, 0xF9, 0x68, 0xF9, 0xA3, 0xD1, 0xCD, 0xF9, 0x69, 0xF9, 0x01, 0x64, + 0x6B, 0xFB, 0x31, 0x44, 0x21, 0xBC, 0x40, 0x51, 0x20, 0x44, 0x01, 0x65, 0x34, 0x80, 0x01, 0x64, + 0x51, 0xFB, 0x21, 0x60, 0x50, 0x64, 0x52, 0xFB, 0x0F, 0x4E, 0xE8, 0x60, 0x58, 0x4F, 0x02, 0x78, + 0xFF, 0xFF, 0x0E, 0x4F, 0xC7, 0x60, 0x2E, 0x78, 0xFF, 0xFF, 0x0E, 0x57, 0x63, 0x46, 0x43, 0x47, + 0x1E, 0xF2, 0x72, 0xF2, 0x02, 0x1B, 0x01, 0x1B, 0x0C, 0x00, 0x60, 0x46, 0x1B, 0x60, 0xDA, 0x64, + 0x40, 0x4B, 0xF0, 0x60, 0x58, 0x4D, 0x75, 0x78, 0xFF, 0xFF, 0x27, 0x46, 0x72, 0xF2, 0xFF, 0xFF, + 0xF4, 0x1B, 0x37, 0x58, 0xFF, 0xFF, 0x1B, 0x60, 0xAC, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, + 0x60, 0x46, 0x0E, 0xF2, 0x5B, 0x03, 0x60, 0x40, 0xF0, 0x37, 0x48, 0x00, 0xFF, 0x37, 0x3D, 0x00, + 0xFD, 0x37, 0x35, 0x00, 0x18, 0x37, 0x29, 0x00, 0xFE, 0x37, 0x2C, 0x00, 0xF8, 0x37, 0x0A, 0x00, + 0x60, 0x47, 0xFF, 0xB5, 0x0F, 0x60, 0xD0, 0x62, 0x46, 0xD1, 0x00, 0x60, 0x01, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x1B, 0x60, 0xDA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xD6, 0x01, 0x06, 0xB4, 0xFD, 0x7F, 0x0E, 0xFA, + 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0xB2, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xF9, 0xFE, 0xC6, 0x01, 0xDB, 0x60, 0x58, 0x4F, 0xB7, 0x78, + 0xFF, 0xFF, 0x14, 0x00, 0xDE, 0x60, 0x58, 0x4F, 0x99, 0x78, 0xFF, 0xFF, 0xBC, 0x03, 0x23, 0xF0, + 0x60, 0x40, 0x04, 0x26, 0xE2, 0x1B, 0x02, 0x26, 0xE0, 0x18, 0xA2, 0xFF, 0x02, 0xF0, 0x09, 0x60, + 0x08, 0x64, 0xD0, 0x80, 0x90, 0xF3, 0x02, 0x02, 0xCC, 0x84, 0x90, 0xFB, 0x1B, 0x60, 0xDA, 0x64, + 0x40, 0x4B, 0xF0, 0x60, 0x58, 0x4D, 0x75, 0x78, 0xFF, 0xFF, 0xA5, 0x01, 0xAC, 0xFE, 0x09, 0x05, + 0xAD, 0xFE, 0x10, 0x05, 0xAE, 0xFE, 0x9F, 0x05, 0xAF, 0xFE, 0x3A, 0x05, 0xC7, 0x60, 0x2E, 0x78, + 0xFF, 0xFF, 0x0F, 0x60, 0xCE, 0x62, 0xA2, 0xD1, 0x20, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0xF4, 0x01, 0x10, 0x60, 0x02, 0x65, 0x03, 0x61, 0x07, 0x00, 0xA2, 0xDD, 0x58, 0x4F, + 0x64, 0x58, 0xFF, 0xFF, 0x00, 0xB9, 0xFF, 0xFF, 0x08, 0x03, 0x00, 0x63, 0xA5, 0xD1, 0x5A, 0xD3, + 0xDA, 0x85, 0x00, 0xA8, 0xCD, 0x81, 0xF2, 0x02, 0xF8, 0x02, 0xE0, 0x01, 0x0F, 0x60, 0xCC, 0x62, + 0x0F, 0x60, 0xF2, 0x65, 0xE5, 0x60, 0x4E, 0x63, 0x00, 0x64, 0x5A, 0xDB, 0xD6, 0x80, 0xFF, 0xFF, + 0x04, 0x03, 0x5A, 0xDB, 0x5A, 0xDB, 0x5A, 0xDD, 0xF9, 0x01, 0x10, 0x60, 0x00, 0x65, 0x00, 0x64, + 0x5A, 0xDB, 0xD6, 0x80, 0xFF, 0xFF, 0x02, 0x03, 0x5A, 0xDD, 0xFB, 0x01, 0x2F, 0x58, 0xFF, 0xFF, + 0x0F, 0x60, 0xD0, 0x64, 0x40, 0x41, 0x0F, 0x60, 0xCE, 0x63, 0xA3, 0xD1, 0x00, 0x64, 0xD0, 0x80, + 0x06, 0x61, 0x08, 0x03, 0xBD, 0xDB, 0xA3, 0xD3, 0xFF, 0xFF, 0xB0, 0x84, 0xCD, 0x81, 0xA3, 0xDB, + 0x06, 0xA3, 0xF9, 0x02, 0x0F, 0x60, 0xF4, 0x63, 0xA3, 0xD1, 0x00, 0x64, 0xD0, 0x80, 0x07, 0x61, + 0x19, 0x03, 0xBD, 0xDB, 0x64, 0x44, 0xFE, 0xA3, 0x02, 0xA3, 0xCD, 0x81, 0xE8, 0x84, 0xE3, 0x03, + 0x02, 0x05, 0xE1, 0x03, 0xF9, 0x01, 0x78, 0xFB, 0x7A, 0xFD, 0x61, 0x5C, 0xA3, 0xD3, 0x79, 0xF9, + 0x03, 0x18, 0x58, 0x4F, 0x60, 0x58, 0xFF, 0xFF, 0x7A, 0xF3, 0x79, 0xF1, 0x60, 0x43, 0x78, 0xF3, + 0x64, 0x41, 0xEA, 0x01, 0x21, 0x43, 0x0F, 0x60, 0xF4, 0x65, 0xD7, 0x80, 0xBD, 0xD1, 0xBD, 0xD3, + 0x03, 0x02, 0xC7, 0x60, 0x2E, 0x78, 0xFF, 0xFF, 0xA0, 0x84, 0xBD, 0xD1, 0x43, 0x41, 0xF5, 0x03, + 0xE5, 0x60, 0x53, 0x64, 0x64, 0x58, 0x40, 0x4F, 0x2A, 0xF0, 0x83, 0x60, 0xFF, 0x65, 0x64, 0x47, + 0x03, 0x2B, 0x01, 0x00, 0x17, 0x00, 0x03, 0x26, 0x03, 0xAC, 0x60, 0x47, 0xA4, 0x84, 0x2A, 0xFA, + 0x2F, 0xF2, 0x2C, 0xFA, 0x30, 0xF2, 0x2D, 0xFA, 0x31, 0xF2, 0x2E, 0xFA, 0x64, 0x41, 0xCB, 0xF3, + 0x2F, 0xFA, 0x60, 0x43, 0xCC, 0xF3, 0x30, 0xFA, 0xCD, 0xF1, 0x31, 0xF8, 0x32, 0xFC, 0x33, 0xFA, + 0x34, 0xF8, 0x19, 0x00, 0x60, 0x47, 0xA4, 0x84, 0x2A, 0xFA, 0x2F, 0xF2, 0x2C, 0xFA, 0x30, 0xF2, + 0x2D, 0xFA, 0x31, 0xF2, 0x2E, 0xFA, 0x36, 0xF2, 0x32, 0xFA, 0x37, 0xF2, 0x33, 0xFA, 0x38, 0xF2, + 0x34, 0xFA, 0xCB, 0xF3, 0x2F, 0xFA, 0x36, 0xFA, 0xCC, 0xF3, 0x30, 0xFA, 0x37, 0xFA, 0xCD, 0xF3, + 0x31, 0xFA, 0x38, 0xFA, 0x64, 0x41, 0x1C, 0xF2, 0x13, 0xFA, 0x00, 0xF4, 0x0D, 0xF2, 0xFF, 0xFF, + 0x60, 0x40, 0x80, 0x2B, 0x29, 0x00, 0x26, 0x46, 0x04, 0x63, 0x03, 0xFC, 0x00, 0xF4, 0x0D, 0xF2, + 0x06, 0xFA, 0xE6, 0x60, 0x58, 0x4E, 0xF4, 0x78, 0xFF, 0xFF, 0xFF, 0xA0, 0x59, 0xF5, 0x1A, 0x02, + 0x39, 0xF2, 0x26, 0x46, 0x3F, 0xFA, 0x00, 0xF4, 0x00, 0x60, 0x81, 0x67, 0x0D, 0xFA, 0x7C, 0x64, + 0x01, 0xFA, 0x26, 0x46, 0x00, 0x64, 0x3E, 0xFA, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0x9A, 0x64, + 0xA2, 0xDB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC8, 0xFE, + 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x26, 0x46, 0x3F, 0xF0, 0x42, 0x64, 0xD0, 0x80, + 0xFF, 0xFF, 0x01, 0x04, 0x3F, 0xFA, 0x1C, 0xF2, 0x13, 0xFA, 0x26, 0xF2, 0x27, 0xF0, 0x60, 0x47, + 0x00, 0xF4, 0x1F, 0xFA, 0x64, 0x47, 0x20, 0xFA, 0x61, 0x44, 0x21, 0xFA, 0x01, 0x67, 0x0D, 0xFA, + 0x10, 0x61, 0x1F, 0x60, 0x6C, 0x64, 0x1E, 0x63, 0x58, 0xD1, 0xCD, 0x81, 0xBD, 0xD8, 0xFC, 0x02, + 0x9B, 0xF1, 0xB8, 0xF1, 0x64, 0x5E, 0x64, 0x5F, 0x44, 0x63, 0xBD, 0xDA, 0x1F, 0x60, 0x66, 0x62, + 0xA2, 0xD3, 0xFF, 0xFF, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0x09, 0xBC, 0x4A, 0xD3, 0x60, 0x45, + 0x60, 0x40, 0x01, 0x36, 0x03, 0x64, 0x02, 0x36, 0x01, 0x64, 0xB4, 0x84, 0x06, 0xA2, 0xA2, 0xD1, + 0xBD, 0xDA, 0x64, 0x47, 0xBD, 0xDA, 0xB5, 0xF3, 0xB6, 0xF1, 0x60, 0x47, 0xBD, 0xDA, 0x64, 0x47, + 0xC3, 0xF1, 0xBD, 0xDA, 0x64, 0x44, 0xBD, 0xDA, 0x26, 0x46, 0x00, 0x64, 0x23, 0xF0, 0x3B, 0xF0, + 0x64, 0x40, 0x10, 0x2A, 0x06, 0x00, 0xC0, 0x67, 0xA0, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, + 0x10, 0xBC, 0x3E, 0xFA, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0x9A, 0x64, 0xA2, 0xDB, 0x26, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC8, 0xFE, 0x00, 0x66, 0x46, 0x46, + 0x2F, 0x58, 0xFF, 0xFF, 0x04, 0x60, 0x5C, 0x61, 0xB3, 0x60, 0x58, 0x4D, 0x77, 0x78, 0xFF, 0xFF, + 0x66, 0x44, 0x59, 0xFB, 0x04, 0x64, 0x03, 0xFA, 0x2F, 0x58, 0xFF, 0xFF, 0x59, 0xF5, 0xAC, 0xF1, + 0x19, 0xF8, 0x00, 0x64, 0x3E, 0xFA, 0x08, 0x64, 0x2A, 0xFA, 0x80, 0x7E, 0xF8, 0x7F, 0x0E, 0xFA, + 0x88, 0xF1, 0x07, 0xF8, 0x01, 0x60, 0x60, 0x67, 0x2C, 0xFA, 0x1D, 0x60, 0x00, 0x67, 0x2D, 0xFA, + 0x01, 0x60, 0x00, 0x67, 0x2E, 0xFA, 0xCB, 0xF1, 0x2F, 0xF8, 0x32, 0xF8, 0xCC, 0xF1, 0x30, 0xF8, + 0x33, 0xF8, 0xCD, 0xF1, 0x31, 0xF8, 0x34, 0xF8, 0x00, 0x63, 0x3B, 0xFC, 0x3D, 0xFC, 0x01, 0x64, + 0x3A, 0xFA, 0x66, 0x64, 0x39, 0xFA, 0x3C, 0xFC, 0xAA, 0x60, 0xAA, 0x64, 0x00, 0xF4, 0x02, 0xFA, + 0x00, 0x60, 0x03, 0x64, 0x5A, 0xDA, 0x1D, 0x60, 0x60, 0x64, 0x5A, 0xDA, 0x01, 0x60, 0x00, 0x64, + 0x5A, 0xDA, 0x82, 0x7F, 0x24, 0x7E, 0x08, 0xFA, 0x01, 0x60, 0x01, 0x64, 0x0A, 0xFA, 0x00, 0x64, + 0x0E, 0xFA, 0x2D, 0x58, 0xFF, 0xFF, 0x59, 0xF5, 0x3D, 0xF2, 0x3C, 0xF2, 0xCC, 0x83, 0x00, 0xA8, + 0x03, 0x03, 0x08, 0x28, 0x3D, 0xFC, 0x45, 0x00, 0x3D, 0xFA, 0x3A, 0xF2, 0x3B, 0xF0, 0x00, 0x63, + 0x00, 0xF4, 0x07, 0xFC, 0x01, 0xB0, 0x0B, 0xFA, 0x1A, 0x03, 0x1F, 0xF8, 0xFF, 0xFF, 0x1B, 0x60, + 0xDA, 0x62, 0x18, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x0A, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0x1F, 0xF2, 0x1E, 0xF0, 0x59, 0xF5, 0x00, 0xA8, 0x3B, 0xF8, 0xD0, 0x80, 0x06, 0x03, + 0x05, 0x03, 0x04, 0x60, 0x5C, 0x63, 0x0F, 0x64, 0x3A, 0xFA, 0x39, 0xFC, 0x00, 0xF4, 0x00, 0x64, + 0x06, 0xFA, 0xE6, 0x60, 0x58, 0x4E, 0xF4, 0x78, 0xFF, 0xFF, 0x59, 0xF5, 0x00, 0xF4, 0x81, 0x60, + 0x00, 0x64, 0x06, 0xFA, 0x32, 0x47, 0x04, 0xBC, 0x07, 0xFA, 0xB8, 0xF1, 0x00, 0x7F, 0x64, 0x5E, + 0x09, 0xFA, 0x59, 0xF5, 0x00, 0x64, 0x15, 0xFA, 0x39, 0xF2, 0x3F, 0xFA, 0x1B, 0x60, 0xDA, 0x62, + 0x1B, 0x60, 0x88, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0xE1, 0x60, 0x0D, 0x78, 0xFF, 0xFF, 0x66, 0x45, 0x0E, 0xF2, 0x0F, 0xF0, 0x10, 0xF0, + 0x64, 0x41, 0x01, 0xA8, 0x59, 0xF5, 0x09, 0x02, 0xAD, 0x83, 0x64, 0x44, 0xAC, 0x84, 0x08, 0x24, + 0x0A, 0x63, 0x3C, 0xFC, 0x3D, 0xFC, 0x1A, 0x02, 0x2D, 0x00, 0x03, 0x3A, 0x03, 0x00, 0x00, 0x64, + 0x3C, 0xFA, 0x29, 0x00, 0x04, 0x3A, 0x09, 0x00, 0x0A, 0x64, 0x3C, 0xFA, 0x01, 0x64, 0x3A, 0xFA, + 0x00, 0xF4, 0x00, 0x64, 0x1F, 0xFA, 0x1E, 0xFA, 0x1E, 0x00, 0x02, 0x3A, 0x1E, 0x00, 0x64, 0x44, + 0xAD, 0x83, 0xAC, 0x84, 0x02, 0x03, 0x3C, 0xFC, 0x3D, 0xFC, 0x15, 0x03, 0x3A, 0xFA, 0xF8, 0x65, + 0x52, 0x63, 0x64, 0x44, 0x01, 0x36, 0x0D, 0x00, 0x12, 0xA3, 0x64, 0x40, 0x02, 0x2A, 0x02, 0x00, + 0xC7, 0x83, 0xC7, 0x83, 0x64, 0x40, 0x08, 0x2A, 0x01, 0x00, 0xC7, 0x83, 0x64, 0x40, 0x04, 0x26, + 0xC7, 0x83, 0x39, 0xFC, 0x00, 0x64, 0x2E, 0x58, 0xFF, 0xFF, 0x3B, 0xF0, 0x3A, 0xF2, 0x65, 0x46, + 0x06, 0xF2, 0x40, 0x47, 0x1D, 0x18, 0x32, 0x47, 0x07, 0xFA, 0x24, 0x7E, 0x82, 0x7F, 0x08, 0xFA, + 0x01, 0x60, 0x01, 0x63, 0xB8, 0xF3, 0x0A, 0xFC, 0x00, 0x7F, 0x09, 0xFA, 0x27, 0x40, 0x01, 0x2A, + 0x0F, 0x00, 0x1F, 0xF8, 0x1B, 0x60, 0xDA, 0x62, 0x18, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, + 0x0A, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x1E, 0xF0, 0x59, 0xF5, 0x3B, 0xF8, 0x65, 0x46, + 0x27, 0x40, 0x02, 0x26, 0x02, 0x00, 0x00, 0xF4, 0x13, 0x00, 0x6E, 0x61, 0xFF, 0x60, 0xFE, 0x64, + 0x00, 0x60, 0x0E, 0x63, 0x58, 0xD1, 0x59, 0xD8, 0xFD, 0x1F, 0x01, 0x60, 0xEE, 0x63, 0x00, 0xF4, + 0x02, 0x61, 0x58, 0xD1, 0x59, 0xD8, 0x7E, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x02, 0x61, 0xF9, 0x1F, + 0x27, 0x40, 0x04, 0x26, 0x1B, 0x00, 0x46, 0x4B, 0x1B, 0x60, 0x88, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, + 0x00, 0xA8, 0x60, 0x46, 0x0E, 0x03, 0x89, 0xF0, 0xE7, 0x60, 0x58, 0x4D, 0xAE, 0x78, 0xFF, 0xFF, + 0x65, 0x44, 0xAC, 0x86, 0xFF, 0xFF, 0x08, 0x03, 0xE7, 0x60, 0x58, 0x4D, 0xAE, 0x78, 0xFF, 0xFF, + 0x04, 0x00, 0x2B, 0x46, 0x82, 0xFC, 0x00, 0xF4, 0x82, 0xFC, 0x00, 0xF4, 0x27, 0x40, 0x08, 0x26, + 0x1A, 0x00, 0x46, 0x4B, 0x1B, 0x60, 0xC4, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, + 0x0E, 0x03, 0x89, 0xF0, 0xE7, 0x60, 0x58, 0x4D, 0xAE, 0x78, 0xFF, 0xFF, 0x65, 0x44, 0xAC, 0x86, + 0xFF, 0xFF, 0x08, 0x03, 0xE7, 0x60, 0x58, 0x4D, 0xAE, 0x78, 0xFF, 0xFF, 0x04, 0x00, 0x65, 0x46, + 0x02, 0xFA, 0x00, 0xF4, 0x82, 0xFC, 0x01, 0x64, 0x2E, 0x58, 0xFF, 0xFF, 0x01, 0x61, 0x02, 0x64, + 0x7A, 0x63, 0x58, 0xD0, 0xAB, 0x46, 0xA0, 0xD8, 0xAB, 0x46, 0xFB, 0x1F, 0xAB, 0x46, 0x00, 0xF4, + 0xCD, 0x81, 0xAB, 0x46, 0x00, 0xF4, 0xF3, 0x02, 0x2D, 0x58, 0xFF, 0xFF, 0x00, 0x60, 0x2A, 0x61, + 0xB3, 0x60, 0x58, 0x4D, 0x77, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0x58, 0xFB, 0x04, 0x64, 0x03, 0xFA, + 0x67, 0x44, 0x2C, 0xFA, 0x2D, 0xFA, 0x2E, 0xFA, 0x32, 0xFA, 0x33, 0xFA, 0x34, 0xFA, 0x12, 0x60, + 0x80, 0x64, 0x88, 0xF1, 0x0E, 0xFA, 0x07, 0xF8, 0x00, 0x64, 0x3E, 0xFA, 0x11, 0x60, 0xD8, 0x63, + 0xA3, 0xDB, 0x06, 0xA3, 0x10, 0x60, 0x08, 0x64, 0xBD, 0xDB, 0x04, 0x64, 0xBD, 0xDB, 0x06, 0x64, + 0xA3, 0xDB, 0x10, 0x60, 0x06, 0x62, 0xEA, 0x60, 0x08, 0x64, 0xA2, 0xDB, 0x11, 0x60, 0xE4, 0x63, + 0x00, 0x64, 0xA3, 0xDB, 0x06, 0xA3, 0x10, 0x60, 0x0C, 0x64, 0xBD, 0xDB, 0x08, 0x64, 0xBD, 0xDB, + 0x06, 0x64, 0xA3, 0xDB, 0x10, 0x60, 0x0A, 0x62, 0xEA, 0x60, 0x12, 0x64, 0xA2, 0xDB, 0x0F, 0x60, + 0xFC, 0x62, 0xE9, 0x60, 0xF2, 0x64, 0xA2, 0xDB, 0x00, 0x64, 0x25, 0x60, 0x2A, 0x62, 0xA2, 0xDB, + 0x2F, 0x58, 0xFF, 0xFF, 0x58, 0xF5, 0xCB, 0xF1, 0x2F, 0xF8, 0xCC, 0xF1, 0x30, 0xF8, 0xCD, 0xF1, + 0x31, 0xF8, 0xAC, 0xF1, 0x19, 0xF8, 0xEA, 0x60, 0x58, 0x4E, 0x1C, 0x78, 0xFF, 0xFF, 0x30, 0x64, + 0x3B, 0x42, 0x5A, 0xDB, 0x0F, 0x60, 0xE2, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x16, 0x60, 0xCC, 0x61, + 0xA1, 0xD3, 0xFF, 0xFF, 0x59, 0x18, 0x58, 0xF5, 0x40, 0x64, 0x2A, 0xFA, 0x52, 0xF3, 0x00, 0xF4, + 0x60, 0x43, 0xBD, 0xD1, 0x04, 0x65, 0x64, 0x47, 0xA5, 0xDA, 0x64, 0x41, 0xDD, 0x81, 0xE9, 0x81, + 0x62, 0x44, 0x04, 0x03, 0xBD, 0xD1, 0xCD, 0x81, 0x58, 0xD8, 0xFC, 0x02, 0x58, 0x8B, 0x21, 0x60, + 0x8E, 0x63, 0xA3, 0xD1, 0x2B, 0x44, 0xC8, 0x84, 0x64, 0x41, 0xFF, 0xB1, 0x61, 0x45, 0x03, 0xA1, + 0xE9, 0x81, 0x41, 0x4C, 0xBD, 0xD1, 0xCD, 0x81, 0x58, 0xD8, 0xFC, 0x02, 0x2B, 0xD2, 0x2B, 0x43, + 0x60, 0x47, 0x01, 0x7E, 0x52, 0xF1, 0xA3, 0xDA, 0xA4, 0xD3, 0xCB, 0x83, 0x44, 0x8B, 0xF8, 0x84, + 0x2C, 0x41, 0x0C, 0x04, 0xBE, 0xD2, 0xFF, 0xFF, 0x60, 0x47, 0xBE, 0xDA, 0x00, 0x7E, 0xA3, 0xD2, + 0x60, 0x45, 0x00, 0x7F, 0xB4, 0x84, 0xCD, 0x81, 0xBD, 0xDA, 0xF4, 0x02, 0x58, 0xF5, 0x2B, 0x44, + 0x04, 0xA4, 0x3F, 0xFA, 0x65, 0xF3, 0x64, 0xFB, 0x16, 0x60, 0xCE, 0x61, 0x01, 0x64, 0x52, 0xF1, + 0xA1, 0xDB, 0x65, 0xFB, 0xA4, 0xD3, 0x04, 0x65, 0x51, 0xF3, 0x01, 0x18, 0x0C, 0x65, 0xF3, 0xB4, + 0xB4, 0x84, 0x51, 0xFB, 0x02, 0xB0, 0xFF, 0xFF, 0x16, 0x03, 0x65, 0xF3, 0xFF, 0xFF, 0x60, 0x47, + 0x0F, 0xB4, 0x65, 0xFB, 0x01, 0x03, 0x0F, 0x00, 0xE9, 0x60, 0x74, 0x78, 0xFF, 0xFF, 0x51, 0xF1, + 0x65, 0xF3, 0x64, 0x40, 0x02, 0x26, 0xF8, 0x01, 0xF3, 0xA0, 0x04, 0xA4, 0x01, 0x04, 0xF1, 0xA4, + 0x10, 0x36, 0xF2, 0x01, 0x65, 0xFB, 0x65, 0xF3, 0x16, 0x60, 0xCC, 0x61, 0xA1, 0xD1, 0xCC, 0x84, + 0x01, 0x61, 0x08, 0x24, 0x03, 0x00, 0xE1, 0x81, 0xCC, 0x84, 0xFB, 0x01, 0xA1, 0x84, 0x51, 0xF1, + 0xE7, 0x03, 0x16, 0x60, 0xCE, 0x61, 0xA1, 0xDB, 0x00, 0x00, 0x65, 0xF3, 0x01, 0x61, 0xCC, 0x84, + 0xFF, 0xFF, 0x02, 0x03, 0xE1, 0x81, 0xFB, 0x01, 0x9A, 0xF3, 0x61, 0x45, 0xA4, 0x80, 0xFF, 0xFF, + 0xD7, 0x03, 0x31, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x0F, 0x60, 0xE2, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0xDE, 0xFE, 0x0B, 0x04, 0x0F, 0x60, 0xE4, 0x62, 0x40, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xE8, 0x60, + 0x95, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x65, 0xF1, 0x1C, 0x60, 0x00, 0x62, + 0xA2, 0xD9, 0x1E, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x0F, 0x60, 0xE4, 0x62, 0x20, 0x60, + 0x00, 0x64, 0xA2, 0xDB, 0xE8, 0x60, 0xC8, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0xBE, 0xFE, 0x0F, 0x60, 0xCE, 0x62, 0xA2, 0xD1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0x0F, 0x60, 0xE2, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x58, 0xF5, 0x1B, 0x60, 0xDA, 0x62, + 0x1B, 0x60, 0x8E, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0x00, 0x64, 0x4F, 0xFB, 0x0F, 0x60, 0xE4, 0x62, 0x00, 0x60, 0x01, 0x64, 0xA2, 0xDB, + 0xE8, 0x60, 0xF2, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0xC1, 0xFE, 0x33, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x2F, 0x58, 0xFF, 0xFF, 0x34, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x0F, 0x60, 0xE2, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0xA6, 0xF1, 0x11, 0x60, 0xDC, 0x62, 0xA2, 0xD9, 0x1C, 0x60, 0x10, 0x62, 0x11, 0x60, + 0xD8, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0xA7, 0xF1, 0x11, 0x60, + 0xE8, 0x62, 0xA2, 0xD9, 0x1C, 0x60, 0x0E, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xFD, 0x1B, 0x1C, 0x60, + 0x10, 0x62, 0x11, 0x60, 0xE4, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, + 0x0F, 0x60, 0xE4, 0x62, 0x00, 0x60, 0x08, 0x64, 0xA2, 0xDB, 0xE9, 0x60, 0x23, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x4F, 0xF1, 0x0F, 0x60, 0xE2, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x64, 0x40, 0xFF, 0x26, 0x03, 0x00, 0xE8, 0x60, 0x77, 0x78, 0xFF, 0xFF, 0x02, 0x0A, 0x00, 0x64, + 0x4F, 0xFB, 0xA8, 0xF1, 0x11, 0x60, 0xE8, 0x62, 0xA2, 0xD9, 0x0F, 0x60, 0xE4, 0x62, 0x00, 0x60, + 0x0C, 0x64, 0xA2, 0xDB, 0xE9, 0x60, 0x49, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x1C, 0x60, 0x10, 0x62, + 0x11, 0x60, 0xE4, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x2F, 0x58, + 0xFF, 0xFF, 0x0F, 0x60, 0xE2, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x0C, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x1C, 0x60, 0x10, 0x62, 0x11, 0x60, 0xE4, 0x64, 0xA2, 0xDB, + 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x14, 0x00, 0xFF, 0x60, 0xF7, 0x64, 0xA0, 0x84, + 0xA2, 0xDB, 0x4F, 0xF3, 0xDB, 0x0A, 0x00, 0xA0, 0x00, 0x64, 0x02, 0x03, 0x4F, 0xFB, 0xD6, 0x01, + 0x1C, 0x60, 0x10, 0x62, 0x11, 0x60, 0xD8, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0xE8, 0x60, 0x77, 0x78, 0xFF, 0xFF, 0x35, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x1C, 0x60, + 0x10, 0x62, 0x11, 0x60, 0xD8, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, + 0x51, 0xF3, 0xFF, 0xFF, 0xE3, 0xB4, 0x51, 0xFB, 0x16, 0x60, 0xCA, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, + 0xFE, 0xB4, 0xA2, 0xDB, 0x00, 0x64, 0x25, 0x60, 0x2A, 0x62, 0xA2, 0xDB, 0x0F, 0x60, 0xE2, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0E, 0x04, 0x32, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x0F, 0x60, + 0xE4, 0x62, 0x40, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xE9, 0x60, 0x8E, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x64, 0xF1, 0x65, 0xF9, 0x1C, 0x60, 0x00, 0x62, 0xA2, 0xD9, 0x1E, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x0F, 0x60, 0xE4, 0x62, 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, + 0xE9, 0x60, 0xB6, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xBE, 0xFE, 0x0F, 0x60, + 0xCE, 0x62, 0xA2, 0xD1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x0F, 0x60, + 0xCE, 0x62, 0xA2, 0xD1, 0x10, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x00, 0x60, + 0x04, 0x61, 0xB3, 0x60, 0x58, 0x4D, 0x77, 0x78, 0xFF, 0xFF, 0x01, 0x64, 0x23, 0xFA, 0xF1, 0x60, + 0x02, 0x64, 0x24, 0xFA, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0xCA, 0x64, 0xA2, 0xDB, 0x66, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xFA, 0xFE, 0xEA, 0x60, 0x58, 0x4E, + 0x2E, 0x78, 0xFF, 0xFF, 0x20, 0x44, 0x01, 0xB5, 0x54, 0x80, 0x31, 0x44, 0xDE, 0xB4, 0x40, 0x51, + 0x0F, 0x60, 0xE2, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x5A, 0xDB, 0x3E, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x2F, 0x58, 0xFF, 0xFF, 0x3F, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x1C, 0x60, 0x10, 0x62, 0x11, 0x60, + 0xD8, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x00, 0x64, 0x51, 0xFB, + 0x0F, 0x60, 0xE2, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x5A, 0xDB, 0xBE, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x0F, 0x60, 0xE2, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xE2, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x08, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x66, 0x01, 0x60, 0x7A, 0x61, 0x16, 0x60, + 0xC4, 0x63, 0xA1, 0xD3, 0xFF, 0xFF, 0x20, 0x7F, 0xBD, 0xDB, 0x21, 0x60, 0x32, 0x64, 0xBD, 0xDB, + 0x04, 0xA1, 0xA1, 0xD3, 0xFF, 0xFF, 0x22, 0x7F, 0xA3, 0xDB, 0x10, 0x00, 0x01, 0x60, 0x7A, 0x61, + 0x16, 0x60, 0xC4, 0x63, 0xA1, 0xD3, 0x00, 0x66, 0x20, 0x7F, 0xBD, 0xDB, 0x59, 0xD3, 0xFF, 0xFF, + 0x21, 0x7F, 0xBD, 0xDB, 0x59, 0xD3, 0xFF, 0xFF, 0x22, 0x7F, 0xA3, 0xDB, 0x0F, 0x60, 0xE2, 0x62, + 0xA2, 0xD1, 0x9F, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0xDE, 0xFE, 0x0B, 0x04, 0x0F, 0x60, + 0xE4, 0x62, 0x40, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xEA, 0x60, 0x3E, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x1C, 0x60, 0x00, 0x62, 0x16, 0x60, 0xC2, 0x64, 0xA2, 0xDB, 0x20, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x0F, 0x60, 0xE4, 0x62, 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, + 0xEA, 0x60, 0x66, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xE2, 0x62, + 0xA2, 0xD1, 0x9F, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0xBE, 0xFE, 0x0F, 0x60, 0xCE, 0x62, + 0xA2, 0xD1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2E, 0x58, 0xFF, 0xFF, + 0x5F, 0xFB, 0xAC, 0x85, 0x60, 0x41, 0x20, 0x03, 0x01, 0x60, 0x00, 0x63, 0x08, 0x64, 0xE9, 0x81, + 0xCC, 0x84, 0x02, 0x24, 0xDF, 0x83, 0xFB, 0x02, 0x21, 0x60, 0x8E, 0x64, 0xA0, 0xDD, 0x65, 0x41, + 0x21, 0x60, 0x90, 0x63, 0x0F, 0x60, 0xC0, 0x64, 0xE9, 0x81, 0x58, 0xD1, 0xFD, 0x04, 0xA3, 0xD9, + 0x0B, 0x03, 0x58, 0xD1, 0xE9, 0x81, 0x60, 0x45, 0xFC, 0x04, 0xA3, 0xD1, 0x64, 0x47, 0xB0, 0x84, + 0xBD, 0xDB, 0x00, 0xB9, 0x65, 0x44, 0xF0, 0x02, 0x20, 0x60, 0x38, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, + 0x01, 0xA8, 0x01, 0x60, 0x70, 0x62, 0x06, 0x02, 0xA2, 0xD3, 0xFF, 0xFF, 0x01, 0xA8, 0xFF, 0xFF, + 0x01, 0x03, 0x02, 0x64, 0x60, 0x41, 0x21, 0x60, 0x8E, 0x63, 0xBD, 0xD3, 0xA3, 0xD3, 0xFF, 0xB5, + 0x80, 0xBF, 0xCD, 0x81, 0x65, 0x5C, 0x0F, 0x03, 0x80, 0xBF, 0xBD, 0xDB, 0x65, 0x44, 0xC8, 0x84, + 0xFF, 0xFF, 0x0C, 0x03, 0x60, 0x45, 0xCD, 0x81, 0xA3, 0xD3, 0x08, 0x03, 0x80, 0xBF, 0xCD, 0x81, + 0xFF, 0xFF, 0x01, 0x03, 0x80, 0xBC, 0x60, 0x47, 0xBD, 0xDB, 0x00, 0x65, 0x64, 0x41, 0x21, 0x60, + 0x90, 0x63, 0xBD, 0xD3, 0xFF, 0xFF, 0x80, 0xB0, 0xFF, 0xFF, 0x01, 0x03, 0x60, 0x45, 0x60, 0x47, + 0x80, 0xB0, 0xFF, 0xFF, 0x01, 0x03, 0x60, 0x45, 0xCD, 0x81, 0xFF, 0xFF, 0xF2, 0x02, 0x65, 0x44, + 0x7F, 0xB4, 0x02, 0x3A, 0x02, 0x00, 0x0A, 0x64, 0x15, 0x00, 0x04, 0x3A, 0x02, 0x00, 0x14, 0x64, + 0x11, 0x00, 0x0A, 0x3A, 0x02, 0x00, 0x32, 0x64, 0x0D, 0x00, 0x0B, 0x3A, 0x02, 0x00, 0x37, 0x64, + 0x09, 0x00, 0x10, 0x3A, 0x02, 0x00, 0x50, 0x64, 0x05, 0x00, 0x16, 0x3A, 0x02, 0x00, 0x6E, 0x64, + 0x01, 0x00, 0x14, 0x64, 0x62, 0xFB, 0x2E, 0x58, 0xFF, 0xFF, 0x3C, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x31, 0x40, 0x20, 0x2A, 0x18, 0x00, 0x3F, 0xF2, 0x47, 0x65, 0xC4, 0x84, 0xE8, 0x84, 0x23, 0xFA, + 0xF1, 0x60, 0x02, 0x64, 0x24, 0xFA, 0x1B, 0x60, 0xDA, 0x62, 0x1B, 0x60, 0xCA, 0x64, 0xA2, 0xDB, + 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xFA, 0xFE, 0x00, 0x66, + 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x26, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x0C, 0x63, 0x12, 0x60, + 0xB6, 0x62, 0x00, 0x64, 0x5A, 0xDB, 0xFE, 0x1F, 0x53, 0xFB, 0x54, 0xFB, 0x12, 0x60, 0xBA, 0x63, + 0x02, 0x64, 0xA3, 0xDB, 0x2E, 0x58, 0xFF, 0xFF, 0x12, 0x60, 0xBE, 0x62, 0xA2, 0xD3, 0x00, 0x63, + 0xF0, 0xA0, 0x01, 0xA4, 0x03, 0x03, 0xA2, 0xDB, 0x2E, 0x58, 0xFF, 0xFF, 0xA2, 0xDD, 0x12, 0x60, + 0xC0, 0x62, 0xA2, 0xD1, 0xA2, 0xDD, 0x5A, 0xD3, 0xA2, 0xDD, 0xC0, 0x81, 0x61, 0x44, 0x02, 0x24, + 0xFF, 0xFF, 0xE9, 0x81, 0xE9, 0x81, 0xE9, 0x81, 0xE9, 0x81, 0x5A, 0xD3, 0xE9, 0x81, 0xE8, 0x83, + 0xEB, 0x83, 0xEB, 0x83, 0xEB, 0x83, 0xEB, 0x85, 0xD4, 0x85, 0xC5, 0x83, 0xA2, 0xDD, 0x12, 0x60, + 0xB8, 0x62, 0x63, 0x47, 0x00, 0x7F, 0xA2, 0xDB, 0x2E, 0x58, 0xFF, 0xFF, 0x03, 0xE1, 0xA3, 0xFF, + 0x1B, 0x60, 0x5A, 0x63, 0x17, 0xFD, 0xAE, 0xFF, 0xEB, 0x60, 0x84, 0x78, 0xFF, 0xFF, 0x7F, 0x67, + 0x01, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0xB1, 0xFE, 0x05, 0x05, 0xB0, 0xFE, 0x06, 0x05, 0xB2, 0xFE, + 0xB3, 0xFE, 0x22, 0x00, 0xF0, 0x60, 0xFA, 0x78, 0xFF, 0xFF, 0x28, 0xF3, 0x29, 0xF1, 0x40, 0x44, + 0x44, 0x45, 0x2A, 0xF1, 0x2B, 0xF1, 0x44, 0x46, 0x44, 0x47, 0x3F, 0xB4, 0xE0, 0x85, 0x16, 0x60, + 0xD2, 0x64, 0x44, 0xD7, 0x58, 0x43, 0xFF, 0xFF, 0x60, 0x45, 0x12, 0x60, 0xC8, 0x7C, 0xA4, 0xD3, + 0x61, 0x43, 0x04, 0xB4, 0x24, 0x44, 0x02, 0x03, 0x13, 0xFF, 0x06, 0x00, 0x3F, 0xB4, 0xB4, 0x84, + 0xFF, 0x27, 0x05, 0xFD, 0x04, 0xFB, 0x10, 0x75, 0xA1, 0xFF, 0xFF, 0xFF, 0x86, 0x3E, 0xB4, 0xFE, + 0x09, 0x05, 0xB5, 0xFE, 0x02, 0x24, 0x80, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0xB7, 0xFE, 0x05, 0x05, + 0xB6, 0xFE, 0xF2, 0x01, 0xF1, 0x60, 0x35, 0x78, 0xFF, 0xFF, 0x36, 0x44, 0x00, 0x7F, 0xF4, 0xA0, + 0x60, 0x45, 0x05, 0x05, 0x17, 0x60, 0x5E, 0x64, 0x44, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0xE4, 0x01, + 0xE3, 0x01, 0x7F, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, 0x10, 0x02, + 0x10, 0x64, 0x40, 0x40, 0x02, 0x64, 0x40, 0x50, 0x61, 0xFF, 0x3F, 0x40, 0x40, 0x26, 0x04, 0x00, + 0x10, 0xE0, 0x46, 0x60, 0x09, 0xE0, 0x00, 0x00, 0x27, 0xF1, 0x00, 0x66, 0x20, 0x78, 0x42, 0xFE, + 0x23, 0x58, 0xFF, 0xFF, 0x78, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, + 0x1C, 0x02, 0x12, 0x60, 0xC8, 0x63, 0xA3, 0xD3, 0x07, 0x7C, 0x20, 0xB5, 0x0C, 0xB5, 0x04, 0x03, + 0x03, 0x02, 0xBC, 0xF9, 0x00, 0x67, 0x11, 0x00, 0x00, 0x61, 0x41, 0x56, 0xC7, 0xFE, 0xB4, 0x01, + 0x36, 0x47, 0xFF, 0x23, 0x04, 0x00, 0x00, 0x7F, 0x60, 0x41, 0x7F, 0x67, 0x06, 0x00, 0x04, 0x7C, + 0xBC, 0xF9, 0x20, 0x44, 0x80, 0xBC, 0x40, 0x40, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x78, 0x60, + 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, 0x31, 0x02, 0x12, 0x60, 0xC8, 0x63, + 0xA3, 0xD3, 0x01, 0x7C, 0x20, 0xB5, 0x0C, 0xB5, 0x03, 0x03, 0x02, 0x02, 0xBC, 0xF9, 0xFF, 0xFF, + 0x02, 0x61, 0x41, 0x56, 0xC7, 0xFE, 0xEB, 0x60, 0x84, 0x78, 0xFF, 0xFF, 0x7E, 0xF1, 0x20, 0x44, + 0x64, 0x40, 0xFF, 0x26, 0x1B, 0x00, 0x7F, 0xB4, 0x40, 0x40, 0x5C, 0x5E, 0x82, 0xFF, 0x26, 0x44, + 0xFD, 0xB4, 0x40, 0x46, 0x5C, 0x41, 0x87, 0xFF, 0x62, 0xFF, 0x00, 0x63, 0x1B, 0x60, 0xC4, 0x62, + 0xA2, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x04, 0x03, 0x09, 0xF2, 0x0F, 0xFC, 0xAC, 0x86, + 0xFB, 0x01, 0x1C, 0x60, 0x04, 0x62, 0x06, 0x64, 0xA2, 0xDB, 0x2D, 0xFF, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x25, 0x46, 0x01, 0xF2, 0x08, 0xF0, 0x60, 0x47, 0x03, 0xB4, 0x03, 0xAC, 0x7F, 0x67, + 0x03, 0x61, 0x08, 0x02, 0x1B, 0x60, 0xE0, 0x64, 0x40, 0x4B, 0xF0, 0x60, 0x58, 0x4D, 0x75, 0x78, + 0xFF, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x24, 0x40, 0x01, 0x2B, 0x49, 0x00, 0x25, 0x44, + 0x1F, 0xB4, 0xE0, 0x85, 0xEC, 0x60, 0x36, 0x64, 0xC4, 0x98, 0xFF, 0xFF, 0xC0, 0xFE, 0x3D, 0x00, + 0xC1, 0xFE, 0x3B, 0x00, 0xC2, 0xFE, 0x39, 0x00, 0xC3, 0xFE, 0x37, 0x00, 0xC4, 0xFE, 0x35, 0x00, + 0xC5, 0xFE, 0x33, 0x00, 0xC6, 0xFE, 0x31, 0x00, 0xC7, 0xFE, 0x2F, 0x00, 0xC8, 0xFE, 0x2D, 0x00, + 0xC9, 0xFE, 0x2B, 0x00, 0xCA, 0xFE, 0x29, 0x00, 0xCB, 0xFE, 0x27, 0x00, 0xCC, 0xFE, 0x25, 0x00, + 0xCD, 0xFE, 0x23, 0x00, 0xCE, 0xFE, 0x21, 0x00, 0xCF, 0xFE, 0x1F, 0x00, 0xD0, 0xFE, 0x1D, 0x00, + 0xD1, 0xFE, 0x1B, 0x00, 0xD2, 0xFE, 0x19, 0x00, 0xD3, 0xFE, 0x17, 0x00, 0xD4, 0xFE, 0x15, 0x00, + 0xD5, 0xFE, 0x13, 0x00, 0xD6, 0xFE, 0x11, 0x00, 0xD7, 0xFE, 0x0F, 0x00, 0xD8, 0xFE, 0x0D, 0x00, + 0xD9, 0xFE, 0x0B, 0x00, 0xDA, 0xFE, 0x09, 0x00, 0xDB, 0xFE, 0x07, 0x00, 0xDC, 0xFE, 0x05, 0x00, + 0xDD, 0xFE, 0x03, 0x00, 0xDE, 0xFE, 0x01, 0x00, 0xDF, 0xFE, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x00, 0x64, 0x9F, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x9E, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x9D, 0xFE, + 0xF0, 0x84, 0xFF, 0xFF, 0x9C, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x9B, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, + 0x9A, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x99, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x98, 0xFE, 0xF0, 0x84, + 0xFF, 0xFF, 0x97, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x96, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x95, 0xFE, + 0xF0, 0x84, 0xFF, 0xFF, 0x94, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x93, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, + 0x92, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x91, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x90, 0xFE, 0xF0, 0x84, + 0x06, 0xFB, 0x8F, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x8E, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x8D, 0xFE, + 0xF0, 0x84, 0xFF, 0xFF, 0x8C, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x8B, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, + 0x8A, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x89, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x88, 0xFE, 0xF0, 0x84, + 0xFF, 0xFF, 0x87, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x86, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x85, 0xFE, + 0xF0, 0x84, 0xFF, 0xFF, 0x84, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x83, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, + 0x82, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x81, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x80, 0xFE, 0xF0, 0x84, + 0x05, 0xFB, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x5C, 0x5C, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x24, 0x40, 0x01, 0x27, 0x55, 0x00, 0x05, 0x60, 0x00, 0x63, 0x05, 0xFD, 0x30, 0x44, 0xBD, 0xDB, + 0x31, 0x44, 0xBD, 0xDB, 0x32, 0x44, 0xBD, 0xDB, 0x33, 0x44, 0xBD, 0xDB, 0x34, 0x44, 0xBD, 0xDB, + 0x35, 0x44, 0xBD, 0xDB, 0x36, 0x44, 0xBD, 0xDB, 0x37, 0x44, 0xBD, 0xDB, 0x38, 0x44, 0xBD, 0xDB, + 0x39, 0x44, 0xBD, 0xDB, 0x3A, 0x44, 0xBD, 0xDB, 0x3B, 0x44, 0xBD, 0xDB, 0x3C, 0x44, 0xBD, 0xDB, + 0x3D, 0x44, 0xBD, 0xDB, 0x3E, 0x44, 0xBD, 0xDB, 0x3F, 0x44, 0xBD, 0xDB, 0x02, 0x61, 0x61, 0x44, + 0x02, 0x36, 0x82, 0xFF, 0x03, 0x36, 0x83, 0xFF, 0x04, 0x36, 0x84, 0xFF, 0x05, 0x36, 0x85, 0xFF, + 0x06, 0x36, 0x86, 0xFF, 0x07, 0x36, 0x87, 0xFF, 0x20, 0x44, 0xBD, 0xDB, 0x21, 0x44, 0xBD, 0xDB, + 0x22, 0x44, 0xBD, 0xDB, 0x23, 0x44, 0xBD, 0xDB, 0x24, 0x44, 0xBD, 0xDB, 0x25, 0x44, 0xBD, 0xDB, + 0x26, 0x44, 0xBD, 0xDB, 0x27, 0x44, 0xBD, 0xDB, 0x28, 0x44, 0xBD, 0xDB, 0x29, 0x44, 0xBD, 0xDB, + 0x2A, 0x44, 0xBD, 0xDB, 0x2B, 0x44, 0xBD, 0xDB, 0x2C, 0x44, 0xBD, 0xDB, 0x2D, 0x44, 0xBD, 0xDB, + 0x2E, 0x44, 0xBD, 0xDB, 0x2F, 0x44, 0xBD, 0xDB, 0xDD, 0x81, 0x08, 0x3A, 0xD0, 0x01, 0x54, 0x00, + 0x27, 0x40, 0x10, 0x26, 0x30, 0x00, 0x26, 0x44, 0x01, 0x36, 0x2D, 0x00, 0x02, 0x36, 0x82, 0xFF, + 0x03, 0x36, 0x83, 0xFF, 0x04, 0x36, 0x84, 0xFF, 0x05, 0x36, 0x85, 0xFF, 0x06, 0x36, 0x86, 0xFF, + 0x25, 0x44, 0x00, 0x36, 0x44, 0x40, 0x01, 0x36, 0x44, 0x41, 0x02, 0x36, 0x44, 0x42, 0x03, 0x36, + 0x44, 0x43, 0x04, 0x36, 0x44, 0x44, 0x05, 0x36, 0x44, 0x45, 0x06, 0x36, 0x44, 0x46, 0x07, 0x36, + 0x44, 0x47, 0x08, 0x36, 0x44, 0x48, 0x09, 0x36, 0x44, 0x49, 0x0A, 0x36, 0x44, 0x4A, 0x0B, 0x36, + 0x44, 0x4B, 0x0C, 0x36, 0x44, 0x4C, 0x0D, 0x36, 0x44, 0x4D, 0x0E, 0x36, 0x44, 0x4E, 0x0F, 0x36, + 0x44, 0x4F, 0x87, 0xFF, 0x21, 0x00, 0x25, 0x44, 0x10, 0x36, 0x44, 0x50, 0x11, 0x36, 0x44, 0x51, + 0x12, 0x36, 0x44, 0x52, 0x13, 0x36, 0x44, 0x53, 0x14, 0x36, 0x44, 0x54, 0x15, 0x36, 0x44, 0x55, + 0x16, 0x36, 0x44, 0x56, 0x17, 0x36, 0x44, 0x57, 0x18, 0x36, 0x44, 0x58, 0x19, 0x36, 0x44, 0x59, + 0x1A, 0x36, 0x44, 0x5A, 0x1B, 0x36, 0x44, 0x5B, 0x1C, 0x36, 0x44, 0x5C, 0x1D, 0x36, 0x44, 0x5D, + 0x1E, 0x36, 0x44, 0x5E, 0x1F, 0x36, 0x44, 0x5F, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x25, 0x46, + 0xB3, 0x60, 0x58, 0x4F, 0x22, 0x78, 0xFF, 0xFF, 0x03, 0x61, 0x7F, 0x67, 0x0B, 0x02, 0x00, 0xF0, + 0x1B, 0x60, 0xE0, 0x62, 0x04, 0x64, 0xA2, 0xDB, 0x5A, 0xD9, 0x0A, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x40, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, + 0x7F, 0x67, 0x02, 0x61, 0x11, 0x02, 0x1C, 0x60, 0x04, 0x62, 0x1A, 0x64, 0xA2, 0xDB, 0x00, 0x60, + 0x50, 0x63, 0x5A, 0xDD, 0xED, 0x60, 0xB9, 0x64, 0x80, 0xFB, 0x2D, 0xFF, 0xEB, 0x60, 0x84, 0x78, + 0xFF, 0xFF, 0x2A, 0xF3, 0x05, 0xFB, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x40, 0x60, 0xC0, 0x64, + 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, 0x0F, 0x02, 0x1C, 0x60, 0x04, 0x62, 0x1C, 0x64, + 0xA2, 0xDB, 0x00, 0x60, 0x50, 0x63, 0x5A, 0xDD, 0xED, 0x60, 0xD3, 0x64, 0x80, 0xFB, 0x2D, 0xFF, + 0xEB, 0x60, 0x84, 0x78, 0xFF, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x7F, 0x60, 0xC0, 0x64, + 0x24, 0x45, 0xA4, 0x80, 0x02, 0x61, 0x34, 0x02, 0x25, 0x45, 0x20, 0x44, 0x80, 0x2A, 0x35, 0x00, + 0xF1, 0x60, 0x00, 0x64, 0xD4, 0x80, 0xFF, 0xFF, 0x01, 0x03, 0x29, 0x00, 0x21, 0x60, 0x74, 0x62, + 0xA2, 0xD1, 0x9A, 0xF3, 0x16, 0x60, 0xCC, 0x61, 0xA0, 0x84, 0xA1, 0xDB, 0x25, 0x45, 0x1B, 0x60, + 0x52, 0x63, 0x01, 0x61, 0xBD, 0xD3, 0xBD, 0xD1, 0xD4, 0x80, 0xBD, 0xD3, 0xBD, 0xD5, 0xCD, 0x81, + 0x02, 0x03, 0x15, 0x03, 0xF7, 0x01, 0xA2, 0xFF, 0xA6, 0xD3, 0x40, 0x4C, 0x00, 0xA8, 0x67, 0x43, + 0x0C, 0x02, 0xA2, 0xDD, 0x42, 0x48, 0x64, 0x41, 0xB3, 0x60, 0x58, 0x4D, 0x77, 0x78, 0xFF, 0xFF, + 0x66, 0x44, 0x28, 0xDB, 0x02, 0x03, 0x2C, 0x58, 0xA3, 0xFF, 0x0C, 0x61, 0x03, 0x00, 0x04, 0x61, + 0x7F, 0x67, 0x01, 0x00, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xF1, 0x60, 0x02, 0x64, 0xD4, 0x80, + 0x7F, 0x67, 0x06, 0x63, 0xF8, 0x02, 0x31, 0x40, 0x20, 0x26, 0xF5, 0x01, 0x21, 0x60, 0x74, 0x62, + 0xA2, 0xD1, 0x9A, 0xF3, 0x16, 0x60, 0xCC, 0x61, 0xA0, 0x84, 0xA1, 0xDB, 0x16, 0x60, 0xD0, 0x61, + 0x01, 0x64, 0xA1, 0xDB, 0xFF, 0xFF, 0xC4, 0xFE, 0xE5, 0x01, 0xC6, 0xFE, 0xE3, 0x01, 0x7E, 0x60, + 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x02, 0x61, 0x3F, 0x02, 0x25, 0x45, 0xF8, 0x2B, 0x3B, 0x00, + 0x2E, 0xF5, 0x67, 0x44, 0xD4, 0x80, 0x17, 0x60, 0x6A, 0x63, 0x39, 0x03, 0x64, 0x61, 0x24, 0x44, + 0x01, 0x27, 0x29, 0x00, 0xA3, 0xFC, 0xA4, 0xF8, 0xBD, 0xD3, 0xA3, 0xD1, 0xD4, 0x80, 0xCD, 0x81, + 0x08, 0x24, 0x64, 0x58, 0x08, 0xA3, 0xF8, 0x02, 0x08, 0x60, 0x00, 0x63, 0xBD, 0xD3, 0xA3, 0xD1, + 0xFE, 0xA0, 0xFA, 0x60, 0x00, 0x64, 0xD0, 0x80, 0x14, 0x02, 0x13, 0x02, 0x04, 0xA3, 0xBE, 0xD3, + 0xBD, 0xD1, 0x0F, 0x18, 0xD4, 0x80, 0x0D, 0x18, 0x03, 0x03, 0xC3, 0x83, 0xC3, 0x83, 0xF7, 0x01, + 0x64, 0x41, 0xDD, 0x81, 0xE1, 0x81, 0xCB, 0x83, 0x46, 0x65, 0xF2, 0x60, 0x58, 0x4F, 0x4A, 0x78, + 0xFF, 0xFF, 0x00, 0x67, 0x0A, 0x00, 0xBD, 0xD3, 0xBE, 0xD1, 0xD4, 0x80, 0xCD, 0x81, 0x08, 0x24, + 0x64, 0x58, 0x08, 0xA3, 0xF8, 0x02, 0x04, 0x61, 0x7F, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x0F, 0x64, + 0x23, 0xFA, 0x67, 0x44, 0x24, 0xFA, 0x62, 0x41, 0x3E, 0x60, 0x00, 0x65, 0x1A, 0x63, 0xEA, 0x60, + 0x88, 0x64, 0x65, 0x46, 0x58, 0xD0, 0x2E, 0xF5, 0x59, 0xD8, 0xFB, 0x1F, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x4B, 0xD3, 0xFF, 0xFF, 0x60, 0x41, 0xE8, 0x84, 0xDC, 0x84, 0x23, 0xFA, 0xBF, 0xD1, + 0x4A, 0x65, 0x64, 0x43, 0xF2, 0x60, 0x58, 0x4F, 0x4A, 0x78, 0xFF, 0xFF, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x25, 0xF2, 0xFF, 0xFF, 0xE0, 0xA0, 0x20, 0x64, 0x01, 0x06, 0x25, 0xFA, 0x23, 0xF2, + 0xDF, 0xD1, 0xCC, 0x84, 0xE0, 0x85, 0x0B, 0x06, 0xBF, 0xD1, 0x64, 0x41, 0xD5, 0x80, 0x64, 0x43, + 0x01, 0x06, 0x65, 0x41, 0x4A, 0x65, 0xEF, 0x60, 0x58, 0x4F, 0x87, 0x78, 0xFF, 0xFF, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0xBC, 0xF3, 0x02, 0x63, 0x23, 0xFC, 0x07, 0xB4, 0x25, 0xFA, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x4B, 0xD3, 0xBF, 0xD3, 0x60, 0x41, 0xC9, 0x83, 0xE9, 0x81, 0xDD, 0x81, + 0xA3, 0xFA, 0xE0, 0x81, 0x3C, 0x60, 0x00, 0x67, 0x02, 0x24, 0x02, 0xA4, 0x60, 0x47, 0x40, 0x4B, + 0xC9, 0x81, 0x4A, 0x65, 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0xA5, 0xD8, 0xDA, 0x85, 0x80, 0x3A, + 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0xF6, 0x1F, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xFC, 0xA3, + 0xA3, 0xD1, 0x4C, 0x65, 0xA4, 0xD3, 0xDA, 0x83, 0x60, 0x47, 0x25, 0xFA, 0x00, 0x7E, 0x60, 0x47, + 0x01, 0x26, 0xDC, 0x84, 0x60, 0x41, 0xE8, 0x84, 0xD8, 0x84, 0x23, 0xFA, 0xAB, 0x01, 0xFC, 0xA3, + 0xA3, 0xD1, 0x4C, 0x65, 0xA4, 0xD3, 0xDA, 0x83, 0x00, 0x7F, 0x25, 0xFA, 0x60, 0x41, 0x01, 0x26, + 0xDD, 0x81, 0xE9, 0x84, 0xD8, 0x84, 0x23, 0xFA, 0x9D, 0x01, 0x23, 0xF2, 0x12, 0x60, 0xB8, 0x65, + 0x60, 0x41, 0x12, 0x60, 0x54, 0x63, 0xA3, 0xDB, 0xFF, 0xA1, 0x48, 0x64, 0x58, 0xD0, 0x7E, 0xA8, + 0x5B, 0xD9, 0x02, 0x02, 0x00, 0xF4, 0x02, 0x64, 0xFF, 0xA1, 0xD7, 0x80, 0x02, 0x03, 0x01, 0x03, + 0xF5, 0x01, 0x2E, 0xF5, 0x00, 0x60, 0x2F, 0x65, 0x25, 0xF2, 0x00, 0x63, 0xCC, 0x84, 0x03, 0xA3, + 0xFD, 0x05, 0x4A, 0x64, 0xD7, 0x80, 0x11, 0x60, 0xF0, 0x61, 0x2F, 0x05, 0xA1, 0xDD, 0xE3, 0x83, + 0xFE, 0xA3, 0x58, 0xD0, 0x7E, 0xA8, 0x59, 0xD9, 0x02, 0x02, 0x00, 0xF4, 0x02, 0x64, 0xF9, 0x1F, + 0x00, 0x63, 0x59, 0xDD, 0x2E, 0xF5, 0x11, 0x60, 0xF0, 0x64, 0x25, 0xF0, 0xA0, 0xD3, 0xD3, 0x80, + 0x01, 0xB0, 0x04, 0x03, 0x01, 0xA4, 0x03, 0x03, 0xA2, 0xDB, 0x01, 0x00, 0xA2, 0xDD, 0x11, 0x60, + 0xF8, 0x63, 0x10, 0x60, 0x0A, 0x65, 0xBD, 0xD3, 0xBD, 0xD1, 0xE0, 0x84, 0xC4, 0x82, 0x10, 0x60, + 0x2A, 0x65, 0x07, 0x64, 0x64, 0x41, 0x5A, 0xDB, 0xD6, 0x80, 0xCD, 0x81, 0x06, 0x03, 0xFB, 0x02, + 0x25, 0xF2, 0x02, 0xA3, 0xCC, 0x84, 0xA2, 0xDA, 0xEC, 0x02, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x12, 0x60, 0x54, 0x61, 0xA1, 0xD3, 0x23, 0xFA, 0xE0, 0x83, 0x4A, 0x65, 0x04, 0x02, 0x02, 0x63, + 0x23, 0xFC, 0xA5, 0xFC, 0x09, 0x00, 0xDB, 0x83, 0x59, 0xD1, 0xA5, 0xD8, 0xDA, 0x85, 0x80, 0x3A, + 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0xF8, 0x1F, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x11, 0x60, + 0xF0, 0x62, 0xA2, 0xD3, 0x00, 0x61, 0x02, 0xA4, 0xFE, 0xA0, 0x23, 0xFA, 0x1B, 0x03, 0xFA, 0xA4, + 0xFD, 0xA4, 0x01, 0xA1, 0xFD, 0x07, 0x61, 0x43, 0x23, 0xF2, 0x25, 0xFC, 0xE0, 0x83, 0x02, 0xA3, + 0x11, 0x60, 0xF0, 0x61, 0x00, 0x60, 0x4A, 0x64, 0x59, 0xD1, 0x58, 0xD8, 0x7E, 0x3A, 0x02, 0x00, + 0x00, 0xF4, 0x02, 0x64, 0xF9, 0x1F, 0x25, 0xF2, 0x23, 0xF2, 0x01, 0xB0, 0xCC, 0x84, 0x04, 0x02, + 0x23, 0xFA, 0x02, 0x00, 0x00, 0x64, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x41, 0x4B, + 0x65, 0x42, 0x80, 0x64, 0xD4, 0x85, 0x2B, 0x41, 0x00, 0xA1, 0x55, 0x8B, 0x0D, 0x03, 0x02, 0x04, + 0x65, 0x41, 0x02, 0x00, 0x00, 0x64, 0x40, 0x4B, 0xCA, 0x84, 0x58, 0xD0, 0xC9, 0x81, 0xBD, 0xD9, + 0xFC, 0x02, 0x00, 0xF4, 0x04, 0x65, 0xEC, 0x01, 0x2F, 0x58, 0xFF, 0xFF, 0xFC, 0xA3, 0xA3, 0xD3, + 0x02, 0x7C, 0xA0, 0xD3, 0x23, 0xF8, 0xDC, 0x84, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x02, 0x64, 0x23, 0xFA, 0x01, 0x64, 0x9D, 0xFE, 0x02, 0x28, 0x02, 0x64, 0x25, 0xFA, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x21, 0x60, 0x80, 0x62, 0xA2, 0xD3, 0x02, 0x7C, 0x23, 0xF8, 0x01, 0xB4, + 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xFC, 0xA3, 0xA3, 0xD1, 0x02, 0x64, 0x23, 0xFA, + 0x64, 0x44, 0x7C, 0x5F, 0x60, 0x45, 0x64, 0x47, 0x7C, 0x5F, 0x89, 0xF1, 0x66, 0x41, 0xC0, 0x86, + 0xA5, 0xD2, 0x61, 0x46, 0x00, 0x63, 0x60, 0x40, 0x0A, 0x37, 0x01, 0x63, 0x14, 0x37, 0x02, 0x63, + 0x37, 0x37, 0x06, 0x63, 0x6E, 0x37, 0x0B, 0x63, 0x25, 0xFC, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x02, 0x64, 0x23, 0xFA, 0x88, 0xFF, 0x75, 0x44, 0x8D, 0xFF, 0xE8, 0x87, 0xE8, 0x84, 0xE8, 0x84, + 0x03, 0xB4, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x25, 0xF0, 0x21, 0x60, 0x7C, 0x65, + 0x23, 0xF2, 0xA5, 0xD9, 0x02, 0xA8, 0x64, 0x44, 0x07, 0x02, 0x00, 0xBC, 0xF2, 0xA4, 0x04, 0x03, + 0x03, 0x07, 0x1F, 0x60, 0xAA, 0x62, 0xA2, 0xD9, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x20, 0x63, + 0x20, 0x60, 0x0A, 0x61, 0x48, 0x64, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x25, 0xF0, 0x20, 0x64, + 0xD0, 0x81, 0xFF, 0xFF, 0x02, 0x07, 0x25, 0xFA, 0x0F, 0x00, 0x20, 0x60, 0x0E, 0x63, 0xC3, 0x83, + 0x01, 0x2A, 0x06, 0x00, 0xCF, 0x83, 0xA3, 0xD3, 0xCD, 0x81, 0x00, 0x7F, 0xBD, 0xDB, 0x04, 0x03, + 0x00, 0x64, 0xC9, 0x81, 0xBD, 0xDB, 0xFD, 0x02, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, + 0x25, 0xF0, 0x01, 0x60, 0x70, 0x63, 0xA3, 0xD9, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xFC, 0xA3, + 0xA5, 0xF0, 0xA3, 0xD1, 0xFF, 0xFF, 0x64, 0x5E, 0x00, 0x7F, 0x60, 0x41, 0x64, 0x47, 0x7C, 0x5F, + 0x89, 0xF1, 0x66, 0x43, 0xC0, 0x86, 0x65, 0x44, 0xA1, 0xDA, 0x63, 0x46, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0xFC, 0xA3, 0xA3, 0xD1, 0xFF, 0xFF, 0x64, 0x5E, 0x00, 0x7F, 0x60, 0x45, 0x64, 0x47, + 0x7C, 0x5F, 0x89, 0xF1, 0x66, 0x41, 0xC0, 0x86, 0x65, 0x44, 0xA0, 0xD2, 0x61, 0x46, 0x25, 0xFA, + 0x02, 0x64, 0x23, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, 0x25, 0xF0, 0x02, 0xA8, + 0x00, 0x67, 0x02, 0x02, 0x2D, 0xF9, 0x2C, 0xF9, 0x23, 0x58, 0xFF, 0xFF, 0x1F, 0x60, 0xA8, 0x61, + 0x23, 0xF2, 0x25, 0xF2, 0x02, 0xA8, 0x00, 0xA8, 0x09, 0x02, 0x07, 0x03, 0xD0, 0xA0, 0x30, 0x65, + 0x03, 0x04, 0xA7, 0xA0, 0x59, 0x65, 0x01, 0x06, 0x65, 0x44, 0xA1, 0xDB, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x04, 0x61, 0x0A, 0x00, 0x25, 0x60, 0x2C, 0x61, 0x01, 0x64, 0xA1, 0xDB, 0x04, 0x00, + 0x25, 0x60, 0x2C, 0x61, 0x00, 0x64, 0xA1, 0xDB, 0x06, 0x61, 0x41, 0x56, 0xC7, 0xFE, 0xEB, 0x60, + 0x84, 0x78, 0xFF, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xA2, 0xFF, 0x46, 0x45, 0x02, 0xF0, + 0x09, 0x60, 0x08, 0x64, 0xD0, 0x80, 0x00, 0xF4, 0x01, 0xF2, 0x66, 0x5C, 0x25, 0x46, 0x56, 0x02, + 0x70, 0x27, 0x54, 0x00, 0x12, 0x64, 0x03, 0xFA, 0x04, 0xF8, 0x0E, 0xF2, 0x87, 0xFC, 0x8D, 0xFC, + 0x8E, 0xFC, 0xDA, 0x82, 0x16, 0x61, 0x00, 0x63, 0xC9, 0x81, 0x5A, 0xDC, 0xFD, 0x02, 0x60, 0x40, + 0xF0, 0x3B, 0x16, 0x00, 0x32, 0x44, 0x8F, 0xF3, 0x01, 0xB0, 0xF6, 0xA0, 0x08, 0x24, 0x2C, 0x05, + 0xDC, 0x83, 0xF0, 0x67, 0x0E, 0xFA, 0x1B, 0x60, 0xC4, 0x64, 0x2B, 0xDB, 0x66, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0x8F, 0xFD, 0x2B, 0xFF, 0xFE, 0x64, 0x3B, 0x42, 0x4A, 0xDB, 0x4F, 0x00, + 0x90, 0xF3, 0x0A, 0x65, 0xD4, 0x80, 0xDC, 0x83, 0x17, 0x05, 0x90, 0xFD, 0x98, 0xFE, 0x04, 0x04, + 0x00, 0x7F, 0x08, 0x7E, 0x0E, 0xFA, 0x3B, 0xFF, 0x1B, 0x60, 0xB8, 0x64, 0x2B, 0xDB, 0x66, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0x0E, 0xF2, 0x2B, 0xFF, 0x60, 0x40, 0x08, 0x26, 0xF7, 0xFE, + 0xFD, 0x64, 0x3B, 0x42, 0x4A, 0xDB, 0x32, 0x00, 0x8C, 0xF3, 0xFF, 0xFF, 0xD8, 0xA0, 0xFF, 0xFF, + 0x0D, 0x04, 0x1B, 0x60, 0xD0, 0x64, 0x2B, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0xFC, 0x64, 0x3B, 0x42, 0x4A, 0xDB, 0x21, 0x00, 0x46, 0x45, 0x00, 0x64, + 0x2B, 0xDB, 0x25, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xA2, 0xFF, + 0x00, 0xF4, 0x01, 0xF0, 0x0A, 0x18, 0x70, 0x67, 0xA0, 0x80, 0xF0, 0x67, 0x06, 0x03, 0xC0, 0x84, + 0x01, 0xFA, 0x25, 0x46, 0x25, 0x44, 0x80, 0xFC, 0x05, 0xFA, 0xB4, 0x60, 0x58, 0x4E, 0x48, 0x78, + 0xFF, 0xFF, 0xD4, 0xFE, 0xA3, 0xFF, 0xFF, 0x64, 0x3B, 0x42, 0x4A, 0xDB, 0xD4, 0xFE, 0xA3, 0xFF, + 0x2D, 0x58, 0xFF, 0xFF, 0x1B, 0x60, 0xBE, 0x64, 0x40, 0x47, 0x58, 0x4F, 0x0D, 0x00, 0x1B, 0x60, + 0xB2, 0x64, 0x40, 0x47, 0x58, 0x4F, 0x18, 0x00, 0x1B, 0x60, 0xCA, 0x64, 0x40, 0x47, 0x58, 0x4F, + 0x03, 0x00, 0xEB, 0x60, 0x84, 0x78, 0xFF, 0xFF, 0x27, 0xD5, 0x0E, 0xF2, 0x0B, 0x18, 0x60, 0x40, + 0x01, 0x2A, 0x08, 0x00, 0x1B, 0x60, 0xE0, 0x64, 0x40, 0x4B, 0xF0, 0x60, 0x58, 0x4D, 0x75, 0x78, + 0xFF, 0xFF, 0xF2, 0x01, 0x2F, 0x58, 0xFF, 0xFF, 0x27, 0xD5, 0x0E, 0xF2, 0x14, 0x18, 0x60, 0x40, + 0x01, 0x2A, 0x11, 0x00, 0x02, 0xF0, 0x09, 0x60, 0x08, 0x64, 0xD0, 0x80, 0xA2, 0xFF, 0x90, 0xF3, + 0x02, 0x02, 0xCC, 0x84, 0x90, 0xFB, 0x1B, 0x60, 0xE0, 0x64, 0x40, 0x4B, 0xF0, 0x60, 0x58, 0x4D, + 0x75, 0x78, 0xFF, 0xFF, 0xE9, 0x01, 0x2F, 0x58, 0xFF, 0xFF, 0xFB, 0x64, 0x3A, 0x42, 0x4A, 0xDB, + 0xA2, 0xFF, 0x93, 0xF3, 0x8F, 0xF3, 0xCC, 0x80, 0xFA, 0xA0, 0x01, 0x14, 0x1E, 0x05, 0xB3, 0x60, + 0x58, 0x4D, 0x4E, 0x78, 0xFF, 0xFF, 0xA2, 0xFF, 0x18, 0x03, 0xF0, 0x67, 0x0E, 0xFA, 0x1B, 0x60, + 0xE0, 0x62, 0x1B, 0x60, 0xC4, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0xF6, 0x64, 0x3A, 0x42, 0x4A, 0xDB, 0x93, 0xF3, 0x8F, 0xF3, 0xCC, 0x83, + 0xDC, 0x84, 0x01, 0x15, 0x93, 0xFD, 0x8F, 0xFB, 0xD4, 0xFE, 0x92, 0xF3, 0x90, 0xF3, 0x00, 0xA8, + 0x91, 0xF1, 0x03, 0x02, 0xD0, 0x80, 0xFF, 0xFF, 0x27, 0x05, 0xB3, 0x60, 0x58, 0x4D, 0x4E, 0x78, + 0xFF, 0xFF, 0xA2, 0xFF, 0x21, 0x03, 0x00, 0x63, 0x92, 0xF3, 0x0E, 0xFC, 0xCC, 0x84, 0xFF, 0x3A, + 0x92, 0xFB, 0x98, 0xFE, 0x03, 0x04, 0x08, 0xBB, 0x0E, 0xFC, 0x3B, 0xFF, 0x1B, 0x60, 0xE0, 0x62, + 0x1B, 0x60, 0xB8, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0xF7, 0x64, 0x3A, 0x42, 0x4A, 0xDB, 0x90, 0xF3, 0x0E, 0xF2, 0xDC, 0x83, 0x08, 0xB0, + 0x90, 0xFD, 0x08, 0x28, 0xF7, 0xFE, 0xD4, 0xFE, 0xA3, 0xFF, 0xEB, 0x60, 0x84, 0x78, 0xFF, 0xFF, + 0xB9, 0xFE, 0x13, 0xFF, 0x24, 0x40, 0x80, 0x2B, 0x0B, 0x00, 0xA2, 0xFF, 0x25, 0x46, 0x09, 0xF4, + 0x0E, 0xF2, 0x05, 0x18, 0x08, 0xBC, 0x0E, 0xFA, 0xFF, 0xFF, 0xF7, 0xFE, 0x01, 0x00, 0xD8, 0xFE, + 0xA3, 0xFF, 0x25, 0x46, 0x3E, 0xF2, 0x00, 0xF4, 0x08, 0xF0, 0x25, 0x46, 0x06, 0xB4, 0xFF, 0x7F, + 0x10, 0xBC, 0x06, 0x26, 0xFD, 0x7F, 0x0E, 0xFA, 0x3E, 0xF2, 0x3F, 0xF2, 0x60, 0x41, 0x08, 0x2A, + 0x64, 0x47, 0x3F, 0xFA, 0x60, 0x45, 0x1F, 0x60, 0x62, 0x62, 0xA2, 0xD3, 0xA3, 0xFC, 0xAB, 0xFC, + 0x91, 0xFC, 0xD4, 0x80, 0xE0, 0x60, 0xC1, 0x65, 0xA5, 0x80, 0x01, 0x04, 0x07, 0x03, 0x23, 0xF0, + 0x08, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0xF2, 0x60, 0x25, 0x78, 0xFF, 0xFF, 0xF4, 0x60, 0x58, 0x4F, + 0x2D, 0x78, 0xFF, 0xFF, 0x14, 0x04, 0x23, 0xF0, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0x98, 0xF1, + 0x1E, 0x60, 0xFC, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, + 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x02, 0x00, 0x20, 0x60, 0x00, 0x75, 0x46, 0x00, 0x3E, 0xF0, + 0x89, 0xF1, 0x64, 0x47, 0x07, 0xB4, 0x07, 0x36, 0x3B, 0x00, 0x04, 0x03, 0xCC, 0x84, 0xE0, 0x84, + 0xC0, 0x83, 0x2D, 0x00, 0x2C, 0xF2, 0x88, 0xF1, 0x01, 0xB0, 0x64, 0x43, 0x35, 0x02, 0x2E, 0xF2, + 0x12, 0x60, 0xCE, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, + 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x2E, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, + 0x0C, 0x02, 0x61, 0x46, 0x2D, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, + 0x2C, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, + 0xE8, 0x1B, 0x88, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x01, 0x03, 0x09, 0x00, 0x66, 0x45, + 0x63, 0x46, 0x06, 0xF0, 0x65, 0x46, 0x64, 0x44, 0x0C, 0x26, 0x02, 0x00, 0x02, 0x26, 0x04, 0x00, + 0x23, 0xF0, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0x07, 0xFC, 0x23, 0xF2, 0xFF, 0xFF, 0x10, 0x1B, + 0x1B, 0x60, 0xE0, 0x62, 0x1B, 0x60, 0x9A, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x0E, 0xF2, 0xC8, 0xFE, 0x10, 0xAC, 0x0E, 0xFA, 0x0F, 0x00, + 0x1B, 0x60, 0xE0, 0x62, 0x1B, 0x60, 0xAC, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x0E, 0xF2, 0xCE, 0xFE, 0x10, 0xAC, 0x0E, 0xFA, 0xEB, 0x60, + 0x84, 0x78, 0xFF, 0xFF, 0xCB, 0x84, 0xC9, 0x83, 0xFF, 0xFF, 0x08, 0x04, 0x58, 0xD1, 0xA5, 0xD8, + 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0xF8, 0x1F, 0x2F, 0x58, 0xFF, 0xFF, + 0x25, 0xF0, 0x21, 0x60, 0x2C, 0x62, 0xA2, 0xD9, 0x19, 0x00, 0x21, 0x60, 0x80, 0x64, 0xA0, 0xD1, + 0x7F, 0xF9, 0x0C, 0x60, 0x38, 0x62, 0x40, 0x63, 0x00, 0x64, 0x5A, 0xDB, 0xFE, 0x1F, 0x64, 0x40, + 0x01, 0x2A, 0x0C, 0x00, 0x04, 0x65, 0x0C, 0x60, 0x38, 0x61, 0x48, 0x64, 0x3E, 0x63, 0x7C, 0xA8, + 0x58, 0xD0, 0x59, 0xD9, 0x02, 0x02, 0x00, 0xF4, 0x02, 0x64, 0xF9, 0x1F, 0x21, 0x60, 0x2C, 0x62, + 0xA2, 0xD1, 0x0D, 0x60, 0x1C, 0x65, 0x02, 0xFE, 0x64, 0x44, 0xF8, 0x84, 0xF8, 0x84, 0xF8, 0x87, + 0x60, 0x41, 0x64, 0x44, 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x84, 0x3E, 0xFB, 0x60, 0x42, 0x61, 0x44, + 0x03, 0xA2, 0x60, 0xFE, 0xA2, 0xDB, 0xFF, 0xFF, 0x20, 0xFE, 0x64, 0x44, 0x0C, 0x60, 0x3A, 0x65, + 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x84, 0x40, 0xFB, 0xFF, 0xFF, 0x00, 0x67, + 0x00, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x21, 0x60, 0x80, 0x64, 0xA0, 0xD1, 0x7F, 0xF9, 0x00, 0x64, + 0x40, 0x41, 0x64, 0x40, 0x01, 0x2A, 0xA6, 0x00, 0x4A, 0x64, 0xA0, 0xD2, 0xFF, 0xFF, 0x40, 0x42, + 0x80, 0x2B, 0x04, 0x00, 0xFF, 0xB4, 0x40, 0x42, 0x01, 0x64, 0x40, 0x41, 0x88, 0xF3, 0x46, 0x4B, + 0x87, 0xF3, 0x60, 0x46, 0xE0, 0x83, 0xAB, 0x46, 0x26, 0xF0, 0xAB, 0x46, 0x55, 0xF8, 0xAB, 0x46, + 0x27, 0xF0, 0xAB, 0x46, 0x56, 0xF8, 0xAB, 0x46, 0x28, 0xF0, 0xAB, 0x46, 0x57, 0xF8, 0x66, 0x44, + 0x02, 0xA6, 0xF1, 0x1F, 0x88, 0xF3, 0xFF, 0xFF, 0x60, 0x46, 0xAB, 0x46, 0x0C, 0x60, 0x7A, 0x65, + 0x22, 0x44, 0xFF, 0xB4, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x81, 0xC9, 0x81, + 0x52, 0x64, 0x0E, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x21, 0x44, 0x01, 0x2A, 0x08, 0x00, + 0xAB, 0x46, 0xF0, 0xA1, 0x6E, 0x64, 0x0E, 0x63, 0x59, 0xD1, 0x58, 0xD8, 0xFD, 0x1F, 0xAB, 0x46, + 0x22, 0x44, 0xFF, 0xB4, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0x0C, 0x60, 0xDC, 0x65, 0xC4, 0x81, + 0x60, 0x45, 0xC9, 0x81, 0x62, 0x64, 0x06, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x21, 0x44, + 0x01, 0x2A, 0x08, 0x00, 0xAB, 0x46, 0xF8, 0xA1, 0xAE, 0x64, 0x06, 0x63, 0x59, 0xD1, 0x58, 0xD8, + 0xFD, 0x1F, 0xAB, 0x46, 0x65, 0x44, 0x0C, 0x60, 0xFC, 0x65, 0xC4, 0x81, 0xC9, 0x81, 0x6A, 0x64, + 0x06, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x22, 0x44, 0xFF, 0xB4, 0xE0, 0x84, 0xE0, 0x85, + 0xC4, 0x84, 0x0C, 0x60, 0xC2, 0x65, 0xC4, 0x81, 0x72, 0x64, 0x04, 0x63, 0x58, 0xD0, 0x59, 0xD9, + 0xFD, 0x1F, 0xAB, 0x46, 0x21, 0x44, 0x01, 0x2A, 0x06, 0x00, 0xFA, 0xA1, 0x88, 0x64, 0x04, 0x63, + 0x59, 0xD1, 0x58, 0xD8, 0xFD, 0x1F, 0x37, 0xF0, 0x21, 0x44, 0x01, 0x2A, 0x13, 0x00, 0x22, 0x44, + 0x3D, 0xFB, 0x60, 0x41, 0x02, 0xFE, 0xF8, 0x84, 0xF8, 0x84, 0xF8, 0x84, 0x3C, 0xFB, 0x0C, 0x60, + 0xBE, 0x63, 0x88, 0xFF, 0xCD, 0x81, 0x06, 0xA3, 0xFD, 0x0D, 0x8D, 0xFF, 0x3B, 0xFD, 0x64, 0x47, + 0x80, 0xBF, 0x60, 0x5C, 0x22, 0x43, 0x80, 0x61, 0x88, 0xFF, 0xCF, 0x83, 0xE1, 0x81, 0xFD, 0x0D, + 0x8D, 0xFF, 0x61, 0x47, 0x31, 0x91, 0xB1, 0x84, 0x37, 0xFA, 0x87, 0xF3, 0xFF, 0xFF, 0xCC, 0x83, + 0xE3, 0x83, 0x66, 0x44, 0x02, 0xA6, 0x37, 0xF0, 0x66, 0x44, 0xB1, 0x9C, 0x37, 0xF8, 0x02, 0xA6, + 0xFA, 0x1F, 0xAB, 0x46, 0x00, 0x67, 0x00, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, 0x25, 0xF0, + 0x02, 0xA8, 0x00, 0x67, 0x24, 0x02, 0x3D, 0xF1, 0x64, 0x44, 0x03, 0xB4, 0x40, 0x42, 0xD0, 0x80, + 0x88, 0xF3, 0xFF, 0xFF, 0x60, 0x46, 0xB7, 0xF4, 0x80, 0x61, 0x02, 0x02, 0xE3, 0x83, 0xEB, 0x83, + 0x22, 0x44, 0x88, 0xFF, 0xCC, 0x84, 0xE1, 0x81, 0xFD, 0x0D, 0x8D, 0xFF, 0x61, 0x47, 0x31, 0x91, + 0x9D, 0x85, 0xA7, 0x83, 0x37, 0xFC, 0x87, 0xF3, 0xFF, 0xFF, 0xCC, 0x83, 0xE3, 0x83, 0x66, 0x44, + 0x02, 0xA6, 0xB7, 0xF2, 0x66, 0x44, 0xA5, 0x81, 0xB7, 0xFA, 0x02, 0xA6, 0xFA, 0x1F, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x11, 0x64, 0x23, 0xFA, 0x25, 0x44, 0x24, 0xFA, 0x04, 0x64, 0x40, 0x4B, + 0x62, 0x41, 0x0C, 0x60, 0xC2, 0x64, 0x04, 0x63, 0x58, 0xD1, 0x59, 0xD8, 0xFD, 0x1F, 0x2B, 0x43, + 0x00, 0x7C, 0x59, 0xD8, 0x4F, 0x8B, 0x06, 0xA4, 0xF6, 0x02, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x21, 0x60, 0x80, 0x64, 0xA0, 0xD1, 0x7F, 0xF9, 0x64, 0x40, 0x01, 0x2A, 0x4E, 0x00, 0x27, 0xF2, + 0x12, 0x60, 0xCE, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, + 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x27, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, + 0x0C, 0x02, 0x61, 0x46, 0x26, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, + 0x25, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, + 0xE8, 0x1B, 0x88, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x01, 0x03, 0x2A, 0x00, 0x43, 0x4B, + 0xAB, 0x46, 0x37, 0xF2, 0x80, 0x60, 0x30, 0x7C, 0xB0, 0x84, 0xA2, 0xDA, 0x4E, 0x61, 0x6E, 0x64, + 0x0E, 0x63, 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0x58, 0xD8, 0xFB, 0x1F, 0x88, 0x64, 0x04, 0x63, + 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0x58, 0xD8, 0xFB, 0x1F, 0xD9, 0x81, 0x98, 0x64, 0x04, 0x63, + 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0x58, 0xD8, 0xFB, 0x1F, 0xD9, 0x81, 0xAE, 0x64, 0x0E, 0x63, + 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0x58, 0xD8, 0xFB, 0x1F, 0x00, 0x67, 0x00, 0x61, 0x23, 0x58, + 0xFF, 0xFF, 0x01, 0x67, 0x20, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x21, 0x60, 0x80, 0x64, 0xA0, 0xD1, + 0x7F, 0xF9, 0x64, 0x40, 0x01, 0x2A, 0x31, 0x00, 0x27, 0xF2, 0x12, 0x60, 0xCE, 0x65, 0x60, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, + 0x61, 0x46, 0x27, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x26, 0xF0, + 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x25, 0xF0, 0x63, 0x46, 0xD0, 0x80, + 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0x88, 0xF3, 0x08, 0xFE, + 0x60, 0x43, 0x61, 0x46, 0x01, 0x03, 0x0D, 0x00, 0x43, 0x4B, 0xAB, 0x46, 0x37, 0xF2, 0x80, 0x60, + 0x30, 0x61, 0x9D, 0x85, 0xA4, 0x84, 0xA2, 0xDA, 0xAB, 0x46, 0x00, 0x67, 0x00, 0x61, 0x23, 0x58, + 0xFF, 0xFF, 0x01, 0x67, 0x20, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x3E, 0xF2, 0xAC, 0xF1, 0x08, 0xB0, + 0x19, 0xF8, 0x4A, 0x02, 0x07, 0x23, 0x2B, 0x00, 0x60, 0x47, 0x07, 0xB4, 0x89, 0xF1, 0xCC, 0x84, + 0xE0, 0x84, 0x40, 0x8A, 0xAA, 0x46, 0x03, 0xF2, 0x04, 0xF0, 0x05, 0xF2, 0x60, 0x43, 0xAA, 0x46, + 0x2C, 0xFC, 0x2D, 0xF8, 0x2E, 0xFA, 0xCB, 0xF1, 0x2F, 0xF8, 0xCC, 0xF1, 0x30, 0xF8, 0xCD, 0xF1, + 0x31, 0xF8, 0x46, 0x4A, 0x00, 0xF4, 0x02, 0xF2, 0x03, 0xF0, 0x04, 0xF2, 0x60, 0x43, 0xAA, 0x46, + 0x32, 0xFC, 0x33, 0xF8, 0x34, 0xFA, 0xAA, 0x46, 0x05, 0xF2, 0x06, 0xF0, 0x07, 0xF2, 0x60, 0x43, + 0xAA, 0x46, 0x36, 0xFC, 0x37, 0xF8, 0x38, 0xFA, 0x03, 0x60, 0x08, 0x64, 0x1C, 0x00, 0x67, 0xF1, + 0x2F, 0xF8, 0x68, 0xF1, 0x30, 0xF8, 0x69, 0xF1, 0x31, 0xF8, 0x46, 0x4A, 0x00, 0xF4, 0x02, 0xF2, + 0x03, 0xF0, 0x04, 0xF2, 0x60, 0x43, 0xAA, 0x46, 0x2C, 0xFC, 0x2D, 0xF8, 0x2E, 0xFA, 0xAA, 0x46, + 0x05, 0xF2, 0x06, 0xF0, 0x07, 0xF2, 0x60, 0x43, 0xAA, 0x46, 0x32, 0xFC, 0x33, 0xF8, 0x34, 0xFA, + 0x02, 0x60, 0x08, 0x64, 0x00, 0x00, 0x2A, 0xFA, 0x02, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x28, 0xF3, + 0xFF, 0xFF, 0x60, 0x47, 0x0F, 0xB4, 0x59, 0x00, 0xFF, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x1C, 0x60, + 0x04, 0x65, 0x04, 0x64, 0xA5, 0xDB, 0x12, 0x00, 0x1C, 0x60, 0x04, 0x65, 0x0C, 0x64, 0xA5, 0xDB, + 0x0D, 0x00, 0x1C, 0x60, 0x04, 0x65, 0x06, 0x64, 0xA5, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x1C, 0x60, 0x04, 0x65, 0x08, 0x64, 0xA5, 0xDB, 0xF4, 0x60, 0xD9, 0x64, + 0x80, 0xFB, 0xFF, 0xFF, 0x2D, 0xFF, 0xEB, 0x60, 0x84, 0x78, 0xFF, 0xFF, 0x29, 0xF3, 0x65, 0xFB, + 0x83, 0xFB, 0x02, 0x60, 0xEE, 0x64, 0x82, 0xFB, 0x07, 0x64, 0x84, 0xFB, 0xF4, 0x60, 0xD9, 0x64, + 0x80, 0xFB, 0xFF, 0xFF, 0xDF, 0xFE, 0x00, 0x64, 0x19, 0xFF, 0xEB, 0x60, 0x84, 0x78, 0xFF, 0xFF, + 0xAF, 0x60, 0xFD, 0x63, 0x0C, 0x60, 0x16, 0x64, 0xA0, 0xDD, 0x62, 0xFF, 0xF4, 0x60, 0xC6, 0x63, + 0x80, 0xFD, 0xFF, 0xFF, 0x1A, 0xFF, 0xEB, 0x60, 0x84, 0x78, 0xFF, 0xFF, 0xA7, 0x60, 0x9B, 0x63, + 0x0C, 0x60, 0x16, 0x64, 0xA0, 0xDD, 0x62, 0xFF, 0x29, 0xF5, 0x1B, 0x60, 0xE0, 0x63, 0x1B, 0x60, + 0xB2, 0x64, 0xBD, 0xDB, 0x66, 0x44, 0xBD, 0xDB, 0x02, 0x64, 0xA3, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xF9, 0xFE, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xA7, 0x01, 0x00, 0x36, 0xA8, 0x01, 0x01, 0x36, + 0xAB, 0x01, 0x02, 0x36, 0xAE, 0x01, 0x03, 0x36, 0xB5, 0x01, 0x04, 0x36, 0xD1, 0x01, 0x05, 0x36, + 0xCF, 0x01, 0x06, 0x36, 0xF1, 0x01, 0x07, 0x36, 0xCB, 0x01, 0x08, 0x36, 0xB7, 0x01, 0x09, 0x36, + 0x0C, 0x00, 0x0A, 0x36, 0x0D, 0x00, 0x0B, 0x36, 0x0E, 0x00, 0x0C, 0x36, 0x17, 0x00, 0x0D, 0x36, + 0x0D, 0x00, 0x0E, 0x36, 0x1E, 0x00, 0x0F, 0x36, 0x32, 0x00, 0x02, 0x60, 0x00, 0x64, 0x08, 0x00, + 0x04, 0x60, 0x00, 0x64, 0x05, 0x00, 0x00, 0x60, 0x01, 0x64, 0x02, 0x00, 0x20, 0x60, 0x00, 0x64, + 0x32, 0x45, 0xB4, 0x85, 0x45, 0x52, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xB0, 0x60, 0xC1, 0x63, + 0x0C, 0x60, 0x16, 0x64, 0xA0, 0xDD, 0x62, 0xFF, 0xFF, 0xFF, 0x1A, 0xFF, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x3F, 0x40, 0x02, 0x2B, 0x05, 0x00, 0x90, 0x60, 0x00, 0xE8, 0xAF, 0x60, 0xFD, 0x63, + 0x04, 0x00, 0x91, 0x60, 0x00, 0xE8, 0xB0, 0x60, 0xAB, 0x63, 0x28, 0xE8, 0x0C, 0x60, 0x16, 0x64, + 0xA0, 0xDD, 0x62, 0xFF, 0xFF, 0xFF, 0x1A, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x91, 0x60, + 0x00, 0xE8, 0x28, 0xE8, 0xD9, 0x60, 0xFE, 0x64, 0x32, 0x45, 0xA4, 0x85, 0x45, 0x52, 0x99, 0xFF, + 0xA5, 0x4F, 0xFF, 0xB4, 0x07, 0xFB, 0x98, 0xFF, 0xA7, 0x60, 0x9B, 0x63, 0x0C, 0x60, 0x16, 0x64, + 0xA0, 0xDD, 0x62, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x42, 0x6F, 0x6F, 0x74, 0x63, 0x6F, + 0x64, 0x65, 0x20, 0x21, 0x21, 0x20, 0x20, 0x00, 0x53, 0x54, 0x41, 0x2F, 0x41, 0x50, 0x20, 0x46, + 0x75, 0x6E, 0x63, 0x27, 0x73, 0x00, 0x20, 0x00, 0x02, 0x00, 0x02, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x02, 0x00, 0x02, 0x00, 0x04, 0x00, 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, 0x06, 0x00, + 0x07, 0x00, 0x05, 0x00, 0x06, 0x00, 0x07, 0x00, 0x06, 0x00, 0x06, 0x00, 0x07, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, + 0x40, 0x00, 0x32, 0x00, 0x32, 0x00, 0x0A, 0x00, 0x02, 0x00, 0x06, 0x00, 0x40, 0x00, 0x32, 0x00, + 0x36, 0x00, 0x0A, 0x00, 0x02, 0x00, 0x06, 0x00, 0x40, 0x00, 0x3B, 0x00, 0x40, 0x00, 0x17, 0x00, + 0x07, 0x00, 0x07, 0x00, 0x4A, 0x00, 0x40, 0x00, 0x4A, 0x00, 0x1E, 0x00, 0x0C, 0x00, 0x08, 0x00, + 0x57, 0x00, 0x4D, 0x00, 0x57, 0x00, 0x2B, 0x00, 0x19, 0x00, 0x08, 0x00, 0x5D, 0x00, 0x53, 0x00, + 0x5D, 0x00, 0x31, 0x00, 0x1F, 0x00, 0x08, 0x00, + +}; /* fw_image_4_data */ + +static const CFG_IDENTITY_STRCT fw_image_infoidentity[] = { + { + sizeof( CFG_IDENTITY_STRCT ) / sizeof(hcf_16) - 1, + CFG_FW_IDENTITY, + COMP_ID_FW_AP, + 2, //Variant + 2, //Major + 36 //Minor + }, + { 0000, 0000, 0000, 0000, 0000, 0000 } //endsentinel +}; + +static const CFG_PROG_STRCT fw_image_code[] = { + { + 8, + CFG_PROG, + CFG_PROG_VOLATILE, // mode + 0x0146, // sizeof(fw_image_1_data), + 0x00000060, // Target address in NIC Memory + 0x0000, // CRC: yes/no TYPE: primary/station/tertiary + (hcf_8 FAR *) fw_image_1_data + }, + { + 8, + CFG_PROG, + CFG_PROG_VOLATILE, // mode + 0x1918, // sizeof(fw_image_2_data), + 0x00000C16, // Target address in NIC Memory + 0x0000, // CRC: yes/no TYPE: primary/station/tertiary + (hcf_8 FAR *) fw_image_2_data + }, + { + 8, + CFG_PROG, + CFG_PROG_VOLATILE, // mode + 0x01bc, // sizeof(fw_image_3_data), + 0x001E252E, // Target address in NIC Memory + 0x0000, // CRC: yes/no TYPE: primary/station/tertiary + (hcf_8 FAR *) fw_image_3_data + }, + { + 8, + CFG_PROG, + CFG_PROG_VOLATILE, // mode + 0xab28, // sizeof(fw_image_4_data), + 0x001F4000, // Target address in NIC Memory + 0x0000, // CRC: yes/no TYPE: primary/station/tertiary + (hcf_8 FAR *) fw_image_4_data + }, + { + 5, + CFG_PROG, + CFG_PROG_STOP, // mode + 0000, + 0x000F1297, // Start execution address + }, + { 0000, 0000, 0000, 0000, 00000000, 0000, 00000000} +}; + +static const CFG_RANGE20_STRCT fw_image_infocompat[] = { + { 3 + ((20 * sizeof(CFG_RANGE_SPEC_STRCT)) / sizeof(hcf_16)), + CFG_FW_SUP_RANGE, + COMP_ROLE_SUPL, + COMP_ID_APF, + { + { 2, 2, 4 } //variant, bottom, top + } + }, + { 3 + ((20 * sizeof(CFG_RANGE_SPEC_STRCT)) / sizeof(hcf_16)), + CFG_MFI_ACT_RANGES_STA, + COMP_ROLE_ACT, + COMP_ID_MFI, + { + { 4, 6, 7 }, //variant, bottom, top + { 5, 6, 7 }, //variant, bottom, top + { 6, 6, 7 } //variant, bottom, top + } + }, + { 3 + ((20 * sizeof(CFG_RANGE_SPEC_STRCT)) / sizeof(hcf_16)), + CFG_CFI_ACT_RANGES_STA, + COMP_ROLE_ACT, + COMP_ID_CFI, + { + { 2, 1, 2 } //variant, bottom, top + } + }, + { 0000, 0000, 0000, 0000, { { 0000, 0000, 0000 } } } //endsentinel +}; + +memimage fw_image = { + "FUPU7D37dhfwci\001C", //signature, , C/Bin type + (CFG_PROG_STRCT *) fw_image_code, + 0x000F1297, + 00000000, //(dummy) pdaplug + 00000000, //(dummy) priplug + (CFG_RANGE20_STRCT *) fw_image_infocompat, + (CFG_IDENTITY_STRCT *) fw_image_infoidentity, +}; + diff --git a/drivers/staging/wlags49_h2/ap_h25.c b/drivers/staging/wlags49_h2/ap_h25.c new file mode 100644 index 000000000000..f4491cbd08d3 --- /dev/null +++ b/drivers/staging/wlags49_h2/ap_h25.c @@ -0,0 +1,4094 @@ +/* + * File: ap_h54.124 + * + * Abstract: This file contains memory image 'fw_image'. + * + * Contents: Total size of the memory image: 63146 bytes. + * Total number of blocks: 4 blocks. + * Block 1 : load address 00000060, 328 bytes. + * Block 2 : load address 00000C16, 9266 bytes. + * Block 3 : load address 001E3048, 6476 bytes. + * Block 4 : load address 001F4000, 47076 bytes. + * + * Identity: component id: 32 (variant 3) version 1.24 + * + * Compatibility: + * supplying interface 8 (variant 4) : 1 - 1 + * acting on interface 1 (variant 7) : 3 - 3 + * acting on interface 1 (variant 8) : 1 - 1 + * acting on interface 2 (variant 4) : 1 - 2 + * + * Generated: by g:\fw\fupu3.exe version 4.26 + * + * Commandline: g:\fw\fupu3.exe /f=4 /n=fw_image /i=t3012400.hex + */ + + +#include "hcfcfg.h" // to get hcf_16 etc defined as well as + // possible settings which inluence mdd.h or dhf.h +#include "mdd.h" //to get COMP_ID_STA etc defined +#include "dhf.h" //used to be "fhfmem.h", to get memblock,plugrecord, + +static const hcf_8 fw_image_1_data[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x0C, 0x00, 0x00, + 0x02, 0x0D, 0x00, 0x00, 0x02, 0x0D, 0xD6, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x09, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEA, + 0x00, 0x00, 0xFF, 0x07, 0x02, 0x00, 0x64, 0x00, 0x64, 0x00, 0x10, 0x27, 0x10, 0x27, 0x14, 0x00, + 0xD0, 0x07, 0xD0, 0x07, 0x10, 0x27, 0x2F, 0x00, 0x32, 0x00, 0x32, 0x00, 0x05, 0x00, 0x02, 0x00, + 0x02, 0x00, 0x10, 0x27, 0x05, 0x00, 0x00, 0x02, 0x00, 0x02, 0x13, 0x00, 0x07, 0x00, 0x03, 0x00, + 0x32, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x09, 0x2B, 0x09, 0x2B, 0x09, 0xFF, 0x0F, + 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x01, 0x00, 0x40, 0x00, 0x32, 0x00, 0x32, 0x00, + 0x0A, 0x00, 0x02, 0x00, 0x06, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + +}; /* fw_image_1_data */ + +static const hcf_8 fw_image_2_data[] = { + 0x7C, 0xA4, 0x00, 0x16, 0x08, 0x40, 0x0F, 0xD2, 0xE1, 0x28, 0xA5, 0x7C, 0x50, 0x30, 0xF1, 0x84, + 0x44, 0x08, 0xAB, 0xAE, 0xA5, 0xB8, 0xFC, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA5, 0xC6, 0x84, 0xF8, + 0x99, 0xEE, 0x8D, 0xF6, 0x0D, 0xFF, 0xBD, 0xD6, 0xB1, 0xDE, 0x54, 0x91, 0x50, 0x60, 0x03, 0x02, + 0xA9, 0xCE, 0x7D, 0x56, 0x19, 0xE7, 0x62, 0xB5, 0xE6, 0x4D, 0x9A, 0xEC, 0x45, 0x8F, 0x9D, 0x1F, + 0x40, 0x89, 0x87, 0xFA, 0x15, 0xEF, 0xEB, 0xB2, 0xC9, 0x8E, 0x0B, 0xFB, 0xEC, 0x41, 0x67, 0xB3, + 0xFD, 0x5F, 0xEA, 0x45, 0xBF, 0x23, 0xF7, 0x53, 0x96, 0xE4, 0x5B, 0x9B, 0xC2, 0x75, 0x1C, 0xE1, + 0xAE, 0x3D, 0x6A, 0x4C, 0x5A, 0x6C, 0x41, 0x7E, 0x02, 0xF5, 0x4F, 0x83, 0x5C, 0x68, 0xF4, 0x51, + 0x34, 0xD1, 0x08, 0xF9, 0x93, 0xE2, 0x73, 0xAB, 0x53, 0x62, 0x3F, 0x2A, 0x0C, 0x08, 0x52, 0x95, + 0x65, 0x46, 0x5E, 0x9D, 0x28, 0x30, 0xA1, 0x37, 0x0F, 0x0A, 0xB5, 0x2F, 0x09, 0x0E, 0x36, 0x24, + 0x9B, 0x1B, 0x3D, 0xDF, 0x26, 0xCD, 0x69, 0x4E, 0xCD, 0x7F, 0x9F, 0xEA, 0x1B, 0x12, 0x9E, 0x1D, + 0x74, 0x58, 0x2E, 0x34, 0x2D, 0x36, 0xB2, 0xDC, 0xEE, 0xB4, 0xFB, 0x5B, 0xF6, 0xA4, 0x4D, 0x76, + 0x61, 0xB7, 0xCE, 0x7D, 0x7B, 0x52, 0x3E, 0xDD, 0x71, 0x5E, 0x97, 0x13, 0xF5, 0xA6, 0x68, 0xB9, + 0x00, 0x00, 0x2C, 0xC1, 0x60, 0x40, 0x1F, 0xE3, 0xC8, 0x79, 0xED, 0xB6, 0xBE, 0xD4, 0x46, 0x8D, + 0xD9, 0x67, 0x4B, 0x72, 0xDE, 0x94, 0xD4, 0x98, 0xE8, 0xB0, 0x4A, 0x85, 0x6B, 0xBB, 0x2A, 0xC5, + 0xE5, 0x4F, 0x16, 0xED, 0xC5, 0x86, 0xD7, 0x9A, 0x55, 0x66, 0x94, 0x11, 0xCF, 0x8A, 0x10, 0xE9, + 0x06, 0x04, 0x81, 0xFE, 0xF0, 0xA0, 0x44, 0x78, 0xBA, 0x25, 0xE3, 0x4B, 0xF3, 0xA2, 0xFE, 0x5D, + 0xC0, 0x80, 0x8A, 0x05, 0xAD, 0x3F, 0xBC, 0x21, 0x48, 0x70, 0x04, 0xF1, 0xDF, 0x63, 0xC1, 0x77, + 0x75, 0xAF, 0x63, 0x42, 0x30, 0x20, 0x1A, 0xE5, 0x0E, 0xFD, 0x6D, 0xBF, 0x4C, 0x81, 0x14, 0x18, + 0x35, 0x26, 0x2F, 0xC3, 0xE1, 0xBE, 0xA2, 0x35, 0xCC, 0x88, 0x39, 0x2E, 0x57, 0x93, 0xF2, 0x55, + 0x82, 0xFC, 0x47, 0x7A, 0xAC, 0xC8, 0xE7, 0xBA, 0x2B, 0x32, 0x95, 0xE6, 0xA0, 0xC0, 0x98, 0x19, + 0xD1, 0x9E, 0x7F, 0xA3, 0x66, 0x44, 0x7E, 0x54, 0xAB, 0x3B, 0x83, 0x0B, 0xCA, 0x8C, 0x29, 0xC7, + 0xD3, 0x6B, 0x3C, 0x28, 0x79, 0xA7, 0xE2, 0xBC, 0x1D, 0x16, 0x76, 0xAD, 0x3B, 0xDB, 0x56, 0x64, + 0x4E, 0x74, 0x1E, 0x14, 0xDB, 0x92, 0x0A, 0x0C, 0x6C, 0x48, 0xE4, 0xB8, 0x5D, 0x9F, 0x6E, 0xBD, + 0xEF, 0x43, 0xA6, 0xC4, 0xA8, 0x39, 0xA4, 0x31, 0x37, 0xD3, 0x8B, 0xF2, 0x32, 0xD5, 0x43, 0x8B, + 0x59, 0x6E, 0xB7, 0xDA, 0x8C, 0x01, 0x64, 0xB1, 0xD2, 0x9C, 0xE0, 0x49, 0xB4, 0xD8, 0xFA, 0xAC, + 0x07, 0xF3, 0x25, 0xCF, 0xAF, 0xCA, 0x8E, 0xF4, 0xE9, 0x47, 0x18, 0x10, 0xD5, 0x6F, 0x88, 0xF0, + 0x6F, 0x4A, 0x72, 0x5C, 0x24, 0x38, 0xF1, 0x57, 0xC7, 0x73, 0x51, 0x97, 0x23, 0xCB, 0x7C, 0xA1, + 0x9C, 0xE8, 0x21, 0x3E, 0xDD, 0x96, 0xDC, 0x61, 0x86, 0x0D, 0x85, 0x0F, 0x90, 0xE0, 0x42, 0x7C, + 0xC4, 0x71, 0xAA, 0xCC, 0xD8, 0x90, 0x05, 0x06, 0x01, 0xF7, 0x12, 0x1C, 0xA3, 0xC2, 0x5F, 0x6A, + 0xF9, 0xAE, 0xD0, 0x69, 0x91, 0x17, 0x58, 0x99, 0x27, 0x3A, 0xB9, 0x27, 0x38, 0xD9, 0x13, 0xEB, + 0xB3, 0x2B, 0x33, 0x22, 0xBB, 0xD2, 0x70, 0xA9, 0x89, 0x07, 0xA7, 0x33, 0xB6, 0x2D, 0x22, 0x3C, + 0x92, 0x15, 0x20, 0xC9, 0x49, 0x87, 0xFF, 0xAA, 0x78, 0x50, 0x7A, 0xA5, 0x8F, 0x03, 0xF8, 0x59, + 0x80, 0x09, 0x17, 0x1A, 0xDA, 0x65, 0x31, 0xD7, 0xC6, 0x84, 0xB8, 0xD0, 0xC3, 0x82, 0xB0, 0x29, + 0x77, 0x5A, 0x11, 0x1E, 0xCB, 0x7B, 0xFC, 0xA8, 0xD6, 0x6D, 0x3A, 0x2C, 0x00, 0x30, 0x00, 0x31, + 0x00, 0x33, 0x00, 0x34, 0x00, 0x35, 0x00, 0x36, 0x00, 0x37, 0x00, 0x38, 0x00, 0x38, 0x00, 0x3A, + 0x00, 0x3B, 0x00, 0x3C, 0x00, 0x3D, 0x00, 0x3E, 0x00, 0x3F, 0x00, 0x3F, 0x59, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEC, 0x21, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x20, 0x03, 0xE0, 0x01, 0x40, 0x01, 0x20, 0x03, 0xE0, 0x01, + 0x40, 0x01, 0x18, 0x08, 0xF0, 0x3F, 0xFC, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0A, 0x02, 0x14, 0x05, 0x32, 0x0B, 0x37, + 0x08, 0x50, 0x0B, 0x6E, 0x02, 0x00, 0x04, 0x00, 0x0B, 0x00, 0x16, 0x00, 0x0C, 0x00, 0x12, 0x00, + 0x18, 0x00, 0x24, 0x00, 0x30, 0x00, 0x48, 0x00, 0x60, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x39, 0x00, 0x20, 0x00, 0x39, 0x00, + 0x39, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xA4, 0x10, 0xF2, 0x10, 0xAA, 0x10, 0xEC, 0x10, 0xB0, 0x10, 0xE6, 0x10, 0xB6, 0x10, + 0xE0, 0x10, 0xBC, 0x10, 0xDA, 0x10, 0xC2, 0x10, 0xD4, 0x10, 0xC8, 0x10, 0xCE, 0x10, 0x07, 0x01, + 0x00, 0x00, 0x16, 0x22, 0x00, 0x04, 0x08, 0x01, 0x00, 0x00, 0x16, 0x26, 0x00, 0x04, 0x09, 0x01, + 0x00, 0x00, 0x16, 0x2A, 0x00, 0x04, 0x0A, 0x01, 0x00, 0x00, 0x16, 0x2E, 0x00, 0x04, 0x0B, 0x01, + 0x00, 0x00, 0x10, 0x24, 0x04, 0x04, 0x0C, 0x01, 0x00, 0x00, 0x10, 0x28, 0x04, 0x04, 0x0D, 0x01, + 0x00, 0x00, 0x10, 0x2C, 0x04, 0x04, 0x0E, 0x01, 0x00, 0x00, 0x10, 0x30, 0x04, 0x04, 0x0F, 0x01, + 0x00, 0x00, 0x14, 0x34, 0x08, 0x84, 0x10, 0x01, 0x00, 0x00, 0x14, 0x38, 0x08, 0x84, 0x11, 0x01, + 0x00, 0x00, 0x14, 0x3C, 0x08, 0x84, 0x12, 0x01, 0x00, 0x00, 0x14, 0x40, 0x08, 0x84, 0x13, 0x01, + 0x00, 0x00, 0x17, 0x64, 0x0C, 0x8B, 0x14, 0x01, 0x00, 0x00, 0x17, 0x68, 0x0C, 0x8B, 0x15, 0x01, + 0x00, 0x00, 0x17, 0x6C, 0x0C, 0x8B, 0x16, 0x01, 0x00, 0x00, 0x17, 0x70, 0x0C, 0x8B, 0x17, 0x01, + 0x00, 0x00, 0x17, 0x74, 0x0C, 0x8B, 0x18, 0x01, 0x00, 0x00, 0x17, 0x78, 0x0C, 0x8B, 0x19, 0x01, + 0x00, 0x00, 0x17, 0x7C, 0x0C, 0x8B, 0x1A, 0x01, 0x00, 0x00, 0x17, 0x80, 0x0C, 0x8B, 0x1B, 0x01, + 0x00, 0x00, 0x17, 0x84, 0x0C, 0x8B, 0x1C, 0x01, 0x00, 0x00, 0x17, 0x88, 0x0C, 0x8B, 0x1D, 0x01, + 0x00, 0x00, 0x17, 0x8C, 0x0C, 0x8B, 0x1E, 0x01, 0x00, 0x00, 0x0E, 0x95, 0x17, 0x04, 0x1F, 0x01, + 0x00, 0x00, 0x0E, 0x99, 0x17, 0x04, 0x20, 0x01, 0x00, 0x00, 0x0E, 0x9D, 0x17, 0x04, 0x21, 0x01, + 0x00, 0x00, 0x0E, 0xA1, 0x17, 0x04, 0x22, 0x01, 0x00, 0x00, 0x0E, 0xA5, 0x00, 0x00, 0x14, 0x11, + 0x34, 0x11, 0x54, 0x11, 0x74, 0x11, 0xCC, 0x11, 0x1C, 0x11, 0x3C, 0x11, 0x5C, 0x11, 0x7C, 0x11, + 0xD4, 0x11, 0x24, 0x11, 0x44, 0x11, 0x64, 0x11, 0x84, 0x11, 0xDC, 0x11, 0x2C, 0x11, 0x4C, 0x11, + 0x6C, 0x11, 0x8C, 0x11, 0xE4, 0x11, 0x94, 0x11, 0x9C, 0x11, 0xA4, 0x11, 0xAC, 0x11, 0xB4, 0x11, + 0xBC, 0x11, 0xC4, 0x11, 0xEC, 0x11, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, + 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, + 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x0A, 0x0A, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, + 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x0A, 0x0A, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x10, 0x10, 0x10, 0x10, + 0x17, 0x17, 0x17, 0x17, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x14, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, + 0x14, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x11, 0x11, 0x11, 0x11, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x14, 0x14, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x16, 0x16, 0x16, 0x16, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x0A, 0x0A, 0x0A, + 0x0A, 0x7F, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x10, 0x10, 0x10, 0x10, 0x7F, 0x14, 0x14, 0x14, 0x14, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x0A, 0x0A, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, + 0x14, 0x14, 0x14, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x9D, 0x9D, 0xA1, 0xAA, 0x10, 0x10, + 0x9D, 0x9D, 0x08, 0x02, 0x06, 0x00, 0xA5, 0xA5, 0xAA, 0xAA, 0x17, 0x17, 0xA2, 0xA2, 0x15, 0x05, + 0x07, 0x00, 0xAA, 0xAA, 0xB4, 0xB4, 0x1C, 0x1C, 0xA7, 0xA7, 0x1C, 0x0A, 0x08, 0x00, 0xB7, 0xB7, + 0xC1, 0xC1, 0x09, 0x09, 0xB4, 0xB4, 0x29, 0x17, 0x08, 0x00, 0xBD, 0xBD, 0xC7, 0xC7, 0x0F, 0x0F, + 0xBA, 0xBA, 0x2F, 0x1D, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x17, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xE4, 0xF0, 0xFD, 0xF0, 0x1F, 0xF1, 0x60, 0xF6, 0x9B, 0xF0, 0x79, 0xF6, 0x9B, 0xF0, 0x9B, 0xF0, + 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0xCC, 0xF7, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, + 0x9B, 0xF0, 0x15, 0xF3, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, + 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, + 0x9B, 0xF0, 0x66, 0xF3, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, + 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, + 0xE3, 0xF2, 0xFE, 0xF2, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, 0x9B, 0xF0, + 0xB4, 0x1C, 0x59, 0xF1, 0x6C, 0xF1, 0x1C, 0xF2, 0x20, 0xF2, 0x9B, 0xF0, 0x9B, 0xF0, 0xCF, 0xF2, + 0x64, 0xE6, 0x3E, 0xE6, 0x92, 0xE6, 0xE1, 0xE6, 0xA9, 0xE7, 0xCF, 0xE7, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x12, 0xF1, 0x35, 0xF1, 0x5D, 0xF6, 0x5D, 0xF6, 0x6D, 0xF6, 0x86, 0xF6, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFC, 0xC0, 0xF3, 0xF2, 0xF5, 0x5A, 0x00, 0x02, 0x00, 0xF9, 0xFF, + 0xC0, 0xF3, 0xD6, 0xF3, 0xCA, 0x00, 0x02, 0x00, 0xF7, 0xFF, 0xC0, 0xF3, 0xD6, 0xF3, 0xB0, 0x26, + 0x06, 0x00, 0xF0, 0xFF, 0xC0, 0xF3, 0xAA, 0xF3, 0x00, 0x00, 0x00, 0x02, 0xF6, 0xFF, 0xC0, 0xF3, + 0xD6, 0xF3, 0x6C, 0x00, 0x02, 0x00, 0xF4, 0xFF, 0xC0, 0xF3, 0xD6, 0xF3, 0x68, 0x01, 0x02, 0x00, + 0xF5, 0xFF, 0xC0, 0xF3, 0xFB, 0xF5, 0xA2, 0x26, 0x02, 0x00, 0xED, 0xFF, 0xC0, 0xF3, 0x0D, 0xF6, + 0x9E, 0x2B, 0x02, 0x00, 0xEC, 0xFF, 0xC0, 0xF3, 0x3B, 0xF6, 0xA0, 0x2B, 0x02, 0x00, 0xEB, 0xFF, + 0xC0, 0xF3, 0x41, 0xF6, 0xA2, 0x2B, 0x02, 0x00, 0xEE, 0xFF, 0xC0, 0xF3, 0x47, 0xF6, 0xD6, 0x2B, + 0x02, 0x00, 0xDA, 0xFF, 0xC0, 0xF3, 0xD6, 0xF3, 0xD0, 0x13, 0x0C, 0x00, 0xEA, 0xFF, 0xC0, 0xF3, + 0xAA, 0xF3, 0xEC, 0x2B, 0x06, 0x00, 0xE9, 0xFF, 0xC0, 0xF3, 0xD6, 0xF3, 0xF2, 0x2B, 0x02, 0x00, + 0xE8, 0xFF, 0xC0, 0xF3, 0xD6, 0xF3, 0xF4, 0x2B, 0x02, 0x00, 0xE7, 0xFF, 0xC0, 0xF3, 0xD6, 0xF3, + 0xF6, 0x2B, 0x02, 0x00, 0xE6, 0xFF, 0xC0, 0xF3, 0xD6, 0xF3, 0xF8, 0x2B, 0x02, 0x00, 0xE5, 0xFF, + 0xC0, 0xF3, 0xD6, 0xF3, 0xFA, 0x2B, 0x10, 0x00, 0xE4, 0xFF, 0xC0, 0xF3, 0xD6, 0xF3, 0x0A, 0x2C, + 0x18, 0x00, 0xDB, 0xFF, 0xC0, 0xF3, 0xD6, 0xF3, 0x22, 0x2C, 0x02, 0x00, 0xDC, 0xFF, 0xC0, 0xF3, + 0xD6, 0xF3, 0x24, 0x2C, 0x02, 0x00, 0xE1, 0xFF, 0xC0, 0xF3, 0xD6, 0xF3, 0xC6, 0x2C, 0x02, 0x00, + 0xE0, 0xFF, 0xC0, 0xF3, 0xD6, 0xF3, 0xC4, 0x2C, 0x02, 0x00, 0xE3, 0xFF, 0xC0, 0xF3, 0xD6, 0xF3, + 0xA8, 0x2C, 0x02, 0x00, 0xE2, 0xFF, 0x0E, 0xF4, 0xAA, 0xF3, 0x7E, 0x2C, 0x24, 0x00, 0x03, 0xFC, + 0xC0, 0xF3, 0x3A, 0xF5, 0x92, 0x2B, 0x02, 0x00, 0x04, 0xFC, 0xC0, 0xF3, 0xD0, 0xF3, 0xBA, 0x26, + 0x22, 0x00, 0x06, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0xA0, 0x26, 0x02, 0x00, 0x07, 0xFC, 0xC0, 0xF3, + 0xD6, 0xF3, 0xFE, 0x26, 0x02, 0x00, 0x0E, 0xFC, 0xC0, 0xF3, 0x63, 0xF5, 0x08, 0x27, 0x22, 0x00, + 0xB1, 0xFC, 0xC0, 0xF3, 0x88, 0xF8, 0x2A, 0x28, 0x02, 0x00, 0x20, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, + 0x2E, 0x27, 0x02, 0x00, 0x25, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0x3A, 0x27, 0x02, 0x00, 0x26, 0xFC, + 0xC0, 0xF3, 0xD6, 0xF3, 0x3C, 0x27, 0x02, 0x00, 0x27, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0x3E, 0x27, + 0x02, 0x00, 0xB2, 0xFC, 0xC0, 0xF3, 0xD0, 0xF3, 0x4E, 0x28, 0x22, 0x00, 0xC1, 0xFC, 0xC0, 0xF3, + 0xD6, 0xF3, 0x56, 0x2C, 0x20, 0x00, 0xB0, 0xFC, 0xA0, 0xF3, 0x8C, 0xF8, 0x00, 0x00, 0x00, 0x00, + 0xC4, 0xFC, 0xA0, 0xF3, 0x54, 0xF6, 0x00, 0x00, 0x08, 0x00, 0xC8, 0xFC, 0xA0, 0xF3, 0x52, 0xF6, + 0x00, 0x00, 0x08, 0x00, 0xB4, 0xFC, 0xA0, 0xF3, 0xC0, 0xF8, 0x00, 0x00, 0x00, 0x00, 0xB6, 0xFC, + 0xA0, 0xF3, 0x6A, 0xF9, 0x00, 0x00, 0x00, 0x00, 0xB7, 0xFC, 0xA0, 0xF3, 0xAC, 0xF9, 0x00, 0x00, + 0x00, 0x00, 0xB8, 0xFC, 0xA0, 0xF3, 0x02, 0xFA, 0x00, 0x00, 0x00, 0x00, 0xBC, 0xFC, 0xA0, 0xF3, + 0x3B, 0xFA, 0x00, 0x00, 0x00, 0x00, 0xBD, 0xFC, 0xA0, 0xF3, 0xC3, 0xFA, 0x00, 0x00, 0x00, 0x00, + 0xBE, 0xFC, 0xA0, 0xF3, 0xEF, 0xFA, 0x00, 0x00, 0x00, 0x00, 0xBF, 0xFC, 0xA0, 0xF3, 0x3C, 0xFB, + 0x00, 0x00, 0x00, 0x00, 0xB3, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0xA2, 0x0F, 0x10, 0x00, 0xB5, 0xFC, + 0xC0, 0xF3, 0xD6, 0xF3, 0xA4, 0x2C, 0x02, 0x00, 0xB9, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0xA6, 0x2C, + 0x02, 0x00, 0x90, 0xFD, 0xC0, 0xF3, 0xAA, 0xF3, 0xAA, 0x2C, 0x02, 0x00, 0x88, 0xFC, 0xC0, 0xF3, + 0xD6, 0xF3, 0x78, 0x2B, 0x04, 0x00, 0x89, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0x7C, 0x2B, 0x04, 0x00, + 0xC5, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0x80, 0x2B, 0x04, 0x00, 0x23, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, + 0x34, 0x27, 0x04, 0x00, 0x2A, 0xFC, 0xC0, 0xF3, 0x2C, 0xF4, 0xB6, 0x26, 0x02, 0x00, 0xC7, 0xFD, + 0xC0, 0xF3, 0xAA, 0xF3, 0xA6, 0x2B, 0x0A, 0x00, 0x29, 0xFC, 0x7F, 0xF4, 0x43, 0xF4, 0x00, 0x00, + 0x00, 0x00, 0xC2, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0x86, 0x2B, 0x08, 0x00, 0x32, 0xFC, 0xC0, 0xF3, + 0xD6, 0xF3, 0x5C, 0x01, 0x02, 0x00, 0x33, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0x5E, 0x01, 0x02, 0x00, + 0x35, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0x8E, 0x2B, 0x02, 0x00, 0xC7, 0xFC, 0xC0, 0xF3, 0xEB, 0xF5, + 0x90, 0x2B, 0x02, 0x00, 0x10, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0xA8, 0x26, 0x02, 0x00, 0x11, 0xFC, + 0xC0, 0xF3, 0xD6, 0xF3, 0x44, 0x27, 0x06, 0x00, 0x12, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0x4A, 0x27, + 0x06, 0x00, 0x13, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0x50, 0x27, 0x06, 0x00, 0x14, 0xFC, 0xC0, 0xF3, + 0xD6, 0xF3, 0x56, 0x27, 0x06, 0x00, 0x15, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0x5C, 0x27, 0x06, 0x00, + 0x16, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0x62, 0x27, 0x06, 0x00, 0x17, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, + 0x2A, 0x27, 0x02, 0x00, 0x83, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0x6C, 0x01, 0x02, 0x00, 0x97, 0xFC, + 0xC0, 0xF3, 0xD6, 0xF3, 0x6A, 0x01, 0x02, 0x00, 0x98, 0xFC, 0xD7, 0xF5, 0xC5, 0xF5, 0xEC, 0x00, + 0x02, 0x00, 0x99, 0xFC, 0xD7, 0xF5, 0xC5, 0xF5, 0xEC, 0x02, 0x02, 0x00, 0x9A, 0xFC, 0xD7, 0xF5, + 0xC5, 0xF5, 0xEC, 0x04, 0x02, 0x00, 0x9B, 0xFC, 0xD7, 0xF5, 0xC5, 0xF5, 0xEC, 0x06, 0x02, 0x00, + 0x9C, 0xFC, 0xD7, 0xF5, 0xC5, 0xF5, 0xEC, 0x08, 0x02, 0x00, 0x9D, 0xFC, 0xD7, 0xF5, 0xC5, 0xF5, + 0xEC, 0x0A, 0x02, 0x00, 0x18, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0x2C, 0x27, 0x02, 0x00, 0x22, 0xFC, + 0xC0, 0xF3, 0xD6, 0xF3, 0x32, 0x27, 0x02, 0x00, 0x24, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0x38, 0x27, + 0x02, 0x00, 0xC0, 0xFC, 0xA0, 0xF3, 0x50, 0xF6, 0x00, 0x00, 0x06, 0x00, 0x9E, 0xFC, 0xC0, 0xF3, + 0x83, 0xF5, 0x6E, 0x01, 0x04, 0x00, 0x9F, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0x3E, 0x2C, 0x04, 0x00, + 0xA0, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0x42, 0x2C, 0x04, 0x00, 0xA1, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, + 0x46, 0x2C, 0x04, 0x00, 0xA2, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0x4A, 0x2C, 0x04, 0x00, 0xA3, 0xFC, + 0xC0, 0xF3, 0xD6, 0xF3, 0x4E, 0x2C, 0x04, 0x00, 0xA4, 0xFC, 0xC0, 0xF3, 0xD6, 0xF3, 0x52, 0x2C, + 0x04, 0x00, 0x20, 0xFD, 0xF1, 0xF3, 0xAA, 0xF3, 0xD5, 0xFB, 0x08, 0x00, 0x21, 0xFD, 0xF1, 0xF3, + 0xAA, 0xF3, 0xD9, 0xFB, 0x0A, 0x00, 0x22, 0xFD, 0xF1, 0xF3, 0xAA, 0xF3, 0xDE, 0xFB, 0x16, 0x00, + 0x23, 0xFD, 0xF1, 0xF3, 0xAA, 0xF3, 0xE9, 0xFB, 0x0A, 0x00, 0x45, 0xFD, 0xC0, 0xF3, 0xAA, 0xF3, + 0xCA, 0x00, 0x02, 0x00, 0x47, 0xFD, 0xC0, 0xF3, 0xAA, 0xF3, 0x36, 0x01, 0x02, 0x00, 0x48, 0xFD, + 0xD4, 0xF4, 0xAA, 0xF3, 0x5C, 0x01, 0x02, 0x00, 0x49, 0xFD, 0xD4, 0xF4, 0xAA, 0xF3, 0x5E, 0x01, + 0x02, 0x00, 0x4A, 0xFD, 0xC0, 0xF3, 0xAA, 0xF3, 0x56, 0x01, 0x02, 0x00, 0x4B, 0xFD, 0xC0, 0xF3, + 0xAA, 0xF3, 0x58, 0x01, 0x02, 0x00, 0x4D, 0xFD, 0xF1, 0xF3, 0xAA, 0xF3, 0xEE, 0xFB, 0x08, 0x00, + 0x4F, 0xFD, 0xE8, 0xF4, 0xAA, 0xF3, 0x96, 0x2B, 0x02, 0x00, 0xC2, 0xFD, 0xDE, 0xF4, 0xAA, 0xF3, + 0x00, 0x00, 0x02, 0x00, 0x40, 0xFD, 0xE9, 0xF3, 0xAA, 0xF3, 0x78, 0x01, 0x02, 0x00, 0x24, 0xFD, + 0x01, 0xF5, 0xAA, 0xF3, 0x00, 0x00, 0x02, 0x00, 0x91, 0xFD, 0xC0, 0xF3, 0xAA, 0xF3, 0xCC, 0x1E, + 0x02, 0x00, 0x93, 0xFD, 0xC0, 0xF3, 0xAA, 0xF3, 0xD2, 0x1E, 0x02, 0x00, 0x8F, 0xFD, 0x0E, 0xF5, + 0xAA, 0xF3, 0x00, 0x00, 0x08, 0x00, 0xC1, 0xFD, 0x92, 0xF6, 0xAA, 0xF3, 0xC8, 0x00, 0x02, 0x00, + 0xC6, 0xFD, 0xC0, 0xF3, 0xAA, 0xF3, 0x20, 0x30, 0x04, 0x00, 0x25, 0xFD, 0xC0, 0xF3, 0xAA, 0xF3, + 0x62, 0x01, 0x02, 0x00, 0x89, 0xFD, 0x96, 0xF4, 0xAA, 0xF3, 0x00, 0x00, 0x00, 0x00, 0x8A, 0xFD, + 0x0E, 0xF4, 0xAA, 0xF3, 0x7E, 0x2C, 0x24, 0x00, 0x46, 0xFD, 0xC0, 0xF3, 0xAA, 0xF3, 0x7A, 0x01, + 0x06, 0x00, 0x86, 0xFD, 0xC0, 0xF3, 0xAA, 0xF3, 0xB0, 0x26, 0x06, 0x00, 0x87, 0xFD, 0xC0, 0xF3, + 0xAA, 0xF3, 0x76, 0x2C, 0x06, 0x00, 0x8B, 0xFD, 0x96, 0xF9, 0xAA, 0xF3, 0x00, 0x00, 0x12, 0x00, + 0x8B, 0xFD, 0x96, 0xF9, 0xAA, 0xF3, 0x00, 0x00, 0x12, 0x00, 0x8E, 0xFD, 0xC0, 0xF3, 0xAA, 0xF3, + 0xEE, 0x14, 0x02, 0x00, 0x80, 0xFD, 0xEF, 0xF4, 0xAA, 0xF3, 0x22, 0x00, 0x02, 0x00, 0x81, 0xFD, + 0xEF, 0xF4, 0xAA, 0xF3, 0x22, 0x02, 0x02, 0x00, 0x82, 0xFD, 0xEF, 0xF4, 0xAA, 0xF3, 0x22, 0x04, + 0x02, 0x00, 0x83, 0xFD, 0xEF, 0xF4, 0xAA, 0xF3, 0x22, 0x06, 0x02, 0x00, 0x84, 0xFD, 0xEF, 0xF4, + 0xAA, 0xF3, 0x22, 0x08, 0x02, 0x00, 0x85, 0xFD, 0xEF, 0xF4, 0xAA, 0xF3, 0x22, 0x0A, 0x02, 0x00, + 0x00, 0xF1, 0x46, 0x00, 0x64, 0xF3, 0xF6, 0x00, 0x00, 0x03, 0x8E, 0xF7, 0x1F, 0x00, 0x34, 0x01, + 0xC8, 0x00, 0x96, 0x01, 0xCC, 0x00, 0xFA, 0x00, 0x78, 0x01, 0xD2, 0x25, 0x18, 0x01, 0xCC, 0x1E, + 0xC8, 0x00, 0x00, 0x00, 0x02, 0x15, 0x00, 0x00, 0x06, 0x17, 0x12, 0x01, 0x03, 0x00, 0xAE, 0x00, + 0xEC, 0x00, 0x44, 0x00, 0xDC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x09, 0x08, 0x24, 0x28, 0x06, + 0x0C, 0x18, 0x08, 0x30, 0x14, 0x0C, 0x08, 0x36, 0x10, 0x12, 0xA1, 0xB6, 0x14, 0xB6, 0x50, 0xB7, + 0x59, 0xB7, 0x25, 0xB6, 0xCE, 0xB6, 0x93, 0xB6, 0x15, 0x1C, 0xD0, 0x1A, 0x15, 0x1C, 0x8B, 0x1B, + 0xEE, 0x1A, 0xCB, 0x1A, 0xD2, 0x1B, 0xF1, 0x1B, 0x06, 0x1C, 0x48, 0x1C, 0x74, 0x1C, 0x74, 0x1B, + 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, + 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x23, 0x46, 0x23, 0x46, 0x23, 0x46, 0x1C, 0x47, 0x1C, 0x47, + 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, + 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1D, 0x47, 0x9A, 0x48, 0xDA, 0x48, 0x1A, 0x48, 0x5A, 0x48, + 0x9A, 0x48, 0xDA, 0x48, 0x1A, 0x48, 0x5A, 0x48, 0x9A, 0x48, 0xDA, 0x48, 0x1A, 0x48, 0x5A, 0x48, + 0x9A, 0x48, 0x33, 0x48, 0x78, 0x49, 0x78, 0x49, 0x79, 0x49, 0x79, 0x49, 0x79, 0x49, 0x79, 0x49, + 0x7A, 0x49, 0x7A, 0x49, 0x7A, 0x49, 0x7A, 0x49, 0x7B, 0x49, 0x7B, 0x49, 0x7B, 0x49, 0x7C, 0x49, + 0xD8, 0x03, 0xDC, 0x03, 0xE0, 0x03, 0xE4, 0x03, 0xF0, 0x03, 0xF4, 0x03, 0xF8, 0x03, 0x0A, 0x04, + 0x0E, 0x04, 0x12, 0x04, 0x16, 0x04, 0x0C, 0x04, 0x10, 0x04, 0x14, 0x04, 0x18, 0x04, 0x1C, 0x04, + 0x20, 0x04, 0x24, 0x04, 0x28, 0x04, 0x4C, 0x04, 0x50, 0x04, 0x54, 0x04, 0x58, 0x04, 0x5C, 0x04, + 0x60, 0x04, 0x64, 0x04, 0x68, 0x04, 0x6C, 0x04, 0x70, 0x04, 0x74, 0x04, 0x7D, 0x04, 0x81, 0x04, + 0x85, 0x04, 0x89, 0x04, 0x8D, 0x04, 0x10, 0x00, 0x8E, 0x19, 0xAC, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x3C, 0x0C, 0x00, 0x00, 0xFF, 0x3F, 0x44, 0x04, 0x00, 0x00, 0xD3, 0x22, 0x44, 0x04, + 0x9C, 0x02, 0xCB, 0x54, 0x44, 0x04, 0x00, 0x00, 0x01, 0x00, 0x44, 0x04, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x0C, 0x71, 0x00, 0x30, 0x50, 0x20, 0x00, 0x80, 0xBF, 0x1F, 0xA6, 0x28, 0x00, 0x0B, 0x02, + 0x60, 0x84, 0x4C, 0x00, 0x02, 0x00, 0x4B, 0x1C, 0x98, 0x00, 0x00, 0x00, 0x20, 0x0B, 0x34, 0x04, + 0xFD, 0x34, 0x34, 0x00, 0x38, 0x04, 0xFD, 0x34, 0x34, 0x00, 0x3C, 0x04, 0x01, 0x00, 0x10, 0x00, + 0x00, 0x08, 0x00, 0x52, 0x14, 0x00, 0x04, 0x08, 0x0E, 0x32, 0x00, 0xA6, 0x10, 0x08, 0xC4, 0x03, + 0x50, 0x60, 0x18, 0x08, 0xF0, 0x3F, 0xFC, 0x01, 0x10, 0x0C, 0x00, 0x00, 0x80, 0x04, 0x14, 0x0C, + 0x00, 0x00, 0x00, 0x41, 0x20, 0x0C, 0xB0, 0x00, 0xB0, 0xB8, 0x24, 0x0C, 0x00, 0x00, 0xAB, 0x05, + 0x2C, 0x0C, 0x80, 0x05, 0x00, 0xFF, 0x30, 0x0C, 0x00, 0x00, 0xB0, 0x04, 0x34, 0x0C, 0x03, 0x00, + 0x00, 0xE8, 0x44, 0x0C, 0x04, 0x00, 0xFF, 0x0F, 0x00, 0x10, 0x2E, 0x00, 0x0C, 0xE3, 0x44, 0x04, + 0x00, 0x00, 0x01, 0x04, 0x44, 0x04, 0x00, 0x00, 0x01, 0x01, 0x44, 0x04, 0x00, 0x00, 0x01, 0x00, + 0x44, 0x04, 0x00, 0x00, 0x01, 0x04, 0x44, 0x04, 0x00, 0x00, 0x80, 0x03, 0x48, 0x0C, 0x00, 0x00, + 0x7F, 0x00, 0x04, 0x04, 0x08, 0x48, 0x00, 0x00, 0x04, 0x04, 0x08, 0x40, 0x00, 0x00, 0x00, 0x0C, + 0x71, 0x00, 0x30, 0x30, 0x00, 0x00, 0x5E, 0x40, 0x01, 0x00, 0x18, 0x00, 0x36, 0xC0, 0xE8, 0x0E, + 0x1C, 0x00, 0x78, 0xC8, 0xA5, 0x40, 0x24, 0x00, 0x9E, 0xB0, 0xB9, 0x95, 0x08, 0x08, 0x00, 0xEA, + 0x40, 0x01, 0x0C, 0x08, 0x00, 0xEA, 0x00, 0x00, 0x1C, 0x08, 0x00, 0x00, 0x42, 0x07, 0x20, 0x08, + 0x7B, 0x00, 0xD4, 0x09, 0x2C, 0x04, 0x14, 0x00, 0x50, 0x14, 0x30, 0x04, 0x28, 0x0F, 0x28, 0x7F, + 0x18, 0x08, 0x20, 0x00, 0xFC, 0x01, 0x04, 0x10, 0x69, 0x00, 0xFD, 0xC3, 0x08, 0x10, 0x69, 0x00, + 0xFD, 0xC3, 0x08, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x48, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x48, 0x0C, + 0x00, 0x00, 0x7F, 0x00, 0x04, 0x04, 0x08, 0x48, 0x02, 0x00, 0x00, 0x00, 0x5E, 0x48, 0x00, 0x00, + 0x04, 0x04, 0x08, 0x40, 0x02, 0x00, 0x00, 0x0C, 0x71, 0x00, 0x30, 0x50, 0x00, 0x00, 0x5E, 0x48, + 0x01, 0x00, 0x18, 0x00, 0x3A, 0xC0, 0xE8, 0x04, 0x1C, 0x00, 0x78, 0xD0, 0xA5, 0x40, 0x24, 0x00, + 0x9E, 0xB0, 0xB9, 0x85, 0x2C, 0x04, 0x14, 0x00, 0x50, 0x14, 0x30, 0x04, 0x28, 0x0F, 0x28, 0x7F, + 0x08, 0x08, 0x00, 0xEA, 0x40, 0x01, 0x0C, 0x08, 0x00, 0xEA, 0x00, 0x00, 0x1C, 0x08, 0x00, 0x00, + 0x42, 0x07, 0x20, 0x08, 0x7B, 0x00, 0xD4, 0x09, 0x18, 0x08, 0xF0, 0x3F, 0xFC, 0x01, 0x04, 0x10, + 0x69, 0x00, 0xDD, 0xCD, 0x08, 0x10, 0x69, 0x00, 0xDD, 0xCD, 0x08, 0x0C, 0x00, 0x00, 0x00, 0x00, + 0x48, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x40, 0x01, 0x41, 0x01, 0x0C, 0x04, 0x40, 0x04, + 0x41, 0x04, 0x10, 0x04, 0xD6, 0x08, 0x56, 0x0A, 0x14, 0x04, 0x42, 0x02, 0x56, 0x0A, 0x18, 0x04, + 0x56, 0x0A, 0x40, 0x02, 0x1C, 0x04, 0x42, 0x0A, 0x42, 0x2A, 0x20, 0x04, 0xC2, 0x00, 0xD6, 0x08, + 0x24, 0x04, 0xD6, 0x08, 0xC0, 0x00, 0x28, 0x04, 0xC2, 0x08, 0xC2, 0x28, 0x08, 0x04, 0x40, 0x01, + 0x41, 0x01, 0x0C, 0x04, 0x00, 0x01, 0x01, 0x01, 0x10, 0x04, 0x56, 0x0A, 0x56, 0x0A, 0x14, 0x04, + 0x42, 0x02, 0x56, 0x0A, 0x18, 0x04, 0x56, 0x0A, 0x40, 0x02, 0x1C, 0x04, 0x42, 0x0A, 0x42, 0x2A, + 0x20, 0x04, 0x42, 0x02, 0x56, 0x0A, 0x24, 0x04, 0x56, 0x0A, 0x40, 0x02, 0x28, 0x04, 0x42, 0x0A, + 0x42, 0x2A, 0x08, 0x04, 0x40, 0x01, 0x41, 0x01, 0x0C, 0x04, 0x40, 0x04, 0x41, 0x04, 0x10, 0x04, + 0xCE, 0x08, 0x4E, 0x0A, 0x14, 0x04, 0x42, 0x02, 0x4E, 0x0A, 0x18, 0x04, 0x4E, 0x0A, 0x40, 0x02, + 0x1C, 0x04, 0x42, 0x0A, 0x42, 0x2A, 0x20, 0x04, 0xC2, 0x00, 0xCE, 0x08, 0x24, 0x04, 0xCE, 0x08, + 0xC0, 0x00, 0x28, 0x04, 0xC2, 0x08, 0xC2, 0x28, 0x08, 0x04, 0x40, 0x01, 0x41, 0x01, 0x0C, 0x04, + 0x00, 0x01, 0x01, 0x01, 0x10, 0x04, 0x4E, 0x0A, 0x4E, 0x0A, 0x14, 0x04, 0x42, 0x02, 0x4E, 0x0A, + 0x18, 0x04, 0x4E, 0x0A, 0x40, 0x02, 0x1C, 0x04, 0x42, 0x0A, 0x42, 0x2A, 0x20, 0x04, 0x42, 0x02, + 0x4E, 0x0A, 0x24, 0x04, 0x4E, 0x0A, 0x40, 0x02, 0x28, 0x04, 0x42, 0x0A, 0x42, 0x2A, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, + 0x05, 0x00, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, + 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, + 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, + 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x17, 0xA0, 0x17, 0xA0, 0x17, + 0xA0, 0x18, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, + 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, + 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, + 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, + 0xFF, 0x06, 0x00, 0x00, 0x65, 0x00, 0x65, 0x00, 0x65, 0x00, 0x65, 0x00, 0x5D, 0x00, 0x52, 0x00, + 0x48, 0x00, 0x40, 0x00, 0x38, 0x00, 0x31, 0x00, 0x2C, 0x00, 0x27, 0x00, 0x23, 0x00, 0x1F, 0x00, + 0x00, 0x00, 0x65, 0x00, 0x65, 0x00, 0x65, 0x00, 0x65, 0x00, 0x5D, 0x00, 0x52, 0x00, 0x48, 0x00, + 0x40, 0x00, 0x38, 0x00, 0x31, 0x00, 0x2C, 0x00, 0x27, 0x00, 0x23, 0x00, 0x1F, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, + 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, + 0x15, 0x00, 0x6E, 0x6F, 0x6E, 0x2D, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, + 0x53, 0x53, 0x49, 0x44, 0x20, 0x21, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x01, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x00, 0x09, 0x00, 0x00, 0x01, 0x00, 0x64, 0x00, 0x64, 0x00, 0x00, 0x00, + 0x48, 0x45, 0x52, 0x4D, 0x45, 0x53, 0x20, 0x32, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, 0x10, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x03, 0x00, 0x15, 0x00, 0x6E, 0x6F, 0x6E, 0x2D, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x20, 0x53, 0x53, 0x49, 0x44, 0x20, 0x21, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x09, 0x00, 0x00, 0x01, 0x00, 0x64, 0x00, + 0x64, 0x00, 0x00, 0x00, 0x48, 0x45, 0x52, 0x4D, 0x45, 0x53, 0x20, 0x32, 0x00, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x69, 0x72, 0x73, 0x74, 0x20, 0x57, 0x61, + 0x76, 0x65, 0x4C, 0x41, 0x4E, 0x20, 0x49, 0x49, 0x20, 0x53, 0x53, 0x49, 0x44, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xFF, 0x0F, 0xF0, 0x0F, 0x0F, 0x00, 0x50, 0x01, 0x02, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x14, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x07, 0x00, 0x30, 0x00, 0xFF, 0x00, 0x09, 0x00, 0x09, 0x00, 0x09, 0x00, 0x09, 0x00, + 0x0A, 0x00, 0x0A, 0x00, 0x0B, 0x00, 0x0B, 0x00, 0x14, 0x00, 0x14, 0x00, 0x14, 0x00, 0x0A, 0x00, + 0x00, 0x00, 0x02, 0x01, 0x02, 0x04, 0x0B, 0x16, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01, 0x82, 0x84, + 0x8B, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x03, 0x00, 0x20, 0x00, 0x1B, 0x00, 0x17, 0x00, 0x11, 0x00, 0x10, 0x00, 0x0B, 0x00, + 0x0B, 0x00, 0x09, 0x00, 0x17, 0x00, 0x14, 0x00, 0x10, 0x00, 0x0D, 0x00, 0x0B, 0x00, 0x09, 0x00, + 0x08, 0x00, 0x07, 0x00, 0x0D, 0x00, 0x0A, 0x00, 0x09, 0x00, 0x08, 0x00, 0x05, 0x00, 0x05, 0x00, + 0xD8, 0x0C, 0xC0, 0x08, 0x90, 0x0D, 0x60, 0x09, 0x48, 0x0E, 0x30, 0x0A, 0x24, 0x0F, 0x18, 0x0B, + 0x0B, 0x6E, 0x0B, 0x37, 0x02, 0x14, 0x01, 0x0A, 0xFF, 0x0F, 0xF0, 0x0F, 0xFF, 0x0F, 0xF0, 0x0F, + 0xFF, 0x0F, 0xF0, 0x0F, 0xFF, 0x0F, 0xF0, 0x0F, 0xFF, 0x0F, 0xF0, 0x0F, 0xFF, 0x0F, 0xF0, 0x0F, + 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x03, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xDD, 0x00, 0x50, 0xF2, 0x01, 0x01, 0x00, + 0x00, 0x50, 0xF2, 0x05, 0x02, 0x00, 0x00, 0x50, 0xF2, 0x02, 0x00, 0x50, 0xF2, 0x04, 0x02, 0x00, + 0x00, 0x50, 0xF2, 0x00, 0x00, 0x50, 0xF2, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x04, 0x00, 0x15, 0x00, 0x02, 0x00, + 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x04, 0x00, 0x10, 0x00, 0x02, 0x00, 0x04, 0x00, 0x04, 0x00, + 0x15, 0x00, 0x20, 0x00, 0x11, 0x00, 0x20, 0x00, 0x16, 0x26, 0xE2, 0x2B, 0xEA, 0x2D, 0xC4, 0x2D, + 0xEE, 0x2D, 0x7E, 0x2C, 0x1E, 0x2E, 0x22, 0x2E, 0xFF, 0xFF, 0x2C, 0x2E, 0x00, 0x00, 0x4E, 0x28, + 0xD8, 0x2B, 0x22, 0x2E, 0xFF, 0xFF, 0x00, 0x00, 0x16, 0x26, 0xE2, 0x2B, 0xEA, 0x2D, 0xFF, 0xFF, + 0xEE, 0x2D, 0x7E, 0x2C, 0x1E, 0x2E, 0x22, 0x2E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0x2C, 0x2E, 0x00, 0x00, 0xE2, 0x2B, 0x34, 0x2E, 0x22, 0x2E, 0x00, 0x00, 0x00, 0x05, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x00, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x2A, 0x00, 0x00, 0x08, 0x32, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x00, 0x60, 0x1D, 0x00, 0x00, 0x00, 0x0D, 0x81, + 0x00, 0x60, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, + 0x00, 0x00, 0xDD, 0x00, 0xFF, 0xFF, 0x97, 0xDA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x00, 0x19, 0x0A, 0x09, 0x46, 0x1C, 0x60, 0x18, 0x00, 0x19, 0x1D, 0x09, 0x42, + 0x1C, 0x60, + +}; /* fw_image_2_data */ + +static const hcf_8 fw_image_3_data[] = { + 0x00, 0x60, 0x46, 0x74, 0xCD, 0xE2, 0x04, 0xE1, 0x02, 0x60, 0x00, 0xE1, 0x82, 0xF3, 0x21, 0x60, + 0xCE, 0x61, 0x60, 0x40, 0x01, 0x2B, 0x02, 0x00, 0x21, 0x60, 0x56, 0x61, 0x0F, 0x60, 0xE8, 0x64, + 0x59, 0xD1, 0x58, 0xD9, 0x59, 0xD1, 0x58, 0xD9, 0x3F, 0x44, 0x40, 0x26, 0x05, 0x00, 0x18, 0x60, + 0x22, 0xF3, 0x5A, 0xD1, 0xA0, 0x50, 0xA4, 0x50, 0x3F, 0x40, 0x02, 0x2B, 0x03, 0x00, 0x18, 0x60, + 0x74, 0x78, 0xFF, 0xFF, 0x04, 0x29, 0xFE, 0x01, 0xC4, 0xE2, 0x43, 0x64, 0x3A, 0xDB, 0x82, 0xF3, + 0xFF, 0xFF, 0x60, 0x41, 0x3F, 0x44, 0xFF, 0x01, 0x3F, 0x40, 0x40, 0x26, 0x05, 0x00, 0x18, 0x60, + 0x20, 0xF3, 0x5A, 0xD1, 0xA0, 0x50, 0xA4, 0x52, 0xC4, 0xE2, 0x00, 0x63, 0x81, 0xFD, 0x32, 0x7B, + 0x4D, 0xE2, 0xBF, 0xFE, 0xC4, 0xE2, 0x41, 0xFF, 0xE0, 0xFE, 0xE1, 0xFE, 0xE2, 0xFE, 0x43, 0xFF, + 0x44, 0xFF, 0x46, 0xFF, 0x83, 0xF3, 0x62, 0xFF, 0x60, 0x40, 0x05, 0x36, 0x2D, 0xFF, 0x07, 0x36, + 0xD5, 0xFE, 0x08, 0xE1, 0x88, 0x60, 0x85, 0x71, 0x8D, 0xE2, 0xA3, 0x60, 0x30, 0x78, 0xFF, 0xFF, + 0x00, 0x60, 0x10, 0x62, 0x1A, 0x60, 0x58, 0x4D, 0xB4, 0x78, 0xFF, 0xFF, 0x64, 0x41, 0xA9, 0x9C, + 0x60, 0x45, 0x1A, 0x60, 0x58, 0x4D, 0x88, 0x78, 0xFF, 0xFF, 0x82, 0xF1, 0x09, 0x60, 0xB4, 0x61, + 0x64, 0x44, 0x01, 0x27, 0x24, 0x00, 0x60, 0x40, 0x0E, 0x3A, 0x0D, 0x00, 0x01, 0x7C, 0x10, 0x60, + 0xF2, 0xF9, 0x44, 0x60, 0x08, 0x7C, 0x10, 0x60, 0xC4, 0xF9, 0x12, 0x60, 0xE5, 0xF1, 0x02, 0x60, + 0xB0, 0x61, 0xB1, 0x9C, 0x26, 0x00, 0x00, 0x7C, 0x10, 0x60, 0xF2, 0xF9, 0x40, 0x60, 0x08, 0x7C, + 0x10, 0x60, 0xC4, 0xF9, 0x12, 0x60, 0xE5, 0xF1, 0x02, 0x60, 0x90, 0x61, 0xB1, 0x9C, 0x09, 0x60, + 0x67, 0x65, 0xFF, 0xB4, 0xC4, 0x85, 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x81, 0x12, 0x00, 0xFF, 0xB4, + 0xED, 0xA0, 0x25, 0x60, 0xCC, 0x61, 0x04, 0x04, 0xE2, 0xA0, 0xD9, 0x81, 0x01, 0x04, 0xD9, 0x81, + 0xA1, 0xD1, 0x02, 0x60, 0x50, 0x61, 0x1F, 0x60, 0xF6, 0x65, 0xE0, 0x84, 0x44, 0xD3, 0xB1, 0x9C, + 0xC8, 0x81, 0x61, 0x47, 0x00, 0x7E, 0xE9, 0x81, 0x07, 0x60, 0xF0, 0x65, 0xA5, 0x81, 0x0B, 0xB9, + 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x85, 0xB5, 0x85, 0x04, 0x60, 0x44, 0x62, 0x1A, 0x60, 0x58, 0x4D, + 0x88, 0x78, 0xFF, 0xFF, 0x82, 0xF3, 0xC8, 0x61, 0x61, 0x54, 0xCD, 0xE2, 0x60, 0x40, 0x01, 0x27, + 0x2E, 0x00, 0xCC, 0x84, 0xE0, 0x85, 0x15, 0x60, 0xA2, 0xE7, 0x1F, 0x60, 0x86, 0x64, 0x1A, 0x60, + 0x58, 0x4F, 0x7D, 0x78, 0xFF, 0xFF, 0x1F, 0x60, 0xA2, 0x64, 0x1A, 0x60, 0x58, 0x4F, 0x7D, 0x78, + 0xFF, 0xFF, 0x1F, 0x60, 0xBE, 0x64, 0x1A, 0x60, 0x58, 0x4F, 0x7D, 0x78, 0xFF, 0xFF, 0x1F, 0x60, + 0xDA, 0x64, 0x1A, 0x60, 0x58, 0x4F, 0x7D, 0x78, 0xFF, 0xFF, 0x75, 0x64, 0x06, 0x61, 0x61, 0x48, + 0x60, 0x44, 0x80, 0xBC, 0xFF, 0xB4, 0x60, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x21, 0x60, + 0xEC, 0x7C, 0x07, 0x60, 0xE9, 0xF9, 0x21, 0x60, 0x74, 0x63, 0x14, 0x61, 0x21, 0x00, 0x11, 0x60, + 0x62, 0xF1, 0xFF, 0xB4, 0xED, 0xA0, 0x64, 0x41, 0x04, 0x04, 0xE2, 0xA0, 0xD9, 0x81, 0x01, 0x04, + 0xD9, 0x81, 0xA1, 0xD1, 0x10, 0x60, 0x91, 0xF3, 0x64, 0x41, 0xFF, 0xB1, 0xFF, 0x60, 0x00, 0x65, + 0xA4, 0x84, 0x34, 0x94, 0xA2, 0xDB, 0x5A, 0xD3, 0x64, 0x41, 0xA5, 0x81, 0xFF, 0xB4, 0x34, 0x94, + 0xA2, 0xDB, 0x22, 0x60, 0x58, 0x7C, 0x07, 0x60, 0xE9, 0xF9, 0x21, 0x60, 0x02, 0x63, 0x13, 0x61, + 0x1A, 0x60, 0x58, 0x4D, 0x9C, 0x78, 0xFF, 0xFF, 0x07, 0x60, 0xE9, 0xF3, 0x31, 0x40, 0x80, 0x26, + 0x36, 0xA4, 0x07, 0x60, 0xE9, 0xFB, 0x60, 0x43, 0x09, 0x61, 0x1A, 0x60, 0x58, 0x4D, 0x9C, 0x78, + 0xFF, 0xFF, 0x82, 0xF3, 0x22, 0x60, 0xC4, 0x61, 0x00, 0x7C, 0x7E, 0x63, 0x59, 0xD9, 0xFE, 0x1F, + 0x60, 0x40, 0x01, 0x27, 0x03, 0x00, 0x23, 0x60, 0x46, 0x65, 0x15, 0x00, 0xFF, 0xB4, 0xF9, 0xA0, + 0x23, 0x60, 0x68, 0x65, 0x01, 0x7C, 0x0D, 0x04, 0xED, 0xA0, 0x23, 0x60, 0x8A, 0x65, 0x11, 0x7C, + 0x08, 0x04, 0xE2, 0xA0, 0x23, 0x60, 0xAC, 0x65, 0x21, 0x7C, 0x03, 0x04, 0x23, 0x60, 0xCE, 0x65, + 0x31, 0x7C, 0x64, 0x5F, 0x64, 0xFB, 0xA5, 0xD3, 0xDA, 0x85, 0xF0, 0xA0, 0x22, 0x60, 0xC4, 0x61, + 0x08, 0x06, 0x40, 0x54, 0x58, 0x53, 0x08, 0xFF, 0xA2, 0x60, 0xE7, 0x64, 0x43, 0xFB, 0x08, 0xFF, + 0xFF, 0x01, 0x60, 0x43, 0x60, 0x46, 0xA5, 0xD1, 0xDA, 0x85, 0xA5, 0xD3, 0xDA, 0x85, 0x59, 0xD9, + 0x59, 0xDB, 0x59, 0xD9, 0x59, 0xDB, 0xFB, 0x1F, 0x0C, 0x63, 0xA5, 0xD1, 0xDA, 0x85, 0xA5, 0xD3, + 0xDA, 0x85, 0x59, 0xD9, 0x59, 0xDB, 0x59, 0xD9, 0x59, 0xDB, 0xF7, 0x1F, 0x66, 0x44, 0x0E, 0x63, + 0x53, 0x93, 0x60, 0x40, 0x10, 0x36, 0x07, 0x00, 0x65, 0x44, 0x48, 0xD3, 0x59, 0xD9, 0x59, 0xDB, + 0x59, 0xD9, 0x59, 0xDB, 0xFB, 0x1F, 0x12, 0x60, 0xBC, 0xF1, 0x64, 0xF3, 0x64, 0x43, 0xDB, 0x81, + 0x25, 0x60, 0x5A, 0x65, 0x60, 0x40, 0x01, 0x37, 0x12, 0x00, 0x11, 0x37, 0x17, 0x00, 0x21, 0x37, + 0x1D, 0x00, 0x31, 0x37, 0x22, 0x00, 0xA3, 0xD1, 0x12, 0x60, 0xB7, 0xF5, 0x64, 0x44, 0xFF, 0xB4, + 0x12, 0x60, 0xB6, 0xFB, 0x64, 0x47, 0xFF, 0xB4, 0x12, 0x60, 0xAD, 0xF1, 0x1D, 0x00, 0xA1, 0xD3, + 0x12, 0x60, 0xB8, 0xF5, 0xFF, 0xB4, 0x12, 0x60, 0xAE, 0xF1, 0x16, 0x00, 0xA1, 0xD3, 0x12, 0x60, + 0xB9, 0xF5, 0x60, 0x47, 0xFF, 0xB4, 0x12, 0x60, 0xAF, 0xF1, 0x0E, 0x00, 0x59, 0xD3, 0x12, 0x60, + 0xBA, 0xF5, 0xFF, 0xB4, 0x12, 0x60, 0xB0, 0xF1, 0x07, 0x00, 0x59, 0xD3, 0x12, 0x60, 0xBB, 0xF5, + 0x60, 0x47, 0xFF, 0xB4, 0x12, 0x60, 0xB1, 0xF1, 0x12, 0x60, 0xB5, 0xFB, 0x12, 0x60, 0xB2, 0xF9, + 0x66, 0x42, 0xFC, 0xA2, 0xA2, 0xD3, 0x24, 0x60, 0x48, 0x63, 0xCC, 0x84, 0xE8, 0x84, 0xCC, 0x81, + 0x63, 0x45, 0xA6, 0xD3, 0xDA, 0x82, 0xFF, 0xB4, 0xFF, 0xFF, 0x03, 0x03, 0x60, 0x40, 0x80, 0x2B, + 0x03, 0x00, 0xDA, 0x86, 0xCD, 0x81, 0xF5, 0x01, 0x00, 0xB9, 0xA6, 0xD3, 0x0B, 0x03, 0x5A, 0xD1, + 0xDA, 0x86, 0xFF, 0xB4, 0xE0, 0x84, 0xC4, 0x84, 0x5C, 0x90, 0xBD, 0xD9, 0xFD, 0x02, 0xCD, 0x81, + 0x66, 0x42, 0xF2, 0x02, 0x5A, 0xD3, 0x24, 0x60, 0x86, 0x65, 0xD7, 0x80, 0xBD, 0xDB, 0xFD, 0x02, + 0x64, 0xF3, 0x15, 0x60, 0xDD, 0xF1, 0x60, 0x40, 0x01, 0x27, 0x09, 0x00, 0x64, 0x40, 0x10, 0x26, + 0x06, 0x00, 0x13, 0x64, 0xAD, 0xFB, 0x01, 0x60, 0x67, 0x64, 0x37, 0xFB, 0x09, 0x00, 0x08, 0x64, + 0xAD, 0xFB, 0x82, 0xF3, 0x01, 0x60, 0x67, 0x7C, 0x60, 0x40, 0x01, 0x27, 0x5B, 0x7C, 0x37, 0xF9, + 0x13, 0x60, 0x5B, 0xF1, 0x64, 0xF3, 0x15, 0x60, 0xD2, 0xF9, 0x15, 0x60, 0xD6, 0xF9, 0x60, 0x40, + 0x01, 0x27, 0x0A, 0x00, 0xFF, 0xB5, 0x10, 0x60, 0xA8, 0x63, 0x65, 0x41, 0xCD, 0x81, 0x06, 0xA3, + 0xFD, 0x02, 0xFA, 0xA3, 0xA3, 0xD3, 0x0F, 0x00, 0x01, 0x60, 0xFF, 0x65, 0xA4, 0x84, 0x11, 0x60, + 0x14, 0x61, 0xA1, 0xD1, 0xFF, 0xFF, 0xD0, 0x80, 0x08, 0xA1, 0xFB, 0x02, 0xFC, 0xA1, 0xA1, 0xD3, + 0x15, 0x60, 0xD2, 0xF1, 0xFF, 0xB4, 0xD0, 0x80, 0xFF, 0xFF, 0x04, 0x07, 0x15, 0x60, 0xD2, 0xFB, + 0x15, 0x60, 0xD6, 0xFB, 0x25, 0x60, 0x7A, 0x63, 0x24, 0x60, 0x08, 0x65, 0x12, 0x60, 0xB6, 0xF1, + 0x23, 0x60, 0xF0, 0x61, 0x25, 0x60, 0x68, 0x64, 0x40, 0x4F, 0x04, 0x64, 0xC3, 0x60, 0x58, 0x4D, + 0x25, 0x78, 0xFF, 0xFF, 0x25, 0x60, 0x82, 0x63, 0x12, 0x60, 0xB5, 0xF1, 0x24, 0x60, 0x48, 0x65, + 0x25, 0x60, 0x66, 0x64, 0x40, 0x4F, 0x08, 0x64, 0xC3, 0x60, 0x58, 0x4D, 0x25, 0x78, 0xFF, 0xFF, + 0x64, 0xF3, 0x08, 0x7C, 0x38, 0xF9, 0x24, 0x60, 0xE0, 0x61, 0x60, 0x40, 0x01, 0x2B, 0x0E, 0x00, + 0x01, 0x37, 0x06, 0x00, 0x11, 0x37, 0x03, 0x00, 0x21, 0x3B, 0x1E, 0xA1, 0x1E, 0xA1, 0x1E, 0xA1, + 0x1C, 0x63, 0x24, 0x60, 0xC2, 0x64, 0x59, 0xD1, 0x58, 0xD9, 0xFD, 0x1F, 0x12, 0x60, 0xB2, 0xF3, + 0x00, 0x7C, 0x60, 0x45, 0x70, 0x62, 0x1A, 0x60, 0x58, 0x4D, 0x88, 0x78, 0xFF, 0xFF, 0x04, 0x29, + 0xFE, 0x01, 0x00, 0x60, 0x10, 0x62, 0x1A, 0x60, 0x58, 0x4D, 0xB4, 0x78, 0xFF, 0xFF, 0x01, 0x61, + 0xB1, 0x9C, 0x60, 0x45, 0x1A, 0x60, 0x58, 0x4D, 0x88, 0x78, 0xFF, 0xFF, 0x18, 0x60, 0x50, 0x78, + 0xFF, 0xFF, 0x44, 0xD3, 0x80, 0x7C, 0x60, 0x48, 0x60, 0x47, 0x00, 0x7F, 0xB0, 0x8A, 0xFF, 0xFF, + 0x01, 0x16, 0xFE, 0x01, 0x2F, 0x58, 0xFF, 0xFF, 0xD5, 0x60, 0x84, 0xE7, 0x62, 0x47, 0x80, 0xBF, + 0x60, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x64, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, + 0x65, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x95, 0x60, 0x84, 0xE7, 0x2D, 0x58, 0xFF, 0xFF, + 0x00, 0x7C, 0xBD, 0xD3, 0xD5, 0x60, 0x84, 0xE7, 0x60, 0x47, 0x80, 0xBF, 0x60, 0x4A, 0xBD, 0xD3, + 0x01, 0x16, 0xFE, 0x01, 0x90, 0x8A, 0xBD, 0xD3, 0x01, 0x16, 0xFE, 0x01, 0x90, 0x8A, 0xFF, 0xFF, + 0x01, 0x16, 0xFE, 0x01, 0xCD, 0x81, 0x95, 0x60, 0x84, 0xE7, 0xEB, 0x02, 0x2D, 0x58, 0xFF, 0xFF, + 0xD5, 0x60, 0x84, 0xE7, 0x62, 0x4A, 0x02, 0x64, 0x01, 0x16, 0xFE, 0x01, 0xCC, 0x84, 0xFF, 0xFF, + 0xFD, 0x02, 0x7C, 0x49, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x68, 0x5C, 0x7C, 0x49, 0xFF, 0xFF, + 0x01, 0x16, 0xFE, 0x01, 0x68, 0x44, 0x95, 0x60, 0x84, 0xE7, 0x2D, 0x58, 0xFF, 0xFF, 0x42, 0xFF, + 0x40, 0xFF, 0x3F, 0x40, 0x02, 0x27, 0x33, 0x00, 0x43, 0x45, 0x20, 0x44, 0x20, 0xBC, 0x40, 0x40, + 0x3F, 0x40, 0x02, 0x27, 0x1B, 0x00, 0x60, 0xBC, 0x40, 0x40, 0xDD, 0xFE, 0x18, 0x60, 0x07, 0xF1, + 0xAD, 0x4F, 0x00, 0x7F, 0xFA, 0xB4, 0x64, 0x41, 0x64, 0xF1, 0x02, 0xB1, 0x04, 0x65, 0x02, 0x02, + 0x64, 0x40, 0x01, 0x2B, 0x01, 0x65, 0xB4, 0x84, 0xA0, 0x5D, 0x00, 0xEE, 0x19, 0x61, 0xCD, 0x81, + 0xFF, 0xFF, 0xFD, 0x02, 0x43, 0x45, 0x3F, 0x40, 0x02, 0x27, 0x11, 0x00, 0xAE, 0x4F, 0xFD, 0xB4, + 0x04, 0xBC, 0xA0, 0x5E, 0x00, 0x60, 0x02, 0x71, 0x8D, 0xE2, 0x40, 0xE1, 0xA1, 0xFF, 0x04, 0xAC, + 0xA0, 0x5E, 0x0F, 0x60, 0xA0, 0x71, 0x8D, 0xE2, 0xA1, 0xFF, 0xDD, 0xFE, 0x1E, 0x00, 0x43, 0x45, + 0x20, 0x44, 0x60, 0xBC, 0x40, 0x40, 0xAE, 0x4F, 0xFD, 0xB4, 0x04, 0xBC, 0xA0, 0x5E, 0xDD, 0xFE, + 0x00, 0x60, 0x02, 0x71, 0x8D, 0xE2, 0x40, 0xE1, 0xA1, 0xFF, 0x04, 0xAC, 0xA0, 0x5E, 0x00, 0x60, + 0xC8, 0x71, 0x8D, 0xE2, 0xA1, 0xFF, 0x0C, 0x60, 0x00, 0x62, 0x00, 0x60, 0x71, 0x7C, 0x10, 0x60, + 0x00, 0x65, 0x1A, 0x60, 0x58, 0x4D, 0x88, 0x78, 0xFF, 0xFF, 0x20, 0x60, 0x3C, 0x63, 0x1E, 0x61, + 0x1A, 0x60, 0x58, 0x4D, 0x9C, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x14, 0x71, 0x8D, 0xE2, 0xA1, 0xFF, + 0x31, 0x44, 0x40, 0x26, 0x02, 0x00, 0x80, 0x26, 0x17, 0x00, 0x21, 0x60, 0xEC, 0x63, 0x07, 0x60, + 0xE9, 0xFD, 0x09, 0x61, 0x1A, 0x60, 0x58, 0x4D, 0x9C, 0x78, 0xFF, 0xFF, 0x31, 0x44, 0x40, 0x2A, + 0x14, 0x00, 0x31, 0x44, 0x7F, 0xB4, 0x40, 0x51, 0xAE, 0x4C, 0x10, 0x26, 0x0E, 0x00, 0x07, 0x60, + 0xEA, 0xFB, 0x31, 0x44, 0x80, 0xBC, 0x40, 0x51, 0x22, 0x60, 0x22, 0x63, 0x07, 0x60, 0xE9, 0xFD, + 0x09, 0x61, 0x1A, 0x60, 0x58, 0x4D, 0x9C, 0x78, 0xFF, 0xFF, 0x20, 0x60, 0xF0, 0x63, 0x03, 0x61, + 0x1A, 0x60, 0x58, 0x4D, 0x9C, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x10, 0x62, 0x19, 0x60, 0x8F, 0x7C, + 0x00, 0x60, 0xAC, 0x65, 0x1A, 0x60, 0x58, 0x4D, 0x88, 0x78, 0xFF, 0xFF, 0x80, 0xE1, 0xBF, 0xFE, + 0xA1, 0x4F, 0x70, 0xB4, 0x50, 0x36, 0xAF, 0x00, 0x20, 0x36, 0x03, 0x00, 0x18, 0x60, 0x24, 0x78, + 0xFF, 0xFF, 0x01, 0x60, 0x1A, 0xE1, 0xDF, 0xFE, 0x19, 0xFF, 0x00, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, + 0x3F, 0x40, 0x20, 0x2B, 0xA1, 0x00, 0x01, 0x16, 0xFE, 0x01, 0x38, 0x69, 0xA1, 0xFF, 0xFF, 0xFF, + 0x68, 0x44, 0x01, 0x2A, 0x99, 0x00, 0x13, 0x60, 0x09, 0xF3, 0xFF, 0xFF, 0xDC, 0x84, 0x00, 0x36, + 0x00, 0x3B, 0xA2, 0xDB, 0x64, 0xF1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x9C, 0x47, 0x00, 0x43, 0x45, + 0x20, 0x44, 0x20, 0xBC, 0x40, 0x40, 0x18, 0x60, 0x22, 0xF3, 0x3F, 0x40, 0x40, 0x26, 0x01, 0x00, + 0xA0, 0x50, 0x3F, 0x40, 0x02, 0x2B, 0x29, 0x00, 0xAE, 0x4F, 0xFD, 0xB4, 0xA0, 0x5E, 0xDD, 0xFE, + 0xAC, 0x4F, 0x10, 0xBC, 0xA0, 0x5C, 0xFF, 0xFF, 0x10, 0xAC, 0xA0, 0x5C, 0x00, 0x60, 0xC8, 0x71, + 0x8D, 0xE2, 0x40, 0xE1, 0x40, 0x29, 0xFE, 0x01, 0x0C, 0x60, 0x00, 0x62, 0x00, 0x60, 0x71, 0x7C, + 0x10, 0x60, 0x00, 0x65, 0x1A, 0x60, 0x58, 0x4D, 0x88, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0xC8, 0x71, + 0x8D, 0xE2, 0x40, 0xE1, 0x40, 0x29, 0xFE, 0x01, 0x01, 0x60, 0x08, 0xE1, 0x64, 0xF1, 0x82, 0xF9, + 0x05, 0x7C, 0x83, 0xF9, 0xDF, 0xFE, 0x19, 0xFF, 0xFF, 0xFF, 0x18, 0x60, 0x07, 0xF1, 0xAD, 0x4F, + 0x00, 0x7F, 0xFA, 0xB4, 0x64, 0x41, 0x64, 0xF1, 0x02, 0xB1, 0x04, 0x65, 0x02, 0x02, 0x64, 0x40, + 0x01, 0x2B, 0x01, 0x65, 0xB4, 0x84, 0xA0, 0x5D, 0xBF, 0xFE, 0x45, 0x00, 0x18, 0x60, 0x07, 0xF1, + 0xAD, 0x4F, 0x00, 0x7F, 0xFA, 0xB4, 0x64, 0x41, 0x64, 0xF1, 0x02, 0xB1, 0x04, 0x65, 0x02, 0x02, + 0x64, 0x40, 0x01, 0x2B, 0x01, 0x65, 0xB4, 0x84, 0xA0, 0x5D, 0x43, 0x45, 0x20, 0x44, 0x20, 0xBC, + 0x40, 0x40, 0x02, 0x60, 0xEE, 0x64, 0x3F, 0x40, 0x02, 0x27, 0xC8, 0x64, 0x81, 0xFB, 0x82, 0xF9, + 0x05, 0x64, 0x83, 0xFB, 0xDF, 0xFE, 0x19, 0xFF, 0x26, 0x00, 0x20, 0x44, 0x20, 0xBC, 0x40, 0x40, + 0x43, 0x45, 0xA4, 0xD1, 0xDA, 0x83, 0xC3, 0x85, 0x80, 0xE1, 0xDF, 0xFE, 0xBD, 0xD3, 0xFF, 0xFF, + 0x60, 0x48, 0x60, 0x47, 0x80, 0xBC, 0x00, 0x7F, 0x60, 0x4A, 0xD7, 0x80, 0xA1, 0xFF, 0xF6, 0x02, + 0xBF, 0xFE, 0x11, 0x00, 0x43, 0x45, 0xA4, 0xD1, 0xDA, 0x83, 0x0D, 0x18, 0x64, 0x44, 0x00, 0x61, + 0xFA, 0xA4, 0xDD, 0x81, 0xFD, 0x02, 0x1A, 0x60, 0x58, 0x4D, 0x9C, 0x78, 0xFF, 0xFF, 0xBF, 0xFE, + 0x02, 0x00, 0xF1, 0xFE, 0x01, 0x00, 0x25, 0x43, 0x21, 0xE1, 0x00, 0x64, 0xBF, 0xDB, 0x20, 0x44, + 0x20, 0x2A, 0x07, 0x00, 0x07, 0xB4, 0x04, 0x36, 0xC3, 0xFE, 0x06, 0x36, 0xCC, 0xFE, 0x07, 0x36, + 0xD5, 0xFE, 0x20, 0x44, 0xD8, 0xB4, 0x40, 0x40, 0x1F, 0x60, 0x2C, 0x63, 0xBD, 0xD3, 0x03, 0x61, + 0x0F, 0x1B, 0x04, 0xA3, 0xBD, 0xD3, 0x04, 0x61, 0x0B, 0x1B, 0x04, 0xA3, 0xBD, 0xD3, 0x06, 0x61, + 0x07, 0x1B, 0x04, 0xA3, 0xBD, 0xD3, 0x07, 0x61, 0x03, 0x1B, 0xC3, 0x60, 0x53, 0x78, 0xFF, 0xFF, + 0xA3, 0xD1, 0x40, 0x44, 0x20, 0x44, 0x07, 0xB5, 0xD4, 0x85, 0x35, 0x80, 0x24, 0x45, 0x1F, 0x60, + 0x6C, 0x64, 0x44, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0x43, 0x45, 0x20, 0x44, 0x20, 0xBC, 0x40, 0x40, + 0x64, 0x43, 0xBD, 0xD3, 0xBD, 0xD1, 0x40, 0x44, 0x10, 0x27, 0x19, 0x00, 0x3F, 0x40, 0x02, 0x2B, + 0x06, 0x00, 0x24, 0x47, 0x08, 0x2B, 0x13, 0x00, 0x07, 0xB4, 0x01, 0x36, 0x11, 0x00, 0xFF, 0x60, + 0x7F, 0x65, 0x15, 0x60, 0xA2, 0x64, 0x24, 0x40, 0x08, 0x2B, 0xA4, 0x84, 0xA0, 0x57, 0xFF, 0xFF, + 0x64, 0x49, 0xFF, 0xFF, 0x68, 0x44, 0x01, 0x16, 0xFD, 0x01, 0x00, 0x7F, 0xA3, 0xDB, 0xAB, 0x01, + 0x64, 0x42, 0x1A, 0x60, 0x58, 0x4D, 0xB4, 0x78, 0xFF, 0xFF, 0xBD, 0xD9, 0xA3, 0xDB, 0xA3, 0x01, + 0x43, 0x45, 0x20, 0x44, 0x20, 0xBC, 0x40, 0x40, 0x64, 0x43, 0xBD, 0xD3, 0xA3, 0xD1, 0x40, 0x44, + 0x10, 0x2B, 0x16, 0x00, 0xBE, 0xD1, 0xFF, 0xFF, 0x15, 0x60, 0x80, 0xE7, 0x24, 0x40, 0x07, 0x27, + 0x04, 0x00, 0xAC, 0x4F, 0x10, 0xBC, 0x00, 0x7F, 0xA0, 0x5C, 0x64, 0x4A, 0xFF, 0xFF, 0x01, 0x16, + 0xFE, 0x01, 0x24, 0x40, 0x20, 0x27, 0x1D, 0x00, 0xAC, 0x4F, 0xEF, 0xB4, 0xA0, 0x5C, 0x19, 0x00, + 0x3F, 0x40, 0x02, 0x2B, 0x06, 0x00, 0x24, 0x47, 0x08, 0x2B, 0x13, 0x00, 0x07, 0xB4, 0x01, 0x36, + 0x11, 0x00, 0x15, 0x60, 0x22, 0x64, 0x24, 0x40, 0x08, 0x27, 0x80, 0xBC, 0x7C, 0x48, 0xBE, 0xD3, + 0xA0, 0x57, 0x60, 0x48, 0x64, 0x44, 0x80, 0xBC, 0xFF, 0xB4, 0x60, 0x4A, 0xFF, 0xFF, 0x01, 0x16, + 0xFE, 0x01, 0x69, 0x01, 0x01, 0x61, 0x1A, 0x60, 0x58, 0x4D, 0x9C, 0x78, 0xFF, 0xFF, 0x63, 0x01, + 0x28, 0xF3, 0xFF, 0xFF, 0x60, 0x47, 0x0F, 0xB4, 0x9A, 0x00, 0xFF, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x04, 0x64, 0x0F, 0x60, 0x9F, 0xFB, 0x27, 0x00, 0x0C, 0x64, 0x3F, 0x40, 0x02, 0x2B, 0x23, 0x00, + 0x29, 0xF1, 0x0F, 0x60, 0x9F, 0xFB, 0x5A, 0xD9, 0x1C, 0x60, 0xD0, 0x64, 0x7F, 0xFB, 0xFF, 0xFF, + 0x2D, 0xFF, 0xF0, 0x60, 0xC7, 0x78, 0xFF, 0xFF, 0x22, 0x60, 0x22, 0x63, 0x09, 0x61, 0x1A, 0x60, + 0x58, 0x4D, 0x9C, 0x78, 0xFF, 0xFF, 0x77, 0x00, 0xD3, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, 0xD3, 0xFB, + 0x06, 0x64, 0x0F, 0x60, 0x9F, 0xFB, 0xFF, 0xFF, 0x2D, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x08, 0x64, 0x0F, 0x60, 0x9F, 0xFB, 0x1D, 0x60, 0x4F, 0x64, 0x7F, 0xFB, 0xFF, 0xFF, 0x2D, 0xFF, + 0xF0, 0x60, 0xC7, 0x78, 0xFF, 0xFF, 0x29, 0xF3, 0x11, 0x60, 0xF9, 0x65, 0x60, 0x5C, 0x3F, 0x40, + 0x02, 0x2B, 0x13, 0x00, 0x00, 0x37, 0x11, 0x00, 0x01, 0x3B, 0x55, 0x00, 0x11, 0x60, 0x19, 0x63, + 0xFF, 0xB7, 0x60, 0x5C, 0xA3, 0xD3, 0x08, 0xA3, 0x00, 0x7E, 0xD0, 0x80, 0xD7, 0x80, 0x02, 0x03, + 0xF9, 0x02, 0x49, 0x00, 0xF4, 0xA3, 0xA3, 0xD3, 0x05, 0x00, 0x00, 0xBC, 0xF2, 0xA4, 0x43, 0x03, + 0x42, 0x07, 0x64, 0x44, 0x64, 0xFB, 0x82, 0xFB, 0xC8, 0x64, 0x81, 0xFB, 0x07, 0x64, 0x83, 0xFB, + 0x1D, 0x60, 0x4F, 0x64, 0x7F, 0xFB, 0xFF, 0xFF, 0xDF, 0xFE, 0x00, 0x64, 0x19, 0xFF, 0xF0, 0x60, + 0xC7, 0x78, 0xFF, 0xFF, 0x88, 0xFF, 0xBA, 0x60, 0x98, 0x71, 0x8D, 0xE2, 0x01, 0x11, 0x09, 0x00, + 0x71, 0x40, 0x80, 0x27, 0xFB, 0x01, 0x88, 0xE2, 0xBA, 0x60, 0xD0, 0x64, 0x03, 0xFB, 0x8D, 0xFF, + 0x15, 0x00, 0x8D, 0xFF, 0xB1, 0x60, 0xED, 0x63, 0x06, 0x60, 0x0B, 0xFD, 0xFF, 0xFF, 0x62, 0xFF, + 0x1D, 0x60, 0x3C, 0x63, 0x7F, 0xFD, 0xFF, 0xFF, 0x1A, 0xFF, 0xF0, 0x60, 0xC7, 0x78, 0xFF, 0xFF, + 0xA4, 0x60, 0x7C, 0x63, 0x06, 0x60, 0x0B, 0xFD, 0xFF, 0xFF, 0x62, 0xFF, 0x29, 0xF5, 0x1F, 0x60, + 0x26, 0x63, 0x1E, 0x60, 0xF8, 0x64, 0xBD, 0xDB, 0x66, 0x44, 0xBD, 0xDB, 0x02, 0x64, 0xA3, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0xF9, 0xFE, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x66, 0x01, 0x00, 0x36, + 0x67, 0x01, 0x01, 0x36, 0x69, 0x01, 0x02, 0x36, 0x7F, 0x01, 0x03, 0x36, 0x89, 0x01, 0x04, 0x36, + 0xC1, 0x01, 0x05, 0x36, 0xBF, 0x01, 0x06, 0x36, 0xF1, 0x01, 0x07, 0x36, 0xBB, 0x01, 0x08, 0x36, + 0x8A, 0x01, 0x09, 0x36, 0x0C, 0x00, 0x0A, 0x36, 0x0D, 0x00, 0x0B, 0x36, 0x0E, 0x00, 0x0C, 0x36, + 0x17, 0x00, 0x0D, 0x36, 0x0D, 0x00, 0x0E, 0x36, 0x1D, 0x00, 0x0F, 0x36, 0x41, 0x00, 0x02, 0x60, + 0x00, 0x64, 0x08, 0x00, 0x04, 0x60, 0x00, 0x64, 0x05, 0x00, 0x00, 0x60, 0x01, 0x64, 0x02, 0x00, + 0x20, 0x60, 0x00, 0x64, 0x32, 0x45, 0xB4, 0x85, 0x45, 0x52, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0xB2, 0x60, 0xD0, 0x63, 0x06, 0x60, 0x0B, 0xFD, 0x62, 0xFF, 0xFF, 0xFF, 0x1A, 0xFF, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x3F, 0x40, 0x02, 0x2B, 0x15, 0x00, 0x88, 0xFF, 0xBA, 0x60, 0x98, 0x71, + 0x8D, 0xE2, 0x01, 0x11, 0x09, 0x00, 0x71, 0x40, 0x80, 0x27, 0xFB, 0x01, 0x88, 0xE2, 0xBA, 0x60, + 0xD0, 0x64, 0x03, 0xFB, 0x8D, 0xFF, 0x11, 0x00, 0x8D, 0xFF, 0x90, 0x60, 0x00, 0xE8, 0xB1, 0x60, + 0xED, 0x63, 0x04, 0x00, 0x91, 0x60, 0x00, 0xE8, 0xB2, 0x60, 0xB6, 0x63, 0x2A, 0xE8, 0x06, 0x60, + 0x0B, 0xFD, 0xFF, 0xFF, 0x62, 0xFF, 0xFF, 0xFF, 0x1A, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0xD2, 0xF3, 0xFF, 0xFF, 0xEF, 0xB4, 0xD2, 0xFB, 0xAD, 0x4F, 0xFD, 0xB4, 0xA0, 0x5D, 0xD0, 0x60, + 0x00, 0xE8, 0x2A, 0xE8, 0xD9, 0x60, 0xFE, 0x64, 0x32, 0x45, 0xA4, 0x85, 0x45, 0x52, 0x99, 0xFF, + 0xA5, 0x4F, 0xFF, 0xB4, 0x07, 0xFB, 0x98, 0xFF, 0xA4, 0x60, 0x7C, 0x63, 0x06, 0x60, 0x0B, 0xFD, + 0x62, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, 0x07, 0x02, + 0x62, 0xFF, 0x63, 0xFF, 0x64, 0xFF, 0x65, 0xFF, 0x66, 0xFF, 0xBF, 0xFE, 0xA1, 0xFF, 0x82, 0xFF, + 0x88, 0xFF, 0x6C, 0x40, 0x41, 0xFF, 0xC4, 0xE2, 0x43, 0xFF, 0x5C, 0x49, 0x08, 0xE1, 0xA3, 0x60, + 0x30, 0x78, 0xFF, 0xFF, 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, 0x02, 0x02, 0xA1, 0xFF, 0xFF, 0xFF, + 0x82, 0xFF, 0x88, 0xFF, 0xA8, 0xE2, 0x01, 0x70, 0xAD, 0xF1, 0x00, 0x6B, 0x89, 0xFF, 0x64, 0x54, + 0x88, 0xFF, 0x9F, 0xFE, 0x02, 0x05, 0x64, 0x44, 0x60, 0x54, 0xCD, 0xE2, 0xC2, 0x64, 0x3A, 0xDB, + 0xBC, 0xFF, 0xB5, 0xFF, 0x1D, 0xFF, 0x26, 0x44, 0x02, 0xB4, 0x40, 0x46, 0x3C, 0x44, 0x00, 0xBC, + 0xFF, 0xFF, 0x06, 0x03, 0x27, 0x40, 0x26, 0x22, 0x03, 0x00, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, + 0x27, 0x44, 0x20, 0x2A, 0x04, 0x00, 0xA0, 0x60, 0x00, 0xEA, 0xB0, 0x60, 0x00, 0xEA, 0x5C, 0x44, + 0x27, 0x44, 0x18, 0xB4, 0x40, 0x47, 0x00, 0xE1, 0xA4, 0xE2, 0xC4, 0xE2, 0x47, 0xFF, 0xB6, 0xFF, + 0xB7, 0xFF, 0xB4, 0xFF, 0x32, 0xF1, 0x08, 0x29, 0x09, 0x00, 0x64, 0x40, 0x07, 0x22, 0x06, 0x00, + 0x43, 0xFF, 0x27, 0x44, 0x10, 0xBC, 0x40, 0x47, 0x00, 0x64, 0x32, 0xFB, 0x31, 0x41, 0x3C, 0x44, + 0x01, 0xB1, 0x00, 0xBC, 0x0A, 0x02, 0x09, 0x03, 0x32, 0xF3, 0x00, 0x7C, 0x01, 0xB4, 0xFF, 0xFF, + 0x04, 0x03, 0x32, 0xF9, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0xC8, 0x60, 0x09, 0x7D, 0x00, 0x60, + 0x00, 0x6B, 0x00, 0x64, 0x33, 0xFB, 0x0C, 0x60, 0x16, 0x64, 0xA0, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0xE1, 0x30, 0x40, 0x02, 0x36, 0xA1, 0xFF, 0x83, 0xFF, 0x8D, 0xFF, 0x5C, 0x44, 0x5C, 0x43, + 0x5C, 0x42, 0x5C, 0x41, 0x5C, 0x40, 0xAC, 0xFF, 0xAD, 0xFF, 0xE7, 0xE1, 0xB3, 0x60, 0xBE, 0x78, + 0xFF, 0xFF, 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, 0x03, 0x02, 0x28, 0xE2, 0x40, 0xFF, 0xA1, 0xFF, + 0x84, 0xFF, 0xC1, 0x60, 0x6B, 0x64, 0x40, 0x42, 0xB7, 0x60, 0xA2, 0x64, 0x40, 0x40, 0x9C, 0xF3, + 0x65, 0xFB, 0x0F, 0x60, 0xF6, 0x63, 0xA9, 0xF3, 0xBD, 0xDB, 0x00, 0x60, 0x9A, 0x64, 0xBD, 0xDB, + 0x02, 0x64, 0xBD, 0xDB, 0x04, 0x64, 0xA3, 0xDB, 0x5C, 0x49, 0x0A, 0x64, 0x40, 0x4B, 0x5C, 0x5C, + 0x01, 0x60, 0x39, 0xE2, 0x04, 0x60, 0x00, 0x7A, 0x89, 0xFF, 0x03, 0x60, 0xFF, 0x73, 0x88, 0xFF, + 0xB7, 0x60, 0xA2, 0x78, 0xFF, 0xFF, 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, 0x06, 0x02, 0x40, 0xFF, + 0x42, 0xFF, 0x43, 0xFF, 0x44, 0xFF, 0x45, 0xFF, 0xA1, 0xFF, 0x88, 0xFF, 0x85, 0xFF, 0x21, 0xE1, + 0x5C, 0x40, 0xC3, 0x60, 0x53, 0x78, 0xFF, 0xFF, 0xA2, 0xFF, 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, + 0x01, 0x02, 0xA1, 0xFF, 0x86, 0xFF, 0x88, 0xFF, 0x5C, 0x46, 0x5C, 0x49, 0x5C, 0x40, 0xE1, 0x60, + 0x58, 0x4F, 0x7A, 0x78, 0xFF, 0xFF, 0xD0, 0x60, 0x58, 0x4F, 0xA2, 0x78, 0xFF, 0xFF, 0xEB, 0x60, + 0x58, 0x4F, 0x10, 0x78, 0xFF, 0xFF, 0xDD, 0x60, 0x58, 0x4F, 0xF5, 0x78, 0xFF, 0xFF, 0x1F, 0xE1, + 0xA3, 0xFF, 0xCA, 0x60, 0x7E, 0x78, 0xFF, 0xFF, 0x03, 0xE1, 0xA3, 0xFF, 0x1E, 0x60, 0x9E, 0x63, + 0x17, 0xFD, 0xAE, 0xFF, 0xF0, 0x60, 0xC7, 0x78, 0xFF, 0xFF, 0x86, 0xF3, 0x87, 0xF3, 0xDC, 0x81, + 0x00, 0x7C, 0x01, 0x00, 0x00, 0xFA, 0x60, 0x46, 0xFE, 0x63, 0xA3, 0xD8, 0xFE, 0x1F, 0xCD, 0x81, + 0xD8, 0x84, 0xF8, 0x02, 0x86, 0xF3, 0x87, 0xF5, 0xDC, 0x81, 0x80, 0x67, 0x40, 0x4A, 0x05, 0x18, + 0x2A, 0x43, 0x02, 0xFC, 0x5F, 0x8A, 0x00, 0xF4, 0xFA, 0x01, 0x2E, 0x58, 0xFF, 0xFF, 0x88, 0xF3, + 0x06, 0x61, 0x00, 0x7C, 0x60, 0x46, 0xFE, 0x63, 0xA3, 0xD8, 0xFE, 0x1F, 0xCD, 0x81, 0x66, 0x44, + 0xD8, 0x84, 0xF8, 0x02, 0x09, 0x60, 0x2B, 0x7C, 0x88, 0xF3, 0x06, 0x61, 0x60, 0x46, 0x01, 0x63, + 0x76, 0xF8, 0x00, 0xFC, 0x63, 0x47, 0x06, 0xFA, 0x76, 0xF8, 0x03, 0x64, 0x77, 0xFA, 0xDF, 0x83, + 0x66, 0x44, 0xCD, 0x81, 0x02, 0xA6, 0xF4, 0x02, 0x2E, 0x58, 0xFF, 0xFF, 0x8A, 0xF1, 0x89, 0xF3, + 0x7C, 0x63, 0x8C, 0xFB, 0x60, 0x46, 0x01, 0xFC, 0xDC, 0x84, 0xD0, 0x80, 0x00, 0xFA, 0xFA, 0x04, + 0x8D, 0xFB, 0x60, 0x46, 0x00, 0x64, 0x00, 0xFA, 0x63, 0x44, 0x80, 0x7F, 0x01, 0xFA, 0x8A, 0xF3, + 0x89, 0xF1, 0xDC, 0x84, 0xD0, 0x84, 0x8B, 0xFB, 0x03, 0x60, 0x26, 0x61, 0xB5, 0x60, 0x58, 0x4D, + 0x8C, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0x2E, 0xFB, 0x82, 0xFF, 0x40, 0x42, 0x87, 0xFF, 0x8B, 0xF3, + 0x93, 0xFB, 0x00, 0x64, 0x40, 0x50, 0x63, 0xFF, 0x60, 0xFF, 0x66, 0xFF, 0x65, 0xFF, 0x64, 0xFF, + 0x61, 0xFF, 0x62, 0xFF, 0x49, 0x60, 0x02, 0xE1, 0x52, 0x60, 0x02, 0xE1, 0x5C, 0x60, 0x02, 0xE1, + 0x65, 0x60, 0x02, 0xE1, 0x6B, 0x60, 0x02, 0xE1, 0x76, 0x60, 0x02, 0xE1, 0x41, 0x60, 0x02, 0xE1, + 0x04, 0x64, 0x0F, 0x60, 0x9F, 0xFB, 0x1F, 0x60, 0x64, 0x64, 0x7F, 0xFB, 0x2D, 0xFF, 0x0A, 0x61, + 0x41, 0x4B, 0x09, 0x60, 0x08, 0x61, 0xB5, 0x60, 0x58, 0x4D, 0x8C, 0x78, 0xFF, 0xFF, 0xF0, 0x67, + 0x0E, 0xFA, 0x1F, 0x60, 0x0A, 0x64, 0x0F, 0x60, 0x93, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x2B, 0x41, 0x4D, 0x8B, 0xFF, 0xFF, 0xEA, 0x02, 0x09, 0x61, + 0x41, 0x4B, 0x09, 0x60, 0x08, 0x61, 0xB5, 0x60, 0x58, 0x4D, 0x8C, 0x78, 0xFF, 0xFF, 0x1E, 0x60, + 0xFE, 0x64, 0x0F, 0x60, 0x93, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0x2B, 0x41, 0x4D, 0x8B, 0xFF, 0xFF, 0xEC, 0x02, 0x1E, 0x60, 0xB0, 0x78, 0xFF, 0xFF, + 0x00, 0xEA, 0x00, 0xEB, 0x50, 0x60, 0x03, 0xEA, 0x51, 0x60, 0x13, 0xEA, 0x52, 0x60, 0x30, 0xEA, + 0x53, 0x60, 0x40, 0xEA, 0x54, 0x60, 0x52, 0xEA, 0x55, 0x60, 0x6D, 0xEA, 0x56, 0x60, 0x71, 0xEA, + 0x57, 0x60, 0x8B, 0xEA, 0x58, 0x60, 0x47, 0xEA, 0x59, 0x60, 0xA0, 0xEA, 0x5A, 0x60, 0xB2, 0xEA, + 0x5B, 0x60, 0xC1, 0xEA, 0x5C, 0x60, 0xD7, 0xEA, 0x5D, 0x60, 0xEB, 0xEA, 0x5E, 0x60, 0xA0, 0xEA, + 0x50, 0x60, 0x36, 0xEB, 0x51, 0x60, 0x37, 0xEB, 0x52, 0x60, 0x20, 0xEB, 0x53, 0x60, 0xE4, 0xEB, + 0x54, 0x60, 0x34, 0xEB, 0x55, 0x60, 0x58, 0xEB, 0x56, 0x60, 0x48, 0xEB, 0x57, 0x60, 0xD0, 0xEB, + 0x58, 0x60, 0xC3, 0xEB, 0x59, 0x60, 0xFC, 0xEB, 0x5A, 0x60, 0x34, 0xEB, 0x5B, 0x60, 0x58, 0xEB, + 0x5C, 0x60, 0xC0, 0xEB, 0x5D, 0x60, 0xD0, 0xEB, 0x5E, 0x60, 0x91, 0xEB, 0x00, 0xEA, 0x00, 0xEB, + 0xE0, 0x60, 0x02, 0xEA, 0xE0, 0x60, 0x03, 0xEB, 0xA0, 0x60, 0x00, 0xEB, 0xB0, 0x60, 0x00, 0xEB, + 0xAB, 0x48, 0x40, 0x3B, 0x01, 0x00, 0xFC, 0x01, 0x00, 0xEB, 0x03, 0x60, 0x02, 0x64, 0xA0, 0xDB, + 0x0F, 0x64, 0x60, 0x7F, 0xA0, 0x5A, 0x80, 0x60, 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, 0xD1, 0x60, + 0x00, 0xEA, 0x24, 0x44, 0xFF, 0xB4, 0x04, 0xFB, 0x50, 0x60, 0x00, 0x64, 0x05, 0xFB, 0x10, 0x60, + 0x10, 0x75, 0xF0, 0x60, 0xC7, 0x78, 0xFF, 0xFF, 0x3F, 0x40, 0x40, 0x26, 0x40, 0x00, 0x05, 0x60, + 0xF9, 0xF1, 0x42, 0x60, 0x08, 0x64, 0x09, 0x60, 0x19, 0x63, 0x64, 0x40, 0x01, 0x2B, 0x04, 0x00, + 0x42, 0x60, 0x09, 0x64, 0x0A, 0x60, 0x19, 0x63, 0x18, 0x60, 0x22, 0xFB, 0x04, 0x60, 0x00, 0xBC, + 0x18, 0x60, 0x1E, 0xFB, 0x18, 0x60, 0x1D, 0xFD, 0x1D, 0x60, 0x19, 0x63, 0x18, 0x60, 0x21, 0xFD, + 0x80, 0x60, 0x1C, 0x64, 0x3F, 0x40, 0x01, 0x2A, 0x02, 0x00, 0x60, 0x60, 0x1C, 0x64, 0x18, 0x60, + 0x23, 0xFB, 0x18, 0x60, 0x1F, 0xFB, 0x18, 0x60, 0x22, 0xF3, 0xA0, 0x50, 0xA0, 0x50, 0x0B, 0x60, + 0xF8, 0x63, 0xA3, 0xD1, 0x30, 0x60, 0x38, 0x61, 0xA1, 0xD3, 0xF8, 0xA3, 0x90, 0x84, 0xA2, 0xDB, + 0xA3, 0xD1, 0x59, 0xD3, 0x06, 0xA3, 0x90, 0x84, 0xA2, 0xDB, 0xA3, 0xD1, 0x59, 0xD3, 0xFE, 0xA3, + 0x90, 0x84, 0xA2, 0xDB, 0xA3, 0xD1, 0x59, 0xD3, 0xFF, 0xFF, 0x90, 0x84, 0xA2, 0xDB, 0x80, 0x60, + 0x58, 0xEC, 0x80, 0x60, 0x00, 0xED, 0x80, 0x60, 0x80, 0xEE, 0x40, 0xEC, 0x00, 0xED, 0x00, 0xEE, + 0xC0, 0x60, 0x59, 0xEC, 0xC0, 0x60, 0x07, 0xED, 0xC0, 0x60, 0x8F, 0xEE, 0xAD, 0x4F, 0xFA, 0xB4, + 0xA0, 0x5D, 0x00, 0xF3, 0x28, 0xFB, 0x40, 0x44, 0xA2, 0x60, 0xE8, 0x7C, 0x20, 0xF9, 0x1D, 0x60, + 0xD0, 0x7C, 0x21, 0xF9, 0x1D, 0x60, 0xE6, 0x7C, 0x22, 0xF9, 0x1E, 0x60, 0x44, 0x7C, 0x23, 0xF9, + 0x1E, 0x60, 0x55, 0x7C, 0x24, 0xF9, 0x1E, 0x60, 0x7F, 0x7C, 0x25, 0xF9, 0x1E, 0x60, 0x90, 0x7C, + 0x26, 0xF9, 0xD0, 0x60, 0x00, 0xE8, 0x28, 0xE8, 0x44, 0x60, 0x01, 0xE6, 0x00, 0x64, 0x40, 0x52, + 0x10, 0x60, 0x04, 0xE6, 0x08, 0x60, 0x06, 0x63, 0xFD, 0x60, 0x0C, 0x65, 0x5B, 0xD3, 0xBF, 0xD1, + 0x0C, 0x18, 0xC3, 0x83, 0xD4, 0x80, 0xC3, 0x83, 0xF9, 0x02, 0xFA, 0xA3, 0xA3, 0xD3, 0x02, 0x60, + 0x00, 0x65, 0xF9, 0xA0, 0xFC, 0xA0, 0x09, 0x05, 0x00, 0x05, 0x21, 0x60, 0x00, 0x65, 0x3F, 0x43, + 0x21, 0x60, 0x00, 0x65, 0xC0, 0x60, 0x8F, 0xEE, 0x08, 0x00, 0x02, 0x60, 0x00, 0x65, 0x00, 0x60, + 0x00, 0x64, 0x18, 0xFB, 0x3F, 0x43, 0x11, 0x60, 0x10, 0xE6, 0xB7, 0x84, 0x40, 0x5F, 0x30, 0x60, + 0x20, 0x63, 0x3F, 0x40, 0x20, 0x27, 0x06, 0x00, 0x0F, 0x60, 0xFF, 0x64, 0xBD, 0xDB, 0x0F, 0x60, + 0xF0, 0x64, 0x03, 0x00, 0x0F, 0x64, 0xBD, 0xDB, 0x00, 0x64, 0xA3, 0xDB, 0x00, 0x60, 0x30, 0xE2, + 0x00, 0x60, 0x50, 0xE2, 0x00, 0x60, 0x79, 0xE2, 0x00, 0x60, 0x90, 0xE2, 0x01, 0x60, 0xD0, 0xE2, + 0x01, 0x60, 0xF0, 0xE2, 0x01, 0x60, 0xB0, 0xE2, 0x13, 0x64, 0xAD, 0xFB, 0x01, 0x60, 0x67, 0x64, + 0x37, 0xFB, 0x00, 0x60, 0x50, 0x64, 0x36, 0xFB, 0x09, 0x60, 0x2A, 0x64, 0x98, 0xFB, 0x82, 0xFF, + 0x92, 0xFF, 0x5C, 0x41, 0x5C, 0x46, 0x5C, 0x47, 0x00, 0xE1, 0xA4, 0x60, 0x7C, 0x63, 0x0C, 0x60, + 0x16, 0x64, 0xA0, 0xDD, 0x87, 0xFF, 0x97, 0xFF, 0x0C, 0x60, 0x02, 0x64, 0x40, 0x5A, 0x06, 0xA4, + 0x40, 0x5B, 0x5C, 0x5E, 0x13, 0x60, 0x52, 0xF3, 0x64, 0xFB, 0x3F, 0x40, 0x01, 0x22, 0x03, 0x00, + 0x80, 0x60, 0x37, 0x7C, 0x02, 0x00, 0x80, 0x60, 0x27, 0x7C, 0x16, 0x60, 0x55, 0xF9, 0x00, 0x60, + 0x80, 0x64, 0x89, 0xFB, 0x02, 0x60, 0x80, 0x66, 0x22, 0x60, 0x22, 0x64, 0x77, 0x60, 0x77, 0x63, + 0x00, 0xFA, 0x01, 0xFC, 0x00, 0xF0, 0x01, 0xF0, 0xD0, 0x80, 0xD3, 0x80, 0x1E, 0x02, 0x1D, 0x02, + 0x06, 0x60, 0x80, 0x65, 0x45, 0x4A, 0xAA, 0x46, 0x00, 0xFC, 0x01, 0xFA, 0xAA, 0x46, 0x00, 0xF0, + 0x2A, 0x41, 0x50, 0x65, 0xD3, 0x80, 0xCD, 0x84, 0x13, 0x03, 0x0A, 0x60, 0x80, 0x65, 0x45, 0x4A, + 0xAA, 0x46, 0x00, 0xFC, 0x01, 0xFA, 0xAA, 0x46, 0x00, 0xF0, 0x65, 0x41, 0xC8, 0x65, 0xD3, 0x80, + 0xCD, 0x84, 0x06, 0x03, 0x12, 0x60, 0x7F, 0x64, 0x03, 0x00, 0x10, 0x65, 0x02, 0x60, 0x7F, 0x64, + 0x65, 0x43, 0x86, 0xFD, 0x0F, 0x60, 0x5B, 0xFD, 0x07, 0x61, 0xC5, 0x81, 0xE1, 0x85, 0xD4, 0x84, + 0x8A, 0xFB, 0xDC, 0x84, 0x88, 0xFB, 0x0C, 0xA4, 0x87, 0xFB, 0x0F, 0x60, 0x5C, 0xFB, 0x1E, 0x60, + 0x58, 0x4E, 0xD3, 0x78, 0xFF, 0xFF, 0x1E, 0x60, 0x58, 0x4E, 0xB9, 0x78, 0xFF, 0xFF, 0x3F, 0x40, + 0x40, 0x26, 0x05, 0x00, 0x18, 0x60, 0x20, 0xF3, 0x5A, 0xD1, 0xA0, 0x50, 0xA4, 0x52, 0x00, 0x64, + 0x0A, 0x60, 0x7E, 0xFB, 0x1E, 0x60, 0xF2, 0x78, 0xFF, 0xFF, 0x5C, 0x51, 0x3F, 0x41, 0xA5, 0x4C, + 0x50, 0x37, 0x0B, 0x00, 0x01, 0xB9, 0x41, 0x5F, 0xB5, 0x60, 0x55, 0xE0, 0x05, 0x60, 0xF9, 0xF1, + 0xC0, 0x67, 0x90, 0x84, 0x3F, 0x40, 0x01, 0x26, 0xA0, 0x50, 0x06, 0x60, 0x08, 0xF3, 0x01, 0x60, + 0x01, 0x65, 0x01, 0x60, 0x02, 0x7C, 0xD4, 0x80, 0xD0, 0x80, 0x01, 0x03, 0x10, 0x02, 0x5A, 0xD1, + 0x5A, 0xD3, 0x3E, 0x60, 0x00, 0x66, 0xE0, 0x87, 0x40, 0x4A, 0xF7, 0x60, 0x8C, 0x61, 0x64, 0x44, + 0xC8, 0x84, 0x0C, 0x63, 0xAA, 0x46, 0x58, 0xD0, 0xAA, 0x46, 0x59, 0xD8, 0xFB, 0x1F, 0x08, 0x60, + 0x00, 0x63, 0xFA, 0x60, 0x00, 0x65, 0xBD, 0xD3, 0xA3, 0xD3, 0x02, 0xA8, 0xD4, 0x80, 0x07, 0x02, + 0x06, 0x02, 0x49, 0x60, 0x4C, 0x61, 0x3C, 0x60, 0x00, 0x66, 0x41, 0x4B, 0x03, 0x00, 0x24, 0x60, + 0x84, 0x78, 0xFF, 0xFF, 0x2B, 0x41, 0x49, 0x60, 0x94, 0x7C, 0xD1, 0x80, 0xA1, 0xD2, 0x25, 0x05, + 0x59, 0xD0, 0x60, 0x45, 0x59, 0xD2, 0x44, 0x47, 0xE0, 0x87, 0x40, 0x4A, 0x59, 0xD2, 0x59, 0x8B, + 0x40, 0x4C, 0x08, 0x60, 0x00, 0x63, 0xBE, 0xD3, 0xBD, 0xD1, 0xEC, 0x18, 0xD4, 0x80, 0xEA, 0x18, + 0x03, 0x03, 0xC3, 0x83, 0xC3, 0x83, 0xF7, 0x01, 0x67, 0x44, 0xC0, 0x84, 0xE0, 0x85, 0x2C, 0x44, + 0xD4, 0x80, 0x63, 0x41, 0x01, 0x06, 0x65, 0x44, 0xC8, 0x83, 0xAA, 0x46, 0x59, 0xD1, 0x27, 0xD8, + 0x5A, 0x87, 0xFC, 0x1F, 0xAA, 0x46, 0x2B, 0x41, 0xD5, 0x01, 0x49, 0x60, 0x94, 0x61, 0x41, 0x4B, + 0x2B, 0x41, 0x49, 0x60, 0x94, 0x7C, 0xD1, 0x80, 0xA1, 0xD2, 0x27, 0x05, 0x59, 0xD0, 0x60, 0x45, + 0x59, 0xD2, 0x44, 0x47, 0xE0, 0x87, 0x40, 0x4A, 0x59, 0xD2, 0x59, 0x8B, 0x40, 0x4C, 0x08, 0x60, + 0x00, 0x63, 0xBE, 0xD3, 0xBD, 0xD1, 0xEC, 0x18, 0xD4, 0x80, 0xEA, 0x18, 0x03, 0x03, 0xC3, 0x83, + 0xC3, 0x83, 0xF7, 0x01, 0x04, 0xA3, 0xA3, 0xD1, 0x5A, 0x88, 0x2C, 0x43, 0xD3, 0x80, 0xFF, 0xFF, + 0x01, 0x06, 0x64, 0x43, 0xCF, 0x83, 0xAA, 0x46, 0x60, 0xFE, 0x28, 0xD1, 0x5E, 0x88, 0x27, 0xD8, + 0x5A, 0x87, 0xFB, 0x1F, 0x20, 0xFE, 0xAA, 0x46, 0xD3, 0x01, 0xFA, 0x60, 0x39, 0x65, 0x24, 0x60, + 0x58, 0x4D, 0x97, 0x78, 0xFF, 0xFF, 0x03, 0x03, 0xBE, 0xD1, 0x07, 0x60, 0xED, 0xF9, 0x07, 0x60, + 0xED, 0xF3, 0x20, 0x60, 0x00, 0x7C, 0x60, 0x40, 0x10, 0x2A, 0x05, 0x00, 0x07, 0x60, 0xEC, 0xF9, + 0x07, 0x60, 0xEB, 0xF9, 0x12, 0x00, 0x04, 0xB0, 0x10, 0x60, 0x55, 0xF3, 0x0E, 0x03, 0x02, 0xBC, + 0xA2, 0xDB, 0x07, 0x60, 0xF5, 0xFB, 0x10, 0x60, 0xE8, 0xF3, 0x10, 0x60, 0xAC, 0xF3, 0x02, 0xBD, + 0x02, 0xBC, 0xA2, 0xDB, 0x65, 0x44, 0x10, 0x60, 0xE8, 0xFB, 0x07, 0x60, 0xED, 0xF3, 0x31, 0x41, + 0x60, 0x40, 0x20, 0x2A, 0x40, 0xB9, 0x40, 0x26, 0x03, 0x00, 0x60, 0x40, 0x01, 0x26, 0x80, 0xB9, + 0x41, 0x51, 0xFA, 0x60, 0x3A, 0x65, 0x24, 0x60, 0x58, 0x4D, 0x97, 0x78, 0xFF, 0xFF, 0x03, 0x02, + 0x23, 0x60, 0x1D, 0x78, 0xFF, 0xFF, 0x5B, 0xD3, 0xF8, 0x60, 0x3F, 0x65, 0x00, 0x7F, 0xE0, 0x84, + 0xE0, 0x84, 0x10, 0x60, 0xF7, 0xF3, 0xE0, 0x9C, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, + 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0xBD, 0xD3, 0xFF, 0xFF, 0x60, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0xE0, 0x84, 0x10, 0x60, 0xFA, 0xF3, 0xE0, 0x9C, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, + 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x21, 0x60, 0xFA, 0x61, 0xA3, 0xD3, + 0xFF, 0xFF, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0xE0, 0x84, 0xA1, 0xD3, 0xE0, 0x9C, 0xA4, 0x84, + 0xB0, 0x84, 0xA1, 0xDB, 0xA3, 0xD3, 0xFF, 0xFF, 0x00, 0x7F, 0xE0, 0x84, 0xE0, 0x84, 0x59, 0xD3, + 0xE0, 0x9C, 0xA4, 0x84, 0xB0, 0x84, 0xA1, 0xDB, 0x11, 0x60, 0x00, 0xF3, 0xFF, 0xFF, 0xA4, 0x84, + 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x11, 0x60, + 0x03, 0xF3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, + 0xB0, 0x84, 0xA2, 0xDB, 0x11, 0x60, 0x06, 0xF3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, + 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0xA3, 0xD3, 0xFF, 0xFF, 0x60, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0xE0, 0x84, 0x11, 0x60, 0x09, 0xF3, 0xE0, 0x9C, 0xA4, 0x84, 0xB0, 0x84, + 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x11, 0x60, 0x0C, 0xF3, + 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, + 0xA2, 0xDB, 0x11, 0x60, 0x0F, 0xF3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, + 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x02, 0xA3, 0xA3, 0xD3, 0xF8, 0x60, 0x3F, 0x65, + 0x00, 0x7F, 0xE0, 0x84, 0xE0, 0x84, 0x11, 0x60, 0x12, 0xF3, 0xE0, 0x9C, 0xA4, 0x84, 0xB0, 0x84, + 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0xBD, 0xD3, 0xFF, 0xFF, + 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0xE0, 0x84, 0x11, 0x60, 0x15, 0xF3, 0xE0, 0x9C, 0xA4, 0x84, + 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x22, 0x60, + 0x30, 0x61, 0xA3, 0xD3, 0xFF, 0xFF, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0xE0, 0x84, 0xA1, 0xD3, + 0xE0, 0x9C, 0xA4, 0x84, 0xB0, 0x84, 0xA1, 0xDB, 0xA3, 0xD3, 0xFF, 0xFF, 0x00, 0x7F, 0xE0, 0x84, + 0xE0, 0x84, 0x59, 0xD3, 0xE0, 0x9C, 0xA4, 0x84, 0xB0, 0x84, 0xA1, 0xDB, 0x11, 0x60, 0x1B, 0xF3, + 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, + 0xA2, 0xDB, 0x11, 0x60, 0x1E, 0xF3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, + 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x11, 0x60, 0x21, 0xF3, 0xFF, 0xFF, 0xA4, 0x84, + 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0xA3, 0xD3, + 0xFF, 0xFF, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0xE0, 0x84, 0x11, 0x60, 0x24, 0xF3, 0xE0, 0x9C, + 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, + 0x11, 0x60, 0x27, 0xF3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, + 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x11, 0x60, 0x2A, 0xF3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, + 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x00, 0x60, 0x6A, 0x63, + 0x22, 0x60, 0x56, 0x61, 0x21, 0x60, 0xEA, 0x64, 0x58, 0xD1, 0x59, 0xD9, 0xFD, 0x1F, 0x11, 0x60, + 0x33, 0xF3, 0xFF, 0xFF, 0x18, 0xAC, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0x18, 0xAC, 0xA2, 0xDB, + 0x11, 0x60, 0x37, 0xF3, 0xFF, 0xFF, 0x18, 0xAC, 0xA2, 0xDB, 0x11, 0x60, 0x39, 0xF3, 0xFF, 0xFF, + 0x18, 0xAC, 0xA2, 0xDB, 0x11, 0x60, 0x40, 0xF3, 0xFF, 0xFF, 0x18, 0xAC, 0xA2, 0xDB, 0x11, 0x60, + 0x42, 0xF3, 0xFF, 0xFF, 0x18, 0xAC, 0xA2, 0xDB, 0x11, 0x60, 0x4E, 0xF3, 0xFF, 0xFF, 0x18, 0xAC, + 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0x18, 0xAC, 0xA2, 0xDB, 0x11, 0x60, 0x52, 0xF3, 0xFF, 0xFF, + 0x18, 0xAC, 0xA2, 0xDB, 0x11, 0x60, 0x54, 0xF3, 0xFF, 0xFF, 0x18, 0xAC, 0xA2, 0xDB, 0x11, 0x60, + 0x5B, 0xF3, 0xFF, 0xFF, 0x18, 0xAC, 0xA2, 0xDB, 0x11, 0x60, 0x5D, 0xF3, 0xFF, 0xFF, 0x18, 0xAC, + 0xA2, 0xDB, 0xFA, 0x60, 0x2C, 0x65, 0x24, 0x60, 0x58, 0x4D, 0x97, 0x78, 0xFF, 0xFF, 0x0E, 0x03, + 0x63, 0x45, 0x23, 0x60, 0xF0, 0x63, 0x06, 0x61, 0xA5, 0xD1, 0xDA, 0x85, 0x64, 0x44, 0x0F, 0xB4, + 0xBD, 0xDB, 0x64, 0x47, 0x0F, 0xB4, 0xCD, 0x81, 0xBD, 0xDB, 0xF6, 0x02, 0xFA, 0x60, 0x30, 0x65, + 0x24, 0x60, 0x58, 0x4D, 0x97, 0x78, 0xFF, 0xFF, 0x14, 0x03, 0xBD, 0xD3, 0x63, 0x46, 0x24, 0x60, + 0x88, 0x63, 0x12, 0x60, 0x53, 0xFB, 0xDA, 0x85, 0xBD, 0xDB, 0x0E, 0x61, 0xA6, 0xD1, 0xDA, 0x86, + 0x64, 0x44, 0xFF, 0xB4, 0xA5, 0xDB, 0xDA, 0x85, 0x64, 0x47, 0xFF, 0xB4, 0xCD, 0x81, 0xBD, 0xDB, + 0xF5, 0x02, 0xFA, 0x60, 0x31, 0x65, 0x24, 0x60, 0x58, 0x4D, 0x97, 0x78, 0xFF, 0xFF, 0x22, 0x03, + 0xBD, 0xD3, 0x12, 0x60, 0x71, 0xFB, 0x5A, 0x81, 0x12, 0x60, 0x80, 0xFB, 0x5A, 0x82, 0x12, 0x60, + 0x8F, 0xFB, 0x5A, 0x83, 0x12, 0x60, 0x9E, 0xFB, 0x5A, 0x84, 0x0E, 0x61, 0xBD, 0xD1, 0xBD, 0xD5, + 0x64, 0x44, 0xFF, 0xB4, 0x21, 0xDB, 0x5A, 0x81, 0x64, 0x47, 0xFF, 0xB4, 0x22, 0xDB, 0x5A, 0x82, + 0x66, 0x44, 0xFF, 0xB4, 0x23, 0xDB, 0x5A, 0x83, 0x66, 0x47, 0xFF, 0xB4, 0x24, 0xDB, 0xCD, 0x81, + 0x5A, 0x84, 0xEC, 0x02, 0xFA, 0x60, 0x47, 0x65, 0x24, 0x60, 0x58, 0x4D, 0x97, 0x78, 0xFF, 0xFF, + 0x11, 0x03, 0x63, 0x45, 0x25, 0x60, 0x5A, 0x63, 0xA5, 0xD1, 0xDA, 0x85, 0xBD, 0xD9, 0x02, 0x61, + 0xA5, 0xD1, 0xDA, 0x85, 0x64, 0x47, 0x00, 0x7E, 0xBD, 0xDB, 0x64, 0x44, 0x00, 0x7E, 0xCD, 0x81, + 0xBD, 0xDB, 0xF6, 0x02, 0xFA, 0x60, 0x2E, 0x65, 0x24, 0x60, 0x58, 0x4D, 0x97, 0x78, 0xFF, 0xFF, + 0x1F, 0x03, 0x63, 0x46, 0xFC, 0xA3, 0xA3, 0xD3, 0x24, 0x60, 0x08, 0x63, 0xCC, 0x84, 0xE8, 0x84, + 0xCC, 0x81, 0x00, 0x36, 0x0D, 0x00, 0x63, 0x45, 0xA6, 0xD3, 0x5A, 0xD1, 0xDA, 0x86, 0xFF, 0xB4, + 0xE0, 0x84, 0xC4, 0x84, 0x5C, 0x90, 0xBD, 0xD9, 0xFD, 0x02, 0xCD, 0x81, 0x66, 0x42, 0xF4, 0x02, + 0x66, 0x42, 0x5A, 0xD3, 0x24, 0x60, 0x48, 0x65, 0xBD, 0xDB, 0xD7, 0x80, 0xFF, 0xFF, 0xFC, 0x02, + 0x25, 0x60, 0x6E, 0x61, 0xFA, 0x60, 0x46, 0x65, 0x24, 0x60, 0x58, 0x4D, 0x97, 0x78, 0xFF, 0xFF, + 0x01, 0x03, 0xA1, 0xDD, 0xD9, 0x81, 0xFA, 0x60, 0x2F, 0x65, 0x24, 0x60, 0x58, 0x4D, 0x97, 0x78, + 0xFF, 0xFF, 0x01, 0x03, 0xA1, 0xDD, 0xD9, 0x81, 0xFA, 0x60, 0x3E, 0x65, 0x24, 0x60, 0x58, 0x4D, + 0x97, 0x78, 0xFF, 0xFF, 0x01, 0x03, 0xA1, 0xDD, 0xD9, 0x81, 0xFA, 0x60, 0x3F, 0x65, 0x24, 0x60, + 0x58, 0x4D, 0x97, 0x78, 0xFF, 0xFF, 0x01, 0x03, 0xA1, 0xDD, 0xD9, 0x81, 0xFA, 0x60, 0x40, 0x65, + 0x24, 0x60, 0x58, 0x4D, 0x97, 0x78, 0xFF, 0xFF, 0x01, 0x03, 0xA1, 0xDD, 0xD9, 0x81, 0xFA, 0x60, + 0x3B, 0x65, 0x24, 0x60, 0x58, 0x4D, 0x97, 0x78, 0xFF, 0xFF, 0x01, 0x03, 0xA1, 0xDD, 0xFA, 0x60, + 0x48, 0x65, 0x24, 0x60, 0x58, 0x4D, 0x97, 0x78, 0xFF, 0xFF, 0x10, 0x03, 0xBD, 0xD3, 0x25, 0x60, + 0xCA, 0x61, 0x0E, 0xB4, 0xBD, 0xD1, 0xA1, 0xDB, 0x64, 0x47, 0x0E, 0xB4, 0xA3, 0xD1, 0x59, 0xDB, + 0x64, 0x44, 0x0E, 0xB4, 0x59, 0xDB, 0x64, 0x47, 0x0E, 0xB4, 0x59, 0xDB, 0xFA, 0x60, 0x29, 0x65, + 0x24, 0x60, 0x58, 0x4D, 0x97, 0x78, 0xFF, 0xFF, 0x07, 0x03, 0x04, 0xA3, 0xA3, 0xD3, 0x20, 0x60, + 0x00, 0x65, 0xB4, 0x84, 0x10, 0x60, 0x29, 0xFB, 0xFA, 0x60, 0x2A, 0x65, 0x24, 0x60, 0x58, 0x4D, + 0x97, 0x78, 0xFF, 0xFF, 0x39, 0x03, 0x04, 0xA3, 0xBD, 0xD1, 0x10, 0x60, 0xCD, 0xF3, 0x64, 0x41, + 0x64, 0x5E, 0xA2, 0xDB, 0x64, 0x47, 0x5A, 0xD3, 0x60, 0x5C, 0x64, 0x5F, 0xA2, 0xDB, 0x10, 0x60, + 0xE3, 0xF3, 0xFF, 0x60, 0xC0, 0xB5, 0x61, 0x40, 0x80, 0x27, 0x05, 0x00, 0xE9, 0x87, 0x3F, 0xB4, + 0xB4, 0x84, 0xA2, 0xDB, 0x1E, 0x00, 0x65, 0x44, 0xA2, 0xDB, 0x10, 0x60, 0xDC, 0xF1, 0xE1, 0x80, + 0xF9, 0x81, 0xE1, 0x80, 0xF9, 0x84, 0xFF, 0x60, 0x80, 0xB4, 0xC0, 0x9C, 0xA2, 0xD9, 0x10, 0x60, + 0xDF, 0xF1, 0xFF, 0xFF, 0xC0, 0x9C, 0xA2, 0xD9, 0x10, 0x60, 0xE6, 0xF1, 0x01, 0x7E, 0x60, 0x47, + 0x60, 0x41, 0x64, 0x44, 0xFE, 0x60, 0x00, 0xB5, 0xC1, 0x84, 0x01, 0x60, 0xFF, 0xB4, 0xB4, 0x84, + 0xA2, 0xDB, 0xDB, 0x83, 0x11, 0x60, 0x62, 0xFD, 0xFA, 0x60, 0x2B, 0x65, 0x24, 0x60, 0x58, 0x4D, + 0x97, 0x78, 0xFF, 0xFF, 0x07, 0x03, 0x04, 0xA3, 0xBD, 0xD3, 0x10, 0x60, 0xD0, 0xFB, 0xA3, 0xD3, + 0x10, 0x60, 0x94, 0xFB, 0xFA, 0x60, 0x3C, 0x65, 0x24, 0x60, 0x58, 0x4D, 0x97, 0x78, 0xFF, 0xFF, + 0x1F, 0x03, 0xA3, 0xD3, 0xFC, 0x60, 0xFC, 0x65, 0xA4, 0x84, 0x60, 0x5C, 0x00, 0x7E, 0xC0, 0x60, + 0x00, 0xA0, 0x60, 0x43, 0x07, 0x04, 0x10, 0x60, 0xD4, 0xF3, 0xFF, 0xFF, 0x03, 0x60, 0xFF, 0xB4, + 0x3C, 0x94, 0xA2, 0xDB, 0x21, 0x60, 0x30, 0x61, 0x64, 0x44, 0x00, 0x7F, 0xC0, 0xA0, 0x60, 0x47, + 0x07, 0x04, 0x60, 0x43, 0xA1, 0xD3, 0xFF, 0xFF, 0x03, 0x60, 0xFF, 0xB4, 0x3C, 0x94, 0xA1, 0xDB, + 0xB8, 0xFE, 0xB9, 0xFE, 0xBA, 0xFE, 0xBB, 0xFE, 0xBD, 0xFE, 0xBF, 0xFE, 0x15, 0x60, 0xCB, 0xF3, + 0x12, 0x63, 0x60, 0x40, 0x01, 0x27, 0x04, 0x00, 0x0B, 0x60, 0xEA, 0x62, 0x5A, 0xDF, 0xFE, 0x1F, + 0x1F, 0x60, 0xC8, 0x78, 0xFF, 0xFF, 0x08, 0x60, 0x06, 0x63, 0xBE, 0xD3, 0xBD, 0xD1, 0x07, 0x18, + 0xD4, 0x80, 0x05, 0x18, 0x03, 0x03, 0xC3, 0x83, 0xC3, 0x83, 0xF7, 0x01, 0xDB, 0x83, 0x00, 0xBC, + 0x2D, 0x58, 0xFF, 0xFF, 0x86, 0xFD, 0xB0, 0x26, 0x00, 0x00, 0x06, 0x00, 0x10, 0xFD, 0x32, 0x01, + 0x00, 0x00, 0x02, 0x00, 0x14, 0xFD, 0x94, 0x2B, 0x00, 0x00, 0x0A, 0x00, 0x41, 0xFA, 0x46, 0x23, + 0x00, 0x00, 0x22, 0x00, 0x42, 0xFA, 0x68, 0x23, 0x00, 0x00, 0x22, 0x00, 0x43, 0xFA, 0x8A, 0x23, + 0x00, 0x00, 0x22, 0x00, 0x44, 0xFA, 0xAC, 0x23, 0x00, 0x00, 0x22, 0x00, 0x45, 0xFA, 0xCE, 0x23, + 0x00, 0x00, 0x22, 0x00, 0x25, 0xFD, 0x62, 0x01, 0x00, 0x00, 0x02, 0x00, + +}; /* fw_image_3_data */ + +static const hcf_8 fw_image_4_data[] = { + 0x6C, 0x40, 0xA1, 0xFF, 0x98, 0xFF, 0x80, 0x3E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x41, 0xFF, 0x33, 0xF3, 0x32, 0x11, 0x31, 0x18, 0x40, 0x64, 0x3A, 0xDB, 0x1C, 0x00, 0xFF, 0xFF, + 0xC4, 0xE2, 0x27, 0x44, 0x20, 0x2A, 0x01, 0x00, 0xFF, 0xFF, 0x42, 0x64, 0x3A, 0xDB, 0x23, 0x00, + 0x41, 0xFF, 0xA3, 0x60, 0x34, 0x78, 0xE2, 0xFE, 0x40, 0x49, 0x02, 0x60, 0x01, 0xE1, 0x1D, 0x00, + 0x44, 0xFF, 0x1B, 0x09, 0x29, 0x44, 0x10, 0x2A, 0x04, 0x74, 0xCD, 0xE2, 0x10, 0x65, 0x0B, 0x00, + 0xA4, 0x60, 0x49, 0x78, 0xA4, 0xE2, 0x29, 0x44, 0x20, 0x2A, 0x0D, 0x00, 0x20, 0xAC, 0xEC, 0x01, + 0xA4, 0x60, 0x49, 0x78, 0x46, 0xFF, 0xB4, 0x84, 0x40, 0x49, 0xA1, 0xFF, 0xFF, 0xFF, 0x80, 0x3E, + 0xA4, 0x60, 0x49, 0x78, 0xFF, 0xFF, 0x62, 0xFF, 0x08, 0xE1, 0xA1, 0xFF, 0x98, 0xFF, 0x80, 0x3E, + 0xAA, 0x60, 0xF4, 0x78, 0x4C, 0x4E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xAA, 0x60, 0xFB, 0x78, 0x44, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC4, 0xE2, 0x84, 0xFF, 0x22, 0x58, 0x82, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA4, 0x60, 0xB9, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0xE1, 0x01, 0xFF, 0xFF, + 0x10, 0x29, 0xFA, 0x01, 0xE4, 0xE2, 0xAA, 0x60, 0xB0, 0x78, 0x94, 0xF3, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC1, 0x60, 0x35, 0x78, 0x64, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xAA, 0x60, 0x97, 0x78, 0xAC, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x80, 0x29, 0xE2, 0x01, 0xAA, 0x60, 0xF3, 0x78, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB4, 0x60, 0xEF, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB5, 0x60, 0x1C, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB3, 0x60, 0x8B, 0x78, 0x42, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB3, 0x60, 0xBE, 0x78, 0x43, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB3, 0x60, 0xBE, 0x78, 0x44, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB6, 0x60, 0x9D, 0x78, 0x45, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB3, 0x60, 0xC1, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x60, 0x83, 0x64, 0x80, 0x29, 0x09, 0xFB, 0xB4, 0x60, 0xB7, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, + 0x98, 0xFF, 0xC2, 0x60, 0x69, 0x78, 0x40, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC1, 0x60, 0xE0, 0x78, 0x98, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC0, 0x60, 0x3D, 0x78, 0x98, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xBF, 0x60, 0xB8, 0x78, 0x98, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB7, 0x60, 0x96, 0x78, 0x98, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA1, 0xFF, 0x98, 0xFF, 0x83, 0x3E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC3, 0x60, 0x58, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0x41, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0x42, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0xB0, 0xFF, 0xB1, 0xFF, 0x40, 0xFF, 0x43, 0xFF, 0xC3, 0x60, 0x53, 0x78, 0x44, 0xFF, 0xFF, 0x01, + 0xC3, 0x60, 0x58, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0x1C, 0x60, 0x28, 0x78, 0x45, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0xC3, 0x60, 0x53, 0x78, 0x84, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0xC3, 0x60, 0x52, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0xCA, 0x60, 0x76, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xE8, 0x60, 0x6C, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x42, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x85, 0x3E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xCA, 0x60, 0x7E, 0x78, 0x24, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xE6, 0x60, 0x2A, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xCA, 0x60, 0x7E, 0x78, 0x44, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xCA, 0x60, 0x7E, 0x78, 0x84, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xCA, 0x60, 0x7E, 0x78, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xF0, 0x60, 0x9F, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xF0, 0x60, 0xCA, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xF0, 0x60, 0xE3, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xF0, 0x60, 0xC7, 0x78, 0x28, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xF0, 0x60, 0xC7, 0x78, 0x44, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xF0, 0x60, 0xC7, 0x78, 0x45, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xF0, 0x60, 0xC7, 0x78, 0x46, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x60, 0x87, 0x64, 0x80, 0x29, 0x09, 0xFB, 0x47, 0xFF, 0xF0, 0x60, 0xC7, 0x78, 0xFF, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x43, 0xF7, 0xA7, 0xFF, 0x41, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xA2, 0x60, 0x00, 0x78, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x2E, 0x60, 0x54, 0x63, 0x20, 0x44, 0xBD, 0xDB, 0x21, 0x44, 0xBD, 0xDB, 0x22, 0x44, 0xBD, 0xDB, + 0x23, 0x44, 0xBD, 0xDB, 0x24, 0x44, 0xBD, 0xDB, 0x25, 0x44, 0xBD, 0xDB, 0x26, 0x44, 0xBD, 0xDB, + 0x27, 0x44, 0xBD, 0xDB, 0x28, 0x44, 0xBD, 0xDB, 0x29, 0x44, 0xBD, 0xDB, 0x2A, 0x44, 0xBD, 0xDB, + 0x2B, 0x44, 0xBD, 0xDB, 0x2C, 0x44, 0xBD, 0xDB, 0x2D, 0x44, 0xBD, 0xDB, 0x2E, 0x44, 0xBD, 0xDB, + 0x2F, 0x44, 0xBD, 0xDB, 0x17, 0x60, 0x24, 0xFD, 0x2F, 0x60, 0x74, 0x63, 0x17, 0x60, 0x25, 0xFD, + 0x30, 0x44, 0x17, 0x60, 0x26, 0xFB, 0x31, 0x44, 0x17, 0x60, 0x27, 0xFB, 0x32, 0x44, 0x17, 0x60, + 0x28, 0xFB, 0x33, 0x44, 0x17, 0x60, 0x29, 0xFB, 0x81, 0xFF, 0x91, 0xFF, 0x58, 0x51, 0x44, 0x00, + 0x82, 0xFF, 0x92, 0xFF, 0x58, 0x51, 0x40, 0x00, 0x83, 0xFF, 0x93, 0xFF, 0x58, 0x51, 0x3C, 0x00, + 0x84, 0xFF, 0x94, 0xFF, 0x58, 0x51, 0x38, 0x00, 0x85, 0xFF, 0x95, 0xFF, 0x58, 0x51, 0x34, 0x00, + 0x86, 0xFF, 0x96, 0xFF, 0x58, 0x51, 0x30, 0x00, 0x87, 0xFF, 0x97, 0xFF, 0x58, 0x51, 0x2C, 0x00, + 0x80, 0xFF, 0x90, 0xFF, 0x99, 0xFF, 0x17, 0x60, 0x24, 0xF1, 0x30, 0x44, 0x64, 0x43, 0xBD, 0xDB, + 0x31, 0x44, 0xBD, 0xDB, 0x32, 0x44, 0xBD, 0xDB, 0x33, 0x44, 0xBD, 0xDB, 0x34, 0x44, 0xBD, 0xDB, + 0x35, 0x44, 0xBD, 0xDB, 0x36, 0x44, 0xBD, 0xDB, 0x37, 0x44, 0xBD, 0xDB, 0x38, 0x44, 0xBD, 0xDB, + 0x39, 0x44, 0xBD, 0xDB, 0x3A, 0x44, 0xBD, 0xDB, 0x3B, 0x44, 0xBD, 0xDB, 0x3C, 0x44, 0xBD, 0xDB, + 0x3D, 0x44, 0xBD, 0xDB, 0x3E, 0x44, 0xBD, 0xDB, 0x3F, 0x44, 0xBD, 0xDB, 0xEE, 0x60, 0x48, 0x64, + 0x0A, 0xFB, 0x40, 0x21, 0xFE, 0x01, 0x70, 0x00, 0x42, 0x50, 0x40, 0x53, 0x17, 0x60, 0x25, 0xF3, + 0xFF, 0xFF, 0x40, 0x52, 0x33, 0x44, 0x32, 0x42, 0xA2, 0xDB, 0xDA, 0x82, 0xA2, 0xDD, 0xDA, 0x83, + 0x65, 0x44, 0xBD, 0xDB, 0x61, 0x44, 0xBD, 0xDB, 0x66, 0x44, 0xBD, 0xDB, 0xBD, 0xD9, 0x30, 0x44, + 0xBD, 0xDB, 0x99, 0xFF, 0xA4, 0x4C, 0xBD, 0xDB, 0xA5, 0x4C, 0xBD, 0xDB, 0xA0, 0x4C, 0xBD, 0xDB, + 0xA1, 0x4C, 0xBD, 0xDB, 0x98, 0xFF, 0x17, 0x60, 0x25, 0xFD, 0x17, 0x60, 0x26, 0xF3, 0xFF, 0xFF, + 0x40, 0x50, 0x17, 0x60, 0x28, 0xF3, 0xFF, 0xFF, 0x40, 0x52, 0x17, 0x60, 0x29, 0xF3, 0xFF, 0xFF, + 0x40, 0x53, 0x31, 0x41, 0x17, 0x60, 0x27, 0xF3, 0xFF, 0xFF, 0x40, 0x51, 0x17, 0x60, 0x24, 0xF3, + 0xFF, 0xFF, 0x60, 0x43, 0x20, 0x44, 0xBD, 0xDB, 0x21, 0x44, 0xBD, 0xDB, 0x22, 0x44, 0xBD, 0xDB, + 0x23, 0x44, 0xBD, 0xDB, 0x24, 0x44, 0xBD, 0xDB, 0x25, 0x44, 0xBD, 0xDB, 0x26, 0x44, 0xBD, 0xDB, + 0x27, 0x44, 0xBD, 0xDB, 0x28, 0x44, 0xBD, 0xDB, 0x29, 0x44, 0xBD, 0xDB, 0x2A, 0x44, 0xBD, 0xDB, + 0x2B, 0x44, 0xBD, 0xDB, 0x2C, 0x44, 0xBD, 0xDB, 0x2D, 0x44, 0xBD, 0xDB, 0x2E, 0x44, 0xBD, 0xDB, + 0x2F, 0x44, 0xBD, 0xDB, 0x17, 0x60, 0x24, 0xFD, 0x61, 0x58, 0xFF, 0xFF, 0x28, 0x60, 0x76, 0x63, + 0xA3, 0xD3, 0x33, 0x5C, 0x02, 0xA4, 0xBD, 0xDB, 0xFE, 0xB4, 0xE0, 0x85, 0xC4, 0x85, 0x47, 0xD9, + 0x34, 0x44, 0x5B, 0xDB, 0x44, 0xF3, 0x5B, 0xDB, 0xA1, 0xFF, 0xFF, 0xFF, 0x87, 0x3E, 0xFF, 0x01, + 0x82, 0xE1, 0x80, 0xFF, 0x90, 0xFF, 0x88, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x87, 0x3E, 0x41, 0xFF, + 0x00, 0x60, 0x03, 0xE1, 0x21, 0x46, 0x66, 0x45, 0x00, 0xF4, 0x2E, 0x44, 0x09, 0xFA, 0x6A, 0x61, + 0x7F, 0x60, 0xFE, 0x63, 0xA1, 0xFF, 0x9A, 0xFF, 0x05, 0x11, 0x0A, 0x00, 0x00, 0xF4, 0x01, 0xF2, + 0x17, 0x18, 0x7A, 0x61, 0x02, 0x25, 0x04, 0x00, 0x6C, 0x44, 0x7A, 0xDA, 0xFB, 0x1C, 0xF6, 0x11, + 0xD9, 0x81, 0x41, 0xFF, 0x02, 0x1C, 0x00, 0xF4, 0xDA, 0x82, 0x41, 0xFF, 0xC9, 0x81, 0xCB, 0x83, + 0x6C, 0x44, 0x5A, 0xDA, 0x02, 0x1C, 0x00, 0xF4, 0x81, 0xF2, 0x6C, 0x44, 0x5A, 0xDA, 0xCB, 0x83, + 0x02, 0x74, 0x02, 0x60, 0x04, 0xE1, 0x80, 0x60, 0x00, 0x61, 0x5D, 0x93, 0xB5, 0xFF, 0x98, 0xFF, + 0x26, 0x44, 0xFD, 0xB4, 0x84, 0xBC, 0x40, 0x46, 0x65, 0x46, 0x00, 0x64, 0x23, 0xFA, 0x3F, 0xFC, + 0x63, 0x47, 0x0A, 0x63, 0x0F, 0xFC, 0x00, 0xF4, 0x08, 0xFA, 0xCB, 0xFE, 0x18, 0xE1, 0x44, 0xFF, + 0xA1, 0xFF, 0x98, 0xFF, 0x80, 0x3E, 0xE2, 0xFE, 0x03, 0x04, 0xA3, 0x60, 0x99, 0x78, 0xFF, 0xFF, + 0xE0, 0xFE, 0x03, 0x04, 0xA3, 0x60, 0xAF, 0x78, 0xFF, 0xFF, 0xE1, 0xFE, 0x07, 0x05, 0x9F, 0xFE, + 0x03, 0x04, 0x18, 0x60, 0x24, 0x78, 0xFF, 0xFF, 0x43, 0xFF, 0xA9, 0x01, 0xD3, 0xF3, 0xFF, 0xFF, + 0x01, 0xB4, 0xFF, 0xFF, 0x08, 0x24, 0x15, 0x00, 0x29, 0x44, 0x08, 0x26, 0xE1, 0x01, 0x72, 0x44, + 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0x94, 0xF3, 0xE8, 0x85, 0xFF, 0xB7, + 0xE0, 0x84, 0xE0, 0x84, 0xB4, 0x85, 0x73, 0x44, 0xD4, 0x84, 0x10, 0x65, 0xD4, 0x80, 0xFF, 0xFF, + 0x37, 0x04, 0x3F, 0x40, 0x40, 0x26, 0x09, 0x00, 0x18, 0x60, 0x1C, 0xF3, 0x5A, 0xD1, 0xA0, 0x50, + 0xA4, 0x52, 0x5A, 0xD3, 0x5A, 0xD1, 0xA0, 0x50, 0xA4, 0x50, 0xBC, 0xF3, 0xD2, 0xF1, 0x01, 0xA8, + 0x07, 0xA8, 0x0A, 0x03, 0x09, 0x03, 0x64, 0x40, 0x01, 0x26, 0x09, 0x00, 0x18, 0x60, 0x07, 0xF3, + 0xFF, 0xFF, 0x01, 0xB4, 0xFF, 0xFF, 0x03, 0x02, 0xAD, 0x4F, 0xFA, 0xB4, 0xA0, 0x5D, 0xAE, 0x4F, + 0x02, 0xBC, 0x00, 0x7F, 0xA0, 0x5E, 0x3F, 0x40, 0x02, 0x2B, 0x11, 0x00, 0x0C, 0x60, 0x00, 0x62, + 0x00, 0x60, 0x71, 0x7C, 0x00, 0x60, 0xB1, 0x65, 0x1A, 0x60, 0x58, 0x4D, 0x88, 0x78, 0xFF, 0xFF, + 0x08, 0xE1, 0x62, 0xFF, 0xA3, 0xFF, 0xFF, 0xFF, 0xA2, 0xFF, 0x02, 0x60, 0x08, 0xE1, 0xBD, 0xFE, + 0x97, 0x01, 0x21, 0x46, 0x01, 0x5D, 0x5C, 0x62, 0x03, 0xE1, 0x44, 0xFF, 0xA1, 0xFF, 0x9A, 0xFF, + 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0x62, 0x62, 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0xA1, 0xFF, + 0x5A, 0xDC, 0x12, 0xE1, 0x02, 0x60, 0x01, 0xE1, 0xA1, 0xFF, 0x98, 0xFF, 0x80, 0x3E, 0x28, 0x40, + 0x40, 0x2B, 0x03, 0x00, 0x29, 0x40, 0x20, 0x27, 0x97, 0x00, 0xC8, 0x74, 0xCD, 0xE2, 0x29, 0x44, + 0x08, 0xBC, 0x40, 0x49, 0x44, 0xFF, 0x05, 0xE1, 0x28, 0x40, 0x08, 0x2A, 0x07, 0x00, 0x28, 0x40, + 0x48, 0x36, 0x04, 0x00, 0xD2, 0xF3, 0xFF, 0xFF, 0x02, 0xBC, 0xD2, 0xFB, 0x29, 0x44, 0xFF, 0x60, + 0xEF, 0x65, 0x24, 0x89, 0x40, 0x27, 0x3F, 0x00, 0x00, 0x00, 0x29, 0x40, 0x80, 0x27, 0x0B, 0x00, + 0x07, 0x61, 0xA1, 0xFF, 0xCD, 0x81, 0x04, 0x25, 0x61, 0x00, 0x87, 0x4C, 0xFB, 0x02, 0xF3, 0x60, + 0xA0, 0x64, 0x80, 0x4C, 0x07, 0x00, 0xA1, 0xFF, 0x9C, 0x4C, 0x9C, 0x4C, 0x9C, 0x4D, 0x05, 0x60, + 0xCF, 0x64, 0x80, 0x4C, 0x28, 0x40, 0x40, 0x2B, 0x05, 0x00, 0x29, 0x40, 0x20, 0x27, 0x02, 0x00, + 0x15, 0x60, 0x6F, 0x6B, 0x04, 0x25, 0x4A, 0x00, 0x30, 0x64, 0x3A, 0xDB, 0x44, 0xFF, 0x04, 0x25, + 0x45, 0x00, 0x04, 0x60, 0x00, 0x65, 0x25, 0x44, 0xB4, 0x84, 0x80, 0x4E, 0x2D, 0x41, 0x04, 0x25, + 0x3D, 0x00, 0x61, 0x4C, 0x00, 0x60, 0x8A, 0x65, 0xC5, 0x81, 0x61, 0x54, 0xA1, 0xFF, 0xFF, 0xFF, + 0x04, 0x25, 0x34, 0x00, 0x67, 0x4E, 0x07, 0x64, 0x1C, 0xFB, 0x00, 0xE1, 0x02, 0x60, 0x05, 0xE1, + 0xA1, 0xFF, 0x98, 0xFF, 0x80, 0x3E, 0x28, 0x40, 0x40, 0x27, 0x0A, 0x00, 0x1C, 0x65, 0x28, 0x40, + 0xA4, 0x36, 0x14, 0x65, 0x23, 0x44, 0xC4, 0x84, 0x28, 0x40, 0x08, 0x2A, 0x0C, 0x00, 0x07, 0x00, + 0x23, 0x44, 0x1C, 0xA4, 0x29, 0x40, 0x20, 0x27, 0x02, 0x00, 0x11, 0x60, 0x0F, 0x6B, 0x3C, 0x46, + 0x98, 0xF0, 0x23, 0x44, 0xC4, 0x84, 0x06, 0x74, 0x25, 0x5C, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, + 0xE0, 0x84, 0xB0, 0x84, 0x80, 0x4C, 0x9C, 0x4C, 0x44, 0xFF, 0x18, 0xE1, 0x0A, 0x64, 0x1E, 0x74, + 0x02, 0x60, 0x05, 0xE1, 0x40, 0x40, 0xA1, 0xFF, 0x98, 0xFF, 0x80, 0x3E, 0xC4, 0xE2, 0x27, 0x44, + 0x20, 0x2A, 0x06, 0x00, 0x42, 0x64, 0x3A, 0xDB, 0x67, 0x4C, 0xB0, 0x60, 0x80, 0x78, 0xFF, 0xFF, + 0x41, 0x64, 0x3A, 0xDB, 0x62, 0xFF, 0x08, 0xE1, 0xE2, 0xFE, 0x72, 0x52, 0xA1, 0xFF, 0x98, 0xFF, + 0x80, 0x3E, 0xA1, 0xFF, 0x98, 0xFF, 0x80, 0x3E, 0x28, 0x40, 0x08, 0x27, 0x66, 0x01, 0x3C, 0x46, + 0x8B, 0xFF, 0x84, 0x60, 0x00, 0xE4, 0x0F, 0x60, 0x92, 0x64, 0xC9, 0x60, 0x58, 0x4F, 0x10, 0x78, + 0xFF, 0xFF, 0x3F, 0xF2, 0x00, 0x60, 0x18, 0x70, 0x18, 0x71, 0x20, 0x72, 0x00, 0xF2, 0x60, 0x53, + 0x20, 0xE1, 0xA1, 0xFF, 0x88, 0x75, 0x00, 0xE1, 0xFF, 0xFF, 0x60, 0x50, 0x75, 0x44, 0x12, 0x71, + 0x6E, 0x72, 0x81, 0x75, 0xFF, 0xFF, 0x88, 0xFF, 0xA3, 0x60, 0xB5, 0x78, 0xFF, 0xFF, 0x32, 0xF3, + 0x08, 0x29, 0x0A, 0x00, 0x60, 0x40, 0x07, 0x22, 0x07, 0x00, 0xFE, 0xB4, 0x32, 0xFB, 0x27, 0x44, + 0x10, 0xBC, 0xF7, 0xB4, 0x40, 0x47, 0x43, 0xFF, 0x00, 0x64, 0x3A, 0xDB, 0x01, 0x60, 0x08, 0xE1, + 0x31, 0x40, 0x01, 0x2A, 0x04, 0x00, 0x00, 0x64, 0x33, 0xFB, 0x01, 0x60, 0x0A, 0xE1, 0xE5, 0xFE, + 0x27, 0x05, 0x9F, 0xFE, 0x12, 0x05, 0x31, 0x41, 0x40, 0x2A, 0x0F, 0x00, 0x07, 0x60, 0xEA, 0xF1, + 0xAE, 0x4C, 0x90, 0x80, 0x10, 0x2A, 0x09, 0x00, 0x7F, 0xB1, 0x07, 0x60, 0xEA, 0xFB, 0x60, 0x40, + 0x10, 0x2A, 0x80, 0xB9, 0x41, 0x51, 0xDF, 0xFE, 0x19, 0xFF, 0x27, 0x44, 0x10, 0x26, 0x13, 0x00, + 0x9F, 0xFE, 0x02, 0x04, 0x40, 0xE1, 0x06, 0x00, 0x7C, 0xE1, 0x31, 0x44, 0x01, 0x2A, 0x02, 0x00, + 0x04, 0x0A, 0xFD, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, 0xAF, 0x60, 0x7B, 0x78, 0xFF, 0xFF, + 0xAA, 0x60, 0xC0, 0x78, 0xFF, 0xFF, 0x27, 0x44, 0x08, 0x26, 0xFF, 0xFF, 0xC0, 0x60, 0xEA, 0x78, + 0xFF, 0xFF, 0x48, 0xF3, 0x32, 0xF1, 0x00, 0x63, 0x64, 0x40, 0x07, 0x26, 0x03, 0x00, 0xA5, 0x60, + 0x6C, 0x78, 0xFF, 0xFF, 0x31, 0x40, 0x08, 0x26, 0xF1, 0x01, 0xCD, 0xE2, 0x84, 0xE1, 0x70, 0x41, + 0xAD, 0x80, 0x71, 0x40, 0x80, 0x27, 0xEA, 0x12, 0x03, 0x03, 0xC1, 0x60, 0x3B, 0x78, 0xFF, 0xFF, + 0xA1, 0xFF, 0xFF, 0xFF, 0xC4, 0xE2, 0x32, 0xFD, 0x60, 0x40, 0x01, 0x2A, 0xDC, 0x01, 0x3C, 0x46, + 0x3E, 0xF2, 0x2A, 0xF0, 0x27, 0x41, 0x44, 0x48, 0x20, 0xB9, 0x01, 0xB4, 0xF7, 0xB1, 0x0A, 0x03, + 0x64, 0x40, 0x08, 0x27, 0x07, 0x00, 0x0F, 0x60, 0xEE, 0x63, 0x00, 0x64, 0x45, 0xFB, 0x46, 0xFB, + 0xBD, 0xDB, 0xA3, 0xDB, 0xCB, 0x0A, 0xCA, 0x11, 0x41, 0x47, 0x22, 0xF2, 0xFF, 0xFF, 0x60, 0x40, + 0x10, 0x26, 0x04, 0x00, 0x01, 0x2A, 0x05, 0x00, 0x10, 0x2B, 0x03, 0x00, 0x29, 0x47, 0x20, 0xBF, + 0x40, 0x49, 0x05, 0xE1, 0x01, 0x60, 0x08, 0xE1, 0x2A, 0xE8, 0x3C, 0x46, 0x00, 0x63, 0x32, 0xFD, + 0x43, 0xFF, 0x0F, 0xF0, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x2A, 0x03, 0x00, 0xA8, 0x60, 0x76, 0x78, + 0xFF, 0xFF, 0x64, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x27, 0x0E, 0x00, 0x1F, 0xF2, 0xFF, 0xFF, + 0x60, 0x40, 0x40, 0x2B, 0x09, 0x00, 0x15, 0x60, 0xDD, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x02, 0x2A, + 0x03, 0x00, 0xA9, 0x60, 0x81, 0x78, 0xFF, 0xFF, 0x1F, 0xF2, 0xC0, 0x60, 0x00, 0x65, 0xA4, 0x9C, + 0x3F, 0x60, 0xCF, 0x65, 0x29, 0x44, 0xA4, 0x84, 0x30, 0x89, 0x15, 0x60, 0xD9, 0xF3, 0xFF, 0xFF, + 0x15, 0x60, 0xD8, 0xFB, 0x1F, 0xF2, 0x39, 0xF1, 0xE0, 0x60, 0xFF, 0xB5, 0x0A, 0x18, 0x60, 0x47, + 0x1F, 0xB4, 0xD0, 0x84, 0xE0, 0xA0, 0x02, 0x0D, 0x00, 0x64, 0x02, 0x00, 0x01, 0x04, 0x1F, 0x64, + 0x60, 0x47, 0xB4, 0x81, 0x07, 0x60, 0xEB, 0xF1, 0xFF, 0xFF, 0xB1, 0x8C, 0x29, 0x40, 0x40, 0x2B, + 0x10, 0x00, 0x22, 0x60, 0xC6, 0x65, 0x60, 0x47, 0x1F, 0xB4, 0xE0, 0x84, 0xE0, 0x84, 0x44, 0xD3, + 0x5A, 0xD1, 0x01, 0x60, 0x00, 0xE1, 0x01, 0x60, 0x09, 0x6B, 0x60, 0x4C, 0xB5, 0xFF, 0x64, 0x4C, + 0x14, 0x00, 0x22, 0x60, 0xC6, 0x65, 0x60, 0x47, 0x1F, 0xB4, 0xE0, 0x84, 0xE0, 0x84, 0x44, 0xD3, + 0x5A, 0xD1, 0x01, 0x60, 0x00, 0xE1, 0x05, 0x60, 0x69, 0x6B, 0x60, 0x4C, 0xB5, 0xFF, 0x64, 0x4C, + 0x7C, 0x44, 0x29, 0x40, 0x80, 0x2B, 0x67, 0x44, 0x60, 0x4C, 0x00, 0xE1, 0x84, 0xFF, 0xC1, 0x60, + 0x6B, 0x64, 0x40, 0x42, 0x82, 0xFF, 0x0D, 0x00, 0xE5, 0xFE, 0x03, 0x04, 0xAA, 0x60, 0xC0, 0x78, + 0xFF, 0xFF, 0x32, 0xF1, 0xFF, 0xFF, 0x64, 0x40, 0x07, 0x22, 0x43, 0xFF, 0xA4, 0x60, 0x7C, 0x78, + 0xFF, 0xFF, 0x3C, 0x44, 0x0B, 0x64, 0x3A, 0xDB, 0x01, 0x60, 0x0A, 0xE1, 0x1C, 0x42, 0x22, 0x46, + 0x13, 0xF2, 0xFF, 0x65, 0x60, 0x47, 0x2A, 0xF2, 0x40, 0x45, 0x40, 0x48, 0x04, 0x2B, 0x13, 0x00, + 0x16, 0xF2, 0x1D, 0xF2, 0x40, 0x43, 0x0F, 0xF2, 0x40, 0x4D, 0x0F, 0x64, 0x14, 0xF0, 0x35, 0xF2, + 0xA0, 0x82, 0x0F, 0xB4, 0xCA, 0x85, 0xD4, 0x80, 0x10, 0xF2, 0x01, 0x02, 0x2B, 0xFA, 0x27, 0x44, + 0x40, 0xBC, 0x40, 0x47, 0x13, 0x00, 0x17, 0xF2, 0x2C, 0xF0, 0x40, 0x43, 0x1B, 0xF2, 0x1D, 0xFA, + 0x40, 0x4D, 0x64, 0x40, 0x01, 0x2A, 0x02, 0x00, 0xAB, 0xFC, 0x05, 0x00, 0x28, 0x40, 0xA4, 0x36, + 0x02, 0x00, 0x11, 0xF2, 0x2B, 0xFA, 0x27, 0x44, 0xBF, 0xB4, 0x40, 0x47, 0xF0, 0xFE, 0xAF, 0x60, + 0x85, 0x78, 0xFF, 0xFF, 0x22, 0x46, 0x2C, 0xF0, 0x27, 0x44, 0xDF, 0xB4, 0x40, 0x47, 0x64, 0x40, + 0x01, 0x26, 0x01, 0x00, 0x01, 0x00, 0x11, 0x00, 0x2A, 0xF0, 0x01, 0x65, 0x64, 0x40, 0xA4, 0x3A, + 0x04, 0x65, 0x27, 0x44, 0x34, 0x87, 0x36, 0xF3, 0xFF, 0xFF, 0x60, 0x56, 0xAD, 0xE2, 0x04, 0x64, + 0x3A, 0xDB, 0x69, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, 0x06, 0x64, 0x3A, 0xDB, 0x22, 0x46, + 0x01, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0xC1, 0x60, 0x44, 0x78, 0xFF, 0xFF, 0x28, 0x40, 0xC4, 0x3A, + 0x0C, 0x00, 0x27, 0x44, 0xFD, 0xB4, 0x40, 0x47, 0xA8, 0xE2, 0x05, 0xE1, 0x01, 0x60, 0x08, 0xE1, + 0x2A, 0xE8, 0x3C, 0x46, 0xA5, 0x60, 0x1C, 0x78, 0xFF, 0xFF, 0x3F, 0x40, 0x01, 0x2B, 0x05, 0x00, + 0x67, 0x4C, 0x01, 0x60, 0x00, 0xE1, 0x05, 0x60, 0x69, 0x6B, 0x07, 0x60, 0xEC, 0xF1, 0x1F, 0xF2, + 0x2A, 0xE8, 0xB0, 0x81, 0x29, 0x40, 0x40, 0x2B, 0x14, 0x00, 0x61, 0x4C, 0x22, 0x60, 0xC6, 0x65, + 0x61, 0x47, 0x1F, 0xB4, 0xE0, 0x84, 0xE0, 0x84, 0x44, 0xD3, 0x5A, 0xD1, 0x01, 0x60, 0x00, 0xE1, + 0x01, 0x60, 0x09, 0x6B, 0x60, 0x4C, 0xB5, 0xFF, 0xFF, 0x60, 0xF2, 0x64, 0x64, 0x4C, 0x40, 0x43, + 0x18, 0x00, 0x29, 0x47, 0x80, 0xB7, 0x34, 0x94, 0x60, 0x4C, 0x22, 0x60, 0xC6, 0x65, 0x61, 0x47, + 0x1F, 0xB4, 0xE0, 0x84, 0xE0, 0x84, 0x44, 0xD3, 0x5A, 0xD1, 0x01, 0x60, 0x00, 0xE1, 0x05, 0x60, + 0x69, 0x6B, 0x60, 0x4C, 0xB5, 0xFF, 0x64, 0x4C, 0x7C, 0x44, 0x29, 0x40, 0x80, 0x2B, 0x67, 0x44, + 0x60, 0x4C, 0x40, 0xE1, 0x01, 0x60, 0x08, 0xE1, 0x28, 0x45, 0xBF, 0x60, 0xFF, 0x64, 0x24, 0x88, + 0xC4, 0xE2, 0x08, 0x64, 0x3A, 0xDB, 0x21, 0x46, 0x2A, 0x44, 0x72, 0x45, 0x24, 0xFA, 0x94, 0xF3, + 0x06, 0x04, 0xE4, 0xE2, 0xDC, 0x9C, 0x29, 0x40, 0x01, 0x26, 0x64, 0x44, 0x94, 0xF9, 0x25, 0xFA, + 0x95, 0xF3, 0x02, 0x04, 0xDC, 0x84, 0x95, 0xFB, 0x28, 0xFA, 0x96, 0xF3, 0x02, 0x04, 0xDC, 0x84, + 0x96, 0xFB, 0x29, 0xFA, 0x24, 0x44, 0x04, 0x2A, 0x06, 0x00, 0x28, 0x40, 0xA4, 0x36, 0x03, 0x00, + 0xA7, 0x60, 0x46, 0x78, 0xFF, 0xFF, 0x94, 0xFC, 0x13, 0x60, 0x4A, 0xF1, 0x28, 0x44, 0x08, 0x2A, + 0x51, 0x00, 0x03, 0x2B, 0x01, 0x00, 0x4E, 0x00, 0x64, 0x40, 0x00, 0x36, 0x4B, 0x00, 0x32, 0xF2, + 0x2F, 0xF0, 0x50, 0xFE, 0x01, 0x2A, 0x03, 0x00, 0x01, 0x61, 0x8E, 0xF3, 0x31, 0x00, 0xD0, 0x80, + 0x33, 0xF2, 0x30, 0xF0, 0x34, 0xF2, 0xD0, 0x80, 0x31, 0xF0, 0xFF, 0xFF, 0xD0, 0x80, 0x60, 0x47, + 0x34, 0x0C, 0xFF, 0xB4, 0x15, 0x60, 0x02, 0x65, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0xFF, 0xFF, + 0x31, 0x18, 0x60, 0x43, 0x50, 0xFE, 0x66, 0x41, 0x32, 0xF0, 0x63, 0x46, 0x03, 0xF2, 0x61, 0x46, + 0xD0, 0x80, 0x33, 0xF0, 0x63, 0x46, 0x04, 0xF2, 0x61, 0x46, 0xD0, 0x80, 0x34, 0xF0, 0x63, 0x46, + 0x05, 0xF2, 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, 0x04, 0x0C, 0x00, 0xF2, 0x61, 0x46, 0x1A, 0x18, + 0xE8, 0x01, 0x06, 0xF0, 0x8E, 0xF3, 0x61, 0x46, 0x02, 0x61, 0x64, 0x40, 0x02, 0x2A, 0x12, 0x00, + 0xFC, 0xA0, 0xFF, 0xFF, 0x04, 0x0E, 0x61, 0x44, 0x14, 0xFA, 0x11, 0xFC, 0x0B, 0x00, 0x2C, 0xF2, + 0x2F, 0xFA, 0x2D, 0xF2, 0x30, 0xFA, 0x2E, 0xF2, 0x31, 0xFA, 0x1D, 0xFF, 0x26, 0x44, 0x02, 0xBC, + 0x40, 0x46, 0x1E, 0x00, 0x26, 0x43, 0x84, 0xBB, 0xFC, 0xB3, 0x21, 0x46, 0x01, 0x5D, 0x0F, 0xFC, + 0x5C, 0x46, 0x05, 0xFF, 0x27, 0x44, 0x01, 0x2A, 0x13, 0x00, 0x50, 0xFE, 0x28, 0x40, 0x08, 0x3A, + 0x12, 0x00, 0x2F, 0xF2, 0x30, 0xF0, 0x60, 0x43, 0x31, 0xF2, 0x22, 0x46, 0x64, 0x41, 0x2C, 0xF0, + 0x2D, 0xF0, 0xD3, 0x80, 0x2E, 0xF0, 0xD1, 0x80, 0xD0, 0x80, 0x27, 0x44, 0x09, 0x0C, 0x03, 0x00, + 0x27, 0x44, 0x06, 0x22, 0x05, 0x00, 0xB8, 0xB4, 0x40, 0x47, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, + 0xD4, 0x64, 0x40, 0x48, 0x0D, 0x64, 0x3A, 0xDB, 0x21, 0x46, 0x1C, 0xF2, 0x00, 0xE1, 0xF0, 0xFE, + 0x00, 0x63, 0x28, 0x44, 0xA4, 0x36, 0x07, 0x00, 0x04, 0x2B, 0x05, 0x00, 0x30, 0xF3, 0x2D, 0x45, + 0xD4, 0x84, 0xCA, 0x65, 0xD4, 0x83, 0xD4, 0x64, 0x35, 0x00, 0x0F, 0x64, 0x3A, 0xDB, 0x21, 0x46, + 0x29, 0x40, 0x40, 0x27, 0x15, 0x00, 0x80, 0x27, 0x02, 0x00, 0xCA, 0x65, 0x01, 0x00, 0x6A, 0x65, + 0x1C, 0xF2, 0xFF, 0xFF, 0x04, 0x7F, 0x40, 0x45, 0x0A, 0x36, 0x70, 0x64, 0x14, 0x36, 0x38, 0x64, + 0x37, 0x36, 0x15, 0x64, 0x6E, 0x3A, 0x17, 0x00, 0x84, 0x7F, 0x40, 0x45, 0x0B, 0x64, 0x13, 0x00, + 0x1C, 0xF2, 0x1E, 0x65, 0x40, 0x45, 0x0B, 0x36, 0x1E, 0x64, 0x0F, 0x36, 0x16, 0x64, 0x0A, 0x36, + 0x12, 0x64, 0x0E, 0x36, 0x0E, 0x64, 0x09, 0x36, 0x0E, 0x64, 0x0D, 0x36, 0x0A, 0x64, 0x08, 0x36, + 0x0A, 0x64, 0x0C, 0x36, 0x0A, 0x64, 0x40, 0x4D, 0x00, 0xE1, 0xF0, 0xFE, 0x2B, 0xF2, 0xC4, 0x85, + 0xD4, 0x83, 0xC4, 0x64, 0x40, 0x48, 0x2F, 0xF0, 0xB0, 0xF0, 0xB1, 0xF2, 0xA1, 0xFF, 0x12, 0x74, + 0xCD, 0xE2, 0x80, 0x4E, 0x12, 0x74, 0x83, 0x4C, 0x12, 0x74, 0x9A, 0xFF, 0x84, 0x4C, 0x12, 0x74, + 0x85, 0x4C, 0x12, 0x74, 0x81, 0x4C, 0x12, 0x74, 0xA1, 0xFF, 0x98, 0xFF, 0xB1, 0x60, 0x58, 0x4F, + 0x00, 0x78, 0xFF, 0xFF, 0x01, 0x60, 0x18, 0xE1, 0x78, 0x44, 0x03, 0xA4, 0x35, 0xFB, 0xB1, 0x60, + 0x43, 0x78, 0xFF, 0xFF, 0x29, 0x44, 0xF7, 0xB4, 0x40, 0x49, 0x27, 0x44, 0x01, 0x2A, 0x05, 0x00, + 0xFE, 0xB4, 0x40, 0x47, 0xA5, 0x60, 0xCD, 0x78, 0xFF, 0xFF, 0x13, 0x60, 0x2E, 0xF3, 0xFF, 0xFF, + 0x60, 0x40, 0x02, 0x36, 0xC1, 0xFE, 0xA4, 0x60, 0x6F, 0x78, 0xFF, 0xFF, 0x28, 0x40, 0xB4, 0x3A, + 0x0B, 0x00, 0x27, 0x44, 0x07, 0x22, 0x05, 0x00, 0xF8, 0xB4, 0x40, 0x47, 0x02, 0x64, 0x31, 0xFB, + 0xC0, 0xFE, 0xA6, 0x60, 0xDD, 0x78, 0xFF, 0xFF, 0x28, 0x44, 0xD4, 0x36, 0x03, 0x00, 0xA8, 0x60, + 0x5D, 0x78, 0xFF, 0xFF, 0xA8, 0xE2, 0x27, 0x44, 0xFB, 0xB4, 0x40, 0x47, 0x1C, 0x42, 0x22, 0x46, + 0x16, 0x60, 0x2B, 0xF3, 0xFF, 0xFF, 0x34, 0xFB, 0x2A, 0xF0, 0xF7, 0x60, 0xFF, 0x64, 0xA0, 0x84, + 0xA2, 0xDA, 0x60, 0x40, 0x40, 0x2B, 0xC4, 0x00, 0x22, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x22, 0x26, + 0x3F, 0x00, 0x01, 0x26, 0x03, 0x00, 0x04, 0x26, 0x05, 0x00, 0xBA, 0x00, 0x04, 0x2B, 0xB8, 0x00, + 0x87, 0xF5, 0x01, 0x00, 0x07, 0xF4, 0x4B, 0xF2, 0xFF, 0xFF, 0xDC, 0x84, 0x4B, 0xFA, 0x0C, 0x60, + 0xFE, 0x62, 0x80, 0xFF, 0xC8, 0x60, 0x78, 0x44, 0x02, 0xA4, 0xA2, 0xDB, 0x46, 0x78, 0xFF, 0xFF, + 0x82, 0xFF, 0x87, 0xF3, 0x66, 0x5C, 0xD0, 0x80, 0x00, 0x7C, 0x07, 0x03, 0x66, 0x43, 0x22, 0x46, + 0x22, 0xF2, 0x63, 0x46, 0x60, 0x40, 0x01, 0x2A, 0x01, 0x00, 0x3C, 0xF1, 0x4B, 0xF0, 0x64, 0x41, + 0x64, 0x47, 0x60, 0x5F, 0x20, 0xBC, 0x80, 0x26, 0x80, 0xAC, 0x60, 0x47, 0x22, 0x46, 0x3A, 0xFA, + 0x64, 0x44, 0x20, 0x7F, 0x34, 0x94, 0x3B, 0xFA, 0x08, 0x60, 0x00, 0xEA, 0x0F, 0x64, 0x60, 0x7F, + 0xA0, 0x5A, 0x80, 0x60, 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, 0xD1, 0x60, 0x00, 0xEA, 0x80, 0x00, + 0x2A, 0xF2, 0x00, 0x60, 0x7C, 0x62, 0x60, 0x40, 0x40, 0x2B, 0x24, 0x00, 0xA2, 0xD3, 0x00, 0x61, + 0x60, 0xFE, 0xA0, 0xD3, 0x5E, 0xD1, 0xFF, 0xFF, 0x20, 0xFE, 0x64, 0x5F, 0xDC, 0x84, 0xF1, 0x81, + 0xC0, 0x2B, 0x04, 0x00, 0x80, 0x2A, 0x02, 0x00, 0x7F, 0xA4, 0xDC, 0x84, 0xFF, 0x3B, 0x03, 0x00, + 0x60, 0x47, 0xDC, 0x87, 0x01, 0x61, 0xC0, 0x80, 0x00, 0x36, 0xDC, 0x84, 0x4E, 0xDB, 0x60, 0xFE, + 0x5A, 0xD1, 0xFF, 0xFF, 0xC1, 0x84, 0xF0, 0x22, 0x10, 0xA4, 0xF0, 0x2A, 0x01, 0x00, 0x00, 0x64, + 0xA2, 0xDB, 0x20, 0xFE, 0x00, 0x60, 0x3E, 0xF3, 0xFF, 0xFF, 0xA0, 0xD3, 0x5A, 0xD1, 0x3A, 0xFA, + 0x3B, 0xF8, 0x74, 0x62, 0xA2, 0xD0, 0xFF, 0xFF, 0x64, 0x44, 0xE0, 0x7F, 0xA0, 0x5A, 0x64, 0x47, + 0xE1, 0x7F, 0x5A, 0xD0, 0xA0, 0x5A, 0x64, 0x44, 0xE2, 0x7F, 0xA0, 0x5A, 0x00, 0x60, 0x40, 0xF3, + 0xFF, 0xFF, 0xA0, 0xD1, 0x5A, 0xD1, 0x64, 0x45, 0x64, 0x44, 0xE3, 0x7F, 0xA0, 0x5A, 0x64, 0x47, + 0xE4, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xE5, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xE6, 0x7F, + 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xE7, 0x7F, 0xA0, 0x5A, 0x65, 0x40, 0x0D, 0x3A, 0x1C, 0x00, + 0x64, 0x47, 0xE8, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xE9, 0x7F, 0xA0, 0x5A, 0x64, 0x47, + 0xEA, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xEB, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xEC, 0x7F, + 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xED, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xEE, 0x7F, 0x5A, 0xD1, + 0xA0, 0x5A, 0x64, 0x44, 0xEF, 0x7F, 0xA0, 0x5A, 0x08, 0x60, 0x00, 0xEA, 0x65, 0x44, 0x02, 0xA4, + 0x60, 0x7F, 0xA0, 0x5A, 0x80, 0x60, 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, 0xD1, 0x60, 0x00, 0xEA, + 0x0B, 0xF2, 0xFF, 0xFF, 0x7F, 0xB4, 0x0C, 0xF0, 0x04, 0x02, 0x64, 0x46, 0x00, 0xF0, 0x04, 0x64, + 0x22, 0x46, 0x03, 0xFA, 0x60, 0x41, 0x64, 0x46, 0x01, 0xF2, 0xFC, 0xA1, 0x61, 0x45, 0xD4, 0x84, + 0xFF, 0xFF, 0x08, 0x02, 0x00, 0xF0, 0x04, 0x63, 0x64, 0x46, 0x01, 0xF2, 0x22, 0x46, 0x1A, 0xFA, + 0x03, 0xFC, 0x02, 0x00, 0x22, 0x46, 0x1A, 0xFA, 0x35, 0xF2, 0x04, 0xF8, 0xDC, 0x84, 0x35, 0xFA, + 0x14, 0xF2, 0x0F, 0xB5, 0x0F, 0xB4, 0xCC, 0x84, 0x94, 0x80, 0x04, 0x60, 0x00, 0x65, 0x2A, 0xF2, + 0x01, 0x02, 0x94, 0x84, 0x2A, 0xFA, 0x95, 0xFC, 0x06, 0x00, 0xC4, 0x3A, 0x07, 0x00, 0x27, 0x44, + 0xFD, 0xB4, 0x40, 0x47, 0xA8, 0xE2, 0xA5, 0x60, 0x7A, 0x78, 0xFF, 0xFF, 0x28, 0x44, 0x04, 0x26, + 0x05, 0x00, 0x68, 0x3A, 0x03, 0x00, 0x32, 0x44, 0x00, 0x27, 0x03, 0x00, 0xA4, 0x60, 0x7C, 0x78, + 0xFF, 0xFF, 0x0A, 0x64, 0x3A, 0xDB, 0xA4, 0x60, 0x7C, 0x78, 0xFF, 0xFF, 0x0E, 0x64, 0x3A, 0xDB, + 0x3C, 0x44, 0x60, 0x46, 0x1E, 0xF0, 0x40, 0x42, 0x64, 0x40, 0x40, 0x27, 0x48, 0x00, 0x1F, 0xF2, + 0xFF, 0xFF, 0x60, 0x40, 0x40, 0x27, 0x3C, 0x00, 0x80, 0x2B, 0x0B, 0x00, 0xBF, 0x60, 0xFF, 0x65, + 0x29, 0x44, 0x24, 0x89, 0x80, 0x60, 0x00, 0x65, 0x29, 0x44, 0x34, 0x89, 0x80, 0x60, 0x00, 0x63, + 0x05, 0x00, 0x3F, 0x60, 0xFF, 0x65, 0x29, 0x44, 0x24, 0x89, 0x00, 0x63, 0x1E, 0xF2, 0x39, 0xF1, + 0xC0, 0x60, 0xFF, 0xB5, 0x0A, 0x18, 0x60, 0x47, 0x1F, 0xB4, 0xD0, 0x84, 0xE0, 0xA0, 0x02, 0x0D, + 0x00, 0x64, 0x02, 0x00, 0x01, 0x04, 0x1F, 0x64, 0x60, 0x47, 0xB4, 0x84, 0x07, 0x60, 0xEB, 0xF1, + 0x3C, 0x94, 0xB0, 0x84, 0x60, 0x4C, 0x22, 0x60, 0xC6, 0x65, 0x60, 0x47, 0x1F, 0xB4, 0xE0, 0x84, + 0xE0, 0x84, 0x44, 0xD3, 0x5A, 0xD1, 0x01, 0x60, 0x00, 0xE1, 0x05, 0x60, 0x69, 0x6B, 0x60, 0x4C, + 0xB5, 0xFF, 0x64, 0x4C, 0x7C, 0x44, 0x29, 0x40, 0x80, 0x2B, 0x67, 0x44, 0x60, 0x4C, 0x32, 0x00, + 0x15, 0x60, 0xDD, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x04, 0x26, 0xCB, 0x01, 0xBF, 0x01, 0x40, 0x60, + 0x00, 0x65, 0x29, 0x44, 0x34, 0x89, 0x40, 0x60, 0x00, 0x63, 0x9F, 0xF2, 0x1E, 0xF2, 0x39, 0xF1, + 0xC0, 0x60, 0xFF, 0xB5, 0x0A, 0x18, 0x60, 0x47, 0x1F, 0xB4, 0xD0, 0x84, 0xE0, 0xA0, 0x02, 0x0D, + 0x00, 0x64, 0x02, 0x00, 0x01, 0x04, 0x1F, 0x64, 0x60, 0x47, 0xB4, 0x84, 0x07, 0x60, 0xEB, 0xF1, + 0x3C, 0x94, 0xB0, 0x81, 0x61, 0x4C, 0x22, 0x60, 0xC6, 0x65, 0x61, 0x47, 0x1F, 0xB4, 0xE0, 0x84, + 0xE0, 0x84, 0x44, 0xD3, 0x5A, 0xD1, 0x01, 0x60, 0x00, 0xE1, 0x01, 0x60, 0x09, 0x6B, 0x60, 0x4C, + 0xB5, 0xFF, 0x64, 0x4C, 0x40, 0xE1, 0x01, 0x60, 0x08, 0xE1, 0x84, 0xFF, 0xC1, 0x60, 0x6B, 0x64, + 0x40, 0x42, 0x82, 0xFF, 0x2A, 0xF2, 0x10, 0x60, 0x00, 0x65, 0xA4, 0x84, 0xB4, 0xBC, 0x1E, 0xF0, + 0x40, 0x48, 0x64, 0x40, 0x40, 0x27, 0x17, 0x00, 0x1C, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x0A, 0x36, + 0x06, 0x00, 0x14, 0x36, 0x07, 0x00, 0x37, 0x36, 0x08, 0x00, 0x6E, 0x36, 0x09, 0x00, 0x70, 0x7C, + 0xA0, 0x63, 0x0F, 0x00, 0x38, 0x7C, 0x50, 0x63, 0x0C, 0x00, 0x15, 0x7C, 0x1E, 0x63, 0x09, 0x00, + 0x0B, 0x7C, 0x0F, 0x63, 0x06, 0x00, 0x9C, 0xF4, 0xFF, 0x65, 0x63, 0x47, 0xA4, 0x9C, 0xA7, 0x84, + 0x23, 0x00, 0x40, 0x45, 0x43, 0x4D, 0x00, 0xE1, 0xF0, 0xFE, 0x29, 0x40, 0x80, 0x2B, 0x03, 0x00, + 0x00, 0x60, 0x6A, 0x65, 0x02, 0x00, 0x00, 0x60, 0xCA, 0x65, 0x1F, 0xF2, 0xFF, 0xFF, 0x60, 0x40, + 0x40, 0x27, 0x0E, 0x00, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x04, 0x27, 0x03, 0x00, 0x65, 0x44, + 0xE0, 0x85, 0x12, 0x00, 0x2B, 0xF2, 0x11, 0xF0, 0xC0, 0x84, 0xD0, 0x84, 0xC4, 0x83, 0x11, 0x00, + 0x1E, 0x64, 0xC4, 0x84, 0x60, 0x45, 0x08, 0x00, 0x40, 0x45, 0xFF, 0x60, 0xF8, 0x64, 0x40, 0x43, + 0x00, 0xE1, 0xF0, 0xFE, 0x00, 0x60, 0x3C, 0x65, 0x91, 0xF4, 0x1B, 0xF0, 0xC3, 0x84, 0xC4, 0x84, + 0xC0, 0x83, 0x28, 0x44, 0xA1, 0xFF, 0x12, 0x74, 0x80, 0x4E, 0x12, 0x74, 0x83, 0x4C, 0x9A, 0xFF, + 0x12, 0x74, 0x56, 0x62, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, + 0x5C, 0x62, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0xA1, 0xFF, + 0x98, 0xFF, 0xB1, 0x60, 0x58, 0x4F, 0x00, 0x78, 0xFF, 0xFF, 0xBC, 0xFF, 0xB5, 0xFF, 0x01, 0x60, + 0x18, 0xE1, 0x47, 0xFF, 0x27, 0x44, 0x02, 0xBC, 0x40, 0x47, 0x36, 0xF3, 0xB6, 0xFF, 0xB7, 0xFF, + 0xB4, 0xFF, 0xC8, 0x60, 0x09, 0x7D, 0x7C, 0x4B, 0x60, 0x56, 0xAD, 0xE2, 0xA5, 0x60, 0xC7, 0x78, + 0xFF, 0xFF, 0x15, 0x60, 0xDD, 0xF3, 0x15, 0x60, 0xBE, 0xF3, 0x60, 0x40, 0x04, 0x26, 0x0B, 0x00, + 0x07, 0xB4, 0x60, 0x40, 0x01, 0x36, 0x07, 0x00, 0x29, 0x44, 0xBF, 0x60, 0xFF, 0xB7, 0x80, 0xBF, + 0x40, 0x49, 0x80, 0x67, 0x05, 0x00, 0x3F, 0x60, 0xFF, 0x65, 0x29, 0x44, 0x24, 0x89, 0x00, 0x64, + 0x12, 0x60, 0xD3, 0xF1, 0xFF, 0xFF, 0x15, 0x60, 0xD8, 0xF9, 0x39, 0xF1, 0x12, 0x60, 0xBF, 0xF1, + 0x64, 0x41, 0x64, 0x5E, 0x60, 0x45, 0x64, 0x47, 0x1F, 0xB4, 0x54, 0x94, 0xE0, 0xA0, 0x02, 0x0D, + 0x00, 0x64, 0x02, 0x00, 0x01, 0x04, 0x1F, 0x64, 0x60, 0x47, 0x07, 0x60, 0xEB, 0xF1, 0xB4, 0x84, + 0xB0, 0x8C, 0x22, 0x60, 0xC6, 0x7C, 0x60, 0x47, 0x1F, 0xB4, 0xE0, 0x84, 0xE0, 0x84, 0x40, 0xD3, + 0x5A, 0xD1, 0x01, 0x60, 0x00, 0xE1, 0x05, 0x60, 0x69, 0x6B, 0x60, 0x4C, 0xB5, 0xFF, 0x64, 0x4C, + 0x7C, 0x44, 0x29, 0x40, 0x80, 0x2B, 0x67, 0x44, 0x60, 0x4C, 0x40, 0xE1, 0x01, 0x60, 0x08, 0xE1, + 0x84, 0xFF, 0xC1, 0x60, 0x6B, 0x64, 0x40, 0x42, 0x82, 0xFF, 0x3C, 0x44, 0x60, 0x46, 0x40, 0x42, + 0x13, 0x64, 0x3A, 0xDB, 0x10, 0x60, 0x00, 0x65, 0x3C, 0x46, 0x2A, 0xF2, 0x15, 0x60, 0xBE, 0xF1, + 0xA4, 0x84, 0xC4, 0xBC, 0x40, 0x48, 0x64, 0x44, 0x04, 0x26, 0x09, 0x00, 0x02, 0x26, 0x0A, 0x00, + 0x01, 0x26, 0x0B, 0x00, 0x08, 0x2A, 0x03, 0x00, 0x0B, 0x63, 0x6E, 0x64, 0x08, 0x00, 0x15, 0x63, + 0x37, 0x64, 0x05, 0x00, 0x38, 0x63, 0x14, 0x64, 0x02, 0x00, 0x70, 0x63, 0x0A, 0x64, 0x43, 0x4D, + 0x40, 0x45, 0x00, 0xE1, 0xF0, 0xFE, 0x00, 0x60, 0x1E, 0x64, 0x1B, 0xF0, 0x11, 0xF0, 0xC0, 0x84, + 0xC0, 0x84, 0x60, 0x43, 0x28, 0x44, 0xA1, 0xFF, 0x12, 0x74, 0x80, 0x4E, 0x12, 0x74, 0x83, 0x4C, + 0x9A, 0xFF, 0x12, 0x74, 0x5C, 0x62, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, + 0x12, 0x74, 0xA1, 0xFF, 0x98, 0xFF, 0xB1, 0x60, 0x58, 0x4F, 0x00, 0x78, 0xFF, 0xFF, 0x01, 0x60, + 0x18, 0xE1, 0x78, 0x44, 0x03, 0xA4, 0x35, 0xFB, 0xB1, 0x60, 0x43, 0x78, 0xFF, 0xFF, 0xC4, 0xE2, + 0x08, 0x64, 0x3A, 0xDB, 0xA5, 0x60, 0x1C, 0x78, 0xFF, 0xFF, 0x24, 0x40, 0x01, 0x2A, 0x0E, 0x00, + 0x1D, 0xFF, 0x26, 0x44, 0x02, 0xBC, 0x40, 0x46, 0x27, 0x44, 0x07, 0x22, 0x05, 0x00, 0xF8, 0xB4, + 0x40, 0x47, 0x06, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x30, 0xF1, 0x52, 0x00, 0xFC, 0xB3, 0x32, 0x40, + 0x01, 0x2A, 0x06, 0x00, 0x0A, 0xBB, 0x0F, 0xFC, 0xCB, 0xFE, 0xA4, 0x60, 0x7C, 0x78, 0xFF, 0xFF, + 0x24, 0x44, 0x04, 0x26, 0x02, 0x00, 0x0F, 0xFC, 0x05, 0xFF, 0x30, 0xF1, 0x27, 0x44, 0x05, 0x22, + 0x2C, 0x00, 0xFA, 0xB4, 0x40, 0x47, 0x24, 0x44, 0x10, 0x2A, 0x23, 0x00, 0x28, 0x40, 0xD4, 0x3A, + 0x20, 0x00, 0x31, 0x40, 0x08, 0x26, 0x00, 0x7C, 0x2B, 0x44, 0xD0, 0x80, 0x70, 0x45, 0x02, 0x28, + 0x64, 0x44, 0xC4, 0x84, 0xFF, 0xFF, 0x04, 0x24, 0x00, 0xB4, 0x60, 0x50, 0x08, 0x28, 0x01, 0x00, + 0x20, 0x29, 0x6D, 0xE2, 0x1D, 0xF0, 0xC0, 0x64, 0xC0, 0x84, 0x0A, 0x60, 0x7B, 0xF1, 0xE8, 0x84, + 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xC0, 0x84, 0xA2, 0xDB, 0xA5, 0x60, 0xCD, 0x78, + 0xFF, 0xFF, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x07, 0x00, 0x02, 0x2A, 0x05, 0x00, 0xFD, 0xB4, + 0x40, 0x47, 0x06, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x05, 0x64, 0x3A, 0xDB, 0x28, 0x44, 0xA4, 0x3A, + 0x07, 0x00, 0x01, 0x60, 0x02, 0x7C, 0x25, 0x44, 0x0A, 0x3A, 0x02, 0x00, 0x01, 0x60, 0x3A, 0x7C, + 0x31, 0x40, 0x08, 0x26, 0x00, 0x7C, 0x2B, 0x44, 0xD0, 0x80, 0x70, 0x45, 0x02, 0x28, 0x64, 0x44, + 0xC4, 0x84, 0xFF, 0xFF, 0x04, 0x24, 0x00, 0xB4, 0x28, 0x40, 0xE4, 0x36, 0x00, 0xB4, 0x60, 0x50, + 0x08, 0x28, 0x01, 0x00, 0x20, 0x29, 0x6D, 0xE2, 0xA4, 0x60, 0x6F, 0x78, 0xFF, 0xFF, 0x27, 0x44, + 0x05, 0x22, 0x09, 0x00, 0xBA, 0xB4, 0x40, 0x47, 0x3C, 0x46, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, + 0xA4, 0x60, 0x7C, 0x78, 0xFF, 0xFF, 0x27, 0x44, 0x02, 0x2A, 0x06, 0x00, 0xFD, 0xB4, 0x40, 0x47, + 0x06, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0xF4, 0x01, 0xF3, 0x0A, 0x7C, 0x50, 0x6D, 0xE2, 0xF0, 0x01, + 0x72, 0x45, 0xDC, 0x84, 0x94, 0xFB, 0x11, 0x64, 0x3A, 0xDB, 0x95, 0xF3, 0x06, 0x04, 0xDC, 0x84, + 0x95, 0xFB, 0x96, 0xF3, 0x02, 0x04, 0xDC, 0x84, 0x96, 0xFB, 0xA4, 0x60, 0x87, 0x78, 0xFF, 0xFF, + 0x00, 0x61, 0x12, 0x64, 0x3A, 0xDB, 0x18, 0x60, 0xEE, 0x63, 0xBD, 0xD3, 0x72, 0x45, 0x44, 0x8A, + 0x02, 0x28, 0x03, 0x00, 0xE4, 0xE2, 0xDD, 0x81, 0x04, 0x00, 0x02, 0x28, 0x02, 0x00, 0xE4, 0xE2, + 0xDD, 0x81, 0xBD, 0xD3, 0x94, 0xF1, 0x61, 0x45, 0xC0, 0x84, 0x00, 0x61, 0x02, 0x24, 0x01, 0xB9, + 0xC4, 0x84, 0x60, 0x55, 0x2A, 0x52, 0xE4, 0xE2, 0x94, 0xFB, 0x02, 0x24, 0x01, 0xB9, 0xBD, 0xD3, + 0x95, 0xF1, 0x61, 0x45, 0xC0, 0x84, 0x00, 0x61, 0x02, 0x24, 0x01, 0xB9, 0xC4, 0x84, 0x95, 0xFB, + 0x02, 0x24, 0x01, 0xB9, 0xBD, 0xD3, 0x96, 0xF1, 0x61, 0x45, 0xC0, 0x84, 0xC4, 0x84, 0x96, 0xFB, + 0xA5, 0x60, 0x71, 0x78, 0xFF, 0xFF, 0xAC, 0x01, 0x47, 0xFF, 0x44, 0xFF, 0xC8, 0x74, 0xCD, 0xE2, + 0xAA, 0x60, 0xFE, 0x78, 0x00, 0x61, 0xA4, 0x60, 0x7C, 0x78, 0xFF, 0xFF, 0x5C, 0x44, 0x26, 0x44, + 0x02, 0x26, 0x0C, 0x00, 0x3E, 0x46, 0x09, 0xF2, 0x1E, 0x41, 0x03, 0x1B, 0xAC, 0x60, 0x14, 0x78, + 0xFF, 0xFF, 0x40, 0x5E, 0xFD, 0xFB, 0x21, 0x44, 0x02, 0x64, 0x40, 0x46, 0x41, 0x5D, 0x21, 0x46, + 0x00, 0x64, 0x31, 0xFA, 0x00, 0xF2, 0x46, 0x45, 0x87, 0xFC, 0xAC, 0xE2, 0x01, 0x64, 0x33, 0xFB, + 0x32, 0x40, 0x01, 0x2A, 0x21, 0x00, 0x19, 0xF3, 0x01, 0x60, 0x1E, 0xE1, 0x1D, 0x18, 0x80, 0x64, + 0x40, 0x49, 0x00, 0xE1, 0x19, 0xFF, 0x08, 0x64, 0x2A, 0xFA, 0x5A, 0xDA, 0x2C, 0xFA, 0x5A, 0xDA, + 0x5A, 0xDA, 0xD2, 0xF3, 0xFF, 0xFF, 0x02, 0xBC, 0xD2, 0xFB, 0x72, 0x44, 0x24, 0xFA, 0x94, 0xF3, + 0x25, 0xFA, 0xA1, 0xFF, 0xFF, 0xFF, 0xB6, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0xC8, 0x60, 0x09, 0x7D, + 0x7C, 0x4B, 0xA4, 0x60, 0x7C, 0x78, 0xFF, 0xFF, 0x01, 0xE1, 0x01, 0x60, 0x1A, 0xE1, 0x3F, 0x60, + 0xCF, 0x65, 0x29, 0x44, 0x24, 0x89, 0x2E, 0x44, 0x00, 0x36, 0x41, 0x00, 0x01, 0x3A, 0xC9, 0x00, + 0x88, 0xFF, 0x40, 0x67, 0x29, 0x45, 0x34, 0x89, 0x04, 0x64, 0x89, 0xFF, 0x60, 0x54, 0x88, 0xFF, + 0xA1, 0xFF, 0x6C, 0x45, 0x65, 0x44, 0x0F, 0xB4, 0x40, 0x45, 0x1C, 0xFA, 0x65, 0x44, 0x29, 0x41, + 0xF9, 0x81, 0x52, 0x4A, 0x71, 0x89, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x83, 0x1D, 0xFC, + 0x1B, 0xFC, 0x98, 0xF1, 0xFC, 0xA3, 0xD3, 0x80, 0x43, 0x43, 0x03, 0x04, 0xAC, 0x60, 0x0A, 0x78, + 0xFF, 0xFF, 0x09, 0x7C, 0xD3, 0x80, 0x9A, 0xFF, 0x03, 0x07, 0xAC, 0x60, 0x0A, 0x78, 0xFF, 0xFF, + 0x25, 0x44, 0x01, 0x26, 0x0F, 0xAC, 0x1F, 0x60, 0x50, 0x65, 0x44, 0xD3, 0x12, 0x65, 0x45, 0x46, + 0x60, 0x47, 0x40, 0x7F, 0x27, 0xFA, 0x8F, 0xFC, 0x18, 0x61, 0xCB, 0xF1, 0xA1, 0xFF, 0x6C, 0x44, + 0xDC, 0x80, 0xFF, 0xFF, 0x21, 0x03, 0x50, 0xFE, 0xAC, 0x60, 0x20, 0x78, 0xFF, 0xFF, 0xC8, 0x60, + 0x0B, 0x7D, 0x08, 0x60, 0x00, 0x6B, 0xB5, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0xAA, 0x74, 0xCD, 0xE2, + 0x02, 0x64, 0x89, 0xFF, 0x60, 0x54, 0x88, 0xFF, 0x01, 0x60, 0x08, 0xE1, 0x05, 0xE1, 0xA1, 0xFF, + 0xFF, 0xFF, 0x04, 0x25, 0x76, 0x00, 0x6C, 0x44, 0x0A, 0x36, 0x07, 0x00, 0x14, 0x36, 0x05, 0x00, + 0x37, 0x36, 0x03, 0x00, 0x6E, 0x36, 0x01, 0x00, 0x6C, 0x00, 0x40, 0x45, 0x32, 0x74, 0xA1, 0xFF, + 0x1C, 0xFA, 0x40, 0x4E, 0x8C, 0x44, 0x60, 0x43, 0x1D, 0xFA, 0x01, 0xE1, 0x20, 0x64, 0x3A, 0xDB, + 0x2E, 0x44, 0x14, 0x36, 0x12, 0x00, 0x0A, 0x36, 0x0F, 0x00, 0x63, 0x45, 0xE3, 0x83, 0xE3, 0x83, + 0xC7, 0x83, 0xE3, 0x83, 0xC7, 0x83, 0xFF, 0xFF, 0x37, 0x36, 0x05, 0x00, 0x6E, 0x36, 0x04, 0x00, + 0xAC, 0x60, 0x1E, 0x78, 0xFF, 0xFF, 0xEB, 0x83, 0xEB, 0x83, 0xEB, 0x83, 0xEB, 0x83, 0xFF, 0xFF, + 0x80, 0x27, 0xCF, 0x83, 0x1B, 0xFC, 0x01, 0x64, 0x4F, 0xFB, 0xA1, 0xFF, 0x29, 0x41, 0xF9, 0x81, + 0x52, 0x4A, 0x71, 0x89, 0x2E, 0x44, 0x27, 0xFA, 0x98, 0xF1, 0xFC, 0xA3, 0xD3, 0x80, 0x43, 0x43, + 0x03, 0x04, 0xAC, 0x60, 0x0A, 0x78, 0xFF, 0xFF, 0x9A, 0xFF, 0x54, 0x63, 0x12, 0x64, 0x40, 0x46, + 0x8F, 0xFC, 0x18, 0x61, 0xCB, 0xF1, 0x50, 0xFE, 0x6C, 0x40, 0x9E, 0x15, 0x01, 0x60, 0x08, 0xE1, + 0x80, 0xE1, 0x00, 0x64, 0x33, 0xFB, 0x01, 0x60, 0x18, 0xE1, 0x01, 0x11, 0x0F, 0x00, 0x29, 0x44, + 0x20, 0xBC, 0x40, 0x49, 0x01, 0x64, 0x33, 0xFB, 0xB6, 0xFF, 0x00, 0xE1, 0x01, 0x60, 0x1A, 0xE1, + 0xA1, 0xFF, 0xFF, 0xFF, 0x6C, 0x40, 0xFC, 0x11, 0x01, 0x60, 0x18, 0xE1, 0xB5, 0xFF, 0xB6, 0xFF, + 0xB7, 0xFF, 0xB4, 0xFF, 0xC8, 0x60, 0x09, 0x7D, 0x7C, 0x4B, 0x35, 0xE1, 0xAC, 0xE2, 0xAA, 0x60, + 0x97, 0x78, 0xFF, 0xFF, 0x13, 0x60, 0x02, 0xF3, 0xFF, 0xFF, 0xDC, 0x84, 0x00, 0x36, 0x00, 0x3B, + 0xA2, 0xDB, 0x21, 0x64, 0x3A, 0xDB, 0xD2, 0x01, 0x25, 0x60, 0xF2, 0x64, 0xE5, 0x60, 0x78, 0x41, + 0xC7, 0x78, 0x97, 0xF1, 0x2A, 0x64, 0x3A, 0xDB, 0x5C, 0x41, 0xC8, 0x01, 0x29, 0x64, 0x3A, 0xDB, + 0x88, 0x60, 0x85, 0x71, 0x8D, 0xE2, 0xA2, 0xFC, 0x32, 0x40, 0x01, 0x2A, 0xA8, 0x00, 0x01, 0x60, + 0x1A, 0xE1, 0x23, 0x43, 0xA1, 0xFF, 0xEC, 0x44, 0x2A, 0xFA, 0x40, 0x48, 0xA1, 0xFF, 0x7A, 0xDC, + 0x7E, 0x36, 0x04, 0xA2, 0xFC, 0x1C, 0x03, 0x1D, 0x00, 0x64, 0x3F, 0xFA, 0x2E, 0x00, 0x03, 0x2B, + 0x04, 0x00, 0xA1, 0xFF, 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0x8F, 0xB0, 0x88, 0x3A, 0x03, 0x00, + 0x70, 0x62, 0xA1, 0xFF, 0x7A, 0xDC, 0x28, 0x40, 0x40, 0x2B, 0x06, 0x00, 0x72, 0x62, 0xA1, 0xFF, + 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0x3F, 0xFC, 0x00, 0xF4, 0x10, 0x62, 0x6E, 0x61, + 0xA1, 0xFF, 0x05, 0x1D, 0x12, 0x1E, 0x0C, 0x00, 0x00, 0xF4, 0x7C, 0x61, 0x02, 0x62, 0x7A, 0xDC, + 0x63, 0x40, 0xFD, 0x1C, 0xF9, 0x1D, 0xFF, 0xB1, 0x08, 0x1E, 0x02, 0x02, 0x00, 0xF4, 0x02, 0x62, + 0xB6, 0xFF, 0xB7, 0xFF, 0xA1, 0xFF, 0x6C, 0x44, 0x5A, 0xDA, 0x98, 0xFF, 0xA1, 0xFF, 0x6C, 0x40, + 0xA1, 0xFF, 0x47, 0xFF, 0x7C, 0x44, 0x33, 0xFB, 0x26, 0x44, 0xFD, 0xB4, 0x84, 0xBC, 0x01, 0x15, + 0x7F, 0xB4, 0x40, 0x46, 0x6C, 0x40, 0xB6, 0xFF, 0xB7, 0xFF, 0xA1, 0xFF, 0x6C, 0x45, 0xA1, 0xFF, + 0x7F, 0x60, 0x7F, 0x7C, 0x6C, 0x44, 0xA0, 0x84, 0x15, 0xA7, 0x15, 0xA4, 0x21, 0x46, 0x26, 0xFA, + 0x29, 0x40, 0x40, 0x2B, 0x07, 0x00, 0xB6, 0xFF, 0x40, 0x60, 0x00, 0x65, 0xA1, 0xFF, 0x6C, 0x44, + 0x1A, 0xFA, 0x09, 0x00, 0x65, 0x44, 0x0F, 0xB4, 0x06, 0xA8, 0x80, 0x60, 0x00, 0x65, 0x08, 0x28, + 0x7C, 0x45, 0x29, 0x44, 0x34, 0x89, 0x27, 0xF0, 0x65, 0x44, 0x64, 0x5E, 0x27, 0xFA, 0x81, 0xE1, + 0x01, 0x60, 0x18, 0xE1, 0x01, 0x11, 0x0F, 0x00, 0x29, 0x44, 0x20, 0xBC, 0x40, 0x49, 0x01, 0x64, + 0x33, 0xFB, 0xB6, 0xFF, 0x00, 0xE1, 0x01, 0x60, 0x1A, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x6C, 0x40, + 0xFC, 0x11, 0x01, 0x60, 0x18, 0xE1, 0x21, 0x46, 0xB5, 0xFF, 0xBC, 0xFF, 0x47, 0xFF, 0xB6, 0xFF, + 0xB7, 0xFF, 0xB4, 0xFF, 0xC8, 0x60, 0x09, 0x7D, 0x7C, 0x4B, 0x26, 0x43, 0x2A, 0x44, 0x72, 0x45, + 0x24, 0xFA, 0x94, 0xF3, 0x06, 0x04, 0xE4, 0xE2, 0xDC, 0x9C, 0x29, 0x40, 0x01, 0x26, 0x64, 0x44, + 0x94, 0xF9, 0x25, 0xFA, 0x95, 0xF3, 0x02, 0x04, 0xDC, 0x84, 0x95, 0xFB, 0x28, 0xFA, 0x96, 0xF3, + 0x02, 0x04, 0xDC, 0x84, 0x96, 0xFB, 0x29, 0xFA, 0xAA, 0x60, 0x1D, 0x78, 0xFF, 0xFF, 0xA1, 0xFF, + 0x12, 0x61, 0x8C, 0x44, 0xCC, 0xF0, 0x2A, 0xFA, 0x40, 0x48, 0x04, 0x26, 0x43, 0x00, 0xA1, 0xFF, + 0x8C, 0x44, 0x5A, 0xDA, 0x30, 0xFB, 0x6C, 0x44, 0x2C, 0xFA, 0xFF, 0xFF, 0x01, 0x26, 0x26, 0x00, + 0xD0, 0x80, 0xA1, 0xFF, 0x8C, 0x44, 0x6C, 0x5C, 0x00, 0xE1, 0xF2, 0xFE, 0x2D, 0xFA, 0xCD, 0xF3, + 0xD4, 0x80, 0xD0, 0x80, 0x2E, 0xF8, 0x24, 0x44, 0x16, 0x0C, 0x32, 0x40, 0x02, 0x2A, 0x07, 0x00, + 0x28, 0x42, 0x0C, 0xB2, 0x08, 0x3A, 0x03, 0x00, 0x10, 0xBC, 0x40, 0x44, 0x5C, 0x00, 0x04, 0x0A, + 0xA1, 0xFF, 0xAC, 0x60, 0x13, 0x78, 0xFF, 0xFF, 0x11, 0xBC, 0x40, 0x44, 0x28, 0x45, 0xBF, 0x60, + 0xFF, 0x64, 0x24, 0x88, 0x50, 0x00, 0x30, 0xBC, 0x40, 0x44, 0x4D, 0x00, 0x20, 0xB9, 0x5C, 0x8E, + 0xA1, 0xFF, 0x8C, 0x44, 0x2D, 0xFA, 0xDC, 0x9C, 0x6C, 0x44, 0x00, 0xE1, 0xF2, 0xFE, 0x2E, 0xFA, + 0x08, 0x28, 0x44, 0x4E, 0xDC, 0x84, 0x2E, 0x5C, 0xB0, 0x84, 0xEF, 0xB1, 0x08, 0x24, 0x40, 0xB9, + 0x41, 0x46, 0x39, 0x00, 0x23, 0x41, 0x13, 0x64, 0x51, 0x90, 0x56, 0x63, 0x03, 0x04, 0xAC, 0x60, + 0x0A, 0x78, 0xFF, 0xFF, 0x8C, 0x44, 0x04, 0x61, 0x2B, 0xFA, 0x50, 0xFE, 0x80, 0x27, 0x00, 0x64, + 0x30, 0xFB, 0x8C, 0x44, 0x2C, 0xFA, 0xD0, 0x80, 0x8C, 0x44, 0x2D, 0xFA, 0xD4, 0x80, 0x00, 0x65, + 0x8C, 0x44, 0xCD, 0xF1, 0x2E, 0xFA, 0xD0, 0x80, 0x28, 0x44, 0x03, 0x0C, 0xA0, 0x2A, 0x0A, 0x00, + 0x11, 0x00, 0x10, 0x65, 0x60, 0x40, 0xC4, 0x36, 0x04, 0x00, 0xD4, 0x3A, 0x08, 0x00, 0x27, 0x40, + 0x40, 0x26, 0x30, 0x65, 0x00, 0x64, 0x3F, 0xFA, 0x46, 0x4E, 0x35, 0x84, 0x66, 0x00, 0x40, 0x26, + 0xF9, 0x01, 0x30, 0x65, 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0x04, 0x61, 0xF3, 0x01, 0xA1, 0xFF, + 0xAB, 0x60, 0xE6, 0x78, 0xFF, 0xFF, 0xFF, 0x60, 0xFE, 0x65, 0x23, 0x43, 0xE8, 0xA3, 0x80, 0x27, + 0xF6, 0x01, 0x20, 0xE6, 0x08, 0x60, 0x00, 0xEB, 0x28, 0x44, 0x03, 0x2B, 0x05, 0x00, 0x6A, 0x62, + 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0x28, 0x44, 0x8F, 0xB0, 0x88, 0x3A, 0x03, 0x00, 0x70, 0x62, + 0x7A, 0xDC, 0x28, 0x44, 0x40, 0x2B, 0x0D, 0x00, 0x72, 0x62, 0x7A, 0xDC, 0xA1, 0xFF, 0x6C, 0x5C, + 0x5A, 0xD8, 0xE4, 0x40, 0x20, 0x2B, 0x03, 0x00, 0x7A, 0xDC, 0x7A, 0xDC, 0xF8, 0xA3, 0x25, 0xFF, + 0xB0, 0xFF, 0x3F, 0xFC, 0x00, 0xF4, 0x10, 0x62, 0x10, 0x61, 0x57, 0x90, 0x6C, 0x61, 0xA1, 0xFF, + 0x09, 0x07, 0x02, 0x1D, 0x2A, 0x1E, 0x21, 0x00, 0xCB, 0x83, 0x7A, 0xDC, 0xFE, 0x1C, 0xD9, 0x81, + 0x24, 0x1E, 0x1B, 0x00, 0xCB, 0x83, 0x0E, 0xA3, 0xA7, 0x84, 0xF2, 0xA3, 0x7A, 0xDC, 0xFE, 0x1C, + 0x05, 0x1D, 0x01, 0x60, 0x18, 0xE1, 0x7C, 0xA8, 0xD9, 0x81, 0x0A, 0x02, 0x00, 0xF4, 0x02, 0x62, + 0xA7, 0x84, 0x7A, 0x61, 0x7A, 0xDC, 0xFE, 0x1C, 0xF9, 0x1D, 0x7C, 0xA8, 0xD9, 0x81, 0xF6, 0x03, + 0xFF, 0xB1, 0x0B, 0x1E, 0x02, 0x02, 0x00, 0xF4, 0x02, 0x62, 0xA1, 0xFF, 0xFF, 0xFF, 0xB6, 0xFF, + 0xB7, 0xFF, 0x6C, 0x44, 0x5A, 0xDA, 0xCD, 0x81, 0x64, 0x40, 0x46, 0x45, 0x28, 0x44, 0x40, 0x2B, + 0x0E, 0x00, 0x64, 0x40, 0x20, 0x2B, 0x0B, 0x00, 0x01, 0xA2, 0x62, 0x44, 0x46, 0x45, 0x21, 0x46, + 0x00, 0xF4, 0x02, 0x62, 0x9A, 0xFF, 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0x98, 0xFF, + 0x00, 0xE6, 0x01, 0xF2, 0x61, 0x45, 0xD4, 0x9E, 0x21, 0x46, 0x16, 0xFA, 0x25, 0x44, 0x06, 0xFA, + 0xA1, 0xFF, 0x8C, 0x44, 0xA1, 0xFF, 0x47, 0xFF, 0x50, 0x4B, 0x67, 0x50, 0x69, 0xE2, 0x25, 0x46, + 0x01, 0xF2, 0x61, 0x45, 0xD4, 0x9E, 0x21, 0x46, 0x16, 0xFA, 0x25, 0x45, 0x86, 0xF8, 0xFF, 0xFF, + 0x6A, 0x44, 0x40, 0x2B, 0x03, 0x15, 0xAF, 0x60, 0x10, 0x78, 0xFF, 0xFF, 0x29, 0x40, 0x10, 0x26, + 0x04, 0x00, 0x04, 0x74, 0xCD, 0xE2, 0xA1, 0xFF, 0xFF, 0xFF, 0x6C, 0x44, 0xB6, 0xFF, 0xB7, 0xFF, + 0xC4, 0xE2, 0x01, 0x60, 0x18, 0xE1, 0x05, 0x76, 0xAD, 0xE2, 0x41, 0xE1, 0xA1, 0xFF, 0x6C, 0x45, + 0xA1, 0xFF, 0x65, 0x41, 0x7F, 0x60, 0x7F, 0x7C, 0x6C, 0x44, 0xA0, 0x84, 0x15, 0xA7, 0x15, 0xA4, + 0x21, 0x46, 0x26, 0xFA, 0x22, 0x46, 0x10, 0xFA, 0x21, 0x46, 0x29, 0x40, 0x40, 0x2B, 0x07, 0x00, + 0xB6, 0xFF, 0xA1, 0xFF, 0x40, 0x60, 0x00, 0x65, 0x6C, 0x44, 0x1A, 0xFA, 0x09, 0x00, 0x65, 0x44, + 0x0F, 0xB4, 0x06, 0xA8, 0x80, 0x60, 0x00, 0x65, 0x08, 0x28, 0x7C, 0x45, 0x29, 0x44, 0x34, 0x89, + 0x27, 0xF0, 0x65, 0x47, 0x1F, 0xB1, 0x34, 0x97, 0x64, 0x5E, 0x07, 0x60, 0xF5, 0xF1, 0x29, 0x40, + 0x40, 0x2B, 0x04, 0x00, 0x64, 0x40, 0x02, 0x26, 0x10, 0x60, 0x00, 0xBC, 0x27, 0xFA, 0x01, 0x60, + 0x18, 0xE1, 0x00, 0x64, 0x33, 0xFB, 0xA8, 0xE2, 0x05, 0xE1, 0x28, 0x40, 0x03, 0x26, 0xCE, 0x00, + 0x31, 0x40, 0x20, 0x2A, 0x03, 0x00, 0x28, 0x40, 0x50, 0x3A, 0xC8, 0x00, 0x24, 0x44, 0x20, 0x2A, + 0xC5, 0x00, 0x2B, 0x44, 0xAC, 0x80, 0x28, 0x40, 0xB4, 0x3A, 0x03, 0x00, 0x02, 0x03, 0x30, 0xFB, + 0xBD, 0x00, 0x28, 0x44, 0xBF, 0x60, 0xFF, 0x65, 0xA4, 0x84, 0x40, 0x48, 0x2B, 0x50, 0xA1, 0xFF, + 0xFF, 0xFF, 0x01, 0x60, 0x08, 0xE1, 0x1C, 0xF2, 0xC4, 0xE2, 0x40, 0x45, 0x28, 0x40, 0xC4, 0x36, + 0x9D, 0x00, 0x29, 0x40, 0x40, 0x2B, 0x49, 0x00, 0x2B, 0x60, 0xBE, 0x63, 0x60, 0x40, 0x0B, 0x36, + 0x20, 0x00, 0x0F, 0x36, 0x1B, 0x00, 0x0A, 0x36, 0x16, 0x00, 0x0E, 0x36, 0x11, 0x00, 0x09, 0x36, + 0x0C, 0x00, 0x0D, 0x36, 0x07, 0x00, 0x08, 0x36, 0x02, 0x00, 0xA3, 0xD3, 0x15, 0x00, 0x02, 0xA3, + 0xA3, 0xD3, 0x12, 0x00, 0x04, 0xA3, 0xA3, 0xD3, 0x0F, 0x00, 0x06, 0xA3, 0xA3, 0xD3, 0x0C, 0x00, + 0x08, 0xA3, 0xA3, 0xD3, 0x09, 0x00, 0x0A, 0xA3, 0xA3, 0xD3, 0x06, 0x00, 0x0C, 0xA3, 0xA3, 0xD3, + 0x03, 0x00, 0x0E, 0xA3, 0xA3, 0xD3, 0xFF, 0xFF, 0x25, 0x60, 0x82, 0x63, 0x60, 0x40, 0x0C, 0x36, + 0x19, 0x00, 0x08, 0x36, 0x15, 0x00, 0x0D, 0x36, 0x11, 0x00, 0x09, 0x36, 0x0D, 0x00, 0x0E, 0x36, + 0x09, 0x00, 0x0A, 0x36, 0x05, 0x00, 0x0F, 0x36, 0x01, 0x00, 0x3A, 0x00, 0x02, 0xA3, 0x38, 0x00, + 0x04, 0xA3, 0x36, 0x00, 0x06, 0xA3, 0x34, 0x00, 0x08, 0xA3, 0x32, 0x00, 0x0A, 0xA3, 0x30, 0x00, + 0x0C, 0xA3, 0x2E, 0x00, 0x0E, 0xA3, 0x2C, 0x00, 0x2B, 0x00, 0x2B, 0x60, 0xCE, 0x63, 0x25, 0x44, + 0x0A, 0x36, 0x0C, 0x00, 0x14, 0x36, 0x07, 0x00, 0x37, 0x36, 0x02, 0x00, 0xA3, 0xD3, 0x09, 0x00, + 0x02, 0xA3, 0xA3, 0xD3, 0x06, 0x00, 0x04, 0xA3, 0xA3, 0xD3, 0x03, 0x00, 0x06, 0xA3, 0xA3, 0xD3, + 0xFF, 0xFF, 0x40, 0x45, 0x0A, 0x36, 0x0D, 0x00, 0x14, 0x36, 0x38, 0x64, 0x37, 0x3A, 0x03, 0x00, + 0x04, 0x7F, 0x40, 0x45, 0x15, 0x64, 0x6E, 0x3A, 0x09, 0x00, 0x84, 0x7F, 0x40, 0x45, 0x0B, 0x64, + 0x05, 0x00, 0x29, 0x44, 0x7F, 0x60, 0xFF, 0xB4, 0x40, 0x49, 0x70, 0x64, 0x40, 0x4D, 0x02, 0x00, + 0x40, 0x45, 0x0A, 0x00, 0x25, 0x60, 0x7A, 0x63, 0x0A, 0x36, 0x06, 0x00, 0x14, 0x36, 0x02, 0xA3, + 0x37, 0x36, 0x04, 0xA3, 0x6E, 0x36, 0x06, 0xA3, 0x28, 0xA3, 0xA3, 0xD1, 0xD8, 0xA3, 0x15, 0x60, + 0xD8, 0xF9, 0x39, 0xF1, 0xA3, 0xD1, 0x64, 0x41, 0x64, 0x5E, 0x60, 0x45, 0x64, 0x47, 0x1F, 0xB4, + 0x54, 0x94, 0xE0, 0xA0, 0x02, 0x0D, 0x00, 0x64, 0x02, 0x00, 0x01, 0x04, 0x1F, 0x64, 0x60, 0x47, + 0xB4, 0x85, 0x29, 0x44, 0xC0, 0x60, 0x00, 0xB4, 0xB4, 0x84, 0x1F, 0xFA, 0xB5, 0xFF, 0xA1, 0xFF, + 0xAD, 0xF3, 0xC4, 0xE2, 0x89, 0xFF, 0x60, 0x54, 0x88, 0xFF, 0xDC, 0x84, 0xE0, 0x94, 0xFF, 0x60, + 0xCF, 0x65, 0x29, 0x44, 0x24, 0x89, 0xA5, 0x60, 0xD6, 0x78, 0x04, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, + 0xC4, 0xE2, 0xA1, 0xFF, 0xFF, 0x60, 0xCF, 0x65, 0x29, 0x44, 0x24, 0x89, 0xAD, 0xF3, 0xC4, 0xE2, + 0x89, 0xFF, 0x60, 0x54, 0x88, 0xFF, 0xDC, 0x84, 0xE0, 0x94, 0x26, 0x44, 0x84, 0xBC, 0x24, 0x40, + 0x0C, 0x22, 0xFD, 0xB4, 0x40, 0x46, 0x23, 0x64, 0x3A, 0xDB, 0xAC, 0x60, 0xAB, 0x78, 0xFF, 0xFF, + 0x27, 0x40, 0x26, 0x22, 0x05, 0x00, 0xF8, 0xB4, 0x40, 0x47, 0x06, 0x64, 0x31, 0xFB, 0xC0, 0xFE, + 0x29, 0x40, 0x10, 0x26, 0x02, 0x00, 0x04, 0x74, 0xCD, 0xE2, 0x01, 0x60, 0x18, 0xE1, 0x01, 0x60, + 0x18, 0xE1, 0x01, 0x11, 0x0F, 0x00, 0x29, 0x44, 0x20, 0xBC, 0x40, 0x49, 0x01, 0x64, 0x33, 0xFB, + 0xB6, 0xFF, 0x00, 0xE1, 0x01, 0x60, 0x1A, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x6C, 0x40, 0xFC, 0x11, + 0x01, 0x60, 0x18, 0xE1, 0xB5, 0xFF, 0x47, 0xFF, 0xB6, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0xC8, 0x60, + 0x09, 0x7D, 0x7C, 0x4B, 0x37, 0xF3, 0x2B, 0x45, 0xD4, 0x80, 0xFF, 0xFF, 0x02, 0x28, 0x65, 0x44, + 0x60, 0x50, 0xA0, 0x4C, 0x20, 0xBC, 0xFF, 0xB4, 0xA0, 0x51, 0x00, 0x60, 0x2E, 0x7C, 0x74, 0x44, + 0xC0, 0x94, 0x32, 0x40, 0x02, 0x2A, 0x19, 0x00, 0x28, 0x44, 0xA4, 0x36, 0x03, 0x00, 0x0C, 0xB4, + 0x04, 0x36, 0x13, 0x00, 0x26, 0x43, 0xFD, 0xB3, 0x04, 0xBB, 0x43, 0x46, 0x01, 0x2A, 0x03, 0x00, + 0x28, 0x47, 0x40, 0xBF, 0x40, 0x48, 0x0A, 0xBB, 0x0F, 0xFC, 0x50, 0x4B, 0x67, 0x50, 0x00, 0x64, + 0x30, 0xFB, 0x05, 0xFF, 0xAC, 0x60, 0xAB, 0x78, 0xFF, 0xFF, 0x24, 0x64, 0x3A, 0xDB, 0x28, 0x44, + 0x04, 0x2A, 0x03, 0x00, 0xA4, 0x60, 0x6F, 0x78, 0xFF, 0xFF, 0x1D, 0xFF, 0xA8, 0xE2, 0x26, 0x40, + 0x10, 0x2A, 0x06, 0x00, 0x25, 0x60, 0xF0, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xC7, 0x78, 0x97, 0xF1, + 0xA4, 0x60, 0x6F, 0x78, 0xFF, 0xFF, 0x03, 0x0A, 0xA4, 0x60, 0x7C, 0x78, 0xFF, 0xFF, 0x01, 0x64, + 0x4F, 0xFB, 0xE1, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, 0x54, 0x62, 0x22, 0x46, 0xA2, 0xD0, + 0x16, 0x63, 0x7C, 0x41, 0x44, 0x48, 0x80, 0x36, 0x04, 0x61, 0x28, 0x40, 0x50, 0x36, 0x04, 0x61, + 0x41, 0x4E, 0x28, 0x44, 0xA4, 0x36, 0x0E, 0x63, 0x0A, 0x60, 0x7C, 0xF1, 0x2D, 0x44, 0xE8, 0x84, + 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xC0, 0x84, 0xA2, 0xDB, 0x9A, 0xFF, 0xA1, 0xFF, + 0x12, 0x74, 0xCD, 0xE2, 0x54, 0x62, 0xA2, 0xD2, 0xFF, 0xFF, 0x6A, 0x40, 0x80, 0x4E, 0x12, 0x74, + 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, + 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0xFF, 0xFF, 0x01, 0x1D, + 0xB2, 0x00, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, + 0x12, 0x74, 0x28, 0x40, 0x03, 0x2B, 0x06, 0x00, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, + 0x7A, 0xD4, 0x12, 0x74, 0x70, 0x62, 0x28, 0x44, 0x8F, 0xB0, 0x88, 0x3A, 0x02, 0x00, 0x7A, 0xD4, + 0x12, 0x74, 0x28, 0x40, 0x40, 0x2B, 0x16, 0x00, 0x72, 0x62, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD2, + 0x12, 0x74, 0x80, 0x4C, 0x20, 0x2B, 0x05, 0x00, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, + 0x12, 0x74, 0x22, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x10, 0x26, 0x04, 0x00, 0x26, 0x26, 0x4D, 0x00, + 0x26, 0x27, 0x4B, 0x00, 0x23, 0x43, 0xFF, 0xFF, 0x06, 0x1D, 0x2E, 0x1E, 0x00, 0x00, 0x03, 0xF0, + 0x04, 0xF4, 0x64, 0x42, 0x3D, 0x00, 0x2E, 0x40, 0x04, 0x2A, 0x27, 0x00, 0xA1, 0xFF, 0x02, 0xFE, + 0x10, 0x25, 0x42, 0xFE, 0x12, 0x74, 0x72, 0x45, 0x65, 0x4C, 0x94, 0xF3, 0x03, 0x04, 0xE4, 0xE2, + 0xDC, 0x84, 0x94, 0xFB, 0xA1, 0xFF, 0x12, 0x74, 0x80, 0x4C, 0x12, 0x74, 0x95, 0xF3, 0x02, 0x04, + 0xDC, 0x84, 0x95, 0xFB, 0x80, 0x4C, 0x12, 0x74, 0x96, 0xF3, 0x02, 0x04, 0xDC, 0x84, 0x96, 0xFB, + 0x80, 0x4C, 0x12, 0x74, 0x5C, 0x4E, 0xF8, 0xA3, 0x03, 0xF2, 0x9A, 0xF2, 0x04, 0xF4, 0xFF, 0xB1, + 0xF8, 0xA1, 0x06, 0xA4, 0x60, 0x42, 0x0A, 0x00, 0x4E, 0x00, 0x03, 0xF2, 0x9A, 0xF2, 0x04, 0xF4, + 0xC8, 0x82, 0xFF, 0xB1, 0x03, 0x00, 0x00, 0xF4, 0x81, 0xF2, 0xFF, 0xB1, 0x7A, 0xD4, 0x12, 0x74, + 0xFD, 0x1C, 0xF9, 0x1D, 0xFF, 0xB1, 0x1B, 0x1E, 0x02, 0x02, 0x00, 0xF4, 0xDA, 0x82, 0xDA, 0x82, + 0xA2, 0xD2, 0xA1, 0xFF, 0x09, 0x74, 0x60, 0x4D, 0x12, 0x00, 0x03, 0xF2, 0x9A, 0xF2, 0x04, 0xF4, + 0x23, 0x43, 0xA1, 0xFF, 0x12, 0x74, 0xA0, 0xD2, 0xFE, 0xA1, 0xCB, 0x83, 0x60, 0x4E, 0xAF, 0x83, + 0x03, 0x1D, 0x05, 0x03, 0x12, 0x74, 0xEB, 0x01, 0xA1, 0xFF, 0x12, 0x74, 0xDF, 0x01, 0x12, 0x74, + 0xDA, 0x83, 0x66, 0x44, 0x22, 0x46, 0x0C, 0xFA, 0x22, 0xF2, 0x0B, 0xFC, 0x28, 0x40, 0x40, 0x2B, + 0x1A, 0x00, 0x10, 0x26, 0x04, 0x00, 0x26, 0x26, 0x0F, 0x00, 0x26, 0x27, 0x0D, 0x00, 0x00, 0xF4, + 0x02, 0x62, 0xA1, 0xFF, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, + 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x07, 0x00, 0xA1, 0xFF, 0x12, 0x74, 0x9C, 0x4E, 0x12, 0x74, + 0x9C, 0x4C, 0x12, 0x74, 0x00, 0x00, 0x88, 0xFF, 0xA1, 0xFF, 0xB1, 0x60, 0x58, 0x4F, 0x00, 0x78, + 0xFF, 0xFF, 0x01, 0x60, 0x18, 0xE1, 0x78, 0x44, 0x02, 0xA4, 0x35, 0xFB, 0xCC, 0x00, 0x29, 0x44, + 0xF7, 0xB4, 0x40, 0x49, 0x34, 0x64, 0x3A, 0xDB, 0x44, 0xE1, 0xA5, 0x60, 0xB2, 0x78, 0xFF, 0xFF, + 0x00, 0x6B, 0xBC, 0xFF, 0x15, 0xF3, 0xFF, 0xFF, 0xDC, 0x84, 0x15, 0xFB, 0x78, 0x5C, 0x07, 0x00, + 0x78, 0x5C, 0x2F, 0x00, 0x62, 0xFF, 0xFF, 0xFF, 0xA1, 0xFF, 0x98, 0xFF, 0x80, 0x3E, 0x80, 0x60, + 0x01, 0xE0, 0xD5, 0x60, 0x84, 0xE7, 0x82, 0xF3, 0x40, 0x60, 0x60, 0x40, 0x01, 0x23, 0x48, 0x60, + 0x5E, 0x65, 0x80, 0x60, 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x65, 0x4A, 0xFF, 0xFF, + 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x80, 0x60, + 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x65, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, + 0x00, 0x60, 0x01, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x95, 0x60, 0x84, 0xE7, 0x64, 0x58, + 0xFF, 0xFF, 0x80, 0x60, 0x01, 0xE0, 0xD5, 0x60, 0x84, 0xE7, 0x82, 0xF3, 0x7C, 0x45, 0x60, 0x40, + 0x01, 0x23, 0x02, 0x65, 0x8C, 0x60, 0x48, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, + 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, 0x7F, 0x6A, 0xFF, 0xFF, 0x01, 0x16, + 0xFE, 0x01, 0x84, 0x60, 0x04, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x48, 0x60, 0x08, 0x6A, + 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x65, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x84, 0x60, + 0x04, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x40, 0x60, 0x08, 0x6A, 0xFF, 0xFF, 0x01, 0x16, + 0xFE, 0x01, 0x65, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x8C, 0x60, 0x48, 0x6A, 0xFF, 0xFF, + 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, + 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x95, 0x60, 0x84, 0xE7, 0x64, 0x58, 0xFF, 0xFF, + 0x12, 0x74, 0x6A, 0x40, 0x87, 0x4F, 0x12, 0x74, 0x87, 0x4C, 0x12, 0x74, 0x29, 0x40, 0x40, 0x2B, + 0x08, 0x00, 0x0A, 0x64, 0x89, 0xFF, 0x60, 0x54, 0x88, 0xFF, 0x87, 0x4D, 0x12, 0x74, 0x87, 0x4D, + 0x09, 0x00, 0x03, 0x64, 0x89, 0xFF, 0x60, 0x54, 0x88, 0xFF, 0x87, 0x4F, 0x12, 0x74, 0x87, 0x4D, + 0x12, 0x74, 0x87, 0x4D, 0x7C, 0x44, 0x01, 0x08, 0x01, 0x00, 0x67, 0x44, 0x12, 0x74, 0x87, 0x4C, + 0x12, 0x74, 0x87, 0x4C, 0x12, 0x74, 0x87, 0x4C, 0x12, 0x74, 0x87, 0x4D, 0x12, 0x74, 0x87, 0x4D, + 0x12, 0x74, 0x87, 0x4D, 0x12, 0x74, 0x04, 0x21, 0x04, 0x00, 0xFF, 0x2A, 0x01, 0x00, 0x04, 0x00, + 0x03, 0x00, 0xFF, 0x2A, 0x0D, 0x00, 0x0C, 0x00, 0xBC, 0xFF, 0x61, 0xFF, 0x78, 0x5C, 0x57, 0x01, + 0x78, 0x5C, 0x7F, 0x01, 0xB6, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0xC8, 0x60, 0x09, 0x7D, 0x7C, 0x4B, + 0x6A, 0x44, 0x2F, 0x58, 0xFF, 0xFF, 0x04, 0x74, 0xC4, 0xE2, 0x04, 0xE1, 0x29, 0x40, 0x40, 0x2B, + 0x05, 0x00, 0xA1, 0xFF, 0xFF, 0xFF, 0xBC, 0xFF, 0x14, 0x74, 0x01, 0x00, 0x04, 0x74, 0xC4, 0xE2, + 0x04, 0xE1, 0xBC, 0xFF, 0xB5, 0xFF, 0x47, 0xFF, 0xB6, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0xC8, 0x60, + 0x09, 0x7D, 0x7C, 0x4B, 0x29, 0x40, 0x40, 0x27, 0x04, 0x00, 0xC2, 0x60, 0x58, 0x4F, 0xC8, 0x78, + 0xFF, 0xFF, 0xA1, 0xFF, 0x29, 0x40, 0x10, 0x26, 0x6D, 0x00, 0x80, 0x60, 0x01, 0xE0, 0xD5, 0x60, + 0x84, 0xE7, 0x82, 0xF3, 0x40, 0x60, 0x60, 0x40, 0x01, 0x23, 0x48, 0x60, 0x5E, 0x65, 0x80, 0x60, + 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x65, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, + 0x00, 0x60, 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x80, 0x60, 0x00, 0x6A, 0xFF, 0xFF, + 0x01, 0x16, 0xFE, 0x01, 0x65, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, 0x01, 0x6A, + 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x95, 0x60, 0x84, 0xE7, 0x80, 0x60, 0x01, 0xE0, 0xD5, 0x60, + 0x84, 0xE7, 0x82, 0xF3, 0x7C, 0x45, 0x60, 0x40, 0x01, 0x23, 0x02, 0x65, 0x8C, 0x60, 0x48, 0x6A, + 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, + 0x00, 0x60, 0x7F, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x84, 0x60, 0x04, 0x6A, 0xFF, 0xFF, + 0x01, 0x16, 0xFE, 0x01, 0x48, 0x60, 0x08, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x65, 0x4A, + 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x84, 0x60, 0x04, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, + 0x40, 0x60, 0x08, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x65, 0x4A, 0xFF, 0xFF, 0x01, 0x16, + 0xFE, 0x01, 0x8C, 0x60, 0x48, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, 0x00, 0x6A, + 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, + 0x95, 0x60, 0x84, 0xE7, 0x01, 0x60, 0x08, 0xE1, 0xFF, 0xFF, 0xC4, 0xE2, 0x29, 0x40, 0x40, 0x2B, + 0x04, 0x00, 0xC2, 0x60, 0x58, 0x4F, 0xC8, 0x78, 0xFF, 0xFF, 0xC2, 0x60, 0x58, 0x4F, 0xD0, 0x78, + 0xFF, 0xFF, 0xA1, 0xFF, 0xAD, 0xF3, 0xC4, 0xE2, 0x89, 0xFF, 0x60, 0x54, 0x88, 0xFF, 0xDC, 0x84, + 0xE0, 0x94, 0x35, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x08, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, + 0x43, 0xFF, 0x01, 0x60, 0x00, 0xE1, 0x28, 0xF3, 0x47, 0xFF, 0x60, 0x40, 0x07, 0x37, 0x66, 0x00, + 0x05, 0x3B, 0x04, 0x00, 0xFF, 0x0A, 0x80, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x18, 0x60, 0x07, 0xF1, + 0xAD, 0x4F, 0x00, 0x7F, 0xFA, 0xB4, 0x64, 0x41, 0x64, 0xF1, 0x02, 0xB1, 0x04, 0x65, 0x02, 0x02, + 0x64, 0x40, 0x01, 0x2B, 0x01, 0x65, 0xB4, 0x84, 0xA0, 0x5D, 0x29, 0xF5, 0x2A, 0xF3, 0x47, 0xFF, + 0x3F, 0xF0, 0x01, 0x1B, 0x01, 0x64, 0x60, 0x56, 0xAD, 0xE2, 0xB5, 0xFF, 0x6C, 0x40, 0x40, 0xE1, + 0xA1, 0xFF, 0x00, 0xF4, 0x6E, 0x61, 0x12, 0x62, 0x64, 0x43, 0x01, 0xE1, 0x03, 0x64, 0xE2, 0xD0, + 0xC9, 0x81, 0x64, 0x4C, 0xCC, 0x84, 0xDA, 0x82, 0xFA, 0x02, 0x01, 0x60, 0x00, 0x6B, 0x9A, 0xFF, + 0xCA, 0x82, 0x03, 0x00, 0x00, 0xF4, 0x81, 0xF2, 0xFF, 0xFF, 0x7A, 0xD0, 0xA1, 0xFF, 0x64, 0x4C, + 0xFC, 0x1C, 0xF8, 0x1D, 0x00, 0xB9, 0x06, 0x1E, 0x02, 0x02, 0x00, 0xF4, 0xDA, 0x82, 0x5A, 0xD2, + 0xA1, 0xFF, 0x60, 0x4D, 0x3F, 0x40, 0x02, 0x2B, 0x10, 0x00, 0x28, 0xF3, 0xA5, 0x60, 0xC4, 0x65, + 0x60, 0x40, 0x0E, 0x3B, 0x0A, 0x00, 0xD2, 0xF3, 0xFF, 0xFF, 0x10, 0xBC, 0xD2, 0xFB, 0xAD, 0x4F, + 0x02, 0xBC, 0x00, 0x7F, 0xA0, 0x5D, 0x85, 0x4C, 0xFE, 0x01, 0xD2, 0xF3, 0xFF, 0xFF, 0x02, 0xBC, + 0xD2, 0xFB, 0xA1, 0xFF, 0x87, 0x4E, 0x87, 0x4C, 0x87, 0x4C, 0x87, 0x4C, 0x87, 0x4C, 0x67, 0x4C, + 0xFF, 0xFF, 0xBC, 0xFF, 0x00, 0xE1, 0xD5, 0xFE, 0xA1, 0xFF, 0xFF, 0xFF, 0x00, 0x64, 0x40, 0x46, + 0x60, 0x41, 0xB5, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0x29, 0xF5, 0x3F, 0xF0, 0x24, 0xF2, 0x44, 0x43, + 0x40, 0x4D, 0x00, 0xF4, 0xF3, 0x60, 0xA0, 0x65, 0x10, 0x62, 0x5A, 0xD2, 0xD9, 0x81, 0xD4, 0x80, + 0xFF, 0xFF, 0xFB, 0x02, 0x61, 0x45, 0x2D, 0x44, 0xD4, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, + 0xFD, 0xA5, 0x48, 0x60, 0x00, 0x64, 0xC4, 0x9D, 0x0D, 0x60, 0x00, 0x6B, 0x2D, 0x44, 0xC0, 0x83, + 0xBB, 0xFF, 0x29, 0xF5, 0x01, 0xE1, 0x00, 0xF4, 0x6C, 0x61, 0x10, 0x62, 0x05, 0x00, 0x00, 0xF4, + 0x01, 0xF2, 0xFF, 0xFF, 0x60, 0x41, 0x04, 0x62, 0xA1, 0xFF, 0xFF, 0xFF, 0x01, 0x10, 0x1A, 0x00, + 0x26, 0x44, 0x01, 0x26, 0x0C, 0x00, 0x2D, 0x44, 0xC8, 0x84, 0x40, 0x4D, 0x02, 0x03, 0x6C, 0x45, + 0xF3, 0x01, 0x03, 0x15, 0x01, 0x64, 0x05, 0xFA, 0x15, 0x00, 0x6C, 0x45, 0xED, 0x01, 0x23, 0x44, + 0xC8, 0x84, 0x40, 0x43, 0x02, 0x03, 0x6C, 0x45, 0xE7, 0x01, 0x00, 0x64, 0x01, 0x15, 0x01, 0x64, + 0x6C, 0x45, 0x05, 0xFB, 0xE2, 0xD2, 0xDA, 0x82, 0xC9, 0x81, 0x60, 0x4C, 0xDD, 0x1C, 0xD7, 0x03, + 0xBC, 0xFF, 0xDA, 0x01, 0x00, 0xE1, 0xD5, 0xFE, 0xA1, 0xFF, 0xFF, 0xFF, 0x08, 0xE1, 0xA1, 0xFF, + 0x67, 0x4C, 0x43, 0xFF, 0xD2, 0xF3, 0xFF, 0xFF, 0x10, 0xBC, 0xD2, 0xFB, 0xAD, 0x4F, 0x02, 0xBC, + 0x00, 0x7F, 0xA0, 0x5D, 0x01, 0xE1, 0x01, 0x60, 0x69, 0x6B, 0xA5, 0x60, 0xC4, 0x64, 0x60, 0x4C, + 0xBB, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x60, 0x4C, 0xA1, 0xFF, 0xFF, 0xFF, 0x60, 0x4C, 0xFC, 0x01, + 0x29, 0xF3, 0x2A, 0xF1, 0x07, 0xB5, 0x04, 0xE1, 0x65, 0x41, 0x64, 0x54, 0xCD, 0xE2, 0x95, 0x81, + 0xA1, 0x5D, 0xA1, 0xFF, 0xFF, 0xFF, 0xF9, 0x01, 0x10, 0x61, 0x7F, 0x60, 0xC0, 0x64, 0xA0, 0x80, + 0x7F, 0x67, 0x02, 0x63, 0x25, 0x02, 0x98, 0xFE, 0x19, 0x05, 0x0F, 0x60, 0x7F, 0xF5, 0x0E, 0xF2, + 0x15, 0x18, 0x02, 0x18, 0x09, 0xF4, 0xFB, 0x01, 0x23, 0x44, 0x00, 0xA8, 0x08, 0x7E, 0x0A, 0x02, + 0x66, 0x44, 0x11, 0xFB, 0x46, 0x43, 0x23, 0x47, 0x80, 0xBF, 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, + 0x28, 0xB9, 0x10, 0x7E, 0x00, 0x7F, 0x0E, 0xFA, 0x00, 0x67, 0x0A, 0x00, 0x20, 0x44, 0xDC, 0x85, + 0x0F, 0xB4, 0xF7, 0xA0, 0x7F, 0x67, 0x07, 0x63, 0x03, 0x05, 0x45, 0x40, 0x00, 0x67, 0xD8, 0xFE, + 0xFF, 0x27, 0x05, 0xFD, 0x0A, 0x7E, 0x04, 0xFB, 0x61, 0x55, 0x48, 0x00, 0x28, 0xFB, 0x01, 0xF3, + 0x29, 0xFB, 0x44, 0x46, 0x40, 0x45, 0x10, 0x61, 0x7E, 0x60, 0xC0, 0x64, 0xA0, 0x80, 0x7F, 0x67, + 0x02, 0x63, 0x30, 0x02, 0xB5, 0x60, 0x58, 0x4F, 0x4B, 0x78, 0xFF, 0xFF, 0x7F, 0x67, 0x03, 0x63, + 0x29, 0x02, 0x26, 0x40, 0x01, 0x2B, 0x23, 0x00, 0x98, 0xFE, 0x18, 0x05, 0x0F, 0x60, 0x7F, 0xF5, + 0x0E, 0xF2, 0x14, 0x18, 0x02, 0x18, 0x09, 0xF4, 0xFB, 0x01, 0x23, 0x44, 0x00, 0xA8, 0x08, 0x7E, + 0x0A, 0x02, 0x66, 0x44, 0x11, 0xFB, 0x46, 0x43, 0x23, 0x47, 0x80, 0xBF, 0x3B, 0x42, 0x04, 0xA2, + 0xA2, 0xDB, 0x08, 0xB9, 0x10, 0x7E, 0x00, 0x7F, 0x0E, 0xFA, 0x09, 0x00, 0x20, 0x44, 0xDC, 0x85, + 0x0F, 0xB4, 0xF7, 0xA0, 0x7F, 0x67, 0x07, 0x63, 0x05, 0x05, 0x45, 0x40, 0xD8, 0xFE, 0x00, 0x67, + 0xD0, 0xFE, 0xD9, 0xFE, 0xFF, 0x27, 0x05, 0xFD, 0x0B, 0x7E, 0x04, 0xFB, 0x0A, 0x60, 0x7E, 0xF3, + 0xFF, 0xFF, 0x20, 0xB0, 0x80, 0xBC, 0x08, 0x28, 0xA2, 0xDB, 0x61, 0x55, 0x66, 0x00, 0x04, 0xB5, + 0x82, 0xB5, 0x25, 0x02, 0x04, 0x03, 0x20, 0x44, 0x7F, 0xB4, 0x40, 0x40, 0xA3, 0xD3, 0x99, 0xFE, + 0x04, 0x04, 0x02, 0xBC, 0xFE, 0xB4, 0xA3, 0xDB, 0x59, 0x00, 0xBC, 0xF3, 0x20, 0x40, 0x80, 0x26, + 0x55, 0x00, 0xA3, 0xD3, 0xFF, 0xA0, 0xF8, 0xB4, 0x02, 0x02, 0xA3, 0xDB, 0x1C, 0x00, 0x04, 0xBC, + 0xBF, 0xB4, 0xA3, 0xDB, 0x08, 0xB0, 0x01, 0x64, 0x08, 0x24, 0x02, 0x64, 0x28, 0xFB, 0x20, 0x44, + 0x80, 0xBC, 0x40, 0x40, 0xD0, 0xFE, 0x42, 0x00, 0xBF, 0xB4, 0xA3, 0xDB, 0x3F, 0x00, 0x40, 0xB0, + 0xFF, 0xFF, 0xFA, 0x02, 0xF8, 0xB4, 0xA3, 0xDB, 0x08, 0xB5, 0x07, 0x7C, 0x01, 0x02, 0xBC, 0xF9, + 0x20, 0x44, 0x7F, 0xB4, 0x40, 0x40, 0x14, 0x60, 0xFC, 0x63, 0xA3, 0xD3, 0xFF, 0xFF, 0x20, 0xB5, + 0x07, 0xB5, 0x08, 0x28, 0xC4, 0x02, 0x99, 0xFE, 0x29, 0x05, 0x20, 0x44, 0x80, 0x26, 0x26, 0x00, + 0x20, 0x2A, 0x03, 0x00, 0xDF, 0xB4, 0x40, 0x40, 0x6A, 0x00, 0x40, 0x2A, 0x1F, 0x00, 0xBF, 0xB4, + 0x40, 0x40, 0x09, 0x00, 0xA8, 0xFF, 0x20, 0x44, 0x99, 0xFE, 0x02, 0x05, 0x80, 0x2A, 0x03, 0x00, + 0x40, 0xBC, 0x40, 0x40, 0x13, 0x00, 0x00, 0xF1, 0x80, 0xBC, 0x40, 0x40, 0x64, 0x44, 0xE0, 0x84, + 0xE8, 0x84, 0x0A, 0x36, 0x29, 0x01, 0x0B, 0x36, 0x59, 0x01, 0x28, 0xFB, 0x01, 0xF1, 0x29, 0xF9, + 0x02, 0xF1, 0x2A, 0xF9, 0x03, 0xF1, 0x2B, 0xF9, 0xD0, 0xFE, 0xAE, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, + 0x82, 0x3E, 0x75, 0x44, 0x02, 0xB0, 0x01, 0xB0, 0x4A, 0x02, 0xDC, 0x02, 0x04, 0xB0, 0x08, 0xB0, + 0x0B, 0x02, 0x20, 0x02, 0x40, 0x26, 0xA7, 0xFF, 0x8C, 0xFF, 0x75, 0x40, 0x80, 0x2B, 0x01, 0x00, + 0xAB, 0xFF, 0x75, 0x44, 0x8D, 0xFF, 0xEA, 0x01, 0x0A, 0xF3, 0xAA, 0xFF, 0x60, 0x40, 0x20, 0x2B, + 0x02, 0x00, 0x38, 0xFF, 0x0D, 0x00, 0x01, 0x26, 0x0C, 0x00, 0xC0, 0x60, 0x00, 0x7C, 0xA0, 0x84, + 0x80, 0x3B, 0x02, 0x00, 0xC0, 0x67, 0x03, 0x00, 0x40, 0x3B, 0x02, 0x00, 0x00, 0x67, 0x0A, 0xFB, + 0xD5, 0x01, 0xD4, 0x01, 0x0B, 0xF1, 0xAB, 0xFF, 0x64, 0x44, 0xFF, 0x27, 0x1F, 0x00, 0x20, 0x26, + 0x03, 0x00, 0x02, 0x60, 0x00, 0x75, 0x1A, 0x00, 0x19, 0xF3, 0xFF, 0xFF, 0x03, 0x1B, 0x04, 0x60, + 0x00, 0x75, 0x0A, 0x64, 0xCC, 0x84, 0x19, 0xFB, 0x01, 0x60, 0x00, 0x75, 0x64, 0x40, 0x03, 0x22, + 0x0D, 0x00, 0x20, 0x44, 0x80, 0x2A, 0x03, 0x00, 0x20, 0xBC, 0x40, 0x40, 0x07, 0x00, 0xD9, 0xFE, + 0x81, 0x60, 0x0B, 0x64, 0x28, 0xFB, 0x2C, 0x44, 0x29, 0xFB, 0xD0, 0xFE, 0xAF, 0x01, 0xA9, 0xFF, + 0x77, 0x44, 0x60, 0x57, 0x40, 0x4A, 0x01, 0x2A, 0x20, 0x00, 0x24, 0x44, 0xAC, 0x86, 0x08, 0xF2, + 0x1C, 0x03, 0x1F, 0x60, 0x04, 0x65, 0xD4, 0x80, 0x0E, 0xF2, 0x02, 0x03, 0xA5, 0xD5, 0x04, 0x00, + 0x01, 0xBC, 0x0E, 0xFA, 0x09, 0xF4, 0xD1, 0xFE, 0x46, 0x44, 0x0F, 0x18, 0x3F, 0xF2, 0x48, 0x65, + 0xC4, 0x84, 0x13, 0xFB, 0x66, 0x44, 0x10, 0xFB, 0x66, 0x47, 0x20, 0xBF, 0x3B, 0x42, 0x04, 0xA2, + 0xA2, 0xDB, 0x0E, 0xF2, 0x41, 0x75, 0x10, 0xBC, 0x0E, 0xFA, 0x2A, 0x44, 0x08, 0x2A, 0x17, 0x00, + 0x23, 0x44, 0x00, 0xA8, 0x5C, 0x43, 0x13, 0x03, 0x0F, 0x60, 0x7F, 0xF5, 0x01, 0x00, 0x09, 0xF4, + 0x0E, 0xF2, 0x0D, 0x18, 0x08, 0xB0, 0x18, 0xAC, 0xFA, 0x03, 0x0E, 0xFA, 0x66, 0x43, 0x11, 0xFD, + 0x46, 0x43, 0x23, 0x47, 0x80, 0xBF, 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, 0x28, 0x75, 0x2A, 0x44, + 0x06, 0x22, 0x2D, 0x00, 0x22, 0x44, 0x00, 0xA8, 0x60, 0x46, 0x0E, 0xF2, 0x28, 0x03, 0x10, 0xB0, + 0x01, 0xBC, 0x03, 0x02, 0x00, 0x64, 0x40, 0x42, 0x22, 0x00, 0x0E, 0xFA, 0xD1, 0xFE, 0x1E, 0x60, + 0xF8, 0x64, 0x40, 0x47, 0x58, 0x4F, 0x80, 0x00, 0x46, 0x42, 0x19, 0x02, 0x22, 0x47, 0x40, 0xBF, + 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, 0x23, 0xF2, 0x66, 0x43, 0x00, 0xA8, 0x0E, 0xF2, 0x08, 0x02, + 0x60, 0x40, 0x02, 0x2A, 0xE4, 0x01, 0x12, 0xFD, 0x10, 0x64, 0x0E, 0xFA, 0x02, 0x75, 0x07, 0x00, + 0x60, 0x40, 0x04, 0x2A, 0xDC, 0x01, 0x12, 0xFD, 0x10, 0x64, 0x0E, 0xFA, 0x04, 0x75, 0x2A, 0x44, + 0x80, 0x2A, 0x19, 0x00, 0x21, 0x44, 0xAC, 0x86, 0x0E, 0xF2, 0x15, 0x03, 0x01, 0xBC, 0x0E, 0xFA, + 0xD1, 0xFE, 0x1F, 0x60, 0x10, 0x64, 0x40, 0x47, 0x58, 0x4F, 0x56, 0x00, 0x46, 0x41, 0x0B, 0x02, + 0x21, 0x47, 0x10, 0xBF, 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, 0x0E, 0xF2, 0x66, 0x43, 0x08, 0xFD, + 0x10, 0xBC, 0x0E, 0xFA, 0x80, 0x75, 0x2A, 0x44, 0x10, 0xB0, 0x20, 0x44, 0x15, 0x03, 0x7F, 0xB4, + 0x40, 0x40, 0x14, 0x60, 0xFC, 0x63, 0xA3, 0xD3, 0xFF, 0xFF, 0x20, 0xB0, 0x80, 0xB0, 0x09, 0x03, + 0x08, 0x03, 0x40, 0xBC, 0x7F, 0xB4, 0x04, 0xB0, 0xA3, 0xDB, 0x03, 0x03, 0x20, 0x44, 0x80, 0xBC, + 0x40, 0x40, 0xB3, 0x60, 0x8B, 0x78, 0xFF, 0xFF, 0xB3, 0x60, 0xBE, 0x78, 0xFF, 0xFF, 0xE8, 0xFE, + 0x14, 0x05, 0xEA, 0xFE, 0x24, 0x05, 0xE9, 0xFE, 0x1C, 0x05, 0xE7, 0xFE, 0x09, 0x05, 0x47, 0xFF, + 0x20, 0x44, 0x0F, 0x22, 0x03, 0x00, 0xCC, 0x84, 0x40, 0x40, 0x0F, 0x22, 0xB8, 0xFE, 0xEC, 0x01, + 0x23, 0x41, 0x00, 0xB9, 0x5C, 0x4A, 0xE8, 0x02, 0x6F, 0x01, 0x24, 0x41, 0x00, 0xB9, 0x1F, 0x60, + 0x04, 0x65, 0x45, 0x47, 0xE1, 0x02, 0x58, 0x4F, 0x0F, 0x00, 0xDE, 0x02, 0x5C, 0x4A, 0x46, 0x44, + 0x4D, 0x01, 0x22, 0x41, 0x00, 0xB9, 0x5C, 0x4A, 0x08, 0x24, 0x81, 0x01, 0xD5, 0x01, 0x21, 0x41, + 0x00, 0xB9, 0x5C, 0x4A, 0xA6, 0x03, 0xD0, 0x01, 0x27, 0xD3, 0x03, 0x00, 0x10, 0xB0, 0x09, 0xF2, + 0x04, 0x03, 0xAC, 0x86, 0x0E, 0xF2, 0xFA, 0x02, 0x08, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0E, 0xF3, + 0x0F, 0x60, 0xFE, 0x65, 0x0C, 0xF3, 0x24, 0x86, 0x24, 0x46, 0x60, 0x40, 0xFB, 0x3B, 0x07, 0x00, + 0x80, 0x26, 0x02, 0x00, 0x23, 0x46, 0x03, 0x4C, 0x46, 0x61, 0x3A, 0x65, 0x0C, 0x00, 0x2E, 0xF3, + 0x40, 0x45, 0xF8, 0x2B, 0x02, 0x00, 0x40, 0x45, 0x03, 0x00, 0x58, 0x4F, 0x44, 0x00, 0x07, 0x02, + 0x58, 0x4F, 0x50, 0x00, 0x04, 0x05, 0x66, 0x50, 0x65, 0x52, 0x61, 0x51, 0x09, 0x00, 0x26, 0x47, + 0x00, 0xBF, 0x0E, 0xFB, 0x2E, 0xF5, 0x05, 0xF0, 0x80, 0x60, 0x64, 0x50, 0x00, 0x72, 0x7E, 0x71, + 0xAC, 0xFF, 0xB3, 0x60, 0xBE, 0x78, 0xFF, 0xFF, 0x8E, 0xFF, 0x0F, 0xF3, 0x0F, 0x60, 0xFE, 0x65, + 0x24, 0x86, 0x0D, 0xF3, 0x24, 0x46, 0x60, 0x40, 0xFB, 0x3B, 0x07, 0x00, 0x80, 0x26, 0x02, 0x00, + 0x23, 0x46, 0x03, 0x4C, 0x46, 0x61, 0x3A, 0x65, 0x0C, 0x00, 0x2E, 0xF3, 0x40, 0x45, 0xF8, 0x2B, + 0x02, 0x00, 0x40, 0x45, 0x03, 0x00, 0x58, 0x4F, 0x16, 0x00, 0x07, 0x02, 0x58, 0x4F, 0x22, 0x00, + 0x04, 0x05, 0x66, 0x50, 0x65, 0x52, 0x61, 0x51, 0x09, 0x00, 0x26, 0x47, 0x00, 0xBF, 0x0F, 0xFB, + 0x2E, 0xF5, 0x05, 0xF0, 0x80, 0x60, 0x64, 0x50, 0x00, 0x72, 0x7E, 0x71, 0x8D, 0xFF, 0xAD, 0xFF, + 0xB3, 0x60, 0xBE, 0x78, 0xFF, 0xFF, 0x25, 0x44, 0x89, 0xF1, 0x8A, 0xF1, 0xD0, 0x80, 0xD0, 0x80, + 0x07, 0x04, 0x01, 0x06, 0x05, 0x00, 0x25, 0x46, 0x01, 0xF0, 0x03, 0x67, 0xA0, 0x85, 0x94, 0x80, + 0x2F, 0x58, 0xFF, 0xFF, 0x25, 0x46, 0x26, 0x41, 0x46, 0x63, 0x01, 0xF2, 0xFF, 0xFF, 0xFF, 0xB5, + 0xD5, 0x81, 0x00, 0xF2, 0x05, 0x04, 0x04, 0x63, 0x60, 0x46, 0xF7, 0x1B, 0x42, 0xFE, 0x0D, 0x00, + 0x61, 0x44, 0xC5, 0x81, 0x63, 0x45, 0xC5, 0x81, 0x9C, 0x84, 0xDC, 0x84, 0x01, 0xF2, 0xF0, 0x85, + 0xF0, 0x80, 0x65, 0x44, 0xF8, 0x85, 0xFF, 0xFF, 0x02, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xA2, 0xFF, + 0x0F, 0x60, 0x8B, 0xF3, 0xFF, 0xFF, 0xAC, 0x86, 0x0E, 0xF2, 0x07, 0x03, 0x00, 0xA8, 0x09, 0xF2, + 0xFA, 0x02, 0x01, 0x67, 0x0E, 0xFA, 0x08, 0xFE, 0x17, 0x00, 0x8B, 0xF3, 0xFF, 0xFF, 0xD8, 0xA0, + 0x00, 0xB4, 0x12, 0x06, 0x09, 0x60, 0x08, 0x61, 0x41, 0x4A, 0x7C, 0xA1, 0x0E, 0xA1, 0xA2, 0xFF, + 0xB5, 0x60, 0x58, 0x4E, 0xC1, 0x78, 0xFF, 0xFF, 0xA3, 0xFF, 0x06, 0x03, 0x2A, 0x43, 0xB5, 0x60, + 0x58, 0x4E, 0xE2, 0x78, 0xFF, 0xFF, 0x08, 0xFE, 0xA3, 0xFF, 0x2D, 0x58, 0xFF, 0xFF, 0x41, 0x4A, + 0x42, 0xA1, 0x03, 0x00, 0x41, 0x4A, 0x7C, 0xA1, 0x0E, 0xA1, 0xA2, 0xFF, 0xB5, 0x60, 0x58, 0x4E, + 0xC1, 0x78, 0xFF, 0xFF, 0x07, 0x03, 0x2A, 0x43, 0xB5, 0x60, 0x58, 0x4E, 0xE2, 0x78, 0xFF, 0xFF, + 0x08, 0xFE, 0x0C, 0x00, 0x0F, 0x60, 0x8B, 0xF3, 0xFF, 0xFF, 0xAC, 0x86, 0x0E, 0xF2, 0x06, 0x03, + 0x00, 0xA8, 0x09, 0xF2, 0xFA, 0x02, 0x01, 0x67, 0x0E, 0xFA, 0x08, 0xFE, 0xA3, 0xFF, 0x2D, 0x58, + 0xFF, 0xFF, 0x8C, 0xF3, 0x7C, 0x63, 0x00, 0xBE, 0x40, 0x45, 0x1A, 0x03, 0x00, 0x65, 0x65, 0x44, + 0xDC, 0x85, 0x84, 0xA1, 0x00, 0xF2, 0x06, 0x06, 0x01, 0xFC, 0x00, 0xA8, 0x60, 0x46, 0xF7, 0x02, + 0x40, 0x45, 0x0E, 0x00, 0x8B, 0xF3, 0x00, 0x63, 0xD4, 0x84, 0x8B, 0xFB, 0x80, 0x60, 0x7C, 0x64, + 0x01, 0xFA, 0x00, 0xF0, 0x00, 0xFC, 0xD3, 0x80, 0x8C, 0xF9, 0x02, 0x02, 0x8D, 0xF9, 0x08, 0xFE, + 0x2E, 0x58, 0xFF, 0xFF, 0x66, 0x44, 0x25, 0x46, 0x05, 0xFA, 0x06, 0xFA, 0x01, 0xF0, 0x03, 0x67, + 0x02, 0xFC, 0xB0, 0x84, 0x3A, 0x7E, 0x01, 0xFA, 0x12, 0x64, 0x03, 0xFA, 0x00, 0xF0, 0x04, 0xF8, + 0x00, 0x64, 0x0C, 0x61, 0x10, 0x63, 0x59, 0xDA, 0xFE, 0x1F, 0x2E, 0x58, 0xFF, 0xFF, 0x27, 0x43, + 0xE3, 0x81, 0xE9, 0x81, 0x03, 0x05, 0x16, 0x03, 0x00, 0x61, 0x01, 0x00, 0xEC, 0x63, 0x61, 0x46, + 0xBF, 0xD2, 0x27, 0x45, 0xDC, 0x84, 0xA2, 0xDA, 0xBE, 0xD2, 0x25, 0x46, 0x88, 0xF8, 0x04, 0x1B, + 0x25, 0x44, 0x61, 0x46, 0xA3, 0xDA, 0x04, 0x00, 0x0A, 0xFA, 0x60, 0x46, 0x25, 0x44, 0x09, 0xFA, + 0x61, 0x46, 0xBE, 0xDA, 0x2F, 0x58, 0xFF, 0xFF, 0x25, 0x44, 0x00, 0xA8, 0x07, 0x4B, 0x0C, 0x03, + 0x58, 0x4F, 0x33, 0x00, 0x0B, 0x47, 0x1F, 0x60, 0x0A, 0x65, 0x27, 0x44, 0xD4, 0x80, 0x00, 0x64, + 0x01, 0x02, 0x0F, 0xFA, 0x58, 0x4F, 0xD3, 0x01, 0x70, 0x00, 0x25, 0x43, 0xE3, 0x84, 0x7C, 0x41, + 0x02, 0x04, 0xE8, 0x81, 0xEC, 0x63, 0x61, 0x46, 0xA3, 0xD2, 0x00, 0x7C, 0x40, 0x45, 0xBF, 0xD8, + 0xA3, 0xD8, 0xBE, 0xD8, 0x27, 0x42, 0x5A, 0xD3, 0x25, 0x5C, 0x60, 0x41, 0x02, 0x1B, 0x27, 0xD9, + 0x05, 0x00, 0x25, 0x46, 0x0A, 0xFA, 0x61, 0x46, 0x25, 0x44, 0x09, 0xFA, 0x25, 0x44, 0x27, 0x43, + 0x00, 0x61, 0x60, 0x46, 0x09, 0xF2, 0x08, 0xFC, 0x00, 0xA8, 0xDD, 0x81, 0xFA, 0x02, 0xBF, 0xD1, + 0x66, 0x44, 0xBE, 0xDB, 0xC1, 0x84, 0xBF, 0xDB, 0x48, 0x00, 0x25, 0x46, 0xEC, 0x63, 0x08, 0xF2, + 0x89, 0xF2, 0x1E, 0x18, 0x40, 0x47, 0xE0, 0x84, 0xE8, 0x85, 0x02, 0x05, 0xE8, 0x83, 0x00, 0x65, + 0x65, 0x46, 0xBF, 0xD2, 0x61, 0x5C, 0xCC, 0x84, 0xA2, 0xDA, 0x25, 0x46, 0x0A, 0xF2, 0x00, 0xB9, + 0x65, 0x46, 0x08, 0x24, 0xBE, 0xDA, 0x02, 0x1B, 0xA3, 0xD8, 0x02, 0x00, 0x60, 0x46, 0x89, 0xFA, + 0x00, 0xB9, 0x61, 0x46, 0x08, 0x28, 0x0A, 0xFA, 0x25, 0x46, 0x89, 0xFC, 0x8A, 0xFC, 0x88, 0xFC, + 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x61, 0x28, 0x65, 0x25, 0x43, 0x8D, 0xF3, 0xAF, 0x83, 0x00, 0xBE, + 0x18, 0x03, 0x02, 0x03, 0x00, 0xFC, 0x01, 0x00, 0x8C, 0xFD, 0x63, 0x46, 0x65, 0x44, 0xCC, 0x85, + 0x00, 0xF2, 0x07, 0x02, 0x8D, 0xF5, 0x00, 0x64, 0x00, 0xFA, 0xDE, 0x60, 0xAF, 0x64, 0x09, 0xFB, + 0x08, 0x00, 0x66, 0x43, 0x00, 0xBE, 0xDD, 0x81, 0xF1, 0x02, 0x8B, 0xF1, 0x8D, 0xFD, 0xC1, 0x84, + 0x8B, 0xFB, 0x2E, 0x58, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x45, 0x29, 0x43, 0xFC, 0xA3, 0x66, 0x44, + 0xBD, 0xDB, 0x25, 0x44, 0xBD, 0xDB, 0x00, 0x64, 0xBD, 0xDB, 0x03, 0x61, 0x0E, 0x65, 0x1F, 0x60, + 0x1E, 0x63, 0x43, 0x49, 0xA3, 0xD3, 0x06, 0xA3, 0x00, 0xA8, 0xCD, 0x81, 0x04, 0x02, 0xF9, 0x02, + 0xB3, 0x60, 0xBE, 0x78, 0xFF, 0xFF, 0x01, 0x26, 0xE6, 0x01, 0xD4, 0x80, 0x60, 0x45, 0xE3, 0x05, + 0xF6, 0xA3, 0xBD, 0xD1, 0xBD, 0xD1, 0x44, 0x47, 0x44, 0x48, 0x44, 0x45, 0x1F, 0x60, 0x60, 0x64, + 0x44, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0x48, 0xFE, 0x8C, 0xF5, 0x8B, 0xF3, 0x0D, 0x18, 0xCC, 0x84, + 0x8B, 0xFB, 0x80, 0x60, 0x7C, 0x64, 0x01, 0xFA, 0x00, 0x64, 0x00, 0xF0, 0x00, 0xFA, 0xD0, 0x80, + 0x8C, 0xF9, 0x02, 0x02, 0x8D, 0xF9, 0x08, 0xFE, 0x2E, 0x58, 0xFF, 0xFF, 0x1E, 0x60, 0xCE, 0x63, + 0x0D, 0x65, 0x00, 0x61, 0x41, 0x48, 0xA3, 0xD3, 0x06, 0xA3, 0xAC, 0x86, 0x00, 0x61, 0x09, 0x03, + 0x00, 0xF2, 0x09, 0xF0, 0xAC, 0x86, 0x00, 0xF2, 0xDD, 0x81, 0xFC, 0x02, 0x64, 0x44, 0xAC, 0x86, + 0xF6, 0x01, 0x61, 0x44, 0x25, 0x46, 0x27, 0xDA, 0x65, 0x44, 0x28, 0x45, 0x45, 0x88, 0xCC, 0x85, + 0x5A, 0x87, 0xE9, 0x02, 0x00, 0x64, 0x27, 0xDA, 0x5A, 0xDA, 0x5A, 0x87, 0x87, 0xF3, 0x86, 0xF1, + 0x02, 0xA4, 0x60, 0x46, 0x60, 0x45, 0x00, 0x61, 0x22, 0xF2, 0xFF, 0xFF, 0xAC, 0x86, 0x00, 0xF2, + 0x04, 0x03, 0xAC, 0x86, 0x00, 0xF2, 0xDD, 0x81, 0xFC, 0x02, 0x65, 0x44, 0x02, 0xA5, 0x65, 0x46, + 0x64, 0x44, 0xCC, 0x9C, 0xFF, 0xFF, 0xF0, 0x02, 0x61, 0x44, 0x25, 0x46, 0x27, 0xDA, 0x5A, 0x87, + 0x28, 0x45, 0x45, 0x88, 0x87, 0xF3, 0x86, 0xF1, 0x02, 0xA4, 0x60, 0x46, 0x60, 0x45, 0x00, 0x61, + 0x76, 0xF2, 0xFF, 0xFF, 0xAC, 0x86, 0x00, 0xF2, 0x09, 0x03, 0x00, 0xF2, 0x09, 0xF0, 0xAC, 0x86, + 0x00, 0xF2, 0xDD, 0x81, 0xFC, 0x02, 0x64, 0x44, 0xAC, 0x86, 0xF6, 0x01, 0x65, 0x44, 0x02, 0xA5, + 0x65, 0x46, 0x64, 0x44, 0xCC, 0x9C, 0x61, 0x44, 0xEB, 0x02, 0x25, 0x46, 0x27, 0xDA, 0x5A, 0x87, + 0x28, 0x45, 0x45, 0x88, 0x06, 0x60, 0x40, 0x65, 0x8C, 0xF3, 0x01, 0x61, 0xAC, 0x86, 0x00, 0xF2, + 0x03, 0x03, 0xD5, 0x80, 0xDD, 0x81, 0xFA, 0x04, 0xCD, 0x84, 0x25, 0x46, 0x27, 0xDA, 0x28, 0x45, + 0xC4, 0x84, 0x5A, 0xDA, 0xDA, 0x81, 0x8B, 0xF1, 0x59, 0xD8, 0x1E, 0x60, 0xCC, 0x64, 0x18, 0x63, + 0xA0, 0xD1, 0x06, 0xA4, 0x59, 0xD8, 0xFC, 0x1F, 0x00, 0x64, 0x59, 0xDA, 0x59, 0xDA, 0x01, 0x60, + 0x1A, 0x64, 0x0A, 0x63, 0x58, 0xD1, 0x59, 0xD8, 0xFD, 0x1F, 0x7D, 0xF1, 0x59, 0xD8, 0x45, 0x01, + 0x07, 0x4B, 0xB6, 0x60, 0x58, 0x4F, 0x4D, 0x78, 0xFF, 0xFF, 0x0B, 0x47, 0x58, 0x4F, 0x21, 0x00, + 0x3C, 0x01, 0x07, 0x4B, 0xB6, 0x60, 0x58, 0x4F, 0x4D, 0x78, 0xFF, 0xFF, 0x0B, 0x47, 0x27, 0x44, + 0x00, 0xBE, 0x08, 0xF0, 0x15, 0x03, 0x64, 0x42, 0x4A, 0xD3, 0x09, 0xF2, 0xDC, 0x83, 0xA2, 0xDD, + 0x25, 0x43, 0x09, 0xFC, 0x63, 0x46, 0x27, 0x43, 0x0A, 0xFC, 0x09, 0xFA, 0x08, 0xF8, 0x00, 0xA8, + 0x66, 0x43, 0x03, 0x02, 0x64, 0x44, 0x58, 0xDD, 0x03, 0x00, 0x60, 0x46, 0x25, 0x44, 0x0A, 0xFA, + 0x1C, 0x01, 0x27, 0x43, 0xE3, 0x81, 0xE9, 0x81, 0x03, 0x05, 0x16, 0x03, 0x00, 0x61, 0x01, 0x00, + 0xEC, 0x63, 0x61, 0x46, 0xBF, 0xD2, 0x27, 0x45, 0xDC, 0x84, 0xA2, 0xDA, 0xA3, 0xD2, 0x25, 0x46, + 0x88, 0xF8, 0x04, 0x1B, 0x25, 0x44, 0x61, 0x46, 0xBE, 0xDA, 0x04, 0x00, 0x09, 0xFA, 0x60, 0x46, + 0x25, 0x44, 0x0A, 0xFA, 0x61, 0x46, 0xA3, 0xDA, 0x2F, 0x58, 0xFF, 0xFF, 0xA0, 0xFE, 0x07, 0x05, + 0xA3, 0xFE, 0x07, 0x05, 0xA1, 0xFE, 0x46, 0x05, 0x60, 0x64, 0x3B, 0xDB, 0x0F, 0x00, 0x20, 0x58, + 0xFF, 0xFF, 0xFA, 0x01, 0x0A, 0x60, 0x80, 0xF3, 0xFF, 0xFF, 0xFB, 0xB4, 0xA2, 0xDB, 0xA0, 0x4C, + 0x59, 0xBC, 0xFF, 0xB4, 0xA0, 0x51, 0xA0, 0x4C, 0x7D, 0xB4, 0xA0, 0x51, 0xA1, 0xFF, 0xFF, 0xFF, + 0x83, 0x3E, 0x40, 0x60, 0x0B, 0x65, 0x2B, 0x44, 0x00, 0x63, 0xE8, 0x80, 0xF8, 0x84, 0x02, 0x24, + 0x94, 0x84, 0xF3, 0x83, 0xCD, 0x81, 0xFF, 0xFF, 0xF8, 0x02, 0xDF, 0x83, 0x2F, 0x58, 0x40, 0x4B, + 0x00, 0x62, 0x01, 0x64, 0xD4, 0x80, 0xE0, 0x84, 0x1A, 0x03, 0xD4, 0x80, 0xE0, 0x84, 0x15, 0x03, + 0x61, 0x44, 0x11, 0x61, 0xE0, 0x84, 0xCD, 0x81, 0xFD, 0x04, 0x01, 0x00, 0xE0, 0x84, 0xF2, 0x82, + 0xFF, 0xFF, 0x02, 0x24, 0xC6, 0x82, 0x02, 0x28, 0xD6, 0x82, 0xE2, 0x80, 0xCD, 0x81, 0x02, 0x28, + 0x01, 0xBC, 0xF4, 0x02, 0x01, 0x2A, 0xC6, 0x82, 0x03, 0x00, 0xE9, 0x81, 0xF2, 0x82, 0x61, 0x44, + 0x2D, 0x58, 0xFF, 0xFF, 0x00, 0x64, 0x3B, 0xDB, 0x0C, 0x60, 0x6E, 0xF3, 0x5A, 0xD1, 0x60, 0x40, + 0x04, 0x3A, 0x2C, 0x00, 0x00, 0x64, 0x4A, 0xDB, 0x1E, 0x60, 0xCE, 0x63, 0xA3, 0xD3, 0x46, 0x43, + 0xAC, 0x86, 0x3C, 0x45, 0x22, 0x03, 0xD4, 0x80, 0x07, 0xF2, 0x02, 0x02, 0x09, 0xF2, 0xF8, 0x01, + 0xD0, 0x80, 0x09, 0xF2, 0xF5, 0x02, 0x60, 0x43, 0x80, 0x67, 0xB0, 0x81, 0x61, 0x44, 0x0F, 0x60, + 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x09, 0x60, + 0x08, 0x65, 0x0E, 0xF2, 0x02, 0xF2, 0x60, 0x40, 0xF0, 0x37, 0x05, 0x00, 0x8F, 0xF3, 0xD4, 0x80, + 0xCC, 0x84, 0x01, 0x02, 0x8F, 0xFB, 0x63, 0x44, 0xDB, 0x01, 0x23, 0x46, 0x3C, 0x44, 0xAC, 0x80, + 0xFF, 0xFF, 0x94, 0x02, 0x69, 0xF3, 0x6A, 0xF3, 0x02, 0xA8, 0x02, 0xA8, 0x08, 0x02, 0x00, 0x64, + 0x6B, 0xFB, 0x69, 0xFB, 0x6A, 0xFB, 0x00, 0x64, 0x6C, 0xFB, 0xCA, 0xFE, 0x92, 0x00, 0x03, 0x02, + 0x00, 0x64, 0x6A, 0xFB, 0xCA, 0xFE, 0x01, 0x64, 0x3B, 0xDB, 0x0F, 0x60, 0x6A, 0xF3, 0xFF, 0xFF, + 0x00, 0xA8, 0x60, 0x46, 0x35, 0x03, 0x2C, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x26, 0x86, 0x00, + 0x2E, 0xF2, 0x15, 0x60, 0x02, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, + 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x2E, 0xF0, 0x63, 0x46, 0xD0, 0x80, + 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x2D, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, + 0x61, 0x46, 0x2C, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, + 0x63, 0x46, 0xE8, 0x1B, 0x87, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x5F, 0x02, 0x66, 0x45, + 0x63, 0x46, 0x06, 0xF2, 0x65, 0x46, 0x80, 0xB0, 0x09, 0xF2, 0x58, 0x03, 0xAC, 0x86, 0xCA, 0x01, + 0x6A, 0xF3, 0xFF, 0xFF, 0x01, 0xA8, 0xFF, 0xFF, 0x4C, 0x02, 0x0F, 0x60, 0x73, 0xF3, 0xFF, 0xFF, + 0x00, 0xA8, 0x60, 0x46, 0x0F, 0x03, 0x76, 0xF1, 0x07, 0xF2, 0xFF, 0xFF, 0xD0, 0x80, 0x09, 0xF2, + 0x03, 0x02, 0xAC, 0x86, 0x07, 0xF2, 0xFA, 0x02, 0x03, 0x02, 0x00, 0x64, 0x76, 0xFB, 0xED, 0x01, + 0x46, 0x5C, 0x3C, 0x00, 0x0F, 0x60, 0x76, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x01, 0x03, + 0x35, 0x02, 0x6B, 0xF3, 0xFF, 0xFF, 0x01, 0xA8, 0xFF, 0xFF, 0x13, 0x02, 0x0F, 0x60, 0x6D, 0xF3, + 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x0B, 0x03, 0x2A, 0xF0, 0x20, 0x67, 0x09, 0xF2, 0xB0, 0x83, + 0x00, 0xA8, 0x00, 0x64, 0x02, 0x03, 0x2A, 0xFC, 0x01, 0x00, 0x6B, 0xFB, 0x1F, 0x00, 0x00, 0x64, + 0x6B, 0xFB, 0x0F, 0x60, 0x67, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x12, 0x03, 0x2A, 0xF0, + 0x08, 0x67, 0xA0, 0x80, 0xFF, 0xFF, 0x12, 0x03, 0x76, 0xF1, 0x07, 0xF2, 0xFF, 0xFF, 0xD0, 0x80, + 0x09, 0xF2, 0x03, 0x02, 0xAC, 0x86, 0x07, 0xF2, 0xFA, 0x02, 0x08, 0x02, 0x00, 0x64, 0x76, 0xFB, + 0xE8, 0x01, 0x00, 0x64, 0x76, 0xFB, 0xB7, 0x60, 0xA2, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0xFC, 0xFB, + 0x46, 0x5C, 0x16, 0x60, 0x2B, 0xF3, 0x0D, 0xF2, 0x60, 0x5C, 0x64, 0x5F, 0x0D, 0xFA, 0x07, 0xF0, + 0x2A, 0xF2, 0xFF, 0xFF, 0x76, 0xF9, 0x60, 0x40, 0x08, 0x2B, 0x05, 0x00, 0x00, 0x64, 0x48, 0xFB, + 0xBA, 0x60, 0x03, 0x78, 0xFF, 0xFF, 0x00, 0x64, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x02, 0x23, 0xF0, + 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0xBF, 0x60, 0x16, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0x00, 0x63, + 0x40, 0x47, 0x50, 0x36, 0x01, 0x00, 0x01, 0x63, 0x48, 0xFD, 0x4A, 0xF3, 0x35, 0xFA, 0x10, 0xA4, + 0x4A, 0xFB, 0x00, 0x64, 0x15, 0xFA, 0x16, 0xFA, 0x0F, 0xFA, 0x07, 0xF0, 0x87, 0xF3, 0xFF, 0xFF, + 0xD0, 0x80, 0xFF, 0xFF, 0x05, 0x03, 0x66, 0x43, 0x64, 0x46, 0x11, 0xF2, 0xBA, 0xFB, 0x63, 0x46, + 0x03, 0xF2, 0x00, 0xF4, 0x01, 0xF2, 0xFC, 0xA5, 0x00, 0x7F, 0xD4, 0x84, 0x27, 0x45, 0x3C, 0x46, + 0x1A, 0xFA, 0x22, 0x63, 0x7B, 0x60, 0xFF, 0x64, 0xA4, 0x84, 0x03, 0x2B, 0x1C, 0x63, 0x2A, 0xFA, + 0x8F, 0xB0, 0x88, 0x36, 0x02, 0xA3, 0x60, 0x40, 0xA4, 0x36, 0x14, 0x63, 0x43, 0x4C, 0x18, 0xFC, + 0x00, 0x7C, 0x22, 0xF8, 0x64, 0x41, 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, 0x3A, 0xF2, 0x63, 0x46, + 0xFF, 0xB4, 0x22, 0xFA, 0x60, 0x40, 0x00, 0x36, 0x92, 0x00, 0x2A, 0xF2, 0xFF, 0xFF, 0x0C, 0xB0, + 0x08, 0x3A, 0x8D, 0x00, 0x60, 0x40, 0x40, 0x26, 0x8A, 0x00, 0x03, 0xF2, 0x00, 0xF4, 0xA0, 0xD2, + 0xAA, 0x60, 0xAA, 0x65, 0x5A, 0xD0, 0xD4, 0x80, 0x03, 0x64, 0x0A, 0x02, 0xD0, 0x80, 0x00, 0x64, + 0x5A, 0xD0, 0x06, 0x02, 0xD0, 0x80, 0xF8, 0x7F, 0xD0, 0x80, 0x01, 0x03, 0x01, 0x02, 0x01, 0x61, + 0x62, 0x43, 0x46, 0x43, 0x3C, 0x46, 0x07, 0xF4, 0x3A, 0xF2, 0xFF, 0xFF, 0xA3, 0x46, 0x60, 0x40, + 0x22, 0x26, 0x49, 0x00, 0x60, 0x45, 0x63, 0x42, 0x5A, 0xD0, 0xCD, 0x81, 0x3C, 0x46, 0x18, 0x02, + 0x64, 0x44, 0x88, 0x3A, 0x15, 0x00, 0x8E, 0x37, 0x00, 0x00, 0x65, 0x44, 0x01, 0x26, 0x5F, 0x00, + 0x04, 0x26, 0x03, 0x00, 0x10, 0x26, 0x01, 0x00, 0x31, 0x00, 0xA3, 0x46, 0x3B, 0xF2, 0xFF, 0xFF, + 0x60, 0x40, 0x80, 0x27, 0x3E, 0x00, 0xA3, 0x46, 0x00, 0x7C, 0x22, 0xF8, 0xA3, 0x46, 0x4F, 0x00, + 0xA3, 0x46, 0x65, 0x44, 0x01, 0x26, 0x0B, 0x00, 0x04, 0x26, 0x03, 0x00, 0x10, 0x26, 0x01, 0x00, + 0x1D, 0x00, 0x3B, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x27, 0x2B, 0x00, 0x17, 0x00, 0x87, 0xF3, + 0xFF, 0xFF, 0x60, 0x46, 0x3A, 0xF2, 0x66, 0x43, 0xFF, 0xB4, 0x3C, 0x46, 0x22, 0xF0, 0x60, 0x47, + 0xB0, 0x84, 0x22, 0xFA, 0x63, 0x46, 0x3B, 0xF0, 0x60, 0x40, 0x04, 0x27, 0x03, 0x00, 0x10, 0x27, + 0x01, 0x00, 0x04, 0x00, 0x64, 0x40, 0x80, 0x27, 0x14, 0x00, 0x00, 0x00, 0x3C, 0x46, 0x02, 0x65, + 0xBE, 0x60, 0xB6, 0x78, 0xFF, 0xFF, 0xCD, 0x81, 0x63, 0x42, 0x5A, 0xD0, 0x3C, 0x46, 0x09, 0x02, + 0x64, 0x44, 0x88, 0x3A, 0x06, 0x00, 0x77, 0x37, 0x1A, 0x00, 0x78, 0x37, 0x18, 0x00, 0x8E, 0x37, + 0x16, 0x00, 0x3C, 0x46, 0x22, 0xF0, 0x80, 0x67, 0xB0, 0x84, 0xA2, 0xDA, 0xFF, 0xFF, 0x3F, 0xF2, + 0x3E, 0xF0, 0x08, 0xA4, 0x60, 0x41, 0x22, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x26, 0x03, 0x00, + 0x04, 0x26, 0x03, 0x00, 0x04, 0x00, 0x04, 0x2B, 0x02, 0x00, 0x61, 0x44, 0x3F, 0xFA, 0x3C, 0x46, + 0x2C, 0xF2, 0x27, 0x40, 0x01, 0x27, 0x32, 0xF2, 0xB4, 0xF1, 0x60, 0x40, 0x01, 0x26, 0x47, 0x00, + 0x09, 0x60, 0x00, 0x64, 0xD0, 0x80, 0x3F, 0xF2, 0x09, 0x06, 0x2C, 0x45, 0xC4, 0x84, 0xD0, 0x80, + 0x40, 0x4A, 0x34, 0x06, 0x60, 0x43, 0x64, 0x44, 0x54, 0x88, 0x17, 0x00, 0x60, 0x45, 0x13, 0x60, + 0x4B, 0xF3, 0xBB, 0xF3, 0x00, 0xBC, 0x60, 0x47, 0xEC, 0xA0, 0x28, 0x03, 0x27, 0x07, 0x2C, 0x44, + 0xC4, 0x81, 0x02, 0x60, 0x1C, 0x65, 0x45, 0x4A, 0xD5, 0x80, 0x2C, 0x45, 0x1F, 0x06, 0x27, 0x40, + 0x04, 0x27, 0x25, 0x00, 0x2A, 0x43, 0xD7, 0x85, 0x45, 0x48, 0xB5, 0xF1, 0x0F, 0xF2, 0xD3, 0x80, + 0x01, 0x65, 0x01, 0x07, 0x00, 0x65, 0xB4, 0x84, 0x0F, 0xFA, 0x00, 0x63, 0x3F, 0xF2, 0x28, 0x45, + 0x60, 0x41, 0xD4, 0x84, 0xDF, 0x83, 0xFC, 0x07, 0x14, 0xFC, 0x17, 0xFA, 0x04, 0x60, 0x00, 0x64, + 0x27, 0x45, 0xB4, 0x84, 0x2A, 0xFA, 0x28, 0x43, 0x16, 0xFC, 0x0D, 0x00, 0x3F, 0xF2, 0x2C, 0x45, + 0xB5, 0xF1, 0xC4, 0x81, 0xD1, 0x80, 0x0F, 0xF2, 0x01, 0x06, 0x01, 0xBC, 0x0F, 0xFA, 0x3F, 0xF2, + 0x17, 0xFA, 0x01, 0x64, 0x14, 0xFA, 0x0F, 0xF0, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x2A, 0x6F, 0x00, + 0x64, 0xF1, 0x15, 0x60, 0xDD, 0xF3, 0x64, 0x40, 0x01, 0x27, 0x03, 0x00, 0x60, 0x40, 0x02, 0x26, + 0x14, 0x00, 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, 0x12, 0xF0, 0x15, 0x60, 0xDE, 0xF3, 0x63, 0x46, + 0x64, 0x40, 0x10, 0x2A, 0x20, 0x00, 0x60, 0x40, 0x02, 0x26, 0x07, 0x00, 0x01, 0x26, 0x08, 0x00, + 0x04, 0x26, 0x09, 0x00, 0x06, 0x61, 0x6E, 0x63, 0x08, 0x00, 0x02, 0x61, 0x14, 0x63, 0x05, 0x00, + 0x00, 0x61, 0x0A, 0x63, 0x02, 0x00, 0x04, 0x61, 0x37, 0x63, 0x00, 0x64, 0x25, 0x60, 0xA2, 0x65, + 0x45, 0xD1, 0xD5, 0x81, 0x15, 0x60, 0xDA, 0xF9, 0x25, 0x60, 0x7A, 0x65, 0x45, 0xD1, 0x1C, 0xFC, + 0xB0, 0x84, 0x1E, 0xFA, 0x3C, 0x00, 0x60, 0x40, 0x10, 0x2A, 0x04, 0x00, 0x08, 0x61, 0x1E, 0x60, + 0x0B, 0x63, 0x27, 0x00, 0x20, 0x2A, 0x04, 0x00, 0x0A, 0x61, 0x16, 0x60, 0x0F, 0x63, 0x21, 0x00, + 0x40, 0x2A, 0x04, 0x00, 0x0C, 0x61, 0x12, 0x60, 0x0A, 0x63, 0x1B, 0x00, 0x80, 0x2A, 0x04, 0x00, + 0x0E, 0x61, 0x0E, 0x60, 0x0E, 0x63, 0x15, 0x00, 0x01, 0x2B, 0x04, 0x00, 0x10, 0x61, 0x0E, 0x60, + 0x09, 0x63, 0x0F, 0x00, 0x02, 0x2B, 0x04, 0x00, 0x12, 0x61, 0x0A, 0x60, 0x0D, 0x63, 0x09, 0x00, + 0x04, 0x2B, 0x04, 0x00, 0x14, 0x61, 0x0A, 0x60, 0x08, 0x63, 0x03, 0x00, 0x16, 0x61, 0x0A, 0x60, + 0x0C, 0x63, 0x1E, 0xF0, 0x40, 0x67, 0x25, 0x60, 0xA2, 0x65, 0x45, 0xD1, 0xD5, 0x81, 0x15, 0x60, + 0xDA, 0xF9, 0x25, 0x60, 0x7A, 0x65, 0x45, 0xD1, 0x1C, 0xFC, 0xB0, 0x84, 0x1E, 0xFA, 0xAA, 0xF2, + 0x15, 0x60, 0xC2, 0xF3, 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, 0x44, 0x44, 0x61, 0x40, 0x08, 0x26, + 0x02, 0x00, 0x61, 0x40, 0x80, 0x36, 0x12, 0xF2, 0x63, 0x46, 0x2C, 0x60, 0x26, 0x61, 0x00, 0x7F, + 0x60, 0x45, 0x45, 0xD3, 0xFF, 0xFF, 0x60, 0x45, 0x00, 0x7F, 0x4B, 0xFB, 0x65, 0x44, 0x00, 0x7E, + 0xBB, 0xFB, 0x62, 0xF1, 0x60, 0x43, 0x60, 0x47, 0xD0, 0x80, 0xC0, 0x65, 0x01, 0x06, 0x64, 0x44, + 0x0A, 0x36, 0x70, 0x64, 0x14, 0x36, 0x38, 0x64, 0x37, 0x36, 0x15, 0x64, 0x6E, 0x36, 0x0B, 0x64, + 0x44, 0x86, 0x2A, 0xF2, 0x07, 0xF0, 0x60, 0x40, 0xB0, 0x3A, 0x03, 0x00, 0x40, 0x3B, 0x01, 0x00, + 0x12, 0x00, 0x0C, 0xB4, 0x08, 0x3A, 0x44, 0x00, 0x22, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x2B, + 0x3F, 0x00, 0x17, 0xF2, 0x22, 0xF0, 0xFF, 0xFF, 0x64, 0x40, 0x22, 0x22, 0x04, 0x00, 0x00, 0xA8, + 0x01, 0xA8, 0x36, 0x03, 0x35, 0x03, 0x3C, 0x46, 0x2A, 0xF0, 0x40, 0x67, 0xB0, 0x84, 0xA2, 0xDA, + 0x60, 0x45, 0x22, 0xF2, 0xFF, 0xFF, 0x60, 0x43, 0x60, 0x40, 0x01, 0x26, 0x05, 0x00, 0x04, 0x26, + 0x1D, 0x00, 0x10, 0x26, 0x10, 0x00, 0x04, 0x00, 0x04, 0x27, 0x18, 0x00, 0x10, 0x27, 0x0B, 0x00, + 0x65, 0x44, 0x2A, 0x61, 0x60, 0x40, 0x03, 0x2B, 0x24, 0x61, 0x8F, 0xB0, 0x88, 0x36, 0x02, 0xA1, + 0x41, 0x4C, 0x98, 0xFA, 0x15, 0x00, 0x65, 0x44, 0x32, 0x61, 0x60, 0x40, 0x03, 0x2B, 0x2C, 0x61, + 0x8F, 0xB0, 0x88, 0x36, 0x02, 0xA1, 0x41, 0x4C, 0x98, 0xFA, 0x0A, 0x00, 0x65, 0x44, 0x2E, 0x61, + 0x60, 0x40, 0x03, 0x2B, 0x28, 0x61, 0x8F, 0xB0, 0x88, 0x36, 0x02, 0xA1, 0x41, 0x4C, 0x98, 0xFA, + 0xBB, 0x60, 0xFB, 0x78, 0xFF, 0xFF, 0x66, 0x45, 0xAA, 0xF2, 0x15, 0x60, 0xC2, 0xF3, 0x24, 0x46, + 0x61, 0x40, 0x08, 0x26, 0x02, 0x00, 0x61, 0x40, 0x80, 0x36, 0x12, 0xF2, 0x65, 0x46, 0x60, 0x40, + 0x10, 0x26, 0x34, 0x00, 0x2C, 0x45, 0x17, 0xF2, 0x4B, 0xF1, 0xC4, 0x84, 0xE0, 0x84, 0xE0, 0x84, + 0xE0, 0x81, 0x64, 0x45, 0x16, 0xA1, 0xB7, 0x60, 0x58, 0x4D, 0xC0, 0x78, 0xFF, 0xFF, 0x64, 0xF1, + 0x01, 0xA4, 0xE0, 0x84, 0xE0, 0x84, 0x64, 0x40, 0x01, 0x2B, 0x06, 0xA4, 0x1B, 0xFA, 0xBB, 0xF3, + 0x25, 0x60, 0x82, 0x65, 0x60, 0x40, 0x0B, 0x37, 0x00, 0x63, 0x0F, 0x37, 0x02, 0x63, 0x0A, 0x37, + 0x04, 0x63, 0x0E, 0x37, 0x06, 0x63, 0x09, 0x37, 0x08, 0x63, 0x0D, 0x37, 0x0A, 0x63, 0x08, 0x37, + 0x0C, 0x63, 0x0C, 0x37, 0x0E, 0x63, 0x28, 0xA3, 0x47, 0xD1, 0xD8, 0xA3, 0xD7, 0x83, 0x15, 0x60, + 0xD9, 0xF9, 0x47, 0xD1, 0x40, 0x67, 0xB0, 0x84, 0x1F, 0xFA, 0x56, 0x00, 0x2A, 0xF2, 0xFF, 0xFF, + 0x60, 0x40, 0x80, 0x36, 0x17, 0x00, 0x50, 0x36, 0x15, 0x00, 0x10, 0x36, 0x13, 0x00, 0x30, 0x36, + 0x11, 0x00, 0xA0, 0x36, 0x0F, 0x00, 0xB0, 0x36, 0x0D, 0x00, 0xC0, 0x36, 0x0B, 0x00, 0xBB, 0xF3, + 0xFF, 0xFF, 0x60, 0x40, 0x0A, 0x37, 0x06, 0x00, 0x15, 0x60, 0xDD, 0xF3, 0x80, 0x60, 0x00, 0x61, + 0x60, 0x40, 0x04, 0x26, 0x00, 0x61, 0xBB, 0xF3, 0x25, 0x60, 0x7A, 0x65, 0x60, 0x40, 0x0A, 0x37, + 0x00, 0x63, 0x14, 0x37, 0x02, 0x63, 0x37, 0x37, 0x04, 0x63, 0x6E, 0x37, 0x06, 0x63, 0x28, 0xA3, + 0x47, 0xD1, 0xD8, 0xA3, 0xD7, 0x83, 0x15, 0x60, 0xD9, 0xF9, 0x47, 0xD1, 0xFF, 0xFF, 0xB1, 0x84, + 0x1F, 0xFA, 0xBB, 0xF1, 0x2C, 0x45, 0x64, 0x43, 0x17, 0xF2, 0x4B, 0xF1, 0xC4, 0x84, 0xE0, 0x84, + 0xE0, 0x84, 0xE0, 0x81, 0x63, 0x40, 0x37, 0x37, 0xE1, 0x81, 0x64, 0x45, 0xB7, 0x60, 0x58, 0x4D, + 0xC0, 0x78, 0xFF, 0xFF, 0xAE, 0x82, 0xFC, 0xA2, 0x0A, 0x03, 0x63, 0x40, 0x6E, 0x3B, 0x06, 0x00, + 0x60, 0x41, 0x04, 0x0D, 0x63, 0x44, 0x80, 0x7E, 0xBB, 0xFB, 0x61, 0x44, 0xDC, 0x84, 0x2B, 0xF0, + 0x1B, 0xFA, 0x64, 0x44, 0x80, 0x27, 0x47, 0x00, 0x07, 0xF0, 0x66, 0x45, 0x64, 0x46, 0x12, 0xF2, + 0x65, 0x46, 0x60, 0x40, 0x10, 0x2A, 0x2E, 0x00, 0x16, 0xF2, 0x0F, 0xF0, 0xAC, 0x84, 0x2C, 0x45, + 0x29, 0x03, 0x4B, 0xF1, 0xC4, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x81, 0x63, 0x40, 0x37, 0x37, + 0xE1, 0x81, 0x64, 0x45, 0x0F, 0xF0, 0xB7, 0x60, 0x58, 0x4D, 0xC0, 0x78, 0xFF, 0xFF, 0xAE, 0x82, + 0xFC, 0xA2, 0x0A, 0x03, 0x63, 0x40, 0x6E, 0x3B, 0x06, 0x00, 0x60, 0x41, 0x04, 0x0D, 0x80, 0x67, + 0xB0, 0x84, 0x0F, 0xFA, 0x61, 0x44, 0xDC, 0x84, 0x1D, 0xFA, 0xDE, 0x65, 0xC4, 0x85, 0x26, 0x41, + 0xE1, 0x81, 0xC5, 0x84, 0x2B, 0xFA, 0x1B, 0xF0, 0xDE, 0x64, 0xC0, 0x85, 0x26, 0x44, 0xE0, 0x84, + 0xC4, 0x84, 0x10, 0xFA, 0x26, 0x44, 0x2C, 0xF0, 0x0A, 0xA4, 0x66, 0x45, 0x24, 0x46, 0x92, 0xF2, + 0x65, 0x46, 0x9F, 0xF0, 0x61, 0x40, 0x10, 0x2A, 0x03, 0x00, 0x65, 0x40, 0x80, 0x27, 0xA0, 0xA4, + 0x64, 0x40, 0x01, 0x26, 0x00, 0x64, 0x11, 0xFA, 0xBB, 0xF3, 0x13, 0xFA, 0x7C, 0x44, 0x1D, 0xFA, + 0xFF, 0xFF, 0x0D, 0xF2, 0x3E, 0xF0, 0x60, 0x47, 0xFF, 0xB4, 0x64, 0x41, 0x01, 0xB1, 0x01, 0x63, + 0x17, 0x02, 0x60, 0x41, 0xFF, 0x22, 0x04, 0x00, 0xB7, 0x60, 0x58, 0x4F, 0xB1, 0x78, 0xFF, 0xFF, + 0x07, 0x60, 0xF7, 0xFD, 0x16, 0x60, 0x2B, 0xF3, 0xFF, 0xFF, 0x60, 0x41, 0x01, 0x63, 0x61, 0x40, + 0xFF, 0x22, 0x04, 0x00, 0xB7, 0x60, 0x58, 0x4F, 0xB1, 0x78, 0xFF, 0xFF, 0x07, 0x60, 0xF8, 0xFD, + 0xBD, 0x60, 0x7A, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x40, 0x27, 0x03, 0x00, + 0xBD, 0x60, 0x75, 0x78, 0xFF, 0xFF, 0x22, 0xF2, 0x46, 0x43, 0x60, 0x40, 0x22, 0x26, 0x09, 0x00, + 0x01, 0x26, 0x0A, 0x00, 0x04, 0x26, 0x4B, 0x00, 0x10, 0x26, 0x10, 0x00, 0xBD, 0x60, 0x75, 0x78, + 0xFF, 0xFF, 0xBC, 0x60, 0xF0, 0x78, 0xFF, 0xFF, 0x04, 0x27, 0x3D, 0x00, 0x10, 0x27, 0x03, 0x00, + 0xBD, 0x60, 0x75, 0x78, 0xFF, 0xFF, 0x87, 0xF3, 0x3C, 0xF1, 0x02, 0x00, 0x07, 0xF2, 0x00, 0x7C, + 0x40, 0x43, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x27, 0x21, 0x00, 0xA3, 0x46, 0x4B, 0xF2, + 0xFF, 0xFF, 0xDC, 0x84, 0x4B, 0xFA, 0x4A, 0xF2, 0x08, 0x04, 0xDC, 0x84, 0x4A, 0xFA, 0x49, 0xF2, + 0x04, 0x04, 0xDC, 0x84, 0x49, 0xFA, 0x01, 0x04, 0xFF, 0xFF, 0x87, 0xF3, 0x66, 0x5C, 0xD0, 0x80, + 0x00, 0x7C, 0x01, 0x02, 0x3C, 0xF1, 0x4B, 0xF0, 0x64, 0x47, 0x20, 0xBF, 0xA3, 0x46, 0x3A, 0xF8, + 0x3B, 0xFA, 0xA3, 0x46, 0x4A, 0xF2, 0x49, 0xF0, 0xA3, 0x46, 0x3C, 0xFA, 0x3D, 0xF8, 0x0F, 0x60, + 0xA0, 0x64, 0xA3, 0x46, 0x76, 0x61, 0x0E, 0x63, 0x59, 0xD0, 0x58, 0xD9, 0xFD, 0x1F, 0xA3, 0x46, + 0xBD, 0x60, 0x75, 0x78, 0xFF, 0xFF, 0x87, 0xF3, 0xFF, 0xFF, 0x60, 0x46, 0x02, 0x00, 0x07, 0xF4, + 0xFF, 0xFF, 0xA3, 0x46, 0x2A, 0xF2, 0xA3, 0x46, 0x60, 0x40, 0x08, 0x27, 0x48, 0x00, 0x87, 0xF3, + 0x66, 0x5C, 0xD0, 0x80, 0x3B, 0xF0, 0x08, 0x03, 0x64, 0x40, 0x10, 0x2A, 0x12, 0x00, 0xFF, 0x60, + 0xEF, 0x64, 0xA0, 0x84, 0x3B, 0xFA, 0x24, 0x00, 0x3D, 0xF3, 0x01, 0x61, 0x60, 0x43, 0xCF, 0x83, + 0xE1, 0x81, 0xFD, 0x0D, 0xE9, 0x81, 0xA1, 0x80, 0xFF, 0xFF, 0x03, 0x03, 0x91, 0x84, 0x3B, 0xFA, + 0x17, 0x00, 0x4B, 0xF2, 0xFF, 0xFF, 0x10, 0xA0, 0xFF, 0xFF, 0x02, 0x04, 0xFF, 0x60, 0xFF, 0x64, + 0xDC, 0x84, 0x4B, 0xFA, 0x4A, 0xF2, 0x16, 0x04, 0xDC, 0x84, 0x4A, 0xFA, 0x49, 0xF2, 0x08, 0x04, + 0xDC, 0x84, 0x49, 0xFA, 0x05, 0x04, 0x3B, 0xF2, 0xFF, 0xFF, 0xE0, 0x84, 0xE8, 0x84, 0x3B, 0xFA, + 0x0C, 0x60, 0xFE, 0x62, 0x80, 0xFF, 0x78, 0x44, 0x03, 0xA4, 0xA2, 0xDB, 0xC7, 0x60, 0xCF, 0x78, + 0xFF, 0xFF, 0x84, 0xFF, 0x06, 0x60, 0x17, 0xE1, 0x77, 0x40, 0x8B, 0xFF, 0x02, 0x60, 0x00, 0x75, + 0xC9, 0x60, 0x58, 0x4F, 0x67, 0x78, 0xFF, 0xFF, 0x01, 0x64, 0x06, 0x60, 0x80, 0xFB, 0x0C, 0x60, + 0xFE, 0x62, 0x80, 0xFF, 0x78, 0x44, 0x03, 0xA4, 0xA2, 0xDB, 0xC8, 0x60, 0x46, 0x78, 0xFF, 0xFF, + 0x84, 0xFF, 0x00, 0x7C, 0x06, 0x60, 0x80, 0xF3, 0xA2, 0xD9, 0x60, 0x40, 0x01, 0x2A, 0x04, 0x00, + 0xC9, 0x60, 0x58, 0x4F, 0xAF, 0x78, 0xFF, 0xFF, 0x3C, 0x46, 0x07, 0xF4, 0x87, 0xF3, 0x66, 0x5C, + 0xD0, 0x80, 0x00, 0x7C, 0x07, 0x03, 0x66, 0x43, 0x3C, 0x46, 0x22, 0xF2, 0x63, 0x46, 0x60, 0x40, + 0x01, 0x2A, 0x01, 0x00, 0x3C, 0xF1, 0x4B, 0xF0, 0x64, 0x41, 0x64, 0x47, 0xFF, 0xB4, 0x60, 0x5F, + 0x20, 0xBC, 0x80, 0x26, 0x80, 0xAC, 0x60, 0x47, 0xA3, 0x46, 0x3A, 0xFA, 0x64, 0x44, 0x20, 0x7F, + 0x34, 0x94, 0x3B, 0xFA, 0xA3, 0x46, 0x4A, 0xF2, 0x49, 0xF0, 0xA3, 0x46, 0x3C, 0xFA, 0x3D, 0xF8, + 0x80, 0x60, 0x10, 0xE0, 0x08, 0x60, 0x00, 0xEA, 0x0F, 0x64, 0x60, 0x7F, 0xA0, 0x5A, 0x80, 0x60, + 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, 0xD1, 0x60, 0x00, 0xEA, 0xBD, 0x60, 0x75, 0x78, 0xFF, 0xFF, + 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x27, 0x31, 0x00, 0x2A, 0xF2, 0x00, 0x60, 0x7C, 0x62, + 0x60, 0x40, 0x40, 0x2B, 0x24, 0x00, 0xA2, 0xD3, 0x00, 0x61, 0x60, 0xFE, 0xA0, 0xD3, 0x5E, 0xD1, + 0xFF, 0xFF, 0x20, 0xFE, 0x64, 0x5F, 0xDC, 0x84, 0xF1, 0x81, 0xC0, 0x2B, 0x04, 0x00, 0x80, 0x2A, + 0x02, 0x00, 0x7F, 0xA4, 0xDC, 0x84, 0xFF, 0x3B, 0x03, 0x00, 0x60, 0x47, 0xDC, 0x87, 0x01, 0x61, + 0xC0, 0x80, 0x00, 0x36, 0xDC, 0x84, 0x4E, 0xDB, 0x60, 0xFE, 0x5A, 0xD1, 0xFF, 0xFF, 0xC1, 0x84, + 0xF0, 0x22, 0x10, 0xA4, 0xF0, 0x2A, 0x01, 0x00, 0x00, 0x64, 0xA2, 0xDB, 0x20, 0xFE, 0x00, 0x60, + 0x3E, 0xF3, 0xFF, 0xFF, 0xA0, 0xD3, 0x5A, 0xD1, 0x3A, 0xFA, 0x3B, 0xF8, 0x74, 0x62, 0xA2, 0xD0, + 0xFF, 0xFF, 0x64, 0x44, 0xE0, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xE1, 0x7F, 0x5A, 0xD0, 0xA0, 0x5A, + 0x64, 0x44, 0xE2, 0x7F, 0xA0, 0x5A, 0x00, 0x60, 0x40, 0xF3, 0xFF, 0xFF, 0xA0, 0xD1, 0x5A, 0xD1, + 0x64, 0x45, 0x64, 0x44, 0xE3, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xE4, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, + 0x64, 0x44, 0xE5, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xE6, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, + 0xE7, 0x7F, 0xA0, 0x5A, 0x65, 0x40, 0x0D, 0x3A, 0x1C, 0x00, 0x64, 0x47, 0xE8, 0x7F, 0x5A, 0xD1, + 0xA0, 0x5A, 0x64, 0x44, 0xE9, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xEA, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, + 0x64, 0x44, 0xEB, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xEC, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, + 0xED, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xEE, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xEF, 0x7F, + 0xA0, 0x5A, 0x08, 0x60, 0x00, 0xEA, 0x65, 0x44, 0x02, 0xA4, 0x60, 0x7F, 0xA0, 0x5A, 0x80, 0x60, + 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, 0xD1, 0x60, 0x00, 0xEA, 0x02, 0x64, 0x3B, 0xDB, 0xBA, 0x60, + 0xF3, 0x78, 0xFF, 0xFF, 0xBF, 0x60, 0xBB, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0xFC, 0xFB, 0x07, 0xF0, + 0x00, 0x64, 0xD0, 0x80, 0x87, 0xF3, 0x0E, 0x03, 0xD0, 0x80, 0xFF, 0xFF, 0x0B, 0x03, 0x47, 0xF1, + 0x07, 0xF0, 0x64, 0x40, 0x02, 0x26, 0x01, 0x00, 0x08, 0x00, 0x03, 0x12, 0xBE, 0x60, 0x46, 0x78, + 0xFF, 0xFF, 0xFC, 0x0A, 0xBE, 0x60, 0xA6, 0x78, 0xFF, 0xFF, 0x87, 0xF0, 0x87, 0xF3, 0x10, 0xF0, + 0xD4, 0x80, 0xFF, 0xFF, 0x3D, 0x03, 0x66, 0x43, 0x65, 0x46, 0xFF, 0x67, 0x20, 0x85, 0x64, 0x5F, + 0x40, 0x44, 0x15, 0xF0, 0x25, 0x44, 0xD0, 0x84, 0x03, 0xA4, 0x03, 0x0E, 0xE8, 0x84, 0xE8, 0x84, + 0x04, 0x00, 0xFA, 0xA4, 0xE8, 0x84, 0xE8, 0x87, 0xC0, 0xBF, 0xC0, 0x84, 0x15, 0xFA, 0x40, 0x45, + 0x14, 0xF0, 0x24, 0x44, 0xD0, 0x84, 0x1F, 0xA4, 0x06, 0x0E, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, + 0xE8, 0x84, 0xE8, 0x84, 0x07, 0x00, 0xC2, 0xA4, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, + 0xE8, 0x87, 0xF8, 0xBF, 0xC0, 0x84, 0x14, 0xFA, 0x60, 0x5C, 0x2F, 0x67, 0xD0, 0x80, 0x60, 0x45, + 0x02, 0x28, 0x64, 0x45, 0x25, 0x5C, 0x8B, 0x67, 0xD0, 0x80, 0x60, 0x41, 0x02, 0x24, 0x64, 0x41, + 0xD5, 0x84, 0x80, 0x65, 0xC4, 0x87, 0x01, 0x05, 0x00, 0x64, 0xFF, 0xB4, 0x0E, 0xFA, 0x63, 0x46, + 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, 0x17, 0xF2, 0x63, 0x46, 0x60, 0x40, 0x00, 0x36, 0x2E, 0x00, + 0x01, 0x36, 0x1E, 0x00, 0x03, 0x3A, 0x25, 0x00, 0x64, 0x46, 0x10, 0xF2, 0x11, 0xFA, 0x12, 0xF2, + 0x00, 0x61, 0x60, 0x47, 0x00, 0x7F, 0x12, 0xFA, 0x97, 0xFA, 0x46, 0x44, 0x63, 0x46, 0xC1, 0x60, + 0x58, 0x4E, 0x72, 0x78, 0xFF, 0xFF, 0x65, 0x40, 0x00, 0x3A, 0x04, 0x00, 0xC1, 0x60, 0x58, 0x4E, + 0xBC, 0x78, 0xFF, 0xFF, 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, 0x96, 0xFC, 0x63, 0x46, 0x43, 0x00, + 0x64, 0x46, 0x16, 0xF2, 0x00, 0x61, 0x20, 0x28, 0xFF, 0xA4, 0x97, 0xFA, 0x16, 0xFA, 0x63, 0x46, + 0x3A, 0x00, 0x64, 0x46, 0x00, 0x61, 0x97, 0xFA, 0x63, 0x46, 0x35, 0x00, 0x07, 0xF0, 0x66, 0x41, + 0x64, 0x46, 0x16, 0xF2, 0xFF, 0xFF, 0x20, 0x28, 0xFF, 0xA4, 0x16, 0xFA, 0x93, 0xF4, 0x12, 0xF2, + 0x20, 0x28, 0xFF, 0xA3, 0x13, 0xFC, 0x61, 0x46, 0x63, 0x40, 0x00, 0x3A, 0x24, 0x00, 0xC1, 0x60, + 0x58, 0x4E, 0x93, 0x78, 0xFF, 0xFF, 0x61, 0x40, 0xFF, 0x36, 0x1D, 0x00, 0x66, 0x41, 0x64, 0x46, + 0x12, 0xF2, 0x93, 0xF4, 0x61, 0x46, 0x20, 0x28, 0x16, 0x00, 0x44, 0x44, 0xC1, 0x60, 0x58, 0x4E, + 0x72, 0x78, 0xFF, 0xFF, 0x24, 0x5C, 0x65, 0x40, 0x00, 0x36, 0x06, 0x00, 0x66, 0x41, 0x64, 0x46, + 0x01, 0x64, 0x17, 0xFA, 0x61, 0x46, 0x07, 0x00, 0x66, 0x43, 0x64, 0x46, 0xC1, 0x60, 0x58, 0x4E, + 0xBC, 0x78, 0xFF, 0xFF, 0x63, 0x46, 0xBE, 0x60, 0xA6, 0x78, 0xFF, 0xFF, 0x07, 0xF0, 0x66, 0x43, + 0x64, 0x46, 0x17, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0xFF, 0x27, 0xFF, 0xFF, 0x00, 0x36, 0x07, 0x00, + 0x01, 0x36, 0x1C, 0x00, 0x02, 0x36, 0x24, 0x00, 0x03, 0x36, 0x43, 0x00, 0xFF, 0xFF, 0x15, 0x60, + 0xF9, 0xF1, 0x16, 0xF2, 0x43, 0x44, 0xD0, 0x80, 0x2C, 0x60, 0x24, 0x61, 0x09, 0x03, 0xA1, 0xD1, + 0x2C, 0x60, 0x22, 0x63, 0xC0, 0x84, 0x16, 0xFA, 0xA3, 0xD3, 0xFF, 0xFF, 0x13, 0xFA, 0x39, 0x00, + 0x96, 0xFC, 0xC1, 0x60, 0x58, 0x4E, 0xBC, 0x78, 0xFF, 0xFF, 0x33, 0x00, 0x43, 0x44, 0xC1, 0x60, + 0x58, 0x4E, 0xBC, 0x78, 0xFF, 0xFF, 0x16, 0x60, 0x11, 0xF3, 0x96, 0xFC, 0x13, 0xFA, 0x29, 0x00, + 0x63, 0x46, 0x2B, 0x60, 0xF4, 0x63, 0xA3, 0xD3, 0x15, 0xF2, 0x60, 0x45, 0xD4, 0x80, 0x07, 0xF0, + 0x0C, 0x03, 0x66, 0x41, 0x44, 0x44, 0x64, 0x46, 0x12, 0xF2, 0x61, 0x46, 0xC1, 0x60, 0x58, 0x4E, + 0x72, 0x78, 0xFF, 0xFF, 0x65, 0x40, 0x00, 0x3A, 0x19, 0x00, 0x66, 0x43, 0x24, 0x46, 0xC1, 0x60, + 0x58, 0x4E, 0xBC, 0x78, 0xFF, 0xFF, 0x12, 0xF2, 0x91, 0xF2, 0x90, 0xFA, 0x60, 0x5F, 0x12, 0xFA, + 0x04, 0x00, 0xC1, 0x60, 0x58, 0x4E, 0xBC, 0x78, 0xFF, 0xFF, 0x03, 0x64, 0x17, 0xFA, 0x63, 0x46, + 0x05, 0x00, 0x24, 0x43, 0x02, 0x64, 0x17, 0xFA, 0x63, 0x46, 0x00, 0x00, 0x03, 0x64, 0x3B, 0xDB, + 0xCA, 0xFE, 0x47, 0xF1, 0x01, 0x65, 0x32, 0x40, 0x04, 0x27, 0x08, 0x00, 0x2C, 0xF2, 0x64, 0x45, + 0x02, 0x22, 0x04, 0x00, 0x60, 0x40, 0x01, 0x26, 0x01, 0x00, 0x7B, 0x00, 0x14, 0xF2, 0x65, 0x40, + 0x01, 0x26, 0x0C, 0x00, 0x60, 0x45, 0x05, 0x64, 0x3B, 0xDB, 0x65, 0x44, 0xCC, 0x85, 0x25, 0x60, + 0xD6, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xD3, 0x78, 0x97, 0xF1, 0x50, 0x00, 0x60, 0x41, 0x2A, 0xF0, + 0x00, 0x60, 0x0C, 0x64, 0xA0, 0x84, 0x04, 0x36, 0x02, 0x00, 0x0C, 0x3A, 0x01, 0x00, 0x46, 0x00, + 0x61, 0x45, 0x60, 0x43, 0x25, 0x60, 0xD6, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xD3, 0x78, 0x97, 0xF1, + 0x63, 0x40, 0x08, 0x36, 0x01, 0x00, 0x3A, 0x00, 0x14, 0xF2, 0x1C, 0x65, 0x60, 0x41, 0x00, 0x63, + 0xCD, 0x81, 0xC7, 0x83, 0xFD, 0x02, 0x3F, 0xF0, 0x2C, 0xF2, 0xC3, 0x83, 0x60, 0x40, 0x01, 0x2A, + 0x0D, 0x00, 0x25, 0x60, 0xD4, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xC7, 0x78, 0x97, 0xF1, 0x25, 0x60, + 0xDA, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xD2, 0x78, 0x63, 0x45, 0x20, 0x00, 0x25, 0x60, 0xD2, 0x64, + 0xE5, 0x60, 0x78, 0x41, 0xC7, 0x78, 0x97, 0xF1, 0x25, 0x60, 0xD8, 0x64, 0xE5, 0x60, 0x78, 0x41, + 0xD2, 0x78, 0x63, 0x45, 0x15, 0xF2, 0xFF, 0xFF, 0x0F, 0xB4, 0x00, 0xA8, 0x01, 0xA8, 0x0E, 0x03, + 0x07, 0x03, 0x25, 0x60, 0xE0, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xC7, 0x78, 0x97, 0xF1, 0x06, 0x00, + 0x25, 0x60, 0xDE, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xC7, 0x78, 0x97, 0xF1, 0x04, 0x64, 0x3B, 0xDB, + 0x07, 0xF0, 0x66, 0x41, 0x64, 0x46, 0x06, 0xF0, 0xFF, 0x60, 0x5F, 0x64, 0xA0, 0x84, 0x06, 0xFA, + 0x61, 0x46, 0x1E, 0x60, 0xF2, 0x64, 0x0F, 0x60, 0x8D, 0xFB, 0x3C, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x5C, 0x5C, 0xFC, 0xFC, 0xCE, 0xFE, 0xB7, 0x60, 0xE2, 0x78, + 0xFF, 0xFF, 0x13, 0x60, 0x2E, 0xF3, 0x07, 0xF4, 0x06, 0xF2, 0x02, 0xA8, 0x3C, 0x46, 0x10, 0x03, + 0x10, 0xB0, 0x2A, 0xF2, 0x0D, 0x03, 0x0E, 0xF2, 0x0C, 0xB0, 0x60, 0x40, 0xF0, 0x37, 0x20, 0xBC, + 0x02, 0x03, 0xFE, 0x7F, 0x0E, 0xFA, 0x23, 0xF0, 0x10, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0xCE, 0x01, + 0x2A, 0xF2, 0xFF, 0xFF, 0x50, 0xA8, 0x02, 0x7C, 0x10, 0x03, 0x0F, 0xF0, 0x15, 0xF2, 0x64, 0x41, + 0x01, 0x2A, 0x02, 0x00, 0xAF, 0xF1, 0x09, 0x00, 0x03, 0x65, 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, + 0x06, 0xF0, 0x63, 0x46, 0xAE, 0xF1, 0x64, 0x40, 0x10, 0x2A, 0x64, 0x45, 0xDC, 0x84, 0xD4, 0x80, + 0x15, 0xFA, 0x38, 0x07, 0x61, 0x40, 0x01, 0x2A, 0x08, 0x00, 0x13, 0x60, 0x03, 0xF3, 0xFF, 0xFF, + 0xDC, 0x84, 0x00, 0x36, 0x00, 0x3B, 0xA2, 0xDB, 0x07, 0x00, 0x13, 0x60, 0x04, 0xF3, 0xFF, 0xFF, + 0xDC, 0x84, 0x00, 0x36, 0x00, 0x3B, 0xA2, 0xDB, 0x2A, 0xF0, 0x08, 0x67, 0xB0, 0x84, 0xA2, 0xDA, + 0x08, 0xF0, 0x1E, 0x60, 0xD4, 0x64, 0xD0, 0x80, 0x07, 0xF2, 0x46, 0x43, 0x87, 0xF1, 0x06, 0x03, + 0x60, 0x46, 0x86, 0xF4, 0xD0, 0x80, 0x80, 0xBB, 0x01, 0x03, 0x06, 0xFC, 0x23, 0x46, 0x3E, 0xF2, + 0x00, 0x63, 0x01, 0xB0, 0x43, 0x5C, 0xFC, 0xFC, 0x0A, 0x03, 0x1E, 0x60, 0xEC, 0x64, 0x0F, 0x60, + 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xB7, 0x60, + 0xE2, 0x78, 0xFF, 0xFF, 0x00, 0x64, 0x49, 0xFB, 0x25, 0x60, 0xE0, 0x64, 0xE5, 0x60, 0x78, 0x41, + 0xC7, 0x78, 0x97, 0xF1, 0x25, 0x60, 0xE2, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xC7, 0x78, 0x97, 0xF1, + 0x27, 0x44, 0xF7, 0xB4, 0x40, 0x47, 0x23, 0xF0, 0x01, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0x07, 0xF0, + 0x66, 0x41, 0x64, 0x46, 0x06, 0xF2, 0x7F, 0x65, 0xA4, 0x9E, 0x06, 0xFA, 0x61, 0x46, 0x5E, 0x01, + 0xC0, 0x60, 0x35, 0x78, 0xFF, 0xFF, 0x21, 0x64, 0x3B, 0xDB, 0x31, 0xF3, 0x01, 0x63, 0xC4, 0xB4, + 0x31, 0xFB, 0x32, 0xFD, 0xBF, 0x60, 0xEB, 0x62, 0x42, 0x40, 0xA0, 0x4C, 0x40, 0xBC, 0x7D, 0xB4, + 0xA0, 0x51, 0xA0, 0xFE, 0x1A, 0xFF, 0x1E, 0x60, 0xE6, 0x64, 0x08, 0xF0, 0x07, 0xF0, 0xD0, 0x80, + 0x1E, 0x60, 0xEC, 0x62, 0x13, 0x02, 0xA2, 0xD3, 0x01, 0x63, 0xAC, 0x86, 0x07, 0xF2, 0x0E, 0x03, + 0xD0, 0x80, 0x09, 0xF2, 0xFA, 0x02, 0x23, 0xFC, 0x1E, 0x60, 0xF2, 0x64, 0x0F, 0x60, 0x8D, 0xFB, + 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x3C, 0x46, 0x06, 0x64, + 0xA1, 0xFF, 0x49, 0xFB, 0x83, 0x3E, 0x31, 0xF3, 0x87, 0x60, 0x80, 0x61, 0x1D, 0xF0, 0x60, 0x40, + 0x01, 0x2A, 0x0F, 0x00, 0xFE, 0xB4, 0x31, 0xFB, 0x00, 0x64, 0x49, 0xFB, 0x01, 0x64, 0x47, 0xFB, + 0x00, 0x71, 0x05, 0x64, 0x64, 0x5F, 0x0D, 0xFA, 0x40, 0x64, 0x3B, 0xDB, 0xC0, 0x60, 0x35, 0x78, + 0xFF, 0xFF, 0x02, 0x2A, 0x17, 0x00, 0xD1, 0x91, 0x8D, 0xE2, 0x41, 0x64, 0x3B, 0xDB, 0x31, 0xF3, + 0x2C, 0x60, 0x5E, 0x63, 0xFD, 0xB4, 0x31, 0xFB, 0xA3, 0xD3, 0x02, 0x63, 0x60, 0x5C, 0x0D, 0xF2, + 0x47, 0xFD, 0xFF, 0xB5, 0x60, 0x47, 0xD0, 0x80, 0xDC, 0x84, 0x1F, 0x03, 0x60, 0x47, 0xB4, 0x84, + 0x0D, 0xFA, 0x1B, 0x00, 0x08, 0x2A, 0x07, 0x00, 0x42, 0x64, 0x3B, 0xDB, 0x31, 0xF3, 0xFF, 0xFF, + 0xF7, 0xB4, 0x31, 0xFB, 0x12, 0x00, 0x10, 0x2A, 0x09, 0x00, 0x43, 0x64, 0x3B, 0xDB, 0x31, 0xF3, + 0xFF, 0xFF, 0xEF, 0xB4, 0x31, 0xFB, 0xBF, 0x60, 0xBB, 0x78, 0xFF, 0xFF, 0x44, 0x64, 0x3B, 0xDB, + 0x31, 0xF3, 0xFF, 0xFF, 0xDF, 0xB4, 0x31, 0xFB, 0x00, 0x00, 0x2A, 0x64, 0x3B, 0xDB, 0xB7, 0x60, + 0xA2, 0x64, 0x40, 0x40, 0xBD, 0x60, 0x7D, 0x78, 0xFF, 0xFF, 0x0A, 0x60, 0x80, 0xF3, 0xFF, 0xFF, + 0x02, 0xB5, 0x04, 0xB5, 0x04, 0x03, 0x03, 0x03, 0xC0, 0x60, 0xB8, 0x78, 0xFF, 0xFF, 0xF0, 0x60, + 0x58, 0x4E, 0x74, 0x78, 0xFF, 0xFF, 0x31, 0x40, 0x01, 0x2A, 0x28, 0x00, 0x9D, 0xFE, 0x26, 0x04, + 0x25, 0x0A, 0x9F, 0xFE, 0x23, 0x05, 0x85, 0xFF, 0x20, 0x44, 0x84, 0xFF, 0x40, 0x26, 0x1E, 0x00, + 0x3F, 0x40, 0x20, 0x2B, 0x1B, 0x00, 0x38, 0x69, 0xFF, 0xFF, 0x68, 0x44, 0x01, 0x16, 0xFD, 0x01, + 0x01, 0x2A, 0x14, 0x00, 0x13, 0x60, 0x09, 0xF3, 0xFF, 0xFF, 0xDC, 0x84, 0x00, 0x36, 0x00, 0x3B, + 0xA2, 0xDB, 0x64, 0xF1, 0x02, 0x60, 0xEE, 0x64, 0x81, 0xFB, 0xFF, 0xFF, 0x80, 0x60, 0x00, 0x64, + 0xB0, 0x84, 0x82, 0xFB, 0x04, 0x64, 0x83, 0xFB, 0xDF, 0xFE, 0x19, 0xFF, 0x10, 0x64, 0x3B, 0xDB, + 0x65, 0xF3, 0x73, 0x45, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x93, 0x74, 0xF1, 0xC9, 0xFE, + 0x64, 0x40, 0x01, 0x26, 0x3B, 0x00, 0x49, 0xF3, 0x3C, 0x46, 0x31, 0x18, 0xCC, 0x84, 0x49, 0xFB, + 0x2E, 0x02, 0xC1, 0x60, 0x6B, 0x64, 0x40, 0x42, 0xFC, 0xFC, 0x00, 0x64, 0x5C, 0x5C, 0x32, 0xFB, + 0x82, 0xFF, 0x5C, 0x47, 0x84, 0xFF, 0x62, 0xFF, 0x13, 0x60, 0x01, 0xF3, 0xFF, 0xFF, 0xDC, 0x84, + 0x00, 0x36, 0x00, 0x3B, 0xA2, 0xDB, 0x2A, 0xF2, 0x07, 0xF0, 0x0C, 0xB4, 0x08, 0x3A, 0x07, 0x00, + 0x66, 0x41, 0x64, 0x46, 0x06, 0xF0, 0xFF, 0x60, 0xDF, 0x64, 0xA0, 0x84, 0x06, 0xFA, 0x23, 0xF0, + 0x01, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0x1E, 0x60, 0xF2, 0x64, 0x0F, 0x60, 0x8D, 0xFB, 0x66, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0xCE, 0xFE, 0x06, 0x00, + 0x65, 0xF3, 0x73, 0x45, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x93, 0x14, 0x60, 0xFC, 0x63, + 0xA3, 0xD3, 0xAD, 0x49, 0x20, 0xB5, 0x08, 0xB1, 0x22, 0x03, 0xE1, 0x81, 0x10, 0xB5, 0x95, 0x81, + 0x60, 0x41, 0x18, 0x02, 0x14, 0x60, 0xFE, 0x7C, 0xA4, 0xD3, 0xFF, 0xFF, 0xCC, 0x84, 0xA4, 0xDB, + 0x16, 0x02, 0x0A, 0x64, 0xA4, 0xDB, 0x61, 0x44, 0x07, 0xB4, 0xFF, 0xFF, 0x10, 0x02, 0x08, 0xB1, + 0xE1, 0x81, 0x95, 0x81, 0xA3, 0xD3, 0x0B, 0x03, 0x08, 0xAC, 0x01, 0xBC, 0xA3, 0xDB, 0xFF, 0xFF, + 0x13, 0xFF, 0x05, 0x00, 0x10, 0xAC, 0xA3, 0xDB, 0x0A, 0x7C, 0x0A, 0x60, 0x7F, 0xF9, 0xB7, 0x60, + 0xAE, 0x78, 0xFF, 0xFF, 0x46, 0xF3, 0x45, 0xF1, 0x04, 0x1B, 0x64, 0x44, 0x02, 0x1B, 0x07, 0x60, + 0xF7, 0xF3, 0x45, 0xFB, 0x00, 0x63, 0x46, 0xFD, 0x60, 0x41, 0x25, 0x64, 0x3B, 0xDB, 0x27, 0x44, + 0xEF, 0xB4, 0x40, 0x47, 0x00, 0xB9, 0x71, 0x40, 0x80, 0x27, 0x01, 0x12, 0x19, 0x03, 0xC1, 0x60, + 0x0C, 0x62, 0x84, 0xFF, 0x42, 0x42, 0x82, 0xFF, 0xA0, 0x4C, 0x14, 0xBC, 0xFF, 0xB4, 0xA0, 0x51, + 0x1F, 0x0A, 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, 0x70, 0x44, 0xAC, 0x80, 0x19, 0x0A, 0x71, 0x40, + 0x80, 0x27, 0xF7, 0x12, 0x45, 0xF3, 0x27, 0x02, 0x03, 0x18, 0xCC, 0x84, 0x45, 0xFB, 0xF1, 0x02, + 0x06, 0x0A, 0xA0, 0x4C, 0xFB, 0xB4, 0xA0, 0x51, 0xA4, 0x60, 0xD7, 0x78, 0xFF, 0xFF, 0x84, 0xFF, + 0xC0, 0x60, 0xEA, 0x64, 0x40, 0x42, 0x82, 0xFF, 0xA0, 0x4C, 0x14, 0xBC, 0xFF, 0xB4, 0xA0, 0x51, + 0xAF, 0x60, 0x7B, 0x78, 0xFF, 0xFF, 0x3C, 0x44, 0xAC, 0x80, 0x32, 0xF1, 0x12, 0x03, 0x64, 0x40, + 0x07, 0x22, 0x0F, 0x00, 0xA4, 0x60, 0xB6, 0x78, 0xFF, 0xFF, 0xA0, 0x4C, 0x1C, 0xBC, 0xDF, 0xB4, + 0xA0, 0x51, 0xF1, 0x01, 0x06, 0x00, 0x28, 0x64, 0x3A, 0xDB, 0xA0, 0x4C, 0x30, 0xBC, 0xF3, 0xB4, + 0xA0, 0x51, 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, 0x28, 0x64, 0x3B, 0xDB, 0x07, 0x60, 0xF8, 0xF3, + 0x32, 0x40, 0x02, 0x27, 0x16, 0x00, 0x46, 0xFB, 0x14, 0x18, 0xC1, 0x60, 0x59, 0x64, 0x84, 0xFF, + 0x40, 0x42, 0x82, 0xFF, 0xA0, 0x4C, 0x15, 0xBC, 0xF7, 0xB4, 0xA0, 0x51, 0xA1, 0xFF, 0xFF, 0xFF, + 0x81, 0x3E, 0x70, 0x44, 0xAC, 0x80, 0x46, 0xF3, 0xCB, 0x0A, 0xDD, 0x02, 0xCC, 0x84, 0x46, 0xFB, + 0xF5, 0x02, 0x84, 0xFF, 0xC1, 0x60, 0x6B, 0x64, 0x40, 0x42, 0x82, 0xFF, 0x27, 0x44, 0x08, 0xBC, + 0x40, 0x47, 0xF9, 0xE1, 0x04, 0x00, 0x78, 0xE1, 0x31, 0x40, 0x01, 0x26, 0xF9, 0xE1, 0xA4, 0x60, + 0xAA, 0x78, 0xFF, 0xFF, 0x15, 0x60, 0xFB, 0xF1, 0x60, 0x45, 0x2C, 0x60, 0x0A, 0x61, 0xC5, 0x83, + 0xA3, 0xD3, 0xFF, 0xFF, 0x60, 0x41, 0x66, 0x45, 0x24, 0x46, 0x0E, 0xF2, 0x65, 0x46, 0x64, 0x45, + 0xD5, 0x81, 0x61, 0x45, 0x00, 0x7F, 0xD4, 0x80, 0x64, 0x43, 0x08, 0x04, 0xE3, 0x83, 0x63, 0x45, + 0xC5, 0x81, 0x61, 0x45, 0xD4, 0x80, 0x02, 0x65, 0x03, 0x07, 0x03, 0x00, 0x00, 0x65, 0x01, 0x00, + 0x01, 0x65, 0x2E, 0x58, 0xFF, 0xFF, 0x66, 0x43, 0x64, 0x46, 0x8F, 0xF0, 0x12, 0xF2, 0x91, 0xF2, + 0x60, 0x40, 0x10, 0x36, 0x05, 0x00, 0x12, 0x36, 0x08, 0x00, 0x0C, 0x36, 0x0B, 0x00, 0x0F, 0x00, + 0x40, 0x61, 0xA5, 0x80, 0x0A, 0x64, 0x13, 0x02, 0xF3, 0x01, 0x10, 0x61, 0xA5, 0x80, 0x0E, 0x64, + 0x0E, 0x02, 0xEE, 0x01, 0x08, 0x61, 0xA5, 0x80, 0x10, 0x64, 0x09, 0x02, 0xE9, 0x01, 0xE1, 0x81, + 0xA5, 0x80, 0x03, 0x05, 0xC8, 0x84, 0x03, 0x02, 0xE3, 0x01, 0xFF, 0x61, 0x02, 0x00, 0x12, 0xFA, + 0x91, 0xFA, 0x63, 0x46, 0x2E, 0x58, 0xFF, 0xFF, 0x8F, 0xF0, 0x12, 0xF2, 0x91, 0xF2, 0x60, 0x40, + 0x0A, 0x36, 0x05, 0x00, 0x0E, 0x36, 0x08, 0x00, 0x10, 0x36, 0x0B, 0x00, 0x0F, 0x00, 0x08, 0x61, + 0xA5, 0x80, 0x10, 0x7E, 0x11, 0x02, 0xF3, 0x01, 0x04, 0x61, 0xA5, 0x80, 0x12, 0x7E, 0x0C, 0x02, + 0xEE, 0x01, 0x20, 0x61, 0xA5, 0x80, 0x0C, 0x7E, 0x07, 0x02, 0xE9, 0x01, 0xE9, 0x81, 0xA5, 0x80, + 0x05, 0x05, 0xD8, 0x84, 0x01, 0x02, 0xE3, 0x01, 0x12, 0xFA, 0x91, 0xFA, 0x2E, 0x58, 0xFF, 0xFF, + 0x24, 0xE2, 0x2D, 0xF3, 0x2C, 0xF3, 0x00, 0xBD, 0xCC, 0x84, 0x08, 0x03, 0x2C, 0xFB, 0x06, 0x02, + 0x65, 0x44, 0x2C, 0xFB, 0x8A, 0xFF, 0x80, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x44, 0xF3, 0xFF, 0xFF, + 0xDC, 0x84, 0x44, 0xFB, 0x28, 0x60, 0x72, 0x65, 0x28, 0x60, 0x70, 0x61, 0xA5, 0xD3, 0xA1, 0xD3, + 0x11, 0x18, 0xCC, 0x84, 0xA1, 0xDB, 0x0E, 0x02, 0xA5, 0xD3, 0xA1, 0xDB, 0x14, 0x60, 0x3B, 0xF3, + 0x14, 0x60, 0x3A, 0xF1, 0xA2, 0xDB, 0xD0, 0x80, 0xFF, 0xFF, 0x04, 0x03, 0x8A, 0xFF, 0x20, 0x60, + 0x00, 0x75, 0x88, 0xFF, 0xD2, 0xF3, 0x31, 0x40, 0x01, 0x2A, 0x3D, 0x00, 0x60, 0x43, 0x04, 0xB0, + 0x02, 0xB0, 0x08, 0x24, 0x16, 0x02, 0x10, 0xB0, 0x29, 0x44, 0x34, 0x02, 0x00, 0xA8, 0xCC, 0x81, + 0x0D, 0x03, 0x41, 0x49, 0x2F, 0x02, 0x63, 0x40, 0x08, 0x2A, 0x08, 0x00, 0xF7, 0xB3, 0x18, 0x60, + 0x0A, 0xF1, 0xAD, 0x4F, 0xFD, 0xB4, 0xA0, 0x5D, 0x44, 0x49, 0x24, 0x00, 0x63, 0x40, 0x02, 0x2A, + 0x10, 0x00, 0x18, 0x60, 0x0B, 0xF3, 0x18, 0x60, 0x09, 0xFB, 0x40, 0x49, 0x18, 0x60, 0x0C, 0xF3, + 0x18, 0x60, 0x0A, 0xFB, 0x0C, 0xBB, 0xFD, 0xB3, 0xAD, 0x4F, 0x02, 0xBC, 0x00, 0x7F, 0xA0, 0x5D, + 0x11, 0x00, 0x18, 0x60, 0x0D, 0xF3, 0x30, 0x60, 0x12, 0x7C, 0x0C, 0x18, 0xA4, 0xDB, 0x40, 0x49, + 0x18, 0x60, 0x0E, 0xF3, 0x18, 0x60, 0x0A, 0xFB, 0x08, 0xBB, 0xFB, 0xB3, 0xAD, 0x4F, 0x02, 0xBC, + 0x00, 0x7F, 0xA0, 0x5D, 0xD2, 0xFD, 0x00, 0x60, 0x85, 0xF3, 0x62, 0x43, 0x17, 0x18, 0x58, 0xD3, + 0x62, 0x41, 0x03, 0x18, 0xCC, 0x84, 0xA1, 0xDB, 0x11, 0x00, 0x49, 0xD3, 0xA3, 0xDB, 0x06, 0xA1, + 0xA1, 0xD3, 0x59, 0xD1, 0x60, 0x45, 0xA5, 0xD3, 0x59, 0xD1, 0xB0, 0x84, 0xA5, 0xDB, 0x64, 0x44, + 0x06, 0x36, 0xCD, 0xFE, 0x07, 0x36, 0xD6, 0xFE, 0xE6, 0x01, 0x23, 0x46, 0xB7, 0x60, 0xAE, 0x78, + 0xFF, 0xFF, 0x46, 0x43, 0x1F, 0x60, 0x44, 0x61, 0xA1, 0xD3, 0x59, 0xD1, 0x06, 0x1B, 0x59, 0xD3, + 0x59, 0xD1, 0x03, 0x1B, 0x59, 0xD3, 0x59, 0xD1, 0xF0, 0x18, 0x00, 0x63, 0x49, 0xDD, 0x60, 0x40, + 0x02, 0x36, 0x11, 0x00, 0x03, 0x36, 0x32, 0x00, 0x01, 0x36, 0x08, 0x00, 0x05, 0x3A, 0xEA, 0x01, + 0xA4, 0xD3, 0x5A, 0xD3, 0x9C, 0x85, 0xA4, 0x84, 0xA2, 0xDB, 0xE4, 0x01, 0x01, 0x60, 0x0A, 0x61, + 0x00, 0x64, 0xA1, 0xDB, 0xDF, 0x01, 0xC2, 0x60, 0x8F, 0x64, 0x40, 0x45, 0x22, 0x00, 0x01, 0x60, + 0x0A, 0x66, 0xA6, 0xD3, 0x04, 0xA1, 0x60, 0x43, 0xA1, 0xD3, 0xC9, 0x81, 0x60, 0x45, 0x00, 0xBB, + 0xA1, 0xDB, 0xBE, 0xD3, 0x09, 0x03, 0xD4, 0x84, 0x9C, 0x84, 0xDC, 0x84, 0xFF, 0xFF, 0x04, 0x0E, + 0xA3, 0xD1, 0x63, 0x46, 0x64, 0x43, 0xF2, 0x01, 0x9C, 0x84, 0xDC, 0x85, 0x49, 0xDD, 0x61, 0x44, + 0x00, 0xBB, 0xA6, 0xDB, 0x02, 0x03, 0x65, 0x44, 0xBE, 0xDB, 0xBC, 0x01, 0xC2, 0x60, 0x6A, 0x64, + 0x40, 0x45, 0x01, 0x60, 0x0A, 0x66, 0xA6, 0xD3, 0xFF, 0xFF, 0xD0, 0x80, 0x0F, 0x18, 0x02, 0x03, + 0x60, 0x46, 0xF9, 0x01, 0x58, 0xD3, 0xA4, 0xD3, 0x60, 0x45, 0x00, 0x63, 0xA4, 0xDD, 0x05, 0x18, + 0x58, 0xD3, 0xFF, 0xFF, 0xC4, 0x83, 0xA2, 0xDD, 0xCA, 0x84, 0xA6, 0xDB, 0x25, 0x58, 0x64, 0x41, + 0x04, 0x60, 0x40, 0x62, 0x1A, 0x60, 0x58, 0x4D, 0xB4, 0x78, 0xFF, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, + 0x64, 0x40, 0x01, 0x2B, 0x50, 0x00, 0x28, 0x40, 0x08, 0x3A, 0x4D, 0x00, 0xE8, 0x84, 0xE8, 0x84, + 0xE8, 0x84, 0xE8, 0x84, 0x15, 0x60, 0xD5, 0xFB, 0x64, 0xF1, 0x24, 0x60, 0x88, 0x63, 0x64, 0x40, + 0x01, 0x27, 0x3C, 0xA3, 0x29, 0x40, 0x40, 0x2B, 0x1E, 0xA3, 0xBD, 0xD1, 0x63, 0x45, 0x44, 0x4E, + 0x0E, 0x61, 0xBD, 0xD1, 0xCD, 0x81, 0xD0, 0x80, 0x01, 0x03, 0xFB, 0x04, 0xCB, 0x83, 0x15, 0x60, + 0xD8, 0xF3, 0x39, 0xF1, 0xD7, 0x83, 0xEB, 0x83, 0x2E, 0x41, 0x5D, 0x93, 0xDF, 0x83, 0x15, 0x60, + 0xD4, 0xFD, 0x15, 0x60, 0xD3, 0xFB, 0x53, 0x93, 0xDF, 0x80, 0x10, 0x03, 0x38, 0xF3, 0xCF, 0x83, + 0x08, 0x03, 0xDF, 0x83, 0x0B, 0x02, 0xDF, 0x83, 0xDC, 0x84, 0xF0, 0xA0, 0x38, 0xFB, 0x06, 0x03, + 0x03, 0x00, 0xCC, 0x84, 0x38, 0xFB, 0x02, 0x03, 0x00, 0x63, 0x02, 0x00, 0x08, 0x64, 0x38, 0xFB, + 0xE3, 0x80, 0xFB, 0x83, 0xC3, 0x83, 0x63, 0x44, 0xFC, 0xA0, 0x02, 0x0E, 0x08, 0x07, 0x08, 0x00, + 0x04, 0xA4, 0xFF, 0xFF, 0x05, 0x0D, 0xFC, 0x64, 0xFF, 0x7F, 0x60, 0x43, 0x01, 0x00, 0x04, 0x63, + 0x39, 0xFD, 0x15, 0x60, 0xD7, 0xFD, 0x2F, 0x58, 0xFF, 0xFF, 0x15, 0x60, 0xD2, 0xF3, 0x40, 0x4E, + 0x60, 0x46, 0x2F, 0xDB, 0x44, 0x44, 0xA1, 0xD3, 0xD9, 0x81, 0x48, 0x94, 0x24, 0x5C, 0xD0, 0x9C, + 0x66, 0x42, 0x04, 0x06, 0xD2, 0x9C, 0x2F, 0xD9, 0x64, 0x46, 0x24, 0x44, 0xE0, 0x84, 0x44, 0xD3, + 0xA3, 0xDB, 0xFF, 0xB4, 0x60, 0x5C, 0x66, 0x44, 0x22, 0xA4, 0xD0, 0x84, 0xE0, 0xA0, 0x02, 0x0D, + 0x00, 0x64, 0x02, 0x00, 0x01, 0x04, 0x1F, 0x64, 0xA2, 0xD3, 0x60, 0x5C, 0x64, 0x5E, 0x60, 0x47, + 0x2F, 0xD1, 0x28, 0xA3, 0xA3, 0xD9, 0xD8, 0xA3, 0x2E, 0x42, 0x4E, 0x8E, 0xBD, 0xDB, 0xDB, 0x02, + 0x2D, 0x58, 0xFF, 0xFF, 0x43, 0xFF, 0x39, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x84, 0x3E, 0xFB, 0x01, + 0x3D, 0x44, 0x00, 0xA8, 0xFF, 0xFF, 0x03, 0x02, 0x40, 0xFF, 0x44, 0xFF, 0xF4, 0x01, 0xA0, 0x4C, + 0x3D, 0x46, 0x2A, 0xF2, 0x46, 0x4D, 0x10, 0x25, 0x12, 0x00, 0x09, 0xE1, 0xA1, 0xFF, 0x2D, 0x46, + 0x0F, 0xF2, 0x01, 0x29, 0x06, 0x00, 0x2A, 0xF0, 0x40, 0xFF, 0x64, 0x40, 0x40, 0x2B, 0x08, 0xBC, + 0x02, 0xBC, 0x0F, 0xFA, 0x08, 0x25, 0xDE, 0x01, 0xCB, 0xFE, 0x5C, 0x5D, 0xDC, 0x01, 0x44, 0xFF, + 0x03, 0x2B, 0x21, 0x00, 0x88, 0xF3, 0x06, 0x61, 0x60, 0x43, 0x66, 0x45, 0x31, 0xF0, 0x63, 0x46, + 0x05, 0xF2, 0x65, 0x46, 0xD0, 0x80, 0x30, 0xF0, 0x0F, 0x02, 0x63, 0x46, 0x04, 0xF2, 0x65, 0x46, + 0xD0, 0x80, 0x2F, 0xF0, 0x09, 0x02, 0x63, 0x46, 0x03, 0xF2, 0x65, 0x46, 0xD0, 0x80, 0xFF, 0xFF, + 0x03, 0x02, 0xFF, 0xFF, 0x48, 0xFE, 0x06, 0x00, 0xCD, 0x81, 0x02, 0xA3, 0xE7, 0x02, 0x87, 0xF1, + 0x08, 0xFE, 0x64, 0x43, 0x26, 0x03, 0x31, 0xF2, 0x15, 0x60, 0x02, 0x65, 0x60, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, + 0x31, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x30, 0xF0, 0x63, 0x46, + 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x2F, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, + 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0x87, 0xF3, 0x08, 0xFE, 0x60, 0x43, + 0x61, 0x46, 0x07, 0xFC, 0x3F, 0xF2, 0x09, 0x60, 0xB0, 0x65, 0xD4, 0x80, 0x2A, 0xF2, 0x9D, 0x05, + 0x08, 0x25, 0x88, 0x01, 0x5C, 0x4B, 0x0C, 0x60, 0xEC, 0x61, 0xA1, 0xDF, 0x2D, 0x46, 0x3B, 0xF2, + 0x87, 0xF1, 0x87, 0xF4, 0x60, 0x40, 0x20, 0x2B, 0xB7, 0x00, 0xD3, 0x80, 0x2C, 0xF0, 0x8D, 0x03, + 0x07, 0xF4, 0x64, 0x40, 0x01, 0x26, 0x87, 0xF5, 0xBA, 0xF4, 0x2D, 0x46, 0x04, 0x64, 0x04, 0xB3, + 0x22, 0xF0, 0x04, 0x03, 0xC5, 0x60, 0xBD, 0x78, 0xFF, 0xFF, 0xA6, 0x00, 0x10, 0x64, 0xB0, 0x9C, + 0x3B, 0xF2, 0x22, 0xF8, 0x60, 0x47, 0xC0, 0xB7, 0x02, 0xFE, 0xF0, 0x84, 0xF0, 0x84, 0xF0, 0x84, + 0x00, 0xA8, 0x40, 0x4A, 0x17, 0x03, 0xE0, 0x81, 0x61, 0x43, 0x42, 0xFE, 0x00, 0x64, 0xF0, 0x84, + 0xFE, 0x1F, 0x40, 0x4A, 0xE1, 0x84, 0xE0, 0x84, 0x2D, 0x46, 0x07, 0xF4, 0xE0, 0x81, 0x3B, 0xF0, + 0x2A, 0x47, 0x0C, 0x60, 0x3A, 0x63, 0xA0, 0x84, 0x47, 0x9C, 0x10, 0x03, 0x7C, 0x44, 0x00, 0x60, + 0xB2, 0x63, 0x14, 0x00, 0x07, 0xF4, 0x3B, 0xF0, 0x66, 0x44, 0x64, 0x40, 0x80, 0x2B, 0x06, 0x00, + 0x00, 0x60, 0x78, 0x7C, 0x00, 0x60, 0xA2, 0x63, 0x43, 0x4C, 0x08, 0x00, 0x2D, 0x46, 0xC5, 0x60, + 0xB0, 0x78, 0xFF, 0xFF, 0x2D, 0x46, 0xC5, 0x60, 0xB0, 0x78, 0xFF, 0xFF, 0xCE, 0xFB, 0xCF, 0xF9, + 0xD0, 0xFD, 0xAD, 0x46, 0x3D, 0xF2, 0xAD, 0x46, 0xA3, 0xD0, 0xAD, 0x46, 0xD0, 0x80, 0x3C, 0xF2, + 0xAD, 0x46, 0x02, 0x03, 0x15, 0x07, 0xEE, 0x04, 0x5B, 0xD0, 0xAD, 0x46, 0xD0, 0x80, 0x3A, 0xF2, + 0x03, 0x03, 0xAD, 0x46, 0x0D, 0x07, 0xE6, 0x04, 0x3A, 0xF0, 0xAD, 0x46, 0x5B, 0xD0, 0x64, 0x44, + 0xD0, 0x80, 0x2B, 0x44, 0x05, 0x07, 0xDE, 0x03, 0xD0, 0x84, 0x10, 0xA4, 0xFF, 0xFF, 0x00, 0x07, + 0xCF, 0xF3, 0xCE, 0xF5, 0xFE, 0xA4, 0x0F, 0x60, 0xC0, 0x61, 0x0E, 0x63, 0x58, 0xD0, 0x59, 0xD9, + 0xFD, 0x1F, 0x2D, 0x46, 0x8B, 0xFF, 0x2D, 0x46, 0x0F, 0x60, 0xB2, 0x64, 0xC9, 0x60, 0x58, 0x4F, + 0x10, 0x78, 0xFF, 0xFF, 0x3F, 0xF2, 0x00, 0x60, 0x18, 0x70, 0x18, 0x71, 0x20, 0x72, 0x60, 0x53, + 0x88, 0x75, 0x00, 0xF2, 0x09, 0xE1, 0x60, 0x50, 0x12, 0x71, 0x6E, 0x72, 0x83, 0x75, 0xA1, 0xFF, + 0xFF, 0xFF, 0x08, 0x25, 0x1F, 0x00, 0x40, 0xFF, 0x02, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x75, 0x40, + 0x03, 0x2A, 0x03, 0x00, 0x80, 0x75, 0x0A, 0x64, 0x0B, 0x00, 0x80, 0x75, 0x1B, 0xF3, 0x8B, 0xFF, + 0x02, 0x60, 0x00, 0x75, 0xFF, 0xFF, 0x02, 0x60, 0x00, 0x75, 0xDC, 0x84, 0xA2, 0xDB, 0x02, 0x64, + 0x98, 0xFF, 0x2D, 0x46, 0x0F, 0xF0, 0xFF, 0xFF, 0xB0, 0x84, 0xA2, 0xDA, 0x88, 0xFF, 0xC3, 0x60, + 0x74, 0x78, 0xFF, 0xFF, 0x8B, 0xFF, 0x02, 0x60, 0x00, 0x75, 0xFF, 0xFF, 0x02, 0x60, 0x00, 0x75, + 0x88, 0xFF, 0xC5, 0x60, 0x96, 0x78, 0xFF, 0xFF, 0x22, 0xF0, 0x22, 0x64, 0xB0, 0x84, 0x22, 0xFA, + 0x3A, 0xF0, 0xFF, 0xFF, 0x64, 0x44, 0xE0, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xE1, 0x7F, 0x5A, 0xD0, + 0xA0, 0x5B, 0x64, 0x44, 0xE2, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0x7C, 0x5F, 0xE8, 0x84, 0xE8, 0x85, + 0x0D, 0x60, 0x02, 0x64, 0x44, 0xD3, 0x5A, 0xD1, 0x03, 0x1B, 0xC5, 0x60, 0xB0, 0x78, 0xFF, 0xFF, + 0x60, 0x45, 0x64, 0x44, 0xE3, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xE4, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, + 0x64, 0x44, 0xE5, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xE6, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, 0x64, 0x44, + 0xE7, 0x7F, 0xA0, 0x5B, 0x65, 0x40, 0x0D, 0x3A, 0x1C, 0x00, 0x64, 0x47, 0xE8, 0x7F, 0x5A, 0xD1, + 0xA0, 0x5B, 0x64, 0x44, 0xE9, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xEA, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, + 0x64, 0x44, 0xEB, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xEC, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, 0x64, 0x44, + 0xED, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xEE, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, 0x64, 0x44, 0xEF, 0x7F, + 0xA0, 0x5B, 0x65, 0x44, 0xD8, 0x84, 0x08, 0x25, 0xB9, 0x00, 0x60, 0x7F, 0xA0, 0x5B, 0x80, 0x60, + 0x00, 0xEB, 0xA0, 0x60, 0x00, 0xEB, 0xD1, 0x60, 0x00, 0xEB, 0x3F, 0xF2, 0x3B, 0xF0, 0x60, 0x43, + 0xFC, 0xA4, 0x64, 0x40, 0x20, 0x2B, 0x03, 0x00, 0x08, 0xA4, 0x3F, 0xFA, 0x08, 0xA3, 0xF8, 0xA3, + 0x3F, 0xFA, 0x0A, 0xE1, 0xB3, 0xFF, 0x9A, 0xFF, 0xCB, 0x83, 0x00, 0xF4, 0x10, 0x62, 0x6C, 0x61, + 0x0E, 0xA3, 0xAB, 0x84, 0xF2, 0xA3, 0xA1, 0xFF, 0x08, 0x00, 0x00, 0xF4, 0x81, 0xF2, 0x6C, 0x18, + 0x02, 0x62, 0xC9, 0x81, 0xAB, 0x84, 0x01, 0x00, 0xA2, 0xDC, 0x7A, 0xD4, 0xFD, 0x1C, 0xA2, 0xDC, + 0x08, 0x25, 0x8C, 0x00, 0xF2, 0x1D, 0x41, 0x44, 0x7C, 0xA8, 0xD9, 0x81, 0xEE, 0x03, 0xFF, 0xB1, + 0x98, 0xFF, 0x09, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x08, 0x25, 0x80, 0x00, 0x40, 0xFF, 0x42, 0x42, + 0x46, 0x43, 0x06, 0x1E, 0x04, 0x02, 0x00, 0xF4, 0x02, 0x62, 0x42, 0x42, 0x46, 0x43, 0x01, 0xA2, + 0x63, 0x45, 0x01, 0xA2, 0x62, 0x43, 0x46, 0x4C, 0xC6, 0x60, 0x58, 0x4F, 0x4B, 0x78, 0xFF, 0xFF, + 0x0A, 0xE1, 0x9A, 0xFF, 0x24, 0x41, 0x02, 0xA1, 0x65, 0x43, 0x08, 0xA3, 0x23, 0x46, 0x22, 0x42, + 0x7E, 0x3A, 0x0A, 0x00, 0x00, 0xF4, 0x81, 0xF2, 0x37, 0x18, 0x02, 0x62, 0xC9, 0x81, 0xAB, 0x84, + 0x03, 0x00, 0xA2, 0xDC, 0x7E, 0x36, 0xF6, 0x01, 0x7A, 0xD4, 0xFF, 0xFF, 0xFA, 0x1C, 0xA2, 0xDC, + 0xF1, 0x1D, 0xD9, 0x81, 0xFF, 0xB1, 0x0B, 0x1E, 0x62, 0x40, 0x7E, 0x3A, 0x02, 0x00, 0x00, 0xF4, + 0x02, 0x62, 0x5A, 0xD2, 0x89, 0xFF, 0x80, 0x4F, 0x6F, 0x44, 0xA2, 0xDA, 0x88, 0xFF, 0x98, 0xFF, + 0x3D, 0x46, 0x0F, 0xF0, 0x0A, 0x64, 0xB0, 0x84, 0x18, 0x14, 0xF7, 0xB4, 0xA2, 0xDA, 0x06, 0x60, + 0x76, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, 0x0C, 0x00, 0xD1, 0xF5, 0xD0, 0xF4, 0x0C, 0x60, + 0xEC, 0x61, 0x59, 0xD1, 0x3B, 0xF8, 0x05, 0x64, 0x59, 0xD1, 0xCC, 0x84, 0xBD, 0xD8, 0xFC, 0x02, + 0x2D, 0x46, 0xC3, 0x60, 0x74, 0x78, 0xFF, 0xFF, 0x28, 0x00, 0xA2, 0xDA, 0x2D, 0x46, 0x3B, 0xF0, + 0xFF, 0xFF, 0x64, 0x40, 0x20, 0x2B, 0x1E, 0x00, 0x07, 0xF4, 0xBB, 0xF0, 0x2A, 0x44, 0xA4, 0x84, + 0xFF, 0xFF, 0x2F, 0x26, 0x16, 0x00, 0x2D, 0x46, 0x64, 0x44, 0x3A, 0xF0, 0xBC, 0xF0, 0x64, 0x5F, + 0x3D, 0xF0, 0x07, 0xF4, 0xD0, 0xF4, 0xFF, 0xFF, 0x08, 0xA3, 0x5B, 0xD8, 0x65, 0x5C, 0x5B, 0xD8, + 0x5B, 0xDA, 0x2D, 0x46, 0xCE, 0xF3, 0x3C, 0xFA, 0xCF, 0xF3, 0x3D, 0xFA, 0x2A, 0x44, 0x23, 0xFA, + 0x01, 0x00, 0x2D, 0x46, 0xC3, 0x60, 0x74, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0x98, 0xFF, 0x43, 0xFF, + 0x40, 0xFF, 0xB0, 0xFF, 0xB1, 0xFF, 0x2D, 0x46, 0x0C, 0x60, 0xEC, 0x61, 0xA1, 0xD3, 0x2D, 0x46, + 0x60, 0x40, 0x01, 0x2A, 0x0A, 0x00, 0xD1, 0xF5, 0xD0, 0xF4, 0x59, 0xD1, 0x3B, 0xF8, 0x05, 0x64, + 0x59, 0xD1, 0xCC, 0x84, 0xBD, 0xD8, 0xFC, 0x02, 0x2D, 0x46, 0xC3, 0x60, 0x53, 0x78, 0xFF, 0xFF, + 0x98, 0xFF, 0x09, 0xE1, 0xA1, 0xFF, 0x3D, 0x46, 0x08, 0x25, 0xE0, 0x01, 0x0F, 0xF2, 0x40, 0xFF, + 0x02, 0xBC, 0xA2, 0xDA, 0xC3, 0x60, 0x74, 0x78, 0xFF, 0xFF, 0xB0, 0x84, 0x22, 0xFA, 0x00, 0x63, + 0x3B, 0xF2, 0x06, 0x60, 0x76, 0xFD, 0x60, 0x47, 0xC0, 0xB7, 0x02, 0xFE, 0xF0, 0x84, 0xF0, 0x84, + 0xF0, 0x84, 0x00, 0xA8, 0x40, 0x4A, 0x16, 0x03, 0xE0, 0x81, 0x61, 0x43, 0x42, 0xFE, 0x00, 0x64, + 0xF0, 0x84, 0xFE, 0x1F, 0x40, 0x4A, 0xE1, 0x84, 0xE0, 0x84, 0x2D, 0x46, 0x07, 0xF4, 0xE0, 0x81, + 0x3B, 0xF0, 0x2A, 0x47, 0x0C, 0x60, 0x3A, 0x63, 0xA0, 0x84, 0x47, 0x9C, 0x10, 0x03, 0x7C, 0x44, + 0xA8, 0x63, 0x0F, 0x00, 0x07, 0xF4, 0x20, 0x64, 0x40, 0x4A, 0x3B, 0xF0, 0x66, 0x44, 0x64, 0x40, + 0x80, 0x2B, 0x05, 0x00, 0x00, 0x60, 0x78, 0x7C, 0x00, 0x60, 0x98, 0x63, 0x02, 0x00, 0x2D, 0x46, + 0xBF, 0x01, 0x2D, 0x46, 0xCE, 0xFB, 0xCF, 0xF9, 0xD0, 0xFD, 0x07, 0xF2, 0xD1, 0xFB, 0x60, 0x46, + 0x3B, 0xF0, 0x2A, 0x44, 0x06, 0x60, 0x77, 0xF9, 0x5C, 0x4B, 0xA0, 0x84, 0xFF, 0xFF, 0x3F, 0x22, + 0x05, 0x00, 0x90, 0x84, 0x3B, 0xFA, 0x01, 0x64, 0x40, 0x4B, 0x21, 0x00, 0xAD, 0x46, 0x0A, 0xA3, + 0x3D, 0xF2, 0xAD, 0x46, 0xA3, 0xD0, 0xAD, 0x46, 0xD0, 0x80, 0x3C, 0xF2, 0xAD, 0x46, 0x02, 0x03, + 0x16, 0x07, 0x14, 0x04, 0x5B, 0xD0, 0xAD, 0x46, 0xD0, 0x80, 0x3B, 0xF2, 0x03, 0x03, 0xAD, 0x46, + 0x0E, 0x07, 0x0C, 0x04, 0x3A, 0xF0, 0xAD, 0x46, 0x5B, 0xD0, 0x64, 0x5F, 0xD0, 0x80, 0x2B, 0x44, + 0x17, 0x07, 0x04, 0x03, 0xD0, 0x84, 0x10, 0xA4, 0xFF, 0xFF, 0x12, 0x07, 0x89, 0x01, 0x01, 0x64, + 0x06, 0x60, 0x76, 0xFB, 0x2D, 0x46, 0x0C, 0x60, 0xFC, 0x62, 0x80, 0xFF, 0x78, 0x44, 0x03, 0xA4, + 0xA2, 0xDB, 0xC6, 0x60, 0x76, 0x78, 0xFF, 0xFF, 0x85, 0xFF, 0x2D, 0x46, 0x08, 0x25, 0x5E, 0x01, + 0x2D, 0x46, 0x0C, 0x60, 0xFC, 0x62, 0x80, 0xFF, 0x78, 0x44, 0x03, 0xA4, 0xA2, 0xDB, 0xC6, 0x60, + 0xFE, 0x78, 0xFF, 0xFF, 0x85, 0xFF, 0x2D, 0x46, 0x08, 0x25, 0x50, 0x01, 0x00, 0x60, 0x0F, 0x64, + 0xC4, 0x60, 0xDB, 0x78, 0xFF, 0xFF, 0x2D, 0x46, 0x3B, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x20, 0x2B, + 0x23, 0x00, 0x00, 0xF4, 0x08, 0x61, 0x2D, 0x46, 0x00, 0xF4, 0x0A, 0x62, 0x56, 0x92, 0x5A, 0xD0, + 0x2C, 0x46, 0x64, 0x47, 0x63, 0x40, 0x7F, 0x2A, 0x03, 0x00, 0x00, 0xF4, 0x03, 0x63, 0x46, 0x4C, + 0x60, 0xFE, 0xDE, 0xD8, 0x7F, 0x3A, 0x03, 0x00, 0x00, 0xF4, 0x03, 0x63, 0x46, 0x4C, 0xDE, 0xDA, + 0xFE, 0xA1, 0x20, 0xFE, 0xE8, 0x02, 0x63, 0x41, 0xFD, 0xA1, 0x46, 0x4C, 0x01, 0xF2, 0x2D, 0x46, + 0x61, 0x5E, 0x16, 0xFA, 0x2C, 0x44, 0x06, 0xFA, 0x2F, 0x58, 0xFF, 0xFF, 0x07, 0xF4, 0x66, 0x41, + 0x03, 0xF2, 0x04, 0xF2, 0x40, 0x42, 0x05, 0xF2, 0x40, 0x43, 0x40, 0x44, 0x61, 0x46, 0x3C, 0xF2, + 0x3D, 0xF2, 0x40, 0x40, 0x40, 0x41, 0x0D, 0x60, 0x72, 0x65, 0x00, 0x61, 0xCF, 0xF1, 0xCE, 0xF5, + 0x44, 0x4C, 0x2C, 0x5C, 0xE9, 0x80, 0x00, 0x64, 0xF0, 0x84, 0xF0, 0x84, 0xC0, 0x83, 0xBD, 0xD2, + 0x24, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x20, 0x44, 0x40, 0x80, 0xDB, 0x83, 0xBD, 0xD2, + 0x20, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x21, 0x44, 0x40, 0x81, 0xDB, 0x83, 0xBD, 0xD2, + 0x21, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x22, 0x44, 0x40, 0x82, 0xDB, 0x83, 0xBD, 0xD2, + 0x22, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x23, 0x44, 0x40, 0x83, 0xF2, 0xA3, 0xBD, 0xD2, + 0x23, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x24, 0x44, 0xC0, 0x9C, 0x41, 0x84, 0xDD, 0x81, + 0x08, 0x2A, 0xA7, 0x01, 0x0C, 0x60, 0xEE, 0x61, 0x05, 0x64, 0xD0, 0xF4, 0xD1, 0xF5, 0xFE, 0xA3, + 0x5B, 0xD0, 0xCC, 0x84, 0x59, 0xD9, 0xFC, 0x02, 0xD0, 0xF3, 0xD1, 0xF5, 0x60, 0x42, 0x20, 0x44, + 0xA2, 0xDA, 0x21, 0x44, 0x5A, 0xDA, 0x22, 0x44, 0x5A, 0xDA, 0x23, 0x44, 0x5A, 0xDA, 0x24, 0x44, + 0x5A, 0xDA, 0x61, 0x46, 0x06, 0x60, 0x7E, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0x66, 0x41, 0xD0, 0xF3, + 0xD1, 0xF5, 0xA0, 0xD2, 0x5A, 0xD0, 0x40, 0x40, 0x44, 0x41, 0x5A, 0xD2, 0x5A, 0xD0, 0x40, 0x42, + 0x5A, 0xD0, 0x44, 0x43, 0x61, 0x46, 0xBA, 0xF0, 0x3B, 0xF2, 0x44, 0x44, 0x65, 0x5F, 0x40, 0x85, + 0xCF, 0xF4, 0xCE, 0xF5, 0x43, 0x4C, 0x0D, 0x60, 0x72, 0x65, 0xBD, 0xD2, 0x25, 0x5C, 0x90, 0x9C, + 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x47, 0x90, 0x9C, 0x20, 0x44, 0x40, 0x80, 0xBD, 0xD2, 0x20, 0x5C, 0x90, 0x9C, 0x64, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, + 0x90, 0x9C, 0x21, 0x44, 0x40, 0x81, 0xBD, 0xD2, 0x21, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x22, 0x44, 0x40, 0x82, 0xBD, 0xD2, 0x22, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, + 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x23, 0x44, + 0x40, 0x83, 0xBD, 0xD2, 0x23, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x24, 0x44, 0x40, 0x84, + 0xBD, 0xD2, 0x24, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x25, 0x44, 0x40, 0x85, 0x61, 0x46, + 0x3A, 0xF0, 0xFF, 0xFF, 0x64, 0x44, 0xE0, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xE1, 0x7F, 0x5A, 0xD0, + 0xA0, 0x5B, 0x64, 0x44, 0xE2, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xCE, 0xF5, 0xBD, 0xD2, 0x25, 0x5C, + 0x90, 0x84, 0xE8, 0x80, 0xF8, 0x84, 0x20, 0x5C, 0x40, 0x80, 0x20, 0x44, 0xE4, 0x7F, 0xA0, 0x5B, + 0x20, 0x47, 0xE5, 0x7F, 0xA0, 0x5B, 0xBD, 0xD2, 0x20, 0x5C, 0x90, 0x84, 0xE8, 0x80, 0xF8, 0x84, + 0x21, 0x5C, 0x40, 0x81, 0x21, 0x44, 0xE6, 0x7F, 0xA0, 0x5B, 0x21, 0x47, 0xE7, 0x7F, 0xA0, 0x5B, + 0x21, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x22, 0x5C, 0x40, 0x82, 0x22, 0x44, 0xE8, 0x7F, 0xA0, 0x5B, + 0x22, 0x47, 0xE9, 0x7F, 0xA0, 0x5B, 0x22, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x23, 0x5C, 0x40, 0x83, + 0x23, 0x44, 0xEA, 0x7F, 0xA0, 0x5B, 0x23, 0x47, 0xEB, 0x7F, 0xA0, 0x5B, 0x23, 0x44, 0xE8, 0x80, + 0xF8, 0x84, 0x24, 0x5C, 0x40, 0x84, 0x24, 0x44, 0xEC, 0x7F, 0xA0, 0x5B, 0x24, 0x47, 0xED, 0x7F, + 0xA0, 0x5B, 0x24, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x25, 0x5C, 0x40, 0x85, 0x25, 0x44, 0xEE, 0x7F, + 0xA0, 0x5B, 0x25, 0x47, 0xEF, 0x7F, 0xA0, 0x5B, 0x2C, 0x43, 0xA3, 0xD2, 0x25, 0x5C, 0x90, 0x81, + 0xE9, 0x84, 0xE3, 0x7F, 0xA0, 0x5B, 0x06, 0x60, 0x7E, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0xCB, 0xF3, + 0x5A, 0xD3, 0x40, 0x48, 0x5A, 0xD3, 0x40, 0x49, 0x40, 0x4A, 0x00, 0x60, 0x78, 0x7C, 0x44, 0x4D, + 0x49, 0xF2, 0x4A, 0xF2, 0x40, 0x47, 0x40, 0x46, 0x0D, 0x60, 0x72, 0x65, 0x00, 0x61, 0x2D, 0x5C, + 0xE9, 0x80, 0x00, 0x64, 0xF0, 0x84, 0xF0, 0x84, 0xC0, 0x83, 0xBD, 0xD2, 0x2A, 0x5C, 0x90, 0x9C, + 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x47, 0x90, 0x9C, 0x26, 0x44, 0x40, 0x86, 0xDB, 0x83, 0xBD, 0xD2, 0x26, 0x5C, 0x90, 0x9C, + 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x47, 0x90, 0x9C, 0x27, 0x44, 0x40, 0x87, 0xDB, 0x83, 0xBD, 0xD2, 0x27, 0x5C, 0x90, 0x9C, + 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x47, 0x90, 0x9C, 0x28, 0x44, 0x40, 0x88, 0xDB, 0x83, 0xBD, 0xD2, 0x28, 0x5C, 0x90, 0x9C, + 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x47, 0x90, 0x9C, 0x29, 0x44, 0x40, 0x89, 0xF2, 0xA3, 0xBD, 0xD2, 0x29, 0x5C, 0x90, 0x9C, + 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x47, 0x90, 0x9C, 0x2A, 0x44, 0xC0, 0x9C, 0x41, 0x8A, 0xDD, 0x81, 0x08, 0x2A, 0xA7, 0x01, + 0x26, 0x44, 0x44, 0xFA, 0x27, 0x44, 0x45, 0xFA, 0x28, 0x44, 0x46, 0xFA, 0x29, 0x44, 0x47, 0xFA, + 0x2A, 0x44, 0x48, 0xFA, 0x06, 0x60, 0x7F, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x60, 0x88, 0x7C, + 0x44, 0x4D, 0x2D, 0x42, 0xA2, 0xD2, 0x5A, 0xD0, 0x40, 0x46, 0x44, 0x47, 0x5A, 0xD2, 0x5A, 0xD0, + 0x40, 0x48, 0x5A, 0xD0, 0x44, 0x49, 0x4B, 0xF2, 0x44, 0x4A, 0x40, 0x8B, 0x60, 0x5C, 0x64, 0x47, + 0xE0, 0x7F, 0xA0, 0x5A, 0xFF, 0xB4, 0x20, 0xBC, 0x7F, 0xB4, 0xE1, 0x7F, 0xA0, 0x5A, 0x64, 0x44, + 0xE2, 0x7F, 0xA0, 0x5A, 0x00, 0x60, 0x78, 0x63, 0x0D, 0x60, 0x72, 0x65, 0xBD, 0xD2, 0x2B, 0x5C, + 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, + 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x26, 0x44, 0x40, 0x86, 0xBD, 0xD2, 0x26, 0x5C, 0x90, 0x9C, + 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x47, 0x90, 0x9C, 0x27, 0x44, 0x40, 0x87, 0xBD, 0xD2, 0x27, 0x5C, 0x90, 0x9C, 0x64, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, + 0x90, 0x9C, 0x28, 0x44, 0x40, 0x88, 0xBD, 0xD2, 0x28, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x29, 0x44, 0x40, 0x89, 0xBD, 0xD2, 0x29, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, + 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x2A, 0x44, + 0x40, 0x8A, 0xBD, 0xD2, 0x2A, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x2B, 0x44, 0x40, 0x8B, + 0xBD, 0xD2, 0x2B, 0x5C, 0x90, 0x84, 0xE8, 0x80, 0xF8, 0x84, 0x26, 0x5C, 0x40, 0x86, 0x26, 0x44, + 0xE4, 0x7F, 0xA0, 0x5A, 0x26, 0x47, 0xE5, 0x7F, 0xA0, 0x5A, 0xBD, 0xD2, 0x26, 0x5C, 0x90, 0x84, + 0xE8, 0x80, 0xF8, 0x84, 0x27, 0x5C, 0x40, 0x87, 0x27, 0x44, 0xE6, 0x7F, 0xA0, 0x5A, 0x27, 0x47, + 0xE7, 0x7F, 0xA0, 0x5A, 0x27, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x28, 0x5C, 0x40, 0x88, 0x28, 0x44, + 0xE8, 0x7F, 0xA0, 0x5A, 0x28, 0x47, 0xE9, 0x7F, 0xA0, 0x5A, 0x28, 0x44, 0xE8, 0x80, 0xF8, 0x84, + 0x29, 0x5C, 0x40, 0x89, 0x29, 0x44, 0xEA, 0x7F, 0xA0, 0x5A, 0x29, 0x47, 0xEB, 0x7F, 0xA0, 0x5A, + 0x29, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x2A, 0x5C, 0x40, 0x8A, 0x2A, 0x44, 0xEC, 0x7F, 0xA0, 0x5A, + 0x2A, 0x47, 0xED, 0x7F, 0xA0, 0x5A, 0x2A, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x2B, 0x5C, 0x40, 0x8B, + 0x2B, 0x44, 0xEE, 0x7F, 0xA0, 0x5A, 0x2B, 0x47, 0xEF, 0x7F, 0xA0, 0x5A, 0x3C, 0xF0, 0x2B, 0x44, + 0x90, 0x84, 0xE8, 0x84, 0xE3, 0x7F, 0xA0, 0x5A, 0x06, 0x60, 0x7F, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, + 0x60, 0x45, 0x00, 0xF0, 0x84, 0x60, 0x00, 0xE3, 0x04, 0x71, 0x64, 0x50, 0x01, 0x2A, 0x04, 0x71, + 0x5C, 0x61, 0x04, 0x63, 0x59, 0xD0, 0x58, 0xD9, 0xFD, 0x1F, 0x3D, 0xF2, 0x60, 0x43, 0x60, 0x47, + 0x5B, 0xDB, 0x3C, 0xF2, 0xFF, 0xFF, 0x60, 0x47, 0x5B, 0xDB, 0x3A, 0xF2, 0xFF, 0xFF, 0x60, 0x47, + 0x5B, 0xDB, 0x3F, 0xF2, 0xFF, 0xFF, 0x60, 0x47, 0x5B, 0xDB, 0x81, 0x60, 0x18, 0xE3, 0x65, 0x43, + 0xE3, 0x84, 0x60, 0x47, 0x00, 0x7F, 0x60, 0x50, 0x7F, 0x64, 0x23, 0x94, 0x60, 0x51, 0x7C, 0x72, + 0x04, 0x75, 0x0C, 0x60, 0x16, 0x61, 0x16, 0x60, 0x00, 0x63, 0x59, 0xDD, 0x2A, 0xF2, 0x87, 0x60, + 0x8F, 0x65, 0xA4, 0x87, 0x40, 0xBF, 0x59, 0xDB, 0x56, 0x64, 0x0A, 0x63, 0x58, 0xD0, 0x59, 0xD9, + 0xFD, 0x1F, 0x62, 0x64, 0x04, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x35, 0xF2, 0x0F, 0x65, + 0xA4, 0x9C, 0x59, 0xD9, 0x06, 0x63, 0x59, 0xDF, 0xFE, 0x1F, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x45, + 0x03, 0x2B, 0x05, 0x00, 0x6A, 0x64, 0x04, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x65, 0x40, + 0x8F, 0xB0, 0x88, 0x3A, 0x02, 0x00, 0x39, 0xF0, 0x59, 0xD9, 0x2F, 0x58, 0xFF, 0xFF, 0x0C, 0x60, + 0x16, 0x61, 0xA3, 0x46, 0x00, 0xF4, 0x02, 0x64, 0x0A, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, + 0x59, 0xDF, 0x59, 0xDF, 0xA0, 0x4C, 0x04, 0xBC, 0xFF, 0xB4, 0xA0, 0x51, 0x23, 0x44, 0x01, 0xA7, + 0x80, 0xBF, 0x60, 0x50, 0x80, 0x60, 0x38, 0x71, 0x80, 0x60, 0x7C, 0x72, 0x01, 0x76, 0xFF, 0xFF, + 0x76, 0x44, 0x01, 0x3A, 0xFD, 0x01, 0x40, 0x76, 0x42, 0xFF, 0xFF, 0xFF, 0x40, 0x76, 0x80, 0x60, + 0x18, 0x70, 0x80, 0x60, 0x18, 0x71, 0x80, 0x60, 0x7C, 0x72, 0x80, 0x60, 0x10, 0x73, 0x02, 0x76, + 0x76, 0x44, 0xFF, 0xFF, 0x76, 0x44, 0x02, 0x3A, 0xFD, 0x01, 0x40, 0x76, 0x42, 0xFF, 0x3C, 0x46, + 0x00, 0xF2, 0x80, 0x60, 0x00, 0xBC, 0x60, 0x50, 0x80, 0x60, 0x12, 0x71, 0x80, 0x60, 0x6E, 0x72, + 0x3F, 0xF2, 0xFF, 0xFF, 0xF8, 0xA7, 0x80, 0xBF, 0x60, 0x53, 0x04, 0x76, 0xFF, 0xFF, 0x88, 0xFF, + 0x3C, 0x46, 0x07, 0xF2, 0xFF, 0xFF, 0x40, 0x43, 0xA3, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x77, 0x40, + 0x8B, 0xFF, 0xA0, 0x4C, 0x04, 0xE1, 0xFF, 0xFF, 0x76, 0x44, 0x04, 0x3A, 0xFD, 0x01, 0x40, 0x76, + 0x42, 0xFF, 0xFF, 0xFF, 0x10, 0x76, 0xFF, 0xFF, 0x76, 0x44, 0x20, 0x3A, 0xFD, 0x01, 0x40, 0x76, + 0x42, 0xFF, 0xA0, 0x48, 0x00, 0x7F, 0xA0, 0x51, 0x02, 0x60, 0x00, 0x75, 0x88, 0xFF, 0xA0, 0x4C, + 0xFB, 0xB4, 0xA0, 0x51, 0x06, 0x60, 0x1F, 0xE1, 0x16, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0x26, 0x46, + 0x3F, 0xF2, 0xFF, 0xFF, 0xF8, 0xA4, 0x3F, 0xFA, 0x00, 0xF4, 0x60, 0x47, 0x08, 0xFA, 0xA0, 0x48, + 0x08, 0x26, 0x07, 0x00, 0xA0, 0x4C, 0x04, 0xE1, 0xFF, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x00, 0x7F, + 0xA0, 0x51, 0x42, 0xFF, 0x26, 0x46, 0x8B, 0xFF, 0x02, 0x60, 0x00, 0x75, 0x3C, 0xF2, 0x40, 0x76, + 0x14, 0x1B, 0x26, 0x46, 0x3B, 0xF2, 0x0C, 0x60, 0xBC, 0x63, 0x60, 0x47, 0xC0, 0xB4, 0xE8, 0x84, + 0xE8, 0x84, 0xE8, 0x84, 0x43, 0x93, 0xE3, 0x9C, 0x64, 0x47, 0x80, 0x7C, 0x64, 0x5F, 0x60, 0x50, + 0x7F, 0x64, 0x23, 0x97, 0x80, 0xBF, 0x60, 0x51, 0x07, 0x00, 0x01, 0xA7, 0x80, 0xBF, 0x60, 0x50, + 0x80, 0x60, 0x40, 0x71, 0x80, 0x60, 0x7C, 0x72, 0x01, 0x76, 0xFF, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, + 0x0C, 0x21, 0xFC, 0x01, 0x04, 0x25, 0xD5, 0x01, 0x40, 0x76, 0x43, 0xFF, 0x0C, 0x60, 0x22, 0x61, + 0x26, 0x46, 0x00, 0xF4, 0x02, 0x64, 0x0A, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x59, 0xDF, + 0x59, 0xDF, 0x80, 0x60, 0x18, 0x70, 0x80, 0x60, 0x24, 0x71, 0x80, 0x60, 0x7C, 0x72, 0x80, 0x60, + 0x10, 0x73, 0x02, 0x76, 0xFF, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x0C, 0x21, 0xFC, 0x01, 0x04, 0x25, + 0xB8, 0x01, 0x40, 0x76, 0x43, 0xFF, 0x26, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0x60, 0x47, 0x80, 0xBF, + 0x60, 0x50, 0x80, 0x60, 0x12, 0x71, 0x3F, 0xF2, 0x80, 0x60, 0x6E, 0x72, 0x60, 0x47, 0x80, 0xBF, + 0x60, 0x53, 0x04, 0x76, 0xFF, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x0C, 0x21, 0xFC, 0x01, 0x04, 0x25, + 0xA0, 0x01, 0x40, 0x76, 0x43, 0xFF, 0x08, 0x76, 0xFF, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x0C, 0x21, + 0xFC, 0x01, 0x04, 0x25, 0x96, 0x01, 0x76, 0x5C, 0xFF, 0xFF, 0x40, 0x76, 0x43, 0xFF, 0x88, 0xFF, + 0x26, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0xDF, 0x60, 0x2A, 0x78, 0xFF, 0xFF, 0x08, 0x60, 0x11, 0xF1, + 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x20, 0x00, 0x74, 0xF3, 0x31, 0x40, + 0x01, 0x2A, 0x1C, 0x00, 0xDC, 0x84, 0x01, 0xB4, 0x74, 0xFB, 0x08, 0x02, 0x08, 0x60, 0x12, 0xF1, + 0x00, 0x60, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x10, 0x00, 0x08, 0x60, 0x18, 0xF1, + 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x08, 0x00, 0xA9, 0xFE, 0xE6, 0x05, + 0xAB, 0xFE, 0x07, 0x05, 0xA8, 0xFE, 0xD7, 0x05, 0xAA, 0xFE, 0xD8, 0x05, 0xA1, 0xFF, 0xFF, 0xFF, + 0x85, 0x3E, 0x0F, 0x60, 0x85, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x03, 0x02, 0xCA, 0x60, + 0x7E, 0x78, 0xFF, 0xFF, 0x26, 0x45, 0xD4, 0x80, 0x0F, 0xF0, 0xF9, 0x03, 0x64, 0x44, 0x70, 0xB0, + 0x70, 0x2A, 0x13, 0x00, 0x13, 0x60, 0x08, 0xF3, 0xFF, 0xFF, 0xDC, 0x84, 0x00, 0x36, 0x00, 0x3B, + 0xA2, 0xDB, 0xA2, 0xFF, 0x8E, 0xF3, 0xFF, 0xFF, 0xCC, 0x84, 0xFE, 0xA0, 0x8E, 0xFB, 0x01, 0x07, + 0xD4, 0xFE, 0xA3, 0xFF, 0xCE, 0x60, 0x38, 0x78, 0xFF, 0xFF, 0x64, 0x40, 0x02, 0x26, 0x09, 0x00, + 0x66, 0x45, 0x09, 0xF4, 0x0F, 0xF2, 0x02, 0x18, 0x65, 0x46, 0xE4, 0x1B, 0x00, 0x64, 0x40, 0x46, + 0xCD, 0x01, 0xA2, 0xFF, 0x8E, 0xF3, 0x46, 0x46, 0xCC, 0x84, 0xFE, 0xA0, 0x8E, 0xFB, 0x01, 0x07, + 0xD4, 0xFE, 0xA3, 0xFF, 0x0F, 0xF0, 0xA3, 0xFC, 0x64, 0x44, 0x80, 0x26, 0x17, 0x00, 0x25, 0x60, + 0xF0, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xC7, 0x78, 0x97, 0xF1, 0x32, 0x44, 0x01, 0x2A, 0x03, 0x00, + 0x07, 0x60, 0x01, 0x64, 0x04, 0x00, 0x02, 0x2A, 0x06, 0x00, 0x00, 0x60, 0x01, 0x64, 0x23, 0xFA, + 0xCE, 0x60, 0x44, 0x78, 0xFF, 0xFF, 0xCE, 0x60, 0x38, 0x78, 0xFF, 0xFF, 0x0F, 0xF0, 0xFF, 0xFF, + 0x64, 0x44, 0x08, 0x26, 0x34, 0x00, 0x2A, 0xF2, 0x60, 0x63, 0x60, 0x40, 0x02, 0x2B, 0x66, 0x63, + 0xBE, 0xD2, 0x68, 0xF1, 0xA3, 0xD2, 0xD0, 0x80, 0x67, 0xF1, 0x0D, 0x02, 0xBF, 0xD2, 0xD0, 0x80, + 0x66, 0xF1, 0x09, 0x02, 0xD0, 0x80, 0xFF, 0xFF, 0x06, 0x02, 0x25, 0x60, 0xFC, 0x64, 0xE5, 0x60, + 0x78, 0x41, 0xC7, 0x78, 0x97, 0xF1, 0x32, 0x44, 0x01, 0x2A, 0x03, 0x00, 0x07, 0x60, 0x02, 0x64, + 0x04, 0x00, 0x02, 0x2A, 0x06, 0x00, 0x00, 0x60, 0x02, 0x64, 0x23, 0xFA, 0xCE, 0x60, 0x44, 0x78, + 0xFF, 0xFF, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0xB0, 0x3A, 0x06, 0x00, 0x00, 0x60, 0x02, 0x64, + 0x23, 0xFA, 0xCB, 0x60, 0x9D, 0x78, 0xFF, 0xFF, 0xCE, 0x60, 0x38, 0x78, 0xFF, 0xFF, 0x32, 0x44, + 0x01, 0x2A, 0x4A, 0x00, 0x27, 0x60, 0x6A, 0x63, 0xBF, 0xD3, 0x00, 0x65, 0xB4, 0x81, 0xDB, 0x83, + 0x3D, 0x03, 0xBF, 0xD3, 0xA3, 0xD3, 0x40, 0x48, 0xBE, 0xD3, 0x40, 0x4A, 0x2E, 0xF0, 0x40, 0x4C, + 0xD0, 0x80, 0x2D, 0xF0, 0x08, 0x02, 0x2A, 0x44, 0xD0, 0x80, 0x2C, 0xF0, 0x04, 0x02, 0x28, 0x44, + 0xD0, 0x80, 0xFF, 0xFF, 0x2B, 0x03, 0x31, 0xF0, 0x2C, 0x44, 0xD0, 0x80, 0x30, 0xF0, 0x08, 0x02, + 0x2A, 0x44, 0xD0, 0x80, 0x2F, 0xF0, 0x04, 0x02, 0x28, 0x44, 0xD0, 0x80, 0xFF, 0xFF, 0x1E, 0x03, + 0x34, 0xF0, 0x2C, 0x44, 0xD0, 0x80, 0x33, 0xF0, 0x08, 0x02, 0x2A, 0x44, 0xD0, 0x80, 0x32, 0xF0, + 0x04, 0x02, 0x28, 0x44, 0xD0, 0x80, 0xFF, 0xFF, 0x11, 0x03, 0x38, 0xF0, 0x2C, 0x44, 0xD0, 0x80, + 0x37, 0xF0, 0x08, 0x02, 0x2A, 0x44, 0xD0, 0x80, 0x36, 0xF0, 0x04, 0x02, 0x28, 0x44, 0xD0, 0x80, + 0xFF, 0xFF, 0x04, 0x03, 0xFA, 0xA1, 0x06, 0xA3, 0xB7, 0x03, 0xC3, 0x01, 0x07, 0x60, 0x00, 0x64, + 0x23, 0xFA, 0xCE, 0x60, 0x44, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0x0F, 0xF0, 0x60, 0x45, 0xA4, 0x36, + 0x08, 0x00, 0x0C, 0xB4, 0x04, 0x36, 0x02, 0x00, 0x0C, 0x3A, 0x06, 0x00, 0xCE, 0x60, 0x38, 0x78, + 0xFF, 0xFF, 0xCC, 0x60, 0x35, 0x78, 0xFF, 0xFF, 0x26, 0xF2, 0x50, 0xF1, 0x60, 0x47, 0x00, 0x7E, + 0xD0, 0x84, 0x1F, 0xA4, 0x06, 0x0E, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, + 0x07, 0x00, 0xC2, 0xA4, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x87, 0xF8, 0xBF, + 0xC0, 0x84, 0xA2, 0xDB, 0x0F, 0xF0, 0x65, 0x40, 0x40, 0x2B, 0x17, 0x00, 0x32, 0x40, 0x08, 0x26, + 0x14, 0x00, 0x07, 0xF4, 0x3A, 0xF2, 0xFF, 0xFF, 0x37, 0xB4, 0x26, 0x46, 0x0E, 0x02, 0x2C, 0xF2, + 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x26, 0x06, 0x00, 0x25, 0x60, 0xF6, 0x64, 0xE5, 0x60, 0x78, 0x41, + 0xC7, 0x78, 0x97, 0xF1, 0xCE, 0x60, 0x38, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0x64, 0x40, 0x60, 0x26, + 0x03, 0x00, 0xCC, 0x60, 0x0D, 0x78, 0xFF, 0xFF, 0x60, 0x40, 0x40, 0x3A, 0xF3, 0x01, 0x25, 0x60, + 0xEA, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xC7, 0x78, 0x97, 0xF1, 0x27, 0xF2, 0xFF, 0xFF, 0x60, 0x40, + 0x01, 0x3B, 0x07, 0x00, 0x25, 0x60, 0xF8, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xC7, 0x78, 0x97, 0xF1, + 0x08, 0x00, 0x02, 0x3B, 0x06, 0x00, 0x25, 0x60, 0xFA, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xC7, 0x78, + 0x97, 0xF1, 0x2A, 0xF2, 0x28, 0x41, 0x40, 0xA8, 0x01, 0xB1, 0x02, 0x02, 0x43, 0x02, 0x6D, 0x00, + 0x60, 0x40, 0x08, 0x2A, 0x0F, 0x00, 0x25, 0x60, 0xE8, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xC7, 0x78, + 0x97, 0xF1, 0x1B, 0xF2, 0xFF, 0xFF, 0x60, 0x45, 0x25, 0x60, 0xEE, 0x64, 0xE5, 0x60, 0x78, 0x41, + 0xD3, 0x78, 0x97, 0xF1, 0x0F, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x40, 0x26, 0x28, 0x00, 0x32, 0x44, + 0x02, 0x26, 0x25, 0x00, 0x10, 0x2B, 0x26, 0x00, 0x27, 0x60, 0x6A, 0x63, 0xBF, 0xD3, 0x2C, 0xF0, + 0x00, 0xA8, 0x60, 0x41, 0x0D, 0x03, 0x50, 0xFE, 0xBD, 0xD3, 0x2D, 0xF0, 0xD0, 0x80, 0xBD, 0xD3, + 0x2E, 0xF0, 0xD0, 0x80, 0xBD, 0xD3, 0x2C, 0xF0, 0xD0, 0x80, 0xFA, 0xA1, 0x10, 0x0C, 0xF3, 0x02, + 0x50, 0xFE, 0x60, 0x60, 0x01, 0x64, 0xD0, 0x80, 0x2D, 0xF0, 0x1D, 0x64, 0xD0, 0x80, 0x2E, 0xF0, + 0x01, 0x64, 0xD0, 0x80, 0xFF, 0xFF, 0x03, 0x0C, 0xCE, 0x60, 0x38, 0x78, 0xFF, 0xFF, 0x32, 0x40, + 0x40, 0x2A, 0x00, 0x00, 0xCD, 0x60, 0xEE, 0x78, 0xFF, 0xFF, 0x32, 0x40, 0x40, 0x26, 0xFA, 0x01, + 0x2A, 0xF0, 0xFF, 0xFF, 0x64, 0x40, 0x08, 0x2A, 0x20, 0x00, 0x32, 0x40, 0x02, 0x2A, 0x1D, 0x00, + 0x03, 0x67, 0xA0, 0x84, 0x00, 0x37, 0x64, 0x63, 0x60, 0x40, 0x02, 0x37, 0x5E, 0x63, 0x60, 0x40, + 0x01, 0x37, 0x58, 0x63, 0x60, 0x40, 0x03, 0x37, 0x0D, 0x00, 0xBD, 0xD2, 0x66, 0xF1, 0xBD, 0xD2, + 0xD0, 0x80, 0x67, 0xF1, 0x07, 0x02, 0xD0, 0x80, 0xBD, 0xD2, 0x68, 0xF1, 0x03, 0x02, 0xD0, 0x80, + 0xFF, 0xFF, 0x03, 0x03, 0xCE, 0x60, 0x38, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0x87, 0xF4, 0x60, 0x40, + 0x03, 0x2B, 0x31, 0x00, 0x88, 0xF3, 0x06, 0x61, 0x60, 0x43, 0x66, 0x45, 0x31, 0xF0, 0x63, 0x46, + 0x05, 0xF2, 0x65, 0x46, 0xD0, 0x80, 0x30, 0xF0, 0x0F, 0x02, 0x63, 0x46, 0x04, 0xF2, 0x65, 0x46, + 0xD0, 0x80, 0x2F, 0xF0, 0x09, 0x02, 0x63, 0x46, 0x03, 0xF2, 0x65, 0x46, 0xD0, 0x80, 0xFF, 0xFF, + 0x03, 0x02, 0xFF, 0xFF, 0x48, 0xFE, 0x06, 0x00, 0xCD, 0x81, 0x02, 0xA3, 0xE7, 0x02, 0x87, 0xF1, + 0x08, 0xFE, 0x64, 0x43, 0x03, 0x03, 0xCE, 0x60, 0x38, 0x78, 0xFF, 0xFF, 0x43, 0x43, 0x23, 0x46, + 0x06, 0xF0, 0x26, 0x46, 0x07, 0x67, 0xA0, 0x84, 0x23, 0xFA, 0x64, 0x40, 0x02, 0x26, 0x2B, 0x00, + 0xCE, 0x60, 0x38, 0x78, 0xFF, 0xFF, 0x26, 0x1B, 0x31, 0xF2, 0x15, 0x60, 0x02, 0x65, 0x60, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, + 0x61, 0x46, 0x31, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x30, 0xF0, + 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x2F, 0xF0, 0x63, 0x46, 0xD0, 0x80, + 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0x87, 0xF3, 0x08, 0xFE, + 0x60, 0x43, 0x61, 0x46, 0x43, 0x43, 0x07, 0xFC, 0x43, 0x43, 0x1D, 0xF0, 0xC0, 0x64, 0xC0, 0x84, + 0x0A, 0x60, 0x7B, 0xF1, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xC0, 0x84, + 0xA2, 0xDB, 0x63, 0x45, 0x2A, 0xF2, 0x35, 0xF0, 0x60, 0x40, 0xA4, 0x36, 0x0B, 0x00, 0x08, 0x2B, + 0x0C, 0x00, 0x23, 0x46, 0x26, 0xF2, 0x26, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x06, 0x02, 0xCE, 0x60, + 0x38, 0x78, 0xFF, 0xFF, 0xCD, 0x60, 0xEE, 0x78, 0xFF, 0xFF, 0x23, 0x46, 0x22, 0xF2, 0x26, 0x46, + 0x44, 0x4C, 0x0F, 0x26, 0x19, 0x00, 0x00, 0xBC, 0x40, 0x45, 0x0B, 0x03, 0x00, 0x64, 0x23, 0x46, + 0x22, 0xFA, 0x26, 0x46, 0xA2, 0xFF, 0xB6, 0x60, 0x58, 0x4E, 0x72, 0x78, 0xFF, 0xFF, 0xA3, 0xFF, + 0x26, 0x46, 0x2A, 0xF0, 0x2C, 0x44, 0x64, 0x40, 0x04, 0x27, 0x06, 0x00, 0x23, 0x46, 0x26, 0xFA, + 0x26, 0x46, 0xCD, 0x60, 0xA5, 0x78, 0xFF, 0xFF, 0x3F, 0xF2, 0x02, 0xFA, 0xA2, 0xFF, 0x16, 0xF0, + 0xFF, 0xFF, 0x64, 0x44, 0x01, 0x26, 0xDC, 0x9C, 0x92, 0xF3, 0x2A, 0xF2, 0xDC, 0x83, 0x92, 0xFD, + 0x06, 0xF4, 0x01, 0xF8, 0x26, 0x46, 0x60, 0x40, 0x40, 0x2B, 0x18, 0x00, 0x64, 0x44, 0x00, 0x65, + 0xFF, 0xB4, 0xFC, 0xA4, 0x06, 0xF0, 0x03, 0x03, 0x64, 0x46, 0x0C, 0x0D, 0x02, 0x65, 0x26, 0x46, + 0x00, 0xF2, 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, 0x02, 0x03, 0x60, 0x46, 0xF9, 0x01, 0x01, 0xF2, + 0xFF, 0xFF, 0xD4, 0x84, 0x01, 0xFA, 0x66, 0x44, 0x26, 0x46, 0x06, 0xFA, 0x06, 0xF4, 0x00, 0xF2, + 0x80, 0xFC, 0x40, 0x45, 0xB6, 0x60, 0x58, 0x4E, 0x72, 0x78, 0xFF, 0xFF, 0xA3, 0xFF, 0x26, 0x46, + 0x2C, 0x44, 0x0F, 0x26, 0x0F, 0x00, 0x23, 0x46, 0x26, 0xFA, 0x26, 0x44, 0x22, 0xFA, 0x26, 0x46, + 0x00, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0x6E, 0x00, 0xA3, 0x46, 0x26, 0xF2, 0x60, 0x45, 0xDC, 0x84, 0xD4, 0x80, 0x26, 0xFA, + 0xA3, 0x46, 0x6B, 0x02, 0x2A, 0xF0, 0xA3, 0x46, 0x22, 0xF2, 0xA3, 0x46, 0x00, 0xBC, 0x00, 0xF2, + 0x01, 0x02, 0x63, 0x00, 0x44, 0x4C, 0x3F, 0xF0, 0x60, 0x43, 0x23, 0x46, 0x22, 0xF4, 0x09, 0x60, + 0x00, 0x65, 0x3F, 0xF2, 0x26, 0x46, 0xC0, 0x84, 0xD4, 0x80, 0x60, 0x45, 0x56, 0x07, 0x80, 0xFC, + 0x1B, 0xF2, 0x06, 0xF2, 0x60, 0x41, 0x23, 0x46, 0x22, 0xF4, 0x1B, 0xF0, 0x06, 0xF0, 0xC1, 0x81, + 0x06, 0xFA, 0x05, 0xFA, 0x9B, 0xFA, 0x65, 0x44, 0x3F, 0xFA, 0x64, 0x46, 0x00, 0xFC, 0x63, 0x46, + 0x01, 0xF2, 0x10, 0x61, 0xF2, 0xA4, 0x01, 0xFA, 0xC8, 0x83, 0x02, 0x64, 0x59, 0xD0, 0x58, 0xD8, + 0xFD, 0x1F, 0x06, 0x45, 0x00, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x25, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xA2, 0xFF, 0x00, 0xF4, 0x01, 0xF0, 0x0A, 0x18, 0x70, 0x67, + 0xA0, 0x80, 0xF0, 0x67, 0x06, 0x03, 0xC0, 0x84, 0x01, 0xFA, 0x25, 0x46, 0x25, 0x44, 0x80, 0xFC, + 0x05, 0xFA, 0xB6, 0x60, 0x58, 0x4E, 0x72, 0x78, 0xFF, 0xFF, 0xD4, 0xFE, 0xA3, 0xFF, 0x2C, 0x44, + 0x04, 0x27, 0x16, 0x00, 0x23, 0x46, 0x22, 0xF2, 0xA2, 0xFC, 0x60, 0x46, 0x46, 0x46, 0x3F, 0xF2, + 0x00, 0xF4, 0x60, 0x47, 0x08, 0xFA, 0x26, 0x46, 0x2C, 0x43, 0x2A, 0xFC, 0x06, 0xF4, 0x00, 0x64, + 0x00, 0xFA, 0x01, 0xF0, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0x01, 0xFA, 0x26, 0x46, 0x1D, 0x00, + 0x00, 0x66, 0x46, 0x46, 0xCA, 0x60, 0x81, 0x78, 0xFF, 0xFF, 0xA3, 0x46, 0x22, 0xF0, 0xA2, 0xFC, + 0x00, 0x63, 0x33, 0x85, 0xA3, 0x46, 0x0D, 0x03, 0xA3, 0x46, 0x26, 0xF2, 0x0F, 0x65, 0xA4, 0x85, + 0xD4, 0x84, 0x26, 0xFA, 0xA3, 0x46, 0xA2, 0xFF, 0xB6, 0x60, 0x58, 0x4E, 0x72, 0x78, 0xFF, 0xFF, + 0xA3, 0xFF, 0x26, 0x46, 0xCE, 0x60, 0x38, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0x32, 0xF0, 0x60, 0x40, + 0x08, 0x2A, 0x24, 0x00, 0x01, 0x2B, 0x13, 0x00, 0x64, 0x40, 0x01, 0x2A, 0x10, 0x00, 0x25, 0x60, + 0xE8, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xC7, 0x78, 0x97, 0xF1, 0x1B, 0xF2, 0xFF, 0xFF, 0x60, 0x45, + 0x25, 0x60, 0xEE, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xD3, 0x78, 0x97, 0xF1, 0x0F, 0x00, 0x25, 0x60, + 0xE6, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xC7, 0x78, 0x97, 0xF1, 0x1B, 0xF2, 0xFF, 0xFF, 0x60, 0x45, + 0x25, 0x60, 0xEC, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xD3, 0x78, 0x97, 0xF1, 0x07, 0xF4, 0xFF, 0xFF, + 0x26, 0xF2, 0x26, 0x46, 0x0F, 0xB4, 0xDC, 0x85, 0x25, 0x60, 0xEA, 0x64, 0xE5, 0x60, 0x78, 0x41, + 0xD3, 0x78, 0x97, 0xF1, 0x27, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x3B, 0x07, 0x00, 0x25, 0x60, + 0xF8, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xC7, 0x78, 0x97, 0xF1, 0x08, 0x00, 0x02, 0x3B, 0x06, 0x00, + 0x25, 0x60, 0xFA, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xC7, 0x78, 0x97, 0xF1, 0x07, 0xF2, 0x26, 0xF0, + 0x41, 0x18, 0x60, 0x46, 0xFF, 0x67, 0x20, 0x88, 0x64, 0x5F, 0x40, 0x4A, 0x15, 0xF0, 0x28, 0x44, + 0xD0, 0x84, 0x03, 0xA4, 0x03, 0x0E, 0xE8, 0x84, 0xE8, 0x84, 0x04, 0x00, 0xFA, 0xA4, 0xE8, 0x84, + 0xE8, 0x87, 0xC0, 0xBF, 0xC0, 0x84, 0x15, 0xFA, 0x40, 0x48, 0x14, 0xF0, 0x2A, 0x44, 0xD0, 0x84, + 0x1F, 0xA4, 0x06, 0x0E, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0x07, 0x00, + 0xC2, 0xA4, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x87, 0xF8, 0xBF, 0xC0, 0x84, + 0x14, 0xFA, 0x2B, 0x60, 0xEC, 0x63, 0xBD, 0xDB, 0x60, 0x5C, 0x2F, 0x67, 0xD0, 0x80, 0x60, 0x45, + 0x02, 0x28, 0x64, 0x45, 0x28, 0x5C, 0xBD, 0xD9, 0x8B, 0x67, 0xD0, 0x80, 0x60, 0x41, 0x02, 0x24, + 0x64, 0x41, 0xD5, 0x84, 0x80, 0x65, 0xC4, 0x87, 0x01, 0x05, 0x00, 0x64, 0xFF, 0xB4, 0x0E, 0xFA, + 0xA3, 0xDB, 0x26, 0x46, 0xCE, 0x60, 0x7F, 0x78, 0xFF, 0xFF, 0xCA, 0x60, 0x81, 0x78, 0xFF, 0xFF, + 0x1F, 0x60, 0x20, 0x64, 0x40, 0x4B, 0xF6, 0x60, 0x58, 0x4D, 0xB3, 0x78, 0xFF, 0xFF, 0x00, 0x66, + 0x46, 0x46, 0xCA, 0x60, 0x81, 0x78, 0xFF, 0xFF, 0x1F, 0x60, 0x04, 0x64, 0x0F, 0x60, 0x90, 0xFB, + 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xF8, 0xFE, 0x00, 0x66, + 0x46, 0x46, 0xCA, 0x60, 0x81, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0x58, 0x63, 0x60, 0x47, 0x01, 0x27, + 0x64, 0x63, 0x61, 0x5C, 0x18, 0x60, 0x0F, 0xF9, 0xBD, 0xD0, 0xBD, 0xD0, 0x64, 0x45, 0x64, 0x41, + 0xBD, 0xD0, 0x00, 0xF4, 0x04, 0xF8, 0x83, 0xFA, 0x82, 0xF8, 0xA6, 0x46, 0x02, 0xB0, 0x5E, 0x63, + 0x04, 0x03, 0x64, 0x63, 0x03, 0xB0, 0x02, 0x3A, 0x6C, 0x63, 0x3F, 0xF2, 0xBD, 0xD0, 0xBD, 0xD0, + 0x64, 0x45, 0x64, 0x41, 0xBD, 0xD0, 0xA6, 0x46, 0x07, 0xF8, 0x86, 0xFA, 0x85, 0xF8, 0x60, 0x47, + 0x08, 0xFA, 0x18, 0x60, 0x0F, 0xF1, 0x26, 0x46, 0x64, 0x41, 0x2F, 0x58, 0xFF, 0xFF, 0x2A, 0xF2, + 0x2C, 0xF0, 0x31, 0x40, 0x20, 0x26, 0x09, 0x00, 0x60, 0x40, 0xA4, 0x36, 0x21, 0x00, 0x08, 0x26, + 0x07, 0x00, 0x7D, 0xF1, 0xCF, 0x60, 0x47, 0x78, 0xFF, 0xFF, 0xCF, 0x60, 0x77, 0x78, 0xFF, 0xFF, + 0x64, 0x40, 0x01, 0x26, 0x12, 0x00, 0x3F, 0xF0, 0x32, 0x40, 0x10, 0x2A, 0x0A, 0x00, 0x64, 0x41, + 0x60, 0x40, 0x40, 0x27, 0x06, 0x00, 0xCD, 0x81, 0xDD, 0x81, 0x03, 0x03, 0x02, 0x03, 0x01, 0x61, + 0x01, 0x00, 0x00, 0x61, 0x60, 0x40, 0x18, 0x3A, 0x03, 0x00, 0xCF, 0x60, 0xC9, 0x78, 0xFF, 0xFF, + 0x07, 0xF2, 0x87, 0xF1, 0x66, 0x45, 0xD0, 0x80, 0x60, 0x46, 0x06, 0xF2, 0x65, 0x46, 0x03, 0x03, + 0xFF, 0xFF, 0x02, 0x26, 0x07, 0x00, 0xDD, 0x60, 0x58, 0x4F, 0x90, 0x78, 0xFF, 0xFF, 0xCF, 0x60, + 0xC5, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0xA4, 0x3A, 0x07, 0x00, 0xDF, 0x60, + 0x58, 0x4F, 0xE3, 0x78, 0xFF, 0xFF, 0xCF, 0x60, 0xC5, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0xCE, 0x60, + 0x58, 0x4F, 0x54, 0x78, 0xFF, 0xFF, 0x3F, 0xF2, 0x06, 0x65, 0xD4, 0x80, 0x60, 0x43, 0x5B, 0x04, + 0x00, 0xF4, 0xAA, 0x60, 0xAA, 0x65, 0x09, 0xF2, 0x0A, 0xF0, 0xD4, 0x80, 0x03, 0x64, 0x53, 0x02, + 0xD0, 0x80, 0x00, 0x64, 0x0B, 0xF0, 0x4F, 0x02, 0x64, 0x45, 0xD4, 0x80, 0xF8, 0x7F, 0x08, 0x02, + 0x0C, 0xF0, 0x26, 0x46, 0x64, 0x45, 0x23, 0xF0, 0x20, 0x67, 0xB0, 0x84, 0xA2, 0xDA, 0x0B, 0x00, + 0xD4, 0x80, 0x1D, 0x60, 0x60, 0x64, 0x11, 0x02, 0x0C, 0xF0, 0x26, 0x46, 0x64, 0x45, 0x23, 0xF0, + 0x40, 0x67, 0xB0, 0x84, 0xA2, 0xDA, 0x65, 0x44, 0x88, 0x3A, 0x35, 0x00, 0x77, 0x37, 0x03, 0x00, + 0x78, 0x37, 0x01, 0x00, 0x8E, 0x37, 0x00, 0x61, 0x2E, 0x00, 0xD4, 0x80, 0x08, 0x65, 0x2B, 0x02, + 0xD7, 0x80, 0x01, 0x60, 0x00, 0x64, 0x0C, 0xF0, 0x26, 0x04, 0xD0, 0x80, 0x0D, 0xF0, 0x23, 0x02, + 0x26, 0x46, 0x14, 0xF2, 0x01, 0x63, 0x02, 0xA8, 0x64, 0x47, 0x1D, 0x03, 0x7F, 0xB4, 0xFD, 0xA0, + 0x06, 0x03, 0x19, 0x07, 0x23, 0xF0, 0x60, 0x67, 0xB0, 0x84, 0xA2, 0xDA, 0x6B, 0x00, 0x26, 0x46, + 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x2A, 0x07, 0x00, 0x60, 0x40, 0x48, 0x36, 0x04, 0x00, + 0xD2, 0xF3, 0xFF, 0xFF, 0x02, 0xBC, 0xD2, 0xFB, 0xE8, 0x60, 0x58, 0x4F, 0xEF, 0x78, 0xFF, 0xFF, + 0xCF, 0x60, 0xC5, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x61, 0x40, 0x01, 0x2A, 0x09, 0x00, 0x25, 0x60, + 0xFE, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xC7, 0x78, 0x97, 0xF1, 0xCF, 0x60, 0xC9, 0x78, 0xFF, 0xFF, + 0xDF, 0x60, 0x58, 0x4F, 0xE3, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0xFF, 0xFF, 0xFF, 0xFF, 0x48, 0x36, + 0x88, 0x00, 0xCF, 0x60, 0xD6, 0x78, 0xFF, 0xFF, 0xCF, 0x60, 0xC5, 0x78, 0xFF, 0xFF, 0x60, 0x40, + 0x0C, 0x26, 0x7F, 0x00, 0x64, 0x40, 0x01, 0x2A, 0x7C, 0x00, 0xB0, 0x3A, 0x05, 0x00, 0xD4, 0x60, + 0x58, 0x4F, 0x5A, 0x78, 0xFF, 0xFF, 0x71, 0x00, 0x00, 0x3A, 0x05, 0x00, 0xD7, 0x60, 0x58, 0x4F, + 0xCA, 0x78, 0xFF, 0xFF, 0x6A, 0x00, 0x20, 0x3A, 0x05, 0x00, 0xD7, 0x60, 0x58, 0x4F, 0xCA, 0x78, + 0xFF, 0xFF, 0x63, 0x00, 0xC0, 0x3A, 0x05, 0x00, 0xDC, 0x60, 0x58, 0x4F, 0xFE, 0x78, 0xFF, 0xFF, + 0x5C, 0x00, 0xA0, 0x3A, 0x05, 0x00, 0xDD, 0x60, 0x58, 0x4F, 0x5B, 0x78, 0xFF, 0xFF, 0x55, 0x00, + 0x40, 0x3A, 0x0D, 0x00, 0xE3, 0x60, 0x58, 0x4F, 0xC3, 0x78, 0xFF, 0xFF, 0x4E, 0x00, 0x60, 0x40, + 0x50, 0x3A, 0x05, 0x00, 0xED, 0x60, 0x58, 0x4F, 0xEB, 0x78, 0xFF, 0xFF, 0x46, 0x00, 0xCF, 0x60, + 0xC9, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x2A, 0x07, 0x00, + 0x60, 0x40, 0x48, 0x36, 0x04, 0x00, 0xD2, 0xF3, 0xFF, 0xFF, 0x02, 0xBC, 0xD2, 0xFB, 0x2A, 0xF2, + 0x3B, 0xF0, 0x60, 0x40, 0x40, 0x2B, 0x04, 0x00, 0x64, 0x40, 0x20, 0x2B, 0x01, 0x00, 0x03, 0x00, + 0xCF, 0x60, 0xB9, 0x78, 0xFF, 0xFF, 0x22, 0xF2, 0xFF, 0xFF, 0x04, 0xB4, 0xFF, 0xFF, 0xF8, 0x03, + 0x23, 0xF2, 0x07, 0xF4, 0xBB, 0xF0, 0x26, 0x46, 0xA4, 0x84, 0xFF, 0xFF, 0x60, 0x40, 0x2F, 0x26, + 0x20, 0x00, 0xC9, 0x60, 0x58, 0x4F, 0xCF, 0x78, 0xFF, 0xFF, 0x64, 0x40, 0x18, 0x36, 0x09, 0x00, + 0x04, 0x65, 0xE5, 0x60, 0x58, 0x4E, 0x27, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0xCF, 0x60, 0xC9, 0x78, + 0xFF, 0xFF, 0x1F, 0x60, 0x04, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xF8, 0xFE, 0x0C, 0x00, 0x66, 0x44, 0x00, 0xA8, 0xFF, 0xFF, + 0x0A, 0x03, 0x26, 0x46, 0x1F, 0x60, 0x20, 0x64, 0x40, 0x4B, 0xF6, 0x60, 0x58, 0x4D, 0xB3, 0x78, + 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0xCE, 0x60, 0x35, 0x78, 0xFF, 0xFF, 0x14, 0xF2, 0x00, 0x7C, + 0x3E, 0xF8, 0xCC, 0x84, 0xCC, 0x84, 0x18, 0x03, 0x5C, 0x02, 0x11, 0xF2, 0x07, 0xFA, 0xAB, 0xF3, + 0x19, 0xFA, 0xD0, 0x60, 0x58, 0x4E, 0x86, 0x78, 0xFF, 0xFF, 0x1E, 0x60, 0xE0, 0x64, 0x0F, 0x60, + 0x90, 0xFB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC8, 0xFE, + 0xF2, 0x64, 0x3B, 0x42, 0x4A, 0xDB, 0x8D, 0x00, 0xA2, 0xFF, 0x46, 0x45, 0xB6, 0x60, 0x58, 0x4E, + 0xBB, 0x78, 0xFF, 0xFF, 0xA3, 0xFF, 0x11, 0x03, 0x7E, 0x63, 0x46, 0x4B, 0x25, 0x46, 0xA3, 0xD0, + 0x2B, 0x46, 0xA3, 0xD8, 0xFB, 0x1F, 0x89, 0xFC, 0x8A, 0xFC, 0x88, 0xFC, 0x05, 0x18, 0x64, 0x46, + 0x01, 0xF0, 0x10, 0x67, 0xC0, 0x84, 0x01, 0xFA, 0x08, 0xFE, 0x2B, 0x46, 0x46, 0x46, 0x25, 0x46, + 0xD0, 0x60, 0x58, 0x4E, 0x86, 0x78, 0xFF, 0xFF, 0x13, 0x60, 0x43, 0xF3, 0x87, 0xF3, 0x00, 0xA8, + 0x07, 0xFA, 0x0E, 0x03, 0x1E, 0x60, 0xDA, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x25, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xF3, 0x64, 0x3B, 0x42, 0x4A, 0xDB, 0x0D, 0x00, + 0x1E, 0x60, 0xCE, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x25, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0xF4, 0x64, 0x3B, 0x42, 0x4A, 0xDB, 0x26, 0x44, 0x00, 0xA8, 0xC1, 0xFE, + 0x48, 0x03, 0x26, 0x46, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x2A, 0x07, 0x00, 0x60, 0x40, + 0x48, 0x36, 0x04, 0x00, 0xD2, 0xF3, 0xFF, 0xFF, 0x02, 0xBC, 0xD2, 0xFB, 0x26, 0x46, 0x2A, 0xF2, + 0x3B, 0xF0, 0x60, 0x40, 0x40, 0x2B, 0x06, 0x00, 0xC0, 0x60, 0x00, 0x64, 0x64, 0x40, 0x20, 0x2B, + 0x01, 0x00, 0x03, 0x00, 0xD0, 0x60, 0x73, 0x78, 0xFF, 0xFF, 0x22, 0xF2, 0xFF, 0xFF, 0x04, 0xB4, + 0xFF, 0xFF, 0xF8, 0x03, 0x23, 0xF2, 0x07, 0xF4, 0xBB, 0xF0, 0x26, 0x46, 0xA4, 0x84, 0xFF, 0xFF, + 0x60, 0x40, 0x2F, 0x26, 0x07, 0x00, 0xC9, 0x60, 0x58, 0x4F, 0xCF, 0x78, 0xFF, 0xFF, 0x64, 0x40, + 0x18, 0x36, 0x09, 0x00, 0x04, 0x65, 0xE5, 0x60, 0x58, 0x4E, 0x27, 0x78, 0xFF, 0xFF, 0x26, 0x46, + 0xCF, 0x60, 0xC9, 0x78, 0xFF, 0xFF, 0x1F, 0x60, 0x04, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x26, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xF8, 0xFE, 0xF1, 0x64, 0x3B, 0x42, + 0x4A, 0xDB, 0x00, 0x66, 0x46, 0x46, 0xCF, 0x60, 0xC5, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0x82, 0x60, + 0xFF, 0x65, 0xA4, 0x87, 0x02, 0xBF, 0x2A, 0xFA, 0x1C, 0xF2, 0x13, 0xFA, 0x32, 0xF2, 0x2C, 0xFA, + 0x33, 0xF2, 0x2D, 0xFA, 0x34, 0xF2, 0x2E, 0xFA, 0x2F, 0xF2, 0x32, 0xFA, 0x30, 0xF2, 0x33, 0xFA, + 0x31, 0xF2, 0x34, 0xFA, 0x66, 0xF3, 0x2F, 0xFA, 0x67, 0xF3, 0x30, 0xFA, 0x68, 0xF3, 0x31, 0xFA, + 0x2E, 0x58, 0xFF, 0xFF, 0xD3, 0x60, 0x59, 0x64, 0x08, 0x60, 0x26, 0xFB, 0x2F, 0x58, 0xFF, 0xFF, + 0xB1, 0xF3, 0x12, 0x60, 0x2C, 0x63, 0xF7, 0xA0, 0xFF, 0xFF, 0x02, 0x06, 0x00, 0x64, 0xB1, 0xFB, + 0xB1, 0xF3, 0xB1, 0xFB, 0x01, 0xA4, 0xCC, 0x84, 0xFF, 0xFF, 0x02, 0x03, 0x2A, 0xA3, 0xFB, 0x01, + 0x63, 0x46, 0x10, 0x60, 0xA6, 0x63, 0x0E, 0x61, 0x60, 0xFE, 0xA6, 0xD1, 0xDE, 0x86, 0x01, 0x64, + 0x64, 0x40, 0x7F, 0x36, 0x00, 0x64, 0xA3, 0xDB, 0xDB, 0x83, 0xA3, 0xD9, 0xCD, 0x81, 0x04, 0xA3, + 0xF4, 0x02, 0x11, 0x60, 0x16, 0x63, 0x1C, 0x61, 0xA6, 0xD1, 0xDE, 0x86, 0x01, 0x64, 0x64, 0x40, + 0x7F, 0x36, 0x00, 0x64, 0xA3, 0xDB, 0xDB, 0x83, 0xA3, 0xD9, 0xCD, 0x81, 0x06, 0xA3, 0xF4, 0x02, + 0x20, 0xFE, 0x13, 0x60, 0x7F, 0xF3, 0x13, 0x60, 0x2D, 0xFB, 0x1E, 0x63, 0x26, 0x60, 0x64, 0x61, + 0x27, 0x60, 0x08, 0x64, 0x58, 0xD1, 0x59, 0xD9, 0xFD, 0x1F, 0x13, 0x60, 0x95, 0xF3, 0x13, 0x60, + 0x43, 0xFB, 0x13, 0x60, 0x96, 0xF3, 0x13, 0x60, 0x44, 0xFB, 0x13, 0x60, 0x9C, 0xF3, 0x13, 0x60, + 0x4A, 0xFB, 0x13, 0x60, 0x9D, 0xF3, 0x13, 0x60, 0x4B, 0xFB, 0x13, 0x60, 0x9E, 0xF3, 0x13, 0x60, + 0x4C, 0xFB, 0x13, 0x60, 0x9F, 0xF3, 0x13, 0x60, 0x4D, 0xFB, 0x13, 0x60, 0x97, 0xF3, 0x13, 0x60, + 0x45, 0xFB, 0x13, 0x60, 0x98, 0xF3, 0x13, 0x60, 0x46, 0xFB, 0x13, 0x60, 0x99, 0xF3, 0x13, 0x60, + 0x47, 0xFB, 0x26, 0x60, 0xB0, 0x63, 0xBD, 0xD1, 0xCB, 0xF9, 0x66, 0xF9, 0xBD, 0xD1, 0xCC, 0xF9, + 0x67, 0xF9, 0xA3, 0xD1, 0xCD, 0xF9, 0x68, 0xF9, 0x01, 0x64, 0x6A, 0xFB, 0x13, 0x60, 0x51, 0xF3, + 0xC4, 0xFB, 0x00, 0x63, 0x4A, 0xFD, 0x5A, 0xFD, 0x6B, 0xFD, 0x6C, 0xFD, 0x13, 0x60, 0x45, 0xF3, + 0x15, 0x60, 0xCB, 0xF1, 0xFF, 0x60, 0xE7, 0x65, 0x32, 0x41, 0xA5, 0x81, 0xFF, 0xA0, 0xFF, 0xFF, + 0x01, 0x03, 0x06, 0x00, 0x13, 0x60, 0x47, 0xF3, 0x08, 0xB9, 0x60, 0x40, 0x01, 0x26, 0x10, 0xB9, + 0x41, 0x52, 0x87, 0xF5, 0x32, 0x44, 0x10, 0xB0, 0xFF, 0xFF, 0x0A, 0x03, 0x14, 0x60, 0x15, 0xF3, + 0x06, 0xF0, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0x80, 0xBF, 0xB0, 0x84, 0x06, 0xFA, + 0x13, 0x60, 0x45, 0xF3, 0x22, 0x7C, 0xFF, 0xA0, 0xFD, 0xA0, 0x05, 0x06, 0x03, 0x03, 0xFE, 0xA0, + 0x04, 0x7C, 0x01, 0x02, 0x3A, 0xF8, 0x13, 0x60, 0x4C, 0xF1, 0x20, 0x44, 0x20, 0xB5, 0x64, 0x41, + 0x00, 0xB9, 0xD4, 0x84, 0x08, 0x28, 0x20, 0xBC, 0x40, 0x40, 0x15, 0x60, 0xCB, 0xF3, 0x30, 0x60, + 0x0E, 0x63, 0xF0, 0x84, 0xF0, 0x84, 0xF0, 0x84, 0x02, 0xB5, 0xF0, 0x84, 0xF0, 0x84, 0x03, 0xB4, + 0x65, 0x5C, 0xA3, 0xD9, 0x02, 0xA8, 0x18, 0x60, 0x08, 0xFB, 0x15, 0x02, 0x00, 0x60, 0xC8, 0x64, + 0x18, 0x60, 0x09, 0xFB, 0x18, 0x60, 0x0D, 0xFB, 0x07, 0x60, 0xD0, 0x64, 0x18, 0x60, 0x0A, 0xFB, + 0x18, 0x60, 0x0E, 0xFB, 0x01, 0x60, 0x90, 0x64, 0x18, 0x60, 0x0B, 0xFB, 0x00, 0x60, 0x64, 0x64, + 0x18, 0x60, 0x0C, 0xFB, 0x06, 0x00, 0x64, 0x64, 0x18, 0x60, 0x0B, 0xFB, 0x64, 0x64, 0x18, 0x60, + 0x0C, 0xFB, 0xB1, 0xF1, 0x10, 0x60, 0xA0, 0x63, 0x2F, 0x18, 0x60, 0x40, 0x01, 0x27, 0x12, 0x00, + 0xCC, 0x84, 0x06, 0xA3, 0xFD, 0x02, 0xA3, 0xD3, 0x10, 0x60, 0xA6, 0x63, 0x25, 0x1B, 0x10, 0x60, + 0xF8, 0x65, 0xA3, 0xD3, 0x06, 0xA3, 0xD7, 0x80, 0x02, 0x1B, 0xFB, 0x04, 0x1D, 0x00, 0xF8, 0xA3, + 0xA3, 0xD3, 0x18, 0x00, 0x11, 0x60, 0x14, 0x63, 0x11, 0x60, 0xF4, 0x65, 0xA3, 0xD1, 0x08, 0xA3, + 0xD0, 0x80, 0xD7, 0x80, 0x02, 0x03, 0xFA, 0x04, 0x0F, 0x00, 0xFA, 0xA3, 0xA3, 0xD3, 0x11, 0x60, + 0x16, 0x63, 0x0A, 0x1B, 0xA3, 0xD3, 0x08, 0xA3, 0xD7, 0x80, 0x02, 0x1B, 0xFB, 0x04, 0x04, 0x00, + 0xF6, 0xA3, 0xA3, 0xD3, 0xC5, 0xFB, 0x64, 0xFB, 0x27, 0x60, 0x34, 0x64, 0x26, 0x60, 0x90, 0x63, + 0xA0, 0xD1, 0xA3, 0xD9, 0x64, 0x41, 0x58, 0xD1, 0x5B, 0xD9, 0x64, 0xF3, 0xFF, 0xFF, 0x60, 0x40, + 0x01, 0x2B, 0x03, 0x00, 0xD1, 0x60, 0xE9, 0x78, 0xFF, 0xFF, 0x91, 0xFA, 0x61, 0x44, 0xEF, 0x60, + 0x58, 0x4E, 0xAB, 0x78, 0xFF, 0xFF, 0x12, 0xFA, 0x15, 0x60, 0xBC, 0xF3, 0x3F, 0x40, 0x01, 0x27, + 0x08, 0x00, 0x0F, 0x60, 0xFF, 0x65, 0xA4, 0x84, 0xEE, 0x60, 0x58, 0x4E, 0x26, 0x78, 0xFF, 0xFF, + 0x06, 0x00, 0x0F, 0x65, 0xA4, 0x84, 0xEE, 0x60, 0x58, 0x4E, 0x26, 0x78, 0xFF, 0xFF, 0x00, 0x65, + 0xEE, 0x60, 0x58, 0x4E, 0xC6, 0x78, 0xFF, 0xFF, 0xEF, 0x60, 0x58, 0x4E, 0x10, 0x78, 0xFF, 0xFF, + 0x15, 0x00, 0x11, 0xF8, 0x64, 0x44, 0xEF, 0x60, 0x58, 0x4E, 0xAB, 0x78, 0xFF, 0xFF, 0x12, 0xFA, + 0x15, 0x60, 0xBD, 0xF3, 0x0F, 0x60, 0xFF, 0x65, 0xA4, 0x84, 0xEE, 0x60, 0x58, 0x4E, 0x26, 0x78, + 0xFF, 0xFF, 0xFF, 0x65, 0xEE, 0x60, 0x58, 0x4E, 0xC6, 0x78, 0xFF, 0xFF, 0xB5, 0xF1, 0x09, 0x60, + 0x2A, 0x64, 0xD0, 0x80, 0x03, 0x64, 0x01, 0x06, 0x06, 0x64, 0xAE, 0xFB, 0x46, 0x48, 0xC3, 0xF3, + 0xFF, 0xFF, 0x60, 0x40, 0x05, 0x3A, 0x03, 0x00, 0x14, 0x60, 0x00, 0x66, 0x11, 0x00, 0x04, 0x3A, + 0x03, 0x00, 0x13, 0x60, 0xF4, 0x66, 0x0C, 0x00, 0x03, 0x3A, 0x03, 0x00, 0x13, 0x60, 0xE8, 0x66, + 0x07, 0x00, 0x02, 0x3A, 0x03, 0x00, 0x13, 0x60, 0xDC, 0x66, 0x02, 0x00, 0x13, 0x60, 0xD0, 0x66, + 0x60, 0xFE, 0xA6, 0xD3, 0xDE, 0x86, 0x10, 0x60, 0x5F, 0xFB, 0xA6, 0xD3, 0xDE, 0x86, 0x21, 0x60, + 0x2F, 0x63, 0xA3, 0xDB, 0x21, 0x60, 0xA7, 0x63, 0xA3, 0xDB, 0xA6, 0xD3, 0xDE, 0x86, 0x10, 0x60, + 0x5E, 0xFB, 0xA6, 0xD3, 0xDE, 0x86, 0x20, 0x60, 0xBF, 0x63, 0xA3, 0xDB, 0x20, 0xFE, 0xA6, 0xD3, + 0xDA, 0x86, 0x60, 0x43, 0x1F, 0xB3, 0x63, 0x5C, 0x1F, 0x60, 0x00, 0xB4, 0xE8, 0x84, 0xE8, 0x84, + 0xE8, 0x84, 0xB0, 0x85, 0x10, 0x60, 0x95, 0xF3, 0xFF, 0xFF, 0xFC, 0x60, 0x00, 0xB4, 0xB4, 0x84, + 0xA2, 0xDB, 0x10, 0x60, 0xD1, 0xFB, 0x21, 0x60, 0xCA, 0x63, 0xA3, 0xD3, 0xA6, 0xD1, 0xDE, 0x86, + 0x80, 0x60, 0x7F, 0xB5, 0x64, 0x44, 0xE8, 0x84, 0x7F, 0x60, 0x80, 0xB4, 0xB4, 0x84, 0xA3, 0xDB, + 0x60, 0xFE, 0xA6, 0xD3, 0xDE, 0x86, 0x10, 0x60, 0x62, 0xFB, 0x20, 0xFE, 0x10, 0x60, 0x2A, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0A, 0x04, 0x40, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, + 0xD2, 0x60, 0x5E, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x64, 0xF1, 0x0F, 0x60, + 0x9D, 0xF9, 0x0C, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x20, 0x44, 0x01, 0x65, 0x34, 0x80, + 0x20, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD2, 0x60, 0x82, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x64, 0xF1, 0x0F, 0x60, + 0x9D, 0xF9, 0x0E, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x20, 0x60, 0x00, 0x64, 0x08, 0x60, + 0x16, 0xFB, 0xD2, 0x60, 0x97, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, + 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xBE, 0xFE, 0x08, 0x60, 0x11, 0xF1, 0x40, 0x60, 0x00, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0xBE, 0xFE, 0x08, 0x60, 0x11, 0xF1, 0x40, 0x60, 0x00, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x20, 0x40, 0x20, 0x2A, 0x04, 0x00, 0xF0, 0x60, 0x58, 0x4E, + 0x66, 0x78, 0xFF, 0xFF, 0x36, 0x40, 0x08, 0x3A, 0x6A, 0x00, 0x36, 0x40, 0x08, 0x3A, 0x05, 0x00, + 0x10, 0x60, 0x42, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x04, 0x00, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x4E, 0xF3, 0xFF, 0xFF, 0x1D, 0x1B, 0x13, 0x60, 0x54, 0xF3, 0xC7, 0xFB, 0x26, 0x60, + 0x16, 0x65, 0x26, 0x60, 0xB8, 0x61, 0x26, 0x60, 0x14, 0x64, 0x20, 0x63, 0x59, 0xD1, 0x58, 0xD9, + 0xA5, 0xD9, 0xDA, 0x85, 0xFB, 0x1F, 0x00, 0x60, 0x01, 0x64, 0x08, 0x60, 0x22, 0xFB, 0xD3, 0x60, + 0x3C, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x36, 0x40, 0x08, 0x3A, 0x41, 0x00, 0xE7, 0x60, 0xC5, 0x78, + 0xFF, 0xFF, 0x27, 0x60, 0x3E, 0x63, 0x60, 0x41, 0x00, 0x62, 0xCD, 0x81, 0x04, 0xA2, 0xFD, 0x02, + 0x2C, 0x60, 0x3E, 0x61, 0xFC, 0xA2, 0x62, 0x45, 0xC5, 0x81, 0xE0, 0x84, 0xE0, 0x85, 0xC4, 0x85, + 0xC7, 0x83, 0xFE, 0xA5, 0x88, 0xF3, 0xFF, 0xFF, 0xC4, 0x84, 0x66, 0x45, 0x60, 0x46, 0xBD, 0xD1, + 0x03, 0xF8, 0xBD, 0xD1, 0x04, 0xF8, 0xA3, 0xD1, 0x05, 0xF8, 0x06, 0xF2, 0xFF, 0xFF, 0x02, 0x7E, + 0x06, 0xFA, 0x64, 0xF3, 0x61, 0x43, 0x60, 0x40, 0x01, 0x27, 0x02, 0xA3, 0xA3, 0xD1, 0x0F, 0xF8, + 0x16, 0x64, 0x12, 0xFA, 0x01, 0x64, 0x11, 0xFA, 0x66, 0x5C, 0xC1, 0x60, 0x58, 0x4E, 0x93, 0x78, + 0xFF, 0xFF, 0x66, 0x43, 0x32, 0x40, 0x08, 0x2A, 0x0A, 0x00, 0x14, 0x60, 0x15, 0xF3, 0x06, 0xF0, + 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0x80, 0xBF, 0xB0, 0x84, 0x06, 0xFA, 0xC5, 0xFE, + 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x00, 0x60, 0x30, 0x64, 0x08, 0x60, 0x16, 0xFB, + 0xD2, 0x60, 0xB5, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, 0x2A, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x00, 0x60, 0x03, 0x64, 0x08, 0x60, 0x22, 0xFB, 0xD2, 0x60, 0xB5, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, 0x42, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x0F, 0x4E, 0xE1, 0x60, 0x58, 0x4F, 0xA9, 0x78, 0xFF, 0xFF, 0x0E, 0x4F, 0x0F, 0x4E, 0xDF, 0x60, + 0x58, 0x4F, 0x0F, 0x78, 0xFF, 0xFF, 0x0E, 0x4F, 0x0F, 0x4E, 0xDE, 0x60, 0x58, 0x4F, 0x9A, 0x78, + 0xFF, 0xFF, 0x0E, 0x4F, 0x0F, 0x4E, 0xDD, 0x60, 0x58, 0x4F, 0xFB, 0x78, 0xFF, 0xFF, 0x0E, 0x4F, + 0xD5, 0x01, 0x4E, 0xF3, 0x7D, 0xF5, 0x60, 0x40, 0xFF, 0x22, 0x0A, 0x00, 0x88, 0xF1, 0xCC, 0x84, + 0xE0, 0x84, 0xC0, 0x86, 0x06, 0xF2, 0xFF, 0xFF, 0x00, 0x7E, 0x06, 0xFA, 0x7D, 0xF5, 0x07, 0x00, + 0x08, 0x60, 0x24, 0xF1, 0x00, 0x60, 0x11, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x4E, 0xF3, + 0x66, 0x40, 0xFF, 0x22, 0x05, 0x00, 0xFF, 0x22, 0x39, 0x00, 0xD4, 0x60, 0x0C, 0x78, 0xFF, 0xFF, + 0x02, 0x64, 0x69, 0xFB, 0xFF, 0xFF, 0xC1, 0xFE, 0x69, 0xF3, 0x00, 0x65, 0xD4, 0x80, 0x4E, 0xF3, + 0x0E, 0x03, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x80, 0x60, 0x00, 0x64, 0x08, 0x60, + 0x16, 0xFB, 0xD3, 0x60, 0x7C, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, + 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0A, 0x04, 0x20, 0x60, 0x00, 0x64, 0x08, 0x60, + 0x16, 0xFB, 0xD3, 0x60, 0x8F, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xD3, 0xF3, + 0xFF, 0xFF, 0xFE, 0xB4, 0xD3, 0xFB, 0x1F, 0x60, 0x3A, 0x62, 0x06, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x2D, 0xFF, 0x20, 0x44, 0x01, 0xB5, 0x54, 0x80, 0xDA, 0xFE, 0xBE, 0xFE, 0x87, 0xF1, 0x02, 0x64, + 0x86, 0xF3, 0xC0, 0x83, 0x40, 0x48, 0x75, 0xFD, 0xE7, 0x60, 0x58, 0x4E, 0x81, 0x78, 0xFF, 0xFF, + 0x28, 0x44, 0x4C, 0x88, 0x75, 0xF3, 0x02, 0x65, 0xC4, 0x83, 0xF5, 0x02, 0x1E, 0x60, 0x58, 0x4E, + 0xB9, 0x78, 0xFF, 0xFF, 0x17, 0x60, 0x06, 0x64, 0x0B, 0x60, 0x82, 0xFB, 0x4A, 0xDF, 0x01, 0x60, + 0xFE, 0x63, 0x15, 0x60, 0x00, 0x61, 0x00, 0x64, 0x59, 0xDB, 0xFE, 0x1F, 0x7D, 0xF1, 0x1E, 0x60, + 0xE0, 0x61, 0x64, 0x40, 0xFF, 0x26, 0x38, 0x00, 0xD4, 0x60, 0x58, 0x4E, 0x0F, 0x78, 0xFF, 0xFF, + 0x1E, 0x60, 0xCE, 0x61, 0xD4, 0x60, 0x58, 0x4E, 0x0F, 0x78, 0xFF, 0xFF, 0x1E, 0x60, 0xD4, 0x61, + 0xD4, 0x60, 0x58, 0x4E, 0x0F, 0x78, 0xFF, 0xFF, 0x1E, 0x60, 0xE6, 0x61, 0xD4, 0x60, 0x58, 0x4E, + 0x0F, 0x78, 0xFF, 0xFF, 0x1E, 0x60, 0xEC, 0x61, 0xD4, 0x60, 0x58, 0x4E, 0x0F, 0x78, 0xFF, 0xFF, + 0x1E, 0x60, 0xF8, 0x61, 0xD4, 0x60, 0x58, 0x4E, 0x0F, 0x78, 0xFF, 0xFF, 0x1F, 0x60, 0x04, 0x61, + 0xD4, 0x60, 0x58, 0x4E, 0x0F, 0x78, 0xFF, 0xFF, 0x1E, 0x60, 0xF2, 0x61, 0xD4, 0x60, 0x58, 0x4E, + 0x0F, 0x78, 0xFF, 0xFF, 0x1E, 0x60, 0xDA, 0x61, 0xD4, 0x60, 0x58, 0x4E, 0x3A, 0x78, 0xFF, 0xFF, + 0x00, 0x64, 0x08, 0x60, 0x15, 0xFB, 0x5A, 0xDB, 0xC5, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xA1, 0xD3, + 0x0E, 0x57, 0x23, 0x00, 0x0E, 0xF2, 0x44, 0x4C, 0x80, 0xB0, 0x10, 0xB0, 0x0A, 0x03, 0x00, 0x64, + 0x0F, 0x60, 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0x13, 0x00, 0x12, 0x02, 0xF0, 0x37, 0x09, 0x00, 0x02, 0xF0, 0x09, 0x60, 0x08, 0x64, 0xD0, 0x80, + 0xA2, 0xFF, 0x8F, 0xF3, 0x02, 0x02, 0xCC, 0x84, 0x8F, 0xFB, 0x1F, 0x60, 0x20, 0x64, 0x40, 0x4B, + 0xF6, 0x60, 0x58, 0x4D, 0xB3, 0x78, 0xFF, 0xFF, 0x2C, 0x44, 0xAC, 0x86, 0x09, 0xF0, 0xDA, 0x02, + 0x37, 0x58, 0xFF, 0xFF, 0xA1, 0xD3, 0x0E, 0x57, 0x18, 0x00, 0x0E, 0xF2, 0x44, 0x4C, 0x80, 0xB0, + 0x10, 0xB0, 0x0A, 0x03, 0x00, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x08, 0x00, 0x07, 0x02, 0x1F, 0x60, 0x20, 0x64, 0x40, 0x4B, + 0xF6, 0x60, 0x58, 0x4D, 0xB3, 0x78, 0xFF, 0xFF, 0x2C, 0x44, 0xAC, 0x86, 0x09, 0xF0, 0xE5, 0x02, + 0x37, 0x58, 0xFF, 0xFF, 0x00, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0xB0, 0x64, 0x2A, 0xFA, 0x2F, 0xF2, + 0x2C, 0xFA, 0x30, 0xF2, 0x2D, 0xFA, 0x31, 0xF2, 0x2E, 0xFA, 0xCB, 0xF3, 0x2F, 0xFA, 0xCC, 0xF3, + 0x30, 0xFA, 0xCD, 0xF3, 0x31, 0xFA, 0x66, 0xF3, 0x32, 0xFA, 0x67, 0xF3, 0x33, 0xFA, 0x68, 0xF3, + 0x34, 0xFA, 0xAB, 0xF1, 0x19, 0xF8, 0x06, 0x63, 0x3F, 0xFC, 0x1C, 0xF2, 0x13, 0xFA, 0x00, 0x64, + 0x3E, 0xFA, 0x07, 0xF2, 0x87, 0xF1, 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, 0x0C, 0x03, 0x60, 0x46, + 0x06, 0xF2, 0x26, 0x46, 0x01, 0xB0, 0xFF, 0xFF, 0x03, 0x02, 0xD6, 0x60, 0x40, 0x78, 0xFF, 0xFF, + 0xD7, 0x60, 0x92, 0x78, 0xFF, 0xFF, 0x00, 0xF4, 0x0A, 0xF2, 0x09, 0xF2, 0xFF, 0xA0, 0x00, 0xA0, + 0x13, 0x02, 0xFF, 0xA0, 0x04, 0x03, 0x08, 0x03, 0xD4, 0x60, 0xAF, 0x78, 0xFF, 0xFF, 0x02, 0x64, + 0x55, 0xFB, 0xD4, 0x60, 0xBA, 0x78, 0xFF, 0xFF, 0x01, 0x63, 0x32, 0x40, 0x08, 0x2A, 0x0F, 0x00, + 0x55, 0xFD, 0xD4, 0x60, 0xBA, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x00, 0xF4, 0x0A, 0xF2, 0x0E, 0x63, + 0x01, 0xA4, 0x0A, 0xFA, 0x0B, 0xFC, 0x43, 0x59, 0xD7, 0x60, 0x6C, 0x78, 0xFF, 0xFF, 0x26, 0x46, + 0x00, 0xF4, 0x0A, 0xF2, 0x0D, 0x63, 0x01, 0xA4, 0x0A, 0xFA, 0x0B, 0xFC, 0x43, 0x59, 0xD7, 0x60, + 0x6C, 0x78, 0xFF, 0xFF, 0x87, 0xF5, 0x00, 0xF2, 0x26, 0x46, 0x00, 0xA0, 0x2E, 0xF0, 0x37, 0x03, + 0x66, 0x41, 0x15, 0x60, 0x02, 0x65, 0x64, 0x47, 0x00, 0x7F, 0x87, 0xF1, 0xE0, 0x84, 0x44, 0xD3, + 0x64, 0x43, 0x11, 0x18, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xFC, 0x1B, 0x66, 0x44, 0x64, 0x46, + 0x80, 0xF0, 0x60, 0x46, 0x80, 0xF8, 0x65, 0x46, 0x65, 0x43, 0x80, 0xF0, 0x01, 0xFA, 0x80, 0xFC, + 0x64, 0x46, 0x80, 0xF8, 0x0B, 0x00, 0x64, 0x46, 0x62, 0x43, 0x00, 0xF2, 0xA3, 0xDB, 0x60, 0x46, + 0x80, 0xF0, 0x81, 0xFC, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x60, 0x43, 0x61, 0x46, 0x86, 0xF1, + 0x17, 0x60, 0x02, 0x61, 0xA1, 0xD3, 0xDA, 0x81, 0xD0, 0x80, 0xDC, 0x9C, 0x05, 0x05, 0xA1, 0xD3, + 0x4A, 0xD9, 0xA0, 0xDD, 0xDA, 0x9C, 0xA1, 0xD9, 0xD6, 0x60, 0x09, 0x78, 0xFF, 0xFF, 0x0B, 0x60, + 0x81, 0xF3, 0xFF, 0xFF, 0x62, 0x18, 0x17, 0x60, 0x02, 0x64, 0x04, 0xA5, 0xA0, 0xD1, 0x72, 0x44, + 0xFF, 0xB4, 0x64, 0x40, 0xE0, 0x22, 0x1F, 0xB4, 0x64, 0x40, 0xF8, 0x22, 0x07, 0xB4, 0x02, 0x00, + 0x03, 0x04, 0xD0, 0x84, 0xD0, 0x80, 0xFC, 0x01, 0xE0, 0x84, 0x44, 0xD3, 0xFF, 0xFF, 0x60, 0x43, + 0x66, 0x41, 0x63, 0x46, 0x05, 0xF2, 0x00, 0xF0, 0x81, 0xF0, 0x02, 0x18, 0x64, 0x46, 0x81, 0xF8, + 0x07, 0x1B, 0x15, 0x60, 0x02, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD9, 0x02, 0x00, + 0x65, 0x46, 0x00, 0xF8, 0x87, 0xF3, 0x63, 0x45, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xD4, 0x80, + 0x01, 0x18, 0xFA, 0x04, 0x80, 0xF8, 0x65, 0x46, 0x00, 0xFA, 0x06, 0xF2, 0xFF, 0xFF, 0x00, 0x7E, + 0x06, 0xFA, 0x61, 0x46, 0x2E, 0xF0, 0x66, 0x41, 0x15, 0x60, 0x02, 0x65, 0x64, 0x47, 0x00, 0x7F, + 0x87, 0xF1, 0xE0, 0x84, 0x44, 0xD3, 0x64, 0x43, 0x11, 0x18, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, + 0xFC, 0x1B, 0x66, 0x44, 0x64, 0x46, 0x80, 0xF0, 0x60, 0x46, 0x80, 0xF8, 0x65, 0x46, 0x65, 0x43, + 0x80, 0xF0, 0x01, 0xFA, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x0B, 0x00, 0x64, 0x46, 0x62, 0x43, + 0x00, 0xF2, 0xA3, 0xDB, 0x60, 0x46, 0x80, 0xF0, 0x81, 0xFC, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, + 0x60, 0x43, 0x61, 0x46, 0xD6, 0x60, 0x09, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x02, 0x61, 0xB5, 0x60, + 0x58, 0x4D, 0xA2, 0x78, 0xFF, 0xFF, 0x86, 0xF1, 0x72, 0x44, 0xFF, 0xB4, 0xD0, 0x80, 0xFF, 0xFF, + 0x02, 0x04, 0xD0, 0x84, 0xFB, 0x01, 0xE0, 0x83, 0x87, 0xF3, 0x02, 0xA3, 0x43, 0x93, 0x66, 0x44, + 0x00, 0xA8, 0x56, 0xFD, 0x3A, 0x03, 0x00, 0x64, 0x2B, 0xFA, 0x00, 0x60, 0xC0, 0x64, 0x2A, 0xFA, + 0x66, 0x45, 0x63, 0x46, 0x03, 0xF2, 0x04, 0xF0, 0x85, 0xF2, 0x65, 0x46, 0x2C, 0xFA, 0x2D, 0xF8, + 0xAE, 0xFA, 0xCB, 0xF3, 0x2F, 0xFA, 0x32, 0xFA, 0xCC, 0xF3, 0x30, 0xFA, 0x33, 0xFA, 0xCD, 0xF3, + 0x31, 0xFA, 0x34, 0xFA, 0xAB, 0xF1, 0x19, 0xF8, 0xFF, 0x67, 0x0E, 0xFA, 0x66, 0x41, 0x43, 0x49, + 0x29, 0x46, 0x92, 0xF0, 0x2C, 0x60, 0x26, 0x63, 0x47, 0xD3, 0x61, 0x46, 0x02, 0x63, 0x00, 0x7E, + 0x13, 0xFA, 0x3F, 0xFC, 0x00, 0x64, 0x3E, 0xFA, 0x87, 0xF3, 0x07, 0xFA, 0x66, 0x41, 0x00, 0xF4, + 0x05, 0x64, 0x09, 0xFA, 0x1E, 0x60, 0xD4, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x61, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x56, 0xF3, 0xA3, 0xFF, 0x60, 0x43, + 0xE7, 0x60, 0x58, 0x4E, 0x81, 0x78, 0xFF, 0xFF, 0x56, 0xF3, 0xFF, 0xFF, 0x40, 0x58, 0x03, 0x65, + 0xE5, 0x60, 0x58, 0x4E, 0x51, 0x78, 0xFF, 0xFF, 0x56, 0xF3, 0x26, 0x46, 0x60, 0x43, 0x66, 0x41, + 0x63, 0x46, 0x05, 0xF2, 0x00, 0xF0, 0x81, 0xF0, 0x02, 0x18, 0x64, 0x46, 0x81, 0xF8, 0x07, 0x1B, + 0x15, 0x60, 0x02, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD9, 0x02, 0x00, 0x65, 0x46, + 0x00, 0xF8, 0x87, 0xF3, 0x63, 0x45, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xD4, 0x80, 0x01, 0x18, + 0xFA, 0x04, 0x80, 0xF8, 0x65, 0x46, 0x00, 0xFA, 0x06, 0xF2, 0xFF, 0xFF, 0x00, 0x7E, 0x06, 0xFA, + 0x61, 0x46, 0x2E, 0xF0, 0x66, 0x41, 0x15, 0x60, 0x02, 0x65, 0x64, 0x47, 0x00, 0x7F, 0x87, 0xF1, + 0xE0, 0x84, 0x44, 0xD3, 0x64, 0x43, 0x11, 0x18, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xFC, 0x1B, + 0x66, 0x44, 0x64, 0x46, 0x80, 0xF0, 0x60, 0x46, 0x80, 0xF8, 0x65, 0x46, 0x65, 0x43, 0x80, 0xF0, + 0x01, 0xFA, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x0B, 0x00, 0x64, 0x46, 0x62, 0x43, 0x00, 0xF2, + 0xA3, 0xDB, 0x60, 0x46, 0x80, 0xF0, 0x81, 0xFC, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x60, 0x43, + 0x61, 0x46, 0x2C, 0xF2, 0x2D, 0xF0, 0xAE, 0xF2, 0x66, 0x45, 0x63, 0x46, 0x03, 0xFA, 0x04, 0xF8, + 0x55, 0xF3, 0x85, 0xFA, 0xFF, 0xA0, 0x65, 0x46, 0x03, 0x03, 0xD7, 0x60, 0xAE, 0x78, 0xFF, 0xFF, + 0x94, 0xF3, 0x66, 0x45, 0x63, 0x46, 0x1F, 0xFA, 0x65, 0x46, 0xBA, 0x65, 0x60, 0x44, 0xC4, 0x85, + 0x01, 0x60, 0xFE, 0x61, 0x00, 0x64, 0x80, 0x63, 0xC7, 0x85, 0x94, 0x84, 0x59, 0xDB, 0xFC, 0x1F, + 0x00, 0x60, 0x88, 0x64, 0x3F, 0xFA, 0x00, 0xF4, 0x02, 0x64, 0x0A, 0xFA, 0x00, 0x64, 0x0B, 0xFA, + 0x80, 0x7F, 0x10, 0x7E, 0x0C, 0xFA, 0x1A, 0x65, 0x80, 0x61, 0x02, 0x60, 0x00, 0x63, 0x0F, 0x4E, + 0xF8, 0x60, 0x58, 0x4F, 0x7A, 0x78, 0xFF, 0xFF, 0x0E, 0x4F, 0xD7, 0x60, 0x80, 0x78, 0xFF, 0xFF, + 0x26, 0x46, 0x23, 0xF0, 0x00, 0x60, 0x02, 0x64, 0xA0, 0x80, 0x00, 0xF4, 0x03, 0x03, 0xD7, 0x60, + 0x2A, 0x78, 0xFF, 0xFF, 0x09, 0xF2, 0xFF, 0xFF, 0xFF, 0xA0, 0x00, 0xA0, 0x0C, 0x03, 0x03, 0x03, + 0xD6, 0x60, 0xA7, 0x78, 0xFF, 0xFF, 0x0A, 0xF2, 0x26, 0x46, 0xFF, 0xA0, 0x87, 0xF4, 0x10, 0x02, + 0xD7, 0x60, 0xAE, 0x78, 0xFF, 0xFF, 0x0A, 0xF2, 0xFF, 0xFF, 0xFF, 0xA0, 0xFD, 0xA0, 0x02, 0x03, + 0x04, 0x03, 0x06, 0x00, 0xD6, 0x60, 0xE6, 0x78, 0xFF, 0xFF, 0xD6, 0x60, 0xF1, 0x78, 0xFF, 0xFF, + 0x26, 0x46, 0x87, 0xF4, 0x66, 0x41, 0x63, 0x46, 0x05, 0xF2, 0x00, 0xF0, 0x81, 0xF0, 0x02, 0x18, + 0x64, 0x46, 0x81, 0xF8, 0x07, 0x1B, 0x15, 0x60, 0x02, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, + 0x44, 0xD9, 0x02, 0x00, 0x65, 0x46, 0x00, 0xF8, 0x87, 0xF3, 0x63, 0x45, 0x60, 0x46, 0x00, 0xF2, + 0xFF, 0xFF, 0xD4, 0x80, 0x01, 0x18, 0xFA, 0x04, 0x80, 0xF8, 0x65, 0x46, 0x00, 0xFA, 0x06, 0xF2, + 0xFF, 0xFF, 0x00, 0x7E, 0x06, 0xFA, 0x61, 0x46, 0x0B, 0x60, 0x82, 0xF3, 0xDA, 0x81, 0x60, 0x45, + 0xD5, 0x80, 0xA1, 0xD1, 0x11, 0x03, 0xD3, 0x80, 0xD9, 0x81, 0xFA, 0x02, 0xC9, 0x81, 0xC8, 0x85, + 0xD5, 0x80, 0xA5, 0xD3, 0x08, 0x28, 0xA1, 0xDB, 0x17, 0x60, 0x04, 0x62, 0x65, 0x44, 0xA2, 0xDB, + 0x4A, 0xD3, 0xFF, 0xFF, 0xCC, 0x84, 0xA2, 0xDB, 0xD4, 0x60, 0xA4, 0x78, 0xFF, 0xFF, 0x26, 0x46, + 0x87, 0xF4, 0x66, 0x41, 0x63, 0x46, 0x05, 0xF2, 0x00, 0xF0, 0x81, 0xF0, 0x02, 0x18, 0x64, 0x46, + 0x81, 0xF8, 0x07, 0x1B, 0x15, 0x60, 0x02, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD9, + 0x02, 0x00, 0x65, 0x46, 0x00, 0xF8, 0x87, 0xF3, 0x63, 0x45, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, + 0xD4, 0x80, 0x01, 0x18, 0xFA, 0x04, 0x80, 0xF8, 0x65, 0x46, 0x00, 0xFA, 0x06, 0xF2, 0xFF, 0xFF, + 0x00, 0x7E, 0x06, 0xFA, 0x61, 0x46, 0x0B, 0x60, 0x82, 0xF3, 0xDA, 0x81, 0x60, 0x45, 0xD5, 0x80, + 0xA1, 0xD1, 0x11, 0x03, 0xD3, 0x80, 0xD9, 0x81, 0xFA, 0x02, 0xC9, 0x81, 0xC8, 0x85, 0xD5, 0x80, + 0xA5, 0xD3, 0x08, 0x28, 0xA1, 0xDB, 0x17, 0x60, 0x04, 0x62, 0x65, 0x44, 0xA2, 0xDB, 0x4A, 0xD3, + 0xFF, 0xFF, 0xCC, 0x84, 0xA2, 0xDB, 0xD4, 0x60, 0xAF, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x32, 0x44, + 0x08, 0xB0, 0x87, 0xF4, 0x03, 0x02, 0xD4, 0x60, 0xAF, 0x78, 0xFF, 0xFF, 0xD6, 0x60, 0x18, 0x78, + 0xFF, 0xFF, 0x32, 0x44, 0x26, 0x46, 0x08, 0xB0, 0x07, 0xF2, 0x03, 0x02, 0xD4, 0x60, 0xAF, 0x78, + 0xFF, 0xFF, 0x60, 0x46, 0x1F, 0xF2, 0x26, 0x46, 0xBA, 0x65, 0x60, 0x44, 0xC4, 0x85, 0x01, 0x60, + 0xFE, 0x61, 0x00, 0x64, 0x80, 0x63, 0xC7, 0x85, 0x94, 0x84, 0x59, 0xDB, 0xFC, 0x1F, 0x00, 0xF4, + 0x01, 0x60, 0xFE, 0x61, 0x7E, 0x65, 0x18, 0x63, 0x5B, 0xD2, 0x59, 0xD1, 0xFF, 0xFF, 0xD0, 0x80, + 0xD7, 0x80, 0x18, 0x02, 0xF9, 0x02, 0x00, 0xF4, 0x02, 0x63, 0x0E, 0x65, 0x5B, 0xD2, 0x59, 0xD1, + 0xFF, 0xFF, 0xD0, 0x80, 0xD7, 0x80, 0x0E, 0x02, 0xF9, 0x02, 0x26, 0x46, 0x07, 0xF4, 0x06, 0xF2, + 0xFF, 0xFF, 0x01, 0x7E, 0x06, 0xFA, 0x26, 0x46, 0x00, 0xF4, 0x04, 0x64, 0x0A, 0xFA, 0x00, 0x64, + 0x0B, 0xFA, 0x56, 0x00, 0x26, 0x46, 0x87, 0xF4, 0x66, 0x41, 0x63, 0x46, 0x05, 0xF2, 0x00, 0xF0, + 0x81, 0xF0, 0x02, 0x18, 0x64, 0x46, 0x81, 0xF8, 0x07, 0x1B, 0x15, 0x60, 0x02, 0x65, 0x60, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD9, 0x02, 0x00, 0x65, 0x46, 0x00, 0xF8, 0x87, 0xF3, 0x63, 0x45, + 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xD4, 0x80, 0x01, 0x18, 0xFA, 0x04, 0x80, 0xF8, 0x65, 0x46, + 0x00, 0xFA, 0x06, 0xF2, 0xFF, 0xFF, 0x00, 0x7E, 0x06, 0xFA, 0x61, 0x46, 0x0B, 0x60, 0x82, 0xF3, + 0xDA, 0x81, 0x60, 0x45, 0xD5, 0x80, 0xA1, 0xD1, 0x11, 0x03, 0xD3, 0x80, 0xD9, 0x81, 0xFA, 0x02, + 0xC9, 0x81, 0xC8, 0x85, 0xD5, 0x80, 0xA5, 0xD3, 0x08, 0x28, 0xA1, 0xDB, 0x17, 0x60, 0x04, 0x62, + 0x65, 0x44, 0xA2, 0xDB, 0x4A, 0xD3, 0xFF, 0xFF, 0xCC, 0x84, 0xA2, 0xDB, 0x00, 0xF4, 0x04, 0x64, + 0x0A, 0xFA, 0x0F, 0x64, 0x0B, 0xFA, 0x40, 0x59, 0x02, 0x60, 0x00, 0x61, 0x41, 0x58, 0x26, 0x46, + 0x2C, 0xF2, 0xA1, 0xDB, 0x2D, 0xF2, 0x59, 0xDB, 0x2E, 0xF2, 0x59, 0xDB, 0x03, 0x65, 0xE5, 0x60, + 0x58, 0x4E, 0x27, 0x78, 0xFF, 0xFF, 0x03, 0x65, 0xE5, 0x60, 0x58, 0x4E, 0x51, 0x78, 0xFF, 0xFF, + 0x26, 0x46, 0x87, 0xF3, 0x07, 0xFA, 0x1E, 0x60, 0xD4, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x26, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x00, 0x66, 0x46, 0x46, + 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0xF4, 0x0A, 0xF2, 0x09, 0xF2, 0xFF, 0xA0, 0x00, 0xA0, 0x06, 0x02, + 0xFF, 0xA0, 0x07, 0x03, 0x09, 0x03, 0xD6, 0x60, 0xA7, 0x78, 0xFF, 0xFF, 0xD6, 0x60, 0x68, 0x78, + 0xFF, 0xFF, 0xD7, 0x60, 0xB3, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x07, 0xF4, 0x06, 0xF2, 0x66, 0x43, + 0x00, 0x7E, 0x06, 0xFA, 0x26, 0x46, 0xD6, 0x60, 0x18, 0x78, 0xFF, 0xFF, 0x63, 0x46, 0x06, 0xF2, + 0xFF, 0xFF, 0x01, 0x7E, 0x06, 0xFA, 0x26, 0x46, 0x87, 0xF3, 0x07, 0xFA, 0x00, 0xF4, 0x02, 0x64, + 0x0A, 0xFA, 0x00, 0x64, 0x0B, 0xFA, 0x1E, 0x60, 0xD4, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x26, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x00, 0x66, 0x46, 0x46, + 0x2F, 0x58, 0xFF, 0xFF, 0x01, 0x61, 0x00, 0x60, 0x10, 0x7C, 0x2A, 0xF2, 0x0C, 0x60, 0x70, 0xFB, + 0xFF, 0xB4, 0x16, 0x60, 0x83, 0xFB, 0x60, 0x40, 0x00, 0x36, 0x03, 0x00, 0x02, 0x61, 0x00, 0x60, + 0x30, 0x7C, 0x41, 0x47, 0x2A, 0xF8, 0x2F, 0xF2, 0x2C, 0xFA, 0x30, 0xF2, 0x2D, 0xFA, 0x31, 0xF2, + 0x2E, 0xFA, 0xCB, 0xF3, 0x2F, 0xFA, 0xCC, 0xF3, 0x30, 0xFA, 0xCD, 0xF3, 0x31, 0xFA, 0x66, 0xF3, + 0x32, 0xFA, 0x67, 0xF3, 0x33, 0xFA, 0x68, 0xF3, 0x34, 0xFA, 0xAB, 0xF1, 0x19, 0xF8, 0x00, 0x7C, + 0x3E, 0xF8, 0x1C, 0xF0, 0x13, 0xF8, 0x07, 0xF2, 0x87, 0xF1, 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, + 0x03, 0x02, 0xDC, 0x60, 0x55, 0x78, 0xFF, 0xFF, 0x40, 0x4B, 0x01, 0x65, 0xEF, 0x60, 0x58, 0x4E, + 0xDC, 0x78, 0xFF, 0xFF, 0xAB, 0x46, 0x06, 0xF2, 0xAB, 0x46, 0x00, 0xF4, 0x01, 0xB0, 0xFF, 0xFF, + 0x03, 0x02, 0xDC, 0x60, 0x55, 0x78, 0xFF, 0xFF, 0x09, 0xF2, 0x16, 0x60, 0x84, 0xFB, 0x5A, 0x84, + 0x00, 0x63, 0x60, 0x40, 0x20, 0x26, 0x02, 0xBB, 0x60, 0x40, 0x04, 0x27, 0x04, 0xBB, 0xAB, 0x46, + 0x78, 0xFC, 0xAB, 0x46, 0xFF, 0xFF, 0x10, 0xB0, 0x80, 0x60, 0x00, 0x63, 0x0C, 0x03, 0x13, 0x60, + 0x45, 0xF1, 0xFF, 0xFF, 0x64, 0x44, 0xFE, 0x26, 0x08, 0x00, 0x32, 0x40, 0x08, 0x26, 0x06, 0x00, + 0xDC, 0x60, 0xB9, 0x78, 0xFF, 0xFF, 0x32, 0x40, 0x10, 0x2A, 0x00, 0x63, 0xAB, 0x46, 0x06, 0xF0, + 0x7F, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0x63, 0x45, 0xB4, 0x84, 0x06, 0xFA, 0xAB, 0x46, 0x0A, 0xF0, + 0x56, 0xF9, 0x24, 0xD9, 0x5A, 0x84, 0x01, 0x63, 0x32, 0x40, 0x10, 0x26, 0x10, 0xBB, 0x13, 0x60, + 0x45, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0xFE, 0x26, 0x10, 0xBB, 0x15, 0x60, 0xDD, 0xF1, 0x63, 0x44, + 0x20, 0xBC, 0xFB, 0x60, 0xFF, 0xB7, 0x64, 0x40, 0x10, 0x26, 0x04, 0xBC, 0x60, 0x47, 0x60, 0x43, + 0x09, 0xFC, 0x27, 0x44, 0xFE, 0xA0, 0xFF, 0xFF, 0x03, 0x03, 0xD8, 0x60, 0xC8, 0x78, 0xFF, 0xFF, + 0x18, 0x60, 0xD6, 0x64, 0x24, 0x43, 0x0B, 0xF0, 0xA0, 0xD9, 0xBD, 0xD9, 0x0C, 0xF0, 0x58, 0xD9, + 0xBD, 0xD9, 0x0D, 0xF0, 0x58, 0xD9, 0xBD, 0xD9, 0x43, 0x44, 0x26, 0x46, 0x87, 0xF2, 0x3F, 0xF2, + 0x41, 0x4B, 0x00, 0xF4, 0x60, 0x43, 0xF6, 0xA3, 0x00, 0x60, 0x1B, 0x61, 0x00, 0x60, 0x01, 0x65, + 0x01, 0x60, 0xFF, 0x64, 0x40, 0x4C, 0xEF, 0x60, 0x58, 0x4E, 0x79, 0x78, 0xFF, 0xFF, 0x00, 0xBB, + 0xFF, 0xFF, 0x00, 0x02, 0x00, 0x64, 0x40, 0x4A, 0x60, 0xFE, 0x02, 0x60, 0x00, 0x63, 0xBD, 0xD3, + 0xBD, 0xD3, 0x60, 0x41, 0xF0, 0x60, 0x58, 0x4E, 0x27, 0x78, 0xFF, 0xFF, 0x20, 0xFE, 0x26, 0x46, + 0x3F, 0xF2, 0x00, 0xF4, 0x60, 0x43, 0xF6, 0xA3, 0x00, 0x60, 0x1B, 0x61, 0x00, 0x60, 0x32, 0x65, + 0x01, 0x60, 0xFF, 0x64, 0x40, 0x4C, 0xEF, 0x60, 0x58, 0x4E, 0x79, 0x78, 0xFF, 0xFF, 0x00, 0xBB, + 0xFF, 0xFF, 0x0B, 0x03, 0x60, 0xFE, 0x02, 0x60, 0x00, 0x63, 0xBD, 0xD3, 0xBD, 0xD3, 0x60, 0x41, + 0xF0, 0x60, 0x58, 0x4E, 0x27, 0x78, 0xFF, 0xFF, 0x00, 0x00, 0x20, 0xFE, 0x30, 0x60, 0x20, 0x61, + 0xA1, 0xD1, 0x82, 0xF3, 0x01, 0x60, 0x6E, 0x63, 0x60, 0x45, 0x2A, 0x44, 0x60, 0xFB, 0xA3, 0xD5, + 0x65, 0x40, 0x01, 0x27, 0x5B, 0xD5, 0x65, 0x40, 0x01, 0x27, 0x59, 0xD1, 0x66, 0x41, 0xA0, 0x84, + 0x24, 0x94, 0x2B, 0x46, 0x0F, 0xFA, 0x61, 0xFB, 0x16, 0x64, 0x12, 0xFA, 0x01, 0x64, 0x11, 0xFA, + 0x66, 0x5C, 0xC1, 0x60, 0x58, 0x4E, 0x93, 0x78, 0xFF, 0xFF, 0xD9, 0x60, 0x28, 0x78, 0xFF, 0xFF, + 0x26, 0x46, 0x87, 0xF2, 0x3F, 0xF2, 0x41, 0x4B, 0x00, 0xF4, 0x60, 0x43, 0xFC, 0xA3, 0x00, 0x60, + 0x15, 0x61, 0x00, 0x60, 0x01, 0x65, 0x01, 0x60, 0xFF, 0x64, 0x40, 0x4C, 0xEF, 0x60, 0x58, 0x4E, + 0x79, 0x78, 0xFF, 0xFF, 0x00, 0xBB, 0xFF, 0xFF, 0x00, 0x02, 0x00, 0x64, 0x40, 0x4A, 0x60, 0xFE, + 0x02, 0x60, 0x00, 0x63, 0xBD, 0xD3, 0xBD, 0xD3, 0x60, 0x41, 0xF0, 0x60, 0x58, 0x4E, 0x27, 0x78, + 0xFF, 0xFF, 0x20, 0xFE, 0x26, 0x46, 0x3F, 0xF2, 0x00, 0xF4, 0x60, 0x43, 0xFC, 0xA3, 0x00, 0x60, + 0x15, 0x61, 0x00, 0x60, 0x32, 0x65, 0x01, 0x60, 0xFF, 0x64, 0x40, 0x4C, 0xEF, 0x60, 0x58, 0x4E, + 0x79, 0x78, 0xFF, 0xFF, 0x00, 0xBB, 0xFF, 0xFF, 0x0B, 0x03, 0x60, 0xFE, 0x02, 0x60, 0x00, 0x63, + 0xBD, 0xD3, 0xBD, 0xD3, 0x60, 0x41, 0xF0, 0x60, 0x58, 0x4E, 0x27, 0x78, 0xFF, 0xFF, 0x00, 0x00, + 0x20, 0xFE, 0x30, 0x60, 0x20, 0x61, 0xA1, 0xD1, 0x82, 0xF3, 0x01, 0x60, 0x6E, 0x63, 0x60, 0x45, + 0x2A, 0x44, 0x60, 0xFB, 0xA3, 0xD5, 0x65, 0x40, 0x01, 0x27, 0x5B, 0xD5, 0x65, 0x40, 0x01, 0x27, + 0x59, 0xD1, 0x66, 0x41, 0xA0, 0x84, 0x24, 0x94, 0x2B, 0x46, 0x0F, 0xFA, 0x61, 0xFB, 0x16, 0x64, + 0x12, 0xFA, 0x01, 0x64, 0x11, 0xFA, 0x66, 0x5C, 0xC1, 0x60, 0x58, 0x4E, 0x93, 0x78, 0xFF, 0xFF, + 0x2B, 0x46, 0x0F, 0xF2, 0x12, 0x63, 0x7C, 0x18, 0x26, 0x46, 0x87, 0xF2, 0x01, 0x65, 0x41, 0x4B, + 0xAB, 0x46, 0x0F, 0xF2, 0xFF, 0xFF, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xFF, 0x22, + 0x00, 0x65, 0x78, 0xF2, 0xFF, 0xFF, 0xB4, 0x84, 0x78, 0xFA, 0xAB, 0x46, 0xFF, 0xFF, 0x26, 0x46, + 0x3F, 0xF2, 0x00, 0xF4, 0x16, 0x65, 0x27, 0x40, 0x02, 0x3A, 0x03, 0x00, 0x1C, 0x65, 0xF6, 0xA4, + 0x01, 0x00, 0xFC, 0xA4, 0x24, 0x43, 0x2D, 0x60, 0x5E, 0x61, 0x5D, 0x91, 0x51, 0x90, 0xFF, 0xFF, + 0x04, 0x28, 0x60, 0x41, 0xCD, 0x84, 0x4C, 0x91, 0x60, 0x43, 0x60, 0xFE, 0xA5, 0xD2, 0xDE, 0x85, + 0x7F, 0x26, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0x5D, 0x93, 0xA3, 0xDB, 0x5D, 0x93, 0xA5, 0xD2, + 0xF6, 0x1F, 0x5D, 0x93, 0x20, 0xFE, 0xDF, 0x83, 0x2D, 0x60, 0x04, 0x7C, 0x03, 0x1E, 0x60, 0xFE, + 0xBD, 0xDF, 0x20, 0xFE, 0x2D, 0x60, 0x08, 0x64, 0x53, 0x93, 0xA4, 0xDD, 0x26, 0x46, 0x00, 0xF4, + 0x13, 0x60, 0x44, 0xF3, 0x00, 0x63, 0x00, 0xB8, 0x0A, 0xFC, 0x03, 0x02, 0xD9, 0x60, 0xCF, 0x78, + 0xFF, 0xFF, 0x0B, 0xF2, 0x27, 0x40, 0x02, 0x3A, 0x02, 0x00, 0x0E, 0xF2, 0xFF, 0xFF, 0x60, 0x47, + 0x00, 0x3A, 0x25, 0x00, 0x60, 0x41, 0x00, 0x36, 0x22, 0x00, 0xE0, 0xA0, 0xDA, 0x85, 0x1F, 0x07, + 0x13, 0x60, 0x0B, 0xF1, 0x65, 0x42, 0xD1, 0x80, 0x26, 0x60, 0x18, 0x63, 0x18, 0x02, 0x50, 0xFE, + 0x61, 0x40, 0xFE, 0x22, 0x08, 0x00, 0x62, 0x45, 0xBD, 0xD3, 0xA5, 0xD0, 0xDA, 0x82, 0xD0, 0x80, + 0xC9, 0x81, 0xF6, 0x0C, 0x0C, 0x00, 0x61, 0x40, 0x00, 0x36, 0x31, 0x00, 0x62, 0x45, 0xA3, 0xD3, + 0xA5, 0xD0, 0xFF, 0xFF, 0x90, 0x80, 0xFF, 0x26, 0x02, 0x00, 0xDE, 0x82, 0x28, 0x00, 0x0C, 0x63, + 0x0A, 0xFC, 0x00, 0x64, 0x09, 0xFA, 0x0B, 0xFA, 0x01, 0x7E, 0x0C, 0xFA, 0x26, 0x46, 0x08, 0x64, + 0x3F, 0xFA, 0x07, 0xF2, 0x87, 0xF1, 0x40, 0x58, 0x07, 0xF8, 0x1E, 0x60, 0xD4, 0x64, 0x0F, 0x60, + 0x90, 0xFB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, + 0xDC, 0x60, 0xD4, 0x78, 0xFF, 0xFF, 0x20, 0xFE, 0x16, 0x60, 0x50, 0xF3, 0xFF, 0xFF, 0x22, 0xB0, + 0xFF, 0xFF, 0x03, 0x03, 0xDB, 0x60, 0xB1, 0x78, 0xFF, 0xFF, 0x01, 0x63, 0xD9, 0x01, 0x13, 0x60, + 0x45, 0xF3, 0xFF, 0xFF, 0xFF, 0xA4, 0xFF, 0xFF, 0x0C, 0x20, 0x03, 0x00, 0xDB, 0x60, 0xB1, 0x78, + 0xFF, 0xFF, 0x00, 0x64, 0x16, 0x60, 0x56, 0xFB, 0x16, 0x60, 0x57, 0xFB, 0x16, 0x60, 0x58, 0xFB, + 0x16, 0x60, 0x5A, 0xFB, 0x16, 0x60, 0x5B, 0xFB, 0x16, 0x60, 0x5C, 0xFB, 0x16, 0x60, 0x5D, 0xFB, + 0x18, 0x60, 0x17, 0xFB, 0x2B, 0x46, 0x3B, 0xF2, 0x7F, 0x60, 0xCF, 0x65, 0xA4, 0x84, 0xA2, 0xDA, + 0x26, 0x46, 0x00, 0xF4, 0x0B, 0xF2, 0x27, 0x40, 0x02, 0x3A, 0x02, 0x00, 0x0E, 0xF2, 0xFF, 0xFF, + 0xCE, 0x81, 0x20, 0xFE, 0x30, 0x60, 0x28, 0x64, 0x40, 0x4A, 0xDA, 0x60, 0x58, 0x4D, 0x62, 0x78, + 0xFF, 0xFF, 0x20, 0xFE, 0x18, 0x60, 0x17, 0xF3, 0xFF, 0xFF, 0x08, 0x18, 0x18, 0x60, 0x19, 0xF3, + 0x18, 0x60, 0x1A, 0xF5, 0x60, 0x41, 0x30, 0x60, 0x2E, 0x62, 0xA2, 0xDF, 0x2A, 0xD1, 0xDA, 0x85, + 0x64, 0x44, 0x01, 0xA0, 0xFF, 0xFF, 0x01, 0x02, 0x75, 0x00, 0x45, 0x4A, 0x7C, 0x44, 0x60, 0xFE, + 0xA1, 0xD2, 0xFF, 0xFF, 0xD0, 0x80, 0x20, 0xFE, 0x01, 0x03, 0xE3, 0x01, 0x30, 0x60, 0x2E, 0x62, + 0xA2, 0xDF, 0x60, 0xFE, 0x5D, 0xD2, 0xFF, 0xFF, 0x60, 0x5C, 0x41, 0x94, 0x81, 0xA0, 0x20, 0xFE, + 0x2D, 0x04, 0x01, 0x64, 0x18, 0x60, 0x17, 0xFB, 0xC1, 0x84, 0x84, 0xA4, 0x18, 0x60, 0x19, 0xFB, + 0x00, 0xF2, 0x18, 0x60, 0x1A, 0xFB, 0x18, 0x60, 0x18, 0xFD, 0x02, 0x60, 0x00, 0x63, 0xCD, 0x85, + 0x64, 0x44, 0xD8, 0x81, 0xCD, 0x84, 0x4C, 0x91, 0x60, 0x43, 0x60, 0xFE, 0xA5, 0xD2, 0xDE, 0x85, + 0x7F, 0x26, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0x5D, 0x93, 0xA3, 0xDB, 0x5D, 0x93, 0xA5, 0xD2, + 0xF6, 0x1F, 0x5D, 0x93, 0x20, 0xFE, 0xDF, 0x83, 0x00, 0x60, 0x01, 0x61, 0x02, 0x60, 0x00, 0x64, + 0xE0, 0x87, 0x60, 0x46, 0x18, 0x60, 0x18, 0xF3, 0xFF, 0xFF, 0x60, 0x43, 0x60, 0xFE, 0xCD, 0x81, + 0x20, 0xFE, 0x2A, 0x44, 0x00, 0x60, 0x02, 0x65, 0x44, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0xDB, 0x60, + 0x5C, 0x78, 0xFF, 0xFF, 0x18, 0x60, 0x17, 0xF3, 0xFF, 0xFF, 0x08, 0x18, 0x18, 0x60, 0x19, 0xF3, + 0x18, 0x60, 0x1A, 0xF5, 0x60, 0x41, 0x30, 0x60, 0x2E, 0x62, 0xA2, 0xDF, 0x66, 0x5C, 0x26, 0x46, + 0x00, 0xF2, 0x64, 0x46, 0x58, 0x90, 0xFF, 0xFF, 0x03, 0x02, 0x61, 0x44, 0x0B, 0xA5, 0x04, 0x00, + 0x61, 0x44, 0xFC, 0xA4, 0x8B, 0x7C, 0xC0, 0x85, 0xDD, 0x81, 0x66, 0x44, 0x18, 0x60, 0x1A, 0xFB, + 0x26, 0x46, 0x1B, 0xF0, 0x18, 0x60, 0x1A, 0xF5, 0x64, 0x44, 0xD4, 0x80, 0xFF, 0xFF, 0xD7, 0x06, + 0x2D, 0x58, 0xFF, 0xFF, 0x60, 0xFE, 0x5D, 0xD2, 0xFF, 0xFF, 0x20, 0xFE, 0xFF, 0xB4, 0x41, 0x94, + 0x81, 0xA0, 0xFF, 0xFF, 0x02, 0x04, 0x00, 0xF4, 0x84, 0xA4, 0x60, 0x41, 0x62, 0x01, 0x60, 0xFE, + 0x5D, 0xD2, 0xFF, 0xFF, 0xFA, 0xA4, 0xFF, 0xFF, 0x04, 0x20, 0x02, 0x00, 0xFF, 0xA1, 0x61, 0x01, + 0x5D, 0xD0, 0xFF, 0xFF, 0x64, 0x40, 0x00, 0x36, 0x02, 0x00, 0xC9, 0x81, 0x5A, 0x01, 0x5D, 0xD0, + 0xFF, 0xFF, 0x64, 0x40, 0x50, 0x36, 0x02, 0x00, 0xFD, 0xA1, 0x53, 0x01, 0x5D, 0xD0, 0xFF, 0xFF, + 0x64, 0x40, 0xF2, 0x36, 0x04, 0x00, 0xFC, 0xA1, 0xDA, 0x60, 0x01, 0x78, 0xFF, 0xFF, 0x5D, 0xD0, + 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x36, 0x04, 0x00, 0xFB, 0xA1, 0xDA, 0x60, 0x01, 0x78, 0xFF, 0xFF, + 0x5D, 0xD0, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x36, 0x04, 0x00, 0xFA, 0xA1, 0xDA, 0x60, 0x01, 0x78, + 0xFF, 0xFF, 0x5D, 0xD0, 0xFF, 0xFF, 0x64, 0x40, 0x00, 0x36, 0x04, 0x00, 0xF9, 0xA1, 0xDA, 0x60, + 0x01, 0x78, 0xFF, 0xFF, 0x60, 0x5C, 0x00, 0x36, 0x2A, 0x00, 0x00, 0x64, 0xDB, 0x60, 0x58, 0x4E, + 0x16, 0x78, 0xFF, 0xFF, 0x16, 0x60, 0x5A, 0xFB, 0x64, 0x40, 0x00, 0x36, 0x25, 0x00, 0x5D, 0xD2, + 0xDD, 0x81, 0xDB, 0x60, 0x58, 0x4E, 0x16, 0x78, 0xFF, 0xFF, 0x16, 0x60, 0x5B, 0xFB, 0x64, 0x40, + 0x00, 0x36, 0x1F, 0x00, 0x5D, 0xD2, 0xDD, 0x81, 0xDB, 0x60, 0x58, 0x4E, 0x16, 0x78, 0xFF, 0xFF, + 0x16, 0x60, 0x5C, 0xFB, 0x64, 0x40, 0x00, 0x36, 0x19, 0x00, 0x5D, 0xD0, 0x16, 0x60, 0x5D, 0xF9, + 0x5D, 0xD0, 0x2C, 0x60, 0xBB, 0x62, 0xA2, 0xD9, 0xD9, 0x60, 0xF9, 0x78, 0xFF, 0xFF, 0x20, 0xFE, + 0x00, 0x60, 0x04, 0x64, 0x16, 0x60, 0x5A, 0xFB, 0x20, 0xFE, 0x00, 0x60, 0x04, 0x64, 0x16, 0x60, + 0x5B, 0xFB, 0x20, 0xFE, 0x00, 0x60, 0x02, 0x64, 0x16, 0x60, 0x5C, 0xFB, 0x20, 0xFE, 0x00, 0x60, + 0x00, 0x64, 0x16, 0x60, 0x5D, 0xFB, 0xD9, 0x60, 0xF9, 0x78, 0xFF, 0xFF, 0x16, 0x60, 0x5E, 0xFB, + 0xE0, 0x84, 0xE0, 0x84, 0x03, 0x02, 0x01, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x02, 0xA5, 0x64, 0x44, + 0xD4, 0x9C, 0x16, 0x60, 0x5F, 0xF9, 0x2C, 0x60, 0xC0, 0x62, 0xA2, 0xDF, 0x5D, 0xD0, 0x00, 0x65, + 0x64, 0x40, 0x00, 0x3A, 0x01, 0x65, 0x5D, 0xD0, 0xFF, 0xFF, 0x64, 0x40, 0x50, 0x3A, 0x01, 0x65, + 0x5D, 0xD0, 0xFF, 0xFF, 0x64, 0x40, 0xF2, 0x3A, 0x01, 0x65, 0x5D, 0xD0, 0x65, 0x40, 0x00, 0x3A, + 0x17, 0x00, 0x00, 0x60, 0x00, 0x65, 0x64, 0x40, 0x00, 0x36, 0x01, 0x65, 0x64, 0x40, 0x01, 0x36, + 0x02, 0x65, 0x64, 0x40, 0x02, 0x36, 0x04, 0x65, 0x64, 0x40, 0x04, 0x36, 0x10, 0x65, 0x64, 0x40, + 0x05, 0x36, 0x20, 0x65, 0x65, 0x5C, 0x16, 0x60, 0x60, 0xF3, 0xFF, 0xFF, 0xB0, 0x84, 0xA2, 0xDB, + 0x16, 0x60, 0x5E, 0xF3, 0xFF, 0xFF, 0xFF, 0xA4, 0xA2, 0xDB, 0xD0, 0x02, 0x16, 0x60, 0x60, 0xF3, + 0x16, 0x60, 0x5F, 0xF1, 0x2E, 0x58, 0xFF, 0xFF, 0x20, 0xFE, 0x16, 0x60, 0x50, 0xF1, 0x16, 0x60, + 0x5A, 0xF3, 0xFF, 0xFF, 0xA0, 0x84, 0xFF, 0xFF, 0x10, 0x26, 0x09, 0x00, 0x04, 0x26, 0x09, 0x00, + 0x20, 0x26, 0x09, 0x00, 0x02, 0x26, 0x09, 0x00, 0xD9, 0x60, 0xC3, 0x78, 0xFF, 0xFF, 0x10, 0x7C, + 0x05, 0x00, 0x04, 0x7C, 0x03, 0x00, 0x20, 0x7C, 0x01, 0x00, 0x02, 0x7C, 0x16, 0x60, 0x56, 0xF9, + 0x16, 0x60, 0x51, 0xF1, 0x16, 0x60, 0x5B, 0xF3, 0x2C, 0x60, 0xAC, 0x62, 0xA0, 0x84, 0xA2, 0xD1, + 0xFF, 0xFF, 0x10, 0x26, 0x07, 0x00, 0x04, 0x26, 0x07, 0x00, 0x01, 0x26, 0x0D, 0x00, 0xD9, 0x60, + 0xC3, 0x78, 0xFF, 0xFF, 0x10, 0x7C, 0x09, 0x00, 0x64, 0x40, 0x10, 0x22, 0x03, 0x00, 0xD9, 0x60, + 0xC3, 0x78, 0xFF, 0xFF, 0x04, 0x7C, 0x01, 0x00, 0x01, 0x7C, 0x16, 0x60, 0x57, 0xF9, 0x16, 0x60, + 0x52, 0xF1, 0x16, 0x60, 0x5C, 0xF3, 0xFF, 0xFF, 0xA0, 0x84, 0x02, 0x26, 0x07, 0x00, 0x04, 0x26, + 0x07, 0x00, 0x01, 0x26, 0x07, 0x00, 0xD9, 0x60, 0xC3, 0x78, 0xFF, 0xFF, 0x02, 0x7C, 0x03, 0x00, + 0x04, 0x7C, 0x01, 0x00, 0x20, 0x7C, 0x16, 0x60, 0x58, 0xF9, 0x16, 0x60, 0x5D, 0xF1, 0x16, 0x60, + 0x59, 0xF9, 0x16, 0x60, 0x58, 0xF3, 0x16, 0x60, 0x57, 0xF1, 0x60, 0x47, 0xB0, 0x84, 0x13, 0x60, + 0x45, 0xF1, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x36, 0x22, 0xBC, 0xAB, 0x46, 0x3A, 0xFA, 0xAB, 0x46, + 0x16, 0x60, 0x56, 0xF3, 0x13, 0x60, 0x45, 0xF1, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x36, 0x22, 0xBC, + 0x87, 0xF1, 0x66, 0x41, 0x64, 0x46, 0x3A, 0xFA, 0xFF, 0xFF, 0x61, 0x46, 0xAB, 0x46, 0x82, 0xF0, + 0xC0, 0x67, 0xB4, 0x84, 0xAB, 0x46, 0x0B, 0xFA, 0x13, 0x60, 0x4D, 0xF1, 0x2D, 0x60, 0xBE, 0x7C, + 0x04, 0x1B, 0xFF, 0x60, 0xFF, 0x63, 0xA4, 0xDD, 0x26, 0x00, 0x2E, 0x60, 0x34, 0x63, 0xA4, 0xDD, + 0xDB, 0x83, 0x60, 0xFE, 0x00, 0x64, 0xBD, 0xDB, 0x60, 0x64, 0xBD, 0xDB, 0x1D, 0x64, 0xBD, 0xDB, + 0xC3, 0xF3, 0xBD, 0xDB, 0x20, 0xFE, 0x01, 0x60, 0x78, 0x64, 0x06, 0x61, 0x58, 0xD1, 0xFF, 0xFF, + 0x60, 0xFE, 0xBD, 0xD9, 0x20, 0xFE, 0xCD, 0x81, 0x61, 0x40, 0x08, 0x28, 0xF7, 0x01, 0xB6, 0xF1, + 0xFF, 0xFF, 0x64, 0x47, 0x60, 0xFE, 0xBD, 0xD9, 0xBD, 0xDB, 0x20, 0xFE, 0x13, 0x60, 0x4B, 0xF1, + 0x60, 0xFE, 0xBD, 0xD9, 0x20, 0xFE, 0x2D, 0x60, 0xBC, 0x64, 0x40, 0x48, 0x18, 0x61, 0x26, 0x46, + 0x00, 0xF4, 0xFF, 0x60, 0xF2, 0x64, 0xE4, 0x60, 0x58, 0x4D, 0xA7, 0x78, 0xFF, 0xFF, 0x26, 0x46, + 0x3F, 0xFC, 0x2B, 0x46, 0x56, 0xF1, 0x1F, 0xF8, 0x0C, 0x60, 0x70, 0xF1, 0x10, 0x60, 0x00, 0x64, + 0xA0, 0x80, 0x06, 0xF2, 0x0B, 0x03, 0x10, 0xBC, 0x06, 0xFA, 0x86, 0xF3, 0x00, 0x60, 0x70, 0xF3, + 0x60, 0x45, 0xD4, 0x80, 0xDC, 0x84, 0x07, 0x07, 0xA2, 0xDB, 0x05, 0x00, 0x10, 0xB5, 0xFF, 0xFF, + 0x02, 0x03, 0xD4, 0x84, 0x06, 0xFA, 0x07, 0xF2, 0x66, 0x45, 0x60, 0x46, 0x06, 0xF2, 0x65, 0x46, + 0x02, 0xB0, 0xFF, 0xFF, 0x11, 0x03, 0x26, 0x46, 0x87, 0xF3, 0x07, 0xFA, 0x1E, 0x60, 0xD4, 0x64, + 0x0F, 0x60, 0x90, 0xFB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xC1, 0xFE, 0x00, 0x66, 0x46, 0x46, 0x50, 0x00, 0x26, 0x46, 0x87, 0xF3, 0x07, 0xFA, 0x1E, 0x60, + 0xD4, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0xC1, 0xFE, 0x00, 0x66, 0x46, 0x46, 0x19, 0x00, 0x00, 0x60, 0xC0, 0x64, 0x2A, 0xFA, + 0x02, 0x64, 0x3F, 0xFA, 0x87, 0xF3, 0x07, 0xFA, 0x00, 0xF4, 0x09, 0x64, 0x09, 0xFA, 0x1E, 0x60, + 0xD4, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0xC1, 0xFE, 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x2B, 0x43, 0x0B, 0x60, + 0x82, 0xF3, 0xDA, 0x81, 0x60, 0x45, 0xD5, 0x80, 0xA1, 0xD1, 0x11, 0x03, 0xD3, 0x80, 0xD9, 0x81, + 0xFA, 0x02, 0xC9, 0x81, 0xC8, 0x85, 0xD5, 0x80, 0xA5, 0xD3, 0x08, 0x28, 0xA1, 0xDB, 0x17, 0x60, + 0x04, 0x62, 0x65, 0x44, 0xA2, 0xDB, 0x4A, 0xD3, 0xFF, 0xFF, 0xCC, 0x84, 0xA2, 0xDB, 0xAB, 0x46, + 0x06, 0xF2, 0xFF, 0xFF, 0x02, 0xBC, 0x06, 0xFA, 0x78, 0xF2, 0x15, 0x60, 0xDC, 0xF3, 0x60, 0x45, + 0xA4, 0x84, 0x15, 0x60, 0xDC, 0xFB, 0xAB, 0x46, 0xAB, 0x46, 0x0F, 0x60, 0xFF, 0x64, 0x02, 0xF0, + 0x71, 0xF1, 0xA0, 0x84, 0xD0, 0x80, 0x02, 0xFA, 0xAB, 0x46, 0x01, 0x06, 0x71, 0xFB, 0x27, 0x41, + 0x01, 0xB1, 0xFF, 0xFF, 0x08, 0x03, 0x2B, 0x46, 0x0B, 0x58, 0x01, 0x65, 0xE5, 0x60, 0x58, 0x4E, + 0x51, 0x78, 0xFF, 0xFF, 0x0A, 0x00, 0x2B, 0x46, 0x0B, 0x58, 0x18, 0x60, 0xD6, 0x64, 0x40, 0x59, + 0x02, 0x65, 0xE5, 0x60, 0x58, 0x4E, 0x51, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, + 0xFF, 0xFF, 0x26, 0x46, 0x00, 0xF4, 0x00, 0x64, 0x09, 0xFA, 0x0B, 0xFA, 0x01, 0x7E, 0x0C, 0xFA, + 0x0A, 0x64, 0x0A, 0xFA, 0x26, 0x46, 0x08, 0x64, 0x3F, 0xFA, 0x07, 0xF2, 0x87, 0xF1, 0x40, 0x58, + 0x07, 0xF8, 0x1E, 0x60, 0xD4, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0xFF, 0x60, 0xFD, 0x65, 0x38, 0x46, 0x06, 0xF2, + 0xFF, 0xFF, 0xA4, 0x83, 0x06, 0xFC, 0x02, 0xB0, 0x26, 0x46, 0x1C, 0x03, 0x38, 0x43, 0x86, 0xF1, + 0x17, 0x60, 0x02, 0x61, 0xA1, 0xD3, 0xDA, 0x81, 0xD0, 0x80, 0xDC, 0x9C, 0x05, 0x05, 0xA1, 0xD3, + 0x4A, 0xD9, 0xA0, 0xDD, 0xDA, 0x9C, 0xA1, 0xD9, 0x02, 0x60, 0x00, 0x61, 0x2C, 0xF2, 0xA1, 0xDB, + 0x2D, 0xF2, 0x41, 0x58, 0x59, 0xDB, 0x2E, 0xF2, 0x59, 0xDB, 0x03, 0x65, 0xE5, 0x60, 0x58, 0x4E, + 0x51, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x07, 0xF2, 0x87, 0xF1, + 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, 0x02, 0x02, 0x2F, 0x58, 0xFF, 0xFF, 0x40, 0x47, 0x07, 0xF2, + 0x66, 0x45, 0x60, 0x46, 0x06, 0xF2, 0x65, 0x46, 0x02, 0xB0, 0xFF, 0xFF, 0x1A, 0x02, 0x27, 0x43, + 0x0B, 0x60, 0x82, 0xF3, 0xDA, 0x81, 0x60, 0x45, 0xD5, 0x80, 0xA1, 0xD1, 0x11, 0x03, 0xD3, 0x80, + 0xD9, 0x81, 0xFA, 0x02, 0xC9, 0x81, 0xC8, 0x85, 0xD5, 0x80, 0xA5, 0xD3, 0x08, 0x28, 0xA1, 0xDB, + 0x17, 0x60, 0x04, 0x62, 0x65, 0x44, 0xA2, 0xDB, 0x4A, 0xD3, 0xFF, 0xFF, 0xCC, 0x84, 0xA2, 0xDB, + 0x0C, 0x00, 0x27, 0x44, 0x40, 0x58, 0x03, 0x65, 0xE5, 0x60, 0x58, 0x4E, 0x51, 0x78, 0xFF, 0xFF, + 0x27, 0x43, 0xE7, 0x60, 0x58, 0x4E, 0x81, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x87, 0xF4, 0x66, 0x41, + 0x63, 0x46, 0x05, 0xF2, 0x00, 0xF0, 0x81, 0xF0, 0x02, 0x18, 0x64, 0x46, 0x81, 0xF8, 0x07, 0x1B, + 0x15, 0x60, 0x02, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD9, 0x02, 0x00, 0x65, 0x46, + 0x00, 0xF8, 0x87, 0xF3, 0x63, 0x45, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xD4, 0x80, 0x01, 0x18, + 0xFA, 0x04, 0x80, 0xF8, 0x65, 0x46, 0x00, 0xFA, 0x06, 0xF2, 0xFF, 0xFF, 0x00, 0x7E, 0x06, 0xFA, + 0x61, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x07, 0xF2, 0x87, 0xF1, 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, + 0x02, 0x02, 0x2F, 0x58, 0xFF, 0xFF, 0x40, 0x47, 0x07, 0xF2, 0x66, 0x45, 0x60, 0x46, 0x06, 0xF2, + 0x65, 0x46, 0x02, 0xB0, 0xFF, 0xFF, 0x02, 0x02, 0x2F, 0x58, 0xFF, 0xFF, 0x27, 0x46, 0x06, 0xF0, + 0xFF, 0x60, 0xED, 0x64, 0xA0, 0x84, 0x06, 0xFA, 0x27, 0x43, 0x86, 0xF1, 0x17, 0x60, 0x02, 0x61, + 0xA1, 0xD3, 0xDA, 0x81, 0xD0, 0x80, 0xDC, 0x9C, 0x05, 0x05, 0xA1, 0xD3, 0x4A, 0xD9, 0xA0, 0xDD, + 0xDA, 0x9C, 0xA1, 0xD9, 0x07, 0x58, 0x03, 0x65, 0xE5, 0x60, 0x58, 0x4E, 0x51, 0x78, 0xFF, 0xFF, + 0x27, 0x43, 0xE7, 0x60, 0x58, 0x4E, 0x81, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x2F, 0x58, 0xFF, 0xFF, + 0x26, 0x46, 0x2F, 0xF2, 0x2C, 0xFA, 0x30, 0xF2, 0x2D, 0xFA, 0x31, 0xF2, 0x2E, 0xFA, 0xCB, 0xF3, + 0x2F, 0xFA, 0xCC, 0xF3, 0x30, 0xFA, 0xCD, 0xF3, 0x31, 0xFA, 0x66, 0xF3, 0x32, 0xFA, 0x67, 0xF3, + 0x33, 0xFA, 0x68, 0xF3, 0x34, 0xFA, 0xAB, 0xF1, 0x19, 0xF8, 0x00, 0x65, 0xEF, 0x60, 0x58, 0x4E, + 0xDC, 0x78, 0xFF, 0xFF, 0x61, 0x44, 0x15, 0x60, 0xC2, 0xFB, 0x02, 0x63, 0x3F, 0xFC, 0x00, 0x64, + 0x3E, 0xFA, 0x02, 0x60, 0x00, 0x61, 0x2C, 0xF2, 0xA1, 0xDB, 0x2D, 0xF2, 0x41, 0x58, 0x59, 0xDB, + 0x2E, 0xF2, 0x59, 0xDB, 0x06, 0x63, 0x07, 0xF2, 0x87, 0xF1, 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, + 0x0D, 0x02, 0x43, 0x59, 0x02, 0x65, 0xE5, 0x60, 0x58, 0x4E, 0x27, 0x78, 0xFF, 0xFF, 0x26, 0x46, + 0xC0, 0x64, 0x2A, 0xFA, 0x00, 0xF4, 0x06, 0x64, 0x09, 0xFA, 0x15, 0x00, 0x07, 0xF2, 0x66, 0x45, + 0x60, 0x46, 0x06, 0xF2, 0x65, 0x46, 0x02, 0xB0, 0xFF, 0xFF, 0x1D, 0x02, 0x07, 0x63, 0x43, 0x59, + 0x01, 0x65, 0xE5, 0x60, 0x58, 0x4E, 0x27, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0xA0, 0x64, 0x2A, 0xFA, + 0x00, 0xF4, 0x07, 0x64, 0x09, 0xFA, 0x26, 0x46, 0x87, 0xF3, 0x07, 0xFA, 0x1E, 0x60, 0xD4, 0x64, + 0x0F, 0x60, 0x90, 0xFB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xC1, 0xFE, 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0xDE, 0x60, 0x66, 0x64, 0x08, 0x60, + 0x29, 0xFB, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x60, 0x03, 0x64, 0x08, 0x60, 0x1F, 0xFB, 0xDE, 0x60, + 0x05, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x1E, 0xF1, 0x00, 0x60, + 0x02, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x59, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x71, 0xF3, 0x87, 0xF5, + 0xDC, 0x81, 0x66, 0x43, 0x02, 0xA3, 0x63, 0x46, 0xCD, 0x81, 0x06, 0xF2, 0xEE, 0x03, 0x60, 0x40, + 0x08, 0x2A, 0xF7, 0x01, 0x0C, 0xAC, 0x06, 0xFA, 0x46, 0x49, 0x00, 0x60, 0x02, 0x61, 0xB5, 0x60, + 0x58, 0x4D, 0xA2, 0x78, 0xFF, 0xFF, 0xE1, 0x03, 0x18, 0x60, 0x13, 0xF3, 0xFF, 0xFF, 0x03, 0x1B, + 0x00, 0x60, 0xA0, 0x64, 0x02, 0x00, 0x00, 0x60, 0xC0, 0x64, 0x2A, 0xFA, 0xAB, 0xFC, 0x66, 0x45, + 0x29, 0x44, 0x07, 0xFA, 0x29, 0x46, 0x03, 0xF2, 0x04, 0xF0, 0x85, 0xF2, 0x65, 0x46, 0x2C, 0xFA, + 0x2D, 0xF8, 0xAE, 0xFA, 0xCB, 0xF3, 0x2F, 0xFA, 0x32, 0xFA, 0xCC, 0xF3, 0x30, 0xFA, 0x33, 0xFA, + 0xCD, 0xF3, 0x31, 0xFA, 0x34, 0xFA, 0xAB, 0xF1, 0x19, 0xF8, 0x18, 0x67, 0x0E, 0xFA, 0x66, 0x41, + 0x29, 0x46, 0x92, 0xF0, 0x2C, 0x60, 0x26, 0x63, 0x47, 0xD3, 0x61, 0x46, 0x00, 0x7E, 0x13, 0xFA, + 0x02, 0x63, 0x3F, 0xFC, 0x00, 0x64, 0x3E, 0xFA, 0x66, 0x41, 0x00, 0xF4, 0x18, 0x60, 0x12, 0xF3, + 0x09, 0xFA, 0x1E, 0x60, 0xE0, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x61, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC8, 0xFE, 0xA0, 0x01, 0x95, 0x01, 0x00, 0x64, 0x08, 0x60, + 0x1E, 0xFB, 0x5A, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0x07, 0xF0, 0xFF, 0xFF, 0x64, 0x43, 0x0B, 0x60, + 0x82, 0xF3, 0xDA, 0x81, 0x60, 0x45, 0xD5, 0x80, 0xA1, 0xD1, 0x04, 0x03, 0xD3, 0x80, 0xD9, 0x81, + 0xFA, 0x02, 0x08, 0x00, 0xA1, 0xDD, 0xD9, 0x84, 0x0B, 0x60, 0x82, 0xFB, 0x4A, 0xD3, 0xFF, 0xFF, + 0xDC, 0x84, 0xA2, 0xDB, 0x66, 0x45, 0x63, 0x46, 0x06, 0xF2, 0xFF, 0x60, 0x01, 0x7C, 0xA0, 0x9C, + 0x06, 0xF8, 0x65, 0x46, 0x70, 0xF3, 0x60, 0x40, 0x10, 0x2A, 0x03, 0x00, 0xCC, 0x84, 0x80, 0x2B, + 0x70, 0xFB, 0x08, 0x60, 0x1E, 0xF1, 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, 0x30, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x00, 0x60, 0x02, 0x64, + 0x08, 0x60, 0x19, 0xFB, 0xDE, 0x60, 0xA8, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x70, 0xF3, 0x71, 0xF3, 0x00, 0xA8, 0x60, 0x88, 0x43, 0x03, 0xE0, 0x83, 0x5F, 0x03, 0xCB, 0x83, + 0x87, 0xF3, 0x72, 0xF1, 0x02, 0xA4, 0x40, 0x47, 0x64, 0x45, 0x27, 0x46, 0x76, 0xF4, 0x12, 0xF2, + 0x33, 0x18, 0xD4, 0x80, 0x02, 0x64, 0x30, 0x07, 0x23, 0xFA, 0x2A, 0xF2, 0x0E, 0xF2, 0x0C, 0xB0, + 0x02, 0xF0, 0x0C, 0x02, 0x1E, 0x60, 0xD4, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0xE7, 0x01, 0x60, 0x40, 0xF0, 0x37, + 0x08, 0x00, 0x09, 0x60, 0x08, 0x64, 0xD0, 0x80, 0xA2, 0xFF, 0x8F, 0xF3, 0x02, 0x02, 0xDC, 0x84, + 0x8F, 0xFB, 0x1E, 0x60, 0xF2, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xA3, 0xFF, 0xCE, 0xFE, 0x25, 0x60, 0xE4, 0x64, 0xE5, 0x60, + 0x78, 0x41, 0xC7, 0x78, 0x97, 0xF1, 0xC9, 0x01, 0x27, 0x44, 0x02, 0xA4, 0x40, 0x47, 0xC5, 0x1F, + 0x28, 0x43, 0xCB, 0x83, 0x87, 0xF3, 0x1A, 0x0E, 0x02, 0xA4, 0x40, 0x4C, 0x43, 0x48, 0x2C, 0x46, + 0x22, 0xF2, 0x72, 0xF1, 0xAC, 0x86, 0x12, 0xF2, 0x0C, 0x03, 0xD0, 0x80, 0xFF, 0xFF, 0x09, 0x07, + 0x1F, 0x60, 0x20, 0x64, 0x40, 0x4B, 0xF6, 0x60, 0x58, 0x4D, 0xB3, 0x78, 0xFF, 0xFF, 0x2C, 0x46, + 0xA2, 0xFC, 0x2C, 0x44, 0x02, 0xA4, 0x28, 0x43, 0x40, 0x4C, 0xE8, 0x1F, 0x8B, 0x01, 0x01, 0x63, + 0x65, 0xF3, 0xAB, 0xF3, 0x00, 0xBD, 0xAC, 0x81, 0x06, 0x03, 0x05, 0x03, 0xB7, 0x60, 0x58, 0x4D, + 0xC0, 0x78, 0xFF, 0xFF, 0x60, 0x43, 0x5B, 0xFD, 0x3E, 0x63, 0x18, 0x60, 0x94, 0x61, 0x00, 0x64, + 0x59, 0xDB, 0xFE, 0x1F, 0x70, 0xFB, 0x71, 0xFB, 0x18, 0x60, 0xDC, 0x65, 0xA5, 0xDF, 0x5A, 0xDF, + 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0x70, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x03, 0x02, + 0xCA, 0x60, 0x7E, 0x78, 0xFF, 0xFF, 0x07, 0xF0, 0x66, 0x45, 0x64, 0x46, 0x1F, 0xF2, 0x65, 0x46, + 0x64, 0x45, 0x5B, 0xF1, 0xE0, 0x84, 0x72, 0xF1, 0xC0, 0x84, 0xC0, 0x84, 0x12, 0xFA, 0x2C, 0xF2, + 0x70, 0xF3, 0x60, 0x40, 0x01, 0x2A, 0x34, 0x00, 0x00, 0xA8, 0x13, 0x60, 0x43, 0xF3, 0x36, 0x03, + 0x00, 0xA8, 0xFF, 0xFF, 0x33, 0x03, 0xE1, 0x60, 0x58, 0x4D, 0x04, 0x78, 0xFF, 0xFF, 0x25, 0x46, + 0x09, 0x60, 0x08, 0x61, 0xA2, 0xFF, 0x0E, 0xF2, 0x02, 0xF0, 0x60, 0x40, 0xF0, 0x37, 0x0D, 0x00, + 0x91, 0xF3, 0x8F, 0xF3, 0xDC, 0x83, 0xD1, 0x80, 0x91, 0xFD, 0x0C, 0x03, 0x8B, 0xF3, 0xCC, 0x83, + 0xD8, 0xA0, 0x8F, 0xFD, 0x07, 0x04, 0xD4, 0xFE, 0x05, 0x00, 0xD1, 0x80, 0x92, 0xF3, 0x02, 0x03, + 0xDC, 0x84, 0x92, 0xFB, 0x1E, 0x60, 0xDA, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x25, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xA3, 0xFF, 0xDF, 0x60, 0x2A, 0x78, 0xFF, 0xFF, + 0x66, 0x41, 0x65, 0x46, 0x06, 0xF2, 0x61, 0x46, 0x60, 0x40, 0x10, 0x2A, 0x4B, 0x00, 0x80, 0x67, + 0xB4, 0x81, 0x61, 0x44, 0x0F, 0x60, 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0xE1, 0x60, 0x58, 0x4D, 0x04, 0x78, 0xFF, 0xFF, 0x25, 0x46, 0x2A, 0xF2, + 0x09, 0x60, 0x08, 0x61, 0x0C, 0xB0, 0xA2, 0xFF, 0x17, 0x03, 0x0E, 0xF2, 0x02, 0xF0, 0x60, 0x40, + 0xF0, 0x37, 0x0D, 0x00, 0x8F, 0xF3, 0x91, 0xF3, 0xCC, 0x83, 0xD1, 0x80, 0x8F, 0xFD, 0x0C, 0x03, + 0x8B, 0xF3, 0xDC, 0x83, 0xD8, 0xA0, 0x91, 0xFD, 0x07, 0x04, 0xD4, 0xFE, 0x05, 0x00, 0xD1, 0x80, + 0x92, 0xF3, 0x02, 0x03, 0xDC, 0x84, 0x92, 0xFB, 0x07, 0xF0, 0x0A, 0xF2, 0xA3, 0xFF, 0x64, 0x45, + 0x2F, 0x1B, 0x66, 0x41, 0x65, 0x46, 0x02, 0xF0, 0x61, 0x46, 0x0F, 0x60, 0xFF, 0x61, 0xA1, 0x84, + 0x60, 0x41, 0xE9, 0x81, 0xE9, 0x81, 0xE9, 0x81, 0xE1, 0x82, 0x07, 0xB4, 0x01, 0x61, 0x03, 0x03, + 0xCC, 0x84, 0xE1, 0x81, 0xFD, 0x02, 0x18, 0x60, 0x96, 0x65, 0x46, 0xD1, 0x61, 0x44, 0xB0, 0x84, + 0xA2, 0xDB, 0x16, 0x00, 0x1E, 0x60, 0xD4, 0x61, 0x2A, 0xF2, 0x3E, 0xF2, 0x0C, 0xB0, 0x01, 0xB0, + 0x05, 0x03, 0x1E, 0x60, 0xE6, 0x61, 0x02, 0x02, 0x1E, 0x60, 0xCE, 0x61, 0x61, 0x44, 0x0F, 0x60, + 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, + 0xDF, 0x60, 0x2A, 0x78, 0xFF, 0xFF, 0x07, 0xF0, 0x2B, 0xF2, 0x2A, 0xF2, 0x60, 0x41, 0x44, 0x49, + 0x60, 0x45, 0xA4, 0x3A, 0x0D, 0x00, 0x61, 0x40, 0xC0, 0x3B, 0x79, 0x00, 0xA9, 0x46, 0x06, 0xF2, + 0xA9, 0x46, 0x60, 0x40, 0x20, 0x26, 0x73, 0x00, 0x20, 0xBC, 0xA9, 0x46, 0x06, 0xFA, 0xA9, 0x46, + 0xA9, 0x46, 0x06, 0xF0, 0xA9, 0x46, 0x65, 0x40, 0x10, 0x2B, 0x6C, 0x00, 0x64, 0x40, 0x10, 0x2A, + 0x35, 0x00, 0x65, 0x40, 0xA4, 0x3A, 0x63, 0x00, 0x29, 0x45, 0x65, 0x46, 0x76, 0xF2, 0xFF, 0xFF, + 0x00, 0xA8, 0x60, 0x46, 0x04, 0x02, 0x76, 0x00, 0xE0, 0x60, 0xEA, 0x78, 0xFF, 0xFF, 0x09, 0xF2, + 0x2A, 0xF0, 0x00, 0xA8, 0x20, 0x67, 0x02, 0x03, 0xB0, 0x84, 0x2A, 0xFA, 0x0E, 0xF2, 0x02, 0xF0, + 0x60, 0x40, 0xF0, 0x37, 0x08, 0x00, 0x09, 0x60, 0x08, 0x64, 0xD0, 0x80, 0xA2, 0xFF, 0x8F, 0xF3, + 0x02, 0x02, 0xDC, 0x84, 0x8F, 0xFB, 0x3E, 0xF2, 0xA3, 0xFF, 0x01, 0xB0, 0x1E, 0x60, 0xE6, 0x61, + 0x02, 0x02, 0x1E, 0x60, 0xD4, 0x61, 0x61, 0x44, 0x0F, 0x60, 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x16, 0x00, 0x10, 0x64, 0xB0, 0x84, + 0xDF, 0x65, 0xA4, 0x9E, 0xA9, 0x46, 0x06, 0xFA, 0xA9, 0x46, 0xA2, 0xFF, 0x04, 0x64, 0x0C, 0x60, + 0x6E, 0xFB, 0x29, 0x44, 0x5A, 0xDB, 0x70, 0xF3, 0xC1, 0xFE, 0xD4, 0xFE, 0x86, 0xF1, 0xA3, 0xFF, + 0xD0, 0x80, 0xDC, 0x84, 0x01, 0x07, 0x70, 0xFB, 0xA9, 0x46, 0x76, 0xF2, 0xA9, 0x46, 0x64, 0x18, + 0xA9, 0x46, 0x02, 0xF0, 0xA9, 0x46, 0x0F, 0x60, 0xFF, 0x61, 0xA1, 0x84, 0x60, 0x41, 0xE9, 0x81, + 0xE9, 0x81, 0xE9, 0x81, 0xE1, 0x82, 0x07, 0xB4, 0x01, 0x61, 0x03, 0x03, 0xCC, 0x84, 0xE1, 0x81, + 0xFD, 0x02, 0x18, 0x60, 0x96, 0x65, 0x46, 0xD1, 0xFF, 0xFF, 0xB1, 0x84, 0xA2, 0xDB, 0xE1, 0x60, + 0x01, 0x78, 0xFF, 0xFF, 0x64, 0x40, 0x10, 0x2A, 0xFA, 0x01, 0xFF, 0x60, 0xEF, 0x64, 0xA0, 0x84, + 0xA9, 0x46, 0x06, 0xFA, 0xA9, 0x46, 0x65, 0x41, 0x70, 0xF3, 0x29, 0x45, 0xCC, 0x84, 0x80, 0x2B, + 0x70, 0xFB, 0x65, 0x46, 0x76, 0xF2, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x36, 0x02, 0x61, 0x40, + 0xA4, 0x3A, 0xE5, 0x01, 0x00, 0x60, 0x3A, 0x61, 0xB5, 0x60, 0x58, 0x4D, 0x9F, 0x78, 0xFF, 0xFF, + 0x83, 0x03, 0x02, 0x60, 0x48, 0x64, 0x2A, 0xFA, 0xCB, 0xF1, 0x2F, 0xF8, 0xCC, 0xF1, 0x30, 0xF8, + 0xCD, 0xF1, 0x31, 0xF8, 0x66, 0xF1, 0x32, 0xF8, 0x67, 0xF1, 0x33, 0xF8, 0x68, 0xF1, 0x34, 0xF8, + 0xA9, 0x46, 0x03, 0xF2, 0x04, 0xF0, 0x85, 0xF0, 0xA9, 0x46, 0x2C, 0xFA, 0x2D, 0xF8, 0xAE, 0xF8, + 0xAB, 0xF1, 0x19, 0xF8, 0xFF, 0x67, 0x0E, 0xFA, 0x00, 0x64, 0x3E, 0xFA, 0x3F, 0xFA, 0x29, 0x44, + 0x07, 0xFA, 0x1E, 0x60, 0xD4, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x35, 0x00, 0x80, 0x67, 0xB4, 0x83, 0x2A, 0xF2, + 0x09, 0x60, 0x08, 0x65, 0x0C, 0xB0, 0x09, 0xF0, 0x0C, 0x02, 0x1E, 0x60, 0xD4, 0x64, 0x0F, 0x60, + 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x9F, 0x18, + 0x64, 0x46, 0x3E, 0xF2, 0xA2, 0xFF, 0x01, 0xB0, 0x1E, 0x60, 0xE6, 0x61, 0x02, 0x02, 0x1E, 0x60, + 0xCE, 0x61, 0x02, 0xF2, 0x0E, 0xF0, 0xD4, 0x80, 0x09, 0xF4, 0x06, 0x02, 0x8F, 0xF3, 0x64, 0x40, + 0xF0, 0x37, 0x02, 0x00, 0xDC, 0x84, 0x8F, 0xFB, 0x66, 0x44, 0x00, 0xA8, 0xFF, 0xFF, 0xF1, 0x02, + 0x61, 0x44, 0x0F, 0x60, 0x90, 0xFB, 0x5A, 0xDD, 0x08, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xC1, 0xFE, 0xA3, 0xFF, 0xA9, 0x46, 0x02, 0xF0, 0xA9, 0x46, 0x0F, 0x60, 0xFF, 0x61, 0xA1, 0x84, + 0x60, 0x41, 0xE9, 0x81, 0xE9, 0x81, 0xE9, 0x81, 0xE1, 0x82, 0x07, 0xB4, 0x01, 0x61, 0x03, 0x03, + 0xCC, 0x84, 0xE1, 0x81, 0xFD, 0x02, 0x18, 0x60, 0x96, 0x65, 0x46, 0xD3, 0x9D, 0x85, 0xA4, 0x84, + 0xA2, 0xDB, 0x26, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x46, 0x45, 0x3F, 0xF2, 0x05, 0x48, 0x00, 0xA8, + 0x60, 0x41, 0x66, 0x44, 0x0B, 0x03, 0x0E, 0xA1, 0x00, 0xF2, 0x42, 0xFE, 0xAC, 0x86, 0x01, 0xF2, + 0x1F, 0x03, 0x7F, 0xB5, 0xD5, 0x81, 0x66, 0x44, 0xF7, 0x07, 0x25, 0x46, 0x05, 0xF0, 0x06, 0xFA, + 0x05, 0xFA, 0xD0, 0x80, 0x64, 0x43, 0x13, 0x03, 0x60, 0x46, 0x01, 0xF0, 0x80, 0x67, 0xB0, 0x84, + 0x01, 0xFA, 0x00, 0xF0, 0x00, 0x64, 0x00, 0xFA, 0x44, 0x45, 0xA2, 0xFF, 0xB6, 0x60, 0x58, 0x4E, + 0x72, 0x78, 0xFF, 0xFF, 0xA3, 0xFF, 0x08, 0x45, 0x25, 0x46, 0x01, 0x64, 0x02, 0xFA, 0x02, 0xFE, + 0x2D, 0x58, 0xFF, 0xFF, 0x23, 0xF2, 0x07, 0xF0, 0x10, 0xB0, 0x10, 0xAC, 0x3A, 0x03, 0x23, 0xFA, + 0x80, 0x67, 0xB0, 0x81, 0x61, 0x44, 0x0F, 0x60, 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x04, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x46, 0x45, 0x64, 0x46, 0x02, 0xF0, 0x0F, 0x60, 0xFF, 0x61, + 0xA1, 0x84, 0x60, 0x41, 0xE9, 0x81, 0xE9, 0x81, 0xE9, 0x81, 0xE1, 0x82, 0x07, 0xB4, 0x01, 0x61, + 0x03, 0x03, 0xCC, 0x84, 0xE1, 0x81, 0xFD, 0x02, 0x18, 0x60, 0x96, 0x65, 0x46, 0xD1, 0xFF, 0xFF, + 0xB1, 0x84, 0xA2, 0xDB, 0x9F, 0xF2, 0x25, 0x46, 0xE1, 0x81, 0x5B, 0xF1, 0x72, 0xF1, 0xC1, 0x81, + 0xC1, 0x81, 0x92, 0xFA, 0xA2, 0xFF, 0x02, 0xF0, 0x09, 0x60, 0x08, 0x61, 0xD1, 0x80, 0x0E, 0xF2, + 0x05, 0x02, 0x8F, 0xF3, 0x20, 0xB0, 0xCC, 0x84, 0x01, 0x02, 0x8F, 0xFB, 0xA3, 0xFF, 0x48, 0xFE, + 0x07, 0x00, 0x0E, 0xF2, 0x08, 0xFE, 0xF0, 0x7F, 0x60, 0x40, 0x20, 0x2A, 0x00, 0x7F, 0x0E, 0xFA, + 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x60, 0xC5, 0x61, 0xB5, 0x60, 0x58, 0x4D, 0xA2, 0x78, 0xFF, 0xFF, + 0x66, 0x44, 0x57, 0xFB, 0x04, 0x64, 0x03, 0xFA, 0x80, 0x64, 0x2A, 0xFA, 0xAB, 0xF1, 0x19, 0xF8, + 0x00, 0x64, 0x3E, 0xFA, 0x00, 0x60, 0x80, 0x64, 0x0E, 0xFA, 0x87, 0xF1, 0x07, 0xF8, 0x67, 0x44, + 0x2C, 0xFA, 0x2D, 0xFA, 0x2E, 0xFA, 0xE4, 0x60, 0x65, 0x64, 0x08, 0x60, 0x25, 0xFB, 0xE2, 0x60, + 0xA0, 0x64, 0x08, 0x60, 0x2B, 0xFB, 0x18, 0x60, 0xE6, 0x63, 0x65, 0x44, 0xBD, 0xDB, 0x10, 0x60, + 0x58, 0x64, 0xBD, 0xDB, 0x02, 0x64, 0xBD, 0xDB, 0x06, 0x64, 0xA3, 0xDB, 0xE9, 0x60, 0xB2, 0x78, + 0xFF, 0xFF, 0xE9, 0x60, 0x58, 0x4D, 0xBE, 0x78, 0xFF, 0xFF, 0x57, 0xF5, 0xCB, 0xF1, 0x2F, 0xF8, + 0xCC, 0xF1, 0x30, 0xF8, 0xCD, 0xF1, 0x31, 0xF8, 0x66, 0xF1, 0x32, 0xF8, 0x67, 0xF1, 0x33, 0xF8, + 0x68, 0xF1, 0x34, 0xF8, 0x13, 0x60, 0x45, 0xF1, 0x01, 0x64, 0x64, 0x40, 0xFE, 0x26, 0x10, 0xBC, + 0x32, 0x40, 0x10, 0x26, 0x10, 0xBC, 0x20, 0xBC, 0x04, 0x60, 0x00, 0x65, 0x60, 0x44, 0xB4, 0x84, + 0x17, 0x60, 0x22, 0xFB, 0x13, 0x60, 0x44, 0xF1, 0x26, 0x60, 0x16, 0x64, 0x02, 0x18, 0x26, 0x60, + 0x38, 0x64, 0x16, 0x60, 0xBF, 0xFB, 0x16, 0x60, 0xCF, 0xFB, 0x2C, 0x60, 0x84, 0x61, 0x13, 0x60, + 0x97, 0xF3, 0x2D, 0x60, 0x5E, 0x65, 0xFE, 0xA4, 0xE0, 0x84, 0x02, 0x05, 0x67, 0x44, 0x21, 0x00, + 0xE0, 0x84, 0xC4, 0x85, 0x16, 0x60, 0x55, 0xF3, 0xA5, 0xD1, 0xDA, 0x85, 0xA0, 0x83, 0x16, 0x60, + 0x51, 0xFD, 0xA5, 0xD1, 0x2C, 0x60, 0xA0, 0x62, 0xA0, 0x83, 0xA2, 0xDD, 0x2C, 0x60, 0x84, 0x61, + 0x50, 0x60, 0x00, 0x7C, 0x00, 0x60, 0xF2, 0x65, 0xE2, 0x60, 0x58, 0x4D, 0x06, 0x78, 0xFF, 0xFF, + 0x16, 0x60, 0x53, 0xF1, 0x59, 0xD9, 0x2C, 0x60, 0x7E, 0x65, 0xD5, 0x84, 0xDD, 0x7F, 0xA5, 0xDB, + 0x65, 0x44, 0x16, 0x60, 0xC4, 0xFB, 0x16, 0x60, 0xD4, 0xFB, 0x79, 0x00, 0x16, 0x60, 0x54, 0xF3, + 0x2C, 0x60, 0xA0, 0x62, 0xFD, 0xA0, 0xA2, 0xD3, 0xEE, 0x03, 0x60, 0x40, 0x02, 0x2A, 0x02, 0x00, + 0x01, 0x63, 0x0B, 0x00, 0x04, 0x2A, 0x02, 0x00, 0x02, 0x63, 0x07, 0x00, 0x10, 0x2A, 0x02, 0x00, + 0x04, 0x63, 0x03, 0x00, 0x20, 0x2A, 0x01, 0x00, 0x05, 0x63, 0x63, 0x47, 0xB4, 0x83, 0x59, 0xD9, + 0x59, 0xDD, 0x16, 0x60, 0x54, 0xF3, 0x16, 0x60, 0x51, 0xF3, 0xFE, 0xA0, 0x40, 0x4C, 0xD3, 0x03, + 0x00, 0x60, 0x00, 0x63, 0x59, 0xDD, 0x41, 0x4A, 0x2C, 0x40, 0x01, 0x2A, 0x05, 0x00, 0x00, 0x63, + 0x63, 0x47, 0xB4, 0x83, 0x59, 0xD9, 0x59, 0xDD, 0x2C, 0x40, 0x02, 0x2A, 0x03, 0x00, 0x01, 0x63, + 0x59, 0xD9, 0x59, 0xDD, 0x2C, 0x40, 0x04, 0x2A, 0x05, 0x00, 0x02, 0x63, 0x63, 0x47, 0xB4, 0x83, + 0x59, 0xD9, 0x59, 0xDD, 0x2C, 0x40, 0x10, 0x2A, 0x05, 0x00, 0x04, 0x63, 0x63, 0x47, 0xB4, 0x83, + 0x59, 0xD9, 0x59, 0xDD, 0x2C, 0x40, 0x20, 0x2A, 0x05, 0x00, 0x05, 0x63, 0x63, 0x47, 0xB4, 0x83, + 0x59, 0xD9, 0x59, 0xDD, 0x2A, 0x44, 0x51, 0x93, 0xEB, 0x83, 0xEB, 0x83, 0xA0, 0xDD, 0x16, 0x60, + 0x54, 0xF3, 0x16, 0x60, 0x52, 0xF3, 0xFF, 0xA0, 0x40, 0x4C, 0x9D, 0x03, 0x59, 0xDF, 0x41, 0x4A, + 0x2C, 0x40, 0x01, 0x2A, 0x05, 0x00, 0x00, 0x63, 0x63, 0x47, 0xB4, 0x83, 0x59, 0xD9, 0x59, 0xDD, + 0x2C, 0x40, 0x02, 0x2A, 0x05, 0x00, 0x01, 0x63, 0x63, 0x47, 0xB4, 0x83, 0x59, 0xD9, 0x59, 0xDD, + 0x2C, 0x40, 0x04, 0x2A, 0x05, 0x00, 0x02, 0x63, 0x63, 0x47, 0xB4, 0x83, 0x59, 0xD9, 0x59, 0xDD, + 0x2A, 0x44, 0x51, 0x93, 0xEB, 0x83, 0xEB, 0x83, 0xA0, 0xDD, 0x2D, 0x58, 0xFF, 0xFF, 0x57, 0xF5, + 0xCB, 0xF3, 0xCC, 0xF1, 0x00, 0x63, 0xC0, 0x87, 0xCD, 0xF1, 0x5A, 0xFD, 0xC0, 0x85, 0x65, 0x47, + 0xC4, 0x84, 0x07, 0xB5, 0x18, 0x60, 0xE2, 0x64, 0x0F, 0x60, 0xA5, 0xFB, 0x02, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x04, 0xFF, 0x10, 0x60, 0x24, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x00, 0x60, 0x02, 0x64, + 0x08, 0x60, 0x13, 0xFB, 0xE2, 0x60, 0xA9, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x08, 0x60, 0x12, 0xF1, 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x10, 0x60, 0x24, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x57, 0xF5, 0x00, 0x64, 0x94, 0xFB, + 0x95, 0xFB, 0x96, 0xFB, 0x74, 0xFB, 0x65, 0xF3, 0x00, 0x75, 0x00, 0x72, 0xE0, 0x84, 0xE0, 0x84, + 0xE0, 0x93, 0xC7, 0xF3, 0xED, 0xE2, 0xCC, 0x84, 0x5A, 0xFB, 0x00, 0x60, 0x04, 0x64, 0x08, 0x60, + 0x13, 0xFB, 0xE2, 0x60, 0xC7, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, + 0x24, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x64, 0xF1, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x2B, 0x05, 0x00, + 0x67, 0x44, 0x16, 0x60, 0xC1, 0xFB, 0x16, 0x60, 0xD1, 0xFB, 0x16, 0x60, 0xF6, 0xF9, 0x2D, 0x60, + 0x86, 0x65, 0xE4, 0x60, 0x58, 0x4D, 0xE7, 0x78, 0xFF, 0xFF, 0x64, 0xF3, 0xFF, 0xFF, 0x60, 0x40, + 0x01, 0x2B, 0x05, 0x00, 0xFF, 0x60, 0xFF, 0x63, 0x16, 0x60, 0xC5, 0xFD, 0x08, 0x00, 0x2E, 0x60, + 0x1E, 0x63, 0x16, 0x60, 0xC5, 0xFD, 0xE4, 0x60, 0x58, 0x4D, 0xFF, 0x78, 0xFF, 0xFF, 0xE4, 0x60, + 0x58, 0x4D, 0x6E, 0x78, 0xFF, 0xFF, 0xE5, 0x60, 0x58, 0x4D, 0x18, 0x78, 0xFF, 0xFF, 0x57, 0xF5, + 0x00, 0xF4, 0x65, 0xF1, 0x06, 0xF8, 0x17, 0x60, 0x22, 0xF3, 0x15, 0x60, 0xDD, 0xF1, 0xFB, 0x60, + 0xFF, 0x65, 0x60, 0x44, 0xA4, 0x84, 0x60, 0x47, 0x64, 0x40, 0x10, 0x26, 0x04, 0xBC, 0x60, 0x47, + 0x07, 0xFA, 0x2D, 0x60, 0x7E, 0x64, 0x40, 0x48, 0x10, 0x61, 0x00, 0x60, 0x00, 0x64, 0xE4, 0x60, + 0x58, 0x4D, 0xA7, 0x78, 0xFF, 0xFF, 0x57, 0xF5, 0x3F, 0xFC, 0x5A, 0xF3, 0xC7, 0xF1, 0xAC, 0x83, + 0x01, 0x64, 0x02, 0x02, 0x6B, 0xFB, 0x64, 0x43, 0x1E, 0x60, 0xD4, 0x64, 0x0F, 0x60, 0x90, 0xFB, + 0x66, 0x44, 0x5A, 0xDB, 0x04, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0xCF, 0x83, + 0x72, 0xF3, 0x5A, 0xFD, 0xDC, 0x84, 0x72, 0xFB, 0x5C, 0xF3, 0xFF, 0xFF, 0xCC, 0x84, 0x5C, 0xFB, + 0x03, 0x03, 0xE3, 0x60, 0xBD, 0x78, 0xFF, 0xFF, 0x0A, 0x64, 0x5C, 0xFB, 0xA2, 0x4C, 0x20, 0x27, + 0xF8, 0x01, 0x46, 0x60, 0x50, 0x65, 0x72, 0x44, 0xD4, 0x80, 0xFF, 0xFF, 0xF2, 0x04, 0x5D, 0xFB, + 0x40, 0x48, 0x94, 0xF3, 0x5E, 0xFB, 0x40, 0x4A, 0x95, 0xF3, 0x96, 0xF3, 0x40, 0x4C, 0x60, 0x41, + 0x65, 0xF1, 0x40, 0x63, 0xAD, 0x80, 0xF0, 0xA3, 0x09, 0x02, 0x3C, 0x03, 0x2C, 0x41, 0x2A, 0x44, + 0x40, 0x4C, 0x28, 0x44, 0x40, 0x4A, 0x00, 0x64, 0x40, 0x48, 0xF4, 0x01, 0xD1, 0x80, 0x01, 0x02, + 0x31, 0x04, 0x10, 0xA3, 0x80, 0x60, 0x00, 0x65, 0xA5, 0x80, 0xCF, 0x83, 0x08, 0x02, 0x28, 0x44, + 0x60, 0x88, 0x2A, 0x44, 0x70, 0x8A, 0x2C, 0x44, 0x70, 0x8C, 0xF1, 0x81, 0xF5, 0x01, 0xE7, 0xA3, + 0x64, 0x44, 0x00, 0xA0, 0x00, 0x62, 0x02, 0x02, 0x00, 0x61, 0x1C, 0x00, 0xE0, 0x84, 0xDE, 0x82, + 0xFD, 0x04, 0x42, 0xFE, 0xF8, 0x84, 0x62, 0x45, 0xC7, 0x83, 0x60, 0x45, 0x02, 0xFE, 0xD5, 0x84, + 0x02, 0x05, 0x01, 0x05, 0x61, 0x44, 0xCF, 0x83, 0x60, 0x41, 0x08, 0x03, 0x28, 0x44, 0x60, 0x88, + 0x2A, 0x44, 0x70, 0x8A, 0x2C, 0x44, 0x70, 0x8C, 0xF1, 0x81, 0xF1, 0x01, 0xCE, 0x82, 0xE9, 0x81, + 0xFD, 0x02, 0xF1, 0x81, 0x61, 0x44, 0x00, 0xA8, 0xFF, 0xFF, 0x2F, 0x03, 0x73, 0x40, 0x5D, 0xF3, + 0xFF, 0xFF, 0x60, 0x47, 0xE8, 0x84, 0xE8, 0x84, 0x5E, 0xF3, 0x3F, 0xB5, 0xE0, 0x84, 0xE0, 0x84, + 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xB4, 0x84, 0x61, 0x45, 0xD4, 0x84, 0xC0, 0x84, + 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x81, 0x64, 0x44, 0x73, 0x45, 0xE0, 0x84, 0xE0, 0x84, + 0xE0, 0x84, 0xC4, 0x85, 0x61, 0x44, 0xD4, 0x80, 0xFF, 0xFF, 0x0F, 0x03, 0x60, 0x53, 0xD4, 0x84, + 0xFF, 0xFF, 0x74, 0xF3, 0xFF, 0xFF, 0xDC, 0x84, 0x01, 0xB4, 0x74, 0xFB, 0x13, 0x60, 0x06, 0xF3, + 0xFF, 0xFF, 0xDC, 0x84, 0x00, 0x36, 0x00, 0x3B, 0xA2, 0xDB, 0xE9, 0x60, 0xFB, 0x78, 0xFF, 0xFF, + 0xC1, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x04, 0x64, 0x03, 0xFA, 0x00, 0xF4, 0x09, 0xF2, 0xFF, 0xFF, + 0x60, 0x47, 0x00, 0x3A, 0x1C, 0x00, 0x60, 0x43, 0x00, 0x36, 0x1C, 0x00, 0xE0, 0xA0, 0xDA, 0x85, + 0x16, 0x07, 0x26, 0x60, 0x16, 0x61, 0xA1, 0xD1, 0xFF, 0xFF, 0xD3, 0x80, 0xCB, 0x83, 0x0F, 0x02, + 0x07, 0x0E, 0x59, 0xD3, 0xA5, 0xD0, 0xDA, 0x85, 0xD0, 0x80, 0xFF, 0xFF, 0x08, 0x02, 0xF9, 0x1F, + 0x12, 0x1E, 0xA5, 0xD0, 0x59, 0xD3, 0xFF, 0xFF, 0x90, 0x80, 0xFF, 0x22, 0x0C, 0x00, 0xE4, 0x60, + 0x63, 0x78, 0xFF, 0xFF, 0x13, 0x60, 0x44, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, 0x03, 0x00, + 0x26, 0x60, 0x38, 0x64, 0x02, 0x00, 0x26, 0x60, 0x16, 0x64, 0x16, 0x60, 0xCF, 0xFB, 0x26, 0x46, + 0x2F, 0xF2, 0x2C, 0xFA, 0x30, 0xF2, 0x2D, 0xFA, 0x31, 0xF2, 0x2E, 0xFA, 0xCB, 0xF1, 0x2F, 0xF8, + 0xCC, 0xF1, 0x30, 0xF8, 0xCD, 0xF1, 0x31, 0xF8, 0x66, 0xF1, 0x32, 0xF8, 0x67, 0xF1, 0x33, 0xF8, + 0x68, 0xF1, 0x34, 0xF8, 0x00, 0x65, 0xEF, 0x60, 0x58, 0x4E, 0xDC, 0x78, 0xFF, 0xFF, 0x61, 0x44, + 0x15, 0x60, 0xC2, 0xFB, 0x50, 0x63, 0x2A, 0xFC, 0xAB, 0xF3, 0x19, 0xFA, 0x00, 0x64, 0x3E, 0xFA, + 0x87, 0xF3, 0x07, 0xFA, 0x00, 0xF4, 0x65, 0xF1, 0x06, 0xF8, 0x17, 0x60, 0x22, 0xF3, 0x15, 0x60, + 0xDD, 0xF1, 0xFB, 0x60, 0xFF, 0xB7, 0x64, 0x40, 0x10, 0x26, 0x04, 0xBC, 0x60, 0x47, 0x07, 0xFA, + 0x2D, 0x60, 0xA6, 0x65, 0xE4, 0x60, 0x58, 0x4D, 0xE7, 0x78, 0xFF, 0xFF, 0x64, 0xF3, 0x2E, 0x60, + 0x1E, 0x63, 0x60, 0x40, 0x01, 0x27, 0x67, 0x43, 0x16, 0x60, 0xD5, 0xFD, 0x2D, 0x60, 0x9E, 0x64, + 0x40, 0x48, 0x10, 0x61, 0x00, 0x60, 0x00, 0x64, 0xE4, 0x60, 0x58, 0x4D, 0xA7, 0x78, 0xFF, 0xFF, + 0x26, 0x46, 0x3F, 0xFC, 0x1E, 0x60, 0xD4, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x26, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x20, 0x44, 0x80, 0x26, 0x11, 0x00, + 0x80, 0xBC, 0x40, 0x40, 0x00, 0x64, 0x94, 0xFB, 0x95, 0xFB, 0x96, 0xFB, 0x74, 0xFB, 0x65, 0xF3, + 0x00, 0x75, 0x00, 0x72, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x93, 0xC7, 0xF3, 0xED, 0xE2, 0xCC, 0x84, + 0x5A, 0xFB, 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x64, 0x08, 0x60, 0x12, 0xFB, + 0x5A, 0xDB, 0x00, 0x64, 0x72, 0xFB, 0x74, 0xFB, 0x2F, 0x58, 0xFF, 0xFF, 0x3E, 0x63, 0x18, 0x60, + 0x94, 0x61, 0x59, 0xD1, 0x61, 0x46, 0x07, 0x1B, 0xFC, 0x1F, 0x2D, 0x60, 0xC8, 0x62, 0xA2, 0xDF, + 0x01, 0x65, 0x00, 0x61, 0x16, 0x00, 0x18, 0x60, 0xD6, 0x61, 0x49, 0xD1, 0xCB, 0x83, 0xFD, 0x18, + 0x63, 0x41, 0x04, 0xA1, 0x61, 0x45, 0x66, 0x43, 0x2D, 0x60, 0xC8, 0x64, 0xDC, 0x84, 0x60, 0xFE, + 0xBD, 0xD1, 0xA0, 0xD9, 0xCD, 0x81, 0x20, 0xFE, 0xF9, 0x02, 0x66, 0x44, 0x18, 0x60, 0x96, 0x7C, + 0xD0, 0x81, 0x5A, 0xF3, 0xC7, 0xF1, 0x2D, 0x60, 0xC6, 0x63, 0x00, 0xA0, 0x64, 0x5F, 0xBD, 0xDB, + 0x0F, 0x60, 0x6D, 0xF1, 0x02, 0x02, 0x01, 0x18, 0x01, 0xB9, 0x61, 0x44, 0x60, 0xFE, 0xA3, 0xDB, + 0xFC, 0xA3, 0x65, 0x44, 0x03, 0xA4, 0xA3, 0xDB, 0x20, 0xFE, 0x2D, 0x58, 0xFF, 0xFF, 0x17, 0x60, + 0x23, 0xFB, 0xCD, 0x81, 0x28, 0xD3, 0x5A, 0x88, 0xDC, 0x83, 0x31, 0x18, 0xFB, 0x03, 0x61, 0x40, + 0x7F, 0x3A, 0x06, 0x00, 0x17, 0x60, 0x23, 0xF3, 0x03, 0x61, 0x7C, 0xA4, 0xA2, 0xDB, 0x00, 0xF4, + 0x60, 0xFE, 0xA3, 0xD1, 0x5D, 0xD8, 0x61, 0x40, 0x7F, 0x3A, 0x08, 0x00, 0x20, 0xFE, 0x17, 0x60, + 0x23, 0xF3, 0x03, 0x61, 0x7C, 0xA4, 0xA2, 0xDB, 0x00, 0xF4, 0x60, 0xFE, 0xBF, 0xD3, 0x5D, 0xDA, + 0xFF, 0xB4, 0x00, 0x7F, 0x12, 0x03, 0xDF, 0x83, 0x61, 0x40, 0x7F, 0x3A, 0x0A, 0x00, 0x20, 0xFE, + 0x60, 0x45, 0x17, 0x60, 0x23, 0xF3, 0x03, 0x61, 0x7C, 0xA4, 0xA2, 0xDB, 0x65, 0x44, 0x00, 0xF4, + 0x60, 0xFE, 0xBD, 0xD1, 0xCC, 0x84, 0x5D, 0xD8, 0xEF, 0x02, 0x20, 0xFE, 0xCB, 0x01, 0x17, 0x60, + 0x23, 0xF1, 0xFD, 0xA1, 0xFF, 0xB1, 0xC1, 0x83, 0xA2, 0xDD, 0x2D, 0x58, 0xFF, 0xFF, 0x67, 0x5C, + 0x14, 0x60, 0x26, 0x61, 0xA1, 0xD3, 0xA5, 0xD9, 0x10, 0x18, 0x60, 0x43, 0x2D, 0x60, 0xEE, 0x64, + 0xA5, 0xDB, 0x60, 0xFE, 0xA0, 0xDD, 0x20, 0xFE, 0xDC, 0x84, 0xCF, 0x83, 0xE3, 0x83, 0x59, 0xD1, + 0xDC, 0x84, 0x60, 0xFE, 0xA0, 0xD9, 0x20, 0xFE, 0xFA, 0x1F, 0x2D, 0x58, 0xFF, 0xFF, 0x15, 0x60, + 0xDC, 0xF1, 0x15, 0x60, 0xDD, 0xF3, 0x64, 0x40, 0x01, 0x2A, 0x02, 0xBC, 0x64, 0x40, 0x02, 0x2A, + 0x04, 0xBC, 0x64, 0x40, 0x04, 0x2A, 0xEF, 0xB4, 0x15, 0x60, 0xDD, 0xFB, 0x07, 0xB4, 0x60, 0xFE, + 0x17, 0x60, 0x10, 0xFB, 0x20, 0xFE, 0x07, 0x7C, 0x15, 0x60, 0xDC, 0xF9, 0x2D, 0x58, 0xFF, 0xFF, + 0x20, 0x40, 0x20, 0x2A, 0x0A, 0x00, 0x0A, 0x60, 0x77, 0xF1, 0x50, 0xF3, 0x2E, 0x60, 0x31, 0x63, + 0x60, 0xFE, 0xBD, 0xD9, 0x60, 0x47, 0xA3, 0xDB, 0x20, 0xFE, 0x2D, 0x58, 0xFF, 0xFF, 0x0E, 0x57, + 0x32, 0x40, 0x40, 0x26, 0x24, 0x00, 0x45, 0x48, 0x00, 0x60, 0x10, 0x61, 0xB5, 0x60, 0x58, 0x4D, + 0x9F, 0x78, 0xFF, 0xFF, 0x1C, 0x03, 0xF2, 0x60, 0x02, 0x64, 0x24, 0xFA, 0x00, 0x60, 0x48, 0x61, + 0x28, 0x44, 0x59, 0xDA, 0x03, 0x64, 0x38, 0x43, 0xBD, 0xD1, 0xCC, 0x84, 0x59, 0xD8, 0xFC, 0x02, + 0x39, 0x44, 0x59, 0xDA, 0x06, 0x64, 0x23, 0xFA, 0x1F, 0x60, 0x10, 0x64, 0x0F, 0x60, 0x90, 0xFB, + 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xFA, 0xFE, 0x37, 0x58, + 0xFF, 0xFF, 0x0E, 0x57, 0x32, 0x40, 0x40, 0x26, 0x4F, 0x00, 0x45, 0x48, 0x00, 0x60, 0x68, 0x61, + 0xB5, 0x60, 0x58, 0x4D, 0x9F, 0x78, 0xFF, 0xFF, 0x47, 0x03, 0xF2, 0x60, 0x01, 0x64, 0x24, 0xFA, + 0x02, 0x60, 0x00, 0x61, 0x46, 0x4A, 0x38, 0x44, 0x54, 0x94, 0x03, 0x64, 0x01, 0x02, 0x09, 0x00, + 0x06, 0x63, 0x4A, 0x61, 0x38, 0x46, 0xBD, 0xD0, 0xCC, 0x84, 0x2A, 0x46, 0x59, 0xD8, 0xFA, 0x02, + 0x06, 0x00, 0xDA, 0x81, 0x38, 0x43, 0xBD, 0xD1, 0xCC, 0x84, 0x59, 0xD8, 0xFC, 0x02, 0x05, 0x63, + 0x28, 0x44, 0x02, 0xA8, 0x25, 0xFA, 0x07, 0x02, 0x03, 0x64, 0x39, 0x43, 0xBD, 0xD1, 0xCC, 0x84, + 0x59, 0xD8, 0xFC, 0x02, 0x08, 0x63, 0x28, 0x44, 0x03, 0xA8, 0x16, 0x60, 0x82, 0xF3, 0x0F, 0x03, + 0xE8, 0x85, 0xC7, 0x85, 0x60, 0x43, 0xFE, 0xA3, 0x2D, 0x60, 0x06, 0x64, 0x58, 0xD1, 0xD9, 0x81, + 0xA1, 0xD8, 0x7E, 0x2A, 0x02, 0x00, 0x00, 0xF4, 0x02, 0x61, 0xF8, 0x1F, 0x65, 0x43, 0x2A, 0x46, + 0x23, 0xFC, 0x1F, 0x60, 0x10, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xFA, 0xFE, 0x37, 0x58, 0xFF, 0xFF, 0x0E, 0x57, 0x32, 0x40, + 0x40, 0x26, 0x1B, 0x00, 0x45, 0x48, 0x00, 0x60, 0x06, 0x61, 0xB5, 0x60, 0x58, 0x4D, 0x9F, 0x78, + 0xFF, 0xFF, 0x13, 0x03, 0x02, 0x64, 0x23, 0xFA, 0xF2, 0x60, 0x00, 0x64, 0x5A, 0xDA, 0x28, 0x44, + 0x5A, 0xDA, 0xFF, 0xFF, 0x1F, 0x60, 0x10, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xFA, 0xFE, 0x37, 0x58, 0xFF, 0xFF, 0xA0, 0xD3, + 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x03, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, + 0xDD, 0x98, 0xFF, 0xFF, 0x97, 0xF1, 0xA0, 0xD3, 0xFF, 0xFF, 0xD8, 0x80, 0xC4, 0x84, 0x0C, 0x03, + 0x08, 0x05, 0xDC, 0x80, 0xD0, 0x80, 0x05, 0x03, 0xA2, 0xDB, 0x02, 0x24, 0xC6, 0xFE, 0xDD, 0x98, + 0xFF, 0xFF, 0xFF, 0x60, 0xFE, 0x64, 0xA2, 0xDB, 0xDD, 0x98, 0xFF, 0xFF, 0xA2, 0xFF, 0x32, 0x40, + 0x40, 0x26, 0x3C, 0x00, 0x7B, 0xF3, 0x67, 0x43, 0xDC, 0x84, 0xCC, 0x84, 0x37, 0x03, 0x60, 0x46, + 0x0A, 0x02, 0x7B, 0xFD, 0x00, 0x60, 0x46, 0x61, 0xB5, 0x60, 0x58, 0x4D, 0x9F, 0x78, 0xFF, 0xFF, + 0x66, 0x44, 0x7B, 0xFB, 0x2C, 0x03, 0x46, 0x4B, 0x25, 0x60, 0xD0, 0x61, 0x18, 0x64, 0x23, 0xFA, + 0xF1, 0x60, 0x00, 0x64, 0x24, 0xFA, 0x4A, 0x65, 0xA2, 0xFF, 0x2C, 0x63, 0x59, 0xD1, 0xA2, 0xDF, + 0xA5, 0xD8, 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0xF7, 0x1F, 0x12, 0x63, + 0x59, 0xD1, 0xA5, 0xD8, 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0xF8, 0x1F, + 0x1F, 0x60, 0x10, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x2B, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0xFA, 0xFE, 0xA6, 0xFE, 0x00, 0x64, 0x7B, 0xFB, 0xA3, 0xFF, 0xCA, 0x60, + 0x7E, 0x78, 0xFF, 0xFF, 0xA6, 0xFE, 0xBA, 0x05, 0xA7, 0xFE, 0x0A, 0x05, 0xA5, 0xFE, 0x03, 0x04, + 0xE6, 0x60, 0x8E, 0x78, 0xFF, 0xFF, 0xA4, 0xFE, 0xF2, 0x04, 0xE7, 0x60, 0x1F, 0x78, 0xFF, 0xFF, + 0x36, 0x45, 0x19, 0x60, 0x86, 0x64, 0x44, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0x28, 0xF3, 0x7D, 0xF1, + 0x60, 0x47, 0x07, 0xB4, 0x4E, 0xFB, 0x01, 0x61, 0x03, 0x03, 0xCC, 0x84, 0xE1, 0x81, 0xFD, 0x02, + 0x9D, 0x84, 0xA1, 0x80, 0xA0, 0x83, 0x15, 0x03, 0x7D, 0xFD, 0x08, 0x60, 0x24, 0xF1, 0x00, 0x60, + 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x31, 0x44, 0xDE, 0xB4, 0x40, 0x51, 0x01, 0x7C, + 0xBC, 0xF9, 0x49, 0xF3, 0x01, 0x63, 0x60, 0x40, 0xFF, 0x26, 0x49, 0xFD, 0xCA, 0x60, 0x7E, 0x78, + 0xFF, 0xFF, 0xE6, 0x60, 0x8E, 0x78, 0xFF, 0xFF, 0x26, 0x60, 0xB0, 0x63, 0xBD, 0xD3, 0xBD, 0xD1, + 0xBD, 0xD1, 0xB0, 0x84, 0xB0, 0x84, 0xFF, 0xFF, 0x07, 0x02, 0x6A, 0xFB, 0x31, 0x44, 0xFE, 0xB4, + 0x40, 0x51, 0x0D, 0x64, 0x05, 0xFB, 0x1A, 0x00, 0x28, 0xF3, 0xFF, 0xFF, 0x13, 0x60, 0x52, 0xF3, + 0xC5, 0xFB, 0x64, 0xFB, 0x0F, 0x60, 0x85, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x46, 0x5E, + 0x31, 0x44, 0x21, 0xBC, 0x40, 0x51, 0xED, 0xE2, 0x0F, 0x4E, 0xD0, 0x60, 0x58, 0x4F, 0xA8, 0x78, + 0xFF, 0xFF, 0x0E, 0x4F, 0x00, 0x00, 0xE8, 0x60, 0x74, 0x78, 0xFF, 0xFF, 0xD7, 0xFE, 0xCA, 0x60, + 0x7E, 0x78, 0xFF, 0xFF, 0x2E, 0xF5, 0x27, 0xF2, 0x15, 0x60, 0x02, 0x65, 0x60, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, + 0x27, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x26, 0xF0, 0x63, 0x46, + 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x25, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, + 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0x87, 0xF3, 0x08, 0xFE, 0x60, 0x43, + 0x61, 0x46, 0x26, 0x02, 0x0B, 0x60, 0x82, 0xF3, 0xDA, 0x81, 0x60, 0x45, 0xD5, 0x80, 0xA1, 0xD1, + 0x04, 0x03, 0xD3, 0x80, 0xD9, 0x81, 0xFA, 0x02, 0x08, 0x00, 0xA1, 0xDD, 0xD9, 0x84, 0x0B, 0x60, + 0x82, 0xFB, 0x4A, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xA2, 0xDB, 0x66, 0x45, 0x63, 0x46, 0x06, 0xF2, + 0xFF, 0x60, 0x01, 0x7C, 0xA0, 0x9C, 0x06, 0xF8, 0x65, 0x46, 0x70, 0xF3, 0x60, 0x40, 0x10, 0x2A, + 0x03, 0x00, 0xCC, 0x84, 0x80, 0x2B, 0x70, 0xFB, 0xE7, 0x60, 0x58, 0x4E, 0x81, 0x78, 0xFF, 0xFF, + 0xAD, 0x01, 0x2E, 0xF5, 0x28, 0xF0, 0x18, 0x60, 0x12, 0xF9, 0x27, 0xF2, 0x15, 0x60, 0x02, 0x65, + 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, + 0x16, 0x18, 0x61, 0x46, 0x27, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, + 0x26, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x25, 0xF0, 0x63, 0x46, + 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0x87, 0xF3, + 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x12, 0x02, 0x63, 0x46, 0x06, 0xF2, 0xFF, 0xFF, 0x02, 0xB0, + 0x08, 0xBC, 0x0C, 0x03, 0x06, 0xFA, 0xE7, 0x60, 0x58, 0x4E, 0x81, 0x78, 0xFF, 0xFF, 0x08, 0x60, + 0x1E, 0xF1, 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x6F, 0x01, 0x01, 0x64, + 0x51, 0xFB, 0x28, 0x60, 0x4E, 0x64, 0x52, 0xFB, 0x15, 0x60, 0xC3, 0xF3, 0xFF, 0xFF, 0x15, 0x18, + 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x08, 0x60, 0x1B, 0xF1, 0x00, 0x60, 0x10, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x10, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xE7, 0x60, + 0x3D, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x2B, 0x60, 0x88, 0x61, 0xFF, 0x60, + 0x80, 0x65, 0xA1, 0xD3, 0xFF, 0xFF, 0xA4, 0x80, 0x59, 0xD3, 0x05, 0x02, 0x04, 0x1B, 0x59, 0xD3, + 0xFF, 0xFF, 0x01, 0x1B, 0x15, 0x00, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x08, 0x60, + 0x1B, 0xF1, 0x00, 0x60, 0x20, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x10, 0x60, 0x00, 0x64, + 0x08, 0x60, 0x16, 0xFB, 0xE7, 0x60, 0x60, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x00, 0x60, 0x04, 0x61, 0xB5, 0x60, 0x58, 0x4D, 0x9F, 0x78, 0xFF, 0xFF, 0x01, 0x64, 0x23, 0xFA, + 0xF1, 0x60, 0x02, 0x64, 0x24, 0xFA, 0x1F, 0x60, 0x10, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x66, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xFA, 0xFE, 0x00, 0x60, 0x30, 0x64, + 0x08, 0x60, 0x16, 0xFB, 0xD2, 0x60, 0xB5, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0xCA, 0x60, 0x7E, 0x78, + 0xFF, 0xFF, 0x0E, 0x57, 0x63, 0x46, 0x43, 0x47, 0x22, 0xF2, 0x76, 0xF2, 0x02, 0x1B, 0x01, 0x1B, + 0x0C, 0x00, 0x60, 0x46, 0x1F, 0x60, 0x20, 0x64, 0x40, 0x4B, 0xF6, 0x60, 0x58, 0x4D, 0xB3, 0x78, + 0xFF, 0xFF, 0x27, 0x46, 0x76, 0xF2, 0xFF, 0xFF, 0xF4, 0x1B, 0x37, 0x58, 0xFF, 0xFF, 0xE7, 0x60, + 0x9F, 0x64, 0x08, 0x60, 0x2A, 0xFB, 0x2F, 0x58, 0xFF, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x64, + 0x08, 0x60, 0x21, 0xFB, 0x5A, 0xDB, 0x10, 0x60, 0x42, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x2F, 0x58, + 0xFF, 0xFF, 0x28, 0xF3, 0x7D, 0xF1, 0x60, 0x47, 0x07, 0xB4, 0x4E, 0xFB, 0x01, 0x61, 0x03, 0x03, + 0xCC, 0x84, 0xE1, 0x81, 0xFD, 0x02, 0xA1, 0x80, 0xB1, 0x83, 0x16, 0x02, 0xCF, 0x85, 0xA7, 0x80, + 0x7D, 0xFD, 0x0B, 0x02, 0x01, 0x65, 0xE5, 0x60, 0x58, 0x4E, 0xA6, 0x78, 0xFF, 0xFF, 0x31, 0x44, + 0xDF, 0xB4, 0x40, 0x51, 0xD0, 0x60, 0xD9, 0x78, 0xFF, 0xFF, 0x08, 0x60, 0x21, 0xF1, 0x00, 0x60, + 0x01, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0xE6, 0x60, 0x8E, 0x78, 0xFF, 0xFF, 0x28, 0xF3, + 0x7D, 0xF1, 0x60, 0x47, 0x07, 0xB4, 0x4E, 0xFB, 0x01, 0x61, 0x03, 0x03, 0xCC, 0x84, 0xE1, 0x81, + 0xFD, 0x02, 0x9D, 0x84, 0xA1, 0x80, 0xA0, 0x83, 0x13, 0x03, 0x7D, 0xFD, 0x08, 0x60, 0x24, 0xF1, + 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x7D, 0xF1, 0x31, 0x44, 0x64, 0x40, + 0xFF, 0x26, 0x03, 0x00, 0x21, 0xBC, 0x40, 0x51, 0x03, 0x00, 0xCA, 0x60, 0x7E, 0x78, 0xFF, 0xFF, + 0xE6, 0x60, 0x8E, 0x78, 0xFF, 0xFF, 0x0E, 0x57, 0x32, 0x40, 0x40, 0x26, 0x1B, 0x00, 0x45, 0x48, + 0x00, 0x60, 0x06, 0x61, 0xB5, 0x60, 0x58, 0x4D, 0x9F, 0x78, 0xFF, 0xFF, 0x13, 0x03, 0x02, 0x64, + 0x23, 0xFA, 0xF2, 0x60, 0x04, 0x64, 0x5A, 0xDA, 0x28, 0x44, 0x5A, 0xDA, 0xFF, 0xFF, 0x1F, 0x60, + 0x10, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0xFA, 0xFE, 0x37, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0x79, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, + 0x60, 0x46, 0x0E, 0xF2, 0x59, 0x03, 0x60, 0x40, 0xF0, 0x37, 0x46, 0x00, 0xFF, 0x37, 0x3B, 0x00, + 0xFD, 0x37, 0x33, 0x00, 0x18, 0x37, 0x27, 0x00, 0xFE, 0x37, 0x2A, 0x00, 0xF8, 0x37, 0x0A, 0x00, + 0x60, 0x47, 0xFF, 0xB5, 0x10, 0x60, 0x24, 0x62, 0x46, 0xD1, 0x00, 0x60, 0x01, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x00, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xD8, 0x01, 0x06, 0xB4, 0xFD, 0x7F, 0x0E, 0xFA, 0x1E, 0x60, + 0xF8, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0xF9, 0xFE, 0xC9, 0x01, 0xDE, 0x60, 0x58, 0x4F, 0x6C, 0x78, 0xFF, 0xFF, 0x14, 0x00, + 0xE1, 0x60, 0x58, 0x4F, 0x32, 0x78, 0xFF, 0xFF, 0xBF, 0x03, 0x23, 0xF0, 0x60, 0x40, 0x04, 0x26, + 0xE3, 0x1B, 0x02, 0x26, 0xE1, 0x18, 0xA2, 0xFF, 0x02, 0xF0, 0x09, 0x60, 0x08, 0x64, 0xD0, 0x80, + 0x8F, 0xF3, 0x02, 0x02, 0xCC, 0x84, 0x8F, 0xFB, 0x1F, 0x60, 0x20, 0x64, 0x40, 0x4B, 0xF6, 0x60, + 0x58, 0x4D, 0xB3, 0x78, 0xFF, 0xFF, 0xA8, 0x01, 0xAC, 0xFE, 0x09, 0x05, 0xAD, 0xFE, 0x0F, 0x05, + 0xAE, 0xFE, 0xA2, 0x05, 0xAF, 0xFE, 0x37, 0x05, 0xCA, 0x60, 0x7E, 0x78, 0xFF, 0xFF, 0x08, 0x60, + 0x11, 0xF1, 0x20, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0xF5, 0x01, 0x10, 0x60, + 0x56, 0x65, 0x03, 0x61, 0x07, 0x00, 0xA2, 0xDD, 0x58, 0x4F, 0x64, 0x58, 0xFF, 0xFF, 0x00, 0xB9, + 0xFF, 0xFF, 0x08, 0x03, 0x00, 0x63, 0xA5, 0xD1, 0x5A, 0xD3, 0xDA, 0x85, 0x00, 0xA8, 0xCD, 0x81, + 0xF2, 0x02, 0xF8, 0x02, 0xE1, 0x01, 0x10, 0x60, 0x20, 0x62, 0x10, 0x60, 0x46, 0x65, 0xE8, 0x60, + 0xA9, 0x63, 0x5A, 0xDF, 0xD6, 0x80, 0xFF, 0xFF, 0x04, 0x03, 0x5A, 0xDF, 0x5A, 0xDF, 0x5A, 0xDD, + 0xF9, 0x01, 0x10, 0x60, 0x54, 0x65, 0x5A, 0xDF, 0xD6, 0x80, 0xFF, 0xFF, 0x02, 0x03, 0x5A, 0xDD, + 0xFB, 0x01, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, 0x24, 0x64, 0x40, 0x41, 0x10, 0x60, 0x22, 0x63, + 0xA3, 0xD1, 0x00, 0x64, 0xD0, 0x80, 0x06, 0x61, 0x08, 0x03, 0xBD, 0xDB, 0xA3, 0xD3, 0xFF, 0xFF, + 0xB0, 0x84, 0xCD, 0x81, 0xA3, 0xDB, 0x06, 0xA3, 0xF9, 0x02, 0x10, 0x60, 0x48, 0x63, 0xA3, 0xD1, + 0x00, 0x64, 0xD0, 0x80, 0x07, 0x61, 0x19, 0x03, 0xBD, 0xDB, 0x64, 0x44, 0xFE, 0xA3, 0x02, 0xA3, + 0xCD, 0x81, 0xE8, 0x84, 0xE3, 0x03, 0x02, 0x05, 0xE1, 0x03, 0xF9, 0x01, 0x77, 0xFB, 0x79, 0xFD, + 0x61, 0x5C, 0xA3, 0xD3, 0x78, 0xF9, 0x03, 0x18, 0x58, 0x4F, 0x60, 0x58, 0xFF, 0xFF, 0x79, 0xF3, + 0x78, 0xF1, 0x60, 0x43, 0x77, 0xF3, 0x64, 0x41, 0xEA, 0x01, 0x21, 0x43, 0x10, 0x60, 0x48, 0x65, + 0xD7, 0x80, 0xBD, 0xD1, 0xBD, 0xD3, 0x03, 0x02, 0xCA, 0x60, 0x7E, 0x78, 0xFF, 0xFF, 0xA0, 0x84, + 0xBD, 0xD1, 0x43, 0x41, 0xF5, 0x03, 0xE8, 0x60, 0xAE, 0x64, 0x64, 0x58, 0x40, 0x4F, 0x2A, 0xF0, + 0x83, 0x60, 0xFF, 0x65, 0x64, 0x47, 0x03, 0x2B, 0x01, 0x00, 0x17, 0x00, 0x03, 0x26, 0x03, 0xAC, + 0x60, 0x47, 0xA4, 0x84, 0x2A, 0xFA, 0x2F, 0xF2, 0x2C, 0xFA, 0x30, 0xF2, 0x2D, 0xFA, 0x31, 0xF2, + 0x2E, 0xFA, 0x64, 0x41, 0xCB, 0xF3, 0x2F, 0xFA, 0x60, 0x43, 0xCC, 0xF3, 0x30, 0xFA, 0xCD, 0xF1, + 0x31, 0xF8, 0x32, 0xFC, 0x33, 0xFA, 0x34, 0xF8, 0x19, 0x00, 0x60, 0x47, 0xA4, 0x84, 0x2A, 0xFA, + 0x2F, 0xF2, 0x2C, 0xFA, 0x30, 0xF2, 0x2D, 0xFA, 0x31, 0xF2, 0x2E, 0xFA, 0x36, 0xF2, 0x32, 0xFA, + 0x37, 0xF2, 0x33, 0xFA, 0x38, 0xF2, 0x34, 0xFA, 0xCB, 0xF3, 0x2F, 0xFA, 0x36, 0xFA, 0xCC, 0xF3, + 0x30, 0xFA, 0x37, 0xFA, 0xCD, 0xF3, 0x31, 0xFA, 0x38, 0xFA, 0x64, 0x41, 0x1C, 0xF2, 0x13, 0xFA, + 0x00, 0xF4, 0x0D, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x2B, 0x28, 0x00, 0x26, 0x46, 0x04, 0x63, + 0x03, 0xFC, 0x00, 0xF4, 0x0D, 0xF2, 0x06, 0xFA, 0xEA, 0x60, 0x58, 0x4E, 0x49, 0x78, 0xFF, 0xFF, + 0xFF, 0xA0, 0x59, 0xF5, 0x19, 0x02, 0x39, 0xF2, 0x26, 0x46, 0x3F, 0xFA, 0x00, 0xF4, 0x00, 0x60, + 0x81, 0x67, 0x0D, 0xFA, 0x7C, 0x64, 0x01, 0xFA, 0x26, 0x46, 0x00, 0x64, 0x3E, 0xFA, 0x1E, 0x60, + 0xE0, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0xC8, 0xFE, 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x26, 0x46, 0x3F, 0xF0, + 0x42, 0x64, 0xD0, 0x80, 0xFF, 0xFF, 0x01, 0x04, 0x3F, 0xFA, 0x1C, 0xF2, 0x13, 0xFA, 0x26, 0xF2, + 0x27, 0xF0, 0x60, 0x47, 0x00, 0xF4, 0x1F, 0xFA, 0x64, 0x47, 0x20, 0xFA, 0x61, 0x44, 0x21, 0xFA, + 0x01, 0x67, 0x0D, 0xFA, 0x10, 0x61, 0x26, 0x60, 0x64, 0x64, 0x1E, 0x63, 0x58, 0xD1, 0xCD, 0x81, + 0xBD, 0xD8, 0xFC, 0x02, 0x9A, 0xF1, 0xB7, 0xF1, 0x64, 0x5E, 0x64, 0x5F, 0x44, 0x63, 0xBD, 0xDA, + 0x13, 0x60, 0x2F, 0xF3, 0xFF, 0xFF, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0x09, 0xBC, 0x4A, 0xD3, + 0x60, 0x45, 0x60, 0x40, 0x01, 0x36, 0x03, 0x64, 0x02, 0x36, 0x01, 0x64, 0xB4, 0x84, 0x06, 0xA2, + 0xA2, 0xD1, 0xBD, 0xDA, 0x64, 0x47, 0xBD, 0xDA, 0xB4, 0xF3, 0xB5, 0xF1, 0x60, 0x47, 0xBD, 0xDA, + 0x64, 0x47, 0xC3, 0xF1, 0xBD, 0xDA, 0x64, 0x44, 0xBD, 0xDA, 0x26, 0x46, 0x00, 0x64, 0x23, 0xF0, + 0x3B, 0xF0, 0x64, 0x40, 0x10, 0x2A, 0x06, 0x00, 0xC0, 0x67, 0xA0, 0x84, 0xE8, 0x84, 0xE8, 0x84, + 0xE8, 0x84, 0x10, 0xBC, 0x3E, 0xFA, 0x1E, 0x60, 0xE0, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x26, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC8, 0xFE, 0x00, 0x66, 0x46, 0x46, + 0x2F, 0x58, 0xFF, 0xFF, 0x04, 0x60, 0x5C, 0x61, 0xB5, 0x60, 0x58, 0x4D, 0xA2, 0x78, 0xFF, 0xFF, + 0x66, 0x44, 0x59, 0xFB, 0x04, 0x64, 0x03, 0xFA, 0x2F, 0x58, 0xFF, 0xFF, 0x59, 0xF5, 0xAB, 0xF1, + 0x19, 0xF8, 0x00, 0x64, 0x3E, 0xFA, 0x08, 0x64, 0x2A, 0xFA, 0x80, 0x7E, 0xF8, 0x7F, 0x0E, 0xFA, + 0x87, 0xF1, 0x07, 0xF8, 0x01, 0x60, 0x60, 0x67, 0x2C, 0xFA, 0x1D, 0x60, 0x00, 0x67, 0x2D, 0xFA, + 0x01, 0x60, 0x00, 0x67, 0x2E, 0xFA, 0xCB, 0xF1, 0x2F, 0xF8, 0x32, 0xF8, 0xCC, 0xF1, 0x30, 0xF8, + 0x33, 0xF8, 0xCD, 0xF1, 0x31, 0xF8, 0x34, 0xF8, 0x00, 0x63, 0x3B, 0xFC, 0x3D, 0xFC, 0x01, 0x64, + 0x3A, 0xFA, 0x66, 0x64, 0x39, 0xFA, 0x3C, 0xFC, 0xAA, 0x60, 0xAA, 0x64, 0x00, 0xF4, 0x02, 0xFA, + 0x00, 0x60, 0x03, 0x64, 0x5A, 0xDA, 0x1D, 0x60, 0x60, 0x64, 0x5A, 0xDA, 0x01, 0x60, 0x00, 0x64, + 0x5A, 0xDA, 0x81, 0x7F, 0x18, 0x7E, 0x08, 0xFA, 0x01, 0x60, 0x01, 0x64, 0x0A, 0xFA, 0x00, 0x64, + 0x0E, 0xFA, 0x2D, 0x58, 0xFF, 0xFF, 0x59, 0xF5, 0x3D, 0xF2, 0x3C, 0xF2, 0xCC, 0x83, 0x00, 0xA8, + 0x03, 0x03, 0x08, 0x28, 0x3D, 0xFC, 0x42, 0x00, 0x3D, 0xFA, 0x3A, 0xF2, 0x3B, 0xF0, 0x00, 0x63, + 0x00, 0xF4, 0x07, 0xFC, 0x01, 0xB0, 0x0B, 0xFA, 0x19, 0x03, 0x1F, 0xF8, 0xFF, 0xFF, 0x18, 0x64, + 0x0F, 0x60, 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x0A, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0x1F, 0xF2, 0x1E, 0xF0, 0x59, 0xF5, 0x00, 0xA8, 0x3B, 0xF8, 0xD0, 0x80, 0x06, 0x03, 0x05, 0x03, + 0x04, 0x60, 0x5C, 0x63, 0x0F, 0x64, 0x3A, 0xFA, 0x39, 0xFC, 0x00, 0xF4, 0x00, 0x64, 0x06, 0xFA, + 0xEA, 0x60, 0x58, 0x4E, 0x49, 0x78, 0xFF, 0xFF, 0x59, 0xF5, 0x00, 0xF4, 0x81, 0x60, 0x00, 0x64, + 0x06, 0xFA, 0x32, 0x47, 0x07, 0xFA, 0xB7, 0xF1, 0x00, 0x7F, 0x64, 0x5E, 0x09, 0xFA, 0x59, 0xF5, + 0x00, 0x64, 0x15, 0xFA, 0x39, 0xF2, 0x3F, 0xFA, 0x1E, 0x60, 0xCE, 0x64, 0x0F, 0x60, 0x90, 0xFB, + 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xE3, 0x60, 0xC0, 0x78, + 0xFF, 0xFF, 0x66, 0x45, 0x0E, 0xF2, 0x0F, 0xF0, 0x10, 0xF0, 0x64, 0x41, 0x01, 0xA8, 0x59, 0xF5, + 0x09, 0x02, 0xAD, 0x83, 0x64, 0x44, 0xAC, 0x84, 0x08, 0x24, 0x0A, 0x63, 0x3C, 0xFC, 0x3D, 0xFC, + 0x1A, 0x02, 0x2D, 0x00, 0x03, 0x3A, 0x03, 0x00, 0x00, 0x64, 0x3C, 0xFA, 0x29, 0x00, 0x04, 0x3A, + 0x09, 0x00, 0x0A, 0x64, 0x3C, 0xFA, 0x01, 0x64, 0x3A, 0xFA, 0x00, 0xF4, 0x00, 0x64, 0x1F, 0xFA, + 0x1E, 0xFA, 0x1E, 0x00, 0x02, 0x3A, 0x1E, 0x00, 0x64, 0x44, 0xAD, 0x83, 0xAC, 0x84, 0x02, 0x03, + 0x3C, 0xFC, 0x3D, 0xFC, 0x15, 0x03, 0x3A, 0xFA, 0xF8, 0x65, 0x52, 0x63, 0x64, 0x44, 0x01, 0x36, + 0x0D, 0x00, 0x12, 0xA3, 0x64, 0x40, 0x02, 0x2A, 0x02, 0x00, 0xC7, 0x83, 0xC7, 0x83, 0x64, 0x40, + 0x08, 0x2A, 0x01, 0x00, 0xC7, 0x83, 0x64, 0x40, 0x04, 0x26, 0xC7, 0x83, 0x39, 0xFC, 0x00, 0x64, + 0x2E, 0x58, 0xFF, 0xFF, 0x3B, 0xF0, 0x3A, 0xF2, 0x65, 0x46, 0x06, 0xF2, 0x40, 0x47, 0x1C, 0x18, + 0x32, 0x47, 0x07, 0xFA, 0x18, 0x7E, 0x81, 0x7F, 0x08, 0xFA, 0x01, 0x60, 0x01, 0x63, 0xB7, 0xF3, + 0x0A, 0xFC, 0x00, 0x7F, 0x09, 0xFA, 0x27, 0x40, 0x01, 0x2A, 0x0E, 0x00, 0x1F, 0xF8, 0x18, 0x64, + 0x0F, 0x60, 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x0A, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0x1E, 0xF0, 0x59, 0xF5, 0x3B, 0xF8, 0x65, 0x46, 0x27, 0x40, 0x02, 0x26, 0x02, 0x00, 0x00, 0xF4, + 0x13, 0x00, 0x6E, 0x61, 0xFF, 0x60, 0xFE, 0x64, 0x00, 0x60, 0x0E, 0x63, 0x58, 0xD1, 0x59, 0xD8, + 0xFD, 0x1F, 0x01, 0x60, 0xEE, 0x63, 0x00, 0xF4, 0x02, 0x61, 0x58, 0xD1, 0x59, 0xD8, 0x7E, 0x3A, + 0x02, 0x00, 0x00, 0xF4, 0x02, 0x61, 0xF9, 0x1F, 0x27, 0x40, 0x04, 0x26, 0x1A, 0x00, 0x46, 0x4B, + 0x0F, 0x60, 0x67, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x0E, 0x03, 0x89, 0xF0, 0xEB, 0x60, + 0x58, 0x4D, 0x00, 0x78, 0xFF, 0xFF, 0x65, 0x44, 0xAC, 0x86, 0xFF, 0xFF, 0x08, 0x03, 0xEB, 0x60, + 0x58, 0x4D, 0x00, 0x78, 0xFF, 0xFF, 0x04, 0x00, 0x2B, 0x46, 0x82, 0xFC, 0x00, 0xF4, 0x82, 0xFC, + 0x00, 0xF4, 0x27, 0x40, 0x08, 0x26, 0x19, 0x00, 0x46, 0x4B, 0x0F, 0x60, 0x85, 0xF3, 0xFF, 0xFF, + 0x00, 0xA8, 0x60, 0x46, 0x0E, 0x03, 0x89, 0xF0, 0xEB, 0x60, 0x58, 0x4D, 0x00, 0x78, 0xFF, 0xFF, + 0x65, 0x44, 0xAC, 0x86, 0xFF, 0xFF, 0x08, 0x03, 0xEB, 0x60, 0x58, 0x4D, 0x00, 0x78, 0xFF, 0xFF, + 0x04, 0x00, 0x65, 0x46, 0x02, 0xFA, 0x00, 0xF4, 0x82, 0xFC, 0x01, 0x64, 0x2E, 0x58, 0xFF, 0xFF, + 0x01, 0x61, 0x02, 0x64, 0x7A, 0x63, 0x58, 0xD0, 0xAB, 0x46, 0xA0, 0xD8, 0xAB, 0x46, 0xFB, 0x1F, + 0xAB, 0x46, 0x00, 0xF4, 0xCD, 0x81, 0xAB, 0x46, 0x00, 0xF4, 0xF3, 0x02, 0x2D, 0x58, 0xFF, 0xFF, + 0x00, 0x60, 0x2A, 0x61, 0xB5, 0x60, 0x58, 0x4D, 0xA2, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0x58, 0xFB, + 0x04, 0x64, 0x03, 0xFA, 0x67, 0x44, 0x2C, 0xFA, 0x2D, 0xFA, 0x2E, 0xFA, 0x32, 0xFA, 0x33, 0xFA, + 0x34, 0xFA, 0x12, 0x60, 0x80, 0x64, 0x87, 0xF1, 0x0E, 0xFA, 0x07, 0xF8, 0x00, 0x64, 0x3E, 0xFA, + 0x0A, 0x60, 0x07, 0xFB, 0x06, 0xA2, 0x10, 0x60, 0x5C, 0x64, 0xA2, 0xDB, 0x04, 0x64, 0x5A, 0xDB, + 0x06, 0x64, 0x5A, 0xDB, 0xED, 0x60, 0xD9, 0x64, 0x08, 0x60, 0x2D, 0xFB, 0x00, 0x64, 0x0A, 0x60, + 0x0D, 0xFB, 0x06, 0xA2, 0x10, 0x60, 0x60, 0x64, 0xA2, 0xDB, 0x08, 0x64, 0x5A, 0xDB, 0x06, 0x64, + 0x5A, 0xDB, 0xED, 0x60, 0xE2, 0x64, 0x08, 0x60, 0x2F, 0xFB, 0xED, 0x60, 0xBE, 0x64, 0x08, 0x60, + 0x28, 0xFB, 0x00, 0x60, 0x30, 0x64, 0x08, 0x60, 0x1C, 0xFB, 0xEB, 0x60, 0x58, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0xED, 0x60, 0x70, 0x78, 0xFF, 0xFF, + 0x58, 0xF5, 0xCB, 0xF1, 0x2F, 0xF8, 0xCC, 0xF1, 0x30, 0xF8, 0xCD, 0xF1, 0x31, 0xF8, 0xAB, 0xF1, + 0x19, 0xF8, 0x58, 0xF5, 0x40, 0x64, 0x2A, 0xFA, 0x64, 0xF3, 0x63, 0xFB, 0x08, 0x60, 0x1B, 0xF1, + 0x00, 0x60, 0x10, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x03, 0x00, + 0xEC, 0x60, 0xCB, 0x78, 0xFF, 0xFF, 0x15, 0x60, 0xC0, 0xF3, 0xEF, 0x60, 0x58, 0x4E, 0xAB, 0x78, + 0xFF, 0xFF, 0x15, 0x60, 0xC2, 0xFB, 0x15, 0x60, 0xBC, 0xF3, 0x3F, 0x40, 0x01, 0x27, 0x08, 0x00, + 0x0F, 0x60, 0xFF, 0x65, 0xA4, 0x84, 0xEE, 0x60, 0x58, 0x4E, 0x26, 0x78, 0xFF, 0xFF, 0x05, 0x00, + 0x0F, 0xB4, 0xEE, 0x60, 0x58, 0x4E, 0x26, 0x78, 0xFF, 0xFF, 0x58, 0xF5, 0x2D, 0x60, 0x94, 0x64, + 0x00, 0xF4, 0x40, 0x48, 0x28, 0x60, 0x4E, 0x64, 0x20, 0x40, 0x10, 0x27, 0x02, 0x00, 0x28, 0x60, + 0x2C, 0x64, 0x28, 0xDB, 0x04, 0x61, 0x00, 0x60, 0x00, 0x64, 0xE4, 0x60, 0x58, 0x4D, 0xA7, 0x78, + 0xFF, 0xFF, 0x58, 0xF5, 0x3F, 0xFC, 0x01, 0x64, 0x52, 0xF1, 0x0C, 0x60, 0x81, 0xFB, 0x64, 0xFB, + 0xA4, 0xD3, 0x04, 0x65, 0x51, 0xF3, 0x01, 0x18, 0x0C, 0x65, 0xF3, 0xB4, 0xB4, 0x84, 0x51, 0xFB, + 0x0D, 0x00, 0xED, 0x60, 0x70, 0x78, 0xFF, 0xFF, 0x51, 0xF1, 0x64, 0xF3, 0xFF, 0xFF, 0xF3, 0xA0, + 0x04, 0xA4, 0x01, 0x04, 0xF1, 0xA4, 0x10, 0x36, 0xF4, 0x01, 0x64, 0xFB, 0x64, 0xF3, 0x15, 0x60, + 0xC3, 0xF1, 0xCC, 0x84, 0x01, 0x61, 0x08, 0x24, 0x03, 0x00, 0xE1, 0x81, 0xCC, 0x84, 0xFB, 0x01, + 0xA1, 0x84, 0x51, 0xF1, 0xEA, 0x03, 0x0C, 0x60, 0x81, 0xFB, 0x9D, 0xFE, 0x3D, 0x05, 0xBA, 0xFE, + 0x10, 0x60, 0x36, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0A, 0x04, 0x40, 0x60, 0x00, 0x64, + 0x08, 0x60, 0x1C, 0xFB, 0xEB, 0x60, 0xD0, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x10, 0x60, 0x36, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x64, 0xF1, 0x0F, 0x60, 0x9D, 0xF9, 0x08, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x20, 0x60, 0x00, 0x64, 0x08, 0x60, 0x1C, 0xFB, 0xEB, 0x60, + 0xF5, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xBE, 0xFE, 0x08, 0x60, 0x11, 0xF1, + 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x18, 0x60, 0x07, 0xF1, 0xAD, 0x4F, + 0x00, 0x7F, 0xFA, 0xB4, 0x64, 0x41, 0x64, 0xF1, 0x02, 0xB1, 0x04, 0x65, 0x02, 0x02, 0x64, 0x40, + 0x01, 0x2B, 0x01, 0x65, 0xB4, 0x84, 0xA0, 0x5D, 0x10, 0x60, 0x36, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0xDE, 0xFE, 0x0A, 0x04, 0x40, 0x60, 0x00, 0x64, 0x08, 0x60, 0x1C, 0xFB, 0xEB, 0x60, 0xCD, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x64, 0xF1, 0x0F, 0x60, 0x9D, 0xF9, 0x0E, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x20, 0x60, 0x00, 0x64, 0x08, 0x60, 0x1C, 0xFB, 0xEC, 0x60, + 0x2D, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xBE, 0xFE, 0x08, 0x60, 0x11, 0xF1, + 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x10, 0x60, 0x36, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x58, 0xF5, 0x1E, 0x60, 0xD4, 0x64, 0x0F, 0x60, 0x90, 0xFB, 0x66, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x00, 0x64, 0x4F, 0xFB, 0x00, 0x60, 0x01, 0x64, + 0x08, 0x60, 0x1C, 0xFB, 0xEC, 0x60, 0x51, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0xC1, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x10, 0x60, 0x36, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xA5, 0xF1, 0x0A, 0x60, 0x09, 0xF9, + 0x14, 0x60, 0x0E, 0x64, 0x0F, 0x60, 0xA5, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, + 0xA6, 0xF1, 0x0A, 0x60, 0x0F, 0xF9, 0x1F, 0x60, 0x48, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xFD, 0x1B, + 0x14, 0x60, 0x1A, 0x64, 0x0F, 0x60, 0xA5, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, + 0x00, 0x60, 0x08, 0x64, 0x08, 0x60, 0x1C, 0xFB, 0xEC, 0x60, 0x7A, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x4F, 0xF1, 0x10, 0x60, 0x36, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x64, 0x40, + 0xFF, 0x26, 0x0B, 0x00, 0x51, 0xF3, 0xFF, 0xFF, 0x80, 0xB0, 0xFF, 0xFF, 0x03, 0x03, 0xED, 0x60, + 0x6A, 0x78, 0xFF, 0xFF, 0xEB, 0x60, 0xB4, 0x78, 0xFF, 0xFF, 0x02, 0x0A, 0x00, 0x64, 0x4F, 0xFB, + 0xA7, 0xF1, 0x0A, 0x60, 0x0F, 0xF9, 0x00, 0x60, 0x0C, 0x64, 0x08, 0x60, 0x1C, 0xFB, 0xEC, 0x60, + 0xA5, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x14, 0x60, 0x1A, 0x64, 0x0F, 0x60, 0xA5, 0xFB, 0x02, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x1B, 0xF1, 0x00, 0x60, + 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x0B, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x14, 0x60, 0x1A, 0x64, + 0x0F, 0x60, 0xA5, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x13, 0x00, 0xFF, 0x60, + 0xF7, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x4F, 0xF3, 0xDE, 0x0A, 0x00, 0xA0, 0x00, 0x64, 0x02, 0x03, + 0x4F, 0xFB, 0xD9, 0x01, 0x14, 0x60, 0x0E, 0x64, 0x0F, 0x60, 0xA5, 0xFB, 0x03, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x04, 0xFF, 0xB7, 0x01, 0x15, 0x60, 0xC1, 0xF3, 0xEF, 0x60, 0x58, 0x4E, 0xAB, 0x78, + 0xFF, 0xFF, 0x15, 0x60, 0xC2, 0xFB, 0x15, 0x60, 0xBD, 0xF3, 0x0F, 0x60, 0xFF, 0x65, 0xA4, 0x84, + 0xEE, 0x60, 0x58, 0x4E, 0x26, 0x78, 0xFF, 0xFF, 0x58, 0xF5, 0x2D, 0x60, 0x94, 0x64, 0x00, 0xF4, + 0x40, 0x48, 0x28, 0x60, 0x4E, 0x64, 0x20, 0x40, 0x10, 0x27, 0x02, 0x00, 0x28, 0x60, 0x2C, 0x64, + 0x28, 0xDB, 0x04, 0x61, 0x00, 0x60, 0x00, 0x64, 0xE4, 0x60, 0x58, 0x4D, 0xA7, 0x78, 0xFF, 0xFF, + 0x58, 0xF5, 0x3F, 0xFC, 0x51, 0xF3, 0x20, 0x40, 0x10, 0x23, 0x02, 0x00, 0x20, 0xBC, 0x04, 0x00, + 0x60, 0x40, 0x01, 0x22, 0x40, 0xBC, 0x04, 0xBC, 0x80, 0xBC, 0x51, 0xFB, 0x11, 0x60, 0x16, 0x64, + 0x08, 0x60, 0x46, 0xFB, 0x06, 0x64, 0x08, 0x60, 0x4D, 0xFB, 0x15, 0x60, 0xC6, 0xF3, 0xFF, 0xFF, + 0x07, 0xB4, 0xA2, 0xDB, 0x51, 0xF3, 0x08, 0x60, 0x46, 0xF1, 0x60, 0x40, 0x20, 0x26, 0x03, 0x00, + 0x01, 0x26, 0x32, 0x00, 0x45, 0x00, 0x08, 0x60, 0x4D, 0xF3, 0xFF, 0xFF, 0xDD, 0xA0, 0x01, 0xA4, + 0x57, 0x03, 0xA2, 0xDB, 0x2B, 0x60, 0x88, 0x61, 0xE0, 0xA0, 0xF0, 0xA0, 0x05, 0x05, 0x01, 0x05, + 0x05, 0x00, 0x02, 0xA1, 0xF0, 0xA4, 0x02, 0x00, 0x04, 0xA1, 0xE0, 0xA4, 0xA1, 0xD1, 0x01, 0x61, + 0xDC, 0x84, 0xCC, 0x84, 0xFF, 0xFF, 0x02, 0x03, 0xE1, 0x81, 0xFB, 0x01, 0xA1, 0x80, 0x10, 0x60, + 0x9A, 0x64, 0x01, 0x02, 0xE0, 0x01, 0xA0, 0xD3, 0x11, 0x60, 0x0E, 0x63, 0xFA, 0xA4, 0xCC, 0x84, + 0x08, 0xA3, 0xFD, 0x02, 0xB1, 0xF1, 0xA3, 0xD3, 0x01, 0x18, 0xD5, 0x18, 0xFE, 0xA3, 0xA3, 0xD3, + 0x64, 0xFB, 0xEB, 0x60, 0xCD, 0x78, 0xFF, 0xFF, 0x11, 0x60, 0xF4, 0x65, 0x64, 0x41, 0xA1, 0xD3, + 0xD5, 0x80, 0x00, 0xB8, 0x25, 0x07, 0x02, 0x02, 0x08, 0xA1, 0xF9, 0x01, 0x61, 0x44, 0x08, 0x60, + 0x46, 0xFB, 0x01, 0x64, 0xA1, 0xDB, 0x49, 0xD3, 0x64, 0xFB, 0xEB, 0x60, 0xCD, 0x78, 0xFF, 0xFF, + 0x11, 0x60, 0xF4, 0x65, 0x64, 0x41, 0xA1, 0xD3, 0xD5, 0x80, 0x04, 0xB0, 0x11, 0x07, 0x02, 0x02, + 0x08, 0xA1, 0xF9, 0x01, 0x61, 0x44, 0x08, 0x60, 0x46, 0xFB, 0x49, 0xD3, 0x64, 0xFB, 0xEB, 0x60, + 0xCD, 0x78, 0xFF, 0xFF, 0x08, 0x60, 0x46, 0xF3, 0xFF, 0xFF, 0x08, 0xA4, 0xA2, 0xDB, 0x9A, 0x01, + 0x14, 0x60, 0x0E, 0x64, 0x0F, 0x60, 0xA5, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, + 0x51, 0xF3, 0xFF, 0xFF, 0xE3, 0xB4, 0x51, 0xFB, 0x0C, 0x60, 0x7F, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, + 0xA2, 0xDB, 0x10, 0x60, 0x36, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0A, 0x04, 0x40, 0x60, + 0x00, 0x64, 0x08, 0x60, 0x1C, 0xFB, 0xED, 0x60, 0x81, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x63, 0xF1, 0x64, 0xF9, 0x0F, 0x60, 0x9D, 0xF9, 0x0E, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x2D, 0xFF, 0x20, 0x60, 0x00, 0x64, 0x08, 0x60, 0x1C, 0xFB, 0xED, 0x60, 0xA3, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xBE, 0xFE, 0x08, 0x60, 0x11, 0xF1, 0x40, 0x60, 0x00, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x08, 0x60, 0x11, 0xF1, 0x10, 0x60, 0x00, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x00, 0x60, 0x30, 0x64, 0x08, 0x60, 0x1C, 0xFB, 0xEB, 0x60, 0x58, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0x14, 0x60, 0x0E, 0x64, + 0x0F, 0x60, 0xA5, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x00, 0x64, 0x51, 0xFB, + 0x00, 0x64, 0x08, 0x60, 0x1B, 0xFB, 0x5A, 0xDB, 0xBE, 0xFE, 0x00, 0x60, 0x30, 0x64, 0x08, 0x60, + 0x1C, 0xFB, 0xEB, 0x60, 0x58, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x2F, 0x58, + 0xFF, 0xFF, 0x08, 0x60, 0x1B, 0xF1, 0x00, 0x60, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x1B, 0xF1, 0x00, 0x60, 0x08, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x31, 0x40, 0x20, 0x2A, 0x35, 0x00, 0x3F, 0xF2, 0x47, 0x65, + 0xC4, 0x84, 0xE8, 0x84, 0x23, 0xFA, 0xF1, 0x60, 0x02, 0x64, 0x24, 0xFA, 0x64, 0xF3, 0x01, 0x60, + 0xFF, 0x65, 0xA4, 0x84, 0x01, 0x23, 0x14, 0x00, 0x11, 0x60, 0x14, 0x61, 0x11, 0x60, 0xF4, 0x65, + 0xA1, 0xD1, 0xD5, 0x80, 0xD0, 0x80, 0x0B, 0x03, 0x02, 0x03, 0x08, 0xA1, 0xF9, 0x01, 0x04, 0xA1, + 0xA1, 0xD3, 0x01, 0x60, 0x00, 0x65, 0x60, 0x47, 0xFF, 0xB4, 0xB4, 0x84, 0x01, 0x00, 0x01, 0x64, + 0x00, 0xF4, 0x08, 0xFA, 0xFF, 0xFF, 0x26, 0x46, 0x1F, 0x60, 0x10, 0x64, 0x0F, 0x60, 0x90, 0xFB, + 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xFA, 0xFE, 0x00, 0x66, + 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x26, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x5F, 0xFB, 0xAC, 0x85, + 0x60, 0x41, 0x2E, 0x60, 0x22, 0x63, 0x16, 0x60, 0xC6, 0xFD, 0x16, 0x60, 0xCC, 0xFD, 0x16, 0x60, + 0xD6, 0xFD, 0x16, 0x60, 0xE0, 0xFD, 0x5C, 0x03, 0x61, 0x5C, 0x00, 0x63, 0xE9, 0x81, 0xFF, 0xFF, + 0x02, 0x24, 0xDF, 0x83, 0xFB, 0x02, 0x08, 0x64, 0x53, 0x90, 0x64, 0x41, 0x03, 0x04, 0x01, 0x60, + 0x08, 0x63, 0x0C, 0x00, 0x01, 0x60, 0x00, 0x63, 0x10, 0x64, 0xE9, 0x81, 0xFF, 0xFF, 0x02, 0x24, + 0xDF, 0x83, 0x08, 0x36, 0x03, 0x00, 0xCC, 0x84, 0xFF, 0xFF, 0xF7, 0x02, 0x15, 0x60, 0xEC, 0xFD, + 0x43, 0x48, 0x65, 0x41, 0x2B, 0x60, 0xDA, 0x63, 0x28, 0x44, 0xFF, 0xB5, 0x10, 0x60, 0x08, 0x64, + 0xE9, 0x81, 0x58, 0xD1, 0xFD, 0x04, 0xA3, 0xD9, 0x0C, 0x03, 0x58, 0xD1, 0xE9, 0x81, 0x40, 0x4A, + 0xFC, 0x04, 0xA3, 0xD1, 0x64, 0x47, 0xB0, 0x84, 0xBD, 0xDB, 0x65, 0x44, 0xC8, 0x85, 0x2A, 0x44, + 0xEF, 0x02, 0x28, 0x43, 0x08, 0x3A, 0x24, 0x00, 0x60, 0x45, 0x04, 0x64, 0x32, 0x60, 0x00, 0x63, + 0x41, 0x48, 0xE9, 0x81, 0xCC, 0x84, 0x02, 0x24, 0xDF, 0x83, 0xFB, 0x02, 0x63, 0x40, 0x00, 0x36, + 0x17, 0x00, 0x17, 0x60, 0x11, 0xFD, 0x2E, 0x60, 0x24, 0x63, 0x65, 0x44, 0x28, 0x41, 0xE9, 0x81, + 0x58, 0xD1, 0xFD, 0x04, 0xA3, 0xD9, 0x15, 0x03, 0x58, 0xD1, 0xE9, 0x81, 0x60, 0x45, 0xFC, 0x04, + 0xA3, 0xD1, 0x64, 0x47, 0xB0, 0x84, 0xBD, 0xDB, 0x00, 0xB9, 0x65, 0x44, 0xF0, 0x02, 0x09, 0x00, + 0x67, 0x43, 0x16, 0x60, 0xC6, 0xFD, 0x16, 0x60, 0xCC, 0xFD, 0x16, 0x60, 0xD6, 0xFD, 0x16, 0x60, + 0xE0, 0xFD, 0x20, 0x40, 0x10, 0x27, 0x0D, 0x00, 0x2B, 0x60, 0xE2, 0x61, 0x15, 0x60, 0xEC, 0xF3, + 0xA1, 0xDB, 0xFF, 0xB4, 0xCC, 0x84, 0xA8, 0x83, 0x2B, 0x60, 0xD8, 0x64, 0x58, 0xD1, 0x59, 0xD9, + 0xFD, 0x1F, 0x2B, 0x60, 0xE4, 0x63, 0x15, 0x60, 0xBE, 0xF3, 0x08, 0x61, 0x60, 0xFE, 0xA3, 0xD1, + 0xFF, 0xFF, 0x20, 0xFE, 0x00, 0xA8, 0xE8, 0x84, 0x0F, 0x03, 0x60, 0xFE, 0x02, 0x28, 0xF6, 0x01, + 0x80, 0x62, 0xB2, 0x9C, 0xBD, 0xD9, 0x62, 0xF9, 0xCD, 0x81, 0x00, 0x36, 0x01, 0x00, 0xEE, 0x01, + 0x2E, 0x60, 0x24, 0x63, 0x08, 0x61, 0xEA, 0x01, 0x2E, 0x58, 0xFF, 0xFF, 0x2B, 0x60, 0x7C, 0x63, + 0x65, 0x40, 0xFF, 0x36, 0x02, 0xA3, 0xA3, 0xD3, 0xFF, 0xFF, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, + 0xE8, 0x84, 0x40, 0x26, 0x7F, 0xB4, 0x20, 0x26, 0x3F, 0xB4, 0x60, 0x45, 0x80, 0x63, 0xEF, 0x60, + 0x58, 0x4D, 0x33, 0x78, 0xFF, 0xFF, 0x15, 0x60, 0xDF, 0xFB, 0x40, 0x63, 0xEF, 0x60, 0x58, 0x4D, + 0x33, 0x78, 0xFF, 0xFF, 0x15, 0x60, 0xE0, 0xFB, 0x20, 0x63, 0xEF, 0x60, 0x58, 0x4D, 0x33, 0x78, + 0xFF, 0xFF, 0x15, 0x60, 0xE1, 0xFB, 0x10, 0x63, 0xEF, 0x60, 0x58, 0x4D, 0x33, 0x78, 0xFF, 0xFF, + 0x15, 0x60, 0xE2, 0xFB, 0x08, 0x63, 0xEF, 0x60, 0x58, 0x4D, 0x33, 0x78, 0xFF, 0xFF, 0x15, 0x60, + 0xE3, 0xFB, 0x04, 0x63, 0xEF, 0x60, 0x58, 0x4D, 0x33, 0x78, 0xFF, 0xFF, 0x15, 0x60, 0xE4, 0xFB, + 0x02, 0x63, 0xEF, 0x60, 0x58, 0x4D, 0x33, 0x78, 0xFF, 0xFF, 0x15, 0x60, 0xE5, 0xFB, 0x01, 0x63, + 0xEF, 0x60, 0x58, 0x4D, 0x33, 0x78, 0xFF, 0xFF, 0x15, 0x60, 0xE6, 0xFB, 0x2E, 0x58, 0xFF, 0xFF, + 0x15, 0x60, 0xBE, 0xF3, 0xFF, 0xFF, 0x0F, 0xB4, 0x60, 0x45, 0x08, 0x63, 0xEF, 0x60, 0x58, 0x4D, + 0x5E, 0x78, 0xFF, 0xFF, 0x15, 0x60, 0xE7, 0xFB, 0x04, 0x63, 0xEF, 0x60, 0x58, 0x4D, 0x5E, 0x78, + 0xFF, 0xFF, 0x15, 0x60, 0xE8, 0xFB, 0x02, 0x63, 0xEF, 0x60, 0x58, 0x4D, 0x5E, 0x78, 0xFF, 0xFF, + 0x15, 0x60, 0xE9, 0xFB, 0x01, 0x63, 0xEF, 0x60, 0x58, 0x4D, 0x5E, 0x78, 0xFF, 0xFF, 0x15, 0x60, + 0xEA, 0xFB, 0x2E, 0x58, 0xFF, 0xFF, 0x63, 0x5C, 0xA7, 0x84, 0xEB, 0x83, 0x14, 0x02, 0x01, 0x03, + 0xFB, 0x01, 0x64, 0x44, 0x01, 0x36, 0x0B, 0x64, 0x02, 0x36, 0x0B, 0x64, 0x04, 0x36, 0x0A, 0x64, + 0x08, 0x36, 0x0A, 0x64, 0x10, 0x36, 0x09, 0x64, 0x20, 0x36, 0x09, 0x64, 0x40, 0x36, 0x09, 0x64, + 0x80, 0x36, 0x09, 0x64, 0x11, 0x00, 0x60, 0x40, 0x01, 0x36, 0x0B, 0x64, 0x02, 0x36, 0x0F, 0x64, + 0x04, 0x36, 0x0A, 0x64, 0x08, 0x36, 0x0E, 0x64, 0x10, 0x36, 0x09, 0x64, 0x20, 0x36, 0x0D, 0x64, + 0x40, 0x36, 0x08, 0x64, 0x80, 0x36, 0x0C, 0x64, 0x2D, 0x58, 0xFF, 0xFF, 0x63, 0x5C, 0xA7, 0x84, + 0xEB, 0x83, 0x0C, 0x02, 0x01, 0x03, 0xFB, 0x01, 0x64, 0x44, 0x01, 0x36, 0x0A, 0x64, 0x02, 0x36, + 0x14, 0x64, 0x04, 0x36, 0x37, 0x64, 0x08, 0x36, 0x6E, 0x64, 0x09, 0x00, 0x60, 0x40, 0x01, 0x36, + 0x0A, 0x64, 0x02, 0x36, 0x14, 0x64, 0x04, 0x36, 0x37, 0x64, 0x08, 0x36, 0x6E, 0x64, 0x2D, 0x58, + 0xFF, 0xFF, 0x60, 0xFE, 0x81, 0xA1, 0x7F, 0xA1, 0x02, 0x06, 0x00, 0xF4, 0x03, 0x61, 0x5D, 0xD2, + 0xCF, 0x83, 0xD4, 0x80, 0x25, 0x03, 0x16, 0x03, 0xCF, 0x83, 0x61, 0x44, 0x80, 0xA0, 0x20, 0x03, + 0x02, 0x02, 0x00, 0xF4, 0x03, 0x61, 0x5D, 0xD2, 0xCF, 0x83, 0x81, 0xA1, 0x19, 0x03, 0x05, 0x07, + 0x7F, 0xA1, 0xCC, 0x84, 0xDD, 0x81, 0xE6, 0x03, 0xF7, 0x01, 0x00, 0xF4, 0x00, 0xB8, 0x04, 0x61, + 0xE6, 0x03, 0xF2, 0x01, 0x2C, 0x43, 0x5D, 0xD0, 0xDE, 0xD9, 0x64, 0x44, 0x5D, 0xD0, 0xDE, 0xD9, + 0xCC, 0x84, 0x81, 0xA1, 0x05, 0x03, 0x7F, 0xA1, 0xF9, 0x04, 0x00, 0xF4, 0x03, 0x61, 0xF6, 0x01, + 0x20, 0xFE, 0x2E, 0x58, 0xFF, 0xFF, 0x01, 0x3A, 0x02, 0x00, 0x16, 0x64, 0x2B, 0x00, 0x02, 0x3A, + 0x02, 0x00, 0x14, 0x64, 0x27, 0x00, 0x04, 0x3A, 0x02, 0x00, 0x12, 0x64, 0x23, 0x00, 0x08, 0x3A, + 0x02, 0x00, 0x10, 0x64, 0x1F, 0x00, 0x10, 0x3A, 0x02, 0x00, 0x0E, 0x64, 0x1B, 0x00, 0x20, 0x3A, + 0x02, 0x00, 0x0C, 0x64, 0x17, 0x00, 0x40, 0x3A, 0x02, 0x00, 0x0A, 0x64, 0x13, 0x00, 0x80, 0x3A, + 0x02, 0x00, 0x08, 0x64, 0x0F, 0x00, 0x01, 0x3B, 0x02, 0x00, 0x06, 0x64, 0x0B, 0x00, 0x02, 0x3B, + 0x02, 0x00, 0x04, 0x64, 0x07, 0x00, 0x04, 0x3B, 0x02, 0x00, 0x02, 0x64, 0x03, 0x00, 0x08, 0x3B, + 0xFF, 0x01, 0x00, 0x64, 0x2E, 0x58, 0xFF, 0xFF, 0x27, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x36, 0x3A, + 0x02, 0x00, 0x00, 0x61, 0x2C, 0x00, 0x30, 0x3A, 0x02, 0x00, 0x02, 0x61, 0x28, 0x00, 0x24, 0x3A, + 0x02, 0x00, 0x04, 0x61, 0x24, 0x00, 0x18, 0x3A, 0x02, 0x00, 0x06, 0x61, 0x20, 0x00, 0x12, 0x3A, + 0x02, 0x00, 0x08, 0x61, 0x1C, 0x00, 0x0C, 0x3A, 0x02, 0x00, 0x0A, 0x61, 0x18, 0x00, 0x09, 0x3A, + 0x02, 0x00, 0x0C, 0x61, 0x14, 0x00, 0x06, 0x3A, 0x02, 0x00, 0x0E, 0x61, 0x10, 0x00, 0x6E, 0x3A, + 0x02, 0x00, 0x10, 0x61, 0x0C, 0x00, 0x37, 0x3A, 0x02, 0x00, 0x12, 0x61, 0x08, 0x00, 0x14, 0x3A, + 0x02, 0x00, 0x14, 0x61, 0x04, 0x00, 0x0A, 0x3A, 0xFF, 0xFF, 0x16, 0x61, 0x00, 0x00, 0x65, 0x40, + 0x01, 0x3A, 0x13, 0x00, 0x66, 0x45, 0x2B, 0x46, 0x92, 0xFA, 0x65, 0x46, 0x26, 0xF2, 0xFF, 0xFF, + 0x60, 0x41, 0x00, 0x7F, 0x60, 0x45, 0x61, 0x47, 0x00, 0x7F, 0xD4, 0x84, 0x66, 0x41, 0x2B, 0x46, + 0x0E, 0xF2, 0x60, 0x45, 0x65, 0x5E, 0x0E, 0xFA, 0x61, 0x46, 0x2E, 0x58, 0xFF, 0xFF, 0xCD, 0x81, + 0x7F, 0xB4, 0x02, 0x3A, 0x02, 0x00, 0x01, 0x64, 0x2E, 0x00, 0x04, 0x3A, 0x02, 0x00, 0x02, 0x64, + 0x2A, 0x00, 0x0B, 0x3A, 0x02, 0x00, 0x04, 0x64, 0x26, 0x00, 0x16, 0x3A, 0x02, 0x00, 0x08, 0x64, + 0x22, 0x00, 0x0C, 0x3A, 0x02, 0x00, 0x10, 0x64, 0x1E, 0x00, 0x12, 0x3A, 0x02, 0x00, 0x20, 0x64, + 0x1A, 0x00, 0x18, 0x3A, 0x02, 0x00, 0x40, 0x64, 0x16, 0x00, 0x24, 0x3A, 0x02, 0x00, 0x80, 0x64, + 0x12, 0x00, 0x30, 0x3A, 0x02, 0x00, 0x01, 0x7F, 0x0E, 0x00, 0x48, 0x3A, 0x02, 0x00, 0x02, 0x7F, + 0x0A, 0x00, 0x60, 0x3A, 0x02, 0x00, 0x04, 0x7F, 0x06, 0x00, 0x6C, 0x3A, 0x02, 0x00, 0x08, 0x7F, + 0x02, 0x00, 0x00, 0x64, 0x00, 0x00, 0x20, 0xFE, 0x2A, 0x45, 0x34, 0x8A, 0x60, 0xFE, 0x61, 0x40, + 0x00, 0x36, 0x02, 0x00, 0xBD, 0xD3, 0xC3, 0x01, 0x2E, 0x58, 0xFF, 0xFF, 0x53, 0xFB, 0x54, 0xFB, + 0x00, 0x60, 0x0C, 0x63, 0x14, 0x60, 0xEC, 0x62, 0x00, 0x64, 0x5A, 0xDB, 0xFE, 0x1F, 0x02, 0x64, + 0x0A, 0x60, 0x78, 0xFB, 0x2E, 0x58, 0xFF, 0xFF, 0x0A, 0x60, 0x7A, 0xF3, 0x00, 0x63, 0xF0, 0xA0, + 0x01, 0xA4, 0x03, 0x03, 0xA2, 0xDB, 0x2E, 0x58, 0xFF, 0xFF, 0xA2, 0xDD, 0x0A, 0x60, 0x7B, 0xF1, + 0xA2, 0xDD, 0x5A, 0xD3, 0xA2, 0xDD, 0xC0, 0x81, 0x61, 0x44, 0x02, 0x24, 0xFF, 0xFF, 0xE9, 0x81, + 0xE9, 0x81, 0xE9, 0x81, 0xE9, 0x81, 0x5A, 0xD3, 0xE9, 0x81, 0xE8, 0x83, 0xEB, 0x83, 0xEB, 0x83, + 0xEB, 0x83, 0xEB, 0x85, 0xD4, 0x85, 0xC5, 0x83, 0xA2, 0xDD, 0x63, 0x47, 0x00, 0x7F, 0x0A, 0x60, + 0x77, 0xFB, 0x2E, 0x58, 0xFF, 0xFF, 0x7F, 0x67, 0x01, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0xB1, 0xFE, + 0x05, 0x05, 0xB0, 0xFE, 0x06, 0x05, 0xB2, 0xFE, 0xB3, 0xFE, 0x21, 0x00, 0xF7, 0x60, 0x38, 0x78, + 0xFF, 0xFF, 0x28, 0xF3, 0x29, 0xF1, 0x40, 0x44, 0x44, 0x45, 0x2A, 0xF1, 0x2B, 0xF1, 0x44, 0x46, + 0x44, 0x47, 0x3F, 0xB4, 0xE0, 0x85, 0x19, 0x60, 0x06, 0x64, 0x44, 0xD7, 0x58, 0x43, 0xFF, 0xFF, + 0x60, 0x45, 0x0A, 0x60, 0x7E, 0xF3, 0x61, 0x43, 0x04, 0xB4, 0x24, 0x44, 0x02, 0x03, 0x13, 0xFF, + 0x06, 0x00, 0x3F, 0xB4, 0xB4, 0x84, 0xFF, 0x27, 0x05, 0xFD, 0x04, 0xFB, 0x10, 0x75, 0xA1, 0xFF, + 0xFF, 0xFF, 0x86, 0x3E, 0xB4, 0xFE, 0x09, 0x05, 0xB5, 0xFE, 0x02, 0x24, 0x7F, 0xF7, 0xFF, 0xFF, + 0xFF, 0xFF, 0xB7, 0xFE, 0x05, 0x05, 0xB6, 0xFE, 0xF2, 0x01, 0xF7, 0x60, 0x73, 0x78, 0xFF, 0xFF, + 0x36, 0x44, 0x00, 0x7F, 0xEE, 0xA0, 0x60, 0x45, 0x05, 0x05, 0x19, 0x60, 0x98, 0x64, 0x44, 0xD7, + 0xFF, 0xFF, 0xFF, 0xFF, 0xE4, 0x01, 0xE3, 0x01, 0x7F, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, + 0x7F, 0x67, 0x02, 0x61, 0x10, 0x02, 0x10, 0x64, 0x40, 0x40, 0x02, 0x64, 0x40, 0x50, 0x61, 0xFF, + 0x3F, 0x40, 0x40, 0x26, 0x04, 0x00, 0x10, 0xE0, 0x46, 0x60, 0x09, 0xE0, 0x00, 0x00, 0x27, 0xF1, + 0x00, 0x66, 0x20, 0x78, 0x42, 0xFE, 0x23, 0x58, 0xFF, 0xFF, 0x7F, 0x60, 0xC0, 0x64, 0x24, 0x45, + 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, 0x19, 0x02, 0x0A, 0x60, 0x7E, 0xF3, 0x07, 0x7C, 0x20, 0xB5, + 0x0C, 0xB5, 0x04, 0x03, 0x03, 0x02, 0xBC, 0xF9, 0x00, 0x67, 0x0F, 0x00, 0x00, 0x61, 0x41, 0x56, + 0xC7, 0xFE, 0xB5, 0x01, 0x36, 0x47, 0xFF, 0x23, 0x04, 0x00, 0x00, 0x7F, 0x60, 0x41, 0x7F, 0x67, + 0x04, 0x00, 0x20, 0x44, 0x80, 0xBC, 0x40, 0x40, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x7F, 0x60, + 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, 0x31, 0x02, 0x0A, 0x60, 0x7E, 0xF3, + 0x01, 0x7C, 0x20, 0xB5, 0x0C, 0xB5, 0x03, 0x03, 0x02, 0x02, 0xBC, 0xF9, 0xFF, 0xFF, 0x02, 0x61, + 0x41, 0x56, 0xC7, 0xFE, 0xF0, 0x60, 0xC7, 0x78, 0xFF, 0xFF, 0x7D, 0xF1, 0x20, 0x44, 0x64, 0x40, + 0xFF, 0x26, 0x1C, 0x00, 0x7F, 0xB4, 0x40, 0x40, 0x5C, 0x5E, 0x82, 0xFF, 0x26, 0x44, 0xFD, 0xB4, + 0x40, 0x46, 0x5C, 0x41, 0x87, 0xFF, 0x62, 0xFF, 0x0F, 0x60, 0x85, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, + 0x60, 0x46, 0x04, 0x03, 0x09, 0xF2, 0x8F, 0xFC, 0xAC, 0x86, 0xFB, 0x01, 0xD3, 0xF3, 0xFF, 0xFF, + 0xFE, 0xB4, 0xD3, 0xFB, 0x06, 0x64, 0x0F, 0x60, 0x9F, 0xFB, 0x2D, 0xFF, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x25, 0x46, 0x01, 0xF2, 0x08, 0xF0, 0x60, 0x47, 0x03, 0xB4, 0x03, 0xAC, 0x7F, 0x67, + 0x03, 0x61, 0x08, 0x02, 0x1F, 0x60, 0x26, 0x64, 0x40, 0x4B, 0xF6, 0x60, 0x58, 0x4D, 0xB3, 0x78, + 0xFF, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x24, 0x40, 0x01, 0x2B, 0x49, 0x00, 0x25, 0x44, + 0x1F, 0xB4, 0xE0, 0x85, 0xF1, 0x60, 0x76, 0x64, 0xC4, 0x98, 0xFF, 0xFF, 0xC0, 0xFE, 0x3D, 0x00, + 0xC1, 0xFE, 0x3B, 0x00, 0xC2, 0xFE, 0x39, 0x00, 0xC3, 0xFE, 0x37, 0x00, 0xC4, 0xFE, 0x35, 0x00, + 0xC5, 0xFE, 0x33, 0x00, 0xC6, 0xFE, 0x31, 0x00, 0xC7, 0xFE, 0x2F, 0x00, 0xC8, 0xFE, 0x2D, 0x00, + 0xC9, 0xFE, 0x2B, 0x00, 0xCA, 0xFE, 0x29, 0x00, 0xCB, 0xFE, 0x27, 0x00, 0xCC, 0xFE, 0x25, 0x00, + 0xCD, 0xFE, 0x23, 0x00, 0xCE, 0xFE, 0x21, 0x00, 0xCF, 0xFE, 0x1F, 0x00, 0xD0, 0xFE, 0x1D, 0x00, + 0xD1, 0xFE, 0x1B, 0x00, 0xD2, 0xFE, 0x19, 0x00, 0xD3, 0xFE, 0x17, 0x00, 0xD4, 0xFE, 0x15, 0x00, + 0xD5, 0xFE, 0x13, 0x00, 0xD6, 0xFE, 0x11, 0x00, 0xD7, 0xFE, 0x0F, 0x00, 0xD8, 0xFE, 0x0D, 0x00, + 0xD9, 0xFE, 0x0B, 0x00, 0xDA, 0xFE, 0x09, 0x00, 0xDB, 0xFE, 0x07, 0x00, 0xDC, 0xFE, 0x05, 0x00, + 0xDD, 0xFE, 0x03, 0x00, 0xDE, 0xFE, 0x01, 0x00, 0xDF, 0xFE, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x00, 0x64, 0x9F, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x9E, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x9D, 0xFE, + 0xF0, 0x84, 0xFF, 0xFF, 0x9C, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x9B, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, + 0x9A, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x99, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x98, 0xFE, 0xF0, 0x84, + 0xFF, 0xFF, 0x97, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x96, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x95, 0xFE, + 0xF0, 0x84, 0xFF, 0xFF, 0x94, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x93, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, + 0x92, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x91, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x90, 0xFE, 0xF0, 0x84, + 0x06, 0xFB, 0x8F, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x8E, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x8D, 0xFE, + 0xF0, 0x84, 0xFF, 0xFF, 0x8C, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x8B, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, + 0x8A, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x89, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x88, 0xFE, 0xF0, 0x84, + 0xFF, 0xFF, 0x87, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x86, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x85, 0xFE, + 0xF0, 0x84, 0xFF, 0xFF, 0x84, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x83, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, + 0x82, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x81, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x80, 0xFE, 0xF0, 0x84, + 0x05, 0xFB, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x5C, 0x5C, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x24, 0x40, 0x01, 0x27, 0x55, 0x00, 0x05, 0x60, 0x00, 0x63, 0x05, 0xFD, 0x30, 0x44, 0xBD, 0xDB, + 0x31, 0x44, 0xBD, 0xDB, 0x32, 0x44, 0xBD, 0xDB, 0x33, 0x44, 0xBD, 0xDB, 0x34, 0x44, 0xBD, 0xDB, + 0x35, 0x44, 0xBD, 0xDB, 0x36, 0x44, 0xBD, 0xDB, 0x37, 0x44, 0xBD, 0xDB, 0x38, 0x44, 0xBD, 0xDB, + 0x39, 0x44, 0xBD, 0xDB, 0x3A, 0x44, 0xBD, 0xDB, 0x3B, 0x44, 0xBD, 0xDB, 0x3C, 0x44, 0xBD, 0xDB, + 0x3D, 0x44, 0xBD, 0xDB, 0x3E, 0x44, 0xBD, 0xDB, 0x3F, 0x44, 0xBD, 0xDB, 0x02, 0x61, 0x61, 0x44, + 0x02, 0x36, 0x82, 0xFF, 0x03, 0x36, 0x83, 0xFF, 0x04, 0x36, 0x84, 0xFF, 0x05, 0x36, 0x85, 0xFF, + 0x06, 0x36, 0x86, 0xFF, 0x07, 0x36, 0x87, 0xFF, 0x20, 0x44, 0xBD, 0xDB, 0x21, 0x44, 0xBD, 0xDB, + 0x22, 0x44, 0xBD, 0xDB, 0x23, 0x44, 0xBD, 0xDB, 0x24, 0x44, 0xBD, 0xDB, 0x25, 0x44, 0xBD, 0xDB, + 0x26, 0x44, 0xBD, 0xDB, 0x27, 0x44, 0xBD, 0xDB, 0x28, 0x44, 0xBD, 0xDB, 0x29, 0x44, 0xBD, 0xDB, + 0x2A, 0x44, 0xBD, 0xDB, 0x2B, 0x44, 0xBD, 0xDB, 0x2C, 0x44, 0xBD, 0xDB, 0x2D, 0x44, 0xBD, 0xDB, + 0x2E, 0x44, 0xBD, 0xDB, 0x2F, 0x44, 0xBD, 0xDB, 0xDD, 0x81, 0x08, 0x3A, 0xD0, 0x01, 0x54, 0x00, + 0x27, 0x40, 0x10, 0x26, 0x30, 0x00, 0x26, 0x44, 0x01, 0x36, 0x2D, 0x00, 0x02, 0x36, 0x82, 0xFF, + 0x03, 0x36, 0x83, 0xFF, 0x04, 0x36, 0x84, 0xFF, 0x05, 0x36, 0x85, 0xFF, 0x06, 0x36, 0x86, 0xFF, + 0x25, 0x44, 0x00, 0x36, 0x44, 0x40, 0x01, 0x36, 0x44, 0x41, 0x02, 0x36, 0x44, 0x42, 0x03, 0x36, + 0x44, 0x43, 0x04, 0x36, 0x44, 0x44, 0x05, 0x36, 0x44, 0x45, 0x06, 0x36, 0x44, 0x46, 0x07, 0x36, + 0x44, 0x47, 0x08, 0x36, 0x44, 0x48, 0x09, 0x36, 0x44, 0x49, 0x0A, 0x36, 0x44, 0x4A, 0x0B, 0x36, + 0x44, 0x4B, 0x0C, 0x36, 0x44, 0x4C, 0x0D, 0x36, 0x44, 0x4D, 0x0E, 0x36, 0x44, 0x4E, 0x0F, 0x36, + 0x44, 0x4F, 0x87, 0xFF, 0x21, 0x00, 0x25, 0x44, 0x10, 0x36, 0x44, 0x50, 0x11, 0x36, 0x44, 0x51, + 0x12, 0x36, 0x44, 0x52, 0x13, 0x36, 0x44, 0x53, 0x14, 0x36, 0x44, 0x54, 0x15, 0x36, 0x44, 0x55, + 0x16, 0x36, 0x44, 0x56, 0x17, 0x36, 0x44, 0x57, 0x18, 0x36, 0x44, 0x58, 0x19, 0x36, 0x44, 0x59, + 0x1A, 0x36, 0x44, 0x5A, 0x1B, 0x36, 0x44, 0x5B, 0x1C, 0x36, 0x44, 0x5C, 0x1D, 0x36, 0x44, 0x5D, + 0x1E, 0x36, 0x44, 0x5E, 0x1F, 0x36, 0x44, 0x5F, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x25, 0x46, + 0xB5, 0x60, 0x58, 0x4F, 0x4B, 0x78, 0xFF, 0xFF, 0x03, 0x61, 0x7F, 0x67, 0x0A, 0x02, 0x00, 0xF0, + 0x04, 0x64, 0x0F, 0x60, 0x93, 0xFB, 0x5A, 0xD9, 0x0A, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x40, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, + 0x02, 0x61, 0x12, 0x02, 0x14, 0x64, 0x0F, 0x60, 0x9F, 0xFB, 0x00, 0x60, 0x50, 0x63, 0x5A, 0xDD, + 0xF2, 0x60, 0xF7, 0x64, 0x7F, 0xFB, 0x2D, 0xFF, 0xF0, 0x60, 0xC7, 0x78, 0xFF, 0xFF, 0x2A, 0xF3, + 0x05, 0xFB, 0x2B, 0xF3, 0x06, 0xFB, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x40, 0x60, 0xC0, 0x64, + 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, 0x0E, 0x02, 0x16, 0x64, 0x0F, 0x60, 0x9F, 0xFB, + 0x00, 0x60, 0x50, 0x63, 0x5A, 0xDD, 0xF3, 0x60, 0x12, 0x64, 0x7F, 0xFB, 0x2D, 0xFF, 0xF0, 0x60, + 0xC7, 0x78, 0xFF, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x7F, 0x60, 0xC0, 0x64, 0x24, 0x45, + 0xA4, 0x80, 0x02, 0x61, 0x35, 0x02, 0x25, 0x45, 0xF1, 0x60, 0x02, 0x64, 0xD4, 0x80, 0xFF, 0xFF, + 0x34, 0x03, 0xF1, 0x60, 0x00, 0x64, 0xD4, 0x80, 0xFF, 0xFF, 0x01, 0x03, 0x28, 0x00, 0x15, 0x60, + 0xC3, 0xF1, 0x99, 0xF3, 0x19, 0x60, 0x00, 0x61, 0xA0, 0x84, 0xA1, 0xDB, 0x25, 0x45, 0x1E, 0x60, + 0x96, 0x63, 0x01, 0x61, 0xBD, 0xD3, 0xBD, 0xD1, 0xD4, 0x80, 0xBD, 0xD3, 0xBD, 0xD5, 0xCD, 0x81, + 0x02, 0x03, 0x15, 0x03, 0xF7, 0x01, 0xA2, 0xFF, 0xA6, 0xD3, 0x40, 0x4C, 0x00, 0xA8, 0x67, 0x43, + 0x0C, 0x02, 0xA2, 0xDD, 0x42, 0x48, 0x64, 0x41, 0xB5, 0x60, 0x58, 0x4D, 0xA2, 0x78, 0xFF, 0xFF, + 0x66, 0x44, 0x28, 0xDB, 0x02, 0x03, 0x2C, 0x58, 0xA3, 0xFF, 0x0C, 0x61, 0x03, 0x00, 0x04, 0x61, + 0x7F, 0x67, 0x01, 0x00, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xF1, 0x60, 0x02, 0x64, 0xD4, 0x80, + 0x7F, 0x67, 0x06, 0x63, 0xF8, 0x02, 0x31, 0x40, 0x21, 0x2A, 0xF5, 0x01, 0x01, 0x64, 0x0C, 0x60, + 0x82, 0xFB, 0xFF, 0xFF, 0xC4, 0xFE, 0xEE, 0x01, 0xC6, 0xFE, 0xEC, 0x01, 0x7E, 0x60, 0xC0, 0x64, + 0x24, 0x45, 0xA4, 0x80, 0x02, 0x61, 0x3F, 0x02, 0x25, 0x45, 0xF8, 0x2B, 0x3B, 0x00, 0x2E, 0xF5, + 0x67, 0x44, 0xD4, 0x80, 0x19, 0x60, 0xAA, 0x63, 0x39, 0x03, 0x7E, 0x61, 0x24, 0x44, 0x01, 0x27, + 0x29, 0x00, 0xA3, 0xFC, 0xA4, 0xF8, 0xBD, 0xD3, 0xA3, 0xD1, 0xD4, 0x80, 0xCD, 0x81, 0x08, 0x24, + 0x64, 0x58, 0x08, 0xA3, 0xF8, 0x02, 0x08, 0x60, 0x00, 0x63, 0xBD, 0xD3, 0xA3, 0xD1, 0xFE, 0xA0, + 0xFA, 0x60, 0x00, 0x64, 0xD0, 0x80, 0x14, 0x02, 0x13, 0x02, 0x04, 0xA3, 0xBE, 0xD3, 0xBD, 0xD1, + 0x0F, 0x18, 0xD4, 0x80, 0x0D, 0x18, 0x03, 0x03, 0xC3, 0x83, 0xC3, 0x83, 0xF7, 0x01, 0x64, 0x41, + 0xDD, 0x81, 0xE1, 0x81, 0xCB, 0x83, 0x46, 0x65, 0xF8, 0x60, 0x58, 0x4F, 0x7A, 0x78, 0xFF, 0xFF, + 0x00, 0x67, 0x0A, 0x00, 0xBD, 0xD3, 0xBE, 0xD1, 0xD4, 0x80, 0xCD, 0x81, 0x08, 0x24, 0x64, 0x58, + 0x08, 0xA3, 0xF8, 0x02, 0x04, 0x61, 0x7F, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x0F, 0x64, 0x23, 0xFA, + 0x67, 0x44, 0x24, 0xFA, 0x62, 0x41, 0x3E, 0x60, 0x00, 0x65, 0x1A, 0x63, 0xF7, 0x60, 0x8C, 0x64, + 0x65, 0x46, 0x58, 0xD0, 0x2E, 0xF5, 0x59, 0xD8, 0xFB, 0x1F, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x4B, 0xD3, 0xFF, 0xFF, 0x60, 0x41, 0xE8, 0x84, 0xDC, 0x84, 0x23, 0xFA, 0xBF, 0xD1, 0x4A, 0x65, + 0x64, 0x43, 0xF8, 0x60, 0x58, 0x4F, 0x7A, 0x78, 0xFF, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x25, 0xF2, 0xFF, 0xFF, 0xE0, 0xA0, 0x20, 0x64, 0x01, 0x06, 0x25, 0xFA, 0x23, 0xF2, 0xDF, 0xD1, + 0xCC, 0x84, 0xE0, 0x85, 0x0B, 0x06, 0xBF, 0xD1, 0x64, 0x41, 0xD5, 0x80, 0x64, 0x43, 0x01, 0x06, + 0x65, 0x41, 0x4A, 0x65, 0xF4, 0x60, 0x58, 0x4F, 0xBD, 0x78, 0xFF, 0xFF, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0xBC, 0xF3, 0x02, 0x63, 0x23, 0xFC, 0x07, 0xB4, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x4B, 0xD3, 0xBF, 0xD3, 0x60, 0x41, 0xC9, 0x83, 0xE9, 0x81, 0xDD, 0x81, 0xA3, 0xFA, + 0xE0, 0x81, 0x3C, 0x60, 0x00, 0x67, 0x02, 0x24, 0x02, 0xA4, 0x60, 0x47, 0x40, 0x4B, 0xC9, 0x81, + 0x4A, 0x65, 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0xA5, 0xD8, 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, + 0x00, 0xF4, 0x04, 0x65, 0xF6, 0x1F, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xFC, 0xA3, 0xA3, 0xD1, + 0x4C, 0x65, 0xA4, 0xD3, 0xDA, 0x83, 0x60, 0x47, 0x25, 0xFA, 0x00, 0x7E, 0x60, 0x47, 0x01, 0x26, + 0xDC, 0x84, 0x60, 0x41, 0xE8, 0x84, 0xD8, 0x84, 0x23, 0xFA, 0xAB, 0x01, 0xFC, 0xA3, 0xA3, 0xD1, + 0x4C, 0x65, 0xA4, 0xD3, 0xDA, 0x83, 0x00, 0x7F, 0x25, 0xFA, 0x60, 0x41, 0x01, 0x26, 0xDD, 0x81, + 0xE9, 0x84, 0xD8, 0x84, 0x23, 0xFA, 0x9D, 0x01, 0x23, 0xF2, 0x25, 0xF2, 0x02, 0xA8, 0xF8, 0xA0, + 0x0F, 0x02, 0xEC, 0xA0, 0x0D, 0x04, 0x0C, 0x07, 0x15, 0x60, 0xD2, 0xF1, 0xFF, 0xFF, 0xD0, 0x80, + 0xFF, 0xFF, 0x04, 0x07, 0x15, 0x60, 0xD2, 0xFB, 0x15, 0x60, 0xD6, 0xFB, 0x13, 0x60, 0x5B, 0xFB, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, 0x14, 0x60, 0xEE, 0x65, 0x60, 0x41, 0x14, 0x60, + 0x8A, 0x63, 0xA3, 0xDB, 0xFF, 0xA1, 0x48, 0x64, 0x58, 0xD0, 0x7E, 0xA8, 0x5B, 0xD9, 0x02, 0x02, + 0x00, 0xF4, 0x02, 0x64, 0xFF, 0xA1, 0xD7, 0x80, 0x02, 0x03, 0x01, 0x03, 0xF5, 0x01, 0x2E, 0xF5, + 0x00, 0x60, 0x2F, 0x65, 0x25, 0xF2, 0x00, 0x63, 0xCC, 0x84, 0x03, 0xA3, 0xFD, 0x05, 0x4A, 0x64, + 0xD7, 0x80, 0x14, 0x60, 0x26, 0x61, 0x18, 0x05, 0xA1, 0xDD, 0xE3, 0x83, 0xFE, 0xA3, 0x58, 0xD0, + 0x7E, 0xA8, 0x59, 0xD9, 0x02, 0x02, 0x00, 0xF4, 0x02, 0x64, 0xF9, 0x1F, 0x00, 0x63, 0x59, 0xDD, + 0x2E, 0xF5, 0x25, 0xF0, 0x0A, 0x60, 0x13, 0xF3, 0xD3, 0x80, 0x01, 0xB0, 0x04, 0x03, 0x01, 0xA4, + 0x03, 0x03, 0xA2, 0xDB, 0x01, 0x00, 0xA2, 0xDD, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x14, 0x60, + 0x8A, 0x61, 0xA1, 0xD3, 0x23, 0xFA, 0xE0, 0x83, 0x4A, 0x65, 0x04, 0x02, 0x02, 0x63, 0x23, 0xFC, + 0xA5, 0xFC, 0x09, 0x00, 0xDB, 0x83, 0x59, 0xD1, 0xA5, 0xD8, 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, + 0x00, 0xF4, 0x04, 0x65, 0xF8, 0x1F, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x0A, 0x60, 0x13, 0xF3, + 0x00, 0x61, 0x02, 0xA4, 0xFE, 0xA0, 0x23, 0xFA, 0x1B, 0x03, 0xFA, 0xA4, 0xFD, 0xA4, 0x01, 0xA1, + 0xFD, 0x07, 0x61, 0x43, 0x23, 0xF2, 0x25, 0xFC, 0xE0, 0x83, 0x02, 0xA3, 0x14, 0x60, 0x26, 0x61, + 0x00, 0x60, 0x4A, 0x64, 0x59, 0xD1, 0x58, 0xD8, 0x7E, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x02, 0x64, + 0xF9, 0x1F, 0x25, 0xF2, 0x23, 0xF2, 0x01, 0xB0, 0xCC, 0x84, 0x04, 0x02, 0x23, 0xFA, 0x02, 0x00, + 0x00, 0x64, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x41, 0x4B, 0x65, 0x42, 0x80, 0x64, + 0xD4, 0x85, 0x2B, 0x41, 0x00, 0xA1, 0x55, 0x8B, 0x0D, 0x03, 0x02, 0x04, 0x65, 0x41, 0x02, 0x00, + 0x00, 0x64, 0x40, 0x4B, 0xCA, 0x84, 0x58, 0xD0, 0xC9, 0x81, 0xBD, 0xD9, 0xFC, 0x02, 0x00, 0xF4, + 0x04, 0x65, 0xEC, 0x01, 0x2F, 0x58, 0xFF, 0xFF, 0xFC, 0xA3, 0xA3, 0xD3, 0x02, 0x7C, 0xA0, 0xD3, + 0x23, 0xF8, 0xDC, 0x84, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x02, 0x64, 0x23, 0xFA, + 0x01, 0x64, 0x9D, 0xFE, 0x02, 0x28, 0x02, 0x64, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x02, 0x7C, 0x23, 0xF8, 0x01, 0x64, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xFC, 0xA3, + 0xA3, 0xD1, 0x02, 0x64, 0x23, 0xFA, 0x64, 0x44, 0x7C, 0x5F, 0x60, 0x45, 0x64, 0x47, 0x7C, 0x5F, + 0x88, 0xF1, 0x66, 0x41, 0xC0, 0x86, 0xA5, 0xD2, 0x61, 0x46, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x02, 0x64, 0x23, 0xFA, 0x88, 0xFF, 0x75, 0x44, 0x8D, 0xFF, 0xE8, 0x87, 0xE8, 0x84, + 0xE8, 0x84, 0x03, 0xB4, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x05, 0x64, 0x23, 0xFA, + 0x52, 0x63, 0x96, 0xF3, 0x4B, 0xDA, 0x95, 0xF3, 0x4B, 0xDA, 0x94, 0xF3, 0x4B, 0xDA, 0x60, 0x41, + 0x88, 0xFF, 0x72, 0x5C, 0x89, 0xFF, 0x4A, 0xD8, 0xA2, 0x48, 0x20, 0x23, 0x0E, 0x00, 0x64, 0x40, + 0x80, 0x27, 0x15, 0x00, 0xDC, 0x84, 0xBD, 0xDA, 0xBD, 0xD2, 0x11, 0x04, 0xDC, 0x84, 0xA2, 0xDA, + 0xA3, 0xD2, 0x0D, 0x04, 0xDC, 0x84, 0xA3, 0xDA, 0x0A, 0x00, 0x52, 0x63, 0x96, 0xF3, 0x4B, 0xDA, + 0x95, 0xF3, 0x4B, 0xDA, 0x94, 0xF3, 0x4B, 0xDA, 0x54, 0x90, 0x4C, 0x63, 0xE0, 0x02, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x25, 0xF0, 0x23, 0xF2, 0x15, 0x60, 0xC9, 0xF9, 0x02, 0xA8, 0x64, 0x44, + 0x1F, 0x02, 0x3F, 0x40, 0x02, 0x2B, 0x16, 0x00, 0x00, 0x37, 0x14, 0x00, 0x01, 0x3B, 0x18, 0x00, + 0x11, 0x60, 0xF9, 0x65, 0x11, 0x60, 0x19, 0x63, 0xFF, 0xB7, 0x60, 0x5C, 0xA3, 0xD3, 0x08, 0xA3, + 0x00, 0x7E, 0xD0, 0x80, 0xD7, 0x80, 0x03, 0x03, 0xF9, 0x02, 0x7F, 0x67, 0x0A, 0x00, 0xF4, 0xA3, + 0xA3, 0xD1, 0x04, 0x00, 0x00, 0xBC, 0xF2, 0xA4, 0x03, 0x03, 0x02, 0x07, 0x13, 0x60, 0x52, 0xF9, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x20, 0x63, 0x27, 0x60, 0x06, 0x61, 0x48, 0x64, 0x58, 0xD0, + 0x59, 0xD9, 0xFD, 0x1F, 0x25, 0xF0, 0x20, 0x64, 0xD0, 0x81, 0xFF, 0xFF, 0x02, 0x07, 0x25, 0xFA, + 0x0F, 0x00, 0x27, 0x60, 0x0A, 0x63, 0xC3, 0x83, 0x01, 0x2A, 0x06, 0x00, 0xCF, 0x83, 0xA3, 0xD3, + 0xCD, 0x81, 0x00, 0x7F, 0xBD, 0xDB, 0x04, 0x03, 0x00, 0x64, 0xC9, 0x81, 0xBD, 0xDB, 0xFD, 0x02, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, 0x25, 0xF0, 0x01, 0x60, 0x6E, 0x63, 0x7F, 0x67, + 0x3A, 0x18, 0xA3, 0xD9, 0x26, 0xF0, 0x7F, 0x67, 0x36, 0x18, 0x5B, 0xD9, 0x13, 0x60, 0x0A, 0xF3, + 0x25, 0xF0, 0x60, 0x40, 0x03, 0x3A, 0x2E, 0x00, 0x86, 0xF3, 0x87, 0xF3, 0x60, 0x43, 0xE3, 0x83, + 0x60, 0x46, 0x0F, 0xF8, 0x30, 0x61, 0x94, 0xFA, 0x01, 0x61, 0x91, 0xFA, 0x16, 0x64, 0x12, 0xFA, + 0x60, 0x40, 0x10, 0x36, 0x05, 0x00, 0x12, 0x36, 0x08, 0x00, 0x0C, 0x36, 0x0B, 0x00, 0x0F, 0x00, + 0x40, 0x61, 0xA1, 0x80, 0x0A, 0x64, 0x11, 0x02, 0xF3, 0x01, 0x10, 0x61, 0xA1, 0x80, 0x0E, 0x64, + 0x0C, 0x02, 0xEE, 0x01, 0x08, 0x61, 0xA1, 0x80, 0x10, 0x64, 0x07, 0x02, 0xE9, 0x01, 0xE1, 0x81, + 0xA1, 0x80, 0x05, 0x05, 0xC8, 0x84, 0x01, 0x02, 0xE3, 0x01, 0x12, 0xFA, 0x91, 0xFA, 0x66, 0x44, + 0x02, 0xA6, 0xD7, 0x1F, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xFC, 0xA3, 0xA5, 0xF0, 0xA3, 0xD1, + 0xFF, 0xFF, 0x64, 0x5E, 0x00, 0x7F, 0x60, 0x41, 0x64, 0x47, 0x7C, 0x5F, 0x88, 0xF1, 0x66, 0x43, + 0xC0, 0x86, 0x65, 0x44, 0xA1, 0xDA, 0x63, 0x46, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xFC, 0xA3, + 0xA3, 0xD1, 0xFF, 0xFF, 0x64, 0x5E, 0x00, 0x7F, 0x60, 0x45, 0x64, 0x47, 0x7C, 0x5F, 0x88, 0xF1, + 0x66, 0x41, 0xC0, 0x86, 0x65, 0x44, 0xA0, 0xD2, 0x61, 0x46, 0x25, 0xFA, 0x02, 0x64, 0x23, 0xFA, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x25, 0xF2, 0x15, 0x60, 0xC8, 0xFB, 0xFF, 0xFF, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, 0x25, 0xF0, 0x02, 0xA8, 0x00, 0x67, 0x02, 0x02, 0x2D, 0xF9, + 0x2C, 0xF9, 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, 0x25, 0xF2, 0x02, 0xA8, 0x00, 0xA8, 0x0A, 0x02, + 0x07, 0x03, 0xD0, 0xA0, 0x30, 0x65, 0x03, 0x04, 0xA7, 0xA0, 0x59, 0x65, 0x01, 0x06, 0x65, 0x44, + 0x13, 0x60, 0x51, 0xFB, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x25, 0xF2, 0x15, 0x60, 0xCF, 0xFB, + 0xFF, 0xFF, 0x08, 0x2A, 0x25, 0x00, 0x15, 0x60, 0xDD, 0xF3, 0xFF, 0xFF, 0xE9, 0xB4, 0x60, 0x44, + 0x15, 0x60, 0xCF, 0xF1, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x26, 0x02, 0xBC, 0x64, 0x40, 0x02, 0x2A, + 0x04, 0xBC, 0x64, 0x40, 0x04, 0x26, 0x08, 0x00, 0x15, 0x60, 0xDD, 0xFB, 0x13, 0x64, 0xAD, 0xFB, + 0x01, 0x60, 0x67, 0x64, 0x37, 0xFB, 0x0C, 0x00, 0x10, 0xBC, 0x15, 0x60, 0xDD, 0xFB, 0x08, 0x64, + 0xAD, 0xFB, 0x82, 0xF3, 0x01, 0x60, 0x67, 0x7C, 0x60, 0x40, 0x01, 0x27, 0x5B, 0x7C, 0x37, 0xF9, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x25, 0xF2, 0x15, 0x60, 0xD0, 0xFB, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x25, 0xF2, 0x15, 0x60, 0xD1, 0xFB, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x25, 0xF2, + 0x15, 0x60, 0xEB, 0xFB, 0xFF, 0xFF, 0x0F, 0x22, 0x41, 0x75, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x04, 0x61, 0x06, 0x00, 0x01, 0x64, 0x01, 0x00, 0x00, 0x64, 0x18, 0x60, 0x13, 0xFB, 0x06, 0x61, + 0x41, 0x56, 0xC7, 0xFE, 0xF0, 0x60, 0xC7, 0x78, 0xFF, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x78, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, 0x10, 0x02, 0x08, 0x61, + 0x41, 0x56, 0xC7, 0xFE, 0xF0, 0x60, 0xC7, 0x78, 0xFF, 0xFF, 0x36, 0x47, 0xFF, 0x23, 0x04, 0x00, + 0x00, 0x7F, 0x60, 0x41, 0x7F, 0x67, 0x03, 0x00, 0x04, 0x7C, 0xBC, 0xF9, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x78, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, 0x10, 0x02, + 0x0A, 0x61, 0x41, 0x56, 0xC7, 0xFE, 0xF0, 0x60, 0xC7, 0x78, 0xFF, 0xFF, 0x36, 0x47, 0xFF, 0x23, + 0x04, 0x00, 0x00, 0x7F, 0x60, 0x41, 0x7F, 0x67, 0x03, 0x00, 0x01, 0x7C, 0xBC, 0xF9, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x02, 0x63, 0x64, 0xF3, 0x23, 0xFC, 0x60, 0x40, 0x01, 0x23, 0x17, 0x00, + 0x01, 0x60, 0xFF, 0x65, 0xA4, 0x84, 0x11, 0x60, 0x14, 0x61, 0x11, 0x60, 0xF4, 0x65, 0xA1, 0xD1, + 0xD5, 0x80, 0xD0, 0x80, 0x0B, 0x03, 0x02, 0x03, 0x08, 0xA1, 0xF9, 0x01, 0x04, 0xA1, 0xA1, 0xD3, + 0x01, 0x60, 0x00, 0x65, 0x60, 0x47, 0xFF, 0xB4, 0xB4, 0x84, 0x01, 0x00, 0xFF, 0x64, 0x25, 0xFA, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xA2, 0xFF, 0x46, 0x45, 0x02, 0xF0, 0x09, 0x60, 0x08, 0x64, + 0xD0, 0x80, 0x00, 0xF4, 0x01, 0xF2, 0x66, 0x5C, 0x25, 0x46, 0x56, 0x02, 0x70, 0x27, 0x54, 0x00, + 0x12, 0x64, 0x03, 0xFA, 0x04, 0xF8, 0x0E, 0xF2, 0x87, 0xFC, 0x8D, 0xFC, 0x8E, 0xFC, 0xDA, 0x82, + 0x16, 0x61, 0x00, 0x63, 0xC9, 0x81, 0x5A, 0xDC, 0xFD, 0x02, 0x60, 0x40, 0xF0, 0x3B, 0x16, 0x00, + 0x32, 0x44, 0x8E, 0xF3, 0x01, 0xB0, 0xF6, 0xA0, 0x08, 0x24, 0x2C, 0x05, 0xDC, 0x83, 0xF0, 0x67, + 0x0E, 0xFA, 0x1F, 0x60, 0x0A, 0x64, 0x2B, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0x8E, 0xFD, 0x2B, 0xFF, 0xFE, 0x64, 0x3B, 0x42, 0x4A, 0xDB, 0x4F, 0x00, 0x8F, 0xF3, 0x09, 0x65, + 0xD4, 0x80, 0xDC, 0x83, 0x17, 0x05, 0x8F, 0xFD, 0x98, 0xFE, 0x04, 0x04, 0x00, 0x7F, 0x08, 0x7E, + 0x0E, 0xFA, 0x3B, 0xFF, 0x1E, 0x60, 0xFE, 0x64, 0x2B, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0x0E, 0xF2, 0x2B, 0xFF, 0x60, 0x40, 0x08, 0x26, 0xF7, 0xFE, 0xFD, 0x64, 0x3B, 0x42, + 0x4A, 0xDB, 0x32, 0x00, 0x8B, 0xF3, 0xFF, 0xFF, 0xD8, 0xA0, 0xFF, 0xFF, 0x0D, 0x04, 0x1F, 0x60, + 0x16, 0x64, 0x2B, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xFC, 0x64, 0x3B, 0x42, 0x4A, 0xDB, 0x21, 0x00, 0x46, 0x45, 0x00, 0x64, 0x2B, 0xDB, 0x25, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xA2, 0xFF, 0x00, 0xF4, 0x01, 0xF0, + 0x0A, 0x18, 0x70, 0x67, 0xA0, 0x80, 0xF0, 0x67, 0x06, 0x03, 0xC0, 0x84, 0x01, 0xFA, 0x25, 0x46, + 0x25, 0x44, 0x80, 0xFC, 0x05, 0xFA, 0xB6, 0x60, 0x58, 0x4E, 0x72, 0x78, 0xFF, 0xFF, 0xD4, 0xFE, + 0xA3, 0xFF, 0xFF, 0x64, 0x3B, 0x42, 0x4A, 0xDB, 0xD4, 0xFE, 0xA3, 0xFF, 0x2D, 0x58, 0xFF, 0xFF, + 0x1F, 0x60, 0x04, 0x64, 0x40, 0x47, 0x58, 0x4F, 0x0D, 0x00, 0x1E, 0x60, 0xF8, 0x64, 0x40, 0x47, + 0x58, 0x4F, 0x18, 0x00, 0x1F, 0x60, 0x10, 0x64, 0x40, 0x47, 0x58, 0x4F, 0x03, 0x00, 0xF0, 0x60, + 0xC7, 0x78, 0xFF, 0xFF, 0x27, 0xD5, 0x0E, 0xF2, 0x0B, 0x18, 0x60, 0x40, 0x01, 0x2A, 0x08, 0x00, + 0x1F, 0x60, 0x26, 0x64, 0x40, 0x4B, 0xF6, 0x60, 0x58, 0x4D, 0xB3, 0x78, 0xFF, 0xFF, 0xF2, 0x01, + 0x2F, 0x58, 0xFF, 0xFF, 0x27, 0xD5, 0x0E, 0xF2, 0x14, 0x18, 0x60, 0x40, 0x01, 0x2A, 0x11, 0x00, + 0x02, 0xF0, 0x09, 0x60, 0x08, 0x64, 0xD0, 0x80, 0xA2, 0xFF, 0x8F, 0xF3, 0x02, 0x02, 0xCC, 0x84, + 0x8F, 0xFB, 0x1F, 0x60, 0x26, 0x64, 0x40, 0x4B, 0xF6, 0x60, 0x58, 0x4D, 0xB3, 0x78, 0xFF, 0xFF, + 0xE9, 0x01, 0x2F, 0x58, 0xFF, 0xFF, 0xFB, 0x64, 0x3A, 0x42, 0x4A, 0xDB, 0xA2, 0xFF, 0x92, 0xF3, + 0x8E, 0xF3, 0xCC, 0x80, 0xFA, 0xA0, 0x01, 0x14, 0x1D, 0x05, 0xB5, 0x60, 0x58, 0x4D, 0x77, 0x78, + 0xFF, 0xFF, 0xA2, 0xFF, 0x17, 0x03, 0xF0, 0x67, 0x0E, 0xFA, 0x1F, 0x60, 0x0A, 0x64, 0x0F, 0x60, + 0x93, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xF6, 0x64, + 0x3A, 0x42, 0x4A, 0xDB, 0x92, 0xF3, 0x8E, 0xF3, 0xCC, 0x83, 0xDC, 0x84, 0x01, 0x15, 0x92, 0xFD, + 0x8E, 0xFB, 0xD4, 0xFE, 0x91, 0xF3, 0x8F, 0xF3, 0x00, 0xA8, 0x90, 0xF1, 0x03, 0x02, 0xD0, 0x80, + 0xFF, 0xFF, 0x26, 0x05, 0xB5, 0x60, 0x58, 0x4D, 0x77, 0x78, 0xFF, 0xFF, 0xA2, 0xFF, 0x20, 0x03, + 0x00, 0x63, 0x91, 0xF3, 0x0E, 0xFC, 0xCC, 0x84, 0xFF, 0x3A, 0x91, 0xFB, 0x98, 0xFE, 0x03, 0x04, + 0x08, 0xBB, 0x0E, 0xFC, 0x3B, 0xFF, 0x1E, 0x60, 0xFE, 0x64, 0x0F, 0x60, 0x93, 0xFB, 0x66, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xF7, 0x64, 0x3A, 0x42, 0x4A, 0xDB, + 0x8F, 0xF3, 0x0E, 0xF2, 0xDC, 0x83, 0x08, 0xB0, 0x8F, 0xFD, 0x08, 0x28, 0xF7, 0xFE, 0xD4, 0xFE, + 0xA3, 0xFF, 0xF0, 0x60, 0xC7, 0x78, 0xFF, 0xFF, 0xB9, 0xFE, 0x13, 0xFF, 0x24, 0x40, 0x80, 0x2B, + 0x0B, 0x00, 0xA2, 0xFF, 0x25, 0x46, 0x09, 0xF4, 0x0E, 0xF2, 0x05, 0x18, 0x08, 0xBC, 0x0E, 0xFA, + 0xFF, 0xFF, 0xF7, 0xFE, 0x01, 0x00, 0xD8, 0xFE, 0xA3, 0xFF, 0x25, 0x46, 0x3E, 0xF2, 0x00, 0xF4, + 0x08, 0xF0, 0x25, 0x46, 0x06, 0xB4, 0xFF, 0x7F, 0x10, 0xBC, 0x06, 0x26, 0xFD, 0x7F, 0x0E, 0xFA, + 0x3E, 0xF2, 0x3F, 0xF2, 0x60, 0x41, 0x08, 0x2A, 0x64, 0x47, 0x3F, 0xFA, 0x60, 0x45, 0x13, 0x60, + 0x2D, 0xF3, 0xA3, 0xFC, 0xAB, 0xFC, 0x91, 0xFC, 0xD4, 0x80, 0x38, 0x60, 0xC1, 0x65, 0xA5, 0x80, + 0x01, 0x04, 0x07, 0x03, 0x23, 0xF0, 0x08, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0xF8, 0x60, 0x57, 0x78, + 0xFF, 0xFF, 0xFB, 0x60, 0x58, 0x4F, 0x75, 0x78, 0xFF, 0xFF, 0x0B, 0x04, 0x23, 0xF0, 0x04, 0x64, + 0xB0, 0x84, 0xA2, 0xDA, 0x25, 0x60, 0xF4, 0x64, 0xE5, 0x60, 0x78, 0x41, 0xC7, 0x78, 0x97, 0xF1, + 0x46, 0x00, 0x3E, 0xF0, 0x88, 0xF1, 0x64, 0x47, 0x07, 0xB4, 0x07, 0x36, 0x3B, 0x00, 0x04, 0x03, + 0xCC, 0x84, 0xE0, 0x84, 0xC0, 0x83, 0x2D, 0x00, 0x2C, 0xF2, 0x87, 0xF1, 0x01, 0xB0, 0x64, 0x43, + 0x35, 0x02, 0x2E, 0xF2, 0x15, 0x60, 0x02, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, + 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x2E, 0xF0, 0x63, 0x46, + 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x2D, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, + 0x06, 0x02, 0x61, 0x46, 0x2C, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, + 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0x87, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x01, 0x03, + 0x09, 0x00, 0x66, 0x45, 0x63, 0x46, 0x06, 0xF0, 0x65, 0x46, 0x64, 0x44, 0x0C, 0x26, 0x02, 0x00, + 0x02, 0x26, 0x04, 0x00, 0x23, 0xF0, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0x07, 0xFC, 0x23, 0xF2, + 0xFF, 0xFF, 0x0F, 0x1B, 0x1E, 0x60, 0xE0, 0x64, 0x0F, 0x60, 0x93, 0xFB, 0x66, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x0E, 0xF2, 0xC8, 0xFE, 0x10, 0xAC, 0x0E, 0xFA, + 0x0E, 0x00, 0x1E, 0x60, 0xF2, 0x64, 0x0F, 0x60, 0x93, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x0E, 0xF2, 0xCE, 0xFE, 0x10, 0xAC, 0x0E, 0xFA, 0xF0, 0x60, + 0xC7, 0x78, 0xFF, 0xFF, 0xCB, 0x84, 0xC9, 0x83, 0xFF, 0xFF, 0x08, 0x04, 0x58, 0xD1, 0xA5, 0xD8, + 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0xF8, 0x1F, 0x2F, 0x58, 0xFF, 0xFF, + 0x25, 0xF0, 0x14, 0x60, 0x15, 0xF9, 0x11, 0x00, 0x0D, 0x60, 0x00, 0x62, 0x40, 0x63, 0x5A, 0xDF, + 0xFE, 0x1F, 0x04, 0x65, 0x0D, 0x60, 0x00, 0x61, 0x48, 0x64, 0x3E, 0x63, 0x7C, 0xA8, 0x58, 0xD0, + 0x59, 0xD9, 0x02, 0x02, 0x00, 0xF4, 0x02, 0x64, 0xF9, 0x1F, 0x14, 0x60, 0x15, 0xF1, 0x0C, 0x60, + 0xDC, 0x65, 0x02, 0xFE, 0x64, 0x44, 0xF8, 0x84, 0xF8, 0x84, 0xF8, 0x87, 0x60, 0x41, 0x64, 0x44, + 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x84, 0x3E, 0xFB, 0x60, 0x42, 0x61, 0x44, 0x03, 0xA2, 0x60, 0xFE, + 0xA2, 0xDB, 0x20, 0xFE, 0x64, 0x44, 0x0D, 0x60, 0x02, 0x65, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, + 0xE0, 0x84, 0xC4, 0x84, 0x40, 0xFB, 0xFF, 0xFF, 0x00, 0x67, 0x00, 0x61, 0x23, 0x58, 0xFF, 0xFF, + 0x5C, 0x41, 0x25, 0xF2, 0xFF, 0xFF, 0x40, 0x42, 0x80, 0x2B, 0x04, 0x00, 0xFF, 0xB4, 0x40, 0x42, + 0x01, 0x64, 0x40, 0x41, 0x87, 0xF3, 0x46, 0x4B, 0x86, 0xF3, 0x60, 0x46, 0xE0, 0x83, 0xAB, 0x46, + 0x26, 0xF0, 0xAB, 0x46, 0x59, 0xF8, 0xAB, 0x46, 0x27, 0xF0, 0xAB, 0x46, 0x5A, 0xF8, 0xAB, 0x46, + 0x28, 0xF0, 0xAB, 0x46, 0x5B, 0xF8, 0x66, 0x44, 0x02, 0xA6, 0xF1, 0x1F, 0x87, 0xF3, 0xFF, 0xFF, + 0x60, 0x46, 0xAB, 0x46, 0x0C, 0x60, 0x3A, 0x65, 0x22, 0x44, 0xFF, 0xB4, 0xE0, 0x84, 0xE0, 0x84, + 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x81, 0xC9, 0x81, 0x52, 0x64, 0x0E, 0x63, 0x58, 0xD0, 0x59, 0xD9, + 0xFD, 0x1F, 0x21, 0x44, 0x01, 0x2A, 0x08, 0x00, 0xAB, 0x46, 0xF0, 0xA1, 0x76, 0x64, 0x0E, 0x63, + 0x59, 0xD1, 0x58, 0xD8, 0xFD, 0x1F, 0xAB, 0x46, 0x22, 0x44, 0xFF, 0xB4, 0xE0, 0x84, 0xE0, 0x84, + 0xE0, 0x84, 0x0C, 0x60, 0x9C, 0x65, 0xC4, 0x81, 0x60, 0x45, 0xC9, 0x81, 0x62, 0x64, 0x06, 0x63, + 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x21, 0x44, 0x01, 0x2A, 0x08, 0x00, 0xAB, 0x46, 0xF8, 0xA1, + 0xB6, 0x64, 0x06, 0x63, 0x59, 0xD1, 0x58, 0xD8, 0xFD, 0x1F, 0xAB, 0x46, 0x65, 0x44, 0x0C, 0x60, + 0xBC, 0x65, 0xC4, 0x81, 0xC9, 0x81, 0x6A, 0x64, 0x06, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, + 0x22, 0x44, 0xFF, 0xB4, 0xE0, 0x84, 0xE0, 0x85, 0xC4, 0x84, 0x0C, 0x60, 0x82, 0x65, 0xC4, 0x81, + 0x72, 0x64, 0x04, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0xAB, 0x46, 0x21, 0x44, 0x01, 0x2A, + 0x06, 0x00, 0xFA, 0xA1, 0x90, 0x64, 0x04, 0x63, 0x59, 0xD1, 0x58, 0xD8, 0xFD, 0x1F, 0x3B, 0xF0, + 0x21, 0x44, 0x01, 0x2A, 0x13, 0x00, 0x22, 0x44, 0x3D, 0xFB, 0x60, 0x41, 0x02, 0xFE, 0xF8, 0x84, + 0xF8, 0x84, 0xF8, 0x84, 0x3C, 0xFB, 0x0C, 0x60, 0x7E, 0x63, 0x88, 0xFF, 0xCD, 0x81, 0x06, 0xA3, + 0xFD, 0x0D, 0x8D, 0xFF, 0x3B, 0xFD, 0x64, 0x47, 0x80, 0xBF, 0x60, 0x5C, 0x22, 0x43, 0x80, 0x61, + 0x88, 0xFF, 0xCF, 0x83, 0xE1, 0x81, 0xFD, 0x0D, 0x8D, 0xFF, 0x61, 0x47, 0x31, 0x91, 0xB1, 0x84, + 0x3B, 0xFA, 0x86, 0xF3, 0xFF, 0xFF, 0xCC, 0x83, 0xE3, 0x83, 0x66, 0x44, 0x02, 0xA6, 0x3B, 0xF0, + 0x66, 0x44, 0xB1, 0x9C, 0x3B, 0xF8, 0x02, 0xA6, 0xFA, 0x1F, 0xAB, 0x46, 0x00, 0x67, 0x00, 0x61, + 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, 0x25, 0xF0, 0x02, 0xA8, 0x00, 0x67, 0x24, 0x02, 0x3D, 0xF1, + 0x64, 0x44, 0x03, 0xB4, 0x40, 0x42, 0xD0, 0x80, 0x87, 0xF3, 0xFF, 0xFF, 0x60, 0x46, 0xBB, 0xF4, + 0x80, 0x61, 0x02, 0x02, 0xE3, 0x83, 0xEB, 0x83, 0x22, 0x44, 0x88, 0xFF, 0xCC, 0x84, 0xE1, 0x81, + 0xFD, 0x0D, 0x8D, 0xFF, 0x61, 0x47, 0x31, 0x91, 0x9D, 0x85, 0xA7, 0x83, 0x3B, 0xFC, 0x86, 0xF3, + 0xFF, 0xFF, 0xCC, 0x83, 0xE3, 0x83, 0x66, 0x44, 0x02, 0xA6, 0xBB, 0xF2, 0x66, 0x44, 0xA5, 0x81, + 0xBB, 0xFA, 0x02, 0xA6, 0xFA, 0x1F, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x11, 0x64, 0x23, 0xFA, + 0x25, 0x44, 0x24, 0xFA, 0x04, 0x64, 0x40, 0x4B, 0x62, 0x41, 0x0C, 0x60, 0x82, 0x64, 0x04, 0x63, + 0x58, 0xD1, 0x59, 0xD8, 0xFD, 0x1F, 0x2B, 0x43, 0x00, 0x7C, 0x59, 0xD8, 0x4F, 0x8B, 0x06, 0xA4, + 0xF6, 0x02, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x27, 0xF2, 0x15, 0x60, 0x02, 0x65, 0x60, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, + 0x61, 0x46, 0x27, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x26, 0xF0, + 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x25, 0xF0, 0x63, 0x46, 0xD0, 0x80, + 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0x87, 0xF3, 0x08, 0xFE, + 0x60, 0x43, 0x61, 0x46, 0x01, 0x03, 0x2A, 0x00, 0x43, 0x4B, 0xAB, 0x46, 0x3B, 0xF2, 0x80, 0x60, + 0x30, 0x7C, 0xB0, 0x84, 0xA2, 0xDA, 0x4E, 0x61, 0x76, 0x64, 0x0E, 0x63, 0xAB, 0x46, 0x59, 0xD0, + 0xAB, 0x46, 0x58, 0xD8, 0xFB, 0x1F, 0x90, 0x64, 0x04, 0x63, 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, + 0x58, 0xD8, 0xFB, 0x1F, 0xD9, 0x81, 0xA0, 0x64, 0x04, 0x63, 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, + 0x58, 0xD8, 0xFB, 0x1F, 0xD9, 0x81, 0xB6, 0x64, 0x0E, 0x63, 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, + 0x58, 0xD8, 0xFB, 0x1F, 0x00, 0x67, 0x00, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x01, 0x67, 0x20, 0x61, + 0x23, 0x58, 0xFF, 0xFF, 0x27, 0xF2, 0x15, 0x60, 0x02, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, + 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x27, 0xF0, + 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x26, 0xF0, 0x63, 0x46, 0xD0, 0x80, + 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x25, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, + 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0x87, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, + 0x01, 0x03, 0x0D, 0x00, 0x43, 0x4B, 0xAB, 0x46, 0x3B, 0xF2, 0x80, 0x60, 0x30, 0x61, 0x9D, 0x85, + 0xA4, 0x84, 0xA2, 0xDA, 0xAB, 0x46, 0x00, 0x67, 0x00, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x01, 0x67, + 0x20, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x00, 0x64, 0x40, 0x41, 0x4A, 0x64, 0xA0, 0xD2, 0xFF, 0xFF, + 0x40, 0x42, 0x80, 0x2B, 0x04, 0x00, 0xFF, 0xB4, 0x40, 0x42, 0x01, 0x64, 0x40, 0x41, 0x87, 0xF3, + 0x46, 0x4B, 0x86, 0xF3, 0x60, 0x46, 0xE0, 0x83, 0xAB, 0x46, 0x32, 0xF0, 0xAB, 0x46, 0x59, 0xF8, + 0xAB, 0x46, 0x33, 0xF0, 0xAB, 0x46, 0x5A, 0xF8, 0xAB, 0x46, 0x34, 0xF0, 0xAB, 0x46, 0x5B, 0xF8, + 0x66, 0x44, 0x02, 0xA6, 0xF1, 0x1F, 0x87, 0xF3, 0xFF, 0xFF, 0x60, 0x46, 0xAB, 0x46, 0x0C, 0x60, + 0x3A, 0x65, 0x22, 0x44, 0xFF, 0xB4, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x81, + 0xC9, 0x81, 0x4A, 0x64, 0x0E, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x21, 0x44, 0x01, 0x2A, + 0x08, 0x00, 0xAB, 0x46, 0xF0, 0xA1, 0x76, 0x64, 0x0E, 0x63, 0x59, 0xD1, 0x58, 0xD8, 0xFD, 0x1F, + 0xAB, 0x46, 0x22, 0x44, 0xFF, 0xB4, 0xE0, 0x84, 0xE0, 0x85, 0xC4, 0x84, 0x0C, 0x60, 0x82, 0x65, + 0xC4, 0x81, 0x5A, 0x64, 0x04, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0xAB, 0x46, 0x21, 0x44, + 0x01, 0x2A, 0x06, 0x00, 0xFA, 0xA1, 0x90, 0x64, 0x04, 0x63, 0x59, 0xD1, 0x58, 0xD8, 0xFD, 0x1F, + 0x3B, 0xF0, 0x21, 0x44, 0x01, 0x2A, 0x13, 0x00, 0x22, 0x44, 0x3D, 0xFB, 0x60, 0x41, 0x02, 0xFE, + 0xF8, 0x84, 0xF8, 0x84, 0xF8, 0x84, 0x3C, 0xFB, 0x0C, 0x60, 0x7E, 0x63, 0x88, 0xFF, 0xCD, 0x81, + 0x06, 0xA3, 0xFD, 0x0D, 0x8D, 0xFF, 0x3B, 0xFD, 0x64, 0x47, 0x80, 0xBF, 0x60, 0x5C, 0x22, 0x43, + 0x80, 0x61, 0x88, 0xFF, 0xCF, 0x83, 0xE1, 0x81, 0xFD, 0x0D, 0x8D, 0xFF, 0x61, 0x47, 0x31, 0x91, + 0xB1, 0x84, 0x3B, 0xFA, 0x86, 0xF3, 0xFF, 0xFF, 0xCC, 0x83, 0xE3, 0x83, 0x66, 0x44, 0x02, 0xA6, + 0x3B, 0xF0, 0x66, 0x44, 0xB1, 0x9C, 0x3B, 0xF8, 0x02, 0xA6, 0xFA, 0x1F, 0xAB, 0x46, 0x00, 0x67, + 0x00, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, 0x25, 0xF0, 0x02, 0xA8, 0x00, 0x67, 0x24, 0x02, + 0x3D, 0xF1, 0x64, 0x44, 0x03, 0xB4, 0x40, 0x42, 0xD0, 0x80, 0x87, 0xF3, 0xFF, 0xFF, 0x60, 0x46, + 0xBB, 0xF4, 0x80, 0x61, 0x02, 0x02, 0xE3, 0x83, 0xEB, 0x83, 0x22, 0x44, 0x88, 0xFF, 0xCC, 0x84, + 0xE1, 0x81, 0xFD, 0x0D, 0x8D, 0xFF, 0x61, 0x47, 0x31, 0x91, 0x9D, 0x85, 0xA7, 0x83, 0x3B, 0xFC, + 0x86, 0xF3, 0xFF, 0xFF, 0xCC, 0x83, 0xE3, 0x83, 0x66, 0x44, 0x02, 0xA6, 0xBB, 0xF2, 0x66, 0x44, + 0xA5, 0x81, 0xBB, 0xFA, 0x02, 0xA6, 0xFA, 0x1F, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x27, 0xF2, + 0x15, 0x60, 0x02, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, + 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x27, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, + 0x0C, 0x02, 0x61, 0x46, 0x26, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, + 0x25, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, + 0xE8, 0x1B, 0x87, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x01, 0x03, 0x21, 0x00, 0x43, 0x4B, + 0xAB, 0x46, 0x3B, 0xF2, 0x80, 0x60, 0x30, 0x7C, 0xB0, 0x84, 0xA2, 0xDA, 0x4E, 0x61, 0x76, 0x64, + 0x0E, 0x63, 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0x58, 0xD8, 0xFB, 0x1F, 0x90, 0x64, 0x04, 0x63, + 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0x58, 0xD8, 0xFB, 0x1F, 0xA0, 0x64, 0x04, 0x63, 0xAB, 0x46, + 0x59, 0xD0, 0xAB, 0x46, 0x58, 0xD8, 0xFB, 0x1F, 0x00, 0x67, 0x00, 0x61, 0x23, 0x58, 0xFF, 0xFF, + 0x01, 0x67, 0x20, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x27, 0xF2, 0x15, 0x60, 0x02, 0x65, 0x60, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, + 0x61, 0x46, 0x27, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x26, 0xF0, + 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x25, 0xF0, 0x63, 0x46, 0xD0, 0x80, + 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0x87, 0xF3, 0x08, 0xFE, + 0x60, 0x43, 0x61, 0x46, 0x01, 0x03, 0x0D, 0x00, 0x43, 0x4B, 0xAB, 0x46, 0x3B, 0xF2, 0x80, 0x60, + 0x30, 0x61, 0x9D, 0x85, 0xA4, 0x84, 0xA2, 0xDA, 0xAB, 0x46, 0x00, 0x67, 0x00, 0x61, 0x23, 0x58, + 0xFF, 0xFF, 0x01, 0x67, 0x20, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x3E, 0xF2, 0xAB, 0xF1, 0x08, 0xB0, + 0x19, 0xF8, 0x4A, 0x02, 0x07, 0x23, 0x2B, 0x00, 0x60, 0x47, 0x07, 0xB4, 0x88, 0xF1, 0xCC, 0x84, + 0xE0, 0x84, 0x40, 0x8A, 0xAA, 0x46, 0x03, 0xF2, 0x04, 0xF0, 0x05, 0xF2, 0x60, 0x43, 0xAA, 0x46, + 0x2C, 0xFC, 0x2D, 0xF8, 0x2E, 0xFA, 0xCB, 0xF1, 0x2F, 0xF8, 0xCC, 0xF1, 0x30, 0xF8, 0xCD, 0xF1, + 0x31, 0xF8, 0x46, 0x4A, 0x00, 0xF4, 0x02, 0xF2, 0x03, 0xF0, 0x04, 0xF2, 0x60, 0x43, 0xAA, 0x46, + 0x32, 0xFC, 0x33, 0xF8, 0x34, 0xFA, 0xAA, 0x46, 0x05, 0xF2, 0x06, 0xF0, 0x07, 0xF2, 0x60, 0x43, + 0xAA, 0x46, 0x36, 0xFC, 0x37, 0xF8, 0x38, 0xFA, 0x03, 0x60, 0x08, 0x64, 0x1C, 0x00, 0x66, 0xF1, + 0x2F, 0xF8, 0x67, 0xF1, 0x30, 0xF8, 0x68, 0xF1, 0x31, 0xF8, 0x46, 0x4A, 0x00, 0xF4, 0x02, 0xF2, + 0x03, 0xF0, 0x04, 0xF2, 0x60, 0x43, 0xAA, 0x46, 0x2C, 0xFC, 0x2D, 0xF8, 0x2E, 0xFA, 0xAA, 0x46, + 0x05, 0xF2, 0x06, 0xF0, 0x07, 0xF2, 0x60, 0x43, 0xAA, 0x46, 0x32, 0xFC, 0x33, 0xF8, 0x34, 0xFA, + 0x02, 0x60, 0x08, 0x64, 0x00, 0x00, 0x2A, 0xFA, 0x02, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x42, 0x6F, + 0x6F, 0x74, 0x63, 0x6F, 0x64, 0x65, 0x20, 0x21, 0x21, 0x20, 0x20, 0x00, 0x53, 0x54, 0x41, 0x2F, + 0x41, 0x50, 0x20, 0x46, 0x75, 0x6E, 0x63, 0x27, 0x73, 0x00, 0x20, 0x00, 0x03, 0x00, 0x01, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x08, 0x00, 0x04, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x04, 0x00, 0x06, 0x00, 0x07, 0x00, 0x05, 0x00, 0x06, 0x00, 0x07, 0x00, 0x06, 0x00, 0x06, 0x00, + 0x07, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x00, 0x00, + +}; /* fw_image_4_data */ + +static const CFG_IDENTITY_STRCT fw_image_infoidentity[] = { + { + sizeof( CFG_IDENTITY_STRCT ) / sizeof(hcf_16) - 1, + CFG_FW_IDENTITY, + COMP_ID_FW_AP, + 3, //Variant + 1, //Major + 24 //Minor + }, + { 0000, 0000, 0000, 0000, 0000, 0000 } //endsentinel +}; + +static const CFG_PROG_STRCT fw_image_code[] = { + { + 8, + CFG_PROG, + CFG_PROG_VOLATILE, // mode + 0x0148, // sizeof(fw_image_1_data), + 0x00000060, // Target address in NIC Memory + 0x0000, // CRC: yes/no TYPE: primary/station/tertiary + (hcf_8 FAR *) fw_image_1_data + }, + { + 8, + CFG_PROG, + CFG_PROG_VOLATILE, // mode + 0x2432, // sizeof(fw_image_2_data), + 0x00000C16, // Target address in NIC Memory + 0x0000, // CRC: yes/no TYPE: primary/station/tertiary + (hcf_8 FAR *) fw_image_2_data + }, + { + 8, + CFG_PROG, + CFG_PROG_VOLATILE, // mode + 0x194c, // sizeof(fw_image_3_data), + 0x001E3048, // Target address in NIC Memory + 0x0000, // CRC: yes/no TYPE: primary/station/tertiary + (hcf_8 FAR *) fw_image_3_data + }, + { + 8, + CFG_PROG, + CFG_PROG_VOLATILE, // mode + 0xb7e4, // sizeof(fw_image_4_data), + 0x001F4000, // Target address in NIC Memory + 0x0000, // CRC: yes/no TYPE: primary/station/tertiary + (hcf_8 FAR *) fw_image_4_data + }, + { + 5, + CFG_PROG, + CFG_PROG_STOP, // mode + 0000, + 0x000F2101, // Start execution address + }, + { 0000, 0000, 0000, 0000, 00000000, 0000, 00000000} +}; + +static const CFG_RANGE20_STRCT fw_image_infocompat[] = { + { 3 + ((20 * sizeof(CFG_RANGE_SPEC_STRCT)) / sizeof(hcf_16)), + CFG_FW_SUP_RANGE, + COMP_ROLE_SUPL, + COMP_ID_APF, + { + { 4, 1, 1 } //variant, bottom, top + } + }, + { 3 + ((20 * sizeof(CFG_RANGE_SPEC_STRCT)) / sizeof(hcf_16)), + CFG_MFI_ACT_RANGES_STA, + COMP_ROLE_ACT, + COMP_ID_MFI, + { + { 7, 3, 3 }, //variant, bottom, top + { 8, 1, 1 } //variant, bottom, top + } + }, + { 3 + ((20 * sizeof(CFG_RANGE_SPEC_STRCT)) / sizeof(hcf_16)), + CFG_CFI_ACT_RANGES_STA, + COMP_ROLE_ACT, + COMP_ID_CFI, + { + { 4, 1, 2 } //variant, bottom, top + } + }, + { 0000, 0000, 0000, 0000, { { 0000, 0000, 0000 } } } //endsentinel +}; + +memimage fw_image = { + "FUPU7D37dhfwci\001C", //signature, , C/Bin type + (CFG_PROG_STRCT *) fw_image_code, + 0x000F2101, + 00000000, //(dummy) pdaplug + 00000000, //(dummy) priplug + (CFG_RANGE20_STRCT *) fw_image_infocompat, + (CFG_IDENTITY_STRCT *) fw_image_infoidentity, +}; + diff --git a/drivers/staging/wlags49_h2/debug.h b/drivers/staging/wlags49_h2/debug.h new file mode 100644 index 000000000000..d3db6266f6e3 --- /dev/null +++ b/drivers/staging/wlags49_h2/debug.h @@ -0,0 +1,229 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * This file contains definitions and macros for debugging. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/07/20 09:29:45 $ + * $Revision: 1.3 $ + * $Source: /usr/local/cvs/wl_lkm/include/hcf/debug.h,v $ + * + ******************************************************************************/ + + + + +#ifndef _DEBUG_H +#define _DEBUG_H + + + + +/* Turn on debugging here if not done with a preprocessor define */ +#ifndef DBG +#define DBG 0 +#else +#undef DBG +#define DBG 1 +#endif //DBG + + + + +#if DBG +/****************************************************************************/ + +/* Set the level of debugging if not done with a preprocessor define. See + wl_main.c, init_module() for how the debug level translates into the + the types of messages displayed */ +#ifndef DBG_LVL +#define DBG_LVL 5 /* yields nothing via init_module, + original value of 5 yields DBG_TRACE_ON and DBG_VERBOSE_ON */ +#endif // DBG_LVL + + +#define DBG_ERROR_ON 0x00000001L +#define DBG_WARNING_ON 0x00000002L +#define DBG_NOTICE_ON 0x00000004L +#define DBG_TRACE_ON 0x00000008L +#define DBG_VERBOSE_ON 0x00000010L +#define DBG_PARAM_ON 0x00000020L +#define DBG_BREAK_ON 0x00000040L +#define DBG_RX_ON 0x00000100L +#define DBG_TX_ON 0x00000200L +#define DBG_DS_ON 0x00000400L + +#define DBG_DEFAULTS (DBG_ERROR_ON | DBG_WARNING_ON | DBG_BREAK_ON) + +#define DBG_FLAGS(A) (A)->DebugFlag +#define DBG_NAME(A) (A)->dbgName +#define DBG_LEVEL(A) (A)->dbgLevel + + +#ifndef PRINTK +# define PRINTK(S...) printk(S) +#endif // PRINTK + + +#ifndef DBG_PRINT +# define DBG_PRINT(S...) PRINTK(KERN_DEBUG S) +#endif // DBG_PRINT + + +#ifndef DBG_PRINTC +# define DBG_PRINTC(S...) PRINTK(S) +#endif // DBG_PRINTC + + +#ifndef DBG_TRAP +# define DBG_TRAP {} +#endif // DBG_TRAP + + +#define _ENTER_STR ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" +#define _LEAVE_STR "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" + + +#define _DBG_ENTER(A) DBG_PRINT("%s:%.*s:%s\n",DBG_NAME(A),++DBG_LEVEL(A),_ENTER_STR,__FUNC__) +#define _DBG_LEAVE(A) DBG_PRINT("%s:%.*s:%s\n",DBG_NAME(A),DBG_LEVEL(A)--,_LEAVE_STR,__FUNC__) + + +#define DBG_FUNC(F) static const char *__FUNC__ = F; + +#define DBG_ENTER(A) {if (DBG_FLAGS(A) & DBG_TRACE_ON) _DBG_ENTER(A);} + +#define DBG_LEAVE(A) {if (DBG_FLAGS(A) & DBG_TRACE_ON) _DBG_LEAVE(A);} + +#define DBG_PARAM(A,N,F,S...) {if (DBG_FLAGS(A) & DBG_PARAM_ON) \ + DBG_PRINT(" %s -- "F"\n",N,S);} + + +#define DBG_ERROR(A,S...) {if (DBG_FLAGS(A) & DBG_ERROR_ON) \ + {DBG_PRINT("%s:ERROR:%s ",DBG_NAME(A),__FUNC__);DBG_PRINTC(S);DBG_TRAP;}} + + +#define DBG_WARNING(A,S...) {if (DBG_FLAGS(A) & DBG_WARNING_ON) \ + {DBG_PRINT("%s:WARNING:%s ",DBG_NAME(A),__FUNC__);DBG_PRINTC(S);}} + + +#define DBG_NOTICE(A,S...) {if (DBG_FLAGS(A) & DBG_NOTICE_ON) \ + {DBG_PRINT("%s:NOTICE:%s ",DBG_NAME(A),__FUNC__);DBG_PRINTC(S);}} + + +#define DBG_TRACE(A,S...) do {if (DBG_FLAGS(A) & DBG_TRACE_ON) \ + {DBG_PRINT("%s:%s ",DBG_NAME(A),__FUNC__);DBG_PRINTC(S);}} while (0) + + +#define DBG_RX(A,S...) {if (DBG_FLAGS(A) & DBG_RX_ON) \ + {DBG_PRINT(S);}} + + +#define DBG_TX(A,S...) {if (DBG_FLAGS(A) & DBG_TX_ON) \ + {DBG_PRINT(S);}} + +#define DBG_DS(A,S...) {if (DBG_FLAGS(A) & DBG_DS_ON) \ + {DBG_PRINT(S);}} + + +#define DBG_ASSERT(C) {if (!(C)) \ + {DBG_PRINT("ASSERT(%s) -- %s#%d (%s)\n", \ + #C,__FILE__,__LINE__,__FUNC__); \ + DBG_TRAP;}} + +typedef struct { + char *dbgName; + int dbgLevel; + unsigned long DebugFlag; +} dbg_info_t; + + +/****************************************************************************/ +#else // DBG +/****************************************************************************/ + +#define DBG_DEFN +#define DBG_TRAP +#define DBG_FUNC(F) +#define DBG_PRINT(S...) +#define DBG_ENTER(A) +#define DBG_LEAVE(A) +#define DBG_PARAM(A,N,F,S...) +#define DBG_ERROR(A,S...) +#define DBG_WARNING(A,S...) +#define DBG_NOTICE(A,S...) +#define DBG_TRACE(A,S...) +#define DBG_RX(A,S...) +#define DBG_TX(A,S...) +#define DBG_DS(A,S...) +#define DBG_ASSERT(C) + +#endif // DBG +/****************************************************************************/ + + + + +#endif // _DEBUG_H + diff --git a/drivers/staging/wlags49_h2/dhf.c b/drivers/staging/wlags49_h2/dhf.c new file mode 100644 index 000000000000..b6f5834b1aff --- /dev/null +++ b/drivers/staging/wlags49_h2/dhf.c @@ -0,0 +1,390 @@ + +// vim:tw=110:ts=4: +/************************************************************************************************************** +* +* FILE : DHF.C +* +* DATE : $Date: 2004/07/19 08:16:14 $ $Revision: 1.2 $ +* Original : 2004/05/28 14:05:34 Revision: 1.36 Tag: hcf7_t20040602_01 +* Original : 2004/05/11 06:22:57 Revision: 1.32 Tag: hcf7_t7_20040513_01 +* Original : 2004/04/15 09:24:42 Revision: 1.28 Tag: hcf7_t7_20040415_01 +* Original : 2004/04/08 15:18:16 Revision: 1.27 Tag: t7_20040413_01 +* Original : 2004/04/01 15:32:55 Revision: 1.25 Tag: t7_20040401_01 +* Original : 2004/03/10 15:39:28 Revision: 1.21 Tag: t20040310_01 +* Original : 2004/03/04 11:03:37 Revision: 1.19 Tag: t20040304_01 +* Original : 2004/03/02 09:27:11 Revision: 1.17 Tag: t20040302_03 +* Original : 2004/02/24 13:00:28 Revision: 1.15 Tag: t20040224_01 +* Original : 2004/02/19 10:57:28 Revision: 1.14 Tag: t20040219_01 +* Original : 2003/11/27 09:00:09 Revision: 1.3 Tag: t20021216_01 +* +* AUTHOR : John Meertens +* Nico Valster +* +* SPECIFICATION: ........ +* +* DESC : generic functions to handle the download of NIC firmware +* Local Support Routines for above procedures +* +* Customizable via HCFCFG.H, which is included by HCF.H +* +* +* DHF is (intended to be) platform-independent. +* DHF is a module that provides a number of routines to download firmware +* images (the names primary, station, access point, secondary and tertiary +* are used or have been used) to volatile or nonvolatile memory +* in WaveLAN/IEEE NICs. To achieve this DHF makes use of the WaveLAN/IEEE +* WCI as implemented by the HCF-module. +* +* Download to non-volatile memory is used to update a WaveLAN/IEEE NIC to new +* firmware. Normally this will be an upgrade to newer firmware, although +* downgrading to older firmware is possible too. +* +* Note: relative to Asserts, the following can be observed: +* Since the IFB is not known inside the routine, the macro HCFASSERT is replaced with MMDASSERT. +* Also the line number reported in the assert is raised by FILE_NAME_OFFSET (10000) to discriminate the +* DHF Asserts from HCF and MMD asserts. +* +*************************************************************************************************************** +* +* +* SOFTWARE LICENSE +* +* This software is provided subject to the following terms and conditions, +* which you should read carefully before using the software. Using this +* software indicates your acceptance of these terms and conditions. If you do +* not agree with these terms and conditions, do not use the software. +* +* COPYRIGHT © 1999 - 2000 by Lucent Technologies. All Rights Reserved +* COPYRIGHT © 2001 - 2004 by Agere Systems Inc. All Rights Reserved +* All rights reserved. +* +* Redistribution and use in source or binary forms, with or without +* modifications, are permitted provided that the following conditions are met: +* +* . Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following Disclaimer as comments in the code as +* well as in the documentation and/or other materials provided with the +* distribution. +* +* . Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following Disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* . Neither the name of Agere Systems Inc. nor the names of the contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* Disclaimer +* +* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY +* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN +* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +* DAMAGE. +* +* +**************************************************************************************************************/ + +#include "hcf.h" +#include "hcfdef.h" +#include "dhf.h" +#include "mmd.h" + +//to distinguish MMD from HCF asserts by means of line number +#undef FILE_NAME_OFFSET +#define FILE_NAME_OFFSET MMD_FILE_NAME_OFFSET +/*----------------------------------------------------------------------------- + * + * Defines, data structures, and global variables + * + *---------------------------------------------------------------------------*/ + +// 12345678901234 +char signature[14] = "FUPU7D37dhfwci"; + +//The binary download function "relocates" the image using constructions like: +// fw->identity = (CFG_IDENTITY_STRCT FAR *)((char FAR *)fw->identity + (hcf_32)fw ); +//under some of the memory models under MSVC 1.52 these constructions degrade to 16-bits pointer arithmetic. +//fw->identity is limited, such that adding it to fw, does not need to carry over from offset to segment. +//However the segment is not set at all. +//As a workaround the PSEUDO_CHARP macro is introduced which is a char pointer except for MSVC 1.52, in +//which case we know that a 32-bit quantity is adequate as a pointer. +//Note that other platforms may experience comparable problems when using the binary download feature. +#if defined(_MSC_VER) && _MSC_VER == 800 // Visual C++ 1.5 +#define PSEUDO_CHARP hcf_32 +#else +#define PSEUDO_CHARP hcf_8* +#endif + +/*----------------------------------------------------------------------------- + * + * LTV-records retrieved from the NIC to: + * - determine compatibility between NIC and image + * - ((setup the buffer size dynamically for non-volatile download (see note below) )) + * - supply plugging information contained in the PDA (H-I only) + * + *---------------------------------------------------------------------------*/ + +// for USB/H1 we needed a smaller value than the CFG_DL_BUF_STRCT reported 8192 +// for the time being it seems simpler to always use 2000 for USB/H1 as well as all other cases rather than +// using the "fixed anyway" CFG_DL_BUF_STRCT. +#define DL_SIZE 2000 + +//CFG_IDENTITY_STRCT pri_identity = { LOF(CFG_IDENTITY_STRCT), CFG_PRI_IDENTITY }; +CFG_SUP_RANGE_STRCT mfi_sup = { LOF(CFG_SUP_RANGE_STRCT), CFG_NIC_MFI_SUP_RANGE }; +CFG_SUP_RANGE_STRCT cfi_sup = { LOF(CFG_SUP_RANGE_STRCT), CFG_NIC_CFI_SUP_RANGE }; +/* Note: could be used rather than the above explained and defined DL_SIZE if need arises + * CFG_DL_BUF_STRCT dl_buf = { LOF(CFG_DL_BUF_STRCT), CFG_DL_BUF }; +*/ + +/*----------------------------------------------------------------------------- + * Array ltv_info stores NIC information (in the form of LTV-records) + * needed for download. A NULL record indicates the end of the array. + *---------------------------------------------------------------------------*/ + +/* The LTV_INFO_STRUCT is needed to save the sizes of the structs, because after a GET_INFO() + * the len field is changed to the real len of the RID by the called routine. + * This is only relevant if the DHF used without reloading the driver/utility. + */ + +LTV_INFO_STRUCT ltv_info[] = { + { (LTVP)&mfi_sup, LOF(CFG_SUP_RANGE_STRCT) } , + { (LTVP)&cfi_sup, LOF(CFG_SUP_RANGE_STRCT) } , + { (LTVP) NULL, 0 } +}; + + +/***********************************************************************************************************/ +/*************************************** PROTOTYPES ******************************************************/ +/***********************************************************************************************************/ +static int check_comp_fw( memimage *fw ); + + +/************************************************************************************************************ +*.SUBMODULE int check_comp_fw( memimage *fw ) +*.PURPOSE Checks compatibility of CFI and MFI, NIC as supplier, station/AP firmware image as supplier. +* +*.ARGUMENTS +* fw F/W image to be downloaded +* +*.RETURNS +* HFC_SUCCESS - firmware OK +* DHF_ERR_INCOMP_FW +* +*.DESCRIPTION +* This function uses compatibility and identity information that has been +* retrieved from the card which is currently inserted to check whether the +* station firmware image to be downloaded is compatible. +*.ENDDOC END DOCUMENTATION +*************************************************************************************************************/ +int +check_comp_fw( memimage *fw ) +{ +CFG_RANGE20_STRCT *p; +int rc = HCF_SUCCESS; +CFG_RANGE_SPEC_STRCT* i; + + switch( fw->identity->typ ) { + case CFG_FW_IDENTITY: //Station F/W + case COMP_ID_FW_AP_FAKE: //;?is this useful (used to be: CFG_AP_IDENTITY) + break; + default: + MMDASSERT( DO_ASSERT, fw->identity->typ ) //unknown/unsupported firmware_type: + rc = DHF_ERR_INCOMP_FW; + return rc; /* ;? how useful is this anyway, + * till that is sorted out might as well violate my own single exit principle + */ + } + p = fw->compat; + i = NULL; + while( p->len && i == NULL ) { // check the MFI ranges + if ( p->typ == CFG_MFI_ACT_RANGES_STA ) { + i = mmd_check_comp( (void*)p, &mfi_sup ); + } + p++; + } + MMDASSERT( i, 0 ) //MFI: NIC Supplier not compatible with F/W image Actor + if ( i ) { + p = fw->compat; + i = NULL; + while ( p->len && i == NULL ) { // check the CFI ranges + if ( p->typ == CFG_CFI_ACT_RANGES_STA ) { + i = mmd_check_comp( (void*)p, &cfi_sup ); + } + p++; + } + MMDASSERT( i, 0 ) //CFI: NIC Supplier not compatible with F/W image Actor + } + if ( i == NULL ) { + rc = DHF_ERR_INCOMP_FW; + } + return rc; +} // check_comp_fw + + + + + +/*----------------------------------------------------------------------------- + * + * Exported functions + * + *---------------------------------------------------------------------------*/ + + + +/************************************************************************************************************* +* +*.MODULE int dhf_download_binary( void *ifbp, memimage *fw ) +*.PURPOSE Downloads a complete (primary, station, or access point) firmware image to the NIC. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* fw F/W image to be downloaded +* +*.RETURNS +* HCF_SUCCESS - download completed successfully. +* DHF_ERR_INCOMP_FW - firmware not compatible +* +*.DESCRIPTION +* Initialize global variables +* Connect to the DHF +* Check the compatibility of the image (For primary firmware images it is checked first +* whether download is necessary). +* If everything's download the firmware. +* Disconnect from the DHF. +* +* +*.DIAGRAM +* +*.NOTICE: + MMDASSERT is unacceptable because some drivers call dhf_download_binary before hcf_connect + +* The old comment was: +*.ENDDOC END DOCUMENTATION +*************************************************************************************************************/ +int +dhf_download_binary( memimage *fw ) +{ +int rc = HCF_SUCCESS; +CFG_PROG_STRCT *p; +int i; + + //validate the image + for ( i = 0; i < sizeof(signature) && fw->signature[i] == signature[i]; i++ ) /*NOP*/; + if ( i != sizeof(signature) || + fw->signature[i] != 0x01 || + //test for Little/Big Endian Binary flag + fw->signature[i+1] != ( /*HCF_BIG_ENDIAN ? 'B' : */ 'L' ) ) rc = DHF_ERR_INCOMP_FW; + else { //Little Endian Binary format + fw->codep = (CFG_PROG_STRCT FAR *)((PSEUDO_CHARP)fw->codep + (hcf_32)fw ); + fw->identity = (CFG_IDENTITY_STRCT FAR *)((PSEUDO_CHARP)fw->identity + (hcf_32)fw ); + fw->compat = (CFG_RANGE20_STRCT FAR *)((PSEUDO_CHARP)fw->compat + (hcf_32)fw ); + for ( i = 0; fw->p[i]; i++ ) fw->p[i] = ((PSEUDO_CHARP)fw->p[i] + (hcf_32)fw ); + p = fw->codep; + while ( p->len ) { + p->host_addr = (PSEUDO_CHARP)p->host_addr + (hcf_32)fw; + p++; + } + } + return rc; +} // dhf_download_binary + + +/************************************************************************************************************* +* +*.MODULE int dhf_download_fw( void *ifbp, memimage *fw ) +*.PURPOSE Downloads a complete (primary or tertiary) firmware image to the NIC. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* fw F/W image to be downloaded +* +*.RETURNS +* HCF_SUCCESS - download completed successfully. +* HCF_ERR_NO_NIC - no NIC present +* DHF_ERR_INCOMP_FW - firmware not compatible +* +*.DESCRIPTION +* - check the signature of the image +* - get the compatibility information from the components on the NIC +* - Primary Firmware Identity +* - Modem - Firmware I/F +* - Controller - Firmware I/F +*!! - if necessary ( i.e. H-I) get the PDA contents from the NIC +* - check the compatibility of the MFI and CFI of the NIC with the F/W image +* Note: the Primary F/W compatibility is only relevant for the "running" HCF and is already verified in +* hcf_connect +*!! - if necessary ( i.e. H-I) +*!! - verify the sumcheck of the PDA +*!! - plug the image (based on the PDA and the default plug records) +* - loop over all the download LTVs in the image which consists of a sequence of +* - CFG_PROG_VOLATILE/CFG_PROG_NON_VOLATILE +* - 1 or more sequences of CFG_PROG_ADDR, CFG_PROG_DATA,....,CFG_PROG_DATA +* - CFG_PROG_STOP +* +*.DIAGRAM +* +*.NOTICE +* The old comment was: +* // Download primary firmware if necessary and allowed. This is done silently (without telling +* // the user) and only if the firmware in the download image is newer than the firmware in the +* // card. In Major version 4 of the primary firmware functions of Hermes and Shark were +* // combined. Prior to that two separate versions existed. We only have to download primary +* // firmware if major version of primary firmware in the NIC < 4. +* // download = pri_identity.version_major < 4; +* // if ( download ) { +* // rc = check_comp_primary( fw ); +* // } +* It is my understanding that Pri Variant 1 must be updated by Pri Variant 2. The test on +* major version < 4 should amount to the same result but be "principally" less correct +* In deliberation with the Architecture team, it was decided that this upgrade for old H-I +* NICs, is an aspect which belongs on the WSU level not on the DHF level +* +*.ENDDOC END DOCUMENTATION +*************************************************************************************************************/ +int +dhf_download_fw( void *ifbp, memimage *fw ) +{ +int rc = HCF_SUCCESS; +LTV_INFO_STRUCT_PTR pp = ltv_info; +CFG_PROG_STRCT *p = fw->codep; +LTVP ltvp; +int i; + + MMDASSERT( fw != NULL, 0 ) + //validate the image + for ( i = 0; i < sizeof(signature) && fw->signature[i] == signature[i]; i++ ) /*NOP*/; + if ( i != sizeof(signature) || + fw->signature[i] != 0x01 || + //check for binary image + ( fw->signature[i+1] != 'C' && fw->signature[i+1] != ( /*HCF_BIG_ENDIAN ? 'B' : */ 'L' ) ) ) + rc = DHF_ERR_INCOMP_FW; + +// Retrieve all information needed for download from the NIC + while ( ( rc == HCF_SUCCESS ) && ( ( ltvp = pp->ltvp) != NULL ) ) { + ltvp->len = pp++->len; // Set len to original len. This len is changed to real len by GET_INFO() + rc = GET_INFO( ltvp ); + MMDASSERT( rc == HCF_SUCCESS, rc ) + MMDASSERT( rc == HCF_SUCCESS, ltvp->typ ) + MMDASSERT( rc == HCF_SUCCESS, ltvp->len ) + } + if ( rc == HCF_SUCCESS ) rc = check_comp_fw( fw ); + if ( rc == HCF_SUCCESS ) { + while ( rc == HCF_SUCCESS && p->len ) { + rc = PUT_INFO( p ); + p++; + } + } + MMDASSERT( rc == HCF_SUCCESS, rc ) + return rc; +} // dhf_download_fw + + diff --git a/drivers/staging/wlags49_h2/dhf.h b/drivers/staging/wlags49_h2/dhf.h new file mode 100644 index 000000000000..c071f342a655 --- /dev/null +++ b/drivers/staging/wlags49_h2/dhf.h @@ -0,0 +1,226 @@ + +// vim:tw=110:ts=4: +#ifndef DHF_H +#define DHF_H + +/************************************************************************************************************** +* +* FILE : DHF.H +* +* DATE : $Date: 2004/07/19 08:16:14 $ $Revision: 1.2 $ +* Original : 2004/05/17 07:33:13 Revision: 1.25 Tag: hcf7_t20040602_01 +* Original : 2004/05/11 06:03:14 Revision: 1.24 Tag: hcf7_t7_20040513_01 +* Original : 2004/04/15 09:24:42 Revision: 1.22 Tag: hcf7_t7_20040415_01 +* Original : 2004/04/09 14:35:52 Revision: 1.21 Tag: t7_20040413_01 +* Original : 2004/04/01 15:32:55 Revision: 1.18 Tag: t7_20040401_01 +* Original : 2004/03/10 15:39:28 Revision: 1.15 Tag: t20040310_01 +* Original : 2004/03/04 11:03:38 Revision: 1.13 Tag: t20040304_01 +* Original : 2004/02/25 14:14:37 Revision: 1.11 Tag: t20040302_03 +* Original : 2004/02/24 13:00:28 Revision: 1.10 Tag: t20040224_01 +* Original : 2004/02/19 10:57:28 Revision: 1.8 Tag: t20040219_01 +* +* AUTHOR : John Meertens +* Nico Valster +* +* SPECIFICATION: ......... +* +* DESC : structure definitions and function prototypes for unit DHF. +* +* Customizable via HCFCFG.H, which is included indirectly via HCF.H +* +*************************************************************************************************************** +* +* +* SOFTWARE LICENSE +* +* This software is provided subject to the following terms and conditions, +* which you should read carefully before using the software. Using this +* software indicates your acceptance of these terms and conditions. If you do +* not agree with these terms and conditions, do not use the software. +* +* COPYRIGHT © 1994 - 1995 by AT&T. All Rights Reserved +* COPYRIGHT © 1999 - 2000 by Lucent Technologies. All Rights Reserved +* COPYRIGHT © 2001 - 2004 by Agere Systems Inc. All Rights Reserved +* All rights reserved. +* +* Redistribution and use in source or binary forms, with or without +* modifications, are permitted provided that the following conditions are met: +* +* . Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following Disclaimer as comments in the code as +* well as in the documentation and/or other materials provided with the +* distribution. +* +* . Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following Disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* . Neither the name of Agere Systems Inc. nor the names of the contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* Disclaimer +* +* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY +* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN +* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +* DAMAGE. +* +* +**************************************************************************************************************/ + + +#ifdef _WIN32_WCE +#include +#endif + +#include "hcf.h" // includes HCFCFG.H too + +#ifdef DHF_UIL +#define GET_INFO( pp ) uil_get_info( (LTVP)pp ) +#define PUT_INFO( pp ) uil_put_info( (LTVP)pp ) +#else +#define GET_INFO( pp ) hcf_get_info( ifbp, (LTVP)pp ) +#define PUT_INFO( pp ) hcf_put_info( ifbp, (LTVP)pp ) +#endif + + +/*---- Defines --------------------------------------------------------------*/ +#define CODEMASK 0x0000FFFFL // Codemask for plug records + +/*---- Error numbers --------------------------------------------------------*/ + +#define DHF_ERR_INCOMP_FW 0x40 //Image not compatible with NIC + +/*---- Type definitions -----------------------------------------------------*/ +//* needed by dhf_wrap.c +// +typedef struct { + LTVP ltvp; + hcf_16 len; +} LTV_INFO_STRUCT , *LTV_INFO_STRUCT_PTR; + + +/* + * Type: plugrecord + * + * Abstract: This structure represents a Plug Data Record. + * + * Description: + * This structure is used to overlay the plug records in the firmware memory image. + */ + +typedef struct { + hcf_32 code; // Code to plug + hcf_32 addr; // Address within the memory image to plug it in + hcf_32 len; // The # of bytes which are available to store it +} plugrecord; + +/* + * Type: stringrecord + * + * Abstract: This structure represents a Firmware debug/assert string + * + * Description: + * This structure is used to get assert and debug outputs in the driver and/or utility to be + * able to get more visability of the FW. + */ + +#define MAX_DEBUGSTRINGS 1024 +#define MAX_DEBUGSTRING_LEN 82 + +typedef struct { + hcf_32 id; + char str[MAX_DEBUGSTRING_LEN]; +} stringrecord; + +/* + * Type: exportrecord + * + * Abstract: This structure represents a Firmware export of a variable + * + * Description: + * This structure is used to get the address and name of a FW variable. + */ + +#define MAX_DEBUGEXPORTS 2048 +#define MAX_DEBUGEXPORT_LEN 12 + +typedef struct { + hcf_32 id; + char str[MAX_DEBUGEXPORT_LEN]; +} exportrecord; + +// Offsets in memimage array p[] +#define FWSTRINGS_FUNCTION 0 +#define FWEXPORTS_FUNCTION 1 + +/* + * Type: memimage + * + * Abstract: The "root" description of a complete memory image + * + * Description: + * This type represents an entire memory image. The image is built up of several + * segments. These segments need not be contiguous areas in memory, in other words + * the image may contain 'holes'. + * + * The 'codep' field points to an array of segment_descriptor structures. + * The end of the array is indicated by a segment_descriptor of which all fields are zero. + * The 'execution' field is a 32-bit address representing the execution address + * of the firmware within the memory image. This address is zero in case of non-volatile + * memory download. + * The 'compat' field points to an array of TODO + * The end of the array is indicated by a plug record of which all fields are zero. + * The 'identity' field points to an array of TODO + * The end of the array is indicated by a plug record of which all fields are zero. + * The Hermes-I specific 'pdaplug' field points to an array of Production Data Plug record structures. + * The end of the array is indicated by a plug record of which all fields are zero. + * The Hermes-I specific 'priplug' field points to an array of Primary Information Plug record structures. + * The end of the array is indicated by a plug record of which all fields are zero. + */ +typedef struct { + char signature[14+1+1]; // signature (see DHF.C) + C/LE-Bin/BE-Bin-flag + format version + CFG_PROG_STRCT FAR *codep; // + hcf_32 execution; // Execution address of the firmware + void FAR *place_holder_1; + void FAR *place_holder_2; + CFG_RANGE20_STRCT FAR *compat; // Pointer to the compatibility info records + CFG_IDENTITY_STRCT FAR *identity; // Pointer to the identity info records + void FAR *p[2]; /* (Up to 9) pointers for (future) expansion + * currently in use: + * - F/W printf information + */ +} memimage; + + + +/*----------------------------------------------------------------------------- + * + * DHF function prototypes + * + *---------------------------------------------------------------------------*/ + +EXTERN_C int dhf_download_fw( void *ifbp, memimage *fw ); // ifbp, ignored when using the UIL +EXTERN_C int dhf_download_binary( memimage *fw ); + + +/*----------------------------------------------------------------------------- + * + * Functions to be provided by the user of the DHF module. + * + *---------------------------------------------------------------------------*/ + +// defined in DHF.C; see there for comments +EXTERN_C hcf_16 *find_record_in_pda( hcf_16 *pdap, hcf_16 code ); + +#endif // DHF_H + diff --git a/drivers/staging/wlags49_h2/dhfcfg.h b/drivers/staging/wlags49_h2/dhfcfg.h new file mode 100644 index 000000000000..55bd90e422e8 --- /dev/null +++ b/drivers/staging/wlags49_h2/dhfcfg.h @@ -0,0 +1,175 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * This file contains DHF configuration info. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/07/19 07:08:33 $ + * $Revision: 1.1.1.1 $ + * $Source: /usr/local/cvs/wl_lkm/include/hcf/dhfcfg.h,v $ + * + ******************************************************************************/ + + + + +#ifndef DHFCFG_H +#define DHFCFG_H +/*----------------------------------------------------------------------------- + * File DHFCFG.H + * + * Contents: #defines for the DHF module + * + * Comments: + * Some combinations of the #defines in this file are illegal (as noted below). + * If an illegal combinations of #defines is specified a compile error is + * generated. See document DHFUG.DOC for more information. + * + * Author: John Meertens + * Date: 11-01-2000 + * + * Change history: + *---------------------------------------------------------------------------*/ + + +// Define DHF_WCI if you want to use the WCI to access the ORiNOCO card. +// Define DHF_UIL if you want to use the UIL to access the ORiNOCO card. +// You must define either DHF_WCI or DHF_UIL. If neither of the two is defined +// or both a compile error is generated. +#define DHF_WCI +//!!!#define DHF_UIL + +// Define DHF_BIG_ENDIAN if you are working on a big endian platform. +// Define DHF_LITTLE_ENDIAN if you are working on a little endian platform. +// You must define either DHF_BIG_ENDIAN or DHF_LITTLE_ENDIAN. If neither of +// the two is defined or both a compile error is generated. +#ifdef USE_BIG_ENDIAN +#define DHF_BIG_ENDIAN +#else +#define DHF_LITTLE_ENDIAN +#endif /* USE_BIG_ENDIAN */ + +// Define DHF_WIN if you are working on Windows platform. +// Define DHF_DOS if you are working on DOS. +// You must define either DHF_WIN or DHF_DOS. If neither of +// the two is defined or both a compile error is generated. +//!!!#define DHF_WIN +//!!!#define DHF_DOS + +// Define if you want the DHF to users. Not defining DHF_GET_RES_MSG +// leads to a decrease in code size as message strings are not included. +//!!!#define DHF_GET_RES_MSG + +// Linux driver specific +// Prevent inclusion of stdlib.h and string.h +#define _INC_STDLIB +#define _INC_STRING + +//----------------------------------------------------------------------------- +// Define one or more of the following DSF #defines if you want to implement +// the related DSF-function. Function dsf_callback must allways be implemented. +// See file DHF.H for prototypes of the functions. + +// Define DSF_ALLOC if you want to manage memory allocation and de-allocation +// for the DHF. If DSF_ALLOC is defined you must implement dsf_alloc and dsf_free. +//!!!#define DSF_ALLOC + +// Define DSF_CONFIRM if you want the DHF to ask the user for confirmation in a +// number of situations. If DSF_CONFIRM is defined you must implement dsf_confirm. +// Not defining DSF_CONFIRM leads to a decrease in code size as confirmation +// strings are not included. +//!!!#define DSF_CONFIRM + +// Define DSF_DEBUG_MESSAGE if you want debug messages added to your output. +// If you define DSF_DEBUG_MESSAGE then you must implement function +// dsf_debug_message. +//#define DSF_DEBUG_MESSAGE + +// Define DSF_ASSERT if you want asserts to be activated. +// If you define DSF_ASSERT then you must implement function dsf_assert. +//#define DBG 1 +//#define DSF_ASSERT + +// Define DSF_DBWIN if you want asserts and debug messages to be send to a debug +// window like SOFTICE or DebugView from SysInternals. +//!!!#define DSF_DBWIN +//!!! Not implemented yet! + +// Define DSF_VOLATILE_ONLY if you only wants to use valatile functions +// This is a typical setting for a AP and a driver. +#define DSF_VOLATILE_ONLY + +// Define DSF_HERMESII if you want to use the DHF for the Hermes-II +#ifdef HERMES2 +#define DSF_HERMESII +#else +#undef DSF_HERMESII +#endif // HERMES2 + +// Define DSF_BINARY_FILE if you want to use the DHF in combination with +// reading the Firmware from a separate binary file. +//!!!#define DSF_BINARY_FILE + +#endif // DHFCFG_H diff --git a/drivers/staging/wlags49_h2/hcf.c b/drivers/staging/wlags49_h2/hcf.c new file mode 100644 index 000000000000..6e39f5081e27 --- /dev/null +++ b/drivers/staging/wlags49_h2/hcf.c @@ -0,0 +1,4881 @@ +// vim:tw=110:ts=4: +/************************************************************************************************************ +* +* FILE : HCF.C +* +* DATE : $Date: 2004/08/05 11:47:10 $ $Revision: 1.10 $ +* Original: 2004/06/02 10:22:22 Revision: 1.85 Tag: hcf7_t20040602_01 +* Original: 2004/04/15 09:24:41 Revision: 1.63 Tag: hcf7_t7_20040415_01 +* Original: 2004/04/13 14:22:44 Revision: 1.62 Tag: t7_20040413_01 +* Original: 2004/04/01 15:32:55 Revision: 1.59 Tag: t7_20040401_01 +* Original: 2004/03/10 15:39:27 Revision: 1.55 Tag: t20040310_01 +* Original: 2004/03/04 11:03:37 Revision: 1.53 Tag: t20040304_01 +* Original: 2004/03/02 14:51:21 Revision: 1.50 Tag: t20040302_03 +* Original: 2004/02/24 13:00:27 Revision: 1.43 Tag: t20040224_01 +* Original: 2004/02/19 10:57:25 Revision: 1.39 Tag: t20040219_01 +* +* AUTHOR : Nico Valster +* +* SPECIFICATION: ........ +* +* DESCRIPTION : HCF Routines for Hermes-II (callable via the Wireless Connection I/F or WCI) +* Local Support Routines for above procedures +* +* Customizable via HCFCFG.H, which is included by HCF.H +* +************************************************************************************************************* +* +* +* SOFTWARE LICENSE +* +* This software is provided subject to the following terms and conditions, +* which you should read carefully before using the software. Using this +* software indicates your acceptance of these terms and conditions. If you do +* not agree with these terms and conditions, do not use the software. +* +* COPYRIGHT © 1994 - 1995 by AT&T. All Rights Reserved +* COPYRIGHT © 1996 - 2000 by Lucent Technologies. All Rights Reserved +* COPYRIGHT © 2001 - 2004 by Agere Systems Inc. All Rights Reserved +* All rights reserved. +* +* Redistribution and use in source or binary forms, with or without +* modifications, are permitted provided that the following conditions are met: +* +* . Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following Disclaimer as comments in the code as +* well as in the documentation and/or other materials provided with the +* distribution. +* +* . Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following Disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* . Neither the name of Agere Systems Inc. nor the names of the contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* Disclaimer +* +* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY +* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN +* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +* DAMAGE. +* +* +************************************************************************************************************/ + + +/************************************************************************************************************ +** +** Implementation Notes +** +* - a leading marker of //! is used. The purpose of such a sequence is to help to understand the flow +* An example is: //!rc = HCF_SUCCESS; +* if this is superfluous because rc is already guaranteed to be 0 but it shows to the (maintenance) +* programmer it is an intentional omission at the place where someone could consider it most appropriate at +* first glance +* - using near pointers in a model where ss!=ds is an invitation for disaster, so be aware of how you specify +* your model and how you define variables which are used at interrupt time +* - remember that sign extension on 32 bit platforms may cause problems unless code is carefully constructed, +* e.g. use "(hcf_16)~foo" rather than "~foo" +* +************************************************************************************************************/ + +#include "hcf.h" // HCF and MSF common include file +#include "hcfdef.h" // HCF specific include file +#include "mmd.h" // MoreModularDriver common include file + +#if ! defined offsetof +#define offsetof(s,m) ((unsigned int)&(((s *)0)->m)) +#endif // offsetof + + +/***********************************************************************************************************/ +/*************************************** PROTOTYPES ******************************************************/ +/***********************************************************************************************************/ +HCF_STATIC int cmd_exe( IFBP ifbp, hcf_16 cmd_code, hcf_16 par_0 ); +HCF_STATIC int init( IFBP ifbp ); +HCF_STATIC int put_info( IFBP ifbp, LTVP ltvp ); +#if (HCF_EXT) & HCF_EXT_MB +HCF_STATIC int put_info_mb( IFBP ifbp, CFG_MB_INFO_STRCT FAR * ltvp ); +#endif // HCF_EXT_MB +#if (HCF_TYPE) & HCF_TYPE_WPA +HCF_STATIC void calc_mic( hcf_32* p, hcf_32 M ); +void calc_mic_rx_frag( IFBP ifbp, wci_bufp p, int len ); +void calc_mic_tx_frag( IFBP ifbp, wci_bufp p, int len ); +HCF_STATIC int check_mic( IFBP ifbp ); +#endif // HCF_TYPE_WPA + +HCF_STATIC void calibrate( IFBP ifbp ); +HCF_STATIC int cmd_cmpl( IFBP ifbp ); +HCF_STATIC hcf_16 get_fid( IFBP ifbp ); +HCF_STATIC void isr_info( IFBP ifbp ); +#if HCF_DMA +HCF_STATIC DESC_STRCT* get_frame_lst(IFBP ifbp, int tx_rx_flag); +#endif // HCF_DMA +HCF_STATIC void get_frag( IFBP ifbp, wci_bufp bufp, int len BE_PAR( int word_len ) ); //char*, byte count (usually even) +#if HCF_DMA +HCF_STATIC void put_frame_lst( IFBP ifbp, DESC_STRCT *descp, int tx_rx_flag ); +#endif // HCF_DMA +HCF_STATIC void put_frag( IFBP ifbp, wci_bufp bufp, int len BE_PAR( int word_len ) ); +HCF_STATIC void put_frag_finalize( IFBP ifbp ); +HCF_STATIC int setup_bap( IFBP ifbp, hcf_16 fid, int offset, int type ); +#if (HCF_ASSERT) & HCF_ASSERT_PRINTF +static int fw_printf(IFBP ifbp, CFG_FW_PRINTF_STRCT FAR *ltvp); +#endif // HCF_ASSERT_PRINTF + +HCF_STATIC int download( IFBP ifbp, CFG_PROG_STRCT FAR *ltvp ); +#if (HCF_ENCAP) & HCF_ENC +HCF_STATIC hcf_8 hcf_encap( wci_bufp type ); +#endif // HCF_ENCAP +HCF_STATIC hcf_8 null_addr[4] = { 0, 0, 0, 0 }; +#if ! defined IN_PORT_WORD //replace I/O Macros with logging facility +extern FILE *log_file; + +#define IN_PORT_WORD(port) in_port_word( (hcf_io)(port) ) + +static hcf_16 in_port_word( hcf_io port ) { +hcf_16 i = (hcf_16)_inpw( port ); + if ( log_file ) { + fprintf( log_file, "\nR %2.2x %4.4x", (port)&0xFF, i); + } + return i; +} // in_port_word + +#define OUT_PORT_WORD(port, value) out_port_word( (hcf_io)(port), (hcf_16)(value) ) + +static void out_port_word( hcf_io port, hcf_16 value ) { + _outpw( port, value ); + if ( log_file ) { + fprintf( log_file, "\nW %2.02x %4.04x", (port)&0xFF, value ); + } +} + +void IN_PORT_STRING_32( hcf_io prt, hcf_32 FAR * dst, int n) { + int i = 0; + hcf_16 FAR * p; + if ( log_file ) { + fprintf( log_file, "\nread string_32 length %04x (%04d) at port %02.2x to addr %lp", + (hcf_16)n, (hcf_16)n, (hcf_16)(prt)&0xFF, dst); + } + while ( n-- ) { + p = (hcf_16 FAR *)dst; + *p++ = (hcf_16)_inpw( prt ); + *p = (hcf_16)_inpw( prt ); + if ( log_file ) { + fprintf( log_file, "%s%08lx ", i++ % 0x08 ? " " : "\n", *dst); + } + dst++; + } +} // IN_PORT_STRING_32 + +void IN_PORT_STRING_8_16( hcf_io prt, hcf_8 FAR * dst, int n) { //also handles byte alignment problems + hcf_16 FAR * p = (hcf_16 FAR *)dst; //this needs more elaborate code in non-x86 platforms + int i = 0; + if ( log_file ) { + fprintf( log_file, "\nread string_16 length %04x (%04d) at port %02.2x to addr %lp", + (hcf_16)n, (hcf_16)n, (hcf_16)(prt)&0xFF, dst ); + } + while ( n-- ) { + *p =(hcf_16)_inpw( prt); + if ( log_file ) { + if ( i++ % 0x10 ) { + fprintf( log_file, "%04x ", *p); + } else { + fprintf( log_file, "\n%04x ", *p); + } + } + p++; + } +} // IN_PORT_STRING_8_16 + +void OUT_PORT_STRING_32( hcf_io prt, hcf_32 FAR * src, int n) { + int i = 0; + hcf_16 FAR * p; + if ( log_file ) { + fprintf( log_file, "\nwrite string_32 length %04x (%04d) at port %02.2x", + (hcf_16)n, (hcf_16)n, (hcf_16)(prt)&0xFF); + } + while ( n-- ) { + p = (hcf_16 FAR *)src; + _outpw( prt, *p++ ); + _outpw( prt, *p ); + if ( log_file ) { + fprintf( log_file, "%s%08lx ", i++ % 0x08 ? " " : "\n", *src); + } + src++; + } +} // OUT_PORT_STRING_32 + +void OUT_PORT_STRING_8_16( hcf_io prt, hcf_8 FAR * src, int n) { //also handles byte alignment problems + hcf_16 FAR * p = (hcf_16 FAR *)src; //this needs more elaborate code in non-x86 platforms + int i = 0; + if ( log_file ) { + fprintf( log_file, "\nwrite string_16 length %04x (%04d) at port %04x", n, n, (hcf_16)prt); + } + while ( n-- ) { + (void)_outpw( prt, *p); + if ( log_file ) { + if ( i++ % 0x10 ) { + fprintf( log_file, "%04x ", *p); + } else { + fprintf( log_file, "\n%04x ", *p); + } + } + p++; + } +} // OUT_PORT_STRING_8_16 + +#endif // IN_PORT_WORD + +/************************************************************************************************************ +******************************* D A T A D E F I N I T I O N S ******************************************** +************************************************************************************************************/ + +#if HCF_ASSERT +IFBP BASED assert_ifbp = NULL; //to make asserts easily work under MMD and DHF +#endif // HCF_ASSERT + +#if HCF_ENCAP +/* SNAP header to be inserted in Ethernet-II frames */ +HCF_STATIC hcf_8 BASED snap_header[] = { 0xAA, 0xAA, 0x03, 0x00, 0x00, //5 bytes signature + + 0 }; //1 byte protocol identifier +#endif // HCF_ENCAP + +#if (HCF_TYPE) & HCF_TYPE_WPA +HCF_STATIC hcf_8 BASED mic_pad[8] = { 0x5A, 0, 0, 0, 0, 0, 0, 0 }; //MIC padding of message +#endif // HCF_TYPE_WPA + +#if defined MSF_COMPONENT_ID +CFG_IDENTITY_STRCT BASED cfg_drv_identity = { + sizeof(cfg_drv_identity)/sizeof(hcf_16) - 1, //length of RID + CFG_DRV_IDENTITY, // (0x0826) + MSF_COMPONENT_ID, + MSF_COMPONENT_VAR, + MSF_COMPONENT_MAJOR_VER, + MSF_COMPONENT_MINOR_VER +} ; + +CFG_RANGES_STRCT BASED cfg_drv_sup_range = { + sizeof(cfg_drv_sup_range)/sizeof(hcf_16) - 1, //length of RID + CFG_DRV_SUP_RANGE, // (0x0827) + + COMP_ROLE_SUPL, + COMP_ID_DUI, + {{ DUI_COMPAT_VAR, + DUI_COMPAT_BOT, + DUI_COMPAT_TOP + }} +} ; + +struct CFG_RANGE3_STRCT BASED cfg_drv_act_ranges_pri = { + sizeof(cfg_drv_act_ranges_pri)/sizeof(hcf_16) - 1, //length of RID + CFG_DRV_ACT_RANGES_PRI, // (0x0828) + + COMP_ROLE_ACT, + COMP_ID_PRI, + { + { 0, 0, 0 }, // HCF_PRI_VAR_1 not supported by HCF 7 + { 0, 0, 0 }, // HCF_PRI_VAR_2 not supported by HCF 7 + { 3, //var_rec[2] - Variant number + CFG_DRV_ACT_RANGES_PRI_3_BOTTOM, // - Bottom Compatibility + CFG_DRV_ACT_RANGES_PRI_3_TOP // - Top Compatibility + } + } +} ; + + +struct CFG_RANGE4_STRCT BASED cfg_drv_act_ranges_sta = { + sizeof(cfg_drv_act_ranges_sta)/sizeof(hcf_16) - 1, //length of RID + CFG_DRV_ACT_RANGES_STA, // (0x0829) + + COMP_ROLE_ACT, + COMP_ID_STA, + { +#if defined HCF_STA_VAR_1 + { 1, //var_rec[1] - Variant number + CFG_DRV_ACT_RANGES_STA_1_BOTTOM, // - Bottom Compatibility + CFG_DRV_ACT_RANGES_STA_1_TOP // - Top Compatibility + }, +#else + { 0, 0, 0 }, +#endif // HCF_STA_VAR_1 +#if defined HCF_STA_VAR_2 + { 2, //var_rec[1] - Variant number + CFG_DRV_ACT_RANGES_STA_2_BOTTOM, // - Bottom Compatibility + CFG_DRV_ACT_RANGES_STA_2_TOP // - Top Compatibility + }, +#else + { 0, 0, 0 }, +#endif // HCF_STA_VAR_2 +// For Native_USB (Not used!) +#if defined HCF_STA_VAR_3 + { 3, //var_rec[1] - Variant number + CFG_DRV_ACT_RANGES_STA_3_BOTTOM, // - Bottom Compatibility + CFG_DRV_ACT_RANGES_STA_3_TOP // - Top Compatibility + }, +#else + { 0, 0, 0 }, +#endif // HCF_STA_VAR_3 +// Warp +#if defined HCF_STA_VAR_4 + { 4, //var_rec[1] - Variant number + CFG_DRV_ACT_RANGES_STA_4_BOTTOM, // - Bottom Compatibility + CFG_DRV_ACT_RANGES_STA_4_TOP // - Top Compatibility + } +#else + { 0, 0, 0 } +#endif // HCF_STA_VAR_4 + } +} ; + + +struct CFG_RANGE6_STRCT BASED cfg_drv_act_ranges_hsi = { + sizeof(cfg_drv_act_ranges_hsi)/sizeof(hcf_16) - 1, //length of RID + CFG_DRV_ACT_RANGES_HSI, // (0x082A) + COMP_ROLE_ACT, + COMP_ID_HSI, + { +#if defined HCF_HSI_VAR_0 // Controlled deployment + { 0, // var_rec[1] - Variant number + CFG_DRV_ACT_RANGES_HSI_0_BOTTOM, // - Bottom Compatibility + CFG_DRV_ACT_RANGES_HSI_0_TOP // - Top Compatibility + }, +#else + { 0, 0, 0 }, +#endif // HCF_HSI_VAR_0 + { 0, 0, 0 }, // HCF_HSI_VAR_1 not supported by HCF 7 + { 0, 0, 0 }, // HCF_HSI_VAR_2 not supported by HCF 7 + { 0, 0, 0 }, // HCF_HSI_VAR_3 not supported by HCF 7 +#if defined HCF_HSI_VAR_4 // Hermes-II all types + { 4, // var_rec[1] - Variant number + CFG_DRV_ACT_RANGES_HSI_4_BOTTOM, // - Bottom Compatibility + CFG_DRV_ACT_RANGES_HSI_4_TOP // - Top Compatibility + }, +#else + { 0, 0, 0 }, +#endif // HCF_HSI_VAR_4 +#if defined HCF_HSI_VAR_5 // WARP Hermes-2.5 + { 5, // var_rec[1] - Variant number + CFG_DRV_ACT_RANGES_HSI_5_BOTTOM, // - Bottom Compatibility + CFG_DRV_ACT_RANGES_HSI_5_TOP // - Top Compatibility + } +#else + { 0, 0, 0 } +#endif // HCF_HSI_VAR_5 + } +} ; + + +CFG_RANGE4_STRCT BASED cfg_drv_act_ranges_apf = { + sizeof(cfg_drv_act_ranges_apf)/sizeof(hcf_16) - 1, //length of RID + CFG_DRV_ACT_RANGES_APF, // (0x082B) + + COMP_ROLE_ACT, + COMP_ID_APF, + { +#if defined HCF_APF_VAR_1 //(Fake) Hermes-I + { 1, //var_rec[1] - Variant number + CFG_DRV_ACT_RANGES_APF_1_BOTTOM, // - Bottom Compatibility + CFG_DRV_ACT_RANGES_APF_1_TOP // - Top Compatibility + }, +#else + { 0, 0, 0 }, +#endif // HCF_APF_VAR_1 +#if defined HCF_APF_VAR_2 //Hermes-II + { 2, // var_rec[1] - Variant number + CFG_DRV_ACT_RANGES_APF_2_BOTTOM, // - Bottom Compatibility + CFG_DRV_ACT_RANGES_APF_2_TOP // - Top Compatibility + }, +#else + { 0, 0, 0 }, +#endif // HCF_APF_VAR_2 +#if defined HCF_APF_VAR_3 // Native_USB + { 3, // var_rec[1] - Variant number + CFG_DRV_ACT_RANGES_APF_3_BOTTOM, // - Bottom Compatibility !!!!!see note below!!!!!!! + CFG_DRV_ACT_RANGES_APF_3_TOP // - Top Compatibility + }, +#else + { 0, 0, 0 }, +#endif // HCF_APF_VAR_3 +#if defined HCF_APF_VAR_4 // WARP Hermes 2.5 + { 4, // var_rec[1] - Variant number + CFG_DRV_ACT_RANGES_APF_4_BOTTOM, // - Bottom Compatibility !!!!!see note below!!!!!!! + CFG_DRV_ACT_RANGES_APF_4_TOP // - Top Compatibility + } +#else + { 0, 0, 0 } +#endif // HCF_APF_VAR_4 + } +} ; +#define HCF_VERSION TEXT( "HCF$Revision: 1.10 $" ) + +static struct /*CFG_HCF_OPT_STRCT*/ { + hcf_16 len; //length of cfg_hcf_opt struct + hcf_16 typ; //type 0x082C + hcf_16 v0; //offset HCF_VERSION + hcf_16 v1; // MSF_COMPONENT_ID + hcf_16 v2; // HCF_ALIGN + hcf_16 v3; // HCF_ASSERT + hcf_16 v4; // HCF_BIG_ENDIAN + hcf_16 v5; // /* HCF_DLV | HCF_DLNV */ + hcf_16 v6; // HCF_DMA + hcf_16 v7; // HCF_ENCAP + hcf_16 v8; // HCF_EXT + hcf_16 v9; // HCF_INT_ON + hcf_16 v10; // HCF_IO + hcf_16 v11; // HCF_LEGACY + hcf_16 v12; // HCF_MAX_LTV + hcf_16 v13; // HCF_PROT_TIME + hcf_16 v14; // HCF_SLEEP + hcf_16 v15; // HCF_TALLIES + hcf_16 v16; // HCF_TYPE + hcf_16 v17; // HCF_NIC_TAL_CNT + hcf_16 v18; // HCF_HCF_TAL_CNT + hcf_16 v19; // offset tallies + TCHAR val[sizeof(HCF_VERSION)]; +} BASED cfg_hcf_opt = { + sizeof(cfg_hcf_opt)/sizeof(hcf_16) -1, + CFG_HCF_OPT, // (0x082C) + ( sizeof(cfg_hcf_opt) - sizeof(HCF_VERSION) - 4 )/sizeof(hcf_16), +#if defined MSF_COMPONENT_ID + MSF_COMPONENT_ID, +#else + 0, +#endif // MSF_COMPONENT_ID + HCF_ALIGN, + HCF_ASSERT, + HCF_BIG_ENDIAN, + 0, // /* HCF_DLV | HCF_DLNV*/, + HCF_DMA, + HCF_ENCAP, + HCF_EXT, + HCF_INT_ON, + HCF_IO, + HCF_LEGACY, + HCF_MAX_LTV, + HCF_PROT_TIME, + HCF_SLEEP, + HCF_TALLIES, + HCF_TYPE, +#if (HCF_TALLIES) & ( HCF_TALLIES_NIC | HCF_TALLIES_HCF ) + HCF_NIC_TAL_CNT, + HCF_HCF_TAL_CNT, + offsetof(IFB_STRCT, IFB_TallyLen ), +#else + 0, 0, 0, +#endif // HCF_TALLIES_NIC / HCF_TALLIES_HCF + HCF_VERSION +}; // cfg_hcf_opt +#endif // MSF_COMPONENT_ID + +#if defined HCF_TALLIES_EXTRA + replaced by HCF_EXT_TALLIES_FW ; +#endif // HCF_TALLIES_EXTRA + +#if defined MSF_COMPONENT_ID || (HCF_EXT) & HCF_EXT_MB +#if (HCF_EXT) & HCF_EXT_MB +HCF_STATIC LTV_STRCT BASED cfg_null = { 1, CFG_NULL, {0} }; +#endif // HCF_EXT_MB +HCF_STATIC hcf_16* BASED xxxx[ ] = { +#if (HCF_EXT) & HCF_EXT_MB + &cfg_null.len, //CFG_NULL 0x0820 +#endif // HCF_EXT_MB +#if defined MSF_COMPONENT_ID + &cfg_drv_identity.len, //CFG_DRV_IDENTITY 0x0826 + &cfg_drv_sup_range.len, //CFG_DRV_SUP_RANGE 0x0827 + &cfg_drv_act_ranges_pri.len, //CFG_DRV_ACT_RANGES_PRI 0x0828 + &cfg_drv_act_ranges_sta.len, //CFG_DRV_ACT_RANGES_STA 0x0829 + &cfg_drv_act_ranges_hsi.len, //CFG_DRV_ACT_RANGES_HSI 0x082A + &cfg_drv_act_ranges_apf.len, //CFG_DRV_ACT_RANGES_APF 0x082B + &cfg_hcf_opt.len, //CFG_HCF_OPT 0x082C + NULL, //IFB_PRIIdentity placeholder 0xFD02 + NULL, //IFB_PRISup placeholder 0xFD03 +#endif // MSF_COMPONENT_ID + NULL //endsentinel + }; +#define xxxx_PRI_IDENTITY_OFFSET (sizeof(xxxx)/sizeof(xxxx[0]) - 3) + +#endif // MSF_COMPONENT_ID / HCF_EXT_MB + + +/************************************************************************************************************ +************************** T O P L E V E L H C F R O U T I N E S ************************************** +************************************************************************************************************/ + +#if (HCF_DL_ONLY) == 0 +/************************************************************************************************************ +* +*.MODULE int hcf_action( IFBP ifbp, hcf_16 action ) +*.PURPOSE Changes the run-time Card behavior. +* Performs Miscellanuous actions. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* action number identifying the type of change +* - HCF_ACT_CCX_OFF disable CKIP +* - HCF_ACT_CCX_ON enable CKIP +* - HCF_ACT_INT_FORCE_ON enable interrupt generation by WaveLAN NIC +* - HCF_ACT_INT_OFF disable interrupt generation by WaveLAN NIC +* - HCF_ACT_INT_ON compensate 1 HCF_ACT_INT_OFF, enable interrupt generation if balance reached +* - HCF_ACT_PRS_SCAN Hermes Probe Respons Scan (F102) command +* - HCF_ACT_RX_ACK acknowledge non-DMA receiver to Hermes +* - HCF_ACT_SCAN Hermes Inquire Scan (F101) command (non-WARP only) +* - HCF_ACT_SLEEP DDS Sleep request +* - HCF_ACT_TALLIES Hermes Inquire Tallies (F100) command +* +*.RETURNS +* HCF_SUCCESS all (including invalid) +* HCF_INT_PENDING HCF_ACT_INT_OFF, interrupt pending +* HCF_ERR_NO_NIC HCF_ACT_INT_OFF, NIC presence check fails +* +*.CONDITIONS +* Except for hcf_action with HCF_ACT_INT_FORCE_ON or HCF_ACT_INT_OFF as parameter or hcf_connect with an I/O +* address (i.e. not HCF_DISCONNECT), all hcf-function calls MUST be preceeded by a call of hcf_action with +* HCF_ACT_INT_OFF as parameter. +* Note that hcf_connect defaults to NIC interrupt disabled mode, i.e. as if hcf_action( HCF_ACT_INT_OFF ) +* was called. +* +*.DESCRIPTION +* hcf_action supports the following mode changing action-code pairs that are antonyms +* - HCF_ACT_CCX_OFF / HCF_ACT_CCX_ON +* - HCF_ACT_INT_[FORCE_]ON / HCF_ACT_INT_OFF +* +* Additionally hcf_action can start the following actions in the NIC: +* - HCF_ACT_PRS_SCAN +* - HCF_ACT_RX_ACK +* - HCF_ACT_SCAN +* - HCF_ACT_SLEEP +* - HCF_ACT_TALLIES +* +* o HCF_ACT_INT_OFF: Sets NIC Interrupts mode Disabled. +* This command, and the associated [Force] Enable NIC interrupts command, are only available if the HCF_INT_ON +* compile time option is not set at 0x0000. +* +* o HCF_ACT_INT_ON: Sets NIC Interrupts mode Enabled. +* Enable NIC Interrupts, depending on the number of preceding Disable NIC Interrupt calls. +* +* o HCF_ACT_INT_FORCE_ON: Force NIC Interrupts mode Enabled. +* Sets NIC Interrupts mode Enabled, regardless off the number of preceding Disable NIC Interrupt calls. +* +* The disabling and enabling of interrupts are antonyms. +* These actions must be balanced. +* For each "disable interrupts" there must be a matching "enable interrupts". +* The disable interrupts may be executed multiple times in a row without intervening enable interrupts, in +* other words, the disable interrupts may be nested. +* The interrupt generation mechanism is disabled at the first call with HCF_ACT_INT_OFF. +* The interrupt generation mechanism is re-enabled when the number of calls with HCF_ACT_INT_ON matches the +* number of calls with INT_OFF. +* +* It is not allowed to have more Enable NIC Interrupts calls than Disable NIC Interrupts calls. +* The interrupt generation mechanism is initially (i.e. after hcf_connect) disabled. +* An MSF based on a interrupt strategy must call hcf_action with INT_ON in its initialization logic. +* +*! The INT_OFF/INT_ON housekeeping is initialized at 0x0000 by hcf_connect, causing the interrupt generation +* mechanism to be disabled at first. This suits MSF implementation based on a polling strategy. +* +* o HCF_ACT_CCX_OFF / HCF_ACT_CCX_ON +*!! This can use some more explanation;? +* Disables and Enables support in the HCF runtime code for the CCX feature. Each time one of these action +* codes is used, the effects of the preceding use cease. +* +* o HCF_ACT_SLEEP: Initiates the Disconnected DeepSleep process +* This command is only available if the HCF_DDS compile time option is set. It triggers the F/W to start the +* sleep handshaking. Regardless whether the Host initiates a Disconnected DeepSleep (DDS) or the F/W initiates +* a Connected DeepSleep (CDS), the Host-F/W sleep handshaking is completed when the NIC Interrupts mode is +* enabled (by means of the balancing HCF_ACT_INT_ON), i.e. at that moment the F/W really goes into sleep mode. +* The F/W is wokenup by the HCF when the NIC Interrupts mode are disabled, i.e. at the first HCF_ACT_INT_OFF +* after going into sleep. +* +* The following Miscellanuous actions are defined: +* +* o HCF_ACT_RX_ACK: Receiver Acknowledgement (non-DMA, non-USB mode only) +* Acking the receiver, frees the NIC memory used to hold the Rx frame and allows the F/W to +* report the existence of the next Rx frame. +* If the MSF does not need access (any longer) to the current frame, e.g. because it is rejected based on the +* look ahead or copied to another buffer, the receiver may be acked. Acking earlier is assumed to have the +* potential of improving the performance. +* If the MSF does not explitly ack te receiver, the acking is done implicitly if: +* - the received frame fits in the look ahead buffer, by the hcf_service_nic call that reported the Rx frame +* - if not in the above step, by hcf_rcv_msg (assuming hcf_rcv_msg is called) +* - if neither of the above implicit acks nor an explicit ack by the MSF, by the first hcf_service_nic after +* the hcf_service_nic that reported the Rx frame. +* Note: If an Rx frame is already acked, an explicit ACK by the MSF acts as a NoOperation. +* +* o HCF_ACT_TALLIES: Inquire Tallies command +* This command is only operational if the F/W is enabled. +* The Inquire Tallies command requests the F/W to provide its current set of tallies. +* See also hcf_get_info with CFG_TALLIES as parameter. +* +* o HCF_ACT_PRS_SCAN: Inquire Probe Respons Scan command +* This command is only operational if the F/W is enabled. +* The Probe Respons Scan command starts a scan sequence. +* The HCF puts the result of this action in an MSF defined buffer (see CFG_RID_LOG_STRCT). +* +* o HCF_ACT_SCAN: Inquire Scan command +* This command is only supported for HII F/W (i.e. pre-WARP) and it is operational if the F/W is enabled. +* The Inquire Scan command starts a scan sequence. +* The HCF puts the result of this action in an MSF defined buffer (see CFG_RID_LOG_STRCT). +* +* Assert fails if +* - ifbp has a recognizable out-of-range value. +* - NIC interrupts are not disabled while required by parameter action. +* - an invalid code is specified in parameter action. +* - HCF_ACT_INT_ON commands outnumber the HCF_ACT_INT_OFF commands. +* - reentrancy, may be caused by calling hcf_functions without adequate protection against NIC interrupts or +* multi-threading +* +* - Since the HCF does not maintain status information relative to the F/W enabled state, it is not asserted +* whether HCF_ACT_SCAN, HCF_ACT_PRS_SCAN or HCF_ACT_TALLIES are only used while F/W is enabled. +* +*.DIAGRAM +* 0: The assert embedded in HCFLOGENTRY checks against re-entrancy. Re-entrancy could be caused by a MSF logic +* at task-level calling hcf_functions without shielding with HCF_ACT_ON/_OFF. However the HCF_ACT_INT_OFF +* action itself can per definition not be protected this way. Based on code inspection, it can be concluded, +* that there is no re-entrancy PROBLEM in this particular flow. It does not seem worth the trouble to +* explicitly check for this condition (although there was a report of an MSF which ran into this assert. +* 2:IFB_IntOffCnt is used to balance the INT_OFF and INT_ON calls. Disabling of the interrupts is achieved by +* writing a zero to the Hermes IntEn register. In a shared interrupt environment (e.g. the mini-PCI NDIS +* driver) it is considered more correct to return the status HCF_INT_PENDING if and only if, the current +* invocation of hcf_service_nic is (apparently) called in the ISR when the ISR was activated as result of a +* change in HREG_EV_STAT matching a bit in HREG_INT_EN, i.e. not if invoked as result of another device +* generating an interrupt on the shared interrupt line. +* Note 1: it has been observed that under certain adverse conditions on certain platforms the writing of +* HREG_INT_EN can apparently fail, therefor it is paramount that HREG_INT_EN is written again with 0 for +* each and every call to HCF_ACT_INT_OFF. +* Note 2: it has been observed that under certain H/W & S/W architectures this logic is called when there is +* no NIC at all. To cater for this, the value of HREG_INT_EN is validated. If the unused bit 0x0100 is set, +* it is assumed there is no NIC. +* Note 3: During the download process, some versions of the F/W reset HREG_SW_0, hence checking this +* register for HCF_MAGIC (the classical NIC presence test) when HCF_ACT_INT_OFF is called due to another +* card interrupting via a shared IRQ during a download, fails. +*4: The construction "if ( ifbp->IFB_IntOffCnt-- == 0 )" is optimal (in the sense of shortest/quickest +* path in error free flows) but NOT fail safe in case of too many INT_ON invocations compared to INT_OFF). +* Enabling of the interrupts is achieved by writing the Hermes IntEn register. +* - If the HCF is in Defunct mode, the interrupts stay disabled. +* - Under "normal" conditions, the HCF is only interested in Info Events, Rx Events and Notify Events. +* - When the HCF is out of Tx/Notify resources, the HCF is also interested in Alloc Events. +* - via HCF_EXT, the MSF programmer can also request HREG_EV_TICK and/or HREG_EV_TX_EXC interrupts. +* For DMA operation, the DMA hardware handles the alloc events. The DMA engine will generate a 'TxDmaDone' +* event as soon as it has pumped a frame from host ram into NIC-RAM (note that the frame does not have to be +* transmitted then), and a 'RxDmaDone' event as soon as a received frame has been pumped from NIC-RAM into +* host ram. Note that the 'alloc' event has been removed from the event-mask, because the DMA engine will +* react to and acknowledge this event. +*6: ack the "old" Rx-event. See "Rx Buffer free strategy" in hcf_service_nic above for more explanation. +* IFB_RxFID and IFB_RxLen must be cleared to bring both the internal HCF house keeping and the information +* supplied to the MSF in the state "no frame received". +*8: The HCF_ACT_SCAN, HCF_ACT_PRS_SCAN and HCF_ACT_TALLIES activity are merged by "clever" algebraic +* manipulations of the RID-values and action codes, so foregoing robustness against migration problems for +* ease of implementation. The assumptions about numerical relationships between CFG_TALLIES etc and +* HCF_ACT_TALLIES etc are checked by the "#if" statements just prior to the body of this routine, resulting +* in: err "maintenance" during compilation if the assumptions are no longer met. The writing of HREG_PARAM_1 +* with 0x3FFF in case of an PRS scan, is a kludge to get around lack of specification, hence different +* implementation in F/W and Host. +* When there is no NIC RAM available, some versions of the Hermes F/W do report 0x7F00 as error in the +* Result field of the Status register and some F/W versions don't. To mask this difference to the MSF all +* return codes of the Hermes are ignored ("best" and "most simple" solution to these types of analomies with +* an acceptable loss due to ignoring all error situations as well). +* The "No inquire space" is reported via the Hermes tallies. +*30: do not HCFASSERT( rc, rc ) since rc == HCF_INT_PENDING is no error +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +#if ( (HCF_TYPE) & HCF_TYPE_HII5 ) == 0 +#if CFG_SCAN != CFG_TALLIES - HCF_ACT_TALLIES + HCF_ACT_SCAN +err: "maintenance" apparently inviolated the underlying assumption about the numerical values of these macros +#endif +#endif // HCF_TYPE_HII5 +#if CFG_PRS_SCAN != CFG_TALLIES - HCF_ACT_TALLIES + HCF_ACT_PRS_SCAN +err: "maintenance" apparently inviolated the underlying assumption about the numerical values of these macros +#endif +int +hcf_action( IFBP ifbp, hcf_16 action ) +{ +int rc = HCF_SUCCESS; + + HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic ) +#if HCF_INT_ON + HCFLOGENTRY( action == HCF_ACT_INT_FORCE_ON ? HCF_TRACE_ACTION_KLUDGE : HCF_TRACE_ACTION, action ) /* 0 */ +#if (HCF_SLEEP) + HCFASSERT( ifbp->IFB_IntOffCnt != 0xFFFE || action == HCF_ACT_INT_OFF, + MERGE_2( action, ifbp->IFB_IntOffCnt ) ) +#else + HCFASSERT( ifbp->IFB_IntOffCnt != 0xFFFE, action ) +#endif // HCF_SLEEP + HCFASSERT( ifbp->IFB_IntOffCnt != 0xFFFF || + action == HCF_ACT_INT_OFF || action == HCF_ACT_INT_FORCE_ON, action ) + HCFASSERT( ifbp->IFB_IntOffCnt <= 16 || ifbp->IFB_IntOffCnt >= 0xFFFE, + MERGE_2( action, ifbp->IFB_IntOffCnt ) ) //nesting more than 16 deep seems unreasonable +#endif // HCF_INT_ON + + switch (action) { +#if HCF_INT_ON +hcf_16 i; + case HCF_ACT_INT_OFF: // Disable Interrupt generation +#if HCF_SLEEP + if ( ifbp->IFB_IntOffCnt == 0xFFFE ) { // WakeUp test ;?tie this to the "new" super-LinkStat + ifbp->IFB_IntOffCnt++; // restore conventional I/F + OPW(HREG_IO, HREG_IO_WAKEUP_ASYNC ); // set wakeup bit + OPW(HREG_IO, HREG_IO_WAKEUP_ASYNC ); // set wakeup bit to counteract the clearing by F/W + // 800 us latency before FW switches to high power + MSF_WAIT(800); // MSF-defined function to wait n microseconds. +//OOR if ( ifbp->IFB_DSLinkStat & CFG_LINK_STAT_DS_OOR ) { // OutOfRange +// printk( "<5>ACT_INT_OFF: Deepsleep phase terminated, enable and go to AwaitConnection\n" ); //;?remove me 1 day +// hcf_cntl( ifbp, HCF_CNTL_ENABLE ); +// } +// ifbp->IFB_DSLinkStat &= ~( CFG_LINK_STAT_DS_IR | CFG_LINK_STAT_DS_OOR); //clear IR/OOR state + } +#endif // HCF_SLEEP +/*2*/ ifbp->IFB_IntOffCnt++; +//! rc = 0; + i = IPW( HREG_INT_EN ); + OPW( HREG_INT_EN, 0 ); + if ( i & 0x1000 ) { + rc = HCF_ERR_NO_NIC; + } else { + if ( i & IPW( HREG_EV_STAT ) ) { + rc = HCF_INT_PENDING; + } + } + break; + + case HCF_ACT_INT_FORCE_ON: // Enforce Enable Interrupt generation + ifbp->IFB_IntOffCnt = 0; + //Fall through in HCF_ACT_INT_ON + + case HCF_ACT_INT_ON: // Enable Interrupt generation +/*4*/ if ( ifbp->IFB_IntOffCnt-- == 0 && ifbp->IFB_CardStat == 0 ) { + //determine Interrupt Event mask +#if HCF_DMA + if ( ifbp->IFB_CntlOpt & USE_DMA ) { + i = HREG_EV_INFO | HREG_EV_RDMAD | HREG_EV_TDMAD | HREG_EV_TX_EXT; //mask when DMA active + } else +#endif // HCF_DMA + { + i = HREG_EV_INFO | HREG_EV_RX | HREG_EV_TX_EXT; //mask when DMA not active + if ( ifbp->IFB_RscInd == 0 ) { + i |= HREG_EV_ALLOC; //mask when no TxFID available + } + } +#if HCF_SLEEP + if ( ( IPW(HREG_EV_STAT) & ( i | HREG_EV_SLEEP_REQ ) ) == HREG_EV_SLEEP_REQ ) { + // firmware indicates it would like to go into sleep modus + // only acknowledge this request if no other events that can cause an interrupt are pending + ifbp->IFB_IntOffCnt--; //becomes 0xFFFE + OPW( HREG_INT_EN, i | HREG_EV_TICK ); + OPW( HREG_EV_ACK, HREG_EV_SLEEP_REQ | HREG_EV_TICK | HREG_EV_ACK_REG_READY ); + } else +#endif // HCF_SLEEP + { + OPW( HREG_INT_EN, i | HREG_EV_SLEEP_REQ ); + } + } + break; +#endif // HCF_INT_ON + +#if (HCF_SLEEP) & HCF_DDS + case HCF_ACT_SLEEP: // DDS Sleep request + hcf_cntl( ifbp, HCF_CNTL_DISABLE ); + cmd_exe( ifbp, HCMD_SLEEP, 0 ); + break; +// case HCF_ACT_WAKEUP: // DDS Wakeup request +// HCFASSERT( ifbp->IFB_IntOffCnt == 0xFFFE, ifbp->IFB_IntOffCnt ) +// ifbp->IFB_IntOffCnt++; // restore conventional I/F +// OPW( HREG_IO, HREG_IO_WAKEUP_ASYNC ); +// MSF_WAIT(800); // MSF-defined function to wait n microseconds. +// rc = hcf_action( ifbp, HCF_ACT_INT_OFF ); /*bogus, IFB_IntOffCnt == 0xFFFF, so if you carefully look +// *at the #if HCF_DDS statements, HCF_ACT_INT_OFF is empty +// *for DDS. "Much" better would be to merge the flows for +// *DDS and DEEP_SLEEP +// */ +// break; +#endif // HCF_DDS + +#if (HCF_TYPE) & HCF_TYPE_CCX + case HCF_ACT_CCX_ON: // enable CKIP + case HCF_ACT_CCX_OFF: // disable CKIP + ifbp->IFB_CKIPStat = action; + break; +#endif // HCF_TYPE_CCX + + case HCF_ACT_RX_ACK: //Receiver ACK +/*6*/ if ( ifbp->IFB_RxFID ) { + DAWA_ACK( HREG_EV_RX ); + } + ifbp->IFB_RxFID = ifbp->IFB_RxLen = 0; + break; + +/*8*/ case HCF_ACT_PRS_SCAN: // Hermes PRS Scan (F102) + OPW( HREG_PARAM_1, 0x3FFF ); + //Fall through in HCF_ACT_TALLIES + case HCF_ACT_TALLIES: // Hermes Inquire Tallies (F100) +#if ( (HCF_TYPE) & HCF_TYPE_HII5 ) == 0 + case HCF_ACT_SCAN: // Hermes Inquire Scan (F101) +#endif // HCF_TYPE_HII5 + /*!! the assumptions about numerical relationships between CFG_TALLIES etc and HCF_ACT_TALLIES etc + * are checked by #if statements just prior to this routine resulting in: err "maintenance" */ + cmd_exe( ifbp, HCMD_INQUIRE, action - HCF_ACT_TALLIES + CFG_TALLIES ); + break; + + default: + HCFASSERT( DO_ASSERT, action ) + break; + } + //! do not HCFASSERT( rc == HCF_SUCCESS, rc ) /* 30*/ + HCFLOGEXIT( HCF_TRACE_ACTION ) + return rc; +} // hcf_action +#endif // HCF_DL_ONLY + + +/************************************************************************************************************ +* +*.MODULE int hcf_cntl( IFBP ifbp, hcf_16 cmd ) +*.PURPOSE Connect or disconnect a specific port to a specific network. +*!! ;???????????????? continue needs more explanation +* recovers by means of "continue" when the connect proces in CCX mode fails +* Enables or disables data transmission and reception for the NIC. +* Activates static NIC configuration for a specific port at connect. +* Activates static configuration for all ports at enable. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* cmd 0x001F: Hermes command (disable, enable, connect, disconnect, continue) +* HCF_CNTL_ENABLE Enable +* HCF_CNTL_DISABLE Disable +* HCF_CNTL_CONTINUE Continue +* HCF_CNTL_CONNECT Connect +* HCF_CNTL_DISCONNECT Disconnect +* 0x0100: command qualifier (continue) +* HCMD_RETRY retry flag +* 0x0700: port number (connect/disconnect) +* HCF_PORT_0 MAC Port 0 +* HCF_PORT_1 MAC Port 1 +* HCF_PORT_2 MAC Port 2 +* HCF_PORT_3 MAC Port 3 +* HCF_PORT_4 MAC Port 4 +* HCF_PORT_5 MAC Port 5 +* HCF_PORT_6 MAC Port 6 +* +*.RETURNS +* HCF_SUCCESS +*!! via cmd_exe +* HCF_ERR_NO_NIC +* HCF_ERR_DEFUNCT_... +* HCF_ERR_TIME_OUT +* +*.DESCRIPTION +* The parameter cmd contains a number of subfields. +* The actual value for cmd is created by logical or-ing the appropriate mnemonics for the subfields. +* The field 0x001F contains the command code +* - HCF_CNTL_ENABLE +* - HCF_CNTL_DISABLE +* - HCF_CNTL_CONNECT +* - HCF_CNTL_DISCONNECT +* - HCF_CNTL_CONTINUE +* +* For HCF_CNTL_CONTINUE, the field 0x0100 contains the retry flag HCMD_RETRY. +* For HCF_CNTL_CONNECT and HCF_CNTL_DISCONNECT, the field 0x0700 contains the port number as HCF_PORT_#. +* For Station as well as AccessPoint F/W, MAC Port 0 is the "normal" communication channel. +* For AccessPoint F/W, MAC Port 1 through 6 control the WDS links. +* +* Note that despite the names HCF_CNTL_DISABLE and HCF_CNTL_ENABLE, hcf_cntl does not influence the NIC +* Interrupts mode. +* +* The Connect is used by the MSF to bring a particular port in an inactive state as far as data transmission +* and reception are concerned. +* When a particular port is disconnected: +* - the F/W disables the receiver for that port. +* - the F/W ignores send commands for that port. +* - all frames (Receive as well as pending Transmit) for that port on the NIC are discarded. +* +* When the NIC is disabled, above list applies to all ports, i.e. the result is like all ports are +* disconnected. +* +* When a particular port is connected: +* - the F/W effectuates the static configuration for that port. +* - enables the receiver for that port. +* - accepts send commands for that port. +* +* Enabling has the following effects: +* - the F/W effectuates the static configuration for all ports. +* The F/W only updates its static configuration at a transition from disabled to enabled or from +* disconnected to connected. +* In order to enforce the static configuration, the MSF must assure that such a transition takes place. +* Due to such a disable/enable or disconnect/connect sequence, Rx/Tx frames may be lost, in other words, +* configuration may impact communication. +* - The DMA Engine (if applicable) is enabled. +* Note that the Enable Function by itself only enables data transmission and reception, it +* does not enable the Interrupt Generation mechanism. This is done by hcf_action. +* +* Disabling has the following effects: +*!! ;?????is the following statement really true +* - it acts as a disconnect on all ports. +* - The DMA Engine (if applicable) is disabled. +* +* For impact of the disable command on the behavior of hcf_dma_tx/rx_get see the appropriate sections. +* +* Although the Enable/Disable and Connect/Disconnect are antonyms, there is no restriction on their sequencing, +* in other words, they may be called multiple times in arbitrary sequence without being paired or balanced. +* Each time one of these functions is called, the effects of the preceding calls cease. +* +* Assert fails if +* - ifbp has a recognizable out-of-range value. +* - NIC interrupts are not disabled. +* - A command other than Continue, Enable, Disable, Connect or Disconnect is given. +* - An invalid combination of the subfields is given or a bit outside the subfields is given. +* - any return code besides HCF_SUCCESS. +* - reentrancy, may be caused by calling a hcf_function without adequate protection against NIC interrupts or +* multi-threading +* +*.DIAGRAM +* hcf_cntl takes successively the following actions: +*2: If the HCF is in Defunct mode or incompatible with the Primary or Station Supplier in the Hermes, +* hcf_cntl() returns immediately with HCF_ERR_NO_NIC;? as status. +*8: when the port is disabled, the DMA engine needs to be de-activated, so the host can safely reclaim tx +* packets from the tx descriptor chain. +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +int +hcf_cntl( IFBP ifbp, hcf_16 cmd ) +{ +int rc = HCF_ERR_INCOMP_FW; +#if HCF_ASSERT +{ int x = cmd & HCMD_CMD_CODE; + if ( x == HCF_CNTL_CONTINUE ) x &= ~HCMD_RETRY; + else if ( (x == HCMD_DISABLE || x == HCMD_ENABLE) && ifbp->IFB_FWIdentity.comp_id == COMP_ID_FW_AP ) { + x &= ~HFS_TX_CNTL_PORT; + } + HCFASSERT( x==HCF_CNTL_ENABLE || x==HCF_CNTL_DISABLE || HCF_CNTL_CONTINUE || + x==HCF_CNTL_CONNECT || x==HCF_CNTL_DISCONNECT, cmd ) +} +#endif // HCF_ASSERT +// #if (HCF_SLEEP) & HCF_DDS +// HCFASSERT( ifbp->IFB_IntOffCnt != 0xFFFE, cmd ) +// #endif // HCF_DDS + HCFLOGENTRY( HCF_TRACE_CNTL, cmd ) + if ( ifbp->IFB_CardStat == 0 ) { /*2*/ +/*6*/ rc = cmd_exe( ifbp, cmd, 0 ); +#if (HCF_SLEEP) & HCF_DDS + ifbp->IFB_TickCnt = 0; //start 2 second period (with 1 tick uncertanty) +#endif // HCF_DDS + } +#if HCF_DMA + //!rlav : note that this piece of code is always executed, regardless of the DEFUNCT bit in IFB_CardStat. + // The reason behind this is that the MSF should be able to get all its DMA resources back from the HCF, + // even if the hardware is disfunctional. Practical example under Windows : surprise removal. + if ( ifbp->IFB_CntlOpt & USE_DMA ) { + hcf_io io_port = ifbp->IFB_IOBase; + DESC_STRCT *p; + if ( cmd == HCF_CNTL_DISABLE || cmd == HCF_CNTL_ENABLE ) { + OUT_PORT_DWORD( (io_port + HREG_DMA_CTRL), DMA_CTRLSTAT_RESET); /*8*/ + ifbp->IFB_CntlOpt &= ~DMA_ENABLED; + } + if ( cmd == HCF_CNTL_ENABLE ) { + OUT_PORT_DWORD( (io_port + HREG_DMA_CTRL), DMA_CTRLSTAT_GO); + /* ;? by rewriting hcf_dma_rx_put you can probably just call hcf_dma_rx_put( ifbp->IFB_FirstDesc[DMA_RX] ) + * as additional beneficiary side effect, the SOP and EOP bits will also be cleared + */ + ifbp->IFB_CntlOpt |= DMA_ENABLED; + HCFASSERT( NT_ASSERT, NEVER_TESTED ) + // make the entire rx descriptor chain DMA-owned, so the DMA engine can (re-)use it. + if ( ( p = ifbp->IFB_FirstDesc[DMA_RX] ) != NULL ) { //;? Think this over again in the light of the new chaining strategy + if ( 1 ) { //begin alternative + HCFASSERT( NT_ASSERT, NEVER_TESTED ) + put_frame_lst( ifbp, ifbp->IFB_FirstDesc[DMA_RX], DMA_RX ); + if ( ifbp->IFB_FirstDesc[DMA_RX] ) { + put_frame_lst( ifbp, ifbp->IFB_FirstDesc[DMA_RX]->next_desc_addr, DMA_RX ); + } + } else { + while ( p ) { + //p->buf_cntl.cntl_stat |= DESC_DMA_OWNED; + p->BUF_CNT |= DESC_DMA_OWNED; + p = p->next_desc_addr; + } + // a rx chain is available so hand it over to the DMA engine + p = ifbp->IFB_FirstDesc[DMA_RX]; + OUT_PORT_DWORD( (io_port + HREG_RXDMA_PTR32), p->desc_phys_addr); + } //end alternative + } + } + } +#endif // HCF_DMA + HCFASSERT( rc == HCF_SUCCESS, rc ) + HCFLOGEXIT( HCF_TRACE_CNTL ) + return rc; +} // hcf_cntl + + +/************************************************************************************************************ +* +*.MODULE int hcf_connect( IFBP ifbp, hcf_io io_base ) +*.PURPOSE Grants access right for the HCF to the IFB. +* Initializes Card and HCF housekeeping. +* +*.ARGUMENTS +* ifbp (near) address of the Interface Block +* io_base non-USB: I/O Base address of the NIC (connect) +* non-USB: HCF_DISCONNECT +* USB: HCF_CONNECT, HCF_DISCONNECT +* +*.RETURNS +* HCF_SUCCESS +* HCF_ERR_INCOMP_PRI +* HCF_ERR_INCOMP_FW +* HCF_ERR_DEFUNCT_CMD_SEQ +*!! HCF_ERR_NO_NIC really returned ;? +* HCF_ERR_NO_NIC +* HCF_ERR_TIME_OUT +* +* MSF-accessible fields of Result Block: +* IFB_IOBase entry parameter io_base +* IFB_IORange HREG_IO_RANGE (0x40/0x80) +* IFB_Version version of the IFB layout +* IFB_FWIdentity CFG_FW_IDENTITY_STRCT, specifies the identity of the +* "running" F/W, i.e. tertiary F/W under normal conditions +* IFB_FWSup CFG_SUP_RANGE_STRCT, specifies the supplier range of +* the "running" F/W, i.e. tertiary F/W under normal conditions +* IFB_HSISup CFG_SUP_RANGE_STRCT, specifies the HW/SW I/F range of the NIC +* IFB_PRIIdentity CFG_PRI_IDENTITY_STRCT, specifies the Identity of the Primary F/W +* IFB_PRISup CFG_SUP_RANGE_STRCT, specifies the supplier range of the Primary F/W +* all other all MSF accessible fields, which are not specified above, are zero-filled +* +*.CONDITIONS +* It is the responsibility of the MSF to assure the correctness of the I/O Base address. +* +* Note: hcf_connect defaults to NIC interrupt disabled mode, i.e. as if hcf_action( HCF_ACT_INT_OFF ) +* was called. +* +*.DESCRIPTION +* hcf_connect passes the MSF-defined location of the IFB to the HCF and grants or revokes access right for the +* HCF to the IFB. Revoking is done by specifying HCF_DISCONNECT rather than an I/O address for the parameter +* io_base. Every call of hcf_connect in "connect" mode, must eventually be followed by a call of hcf_connect +* in "disconnect" mode. Clalling hcf_connect in "connect"/"disconnect" mode can not be nested. +* The IFB address must be used as a handle with all subsequent HCF-function calls and the HCF uses the IFB +* address as a handle when it performs a call(back) of an MSF-function (i.e. msf_assert). +* +* Note that not only the MSF accessible fields are cleared, but also all internal housekeeping +* information is re-initialized. +* This implies that all settings which are done via hcf_action and hcf_put_info (e.g. CFG_MB_ASSERT, CFG_REG_MB, +* CFG_REG_INFO_LOG) must be done again. The only field which is not cleared, is IFB_MSFSup. +* +* If HCF_INT_ON is selected as compile option, NIC interrupts are disabled. +* +* Assert fails if +* - ifbp is not properly aligned ( ref chapter HCF_ALIGN in 4.1.1) +* - I/O Base Address is not a multiple of 0x40 (note: 0x0000 is explicitly allowed). +* +*.DIAGRAM +* +*0: Throughout hcf_connect you need to distinguish the connect from the disconnect case, which requires +* some attention about what to use as "I/O" address when for which purpose. +*2: +*2a: Reset H-II by toggling reset bit in IO-register on and off. +* The HCF_TYPE_PRELOADED caters for the DOS environment where H-II is loaded by a separate program to +* overcome the 64k size limit posed on DOS drivers. +* The macro OPW is not yet useable because the IFB_IOBase field is not set. +* Note 1: hopefully the clearing and initializing of the IFB (see below) acts as a delay which meets the +* specification for S/W reset +* Note 2: it turns out that on some H/W constellations, the clock to access the EEProm is not lowered +* to an appropriate frequency by HREG_IO_SRESET. By giving an HCMD_INI first, this problem is worked around. +*2b: Experimentally it is determined over a wide range of F/W versions that waiting for the for Cmd bit in +* Ev register gives a workable strategy. The available documentation does not give much clues. +*4: clear and initialize the IFB +* The HCF house keeping info is designed such that zero is the appropriate initial value for as much as +* feasible IFB-items. +* The readable fields mentioned in the description section and some HCF specific fields are given their +* actual value. +* IFB_TickIni is initialized at best guess before calibration +* Hcf_connect defaults to "no interrupt generation" (implicitly achieved by the zero-filling). +*6: Register compile-time linked MSF Routine and set default filter level +* cast needed to get around the "near" problem in DOS COM model +* er C2446: no conversion from void (__near __cdecl *)(unsigned char __far *,unsigned int,unsigned short,int) +* to void (__far __cdecl *)(unsigned char __far *,unsigned int,unsigned short,int) +*8: If a command is apparently still active (as indicated by the Busy bit in Cmd register) this may indicate a +* blocked cmd pipe line. To unblock the following actions are done: +* - Ack everything +* - Wait for Busy bit drop in Cmd register +* - Wait for Cmd bit raise in Ev register +* The two waits are combined in a single HCF_WAIT_WHILE to optimize memory size. If either of these waits +* fail (prot_cnt becomes 0), then something is serious wrong. Rather than PANICK, the assumption is that the +* next cmd_exe will fail, causing the HCF to go into DEFUNCT mode +*10: Ack everything to unblock a (possibly blocked) cmd pipe line +* Note 1: it is very likely that an Alloc event is pending and very well possible that a (Send) Cmd event is +* pending on non-initial calls +* Note 2: it is assumed that this strategy takes away the need to ack every conceivable event after an +* Hermes Initialize +*12: Only H-II NEEDS the Hermes Initialize command. Due to the different semantics for H-I and H-II +* Initialize command, init() does not (and can not, since it is called e.g. after a download) execute the +* Hermes Initialize command. Executing the Hermes Initialize command for H-I would not harm but not do +* anything useful either, so it is skipped. +* The return status of cmd_exe is ignored. It is assumed that if cmd_exe fails, init fails too +*14: use io_base as a flag to merge hcf_connect and hcf_disconnect into 1 routine +* the call to init and its subsequent call of cmd_exe will return HCF_ERR_NO_NIC if appropriate. This status +* is (badly) needed by some legacy combination of NT4 and card services which do not yield an I/O address in +* time. +* +*.NOTICE +* On platforms where the NULL-pointer is not a bit-pattern of all zeros, the zero-filling of the IFB results +* in an incorrect initialization of pointers. +* The implementation of the MailBox manipulation in put_mb_info protects against the absence of a MailBox +* based on IFB_MBSize, IFB_MBWp and ifbp->IFB_MBRp. This has ramifications on the initialization of the +* MailBox via hcf_put_info with the CFG_REG_MB type, but it prevents dependency on the "NULL-"ness of +* IFB_MBp. +* +*.NOTICE +* There are a number of problems when asserting and logging hcf_connect, e.g. +* - Asserting on re-entrancy of hcf_connect by means of +* "HCFASSERT( (ifbp->IFB_AssertTrace & HCF_ASSERT_CONNECT) == 0, 0 )" is not useful because IFB contents +* are undefined +* - Asserting before the IFB is cleared will cause mdd_assert() to interpret the garbage in IFB_AssertRtn +* as a routine address +* Therefore HCFTRACE nor HCFLOGENTRY is called by hcf_connect. +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +int +hcf_connect( IFBP ifbp, hcf_io io_base ) +{ +int rc = HCF_SUCCESS; +hcf_io io_addr; +hcf_32 prot_cnt; +hcf_8 *q; +LTV_STRCT x; +#if HCF_ASSERT + hcf_16 xa = ifbp->IFB_FWIdentity.typ; + /* is assumed to cause an assert later on if hcf_connect is called without intervening hcf_disconnect. + * xa == CFG_FW_IDENTITY in subsequent calls without preceding hcf_disconnect, + * xa == 0 in subsequent calls with preceding hcf_disconnect, + * xa == "garbage" (any value except CFG_FW_IDENTITY is acceptable) in the initial call + */ +#endif // HCF_ASSERT + + if ( io_base == HCF_DISCONNECT ) { //disconnect + io_addr = ifbp->IFB_IOBase; + OPW( HREG_INT_EN, 0 ); //;?workaround against dying F/W on subsequent hcf_connect calls + } else { //connect /* 0 */ + io_addr = io_base; + } + +#if 0 //;? if a subsequent hcf_connect is preceeded by an hcf_disconnect the wakeup is not needed !! +#if HCF_SLEEP + OUT_PORT_WORD( .....+HREG_IO, HREG_IO_WAKEUP_ASYNC ); //OPW not yet useable + MSF_WAIT(800); // MSF-defined function to wait n microseconds. + note that MSF_WAIT uses not yet defined!!!! IFB_IOBase and IFB_TickIni (via PROT_CNT_INI) + so be carefull if this code is restored +#endif // HCF_SLEEP +#endif // 0 + +#if ( (HCF_TYPE) & HCF_TYPE_PRELOADED ) == 0 //switch clock back for SEEPROM access !!! + OUT_PORT_WORD( io_addr + HREG_CMD, HCMD_INI ); //OPW not yet useable + prot_cnt = INI_TICK_INI; + HCF_WAIT_WHILE( (IN_PORT_WORD( io_addr + HREG_EV_STAT) & HREG_EV_CMD) == 0 ); + OUT_PORT_WORD( (io_addr + HREG_IO), HREG_IO_SRESET ); //OPW not yet useable /* 2a*/ +#endif // HCF_TYPE_PRELOADED + for ( q = (hcf_8*)(&ifbp->IFB_Magic); q > (hcf_8*)ifbp; *--q = 0 ) /*NOP*/; /* 4 */ + ifbp->IFB_Magic = HCF_MAGIC; + ifbp->IFB_Version = IFB_VERSION; +#if defined MSF_COMPONENT_ID //a new IFB demonstrates how dirty the solution is + xxxx[xxxx_PRI_IDENTITY_OFFSET] = NULL; //IFB_PRIIdentity placeholder 0xFD02 + xxxx[xxxx_PRI_IDENTITY_OFFSET+1] = NULL; //IFB_PRISup placeholder 0xFD03 +#endif // MSF_COMPONENT_ID +#if (HCF_TALLIES) & ( HCF_TALLIES_NIC | HCF_TALLIES_HCF ) + ifbp->IFB_TallyLen = 1 + 2 * (HCF_NIC_TAL_CNT + HCF_HCF_TAL_CNT); //convert # of Tallies to L value for LTV + ifbp->IFB_TallyTyp = CFG_TALLIES; //IFB_TallyTyp: set T value +#endif // HCF_TALLIES_NIC / HCF_TALLIES_HCF + ifbp->IFB_IOBase = io_addr; //set IO_Base asap, so asserts via HREG_SW_2 don't harm + ifbp->IFB_IORange = HREG_IO_RANGE; + ifbp->IFB_CntlOpt = USE_16BIT; +#if HCF_ASSERT + assert_ifbp = ifbp; + ifbp->IFB_AssertLvl = 1; +#if (HCF_ASSERT) & HCF_ASSERT_LNK_MSF_RTN + if ( io_base != HCF_DISCONNECT ) { + ifbp->IFB_AssertRtn = (MSF_ASSERT_RTNP)msf_assert; /* 6 */ + } +#endif // HCF_ASSERT_LNK_MSF_RTN +#if (HCF_ASSERT) & HCF_ASSERT_MB //build the structure to pass the assert info to hcf_put_info + ifbp->IFB_AssertStrct.len = sizeof(ifbp->IFB_AssertStrct)/sizeof(hcf_16) - 1; + ifbp->IFB_AssertStrct.typ = CFG_MB_INFO; + ifbp->IFB_AssertStrct.base_typ = CFG_MB_ASSERT; + ifbp->IFB_AssertStrct.frag_cnt = 1; + ifbp->IFB_AssertStrct.frag_buf[0].frag_len = + ( offsetof(IFB_STRCT, IFB_AssertLvl) - offsetof(IFB_STRCT, IFB_AssertLine) ) / sizeof(hcf_16); + ifbp->IFB_AssertStrct.frag_buf[0].frag_addr = &ifbp->IFB_AssertLine; +#endif // HCF_ASSERT_MB +#endif // HCF_ASSERT + IF_PROT_TIME( prot_cnt = ifbp->IFB_TickIni = INI_TICK_INI; ) +#if ( (HCF_TYPE) & HCF_TYPE_PRELOADED ) == 0 + //!! No asserts before Reset-bit in HREG_IO is cleared + OPW( HREG_IO, 0x0000 ); //OPW useable /* 2b*/ + HCF_WAIT_WHILE( (IPW( HREG_EV_STAT) & HREG_EV_CMD) == 0 ); + IF_PROT_TIME( HCFASSERT( prot_cnt, IPW( HREG_EV_STAT) ) ) + IF_PROT_TIME( if ( prot_cnt ) prot_cnt = ifbp->IFB_TickIni; ) +#endif // HCF_TYPE_PRELOADED + //!! No asserts before Reset-bit in HREG_IO is cleared + HCFASSERT( DO_ASSERT, MERGE_2( HCF_ASSERT, 0xCAF0 ) ) //just to proof that the complete assert machinery is working + HCFASSERT( xa != CFG_FW_IDENTITY, 0 ) // assert if hcf_connect is called without intervening hcf_disconnect. + HCFASSERT( ((hcf_32)(void*)ifbp & (HCF_ALIGN-1) ) == 0, (hcf_32)(void*)ifbp ) + HCFASSERT( (io_addr & 0x003F) == 0, io_addr ) + //if Busy bit in Cmd register + if (IPW( HREG_CMD ) & HCMD_BUSY ) { /* 8 */ + //. Ack all to unblock a (possibly) blocked cmd pipe line + OPW( HREG_EV_ACK, ~HREG_EV_SLEEP_REQ ); + //. Wait for Busy bit drop in Cmd register + //. Wait for Cmd bit raise in Ev register + HCF_WAIT_WHILE( ( IPW( HREG_CMD ) & HCMD_BUSY ) && (IPW( HREG_EV_STAT) & HREG_EV_CMD) == 0 ); + IF_PROT_TIME( HCFASSERT( prot_cnt, IPW( HREG_EV_STAT) ) ) /* if prot_cnt == 0, cmd_exe will fail, causing DEFUNCT */ + } + OPW( HREG_EV_ACK, ~HREG_EV_SLEEP_REQ ); +#if ( (HCF_TYPE) & HCF_TYPE_PRELOADED ) == 0 /*12*/ + (void)cmd_exe( ifbp, HCMD_INI, 0 ); +#endif // HCF_TYPE_PRELOADED +if ( io_base != HCF_DISCONNECT ) { + rc = init( ifbp ); /*14*/ + if ( rc == HCF_SUCCESS ) { + x.len = 2; + x.typ = CFG_NIC_BUS_TYPE; + (void)hcf_get_info( ifbp, &x ); + ifbp->IFB_BusType = x.val[0]; + //CFG_NIC_BUS_TYPE not supported -> default 32 bits/DMA, MSF has to overrule via CFG_CNTL_OPT + if ( x.len == 0 || x.val[0] == 0x0002 || x.val[0] == 0x0003 ) { +#if (HCF_IO) & HCF_IO_32BITS + ifbp->IFB_CntlOpt &= ~USE_16BIT; //reset USE_16BIT +#endif // HCF_IO_32BITS +#if HCF_DMA + ifbp->IFB_CntlOpt |= USE_DMA; //SET DMA +#else + ifbp->IFB_IORange = 0x40 /*i.s.o. HREG_IO_RANGE*/; +#endif // HCF_DMA + } + } + } else HCFASSERT( ( ifbp->IFB_Magic ^= HCF_MAGIC ) == 0, ifbp->IFB_Magic ) /*NOP*/; + /* of above HCFASSERT only the side effect is needed, NOP in case HCFASSERT is dummy */ + ifbp->IFB_IOBase = io_base; /* 0*/ + return rc; +} // hcf_connect + +#if HCF_DMA +/************************************************************************************************************ +* Function get_frame_lst +* - resolve the "last host-owned descriptor" problems when a descriptor list is reclaimed by the MSF. +* +* The FrameList to be reclaimed as well as the DescriptorList always start in IFB_FirstDesc[tx_rx_flag] +* and this is always the "current" DELWA Descriptor. +* +* If a FrameList is available, the last descriptor of the FrameList to turned into a new DELWA Descriptor: +* - a copy is made from the information in the last descriptor of the FrameList into the current +* DELWA Descriptor +* - the remainder of the DescriptorList is detached from the copy by setting the next_desc_addr at NULL +* - the DMA control bits of the copy are cleared to do not confuse the MSF +* - the copy of the last descriptor (i.e. the "old" DELWA Descriptor) is chained to the prev Descriptor +* of the FrameList, thus replacing the original last Descriptor of the FrameList. +* - IFB_FirstDesc is changed to the address of that replaced (original) last descriptor of the FrameList, +* i.e. the "new" DELWA Descriptor. +* +* This function makes a copy of that last host-owned descriptor, so the MSF will get a copy of the descriptor. +* On top of that, it adjusts DMA related fields in the IFB structure. + // perform a copying-scheme to circumvent the 'last host owned descriptor cannot be reclaimed' limitation imposed by H2.5's DMA hardware design + // a 'reclaim descriptor' should be available in the HCF: +* +* Returns: address of the first descriptor of the FrameList +* + 8: Be careful once you start re-ordering the steps in the copy process, that it still works for cases +* of FrameLists of 1, 2 and more than 2 descriptors +* +* Input parameters: +* tx_rx_flag : specifies 'transmit' or 'receive' descriptor. +* +************************************************************************************************************/ +HCF_STATIC DESC_STRCT* +get_frame_lst( IFBP ifbp, int tx_rx_flag ) +{ + +DESC_STRCT *head = ifbp->IFB_FirstDesc[tx_rx_flag]; +DESC_STRCT *copy, *p, *prev; + + HCFASSERT( tx_rx_flag == DMA_RX || tx_rx_flag == DMA_TX, tx_rx_flag ) + //if FrameList + if ( head ) { + //. search for last descriptor of first FrameList + p = prev = head; + while ( ( p->BUF_SIZE & DESC_EOP ) == 0 && p->next_desc_addr ) { + if ( ( ifbp->IFB_CntlOpt & DMA_ENABLED ) == 0 ) { //clear control bits when disabled + p->BUF_CNT &= DESC_CNT_MASK; + } + prev = p; + p = p->next_desc_addr; + } + //. if DMA enabled + if ( ifbp->IFB_CntlOpt & DMA_ENABLED ) { + //. . if last descriptor of FrameList is DMA owned + //. . or if FrameList is single (DELWA) Descriptor + if ( p->BUF_CNT & DESC_DMA_OWNED || head->next_desc_addr == NULL ) { + //. . . refuse to return FrameList to caller + head = NULL; + } + } + } + //if returnable FrameList found + if ( head ) { + //. if FrameList is single (DELWA) Descriptor (implies DMA disabled) + if ( head->next_desc_addr == NULL ) { + //. . clear DescriptorList + /*;?ifbp->IFB_LastDesc[tx_rx_flag] =*/ ifbp->IFB_FirstDesc[tx_rx_flag] = NULL; + //. else + } else { + //. . strip hardware-related bits from last descriptor + //. . remove DELWA Descriptor from head of DescriptorList + copy = head; + head = head->next_desc_addr; + //. . exchange first (Confined) and last (possibly imprisoned) Descriptor + copy->buf_phys_addr = p->buf_phys_addr; + copy->buf_addr = p->buf_addr; + copy->BUF_SIZE = p->BUF_SIZE &= DESC_CNT_MASK; //get rid of DESC_EOP and possibly DESC_SOP + copy->BUF_CNT = p->BUF_CNT &= DESC_CNT_MASK; //get rid of DESC_DMA_OWNED +#if (HCF_EXT) & HCF_DESC_STRCT_EXT + copy->DESC_MSFSup = p->DESC_MSFSup; +#endif // HCF_DESC_STRCT_EXT + //. . turn into a DELWA Descriptor + p->buf_addr = NULL; + //. . chain copy to prev /* 8*/ + prev->next_desc_addr = copy; + //. . detach remainder of the DescriptorList from FrameList + copy->next_desc_addr = NULL; + copy->next_desc_phys_addr = 0xDEAD0000; //! just to be nice, not really needed + //. . save the new start (i.e. DELWA Descriptor) in IFB_FirstDesc + ifbp->IFB_FirstDesc[tx_rx_flag] = p; + } + //. strip DESC_SOP from first descriptor + head->BUF_SIZE &= DESC_CNT_MASK; + //head->BUF_CNT &= DESC_CNT_MASK; get rid of DESC_DMA_OWNED + head->next_desc_phys_addr = 0xDEAD0000; //! just to be nice, not really needed + } + //return the just detached FrameList (if any) + return head; +} // get_frame_lst + + +/************************************************************************************************************ +* Function put_frame_lst +* +* This function +* +* Returns: address of the first descriptor of the FrameList +* +* Input parameters: +* tx_rx_flag : specifies 'transmit' or 'receive' descriptor. +* +* The following list should be kept in sync with hcf_dma_tx/rx_put, in order to get them in the WCI-spec !!!! +* Assert fails if +* - DMA is not enabled +* - descriptor list is NULL +* - a descriptor in the descriptor list is not double word aligned +* - a count of size field of a descriptor contains control bits, i.e. bits in the high order nibble. +* - the DELWA descriptor is not a "singleton" DescriptorList. +* - the DELWA descriptor is not the first Descriptor supplied +* - a non_DMA descriptor is supplied before the DELWA Descriptor is supplied +* - Possibly more checks could be added !!!!!!!!!!!!! + +*.NOTICE +* The asserts marked with *sc* are really sanity checks for the HCF, they can (supposedly) not be influenced +* by incorrect MSF behavior + + // The MSF is required to supply the HCF with a single descriptor for MSF tx reclaim purposes. + // This 'reclaim descriptor' can be recognized by the fact that its buf_addr field is zero. + ********************************************************************************************* + * Although not required from a hardware perspective: + * - make each descriptor in this rx-chain DMA-owned. + * - Also set the count to zero. EOP and SOP bits are also cleared. + *********************************************************************************************/ +HCF_STATIC void +put_frame_lst( IFBP ifbp, DESC_STRCT *descp, int tx_rx_flag ) +{ + DESC_STRCT *p = descp; + hcf_16 port; + + HCFASSERT( ifbp->IFB_CntlOpt & USE_DMA, ifbp->IFB_CntlOpt) //only hcf_dma_tx_put must also be DMA_ENABLED + HCFASSERT( tx_rx_flag == DMA_RX || tx_rx_flag == DMA_TX, tx_rx_flag ) + HCFASSERT( p , 0 ) + + while ( p ) { + HCFASSERT( ((hcf_32)p & 3 ) == 0, (hcf_32)p ) + HCFASSERT( (p->BUF_CNT & ~DESC_CNT_MASK) == 0, p->BUF_CNT ) + HCFASSERT( (p->BUF_SIZE & ~DESC_CNT_MASK) == 0, p->BUF_SIZE ) + p->BUF_SIZE &= DESC_CNT_MASK; //!!this SHOULD be superfluous in case of correct MSF + p->BUF_CNT &= tx_rx_flag == DMA_RX ? 0 : DESC_CNT_MASK; //!!this SHOULD be superfluous in case of correct MSF + p->BUF_CNT |= DESC_DMA_OWNED; + if ( p->next_desc_addr ) { +// HCFASSERT( p->buf_addr && p->buf_phys_addr && p->BUF_SIZE && +/- p->BUF_SIZE, ... ) + HCFASSERT( p->next_desc_addr->desc_phys_addr, (hcf_32)p->next_desc_addr ) + p->next_desc_phys_addr = p->next_desc_addr->desc_phys_addr; + } else { // + p->next_desc_phys_addr = 0; + if ( p->buf_addr == NULL ) { // DELWA Descriptor + HCFASSERT( descp == p, (hcf_32)descp ) //singleton DescriptorList + HCFASSERT( ifbp->IFB_FirstDesc[tx_rx_flag] == NULL, (hcf_32)ifbp->IFB_FirstDesc[tx_rx_flag]) + HCFASSERT( ifbp->IFB_LastDesc[tx_rx_flag] == NULL, (hcf_32)ifbp->IFB_LastDesc[tx_rx_flag]) + descp->BUF_CNT = 0; //&= ~DESC_DMA_OWNED; + ifbp->IFB_FirstDesc[tx_rx_flag] = descp; +// part of alternative ifbp->IFB_LastDesc[tx_rx_flag] = ifbp->IFB_FirstDesc[tx_rx_flag] = descp; + // if "recycling" a FrameList + // (e.g. called from hcf_cntl( HCF_CNTL_ENABLE ) + // . prepare for activation DMA controller +// part of alternative descp = descp->next_desc_addr; + } else { //a "real" FrameList, hand it over to the DMA engine + HCFASSERT( ifbp->IFB_FirstDesc[tx_rx_flag], (hcf_32)descp ) + HCFASSERT( ifbp->IFB_LastDesc[tx_rx_flag], (hcf_32)descp ) + HCFASSERT( ifbp->IFB_LastDesc[tx_rx_flag]->next_desc_addr == NULL, + (hcf_32)ifbp->IFB_LastDesc[tx_rx_flag]->next_desc_addr) +// p->buf_cntl.cntl_stat |= DESC_DMA_OWNED; + ifbp->IFB_LastDesc[tx_rx_flag]->next_desc_addr = descp; + ifbp->IFB_LastDesc[tx_rx_flag]->next_desc_phys_addr = descp->desc_phys_addr; + port = HREG_RXDMA_PTR32; + if ( tx_rx_flag ) { + p->BUF_SIZE |= DESC_EOP; // p points at the last descriptor in the caller-supplied descriptor chain + descp->BUF_SIZE |= DESC_SOP; + port = HREG_TXDMA_PTR32; + } + OUT_PORT_DWORD( (ifbp->IFB_IOBase + port), descp->desc_phys_addr ); + } + ifbp->IFB_LastDesc[tx_rx_flag] = p; + } + p = p->next_desc_addr; + } +} // put_frame_lst + + +/************************************************************************************************************ +* +*.MODULE DESC_STRCT* hcf_dma_rx_get( IFBP ifbp ) +*.PURPOSE decapsulate a message and provides that message to the MSF. +* reclaim all descriptors in the rx descriptor chain. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* +*.RETURNS +* pointer to a FrameList +* +*.DESCRIPTION +* hcf_dma_rx_get is intended to return a received frame when such a frame is deposited in Host memory by the +* DMA engine. In addition hcf_dma_rx_get can be used to reclaim all descriptors in the rx descriptor chain +* when the DMA Engine is disabled, e.g. as part of a driver unloading strategy. +* hcf_dma_rx_get must be called repeatedly by the MSF when hcf_service_nic signals availability of a rx frame +* through the HREG_EV_RDMAD flag of IFB_DmaPackets. The calling must stop when a NULL pointer is returned, at +* which time the HREG_EV_RDMAD flag is also cleared by the HCF to arm the mechanism for the next frame +* reception. +* Regardless whether the DMA Engine is currently enabled (as controlled via hcf_cntl), if the DMA controller +* deposited an Rx-frame in the Rx-DescriptorList, this frame is detached from the Rx-DescriptorList, +* transformed into a FrameList (i.e. updating the housekeeping fields in the descriptors) and returned to the +* caller. +* If no such Rx-frame is available in the Rx-DescriptorList, the behavior of hcf_dma_rx_get depends on the +* status of the DMA Engine. +* If the DMA Engine is enabled, a NULL pointer is returned. +* If the DMA Engine is disabled, the following strategy is used: +* - the complete Rx-DescriptorList is returned. The DELWA Descriptor is not part of the Rx-DescriptorList. +* - If there is no Rx-DescriptorList, the DELWA Descriptor is returned. +* - If there is no DELWA Descriptor, a NULL pointer is returned. +* +* If the MSF performs an disable/enable sequence without exhausting the Rx-DescriptorList as described above, +* the enable command will reset all house keeping information, i.e. already received but not yet by the MSF +* retrieved frames are lost and the next frame will be received starting with the oldest descriptor. +* +* The HCF can be used in 2 fashions: with and without decapsulation for data transfer. +* This is controlled at compile time by the HCF_ENC bit of the HCF_ENCAP system constant. +* If appropriate, decapsulation is done by moving some data inside the buffers and updating the descriptors +* accordingly. +*!! ;?????where did I describe why a simple manipulation with the count values does not suffice? +* +*.DIAGRAM +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ + +DESC_STRCT* +hcf_dma_rx_get (IFBP ifbp) +{ +DESC_STRCT *descp; // pointer to start of FrameList + + descp = get_frame_lst( ifbp, DMA_RX ); + if ( descp && descp->buf_addr ) //!be aware of the missing curly bracket + + //skip decapsulation at confined descriptor +#if (HCF_ENCAP) == HCF_ENC +#if (HCF_TYPE) & HCF_TYPE_CCX + if ( ifbp->IFB_CKIPStat == HCF_ACT_CCX_OFF ) +#endif // HCF_TYPE_CCX + { +int i; +DESC_STRCT *p = descp->next_desc_addr; //pointer to 2nd descriptor of frame + HCFASSERT(p, 0) + // The 2nd descriptor contains (maybe) a SNAP header plus part or whole of the payload. + //determine decapsulation sub-flag in RxFS + i = *(wci_recordp)&descp->buf_addr[HFS_STAT] & ( HFS_STAT_MSG_TYPE | HFS_STAT_ERR ); + if ( i == HFS_STAT_TUNNEL || + ( i == HFS_STAT_1042 && hcf_encap( (wci_bufp)&p->buf_addr[HCF_DASA_SIZE] ) != ENC_TUNNEL )) { + // The 2nd descriptor contains a SNAP header plus part or whole of the payload. + HCFASSERT( p->BUF_CNT == (p->buf_addr[5] + (p->buf_addr[4]<<8) + 2*6 + 2 - 8), p->BUF_CNT ) + // perform decapsulation + HCFASSERT(p->BUF_SIZE >=8, p->BUF_SIZE) + // move SA[2:5] in the second buffer to replace part of the SNAP header + for ( i=3; i >= 0; i--) p->buf_addr[i+8] = p->buf_addr[i]; + // copy DA[0:5], SA[0:1] from first buffer to second buffer + for ( i=0; i<8; i++) p->buf_addr[i] = descp->buf_addr[HFS_ADDR_DEST + i]; + // make first buffer shorter in count + descp->BUF_CNT = HFS_ADDR_DEST; + } + } +#endif // HCF_ENC + if ( descp == NULL ) ifbp->IFB_DmaPackets &= (hcf_16)~HREG_EV_RDMAD; //;?could be integrated into get_frame_lst + HCFLOGEXIT( HCF_TRACE_DMA_RX_GET ) + return descp; +} // hcf_dma_rx_get + + +/************************************************************************************************************ +* +*.MODULE void hcf_dma_rx_put( IFBP ifbp, DESC_STRCT *descp ) +*.PURPOSE supply buffers for receive purposes. +* supply the Rx-DELWA descriptor. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* descp address of a DescriptorList +* +*.RETURNS N.A. +* +*.DESCRIPTION +* This function is called by the MSF to supply the HCF with new/more buffers for receive purposes. +* The HCF can be used in 2 fashions: with and without encapsulation for data transfer. +* This is controlled at compile time by the HCF_ENC bit of the HCF_ENCAP system constant. +* As a consequence, some additional constaints apply to the number of descriptor and the buffers associated +* with the first 2 descriptors. Independent of the encapsulation feature, the COUNT fields are ignored. +* A special case is the supplying of the DELWA descriptor, which must be supplied as the first descriptor. +* +* Assert fails if +* - ifbp has a recognizable out-of-range value. +* - NIC interrupts are not disabled while required by parameter action. +* - in case decapsulation by the HCF is selected: +* - The first databuffer does not have the exact size corresponding with the RxFS up to the 802.3 DestAddr +* field (== 29 words). +* - The FrameList does not consists of at least 2 Descriptors. +* - The second databuffer does not have the minimum size of 8 bytes. +*!! The 2nd part of the list of asserts should be kept in sync with put_frame_lst, in order to get +*!! them in the WCI-spec !!!! +* - DMA is not enabled +* - descriptor list is NULL +* - a descriptor in the descriptor list is not double word aligned +* - a count of size field of a descriptor contains control bits, i.e. bits in the high order nibble. +* - the DELWA descriptor is not a "singleton" DescriptorList. +* - the DELWA descriptor is not the first Descriptor supplied +* - a non_DMA descriptor is supplied before the DELWA Descriptor is supplied +*!! - Possibly more checks could be added !!!!!!!!!!!!! +* +*.DIAGRAM +* +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +void +hcf_dma_rx_put( IFBP ifbp, DESC_STRCT *descp ) +{ + + HCFLOGENTRY( HCF_TRACE_DMA_RX_PUT, 0xDA01 ) + HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic ) + HCFASSERT_INT + + put_frame_lst( ifbp, descp, DMA_RX ); +#if HCF_ASSERT && (HCF_ENCAP) == HCF_ENC + if ( descp->buf_addr ) { + HCFASSERT( descp->BUF_SIZE == HCF_DMA_RX_BUF1_SIZE, descp->BUF_SIZE ) + HCFASSERT( descp->next_desc_addr, 0 ) // first descriptor should be followed by another descriptor + // The second DB is for SNAP and payload purposes. It should be a minimum of 12 bytes in size. + HCFASSERT( descp->next_desc_addr->BUF_SIZE >= 12, descp->next_desc_addr->BUF_SIZE ) + } +#endif // HCFASSERT / HCF_ENC + HCFLOGEXIT( HCF_TRACE_DMA_RX_PUT ) +} // hcf_dma_rx_put + + +/************************************************************************************************************ +* +*.MODULE DESC_STRCT* hcf_dma_tx_get( IFBP ifbp ) +*.PURPOSE DMA mode: reclaims and decapsulates packets in the tx descriptor chain if: +* - A Tx packet has been copied from host-RAM into NIC-RAM by the DMA engine +* - The Hermes/DMAengine have been disabled +* +*.ARGUMENTS +* ifbp address of the Interface Block +* +*.RETURNS +* pointer to a reclaimed Tx packet. +* +*.DESCRIPTION +* impact of the disable command: +* When a non-empty pool of Tx descriptors exists (created by means of hcf_dma_put_tx), the MSF +* is supposed to empty that pool by means of hcf_dma_tx_get calls after the disable in an +* disable/enable sequence. +* +*.DIAGRAM +* +*.NOTICE +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +DESC_STRCT* +hcf_dma_tx_get( IFBP ifbp ) +{ +DESC_STRCT *descp; // pointer to start of FrameList + + descp = get_frame_lst( ifbp, DMA_TX ); + if ( descp && descp->buf_addr ) //!be aware of the missing curly bracket + //skip decapsulation at confined descriptor +#if (HCF_ENCAP) == HCF_ENC + if ( ( descp->BUF_CNT == HFS_TYPE ) +#if (HCF_TYPE) & HCF_TYPE_CCX + || ( descp->BUF_CNT == HFS_DAT ) +#endif // HCF_TYPE_CCX + ) { // perform decapsulation if needed + descp->next_desc_addr->buf_phys_addr -= HCF_DASA_SIZE; + descp->next_desc_addr->BUF_CNT += HCF_DASA_SIZE; + } +#endif // HCF_ENC + if ( descp == NULL ) { //;?could be integrated into get_frame_lst + ifbp->IFB_DmaPackets &= (hcf_16)~HREG_EV_TDMAD; + } + HCFLOGEXIT( HCF_TRACE_DMA_TX_GET ) + return descp; +} // hcf_dma_tx_get + + +/************************************************************************************************************ +* +*.MODULE void hcf_dma_tx_put( IFBP ifbp, DESC_STRCT *descp, hcf_16 tx_cntl ) +*.PURPOSE puts a packet in the Tx DMA queue in host ram and kicks off the TxDma engine. +* supply the Tx-DELWA descriptor. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* descp address of Tx Descriptor Chain (i.e. a single Tx frame) +* tx_cntl indicates MAC-port and (Hermes) options +* +*.RETURNS N.A. +* +*.DESCRIPTION +* The HCF can be used in 2 fashions: with and without encapsulation for data transfer. +* This is controlled at compile time by the HCF_ENC bit of the HCF_ENCAP system constant. +* +* Regardless of the HCF_ENCAP system constant, the descriptor list created to describe the frame to be +* transmitted, must supply space to contain the 802.11 header, preceding the actual frame to be transmitted. +* Basically, this only supplies working storage to the HCF which passes this on to the DMA engine. +* As a consequence the contents of this space do not matter. +* Nevertheless BUF_CNT must take in account this storage. +* This working space to contain the 802.11 header may not be fragmented, the first buffer must be +* sufficiently large to contain at least the 802.11 header, i.e. HFS_ADDR_DEST (29 words or 0x3A bytes). +* This way, the HCF can simply, regardless whether or not the HCF encapsulates the frame, write the parameter +* tx_cntl at offset 0x36 (HFS_TX_CNTL) in the first buffer. +* Note that it is allowed to have part or all of the actual frame represented by the first descriptor as long +* as the requirement for storage for the 802.11 header is met, i.e. the 802.3 frame starts at offset +* HFS_ADDR_DEST. +* Except for the Assert on the 1st buffer in case of Encapsualtion, the SIZE fields are ignored. +* +* In case the encapsulation feature is compiled in, there are the following additional requirements. +* o The BUF_CNT of the first buffer changes from a minimum of 0x3A bytes to exactly 0x3A, i.e. the workspace +* to store the 802.11 header +* o The BUF_SIZE of the first buffer is at least the space needed to store the +* - 802.11 header (29 words) +* - 802.3 header, i.e. 12 bytes addressing information and 2 bytes length field +* - 6 bytes SNAP-header +* This results in 39 words or 0x4E bytes or HFS_TYPE. +* Note that if the BUF_SIZE is larger than 0x4E, this surplus is not used. +* o The actual frame begins in the 2nd descriptor (which is already implied by the BUF_CNT == 0x3A requirement) and the associated buffer contains at least the 802.3 header, i.e. the 14 bytes representing addressing information and length/type field +* +* When the HCF does not encapsulates (i.e. length/type field <= 1500), no changes are made to descriptors +* or buffers. +* +* When the HCF actually encapsulates (i.e. length/type field > 1500), it successively writes, starting at +* offset HFS_ADDR_DEST (0x3A) in the first buffer: +* - the 802.3 addressing information, copied from the begin of the second buffer +* - the frame length, derived from the total length of the individual fragments, corrected for the SNAP +* header length and Type field and ignoring the Destination Address, Source Address and Length field +* - the appropriate snap header (Tunnel or 1042, depending on the value of the type field). +* +* The information in the first two descriptors is adjusted accordingly: +* - the first descriptor count is changed from 0x3A to 0x4E (HFS_TYPE), which matches 0x3A + 12 + 2 + 6 +* - the second descriptor count is decreased by 12, being the moved addressing information +* - the second descriptor (physical) buffer address is increased by 12. +* +* When the descriptors are returned by hcf_dma_tx_get, the transformation of the first two descriptors is +* undone. +* +* Under any of the above scenarios, the assert BUF_CNT <= BUF_SIZE must be true for all descriptors +* In case of encapsulation, BUF_SIZE of the 1st descriptor is asserted to be at least HFS_TYPE (0x4E), so it is NOT tested. +* +* Assert fails if +* - ifbp has a recognizable out-of-range value. +* - tx_cntl has a recognizable out-of-range value. +* - NIC interrupts are not disabled while required by parameter action. +* - in case encapsulation by the HCF is selected: +* - The FrameList does not consists of at least 2 Descriptors. +* - The first databuffer does not contain exactly the (space for) the 802.11 header (== 28 words) +* - The first databuffer does not have a size to additionally accomodate the 802.3 header and the +* SNAP header of the frame after encapsulation (== 39 words). +* - The second databuffer does not contain at least DA, SA and 'type/length' (==14 bytes or 7 words) +*!! The 2nd part of the list of asserts should be kept in sync with put_frame_lst, in order to get +*!! them in the WCI-spec !!!! +* - DMA is not enabled +* - descriptor list is NULL +* - a descriptor in the descriptor list is not double word aligned +* - a count of size field of a descriptor contains control bits, i.e. bits in the high order nibble. +* - the DELWA descriptor is not a "singleton" DescriptorList. +* - the DELWA descriptor is not the first Descriptor supplied +* - a non_DMA descriptor is supplied before the DELWA Descriptor is supplied +*!! - Possibly more checks could be added !!!!!!!!!!!!! +*.DIAGRAM +* +*.NOTICE +* +*.ENDDOC END DOCUMENTATION +* +* +*1: Write tx_cntl parameter to HFS_TX_CNTL field into the Hermes-specific header in buffer 1 +*4: determine whether encapsulation is needed and write the type (tunnel or 1042) already at the appropriate +* offset in the 1st buffer +*6: Build the encapsualtion enveloppe in the free space at the end of the 1st buffer +* - Copy DA/SA fields from the 2nd buffer +* - Calculate total length of the message (snap-header + type-field + the length of all buffer fragments +* associated with the 802.3 frame (i.e all descriptors except the first), but not the DestinationAddress, +* SourceAddress and lenght-field) +* Assert the message length +* Write length. Note that the message is in BE format, hence on LE platforms the length must be converted +* ;? THIS IS NOT WHAT CURRENTLY IS IMPLEMENTED +* - Write snap header. Note that the last byte of the snap header is NOT copied, that byte is already in +* place as result of the call to hcf_encap. +* Note that there are many ways to skin a cat. To express the offsets in the 1st buffer while writing +* the snap header, HFS_TYPE is choosen as a reference point to make it easier to grasp that the snap header +* and encapsualtion type are at least relative in the right. +*8: modify 1st descriptor to reflect moved part of the 802.3 header + Snap-header +* modify 2nd descriptor to skip the moved part of the 802.3 header (DA/SA +*10: set each descriptor to 'DMA owned', clear all other control bits. +* Set SOP bit on first descriptor. Set EOP bit on last descriptor. +*12: Either append the current frame to an existing descriptor list or +*14: create a list beginning with the current frame +*16: remember the new end of the list +*20: hand the frame over to the DMA engine +************************************************************************************************************/ +void +hcf_dma_tx_put( IFBP ifbp, DESC_STRCT *descp, hcf_16 tx_cntl ) +{ +DESC_STRCT *p = descp->next_desc_addr; +int i; + +#if HCF_ASSERT + int x = ifbp->IFB_FWIdentity.comp_id == COMP_ID_FW_AP ? tx_cntl & ~HFS_TX_CNTL_PORT : tx_cntl; + HCFASSERT( (x & ~HCF_TX_CNTL_MASK ) == 0, tx_cntl ) +#endif // HCF_ASSERT + HCFLOGENTRY( HCF_TRACE_DMA_TX_PUT, 0xDA03 ) + HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic ) + HCFASSERT_INT + HCFASSERT( ( ifbp->IFB_CntlOpt & (USE_DMA|DMA_ENABLED) ) == (USE_DMA|DMA_ENABLED), ifbp->IFB_CntlOpt) + + if ( descp->buf_addr ) { + *(hcf_16*)(descp->buf_addr + HFS_TX_CNTL) = tx_cntl; /*1*/ +#if (HCF_ENCAP) == HCF_ENC + HCFASSERT( descp->next_desc_addr, 0 ) //at least 2 descripors + HCFASSERT( descp->BUF_CNT == HFS_ADDR_DEST, descp->BUF_CNT ) //exact length required for 1st buffer + HCFASSERT( descp->BUF_SIZE >= HCF_DMA_TX_BUF1_SIZE, descp->BUF_SIZE ) //minimal storage for encapsulation + HCFASSERT( p->BUF_CNT >= 14, p->BUF_CNT ); //at least DA, SA and 'type' in 2nd buffer + +#if (HCF_TYPE) & HCF_TYPE_CCX + /* if we are doing PPK +/- CMIC, or we are sending a DDP frame */ + if ( ( ifbp->IFB_CKIPStat == HCF_ACT_CCX_ON ) || + ( ( p->BUF_CNT >= 20 ) && ( ifbp->IFB_CKIPStat == HCF_ACT_CCX_OFF ) && + ( p->buf_addr[12] == 0xAA ) && ( p->buf_addr[13] == 0xAA ) && + ( p->buf_addr[14] == 0x03 ) && ( p->buf_addr[15] == 0x00 ) && + ( p->buf_addr[16] == 0x40 ) && ( p->buf_addr[17] == 0x96 ) && + ( p->buf_addr[18] == 0x00 ) && ( p->buf_addr[19] == 0x00 ))) + { + /* copy the DA/SA to the first buffer */ + for ( i = 0; i < HCF_DASA_SIZE; i++ ) { + descp->buf_addr[i + HFS_ADDR_DEST] = p->buf_addr[i]; + } + /* calculate the length of the second fragment only */ + i = 0; + do { i += p->BUF_CNT; } while( p = p->next_desc_addr ); + i -= HCF_DASA_SIZE ; + /* convert the length field to big endian, using the endian friendly macros */ + i = CNV_SHORT_TO_BIG(i); //!! this converts ONLY on LE platforms, how does that relate to the non-CCX code + *(hcf_16*)(&descp->buf_addr[HFS_LEN]) = (hcf_16)i; + descp->BUF_CNT = HFS_DAT; + // modify 2nd descriptor to skip the 'Da/Sa' fields + descp->next_desc_addr->buf_phys_addr += HCF_DASA_SIZE; + descp->next_desc_addr->BUF_CNT -= HCF_DASA_SIZE; + } + else +#endif // HCF_TYPE_CCX + { + descp->buf_addr[HFS_TYPE-1] = hcf_encap(&descp->next_desc_addr->buf_addr[HCF_DASA_SIZE]); /*4*/ + if ( descp->buf_addr[HFS_TYPE-1] != ENC_NONE ) { + for ( i=0; i < HCF_DASA_SIZE; i++ ) { /*6*/ + descp->buf_addr[i + HFS_ADDR_DEST] = descp->next_desc_addr->buf_addr[i]; + } + i = sizeof(snap_header) + 2 - ( 2*6 + 2 ); + do { i += p->BUF_CNT; } while ( ( p = p->next_desc_addr ) != NULL ); + *(hcf_16*)(&descp->buf_addr[HFS_LEN]) = CNV_END_SHORT(i); //!! this converts on ALL platforms, how does that relate to the CCX code + for ( i=0; i < sizeof(snap_header) - 1; i++) { + descp->buf_addr[HFS_TYPE - sizeof(snap_header) + i] = snap_header[i]; + } + descp->BUF_CNT = HFS_TYPE; /*8*/ + descp->next_desc_addr->buf_phys_addr += HCF_DASA_SIZE; + descp->next_desc_addr->BUF_CNT -= HCF_DASA_SIZE; + } + } +#endif // HCF_ENC + } + put_frame_lst( ifbp, descp, DMA_TX ); + HCFLOGEXIT( HCF_TRACE_DMA_TX_PUT ) +} // hcf_dma_tx_put + +#endif // HCF_DMA + +#if (HCF_DL_ONLY) == 0 +/************************************************************************************************************ +* +*.MODULE hcf_8 hcf_encap( wci_bufp type ) +*.PURPOSE test whether RFC1042 or Bridge-Tunnel encapsulation is needed. +* +*.ARGUMENTS +* type (Far) pointer to the (Big Endian) Type/Length field in the message +* +*.RETURNS +* ENC_NONE len/type is "len" ( (BIG_ENDIAN)type <= 1500 ) +* ENC_TUNNEL len/type is "type" and 0x80F3 or 0x8137 +* ENC_1042 len/type is "type" but not 0x80F3 or 0x8137 +* +*.CONDITIONS +* NIC Interrupts d.c +* +*.DESCRIPTION +* Type must point to the Len/Type field of the message, this is the 2-byte field immediately after the 6 byte +* Destination Address and 6 byte Source Address. The 2 successive bytes addressed by type are interpreted as +* a Big Endian value. If that value is less than or equal to 1500, the message is assumed to be in 802.3 +* format. Otherwise the message is assumed to be in Ethernet-II format. Depending on the value of Len/Typ, +* Bridge Tunnel or RFC1042 encapsulation is needed. +* +*.DIAGRAM +* +* 1: presume 802.3, hence preset return value at ENC_NONE +* 2: convert type from "network" Endian format to native Endian +* 4: the litmus test to distinguish type and len. +* The hard code "magic" value of 1500 is intentional and should NOT be replaced by a mnemonic because it is +* not related at all to the maximum frame size supported by the Hermes. +* 6: check type against: +* 0x80F3 //AppleTalk Address Resolution Protocol (AARP) +* 0x8137 //IPX +* to determine the type of encapsulation +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +#if HCF_ENCAP //i.e HCF_ENC or HCF_ENC_SUP +#if ! ( (HCF_ENCAP) & HCF_ENC_SUP ) +HCF_STATIC +#endif // HCF_ENCAP +hcf_8 +hcf_encap( wci_bufp type ) +{ + +hcf_8 rc = ENC_NONE; /* 1 */ +hcf_16 t = (hcf_16)(*type<<8) + *(type+1); /* 2 */ + + if ( t > 1500 ) { /* 4 */ + if ( t == 0x8137 || t == 0x80F3 ) { + rc = ENC_TUNNEL; /* 6 */ + } else { + rc = ENC_1042; + } + } + return rc; +} // hcf_encap +#endif // HCF_ENCAP +#endif // HCF_DL_ONLY + + +/************************************************************************************************************ +* +*.MODULE int hcf_get_info( IFBP ifbp, LTVP ltvp ) +*.PURPOSE Obtains transient and persistent configuration information from the Card and from the HCF. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* ltvp address of LengthTypeValue structure specifying the "what" and the "how much" of the +* information to be collected from the HCF or from the Hermes +* +*.RETURNS +* HCF_ERR_LEN The provided buffer was too small +* HCF_SUCCESS Success +*!! via cmd_exe ( type >= CFG_RID_FW_MIN ) +* HCF_ERR_NO_NIC NIC removed during retrieval +* HCF_ERR_TIME_OUT Expected Hermes event did not occure in expected time +*!! via cmd_exe and setup_bap (type >= CFG_RID_FW_MIN ) +* HCF_ERR_DEFUNCT_... HCF is in defunct mode (bits 0x7F reflect cause) +* +*.DESCRIPTION +* The T-field of the LTV-record (provided by the MSF in parameter ltvp) specifies the RID wanted. The RID +* information identified by the T-field is copied into the V-field. +* On entry, the L-field specifies the size of the buffer, also called the "Initial DataLength". The L-value +* includes the size of the T-field, but not the size of the L-field itself. +* On return, the L-field indicates the number of words actually contained by the Type and Value fields. +* As the size of the Type field in the LTV-record is included in the "Initial DataLength" of the record, the +* V-field can contain at most "Initial DataLength" - 1 words of data. +* Copying stops if either the complete Information is copied or if the number of words indicated by the +* "Initial DataLength" were copied. The "Initial DataLength" acts as a safe guard against Configuration +* Information blocks that have different sizes for different F/W versions, e.g. when later versions support +* more tallies than earlier versions. +* If the size of Value field of the RID exceeds the size of the "Initial DataLength" -1, as much data +* as fits is copied, and an error status of HCF_ERR_LEN is returned. +* +* It is the responsibility of the MSF to detect card removal and re-insertion and not call the HCF when the +* NIC is absent. The MSF cannot, however, timely detect a Card removal if the Card is removed while +* hcf_get_info is in progress. Therefore, the HCF performs its own check on Card presence after the read +* operation of the NIC data. If the Card is not present or removed during the execution of hcf_get_info, +* HCF_ERR_NO_NIC is returned and the content of the Data Buffer is unpredictable. This check is not performed +* in case of the "HCF embedded" pseudo RIDs like CFG_TALLIES. +* +* Assert fails if +* - ifbp has a recognizable out-of-range value. +* - reentrancy, may be caused by calling hcf_functions without adequate protection +* against NIC interrupts or multi-threading. +* - ltvp is a NULL pointer. +* - length field of the LTV-record at entry is 0 or 1 or has an excessive value (i.e. exceeds HCF_MAX_LTV). +* - type field of the LTV-record is invalid. +* +*.DIAGRAM +* Hcf_get_mb_info copies the contents of the oldest MailBox Info block in the MailBox to PC RAM. If len is +* less than the size of the MailBox Info block, only as much as fits in the PC RAM buffer is copied. After +* the copying the MailBox Read pointer is updated to point to the next MailBox Info block, hence the +* remainder of an "oversized" MailBox Info block is lost. The truncation of the MailBox Info block is NOT +* reflected in the return status. Note that hcf_get_info guarantees the length of the PC RAM buffer meets +* the minimum requirements of at least 2, so no PC RAM buffer overrun. +* +* Calling hcf_get_mb_info when their is no MailBox Info block available or when there is no MailBox at all, +* results in a "NULL" MailBox Info block. +* +*12: see NOTICE +*17: The return status of cmd_wait and the first hcfio_in_string can be ignored, because when one fails, the +* other fails via the IFB_DefunctStat mechanism +*20: "HCFASSERT( rc == HCF_SUCCESS, rc )" is not suitable because this will always trigger as side effect of +* the HCFASSERT in hcf_put_info which calls hcf_get_info to figure out whether the RID exists at all. + +*.NOTICE +* +* "HCF embedded" pseudo RIDs: +* CFG_MB_INFO, CFG_TALLIES, CFG_DRV_IDENTITY, CFG_DRV_SUP_RANGE, CFG_DRV_ACT_RANGES_PRI, +* CFG_DRV_ACT_RANGES_STA, CFG_DRV_ACT_RANGES_HSI +* Note the HCF_ERR_LEN is NOT adequately set, when L >= 2 but less than needed +* +* Remarks: Transfers operation information and transient and persistent configuration information from the +* Card and from the HCF to the MSF. +* The exact layout of the provided data structure depends on the action code. Copying stops if either the +* complete Configuration Information is copied or if the number of bytes indicated by len is copied. Len +* acts as a safe guard against Configuration Information blocks which have different sizes for different +* Hermes versions, e.g. when later versions support more tallies than earlier versions. It is a conscious +* decision that unused parts of the PC RAM buffer are not cleared. +* +* Remarks: The only error against which is protected is the "Read error" as result of Card removal. Only the +* last hcf_io_string need to be protected because if the first fails the second will fail as well. Checking +* for cmd_exe errors is supposed superfluous because problems in cmd_exe are already caught or will be +* caught by hcf_enable. +* +* CFG_MB_INFO: copy the oldest MailBox Info Block or the "null" block if none available. +* +* The mechanism to HCF_ASSERT on invalid typ-codes in the LTV record is based on the following strategy: +* - during the pseudo-asynchronous Hermes commands (diagnose, download) only CFG_MB_INFO is acceptable +* - some codes (e.g. CFG_TALLIES) are explicitly handled by the HCF which implies that these codes +* are valid +* - all other codes in the range 0xFC00 through 0xFFFF are passed to the Hermes. The Hermes returns an +* LTV record with a zero value in the L-field for all Typ-codes it does not recognize. This is +* defined and intended behavior, so HCF_ASSERT does not catch on this phenomena. +* - all remaining codes are invalid and cause an ASSERT. +* +*.CONDITIONS +* In case of USB, HCF_MAX_MSG ;?USED;? to limit the amount of data that can be retrieved via hcf_get_info. +* +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +int +hcf_get_info( IFBP ifbp, LTVP ltvp ) +{ + +int rc = HCF_SUCCESS; +hcf_16 len = ltvp->len; +hcf_16 type = ltvp->typ; +wci_recordp p = <vp->len; //destination word pointer (in LTV record) +hcf_16 *q = NULL; /* source word pointer Note!! DOS COM can't cope with FAR + * as a consequence MailBox must be near which is usually true anyway + */ +int i; + + HCFLOGENTRY( HCF_TRACE_GET_INFO, ltvp->typ ) + HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic ) + HCFASSERT_INT + HCFASSERT( ltvp, 0 ) + HCFASSERT( 1 < ltvp->len && ltvp->len <= HCF_MAX_LTV + 1, MERGE_2( ltvp->typ, ltvp->len ) ) + + ltvp->len = 0; //default to: No Info Available +#if defined MSF_COMPONENT_ID || (HCF_EXT) & HCF_EXT_MB //filter out all specials + for ( i = 0; ( q = xxxx[i] ) != NULL && q[1] != type; i++ ) /*NOP*/; +#endif // MSF_COMPONENT_ID / HCF_EXT_MB +#if HCF_TALLIES + if ( type == CFG_TALLIES ) { /*3*/ + (void)hcf_action( ifbp, HCF_ACT_TALLIES ); + q = (hcf_16*)&ifbp->IFB_TallyLen; + } +#endif // HCF_TALLIES +#if (HCF_EXT) & HCF_EXT_MB + if ( type == CFG_MB_INFO ) { + if ( ifbp->IFB_MBInfoLen ) { + if ( ifbp->IFB_MBp[ifbp->IFB_MBRp] == 0xFFFF ) { + ifbp->IFB_MBRp = 0; //;?Probably superfluous + } + q = &ifbp->IFB_MBp[ifbp->IFB_MBRp]; + ifbp->IFB_MBRp += *q + 1; //update read pointer + if ( ifbp->IFB_MBp[ifbp->IFB_MBRp] == 0xFFFF ) { + ifbp->IFB_MBRp = 0; + } + ifbp->IFB_MBInfoLen = ifbp->IFB_MBp[ifbp->IFB_MBRp]; + } + } +#endif // HCF_EXT_MB + if ( q != NULL ) { //a special or CFG_TALLIES or CFG_MB_INFO + i = min( len, *q ) + 1; //total size of destination (including T-field) + while ( i-- ) { + *p++ = *q; +#if (HCF_TALLIES) & HCF_TALLIES_RESET + if ( q > &ifbp->IFB_TallyTyp && type == CFG_TALLIES ) { + *q = 0; + } +#endif // HCF_TALLIES_RESET + q++; + } + } else { // not a special nor CFG_TALLIES nor CFG_MB_INFO + if ( type == CFG_CNTL_OPT ) { //read back effective options + ltvp->len = 2; + ltvp->val[0] = ifbp->IFB_CntlOpt; +#if (HCF_EXT) & HCF_EXT_NIC_ACCESS + } else if ( type == CFG_PROD_DATA ) { //only needed for some test tool on top of H-II NDIS driver +hcf_io io_port; +wci_bufp pt; //pointer with the "right" type, just to help ease writing macros with embedded assembly + OPW( HREG_AUX_PAGE, (hcf_16)(PLUG_DATA_OFFSET >> 7) ); + OPW( HREG_AUX_OFFSET, (hcf_16)(PLUG_DATA_OFFSET & 0x7E) ); + io_port = ifbp->IFB_IOBase + HREG_AUX_DATA; //to prevent side effects of the MSF-defined macro + p = ltvp->val; //destination char pointer (in LTV record) + if ( ( i = len - 1 ) > 0 ) { + pt = (wci_bufp)p; //just to help ease writing macros with embedded assembly + IN_PORT_STRING_8_16( io_port, pt, i ); //space used by T: -1 + } + } else if ( type == CFG_CMD_HCF ) { +#define P ((CFG_CMD_HCF_STRCT FAR *)ltvp) + HCFASSERT( P->cmd == CFG_CMD_HCF_REG_ACCESS, P->cmd ) //only Hermes register access supported + if ( P->cmd == CFG_CMD_HCF_REG_ACCESS ) { + HCFASSERT( P->mode < ifbp->IFB_IOBase, P->mode ) //Check Register space + ltvp->len = min( len, 4 ); //RESTORE ltv length + P->add_info = IPW( P->mode ); + } +#undef P +#endif // HCF_EXT_NIC_ACCESS +#if (HCF_ASSERT) & HCF_ASSERT_PRINTF + } else if (type == CFG_FW_PRINTF) { + rc = fw_printf(ifbp, (CFG_FW_PRINTF_STRCT*)ltvp); +#endif // HCF_ASSERT_PRINTF + } else if ( type >= CFG_RID_FW_MIN ) { +//;? by using HCMD_BUSY option when calling cmd_exe, using a get_frag with length 0 just to set up the +//;? BAP and calling cmd_cmpl, you could merge the 2 Busy waits. Whether this really helps (and what +//;? would be the optimal sequence in cmd_exe and get_frag) would have to be MEASURED +/*17*/ if ( ( rc = cmd_exe( ifbp, HCMD_ACCESS, type ) ) == HCF_SUCCESS && + ( rc = setup_bap( ifbp, type, 0, IO_IN ) ) == HCF_SUCCESS ) { + get_frag( ifbp, (wci_bufp)<vp->len, 2*len+2 BE_PAR(2) ); + if ( IPW( HREG_STAT ) == 0xFFFF ) { //NIC removal test + ltvp->len = 0; + HCFASSERT( DO_ASSERT, type ) + } + } +/*12*/ } else HCFASSERT( DO_ASSERT, type ) /*NOP*/; //NOP in case HCFASSERT is dummy + } + if ( len < ltvp->len ) { + ltvp->len = len; + if ( rc == HCF_SUCCESS ) { + rc = HCF_ERR_LEN; + } + } + HCFASSERT( rc == HCF_SUCCESS || ( rc == HCF_ERR_LEN && ifbp->IFB_AssertTrace & 1<typ ) + HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic ) + HCFASSERT_INT + HCFASSERT( ltvp, 0 ) + HCFASSERT( 1 < ltvp->len && ltvp->len <= HCF_MAX_LTV + 1, ltvp->len ) + + //all codes between 0xFA00 and 0xFCFF are passed to Hermes +#if (HCF_TYPE) & HCF_TYPE_WPA + { hcf_16 i; + hcf_32 FAR * key_p; + + if ( ltvp->typ == CFG_ADD_TKIP_DEFAULT_KEY || ltvp->typ == CFG_ADD_TKIP_MAPPED_KEY ) { + key_p = (hcf_32*)((CFG_ADD_TKIP_MAPPED_KEY_STRCT FAR *)ltvp)->tx_mic_key; + i = TX_KEY; //i.e. TxKeyIndicator == 1, KeyID == 0 + if ( ltvp->typ == CFG_ADD_TKIP_DEFAULT_KEY ) { + key_p = (hcf_32*)((CFG_ADD_TKIP_DEFAULT_KEY_STRCT FAR *)ltvp)->tx_mic_key; + i = CNV_LITTLE_TO_SHORT(((CFG_ADD_TKIP_DEFAULT_KEY_STRCT FAR *)ltvp)->tkip_key_id_info); + } + if ( i & TX_KEY ) { /* TxKeyIndicator == 1 + (either really set by MSF in case of DEFAULT or faked by HCF in case of MAPPED ) */ + ifbp->IFB_MICTxCntl = (hcf_16)( HFS_TX_CNTL_MIC | (i & KEY_ID )<<8 ); + ifbp->IFB_MICTxKey[0] = CNV_LONGP_TO_LITTLE( key_p ); + ifbp->IFB_MICTxKey[1] = CNV_LONGP_TO_LITTLE( (key_p+1) ); + } + i = ( i & KEY_ID ) * 2; + ifbp->IFB_MICRxKey[i] = CNV_LONGP_TO_LITTLE( (key_p+2) ); + ifbp->IFB_MICRxKey[i+1] = CNV_LONGP_TO_LITTLE( (key_p+3) ); + } +#define P ((CFG_REMOVE_TKIP_DEFAULT_KEY_STRCT FAR *)ltvp) + if ( ( ltvp->typ == CFG_REMOVE_TKIP_MAPPED_KEY ) || + ( ltvp->typ == CFG_REMOVE_TKIP_DEFAULT_KEY && + ( (ifbp->IFB_MICTxCntl >> 8) & KEY_ID ) == CNV_SHORT_TO_LITTLE(P->tkip_key_id ) + ) + ) { ifbp->IFB_MICTxCntl = 0; } //disable MIC-engine +#undef P + } +#endif // HCF_TYPE_WPA + + if ( ltvp->typ == CFG_PROG ) { + rc = download( ifbp, (CFG_PROG_STRCT FAR *)ltvp ); + } else switch (ltvp->typ) { +#if (HCF_ASSERT) & HCF_ASSERT_RT_MSF_RTN + case CFG_REG_ASSERT_RTNP: //Register MSF Routines +#define P ((CFG_REG_ASSERT_RTNP_STRCT FAR *)ltvp) + ifbp->IFB_AssertRtn = P->rtnp; +// ifbp->IFB_AssertLvl = P->lvl; //TODO not yet supported so default is set in hcf_connect + HCFASSERT( DO_ASSERT, MERGE_2( HCF_ASSERT, 0xCAF1 ) ) //just to proof that the complete assert machinery is working +#undef P + break; +#endif // HCF_ASSERT_RT_MSF_RTN +#if (HCF_EXT) & HCF_EXT_INFO_LOG + case CFG_REG_INFO_LOG: //Register Log filter + ifbp->IFB_RIDLogp = ((CFG_RID_LOG_STRCT FAR*)ltvp)->recordp; + break; +#endif // HCF_EXT_INFO_LOG + case CFG_CNTL_OPT: //overrule option + HCFASSERT( ( ltvp->val[0] & ~(USE_DMA | USE_16BIT) ) == 0, ltvp->val[0] ) + if ( ( ltvp->val[0] & USE_DMA ) == 0 ) ifbp->IFB_CntlOpt &= ~USE_DMA; + ifbp->IFB_CntlOpt |= ltvp->val[0] & USE_16BIT; + break; +#if (HCF_EXT) & HCF_EXT_MB + case CFG_REG_MB: //Register MailBox +#define P ((CFG_REG_MB_STRCT FAR *)ltvp) + HCFASSERT( ( (hcf_32)P->mb_addr & 0x0001 ) == 0, (hcf_32)P->mb_addr ) + HCFASSERT( (P)->mb_size >= 60, (P)->mb_size ) + ifbp->IFB_MBp = P->mb_addr; + /* if no MB present, size must be 0 for ;?the old;? put_info_mb to work correctly */ + ifbp->IFB_MBSize = ifbp->IFB_MBp == NULL ? 0 : P->mb_size; + ifbp->IFB_MBWp = ifbp->IFB_MBRp = 0; + ifbp->IFB_MBp[0] = 0; //flag the MailBox as empty + ifbp->IFB_MBInfoLen = 0; + HCFASSERT( ifbp->IFB_MBSize >= 60 || ifbp->IFB_MBp == NULL, ifbp->IFB_MBSize ) +#undef P + break; + case CFG_MB_INFO: //store MailBoxInfoBlock + rc = put_info_mb( ifbp, (CFG_MB_INFO_STRCT FAR *)ltvp ); + break; +#endif // HCF_EXT_MB + +#if (HCF_EXT) & HCF_EXT_NIC_ACCESS + case CFG_CMD_NIC: +#define P ((CFG_CMD_NIC_STRCT FAR *)ltvp) + OPW( HREG_PARAM_2, P->parm2 ); + OPW( HREG_PARAM_1, P->parm1 ); + rc = cmd_exe( ifbp, P->cmd, P->parm0 ); + P->hcf_stat = (hcf_16)rc; + P->stat = IPW( HREG_STAT ); + P->resp0 = IPW( HREG_RESP_0 ); + P->resp1 = IPW( HREG_RESP_1 ); + P->resp2 = IPW( HREG_RESP_2 ); + P->ifb_err_cmd = ifbp->IFB_ErrCmd; + P->ifb_err_qualifier = ifbp->IFB_ErrQualifier; +#undef P + break; + case CFG_CMD_HCF: +#define P ((CFG_CMD_HCF_STRCT FAR *)ltvp) + HCFASSERT( P->cmd == CFG_CMD_HCF_REG_ACCESS, P->cmd ) //only Hermes register access supported + if ( P->cmd == CFG_CMD_HCF_REG_ACCESS ) { + HCFASSERT( P->mode < ifbp->IFB_IOBase, P->mode ) //Check Register space + OPW( P->mode, P->add_info); + } +#undef P + break; +#endif // HCF_EXT_NIC_ACCESS + +#if (HCF_ASSERT) & HCF_ASSERT_PRINTF + case CFG_FW_PRINTF_BUFFER_LOCATION: + ifbp->IFB_FwPfBuff = *(CFG_FW_PRINTF_BUFFER_LOCATION_STRCT*)ltvp; + break; +#endif // HCF_ASSERT_PRINTF + + default: //pass everything unknown above the "FID" range to the Hermes or Dongle + rc = put_info( ifbp, ltvp ); + } + //DO NOT !!! HCFASSERT( rc == HCF_SUCCESS, rc ) /* 20 */ + HCFLOGEXIT( HCF_TRACE_PUT_INFO ) + return rc; +} // hcf_put_info + + +#if (HCF_DL_ONLY) == 0 +/************************************************************************************************************ +* +*.MODULE int hcf_rcv_msg( IFBP ifbp, DESC_STRCT *descp, unsigned int offset ) +*.PURPOSE All: decapsulate a message. +* pre-HermesII.5: verify MIC. +* non-USB, non-DMA mode: Transfer a message from the NIC to the Host and acknowledge reception. +* USB: Transform a message from proprietary USB format to 802.3 format +* +*.ARGUMENTS +* ifbp address of the Interface Block +* descp Pointer to the Descriptor List location. +* offset USB: not used +* non-USB: specifies the beginning of the data to be obtained (0 corresponds with DestAddr field +* of frame). +* +*.RETURNS +* HCF_SUCCESS No SSN error ( or HCF_ERR_MIC already reported by hcf_service_nic) +* HCF_ERR_MIC message contains an erroneous MIC ( HCF_SUCCESS is reported if HCF_ERR_MIC is already +* reported by hcf_service_nic) +* HCF_ERR_NO_NIC NIC removed during data retrieval +* HCF_ERR_DEFUNCT... +* +*.DESCRIPTION +* The Receive Message Function can be executed by the MSF to obtain the Data Info fields of the message that +* is reported to be available by the Service NIC Function. +* +* The Receive Message Function copies the message data available in the Card memory into a buffer structure +* provided by the MSF. +* Only data of the message indicated by the Service NIC Function can be obtained. +* Execution of the Service NIC function may result in the availability of a new message, but it definitely +* makes the message reported by the preceding Service NIC function, unavailable. +* +* in non-USB/non-DMA mode, hcf_rcv_msg starts the copy process at the (non-negative) offset requested by the +* parameter offset, relative to HFS_ADDR_DEST, e.g offset 0 starts copying from the Destination Address, the +* very begin of the 802.3 frame message. Offset must either lay within the part of the 802.3 frame as stored +* by hcf_service_nic in the lookahead buffer or be just behind it, i.e. the first byte not yet read. +* When offset is within lookahead, data is copied from lookahead. +* When offset is beyond lookahead, data is read directly from RxFS in NIC with disregard of the actual value +* of offset +* +*.NOTICE: +* o at entry: look ahead buffer as passed with hcf_service_nic is still accessible and unchanged +* o at exit: Receive Frame in NIC memory is released +* +* Description: +* Starting at the byte indicated by the Offset value, the bytes are copied from the Data Info +* Part of the current Receive Frame Structure to the Host memory data buffer structure +* identified by descp. +* The maximum value for Offset is the number of characters of the 802.3 frame read into the +* look ahead buffer by hcf_service_nic (i.e. the look ahead buffer size minus +* Control and 802.11 fields) +* If Offset is less than the maximum value, copying starts from the look ahead buffer till the +* end of that buffer is reached +* Then (or if the maximum value is specified for Offset), the +* message is directly copied from NIC memory to Host memory. +* If an invalid (i.e. too large) offset is specified, an assert catches but the buffer contents are +* undefined. +* Copying stops if either: +* o the end of the 802.3 frame is reached +* o the Descriptor with a NULL pointer in the next_desc_addr field is reached +* +* When the copying stops, the receiver is ack'ed, thus freeing the NIC memory where the frame is stored +* As a consequence, hcf_rcv_msg can only be called once for any particular Rx frame. +* +* For the time being (PCI Bus mastering not yet supported), only the following fields of each +* of the descriptors in the descriptor list must be set by the MSF: +* o buf_cntl.buf_dim[1] +* o *next_desc_addr +* o *buf_addr +* At return from hcf_rcv_msg, the field buf_cntl.buf_dim[0] of the used Descriptors reflects +* the number of bytes in the buffer corresponding with the Descriptor. +* On the last used Descriptor, buf_cntl.buf_dim[0] is less or equal to buf_cntl.buf_dim[1]. +* On all preceding Descriptors buf_cntl.buf_dim[0] is equal to buf_cntl.buf_dim[1]. +* On all succeeding (unused) Descriptors, buf_cntl.buf_dim[0] is zero. +* Note: this I/F is based on the assumptions how the I/F needed for PCI Bus mastering will +* be, so it may change. +* +* The most likely handling of HCF_ERR_NO_NIC by the MSF is to drop the already copied +* data as elegantly as possible under the constraints and requirements posed by the (N)OS. +* If no received Frame Structure is pending, "Success" rather than "Read error" is returned. +* This error constitutes a logic flaw in the MSF +* The HCF can only catch a minority of this +* type of errors +* Based on consistency ideas, the HCF catches none of these errors. +* +* Assert fails if +* - ifbp has a recognizable out-of-range value +* - there is no unacknowledged Rx-message available +* - offset is out of range (outside look ahead buffer) +* - descp is a NULL pointer +* - any of the descriptors is not double word aligned +* - reentrancy, may be caused by calling hcf_functions without adequate protection +* against NIC interrupts or multi-threading. +* - Interrupts are enabled. +* +*.DIAGRAM +* +*.NOTICE +* - by using unsigned int as type for offset, no need to worry about negative offsets +* - Asserting on being enabled/present is superfluous, since a non-zero IFB_lal implies that hcf_service_nic +* was called and detected a Rx-message. A zero IFB_lal will set the BUF_CNT field of at least the first +* descriptor to zero. +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +int +hcf_rcv_msg( IFBP ifbp, DESC_STRCT *descp, unsigned int offset ) +{ +int rc = HCF_SUCCESS; +wci_bufp cp; //char oriented working pointer +hcf_16 i; +int tot_len = ifbp->IFB_RxLen - offset; //total length +wci_bufp lap = ifbp->IFB_lap + offset; //start address in LookAhead Buffer +hcf_16 lal = ifbp->IFB_lal - offset; //available data within LookAhead Buffer +hcf_16 j; + + HCFLOGENTRY( HCF_TRACE_RCV_MSG, offset ) + HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic ) + HCFASSERT_INT + HCFASSERT( descp, HCF_TRACE_RCV_MSG ) + HCFASSERT( ifbp->IFB_RxLen, HCF_TRACE_RCV_MSG ) + HCFASSERT( ifbp->IFB_RxLen >= offset, MERGE_2( offset, ifbp->IFB_RxLen ) ) + HCFASSERT( ifbp->IFB_lal >= offset, offset ) + HCFASSERT( (ifbp->IFB_CntlOpt & USE_DMA) == 0, 0xDADA ) + + if ( tot_len < 0 ) { + lal = 0; tot_len = 0; //suppress all copying activity in the do--while loop + } + do { //loop over all available fragments + // obnoxious hcf.c(1480) : warning C4769: conversion of near pointer to long integer + HCFASSERT( ((hcf_32)descp & 3 ) == 0, (hcf_32)descp ) + cp = descp->buf_addr; + j = min( (hcf_16)tot_len, descp->BUF_SIZE ); //minimum of "what's` available" and fragment size + descp->BUF_CNT = j; + tot_len -= j; //adjust length still to go + if ( lal ) { //if lookahead Buffer not yet completely copied + i = min( lal, j ); //minimum of "what's available" in LookAhead and fragment size + lal -= i; //adjust length still available in LookAhead + j -= i; //adjust length still available in current fragment + /*;? while loop could be improved by moving words but that is complicated on platforms with + * alignment requirements*/ + while ( i-- ) *cp++ = *lap++; + } + if ( j ) { //if LookAhead Buffer exhausted but still space in fragment, copy directly from NIC RAM + get_frag( ifbp, cp, j BE_PAR(0) ); + CALC_RX_MIC( cp, j ); + } + } while ( ( descp = descp->next_desc_addr ) != NULL ); +#if (HCF_TYPE) & HCF_TYPE_WPA + if ( ifbp->IFB_RxFID ) { + rc = check_mic( ifbp ); //prevents MIC error report if hcf_service_nic already consumed all + } +#endif // HCF_TYPE_WPA + (void)hcf_action( ifbp, HCF_ACT_RX_ACK ); //only 1 shot to get the data, so free the resources in the NIC + HCFASSERT( rc == HCF_SUCCESS, rc ) + HCFLOGEXIT( HCF_TRACE_RCV_MSG ) + return rc; +} // hcf_rcv_msg +#endif // HCF_DL_ONLY + + +#if (HCF_DL_ONLY) == 0 +/************************************************************************************************************ +* +*.MODULE int hcf_send_msg( IFBP ifbp, DESC_STRCT *descp, hcf_16 tx_cntl ) +*.PURPOSE Encapsulate a message and append padding and MIC. +* non-USB: Transfers the resulting message from Host to NIC and initiates transmission. +* USB: Transfer resulting message into a flat buffer. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* descp pointer to the DescriptorList or NULL +* tx_cntl indicates MAC-port and (Hermes) options +* HFS_TX_CNTL_SPECTRALINK +* HFS_TX_CNTL_PRIO +* HFS_TX_CNTL_TX_OK +* HFS_TX_CNTL_TX_EX +* HFS_TX_CNTL_TX_DELAY +* HFS_TX_CNTL_TX_CONT +* HCF_PORT_0 MAC Port 0 (default) +* HCF_PORT_1 (AP only) MAC Port 1 +* HCF_PORT_2 (AP only) MAC Port 2 +* HCF_PORT_3 (AP only) MAC Port 3 +* HCF_PORT_4 (AP only) MAC Port 4 +* HCF_PORT_5 (AP only) MAC Port 5 +* HCF_PORT_6 (AP only) MAC Port 6 +* +*.RETURNS +* HCF_SUCCESS +* HCF_ERR_DEFUNCT_.. +* HCF_ERR_TIME_OUT +* +*.DESCRIPTION: +* The Send Message Function embodies 2 functions: +* o transfers a message (including MAC header) from the provided buffer structure in Host memory to the Transmit +* Frame Structure (TxFS) in NIC memory. +* o Issue a send command to the F/W to actually transmit the contents of the TxFS. +* +* Control is based on the Resource Indicator IFB_RscInd. +* The Resource Indicator is maintained by the HCF and should only be interpreted but not changed by the MSF. +* The MSF must check IFB_RscInd to be non-zero before executing the call to the Send Message Function. +* When no resources are available, the MSF must handle the queuing of the Transmit frame and check the +* Resource Indicator periodically after calling hcf_service_nic. +* +* The Send Message Functions transfers a message to NIC memory when it is called with a non-NULL descp. +* Before the Send Message Function is invoked this way, the Resource Indicator (IFB_RscInd) must be checked. +* If the Resource is not available, Send Message Function execution must be postponed until after processing of +* a next hcf_service_nic it appears that the Resource has become available. +* The message is copied from the buffer structure identified by descp to the NIC. +* Copying stops if a NULL pointer in the next_desc_addr field is reached. +* Hcf_send_msg does not check for transmit buffer overflow, because the F/W does this protection. +* In case of a transmit buffer overflow, the surplus which does not fit in the buffer is simply dropped. +* +* The Send Message Function activates the F/W to actually send the message to the medium when the +* HFS_TX_CNTL_TX_DELAY bit of the tx_cntl parameter is not set. +* If the descp parameter of the current call is non-NULL, the message as represented by descp is send. +* If the descp parameter of the current call is NULL, and if the preceding call of the Send Message Function had +* a non-NULL descp and the preceding call had the HFS_TX_CNTL_TX_DELAY bit of tx_cntl set, then the message as +* represented by the descp of the preceding call is send. +* +* Hcf_send_msg supports encapsulation (see HCF_ENCAP) of Ethernet-II frames. +* An Ethernet-II frame is transferred to the Transmit Frame structure as an 802.3 frame. +* Hcf_send_msg distinguishes between an 802.3 and an Ethernet-II frame by looking at the data length/type field +* of the frame. If this field contains a value larger than 1514, the frame is considered to be an Ethernet-II +* frame, otherwise it is treated as an 802.3 frame. +* To ease implementation of the HCF, this type/type field must be located in the first descriptor structure, +* i.e. the 1st fragment must have a size of at least 14 (to contain DestAddr, SrcAddr and Len/Type field). +* An Ethernet-II frame is encapsulated by inserting a SNAP header between the addressing information and the +* type field. This insertion is transparent for the MSF. +* The HCF contains a fixed table that stores a number of types. If the value specified by the type/type field +* occurs in this table, Bridge Tunnel Encapsulation is used, otherwise RFC1042 encapsulation is used. +* Bridge Tunnel uses AA AA 03 00 00 F8 as SNAP header, +* RFC1042 uses AA AA 03 00 00 00 as SNAP header. +* The table currently contains: +* 0 0x80F3 AppleTalk Address Resolution Protocol (AARP) +* 0 0x8137 IPX +* +* The algorithm to distinguish between 802.3 and Ethernet-II frames limits the maximum length for frames of +* 802.3 frames to 1514 bytes. +* Encapsulation can be suppressed by means of the system constant HCF_ENCAP, e.g. to support proprietary +* protocols with 802.3 like frames with a size larger than 1514 bytes. +* +* In case the HCF encapsulates the frame, the number of bytes that is actually transmitted is determined by the +* cumulative value of the buf_cntl.buf_dim[0] fields. +* In case the HCF does not encapsulate the frame, the number of bytes that is actually transmitted is not +* determined by the cumulative value of the buf_cntl.buf_dim[DESC_CNTL_CNT] fields of the desc_strct's but by +* the Length field of the 802.3 frame. +* If there is a conflict between the cumulative value of the buf_cntl.buf_dim[0] fields and the +* 802.3 Length field the 802.3 Length field determines the number of bytes actually transmitted by the NIC while +* the cumulative value of the buf_cntl.buf_dim[0] fields determines the position of the MIC, hence a mismatch +* will result in MIC errors on the Receiving side. +* Currently this problem is flagged on the Transmit side by an Assert. +* The following fields of each of the descriptors in the descriptor list must be set by the MSF: +* o buf_cntl.buf_dim[0] +* o *next_desc_addr +* o *buf_addr +* +* All bits of the tx_cntl parameter except HFS_TX_CNTL_TX_DELAY and the HCF_PORT# bits are passed to the F/W via +* the HFS_TX_CNTL field of the TxFS. +* +* Note that hcf_send_msg does not detect NIC absence. The MSF is supposed to have its own -platform dependent- +* way to recognize card removal/insertion. +* The total system must be robust against card removal and there is no principal difference between card removal +* just after hcf_send_msg returns but before the actual transmission took place or sometime earlier. +* +* Assert fails if +* - ifbp has a recognizable out-of-range value +* - descp is a NULL pointer +* - no resources for PIF available. +* - Interrupts are enabled. +* - reentrancy, may be caused by calling hcf_functions without adequate protection +* against NIC interrupts or multi-threading. +* +*.DIAGRAM +*4: for the normal case (i.e. no HFS_TX_CNTL_TX_DELAY option active), a fid is acquired via the +* routine get_fid. If no FID is acquired, the remainder is skipped without an error notification. After +* all, the MSF is not supposed to call hcf_send_msg when no Resource is available. +*7: The ControlField of the TxFS is written. Since put_frag can only return the fatal Defunct or "No NIC", the +* return status can be ignored because when it fails, cmd_wait will fail as well. (see also the note on the +* need for a return code below). +* Note that HFS_TX_CNTL has different values for H-I, H-I/SSN and H-II and HFS_ADDR_DEST has different +* values for H-I (regardless of SSN) and H-II. +* By writing 17, 1 or 2 ( implying 16, 0 or 1 garbage word after HFS_TX_CNTL) the BAP just gets to +* HFS_ADDR_DEST for H-I, H-I/SSN and H-II respectively. +*10: if neither encapsulation nor MIC calculation is needed, splitting the first fragment in two does not +* really help but it makes the flow easier to follow to do not optimize on this difference +* +* hcf_send_msg checks whether the frame is an Ethernet-II rather than an "official" 802.3 frame. +* The E-II check is based on the length/type field in the MAC header. If this field has a value larger than +* 1500, E-II is assumed. The implementation of this test fails if the length/type field is not in the first +* descriptor. If E-II is recognized, a SNAP header is inserted. This SNAP header represents either RFC1042 +* or Bridge-Tunnel encapsulation, depending on the return status of the support routine hcf_encap. +* +*.NOTICE +* hcf_send_msg leaves the responsibility to only send messages on enabled ports at the MSF level. +* This is considered the strategy which is sufficiently adequate for all "robust" MSFs, have the least +* processor utilization and being still acceptable robust at the WCI !!!!! +* +* hcf_send_msg does not NEED a return value to report NIC absence or removal during the execution of +* hcf_send_msg(), because the MSF and higher layers must be able to cope anyway with the NIC being removed +* after a successful completion of hcf_send_msg() but before the actual transmission took place. +* To accommodate user expectations the current implementation does report NIC absence. +* Defunct blocks all NIC access and will (also) be reported on a number of other calls. +* +* hcf_send_msg does not check for transmit buffer overflow because the Hermes does this protection. +* In case of a transmit buffer overflow, the surplus which does not fit in the buffer is simply dropped. +* Note that this possibly results in the transmission of incomplete frames. +* +* After some deliberation with F/W team, it is decided that - being in the twilight zone of not knowing +* whether the problem at hand is an MSF bug, HCF buf, F/W bug, H/W malfunction or even something else - there +* is no "best thing to do" in case of a failing send, hence the HCF considers the TxFID ownership to be taken +* over by the F/W and hopes for an Allocate event in due time +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +int +hcf_send_msg( IFBP ifbp, DESC_STRCT *descp, hcf_16 tx_cntl ) +{ +int rc = HCF_SUCCESS; +DESC_STRCT *p /* = descp*/; //working pointer +hcf_16 len; // total byte count +hcf_16 i; + +hcf_16 fid = 0; + + HCFASSERT( ifbp->IFB_RscInd || descp == NULL, ifbp->IFB_RscInd ) + HCFASSERT( (ifbp->IFB_CntlOpt & USE_DMA) == 0, 0xDADB ) + + HCFLOGENTRY( HCF_TRACE_SEND_MSG, tx_cntl ) + HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic ) + HCFASSERT_INT + /* obnoxious c:/hcf/hcf.c(1480) : warning C4769: conversion of near pointer to long integer, + * so skip */ + HCFASSERT( ((hcf_32)descp & 3 ) == 0, (hcf_32)descp ) +#if HCF_ASSERT +{ int x = ifbp->IFB_FWIdentity.comp_id == COMP_ID_FW_AP ? tx_cntl & ~HFS_TX_CNTL_PORT : tx_cntl; + HCFASSERT( (x & ~HCF_TX_CNTL_MASK ) == 0, tx_cntl ) +} +#endif // HCF_ASSERT + + if ( descp ) ifbp->IFB_TxFID = 0; //cancel a pre-put message + +#if (HCF_EXT) & HCF_EXT_TX_CONT // Continuous transmit test + if ( tx_cntl == HFS_TX_CNTL_TX_CONT ) { + if ( ( fid = get_fid( ifbp ) ) != 0 ) { + //setup BAP to begin of TxFS + (void)setup_bap( ifbp, fid, 0, IO_OUT ); + //copy all the fragments in a transparent fashion + for ( p = descp; p; p = p->next_desc_addr ) { + /* obnoxious warning C4769: conversion of near pointer to long integer */ + HCFASSERT( ((hcf_32)p & 3 ) == 0, (hcf_32)p ) + put_frag( ifbp, p->buf_addr, p->BUF_CNT BE_PAR(0) ); + } + rc = cmd_exe( ifbp, HCMD_THESEUS | HCMD_BUSY | HCMD_STARTPREAMBLE, fid ); + if ( ifbp->IFB_RscInd == 0 ) { + ifbp->IFB_RscInd = get_fid( ifbp ); + } + } + // een slecht voorbeeld doet goed volgen ;? + HCFLOGEXIT( HCF_TRACE_SEND_MSG ) + return rc; + } +#endif // HCF_EXT_TX_CONT + /* the following initialization code is redundant for a pre-put message + * but moving it inside the "if fid" logic makes the merging with the + * USB flow awkward + */ +#if (HCF_TYPE) & HCF_TYPE_WPA + tx_cntl |= ifbp->IFB_MICTxCntl; +#endif // HCF_TYPE_WPA + if ( (fid = ifbp->IFB_TxFID) == 0 && ( fid = get_fid( ifbp ) ) != 0 ) /* 4 */ + /* skip the next compound statement if: + - pre-put message or + - no fid available (which should never occur if the MSF adheres to the WCI) + */ + { // to match the closing curly bracket of above "if" in case of HCF_TYPE_USB + //calculate total length ;? superfluous unless CCX or Encapsulation + len = 0; + p = descp; + do len += p->BUF_CNT; while ( ( p = p->next_desc_addr ) != NULL ); + p = descp; +//;? HCFASSERT( len <= HCF_MAX_MSG, len ) +/*7*/ (void)setup_bap( ifbp, fid, HFS_TX_CNTL, IO_OUT ); +#if (HCF_TYPE) & HCF_TYPE_TX_DELAY + HCFASSERT( ( descp != NULL ) ^ ( tx_cntl & HFS_TX_CNTL_TX_DELAY ), tx_cntl ) + if ( tx_cntl & HFS_TX_CNTL_TX_DELAY ) { + tx_cntl &= ~HFS_TX_CNTL_TX_DELAY; //!!HFS_TX_CNTL_TX_DELAY no longer available + ifbp->IFB_TxFID = fid; + fid = 0; //!!fid no longer available, be careful when modifying code + } +#endif // HCF_TYPE_TX_DELAY + OPW( HREG_DATA_1, tx_cntl ) ; + OPW( HREG_DATA_1, 0 ); +#if ! ( (HCF_TYPE) & HCF_TYPE_CCX ) + HCFASSERT( p->BUF_CNT >= 14, p->BUF_CNT ) + /* assume DestAddr/SrcAddr/Len/Type ALWAYS contained in 1st fragment + * otherwise life gets too cumbersome for MIC and Encapsulation !!!!!!!! + if ( p->BUF_CNT >= 14 ) { alternatively: add a safety escape !!!!!!!!!!!! } */ +#endif // HCF_TYPE_CCX + CALC_TX_MIC( NULL, -1 ); //initialize MIC +/*10*/ put_frag( ifbp, p->buf_addr, HCF_DASA_SIZE BE_PAR(0) ); //write DA, SA with MIC calculation + CALC_TX_MIC( p->buf_addr, HCF_DASA_SIZE ); //MIC over DA, SA + CALC_TX_MIC( null_addr, 4 ); //MIC over (virtual) priority field +#if (HCF_TYPE) & HCF_TYPE_CCX + //!!be careful do not use positive test on HCF_ACT_CCX_OFF, because IFB_CKIPStat is initially 0 + if(( ifbp->IFB_CKIPStat == HCF_ACT_CCX_ON ) || + ((GET_BUF_CNT(p) >= 20 ) && ( ifbp->IFB_CKIPStat == HCF_ACT_CCX_OFF ) && + (p->buf_addr[12] == 0xAA) && (p->buf_addr[13] == 0xAA) && + (p->buf_addr[14] == 0x03) && (p->buf_addr[15] == 0x00) && + (p->buf_addr[16] == 0x40) && (p->buf_addr[17] == 0x96) && + (p->buf_addr[18] == 0x00) && (p->buf_addr[19] == 0x00))) + { + i = HCF_DASA_SIZE; + + OPW( HREG_DATA_1, CNV_SHORT_TO_BIG( len - i )); + + /* need to send out the remainder of the fragment */ + put_frag( ifbp, &p->buf_addr[i], GET_BUF_CNT(p) - i BE_PAR(0) ); + } + else +#endif // HCF_TYPE_CCX + { + //if encapsulation needed +#if (HCF_ENCAP) == HCF_ENC + //write length (with SNAP-header,Type, without //DA,SA,Length ) no MIC calc. + if ( ( snap_header[sizeof(snap_header)-1] = hcf_encap( &p->buf_addr[HCF_DASA_SIZE] ) ) != ENC_NONE ) { + OPW( HREG_DATA_1, CNV_END_SHORT( len + (sizeof(snap_header) + 2) - ( 2*6 + 2 ) ) ); + //write splice with MIC calculation + put_frag( ifbp, snap_header, sizeof(snap_header) BE_PAR(0) ); + CALC_TX_MIC( snap_header, sizeof(snap_header) ); //MIC over 6 byte SNAP + i = HCF_DASA_SIZE; + } else +#endif // HCF_ENC + { + OPW( HREG_DATA_1, *(wci_recordp)&p->buf_addr[HCF_DASA_SIZE] ); + i = 14; + } + //complete 1st fragment starting with Type with MIC calculation + put_frag( ifbp, &p->buf_addr[i], p->BUF_CNT - i BE_PAR(0) ); + CALC_TX_MIC( &p->buf_addr[i], p->BUF_CNT - i ); + } + //do the remaining fragments with MIC calculation + while ( ( p = p->next_desc_addr ) != NULL ) { + /* obnoxious c:/hcf/hcf.c(1480) : warning C4769: conversion of near pointer to long integer, + * so skip */ + HCFASSERT( ((hcf_32)p & 3 ) == 0, (hcf_32)p ) + put_frag( ifbp, p->buf_addr, p->BUF_CNT BE_PAR(0) ); + CALC_TX_MIC( p->buf_addr, p->BUF_CNT ); + } + //pad message, finalize MIC calculation and write MIC to NIC + put_frag_finalize( ifbp ); + } + if ( fid ) { +/*16*/ rc = cmd_exe( ifbp, HCMD_BUSY | HCMD_TX | HCMD_RECL, fid ); + ifbp->IFB_TxFID = 0; + /* probably this (i.e. no RscInd AND "HREG_EV_ALLOC") at this point in time occurs so infrequent, + * that it might just as well be acceptable to skip this + * "optimization" code and handle that additional interrupt once in a while + */ +// 180 degree error in logic ;? #if ALLOC_15 +/*20*/ if ( ifbp->IFB_RscInd == 0 ) { + ifbp->IFB_RscInd = get_fid( ifbp ); + } +// #endif // ALLOC_15 + } +// HCFASSERT( level::ifbp->IFB_RscInd, ifbp->IFB_RscInd ) + HCFLOGEXIT( HCF_TRACE_SEND_MSG ) + return rc; +} // hcf_send_msg +#endif // HCF_DL_ONLY + + +#if (HCF_DL_ONLY) == 0 +/************************************************************************************************************ +* +*.MODULE int hcf_service_nic( IFBP ifbp, wci_bufp bufp, unsigned int len ) +*.PURPOSE Services (most) NIC events. +* Provides received message +* Provides status information. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* In non-DMA mode: +* bufp address of char buffer, sufficiently large to hold the first part of the RxFS up through HFS_TYPE +* len length in bytes of buffer specified by bufp +* value between HFS_TYPE + 2 and HFS_ADDR_DEST + HCF_MAX_MSG +* +*.RETURNS +* HCF_SUCCESS +* HCF_ERR_MIC message contains an erroneous MIC (only if frame fits completely in bufp) +* +*.DESCRIPTION +* +* MSF-accessible fields of Result Block +* - IFB_RxLen 0 or Frame size. +* - IFB_MBInfoLen 0 or the L-field of the oldest MBIB. +* - IFB_RscInd +* - IFB_HCF_Tallies updated if a corresponding event occurred. +* - IFB_NIC_Tallies updated if a Tally Info frame received from the NIC. +* - IFB_DmaPackets +* - IFB_TxFsStat +* - IFB_TxFsSwSup +* - IFB_LinkStat reflects new link status or 0x0000 if no change relative to previous hcf_service_nic call. +or +* - IFB_LinkStat link status, 0x8000 reflects change relative to previous hcf_service_nic call. +* +* When IFB_MBInfoLen is non-zero, at least one MBIB is available. +* +* IFB_RxLen reflects the number of received bytes in 802.3 view (Including DestAddr, SrcAddr and Length, +* excluding MIC-padding, MIC and sum check) of active Rx Frame Structure. If no Rx Data s available, IFB_RxLen +* equals 0x0000. +* Repeated execution causes the Service NIC Function to provide information about subsequently received +* messages, irrespective whether a hcf_rcv_msg or hcf_action(HCF_ACT_RX) is performed in between. +* +* When IFB_RxLen is non-zero, a Received Frame Structure is available to be routed to the protocol stack. +* When Monitor Mode is not active, this is guaranteed to be an error-free non-WMP frame. +* In case of Monitor Mode, it may also be a frame with an error or a WMP frame. +* Erroneous frames have a non-zero error-sub field in the HFS_STAT field in the look ahead buffer. +* +* If a Receive message is available in NIC RAM, the Receive Frame Structure is (partly) copied from the NIC to +* the buffer identified by bufp. +* Copying stops either after len bytes or when the complete 802.3 frame is copied. +* During the copying the message is decapsulated (if appropriate). +* If the frame is read completely by hcf_service_nic (i.e. the frame fits completely in the lookahead buffer), +* the frame is automatically ACK'ed to the F/W and still available via the look ahead buffer and hcf_rcv_msg. +* Only if the frame is read completely by hcf_service_nic, hcf_service_nic checks the MIC and sets the return +* status accordingly. In this case, hcf_rcv_msg does not check the MIC. +* +* The MIC calculation algorithm works more efficient if the length of the look ahead buffer is +* such that it fits exactly 4 n bytes of the 802.3 frame, i.e. len == HFS_ADDR_DEST + 4*n. +* +* The Service NIC Function supports the NIC event service handling process. +* It performs the appropriate actions to service the NIC, such that the event cause is eliminated and related +* information is saved. +* The Service NIC Function is executed by the MSF ISR or polling routine as first step to determine the event +* cause(s). It is the responsibility of the MSF to perform all not directly NIC related interrupt service +* actions, e.g. in a PC environment this includes servicing the PIC, and managing the Processor Interrupt +* Enabling/Disabling. +* In case of a polled based system, the Service NIC Function must be executed "frequently". +* The Service NIC Function may have side effects related to the Mailbox and Resource Indicator (IFB_RscInd). +* +* hcf_service_nic returns: +* - The length of the data in the available MBIB (IFB_MBInfoLen) +* - Changes in the link status (IFB_LinkStat) +* - The length of the data in the available Receive Frame Structure (IFB_RxLen) +* - updated IFB_RscInd +* - Updated Tallies +* +* hcf_service_nic is presumed to neither interrupt other HCF-tasks nor to be interrupted by other HCF-tasks. +* A way to achieve this is to precede hcf_service_nic as well as all other HCF-tasks with a call to +* hcf_action to disable the card interrupts and, after all work is completed, with a call to hcf_action to +* restore (which is not necessarily the same as enabling) the card interrupts. +* In case of a polled environment, it is assumed that the MSF programmer is sufficiently familiar with the +* specific requirements of that environment to translate the interrupt strategy to a polled strategy. +* +* hcf_service_nic services the following Hermes events: +* - HREG_EV_INFO Asynchronous Information Frame +* - HREG_EV_INFO_DROP WMAC did not have sufficient RAM to build Unsolicited Information Frame +* - HREG_EV_TX_EXC (if applicable, i.e. selected via HCF_EXT_INT_TX_EX bit of HCF_EXT) +* - HREG_EV_SLEEP_REQ (if applicable, i.e. selected via HCF_DDS/HCF_CDS bit of HCF_SLEEP) +* ** in non_DMA mode +* - HREG_EV_ALLOC Asynchronous part of Allocation/Reclaim completed while out of resources at +* completion of hcf_send_msg/notify +* - HREG_EV_RX the detection of the availability of received messages +* including WaveLAN Management Protocol (WMP) message processing +* ** in DMA mode +* - HREG_EV_RDMAD +* - HREG_EV_TDMAD +*!! hcf_service_nic does not service the following Hermes events: +*!! HREG_EV_TX (the "OK" Tx Event) is no longer supported by the WCI, if it occurs it is unclear +*!! what the cause is, so no meaningful strategy is available. Not acking the bit is +*!! probably the best help that can be given to the debugger. +*!! HREG_EV_CMD handled in cmd_wait. +*!! HREG_EV_FW_DMA (i.e. HREG_EV_RXDMA, HREG_EV_TXDMA and_EV_LPESC) are either not used or used +*!! between the F/W and the DMA engine. +*!! HREG_EV_ACK_REG_READY is only applicable for H-II (i.e. not HII.5 and up, see DAWA) +* +* If, in non-DMA mode, a Rx message is available, its length is reflected by the IFB_RxLen field of the IFB. +* This length reflects the data itself and the Destination Address, Source Address and DataLength/Type field +* but not the SNAP-header in case of decapsulation by the HCF. If no message is available, IFB_RxLen is +* zero. Former versions of the HCF handled WMP messages and supported a "monitor" mode in hcf_service_nic, +* which deposited certain or all Rx messages in the MailBox. The responsibility to handle these frames is +* moved to the MSF. The HCF offers as supports hcf_put_info with CFG_MB_INFO as parameter to emulate the old +* implementation under control of the MSF. +* +* **Rx Buffer free strategy +* When hcf_service_nic reports the availability of a non-DMA message, the MSF can access that message by +* means of hcf_rcv_msg. It must be prevented that the LAN Controller writes new data in the NIC buffer +* before the MSF is finished with the current message. The NIC buffer is returned to the LAN Controller +* when: +* - the complete frame fits in the lookahead buffer or +* - hcf_rcv_msg is called or +* - hcf_action with HCF_ACT_RX is called or +* - hcf_service_nic is called again +* It can be reasoned that hcf_action( INT_ON ) should not be given before the MSF has completely processed +* a reported Rx-frame. The reason is that the INT_ON action is guaranteed to cause a (Rx-)interrupt (the +* MSF is processing a Rx-frame, hence the Rx-event bit in the Hermes register must be active). This +* interrupt will cause hcf_service_nic to be called, which will cause the ack-ing of the "last" Rx-event +* to the Hermes, causing the Hermes to discard the associated NIC RAM buffer. +* Assert fails if +* - ifbp is zero or other recognizable out-of-range value. +* - hcf_service_nic is called without a prior call to hcf_connect. +* - interrupts are enabled. +* - reentrancy, may be caused by calling hcf_functions without adequate protection +* against NIC interrupts or multi-threading. +* +* +*.DIAGRAM +*1: IFB_LinkStat is cleared, if a LinkStatus frame is received, IFB_LinkStat will be updated accordingly +* by isr_info. +or +*1: IFB_LinkStat change indication is cleared. If a LinkStatus frame is received, IFB_LinkStat will be updated +* accordingly by isr_info. +*2: IFB_RxLen must be cleared before the NIC presence check otherwise: +* - this value may stay non-zero if the NIC is pulled out at an inconvenient moment. +* - the RxAck on a zero-FID needs a zero-value for IFB_RxLen to work +* Note that as side-effect of the hcf_action call, the remainder of Rx related info is re-initialized as +* well. +*4: In case of Defunct mode, the information supplied by Hermes is unreliable, so the body of +* hcf_service_nic is skipped. Since hcf_cntl turns into a NOP if Primary or Station F/W is incompatible, +* hcf_service_nic is also skipped in those cases. +* To prevent that hcf_service_nic reports bogus information to the MSF with all - possibly difficult to +* debug - undesirable side effects, it is paramount to check the NIC presence. In former days the presence +* test was based on the Hermes register HREG_SW_0. Since in HCF_ACT_INT_OFF is choosen for strategy based on +* HREG_EV_STAT, this is now also used in hcf_service_nic. The motivation to change strategy is partly +* due to inconsistent F/W implementations with respect to HREG_SW_0 manipulation around reset and download. +* Note that in polled environments Card Removal is not detected by INT_OFF which makes the check in +* hcf_service_nic even more important. +*8: The event status register of the Hermes is sampled +* The assert checks for unexpected events ;?????????????????????????????????????. +* - HREG_EV_INFO_DROP is explicitly excluded from the acceptable HREG_EV_STAT bits because it indicates +* a too heavily loaded system. +* - HREG_EV_ACK_REG_READY is 0x0000 for H-I (and hopefully H-II.5) +* +* +* HREG_EV_TX_EXC is accepted (via HREG_EV_TX_EXT) if and only if HCF_EXT_INT_TX_EX set in the HCF_EXT +* definition at compile time. +* The following activities are handled: +* - Alloc events are handled by hcf_send_msg (and notify). Only if there is no "spare" resource, the +* alloc event is superficially serviced by hcf_service_nic to create a pseudo-resource with value +* 0x001. This value is recognized by get_fid (called by hcf_send_msg and notify) where the real +* TxFid is retrieved and the Hermes is acked and - hopefully - the "normal" case with a spare TxFid +* in IFB_RscInd is restored. +* - Info drop events are handled by incrementing a tally +* - LinkEvent (including solicited and unsolicited tallies) are handled by procedure isr_info. +* - TxEx (if selected at compile time) is handled by copying the significant part of the TxFS +* into the IFB for further processing by the MSF. +* Note the complication of the zero-FID protection sub-scheme in DAWA. +* Note, the Ack of all of above events is handled at the end of hcf_service_nic +*16: In case of non-DMA ( either not compiled in or due to a run-time choice): +* If an Rx-frame is available, first the FID of that frame is read, including the complication of the +* zero-FID protection sub-scheme in DAWA. Note that such a zero-FID is acknowledged at the end of +* hcf_service_nic and that this depends on the IFB_RxLen initialization in the begin of hcf_service_nic. +* The Assert validates the HCF assumption about Hermes implementation upon which the range of +* Pseudo-RIDs is based. +* Then the control fields up to the start of the 802.3 frame are read from the NIC into the lookahead buffer. +* The status field is converted to native Endianess. +* The length is, after implicit Endianess conversion if needed, and adjustment for the 14 bytes of the +* 802.3 MAC header, stored in IFB_RxLen. +* In MAC Monitor mode, 802.11 control frames with a TOTAL length of 14 are received, so without this +* length adjustment, IFB_RxLen could not be used to distinguish these frames from "no frame". +* No MIC calculation processes are associated with the reading of these Control fields. +*26: This length test feels like superfluous robustness against malformed frames, but it turned out to be +* needed in the real (hostile) world. +* The decapsulation check needs sufficient data to represent DA, SA, L, SNAP and Type which amounts to +* 22 bytes. In MAC Monitor mode, 802.11 control frames with a smaller length are received. To prevent +* that the implementation goes haywire, a check on the length is needed. +* The actual decapsulation takes place on the fly in the copying process by overwriting the SNAP header. +* Note that in case of decapsulation the SNAP header is not passed to the MSF, hence IFB_RxLen must be +* compensated for the SNAP header length. +* The 22 bytes needed for decapsulation are (more than) sufficient for the exceptional handling of the +* MIC algorithm of the L-field (replacing the 2 byte L-field with 4 0x00 bytes). +*30: The 12 in the no-SSN branch corresponds with the get_frag, the 2 with the IPW of the SSN branch +*32: If Hermes reported MIC-presence, than the MIC engine is initialized with the non-dummy MIC calculation +* routine address and appropriate key. +*34: The 8 bytes after the DA, SA, L are read and it is checked whether decapsulation is needed i.e.: +* - the Hermes reported Tunnel encapsulation or +* - the Hermes reported 1042 Encapsulation and hcf_encap reports that the HCF would not have used +* 1042 as the encapsulation mechanism +* Note that the first field of the RxFS in bufp has Native Endianess due to the conversion done by the +* BE_PAR in get_frag. +*36: The Type field is the only word kept (after moving) of the just read 8 bytes, it is moved to the +* L-field. The original L-field and 6 byte SNAP header are discarded, so IFB_RxLen and buf_addr must +* be adjusted by 8. +*40: Determine how much of the frame (starting with DA) fits in the Lookahead buffer, then read the not-yet +* read data into the lookahead buffer. +* If the lookahead buffer contains the complete message, check the MIC. The majority considered this +* I/F more appropriate then have the MSF call hcf_get_data only to check the MIC. +*44: Since the complete message is copied from NIC RAM to PC RAM, the Rx can be acknowledged to the Hermes +* to optimize the flow ( a better chance to get new Rx data in the next pass through hcf_service_nic ). +* This acknowledgement can not be done via hcf_action( HCF_ACT_RX_ACK ) because this also clears +* IFB_RxLEN thus corrupting the I/F to the MSF. +*;?: In case of DMA (compiled in and activated): + + +*54: Limiting the number of places where the F/W is acked (e.g. the merging of the Rx-ACK with the other +* ACKs), is supposed to diminish the potential of race conditions in the F/W. +* Note 1: The CMD event is acknowledged in cmd_cmpl +* Note 2: HREG_EV_ACK_REG_READY is 0x0000 for H-I (and hopefully H-II.5) +* Note 3: The ALLOC event is acknowledged in get_fid (except for the initialization flow) +* +*.NOTICE +* The Non-DMA HREG_EV_RX is handled different compared with the other F/W events. +* The HREG_EV_RX event is acknowledged by the first hcf_service_nic call after the +* hcf_service_nic call that reported the occurrence of this event. +* This acknowledgment +* makes the next Receive Frame Structure (if any) available. +* An updated IFB_RxLen +* field reflects this availability. +* +*.NOTICE +* The minimum size for Len must supply space for: +* - an F/W dependent number of bytes of Control Info field including the 802.11 Header field +* - Destination Address +* - Source Address +* - Length field +* - [ SNAP Header] +* - [ Ethernet-II Type] +* This results in 68 for Hermes-I and 80 for Hermes-II +* This way the minimum amount of information is available needed by the HCF to determine whether the frame +* must be decapsulated. +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +int +hcf_service_nic( IFBP ifbp, wci_bufp bufp, unsigned int len ) +{ + +int rc = HCF_SUCCESS; +hcf_16 stat; +wci_bufp buf_addr; +hcf_16 i; + + HCFLOGENTRY( HCF_TRACE_SERVICE_NIC, ifbp->IFB_IntOffCnt ) + HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic ) + HCFASSERT_INT + + ifbp->IFB_LinkStat = 0; // ;? to be obsoleted ASAP /* 1*/ + ifbp->IFB_DSLinkStat &= ~CFG_LINK_STAT_CHANGE; /* 1*/ + (void)hcf_action( ifbp, HCF_ACT_RX_ACK ); /* 2*/ + if ( ifbp->IFB_CardStat == 0 && ( stat = IPW( HREG_EV_STAT ) ) != 0xFFFF ) { /* 4*/ +/* IF_NOT_DMA( HCFASSERT( !( stat & ~HREG_EV_BASIC_MASK, stat ) ) + * IF_NOT_USE_DMA( HCFASSERT( !( stat & ~HREG_EV_BASIC_MASK, stat ) ) + * IF_USE_DMA( HCFASSERT( !( stat & ~( HREG_EV_BASIC_MASK ^ ( HREG_EV_...DMA.... ), stat ) ) + */ + /* 8*/ + if ( ifbp->IFB_RscInd == 0 && stat & HREG_EV_ALLOC ) { //Note: IFB_RscInd is ALWAYS 1 for DMA + ifbp->IFB_RscInd = 1; + } + IF_TALLY( if ( stat & HREG_EV_INFO_DROP ) ifbp->IFB_HCF_Tallies.NoBufInfo++; ) +#if (HCF_EXT) & HCF_EXT_INT_TICK + if ( stat & HREG_EV_TICK ) { + ifbp->IFB_TickCnt++; + } +#if 0 // (HCF_SLEEP) & HCF_DDS + if ( ifbp->IFB_TickCnt == 3 && ( ifbp->IFB_DSLinkStat & CFG_LINK_STAT_CONNECTED ) == 0 ) { +CFG_DDS_TICK_TIME_STRCT ltv; + // 2 second period (with 1 tick uncertanty) in not-connected mode -->go into DS_OOR + hcf_action( ifbp, HCF_ACT_SLEEP ); + ifbp->IFB_DSLinkStat |= CFG_LINK_STAT_DS_OOR; //set OutOfRange + ltv.len = 2; + ltv.typ = CFG_DDS_TICK_TIME; + ltv.tick_time = ( ( ifbp->IFB_DSLinkStat & CFG_LINK_STAT_TIMER ) + 0x10 ) *64; //78 is more right + hcf_put_info( ifbp, (LTVP)<v ); + printk( "<5>Preparing for sleep, link_status: %04X, timer : %d\n", + ifbp->IFB_DSLinkStat, ltv.tick_time );//;?remove me 1 day + ifbp->IFB_TickCnt++; //;?just to make sure we do not keep on printing above message + if ( ltv.tick_time < 300 * 125 ) ifbp->IFB_DSLinkStat += 0x0010; + + } +#endif // HCF_DDS +#endif // HCF_EXT_INT_TICK + if ( stat & HREG_EV_INFO ) { + isr_info( ifbp ); + } +#if (HCF_EXT) & HCF_EXT_INT_TX_EX + if ( stat & HREG_EV_TX_EXT && ( i = IPW( HREG_TX_COMPL_FID ) ) != 0 /*DAWA*/ ) { + DAWA_ZERO_FID( HREG_TX_COMPL_FID ) + (void)setup_bap( ifbp, i, 0, IO_IN ); + get_frag( ifbp, &ifbp->IFB_TxFsStat, HFS_SWSUP BE_PAR(1) ); + } +#endif // HCF_EXT_INT_TX_EX +//!rlav DMA engine will handle the rx event, not the driver +#if HCF_DMA + if ( !( ifbp->IFB_CntlOpt & USE_DMA ) ) //!! be aware of the logical indentations +#endif // HCF_DMA +/*16*/ if ( stat & HREG_EV_RX && ( ifbp->IFB_RxFID = IPW( HREG_RX_FID ) ) != 0 ) { //if 0 then DAWA_ACK + HCFASSERT( bufp, len ) + HCFASSERT( len >= HFS_DAT + 2, len ) + DAWA_ZERO_FID( HREG_RX_FID ) + HCFASSERT( ifbp->IFB_RxFID < CFG_PROD_DATA, ifbp->IFB_RxFID) + (void)setup_bap( ifbp, ifbp->IFB_RxFID, 0, IO_IN ); + get_frag( ifbp, bufp, HFS_ADDR_DEST BE_PAR(1) ); + ifbp->IFB_lap = buf_addr = bufp + HFS_ADDR_DEST; + ifbp->IFB_RxLen = (hcf_16)(bufp[HFS_DAT_LEN] + (bufp[HFS_DAT_LEN+1]<<8) + 2*6 + 2); +/*26*/ if ( ifbp->IFB_RxLen >= 22 ) { // convenient for MIC calculation (5 DWs + 1 "skipped" W) + //. get DA,SA,Len/Type and (SNAP,Type or 8 data bytes) +/*30*/ get_frag( ifbp, buf_addr, 22 BE_PAR(0) ); +/*32*/ CALC_RX_MIC( bufp, -1 ); //. initialize MIC + CALC_RX_MIC( buf_addr, HCF_DASA_SIZE ); //. MIC over DA, SA + CALC_RX_MIC( null_addr, 4 ); //. MIC over (virtual) priority field + CALC_RX_MIC( buf_addr+14, 8 ); //. skip Len, MIC over SNAP,Type or 8 data bytes) + buf_addr += 22; +#if (HCF_TYPE) & HCF_TYPE_CCX +//!!be careful do not use positive test on HCF_ACT_CCX_OFF, because IFB_CKIPStat is initially 0 + if( ifbp->IFB_CKIPStat != HCF_ACT_CCX_ON ) +#endif // HCF_TYPE_CCX + { +#if (HCF_ENCAP) == HCF_ENC + HCFASSERT( len >= HFS_DAT + 2 + sizeof(snap_header), len ) +/*34*/ i = *(wci_recordp)&bufp[HFS_STAT] & ( HFS_STAT_MSG_TYPE | HFS_STAT_ERR ); + if ( i == HFS_STAT_TUNNEL || + ( i == HFS_STAT_1042 && hcf_encap( (wci_bufp)&bufp[HFS_TYPE] ) != ENC_TUNNEL ) ) { + //. copy E-II Type to 802.3 LEN field +/*36*/ bufp[HFS_LEN ] = bufp[HFS_TYPE ]; + bufp[HFS_LEN+1] = bufp[HFS_TYPE+1]; + //. discard Snap by overwriting with data + ifbp->IFB_RxLen -= (HFS_TYPE - HFS_LEN); + buf_addr -= ( HFS_TYPE - HFS_LEN ); // this happens to bring us at a DW boundary of 36 + } +#endif // HCF_ENC + } + } +/*40*/ ifbp->IFB_lal = min( (hcf_16)(len - HFS_ADDR_DEST), ifbp->IFB_RxLen ); + i = ifbp->IFB_lal - ( buf_addr - ( bufp + HFS_ADDR_DEST ) ); + get_frag( ifbp, buf_addr, i BE_PAR(0) ); + CALC_RX_MIC( buf_addr, i ); +#if (HCF_TYPE) & HCF_TYPE_WPA + if ( ifbp->IFB_lal == ifbp->IFB_RxLen ) { + rc = check_mic( ifbp ); + } +#endif // HCF_TYPE_WPA +/*44*/ if ( len - HFS_ADDR_DEST >= ifbp->IFB_RxLen ) { + ifbp->IFB_RxFID = 0; + } else { /* IFB_RxFID is cleared, so you do not get another Rx_Ack at next entry of hcf_service_nic */ + stat &= (hcf_16)~HREG_EV_RX; //don't ack Rx if processing not yet completed + } + } + // in case of DMA: signal availability of rx and/or tx packets to MSF + IF_USE_DMA( ifbp->IFB_DmaPackets |= stat & ( HREG_EV_RDMAD | HREG_EV_TDMAD ); ) + // rlav : pending HREG_EV_RDMAD or HREG_EV_TDMAD events get acknowledged here. +/*54*/ stat &= (hcf_16)~( HREG_EV_SLEEP_REQ | HREG_EV_CMD | HREG_EV_ACK_REG_READY | HREG_EV_ALLOC | HREG_EV_FW_DMA ); +//a positive mask would be easier to understand /*54*/ stat &= (hcf_16)~( HREG_EV_SLEEP_REQ | HREG_EV_CMD | HREG_EV_ACK_REG_READY | HREG_EV_ALLOC | HREG_EV_FW_DMA ); + IF_USE_DMA( stat &= (hcf_16)~HREG_EV_RX; ) + if ( stat ) { + DAWA_ACK( stat ); /*DAWA*/ + } + } + HCFLOGEXIT( HCF_TRACE_SERVICE_NIC ) + return rc; +} // hcf_service_nic +#endif // HCF_DL_ONLY + + +/************************************************************************************************************ +************************** H C F S U P P O R T R O U T I N E S ****************************************** +************************************************************************************************************/ + + +/************************************************************************************************************ +* +*.SUBMODULE void calc_mic( hcf_32* p, hcf_32 m ) +*.PURPOSE calculate MIC on a quad byte. +* +*.ARGUMENTS +* p address of the MIC +* m 32 bit value to be processed by the MIC calculation engine +* +*.RETURNS N.A. +* +*.DESCRIPTION +* calc_mic is the implementation of the MIC algorithm. It is a monkey-see monkey-do copy of +* Michael::appendByte() +* of Appendix C of .......... +* +* +*.DIAGRAM +* +*.NOTICE +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ + +#if (HCF_TYPE) & HCF_TYPE_WPA + +#define ROL32( A, n ) ( ((A) << (n)) | ( ((A)>>(32-(n))) & ( (1UL << (n)) - 1 ) ) ) +#define ROR32( A, n ) ROL32( (A), 32-(n) ) + +#define L *p +#define R *(p+1) + +void +calc_mic( hcf_32* p, hcf_32 m ) +{ +#if HCF_BIG_ENDIAN + m = (m >> 16) | (m << 16); +#endif // HCF_BIG_ENDIAN + L ^= m; + R ^= ROL32( L, 17 ); + L += R; + R ^= ((L & 0xff00ff00) >> 8) | ((L & 0x00ff00ff) << 8); + L += R; + R ^= ROL32( L, 3 ); + L += R; + R ^= ROR32( L, 2 ); + L += R; +} // calc_mic +#undef R +#undef L +#endif // HCF_TYPE_WPA + + + +#if (HCF_TYPE) & HCF_TYPE_WPA +/************************************************************************************************************ +* +*.SUBMODULE void calc_mic_rx_frag( IFBP ifbp, wci_bufp p, int len ) +*.PURPOSE calculate MIC on a single fragment. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* bufp (byte) address of buffer +* len length in bytes of buffer specified by bufp +* +*.RETURNS N.A. +* +*.DESCRIPTION +* calc_mic_rx_frag ........ +* +* The MIC is located in the IFB. +* The MIC is separate for Tx and Rx, thus allowing hcf_send_msg to occur between hcf_service_nic and +* hcf_rcv_msg. +* +* +*.DIAGRAM +* +*.NOTICE +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +void +calc_mic_rx_frag( IFBP ifbp, wci_bufp p, int len ) +{ +static union { hcf_32 x32; hcf_16 x16[2]; hcf_8 x8[4]; } x; //* area to accumulate 4 bytes input for MIC engine +int i; + + if ( len == -1 ) { //initialize MIC housekeeping + i = *(wci_recordp)&p[HFS_STAT]; + /* i = CNV_SHORTP_TO_LITTLE(&p[HFS_STAT]); should not be neede to prevent alignment poroblems + * since len == -1 if and only if p is lookahaead buffer which MUST be word aligned + * to be re-investigated by NvR + */ + + if ( ( i & HFS_STAT_MIC ) == 0 ) { + ifbp->IFB_MICRxCarry = 0xFFFF; //suppress MIC calculation + } else { + ifbp->IFB_MICRxCarry = 0; +//* Note that "coincidentally" the bit positions used in HFS_STAT +//* correspond with the offset of the key in IFB_MICKey + i = ( i & HFS_STAT_MIC_KEY_ID ) >> 10; /* coincidentally no shift needed for i itself */ + ifbp->IFB_MICRx[0] = CNV_LONG_TO_LITTLE(ifbp->IFB_MICRxKey[i ]); + ifbp->IFB_MICRx[1] = CNV_LONG_TO_LITTLE(ifbp->IFB_MICRxKey[i+1]); + } + } else { + if ( ifbp->IFB_MICRxCarry == 0 ) { + x.x32 = CNV_LONGP_TO_LITTLE(p); + p += 4; + if ( len < 4 ) { + ifbp->IFB_MICRxCarry = (hcf_16)len; + } else { + ifbp->IFB_MICRxCarry = 4; + len -= 4; + } + } else while ( ifbp->IFB_MICRxCarry < 4 && len ) { //note for hcf_16 applies: 0xFFFF > 4 + x.x8[ifbp->IFB_MICRxCarry++] = *p++; + len--; + } + while ( ifbp->IFB_MICRxCarry == 4 ) { //contrived so we have only 1 call to calc_mic so we could bring it in-line + calc_mic( ifbp->IFB_MICRx, x.x32 ); + x.x32 = CNV_LONGP_TO_LITTLE(p); + p += 4; + if ( len < 4 ) { + ifbp->IFB_MICRxCarry = (hcf_16)len; + } + len -= 4; + } + } +} // calc_mic_rx_frag +#endif // HCF_TYPE_WPA + + +#if (HCF_TYPE) & HCF_TYPE_WPA +/************************************************************************************************************ +* +*.SUBMODULE void calc_mic_tx_frag( IFBP ifbp, wci_bufp p, int len ) +*.PURPOSE calculate MIC on a single fragment. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* bufp (byte) address of buffer +* len length in bytes of buffer specified by bufp +* +*.RETURNS N.A. +* +*.DESCRIPTION +* calc_mic_tx_frag ........ +* +* The MIC is located in the IFB. +* The MIC is separate for Tx and Rx, thus allowing hcf_send_msg to occur between hcf_service_nic and +* hcf_rcv_msg. +* +* +*.DIAGRAM +* +*.NOTICE +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +void +calc_mic_tx_frag( IFBP ifbp, wci_bufp p, int len ) +{ +static union { hcf_32 x32; hcf_16 x16[2]; hcf_8 x8[4]; } x; //* area to accumulate 4 bytes input for MIC engine + + //if initialization request + if ( len == -1 ) { + //. presume MIC calculation disabled + ifbp->IFB_MICTxCarry = 0xFFFF; + //. if MIC calculation enabled + if ( ifbp->IFB_MICTxCntl ) { + //. . clear MIC carry + ifbp->IFB_MICTxCarry = 0; + //. . initialize MIC-engine + ifbp->IFB_MICTx[0] = CNV_LONG_TO_LITTLE(ifbp->IFB_MICTxKey[0]); /*Tx always uses Key 0 */ + ifbp->IFB_MICTx[1] = CNV_LONG_TO_LITTLE(ifbp->IFB_MICTxKey[1]); + } + //else + } else { + //. if MIC enabled (Tx) / if MIC present (Rx) + //. and no carry from previous calc_mic_frag + if ( ifbp->IFB_MICTxCarry == 0 ) { + //. . preset accu with 4 bytes from buffer + x.x32 = CNV_LONGP_TO_LITTLE(p); + //. . adjust pointer accordingly + p += 4; + //. . if buffer contained less then 4 bytes + if ( len < 4 ) { + //. . . promote valid bytes in accu to carry + //. . . flag accu to contain incomplete double word + ifbp->IFB_MICTxCarry = (hcf_16)len; + //. . else + } else { + //. . . flag accu to contain complete double word + ifbp->IFB_MICTxCarry = 4; + //. . adjust remaining buffer length + len -= 4; + } + //. else if MIC enabled + //. and if carry bytes from previous calc_mic_tx_frag + //. . move (1-3) bytes from carry into accu + } else while ( ifbp->IFB_MICTxCarry < 4 && len ) { /* note for hcf_16 applies: 0xFFFF > 4 */ + x.x8[ifbp->IFB_MICTxCarry++] = *p++; + len--; + } + //. while accu contains complete double word + //. and MIC enabled + while ( ifbp->IFB_MICTxCarry == 4 ) { + //. . pass accu to MIC engine + calc_mic( ifbp->IFB_MICTx, x.x32 ); + //. . copy next 4 bytes from buffer to accu + x.x32 = CNV_LONGP_TO_LITTLE(p); + //. . adjust buffer pointer + p += 4; + //. . if buffer contained less then 4 bytes + //. . . promote valid bytes in accu to carry + //. . . flag accu to contain incomplete double word + if ( len < 4 ) { + ifbp->IFB_MICTxCarry = (hcf_16)len; + } + //. . adjust remaining buffer length + len -= 4; + } + } +} // calc_mic_tx_frag +#endif // HCF_TYPE_WPA + + +#if HCF_PROT_TIME +/************************************************************************************************************ +* +*.SUBMODULE void calibrate( IFBP ifbp ) +*.PURPOSE calibrates the S/W protection counter against the Hermes Timer tick. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* +*.RETURNS N.A. +* +*.DESCRIPTION +* calibrates the S/W protection counter against the Hermes Timer tick +* IFB_TickIni is the value used to initialize the S/W protection counter such that the expiration period +* more or less independent of the processor speed. If IFB_TickIni is not yet calibrated, it is done now. +* This calibration is "reasonably" accurate because the Hermes is in a quiet state as a result of the +* Initialize command. +* +* +*.DIAGRAM +* +*1: IFB_TickIni is initialized at INI_TICK_INI by hcf_connect. If calibrate succeeds, IFB_TickIni is +* guaranteed to be changed. As a consequence there will be only 1 shot at calibration (regardless of the +* number of init calls) under normal circumstances. +*2: Calibration is done HCF_PROT_TIME_CNT times. This diminish the effects of jitter and interference, +* especially in a pre-emptive environment. HCF_PROT_TIME_CNT is in the range of 16 through 32 and derived +* from the HCF_PROT_TIME specified by the MSF programmer. The divisor needed to scale HCF_PROT_TIME into the +* 16-32 range, is used as a multiplicator after the calibration, to scale the found value back to the +* requested range. This way a compromise is achieved between accuracy and duration of the calibration +* process. +*3: Acknowledge the Timer Tick Event. +* Each cycle is limited to at most INI_TICK_INI samples of the TimerTick status of the Hermes. +* Since the start of calibrate is unrelated to the Hermes Internal Timer, the first interval may last from 0 +* to the normal interval, all subsequent intervals should be the full length of the Hermes Tick interval. +* The Hermes Timer Tick is not reprogrammed by the HCF, hence it is running at the default of 10 k +* microseconds. +*4: If the Timer Tick Event is continuously up (prot_cnt still has the value INI_TICK_INI) or no Timer Tick +* Event occurred before the protection counter expired, reset IFB_TickIni to INI_TICK_INI, +* set the defunct bit of IFB_CardStat (thus rendering the Hermes inoperable) and exit the calibrate routine. +*8: ifbp->IFB_TickIni is multiplied to scale the found value back to the requested range as explained under 2. +* +*.NOTICE +* o Although there are a number of viewpoints possible, calibrate() uses as error strategy that a single +* failure of the Hermes TimerTick is considered fatal. +* o There is no hard and concrete time-out value defined for Hermes activities. The default 1 seconds is +* believed to be sufficiently "relaxed" for real life and to be sufficiently short to be still useful in an +* environment with humans. +* o Note that via IFB_DefunctStat time outs in cmd_wait and in hcfio_string block all Hermes access till the +* next init so functions which call a mix of cmd_wait and hcfio_string only need to check the return status +* of the last call +* o The return code is preset at Time out. +* The additional complication that no calibrated value for the protection count can be assumed since +* calibrate() does not yet have determined a calibrated value (a catch 22), is handled by setting the +* initial value at INI_TICK_INI (by hcf_connect). This approach is considered safe, because: +* - the HCF does not use the pipeline mechanism of Hermes commands. +* - the likelihood of failure (the only time when protection count is relevant) is small. +* - the time will be sufficiently large on a fast machine (busy bit drops on good NIC before counter +* expires) +* - the time will be sufficiently small on a slow machine (counter expires on bad NIC before the end user +* switches the power off in despair +* The time needed to wrap a 32 bit counter around is longer than many humans want to wait, hence the more or +* less arbitrary value of 0x40000L is chosen, assuming it does not take too long on an XT and is not too +* short on a scream-machine. +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +HCF_STATIC void +calibrate( IFBP ifbp ) +{ +int cnt = HCF_PROT_TIME_CNT; +hcf_32 prot_cnt; + + HCFTRACE( ifbp, HCF_TRACE_CALIBRATE ); + if ( ifbp->IFB_TickIni == INI_TICK_INI ) { /*1*/ + ifbp->IFB_TickIni = 0; /*2*/ + while ( cnt-- ) { + prot_cnt = INI_TICK_INI; + OPW( HREG_EV_ACK, HREG_EV_TICK ); /*3*/ + while ( (IPW( HREG_EV_STAT ) & HREG_EV_TICK) == 0 && --prot_cnt ) { + ifbp->IFB_TickIni++; + } + if ( prot_cnt == 0 || prot_cnt == INI_TICK_INI ) { /*4*/ + ifbp->IFB_TickIni = INI_TICK_INI; + ifbp->IFB_DefunctStat = HCF_ERR_DEFUNCT_TIMER; + ifbp->IFB_CardStat |= CARD_STAT_DEFUNCT; + HCFASSERT( DO_ASSERT, prot_cnt ) + } + } + ifbp->IFB_TickIni <<= HCF_PROT_TIME_SHFT; /*8*/ + } + HCFTRACE( ifbp, HCF_TRACE_CALIBRATE | HCF_TRACE_EXIT ); +} // calibrate +#endif // HCF_PROT_TIME + + +#if (HCF_DL_ONLY) == 0 +#if (HCF_TYPE) & HCF_TYPE_WPA +/************************************************************************************************************ +* +*.SUBMODULE int check_mic( IFBP ifbp ) +*.PURPOSE verifies the MIC of a received non-USB frame. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* +*.RETURNS +* HCF_SUCCESS +* HCF_ERR_MIC +* +*.DESCRIPTION +* +* +*.DIAGRAM +* +*4: test whether or not a MIC is reported by the Hermes +*14: the calculated MIC and the received MIC are compared, the return status is set when there is a mismatch +* +*.NOTICE +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +int +check_mic( IFBP ifbp ) +{ +int rc = HCF_SUCCESS; +hcf_32 x32[2]; //* area to save rcvd 8 bytes MIC + + //if MIC present in RxFS + if ( *(wci_recordp)&ifbp->IFB_lap[-HFS_ADDR_DEST] & HFS_STAT_MIC ) { + //or if ( ifbp->IFB_MICRxCarry != 0xFFFF ) + CALC_RX_MIC( mic_pad, 8 ); //. process up to 3 remaining bytes of data and append 5 to 8 bytes of padding to MIC calculation + get_frag( ifbp, (wci_bufp)x32, 8 BE_PAR(0));//. get 8 byte MIC from NIC + //. if calculated and received MIC do not match + //. . set status at HCF_ERR_MIC +/*14*/ if ( x32[0] != CNV_LITTLE_TO_LONG(ifbp->IFB_MICRx[0]) || + x32[1] != CNV_LITTLE_TO_LONG(ifbp->IFB_MICRx[1]) ) { + rc = HCF_ERR_MIC; + } + } + //return status + return rc; +} // check_mic +#endif // HCF_TYPE_WPA +#endif // HCF_DL_ONLY + + +/************************************************************************************************************ +* +*.SUBMODULE int cmd_cmpl( IFBP ifbp ) +*.PURPOSE waits for Hermes Command Completion. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* +*.RETURNS +* IFB_DefunctStat +* HCF_ERR_TIME_OUT +* HCF_ERR_DEFUNCT_CMD_SEQ +* HCF_SUCCESS +* +*.DESCRIPTION +* +* +*.DIAGRAM +* +*2: Once cmd_cmpl is called, the Busy option bit in IFB_Cmd must be cleared +*4: If Status register and command code don't match either: +* - the Hermes and Host are out of sync ( a fatal error) +* - error bits are reported via the Status Register. +* Out of sync is considered fatal and brings the HCF in Defunct mode +* Errors reported via the Status Register should be caused by sequence violations in Hermes command +* sequences and hence these bugs should have been found during engineering testing. Since there is no +* strategy to cope with this problem, it might as well be ignored at run time. Note that for any particular +* situation where a strategy is formulated to handle the consequences of a particular bug causing a +* particular Error situation reported via the Status Register, the bug should be removed rather than adding +* logic to cope with the consequences of the bug. +* There have been HCF versions where an error report via the Status Register even brought the HCF in defunct +* mode (although it was not yet named like that at that time). This is particular undesirable behavior for a +* general library. +* Simply reporting the error (as "interesting") is debatable. There also have been HCF versions with this +* strategy using the "vague" HCF_FAILURE code. +* The error is reported via: +* - MiscErr tally of the HCF Tally set +* - the (informative) fields IFB_ErrCmd and IFB_ErrQualifier +* - the assert mechanism +*8: Here the Defunct case and the Status error are separately treated +* +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +HCF_STATIC int +cmd_cmpl( IFBP ifbp ) +{ + +PROT_CNT_INI +int rc = HCF_SUCCESS; +hcf_16 stat; + + HCFLOGENTRY( HCF_TRACE_CMD_CPL, ifbp->IFB_Cmd ) + ifbp->IFB_Cmd &= ~HCMD_BUSY; /* 2 */ + HCF_WAIT_WHILE( (IPW( HREG_EV_STAT) & HREG_EV_CMD) == 0 ); /* 4 */ + stat = IPW( HREG_STAT ); +#if HCF_PROT_TIME + if ( prot_cnt == 0 ) { + IF_TALLY( ifbp->IFB_HCF_Tallies.MiscErr++; ) + rc = HCF_ERR_TIME_OUT; + HCFASSERT( DO_ASSERT, ifbp->IFB_Cmd ) + } else +#endif // HCF_PROT_TIME + { + DAWA_ACK( HREG_EV_CMD ); +/*4*/ if ( stat != (ifbp->IFB_Cmd & HCMD_CMD_CODE) ) { +/*8*/ if ( ( (stat ^ ifbp->IFB_Cmd ) & HCMD_CMD_CODE) != 0 ) { + rc = ifbp->IFB_DefunctStat = HCF_ERR_DEFUNCT_CMD_SEQ; + ifbp->IFB_CardStat |= CARD_STAT_DEFUNCT; + } + IF_TALLY( ifbp->IFB_HCF_Tallies.MiscErr++; ) + ifbp->IFB_ErrCmd = stat; + ifbp->IFB_ErrQualifier = IPW( HREG_RESP_0 ); + HCFASSERT( DO_ASSERT, MERGE_2( IPW( HREG_PARAM_0 ), ifbp->IFB_Cmd ) ) + HCFASSERT( DO_ASSERT, MERGE_2( ifbp->IFB_ErrQualifier, ifbp->IFB_ErrCmd ) ) + } + } + HCFASSERT( rc == HCF_SUCCESS, rc) + HCFLOGEXIT( HCF_TRACE_CMD_CPL ) + return rc; +} // cmd_cmpl + + +/************************************************************************************************************ +* +*.SUBMODULE int cmd_exe( IFBP ifbp, int cmd_code, int par_0 ) +*.PURPOSE Executes synchronous part of Hermes Command and - optionally - waits for Command Completion. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* cmd_code +* par_0 +* +*.RETURNS +* IFB_DefunctStat +* HCF_ERR_DEFUNCT_CMD_SEQ +* HCF_SUCCESS +* HCF_ERR_TO_BE_ADDED <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +* +*.DESCRIPTION +* Executes synchronous Hermes Command and waits for Command Completion +* +* The general HCF strategy is to wait for command completion. As a consequence: +* - the read of the busy bit before writing the command register is superfluous +* - the Hermes requirement that no Inquiry command may be executed if there is still an unacknowledged +* Inquiry command outstanding, is automatically met. +* The Tx command uses the "Busy" bit in the cmd_code parameter to deviate from this general HCF strategy. +* The idea is that by not busy-waiting on completion of this frequently used command the processor +* utilization is diminished while using the busy-wait on all other seldom used commands the flow is kept +* simple. +* +* +* +*.DIAGRAM +* +*1: skip the body of cmd_exe when in defunct mode or when - based on the S/W Support register write and +* read back test - there is apparently no NIC. +* Note: we gave up on the "old" strategy to write the S/W Support register at magic only when needed. Due to +* the intricateness of Hermes F/W varieties ( which behave differently as far as corruption of the S/W +* Support register is involved), the increasing number of Hermes commands which do an implicit initialize +* (thus modifying the S/W Support register) and the workarounds of some OS/Support S/W induced aspects (e.g. +* the System Soft library at WinNT which postpones the actual mapping of I/O space up to 30 seconds after +* giving the go-ahead), the "magic" strategy is now reduced to a simple write and read back. This means that +* problems like a bug tramping over the memory mapped Hermes registers will no longer be noticed as side +* effect of the S/W Support register check. +*2: check whether the preceding command skipped the busy wait and if so, check for command completion +* +*.NOTICE +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ + +HCF_STATIC int +cmd_exe( IFBP ifbp, hcf_16 cmd_code, hcf_16 par_0 ) //if HCMD_BUSY of cmd_code set, then do NOT wait for completion +{ +int rc; + + HCFLOGENTRY( HCF_TRACE_CMD_EXE, cmd_code ) + HCFASSERT( (cmd_code & HCMD_CMD_CODE) != HCMD_TX || cmd_code & HCMD_BUSY, cmd_code ) //Tx must have Busy bit set + OPW( HREG_SW_0, HCF_MAGIC ); + if ( IPW( HREG_SW_0 ) == HCF_MAGIC ) { /* 1 */ + rc = ifbp->IFB_DefunctStat; + } + else rc = HCF_ERR_NO_NIC; + if ( rc == HCF_SUCCESS ) { + //;?is this a hot idea, better MEASURE performance impact +/*2*/ if ( ifbp->IFB_Cmd & HCMD_BUSY ) { + rc = cmd_cmpl( ifbp ); + } + OPW( HREG_PARAM_0, par_0 ); + OPW( HREG_CMD, cmd_code &~HCMD_BUSY ); + ifbp->IFB_Cmd = cmd_code; + if ( (cmd_code & HCMD_BUSY) == 0 ) { //;?is this a hot idea, better MEASURE performance impact + rc = cmd_cmpl( ifbp ); + } + } + HCFASSERT( rc == HCF_SUCCESS, MERGE_2( rc, cmd_code ) ) + HCFLOGEXIT( HCF_TRACE_CMD_EXE ) + return rc; +} // cmd_exe + + +/************************************************************************************************************ +* +*.SUBMODULE int download( IFBP ifbp, CFG_PROG_STRCT FAR *ltvp ) +*.PURPOSE downloads F/W image into NIC and initiates execution of the downloaded F/W. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* ltvp specifies the pseudo-RID (as defined by WCI) +* +*.RETURNS +* +*.DESCRIPTION +* +* +*.DIAGRAM +*1: First, Ack everything to unblock a (possibly) blocked cmd pipe line +* Note 1: it is very likely that an Alloc event is pending and very well possible that a (Send) Cmd event is +* pending +* Note 2: it is assumed that this strategy takes away the need to ack every conceivable event after an +* Hermes Initialize +* +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +HCF_STATIC int +download( IFBP ifbp, CFG_PROG_STRCT FAR *ltvp ) //Hermes-II download (volatile only) +{ +hcf_16 i; +int rc = HCF_SUCCESS; +wci_bufp cp; +hcf_io io_port = ifbp->IFB_IOBase + HREG_AUX_DATA; + + HCFLOGENTRY( HCF_TRACE_DL, ltvp->typ ) +#if (HCF_TYPE) & HCF_TYPE_PRELOADED + HCFASSERT( DO_ASSERT, ltvp->mode ) +#else + //if initial "program" LTV + if ( ifbp->IFB_DLMode == CFG_PROG_STOP && ltvp->mode == CFG_PROG_VOLATILE) { + //. switch Hermes to initial mode +/*1*/ OPW( HREG_EV_ACK, ~HREG_EV_SLEEP_REQ ); + rc = cmd_exe( ifbp, HCMD_INI, 0 ); /* HCMD_INI can not be part of init() because that is called on + * other occasions as well */ + rc = init( ifbp ); + } + //if final "program" LTV + if ( ltvp->mode == CFG_PROG_STOP && ifbp->IFB_DLMode == CFG_PROG_VOLATILE) { + //. start tertiary (or secondary) + OPW( HREG_PARAM_1, (hcf_16)(ltvp->nic_addr >> 16) ); + rc = cmd_exe( ifbp, HCMD_EXECUTE, (hcf_16) ltvp->nic_addr ); + if (rc == HCF_SUCCESS) { + rc = init( ifbp ); /*;? do we really want to skip init if cmd_exe failed, i.e. + * IFB_FW_Comp_Id is than possibly incorrect */ + } + //else (non-final) + } else { + //. if mode == Readback SEEPROM +#if 0 //;? as long as the next if contains a hard coded 0, might as well leave it out even more obvious + if ( 0 /*len is definitely not want we want;?*/ && ltvp->mode == CFG_PROG_SEEPROM_READBACK ) { + OPW( HREG_PARAM_1, (hcf_16)(ltvp->nic_addr >> 16) ); + OPW( HREG_PARAM_2, MUL_BY_2(ltvp->len - 4)); + //. . perform Hermes prog cmd with appropriate mode bits + rc = cmd_exe( ifbp, HCMD_PROGRAM | ltvp->mode, (hcf_16)ltvp->nic_addr ); + //. . set up NIC RAM addressability according Resp0-1 + OPW( HREG_AUX_PAGE, IPW( HREG_RESP_1) ); + OPW( HREG_AUX_OFFSET, IPW( HREG_RESP_0) ); + //. . set up L-field of LTV according Resp2 + i = ( IPW( HREG_RESP_2 ) + 1 ) / 2; // i contains max buffer size in words, a probably not very useful piece of information ;? +/*Nico's code based on i is the "real amount of data available" + if ( ltvp->len - 4 < i ) rc = HCF_ERR_LEN; + else ltvp->len = i + 4; +*/ +/* Rolands code based on the idea that a MSF should not ask for more than is available + // check if number of bytes requested exceeds max buffer size + if ( ltvp->len - 4 > i ) { + rc = HCF_ERR_LEN; + ltvp->len = i + 4; + } +*/ + //. . copy data from NIC via AUX port to LTV + cp = (wci_bufp)ltvp->host_addr; /*IN_PORT_STRING_8_16 macro may modify its parameters*/ + i = ltvp->len - 4; + IN_PORT_STRING_8_16( io_port, cp, i ); //!!!WORD length, cp MUST be a char pointer // $$ char + //. else (non-final programming) + } else +#endif //;? as long as the above if contains a hard coded 0, might as well leave it out even more obvious + { //. . get number of words to program + HCFASSERT( ltvp->segment_size, *ltvp->host_addr ) + i = ltvp->segment_size/2; + //. . copy data (words) from LTV via AUX port to NIC + cp = (wci_bufp)ltvp->host_addr; //OUT_PORT_STRING_8_16 macro may modify its parameters + //. . if mode == volatile programming + if ( ltvp->mode == CFG_PROG_VOLATILE ) { + //. . . set up NIC RAM addressability via AUX port + OPW( HREG_AUX_PAGE, (hcf_16)(ltvp->nic_addr >> 16 << 9 | (ltvp->nic_addr & 0xFFFF) >> 7 ) ); + OPW( HREG_AUX_OFFSET, (hcf_16)(ltvp->nic_addr & 0x007E) ); + OUT_PORT_STRING_8_16( io_port, cp, i ); //!!!WORD length, cp MUST be a char pointer + } + } + } + ifbp->IFB_DLMode = ltvp->mode; //save state in IFB_DLMode +#endif // HCF_TYPE_PRELOADED + HCFASSERT( rc == HCF_SUCCESS, rc ) + HCFLOGEXIT( HCF_TRACE_DL ) + return rc; +} // download + + +#if (HCF_ASSERT) & HCF_ASSERT_PRINTF +/************************************************** +* Certain Hermes-II firmware versions can generate +* debug information. This debug information is +* contained in a buffer in nic-RAM, and can be read +* via the aux port. +**************************************************/ +HCF_STATIC int +fw_printf(IFBP ifbp, CFG_FW_PRINTF_STRCT FAR *ltvp) +{ + int rc = HCF_SUCCESS; + hcf_16 fw_cnt; +// hcf_32 DbMsgBuffer = 0x29D2, DbMsgCount= 0x000029D0; +// hcf_16 DbMsgSize=0x00000080; + hcf_32 DbMsgBuffer; + CFG_FW_PRINTF_BUFFER_LOCATION_STRCT *p = &ifbp->IFB_FwPfBuff; + ltvp->len = 1; + if ( p->DbMsgSize != 0 ) { + // first, check the counter in nic-RAM and compare it to the latest counter value of the HCF + OPW( HREG_AUX_PAGE, (hcf_16)(p->DbMsgCount >> 7) ); + OPW( HREG_AUX_OFFSET, (hcf_16)(p->DbMsgCount & 0x7E) ); + fw_cnt = ((IPW( HREG_AUX_DATA) >>1 ) & ((hcf_16)p->DbMsgSize - 1)); + if ( fw_cnt != ifbp->IFB_DbgPrintF_Cnt ) { +// DbgPrint("fw_cnt=%d IFB_DbgPrintF_Cnt=%d\n", fw_cnt, ifbp->IFB_DbgPrintF_Cnt); + DbMsgBuffer = p->DbMsgBuffer + ifbp->IFB_DbgPrintF_Cnt * 6; // each entry is 3 words + OPW( HREG_AUX_PAGE, (hcf_16)(DbMsgBuffer >> 7) ); + OPW( HREG_AUX_OFFSET, (hcf_16)(DbMsgBuffer & 0x7E) ); + ltvp->msg_id = IPW(HREG_AUX_DATA); + ltvp->msg_par = IPW(HREG_AUX_DATA); + ltvp->msg_tstamp = IPW(HREG_AUX_DATA); + ltvp->len = 4; + ifbp->IFB_DbgPrintF_Cnt++; + ifbp->IFB_DbgPrintF_Cnt &= (p->DbMsgSize - 1); + } + } + return rc; +}; +#endif // HCF_ASSERT_PRINTF + + +#if (HCF_DL_ONLY) == 0 +/************************************************************************************************************ +* +*.SUBMODULE hcf_16 get_fid( IFBP ifbp ) +*.PURPOSE get allocated FID for either transmit or notify. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* +*.RETURNS +* 0 no FID available +* <>0 FID number +* +*.DESCRIPTION +* +* +*.DIAGRAM +* The preference is to use a "pending" alloc. If no alloc is pending, then - if available - the "spare" FID +* is used. +* If the spare FID is used, IFB_RscInd (representing the spare FID) must be cleared +* If the pending alloc is used, the alloc event must be acknowledged to the Hermes. +* In case the spare FID was depleted and the IFB_RscInd has been "faked" as pseudo resource with a 0x0001 +* value by hcf_service_nic, IFB_RscInd has to be "corrected" again to its 0x0000 value. +* +* Note that due to the Hermes-II H/W problems which are intended to be worked around by DAWA, the Alloc bit +* in the Event register is no longer a reliable indication of the presence/absence of a FID. The "Clear FID" +* part of the DAWA logic, together with the choice of the definition of the return information from get_fid, +* handle this automatically, i.e. without additional code in get_fid. +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +HCF_STATIC hcf_16 +get_fid( IFBP ifbp ) +{ + +hcf_16 fid = 0; +#if ( (HCF_TYPE) & HCF_TYPE_HII5 ) == 0 +PROT_CNT_INI +#endif // HCF_TYPE_HII5 + + IF_DMA( HCFASSERT(!(ifbp->IFB_CntlOpt & USE_DMA), ifbp->IFB_CntlOpt) ) + + if ( IPW( HREG_EV_STAT) & HREG_EV_ALLOC) { + fid = IPW( HREG_ALLOC_FID ); + HCFASSERT( fid, ifbp->IFB_RscInd ) + DAWA_ZERO_FID( HREG_ALLOC_FID ) +#if ( (HCF_TYPE) & HCF_TYPE_HII5 ) == 0 + HCF_WAIT_WHILE( ( IPW( HREG_EV_STAT ) & HREG_EV_ACK_REG_READY ) == 0 ); + HCFASSERT( prot_cnt, IPW( HREG_EV_STAT ) ) +#endif // HCF_TYPE_HII5 + DAWA_ACK( HREG_EV_ALLOC ); //!!note that HREG_EV_ALLOC is written only once +// 180 degree error in logic ;? #if ALLOC_15 + if ( ifbp->IFB_RscInd == 1 ) { + ifbp->IFB_RscInd = 0; + } +//#endif // ALLOC_15 + } else { +// 180 degree error in logic ;? #if ALLOC_15 + fid = ifbp->IFB_RscInd; +//#endif // ALLOC_15 + ifbp->IFB_RscInd = 0; + } + return fid; +} // get_fid +#endif // HCF_DL_ONLY + + +/************************************************************************************************************ +* +*.SUBMODULE void get_frag( IFBP ifbp, wci_bufp bufp, int len BE_PAR( int word_len ) ) +*.PURPOSE reads with 16/32 bit I/O via BAP1 port from NIC RAM to Host memory. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* bufp (byte) address of buffer +* len length in bytes of buffer specified by bufp +* word_len Big Endian only: number of leading bytes to swap in pairs +* +*.RETURNS N.A. +* +*.DESCRIPTION +* process the single byte (if applicable) read by the previous get_frag and copy len (or len-1) bytes from +* NIC to bufp. +* On a Big Endian platform, the parameter word_len controls the number of leading bytes whose endianess is +* converted (i.e. byte swapped) +* +* +*.DIAGRAM +*10: The PCMCIA card can be removed in the middle of the transfer. By depositing a "magic number" in the +* HREG_SW_0 register of the Hermes at initialization time and by verifying this register, it can be +* determined whether the card is still present. The return status is set accordingly. +* Clearing the buffer is a (relative) cheap way to prevent that failing I/O results in run-away behavior +* because the garbage in the buffer is interpreted by the caller irrespective of the return status (e.g. +* hcf_service_nic has this behavior). +* +*.NOTICE +* It turns out DOS ODI uses zero length fragments. The HCF code can cope with it, but as a consequence, no +* Assert on len is possible +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +HCF_STATIC void +get_frag( IFBP ifbp, wci_bufp bufp, int len BE_PAR( int word_len ) ) +{ +hcf_io io_port = ifbp->IFB_IOBase + HREG_DATA_1; //BAP data register +wci_bufp p = bufp; //working pointer +int i; //prevent side effects from macro +int j; + + HCFASSERT( ((hcf_32)bufp & (HCF_ALIGN-1) ) == 0, (hcf_32)bufp ) + +/*1: here recovery logic for intervening BAP access between hcf_service_nic and hcf_rcv_msg COULD be added + * if current access is RxInitial + * . persistent_offset += len + */ + + i = len; + //if buffer length > 0 and carry from previous get_frag + if ( i && ifbp->IFB_CarryIn ) { + //. move carry to buffer + //. adjust buffer length and pointer accordingly + *p++ = (hcf_8)(ifbp->IFB_CarryIn>>8); + i--; + //. clear carry flag + ifbp->IFB_CarryIn = 0; + } +#if (HCF_IO) & HCF_IO_32BITS + //skip zero-length I/O, single byte I/O and I/O not worthwhile (i.e. less than 6 bytes)for DW logic + //if buffer length >= 6 and 32 bits I/O support + if ( !(ifbp->IFB_CntlOpt & USE_16BIT) && i >= 6 ) { +hcf_32 FAR *p4; //prevent side effects from macro + if ( ( (hcf_32)p & 0x1 ) == 0 ) { //. if buffer at least word aligned + if ( (hcf_32)p & 0x2 ) { //. . if buffer not double word aligned + //. . . read single word to get double word aligned + *(wci_recordp)p = IN_PORT_WORD( io_port ); + //. . . adjust buffer length and pointer accordingly + p += 2; + i -= 2; + } + //. . read as many double word as possible + p4 = (hcf_32 FAR *)p; + j = i/4; + IN_PORT_STRING_32( io_port, p4, j ); + //. . adjust buffer length and pointer accordingly + p += i & ~0x0003; + i &= 0x0003; + } + } +#endif // HCF_IO_32BITS + //if no 32-bit support OR byte aligned OR 1-3 bytes left + if ( i ) { + //. read as many word as possible in "alignment safe" way + j = i/2; + IN_PORT_STRING_8_16( io_port, p, j ); + //. if 1 byte left + if ( i & 0x0001 ) { + //. . read 1 word + ifbp->IFB_CarryIn = IN_PORT_WORD( io_port ); + //. . store LSB in last char of buffer + bufp[len-1] = (hcf_8)ifbp->IFB_CarryIn; + //. . save MSB in carry, set carry flag + ifbp->IFB_CarryIn |= 0x1; + } + } +#if HCF_BIG_ENDIAN + HCFASSERT( word_len == 0 || word_len == 2 || word_len == 4, word_len ) + HCFASSERT( word_len == 0 || ((hcf_32)bufp & 1 ) == 0, (hcf_32)bufp ) + HCFASSERT( word_len <= len, MERGE2( word_len, len ) ) + //see put_frag for an alternative implementation, but be carefull about what are int's and what are + //hcf_16's + if ( word_len ) { //. if there is anything to convert +hcf_8 c; + c = bufp[1]; //. . convert the 1st hcf_16 + bufp[1] = bufp[0]; + bufp[0] = c; + if ( word_len > 1 ) { //. . if there is to convert more than 1 word ( i.e 2 ) + c = bufp[3]; //. . . convert the 2nd hcf_16 + bufp[3] = bufp[2]; + bufp[2] = c; + } + } +#endif // HCF_BIG_ENDIAN +} // get_frag + +/************************************************************************************************************ +* +*.SUBMODULE int init( IFBP ifbp ) +*.PURPOSE Handles common initialization aspects (H-I init, calibration, config.mngmt, allocation). +* +*.ARGUMENTS +* ifbp address of the Interface Block +* +*.RETURNS +* HCF_ERR_INCOMP_PRI +* HCF_ERR_INCOMP_FW +* HCF_ERR_TIME_OUT +* >>hcf_get_info +* HCF_ERR_NO_NIC +* HCF_ERR_LEN +* +*.DESCRIPTION +* init will successively: +* - in case of a (non-preloaded) H-I, initialize the NIC +* - calibrate the S/W protection timer against the Hermes Timer +* - collect HSI, "active" F/W Configuration Management Information +* - in case active F/W is Primary F/W: collect Primary F/W Configuration Management Information +* - check HSI and Primary F/W compatibility with the HCF +* - in case active F/W is Station or AP F/W: check Station or AP F/W compatibility with the HCF +* - in case active F/W is not Primary F/W: allocate FIDs to be used in transmit/notify process +* +* +*.DIAGRAM +*2: drop all error status bits in IFB_CardStat since they are expected to be re-evaluated. +*4: Ack everything except HREG_EV_SLEEP_REQ. It is very likely that an Alloc event is pending and +* very well possible that a Send Cmd event is pending. Acking HREG_EV_SLEEP_REQ is handled by hcf_action( +* HCF_ACT_INT_ON ) !!! +*10: Calibrate the S/W time-out protection mechanism by calling calibrate(). Note that possible errors +* in the calibration process are nor reported by init but will show up via the defunct mechanism in +* subsequent hcf-calls. +*14: usb_check_comp() is called to have the minimal visual clutter for the legacy H-I USB dongle +* compatibility check. +*16: The following configuration management related information is retrieved from the NIC: +* - HSI supplier +* - F/W Identity +* - F/W supplier +* if appropriate: +* - PRI Identity +* - PRI supplier +* appropriate means on H-I: always +* and on H-II if F/W supplier reflects a primary (i.e. only after an Hermes Reset or Init +* command). +* QUESTION ;? !!!!!! should, For each of the above RIDs the Endianess is converted to native Endianess. +* Only the return code of the first hcf_get_info is used. All hcf_get_info calls are made, regardless of +* the success or failure of the 1st hcf_get_info. The assumptions are: +* - if any call fails, they all fail, so remembering the result of the 1st call is adequate +* - a failing call will overwrite the L-field with a 0x0000 value, which services both as an +* error indication for the values cached in the IFB as making mmd_check_comp fail. +* In case of H-I, when getting the F/W identity fails, the F/W is assumed to be H-I AP F/W pre-dating +* version 9.0 and the F/W Identity and Supplier are faked accordingly. +* In case of H-II, the Primary, Station and AP Identity are merged into a single F/W Identity. +* The same applies to the Supplier information. As a consequence the PRI information can no longer be +* retrieved when a Tertiary runs. To accommodate MSFs and Utilities who depend on PRI information being +* available at any time, this information is cached in the IFB. In this cache the generic "F/W" value of +* the typ-fields is overwritten with the specific (legacy) "PRI" values. To actually re-route the (legacy) +* PRI request via hcf_get_info, the xxxx-table must be set. In case of H-I, this caching, modifying and +* re-routing is not needed because PRI information is always available directly from the NIC. For +* consistency the caching fields in the IFB are filled with the PRI information anyway. +*18: mdd_check_comp() is called to check the Supplier Variant and Range of the Host-S/W I/F (HSI) and the +* Primary Firmware Variant and Range against the Top and Bottom level supported by this HCF. If either of +* these tests fails, the CARD_STAT_INCOMP_PRI bit of IFB_CardStat is set +* Note: There should always be a primary except during production, so this makes the HCF in its current form +* unsuitable for manufacturing test systems like the FTS. This can be remedied by an adding a test like +* ifbp->IFB_PRISup.id == COMP_ID_PRI +*20: In case there is Tertiary F/W and this F/W is Station F/W, the Supplier Variant and Range of the Station +* Firmware function as retrieved from the Hermes is checked against the Top and Bottom level supported by +* this HCF. +* Note: ;? the tertiary F/W compatibility checks could be moved to the DHF, which already has checked the +* CFI and MFI compatibility of the image with the NIC before the image was downloaded. +*28: In case of non-Primary F/W: allocates and acknowledge a (TX or Notify) FID and allocates without +* acknowledge another (TX or Notify) FID (the so-called 1.5 alloc scheme) with the following steps: +* - execute the allocate command by calling cmd_exe +* - wait till either the alloc event or a time-out occurs +* - regardless whether the alloc event occurs, call get_fid to +* - read the FID and save it in IFB_RscInd to be used as "spare FID" +* - acknowledge the alloc event +* - do another "half" allocate to complete the "1.5 Alloc scheme" +* Note that above 3 steps do not harm and thus give the "cheapest" acceptable strategy. +* If a time-out occurred, then report time out status (after all) +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +HCF_STATIC int +init( IFBP ifbp ) +{ + +int rc = HCF_SUCCESS; + + HCFLOGENTRY( HCF_TRACE_INIT, 0 ) + + ifbp->IFB_CardStat = 0; /* 2*/ + OPW( HREG_EV_ACK, ~HREG_EV_SLEEP_REQ ); /* 4*/ + IF_PROT_TIME( calibrate( ifbp ); ) /*10*/ +#if 0 // OOR + ifbp->IFB_FWIdentity.len = 2; //misuse the IFB space for a put + ifbp->IFB_FWIdentity.typ = CFG_TICK_TIME; + ifbp->IFB_FWIdentity.comp_id = (1000*1000)/1024 + 1; //roughly 1 second + hcf_put_info( ifbp, (LTVP)&ifbp->IFB_FWIdentity.len ); +#endif // OOR + ifbp->IFB_FWIdentity.len = sizeof(CFG_FW_IDENTITY_STRCT)/sizeof(hcf_16) - 1; + ifbp->IFB_FWIdentity.typ = CFG_FW_IDENTITY; + rc = hcf_get_info( ifbp, (LTVP)&ifbp->IFB_FWIdentity.len ); +/* ;? conversion should not be needed for mmd_check_comp */ +#if HCF_BIG_ENDIAN + ifbp->IFB_FWIdentity.comp_id = CNV_LITTLE_TO_SHORT( ifbp->IFB_FWIdentity.comp_id ); + ifbp->IFB_FWIdentity.variant = CNV_LITTLE_TO_SHORT( ifbp->IFB_FWIdentity.variant ); + ifbp->IFB_FWIdentity.version_major = CNV_LITTLE_TO_SHORT( ifbp->IFB_FWIdentity.version_major ); + ifbp->IFB_FWIdentity.version_minor = CNV_LITTLE_TO_SHORT( ifbp->IFB_FWIdentity.version_minor ); +#endif // HCF_BIG_ENDIAN +#if defined MSF_COMPONENT_ID /*14*/ + if ( rc == HCF_SUCCESS ) { /*16*/ + ifbp->IFB_HSISup.len = sizeof(CFG_SUP_RANGE_STRCT)/sizeof(hcf_16) - 1; + ifbp->IFB_HSISup.typ = CFG_NIC_HSI_SUP_RANGE; + rc = hcf_get_info( ifbp, (LTVP)&ifbp->IFB_HSISup.len ); +/* ;? conversion should not be needed for mmd_check_comp , BUT according to a report of a BE-user it is + * should be resolved in the WARP release + * since some compilers make ugly but unnecessary code of these instructions even for LE, + * it is conditionally compiled */ +#if HCF_BIG_ENDIAN + ifbp->IFB_HSISup.role = CNV_LITTLE_TO_SHORT( ifbp->IFB_HSISup.role ); + ifbp->IFB_HSISup.id = CNV_LITTLE_TO_SHORT( ifbp->IFB_HSISup.id ); + ifbp->IFB_HSISup.variant = CNV_LITTLE_TO_SHORT( ifbp->IFB_HSISup.variant ); + ifbp->IFB_HSISup.bottom = CNV_LITTLE_TO_SHORT( ifbp->IFB_HSISup.bottom ); + ifbp->IFB_HSISup.top = CNV_LITTLE_TO_SHORT( ifbp->IFB_HSISup.top ); +#endif // HCF_BIG_ENDIAN + ifbp->IFB_FWSup.len = sizeof(CFG_SUP_RANGE_STRCT)/sizeof(hcf_16) - 1; + ifbp->IFB_FWSup.typ = CFG_FW_SUP_RANGE; + (void)hcf_get_info( ifbp, (LTVP)&ifbp->IFB_FWSup.len ); +/* ;? conversion should not be needed for mmd_check_comp */ +#if HCF_BIG_ENDIAN + ifbp->IFB_FWSup.role = CNV_LITTLE_TO_SHORT( ifbp->IFB_FWSup.role ); + ifbp->IFB_FWSup.id = CNV_LITTLE_TO_SHORT( ifbp->IFB_FWSup.id ); + ifbp->IFB_FWSup.variant = CNV_LITTLE_TO_SHORT( ifbp->IFB_FWSup.variant ); + ifbp->IFB_FWSup.bottom = CNV_LITTLE_TO_SHORT( ifbp->IFB_FWSup.bottom ); + ifbp->IFB_FWSup.top = CNV_LITTLE_TO_SHORT( ifbp->IFB_FWSup.top ); +#endif // HCF_BIG_ENDIAN + + if ( ifbp->IFB_FWSup.id == COMP_ID_PRI ) { /* 20*/ +int i = sizeof( CFG_FW_IDENTITY_STRCT) + sizeof(CFG_SUP_RANGE_STRCT ); + while ( i-- ) ((hcf_8*)(&ifbp->IFB_PRIIdentity))[i] = ((hcf_8*)(&ifbp->IFB_FWIdentity))[i]; + ifbp->IFB_PRIIdentity.typ = CFG_PRI_IDENTITY; + ifbp->IFB_PRISup.typ = CFG_PRI_SUP_RANGE; + xxxx[xxxx_PRI_IDENTITY_OFFSET] = &ifbp->IFB_PRIIdentity.len; + xxxx[xxxx_PRI_IDENTITY_OFFSET+1] = &ifbp->IFB_PRISup.len; + } + if ( !mmd_check_comp( (void*)&cfg_drv_act_ranges_hsi, &ifbp->IFB_HSISup) /* 22*/ +#if ( (HCF_TYPE) & HCF_TYPE_PRELOADED ) == 0 +//;? the PRI compatibility check is only relevant for DHF + || !mmd_check_comp( (void*)&cfg_drv_act_ranges_pri, &ifbp->IFB_PRISup) +#endif // HCF_TYPE_PRELOADED + ) { + ifbp->IFB_CardStat = CARD_STAT_INCOMP_PRI; + rc = HCF_ERR_INCOMP_PRI; + } + if ( ( ifbp->IFB_FWSup.id == COMP_ID_STA && !mmd_check_comp( (void*)&cfg_drv_act_ranges_sta, &ifbp->IFB_FWSup) ) || + ( ifbp->IFB_FWSup.id == COMP_ID_APF && !mmd_check_comp( (void*)&cfg_drv_act_ranges_apf, &ifbp->IFB_FWSup) ) + ) { /* 24 */ + ifbp->IFB_CardStat |= CARD_STAT_INCOMP_FW; + rc = HCF_ERR_INCOMP_FW; + } + } +#endif // MSF_COMPONENT_ID +#if (HCF_DL_ONLY) == 0 /* 28 */ + if ( rc == HCF_SUCCESS && ifbp->IFB_FWIdentity.comp_id >= COMP_ID_FW_STA ) { +PROT_CNT_INI + /************************************************************************************** + * rlav: the DMA engine needs the host to cause a 'hanging alloc event' for it to consume. + * not sure if this is the right spot in the HCF, thinking about hcf_enable... + **************************************************************************************/ + rc = cmd_exe( ifbp, HCMD_ALLOC, 0 ); +// 180 degree error in logic ;? #if ALLOC_15 +// ifbp->IFB_RscInd = 1; //let's hope that by the time hcf_send_msg isa called, there will be a FID +//#else + if ( rc == HCF_SUCCESS ) { + HCF_WAIT_WHILE( (IPW( HREG_EV_STAT ) & HREG_EV_ALLOC) == 0 ); + IF_PROT_TIME( HCFASSERT(prot_cnt, IPW( HREG_EV_STAT ) ) /*NOP*/;) +#if HCF_DMA + if ( ! ( ifbp->IFB_CntlOpt & USE_DMA ) ) +#endif // HCF_DMA + { + ifbp->IFB_RscInd = get_fid( ifbp ); + HCFASSERT( ifbp->IFB_RscInd, 0 ) + cmd_exe( ifbp, HCMD_ALLOC, 0 ); + IF_PROT_TIME( if ( prot_cnt == 0 ) rc = HCF_ERR_TIME_OUT; ) + } + } +//#endif // ALLOC_15 + } +#endif // HCF_DL_ONLY + HCFASSERT( rc == HCF_SUCCESS, rc ) + HCFLOGEXIT( HCF_TRACE_INIT ) + return rc; +} // init + +#if (HCF_DL_ONLY) == 0 +/************************************************************************************************************ +* +*.SUBMODULE void isr_info( IFBP ifbp ) +*.PURPOSE handles link events. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* +*.RETURNS N.A. +* +*.DESCRIPTION +* +* +*.DIAGRAM +*1: First the FID number corresponding with the InfoEvent is determined. +* Note the complication of the zero-FID protection sub-scheme in DAWA. +* Next the L-field and the T-field are fetched into scratch buffer info. +*2: In case of tallies, the 16 bits Hermes values are accumulated in the IFB into 32 bits values. Info[0] +* is (expected to be) HCF_NIC_TAL_CNT + 1. The contraption "while ( info[0]-- >1 )" rather than +* "while ( --info[0] )" is used because it is dangerous to determine the length of the Value field by +* decrementing info[0]. As a result of a bug in some version of the F/W, info[0] may be 0, resulting +* in a very long loop in the pre-decrement logic. +*4: In case of a link status frame, the information is copied to the IFB field IFB_linkStat +*6: All other than Tallies (including "unknown" ones) are checked against the selection set by the MSF +* via CFG_RID_LOG. If a match is found or the selection set has the wild-card type (i.e non-NULL buffer +* pointer at the terminating zero-type), the frame is copied to the (type-specific) log buffer. +* Note that to accumulate tallies into IFB AND to log them or to log a frame when a specific match occures +* AND based on the wild-card selection, you have to call setup_bap again after the 1st copy. +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +HCF_STATIC void +isr_info( IFBP ifbp ) +{ +hcf_16 info[2], fid; +#if (HCF_EXT) & HCF_EXT_INFO_LOG +RID_LOGP ridp = ifbp->IFB_RIDLogp; //NULL or pointer to array of RID_LOG structures (terminated by zero typ) +#endif // HCF_EXT_INFO_LOG + + HCFTRACE( ifbp, HCF_TRACE_ISR_INFO ); /* 1 */ + fid = IPW( HREG_INFO_FID ); + DAWA_ZERO_FID( HREG_INFO_FID ) + if ( fid ) { + (void)setup_bap( ifbp, fid, 0, IO_IN ); + get_frag( ifbp, (wci_bufp)info, 4 BE_PAR(2) ); + HCFASSERT( info[0] <= HCF_MAX_LTV + 1, MERGE_2( info[1], info[0] ) ) //;? a smaller value makes more sense +#if (HCF_TALLIES) & HCF_TALLIES_NIC //Hermes tally support + if ( info[1] == CFG_TALLIES ) { +hcf_32 *p; +/*2*/ if ( info[0] > HCF_NIC_TAL_CNT ) { + info[0] = HCF_NIC_TAL_CNT + 1; + } + p = (hcf_32*)&ifbp->IFB_NIC_Tallies; + while ( info[0]-- >1 ) *p++ += IPW( HREG_DATA_1 ); //request may return zero length + } + else +#endif // HCF_TALLIES_NIC + { +/*4*/ if ( info[1] == CFG_LINK_STAT ) { + ifbp->IFB_LinkStat = IPW( HREG_DATA_1 ); + } +#if (HCF_EXT) & HCF_EXT_INFO_LOG +/*6*/ while ( 1 ) { + if ( ridp->typ == 0 || ridp->typ == info[1] ) { + if ( ridp->bufp ) { + HCFASSERT( ridp->len >= 2, ridp->typ ) + ridp->bufp[0] = min((hcf_16)(ridp->len - 1), info[0] ); //save L + ridp->bufp[1] = info[1]; //save T + get_frag( ifbp, (wci_bufp)&ridp->bufp[2], (ridp->bufp[0] - 1)*2 BE_PAR(0) ); + } + break; + } + ridp++; + } +#endif // HCF_EXT_INFO_LOG + } + HCFTRACE( ifbp, HCF_TRACE_ISR_INFO | HCF_TRACE_EXIT ); + } + return; +} // isr_info +#endif // HCF_DL_ONLY + +// +// +// #endif // HCF_TALLIES_NIC +// /*4*/ if ( info[1] == CFG_LINK_STAT ) { +// ifbp->IFB_DSLinkStat = IPW( HREG_DATA_1 ) | CFG_LINK_STAT_CHANGE; //corrupts BAP !! ;? +// ifbp->IFB_LinkStat = ifbp->IFB_DSLinkStat & CFG_LINK_STAT_FW; //;? to be obsoleted +// printk( "<4>linkstatus: %04x\n", ifbp->IFB_DSLinkStat ); //;?remove me 1 day +// #if (HCF_SLEEP) & HCF_DDS +// if ( ( ifbp->IFB_DSLinkStat & CFG_LINK_STAT_CONNECTED ) == 0 ) { //even values are disconnected etc. +// ifbp->IFB_TickCnt = 0; //start 2 second period (with 1 tick uncertanty) +// printk( "<5>isr_info: AwaitConnection phase started, IFB_TickCnt = 0\n" ); //;?remove me 1 day +// } +// #endif // HCF_DDS +// } +// #if (HCF_EXT) & HCF_EXT_INFO_LOG +// /*6*/ while ( 1 ) { +// if ( ridp->typ == 0 || ridp->typ == info[1] ) { +// if ( ridp->bufp ) { +// HCFASSERT( ridp->len >= 2, ridp->typ ) +// (void)setup_bap( ifbp, fid, 2, IO_IN ); //restore BAP for tallies, linkstat and specific type followed by wild card +// ridp->bufp[0] = min( ridp->len - 1, info[0] ); //save L +// get_frag( ifbp, (wci_bufp)&ridp->bufp[1], ridp->bufp[0]*2 BE_PAR(0) ); +// } +// break; //;?this break is no longer needed due to setup_bap but lets concentrate on DDS first +// } +// ridp++; +// } +// #endif // HCF_EXT_INFO_LOG +// } +// HCFTRACE( ifbp, HCF_TRACE_ISR_INFO | HCF_TRACE_EXIT ); +// +// +// +// +// return; +//} // isr_info +//#endif // HCF_DL_ONLY + + +/************************************************************************************************************ +* +*.SUBMODULE void mdd_assert( IFBP ifbp, unsigned int line_number, hcf_32 q ) +*.PURPOSE filters assert on level and interfaces to the MSF supplied msf_assert routine. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* line_number line number of the line which caused the assert +* q qualifier, additional information which may give a clue about the problem +* +*.RETURNS N.A. +* +*.DESCRIPTION +* +* +*.DIAGRAM +* +*.NOTICE +* mdd_assert has been through a turmoil, renaming hcf_assert to assert and hcf_assert again and supporting off +* and on being called from the MSF level and other ( immature ) ModularDriverDevelopment modules like DHF and +* MMD. + * !!!! The assert routine is not an hcf_..... routine in the sense that it may be called by the MSF, + * however it is called from mmd.c and dhf.c, so it must be external. + * To prevent namespace pollution it needs a prefix, to prevent that MSF programmers think that + * they are allowed to call the assert logic, the prefix HCF can't be used, so MDD is selected!!!! + * +* When called from the DHF module the line number is incremented by DHF_FILE_NAME_OFFSET and when called from +* the MMD module by MMD_FILE_NAME_OFFSET. +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +#if HCF_ASSERT +void +mdd_assert( IFBP ifbp, unsigned int line_number, hcf_32 q ) +{ +hcf_16 run_time_flag = ifbp->IFB_AssertLvl; + + if ( run_time_flag /* > ;?????? */ ) { //prevent recursive behavior, later to be extended to level filtering + ifbp->IFB_AssertQualifier = q; + ifbp->IFB_AssertLine = (hcf_16)line_number; +#if (HCF_ASSERT) & ( HCF_ASSERT_LNK_MSF_RTN | HCF_ASSERT_RT_MSF_RTN ) + if ( ifbp->IFB_AssertRtn ) { + ifbp->IFB_AssertRtn( line_number, ifbp->IFB_AssertTrace, q ); + } +#endif // HCF_ASSERT_LNK_MSF_RTN / HCF_ASSERT_RT_MSF_RTN +#if (HCF_ASSERT) & HCF_ASSERT_SW_SUP + OPW( HREG_SW_2, line_number ); + OPW( HREG_SW_2, ifbp->IFB_AssertTrace ); + OPW( HREG_SW_2, (hcf_16)q ); + OPW( HREG_SW_2, (hcf_16)(q >> 16 ) ); +#endif // HCF_ASSERT_SW_SUP + +#if (HCF_EXT) & HCF_EXT_MB && (HCF_ASSERT) & HCF_ASSERT_MB + ifbp->IFB_AssertLvl = 0; // prevent recursive behavior + hcf_put_info( ifbp, (LTVP)&ifbp->IFB_AssertStrct ); + ifbp->IFB_AssertLvl = run_time_flag; // restore appropriate filter level +#endif // HCF_EXT_MB / HCF_ASSERT_MB + } +} // mdd_assert +#endif // HCF_ASSERT + + +/************************************************************************************************************ +* +*.SUBMODULE void put_frag( IFBP ifbp, wci_bufp bufp, int len BE_PAR( int word_len ) ) +*.PURPOSE writes with 16/32 bit I/O via BAP1 port from Host memory to NIC RAM. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* bufp (byte) address of buffer +* len length in bytes of buffer specified by bufp +* word_len Big Endian only: number of leading bytes to swap in pairs +* +*.RETURNS N.A. +* +*.DESCRIPTION +* process the single byte (if applicable) not yet written by the previous put_frag and copy len +* (or len-1) bytes from bufp to NIC. +* +* +*.DIAGRAM +* +*.NOTICE +* It turns out DOS ODI uses zero length fragments. The HCF code can cope with it, but as a consequence, no +* Assert on len is possible +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +HCF_STATIC void +put_frag( IFBP ifbp, wci_bufp bufp, int len BE_PAR( int word_len ) ) +{ +hcf_io io_port = ifbp->IFB_IOBase + HREG_DATA_1; //BAP data register +int i; //prevent side effects from macro +hcf_16 j; + HCFASSERT( ((hcf_32)bufp & (HCF_ALIGN-1) ) == 0, (hcf_32)bufp ) +#if HCF_BIG_ENDIAN + HCFASSERT( word_len == 0 || word_len == 2 || word_len == 4, word_len ) + HCFASSERT( word_len == 0 || ((hcf_32)bufp & 1 ) == 0, (hcf_32)bufp ) + HCFASSERT( word_len <= len, MERGE_2( word_len, len ) ) + + if ( word_len ) { //if there is anything to convert + //. convert and write the 1st hcf_16 + j = bufp[1] | bufp[0]<<8; + OUT_PORT_WORD( io_port, j ); + //. update pointer and counter accordingly + len -= 2; + bufp += 2; + if ( word_len > 1 ) { //. if there is to convert more than 1 word ( i.e 2 ) + //. . convert and write the 2nd hcf_16 + j = bufp[1] | bufp[0]<<8; /*bufp is already incremented by 2*/ + OUT_PORT_WORD( io_port, j ); + //. . update pointer and counter accordingly + len -= 2; + bufp += 2; + } + } +#endif // HCF_BIG_ENDIAN + i = len; + if ( i && ifbp->IFB_CarryOut ) { //skip zero-length + j = ((*bufp)<<8) + ( ifbp->IFB_CarryOut & 0xFF ); + OUT_PORT_WORD( io_port, j ); + bufp++; i--; + ifbp->IFB_CarryOut = 0; + } +#if (HCF_IO) & HCF_IO_32BITS + //skip zero-length I/O, single byte I/O and I/O not worthwhile (i.e. less than 6 bytes)for DW logic + //if buffer length >= 6 and 32 bits I/O support + if ( !(ifbp->IFB_CntlOpt & USE_16BIT) && i >= 6 ) { +hcf_32 FAR *p4; //prevent side effects from macro + if ( ( (hcf_32)bufp & 0x1 ) == 0 ) { //. if buffer at least word aligned + if ( (hcf_32)bufp & 0x2 ) { //. . if buffer not double word aligned + //. . . write a single word to get double word aligned + j = *(wci_recordp)bufp; //just to help ease writing macros with embedded assembly + OUT_PORT_WORD( io_port, j ); + //. . . adjust buffer length and pointer accordingly + bufp += 2; i -= 2; + } + //. . write as many double word as possible + p4 = (hcf_32 FAR *)bufp; + j = (hcf_16)i/4; + OUT_PORT_STRING_32( io_port, p4, j ); + //. . adjust buffer length and pointer accordingly + bufp += i & ~0x0003; + i &= 0x0003; + } + } +#endif // HCF_IO_32BITS + //if no 32-bit support OR byte aligned OR 1 word left + if ( i ) { + //. if odd number of bytes left + if ( i & 0x0001 ) { + //. . save left over byte (before bufp is corrupted) in carry, set carry flag + ifbp->IFB_CarryOut = (hcf_16)bufp[i-1] | 0x0100; //note that i and bufp are always simultaneously modified, &bufp[i-1] is invariant + } + //. write as many word as possible in "alignment safe" way + j = (hcf_16)i/2; + OUT_PORT_STRING_8_16( io_port, bufp, j ); + } +} // put_frag + + +/************************************************************************************************************ +* +*.SUBMODULE void put_frag_finalize( IFBP ifbp ) +*.PURPOSE cleanup after put_frag for trailing odd byte and MIC transfer to NIC. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* +*.RETURNS N.A. +* +*.DESCRIPTION +* finalize the MIC calculation with the padding pattern, output the last byte (if applicable) +* of the message and the MIC to the TxFS +* +* +*.DIAGRAM +*2: 1 byte of the last put_frag may be still in IFB_CarryOut ( the put_frag carry holder ), so ........ +* 1 - 3 bytes of the last put_frag may be still in IFB_tx_32 ( the MIC engine carry holder ), so ........ +* The call to the MIC calculation routine feeds these remaining bytes (if any) of put_frag and the +* just as many bytes of the padding as needed to the MIC calculation engine. Note that the "unneeded" pad +* bytes simply end up in the MIC engine carry holder and are never used. +*8: write the remainder of the MIC and possible some garbage to NIC RAM +* Note: i is always 4 (a loop-invariant of the while in point 2) +* +*.NOTICE +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +HCF_STATIC void +put_frag_finalize( IFBP ifbp ) +{ +#if (HCF_TYPE) & HCF_TYPE_WPA + if ( ifbp->IFB_MICTxCarry != 0xFFFF) { //if MIC calculation active + CALC_TX_MIC( mic_pad, 8); //. feed (up to 8 bytes of) virtual padding to MIC engine + //. write (possibly) trailing byte + (most of) MIC + put_frag( ifbp, (wci_bufp)ifbp->IFB_MICTx, 8 BE_PAR(0) ); + } +#endif // HCF_TYPE_WPA + put_frag( ifbp, null_addr, 1 BE_PAR(0) ); //write (possibly) trailing data or MIC byte +} // put_frag_finalize + + +/************************************************************************************************************ +* +*.SUBMODULE int put_info( IFBP ifbp, LTVP ltvp ) +*.PURPOSE support routine to handle the "basic" task of hcf_put_info to pass RIDs to the NIC. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* ltvp address in NIC RAM where LVT-records are located +* +*.RETURNS +* HCF_SUCCESS +* >>put_frag +* >>cmd_wait +* +*.DESCRIPTION +* +* +*.DIAGRAM +*20: do not write RIDs to NICs which have incompatible Firmware +*24: If the RID does not exist, the L-field is set to zero. +* Note that some RIDs can not be read, e.g. the pseudo RIDs for direct Hermes commands and CFG_DEFAULT_KEYS +*28: If the RID is written successful, pass it to the NIC by means of an Access Write command +* +*.NOTICE +* The mechanism to HCF_ASSERT on invalid typ-codes in the LTV record is based on the following strategy: +* - some codes (e.g. CFG_REG_MB) are explicitly handled by the HCF which implies that these codes +* are valid. These codes are already consumed by hcf_put_info. +* - all other codes are passed to the Hermes. Before the put action is executed, hcf_get_info is called +* with an LTV record with a value of 1 in the L-field and the intended put action type in the Typ-code +* field. If the put action type is valid, it is also valid as a get action type code - except +* for CFG_DEFAULT_KEYS and CFG_ADD_TKIP_DEFAULT_KEY - so the HCF_ASSERT logic of hcf_get_info should +* not catch. +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +HCF_STATIC int +put_info( IFBP ifbp, LTVP ltvp ) +{ + +int rc = HCF_SUCCESS; + + HCFASSERT( ifbp->IFB_CardStat == 0, MERGE_2( ltvp->typ, ifbp->IFB_CardStat ) ) + HCFASSERT( CFG_RID_CFG_MIN <= ltvp->typ && ltvp->typ <= CFG_RID_CFG_MAX, ltvp->typ ) + + if ( ifbp->IFB_CardStat == 0 && /* 20*/ + ( ( CFG_RID_CFG_MIN <= ltvp->typ && ltvp->typ <= CFG_RID_CFG_MAX ) || + ( CFG_RID_ENG_MIN <= ltvp->typ /* && ltvp->typ <= 0xFFFF */ ) ) ) { +#if HCF_ASSERT //FCC8, FCB0, FCB4, FCB6, FCB7, FCB8, FCC0, FCC4, FCBC, FCBD, FCBE, FCBF + { + hcf_16 t = ltvp->typ; + LTV_STRCT x = { 2, t, {0} }; /*24*/ + hcf_get_info( ifbp, (LTVP)&x ); + if ( x.len == 0 && + ( t != CFG_DEFAULT_KEYS && t != CFG_ADD_TKIP_DEFAULT_KEY && t != CFG_REMOVE_TKIP_DEFAULT_KEY && + t != CFG_ADD_TKIP_MAPPED_KEY && t != CFG_REMOVE_TKIP_MAPPED_KEY && + t != CFG_HANDOVER_ADDR && t != CFG_DISASSOCIATE_ADDR && + t != CFG_FCBC && t != CFG_FCBD && t != CFG_FCBE && t != CFG_FCBF && + t != CFG_DEAUTHENTICATE_ADDR + ) + ) { + HCFASSERT( DO_ASSERT, ltvp->typ ) + } + } +#endif // HCF_ASSERT + + rc = setup_bap( ifbp, ltvp->typ, 0, IO_OUT ); + put_frag( ifbp, (wci_bufp)ltvp, 2*ltvp->len + 2 BE_PAR(2) ); +/*28*/ if ( rc == HCF_SUCCESS ) { + rc = cmd_exe( ifbp, HCMD_ACCESS + HCMD_ACCESS_WRITE, ltvp->typ ); + } + } + return rc; +} // put_info + + +#if (HCF_DL_ONLY) == 0 +/************************************************************************************************************ +* +*.SUBMODULE int put_info_mb( IFBP ifbp, CFG_MB_INFO_STRCT FAR * ltvp ) +*.PURPOSE accumulates a ( series of) buffers into a single Info block into the MailBox. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* ltvp address of structure specifying the "type" and the fragments of the information to be synthesized +* as an LTV into the MailBox +* +*.RETURNS +* +*.DESCRIPTION +* If the data does not fit (including no MailBox is available), the IFB_MBTally is incremented and an +* error status is returned. +* HCF_ASSERT does not catch. +* Calling put_info_mb when their is no MailBox available, is considered a design error in the MSF. +* +* Note that there is always at least 1 word of unused space in the mail box. +* As a consequence: +* - no problem in pointer arithmetic (MB_RP == MB_WP means unambiguously mail box is completely empty +* - There is always free space to write an L field with a value of zero after each MB_Info block. This +* allows for an easy scan mechanism in the "get MB_Info block" logic. +* +* +*.DIAGRAM +*1: Calculate L field of the MBIB, i.e. 1 for the T-field + the cumulative length of the fragments. +*2: The free space in the MailBox is calculated (2a: free part from Write Ptr to Read Ptr, 2b: free part +* turns out to wrap around) . If this space suffices to store the number of words reflected by len (T-field +* + Value-field) plus the additional MailBox Info L-field + a trailing 0 to act as the L-field of a trailing +* dummy or empty LTV record, then a MailBox Info block is build in the MailBox consisting of +* - the value len in the first word +* - type in the second word +* - a copy of the contents of the fragments in the second and higher word +* +*4: Since put_info_mb() can more or less directly be called from the MSF level, the I/F must be robust +* against out-of-range variables. As failsafe coding, the MB update is skipped by changing tlen to 0 if +* len == 0; This will indirectly cause an assert as result of the violation of the next if clause. +*6: Check whether the free space in MailBox suffices (this covers the complete absence of the MailBox). +* Note that len is unsigned, so even MSF I/F violation works out O.K. +* The '2' in the expression "len+2" is used because 1 word is needed for L itself and 1 word is needed +* for the zero-sentinel +*8: update MailBox Info length report to MSF with "oldest" MB Info Block size. Be carefull here, if you get +* here before the MailBox is registered, you can't read from the buffer addressed by IFB_MBp (it is the +* Null buffer) so don't move this code till the end of this routine but keep it where there is garuanteed +* a buffer. +* +*.NOTICE +* boundary testing depends on the fact that IFB_MBSize is guaranteed to be zero if no MailBox is present, +* and to a lesser degree, that IFB_MBWp = IFB_MBRp = 0 +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +#if (HCF_EXT) & HCF_EXT_MB + +HCF_STATIC int +put_info_mb( IFBP ifbp, CFG_MB_INFO_STRCT FAR * ltvp ) +{ + +int rc = HCF_SUCCESS; +hcf_16 i; //work counter +hcf_16 *dp; //destination pointer (in MailBox) +wci_recordp sp; //source pointer +hcf_16 len; //total length to copy to MailBox +hcf_16 tlen; //free length/working length/offset in WMP frame + + if ( ifbp->IFB_MBp == NULL ) return rc; //;?not sufficient + HCFASSERT( ifbp->IFB_MBp != NULL, 0 ) //!!!be careful, don't get into an endless recursion + HCFASSERT( ifbp->IFB_MBSize, 0 ) + + len = 1; /* 1 */ + for ( i = 0; i < ltvp->frag_cnt; i++ ) { + len += ltvp->frag_buf[i].frag_len; + } + if ( ifbp->IFB_MBRp > ifbp->IFB_MBWp ) { + tlen = ifbp->IFB_MBRp - ifbp->IFB_MBWp; /* 2a*/ + } else { + if ( ifbp->IFB_MBRp == ifbp->IFB_MBWp ) { + ifbp->IFB_MBRp = ifbp->IFB_MBWp = 0; // optimize Wrapping + } + tlen = ifbp->IFB_MBSize - ifbp->IFB_MBWp; /* 2b*/ + if ( ( tlen <= len + 2 ) && ( len + 2 < ifbp->IFB_MBRp ) ) { //if trailing space is too small but + // leading space is sufficiently large + ifbp->IFB_MBp[ifbp->IFB_MBWp] = 0xFFFF; //flag dummy LTV to fill the trailing space + ifbp->IFB_MBWp = 0; //reset WritePointer to begin of MailBox + tlen = ifbp->IFB_MBRp; //get new available space size + } + } + dp = &ifbp->IFB_MBp[ifbp->IFB_MBWp]; + if ( len == 0 ) { + tlen = 0; //;? what is this good for + } + if ( len + 2 >= tlen ){ /* 6 */ + //Do Not ASSERT, this is a normal condition + IF_TALLY( ifbp->IFB_HCF_Tallies.NoBufMB++; ) /*NOP to cover against analomies with empty compound*/; + rc = HCF_ERR_LEN; + } else { + *dp++ = len; //write Len (= size of T+V in words to MB_Info block + *dp++ = ltvp->base_typ; //write Type to MB_Info block + ifbp->IFB_MBWp += len + 1; //update WritePointer of MailBox + for ( i = 0; i < ltvp->frag_cnt; i++ ) { // process each of the fragments + sp = ltvp->frag_buf[i].frag_addr; + len = ltvp->frag_buf[i].frag_len; + while ( len-- ) *dp++ = *sp++; + } + ifbp->IFB_MBp[ifbp->IFB_MBWp] = 0; //to assure get_info for CFG_MB_INFO stops + ifbp->IFB_MBInfoLen = ifbp->IFB_MBp[ifbp->IFB_MBRp]; /* 8 */ + } + return rc; +} // put_info_mb + +#endif // HCF_EXT_MB +#endif // HCF_DL_ONLY + + +/************************************************************************************************************ +* +*.SUBMODULE int setup_bap( IFBP ifbp, hcf_16 fid, int offset, int type ) +*.PURPOSE set up data access to NIC RAM via BAP_1. +* +*.ARGUMENTS +* ifbp address of I/F Block +* fid FID/RID +* offset !!even!! offset in FID/RID +* type IO_IN, IO_OUT +* +*.RETURNS +* HCF_SUCCESS O.K +* HCF_ERR_NO_NIC card is removed +* HCF_ERR_DEFUNCT_TIME_OUT Fatal malfunction detected +* HCF_ERR_DEFUNCT_..... if and only if IFB_DefunctStat <> 0 +* +*.DESCRIPTION +* +* A non-zero return status indicates: +* - the NIC is considered nonoperational, e.g. due to a time-out of some Hermes activity in the past +* - BAP_1 could not properly be initialized +* - the card is removed before completion of the data transfer +* In all other cases, a zero is returned. +* BAP Initialization failure indicates an H/W error which is very likely to signal complete H/W failure. +* Once a BAP Initialization failure has occurred all subsequent interactions with the Hermes will return a +* "defunct" status till the Hermes is re-initialized by means of an hcf_connect. +* +* A BAP is a set of registers (Offset, Select and Data) offering read/write access to a particular FID or +* RID. This access is based on a auto-increment feature. +* There are two BAPs but these days the HCF uses only BAP_1 and leaves BAP_0 to the PCI Busmastering H/W. +* +* The BAP-mechanism is based on the Busy bit in the Offset register (see the Hermes definition). The waiting +* for Busy must occur between writing the Offset register and accessing the Data register. The +* implementation to wait for the Busy bit drop after each write to the Offset register, implies that the +* requirement that the Busy bit is low before the Select register is written, is automatically met. +* BAP-setup may be time consuming (e.g. 380 usec for large offsets occurs frequently). The wait for Busy bit +* drop is protected by a loop counter, which is initialized with IFB_TickIni, which is calibrated in init. +* +* The NIC I/F is optimized for word transfer and can only handle word transfer at a word boundary in NIC +* RAM. The intended solution for transfer of a single byte has multiple H/W flaws. There have been different +* S/W Workaround strategies. RID access is hcf_16 based by "nature", so no byte access problems. For Tx/Rx +* FID access, the byte logic became obsolete by absorbing it in the double word oriented nature of the MIC +* feature. +* +* +*.DIAGRAM +* +*2: the test on rc checks whether the HCF went into "defunct" mode ( e.g. BAP initialization or a call to +* cmd_wait did ever fail). +*4: the select register and offset register are set +* the offset register is monitored till a successful condition (no busy bit) is detected or till the +* (calibrated) protection counter expires +* If the counter expires, this is reflected in IFB_DefunctStat, so all subsequent calls to setup_bap fail +* immediately ( see 2) +*6: initialization of the carry as used by pet/get_frag +*8: HREG_OFFSET_ERR is ignored as error because: +* a: the Hermes is robust against it +* b: it is not known what causes it (probably a bug), hence no strategy can be specified which level is +* to handle this error in which way. In the past, it could be induced by the MSF level, e.g. by calling +* hcf_rcv_msg while there was no Rx-FID available. Since this is an MSF-error which is caught by ASSERT, +* there is no run-time action required by the HCF. +* Lumping the Offset error in with the Busy bit error, as has been done in the past turns out to be a +* disaster or a life saver, just depending on what the cause of the error is. Since no prediction can be +* done about the future, it is "felt" to be the best strategy to ignore this error. One day the code was +* accompanied by the following comment: +* // ignore HREG_OFFSET_ERR, someone, supposedly the MSF programmer ;) made a bug. Since we don't know +* // what is going on, we might as well go on - under management pressure - by ignoring it +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +HCF_STATIC int +setup_bap( IFBP ifbp, hcf_16 fid, int offset, int type ) +{ +PROT_CNT_INI +int rc; + + HCFTRACE( ifbp, HCF_TRACE_STRIO ); + if ( ( rc = ifbp->IFB_DefunctStat ) == HCF_SUCCESS ) { /*2*/ + OPW( HREG_SELECT_1, fid ); /*4*/ + OPW( HREG_OFFSET_1, offset ); + if ( type == IO_IN ) { + ifbp->IFB_CarryIn = 0; + } + else ifbp->IFB_CarryOut = 0; + HCF_WAIT_WHILE( IPW( HREG_OFFSET_1) & HCMD_BUSY ); + HCFASSERT( !( IPW( HREG_OFFSET_1) & HREG_OFFSET_ERR ), MERGE_2( fid, offset ) ) /*8*/ + if ( prot_cnt == 0 ) { + HCFASSERT( DO_ASSERT, MERGE_2( fid, offset ) ) + rc = ifbp->IFB_DefunctStat = HCF_ERR_DEFUNCT_TIME_OUT; + ifbp->IFB_CardStat |= CARD_STAT_DEFUNCT; + } + } + HCFTRACE( ifbp, HCF_TRACE_STRIO | HCF_TRACE_EXIT ); + return rc; +} // setup_bap + diff --git a/drivers/staging/wlags49_h2/hcf.h b/drivers/staging/wlags49_h2/hcf.h new file mode 100644 index 000000000000..2cd573944cdc --- /dev/null +++ b/drivers/staging/wlags49_h2/hcf.h @@ -0,0 +1,405 @@ + +// vim:tw=110:ts=4: +#ifndef HCF_H +#define HCF_H 1 + +/************************************************************************************************************ +* +* FILE : hcf.h +* +* DATE : $Date: 2004/08/05 11:47:10 $ $Revision: 1.7 $ +* Original: 2004/05/19 07:26:01 Revision: 1.56 Tag: hcf7_t20040602_01 +* Original: 2004/05/12 08:47:23 Revision: 1.53 Tag: hcf7_t7_20040513_01 +* Original: 2004/04/15 09:24:42 Revision: 1.46 Tag: hcf7_t7_20040415_01 +* Original: 2004/04/08 15:18:16 Revision: 1.45 Tag: t7_20040413_01 +* Original: 2004/04/01 15:32:55 Revision: 1.43 Tag: t7_20040401_01 +* Original: 2004/03/10 15:39:28 Revision: 1.39 Tag: t20040310_01 +* Original: 2004/03/04 11:03:38 Revision: 1.37 Tag: t20040304_01 +* Original: 2004/03/02 14:51:21 Revision: 1.35 Tag: t20040302_03 +* Original: 2004/02/24 13:00:28 Revision: 1.28 Tag: t20040224_01 +* Original: 2004/02/09 14:50:14 Revision: 1.26 Tag: t20040219_01 +* +* AUTHOR : Nico Valster +* +* SPECIFICATION: .......... +* +* DESC : Definitions and Prototypes for MSF as well as HCF sources +* +* Customizable via HCFCFG.H +* +* +************************************************************************************************************** + +************************************************************************************************************** +* +* +* SOFTWARE LICENSE +* +* This software is provided subject to the following terms and conditions, +* which you should read carefully before using the software. Using this +* software indicates your acceptance of these terms and conditions. If you do +* not agree with these terms and conditions, do not use the software. +* +* COPYRIGHT © 1994 - 1995 by AT&T. All Rights Reserved +* COPYRIGHT © 1996 - 2000 by Lucent Technologies. All Rights Reserved +* COPYRIGHT © 2001 - 2004 by Agere Systems Inc. All Rights Reserved +* All rights reserved. +* +* Redistribution and use in source or binary forms, with or without +* modifications, are permitted provided that the following conditions are met: +* +* . Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following Disclaimer as comments in the code as +* well as in the documentation and/or other materials provided with the +* distribution. +* +* . Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following Disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* . Neither the name of Agere Systems Inc. nor the names of the contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* Disclaimer +* +* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY +* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN +* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +* DAMAGE. +* +* +*************************************************************************************************************/ + + +#include "hcfcfg.h" // System Constants to be defined by the MSF-programmer to tailor the HCF +#include "mdd.h" // Include file common for HCF, MSF + + +/************************************************************************************************/ +/************************************** MACROS ************************************************/ +/************************************************************************************************/ + +#define LOF(x) (sizeof(x)/sizeof(hcf_16)-1) + +/* Endianess + * Little Endian (a.k.a. Intel), least significant byte first + * Big Endian (a.k.a. Motorola), most significant byte first + * + * The following macros are supplied + * o CNV_LITTLE_TO_SHORT(w) interprets the 16-bits input value as Little Endian, returns an hcf_16 + * o CNV_BIG_TO_SHORT(w) interprets the 16-bits input value as Big Endian, returns an hcf_16 + * + */ + +/* To increase portability, use unsigned char and unsigned char * when accessing parts of larger + * types to convert their Endianess + */ + +#define CNV_END_SHORT(w) (hcf_16)( ((hcf_16)(w) & 0x00FF) << 8 | ((hcf_16)(w) & 0xFF00) >> 8 ) +#define CNV_END_LONG(dw) (hcf_32)( (dw >> 24) | ((dw >> 8) & 0xff00) | ((dw << 8) & 0xff0000) | (dw << 24) ) + +#if HCF_BIG_ENDIAN +//******************************************** B I G E N D I A N ******************************************* +#define CNV_LITTLE_TO_SHORT(w) CNV_END_SHORT(w) // endianess conversion needed +#define CNV_BIG_TO_SHORT(w) (w) // no endianess conversion needed +#define CNV_LITTLE_TO_LONG(dw) CNV_END_LONG(dw) +#define CNV_LONG_TO_LITTLE(dw) CNV_END_LONG(dw) +#else +//****************************************** L I T T L E E N D I A N **************************************** +#define CNV_LITTLE_TO_SHORT(w) (w) // no endianess conversion needed +#define CNV_BIG_TO_SHORT(w) CNV_END_SHORT(w) // endianess conversion needed +#define CNV_LITTLE_TO_LONG(dw) (dw) +#define CNV_LONG_TO_LITTLE(dw) (dw) + +#if defined HCF_ALIGN && HCF_ALIGN > 1 +#define CNV_SHORTP_TO_LITTLE(pw) ((hcf_16)(*(hcf_8 *)pw)) | ((hcf_16)(*((hcf_8 *)pw+1)) << 8) +#define CNV_LONGP_TO_LITTLE(pdw) ((hcf_32)(*(hcf_8 *)pdw)) | ((hcf_32)(*((hcf_8 *)pdw+1)) << 8) | \ + ((hcf_32)(*((hcf_8 *)pdw+2)) << 16) | ((hcf_32)(*((hcf_8 *)pdw+3)) << 24) +#else +#define CNV_LONGP_TO_LITTLE(pdw) (*(hcf_32 *)pdw) +#define CNV_SHORTP_TO_LITTLE(pw) (*(hcf_16 *)pw) +#endif + +#endif // HCF_BIG_ENDIAN + +// conversion macros which can be expressed in other macros +#define CNV_SHORT_TO_LITTLE(w) CNV_LITTLE_TO_SHORT(w) +#define CNV_SHORT_TO_BIG(w) CNV_BIG_TO_SHORT(w) + +/************************************************************************************************/ +/************************************** END OF MACROS *****************************************/ +/************************************************************************************************/ + +/***********************************************************************************************************/ +/***************** ****************************************/ +/***********************************************************************************************************/ + +// offsets Transmit/Receive Frame Structure +#define HFS_STAT 0x0000 +#define HFS_SWSUP 0x0006 //SW Support +#define HFS_Q_INFO 0x0006 //Signal/Silence level +#define HFS_RATE 0x0008 //RxFlow/Rate +#define HFS_STAT_ERR RX_STAT_ERR //link "natural" HCF name to "natural" MSF name +#define HFS_TX_CNTL 0x0036 + // H-I H-II +#define HFS_DAT_LEN (HFS_ADDR_DEST - 2) // 0x002C 0x0038 +#define HFS_ADDR_DEST 0x003A // 0x002E 0x003A +#define HFS_ADDR_SRC (HFS_ADDR_DEST + 6) // 0x0034 0x0040 +#define HFS_LEN (HFS_ADDR_SRC + 6) // 0x003A 0x0046 +#define HFS_DAT (HFS_LEN + 2) // 0x003C 0x0048 +#define HFS_TYPE (HFS_DAT + 6) // 0x0042 0x004E + + +//============================= D E S C R I P T O R S T R U C T U R E ============================== +//;?MDD.H stuff ;? + +#if HCF_BIG_ENDIAN +#define DESC_STRCT_CNT 0 +#define DESC_STRCT_SIZE 1 +#else +#define DESC_STRCT_CNT 1 +#define DESC_STRCT_SIZE 0 +#endif // HCF_BIG_ENDIAN + +#define BUF_CNT buf_dim[DESC_STRCT_CNT] +#define BUF_SIZE buf_dim[DESC_STRCT_SIZE] + +typedef struct DESC_STRCT { + hcf_16 buf_dim[2]; + hcf_32 buf_phys_addr; + hcf_32 next_desc_phys_addr; // physical address of next descriptor + hcf_32 desc_phys_addr; // physical address of this descriptor + struct DESC_STRCT *next_desc_addr; + hcf_8 FAR *buf_addr; +#if (HCF_EXT) & HCF_EXT_DESC_STRCT + void FAR *DESC_MSFSup; // pointer for arbitrary use by the MSF +#endif // HCF_DESC_STRCT_EXT +} DESC_STRCT; + +#define HCF_DASA_SIZE 12 //size in bytes for DA/SA + +#define DESC_CNT_MASK 0x0FFF + +#define GET_BUF_SIZE(descp) ((descp)->BUF_SIZE) +#define GET_BUF_CNT(descp) ((descp)->BUF_CNT) +#define SET_BUF_SIZE(descp, size) (descp)->BUF_SIZE = size; +#define SET_BUF_CNT(descp, count) (descp)->BUF_CNT = count; + +//========================================= T A L L I E S =================================================== + +typedef struct { //Hermes Tallies (IFB substructure) + hcf_32 TxUnicastFrames; + hcf_32 TxMulticastFrames; + hcf_32 TxFragments; + hcf_32 TxUnicastOctets; + hcf_32 TxMulticastOctets; + hcf_32 TxDeferredTransmissions; + hcf_32 TxSingleRetryFrames; + hcf_32 TxMultipleRetryFrames; + hcf_32 TxRetryLimitExceeded; + hcf_32 TxDiscards; + hcf_32 RxUnicastFrames; + hcf_32 RxMulticastFrames; + hcf_32 RxFragments; + hcf_32 RxUnicastOctets; + hcf_32 RxMulticastOctets; + hcf_32 RxFCSErrors; + hcf_32 RxDiscardsNoBuffer; + hcf_32 TxDiscardsWrongSA; + hcf_32 RxWEPUndecryptable; + hcf_32 RxMsgInMsgFragments; + hcf_32 RxMsgInBadMsgFragments; + hcf_32 RxDiscardsWEPICVError; + hcf_32 RxDiscardsWEPExcluded; +#if (HCF_EXT) & HCF_EXT_TALLIES_FW + hcf_32 TalliesExtra[32]; +#endif // HCF_EXT_TALLIES_FW +} CFG_HERMES_TALLIES_STRCT; + +typedef struct { //HCF Tallies (IFB substructure) + hcf_32 NoBufInfo; //No buffer available for unsolicited Notify frame + hcf_32 NoBufMB; //No space available in MailBox + hcf_32 MiscErr; /* Command errors + * - time out on completion synchronous part Hermes Command + * - completed Hermes Command doesn't match original command + * - status of completed Hermes Command contains error bits + */ +#if (HCF_EXT) & HCF_EXT_TALLIES_FW + hcf_32 EngCnt[8]; +#endif // HCF_EXT_TALLIES_FW +} CFG_HCF_TALLIES_STRCT; + +//Note this way to define ..._TAL_CNT implies that all tallies must keep the same (hcf_32) size +#if (HCF_TALLIES) & ( HCF_TALLIES_NIC | HCF_TALLIES_HCF ) +#if (HCF_TALLIES) & HCF_TALLIES_NIC //Hermes tally support +#define HCF_NIC_TAL_CNT (sizeof(CFG_HERMES_TALLIES_STRCT)/ sizeof(hcf_32)) +#else +#define HCF_NIC_TAL_CNT 0 +#endif // HCF_TALLIES +#if (HCF_TALLIES) & HCF_TALLIES_HCF //HCF tally support +#define HCF_HCF_TAL_CNT (sizeof(CFG_HCF_TALLIES_STRCT) / sizeof(hcf_32)) +#else +#define HCF_HCF_TAL_CNT 0 +#endif // HCF_TALLIES +#define HCF_TOT_TAL_CNT ( HCF_NIC_TAL_CNT + HCF_NIC_TAL_CNT ) +#endif // HCF_TALLIES_NIC / HCF_TALLIES_HCF + + +/***********************************************************************************************************/ +/********************************** I N T E R F A C E B L O C K ******************************************/ +/***********************************************************************************************************/ + +#define IFB_VERSION 0x0E // initially 0, to be incremented by every IFB layout change + +typedef struct { + hcf_io IFB_IOBase; // I/O address of Hermes chip as passed by MSF at hcf_connect call + hcf_16 IFB_IORange; // I/O Range used by Hermes chip + hcf_16 IFB_DLMode; // Download Mode state + hcf_16 IFB_Cmd; // cmd in progress flag, to be ack-ed before next cmd can be issued + hcf_16 IFB_RxFID; // FID of "current" RxFS (non-DMA mode) +//;?#if tx_delay option + hcf_16 IFB_TxFID; // fid storage during "delayed" send +//;?#endif tx_delay option + hcf_16 IFB_RxLen; // + hcf_16 IFB_DefunctStat; // BAP initialization or Cmd Completion failed + hcf_16 IFB_ErrCmd; // contents Status reg when error bits and/or mismatch in cmd_wait + hcf_16 IFB_ErrQualifier; // contents Resp0 reg when error bits and/or mismatch in cmd_wait + hcf_16 IFB_lal; // LookAhead Length + wci_bufp IFB_lap; // LookAhead Buffer pointer + hcf_16 IFB_LinkStat; // Link Status + hcf_16 IFB_DSLinkStat; // Link Status, new strategy introduced for DeepSleep + hcf_16 IFB_CarryIn; // carry and carry-flag to move 1 byte from one get_frag to the next + hcf_16 IFB_CarryOut; // carry and carry-flag to move 1 byte from one put_frag to the next + hcf_16 IFB_Version; // IFB_VERSION, incremented by every SIGNIFICANT IFB layout change + hcf_16 IFB_CardStat; // NIC error / F/W incompatibility status + hcf_16 IFB_RscInd; // non-DMA: TxFID available, DMA: always 1 + hcf_16 IFB_CntlOpt; // flags: 32 bits I/O, DMA available, DMA enabled + hcf_16 IFB_BusType; // BusType, derived via CFG_NIC_BUS_TYPE + CFG_FW_IDENTITY_STRCT IFB_FWIdentity; /* keep FWIdentity/Sup and PRIIdentity/Sup in sequence + * because of the (dumb) copy in init() */ +#if defined MSF_COMPONENT_ID + CFG_SUP_RANGE_STRCT IFB_FWSup; + CFG_PRI_IDENTITY_STRCT IFB_PRIIdentity; + CFG_SUP_RANGE_STRCT IFB_PRISup; + CFG_SUP_RANGE_STRCT IFB_HSISup; +#endif // MSF_COMPONENT_ID +#if (HCF_EXT) & HCF_EXT_INFO_LOG + RID_LOGP IFB_RIDLogp; // pointer to RID_LOG structure +#endif // HCF_EXT_INFO_LOG +#if HCF_PROT_TIME + hcf_32 IFB_TickIni; // initialization of S/W counter based protection loop +#endif // HCF_PROT_TIME +#if (HCF_EXT) & HCF_EXT_INT_TICK + int IFB_TickCnt; // Hermes Timer Tick Counter +#endif // HCF_EXT_INT_TICK +#if (HCF_EXT) & HCF_EXT_MB + hcf_16 *IFB_MBp; // pointer to the MailBox + hcf_16 IFB_MBSize; // size of the MailBox + hcf_16 IFB_MBWp; // zero-based write index into the MailBox + hcf_16 IFB_MBRp; // zero-based read index into the MailBox + hcf_16 IFB_MBInfoLen; // contents of L-field of the oldest available MailBoxInfoBlock +#endif // HCF_EXT_MB +#if (HCF_TYPE) & HCF_TYPE_WPA + hcf_16 IFB_MICTxCntl; // MIC bit and Key index in TxControl field of TxFS + hcf_32 IFB_MICTxKey[2]; // calculating key + hcf_32 IFB_MICTx[2]; // Tx MIC calculation Engine state + hcf_16 IFB_MICTxCarry; // temp length, carries over from one Tx fragment to another + hcf_16 IFB_MICRxCarry; // temp length, carries over from one Rx fragment to another + hcf_32 IFB_MICRxKey[4*2]; // 4 checking keys + hcf_32 IFB_MICRx[2]; // Rx MIC calculation Engine state +#endif // HCF_TYPE_WPA +#if HCF_ASSERT +#if (HCF_ASSERT) & HCF_ASSERT_MB + CFG_MB_INFO_RANGE1_STRCT IFB_AssertStrct; // Add some complication to the HCF as prize for the new MSF I/F +#endif // HCF_ASSERT_MB + // target of above IFB_AssertStrct + hcf_16 IFB_AssertLine; // - line number ( + encoded module name ) + hcf_16 IFB_AssertTrace; // - bit based trace of all hcf_.... invocations + hcf_32 IFB_AssertQualifier; // - qualifier + hcf_16 IFB_AssertLvl; // Assert Filtering, Not yet implemented + hcf_16 IFB_AssertWhere; // Where parameter of the Assert macro +#if (HCF_ASSERT) & ( HCF_ASSERT_LNK_MSF_RTN | HCF_ASSERT_RT_MSF_RTN ) + MSF_ASSERT_RTNP IFB_AssertRtn; // MSF Assert Call back routine (inspired by GEF, DrDobbs Nov 1998 ) +#endif // HCF_ASSERT_LNK_MSF_RTN +#if (HCF_ASSERT) & HCF_ASSERT_PRINTF // engineering facilty intended as F/W debugging aid + hcf_16 IFB_DbgPrintF_Cnt; + CFG_FW_PRINTF_BUFFER_LOCATION_STRCT IFB_FwPfBuff; +#endif // HCF_ASSERT_PRINTF +#endif // HCF_ASSERT +#if ! defined HCF_INT_OFF + hcf_16 volatile IFB_IntOffCnt; // 0xFFFF based HCF_ACT_INT_OFF nesting counter, DeepSleep flag +#endif // HCF_INT_OFF +#if (HCF_TYPE) & HCF_TYPE_CCX + hcf_16 IFB_CKIPStat; // CKIP Status flag +#endif // HCF_TYPE_CCX +#if (HCF_TALLIES) & ( HCF_TALLIES_NIC | HCF_TALLIES_HCF ) //Hermes and/or HCF tally support + hcf_32 IFB_Silly_you_should_align; //;? + hcf_16 IFB_TallyLen; // Tally length (to build an LTV) + hcf_16 IFB_TallyTyp; // Tally Type (to build an LTV) +#endif // HCF_TALLIES_NIC / HCF_TALLIES_HCF +#if (HCF_TALLIES) & HCF_TALLIES_NIC //Hermes tally support + CFG_HERMES_TALLIES_STRCT IFB_NIC_Tallies; +#endif // HCF_TALLIES_NIC +#if (HCF_TALLIES) & HCF_TALLIES_HCF //HCF tally support + CFG_HCF_TALLIES_STRCT IFB_HCF_Tallies; +#endif // HCF_TALLIES_HCF +#if HCF_DMA + //used for a pool of destination_address descriptor/buffers, used during tx encapsulation points to the + //first/last descriptor in the descriptor chain, so we can easily remove and append a packet. + DESC_STRCT *IFB_FirstDesc[2]; + DESC_STRCT *IFB_LastDesc[2]; + DESC_STRCT *IFB_ConfinedDesc[2]; // pointers to descriptor used for host reclaim purposes. + hcf_16 IFB_DmaPackets; // HREG_EV_[TX/RX]DMA_DONE flags, reports DMA Frame availability to MSF +#endif // HCF_DMA +#if (HCF_EXT) & HCF_EXT_INT_TX_EX + hcf_16 IFB_TxFsStat; // Tx message monitoring + hcf_16 IFB_TxFsGap[2]; //;?make this robust + hcf_16 IFB_TxFsSwSup; +#endif // HCF_EXT_INT_TX_EX + hcf_16 IFB_Magic; /* "Magic" signature, to help the debugger interpret a memory dump + * also the last field cleared at hcf_connect + */ +#if (HCF_EXT) & HCF_EXT_IFB_STRCT // for usage by the MSF + void FAR *IFB_MSFSup; // pointer for arbitrary use by the MSF +#endif // HCF_EXT_IFB_STRCT_EXT +} IFB_STRCT; + +typedef IFB_STRCT* IFBP; + + +/***********************************************************************************************************/ +/********************** W C I F U N C T I O N S P R O T O T Y P E S ******************************/ +/***********************************************************************************************************/ + +EXTERN_C int hcf_action (IFBP ifbp, hcf_16 cmd ); +EXTERN_C int hcf_connect (IFBP ifbp, hcf_io io_base ); +#if (HCF_ENCAP) & HCF_ENC_SUP +EXTERN_C hcf_8 hcf_encap (wci_bufp type ); +#endif // HCF_ENC_SUP +EXTERN_C int hcf_get_info (IFBP ifbp, LTVP ltvp ); +EXTERN_C int hcf_service_nic (IFBP ifbp, wci_bufp bufp, unsigned int len ); +EXTERN_C int hcf_cntl (IFBP ifbp, hcf_16 cmd ); +EXTERN_C int hcf_put_info (IFBP ifbp, LTVP ltvp ); +EXTERN_C int hcf_rcv_msg (IFBP ifbp, DESC_STRCT *descp, unsigned int offset ); +EXTERN_C int hcf_send_msg (IFBP ifbp, DESC_STRCT *dp, hcf_16 tx_cntl ); +#if HCF_DMA +EXTERN_C void hcf_dma_tx_put (IFBP ifbp, DESC_STRCT *d, hcf_16 tx_cntl ); +EXTERN_C DESC_STRCT* hcf_dma_tx_get (IFBP ifbp ); +EXTERN_C DESC_STRCT* hcf_dma_rx_get (IFBP ifbp ); +EXTERN_C void hcf_dma_rx_put (IFBP ifbp, DESC_STRCT *d ); +#endif // HCF_DMA +#if (HCF_ASSERT) & HCF_ASSERT_LNK_MSF_RTN +EXTERN_C void msf_assert (unsigned int line_number, hcf_16 trace, hcf_32 qual ); +#endif // HCF_ASSERT_LNK_MSF_RTN + +#endif // HCF_H + diff --git a/drivers/staging/wlags49_h2/hcfcfg.h b/drivers/staging/wlags49_h2/hcfcfg.h new file mode 100644 index 000000000000..83475b1060a1 --- /dev/null +++ b/drivers/staging/wlags49_h2/hcfcfg.h @@ -0,0 +1,2344 @@ + +// vim:tw=110:ts=4: +#ifndef HCFCFG_H +#define HCFCFG_H 1 + +/************************************************************************************************************* +* +* FILE : hcfcfg.tpl // hcfcfg.h +* +* DATE : $Date: 2004/08/05 11:47:10 $ $Revision: 1.6 $ +* Original: 2004/04/08 15:18:16 Revision: 1.40 Tag: t20040408_01 +* Original: 2004/04/01 15:32:55 Revision: 1.38 Tag: t7_20040401_01 +* Original: 2004/03/10 15:39:28 Revision: 1.34 Tag: t20040310_01 +* Original: 2004/03/03 14:10:12 Revision: 1.32 Tag: t20040304_01 +* Original: 2004/03/02 09:27:12 Revision: 1.30 Tag: t20040302_03 +* Original: 2004/02/24 13:00:28 Revision: 1.25 Tag: t20040224_01 +* Original: 2004/02/18 17:13:57 Revision: 1.23 Tag: t20040219_01 +* +* AUTHOR : Nico Valster +* +* DESC : HCF Customization Macros +* hcfcfg.tpl list all #defines which must be specified to: +* adjust the HCF functions defined in HCF.C to the characteristics of a specific environment +* o maximum sizes for messages +* o Endianess +* Compiler specific macros +* o port I/O macros +* o type definitions +* +* By copying HCFCFG.TPL to HCFCFG.H and -if needed- modifying the #defines the WCI functionality can be +* tailored +* +* Supported environments: +* WVLAN_41 Miniport NDIS 3.1 +* WVLAN_42 Packet Microsoft Visual C 1.5 +* WVLAN_43 16 bits DOS ODI Microsoft Visual C 1.5 +* WVLAN_44 32 bits ODI (__NETWARE_386__) WATCOM +* WVLAN_45 MAC_OS MPW?, Symantec? +* WVLAN_46 Windows CE (_WIN32_WCE) Microsoft ? +* WVLAN_47 LINUX (__LINUX__) GCC, discarded, based on GPL'ed HCF-light +* WVLAN_48 Miniport NDIS 5 +* WVLAN_49 LINUX (__LINUX__) GCC, originally based on pre-compiled HCF_library +* migrated to use the HCF sources when Lucent Technologies +* brought the HCF module under GPL +* WVLAN_51 Miniport USB NDIS 5 +* WVLAN_52 Miniport NDIS 4 +* WVLAN_53 VxWorks END Station driver +* WVLAN_54 VxWorks END Access Point driver +* WVLAN_81 WavePoint BORLAND C +* WCITST Inhouse test tool Microsoft Visual C 1.5 +* WSU WaveLAN Station Update Microsoft Visual C ?? +* SCO UNIX not yet actually used ? ? +* __ppc OEM supplied ? +* _AM29K OEM supplied ? +* ? OEM supplied Microtec Research 80X86 Compiler +* +************************************************************************************************************** +* +* +* SOFTWARE LICENSE +* +* This software is provided subject to the following terms and conditions, +* which you should read carefully before using the software. Using this +* software indicates your acceptance of these terms and conditions. If you do +* not agree with these terms and conditions, do not use the software. +* +* COPYRIGHT © 1994 - 1995 by AT&T. All Rights Reserved +* COPYRIGHT © 1996 - 2000 by Lucent Technologies. All Rights Reserved +* COPYRIGHT © 2001 - 2004 by Agere Systems Inc. All Rights Reserved +* All rights reserved. +* +* Redistribution and use in source or binary forms, with or without +* modifications, are permitted provided that the following conditions are met: +* +* . Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following Disclaimer as comments in the code as +* well as in the documentation and/or other materials provided with the +* distribution. +* +* . Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following Disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* . Neither the name of Agere Systems Inc. nor the names of the contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* Disclaimer +* +* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY +* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN +* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +* DAMAGE. +* +* +*************************************************************************************************************/ + +/* Alignment +* Some platforms can access words on odd boundaries (with possibly an performance impact), at other +* platforms such an access may result in a memory access violation. +* It is assumed that everywhere where the HCF casts a char pointer into a word pointer, the alignment +* criteria are met. This put some restrictions on the MSF, which are assumed to be "automatically" fulfilled +* at the applicable platforms +* To assert this assumption, the macro HCF_ALIGN can be defined. The default value is 1, meaning byte +* alignment (or no alignment), a value of 2 means word alignment, a value of 4 means double word alignment +*/ + +/***************************** IN_PORT_STRING_8_16 S a m p l e s ***************************************** + + // C implementation which let the processor handle the word-at-byte-boundary problem +#define IN_PORT_STRING_8_16( port, addr, n) while ( n-- ) \ + { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); ((hcf_8 FAR*)addr)+=2; } + + // C implementation which handles the word-at-byte-boundary problem +#define IN_PORT_STRING_8_16( port, addr, n) while ( n-- ) \ + { hcf_16 i = IN_PORT_WORD(port); *((hcf_8 FAR*)addr)++ = (hcf_8)i; *((hcf_8 FAR*)addr)++ = (hcf_8)(i>>8);} + + // Assembler implementation +#define IN_PORT_STRING_8_16( port, addr, len) __asm \ +{ \ + __asm push di \ + __asm push es \ + __asm mov cx,len \ + __asm les di,addr \ + __asm mov dx,port \ + __asm rep insw \ + __asm pop es \ + __asm pop di \ +} + + +***************************** OUT_PORT_STRING_8_16 S a m p l e s ****************************************** + + // C implementation which let the processor handle the word-at-byte-boundary problem +#define OUT_PORT_STRING_8_16( port, addr, n) while ( n-- ) \ + { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; ((hcf_8 FAR*)addr)+=2; } + + // C implementation which handles the word-at-byte-boundary problem +#define OUT_PORT_STRING_8_16( port, addr, n) while ( n-- ) \ + { OUT_PORT_WORD( port, *((hcf_8 FAR*)addr) | *(((hcf_8 FAR*)addr)+1)<<8 ); (hcf_8 FAR*)addr+=2; } + + // Assembler implementation +#define OUT_PORT_STRING_8_16( port, addr, len) __asm \ +{ \ + __asm push si \ + __asm push ds \ + __asm mov cx,len \ + __asm lds si,addr \ + __asm mov dx,port \ + __asm rep outsw \ + __asm pop ds \ + __asm pop si \ +} + +*************************************************************************************************************/ + + +/************************************************************************************************/ +/****************** C O M P I L E R S P E C I F I C M A C R O S ***************************/ +/************************************************************************************************/ +/************************************************************************************************* +* +* !!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!! +* !!!! Do not call these macros with parameters which introduce side effects !!!! +* !!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!! +* +* +* By selecting the appropriate Macro definitions by means of modifying the "#ifdef 0/1" lines, the HCF can be +* adjusted for the I/O characteristics of a specific compiler +* +* If needed the macros can be modified or replaced with definitions appropriate for your personal platform. +* If you need to make such changes it is appreciated if you inform Agere Systems +* That way the changes can become part of the next release of the WCI +* +* For convenience of the MSF-programmer, all macros are allowed to modify their parameters (although some +* might argue that this would constitute bad coding practice). This has its implications on the HCF, e.g. as a +* consequence these macros should not be called with parameters which have side effects, e.g auto-increment. +* +* in the Microsoft implementation of inline assembly it is O.K. to corrupt all flags except the direction flag +* and to corrupt all registers except the segment registers and EDI, ESI, ESP and EBP (or their 16 bits +* equivalents). Other environments may have other constraints +* +* in the Intel environment it is O.K to have a word (as a 16 bits quantity) at a byte boundary, hence +* IN_/OUT_PORT_STRING_8_16 can move words between PC-memory and NIC-memory with as only constraint that the +* words are on a word boundary in NIC-memory. This does not hold true for all conceivable environments, e.g. +* an Motorola 68xxx does not allow this. Probably/hopefully the boundary conditions imposed by these type of +* platforms prevent this case from materializing. If this is not the case, OUT_PORT_STRING_8_16 must be coded +* by combining two Host memory hcf_8 values at a time to a single hcf_16 value to be passed to the NIC and +* IN_PORT_STRING_8_16 the single hcf_16 retrieved from the NIC must be split in two hcf_8 values to be stored +* in Host memory (see the sample code above) +* +* The prototypes and functional description of the macros are: +* +* hcf_16 IN_PORT_WORD( hcf_16 port ) +* Reads a word (16 bits) from the specified port +* +* void OUT_PORT_WORD( hcf_16 port, hcf_16 value) +* Writes a word (16 bits) to the specified port +* +* hcf_16 IN_PORT_DWORD( hcf_16 port ) +* Reads a dword (32 bits) from the specified port +* +* void OUT_PORT_DWORD( hcf_16 port, hcf_32 value) +* Writes a dword (32 bits) to the specified port +* +* void IN_PORT_STRING_8_16( port, addr, len) +* Reads len number of words (16 bits) from NIC memory via the specified port to the (FAR) +* byte-pointer addr in PC-RAM +* Note that len specifies the number of words, NOT the number of bytes +* !!!NOTE, although len specifies the number of words, addr MUST be a char pointer NOTE!!! +* See also the common notes for IN_PORT_STRING_8_16 and OUT_PORT_STRING_8_16 +* +* void OUT_PORT_STRING_8_16( port, addr, len) +* Writes len number of words (16 bits) from the (FAR) byte-pointer addr in PC-RAM via the specified +* port to NIC memory +* Note that len specifies the number of words, NOT the number of bytes. +* !!!NOTE, although len specifies the number of words, addr MUST be a char pointer NOTE!!! +* +* The peculiar combination of word-length and char pointers for IN_PORT_STRING_8_16 as well as +* OUT_PORT_STRING_8_16 is justified by the assumption that it offers a more optimal algorithm +* +* void IN_PORT_STRING_32( port, addr, len) +* Reads len number of double-words (32 bits) from NIC memory via the specified port to the (FAR) +* double-word address addr in PC-RAM +* +* void OUT_PORT_STRING_32( port, addr, len) +* Writes len number of double-words (32 bits) from the (FAR) double-word address addr in PC-RAM via +* the specified port to NIC memory +* +* !!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!! +* !!!! Do not call these macros with parameters which introduce side effects !!!! +* !!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!! +* +*************************************************************************************************/ + +/**************************** define INT Types ******************************/ +typedef unsigned char hcf_8; +typedef unsigned short hcf_16; +typedef unsigned long hcf_32; + +/**************************** define I/O Types ******************************/ +#define HCF_IO_MEM 0x0001 // memory mapped I/O ( 0: Port I/O ) +#define HCF_IO_32BITS 0x0002 // 32Bits support ( 0: only 16 Bits I/O) + +/****************************** #define HCF_TYPE ********************************/ +#define HCF_TYPE_NONE 0x0000 // No type +#define HCF_TYPE_WPA 0x0001 // WPA support +#define HCF_TYPE_USB 0x0002 // reserved (USB Dongle driver support) +//#define HCF_TYPE_HII 0x0004 // Hermes-II, to discriminate H-I and H-II CFG_HCF_OPT_STRCT +#define HCF_TYPE_WARP 0x0008 // WARP F/W +#define HCF_TYPE_PRELOADED 0x0040 // pre-loaded F/W +#define HCF_TYPE_HII5 0x0080 // Hermes-2.5 H/W +#define HCF_TYPE_CCX 0x0100 // CKIP +#define HCF_TYPE_BEAGLE_HII5 0x0200 // Beagle Hermes-2.5 H/W +#define HCF_TYPE_TX_DELAY 0x4000 // Delayed transmission ( non-DMA only) + +/****************************** #define HCF_ASSERT ******************************/ +#define HCF_ASSERT_NONE 0x0000 // No assert support +#define HCF_ASSERT_PRINTF 0x0001 // Hermes generated debug info +#define HCF_ASSERT_SW_SUP 0x0002 // logging via Hermes support register +#define HCF_ASSERT_MB 0x0004 // logging via Mailbox +#define HCF_ASSERT_RT_MSF_RTN 0x4000 // dynamically binding of msf_assert routine +#define HCF_ASSERT_LNK_MSF_RTN 0x8000 // statically binding of msf_assert routine + +/****************************** #define HCF_ENCAP *******************************/ +#define HCF_ENC_NONE 0x0000 // No encapsulation support +#define HCF_ENC 0x0001 // HCF handles En-/Decapsulation +#define HCF_ENC_SUP 0x0002 // HCF supports MSF to handle En-/Decapsulation + +/****************************** #define HCF_EXT *********************************/ +#define HCF_EXT_NONE 0x0000 // No expanded features +#define HCF_EXT_INFO_LOG 0x0001 // logging of Hermes Info frames +//#define HCF_EXT_INT_TX_OK 0x0002 // RESERVED!!! monitoring successful Tx message +#define HCF_EXT_INT_TX_EX 0x0004 // monitoring unsuccessful Tx message +//#define HCF_EXT_MON_MODE 0x0008 // LEGACY +#define HCF_EXT_TALLIES_FW 0x0010 // support for up to 32 Hermes Engineering tallies +#define HCF_EXT_TALLIES_HCF 0x0020 // support for up to 8 HCF Engineering tallies +#define HCF_EXT_NIC_ACCESS 0x0040 // direct access via Aux-ports and to Hermes registers and commands +#define HCF_EXT_MB 0x0080 // MailBox code expanded +#define HCF_EXT_IFB_STRCT 0x0100 // MSF custom pointer in IFB +#define HCF_EXT_DESC_STRCT 0x0200 // MSF custom pointer in Descriptor +#define HCF_EXT_TX_CONT 0x4000 // Continuous transmit test +#define HCF_EXT_INT_TICK 0x8000 // enables TimerTick interrupt generation + +/****************************** #define HCF_SLEEP *******************************/ +#define HCF_DDS 0x0001 // Disconnected Deep Sleep +#define HCF_CDS 0x0002 // Connected Deep Sleep + +/****************************** #define HCF_TALLIES ******************************/ +#define HCF_TALLIES_NONE 0x0000 // No tally support +#define HCF_TALLIES_NIC 0x0001 // Hermes Tallies accumulated in IFB +#define HCF_TALLIES_HCF 0x0002 // HCF Tallies accumulated in IFB +#define HCF_TALLIES_RESET 0x8000 // Tallies in IFB are reset when reported via hcf_get_info + + +/************************************************************************************************/ +/****************************** M I N I P O R T N D I S *************************************/ +/************************************************************************************************/ + +#if defined WVLAN_41 || defined WVLAN_48 || defined WVLAN_52 || defined _WIN32_WCE + +#ifndef WVLAN_46 +#define HCF_EXT (HCF_EXT_INFO_LOG | HCF_EXT_MB | HCF_EXT_NIC_ACCESS ) +#else +#define HCF_EXT ( HCF_EXT_TX_CONT | HCF_EXT_INFO_LOG | HCF_EXT_MB | HCF_EXT_NIC_ACCESS ) +#endif +#define HCF_DLV 1 //H-I legacy, superfluous for H-II + +#ifdef _WIN32_WCE +#define HCF_IO HCF_IO_MEM +#define HCF_DMA 0 // To enable DMA +#endif + +#if _VARIANT == 7 +#define HCF_SLEEP HCF_CDS +#endif // _VARIANT == 7 + +#if _VARIANT == 5 || _VARIANT == 6 +#define _WARP +#define _AES +#define HCF_SLEEP HCF_CDS +#if _VARIANT == 6 +//! #define _RSN +#endif // _VARIANT == 6 +#ifndef _WIN32_WCE +#define HCF_IO HCF_IO_32BITS +#define HCF_DMA 1 // To enable DMA +#endif +#endif // _VARIANT == 5 || _VARIANT == 6 + + +//HWi for migration purposes I defined a define which will be TRUE for ALL drivers +//Meaning that _CCX defined code which we think will get a all driver OK flag can be defined from _CCX to _CCX_OK +#if defined WVLAN_48 // && !defined _WIN32_WCE +#if _VARIANT == 4 || _VARIANT == 6 +#define _CCX_OK 1 +#endif // _VARIANT == 4 || _VARIANT == 6 +#endif // WVLAN_48 + +//#if !defined WVLAN_46 +#if defined WVLAN_48 +#if _VARIANT == 4 || _VARIANT == 6 +#define _CCX +#define HCF_MAX_MSG_CKIP_PADDING 86 //, use 86 for rx fragmentation. 28 is enuf for MIC+PPK encapsulation +#define HCF_MAX_MSG ( 1514 + HCF_MAX_MSG_CKIP_PADDING ) // need extra padding for CKIP (need to subtract 28 for NDIS) +#endif // _VARIANT == 4 || _VARIANT == 6 +#endif // WVLAN_48 +//#endif // WVLAN_46 + +#if !defined WVLAN_46 +#define _PEEK +#endif + +#ifndef _WIN32_WCE +// ASSERT already used by WinCE... +#ifdef ASSERT +#undef ASSERT +#define ASSERT(x) ASSERTDEBUGMSG((x), (TEXT("SIMULATE ASSERT:"))) +#endif +#endif + + +#if defined WVLAN_41 +#define MSF_COMPONENT_ID COMP_ID_MINIPORT_NDIS_31 +#endif // WVLAN_41 +#if defined WVLAN_48 && !defined _WIN32_WCE +#define MSF_COMPONENT_ID COMP_ID_MINIPORT_NDIS_50 +#endif // WVLAN_48 / _WIN32_WCE +#if defined WVLAN_52 && !defined _WIN32_WCE +#define MSF_COMPONENT_ID COMP_ID_MINIPORT_NDIS_40 +#endif // WVLAN_52 / _WIN32_WCE +#if defined WVLAN_46 +#define MSF_COMPONENT_ID COMP_ID_WIN_CE +#endif // _WIN32_WCE + +#define MSF_COMPONENT_VAR _VARIANT + +#define T1__HCF_TYPE (HCF_TYPE_NONE) + +#define T2__HCF_TYPE (T1__HCF_TYPE) + +#ifdef _WARP +#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5 | HCF_TYPE_WARP ) +#else +#if _VARIANT == 7 +#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5) +#else // _VARIANT == 7 +#define T3__HCF_TYPE (T2__HCF_TYPE) +#endif // _VARIANT == 7 +#endif // _WARP + +#ifdef _CCX_OK +#define T4__HCF_TYPE (T3__HCF_TYPE | HCF_TYPE_CCX) +#else +#define T4__HCF_TYPE (T3__HCF_TYPE) +#endif // _CCX_OK + +//not suitable for H-II #define HCF_CFG_STA_1_BOTTOM 16 + +// Default WPA in ON for all drivers except for WARP driver +#ifdef _WARP +#define T5__HCF_TYPE (T4__HCF_TYPE) +#else // _WARP +#define T5__HCF_TYPE (T4__HCF_TYPE | HCF_TYPE_WPA) +#endif // _WARP + +#define HCF_TYPE (T5__HCF_TYPE) + +// This is needed to get aux_ctrl() from the HCF for WlFreezeAndDump() +#if (defined DBG && DBG != 0) +#ifndef STATIC +#define STATIC +#endif +#endif + +#if !defined SOFTRONICS_CODE && !defined _APIDLL && !defined _WIN32_WCE +#include +#endif // SOFTRONICS_CODE / _APIDLL / _WIN32_WCE +#if defined _WIN32_WCE +#include +#include +#endif // _WIN32_WCE +#include "version.h" + +#define MSF_COMPONENT_MAJOR_VER TPI_MAJOR_VERSION +#define MSF_COMPONENT_MINOR_VER TPI_MINOR_VERSION + +#if !defined _APIDLL && !defined _WIN32_WCE + +__inline UCHAR NDIS_IN_BYTE( ULONG port ) +{ + UCHAR value; + NdisRawReadPortUchar(port , &value); + return (value); +} + +__inline ULONG NDIS_IN_LONG( ULONG port ) +{ + ULONG value; + NdisRawReadPortUlong(port , &value); + return (value); +} +__inline USHORT NDIS_IN_WORD( ULONG port ) +{ + USHORT value; + NdisRawReadPortUshort(port , &value); + return (value); +} + +#define IN_PORT_DWORD(port) NDIS_IN_LONG( (ULONG) (port) ) +#define IN_PORT_WORD(port) NDIS_IN_WORD( (ULONG) (port) ) +#define OUT_PORT_DWORD(port, value) NdisRawWritePortUlong((ULONG) (port) , value) +#define OUT_PORT_WORD(port, value) NdisRawWritePortUshort((ULONG) (port) , (USHORT) (value)) + +#define IN_PORT_STRING_8_16(port, addr, len) IN_PORT_STRING_16(port, addr, len) +#define OUT_PORT_STRING_8_16(port, addr, len) OUT_PORT_STRING_16(port, addr, len) + +#define IN_PORT_STRING_32(port, addr, len) { \ + NdisRawReadPortBufferUlong(port, addr, (len)); \ +} + +#define OUT_PORT_STRING_32(port, addr, len) { \ + NdisRawWritePortBufferUlong(port, addr, (len)); \ +} + +#define IN_PORT_STRING_16(port, addr, len) NdisRawReadPortBufferUshort(port, addr, (len)); +#define OUT_PORT_STRING_16(port, addr, len) NdisRawWritePortBufferUshort(port, addr, (len)); + +#endif // _APIDLL / _WIN32_WCE + +#if defined _WIN32_WCE + +#define HCF_ALIGN 2 +#define HCF_MEM_IO 1 // overrule standard Port I/O with Memory mapped I/O +#define HCF_PROT_TIME 49 + +#define IN_PORT_BYTE CE_IN_PORT_BYTE +#define OUT_PORT_BYTE CE_OUT_PORT_BYTE +#define IN_PORT_WORD CE_IN_PORT_WORD +#define OUT_PORT_WORD CE_OUT_PORT_WORD +#define IN_PORT_STRING_16 CE_IN_PORT_STRING +#define OUT_PORT_STRING_16 CE_OUT_PORT_STRING + +extern hcf_8 CE_IN_PORT_BYTE(hcf_32 port); +extern void CE_OUT_PORT_BYTE(hcf_32 port, hcf_8 value); +extern hcf_16 CE_IN_PORT_WORD(hcf_32 port); +extern void CE_OUT_PORT_WORD(hcf_32 port, hcf_16 value); +extern void CE_IN_PORT_STRING(hcf_32 port, void *addr, hcf_16 len); +extern void CE_OUT_PORT_STRING(hcf_32 port, void *addr, hcf_16 len); + + +#endif + +#if defined _DEBUG || (defined DBG && DBG != 0) +#define HCF_ASSERT ( HCF_ASSERT_LNK_MSF_RTN | HCF_ASSERT_RT_MSF_RTN | HCF_ASSERT_PRINTF ) //0xC001 +//#define HCF_ASSERT ( HCF_ASSERT_LNK_MSF_RTN | HCF_ASSERT_RT_MSF_RTN | HCF_ASSERT_PRINTF | HCF_ASSERT_MB ) //just to test +#endif // _DEBUG || DBG + +#if defined DEBUG || defined _DEBUG || (defined DBG && DBG != 0) +#ifdef _WIN32_WCE +#define DBGA2W(DBGSTR) CeConvertAnsiToUnicodeLen((char*)DBGSTR) +#define OUTPUTDEBUGMSG(dprintf_exp) ((void)((! ZONE_DEBUG) ? 0:ce_debug_out dprintf_exp)) +#define ASSERTDEBUGMSG(cond, dprintf_exp) ((void)((cond) ? 0:ce_debug_out dprintf_exp)) + +#define ZONE_ERROR DEBUGZONE(0) +#define ZONE_WARN DEBUGZONE(1) +#define ZONE_FUNCTION DEBUGZONE(2) +#define ZONE_INIT DEBUGZONE(3) +#define ZONE_INTR DEBUGZONE(4) +#define ZONE_RCV DEBUGZONE(5) +#define ZONE_XMIT DEBUGZONE(6) +#define ZONE_ASSERT DEBUGZONE(7) +#define ZONE_DEBUG DEBUGZONE(8) +#define ZONE_OEM DEBUGZONE(9) +#define ZONE_HCF DEBUGZONE(10) +#define ZONE_PORTIO DEBUGZONE(11) +#define ZONE_LOGTOFILE DEBUGZONE(15) + +#else // !(_WIN32_WCE) + +#define OUTPUTDEBUGMSG(dprintf_exp) ((void) (DbgPrint dprintf_exp)) +// the assertdebugmsg macro will print filename, line followed by a caller-defined text, when cond == 0 +#define ASSERTDEBUGMSG(cond, print) ((void)((cond) ? 0: (DbgPrint("%s %s:%d - ", print, __FILE__, __LINE__)))) + +#define ZONE_ERROR 1 +#define ZONE_WARN 1 +#define ZONE_FUNCTION 1 +#define ZONE_INIT 1 +#define ZONE_INTR 1 +#define ZONE_RCV 1 +#define ZONE_XMIT 1 +#define ZONE_ASSERT 1 +#define ZONE_DEBUG 1 +#define ZONE_OEM 1 +#define ZONE_HCF 1 +#define ZONE_PORTIO 1 +#define ZONE_LOGTOFILE 1 + +#endif // _WIN32_WCE +#ifndef DBGA2W +#define DBGA2W +#endif // DBGA2W + +#else // !(defined DEBUG || defined _DEBUG || (defined DBG && DBG != 0) ) +#define OUTPUTDEBUGMSG(dprintf_exp) +#define ASSERTDEBUGMSG(cond, dprintf_exp) +#endif // DEBUG / DBG + +#if !defined HCF_MAX_MSG_CKIP_PADDING +#define HCF_MAX_MSG_CKIP_PADDING 0 +#endif // HCF_MAX_MSG_CKIP_PADDING + +#if !defined HCF_MAX_MSG +#define HCF_MAX_MSG 1514 +#endif // HCF_MAX_MSG + +#define HCF_LEGACY 1 //;?nv je moet wat + +#endif //WVLAN_41 / WVLAN_48 / WVLAN_52 / _WIN32_WCE + + +/************************************************************************************************/ +/**************************** P A C K E T D R I V E R ***************************************/ +/********************************** D O S O D I *********************************************/ +/************************************************************************************************/ + +#if defined WVLAN_42 || defined WVLAN_43 + +#pragma warning ( disable: 4001 ) +#define FAR __far //segmented 16 bits mode +#define BASED __based(__segname("_CODE")) //force all the "const" structures in the CODE segment + +//#define HCF_IO 0 //no DMA, no 32 bits + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +#define HCF_EXT HCF_EXT_MB +#define HCF_PROT_TIME 49 //49*10240 microseconds H/W failure protection timer + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +/******************************** CONFIGURATION MANAGEMENT *****************************************/ +#ifdef WVLAN_42 +#define MSF_COMPONENT_ID COMP_ID_PACKET +#define MSF_COMPONENT_VAR 1 +#define MSF_COMPONENT_MAJOR_VER 6 +#define MSF_COMPONENT_MINOR_VER 12 +#endif // WVLAN_42 + +#ifdef WVLAN_43 +#define MSF_COMPONENT_ID COMP_ID_ODI_16 +#define MSF_COMPONENT_VAR 1 +#define MSF_COMPONENT_MAJOR_VER 6 +#define MSF_COMPONENT_MINOR_VER 10 +#endif // WVLAN_43 + +/************************************** INPUT / OUTPUT **********************************************/ +#ifndef H_2_INC +#include +#include +#if 1 //temorary use functions defined in hcf.c +#ifndef _DEBUG +#pragma intrinsic( _inp, _inpw, _outp, _outpw ) +#endif // _DEBUG + +#define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) )) +#define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value )) + +#if 1 // C implementation which let the processor handle the word-at-byte-boundary problem +#define IN_PORT_STRING_8_16( port, addr, n) while (n--) \ + { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); ((hcf_8 FAR*)addr)+=2; } +#define OUT_PORT_STRING_8_16( port, addr, n) while (n--) \ + { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; ((hcf_8 FAR*)addr)+=2; } +#elif 0 // C implementation which handles the word-at-byte-boundary problem +#define IN_PORT_STRING_8_16( port, addr, n) while ( n-- ) \ + { hcf_16 i = IN_PORT_WORD(port); *((hcf_8 FAR*)addr)++ = (hcf_8)i; *((hcf_8 FAR*)addr)++ = (hcf_8)(i>>8);} +#define OUT_PORT_STRING_8_16( port, addr, n) while ( n-- ) \ + { OUT_PORT_WORD( port, *((hcf_8 FAR*)addr) | *(((hcf_8 FAR*)addr)+1)<<8 ); (hcf_8 FAR*)addr+=2; } +#else // Assembler implementation +#define IN_PORT_STRING_8_16( port, addr, n) __asm \ +{ \ + __asm push di \ + __asm push es \ + __asm mov cx,n \ + __asm les di,addr \ + __asm mov dx,port \ + __asm rep insw \ + __asm pop es \ + __asm pop di \ +} + +#define OUT_PORT_STRING_8_16( port, addr, n) __asm \ +{ \ + __asm push si \ + __asm push ds \ + __asm mov cx,n \ + __asm lds si,addr \ + __asm mov dx,port \ + __asm rep outsw \ + __asm pop ds \ + __asm pop si \ +} + +#endif // Asm or C implementation +#define IN_PORT_STRING_32( port, addr, n) { int n2 = 2*n; IN_PORT_STRING_8_16(port, addr, n2) } +#define OUT_PORT_STRING_32( port, addr, n) { int n2 = 2*n; OUT_PORT_STRING_8_16(port, addr, n2) } +#endif // 0 //temorary use functions defined in hcf.c +#endif // H_2_INC + +#endif // WVLAN_42 / WVLAN_43 + + + +/************************************************************************************************/ +/**************************** D O S H - I / II L O A D E R **********************************/ +/************************************************************************************************/ + +#if defined H0_LDR || defined H1_LDR || defined H2_LDR || defined H5_LDR + +#if defined H0_LDR //implies H-I +#define HCF_DLV 0 //H-I legacy, meaningless under H-II +#define HCF_DLNV 1 //H-I legacy, meaningless under H-II +#endif // H0_LDR + +#if defined H1_LDR //implies H-I +#define HCF_DLV 1 //H-I legacy, meaningless under H-II +#define HCF_DLNV 0 //H-I legacy, meaningless under H-II +#endif // H1_LDR / H2_LDR + +//#if defined H2_LDR : not needed, H-II defaults are O.K for H2_LDR + +#ifdef H5_LDR +#define HCF_TYPE (HCF_TYPE_HII5 | HCF_TYPE_WARP ) +//;? why does only this subset of the H_LDRs need HCF_TYPE to be defined here +#endif + +#define HCF_ASSERT HCF_ASSERT_LNK_MSF_RTN //support dynamic linking of msf_assert routine +#define HCF_ENCAP 0 +#define HCF_INT_ON 0 +#define HCF_TALLIES 0 + +#define MSF_COMPONENT_ID COMP_ID_ODI_16 //;?By lack of any better +#define MSF_COMPONENT_VAR 1 +#define MSF_COMPONENT_MAJOR_VER 0 +#define MSF_COMPONENT_MINOR_VER 0 + +#include +#include +#if defined NDEBUG +#pragma intrinsic( _inp, _inpw, _outp, _outpw ) +#endif // NDEBUG + +#if 0 //use 0 to replace I/O Macros with logging facility +#define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) )) +#define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value )) +#define IN_PORT_STRING_16( port, addr, n) \ + while ( n-- ) { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); (cast)addr += 2; } +#define OUT_PORT_STRING_16( port, addr, n) \ + while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; (cast)addr += 2; } +#endif //use 0 to replace I/O Macros with logging facility + +#endif // H0_LDR / H1_LDR / H2_LDR + + + +/************************************************************************************************/ +/**************************** H C F D E M O P R O G R A M ***********************************/ +/************************************************************************************************/ + +#if defined HCF_DEMO + +#define HCF_DLV 1 //;?should become the default !defaults to 1 anyway for H-II +//#define HCF_DLNV 0 //defaults to 0 anyway for H-II + +#define HCF_ASSERT HCF_ASSERT_LNK_MSF_RTN //support dynamic linking of msf_assert routine + +#define HCF_ENCAP 0 +#define HCF_INT_ON 0 +#define HCF_TALLIES ( HCF_TALLIES_NIC | HCF_TALLIES_HCF ) + +//#define MSF_COMPONENT_ID NO configuration management + +#include +#include +#if defined NDEBUG +#pragma intrinsic( _inp, _inpw, _outp, _outpw ) +#endif // NDEBUG + +#if 0 //use 0 to replace I/O Macros with logging facility +#define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) )) +#define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value )) +#define IN_PORT_STRING_16( port, addr, n) \ + while ( n-- ) { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); (cast)addr += 2; } +#define OUT_PORT_STRING_16( port, addr, n) \ + while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; (cast)addr += 2; } +#endif //use 0 to replace I/O Macros with logging facility + +#endif // HCF_DEMO + + + +/************************************************************************************************/ +/*********************************** M A C O S **********************************************/ +/************************************************************************************************/ + +#if defined WVLAN_45 + +#include "Version.h" + +#define MSF_COMPONENT_ID COMP_ID_MAC_OS +#define MSF_COMPONENT_VAR VARIANT +#define MSF_COMPONENT_MAJOR_VER VERSION_MAJOR +#define MSF_COMPONENT_MINOR_VER VERSION_MINOR + +#define MAC_OS 1 + +#define HCF_BIG_ENDIAN 1 // selects Big Endian (a.k.a. Motorola), most significant byte first + +#if defined DEBUG +#define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox +#endif // DEBUG + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus +extern volatile unsigned char *MacIOaddr; +extern hcf_16 IN_PORT_WORD(hcf_16 port); +extern void OUT_PORT_WORD(hcf_16 port, hcf_16 value); +extern void IN_PORT_STRING_16(hcf_16 port, void *addr, hcf_16 len); +extern void OUT_PORT_STRING_16(hcf_16 port, void *addr, hcf_16 len); + +#define SwapBytes(t) (((t) >> 8) + (((t) & 0xff) << 8)) + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // WVLAN_45 + + + +/************************************************************************************************/ +/****************************************** L I N U X *****************************************/ +/************************************************************************************************/ + +#ifdef WVLAN_49 +#include +//#include +#include + +/* The following macro ensures that no symbols are exported, minimizing the chance of a symbol + collision in the kernel */ +//EXPORT_NO_SYMBOLS; //;?this place seems not appropriately to me + +//#define HCF_SLEEP (HCF_CDS | HCF_DDS ) +#define HCF_SLEEP (HCF_CDS) + +//#define HCF_TYPE (HCF_TYPE_HII5|HCF_TYPE_STA|HCF_TYPE_AP) +#ifdef HERMES25 +#ifdef WARP +#define HCF_TYPE ( HCF_TYPE_WARP | HCF_TYPE_HII5 ) +#else +#define HCF_TYPE HCF_TYPE_HII5 +#endif // WARP +#else +#define HCF_TYPE HCF_TYPE_NONE +#endif // HERMES25 + +#ifdef ENABLE_DMA +#define HCF_DMA 1 +#endif // ENABLE_DMA + +/* We now need a switch to include support for the Mailbox and other necessary extensions */ +#define HCF_EXT ( HCF_EXT_MB | HCF_EXT_INFO_LOG | HCF_EXT_INT_TICK )//get deepsleep exercise going + +/* ;? The Linux MSF still uses these definitions; define it here until it's removed */ +#ifndef HCF_TYPE_HII +#define HCF_TYPE_HII 0x0004 +#endif + +#ifndef HCF_TYPE_AP +#define HCF_TYPE_AP 0x0010 +#endif + +#ifndef HCF_TYPE_STA +#define HCF_TYPE_STA 0x0020 +#endif // HCF_TYPE_STA + +/* Guarantees word alignment */ +#define HCF_ALIGN 2 + +/* Endian macros CNV_INT_TO_LITTLE() and CNV_LITTLE_TO_INT() were renamed to + CNV_SHORT_TO_LITTLE() and CNV_LITTLE_TO_SHORT() */ +#ifndef CNV_INT_TO_LITTLE +#define CNV_INT_TO_LITTLE CNV_SHORT_TO_LITTLE +#endif + +#ifndef CNV_LITTLE_TO_INT +#define CNV_LITTLE_TO_INT CNV_LITTLE_TO_SHORT +#endif + +#define HCF_ERR_BUSY 0x06 + +/* UIL defines were removed from the HCF */ +#define UIL_SUCCESS HCF_SUCCESS +#define UIL_ERR_TIME_OUT HCF_ERR_TIME_OUT +#define UIL_ERR_NO_NIC HCF_ERR_NO_NIC +#define UIL_ERR_LEN HCF_ERR_LEN +#define UIL_ERR_MIN HCF_ERR_MAX /*end of HCF errors which are passed through to UIL + *** ** *** ****** ***** *** ****** ******* ** *** */ +#define UIL_ERR_IN_USE 0x44 +#define UIL_ERR_WRONG_IFB 0x46 +#define UIL_ERR_MAX 0x7F /*upper boundary of UIL errors without HCF-pendant + ***** ******** ** *** ****** ******* *** ******* */ +#define UIL_ERR_BUSY HCF_ERR_BUSY +#define UIL_ERR_DIAG_1 HCF_ERR_DIAG_1 +#define UIL_FAILURE 0xFF /* 20010705 nv this relick should be eridicated */ +#define UIL_ERR_PIF_CONFLICT 0x40 //obsolete +#define UIL_ERR_INCOMP_DRV 0x41 //obsolete +#define UIL_ERR_DOS_CALL 0x43 //obsolete +#define UIL_ERR_NO_DRV 0x42 //obsolete +#define UIL_ERR_NSTL 0x45 //obsolete + + + +#if 0 //;? #ifdef get this going LATER HERMES25 +#define HCF_IO HCF_IO_32BITS +#define HCF_DMA 1 +#define HCF_DESC_STRCT_EXT 4 + +/* Switch for BusMaster DMA support. Note that the above define includes the DMA-specific HCF + code in the build. This define sets the MSF to use DMA; if ENABLE_DMA is not defined, then + port I/O will be used in the build */ +#ifndef BUS_PCMCIA +#define ENABLE_DMA +#endif // USE_PCMCIA + +#endif // HERMES25 + + +/* Overrule standard WaveLAN Packet Size when in DMA mode */ +#ifdef ENABLE_DMA +#define HCF_MAX_PACKET_SIZE 2304 +#else +#define HCF_MAX_PACKET_SIZE 1514 +#endif // ENABLE_DMA + +/* The following sets the component ID, as well as the versioning. See also wl_version.h */ +#define MSF_COMPONENT_ID COMP_ID_LINUX + +#define MSF_COMPONENT_VAR DRV_VARIANT +#define MSF_COMPONENT_MAJOR_VER DRV_MAJOR_VERSION +#define MSF_COMPONENT_MINOR_VER DRV_MINOR_VERSION + +/* Define the following to turn on assertions in the HCF */ +//#define HCF_ASSERT 0x8000 +#define HCF_ASSERT HCF_ASSERT_LNK_MSF_RTN // statically binding of msf_assert routine + +#ifdef USE_BIG_ENDIAN +#define HCF_BIG_ENDIAN 1 +#else +#define HCF_BIG_ENDIAN 0 +#endif /* USE_BIG_ENDIAN */ + +/* Define the following if your system uses memory-mapped IO */ +//#define HCF_MEM_IO + +/* The following defines the standard macros required by the HCF to move data to/from the card */ +#define IN_PORT_BYTE(port) ((hcf_8)inb( (hcf_io)(port) )) +#define IN_PORT_WORD(port) ((hcf_16)inw( (hcf_io)(port) )) +#define OUT_PORT_BYTE(port, value) (outb( (hcf_8) (value), (hcf_io)(port) )) +#define OUT_PORT_WORD(port, value) (outw((hcf_16) (value), (hcf_io)(port) )) + +#define IN_PORT_STRING_16(port, dst, n) insw((hcf_io)(port), dst, n) +#define OUT_PORT_STRING_16(port, src, n) outsw((hcf_io)(port), src, n) +//#define IN_PORT_STRINGL(port, dst, n) insl((port), (dst), (n)) +//#define OUT_PORT_STRINGL(port, src, n) outsl((port), (src), (n)) +#define IN_PORT_STRING_32(port, dst, n) insl((port), (dst), (n)) +#define OUT_PORT_STRING_32(port, src, n) outsl((port), (src), (n)) +#define IN_PORT_HCF32(port) inl( (hcf_io)(port) ) +#define OUT_PORT_HCF32(port, value) outl((hcf_32)(value), (hcf_io)(port) ) + +#define IN_PORT_DWORD(port) IN_PORT_HCF32(port) +#define OUT_PORT_DWORD(port, value) OUT_PORT_HCF32(port, value) + +#define IN_PORT_STRING_8_16(port, addr, len) IN_PORT_STRING_16(port, addr, len) +#define OUT_PORT_STRING_8_16(port, addr, len) OUT_PORT_STRING_16(port, addr, len) + + +#ifndef OUTPUTDEBUGMSG +#define OUTPUTDEBUGMSG(dprintf_exp) +#endif + + +#ifndef ASSERTDEBUGMSG +#define ASSERTDEBUGMSG(cond, dprintf_exp) +#endif + +#ifndef CFG_SCAN_CHANNELS_2GHZ +#define CFG_SCAN_CHANNELS_2GHZ 0xFCC2 +#endif /* CFG_SCAN_CHANNELS_2GHZ */ + +#define HCF_MAX_MSG 1600 //get going ;? +#endif // WVLAN_49 + + + +/************************************************************************************************/ +/********************************************* Q N X ******************************************/ +/************************************************************************************************/ + +#if defined __QNX__ || defined WVLAN_50 + +#define MSF_COMPONENT_ID 0 //Although there is no DUI support, we need this to get ... +#define MSF_COMPONENT_VAR 0 //...compatibilty check to function +#define MSF_COMPONENT_MAJOR_VER 0 //...;?this is worth looking into to make this a more +#define MSF_COMPONENT_MINOR_VER 0 //..."defined" I/F so OEMers can figure out what to do + +#include + +#define IN_PORT_WORD(port) ((hcf_16)inpw( (hcf_io)(port) )) +#define OUT_PORT_WORD(port, value) (outpw( (hcf_io)(port), (hcf_16) (value) )) +/* +#define IN_PORT_STRING_16( port, addr, n) \ + while ( n-- ) { *(hcf_16*)addr = IN_PORT_WORD( port ); (cast)addr += 2; } +#define OUT_PORT_STRING_16( port, addr, n) \ + while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16*)addr ) ; (cast)addr += 2; } +*/ + +#endif // QNX / WVLAN_50 + + + +/************************************************************************************************/ +/********************************************* B E O S ****************************************/ +/************************************************************************************************/ + +#if defined __BEOS__ + +#define MSF_COMPONENT_ID 0 //Although there is no DUI support, we need this to get ... +#define MSF_COMPONENT_VAR 0 //...compatibilty check to function +#define MSF_COMPONENT_MAJOR_VER 0 //...;?this is worth looking into to make this a more +#define MSF_COMPONENT_MINOR_VER 0 //..."defined" I/F so OEMers can figure out what to do + +#include +#include + +uint8 read_io_8 (int); +void write_io_8 (int, uint8); +uint16 read_io_16 (int); +void write_io_16 (int, uint16); + +#define IN_PORT_WORD(port) ((hcf_16)read_io_16( (hcf_io)(port) )) +#define OUT_PORT_WORD(port, value) (write_io_16( (hcf_io)(port), (hcf_16) (value) )) +/* +#define IN_PORT_STRING_16( port, addr, n) \ + while ( n-- ) { *(hcf_16*)addr = IN_PORT_WORD( port ); (cast)addr += 2; } +#define OUT_PORT_STRING_16( port, addr, n) \ + while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16*)addr ) ; (cast)addr += 2; } +*/ +#endif // __BEOS__ + + + +/************************************************************************************************/ +/******************************** U S B D O N G L E *****************************************/ +/************************************************************************************************/ + +#if defined USB +#include "gpif.h" + +#define MSF_COMPONENT_MAJOR_VER 0 +#define MSF_COMPONENT_MINOR_VER 1 + +#define IN_PORT_WORD(port) (Hermes_IO_Read( (hcf_8)(port))) +#define OUT_PORT_WORD(port, value) (Hermes_IO_Write( (hcf_8)port, /*(hcf_16)*/(value) ) ) +/* !!!! NOTE USB supports only 16-bits I/O and no 8-bits I/O + * as a consequence the IN_/OUT_PORT_STRING_16 macros use hcf_16* rather than hcf_8 pointers + * to get more optimal code + * therefore the pointers are incremented by 1 (which means two "bytes") rather than by 2 + */ +//#define IN_PORT_STRING_16( port, addr, n) while ( n-- ) { *((hcf_16*)addr)++ = IN_PORT_WORD( port ); } +//#define OUT_PORT_STRING_16( port, addr, n) while ( n-- ) { OUT_PORT_WORD( port, *((hcf_16*)addr)++ ); } +#define IN_PORT_STRING_16( port, dst, n) while ( n-- ) { *dst++ = IN_PORT_WORD( port ); } +#define OUT_PORT_STRING_16( port, src, n) while ( n-- ) { OUT_PORT_WORD( port, *src++ ); } + +//#define HCF_TYPE ( HCF_TYPE_AP | HCF_TYPE_WPA ) +#define HCF_TYPE HCF_TYPE_WPA + +#endif // USB + + +/************************************************************************************************/ +/****************************************** FreeBSD *******************************************/ +/************************************************************************************************/ + +#if defined __FREE_BSD__ + +#define MSF_COMPONENT_ID COMP_ID_FreeBSD +#define MSF_COMPONENT_VAR 1 +#define MSF_COMPONENT_MAJOR_VER 1 +#define MSF_COMPONENT_MINOR_VER 0 + +#define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O + +#include + +#define IN_PORT_WORD(port) ((hcf_16)inw( (hcf_io)(port) )) +#define OUT_PORT_WORD(port, value) (outw((hcf_io)(port), (hcf_16)(value))) + +/* +#define IN_PORT_STRING_16( port, addr, n) \ + while ( n-- ) { *(hcf_16*)addr = IN_PORT_WORD( port ); (cast)addr += 2; } +#define OUT_PORT_STRING_16( port, addr, n) \ + while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16*)addr ) ; (cast)addr += 2; } +*/ +#endif // __FREE_BSD__ + + + +/************************************************************************************************/ +/********************************* W A V E P O I N T ******************************************/ +/************************************************************************************************/ + +#if defined WVLAN_81 /* BORLANDC */ + +#define EXTERN_C extern // needed because DHF uses this instead of 'extern' + +#define MSF_COMPONENT_ID COMP_ID_AP1 +#define MSF_COMPONENT_VAR 1 +#define MSF_COMPONENT_MAJOR_VER 4 +#define MSF_COMPONENT_MINOR_VER 0 + +#define HCF_PROT_TIME 49 //49*10240 microseconds H/W failure protection timer + +//#define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox /* debug build only */ + +#if !defined FAR +#define FAR far // segmented 16 bits mode +#endif // FAR + +#define IN_PORT_WORD(port) (inport( (hcf_io)(port) )) +#define OUT_PORT_WORD(port, value) (outport( (hcf_io)(port), value )) + +#define IN_PORT_STRING_16(port, addr, len) \ + asm { push di; push es; mov cx,len; les di,addr; mov dx,port; rep insw; pop es; pop di } + +#define OUT_PORT_STRING_16(port, addr, len) \ + asm { push si; push ds; mov cx,len; lds si,addr; mov dx,port; rep outsw; pop ds; pop si } + +#endif // WVLAN_81 + + +/************************************************************************************************/ +/******************************** W A V E L A U N C H *****************************************/ +/************************************************************************************************/ + +#if defined WVLAUNCH + +#include "DriverX.h" +extern HWDEVICE* g_pDevice; + +//#define MSF_COMPONENT_ID 0 //;? to get around browser problem + +#define IN_PORT_WORD(port) HwInpw( g_pDevice, port ) +#define OUT_PORT_WORD(port, value) HwOutpw( g_pDevice, port, value ) + + +// C implementation which let the processor handle the word-at-byte-boundary problem +/* +#define IN_PORT_STRING_16( port, addr, n) \ + while ( n-- ) { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); (cast)addr += 2; } +#define OUT_PORT_STRING_16( port, addr, n) \ + while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; (cast)addr += 2; } +*/ +#endif // WVLAUNCH + + + +/************************************************************************************************/ +/************************************* W C I T S T *********************************************/ +/************************************************************************************************/ + +#if defined WCITST +#define MSF_COMPONENT_ID 0 //Although there is no DUI support, we need this to get ... +#define MSF_COMPONENT_VAR 0 //...compatibilty check to function +#define MSF_COMPONENT_MAJOR_VER 0 //...;?this is worth looking into to make this a more +#define MSF_COMPONENT_MINOR_VER 0 //..."defined" I/F so OEMers can figure out what to do + +//#define HCF_ENCAP HCF_ENC_NONE //to get going +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define HCF_TYPE (HCF_TYPE_WPA | HCF_TYPE_PRELOADED) // Hermes-I for HCF6, II for HCF7 +#define HCF_DMA 1 +//#define LLB //!!!!MIC Debug Only +#if defined LLB && !((HCF_TYPE) & HCF_TYPE_WPA) +err: no LLB unless SSN; +#endif // LLB / HCF_TYPE_WPA +//#define HCF_ALIGN 2 +#define HCF_DLV 1 //just to change memory layout ????;? +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +#define HCF_ASSERT HCF_ASSERT_SW_SUP // logging via Hermes support registerr +//#define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox + +#if defined __GNUC__ +#include "stdio.h" +//#include "unistd.h" //ioperm libc5 +#include "sys/io.h" //ioperm glibc +#define extern //see IO Port Programming mini-HOWTO +//#include "asm/io.h" // +#define IN_PORT_WORD(port) inw( (hcf_io)(port) ) +#define IN_PORT_DWORD(port) inl( (hcf_io)(port) ) +#define OUT_PORT_WORD(port, value) outw( (hcf_io)(port), (hcf_16)(value) ) +#define OUT_PORT_DWORD(port, value) outl( (hcf_io)(port), (hcf_16)(value) ) +#else +#pragma warning ( disable: 4001 ) +#define FAR __far // segmented 16 bits mode + +#include +#include +#ifndef _DEBUG +#pragma intrinsic( _inp, _inpw, _outp, _outpw ) +#endif // _DEBUG + +#ifdef LOG +extern FILE* utm_logfile; +hcf_16 ipw( hcf_16 port ); +hcf_8 ipb( hcf_16 port ); +void opw( hcf_16 port, hcf_16 value ); +void opb( hcf_16 port, hcf_8 value ); + +#define IN_PORT_WORD(port) ipw( (hcf_io)(port) ) +#define OUT_PORT_WORD(port, value) opw( (hcf_io)(port), (hcf_16)(value) ) +#else // LOG +#define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) )) +#define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value )) +#endif // LOG + +#if 1 //ASM example +#define IN_PORT_STRING_16( port, addr, len) __asm \ +{ \ + __asm push di \ + __asm push es \ + __asm mov cx,len \ + __asm les di,addr \ + __asm mov dx,port \ + __asm rep insw \ + __asm pop es \ + __asm pop di \ +} + +#define OUT_PORT_STRING_16( port, addr, len) __asm \ +{ \ + __asm push si \ + __asm push ds \ + __asm mov cx,len \ + __asm lds si,addr \ + __asm mov dx,port \ + __asm rep outsw \ + __asm pop ds \ + __asm pop si \ +} + +#endif // asm example + +#endif // __GCC__ + +#if ! defined IN_PORT_STRING_16 +#define IN_PORT_STRING_16( port, addr, n) while (n--) \ + { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); ((hcf_16 FAR*)addr)++; } +#define OUT_PORT_STRING_16( port, addr, n) while (n--) \ + { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ); ((hcf_16 FAR*)addr)++; } +#endif // IN_PORT_STRING_16 + +#endif // WCITST + + +/************************************************************************************************/ +/******************************* Motorola Power PC 800 family *********************************/ +/************************************************************************************************/ +/* known users: LH@I + */ + +#if defined I_MPC8XX + +#define MSF_COMPONENT_VAR 0 +#define MSF_COMPONENT_ID 0 +#define MSF_COMPONENT_MAJOR_VER 1 +#define MSF_COMPONENT_MINOR_VER 0 + +#define HCF_HSI_VAR 1 + +#define HCF_BIG_ENDIAN 1 +#define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O + +#include "o_portbl.h" +#include "ipcmcia.h" +typedef o_uint8_t hcf_8; +typedef o_uint16_t hcf_16; +typedef o_uint32_t hcf_32; + +/***************************************************************************/ + + +#ifdef _lint +#else +asm hcf_16 IN_PORT_WORD(int port) +{ +% reg port + lhbrx r3,r0,port + eieio +} +#endif // _lint + + +#ifdef _lint +#else +asm void OUT_PORT_WORD(int port, hcf_16 value) +{ +% reg port, value + sthbrx value,r0,port + eieio +} +#endif // _lint + +/***************************************************************************/ + +#define IN_PORT_STRING_16(port, addr, len) \ + { \ + unsigned l = (len); \ + hcf_16 *d = (volatile hcf_16 *)(addr); \ + while (l--) \ + { \ + *d++ = *(volatile hcf_16 *)(port); \ + EIEIO(); \ + } \ + } + +#define OUT_PORT_STRING_16(port, addr, len) \ + { \ + unsigned l = (len); \ + hcf_16 *s = (volatile hcf_16 *)(addr); \ + while (l--) \ + { \ + *(volatile hcf_16 *)(port) = *s++; \ + EIEIO(); \ + } \ + } + +#endif // I_MPC8XX + + + +/************************************************************************************************/ +/********************************** Diab or High C 29K **************************************/ +/************************************************************************************************/ +/* known users: GK@C + */ + +#if defined _AM29K + +#define MSF_COMPONENT_VAR 0 +#define MSF_COMPONENT_ID COMP_ID_AP1 +#define MSF_COMPONENT_MAJOR_VER 1 +#define MSF_COMPONENT_MINOR_VER 0 + +#define HCF_BIG_ENDIAN 1 +#define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O + +#define SwapBytes(t) /*lint -e572*/(((t) >> 8) + (((t) & 0xff) << 8))/*lint +e572*/ + +#if defined __ppc + #ifndef __GNUC__ + #define __asm__ asm + #endif + + #if ! defined _lint + #define EIEIO() __asm__(" eieio") + #else + #define EIEIO() + #endif + + static hcf_16 IN_PORT_WORD(int port) { + hcf_16 value = *(volatile hcf_16 *)(port); EIEIO(); + value = SwapBytes(value); + return value; + } + + #define OUT_PORT_WORD(port, value) \ + { *(volatile hcf_16 *)(port) = SwapBytes(value); EIEIO(); } +#else + #define IN_PORT_WORD(port) (*(volatile hcf_16 *)(port)) + #define OUT_PORT_WORD(port, value) (*(volatile hcf_16 *)(port) = (value)) +#endif // __ppc + +/***************************************************************************/ + +#define IN_PORT_STRING_16( port, addr, len) { \ + unsigned l = (len); \ + hcf_16 t, *d = (volatile hcf_16 *)(addr); \ + while (l--) { \ + t = IN_PORT_WORD(port); \ + *d++ = SwapBytes(t); \ + } \ + } + +#define OUT_PORT_STRING_16( port, addr, len) { \ + unsigned l = (len); \ + hcf_16 t, *s = (volatile hcf_16 *)(addr); \ + while (l--) { \ + t = *s++; \ + OUT_PORT_WORD(port, SwapBytes(t)); \ + } \ + } + +#if PRODUCT == 9150 + #define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox + #undef MSF_COMPONENT_ID +#endif // 9150 + +#endif // _AM29K + + + +/************************************************************************************************/ +/***************************************** MPC860 **********************************************/ +/************************************************************************************************/ +/* known users: RR + */ + +#if defined CPU +#if CPU == PPC860 + +#define MSF_COMPONENT_VAR 0 +#define MSF_COMPONENT_ID 0 +#define MSF_COMPONENT_MAJOR_VER 1 +#define MSF_COMPONENT_MINOR_VER 0 + +#define HCF_BIG_ENDIAN 1 +#define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O + +#define SwapBytes(t) /*lint -e572*/(((t) >> 8) + (((t) & 0xff) << 8))/*lint +e572*/ + +#ifndef __GNUC__ + #define __asm__ asm +#endif + +#if ! defined _lint + #define EIEIO() __asm__(" eieio") +#else + #define EIEIO() +#endif + +static hcf_16 IN_PORT_WORD(int port) { + hcf_16 value = *(volatile hcf_16 *)(port); EIEIO(); + value = SwapBytes(value); + return value; + #ifdef __GNUC__ + /* the following serves to avoid the compiler warnings that + * IN_PORT_WORD() is not used in some files */ + (void)IN_PORT_WORD; + #endif +} + +#define OUT_PORT_WORD(port, value) \ + { *(volatile hcf_16 *)(port) = SwapBytes(value); EIEIO(); } + +/***************************************************************************/ + +#define IN_PORT_STRING_16( port, addr, len) { \ + unsigned l = (len); \ + hcf_16 t; \ + volatile hcf_16 *d = (volatile hcf_16 *)(addr); \ + while (l--) { \ + t = IN_PORT_WORD(port); \ + *d++ = SwapBytes(t); \ + } \ + } + +#define OUT_PORT_STRING_16( port, addr, len) { \ + unsigned l = (len); \ + hcf_16 t; \ + volatile hcf_16 *s = (volatile hcf_16 *)(addr); \ + while (l--) { \ + t = *s++; \ + OUT_PORT_WORD(port, SwapBytes(t)); \ + } \ + } + +#if PRODUCT == 9150 + #define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox + #undef MSF_COMPONENT_ID +#endif + +#endif /* PPC860 */ +#endif /* CPU */ + + + +/************************************************************************************************/ +/**************************** Microtec Research 80X86 Compiler *********************************/ +/************************************************************************************************/ + +#if 0 + +//#undef HCF_TYPE // Hermes-I Station F/W without SSN support + +#define MSF_COMPONENT_VAR 0 +#define MSF_COMPONENT_ID 0 +#define MSF_COMPONENT_MAJOR_VER 1 +#define MSF_COMPONENT_MINOR_VER 0 + +extern int far inp( int ); +extern void far outp( int, int ); +extern int far inpw( int ); +extern void far outpw( int, int ); + +#define IN_PORT_WORD(port) ((hcf_16)inpw( (hcf_io)(port) )) +#define OUT_PORT_WORD(port, value) ((void)outpw( (hcf_io)(port), value )) + +#define IN_PORT_STRING_16( port, addr, len) { \ + unsigned l = (len); \ + hcf_16 *d = (hcf_16 *)(addr); \ + while (l--) *d++ = IN_PORT_WORD(port); \ + } + +#define OUT_PORT_STRING_16( port, addr, len) { \ + unsigned l = (len); \ + hcf_16 *s = (hcf_16 *)(addr); \ + while (l--) OUT_PORT_WORD(port, *s++); \ + } +#endif /* Microtec 80X86 C Compiler */ + + + +/************************************************************************************************/ +/****************************** W A V E L A N E C ********************************************/ +/************************************************************************************************/ +/* known users: KM + */ + +#ifdef mc68302 + +#define MSF_COMPONENT_ID COMP_ID_EC + +#include + +#define MSF_COMPONENT_VAR 1 +#define MSF_COMPONENT_MAJOR_VER MAJOR_VERSION +#define MSF_COMPONENT_MINOR_VER MINOR_VERSION + +#define HCF_BIG_ENDIAN 1 +#define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O + +#define SwapBytes(t) /*lint -e572*/(((t) >> 8) + (((t) & 0xff) << 8))/*lint +e572*/ + +#define PCMCIA_ADDRESS 0xc80000UL + +#define IN_PORT_2BYTES(port) (*(hcf_16 *)(port)) +#if 0 +static hcf_16 IN_PORT_WORD(hcf_32 port) // should be hcf_io, not hcf_32 +{ + hcf_16 word = IN_PORT_2BYTES(port); + return SwapBytes(word); +} +#else +static hcf_16 swap_var; +#define IN_PORT_WORD(port) \ + (((swap_var = IN_PORT_2BYTES(port)) >> 8) + (((swap_var) & 0xff) << 8)) +#endif +#define OUT_PORT_2BYTES(port, value) (*(hcf_16 *)(port) = (hcf_16)(value)) +#define OUT_PORT_WORD(port, value) OUT_PORT_2BYTES(port, SwapBytes(value)) + +/* +#define IN_PORT_STRING_16(port, addr, len) \ + while ((len)--) {*(hcf_16 *)(addr) = IN_PORT_2BYTES(port); ((cast)addr) += 2; } +#define OUT_PORT_STRING_16(port, addr, len) \ + while ((len)--) {OUT_PORT_2BYTES((port), *(hcf_16 *)(addr)) ; ((cast)addr) += 2; } +*/ + +#endif /* mc68302 */ + + + +/************************************************************************************************/ +/********************************* NGAP ***************************************/ +/************************************************************************************************/ + +#if defined __VX_WORKS__ /* VxWorks */ + +#if defined WLC_STATION +//#undef HCF_TYPE /* Hermes-I Station F/W without SSN support */ +#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDSTA +#else +#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDAP +#endif // WLC_STATION + +#define HCF_YIELD (taskDelay(0) == 0) + +#define MSF_COMPONENT_VAR 1 +#define MSF_COMPONENT_MAJOR_VER 1 +#define MSF_COMPONENT_MINOR_VER 0 + +// #define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox + +#if defined PC486BSP + +#define IN_PORT_WORD(port) (sysInWord ((hcf_io)(port))) +#define OUT_PORT_WORD(port, value) (sysOutWord ((hcf_io)(port), (hcf_16) (value))) +#define IN_PORT_STRING_16(port, addr, n) (sysInWordString ((hcf_io)(port), addr, n)) +#define OUT_PORT_STRING_16(port, addr, n) (sysOutWordString ((hcf_io)(port), addr, n)) + +#elif defined AS2000BSP + +#define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O + +/* Define PCI stuff here. */ +unsigned short sysRead16( unsigned short *port ); +void sysWrite16( unsigned short *port, unsigned short value ); + +#define PCI_IN_BYTE( port ) \ + *(unsigned char *)( port ) + +#define PCI_IN_WORD( port ) \ + sysRead16( (unsigned short *)( port ) ) + +#define PCI_OUT_BYTE( port, value ) \ + *(unsigned char *)( port ) = (unsigned char)( value ) + +#define PCI_OUT_WORD( port, value ) \ + sysWrite16( (unsigned short *)( port ), (unsigned short)( value ) ) + +#define IN_PORT_WORD( port ) \ + PCI_IN_WORD( port ) + +#define OUT_PORT_WORD( port, value ) \ + PCI_OUT_WORD( port, value ) + +#define IN_PORT_STRING_16( port, buf, len ) \ + do { \ + hcf_16 *p; \ + \ + for ( p = (hcf_16 *)(buf); p < &( (hcf_16 *)(buf) )[ (int)len ]; p++ ) { \ + *p = PCI_IN_WORD( port ); \ + } \ + } while ( 0 ) + +#define OUT_PORT_STRING_16( port, buf, len ) \ + do { \ + const hcf_16 *p; \ + \ + for ( p = (const hcf_16 *)( buf ); p < &( (const hcf_16 *)(buf) )[ (int)len ]; p++ ) { \ + PCI_OUT_WORD( port, *p ); \ + } \ + } while ( 0 ) + +#elif defined FADS860BSP /* elif defined AS2000BSP */ + +#define HCF_BIG_ENDIAN 1 + +#define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O + +#ifndef __GNUC__ + #define __asm__ asm +#endif + +#if ! defined _lint + #define EIEIO() __asm__(" eieio") +#else + #define EIEIO() +#endif + +static hcf_16 IN_PORT_WORD(int port) { + hcf_16 value = *(volatile hcf_16 *)(port); EIEIO(); + value = ((value & 0xff00) >> 8) + ((value & 0x00ff) << 8); +/* value = CNV_LITTLE_TO_SHORT(value); */ + return value; + #ifdef __GNUC__ + /* the following serves to avoid the compiler warnings that + * IN_PORT_WORD() is not used in some files */ + (void)IN_PORT_WORD; + #endif +} + +#define OUT_PORT_WORD(port, value) \ + { *(volatile hcf_16 *)(port) = CNV_SHORT_TO_LITTLE(value); EIEIO(); } + +/***********************************************************************/ + +#define IN_PORT_STRING_16( port, addr, len) { \ + unsigned l = (len); \ + volatile hcf_16 *d = (volatile hcf_16 *)(addr); \ + while (l--) { \ + *d++ = *(volatile hcf_16 *)(port); \ + EIEIO(); \ + } \ + } + +#define OUT_PORT_STRING_16( port, addr, len) { \ + unsigned l = (len); \ + volatile hcf_16 *s = (volatile hcf_16 *)(addr); \ + while (l--) { \ + *(volatile hcf_16 *)(port) = *s++; \ + EIEIO(); \ + } \ + } + +#elif defined DAYTONABSP + +#define HCF_BIG_ENDIAN 1 + +#define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O + +#ifndef __GNUC__ + #define __asm__ asm +#endif + +#define IN_PORT_WORD(port) (sysOrinocoInWord((unsigned long)(port))) +#define OUT_PORT_WORD(port,value) (sysOrinocoOutWord((unsigned long)(port), (unsigned short)(value))) + +#define IN_PORT_STRING_16(port,addr,len) (sysOrinocoInString((port), (addr), (len))) +#define OUT_PORT_STRING_16(port,addr,len) (sysOrinocoOutString((port), (addr), (len))) + +extern unsigned char sysOrinocoInByte (unsigned long port); +extern unsigned short sysOrinocoInWord (unsigned long port); +extern void sysOrinocoInString (unsigned long port, void *addr, unsigned short len); + +extern void sysOrinocoOutByte (unsigned long port, unsigned char value); +extern void sysOrinocoOutWord (unsigned long port, unsigned short value); +extern void sysOrinocoOutString (unsigned long port, void *addr, unsigned short len); + +#elif defined ALPHA_BSP + +#define HCF_BIG_ENDIAN 1 + +#define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O + +#ifndef __GNUC__ + #define __asm__ asm +#endif + +#define IN_PORT_WORD(port) (sysOrinocoInWord((unsigned long)(port))) +#define OUT_PORT_WORD(port,value) (sysOrinocoOutWord((unsigned long)(port), (unsigned short)(value))) + +#define IN_PORT_STRING_16(port,addr,len) (sysOrinocoInString((port), (addr), (len))) +#define OUT_PORT_STRING_16(port,addr,len) (sysOrinocoOutString((port), (addr), (len))) + +extern unsigned char sysOrinocoInByte (unsigned long port); +extern unsigned short sysOrinocoInWord (unsigned long port); +extern void sysOrinocoInString (unsigned long port, void *addr, unsigned short len); + +extern void sysOrinocoOutByte (unsigned long port, unsigned char value); +extern void sysOrinocoOutWord (unsigned long port, unsigned short value); +extern void sysOrinocoOutString (unsigned long port, void *addr, unsigned short len); + +#else + +err: /* commented here */ /* "BSP is not defined..." */ + +#endif /* else PC486BSP */ + +#endif // __VX_WORKS__ + + + +/************************************************************************************************/ +/****************************** VXWORKS. Motorola Sandpoint PowerPC 824X ***********************/ +/************************************************************************************************/ +#ifdef __VX_WORKS_SANDPOINT_824X__ + +#include +#include +#include + +#ifdef WVLAN_53 +#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDSTA +#endif /* WVLAN_53 */ + +#ifdef WVLAN_54 +#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDAP +#endif /* WVLAN_54 */ + +#ifdef WVLAN_56 +#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_END +#endif /* WVLAN_56 */ + +#if !defined MSF_COMPONENT_ID +#error "you must define an MSF component ID: WVLAN_53, WVLAN_54, WVLAN_56" +#endif + +#define MSF_COMPONENT_VAR 1 + +#define HCF_EXT HCF_EXT_INFO_LOG +#define HCF_SLEEP ( HCF_CDS | HCF_DDS ) +//#define HCF_SLEEP ( HCF_DDS ) + +#ifndef HCF_ACT_WAKEUP +#define HCF_ACT_WAKEUP 0x1D +#endif // HCF_ACT_WAKEUP + +#if defined FATNIC | defined BEAGLE_H253 +#define T1__HCF_TYPE HCF_TYPE_STA +#else +#define T1__HCF_TYPE HCF_TYPE_AP | HCF_TYPE_STA +#endif + +#ifdef HERMES_USB +#define T2__HCF_TYPE (T1__HCF_TYPE | HCF_TYPE_USB) +#else // HERMES_USB +#define T2__HCF_TYPE (T1__HCF_TYPE) +#endif // HERMES_USB + +#ifdef _WARP +#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5) +#else // _WARP +#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_WPA | HCF_TYPE_HII) +#endif // WARP + +#ifdef _CCX +#define T4__HCF_TYPE (T3__HCF_TYPE | HCF_TYPE_CCX) +#else // _WARP +#define T4__HCF_TYPE (T3__HCF_TYPE) +#endif // _CCX + +#define T5__HCF_TYPE (T4__HCF_TYPE) + +// Default to TYPE_AP + SSN! +#define HCF_TYPE (T5__HCF_TYPE ) + + + +#define MSF_COMPONENT_MAJOR_VER 2 +#define MSF_COMPONENT_MINOR_VER 0 + +#define HCF_IO HCF_IO_MEM +#define HCF_DMA 0 +#define HCF_MEM_IO 1 +#define HCF_BIG_ENDIAN 1 + +//#define support_32bits 1 + +#define IN_PORT_WORD(port) (sysInWord( (hcf_io)(port) )) +#define OUT_PORT_WORD(port, value) (sysOutWord( (hcf_io)(port), (hcf_16)(value) )) +#define IN_PORT_DWORD(port) (sysInLong( (hcf_io)(port) )) +#define OUT_PORT_DWORD(port, value) (sysOutLong( (hcf_io)(port), (hcf_16)(value) )) +#define IN_PORT_STRING_16(port, dst, n) (sysInWordString((hcf_io)(port), (hcf_16 *)dst, n)) +#define OUT_PORT_STRING_16(port, src, n) (sysOutWordString((hcf_io)(port), (hcf_16 *)src, n)) + +#ifdef WVLAN_DEBUG +#define DBG 1 +#define _DEBUG 1 +#endif + +/* we'll need to add these prints someday */ +#define OUTPUTDEBUGMSG(dprintf_exp) +#define ASSERTDEBUGMSG(cond, dprintf_exp) + +#define HCF_INTERFACE_CONNECT(ifbp) +#define HCF_INTERFACE_DISCONNECT(ifbp) +#define HCF_ENTER_INTERFACE_FUNCT(ibfb) +#define HCF_LEAVE_INTERFACE_FUNCT(ifbp) + +#define CNV_END_INT(w) ( ((hcf_16)(w) & 0x00FF) << 8 | ((hcf_16)(w) & 0xFF00) >> 8 ) +#define CNV_LITTLE_TO_INT(w) CNV_END_INT(w) +#define CNV_INT_TO_LITTLE(w) CNV_LITTLE_TO_INT(w) + +#endif /* __VX_WORKS_SANDPOINT_824X__ */ + +/************************************************************************************************/ +/************************************* VXWORKS. ARM T8300 IPPhone *****************************/ +/************************************************************************************************/ +#if defined( IPT_T8300 ) || defined( IPT_T8307 ) + +#include +#include +#include + +#define HCF_ALIGN 4 /* default to 4 byte alignment */ + +#define BEAGLE_H253 /* Hermes 2.5.3 build, better to be in the project file */ +#define OOR_DDS /* Hermes 2.5.3 build, better to be in the project file */ +#define FATNIC + + +#ifdef WVLAN_53 +#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDSTA +#endif /* WVLAN_53 */ + +#ifdef WVLAN_54 +#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDAP +#endif /* WVLAN_54 */ + +#ifdef WVLAN_56 +#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_END +#endif /* WVLAN_56 */ + +#if !defined MSF_COMPONENT_ID +#error "you must define an MSF component ID: WVLAN_53, WVLAN_54, WVLAN_56" +#endif + +#define MSF_COMPONENT_VAR 1 + +#define HCF_EXT HCF_EXT_INFO_LOG +//#define HCF_EXT HCF_EXT_INFO_LOG | HCF_EXT_MB +#define HCF_SLEEP ( HCF_CDS | HCF_DDS ) +//#define HCF_SLEEP ( HCF_DDS ) + +#ifndef HCF_ACT_WAKEUP +#define HCF_ACT_WAKEUP 0x1D +#endif // HCF_ACT_WAKEUP + +#if defined FATNIC || defined BEAGLE_H253 +#define T1__HCF_TYPE HCF_TYPE_STA +#else +//#define T1__HCF_TYPE HCF_TYPE_AP | HCF_TYPE_STA +#define T1__HCF_TYPE HCF_TYPE_STA /* dz, Station code only */ +#endif + +#ifdef HERMES_USB +#define T2__HCF_TYPE (T1__HCF_TYPE | HCF_TYPE_USB) +#else // HERMES_USB +#define T2__HCF_TYPE (T1__HCF_TYPE) +#endif // HERMES_USB + +#ifdef _WARP +#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5) +#else // _WARP +#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_WPA | HCF_TYPE_HII) +//#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII) /* dz. no WPA support at this time, test code */ +#endif // WARP + +#ifdef _CCX +#define T4__HCF_TYPE (T3__HCF_TYPE | HCF_TYPE_CCX) +#else // _WARP +#define T4__HCF_TYPE (T3__HCF_TYPE) +#endif // _CCX + +#define T5__HCF_TYPE (T4__HCF_TYPE) + +// Default to TYPE_AP + SSN! +#define HCF_TYPE (T5__HCF_TYPE ) + + +#define MSF_COMPONENT_MAJOR_VER 2 +#define MSF_COMPONENT_MINOR_VER 0 + +#define HCF_IO HCF_IO_MEM +#define HCF_DMA 0 +#define HCF_MEM_IO 1 + + +/* Endian is determined by vxWorks project compile option */ +#if (_BYTE_ORDER == _BIG_ENDIAN) +#undef HCF_LITTLE_ENDIAN +#define HCF_BIG_ENDIAN 1 +#endif + + +#define CNV_END(w) ( ((hcf_16)(w) & 0x00FF) << 8 | ((hcf_16)(w) & 0xFF00) >> 8 ) +#if defined HCF_BIG_ENDIAN +//******************************************** B I G E N D I A N ******************************************* +#define CNV_LITTLE_TO_INT(w) CNV_END(w) // endianess conversion needed +#define CNV_BIG_TO_INT(w) (w) // no endianess conversion needed +#else +//****************************************** L I T T L E E N D I A N **************************************** +#define CNV_LITTLE_TO_INT(w) (w) // no endianess conversion needed +#define CNV_BIG_TO_INT(w) CNV_END(w) // endianess conversion needed +#endif // HCF_BIG_ENDIAN + +// conversion macros which can be expressed in other macros +#define CNV_INT_TO_LITTLE(w) CNV_LITTLE_TO_INT(w) +#define CNV_INT_TO_BIG(w) CNV_BIG_TO_INT(w) + + + +#define IN_PORT_WORD( port ) *((volatile hcf_16 *)( port )) +#define OUT_PORT_WORD( port, value ) *((volatile hcf_16 *)( port )) = ((hcf_16)( value )) +//#define IN_PORT_BYTE( port ) *((volatile hcf_8 *)( port )) + +#define IN_PORT_STRING( port, addr, len) { \ + unsigned l = len; \ + hcf_16 *d = (hcf_16 *)(addr); \ + hcf_16 t; \ + while (l--) { \ + t = IN_PORT_WORD(port); \ + *d++ = CNV_LITTLE_TO_INT(t); \ + } \ +} // IN_PORT_STRING + +#define OUT_PORT_STRING( port, addr, len) { \ + unsigned l = (len); \ + hcf_16 *s = (hcf_16 *)(addr); \ + hcf_16 t; \ + while (l--) { \ + t = *s++; \ + t = CNV_LITTLE_TO_INT(t); \ + OUT_PORT_WORD(port, t); \ + } \ +} // OUT_PORT_STRING + +#define IN_PORT_STRING_16(port, dst, n) { \ + unsigned l = (n); \ + hcf_16 *d = (hcf_16 *)(dst); \ + while (l--) { \ + *d++ = IN_PORT_WORD(port); \ + } \ +} // IN_PORT_STRING_16 + +#define OUT_PORT_STRING_16(port, src, n) { \ + hcf_16 t; \ + int l = (n); \ + hcf_16 *s = (hcf_16 *)(src); \ + while (l--) { \ + t = *s++; \ + OUT_PORT_WORD(port, t); \ + } \ +} // OUT_PORT_STRING_16 + +/* #define HCF_YIELD (taskDelay(0) == 0) */ + + + +#ifdef WVLAN_DEBUG +#define DBG 1 +#define _DEBUG 1 +#endif + +/* we'll need to add these prints someday */ +#define OUTPUTDEBUGMSG(dprintf_exp) +#define ASSERTDEBUGMSG(cond, dprintf_exp) + +#define HCF_INTERFACE_CONNECT(ifbp) +#define HCF_INTERFACE_DISCONNECT(ifbp) +#define HCF_ENTER_INTERFACE_FUNCT(ibfb) +#define HCF_LEAVE_INTERFACE_FUNCT(ifbp) + +#define sysInWord(offsetAddr) IN_PORT_WORD(offsetAddr) +#define sysInByte(offsetAddr) IN_PORT_BYTE(offsetAddr) +#define sysOutWord(addr, value) OUT_PORT_WORD(addr, value) + +#endif /*IPT_T8300 */ + +/************************************************************************************************************/ +/*********************************** **************************************/ +/************************************************************************************************************/ +#if ! defined HCF_ALIGN +#define HCF_ALIGN 1 //default to no alignment +#endif // HCF_ALIGN + +#if ! defined HCF_ASSERT +#define HCF_ASSERT 0 +#endif // HCF_ASSERT + +#if ! defined HCF_BIG_ENDIAN +#define HCF_BIG_ENDIAN 0 +#endif // HCF_BIG_ENDIAN + +#if ! defined HCF_DL_ONLY +#define HCF_DL_ONLY 0 +#endif // HCF_DL_ONLY + +#if ! defined HCF_DMA +#define HCF_DMA 0 +#endif // HCF_DMA + +#if ! defined HCF_ENCAP +#define HCF_ENCAP HCF_ENC +#endif // HCF_ENCAP + +#if ! defined HCF_ENTRY +#define HCF_ENTRY( ifbp ) +#endif // HCF_ENTRY + +#if ! defined HCF_EXIT +#define HCF_EXIT( ifbp ) +#endif // HCF_EXIT + +#if ! defined HCF_EXT +#define HCF_EXT 0 +#endif // HCF_EXT + +#if ! defined HCF_INT_ON +#define HCF_INT_ON 1 +#endif // HCF_INT_ON + +#if ! defined HCF_IO +#define HCF_IO 0 //default 16 bits support only, port I/O +#endif // HCF_IO + +#if ! defined HCF_LEGACY +#define HCF_LEGACY 0 +#endif // HCF_LEGACY + +#if ! defined HCF_MAX_LTV +#define HCF_MAX_LTV 1200 // sufficient for all known purposes +#endif // HCF_MAX_LTV + +#if ! defined HCF_PROT_TIME +#define HCF_PROT_TIME 100 // number of 10K microsec protection timer against H/W malfunction +#endif // HCF_PROT_TIME + +#if ! defined HCF_SLEEP +#define HCF_SLEEP 0 +#endif // HCF_SLEEP + +#if ! defined HCF_TALLIES +#define HCF_TALLIES ( HCF_TALLIES_NIC | HCF_TALLIES_HCF ) +#endif // HCF_TALLIES + +#if ! defined HCF_TYPE +#define HCF_TYPE 0 +#endif // HCF_TYPE + +#if HCF_BIG_ENDIAN +#undef HCF_BIG_ENDIAN +#define HCF_BIG_ENDIAN 1 //just for convenience of generating cfg_hcf_opt +#endif // HCF_BIG_ENDIAN + +#if HCF_DL_ONLY +#undef HCF_DL_ONLY +#define HCF_DL_ONLY 1 //just for convenience of generating cfg_hcf_opt +#endif // HCF_DL_ONLY + +#if HCF_DMA +#undef HCF_DMA +#define HCF_DMA 1 //just for convenience of generating cfg_hcf_opt +#endif // HCF_DMA + +#if HCF_INT_ON +#undef HCF_INT_ON +#define HCF_INT_ON 1 //just for convenience of generating cfg_hcf_opt +#endif // HCF_INT_ON + + +#if ! defined IN_PORT_STRING_8_16 +#define IN_PORT_STRING_8_16(port, addr, len) IN_PORT_STRING_16(port, addr, len) +#define OUT_PORT_STRING_8_16(port, addr, len) OUT_PORT_STRING_16(port, addr, len) +#endif // IN_PORT_STRING_8_16 + +/************************************************************************************************/ +/********** *************/ +/************************************************************************************************/ + +#if ! defined FAR +#define FAR // default to flat 32-bits code +#endif // FAR + +typedef hcf_8 FAR *wci_bufp; // segmented 16-bits or flat 32-bits pointer to 8 bits unit +typedef hcf_16 FAR *wci_recordp; // segmented 16-bits or flat 32-bits pointer to 16 bits unit + +/* I/O Address size +* Platforms which use port mapped I/O will (in general) have a 64k I/O space, conveniently expressed in a +* 16-bits quantity +* Platforms which use memory mapped I/O will (in general) have an I/O space much larger than 64k, and need a +* 32-bits quantity to express the I/O base +*/ + +#if HCF_IO & HCF_IO_MEM +typedef hcf_32 hcf_io; +#else +typedef hcf_16 hcf_io; +#endif //HCF_IO + +#if HCF_PROT_TIME > 128 +#define HCF_PROT_TIME_SHFT 3 +#define HCF_PROT_TIME_DIV 8 +#elif HCF_PROT_TIME > 64 +#define HCF_PROT_TIME_SHFT 2 +#define HCF_PROT_TIME_DIV 4 +#elif HCF_PROT_TIME > 32 +#define HCF_PROT_TIME_SHFT 1 +#define HCF_PROT_TIME_DIV 2 +#else //HCF_PROT_TIME >= 19 +#define HCF_PROT_TIME_SHFT 0 +#define HCF_PROT_TIME_DIV 1 +#endif + +#define HCF_PROT_TIME_CNT (HCF_PROT_TIME / HCF_PROT_TIME_DIV) + + +/************************************************************************************************************/ +/******************************************* . . . . . . . . . *********************************************/ +/************************************************************************************************************/ + +/* MSF_COMPONENT_ID is used to define the CFG_IDENTITY_STRCT in HCF.C +* CFG_IDENTITY_STRCT is defined in HCF.C purely based on convenience arguments. +* The HCF can not have the knowledge to determine the ComponentId field of the Identity record (aka as +* Version Record), therefore the MSF part of the Drivers must supply this value via the System Constant +* MSF_COMPONENT_ID. +* There is a set of values predefined in MDD.H (format COMP_ID_.....) +* +* Note that taking MSF_COMPONENT_ID as a default value for DUI_COMPAT_VAR is purely an implementation +* convenience, the numerical values of these two quantities have none functional relationship whatsoever. +*/ + +#if defined MSF_COMPONENT_ID + +#if ! defined DUI_COMPAT_VAR +#define DUI_COMPAT_VAR MSF_COMPONENT_ID +#endif // DUI_COMPAT_VAR + +#if ! defined DUI_COMPAT_BOT //;?this way utilities can lower as well raise the bottom +#define DUI_COMPAT_BOT 8 +#endif // DUI_COMPAT_BOT + +#if ! defined DUI_COMPAT_TOP //;?this way utilities can lower as well raise the top +#define DUI_COMPAT_TOP 8 +#endif // DUI_COMPAT_TOP + +#endif // MSF_COMPONENT_ID + +#if (HCF_TYPE) & HCF_TYPE_HII5 + +#if ! defined HCF_HSI_VAR_5 +#define HCF_HSI_VAR_5 +#endif // HCF_HSI_VAR_5 + +#if ! defined HCF_APF_VAR_4 +#define HCF_APF_VAR_4 +#endif // HCF_APF_VAR_4 + +#if (HCF_TYPE) & HCF_TYPE_WARP +#if ! defined HCF_STA_VAR_4 +#define HCF_STA_VAR_4 +#endif // HCF_STA_VAR_4 +#else +#if ! defined HCF_STA_VAR_2 +#define HCF_STA_VAR_2 +#endif // HCF_STA_VAR_2 +#endif + +#if defined HCF_HSI_VAR_4 +err: HSI variants 4 correspond with HII; +#endif // HCF_HSI_VAR_4 + +#else + +#if ! defined HCF_HSI_VAR_4 +#define HCF_HSI_VAR_4 //Hermes-II all types (for the time being!) +#endif // HCF_HSI_VAR_4 + +#if ! defined HCF_APF_VAR_2 +#define HCF_APF_VAR_2 +#endif // HCF_APF_VAR_2 + +#if ! defined HCF_STA_VAR_2 +#define HCF_STA_VAR_2 +#endif // HCF_STA_VAR_2 + +#endif // HCF_TYPE_HII5 + +#if ! defined HCF_PRI_VAR_3 +#define HCF_PRI_VAR_3 +#endif // HCF_PRI_VAR_3 + +#if defined HCF_HSI_VAR_1 || defined HCF_HSI_VAR_2 || defined HCF_HSI_VAR_3 +err: HSI variants 1, 2 and 3 correspond with H-I only; +#endif // HCF_HSI_VAR_1, HCF_HSI_VAR_2, HCF_HSI_VAR_3 + +#if defined HCF_PRI_VAR_1 || defined HCF_PRI_VAR_2 +err: primary variants 1 and 2 correspond with H-I only; +#endif // HCF_PRI_VAR_1 / HCF_PRI_VAR_2 + + +/************************************************************************************************************/ +/******************************************* . . . . . . . . . *********************************************/ +/************************************************************************************************************/ + + +/* The BASED customization macro is used to resolves the SS!=DS conflict for the Interrupt Service logic in + * DOS Drivers. Due to the cumbersomeness of mixing C and assembler local BASED variables still end up in the + * wrong segment. The workaround is that the HCF uses only global BASED variables or IFB-based variables. + * The "BASED" construction (supposedly) only amounts to something in the small memory model. + * + * Note that the whole BASED rigmarole is needlessly complicated because both the Microsoft Compiler and + * Linker are unnecessary restrictive in what far pointer manipulation they allow + */ + +#if ! defined BASED +#define BASED +#endif // BASED + +#if ! defined EXTERN_C +#ifdef __cplusplus +#define EXTERN_C extern "C" +#else +#define EXTERN_C +#endif // __cplusplus +#endif // EXTERN_C + +#if ! defined NULL +#define NULL ((void *) 0) +#endif // NULL + +#if ! defined TEXT +#define TEXT(x) x +#endif // TEXT + +#if !defined _TCHAR_DEFINED +#define TCHAR char +#endif // _TCHAR_DEFINED + +/************************************************************************************************************/ +/*********************** C O N F L I C T D E T E C T I O N & R E S O L U T I O N ************************/ +/************************************************************************************************************/ +#if defined HCF_LITTLE_ENDIAN +err: HCF_LITTLE_ENDIAN is obsolete; +#endif // HCF_LITTLE_ENDIAN + +#if defined HCF_INT_OFF +err: HCF_INT_OFF is obsolete; +#endif //HCF_INT_OFF + +#if HCF_ALIGN != 1 && HCF_ALIGN != 2 && HCF_ALIGN != 4 && HCF_ALIGN != 8 +err: invalid value for HCF_ALIGN; +#endif // HCF_ALIGN + +#if (HCF_ASSERT) & ~( HCF_ASSERT_PRINTF | HCF_ASSERT_SW_SUP | HCF_ASSERT_MB | HCF_ASSERT_RT_MSF_RTN | \ + HCF_ASSERT_LNK_MSF_RTN ) +err: invalid value for HCF_ASSERT; +#endif // HCF_ASSERT + +#if (HCF_ASSERT) & HCF_ASSERT_MB && ! ( (HCF_EXT) & HCF_EXT_MB ) //detect potential conflict +err: these macros are not used consistently; +#endif // HCF_ASSERT_MB / HCF_EXT_MB + +#if HCF_BIG_ENDIAN != 0 && HCF_BIG_ENDIAN != 1 +err: invalid value for HCF_BIG_ENDIAN; +#endif // HCF_BIG_ENDIAN + +#if HCF_DL_ONLY != 0 && HCF_DL_ONLY != 1 +err: invalid value for HCF_DL_ONLY; +#endif // HCF_DL_ONLY + +#if HCF_DMA != 0 && HCF_DMA != 1 +err: invalid value for HCF_DMA; +#endif // HCF_DMA + +#if (HCF_ENCAP) & ~( HCF_ENC | HCF_ENC_SUP ) +err: invalid value for HCF_ENCAP; +#endif // HCF_ENCAP + +#if (HCF_EXT) & ~( HCF_EXT_INFO_LOG | HCF_EXT_INT_TX_EX | HCF_EXT_TALLIES_FW | HCF_EXT_TALLIES_HCF | \ + HCF_EXT_NIC_ACCESS | HCF_EXT_MB | HCF_EXT_INT_TICK | \ + HCF_EXT_IFB_STRCT | HCF_EXT_DESC_STRCT | HCF_EXT_TX_CONT ) +err: invalid value for HCF_EXT; +#endif // HCF_EXT + +#if HCF_INT_ON != 0 && HCF_INT_ON != 1 +err: invalid value for HCF_INT_ON; +#endif // HCF_INT_ON + +#if (HCF_IO) & ~( HCF_IO_MEM | HCF_IO_32BITS ) +err: invalid value for HCF_IO; +#endif // HCF_IO + +#if HCF_LEGACY != 0 && HCF_LEGACY != 1 +err: invalid value for HCF_LEGACY; +#endif // HCF_LEGACY + +#if HCF_MAX_LTV < 16 || HCF_MAX_LTV > 2304 +err: invalid value for HCF_MAX_LTV; +#endif // HCF_MAX_LTV + +#if HCF_PROT_TIME != 0 && ( HCF_PROT_TIME < 19 || 256 < HCF_PROT_TIME ) +err: below minimum .08 second required by Hermes or possibly above hcf_32 capacity; +#endif // HCF_PROT_TIME + +#if (HCF_SLEEP) & ~( HCF_CDS | HCF_DDS ) +err: invalid value for HCF_SLEEP; +#endif // HCF_SLEEP + +#if (HCF_SLEEP) && ! (HCF_INT_ON) +err: these macros are not used consistently; +#endif // HCF_SLEEP / HCF_INT_ON + +#if (HCF_SLEEP) && ! ( (HCF_EXT) & HCF_EXT_INT_TICK ) +//;? err: these macros are not used consistently; +#endif // HCF_SLEEP / HCF_EXT_INT_TICK + +#if (HCF_TALLIES) & ~( HCF_TALLIES_HCF | HCF_TALLIES_NIC | HCF_TALLIES_RESET ) || \ + (HCF_TALLIES) == HCF_TALLIES_RESET +err: invalid value for HCF_TALLIES; +#endif // HCF_TALLIES + +#if (HCF_TYPE) & ~(HCF_TYPE_WPA | HCF_TYPE_USB | HCF_TYPE_PRELOADED | HCF_TYPE_HII5 | HCF_TYPE_WARP | \ + HCF_TYPE_CCX /* | HCF_TYPE_TX_DELAY */ ) +err: invalid value for HCF_TYPE; +#endif //HCF_TYPE + +#if (HCF_TYPE) & HCF_TYPE_WARP && (HCF_TYPE) & HCF_TYPE_WPA +err: at most 1 of these macros should be defined; +#endif //HCF_TYPE_WARP / HCF_TYPE_WPA + +#endif //HCFCFG_H + diff --git a/drivers/staging/wlags49_h2/hcfdef.h b/drivers/staging/wlags49_h2/hcfdef.h new file mode 100644 index 000000000000..f7e74bfbadfa --- /dev/null +++ b/drivers/staging/wlags49_h2/hcfdef.h @@ -0,0 +1,809 @@ + +// vim:tw=110:ts=4: +#ifndef HCFDEFC_H +#define HCFDEFC_H 1 + +/************************************************************************************************* +* +* FILE : HCFDEF.H +* +* DATE : $Date: 2004/08/05 11:47:10 $ $Revision: 1.8 $ +* Original: 2004/05/28 14:05:35 Revision: 1.59 Tag: hcf7_t20040602_01 +* Original: 2004/05/13 15:31:45 Revision: 1.53 Tag: hcf7_t7_20040513_01 +* Original: 2004/04/15 09:24:42 Revision: 1.44 Tag: hcf7_t7_20040415_01 +* Original: 2004/04/13 14:22:45 Revision: 1.43 Tag: t7_20040413_01 +* Original: 2004/04/01 15:32:55 Revision: 1.40 Tag: t7_20040401_01 +* Original: 2004/03/10 15:39:28 Revision: 1.36 Tag: t20040310_01 +* Original: 2004/03/03 14:10:12 Revision: 1.34 Tag: t20040304_01 +* Original: 2004/03/02 09:27:12 Revision: 1.32 Tag: t20040302_03 +* Original: 2004/02/24 13:00:29 Revision: 1.29 Tag: t20040224_01 +* Original: 2004/02/18 17:13:57 Revision: 1.26 Tag: t20040219_01 +* +* AUTHOR : Nico Valster +* +* SPECIFICATION: ........... +* +* DESC : Definitions and Prototypes for HCF only +* +************************************************************************************************** +* +* +* SOFTWARE LICENSE +* +* This software is provided subject to the following terms and conditions, +* which you should read carefully before using the software. Using this +* software indicates your acceptance of these terms and conditions. If you do +* not agree with these terms and conditions, do not use the software. +* +* COPYRIGHT © 1994 - 1995 by AT&T. All Rights Reserved +* COPYRIGHT © 1996 - 2000 by Lucent Technologies. All Rights Reserved +* COPYRIGHT © 2001 - 2004 by Agere Systems Inc. All Rights Reserved +* All rights reserved. +* +* Redistribution and use in source or binary forms, with or without +* modifications, are permitted provided that the following conditions are met: +* +* . Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following Disclaimer as comments in the code as +* well as in the documentation and/or other materials provided with the +* distribution. +* +* . Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following Disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* . Neither the name of Agere Systems Inc. nor the names of the contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* Disclaimer +* +* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY +* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN +* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +* DAMAGE. +* +* +*************************************************************************************************/ + + +/************************************************************************************************/ +/********************************* P R E F I X E S ********************************************/ +/************************************************************************************************/ +//IFB_ Interface Block +//HCMD_ Hermes Command +//HFS_ Hermes (Transmit/Receive) Frame Structure +//HREG_ Hermes Register + +/*************************************************************************************************/ + +#if 0 // +#define BIT0 0x0001 +#define BIT1 0x0002 +#define BIT2 0x0004 +#define BIT3 0x0008 +#define BIT4 0x0010 +#define BIT5 0x0020 +#define BIT6 0x0040 +#define BIT7 0x0080 +#define BIT8 0x0100 +#define BIT9 0x0200 +#define BIT10 0x0400 +#define BIT11 0x0800 +#define BIT12 0x1000 +#define BIT13 0x2000 +#define BIT14 0x4000 +#define BIT15 0x8000 +#define BIT16 0x00010000 +#define BIT17 0x00020000 +#define BIT18 0x00040000 +#define BIT19 0x00080000 +#define BIT20 0x00100000 +#define BIT21 0x00200000 +#define BIT22 0x00400000 +#define BIT23 0x00800000 +#define BIT24 0x01000000 +#define BIT25 0x02000000 +#define BIT26 0x04000000 +#define BIT27 0x08000000 +#define BIT28 0x10000000 +#define BIT29 0x20000000 +#define BIT30 0x40000000 +#define BIT31 0x80000000 +#endif // 0 + +/************************************************************************************************/ +/********************************* GENERAL EQUATES **********************************************/ +/************************************************************************************************/ + + +#define HCF_MAGIC 0x7D37 // "}7" Handle validation + +#define PLUG_DATA_OFFSET 0x00000800 //needed by some test tool on top of H-II NDIS driver + +#define INI_TICK_INI 0x00040000L + +#define IO_IN 0 //hcfio_in_string +#define IO_OUT 1 //hcfio_out_string + +//DO_ASSERT, create an artificial FALSE to force an ASSERT without the nasty compiler warning +#define DO_ASSERT ( assert_ifbp->IFB_Magic != HCF_MAGIC && assert_ifbp->IFB_Magic == HCF_MAGIC ) +#define NT_ASSERT 0x0000 //, NEVER_TESTED +#define NEVER_TESTED MERGE_2( 0xEFFE, 0xFEEF ) +#define SE_ASSERT 0x5EFF /* Side Effect, HCFASSERT invokation which are only called for the + * side effect and which should never trigger */ +#define DHF_FILE_NAME_OFFSET 10000 //to distinguish DHF from HCF asserts by means of line number +#define MMD_FILE_NAME_OFFSET 20000 //to distinguish MMD from HCF asserts by means of line number + +// trace codes used to +// 1: profile execution times via HCF_TRACE and HCF_TRACE_VALUE +// 2: hierarchical flow information via HCFLOGENTRY / HCFLOGEXIT + +//#define HCF_TRACE_CONNECT useless +//#define HCF_TRACE_DISCONNECT useless +#define HCF_TRACE_ACTION 0x0000 // 0x0001 +#define HCF_TRACE_CNTL 0x0001 // 0x0002 +#define HCF_TRACE_DMA_RX_GET 0x0002 // 0x0004 +#define HCF_TRACE_DMA_RX_PUT 0x0003 // 0x0008 +#define HCF_TRACE_DMA_TX_GET 0x0004 // 0x0010 +#define HCF_TRACE_DMA_TX_PUT 0x0005 // 0x0020 +#define HCF_TRACE_GET_INFO 0x0006 // 0x0040 +#define HCF_TRACE_PUT_INFO 0x0007 // 0x0080 +#define HCF_TRACE_RCV_MSG 0x0008 // 0x0100 +#define HCF_TRACE_SEND_MSG 0x0009 // 0x0200 +#define HCF_TRACE_SERVICE_NIC 0x000A // 0x0400 +// #define HCF_TRACE_ 0x000C // 0x1000 +// #define HCF_TRACE_ 0x000D // 0x2000 +// #define HCF_TRACE_ 0x000E // 0x4000 +// #define HCF_TRACE_ 0x000F // 0x8000 +// ============================================ HCF_TRACE_... codes below 0x0010 are asserted on re-entry +#define HCF_TRACE_ACTION_KLUDGE 0x0010 /* once you start introducing kludges there is no end to it + * this is an escape to do not assert on re-entrancy problem caused + * by HCF_ACT_INT_FORCE_ON used to get Microsofts NDIS drivers going + */ +#define HCF_TRACE_STRIO 0x0020 +#define HCF_TRACE_ALLOC 0X0021 +#define HCF_TRACE_DL 0X0023 +#define HCF_TRACE_ISR_INFO 0X0024 +#define HCF_TRACE_CALIBRATE 0x0026 + +#define HCF_TRACE_CMD_CPL 0x0040 +#define HCF_TRACE_CMD_EXE 0x0041 +#define HCF_TRACE_GET_FID 0x0042 +#define HCF_TRACE_GET_FRAG 0x0043 +#define HCF_TRACE_INIT 0x0044 +#define HCF_TRACE_PUT_FRAG 0x0045 +#define HCF_TRACE_SETUP_BAP 0x0046 + +#define HCF_TRACE_EXIT 0x8000 // Keil C warns "long constant truncated to int" + +//#define BAP_0 HREG_DATA_0 //Used by DMA controller to access NIC RAM +#define BAP_1 HREG_DATA_1 //Used by HCF to access NIC RAM + + +//************************* Hermes Receive/Transmit Frame Structures +//HFS_STAT +//see MMD.H for HFS_STAT_ERR +#define HFS_STAT_MSG_TYPE 0xE000 //Hermes reported Message Type +#define HFS_STAT_MIC_KEY_ID 0x1800 //MIC key used (if any) +#define HFS_STAT_1042 0x2000 //RFC1042 Encoded +#define HFS_STAT_TUNNEL 0x4000 //Bridge-Tunnel Encoded +#define HFS_STAT_WMP_MSG 0x6000 //WaveLAN-II Management Protocol Frame +#if (HCF_TYPE) & HCF_TYPE_WPA +#define HFS_STAT_MIC 0x0010 //Frame contains MIC //;? re-instate when F/W ready +#endif + +//************************* Hermes Register Offsets and Command bits +#define HREG_IO_RANGE 0x80 //I/O Range used by Hermes + + +//************************* Command/Status +#define HREG_CMD 0x00 // +#define HCMD_CMD_CODE 0x3F +#define HREG_PARAM_0 0x02 // +#define HREG_PARAM_1 0x04 // +#define HREG_PARAM_2 0x06 // +#define HREG_STAT 0x08 // +#define HREG_STAT_CMD_CODE 0x003F // +#define HREG_STAT_DIAG_ERR 0x0100 +#define HREG_STAT_INQUIRE_ERR 0x0500 +#define HREG_STAT_CMD_RESULT 0x7F00 // +#define HREG_RESP_0 0x0A // +#define HREG_RESP_1 0x0C // +#define HREG_RESP_2 0x0E // + + +//************************* FID Management +#define HREG_INFO_FID 0x10 // +#define HREG_RX_FID 0x20 // +#define HREG_ALLOC_FID 0x22 // +#define HREG_TX_COMPL_FID 0x24 // + + +//************************* BAP +//20031030 HWi Inserted this again because the dongle code uses this (GPIF.C) +//#define HREG_SELECT_0 0x18 // +//#define HREG_OFFSET_0 0x1C // +//#define HREG_DATA_0 0x36 // + +//#define HREG_OFFSET_BUSY 0x8000 // use HCMD_BUSY +#define HREG_OFFSET_ERR 0x4000 // +//rsrvd #define HREG_OFFSET_DATA_OFFSET 0x0FFF // + +#define HREG_SELECT_1 0x1A // +#define HREG_OFFSET_1 0x1E // +#define HREG_DATA_1 0x38 // + + +//************************* Event +#define HREG_EV_STAT 0x30 // +#define HREG_INT_EN 0x32 // +#define HREG_EV_ACK 0x34 // + +#define HREG_EV_TICK 0x8000 //Auxiliary Timer Tick +//#define HREG_EV_RES 0x4000 //H-I only: H/W error (Wait Time-out) +#define HREG_EV_INFO_DROP 0x2000 //WMAC did not have sufficient RAM to build Unsollicited Frame +#if (HCF_TYPE) & HCF_TYPE_HII5 +#define HREG_EV_ACK_REG_READY 0x0000 +#else +#define HREG_EV_ACK_REG_READY 0x1000 //Workaround Kludge bit for H-II (not H-II.5) +#endif // HCF_TYPE_HII5 +#if (HCF_SLEEP) & ( HCF_CDS | HCF_DDS ) +#define HREG_EV_SLEEP_REQ 0x0800 +#else +#define HREG_EV_SLEEP_REQ 0x0000 +#endif // HCF_CDS / HCF_DDS +#if HCF_DMA +//#define HREG_EV_LPESC 0x0400 // firmware sets this bit and clears it, not for host usage. +#define HREG_EV_RDMAD 0x0200 // rx frame in host memory +#define HREG_EV_TDMAD 0x0100 // tx frame in host memory processed +//#define HREG_EV_RXDMA 0x0040 // firmware kicks off DMA engine (bit is not for host usage) +//#define HREG_EV_TXDMA 0x0020 // firmware kicks off DMA engine (bit is not for host usage) +#define HREG_EV_FW_DMA 0x0460 // firmware / DMA engine I/F (bits are not for host usage) +#else +#define HREG_EV_FW_DMA 0x0000 +#endif // HCF_DMA +#define HREG_EV_INFO 0x0080 // Asynchronous Information Frame +#define HREG_EV_CMD 0x0010 // Command completed, Status and Response available +#define HREG_EV_ALLOC 0x0008 // Asynchronous part of Allocation/Reclaim completed +#define HREG_EV_TX_EXC 0x0004 // Asynchronous Transmission unsuccessful completed +#define HREG_EV_TX 0x0002 // Asynchronous Transmission successful completed +#define HREG_EV_RX 0x0001 // Asynchronous Receive Frame + +#define HREG_EV_TX_EXT ( (HCF_EXT) & (HCF_EXT_INT_TX_EX | HCF_EXT_INT_TICK ) ) + /* HREG_EV_TX_EXT := 0x0000 or HREG_EV_TX_EXC and/or HREG_EV_TICK + * could be extended with HREG_EV_TX */ +#if HCF_EXT_INT_TX_EX != HREG_EV_TX_EXC +err: these values should match; +#endif // HCF_EXT_INT_TX_EX / HREG_EV_TX_EXC + +#if HCF_EXT_INT_TICK != HREG_EV_TICK +err: these values should match; +#endif // HCF_EXT_INT_TICK / HREG_EV_TICK + +//************************* Host Software +#define HREG_SW_0 0x28 // +#define HREG_SW_1 0x2A // +#define HREG_SW_2 0x2C // +//rsrvd #define HREG_SW_3 0x2E // +//************************* Control and Auxiliary Port + +#define HREG_IO 0x12 +#define HREG_IO_SRESET 0x0001 +#define HREG_IO_WAKEUP_ASYNC 0x0002 +#define HREG_IO_WOKEN_UP 0x0004 +#define HREG_CNTL 0x14 // +//#define HREG_CNTL_WAKEUP_SYNC 0x0001 +#define HREG_CNTL_AUX_ENA_STAT 0xC000 +#define HREG_CNTL_AUX_DIS_STAT 0x0000 +#define HREG_CNTL_AUX_ENA_CNTL 0x8000 +#define HREG_CNTL_AUX_DIS_CNTL 0x4000 +#define HREG_CNTL_AUX_DSD 0x2000 +#define HREG_CNTL_AUX_ENA (HREG_CNTL_AUX_ENA_CNTL | HREG_CNTL_AUX_DIS_CNTL ) +#define HREG_SPARE 0x16 // +#define HREG_AUX_PAGE 0x3A // +#define HREG_AUX_OFFSET 0x3C // +#define HREG_AUX_DATA 0x3E // + +#if HCF_DMA +//************************* DMA (bus mastering) + // Be carefull to use these registers only at a genuine 32 bits NIC + // On 16 bits NICs, these addresses are mapped into the range 0x00 through 0x3F with all consequences + // thereof, e.g. HREG_DMA_CTRL register maps to HREG_CMD. +#define HREG_DMA_CTRL 0x0040 +#define HREG_TXDMA_PTR32 0x0044 +#define HREG_TXDMA_PRIO_PTR32 0x0048 +#define HREG_TXDMA_HIPRIO_PTR32 0x004C +#define HREG_RXDMA_PTR32 0x0050 +#define HREG_CARDDETECT_1 0x007C // contains 7D37 +#define HREG_CARDDETECT_2 0x007E // contains 7DE7 +#define HREG_FREETIMER 0x0058 +#define HREG_DMA_RX_CNT 0x0026 + +/****************************************************************************** +* Defines for the bits in the DmaControl register (@40h) +******************************************************************************/ +#define HREG_DMA_CTRL_RXHWEN 0x80000000 // high word enable bit +#define HREG_DMA_CTRL_RXRESET 0x40000000 // tx dma init bit +#define HREG_DMA_CTRL_RXBAP1 BIT29 +#define HREG_DMA_CTRL_RX_STALLED BIT28 +#define HREG_DMA_CTRL_RXAUTOACK_DMADONE BIT27 // no host involvement req. for TDMADONE event +#define HREG_DMA_CTRL_RXAUTOACK_INFO BIT26 // no host involvement req. for alloc event +#define HREG_DMA_CTRL_RXAUTOACK_DMAEN 0x02000000 // no host involvement req. for TxDMAen event +#define HREG_DMA_CTRL_RXAUTOACK_RX 0x01000000 // no host involvement req. for tx event +#define HREG_DMA_CTRL_RX_BUSY BIT23 // read only bit +//#define HREG_DMA_CTRL_RX_RBUFCONT_PLAIN 0 // bits 21..20 +//#define HREG_DMA_CTRL_RX_MODE_PLAIN_DMA 0 // mode 0 +#define HREG_DMA_CTRL_RX_MODE_SINGLE_PACKET 0x00010000 // mode 1 +#define HREG_DMA_CTRL_RX_MODE_MULTI_PACKET 0x00020000 // mode 2 +//#define HREG_DMA_CTRL_RX_MODE_DISABLE (0x00020000|0x00010000) // disable tx dma engine +#define HREG_DMA_CTRL_TXHWEN 0x8000 // low word enable bit +#define HREG_DMA_CTRL_TXRESET 0x4000 // rx dma init bit +#define HREG_DMA_CTRL_TXBAP1 BIT13 +#define HREG_DMA_CTRL_TXAUTOACK_DMADONE BIT11 // no host involvement req. for RxDMADONE event +#define HREG_DMA_CTRL_TXAUTOACK_DMAEN 0x00000400 // no host involvement req. for RxDMAen event +#define HREG_DMA_CTRL_TXAUTOACK_DMAALLOC 0x00000200 // no host involvement req. for info event +#define HREG_DMA_CTRL_TXAUTOACK_TX 0x00000100 // no host involvement req. for rx event +#define HREG_DMA_CTRL_TX_BUSY BIT7 // read only bit +//#define HREG_DMA_CTRL_TX_TBUFCONT_PLAIN 0 // bits 6..5 +//#define HREG_DMA_CTRL_TX_MODE_PLAIN_DMA 0 // mode 0 +#define HREG_DMA_CTRL_TX_MODE_SINGLE_PACKET BIT0 // mode 1 +#define HREG_DMA_CTRL_TX_MODE_MULTI_PACKET 0x00000002 // mode 2 +//#define HREG_DMA_CTRL_TX_MODE_DISABLE (0x00000001|0x00000002) // disable tx dma engine + +//configuration DWORD to configure DMA for mode2 operation, using BAP0 as the DMA BAP. +#define DMA_CTRLSTAT_GO (HREG_DMA_CTRL_RXHWEN | HREG_DMA_CTRL_RX_MODE_MULTI_PACKET | \ + HREG_DMA_CTRL_RXAUTOACK_DMAEN | HREG_DMA_CTRL_RXAUTOACK_RX | \ + HREG_DMA_CTRL_TXHWEN | /*;?HREG_DMA_CTRL_TX_TBUFCONT_PLAIN |*/ \ + HREG_DMA_CTRL_TX_MODE_MULTI_PACKET | HREG_DMA_CTRL_TXAUTOACK_DMAEN |\ + HREG_DMA_CTRL_TXAUTOACK_DMAALLOC) + +//configuration DWORD to reset both the Tx and Rx DMA engines +#define DMA_CTRLSTAT_RESET (HREG_DMA_CTRL_RXHWEN | HREG_DMA_CTRL_RXRESET | HREG_DMA_CTRL_TXHWEN | HREG_DMA_CTRL_TXRESET) + +//#define DESC_DMA_OWNED 0x80000000 // BIT31 +#define DESC_DMA_OWNED 0x8000 // BIT31 +#define DESC_SOP 0x8000 // BIT15 +#define DESC_EOP 0x4000 // BIT14 + +#define DMA_RX 0 +#define DMA_TX 1 + +// #define IFB_RxFirstDesc IFB_FirstDesc[DMA_RX] +// #define IFB_TxFirstDesc IFB_FirstDesc[DMA_TX] +// #define IFB_RxLastDesc IFB_LastDesc[DMA_RX] +// #define IFB_TxLastDesc IFB_LastDesc[DMA_TX] + +#endif // HCF_DMA +// +/************************************************************************************************/ +/********************************** EQUATES ***************************************************/ +/************************************************************************************************/ + + +// Hermes Command Codes and Qualifier bits +#define HCMD_BUSY 0x8000 // Busy bit, applicable for all commands +#define HCMD_INI 0x0000 // +#define HCMD_ENABLE HCF_CNTL_ENABLE // 0x0001 +#define HCMD_DISABLE HCF_CNTL_DISABLE // 0x0002 +#define HCMD_CONNECT HCF_CNTL_CONNECT // 0x0003 +#define HCMD_EXECUTE 0x0004 // +#define HCMD_DISCONNECT HCF_CNTL_DISCONNECT // 0x0005 +#define HCMD_SLEEP 0x0006 // +#define HCMD_CONTINUE HCF_CNTL_CONTINUE // 0x0007 +#define HCMD_RETRY 0x0100 // Retry bit +#define HCMD_ALLOC 0x000A // +#define HCMD_TX 0x000B // +#define HCMD_RECL 0x0100 // Reclaim bit, applicable for Tx and Inquire +#define HCMD_INQUIRE 0x0011 // +#define HCMD_ACCESS 0x0021 // +#define HCMD_ACCESS_WRITE 0x0100 // Write bit +#define HCMD_PROGRAM 0x0022 // +#define HCMD_READ_MIF 0x0030 +#define HCMD_WRITE_MIF 0x0031 +#define HCMD_THESEUS 0x0038 +#define HCMD_STARTPREAMBLE 0x0E00 // Start continuous preamble Tx +#define HCMD_STOP 0x0F00 // Stop Theseus test mode + + +//Configuration Management +// + +#define CFG_DRV_ACT_RANGES_PRI_3_BOTTOM 1 // Default Bottom Compatibility for Primary Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_PRI_3_TOP 1 // Default Top Compatibility for Primary Firmware - driver I/F + +#define CFG_DRV_ACT_RANGES_HSI_4_BOTTOM 1 // Default Bottom Compatibility for H/W - driver I/F +#define CFG_DRV_ACT_RANGES_HSI_4_TOP 1 // Default Top Compatibility for H/W - driver I/F + +#define CFG_DRV_ACT_RANGES_HSI_5_BOTTOM 1 // Default Bottom Compatibility for H/W - driver I/F +#define CFG_DRV_ACT_RANGES_HSI_5_TOP 1 // Default Top Compatibility for H/W - driver I/F + +#if (HCF_TYPE) & HCF_TYPE_WPA +#define CFG_DRV_ACT_RANGES_APF_1_BOTTOM 16 // Default Bottom Compatibility for AP Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_APF_1_TOP 16 // Default Top Compatibility for AP Firmware - driver I/F +#else //;? is this REALLY O.K. +#define CFG_DRV_ACT_RANGES_APF_1_BOTTOM 1 // Default Bottom Compatibility for AP Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_APF_1_TOP 1 // Default Top Compatibility for AP Firmware - driver I/F +#endif // HCF_TYPE_WPA + +#define CFG_DRV_ACT_RANGES_APF_2_BOTTOM 2 // Default Bottom Compatibility for AP Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_APF_2_TOP 2 // Default Top Compatibility for AP Firmware - driver I/F + +#define CFG_DRV_ACT_RANGES_APF_3_BOTTOM 1 // Default Bottom Compatibility for AP Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_APF_3_TOP 1 // Default Top Compatibility for AP Firmware - driver I/F + +#define CFG_DRV_ACT_RANGES_APF_4_BOTTOM 1 // Default Bottom Compatibility for AP Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_APF_4_TOP 1 // Default Top Compatibility for AP Firmware - driver I/F + +#if (HCF_TYPE) & HCF_TYPE_HII5 +#define CFG_DRV_ACT_RANGES_STA_2_BOTTOM 6 // Default Bottom Compatibility for Station Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_STA_2_TOP 6 // Default Top Compatibility for Station Firmware - driver I/F +#else // (HCF_TYPE) & HCF_TYPE_HII5 +#define CFG_DRV_ACT_RANGES_STA_2_BOTTOM 1 // Default Bottom Compatibility for Station Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_STA_2_TOP 2 // Default Top Compatibility for Station Firmware - driver I/F +#endif // (HCF_TYPE) & HCF_TYPE_HII5 + +#define CFG_DRV_ACT_RANGES_STA_3_BOTTOM 1 // Default Bottom Compatibility for Station Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_STA_3_TOP 1 // Default Top Compatibility for Station Firmware - driver I/F + +#define CFG_DRV_ACT_RANGES_STA_4_BOTTOM 1 // Default Bottom Compatibility for Station Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_STA_4_TOP 1 // Default Top Compatibility for Station Firmware - driver I/F + +//--------------------------------------------------------------------------------------------------------------------- +#if defined HCF_CFG_PRI_1_TOP || defined HCF_CFG_PRI_1_BOTTOM +err: PRI_1 not supported for H-I; // Compatibility for Primary Firmware - driver I/F +#endif // HCF_CFG_PRI_1_TOP / HCF_CFG_PRI_1_BOTTOM + +#if defined HCF_CFG_PRI_2_TOP || defined HCF_CFG_PRI_2_BOTTOM +err: PRI_2 not supported for H-I; // Compatibility for Primary Firmware - driver I/F +#endif // HCF_CFG_PRI_2_TOP / HCF_CFG_PRI_2_BOTTOM + +#ifdef HCF_CFG_PRI_3_TOP // Top Compatibility for Primary Firmware - driver I/F +#if HCF_CFG_PRI_3_TOP == 0 || \ + CFG_DRV_ACT_RANGES_PRI_3_BOTTOM <= HCF_CFG_PRI_3_TOP && HCF_CFG_PRI_3_TOP <= CFG_DRV_ACT_RANGES_PRI_3_TOP +#undef CFG_DRV_ACT_RANGES_PRI_3_TOP +#define CFG_DRV_ACT_RANGES_PRI_3_TOP HCF_CFG_PRI_3_TOP +#else +err: ; +#endif +#endif // HCF_CFG_PRI_3_TOP + +#ifdef HCF_CFG_PRI_3_BOTTOM // Bottom Compatibility for Primary Firmware - driver I/F +#if CFG_DRV_ACT_RANGES_PRI_3_BOTTOM <= HCF_CFG_PRI_3_BOTTOM && HCF_CFG_PRI_3_BOTTOM <= CFG_DRV_ACT_RANGES_PRI_3_TOP +#undef CFG_DRV_ACT_RANGES_PRI_3_BOTTOM +#define CFG_DRV_ACT_RANGES_PRI_3_BOTTOM HCF_CFG_PRI_3_BOTTOM +#else +err: ; +#endif +#endif // HCF_CFG_PRI_3_BOTTOM + + +//--------------------------------------------------------------------------------------------------------------------- +#if defined HCF_CFG_HSI_0_TOP || defined HCF_CFG_HSI_0_BOTTOM +err: HSI_0 not supported for H-I; // Compatibility for HSI I/F +#endif // HCF_CFG_HSI_0_TOP / HCF_CFG_HSI_0_BOTTOM + +#if defined HCF_CFG_HSI_1_TOP || defined HCF_CFG_HSI_1_BOTTOM +err: HSI_1 not supported for H-I; // Compatibility for HSI I/F +#endif // HCF_CFG_HSI_1_TOP / HCF_CFG_HSI_1_BOTTOM + +#if defined HCF_CFG_HSI_2_TOP || defined HCF_CFG_HSI_2_BOTTOM +err: HSI_2 not supported for H-I; // Compatibility for HSI I/F +#endif // HCF_CFG_HSI_2_TOP / HCF_CFG_HSI_2_BOTTOM + +#if defined HCF_CFG_HSI_3_TOP || defined HCF_CFG_HSI_3_BOTTOM +err: HSI_3 not supported for H-I; // Compatibility for HSI I/F +#endif // HCF_CFG_HSI_3_TOP / HCF_CFG_HSI_3_BOTTOM + +#ifdef HCF_CFG_HSI_4_TOP // Top Compatibility for HSI I/F +#if HCF_CFG_HSI_4_TOP == 0 || \ + CFG_DRV_ACT_RANGES_HSI_4_BOTTOM <= CF_CFG_HSI_4_TOP && HCF_CFG_HSI_4_TOP <= CFG_DRV_ACT_RANGES_HSI_4_TOP +#undef CFG_DRV_ACT_RANGES_HSI_4_TOP +#define CFG_DRV_ACT_RANGES_HSI_4_TOP HCF_CFG_HSI_4_TOP +#else +err: ; +#endif +#endif // HCF_CFG_HSI_4_TOP + +#ifdef HCF_CFG_HSI_4_BOTTOM // Bottom Compatibility for HSI I/F +#if CFG_DRV_ACT_RANGES_HSI_4_BOTTOM <= HCF_CFG_HSI_4_BOTTOM && HCF_CFG_HSI_4_BOTTOM <= CFG_DRV_ACT_RANGES_HSI_4_TOP +#undef CFG_DRV_ACT_RANGES_HSI_4_BOTTOM +#define CFG_DRV_ACT_RANGES_HSI_4_BOTTOM HCF_CFG_HSI_4_BOTTOM +#else +err: ; +#endif +#endif // HCF_CFG_HSI_4_BOTTOM + +#ifdef HCF_CFG_HSI_5_TOP // Top Compatibility for HSI I/F +#if HCF_CFG_HSI_5_TOP == 0 || \ + CFG_DRV_ACT_RANGES_HSI_5_BOTTOM <= CF_CFG_HSI_5_TOP && HCF_CFG_HSI_5_TOP <= CFG_DRV_ACT_RANGES_HSI_5_TOP +#undef CFG_DRV_ACT_RANGES_HSI_5_TOP +#define CFG_DRV_ACT_RANGES_HSI_5_TOP HCF_CFG_HSI_5_TOP +#else +err: ; +#endif +#endif // HCF_CFG_HSI_5_TOP + +#ifdef HCF_CFG_HSI_5_BOTTOM // Bottom Compatibility for HSI I/F +#if CFG_DRV_ACT_RANGES_HSI_5_BOTTOM <= HCF_CFG_HSI_5_BOTTOM && HCF_CFG_HSI_5_BOTTOM <= CFG_DRV_ACT_RANGES_HSI_5_TOP +#undef CFG_DRV_ACT_RANGES_HSI_5_BOTTOM +#define CFG_DRV_ACT_RANGES_HSI_5_BOTTOM HCF_CFG_HSI_5_BOTTOM +#else +err: ; +#endif +#endif // HCF_CFG_HSI_5_BOTTOM +//--------------------------------------------------------------------------------------------------------------------- +#if defined HCF_CFG_APF_1_TOP || defined HCF_CFG_APF_1_BOTTOM +err: APF_1 not supported for H-I; // Compatibility for AP Firmware - driver I/F +#endif // HCF_CFG_APF_1_TOP / HCF_CFG_APF_1_BOTTOM + +#ifdef HCF_CFG_APF_2_TOP // Top Compatibility for AP Firmware - driver I/F +#if HCF_CFG_APF_2_TOP == 0 || \ + CFG_DRV_ACT_RANGES_APF_2_BOTTOM <= HCF_CFG_APF_2_TOP && HCF_CFG_APF_2_TOP <= CFG_DRV_ACT_RANGES_APF_2_TOP +#undef CFG_DRV_ACT_RANGES_APF_2_TOP +#define CFG_DRV_ACT_RANGES_APF_2_TOP HCF_CFG_APF_2_TOP +#else +err: ; +#endif +#endif // HCF_CFG_APF_TOP + +#ifdef HCF_CFG_APF_2_BOTTOM // Bottom Compatibility for AP Firmware - driver I/F +#if CFG_DRV_ACT_RANGES_APF_2_BOTTOM <= HCF_CFG_APF_2_BOTTOM && HCF_CFG_APF_2_BOTTOM <= CFG_DRV_ACT_RANGES_APF_2_TOP +#undef CFG_DRV_ACT_RANGES_APF_2_BOTTOM +#define CFG_DRV_ACT_RANGES_APF_2_BOTTOM HCF_CFG_APF_2_BOTTOM +#else +err: ; +#endif +#endif // HCF_CFG_APF_BOTTOM + +//--------------------------------------------------------------------------------------------------------------------- +#if defined HCF_CFG_STA_1_TOP || defined HCF_CFG_STA_1_BOTTOM +err: STA_1 not supported for H-I; // Compatibility for Station Firmware - driver I/F +#endif // HCF_CFG_STA_1_TOP / HCF_CFG_STA_1_BOTTOM + +#ifdef HCF_CFG_STA_2_TOP // Top Compatibility for Station Firmware - driver I/F +#if HCF_CFG_STA_2_TOP == 0 || \ + CFG_DRV_ACT_RANGES_STA_2_BOTTOM <= HCF_CFG_STA_2_TOP && HCF_CFG_STA_2_TOP <= CFG_DRV_ACT_RANGES_STA_2_TOP +#undef CFG_DRV_ACT_RANGES_STA_2_TOP +#define CFG_DRV_ACT_RANGES_STA_2_TOP HCF_CFG_STA_2_TOP +#else +err: ; +#endif +#endif // HCF_CFG_STA_TOP + +#ifdef HCF_CFG_STA_2_BOTTOM // Bottom Compatibility for Station Firmware - driver I/F +#if CFG_DRV_ACT_RANGES_STA_2_BOTTOM <= HCF_CFG_STA_2_BOTTOM && HCF_CFG_STA_2_BOTTOM <= CFG_DRV_ACT_RANGES_STA_2_TOP +#undef CFG_DRV_ACT_RANGES_STA_2_BOTTOM +#define CFG_DRV_ACT_RANGES_STA_2_BOTTOM HCF_CFG_STA_2_BOTTOM +#else +err: ; +#endif +#endif // HCF_CFG_STA_BOTTOM + + +/************************************************************************************************/ +/************************************** MACROS ************************************************/ +/************************************************************************************************/ + +/* min and max macros */ +#if ! defined max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif +#if ! defined min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif + +#ifdef HCF_SLEEP +#if defined MSF_WAIT +err: MSF should no longer supply this macro; +#else +#define MSF_WAIT(x) \ + { PROT_CNT_INI \ + HCF_WAIT_WHILE( ( IPW( HREG_IO ) & HREG_IO_WOKEN_UP ) == 0 ); \ + HCFASSERT( prot_cnt, IPW( HREG_IO ) ) \ + } +#endif // MSF_WAIT +#else +#define MSF_WAIT(x) /*NOP*/ +#endif // HCF_SLEEP + +#define LOF(x) (sizeof(x)/sizeof(hcf_16)-1) + +#define MUL_BY_2( x ) ( (x) << 1 ) //used to multiply by 2 +#define DIV_BY_2( x ) ( (x) >> 1 ) //used to divide by 2 + +//resolve problems on for some 16 bits compilers to create 32 bit values +#define MERGE_2( hw, lw ) ( ( ((hcf_32)(hw)) << 16 ) | ((hcf_16)(lw)) ) + +#if ! defined HCF_STATIC +#define HCF_STATIC static +#endif // HCF_STATIC + +#if ( (HCF_TYPE) & HCF_TYPE_HII5 ) == 0 +#define DAWA_ACK( mask) { \ + OPW( HREG_EV_ACK, mask | HREG_EV_ACK_REG_READY ); \ + OPW( HREG_EV_ACK, (mask & ~HREG_EV_ALLOC) | HREG_EV_ACK_REG_READY ); } +#define DAWA_ZERO_FID(reg) OPW( reg, 0 ); +#else +#define DAWA_ACK( mask) OPW( HREG_EV_ACK, mask ); +#define DAWA_ZERO_FID(reg) +#endif // HCF_TYPE_HII5 + +#if (HCF_TYPE) & HCF_TYPE_WPA +#define CALC_RX_MIC( p, len ) calc_mic_rx_frag( ifbp, p, len ) +#define CALC_TX_MIC( p, len ) calc_mic_tx_frag( ifbp, p, len ) +#define IF_SSN(x) x +#define IF_NOT_SSN(x) +#else +#define CALC_RX_MIC( p, len ) +#define CALC_TX_MIC( p, len ) +#define MIC_RX_RTN( mic, dw ) +#define MIC_TX_RTN( mic, dw ) +#define IF_SSN(x) +#define IF_NOT_SSN(x) x +#endif // HCF_TYPE_WPA + +#if HCF_TALLIES & HCF_TALLIES_HCF //HCF tally support +#define IF_TALLY(x) x +#else +#define IF_TALLY(x) +#endif // HCF_TALLIES_HCF + + +#if HCF_DMA +#define IF_DMA(x) x +#define IF_NOT_DMA(x) +#define IF_USE_DMA(x) if ( ifbp->IFB_CntlOpt & USE_DMA ) x +#define IF_NOT_USE_DMA(x) if ( !(ifbp->IFB_CntlOpt & USE_DMA) ) x +#else +#define IF_DMA(x) +#define IF_NOT_DMA(x) x +#define IF_USE_DMA(x) +#define IF_NOT_USE_DMA(x) x +#endif // HCF_DMA + + +#define IPW(x) ((hcf_16)IN_PORT_WORD( ifbp->IFB_IOBase + (x) ) ) +#define OPW(x, y) OUT_PORT_WORD( ifbp->IFB_IOBase + (x), y ) + /* make sure the implementation of HCF_WAIT_WHILE is such that there may be multiple HCF_WAIT_WHILE calls + * in a row and that when one fails all subsequent fail immediately without reinitialization of prot_cnt + */ +#if HCF_PROT_TIME == 0 +#define PROT_CNT_INI +#define IF_PROT_TIME(x) +#if defined HCF_YIELD +#define HCF_WAIT_WHILE( x ) while ( (x) && (HCF_YIELD) ) /*NOP*/; +#else +#define HCF_WAIT_WHILE( x ) while ( x ) /*NOP*/; +#endif // HCF_YIELD +#else +#define PROT_CNT_INI hcf_32 prot_cnt = ifbp->IFB_TickIni; +#define IF_PROT_TIME(x) x +#if defined HCF_YIELD +#define HCF_WAIT_WHILE( x ) while ( prot_cnt && (x) && (HCF_YIELD) ) prot_cnt--; +#else +#include +#define HCF_WAIT_WHILE( x ) while ( prot_cnt && (x) ) { udelay(2); prot_cnt--; } +#endif // HCF_YIELD +#endif // HCF_PROT_TIME + +#if defined HCF_EX_INT +//#if HCF_EX_INT & ~( HCF_EX_INT_TX_EX | HCF_EX_INT_TX_OK | HCF_EX_INT_TICK ) +;? out dated checking +err: you used an invalid bitmask; +// #endif // HCF_EX_INT validation +// #else +// #define HCF_EX_INT 0x000 +#endif // HCF_EX_INT + +#if 0 //get compiler going +#if HCF_EX_INT_TICK != HREG_EV_TICK +;? out dated checking +err: someone redefined these macros while the implemenation assumes they are equal; +#endif +#if HCF_EX_INT_TX_OK != HFS_TX_CNTL_TX_OK || HFS_TX_CNTL_TX_OK != HREG_EV_TX_OK +;? out dated checking +err: someone redefined these macros while the implemenation assumes they are equal; +#endif +#if HCF_EX_INT_TX_EX != HFS_TX_CNTL_TX_EX || HFS_TX_CNTL_TX_EX != HREG_EV_TX_EX +;? out dated checking +err: someone redefined these macros while the implemenation assumes they are equal; +#endif +#endif // 0 get compiler going + + +/* The assert in HCFLOGENTRY checks against re-entrancy. Re-entrancy could be caused by MSF logic at + * task-level calling hcf_functions without shielding with HCF_ACT_ON/_OFF. When an interrupt occurs, + * the ISR could (either directly or indirectly) cause re-entering of the interrupted HCF-routine. + * + * The "(ifbp->IFB_AssertWhere = where)" test in HCFLOGENTRY services ALSO as a statement to get around: + * #pragma warning: conditional expression is constant + * on the if-statement + */ +#if HCF_ASSERT +#define HCFASSERT(x,q) {if (!(x)) {mdd_assert( ifbp, __LINE__ , q );}} +#define MMDASSERT(x,q) {if (!(x)) {mdd_assert( assert_ifbp, __LINE__ + FILE_NAME_OFFSET, q );}} + +#define HCFLOGENTRY( where, what ) \ +{if ( (ifbp->IFB_AssertWhere = where) <= 15 ) { \ + HCF_ENTRY( ifbp ); \ + HCFASSERT( (ifbp->IFB_AssertTrace & 1<<((where)&0xF)) == 0, ifbp->IFB_AssertTrace ); \ + ifbp->IFB_AssertTrace |= 1<<((where)&0xF); \ + } \ +HCFTRACE(ifbp, where ) \ +HCFTRACEVALUE(ifbp, what ) \ +} + +#define HCFLOGEXIT( where ) \ +{if ( (ifbp->IFB_AssertWhere = where) <= 15 ) { \ + HCF_EXIT( ifbp ); \ + ifbp->IFB_AssertTrace &= ~(1<<((where)&0xF)); \ + } \ +HCFTRACE(ifbp, (where)|HCF_TRACE_EXIT ) \ +} + +#else // HCF_ASSERT +#define HCFASSERT( x, q ) +#define MMDASSERT( x, q ) +#define HCFLOGENTRY( where, what ) {HCF_ENTRY( ifbp );} +#define HCFLOGEXIT( where ) {HCF_EXIT( ifbp );} +#endif // HCF_ASSERT + +#if HCF_INT_ON +/* ;? HCFASSERT_INT + * #if (HCF_SLEEP) & HCF_DDS + * #define HCFASSERT_INT HCFASSERT( ifbp->IFB_IntOffCnt != 0xFFFF && ifbp->IFB_IntOffCnt != 0xFFFE, \ + * ifbp->IFB_IntOffCnt ) + * #else + */ +#define HCFASSERT_INT HCFASSERT( ifbp->IFB_IntOffCnt != 0xFFFF, ifbp->IFB_IntOffCnt ) +// #endif // HCF_DDS +#else +#define HCFASSERT_INT +#endif // HCF_INT_ON + + +#if defined HCF_TRACE +#define HCFTRACE(ifbp, where ) {OPW( HREG_SW_1, where );} +//#define HCFTRACE(ifbp, where ) {HCFASSERT( DO_ASSERT, where );} +#define HCFTRACEVALUE(ifbp, what ) {OPW( HREG_SW_2, what );} +//#define HCFTRACEVALUE(ifbp, what ) {HCFASSERT( DO_ASSERT, what );} +#else +#define HCFTRACE(ifbp, where ) +#define HCFTRACEVALUE(ifbp, what ) +#endif // HCF_TRACE + + +#if HCF_BIG_ENDIAN +#define BE_PAR(x) ,x +#else +#define BE_PAR(x) +#endif // HCF_BIG_ENDIAN + +/************************************************************************************************/ +/************************************** END OF MACROS *****************************************/ +/************************************************************************************************/ + +/************************************************************************************************/ +/*************************************** PROTOTYPES *******************************************/ +/************************************************************************************************/ + +#if HCF_ASSERT +extern IFBP BASED assert_ifbp; //to make asserts easily work under MMD and DHF +EXTERN_C void mdd_assert (IFBP ifbp, unsigned int line_number, hcf_32 q ); +#endif //HCF_ASSERT + +#if ! ( (HCF_IO) & HCF_IO_32BITS ) // defined 16 bits only +#undef OUT_PORT_STRING_32 +#undef IN_PORT_STRING_32 +#endif // HCF_IO +#endif //HCFDEFC_H + diff --git a/drivers/staging/wlags49_h2/man/wlags49.4 b/drivers/staging/wlags49_h2/man/wlags49.4 new file mode 100644 index 000000000000..a34588530740 --- /dev/null +++ b/drivers/staging/wlags49_h2/man/wlags49.4 @@ -0,0 +1,734 @@ +.\" vim:tw=78: +.\" Copyright (c) 1999-2003 Agere Systems Inc. -- http://www.agere.com +.\" wlags49.4 7.20-abg 04/28/2004 13:30:00 +.\" +.TH WLAGS49 4 "04/28/2004 13:30:00" "pcmcia-cs" +.SH NAME +wlags49 \- Agere Systems Wireless PC Card / PCI device drivers + +wlags49_h2_cs.o \- Hermes-II Card Services (PCMCIA/CF) driver +.br +wlags49_h2.o \- Hermes-II MiniPCI driver +.br +wlags49_h25.o \- Hermes-II.5 PCI/CardBus driver +.br +wlags49_h25_cs.o\- Hermes-II.5 Card Services (PCMCIA/CF) driver + +.SH SYNOPSIS +.nh +.fi +.B insmod wlags49_[h1,h2]_[cs].o +.br +.RB [ Authentication=n ] +.RB [ AuthKeyMngmtSuite=???? ] +.RB [ BRSC2GHz=b ]\p +.RB [ BRSC5GHz=b ] +.RB [ Coexistence=n ] +.RB [ Configured=???? ]\p +.RB [ ConnectionControl=???? ] +.RB [ CreateIBSS=s ] +.RB [ DebugFlag=n ]\p +.RB [ DesiredSSID=s ] +.RB [ DownloadFirmware=n ] +.RB [ DriverEnable=???? ]\p +.RB [ EnableEncryption=s ] +.RB [ Encryption=???? ] +.RB [ ExcludeUnencrypted=s ]\p +.RB [ IntraBSSRelay=s ] +.RB [ IrqList=i,j,... ] +.RB [ IrqMask=n ]\p +.RB [ Key1=s ] +.RB [ Key2=s ] +.RB [ Key3=s ] +.RB [ Key4=s ]\p +.RB [ LoadBalancing=s ] +.RB [ MaxSleepDuration=n ] +.RB [ MediumDistribution=s ]\p +.RB [ MicroWaveRobustness=s ] +.RB [ MulticastPMBuffering=s ] +.RB [ MulticastRate=n ]\p +.RB [ MulticastReceive=s ] +.RB [ NetworkAddress=n,n,n,n,n,n ] +.RB [ NetworkType=???? ]\p +.RB [ OwnATIMWindow=n ] +.RB [ OwnBeaconInterval=n ] +.RB [ OwnChannel=n ]\p +.RB [ OwnDTIMPeriod=n ] +.RB [ OwnName=s ] +.RB [ OwnSSID=s ]\p +.RB [ pc_debug=n ] +.RB [ PMEnabled=b ] +.RB [ PMHoldoverDuration=n ]\p +.RB [ PortType=n ] +.RB [ PowerMode=???? ] +.RB [ PromiscuousMode=s ]\p +.RB [ RejectANY=s ] +.RB [ RTSThreshold=n ]\p +.RB [ RTSThreshold1=n ] +.RB [ RTSThreshold2=n ] +.RB [ RTSThreshold3=n ]\p +.RB [ RTSThreshold4=n ] +.RB [ RTSThreshold5=n ] +.RB [ RTSThreshold6=n ]\p +.RB [ SRSC2GHz=b ] +.RB [ SRSC5GHz=b ] +.RB [ SystemScale=n ]\p +.RB [ TxKey=n ] +.RB [ TxRateControl=n ]\p +.RB [ TxRateControl1=n ] +.RB [ TxRateControl2=n ] +.RB [ TxRateControl3=n ]\p +.RB [ TxRateControl4=n ] +.RB [ TxRateControl5=n ] +.RB [ TxRateControl6=n ]\p +.RB [ WDSAddress=n,n,n,n,n,n ]\p +.RB [ WDSAddress1=n,n,n,n,n,n ] +.RB [ WDSAddress2=n,n,n,n,n,n ]\p +.RB [ WDSAddress3=n,n,n,n,n,n ] +.RB [ WDSAddress4=n,n,n,n,n,n ]\p +.RB [ WDSAddress5=n,n,n,n,n,n ] +.RB [ WDSAddress6=n,n,n,n,n,n ]\p +.fi + + + +.SH DESCRIPTION +.I wlags49 +is the low-level Card Services / PCI driver for the +.B Wireless PC Card, Wireless Integrated Card, Wireless Embedded Card +and other wireless adapters based on the Agere Systems Hermes-II, and Hermes-II.5 wireless MAC. When this driver is attached to a card, it +allocates the next available ethernet device (eth0..eth#). This +device name will be passed on to +.IR cardmgr (8), +or the PCI subsystem, for the card configuration, and reported in the kernel log file +with the I/O base address and MAC address used by the card. +.SH FEATURES + \- Hot plug/unplug + \- Access Point and peer-to-peer communication + \- Card power management + \- Support for Hermes-II & Hermes-II.5 based PCMCIA, Mini PCI, and CardBus cards + \- Wired Equivalent Privacy (WEP) + \- WPA-PSK support (EXPERIMENTAL) + \- Driver utility interface (UIL) + \- Wireless Extensions + \- Software AP mode +.SH PARAMETERS +.TP +.B Authentication=n +Algorithm used for Authentication. +.BR + 1 \- Open System +.BR + 2 \- Shared Key +.BR + Default: 1 +.TP +.B Auth_key_mgmt_suite +??????????????? +.TP +.B BRSC2GHz=b +Sets the card\'s Basic Rate Set in the 2.4GHz band. See SRSC2GHz +for the value\'s format. +.BR + Default: 15 (or 0x000F, only 11b rates to accept legacy 11b stations) +.TP +.B BRSC5GHz-b +Sets the card\'s Basic Rate Set in the 5.0GHz band. See SRSC2GHz for the +value\'s format +.BR + Default: 4080 (or 0x0FF0, all 11a rates) +.TP +.B Coexistence=n +Used to make the 802.11a/b/g coexistence behavior more strict. +.BR + Default \- 0 (Use standard behavior) +.TP +.B ConnectionControl=n +Configures the card\'s connection control process in dealing with multiple +bands (802.11b/g vs. 802.11a). +.BR + 0 \- Single Band operation in 2GHz +.BR + 1 \- Single Band operation in 5GHz +.BR + 2 \- Multiple Band operation starting with 2GHz +.BR + 3 \- Multiple Band operation starting with 5GHz +.BR + Default \- 2 +.TP +.B Configured +??????????????? +.TP +.B ConnectionControl +??????????????? +.TP +.B CreateIBSS=s +Enable or disable IBSS Creation. +For correct operation, specification of a OwnSSID is required. +This mode requires firmware 6.04 or higher. +.BR + N \- Disable +.BR + Y \- Enable +.BR + Default: N +.TP +.B DebugFlag=n +Selects the driver debugging level. This parameter is only available +if the module is compiled with debugging enabled. Refer to the +file +.B debug.h +in the source directory for information on the flag values. +.BR + 0x00000001L \- DBG_ERROR_ON +.BR + 0x00000002L \- DBG_WARNING_ON +.BR + 0x00000004L \- DBG_NOTICE_ON +.BR + 0x00000008L \- DBG_TRACE_ON +.BR + 0x00000010L \- DBG_VERBOSE_ON +.BR + 0x00000020L \- DBG_PARAM_ON +.BR + 0x00000040L \- DBG_BREAK_ON +.BR + 0x00000100L \- DBG_RX_ON +.BR + 0x00000200L \- DBG_TX_ON +.BR + 0x00000400L \- DBG_DS_ON +.BR +If the module is compiled with debugging enabled, DebugFlag +defaults to DBG_ERROR_ON, DBG_WARNING_ON and DBG_BREAK_ON. +DebugFlag overrules pc_debug. +.TP +.B DesiredSSID=s +Same as OwnSSID. +.TP +.B DownloadFirmware=n +This release of the driver introduces the ability to perform downloads of the STA/AP +firmware. In fact, this is required for Hermes-II based cards. This parameter tells +the driver which version of the firmware to download to the card. +.BR + 0 \- No download performed (Hermes-I only) +.BR + 1 \- Download STA firmware +.BR + 2 \- Download AP firmware +.BR + Default: 1, when STA mode functionality is + included in the build + 2, when code is built exclusively for + AP mode +.TP +.B DriverEnable +??????????????? +.TP +.B EnableEncryption=n +Set the method of Data encryption. +.BR + 0 \- Disable +.BR + 1 \- Enable WEP Encryption +.BR + 2 \- Enable WPA with TKIP encryption +.BR + Default: 0 +.TP +.B Encryption +??????????????? +.TP +.B ExcludeUnencrypted=s +Controls how the stations must communicate with the AP. +.BR + Y \- Stations must enable encryption and provide + the proper encryption key to communicate + with the AP. +.BR + N \- Stations do not need to enable encryption + to communicate with the AP. +.BR + Default: N +.TP +.B IntraBSSRelay=s +Controls the automatic relay of received messages that are destined for other +stations in the BSS. +.BR + Y \- Messages are relayed to the appropriate + station(s). +.BR + N \- Messages are passed up to the host. +.BR + Default: Y +.TP +.B IrqList=i,j,... +Specifies the set of interrupts (up to 4) that may be allocated by +this driver. This overrides the values set in the +.B IrqMask +parameter. NOTE: This parameter is for PCMCIA only. +.TP +.B IrqMask=n +Specifies a mask of valid interrupts that may be allocated by this driver. +If +.B IrqList +is also specified, the values in +.B IrqList +are used instead. NOTE: This parameter is for PCMCIA only. +.BR + Default: 0xdeb8 (IRQ 3,4,5,7,9,10,11,12,14,15) +.TP +.B Key1=s +Specifies one of 4 possible keys for the Data encryption. +One of these keys, identified by TxKey, +is used for the enciphering of Data that is transmitted by this station. +All keys specified can be used for the deciphering of Data that is received. +.BR +The key value can be an ASCII character string or a hexadecimal value. +The length of the key value can be 5 characters or 10 hexadecimal digits for +the standard encryption (Silver or Gold card), or 13 characters or 26 +hexadecimal digits for the encryption with extended keys (Gold card only). +The keys defined in the station must match the keys defined in the access +points; both on value and number (1 through 4). +.BR +In 2.0 series Linux kernel modules, values that begin with a number are +considered integers. In this case a hexadecimal value string or a character +string starting with a number, will need to be surrounded by escaped +double quotes (ie. Key1=\\"0x1122334455\\" Key2=\\"12xyz\\"). +.BR + 5 or 13, printable character string, or +.BR + 10 or 26 hex digits if preceded by "0x". +.BR + If this parameter is omitted, the default of the MAC is used ( = 0-length). +.TP +.B Key2=s +Same as Key1. +.TP +.B Key3=s +Same as Key1. +.TP +.B Key4=s +Same as Key1. +.TP +.B LoadBalancing=s +Control for the Load Balancing algorithm for both STAs and APs. The AP +includes a load balancing element in the Probe Response and Beacon frames. +The STA uses this info to select an AP, not only based on comms quality, but +also on the load of that AP. +.BR + Default: Y +.TP +.B MaxDataLength +??????????????? +.TP +.B MaxSleepDuration=n +Set the maximum Power Management sleep duration in milliseconds. +Valid values are 0 to 65535 milliseconds. +.BR + Default: 100 +.TP +.B MediumDistribution=s +Control for the distribution of medium parameters, like communication +thresholds, microwave robustness, RTS/CTS thresholds, by APs. The associated +stations replace their own values with the received values. +.BR + Default=Y +.TP +.B MicroWaveRobustness=s +Enable or disable Microwave Oven Robustness. +.BR + N \- Disable +.BR + Y \- Enable +.BR + Default: N +.TP +.B MulticastPMBuffering=s +Controls buffering of multicast MAC frames for transmission after DTIM. If no, +multicast MAC frames are directly placed in the output queue. +.BR + Default: Y +.TP +.B MulticastRate=n +Sets the data rate for multicast message transmission. +.BR + 1 \- Fixed 1Mb/s + 2 \- Fixed 2Mb/s + 3 \- Fixed 5.5Mb/s + 4 \- Fixed 11Mb/s +.BR + Default: 2 + +For Hermes-II.5, an INTEGER CONVERTED bit mask representing the +rate to multicast, where the rates supported are as follows: + +Bit : 15|14|13|12|11|10|09|08|07|06|05|04|03|02|01|00 +.br +------------------------------------------------------ +.br +Rate : XX|XX|XX|XX|54|48|36|24|18|12| 9| 6|11|5.5|2| 1 + + Default: 4 (Translates to 0x0004 = 5.5 Mb/sec) + +.TP +.B MulticastReceive=s +Enable or disable receiving of all multicast packets when Card Power Management +is enabled. When enabled, the station will wake up frequently +to receive the multicast frames. This causes less optimal power savings. +.BR + N \- Disable +.BR + Y \- Enable +.BR + Default: Y +.TP +.B NetworkAddress=n,n,n,n,n,n +Sets the adapter hardware ethernet address (MAC address) to the value +specified. Note that this is to be used to specify a Local MAC address. Do +not specify this parameter if the card\'s universal address is to be used. +Valid values are six hexadecimal digit-pairs (prefixed with 0x). +.BR + Default: +.TP +.B NetworkType +??????????????? +.TP +.B OwnATIMWindow=n +ATIM window time used for creating an IBSS. +.BR + Range: 0..100 +.BR + Default: 0 +.TP +.B OwnBeaconInterval=b +Beacon Interval in TU +.BR + Range 20..200 +.BR + Default \- 100 +.TP +.B channel=n +Same as OwnChannel. +.TP +.B OwnChannel=n +Sets the channel the Ad-Hoc or IBSS mode will use. +The default channel for Ad-Hoc mode is determined by the Wireless PC Card. +The default channel for IBSS is set to 10 by the driver. +This value has no effect when the adapter is used with an Access Point +(BSS network) since the Access Point automatically determines the channel. +Valid values are 0 to 14. However the channels allowed in +your region are subject to local regulations and are limited at +manufacturing time of the Wireless PC Card. When the provided value is +not allowed, the value remains unchanged. +.BR + 0 \- Use default channel +.BR + Default: 0 +.TP +.B OwnDTIMPeriod=n +The number of beacon intervals between successive Delivery Traffic Identification +Maps (DTIMs). +.BR + Range: 1..65535 +.BR + Default: 1 +.TP +.B OwnName=s +Sets the station name to the specified string value. This parameter +is used for diagnostic purposes, as a user\-friendly identification +of this system. This parameter accepts a maximum of 32 characters. +.BR + Default: Linux +.TP +.B OwnSSID=s +Sets the card network name to the specified string value. This parameter +accepts a maximum of 32 characters. Whitespace in the network name +will need to be escaped with a backslash (ie. OwnSSID=My\\ Network). +.BR + Default: ANY +.TP +.B pc_debug=n +Selects the PCMCIA debugging level. This parameter is only available +if the module is compiled with debugging enabled. A non\-zero value +enables debugging. Higher values yield more information, i.e. for any value all +lower values are implied. +.BR + 8 \- DBG_DS_ON +.BR + 7 \- DBG_RX_ON | DBG_TX_ON +.BR + 6 \- DBG_PARAM_ON +.BR + 5 \- DBG_TRACE_ON +.BR + 4 \- DBG_VERBOSE_ON +.BR +If the module is compiled with debugging enabled, pc_debug defaults to 5. +DebugFlag overrules pc_debug. +.BR +The name pc_debug rather than PcDebug, since pc_debug is used by many PCMCIA driver. +.TP +.B PMEnabled=b +Sets the card\'s Power Management state. +.BR + 0 \- Disable +.BR + 1 \- Enable Enhanced Mode +.BR + 2 \- Enabled Standard Mode +.BR + 0x8000 \- Enhanced?????? Mode (to be combined with 0x0001 or 0x0002) + + Default: 0 (Disabled) +.TP +.B PMHoldoverDuration=n +Time that the station remains in an awake state after a MAC frame transfer if +Enhanced Power Save is active. +.BR + Range: 1..1000 +.BR + Default: 100 +.TP +.B PowerMode +??????????????? +.TP +.B PortType=n +Selects the type of network operation. +.BR + 1 \- Normal Operation (BSS or IBSS) +.BR + 3 \- Ad-Hoc Demo Mode +.BR + Default: 1 +.TP +.B PromiscuousMode=s +Switch for promiscuous mode reception. +.BR + Default: N +.TP +.B RejectANY=s +Controls how stations associate to the device. +.BR + Y \- Stations must provide the correct SSID to + associate to the AP. +.BR + N \- Stations are not required to provide the + correct SSID to associate to the AP. + Known as an \'open\' network. +.BR + Default - N +.TP +.B RTSThreshold=n +Controls the RTS/CTS handshake threshold for transmissions in Station mode. +Valid values are 0 to 2347. +.BR + 500 \- Hidden Stations +.BR + 2347 \- No RTS/CTS +.BR + Default: 2347 +.TP +.B RTSThreshold1=n +Same as RTSThreshold, only for port 1 of in AccessPoint mode. +.TP +.B RTSThreshold2=n +Same as RTSThreshold1, only for port 2. +.TP +.B RTSThreshold3=n +Same as RTSThreshold1, only for port 3. +.TP +.B RTSThreshold4=n +Same as RTSThreshold1, only for port 4. +.TP +.B RTSThreshold5=n +Same as RTSThreshold1, only for port 5. +.TP +.B RTSThreshold6=n +Same as RTSThreshold1, only for port 6. +.TP +.B SRSC2GHz=b +Sets the card\'s Supported Rate Set in the 2.4GHz band. The value +is an INTEGER CONVERTED bit mask representing the rates to support, +where the rates supported are as follows: + +Bit : 15|14|13|12|11|10|09|08|07|06|05|04|03|02|01|00 +.br +------------------------------------------------------ +.br +Rate : XX|XX|XX|XX|54|48|36|24|18|12| 9| 6|11|5.5|2| 1 +.BR + Default: 4095 (or 0x0FFF, all 11b and 11g rates) +.TP +.B SRSC5GHz=b +Sets the card\'s Supported Rate Set in the 5.0GHz band. See SRSC2GHz +for the value\'s format. +.BR + Default: 4080 (or 0x0FF0, all 11a rates) +.TP +.B SystemScale=n +Sets the distance between Access Points in the network. This value +influences the Modem Thresholds (EnergyDetectThreshold, +CarrierDetectThreshold and DeferThreshold) and +the Roaming Thresholds (CellSearchThreshold and OutOfRangeThreshold). +.BR + 1 \- Large +.BR + 2 \- Medium +.BR + 3 \- Small +.BR + Default: 1 +.TP +.B TxRateControl=n +Sets the data rate to be used by the transmitter. For Hermes-II: +.BR + 1 \- Fixed Low (1 Mb/sec) +.BR + 2 \- Fixed Standard (2 Mb/sec) +.BR + 3 \- Auto Rate Select High (11, 5.5, 2, 1 Mb/sec) +.BR + 4 \- Fixed Medium (5.5 Mb/sec) +.BR + 5 \- Fixed High (11 Mb/sec) +.BR + 6 \- Auto Rate Select Standard (2, 1 Mb/sec) +.BR + 7 \- Auto Rate Select Medium (5.5, 2, 1 Mb/sec) +.BR + Default: 3 + +For Hermes-II.5, an INTEGER CONVERTED bit mask representing all of the +rates to support, where the rates supported are as follows: + +Bit : 15|14|13|12|11|10|09|08|07|06|05|04|03|02|01|00 +.br +------------------------------------------------------ +.br +Rate : XX|XX|XX|XX|54|48|36|24|18|12| 9| 6|11|5.5|2| 1 +.BR + Default: 4095 (Translates to 0xFFF, which is all rates) +.TP +.B RTSThreshold=n +Sets the number of octets in a message or fragment above which a +RTS/CTS handshake is performed. +Valid values are 0 to 2347. +.BR + 500 \- Hidden Stations +.BR + 2347 \- No RTS/CTS +.BR + Default: 2347 +.TP +.B TxKey=n +Designates which of the keys is to be used for the enciphering of data that is +transmitted by this station. +.BR + Integer in the range 1..4. +.BR + Default: 1 +.TP +.B TxPowLevel +??????????????? +.TP +.B TxRateControl=n +Sets the data rate to be used by the transmitter in Station mode. +.BR + 1 \- Fixed Low +.BR + 2 \- Fixed Standard +.BR + 3 \- Auto Rate Select (High) +.BR + 4 \- Fixed Medium +.BR + 5 \- Fixed High +.BR + 6 \- Auto Rate Select (Standard) +.BR + 7 \- Auto Rate Select (Medium) +.BR + Default: 3 + +For Hermes-II.5, an INTEGER CONVERTED bit mask representing all of the +rates to support, where the rates supported are as follows: + +Bit : 15|14|13|12|11|10|09|08|07|06|05|04|03|02|01|00 +.br +------------------------------------------------------ +.br +Rate : XX|XX|XX|XX|54|48|36|24|18|12| 9| 6|11|5.5|2| 1 +.BR + Default: 4095 (Translates to 0xFFF, which is all rates) + +.TP +.B TxRateControl1=n +Same as TxRateControl, only for port 1 in AccessPoint mode. +.TP +.B TxRateControl2=n +Same as TxRateControl1, only for port 2. +.TP +.B TxRateControl3=n +Same as TxRateControl1, only for port 3. +.TP +.B TxRateControl4=n +Same as TxRateControl1, only for port 4. +.TP +.B TxRateControl5=n +Same as TxRateControl1, only for port 5. +.TP +.B TxRateControl6=n +Same as TxRateControl1, only for port 6. +.TP +.B VendorDescription +??????????????? +.TP +.B WDSAddress=n,n,n,n,n,n +MAC address that identifies the corresponding node of the WDS port in Station mode. +Note that for WDS to work properly, a bridge interface must be setup between the device and +the wds network devices created by the driver. For more information on bridge +interfaces, please refer to the man page for \'brctl\'. +.BR + Default: 00:00:00:00:00:00 +.TP +.B WDSAddress1=n,n,n,n,n,n +Same as WDSAddress, only for port 1 in AccessPoint mode. +.TP +.B WDSAddress2=n,n,n,n,n,n +Same as WDSAddress1, only for port 2. +.TP +.B WDSAddress3=n,n,n,n,n,n +Same as WDSAddress1, only for port 3. +.TP +.B WDSAddress4=n,n,n,n,n,n +Same as WDSAddress1, only for port 4. +.TP +.B WDSAddress5=n,n,n,n,n,n +Same as WDSAddress1, only for port 5. +.TP +.B WDSAddress6=n,n,n,n,n,n +Same as WDSAddress1, only for port 6. +.SH SECURITY +On a multi-user system only the system administrator needs access to the WEP +encryption keys. In this case, consider removing the read permission for +normal users of the PCMCIA config.opts file, the system log file, and any +Agere proprietary iwconfig-eth scripts. +.SH CONTACT +If you encounter problems when installing or using this product, or would like +information about our other "Wireless" products, please contact your local +Authorized "Wireless" Reseller or Agere Systems sales office. + +Addresses and telephone numbers of the Agere Systems sales offices are +listed on our Agere Systems web site. +.TP +.B WWW +http://www.agere.com +.SH SEE ALSO +.BR cardmgr (8), +.BR pcmcia (5), +.BR ifconfig (8), +.BR insmod (8), +.BR brctl (8). diff --git a/drivers/staging/wlags49_h2/mdd.h b/drivers/staging/wlags49_h2/mdd.h new file mode 100644 index 000000000000..b45c7ddd92e2 --- /dev/null +++ b/drivers/staging/wlags49_h2/mdd.h @@ -0,0 +1,1156 @@ + +// vim:tw=110:ts=4: +#ifndef MDD_H +#define MDD_H 1 + +/************************************************************************************************************* +* +* FILE : mdd.h +* +* DATE : $Date: 2004/08/05 11:47:10 $ $Revision: 1.6 $ +* Original : 2004/05/25 05:59:37 Revision: 1.57 Tag: hcf7_t20040602_01 +* Original : 2004/05/13 15:31:45 Revision: 1.54 Tag: hcf7_t7_20040513_01 +* Original : 2004/04/15 09:24:41 Revision: 1.47 Tag: hcf7_t7_20040415_01 +* Original : 2004/04/13 14:22:45 Revision: 1.46 Tag: t7_20040413_01 +* Original : 2004/04/01 15:32:55 Revision: 1.42 Tag: t7_20040401_01 +* Original : 2004/03/10 15:39:28 Revision: 1.38 Tag: t20040310_01 +* Original : 2004/03/04 11:03:37 Revision: 1.36 Tag: t20040304_01 +* Original : 2004/03/02 09:27:11 Revision: 1.34 Tag: t20040302_03 +* Original : 2004/02/24 13:00:27 Revision: 1.29 Tag: t20040224_01 +* Original : 2004/02/18 17:13:57 Revision: 1.26 Tag: t20040219_01 +* +* AUTHOR : Nico Valster +* +* DESC : Definitions and Prototypes for HCF, DHF, MMD and MSF +* +*************************************************************************************************************** +* +* +* SOFTWARE LICENSE +* +* This software is provided subject to the following terms and conditions, +* which you should read carefully before using the software. Using this +* software indicates your acceptance of these terms and conditions. If you do +* not agree with these terms and conditions, do not use the software. +* +* COPYRIGHT © 1994 - 1995 by AT&T. All Rights Reserved +* COPYRIGHT © 1996 - 2000 by Lucent Technologies. All Rights Reserved +* COPYRIGHT © 2001 - 2004 by Agere Systems Inc. All Rights Reserved +* All rights reserved. +* +* Redistribution and use in source or binary forms, with or without +* modifications, are permitted provided that the following conditions are met: +* +* . Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following Disclaimer as comments in the code as +* well as in the documentation and/or other materials provided with the +* distribution. +* +* . Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following Disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* . Neither the name of Agere Systems Inc. nor the names of the contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* Disclaimer +* +* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY +* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN +* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +* DAMAGE. +* +* +************************************************************************************************************/ + + +/************************************************************************************************************ +* +* The macros Xn(...) and XXn(...) are used to define the LTV's (short for Length Type Value[ ]) , +* aka RIDs, processed by the Hermes. +* The n in Xn and XXn reflects the number of "Value" fields in these RIDs. +* +* Xn(...) : Macros used for RIDs which use only type hcf_16 for the "V" fields of the LTV. +* Xn takes as parameters a RID name and "n" name(s), one for each of the "V" fields of the LTV. +* +* XXn(...) : Macros used for RIDs which use at least one other type then hcf_16 for a "V" field +* of the LTV. +* XXn(..) takes as parameters a RID name and "n" pair(s) of type and name, one for each "V" field +* of the LTV + + ****************************************** e x a m p l e s *********************************************** + +* X1(RID_NAME, parameters...) : expands to : +* typedef struct RID_NAME_STRCT { +* hcf_16 len; +* hcf_16 typ; +* hcf_16 par1; +* } RID_NAME_STRCT; + +* X2(RID_NAME, parameters...) : expands to : +* typedef struct RID_NAME_STRCT { +* hcf_16 len; +* hcf_16 typ; +* hcf_16 par1; +* hcf_16 par2; +* } RID_NAME_STRCT; + + +* XX1(RID_NAME, par1type, par1name, ...) : expands to : +* typedef struct RID_NAME_STRCT { +* hcf_16 len; +* hcf_16 typ; +* par1type par1name; +* } RID_NAME_STRCT; + +************************************************************************************************************/ + +/******************************* XX Sub-macro definitions **************************************************/ + +#define XX1( name, type1, par1 ) \ +typedef struct { \ + hcf_16 len; \ + hcf_16 typ; \ + type1 par1; \ +} name##_STRCT; + +#define XX2( name, type1, par1, type2, par2 ) \ +typedef struct { \ + hcf_16 len; \ + hcf_16 typ; \ + type1 par1; \ + type2 par2; \ +} name##_STRCT; + +#define XX3( name, type1, par1, type2, par2, type3, par3 ) \ +typedef struct name##_STRCT { \ + hcf_16 len; \ + hcf_16 typ; \ + type1 par1; \ + type2 par2; \ + type3 par3; \ +} name##_STRCT; + +#define XX4( name, type1, par1, type2, par2, type3, par3, type4, par4 ) \ +typedef struct { \ + hcf_16 len; \ + hcf_16 typ; \ + type1 par1; \ + type2 par2; \ + type3 par3; \ + type4 par4; \ +} name##_STRCT; + +#define X1( name, par1 ) \ +typedef struct name##_STRCT { \ + hcf_16 len; \ + hcf_16 typ; \ + hcf_16 par1; \ +} name##_STRCT; + +#define X2( name, par1, par2 ) \ +typedef struct { \ + hcf_16 len; \ + hcf_16 typ; \ + hcf_16 par1; \ + hcf_16 par2; \ +} name##_STRCT; + +#define X3( name, par1, par2, par3 ) \ +typedef struct { \ + hcf_16 len; \ + hcf_16 typ; \ + hcf_16 par1; \ + hcf_16 par2; \ + hcf_16 par3; \ +} name##_STRCT; + +#define X4( name, par1, par2, par3, par4 ) \ +typedef struct { \ + hcf_16 len; \ + hcf_16 typ; \ + hcf_16 par1; \ + hcf_16 par2; \ + hcf_16 par3; \ + hcf_16 par4; \ +} name##_STRCT; + +#define X5( name, par1, par2, par3, par4, par5 ) \ +typedef struct { \ + hcf_16 len; \ + hcf_16 typ; \ + hcf_16 par1; \ + hcf_16 par2; \ + hcf_16 par3; \ + hcf_16 par4; \ + hcf_16 par5; \ +} name##_STRCT; + +#define X6( name, par1, par2, par3, par4, par5, par6 ) \ +typedef struct { \ + hcf_16 len; \ + hcf_16 typ; \ + hcf_16 par1; \ + hcf_16 par2; \ + hcf_16 par3; \ + hcf_16 par4; \ + hcf_16 par5; \ + hcf_16 par6; \ +} name##_STRCT; + +#define X8( name, par1, par2, par3, par4, par5, par6, par7, par8 ) \ +typedef struct { \ + hcf_16 len; \ + hcf_16 typ; \ + hcf_16 par1; \ + hcf_16 par2; \ + hcf_16 par3; \ + hcf_16 par4; \ + hcf_16 par5; \ + hcf_16 par6; \ + hcf_16 par7; \ + hcf_16 par8; \ +} name##_STRCT; + +#define X11( name, par1, par2, par3, par4, par5, par6, par7, par8, par9, par10, par11 ) \ +typedef struct { \ + hcf_16 len; \ + hcf_16 typ; \ + hcf_16 par1; \ + hcf_16 par2; \ + hcf_16 par3; \ + hcf_16 par4; \ + hcf_16 par5; \ + hcf_16 par6; \ + hcf_16 par7; \ + hcf_16 par8; \ + hcf_16 par9; \ + hcf_16 par10; \ + hcf_16 par11; \ +} name##_STRCT; + +/******************************* Substructure definitions **************************************************/ + +//apparently not needed (CFG_CNF_COUNTRY) +typedef struct CHANNEL_SET { //channel set structure used in the CFG_CNF_COUNTRY LTV + hcf_16 first_channel; + hcf_16 number_of_channels; + hcf_16 max_tx_output_level; +} CHANNEL_SET; + +typedef struct KEY_STRCT { // key structure used in the CFG_DEFAULT_KEYS LTV + hcf_16 len; //length of key + hcf_8 key[14]; //encryption key +} KEY_STRCT; + +typedef struct SCAN_RS_STRCT { // Scan Result structure used in the CFG_SCAN LTV + hcf_16 channel_id; + hcf_16 noise_level; + hcf_16 signal_level; + hcf_8 bssid[6]; + hcf_16 beacon_interval_time; + hcf_16 capability; + hcf_16 ssid_len; + hcf_8 ssid_val[32]; +} SCAN_RS_STRCT; + +typedef struct CFG_RANGE_SPEC_STRCT { // range specification structure used in CFG_RANGES, CFG_RANGE1 etc + hcf_16 variant; + hcf_16 bottom; + hcf_16 top; +} CFG_RANGE_SPEC_STRCT; + +typedef struct CFG_RANGE_SPEC_BYTE_STRCT { // byte oriented range specification structure used in CFG_RANGE_B LTV + hcf_8 variant[2]; + hcf_8 bottom[2]; + hcf_8 top[2]; +} CFG_RANGE_SPEC_BYTE_STRCT; + +//used to set up "T" functionality for Info frames, i.e. log info frames in MSF supplied buffer and MailBox +XX1( RID_LOG, unsigned short FAR*, bufp ) +typedef RID_LOG_STRCT FAR *RID_LOGP; +XX1( CFG_RID_LOG, RID_LOGP, recordp ) + + X1( LTV, val[1] ) /*minimum LTV proto typ */ + X1( LTV_MAX, val[HCF_MAX_LTV] ) /*maximum LTV proto typ */ +XX2( CFG_REG_MB, hcf_16* , mb_addr, hcf_16, mb_size ) + +typedef struct CFG_MB_INFO_FRAG { // specification of buffer fragment + unsigned short FAR* frag_addr; + hcf_16 frag_len; +} CFG_MB_INFO_FRAG; + +/* Mail Box Info Block structures, + * the base form: CFG_MB_INFO_STRCT + * and the derived forms: CFG_MB_INFO_RANGE_STRCT with n is 1, 2, 3 or 20 + * predefined for a payload of 1, and up to 2, 3 and 20 CFG_MB_INFO_FRAG elements */ +XX3( CFG_MB_INFO, hcf_16, base_typ, hcf_16, frag_cnt, CFG_MB_INFO_FRAG, frag_buf[ 1] ) +XX3( CFG_MB_INFO_RANGE1, hcf_16, base_typ, hcf_16, frag_cnt, CFG_MB_INFO_FRAG, frag_buf[ 1] ) +XX3( CFG_MB_INFO_RANGE2, hcf_16, base_typ, hcf_16, frag_cnt, CFG_MB_INFO_FRAG, frag_buf[ 2] ) +XX3( CFG_MB_INFO_RANGE3, hcf_16, base_typ, hcf_16, frag_cnt, CFG_MB_INFO_FRAG, frag_buf[ 3] ) +XX3( CFG_MB_INFO_RANGE20, hcf_16, base_typ, hcf_16, frag_cnt, CFG_MB_INFO_FRAG, frag_buf[20] ) + +XX3( CFG_MB_ASSERT, hcf_16, line, hcf_16, trace, hcf_32, qualifier ) /*MBInfoBlock for asserts */ +#if (HCF_ASSERT) & ( HCF_ASSERT_LNK_MSF_RTN | HCF_ASSERT_RT_MSF_RTN ) +typedef void (MSF_ASSERT_RTN)( unsigned int , hcf_16, hcf_32 ); +typedef MSF_ASSERT_RTN /*can't link FAR*/ * MSF_ASSERT_RTNP; +/* CFG_REG_ASSERT_RTNP (0x0832) (de-)register MSF Callback routines + * lvl: Assert level filtering (not yet implemented) + * rtnp: address of MSF_ASSERT_RTN (native Endian format) */ +XX2( CFG_REG_ASSERT_RTNP, hcf_16, lvl, MSF_ASSERT_RTNP, rtnp ) +#endif // HCF_ASSERT_LNK_MSF_RTN / HCF_ASSERT_RT_MSF_RTN + + X1( CFG_HCF_OPT, val[20] ) /*(Compile time) options */ + X3( CFG_CMD_HCF, cmd, mode, add_info ) /*HCF Engineering command */ + +typedef struct { + hcf_16 len; + hcf_16 typ; + hcf_16 mode; // PROG_STOP/VOLATILE [FLASH/SEEPROM/SEEPROM_READBACK] + hcf_16 segment_size; // size of the segment in bytes + hcf_32 nic_addr; // destination address (in NIC memory) + hcf_16 flags; // 0x0001 : CRC Yes/No +// hcf_32 flags; // 0x0001 : CRC Yes/No + /* ;? still not the whole story + * flags is extended from 16 to 32 bits to force that compiling FW.C produces the same structures + * in memory as FUPU4 BIN files. + * Note that the problem arises from the violation of the constraint to use packing at byte boundaries + * as was stipulated in the WCI-specification + * The Pack pragma can't resolve this issue, because that impacts all members of the structure with + * disregard of their actual size, so aligning host_addr under MSVC 1.5 at 4 bytes, also aligns + * len, typ etc on 4 bytes + * */ +// hcf_16 pad; //!! be careful alignment problems for Bin download versus C download + hcf_8 FAR *host_addr; // source address (in Host memory) +} CFG_PROG_STRCT; // segment_descp; + +// a structure used for transporting debug-related information from firmware +// via the HCF, into the MSF +typedef struct { + hcf_16 len; + hcf_16 typ; + hcf_16 msg_id, msg_par, msg_tstamp; +} CFG_FW_PRINTF_STRCT; + +// a structure used to define the location and size of a certain debug-related +// buffer in nic-ram. +typedef struct { + hcf_16 len; + hcf_16 typ; + hcf_32 DbMsgCount, // ds (nicram) address of a counter + DbMsgBuffer, // ds (nicram) address of the buffer + DbMsgSize, // number of entries (each 3 word in size) in this buffer + DbMsgIntrvl; // ds (nicram) address of interval for generating InfDrop event +} CFG_FW_PRINTF_BUFFER_LOCATION_STRCT; + +XX3( CFG_RANGES, hcf_16, role, hcf_16, id, CFG_RANGE_SPEC_STRCT, var_rec[ 1] ) /*Actor/Supplier range (1 variant)*/ +XX3( CFG_RANGE1, hcf_16, role, hcf_16, id, CFG_RANGE_SPEC_STRCT, var_rec[ 1] ) /*Actor/Supplier range (1 variant)*/ +XX3( CFG_RANGE2, hcf_16, role, hcf_16, id, CFG_RANGE_SPEC_STRCT, var_rec[ 2] ) /*Actor range ( 2 variants) */ +XX3( CFG_RANGE3, hcf_16, role, hcf_16, id, CFG_RANGE_SPEC_STRCT, var_rec[ 3] ) /*Actor range ( 3 variants) */ +XX3( CFG_RANGE4, hcf_16, role, hcf_16, id, CFG_RANGE_SPEC_STRCT, var_rec[ 4] ) /*Actor range ( 4 variants) */ +XX3( CFG_RANGE5, hcf_16, role, hcf_16, id, CFG_RANGE_SPEC_STRCT, var_rec[ 5] ) /*Actor range ( 5 variants) */ +XX3( CFG_RANGE6, hcf_16, role, hcf_16, id, CFG_RANGE_SPEC_STRCT, var_rec[ 6] ) /*Actor range ( 6 variants) */ +XX3( CFG_RANGE7, hcf_16, role, hcf_16, id, CFG_RANGE_SPEC_STRCT, var_rec[ 7] ) /*Actor range ( 7 variants) */ +XX3( CFG_RANGE20, hcf_16, role, hcf_16, id, CFG_RANGE_SPEC_STRCT, var_rec[20] ) /*Actor range (20 variants) */ + +/*Frames */ + X3( CFG_ASSOC_STAT, assoc_stat, station_addr[3], val[46] ) /*Association status, basic */ + X2( CFG_ASSOC_STAT3, assoc_stat, station_addr[3] ) /*assoc_stat:3 */ + X3( CFG_ASSOC_STAT1, assoc_stat, station_addr[3], frame_body[43] ) /*assoc_stat:1 */ + X4( CFG_ASSOC_STAT2, assoc_stat, station_addr[3], old_ap_addr[3], frame_body[43] ) /*assoc_stat:2 */ + +/*Static Configurations */ + X1( CFG_CNF_PORT_TYPE, port_type ) /*[STA] Connection control characteristics */ + X1( CFG_MAC_ADDR, mac_addr[3] ) /*general: FC01,FC08,FC11,FC12,FC13,FC14,FC15,FC16 */ + X1( CFG_CNF_OWN_MAC_ADDR, mac_addr[3] ) + X1( CFG_ID, ssid[17] ) /*0xFC02, 0xFC04, 0xFC0E */ +/* X1( CFG_DESIRED_SSID, ssid[17] ) see Dynamic Configurations */ + X1( CFG_CNF_OWN_CHANNEL, channel ) /*Communication channel for BSS creation */ + X1( CFG_CNF_OWN_SSID, ssid[17] ) + X1( CFG_CNF_OWN_ATIM_WINDOW, atim_window ) + X1( CFG_CNF_SYSTEM_SCALE, system_scale ) + X1( CFG_CNF_MAX_DATA_LEN, max_data_len ) + X1( CFG_CNF_WDS_ADDR, mac_addr[3] ) /*[STA] MAC Address of corresponding WDS Link node */ + X1( CFG_CNF_PM_ENABLED, pm_enabled ) /*[STA] Switch for ESS Power Management (PM) On/Off */ + X1( CFG_CNF_PM_EPS, pm_eps ) /*[STA] Switch for ESS PM EPS/PS Mode */ + X1( CFG_CNF_MCAST_RX, mcast_rx ) /*[STA] Switch for ESS PM Multicast reception On/Off */ + X1( CFG_CNF_MAX_SLEEP_DURATION, duration ) /*[STA] Maximum sleep time for ESS PM */ + X1( CFG_CNF_PM_HOLDOVER_DURATION, duration ) /*[STA] Holdover time for ESS PM */ + X1( CFG_CNF_OWN_NAME, ssid[17] ) /*Identification text for diagnostic purposes */ + X1( CFG_CNF_OWN_DTIM_PERIOD, period ) /*[AP] Beacon intervals between successive DTIMs */ + X1( CFG_CNF_WDS_ADDR1, mac_addr[3] ) /*[AP] Port 1 MAC Adrs of corresponding WDS Link node */ + X1( CFG_CNF_WDS_ADDR2, mac_addr[3] ) /*[AP] Port 2 MAC Adrs of corresponding WDS Link node */ + X1( CFG_CNF_WDS_ADDR3, mac_addr[3] ) /*[AP] Port 3 MAC Adrs of corresponding WDS Link node */ + X1( CFG_CNF_WDS_ADDR4, mac_addr[3] ) /*[AP] Port 4 MAC Adrs of corresponding WDS Link node */ + X1( CFG_CNF_WDS_ADDR5, mac_addr[3] ) /*[AP] Port 5 MAC Adrs of corresponding WDS Link node */ + X1( CFG_CNF_WDS_ADDR6, mac_addr[3] ) /*[AP] Port 6 MAC Adrs of corresponding WDS Link node */ + X1( CFG_CNF_MCAST_PM_BUF, mcast_pm_buf ) /*[AP] Switch for PM buffering of Multicast Messages */ + X1( CFG_CNF_REJECT_ANY, reject_any ) /*[AP] Switch for PM buffering of Multicast Messages */ +//X1( CFG_CNF_ENCRYPTION_ENABLED, encryption ) /*specify encryption type of Tx/Rx messages */ + X1( CFG_CNF_ENCRYPTION, encryption ) /*specify encryption type of Tx/Rx messages */ + X1( CFG_CNF_AUTHENTICATION, authentication ) /*selects Authentication algorithm */ + X1( CFG_CNF_EXCL_UNENCRYPTED, exclude_unencrypted ) /*[AP] Switch for 'clear-text' rx message acceptance */ + X1( CFG_CNF_MCAST_RATE, mcast_rate ) /*Transmit Data rate for Multicast frames */ + X1( CFG_CNF_INTRA_BSS_RELAY, intra_bss_relay ) /*[AP] Switch for IntraBBS relay */ + X1( CFG_CNF_MICRO_WAVE, micro_wave ) /*MicroWave (Robustness) */ + X1( CFG_CNF_LOAD_BALANCING, load_balancing ) /*Load Balancing (Boolean, 0=OFF, 1=ON, default=1) */ + X1( CFG_CNF_MEDIUM_DISTRIBUTION, medium_distribution ) /*Medium Distribution (Boolean, 0=OFF, 1=ON, default=1) */ + X1( CFG_CNF_GROUP_ADDR_FILTER, group_addr_filter ) /*Group Address Filter */ + X1( CFG_CNF_TX_POW_LVL, tx_pow_lvl ) /*Tx Power Level */ +XX4( CFG_CNF_COUNTRY_INFO, \ + hcf_16, n_channel_sets, hcf_16, country_code[2], \ + hcf_16, environment, CHANNEL_SET, channel_set[1] ) /*Current Country Info */ +XX4( CFG_CNF_COUNTRY_INFO_MAX, \ + hcf_16, n_channel_sets, hcf_16, country_code[2], \ + hcf_16, environment, CHANNEL_SET, channel_set[14]) /*Current Country Info */ + +/*Dynamic Configurations */ + X1( CFG_DESIRED_SSID, ssid[17] ) /*[STA] Service Set identification for connection */ +#define GROUP_ADDR_SIZE (32 * 6) //32 6-byte MAC-addresses + X1( CFG_GROUP_ADDR, mac_addr[GROUP_ADDR_SIZE/2] ) /*[STA] Multicast MAC Addresses for Rx-message */ + X1( CFG_CREATE_IBSS, create_ibss ) /*[STA] Switch for IBSS creation On/Off */ + X1( CFG_RTS_THRH, rts_thrh ) /*[STA] Frame length used for RTS/CTS handshake */ + X1( CFG_TX_RATE_CNTL, tx_rate_cntl ) /*[STA] Data rate control for message transmission */ + X1( CFG_PROMISCUOUS_MODE, promiscuous_mode ) /*[STA] Switch for Promiscuous mode reception On/Of */ + X1( CFG_WOL, wake_on_lan ) /*[STA] Switch for Wake-On-LAN mode */ + X1( CFG_RTS_THRH0, rts_thrh ) /*[AP] Port 0 frame length for RTS/CTS handshake */ + X1( CFG_RTS_THRH1, rts_thrh ) /*[AP] Port 1 frame length for RTS/CTS handshake */ + X1( CFG_RTS_THRH2, rts_thrh ) /*[AP] Port 2 frame length for RTS/CTS handshake */ + X1( CFG_RTS_THRH3, rts_thrh ) /*[AP] Port 3 frame length for RTS/CTS handshake */ + X1( CFG_RTS_THRH4, rts_thrh ) /*[AP] Port 4 frame length for RTS/CTS handshake */ + X1( CFG_RTS_THRH5, rts_thrh ) /*[AP] Port 5 frame length for RTS/CTS handshake */ + X1( CFG_RTS_THRH6, rts_thrh ) /*[AP] Port 6 frame length for RTS/CTS handshake */ + X1( CFG_TX_RATE_CNTL0, rate_cntl ) /*[AP] Port 0 data rate control for transmission */ + X1( CFG_TX_RATE_CNTL1, rate_cntl ) /*[AP] Port 1 data rate control for transmission */ + X1( CFG_TX_RATE_CNTL2, rate_cntl ) /*[AP] Port 2 data rate control for transmission */ + X1( CFG_TX_RATE_CNTL3, rate_cntl ) /*[AP] Port 3 data rate control for transmission */ + X1( CFG_TX_RATE_CNTL4, rate_cntl ) /*[AP] Port 4 data rate control for transmission */ + X1( CFG_TX_RATE_CNTL5, rate_cntl ) /*[AP] Port 5 data rate control for transmission */ + X1( CFG_TX_RATE_CNTL6, rate_cntl ) /*[AP] Port 6 data rate control for transmission */ +XX1( CFG_DEFAULT_KEYS, KEY_STRCT, key[4] ) /*defines set of encryption keys */ + X1( CFG_TX_KEY_ID, tx_key_id ) /*select key for encryption of Tx messages */ + X1( CFG_SCAN_SSID, ssid[17] ) /*identification for connection */ + X5( CFG_ADD_TKIP_DEFAULT_KEY, \ + tkip_key_id_info, tkip_key_iv_info[4], tkip_key[8], \ + tx_mic_key[4], rx_mic_key[4] ) /* */ + X6( CFG_ADD_TKIP_MAPPED_KEY, bssid[3], tkip_key[8], \ + tsc[4], rsc[4], tx_mic_key[4], rx_mic_key[4] ) /* */ + X1( CFG_SET_SSN_AUTHENTICATION_SUITE, \ + ssn_authentication_suite ) /* */ + X1( CFG_REMOVE_TKIP_DEFAULT_KEY,tkip_key_id ) /* */ + X1( CFG_TICK_TIME, tick_time ) /*Auxiliary Timer tick interval */ + X1( CFG_DDS_TICK_TIME, tick_time ) /*Disconnected DeepSleep Timer tick interval */ + +/********************************************************************** +* Added for Pattern-matching WakeOnLan. (See firmware design note WMDN281C) +**********************************************************************/ +#define WOL_PATTERNS 5 // maximum of 5 patterns in firmware +#define WOL_PATTERN_LEN 124 // maximum 124 bytes pattern length per pattern in firmware +#define WOL_MASK_LEN 30 // maximum 30 bytes mask length per pattern in firmware +#define WOL_BUF_SIZE (WOL_PATTERNS * (WOL_PATTERN_LEN + WOL_MASK_LEN + 6) / 2) +X2( CFG_WOL_PATTERNS, nPatterns, buffer[WOL_BUF_SIZE] ) /*[STA] WakeOnLan pattern match, room for 5 patterns*/ + + X5( CFG_SUP_RANGE, role, id, variant, bottom, top ) /*[PRI] Primary Supplier compatibility range */ +/* NIC Information */ + X4( CFG_IDENTITY, comp_id, variant, version_major, version_minor ) /*identification Prototype */ +#define CFG_DRV_IDENTITY_STRCT CFG_IDENTITY_STRCT +#define CFG_PRI_IDENTITY_STRCT CFG_IDENTITY_STRCT +#define CFG_NIC_IDENTITY_STRCT CFG_IDENTITY_STRCT +#define CFG_FW_IDENTITY_STRCT CFG_IDENTITY_STRCT + X1( CFG_RID_INF_MIN, y ) /*lowest value representing an Information RID */ + X1( CFG_MAX_LOAD_TIME, max_load_time ) /*[PRI] Max response time of the Download command */ + X3( CFG_DL_BUF, buf_page, buf_offset, buf_len ) /*[PRI] Download buffer location and size */ +// X5( CFG_PRI_SUP_RANGE, role, id, variant, bottom, top ) /*[PRI] Primary Supplier compatibility range */ + X5( CFG_CFI_ACT_RANGES_PRI,role, id, variant, bottom, top ) /*[PRI] Controller Actor compatibility ranges */ +// X5( CFG_NIC_HSI_SUP_RANGE, role, id, variant, bottom, top ) /*H/W - S/W I/F supplier range */ + X1( CFG_NIC_SERIAL_NUMBER, serial_number[17] ) /*[PRI] Network I/F Card serial number */ + X5( CFG_NIC_MFI_SUP_RANGE, role, id, variant, bottom, top ) /*[PRI] Modem I/F Supplier compatibility range */ + X5( CFG_NIC_CFI_SUP_RANGE, role, id, variant, bottom, top ) /*[PRI] Controller I/F Supplier compatibility range*/ +//H-I X1( CFG_CHANNEL_LIST, channel_list ) /*Allowed communication channels */ +//H-I XX2( CFG_REG_DOMAINS, hcf_16, num_domain, hcf_8, reg_domains[10] ) /*List of intended regulatory domains */ + X1( CFG_NIC_TEMP_TYPE, temp_type ) /*Hardware temperature range code */ +//H-I X1( CFG_CIS, cis[240] ) /*PC Card Standard Card Information Structure */ + X5( CFG_NIC_PROFILE, \ + profile_code, capability_options, allowed_data_rates, val4, val5 ) /*Card Profile */ +// X5( CFG_FW_SUP_RANGE, role, id, variant, bottom, top ) /*[STA] Station I/F Supplier compatibility range */ + X5( CFG_MFI_ACT_RANGES, role, id, variant, bottom, top ) /*[STA] Modem I/F Actor compatibility ranges */ + X5( CFG_CFI_ACT_RANGES_STA,role, id, variant, bottom, top ) /*[STA] Controller I/F Actor compatibility ranges */ + X5( CFG_MFI_ACT_RANGES_STA,role, id, variant, bottom, top ) /*[STA] Controller I/F Actor compatibility ranges */ + X1( CFG_NIC_BUS_TYPE, nic_bus_type ) /*NIC bustype derived from BUSSEL host I/F signals */ + +/* MAC INFORMATION */ + X1( CFG_PORT_STAT, port_stat ) /*[STA] Actual MAC Port connection control status */ + X1( CFG_CUR_SSID, ssid[17] ) /*[STA] Identification of the actually connected SS */ + X1( CFG_CUR_BSSID, mac_addr[3] ) /*[STA] Identification of the actually connected BSS */ + X3( CFG_COMMS_QUALITY, coms_qual, signal_lvl, noise_lvl ) /*[STA] Quality of the Basic Service Set connection */ + X1( CFG_CUR_TX_RATE, rate ) /*[STA] Actual transmit data rate */ + X1( CFG_CUR_BEACON_INTERVAL, interval ) /*Beacon transmit interval time for BSS creation */ +#if (HCF_TYPE) & HCF_TYPE_WARP + X11( CFG_CUR_SCALE_THRH, \ + carrier_detect_thrh_cck, carrier_detect_thrh_ofdm, defer_thrh, \ + energy_detect_thrh, rssi_on_thrh_deviation, \ + rssi_off_thrh_deviation, cck_drop_thrh, ofdm_drop_thrh, \ + cell_search_thrh, out_of_range_thrh, delta_snr ) +#else + X6( CFG_CUR_SCALE_THRH, \ + energy_detect_thrh, carrier_detect_thrh, defer_thrh, \ + cell_search_thrh, out_of_range_thrh, delta_snr ) /*Actual System Scale thresholds settings */ +#endif // HCF_TYPE_WARP + X1( CFG_PROTOCOL_RSP_TIME, time ) /*Max time to await a response to a request message */ + X1( CFG_CUR_SHORT_RETRY_LIMIT, limit ) /*Max number of transmit attempts for short frames */ + X1( CFG_CUR_LONG_RETRY_LIMIT, limit ) /*Max number of transmit attempts for long frames */ + X1( CFG_MAX_TX_LIFETIME, time ) /*Max transmit frame handling duration */ + X1( CFG_MAX_RX_LIFETIME, time ) /*Max received frame handling duration */ + X1( CFG_CF_POLLABLE, cf_pollable ) /*[STA] Contention Free pollable capability indication */ + X2( CFG_AUTHENTICATION_ALGORITHMS,authentication_type, type_enabled ) /*Authentication Algorithm */ + X1( CFG_PRIVACY_OPT_IMPLEMENTED,privacy_opt_implemented ) /*WEP Option availability indication */ + X1( CFG_CUR_REMOTE_RATES, rates ) /*CurrentRemoteRates */ + X1( CFG_CUR_USED_RATES, rates ) /*CurrentUsedRates */ + X1( CFG_CUR_SYSTEM_SCALE, current_system_scale ) /*CurrentUsedRates */ + X1( CFG_CUR_TX_RATE1, rate ) /*[AP] Actual Port 1 transmit data rate */ + X1( CFG_CUR_TX_RATE2, rate ) /*[AP] Actual Port 2 transmit data rate */ + X1( CFG_CUR_TX_RATE3, rate ) /*[AP] Actual Port 3 transmit data rate */ + X1( CFG_CUR_TX_RATE4, rate ) /*[AP] Actual Port 4 transmit data rate */ + X1( CFG_CUR_TX_RATE5, rate ) /*[AP] Actual Port 5 transmit data rate */ + X1( CFG_CUR_TX_RATE6, rate ) /*[AP] Actual Port 6 transmit data rate */ + X1( CFG_OWN_MAC_ADDR, mac_addr[3] ) /*[AP] Unique local node MAC Address */ + X3( CFG_PCF_INFO, medium_occupancy_limit, \ + cfp_period, cfp_max_duration ) /*[AP] Point Coordination Function capability info */ + X1( CFG_CUR_SSN_INFO_ELEMENT, ssn_info_element[1] ) /* */ + X4( CFG_CUR_TKIP_IV_INFO, \ + tkip_seq_cnt0[4], tkip_seq_cnt1[4], \ + tkip_seq_cnt2[4], tkip_seq_cnt3[4] ) /* */ + X2( CFG_CUR_ASSOC_REQ_INFO, frame_type, frame_body[1] ) /* 0xFD8C */ + X2( CFG_CUR_ASSOC_RESP_INFO, frame_type, frame_body[1] ) /* 0xFD8D */ + + +/* Modem INFORMATION */ + X1( CFG_PHY_TYPE, phy_type ) /*Physical layer type indication */ + X1( CFG_CUR_CHANNEL, current_channel ) /*Actual frequency channel used for transmission */ + X1( CFG_CUR_POWER_STATE, current_power_state ) /*Actual power consumption status */ + X1( CFG_CCAMODE, cca_mode ) /*Clear channel assessment mode indication */ + X1( CFG_SUPPORTED_DATA_RATES, rates[5] ) /*Data rates capability information */ + + +/* FRAMES */ +XX1( CFG_SCAN, SCAN_RS_STRCT, scan_result[32] ) /*Scan results */ + + + +//-------------------------------------------------------------------------------------- +// UIL management function to be passed to WaveLAN/IEEE Drivers in DUI_STRCT field fun +//-------------------------------------------------------------------------------------- + +// HCF and UIL Common +#define MDD_ACT_SCAN 0x06 // Hermes Inquire Scan (F101) command +#define MDD_ACT_PRS_SCAN 0x07 // Hermes Probe Response Scan (F102) command + +// UIL Specific +#define UIL_FUN_CONNECT 0x00 // Perform connect command +#define UIL_FUN_DISCONNECT 0x01 // Perform disconnect command +#define UIL_FUN_ACTION 0x02 // Perform UIL Action command. +#define UIL_FUN_SEND_DIAG_MSG 0x03 // Send a diagnostic message. +#define UIL_FUN_GET_INFO 0x04 // Retrieve information from NIC. +#define UIL_FUN_PUT_INFO 0x05 // Put information on NIC. + +/* UIL_ACT_TALLIES 0x05 * this should not be exported to the USF + * it is solely intended as a strategic choice for the MSF to either + * - use HCF_ACT_TALLIES and direct IFB access + * - use CFG_TALLIES + */ +#define UIL_ACT_SCAN MDD_ACT_SCAN +#define UIL_ACT_PRS_SCAN MDD_ACT_PRS_SCAN +#define UIL_ACT_BLOCK 0x0B +#define UIL_ACT_UNBLOCK 0x0C +#define UIL_ACT_RESET 0x80 +#define UIL_ACT_REBIND 0x81 +#define UIL_ACT_APPLY 0x82 +#define UIL_ACT_DISCONNECT 0x83 //;?040108 possibly obsolete //Special for WINCE + +// HCF Specific +/* Note that UIL_ACT-codes must match HCF_ACT-codes across a run-time bound I/F + * The initial matching is achieved by "#define HCF_ACT_xxx HCF_UIL_ACT_xxx" where appropriate + * In other words, these codes should never, ever change to minimize migration problems between + * combinations of old drivers and new utilities and vice versa + */ +#define HCF_DISCONNECT 0x01 //disconnect request for hcf_connect (invalid as IO Address) +#define HCF_ACT_TALLIES 0x05 // ! UIL_ACT_TALLIES does not exist ! Hermes Inquire Tallies (F100) cmd +#if ( (HCF_TYPE) & HCF_TYPE_WARP ) == 0 +#define HCF_ACT_SCAN MDD_ACT_SCAN +#endif // HCF_TYPE_WARP +#define HCF_ACT_PRS_SCAN MDD_ACT_PRS_SCAN +#if HCF_INT_ON +#define HCF_ACT_INT_OFF 0x0D // Disable Interrupt generation +#define HCF_ACT_INT_ON 0x0E // Enable Interrupt generation +#define HCF_ACT_INT_FORCE_ON 0x0F // Enforce Enable Interrupt generation +#endif // HCF_INT_ON +#define HCF_ACT_RX_ACK 0x15 // Receiever ACK (optimization) +#if (HCF_TYPE) & HCF_TYPE_CCX +#define HCF_ACT_CCX_ON 0x1A // enable CKIP +#define HCF_ACT_CCX_OFF 0x1B // disable CKIP +#endif // HCF_TYPE_CCX +#if (HCF_SLEEP) & HCF_DDS +#define HCF_ACT_SLEEP 0x1C // DDS Sleep request +//#define HCF_ACT_WAKEUP 0x1D // DDS Wakeup request +#endif // HCF_DDS + +/* HCF_ACT_MAX // xxxx: start value for UIL-range, NOT to be passed to HCF + * Too bad, there was originally no spare room created to use + * HCF_ACT_MAX as an equivalent of HCF_ERR_MAX. Since creating + * this room in retrospect would create a backward incompatibility + * we will just have to live with the haphazard sequence of + * UIL- and HCF specific codes. Theoretically this could be + * corrected when and if there will ever be an overall + * incompatibility introduced for another reason + */ + +/*============================================================= HERMES RECORDS ============================*/ +#define CFG_RID_FW_MIN 0xFA00 //lowest value representing a Hermes-II based RID +// #define CFG_PDA_BEGIN 0xFA // +// #define CFG_PDA_END 0xFA // +// #define CFG_PDA_NIC_TOP_LVL_ASSEMBLY_NUMBER 0xFA // +// #define CFG_PDA_PCB_TRACER_NUMBER 0xFA // +// #define CFG_PDA_RMM_TRACER_NUMBER 0xFA // +// #define CFG_PDA_RMM_COMP_ID 0xFA // +// #define CFG_PDA_ 0xFA // + +/*============================================================= CONFIGURATION RECORDS =====================*/ +/*============================================================= mask 0xFCxx =====================*/ +#define CFG_RID_CFG_MIN 0xFC00 //lowest value representing a Hermes configuration RID + +// NETWORK PARAMETERS, STATIC CONFIGURATION ENTITIES +//FC05, FC0B, FC0C, FC0D: SEE W2DN149 + +#define CFG_CNF_PORT_TYPE 0xFC00 //[STA] Connection control characteristics +#define CFG_CNF_OWN_MAC_ADDR 0xFC01 //[STA] MAC Address of this node +// 0xFC02 see DYNAMIC CONFIGURATION ENTITIES +#define CFG_CNF_OWN_CHANNEL 0xFC03 //Communication channel for BSS creation +#define CFG_CNF_OWN_SSID 0xFC04 //IBSS creation (STA) or ESS (AP) Service Set Ident +#define CFG_CNF_OWN_ATIM_WINDOW 0xFC05 //[STA] ATIM Window time for IBSS creation +#define CFG_CNF_SYSTEM_SCALE 0xFC06 //System Scale that specifies the AP density +#define CFG_CNF_MAX_DATA_LEN 0xFC07 //Maximum length of MAC Frame Body data +#define CFG_CNF_PM_ENABLED 0xFC09 //[STA] Switch for ESS Power Management (PM) +#define CFG_CNF_MCAST_RX 0xFC0B //[STA] Switch for ESS PM Multicast reception On/Off +#define CFG_CNF_MAX_SLEEP_DURATION 0xFC0C //[STA] Maximum sleep time for ESS PM +#define CFG_CNF_HOLDOVER_DURATION 0xFC0D //[STA] Holdover time for ESS PM +#define CFG_CNF_OWN_NAME 0xFC0E //Identification text for diagnostic purposes + +#define CFG_CNF_OWN_DTIM_PERIOD 0xFC10 //[AP] Beacon intervals between successive DTIMs +#define CFG_CNF_WDS_ADDR1 0xFC11 //[AP] Port 1 MAC Adrs of corresponding WDS Link node +#define CFG_CNF_WDS_ADDR2 0xFC12 //[AP] Port 2 MAC Adrs of corresponding WDS Link node +#define CFG_CNF_WDS_ADDR3 0xFC13 //[AP] Port 3 MAC Adrs of corresponding WDS Link node +#define CFG_CNF_WDS_ADDR4 0xFC14 //[AP] Port 4 MAC Adrs of corresponding WDS Link node +#define CFG_CNF_WDS_ADDR5 0xFC15 //[AP] Port 5 MAC Adrs of corresponding WDS Link node +#define CFG_CNF_WDS_ADDR6 0xFC16 //[AP] Port 6 MAC Adrs of corresponding WDS Link node +#define CFG_CNF_PM_MCAST_BUF 0xFC17 //[AP] Switch for PM buffereing of Multicast Messages +#define CFG_CNF_MCAST_PM_BUF CFG_CNF_PM_MCAST_BUF //name does not match H-II spec +#define CFG_CNF_REJECT_ANY 0xFC18 //[AP] Switch for PM buffereing of Multicast Messages + +#define CFG_CNF_ENCRYPTION 0xFC20 //select en/de-cryption of Tx/Rx messages +#define CFG_CNF_AUTHENTICATION 0xFC21 //[STA] selects Authentication algorithm +#define CFG_CNF_EXCL_UNENCRYPTED 0xFC22 //[AP] Switch for 'clear-text' rx message acceptance +#define CFG_CNF_MCAST_RATE 0xFC23 //Transmit Data rate for Multicast frames +#define CFG_CNF_INTRA_BSS_RELAY 0xFC24 //[AP] Switch for IntraBBS relay +#define CFG_CNF_MICRO_WAVE 0xFC25 //MicroWave (Robustness) +#define CFG_CNF_LOAD_BALANCING 0xFC26 //Load Balancing (Boolean, 0=OFF, 1=ON, default=1) +#define CFG_CNF_MEDIUM_DISTRIBUTION 0xFC27 //Medium Distribution (Boolean, 0=OFF, 1=ON, default=1) +#define CFG_CNF_RX_ALL_GROUP_ADDR 0xFC28 //[STA] Group Address Filter +#define CFG_CNF_COUNTRY_INFO 0xFC29 //Country Info +#if (HCF_TYPE) & HCF_TYPE_WARP +#define CFG_CNF_TX_POW_LVL 0xFC2A //TxPower Level +#define CFG_CNF_CONNECTION_CNTL 0xFC30 //[STA] Connection Control +#define CFG_CNF_OWN_BEACON_INTERVAL 0xFC31 //[AP] +#define CFG_CNF_SHORT_RETRY_LIMIT 0xFC32 // +#define CFG_CNF_LONG_RETRY_LIMIT 0xFC33 // +#define CFG_CNF_TX_EVENT_MODE 0xFC34 // +#define CFG_CNF_WIFI_COMPATIBLE 0xFC35 //[STA] Wifi compatible +#endif // HCF_TYPE_WARP +#if (HCF_TYPE) & HCF_TYPE_BEAGLE_HII5 +#define CFG_VOICE_RETRY_LIMIT 0xFC36 /* Voice frame retry limit. Range: 1-15, default: 4 */ +#define CFG_VOICE_CONTENTION_WINDOW 0xFC37 /* Contention window for voice frames. */ +#endif // BEAGLE_HII5 + +// NETWORK PARAMETERS, DYNAMIC CONFIGURATION ENTITIES +#define CFG_DESIRED_SSID 0xFC02 //[STA] Service Set identification for connection and scan + +#define CFG_GROUP_ADDR 0xFC80 //[STA] Multicast MAC Addresses for Rx-message +#define CFG_CREATE_IBSS 0xFC81 //[STA] Switch for IBSS creation On/Off +#define CFG_RTS_THRH 0xFC83 //Frame length used for RTS/CTS handshake +#define CFG_TX_RATE_CNTL 0xFC84 //[STA] Data rate control for message transmission +#define CFG_PROMISCUOUS_MODE 0xFC85 //[STA] Switch for Promiscuous mode reception On/Off +#define CFG_WOL 0xFC86 //[STA] Switch for Wake-On-LAN mode +#define CFG_WOL_PATTERNS 0xFC87 //[STA] Patterns for Wake-On-LAN +#define CFG_SUPPORTED_RATE_SET_CNTL 0xFC88 // +#define CFG_BASIC_RATE_SET_CNTL 0xFC89 // + +#define CFG_SOFTWARE_ACK_MODE 0xFC90 // +#define CFG_RTS_THRH0 0xFC97 //[AP] Port 0 frame length for RTS/CTS handshake +#define CFG_RTS_THRH1 0xFC98 //[AP] Port 1 frame length for RTS/CTS handshake +#define CFG_RTS_THRH2 0xFC99 //[AP] Port 2 frame length for RTS/CTS handshake +#define CFG_RTS_THRH3 0xFC9A //[AP] Port 3 frame length for RTS/CTS handshake +#define CFG_RTS_THRH4 0xFC9B //[AP] Port 4 frame length for RTS/CTS handshake +#define CFG_RTS_THRH5 0xFC9C //[AP] Port 5 frame length for RTS/CTS handshake +#define CFG_RTS_THRH6 0xFC9D //[AP] Port 6 frame length for RTS/CTS handshake + +#define CFG_TX_RATE_CNTL0 0xFC9E //[AP] Port 0 data rate control for transmission +#define CFG_TX_RATE_CNTL1 0xFC9F //[AP] Port 1 data rate control for transmission +#define CFG_TX_RATE_CNTL2 0xFCA0 //[AP] Port 2 data rate control for transmission +#define CFG_TX_RATE_CNTL3 0xFCA1 //[AP] Port 3 data rate control for transmission +#define CFG_TX_RATE_CNTL4 0xFCA2 //[AP] Port 4 data rate control for transmission +#define CFG_TX_RATE_CNTL5 0xFCA3 //[AP] Port 5 data rate control for transmission +#define CFG_TX_RATE_CNTL6 0xFCA4 //[AP] Port 6 data rate control for transmission + +#define CFG_DEFAULT_KEYS 0xFCB0 //defines set of encryption keys +#define CFG_TX_KEY_ID 0xFCB1 //select key for encryption of Tx messages +#define CFG_SCAN_SSID 0xFCB2 //Scan SSID +#define CFG_ADD_TKIP_DEFAULT_KEY 0xFCB4 //set KeyID and TxKey indication +#define KEY_ID 0x0003 //KeyID mask for tkip_key_id_info field +#define TX_KEY 0x8000 //Default Tx Key flag of tkip_key_id_info field +#define CFG_SET_WPA_AUTH_KEY_MGMT_SUITE 0xFCB5 //Authenticated Key Management Suite +#define CFG_REMOVE_TKIP_DEFAULT_KEY 0xFCB6 //invalidate KeyID and TxKey indication +#define CFG_ADD_TKIP_MAPPED_KEY 0xFCB7 //set MAC address pairwise station +#define CFG_REMOVE_TKIP_MAPPED_KEY 0xFCB8 //invalidate MAC address pairwise station +#define CFG_SET_WPA_CAPABILITIES_INFO 0xFCB9 //WPA Capabilities +#define CFG_CACHED_PMK_ADDR 0xFCBA //set MAC address of pre-authenticated AP +#define CFG_REMOVE_CACHED_PMK_ADDR 0xFCBB //invalidate MAC address of pre-authenticated AP +#define CFG_FCBC 0xFCBC //FW codes ahead of available documentation, so ??????? +#define CFG_FCBD 0xFCBD //FW codes ahead of available documentation, so ??????? +#define CFG_FCBE 0xFCBE //FW codes ahead of available documentation, so ??????? +#define CFG_FCBF 0xFCBF //FW codes ahead of available documentation, so ??????? + +#define CFG_HANDOVER_ADDR 0xFCC0 //[AP] Station MAC Adrress re-associated with other AP +#define CFG_SCAN_CHANNEL 0xFCC2 //Channel set for host requested scan +//;?#define CFG_SCAN_CHANNEL_MASK 0xFCC2 // contains +#define CFG_DISASSOCIATE_ADDR 0xFCC4 //[AP] Station MAC Adrress to be disassociated +#define CFG_PROBE_DATA_RATE 0xFCC5 //WARP connection control +#define CFG_FRAME_BURST_LIMIT 0xFCC6 // +#define CFG_COEXISTENSE_BEHAVIOUR 0xFCC7 //[AP] +#define CFG_DEAUTHENTICATE_ADDR 0xFCC8 //MAC address of Station to be deauthenticated + +// BEHAVIOR PARAMETERS +#define CFG_TICK_TIME 0xFCE0 //Auxiliary Timer tick interval +#define CFG_DDS_TICK_TIME 0xFCE1 //Disconnected DeepSleep Timer tick interval +//#define CFG_CNF_COUNTRY 0xFCFE apparently not needed ;? +#define CFG_RID_CFG_MAX 0xFCFF //highest value representing an Configuration RID + + +/*============================================================= INFORMATION RECORDS =====================*/ +/*============================================================= mask 0xFDxx =====================*/ +// NIC INFORMATION +#define CFG_RID_INF_MIN 0xFD00 //lowest value representing an Information RID +#define CFG_MAX_LOAD_TIME 0xFD00 //[INT] Maximum response time of the Download command. +#define CFG_DL_BUF 0xFD01 //[INT] Download buffer location and size. +#define CFG_PRI_IDENTITY 0xFD02 //[PRI] Primary Functions firmware identification. +#define CFG_PRI_SUP_RANGE 0xFD03 //[PRI] Primary Functions I/F Supplier compatibility range. +#define CFG_NIC_HSI_SUP_RANGE 0xFD09 //H/W - S/W I/F supplier range +#define CFG_NIC_SERIAL_NUMBER 0xFD0A //[PRI] Network Interface Card serial number. +#define CFG_NIC_IDENTITY 0xFD0B //[PRI] Network Interface Card identification. +#define CFG_NIC_MFI_SUP_RANGE 0xFD0C //[PRI] Modem I/F Supplier compatibility range. +#define CFG_NIC_CFI_SUP_RANGE 0xFD0D //[PRI] Controller I/F Supplier compatibility range. +#define CFG_CHANNEL_LIST 0xFD10 //Allowed communication channels. +#define CFG_NIC_TEMP_TYPE 0xFD12 //Hardware temperature range code. +#define CFG_CIS 0xFD13 //PC Card Standard Card Information Structure +#define CFG_NIC_PROFILE 0xFD14 //Card Profile +#define CFG_FW_IDENTITY 0xFD20 //firmware identification. +#define CFG_FW_SUP_RANGE 0xFD21 //firmware Supplier compatibility range. +#define CFG_MFI_ACT_RANGES_STA 0xFD22 //[STA] Modem I/F Actor compatibility ranges. +#define CFG_CFI_ACT_RANGES_STA 0xFD23 //[STA] Controller I/F Actor compatibility ranges. +#define CFG_NIC_BUS_TYPE 0xFD24 //Card Bustype +#define CFG_NIC_BUS_TYPE_PCCARD_CF 0x0000 //16 bit PC Card or Compact Flash +#define CFG_NIC_BUS_TYPE_USB 0x0001 //USB +#define CFG_NIC_BUS_TYPE_CARDBUS 0x0002 //CardBus +#define CFG_NIC_BUS_TYPE_PCI 0x0003 //(mini)PCI +#define CFG_DOMAIN_CODE 0xFD25 + +// MAC INFORMATION +#define CFG_PORT_STAT 0xFD40 //Actual MAC Port connection control status +#define CFG_CUR_SSID 0xFD41 //[STA] Identification of the actually connected SS +#define CFG_CUR_BSSID 0xFD42 //[STA] Identification of the actually connected BSS +#define CFG_COMMS_QUALITY 0xFD43 //[STA] Quality of the Basic Service Set connection +#define CFG_CUR_TX_RATE 0xFD44 //[STA] Actual transmit data rate +#define CFG_CUR_BEACON_INTERVAL 0xFD45 //Beacon transmit interval time for BSS creation +#define CFG_CUR_SCALE_THRH 0xFD46 //Actual System Scale thresholds settings +#define CFG_PROTOCOL_RSP_TIME 0xFD47 //Max time to await a response to a request message +#define CFG_CUR_SHORT_RETRY_LIMIT 0xFD48 //Max number of transmit attempts for short frames +#define CFG_CUR_LONG_RETRY_LIMIT 0xFD49 //Max number of transmit attempts for long frames +#define CFG_MAX_TX_LIFETIME 0xFD4A //Max transmit frame handling duration +#define CFG_MAX_RX_LIFETIME 0xFD4B //Max received frame handling duration +#define CFG_CF_POLLABLE 0xFD4C //[STA] Contention Free pollable capability indication +#define CFG_AUTHENTICATION_ALGORITHMS 0xFD4D //Available Authentication Algorithms indication +#define CFG_PRIVACY_OPT_IMPLEMENTED 0xFD4F //WEP Option availability indication + +#define CFG_CUR_REMOTE_RATES 0xFD50 //[STA] CurrentRemoteRates +#define CFG_CUR_USED_RATES 0xFD51 //[STA] CurrentUsedRates +#define CFG_CUR_SYSTEM_SCALE 0xFD52 //[STA] CurrentSystemScale + +#define CFG_CUR_TX_RATE1 0xFD80 //[AP] Actual Port 1 transmit data rate +#define CFG_CUR_TX_RATE2 0xFD81 //[AP] Actual Port 2 transmit data rate +#define CFG_CUR_TX_RATE3 0xFD82 //[AP] Actual Port 3 transmit data rate +#define CFG_CUR_TX_RATE4 0xFD83 //[AP] Actual Port 4 transmit data rate +#define CFG_CUR_TX_RATE5 0xFD84 //[AP] Actual Port 5 transmit data rate +#define CFG_CUR_TX_RATE6 0xFD85 //[AP] Actual Port 6 transmit data rate +#define CFG_NIC_MAC_ADDR 0xFD86 //Unique local node MAC Address +#define CFG_PCF_INFO 0xFD87 //[AP] Point Coordination Function capability info +//*RESERVED* #define CFG_HIGHEST_BASIC_RATE 0xFD88 // +#define CFG_CUR_COUNTRY_INFO 0xFD89 // +#define CFG_CUR_SSN_INFO_ELEMENT 0xFD8A // +#define CFG_CUR_TKIP_IV_INFO 0xFD8B // +#define CFG_CUR_ASSOC_REQ_INFO 0xFD8C // +#define CFG_CUR_ASSOC_RESP_INFO 0xFD8D // +#define CFG_CUR_LOAD 0xFD8E //[AP] current load on AP's channel + +#define CFG_SECURITY_CAPABILITIES 0xFD90 //Combined capabilities information + +// MODEM INFORMATION +#define CFG_PHY_TYPE 0xFDC0 //Physical layer type indication +#define CFG_CUR_CHANNEL 0xFDC1 //Actual frequency channel used for transmission +#define CFG_CUR_POWER_STATE 0xFDC2 //Actual power consumption status +#define CFG_CCA_MODE 0xFDC3 //Clear channel assessment mode indication +#define CFG_SUPPORTED_DATA_RATES 0xFDC6 //Data rates capability information + +#define CFG_RID_INF_MAX 0xFDFF //highest value representing an Information RID + +// ENGINEERING INFORMATION +#define CFG_RID_ENG_MIN 0xFFE0 //lowest value representing a Hermes engineering RID + + +/****************************** General define *************************************************************/ + + +//IFB field related +// IFB_CardStat +#define CARD_STAT_INCOMP_PRI 0x2000U // no compatible HSI / primary F/W +#define CARD_STAT_INCOMP_FW 0x1000U // no compatible station / tertiary F/W +#define CARD_STAT_DEFUNCT 0x0100U // HCF is in Defunct mode +// IFB_RxStat +#define RX_STAT_PRIO 0x00E0U //Priority subfield +#define RX_STAT_ERR 0x000FU //Error mask +#define RX_STAT_UNDECR 0x0002U //Non-decryptable encrypted message +#define RX_STAT_FCS_ERR 0x0001U //FCS error + +// SNAP header for E-II Encapsulation +#define ENC_NONE 0xFF +#define ENC_1042 0x00 +#define ENC_TUNNEL 0xF8 +/****************************** Xxxxxxxx *******************************************************************/ + + +#define HCF_SUCCESS 0x00 // OK +#define HCF_ERR_TIME_OUT 0x04 // Expected Hermes event did not occure in expected time +#define HCF_ERR_NO_NIC 0x05 /* card not found (usually yanked away during hcfio_in_string + * Also: card is either absent or disabled while it should be neither */ +#define HCF_ERR_LEN 0x08 /* buffer size insufficient + * - IFB_ConfigTable too small + * - hcf_get_info buffer has a size of 0 or 1 or less than needed + * to accomodate all data + * - hcf_put_info: CFG_DLNV_DATA exceeds intermediate + * buffer size */ +#define HCF_ERR_INCOMP_PRI 0x09 // primary functions are not compatible +#define HCF_ERR_INCOMP_FW 0x0A // station functions are compatible +#define HCF_ERR_MIC 0x0D // MIC check fails +#define HCF_ERR_SLEEP 0x0E // NIC in sleep mode +#define HCF_ERR_MAX 0x3F /* end of HCF range + *** ** *** ****** *** *************** */ +#define HCF_ERR_DEFUNCT 0x80 // BIT, reflecting that the HCF is in defunct mode (bits 0x7F reflect cause) +#define HCF_ERR_DEFUNCT_AUX 0x82 // Timeout on acknowledgement on en/disabling AUX registers +#define HCF_ERR_DEFUNCT_TIMER 0x83 // Timeout on timer calibration during initialization process +#define HCF_ERR_DEFUNCT_TIME_OUT 0x84 // Timeout on Busy bit drop during BAP setup +#define HCF_ERR_DEFUNCT_CMD_SEQ 0x86 // Hermes and HCF are out of sync in issuing/processing commands + +#define HCF_INT_PENDING 0x01 // return status of hcf_act( HCF_ACT_INT_OFF ) + +#define HCF_PORT_0 0x0000 // Station supports only single MAC Port +#define HCF_PORT_1 0x0100 // HCF_PORT_1 through HCF_PORT_6 are only supported by AP F/W +#define HCF_PORT_2 0x0200 +#define HCF_PORT_3 0x0300 +#define HCF_PORT_4 0x0400 +#define HCF_PORT_5 0x0500 +#define HCF_PORT_6 0x0600 + +#define HCF_CNTL_ENABLE 0x01 +#define HCF_CNTL_DISABLE 0x02 +#define HCF_CNTL_CONNECT 0x03 +#define HCF_CNTL_DISCONNECT 0x05 +#define HCF_CNTL_CONTINUE 0x07 + +#define USE_DMA 0x0001 +#define USE_16BIT 0x0002 +#define DMA_ENABLED 0x8000 //weak name, it really means: F/W enabled and DMA selected + +//#define HCF_DMA_FD_CNT (2*29) //size in bytes of one Tx/RxFS minus DA/SA +//;?the MSF ( H2PCI.C uses the next 2 mnemonics ) +#define HCF_DMA_RX_BUF1_SIZE (HFS_ADDR_DEST + 8) //extra bytes for LEN/SNAP if decapsulation +#define HCF_DMA_TX_BUF1_SIZE (HFS_ADDR_DEST + 2*6 + 8) //extra bytes for DA/SA/LEN/SNAP if encapsulation + +//HFS_TX_CNTL +/* Note that the HCF_.... System Constants influence the HFS_.... values below + * H-I H-I | H-II H-II H-II.5 + * WPA | WPA + * HFS_TX_CNTL_TX_OK 0002 0002 | 0002 0002 N/A <<<<<<<NULL pointer to matching CFG_RANGE_SPEC_STRCT substructure in actor-structure matching the supplier +* +*.NARRATIVE +* +* Parameters: +* actp address of the actor specification +* supp address of the supplier specification +* +* Description: mmd_check_comp is a support routine to check the compatibility between an actor and a +* supplier. mmd_check_comp is independent of the endianess of the actp and supp structures. This is +* achieved by checking the "bottom" or "role" fields of these structures. Since these fields are restricted +* to a limited range, comparing the contents to a value with a known endian-ess gives a clue to their actual +* endianess. +* +*.DIAGRAM +*1a: The role-field of the actor structure has a known non-zero, not "byte symmetric" value (namely +* COMP_ROLE_ACT or 0x0001), so if and only the contents of this field matches COMP_ROLE_ACT (in Native +* Endian format), the actor structure is Native Endian. +*2a: Since the role-field of the supplier structure is 0x0000, the test as used for the actor does not work +* for a supplier. A supplier has always exactly 1 variant,top,bottom record with (officially, but see the +* note below) each of these 3 values in the range 1 through 99, so one byte of the word value of variant, +* top and bottom words is 0x00 and the other byte is non-zero. Whether the lowest address byte or the +* highest address byte is non-zero depends on the Endianess of the LTV. If and only if the word value of +* bottom is less than 0x0100, the supplier is Native Endian. +* NOTE: the variant field of the supplier structure can not be used for the Endian Detection Algorithm, +* because a a zero-valued variant has been used as Controlled Deployment indication in the past. +* Note: An actor may have multiple sets of variant,top,bottom records, including dummy sets with variant, +* top and bottom fields with a zero-value. As a consequence the endianess of the actor can not be determined +* based on its variant,top,bottom values. +* +* Note: the L and T field of the structures are always in Native Endian format, so you can not draw +* conclusions concerning the Endianess of the structure based on these two fields. +* +*1b/2b +* The only purpose of the CFG_RANGE_SPEC_BYTE_STRCT is to give easy access to the non-zero byte of the word +* value of variant, top and bottom. The variables sup_endian and act_endian are used for the supplier and +* actor structure respectively. These variables must be 0 when the structure has LE format and 1 if the +* structure has BE format. This can be phrased as: +* the variable is false (i.e 0x0000) if either +* (the platform is LE and the LTV is the same as the platform) +* or +* (the platform is BE and the LTV differs from the platform). +* the variable is true (i.e 0x0001) if either +* (the platform is BE and the LTV is the same as the platform) +* or +* (the platform is LE and the LTV differs from the platform). +* +* Alternatively this can be phrased as: +* if the platform is LE +* if the LTV is LE (i.e the same as the platform), then the variable = 0 +* else (the LTV is BE (i.e. different from the platform) ), then the variable = 1 +* if the platform is BE +* if the LTV is BE (i.e the same as the platform), then the variable = 1 +* else (the LTV is LE (i.e. different from the platform) ), then the variable = 0 +* +* This is implemented as: +* #if HCF_BIG_ENDIAN == 0 //platform is LE +* sup/act_endian becomes reverse of structure-endianess as determined in 1a/1b +* #endif +*6: Each of the actor variant-bottom-top records is checked against the (single) supplier variant-bottom-top +* range till either an acceptable match is found or all actor records are tried. As explained above, due to +* the limited ranges of these values, checking a byte is acceptable and suitable. +*8: depending on whether a match was found or not (as reflected by the value of the control variable of the +* for loop), the NULL pointer or a pointer to the matching Number/Bottom/Top record of the Actor structure +* is returned. +* As an additional safety, checking the supplier length protects against invalid Supplier structures, which +* may be caused by failing hcf_get_info (in which case the len-field is zero). Note that the contraption +* "supp->len != sizeof(CFG_SUP_RANGE_STRCT)/sizeof(hcf_16) - 1" +* did turn out not to work for a compiler which padded the structure definition. +* +* Note: when consulting references like DesignNotes and Architecture specifications there is a confusing use +* of the notions number and variant. This resulted in an inconsistent use in the HCF nomenclature as well. +* This makes the logic hard to follow and one has to be very much aware of the context when walking through +* the code. +* NOTE: The Endian Detection Algorithm places limitations on future extensions of the fields, i.e. they should +* stay within the currently defined boundaries of 1 through 99 (although 1 through 255) would work as well +* and there should never be used a zero value for the bottom of a valid supplier. +* Note: relative to Asserts, the following can be observed: +* 1: Supplier variant 0x0000 has been used for Controlled Deployment +* 2: An actor may have one or more variant record specifications with a top of zero and a non-zero bottom +* to override the HCF default support of a particular variant by the MSF programmer via hcfcfg.h +* 3: An actor range can be specified as all zeros, e.g. as padding in the automatically generated firmware +* image files. +*.ENDDOC END DOCUMENTATION +*************************************************************************************************************/ +CFG_RANGE_SPEC_STRCT* +mmd_check_comp( CFG_RANGES_STRCT *actp, CFG_SUP_RANGE_STRCT *supp ) +{ + +CFG_RANGE_SPEC_BYTE_STRCT *actq = (CFG_RANGE_SPEC_BYTE_STRCT*)actp->var_rec; +CFG_RANGE_SPEC_BYTE_STRCT *supq = (CFG_RANGE_SPEC_BYTE_STRCT*)&(supp->variant); +hcf_16 i; +int act_endian; //actor endian flag +int sup_endian; //supplier endian flag + + act_endian = actp->role == COMP_ROLE_ACT; //true if native endian /* 1a */ + sup_endian = supp->bottom < 0x0100; //true if native endian /* 2a */ + +#if HCF_ASSERT + MMDASSERT( supp->len == 6, supp->len ) + MMDASSERT( actp->len >= 6 && actp->len%3 == 0, actp->len ) + + if ( act_endian ) { //native endian + MMDASSERT( actp->role == COMP_ROLE_ACT, actp->role ) + MMDASSERT( 1 <= actp->id && actp->id <= 99, actp->id ) + } else { //non-native endian + MMDASSERT( actp->role == CNV_END_SHORT(COMP_ROLE_ACT), actp->role ) + MMDASSERT( 1 <= CNV_END_SHORT(actp->id) && CNV_END_SHORT(actp->id) <= 99, actp->id ) + } + if ( sup_endian ) { //native endian + MMDASSERT( supp->role == COMP_ROLE_SUPL, supp->role ) + MMDASSERT( 1 <= supp->id && supp->id <= 99, supp->id ) + MMDASSERT( 1 <= supp->variant && supp->variant <= 99, supp->variant ) + MMDASSERT( 1 <= supp->bottom && supp->bottom <= 99, supp->bottom ) + MMDASSERT( 1 <= supp->top && supp->top <= 99, supp->top ) + MMDASSERT( supp->bottom <= supp->top, supp->bottom << 8 | supp->top ) + } else { //non-native endian + MMDASSERT( supp->role == CNV_END_SHORT(COMP_ROLE_SUPL), supp->role ) + MMDASSERT( 1 <= CNV_END_SHORT(supp->id) && CNV_END_SHORT(supp->id) <= 99, supp->id ) + MMDASSERT( 1 <= CNV_END_SHORT(supp->variant) && CNV_END_SHORT(supp->variant) <= 99, supp->variant ) + MMDASSERT( 1 <= CNV_END_SHORT(supp->bottom) && CNV_END_SHORT(supp->bottom) <=99, supp->bottom ) + MMDASSERT( 1 <= CNV_END_SHORT(supp->top) && CNV_END_SHORT(supp->top) <=99, supp->top ) + MMDASSERT( CNV_END_SHORT(supp->bottom) <= CNV_END_SHORT(supp->top), supp->bottom << 8 | supp->top ) + } +#endif // HCF_ASSERT + +#if HCF_BIG_ENDIAN == 0 + act_endian = !act_endian; /* 1b*/ + sup_endian = !sup_endian; /* 2b*/ +#endif // HCF_BIG_ENDIAN + + for ( i = actp->len ; i > 3; actq++, i -= 3 ) { /* 6 */ + MMDASSERT( actq->variant[act_endian] <= 99, i<<8 | actq->variant[act_endian] ) + MMDASSERT( actq->bottom[act_endian] <= 99 , i<<8 | actq->bottom[act_endian] ) + MMDASSERT( actq->top[act_endian] <= 99 , i<<8 | actq->top[act_endian] ) + MMDASSERT( actq->bottom[act_endian] <= actq->top[act_endian], i<<8 | actq->bottom[act_endian] ) + if ( actq->variant[act_endian] == supq->variant[sup_endian] && + actq->bottom[act_endian] <= supq->top[sup_endian] && + actq->top[act_endian] >= supq->bottom[sup_endian] + ) break; + } + if ( i <= 3 || supp->len != 6 /*sizeof(CFG_SUP_RANGE_STRCT)/sizeof(hcf_16) - 1 */ ) { + actq = NULL; /* 8 */ + } +#if HCF_ASSERT + if ( actq == NULL ) { + for ( i = 0; i <= supp->len; i += 2 ) { + MMDASSERT( DO_ASSERT, MERGE_2( ((hcf_16*)supp)[i], ((hcf_16*)supp)[i+1] ) ); + } + for ( i = 0; i <= actp->len; i += 2 ) { + MMDASSERT( DO_ASSERT, MERGE_2( ((hcf_16*)actp)[i], ((hcf_16*)actp)[i+1] ) ); + } + } +#endif // HCF_ASSERT + return (CFG_RANGE_SPEC_STRCT*)actq; +} // mmd_check_comp + diff --git a/drivers/staging/wlags49_h2/mmd.h b/drivers/staging/wlags49_h2/mmd.h new file mode 100644 index 000000000000..06890c1b30a4 --- /dev/null +++ b/drivers/staging/wlags49_h2/mmd.h @@ -0,0 +1,78 @@ + +// vim:tw=110:ts=4: +#ifndef MMD_H +#define MMD_H 1 + +/************************************************************************************************************* +* +* FILE : mmd.h +* +* DATE : $Date: 2004/07/19 08:16:14 $ $Revision: 1.2 $ +* Original: 2004/05/17 07:33:14 Revision: 1.18 Tag: hcf7_t20040602_01 +* Original: 2004/05/11 06:22:59 Revision: 1.17 Tag: hcf7_t7_20040513_01 +* Original: 2004/04/15 09:24:42 Revision: 1.13 Tag: hcf7_t7_20040415_01 +* Original: 2004/04/08 15:18:17 Revision: 1.12 Tag: t7_20040413_01 +* Original: 2004/04/01 15:32:55 Revision: 1.10 Tag: t7_20040401_01 +* Original: 2004/03/04 16:47:50 Revision: 1.7 Tag: t20040310_01 +* Original: 2004/03/03 12:47:05 Revision: 1.6 Tag: t20040304_01 +* Original: 2004/02/25 14:14:39 Revision: 1.5 Tag: t20040302_03 +* Original: 2004/02/24 13:00:29 Revision: 1.4 Tag: t20040224_01 +* Original: 2004/01/30 09:59:33 Revision: 1.3 Tag: t20040219_01 +* +* AUTHOR : Nico Valster +* +* DESC : Definitions and Prototypes for HCF, MSF, UIL as well as USF sources +* +*************************************************************************************************************** +* +* +* SOFTWARE LICENSE +* +* This software is provided subject to the following terms and conditions, +* which you should read carefully before using the software. Using this +* software indicates your acceptance of these terms and conditions. If you do +* not agree with these terms and conditions, do not use the software. +* +* COPYRIGHT © 2001 - 2004 by Agere Systems Inc. All Rights Reserved +* All rights reserved. +* +* Redistribution and use in source or binary forms, with or without +* modifications, are permitted provided that the following conditions are met: +* +* . Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following Disclaimer as comments in the code as +* well as in the documentation and/or other materials provided with the +* distribution. +* +* . Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following Disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* . Neither the name of Agere Systems Inc. nor the names of the contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* Disclaimer +* +* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY +* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN +* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +* DAMAGE. +* +* +**************************************************************************************************************/ +#ifndef HCF_H +#include "hcf.h" //just to get going with swig +#endif + +EXTERN_C CFG_RANGE_SPEC_STRCT* mmd_check_comp( CFG_RANGES_STRCT *actp, CFG_SUP_RANGE_STRCT *supp ); + +#endif // MMD_H diff --git a/drivers/staging/wlags49_h2/sta_h2.c b/drivers/staging/wlags49_h2/sta_h2.c new file mode 100644 index 000000000000..f9a38523724c --- /dev/null +++ b/drivers/staging/wlags49_h2/sta_h2.c @@ -0,0 +1,4480 @@ +/* + * File: sta_h24.236 + * + * Abstract: This file contains memory image 'fw_image'. + * + * Contents: Total size of the memory image: 69294 bytes. + * Total number of blocks: 4 blocks. + * Block 1 : load address 00000060, 390 bytes. + * Block 2 : load address 00000C16, 9496 bytes. + * Block 3 : load address 001E312E, 15786 bytes. + * Block 4 : load address 001F4000, 43622 bytes. + * + * Identity: component id: 31 (variant 3) version 2.36 + * + * Compatibility: + * supplying interface 4 (variant 2) : 2 - 5 + * acting on interface 1 (variant 4) : 6 - 7 + * acting on interface 1 (variant 5) : 6 - 7 + * acting on interface 1 (variant 6) : 6 - 7 + * acting on interface 2 (variant 2) : 1 - 2 + * + * Generated: by g:\fw\fupu3.exe version 4.26 + * + * Commandline: g:\fw\fupu3.exe /f=4 /n=fw_image /i=r3023600.hex + */ + + +#include "hcfcfg.h" // to get hcf_16 etc defined as well as + // possible settings which inluence mdd.h or dhf.h +#include "mdd.h" //to get COMP_ID_STA etc defined +#include "dhf.h" //used to be "fhfmem.h", to get memblock,plugrecord, + +static const hcf_8 fw_image_1_data[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x0D, 0x00, 0x00, + 0x3A, 0x0C, 0x00, 0x00, 0x3A, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x1B, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x86, 0x19, 0x86, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, + 0x06, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xEA, 0x00, 0x00, 0xFF, 0x07, 0x01, 0x00, 0x64, 0x00, 0x64, 0x00, 0x10, 0x27, 0x10, 0x27, + 0x14, 0x00, 0xD0, 0x07, 0xD0, 0x07, 0x10, 0x27, 0x2F, 0x00, 0x32, 0x00, 0x32, 0x00, 0x05, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x10, 0x27, 0x05, 0x00, 0x00, 0x02, 0x00, 0x02, 0x13, 0x00, 0x0A, 0x00, + 0x07, 0x00, 0x03, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x09, 0x2B, 0x09, 0x2B, 0x09, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x00, 0x14, 0x01, 0x00, 0x40, 0x00, 0x32, 0x00, 0x32, 0x00, + 0x0A, 0x00, 0x02, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + +}; /* fw_image_1_data */ + +static const hcf_8 fw_image_2_data[] = { + 0x4B, 0xA3, 0x00, 0x0A, 0x10, 0x01, 0x68, 0xA4, 0xB0, 0x01, 0x84, 0x01, 0x30, 0x33, 0x31, 0x33, + 0x44, 0x44, 0x30, 0x33, 0x31, 0x33, 0x30, 0x33, 0x31, 0x33, 0x32, 0x33, 0x32, 0x33, 0x90, 0x00, + 0x78, 0x04, 0xAE, 0xE4, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, + 0x0C, 0x0D, 0x0E, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA5, 0xC6, 0x84, 0xF8, 0x99, 0xEE, + 0x8D, 0xF6, 0x0D, 0xFF, 0xBD, 0xD6, 0xB1, 0xDE, 0x54, 0x91, 0x50, 0x60, 0x03, 0x02, 0xA9, 0xCE, + 0x7D, 0x56, 0x19, 0xE7, 0x62, 0xB5, 0xE6, 0x4D, 0x9A, 0xEC, 0x45, 0x8F, 0x9D, 0x1F, 0x40, 0x89, + 0x87, 0xFA, 0x15, 0xEF, 0xEB, 0xB2, 0xC9, 0x8E, 0x0B, 0xFB, 0xEC, 0x41, 0x67, 0xB3, 0xFD, 0x5F, + 0xEA, 0x45, 0xBF, 0x23, 0xF7, 0x53, 0x96, 0xE4, 0x5B, 0x9B, 0xC2, 0x75, 0x1C, 0xE1, 0xAE, 0x3D, + 0x6A, 0x4C, 0x5A, 0x6C, 0x41, 0x7E, 0x02, 0xF5, 0x4F, 0x83, 0x5C, 0x68, 0xF4, 0x51, 0x34, 0xD1, + 0x08, 0xF9, 0x93, 0xE2, 0x73, 0xAB, 0x53, 0x62, 0x3F, 0x2A, 0x0C, 0x08, 0x52, 0x95, 0x65, 0x46, + 0x5E, 0x9D, 0x28, 0x30, 0xA1, 0x37, 0x0F, 0x0A, 0xB5, 0x2F, 0x09, 0x0E, 0x36, 0x24, 0x9B, 0x1B, + 0x3D, 0xDF, 0x26, 0xCD, 0x69, 0x4E, 0xCD, 0x7F, 0x9F, 0xEA, 0x1B, 0x12, 0x9E, 0x1D, 0x74, 0x58, + 0x2E, 0x34, 0x2D, 0x36, 0xB2, 0xDC, 0xEE, 0xB4, 0xFB, 0x5B, 0xF6, 0xA4, 0x4D, 0x76, 0x61, 0xB7, + 0xCE, 0x7D, 0x7B, 0x52, 0x3E, 0xDD, 0x71, 0x5E, 0x97, 0x13, 0xF5, 0xA6, 0x68, 0xB9, 0x00, 0x00, + 0x2C, 0xC1, 0x60, 0x40, 0x1F, 0xE3, 0xC8, 0x79, 0xED, 0xB6, 0xBE, 0xD4, 0x46, 0x8D, 0xD9, 0x67, + 0x4B, 0x72, 0xDE, 0x94, 0xD4, 0x98, 0xE8, 0xB0, 0x4A, 0x85, 0x6B, 0xBB, 0x2A, 0xC5, 0xE5, 0x4F, + 0x16, 0xED, 0xC5, 0x86, 0xD7, 0x9A, 0x55, 0x66, 0x94, 0x11, 0xCF, 0x8A, 0x10, 0xE9, 0x06, 0x04, + 0x81, 0xFE, 0xF0, 0xA0, 0x44, 0x78, 0xBA, 0x25, 0xE3, 0x4B, 0xF3, 0xA2, 0xFE, 0x5D, 0xC0, 0x80, + 0x8A, 0x05, 0xAD, 0x3F, 0xBC, 0x21, 0x48, 0x70, 0x04, 0xF1, 0xDF, 0x63, 0xC1, 0x77, 0x75, 0xAF, + 0x63, 0x42, 0x30, 0x20, 0x1A, 0xE5, 0x0E, 0xFD, 0x6D, 0xBF, 0x4C, 0x81, 0x14, 0x18, 0x35, 0x26, + 0x2F, 0xC3, 0xE1, 0xBE, 0xA2, 0x35, 0xCC, 0x88, 0x39, 0x2E, 0x57, 0x93, 0xF2, 0x55, 0x82, 0xFC, + 0x47, 0x7A, 0xAC, 0xC8, 0xE7, 0xBA, 0x2B, 0x32, 0x95, 0xE6, 0xA0, 0xC0, 0x98, 0x19, 0xD1, 0x9E, + 0x7F, 0xA3, 0x66, 0x44, 0x7E, 0x54, 0xAB, 0x3B, 0x83, 0x0B, 0xCA, 0x8C, 0x29, 0xC7, 0xD3, 0x6B, + 0x3C, 0x28, 0x79, 0xA7, 0xE2, 0xBC, 0x1D, 0x16, 0x76, 0xAD, 0x3B, 0xDB, 0x56, 0x64, 0x4E, 0x74, + 0x1E, 0x14, 0xDB, 0x92, 0x0A, 0x0C, 0x6C, 0x48, 0xE4, 0xB8, 0x5D, 0x9F, 0x6E, 0xBD, 0xEF, 0x43, + 0xA6, 0xC4, 0xA8, 0x39, 0xA4, 0x31, 0x37, 0xD3, 0x8B, 0xF2, 0x32, 0xD5, 0x43, 0x8B, 0x59, 0x6E, + 0xB7, 0xDA, 0x8C, 0x01, 0x64, 0xB1, 0xD2, 0x9C, 0xE0, 0x49, 0xB4, 0xD8, 0xFA, 0xAC, 0x07, 0xF3, + 0x25, 0xCF, 0xAF, 0xCA, 0x8E, 0xF4, 0xE9, 0x47, 0x18, 0x10, 0xD5, 0x6F, 0x88, 0xF0, 0x6F, 0x4A, + 0x72, 0x5C, 0x24, 0x38, 0xF1, 0x57, 0xC7, 0x73, 0x51, 0x97, 0x23, 0xCB, 0x7C, 0xA1, 0x9C, 0xE8, + 0x21, 0x3E, 0xDD, 0x96, 0xDC, 0x61, 0x86, 0x0D, 0x85, 0x0F, 0x90, 0xE0, 0x42, 0x7C, 0xC4, 0x71, + 0xAA, 0xCC, 0xD8, 0x90, 0x05, 0x06, 0x01, 0xF7, 0x12, 0x1C, 0xA3, 0xC2, 0x5F, 0x6A, 0xF9, 0xAE, + 0xD0, 0x69, 0x91, 0x17, 0x58, 0x99, 0x27, 0x3A, 0xB9, 0x27, 0x38, 0xD9, 0x13, 0xEB, 0xB3, 0x2B, + 0x33, 0x22, 0xBB, 0xD2, 0x70, 0xA9, 0x89, 0x07, 0xA7, 0x33, 0xB6, 0x2D, 0x22, 0x3C, 0x92, 0x15, + 0x20, 0xC9, 0x49, 0x87, 0xFF, 0xAA, 0x78, 0x50, 0x7A, 0xA5, 0x8F, 0x03, 0xF8, 0x59, 0x80, 0x09, + 0x17, 0x1A, 0xDA, 0x65, 0x31, 0xD7, 0xC6, 0x84, 0xB8, 0xD0, 0xC3, 0x82, 0xB0, 0x29, 0x77, 0x5A, + 0x11, 0x1E, 0xCB, 0x7B, 0xFC, 0xA8, 0xD6, 0x6D, 0x3A, 0x2C, 0x00, 0x30, 0x00, 0x31, 0x00, 0x33, + 0x00, 0x34, 0x00, 0x35, 0x00, 0x36, 0x00, 0x37, 0x00, 0x38, 0x00, 0x38, 0x00, 0x3A, 0x00, 0x3B, + 0x00, 0x3C, 0x00, 0x3D, 0x00, 0x3E, 0x00, 0x3F, 0x00, 0x3F, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0A, 0x02, 0x14, + 0x05, 0x32, 0x0B, 0x37, 0x08, 0x50, 0x0B, 0x6E, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x3F, 0x00, + 0x0C, 0x00, 0x30, 0x00, 0x03, 0x00, 0x0F, 0x00, 0x3E, 0x00, 0x3C, 0x00, 0x02, 0x00, 0x04, 0x00, + 0x0A, 0x00, 0x0B, 0x00, 0x10, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x63, 0x00, 0x20, 0x00, 0x63, 0x00, 0x63, 0x00, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x10, + 0xEE, 0x10, 0xA6, 0x10, 0xE8, 0x10, 0xAC, 0x10, 0xE2, 0x10, 0xB2, 0x10, 0xDC, 0x10, 0xB8, 0x10, + 0xD6, 0x10, 0xBE, 0x10, 0xD0, 0x10, 0xC4, 0x10, 0xCA, 0x10, 0x07, 0x01, 0x00, 0x00, 0x0A, 0x22, + 0x00, 0x04, 0x08, 0x01, 0x00, 0x00, 0x0A, 0x26, 0x00, 0x04, 0x09, 0x01, 0x00, 0x00, 0x0A, 0x2A, + 0x00, 0x04, 0x0A, 0x01, 0x00, 0x00, 0x0A, 0x2E, 0x00, 0x04, 0x0B, 0x01, 0x00, 0x00, 0x10, 0x24, + 0x04, 0x04, 0x0C, 0x01, 0x00, 0x00, 0x10, 0x28, 0x04, 0x04, 0x0D, 0x01, 0x00, 0x00, 0x10, 0x2C, + 0x04, 0x04, 0x0E, 0x01, 0x00, 0x00, 0x10, 0x30, 0x04, 0x04, 0x0F, 0x01, 0x00, 0x00, 0x16, 0x34, + 0x08, 0x04, 0x10, 0x01, 0x00, 0x00, 0x16, 0x38, 0x08, 0x04, 0x11, 0x01, 0x00, 0x00, 0x16, 0x3C, + 0x08, 0x04, 0x12, 0x01, 0x00, 0x00, 0x16, 0x40, 0x08, 0x04, 0x13, 0x01, 0x00, 0x00, 0x17, 0x64, + 0x0C, 0x0B, 0x14, 0x01, 0x00, 0x00, 0x17, 0x68, 0x0C, 0x0B, 0x15, 0x01, 0x00, 0x00, 0x17, 0x6C, + 0x0C, 0x0B, 0x16, 0x01, 0x00, 0x00, 0x17, 0x70, 0x0C, 0x0B, 0x17, 0x01, 0x00, 0x00, 0x17, 0x74, + 0x0C, 0x0B, 0x18, 0x01, 0x00, 0x00, 0x17, 0x78, 0x0C, 0x0B, 0x19, 0x01, 0x00, 0x00, 0x17, 0x7C, + 0x0C, 0x0B, 0x1A, 0x01, 0x00, 0x00, 0x17, 0x80, 0x0C, 0x0B, 0x1B, 0x01, 0x00, 0x00, 0x17, 0x84, + 0x0C, 0x0B, 0x1C, 0x01, 0x00, 0x00, 0x17, 0x88, 0x0C, 0x0B, 0x1D, 0x01, 0x00, 0x00, 0x17, 0x8C, + 0x0C, 0x0B, 0x1E, 0x01, 0x00, 0x00, 0x1D, 0x95, 0x17, 0x04, 0x1F, 0x01, 0x00, 0x00, 0x1D, 0x99, + 0x17, 0x04, 0x20, 0x01, 0x00, 0x00, 0x1D, 0x9D, 0x17, 0x04, 0x21, 0x01, 0x00, 0x00, 0x1D, 0xA1, + 0x17, 0x04, 0x22, 0x01, 0x00, 0x00, 0x0E, 0xA5, 0x00, 0x00, 0x10, 0x11, 0x30, 0x11, 0x50, 0x11, + 0x70, 0x11, 0xC8, 0x11, 0x18, 0x11, 0x38, 0x11, 0x58, 0x11, 0x78, 0x11, 0xD0, 0x11, 0x20, 0x11, + 0x40, 0x11, 0x60, 0x11, 0x80, 0x11, 0xD8, 0x11, 0x28, 0x11, 0x48, 0x11, 0x68, 0x11, 0x88, 0x11, + 0xE0, 0x11, 0x90, 0x11, 0x98, 0x11, 0xA0, 0x11, 0xA8, 0x11, 0xB0, 0x11, 0xB8, 0x11, 0xC0, 0x11, + 0xE8, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBE, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x36, 0x25, 0x4F, 0x25, 0x72, 0x25, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, 0xAC, 0x25, + 0x02, 0x2B, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, 0xF3, 0x2D, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, + 0xE1, 0x24, 0xE1, 0x24, 0x8B, 0x27, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, + 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, + 0xE1, 0x24, 0xE1, 0x24, 0xE5, 0x27, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, + 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, + 0xE1, 0x24, 0x59, 0x27, 0x73, 0x27, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, 0xE1, 0x24, + 0xE1, 0x24, 0x47, 0x23, 0xCE, 0x25, 0xE1, 0x25, 0x91, 0x26, 0x95, 0x26, 0xE1, 0x24, 0xE1, 0x24, + 0x44, 0x27, 0x51, 0xEA, 0xFF, 0xE9, 0x00, 0x00, 0x48, 0xEA, 0x00, 0x00, 0x00, 0x00, 0xC9, 0xEA, + 0x65, 0x25, 0x89, 0x25, 0x00, 0x00, 0xF8, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x13, 0x2B, 0xE0, 0xFC, + 0x4C, 0x28, 0xC6, 0x2A, 0x5A, 0x00, 0x02, 0x00, 0xF9, 0xFF, 0x4C, 0x28, 0x62, 0x28, 0x00, 0x01, + 0x02, 0x00, 0xF7, 0xFF, 0x4C, 0x28, 0x62, 0x28, 0x50, 0x28, 0x06, 0x00, 0xF0, 0xFF, 0x4C, 0x28, + 0x29, 0x28, 0x00, 0x00, 0x00, 0x02, 0xF6, 0xFF, 0x4C, 0x28, 0x62, 0x28, 0x6C, 0x00, 0x02, 0x00, + 0xF4, 0xFF, 0x4C, 0x28, 0x62, 0x28, 0xAA, 0x01, 0x02, 0x00, 0xF5, 0xFF, 0x4C, 0x28, 0xCF, 0x2A, + 0x42, 0x28, 0x02, 0x00, 0xE0, 0xFF, 0x4C, 0x28, 0x62, 0x28, 0xCE, 0x2D, 0x02, 0x00, 0xE1, 0xFF, + 0x4C, 0x28, 0x62, 0x28, 0xD0, 0x2D, 0x02, 0x00, 0xE2, 0xFF, 0x4C, 0x28, 0x62, 0x28, 0xD2, 0x2D, + 0x02, 0x00, 0xE3, 0xFF, 0x4C, 0x28, 0x62, 0x28, 0xCA, 0x2D, 0x02, 0x00, 0x03, 0xFC, 0x4C, 0x28, + 0x17, 0x2A, 0x16, 0x2D, 0x02, 0x00, 0x04, 0xFC, 0x4C, 0x28, 0x5C, 0x28, 0x58, 0x28, 0x22, 0x00, + 0x06, 0xFC, 0x4C, 0x28, 0x62, 0x28, 0x40, 0x28, 0x02, 0x00, 0x07, 0xFC, 0x4C, 0x28, 0x62, 0x28, + 0x9C, 0x28, 0x02, 0x00, 0x0E, 0xFC, 0x4C, 0x28, 0x29, 0x2A, 0xA6, 0x28, 0x22, 0x00, 0xB1, 0xFC, + 0x4C, 0x28, 0x1D, 0x2B, 0xA2, 0x29, 0x02, 0x00, 0x20, 0xFC, 0x4C, 0x28, 0x62, 0x28, 0xCC, 0x28, + 0x02, 0x00, 0x25, 0xFC, 0x4C, 0x28, 0x62, 0x28, 0xD6, 0x28, 0x02, 0x00, 0x26, 0xFC, 0x4C, 0x28, + 0x62, 0x28, 0xD8, 0x28, 0x02, 0x00, 0x27, 0xFC, 0x4C, 0x28, 0x62, 0x28, 0xDA, 0x28, 0x02, 0x00, + 0xB2, 0xFC, 0x4C, 0x28, 0x5C, 0x28, 0xC6, 0x29, 0x22, 0x00, 0xC1, 0xFC, 0x4C, 0x28, 0x62, 0x28, + 0x5A, 0x2D, 0x20, 0x00, 0xB0, 0xFC, 0x1F, 0x28, 0x22, 0x2B, 0x00, 0x00, 0x00, 0x00, 0xC4, 0xFC, + 0x1F, 0x28, 0xE7, 0x2A, 0x00, 0x00, 0x08, 0x00, 0xC8, 0xFC, 0x1F, 0x28, 0xE2, 0x2A, 0x00, 0x00, + 0x08, 0x00, 0xB4, 0xFC, 0x1F, 0x28, 0x60, 0x2B, 0x00, 0x00, 0x00, 0x00, 0xB6, 0xFC, 0x1F, 0x28, + 0x11, 0x2C, 0x00, 0x00, 0x00, 0x00, 0xB7, 0xFC, 0x1F, 0x28, 0x3B, 0x2C, 0x00, 0x00, 0x00, 0x00, + 0xB8, 0xFC, 0x1F, 0x28, 0x98, 0x2C, 0x00, 0x00, 0x00, 0x00, 0xB5, 0xFC, 0x4C, 0x28, 0x62, 0x28, + 0xC6, 0x2D, 0x02, 0x00, 0xB9, 0xFC, 0x4C, 0x28, 0x62, 0x28, 0xC8, 0x2D, 0x02, 0x00, 0x90, 0xFD, + 0x4C, 0x28, 0x29, 0x28, 0xCC, 0x2D, 0x02, 0x00, 0x23, 0xFC, 0x4C, 0x28, 0x62, 0x28, 0xD2, 0x28, + 0x02, 0x00, 0x29, 0xFC, 0x44, 0x29, 0xF1, 0x28, 0x00, 0x00, 0x00, 0x00, 0xC2, 0xFC, 0x4C, 0x28, + 0x62, 0x28, 0x0E, 0x2D, 0x02, 0x00, 0x32, 0xFC, 0x4C, 0x28, 0x62, 0x28, 0xA0, 0x01, 0x02, 0x00, + 0x33, 0xFC, 0x4C, 0x28, 0x62, 0x28, 0xA2, 0x01, 0x02, 0x00, 0x00, 0xFC, 0x4C, 0x28, 0x62, 0x28, + 0x56, 0x28, 0x02, 0x00, 0x01, 0xFC, 0x4C, 0x28, 0x62, 0x28, 0x50, 0x28, 0x06, 0x00, 0x02, 0xFC, + 0x4C, 0x28, 0xDC, 0x28, 0xA4, 0x29, 0x22, 0x00, 0x05, 0xFC, 0x4C, 0x28, 0x62, 0x28, 0x46, 0x28, + 0x02, 0x00, 0x08, 0xFC, 0x4C, 0x28, 0x62, 0x28, 0x4A, 0x28, 0x06, 0x00, 0x09, 0xFC, 0x4C, 0x28, + 0x62, 0x28, 0x9E, 0x28, 0x02, 0x00, 0x0B, 0xFC, 0x4C, 0x28, 0x62, 0x28, 0xA0, 0x28, 0x02, 0x00, + 0x0C, 0xFC, 0x4C, 0x28, 0x62, 0x28, 0xA2, 0x28, 0x02, 0x00, 0x0D, 0xFC, 0x4C, 0x28, 0x62, 0x28, + 0xA4, 0x28, 0x02, 0x00, 0x21, 0xFC, 0x4C, 0x28, 0x62, 0x28, 0xCE, 0x28, 0x02, 0x00, 0x80, 0xFC, + 0xB8, 0x28, 0xC8, 0x28, 0xE2, 0x28, 0xC0, 0x00, 0x81, 0xFC, 0x4C, 0x28, 0x62, 0x28, 0xA8, 0x01, + 0x02, 0x00, 0x83, 0xFC, 0x4C, 0x28, 0x62, 0x28, 0xAC, 0x01, 0x02, 0x00, 0x85, 0xFC, 0x4C, 0x28, + 0x49, 0x2A, 0xA6, 0x01, 0x02, 0x00, 0x86, 0xFC, 0x4C, 0x28, 0x5B, 0x2A, 0xB2, 0x01, 0x02, 0x00, + 0x28, 0xFC, 0x4C, 0x28, 0x62, 0x28, 0xDC, 0x28, 0x02, 0x00, 0x87, 0xFC, 0x4C, 0x28, 0x62, 0x28, + 0xEC, 0x29, 0x22, 0x03, 0x84, 0xFC, 0x4C, 0x28, 0x70, 0x2A, 0xB0, 0x01, 0x02, 0x00, 0x2B, 0xFC, + 0x4C, 0x28, 0x62, 0x28, 0x14, 0x31, 0x02, 0x00, 0xF8, 0xFF, 0x4C, 0x28, 0x62, 0x28, 0x0E, 0x31, + 0x02, 0x00, 0xF3, 0xFF, 0x4C, 0x28, 0x62, 0x28, 0x16, 0x31, 0x02, 0x00, 0x20, 0xFD, 0x7D, 0x28, + 0x29, 0x28, 0x23, 0x34, 0x08, 0x00, 0x21, 0xFD, 0x7D, 0x28, 0x29, 0x28, 0x27, 0x34, 0x0A, 0x00, + 0x22, 0xFD, 0x7D, 0x28, 0x29, 0x28, 0x2C, 0x34, 0x16, 0x00, 0x23, 0xFD, 0x7D, 0x28, 0x29, 0x28, + 0x37, 0x34, 0x0A, 0x00, 0x10, 0xFD, 0x4C, 0x28, 0x29, 0x28, 0x74, 0x01, 0x02, 0x00, 0x45, 0xFD, + 0x4C, 0x28, 0x29, 0x28, 0x00, 0x01, 0x02, 0x00, 0x47, 0xFD, 0x4C, 0x28, 0x29, 0x28, 0x78, 0x01, + 0x02, 0x00, 0x48, 0xFD, 0x9A, 0x29, 0x29, 0x28, 0xA0, 0x01, 0x02, 0x00, 0x49, 0xFD, 0x9A, 0x29, + 0x29, 0x28, 0xA2, 0x01, 0x02, 0x00, 0x4A, 0xFD, 0x4C, 0x28, 0x29, 0x28, 0x98, 0x01, 0x02, 0x00, + 0x4B, 0xFD, 0x4C, 0x28, 0x29, 0x28, 0x9A, 0x01, 0x02, 0x00, 0x4D, 0xFD, 0x7D, 0x28, 0x29, 0x28, + 0x3C, 0x34, 0x04, 0x00, 0x4F, 0xFD, 0xAE, 0x29, 0x29, 0x28, 0x1A, 0x2D, 0x02, 0x00, 0xC0, 0xFD, + 0x7D, 0x28, 0x29, 0x28, 0x3E, 0x34, 0x02, 0x00, 0xC2, 0xFD, 0xA4, 0x29, 0x29, 0x28, 0x00, 0x00, + 0x02, 0x00, 0xC3, 0xFD, 0x7D, 0x28, 0x29, 0x28, 0x3F, 0x34, 0x02, 0x00, 0x40, 0xFD, 0x75, 0x28, + 0x29, 0x28, 0xB8, 0x01, 0x02, 0x00, 0x24, 0xFD, 0xCB, 0x29, 0x29, 0x28, 0x00, 0x00, 0x02, 0x00, + 0x91, 0xFD, 0x4C, 0x28, 0x29, 0x28, 0x20, 0x24, 0x02, 0x00, 0x93, 0xFD, 0x4C, 0x28, 0x29, 0x28, + 0x26, 0x24, 0x02, 0x00, 0xC1, 0xFD, 0x4C, 0x28, 0x29, 0x28, 0xFE, 0x00, 0x02, 0x00, 0xC6, 0xFD, + 0xAA, 0x28, 0x29, 0x28, 0x28, 0x2D, 0x0A, 0x00, 0x89, 0xFD, 0x5B, 0x29, 0x29, 0x28, 0x00, 0x00, + 0x00, 0x00, 0x8A, 0xFD, 0x9A, 0x28, 0x29, 0x28, 0xA0, 0x2D, 0x24, 0x00, 0x41, 0xFD, 0x4C, 0x28, + 0x29, 0x28, 0x7A, 0x2D, 0x22, 0x00, 0x42, 0xFD, 0x4C, 0x28, 0x29, 0x28, 0x02, 0x01, 0x06, 0x00, + 0x43, 0xFD, 0xD8, 0x29, 0x29, 0x28, 0x00, 0x00, 0x06, 0x00, 0x44, 0xFD, 0xB8, 0x29, 0x29, 0x28, + 0xB4, 0x01, 0x02, 0x00, 0x46, 0xFD, 0x4C, 0x28, 0x29, 0x28, 0xBA, 0x01, 0x0C, 0x00, 0x4C, 0xFD, + 0x4C, 0x28, 0x29, 0x28, 0xEA, 0x29, 0x02, 0x00, 0x50, 0xFD, 0x4C, 0x28, 0x29, 0x28, 0xF4, 0x00, + 0x02, 0x00, 0x51, 0xFD, 0x4C, 0x28, 0x29, 0x28, 0xF6, 0x00, 0x02, 0x00, 0x52, 0xFD, 0x4C, 0x28, + 0x29, 0x28, 0xC6, 0x01, 0x02, 0x00, 0x8F, 0xFD, 0xEB, 0x29, 0x29, 0x28, 0x00, 0x00, 0x08, 0x00, + 0x92, 0xFD, 0x4C, 0x28, 0x29, 0x28, 0x54, 0x2D, 0x02, 0x00, 0x8C, 0xFD, 0x3F, 0x28, 0x29, 0x28, + 0x08, 0x2E, 0x56, 0x00, 0x8D, 0xFD, 0x3F, 0x28, 0x29, 0x28, 0x62, 0x2E, 0x14, 0x00, 0x00, 0xF1, + 0x46, 0x00, 0xE3, 0x27, 0x3A, 0x01, 0x01, 0xF1, 0x44, 0x07, 0xE1, 0x27, 0x3C, 0x01, 0x00, 0x03, + 0x2A, 0x68, 0x1E, 0x00, 0x76, 0x01, 0xFE, 0x00, 0xD6, 0x01, 0x02, 0x01, 0x3E, 0x01, 0xB8, 0x01, + 0x74, 0x27, 0x5A, 0x01, 0x20, 0x24, 0x20, 0x00, 0x00, 0x00, 0xBA, 0x1C, 0x00, 0x00, 0xBE, 0x1E, + 0x54, 0x01, 0x0B, 0x00, 0xBA, 0x00, 0xE4, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC4, 0xAF, 0x37, 0xAF, 0x43, 0xB0, + 0x4C, 0xB0, 0x48, 0xAF, 0xDE, 0xAF, 0xB6, 0xAF, 0x1C, 0x33, 0x7F, 0x32, 0x1C, 0x33, 0xF3, 0x32, + 0x89, 0x32, 0x7D, 0x32, 0x3B, 0x33, 0x4C, 0x33, 0x4C, 0x33, 0x4C, 0x33, 0x55, 0x33, 0x70, 0x33, + 0xCD, 0x33, 0xE9, 0x33, 0xF4, 0x32, 0x07, 0x33, 0xDB, 0x32, 0x10, 0x00, 0x12, 0x00, 0x13, 0x00, + 0x20, 0x00, 0x21, 0x00, 0x22, 0x00, 0x30, 0x00, 0x31, 0x00, 0x32, 0x00, 0x33, 0x00, 0x34, 0x00, + 0x35, 0x00, 0x36, 0x00, 0x37, 0x00, 0x38, 0x00, 0x39, 0x00, 0x3A, 0x00, 0x00, 0x00, 0x14, 0x01, + 0x14, 0x01, 0x14, 0x01, 0x14, 0x01, 0x14, 0x01, 0x14, 0x01, 0x14, 0x01, 0x14, 0x01, 0xF3, 0x02, + 0xAD, 0x03, 0x60, 0x04, 0x04, 0x05, 0x07, 0x06, 0x08, 0x07, 0x0A, 0x08, 0x16, 0x09, 0x44, 0x0A, + 0x04, 0x0B, 0x40, 0x0C, 0x80, 0x0D, 0x00, 0x0E, 0x84, 0x0F, 0x01, 0x10, 0x10, 0x11, 0x02, 0x14, + 0x40, 0x20, 0x32, 0x21, 0x32, 0x22, 0x04, 0x23, 0x01, 0x24, 0x0F, 0x25, 0x00, 0x26, 0x00, 0x27, + 0x00, 0x28, 0x00, 0x29, 0x00, 0x2A, 0x01, 0x2B, 0x06, 0x2C, 0x00, 0x38, 0x00, 0x39, 0xD6, 0x3A, + 0x00, 0x3B, 0x00, 0x3C, 0x14, 0x3D, 0x7F, 0x3E, 0x00, 0x3F, 0x68, 0x40, 0x75, 0x41, 0x07, 0x42, + 0x07, 0x43, 0x00, 0x45, 0x3B, 0x4A, 0x00, 0x4B, 0x00, 0x4C, 0x0F, 0x4D, 0x02, 0x75, 0x00, 0x76, + 0x80, 0x00, 0x08, 0x01, 0x09, 0x01, 0x09, 0x01, 0x0A, 0x01, 0x0A, 0x01, 0x0B, 0x01, 0x0B, 0x01, + 0x0C, 0x01, 0x0C, 0x01, 0x0D, 0x01, 0x0D, 0x01, 0x0E, 0x01, 0x0E, 0x01, 0x0F, 0x01, 0x0F, 0x01, + 0x10, 0x01, 0x10, 0x01, 0x11, 0x01, 0x11, 0x01, 0x12, 0x01, 0x12, 0x01, 0x13, 0x01, 0x13, 0x01, + 0x14, 0x01, 0x14, 0x01, 0x15, 0x01, 0x15, 0x01, 0x16, 0x01, 0x16, 0x01, 0x17, 0x01, 0x17, 0x01, + 0x18, 0x01, 0x18, 0x01, 0x19, 0x01, 0x19, 0x01, 0x4D, 0x01, 0x4D, 0x01, 0x4E, 0x01, 0x4E, 0x01, + 0x4F, 0x01, 0x4F, 0x01, 0x50, 0x01, 0x50, 0x01, 0x51, 0x01, 0x51, 0x01, 0x52, 0x01, 0x52, 0x01, + 0x53, 0x01, 0x53, 0x01, 0x54, 0x01, 0x54, 0x01, 0x65, 0x01, 0x65, 0x01, 0x66, 0x01, 0x66, 0x01, + 0x67, 0x01, 0x67, 0x01, 0x68, 0x01, 0x68, 0x01, 0x69, 0x01, 0x69, 0x01, 0x6A, 0x01, 0x6A, 0x01, + 0x6B, 0x01, 0x6B, 0x01, 0x6C, 0x01, 0x6C, 0x01, 0x6D, 0x01, 0x6D, 0x01, 0x6E, 0x01, 0x6E, 0x01, + 0x6F, 0x01, 0x6F, 0x01, 0x70, 0x01, 0x70, 0x01, 0x71, 0x01, 0x71, 0x01, 0x72, 0x01, 0x72, 0x01, + 0x73, 0x01, 0x73, 0x01, 0x74, 0x01, 0x74, 0x01, 0x75, 0x01, 0x75, 0x01, 0x76, 0x01, 0x76, 0x01, + 0x77, 0x01, 0x77, 0x01, 0x78, 0x01, 0x78, 0x01, 0x79, 0x01, 0x79, 0x01, 0x7A, 0x01, 0x7A, 0x01, + 0x7B, 0x01, 0x7B, 0x01, 0x7C, 0x01, 0x7C, 0x01, 0x7D, 0x01, 0x7D, 0x01, 0x7E, 0x01, 0x7E, 0x01, + 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, + 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, + 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, 0x7F, 0x01, + 0x7F, 0x01, 0x80, 0x12, 0x80, 0x12, 0x80, 0x12, 0x80, 0x12, 0x80, 0x12, 0x80, 0x12, 0x80, 0x12, + 0x80, 0x12, 0x80, 0x12, 0x80, 0x12, 0x80, 0x12, 0x80, 0x12, 0x80, 0x12, 0x80, 0x12, 0x80, 0x13, + 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, + 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, 0x80, 0x13, 0x51, 0x44, 0x51, 0x44, 0x51, 0x44, + 0x51, 0x44, 0x51, 0x44, 0x51, 0x44, 0x51, 0x44, 0x51, 0x44, 0x51, 0x44, 0x51, 0x44, 0x51, 0x44, + 0x51, 0x44, 0x51, 0x44, 0x51, 0x44, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, + 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x23, 0x46, 0x23, 0x46, + 0x23, 0x46, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, + 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1D, 0x47, 0x9A, 0x48, + 0xDA, 0x48, 0x1A, 0x48, 0x5A, 0x48, 0x9A, 0x48, 0xDA, 0x48, 0x1A, 0x48, 0x5A, 0x48, 0x9A, 0x48, + 0xDA, 0x48, 0x1A, 0x48, 0x5A, 0x48, 0x9A, 0x48, 0x33, 0x48, 0x78, 0x49, 0x78, 0x49, 0x79, 0x49, + 0x79, 0x49, 0x79, 0x49, 0x79, 0x49, 0x7A, 0x49, 0x7A, 0x49, 0x7A, 0x49, 0x7A, 0x49, 0x7B, 0x49, + 0x7B, 0x49, 0x7B, 0x49, 0x7C, 0x49, 0x32, 0x00, 0x46, 0x00, 0x5A, 0x00, 0x6E, 0x00, 0x82, 0x00, + 0x96, 0x00, 0xAA, 0x00, 0xBE, 0x00, 0xD2, 0x00, 0xE6, 0x00, 0xFA, 0x00, 0x0E, 0x01, 0x22, 0x01, + 0x52, 0x01, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x03, 0x00, 0x03, 0x00, + 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x15, 0x00, 0x6E, 0x6F, 0x6E, 0x2D, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, + 0x64, 0x20, 0x53, 0x53, 0x49, 0x44, 0x20, 0x21, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x09, 0x00, 0x00, 0x01, 0x00, 0x64, 0x00, 0x64, 0x00, + 0x00, 0x00, 0x48, 0x45, 0x52, 0x4D, 0x45, 0x53, 0x20, 0x32, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x15, 0x00, 0x6E, 0x6F, 0x6E, 0x2D, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, + 0x64, 0x20, 0x53, 0x53, 0x49, 0x44, 0x20, 0x21, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x09, 0x00, 0x00, 0x01, 0x00, 0x64, 0x00, 0x64, 0x00, + 0x00, 0x00, 0x48, 0x45, 0x52, 0x4D, 0x45, 0x53, 0x20, 0x32, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x46, 0x69, 0x72, 0x73, 0x74, 0x20, 0x57, 0x61, 0x76, 0x65, 0x4C, 0x41, 0x4E, 0x20, 0x49, 0x49, + 0x20, 0x53, 0x53, 0x49, 0x44, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x02, 0x01, 0x82, 0x84, 0x8B, 0x96, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x85, 0x00, 0x01, + 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x10, 0x00, 0x08, 0x00, 0x00, 0x01, 0x00, 0x01, + 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6E, 0x74, 0x20, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x53, 0x65, 0x74, 0x20, 0x49, 0x64, 0x65, 0x6E, 0x74, + 0x69, 0x66, 0x69, 0x65, 0x72, 0x20, 0x00, 0x00, 0x00, 0x00, 0x06, 0xDD, 0x00, 0x50, 0xF2, 0x01, + 0x01, 0x00, 0x00, 0x50, 0xF2, 0x05, 0x02, 0x00, 0x00, 0x50, 0xF2, 0x02, 0x00, 0x50, 0xF2, 0x04, + 0x02, 0x00, 0x00, 0x50, 0xF2, 0x00, 0x00, 0x50, 0xF2, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x15, 0x00, 0x14, 0x00, 0x15, 0x00, 0x36, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x14, 0x00, + 0x11, 0x00, 0x36, 0x00, 0x01, 0x00, 0x04, 0x00, 0x7A, 0x2D, 0x28, 0x2D, 0x0C, 0x2F, 0x10, 0x2F, + 0x14, 0x2F, 0xA0, 0x2D, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xC6, 0x29, 0x28, 0x2D, + 0xFF, 0xFF, 0x00, 0x00, 0x7A, 0x2D, 0x28, 0x2D, 0x0C, 0x2F, 0x10, 0x2F, 0x14, 0x2F, 0xA0, 0x2D, + 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x7A, 0x2D, 0x28, 0x2D, 0xFF, 0xFF, 0xE6, 0x2D, + 0x34, 0x2D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x00, 0x02, 0x06, 0x00, 0x00, 0x06, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + +}; /* fw_image_2_data */ + +static const hcf_8 fw_image_3_data[] = { + 0x00, 0xE1, 0x30, 0x40, 0x02, 0x36, 0xA1, 0xFF, 0x83, 0xFF, 0x8D, 0xFF, 0x5C, 0x44, 0x5C, 0x43, + 0x5C, 0x42, 0x5C, 0x41, 0x5C, 0x40, 0xAC, 0xFF, 0xAD, 0xFF, 0xE7, 0xE1, 0xAD, 0x60, 0x08, 0x78, + 0xFF, 0xFF, 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, 0x03, 0x02, 0x28, 0xE2, 0x40, 0xFF, 0xA1, 0xFF, + 0x84, 0xFF, 0xBB, 0x60, 0x18, 0x64, 0x40, 0x42, 0xB0, 0x60, 0x97, 0x64, 0x40, 0x40, 0xBD, 0xF3, + 0x80, 0xFB, 0x0F, 0x60, 0x9A, 0x63, 0xCA, 0xF3, 0xBD, 0xDB, 0x00, 0x60, 0x9A, 0x64, 0xBD, 0xDB, + 0x02, 0x64, 0xBD, 0xDB, 0x04, 0x64, 0xA3, 0xDB, 0x5C, 0x49, 0x0A, 0x64, 0x40, 0x4B, 0x5C, 0x5C, + 0x01, 0x60, 0x39, 0xE2, 0x04, 0x60, 0x00, 0x7A, 0x89, 0xFF, 0x03, 0x60, 0xFF, 0x73, 0x88, 0xFF, + 0xB0, 0x60, 0x97, 0x78, 0xFF, 0xFF, 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, 0x06, 0x02, 0x40, 0xFF, + 0x42, 0xFF, 0x43, 0xFF, 0x44, 0xFF, 0x45, 0xFF, 0xA1, 0xFF, 0x88, 0xFF, 0x85, 0xFF, 0x21, 0xE1, + 0x5C, 0x40, 0xBB, 0x60, 0x20, 0x78, 0xFF, 0xFF, 0xA2, 0xFF, 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, + 0x01, 0x02, 0xA1, 0xFF, 0x86, 0xFF, 0x88, 0xFF, 0x5C, 0x46, 0x5C, 0x49, 0x5C, 0x40, 0xE7, 0x60, + 0x58, 0x4F, 0x31, 0x78, 0xFF, 0xFF, 0xC7, 0x60, 0x58, 0x4F, 0xF6, 0x78, 0xFF, 0xFF, 0xCA, 0x60, + 0x58, 0x4F, 0x83, 0x78, 0xFF, 0xFF, 0xDD, 0x60, 0x58, 0x4F, 0x3D, 0x78, 0xFF, 0xFF, 0x1B, 0x60, + 0x58, 0x4F, 0x37, 0x78, 0xFF, 0xFF, 0xEC, 0x60, 0x58, 0x4F, 0x75, 0x78, 0xFF, 0xFF, 0xE0, 0x60, + 0x58, 0x4F, 0x1B, 0x78, 0xFF, 0xFF, 0xE4, 0x60, 0x58, 0x4F, 0xDC, 0x78, 0xFF, 0xFF, 0xF3, 0x60, + 0x58, 0x4F, 0xEB, 0x78, 0xFF, 0xFF, 0x13, 0xE1, 0xA3, 0xFF, 0xBF, 0x60, 0xE7, 0x78, 0xFF, 0xFF, + 0x03, 0xE1, 0xA3, 0xFF, 0xFE, 0xFC, 0xFF, 0xFC, 0x23, 0x60, 0xF4, 0x63, 0x17, 0xFD, 0xAE, 0xFF, + 0x25, 0x60, 0x11, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x26, 0x1A, 0x00, + 0x80, 0x3A, 0x15, 0x00, 0x81, 0xF1, 0x32, 0xF2, 0x33, 0xF2, 0xD0, 0x80, 0x82, 0xF1, 0x0F, 0x02, + 0xD0, 0x80, 0x34, 0xF2, 0x83, 0xF1, 0x0B, 0x02, 0xD0, 0x80, 0xFF, 0xFF, 0x08, 0x02, 0xDF, 0x60, + 0x58, 0x4F, 0x28, 0x78, 0xFF, 0xFF, 0x20, 0x60, 0x58, 0x4F, 0xBF, 0x78, 0xFF, 0xFF, 0x19, 0x60, + 0xE8, 0x78, 0xFF, 0xFF, 0x00, 0xF4, 0xAA, 0x60, 0xAA, 0x65, 0x09, 0xF2, 0x5A, 0xD0, 0xD4, 0x80, + 0x03, 0x64, 0x12, 0x02, 0xD0, 0x80, 0x1D, 0x60, 0x60, 0x65, 0x0E, 0x02, 0x5A, 0xD2, 0xFF, 0xFF, + 0xD4, 0x80, 0x01, 0x60, 0x00, 0x65, 0x08, 0x02, 0x5A, 0xD2, 0xFF, 0xFF, 0xD4, 0x80, 0xFF, 0xFF, + 0x03, 0x02, 0x19, 0x60, 0xE8, 0x78, 0xFF, 0xFF, 0x01, 0x60, 0xD6, 0x65, 0xA5, 0xD1, 0x5A, 0xD1, + 0x44, 0x48, 0x5A, 0xD1, 0x44, 0x4A, 0x26, 0x46, 0x3F, 0xF2, 0x00, 0xF4, 0x44, 0x4C, 0xD8, 0x83, + 0x70, 0x61, 0x68, 0x65, 0xD7, 0x80, 0xFF, 0xFF, 0x07, 0x0E, 0x08, 0xF2, 0x08, 0x00, 0x68, 0x65, + 0xD7, 0x80, 0xFF, 0xFF, 0x01, 0x0E, 0x03, 0x00, 0x19, 0x60, 0xFE, 0x78, 0xFF, 0xFF, 0x58, 0x4F, + 0x79, 0x00, 0x9C, 0x80, 0x01, 0x65, 0x02, 0x02, 0x00, 0x65, 0x02, 0x00, 0xFF, 0x3B, 0xF7, 0x01, + 0x58, 0x4F, 0x70, 0x00, 0x9C, 0x80, 0x45, 0x42, 0xEA, 0x02, 0x58, 0x4F, 0x6B, 0x00, 0x9C, 0x80, + 0xFF, 0xFF, 0xE5, 0x02, 0x58, 0x4F, 0x66, 0x00, 0x9C, 0x80, 0xFF, 0xFF, 0x03, 0x02, 0x00, 0x65, + 0x45, 0x42, 0xF8, 0x01, 0xFF, 0x3A, 0x29, 0x00, 0x60, 0x47, 0xFF, 0xB5, 0x28, 0x44, 0xFF, 0xB4, + 0x94, 0x80, 0xFF, 0xFF, 0xD4, 0x02, 0x60, 0x45, 0x28, 0x47, 0x2A, 0x5F, 0x40, 0x48, 0x2A, 0x47, + 0x2C, 0x5F, 0x40, 0x4A, 0x2C, 0x47, 0x65, 0x5F, 0x40, 0x4C, 0x10, 0x64, 0x40, 0x42, 0x28, 0x45, + 0x05, 0x00, 0x58, 0x4F, 0x47, 0x00, 0x94, 0x80, 0x28, 0x45, 0x26, 0x02, 0x58, 0x4F, 0x42, 0x00, + 0x94, 0x80, 0x2A, 0x45, 0x21, 0x02, 0x58, 0x4F, 0x3D, 0x00, 0x94, 0x80, 0xFF, 0xFF, 0x1C, 0x02, + 0x22, 0x44, 0x4C, 0x82, 0x2C, 0x45, 0x31, 0x03, 0xEC, 0x01, 0x10, 0x65, 0x45, 0x42, 0x28, 0x45, + 0x94, 0x80, 0x2A, 0x45, 0x21, 0x02, 0x58, 0x4F, 0x2D, 0x00, 0x94, 0x80, 0x2C, 0x45, 0x1C, 0x02, + 0x58, 0x4F, 0x28, 0x00, 0x94, 0x80, 0xFF, 0xFF, 0x17, 0x02, 0x22, 0x44, 0x4C, 0x82, 0x28, 0x45, + 0x1C, 0x03, 0x58, 0x4F, 0x1F, 0x00, 0xEC, 0x01, 0x40, 0x4B, 0x28, 0x47, 0x40, 0x48, 0x2A, 0x47, + 0x40, 0x4A, 0x2C, 0x47, 0x60, 0x45, 0x2A, 0x5E, 0x40, 0x4C, 0x2A, 0x44, 0x28, 0x5E, 0x40, 0x4A, + 0x28, 0x44, 0x65, 0x5E, 0x40, 0x48, 0x2B, 0x44, 0x68, 0x65, 0xD7, 0x80, 0xFF, 0xFF, 0x17, 0x0E, + 0x90, 0x01, 0x26, 0x46, 0xC5, 0x60, 0x5B, 0x78, 0xFF, 0xFF, 0xB9, 0xFF, 0x26, 0x46, 0xC5, 0x60, + 0x5B, 0x78, 0xFF, 0xFF, 0xC9, 0x81, 0xCB, 0x83, 0x07, 0x1C, 0x01, 0x1D, 0x08, 0x00, 0x00, 0xF4, + 0x01, 0xF2, 0xFF, 0xFF, 0xFF, 0xB4, 0xD8, 0x81, 0x5A, 0xD2, 0x2F, 0x58, 0xFF, 0xFF, 0x26, 0x46, + 0xC5, 0x60, 0x58, 0x4F, 0x78, 0x78, 0xFF, 0xFF, 0x02, 0x60, 0x00, 0x63, 0x00, 0xF4, 0x84, 0x65, + 0x78, 0x61, 0xA5, 0xD0, 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0x64, 0x44, + 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, 0x05, 0x03, 0x64, 0x47, 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, + 0xF0, 0x02, 0x1C, 0x60, 0xAC, 0x63, 0x29, 0x60, 0xEC, 0x64, 0x08, 0x65, 0xC4, 0x81, 0x61, 0x44, + 0xA3, 0xDB, 0x1C, 0x60, 0xAA, 0x61, 0x00, 0x64, 0xA1, 0xDB, 0x29, 0x60, 0xEC, 0x61, 0xA1, 0xD3, + 0xFF, 0xFF, 0x60, 0x43, 0x1C, 0x60, 0xB0, 0x61, 0xA1, 0xDD, 0x1C, 0x60, 0xB0, 0x61, 0xA1, 0xD3, + 0xFF, 0xFF, 0x60, 0x45, 0x1C, 0x60, 0xAA, 0x61, 0xA1, 0xD3, 0xFF, 0xFF, 0xD4, 0x80, 0xFF, 0xFF, + 0x01, 0x03, 0x03, 0x00, 0x1A, 0x60, 0xD6, 0x78, 0xFF, 0xFF, 0x1C, 0x60, 0xA8, 0x61, 0x01, 0x64, + 0xA1, 0xDB, 0x02, 0x60, 0x00, 0x61, 0x41, 0x4C, 0x03, 0x60, 0x00, 0x61, 0x41, 0x4A, 0x1C, 0x60, + 0xAC, 0x61, 0xA1, 0xD3, 0xFF, 0xFF, 0x40, 0x48, 0x1C, 0x60, 0xB2, 0x63, 0x28, 0x41, 0x06, 0x65, + 0xD5, 0x81, 0xA1, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x26, 0x01, 0xA4, 0x60, 0x41, 0xA3, 0xDB, + 0x2A, 0x43, 0x28, 0x45, 0xA5, 0xD1, 0xDA, 0x85, 0x64, 0x44, 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, + 0x05, 0x03, 0x64, 0x47, 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, 0xF4, 0x02, 0x28, 0x41, 0x1C, 0x60, + 0xB2, 0x63, 0xA3, 0xD3, 0xFF, 0xFF, 0x60, 0x45, 0x45, 0x8B, 0x1C, 0x60, 0xAE, 0x61, 0x2B, 0xD3, + 0xA1, 0xDB, 0x2C, 0x41, 0x28, 0x42, 0x4A, 0xD3, 0xFF, 0xFF, 0x60, 0x45, 0x45, 0x8C, 0x00, 0x7F, + 0x01, 0x7E, 0x40, 0x48, 0x1C, 0x60, 0xB2, 0x61, 0xA1, 0xD3, 0xFF, 0xFF, 0x60, 0x45, 0x00, 0x64, + 0xD4, 0x80, 0xFF, 0xFF, 0x43, 0x03, 0x65, 0x44, 0xFF, 0xA4, 0xA1, 0xDB, 0x1C, 0x60, 0xAE, 0x61, + 0xA1, 0xD3, 0x28, 0x45, 0xA4, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x2C, 0xD3, 0x2A, 0xD3, 0x60, 0x45, + 0xD4, 0x80, 0xFF, 0xFF, 0x01, 0x03, 0x14, 0x00, 0x28, 0x44, 0xE0, 0x84, 0xFF, 0xFF, 0x02, 0x24, + 0x01, 0x00, 0x08, 0x00, 0x2B, 0x44, 0x58, 0x8B, 0x1C, 0x60, 0xAE, 0x63, 0x2B, 0xD3, 0xA3, 0xDB, + 0x00, 0x7F, 0x01, 0x7E, 0x40, 0x48, 0x2A, 0x44, 0x58, 0x8A, 0x2C, 0x44, 0x58, 0x8C, 0xD2, 0x01, + 0x1C, 0x60, 0xA8, 0x61, 0x00, 0x64, 0xA1, 0xDB, 0x1C, 0x60, 0xAC, 0x61, 0xA1, 0xD3, 0xFF, 0xFF, + 0x60, 0x45, 0xFA, 0xA4, 0x60, 0x41, 0xA1, 0xD3, 0xFF, 0xFF, 0x60, 0x41, 0xC5, 0x81, 0x06, 0xA1, + 0x41, 0x48, 0x65, 0x41, 0xFC, 0xA1, 0xA1, 0xD3, 0x28, 0x41, 0x60, 0x40, 0x01, 0x26, 0x01, 0xA4, + 0x60, 0x45, 0xC5, 0x81, 0x61, 0x43, 0x1C, 0x60, 0xAC, 0x61, 0xA1, 0xDD, 0x1C, 0x60, 0xA8, 0x61, + 0xA1, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x26, 0x0D, 0x00, 0x1C, 0x60, 0xAA, 0x61, 0xA1, 0xD3, + 0xFF, 0xFF, 0x01, 0xA4, 0xA1, 0xDB, 0xFF, 0xFF, 0x1A, 0x60, 0x2C, 0x78, 0xFF, 0xFF, 0x19, 0x60, + 0xE8, 0x78, 0xFF, 0xFF, 0x19, 0x60, 0xEC, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x01, 0x60, 0xBA, 0x61, + 0x1F, 0x60, 0x08, 0x63, 0xA1, 0xD3, 0x04, 0xA1, 0x20, 0x7F, 0xBD, 0xDB, 0x32, 0x7E, 0x21, 0x7F, + 0xBD, 0xDB, 0xA1, 0xD3, 0xFF, 0xFF, 0x22, 0x7F, 0xA3, 0xDB, 0x10, 0x00, 0x01, 0x60, 0xBA, 0x61, + 0x1F, 0x60, 0x08, 0x63, 0xA1, 0xD3, 0x00, 0x66, 0x20, 0x7F, 0xBD, 0xDB, 0x59, 0xD3, 0xFF, 0xFF, + 0x21, 0x7F, 0xBD, 0xDB, 0x59, 0xD3, 0xFF, 0xFF, 0x22, 0x7F, 0xA3, 0xDB, 0x0F, 0x60, 0xD8, 0x62, + 0xA2, 0xD1, 0x9F, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0xDE, 0xFE, 0x0B, 0x04, 0x0F, 0x60, + 0xDA, 0x62, 0x40, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0x1A, 0x60, 0xFD, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x24, 0x60, 0x9A, 0x62, 0x1F, 0x60, 0x06, 0x64, 0xA2, 0xDB, 0x20, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x0F, 0x60, 0xDA, 0x62, 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, + 0x1B, 0x60, 0x25, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD8, 0x62, + 0xA2, 0xD1, 0x9F, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0xBE, 0xFE, 0x0F, 0x60, 0xD0, 0x62, + 0xA2, 0xD1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2E, 0x58, 0xFF, 0xFF, + 0x10, 0x60, 0x1E, 0x62, 0x1E, 0x60, 0xF4, 0x64, 0xA2, 0xDB, 0x1A, 0x60, 0x8A, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x06, 0xA2, 0x10, 0x60, 0x40, 0x64, 0xA2, 0xDB, 0x06, 0x64, 0x5A, 0xDB, 0x5A, 0xDB, + 0x1A, 0x60, 0x96, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x06, 0xA2, 0x10, 0x60, 0x44, 0x64, 0xA2, 0xDB, + 0x06, 0x64, 0x5A, 0xDB, 0x5A, 0xDB, 0x1A, 0x60, 0xA2, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x06, 0xA2, + 0x10, 0x60, 0x48, 0x64, 0xA2, 0xDB, 0x06, 0x64, 0x5A, 0xDB, 0x5A, 0xDB, 0xC0, 0xF1, 0x1A, 0x60, + 0xA6, 0x62, 0xA2, 0xD9, 0x10, 0x60, 0x3E, 0x62, 0x20, 0x60, 0x99, 0x64, 0xA2, 0xDB, 0x10, 0x60, + 0x42, 0x62, 0x20, 0x60, 0xA3, 0x64, 0xA2, 0xDB, 0x10, 0x60, 0x46, 0x62, 0x20, 0x60, 0xAD, 0x64, + 0xA2, 0xDB, 0x00, 0x60, 0x70, 0x61, 0xAE, 0x60, 0x58, 0x4D, 0xC4, 0x78, 0xFF, 0xFF, 0x66, 0x44, + 0x63, 0xFB, 0x04, 0x64, 0x03, 0xFA, 0xA9, 0xF3, 0x07, 0xFA, 0x00, 0x64, 0x3E, 0xFA, 0x3F, 0xFA, + 0x0F, 0x60, 0xDA, 0x62, 0x00, 0x60, 0x02, 0x64, 0xA2, 0xDB, 0x1B, 0x60, 0x8A, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD8, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x03, 0x64, + 0x6A, 0xFB, 0x0F, 0x4E, 0xE0, 0x60, 0x58, 0x4F, 0x8E, 0x78, 0xFF, 0xFF, 0x0E, 0x4F, 0x00, 0x64, + 0x6C, 0xFB, 0x63, 0xF5, 0xEB, 0xF3, 0x2F, 0xFA, 0xEC, 0xF3, 0x30, 0xFA, 0xED, 0xF3, 0x31, 0xFA, + 0x81, 0xF3, 0x2C, 0xFA, 0x32, 0xFA, 0x82, 0xF3, 0x2D, 0xFA, 0x33, 0xFA, 0x83, 0xF3, 0x2E, 0xFA, + 0x34, 0xFA, 0xBC, 0xF3, 0x19, 0xFA, 0x06, 0x60, 0x80, 0x64, 0x0E, 0xFA, 0x20, 0x60, 0x58, 0x4E, + 0x71, 0x78, 0xFF, 0xFF, 0xF7, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x0F, 0x60, 0xD0, 0x62, + 0xA2, 0xD1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x0F, 0x60, 0xD8, 0x62, + 0xA2, 0xD1, 0xFF, 0x60, 0x8F, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0xC1, 0xF1, 0x1A, 0x60, 0x9A, 0x62, + 0xA2, 0xD9, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x96, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x04, 0xFF, 0x00, 0x64, 0x6C, 0xFB, 0x0F, 0x60, 0xDA, 0x62, 0x00, 0x60, 0x74, 0x64, + 0xA2, 0xDB, 0x1B, 0x60, 0xDE, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, + 0xD8, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0x1E, 0x60, 0xF4, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x40, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xE0, 0x01, 0x00, 0x60, 0x20, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x11, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x20, 0x40, 0x50, 0x27, 0xD6, 0x01, 0xAF, 0xF3, 0xFF, 0xFF, + 0xFE, 0xA0, 0xFF, 0xFF, 0xD1, 0x06, 0x6C, 0xF3, 0xFF, 0xFF, 0xF6, 0xA0, 0xDC, 0x84, 0x01, 0x05, + 0xA2, 0xDB, 0xCA, 0x01, 0x00, 0x60, 0x10, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0xCE, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0x00, 0x00, 0xE0, 0xF3, 0x29, 0x45, 0xD4, 0x80, 0x6C, 0xF3, 0x03, 0x04, 0x1C, 0x60, + 0x55, 0x78, 0xFF, 0xFF, 0xF6, 0xA0, 0xFF, 0xFF, 0x03, 0x04, 0x1C, 0x60, 0x55, 0x78, 0xFF, 0xFF, + 0x0F, 0x60, 0xDA, 0x62, 0x00, 0x60, 0x64, 0x64, 0xA2, 0xDB, 0x1C, 0x60, 0x2A, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x04, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x1E, 0x60, 0xF4, 0x78, 0xFF, 0xFF, + 0x00, 0x60, 0x40, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xD2, 0x01, + 0x00, 0x60, 0x20, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0xE4, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x20, 0x40, + 0x50, 0x27, 0xDF, 0x01, 0xAF, 0xF3, 0xFF, 0xFF, 0xFE, 0xA0, 0xFF, 0xFF, 0xC3, 0x06, 0x6C, 0xF3, + 0xFF, 0xFF, 0xF6, 0xA0, 0xDC, 0x84, 0x01, 0x05, 0xA2, 0xDB, 0xBC, 0x01, 0x0F, 0x60, 0xD8, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x20, 0x40, 0x40, 0x2B, 0x0B, 0x00, 0x0F, 0x60, 0xDA, 0x62, 0x80, 0x60, + 0x00, 0x64, 0xA2, 0xDB, 0x1C, 0x60, 0x55, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x1C, 0x60, 0x92, 0x65, 0x01, 0x64, 0xA5, 0xDB, 0xC2, 0xF1, 0x1A, 0x60, 0x9A, 0x62, 0xA2, 0xD9, + 0x0C, 0x64, 0x53, 0xFB, 0x1C, 0x60, 0x77, 0x64, 0x6B, 0xFB, 0x1F, 0x60, 0x72, 0x78, 0xFF, 0xFF, + 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0xA2, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, 0xFF, 0x60, 0xDF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, + 0x88, 0xF1, 0x19, 0x60, 0x86, 0x63, 0xD3, 0x80, 0x68, 0xFD, 0x5F, 0x03, 0x68, 0xF3, 0xE2, 0xF1, + 0x60, 0x43, 0x29, 0x44, 0xA3, 0xD3, 0xC0, 0x85, 0xD4, 0x80, 0x5B, 0xD3, 0x56, 0x06, 0x60, 0x43, + 0x08, 0xA3, 0xBE, 0xD3, 0x83, 0xF1, 0xA3, 0xD3, 0xD0, 0x80, 0x82, 0xF1, 0x05, 0x02, 0xBF, 0xD3, + 0xD0, 0x80, 0x81, 0xF1, 0x01, 0x02, 0xD0, 0x80, 0xF8, 0xA3, 0x2B, 0x02, 0x1C, 0x60, 0xAB, 0x64, + 0x6B, 0xFB, 0x1F, 0x60, 0x29, 0x78, 0xFF, 0xFF, 0x01, 0xB0, 0x84, 0xF3, 0x3E, 0x03, 0x63, 0xF5, + 0x48, 0x7E, 0x2A, 0xFA, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, 0x28, 0x64, 0xA2, 0xDB, 0x66, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x0F, 0x60, 0xDA, 0x62, + 0x00, 0x60, 0x01, 0x64, 0xA2, 0xDB, 0x1C, 0x60, 0xC8, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, 0xFF, 0x60, 0xFE, 0x64, 0xA0, 0x84, 0xA2, 0xDB, + 0x1C, 0x00, 0x2D, 0x60, 0x7A, 0x65, 0xA5, 0xD3, 0x65, 0x41, 0x10, 0xA3, 0x01, 0xA4, 0xFE, 0xB4, + 0xC4, 0x85, 0xFE, 0xA1, 0xBD, 0xD3, 0x59, 0xD1, 0xFF, 0xFF, 0xD0, 0x80, 0xD5, 0x80, 0x05, 0x02, + 0x01, 0x03, 0xF8, 0x01, 0x1E, 0x60, 0xE8, 0x78, 0xFF, 0xFF, 0x68, 0xF3, 0x88, 0xF1, 0x04, 0xA4, + 0xD0, 0x80, 0xFF, 0xFF, 0x02, 0x03, 0x68, 0xFB, 0xA1, 0x01, 0xE0, 0xF3, 0x29, 0x45, 0xD4, 0x80, + 0xFF, 0xFF, 0x0C, 0x07, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x96, 0x64, 0xA2, 0xDB, 0x03, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x1B, 0x60, 0xB1, 0x78, 0xFF, 0xFF, 0xE1, 0xF3, 0x29, 0x45, + 0xD4, 0x80, 0xFF, 0xFF, 0x17, 0x06, 0x04, 0x65, 0xE9, 0x60, 0x58, 0x4E, 0x7B, 0x78, 0xFF, 0xFF, + 0x05, 0x64, 0xDC, 0xFB, 0xF2, 0xF3, 0xFF, 0xFF, 0x01, 0xBC, 0xF2, 0xFB, 0x24, 0x60, 0xAA, 0x62, + 0x1A, 0x60, 0x96, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x1D, 0x60, + 0x6D, 0x78, 0xFF, 0xFF, 0x0F, 0x60, 0xDA, 0x62, 0x00, 0x60, 0x74, 0x64, 0xA2, 0xDB, 0x1D, 0x60, + 0x24, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, + 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x1E, 0x60, + 0xF4, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x40, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0x1C, 0x60, 0x87, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x20, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x17, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x20, 0x40, 0x50, 0x27, 0xA7, 0x01, 0xAF, 0xF3, 0x6C, 0xF3, + 0xFE, 0xA0, 0xF6, 0xA0, 0x0A, 0x06, 0x03, 0x04, 0x00, 0x64, 0x55, 0xFB, 0x40, 0x49, 0x6C, 0xF3, + 0xFF, 0xFF, 0xF6, 0xA0, 0xDC, 0x84, 0x01, 0x05, 0xA2, 0xDB, 0x1C, 0x60, 0x87, 0x78, 0xFF, 0xFF, + 0x00, 0x60, 0x10, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0xC6, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x24, 0x60, + 0xAA, 0x62, 0x1A, 0x60, 0xA2, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, + 0x1C, 0x60, 0x55, 0x78, 0xFF, 0xFF, 0x1C, 0x60, 0xEC, 0x78, 0xFF, 0xFF, 0x0F, 0x60, 0xD8, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x20, 0x40, 0x40, 0x2B, 0x0B, 0x00, 0x0F, 0x60, 0xDA, 0x62, 0x80, 0x60, + 0x00, 0x64, 0xA2, 0xDB, 0x1D, 0x60, 0x6D, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x1C, 0x60, 0x92, 0x65, 0x00, 0x64, 0xA5, 0xDB, 0xC3, 0xF1, 0x1A, 0x60, 0x9A, 0x62, 0xA2, 0xD9, + 0x1F, 0x60, 0x80, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0x08, 0xB4, 0x01, 0xBC, 0x29, 0x02, 0xA2, 0xDB, + 0x0F, 0x60, 0xD8, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x0F, 0x4E, 0xE4, 0x60, 0x58, 0x4F, 0xFB, 0x78, + 0xFF, 0xFF, 0x0E, 0x4F, 0x0F, 0x60, 0xDA, 0x62, 0x10, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0x1D, 0x60, + 0xA4, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x1F, 0x60, 0x80, 0x64, 0xA0, 0xD3, + 0xFF, 0xFF, 0x60, 0x40, 0x0C, 0x26, 0x0C, 0x00, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x96, 0x64, + 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x1E, 0x60, 0x97, 0x78, 0xFF, 0xFF, + 0x01, 0x64, 0x31, 0x60, 0x2A, 0x62, 0xA2, 0xDB, 0x0D, 0x64, 0x53, 0xFB, 0x1D, 0x60, 0xC3, 0x64, + 0x6B, 0xFB, 0x1F, 0x60, 0x72, 0x78, 0xFF, 0xFF, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0xA2, 0x64, + 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, + 0xFF, 0x60, 0xDF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x88, 0xF1, 0x19, 0x60, 0x86, 0x63, 0xD3, 0x80, + 0x68, 0xFD, 0x01, 0x02, 0x43, 0x00, 0x68, 0xF3, 0x29, 0x41, 0xA0, 0xD1, 0x58, 0xD3, 0xD1, 0x80, + 0x64, 0x45, 0x60, 0x43, 0x0F, 0x05, 0x08, 0xA3, 0xBE, 0xD3, 0x83, 0xF1, 0xA3, 0xD3, 0xD0, 0x80, + 0x82, 0xF1, 0x05, 0x02, 0xBF, 0xD3, 0xD0, 0x80, 0x81, 0xF1, 0x01, 0x02, 0xD0, 0x80, 0xF8, 0xA3, + 0x07, 0x02, 0x45, 0x49, 0x1E, 0x60, 0x2A, 0x64, 0x6B, 0xFB, 0x1F, 0x60, 0x29, 0x78, 0xFF, 0xFF, + 0x2D, 0x60, 0x7A, 0x65, 0xA5, 0xD3, 0x65, 0x41, 0x10, 0xA3, 0x01, 0xA4, 0xFE, 0xB4, 0xC4, 0x85, + 0xFE, 0xA1, 0xBD, 0xD3, 0x59, 0xD1, 0xFF, 0xFF, 0xD0, 0x80, 0xD5, 0x80, 0x0F, 0x02, 0xF9, 0x02, + 0x05, 0x65, 0xE9, 0x60, 0x58, 0x4E, 0x7B, 0x78, 0xFF, 0xFF, 0x04, 0x64, 0xDC, 0xFB, 0xF2, 0xF3, + 0xFF, 0xFF, 0xFE, 0xB4, 0xF2, 0xFB, 0x1E, 0x60, 0xE8, 0x78, 0xFF, 0xFF, 0x68, 0xF3, 0x88, 0xF1, + 0x04, 0xA4, 0xD0, 0x80, 0xFF, 0xFF, 0x02, 0x03, 0x68, 0xFB, 0xBD, 0x01, 0xE1, 0xF3, 0x29, 0x45, + 0xD4, 0x80, 0xFF, 0xFF, 0x75, 0x05, 0x1E, 0x60, 0x2A, 0x63, 0x6B, 0xFD, 0x1A, 0x60, 0x4C, 0x63, + 0x1F, 0x60, 0x29, 0x78, 0xFF, 0xFF, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x96, 0x64, 0xA2, 0xDB, + 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x05, 0x65, 0xE9, 0x60, 0x58, 0x4E, 0x7B, 0x78, + 0xFF, 0xFF, 0x1F, 0x60, 0x52, 0x61, 0x00, 0x64, 0xA1, 0xDB, 0x04, 0x64, 0xDC, 0xFB, 0xF2, 0xF3, + 0xFF, 0xFF, 0xFE, 0xB4, 0xF2, 0xFB, 0x84, 0xF3, 0x63, 0xF5, 0x48, 0x7E, 0x2A, 0xFA, 0x02, 0x60, + 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, 0x28, 0x64, 0xA2, 0xDB, + 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x0F, 0x60, + 0xDA, 0x62, 0x00, 0x60, 0x01, 0x64, 0xA2, 0xDB, 0x1E, 0x60, 0x61, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, 0xFF, 0x60, 0xFE, 0x64, 0xA0, 0x84, + 0xA2, 0xDB, 0x1A, 0x60, 0x9A, 0x62, 0x00, 0x60, 0x32, 0x64, 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, + 0x1A, 0x60, 0x96, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x0F, 0x60, + 0xDA, 0x62, 0x00, 0x60, 0x10, 0x64, 0xA2, 0xDB, 0x1E, 0x60, 0x81, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, 0xFF, 0x60, 0xEF, 0x64, 0xA0, 0x84, + 0xA2, 0xDB, 0xFD, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, + 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x1B, 0x60, 0xB1, 0x78, 0xFF, 0xFF, + 0x0F, 0x60, 0xDA, 0x62, 0x00, 0x60, 0x74, 0x64, 0xA2, 0xDB, 0x1E, 0x60, 0xA2, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x04, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x1E, 0x60, 0xF4, 0x78, 0xFF, 0xFF, + 0x00, 0x60, 0x40, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x1D, 0x60, + 0xD3, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x20, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x17, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0x20, 0x40, 0x50, 0x27, 0xDD, 0x01, 0xAF, 0xF3, 0x6C, 0xF3, 0xFE, 0xA0, 0xF6, 0xA0, + 0x0A, 0x06, 0x03, 0x04, 0x00, 0x64, 0x55, 0xFB, 0x40, 0x49, 0x6C, 0xF3, 0xFF, 0xFF, 0xF6, 0xA0, + 0xDC, 0x84, 0x01, 0x05, 0xA2, 0xDB, 0x1D, 0x60, 0xD3, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x10, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0xC6, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, + 0xA2, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x1D, 0x60, 0x6D, 0x78, + 0xFF, 0xFF, 0x08, 0x60, 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, 0x0F, 0x60, 0xEA, 0x62, 0xA2, 0xD1, + 0x00, 0x60, 0x20, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, + 0x8A, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x24, 0x60, 0xAA, 0x62, + 0x1A, 0x60, 0x96, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x24, 0x60, + 0xAA, 0x62, 0x1A, 0x60, 0xA2, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, + 0x0F, 0x60, 0xD8, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x5A, 0xDB, 0x00, 0x64, 0x6A, 0xFB, 0x0F, 0x60, + 0xD0, 0x62, 0xA2, 0xD1, 0x02, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x0F, 0x60, + 0xDA, 0x62, 0x00, 0x60, 0x02, 0x64, 0xA2, 0xDB, 0x1B, 0x60, 0x8A, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0xA3, 0xD3, 0x7F, 0xF1, 0x7E, 0xFB, 0xD0, 0x80, 0x00, 0x64, 0x40, 0x03, + 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, 0xBF, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0xDE, 0xFE, + 0x0B, 0x04, 0x0F, 0x60, 0xDA, 0x62, 0x40, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0x1F, 0x60, 0x2F, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, 0xDF, 0x60, + 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x7E, 0xF1, 0x7F, 0xF9, 0x24, 0x60, 0x9A, 0x62, 0xA2, 0xD9, + 0x1E, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x0F, 0x60, 0xDA, 0x62, 0x20, 0x60, 0x00, 0x64, + 0xA2, 0xDB, 0x1F, 0x60, 0x5E, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xBE, 0xFE, + 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, 0xDF, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x0F, 0x60, + 0xD0, 0x62, 0xA2, 0xD1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x01, 0x64, + 0x6B, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0x02, 0x60, 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, 0x0F, 0x60, + 0xD8, 0x62, 0xA2, 0xD1, 0x7F, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x20, 0x40, 0x51, 0x23, + 0x0B, 0x00, 0x0F, 0x60, 0xDA, 0x62, 0x80, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0x1F, 0x60, 0x76, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, 0x7F, 0x60, + 0xFF, 0x61, 0xA1, 0x84, 0x5A, 0xD1, 0x4A, 0xDB, 0xA1, 0x84, 0x5A, 0xDB, 0x40, 0x60, 0x00, 0x65, + 0x20, 0x44, 0x34, 0x80, 0x02, 0x64, 0x8C, 0xFB, 0xFF, 0xFF, 0xC1, 0xFE, 0x8C, 0xF3, 0x00, 0x65, + 0xD4, 0x80, 0xFF, 0xFF, 0x12, 0x03, 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, 0x7F, 0x60, 0xFF, 0x64, + 0xA0, 0x84, 0xA2, 0xDB, 0x0F, 0x60, 0xDA, 0x62, 0x80, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0x1F, 0x60, + 0x99, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x2D, 0x60, 0x7A, 0x64, 0x54, 0xFB, + 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, 0xEF, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x1A, 0x60, + 0x58, 0x4E, 0xDC, 0x78, 0xFF, 0xFF, 0x0F, 0x4E, 0xEC, 0x60, 0x58, 0x4F, 0xB9, 0x78, 0xFF, 0xFF, + 0x0E, 0x4F, 0x0F, 0x60, 0xDA, 0x62, 0x10, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0x1F, 0x60, 0xD3, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x1A, 0x60, 0x58, 0x4E, 0xED, 0x78, 0xFF, 0xFF, + 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x96, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, 0xEF, 0x60, 0xEF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, + 0x01, 0x64, 0x8C, 0xFB, 0xBF, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x01, 0x60, 0x14, 0x62, + 0xA2, 0xD1, 0x12, 0x60, 0x46, 0x63, 0xC3, 0x85, 0xC6, 0xA3, 0x3A, 0xA3, 0xD7, 0x80, 0xAF, 0xF3, + 0x09, 0x04, 0xFE, 0xA0, 0x6C, 0xF3, 0x3A, 0x06, 0xF6, 0xA0, 0x00, 0x64, 0x37, 0x04, 0x55, 0xFB, + 0x40, 0x49, 0x34, 0x00, 0x08, 0xA3, 0xBE, 0xD3, 0x83, 0xF1, 0xA3, 0xD3, 0xD0, 0x80, 0x82, 0xF1, + 0x05, 0x02, 0xBF, 0xD3, 0xD0, 0x80, 0x81, 0xF1, 0x01, 0x02, 0xD0, 0x80, 0xF8, 0xA3, 0xE5, 0x02, + 0xBE, 0xD3, 0x5A, 0xD1, 0x60, 0x47, 0x40, 0x4A, 0x64, 0x47, 0x40, 0x48, 0x20, 0x60, 0x58, 0x4E, + 0x45, 0x78, 0xFF, 0xFF, 0x0A, 0x48, 0x20, 0x60, 0x58, 0x4E, 0x55, 0x78, 0xFF, 0xFF, 0x20, 0x60, + 0x58, 0x4E, 0x71, 0x78, 0xFF, 0xFF, 0x01, 0x60, 0x2E, 0x65, 0x6C, 0xF3, 0xA5, 0xD3, 0xF6, 0xA0, + 0x40, 0xBC, 0x06, 0x04, 0xA5, 0xDB, 0x6A, 0xF1, 0xFF, 0x60, 0xFB, 0x64, 0xA0, 0x84, 0x6A, 0xFB, + 0x6C, 0xF3, 0xFF, 0xFF, 0x00, 0xB8, 0xCC, 0x84, 0x01, 0x03, 0xA2, 0xDB, 0xFD, 0x60, 0xFF, 0x65, + 0x20, 0x44, 0x24, 0x80, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0xC1, 0xFE, 0x6B, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0xF1, 0x28, 0x44, + 0xD0, 0x84, 0x03, 0xA4, 0x03, 0x0E, 0xE8, 0x84, 0xE8, 0x84, 0x04, 0x00, 0xFA, 0xA4, 0xE8, 0x84, + 0xE8, 0x87, 0xC0, 0xBF, 0xC0, 0x84, 0xA2, 0xDB, 0x2E, 0x58, 0xFF, 0xFF, 0x56, 0xF1, 0x28, 0x44, + 0xD0, 0x84, 0x1F, 0xA4, 0x06, 0x0E, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, + 0x07, 0x00, 0xC2, 0xA4, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x87, 0xF8, 0xBF, + 0xC0, 0x84, 0x5C, 0xF1, 0x56, 0xFB, 0xD0, 0x80, 0xFF, 0xFF, 0x01, 0x05, 0x64, 0x44, 0x52, 0xFB, + 0x2E, 0x58, 0xFF, 0xFF, 0x52, 0xF1, 0x00, 0x65, 0x20, 0x40, 0x20, 0x2A, 0x06, 0x00, 0x5C, 0xF3, + 0xFF, 0xFF, 0xD0, 0x80, 0x64, 0x45, 0x01, 0x06, 0x60, 0x45, 0x2F, 0x67, 0xD4, 0x80, 0xFF, 0xFF, + 0x01, 0x06, 0x60, 0x45, 0x55, 0xF1, 0x8B, 0x67, 0xD0, 0x80, 0x60, 0x41, 0x02, 0x24, 0x64, 0x41, + 0xD5, 0x84, 0x80, 0x65, 0xC4, 0x87, 0x01, 0x05, 0x00, 0x64, 0xFF, 0xB4, 0x40, 0x49, 0x20, 0x40, + 0x20, 0x2A, 0x06, 0x00, 0x2E, 0x43, 0xF3, 0x60, 0x58, 0x4E, 0xA8, 0x78, 0xFF, 0xFF, 0x43, 0x4E, + 0x2E, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x08, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, 0x00, 0x60, + 0x10, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xD8, 0x62, + 0xA2, 0xD1, 0x00, 0x60, 0x20, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x0F, 0x60, 0xF6, 0x62, + 0xA2, 0xD1, 0x00, 0x60, 0x40, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x26, 0x46, 0x27, 0xF2, 0x70, 0x63, 0x60, 0x40, 0x0A, 0x36, 0x06, 0x00, 0x14, 0x36, 0x0A, 0x00, + 0x37, 0x36, 0x04, 0x00, 0x6E, 0x36, 0x04, 0x00, 0xD0, 0x63, 0x04, 0x00, 0x33, 0x63, 0x02, 0x00, + 0x21, 0x63, 0x00, 0x00, 0x1F, 0x60, 0x5A, 0x61, 0xA1, 0xDD, 0x26, 0x46, 0xBF, 0xF2, 0x01, 0x60, + 0x00, 0x65, 0xF4, 0xA1, 0xD5, 0x80, 0x00, 0xF4, 0x02, 0x24, 0x65, 0x41, 0x41, 0x48, 0x1E, 0x65, + 0x02, 0x60, 0x00, 0x63, 0xA5, 0xD0, 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, + 0x64, 0x44, 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, 0x05, 0x03, 0x64, 0x47, 0x00, 0x7F, 0xCD, 0x81, + 0xBD, 0xDB, 0xF0, 0x02, 0x02, 0x60, 0x00, 0x63, 0x28, 0x41, 0xBD, 0xD3, 0xBD, 0xD1, 0xFD, 0xA0, + 0xFF, 0xFF, 0x07, 0x03, 0x64, 0x44, 0xE0, 0x85, 0xD1, 0x81, 0xFE, 0xA1, 0xC7, 0x83, 0xF5, 0x0D, + 0x04, 0x00, 0x1A, 0x60, 0x4C, 0x61, 0xA3, 0xD3, 0xA1, 0xDB, 0x31, 0x40, 0x06, 0x26, 0x58, 0x00, + 0x00, 0x64, 0x70, 0xFB, 0x02, 0x60, 0x00, 0x63, 0x28, 0x41, 0xBD, 0xD3, 0xBD, 0xD1, 0xFC, 0xA0, + 0xFB, 0xA0, 0x08, 0x03, 0x28, 0x03, 0x64, 0x44, 0xE0, 0x85, 0xD1, 0x81, 0xFE, 0xA1, 0xC7, 0x83, + 0xF4, 0x0D, 0x46, 0x00, 0xBD, 0xD3, 0xBD, 0xD3, 0x00, 0xB8, 0x70, 0xFB, 0x6F, 0xFB, 0xBD, 0xD3, + 0x3F, 0x02, 0xA3, 0xD3, 0x60, 0x45, 0x60, 0x47, 0xB4, 0x84, 0x60, 0x41, 0x3F, 0xB5, 0xE8, 0x84, + 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0x72, 0xFB, 0x65, 0x47, 0xE0, 0x84, + 0xE0, 0x84, 0x71, 0xFB, 0x64, 0x44, 0xE0, 0x85, 0xFA, 0xA3, 0xC7, 0x83, 0x1A, 0x60, 0x44, 0x62, + 0x61, 0x44, 0xA2, 0xDB, 0xD2, 0x01, 0xBD, 0xD3, 0xA3, 0xD3, 0x00, 0xB8, 0x6E, 0xFB, 0x74, 0xFB, + 0x1F, 0x02, 0x87, 0xF1, 0x70, 0xF3, 0x6D, 0xF9, 0x04, 0x65, 0x60, 0x40, 0x00, 0x3A, 0x06, 0x65, + 0x31, 0x44, 0xB4, 0x84, 0x40, 0x51, 0x02, 0x2A, 0x0B, 0x00, 0x08, 0xBC, 0x40, 0x51, 0x72, 0xF3, + 0x71, 0xF1, 0x00, 0xB8, 0x64, 0x45, 0x01, 0x03, 0x67, 0x45, 0x65, 0x50, 0xCC, 0x84, 0x73, 0xFB, + 0x0F, 0x60, 0xEA, 0x62, 0xA2, 0xD1, 0x01, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x0F, 0x60, 0xEC, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x2A, 0x84, 0x00, 0x1F, 0x60, + 0x52, 0x61, 0x01, 0x64, 0xA1, 0xDB, 0x22, 0x60, 0x58, 0x4E, 0x3E, 0x78, 0xFF, 0xFF, 0x26, 0x46, + 0x00, 0xF4, 0x0D, 0xF2, 0x80, 0xFB, 0x00, 0x64, 0x86, 0xFB, 0x0F, 0x60, 0xEA, 0x62, 0xA2, 0xD1, + 0x00, 0x60, 0x80, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x26, 0x46, 0x3F, 0xF2, 0x00, 0xF4, + 0x1E, 0x65, 0xF4, 0xA4, 0xD4, 0xA0, 0x60, 0x41, 0x01, 0x06, 0x2C, 0x61, 0x41, 0x48, 0x02, 0x60, + 0x00, 0x63, 0xA5, 0xD0, 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0x64, 0x44, + 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, 0x05, 0x03, 0x64, 0x47, 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, + 0xF0, 0x02, 0x02, 0x60, 0x00, 0x63, 0x28, 0x41, 0xBD, 0xD3, 0xBD, 0xD1, 0x01, 0xA8, 0xC9, 0x81, + 0x06, 0x03, 0x64, 0x44, 0xD1, 0x81, 0xE0, 0x85, 0x42, 0x06, 0xC7, 0x83, 0xF5, 0x01, 0x43, 0x48, + 0x2D, 0x60, 0x2A, 0x63, 0x43, 0x4A, 0x64, 0x41, 0x28, 0x43, 0x00, 0x65, 0x45, 0x4C, 0x65, 0x5C, + 0xBD, 0xD3, 0x61, 0x40, 0x00, 0x36, 0x27, 0x00, 0xCD, 0x81, 0x60, 0x40, 0x02, 0x36, 0x60, 0x45, + 0x04, 0x36, 0x60, 0x45, 0x82, 0x36, 0x60, 0x45, 0x84, 0x36, 0x60, 0x45, 0x0B, 0x36, 0x60, 0x45, + 0x8B, 0x36, 0x60, 0x45, 0x16, 0x36, 0x60, 0x45, 0x96, 0x36, 0x60, 0x45, 0x65, 0x40, 0x00, 0x36, + 0xE7, 0x01, 0x64, 0x44, 0xDC, 0x9C, 0x2C, 0x44, 0x00, 0x3A, 0x02, 0x00, 0x45, 0x4C, 0xE0, 0x01, + 0x2C, 0x5E, 0x65, 0x5F, 0x00, 0x65, 0x45, 0x4C, 0x43, 0x48, 0x2A, 0x43, 0xBD, 0xDB, 0xFF, 0xFF, + 0x43, 0x4A, 0x28, 0x43, 0xD5, 0x01, 0x2D, 0x60, 0x28, 0x64, 0x60, 0xFE, 0xA0, 0xD9, 0xFF, 0xFF, + 0x20, 0xFE, 0x64, 0x40, 0x01, 0x3A, 0x39, 0x00, 0x2A, 0x43, 0x65, 0x44, 0xA3, 0xDB, 0x35, 0x00, + 0x23, 0x60, 0x34, 0x78, 0xFF, 0xFF, 0xDC, 0xF3, 0xFF, 0xFF, 0x03, 0xA8, 0x02, 0xA8, 0x02, 0x03, + 0x41, 0x02, 0xF6, 0x01, 0x0F, 0x60, 0xEA, 0x62, 0xA2, 0xD1, 0xFF, 0x60, 0xFB, 0x64, 0xA0, 0x84, + 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x04, 0xFF, 0x26, 0x46, 0x1F, 0x60, 0x5A, 0x61, 0xA1, 0xD3, 0x25, 0xF2, 0x60, 0x45, + 0x24, 0xF0, 0x00, 0xF4, 0x64, 0x43, 0xC7, 0x83, 0x60, 0x41, 0x02, 0x24, 0x01, 0xA1, 0x0A, 0xF0, + 0x09, 0xF2, 0xD1, 0x80, 0xFF, 0xFF, 0x09, 0x07, 0x04, 0x04, 0x63, 0x45, 0xD4, 0x80, 0xFF, 0xFF, + 0x04, 0x06, 0x22, 0x60, 0x58, 0x4E, 0x3E, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x26, 0xF0, 0xFF, 0x67, + 0x20, 0x88, 0x64, 0x5F, 0x40, 0x4A, 0x20, 0x60, 0x58, 0x4E, 0x45, 0x78, 0xFF, 0xFF, 0x0A, 0x48, + 0x20, 0x60, 0x58, 0x4E, 0x55, 0x78, 0xFF, 0xFF, 0x20, 0x60, 0x58, 0x4E, 0x71, 0x78, 0xFF, 0xFF, + 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xDA, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x40, 0x22, + 0xAF, 0x01, 0x01, 0x60, 0x2E, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xBF, 0xB4, 0xA2, 0xDB, 0x1F, 0x60, + 0x5A, 0x61, 0xA1, 0xD3, 0x26, 0x46, 0x60, 0x45, 0x1E, 0x60, 0xFE, 0x63, 0x00, 0xF4, 0x09, 0xF2, + 0xBD, 0xDB, 0xFF, 0xFF, 0x0A, 0xF2, 0xBD, 0xDB, 0x0B, 0xF2, 0xFF, 0xFF, 0xBD, 0xDB, 0x0C, 0xF2, + 0xA3, 0xDB, 0xFA, 0xA3, 0x26, 0x46, 0xA3, 0xD3, 0x24, 0xF0, 0x00, 0x61, 0xD0, 0x84, 0xF1, 0x81, + 0xD4, 0x84, 0xF1, 0x81, 0xBD, 0xDB, 0xA3, 0xD3, 0x03, 0xB1, 0x03, 0xA9, 0x25, 0xF0, 0x42, 0xFE, + 0x05, 0x03, 0xFD, 0xA1, 0xCC, 0x84, 0x01, 0x02, 0xCC, 0x84, 0x00, 0x61, 0xF1, 0x81, 0xD0, 0x84, + 0xF1, 0x81, 0xBD, 0xDB, 0xA3, 0xD3, 0x03, 0xB1, 0x03, 0xA9, 0x28, 0xF0, 0x42, 0xFE, 0x01, 0x03, + 0xCC, 0x84, 0xF1, 0x81, 0xD0, 0x84, 0xF1, 0x81, 0xBD, 0xDB, 0xA3, 0xD3, 0x03, 0xB1, 0x03, 0xA9, + 0x29, 0xF0, 0x01, 0x03, 0xCC, 0x84, 0xD0, 0x84, 0xA3, 0xDB, 0x1F, 0x60, 0x52, 0x61, 0xA1, 0xD3, + 0xFF, 0xFF, 0x02, 0xA8, 0xFF, 0xFF, 0x02, 0x02, 0x2E, 0x58, 0xFF, 0xFF, 0xF5, 0xFE, 0x1E, 0x60, + 0xFE, 0x64, 0xA0, 0xD1, 0x06, 0xA4, 0xA0, 0xD3, 0x64, 0x45, 0x60, 0x40, 0x80, 0x2B, 0x03, 0x00, + 0xFF, 0x60, 0xFF, 0x64, 0x94, 0x85, 0x00, 0x60, 0x96, 0x64, 0xD4, 0x80, 0xFF, 0xFF, 0x0B, 0x06, + 0x1F, 0x60, 0x52, 0x61, 0xA1, 0xD3, 0x6A, 0xF3, 0x00, 0xA8, 0x04, 0xB0, 0x04, 0x02, 0x03, 0x03, + 0x23, 0x60, 0x10, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x00, 0xF4, 0x09, 0xF2, 0x5A, 0xD2, 0x40, 0x48, + 0x40, 0x4A, 0x5A, 0xD2, 0x5A, 0xD2, 0x40, 0x4C, 0x60, 0x41, 0x5A, 0xD0, 0x80, 0xF9, 0x40, 0x63, + 0xAD, 0x80, 0xF0, 0xA3, 0x09, 0x02, 0x3C, 0x03, 0x2C, 0x41, 0x2A, 0x44, 0x40, 0x4C, 0x28, 0x44, + 0x40, 0x4A, 0x00, 0x64, 0x40, 0x48, 0xF4, 0x01, 0xD1, 0x80, 0x01, 0x02, 0x31, 0x04, 0x10, 0xA3, + 0x80, 0x60, 0x00, 0x65, 0xA5, 0x80, 0xCF, 0x83, 0x08, 0x02, 0x28, 0x44, 0x60, 0x88, 0x2A, 0x44, + 0x70, 0x8A, 0x2C, 0x44, 0x70, 0x8C, 0xF1, 0x81, 0xF5, 0x01, 0xE7, 0xA3, 0x64, 0x44, 0x00, 0xA8, + 0x00, 0x62, 0x02, 0x02, 0x00, 0x61, 0x1C, 0x00, 0xE0, 0x84, 0xDE, 0x82, 0xFD, 0x04, 0x42, 0xFE, + 0xF8, 0x84, 0x62, 0x45, 0xC7, 0x83, 0x60, 0x45, 0x02, 0xFE, 0xD5, 0x84, 0x02, 0x05, 0x01, 0x05, + 0x61, 0x44, 0xCF, 0x83, 0x60, 0x41, 0x08, 0x03, 0x28, 0x44, 0x60, 0x88, 0x2A, 0x44, 0x70, 0x8A, + 0x2C, 0x44, 0x70, 0x8C, 0xF1, 0x81, 0xF1, 0x01, 0xCE, 0x82, 0xE9, 0x81, 0xFD, 0x02, 0xF1, 0x81, + 0x09, 0xF2, 0xFF, 0xFF, 0x60, 0x47, 0xE8, 0x84, 0xE8, 0x84, 0x5A, 0xD2, 0x3F, 0xB5, 0xE0, 0x84, + 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xB4, 0x84, 0x61, 0x45, 0xD4, 0x84, + 0xC0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x93, 0x1F, 0x60, 0x52, 0x61, 0xA1, 0xD3, + 0xFF, 0xFF, 0x00, 0xA8, 0xFF, 0xFF, 0x02, 0x03, 0x2E, 0x58, 0xFF, 0xFF, 0x10, 0x65, 0x73, 0x44, + 0xD4, 0x93, 0x6A, 0xF3, 0x26, 0x46, 0x04, 0xBC, 0xA2, 0xDB, 0x26, 0xF0, 0xFF, 0x67, 0x20, 0x88, + 0x64, 0x5F, 0x40, 0x4A, 0x20, 0x60, 0x58, 0x4E, 0x45, 0x78, 0xFF, 0xFF, 0x0A, 0x48, 0x20, 0x60, + 0x58, 0x4E, 0x55, 0x78, 0xFF, 0xFF, 0x20, 0x60, 0x58, 0x4E, 0x71, 0x78, 0xFF, 0xFF, 0x6C, 0xF3, + 0xFF, 0xFF, 0x00, 0xB8, 0xCC, 0x84, 0x01, 0x03, 0xA2, 0xDB, 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, + 0x00, 0x60, 0x40, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, + 0xA2, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x0F, 0x60, 0xD8, 0x62, + 0xA2, 0xD1, 0xFF, 0x60, 0xDF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x26, 0x46, 0x2F, 0x58, 0xFF, 0xFF, + 0x28, 0xF3, 0xFF, 0xFF, 0x60, 0x47, 0x0F, 0xB4, 0x59, 0x00, 0xFF, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x24, 0x60, 0x9E, 0x65, 0x04, 0x64, 0xA5, 0xDB, 0x12, 0x00, 0x24, 0x60, 0x9E, 0x65, 0x0C, 0x64, + 0xA5, 0xDB, 0x0D, 0x00, 0x24, 0x60, 0x9E, 0x65, 0x06, 0x64, 0xA5, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x24, 0x60, 0x9E, 0x65, 0x08, 0x64, 0xA5, 0xDB, 0x23, 0x60, + 0xA1, 0x64, 0xA1, 0xFB, 0xFF, 0xFF, 0x2D, 0xFF, 0x25, 0x60, 0x11, 0x78, 0xFF, 0xFF, 0x29, 0xF3, + 0x7F, 0xFB, 0xA4, 0xFB, 0x02, 0x60, 0xEE, 0x64, 0xA3, 0xFB, 0x07, 0x64, 0xA5, 0xFB, 0x23, 0x60, + 0xA1, 0x64, 0xA1, 0xFB, 0xFF, 0xFF, 0xDF, 0xFE, 0x00, 0x64, 0x19, 0xFF, 0x25, 0x60, 0x11, 0x78, + 0xFF, 0xFF, 0x24, 0x60, 0x0D, 0x63, 0x0C, 0x60, 0x16, 0x64, 0xA0, 0xDD, 0x62, 0xFF, 0x23, 0x60, + 0x8E, 0x63, 0xA1, 0xFD, 0xFF, 0xFF, 0x1A, 0xFF, 0x25, 0x60, 0x11, 0x78, 0xFF, 0xFF, 0xA3, 0x60, + 0x4B, 0x63, 0x0C, 0x60, 0x16, 0x64, 0xA0, 0xDD, 0x62, 0xFF, 0x29, 0xF5, 0x24, 0x60, 0x7A, 0x63, + 0x24, 0x60, 0x4C, 0x64, 0xBD, 0xDB, 0x66, 0x44, 0xBD, 0xDB, 0x02, 0x64, 0xA3, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0xF9, 0xFE, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xA7, 0x01, 0x00, 0x36, 0xA8, 0x01, + 0x01, 0x36, 0xAB, 0x01, 0x02, 0x36, 0xAE, 0x01, 0x03, 0x36, 0xB5, 0x01, 0x04, 0x36, 0xD1, 0x01, + 0x05, 0x36, 0xCF, 0x01, 0x06, 0x36, 0xF1, 0x01, 0x07, 0x36, 0xCB, 0x01, 0x08, 0x36, 0xB7, 0x01, + 0x09, 0x36, 0x0C, 0x00, 0x0A, 0x36, 0x0D, 0x00, 0x0B, 0x36, 0x0E, 0x00, 0x0C, 0x36, 0x17, 0x00, + 0x0D, 0x36, 0x0D, 0x00, 0x0E, 0x36, 0x1E, 0x00, 0x0F, 0x36, 0x32, 0x00, 0x02, 0x60, 0x00, 0x64, + 0x08, 0x00, 0x04, 0x60, 0x00, 0x64, 0x05, 0x00, 0x00, 0x60, 0x01, 0x64, 0x02, 0x00, 0x20, 0x60, + 0x00, 0x64, 0x32, 0x45, 0xB4, 0x85, 0x45, 0x52, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x24, 0x60, + 0xD1, 0x63, 0x0C, 0x60, 0x16, 0x64, 0xA0, 0xDD, 0x62, 0xFF, 0xFF, 0xFF, 0x1A, 0xFF, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x3F, 0x40, 0x02, 0x2B, 0x05, 0x00, 0x90, 0x60, 0x00, 0xE8, 0x24, 0x60, + 0x0D, 0x63, 0x04, 0x00, 0x91, 0x60, 0x00, 0xE8, 0x24, 0x60, 0xBB, 0x63, 0x28, 0xE8, 0x0C, 0x60, + 0x16, 0x64, 0xA0, 0xDD, 0x62, 0xFF, 0xFF, 0xFF, 0x1A, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x91, 0x60, 0x00, 0xE8, 0x28, 0xE8, 0xD9, 0x60, 0xFE, 0x64, 0x32, 0x45, 0xA4, 0x85, 0x45, 0x52, + 0x99, 0xFF, 0xA5, 0x4F, 0xFF, 0xB4, 0x07, 0xFB, 0x98, 0xFF, 0xA3, 0x60, 0x4B, 0x63, 0x0C, 0x60, + 0x16, 0x64, 0xA0, 0xDD, 0x62, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x08, 0xE1, 0xA1, 0xFF, + 0xFF, 0xFF, 0x43, 0xFF, 0x01, 0x60, 0x00, 0xE1, 0x28, 0xF3, 0x47, 0xFF, 0x60, 0x40, 0x07, 0x37, + 0x4B, 0x00, 0x05, 0x3B, 0x04, 0x00, 0xFF, 0x0A, 0x80, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x29, 0xF5, + 0x2A, 0xF3, 0x47, 0xFF, 0x3F, 0xF0, 0x01, 0x1B, 0x01, 0x64, 0x60, 0x56, 0xAD, 0xE2, 0xB5, 0xFF, + 0x6C, 0x40, 0x40, 0xE1, 0xA1, 0xFF, 0x00, 0xF4, 0x6E, 0x61, 0x12, 0x62, 0x64, 0x43, 0x01, 0xE1, + 0x03, 0x64, 0xE2, 0xD0, 0xC9, 0x81, 0x64, 0x4C, 0xCC, 0x84, 0xDA, 0x82, 0xFA, 0x02, 0x01, 0x60, + 0x00, 0x6B, 0x9A, 0xFF, 0xCA, 0x82, 0x03, 0x00, 0x00, 0xF4, 0x81, 0xF2, 0xFF, 0xFF, 0x7A, 0xD0, + 0xA1, 0xFF, 0x64, 0x4C, 0xFC, 0x1C, 0xF8, 0x1D, 0x00, 0xB9, 0x06, 0x1E, 0x02, 0x02, 0x00, 0xF4, + 0xDA, 0x82, 0x5A, 0xD2, 0xA1, 0xFF, 0x60, 0x4D, 0x3F, 0x40, 0x02, 0x2B, 0x08, 0x00, 0x28, 0xF3, + 0xA5, 0x60, 0xC4, 0x65, 0x60, 0x40, 0x0E, 0x3B, 0x02, 0x00, 0x80, 0x4C, 0xFE, 0x01, 0xA1, 0xFF, + 0x87, 0x4E, 0x87, 0x4C, 0x87, 0x4C, 0x87, 0x4C, 0x87, 0x4C, 0x67, 0x4C, 0xFF, 0xFF, 0xBC, 0xFF, + 0x00, 0xE1, 0xD5, 0xFE, 0xA1, 0xFF, 0xFF, 0xFF, 0x00, 0x64, 0x40, 0x46, 0x60, 0x41, 0xB5, 0xFF, + 0xB7, 0xFF, 0xB4, 0xFF, 0x29, 0xF5, 0x3F, 0xF0, 0x24, 0xF2, 0x44, 0x43, 0x40, 0x44, 0x00, 0xF4, + 0xF3, 0x60, 0xA0, 0x65, 0x10, 0x62, 0x5A, 0xD2, 0xD9, 0x81, 0xD4, 0x80, 0xFF, 0xFF, 0xFB, 0x02, + 0x61, 0x45, 0x24, 0x44, 0xD4, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xFD, 0xA5, 0x48, 0x60, + 0x00, 0x64, 0xC4, 0x9D, 0x0D, 0x60, 0x00, 0x6B, 0x24, 0x44, 0xC0, 0x83, 0xBB, 0xFF, 0x29, 0xF5, + 0x01, 0xE1, 0x00, 0xF4, 0x6C, 0x61, 0x10, 0x62, 0x05, 0x00, 0x00, 0xF4, 0x01, 0xF2, 0xFF, 0xFF, + 0x60, 0x41, 0x04, 0x62, 0xA1, 0xFF, 0xFF, 0xFF, 0x01, 0x10, 0x1A, 0x00, 0x26, 0x44, 0x01, 0x26, + 0x0C, 0x00, 0x24, 0x44, 0xC8, 0x84, 0x40, 0x44, 0x02, 0x03, 0x6C, 0x45, 0xF3, 0x01, 0x03, 0x15, + 0x01, 0x64, 0x05, 0xFA, 0x15, 0x00, 0x6C, 0x45, 0xED, 0x01, 0x23, 0x44, 0xC8, 0x84, 0x40, 0x43, + 0x02, 0x03, 0x6C, 0x45, 0xE7, 0x01, 0x00, 0x64, 0x01, 0x15, 0x01, 0x64, 0x6C, 0x45, 0x05, 0xFB, + 0xE2, 0xD2, 0xDA, 0x82, 0xC9, 0x81, 0x60, 0x4C, 0xDD, 0x1C, 0xD7, 0x03, 0xBC, 0xFF, 0xDA, 0x01, + 0x00, 0xE1, 0xD5, 0xFE, 0xA1, 0xFF, 0xFF, 0xFF, 0x08, 0xE1, 0xA1, 0xFF, 0x67, 0x4C, 0x43, 0xFF, + 0xAD, 0x4F, 0x02, 0xBC, 0x00, 0x7F, 0xA0, 0x5D, 0x01, 0xE1, 0x01, 0x60, 0x69, 0x6B, 0xA5, 0x60, + 0xC4, 0x64, 0x60, 0x4C, 0xBB, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x60, 0x4C, 0xA1, 0xFF, 0xFF, 0xFF, + 0x60, 0x4C, 0xFC, 0x01, 0x29, 0xF3, 0x2A, 0xF1, 0x07, 0xB5, 0x04, 0xE1, 0x65, 0x41, 0x64, 0x54, + 0xCD, 0xE2, 0x95, 0x81, 0xA1, 0x5D, 0xA1, 0xFF, 0xFF, 0xFF, 0xF9, 0x01, 0x61, 0x44, 0xFE, 0xFB, + 0xFF, 0xFD, 0xFF, 0x01, 0x7F, 0x67, 0x01, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0xB1, 0xFE, 0x08, 0x05, + 0xB0, 0xFE, 0x09, 0x05, 0xB2, 0xFE, 0xB3, 0xFE, 0x78, 0x43, 0x01, 0x61, 0x24, 0x60, 0xDD, 0x78, + 0x2D, 0x60, 0x5D, 0x78, 0xFF, 0xFF, 0x28, 0xF3, 0x29, 0xF1, 0x40, 0x44, 0x44, 0x45, 0x2A, 0xF1, + 0x2B, 0xF1, 0x44, 0x46, 0x44, 0x47, 0x3F, 0xB4, 0xE0, 0x85, 0x1F, 0x60, 0x88, 0x64, 0x44, 0xD7, + 0x58, 0x43, 0xFF, 0xFF, 0x60, 0x45, 0x1C, 0x60, 0xB4, 0x7C, 0xA4, 0xD3, 0x61, 0x43, 0x04, 0xB4, + 0x24, 0x44, 0x02, 0x03, 0x13, 0xFF, 0x06, 0x00, 0x3F, 0xB4, 0xB4, 0x84, 0xFF, 0x27, 0x05, 0xFD, + 0x04, 0xFB, 0x10, 0x75, 0xA1, 0xFF, 0xFF, 0xFF, 0x86, 0x3E, 0xB4, 0xFE, 0x0B, 0x05, 0xB5, 0xFE, + 0x02, 0x24, 0xA1, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0xB7, 0xFE, 0x07, 0x05, 0x78, 0x43, 0x01, 0x61, + 0x24, 0x60, 0xDD, 0x78, 0x2D, 0x60, 0x98, 0x78, 0xFF, 0xFF, 0x36, 0x44, 0x00, 0x7F, 0xF2, 0xA0, + 0x60, 0x45, 0x05, 0x05, 0x20, 0x60, 0x16, 0x64, 0x44, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0x78, 0x43, + 0x01, 0x61, 0x24, 0x60, 0xDD, 0x78, 0x78, 0x43, 0x01, 0x61, 0x24, 0x60, 0xDD, 0x78, 0x7F, 0x60, + 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, 0x10, 0x02, 0x10, 0x64, 0x40, 0x40, + 0x02, 0x64, 0x40, 0x50, 0x61, 0xFF, 0x3F, 0x40, 0x40, 0x26, 0x04, 0x00, 0x10, 0xE0, 0x46, 0x60, + 0x09, 0xE0, 0x00, 0x00, 0x27, 0xF1, 0x00, 0x66, 0x20, 0x78, 0x42, 0xFE, 0x23, 0x58, 0xFF, 0xFF, + 0x7F, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, 0x1A, 0x02, 0x1C, 0x60, + 0xB4, 0x63, 0xA3, 0xD3, 0x07, 0x7C, 0x20, 0xB5, 0x0C, 0xB5, 0x04, 0x03, 0x03, 0x02, 0xDC, 0xF9, + 0x00, 0x67, 0x0F, 0x00, 0x00, 0x61, 0x41, 0x56, 0xC7, 0xFE, 0xAC, 0x01, 0x36, 0x47, 0xFF, 0x23, + 0x04, 0x00, 0x00, 0x7F, 0x60, 0x41, 0x7F, 0x67, 0x04, 0x00, 0x20, 0x44, 0x80, 0xBC, 0x40, 0x40, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x7F, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, + 0x02, 0x61, 0x31, 0x02, 0x1C, 0x60, 0xB4, 0x63, 0xA3, 0xD3, 0x01, 0x7C, 0x20, 0xB5, 0x0C, 0xB5, + 0x03, 0x03, 0x02, 0x02, 0xDC, 0xF9, 0xFF, 0xFF, 0x02, 0x61, 0x41, 0x56, 0xC7, 0xFE, 0x25, 0x60, + 0x11, 0x78, 0xFF, 0xFF, 0x9F, 0xF1, 0x20, 0x44, 0x64, 0x40, 0xFF, 0x26, 0x1B, 0x00, 0x7F, 0xB4, + 0x40, 0x40, 0x5C, 0x5E, 0x82, 0xFF, 0x26, 0x44, 0xFD, 0xB4, 0x40, 0x46, 0x5C, 0x41, 0x87, 0xFF, + 0x62, 0xFF, 0x00, 0x63, 0x24, 0x60, 0x5E, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, + 0x04, 0x03, 0x09, 0xF2, 0x0F, 0xFC, 0xAC, 0x86, 0xFB, 0x01, 0x24, 0x60, 0x9E, 0x62, 0x06, 0x64, + 0xA2, 0xDB, 0x2D, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x00, 0x67, 0x20, 0x40, 0x80, 0x2A, + 0x02, 0x00, 0x7F, 0x67, 0x06, 0x61, 0x60, 0x45, 0x1C, 0x60, 0xB4, 0x7C, 0xA4, 0xD3, 0x61, 0x43, + 0x04, 0xB4, 0x24, 0x44, 0x02, 0x03, 0x13, 0xFF, 0x55, 0x01, 0x3F, 0xB4, 0xB4, 0x84, 0xFF, 0x27, + 0x05, 0xFD, 0x04, 0xFB, 0x20, 0x40, 0x80, 0x2A, 0x02, 0x00, 0x10, 0x75, 0x07, 0x00, 0x2D, 0x60, + 0x9C, 0x62, 0x01, 0x64, 0xA2, 0xDB, 0xFF, 0xFF, 0x08, 0x60, 0x10, 0x75, 0x43, 0x01, 0x25, 0x46, + 0x01, 0xF2, 0x08, 0xF0, 0x60, 0x47, 0x03, 0xB4, 0x03, 0xAC, 0x7F, 0x67, 0x03, 0x61, 0x08, 0x02, + 0x24, 0x60, 0x7A, 0x64, 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, 0xD8, 0x78, 0xFF, 0xFF, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x24, 0x40, 0x01, 0x2B, 0x49, 0x00, 0x25, 0x44, 0x1F, 0xB4, 0xE0, 0x85, + 0x25, 0x60, 0xEB, 0x64, 0xC4, 0x98, 0xFF, 0xFF, 0xC0, 0xFE, 0x3D, 0x00, 0xC1, 0xFE, 0x3B, 0x00, + 0xC2, 0xFE, 0x39, 0x00, 0xC3, 0xFE, 0x37, 0x00, 0xC4, 0xFE, 0x35, 0x00, 0xC5, 0xFE, 0x33, 0x00, + 0xC6, 0xFE, 0x31, 0x00, 0xC7, 0xFE, 0x2F, 0x00, 0xC8, 0xFE, 0x2D, 0x00, 0xC9, 0xFE, 0x2B, 0x00, + 0xCA, 0xFE, 0x29, 0x00, 0xCB, 0xFE, 0x27, 0x00, 0xCC, 0xFE, 0x25, 0x00, 0xCD, 0xFE, 0x23, 0x00, + 0xCE, 0xFE, 0x21, 0x00, 0xCF, 0xFE, 0x1F, 0x00, 0xD0, 0xFE, 0x1D, 0x00, 0xD1, 0xFE, 0x1B, 0x00, + 0xD2, 0xFE, 0x19, 0x00, 0xD3, 0xFE, 0x17, 0x00, 0xD4, 0xFE, 0x15, 0x00, 0xD5, 0xFE, 0x13, 0x00, + 0xD6, 0xFE, 0x11, 0x00, 0xD7, 0xFE, 0x0F, 0x00, 0xD8, 0xFE, 0x0D, 0x00, 0xD9, 0xFE, 0x0B, 0x00, + 0xDA, 0xFE, 0x09, 0x00, 0xDB, 0xFE, 0x07, 0x00, 0xDC, 0xFE, 0x05, 0x00, 0xDD, 0xFE, 0x03, 0x00, + 0xDE, 0xFE, 0x01, 0x00, 0xDF, 0xFE, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x00, 0x64, 0x9F, 0xFE, + 0xF0, 0x84, 0xFF, 0xFF, 0x9E, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x9D, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, + 0x9C, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x9B, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x9A, 0xFE, 0xF0, 0x84, + 0xFF, 0xFF, 0x99, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x98, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x97, 0xFE, + 0xF0, 0x84, 0xFF, 0xFF, 0x96, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x95, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, + 0x94, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x93, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x92, 0xFE, 0xF0, 0x84, + 0xFF, 0xFF, 0x91, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x90, 0xFE, 0xF0, 0x84, 0x06, 0xFB, 0x8F, 0xFE, + 0xF0, 0x84, 0xFF, 0xFF, 0x8E, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x8D, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, + 0x8C, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x8B, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x8A, 0xFE, 0xF0, 0x84, + 0xFF, 0xFF, 0x89, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x88, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x87, 0xFE, + 0xF0, 0x84, 0xFF, 0xFF, 0x86, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x85, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, + 0x84, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x83, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x82, 0xFE, 0xF0, 0x84, + 0xFF, 0xFF, 0x81, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x80, 0xFE, 0xF0, 0x84, 0x05, 0xFB, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x5C, 0x5C, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x24, 0x40, 0x01, 0x27, + 0x55, 0x00, 0x05, 0x60, 0x00, 0x63, 0x05, 0xFD, 0x30, 0x44, 0xBD, 0xDB, 0x31, 0x44, 0xBD, 0xDB, + 0x32, 0x44, 0xBD, 0xDB, 0x33, 0x44, 0xBD, 0xDB, 0x34, 0x44, 0xBD, 0xDB, 0x35, 0x44, 0xBD, 0xDB, + 0x36, 0x44, 0xBD, 0xDB, 0x37, 0x44, 0xBD, 0xDB, 0x38, 0x44, 0xBD, 0xDB, 0x39, 0x44, 0xBD, 0xDB, + 0x3A, 0x44, 0xBD, 0xDB, 0x3B, 0x44, 0xBD, 0xDB, 0x3C, 0x44, 0xBD, 0xDB, 0x3D, 0x44, 0xBD, 0xDB, + 0x3E, 0x44, 0xBD, 0xDB, 0x3F, 0x44, 0xBD, 0xDB, 0x02, 0x61, 0x61, 0x44, 0x02, 0x36, 0x82, 0xFF, + 0x03, 0x36, 0x83, 0xFF, 0x04, 0x36, 0x84, 0xFF, 0x05, 0x36, 0x85, 0xFF, 0x06, 0x36, 0x86, 0xFF, + 0x07, 0x36, 0x87, 0xFF, 0x20, 0x44, 0xBD, 0xDB, 0x21, 0x44, 0xBD, 0xDB, 0x22, 0x44, 0xBD, 0xDB, + 0x23, 0x44, 0xBD, 0xDB, 0x24, 0x44, 0xBD, 0xDB, 0x25, 0x44, 0xBD, 0xDB, 0x26, 0x44, 0xBD, 0xDB, + 0x27, 0x44, 0xBD, 0xDB, 0x28, 0x44, 0xBD, 0xDB, 0x29, 0x44, 0xBD, 0xDB, 0x2A, 0x44, 0xBD, 0xDB, + 0x2B, 0x44, 0xBD, 0xDB, 0x2C, 0x44, 0xBD, 0xDB, 0x2D, 0x44, 0xBD, 0xDB, 0x2E, 0x44, 0xBD, 0xDB, + 0x2F, 0x44, 0xBD, 0xDB, 0xDD, 0x81, 0x08, 0x3A, 0xD0, 0x01, 0x54, 0x00, 0x27, 0x40, 0x10, 0x26, + 0x30, 0x00, 0x26, 0x44, 0x01, 0x36, 0x2D, 0x00, 0x02, 0x36, 0x82, 0xFF, 0x03, 0x36, 0x83, 0xFF, + 0x04, 0x36, 0x84, 0xFF, 0x05, 0x36, 0x85, 0xFF, 0x06, 0x36, 0x86, 0xFF, 0x25, 0x44, 0x00, 0x36, + 0x44, 0x40, 0x01, 0x36, 0x44, 0x41, 0x02, 0x36, 0x44, 0x42, 0x03, 0x36, 0x44, 0x43, 0x04, 0x36, + 0x44, 0x44, 0x05, 0x36, 0x44, 0x45, 0x06, 0x36, 0x44, 0x46, 0x07, 0x36, 0x44, 0x47, 0x08, 0x36, + 0x44, 0x48, 0x09, 0x36, 0x44, 0x49, 0x0A, 0x36, 0x44, 0x4A, 0x0B, 0x36, 0x44, 0x4B, 0x0C, 0x36, + 0x44, 0x4C, 0x0D, 0x36, 0x44, 0x4D, 0x0E, 0x36, 0x44, 0x4E, 0x0F, 0x36, 0x44, 0x4F, 0x87, 0xFF, + 0x21, 0x00, 0x25, 0x44, 0x10, 0x36, 0x44, 0x50, 0x11, 0x36, 0x44, 0x51, 0x12, 0x36, 0x44, 0x52, + 0x13, 0x36, 0x44, 0x53, 0x14, 0x36, 0x44, 0x54, 0x15, 0x36, 0x44, 0x55, 0x16, 0x36, 0x44, 0x56, + 0x17, 0x36, 0x44, 0x57, 0x18, 0x36, 0x44, 0x58, 0x19, 0x36, 0x44, 0x59, 0x1A, 0x36, 0x44, 0x5A, + 0x1B, 0x36, 0x44, 0x5B, 0x1C, 0x36, 0x44, 0x5C, 0x1D, 0x36, 0x44, 0x5D, 0x1E, 0x36, 0x44, 0x5E, + 0x1F, 0x36, 0x44, 0x5F, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x25, 0x46, 0xAE, 0x60, 0x58, 0x4F, + 0x6F, 0x78, 0xFF, 0xFF, 0x03, 0x61, 0x7F, 0x67, 0x0B, 0x02, 0x00, 0xF0, 0x24, 0x60, 0x7A, 0x62, + 0x04, 0x64, 0xA2, 0xDB, 0x5A, 0xD9, 0x0A, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x40, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, + 0x11, 0x02, 0x24, 0x60, 0x9E, 0x62, 0x1A, 0x64, 0xA2, 0xDB, 0x00, 0x60, 0x50, 0x63, 0x5A, 0xDD, + 0x27, 0x60, 0x6E, 0x64, 0xA1, 0xFB, 0x2D, 0xFF, 0x25, 0x60, 0x11, 0x78, 0xFF, 0xFF, 0x2A, 0xF3, + 0x05, 0xFB, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x40, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, + 0x7F, 0x67, 0x02, 0x61, 0x0F, 0x02, 0x24, 0x60, 0x9E, 0x62, 0x1C, 0x64, 0xA2, 0xDB, 0x00, 0x60, + 0x50, 0x63, 0x5A, 0xDD, 0x27, 0x60, 0x88, 0x64, 0xA1, 0xFB, 0x2D, 0xFF, 0x25, 0x60, 0x11, 0x78, + 0xFF, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x7F, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, + 0x02, 0x61, 0x3E, 0x02, 0x25, 0x45, 0x20, 0x44, 0x80, 0x2A, 0x3A, 0x00, 0xF1, 0x60, 0x00, 0x64, + 0xD4, 0x80, 0xFF, 0xFF, 0x0B, 0x03, 0xF1, 0x60, 0x01, 0x64, 0xD4, 0x80, 0xFF, 0xFF, 0x06, 0x03, + 0xF1, 0x60, 0x02, 0x64, 0xD4, 0x80, 0xFF, 0xFF, 0x30, 0x03, 0x29, 0x00, 0x2D, 0x60, 0x0E, 0x62, + 0xA2, 0xD1, 0xBA, 0xF3, 0x1F, 0x60, 0x82, 0x61, 0xA0, 0x84, 0xA1, 0xDB, 0x25, 0x45, 0x23, 0x60, + 0xE4, 0x63, 0x02, 0x61, 0xBD, 0xD3, 0xBD, 0xD1, 0xD4, 0x80, 0xBD, 0xD3, 0xBD, 0xD5, 0xCD, 0x81, + 0x02, 0x03, 0x15, 0x03, 0xF7, 0x01, 0xA2, 0xFF, 0xA6, 0xD3, 0x40, 0x4C, 0x00, 0xA8, 0x67, 0x43, + 0x0C, 0x02, 0xA2, 0xDD, 0x42, 0x48, 0x64, 0x41, 0xAE, 0x60, 0x58, 0x4D, 0xC4, 0x78, 0xFF, 0xFF, + 0x66, 0x44, 0x28, 0xDB, 0x02, 0x03, 0x2C, 0x58, 0xA3, 0xFF, 0x0C, 0x61, 0x03, 0x00, 0x04, 0x61, + 0x7F, 0x67, 0x01, 0x00, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x2D, 0x60, 0x0E, 0x62, 0xA2, 0xD1, + 0xBA, 0xF3, 0x1F, 0x60, 0x82, 0x61, 0xA0, 0x84, 0xA1, 0xDB, 0x1F, 0x60, 0x86, 0x61, 0x01, 0x64, + 0xA1, 0xDB, 0xFF, 0xFF, 0xC4, 0xFE, 0xEE, 0x01, 0xC6, 0xFE, 0xEC, 0x01, 0x7E, 0x60, 0xC0, 0x64, + 0x24, 0x45, 0xA4, 0x80, 0x02, 0x61, 0x3F, 0x02, 0x25, 0x45, 0xF8, 0x2B, 0x3B, 0x00, 0x2E, 0xF5, + 0x67, 0x44, 0xD4, 0x80, 0x20, 0x60, 0x24, 0x63, 0x39, 0x03, 0x60, 0x61, 0x24, 0x44, 0x01, 0x27, + 0x29, 0x00, 0xA3, 0xFC, 0xA4, 0xF8, 0xBD, 0xD3, 0xA3, 0xD1, 0xD4, 0x80, 0xCD, 0x81, 0x08, 0x24, + 0x64, 0x58, 0x08, 0xA3, 0xF8, 0x02, 0x08, 0x60, 0x00, 0x63, 0xBD, 0xD3, 0xA3, 0xD1, 0xFE, 0xA0, + 0xFA, 0x60, 0x00, 0x64, 0xD0, 0x80, 0x14, 0x02, 0x13, 0x02, 0x04, 0xA3, 0xBE, 0xD3, 0xBD, 0xD1, + 0x0F, 0x18, 0xD4, 0x80, 0x0D, 0x18, 0x03, 0x03, 0xC3, 0x83, 0xC3, 0x83, 0xF7, 0x01, 0x64, 0x41, + 0xDD, 0x81, 0xE1, 0x81, 0xCB, 0x83, 0x46, 0x65, 0x2F, 0x60, 0x58, 0x4F, 0x01, 0x78, 0xFF, 0xFF, + 0x00, 0x67, 0x0A, 0x00, 0xBD, 0xD3, 0xBE, 0xD1, 0xD4, 0x80, 0xCD, 0x81, 0x08, 0x24, 0x64, 0x58, + 0x08, 0xA3, 0xF8, 0x02, 0x04, 0x61, 0x7F, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x0F, 0x64, 0x23, 0xFA, + 0x67, 0x44, 0x24, 0xFA, 0x62, 0x41, 0x3C, 0x60, 0x00, 0x65, 0x1A, 0x63, 0x68, 0x60, 0x28, 0x64, + 0x65, 0x46, 0x58, 0xD0, 0x2E, 0xF5, 0x59, 0xD8, 0xFB, 0x1F, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0xCB, 0x83, 0xBF, 0xD1, 0x4A, 0x65, 0x64, 0x43, 0xBD, 0xD3, 0xFF, 0xFF, 0x60, 0x41, 0x01, 0x26, + 0xDC, 0x81, 0xE9, 0x84, 0xDC, 0x84, 0x23, 0xFA, 0x09, 0x00, 0x4B, 0xD3, 0xFF, 0xFF, 0x60, 0x41, + 0xE8, 0x84, 0xDC, 0x84, 0x23, 0xFA, 0xBF, 0xD1, 0x4A, 0x65, 0x64, 0x43, 0x2F, 0x60, 0x58, 0x4F, + 0x01, 0x78, 0xFF, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x25, 0xF2, 0xFF, 0xFF, 0xE0, 0xA0, + 0x20, 0x64, 0x01, 0x06, 0x25, 0xFA, 0x23, 0xF2, 0xDF, 0xD1, 0xCC, 0x84, 0xE0, 0x85, 0x0B, 0x06, + 0xBF, 0xD1, 0x64, 0x41, 0xD5, 0x80, 0x64, 0x43, 0x01, 0x06, 0x65, 0x41, 0x4A, 0x65, 0x29, 0x60, + 0x58, 0x4F, 0x83, 0x78, 0xFF, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xDC, 0xF3, 0x02, 0x63, + 0x23, 0xFC, 0x07, 0xB4, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x4B, 0xD3, 0xBF, 0xD3, + 0x60, 0x41, 0xC9, 0x83, 0xE9, 0x81, 0xDD, 0x81, 0xA3, 0xFA, 0xE0, 0x81, 0x3C, 0x60, 0x00, 0x67, + 0x02, 0x24, 0x02, 0xA4, 0x60, 0x47, 0x40, 0x4B, 0xC9, 0x81, 0x4A, 0x65, 0xAB, 0x46, 0x59, 0xD0, + 0xAB, 0x46, 0xA5, 0xD8, 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0xF6, 0x1F, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xFC, 0xA3, 0xA3, 0xD1, 0x4C, 0x65, 0xA4, 0xD3, 0xDA, 0x83, + 0x60, 0x47, 0x25, 0xFA, 0x00, 0x7E, 0x60, 0x47, 0x01, 0x26, 0xDC, 0x84, 0x60, 0x41, 0xE8, 0x84, + 0xD8, 0x84, 0x23, 0xFA, 0xAB, 0x01, 0xFC, 0xA3, 0xA3, 0xD1, 0x4C, 0x65, 0xA4, 0xD3, 0xDA, 0x83, + 0x00, 0x7F, 0x25, 0xFA, 0x60, 0x41, 0x01, 0x26, 0xDD, 0x81, 0xE9, 0x84, 0xD8, 0x84, 0x23, 0xFA, + 0x9D, 0x01, 0x28, 0x60, 0xE2, 0x63, 0xBF, 0xD3, 0xFF, 0xFF, 0x60, 0x41, 0xE8, 0x84, 0xDC, 0x84, + 0x23, 0xFA, 0x4A, 0x65, 0x2F, 0x60, 0x58, 0x4F, 0x01, 0x78, 0xFF, 0xFF, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x28, 0x60, 0xE2, 0x63, 0x23, 0xF2, 0xC0, 0x65, 0xCC, 0x84, 0xE0, 0x81, 0x0A, 0x04, + 0xBF, 0xDB, 0xD5, 0x80, 0x07, 0x03, 0x01, 0x06, 0x65, 0x41, 0x61, 0x44, 0xBF, 0xDB, 0x4A, 0x65, + 0x58, 0x4F, 0xAA, 0x00, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x03, 0x4E, 0x28, 0x60, 0x58, 0x43, + 0x5C, 0x78, 0xFF, 0xFF, 0x29, 0x60, 0xC6, 0x61, 0x29, 0x60, 0xA4, 0x62, 0xA2, 0xD3, 0xA1, 0xDB, + 0xCC, 0x84, 0xA8, 0x83, 0x05, 0x04, 0x29, 0x60, 0xA4, 0x64, 0x58, 0xD1, 0x59, 0xD9, 0xFD, 0x1F, + 0x0E, 0x43, 0x81, 0x01, 0x23, 0xF2, 0x1C, 0x60, 0x8E, 0x65, 0x60, 0x41, 0x1C, 0x60, 0x2A, 0x63, + 0xA3, 0xDB, 0xFF, 0xA1, 0x48, 0x64, 0x58, 0xD0, 0x7E, 0xA8, 0x5B, 0xD9, 0x02, 0x02, 0x00, 0xF4, + 0x02, 0x64, 0xFF, 0xA1, 0xD7, 0x80, 0x02, 0x03, 0x01, 0x03, 0xF5, 0x01, 0x2E, 0xF5, 0x00, 0x60, + 0x2F, 0x65, 0x25, 0xF2, 0x00, 0x63, 0xCC, 0x84, 0x03, 0xA3, 0xFD, 0x05, 0x4A, 0x64, 0xD7, 0x80, + 0x1B, 0x60, 0xC6, 0x61, 0x2F, 0x05, 0xA1, 0xDD, 0xE3, 0x83, 0xFE, 0xA3, 0x58, 0xD0, 0x7E, 0xA8, + 0x59, 0xD9, 0x02, 0x02, 0x00, 0xF4, 0x02, 0x64, 0xF9, 0x1F, 0x00, 0x63, 0x59, 0xDD, 0x2E, 0xF5, + 0x1B, 0x60, 0xC6, 0x64, 0x25, 0xF0, 0xA0, 0xD3, 0xD3, 0x80, 0x01, 0xB0, 0x04, 0x03, 0x01, 0xA4, + 0x03, 0x03, 0xA2, 0xDB, 0x01, 0x00, 0xA2, 0xDD, 0x1B, 0x60, 0xCE, 0x63, 0x10, 0x60, 0x5A, 0x65, + 0xBD, 0xD3, 0xBD, 0xD1, 0xE0, 0x84, 0xC4, 0x82, 0x10, 0x60, 0x7A, 0x65, 0x07, 0x64, 0x64, 0x41, + 0x5A, 0xDB, 0xD6, 0x80, 0xCD, 0x81, 0x06, 0x03, 0xFB, 0x02, 0x25, 0xF2, 0x02, 0xA3, 0xCC, 0x84, + 0xA2, 0xDA, 0xEC, 0x02, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x1C, 0x60, 0x2A, 0x61, 0xA1, 0xD3, + 0x23, 0xFA, 0xE0, 0x83, 0x4A, 0x65, 0x04, 0x02, 0x02, 0x63, 0x23, 0xFC, 0xA5, 0xFC, 0x09, 0x00, + 0xDB, 0x83, 0x59, 0xD1, 0xA5, 0xD8, 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, + 0xF8, 0x1F, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x1B, 0x60, 0xC6, 0x62, 0xA2, 0xD3, 0x00, 0x61, + 0x02, 0xA4, 0xFE, 0xA0, 0x23, 0xFA, 0x1B, 0x03, 0xFA, 0xA4, 0xFD, 0xA4, 0x01, 0xA1, 0xFD, 0x07, + 0x61, 0x43, 0x23, 0xF2, 0x25, 0xFC, 0xE0, 0x83, 0x02, 0xA3, 0x1B, 0x60, 0xC6, 0x61, 0x00, 0x60, + 0x4A, 0x64, 0x59, 0xD1, 0x58, 0xD8, 0x7E, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x02, 0x64, 0xF9, 0x1F, + 0x25, 0xF2, 0x23, 0xF2, 0x01, 0xB0, 0xCC, 0x84, 0x04, 0x02, 0x23, 0xFA, 0x02, 0x00, 0x00, 0x64, + 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x41, 0x4B, 0x65, 0x42, 0x80, 0x64, 0xD4, 0x85, + 0x2B, 0x41, 0x00, 0xA1, 0x55, 0x8B, 0x0D, 0x03, 0x02, 0x04, 0x65, 0x41, 0x02, 0x00, 0x00, 0x64, + 0x40, 0x4B, 0xCA, 0x84, 0x58, 0xD0, 0xC9, 0x81, 0xBD, 0xD9, 0xFC, 0x02, 0x00, 0xF4, 0x04, 0x65, + 0xEC, 0x01, 0x2F, 0x58, 0xFF, 0xFF, 0xFC, 0xA3, 0xA3, 0xD3, 0x02, 0x7C, 0xA0, 0xD3, 0x23, 0xF8, + 0xDC, 0x84, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x02, 0x64, 0x23, 0xFA, 0x01, 0x64, + 0x9D, 0xFE, 0x02, 0x28, 0x02, 0x64, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x2D, 0x60, + 0x1A, 0x62, 0xA2, 0xD3, 0x02, 0x7C, 0x23, 0xF8, 0x01, 0xB4, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0xFC, 0xA3, 0xA3, 0xD1, 0x02, 0x64, 0x23, 0xFA, 0xA4, 0xD3, 0x00, 0x63, 0x60, 0x40, + 0x0A, 0x37, 0x01, 0x63, 0x14, 0x37, 0x02, 0x63, 0x37, 0x37, 0x06, 0x63, 0x6E, 0x37, 0x0B, 0x63, + 0x25, 0xFC, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x02, 0x64, 0x23, 0xFA, 0x88, 0xFF, 0x75, 0x44, + 0x8D, 0xFF, 0xE8, 0x87, 0xE8, 0x84, 0xE8, 0x84, 0x03, 0xB4, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x04, 0x64, 0x23, 0xFA, 0x86, 0xFF, 0x29, 0x44, 0x87, 0xFF, 0x25, 0xFA, 0x55, 0xF3, + 0x52, 0xF1, 0x80, 0x65, 0xC4, 0x87, 0x00, 0x7F, 0x26, 0xFA, 0x64, 0x44, 0xC4, 0x87, 0x00, 0x7F, + 0x27, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x05, 0x64, 0x23, 0xFA, 0x52, 0x63, 0xB7, 0xF3, + 0x4B, 0xDA, 0xB6, 0xF3, 0x4B, 0xDA, 0xB5, 0xF3, 0x4B, 0xDA, 0x60, 0x41, 0x88, 0xFF, 0x72, 0x5C, + 0x89, 0xFF, 0x4A, 0xD8, 0xA2, 0x48, 0x20, 0x23, 0x0E, 0x00, 0x64, 0x40, 0x80, 0x27, 0x15, 0x00, + 0xDC, 0x84, 0xBD, 0xDA, 0xBD, 0xD2, 0x11, 0x04, 0xDC, 0x84, 0xA2, 0xDA, 0xA3, 0xD2, 0x0D, 0x04, + 0xDC, 0x84, 0xA3, 0xDA, 0x0A, 0x00, 0x52, 0x63, 0xB7, 0xF3, 0x4B, 0xDA, 0xB6, 0xF3, 0x4B, 0xDA, + 0xB5, 0xF3, 0x4B, 0xDA, 0x54, 0x90, 0x4C, 0x63, 0xE0, 0x02, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x25, 0xF0, 0x2D, 0x60, 0x16, 0x65, 0x23, 0xF2, 0xA5, 0xD9, 0x02, 0xA8, 0x64, 0x44, 0x07, 0x02, + 0x00, 0xBC, 0xF2, 0xA4, 0x04, 0x03, 0x03, 0x07, 0x28, 0x60, 0x44, 0x62, 0xA2, 0xD9, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x20, 0x63, 0x28, 0x60, 0xA4, 0x61, 0x48, 0x64, 0x58, 0xD0, 0x59, 0xD9, + 0xFD, 0x1F, 0x25, 0xF0, 0x20, 0x64, 0xD0, 0x81, 0xFF, 0xFF, 0x02, 0x07, 0x25, 0xFA, 0x0F, 0x00, + 0x28, 0x60, 0xA8, 0x63, 0xC3, 0x83, 0x01, 0x2A, 0x06, 0x00, 0xCF, 0x83, 0xA3, 0xD3, 0xCD, 0x81, + 0x00, 0x7F, 0xBD, 0xDB, 0x04, 0x03, 0x00, 0x64, 0xC9, 0x81, 0xBD, 0xDB, 0xFD, 0x02, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, 0x25, 0xF0, 0x02, 0xA8, 0x01, 0x60, 0xA6, 0x62, 0x09, 0x02, + 0xA2, 0xD9, 0x64, 0x41, 0x32, 0x44, 0x02, 0xB5, 0x00, 0xB9, 0xD4, 0x84, 0x08, 0x28, 0x02, 0xBC, + 0x40, 0x52, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, 0x25, 0xF0, 0x02, 0xA8, 0x01, 0x60, + 0xB2, 0x62, 0x0C, 0x02, 0xA2, 0xD9, 0x64, 0x41, 0x32, 0x44, 0x40, 0xB5, 0x00, 0xB9, 0xD4, 0x84, + 0x08, 0x24, 0x03, 0x00, 0x40, 0xBC, 0x02, 0xB5, 0xD4, 0x84, 0x40, 0x52, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x23, 0xF2, 0x25, 0xF0, 0x01, 0x60, 0xB0, 0x63, 0xA3, 0xD9, 0xA9, 0xF1, 0x20, 0x61, + 0x41, 0x4B, 0x64, 0x43, 0xD8, 0xF3, 0x63, 0x45, 0x66, 0x41, 0x65, 0x46, 0x8C, 0xFA, 0x60, 0x40, + 0x01, 0x36, 0x06, 0x00, 0x02, 0x36, 0x04, 0x00, 0x04, 0x36, 0x02, 0x00, 0x05, 0x3A, 0x02, 0x00, + 0x00, 0x64, 0x01, 0x00, 0x01, 0x64, 0x6F, 0xFA, 0x79, 0xF3, 0x7A, 0xF1, 0xFF, 0xFF, 0xA0, 0x84, + 0x65, 0x43, 0x02, 0x02, 0x79, 0xF3, 0xFF, 0xFF, 0x60, 0x41, 0x0F, 0x60, 0xAE, 0x65, 0xD8, 0xF3, + 0xFF, 0xFF, 0xE0, 0x84, 0x44, 0xD3, 0x61, 0x45, 0xA4, 0x80, 0xFF, 0xFF, 0x04, 0x02, 0xE8, 0x84, + 0xA4, 0x80, 0xFF, 0xFF, 0xFC, 0x03, 0xA4, 0x84, 0x7B, 0xFB, 0x6F, 0xF0, 0x60, 0x47, 0x90, 0x84, + 0x6F, 0xFA, 0x60, 0x47, 0x60, 0x45, 0x80, 0x64, 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0xFC, 0x03, + 0xA4, 0x84, 0x70, 0xF0, 0x70, 0xFA, 0x00, 0x61, 0xE8, 0x84, 0xFF, 0xFF, 0x02, 0x05, 0xDD, 0x81, + 0xFB, 0x01, 0xE1, 0x81, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, 0x0E, 0xFA, 0x66, 0x43, 0x0C, 0xF4, + 0x2B, 0x41, 0x4D, 0x8B, 0x02, 0xA3, 0xB6, 0x02, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, + 0x25, 0xF0, 0x02, 0xA8, 0x00, 0x67, 0x02, 0x02, 0x2D, 0xF9, 0x2C, 0xF9, 0x23, 0x58, 0xFF, 0xFF, + 0x28, 0x60, 0x42, 0x61, 0x23, 0xF2, 0x25, 0xF2, 0x02, 0xA8, 0x00, 0xA8, 0x09, 0x02, 0x07, 0x03, + 0xD0, 0xA0, 0x30, 0x65, 0x03, 0x04, 0xA7, 0xA0, 0x59, 0x65, 0x01, 0x06, 0x65, 0x44, 0xA1, 0xDB, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x31, 0x60, 0x2C, 0x61, 0x01, 0x64, 0xA1, 0xDB, 0x04, 0x00, + 0x31, 0x60, 0x2C, 0x61, 0x00, 0x64, 0xA1, 0xDB, 0x7E, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, + 0x7F, 0x67, 0x02, 0x61, 0x0E, 0x02, 0x06, 0x61, 0x41, 0x56, 0xC7, 0xFE, 0x25, 0x60, 0x11, 0x78, + 0xFF, 0xFF, 0x36, 0x47, 0xFF, 0x23, 0x04, 0x00, 0x00, 0x7F, 0x60, 0x41, 0x7F, 0x67, 0x01, 0x00, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x7E, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, + 0x02, 0x61, 0x12, 0x02, 0x2D, 0x60, 0x58, 0x61, 0x65, 0x43, 0xA1, 0xDD, 0x0C, 0x61, 0x41, 0x56, + 0xC7, 0xFE, 0x25, 0x60, 0x11, 0x78, 0xFF, 0xFF, 0x36, 0x47, 0xFF, 0x23, 0x04, 0x00, 0x00, 0x7F, + 0x60, 0x41, 0x7F, 0x67, 0x01, 0x00, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x25, 0xF0, 0x29, 0x60, + 0xA2, 0x62, 0xA2, 0xD9, 0x19, 0x00, 0x2D, 0x60, 0x1A, 0x64, 0xA0, 0xD1, 0xA0, 0xF9, 0x0C, 0x60, + 0x38, 0x62, 0x40, 0x63, 0x00, 0x64, 0x5A, 0xDB, 0xFE, 0x1F, 0x64, 0x40, 0x01, 0x2A, 0x0C, 0x00, + 0x04, 0x65, 0x0C, 0x60, 0x38, 0x61, 0x48, 0x64, 0x3E, 0x63, 0x7C, 0xA8, 0x58, 0xD0, 0x59, 0xD9, + 0x02, 0x02, 0x00, 0xF4, 0x02, 0x64, 0xF9, 0x1F, 0x29, 0x60, 0xA2, 0x62, 0xA2, 0xD1, 0x0D, 0x60, + 0x1C, 0x65, 0x02, 0xFE, 0x64, 0x44, 0xF8, 0x84, 0xF8, 0x84, 0xF8, 0x87, 0x60, 0x41, 0x64, 0x44, + 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x84, 0x3E, 0xFB, 0x60, 0x42, 0x61, 0x44, 0x03, 0xA2, 0x60, 0xFE, + 0xA2, 0xDB, 0xFF, 0xFF, 0x20, 0xFE, 0x64, 0x44, 0x0C, 0x60, 0x3A, 0x65, 0xE0, 0x84, 0xE0, 0x84, + 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x84, 0x40, 0xFB, 0xFF, 0xFF, 0x00, 0x67, 0x00, 0x61, 0x23, 0x58, + 0xFF, 0xFF, 0x2D, 0x60, 0x1A, 0x64, 0xA0, 0xD1, 0xA0, 0xF9, 0x00, 0x64, 0x40, 0x41, 0x64, 0x40, + 0x01, 0x2A, 0xA4, 0x00, 0x4A, 0x64, 0xA0, 0xD2, 0xFF, 0xFF, 0x40, 0x42, 0x80, 0x2B, 0x04, 0x00, + 0xFF, 0xB4, 0x40, 0x42, 0x01, 0x64, 0x40, 0x41, 0xA9, 0xF3, 0x46, 0x4B, 0x60, 0x46, 0x20, 0x63, + 0xE3, 0x83, 0xAB, 0x46, 0x26, 0xF0, 0xAB, 0x46, 0x55, 0xF8, 0xAB, 0x46, 0x27, 0xF0, 0xAB, 0x46, + 0x56, 0xF8, 0xAB, 0x46, 0x28, 0xF0, 0xAB, 0x46, 0x57, 0xF8, 0x66, 0x44, 0x02, 0xA6, 0xF1, 0x1F, + 0xA9, 0xF3, 0xFF, 0xFF, 0x60, 0x46, 0xAB, 0x46, 0x0C, 0x60, 0x7A, 0x65, 0x22, 0x44, 0xFF, 0xB4, + 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x81, 0xC9, 0x81, 0x52, 0x64, 0x0E, 0x63, + 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x21, 0x44, 0x01, 0x2A, 0x08, 0x00, 0xAB, 0x46, 0xF0, 0xA1, + 0x6E, 0x64, 0x0E, 0x63, 0x59, 0xD1, 0x58, 0xD8, 0xFD, 0x1F, 0xAB, 0x46, 0x22, 0x44, 0xFF, 0xB4, + 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0x0C, 0x60, 0xDC, 0x65, 0xC4, 0x81, 0x60, 0x45, 0xC9, 0x81, + 0x62, 0x64, 0x06, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x21, 0x44, 0x01, 0x2A, 0x08, 0x00, + 0xAB, 0x46, 0xF8, 0xA1, 0xAE, 0x64, 0x06, 0x63, 0x59, 0xD1, 0x58, 0xD8, 0xFD, 0x1F, 0xAB, 0x46, + 0x65, 0x44, 0x0C, 0x60, 0xFC, 0x65, 0xC4, 0x81, 0xC9, 0x81, 0x6A, 0x64, 0x06, 0x63, 0x58, 0xD0, + 0x59, 0xD9, 0xFD, 0x1F, 0x22, 0x44, 0xFF, 0xB4, 0xE0, 0x84, 0xE0, 0x85, 0xC4, 0x84, 0x0C, 0x60, + 0xC2, 0x65, 0xC4, 0x81, 0x72, 0x64, 0x04, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0xAB, 0x46, + 0x21, 0x44, 0x01, 0x2A, 0x06, 0x00, 0xFA, 0xA1, 0x88, 0x64, 0x04, 0x63, 0x59, 0xD1, 0x58, 0xD8, + 0xFD, 0x1F, 0x37, 0xF0, 0x21, 0x44, 0x01, 0x2A, 0x13, 0x00, 0x22, 0x44, 0x3D, 0xFB, 0x60, 0x41, + 0x02, 0xFE, 0xF8, 0x84, 0xF8, 0x84, 0xF8, 0x84, 0x3C, 0xFB, 0x0C, 0x60, 0xBE, 0x63, 0x88, 0xFF, + 0xCD, 0x81, 0x06, 0xA3, 0xFD, 0x0D, 0x8D, 0xFF, 0x3B, 0xFD, 0x64, 0x47, 0x80, 0xBF, 0x60, 0x5C, + 0x22, 0x43, 0x80, 0x61, 0x88, 0xFF, 0xCF, 0x83, 0xE1, 0x81, 0xFD, 0x0D, 0x8D, 0xFF, 0x61, 0x47, + 0x31, 0x91, 0xB1, 0x84, 0x37, 0xFA, 0x1F, 0x63, 0xE3, 0x83, 0x66, 0x44, 0x02, 0xA6, 0x37, 0xF0, + 0x66, 0x44, 0xB1, 0x9C, 0x37, 0xF8, 0x02, 0xA6, 0xFA, 0x1F, 0xAB, 0x46, 0x00, 0x67, 0x00, 0x61, + 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, 0x25, 0xF0, 0x02, 0xA8, 0x00, 0x67, 0x22, 0x02, 0x3D, 0xF1, + 0x64, 0x44, 0x03, 0xB4, 0x40, 0x42, 0xD0, 0x80, 0xA9, 0xF3, 0xFF, 0xFF, 0x60, 0x46, 0xB7, 0xF4, + 0x80, 0x61, 0x02, 0x02, 0xE3, 0x83, 0xEB, 0x83, 0x22, 0x44, 0x88, 0xFF, 0xCC, 0x84, 0xE1, 0x81, + 0xFD, 0x0D, 0x8D, 0xFF, 0x61, 0x47, 0x31, 0x91, 0x9D, 0x85, 0xA7, 0x83, 0x37, 0xFC, 0x1F, 0x63, + 0xE3, 0x83, 0x66, 0x44, 0x02, 0xA6, 0xB7, 0xF2, 0x66, 0x44, 0xA5, 0x81, 0xB7, 0xFA, 0x02, 0xA6, + 0xFA, 0x1F, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x2D, 0x60, 0x1A, 0x64, 0xA0, 0xD1, 0xA0, 0xF9, + 0x64, 0x40, 0x01, 0x2A, 0x4E, 0x00, 0x27, 0xF2, 0x1C, 0x60, 0xBA, 0x65, 0x60, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, + 0x27, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x26, 0xF0, 0x63, 0x46, + 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x25, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, + 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0xA9, 0xF3, 0x08, 0xFE, 0x60, 0x43, + 0x61, 0x46, 0x01, 0x03, 0x2A, 0x00, 0x43, 0x4B, 0xAB, 0x46, 0x37, 0xF2, 0x80, 0x60, 0x30, 0x7C, + 0xB0, 0x84, 0xA2, 0xDA, 0x4E, 0x61, 0x6E, 0x64, 0x0E, 0x63, 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, + 0x58, 0xD8, 0xFB, 0x1F, 0x88, 0x64, 0x04, 0x63, 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0x58, 0xD8, + 0xFB, 0x1F, 0xD9, 0x81, 0x98, 0x64, 0x04, 0x63, 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0x58, 0xD8, + 0xFB, 0x1F, 0xD9, 0x81, 0xAE, 0x64, 0x0E, 0x63, 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0x58, 0xD8, + 0xFB, 0x1F, 0x00, 0x67, 0x00, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x01, 0x67, 0x20, 0x61, 0x23, 0x58, + 0xFF, 0xFF, 0x2D, 0x60, 0x1A, 0x64, 0xA0, 0xD1, 0xA0, 0xF9, 0x64, 0x40, 0x01, 0x2A, 0x31, 0x00, + 0x27, 0xF2, 0x1C, 0x60, 0xBA, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, + 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x27, 0xF0, 0x63, 0x46, 0xD0, 0x80, + 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x26, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, + 0x61, 0x46, 0x25, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, + 0x63, 0x46, 0xE8, 0x1B, 0xA9, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x01, 0x03, 0x0D, 0x00, + 0x43, 0x4B, 0xAB, 0x46, 0x37, 0xF2, 0x80, 0x60, 0x30, 0x61, 0x9D, 0x85, 0xA4, 0x84, 0xA2, 0xDA, + 0xAB, 0x46, 0x00, 0x67, 0x00, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x01, 0x67, 0x20, 0x61, 0x23, 0x58, + 0xFF, 0xFF, 0xA2, 0xFF, 0x46, 0x45, 0x02, 0xF0, 0x09, 0x60, 0x08, 0x64, 0xD0, 0x80, 0x00, 0xF4, + 0x01, 0xF2, 0x66, 0x5C, 0x25, 0x46, 0x56, 0x02, 0x70, 0x27, 0x54, 0x00, 0x12, 0x64, 0x03, 0xFA, + 0x04, 0xF8, 0x0E, 0xF2, 0x87, 0xFC, 0x8D, 0xFC, 0x8E, 0xFC, 0xDA, 0x82, 0x16, 0x61, 0x00, 0x63, + 0xC9, 0x81, 0x5A, 0xDC, 0xFD, 0x02, 0x60, 0x40, 0xF0, 0x3B, 0x16, 0x00, 0x32, 0x44, 0xAF, 0xF3, + 0x01, 0xB0, 0xFA, 0xA0, 0x08, 0x24, 0x2C, 0x05, 0xDC, 0x83, 0xF0, 0x67, 0x0E, 0xFA, 0x24, 0x60, + 0x5E, 0x64, 0x2B, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xAF, 0xFD, 0x2B, 0xFF, + 0xFE, 0x64, 0x3B, 0x42, 0x4A, 0xDB, 0x4F, 0x00, 0xB0, 0xF3, 0x06, 0x65, 0xD4, 0x80, 0xDC, 0x83, + 0x17, 0x05, 0xB0, 0xFD, 0x98, 0xFE, 0x04, 0x04, 0x00, 0x7F, 0x08, 0x7E, 0x0E, 0xFA, 0x3B, 0xFF, + 0x24, 0x60, 0x52, 0x64, 0x2B, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0x0E, 0xF2, + 0x2B, 0xFF, 0x60, 0x40, 0x08, 0x26, 0xF7, 0xFE, 0xFD, 0x64, 0x3B, 0x42, 0x4A, 0xDB, 0x32, 0x00, + 0xAC, 0xF3, 0xFF, 0xFF, 0xD8, 0xA0, 0xFF, 0xFF, 0x0D, 0x04, 0x24, 0x60, 0x6A, 0x64, 0x2B, 0xDB, + 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xFC, 0x64, 0x3B, 0x42, + 0x4A, 0xDB, 0x21, 0x00, 0x46, 0x45, 0x00, 0x64, 0x2B, 0xDB, 0x25, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xA2, 0xFF, 0x00, 0xF4, 0x01, 0xF0, 0x0A, 0x18, 0x70, 0x67, + 0xA0, 0x80, 0xF0, 0x67, 0x06, 0x03, 0xC0, 0x84, 0x01, 0xFA, 0x25, 0x46, 0x25, 0x44, 0x80, 0xFC, + 0x05, 0xFA, 0xAF, 0x60, 0x58, 0x4E, 0x95, 0x78, 0xFF, 0xFF, 0xD4, 0xFE, 0xA3, 0xFF, 0xFF, 0x64, + 0x3B, 0x42, 0x4A, 0xDB, 0xD4, 0xFE, 0xA3, 0xFF, 0x2D, 0x58, 0xFF, 0xFF, 0x24, 0x60, 0x58, 0x64, + 0x40, 0x47, 0x58, 0x4F, 0x0D, 0x00, 0x24, 0x60, 0x4C, 0x64, 0x40, 0x47, 0x58, 0x4F, 0x18, 0x00, + 0x24, 0x60, 0x64, 0x64, 0x40, 0x47, 0x58, 0x4F, 0x03, 0x00, 0x25, 0x60, 0x11, 0x78, 0xFF, 0xFF, + 0x27, 0xD5, 0x0E, 0xF2, 0x0B, 0x18, 0x60, 0x40, 0x01, 0x2A, 0x08, 0x00, 0x24, 0x60, 0x7A, 0x64, + 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, 0xD8, 0x78, 0xFF, 0xFF, 0xF2, 0x01, 0x2F, 0x58, 0xFF, 0xFF, + 0x27, 0xD5, 0x0E, 0xF2, 0x14, 0x18, 0x60, 0x40, 0x01, 0x2A, 0x11, 0x00, 0x02, 0xF0, 0x09, 0x60, + 0x08, 0x64, 0xD0, 0x80, 0xA2, 0xFF, 0xB0, 0xF3, 0x02, 0x02, 0xCC, 0x84, 0xB0, 0xFB, 0x24, 0x60, + 0x7A, 0x64, 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, 0xD8, 0x78, 0xFF, 0xFF, 0xE9, 0x01, 0x2F, 0x58, + 0xFF, 0xFF, 0xFB, 0x64, 0x3A, 0x42, 0x4A, 0xDB, 0xA2, 0xFF, 0xB3, 0xF3, 0xAF, 0xF3, 0xCC, 0x80, + 0xFD, 0xA0, 0x01, 0x14, 0x1E, 0x05, 0xAE, 0x60, 0x58, 0x4D, 0x9B, 0x78, 0xFF, 0xFF, 0xA2, 0xFF, + 0x18, 0x03, 0xF0, 0x67, 0x0E, 0xFA, 0x24, 0x60, 0x7A, 0x62, 0x24, 0x60, 0x5E, 0x64, 0xA2, 0xDB, + 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xF6, 0x64, 0x3A, 0x42, + 0x4A, 0xDB, 0xB3, 0xF3, 0xAF, 0xF3, 0xCC, 0x83, 0xDC, 0x84, 0x01, 0x15, 0xB3, 0xFD, 0xAF, 0xFB, + 0xD4, 0xFE, 0xB2, 0xF3, 0xB0, 0xF3, 0x00, 0xA8, 0xB1, 0xF1, 0x03, 0x02, 0xD0, 0x80, 0xFF, 0xFF, + 0x27, 0x05, 0xAE, 0x60, 0x58, 0x4D, 0x9B, 0x78, 0xFF, 0xFF, 0xA2, 0xFF, 0x21, 0x03, 0x00, 0x63, + 0xB2, 0xF3, 0x0E, 0xFC, 0xCC, 0x84, 0xFF, 0x3A, 0xB2, 0xFB, 0x98, 0xFE, 0x03, 0x04, 0x08, 0xBB, + 0x0E, 0xFC, 0x3B, 0xFF, 0x24, 0x60, 0x7A, 0x62, 0x24, 0x60, 0x52, 0x64, 0xA2, 0xDB, 0x66, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xF7, 0x64, 0x3A, 0x42, 0x4A, 0xDB, + 0xB0, 0xF3, 0x0E, 0xF2, 0xDC, 0x83, 0x08, 0xB0, 0xB0, 0xFD, 0x08, 0x28, 0xF7, 0xFE, 0xD4, 0xFE, + 0xA3, 0xFF, 0x25, 0x60, 0x11, 0x78, 0xFF, 0xFF, 0xB9, 0xFE, 0x13, 0xFF, 0x24, 0x40, 0x80, 0x2B, + 0x0B, 0x00, 0xA2, 0xFF, 0x25, 0x46, 0x09, 0xF4, 0x0E, 0xF2, 0x05, 0x18, 0x08, 0xBC, 0x0E, 0xFA, + 0xFF, 0xFF, 0xF7, 0xFE, 0x01, 0x00, 0xD8, 0xFE, 0xA3, 0xFF, 0x25, 0x46, 0x3E, 0xF2, 0x00, 0xF4, + 0x08, 0xF0, 0x25, 0x46, 0x06, 0xB4, 0xFF, 0x7F, 0x10, 0xBC, 0x06, 0x26, 0xFD, 0x7F, 0x0E, 0xFA, + 0x3E, 0xF2, 0x3F, 0xF2, 0x60, 0x41, 0x08, 0x2A, 0x64, 0x47, 0x3F, 0xFA, 0x60, 0x45, 0x27, 0x60, + 0xFC, 0x62, 0xA2, 0xD3, 0xA3, 0xFC, 0xAB, 0xFC, 0x91, 0xFC, 0xD4, 0x80, 0xC0, 0x60, 0xE1, 0x65, + 0xA5, 0x80, 0x01, 0x04, 0x07, 0x03, 0x23, 0xF0, 0x08, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0x2E, 0x60, + 0xC5, 0x78, 0xFF, 0xFF, 0x2F, 0x60, 0x58, 0x4F, 0x0F, 0x78, 0xFF, 0xFF, 0x14, 0x04, 0x23, 0xF0, + 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0xB8, 0xF1, 0x27, 0x60, 0x96, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, + 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x02, 0x00, + 0x20, 0x60, 0x00, 0x75, 0x83, 0x00, 0xDC, 0xF3, 0xA9, 0xF1, 0x07, 0xB4, 0x64, 0x43, 0xFD, 0xA0, + 0x2C, 0xF2, 0x71, 0x02, 0x01, 0xB0, 0x64, 0x43, 0x78, 0x02, 0x2E, 0xF2, 0x1C, 0x60, 0xBA, 0x65, + 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, + 0x16, 0x18, 0x61, 0x46, 0x2E, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, + 0x2D, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x2C, 0xF0, 0x63, 0x46, + 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0xA9, 0xF3, + 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x51, 0x03, 0x63, 0x46, 0x80, 0xF6, 0x25, 0x46, 0x43, 0x18, + 0x2E, 0xF2, 0x66, 0x41, 0x1C, 0x60, 0xBA, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xA9, 0xF1, 0xE0, 0x84, + 0x44, 0xD3, 0x64, 0x43, 0x11, 0x18, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xFC, 0x1B, 0x66, 0x44, + 0x64, 0x46, 0x80, 0xF0, 0x60, 0x46, 0x80, 0xF8, 0x65, 0x46, 0x65, 0x43, 0x80, 0xF0, 0x01, 0xFA, + 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x0B, 0x00, 0x64, 0x46, 0x62, 0x43, 0x00, 0xF2, 0xA3, 0xDB, + 0x60, 0x46, 0x80, 0xF0, 0x81, 0xFC, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x60, 0x43, 0x61, 0x46, + 0x43, 0x4B, 0x2C, 0xF0, 0xAD, 0xF0, 0x2E, 0xF2, 0xAB, 0x46, 0x03, 0xF8, 0x84, 0xF8, 0x05, 0xFA, + 0x03, 0x64, 0x06, 0xFA, 0xAB, 0x46, 0x1E, 0x60, 0xBC, 0x61, 0xA1, 0xD3, 0x1E, 0x60, 0xFE, 0x7C, + 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0xA0, 0xDD, 0xDA, 0x9C, 0xA1, 0xD9, 0x49, 0xD3, 0xFF, 0xFF, + 0xDC, 0x84, 0xA1, 0xDB, 0x0A, 0x00, 0xDC, 0xF3, 0x02, 0xA3, 0xFE, 0xA0, 0xF9, 0xA0, 0x01, 0x06, + 0x04, 0x02, 0x23, 0xF0, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0x07, 0xFC, 0x23, 0xF2, 0xFF, 0xFF, + 0x27, 0x1B, 0x27, 0x60, 0xFE, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x00, 0x3A, 0x10, 0x00, + 0x24, 0x60, 0x7A, 0x62, 0x24, 0x60, 0x22, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x0E, 0xF2, 0xC1, 0xFE, 0x10, 0xAC, 0x0E, 0xFA, 0x1F, 0x00, + 0x24, 0x60, 0x7A, 0x62, 0x24, 0x60, 0x34, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x0E, 0xF2, 0xC8, 0xFE, 0x10, 0xAC, 0x0E, 0xFA, 0x0F, 0x00, + 0x24, 0x60, 0x7A, 0x62, 0x24, 0x60, 0x46, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x0E, 0xF2, 0xCE, 0xFE, 0x10, 0xAC, 0x0E, 0xFA, 0x25, 0x60, + 0x11, 0x78, 0xFF, 0xFF, 0xCB, 0x84, 0xC9, 0x83, 0xFF, 0xFF, 0x08, 0x04, 0x58, 0xD1, 0xA5, 0xD8, + 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0xF8, 0x1F, 0x2F, 0x58, 0xFF, 0xFF, + 0x3E, 0xF2, 0xCC, 0xF1, 0x08, 0xB0, 0x19, 0xF8, 0x3B, 0x02, 0xEB, 0xF1, 0x2F, 0xF8, 0xEC, 0xF3, + 0x30, 0xFA, 0x60, 0x45, 0xED, 0xF3, 0x31, 0xFA, 0x46, 0x4A, 0x00, 0xF4, 0x60, 0x43, 0x05, 0xF2, + 0x06, 0xF2, 0xD0, 0x80, 0x07, 0xF0, 0x05, 0x02, 0xD4, 0x80, 0xD3, 0x80, 0x02, 0x02, 0xDC, 0xF3, + 0x03, 0x03, 0xAA, 0x46, 0x42, 0xFE, 0x25, 0x00, 0x60, 0x40, 0x03, 0x2A, 0x10, 0x00, 0x02, 0xF2, + 0x03, 0xF0, 0x04, 0xF2, 0x60, 0x43, 0xAA, 0x46, 0x2C, 0xFC, 0x2D, 0xF8, 0x2E, 0xFA, 0x81, 0xF1, + 0x32, 0xF8, 0x82, 0xF1, 0x33, 0xF8, 0x83, 0xF1, 0x34, 0xF8, 0x08, 0x64, 0x10, 0x00, 0x02, 0xF2, + 0x03, 0xF0, 0x04, 0xF2, 0x60, 0x43, 0xAA, 0x46, 0x32, 0xFC, 0x33, 0xF8, 0x34, 0xFA, 0x81, 0xF1, + 0x2C, 0xF8, 0x82, 0xF1, 0x2D, 0xF8, 0x83, 0xF1, 0x2E, 0xF8, 0x01, 0x60, 0x08, 0x64, 0x2A, 0xFA, + 0x02, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, 0x03, 0x02, 0x42, 0xFF, + 0x47, 0xFF, 0xA1, 0xFF, 0x80, 0xFF, 0x90, 0xFF, 0x98, 0xFF, 0x88, 0xFF, 0x84, 0xE1, 0xFF, 0xFF, + 0x00, 0x00, 0xA1, 0xFF, 0xFF, 0xFF, 0x87, 0x3E, 0x2D, 0x60, 0x9C, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, + 0x01, 0x1B, 0xF7, 0x01, 0x87, 0xFF, 0x20, 0x44, 0x80, 0xFF, 0x60, 0x40, 0x80, 0x26, 0xF1, 0x01, + 0xC0, 0x60, 0x40, 0xEC, 0xC0, 0x60, 0x00, 0xED, 0xC0, 0x60, 0x80, 0xEE, 0xAC, 0x4F, 0xBF, 0xB4, + 0xA0, 0x5C, 0x2D, 0x60, 0x1A, 0x62, 0xA2, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0x02, 0x27, 0x06, 0x00, + 0x28, 0xE2, 0x24, 0xE2, 0xBF, 0xFF, 0xFF, 0xFF, 0x75, 0x40, 0x10, 0x00, 0x28, 0xE2, 0x24, 0xE2, + 0x00, 0x60, 0x00, 0x61, 0x00, 0x60, 0x94, 0xE0, 0xBF, 0xFF, 0xFF, 0xFF, 0xA1, 0x50, 0x75, 0x40, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x60, 0x10, 0xE0, 0x2D, 0x60, 0x9C, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x01, 0x60, 0x39, 0xE2, 0x04, 0x60, 0x00, 0x7A, 0xAC, 0x4F, 0x40, 0xBC, + 0x00, 0x7F, 0xA0, 0x5C, 0xC0, 0x60, 0xD9, 0xEC, 0xC0, 0x60, 0x0F, 0xED, 0xC0, 0x60, 0x8F, 0xEE, + 0xAE, 0x4F, 0x04, 0xBC, 0x00, 0x7F, 0xA0, 0x5E, 0x26, 0x61, 0xCD, 0x81, 0xFF, 0xFF, 0xFD, 0x02, + 0xAE, 0x4F, 0xFB, 0xB4, 0xA0, 0x5E, 0xAD, 0x01, 0x80, 0xFF, 0x90, 0xFF, 0x98, 0xFF, 0x2F, 0x60, + 0x54, 0x63, 0x20, 0x44, 0xBD, 0xDB, 0x21, 0x44, 0xBD, 0xDB, 0x22, 0x44, 0xBD, 0xDB, 0x23, 0x44, + 0xBD, 0xDB, 0x24, 0x44, 0xBD, 0xDB, 0x25, 0x44, 0xBD, 0xDB, 0x26, 0x44, 0xBD, 0xDB, 0x27, 0x44, + 0xBD, 0xDB, 0x28, 0x44, 0xBD, 0xDB, 0x29, 0x44, 0xBD, 0xDB, 0x2A, 0x44, 0xBD, 0xDB, 0x2B, 0x44, + 0xBD, 0xDB, 0x2C, 0x44, 0xBD, 0xDB, 0x2D, 0x44, 0xBD, 0xDB, 0x2E, 0x44, 0xBD, 0xDB, 0x2F, 0x44, + 0xBD, 0xDB, 0x2F, 0x60, 0x48, 0x64, 0xA0, 0xDD, 0x30, 0x60, 0x74, 0x63, 0x2F, 0x60, 0x4A, 0x64, + 0xA0, 0xDD, 0x2F, 0x60, 0x4C, 0x63, 0x30, 0x44, 0xA3, 0xDB, 0x2F, 0x60, 0x4E, 0x63, 0x31, 0x44, + 0xA3, 0xDB, 0x2F, 0x60, 0x50, 0x63, 0x32, 0x44, 0xA3, 0xDB, 0x2F, 0x60, 0x52, 0x63, 0x33, 0x44, + 0xA3, 0xDB, 0x81, 0xFF, 0x91, 0xFF, 0x58, 0x51, 0x4B, 0x00, 0x82, 0xFF, 0x92, 0xFF, 0x58, 0x51, + 0x47, 0x00, 0x83, 0xFF, 0x93, 0xFF, 0x58, 0x51, 0x43, 0x00, 0x84, 0xFF, 0x94, 0xFF, 0x58, 0x51, + 0x3F, 0x00, 0x85, 0xFF, 0x95, 0xFF, 0x58, 0x51, 0x3B, 0x00, 0x86, 0xFF, 0x96, 0xFF, 0x58, 0x51, + 0x37, 0x00, 0x87, 0xFF, 0x97, 0xFF, 0x58, 0x51, 0x33, 0x00, 0x80, 0xFF, 0x90, 0xFF, 0x99, 0xFF, + 0x2F, 0x60, 0x48, 0x64, 0xA0, 0xD1, 0x30, 0x44, 0x64, 0x43, 0xBD, 0xDB, 0x31, 0x44, 0xBD, 0xDB, + 0x32, 0x44, 0xBD, 0xDB, 0x33, 0x44, 0xBD, 0xDB, 0x34, 0x44, 0xBD, 0xDB, 0x35, 0x44, 0xBD, 0xDB, + 0x36, 0x44, 0xBD, 0xDB, 0x37, 0x44, 0xBD, 0xDB, 0x38, 0x44, 0xBD, 0xDB, 0x39, 0x44, 0xBD, 0xDB, + 0x3A, 0x44, 0xBD, 0xDB, 0x3B, 0x44, 0xBD, 0xDB, 0x3C, 0x44, 0xBD, 0xDB, 0x3D, 0x44, 0xBD, 0xDB, + 0x3E, 0x44, 0xBD, 0xDB, 0x3F, 0x44, 0xBD, 0xDB, 0xEF, 0x60, 0x48, 0x64, 0x0A, 0xFB, 0x40, 0x21, + 0xFE, 0x01, 0x80, 0xFF, 0x90, 0xFF, 0x98, 0xFF, 0x88, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x87, 0x3E, + 0x42, 0x50, 0x40, 0x53, 0x2F, 0x60, 0x4A, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x40, 0x52, 0x33, 0x44, + 0x32, 0x42, 0xA2, 0xDB, 0xDA, 0x82, 0xA2, 0xDD, 0xDA, 0x83, 0x65, 0x44, 0xBD, 0xDB, 0x61, 0x44, + 0xBD, 0xDB, 0x66, 0x44, 0xBD, 0xDB, 0xBD, 0xD9, 0x30, 0x44, 0xBD, 0xDB, 0x99, 0xFF, 0xA4, 0x4C, + 0xBD, 0xDB, 0xA5, 0x4C, 0xBD, 0xDB, 0xA0, 0x4C, 0xBD, 0xDB, 0xA1, 0x4C, 0xBD, 0xDB, 0x98, 0xFF, + 0x2F, 0x60, 0x4A, 0x64, 0xA0, 0xDD, 0x2F, 0x60, 0x4C, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x40, 0x50, + 0x2F, 0x60, 0x50, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x40, 0x52, 0x2F, 0x60, 0x52, 0x62, 0xA2, 0xD3, + 0xFF, 0xFF, 0x40, 0x53, 0x31, 0x41, 0x2F, 0x60, 0x4E, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x40, 0x51, + 0x2F, 0x60, 0x48, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x60, 0x43, 0x20, 0x44, 0xBD, 0xDB, 0x21, 0x44, + 0xBD, 0xDB, 0x22, 0x44, 0xBD, 0xDB, 0x23, 0x44, 0xBD, 0xDB, 0x24, 0x44, 0xBD, 0xDB, 0x25, 0x44, + 0xBD, 0xDB, 0x26, 0x44, 0xBD, 0xDB, 0x27, 0x44, 0xBD, 0xDB, 0x28, 0x44, 0xBD, 0xDB, 0x29, 0x44, + 0xBD, 0xDB, 0x2A, 0x44, 0xBD, 0xDB, 0x2B, 0x44, 0xBD, 0xDB, 0x2C, 0x44, 0xBD, 0xDB, 0x2D, 0x44, + 0xBD, 0xDB, 0x2E, 0x44, 0xBD, 0xDB, 0x2F, 0x44, 0xBD, 0xDB, 0x2F, 0x60, 0x48, 0x64, 0xA0, 0xDD, + 0x61, 0x58, 0xFF, 0xFF, 0x24, 0xE2, 0x2D, 0xF3, 0x2C, 0xF3, 0x00, 0xBD, 0xCC, 0x84, 0x08, 0x03, + 0x2C, 0xFB, 0x06, 0x02, 0x65, 0x44, 0x2C, 0xFB, 0x8A, 0xFF, 0x80, 0x60, 0x00, 0x75, 0x88, 0xFF, + 0xF2, 0xF3, 0x31, 0x40, 0x01, 0x2A, 0x44, 0x00, 0x60, 0x43, 0x04, 0xB0, 0x02, 0xB0, 0x08, 0x24, + 0x16, 0x02, 0x29, 0x44, 0xFF, 0xFF, 0x00, 0xA8, 0xCC, 0x81, 0x0E, 0x03, 0x41, 0x49, 0x37, 0x02, + 0x63, 0x40, 0x08, 0x2A, 0x09, 0x00, 0xF7, 0xB3, 0x31, 0x60, 0x1E, 0x7C, 0xA4, 0xD1, 0xAD, 0x4F, + 0xFD, 0xB4, 0xA0, 0x5D, 0x44, 0x49, 0x2B, 0x00, 0x63, 0x40, 0x02, 0x2A, 0x14, 0x00, 0x31, 0x60, + 0x20, 0x64, 0xA0, 0xD3, 0x31, 0x60, 0x1C, 0x7C, 0xA4, 0xDB, 0x40, 0x49, 0x31, 0x60, 0x22, 0x64, + 0xA0, 0xD3, 0x31, 0x60, 0x1E, 0x7C, 0xA4, 0xDB, 0x0C, 0xBB, 0xFD, 0xB3, 0xAD, 0x4F, 0x02, 0xBC, + 0x00, 0x7F, 0xA0, 0x5D, 0x14, 0x00, 0x31, 0x60, 0x24, 0x64, 0xA0, 0xD3, 0x31, 0x60, 0x1C, 0x7C, + 0x0E, 0x18, 0xA4, 0xDB, 0x40, 0x49, 0x31, 0x60, 0x26, 0x64, 0xA0, 0xD3, 0x31, 0x60, 0x1E, 0x7C, + 0xA4, 0xDB, 0x08, 0xBB, 0xFB, 0xB3, 0xAD, 0x4F, 0x02, 0xBC, 0x00, 0x7F, 0xA0, 0x5D, 0xF2, 0xFD, + 0x01, 0x60, 0x4E, 0x61, 0xA1, 0xD3, 0x61, 0x43, 0x17, 0x18, 0x58, 0xD3, 0x62, 0x41, 0x03, 0x18, + 0xCC, 0x84, 0xA1, 0xDB, 0x11, 0x00, 0x49, 0xD3, 0xA3, 0xDB, 0x06, 0xA1, 0xA1, 0xD3, 0x59, 0xD1, + 0x60, 0x45, 0xA5, 0xD3, 0x59, 0xD1, 0xB0, 0x84, 0xA5, 0xDB, 0x64, 0x44, 0x06, 0x36, 0xCD, 0xFE, + 0x07, 0x36, 0xD6, 0xFE, 0xE5, 0x01, 0x23, 0x46, 0xB0, 0x60, 0xA4, 0x78, 0xFF, 0xFF, 0x46, 0x43, + 0x24, 0x60, 0xA4, 0x61, 0xA1, 0xD3, 0x59, 0xD1, 0x06, 0x1B, 0x59, 0xD3, 0x59, 0xD1, 0x03, 0x1B, + 0x59, 0xD3, 0x59, 0xD1, 0xF0, 0x18, 0x00, 0x63, 0x49, 0xDD, 0x60, 0x40, 0x02, 0x36, 0x11, 0x00, + 0x03, 0x36, 0x32, 0x00, 0x01, 0x36, 0x08, 0x00, 0x05, 0x3A, 0xEA, 0x01, 0xA4, 0xD3, 0x5A, 0xD3, + 0x9C, 0x85, 0xA4, 0x84, 0xA2, 0xDB, 0xE4, 0x01, 0x01, 0x60, 0x4E, 0x61, 0x00, 0x64, 0xA1, 0xDB, + 0xDF, 0x01, 0x31, 0x60, 0x3C, 0x64, 0x40, 0x45, 0x22, 0x00, 0x01, 0x60, 0x4E, 0x66, 0xA6, 0xD3, + 0x04, 0xA1, 0x60, 0x43, 0xA1, 0xD3, 0xC9, 0x81, 0x60, 0x45, 0x00, 0xBB, 0xA1, 0xDB, 0xBE, 0xD3, + 0x09, 0x03, 0xD4, 0x84, 0x9C, 0x84, 0xDC, 0x84, 0xFF, 0xFF, 0x04, 0x0E, 0xA3, 0xD1, 0x63, 0x46, + 0x64, 0x43, 0xF2, 0x01, 0x9C, 0x84, 0xDC, 0x85, 0x49, 0xDD, 0x61, 0x44, 0x00, 0xBB, 0xA6, 0xDB, + 0x02, 0x03, 0x65, 0x44, 0xBE, 0xDB, 0xBC, 0x01, 0x31, 0x60, 0x17, 0x64, 0x40, 0x45, 0x01, 0x60, + 0x4E, 0x66, 0xA6, 0xD3, 0xFF, 0xFF, 0xD0, 0x80, 0x0F, 0x18, 0x02, 0x03, 0x60, 0x46, 0xF9, 0x01, + 0x58, 0xD3, 0xA4, 0xD3, 0x60, 0x45, 0x00, 0x63, 0xA4, 0xDD, 0x05, 0x18, 0x58, 0xD3, 0xFF, 0xFF, + 0xC4, 0x83, 0xA2, 0xDD, 0xCA, 0x84, 0xA6, 0xDB, 0x25, 0x58, 0x64, 0x41, 0x00, 0x60, 0x46, 0x74, + 0xCD, 0xE2, 0x04, 0xE1, 0x02, 0x60, 0x00, 0xE1, 0x3F, 0x44, 0x40, 0x26, 0x0B, 0x00, 0x01, 0x2A, + 0x05, 0x00, 0x42, 0x60, 0x09, 0xE0, 0x60, 0x60, 0x1C, 0xE0, 0x04, 0x00, 0x42, 0x60, 0x09, 0xE0, + 0x80, 0x60, 0x1C, 0xE0, 0x04, 0x29, 0xFE, 0x01, 0xC4, 0xE2, 0x43, 0x64, 0x3A, 0xDB, 0xA4, 0xF3, + 0xFF, 0xFF, 0x60, 0x41, 0x3F, 0x44, 0x02, 0x27, 0x84, 0x00, 0x20, 0x2B, 0xFF, 0x01, 0x80, 0xE1, + 0x95, 0x60, 0x80, 0xE7, 0x61, 0x40, 0x40, 0x2B, 0x0D, 0x00, 0x05, 0x63, 0x32, 0x60, 0x58, 0x4F, + 0x6A, 0x78, 0xFF, 0xFF, 0x28, 0x63, 0xFF, 0xFF, 0xFE, 0x1F, 0x01, 0x63, 0x32, 0x60, 0x58, 0x4F, + 0x6A, 0x78, 0xFF, 0xFF, 0xFF, 0xB1, 0xCD, 0x81, 0xE1, 0x85, 0x27, 0x60, 0x3C, 0x64, 0x44, 0xD1, + 0xFF, 0xFF, 0x64, 0x43, 0x32, 0x60, 0x58, 0x4F, 0x6A, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x00, 0x63, + 0x32, 0x60, 0x58, 0x4F, 0x6A, 0x78, 0xFF, 0xFF, 0x27, 0x60, 0x58, 0x61, 0x29, 0x60, 0xE8, 0x62, + 0xA2, 0xD3, 0x45, 0xD1, 0x47, 0xBC, 0xE0, 0x84, 0x62, 0x45, 0x64, 0x5F, 0xE8, 0x83, 0x32, 0x60, + 0x58, 0x4F, 0x6A, 0x78, 0xFF, 0xFF, 0xA3, 0xF3, 0xCD, 0xE2, 0x60, 0x54, 0x04, 0xE1, 0x04, 0x29, + 0xFE, 0x01, 0xC4, 0xE2, 0x15, 0x60, 0xA2, 0xE7, 0x38, 0x69, 0xFF, 0xFF, 0x68, 0x44, 0x01, 0x16, + 0xFD, 0x01, 0x01, 0x2A, 0x36, 0x00, 0x03, 0x60, 0x80, 0x7C, 0xA3, 0x83, 0x29, 0x60, 0xE8, 0x62, + 0xA2, 0xD1, 0x43, 0xBB, 0xB3, 0x83, 0x95, 0x60, 0x80, 0xE7, 0x32, 0x60, 0x58, 0x4F, 0x6A, 0x78, + 0xFF, 0xFF, 0xE3, 0x83, 0x15, 0x60, 0xA2, 0xE7, 0x38, 0x69, 0xFF, 0xFF, 0x68, 0x41, 0x01, 0x16, + 0xFD, 0x01, 0x63, 0x47, 0x61, 0x40, 0x01, 0x2A, 0x03, 0x00, 0x00, 0x3A, 0xCC, 0x84, 0x02, 0x00, + 0x07, 0x3A, 0xDC, 0x84, 0xFF, 0xB4, 0xA5, 0xDB, 0x60, 0x47, 0xE8, 0x84, 0x47, 0x65, 0x29, 0x60, + 0xE8, 0x62, 0xA2, 0xD3, 0xB4, 0x85, 0xB4, 0x83, 0x80, 0xE1, 0x95, 0x60, 0x80, 0xE7, 0x32, 0x60, + 0x58, 0x4F, 0x6A, 0x78, 0xFF, 0xFF, 0xA3, 0xF3, 0xCD, 0xE2, 0x60, 0x54, 0x04, 0x29, 0xFE, 0x01, + 0xC4, 0xE2, 0xA4, 0xF3, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x2B, 0x04, 0x00, 0x32, 0x60, 0x43, 0x78, + 0xFF, 0xFF, 0xFF, 0x01, 0xA4, 0xF3, 0x80, 0xE1, 0xCC, 0x84, 0xE0, 0x85, 0x15, 0x60, 0xA2, 0xE7, + 0x26, 0x60, 0x78, 0x64, 0x58, 0x4F, 0x4F, 0x00, 0x26, 0x60, 0x94, 0x64, 0x58, 0x4F, 0x4B, 0x00, + 0x26, 0x60, 0xB0, 0x64, 0x58, 0x4F, 0x47, 0x00, 0x26, 0x60, 0xCC, 0x64, 0x58, 0x4F, 0x43, 0x00, + 0x26, 0x60, 0xE8, 0x64, 0x58, 0x4F, 0x3F, 0x00, 0x27, 0x60, 0x04, 0x64, 0x58, 0x4F, 0x3B, 0x00, + 0x27, 0x60, 0x20, 0x64, 0x58, 0x4F, 0x37, 0x00, 0x01, 0x68, 0xFF, 0x6A, 0xFF, 0xFF, 0x01, 0x16, + 0xFE, 0x01, 0x3F, 0x44, 0x20, 0x27, 0x00, 0x00, 0x3F, 0x40, 0x40, 0x26, 0x08, 0x00, 0x00, 0x60, + 0x18, 0x64, 0x00, 0x60, 0x00, 0x65, 0x94, 0x84, 0xA0, 0x50, 0x1D, 0x60, 0x19, 0xE2, 0xC4, 0xE2, + 0x00, 0x63, 0xA3, 0xFD, 0x32, 0x7B, 0x4D, 0xE2, 0xBF, 0xFE, 0xC4, 0xE2, 0x41, 0xFF, 0xE0, 0xFE, + 0xE1, 0xFE, 0xE2, 0xFE, 0x43, 0xFF, 0x44, 0xFF, 0x46, 0xFF, 0xA5, 0xF3, 0x62, 0xFF, 0x60, 0x40, + 0x05, 0x36, 0x2D, 0xFF, 0x07, 0x36, 0xD5, 0xFE, 0x08, 0xE1, 0x88, 0x60, 0x85, 0x71, 0x8D, 0xE2, + 0xA2, 0x60, 0x16, 0x78, 0xFF, 0xFF, 0x50, 0xEC, 0x63, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, + 0x40, 0xEC, 0x2F, 0x58, 0xFF, 0xFF, 0x44, 0xD3, 0x80, 0x7C, 0x60, 0x48, 0x60, 0x47, 0x00, 0x7F, + 0xB0, 0x8A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x2F, 0x58, 0xFF, 0xFF, 0x42, 0xFF, 0x40, 0xFF, + 0xDD, 0xFE, 0xAD, 0x4F, 0x00, 0x7F, 0x01, 0xBC, 0xA0, 0x5D, 0x00, 0xEE, 0x19, 0x61, 0xCD, 0x81, + 0xFF, 0xFF, 0xFD, 0x02, 0x43, 0x45, 0x20, 0x44, 0x60, 0xBC, 0x40, 0x40, 0x02, 0x60, 0xEE, 0x63, + 0x7F, 0xF3, 0xA3, 0xFD, 0x40, 0x7F, 0xA4, 0xFB, 0x05, 0x64, 0xA5, 0xFB, 0xDF, 0xFE, 0x19, 0xFF, + 0x24, 0x60, 0xDD, 0x64, 0x3F, 0x40, 0x01, 0x2B, 0x02, 0x00, 0x32, 0x60, 0xA2, 0x64, 0xA6, 0xFB, + 0xBB, 0x60, 0x20, 0x78, 0xFF, 0xFF, 0x04, 0xEE, 0xAD, 0x4F, 0x00, 0x7F, 0x01, 0xBC, 0xA0, 0x5D, + 0x19, 0x61, 0xCD, 0x81, 0xFF, 0xFF, 0xFD, 0x02, 0xAD, 0x4F, 0x00, 0x7F, 0x01, 0xBC, 0xA0, 0x5D, + 0x00, 0xEE, 0x15, 0x60, 0xA2, 0xE7, 0x25, 0x60, 0x02, 0x63, 0x25, 0x60, 0x76, 0x65, 0xDF, 0xFE, + 0x80, 0xE1, 0xBD, 0xD3, 0xFF, 0xFF, 0x60, 0x48, 0x60, 0x47, 0x80, 0xBC, 0x00, 0x7F, 0x60, 0x4A, + 0xD7, 0x80, 0xA1, 0xFF, 0xFF, 0xFF, 0xF5, 0x02, 0x25, 0x60, 0x76, 0x63, 0x26, 0x60, 0x78, 0x65, + 0xBD, 0xD3, 0xFF, 0xFF, 0x60, 0x48, 0x60, 0x47, 0x80, 0xBC, 0x00, 0x7F, 0x60, 0x4A, 0xD7, 0x80, + 0xA1, 0xFF, 0xFF, 0xFF, 0xF5, 0x02, 0x3F, 0x40, 0x20, 0x2B, 0x00, 0x00, 0x01, 0x68, 0xFF, 0x6A, + 0xBF, 0xFE, 0x33, 0x60, 0x8A, 0x78, 0xFF, 0xFF, 0x3F, 0x40, 0x20, 0x2B, 0xAD, 0x00, 0x01, 0x16, + 0xFE, 0x01, 0x38, 0x69, 0xA1, 0xFF, 0xFF, 0xFF, 0x68, 0x44, 0x01, 0x2A, 0xA5, 0x00, 0x27, 0x60, + 0xB4, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xFF, 0xFF, 0x08, 0x28, 0xA2, 0xDB, 0x7F, 0xF1, + 0x80, 0x60, 0x00, 0x64, 0xB0, 0x9C, 0x01, 0x00, 0x7F, 0xF1, 0xDD, 0xFE, 0xAD, 0x4F, 0x00, 0x7F, + 0x01, 0xBC, 0xA0, 0x5D, 0x00, 0xEE, 0x43, 0x45, 0x20, 0x44, 0x20, 0xBC, 0x40, 0x40, 0x02, 0x60, + 0xEE, 0x64, 0xA3, 0xFB, 0xA4, 0xF9, 0x05, 0x64, 0xA5, 0xFB, 0xDF, 0xFE, 0x19, 0xFF, 0x83, 0x00, + 0x20, 0x44, 0x20, 0xBC, 0x40, 0x40, 0x43, 0x45, 0xA4, 0xD1, 0xDA, 0x83, 0xC3, 0x85, 0x80, 0xE1, + 0xDF, 0xFE, 0xBD, 0xD3, 0xFF, 0xFF, 0x60, 0x48, 0x60, 0x47, 0x80, 0xBC, 0x00, 0x7F, 0x60, 0x4A, + 0xD7, 0x80, 0xA1, 0xFF, 0xF6, 0x02, 0xBF, 0xFE, 0x6E, 0x00, 0x3F, 0x40, 0x40, 0x26, 0x13, 0x00, + 0x0B, 0x60, 0xF8, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x10, 0x64, 0x90, 0x84, 0xA0, 0x50, 0xF8, 0xA2, + 0xA2, 0xD1, 0x0A, 0x60, 0x19, 0x64, 0x90, 0x84, 0xA0, 0x52, 0x06, 0xA2, 0xA2, 0xD1, 0x46, 0x60, + 0x09, 0x64, 0x90, 0x84, 0xA0, 0x50, 0xAD, 0x4F, 0xFE, 0xB4, 0xA0, 0x5D, 0xAD, 0x4F, 0xFD, 0xB4, + 0xA0, 0x5D, 0x02, 0xEE, 0xBD, 0xFE, 0x50, 0x00, 0x80, 0xE1, 0x01, 0x16, 0xFE, 0x01, 0x64, 0x48, + 0x92, 0x6A, 0xA1, 0xFF, 0xFF, 0xFF, 0x68, 0x40, 0x27, 0x60, 0xA2, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, + 0xDC, 0x84, 0xFF, 0xFF, 0x08, 0x28, 0xA2, 0xDB, 0x3F, 0x00, 0x80, 0xE1, 0x01, 0x16, 0xFE, 0x01, + 0x01, 0x68, 0xA7, 0x6A, 0xA1, 0xFF, 0xFF, 0xFF, 0x68, 0x40, 0x36, 0x00, 0x20, 0x44, 0x20, 0xBC, + 0x40, 0x40, 0x80, 0xE1, 0x64, 0x46, 0x01, 0x16, 0xFE, 0x01, 0x21, 0x69, 0xA1, 0xFF, 0xFF, 0xFF, + 0x68, 0x5E, 0x01, 0x16, 0xFE, 0x01, 0x22, 0x69, 0xA1, 0xFF, 0xFF, 0xFF, 0x68, 0x5F, 0x26, 0xFA, + 0x1C, 0xF2, 0x01, 0x16, 0xFE, 0x01, 0x3A, 0x69, 0xA1, 0xFF, 0xFF, 0xFF, 0x68, 0x5F, 0x27, 0xFA, + 0x1B, 0x00, 0x20, 0x44, 0x20, 0xBC, 0x40, 0x40, 0x43, 0x45, 0xBE, 0xD5, 0xA4, 0xD2, 0x5A, 0x86, + 0xEF, 0xA0, 0x11, 0x61, 0x01, 0x06, 0x60, 0x41, 0x24, 0x60, 0xE0, 0x63, 0x80, 0xE1, 0xBD, 0xD3, + 0x26, 0x42, 0x01, 0x16, 0xFE, 0x01, 0x60, 0x49, 0xA1, 0xFF, 0xFF, 0xFF, 0x68, 0x44, 0xCD, 0x81, + 0xA2, 0xDA, 0x5A, 0x86, 0xF4, 0x02, 0x25, 0x43, 0x21, 0xE1, 0x00, 0x64, 0xBF, 0xDB, 0x20, 0x44, + 0x20, 0x2A, 0x07, 0x00, 0x07, 0xB4, 0x04, 0x36, 0xC3, 0xFE, 0x06, 0x36, 0xCC, 0xFE, 0x07, 0x36, + 0xD5, 0xFE, 0x20, 0x44, 0xD8, 0xB4, 0x40, 0x40, 0x20, 0x44, 0x40, 0x2A, 0x07, 0x00, 0x9F, 0xFE, + 0x1E, 0x05, 0xBF, 0xB4, 0x40, 0x40, 0xA6, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0x24, 0x60, 0x80, 0x63, + 0xBD, 0xD3, 0x02, 0x61, 0x17, 0x1B, 0x04, 0xA3, 0xBD, 0xD3, 0x02, 0x61, 0x13, 0x1B, 0x04, 0xA3, + 0xBD, 0xD3, 0x02, 0x61, 0x0F, 0x1B, 0x04, 0xA3, 0xBD, 0xD3, 0x04, 0x61, 0x0B, 0x1B, 0x04, 0xA3, + 0xBD, 0xD3, 0x06, 0x61, 0x07, 0x1B, 0x04, 0xA3, 0xBD, 0xD3, 0x07, 0x61, 0x03, 0x1B, 0xBB, 0x60, + 0x20, 0x78, 0xFF, 0xFF, 0xA3, 0xD1, 0x40, 0x44, 0x20, 0x44, 0x07, 0xB5, 0xD4, 0x85, 0x35, 0x80, + 0x24, 0x45, 0x24, 0x60, 0xBC, 0x64, 0x44, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0xE1, 0x43, 0x45, + 0x20, 0x44, 0x20, 0xBC, 0x40, 0x40, 0x64, 0x43, 0xBD, 0xD3, 0xBD, 0xD1, 0x40, 0x44, 0x10, 0x27, + 0x10, 0x00, 0xFF, 0x60, 0x7F, 0x65, 0x15, 0x60, 0xA2, 0x64, 0x24, 0x40, 0x08, 0x2B, 0xA4, 0x84, + 0xA0, 0x57, 0xFF, 0xFF, 0x64, 0x49, 0xFF, 0xFF, 0x68, 0x44, 0x01, 0x16, 0xFD, 0x01, 0x00, 0x7F, + 0xA3, 0xDB, 0xA1, 0x01, 0x80, 0xE1, 0x43, 0x45, 0x20, 0x44, 0x20, 0xBC, 0x40, 0x40, 0x64, 0x43, + 0xBD, 0xD3, 0xBD, 0xD1, 0x40, 0x44, 0x10, 0x2B, 0x11, 0x00, 0xA3, 0xD3, 0xFF, 0xFF, 0x15, 0x60, + 0x80, 0xE7, 0x24, 0x40, 0x07, 0x27, 0x02, 0x00, 0x50, 0xEC, 0x00, 0x00, 0x60, 0x4A, 0xFF, 0xFF, + 0x01, 0x16, 0xFE, 0x01, 0x24, 0x40, 0x20, 0x2B, 0x40, 0xEC, 0x0F, 0x00, 0x15, 0x60, 0x22, 0x64, + 0x24, 0x40, 0x08, 0x27, 0x80, 0xBC, 0xA3, 0xD3, 0xA0, 0x57, 0x60, 0x48, 0x64, 0x44, 0x80, 0xBC, + 0xFF, 0xB4, 0x60, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x75, 0x01, 0x42, 0x6F, 0x6F, 0x74, + 0x63, 0x6F, 0x64, 0x65, 0x20, 0x21, 0x21, 0x20, 0x20, 0x00, 0x53, 0x54, 0x41, 0x2F, 0x41, 0x50, + 0x20, 0x46, 0x75, 0x6E, 0x63, 0x27, 0x73, 0x00, 0x1F, 0x00, 0x03, 0x00, 0x02, 0x00, 0x24, 0x00, + 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x02, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x06, 0x00, 0x07, 0x00, 0x05, 0x00, 0x06, 0x00, 0x07, 0x00, 0x06, 0x00, 0x06, 0x00, 0x07, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x02, 0x00, 0x40, 0x00, 0x32, 0x00, 0x32, 0x00, 0x0A, 0x00, 0x02, 0x00, 0x06, 0x00, 0x40, 0x00, + 0x32, 0x00, 0x36, 0x00, 0x0A, 0x00, 0x02, 0x00, 0x06, 0x00, 0x40, 0x00, 0x3B, 0x00, 0x40, 0x00, + 0x17, 0x00, 0x07, 0x00, 0x07, 0x00, 0x4A, 0x00, 0x40, 0x00, 0x4A, 0x00, 0x1E, 0x00, 0x0C, 0x00, + 0x08, 0x00, 0x57, 0x00, 0x4D, 0x00, 0x57, 0x00, 0x2B, 0x00, 0x19, 0x00, 0x08, 0x00, 0x5D, 0x00, + 0x53, 0x00, 0x5D, 0x00, 0x31, 0x00, 0x1F, 0x00, 0x08, 0x00, 0xA9, 0xF3, 0x21, 0x61, 0x00, 0x7C, + 0x01, 0x00, 0x00, 0xFA, 0x60, 0x46, 0xFE, 0x63, 0xA3, 0xD8, 0xFE, 0x1F, 0xCD, 0x81, 0xD8, 0x84, + 0xF8, 0x02, 0x21, 0x61, 0x80, 0x67, 0x40, 0x4A, 0xA9, 0xF5, 0x14, 0x60, 0x02, 0x65, 0x01, 0x7C, + 0x07, 0x18, 0x2A, 0x43, 0x02, 0xFC, 0x5F, 0x8A, 0x8E, 0xF8, 0x70, 0xF8, 0x00, 0xF4, 0xF8, 0x01, + 0x2E, 0x58, 0xFF, 0xFF, 0x3F, 0x40, 0x40, 0x26, 0x0A, 0x00, 0x42, 0x60, 0x09, 0xE0, 0x3F, 0x40, + 0x01, 0x2A, 0x03, 0x00, 0x60, 0x60, 0x1C, 0xE0, 0x02, 0x00, 0x80, 0x60, 0x1C, 0xE0, 0x40, 0xEC, + 0x00, 0xED, 0x02, 0xEE, 0x80, 0x60, 0x58, 0xEC, 0x80, 0x60, 0x00, 0xED, 0x80, 0x60, 0x82, 0xEE, + 0xC0, 0x60, 0x59, 0xEC, 0xC0, 0x60, 0x07, 0xED, 0xAD, 0x4F, 0xFE, 0xB4, 0xA0, 0x5D, 0x00, 0xF3, + 0x28, 0xFB, 0x40, 0x44, 0x2F, 0x60, 0x52, 0x7C, 0x20, 0xF9, 0xA2, 0x60, 0x00, 0x7C, 0x21, 0xF9, + 0xA2, 0x60, 0xE0, 0x7C, 0x22, 0xF9, 0x18, 0x60, 0x97, 0x7C, 0x23, 0xF9, 0x18, 0x60, 0xA8, 0x7C, + 0x24, 0xF9, 0x18, 0x60, 0xD2, 0x7C, 0x25, 0xF9, 0x18, 0x60, 0xE3, 0x7C, 0x26, 0xF9, 0x91, 0x60, + 0x00, 0xE8, 0x28, 0xE8, 0x44, 0x60, 0x02, 0xE6, 0x10, 0x67, 0x40, 0x52, 0x10, 0x60, 0x04, 0xE6, + 0x08, 0x60, 0x00, 0x63, 0xFA, 0x60, 0x00, 0x65, 0xBD, 0xD3, 0xBD, 0xD3, 0x02, 0xA8, 0xD4, 0x80, + 0x4A, 0x02, 0x49, 0x02, 0xDB, 0x83, 0xFA, 0x60, 0x27, 0x65, 0x5B, 0xD3, 0xBF, 0xD1, 0x1A, 0x18, + 0xC3, 0x83, 0xD4, 0x80, 0xC3, 0x83, 0xF9, 0x02, 0xDB, 0x83, 0xD3, 0x83, 0xD3, 0x86, 0x64, 0x41, + 0xCD, 0x81, 0xA6, 0xD1, 0xDA, 0x86, 0x25, 0x60, 0x02, 0x65, 0x00, 0x60, 0x72, 0x63, 0xA5, 0xD3, + 0xDA, 0x85, 0x90, 0x84, 0xFF, 0x27, 0x02, 0x00, 0xA2, 0xD9, 0x01, 0x00, 0xF8, 0x1F, 0xCD, 0x81, + 0xFF, 0xFF, 0xEF, 0x02, 0x08, 0x60, 0x06, 0x63, 0xFA, 0x60, 0x28, 0x65, 0x5B, 0xD3, 0xBF, 0xD1, + 0x0B, 0x18, 0xC3, 0x83, 0xD4, 0x80, 0xC3, 0x83, 0xF9, 0x02, 0xBF, 0xD3, 0x29, 0x60, 0xE8, 0x62, + 0x0E, 0xB4, 0xE0, 0x84, 0xE0, 0x84, 0xA2, 0xDB, 0x08, 0x60, 0x06, 0x63, 0xFD, 0x60, 0x0C, 0x65, + 0x5B, 0xD3, 0xBF, 0xD1, 0x10, 0x18, 0xC3, 0x83, 0xD4, 0x80, 0xC3, 0x83, 0xF9, 0x02, 0xFA, 0xA3, + 0xA3, 0xD3, 0x02, 0x60, 0x00, 0x65, 0xF7, 0xA0, 0xFC, 0xA0, 0x0D, 0x05, 0x04, 0x05, 0x78, 0x43, + 0x02, 0x61, 0x24, 0x60, 0xDD, 0x78, 0x21, 0x60, 0x00, 0x65, 0x3F, 0x43, 0x3F, 0x43, 0x21, 0x60, + 0x00, 0x65, 0xC0, 0x60, 0x8F, 0xEE, 0xB7, 0x84, 0x40, 0x5F, 0x00, 0x60, 0x30, 0xE2, 0x00, 0x60, + 0x50, 0xE2, 0x00, 0x60, 0x79, 0xE2, 0x00, 0x60, 0x90, 0xE2, 0x01, 0x60, 0xD0, 0xE2, 0x01, 0x60, + 0xF0, 0xE2, 0x01, 0x60, 0xB0, 0xE2, 0x26, 0x64, 0x35, 0xFB, 0x01, 0x60, 0x30, 0x64, 0x0A, 0xA4, + 0x38, 0xFB, 0x60, 0x45, 0x00, 0x60, 0xF8, 0x64, 0x0A, 0xA4, 0x39, 0xFB, 0x35, 0xF1, 0x0A, 0x64, + 0xC4, 0x84, 0x36, 0xFB, 0xC0, 0x84, 0x0A, 0xA4, 0x37, 0xFB, 0x09, 0x60, 0x2A, 0x64, 0xB9, 0xFB, + 0x82, 0xFF, 0x92, 0xFF, 0x5C, 0x41, 0x5C, 0x46, 0x5C, 0x47, 0x00, 0xE1, 0xA3, 0x60, 0x4B, 0x63, + 0x0C, 0x60, 0x16, 0x64, 0xA0, 0xDD, 0x87, 0xFF, 0x97, 0xFF, 0x0C, 0x60, 0x02, 0x64, 0x40, 0x5A, + 0x06, 0xA4, 0x40, 0x5B, 0x5C, 0x5E, 0x5C, 0x51, 0x28, 0x60, 0x44, 0x62, 0xA2, 0xD3, 0x7F, 0xFB, + 0x2D, 0x60, 0xCC, 0x61, 0x27, 0x7C, 0xA1, 0xD9, 0x6D, 0x60, 0x1C, 0x63, 0x7F, 0xA3, 0xE3, 0x87, + 0x00, 0x7F, 0xAA, 0xFB, 0x02, 0x60, 0x7F, 0x64, 0x00, 0x60, 0x42, 0x65, 0xD4, 0x84, 0xAB, 0xFB, + 0xDC, 0x84, 0xA9, 0xFB, 0x24, 0x60, 0x0E, 0x62, 0xA2, 0xDB, 0x34, 0x60, 0x58, 0x4E, 0x64, 0x78, + 0xFF, 0xFF, 0xAB, 0xF1, 0xAA, 0xF3, 0x7C, 0x63, 0xAD, 0xFB, 0x60, 0x46, 0x01, 0xFC, 0xDC, 0x84, + 0xD0, 0x80, 0x00, 0xFA, 0xFA, 0x04, 0xAE, 0xFB, 0x60, 0x46, 0x00, 0x64, 0x00, 0xFA, 0x63, 0x44, + 0x80, 0x7F, 0x01, 0xFA, 0xAB, 0xF3, 0xAA, 0xF1, 0xDC, 0x84, 0xD0, 0x84, 0xAC, 0xFB, 0x03, 0x60, + 0x26, 0x61, 0xAE, 0x60, 0x58, 0x4D, 0xB1, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0x2E, 0xFB, 0x82, 0xFF, + 0x40, 0x42, 0x87, 0xFF, 0xAC, 0xF3, 0xB4, 0xFB, 0x08, 0x60, 0x00, 0x63, 0xFA, 0x60, 0x00, 0x65, + 0xBD, 0xD3, 0xA3, 0xD3, 0x02, 0xA8, 0xD4, 0x80, 0x24, 0x02, 0x23, 0x02, 0x2D, 0x60, 0x1A, 0x62, + 0xA2, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0x80, 0x26, 0x1C, 0x00, 0x04, 0xA3, 0xFD, 0x60, 0x0D, 0x65, + 0x5B, 0xD3, 0xBF, 0xD1, 0x16, 0x18, 0xC3, 0x83, 0xD4, 0x80, 0xC3, 0x83, 0xF9, 0x02, 0xBF, 0xD3, + 0xAD, 0x49, 0xFE, 0xA0, 0x00, 0x64, 0x0E, 0x04, 0x08, 0xB1, 0x20, 0xBC, 0x08, 0x28, 0x18, 0xBC, + 0x1C, 0x60, 0xB8, 0x63, 0x07, 0x7C, 0xA3, 0xD9, 0x1C, 0x60, 0xB6, 0x63, 0x05, 0x7C, 0xA3, 0xD9, + 0x01, 0x00, 0x00, 0x64, 0x1C, 0x60, 0xB4, 0x63, 0xA3, 0xDB, 0x00, 0x64, 0x40, 0x50, 0x63, 0xFF, + 0x60, 0xFF, 0x66, 0xFF, 0x65, 0xFF, 0x64, 0xFF, 0x61, 0xFF, 0x62, 0xFF, 0x49, 0x60, 0x02, 0xE1, + 0x52, 0x60, 0x02, 0xE1, 0x5B, 0x60, 0x02, 0xE1, 0x65, 0x60, 0x02, 0xE1, 0x6C, 0x60, 0x02, 0xE1, + 0x76, 0x60, 0x02, 0xE1, 0x41, 0x60, 0x02, 0xE1, 0x04, 0x65, 0x2D, 0x60, 0x18, 0x64, 0x44, 0xD3, + 0xEF, 0x60, 0x58, 0x4E, 0xBD, 0x78, 0xFF, 0xFF, 0x24, 0x60, 0x9E, 0x65, 0x0C, 0x64, 0xA5, 0xDB, + 0x36, 0x60, 0x1E, 0x64, 0xA1, 0xFB, 0x2D, 0xFF, 0x06, 0x61, 0x41, 0x4B, 0x09, 0x60, 0x08, 0x61, + 0xAE, 0x60, 0x58, 0x4D, 0xB1, 0x78, 0xFF, 0xFF, 0xF0, 0x67, 0x0E, 0xFA, 0x24, 0x60, 0x7A, 0x62, + 0x24, 0x60, 0x5E, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0x2B, 0x41, 0x4D, 0x8B, 0xFF, 0xFF, 0xE9, 0x02, 0x06, 0x61, 0x41, 0x4B, 0x09, 0x60, + 0x08, 0x61, 0xAE, 0x60, 0x58, 0x4D, 0xB1, 0x78, 0xFF, 0xFF, 0x24, 0x60, 0x7A, 0x62, 0x24, 0x60, + 0x52, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0x2B, 0x41, 0x4D, 0x8B, 0xFF, 0xFF, 0xEB, 0x02, 0x19, 0x60, 0x17, 0x78, 0xFF, 0xFF, 0x00, 0xEA, + 0x00, 0xEB, 0x50, 0x60, 0x03, 0xEA, 0x51, 0x60, 0x13, 0xEA, 0x52, 0x60, 0x30, 0xEA, 0x53, 0x60, + 0x40, 0xEA, 0x54, 0x60, 0x52, 0xEA, 0x55, 0x60, 0x6D, 0xEA, 0x56, 0x60, 0x71, 0xEA, 0x57, 0x60, + 0x8B, 0xEA, 0x58, 0x60, 0x47, 0xEA, 0x59, 0x60, 0xA0, 0xEA, 0x5A, 0x60, 0xB2, 0xEA, 0x5B, 0x60, + 0xC1, 0xEA, 0x5C, 0x60, 0xD7, 0xEA, 0x5D, 0x60, 0xEB, 0xEA, 0x5E, 0x60, 0xA0, 0xEA, 0x50, 0x60, + 0x36, 0xEB, 0x51, 0x60, 0x37, 0xEB, 0x52, 0x60, 0x20, 0xEB, 0x53, 0x60, 0xE4, 0xEB, 0x54, 0x60, + 0x34, 0xEB, 0x55, 0x60, 0x58, 0xEB, 0x56, 0x60, 0x48, 0xEB, 0x57, 0x60, 0xD0, 0xEB, 0x58, 0x60, + 0xC3, 0xEB, 0x59, 0x60, 0xFC, 0xEB, 0x5A, 0x60, 0x34, 0xEB, 0x5B, 0x60, 0x58, 0xEB, 0x5C, 0x60, + 0xC0, 0xEB, 0x5D, 0x60, 0xD0, 0xEB, 0x5E, 0x60, 0x91, 0xEB, 0x00, 0xEA, 0x00, 0xEB, 0xE0, 0x60, + 0x02, 0xEA, 0xE0, 0x60, 0x03, 0xEB, 0xA0, 0x60, 0x00, 0xEB, 0xB0, 0x60, 0x00, 0xEB, 0xAB, 0x48, + 0x40, 0x3B, 0x01, 0x00, 0xFC, 0x01, 0x00, 0xEB, 0x03, 0x60, 0x02, 0x62, 0x62, 0x44, 0xA2, 0xDB, + 0x0F, 0x64, 0x60, 0x7F, 0xA0, 0x5A, 0x80, 0x60, 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, 0xD1, 0x60, + 0x00, 0xEA, 0x3F, 0x40, 0x40, 0x26, 0x08, 0x00, 0x00, 0x60, 0x18, 0x64, 0x00, 0x60, 0x00, 0x65, + 0x94, 0x84, 0xA0, 0x50, 0x1D, 0x60, 0x19, 0xE2, 0x24, 0x44, 0xFF, 0xB4, 0x04, 0xFB, 0x50, 0x60, + 0x00, 0x64, 0x05, 0xFB, 0x10, 0x60, 0x10, 0x75, 0x25, 0x60, 0x11, 0x78, 0xFF, 0xFF, 0x3F, 0x41, + 0xA5, 0x4C, 0x50, 0x37, 0x04, 0x00, 0x01, 0xB9, 0x41, 0x5F, 0xB5, 0x60, 0x55, 0xE0, 0x0C, 0x60, + 0x10, 0x62, 0xA2, 0xD3, 0x01, 0x60, 0x01, 0x65, 0xD4, 0x80, 0x5A, 0xD1, 0x0F, 0x02, 0x5A, 0xD3, + 0x3C, 0x60, 0x00, 0x66, 0xE0, 0x87, 0x40, 0x4A, 0x68, 0x60, 0x28, 0x61, 0x64, 0x44, 0xC8, 0x84, + 0x0C, 0x63, 0xAA, 0x46, 0x58, 0xD0, 0xAA, 0x46, 0x59, 0xD8, 0xFB, 0x1F, 0x08, 0x60, 0x00, 0x63, + 0xFA, 0x60, 0x00, 0x65, 0xBD, 0xD3, 0xA3, 0xD3, 0x02, 0xA8, 0xD4, 0x80, 0x61, 0x02, 0x60, 0x02, + 0x6E, 0x60, 0x58, 0x61, 0x3C, 0x60, 0x00, 0x66, 0x41, 0x4B, 0x2B, 0x41, 0x6E, 0x60, 0xA0, 0x7C, + 0xD1, 0x80, 0xA1, 0xD2, 0x25, 0x05, 0x59, 0xD0, 0x60, 0x45, 0x59, 0xD2, 0x44, 0x47, 0xE0, 0x87, + 0x40, 0x4A, 0x59, 0xD2, 0x59, 0x8B, 0x40, 0x4C, 0x08, 0x60, 0x00, 0x63, 0xBE, 0xD3, 0xBD, 0xD1, + 0xEC, 0x18, 0xD4, 0x80, 0xEA, 0x18, 0x03, 0x03, 0xC3, 0x83, 0xC3, 0x83, 0xF7, 0x01, 0x67, 0x44, + 0xC0, 0x84, 0xE0, 0x85, 0x2C, 0x44, 0xD4, 0x80, 0x63, 0x41, 0x01, 0x06, 0x65, 0x44, 0xC8, 0x83, + 0xAA, 0x46, 0x59, 0xD1, 0x27, 0xD8, 0x5A, 0x87, 0xFC, 0x1F, 0xAA, 0x46, 0x2B, 0x41, 0xD5, 0x01, + 0x6E, 0x60, 0xA0, 0x61, 0x41, 0x4B, 0x2B, 0x41, 0x6E, 0x60, 0xD8, 0x7C, 0xD1, 0x80, 0xA1, 0xD2, + 0x27, 0x05, 0x59, 0xD0, 0x60, 0x45, 0x59, 0xD2, 0x44, 0x47, 0xE0, 0x87, 0x40, 0x4A, 0x59, 0xD2, + 0x59, 0x8B, 0x40, 0x4C, 0x08, 0x60, 0x00, 0x63, 0xBE, 0xD3, 0xBD, 0xD1, 0xEC, 0x18, 0xD4, 0x80, + 0xEA, 0x18, 0x03, 0x03, 0xC3, 0x83, 0xC3, 0x83, 0xF7, 0x01, 0x04, 0xA3, 0xA3, 0xD1, 0x5A, 0x88, + 0x2C, 0x43, 0xD3, 0x80, 0xFF, 0xFF, 0x01, 0x06, 0x64, 0x43, 0xCF, 0x83, 0xAA, 0x46, 0x60, 0xFE, + 0x28, 0xD1, 0x5E, 0x88, 0x27, 0xD8, 0x5A, 0x87, 0xFB, 0x1F, 0x20, 0xFE, 0xAA, 0x46, 0xD3, 0x01, + 0xB8, 0xFE, 0xB9, 0xFE, 0xBA, 0xFE, 0xBB, 0xFE, 0xBD, 0xFE, 0xBF, 0xFE, 0x2D, 0x60, 0x1A, 0x62, + 0xA2, 0xD3, 0x12, 0x63, 0x60, 0x40, 0x01, 0x27, 0x05, 0x00, 0x0B, 0x60, 0xEA, 0x62, 0x00, 0x64, + 0x5A, 0xDB, 0xFE, 0x1F, 0x34, 0x60, 0x81, 0x78, 0xFF, 0xFF, 0xF1, 0xFF, 0xF6, 0x6C, 0x1E, 0x00, + 0x04, 0x00, 0xF2, 0xFF, 0xFA, 0x6C, 0x1E, 0x00, 0x04, 0x00, 0xFB, 0xFF, 0x02, 0x6D, 0x1E, 0x00, + 0x04, 0x00, 0xF1, 0xFF, 0x8C, 0x64, 0x1E, 0x00, 0x04, 0x00, 0xF2, 0xFF, 0x90, 0x64, 0x1E, 0x00, + 0x04, 0x00, 0xFB, 0xFF, 0x98, 0x64, 0x1E, 0x00, 0x04, 0x00, 0x86, 0xFD, 0x50, 0x28, 0x00, 0x00, + 0x06, 0x00, 0x10, 0xFD, 0x74, 0x01, 0x00, 0x00, 0x02, 0x00, 0x14, 0xFD, 0x18, 0x2D, 0x00, 0x00, + 0x0A, 0x00, 0x20, 0xFA, 0x94, 0x26, 0x00, 0x00, 0x0E, 0x00, 0x21, 0xFA, 0x78, 0x26, 0x00, 0x00, + 0x0E, 0x00, 0x22, 0xFA, 0xB0, 0x26, 0x00, 0x00, 0x0E, 0x00, 0x23, 0xFA, 0x64, 0x25, 0x00, 0x00, + 0x01, 0x00, 0x24, 0xFA, 0x58, 0x27, 0x00, 0x00, 0x0E, 0x00, 0x25, 0xFA, 0x78, 0x25, 0x00, 0x00, + 0x80, 0x00, 0x26, 0xFA, 0x5E, 0x25, 0x00, 0x00, 0x01, 0x00, + +}; /* fw_image_3_data */ + +static const hcf_8 fw_image_4_data[] = { + 0xA2, 0x60, 0xDD, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA2, 0x60, 0xC3, 0x78, 0x41, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA2, 0x60, 0xC9, 0x78, 0xC4, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA2, 0x60, 0x19, 0x78, 0x43, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x44, 0xFF, 0x20, 0x54, 0xCD, 0xE2, 0xA2, 0x60, 0xDB, 0x78, 0x08, 0xE1, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA2, 0x60, 0xDD, 0x78, 0x44, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA2, 0x60, 0xDD, 0x78, 0x46, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA2, 0x60, 0xDD, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA8, 0x60, 0x73, 0x78, 0x4C, 0x4E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA7, 0x60, 0xFB, 0x78, 0x4C, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC4, 0xE2, 0x84, 0xFF, 0x22, 0x58, 0x82, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA3, 0x60, 0x7E, 0x78, 0x43, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xE4, 0xE2, 0xA8, 0x60, 0x14, 0x78, 0xB5, 0xF3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xBA, 0x60, 0xCE, 0x78, 0x64, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA8, 0x60, 0x87, 0x78, 0xA4, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA8, 0x60, 0x55, 0x78, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xAE, 0x60, 0x1E, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xAE, 0x60, 0x4B, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xAC, 0x60, 0xD8, 0x78, 0x42, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xAD, 0x60, 0x08, 0x78, 0x43, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xAD, 0x60, 0x08, 0x78, 0x44, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xAF, 0x60, 0xC0, 0x78, 0x45, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xAD, 0x60, 0x0B, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x60, 0x83, 0x64, 0x80, 0x29, 0x09, 0xFB, 0xAD, 0x60, 0xE6, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, + 0x31, 0x60, 0x16, 0x78, 0x40, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x30, 0x60, 0xA1, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB9, 0x60, 0x4B, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB8, 0x60, 0xBB, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB0, 0x60, 0x89, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA1, 0xFF, 0xFF, 0xFF, 0x83, 0x3E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xBB, 0x60, 0x25, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0x41, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0x42, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0xB0, 0xFF, 0xB1, 0xFF, 0x40, 0xFF, 0x43, 0xFF, 0xBB, 0x60, 0x20, 0x78, 0x44, 0xFF, 0xFF, 0x01, + 0xBB, 0x60, 0x25, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0x33, 0x60, 0x9B, 0x78, 0x45, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0xBB, 0x60, 0x20, 0x78, 0x84, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0xBB, 0x60, 0x1F, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0xBF, 0x60, 0xDB, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xEB, 0x60, 0x1F, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xBF, 0x60, 0xE3, 0x78, 0x42, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xBF, 0x60, 0xE3, 0x78, 0x24, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xE9, 0x60, 0xE3, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xBF, 0x60, 0xE3, 0x78, 0x44, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xBF, 0x60, 0xE3, 0x78, 0x84, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xBF, 0x60, 0xE3, 0x78, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x24, 0x60, 0xE5, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x25, 0x60, 0x14, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x25, 0x60, 0x32, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x25, 0x60, 0x11, 0x78, 0x28, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x25, 0x60, 0x11, 0x78, 0x44, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x25, 0x60, 0x11, 0x78, 0x45, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x25, 0x60, 0x11, 0x78, 0x46, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x60, 0x87, 0x64, 0x80, 0x29, 0x09, 0xFB, 0x47, 0xFF, 0x25, 0x60, 0x11, 0x78, 0xFF, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x2F, 0x60, 0x63, 0x78, 0x42, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x2F, 0x60, 0xB3, 0x78, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, 0x07, 0x02, 0x62, 0xFF, 0x63, 0xFF, 0x64, 0xFF, 0x65, 0xFF, + 0x66, 0xFF, 0xBF, 0xFE, 0xA1, 0xFF, 0x82, 0xFF, 0x88, 0xFF, 0x6C, 0x40, 0x41, 0xFF, 0xC4, 0xE2, + 0x43, 0xFF, 0x5C, 0x49, 0x08, 0xE1, 0xA2, 0x60, 0x16, 0x78, 0xFF, 0xFF, 0xA1, 0xFF, 0x98, 0xFF, + 0x80, 0x3E, 0x9F, 0xFE, 0x03, 0x04, 0x31, 0x60, 0x75, 0x78, 0xFF, 0xFF, 0xE2, 0xFE, 0x40, 0x05, + 0xE0, 0xFE, 0x5B, 0x05, 0xE1, 0xFE, 0xF2, 0x04, 0x29, 0x40, 0x08, 0x26, 0xEF, 0x01, 0x72, 0x44, + 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xB5, 0xF3, 0xE8, 0x85, 0xFF, 0xB7, + 0xE0, 0x84, 0xE0, 0x84, 0xB4, 0x85, 0x73, 0x44, 0xD4, 0x84, 0x10, 0x65, 0xD4, 0x80, 0xFF, 0xFF, + 0x26, 0x04, 0x3F, 0x40, 0x40, 0x26, 0x13, 0x00, 0x0B, 0x60, 0xF8, 0x62, 0xA2, 0xD1, 0x00, 0x60, + 0x10, 0x64, 0x90, 0x84, 0xA0, 0x50, 0xF8, 0xA2, 0xA2, 0xD1, 0x0A, 0x60, 0x19, 0x64, 0x90, 0x84, + 0xA0, 0x52, 0x06, 0xA2, 0xA2, 0xD1, 0x46, 0x60, 0x09, 0x64, 0x90, 0x84, 0xA0, 0x50, 0xF2, 0xF4, + 0x31, 0x60, 0x18, 0x7C, 0x63, 0x40, 0x01, 0x26, 0x08, 0x00, 0xA4, 0xD3, 0xFF, 0xFF, 0x01, 0xB4, + 0xFF, 0xFF, 0x03, 0x02, 0xAD, 0x4F, 0xFE, 0xB4, 0xA0, 0x5D, 0x02, 0xEE, 0xBD, 0xFE, 0xBE, 0x01, + 0x21, 0x46, 0x5E, 0x62, 0x9A, 0xFF, 0x07, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x06, 0x25, 0x10, 0x00, + 0xA2, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0x62, 0x62, 0x01, 0x5D, 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, + 0x7A, 0xDC, 0x44, 0xFF, 0x06, 0x25, 0x04, 0x00, 0x0E, 0xE1, 0x02, 0x60, 0x01, 0xE1, 0x9E, 0x01, + 0x62, 0xFF, 0xC4, 0xE2, 0x41, 0xFF, 0x0A, 0xE1, 0x99, 0x01, 0xC8, 0x74, 0xCD, 0xE2, 0x29, 0x44, + 0x08, 0xBC, 0x40, 0x49, 0x05, 0xE1, 0x31, 0x60, 0x1A, 0x63, 0xA3, 0xD3, 0xF2, 0xF3, 0x06, 0x18, + 0x28, 0x40, 0x08, 0x2A, 0x05, 0x00, 0x28, 0x40, 0x48, 0x36, 0x02, 0x00, 0x02, 0xBC, 0xF2, 0xFB, + 0x3F, 0x40, 0x01, 0x2B, 0xFF, 0xFF, 0xA1, 0xFF, 0x67, 0x4C, 0x06, 0x61, 0xCD, 0x81, 0x04, 0x25, + 0x30, 0x00, 0x87, 0x4C, 0xFB, 0x02, 0x28, 0x40, 0x40, 0x2B, 0x02, 0x00, 0x15, 0x60, 0x6F, 0x6B, + 0xF3, 0x60, 0xA0, 0x64, 0x04, 0x25, 0x25, 0x00, 0x80, 0x4C, 0x30, 0x64, 0x3A, 0xDB, 0x44, 0xFF, + 0x04, 0x25, 0x1F, 0x00, 0x04, 0x60, 0x00, 0x65, 0x25, 0x44, 0x37, 0x36, 0xB4, 0x84, 0x6E, 0x36, + 0xB4, 0x84, 0x80, 0x4E, 0x24, 0x41, 0x04, 0x25, 0x14, 0x00, 0x61, 0x4C, 0x64, 0xA1, 0x61, 0x54, + 0xA1, 0xFF, 0xFF, 0xFF, 0x04, 0x25, 0x0D, 0x00, 0x67, 0x4E, 0x07, 0x64, 0x1C, 0xFB, 0x00, 0xE1, + 0x02, 0x60, 0x01, 0xE1, 0x53, 0x01, 0x33, 0xF3, 0xFD, 0x11, 0xFC, 0x18, 0x40, 0x64, 0x3A, 0xDB, + 0x0A, 0x00, 0xC4, 0xE2, 0x27, 0x44, 0x20, 0x2A, 0x04, 0x00, 0x42, 0x64, 0x3A, 0xDB, 0x67, 0x4C, + 0x02, 0x00, 0x41, 0x64, 0x3A, 0xDB, 0x62, 0xFF, 0x08, 0xE1, 0xE2, 0xFE, 0x72, 0x52, 0x5C, 0x49, + 0x32, 0x7B, 0x4D, 0xE2, 0x3B, 0x01, 0x08, 0xE1, 0x39, 0x01, 0xA1, 0xFF, 0x98, 0xFF, 0x80, 0x3E, + 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, 0x02, 0x02, 0xA1, 0xFF, 0xFF, 0xFF, 0x82, 0xFF, 0x88, 0xFF, + 0x48, 0xE2, 0x01, 0x70, 0xCE, 0xF1, 0x00, 0x6B, 0x89, 0xFF, 0x64, 0x54, 0x88, 0xFF, 0x9F, 0xFE, + 0x02, 0x05, 0x64, 0x44, 0x60, 0x54, 0xCD, 0xE2, 0xC2, 0x64, 0x3A, 0xDB, 0xBC, 0xFF, 0xB5, 0xFF, + 0x1D, 0xFF, 0x26, 0x44, 0x02, 0xB4, 0x40, 0x46, 0x3C, 0x44, 0x00, 0xBC, 0xFF, 0xFF, 0x06, 0x03, + 0x27, 0x40, 0x26, 0x22, 0x03, 0x00, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x27, 0x44, 0x20, 0x2A, + 0x04, 0x00, 0xA0, 0x60, 0x00, 0xEA, 0xB0, 0x60, 0x00, 0xEA, 0x5C, 0x4D, 0x27, 0x44, 0x18, 0xB4, + 0x40, 0x47, 0x00, 0xE1, 0x6C, 0x40, 0x44, 0xE2, 0xC4, 0xE2, 0x47, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, + 0x32, 0xF1, 0x08, 0x29, 0x09, 0x00, 0x64, 0x40, 0x07, 0x22, 0x06, 0x00, 0x43, 0xFF, 0x27, 0x44, + 0x10, 0xBC, 0x40, 0x47, 0x00, 0x64, 0x32, 0xFB, 0x31, 0x41, 0x3C, 0x44, 0x01, 0xB1, 0x00, 0xBC, + 0x0A, 0x02, 0x09, 0x03, 0x32, 0xF3, 0x00, 0x7C, 0x01, 0xB4, 0xFF, 0xFF, 0x04, 0x03, 0x32, 0xF9, + 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x48, 0x60, 0x2D, 0x7D, 0x08, 0x60, 0x00, 0x6B, 0x00, 0x64, + 0x33, 0xFB, 0x0C, 0x60, 0x16, 0x64, 0xA0, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0x32, 0xF3, 0x08, 0x29, + 0x0A, 0x00, 0x60, 0x40, 0x07, 0x22, 0x07, 0x00, 0xFE, 0xB4, 0x32, 0xFB, 0x27, 0x44, 0x10, 0xBC, + 0xF7, 0xB4, 0x40, 0x47, 0x43, 0xFF, 0x00, 0x64, 0x3A, 0xDB, 0x01, 0x60, 0x08, 0xE1, 0x31, 0x40, + 0x01, 0x2A, 0x04, 0x00, 0x00, 0x64, 0x33, 0xFB, 0x01, 0x60, 0x0A, 0xE1, 0xE5, 0xFE, 0x1D, 0x05, + 0x27, 0x44, 0x10, 0x26, 0x1D, 0x00, 0x9F, 0xFE, 0x02, 0x04, 0x02, 0xE1, 0x10, 0x00, 0x3E, 0xE1, + 0x31, 0x44, 0x01, 0x2A, 0x0C, 0x00, 0x0E, 0x0A, 0x28, 0x44, 0x04, 0x27, 0x07, 0x00, 0xD4, 0x36, + 0x05, 0x00, 0xC4, 0x36, 0x03, 0x00, 0xAE, 0x4F, 0xF7, 0xB4, 0xA0, 0x5E, 0xBF, 0xE1, 0xA1, 0xFF, + 0xFF, 0xFF, 0x81, 0x3E, 0xAB, 0x60, 0x2C, 0x78, 0xFF, 0xFF, 0xA3, 0x60, 0xEC, 0x78, 0xFF, 0xFF, + 0x27, 0x44, 0x08, 0x26, 0xFF, 0xFF, 0xBA, 0x60, 0x70, 0x78, 0xFF, 0xFF, 0x48, 0xF3, 0x32, 0xF1, + 0x00, 0x63, 0x64, 0x40, 0x03, 0x22, 0x66, 0x00, 0x31, 0x40, 0x08, 0x26, 0xF4, 0x01, 0xCD, 0xE2, + 0x84, 0xE1, 0x70, 0x41, 0xAD, 0x80, 0x71, 0x40, 0x80, 0x27, 0xED, 0x12, 0x03, 0x03, 0xBA, 0x60, + 0xE7, 0x78, 0xFF, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0xC4, 0xE2, 0x32, 0xFD, 0x60, 0x40, 0x01, 0x2A, + 0xDF, 0x01, 0x00, 0x63, 0x32, 0xFD, 0x6C, 0x40, 0x3C, 0x46, 0x3E, 0xF2, 0x2A, 0xF0, 0x27, 0x41, + 0x44, 0x48, 0x20, 0xB9, 0x01, 0xB4, 0xF7, 0xB1, 0x0A, 0x03, 0x64, 0x40, 0x08, 0x27, 0x07, 0x00, + 0x0F, 0x60, 0x92, 0x63, 0x00, 0x64, 0x45, 0xFB, 0x46, 0xFB, 0xBD, 0xDB, 0xA3, 0xDB, 0xCB, 0x0A, + 0x31, 0x60, 0x0E, 0x7C, 0xA4, 0xD3, 0xFF, 0xFF, 0x17, 0x18, 0x28, 0x40, 0xD4, 0x36, 0x14, 0x00, + 0xAC, 0x4C, 0x80, 0x2A, 0x11, 0x00, 0x31, 0x60, 0x14, 0x7C, 0xA4, 0xD3, 0xFF, 0xFF, 0x0C, 0x18, + 0x31, 0x60, 0x16, 0x7C, 0xA4, 0xD3, 0x31, 0x60, 0x10, 0x7C, 0xA4, 0xD3, 0x60, 0x45, 0xD4, 0x80, + 0xDC, 0x84, 0x02, 0x03, 0xA4, 0xDB, 0xAF, 0x01, 0x31, 0x60, 0x10, 0x7C, 0x00, 0x64, 0xA4, 0xDB, + 0x41, 0x47, 0x3F, 0x40, 0x01, 0x2B, 0x0D, 0x00, 0xF6, 0xFE, 0x67, 0x4C, 0x05, 0x60, 0x69, 0x6B, + 0x31, 0x60, 0x0E, 0x7C, 0xA4, 0xD3, 0xFF, 0xFF, 0x04, 0x18, 0xAE, 0x4F, 0x08, 0xBC, 0x00, 0x7F, + 0xA0, 0x5E, 0x02, 0xE1, 0x01, 0x60, 0x08, 0xE1, 0xF0, 0xFE, 0x84, 0xFF, 0xBB, 0x60, 0x18, 0x64, + 0x40, 0x42, 0x82, 0xFF, 0xE5, 0xFE, 0x03, 0x04, 0xA8, 0x60, 0x24, 0x78, 0xFF, 0xFF, 0xE4, 0xFE, + 0x0A, 0x04, 0x1D, 0xFF, 0x00, 0xEB, 0x60, 0x7F, 0xA0, 0x5A, 0x80, 0x60, 0x00, 0xEA, 0xA0, 0x60, + 0x00, 0xEA, 0xD1, 0x60, 0x00, 0xEA, 0x43, 0xFF, 0xE6, 0xFE, 0x03, 0x05, 0xA3, 0x60, 0x4B, 0x78, + 0xFF, 0xFF, 0x3C, 0x44, 0x60, 0x46, 0x0F, 0xF0, 0x40, 0x42, 0x64, 0x40, 0x01, 0x2A, 0x03, 0x00, + 0xA6, 0x60, 0xB1, 0x78, 0xFF, 0xFF, 0x0B, 0x64, 0x3A, 0xDB, 0x1C, 0x42, 0x22, 0x46, 0x13, 0xF2, + 0xFF, 0x65, 0x60, 0x47, 0x2A, 0xF2, 0x40, 0x45, 0x40, 0x48, 0x04, 0x2B, 0x17, 0x00, 0x16, 0xF2, + 0x1D, 0xF2, 0x40, 0x43, 0x0F, 0xF2, 0x40, 0x44, 0x25, 0x5E, 0x3F, 0x40, 0x01, 0x27, 0x40, 0x45, + 0x0F, 0x64, 0x14, 0xF0, 0x35, 0xF2, 0xA0, 0x82, 0x0F, 0xB4, 0xCA, 0x85, 0xD4, 0x80, 0x10, 0xF2, + 0x01, 0x02, 0x2B, 0xFA, 0x27, 0x44, 0x40, 0xBC, 0x40, 0x47, 0x13, 0x00, 0x17, 0xF2, 0x2C, 0xF0, + 0x40, 0x43, 0x1B, 0xF2, 0x1D, 0xFA, 0x40, 0x44, 0x64, 0x40, 0x01, 0x2A, 0x02, 0x00, 0xAB, 0xFC, + 0x05, 0x00, 0x28, 0x40, 0xA4, 0x36, 0x02, 0x00, 0x11, 0xF2, 0x2B, 0xFA, 0x27, 0x44, 0xBF, 0xB4, + 0x40, 0x47, 0x28, 0x40, 0x40, 0x2B, 0xFF, 0xFF, 0xAB, 0x60, 0x4A, 0x78, 0xFF, 0xFF, 0x22, 0x46, + 0x2C, 0xF0, 0x27, 0x44, 0xDF, 0xB4, 0x40, 0x47, 0xB5, 0xFF, 0xBC, 0xFF, 0x47, 0xFF, 0xB7, 0xFF, + 0xB4, 0xFF, 0x48, 0x60, 0x2D, 0x7D, 0x08, 0x60, 0x00, 0x6B, 0x64, 0x40, 0x01, 0x2A, 0x09, 0x00, + 0x28, 0x44, 0x04, 0x27, 0x05, 0x00, 0xD4, 0x3A, 0x03, 0x00, 0xAE, 0x4F, 0xF7, 0xB4, 0xA0, 0x5E, + 0x1B, 0x00, 0x2A, 0xF0, 0x01, 0x65, 0x64, 0x40, 0xA4, 0x3A, 0x04, 0x65, 0x27, 0x44, 0x34, 0x87, + 0x36, 0xF3, 0xB4, 0xFF, 0x60, 0x5B, 0x4D, 0xE2, 0x04, 0x64, 0x3A, 0xDB, 0x01, 0x60, 0x0A, 0xE1, + 0x28, 0x44, 0x04, 0x27, 0x05, 0x00, 0xD4, 0x3A, 0x03, 0x00, 0xAE, 0x4F, 0xF7, 0xB4, 0xA0, 0x5E, + 0x2B, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, 0x06, 0x64, 0x3A, 0xDB, 0x22, 0x46, 0x01, 0x64, + 0x31, 0xFB, 0xC0, 0xFE, 0xBA, 0x60, 0xF0, 0x78, 0xFF, 0xFF, 0xB5, 0xFF, 0xA1, 0xFF, 0x6C, 0x40, + 0x3F, 0x40, 0x01, 0x2B, 0x03, 0x00, 0x67, 0x4C, 0x05, 0x60, 0x69, 0x6B, 0x02, 0xE1, 0x01, 0x60, + 0x08, 0xE1, 0xC4, 0xE2, 0x08, 0x64, 0x3A, 0xDB, 0xF0, 0xFE, 0x25, 0x46, 0x01, 0xF2, 0x61, 0x45, + 0xD4, 0x9E, 0x21, 0x46, 0x16, 0xFA, 0x2A, 0x44, 0x72, 0x45, 0x24, 0xFA, 0xB5, 0xF3, 0x06, 0x04, + 0xE4, 0xE2, 0xDC, 0x9C, 0x29, 0x40, 0x01, 0x26, 0x64, 0x44, 0xB5, 0xF9, 0x25, 0xFA, 0xB6, 0xF3, + 0x02, 0x04, 0xDC, 0x84, 0xB6, 0xFB, 0x28, 0xFA, 0xB7, 0xF3, 0x02, 0x04, 0xDC, 0x84, 0xB7, 0xFB, + 0x29, 0xFA, 0x2D, 0x44, 0x04, 0x2A, 0x06, 0x00, 0x28, 0x40, 0xA4, 0x36, 0x03, 0x00, 0xA5, 0x60, + 0x77, 0x78, 0xFF, 0xFF, 0x26, 0x43, 0x84, 0xBB, 0xFC, 0xB3, 0x21, 0x46, 0x01, 0x5D, 0x0F, 0xFC, + 0x5C, 0x46, 0x25, 0x44, 0x06, 0xFA, 0x05, 0xFF, 0x27, 0x44, 0x01, 0x2A, 0x13, 0x00, 0x50, 0xFE, + 0x28, 0x40, 0x08, 0x3A, 0x12, 0x00, 0x2F, 0xF2, 0x30, 0xF0, 0x60, 0x43, 0x31, 0xF2, 0x22, 0x46, + 0x64, 0x41, 0x2C, 0xF0, 0x2D, 0xF0, 0xD3, 0x80, 0x2E, 0xF0, 0xD1, 0x80, 0xD0, 0x80, 0x27, 0x44, + 0x09, 0x0C, 0x03, 0x00, 0x27, 0x44, 0x06, 0x22, 0x05, 0x00, 0xB8, 0xB4, 0x40, 0x47, 0x02, 0x64, + 0x31, 0xFB, 0xC0, 0xFE, 0xD4, 0x64, 0x40, 0x48, 0x0D, 0x64, 0x3A, 0xDB, 0x31, 0x60, 0x12, 0x7C, + 0x7C, 0x44, 0xA4, 0xDB, 0x21, 0x46, 0x1C, 0xF2, 0x7C, 0xF1, 0xFF, 0xB4, 0xD0, 0x80, 0xFF, 0xFF, + 0x01, 0x06, 0x64, 0x44, 0x40, 0x45, 0x0A, 0x36, 0x70, 0x64, 0x14, 0x36, 0x38, 0x64, 0x37, 0x3A, + 0x03, 0x00, 0x04, 0x7F, 0x40, 0x45, 0x15, 0x64, 0x6E, 0x3A, 0x03, 0x00, 0x84, 0x7F, 0x40, 0x45, + 0x0B, 0x64, 0x40, 0x44, 0x00, 0x63, 0x28, 0x44, 0xA4, 0x36, 0x0B, 0x00, 0x04, 0x2B, 0x09, 0x00, + 0x30, 0xF3, 0x24, 0x45, 0xD4, 0x84, 0xCA, 0x65, 0xD4, 0x83, 0x31, 0x60, 0x12, 0x7C, 0x01, 0x64, + 0xA4, 0xDB, 0xD4, 0x64, 0x1A, 0x00, 0x0F, 0x64, 0x3A, 0xDB, 0x21, 0x46, 0x70, 0x63, 0x1C, 0xF2, + 0xCA, 0x65, 0x40, 0x45, 0x0A, 0x36, 0x70, 0x64, 0x14, 0x36, 0x38, 0x64, 0x37, 0x3A, 0x03, 0x00, + 0x04, 0x7F, 0x40, 0x45, 0x15, 0x64, 0x6E, 0x3A, 0x03, 0x00, 0x84, 0x7F, 0x40, 0x45, 0x0B, 0x64, + 0x40, 0x44, 0x2B, 0xF2, 0xC4, 0x85, 0xD4, 0x83, 0xC4, 0x64, 0x40, 0x48, 0x2F, 0xF0, 0xB0, 0xF0, + 0xB1, 0xF2, 0x00, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x80, 0x4E, 0x83, 0x4C, 0x9A, 0xFF, 0x84, 0x4C, + 0x85, 0x4C, 0x81, 0x4C, 0xA1, 0xFF, 0x98, 0xFF, 0x87, 0x4F, 0x87, 0x4C, 0x87, 0x4F, 0x87, 0x4D, + 0x87, 0x4C, 0x01, 0x08, 0x01, 0x00, 0xFF, 0xFF, 0x87, 0x4C, 0x87, 0x4C, 0x87, 0x4C, 0x87, 0x4C, + 0xFF, 0xFF, 0xFF, 0xFF, 0x6A, 0x44, 0xBC, 0xFF, 0xC4, 0xE2, 0x0C, 0x74, 0x04, 0xE1, 0xA1, 0xFF, + 0x35, 0xF3, 0xC4, 0xE2, 0x60, 0x54, 0x89, 0xFF, 0x13, 0x74, 0x88, 0xFF, 0xB5, 0xFF, 0x47, 0xFF, + 0x29, 0x44, 0xF7, 0xB4, 0x40, 0x49, 0xB7, 0xFF, 0xB4, 0xFF, 0x48, 0x60, 0x2D, 0x7D, 0x08, 0x60, + 0x00, 0x6B, 0x28, 0x40, 0xC4, 0x36, 0x08, 0x00, 0x31, 0x60, 0x12, 0x7C, 0xA4, 0xD3, 0xFF, 0xFF, + 0x03, 0x1B, 0xAE, 0x4F, 0xF7, 0xB4, 0xA0, 0x5E, 0x27, 0x44, 0x01, 0x2A, 0x05, 0x00, 0xFE, 0xB4, + 0x40, 0x47, 0xA4, 0x60, 0x7C, 0x78, 0xFF, 0xFF, 0xA3, 0x60, 0x3E, 0x78, 0xFF, 0xFF, 0x28, 0x40, + 0xB4, 0x3A, 0x09, 0x00, 0x27, 0x44, 0x07, 0x22, 0x05, 0x00, 0xF8, 0xB4, 0x40, 0x47, 0x02, 0x64, + 0x31, 0xFB, 0xC0, 0xFE, 0x90, 0x01, 0x28, 0x44, 0xD4, 0x36, 0x03, 0x00, 0xA6, 0x60, 0x98, 0x78, + 0xFF, 0xFF, 0x48, 0xE2, 0x27, 0x44, 0xFB, 0xB4, 0x40, 0x47, 0x2D, 0x60, 0x5A, 0x63, 0xA3, 0xD3, + 0xB0, 0x60, 0x58, 0x4D, 0xD8, 0x78, 0xFF, 0xFF, 0x34, 0xFB, 0x1C, 0x42, 0x22, 0x46, 0x2A, 0xF0, + 0xF7, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDA, 0x60, 0x40, 0x40, 0x2B, 0xCC, 0x00, 0x22, 0xF2, + 0xFF, 0xFF, 0x60, 0x40, 0x22, 0x26, 0x42, 0x00, 0x01, 0x26, 0x03, 0x00, 0x04, 0x26, 0x07, 0x00, + 0xC2, 0x00, 0x04, 0x2B, 0xC0, 0x00, 0xA9, 0xF3, 0xFF, 0xFF, 0x60, 0x46, 0x01, 0x00, 0x07, 0xF4, + 0x47, 0xF2, 0xFF, 0xFF, 0xDC, 0x84, 0x47, 0xFA, 0x0D, 0x60, 0x3E, 0x62, 0x80, 0xFF, 0xBE, 0x60, + 0x78, 0x44, 0x02, 0xA4, 0xA2, 0xDB, 0xDE, 0x78, 0xFF, 0xFF, 0x82, 0xFF, 0xA9, 0xF3, 0x66, 0x5C, + 0xD0, 0x80, 0x00, 0x7C, 0x07, 0x03, 0x66, 0x43, 0x22, 0x46, 0x22, 0xF2, 0x63, 0x46, 0x60, 0x40, + 0x01, 0x2A, 0x01, 0x00, 0x3C, 0xF1, 0x47, 0xF0, 0x64, 0x41, 0x64, 0x47, 0xFF, 0xB4, 0x60, 0x5F, + 0x20, 0xBC, 0x80, 0x26, 0x80, 0xAC, 0x60, 0x47, 0x22, 0x46, 0x3A, 0xFA, 0x64, 0x44, 0x20, 0x7F, + 0x34, 0x94, 0x3B, 0xFA, 0x08, 0x60, 0x00, 0xEA, 0x0F, 0x64, 0x60, 0x7F, 0xA0, 0x5A, 0x80, 0x60, + 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, 0xD1, 0x60, 0x00, 0xEA, 0x85, 0x00, 0x2A, 0xF2, 0x00, 0x60, + 0x7C, 0x62, 0x60, 0x40, 0x40, 0x2B, 0x27, 0x00, 0xA2, 0xD3, 0x00, 0x61, 0x60, 0xFE, 0xA0, 0xD3, + 0xDE, 0x82, 0xA2, 0xD1, 0xFF, 0xFF, 0x20, 0xFE, 0x64, 0x5F, 0xDC, 0x84, 0xF1, 0x81, 0xC0, 0x2B, + 0x04, 0x00, 0x80, 0x2A, 0x02, 0x00, 0x7F, 0xA4, 0xDC, 0x84, 0xFF, 0x3B, 0x03, 0x00, 0x60, 0x47, + 0xDC, 0x87, 0x01, 0x61, 0xC0, 0x80, 0x00, 0x36, 0xDC, 0x84, 0x4E, 0xDB, 0x60, 0xFE, 0xDA, 0x82, + 0xA2, 0xD1, 0xFF, 0xFF, 0xC1, 0x84, 0xF0, 0x22, 0x10, 0xA4, 0xF0, 0x2A, 0x01, 0x00, 0x00, 0x64, + 0xA2, 0xDB, 0xFF, 0xFF, 0x20, 0xFE, 0x00, 0x60, 0x7C, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xA0, 0xD3, + 0x5A, 0xD1, 0x3A, 0xFA, 0x3B, 0xF8, 0x74, 0x62, 0xA2, 0xD0, 0xFF, 0xFF, 0x64, 0x44, 0xE0, 0x7F, + 0xA0, 0x5A, 0x64, 0x47, 0xE1, 0x7F, 0x5A, 0xD0, 0xA0, 0x5A, 0x64, 0x44, 0xE2, 0x7F, 0xA0, 0x5A, + 0x00, 0x60, 0x80, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xA0, 0xD1, 0x5A, 0xD1, 0x64, 0x45, 0x64, 0x44, + 0xE3, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xE4, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xE5, 0x7F, + 0xA0, 0x5A, 0x64, 0x47, 0xE6, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xE7, 0x7F, 0xA0, 0x5A, + 0x65, 0x40, 0x0D, 0x3A, 0x1C, 0x00, 0x64, 0x47, 0xE8, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, + 0xE9, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xEA, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xEB, 0x7F, + 0xA0, 0x5A, 0x64, 0x47, 0xEC, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xED, 0x7F, 0xA0, 0x5A, + 0x64, 0x47, 0xEE, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xEF, 0x7F, 0xA0, 0x5A, 0x08, 0x60, + 0x00, 0xEA, 0x65, 0x44, 0x02, 0xA4, 0x60, 0x7F, 0xA0, 0x5A, 0x80, 0x60, 0x00, 0xEA, 0xA0, 0x60, + 0x00, 0xEA, 0xD1, 0x60, 0x00, 0xEA, 0x0B, 0xF2, 0xFF, 0xFF, 0x7F, 0xB4, 0x0C, 0xF0, 0x04, 0x02, + 0x64, 0x46, 0x00, 0xF0, 0x04, 0x64, 0x22, 0x46, 0x03, 0xFA, 0x60, 0x41, 0x64, 0x46, 0x01, 0xF2, + 0xFC, 0xA1, 0x61, 0x45, 0xD4, 0x84, 0xFF, 0xFF, 0x08, 0x02, 0x00, 0xF0, 0x04, 0x63, 0x64, 0x46, + 0x01, 0xF2, 0x22, 0x46, 0x1A, 0xFA, 0x03, 0xFC, 0x02, 0x00, 0x22, 0x46, 0x1A, 0xFA, 0x35, 0xF2, + 0x04, 0xF8, 0xDC, 0x84, 0x35, 0xFA, 0x14, 0xF2, 0x0F, 0xB5, 0x0F, 0xB4, 0xCC, 0x84, 0x94, 0x80, + 0x04, 0x60, 0x00, 0x65, 0x2A, 0xF2, 0x01, 0x02, 0x94, 0x84, 0x2A, 0xFA, 0x95, 0xFC, 0x06, 0x00, + 0xC4, 0x3A, 0x07, 0x00, 0x27, 0x44, 0xFD, 0xB4, 0x40, 0x47, 0x48, 0xE2, 0xA4, 0x60, 0x0B, 0x78, + 0xFF, 0xFF, 0x28, 0x44, 0x04, 0x26, 0x05, 0x00, 0x68, 0x3A, 0x03, 0x00, 0x32, 0x44, 0x00, 0x27, + 0x03, 0x00, 0xA3, 0x60, 0x4B, 0x78, 0xFF, 0xFF, 0x0A, 0x64, 0x3A, 0xDB, 0xA3, 0x60, 0x4B, 0x78, + 0xFF, 0xFF, 0x0E, 0x64, 0x3A, 0xDB, 0x10, 0x60, 0x00, 0x65, 0x3C, 0x46, 0x2A, 0xF2, 0x13, 0xF0, + 0xA4, 0x84, 0xB4, 0xBC, 0x40, 0x48, 0x7C, 0xF1, 0x64, 0x47, 0xFF, 0xB4, 0x60, 0x45, 0xD0, 0x80, + 0x70, 0x61, 0x01, 0x06, 0x64, 0x44, 0x0A, 0x36, 0x70, 0x64, 0x14, 0x36, 0x38, 0x64, 0x37, 0x36, + 0x15, 0x64, 0x6E, 0x36, 0x0B, 0x64, 0x40, 0x4E, 0xA0, 0x63, 0x0A, 0x64, 0x65, 0x40, 0x0A, 0x36, + 0x03, 0x00, 0x38, 0x61, 0x14, 0x64, 0xEB, 0x83, 0x40, 0x45, 0x43, 0x44, 0x02, 0x60, 0x5E, 0x65, + 0x2A, 0xF2, 0x2B, 0xF2, 0x60, 0x40, 0x04, 0x2B, 0x04, 0x00, 0x2E, 0x45, 0xD4, 0x85, 0xC5, 0x84, + 0x05, 0x00, 0x1B, 0xF0, 0xC5, 0x84, 0xC0, 0x84, 0x2E, 0x45, 0xC4, 0x84, 0x60, 0x43, 0x28, 0x44, + 0x00, 0xE1, 0xA1, 0xFF, 0x80, 0x4E, 0x83, 0x4C, 0x9A, 0xFF, 0x56, 0x62, 0x7A, 0xD4, 0x7A, 0xD4, + 0x7A, 0xD4, 0x5C, 0x62, 0x7A, 0xD4, 0x7A, 0xD4, 0x7A, 0xD4, 0xA1, 0xFF, 0x98, 0xFF, 0x87, 0x4F, + 0x87, 0x4C, 0x87, 0x4F, 0x87, 0x4D, 0x87, 0x4C, 0x01, 0x08, 0x01, 0x00, 0xFF, 0xFF, 0x87, 0x4C, + 0x87, 0x4C, 0x87, 0x4C, 0x87, 0x4C, 0xFF, 0xFF, 0xFF, 0xFF, 0x6A, 0x44, 0xBC, 0xFF, 0xB5, 0xFF, + 0x47, 0xFF, 0x27, 0x44, 0x02, 0xBC, 0x40, 0x47, 0x36, 0xF3, 0xB7, 0xFF, 0xB4, 0xFF, 0x48, 0x60, + 0x2D, 0x7D, 0x08, 0x60, 0x00, 0x6B, 0x60, 0x5B, 0x4D, 0xE2, 0xA4, 0x60, 0x6C, 0x78, 0xFF, 0xFF, + 0x21, 0x46, 0xB5, 0xFF, 0xBC, 0xFF, 0x47, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0x48, 0x60, 0x2D, 0x7D, + 0x08, 0x60, 0x00, 0x6B, 0x28, 0x44, 0x04, 0x27, 0x09, 0x00, 0xD4, 0x36, 0x04, 0x00, 0x0C, 0x22, + 0x02, 0x00, 0x0C, 0x3A, 0x03, 0x00, 0xAE, 0x4F, 0xF7, 0xB4, 0xA0, 0x5E, 0x26, 0x43, 0x25, 0x44, + 0x06, 0xFA, 0x2A, 0x44, 0x72, 0x45, 0x24, 0xFA, 0xB5, 0xF3, 0x06, 0x04, 0xE4, 0xE2, 0xDC, 0x9C, + 0x29, 0x40, 0x01, 0x26, 0x64, 0x44, 0xB5, 0xF9, 0x25, 0xFA, 0xB6, 0xF3, 0x02, 0x04, 0xDC, 0x84, + 0xB6, 0xFB, 0x28, 0xFA, 0xB7, 0xF3, 0x02, 0x04, 0xDC, 0x84, 0xB7, 0xFB, 0x29, 0xFA, 0x2D, 0x40, + 0x01, 0x2A, 0x0E, 0x00, 0x1D, 0xFF, 0x26, 0x44, 0x02, 0xBC, 0x40, 0x46, 0x27, 0x44, 0x07, 0x22, + 0x05, 0x00, 0xF8, 0xB4, 0x40, 0x47, 0x06, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x30, 0xF1, 0x76, 0x00, + 0xFC, 0xB3, 0x32, 0x40, 0x01, 0x2A, 0x06, 0x00, 0x0A, 0xBB, 0x0F, 0xFC, 0xCB, 0xFE, 0xA3, 0x60, + 0x4B, 0x78, 0xFF, 0xFF, 0x2D, 0x44, 0x04, 0x26, 0x28, 0x00, 0x0F, 0xFC, 0x05, 0xFF, 0xDC, 0xF3, + 0x28, 0x40, 0x80, 0x3A, 0x22, 0x00, 0x60, 0x40, 0x03, 0x3A, 0x1F, 0x00, 0x32, 0xF2, 0x81, 0xF1, + 0x33, 0xF2, 0xD0, 0x80, 0x82, 0xF1, 0x19, 0x02, 0xD0, 0x80, 0x34, 0xF2, 0x83, 0xF1, 0x15, 0x02, + 0xD0, 0x80, 0x3C, 0x44, 0x12, 0x02, 0xAC, 0x86, 0xBB, 0xFE, 0x0F, 0x03, 0x2A, 0xF2, 0x21, 0x46, + 0x60, 0x40, 0x80, 0x3A, 0x0A, 0x00, 0x01, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x00, 0x64, 0x32, 0xFB, + 0x84, 0xFF, 0xBB, 0x60, 0x18, 0x64, 0x40, 0x42, 0x82, 0xFF, 0x30, 0xF1, 0x27, 0x44, 0x05, 0x22, + 0x2D, 0x00, 0xFA, 0xB4, 0x40, 0x47, 0x2D, 0x44, 0x10, 0x2A, 0x24, 0x00, 0x28, 0x40, 0xD4, 0x3A, + 0x21, 0x00, 0x31, 0x40, 0x08, 0x26, 0x00, 0x7C, 0x2B, 0x44, 0xD0, 0x80, 0x70, 0x45, 0x02, 0x28, + 0x64, 0x44, 0xC4, 0x84, 0xFF, 0xFF, 0x04, 0x24, 0x00, 0xB4, 0x60, 0x50, 0x08, 0x28, 0x01, 0x00, + 0x20, 0x29, 0x6D, 0xE2, 0x1C, 0x60, 0x9A, 0x63, 0x1D, 0xF0, 0xC0, 0x64, 0xC0, 0x84, 0xA3, 0xD1, + 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xC0, 0x84, 0xA3, 0xDB, 0xA4, 0x60, + 0x7C, 0x78, 0xFF, 0xFF, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x07, 0x00, 0x02, 0x2A, 0x05, 0x00, + 0xFD, 0xB4, 0x40, 0x47, 0x06, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x05, 0x64, 0x3A, 0xDB, 0x28, 0x44, + 0xA4, 0x3A, 0x04, 0x00, 0x39, 0xF1, 0x25, 0x44, 0x0A, 0x36, 0x38, 0xF1, 0x31, 0x40, 0x08, 0x26, + 0x00, 0x7C, 0x2B, 0x44, 0xD0, 0x80, 0x70, 0x45, 0x02, 0x28, 0x64, 0x44, 0xC4, 0x84, 0xFF, 0xFF, + 0x04, 0x24, 0x00, 0xB4, 0x28, 0x40, 0xE4, 0x36, 0x00, 0xB4, 0x60, 0x50, 0x08, 0x28, 0x01, 0x00, + 0x20, 0x29, 0x6D, 0xE2, 0xA3, 0x60, 0x3E, 0x78, 0xFF, 0xFF, 0x21, 0x46, 0xB5, 0xFF, 0xBC, 0xFF, + 0x47, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0x48, 0x60, 0x2D, 0x7D, 0x08, 0x60, 0x00, 0x6B, 0xAE, 0x4F, + 0xF7, 0xB4, 0xA0, 0x5E, 0x27, 0x44, 0x07, 0x22, 0x05, 0x00, 0xF8, 0xB4, 0x40, 0x47, 0x06, 0x64, + 0x31, 0xFB, 0xC0, 0xFE, 0xE7, 0x01, 0x27, 0x44, 0x05, 0x22, 0x09, 0x00, 0xBA, 0xB4, 0x40, 0x47, + 0x3C, 0x46, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0xA3, 0x60, 0x4B, 0x78, 0xFF, 0xFF, 0x27, 0x44, + 0x02, 0x2A, 0x06, 0x00, 0xFD, 0xB4, 0x40, 0x47, 0x06, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0xF4, 0x01, + 0xF3, 0x0A, 0x7C, 0x50, 0x6D, 0xE2, 0xF0, 0x01, 0x72, 0x45, 0xDC, 0x84, 0xB5, 0xFB, 0x11, 0x64, + 0x3A, 0xDB, 0xB6, 0xF3, 0x06, 0x04, 0xDC, 0x84, 0xB6, 0xFB, 0xB7, 0xF3, 0x02, 0x04, 0xDC, 0x84, + 0xB7, 0xFB, 0xA3, 0x60, 0x56, 0x78, 0xFF, 0xFF, 0x00, 0x61, 0x12, 0x64, 0x3A, 0xDB, 0x1E, 0x60, + 0xFE, 0x63, 0xBD, 0xD3, 0x72, 0x45, 0x44, 0x8A, 0x02, 0x28, 0x02, 0x00, 0xE4, 0xE2, 0xDD, 0x81, + 0x02, 0x28, 0x02, 0x00, 0xE4, 0xE2, 0xDD, 0x81, 0xBD, 0xD3, 0xB5, 0xF1, 0x61, 0x45, 0xC0, 0x84, + 0x00, 0x61, 0x02, 0x24, 0x01, 0xB9, 0xC4, 0x84, 0x60, 0x55, 0x2A, 0x52, 0xB5, 0xFB, 0x02, 0x24, + 0x01, 0xB9, 0xBD, 0xD3, 0xB6, 0xF1, 0x61, 0x45, 0xC0, 0x84, 0x00, 0x61, 0x02, 0x24, 0x01, 0xB9, + 0xC4, 0x84, 0xB6, 0xFB, 0x02, 0x24, 0x01, 0xB9, 0xBD, 0xD3, 0xB7, 0xF1, 0x61, 0x45, 0xC0, 0x84, + 0xC4, 0x84, 0xB7, 0xFB, 0xA3, 0x60, 0xEF, 0x78, 0xFF, 0xFF, 0x31, 0x40, 0x04, 0x0A, 0xAE, 0x4F, + 0xF7, 0xB4, 0xA0, 0x5E, 0x09, 0x00, 0x31, 0x60, 0x0E, 0x7C, 0xA4, 0xD3, 0xFF, 0xFF, 0x04, 0x18, + 0xAE, 0x4F, 0x08, 0xBC, 0x00, 0x7F, 0xA0, 0x5E, 0x9F, 0x01, 0xA1, 0xFF, 0xFF, 0xFF, 0x01, 0x25, + 0x09, 0x00, 0x04, 0x25, 0x03, 0x00, 0x47, 0xFF, 0x32, 0x74, 0x96, 0x01, 0xC4, 0xE2, 0xAB, 0x60, + 0x2C, 0x78, 0xFF, 0xFF, 0x4C, 0x4E, 0x47, 0xFF, 0x31, 0x60, 0x0E, 0x7C, 0xA4, 0xD3, 0xFF, 0xFF, + 0x04, 0x18, 0xAE, 0x4F, 0x08, 0xBC, 0x00, 0x7F, 0xA0, 0x5E, 0x32, 0x74, 0xCD, 0xE2, 0xA8, 0x60, + 0x8A, 0x78, 0x00, 0x61, 0x10, 0x64, 0x3A, 0xDB, 0xA3, 0x60, 0x4B, 0x78, 0xFF, 0xFF, 0xA3, 0x60, + 0x4B, 0x78, 0xFF, 0xFF, 0x5C, 0x4D, 0x26, 0x44, 0x02, 0x26, 0x0C, 0x00, 0x3E, 0x46, 0x09, 0xF2, + 0x1E, 0x41, 0x03, 0x1B, 0xAA, 0x60, 0xDB, 0x78, 0xFF, 0xFF, 0x40, 0x5E, 0xFD, 0xFB, 0x21, 0x44, + 0x02, 0x64, 0x40, 0x46, 0x41, 0x5D, 0x21, 0x46, 0x00, 0xF2, 0x46, 0x45, 0x87, 0xFC, 0x4C, 0xE2, + 0x01, 0x64, 0x33, 0xFB, 0x01, 0x60, 0x0E, 0xE1, 0x03, 0xE1, 0x3F, 0x40, 0x01, 0x27, 0x00, 0x00, + 0x21, 0x69, 0xB6, 0xFF, 0xA1, 0xFF, 0x6C, 0x5E, 0xB6, 0xFF, 0xB7, 0xFF, 0x60, 0x5C, 0x20, 0x64, + 0x3A, 0xDB, 0x68, 0x43, 0x26, 0xFC, 0x22, 0x69, 0x64, 0x44, 0xA1, 0xFF, 0xFF, 0xFF, 0x6C, 0x5F, + 0x60, 0x43, 0x26, 0xF2, 0xFF, 0xFF, 0x68, 0x5F, 0x26, 0xFA, 0x3A, 0x69, 0x1D, 0xFC, 0x2E, 0x44, + 0x36, 0xF1, 0x1C, 0xFA, 0xC3, 0x94, 0xCD, 0xE2, 0x2E, 0x44, 0x14, 0x36, 0x12, 0x00, 0x0A, 0x36, + 0x0F, 0x00, 0x63, 0x45, 0xE3, 0x83, 0xE3, 0x83, 0xC7, 0x83, 0xE3, 0x83, 0xC7, 0x83, 0xFF, 0xFF, + 0x37, 0x36, 0x05, 0x00, 0x6E, 0x36, 0x04, 0x00, 0xAA, 0x60, 0xF3, 0x78, 0xFF, 0xFF, 0xEB, 0x83, + 0xEB, 0x83, 0xEB, 0x83, 0xEB, 0x83, 0xFF, 0xFF, 0x80, 0x27, 0xCF, 0x83, 0x1B, 0xFC, 0x01, 0x64, + 0x51, 0xFB, 0xA1, 0xFF, 0x1C, 0xF2, 0x29, 0x41, 0xF9, 0x81, 0x52, 0x4A, 0x71, 0x89, 0x68, 0x5F, + 0x27, 0xFA, 0x6C, 0x40, 0x03, 0x15, 0xAB, 0x60, 0x04, 0x78, 0xFF, 0xFF, 0x88, 0x60, 0x85, 0x71, + 0x8D, 0xE2, 0xB9, 0xF1, 0xFC, 0xA3, 0xD3, 0x80, 0x43, 0x43, 0x03, 0x04, 0xAA, 0x60, 0xFB, 0x78, + 0xFF, 0xFF, 0x32, 0x40, 0x01, 0x2A, 0x4C, 0x00, 0x9A, 0xFF, 0x23, 0x43, 0x18, 0x61, 0xA1, 0xFF, + 0x8C, 0x44, 0xCB, 0x83, 0x2A, 0xFA, 0x40, 0x48, 0x40, 0x27, 0x04, 0xA1, 0x60, 0x40, 0x03, 0x2B, + 0x01, 0x00, 0x06, 0xA1, 0x88, 0xB0, 0x88, 0x36, 0xD9, 0x81, 0x62, 0x45, 0x23, 0x44, 0x54, 0x94, + 0x28, 0x40, 0x04, 0x26, 0x00, 0x64, 0x3F, 0xFA, 0xC9, 0x81, 0x65, 0x42, 0x7A, 0xDC, 0x00, 0xB9, + 0xFD, 0x1C, 0x00, 0xF4, 0x6E, 0x61, 0x10, 0x62, 0x14, 0x02, 0x05, 0x1D, 0x12, 0x1E, 0x0C, 0x00, + 0x00, 0xF4, 0x7C, 0x61, 0x02, 0x62, 0x7A, 0xDC, 0x63, 0x40, 0xFD, 0x1C, 0xF9, 0x1D, 0xFF, 0xB1, + 0x08, 0x1E, 0x02, 0x02, 0x00, 0xF4, 0x02, 0x62, 0xB6, 0xFF, 0xB7, 0xFF, 0xA1, 0xFF, 0x6C, 0x44, + 0x5A, 0xDA, 0x98, 0xFF, 0x01, 0x60, 0x08, 0xE1, 0x81, 0xE1, 0xA1, 0xFF, 0x6C, 0x40, 0xA1, 0xFF, + 0x47, 0xFF, 0x26, 0x44, 0xFD, 0xB4, 0x84, 0xBC, 0x01, 0x15, 0x7F, 0xB4, 0x40, 0x46, 0xA1, 0xFF, + 0x6C, 0x40, 0x14, 0x63, 0x01, 0x11, 0x01, 0x00, 0xFD, 0x1F, 0xAA, 0x60, 0x6E, 0x78, 0xFF, 0xFF, + 0x9A, 0xFF, 0x54, 0x63, 0x12, 0x64, 0x40, 0x46, 0x00, 0x64, 0x0F, 0xFA, 0xA1, 0xFF, 0xEB, 0xF1, + 0x12, 0x61, 0x50, 0xFE, 0x2D, 0x60, 0x52, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, + 0x0B, 0x00, 0x8C, 0x45, 0x98, 0xF8, 0x00, 0x64, 0x3A, 0xFA, 0x3B, 0xFA, 0x3C, 0xFA, 0x3D, 0xFA, + 0xBF, 0x60, 0xFF, 0x64, 0xA4, 0x84, 0x01, 0x00, 0x8C, 0x44, 0xEC, 0xF0, 0xBD, 0xDA, 0x40, 0x48, + 0x04, 0x26, 0x40, 0x00, 0xA1, 0xFF, 0x8C, 0x44, 0xBD, 0xDA, 0x30, 0xFB, 0x6C, 0x44, 0xBD, 0xDA, + 0xFF, 0xFF, 0x01, 0x26, 0x24, 0x00, 0xD0, 0x80, 0xA1, 0xFF, 0x8C, 0x44, 0x6C, 0x5C, 0xF2, 0xFE, + 0xBD, 0xDA, 0xED, 0xF3, 0xD4, 0x80, 0xD0, 0x80, 0xBD, 0xD8, 0x2D, 0x44, 0x15, 0x0C, 0x32, 0x40, + 0x02, 0x2A, 0x07, 0x00, 0x28, 0x42, 0x0C, 0xB2, 0x08, 0x3A, 0x03, 0x00, 0x10, 0xBC, 0x40, 0x4D, + 0x4D, 0x00, 0x03, 0x0A, 0xAB, 0x60, 0x09, 0x78, 0xFF, 0xFF, 0x11, 0xBC, 0x40, 0x4D, 0x28, 0x45, + 0xBF, 0x60, 0xFF, 0x64, 0x24, 0x88, 0x42, 0x00, 0x30, 0xBC, 0x40, 0x4D, 0x3F, 0x00, 0x20, 0xB9, + 0x5C, 0x8E, 0xA1, 0xFF, 0x8C, 0x44, 0xBD, 0xDA, 0xDC, 0x9C, 0x6C, 0x44, 0xF2, 0xFE, 0xBD, 0xDA, + 0x08, 0x28, 0x44, 0x4E, 0xDC, 0x84, 0x2E, 0x5C, 0xB0, 0x84, 0xEF, 0xB1, 0x08, 0x24, 0x40, 0xB9, + 0x41, 0x46, 0x2C, 0x00, 0x8C, 0x44, 0x04, 0x61, 0xBD, 0xDA, 0x50, 0xFE, 0x80, 0x27, 0x00, 0x64, + 0x30, 0xFB, 0x8C, 0x44, 0xBD, 0xDA, 0xD0, 0x80, 0x8C, 0x44, 0xBD, 0xDA, 0xD4, 0x80, 0x00, 0x65, + 0x8C, 0x44, 0xED, 0xF1, 0xBD, 0xDA, 0xD0, 0x80, 0x28, 0x44, 0x03, 0x0C, 0xA0, 0x2A, 0x0A, 0x00, + 0x11, 0x00, 0x10, 0x65, 0x60, 0x40, 0xC4, 0x36, 0x04, 0x00, 0xD4, 0x3A, 0x08, 0x00, 0x27, 0x40, + 0x40, 0x26, 0x30, 0x65, 0x00, 0x64, 0x3F, 0xFA, 0x46, 0x4E, 0x35, 0x8D, 0x5F, 0x00, 0x40, 0x26, + 0xF9, 0x01, 0x30, 0x65, 0x9D, 0xDC, 0x9D, 0xDC, 0x9D, 0xDC, 0xF4, 0x01, 0x00, 0xE1, 0x23, 0x43, + 0xE8, 0xA3, 0x6A, 0x62, 0x9A, 0xFF, 0xA1, 0xFF, 0x28, 0x44, 0x03, 0x2B, 0x04, 0x00, 0x7A, 0xDC, + 0x7A, 0xDC, 0x7A, 0xDC, 0x28, 0x44, 0x88, 0xB0, 0x88, 0x2A, 0x03, 0x00, 0x70, 0x62, 0x7A, 0xDC, + 0x28, 0x44, 0x40, 0x2B, 0x13, 0x00, 0x72, 0x62, 0x7A, 0xDC, 0x04, 0xE6, 0x7A, 0xDC, 0x3B, 0xF2, + 0xFF, 0xFF, 0xFF, 0xFF, 0x20, 0x2B, 0x02, 0x00, 0x7A, 0xDC, 0x7A, 0xDC, 0x08, 0x60, 0x00, 0xEB, + 0xFC, 0xA3, 0x25, 0xFF, 0x3F, 0xFC, 0x04, 0xA3, 0xB0, 0xFF, 0x01, 0x00, 0x3F, 0xFC, 0xCF, 0x83, + 0xDF, 0x83, 0x04, 0x02, 0x00, 0xF4, 0x10, 0x62, 0x6C, 0x61, 0x1F, 0x00, 0x27, 0x03, 0xCB, 0x83, + 0xFF, 0x60, 0xFE, 0x65, 0x0E, 0xA3, 0xA7, 0x84, 0xF2, 0xA3, 0x00, 0xF4, 0x10, 0x62, 0x6C, 0x61, + 0x7A, 0xDC, 0xFE, 0x1C, 0x03, 0x1D, 0x7C, 0xA8, 0xD9, 0x81, 0x0A, 0x02, 0x00, 0xF4, 0x02, 0x62, + 0xA7, 0x84, 0x7A, 0x61, 0x7A, 0xDC, 0xFE, 0x1C, 0xF9, 0x1D, 0x7C, 0xA8, 0xD9, 0x81, 0xF6, 0x03, + 0xFF, 0xB1, 0x0C, 0x1E, 0x02, 0x02, 0x00, 0xF4, 0x02, 0x62, 0xA1, 0xFF, 0x01, 0x60, 0x0C, 0xE1, + 0xB6, 0xFF, 0xB7, 0xFF, 0xA1, 0xFF, 0xCD, 0x81, 0x6C, 0x44, 0x5A, 0xDA, 0x98, 0xFF, 0x00, 0xE6, + 0x7C, 0x44, 0x33, 0xFB, 0x01, 0x60, 0x0C, 0xE1, 0x83, 0xE1, 0xA1, 0xFF, 0x8C, 0x44, 0x46, 0x45, + 0xA1, 0xFF, 0x14, 0x63, 0x01, 0x10, 0xFE, 0x1F, 0x01, 0x60, 0x08, 0xE1, 0x0A, 0x64, 0x60, 0x54, + 0x47, 0xFF, 0x50, 0x4B, 0x67, 0x50, 0x69, 0xE2, 0x6A, 0x40, 0x40, 0x2B, 0x01, 0x15, 0x29, 0x00, + 0x6C, 0x40, 0x28, 0x40, 0x03, 0x26, 0x15, 0x00, 0x31, 0x40, 0x20, 0x2A, 0x03, 0x00, 0x28, 0x40, + 0x50, 0x3A, 0x0F, 0x00, 0x2D, 0x44, 0x20, 0x2A, 0x0C, 0x00, 0x2B, 0x44, 0xAC, 0x80, 0x28, 0x40, + 0xB4, 0x3A, 0x03, 0x00, 0x02, 0x03, 0x30, 0xFB, 0x04, 0x00, 0x2B, 0x50, 0xA4, 0x60, 0x85, 0x78, + 0x04, 0xE1, 0x04, 0xE1, 0xA1, 0xFF, 0x35, 0xF1, 0x26, 0x44, 0x64, 0x54, 0xCD, 0xE2, 0x84, 0xBC, + 0x2D, 0x40, 0x0C, 0x22, 0xFD, 0xB4, 0x40, 0x46, 0x23, 0x64, 0x3A, 0xDB, 0xA7, 0x60, 0x18, 0x78, + 0xFF, 0xFF, 0x27, 0x40, 0x26, 0x22, 0x04, 0x00, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0xFF, 0xFF, + 0x6C, 0x40, 0xB7, 0xFF, 0xB4, 0xFF, 0x48, 0x60, 0x2D, 0x7D, 0x08, 0x60, 0x00, 0x6B, 0x37, 0xF3, + 0x2B, 0x45, 0xD4, 0x80, 0xFF, 0xFF, 0x02, 0x28, 0x65, 0x44, 0x60, 0x50, 0xA0, 0x4C, 0x20, 0xBC, + 0xFF, 0xB4, 0xA0, 0x51, 0x35, 0xF1, 0x74, 0x44, 0xC0, 0x94, 0x32, 0x40, 0x02, 0x2A, 0x18, 0x00, + 0x28, 0x44, 0xA4, 0x36, 0x04, 0x00, 0x0C, 0xB4, 0xFF, 0xFF, 0x04, 0x36, 0x11, 0x00, 0x26, 0x43, + 0xFD, 0xB3, 0x04, 0xBB, 0x43, 0x46, 0x01, 0x2A, 0x03, 0x00, 0x28, 0x47, 0x40, 0xBF, 0x40, 0x48, + 0x0A, 0xBB, 0x0F, 0xFC, 0x50, 0x4B, 0x67, 0x50, 0x00, 0x64, 0x30, 0xFB, 0x05, 0xFF, 0xC6, 0x01, + 0x24, 0x64, 0x3A, 0xDB, 0x28, 0x44, 0x04, 0x2A, 0x06, 0x00, 0xAE, 0x4F, 0xF7, 0xB4, 0xA0, 0x5E, + 0xA3, 0x60, 0x3E, 0x78, 0xFF, 0xFF, 0x1D, 0xFF, 0x48, 0xE2, 0x27, 0x44, 0x06, 0x22, 0x05, 0x00, + 0xF9, 0xB4, 0x40, 0x47, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x26, 0x40, 0x10, 0x2A, 0x18, 0x00, + 0x26, 0xF2, 0xFF, 0xFF, 0x60, 0x47, 0xFF, 0xB4, 0xC0, 0xA0, 0xFF, 0xFF, 0x11, 0x0E, 0xB8, 0xF1, + 0x27, 0x60, 0x92, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, + 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, + 0xA7, 0x60, 0xE5, 0x78, 0xFF, 0xFF, 0xB8, 0xF1, 0x27, 0x60, 0x94, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, + 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, + 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x2A, 0x64, 0x3A, 0xDB, 0x5C, 0x41, 0x87, 0xE1, + 0xA1, 0xFF, 0x6C, 0x40, 0x02, 0x00, 0x29, 0x64, 0x3A, 0xDB, 0x01, 0x60, 0x08, 0xE1, 0x87, 0xE1, + 0xA1, 0xFF, 0x6C, 0x40, 0x11, 0x00, 0x27, 0x60, 0xA6, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, + 0xFF, 0xFF, 0x08, 0x28, 0xA2, 0xDB, 0xF1, 0x01, 0x01, 0x60, 0x08, 0xE1, 0x21, 0x64, 0x3A, 0xDB, + 0x03, 0x00, 0x01, 0x60, 0x08, 0xE1, 0x6C, 0x40, 0x00, 0x64, 0x33, 0xFB, 0x32, 0x74, 0x40, 0x63, + 0x01, 0x16, 0xFE, 0x01, 0x01, 0x68, 0x01, 0x11, 0x09, 0x00, 0xA7, 0x6A, 0x22, 0x64, 0x3A, 0xDB, + 0x03, 0x60, 0xC9, 0x63, 0x01, 0x11, 0x02, 0x00, 0x6C, 0x40, 0xFC, 0x1F, 0x6C, 0x40, 0xB5, 0xFF, + 0x6C, 0x40, 0xBC, 0xFF, 0x6C, 0x40, 0xB7, 0xFF, 0xB4, 0xFF, 0x48, 0x60, 0x2D, 0x7D, 0x08, 0x60, + 0x00, 0x6B, 0xAE, 0x4F, 0xF7, 0xB4, 0xA0, 0x5E, 0x03, 0x0A, 0xA3, 0x60, 0x4B, 0x78, 0xFF, 0xFF, + 0x01, 0x64, 0x51, 0xFB, 0x31, 0x60, 0x0E, 0x7C, 0xA4, 0xD3, 0xFF, 0xFF, 0x04, 0x18, 0xAE, 0x4F, + 0x08, 0xBC, 0x00, 0x7F, 0xA0, 0x5E, 0x27, 0x44, 0x06, 0x22, 0x06, 0x00, 0xF9, 0xB4, 0x40, 0x47, + 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x48, 0xE2, 0x27, 0x64, 0x3A, 0xDB, 0xB3, 0xE1, 0xA1, 0xFF, + 0xFF, 0xFF, 0x81, 0x3E, 0x54, 0x62, 0x22, 0x46, 0xA2, 0xD0, 0x16, 0x63, 0x7C, 0x41, 0x44, 0x48, + 0x80, 0x36, 0x04, 0x61, 0x28, 0x40, 0x50, 0x36, 0x04, 0x61, 0x41, 0x4E, 0x28, 0x44, 0xA4, 0x36, + 0x0E, 0x63, 0x1C, 0x60, 0x9C, 0x62, 0xA2, 0xD1, 0x24, 0x44, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, + 0xE8, 0x84, 0xE8, 0x84, 0xC0, 0x84, 0xA2, 0xDB, 0x9A, 0xFF, 0xA1, 0xFF, 0x2D, 0x60, 0x52, 0x62, + 0xA2, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, 0x06, 0x00, 0x18, 0xF2, 0xAA, 0xF0, 0xFF, 0xFF, + 0xB4, 0x84, 0x08, 0x36, 0x2A, 0xFA, 0x54, 0x62, 0xA2, 0xD2, 0xFF, 0xFF, 0x6A, 0x40, 0x80, 0x4E, + 0x7A, 0xD4, 0x7A, 0xD4, 0x7A, 0xD4, 0x7A, 0xD4, 0x7A, 0xD4, 0x7A, 0xD4, 0x7A, 0xD4, 0xFF, 0xFF, + 0x01, 0x1D, 0x78, 0x00, 0x7A, 0xD4, 0x7A, 0xD4, 0x7A, 0xD4, 0x7A, 0xD4, 0x28, 0x40, 0x03, 0x2B, + 0x04, 0x00, 0x7A, 0xD4, 0x7A, 0xD4, 0x7A, 0xD4, 0x6A, 0x40, 0x70, 0x62, 0x28, 0x44, 0x88, 0xB0, + 0x88, 0x36, 0x7A, 0xD4, 0x28, 0x40, 0x40, 0x2B, 0x0B, 0x00, 0x72, 0x62, 0x7A, 0xD4, 0x7A, 0xD4, + 0xA2, 0xD2, 0xFF, 0xFF, 0x60, 0x40, 0x20, 0x2B, 0x02, 0x00, 0x7A, 0xD4, 0x7A, 0xD4, 0x46, 0x00, + 0x23, 0x43, 0xCF, 0x83, 0xDF, 0x83, 0x02, 0x03, 0x55, 0x03, 0x04, 0x00, 0x03, 0xF0, 0x04, 0xF4, + 0x64, 0x42, 0x37, 0x00, 0x2E, 0x40, 0x04, 0x2A, 0x21, 0x00, 0xA1, 0xFF, 0x02, 0xFE, 0x10, 0x25, + 0x42, 0xFE, 0x72, 0x45, 0x65, 0x4C, 0xB5, 0xF3, 0x03, 0x04, 0xE4, 0xE2, 0xDC, 0x84, 0xB5, 0xFB, + 0xA1, 0xFF, 0x80, 0x4C, 0xB6, 0xF3, 0x02, 0x04, 0xDC, 0x84, 0xB6, 0xFB, 0x80, 0x4C, 0xB7, 0xF3, + 0x02, 0x04, 0xDC, 0x84, 0xB7, 0xFB, 0x80, 0x4C, 0x5C, 0x4E, 0xF8, 0xA3, 0x03, 0xF2, 0x9A, 0xF2, + 0x04, 0xF4, 0xFF, 0xB1, 0xF8, 0xA1, 0x06, 0xA4, 0x60, 0x42, 0x09, 0x00, 0x03, 0xF2, 0x9A, 0xF2, + 0x04, 0xF4, 0xC8, 0x82, 0xFF, 0xB1, 0x03, 0x00, 0x00, 0xF4, 0x81, 0xF2, 0xFF, 0xB1, 0x7A, 0xD4, + 0xFF, 0xFF, 0xFD, 0x1C, 0xF9, 0x1D, 0xFF, 0xB1, 0x17, 0x1E, 0x02, 0x02, 0x00, 0xF4, 0xDA, 0x82, + 0xDA, 0x82, 0xA2, 0xD2, 0xA1, 0xFF, 0x09, 0x74, 0x80, 0x4D, 0x0E, 0x00, 0x03, 0xF2, 0x9A, 0xF2, + 0x04, 0xF4, 0x23, 0x43, 0xA1, 0xFF, 0xA0, 0xD2, 0xFE, 0xA1, 0xCB, 0x83, 0x80, 0x4E, 0xAF, 0x83, + 0x02, 0x1D, 0x02, 0x03, 0xED, 0x01, 0xE3, 0x01, 0xA1, 0xFF, 0x28, 0x40, 0x40, 0x2B, 0x02, 0x00, + 0x9C, 0x4E, 0x9C, 0x4C, 0xA1, 0xFF, 0xDA, 0x83, 0x66, 0x44, 0x22, 0x46, 0x0C, 0xFA, 0x0B, 0xFC, + 0x87, 0x4F, 0x87, 0x4C, 0x87, 0x4F, 0x87, 0x4D, 0x87, 0x4C, 0x01, 0x08, 0x01, 0x00, 0xFF, 0xFF, + 0x87, 0x4C, 0x87, 0x4C, 0x87, 0x4C, 0x87, 0x4C, 0xFF, 0xFF, 0xFF, 0xFF, 0x6A, 0x44, 0xBC, 0xFF, + 0x01, 0x60, 0x08, 0xE1, 0x0C, 0x74, 0x04, 0xE1, 0xA1, 0xFF, 0x35, 0xF3, 0xC4, 0xE2, 0x60, 0x54, + 0x89, 0xFF, 0x13, 0x74, 0x88, 0xFF, 0x29, 0x44, 0xF7, 0xB4, 0x40, 0x49, 0x34, 0x64, 0x3A, 0xDB, + 0x06, 0xE1, 0x47, 0xFF, 0xA4, 0x60, 0x47, 0x78, 0xFF, 0xFF, 0xFF, 0x01, 0x10, 0x61, 0x7F, 0x60, + 0xC0, 0x64, 0xA0, 0x80, 0x7F, 0x67, 0x02, 0x63, 0x26, 0x02, 0x98, 0xFE, 0x1A, 0x05, 0x24, 0x60, + 0x52, 0x62, 0xA2, 0xD5, 0x0E, 0xF2, 0x15, 0x18, 0x02, 0x18, 0x09, 0xF4, 0xFB, 0x01, 0x23, 0x44, + 0x00, 0xA8, 0x08, 0x7E, 0x0A, 0x02, 0x66, 0x44, 0x11, 0xFB, 0x46, 0x43, 0x23, 0x47, 0x80, 0xBF, + 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, 0x08, 0xB9, 0x10, 0x7E, 0x00, 0x7F, 0x0E, 0xFA, 0x00, 0x67, + 0x0A, 0x00, 0x20, 0x44, 0xDC, 0x85, 0x0F, 0xB4, 0xFA, 0xA0, 0x7F, 0x67, 0x07, 0x63, 0x03, 0x05, + 0x45, 0x40, 0x00, 0x67, 0xD8, 0xFE, 0xFF, 0x27, 0x05, 0xFD, 0x0A, 0x7E, 0x04, 0xFB, 0x61, 0x55, + 0x4A, 0x00, 0x28, 0xFB, 0x01, 0xF3, 0x29, 0xFB, 0x44, 0x46, 0x40, 0x45, 0x10, 0x61, 0x7E, 0x60, + 0xC0, 0x64, 0xA0, 0x80, 0x7F, 0x67, 0x02, 0x63, 0x31, 0x02, 0xAE, 0x60, 0x58, 0x4F, 0x6F, 0x78, + 0xFF, 0xFF, 0x7F, 0x67, 0x03, 0x63, 0x2A, 0x02, 0x26, 0x40, 0x01, 0x2B, 0x24, 0x00, 0x98, 0xFE, + 0x19, 0x05, 0x24, 0x60, 0x52, 0x62, 0xA2, 0xD5, 0x0E, 0xF2, 0x14, 0x18, 0x02, 0x18, 0x09, 0xF4, + 0xFB, 0x01, 0x23, 0x44, 0x00, 0xA8, 0x08, 0x7E, 0x0A, 0x02, 0x66, 0x44, 0x11, 0xFB, 0x46, 0x43, + 0x23, 0x47, 0x80, 0xBF, 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, 0x08, 0xB9, 0x10, 0x7E, 0x00, 0x7F, + 0x0E, 0xFA, 0x09, 0x00, 0x20, 0x44, 0xDC, 0x85, 0x0F, 0xB4, 0xFA, 0xA0, 0x7F, 0x67, 0x07, 0x63, + 0x05, 0x05, 0x45, 0x40, 0xD8, 0xFE, 0x00, 0x67, 0xD0, 0xFE, 0xD9, 0xFE, 0xFF, 0x27, 0x05, 0xFD, + 0x0B, 0x7E, 0x04, 0xFB, 0x1C, 0x60, 0xB4, 0x63, 0xA3, 0xD3, 0xFF, 0xFF, 0x20, 0xB0, 0x80, 0xBC, + 0x08, 0x28, 0xA3, 0xDB, 0x61, 0x55, 0x63, 0x00, 0x04, 0xB5, 0x82, 0xB5, 0x25, 0x02, 0x04, 0x03, + 0x20, 0x44, 0x7F, 0xB4, 0x40, 0x40, 0xA3, 0xD3, 0x99, 0xFE, 0x04, 0x04, 0x02, 0xBC, 0xFE, 0xB4, + 0xA3, 0xDB, 0x56, 0x00, 0xDC, 0xF3, 0x20, 0x40, 0x80, 0x26, 0x52, 0x00, 0xA3, 0xD3, 0xFF, 0xA0, + 0xF8, 0xB4, 0x02, 0x02, 0xA3, 0xDB, 0x1C, 0x00, 0x04, 0xBC, 0xBF, 0xB4, 0xA3, 0xDB, 0x08, 0xB0, + 0x01, 0x64, 0x08, 0x24, 0x02, 0x64, 0x28, 0xFB, 0x20, 0x44, 0x80, 0xBC, 0x40, 0x40, 0xD0, 0xFE, + 0x3F, 0x00, 0xBF, 0xB4, 0xA3, 0xDB, 0x3C, 0x00, 0x40, 0xB0, 0xFF, 0xFF, 0xFA, 0x02, 0xF8, 0xB4, + 0xA3, 0xDB, 0x08, 0xB5, 0x07, 0x7C, 0x01, 0x02, 0xDC, 0xF9, 0x20, 0x44, 0x7F, 0xB4, 0x40, 0x40, + 0x1C, 0x60, 0xB4, 0x63, 0xA3, 0xD3, 0xFF, 0xFF, 0x20, 0xB5, 0x07, 0xB5, 0x08, 0x28, 0xC4, 0x02, + 0x99, 0xFE, 0x26, 0x05, 0x20, 0x44, 0x80, 0x26, 0x23, 0x00, 0x20, 0x2A, 0x00, 0x00, 0x40, 0x2A, + 0x1F, 0x00, 0xBF, 0xB4, 0x40, 0x40, 0x09, 0x00, 0xA8, 0xFF, 0x20, 0x44, 0x99, 0xFE, 0x02, 0x05, + 0x80, 0x2A, 0x03, 0x00, 0x40, 0xBC, 0x40, 0x40, 0x13, 0x00, 0x00, 0xF1, 0x80, 0xBC, 0x40, 0x40, + 0x64, 0x44, 0xE0, 0x84, 0xE8, 0x84, 0x0A, 0x36, 0x29, 0x01, 0x0B, 0x36, 0x5A, 0x01, 0x28, 0xFB, + 0x01, 0xF1, 0x29, 0xF9, 0x02, 0xF1, 0x2A, 0xF9, 0x03, 0xF1, 0x2B, 0xF9, 0xD0, 0xFE, 0xAE, 0xFF, + 0xA1, 0xFF, 0xFF, 0xFF, 0x82, 0x3E, 0x75, 0x44, 0x02, 0xB0, 0x01, 0xB0, 0x29, 0x02, 0xDC, 0x02, + 0x04, 0xB0, 0x08, 0xB0, 0x0B, 0x02, 0x20, 0x02, 0x40, 0x26, 0xA7, 0xFF, 0x8C, 0xFF, 0x75, 0x40, + 0x80, 0x2B, 0x01, 0x00, 0xAB, 0xFF, 0x75, 0x44, 0x8D, 0xFF, 0xEA, 0x01, 0x0A, 0xF3, 0xAA, 0xFF, + 0x60, 0x40, 0x20, 0x2B, 0x02, 0x00, 0x60, 0xFF, 0x0D, 0x00, 0x01, 0x26, 0x0C, 0x00, 0xC0, 0x60, + 0x00, 0x7C, 0xA0, 0x84, 0x80, 0x3B, 0x02, 0x00, 0xC0, 0x67, 0x03, 0x00, 0x40, 0x3B, 0x02, 0x00, + 0x00, 0x67, 0x0A, 0xFB, 0xD5, 0x01, 0xD4, 0x01, 0xAB, 0xFF, 0x38, 0xFF, 0x00, 0x00, 0xD0, 0x01, + 0x79, 0x63, 0xFF, 0xFF, 0xFF, 0x1F, 0xA9, 0xFF, 0x77, 0x44, 0x60, 0x57, 0x10, 0x60, 0x00, 0x75, + 0x40, 0x4A, 0x01, 0x2A, 0x1C, 0x00, 0x24, 0x44, 0xAC, 0x86, 0x08, 0xF2, 0x18, 0x03, 0x24, 0x60, + 0x58, 0x65, 0xD4, 0x80, 0x0E, 0xF2, 0x02, 0x03, 0xA5, 0xD5, 0x04, 0x00, 0x01, 0xBC, 0x0E, 0xFA, + 0x09, 0xF4, 0xD1, 0xFE, 0x46, 0x44, 0x0B, 0x18, 0x66, 0x44, 0x10, 0xFB, 0x66, 0x47, 0x20, 0xBF, + 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, 0x0E, 0xF2, 0x01, 0x75, 0x10, 0xBC, 0x0E, 0xFA, 0x2A, 0x44, + 0x08, 0x2A, 0x18, 0x00, 0x23, 0x44, 0x00, 0xA8, 0x5C, 0x43, 0x14, 0x03, 0x24, 0x60, 0x52, 0x62, + 0xA2, 0xD5, 0x01, 0x00, 0x09, 0xF4, 0x0E, 0xF2, 0x0D, 0x18, 0x08, 0xB0, 0x18, 0xAC, 0xFA, 0x03, + 0x0E, 0xFA, 0x66, 0x43, 0x11, 0xFD, 0x46, 0x43, 0x23, 0x47, 0x80, 0xBF, 0x3B, 0x42, 0x04, 0xA2, + 0xA2, 0xDB, 0x08, 0x75, 0x2A, 0x44, 0x06, 0x22, 0x2D, 0x00, 0x22, 0x44, 0x00, 0xA8, 0x60, 0x46, + 0x0E, 0xF2, 0x28, 0x03, 0x10, 0xB0, 0x01, 0xBC, 0x03, 0x02, 0x00, 0x64, 0x40, 0x42, 0x22, 0x00, + 0x0E, 0xFA, 0xD1, 0xFE, 0x24, 0x60, 0x4C, 0x64, 0x40, 0x47, 0x58, 0x4F, 0x84, 0x00, 0x46, 0x42, + 0x19, 0x02, 0x22, 0x47, 0x40, 0xBF, 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, 0x23, 0xF2, 0x66, 0x43, + 0x00, 0xA8, 0x0E, 0xF2, 0x08, 0x02, 0x60, 0x40, 0x02, 0x2A, 0xE4, 0x01, 0x12, 0xFD, 0x10, 0x64, + 0x0E, 0xFA, 0x02, 0x75, 0x07, 0x00, 0x60, 0x40, 0x04, 0x2A, 0xDC, 0x01, 0x12, 0xFD, 0x10, 0x64, + 0x0E, 0xFA, 0x04, 0x75, 0x2A, 0x44, 0x80, 0x2A, 0x19, 0x00, 0x21, 0x44, 0xAC, 0x86, 0x0E, 0xF2, + 0x15, 0x03, 0x01, 0xBC, 0x0E, 0xFA, 0xD1, 0xFE, 0x24, 0x60, 0x64, 0x64, 0x40, 0x47, 0x58, 0x4F, + 0x5A, 0x00, 0x46, 0x41, 0x0B, 0x02, 0x21, 0x47, 0x10, 0xBF, 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, + 0x0E, 0xF2, 0x66, 0x43, 0x08, 0xFD, 0x10, 0xBC, 0x0E, 0xFA, 0x80, 0x75, 0x2A, 0x44, 0x10, 0xB0, + 0x20, 0x44, 0x15, 0x03, 0x7F, 0xB4, 0x40, 0x40, 0x1C, 0x60, 0xB4, 0x63, 0xA3, 0xD3, 0xFF, 0xFF, + 0x20, 0xB0, 0x80, 0xB0, 0x09, 0x03, 0x08, 0x03, 0x40, 0xBC, 0x7F, 0xB4, 0x04, 0xB0, 0xA3, 0xDB, + 0x03, 0x03, 0x20, 0x44, 0x80, 0xBC, 0x40, 0x40, 0xAC, 0x60, 0xD8, 0x78, 0xFF, 0xFF, 0x2A, 0x40, + 0x08, 0x2B, 0x01, 0x00, 0x10, 0xFF, 0xAD, 0x60, 0x08, 0x78, 0xFF, 0xFF, 0xE8, 0xFE, 0x14, 0x05, + 0xEA, 0xFE, 0x24, 0x05, 0xE9, 0xFE, 0x1C, 0x05, 0xE7, 0xFE, 0x09, 0x05, 0x47, 0xFF, 0x20, 0x44, + 0x0F, 0x22, 0x03, 0x00, 0xCC, 0x84, 0x40, 0x40, 0x0F, 0x22, 0xB8, 0xFE, 0xEC, 0x01, 0x23, 0x41, + 0x00, 0xB9, 0x5C, 0x4A, 0xE8, 0x02, 0x6A, 0x01, 0x24, 0x41, 0x00, 0xB9, 0x24, 0x60, 0x58, 0x65, + 0x45, 0x47, 0xE1, 0x02, 0x58, 0x4F, 0x0F, 0x00, 0xDE, 0x02, 0x5C, 0x4A, 0x46, 0x44, 0x4C, 0x01, + 0x22, 0x41, 0x00, 0xB9, 0x5C, 0x4A, 0x08, 0x24, 0x7D, 0x01, 0xD5, 0x01, 0x21, 0x41, 0x00, 0xB9, + 0x5C, 0x4A, 0xA2, 0x03, 0xD0, 0x01, 0x27, 0xD3, 0x03, 0x00, 0x10, 0xB0, 0x09, 0xF2, 0x04, 0x03, + 0xAC, 0x86, 0x0E, 0xF2, 0xFA, 0x02, 0x08, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0E, 0xF3, 0x0F, 0x60, + 0xFE, 0x65, 0x0C, 0xF3, 0x24, 0x86, 0x24, 0x46, 0x60, 0x40, 0xFB, 0x3B, 0x07, 0x00, 0x80, 0x26, + 0x02, 0x00, 0x23, 0x46, 0x03, 0x4C, 0x46, 0x61, 0x3A, 0x65, 0x0C, 0x00, 0x2E, 0xF3, 0x40, 0x45, + 0xF8, 0x2B, 0x02, 0x00, 0x40, 0x45, 0x03, 0x00, 0x58, 0x4F, 0x39, 0x00, 0x07, 0x02, 0x58, 0x4F, + 0x45, 0x00, 0x04, 0x05, 0x66, 0x50, 0x65, 0x52, 0x61, 0x51, 0x09, 0x00, 0x26, 0x47, 0x00, 0xBF, + 0x0E, 0xFB, 0x2E, 0xF5, 0x05, 0xF0, 0x80, 0x60, 0x64, 0x50, 0x00, 0x72, 0x7E, 0x71, 0xAC, 0xFF, + 0xAD, 0x60, 0x08, 0x78, 0xFF, 0xFF, 0x8E, 0xFF, 0x0F, 0xF3, 0x0F, 0x60, 0xFE, 0x65, 0x24, 0x86, + 0x0D, 0xF3, 0x2E, 0xF3, 0x40, 0x45, 0xF8, 0x2B, 0x02, 0x00, 0x40, 0x45, 0x03, 0x00, 0x58, 0x4F, + 0x16, 0x00, 0x07, 0x02, 0x58, 0x4F, 0x22, 0x00, 0x04, 0x05, 0x66, 0x50, 0x65, 0x52, 0x61, 0x51, + 0x09, 0x00, 0x26, 0x47, 0x00, 0xBF, 0x0F, 0xFB, 0x2E, 0xF5, 0x05, 0xF0, 0x80, 0x60, 0x64, 0x50, + 0x00, 0x72, 0x7E, 0x71, 0x8D, 0xFF, 0xAD, 0xFF, 0xAD, 0x60, 0x08, 0x78, 0xFF, 0xFF, 0x25, 0x44, + 0xAA, 0xF1, 0xAB, 0xF1, 0xD0, 0x80, 0xD0, 0x80, 0x07, 0x04, 0x01, 0x06, 0x05, 0x00, 0x25, 0x46, + 0x01, 0xF0, 0x03, 0x67, 0xA0, 0x85, 0x94, 0x80, 0x2F, 0x58, 0xFF, 0xFF, 0x25, 0x46, 0x26, 0x41, + 0x46, 0x63, 0x01, 0xF2, 0xFF, 0xFF, 0xFF, 0xB5, 0xD5, 0x81, 0x00, 0xF2, 0x05, 0x04, 0x04, 0x63, + 0x60, 0x46, 0xF7, 0x1B, 0x42, 0xFE, 0x0D, 0x00, 0x61, 0x44, 0xC5, 0x81, 0x63, 0x45, 0xC5, 0x81, + 0x9C, 0x84, 0xDC, 0x84, 0x01, 0xF2, 0xF0, 0x85, 0xF0, 0x80, 0x65, 0x44, 0xF8, 0x85, 0xFF, 0xFF, + 0x02, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xA2, 0xFF, 0x24, 0x60, 0x6A, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, + 0xAC, 0x86, 0x0E, 0xF2, 0x07, 0x03, 0x00, 0xA8, 0x09, 0xF2, 0xFA, 0x02, 0x01, 0x67, 0x0E, 0xFA, + 0x08, 0xFE, 0x17, 0x00, 0xAC, 0xF3, 0xFF, 0xFF, 0xD8, 0xA0, 0x00, 0xB4, 0x12, 0x06, 0x09, 0x60, + 0x08, 0x61, 0x41, 0x4A, 0x7C, 0xA1, 0x0E, 0xA1, 0xA2, 0xFF, 0xAE, 0x60, 0x58, 0x4E, 0xE4, 0x78, + 0xFF, 0xFF, 0xA3, 0xFF, 0x06, 0x03, 0x2A, 0x43, 0xAF, 0x60, 0x58, 0x4E, 0x05, 0x78, 0xFF, 0xFF, + 0x08, 0xFE, 0xA3, 0xFF, 0x2D, 0x58, 0xFF, 0xFF, 0x41, 0x4A, 0x7C, 0xA1, 0x0E, 0xA1, 0xA2, 0xFF, + 0xAE, 0x60, 0x58, 0x4E, 0xE4, 0x78, 0xFF, 0xFF, 0x07, 0x03, 0x2A, 0x43, 0xAF, 0x60, 0x58, 0x4E, + 0x05, 0x78, 0xFF, 0xFF, 0x08, 0xFE, 0x0D, 0x00, 0x24, 0x60, 0x6A, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, + 0xAC, 0x86, 0x0E, 0xF2, 0x06, 0x03, 0x00, 0xA8, 0x09, 0xF2, 0xFA, 0x02, 0x01, 0x67, 0x0E, 0xFA, + 0x08, 0xFE, 0xA3, 0xFF, 0x2D, 0x58, 0xFF, 0xFF, 0xAD, 0xF3, 0x7C, 0x63, 0x00, 0xBE, 0x40, 0x45, + 0x1A, 0x03, 0x00, 0x65, 0x65, 0x44, 0xDC, 0x85, 0x84, 0xA1, 0x00, 0xF2, 0x06, 0x06, 0x01, 0xFC, + 0x00, 0xA8, 0x60, 0x46, 0xF7, 0x02, 0x40, 0x45, 0x0E, 0x00, 0xAC, 0xF3, 0x00, 0x63, 0xD4, 0x84, + 0xAC, 0xFB, 0x80, 0x60, 0x7C, 0x64, 0x01, 0xFA, 0x00, 0xF0, 0x00, 0xFC, 0xD3, 0x80, 0xAD, 0xF9, + 0x02, 0x02, 0xAE, 0xF9, 0x08, 0xFE, 0x2E, 0x58, 0xFF, 0xFF, 0x66, 0x44, 0x25, 0x46, 0x05, 0xFA, + 0x06, 0xFA, 0x01, 0xF0, 0x03, 0x67, 0x02, 0xFC, 0xB0, 0x84, 0x3A, 0x7E, 0x01, 0xFA, 0x12, 0x64, + 0x03, 0xFA, 0x00, 0xF0, 0x04, 0xF8, 0x00, 0x64, 0x0C, 0x61, 0x10, 0x63, 0x59, 0xDA, 0xFE, 0x1F, + 0x2E, 0x58, 0xFF, 0xFF, 0x27, 0x43, 0xE3, 0x81, 0xE9, 0x81, 0x03, 0x05, 0x16, 0x03, 0x00, 0x61, + 0x01, 0x00, 0xE4, 0x63, 0x61, 0x46, 0xBF, 0xD2, 0x27, 0x45, 0xDC, 0x84, 0xA2, 0xDA, 0xBE, 0xD2, + 0x25, 0x46, 0x88, 0xF8, 0x04, 0x1B, 0x25, 0x44, 0x61, 0x46, 0xA3, 0xDA, 0x04, 0x00, 0x0A, 0xFA, + 0x60, 0x46, 0x25, 0x44, 0x09, 0xFA, 0x61, 0x46, 0xBE, 0xDA, 0x2F, 0x58, 0xFF, 0xFF, 0x25, 0x44, + 0x00, 0xA8, 0x07, 0x4B, 0x0C, 0x03, 0x58, 0x4F, 0x33, 0x00, 0x0B, 0x47, 0x24, 0x60, 0x5E, 0x65, + 0x27, 0x44, 0xD4, 0x80, 0x00, 0x64, 0x01, 0x02, 0x0F, 0xFA, 0x58, 0x4F, 0xD3, 0x01, 0x70, 0x00, + 0x25, 0x43, 0xE3, 0x84, 0x7C, 0x41, 0x02, 0x04, 0xE8, 0x81, 0xE4, 0x63, 0x61, 0x46, 0xA3, 0xD2, + 0x00, 0x7C, 0x40, 0x45, 0xBF, 0xD8, 0xA3, 0xD8, 0xBE, 0xD8, 0x27, 0x42, 0x5A, 0xD3, 0x25, 0x5C, + 0x60, 0x41, 0x02, 0x1B, 0x27, 0xD9, 0x05, 0x00, 0x25, 0x46, 0x0A, 0xFA, 0x61, 0x46, 0x25, 0x44, + 0x09, 0xFA, 0x25, 0x44, 0x27, 0x43, 0x00, 0x61, 0x60, 0x46, 0x09, 0xF2, 0x08, 0xFC, 0x00, 0xA8, + 0xDD, 0x81, 0xFA, 0x02, 0xBF, 0xD1, 0x66, 0x44, 0xBE, 0xDB, 0xC1, 0x84, 0xBF, 0xDB, 0x48, 0x00, + 0x25, 0x46, 0xE4, 0x63, 0x08, 0xF2, 0x89, 0xF2, 0x1E, 0x18, 0x40, 0x47, 0xE0, 0x84, 0xE8, 0x85, + 0x02, 0x05, 0xE8, 0x83, 0x00, 0x65, 0x65, 0x46, 0xBF, 0xD2, 0x61, 0x5C, 0xCC, 0x84, 0xA2, 0xDA, + 0x25, 0x46, 0x0A, 0xF2, 0x00, 0xB9, 0x65, 0x46, 0x08, 0x24, 0xBE, 0xDA, 0x02, 0x1B, 0xA3, 0xD8, + 0x02, 0x00, 0x60, 0x46, 0x89, 0xFA, 0x00, 0xB9, 0x61, 0x46, 0x08, 0x28, 0x0A, 0xFA, 0x25, 0x46, + 0x89, 0xFC, 0x8A, 0xFC, 0x88, 0xFC, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x61, 0x28, 0x65, 0x25, 0x43, + 0xAE, 0xF3, 0xAF, 0x83, 0x00, 0xBE, 0x18, 0x03, 0x02, 0x03, 0x00, 0xFC, 0x01, 0x00, 0xAD, 0xFD, + 0x63, 0x46, 0x65, 0x44, 0xCC, 0x85, 0x00, 0xF2, 0x07, 0x02, 0xAE, 0xF5, 0x00, 0x64, 0x00, 0xFA, + 0xDE, 0x60, 0xAF, 0x64, 0x09, 0xFB, 0x08, 0x00, 0x66, 0x43, 0x00, 0xBE, 0xDD, 0x81, 0xF1, 0x02, + 0xAC, 0xF1, 0xAE, 0xFD, 0xC1, 0x84, 0xAC, 0xFB, 0x2E, 0x58, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x45, + 0x29, 0x43, 0xFC, 0xA3, 0x66, 0x44, 0xBD, 0xDB, 0x25, 0x44, 0xBD, 0xDB, 0x00, 0x64, 0xBD, 0xDB, + 0x03, 0x61, 0x0E, 0x65, 0x24, 0x60, 0x72, 0x63, 0x43, 0x49, 0xA3, 0xD3, 0x06, 0xA3, 0x00, 0xA8, + 0xCD, 0x81, 0x04, 0x02, 0xF9, 0x02, 0xAD, 0x60, 0x08, 0x78, 0xFF, 0xFF, 0x01, 0x26, 0xE6, 0x01, + 0xD4, 0x80, 0x60, 0x45, 0xE3, 0x05, 0xF6, 0xA3, 0xBD, 0xD1, 0xBD, 0xD1, 0x44, 0x47, 0x44, 0x48, + 0x44, 0x45, 0x24, 0x60, 0xB0, 0x64, 0x44, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0x24, 0x60, 0x22, 0x63, + 0x0D, 0x65, 0x00, 0x61, 0x41, 0x48, 0xA3, 0xD3, 0x06, 0xA3, 0xAC, 0x86, 0x00, 0x61, 0x09, 0x03, + 0x00, 0xF2, 0x09, 0xF0, 0xAC, 0x86, 0x00, 0xF2, 0xDD, 0x81, 0xFC, 0x02, 0x64, 0x44, 0xAC, 0x86, + 0xF6, 0x01, 0x61, 0x44, 0x25, 0x46, 0x27, 0xDA, 0x65, 0x44, 0x28, 0x45, 0x45, 0x88, 0xCC, 0x85, + 0x5A, 0x87, 0xE9, 0x02, 0x00, 0x64, 0x27, 0xDA, 0x5A, 0xDA, 0x5A, 0x87, 0xA9, 0xF3, 0xA8, 0xF1, + 0x02, 0xA4, 0x60, 0x46, 0x60, 0x45, 0x00, 0x61, 0x1E, 0xF2, 0xFF, 0xFF, 0xAC, 0x86, 0x00, 0xF2, + 0x04, 0x03, 0xAC, 0x86, 0x00, 0xF2, 0xDD, 0x81, 0xFC, 0x02, 0x65, 0x44, 0x02, 0xA5, 0x65, 0x46, + 0x64, 0x44, 0xCC, 0x9C, 0xFF, 0xFF, 0xF0, 0x02, 0x61, 0x44, 0x25, 0x46, 0x27, 0xDA, 0x5A, 0x87, + 0x28, 0x45, 0x45, 0x88, 0x00, 0x64, 0x27, 0xDA, 0x5A, 0x87, 0x06, 0x60, 0x40, 0x65, 0xAD, 0xF3, + 0x01, 0x61, 0xAC, 0x86, 0x00, 0xF2, 0x03, 0x03, 0xD5, 0x80, 0xDD, 0x81, 0xFA, 0x04, 0xCD, 0x84, + 0x25, 0x46, 0x27, 0xDA, 0x28, 0x45, 0xC4, 0x84, 0x5A, 0xDA, 0xDA, 0x81, 0xAC, 0xF1, 0x59, 0xD8, + 0x24, 0x60, 0x20, 0x64, 0x18, 0x63, 0xA0, 0xD1, 0x06, 0xA4, 0x59, 0xD8, 0xFC, 0x1F, 0x00, 0x64, + 0x59, 0xDA, 0x59, 0xDA, 0x01, 0x60, 0x5C, 0x64, 0x0A, 0x63, 0x58, 0xD1, 0x59, 0xD8, 0xFD, 0x1F, + 0xDC, 0xF1, 0x59, 0xD8, 0x75, 0x01, 0x07, 0x4B, 0xAF, 0x60, 0x58, 0x4F, 0x70, 0x78, 0xFF, 0xFF, + 0x0B, 0x47, 0x58, 0x4F, 0x21, 0x00, 0x6C, 0x01, 0x07, 0x4B, 0xAF, 0x60, 0x58, 0x4F, 0x70, 0x78, + 0xFF, 0xFF, 0x0B, 0x47, 0x27, 0x44, 0x00, 0xBE, 0x08, 0xF0, 0x15, 0x03, 0x64, 0x42, 0x4A, 0xD3, + 0x09, 0xF2, 0xDC, 0x83, 0xA2, 0xDD, 0x25, 0x43, 0x09, 0xFC, 0x63, 0x46, 0x27, 0x43, 0x0A, 0xFC, + 0x09, 0xFA, 0x08, 0xF8, 0x00, 0xA8, 0x66, 0x43, 0x03, 0x02, 0x64, 0x44, 0x58, 0xDD, 0x03, 0x00, + 0x60, 0x46, 0x25, 0x44, 0x0A, 0xFA, 0x4C, 0x01, 0x27, 0x43, 0xE3, 0x81, 0xE9, 0x81, 0x03, 0x05, + 0x16, 0x03, 0x00, 0x61, 0x01, 0x00, 0xE4, 0x63, 0x61, 0x46, 0xBF, 0xD2, 0x27, 0x45, 0xDC, 0x84, + 0xA2, 0xDA, 0xA3, 0xD2, 0x25, 0x46, 0x88, 0xF8, 0x04, 0x1B, 0x25, 0x44, 0x61, 0x46, 0xBE, 0xDA, + 0x04, 0x00, 0x09, 0xFA, 0x60, 0x46, 0x25, 0x44, 0x0A, 0xFA, 0x61, 0x46, 0xA3, 0xDA, 0x2F, 0x58, + 0xFF, 0xFF, 0xA0, 0xFE, 0x07, 0x05, 0xA3, 0xFE, 0x07, 0x05, 0xA1, 0xFE, 0x52, 0x05, 0x60, 0x64, + 0x3B, 0xDB, 0x12, 0x00, 0x20, 0x58, 0xFF, 0xFF, 0x4F, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0x1C, 0x60, + 0xB8, 0x63, 0xA3, 0xD3, 0xFF, 0xFF, 0xFB, 0xB4, 0xA3, 0xDB, 0xA0, 0x4C, 0x59, 0xBC, 0xFF, 0xB4, + 0xA0, 0x51, 0xA0, 0x4C, 0x7D, 0xB4, 0xA0, 0x51, 0xA1, 0xFF, 0xFF, 0xFF, 0x83, 0x3E, 0x40, 0x60, + 0x0B, 0x65, 0x2B, 0x44, 0x00, 0x63, 0xE8, 0x80, 0xF8, 0x84, 0x02, 0x24, 0x94, 0x84, 0xF3, 0x83, + 0xCD, 0x81, 0xFF, 0xFF, 0xF8, 0x02, 0xDF, 0x83, 0x2F, 0x58, 0x40, 0x4B, 0x00, 0x62, 0x01, 0x64, + 0xD4, 0x80, 0xE0, 0x84, 0x1A, 0x03, 0xD4, 0x80, 0xE0, 0x84, 0x15, 0x03, 0x61, 0x44, 0x11, 0x61, + 0xE0, 0x84, 0xCD, 0x81, 0xFD, 0x04, 0x01, 0x00, 0xE0, 0x84, 0xF2, 0x82, 0xFF, 0xFF, 0x02, 0x24, + 0xC6, 0x82, 0x02, 0x28, 0xD6, 0x82, 0xE2, 0x80, 0xCD, 0x81, 0x02, 0x28, 0x01, 0xBC, 0xF4, 0x02, + 0x01, 0x2A, 0xC6, 0x82, 0x03, 0x00, 0xE9, 0x81, 0xF2, 0x82, 0x61, 0x44, 0x2D, 0x58, 0xFF, 0xFF, + 0x00, 0xA8, 0x10, 0x61, 0x04, 0x03, 0xF0, 0x84, 0xCD, 0x81, 0xFD, 0x04, 0x61, 0x44, 0x2D, 0x58, + 0xFF, 0xFF, 0x00, 0x64, 0x3B, 0xDB, 0x3C, 0x44, 0xAC, 0x80, 0xFF, 0xFF, 0xBD, 0x02, 0x8B, 0xF3, + 0x8C, 0xF3, 0x02, 0xA8, 0x02, 0xA8, 0x08, 0x02, 0x00, 0x64, 0x8D, 0xFB, 0x8B, 0xFB, 0x8C, 0xFB, + 0x00, 0x64, 0x8E, 0xFB, 0xCA, 0xFE, 0x2D, 0x00, 0x03, 0x02, 0x00, 0x64, 0x8C, 0xFB, 0xCA, 0xFE, + 0x01, 0x64, 0x3B, 0xDB, 0x24, 0x60, 0x28, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, + 0x14, 0x03, 0xDC, 0xF3, 0x2A, 0xF2, 0xFD, 0xA0, 0x60, 0x40, 0x80, 0x3A, 0x29, 0x00, 0x28, 0x02, + 0x9B, 0xFE, 0x26, 0x05, 0x24, 0x60, 0x6E, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xE5, 0x01, 0x8C, 0xF3, 0xFF, 0xFF, 0x01, 0xA8, + 0xFF, 0xFF, 0x07, 0x02, 0x24, 0x60, 0x22, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, + 0x0F, 0x02, 0x86, 0xFF, 0x20, 0x40, 0x52, 0x27, 0x07, 0x00, 0x9A, 0xFE, 0x05, 0x04, 0x9D, 0xFE, + 0x03, 0x04, 0xF1, 0xFE, 0x12, 0x64, 0x3B, 0xDB, 0x84, 0xFF, 0xB0, 0x60, 0x97, 0x78, 0xFF, 0xFF, + 0x66, 0x44, 0xFC, 0xFB, 0x46, 0x5C, 0x2D, 0x60, 0x5A, 0x63, 0xA3, 0xD3, 0xB0, 0x60, 0x58, 0x4D, + 0xD8, 0x78, 0xFF, 0xFF, 0x0D, 0xF2, 0x60, 0x5C, 0x64, 0x5F, 0x0D, 0xFA, 0x11, 0x64, 0x3B, 0xDB, + 0x9D, 0xFE, 0x0B, 0x05, 0x24, 0x60, 0x92, 0x65, 0x08, 0x64, 0xA5, 0xDB, 0xB1, 0x60, 0x4D, 0x64, + 0x4F, 0xFB, 0x2D, 0xFF, 0xB0, 0x60, 0xA4, 0x78, 0xFF, 0xFF, 0x07, 0xF0, 0x00, 0x64, 0xD0, 0x80, + 0xA9, 0xF3, 0x07, 0x02, 0x23, 0xF0, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0xB8, 0x60, 0x36, 0x78, + 0xFF, 0xFF, 0xD0, 0x80, 0xD8, 0xF3, 0x40, 0x03, 0x60, 0x40, 0x03, 0x3A, 0x3D, 0x00, 0x66, 0x41, + 0x64, 0x46, 0x6F, 0xF2, 0x61, 0x46, 0x64, 0x41, 0x4D, 0xF1, 0x60, 0x40, 0x03, 0x3A, 0x34, 0x00, + 0x64, 0x40, 0xFF, 0x22, 0x31, 0x00, 0x05, 0x7E, 0x66, 0x45, 0x61, 0x46, 0x6F, 0xFA, 0x65, 0x46, + 0x07, 0xF0, 0x00, 0x65, 0x65, 0x43, 0x66, 0x41, 0x64, 0x46, 0x70, 0xF2, 0x8C, 0xFA, 0x00, 0xA8, + 0x6F, 0xF2, 0x15, 0x03, 0x60, 0x47, 0xFF, 0xB5, 0x70, 0xF2, 0x00, 0xBB, 0xFF, 0xA0, 0x07, 0x03, + 0x0E, 0x06, 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0x02, 0x02, 0xFB, 0x04, 0x08, 0x00, 0xB9, 0x81, + 0xE8, 0x84, 0xD9, 0x81, 0xFD, 0x04, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, 0x0E, 0xFA, 0x0C, 0xF4, + 0xFF, 0xFF, 0x00, 0x64, 0x4D, 0xFB, 0x4C, 0xFB, 0x07, 0xF0, 0x66, 0x41, 0x64, 0x46, 0x0E, 0xF2, + 0x61, 0x46, 0xFF, 0xFF, 0xF0, 0x7E, 0x4E, 0xFB, 0x2A, 0xF2, 0x00, 0x63, 0x40, 0x47, 0x50, 0x36, + 0x05, 0x00, 0xA4, 0x36, 0x03, 0x00, 0x80, 0x36, 0x01, 0x00, 0x01, 0x63, 0x48, 0xFD, 0x40, 0x47, + 0x08, 0x2A, 0x0A, 0x00, 0x03, 0x2F, 0x08, 0x00, 0x81, 0xF1, 0x2C, 0xF8, 0x82, 0xF1, 0xFF, 0xFF, + 0x2D, 0xF8, 0x83, 0xF1, 0x2E, 0xF8, 0xFF, 0xFF, 0x4A, 0xF3, 0x35, 0xFA, 0x10, 0xA4, 0x4A, 0xFB, + 0x00, 0x64, 0x15, 0xFA, 0x16, 0xFA, 0x0F, 0xFA, 0xFF, 0xFF, 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, + 0x0E, 0xF0, 0x63, 0x46, 0x00, 0x7F, 0x64, 0x5E, 0x4B, 0xFB, 0x64, 0x44, 0x00, 0x7E, 0xDB, 0xFB, + 0x07, 0xF0, 0xA9, 0xF3, 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, 0x03, 0x03, 0xDB, 0xF3, 0xDA, 0xFB, + 0x60, 0x41, 0x03, 0xF2, 0x00, 0xF4, 0x01, 0xF2, 0xFC, 0xA5, 0x00, 0x7F, 0xD4, 0x84, 0x27, 0x45, + 0x3C, 0x46, 0x1A, 0xFA, 0x22, 0x63, 0x7B, 0x60, 0xFF, 0x64, 0xA4, 0x84, 0x03, 0x2B, 0x1C, 0x63, + 0x2A, 0xFA, 0x60, 0x40, 0xA4, 0x36, 0x14, 0x63, 0x43, 0x4C, 0x00, 0x7C, 0x22, 0xF8, 0x64, 0x41, + 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, 0x36, 0xF2, 0x63, 0x46, 0xFF, 0xB4, 0x22, 0xFA, 0x60, 0x40, + 0x00, 0x36, 0x76, 0x00, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x3A, 0xA5, 0x00, 0x03, 0xF2, + 0x00, 0xF4, 0xA0, 0xD2, 0xAA, 0x60, 0xAA, 0x65, 0x5A, 0xD0, 0xD4, 0x80, 0x03, 0x64, 0x0A, 0x02, + 0xD0, 0x80, 0x00, 0x64, 0x5A, 0xD0, 0x06, 0x02, 0xD0, 0x80, 0xF8, 0x7F, 0xD0, 0x80, 0x01, 0x03, + 0x01, 0x02, 0x01, 0x61, 0x62, 0x43, 0x46, 0x43, 0x3C, 0x46, 0x07, 0xF4, 0x36, 0xF2, 0xFF, 0xFF, + 0xA3, 0x46, 0x60, 0x40, 0x22, 0x26, 0x5C, 0x00, 0x60, 0x45, 0x63, 0x42, 0x5A, 0xD0, 0xCD, 0x81, + 0x3C, 0x46, 0x14, 0x02, 0x64, 0x44, 0x88, 0x3A, 0x11, 0x00, 0x8E, 0x3B, 0x0F, 0x00, 0x65, 0x44, + 0x01, 0x26, 0x7A, 0x00, 0x04, 0x26, 0x03, 0x00, 0x10, 0x26, 0x01, 0x00, 0x2D, 0x00, 0xA3, 0x46, + 0x37, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x2B, 0x6F, 0x00, 0x56, 0x00, 0xA3, 0x46, 0x65, 0x44, + 0x01, 0x26, 0x0B, 0x00, 0x04, 0x26, 0x03, 0x00, 0x10, 0x26, 0x01, 0x00, 0x1D, 0x00, 0x37, 0xF2, + 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x27, 0x48, 0x00, 0x17, 0x00, 0xA9, 0xF3, 0xFF, 0xFF, 0x60, 0x46, + 0x36, 0xF2, 0x66, 0x43, 0xFF, 0xB4, 0x3C, 0x46, 0x22, 0xF0, 0x60, 0x47, 0xB0, 0x84, 0x22, 0xFA, + 0x63, 0x46, 0x37, 0xF0, 0x60, 0x40, 0x04, 0x27, 0x03, 0x00, 0x10, 0x27, 0x01, 0x00, 0x04, 0x00, + 0x64, 0x40, 0x80, 0x27, 0x31, 0x00, 0x00, 0x00, 0x3C, 0x46, 0x02, 0x65, 0xB7, 0x60, 0x66, 0x78, + 0xFF, 0xFF, 0xCD, 0x81, 0x63, 0x42, 0x5A, 0xD0, 0x3C, 0x46, 0x26, 0x02, 0x64, 0x44, 0x88, 0x3A, + 0x23, 0x00, 0x77, 0x37, 0x39, 0x00, 0x78, 0x37, 0x37, 0x00, 0x8E, 0x37, 0x35, 0x00, 0xF1, 0x01, + 0x2D, 0x60, 0x52, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, 0x2D, 0x00, 0x07, 0x00, + 0x2D, 0x60, 0x52, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, 0xE2, 0x01, 0x3C, 0x46, + 0x3E, 0xF2, 0x40, 0x60, 0x00, 0x65, 0xF0, 0x84, 0xA4, 0x84, 0x18, 0xFA, 0x2A, 0xF2, 0xBF, 0x60, + 0xFF, 0x65, 0xA4, 0x84, 0x2A, 0xFA, 0x18, 0x00, 0x3C, 0x46, 0x22, 0xF0, 0x80, 0x67, 0xB0, 0x84, + 0xA2, 0xDA, 0xFF, 0xFF, 0x3F, 0xF2, 0x3E, 0xF0, 0x08, 0xA4, 0x60, 0x41, 0x22, 0xF2, 0xFF, 0xFF, + 0x60, 0x40, 0x01, 0x26, 0x03, 0x00, 0x04, 0x26, 0x03, 0x00, 0x06, 0x00, 0x04, 0x2B, 0x04, 0x00, + 0x61, 0x44, 0x64, 0x40, 0x10, 0x26, 0x3F, 0xFA, 0x3C, 0x46, 0x2C, 0xF2, 0x27, 0x40, 0x01, 0x27, + 0x32, 0xF2, 0xD5, 0xF1, 0x60, 0x40, 0x01, 0x26, 0x53, 0x00, 0x09, 0x60, 0x00, 0x64, 0xD0, 0x80, + 0x3F, 0xF2, 0x09, 0x06, 0x2C, 0x45, 0xC4, 0x84, 0xD0, 0x80, 0x40, 0x4A, 0x40, 0x06, 0x60, 0x43, + 0x64, 0x44, 0x54, 0x88, 0x18, 0x00, 0x60, 0x45, 0x28, 0x60, 0x36, 0x64, 0xA0, 0xD3, 0xDB, 0xF3, + 0x00, 0xBC, 0x60, 0x47, 0xEC, 0xA0, 0x33, 0x03, 0x32, 0x07, 0x2C, 0x44, 0xC4, 0x81, 0x02, 0x60, + 0x1C, 0x65, 0x45, 0x4A, 0xD5, 0x80, 0x2C, 0x45, 0x2A, 0x06, 0x27, 0x40, 0x04, 0x27, 0x30, 0x00, + 0x2A, 0x43, 0xD7, 0x85, 0x45, 0x48, 0xD6, 0xF1, 0x0F, 0xF2, 0xD3, 0x80, 0x01, 0x65, 0x01, 0x07, + 0x00, 0x65, 0xB4, 0x84, 0x0F, 0xFA, 0x00, 0x63, 0x3F, 0xF2, 0x28, 0x45, 0x60, 0x41, 0xD4, 0x84, + 0xDF, 0x83, 0xFC, 0x07, 0x14, 0xFC, 0x61, 0x44, 0x01, 0x36, 0x02, 0x00, 0x09, 0x3A, 0x06, 0x00, + 0x28, 0x44, 0x48, 0x88, 0x2A, 0x44, 0xC8, 0x83, 0x43, 0x4A, 0xE5, 0x01, 0x17, 0xFA, 0x04, 0x60, + 0x00, 0x64, 0x27, 0x45, 0xB4, 0x84, 0x2A, 0xFA, 0x28, 0x43, 0x16, 0xFC, 0x0D, 0x00, 0x3F, 0xF2, + 0x2C, 0x45, 0xD6, 0xF1, 0xC4, 0x81, 0xD1, 0x80, 0x0F, 0xF2, 0x01, 0x06, 0x01, 0xBC, 0x0F, 0xFA, + 0x3F, 0xF2, 0x17, 0xFA, 0x01, 0x64, 0x14, 0xFA, 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, 0x0E, 0xF0, + 0x63, 0x46, 0x00, 0x7F, 0x64, 0x5E, 0x4B, 0xFB, 0x64, 0x44, 0x00, 0x7E, 0xDB, 0xFB, 0x7C, 0xF1, + 0x60, 0x43, 0x60, 0x47, 0xD0, 0x80, 0xC0, 0x65, 0x01, 0x06, 0x64, 0x44, 0x0A, 0x36, 0x70, 0x64, + 0x14, 0x36, 0x38, 0x64, 0x37, 0x36, 0x15, 0x64, 0x6E, 0x36, 0x0B, 0x64, 0x44, 0x86, 0x2A, 0xF2, + 0x07, 0xF0, 0x60, 0x40, 0xB0, 0x3A, 0x03, 0x00, 0x40, 0x3B, 0x01, 0x00, 0x12, 0x00, 0x0C, 0xB4, + 0x08, 0x3A, 0x55, 0x00, 0x22, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x2B, 0x50, 0x00, 0x17, 0xF2, + 0x22, 0xF0, 0xFF, 0xFF, 0x64, 0x40, 0x22, 0x22, 0x04, 0x00, 0x00, 0xA8, 0x01, 0xA8, 0x47, 0x03, + 0x46, 0x03, 0x3C, 0x46, 0x2A, 0xF0, 0x40, 0x67, 0xB0, 0x84, 0xA2, 0xDA, 0x60, 0x45, 0x22, 0xF2, + 0xFF, 0xFF, 0x60, 0x43, 0x60, 0x40, 0x01, 0x26, 0x03, 0x00, 0x04, 0x26, 0x0A, 0x00, 0x02, 0x00, + 0x04, 0x27, 0x07, 0x00, 0x65, 0x44, 0x2A, 0x65, 0x60, 0x40, 0x03, 0x2B, 0x24, 0x65, 0x45, 0x4C, + 0x2E, 0x00, 0x65, 0x44, 0x2E, 0x65, 0x60, 0x40, 0x03, 0x2B, 0x28, 0x65, 0x45, 0x4C, 0x07, 0xF0, + 0xA9, 0xF3, 0xFF, 0xFF, 0xD0, 0x80, 0x00, 0x7C, 0x03, 0x03, 0x63, 0x40, 0x01, 0x2A, 0x01, 0x00, + 0x3D, 0xF1, 0x2A, 0xF2, 0xFF, 0xFF, 0x08, 0xB0, 0x3E, 0xF2, 0x19, 0x03, 0x60, 0x47, 0xE8, 0x84, + 0xE8, 0x84, 0xE8, 0x84, 0x03, 0xB4, 0xD0, 0x80, 0xFF, 0xFF, 0x11, 0x03, 0x24, 0x60, 0x6E, 0x62, + 0x24, 0x60, 0x46, 0x64, 0xA2, 0xDB, 0x3C, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0x5C, 0x5C, 0xFC, 0xFC, 0xCE, 0xFE, 0xB0, 0x60, 0xE1, 0x78, 0xFF, 0xFF, 0xDB, 0xF1, + 0x2C, 0x45, 0x64, 0x43, 0x17, 0xF2, 0x4B, 0xF1, 0xC4, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x81, + 0x63, 0x40, 0x37, 0x37, 0xE1, 0x81, 0x64, 0x45, 0xB0, 0x60, 0x58, 0x4D, 0xB6, 0x78, 0xFF, 0xFF, + 0xAE, 0x82, 0xFC, 0xA2, 0x0A, 0x03, 0x63, 0x40, 0x6E, 0x3B, 0x06, 0x00, 0x60, 0x41, 0x04, 0x0D, + 0x63, 0x44, 0x80, 0x7E, 0xDB, 0xFB, 0x61, 0x44, 0xDC, 0x84, 0x2B, 0xF0, 0x1B, 0xFA, 0x64, 0x44, + 0x80, 0x27, 0x34, 0x00, 0x16, 0xF2, 0x0F, 0xF0, 0xAC, 0x84, 0x2C, 0x45, 0x29, 0x03, 0x4B, 0xF1, + 0xC4, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x81, 0x63, 0x40, 0x37, 0x37, 0xE1, 0x81, 0x64, 0x45, + 0x0F, 0xF0, 0xB0, 0x60, 0x58, 0x4D, 0xB6, 0x78, 0xFF, 0xFF, 0xAE, 0x82, 0xFC, 0xA2, 0x0A, 0x03, + 0x63, 0x40, 0x6E, 0x3B, 0x06, 0x00, 0x60, 0x41, 0x04, 0x0D, 0x80, 0x67, 0xB0, 0x84, 0x0F, 0xFA, + 0x61, 0x44, 0xDC, 0x84, 0x1D, 0xFA, 0xDE, 0x65, 0xC4, 0x85, 0x26, 0x41, 0xE1, 0x81, 0xC5, 0x84, + 0x2B, 0xFA, 0x1B, 0xF0, 0xDE, 0x64, 0xC0, 0x85, 0x26, 0x44, 0xE0, 0x84, 0xC4, 0x84, 0x10, 0xFA, + 0x26, 0x44, 0x2C, 0xF0, 0x0A, 0xA4, 0x64, 0x40, 0x01, 0x26, 0x00, 0x64, 0x11, 0xFA, 0xDB, 0xF3, + 0x13, 0xFA, 0xFF, 0xFF, 0x0D, 0xF2, 0x3E, 0xF0, 0x60, 0x47, 0xFF, 0xB4, 0x64, 0x41, 0x01, 0xB1, + 0x01, 0x63, 0x1D, 0x02, 0x60, 0x41, 0xFF, 0x22, 0x04, 0x00, 0xB0, 0x60, 0x58, 0x4F, 0xA7, 0x78, + 0xFF, 0xFF, 0x0F, 0x60, 0x92, 0x64, 0xA0, 0xDD, 0x2D, 0x60, 0x5A, 0x62, 0xA2, 0xD3, 0xB0, 0x60, + 0x58, 0x4D, 0xD8, 0x78, 0xFF, 0xFF, 0x60, 0x41, 0x01, 0x63, 0x61, 0x40, 0xFF, 0x22, 0x04, 0x00, + 0xB0, 0x60, 0x58, 0x4F, 0xA7, 0x78, 0xFF, 0xFF, 0x0F, 0x60, 0x94, 0x64, 0xA0, 0xDD, 0x2A, 0xF2, + 0xFF, 0xFF, 0x60, 0x40, 0x40, 0x27, 0x03, 0x00, 0xB5, 0x60, 0x19, 0x78, 0xFF, 0xFF, 0x22, 0xF2, + 0x46, 0x43, 0x60, 0x40, 0x22, 0x26, 0x8B, 0x00, 0x01, 0x26, 0x05, 0x00, 0x04, 0x26, 0x0C, 0x00, + 0xB5, 0x60, 0x19, 0x78, 0xFF, 0xFF, 0x04, 0x27, 0x03, 0x00, 0xB5, 0x60, 0x19, 0x78, 0xFF, 0xFF, + 0xA9, 0xF3, 0xFF, 0xFF, 0x60, 0x46, 0x02, 0x00, 0x07, 0xF4, 0xFF, 0xFF, 0xA3, 0x46, 0x2A, 0xF2, + 0xA3, 0x46, 0x60, 0x40, 0x08, 0x27, 0x3B, 0x00, 0xA9, 0xF3, 0x66, 0x5C, 0xD0, 0x80, 0x37, 0xF0, + 0x08, 0x03, 0x64, 0x40, 0x10, 0x2A, 0x12, 0x00, 0xFF, 0x60, 0xEF, 0x64, 0xA0, 0x84, 0x37, 0xFA, + 0x24, 0x00, 0x3D, 0xF3, 0x01, 0x61, 0x60, 0x43, 0xCF, 0x83, 0xE1, 0x81, 0xFD, 0x0D, 0xE9, 0x81, + 0xA1, 0x80, 0xFF, 0xFF, 0x03, 0x03, 0x91, 0x84, 0x37, 0xFA, 0x17, 0x00, 0x47, 0xF2, 0xFF, 0xFF, + 0x10, 0xA0, 0xFF, 0xFF, 0x02, 0x04, 0xFF, 0x60, 0xFF, 0x64, 0xDC, 0x84, 0x47, 0xFA, 0x46, 0xF2, + 0x16, 0x04, 0xDC, 0x84, 0x46, 0xFA, 0x45, 0xF2, 0x08, 0x04, 0xDC, 0x84, 0x45, 0xFA, 0x05, 0x04, + 0x37, 0xF2, 0xFF, 0xFF, 0xE0, 0x84, 0xE8, 0x84, 0x37, 0xFA, 0x0D, 0x60, 0x3E, 0x62, 0x80, 0xFF, + 0x78, 0x44, 0x03, 0xA4, 0xA2, 0xDB, 0xBE, 0x60, 0x66, 0x78, 0xFF, 0xFF, 0x84, 0xFF, 0x0D, 0x60, + 0x3E, 0x62, 0x80, 0xFF, 0x78, 0x44, 0x03, 0xA4, 0xA2, 0xDB, 0xBE, 0x60, 0xDE, 0x78, 0xFF, 0xFF, + 0x84, 0xFF, 0xA9, 0xF3, 0x66, 0x5C, 0xD0, 0x80, 0x00, 0x7C, 0x07, 0x03, 0x66, 0x43, 0x3C, 0x46, + 0x22, 0xF2, 0x63, 0x46, 0x60, 0x40, 0x01, 0x2A, 0x01, 0x00, 0x3C, 0xF1, 0x47, 0xF0, 0x64, 0x41, + 0x64, 0x47, 0xFF, 0xB4, 0x60, 0x5F, 0x20, 0xBC, 0x80, 0x26, 0x80, 0xAC, 0x60, 0x47, 0xA3, 0x46, + 0x3A, 0xFA, 0x64, 0x44, 0x20, 0x7F, 0x34, 0x94, 0x3B, 0xFA, 0xA3, 0x46, 0x46, 0xF2, 0x45, 0xF0, + 0xA3, 0x46, 0x3C, 0xFA, 0x3D, 0xF8, 0x08, 0x60, 0x00, 0xEA, 0x0F, 0x64, 0x60, 0x7F, 0xA0, 0x5A, + 0x80, 0x60, 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, 0xD1, 0x60, 0x00, 0xEA, 0x8A, 0x00, 0x2A, 0xF2, + 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x27, 0x35, 0x00, 0x2A, 0xF2, 0x00, 0x60, 0x7C, 0x62, 0x60, 0x40, + 0x40, 0x2B, 0x27, 0x00, 0xA2, 0xD3, 0x00, 0x61, 0x60, 0xFE, 0xA0, 0xD3, 0xDE, 0x82, 0xA2, 0xD1, + 0xFF, 0xFF, 0x20, 0xFE, 0x64, 0x5F, 0xDC, 0x84, 0xF1, 0x81, 0xC0, 0x2B, 0x04, 0x00, 0x80, 0x2A, + 0x02, 0x00, 0x7F, 0xA4, 0xDC, 0x84, 0xFF, 0x3B, 0x03, 0x00, 0x60, 0x47, 0xDC, 0x87, 0x01, 0x61, + 0xC0, 0x80, 0x00, 0x36, 0xDC, 0x84, 0x4E, 0xDB, 0x60, 0xFE, 0xDA, 0x82, 0xA2, 0xD1, 0xFF, 0xFF, + 0xC1, 0x84, 0xF0, 0x22, 0x10, 0xA4, 0xF0, 0x2A, 0x01, 0x00, 0x00, 0x64, 0xA2, 0xDB, 0xFF, 0xFF, + 0x20, 0xFE, 0x00, 0x60, 0x7C, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xA0, 0xD3, 0x5A, 0xD1, 0x3A, 0xFA, + 0x3B, 0xF8, 0x74, 0x62, 0xA2, 0xD0, 0xFF, 0xFF, 0x64, 0x44, 0xE0, 0x7F, 0xA0, 0x5A, 0x64, 0x47, + 0xE1, 0x7F, 0x5A, 0xD0, 0xA0, 0x5A, 0x64, 0x44, 0xE2, 0x7F, 0xA0, 0x5A, 0x00, 0x60, 0x80, 0x62, + 0xA2, 0xD3, 0xFF, 0xFF, 0xA0, 0xD1, 0x5A, 0xD1, 0x64, 0x45, 0x64, 0x44, 0xE3, 0x7F, 0xA0, 0x5A, + 0x64, 0x47, 0xE4, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xE5, 0x7F, 0xA0, 0x5A, 0x64, 0x47, + 0xE6, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xE7, 0x7F, 0xA0, 0x5A, 0x65, 0x40, 0x0D, 0x3A, + 0x1C, 0x00, 0x64, 0x47, 0xE8, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xE9, 0x7F, 0xA0, 0x5A, + 0x64, 0x47, 0xEA, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xEB, 0x7F, 0xA0, 0x5A, 0x64, 0x47, + 0xEC, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xED, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xEE, 0x7F, + 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xEF, 0x7F, 0xA0, 0x5A, 0x08, 0x60, 0x00, 0xEA, 0x65, 0x44, + 0x02, 0xA4, 0x60, 0x7F, 0xA0, 0x5A, 0x80, 0x60, 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, 0xD1, 0x60, + 0x00, 0xEA, 0x02, 0x64, 0x3B, 0xDB, 0xB8, 0x60, 0xBE, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0xFC, 0xFB, + 0x07, 0xF0, 0x00, 0x64, 0xD0, 0x80, 0xA9, 0xF3, 0x17, 0x03, 0xD0, 0x80, 0x66, 0x41, 0x64, 0x46, + 0x6F, 0xF2, 0x61, 0x46, 0x7B, 0x03, 0x60, 0x40, 0x00, 0x36, 0x78, 0x00, 0x47, 0xF1, 0x07, 0xF0, + 0x64, 0x40, 0x02, 0x26, 0x01, 0x00, 0x0B, 0x00, 0x03, 0x12, 0xB6, 0x60, 0x38, 0x78, 0xFF, 0xFF, + 0xFC, 0x0A, 0xB7, 0x60, 0x56, 0x78, 0xFF, 0xFF, 0xB7, 0x60, 0x56, 0x78, 0xFF, 0xFF, 0x66, 0x41, + 0x64, 0x46, 0x0E, 0xF2, 0x60, 0x45, 0x61, 0x46, 0x10, 0x7E, 0x4E, 0xFB, 0x65, 0x44, 0x60, 0x40, + 0x01, 0x36, 0x5C, 0x00, 0x02, 0x36, 0x5D, 0x00, 0x03, 0x36, 0x34, 0x00, 0x04, 0x36, 0x45, 0x00, + 0x67, 0x00, 0x00, 0x64, 0x4C, 0xFB, 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, 0xFF, 0xFF, 0x05, 0x7E, + 0x6F, 0xFA, 0x61, 0x46, 0x00, 0x65, 0x65, 0x43, 0x66, 0x41, 0x64, 0x46, 0x70, 0xF2, 0x8C, 0xFA, + 0x00, 0xA8, 0x6F, 0xF2, 0x15, 0x03, 0x60, 0x47, 0xFF, 0xB5, 0x70, 0xF2, 0x00, 0xBB, 0xFF, 0xA0, + 0x07, 0x03, 0x0E, 0x06, 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0x02, 0x02, 0xFB, 0x04, 0x08, 0x00, + 0xB9, 0x81, 0xE8, 0x84, 0xD9, 0x81, 0xFD, 0x04, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, 0x0E, 0xFA, + 0x0C, 0xF4, 0xFF, 0xFF, 0x66, 0x41, 0x64, 0x46, 0x0E, 0xF2, 0x61, 0x46, 0xFF, 0xFF, 0xA0, 0x7E, + 0x4E, 0xFB, 0x24, 0x00, 0x4C, 0xF3, 0xFF, 0xFF, 0xDC, 0x84, 0x4C, 0xFB, 0xCB, 0xF3, 0x60, 0x45, + 0xD4, 0x80, 0xFF, 0xFF, 0x1B, 0x02, 0x24, 0x60, 0xA6, 0x62, 0x0F, 0x60, 0x96, 0x64, 0xA2, 0xDB, + 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0xBC, 0x01, 0x4C, 0xF3, 0x66, 0x41, 0xDC, 0x84, + 0x4C, 0xFB, 0x64, 0x46, 0x6F, 0xF2, 0xFF, 0xFF, 0x03, 0x7E, 0x6F, 0xFA, 0x61, 0x46, 0x66, 0x41, + 0x64, 0x46, 0x0E, 0xF2, 0x61, 0x46, 0xFF, 0xFF, 0xA4, 0x7E, 0x4E, 0xFB, 0xB7, 0x60, 0x56, 0x78, + 0xFF, 0xFF, 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, 0xFF, 0xFF, 0x01, 0x7E, 0x6F, 0xFA, 0x61, 0x46, + 0x66, 0x41, 0x64, 0x46, 0x0E, 0xF2, 0x61, 0x46, 0xFF, 0xFF, 0xA8, 0x7E, 0x4E, 0xFB, 0xEE, 0x01, + 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, 0x8C, 0xFA, 0x60, 0x47, 0x70, 0xF2, 0xFF, 0xB5, 0x08, 0x18, + 0xE4, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0x03, 0x02, 0xFB, 0x04, 0x01, 0x64, 0x01, 0x00, 0x00, 0x64, + 0x0C, 0xF4, 0x00, 0xA8, 0xFF, 0xFF, 0xDD, 0x02, 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, 0xFF, 0xFF, + 0x60, 0x47, 0x70, 0xF2, 0xFF, 0xB5, 0x61, 0x46, 0x00, 0xA8, 0xFF, 0xFF, 0x29, 0x03, 0xE0, 0x84, + 0xA4, 0x80, 0xFF, 0xFF, 0xFC, 0x03, 0x66, 0x41, 0x64, 0x46, 0x70, 0xFA, 0x61, 0x46, 0x01, 0x65, + 0x65, 0x43, 0x66, 0x41, 0x64, 0x46, 0x70, 0xF2, 0x8C, 0xFA, 0x00, 0xA8, 0x6F, 0xF2, 0x15, 0x03, + 0x60, 0x47, 0xFF, 0xB5, 0x70, 0xF2, 0x00, 0xBB, 0xFF, 0xA0, 0x07, 0x03, 0x0E, 0x06, 0xE8, 0x84, + 0xA4, 0x80, 0xFF, 0xFF, 0x02, 0x02, 0xFB, 0x04, 0x08, 0x00, 0xB9, 0x81, 0xE8, 0x84, 0xD9, 0x81, + 0xFD, 0x04, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, 0x0E, 0xFA, 0x0C, 0xF4, 0xFF, 0xFF, 0x95, 0x01, + 0x94, 0x01, 0x65, 0x44, 0x60, 0x40, 0x01, 0x36, 0xA1, 0x01, 0x02, 0x36, 0x01, 0x00, 0x9E, 0x01, + 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, 0xFF, 0xFF, 0x01, 0x7E, 0x6F, 0xFA, 0x61, 0x46, 0x00, 0x65, + 0x65, 0x43, 0x66, 0x41, 0x64, 0x46, 0x70, 0xF2, 0x8C, 0xFA, 0x00, 0xA8, 0x6F, 0xF2, 0x15, 0x03, + 0x60, 0x47, 0xFF, 0xB5, 0x70, 0xF2, 0x00, 0xBB, 0xFF, 0xA0, 0x07, 0x03, 0x0E, 0x06, 0xE8, 0x84, + 0xA4, 0x80, 0xFF, 0xFF, 0x02, 0x02, 0xFB, 0x04, 0x08, 0x00, 0xB9, 0x81, 0xE8, 0x84, 0xD9, 0x81, + 0xFD, 0x04, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, 0x0E, 0xFA, 0x0C, 0xF4, 0xFF, 0xFF, 0x66, 0x41, + 0x64, 0x46, 0x0E, 0xF2, 0x61, 0x46, 0xD0, 0x7E, 0x4E, 0xFB, 0xB7, 0x60, 0x56, 0x78, 0xFF, 0xFF, + 0x60, 0x45, 0x66, 0x41, 0x64, 0x46, 0x0E, 0xF2, 0x61, 0x46, 0x20, 0x7E, 0x4E, 0xFB, 0x65, 0x44, + 0x60, 0x40, 0x01, 0x36, 0x0B, 0x00, 0x02, 0x36, 0x1A, 0x00, 0x03, 0x36, 0x53, 0x00, 0x04, 0x36, + 0x70, 0x00, 0x05, 0x36, 0x14, 0x00, 0xB7, 0x60, 0x56, 0x78, 0xFF, 0xFF, 0x07, 0xF0, 0x66, 0x41, + 0x64, 0x46, 0x6F, 0xF2, 0xFF, 0xFF, 0x02, 0x7E, 0x6F, 0xFA, 0x61, 0x46, 0x66, 0x41, 0x64, 0x46, + 0x0E, 0xF2, 0x61, 0x46, 0xB0, 0x7E, 0x4E, 0xFB, 0xB7, 0x60, 0x56, 0x78, 0xFF, 0xFF, 0x07, 0xF0, + 0x01, 0x65, 0x65, 0x43, 0x66, 0x41, 0x64, 0x46, 0x70, 0xF2, 0x8C, 0xFA, 0x00, 0xA8, 0x6F, 0xF2, + 0x15, 0x03, 0x60, 0x47, 0xFF, 0xB5, 0x70, 0xF2, 0x00, 0xBB, 0xFF, 0xA0, 0x07, 0x03, 0x0E, 0x06, + 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0x02, 0x02, 0xFB, 0x04, 0x08, 0x00, 0xB9, 0x81, 0xE8, 0x84, + 0xD9, 0x81, 0xFD, 0x04, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, 0x0E, 0xFA, 0x0C, 0xF4, 0xFF, 0xFF, + 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, 0x00, 0x63, 0x03, 0x7E, 0x6F, 0xFA, 0x61, 0x46, 0x4C, 0xFD, + 0x66, 0x41, 0x64, 0x46, 0x0E, 0xF2, 0x61, 0x46, 0xB4, 0x7E, 0x4E, 0xFB, 0x24, 0x60, 0xA6, 0x62, + 0x0F, 0x60, 0x96, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0xB7, 0x60, + 0x56, 0x78, 0xFF, 0xFF, 0x66, 0x41, 0x64, 0x46, 0x70, 0xF2, 0x4C, 0xF3, 0x02, 0xB0, 0x61, 0x46, + 0xCC, 0x84, 0x05, 0x03, 0x04, 0x28, 0x4C, 0xFB, 0xB7, 0x60, 0x56, 0x78, 0xFF, 0xFF, 0x04, 0x28, + 0x4C, 0xFB, 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, 0xFF, 0xFF, 0x04, 0x7E, 0x6F, 0xFA, 0x61, 0x46, + 0x66, 0x41, 0x64, 0x46, 0x0E, 0xF2, 0x61, 0x46, 0xB8, 0x7E, 0x4E, 0xFB, 0xB7, 0x60, 0x56, 0x78, + 0xFF, 0xFF, 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, 0xFF, 0xFF, 0x60, 0x47, 0xFF, 0xB5, 0x70, 0xF2, + 0x61, 0x46, 0xFF, 0xA0, 0xFF, 0xFF, 0x35, 0x06, 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0x02, 0x02, + 0xFB, 0x04, 0x2F, 0x00, 0x64, 0x46, 0x70, 0xFA, 0x01, 0x65, 0x65, 0x43, 0x66, 0x41, 0x64, 0x46, + 0x70, 0xF2, 0x8C, 0xFA, 0x00, 0xA8, 0x6F, 0xF2, 0x15, 0x03, 0x60, 0x47, 0xFF, 0xB5, 0x70, 0xF2, + 0x00, 0xBB, 0xFF, 0xA0, 0x07, 0x03, 0x0E, 0x06, 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0x02, 0x02, + 0xFB, 0x04, 0x08, 0x00, 0xB9, 0x81, 0xE8, 0x84, 0xD9, 0x81, 0xFD, 0x04, 0x0F, 0x60, 0xA2, 0x65, + 0x45, 0xD3, 0x0E, 0xFA, 0x0C, 0xF4, 0xFF, 0xFF, 0x6F, 0xF2, 0x00, 0x63, 0x03, 0x7E, 0x6F, 0xFA, + 0x3C, 0x46, 0x4C, 0xFD, 0x66, 0x41, 0x64, 0x46, 0x0E, 0xF2, 0x61, 0x46, 0xC0, 0x7E, 0x4E, 0xFB, + 0x5D, 0x00, 0x5C, 0x00, 0x65, 0x44, 0x60, 0x40, 0x01, 0x36, 0x03, 0x00, 0x02, 0x36, 0x18, 0x00, + 0x55, 0x00, 0x66, 0x41, 0x64, 0x46, 0x70, 0xF2, 0x61, 0x46, 0x01, 0xB0, 0xFF, 0xFF, 0x4E, 0x02, + 0x07, 0xF0, 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, 0xFF, 0xFF, 0x02, 0x7E, 0x6F, 0xFA, 0x61, 0x46, + 0x66, 0x41, 0x64, 0x46, 0x0E, 0xF2, 0x61, 0x46, 0xE0, 0x7E, 0x4E, 0xFB, 0x3F, 0x00, 0x3E, 0x00, + 0x07, 0xF0, 0x66, 0x41, 0x64, 0x46, 0x6F, 0xF2, 0xFF, 0xFF, 0x01, 0x7E, 0x6F, 0xFA, 0x60, 0x47, + 0xFF, 0xB5, 0x70, 0xF2, 0x61, 0x46, 0xFF, 0xA0, 0xFF, 0xFF, 0xF1, 0x06, 0xE8, 0x84, 0xA4, 0x80, + 0xFF, 0xFF, 0x02, 0x02, 0xFB, 0x04, 0xEB, 0x01, 0x66, 0x41, 0x64, 0x46, 0x70, 0xFA, 0x61, 0x46, + 0x00, 0x65, 0x65, 0x43, 0x66, 0x41, 0x64, 0x46, 0x70, 0xF2, 0x8C, 0xFA, 0x00, 0xA8, 0x6F, 0xF2, + 0x15, 0x03, 0x60, 0x47, 0xFF, 0xB5, 0x70, 0xF2, 0x00, 0xBB, 0xFF, 0xA0, 0x07, 0x03, 0x0E, 0x06, + 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0x02, 0x02, 0xFB, 0x04, 0x08, 0x00, 0xB9, 0x81, 0xE8, 0x84, + 0xD9, 0x81, 0xFD, 0x04, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, 0x0E, 0xFA, 0x0C, 0xF4, 0xFF, 0xFF, + 0x66, 0x41, 0x64, 0x46, 0x0E, 0xF2, 0x61, 0x46, 0xE4, 0x7E, 0x4E, 0xFB, 0x03, 0x64, 0x3B, 0xDB, + 0xCA, 0xFE, 0x47, 0xF1, 0x01, 0x65, 0x32, 0x40, 0x04, 0x27, 0x08, 0x00, 0x2C, 0xF2, 0x64, 0x45, + 0x02, 0x22, 0x04, 0x00, 0x60, 0x40, 0x01, 0x26, 0x01, 0x00, 0xE3, 0x00, 0x14, 0xF2, 0x65, 0x40, + 0x01, 0x26, 0x1D, 0x00, 0x60, 0x45, 0x05, 0x64, 0x3B, 0xDB, 0x65, 0x44, 0xCC, 0x85, 0xB8, 0xF1, + 0x27, 0x60, 0x78, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xD8, 0x80, 0xC4, 0x84, 0x0B, 0x03, 0x07, 0x05, + 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x09, 0x04, 0xC6, 0xFE, 0x07, 0x00, 0x00, 0x64, + 0xB8, 0x84, 0xA2, 0xDB, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0xAF, 0x00, 0x60, 0x41, + 0x2A, 0xF0, 0x00, 0x60, 0x0C, 0x64, 0xA0, 0x84, 0x04, 0x36, 0x02, 0x00, 0x0C, 0x3A, 0x01, 0x00, + 0xA5, 0x00, 0x61, 0x45, 0x60, 0x41, 0xB8, 0xF1, 0x27, 0x60, 0x78, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, + 0xD8, 0x80, 0xC4, 0x84, 0x0B, 0x03, 0x07, 0x05, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, + 0x09, 0x04, 0xC6, 0xFE, 0x07, 0x00, 0x00, 0x64, 0xB8, 0x84, 0xA2, 0xDB, 0x8A, 0xFF, 0x20, 0x60, + 0x00, 0x75, 0x88, 0xFF, 0x61, 0x40, 0x08, 0x36, 0x01, 0x00, 0x88, 0x00, 0x14, 0xF2, 0x1C, 0x65, + 0x60, 0x41, 0x00, 0x63, 0xCD, 0x81, 0xC7, 0x83, 0xFD, 0x02, 0x3F, 0xF0, 0x2C, 0xF2, 0xC3, 0x83, + 0x60, 0x40, 0x01, 0x2A, 0x29, 0x00, 0xB8, 0xF1, 0x27, 0x60, 0x76, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, + 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, + 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0xB8, 0xF1, 0x27, 0x60, 0x7C, 0x64, 0xA0, 0xD3, + 0x63, 0x45, 0xD8, 0x80, 0xC4, 0x84, 0x0B, 0x03, 0x07, 0x05, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, + 0xA2, 0xDB, 0x09, 0x04, 0xC6, 0xFE, 0x07, 0x00, 0x00, 0x64, 0xB8, 0x84, 0xA2, 0xDB, 0x8A, 0xFF, + 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x52, 0x00, 0xB8, 0xF1, 0x27, 0x60, 0x74, 0x64, 0xA0, 0xD3, + 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, + 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0xB8, 0xF1, 0x27, 0x60, 0x7A, 0x64, + 0xA0, 0xD3, 0x63, 0x45, 0xD8, 0x80, 0xC4, 0x84, 0x0B, 0x03, 0x07, 0x05, 0xDC, 0x80, 0xD0, 0x80, + 0x04, 0x03, 0xA2, 0xDB, 0x09, 0x04, 0xC6, 0xFE, 0x07, 0x00, 0x00, 0x64, 0xB8, 0x84, 0xA2, 0xDB, + 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x15, 0xF2, 0xFF, 0xFF, 0x0F, 0xB4, 0x00, 0xA8, + 0x01, 0xA8, 0x24, 0x03, 0x12, 0x03, 0xB8, 0xF1, 0x27, 0x60, 0x82, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, + 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, + 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x11, 0x00, 0xB8, 0xF1, 0x27, 0x60, 0x80, 0x64, + 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, + 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x04, 0x64, 0x3B, 0xDB, + 0x24, 0x60, 0x6E, 0x62, 0x24, 0x60, 0x46, 0x64, 0xA2, 0xDB, 0x3C, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x5C, 0x5C, 0xFC, 0xFC, 0xCE, 0xFE, 0xB0, 0x60, 0xE1, 0x78, + 0xFF, 0xFF, 0x0F, 0xF0, 0x15, 0xF2, 0x64, 0x41, 0x01, 0x2A, 0x02, 0x00, 0xD1, 0xF1, 0x02, 0x00, + 0xD0, 0xF1, 0xFF, 0xFF, 0x64, 0x45, 0xDC, 0x84, 0xD4, 0x80, 0x15, 0xFA, 0x30, 0x07, 0x61, 0x40, + 0x01, 0x2A, 0x09, 0x00, 0x27, 0x60, 0xA8, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xFF, 0xFF, + 0x08, 0x28, 0xA2, 0xDB, 0x08, 0x00, 0x27, 0x60, 0xAA, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, + 0xFF, 0xFF, 0x08, 0x28, 0xA2, 0xDB, 0x2A, 0xF0, 0x08, 0x67, 0xB0, 0x84, 0xA2, 0xDA, 0x00, 0x64, + 0x48, 0xFB, 0x2D, 0x60, 0x52, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, 0x0C, 0x00, + 0x3C, 0x46, 0x3E, 0xF2, 0x40, 0x60, 0x00, 0x65, 0xF0, 0x84, 0xA4, 0x84, 0x18, 0xFA, 0x2A, 0xF2, + 0xBF, 0x60, 0xFF, 0x65, 0xA4, 0x84, 0x2A, 0xFA, 0xB2, 0x60, 0xFC, 0x78, 0xFF, 0xFF, 0x00, 0x64, + 0x49, 0xFB, 0xB8, 0xF1, 0x27, 0x60, 0x82, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, + 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, + 0x00, 0x75, 0x88, 0xFF, 0xB8, 0xF1, 0x27, 0x60, 0x84, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, + 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, + 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x2D, 0x60, 0x5A, 0x63, 0xA3, 0xD3, 0xB0, 0x60, 0x58, 0x4D, + 0xD8, 0x78, 0xFF, 0xFF, 0x0D, 0xF2, 0x60, 0x5C, 0x64, 0x5F, 0x0D, 0xFA, 0x23, 0xF0, 0x01, 0x64, + 0xB0, 0x84, 0xA2, 0xDA, 0x7B, 0x01, 0xB9, 0x60, 0x43, 0x78, 0xFF, 0xFF, 0x21, 0x64, 0x3B, 0xDB, + 0x31, 0xF3, 0x01, 0x63, 0xC4, 0xB4, 0x31, 0xFB, 0x32, 0xFD, 0xB8, 0x60, 0xEF, 0x62, 0x42, 0x40, + 0xA0, 0x4C, 0x40, 0xBC, 0x7D, 0xB4, 0xA0, 0x51, 0xA0, 0xFE, 0x1A, 0xFF, 0x24, 0x60, 0x3A, 0x64, + 0x08, 0xF0, 0x07, 0xF0, 0xD0, 0x80, 0x24, 0x60, 0x40, 0x62, 0x14, 0x02, 0xA2, 0xD3, 0x01, 0x63, + 0xAC, 0x86, 0x07, 0xF2, 0x0F, 0x03, 0xD0, 0x80, 0x09, 0xF2, 0xFA, 0x02, 0x23, 0xFC, 0x24, 0x60, + 0x6E, 0x62, 0x24, 0x60, 0x46, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0x3C, 0x46, 0x06, 0x64, 0xA1, 0xFF, 0x49, 0xFB, 0x83, 0x3E, 0x31, 0xF3, + 0x87, 0x60, 0x80, 0x61, 0x1D, 0xF0, 0x60, 0x40, 0x01, 0x2A, 0x15, 0x00, 0xFE, 0xB4, 0x31, 0xFB, + 0x00, 0x64, 0x49, 0xFB, 0x01, 0x64, 0x47, 0xFB, 0x2D, 0x60, 0x5A, 0x63, 0xA3, 0xD3, 0xB0, 0x60, + 0x58, 0x4D, 0xD8, 0x78, 0xFF, 0xFF, 0x00, 0x71, 0x64, 0x5F, 0x0D, 0xFA, 0x40, 0x64, 0x3B, 0xDB, + 0xB9, 0x60, 0x43, 0x78, 0xFF, 0xFF, 0x02, 0x2A, 0x1B, 0x00, 0xD1, 0x91, 0x8D, 0xE2, 0x41, 0x64, + 0x3B, 0xDB, 0x31, 0xF3, 0x2D, 0x60, 0x62, 0x63, 0xFD, 0xB4, 0x31, 0xFB, 0xA3, 0xD3, 0xB0, 0x60, + 0x58, 0x4D, 0xD8, 0x78, 0xFF, 0xFF, 0x02, 0x63, 0x60, 0x5C, 0x0D, 0xF2, 0x47, 0xFD, 0xFF, 0xB5, + 0x60, 0x47, 0xD0, 0x80, 0xDC, 0x84, 0x1F, 0x03, 0x60, 0x47, 0xB4, 0x84, 0x0D, 0xFA, 0x1B, 0x00, + 0x08, 0x2A, 0x07, 0x00, 0x42, 0x64, 0x3B, 0xDB, 0x31, 0xF3, 0xFF, 0xFF, 0xF7, 0xB4, 0x31, 0xFB, + 0x12, 0x00, 0x10, 0x2A, 0x09, 0x00, 0x43, 0x64, 0x3B, 0xDB, 0x31, 0xF3, 0xFF, 0xFF, 0xEF, 0xB4, + 0x31, 0xFB, 0xB8, 0x60, 0xBE, 0x78, 0xFF, 0xFF, 0x44, 0x64, 0x3B, 0xDB, 0x31, 0xF3, 0xFF, 0xFF, + 0xDF, 0xB4, 0x31, 0xFB, 0x00, 0x00, 0x2A, 0x64, 0x3B, 0xDB, 0xB0, 0x60, 0x97, 0x64, 0x40, 0x40, + 0xB5, 0x60, 0x1E, 0x78, 0xFF, 0xFF, 0x1C, 0x60, 0xB8, 0x63, 0xA3, 0xD3, 0xFF, 0xFF, 0x02, 0xB5, + 0x04, 0xB5, 0x04, 0x03, 0x03, 0x03, 0xBA, 0x60, 0x3C, 0x78, 0xFF, 0xFF, 0x86, 0xFF, 0x20, 0x44, + 0x84, 0xFF, 0x20, 0x2A, 0x04, 0x00, 0xF3, 0x60, 0x58, 0x4E, 0x14, 0x78, 0xFF, 0xFF, 0x31, 0x40, + 0x01, 0x26, 0x17, 0x00, 0xA0, 0x4C, 0x49, 0xBC, 0xFF, 0xB4, 0xA0, 0x51, 0x1C, 0x60, 0xB8, 0x63, + 0xA3, 0xD3, 0xFF, 0xFF, 0x02, 0xB5, 0x04, 0xBC, 0x09, 0x03, 0x60, 0x40, 0x01, 0x26, 0xED, 0xE2, + 0xFE, 0xB4, 0xA3, 0xDB, 0xA0, 0x4C, 0x7D, 0xB4, 0xA0, 0x51, 0x03, 0x00, 0xA0, 0x4C, 0x6D, 0xB4, + 0xA0, 0x51, 0xDC, 0xF3, 0xFF, 0xFF, 0xFD, 0xA0, 0xFF, 0xFF, 0x48, 0x03, 0x31, 0x40, 0x04, 0x2A, + 0x3E, 0x00, 0x6D, 0xF3, 0x74, 0xF3, 0xCC, 0x83, 0x6D, 0xFD, 0xCC, 0x84, 0x74, 0xFB, 0x1F, 0x02, + 0x31, 0x40, 0x02, 0x2A, 0x12, 0x00, 0x6F, 0xF3, 0x70, 0xF1, 0xCC, 0x84, 0x6F, 0xFB, 0x0D, 0x02, + 0x6F, 0xF9, 0x31, 0x44, 0x08, 0xBC, 0x40, 0x51, 0x72, 0xF3, 0x71, 0xF1, 0x00, 0xB8, 0x64, 0x45, + 0x01, 0x03, 0x67, 0x45, 0x65, 0x50, 0xCC, 0x84, 0x73, 0xFB, 0x28, 0x60, 0x00, 0x64, 0xA0, 0xD3, + 0x6E, 0xF1, 0x00, 0xB8, 0x74, 0xF9, 0x03, 0x03, 0x87, 0xF3, 0x6D, 0xFB, 0x04, 0x00, 0x6D, 0xF3, + 0x87, 0xF1, 0x15, 0x1B, 0x6D, 0xF9, 0x31, 0x40, 0x01, 0x2A, 0x11, 0x00, 0xDD, 0xFE, 0x0F, 0x05, + 0xBA, 0xFE, 0xAD, 0x4F, 0x00, 0x7F, 0x01, 0xBC, 0xA0, 0x5D, 0x00, 0xEE, 0x7F, 0xF1, 0x02, 0x60, + 0xEE, 0x64, 0xA3, 0xFB, 0xA4, 0xF9, 0x04, 0x64, 0xA5, 0xFB, 0xDF, 0xFE, 0x19, 0xFF, 0x1A, 0x60, + 0x42, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xCC, 0x84, 0xFF, 0x2B, 0xA2, 0xDB, 0x31, 0x40, 0x01, 0x2A, + 0x29, 0x00, 0x9D, 0xFE, 0x27, 0x04, 0x26, 0x0A, 0x9F, 0xFE, 0x24, 0x05, 0x85, 0xFF, 0x20, 0x44, + 0x84, 0xFF, 0x40, 0x26, 0x1F, 0x00, 0x3F, 0x40, 0x20, 0x2B, 0x1C, 0x00, 0x38, 0x69, 0xFF, 0xFF, + 0x68, 0x44, 0x01, 0x16, 0xFD, 0x01, 0x01, 0x2A, 0x15, 0x00, 0x27, 0x60, 0xB4, 0x64, 0xA0, 0xD3, + 0xFF, 0xFF, 0xDC, 0x84, 0xFF, 0xFF, 0x08, 0x28, 0xA2, 0xDB, 0x7F, 0xF1, 0x02, 0x60, 0xEE, 0x64, + 0xA3, 0xFB, 0xFF, 0xFF, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA4, 0xFB, 0x04, 0x64, 0xA5, 0xFB, + 0xDF, 0xFE, 0x19, 0xFF, 0x10, 0x64, 0x3B, 0xDB, 0x80, 0xF3, 0x73, 0x45, 0xE0, 0x84, 0xE0, 0x84, + 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x93, 0xC9, 0xFE, 0x49, 0xF3, 0x3C, 0x46, 0x27, 0x18, 0xCC, 0x84, + 0x49, 0xFB, 0x24, 0x02, 0xBB, 0x60, 0x18, 0x64, 0x40, 0x42, 0xFC, 0xFC, 0x00, 0x64, 0x5C, 0x5C, + 0x32, 0xFB, 0x82, 0xFF, 0x5C, 0x47, 0x84, 0xFF, 0x62, 0xFF, 0x27, 0x60, 0xA4, 0x64, 0xA0, 0xD3, + 0xFF, 0xFF, 0xDC, 0x84, 0xFF, 0xFF, 0x08, 0x28, 0xA2, 0xDB, 0x23, 0xF0, 0x01, 0x64, 0xB0, 0x84, + 0xA2, 0xDA, 0x24, 0x60, 0x6E, 0x62, 0x24, 0x60, 0x46, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0xCE, 0xFE, 0x6A, 0xF3, 0xFF, 0xFF, + 0x60, 0x41, 0xFD, 0xB4, 0xA2, 0xDB, 0x61, 0x44, 0x01, 0xB0, 0x02, 0xB0, 0x0C, 0x03, 0x0B, 0x02, + 0x9D, 0xFE, 0x09, 0x04, 0x24, 0x60, 0xA6, 0x62, 0x1A, 0x60, 0xA2, 0x64, 0xA2, 0xDB, 0x02, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x07, 0x00, 0x80, 0xF3, 0x73, 0x45, 0xE0, 0x84, 0xE0, 0x84, + 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x93, 0x1C, 0x60, 0xB4, 0x63, 0xA3, 0xD3, 0xAD, 0x49, 0x20, 0xB5, + 0x08, 0xB1, 0x23, 0x03, 0xE1, 0x81, 0x10, 0xB5, 0x95, 0x81, 0x60, 0x41, 0x18, 0x02, 0x1C, 0x60, + 0xB6, 0x7C, 0xA4, 0xD3, 0xFF, 0xFF, 0xCC, 0x84, 0xA4, 0xDB, 0x17, 0x02, 0x05, 0x64, 0xA4, 0xDB, + 0x61, 0x44, 0x07, 0xB4, 0xFF, 0xFF, 0x11, 0x02, 0x08, 0xB1, 0xE1, 0x81, 0x95, 0x81, 0xA3, 0xD3, + 0x0C, 0x03, 0x08, 0xAC, 0x01, 0xBC, 0xA3, 0xDB, 0xFF, 0xFF, 0x13, 0xFF, 0x06, 0x00, 0x10, 0xAC, + 0xA3, 0xDB, 0x1C, 0x60, 0xB6, 0x63, 0x05, 0x7C, 0xA3, 0xD9, 0xB0, 0x60, 0xA4, 0x78, 0xFF, 0xFF, + 0x46, 0xF3, 0x45, 0xF1, 0x05, 0x1B, 0x64, 0x44, 0x03, 0x1B, 0x0F, 0x60, 0x92, 0x62, 0xA2, 0xD3, + 0x45, 0xFB, 0x00, 0x63, 0x46, 0xFD, 0x60, 0x41, 0x25, 0x64, 0x3B, 0xDB, 0x27, 0x44, 0xEF, 0xB4, + 0x40, 0x47, 0x00, 0xB9, 0x71, 0x40, 0x80, 0x27, 0x01, 0x12, 0x2B, 0x03, 0xBA, 0x60, 0x93, 0x62, + 0x84, 0xFF, 0x42, 0x42, 0x82, 0xFF, 0xA0, 0x4C, 0x14, 0xBC, 0xFF, 0xB4, 0xA0, 0x51, 0x31, 0x0A, + 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, 0x70, 0x44, 0xAC, 0x80, 0x2B, 0x0A, 0x71, 0x40, 0x80, 0x27, + 0xF7, 0x12, 0x45, 0xF3, 0x4C, 0x02, 0x15, 0x18, 0x31, 0x60, 0x0E, 0x7C, 0xA4, 0xD3, 0xFF, 0xFF, + 0x0B, 0x18, 0x31, 0x60, 0x10, 0x7C, 0xA4, 0xD3, 0xFF, 0xFF, 0x06, 0x18, 0xAC, 0x4C, 0x80, 0x26, + 0x03, 0x00, 0x00, 0x64, 0x45, 0xFB, 0x05, 0x00, 0x45, 0xF3, 0xFF, 0xFF, 0xCC, 0x84, 0x45, 0xFB, + 0xDF, 0x02, 0x06, 0x0A, 0xA0, 0x4C, 0xFB, 0xB4, 0xA0, 0x51, 0xA3, 0x60, 0x99, 0x78, 0xFF, 0xFF, + 0x84, 0xFF, 0xBA, 0x60, 0x70, 0x64, 0x40, 0x42, 0x82, 0xFF, 0xA0, 0x4C, 0x14, 0xBC, 0xFF, 0xB4, + 0xA0, 0x51, 0xAB, 0x60, 0x2C, 0x78, 0xFF, 0xFF, 0x3C, 0x44, 0xAC, 0x80, 0x32, 0xF1, 0x25, 0x03, + 0x64, 0x40, 0x07, 0x22, 0x22, 0x00, 0xA3, 0x60, 0x7B, 0x78, 0xFF, 0xFF, 0xA0, 0x4C, 0x1C, 0xBC, + 0xDF, 0xB4, 0xA0, 0x51, 0x31, 0x40, 0x08, 0x2A, 0xEF, 0x01, 0x73, 0xF3, 0x71, 0xF1, 0x00, 0xA0, + 0xDC, 0x80, 0x05, 0x03, 0x08, 0x03, 0xCC, 0x84, 0x73, 0xFB, 0x67, 0x50, 0x08, 0x00, 0xCC, 0x84, + 0x73, 0xFB, 0x64, 0x50, 0x04, 0x00, 0x31, 0x44, 0xF7, 0xB4, 0x40, 0x51, 0x06, 0x00, 0x28, 0x64, + 0x3A, 0xDB, 0xA0, 0x4C, 0x30, 0xBC, 0xF3, 0xB4, 0xA0, 0x51, 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, + 0x28, 0x64, 0x3B, 0xDB, 0x0F, 0x60, 0x94, 0x62, 0xA2, 0xD3, 0x32, 0x40, 0x02, 0x27, 0x16, 0x00, + 0x46, 0xFB, 0x14, 0x18, 0xBB, 0x60, 0x06, 0x64, 0x84, 0xFF, 0x40, 0x42, 0x82, 0xFF, 0xA0, 0x4C, + 0x14, 0xBC, 0xF7, 0xB4, 0xA0, 0x51, 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, 0x70, 0x44, 0xAC, 0x80, + 0x46, 0xF3, 0xB7, 0x0A, 0xDC, 0x02, 0xCC, 0x84, 0x46, 0xFB, 0xF5, 0x02, 0x84, 0xFF, 0xBB, 0x60, + 0x18, 0x64, 0x40, 0x42, 0x82, 0xFF, 0x27, 0x44, 0x08, 0xBC, 0x40, 0x47, 0xBB, 0xE1, 0x04, 0x00, + 0x3A, 0xE1, 0x31, 0x40, 0x01, 0x26, 0xBB, 0xE1, 0xA3, 0x60, 0x6F, 0x78, 0xFF, 0xFF, 0x43, 0xFF, + 0x39, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x84, 0x3E, 0xFB, 0x01, 0xA0, 0x4C, 0x3D, 0x46, 0x2A, 0xF2, + 0x46, 0x4D, 0x10, 0x25, 0x0E, 0x00, 0x09, 0xE1, 0xA1, 0xFF, 0x66, 0x40, 0x0F, 0xF2, 0x01, 0x29, + 0x02, 0x00, 0x40, 0xFF, 0x0A, 0xBC, 0xA2, 0xDA, 0x08, 0x25, 0xE9, 0x01, 0xCB, 0xFE, 0x5C, 0x5D, + 0xE7, 0x01, 0x44, 0xFF, 0x31, 0xF2, 0x1C, 0x60, 0xBA, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, + 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x31, 0xF0, + 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x30, 0xF0, 0x63, 0x46, 0xD0, 0x80, + 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x2F, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, + 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0xA9, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, + 0x07, 0xFC, 0x3F, 0xF2, 0x09, 0x60, 0xB0, 0x65, 0xD4, 0x80, 0x2A, 0xF2, 0xC4, 0x05, 0x08, 0x25, + 0xB6, 0x01, 0x00, 0x64, 0x0D, 0x60, 0x2C, 0x61, 0x40, 0x4B, 0xA1, 0xDB, 0x2D, 0x46, 0x3B, 0xF2, + 0xA9, 0xF1, 0x87, 0xF4, 0x60, 0x40, 0x20, 0x2B, 0x12, 0x00, 0xD3, 0x80, 0x2C, 0xF0, 0xB3, 0x03, + 0x07, 0xF4, 0x64, 0x40, 0x01, 0x26, 0xA9, 0xF5, 0xB6, 0xF4, 0x2D, 0x46, 0x04, 0x64, 0x04, 0xB3, + 0x22, 0xFA, 0x04, 0x03, 0xBC, 0x60, 0x72, 0x78, 0xFF, 0xFF, 0x01, 0x00, 0xDE, 0x00, 0x74, 0x62, + 0xA2, 0xD0, 0xFF, 0xFF, 0x64, 0x44, 0xE0, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xE1, 0x7F, 0x5A, 0xD0, + 0xA0, 0x5B, 0x64, 0x44, 0xE2, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0x7C, 0x5F, 0xE8, 0x84, 0xE8, 0x85, + 0x0C, 0x60, 0x3A, 0x64, 0x44, 0xD3, 0x5A, 0xD1, 0x03, 0x1B, 0xBC, 0x60, 0x65, 0x78, 0xFF, 0xFF, + 0x60, 0x45, 0x64, 0x44, 0xE3, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xE4, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, + 0x64, 0x44, 0xE5, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xE6, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, 0x64, 0x44, + 0xE7, 0x7F, 0xA0, 0x5B, 0x65, 0x40, 0x0D, 0x3A, 0x1C, 0x00, 0x64, 0x47, 0xE8, 0x7F, 0x5A, 0xD1, + 0xA0, 0x5B, 0x64, 0x44, 0xE9, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xEA, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, + 0x64, 0x44, 0xEB, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xEC, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, 0x64, 0x44, + 0xED, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xEE, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, 0x64, 0x44, 0xEF, 0x7F, + 0xA0, 0x5B, 0x65, 0x44, 0xD8, 0x84, 0x08, 0x25, 0x76, 0x00, 0x60, 0x7F, 0xA0, 0x5B, 0x80, 0x60, + 0x00, 0xEB, 0xA0, 0x60, 0x00, 0xEB, 0xD1, 0x60, 0x00, 0xEB, 0x3F, 0xF2, 0x04, 0x65, 0xC4, 0x83, + 0x0A, 0xE1, 0xB3, 0xFF, 0x9A, 0xFF, 0xCB, 0x83, 0x00, 0xF4, 0x10, 0x62, 0x6C, 0x61, 0x0E, 0xA3, + 0xAB, 0x84, 0xF2, 0xA3, 0xA1, 0xFF, 0x08, 0x00, 0x00, 0xF4, 0x81, 0xF2, 0x02, 0x62, 0xC9, 0x81, + 0xAB, 0x84, 0xA1, 0xFF, 0x01, 0x00, 0xA2, 0xDC, 0x7A, 0xD4, 0xFD, 0x1C, 0xA2, 0xDC, 0x08, 0x25, + 0x52, 0x00, 0xF2, 0x1D, 0x7C, 0xA8, 0xD9, 0x81, 0xEF, 0x03, 0xFF, 0xB1, 0x09, 0x1E, 0x02, 0x02, + 0x00, 0xF4, 0x02, 0x62, 0x5A, 0xD2, 0x89, 0xFF, 0x80, 0x4F, 0x6F, 0x44, 0xA2, 0xDA, 0x88, 0xFF, + 0x98, 0xFF, 0x09, 0xE1, 0xA1, 0xFF, 0x3D, 0x46, 0x08, 0x25, 0x3D, 0x00, 0x40, 0xFF, 0x0F, 0xF0, + 0x0A, 0x64, 0xB0, 0x84, 0x16, 0x14, 0xF7, 0xB4, 0xA2, 0xDA, 0x0D, 0x60, 0x2C, 0x62, 0xA2, 0xD3, + 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, 0x0C, 0x00, 0xF1, 0xF5, 0xF0, 0xF4, 0x0D, 0x60, 0x2C, 0x61, + 0x59, 0xD1, 0x37, 0xF8, 0x05, 0x64, 0x59, 0xD1, 0xCC, 0x84, 0xBD, 0xD8, 0xFC, 0x02, 0x2D, 0x46, + 0x0D, 0x01, 0xA2, 0xDA, 0x2D, 0x46, 0x3B, 0xF0, 0xFF, 0xFF, 0x64, 0x40, 0x20, 0x2B, 0x18, 0x00, + 0xF1, 0xF5, 0xB7, 0xF0, 0x2A, 0x44, 0xA4, 0x84, 0xFF, 0xFF, 0x2F, 0x26, 0x10, 0x00, 0x2D, 0x46, + 0x64, 0x44, 0x3A, 0xF0, 0xBC, 0xF0, 0x64, 0x5F, 0x3D, 0xF0, 0x07, 0xF4, 0xF0, 0xF4, 0xFF, 0xFF, + 0x08, 0xA3, 0x5B, 0xD8, 0x65, 0x5C, 0x5B, 0xD8, 0x5B, 0xDA, 0x2D, 0x46, 0x01, 0x00, 0x2D, 0x46, + 0xBB, 0x60, 0x36, 0x78, 0xFF, 0xFF, 0x98, 0xFF, 0x43, 0xFF, 0x40, 0xFF, 0xB0, 0xFF, 0xB1, 0xFF, + 0x2D, 0x46, 0x0D, 0x60, 0x2C, 0x61, 0xA1, 0xD3, 0x2D, 0x46, 0x60, 0x40, 0x01, 0x2A, 0x0A, 0x00, + 0xF1, 0xF5, 0xF0, 0xF4, 0x59, 0xD1, 0x37, 0xF8, 0x05, 0x64, 0x59, 0xD1, 0xCC, 0x84, 0xBD, 0xD8, + 0xFC, 0x02, 0x2D, 0x46, 0xBB, 0x60, 0x20, 0x78, 0xFF, 0xFF, 0x98, 0xFF, 0x09, 0xE1, 0xA1, 0xFF, + 0x3D, 0x46, 0x08, 0x25, 0xE0, 0x01, 0x0F, 0xF2, 0x40, 0xFF, 0x02, 0xBC, 0xA2, 0xDA, 0xBB, 0x60, + 0x36, 0x78, 0xFF, 0xFF, 0x00, 0x64, 0x0D, 0x60, 0x2C, 0x62, 0xA2, 0xDB, 0x04, 0x64, 0x22, 0xFA, + 0x87, 0xF4, 0xA9, 0xF1, 0xFF, 0xFF, 0xD3, 0x80, 0x3B, 0xF2, 0xE7, 0x03, 0x60, 0x47, 0xC0, 0xB7, + 0x02, 0xFE, 0xF0, 0x84, 0xF0, 0x84, 0xF0, 0x84, 0x00, 0xA8, 0x40, 0x4A, 0x16, 0x03, 0xE0, 0x81, + 0x61, 0x43, 0x42, 0xFE, 0x00, 0x64, 0xF0, 0x84, 0xFE, 0x1F, 0x40, 0x4A, 0xE1, 0x84, 0xE0, 0x84, + 0x2D, 0x46, 0x07, 0xF4, 0xE0, 0x81, 0x37, 0xF0, 0x2A, 0x47, 0x0C, 0x60, 0x7A, 0x63, 0xA0, 0x84, + 0x47, 0x9C, 0x10, 0x03, 0x7C, 0x44, 0xA0, 0x63, 0x11, 0x00, 0x20, 0x64, 0x40, 0x4A, 0x63, 0x46, + 0x37, 0xF0, 0x66, 0x44, 0x64, 0x40, 0x80, 0x2B, 0x05, 0x00, 0x00, 0x60, 0x70, 0x7C, 0x00, 0x60, + 0x90, 0x63, 0x04, 0x00, 0x2D, 0x46, 0xBC, 0x60, 0x65, 0x78, 0xFF, 0xFF, 0x2D, 0x46, 0xEE, 0xFB, + 0xEF, 0xF9, 0xF0, 0xFD, 0x07, 0xF2, 0xF1, 0xFB, 0x60, 0x46, 0x37, 0xF0, 0x2A, 0x44, 0x0D, 0x60, + 0x2C, 0x62, 0x5A, 0xD9, 0x00, 0x65, 0x45, 0x4B, 0xA0, 0x84, 0xFF, 0xFF, 0x3F, 0x22, 0x05, 0x00, + 0x90, 0x84, 0x37, 0xFA, 0x01, 0x64, 0x40, 0x4B, 0x21, 0x00, 0xAD, 0x46, 0x0A, 0xA3, 0x3D, 0xF2, + 0xAD, 0x46, 0xA3, 0xD0, 0xAD, 0x46, 0xD0, 0x80, 0x3C, 0xF2, 0xAD, 0x46, 0x02, 0x03, 0x16, 0x07, + 0x14, 0x04, 0x5B, 0xD0, 0xAD, 0x46, 0xD0, 0x80, 0x3B, 0xF2, 0x03, 0x03, 0xAD, 0x46, 0x0E, 0x07, + 0x0C, 0x04, 0x3A, 0xF0, 0xAD, 0x46, 0x5B, 0xD0, 0x64, 0x5F, 0xD0, 0x80, 0x2B, 0x44, 0x18, 0x07, + 0x04, 0x03, 0xD0, 0x84, 0x10, 0xA4, 0xFF, 0xFF, 0x13, 0x07, 0x7F, 0x01, 0x01, 0x64, 0x0D, 0x60, + 0x2C, 0x62, 0xA2, 0xDB, 0x2D, 0x46, 0x0D, 0x60, 0x3C, 0x62, 0x80, 0xFF, 0x78, 0x44, 0x03, 0xA4, + 0xA2, 0xDB, 0xBD, 0x60, 0x0B, 0x78, 0xFF, 0xFF, 0x85, 0xFF, 0x2D, 0x46, 0x08, 0x25, 0x53, 0x01, + 0x2D, 0x46, 0x0D, 0x60, 0x3C, 0x62, 0x80, 0xFF, 0x78, 0x44, 0x03, 0xA4, 0xA2, 0xDB, 0xBD, 0x60, + 0x94, 0x78, 0xFF, 0xFF, 0x85, 0xFF, 0x2D, 0x46, 0x08, 0x25, 0x45, 0x01, 0x00, 0x60, 0x0F, 0x64, + 0xBB, 0x60, 0xD3, 0x78, 0xFF, 0xFF, 0x07, 0xF4, 0x66, 0x41, 0x03, 0xF2, 0x04, 0xF2, 0x40, 0x42, + 0x05, 0xF2, 0x40, 0x43, 0x40, 0x44, 0x61, 0x46, 0x3C, 0xF2, 0x3D, 0xF2, 0x40, 0x40, 0x40, 0x41, + 0x0D, 0x60, 0x70, 0x65, 0x00, 0x61, 0xEF, 0xF1, 0xEE, 0xF5, 0x44, 0x4C, 0x2C, 0x5C, 0xE9, 0x80, + 0x00, 0x64, 0xF0, 0x84, 0xF0, 0x84, 0xC0, 0x83, 0xBD, 0xD2, 0x24, 0x5C, 0x90, 0x9C, 0x64, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, + 0x90, 0x9C, 0x20, 0x44, 0x40, 0x80, 0xDB, 0x83, 0xBD, 0xD2, 0x20, 0x5C, 0x90, 0x9C, 0x64, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, + 0x90, 0x9C, 0x21, 0x44, 0x40, 0x81, 0xDB, 0x83, 0xBD, 0xD2, 0x21, 0x5C, 0x90, 0x9C, 0x64, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, + 0x90, 0x9C, 0x22, 0x44, 0x40, 0x82, 0xDB, 0x83, 0xBD, 0xD2, 0x22, 0x5C, 0x90, 0x9C, 0x64, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, + 0x90, 0x9C, 0x23, 0x44, 0x40, 0x83, 0xF2, 0xA3, 0xBD, 0xD2, 0x23, 0x5C, 0x90, 0x9C, 0x64, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, + 0x90, 0x9C, 0x24, 0x44, 0xC0, 0x9C, 0x41, 0x84, 0xDD, 0x81, 0x08, 0x2A, 0xA7, 0x01, 0x0D, 0x60, + 0x2E, 0x61, 0x05, 0x64, 0xF0, 0xF4, 0xF1, 0xF5, 0xFE, 0xA3, 0x5B, 0xD0, 0xCC, 0x84, 0x59, 0xD9, + 0xFC, 0x02, 0xF0, 0xF3, 0xF1, 0xF5, 0x60, 0x42, 0x20, 0x44, 0xA2, 0xDA, 0x21, 0x44, 0x5A, 0xDA, + 0x22, 0x44, 0x5A, 0xDA, 0x23, 0x44, 0x5A, 0xDA, 0x24, 0x44, 0x5A, 0xDA, 0x61, 0x46, 0x0D, 0x60, + 0x3C, 0x62, 0xA2, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0x66, 0x41, 0xF0, 0xF3, 0xF1, 0xF5, 0xA0, 0xD2, + 0x5A, 0xD0, 0x40, 0x40, 0x44, 0x41, 0x5A, 0xD2, 0x5A, 0xD0, 0x40, 0x42, 0x5A, 0xD0, 0x44, 0x43, + 0x61, 0x46, 0xBA, 0xF0, 0x3B, 0xF2, 0x44, 0x44, 0x65, 0x5F, 0x40, 0x85, 0xEF, 0xF4, 0xEE, 0xF5, + 0x43, 0x4C, 0x0D, 0x60, 0x70, 0x65, 0xBD, 0xD2, 0x25, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x20, 0x44, 0x40, 0x80, 0xBD, 0xD2, 0x20, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, + 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x21, 0x44, + 0x40, 0x81, 0xBD, 0xD2, 0x21, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x22, 0x44, 0x40, 0x82, + 0xBD, 0xD2, 0x22, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x23, 0x44, 0x40, 0x83, 0xBD, 0xD2, + 0x23, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x24, 0x44, 0x40, 0x84, 0xBD, 0xD2, 0x24, 0x5C, + 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, + 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x25, 0x44, 0x40, 0x85, 0x61, 0x46, 0x3A, 0xF0, 0xFF, 0xFF, + 0x64, 0x44, 0xE0, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xE1, 0x7F, 0x5A, 0xD0, 0xA0, 0x5B, 0x64, 0x44, + 0xE2, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xEE, 0xF5, 0xBD, 0xD2, 0x25, 0x5C, 0x90, 0x84, 0xE8, 0x80, + 0xF8, 0x84, 0x20, 0x5C, 0x40, 0x80, 0x20, 0x44, 0xE4, 0x7F, 0xA0, 0x5B, 0x20, 0x47, 0xE5, 0x7F, + 0xA0, 0x5B, 0xBD, 0xD2, 0x20, 0x5C, 0x90, 0x84, 0xE8, 0x80, 0xF8, 0x84, 0x21, 0x5C, 0x40, 0x81, + 0x21, 0x44, 0xE6, 0x7F, 0xA0, 0x5B, 0x21, 0x47, 0xE7, 0x7F, 0xA0, 0x5B, 0x21, 0x44, 0xE8, 0x80, + 0xF8, 0x84, 0x22, 0x5C, 0x40, 0x82, 0x22, 0x44, 0xE8, 0x7F, 0xA0, 0x5B, 0x22, 0x47, 0xE9, 0x7F, + 0xA0, 0x5B, 0x22, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x23, 0x5C, 0x40, 0x83, 0x23, 0x44, 0xEA, 0x7F, + 0xA0, 0x5B, 0x23, 0x47, 0xEB, 0x7F, 0xA0, 0x5B, 0x23, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x24, 0x5C, + 0x40, 0x84, 0x24, 0x44, 0xEC, 0x7F, 0xA0, 0x5B, 0x24, 0x47, 0xED, 0x7F, 0xA0, 0x5B, 0x24, 0x44, + 0xE8, 0x80, 0xF8, 0x84, 0x25, 0x5C, 0x40, 0x85, 0x25, 0x44, 0xEE, 0x7F, 0xA0, 0x5B, 0x25, 0x47, + 0xEF, 0x7F, 0xA0, 0x5B, 0x2C, 0x43, 0xA3, 0xD2, 0x25, 0x5C, 0x90, 0x81, 0xE9, 0x84, 0xE3, 0x7F, + 0xA0, 0x5B, 0x0D, 0x60, 0x3C, 0x62, 0xA2, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0xEB, 0xF3, 0x5A, 0xD3, + 0x40, 0x48, 0x5A, 0xD3, 0x40, 0x49, 0x40, 0x4A, 0x00, 0x60, 0x70, 0x7C, 0x44, 0x4D, 0x45, 0xF2, + 0x46, 0xF2, 0x40, 0x47, 0x40, 0x46, 0x0D, 0x60, 0x70, 0x65, 0x00, 0x61, 0x2D, 0x5C, 0xE9, 0x80, + 0x00, 0x64, 0xF0, 0x84, 0xF0, 0x84, 0xC0, 0x83, 0xBD, 0xD2, 0x2A, 0x5C, 0x90, 0x9C, 0x64, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, + 0x90, 0x9C, 0x26, 0x44, 0x40, 0x86, 0xDB, 0x83, 0xBD, 0xD2, 0x26, 0x5C, 0x90, 0x9C, 0x64, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, + 0x90, 0x9C, 0x27, 0x44, 0x40, 0x87, 0xDB, 0x83, 0xBD, 0xD2, 0x27, 0x5C, 0x90, 0x9C, 0x64, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, + 0x90, 0x9C, 0x28, 0x44, 0x40, 0x88, 0xDB, 0x83, 0xBD, 0xD2, 0x28, 0x5C, 0x90, 0x9C, 0x64, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, + 0x90, 0x9C, 0x29, 0x44, 0x40, 0x89, 0xF2, 0xA3, 0xBD, 0xD2, 0x29, 0x5C, 0x90, 0x9C, 0x64, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, + 0x90, 0x9C, 0x2A, 0x44, 0xC0, 0x9C, 0x41, 0x8A, 0xDD, 0x81, 0x08, 0x2A, 0xA7, 0x01, 0x26, 0x44, + 0x40, 0xFA, 0x27, 0x44, 0x41, 0xFA, 0x28, 0x44, 0x42, 0xFA, 0x29, 0x44, 0x43, 0xFA, 0x2A, 0x44, + 0x44, 0xFA, 0x0D, 0x60, 0x3E, 0x62, 0xA2, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x60, 0x80, 0x7C, + 0x44, 0x4D, 0x2D, 0x42, 0xA2, 0xD2, 0x5A, 0xD0, 0x40, 0x46, 0x44, 0x47, 0x5A, 0xD2, 0x5A, 0xD0, + 0x40, 0x48, 0x5A, 0xD0, 0x44, 0x49, 0x47, 0xF2, 0x44, 0x4A, 0x40, 0x8B, 0x60, 0x5C, 0x64, 0x47, + 0xE0, 0x7F, 0xA0, 0x5A, 0xFF, 0xB4, 0x20, 0xBC, 0x7F, 0xB4, 0xE1, 0x7F, 0xA0, 0x5A, 0x64, 0x44, + 0xE2, 0x7F, 0xA0, 0x5A, 0x00, 0x60, 0x70, 0x63, 0x0D, 0x60, 0x70, 0x65, 0xBD, 0xD2, 0x2B, 0x5C, + 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, + 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x26, 0x44, 0x40, 0x86, 0xBD, 0xD2, 0x26, 0x5C, 0x90, 0x9C, + 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x47, 0x90, 0x9C, 0x27, 0x44, 0x40, 0x87, 0xBD, 0xD2, 0x27, 0x5C, 0x90, 0x9C, 0x64, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, + 0x90, 0x9C, 0x28, 0x44, 0x40, 0x88, 0xBD, 0xD2, 0x28, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x29, 0x44, 0x40, 0x89, 0xBD, 0xD2, 0x29, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, + 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x2A, 0x44, + 0x40, 0x8A, 0xBD, 0xD2, 0x2A, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x2B, 0x44, 0x40, 0x8B, + 0xBD, 0xD2, 0x2B, 0x5C, 0x90, 0x84, 0xE8, 0x80, 0xF8, 0x84, 0x26, 0x5C, 0x40, 0x86, 0x26, 0x44, + 0xE4, 0x7F, 0xA0, 0x5A, 0x26, 0x47, 0xE5, 0x7F, 0xA0, 0x5A, 0xBD, 0xD2, 0x26, 0x5C, 0x90, 0x84, + 0xE8, 0x80, 0xF8, 0x84, 0x27, 0x5C, 0x40, 0x87, 0x27, 0x44, 0xE6, 0x7F, 0xA0, 0x5A, 0x27, 0x47, + 0xE7, 0x7F, 0xA0, 0x5A, 0x27, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x28, 0x5C, 0x40, 0x88, 0x28, 0x44, + 0xE8, 0x7F, 0xA0, 0x5A, 0x28, 0x47, 0xE9, 0x7F, 0xA0, 0x5A, 0x28, 0x44, 0xE8, 0x80, 0xF8, 0x84, + 0x29, 0x5C, 0x40, 0x89, 0x29, 0x44, 0xEA, 0x7F, 0xA0, 0x5A, 0x29, 0x47, 0xEB, 0x7F, 0xA0, 0x5A, + 0x29, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x2A, 0x5C, 0x40, 0x8A, 0x2A, 0x44, 0xEC, 0x7F, 0xA0, 0x5A, + 0x2A, 0x47, 0xED, 0x7F, 0xA0, 0x5A, 0x2A, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x2B, 0x5C, 0x40, 0x8B, + 0x2B, 0x44, 0xEE, 0x7F, 0xA0, 0x5A, 0x2B, 0x47, 0xEF, 0x7F, 0xA0, 0x5A, 0x38, 0xF0, 0x2B, 0x44, + 0x90, 0x84, 0xE8, 0x84, 0xE3, 0x7F, 0xA0, 0x5A, 0x0D, 0x60, 0x3E, 0x62, 0xA2, 0xD7, 0xFF, 0xFF, + 0xFF, 0xFF, 0xE4, 0x60, 0xC8, 0x78, 0xFF, 0xFF, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x80, 0x60, + 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x32, 0x00, 0xDC, 0xF3, 0x31, 0x41, 0x01, 0xB1, + 0x03, 0xA8, 0x2D, 0x03, 0x17, 0x02, 0x20, 0x40, 0x04, 0x2B, 0x0C, 0x00, 0xBB, 0xFE, 0xCA, 0xFE, + 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0x08, 0x00, 0x0F, 0x60, 0xD2, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x04, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x0F, 0x60, 0xF6, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x80, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x0C, 0x00, 0xA9, 0xFE, 0xD8, 0x05, 0xAB, 0xFE, 0x0C, 0x05, 0xA8, 0xFE, + 0xC8, 0x05, 0xAA, 0xFE, 0xC9, 0x05, 0x78, 0x43, 0x01, 0x61, 0x24, 0x60, 0xDD, 0x78, 0xA1, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0x85, 0x3E, 0x24, 0x60, 0x5E, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, + 0x60, 0x46, 0x03, 0x02, 0xBF, 0x60, 0xE7, 0x78, 0xFF, 0xFF, 0x26, 0x45, 0xD4, 0x80, 0x0F, 0xF0, + 0xF9, 0x03, 0x64, 0x44, 0x70, 0xB0, 0x70, 0x2A, 0x14, 0x00, 0x27, 0x60, 0xB2, 0x64, 0xA0, 0xD3, + 0xFF, 0xFF, 0xDC, 0x84, 0xFF, 0xFF, 0x08, 0x28, 0xA2, 0xDB, 0xA2, 0xFF, 0xAF, 0xF3, 0xFF, 0xFF, + 0xCC, 0x84, 0xFE, 0xA0, 0xAF, 0xFB, 0x01, 0x07, 0xD4, 0xFE, 0xA3, 0xFF, 0xC5, 0x60, 0x5B, 0x78, + 0xFF, 0xFF, 0x64, 0x40, 0x02, 0x26, 0x09, 0x00, 0x66, 0x45, 0x09, 0xF4, 0x0F, 0xF2, 0x02, 0x18, + 0x65, 0x46, 0xE3, 0x1B, 0x00, 0x64, 0x40, 0x46, 0xCA, 0x01, 0xA2, 0xFF, 0xAF, 0xF3, 0x46, 0x46, + 0xCC, 0x84, 0xFE, 0xA0, 0xAF, 0xFB, 0x01, 0x07, 0xD4, 0xFE, 0xA3, 0xFF, 0x0F, 0xF0, 0xA3, 0xFC, + 0x64, 0x44, 0x80, 0x26, 0x22, 0x00, 0xB8, 0xF1, 0x27, 0x60, 0x92, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, + 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, + 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x32, 0x44, 0x01, 0x2A, 0x03, 0x00, 0x07, 0x60, + 0x01, 0x64, 0x04, 0x00, 0x02, 0x2A, 0x06, 0x00, 0x00, 0x60, 0x01, 0x64, 0x23, 0xFA, 0xC5, 0x60, + 0x67, 0x78, 0xFF, 0xFF, 0xC5, 0x60, 0x5B, 0x78, 0xFF, 0xFF, 0x08, 0x26, 0x3F, 0x00, 0x2A, 0xF2, + 0x60, 0x63, 0x60, 0x40, 0x02, 0x2B, 0x66, 0x63, 0xBE, 0xD2, 0x83, 0xF1, 0xA3, 0xD2, 0xD0, 0x80, + 0x82, 0xF1, 0x18, 0x02, 0xBF, 0xD2, 0xD0, 0x80, 0x81, 0xF1, 0x14, 0x02, 0xD0, 0x80, 0xFF, 0xFF, + 0x11, 0x02, 0xB8, 0xF1, 0x27, 0x60, 0x9E, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, + 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, + 0x00, 0x75, 0x88, 0xFF, 0x32, 0x44, 0x01, 0x2A, 0x03, 0x00, 0x07, 0x60, 0x02, 0x64, 0x04, 0x00, + 0x02, 0x2A, 0x06, 0x00, 0x00, 0x60, 0x02, 0x64, 0x23, 0xFA, 0xC5, 0x60, 0x67, 0x78, 0xFF, 0xFF, + 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0xB0, 0x3A, 0x06, 0x00, 0x00, 0x60, 0x02, 0x64, 0x23, 0xFA, + 0xC1, 0x60, 0x11, 0x78, 0xFF, 0xFF, 0xC5, 0x60, 0x5B, 0x78, 0xFF, 0xFF, 0x32, 0x44, 0x01, 0x2A, + 0x4A, 0x00, 0x28, 0x60, 0xE2, 0x63, 0xBF, 0xD3, 0x00, 0x65, 0xB4, 0x81, 0xDB, 0x83, 0x3D, 0x03, + 0xBF, 0xD3, 0xA3, 0xD3, 0x40, 0x48, 0xBE, 0xD3, 0x40, 0x4A, 0x2E, 0xF0, 0x40, 0x4C, 0xD0, 0x80, + 0x2D, 0xF0, 0x08, 0x02, 0x2A, 0x44, 0xD0, 0x80, 0x2C, 0xF0, 0x04, 0x02, 0x28, 0x44, 0xD0, 0x80, + 0xFF, 0xFF, 0x2B, 0x03, 0x31, 0xF0, 0x2C, 0x44, 0xD0, 0x80, 0x30, 0xF0, 0x08, 0x02, 0x2A, 0x44, + 0xD0, 0x80, 0x2F, 0xF0, 0x04, 0x02, 0x28, 0x44, 0xD0, 0x80, 0xFF, 0xFF, 0x1E, 0x03, 0x34, 0xF0, + 0x2C, 0x44, 0xD0, 0x80, 0x33, 0xF0, 0x08, 0x02, 0x2A, 0x44, 0xD0, 0x80, 0x32, 0xF0, 0x04, 0x02, + 0x28, 0x44, 0xD0, 0x80, 0xFF, 0xFF, 0x11, 0x03, 0x38, 0xF0, 0x2C, 0x44, 0xD0, 0x80, 0x37, 0xF0, + 0x08, 0x02, 0x2A, 0x44, 0xD0, 0x80, 0x36, 0xF0, 0x04, 0x02, 0x28, 0x44, 0xD0, 0x80, 0xFF, 0xFF, + 0x04, 0x03, 0xFA, 0xA1, 0x06, 0xA3, 0xB7, 0x03, 0xC3, 0x01, 0x07, 0x60, 0x00, 0x64, 0x23, 0xFA, + 0xC5, 0x60, 0x67, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0x0F, 0xF0, 0x60, 0x45, 0xA4, 0x36, 0x08, 0x00, + 0x0C, 0xB4, 0x04, 0x36, 0x02, 0x00, 0x0C, 0x3A, 0x06, 0x00, 0xC5, 0x60, 0x5B, 0x78, 0xFF, 0xFF, + 0xC2, 0x60, 0xDD, 0x78, 0xFF, 0xFF, 0x0F, 0xF0, 0x65, 0x40, 0x40, 0x2B, 0x22, 0x00, 0x32, 0x40, + 0x08, 0x26, 0x1F, 0x00, 0x07, 0xF4, 0x36, 0xF2, 0xFF, 0xFF, 0x37, 0xB4, 0x26, 0x46, 0x19, 0x02, + 0x2C, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x26, 0x11, 0x00, 0xB8, 0xF1, 0x27, 0x60, 0x98, 0x64, + 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, + 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0xC5, 0x60, 0x5B, 0x78, + 0xFF, 0xFF, 0x2A, 0xF2, 0x64, 0x40, 0x60, 0x26, 0x03, 0x00, 0xC2, 0x60, 0xAF, 0x78, 0xFF, 0xFF, + 0x60, 0x41, 0xA9, 0xF3, 0x07, 0xFA, 0x61, 0x44, 0x80, 0x3A, 0x06, 0x00, 0xE5, 0x60, 0x58, 0x4F, + 0xE7, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0x10, 0x00, 0x60, 0x40, 0x40, 0x3A, 0x0D, 0x00, 0xDC, 0xF3, + 0xFF, 0xFF, 0x07, 0xB4, 0x03, 0x3A, 0xE2, 0x01, 0xC6, 0x60, 0x58, 0x4D, 0x4F, 0x78, 0xFF, 0xFF, + 0xDD, 0x02, 0xA9, 0xF3, 0x07, 0xFA, 0xD1, 0x00, 0x5E, 0x63, 0x60, 0x40, 0x02, 0x2B, 0x64, 0x63, + 0x50, 0xFE, 0xBD, 0xD2, 0x81, 0xF1, 0xBD, 0xD2, 0xD0, 0x80, 0x82, 0xF1, 0xBD, 0xD2, 0xD0, 0x80, + 0x83, 0xF1, 0x2A, 0xF2, 0xD0, 0x80, 0x60, 0x40, 0x08, 0x3A, 0x07, 0x00, 0x01, 0x0C, 0xC6, 0x01, + 0xDE, 0x60, 0x58, 0x4F, 0xFE, 0x78, 0xFF, 0xFF, 0xB8, 0x00, 0x26, 0x0C, 0xC6, 0x60, 0x58, 0x4D, + 0x4F, 0x78, 0xFF, 0xFF, 0xBB, 0x02, 0x1F, 0x60, 0x52, 0x61, 0x02, 0x64, 0xA1, 0xDB, 0x1F, 0x60, + 0x5A, 0x61, 0x00, 0x64, 0xA1, 0xDB, 0x22, 0x60, 0x58, 0x4E, 0x3E, 0x78, 0xFF, 0xFF, 0x1F, 0x60, + 0x04, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x27, 0x08, 0x00, 0x0F, 0x60, 0xEA, 0x62, + 0xA2, 0xD1, 0x00, 0x60, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x1F, 0x60, 0x52, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x9B, 0x01, 0x91, 0x00, 0xC6, 0x60, 0x58, 0x4D, 0x4F, 0x78, 0xFF, 0xFF, + 0xFA, 0x02, 0x0F, 0x60, 0xCE, 0x61, 0xA1, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x36, 0x07, 0x00, + 0x01, 0x64, 0xA1, 0xDB, 0x01, 0x65, 0xE9, 0x60, 0x58, 0x4E, 0x7B, 0x78, 0xFF, 0xFF, 0x26, 0x46, + 0x31, 0xF2, 0x1C, 0x60, 0xBA, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, + 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x31, 0xF0, 0x63, 0x46, 0xD0, 0x80, + 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x30, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, + 0x61, 0x46, 0x2F, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, + 0x63, 0x46, 0xE8, 0x1B, 0xA9, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0xA9, 0xF1, 0x43, 0x43, + 0xD3, 0x80, 0xFF, 0xFF, 0x04, 0x02, 0xC5, 0x60, 0x58, 0x4F, 0xA5, 0x78, 0xFF, 0xFF, 0x32, 0x40, + 0x08, 0x2A, 0x05, 0x00, 0x63, 0x46, 0x80, 0x60, 0x02, 0x64, 0x06, 0xFA, 0x26, 0x46, 0xD8, 0xF3, + 0x63, 0x45, 0x66, 0x41, 0x65, 0x46, 0x8C, 0xFA, 0x60, 0x40, 0x01, 0x36, 0x06, 0x00, 0x02, 0x36, + 0x04, 0x00, 0x04, 0x36, 0x02, 0x00, 0x05, 0x3A, 0x02, 0x00, 0x00, 0x64, 0x01, 0x00, 0x01, 0x64, + 0x6F, 0xFA, 0x79, 0xF3, 0x7A, 0xF1, 0xFF, 0xFF, 0xA0, 0x84, 0x65, 0x43, 0x02, 0x02, 0x79, 0xF3, + 0xFF, 0xFF, 0x60, 0x41, 0x0F, 0x60, 0xAE, 0x65, 0xD8, 0xF3, 0xFF, 0xFF, 0xE0, 0x84, 0x44, 0xD3, + 0x61, 0x45, 0xA4, 0x80, 0xFF, 0xFF, 0x04, 0x02, 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0xFC, 0x03, + 0xA4, 0x84, 0x7B, 0xFB, 0x6F, 0xF0, 0x60, 0x47, 0x90, 0x84, 0x6F, 0xFA, 0x60, 0x47, 0x60, 0x45, + 0x80, 0x64, 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0xFC, 0x03, 0xA4, 0x84, 0x70, 0xF0, 0x70, 0xFA, + 0x00, 0x61, 0xE8, 0x84, 0xFF, 0xFF, 0x02, 0x05, 0xDD, 0x81, 0xFB, 0x01, 0xE1, 0x81, 0x0F, 0x60, + 0xA2, 0x65, 0x45, 0xD3, 0x0E, 0xFA, 0x66, 0x43, 0x0C, 0xF4, 0xB8, 0xF1, 0x27, 0x60, 0x8C, 0x64, + 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, + 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x27, 0xF2, 0xFF, 0xFF, + 0x60, 0x40, 0x01, 0x3B, 0x12, 0x00, 0xB8, 0xF1, 0x27, 0x60, 0x9A, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, + 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, + 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x13, 0x00, 0x02, 0x3B, 0x11, 0x00, 0xB8, 0xF1, + 0x27, 0x60, 0x9C, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, + 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, + 0x1B, 0xF2, 0xFF, 0xFF, 0xE4, 0xA4, 0x3E, 0xFA, 0x2A, 0xF2, 0x28, 0x41, 0x40, 0xA8, 0x01, 0xB1, + 0x02, 0x02, 0x62, 0x02, 0x92, 0x00, 0x60, 0x40, 0x08, 0x2A, 0x2B, 0x00, 0xB8, 0xF1, 0x27, 0x60, + 0x8A, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, + 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x1B, 0xF2, + 0xFF, 0xFF, 0x60, 0x45, 0xB8, 0xF1, 0x27, 0x60, 0x90, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xD8, 0x80, + 0xC4, 0x84, 0x0B, 0x03, 0x07, 0x05, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x09, 0x04, + 0xC6, 0xFE, 0x07, 0x00, 0x00, 0x64, 0xB8, 0x84, 0xA2, 0xDB, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, + 0x88, 0xFF, 0x0F, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x40, 0x26, 0x28, 0x00, 0x32, 0x44, 0x02, 0x26, + 0x25, 0x00, 0x10, 0x2B, 0x29, 0x00, 0x28, 0x60, 0xE2, 0x63, 0xBF, 0xD3, 0x2C, 0xF0, 0x00, 0xA8, + 0x60, 0x41, 0x0D, 0x03, 0x50, 0xFE, 0xBD, 0xD3, 0x2D, 0xF0, 0xD0, 0x80, 0xBD, 0xD3, 0x2E, 0xF0, + 0xD0, 0x80, 0xBD, 0xD3, 0x2C, 0xF0, 0xD0, 0x80, 0xFA, 0xA1, 0x10, 0x0C, 0xF3, 0x02, 0x50, 0xFE, + 0x60, 0x60, 0x01, 0x64, 0xD0, 0x80, 0x2D, 0xF0, 0x1D, 0x64, 0xD0, 0x80, 0x2E, 0xF0, 0x01, 0x64, + 0xD0, 0x80, 0xFF, 0xFF, 0x03, 0x0C, 0xC5, 0x60, 0x5B, 0x78, 0xFF, 0xFF, 0x32, 0x40, 0x40, 0x2A, + 0x03, 0x00, 0x19, 0x60, 0x22, 0x78, 0xFF, 0xFF, 0xC5, 0x60, 0x55, 0x78, 0xFF, 0xFF, 0x32, 0x40, + 0x40, 0x26, 0xF7, 0x01, 0x2A, 0xF0, 0xFF, 0xFF, 0x64, 0x40, 0x08, 0x2A, 0x2A, 0x00, 0xDC, 0xF3, + 0xFF, 0xFF, 0x07, 0xB4, 0x03, 0xA8, 0xFF, 0xFF, 0x03, 0x03, 0x32, 0x40, 0x02, 0x2A, 0x1D, 0x00, + 0x03, 0x67, 0xA0, 0x84, 0x00, 0x37, 0x64, 0x63, 0x60, 0x40, 0x02, 0x37, 0x5E, 0x63, 0x60, 0x40, + 0x01, 0x37, 0x58, 0x63, 0x60, 0x40, 0x03, 0x37, 0x0D, 0x00, 0xBD, 0xD2, 0x81, 0xF1, 0xBD, 0xD2, + 0xD0, 0x80, 0x82, 0xF1, 0x07, 0x02, 0xD0, 0x80, 0xBD, 0xD2, 0x83, 0xF1, 0x03, 0x02, 0xD0, 0x80, + 0xFF, 0xFF, 0x03, 0x03, 0xC5, 0x60, 0x5B, 0x78, 0xFF, 0xFF, 0xDE, 0x60, 0x58, 0x4F, 0xFE, 0x78, + 0xFF, 0xFF, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x26, 0x06, 0x00, 0x20, 0x40, 0x10, 0x2B, + 0x03, 0x00, 0xC5, 0x60, 0x55, 0x78, 0xFF, 0xFF, 0x87, 0xF4, 0xA9, 0xF1, 0x27, 0x1B, 0x31, 0xF2, + 0x1C, 0x60, 0xBA, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, + 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x31, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, + 0x0C, 0x02, 0x61, 0x46, 0x30, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, + 0x2F, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, + 0xE8, 0x1B, 0xA9, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x03, 0x00, 0xD3, 0x80, 0xFF, 0xFF, + 0xD6, 0x03, 0x43, 0x43, 0xDC, 0xF3, 0x32, 0x40, 0x02, 0x26, 0x04, 0x00, 0x07, 0xB4, 0x03, 0xA8, + 0x2A, 0xF2, 0x5F, 0x02, 0xA9, 0xF1, 0x23, 0x43, 0xD3, 0x80, 0xFF, 0xFF, 0x5A, 0x02, 0xC5, 0x60, + 0x58, 0x4F, 0xA5, 0x78, 0xFF, 0xFF, 0x32, 0x40, 0x02, 0x2A, 0x05, 0x00, 0x63, 0x46, 0x02, 0x64, + 0x06, 0xFA, 0x26, 0x46, 0x4E, 0x00, 0x32, 0x40, 0x08, 0x2A, 0x05, 0x00, 0x63, 0x46, 0x80, 0x60, + 0x02, 0x64, 0x06, 0xFA, 0x26, 0x46, 0xD8, 0xF3, 0x63, 0x45, 0x66, 0x41, 0x65, 0x46, 0x8C, 0xFA, + 0x60, 0x40, 0x01, 0x36, 0x06, 0x00, 0x02, 0x36, 0x04, 0x00, 0x04, 0x36, 0x02, 0x00, 0x05, 0x3A, + 0x02, 0x00, 0x00, 0x64, 0x01, 0x00, 0x01, 0x64, 0x6F, 0xFA, 0x79, 0xF3, 0x7A, 0xF1, 0xFF, 0xFF, + 0xA0, 0x84, 0x65, 0x43, 0x02, 0x02, 0x79, 0xF3, 0xFF, 0xFF, 0x60, 0x41, 0x0F, 0x60, 0xAE, 0x65, + 0xD8, 0xF3, 0xFF, 0xFF, 0xE0, 0x84, 0x44, 0xD3, 0x61, 0x45, 0xA4, 0x80, 0xFF, 0xFF, 0x04, 0x02, + 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0xFC, 0x03, 0xA4, 0x84, 0x7B, 0xFB, 0x6F, 0xF0, 0x60, 0x47, + 0x90, 0x84, 0x6F, 0xFA, 0x60, 0x47, 0x60, 0x45, 0x80, 0x64, 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, + 0xFC, 0x03, 0xA4, 0x84, 0x70, 0xF0, 0x70, 0xFA, 0x00, 0x61, 0xE8, 0x84, 0xFF, 0xFF, 0x02, 0x05, + 0xDD, 0x81, 0xFB, 0x01, 0xE1, 0x81, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, 0x0E, 0xFA, 0x66, 0x43, + 0x0C, 0xF4, 0x07, 0xFC, 0x43, 0x43, 0x02, 0xFE, 0x1D, 0xF0, 0x1C, 0x60, 0x9A, 0x62, 0xC0, 0x64, + 0xC0, 0x84, 0xA2, 0xD1, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xC0, 0x84, + 0xA2, 0xDB, 0x2A, 0xF2, 0x63, 0x45, 0x0C, 0xB4, 0x08, 0x3A, 0x0A, 0x00, 0xDC, 0xF3, 0x23, 0x46, + 0x07, 0xB4, 0xFD, 0xA0, 0x06, 0xF2, 0x26, 0x46, 0x03, 0x03, 0x60, 0x40, 0x02, 0x2A, 0x0D, 0x00, + 0x2A, 0xF2, 0x35, 0xF0, 0x60, 0x40, 0xA4, 0x36, 0x0B, 0x00, 0x08, 0x2B, 0x0C, 0x00, 0x23, 0x46, + 0x22, 0xF2, 0x26, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x06, 0x02, 0xC5, 0x60, 0x5B, 0x78, 0xFF, 0xFF, + 0xC5, 0x60, 0x55, 0x78, 0xFF, 0xFF, 0x23, 0x46, 0x1E, 0xF2, 0x26, 0x46, 0x44, 0x4C, 0x0F, 0x26, + 0x1D, 0x00, 0x00, 0xBC, 0x40, 0x45, 0x0B, 0x03, 0x00, 0x64, 0x23, 0x46, 0x1E, 0xFA, 0x26, 0x46, + 0xA2, 0xFF, 0xAF, 0x60, 0x58, 0x4E, 0x95, 0x78, 0xFF, 0xFF, 0xA3, 0xFF, 0x26, 0x46, 0x2A, 0xF0, + 0x2C, 0x44, 0x64, 0x40, 0x04, 0x27, 0x0A, 0x00, 0x23, 0x46, 0x22, 0xFA, 0x26, 0x46, 0x1B, 0xF2, + 0xFF, 0xFF, 0xE4, 0xA4, 0x3E, 0xFA, 0xC4, 0x60, 0xAD, 0x78, 0xFF, 0xFF, 0x3F, 0xF2, 0x02, 0xFA, + 0xA2, 0xFF, 0x16, 0xF0, 0xFF, 0xFF, 0x64, 0x44, 0x01, 0x26, 0xDC, 0x9C, 0xB3, 0xF3, 0x2A, 0xF2, + 0xDC, 0x83, 0xB3, 0xFD, 0x06, 0xF4, 0x01, 0xF8, 0x26, 0x46, 0x60, 0x40, 0x40, 0x2B, 0x18, 0x00, + 0x64, 0x44, 0x00, 0x65, 0xFF, 0xB4, 0xFC, 0xA4, 0x06, 0xF0, 0x03, 0x03, 0x64, 0x46, 0x0C, 0x0D, + 0x02, 0x65, 0x26, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, 0x02, 0x03, 0x60, 0x46, + 0xF9, 0x01, 0x01, 0xF2, 0xFF, 0xFF, 0xD4, 0x84, 0x01, 0xFA, 0x66, 0x44, 0x26, 0x46, 0x06, 0xFA, + 0x06, 0xF4, 0x00, 0xF2, 0x80, 0xFC, 0x40, 0x45, 0xAF, 0x60, 0x58, 0x4E, 0x95, 0x78, 0xFF, 0xFF, + 0xA3, 0xFF, 0x26, 0x46, 0x2C, 0x44, 0x0F, 0x26, 0x14, 0x00, 0x23, 0x46, 0x22, 0xFA, 0x26, 0x44, + 0x1E, 0xFA, 0x26, 0x46, 0x1B, 0xF2, 0xFF, 0xFF, 0xE4, 0xA4, 0x3E, 0xFA, 0x24, 0x60, 0x74, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0x6F, 0x00, 0xA3, 0x46, 0x22, 0xF2, 0x60, 0x45, 0xDC, 0x84, 0xD4, 0x80, 0x22, 0xFA, 0xA3, 0x46, + 0x6C, 0x02, 0x2A, 0xF0, 0xA3, 0x46, 0x1E, 0xF2, 0xA3, 0x46, 0x00, 0xBC, 0x00, 0xF2, 0x01, 0x02, + 0x64, 0x00, 0x44, 0x4C, 0x3F, 0xF0, 0x60, 0x43, 0x23, 0x46, 0x1E, 0xF4, 0x09, 0x60, 0x00, 0x65, + 0x3F, 0xF2, 0x26, 0x46, 0xC0, 0x84, 0xD4, 0x80, 0x60, 0x45, 0x57, 0x07, 0x80, 0xFC, 0x1B, 0xF2, + 0x06, 0xF2, 0x60, 0x41, 0x23, 0x46, 0x1E, 0xF4, 0x1B, 0xF0, 0x06, 0xF0, 0xC1, 0x81, 0x06, 0xFA, + 0x05, 0xFA, 0x9B, 0xFA, 0x65, 0x44, 0x3F, 0xFA, 0x64, 0x46, 0x00, 0xFC, 0x63, 0x46, 0x01, 0xF2, + 0x10, 0x61, 0xF2, 0xA4, 0x01, 0xFA, 0xC8, 0x83, 0x02, 0x64, 0x59, 0xD0, 0x58, 0xD8, 0xFD, 0x1F, + 0x06, 0x45, 0x24, 0x60, 0x74, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x25, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xA2, 0xFF, 0x00, 0xF4, 0x01, 0xF0, 0x0A, 0x18, 0x70, 0x67, + 0xA0, 0x80, 0xF0, 0x67, 0x06, 0x03, 0xC0, 0x84, 0x01, 0xFA, 0x25, 0x46, 0x25, 0x44, 0x80, 0xFC, + 0x05, 0xFA, 0xAF, 0x60, 0x58, 0x4E, 0x95, 0x78, 0xFF, 0xFF, 0xD4, 0xFE, 0xA3, 0xFF, 0x2C, 0x44, + 0x04, 0x27, 0x16, 0x00, 0x23, 0x46, 0x1E, 0xF2, 0x9E, 0xFC, 0x60, 0x46, 0x46, 0x46, 0x3F, 0xF2, + 0x00, 0xF4, 0x60, 0x47, 0x08, 0xFA, 0x26, 0x46, 0x2C, 0x43, 0x2A, 0xFC, 0x06, 0xF4, 0x00, 0x64, + 0x00, 0xFA, 0x01, 0xF0, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0x01, 0xFA, 0x26, 0x46, 0x1D, 0x00, + 0x00, 0x66, 0x46, 0x46, 0xBF, 0x60, 0xEB, 0x78, 0xFF, 0xFF, 0xA3, 0x46, 0x1E, 0xF0, 0x9E, 0xFC, + 0x00, 0x63, 0x33, 0x85, 0xA3, 0x46, 0x0D, 0x03, 0xA3, 0x46, 0x22, 0xF2, 0x0F, 0x65, 0xA4, 0x85, + 0xD4, 0x84, 0x22, 0xFA, 0xA3, 0x46, 0xA2, 0xFF, 0xAF, 0x60, 0x58, 0x4E, 0x95, 0x78, 0xFF, 0xFF, + 0xA3, 0xFF, 0x26, 0x46, 0xC5, 0x60, 0x5B, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0x32, 0xF0, 0x60, 0x40, + 0x08, 0x2A, 0x5C, 0x00, 0x01, 0x2B, 0x2F, 0x00, 0x64, 0x40, 0x01, 0x2A, 0x2C, 0x00, 0xB8, 0xF1, + 0x27, 0x60, 0x8A, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, + 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, + 0x1B, 0xF2, 0xFF, 0xFF, 0x60, 0x45, 0xB8, 0xF1, 0x27, 0x60, 0x90, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, + 0xD8, 0x80, 0xC4, 0x84, 0x0B, 0x03, 0x07, 0x05, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, + 0x09, 0x04, 0xC6, 0xFE, 0x07, 0x00, 0x00, 0x64, 0xB8, 0x84, 0xA2, 0xDB, 0x8A, 0xFF, 0x20, 0x60, + 0x00, 0x75, 0x88, 0xFF, 0x2B, 0x00, 0xB8, 0xF1, 0x27, 0x60, 0x88, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, + 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, + 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x1B, 0xF2, 0xFF, 0xFF, 0x60, 0x45, 0xB8, 0xF1, + 0x27, 0x60, 0x8E, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xD8, 0x80, 0xC4, 0x84, 0x0B, 0x03, 0x07, 0x05, + 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x09, 0x04, 0xC6, 0xFE, 0x07, 0x00, 0x00, 0x64, + 0xB8, 0x84, 0xA2, 0xDB, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x07, 0xF4, 0xFF, 0xFF, + 0x22, 0xF2, 0x26, 0x46, 0x0F, 0xB4, 0xDC, 0x85, 0xB8, 0xF1, 0x27, 0x60, 0x8C, 0x64, 0xA0, 0xD3, + 0xFF, 0xFF, 0xD8, 0x80, 0xC4, 0x84, 0x0B, 0x03, 0x07, 0x05, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, + 0xA2, 0xDB, 0x09, 0x04, 0xC6, 0xFE, 0x07, 0x00, 0x00, 0x64, 0xB8, 0x84, 0xA2, 0xDB, 0x8A, 0xFF, + 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x27, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x3B, 0x12, 0x00, + 0xB8, 0xF1, 0x27, 0x60, 0x9A, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, + 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, + 0x88, 0xFF, 0x13, 0x00, 0x02, 0x3B, 0x11, 0x00, 0xB8, 0xF1, 0x27, 0x60, 0x9C, 0x64, 0xA0, 0xD3, + 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, + 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0xC6, 0x60, 0x85, 0x78, 0xFF, 0xFF, + 0xBF, 0x60, 0xEB, 0x78, 0xFF, 0xFF, 0x24, 0x60, 0x74, 0x64, 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, + 0xD8, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0xBF, 0x60, 0xEB, 0x78, 0xFF, 0xFF, 0x24, 0x60, + 0x74, 0x62, 0x24, 0x60, 0x58, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0xF8, 0xFE, 0x00, 0x66, 0x46, 0x46, 0xBF, 0x60, 0xEB, 0x78, 0xFF, 0xFF, + 0x2A, 0xF2, 0x58, 0x63, 0x60, 0x47, 0x01, 0x27, 0x64, 0x63, 0x31, 0x60, 0x28, 0x62, 0x61, 0x5C, + 0xA2, 0xD9, 0xBD, 0xD0, 0xBD, 0xD0, 0x64, 0x45, 0x64, 0x41, 0xBD, 0xD0, 0x00, 0xF4, 0x04, 0xF8, + 0x83, 0xFA, 0x82, 0xF8, 0xA6, 0x46, 0x02, 0xB0, 0x5E, 0x63, 0x04, 0x03, 0x64, 0x63, 0x03, 0xB0, + 0x02, 0x3A, 0x6C, 0x63, 0x3F, 0xF2, 0xBD, 0xD0, 0xBD, 0xD0, 0x64, 0x45, 0x64, 0x41, 0xBD, 0xD0, + 0xA6, 0x46, 0x07, 0xF8, 0x86, 0xFA, 0x85, 0xF8, 0x60, 0x47, 0x08, 0xFA, 0x31, 0x60, 0x28, 0x62, + 0xA2, 0xD1, 0x26, 0x46, 0x64, 0x41, 0x2F, 0x58, 0xFF, 0xFF, 0xA9, 0xF5, 0x00, 0xF2, 0x26, 0x46, + 0x31, 0xF0, 0x39, 0x18, 0x66, 0x41, 0x1C, 0x60, 0xBA, 0x65, 0x64, 0x47, 0x00, 0x7F, 0xA9, 0xF1, + 0xE0, 0x84, 0x44, 0xD3, 0x64, 0x43, 0x11, 0x18, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xFC, 0x1B, + 0x66, 0x44, 0x64, 0x46, 0x80, 0xF0, 0x60, 0x46, 0x80, 0xF8, 0x65, 0x46, 0x65, 0x43, 0x80, 0xF0, + 0x01, 0xFA, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x0B, 0x00, 0x64, 0x46, 0x62, 0x43, 0x00, 0xF2, + 0xA3, 0xDB, 0x60, 0x46, 0x80, 0xF0, 0x81, 0xFC, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x60, 0x43, + 0x61, 0x46, 0x1E, 0x60, 0xBC, 0x61, 0xA1, 0xD3, 0x1E, 0x60, 0xFE, 0x7C, 0xD0, 0x80, 0xFF, 0xFF, + 0x07, 0x03, 0xA0, 0xDD, 0xDA, 0x9C, 0xA1, 0xD9, 0x49, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xA1, 0xDB, + 0xC6, 0x60, 0x40, 0x78, 0xFF, 0xFF, 0x20, 0x7C, 0x72, 0x44, 0xFF, 0xB4, 0xD0, 0x80, 0xFF, 0xFF, + 0x02, 0x04, 0xD0, 0x84, 0xFB, 0x01, 0xE0, 0x83, 0xA9, 0xF3, 0x02, 0xA3, 0x43, 0x93, 0xA9, 0xF3, + 0xFF, 0xFF, 0x02, 0xA5, 0xD7, 0x80, 0x04, 0xA5, 0x08, 0x24, 0x65, 0x43, 0x66, 0x41, 0x63, 0x46, + 0x05, 0xF2, 0x00, 0xF0, 0x81, 0xF0, 0x02, 0x18, 0x64, 0x46, 0x81, 0xF8, 0x07, 0x1B, 0x1C, 0x60, + 0xBA, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD9, 0x02, 0x00, 0x65, 0x46, 0x00, 0xF8, + 0xA9, 0xF3, 0x63, 0x45, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xD4, 0x80, 0x01, 0x18, 0xFA, 0x04, + 0x80, 0xF8, 0x65, 0x46, 0x00, 0xFA, 0x06, 0xF2, 0xFF, 0xFF, 0x00, 0x7E, 0x06, 0xFA, 0x61, 0x46, + 0x31, 0xF0, 0x66, 0x41, 0x1C, 0x60, 0xBA, 0x65, 0x64, 0x47, 0x00, 0x7F, 0xA9, 0xF1, 0xE0, 0x84, + 0x44, 0xD3, 0x64, 0x43, 0x11, 0x18, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xFC, 0x1B, 0x66, 0x44, + 0x64, 0x46, 0x80, 0xF0, 0x60, 0x46, 0x80, 0xF8, 0x65, 0x46, 0x65, 0x43, 0x80, 0xF0, 0x01, 0xFA, + 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x0B, 0x00, 0x64, 0x46, 0x62, 0x43, 0x00, 0xF2, 0xA3, 0xDB, + 0x60, 0x46, 0x80, 0xF0, 0x81, 0xFC, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x60, 0x43, 0x61, 0x46, + 0x2F, 0xF2, 0x30, 0xF0, 0x31, 0xF0, 0x64, 0x45, 0x46, 0x43, 0x63, 0x46, 0x03, 0xFA, 0x06, 0xF2, + 0x84, 0xF8, 0x00, 0x7E, 0x06, 0xFA, 0x05, 0xF8, 0xA3, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0xDC, 0xF3, + 0x2A, 0xF2, 0x07, 0xB0, 0x03, 0x3A, 0x2A, 0x00, 0x00, 0xF4, 0x09, 0xF2, 0x60, 0x45, 0x80, 0x3A, + 0x05, 0x00, 0x0E, 0xF2, 0xFF, 0xFF, 0x02, 0xB0, 0x0F, 0xF2, 0x20, 0x03, 0x60, 0x47, 0x00, 0x3A, + 0x1D, 0x00, 0x60, 0x41, 0x00, 0x36, 0x13, 0x00, 0xDA, 0x85, 0x2D, 0x60, 0x7A, 0x63, 0xBD, 0xD1, + 0xFF, 0xFF, 0xD1, 0x80, 0xFF, 0xFF, 0x12, 0x02, 0x60, 0xFE, 0xBD, 0xD3, 0xA5, 0xD0, 0xDE, 0x85, + 0xD0, 0x80, 0xCD, 0x81, 0x0B, 0x02, 0xF9, 0x02, 0x20, 0xFE, 0x00, 0x64, 0x0A, 0x00, 0x26, 0x46, + 0x48, 0xFE, 0x65, 0x40, 0x40, 0x3A, 0x02, 0x00, 0x01, 0x64, 0x03, 0x00, 0x08, 0xFE, 0x20, 0xFE, + 0x00, 0x64, 0x40, 0x48, 0x26, 0x46, 0x2D, 0x58, 0xFF, 0xFF, 0x2D, 0x60, 0x52, 0x62, 0xA2, 0xD3, + 0x18, 0xF2, 0x60, 0x40, 0x01, 0x26, 0x2A, 0xFA, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x26, + 0x03, 0x00, 0xC7, 0x60, 0x6D, 0x78, 0xFF, 0xFF, 0x3F, 0xF0, 0x32, 0x40, 0x10, 0x2A, 0x20, 0x00, + 0x2C, 0xF0, 0x64, 0x41, 0x60, 0x40, 0x40, 0x27, 0x1B, 0x00, 0xCD, 0x81, 0xDD, 0x81, 0x18, 0x03, + 0x17, 0x03, 0x64, 0x40, 0x01, 0x26, 0x14, 0x00, 0x01, 0x61, 0x13, 0x00, 0xB8, 0xF1, 0x27, 0x60, + 0xA0, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, + 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x23, 0x00, + 0x00, 0x61, 0x60, 0x40, 0x18, 0x36, 0x1F, 0x00, 0xC5, 0x60, 0x58, 0x4F, 0x78, 0x78, 0xFF, 0xFF, + 0x0F, 0xF0, 0xEB, 0xF1, 0x64, 0x44, 0x60, 0x22, 0x19, 0x00, 0xDC, 0xF3, 0xFF, 0xFF, 0x07, 0xB4, + 0xFD, 0xA0, 0x2A, 0xF2, 0x03, 0x02, 0x08, 0xB0, 0xFF, 0xFF, 0x10, 0x02, 0x32, 0xF2, 0x33, 0xF2, + 0xD0, 0x80, 0xEC, 0xF1, 0x0B, 0x02, 0xD0, 0x80, 0x34, 0xF2, 0x08, 0x02, 0xED, 0xF1, 0xFF, 0xFF, + 0xD0, 0x80, 0x0F, 0xF0, 0x03, 0x02, 0xC7, 0x60, 0xB9, 0x78, 0xFF, 0xFF, 0x00, 0xF4, 0xAA, 0x60, + 0xAA, 0x65, 0x09, 0xF2, 0x5A, 0xD0, 0xD4, 0x80, 0x03, 0x64, 0x4F, 0x02, 0xD0, 0x80, 0x00, 0x64, + 0x5A, 0xD0, 0x4B, 0x02, 0x64, 0x45, 0xD4, 0x80, 0xF8, 0x7F, 0x08, 0x02, 0x5A, 0xD0, 0x26, 0x46, + 0x64, 0x45, 0x23, 0xF0, 0x20, 0x67, 0xB0, 0x84, 0xA2, 0xDA, 0x0B, 0x00, 0xD4, 0x80, 0x1D, 0x60, + 0x60, 0x64, 0x16, 0x02, 0x5A, 0xD0, 0x26, 0x46, 0x64, 0x45, 0x23, 0xF0, 0x40, 0x67, 0xB0, 0x84, + 0xA2, 0xDA, 0x65, 0x44, 0x88, 0x3A, 0x07, 0x00, 0x77, 0x37, 0x08, 0x00, 0x78, 0x37, 0x06, 0x00, + 0x8E, 0x37, 0x04, 0x00, 0x2A, 0x00, 0x81, 0x3A, 0x28, 0x00, 0x80, 0x37, 0x00, 0x61, 0x25, 0x00, + 0xD4, 0x80, 0x01, 0x60, 0x00, 0x64, 0x5A, 0xD0, 0x20, 0x02, 0xD0, 0x80, 0x5A, 0xD0, 0x1D, 0x02, + 0x26, 0x46, 0x64, 0x47, 0x7F, 0xB4, 0xFD, 0xA0, 0x09, 0x03, 0x17, 0x07, 0x32, 0x40, 0x02, 0x26, + 0x47, 0x00, 0x23, 0xF0, 0x60, 0x67, 0xB0, 0x84, 0xA2, 0xDA, 0x42, 0x00, 0x0F, 0xF2, 0x32, 0x40, + 0x02, 0x26, 0x3E, 0x00, 0xF2, 0xF3, 0xFF, 0xFF, 0x02, 0xBC, 0xF2, 0xFB, 0xEB, 0x60, 0x58, 0x4F, + 0xA5, 0x78, 0xFF, 0xFF, 0xC7, 0x60, 0xC3, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x61, 0x40, 0x01, 0x2A, + 0x12, 0x00, 0xB8, 0xF1, 0x27, 0x60, 0xA0, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, + 0xD0, 0x80, 0x04, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0x04, 0x00, 0x8A, 0xFF, 0x20, 0x60, + 0x00, 0x75, 0x88, 0xFF, 0x6E, 0x00, 0x0F, 0xF2, 0x81, 0xF1, 0x2A, 0xF2, 0x60, 0x40, 0x20, 0x2A, + 0x12, 0x00, 0x5E, 0x63, 0x60, 0x40, 0x02, 0x2B, 0x64, 0x63, 0xBD, 0xD2, 0xBD, 0xD2, 0xD0, 0x80, + 0x82, 0xF1, 0x08, 0x02, 0xD0, 0x80, 0xA3, 0xD2, 0x83, 0xF1, 0x04, 0x02, 0xD0, 0x80, 0xFF, 0xFF, + 0x01, 0x02, 0x06, 0x00, 0x56, 0x00, 0x2A, 0xF2, 0xFF, 0xFF, 0xFF, 0xFF, 0x48, 0x36, 0x51, 0x00, + 0xF2, 0xF3, 0xFF, 0xFF, 0x02, 0xBC, 0xF2, 0xFB, 0x59, 0x00, 0x26, 0x46, 0x2A, 0xF2, 0xFF, 0xFF, + 0xFF, 0xFF, 0x0C, 0x26, 0x46, 0x00, 0xB0, 0x36, 0x15, 0x00, 0x10, 0x36, 0x13, 0x00, 0x30, 0x36, + 0x11, 0x00, 0xC0, 0x36, 0x02, 0x00, 0xA0, 0x3A, 0x12, 0x00, 0x81, 0xF1, 0x32, 0xF2, 0x33, 0xF2, + 0xD0, 0x80, 0x82, 0xF1, 0x36, 0x02, 0xD0, 0x80, 0x34, 0xF2, 0x83, 0xF1, 0x32, 0x02, 0xD0, 0x80, + 0xFF, 0xFF, 0x2F, 0x02, 0xDB, 0x60, 0x58, 0x4F, 0xD2, 0x78, 0xFF, 0xFF, 0x26, 0x00, 0x50, 0x3A, + 0x05, 0x00, 0xEF, 0x60, 0x58, 0x4F, 0xE3, 0x78, 0xFF, 0xFF, 0x1F, 0x00, 0x40, 0x3A, 0x05, 0x00, + 0xE8, 0x60, 0x58, 0x4F, 0x60, 0x78, 0xFF, 0xFF, 0x18, 0x00, 0x80, 0x3A, 0x15, 0x00, 0x81, 0xF1, + 0x32, 0xF2, 0x33, 0xF2, 0xD0, 0x80, 0x82, 0xF1, 0x14, 0x02, 0xD0, 0x80, 0x34, 0xF2, 0x83, 0xF1, + 0x10, 0x02, 0xD0, 0x80, 0xFF, 0xFF, 0x0D, 0x02, 0xDF, 0x60, 0x58, 0x4F, 0x28, 0x78, 0xFF, 0xFF, + 0x20, 0x60, 0x58, 0x4F, 0xBF, 0x78, 0xFF, 0xFF, 0x04, 0x00, 0x66, 0x44, 0x00, 0xA8, 0xFF, 0xFF, + 0x0A, 0x03, 0x26, 0x46, 0x24, 0x60, 0x74, 0x64, 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, 0xD8, 0x78, + 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0xC5, 0x60, 0x58, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0x3B, 0xF0, + 0x60, 0x40, 0x40, 0x2B, 0x1E, 0x00, 0xC0, 0x60, 0x00, 0x64, 0x64, 0x40, 0x20, 0x2B, 0x19, 0x00, + 0x22, 0xF2, 0xFF, 0xFF, 0x04, 0xB4, 0xFF, 0xFF, 0x14, 0x03, 0xC0, 0x60, 0x00, 0x64, 0x26, 0x46, + 0xA0, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0x23, 0xF2, 0x10, 0xBD, 0xB4, 0x9C, 0x3F, 0xF2, + 0x23, 0xF8, 0x3F, 0xF2, 0xFF, 0xFF, 0xF8, 0xA4, 0x3F, 0xFA, 0x00, 0xF4, 0x60, 0x47, 0x08, 0xFA, + 0x26, 0x46, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, 0x58, 0x64, 0xA2, 0xDB, 0x26, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xF8, 0xFE, 0xCB, 0x01, 0x00, 0x60, 0x30, 0x61, + 0xAE, 0x60, 0x58, 0x4D, 0xC4, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0x60, 0xFB, 0x00, 0x60, 0x30, 0x61, + 0xAE, 0x60, 0x58, 0x4D, 0xC4, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0x5F, 0xFB, 0x00, 0x60, 0x02, 0x61, + 0xAE, 0x60, 0x58, 0x4D, 0xC4, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0x66, 0xFB, 0x10, 0x60, 0x26, 0x62, + 0xC9, 0x60, 0xC7, 0x64, 0xA2, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x01, 0x64, 0xDC, 0xFB, 0xF2, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, 0xF2, 0xFB, 0x0F, 0x60, 0xF0, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x00, 0x60, 0x14, 0x63, 0x01, 0x60, 0xC4, 0x61, 0x28, 0x60, 0x3E, 0x64, + 0x58, 0xD1, 0x59, 0xD9, 0xFD, 0x1F, 0x00, 0x60, 0x88, 0x63, 0x27, 0x60, 0xB4, 0x61, 0x28, 0x60, + 0x54, 0x64, 0x58, 0xD1, 0x59, 0xD9, 0xFD, 0x1F, 0x28, 0x60, 0x2C, 0x62, 0xA2, 0xD1, 0xFF, 0xFF, + 0x64, 0x45, 0xA9, 0xF1, 0x66, 0x41, 0x64, 0x46, 0x36, 0xF2, 0xFF, 0xFF, 0x65, 0x40, 0x01, 0x36, + 0x22, 0x64, 0x36, 0xFA, 0x61, 0x46, 0x32, 0x45, 0x28, 0x60, 0x3C, 0x62, 0xA2, 0xD1, 0x10, 0x67, + 0xB4, 0x85, 0x64, 0x40, 0x01, 0x2A, 0x94, 0x85, 0x45, 0x52, 0xFF, 0x60, 0xE7, 0x65, 0x32, 0x41, + 0xA5, 0x81, 0x2D, 0x60, 0x1A, 0x62, 0xA2, 0xD1, 0x28, 0x60, 0x2C, 0x62, 0xA2, 0xD3, 0x64, 0x40, + 0x01, 0x2A, 0x0D, 0x00, 0x08, 0x65, 0xFF, 0xA0, 0xFF, 0xFF, 0x01, 0x03, 0x08, 0x00, 0x28, 0x60, + 0x30, 0x62, 0xA2, 0xD3, 0xB5, 0x81, 0x10, 0x65, 0x60, 0x40, 0x01, 0x26, 0xB5, 0x81, 0x41, 0x52, + 0x2D, 0x60, 0x1A, 0x62, 0xA2, 0xD3, 0x31, 0x60, 0x18, 0x63, 0xF0, 0x84, 0xF0, 0x84, 0xF0, 0x84, + 0x01, 0xB5, 0xF0, 0x84, 0xF0, 0x84, 0x03, 0xB4, 0x65, 0x5C, 0xA3, 0xD9, 0x31, 0x60, 0x1A, 0x63, + 0x02, 0xA8, 0xA3, 0xDB, 0x1B, 0x02, 0x07, 0x60, 0xD0, 0x64, 0x31, 0x60, 0x1C, 0x63, 0xA3, 0xDB, + 0x31, 0x60, 0x24, 0x63, 0xA3, 0xDB, 0x00, 0x60, 0xC8, 0x64, 0x31, 0x60, 0x1E, 0x63, 0xA3, 0xDB, + 0x31, 0x60, 0x26, 0x63, 0xA3, 0xDB, 0x00, 0x60, 0x64, 0x64, 0x31, 0x60, 0x20, 0x63, 0xA3, 0xDB, + 0x01, 0x60, 0x90, 0x64, 0x31, 0x60, 0x22, 0x63, 0xA3, 0xDB, 0x08, 0x00, 0x0A, 0x64, 0x31, 0x60, + 0x20, 0x63, 0xA3, 0xDB, 0x01, 0x64, 0x31, 0x60, 0x22, 0x63, 0xA3, 0xDB, 0x2D, 0x60, 0x1A, 0x62, + 0xA2, 0xD1, 0x01, 0x64, 0x64, 0x40, 0x40, 0x2A, 0x03, 0x00, 0x31, 0x60, 0x0E, 0x7C, 0xA4, 0xDB, + 0x12, 0x60, 0x28, 0x63, 0xBA, 0xF3, 0x0E, 0x61, 0x60, 0x45, 0x65, 0x44, 0xE8, 0x85, 0x05, 0x64, + 0xCD, 0x81, 0x02, 0x28, 0x00, 0x64, 0xBD, 0xDB, 0xF8, 0x02, 0x2D, 0x60, 0x78, 0x61, 0x27, 0x60, + 0xB6, 0x64, 0x20, 0x63, 0x58, 0xD1, 0x59, 0xD9, 0xFD, 0x1F, 0xBD, 0xF1, 0x80, 0xF9, 0x1A, 0x63, + 0x01, 0x60, 0x00, 0x61, 0x00, 0x64, 0x59, 0xDB, 0xFE, 0x1F, 0x40, 0x40, 0x01, 0x64, 0x87, 0xFB, + 0x28, 0x60, 0xCC, 0x61, 0xA1, 0xD3, 0x2E, 0x60, 0x96, 0x61, 0xFE, 0xA4, 0xE0, 0x84, 0x04, 0x24, + 0x0F, 0x00, 0xE0, 0x84, 0x41, 0x91, 0x2D, 0x60, 0xCC, 0x62, 0xA2, 0xD3, 0xA1, 0xD1, 0x2D, 0x60, + 0xC4, 0x62, 0xA0, 0x83, 0xA2, 0xDD, 0x59, 0xD1, 0x2D, 0x60, 0xC2, 0x62, 0xA0, 0x83, 0xA2, 0xDD, + 0xE5, 0xF3, 0x7F, 0xFB, 0x1B, 0x60, 0xC6, 0x61, 0xA1, 0xD3, 0xFF, 0xFF, 0x00, 0xB8, 0x10, 0x60, + 0x5C, 0x65, 0x0D, 0x03, 0x1B, 0x60, 0xCE, 0x63, 0xE5, 0xF3, 0xA3, 0xD1, 0xE0, 0x84, 0xC4, 0x84, + 0xA0, 0xD3, 0xFF, 0xFF, 0x01, 0xB0, 0xFF, 0xFF, 0x02, 0x02, 0xE5, 0xF9, 0x7F, 0xF9, 0xE5, 0xF3, + 0x01, 0x61, 0xCC, 0x84, 0xFF, 0xFF, 0x02, 0x03, 0xE1, 0x81, 0xFB, 0x01, 0xBA, 0xF3, 0x61, 0x45, + 0xA4, 0x80, 0xFF, 0xFF, 0x0B, 0x02, 0x00, 0xB8, 0x01, 0x63, 0x08, 0x03, 0xE8, 0x84, 0xFF, 0xFF, + 0x02, 0x24, 0x02, 0x00, 0xDF, 0x83, 0xFA, 0x01, 0xE5, 0xFD, 0x7F, 0xFD, 0x0F, 0x60, 0xF0, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0B, 0x04, 0x0F, 0x60, 0xF2, 0x62, 0x40, 0x60, 0x00, 0x64, + 0xA2, 0xDB, 0xC8, 0x60, 0xF7, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x7F, 0xF1, + 0x24, 0x60, 0x9A, 0x62, 0xA2, 0xD9, 0x0C, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x07, 0x64, + 0xD0, 0xFB, 0x0F, 0x60, 0xF2, 0x62, 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xC9, 0x60, 0x34, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xF0, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0xBE, 0xFE, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0x01, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0xE3, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x05, 0x3A, + 0x03, 0x00, 0x68, 0x60, 0xBA, 0x61, 0x11, 0x00, 0x04, 0x3A, 0x03, 0x00, 0x68, 0x60, 0xAE, 0x61, + 0x0C, 0x00, 0x03, 0x3A, 0x03, 0x00, 0x68, 0x60, 0xA2, 0x61, 0x07, 0x00, 0x02, 0x3A, 0x03, 0x00, + 0x68, 0x60, 0x96, 0x61, 0x02, 0x00, 0x68, 0x60, 0x8A, 0x61, 0x3C, 0x60, 0x00, 0x66, 0x01, 0x60, + 0xB8, 0x64, 0x0A, 0x63, 0x59, 0xD0, 0x58, 0xD9, 0xFD, 0x1F, 0x01, 0x60, 0xBE, 0x61, 0xE4, 0xF3, + 0x00, 0x66, 0x00, 0xA8, 0x04, 0x65, 0x01, 0x03, 0xA1, 0xDB, 0x1F, 0x60, 0x08, 0x63, 0x55, 0xD3, + 0xFF, 0xFF, 0x20, 0x7F, 0xBD, 0xDB, 0x59, 0xD3, 0xFF, 0xFF, 0x21, 0x7F, 0xBD, 0xDB, 0x59, 0xD3, + 0xFF, 0xFF, 0x22, 0x7F, 0xA3, 0xDB, 0x0F, 0x60, 0xF0, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, + 0x0B, 0x04, 0x0F, 0x60, 0xF2, 0x62, 0x40, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xC9, 0x60, 0x7B, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x24, 0x60, 0x9A, 0x62, 0x1F, 0x60, 0x06, 0x64, + 0xA2, 0xDB, 0x20, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x0F, 0x60, 0xF2, 0x62, 0x20, 0x60, + 0x00, 0x64, 0xA2, 0xDB, 0xC9, 0x60, 0xA0, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0xBE, 0xFE, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0xC5, 0xFE, 0x20, 0x40, 0x20, 0x2A, 0x08, 0x00, 0x10, 0x60, 0x02, 0x62, 0xA2, 0xD1, + 0x00, 0x60, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x0F, 0x60, 0xEA, 0x62, 0xA2, 0xD1, + 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x0F, 0x60, 0xF0, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x5A, 0xDB, 0x0E, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x64, + 0x3B, 0x42, 0x5A, 0xDB, 0x0F, 0x60, 0xF0, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x8B, 0xFB, + 0xFF, 0xFF, 0xC1, 0xFE, 0x10, 0x60, 0x1A, 0x62, 0xA2, 0xD1, 0x01, 0x60, 0xDF, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x24, 0x60, 0xA8, 0x63, 0x01, 0x64, 0xBD, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, + 0x0F, 0x60, 0xF0, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x08, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x0F, 0x60, 0xF2, 0x62, 0x00, 0x60, 0x08, 0x64, 0xA2, 0xDB, 0xC9, 0x60, 0xF3, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x0F, 0x60, 0xF0, 0x62, + 0xA2, 0xD1, 0x7F, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x8B, 0xF3, 0x00, 0x65, 0xD4, 0x80, + 0xFF, 0xFF, 0x0B, 0x03, 0x0F, 0x60, 0xF2, 0x62, 0x80, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xC9, 0x60, + 0xF3, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xDE, 0xFE, 0x0E, 0x04, 0x09, 0x64, + 0x3B, 0x42, 0x5A, 0xDB, 0x0F, 0x60, 0xF2, 0x62, 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xCA, 0x60, + 0x1D, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0A, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x24, 0x60, 0x9A, 0x62, 0x06, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x0F, 0x60, 0xF0, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x5A, 0xDB, 0xBE, 0xFE, 0xDA, 0xFE, 0x24, 0x60, 0x34, 0x61, 0xCA, 0x60, + 0x58, 0x4E, 0x57, 0x78, 0xFF, 0xFF, 0x24, 0x60, 0x22, 0x61, 0xCA, 0x60, 0x58, 0x4E, 0x57, 0x78, + 0xFF, 0xFF, 0x24, 0x60, 0x28, 0x61, 0xCA, 0x60, 0x58, 0x4E, 0x57, 0x78, 0xFF, 0xFF, 0x24, 0x60, + 0x46, 0x61, 0xCA, 0x60, 0x58, 0x4E, 0x57, 0x78, 0xFF, 0xFF, 0x24, 0x60, 0x4C, 0x61, 0xCA, 0x60, + 0x58, 0x4E, 0x57, 0x78, 0xFF, 0xFF, 0x24, 0x60, 0x58, 0x61, 0xCA, 0x60, 0x58, 0x4E, 0x57, 0x78, + 0xFF, 0xFF, 0xC5, 0xFE, 0x0E, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0xA1, 0xD3, + 0x0E, 0x57, 0x24, 0x00, 0x0E, 0xF2, 0x44, 0x4C, 0x80, 0xB0, 0x10, 0xB0, 0x0B, 0x03, 0x24, 0x60, + 0x74, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0x13, 0x00, 0x12, 0x02, 0xF0, 0x37, 0x09, 0x00, 0x02, 0xF0, 0x09, 0x60, 0x08, 0x64, + 0xD0, 0x80, 0xA2, 0xFF, 0xB0, 0xF3, 0x02, 0x02, 0xCC, 0x84, 0xB0, 0xFB, 0x24, 0x60, 0x74, 0x64, + 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, 0xD8, 0x78, 0xFF, 0xFF, 0x2C, 0x44, 0xAC, 0x86, 0x09, 0xF0, + 0xD9, 0x02, 0x37, 0x58, 0xFF, 0xFF, 0x1A, 0x60, 0x66, 0x63, 0x00, 0x64, 0xA3, 0xDB, 0x06, 0xA3, + 0x10, 0x60, 0x4C, 0x64, 0xBD, 0xDB, 0xBD, 0xDB, 0x06, 0x64, 0xA3, 0xDB, 0x00, 0x63, 0x10, 0x60, + 0x9E, 0x62, 0xA2, 0xDD, 0x10, 0x60, 0x4A, 0x62, 0xCF, 0x60, 0x16, 0x64, 0xA2, 0xDB, 0x10, 0x60, + 0x24, 0x62, 0xCE, 0x60, 0xE2, 0x64, 0xA2, 0xDB, 0x0F, 0x60, 0xEC, 0x62, 0x00, 0x60, 0x02, 0x64, + 0xA2, 0xDB, 0xCA, 0x60, 0xFB, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x68, 0x60, + 0x7E, 0x61, 0x3C, 0x60, 0x00, 0x66, 0x01, 0x60, 0xB8, 0x64, 0x0A, 0x63, 0x59, 0xD0, 0x58, 0xD9, + 0xFD, 0x1F, 0x01, 0x60, 0xBE, 0x61, 0xE4, 0xF3, 0x00, 0x66, 0x00, 0xA8, 0x04, 0x65, 0x01, 0x03, + 0xA1, 0xDB, 0x1F, 0x60, 0x08, 0x63, 0x55, 0xD3, 0xFF, 0xFF, 0x20, 0x7F, 0xBD, 0xDB, 0x59, 0xD3, + 0xFF, 0xFF, 0x21, 0x7F, 0xBD, 0xDB, 0x59, 0xD3, 0xFF, 0xFF, 0x22, 0x7F, 0xA3, 0xDB, 0x0F, 0x60, + 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0B, 0x04, 0x0F, 0x60, 0xEC, 0x62, 0x40, 0x60, + 0x00, 0x64, 0xA2, 0xDB, 0xCA, 0x60, 0xC7, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x24, 0x60, 0x9A, 0x62, 0x1F, 0x60, 0x06, 0x64, 0xA2, 0xDB, 0x20, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x2D, 0xFF, 0x0F, 0x60, 0xEC, 0x62, 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xCA, 0x60, 0xEC, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0xBE, 0xFE, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0x2E, 0x58, 0xFF, 0xFF, 0x10, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x0F, 0x60, 0xEA, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0xBA, 0xFE, 0x27, 0x60, 0xB6, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x03, 0xA8, + 0x02, 0xA8, 0x04, 0x03, 0x0F, 0x02, 0xCE, 0x60, 0xB3, 0x78, 0xFF, 0xFF, 0xCD, 0x60, 0xEF, 0x78, + 0xFF, 0xFF, 0x1F, 0x60, 0x80, 0x65, 0xA5, 0xD3, 0xFF, 0xFF, 0xF3, 0xB4, 0xA5, 0xDB, 0xCB, 0x60, + 0x22, 0x78, 0xFF, 0xFF, 0x01, 0x63, 0x1A, 0x60, 0x40, 0x64, 0xA0, 0xDD, 0x1F, 0x60, 0x80, 0x64, + 0x00, 0x63, 0xA0, 0xDD, 0x11, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0xBA, 0xFE, 0x02, 0x64, 0xDC, 0xFB, 0xF2, 0xF3, 0xFF, 0xFF, 0x01, 0xBC, 0xF2, 0xFB, + 0x44, 0x60, 0x44, 0x64, 0x81, 0xFB, 0x82, 0xFB, 0x83, 0xFB, 0xFF, 0xFF, 0x20, 0x40, 0x04, 0x2B, + 0x19, 0x00, 0x9B, 0xFE, 0x09, 0x04, 0xBB, 0xFE, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x80, 0x60, + 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x12, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x0F, 0x60, + 0xEC, 0x62, 0x80, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xCB, 0x60, 0x36, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, 0x0D, 0x64, 0x53, 0xFB, + 0x29, 0x60, 0xA4, 0x64, 0x54, 0xFB, 0x13, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x0F, 0x60, 0xCE, 0x61, + 0xA1, 0xD1, 0x02, 0x60, 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, 0x64, 0x40, 0x01, 0x2A, 0x07, 0x00, + 0x00, 0x64, 0xA1, 0xDB, 0x02, 0x65, 0xE9, 0x60, 0x58, 0x4E, 0x7B, 0x78, 0xFF, 0xFF, 0xCA, 0x60, + 0x58, 0x4E, 0xA7, 0x78, 0xFF, 0xFF, 0x1F, 0x60, 0x80, 0x62, 0x1A, 0x60, 0x40, 0x65, 0xA2, 0xD3, + 0xA5, 0xD1, 0x60, 0x40, 0x0C, 0x22, 0x04, 0x00, 0x04, 0x61, 0xD1, 0x80, 0xFF, 0xFF, 0x2D, 0x05, + 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x0F, 0x4E, 0xE4, 0x60, 0x58, 0x4F, 0xFB, 0x78, + 0xFF, 0xFF, 0x0E, 0x4F, 0x0F, 0x60, 0xEC, 0x62, 0x10, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xCB, 0x60, + 0x95, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x1F, 0x60, 0x80, 0x64, 0xA0, 0xD3, + 0xFF, 0xFF, 0x60, 0x40, 0x0C, 0x26, 0x11, 0x00, 0xFD, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, + 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x38, 0x00, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x0F, 0x4E, 0xEC, 0x60, 0x58, 0x4F, 0xB9, 0x78, 0xFF, 0xFF, 0x0E, 0x4F, 0x0F, 0x60, + 0xEC, 0x62, 0x10, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xCB, 0x60, 0xC2, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x14, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0xFD, 0x60, 0xFF, 0x65, 0x20, 0x44, + 0x24, 0x80, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x88, 0xF1, 0x19, 0x60, 0x86, 0x63, + 0xD3, 0x80, 0x20, 0x44, 0x05, 0x03, 0x10, 0xBC, 0x40, 0x40, 0xCD, 0x60, 0xE8, 0x78, 0xFF, 0xFF, + 0x89, 0xF3, 0xFF, 0xFF, 0xD0, 0x80, 0x20, 0x44, 0x06, 0x02, 0xD4, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, + 0xFF, 0xFF, 0x1E, 0x02, 0x72, 0x00, 0x10, 0xBC, 0x40, 0x40, 0x64, 0x42, 0x5A, 0xD1, 0x06, 0x63, + 0xA4, 0xD1, 0xC3, 0x83, 0x7F, 0xF9, 0xBD, 0xD1, 0x81, 0xF9, 0xBD, 0xD1, 0xFF, 0xFF, 0x82, 0xF9, + 0xBD, 0xD1, 0x83, 0xF9, 0x04, 0xA3, 0xBD, 0xD1, 0x2D, 0x60, 0x7A, 0x64, 0x64, 0x41, 0xDD, 0x81, + 0xFE, 0xB1, 0xA0, 0xD9, 0x04, 0x03, 0xBD, 0xD1, 0xC9, 0x81, 0x58, 0xD9, 0xFC, 0x02, 0x1E, 0x00, + 0xE5, 0xF3, 0x7F, 0xFB, 0x29, 0x60, 0xA4, 0x61, 0xA1, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, 0x2D, 0x60, + 0x7A, 0x63, 0x02, 0x02, 0x27, 0x60, 0xB8, 0x61, 0xA1, 0xD3, 0xBD, 0xDB, 0xDC, 0x84, 0xFE, 0xB4, + 0x59, 0xD1, 0xC8, 0x84, 0xBD, 0xD9, 0xFC, 0x02, 0xED, 0xF3, 0x72, 0x45, 0xEC, 0xF3, 0x94, 0x83, + 0x83, 0xFD, 0x94, 0x83, 0x82, 0xFD, 0x65, 0x5F, 0x02, 0x64, 0x81, 0xFB, 0x0F, 0x60, 0xEA, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0B, 0x04, 0x0F, 0x60, 0xEC, 0x62, 0x40, 0x60, 0x00, 0x64, + 0xA2, 0xDB, 0xCC, 0x60, 0x26, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x18, 0x64, + 0x3B, 0x42, 0x5A, 0xDB, 0x7F, 0xF1, 0x24, 0x60, 0x9A, 0x62, 0xA2, 0xD9, 0x1E, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x2D, 0xFF, 0x0F, 0x60, 0xEC, 0x62, 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xCC, 0x60, + 0x4D, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0xBE, 0xFE, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0xCC, 0x60, 0xAD, 0x78, 0xFF, 0xFF, 0x16, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0xFF, 0x60, 0xEF, 0x65, 0x20, 0x44, 0x24, 0x80, 0xCA, 0x60, 0x58, 0x4E, 0xA7, 0x78, 0xFF, 0xFF, + 0x17, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x02, 0x64, 0xDC, 0xFB, 0xF2, 0xF3, 0xFF, 0xFF, 0x01, 0xBC, + 0xF2, 0xFB, 0xF7, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, + 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0xDA, 0xFE, 0xC1, 0xFE, 0x1A, 0x60, 0x40, 0x62, 0xA2, 0xD1, 0x1A, 0x60, 0x6A, 0x62, + 0xA2, 0xD9, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x04, 0xFF, 0x0F, 0x60, 0xEC, 0x62, 0x00, 0x60, 0x06, 0x64, 0xA2, 0xDB, 0xCB, 0x60, + 0x22, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x1A, 0x60, 0x40, 0x61, 0x75, 0x60, 0x30, 0x65, 0xA1, 0xD3, + 0xFF, 0xFF, 0xFF, 0xA0, 0xE0, 0x84, 0x02, 0x02, 0x03, 0x60, 0xE8, 0x64, 0xD4, 0x80, 0xFF, 0xFF, + 0x01, 0x04, 0x65, 0x44, 0xA1, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0x79, 0xF3, 0x7A, 0xFB, 0x1F, 0x60, + 0x52, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xFF, 0x60, 0xDF, 0x65, 0x20, 0x44, 0x24, 0x80, 0xBF, 0xF1, + 0x1A, 0x60, 0x6A, 0x62, 0xA2, 0xD9, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, 0xA2, 0xDB, + 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0xF7, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, + 0x10, 0x26, 0x67, 0x00, 0x00, 0x64, 0xB5, 0xFB, 0xB6, 0xFB, 0xB7, 0xFB, 0x00, 0x75, 0x00, 0x72, + 0xBD, 0xF1, 0x80, 0xF9, 0x64, 0x44, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x93, 0xE6, 0xF1, + 0x86, 0xF9, 0x28, 0x60, 0xD2, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x01, 0xA8, 0xFF, 0xFF, 0x08, 0x02, + 0x01, 0x60, 0xB0, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x01, 0xA8, 0xFF, 0xFF, 0x01, 0x03, 0x02, 0x64, + 0x60, 0x41, 0x2D, 0x60, 0x28, 0x63, 0xBD, 0xD3, 0xA3, 0xD3, 0xFF, 0xB5, 0x65, 0x5C, 0xCD, 0x81, + 0x80, 0xBF, 0x0E, 0x03, 0x80, 0xBF, 0xBD, 0xDB, 0x65, 0x44, 0xC8, 0x84, 0xFF, 0xFF, 0x0B, 0x03, + 0x60, 0x45, 0xCD, 0x81, 0xA3, 0xD3, 0x07, 0x03, 0xCD, 0x81, 0x80, 0xBF, 0x01, 0x03, 0x80, 0xBC, + 0x60, 0x47, 0xBD, 0xDB, 0x00, 0x65, 0x64, 0x41, 0x2D, 0x60, 0x2A, 0x63, 0xBD, 0xD3, 0xFF, 0xFF, + 0x80, 0xB0, 0xFF, 0xFF, 0x01, 0x03, 0x60, 0x45, 0x60, 0x47, 0x80, 0xB0, 0xFF, 0xFF, 0x01, 0x03, + 0x60, 0x45, 0xC9, 0x81, 0xFF, 0xFF, 0xF2, 0x02, 0x65, 0x44, 0x7F, 0xB4, 0x02, 0x3A, 0x02, 0x00, + 0x0A, 0x64, 0x15, 0x00, 0x04, 0x3A, 0x02, 0x00, 0x14, 0x64, 0x11, 0x00, 0x0A, 0x3A, 0x02, 0x00, + 0x32, 0x64, 0x0D, 0x00, 0x0B, 0x3A, 0x02, 0x00, 0x37, 0x64, 0x09, 0x00, 0x10, 0x3A, 0x02, 0x00, + 0x50, 0x64, 0x05, 0x00, 0x16, 0x3A, 0x02, 0x00, 0x6E, 0x64, 0x01, 0x00, 0x14, 0x64, 0x7C, 0xFB, + 0x28, 0x00, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x0F, 0x60, 0xEC, 0x62, 0x00, 0x60, + 0x84, 0x64, 0xA2, 0xDB, 0xCD, 0x60, 0x40, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x0F, 0x60, 0xEA, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x80, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x0D, 0x03, + 0xA0, 0x84, 0xA2, 0xDB, 0x0F, 0x60, 0xEA, 0x62, 0xA2, 0xD1, 0xFF, 0x60, 0x7F, 0x61, 0xA1, 0x84, + 0x5A, 0xD1, 0x4A, 0xDB, 0xA1, 0x84, 0x5A, 0xDB, 0x04, 0x00, 0xBB, 0xFE, 0xCB, 0x60, 0x22, 0x78, + 0xFF, 0xFF, 0x28, 0x60, 0x2C, 0x62, 0xA2, 0xD1, 0x00, 0x65, 0x64, 0x40, 0x01, 0x36, 0x22, 0x65, + 0x64, 0x40, 0x07, 0x36, 0x01, 0x65, 0xA9, 0xF3, 0x66, 0x5C, 0x60, 0x46, 0x1F, 0x63, 0xE3, 0x83, + 0xB6, 0xF8, 0x02, 0xA6, 0x66, 0x44, 0xFC, 0x1F, 0x28, 0x60, 0x2C, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, + 0x60, 0x40, 0x07, 0x3A, 0x04, 0x00, 0xA9, 0xF3, 0x04, 0x65, 0x60, 0x46, 0xB6, 0xF8, 0x64, 0x46, + 0xA9, 0xF3, 0x32, 0x41, 0x60, 0x45, 0x08, 0xB1, 0x66, 0x41, 0x17, 0x03, 0x65, 0x46, 0x29, 0x60, + 0xA2, 0x62, 0xA2, 0xD3, 0x06, 0xF0, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0x80, 0xBF, + 0xB0, 0x84, 0x06, 0xFA, 0x66, 0x43, 0x02, 0xA3, 0x63, 0x46, 0x06, 0xF0, 0xFF, 0xFF, 0xB0, 0x84, + 0x06, 0xFA, 0x61, 0x46, 0x32, 0x44, 0x10, 0xBC, 0x40, 0x52, 0x1F, 0x60, 0x52, 0x62, 0x01, 0x64, + 0xA2, 0xDB, 0x0F, 0x4E, 0xE7, 0x60, 0x58, 0x4F, 0x51, 0x78, 0xFF, 0xFF, 0x0E, 0x4F, 0x0F, 0x60, + 0xEA, 0x62, 0xA2, 0xD1, 0xFF, 0x60, 0xFB, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x0F, 0x60, 0xEC, 0x62, + 0x00, 0x60, 0x04, 0x64, 0xA2, 0xDB, 0xCB, 0x60, 0x11, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x24, 0x60, + 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, + 0xBB, 0xFE, 0x20, 0x44, 0x04, 0x27, 0x12, 0x00, 0x10, 0x26, 0x02, 0x00, 0xDB, 0xFE, 0x16, 0x00, + 0x0F, 0x60, 0xCE, 0x61, 0xA1, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x36, 0x07, 0x00, 0x01, 0x64, + 0xA1, 0xDB, 0x01, 0x65, 0xE9, 0x60, 0x58, 0x4E, 0x7B, 0x78, 0xFF, 0xFF, 0x0F, 0x60, 0xD0, 0x62, + 0xA2, 0xD1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x01, 0x64, 0x8C, 0xFB, + 0xFF, 0x60, 0xEF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x03, 0x64, 0xDC, 0xFB, 0xF2, 0xF3, 0xFF, 0xFF, + 0xFE, 0xB4, 0xF2, 0xFB, 0xC1, 0xFE, 0x1E, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, + 0x15, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0xBB, 0xFE, 0xCF, 0x60, 0xD6, 0x78, 0xFF, 0xFF, 0x28, 0x60, + 0x2C, 0x62, 0xA2, 0xD1, 0x00, 0x65, 0x64, 0x40, 0x01, 0x36, 0x22, 0x65, 0xA9, 0xF3, 0x66, 0x5C, + 0x60, 0x46, 0x1F, 0x63, 0xE3, 0x83, 0xB6, 0xF8, 0x02, 0xA6, 0x66, 0x44, 0xFC, 0x1F, 0x64, 0x46, + 0x79, 0xF1, 0xA9, 0xF3, 0x7A, 0xF9, 0x02, 0xA4, 0xD8, 0xF3, 0x60, 0x45, 0x66, 0x41, 0x65, 0x46, + 0x8C, 0xFA, 0x60, 0x40, 0x01, 0x36, 0x06, 0x00, 0x02, 0x36, 0x04, 0x00, 0x04, 0x36, 0x02, 0x00, + 0x05, 0x3A, 0x02, 0x00, 0x00, 0x64, 0x01, 0x00, 0x01, 0x64, 0x6F, 0xFA, 0x79, 0xF3, 0x7A, 0xF1, + 0xFF, 0xFF, 0xA0, 0x84, 0x65, 0x43, 0x02, 0x02, 0x79, 0xF3, 0xFF, 0xFF, 0x60, 0x41, 0x0F, 0x60, + 0xAE, 0x65, 0xD8, 0xF3, 0xFF, 0xFF, 0xE0, 0x84, 0x44, 0xD3, 0x61, 0x45, 0xA4, 0x80, 0xFF, 0xFF, + 0x04, 0x02, 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0xFC, 0x03, 0xA4, 0x84, 0x7B, 0xFB, 0x6F, 0xF0, + 0x60, 0x47, 0x90, 0x84, 0x6F, 0xFA, 0x60, 0x47, 0x60, 0x45, 0x80, 0x64, 0xE8, 0x84, 0xA4, 0x80, + 0xFF, 0xFF, 0xFC, 0x03, 0xA4, 0x84, 0x70, 0xF0, 0x70, 0xFA, 0x00, 0x61, 0xE8, 0x84, 0xFF, 0xFF, + 0x02, 0x05, 0xDD, 0x81, 0xFB, 0x01, 0xE1, 0x81, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, 0x0E, 0xFA, + 0x66, 0x43, 0x0C, 0xF4, 0xA9, 0xF1, 0x02, 0x64, 0xC0, 0x85, 0x0C, 0x61, 0x32, 0x40, 0x08, 0x2A, + 0x15, 0x00, 0x29, 0x60, 0xA2, 0x62, 0xA2, 0xD3, 0x66, 0x41, 0x65, 0x46, 0x06, 0xF0, 0xE0, 0x84, + 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0x80, 0xBF, 0xB0, 0x83, 0x06, 0xFC, 0x66, 0x42, 0xFE, 0xA2, + 0x62, 0x46, 0x06, 0xF0, 0xFF, 0xFF, 0xB0, 0x84, 0x06, 0xFA, 0x61, 0x46, 0x1D, 0x64, 0x3B, 0x42, + 0x5A, 0xDB, 0x0B, 0x64, 0xDC, 0xFB, 0xF2, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, 0xF2, 0xFB, 0x01, 0x65, + 0xE9, 0x60, 0x58, 0x4E, 0x7B, 0x78, 0xFF, 0xFF, 0xE5, 0xF1, 0x7F, 0xF9, 0x0F, 0x60, 0xEA, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0B, 0x04, 0x0F, 0x60, 0xEC, 0x62, 0x40, 0x60, 0x00, 0x64, + 0xA2, 0xDB, 0xCE, 0x60, 0x76, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x7F, 0xF1, + 0x24, 0x60, 0x9A, 0x62, 0xA2, 0xD9, 0x1E, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x0F, 0x60, + 0xEC, 0x62, 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xCE, 0x60, 0x9A, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x5A, 0xDB, 0xBE, 0xFE, + 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x01, 0x64, 0x8C, 0xFB, 0xFF, 0x60, 0xDF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x1E, 0x64, 0x3B, 0x42, + 0x5A, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0x1C, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x06, 0x64, 0xDC, 0xFB, + 0xF2, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, 0xF2, 0xFB, 0xE5, 0xF1, 0x7F, 0xF9, 0x0F, 0x60, 0xEA, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x01, 0x64, 0x8C, 0xFB, 0xFF, 0x60, 0xDF, 0x65, 0x20, 0x44, 0x24, 0x80, + 0xA9, 0xF1, 0x66, 0x45, 0x64, 0x46, 0x66, 0x43, 0x02, 0xA3, 0x63, 0x46, 0x02, 0x64, 0x06, 0xFA, + 0x04, 0x63, 0x04, 0x61, 0x01, 0x60, 0xCE, 0x64, 0x58, 0xD1, 0x59, 0xD8, 0xFD, 0x1F, 0x65, 0x46, + 0x01, 0x65, 0xE9, 0x60, 0x58, 0x4E, 0x7B, 0x78, 0xFF, 0xFF, 0x1E, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x2F, 0x58, 0xFF, 0xFF, 0x1F, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x00, 0x64, 0x68, 0xFB, 0x69, 0xFB, + 0xA9, 0xF1, 0x0E, 0x64, 0x66, 0x41, 0x64, 0x42, 0x02, 0xA2, 0x62, 0x46, 0x06, 0xF0, 0xFF, 0x60, + 0xFC, 0x64, 0xA0, 0x84, 0x06, 0xFA, 0x61, 0x46, 0xDC, 0xF3, 0xFF, 0xFF, 0x04, 0xA8, 0x0F, 0x60, + 0xCE, 0x64, 0x07, 0x03, 0xA0, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x2A, 0x02, 0x00, 0x00, 0x63, + 0xA0, 0xDD, 0x01, 0x64, 0xDC, 0xFB, 0xF2, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, 0xF2, 0xFB, 0x0F, 0x60, + 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x0F, 0x60, 0xEC, 0x62, 0x00, 0x60, 0x02, 0x64, 0xA2, 0xDB, + 0xCA, 0x60, 0xFB, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xEA, 0x62, + 0xA2, 0xD1, 0x00, 0x60, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x28, 0x60, 0x3A, 0x64, 0xA0, 0xD3, 0x00, 0xF4, 0x60, 0x40, 0x01, 0x3A, 0x42, 0x00, 0x18, 0x65, + 0x22, 0x61, 0x02, 0x60, 0x00, 0x63, 0xA5, 0xD0, 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, + 0x04, 0x65, 0x64, 0x44, 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, 0x05, 0x03, 0x64, 0x47, 0x00, 0x7F, + 0xCD, 0x81, 0xBD, 0xDB, 0xF0, 0x02, 0x02, 0x60, 0x00, 0x63, 0xBD, 0xD3, 0xBD, 0xD3, 0x01, 0xA8, + 0xE0, 0x85, 0x27, 0x02, 0xC7, 0x83, 0xBD, 0xD3, 0xBD, 0xD3, 0x81, 0xA8, 0x0D, 0xA8, 0x21, 0x02, + 0x20, 0x02, 0xBD, 0xD3, 0xBD, 0xD3, 0x00, 0xA8, 0x60, 0xA8, 0x1B, 0x02, 0xBD, 0xD3, 0x19, 0x02, + 0x1D, 0xA8, 0xA3, 0xD1, 0x16, 0x02, 0xE3, 0xF9, 0x01, 0x60, 0xB8, 0x64, 0x63, 0x41, 0x0A, 0x63, + 0x59, 0xD1, 0x58, 0xD9, 0xFD, 0x1F, 0x59, 0xD1, 0x59, 0xD3, 0xFF, 0xFF, 0x60, 0x47, 0x64, 0x5E, + 0xD6, 0xFB, 0x59, 0xD1, 0x28, 0x60, 0x36, 0x64, 0xA0, 0xD9, 0x28, 0x60, 0xD6, 0x64, 0xA0, 0xD9, + 0x23, 0x00, 0x28, 0x60, 0x40, 0x64, 0xA0, 0xD3, 0xE3, 0xFB, 0x60, 0x40, 0x05, 0x3A, 0x03, 0x00, + 0x68, 0x60, 0xBA, 0x61, 0x11, 0x00, 0x04, 0x3A, 0x03, 0x00, 0x68, 0x60, 0xAE, 0x61, 0x0C, 0x00, + 0x03, 0x3A, 0x03, 0x00, 0x68, 0x60, 0xA2, 0x61, 0x07, 0x00, 0x02, 0x3A, 0x03, 0x00, 0x68, 0x60, + 0x96, 0x61, 0x02, 0x00, 0x68, 0x60, 0x8A, 0x61, 0x3C, 0x60, 0x00, 0x66, 0x01, 0x60, 0xB8, 0x64, + 0x0A, 0x63, 0x59, 0xD0, 0x58, 0xD9, 0xFD, 0x1F, 0x01, 0x60, 0xBE, 0x61, 0xE4, 0xF3, 0x00, 0x66, + 0x00, 0xA8, 0x04, 0x65, 0x01, 0x03, 0xA1, 0xDB, 0x1F, 0x60, 0x08, 0x63, 0x55, 0xD3, 0xFF, 0xFF, + 0x20, 0x7F, 0xBD, 0xDB, 0x59, 0xD3, 0xFF, 0xFF, 0x21, 0x7F, 0xBD, 0xDB, 0x59, 0xD3, 0xFF, 0xFF, + 0x22, 0x7F, 0xA3, 0xDB, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0B, 0x04, + 0x0F, 0x60, 0xEC, 0x62, 0x40, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xCF, 0x60, 0xA2, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x24, 0x60, 0x9A, 0x62, 0x1F, 0x60, 0x06, 0x64, 0xA2, 0xDB, + 0x20, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x0F, 0x60, 0xEC, 0x62, 0x20, 0x60, 0x00, 0x64, + 0xA2, 0xDB, 0xCF, 0x60, 0xC7, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, + 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xBE, 0xFE, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x40, 0x60, + 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2E, 0x58, 0xFF, 0xFF, 0x40, 0x64, 0x3B, 0x42, + 0x5A, 0xDB, 0xBC, 0xF1, 0x1A, 0x60, 0x6A, 0x62, 0xA2, 0xD9, 0x60, 0xF5, 0xEB, 0xF1, 0x2F, 0xF8, + 0xEC, 0xF1, 0x30, 0xF8, 0xED, 0xF1, 0x31, 0xF8, 0xBC, 0xF1, 0x19, 0xF8, 0xF8, 0x60, 0x80, 0x64, + 0x0E, 0xFA, 0x00, 0x64, 0x3E, 0xFA, 0xA9, 0xF1, 0x07, 0xF8, 0x00, 0x60, 0xD0, 0x63, 0x19, 0x60, + 0x84, 0x64, 0xA3, 0xDB, 0x44, 0x60, 0x44, 0x64, 0x81, 0xFB, 0x82, 0xFB, 0x83, 0xFB, 0x31, 0x44, + 0xF9, 0xB4, 0x40, 0x51, 0x00, 0x60, 0xD0, 0x63, 0x01, 0x60, 0x10, 0x65, 0xA3, 0xD3, 0xA5, 0xD1, + 0x04, 0xA4, 0xA3, 0xDB, 0xD0, 0x80, 0xA0, 0xD1, 0x0A, 0x06, 0x41, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xCC, 0x60, 0x5D, 0x78, 0xFF, 0xFF, 0x44, 0x47, + 0x28, 0x60, 0x2C, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xFF, 0xA4, 0xFF, 0xFF, 0x08, 0x07, 0x0E, 0x61, + 0x41, 0xD3, 0x32, 0x40, 0x08, 0x26, 0x03, 0x00, 0x10, 0xB0, 0xFF, 0xFF, 0xD3, 0x02, 0x42, 0x64, + 0x3B, 0x42, 0x5A, 0xDB, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0B, 0x04, + 0x0F, 0x60, 0xEC, 0x62, 0x40, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xD0, 0x60, 0x22, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x27, 0xD1, 0x7F, 0xF9, 0x24, 0x60, 0x9A, 0x62, 0xA2, 0xD9, + 0x1E, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x0F, 0x60, 0xEC, 0x62, 0x20, 0x60, 0x00, 0x64, + 0xA2, 0xDB, 0xD0, 0x60, 0x47, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, + 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xBE, 0xFE, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x40, 0x60, + 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x1A, 0x60, 0x6A, 0x62, 0x07, 0x60, 0xD0, 0x64, + 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x04, 0xFF, 0x27, 0x43, 0x06, 0xA3, 0xBD, 0xD3, 0x81, 0xFB, 0xBD, 0xD3, 0x82, 0xFB, + 0xA3, 0xD3, 0x83, 0xFB, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x0F, 0x60, 0xEC, 0x62, + 0x01, 0x60, 0x04, 0x64, 0xA2, 0xDB, 0xD0, 0x60, 0x79, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0xBC, 0xF1, 0x1A, 0x60, 0x6A, 0x62, 0xA2, 0xD9, 0x0F, 0x60, 0xEA, 0x62, 0xA2, 0xD1, + 0xFE, 0x60, 0xFF, 0x61, 0xA1, 0x84, 0x5A, 0xD1, 0x4A, 0xDB, 0xA1, 0x84, 0x5A, 0xDB, 0x0F, 0x60, + 0xEA, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0xCF, 0x60, 0xF2, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x08, 0x65, 0x20, 0x44, 0x34, 0x80, + 0x5F, 0xF5, 0xEB, 0xF1, 0x2F, 0xF8, 0xEC, 0xF1, 0x30, 0xF8, 0xED, 0xF1, 0x31, 0xF8, 0xBC, 0xF1, + 0x19, 0xF8, 0x80, 0x7E, 0xF8, 0x7F, 0x0E, 0xFA, 0x00, 0x64, 0x3E, 0xFA, 0xA9, 0xF1, 0x07, 0xF8, + 0x2B, 0xFA, 0xB0, 0x64, 0x2A, 0xFA, 0x27, 0x43, 0x06, 0xA3, 0xBD, 0xD1, 0x2C, 0xF8, 0x32, 0xF8, + 0xBD, 0xD1, 0x2D, 0xF8, 0x33, 0xF8, 0xA3, 0xD1, 0x2E, 0xF8, 0x34, 0xF8, 0x06, 0x63, 0x3F, 0xFC, + 0x1F, 0x60, 0x54, 0x61, 0xDC, 0xF3, 0xA1, 0xD3, 0x03, 0xA8, 0xAC, 0x83, 0x0F, 0x02, 0x0E, 0x03, + 0x1F, 0x60, 0x56, 0x61, 0xA1, 0xD1, 0x66, 0x45, 0x00, 0xF4, 0x09, 0xFC, 0x01, 0x64, 0x0A, 0xFA, + 0x0B, 0xF8, 0x1F, 0x60, 0x54, 0x61, 0x00, 0x64, 0xA1, 0xDB, 0x28, 0x00, 0x28, 0x60, 0x2E, 0x64, + 0xA0, 0xD3, 0x66, 0x45, 0x00, 0xF4, 0x60, 0x40, 0x01, 0x36, 0x16, 0x00, 0x02, 0x36, 0xC7, 0x00, + 0x03, 0x36, 0x07, 0x00, 0x04, 0x36, 0x10, 0x00, 0x05, 0x36, 0xC1, 0x00, 0x06, 0x36, 0x01, 0x00, + 0x0B, 0x00, 0x80, 0x64, 0x09, 0xFA, 0x01, 0x63, 0x0A, 0xFC, 0x00, 0x64, 0x0B, 0xFA, 0x2D, 0x60, + 0x54, 0x62, 0x03, 0x64, 0xA2, 0xDB, 0x0A, 0x00, 0x00, 0x64, 0x09, 0xFA, 0x01, 0x63, 0x0A, 0xFC, + 0x00, 0x64, 0x0B, 0xFA, 0x2D, 0x60, 0x54, 0x62, 0x01, 0x64, 0xA2, 0xDB, 0x24, 0x60, 0x74, 0x62, + 0x24, 0x60, 0x28, 0x64, 0xA2, 0xDB, 0x65, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0x00, 0x66, 0xDC, 0xF3, 0x46, 0x46, 0xFD, 0xA0, 0xC1, 0xFE, 0x02, 0x02, 0x2F, 0x58, + 0xFF, 0xFF, 0x01, 0x64, 0x69, 0xFB, 0x43, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x1A, 0x60, 0x44, 0x62, + 0xA2, 0xD3, 0xFF, 0xFF, 0x64, 0xA4, 0xA2, 0xDB, 0x1A, 0x60, 0x44, 0x62, 0xA2, 0xD1, 0x1A, 0x60, + 0x6A, 0x62, 0xA2, 0xD9, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, 0xA2, 0xDB, 0x02, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x0F, 0x60, 0xEC, 0x62, 0x00, 0x60, 0x0C, 0x64, 0xA2, 0xDB, + 0xD1, 0x60, 0x2E, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xEA, 0x62, + 0xA2, 0xD1, 0x00, 0x60, 0x08, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x56, 0x03, 0xA0, 0x84, 0xA2, 0xDB, + 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0x00, 0x64, 0x69, 0xFB, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x26, 0x46, + 0x00, 0xF4, 0x09, 0xF2, 0x0A, 0xF2, 0x00, 0xA8, 0x0B, 0xF2, 0x02, 0xA8, 0x16, 0x02, 0x00, 0xA8, + 0x1A, 0x02, 0x19, 0x02, 0x26, 0x46, 0x24, 0x60, 0x74, 0x64, 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, + 0xD8, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0x20, 0x40, 0x08, 0x2A, 0x03, 0x00, 0xD3, 0x60, + 0x48, 0x78, 0xFF, 0xFF, 0xD9, 0x60, 0x68, 0x78, 0xFF, 0xFF, 0x09, 0xF2, 0x0A, 0xF2, 0x80, 0xA8, + 0x0B, 0xF2, 0x02, 0xA8, 0xE4, 0x03, 0x44, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x0B, 0xF2, 0x26, 0x46, + 0x40, 0x59, 0x02, 0x60, 0x00, 0x61, 0x2F, 0xF2, 0xA1, 0xDB, 0x30, 0xF2, 0x41, 0x58, 0x59, 0xDB, + 0x31, 0xF2, 0x59, 0xDB, 0x26, 0x46, 0x24, 0x60, 0x74, 0x64, 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, + 0xD8, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0x03, 0x65, 0xE9, 0x60, 0x58, 0x4E, 0x4C, 0x78, + 0xFF, 0xFF, 0xDC, 0x60, 0xAA, 0x78, 0xFF, 0xFF, 0xFF, 0x60, 0xFB, 0x64, 0xA0, 0x84, 0xA2, 0xDB, + 0x00, 0x64, 0x69, 0xFB, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x20, 0x40, 0x08, 0x2A, + 0x03, 0x00, 0xCF, 0x60, 0xF2, 0x78, 0xFF, 0xFF, 0xD7, 0x60, 0xDD, 0x78, 0xFF, 0xFF, 0x01, 0x63, + 0x09, 0xFC, 0x32, 0x40, 0x08, 0x26, 0x1A, 0x00, 0x28, 0x60, 0x2C, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, + 0x60, 0x40, 0x0B, 0x36, 0x03, 0x00, 0xD0, 0x60, 0xEC, 0x78, 0xFF, 0xFF, 0x01, 0x64, 0xA2, 0xDB, + 0x2D, 0x60, 0x56, 0x62, 0x0B, 0x64, 0xA2, 0xDB, 0x2D, 0x60, 0x54, 0x62, 0x02, 0x64, 0xA2, 0xDB, + 0xA9, 0xF1, 0x66, 0x41, 0x64, 0x46, 0x22, 0x64, 0x36, 0xFA, 0x61, 0x46, 0x01, 0x64, 0x0A, 0xFA, + 0x00, 0x64, 0x0B, 0xFA, 0x01, 0x64, 0x69, 0xFB, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, 0x28, 0x64, 0xA2, 0xDB, 0x65, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x00, 0x66, 0xDC, 0xF3, 0x46, 0x46, 0xFD, 0xA0, 0xC1, 0xFE, + 0x02, 0x02, 0x2F, 0x58, 0xFF, 0xFF, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, 0xA2, 0xDB, + 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x0F, 0x60, 0xEC, 0x62, 0x00, 0x60, 0x0C, 0x64, + 0xA2, 0xDB, 0xD1, 0x60, 0xEF, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, + 0xEA, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x08, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x3B, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x04, 0xFF, 0x00, 0x64, 0x69, 0xFB, 0x26, 0x46, 0x00, 0xF4, 0x09, 0xF2, 0x0A, 0xF2, + 0x01, 0xA8, 0x0B, 0xF2, 0x02, 0xA8, 0x04, 0x02, 0x00, 0xA8, 0x02, 0x02, 0x01, 0x02, 0x31, 0x00, + 0xD2, 0x60, 0x58, 0x4D, 0xF6, 0x78, 0xFF, 0xFF, 0x0B, 0xF2, 0x26, 0x46, 0x40, 0x59, 0x02, 0x60, + 0x00, 0x61, 0x2F, 0xF2, 0xA1, 0xDB, 0x30, 0xF2, 0x41, 0x58, 0x59, 0xDB, 0x31, 0xF2, 0x59, 0xDB, + 0x26, 0x46, 0x24, 0x60, 0x74, 0x64, 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, 0xD8, 0x78, 0xFF, 0xFF, + 0x00, 0x66, 0x46, 0x46, 0x03, 0x65, 0xE9, 0x60, 0x58, 0x4E, 0x4C, 0x78, 0xFF, 0xFF, 0xDC, 0x60, + 0xAA, 0x78, 0xFF, 0xFF, 0xD2, 0x60, 0x58, 0x4D, 0xF6, 0x78, 0xFF, 0xFF, 0x00, 0x64, 0x69, 0xFB, + 0x20, 0x40, 0x08, 0x2A, 0x03, 0x00, 0xCF, 0x60, 0xF2, 0x78, 0xFF, 0xFF, 0xD7, 0x60, 0xDD, 0x78, + 0xFF, 0xFF, 0x26, 0x46, 0x40, 0x60, 0x00, 0x65, 0x2A, 0xF2, 0x2F, 0xF0, 0xB4, 0x84, 0x2A, 0xFA, + 0x2C, 0xF8, 0x32, 0xF8, 0x30, 0xF2, 0x2D, 0xFA, 0x33, 0xFA, 0x31, 0xF2, 0x2E, 0xFA, 0x34, 0xFA, + 0xEB, 0xF3, 0x2F, 0xFA, 0xEC, 0xF3, 0x30, 0xFA, 0xED, 0xF3, 0x31, 0xFA, 0xCC, 0xF1, 0x19, 0xF8, + 0x1C, 0xF0, 0x13, 0xF8, 0x00, 0x64, 0x3E, 0xFA, 0x00, 0xF4, 0x03, 0x64, 0x0A, 0xFA, 0x00, 0x64, + 0x0B, 0xFA, 0x01, 0x63, 0x69, 0xFD, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x24, 0x60, + 0x74, 0x62, 0x24, 0x60, 0x28, 0x64, 0xA2, 0xDB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0x00, 0x66, 0xDC, 0xF3, 0x46, 0x46, 0xFD, 0xA0, 0xC1, 0xFE, 0x02, 0x02, + 0x2F, 0x58, 0xFF, 0xFF, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, 0xA2, 0xDB, 0x02, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x0F, 0x60, 0xEC, 0x62, 0x00, 0x60, 0x0C, 0x64, 0xA2, 0xDB, + 0xD2, 0x60, 0x8E, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xEA, 0x62, + 0xA2, 0xD1, 0x00, 0x60, 0x08, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x51, 0x03, 0xA0, 0x84, 0xA2, 0xDB, + 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0x00, 0x64, 0x69, 0xFB, 0x26, 0x46, 0x00, 0xF4, 0x09, 0xF2, 0x0A, 0xF2, 0x01, 0xA8, + 0x0B, 0xF2, 0x04, 0xA8, 0x1A, 0x02, 0x00, 0xA8, 0x18, 0x02, 0x17, 0x02, 0xD2, 0x60, 0x58, 0x4D, + 0xF6, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x24, 0x60, 0x74, 0x64, 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, + 0xD8, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0x20, 0x40, 0x08, 0x2A, 0x03, 0x00, 0xD3, 0x60, + 0x48, 0x78, 0xFF, 0xFF, 0xD9, 0x60, 0x68, 0x78, 0xFF, 0xFF, 0xD2, 0x60, 0x58, 0x4D, 0xF6, 0x78, + 0xFF, 0xFF, 0x0B, 0xF2, 0x26, 0x46, 0x40, 0x59, 0x02, 0x60, 0x00, 0x61, 0x2F, 0xF2, 0xA1, 0xDB, + 0x30, 0xF2, 0x41, 0x58, 0x59, 0xDB, 0x31, 0xF2, 0x59, 0xDB, 0x26, 0x46, 0x24, 0x60, 0x74, 0x64, + 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, 0xD8, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0x03, 0x65, + 0xE9, 0x60, 0x58, 0x4E, 0x4C, 0x78, 0xFF, 0xFF, 0xDC, 0x60, 0xAA, 0x78, 0xFF, 0xFF, 0xD2, 0x60, + 0x58, 0x4D, 0xF6, 0x78, 0xFF, 0xFF, 0x00, 0x64, 0x69, 0xFB, 0x20, 0x40, 0x08, 0x2A, 0x03, 0x00, + 0xCF, 0x60, 0xF2, 0x78, 0xFF, 0xFF, 0xD7, 0x60, 0xDD, 0x78, 0xFF, 0xFF, 0x2D, 0x60, 0x56, 0x62, + 0xA2, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x0B, 0x3A, 0x07, 0x00, 0x28, 0x60, 0x2C, 0x62, 0x0B, 0x64, + 0xA2, 0xDB, 0x2D, 0x60, 0x56, 0x62, 0xA2, 0xDF, 0x2D, 0x58, 0xFF, 0xFF, 0x28, 0x60, 0x2C, 0x62, + 0xA2, 0xD3, 0x61, 0x43, 0xA5, 0xD2, 0x60, 0x40, 0x0B, 0x2A, 0x30, 0x00, 0x85, 0x3A, 0x30, 0x00, + 0x60, 0x41, 0x65, 0x44, 0x0A, 0xA4, 0xA0, 0xD0, 0x2D, 0x60, 0x52, 0x62, 0x64, 0x40, 0x18, 0x26, + 0x06, 0x00, 0xA2, 0xDF, 0x28, 0x60, 0x2C, 0x62, 0x01, 0x64, 0xA2, 0xDB, 0x02, 0x00, 0x01, 0x64, + 0xA2, 0xDB, 0x61, 0x44, 0x60, 0x47, 0xFF, 0xB4, 0x02, 0xA4, 0x2E, 0x60, 0x62, 0x61, 0xA1, 0xD1, + 0xDF, 0x83, 0xC0, 0x84, 0xA1, 0xDB, 0xD0, 0x81, 0xCD, 0x84, 0x4C, 0x91, 0x60, 0x43, 0x60, 0xFE, + 0xA5, 0xD2, 0xDE, 0x85, 0x7F, 0x26, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0x5D, 0x93, 0xA3, 0xDB, + 0x5D, 0x93, 0xA5, 0xD2, 0xF6, 0x1F, 0x5D, 0x93, 0x20, 0xFE, 0xDF, 0x83, 0x2D, 0x58, 0xFF, 0xFF, + 0x2D, 0x60, 0x52, 0x62, 0xA2, 0xDF, 0x28, 0x60, 0x2C, 0x62, 0x01, 0x64, 0xA2, 0xDB, 0xF6, 0x01, + 0x45, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x2E, 0x60, 0xEA, 0x7C, 0x2E, 0x60, 0xDE, 0x63, 0xA3, 0xD9, + 0x64, 0x41, 0x29, 0x60, 0xA4, 0x63, 0xBD, 0xD3, 0x00, 0x7C, 0x03, 0x1B, 0x27, 0x43, 0x10, 0xA3, + 0xBD, 0xD3, 0xFF, 0xFF, 0x60, 0x45, 0x64, 0x5F, 0xA1, 0xDB, 0x65, 0x44, 0xBD, 0xD1, 0xC8, 0x84, + 0x59, 0xD8, 0xFC, 0x05, 0x27, 0x41, 0x10, 0xA1, 0xA1, 0xD1, 0xFF, 0xFF, 0xC1, 0x81, 0x01, 0x26, + 0xDD, 0x81, 0x41, 0x4C, 0x59, 0xD1, 0x7C, 0x44, 0xB0, 0x84, 0x59, 0xD1, 0x59, 0xD1, 0xB0, 0x84, + 0xB0, 0x84, 0xFF, 0xFF, 0x02, 0x02, 0x67, 0x44, 0x5D, 0x00, 0x2D, 0x60, 0xE6, 0x63, 0xDD, 0x60, + 0x18, 0x64, 0xBD, 0xDA, 0x50, 0x60, 0x00, 0x64, 0xBD, 0xDA, 0x01, 0x60, 0xF2, 0x64, 0xBD, 0xDA, + 0x00, 0x60, 0x01, 0x64, 0xBD, 0xDA, 0x2C, 0x41, 0x59, 0xD3, 0x50, 0x60, 0x00, 0x7C, 0x60, 0x40, + 0x02, 0x2A, 0x03, 0x00, 0x01, 0x60, 0xF2, 0x64, 0x0E, 0x00, 0x04, 0x2A, 0x03, 0x00, 0x02, 0x60, + 0xF2, 0x64, 0x09, 0x00, 0x10, 0x2A, 0x03, 0x00, 0x04, 0x60, 0xF2, 0x64, 0x04, 0x00, 0x20, 0x2A, + 0x04, 0x00, 0x05, 0x60, 0xF2, 0x64, 0xBD, 0xD9, 0xBD, 0xDB, 0x01, 0x64, 0xBD, 0xDB, 0x59, 0xD3, + 0x50, 0x60, 0x00, 0x7C, 0x60, 0x40, 0x02, 0x2A, 0x03, 0x00, 0x01, 0x60, 0xF2, 0x64, 0x0E, 0x00, + 0x04, 0x2A, 0x03, 0x00, 0x02, 0x60, 0xF2, 0x64, 0x09, 0x00, 0x10, 0x2A, 0x03, 0x00, 0x04, 0x60, + 0xF2, 0x64, 0x04, 0x00, 0x20, 0x2A, 0x04, 0x00, 0x05, 0x60, 0xF2, 0x64, 0xBD, 0xD9, 0xBD, 0xDB, + 0x01, 0x64, 0xBD, 0xDB, 0x59, 0xD3, 0x50, 0x60, 0x00, 0x7C, 0x60, 0x40, 0x01, 0x2A, 0x03, 0x00, + 0x00, 0x60, 0xF2, 0x64, 0x09, 0x00, 0x02, 0x2A, 0x03, 0x00, 0x01, 0x60, 0xF2, 0x64, 0x04, 0x00, + 0x04, 0x2A, 0x02, 0x00, 0x02, 0x60, 0xF2, 0x64, 0xBD, 0xD9, 0xBD, 0xDB, 0x59, 0xD3, 0xBD, 0xDA, + 0x2D, 0x60, 0xE6, 0x64, 0x2E, 0x60, 0xE4, 0x62, 0xA2, 0xDB, 0x60, 0xF5, 0x00, 0x64, 0x2B, 0xFA, + 0x00, 0x64, 0x2A, 0xFA, 0x27, 0x43, 0x06, 0xA3, 0xBD, 0xD1, 0x2C, 0xF8, 0x32, 0xF8, 0xBD, 0xD1, + 0x2D, 0xF8, 0x33, 0xF8, 0xA3, 0xD1, 0x2E, 0xF8, 0x34, 0xF8, 0x00, 0xF4, 0x01, 0x63, 0x32, 0x40, + 0x08, 0x26, 0x10, 0xBB, 0x28, 0x60, 0x2C, 0x62, 0xA2, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0xFE, 0x26, + 0x10, 0xBB, 0x09, 0xFC, 0x27, 0x42, 0x0C, 0xA2, 0x28, 0x60, 0x02, 0x63, 0xA2, 0xD3, 0xA3, 0xD3, + 0x00, 0xBD, 0x01, 0x63, 0xAC, 0x81, 0x09, 0x03, 0x08, 0x03, 0xB0, 0x60, 0x58, 0x4D, 0xB6, 0x78, + 0xFF, 0xFF, 0x00, 0xB8, 0x01, 0x63, 0x01, 0x03, 0x60, 0x43, 0x1A, 0x60, 0x3E, 0x64, 0xA0, 0xDD, + 0x12, 0x61, 0x59, 0xDC, 0x28, 0x60, 0x2C, 0x62, 0xA2, 0xD3, 0xFF, 0x60, 0xFF, 0x7C, 0x60, 0x40, + 0x0B, 0x2A, 0x02, 0x00, 0x2D, 0x60, 0x32, 0x7C, 0x2E, 0x60, 0xE6, 0x62, 0xA2, 0xD9, 0x2E, 0x60, + 0xDE, 0x64, 0x40, 0x48, 0xD9, 0x81, 0xFF, 0x60, 0xF2, 0x64, 0xE8, 0x60, 0x58, 0x4D, 0xE8, 0x78, + 0xFF, 0xFF, 0x60, 0xF5, 0x3F, 0xFC, 0xDB, 0x83, 0x2E, 0x60, 0x08, 0x62, 0xA2, 0xDD, 0x00, 0x7C, + 0x5A, 0xD9, 0x63, 0x41, 0x2E, 0x60, 0x0C, 0x63, 0x12, 0x65, 0x00, 0xF4, 0xCD, 0x84, 0x4C, 0x91, + 0x60, 0x43, 0x60, 0xFE, 0xA5, 0xD2, 0xDE, 0x85, 0x7F, 0x26, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, + 0x5D, 0x93, 0xA3, 0xDB, 0x5D, 0x93, 0xA5, 0xD2, 0xF6, 0x1F, 0x5D, 0x93, 0x20, 0xFE, 0xDF, 0x83, + 0x60, 0xF5, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, 0x28, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x00, 0x66, 0x46, 0x46, 0xC1, 0xFE, 0x06, 0x64, + 0x69, 0xFB, 0x46, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, + 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x0F, 0x60, 0xEC, 0x62, 0x00, 0x60, + 0x1C, 0x64, 0xA2, 0xDB, 0xD4, 0x60, 0x68, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x0F, 0x60, 0xEA, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x08, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x3A, 0x03, + 0xA0, 0x84, 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, 0xA2, 0xDB, 0x03, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x26, 0x46, + 0x00, 0xF4, 0x0A, 0xF2, 0x00, 0x63, 0x00, 0xA8, 0x69, 0xFD, 0x5A, 0x03, 0x0A, 0xF2, 0x26, 0x46, + 0x40, 0x59, 0x02, 0x60, 0x00, 0x61, 0x2F, 0xF2, 0xA1, 0xDB, 0x30, 0xF2, 0x41, 0x58, 0x59, 0xDB, + 0x31, 0xF2, 0x59, 0xDB, 0x26, 0x46, 0x24, 0x60, 0x74, 0x64, 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, + 0xD8, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0x05, 0x65, 0xE9, 0x60, 0x58, 0x4E, 0x4C, 0x78, + 0xFF, 0xFF, 0xDC, 0x60, 0xAA, 0x78, 0xFF, 0xFF, 0x47, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0xCF, 0x60, + 0xF2, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x10, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x21, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x04, 0xFF, 0x26, 0x46, 0x24, 0x60, 0x74, 0x64, 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, + 0xD8, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0x00, 0x64, 0x69, 0xFB, 0x0F, 0x60, 0xEA, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x49, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0xD0, 0x60, 0x94, 0x78, 0xFF, 0xFF, + 0xFF, 0x60, 0xFB, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x00, 0x64, 0x69, 0xFB, 0x0F, 0x60, 0xEA, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x4A, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0xCF, 0x60, 0xF2, 0x78, 0xFF, 0xFF, + 0x48, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x09, 0xF0, 0x2E, 0x60, 0x64, 0x63, 0x10, 0x64, 0xBD, 0xDB, + 0xBD, 0xD9, 0x0A, 0xF0, 0xBD, 0xD9, 0x0B, 0xF0, 0xBD, 0xD9, 0x0C, 0xF2, 0xBD, 0xDB, 0x60, 0x47, + 0xFF, 0xB4, 0x0A, 0xA5, 0x2E, 0x60, 0x62, 0x61, 0x65, 0x5C, 0xA1, 0xD9, 0x60, 0x41, 0x1A, 0x65, + 0xCD, 0x84, 0x4C, 0x91, 0x60, 0x43, 0x60, 0xFE, 0xA5, 0xD2, 0xDE, 0x85, 0x7F, 0x26, 0x02, 0x00, + 0x00, 0xF4, 0x04, 0x65, 0x5D, 0x93, 0xA3, 0xDB, 0x5D, 0x93, 0xA5, 0xD2, 0xF6, 0x1F, 0x5D, 0x93, + 0x20, 0xFE, 0xDF, 0x83, 0xD3, 0x60, 0x58, 0x4D, 0x06, 0x78, 0xFF, 0xFF, 0x0B, 0xF2, 0xFF, 0xFF, + 0x07, 0xB4, 0x01, 0x61, 0x03, 0x03, 0xCC, 0x84, 0xE1, 0x81, 0xFD, 0x02, 0x61, 0x44, 0x96, 0xFB, + 0x27, 0x45, 0x02, 0x62, 0x46, 0xD3, 0x5A, 0xD1, 0x60, 0x47, 0x56, 0xFB, 0x64, 0x47, 0x55, 0xFB, + 0x00, 0x64, 0x5C, 0xFB, 0x0C, 0x62, 0x46, 0xD3, 0x80, 0xFB, 0x0B, 0xF0, 0x0F, 0x60, 0xFF, 0x64, + 0xA0, 0x84, 0x85, 0xFB, 0x26, 0x46, 0x32, 0xF0, 0x81, 0xF9, 0x33, 0xF0, 0x0E, 0x63, 0xC7, 0x81, + 0x82, 0xF9, 0x34, 0xF0, 0x83, 0xF9, 0x59, 0xD1, 0xFF, 0xFF, 0x64, 0x44, 0x01, 0x2A, 0xC8, 0x84, + 0x60, 0x43, 0x2D, 0x60, 0x78, 0x64, 0x58, 0xD9, 0x59, 0xD1, 0x58, 0xD9, 0xFD, 0x1F, 0x28, 0x60, + 0x2C, 0x62, 0xA2, 0xD1, 0x59, 0xD3, 0x64, 0x40, 0x01, 0x36, 0x22, 0x64, 0x64, 0x40, 0x00, 0x36, + 0x50, 0x94, 0xA9, 0xF1, 0xFF, 0xFF, 0x44, 0x47, 0xA7, 0x46, 0x36, 0xFA, 0xB7, 0xFC, 0xA7, 0x46, + 0x1A, 0x60, 0x3E, 0x62, 0xA2, 0xD3, 0x87, 0xFB, 0x31, 0xF2, 0x1C, 0x60, 0xBA, 0x65, 0x60, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, + 0x61, 0x46, 0x31, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x30, 0xF0, + 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x2F, 0xF0, 0x63, 0x46, 0xD0, 0x80, + 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0xA9, 0xF3, 0x08, 0xFE, + 0x60, 0x43, 0x61, 0x46, 0xA9, 0xF1, 0xFF, 0xFF, 0xD3, 0x80, 0x31, 0xF2, 0x27, 0x02, 0x66, 0x41, + 0x1C, 0x60, 0xBA, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xA9, 0xF1, 0xE0, 0x84, 0x44, 0xD3, 0x64, 0x43, + 0x11, 0x18, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xFC, 0x1B, 0x66, 0x44, 0x64, 0x46, 0x80, 0xF0, + 0x60, 0x46, 0x80, 0xF8, 0x65, 0x46, 0x65, 0x43, 0x80, 0xF0, 0x01, 0xFA, 0x80, 0xFC, 0x64, 0x46, + 0x80, 0xF8, 0x0B, 0x00, 0x64, 0x46, 0x62, 0x43, 0x00, 0xF2, 0xA3, 0xDB, 0x60, 0x46, 0x80, 0xF0, + 0x81, 0xFC, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x60, 0x43, 0x61, 0x46, 0x43, 0x47, 0x00, 0xF4, + 0x18, 0x65, 0x0C, 0x61, 0x02, 0x60, 0x00, 0x63, 0xA5, 0xD0, 0xDA, 0x85, 0x64, 0x44, 0x00, 0x7F, + 0xCD, 0x81, 0xBD, 0xDB, 0x05, 0x03, 0x64, 0x47, 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, 0xF4, 0x02, + 0x02, 0x60, 0x02, 0x61, 0xA1, 0xD3, 0x00, 0x65, 0x60, 0x43, 0x59, 0xD3, 0xFF, 0xFF, 0x7F, 0xB4, + 0x02, 0x3A, 0x02, 0x00, 0x01, 0x64, 0x15, 0x00, 0x04, 0x3A, 0x02, 0x00, 0x02, 0x64, 0x11, 0x00, + 0x0A, 0x3A, 0x02, 0x00, 0x04, 0x64, 0x0D, 0x00, 0x0B, 0x3A, 0x02, 0x00, 0x08, 0x64, 0x09, 0x00, + 0x10, 0x3A, 0x02, 0x00, 0x10, 0x64, 0x05, 0x00, 0x16, 0x3A, 0x02, 0x00, 0x20, 0x64, 0x01, 0x00, + 0x00, 0x64, 0xCF, 0x83, 0xB4, 0x85, 0xE1, 0x02, 0x65, 0x44, 0x7A, 0xFB, 0x02, 0x60, 0x02, 0x61, + 0xA1, 0xD3, 0x00, 0x65, 0x60, 0x43, 0x59, 0xD3, 0xFF, 0xFF, 0x80, 0xB0, 0xFF, 0xFF, 0x01, 0x03, + 0x60, 0x45, 0xCF, 0x83, 0x65, 0x44, 0xF7, 0x02, 0x7F, 0xB4, 0x02, 0x3A, 0x02, 0x00, 0x0A, 0x64, + 0x15, 0x00, 0x04, 0x3A, 0x02, 0x00, 0x14, 0x64, 0x11, 0x00, 0x0A, 0x3A, 0x02, 0x00, 0x32, 0x64, + 0x0D, 0x00, 0x0B, 0x3A, 0x02, 0x00, 0x37, 0x64, 0x09, 0x00, 0x10, 0x3A, 0x02, 0x00, 0x50, 0x64, + 0x05, 0x00, 0x16, 0x3A, 0x02, 0x00, 0x6E, 0x64, 0x01, 0x00, 0x14, 0x64, 0x7C, 0xFB, 0x27, 0x44, + 0xD8, 0xF3, 0x60, 0x45, 0x66, 0x41, 0x65, 0x46, 0x8C, 0xFA, 0x60, 0x40, 0x01, 0x36, 0x06, 0x00, + 0x02, 0x36, 0x04, 0x00, 0x04, 0x36, 0x02, 0x00, 0x05, 0x3A, 0x02, 0x00, 0x00, 0x64, 0x01, 0x00, + 0x01, 0x64, 0x6F, 0xFA, 0x79, 0xF3, 0x7A, 0xF1, 0xFF, 0xFF, 0xA0, 0x84, 0x65, 0x43, 0x02, 0x02, + 0x79, 0xF3, 0xFF, 0xFF, 0x60, 0x41, 0x0F, 0x60, 0xAE, 0x65, 0xD8, 0xF3, 0xFF, 0xFF, 0xE0, 0x84, + 0x44, 0xD3, 0x61, 0x45, 0xA4, 0x80, 0xFF, 0xFF, 0x04, 0x02, 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, + 0xFC, 0x03, 0xA4, 0x84, 0x7B, 0xFB, 0x6F, 0xF0, 0x60, 0x47, 0x90, 0x84, 0x6F, 0xFA, 0x60, 0x47, + 0x60, 0x45, 0x80, 0x64, 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0xFC, 0x03, 0xA4, 0x84, 0x70, 0xF0, + 0x70, 0xFA, 0x00, 0x61, 0xE8, 0x84, 0xFF, 0xFF, 0x02, 0x05, 0xDD, 0x81, 0xFB, 0x01, 0xE1, 0x81, + 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, 0x0E, 0xFA, 0x66, 0x43, 0x0C, 0xF4, 0x2D, 0x60, 0xD2, 0x62, + 0xA2, 0xD3, 0x2D, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x60, 0x47, 0x28, 0x60, 0x2C, 0x62, 0xA2, 0xD1, + 0xB0, 0x84, 0x64, 0x40, 0x01, 0x36, 0x22, 0x64, 0x64, 0x40, 0x00, 0x36, 0x50, 0x94, 0xA7, 0x46, + 0x36, 0xFA, 0xB7, 0xFC, 0xA7, 0x46, 0x80, 0x60, 0x03, 0x65, 0x32, 0x40, 0x08, 0x2A, 0x03, 0x65, + 0xA7, 0x46, 0x06, 0xF0, 0x7F, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xB4, 0x84, 0x06, 0xFA, 0xB7, 0xFC, + 0xA7, 0x46, 0x26, 0x46, 0x2F, 0xF0, 0x30, 0xF0, 0x64, 0x43, 0x31, 0xF2, 0x27, 0x46, 0x03, 0xFC, + 0x04, 0xF8, 0x05, 0xFA, 0x26, 0x46, 0xCF, 0x60, 0x58, 0x4E, 0x20, 0x78, 0xFF, 0xFF, 0x26, 0x46, + 0x24, 0x60, 0x74, 0x64, 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, 0xD8, 0x78, 0xFF, 0xFF, 0x00, 0x66, + 0x46, 0x46, 0x01, 0x64, 0x8C, 0xFB, 0x28, 0x60, 0x38, 0x62, 0xA2, 0xD3, 0x20, 0x41, 0x00, 0xBC, + 0x20, 0xB9, 0x01, 0x03, 0x41, 0x40, 0x1F, 0x60, 0x52, 0x61, 0x00, 0x64, 0xA1, 0xDB, 0x04, 0x64, + 0xC1, 0xFE, 0xDC, 0xFB, 0xF2, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, 0xF2, 0xFB, 0xF7, 0x60, 0xFF, 0x65, + 0x20, 0x44, 0x24, 0x80, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x01, 0x65, 0xE9, 0x60, 0x58, 0x4E, 0x7B, 0x78, 0xFF, 0xFF, 0x0F, 0x60, + 0xD8, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x0C, 0x64, + 0x69, 0xFB, 0x0F, 0x60, 0xEC, 0x62, 0x00, 0x60, 0x31, 0x64, 0xA2, 0xDB, 0xD6, 0x60, 0xC4, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, 0x0E, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x5A, 0xDB, 0x0F, 0x60, 0xEA, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x01, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x10, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x31, 0x60, 0x2C, 0x61, 0xA1, 0xD3, 0xFF, 0xFF, 0x03, 0x1B, + 0xDC, 0x60, 0xD0, 0x78, 0xFF, 0xFF, 0xDC, 0x60, 0xD0, 0x78, 0xFF, 0xFF, 0xD7, 0x60, 0x67, 0x78, + 0xFF, 0xFF, 0x00, 0x60, 0x10, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0xF8, 0x03, 0xA0, 0x84, 0xA2, 0xDB, + 0xA9, 0xF3, 0xFF, 0xFF, 0x02, 0xA4, 0x60, 0x43, 0x66, 0x41, 0x63, 0x46, 0x05, 0xF2, 0x00, 0xF0, + 0x81, 0xF0, 0x02, 0x18, 0x64, 0x46, 0x81, 0xF8, 0x07, 0x1B, 0x1C, 0x60, 0xBA, 0x65, 0x60, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD9, 0x02, 0x00, 0x65, 0x46, 0x00, 0xF8, 0xA9, 0xF3, 0x63, 0x45, + 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xD4, 0x80, 0x01, 0x18, 0xFA, 0x04, 0x80, 0xF8, 0x65, 0x46, + 0x00, 0xFA, 0x06, 0xF2, 0xFF, 0xFF, 0x00, 0x7E, 0x06, 0xFA, 0x61, 0x46, 0x4B, 0x64, 0x3B, 0x42, + 0x5A, 0xDB, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x01, 0x60, 0x2E, 0x62, 0xA2, 0xD3, + 0xFF, 0xFF, 0x10, 0xB0, 0xFF, 0xFF, 0x13, 0x03, 0x0F, 0x60, 0xEC, 0x62, 0x04, 0x60, 0x00, 0x64, + 0xA2, 0xDB, 0xD7, 0x60, 0x2F, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x0F, 0x60, 0xF6, 0x62, 0xA2, 0xD1, + 0x01, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x6A, 0xF3, + 0xFF, 0xFF, 0x01, 0xB0, 0xFF, 0xFF, 0x13, 0x03, 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, 0x00, 0x60, + 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x0F, 0x60, 0xEC, 0x62, 0x02, 0x60, 0x00, 0x64, + 0xA2, 0xDB, 0xD7, 0x60, 0x47, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, + 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x00, 0x64, 0x69, 0xFB, 0xD7, 0x60, 0x58, 0x4E, 0x77, 0x78, + 0xFF, 0xFF, 0x02, 0x64, 0x8C, 0xFB, 0x02, 0x64, 0xC1, 0xFE, 0xDC, 0xFB, 0xF2, 0xF3, 0xFF, 0xFF, + 0x01, 0xBC, 0xF2, 0xFB, 0x02, 0x65, 0xE9, 0x60, 0x58, 0x4E, 0x7B, 0x78, 0xFF, 0xFF, 0x03, 0x60, + 0xE8, 0x63, 0x1A, 0x60, 0x40, 0x64, 0xA0, 0xDD, 0xCB, 0x60, 0x1A, 0x78, 0xFF, 0xFF, 0x00, 0x60, + 0x20, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0xFF, 0xFF, 0x08, 0x24, 0x54, 0x01, 0xA0, 0x84, 0xA2, 0xDB, + 0x00, 0x63, 0x69, 0xFD, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x15, 0x00, 0x24, 0x60, + 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, + 0x00, 0x64, 0x69, 0xFB, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x01, 0x64, 0x8C, 0xFB, + 0xFF, 0xFF, 0xC1, 0xFE, 0x2E, 0x58, 0xFF, 0xFF, 0x50, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x0F, 0x60, + 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x01, 0x60, 0x2E, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x10, 0xB0, + 0xFF, 0xFF, 0x13, 0x03, 0x0F, 0x60, 0xF6, 0x62, 0xA2, 0xD1, 0x01, 0x60, 0x00, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x0F, 0x60, 0xEC, 0x62, 0x04, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xD7, 0x60, + 0x8F, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xBC, 0xF1, 0x1A, 0x60, 0x6A, 0x62, + 0xA2, 0xD9, 0x7F, 0xF1, 0x7E, 0xF9, 0x02, 0x64, 0x8C, 0xFB, 0xFF, 0xFF, 0xC1, 0xFE, 0x8C, 0xF3, + 0x00, 0x65, 0xD4, 0x80, 0xFF, 0xFF, 0x0F, 0x03, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x0F, 0x60, 0xEC, 0x62, 0x80, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xD7, 0x60, 0xB3, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x51, 0x64, + 0x3B, 0x42, 0x5A, 0xDB, 0x19, 0x60, 0x84, 0x64, 0x68, 0xFB, 0x1A, 0x60, 0x46, 0x63, 0x81, 0xF3, + 0xBD, 0xDB, 0x82, 0xF3, 0xBD, 0xDB, 0x83, 0xF3, 0xA3, 0xDB, 0x01, 0x60, 0x10, 0x65, 0x68, 0xF3, + 0xA5, 0xD1, 0x04, 0xA4, 0x68, 0xFB, 0xD0, 0x80, 0xA0, 0xD3, 0x20, 0x07, 0x40, 0x47, 0x60, 0x41, + 0x0E, 0x65, 0x45, 0xD3, 0x28, 0x60, 0x2C, 0x62, 0xA2, 0xD1, 0xFF, 0xFF, 0x03, 0x1B, 0x10, 0xB0, + 0xFF, 0xFF, 0xEB, 0x02, 0x27, 0x44, 0x06, 0xA4, 0x60, 0x41, 0xA1, 0xD1, 0x81, 0xF3, 0x82, 0xF1, + 0xD0, 0x80, 0x59, 0xD3, 0x08, 0x02, 0xD0, 0x80, 0x83, 0xF3, 0x59, 0xD1, 0x04, 0x02, 0xD0, 0x80, + 0xFF, 0xFF, 0x01, 0x02, 0x03, 0x00, 0xD8, 0x60, 0x99, 0x78, 0xFF, 0xFF, 0x1A, 0x60, 0x46, 0x63, + 0xBD, 0xD3, 0x81, 0xFB, 0xBD, 0xD3, 0x82, 0xFB, 0xA3, 0xD3, 0x83, 0xFB, 0x53, 0x64, 0x3B, 0x42, + 0x5A, 0xDB, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0B, 0x04, 0x0F, 0x60, + 0xEC, 0x62, 0x40, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xD8, 0x60, 0x06, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x7E, 0xF1, 0x7F, 0xF9, 0x24, 0x60, 0x9A, 0x62, 0xA2, 0xD9, 0x1E, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x0F, 0x60, 0xEC, 0x62, 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, + 0xD8, 0x60, 0x36, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xEA, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0xBE, 0xFE, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x40, 0x60, 0x00, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x01, 0x63, 0x8C, 0xFD, 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, + 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0xC1, 0xFE, 0x54, 0x64, 0x3B, 0x42, + 0x5A, 0xDB, 0x31, 0x44, 0xF9, 0xB4, 0x40, 0x51, 0x01, 0x60, 0xBA, 0x61, 0x1F, 0x60, 0x08, 0x63, + 0xA1, 0xD3, 0xFF, 0xFF, 0x20, 0x7F, 0xBD, 0xDB, 0x59, 0xD3, 0xFF, 0xFF, 0x21, 0x7F, 0xBD, 0xDB, + 0x59, 0xD3, 0xFF, 0xFF, 0x22, 0x7F, 0xA3, 0xDB, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0xDE, 0xFE, 0x0B, 0x04, 0x0F, 0x60, 0xEC, 0x62, 0x40, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xD8, 0x60, + 0x64, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x24, 0x60, 0x9A, 0x62, 0x1F, 0x60, + 0x06, 0x64, 0xA2, 0xDB, 0x20, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x0F, 0x60, 0xEC, 0x62, + 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xD8, 0x60, 0x89, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xBE, 0xFE, 0x0F, 0x60, 0xD0, 0x62, + 0xA2, 0xD1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0xD6, 0x60, 0xB7, 0x78, + 0xFF, 0xFF, 0x27, 0x43, 0x2D, 0x60, 0x7A, 0x65, 0xA5, 0xD3, 0x65, 0x41, 0x10, 0xA3, 0x01, 0xA4, + 0xFE, 0xB4, 0xC4, 0x85, 0xFE, 0xA1, 0xBD, 0xD3, 0x59, 0xD1, 0xFF, 0xFF, 0xD0, 0x80, 0xD5, 0x80, + 0x02, 0x02, 0x04, 0x03, 0xF8, 0x01, 0xD7, 0x60, 0xDD, 0x78, 0xFF, 0xFF, 0x55, 0x64, 0x3B, 0x42, + 0x5A, 0xDB, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0B, 0x04, 0x0F, 0x60, + 0xEC, 0x62, 0x40, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xD8, 0x60, 0xB1, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x27, 0xD1, 0x7F, 0xF9, 0x24, 0x60, 0x9A, 0x62, 0xA2, 0xD9, 0x1E, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x0F, 0x60, 0xEC, 0x62, 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, + 0xD8, 0x60, 0xD6, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xEA, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0xBE, 0xFE, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x40, 0x60, 0x00, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x01, 0x60, 0xBA, 0x61, 0x1F, 0x60, 0x08, 0x63, 0xA1, 0xD3, + 0xFF, 0xFF, 0x20, 0x7F, 0xBD, 0xDB, 0x21, 0x60, 0x32, 0x64, 0xBD, 0xDB, 0x04, 0xA1, 0xA1, 0xD3, + 0xFF, 0xFF, 0x22, 0x7F, 0xA3, 0xDB, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, + 0x0B, 0x04, 0x0F, 0x60, 0xEC, 0x62, 0x40, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xD8, 0x60, 0xF3, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x24, 0x60, 0x9A, 0x62, 0x1F, 0x60, 0x06, 0x64, + 0xA2, 0xDB, 0x20, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x0F, 0x60, 0xEC, 0x62, 0x20, 0x60, + 0x00, 0x64, 0xA2, 0xDB, 0xD9, 0x60, 0x18, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xBE, 0xFE, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, + 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x1A, 0x60, 0x6A, 0x62, 0x07, 0x60, + 0xD0, 0x64, 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, 0xA2, 0xDB, 0x02, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x27, 0x43, 0x06, 0xA3, 0xBD, 0xD3, 0x81, 0xFB, 0xBD, 0xD3, + 0x82, 0xFB, 0xA3, 0xD3, 0x83, 0xFB, 0x31, 0x44, 0xF9, 0xB4, 0x40, 0x51, 0x0F, 0x60, 0xEA, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x0F, 0x60, 0xEC, 0x62, 0x01, 0x60, 0x04, 0x64, 0xA2, 0xDB, 0xD9, 0x60, + 0x4D, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xBC, 0xF1, 0x1A, 0x60, 0x6A, 0x62, + 0xA2, 0xD9, 0x0F, 0x60, 0xEA, 0x62, 0xA2, 0xD1, 0xFE, 0x60, 0xFF, 0x61, 0xA1, 0x84, 0x5A, 0xD1, + 0x4A, 0xDB, 0xA1, 0x84, 0x5A, 0xDB, 0x0F, 0x60, 0xEA, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x04, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xD7, 0x60, 0xDD, 0x78, 0xFF, 0xFF, + 0x27, 0x42, 0x0C, 0xA2, 0x28, 0x60, 0x02, 0x63, 0xA2, 0xD3, 0xA3, 0xD3, 0x00, 0xBD, 0x01, 0x63, + 0xAC, 0x81, 0x09, 0x03, 0x08, 0x03, 0xB0, 0x60, 0x58, 0x4D, 0xB6, 0x78, 0xFF, 0xFF, 0x00, 0xB8, + 0x01, 0x63, 0x01, 0x03, 0x60, 0x43, 0x1A, 0x60, 0x3E, 0x64, 0xA0, 0xDD, 0x60, 0xF5, 0x00, 0x64, + 0x2B, 0xFA, 0x20, 0x64, 0x2A, 0xFA, 0x27, 0x43, 0x06, 0xA3, 0xBD, 0xD1, 0x2C, 0xF8, 0x32, 0xF8, + 0xBD, 0xD1, 0x2D, 0xF8, 0x33, 0xF8, 0xA3, 0xD1, 0x2E, 0xF8, 0x34, 0xF8, 0xEB, 0xF1, 0x2F, 0xF8, + 0xEC, 0xF1, 0x30, 0xF8, 0xED, 0xF1, 0x31, 0xF8, 0xBC, 0xF1, 0x19, 0xF8, 0xF8, 0x60, 0x80, 0x64, + 0x0E, 0xFA, 0x00, 0xF4, 0x01, 0x63, 0x32, 0x40, 0x08, 0x26, 0x10, 0xBB, 0x28, 0x60, 0x2C, 0x62, + 0xA2, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0xFE, 0x26, 0x10, 0xBB, 0x09, 0xFC, 0x1A, 0x60, 0x3E, 0x64, + 0xA0, 0xD3, 0x12, 0x61, 0x59, 0xDA, 0x1A, 0x60, 0x46, 0x63, 0xBD, 0xD1, 0x59, 0xD8, 0xBD, 0xD1, + 0x59, 0xD8, 0xA3, 0xD1, 0x59, 0xD8, 0x2E, 0x60, 0xDE, 0x64, 0x40, 0x48, 0xD9, 0x81, 0xFF, 0x60, + 0xF2, 0x64, 0xE8, 0x60, 0x58, 0x4D, 0xE8, 0x78, 0xFF, 0xFF, 0x60, 0xF5, 0x3F, 0xFC, 0xDB, 0x83, + 0x2E, 0x60, 0x08, 0x62, 0xA2, 0xDD, 0x20, 0x7C, 0x5A, 0xD9, 0x63, 0x41, 0x2E, 0x60, 0x0C, 0x63, + 0x12, 0x65, 0x00, 0xF4, 0xCD, 0x84, 0x4C, 0x91, 0x60, 0x43, 0x60, 0xFE, 0xA5, 0xD2, 0xDE, 0x85, + 0x7F, 0x26, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0x5D, 0x93, 0xA3, 0xDB, 0x5D, 0x93, 0xA5, 0xD2, + 0xF6, 0x1F, 0x5D, 0x93, 0x20, 0xFE, 0xDF, 0x83, 0x60, 0xF5, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, + 0x28, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0x00, 0x66, 0x46, 0x46, 0xC1, 0xFE, 0x14, 0x64, 0x69, 0xFB, 0x56, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x1A, 0x60, 0x44, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x64, 0xA4, 0xA2, 0xDB, 0x1A, 0x60, 0x44, 0x62, + 0xA2, 0xD1, 0x1A, 0x60, 0x6A, 0x62, 0xA2, 0xD9, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, + 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x0F, 0x60, 0xEC, 0x62, 0x00, 0x60, + 0x1C, 0x64, 0xA2, 0xDB, 0xDA, 0x60, 0x10, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x0F, 0x60, 0xEA, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x0E, 0x03, + 0xA0, 0x84, 0xA2, 0xDB, 0x57, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x00, 0x64, 0x69, 0xFB, 0x0F, 0x60, + 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xD7, 0x60, 0xDD, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x10, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0x17, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, + 0x66, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x58, 0x64, 0x3B, 0x42, + 0x5A, 0xDB, 0x00, 0x64, 0x69, 0xFB, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDB, 0x60, + 0xCB, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x08, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x3A, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x66, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x04, 0xFF, 0x00, 0x64, 0x69, 0xFB, 0x0F, 0x60, 0xEA, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x26, 0x46, 0x00, 0xF4, 0x0A, 0xF2, 0xFF, 0xFF, 0x2C, 0x18, 0x59, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x0A, 0xF2, 0x26, 0x46, 0x40, 0x59, 0x02, 0x60, 0x00, 0x61, 0x2F, 0xF2, 0xA1, 0xDB, 0x30, 0xF2, + 0x41, 0x58, 0x59, 0xDB, 0x31, 0xF2, 0x59, 0xDB, 0x26, 0x46, 0x24, 0x60, 0x74, 0x64, 0x40, 0x4B, + 0x2C, 0x60, 0x58, 0x4D, 0xD8, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0x05, 0x65, 0xE9, 0x60, + 0x58, 0x4E, 0x4C, 0x78, 0xFF, 0xFF, 0xDC, 0x60, 0xAA, 0x78, 0xFF, 0xFF, 0xD7, 0x60, 0xDD, 0x78, + 0xFF, 0xFF, 0x5A, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x78, 0x43, 0x02, 0x61, 0x24, 0x60, 0xDD, 0x78, + 0xFF, 0xFF, 0x5B, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x09, 0xF0, 0x2E, 0x60, 0x64, 0x63, 0x30, 0x64, + 0xBD, 0xDB, 0xBD, 0xD9, 0x0A, 0xF0, 0xBD, 0xD9, 0x0B, 0xF0, 0xBD, 0xD9, 0x0C, 0xF2, 0xBD, 0xDB, + 0x60, 0x47, 0xFF, 0xB4, 0x0A, 0xA5, 0x2E, 0x60, 0x62, 0x62, 0x65, 0x5C, 0xA2, 0xD9, 0x60, 0x41, + 0x1A, 0x65, 0xCD, 0x84, 0x4C, 0x91, 0x60, 0x43, 0x60, 0xFE, 0xA5, 0xD2, 0xDE, 0x85, 0x7F, 0x26, + 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0x5D, 0x93, 0xA3, 0xDB, 0x5D, 0x93, 0xA5, 0xD2, 0xF6, 0x1F, + 0x5D, 0x93, 0x20, 0xFE, 0xDF, 0x83, 0xD3, 0x60, 0x58, 0x4D, 0x06, 0x78, 0xFF, 0xFF, 0x0B, 0xF2, + 0xFF, 0xFF, 0x07, 0xB4, 0x01, 0x61, 0x03, 0x03, 0xCC, 0x84, 0xE1, 0x81, 0xFD, 0x02, 0x61, 0x44, + 0x96, 0xFB, 0x27, 0x45, 0x02, 0x62, 0x46, 0xD3, 0x5A, 0xD1, 0x60, 0x47, 0x56, 0xFB, 0x64, 0x47, + 0x55, 0xFB, 0x00, 0x64, 0x5C, 0xFB, 0x0C, 0x62, 0x46, 0xD3, 0x80, 0xFB, 0x0B, 0xF0, 0x0F, 0x60, + 0xFF, 0x64, 0xA0, 0x84, 0x85, 0xFB, 0x1A, 0x60, 0x3E, 0x62, 0xA2, 0xD3, 0x87, 0xFB, 0x26, 0x46, + 0x32, 0xF0, 0x81, 0xF9, 0x33, 0xF0, 0x82, 0xF9, 0x34, 0xF0, 0x83, 0xF9, 0x00, 0xF4, 0x18, 0x65, + 0x0C, 0x61, 0x02, 0x60, 0x00, 0x63, 0xA5, 0xD0, 0xDA, 0x85, 0x64, 0x44, 0x00, 0x7F, 0xCD, 0x81, + 0xBD, 0xDB, 0x05, 0x03, 0x64, 0x47, 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, 0xF4, 0x02, 0x02, 0x60, + 0x02, 0x61, 0xA1, 0xD3, 0x00, 0x65, 0x60, 0x43, 0x59, 0xD3, 0xFF, 0xFF, 0x7F, 0xB4, 0x02, 0x3A, + 0x02, 0x00, 0x01, 0x64, 0x15, 0x00, 0x04, 0x3A, 0x02, 0x00, 0x02, 0x64, 0x11, 0x00, 0x0A, 0x3A, + 0x02, 0x00, 0x04, 0x64, 0x0D, 0x00, 0x0B, 0x3A, 0x02, 0x00, 0x08, 0x64, 0x09, 0x00, 0x10, 0x3A, + 0x02, 0x00, 0x10, 0x64, 0x05, 0x00, 0x16, 0x3A, 0x02, 0x00, 0x20, 0x64, 0x01, 0x00, 0x00, 0x64, + 0xCF, 0x83, 0xB4, 0x85, 0xE1, 0x02, 0x65, 0x44, 0x7A, 0xFB, 0x02, 0x60, 0x02, 0x61, 0xA1, 0xD3, + 0x00, 0x65, 0x60, 0x43, 0x59, 0xD3, 0xFF, 0xFF, 0x80, 0xB0, 0xFF, 0xFF, 0x01, 0x03, 0x60, 0x45, + 0xCF, 0x83, 0x65, 0x44, 0xF7, 0x02, 0x7F, 0xB4, 0x02, 0x3A, 0x02, 0x00, 0x0A, 0x64, 0x15, 0x00, + 0x04, 0x3A, 0x02, 0x00, 0x14, 0x64, 0x11, 0x00, 0x0A, 0x3A, 0x02, 0x00, 0x32, 0x64, 0x0D, 0x00, + 0x0B, 0x3A, 0x02, 0x00, 0x37, 0x64, 0x09, 0x00, 0x10, 0x3A, 0x02, 0x00, 0x50, 0x64, 0x05, 0x00, + 0x16, 0x3A, 0x02, 0x00, 0x6E, 0x64, 0x01, 0x00, 0x14, 0x64, 0x7C, 0xFB, 0xA9, 0xF3, 0xFF, 0xFF, + 0x02, 0xA4, 0xD8, 0xF3, 0x60, 0x45, 0x66, 0x41, 0x65, 0x46, 0x8C, 0xFA, 0x60, 0x40, 0x01, 0x36, + 0x06, 0x00, 0x02, 0x36, 0x04, 0x00, 0x04, 0x36, 0x02, 0x00, 0x05, 0x3A, 0x02, 0x00, 0x00, 0x64, + 0x01, 0x00, 0x01, 0x64, 0x6F, 0xFA, 0x79, 0xF3, 0x7A, 0xF1, 0xFF, 0xFF, 0xA0, 0x84, 0x65, 0x43, + 0x02, 0x02, 0x79, 0xF3, 0xFF, 0xFF, 0x60, 0x41, 0x0F, 0x60, 0xAE, 0x65, 0xD8, 0xF3, 0xFF, 0xFF, + 0xE0, 0x84, 0x44, 0xD3, 0x61, 0x45, 0xA4, 0x80, 0xFF, 0xFF, 0x04, 0x02, 0xE8, 0x84, 0xA4, 0x80, + 0xFF, 0xFF, 0xFC, 0x03, 0xA4, 0x84, 0x7B, 0xFB, 0x6F, 0xF0, 0x60, 0x47, 0x90, 0x84, 0x6F, 0xFA, + 0x60, 0x47, 0x60, 0x45, 0x80, 0x64, 0xE8, 0x84, 0xA4, 0x80, 0xFF, 0xFF, 0xFC, 0x03, 0xA4, 0x84, + 0x70, 0xF0, 0x70, 0xFA, 0x00, 0x61, 0xE8, 0x84, 0xFF, 0xFF, 0x02, 0x05, 0xDD, 0x81, 0xFB, 0x01, + 0xE1, 0x81, 0x0F, 0x60, 0xA2, 0x65, 0x45, 0xD3, 0x0E, 0xFA, 0x66, 0x43, 0x0C, 0xF4, 0xA9, 0xF3, + 0x1C, 0x60, 0xBA, 0x65, 0x02, 0xA4, 0x60, 0x46, 0x05, 0xF0, 0x60, 0x41, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x00, 0x7C, 0x44, 0xD9, 0x26, 0x46, 0x31, 0xF2, 0x61, 0x5C, 0x60, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD9, 0x26, 0x46, 0x2F, 0xF0, 0x61, 0x46, 0x03, 0xF8, 0x26, 0x46, 0x30, 0xF0, + 0x61, 0x46, 0x04, 0xF8, 0x26, 0x46, 0x31, 0xF0, 0x61, 0x46, 0x05, 0xF8, 0x26, 0x46, 0xCF, 0x60, + 0x58, 0x4E, 0x20, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x24, 0x60, 0x74, 0x64, 0x40, 0x4B, 0x2C, 0x60, + 0x58, 0x4D, 0xD8, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0x03, 0x65, 0xE9, 0x60, 0x58, 0x4E, + 0x7B, 0x78, 0xFF, 0xFF, 0x01, 0x63, 0x8C, 0xFD, 0x0F, 0x60, 0xD8, 0x62, 0xA2, 0xD1, 0x00, 0x60, + 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0xC1, 0xFE, 0x5C, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0xD6, 0x60, 0xB7, 0x78, 0xFF, 0xFF, 0xFF, 0x60, 0xF7, 0x65, 0x20, 0x44, 0x24, 0x80, 0xD0, 0x60, + 0x98, 0x78, 0xFF, 0xFF, 0xDC, 0xF3, 0xFF, 0xFF, 0xFD, 0xA0, 0x2A, 0xF2, 0x03, 0x03, 0xDC, 0x60, + 0x7B, 0x78, 0xFF, 0xFF, 0x60, 0x40, 0xB0, 0x36, 0x11, 0x00, 0xC0, 0x36, 0x02, 0x00, 0x2F, 0x58, + 0xFF, 0xFF, 0x26, 0x46, 0x24, 0x60, 0x74, 0x64, 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, 0xD8, 0x78, + 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0xD0, 0x60, 0x98, 0x78, 0xFF, 0xFF, 0x66, 0x45, 0x00, 0xF4, + 0x0A, 0xF2, 0x0B, 0xF2, 0xFE, 0xA0, 0xF3, 0xA0, 0x6F, 0x02, 0x60, 0x41, 0x09, 0xF2, 0x20, 0x03, + 0x00, 0xA0, 0xFF, 0xA0, 0x53, 0x03, 0x65, 0x03, 0x00, 0xA0, 0xFF, 0xFF, 0x4F, 0x03, 0x1F, 0x60, + 0x54, 0x61, 0x01, 0x64, 0xA1, 0xDB, 0x1F, 0x60, 0x56, 0x61, 0x0D, 0x64, 0xA1, 0xDB, 0x1F, 0x60, + 0x58, 0x61, 0x03, 0x64, 0xA1, 0xDB, 0x26, 0x46, 0x24, 0x60, 0x74, 0x64, 0x40, 0x4B, 0x2C, 0x60, + 0x58, 0x4D, 0xD8, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0xD0, 0x60, 0x98, 0x78, 0xFF, 0xFF, + 0x28, 0x60, 0x2E, 0x61, 0xA1, 0xD3, 0xFF, 0xFF, 0xFE, 0xA0, 0x1F, 0x60, 0x54, 0x61, 0x17, 0x02, + 0x01, 0x64, 0xA1, 0xDB, 0x1F, 0x60, 0x56, 0x61, 0x00, 0x64, 0xA1, 0xDB, 0x1F, 0x60, 0x58, 0x61, + 0x01, 0x64, 0xA1, 0xDB, 0x26, 0x46, 0x24, 0x60, 0x74, 0x64, 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, + 0xD8, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0xD0, 0x60, 0x98, 0x78, 0xFF, 0xFF, 0x02, 0x64, + 0xA1, 0xDB, 0x1F, 0x60, 0x56, 0x61, 0x00, 0x64, 0xA1, 0xDB, 0x1F, 0x60, 0x58, 0x61, 0x01, 0x64, + 0xA1, 0xDB, 0x26, 0x46, 0x24, 0x60, 0x74, 0x64, 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, 0xD8, 0x78, + 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0xD0, 0x60, 0x98, 0x78, 0xFF, 0xFF, 0x65, 0x46, 0x07, 0xF4, + 0x06, 0xF2, 0xFF, 0xFF, 0x01, 0x7E, 0x06, 0xFA, 0x65, 0x46, 0x26, 0x46, 0x24, 0x60, 0x74, 0x64, + 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, 0xD8, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, + 0xFF, 0xFF, 0xD2, 0x60, 0x41, 0x78, 0xFF, 0xFF, 0x0A, 0xF2, 0x09, 0xF2, 0xFC, 0xA0, 0xFF, 0xA0, + 0x11, 0x02, 0x0A, 0x02, 0x0B, 0xF2, 0x65, 0x46, 0x0A, 0x1B, 0x66, 0x41, 0x07, 0xF4, 0x06, 0xF2, + 0xFF, 0xFF, 0x01, 0x7E, 0x06, 0xFA, 0x61, 0x46, 0xD0, 0x60, 0x98, 0x78, 0xFF, 0xFF, 0x26, 0x46, + 0x2F, 0x58, 0xFF, 0xFF, 0x65, 0x46, 0x69, 0xF1, 0x2A, 0xF2, 0x64, 0x41, 0x60, 0x40, 0xA0, 0x3A, + 0x02, 0x00, 0x08, 0xB1, 0x04, 0x00, 0xC0, 0x3A, 0x0C, 0x00, 0x04, 0xB1, 0xFF, 0xFF, 0x20, 0x03, + 0x0F, 0x60, 0xEA, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x10, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x17, 0x00, 0xB0, 0x3A, 0x02, 0x00, 0x01, 0x65, 0x07, 0x00, 0x10, 0x3A, 0x02, 0x00, 0x02, 0x65, + 0x03, 0x00, 0x30, 0x3A, 0x0D, 0x00, 0x10, 0x65, 0xA5, 0x80, 0xFF, 0xFF, 0x09, 0x03, 0x0F, 0x60, + 0xEA, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x08, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x00, 0x66, + 0x2F, 0x58, 0xFF, 0xFF, 0x28, 0x60, 0x2E, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xFC, 0xA0, 0xFF, 0xFF, + 0x16, 0x04, 0x0F, 0x60, 0xEC, 0x62, 0x00, 0x60, 0x02, 0x64, 0xA2, 0xDB, 0xDC, 0x60, 0xBC, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x2D, 0x60, 0x58, 0x65, 0xA5, 0xD1, 0x01, 0x60, + 0x00, 0x64, 0xA0, 0x80, 0xFF, 0xFF, 0x03, 0x03, 0xD0, 0x60, 0x98, 0x78, 0xFF, 0xFF, 0x20, 0x40, + 0x08, 0x2A, 0x03, 0x00, 0xCF, 0x60, 0xF2, 0x78, 0xFF, 0xFF, 0xD7, 0x60, 0xDD, 0x78, 0xFF, 0xFF, + 0x4E, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x2E, 0xF5, 0xFF, 0xFF, 0x27, 0xF2, 0x1C, 0x60, 0xBA, 0x65, + 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, + 0x16, 0x18, 0x61, 0x46, 0x27, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, + 0x26, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x25, 0xF0, 0x63, 0x46, + 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0xA9, 0xF3, + 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x25, 0xF2, 0x26, 0xF0, 0xA7, 0xF2, 0xA8, 0xF0, 0x66, 0xF5, + 0xFF, 0xFF, 0x00, 0xF4, 0xFF, 0xFF, 0x89, 0xF8, 0x66, 0xF5, 0xFF, 0xFF, 0x07, 0xFC, 0x2C, 0xFA, + 0x2D, 0xF8, 0xAE, 0xFA, 0xEB, 0xF3, 0x2F, 0xFA, 0xEC, 0xF3, 0x30, 0xFA, 0xED, 0xF3, 0x31, 0xFA, + 0x81, 0xF3, 0x32, 0xFA, 0x82, 0xF3, 0x33, 0xFA, 0x83, 0xF3, 0x34, 0xFA, 0x31, 0x60, 0x2C, 0x61, + 0xA1, 0xD3, 0xFF, 0xFF, 0x03, 0x1B, 0x00, 0x60, 0xA0, 0x64, 0x02, 0x00, 0x00, 0x60, 0xC0, 0x64, + 0x2A, 0xFA, 0x02, 0x63, 0x3F, 0xFC, 0xAB, 0xFC, 0x00, 0x64, 0x3E, 0xFA, 0xCC, 0xF1, 0x19, 0xF8, + 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, 0x28, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x00, 0x66, 0x46, 0x46, 0xC1, 0xFE, 0x0F, 0x60, 0xEA, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0xD6, 0x60, 0xC2, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x3A, 0x61, 0xAE, 0x60, + 0x58, 0x4D, 0xC4, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0x62, 0xFB, 0xA9, 0xF3, 0x07, 0xFA, 0x0C, 0x60, + 0x80, 0x64, 0xBC, 0xF1, 0x19, 0xF8, 0x0E, 0xFA, 0x00, 0x64, 0x3E, 0xFA, 0x3F, 0xFA, 0x00, 0x60, + 0x3A, 0x61, 0xAE, 0x60, 0x58, 0x4D, 0xC4, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0x61, 0xFB, 0xA9, 0xF3, + 0x07, 0xFA, 0x0C, 0x60, 0x80, 0x64, 0x0E, 0xFA, 0xBC, 0xF1, 0x19, 0xF8, 0x00, 0x64, 0x3E, 0xFA, + 0x3F, 0xFA, 0x10, 0x60, 0x20, 0x62, 0xDE, 0x60, 0xDC, 0x64, 0xA2, 0xDB, 0x0F, 0x60, 0xE0, 0x62, + 0x00, 0x60, 0x80, 0x64, 0xA2, 0xDB, 0xDD, 0x60, 0x71, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x20, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x27, 0x60, 0xB6, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, + 0x01, 0xA8, 0x03, 0xA8, 0x04, 0x03, 0x03, 0x03, 0xDE, 0x60, 0xCA, 0x78, 0xFF, 0xFF, 0x04, 0x60, + 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, 0x0F, 0x60, 0xDE, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x9B, 0xFE, + 0x03, 0x05, 0x20, 0x40, 0x4B, 0x23, 0x0E, 0x00, 0x0F, 0x60, 0xE0, 0x62, 0x80, 0x60, 0x00, 0x64, + 0xA2, 0xDB, 0xDD, 0x60, 0x83, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x21, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x2F, 0x58, 0xFF, 0xFF, 0x1F, 0x60, 0x86, 0x61, 0xA1, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, + 0x07, 0x00, 0x90, 0x60, 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, 0x00, 0x64, 0xA1, 0xDB, 0x04, 0x00, + 0x10, 0x60, 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, 0x8C, 0xF3, 0x58, 0xFB, 0x84, 0xF1, 0xBA, 0xFE, + 0x01, 0xA8, 0x59, 0xF9, 0x04, 0x02, 0x02, 0x64, 0x8C, 0xFB, 0xFF, 0xFF, 0xC1, 0xFE, 0x64, 0x47, + 0xDC, 0xF3, 0x10, 0xB0, 0x04, 0xA8, 0x33, 0x02, 0x32, 0x02, 0x62, 0xF5, 0xEB, 0xF1, 0x2F, 0xF8, + 0xEC, 0xF1, 0x30, 0xF8, 0xED, 0xF1, 0x31, 0xF8, 0x81, 0xF1, 0x2C, 0xF8, 0x32, 0xF8, 0x82, 0xF1, + 0x2D, 0xF8, 0x33, 0xF8, 0x83, 0xF1, 0x2E, 0xF8, 0x34, 0xF8, 0x10, 0x60, 0x48, 0x64, 0x2A, 0xFA, + 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, 0x28, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x22, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x0F, 0x60, + 0xE0, 0x62, 0x00, 0x60, 0x01, 0x64, 0xA2, 0xDB, 0xDD, 0x60, 0xEA, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x23, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x10, 0x67, 0x84, 0xFB, 0x8C, 0xF3, + 0xFF, 0xFF, 0x00, 0xA8, 0xFF, 0xFF, 0x0B, 0x03, 0x0F, 0x60, 0xE0, 0x62, 0x80, 0x60, 0x00, 0x64, + 0xA2, 0xDB, 0xDD, 0x60, 0xEF, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, + 0xDE, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x1B, 0x60, 0xC6, 0x65, 0x1F, 0x60, 0x80, 0x64, 0xA0, 0xD3, + 0x05, 0x7C, 0x08, 0xB0, 0xA5, 0xD3, 0x05, 0x02, 0x00, 0xB8, 0xFF, 0xFF, 0x02, 0x03, 0x15, 0x7C, + 0x0B, 0x00, 0xDC, 0xF3, 0x12, 0x60, 0x26, 0x63, 0x03, 0xA8, 0x7F, 0xF3, 0x05, 0x02, 0xE0, 0x85, + 0x47, 0xD3, 0xFF, 0xFF, 0x07, 0xBC, 0xA2, 0xDB, 0x53, 0xF9, 0x29, 0x60, 0xC6, 0x64, 0x54, 0xFB, + 0x24, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x0F, 0x4E, 0xEC, 0x60, 0x58, 0x4F, 0xB9, 0x78, 0xFF, 0xFF, + 0x0E, 0x4F, 0x0F, 0x60, 0xE0, 0x62, 0x10, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0x60, 0x34, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x25, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0xFF, 0xFF, + 0x59, 0xF3, 0x84, 0xFB, 0x60, 0x40, 0x10, 0x27, 0xDA, 0xFE, 0xDC, 0xF3, 0x00, 0xA8, 0x04, 0xA8, + 0x27, 0x02, 0x26, 0x02, 0x61, 0xF5, 0xEB, 0xF1, 0x2F, 0xF8, 0xEC, 0xF1, 0x30, 0xF8, 0xED, 0xF1, + 0x31, 0xF8, 0x81, 0xF1, 0x2C, 0xF8, 0x82, 0xF1, 0x2D, 0xF8, 0x83, 0xF1, 0x2E, 0xF8, 0xA4, 0x64, + 0x2A, 0xFA, 0x85, 0xF1, 0xC0, 0x67, 0xB0, 0x84, 0x2B, 0xFA, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, + 0x28, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xC1, 0xFE, 0x20, 0x60, 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, 0x26, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x9E, 0xF5, 0xFF, 0xFF, 0x07, 0x1B, 0x20, 0x40, 0x80, 0x2B, 0x5C, 0x00, 0x7F, 0x60, 0xFF, 0x65, + 0x20, 0x44, 0x24, 0x80, 0x00, 0x64, 0x41, 0xFB, 0xF1, 0x60, 0x01, 0x64, 0x24, 0xFA, 0xDA, 0x85, + 0x19, 0x60, 0x86, 0x63, 0x89, 0xF1, 0x43, 0x4C, 0xD3, 0x80, 0xBE, 0xD1, 0x14, 0x05, 0x65, 0x40, + 0x80, 0x2A, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0x64, 0x43, 0x32, 0x61, 0x0F, 0x4E, 0x2F, 0x60, + 0x58, 0x4F, 0x01, 0x78, 0xFF, 0xFF, 0x0E, 0x4F, 0x2C, 0x43, 0x04, 0xA3, 0x41, 0xF3, 0xFF, 0xFF, + 0x32, 0xA4, 0x41, 0xFB, 0xE7, 0x01, 0x20, 0x47, 0x20, 0xB0, 0x20, 0xAF, 0x0F, 0x03, 0x40, 0x40, + 0x0F, 0x60, 0xE0, 0x62, 0x00, 0x60, 0x01, 0x64, 0xA2, 0xDB, 0xDE, 0x60, 0xA3, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x27, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x9E, 0xF1, 0x41, 0xF3, + 0xFF, 0xFF, 0x02, 0xA4, 0xE8, 0x84, 0x64, 0x46, 0x23, 0xFA, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, + 0x64, 0x64, 0xA2, 0xDB, 0x5A, 0xD9, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x00, 0x64, + 0x9E, 0xFB, 0xFA, 0xFE, 0xEB, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x0F, 0x60, 0xD0, 0x62, + 0xA2, 0xD1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x58, 0xF3, 0x8C, 0xFB, + 0xFF, 0xFF, 0xC1, 0xFE, 0x0F, 0x60, 0xDE, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x0F, 0x60, 0xE0, 0x62, + 0x00, 0x60, 0x80, 0x64, 0xA2, 0xDB, 0xDD, 0x60, 0x71, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2E, 0x64, + 0x3B, 0x42, 0x5A, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0x2F, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x9E, 0xF1, + 0x00, 0x64, 0xB0, 0x86, 0x9E, 0xFB, 0x07, 0x03, 0x24, 0x60, 0x74, 0x64, 0x40, 0x4B, 0x2C, 0x60, + 0x58, 0x4D, 0xD8, 0x78, 0xFF, 0xFF, 0xEB, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x0F, 0x60, + 0xDE, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x0F, 0x60, 0xE0, 0x62, 0x00, 0x60, 0x80, 0x64, 0xA2, 0xDB, + 0xDD, 0x60, 0x71, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x97, 0xF3, 0x26, 0x46, + 0x60, 0x43, 0x01, 0x2A, 0x22, 0x00, 0x0F, 0xF2, 0x2A, 0xF0, 0x60, 0x40, 0x10, 0x2A, 0x10, 0x00, + 0x64, 0x40, 0x04, 0x27, 0x1A, 0x00, 0xFD, 0xB3, 0x64, 0x40, 0x20, 0x27, 0x02, 0xBB, 0x0F, 0x60, + 0xF6, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x08, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x0C, 0x00, + 0xFB, 0xB3, 0x64, 0x40, 0x20, 0x27, 0x04, 0xBB, 0x0F, 0x60, 0xF6, 0x62, 0xA2, 0xD1, 0x00, 0x60, + 0x10, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x97, 0xFD, 0x26, 0x46, 0x2F, 0x58, 0xFF, 0xFF, + 0xDC, 0xF3, 0x3F, 0xF2, 0x04, 0xA8, 0x57, 0xFB, 0x02, 0x03, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0xF4, + 0x1E, 0x63, 0x08, 0x64, 0x40, 0x48, 0xBD, 0xD2, 0xFF, 0xFF, 0x60, 0x47, 0x05, 0x36, 0x0B, 0x00, + 0xFF, 0xB5, 0xC7, 0x83, 0x01, 0x2A, 0xF7, 0x01, 0x4F, 0xD2, 0x5B, 0xD2, 0x60, 0x40, 0x05, 0x37, + 0x08, 0x00, 0xDF, 0x83, 0xF5, 0x01, 0xFF, 0xB5, 0x65, 0x41, 0x47, 0x8A, 0x5B, 0xD2, 0xDF, 0x83, + 0x07, 0x00, 0x00, 0x7F, 0xDC, 0x85, 0x47, 0x8A, 0x60, 0x41, 0x5B, 0xD2, 0xDB, 0x83, 0x60, 0x47, + 0x01, 0xB0, 0xFE, 0xB5, 0x02, 0x03, 0x02, 0x64, 0x40, 0x48, 0x85, 0xF1, 0x65, 0x44, 0xE0, 0x84, + 0xE0, 0x84, 0xE0, 0x84, 0xFD, 0xA1, 0xE1, 0x81, 0xE1, 0x81, 0xE1, 0x85, 0xC4, 0x81, 0xD0, 0x84, + 0xD1, 0x80, 0x2A, 0x07, 0x29, 0x06, 0x9C, 0x84, 0xDC, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x85, + 0x96, 0xF3, 0xC7, 0x83, 0x01, 0x26, 0x60, 0x47, 0xAB, 0x83, 0xFC, 0xA3, 0x02, 0x00, 0x03, 0x04, + 0x00, 0xF4, 0x84, 0xA3, 0xFC, 0x01, 0x80, 0x65, 0x47, 0xD0, 0x28, 0x41, 0xA0, 0x80, 0xFE, 0xA1, + 0x16, 0x03, 0x09, 0x02, 0x10, 0x60, 0x14, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x10, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x1E, 0x00, 0x10, 0x60, 0x14, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x04, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x15, 0x00, 0x28, 0x41, 0xFE, 0xA1, 0xFF, 0xFF, 0x09, 0x03, + 0x10, 0x60, 0x14, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x08, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x08, 0x00, 0x10, 0x60, 0x14, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0x0F, 0x60, 0xF6, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0x20, 0x40, 0x20, 0x2A, 0x58, 0x00, 0x26, 0x46, 0x3F, 0xF2, 0x00, 0xF4, 0x60, 0x43, + 0xF4, 0xA3, 0x00, 0x60, 0x1D, 0x61, 0x00, 0x60, 0x80, 0x65, 0x60, 0xFE, 0x81, 0xA1, 0x7F, 0xA1, + 0x02, 0x06, 0x00, 0xF4, 0x03, 0x61, 0xDD, 0x81, 0xA1, 0xD2, 0xCF, 0x83, 0xD4, 0x80, 0x2D, 0x03, + 0x17, 0x03, 0xCF, 0x83, 0x61, 0x44, 0x80, 0xA0, 0x28, 0x03, 0x02, 0x02, 0x00, 0xF4, 0x03, 0x61, + 0xDD, 0x81, 0xA1, 0xD2, 0xCF, 0x83, 0x81, 0xA1, 0x20, 0x03, 0x05, 0x07, 0x7F, 0xA1, 0xCC, 0x84, + 0xDD, 0x81, 0xE4, 0x03, 0xF7, 0x01, 0x00, 0xF4, 0x00, 0xB8, 0x04, 0x61, 0xE4, 0x03, 0xF2, 0x01, + 0x01, 0x60, 0xFF, 0x63, 0x46, 0x48, 0x41, 0x4A, 0xDD, 0x81, 0xA1, 0xD0, 0xDF, 0x83, 0xA3, 0xD9, + 0x64, 0x44, 0xDD, 0x81, 0xA1, 0xD0, 0xDF, 0x83, 0xA3, 0xD9, 0xCC, 0x84, 0x81, 0xA1, 0x05, 0x03, + 0x7F, 0xA1, 0xF7, 0x04, 0x00, 0xF4, 0x03, 0x61, 0xF4, 0x01, 0x20, 0xFE, 0x00, 0xBB, 0x02, 0x60, + 0x00, 0x63, 0x08, 0x24, 0x11, 0x00, 0xBD, 0xD3, 0x06, 0x65, 0xD4, 0x80, 0xBD, 0xD3, 0x0C, 0x02, + 0x60, 0x40, 0x60, 0x3A, 0x09, 0x00, 0x1D, 0x3B, 0x07, 0x00, 0xBD, 0xD3, 0xFF, 0xFF, 0xFF, 0xB5, + 0x00, 0x7E, 0x5C, 0xFB, 0x65, 0x44, 0x5B, 0xFB, 0x26, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, + 0xF6, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x20, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x0F, 0x60, 0xF6, 0x62, 0xA2, 0xD1, 0x02, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x63, 0x97, 0xFD, 0x1A, 0x60, 0x72, 0x63, 0x00, 0x64, + 0xA3, 0xDB, 0x06, 0xA3, 0x10, 0x60, 0x50, 0x64, 0xBD, 0xDB, 0xBD, 0xDB, 0x06, 0x64, 0xA3, 0xDB, + 0x10, 0x60, 0x4E, 0x62, 0xE0, 0x60, 0x07, 0x64, 0xA2, 0xDB, 0xD2, 0xF1, 0x1A, 0x60, 0x76, 0x62, + 0xA2, 0xD9, 0x1A, 0x60, 0x7E, 0x63, 0x00, 0x64, 0xA3, 0xDB, 0x06, 0xA3, 0x10, 0x60, 0x54, 0x64, + 0xBD, 0xDB, 0xBD, 0xDB, 0x06, 0x64, 0xA3, 0xDB, 0x10, 0x60, 0x52, 0x62, 0xE0, 0x60, 0x11, 0x64, + 0xA2, 0xDB, 0x28, 0x60, 0x04, 0x62, 0xA2, 0xD1, 0x1A, 0x60, 0x82, 0x62, 0xA2, 0xD9, 0x00, 0x60, + 0x3A, 0x61, 0xAE, 0x60, 0x58, 0x4D, 0xC4, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0x64, 0xFB, 0xA9, 0xF3, + 0x07, 0xFA, 0xBC, 0xF3, 0x19, 0xFA, 0xF8, 0x60, 0x80, 0x64, 0x0E, 0xFA, 0x00, 0x64, 0x3E, 0xFA, + 0x3F, 0xFA, 0x00, 0x60, 0x3A, 0x61, 0xAE, 0x60, 0x58, 0x4D, 0xC4, 0x78, 0xFF, 0xFF, 0x66, 0x44, + 0x65, 0xFB, 0xA9, 0xF3, 0x07, 0xFA, 0xBC, 0xF3, 0x19, 0xFA, 0x24, 0x60, 0x80, 0x64, 0x0E, 0xFA, + 0x00, 0x64, 0x3E, 0xFA, 0x3F, 0xFA, 0x10, 0x60, 0x14, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x5A, 0xDB, + 0x10, 0x60, 0x28, 0x62, 0xE0, 0x60, 0x77, 0x64, 0xA2, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x63, + 0x97, 0xFD, 0xBA, 0xFE, 0xFE, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x84, 0xFD, 0x0F, 0x60, + 0xEA, 0x62, 0xA2, 0xD1, 0x04, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x0F, 0x60, + 0xF6, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x5A, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0x28, 0x60, 0x04, 0x62, + 0xA2, 0xD1, 0x1A, 0x60, 0x82, 0x62, 0xA2, 0xD9, 0x27, 0x60, 0xFE, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, + 0x0A, 0x1B, 0x00, 0x64, 0x84, 0xFB, 0xBA, 0xFE, 0x0F, 0x60, 0xF6, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x5A, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0xBA, 0xFE, 0x97, 0xF3, 0x00, 0x63, 0x84, 0xFD, 0x10, 0xBC, + 0x97, 0xFB, 0xFE, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, + 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x00, 0x60, 0x64, 0x63, 0x1A, 0x60, + 0x42, 0x64, 0xA0, 0xDD, 0x0F, 0x60, 0xF6, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x0F, 0x60, 0xF8, 0x62, + 0x01, 0x60, 0x04, 0x64, 0xA2, 0xDB, 0xE0, 0x60, 0xC9, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x0F, 0x60, 0xF6, 0x62, 0xA2, 0xD1, 0x01, 0x60, 0x00, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xA3, 0x01, 0x31, 0x40, 0x04, 0x2A, 0xE3, 0x01, 0x20, 0x40, + 0x52, 0x23, 0x12, 0x00, 0x0F, 0x60, 0xF6, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x10, 0x60, 0x14, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x0F, 0x60, 0xF8, 0x62, 0x81, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xE0, 0x60, + 0xC9, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0xDB, 0x01, 0x0F, 0x60, 0xF6, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x01, 0x60, 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, 0x65, 0xF5, 0xBC, 0xF1, 0x19, 0xF8, 0x81, 0xF1, + 0x2C, 0xF8, 0x32, 0xF8, 0x82, 0xF1, 0x2D, 0xF8, 0x33, 0xF8, 0x83, 0xF1, 0x2E, 0xF8, 0x34, 0xF8, + 0xEB, 0xF1, 0x2F, 0xF8, 0xEC, 0xF1, 0x30, 0xF8, 0xED, 0xF1, 0x31, 0xF8, 0x11, 0x60, 0x48, 0x64, + 0x2A, 0xFA, 0x00, 0x64, 0x2B, 0xFA, 0x23, 0xFA, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, 0x28, 0x64, + 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, + 0x0F, 0x60, 0xF8, 0x62, 0x00, 0x60, 0x01, 0x64, 0xA2, 0xDB, 0xE1, 0x60, 0x23, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x65, 0xF5, 0x23, 0xF2, 0xFF, 0xFF, 0x01, 0x18, 0x7B, 0x01, + 0x10, 0x67, 0x84, 0xFB, 0x03, 0x64, 0x98, 0xFB, 0xFE, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, + 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x0F, 0x60, 0xF6, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x0F, 0x60, 0xF8, 0x62, 0x81, 0x60, 0x00, 0x64, + 0xA2, 0xDB, 0xE1, 0x60, 0x46, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x0D, 0x00, 0x0F, 0x60, 0xF6, 0x62, + 0xA2, 0xD1, 0x01, 0x60, 0x00, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, 0xA2, 0xDB, + 0xE0, 0x60, 0x77, 0x78, 0xFF, 0xFF, 0x46, 0x60, 0x00, 0x65, 0x20, 0x41, 0x8E, 0xF3, 0xA5, 0x80, + 0x01, 0xB0, 0x01, 0x02, 0x06, 0x00, 0x0F, 0x60, 0xF6, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x2F, 0x58, + 0xFF, 0xFF, 0x1A, 0x60, 0x42, 0x65, 0xA5, 0xD3, 0x01, 0x63, 0x8C, 0xFD, 0x27, 0x1B, 0x00, 0x60, + 0x64, 0x64, 0xA5, 0xDB, 0x65, 0xF5, 0xBC, 0xF1, 0x19, 0xF8, 0x81, 0xF1, 0x2C, 0xF8, 0x32, 0xF8, + 0x82, 0xF1, 0x2D, 0xF8, 0x33, 0xF8, 0x83, 0xF1, 0x2E, 0xF8, 0x34, 0xF8, 0xEB, 0xF1, 0x2F, 0xF8, + 0xEC, 0xF1, 0x30, 0xF8, 0xED, 0xF1, 0x31, 0xF8, 0x11, 0x60, 0x48, 0x64, 0x2A, 0xFA, 0x00, 0x64, + 0x2B, 0xFA, 0x23, 0xFA, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, 0x28, 0x64, 0xA2, 0xDB, 0x66, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x06, 0x00, 0x97, 0xF3, 0x32, 0x40, + 0x02, 0x26, 0x02, 0x00, 0x40, 0x2A, 0xDA, 0xFE, 0xC1, 0xFE, 0x0F, 0x60, 0xF6, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x0F, 0x60, 0xF8, 0x62, 0x01, 0x60, 0x82, 0x64, 0xA2, 0xDB, 0xE1, 0x60, 0xA4, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xF6, 0x62, 0xA2, 0xD1, 0x01, 0x60, + 0x00, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xE0, 0x60, 0x77, 0x78, + 0xFF, 0xFF, 0x00, 0x60, 0x02, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x06, 0x03, 0xA0, 0x84, 0xA2, 0xDB, + 0xBA, 0xFE, 0xE3, 0x60, 0xC8, 0x78, 0xFF, 0xFF, 0x02, 0x64, 0x8C, 0xFB, 0x01, 0x60, 0x00, 0x65, + 0x20, 0x44, 0x34, 0x80, 0xBA, 0xFE, 0xC1, 0xFE, 0x0F, 0x60, 0xF6, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x10, 0x60, 0x14, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x0F, 0x60, 0xF8, 0x62, 0x01, 0x60, 0x46, 0x64, + 0xA2, 0xDB, 0xE1, 0x60, 0xD7, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, + 0xF6, 0x62, 0xA2, 0xD1, 0x01, 0x60, 0x00, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0xE0, 0x60, 0x77, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x3C, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x10, 0x60, 0x14, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x08, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x34, 0x01, 0x00, 0x60, 0x02, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0x0C, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x28, 0x60, 0x00, 0x62, 0xA2, 0xD1, + 0x97, 0xF3, 0x00, 0x61, 0xD1, 0x80, 0xF7, 0xB4, 0xF0, 0x03, 0x97, 0xFB, 0x35, 0x00, 0x00, 0x60, + 0x10, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x0F, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x28, 0x60, 0x00, 0x62, + 0xA2, 0xD1, 0x97, 0xF3, 0x00, 0x61, 0xD1, 0x80, 0x08, 0xBC, 0x03, 0x02, 0xE2, 0x60, 0xE8, 0x78, + 0xFF, 0xFF, 0x97, 0xFB, 0x21, 0x00, 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, + 0xA0, 0x84, 0xA2, 0xDB, 0xE2, 0x60, 0xE8, 0x78, 0xFF, 0xFF, 0x0F, 0x60, 0xF6, 0x62, 0xA2, 0xD1, + 0x00, 0x60, 0x40, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xC5, 0x01, + 0x00, 0x60, 0x02, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xE3, 0x60, + 0xC8, 0x78, 0xFF, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0x02, 0x63, 0x97, 0xF3, 0x8C, 0xFD, 0x01, 0xBC, + 0xC1, 0xFE, 0x97, 0xFB, 0xD2, 0xF1, 0x1A, 0x60, 0x76, 0x62, 0xA2, 0xD9, 0x0F, 0x60, 0xF6, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x10, 0x60, 0x14, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x0F, 0x60, 0xF8, 0x62, + 0x01, 0x60, 0x34, 0x64, 0xA2, 0xDB, 0xE2, 0x60, 0x62, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x24, 0x60, + 0xAA, 0x62, 0x1A, 0x60, 0x72, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, + 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xF6, 0x62, 0xA2, 0xD1, 0x01, 0x60, 0x00, 0x64, 0xA0, 0x80, + 0x9C, 0x84, 0x0E, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x72, 0x64, + 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0xE0, 0x60, 0x77, 0x78, 0xFF, 0xFF, + 0x00, 0x60, 0x10, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x17, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x97, 0xF3, + 0xFF, 0xFF, 0x60, 0x40, 0x04, 0x2A, 0x01, 0x00, 0xD2, 0x01, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, + 0x72, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x97, 0xF3, 0xFF, 0xFF, + 0x60, 0x40, 0x08, 0x2A, 0x4D, 0x00, 0x54, 0x00, 0x10, 0x60, 0x14, 0x62, 0xA2, 0xD1, 0x00, 0x60, + 0x10, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x08, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x97, 0xF3, 0xFF, 0xFF, + 0x08, 0xBC, 0x97, 0xFB, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x60, 0x02, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xAB, 0x01, 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x0C, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x72, 0x64, 0xA2, 0xDB, + 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x2B, 0x00, 0x00, 0x60, 0x08, 0x64, 0xA0, 0x80, + 0x9C, 0x84, 0x0C, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x72, 0x64, + 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x13, 0x00, 0x0F, 0x60, 0xF6, 0x62, + 0xA2, 0xD1, 0x00, 0x60, 0x20, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x08, 0x03, 0xA0, 0x84, 0xA2, 0xDB, + 0x97, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x2A, 0x04, 0x00, 0x0A, 0x00, 0x2F, 0x58, 0xFF, 0xFF, + 0x00, 0x00, 0x97, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, 0x97, 0xFB, 0xE1, 0x60, 0x2A, 0x78, 0xFF, 0xFF, + 0x27, 0x60, 0xFE, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x01, 0xA8, 0xFF, 0xFF, 0x03, 0x02, 0xE3, 0x60, + 0xD1, 0x78, 0xFF, 0xFF, 0x97, 0xF3, 0x01, 0x63, 0x8C, 0xFD, 0x21, 0xBC, 0x97, 0xFB, 0x64, 0xF5, + 0x81, 0xF1, 0x2C, 0xF8, 0x82, 0xF1, 0x2D, 0xF8, 0x83, 0xF1, 0x2E, 0xF8, 0x85, 0xF1, 0xC0, 0x67, + 0xB0, 0x84, 0x2B, 0xFA, 0xBC, 0xF1, 0x19, 0xF8, 0xEB, 0xF1, 0x2F, 0xF8, 0xEC, 0xF1, 0x30, 0xF8, + 0xED, 0xF1, 0x31, 0xF8, 0x10, 0x60, 0xA4, 0x64, 0x2A, 0xFA, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, + 0x28, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xC1, 0xFE, 0x1A, 0x60, 0x76, 0x62, 0x00, 0x60, 0x50, 0x64, 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, + 0x1A, 0x60, 0x72, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x0F, 0x60, + 0xF6, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x10, 0x60, 0x14, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x0F, 0x60, + 0xF8, 0x62, 0x01, 0x60, 0x2C, 0x64, 0xA2, 0xDB, 0xE3, 0x60, 0x3A, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xF6, 0x62, 0xA2, 0xD1, 0x01, 0x60, 0x00, 0x64, 0xA0, 0x80, + 0x9C, 0x84, 0x0E, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x72, 0x64, + 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0xE0, 0x60, 0x77, 0x78, 0xFF, 0xFF, + 0x10, 0x60, 0x14, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, + 0xA0, 0x84, 0xA2, 0xDB, 0x8D, 0x01, 0x0F, 0x60, 0xF6, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x08, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0x08, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x97, 0xF3, 0xFF, 0xFF, 0x02, 0xB0, + 0xFF, 0xFF, 0x4E, 0x03, 0x7D, 0x01, 0x00, 0x60, 0x08, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, + 0xA0, 0x84, 0xA2, 0xDB, 0x45, 0x00, 0x00, 0x60, 0x02, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x16, 0x03, + 0xA0, 0x84, 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x72, 0x64, 0xA2, 0xDB, 0x03, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x28, 0x60, 0x00, 0x62, 0xA2, 0xD3, 0x97, 0xF3, 0x00, 0xA8, + 0xF7, 0xB4, 0x2E, 0x03, 0x97, 0xFB, 0xE2, 0x60, 0x3C, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x10, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0x17, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, + 0x72, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x28, 0x60, 0x00, 0x62, + 0xA2, 0xD3, 0x97, 0xF3, 0x00, 0xA8, 0x08, 0xBC, 0x01, 0x02, 0x42, 0x01, 0x97, 0xFB, 0xE2, 0x60, + 0x3C, 0x78, 0xFF, 0xFF, 0x0F, 0x60, 0xF6, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x20, 0x64, 0xA0, 0x80, + 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x02, 0x00, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x00, + 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x72, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0x97, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, 0x97, 0xFB, 0xE1, 0x60, 0x2A, 0x78, 0xFF, 0xFF, + 0x97, 0xF3, 0x01, 0x63, 0x8C, 0xFD, 0x01, 0xBC, 0x97, 0xFB, 0x00, 0x64, 0x84, 0xFB, 0xC1, 0xFE, + 0x29, 0x00, 0x97, 0xF3, 0x01, 0x63, 0x8C, 0xFD, 0x01, 0xBC, 0x97, 0xFB, 0x00, 0x64, 0x84, 0xFB, + 0x64, 0xF5, 0x81, 0xF1, 0x2C, 0xF8, 0x82, 0xF1, 0x2D, 0xF8, 0x83, 0xF1, 0x2E, 0xF8, 0x85, 0xF1, + 0xC0, 0x67, 0xB0, 0x84, 0x2B, 0xFA, 0xBC, 0xF1, 0x19, 0xF8, 0xEB, 0xF1, 0x2F, 0xF8, 0xEC, 0xF1, + 0x30, 0xF8, 0xED, 0xF1, 0x31, 0xF8, 0x00, 0x60, 0xA4, 0x64, 0x2A, 0xFA, 0x24, 0x60, 0x74, 0x62, + 0x24, 0x60, 0x28, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0xC1, 0xFE, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x7E, 0x64, 0xA2, 0xDB, 0x02, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x0F, 0x60, 0xF6, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x10, 0x60, + 0x14, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x0F, 0x60, 0xF8, 0x62, 0x03, 0x60, 0x0E, 0x64, 0xA2, 0xDB, + 0xE4, 0x60, 0x16, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xF6, 0x62, + 0xA2, 0xD1, 0x01, 0x60, 0x00, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x0E, 0x03, 0xA0, 0x84, 0xA2, 0xDB, + 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x7E, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0xE0, 0x60, 0x77, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x0A, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xC6, 0x01, 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x15, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x10, 0x60, 0x14, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x04, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x8B, 0x01, 0x00, 0x60, 0x12, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xAC, 0x01, 0x0F, 0x60, 0xF6, 0x62, + 0xA2, 0xD1, 0x02, 0x60, 0x00, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0xAD, 0x03, 0xA0, 0x84, 0xA2, 0xDB, + 0x10, 0x67, 0x84, 0xFB, 0x0F, 0x60, 0xF6, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x10, 0x60, 0x14, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x65, 0xF5, 0xBC, 0xF1, 0x19, 0xF8, 0x81, 0xF1, 0x2C, 0xF8, 0x32, 0xF8, + 0x82, 0xF1, 0x2D, 0xF8, 0x33, 0xF8, 0x83, 0xF1, 0x2E, 0xF8, 0x34, 0xF8, 0xEB, 0xF1, 0x2F, 0xF8, + 0xEC, 0xF1, 0x30, 0xF8, 0xED, 0xF1, 0x31, 0xF8, 0x11, 0x60, 0x48, 0x64, 0x2A, 0xFA, 0x00, 0x64, + 0x2B, 0xFA, 0x23, 0xFA, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, 0x28, 0x64, 0xA2, 0xDB, 0x66, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x97, 0xF3, 0xC1, 0xFE, 0xFE, 0xB4, + 0x97, 0xFB, 0x0F, 0x60, 0xF8, 0x62, 0x00, 0x60, 0x03, 0x64, 0xA2, 0xDB, 0xE4, 0x60, 0x94, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xF6, 0x62, 0xA2, 0xD1, 0x00, 0x60, + 0x02, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x29, 0x01, 0x65, 0xF5, + 0x23, 0xF2, 0x98, 0xF3, 0x04, 0x18, 0xCC, 0x84, 0x98, 0xFB, 0x01, 0x03, 0x21, 0x01, 0xE1, 0x60, + 0x2A, 0x78, 0xFF, 0xFF, 0x27, 0x60, 0xFE, 0x62, 0xA2, 0xD3, 0x84, 0xF1, 0x02, 0xA8, 0x2A, 0xF2, + 0x03, 0x02, 0xB0, 0x84, 0x2A, 0xFA, 0x08, 0x00, 0x0F, 0x60, 0xF6, 0x62, 0xA2, 0xD1, 0x00, 0x60, + 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, 0x22, 0x64, + 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, + 0x24, 0x60, 0x34, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0xDB, 0x02, 0xBF, 0x60, + 0xE7, 0x78, 0xFF, 0xFF, 0x0F, 0x60, 0xFC, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x1A, 0x60, 0xAE, 0x63, 0x00, 0x64, 0xA3, 0xDB, + 0x06, 0xA3, 0x10, 0x60, 0x5C, 0x64, 0xBD, 0xDB, 0xBD, 0xDB, 0x06, 0x64, 0xA3, 0xDB, 0x10, 0x60, + 0x5A, 0x62, 0xE4, 0x60, 0xD2, 0x64, 0xA2, 0xDB, 0x1F, 0x60, 0x5C, 0x62, 0xA2, 0xD1, 0x1A, 0x60, + 0xB2, 0x62, 0xA2, 0xD9, 0x10, 0x60, 0x2A, 0x62, 0xE4, 0x60, 0xF9, 0x64, 0xA2, 0xDB, 0x2F, 0x58, + 0xFF, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0x1F, 0x60, 0x80, 0x65, 0xA5, 0xD3, 0xFF, 0xFF, 0x02, 0xBC, + 0xF3, 0xB4, 0x01, 0xB0, 0xA5, 0xDB, 0x0C, 0x02, 0x12, 0x60, 0x26, 0x61, 0x00, 0x64, 0x1A, 0x63, + 0x59, 0xDB, 0xFE, 0x1F, 0x1F, 0x60, 0x5C, 0x61, 0x0A, 0x64, 0x1A, 0x63, 0x59, 0xDB, 0xFE, 0x1F, + 0x7F, 0xF3, 0x7E, 0xFB, 0x01, 0x64, 0x7F, 0xFB, 0x01, 0x61, 0xCC, 0x84, 0xFF, 0xFF, 0x02, 0x03, + 0xE1, 0x81, 0xFB, 0x01, 0xBA, 0xF3, 0x61, 0x45, 0xA4, 0x80, 0xFF, 0xFF, 0x69, 0x03, 0x0F, 0x60, + 0xFC, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0B, 0x04, 0x0F, 0x60, 0xFE, 0x62, 0x40, 0x60, + 0x00, 0x64, 0xA2, 0xDB, 0xE5, 0x60, 0x1F, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x7F, 0xF1, 0x24, 0x60, 0x9A, 0x62, 0xA2, 0xD9, 0x1E, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, + 0x0F, 0x60, 0xFE, 0x62, 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xE5, 0x60, 0x43, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xBE, 0xFE, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x40, 0x60, + 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x0F, 0x60, 0xFC, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x0F, 0x60, 0xFE, 0x62, 0x00, 0x60, 0x1A, 0x64, 0xA2, 0xDB, 0xE5, 0x60, 0x64, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0xAE, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x04, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xFC, 0x62, 0xA2, 0xD1, 0x00, 0x60, + 0x08, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x0C, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, + 0x1A, 0x60, 0xAE, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x26, 0x00, + 0x00, 0x60, 0x10, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x0B, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x24, 0x60, + 0xAA, 0x62, 0x1A, 0x60, 0xAE, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, + 0x12, 0x60, 0x26, 0x65, 0x7F, 0xF3, 0xFF, 0xFF, 0x04, 0xA4, 0xF2, 0xA0, 0xFF, 0xFF, 0x01, 0x06, + 0xF1, 0xA4, 0x01, 0x36, 0x0B, 0x00, 0x00, 0x36, 0x04, 0xA4, 0x60, 0x41, 0xE0, 0x84, 0xC4, 0x84, + 0xA0, 0xD3, 0xFF, 0xFF, 0x00, 0xB8, 0x61, 0x44, 0xEF, 0x02, 0x75, 0x01, 0x1F, 0x60, 0x80, 0x65, + 0xA5, 0xD3, 0x7E, 0xF1, 0xFC, 0xB4, 0xA5, 0xDB, 0x7F, 0xF9, 0x0F, 0x60, 0xFC, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0xDE, 0xFE, 0x0B, 0x04, 0x0F, 0x60, 0xFE, 0x62, 0x40, 0x60, 0x00, 0x64, 0xA2, 0xDB, + 0xE5, 0x60, 0xA5, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x7F, 0xF1, 0x24, 0x60, + 0x9A, 0x62, 0xA2, 0xD9, 0x1E, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x0F, 0x60, 0xFE, 0x62, + 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xE5, 0x60, 0xC9, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0xBE, 0xFE, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x0F, 0x60, 0xFC, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x5A, 0xDB, 0x0F, 0x60, + 0xD0, 0x62, 0xA2, 0xD1, 0x10, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0xE6, 0x60, 0xE9, 0x78, 0xFF, 0xFF, 0xE6, 0x60, 0xED, 0x78, 0xFF, 0xFF, 0x1F, 0x60, + 0x80, 0x63, 0xA3, 0xD3, 0x26, 0x46, 0x02, 0xB0, 0x3F, 0xF2, 0xF6, 0x03, 0x02, 0x60, 0x00, 0x63, + 0x01, 0x60, 0x00, 0x65, 0xD4, 0x80, 0x00, 0xF4, 0x02, 0x24, 0x65, 0x44, 0x12, 0x65, 0x60, 0x41, + 0xA5, 0xD0, 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0x64, 0x44, 0x00, 0x7F, + 0xCD, 0x81, 0xBD, 0xDB, 0x05, 0x03, 0x64, 0x47, 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, 0xF0, 0x02, + 0x02, 0x60, 0x14, 0x63, 0xA3, 0xD3, 0xFF, 0xFF, 0x01, 0xB4, 0xFF, 0xFF, 0x37, 0x02, 0x29, 0x60, + 0xA4, 0x64, 0xA0, 0xD1, 0x1F, 0x60, 0x0E, 0x63, 0x31, 0x18, 0x64, 0x41, 0x44, 0x4B, 0x29, 0x60, + 0xA6, 0x65, 0xA5, 0xD1, 0xDA, 0x85, 0x64, 0x44, 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, 0x05, 0x03, + 0x64, 0x47, 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, 0xF4, 0x02, 0x02, 0x60, 0x1A, 0x61, 0xA1, 0xD3, + 0x2B, 0x45, 0x60, 0x40, 0x00, 0x36, 0x1A, 0x00, 0x01, 0x36, 0x18, 0x00, 0xD4, 0x80, 0x65, 0x43, + 0xB0, 0x02, 0x1F, 0x60, 0x0C, 0x64, 0xE3, 0x83, 0xFE, 0xA3, 0x59, 0xD1, 0x58, 0xD3, 0x40, 0x4B, + 0xD0, 0x80, 0x2B, 0x44, 0x02, 0x02, 0xF9, 0x1F, 0x09, 0x00, 0x02, 0x60, 0x1A, 0x61, 0x65, 0x43, + 0xE3, 0x83, 0xFE, 0xA3, 0x59, 0xD3, 0xFF, 0xFF, 0x9C, 0x1B, 0xFC, 0x1F, 0x26, 0x46, 0x3F, 0xF0, + 0x01, 0x60, 0x00, 0x64, 0xD0, 0x80, 0x64, 0x41, 0x01, 0x05, 0x60, 0x41, 0xF4, 0xA1, 0x02, 0x60, + 0x18, 0x63, 0xBD, 0xD3, 0xBD, 0xD1, 0xFD, 0xA0, 0xF9, 0xA0, 0x08, 0x03, 0x35, 0x03, 0xFE, 0xA1, + 0x64, 0x42, 0xE2, 0x85, 0xD1, 0x81, 0xC7, 0x83, 0x84, 0x06, 0xF3, 0x01, 0x12, 0x60, 0x26, 0x65, + 0xBD, 0xD3, 0xFD, 0xA1, 0xE0, 0x84, 0xC4, 0x85, 0x05, 0x64, 0xA5, 0xDB, 0x1F, 0x60, 0x80, 0x65, + 0xA5, 0xD3, 0x41, 0x48, 0x04, 0xBC, 0xA5, 0xDB, 0x12, 0x60, 0x28, 0x65, 0x12, 0x60, 0x44, 0x61, + 0x49, 0xD3, 0xD6, 0x80, 0x00, 0xB8, 0x0E, 0x03, 0xFB, 0x03, 0x62, 0x45, 0x12, 0x60, 0x26, 0x61, + 0x59, 0xD3, 0xD6, 0x80, 0x00, 0xB8, 0x06, 0x03, 0xFB, 0x03, 0x05, 0x64, 0xA2, 0xDB, 0xD6, 0x80, + 0x02, 0xA2, 0xFC, 0x02, 0x0F, 0x60, 0xFC, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x10, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x28, 0x41, 0xC5, 0x01, 0x63, 0x45, 0x04, 0x60, 0x00, 0x63, 0xD7, 0x83, + 0xEB, 0x83, 0xD3, 0x80, 0x65, 0x43, 0x01, 0x05, 0x54, 0x00, 0xFE, 0xA3, 0x43, 0x4B, 0xA3, 0xD3, + 0x63, 0x41, 0x60, 0x43, 0x1B, 0x60, 0xC6, 0x64, 0xA0, 0xDD, 0xE3, 0x83, 0xFE, 0xA3, 0x59, 0xD1, + 0x58, 0xD9, 0xFD, 0x1F, 0x00, 0x63, 0x58, 0xDD, 0x2B, 0x43, 0xBD, 0xD1, 0x1F, 0x60, 0x78, 0x64, + 0x64, 0x41, 0xBD, 0xD1, 0x58, 0xD9, 0xBD, 0xD1, 0xFC, 0xA1, 0x41, 0x4B, 0x58, 0xD9, 0xBD, 0xD1, + 0xA0, 0xD9, 0x12, 0x60, 0x26, 0x61, 0x12, 0x60, 0x42, 0x65, 0x00, 0x64, 0xD5, 0x80, 0x59, 0xDB, + 0xFD, 0x02, 0x12, 0x60, 0x24, 0x65, 0xBD, 0xD3, 0xA3, 0xD1, 0xE0, 0x84, 0xC4, 0x82, 0x12, 0x60, + 0x44, 0x65, 0x05, 0x64, 0x64, 0x41, 0x5A, 0xDB, 0xD6, 0x80, 0xCD, 0x81, 0x22, 0x03, 0xFB, 0x02, + 0x1F, 0x60, 0x5A, 0x61, 0x4B, 0xD1, 0x04, 0xA3, 0xBD, 0xD3, 0xFF, 0xFF, 0xF6, 0xA0, 0xC1, 0x82, + 0x05, 0x05, 0x64, 0x41, 0x5A, 0xDB, 0xCD, 0x81, 0xFF, 0xFF, 0xFC, 0x02, 0x2B, 0x41, 0xFD, 0xA1, + 0x41, 0x4B, 0xDF, 0x07, 0x0F, 0x60, 0xFC, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x08, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x1F, 0x60, 0x80, 0x65, 0xA5, 0xD3, 0xFF, 0xFF, 0x08, 0xBC, 0xA5, 0xDB, + 0xFF, 0xFF, 0x20, 0xFE, 0x26, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x20, 0xFE, 0x9A, 0xFF, 0x5C, 0x61, + 0x3F, 0xF2, 0xFF, 0xFF, 0x83, 0xA0, 0xFF, 0xFF, 0x04, 0x28, 0x39, 0x00, 0xF4, 0xA4, 0x60, 0x43, + 0x00, 0xF4, 0x1E, 0x62, 0x60, 0xFE, 0xA2, 0xD2, 0xFF, 0xFF, 0x60, 0x40, 0x85, 0x36, 0x10, 0x00, + 0xDE, 0x82, 0xA2, 0xD2, 0xFF, 0xFF, 0x20, 0xFE, 0xFF, 0xB4, 0x02, 0xA4, 0x53, 0x93, 0x51, 0x91, + 0x05, 0x0E, 0xFF, 0xA4, 0x42, 0x92, 0x63, 0x40, 0x61, 0x40, 0xEC, 0x1C, 0x98, 0xFF, 0xD9, 0x01, + 0x20, 0xFE, 0x05, 0x64, 0x00, 0x7C, 0x42, 0x92, 0x60, 0xFE, 0xDE, 0x82, 0xA2, 0xD2, 0xDE, 0x82, + 0xA2, 0xD0, 0xFF, 0xFF, 0x20, 0xFE, 0x64, 0x5F, 0x60, 0x43, 0x60, 0xFE, 0xDE, 0x82, 0xA2, 0xD2, + 0xDE, 0x82, 0xA2, 0xD0, 0xFF, 0xFF, 0x20, 0xFE, 0x64, 0x5F, 0x98, 0xFF, 0x01, 0xA3, 0x01, 0xA4, + 0x2D, 0x60, 0x5A, 0x62, 0xA2, 0xDD, 0x2D, 0x60, 0x5E, 0x62, 0xA2, 0xDB, 0xBA, 0x01, 0x98, 0xFF, + 0xB8, 0x01, 0x00, 0x60, 0xA0, 0x61, 0xAE, 0x60, 0x58, 0x4D, 0xC4, 0x78, 0xFF, 0xFF, 0x66, 0x44, + 0x5D, 0xFB, 0x04, 0x64, 0x03, 0xFA, 0x80, 0x64, 0x2A, 0xFA, 0xCC, 0xF1, 0x19, 0xF8, 0x00, 0x64, + 0x3E, 0xFA, 0x00, 0x60, 0x80, 0x64, 0x0E, 0xFA, 0xA9, 0xF1, 0x07, 0xF8, 0x67, 0x44, 0x2C, 0xFA, + 0x2D, 0xFA, 0x2E, 0xFA, 0x10, 0x60, 0x1C, 0x62, 0xE8, 0x60, 0xDF, 0x64, 0xA2, 0xDB, 0x2F, 0x58, + 0xFF, 0xFF, 0x5D, 0xF5, 0xEB, 0xF1, 0x2F, 0xF8, 0xEC, 0xF1, 0x30, 0xF8, 0xED, 0xF1, 0x31, 0xF8, + 0x81, 0xF1, 0x32, 0xF8, 0x82, 0xF1, 0x33, 0xF8, 0x83, 0xF1, 0x34, 0xF8, 0x28, 0x60, 0x2C, 0x62, + 0xA2, 0xD1, 0x02, 0x64, 0x64, 0x40, 0xFE, 0x26, 0x10, 0xBC, 0x32, 0x40, 0x08, 0x26, 0x10, 0xBC, + 0x2F, 0x60, 0x44, 0x62, 0xA2, 0xDB, 0x28, 0x60, 0x2A, 0x62, 0xA2, 0xD1, 0x2D, 0x60, 0x7A, 0x64, + 0x02, 0x18, 0x27, 0x60, 0xDA, 0x64, 0x2E, 0x60, 0xAE, 0x62, 0xA2, 0xDB, 0x2E, 0x60, 0xCA, 0x62, + 0xA2, 0xDB, 0x2D, 0x60, 0xA6, 0x61, 0x28, 0x60, 0xCC, 0x62, 0xA2, 0xD3, 0x2E, 0x60, 0x96, 0x65, + 0xFE, 0xA4, 0xE0, 0x84, 0x02, 0x05, 0x67, 0x44, 0x99, 0x00, 0xE0, 0x84, 0xC4, 0x85, 0x2D, 0x60, + 0xCC, 0x62, 0xA2, 0xD3, 0xA5, 0xD1, 0xDA, 0x85, 0x2D, 0x60, 0xC4, 0x62, 0xA0, 0x83, 0xA2, 0xDD, + 0xA5, 0xD1, 0x2D, 0x60, 0xC2, 0x62, 0xA0, 0x83, 0xA2, 0xDD, 0x2D, 0x60, 0xA0, 0x61, 0xDD, 0x60, + 0x06, 0x64, 0xA1, 0xDB, 0x06, 0xA1, 0x2D, 0x60, 0xCA, 0x62, 0xA2, 0xD3, 0x2D, 0x60, 0xC2, 0x62, + 0x60, 0x40, 0xFD, 0xA0, 0xA2, 0xD3, 0x74, 0x03, 0x50, 0x60, 0x00, 0x7C, 0x60, 0x40, 0x02, 0x2A, + 0x03, 0x00, 0x01, 0x60, 0xF2, 0x63, 0x0E, 0x00, 0x04, 0x2A, 0x03, 0x00, 0x02, 0x60, 0xF2, 0x63, + 0x09, 0x00, 0x10, 0x2A, 0x03, 0x00, 0x04, 0x60, 0xF2, 0x63, 0x04, 0x00, 0x20, 0x2A, 0x04, 0x00, + 0x05, 0x60, 0xF2, 0x63, 0x59, 0xD9, 0x59, 0xDD, 0x2D, 0x60, 0xCA, 0x62, 0xA2, 0xD3, 0x2D, 0x60, + 0xC4, 0x62, 0xFE, 0xA0, 0xA2, 0xD3, 0x54, 0x03, 0x00, 0x60, 0x00, 0x63, 0x59, 0xDD, 0x61, 0x45, + 0x60, 0x40, 0x01, 0x2A, 0x04, 0x00, 0x00, 0x60, 0xF2, 0x63, 0x59, 0xD9, 0x59, 0xDD, 0x60, 0x40, + 0x02, 0x2A, 0x04, 0x00, 0x01, 0x60, 0xF2, 0x63, 0x59, 0xD9, 0x59, 0xDD, 0x60, 0x40, 0x04, 0x2A, + 0x04, 0x00, 0x02, 0x60, 0xF2, 0x63, 0x59, 0xD9, 0x59, 0xDD, 0x60, 0x40, 0x10, 0x2A, 0x04, 0x00, + 0x04, 0x60, 0xF2, 0x63, 0x59, 0xD9, 0x59, 0xDD, 0x60, 0x40, 0x20, 0x2A, 0x04, 0x00, 0x05, 0x60, + 0xF2, 0x63, 0x59, 0xD9, 0x59, 0xDD, 0xD5, 0x83, 0xEB, 0x83, 0xEB, 0x83, 0xA5, 0xDD, 0x2D, 0x60, + 0xCA, 0x62, 0xA2, 0xD3, 0x2D, 0x60, 0xC6, 0x62, 0xFF, 0xA0, 0xA2, 0xD3, 0x21, 0x03, 0x00, 0x60, + 0x00, 0x63, 0x59, 0xDD, 0x61, 0x45, 0x60, 0x40, 0x01, 0x2A, 0x04, 0x00, 0x00, 0x60, 0xF2, 0x63, + 0x59, 0xD9, 0x59, 0xDD, 0x60, 0x40, 0x02, 0x2A, 0x04, 0x00, 0x01, 0x60, 0xF2, 0x63, 0x59, 0xD9, + 0x59, 0xDD, 0x60, 0x40, 0x04, 0x2A, 0x04, 0x00, 0x02, 0x60, 0xF2, 0x63, 0x59, 0xD9, 0x59, 0xDD, + 0xD5, 0x83, 0xEB, 0x83, 0xEB, 0x83, 0xA5, 0xDD, 0x2D, 0x60, 0xC8, 0x62, 0xA2, 0xD1, 0x59, 0xD9, + 0x2D, 0x60, 0xA0, 0x65, 0xD5, 0x84, 0xDD, 0x7F, 0xA5, 0xDB, 0x65, 0x44, 0x2E, 0x60, 0xB8, 0x62, + 0xA2, 0xDB, 0x2E, 0x60, 0xD4, 0x62, 0xA2, 0xDB, 0x0F, 0x60, 0xD4, 0x62, 0x00, 0x60, 0x04, 0x64, + 0xA2, 0xDB, 0xE8, 0x60, 0x2F, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, + 0xD2, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x7F, 0xF1, 0x2F, 0x60, 0x0E, 0x62, 0xA2, 0xD9, 0x2E, 0x60, + 0xB6, 0x65, 0xE9, 0x60, 0x58, 0x4D, 0x32, 0x78, 0xFF, 0xFF, 0x5D, 0xF5, 0x00, 0xF4, 0x80, 0xF1, + 0x06, 0xF8, 0x2F, 0x60, 0x44, 0x62, 0xA2, 0xD3, 0x07, 0xFA, 0x2E, 0x60, 0xAE, 0x64, 0x40, 0x48, + 0x10, 0x61, 0x00, 0x60, 0x00, 0x64, 0xE8, 0x60, 0x58, 0x4D, 0xE8, 0x78, 0xFF, 0xFF, 0x5D, 0xF5, + 0x3F, 0xFC, 0xDB, 0xFE, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, 0x28, 0x64, 0xA2, 0xDB, 0x66, 0x44, + 0x5A, 0xDB, 0x04, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0xDC, 0xF3, 0x9B, 0xFE, 0xFD, 0xA0, 0x25, 0x04, 0x24, 0x02, 0x04, 0x64, 0x03, 0xFA, 0x00, 0xF4, + 0x09, 0xF2, 0xFF, 0xFF, 0x60, 0x47, 0x00, 0x3A, 0x1C, 0x00, 0x60, 0x43, 0x00, 0x36, 0x1C, 0x00, + 0xE0, 0xA0, 0xDA, 0x85, 0x16, 0x07, 0x2D, 0x60, 0x7A, 0x61, 0xA1, 0xD1, 0xFF, 0xFF, 0xD3, 0x80, + 0xCB, 0x83, 0x0F, 0x02, 0x07, 0x0E, 0x59, 0xD3, 0xA5, 0xD0, 0xDA, 0x85, 0xD0, 0x80, 0xFF, 0xFF, + 0x08, 0x02, 0xF9, 0x1F, 0x13, 0x1E, 0xA5, 0xD0, 0x59, 0xD3, 0xFF, 0xFF, 0x90, 0x80, 0xFF, 0x22, + 0x0D, 0x00, 0xE8, 0x60, 0xDD, 0x78, 0xFF, 0xFF, 0x28, 0x60, 0x2A, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, + 0x60, 0x40, 0x01, 0x2A, 0x03, 0x00, 0x27, 0x60, 0xDA, 0x64, 0x02, 0x00, 0x2D, 0x60, 0x7A, 0x64, + 0x2E, 0x60, 0xCA, 0x62, 0xA2, 0xDB, 0x26, 0x46, 0x2F, 0xF2, 0x2C, 0xFA, 0x30, 0xF2, 0x2D, 0xFA, + 0x31, 0xF2, 0x2E, 0xFA, 0xEB, 0xF1, 0x2F, 0xF8, 0xEC, 0xF1, 0x30, 0xF8, 0xED, 0xF1, 0x31, 0xF8, + 0x81, 0xF1, 0x32, 0xF8, 0x82, 0xF1, 0x33, 0xF8, 0x83, 0xF1, 0x34, 0xF8, 0x50, 0x63, 0x2A, 0xFC, + 0xCC, 0xF3, 0x19, 0xFA, 0x00, 0x64, 0x3E, 0xFA, 0xA9, 0xF3, 0x07, 0xFA, 0x00, 0xF4, 0x80, 0xF1, + 0x06, 0xF8, 0x2F, 0x60, 0x44, 0x62, 0xA2, 0xD3, 0x07, 0xFA, 0x2E, 0x60, 0xD2, 0x65, 0xE9, 0x60, + 0x58, 0x4D, 0x32, 0x78, 0xFF, 0xFF, 0x2E, 0x60, 0xCA, 0x64, 0x40, 0x48, 0x10, 0x61, 0x00, 0x60, + 0x00, 0x64, 0xE8, 0x60, 0x58, 0x4D, 0xE8, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x3F, 0xFC, 0x24, 0x60, + 0x74, 0x62, 0x24, 0x60, 0x28, 0x64, 0xA2, 0xDB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, + 0xD2, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x5A, 0xDB, 0x00, 0x64, 0x94, 0xFB, 0x2F, 0x58, 0xFF, 0xFF, + 0x2F, 0x60, 0x46, 0x62, 0xA2, 0xDB, 0xCD, 0x81, 0x28, 0xD3, 0x5A, 0x88, 0xDC, 0x83, 0x39, 0x18, + 0xFB, 0x03, 0x61, 0x40, 0x7F, 0x3A, 0x07, 0x00, 0x2F, 0x60, 0x46, 0x62, 0xA2, 0xD3, 0x03, 0x61, + 0x7C, 0xA4, 0xA2, 0xDB, 0x00, 0xF4, 0x60, 0xFE, 0xA3, 0xD1, 0xDD, 0x81, 0xA1, 0xD8, 0x61, 0x40, + 0x7F, 0x3A, 0x09, 0x00, 0x20, 0xFE, 0x2F, 0x60, 0x46, 0x62, 0xA2, 0xD3, 0x03, 0x61, 0x7C, 0xA4, + 0xA2, 0xDB, 0x00, 0xF4, 0x60, 0xFE, 0xCF, 0x83, 0xA3, 0xD3, 0xDD, 0x81, 0xA1, 0xDA, 0xFF, 0xB4, + 0x00, 0x7F, 0x15, 0x03, 0xDB, 0x83, 0x61, 0x40, 0x7F, 0x3A, 0x0B, 0x00, 0x20, 0xFE, 0x60, 0x45, + 0x2F, 0x60, 0x46, 0x62, 0xA2, 0xD3, 0x03, 0x61, 0x7C, 0xA4, 0xA2, 0xDB, 0x65, 0x44, 0x00, 0xF4, + 0x60, 0xFE, 0xA3, 0xD1, 0xDF, 0x83, 0xDD, 0x81, 0xCC, 0x84, 0xA1, 0xD8, 0xEC, 0x02, 0x20, 0xFE, + 0xC3, 0x01, 0x2F, 0x60, 0x46, 0x62, 0xA2, 0xD1, 0xFD, 0xA1, 0xFF, 0xB1, 0xC1, 0x83, 0xA2, 0xDD, + 0x2D, 0x58, 0xFF, 0xFF, 0x67, 0x5C, 0x1B, 0x60, 0xC6, 0x61, 0xA1, 0xD3, 0xA5, 0xD9, 0x12, 0x18, + 0x60, 0x43, 0x2F, 0x60, 0x14, 0x64, 0xA5, 0xDB, 0x60, 0xFE, 0xA0, 0xDD, 0xFF, 0xFF, 0x20, 0xFE, + 0xDC, 0x84, 0xCF, 0x83, 0xE3, 0x83, 0x59, 0xD1, 0xDC, 0x84, 0x60, 0xFE, 0xA0, 0xD9, 0xFF, 0xFF, + 0x20, 0xFE, 0xF9, 0x1F, 0x2D, 0x58, 0xFF, 0xFF, 0x0E, 0x57, 0x32, 0x40, 0x40, 0x26, 0x29, 0x00, + 0x45, 0x48, 0x00, 0x60, 0x10, 0x61, 0xAE, 0x60, 0x58, 0x4D, 0xC4, 0x78, 0xFF, 0xFF, 0x21, 0x03, + 0xF2, 0x60, 0x02, 0x64, 0x24, 0xFA, 0x00, 0x60, 0x48, 0x61, 0x28, 0x44, 0x59, 0xDA, 0x03, 0x64, + 0x38, 0x43, 0xBD, 0xD1, 0xCC, 0x84, 0x59, 0xD8, 0xFC, 0x02, 0x39, 0x44, 0x59, 0xDA, 0x28, 0x60, + 0x2E, 0x64, 0xA0, 0xD3, 0x59, 0xDA, 0x07, 0x64, 0x23, 0xFA, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, + 0x64, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xFA, 0xFE, 0x37, 0x58, 0xFF, 0xFF, 0x0E, 0x57, 0x32, 0x40, 0x40, 0x26, 0x1C, 0x00, 0x45, 0x48, + 0x00, 0x60, 0x06, 0x61, 0xAE, 0x60, 0x58, 0x4D, 0xC4, 0x78, 0xFF, 0xFF, 0x14, 0x03, 0x02, 0x64, + 0x23, 0xFA, 0xF2, 0x60, 0x00, 0x64, 0x5A, 0xDA, 0x28, 0x44, 0x5A, 0xDA, 0xFF, 0xFF, 0x24, 0x60, + 0x74, 0x62, 0x24, 0x60, 0x64, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0xFA, 0xFE, 0x37, 0x58, 0xFF, 0xFF, 0xA2, 0xFF, 0x32, 0x40, 0x40, 0x26, + 0x3E, 0x00, 0x9D, 0xF3, 0x67, 0x43, 0xDC, 0x84, 0xCC, 0x84, 0x39, 0x03, 0x60, 0x46, 0x0A, 0x02, + 0x9D, 0xFD, 0x00, 0x60, 0x46, 0x61, 0xAE, 0x60, 0x58, 0x4D, 0xC4, 0x78, 0xFF, 0xFF, 0x66, 0x44, + 0x9D, 0xFB, 0x2E, 0x03, 0x46, 0x4B, 0x27, 0x60, 0x72, 0x61, 0x18, 0x64, 0x23, 0xFA, 0xF1, 0x60, + 0x00, 0x64, 0x24, 0xFA, 0x4A, 0x65, 0xA2, 0xFF, 0x2C, 0x63, 0x00, 0x64, 0x59, 0xD1, 0xA2, 0xDB, + 0xA5, 0xD8, 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0xF7, 0x1F, 0x12, 0x63, + 0x59, 0xD1, 0xA5, 0xD8, 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0xF8, 0x1F, + 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, 0x64, 0x64, 0xA2, 0xDB, 0x2B, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xFA, 0xFE, 0xA6, 0xFE, 0x00, 0x64, 0x9D, 0xFB, 0xA3, 0xFF, + 0xBF, 0x60, 0xE7, 0x78, 0xFF, 0xFF, 0xA6, 0xFE, 0xB8, 0x05, 0xA7, 0xFE, 0x12, 0x05, 0xA5, 0xFE, + 0x03, 0x04, 0xEA, 0x60, 0xC5, 0x78, 0xFF, 0xFF, 0xA4, 0xFE, 0xF2, 0x04, 0x0F, 0x60, 0xDE, 0x62, + 0xA2, 0xD1, 0x00, 0x60, 0x80, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0xBF, 0x60, 0xE7, 0x78, + 0xFF, 0xFF, 0x36, 0x45, 0x20, 0x60, 0x08, 0x64, 0x44, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xF3, + 0xFF, 0xFF, 0x01, 0xB0, 0x00, 0x64, 0x41, 0x03, 0x9F, 0xFB, 0x31, 0x44, 0xE8, 0xB4, 0x40, 0x51, + 0x6A, 0x44, 0xFF, 0xFF, 0x80, 0x26, 0xFC, 0x01, 0x61, 0xFF, 0x62, 0xFF, 0x10, 0x60, 0x1A, 0x62, + 0xA2, 0xD1, 0x00, 0x60, 0x20, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x34, 0x60, 0x58, 0x4E, + 0x64, 0x78, 0xFF, 0xFF, 0x1E, 0x60, 0xBC, 0x62, 0x1E, 0x60, 0xBE, 0x64, 0xA2, 0xDB, 0x00, 0x64, + 0x4A, 0xDB, 0x01, 0x60, 0xFE, 0x63, 0x1C, 0x60, 0xB8, 0x61, 0x00, 0x64, 0x59, 0xDB, 0xFE, 0x1F, + 0x1C, 0x63, 0x10, 0x60, 0x5C, 0x64, 0x58, 0xD1, 0xFF, 0xFF, 0x08, 0x1B, 0xFC, 0x1F, 0x00, 0x60, + 0x62, 0x63, 0x1B, 0x60, 0xC4, 0x64, 0x00, 0x7C, 0x58, 0xD9, 0xFE, 0x1F, 0x1C, 0x60, 0xB4, 0x63, + 0xA3, 0xD3, 0xFF, 0xFF, 0x04, 0xB0, 0xFF, 0xFF, 0x05, 0x03, 0x02, 0x65, 0xE9, 0x60, 0x58, 0x4E, + 0x7B, 0x78, 0xFF, 0xFF, 0xBF, 0x60, 0xE7, 0x78, 0xFF, 0xFF, 0xEA, 0x60, 0xC5, 0x78, 0xFF, 0xFF, + 0x0F, 0x60, 0xEA, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x01, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x74, 0x00, 0x28, 0x60, 0x50, 0x63, 0xBD, 0xD3, 0xBD, 0xD1, 0xBD, 0xD1, 0xB0, 0x84, 0xB0, 0x84, + 0xFF, 0xFF, 0x07, 0x02, 0x8C, 0xFB, 0x31, 0x44, 0xFE, 0xB4, 0x40, 0x51, 0x0D, 0x64, 0x05, 0xFB, + 0x64, 0x00, 0x28, 0xF3, 0x9F, 0xF1, 0x60, 0x47, 0x64, 0x41, 0x07, 0xB1, 0x07, 0xB4, 0x08, 0x24, + 0x67, 0x4C, 0x50, 0xFB, 0x01, 0x61, 0x03, 0x03, 0xCC, 0x84, 0xE1, 0x81, 0xFD, 0x02, 0xA1, 0x80, + 0xB1, 0x83, 0x53, 0x02, 0x9F, 0xFD, 0x28, 0x60, 0x44, 0x62, 0xA2, 0xD3, 0xE5, 0xFB, 0x7F, 0xFB, + 0x24, 0x60, 0x5E, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x46, 0x5E, 0x31, 0x44, + 0x01, 0xBC, 0x40, 0x51, 0xD8, 0xF3, 0x01, 0x63, 0x03, 0xA8, 0x4E, 0xFD, 0x05, 0x02, 0x02, 0x63, + 0x14, 0x60, 0x00, 0x64, 0xDB, 0xFB, 0x0C, 0x00, 0x02, 0xA8, 0x01, 0x63, 0x03, 0x03, 0x0A, 0x60, + 0x00, 0x64, 0x03, 0x00, 0x02, 0x63, 0x14, 0x60, 0x00, 0x64, 0xDB, 0xFB, 0x00, 0x64, 0x4E, 0xFB, + 0x4B, 0xFD, 0xA9, 0xF5, 0xFF, 0xFF, 0x0E, 0xF0, 0x0F, 0x60, 0xA2, 0x65, 0x28, 0x60, 0xD2, 0x62, + 0xA2, 0xD3, 0xFF, 0xFF, 0xFE, 0xA0, 0x03, 0xA8, 0x11, 0x06, 0x79, 0xF1, 0x06, 0x02, 0x64, 0x44, + 0x08, 0x2A, 0x09, 0x00, 0x06, 0x64, 0x44, 0xD3, 0x0D, 0x00, 0x64, 0x44, 0x20, 0x2A, 0x03, 0x00, + 0x0A, 0x64, 0x44, 0xD3, 0x07, 0x00, 0x01, 0x64, 0x44, 0xD3, 0x04, 0x00, 0xE8, 0x84, 0xE0, 0x84, + 0x44, 0xD3, 0x00, 0x00, 0x0E, 0xFA, 0xED, 0xE2, 0x0F, 0x4E, 0xC8, 0x60, 0x58, 0x4F, 0x15, 0x78, + 0xFF, 0xFF, 0x0E, 0x4F, 0xBF, 0x60, 0xE7, 0x78, 0xFF, 0xFF, 0xD7, 0xFE, 0xBF, 0x60, 0xE7, 0x78, + 0xFF, 0xFF, 0x0F, 0x60, 0xEA, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0xF3, 0x01, 0x24, 0x60, 0x46, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, + 0x0E, 0xF2, 0x4D, 0x03, 0x60, 0x40, 0xF0, 0x37, 0x3A, 0x00, 0xFF, 0x37, 0x2F, 0x00, 0xFD, 0x37, + 0x27, 0x00, 0xF8, 0x37, 0x0A, 0x00, 0x60, 0x47, 0xFF, 0xB5, 0x0F, 0x60, 0xD2, 0x62, 0x46, 0xD1, + 0x00, 0x60, 0x01, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x24, 0x60, 0x74, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xDA, 0x01, + 0x06, 0xB4, 0xFD, 0x7F, 0x0E, 0xFA, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, 0x4C, 0x64, 0xA2, 0xDB, + 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xF9, 0xFE, 0xCA, 0x01, + 0x23, 0xF0, 0x60, 0x40, 0x04, 0x26, 0xEC, 0x1B, 0x02, 0x26, 0xEA, 0x18, 0xA2, 0xFF, 0x02, 0xF0, + 0x09, 0x60, 0x08, 0x64, 0xD0, 0x80, 0xB0, 0xF3, 0x02, 0x02, 0xCC, 0x84, 0xB0, 0xFB, 0x24, 0x60, + 0x74, 0x64, 0x40, 0x4B, 0x2C, 0x60, 0x58, 0x4D, 0xD8, 0x78, 0xFF, 0xFF, 0xB3, 0x01, 0xAC, 0xFE, + 0x09, 0x05, 0xAD, 0xFE, 0x10, 0x05, 0xAE, 0xFE, 0xAD, 0x05, 0xAF, 0xFE, 0x3A, 0x05, 0xBF, 0x60, + 0xE7, 0x78, 0xFF, 0xFF, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x20, 0x60, 0x00, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0xF4, 0x01, 0x10, 0x60, 0x32, 0x65, 0x0B, 0x61, 0x07, 0x00, 0xA2, 0xDD, + 0x58, 0x4F, 0x64, 0x58, 0xFF, 0xFF, 0x00, 0xB9, 0xFF, 0xFF, 0x08, 0x03, 0x00, 0x63, 0xA5, 0xD1, + 0x5A, 0xD3, 0xDA, 0x85, 0x00, 0xA8, 0xCD, 0x81, 0xF2, 0x02, 0xF8, 0x02, 0xE0, 0x01, 0x0F, 0x60, + 0xCE, 0x62, 0x10, 0x60, 0x12, 0x65, 0xEB, 0x60, 0x5F, 0x63, 0x00, 0x64, 0x5A, 0xDB, 0xD6, 0x80, + 0xFF, 0xFF, 0x04, 0x03, 0x5A, 0xDB, 0x5A, 0xDB, 0x5A, 0xDD, 0xF9, 0x01, 0x10, 0x60, 0x30, 0x65, + 0x00, 0x64, 0x5A, 0xDB, 0xD6, 0x80, 0xFF, 0xFF, 0x02, 0x03, 0x5A, 0xDD, 0xFB, 0x01, 0x2F, 0x58, + 0xFF, 0xFF, 0x0F, 0x60, 0xD2, 0x64, 0x40, 0x41, 0x0F, 0x60, 0xD0, 0x63, 0xA3, 0xD1, 0x00, 0x64, + 0xD0, 0x80, 0x0B, 0x61, 0x08, 0x03, 0xBD, 0xDB, 0xA3, 0xD3, 0xFF, 0xFF, 0xB0, 0x84, 0xCD, 0x81, + 0xA3, 0xDB, 0x06, 0xA3, 0xF9, 0x02, 0x10, 0x60, 0x1A, 0x63, 0xA3, 0xD1, 0x00, 0x64, 0xD0, 0x80, + 0x0C, 0x61, 0x19, 0x03, 0xBD, 0xDB, 0x64, 0x44, 0xFE, 0xA3, 0x02, 0xA3, 0xCD, 0x81, 0xE8, 0x84, + 0xE3, 0x03, 0x02, 0x05, 0xE1, 0x03, 0xF9, 0x01, 0x99, 0xFB, 0x9B, 0xFD, 0x61, 0x5C, 0xA3, 0xD3, + 0x9A, 0xF9, 0x03, 0x18, 0x58, 0x4F, 0x60, 0x58, 0xFF, 0xFF, 0x9B, 0xF3, 0x9A, 0xF1, 0x60, 0x43, + 0x99, 0xF3, 0x64, 0x41, 0xEA, 0x01, 0x21, 0x43, 0x10, 0x60, 0x14, 0x65, 0xD7, 0x80, 0xBD, 0xD1, + 0xBD, 0xD3, 0x03, 0x02, 0xBF, 0x60, 0xE7, 0x78, 0xFF, 0xFF, 0xA0, 0x84, 0xBD, 0xD1, 0x43, 0x41, + 0xF5, 0x03, 0xEB, 0x60, 0x64, 0x64, 0x64, 0x58, 0x40, 0x4F, 0x2A, 0xF0, 0x83, 0x60, 0xFF, 0x65, + 0x64, 0x47, 0x03, 0x2B, 0x01, 0x00, 0x14, 0x00, 0x03, 0x26, 0x03, 0xAC, 0x60, 0x47, 0xA4, 0x84, + 0x2A, 0xFA, 0x2F, 0xF2, 0x2C, 0xFA, 0x30, 0xF2, 0x2D, 0xFA, 0x31, 0xF2, 0x2E, 0xFA, 0x64, 0x41, + 0xEB, 0xF3, 0x2F, 0xFA, 0x60, 0x43, 0xEC, 0xF3, 0x30, 0xFA, 0xED, 0xF1, 0x31, 0xF8, 0x19, 0x00, + 0x60, 0x47, 0xA4, 0x84, 0x2A, 0xFA, 0x2F, 0xF2, 0x2C, 0xFA, 0x30, 0xF2, 0x2D, 0xFA, 0x31, 0xF2, + 0x2E, 0xFA, 0x36, 0xF2, 0x32, 0xFA, 0x37, 0xF2, 0x33, 0xFA, 0x38, 0xF2, 0x34, 0xFA, 0xEB, 0xF3, + 0x2F, 0xFA, 0x36, 0xFA, 0xEC, 0xF3, 0x30, 0xFA, 0x37, 0xFA, 0xED, 0xF3, 0x31, 0xFA, 0x38, 0xFA, + 0x64, 0x41, 0x1C, 0xF2, 0x13, 0xFA, 0x00, 0xF4, 0x0D, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x2B, + 0x18, 0x00, 0x81, 0x67, 0xA2, 0xDA, 0xEC, 0x60, 0x58, 0x4E, 0x5A, 0x78, 0xFF, 0xFF, 0x26, 0x46, + 0x3F, 0xFC, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, 0x28, 0x64, 0xA2, 0xDB, 0x26, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, + 0xFF, 0xFF, 0x26, 0x46, 0x3F, 0xF0, 0x42, 0x64, 0xD0, 0x80, 0xFF, 0xFF, 0x01, 0x04, 0x3F, 0xFA, + 0x07, 0xF2, 0xA9, 0xF1, 0x01, 0x1B, 0x07, 0xF8, 0x1C, 0xF2, 0x13, 0xFA, 0x26, 0xF2, 0x27, 0xF0, + 0x60, 0x47, 0x00, 0xF4, 0x1F, 0xFA, 0x64, 0x47, 0x20, 0xFA, 0x61, 0x44, 0x21, 0xFA, 0x01, 0x67, + 0x0D, 0xFA, 0x10, 0x61, 0x28, 0x60, 0x06, 0x64, 0x1E, 0x63, 0x58, 0xD1, 0xCD, 0x81, 0xBD, 0xD8, + 0xFC, 0x02, 0xBB, 0xF1, 0xD8, 0xF1, 0x64, 0x5E, 0x64, 0x5F, 0x44, 0x63, 0xBD, 0xDA, 0x28, 0x60, + 0x00, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0x4A, 0xD3, 0x60, 0x45, + 0x60, 0x40, 0x01, 0x36, 0x03, 0x64, 0x02, 0x36, 0x01, 0x64, 0xB4, 0x84, 0x06, 0xA2, 0xA2, 0xD1, + 0xBD, 0xDA, 0x64, 0x47, 0xBD, 0xDA, 0xD5, 0xF3, 0xD6, 0xF1, 0x60, 0x47, 0xBD, 0xDA, 0x64, 0x47, + 0xE3, 0xF1, 0xBD, 0xDA, 0x64, 0x44, 0xBD, 0xDA, 0x26, 0x46, 0x00, 0x64, 0x23, 0xF0, 0x3B, 0xF0, + 0x64, 0x40, 0x10, 0x2A, 0x06, 0x00, 0xC0, 0x67, 0xA0, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, + 0x10, 0xBC, 0x3E, 0xFA, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, 0x34, 0x64, 0xA2, 0xDB, 0x26, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC8, 0xFE, 0x00, 0x66, 0x46, 0x46, + 0x2F, 0x58, 0xFF, 0xFF, 0xB4, 0xF3, 0x1F, 0xFA, 0x32, 0x47, 0x07, 0xFA, 0x24, 0x7E, 0x02, 0x7F, + 0x08, 0xFA, 0xD8, 0xF1, 0x09, 0xF8, 0x01, 0x60, 0x01, 0x64, 0x0A, 0xFA, 0x01, 0x64, 0x0B, 0xFA, + 0x24, 0x60, 0x74, 0x62, 0x18, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x0A, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0x52, 0x63, 0x2E, 0x58, 0xFF, 0xFF, 0x00, 0x60, 0x2A, 0x61, 0xAE, 0x60, + 0x58, 0x4D, 0xC4, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0x5E, 0xFB, 0x04, 0x64, 0x03, 0xFA, 0x67, 0x44, + 0x2C, 0xFA, 0x2D, 0xFA, 0x2E, 0xFA, 0x32, 0xFA, 0x33, 0xFA, 0x34, 0xFA, 0x12, 0x60, 0x80, 0x64, + 0xA9, 0xF1, 0x0E, 0xFA, 0x07, 0xF8, 0x00, 0x64, 0x3E, 0xFA, 0x1A, 0x60, 0x4E, 0x63, 0xA3, 0xDB, + 0x06, 0xA3, 0x10, 0x60, 0x38, 0x64, 0xBD, 0xDB, 0x04, 0x64, 0xBD, 0xDB, 0x06, 0x64, 0xA3, 0xDB, + 0x10, 0x60, 0x36, 0x62, 0xEF, 0x60, 0xA9, 0x64, 0xA2, 0xDB, 0x1A, 0x60, 0x5A, 0x63, 0x00, 0x64, + 0xA3, 0xDB, 0x06, 0xA3, 0x10, 0x60, 0x3C, 0x64, 0xBD, 0xDB, 0x08, 0x64, 0xBD, 0xDB, 0x06, 0x64, + 0xA3, 0xDB, 0x10, 0x60, 0x3A, 0x62, 0xEF, 0x60, 0xB3, 0x64, 0xA2, 0xDB, 0x10, 0x60, 0x22, 0x62, + 0xEF, 0x60, 0x93, 0x64, 0xA2, 0xDB, 0x00, 0x64, 0x31, 0x60, 0x2A, 0x62, 0xA2, 0xDB, 0x2F, 0x58, + 0xFF, 0xFF, 0x5E, 0xF5, 0xEB, 0xF1, 0x2F, 0xF8, 0xEC, 0xF1, 0x30, 0xF8, 0xED, 0xF1, 0x31, 0xF8, + 0xCC, 0xF1, 0x19, 0xF8, 0x30, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x0F, 0x60, 0xE4, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x00, 0x63, 0x8A, 0xFD, 0x1C, 0x60, 0x96, 0x65, 0xA5, 0xDD, 0x19, 0x60, 0x86, 0x63, + 0x88, 0xFD, 0x89, 0xFD, 0x20, 0x40, 0x10, 0x2B, 0x05, 0x00, 0x1F, 0x60, 0x82, 0x61, 0xA1, 0xD3, + 0xFF, 0xFF, 0x59, 0x18, 0x5E, 0xF5, 0x40, 0x64, 0x2A, 0xFA, 0x54, 0xF3, 0x00, 0xF4, 0x60, 0x43, + 0xBD, 0xD1, 0x04, 0x65, 0x64, 0x47, 0xA5, 0xDA, 0x64, 0x41, 0xDD, 0x81, 0xE9, 0x81, 0x62, 0x44, + 0x04, 0x03, 0xBD, 0xD1, 0xCD, 0x81, 0x58, 0xD8, 0xFC, 0x02, 0x58, 0x8B, 0x2D, 0x60, 0x28, 0x63, + 0xA3, 0xD1, 0x2B, 0x44, 0xC8, 0x84, 0x64, 0x41, 0xFF, 0xB1, 0x61, 0x45, 0x03, 0xA1, 0xE9, 0x81, + 0x41, 0x4C, 0xBD, 0xD1, 0xCD, 0x81, 0x58, 0xD8, 0xFC, 0x02, 0x2B, 0xD2, 0x2B, 0x43, 0x60, 0x47, + 0x01, 0x7E, 0x54, 0xF1, 0xA3, 0xDA, 0xA4, 0xD3, 0xCB, 0x83, 0x44, 0x8B, 0xF8, 0x84, 0x2C, 0x41, + 0x0C, 0x04, 0xBE, 0xD2, 0xFF, 0xFF, 0x60, 0x47, 0xBE, 0xDA, 0x00, 0x7E, 0xA3, 0xD2, 0x60, 0x45, + 0x00, 0x7F, 0xB4, 0x84, 0xCD, 0x81, 0xBD, 0xDA, 0xF4, 0x02, 0x5E, 0xF5, 0x2B, 0x44, 0x04, 0xA4, + 0x3F, 0xFA, 0x7F, 0xF3, 0x7E, 0xFB, 0x1F, 0x60, 0x84, 0x61, 0x01, 0x64, 0x54, 0xF1, 0xA1, 0xDB, + 0x7F, 0xFB, 0xA4, 0xD3, 0x04, 0x65, 0x53, 0xF3, 0x01, 0x18, 0x0C, 0x65, 0xF3, 0xB4, 0xB4, 0x84, + 0x53, 0xFB, 0x02, 0xB0, 0xFF, 0xFF, 0x16, 0x03, 0x7F, 0xF3, 0xFF, 0xFF, 0x60, 0x47, 0x0F, 0xB4, + 0x7F, 0xFB, 0x01, 0x03, 0x0F, 0x00, 0xEE, 0x60, 0x4F, 0x78, 0xFF, 0xFF, 0x53, 0xF1, 0x7F, 0xF3, + 0x64, 0x40, 0x02, 0x26, 0xF8, 0x01, 0xF3, 0xA0, 0x04, 0xA4, 0x01, 0x04, 0xF1, 0xA4, 0x10, 0x36, + 0xF2, 0x01, 0x7F, 0xFB, 0x20, 0x40, 0x10, 0x2B, 0x12, 0x00, 0x7F, 0xF3, 0x1F, 0x60, 0x82, 0x61, + 0xA1, 0xD1, 0xCC, 0x84, 0x01, 0x61, 0x08, 0x24, 0x03, 0x00, 0xE1, 0x81, 0xCC, 0x84, 0xFB, 0x01, + 0xA1, 0x84, 0x53, 0xF1, 0xE4, 0x03, 0x1F, 0x60, 0x84, 0x61, 0xA1, 0xDB, 0x19, 0x00, 0x53, 0xF3, + 0xFF, 0xFF, 0x10, 0xB0, 0x12, 0x60, 0x26, 0x63, 0x02, 0x03, 0x10, 0x60, 0x5C, 0x63, 0x31, 0x60, + 0x2A, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0x0C, 0x1B, 0x7F, 0xF3, 0xFF, 0xFF, 0xE0, 0x85, 0x47, 0xD3, + 0x53, 0xF1, 0x01, 0xB0, 0x06, 0xB0, 0xCB, 0x03, 0x64, 0x40, 0x03, 0x26, 0x01, 0x00, 0xC7, 0x03, + 0x7F, 0xF3, 0x01, 0x61, 0xCC, 0x84, 0xFF, 0xFF, 0x02, 0x03, 0xE1, 0x81, 0xFB, 0x01, 0xBA, 0xF3, + 0x61, 0x45, 0xA4, 0x80, 0xFF, 0xFF, 0xBB, 0x03, 0x31, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x0F, 0x60, + 0xE4, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0B, 0x04, 0x0F, 0x60, 0xE6, 0x62, 0x40, 0x60, + 0x00, 0x64, 0xA2, 0xDB, 0xED, 0x60, 0x70, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x7F, 0xF1, 0x24, 0x60, 0x9A, 0x62, 0xA2, 0xD9, 0x1E, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, + 0x0F, 0x60, 0xE6, 0x62, 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xED, 0x60, 0xA3, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xBE, 0xFE, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x40, 0x60, + 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x0F, 0x60, 0xE4, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x5E, 0xF5, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, 0x28, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x00, 0x64, 0x51, 0xFB, 0x0F, 0x60, 0xE6, 0x62, + 0x00, 0x60, 0x01, 0x64, 0xA2, 0xDB, 0xED, 0x60, 0xCD, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0xC1, 0xFE, + 0x33, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0x34, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x0F, 0x60, 0xE4, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xC6, 0xF1, 0x1A, 0x60, 0x52, 0x62, 0xA2, 0xD9, + 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x4E, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0xC7, 0xF1, 0x1A, 0x60, 0x5E, 0x62, 0xA2, 0xD9, 0x24, 0x60, 0xA8, 0x62, 0xA2, 0xD3, + 0xFF, 0xFF, 0xFD, 0x1B, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x5A, 0x64, 0xA2, 0xDB, 0x02, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x0F, 0x60, 0xE6, 0x62, 0x00, 0x60, 0x08, 0x64, 0xA2, 0xDB, + 0xED, 0x60, 0xFE, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x51, 0xF1, 0x0F, 0x60, + 0xE4, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x64, 0x40, 0xFF, 0x26, 0x03, 0x00, 0xED, 0x60, 0x36, 0x78, + 0xFF, 0xFF, 0x02, 0x0A, 0x00, 0x64, 0x51, 0xFB, 0xC8, 0xF1, 0x1A, 0x60, 0x5E, 0x62, 0xA2, 0xD9, + 0x0F, 0x60, 0xE6, 0x62, 0x00, 0x60, 0x0C, 0x64, 0xA2, 0xDB, 0xEE, 0x60, 0x24, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x5A, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x04, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xE4, 0x62, 0xA2, 0xD1, 0x00, 0x60, + 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x0C, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x24, 0x60, 0xAA, 0x62, + 0x1A, 0x60, 0x5A, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x14, 0x00, + 0xFF, 0x60, 0xF7, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x51, 0xF3, 0xDB, 0x0A, 0x00, 0xA0, 0x00, 0x64, + 0x02, 0x03, 0x51, 0xFB, 0xD6, 0x01, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x4E, 0x64, 0xA2, 0xDB, + 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0xED, 0x60, 0x36, 0x78, 0xFF, 0xFF, 0x35, 0x64, + 0x3B, 0x42, 0x5A, 0xDB, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0x4E, 0x64, 0xA2, 0xDB, 0x03, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x53, 0xF3, 0xFF, 0xFF, 0xE3, 0xB4, 0x53, 0xFB, 0x1F, 0x60, + 0x80, 0x64, 0xA0, 0xD3, 0xFF, 0xFF, 0xFE, 0xB4, 0xA2, 0xDB, 0x00, 0x64, 0x31, 0x60, 0x2A, 0x62, + 0xA2, 0xDB, 0x0F, 0x60, 0xE4, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0E, 0x04, 0x32, 0x64, + 0x3B, 0x42, 0x5A, 0xDB, 0x0F, 0x60, 0xE6, 0x62, 0x40, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xEE, 0x60, + 0x69, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x7E, 0xF1, 0x7F, 0xF9, 0x24, 0x60, + 0x9A, 0x62, 0xA2, 0xD9, 0x1E, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x0F, 0x60, 0xE6, 0x62, + 0x20, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xEE, 0x60, 0x91, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0xBE, 0xFE, 0x0F, 0x60, 0xD0, 0x62, 0xA2, 0xD1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x1A, 0x60, 0x06, 0x63, 0x1C, 0x61, 0x00, 0x64, 0xCD, 0x81, 0xBD, 0xDB, + 0xFD, 0x02, 0x12, 0x60, 0x46, 0x61, 0x8A, 0xF3, 0x61, 0x43, 0xC6, 0xA5, 0x47, 0xD1, 0x0F, 0x04, + 0xBE, 0xD5, 0x1A, 0x60, 0x02, 0x63, 0xC3, 0x83, 0xC3, 0x83, 0xC3, 0x83, 0x43, 0xD3, 0xBE, 0xD1, + 0xDC, 0x84, 0xA3, 0xDB, 0x66, 0x44, 0xC0, 0x84, 0xBE, 0xDB, 0x65, 0x44, 0xED, 0x01, 0x1A, 0x60, + 0x06, 0x63, 0x0E, 0x61, 0x41, 0x4B, 0xBD, 0xD3, 0xBD, 0xD1, 0x00, 0xBD, 0x64, 0x41, 0x19, 0x03, + 0x01, 0xA8, 0x61, 0x44, 0x02, 0xA8, 0x15, 0x03, 0x02, 0x02, 0xE9, 0x84, 0x12, 0x00, 0x65, 0x47, + 0x60, 0x45, 0x61, 0x44, 0x09, 0x61, 0xCD, 0x81, 0xE0, 0x84, 0xFF, 0x23, 0xFC, 0x01, 0x02, 0x24, + 0xC4, 0x84, 0x02, 0x28, 0xD4, 0x84, 0xCD, 0x81, 0x01, 0x0E, 0x01, 0xBC, 0x02, 0x03, 0xE0, 0x84, + 0xF6, 0x01, 0x00, 0x7F, 0x2B, 0x41, 0x4D, 0x8B, 0xBF, 0xDB, 0xDD, 0x02, 0x12, 0x60, 0x46, 0x61, + 0x8A, 0xF3, 0x61, 0x43, 0xC6, 0xA5, 0x47, 0xD1, 0x0A, 0x04, 0xDA, 0x86, 0x1A, 0x60, 0x04, 0x63, + 0xC3, 0x83, 0xC3, 0x83, 0xC3, 0x83, 0x43, 0xD1, 0xA6, 0xD9, 0x65, 0x44, 0xF2, 0x01, 0x36, 0x64, + 0x3B, 0x42, 0x5A, 0xDB, 0x53, 0xF3, 0x8A, 0xF1, 0xF3, 0xB4, 0x53, 0xFB, 0x12, 0x60, 0x46, 0x63, + 0xC3, 0x85, 0x45, 0x4A, 0x19, 0x60, 0x86, 0x65, 0x89, 0xF3, 0x45, 0x4C, 0x40, 0x48, 0x20, 0x40, + 0x20, 0x2A, 0x02, 0x00, 0x00, 0x65, 0x45, 0x4B, 0x2A, 0x45, 0xD7, 0x80, 0x02, 0x65, 0x23, 0x05, + 0x47, 0xD1, 0x02, 0x65, 0x47, 0xD3, 0x0A, 0x65, 0xD0, 0x81, 0x47, 0xD3, 0x01, 0x05, 0x00, 0x61, + 0xF2, 0xA3, 0x01, 0xB0, 0x61, 0x44, 0x11, 0x03, 0x20, 0x40, 0x20, 0x2A, 0x08, 0x00, 0xF3, 0x60, + 0x58, 0x4E, 0x3E, 0x78, 0xFF, 0xFF, 0x2B, 0x44, 0x02, 0xA4, 0x40, 0x4B, 0x61, 0x44, 0x2C, 0x42, + 0xA2, 0xDB, 0x5A, 0xDD, 0x5A, 0x8C, 0x3A, 0xA3, 0xDF, 0x01, 0x28, 0x42, 0x4A, 0xDD, 0x4A, 0xDB, + 0x42, 0x48, 0x3A, 0xA3, 0xD9, 0x01, 0x28, 0x44, 0x88, 0xFB, 0x88, 0xF1, 0x19, 0x60, 0x86, 0x63, + 0x44, 0x48, 0x28, 0x45, 0xD7, 0x80, 0xA3, 0xD1, 0x15, 0x05, 0x04, 0x65, 0x46, 0xD3, 0x28, 0x45, + 0xD6, 0x80, 0xD0, 0x80, 0x02, 0x04, 0x04, 0xA3, 0xF5, 0x01, 0xF7, 0x06, 0x62, 0x46, 0xA2, 0xD9, + 0xA3, 0xDB, 0x5B, 0xD3, 0x66, 0x42, 0x5A, 0xD1, 0xA2, 0xDB, 0xA3, 0xD9, 0xFE, 0xA3, 0xA3, 0xD1, + 0x66, 0x42, 0xEB, 0x01, 0x88, 0xF3, 0x89, 0xF1, 0x60, 0x43, 0x44, 0x48, 0x28, 0x45, 0xD7, 0x80, + 0xA3, 0xD1, 0x15, 0x05, 0x04, 0x65, 0x46, 0xD3, 0x28, 0x45, 0xD6, 0x80, 0xD0, 0x80, 0x02, 0x04, + 0x04, 0xA3, 0xF5, 0x01, 0xF7, 0x06, 0x62, 0x46, 0xA2, 0xD9, 0xA3, 0xDB, 0x5B, 0xD3, 0x66, 0x42, + 0x5A, 0xD1, 0xA2, 0xDB, 0xA3, 0xD9, 0xFE, 0xA3, 0xA3, 0xD1, 0x66, 0x42, 0xEB, 0x01, 0x0F, 0x60, + 0xD0, 0x62, 0xA2, 0xD1, 0x10, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x20, 0x40, + 0x80, 0x2B, 0x17, 0x00, 0x00, 0x60, 0x04, 0x61, 0xAE, 0x60, 0x58, 0x4D, 0xC4, 0x78, 0xFF, 0xFF, + 0x01, 0x64, 0x23, 0xFA, 0xF1, 0x60, 0x02, 0x64, 0x24, 0xFA, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, + 0x64, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xFA, 0xFE, 0x0F, 0x60, 0xE4, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x5A, 0xDB, 0x3E, 0x64, 0x3B, 0x42, + 0x5A, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0x3F, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x24, 0x60, 0xAA, 0x62, + 0x1A, 0x60, 0x4E, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x00, 0x64, + 0x53, 0xFB, 0x0F, 0x60, 0xE4, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x5A, 0xDB, 0xBE, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x0F, 0x60, 0xE4, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0F, 0x60, 0xE4, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x08, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x79, 0xFB, 0xAC, 0x85, 0x60, 0x41, + 0x20, 0x03, 0x01, 0x60, 0x00, 0x63, 0x08, 0x64, 0xE9, 0x81, 0xCC, 0x84, 0x02, 0x24, 0xDF, 0x83, + 0xFB, 0x02, 0x2D, 0x60, 0x28, 0x64, 0xA0, 0xDD, 0x65, 0x41, 0x2D, 0x60, 0x2A, 0x63, 0x0F, 0x60, + 0xC0, 0x64, 0xE9, 0x81, 0x58, 0xD1, 0xFD, 0x04, 0xA3, 0xD9, 0x0B, 0x03, 0x58, 0xD1, 0xE9, 0x81, + 0x60, 0x45, 0xFC, 0x04, 0xA3, 0xD1, 0x64, 0x47, 0xB0, 0x84, 0xBD, 0xDB, 0x00, 0xB9, 0x65, 0x44, + 0xF0, 0x02, 0x2E, 0x58, 0xFF, 0xFF, 0x3C, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x20, 0x40, 0x90, 0x2B, + 0x03, 0x00, 0xF2, 0x60, 0xE5, 0x78, 0xFF, 0xFF, 0x53, 0xF3, 0x8A, 0xF1, 0x04, 0xB0, 0x07, 0x60, + 0x40, 0x64, 0xD0, 0x80, 0x21, 0x03, 0x20, 0x06, 0x26, 0x46, 0x8A, 0xF1, 0x12, 0x60, 0x46, 0x63, + 0xC3, 0x83, 0x7F, 0xF3, 0x26, 0xF0, 0xBD, 0xDB, 0x64, 0x44, 0x00, 0x7F, 0xBD, 0xDB, 0x64, 0x47, + 0x00, 0x7F, 0xBD, 0xDB, 0x32, 0xF0, 0xBD, 0xD9, 0x33, 0xF0, 0xBD, 0xD9, 0x34, 0xF0, 0xBD, 0xD9, + 0x00, 0xF4, 0x0D, 0xF0, 0xBD, 0xD9, 0x0E, 0xF0, 0xBD, 0xD9, 0x00, 0x64, 0x0F, 0xF0, 0xA3, 0xDB, + 0x64, 0x47, 0x60, 0x45, 0x00, 0x37, 0x03, 0x00, 0xF2, 0x60, 0xDF, 0x78, 0xFF, 0xFF, 0xBD, 0xDB, + 0xE0, 0xA0, 0x1F, 0x61, 0x00, 0xB8, 0xF8, 0x07, 0xF7, 0x03, 0x60, 0xFE, 0xDD, 0x81, 0xA1, 0xD0, + 0xCC, 0x84, 0xBD, 0xD9, 0xFB, 0x02, 0x65, 0x40, 0x01, 0x26, 0xDF, 0x83, 0x20, 0xFE, 0x2D, 0x60, + 0xE4, 0x62, 0xA2, 0xDD, 0x60, 0xFE, 0xDD, 0x81, 0xA1, 0xD0, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x3A, + 0x04, 0x00, 0xDD, 0x81, 0xA1, 0xD0, 0xFF, 0xFF, 0xC1, 0x81, 0xDD, 0x81, 0xA1, 0xD0, 0xFF, 0xFF, + 0x64, 0x40, 0x03, 0x36, 0x03, 0x00, 0xF2, 0x60, 0xDF, 0x78, 0xFF, 0xFF, 0xD9, 0x81, 0xA1, 0xD0, + 0x7F, 0xF3, 0xFF, 0xFF, 0xD0, 0x80, 0x20, 0xFE, 0x08, 0x24, 0x03, 0x00, 0xF2, 0x60, 0xDF, 0x78, + 0xFF, 0xFF, 0x26, 0x46, 0x3F, 0xF2, 0x00, 0xF4, 0x60, 0x43, 0xF4, 0xA3, 0x00, 0x60, 0x1D, 0x61, + 0x00, 0x60, 0x80, 0x65, 0x60, 0xFE, 0x81, 0xA1, 0x7F, 0xA1, 0x02, 0x06, 0x00, 0xF4, 0x03, 0x61, + 0xDD, 0x81, 0xA1, 0xD2, 0xCF, 0x83, 0xD4, 0x80, 0x2D, 0x03, 0x17, 0x03, 0xCF, 0x83, 0x61, 0x44, + 0x80, 0xA0, 0x28, 0x03, 0x02, 0x02, 0x00, 0xF4, 0x03, 0x61, 0xDD, 0x81, 0xA1, 0xD2, 0xCF, 0x83, + 0x81, 0xA1, 0x20, 0x03, 0x05, 0x07, 0x7F, 0xA1, 0xCC, 0x84, 0xDD, 0x81, 0xE4, 0x03, 0xF7, 0x01, + 0x00, 0xF4, 0x00, 0xB8, 0x04, 0x61, 0xE4, 0x03, 0xF2, 0x01, 0x01, 0x60, 0xFF, 0x63, 0x46, 0x48, + 0x41, 0x4A, 0xDD, 0x81, 0xA1, 0xD0, 0xDF, 0x83, 0xA3, 0xD9, 0x64, 0x44, 0xDD, 0x81, 0xA1, 0xD0, + 0xDF, 0x83, 0xA3, 0xD9, 0xCC, 0x84, 0x81, 0xA1, 0x05, 0x03, 0x7F, 0xA1, 0xF7, 0x04, 0x00, 0xF4, + 0x03, 0x61, 0xF4, 0x01, 0x20, 0xFE, 0x00, 0xBB, 0x02, 0x60, 0x00, 0x61, 0x45, 0x03, 0x60, 0xFE, + 0xDD, 0x81, 0xA1, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0x00, 0x3A, 0x3E, 0x00, 0xDD, 0x81, 0xA1, 0xD1, + 0xFF, 0xFF, 0x64, 0x40, 0x60, 0x3A, 0x38, 0x00, 0xDD, 0x81, 0xA1, 0xD1, 0xFF, 0xFF, 0x64, 0x40, + 0x1D, 0x3A, 0x32, 0x00, 0xDD, 0x81, 0xA1, 0xD3, 0xFF, 0xFF, 0x20, 0xFE, 0xFF, 0xB4, 0x1C, 0x60, + 0x96, 0x65, 0xA5, 0xD3, 0x60, 0x5C, 0x02, 0xA4, 0xA5, 0xDB, 0xFE, 0xA5, 0x1A, 0x60, 0xC6, 0x64, + 0x44, 0xD9, 0x00, 0x7C, 0x60, 0xFE, 0xDD, 0x81, 0xA1, 0xD1, 0xFF, 0xFF, 0x20, 0xFE, 0x1B, 0x60, + 0x06, 0x64, 0xC4, 0x82, 0x64, 0x44, 0xFF, 0xB4, 0xA2, 0xDB, 0x12, 0x60, 0x48, 0x65, 0x8A, 0xF3, + 0xFF, 0xFF, 0xC4, 0x82, 0x64, 0x44, 0xA2, 0xD3, 0xFF, 0xB5, 0xD4, 0x80, 0xFF, 0xFF, 0x02, 0x05, + 0x65, 0x44, 0xA2, 0xDB, 0x09, 0x00, 0x20, 0xFE, 0x28, 0x46, 0x2A, 0x41, 0xFF, 0xB1, 0x60, 0xFE, + 0x82, 0x64, 0xA1, 0xDA, 0xFF, 0xFF, 0x20, 0xFE, 0x26, 0x46, 0x3F, 0xF2, 0x00, 0xF4, 0x60, 0x43, + 0xF4, 0xA3, 0x00, 0x60, 0x1D, 0x61, 0x00, 0x60, 0xDD, 0x65, 0x60, 0xFE, 0x81, 0xA1, 0x7F, 0xA1, + 0x02, 0x06, 0x00, 0xF4, 0x03, 0x61, 0xDD, 0x81, 0xA1, 0xD2, 0xCF, 0x83, 0xD4, 0x80, 0x2D, 0x03, + 0x17, 0x03, 0xCF, 0x83, 0x61, 0x44, 0x80, 0xA0, 0x28, 0x03, 0x02, 0x02, 0x00, 0xF4, 0x03, 0x61, + 0xDD, 0x81, 0xA1, 0xD2, 0xCF, 0x83, 0x81, 0xA1, 0x20, 0x03, 0x05, 0x07, 0x7F, 0xA1, 0xCC, 0x84, + 0xDD, 0x81, 0xE4, 0x03, 0xF7, 0x01, 0x00, 0xF4, 0x00, 0xB8, 0x04, 0x61, 0xE4, 0x03, 0xF2, 0x01, + 0x02, 0x60, 0x00, 0x63, 0x46, 0x48, 0x41, 0x4A, 0xDD, 0x81, 0xA1, 0xD0, 0xDF, 0x83, 0xA3, 0xD9, + 0x64, 0x44, 0xDD, 0x81, 0xA1, 0xD0, 0xDF, 0x83, 0xA3, 0xD9, 0xCC, 0x84, 0x81, 0xA1, 0x05, 0x03, + 0x7F, 0xA1, 0xF7, 0x04, 0x00, 0xF4, 0x03, 0x61, 0xF4, 0x01, 0x20, 0xFE, 0x00, 0xBB, 0x02, 0x60, + 0x00, 0x61, 0x08, 0x24, 0xA6, 0x00, 0x2D, 0x60, 0xD6, 0x62, 0xA2, 0xDF, 0x2D, 0x60, 0xD8, 0x62, + 0xA2, 0xDF, 0x2D, 0x60, 0xDA, 0x62, 0xA2, 0xDF, 0x2D, 0x60, 0xDC, 0x62, 0xA2, 0xDF, 0x60, 0xFE, + 0xDD, 0x64, 0xA1, 0xDB, 0xDD, 0x81, 0xA1, 0xD3, 0xFF, 0xFF, 0xFA, 0xA4, 0xFF, 0xFF, 0x04, 0x34, + 0x9A, 0x01, 0xDD, 0x81, 0xA1, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0x00, 0x3A, 0x94, 0x01, 0xDD, 0x81, + 0xA1, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0x50, 0x3A, 0x8E, 0x01, 0xDD, 0x81, 0xA1, 0xD1, 0xFF, 0xFF, + 0x64, 0x40, 0xF2, 0x3A, 0x88, 0x01, 0xDD, 0x81, 0xA1, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x3A, + 0xDC, 0x00, 0xDD, 0x81, 0xA1, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x3A, 0xD6, 0x00, 0xDD, 0x81, + 0xA1, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0x00, 0x3A, 0xD0, 0x00, 0x60, 0x5C, 0x00, 0x36, 0x39, 0x00, + 0x00, 0x64, 0xF2, 0x60, 0x58, 0x4E, 0x57, 0x78, 0xFF, 0xFF, 0x65, 0x40, 0x08, 0x26, 0xF7, 0x01, + 0x2D, 0x60, 0xD6, 0x62, 0xA2, 0xDB, 0x64, 0x40, 0x00, 0x36, 0x31, 0x00, 0xDD, 0x81, 0xA1, 0xD3, + 0xDD, 0x81, 0xF2, 0x60, 0x58, 0x4E, 0x57, 0x78, 0xFF, 0xFF, 0x65, 0x40, 0x08, 0x26, 0xF5, 0x01, + 0x2D, 0x60, 0xD8, 0x62, 0xA2, 0xDB, 0x64, 0x40, 0x00, 0x36, 0x27, 0x00, 0xDD, 0x81, 0xA1, 0xD3, + 0xDD, 0x81, 0xF2, 0x60, 0x58, 0x4E, 0x57, 0x78, 0xFF, 0xFF, 0x65, 0x40, 0x08, 0x26, 0xF5, 0x01, + 0x2D, 0x60, 0xDA, 0x62, 0xA2, 0xDB, 0x64, 0x40, 0x00, 0x36, 0x1D, 0x00, 0xDD, 0x81, 0xA1, 0xD1, + 0x2D, 0x60, 0xDC, 0x62, 0xA2, 0xD9, 0xDD, 0x81, 0xA1, 0xD1, 0x2D, 0x60, 0xDD, 0x62, 0xA2, 0xD9, + 0x18, 0x00, 0x20, 0xFE, 0x2D, 0x60, 0xD6, 0x62, 0x00, 0x60, 0x04, 0x64, 0xA2, 0xDB, 0x20, 0xFE, + 0x2D, 0x60, 0xD8, 0x62, 0x00, 0x60, 0x04, 0x64, 0xA2, 0xDB, 0x20, 0xFE, 0x2D, 0x60, 0xDA, 0x62, + 0x00, 0x60, 0x02, 0x64, 0xA2, 0xDB, 0x20, 0xFE, 0x2D, 0x60, 0xDC, 0x62, 0x00, 0x60, 0x00, 0x64, + 0xA2, 0xDB, 0x20, 0xFE, 0x02, 0x60, 0x00, 0x65, 0x2D, 0x60, 0x9E, 0x63, 0xD5, 0x84, 0xDC, 0x84, + 0xBD, 0xDB, 0x60, 0x41, 0x66, 0x44, 0x63, 0x46, 0xCD, 0x83, 0xC7, 0x81, 0x60, 0x45, 0x60, 0xFE, + 0x5D, 0x93, 0xA3, 0xD3, 0x5D, 0x93, 0xA6, 0xDB, 0xDE, 0x86, 0xFA, 0x1F, 0x66, 0x43, 0x65, 0x46, + 0x20, 0xFE, 0x20, 0xFE, 0x2D, 0x60, 0xE4, 0x62, 0xA2, 0xD1, 0xFF, 0xFF, 0x64, 0x43, 0x00, 0x64, + 0x2D, 0x60, 0xCE, 0x61, 0xA1, 0xDB, 0x2D, 0x60, 0xC2, 0x62, 0xA2, 0xD1, 0x2D, 0x60, 0xD6, 0x62, + 0xA2, 0xD3, 0xFF, 0xFF, 0xA0, 0x84, 0xFF, 0xFF, 0x10, 0x26, 0x07, 0x00, 0x04, 0x26, 0x07, 0x00, + 0x20, 0x26, 0x07, 0x00, 0x02, 0x26, 0x07, 0x00, 0x48, 0x00, 0x10, 0x7C, 0x05, 0x00, 0x04, 0x7C, + 0x03, 0x00, 0x20, 0x7C, 0x01, 0x00, 0x02, 0x7C, 0x2D, 0x60, 0xCE, 0x61, 0xA1, 0xD9, 0x50, 0x94, + 0x2D, 0x60, 0xD0, 0x61, 0xA1, 0xDB, 0x2D, 0x60, 0xC4, 0x61, 0xA1, 0xD1, 0x2D, 0x60, 0xD8, 0x61, + 0xA1, 0xD3, 0x2D, 0x60, 0xCE, 0x61, 0xA0, 0x84, 0xA1, 0xD1, 0xFF, 0xFF, 0x10, 0x26, 0x05, 0x00, + 0x04, 0x26, 0x05, 0x00, 0x01, 0x26, 0x08, 0x00, 0x28, 0x00, 0x10, 0x7C, 0x06, 0x00, 0x64, 0x40, + 0x10, 0x26, 0x23, 0x00, 0x04, 0x7C, 0x01, 0x00, 0x01, 0x7C, 0x2D, 0x60, 0xD0, 0x61, 0xA1, 0xD9, + 0x50, 0x94, 0x2D, 0x60, 0xD2, 0x61, 0xA1, 0xDB, 0x2D, 0x60, 0xC6, 0x61, 0xA1, 0xD1, 0x2D, 0x60, + 0xDA, 0x61, 0xA1, 0xD3, 0xFF, 0xFF, 0xA0, 0x84, 0x60, 0x40, 0x02, 0x26, 0x05, 0x00, 0x04, 0x26, + 0x05, 0x00, 0x01, 0x26, 0x05, 0x00, 0x09, 0x00, 0x02, 0x7C, 0x03, 0x00, 0x04, 0x7C, 0x01, 0x00, + 0x20, 0x7C, 0x2D, 0x60, 0xD2, 0x61, 0xA1, 0xD9, 0x0D, 0x00, 0x50, 0x94, 0x2D, 0x60, 0xCE, 0x62, + 0xA2, 0xDB, 0x2D, 0x60, 0xD0, 0x62, 0xA2, 0xDB, 0x2D, 0x60, 0xD2, 0x62, 0xA2, 0xDB, 0x2D, 0x60, + 0xD4, 0x62, 0xA2, 0xDB, 0x7C, 0x44, 0x2D, 0x60, 0xCE, 0x61, 0xA1, 0xD1, 0xBD, 0xD9, 0x2D, 0x60, + 0xD0, 0x61, 0xA1, 0xD1, 0xB0, 0x84, 0xBD, 0xD9, 0x2D, 0x60, 0xD2, 0x61, 0xA1, 0xD1, 0xB0, 0x84, + 0xBD, 0xD9, 0x2D, 0x60, 0xC8, 0x61, 0xA1, 0xD1, 0xB0, 0x84, 0xBD, 0xD9, 0x08, 0x28, 0x68, 0x00, + 0x28, 0x60, 0x2C, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xFF, 0xA0, 0xFF, 0xFF, 0x0C, 0x24, 0x60, 0x00, + 0x60, 0x40, 0x0B, 0x36, 0x5D, 0x00, 0x20, 0x40, 0x10, 0x27, 0x5A, 0x00, 0x88, 0x00, 0x20, 0xFE, + 0x00, 0x65, 0x60, 0xFE, 0x2D, 0x60, 0xDE, 0x62, 0xA2, 0xDB, 0xE0, 0x84, 0xE0, 0x84, 0x08, 0x20, + 0x03, 0x00, 0x01, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x02, 0xA5, 0x64, 0x44, 0xD4, 0x9C, 0xD4, 0x80, + 0x2D, 0x60, 0xE0, 0x62, 0x02, 0x05, 0x08, 0x65, 0x41, 0x00, 0xA2, 0xD9, 0x7C, 0x44, 0x2D, 0x60, + 0xE2, 0x62, 0xA2, 0xDB, 0xDD, 0x81, 0xA1, 0xD1, 0x00, 0x65, 0x64, 0x40, 0x00, 0x3A, 0x01, 0x65, + 0xDD, 0x81, 0xA1, 0xD1, 0xFF, 0xFF, 0x64, 0x40, 0x50, 0x3A, 0x01, 0x65, 0xDD, 0x81, 0xA1, 0xD1, + 0xFF, 0xFF, 0x64, 0x40, 0xF2, 0x3A, 0x01, 0x65, 0xDD, 0x81, 0xA1, 0xD1, 0x65, 0x40, 0x00, 0x3A, + 0x18, 0x00, 0x00, 0x60, 0x00, 0x65, 0x64, 0x40, 0x00, 0x36, 0x01, 0x65, 0x64, 0x40, 0x01, 0x36, + 0x02, 0x65, 0x64, 0x40, 0x02, 0x36, 0x04, 0x65, 0x64, 0x40, 0x04, 0x36, 0x10, 0x65, 0x64, 0x40, + 0x05, 0x36, 0x20, 0x65, 0x65, 0x5C, 0x2D, 0x60, 0xE2, 0x62, 0xA2, 0xD3, 0xFF, 0xFF, 0xB0, 0x84, + 0xA2, 0xDB, 0x2D, 0x60, 0xDE, 0x62, 0xA2, 0xD3, 0x00, 0x65, 0xFF, 0xA4, 0xA2, 0xDB, 0xCA, 0x02, + 0x2D, 0x60, 0xE2, 0x62, 0xA2, 0xD3, 0x2D, 0x60, 0xE0, 0x62, 0xA2, 0xD1, 0x2E, 0x58, 0xFF, 0xFF, + 0x20, 0xFE, 0x8A, 0xF3, 0xFF, 0xFF, 0x3A, 0xA4, 0x8A, 0xFB, 0x3D, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x89, 0xF3, 0x7F, 0xF1, 0x04, 0xA4, 0x89, 0xFB, 0x12, 0x60, 0x22, 0x63, 0x53, 0xF3, 0x64, 0x41, + 0x08, 0xB0, 0xE1, 0x85, 0x1C, 0x03, 0xFE, 0xA1, 0x47, 0xD3, 0x02, 0x06, 0xFB, 0xB4, 0xA3, 0xDB, + 0xDD, 0x81, 0x5B, 0xD3, 0x0C, 0x24, 0x02, 0x00, 0xFB, 0xB4, 0xA3, 0xDB, 0x5B, 0xD3, 0xDD, 0x81, + 0x02, 0xBC, 0xA3, 0xDB, 0x0E, 0x65, 0xDD, 0x81, 0xD5, 0x80, 0x5B, 0xD3, 0x08, 0x05, 0xFB, 0xB4, + 0xA3, 0xDB, 0xDD, 0x81, 0xD5, 0x80, 0x5B, 0xD3, 0x02, 0x03, 0xFB, 0xB4, 0xA3, 0xDB, 0xFF, 0xFF, + 0x20, 0xFE, 0x26, 0x46, 0x31, 0x40, 0x20, 0x2A, 0x18, 0x00, 0x3F, 0xF2, 0x47, 0x65, 0xC4, 0x84, + 0xE8, 0x84, 0x23, 0xFA, 0xF1, 0x60, 0x02, 0x64, 0x24, 0xFA, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, + 0x64, 0x64, 0xA2, 0xDB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xFA, 0xFE, 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x26, 0x46, 0x2F, 0x58, 0xFF, 0xFF, + 0x16, 0x63, 0x1C, 0x60, 0x8C, 0x62, 0x00, 0x64, 0x5A, 0xDB, 0xFE, 0x1F, 0x5B, 0xFB, 0x5C, 0xFB, + 0x1C, 0x60, 0x92, 0x63, 0x02, 0x64, 0xA3, 0xDB, 0x1A, 0x60, 0xC6, 0x62, 0x3E, 0x63, 0x00, 0x64, + 0x5A, 0xDB, 0xFE, 0x1F, 0x2E, 0x58, 0xFF, 0xFF, 0x1C, 0x60, 0x98, 0x62, 0xA2, 0xD3, 0x00, 0x63, + 0xF8, 0xA0, 0x01, 0xA4, 0x03, 0x03, 0xA2, 0xDB, 0x2E, 0x58, 0xFF, 0xFF, 0xA2, 0xDD, 0x1C, 0x60, + 0x9A, 0x62, 0xA2, 0xD1, 0xA2, 0xDD, 0x5A, 0xD3, 0xA2, 0xDD, 0xC0, 0x81, 0x61, 0x44, 0x02, 0x24, + 0xFF, 0xFF, 0xE9, 0x81, 0xE9, 0x81, 0xE9, 0x81, 0xE9, 0x81, 0x5A, 0xD3, 0xE9, 0x81, 0xE8, 0x83, + 0xEB, 0x83, 0xEB, 0x83, 0xEB, 0x83, 0xEB, 0x85, 0xD4, 0x85, 0xC5, 0x83, 0xA2, 0xDD, 0x1C, 0x60, + 0x8E, 0x62, 0x63, 0x47, 0x00, 0x7F, 0xA2, 0xDB, 0x2E, 0x58, 0xFF, 0xFF, 0x1C, 0x60, 0xA0, 0x65, + 0xA5, 0xDD, 0x1B, 0x60, 0x46, 0x65, 0x61, 0x44, 0x2B, 0x41, 0x45, 0xDB, 0x60, 0x41, 0x1B, 0x60, + 0x86, 0x65, 0x0A, 0xA3, 0xA3, 0xD1, 0x2B, 0x44, 0x44, 0xD9, 0x1C, 0x60, 0xA0, 0x65, 0xA5, 0xD3, + 0xFF, 0xFF, 0x60, 0x43, 0x00, 0xB9, 0xFF, 0xFF, 0x4C, 0x03, 0x06, 0xA3, 0xBD, 0xD1, 0x81, 0xF3, + 0x82, 0xF1, 0xD0, 0x80, 0xBD, 0xD3, 0x22, 0x02, 0x83, 0xF3, 0xD0, 0x80, 0xA3, 0xD1, 0x1E, 0x02, + 0xD0, 0x80, 0xFF, 0xFF, 0x1B, 0x02, 0x8A, 0xF3, 0x12, 0x60, 0x46, 0x63, 0xC6, 0xA5, 0x47, 0xD1, + 0x7F, 0xF3, 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, 0x08, 0x28, 0xFF, 0x61, 0x61, 0x43, 0x1A, 0x60, + 0xC6, 0x65, 0x2B, 0x44, 0x44, 0xD1, 0x1C, 0x60, 0x8E, 0x65, 0xA5, 0xD1, 0x64, 0x44, 0xD0, 0x81, + 0x1C, 0x60, 0x92, 0x65, 0x01, 0x05, 0x00, 0x61, 0xA5, 0xD3, 0x15, 0x00, 0x1A, 0x60, 0xC6, 0x65, + 0x2B, 0x44, 0x44, 0xD1, 0x1C, 0x60, 0x8E, 0x65, 0x64, 0x43, 0xA5, 0xD1, 0x64, 0x65, 0x63, 0x44, + 0xC0, 0x84, 0xD4, 0x80, 0xFF, 0xFF, 0x02, 0x06, 0x00, 0x61, 0x13, 0x00, 0x61, 0x43, 0xD0, 0x81, + 0x1C, 0x60, 0x92, 0x65, 0xA5, 0xD3, 0xE9, 0x81, 0xE9, 0x81, 0xCC, 0x84, 0xCC, 0x84, 0x02, 0x03, + 0x02, 0x03, 0xE9, 0x81, 0xE9, 0x81, 0xE9, 0x81, 0xE9, 0x85, 0xD7, 0x84, 0x60, 0x41, 0x01, 0x05, + 0x00, 0x61, 0x1C, 0x60, 0xA0, 0x65, 0xA5, 0xD3, 0xFF, 0xFF, 0x60, 0x43, 0x2E, 0x58, 0xFF, 0xFF, + 0x1C, 0x60, 0x94, 0x65, 0xA5, 0xD1, 0x5B, 0xF3, 0x64, 0x41, 0xCD, 0x81, 0xCD, 0x81, 0x02, 0x03, + 0x02, 0x03, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x85, 0x29, 0x44, 0x54, 0x89, 0x2E, 0x58, + 0xFF, 0xFF, 0xED, 0xF3, 0x1A, 0x60, 0xBE, 0x63, 0x0F, 0xB4, 0x01, 0xA4, 0xE0, 0x87, 0xE0, 0x84, + 0xE0, 0x84, 0xBD, 0xDB, 0x10, 0x60, 0x58, 0x64, 0xBD, 0xDB, 0x02, 0x64, 0xBD, 0xDB, 0x06, 0x64, + 0xA3, 0xDB, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0xBA, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x04, 0xFF, 0x2E, 0x58, 0xFF, 0xFF, 0x1A, 0x60, 0xBE, 0x63, 0xEA, 0x60, 0x60, 0x64, + 0xBD, 0xDB, 0x10, 0x60, 0x58, 0x64, 0xBD, 0xDB, 0x02, 0x64, 0xBD, 0xDB, 0x06, 0x64, 0xA3, 0xDB, + 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, 0xBA, 0x64, 0xA2, 0xDB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0x2E, 0x58, 0xFF, 0xFF, 0x16, 0x63, 0x1C, 0x60, 0x8C, 0x62, 0x00, 0x64, 0x5A, 0xDB, + 0xFE, 0x1F, 0x5B, 0xFB, 0x5C, 0xFB, 0x1C, 0x60, 0x92, 0x63, 0x02, 0x64, 0xA3, 0xDB, 0x1A, 0x60, + 0xC6, 0x62, 0x3E, 0x63, 0x00, 0x64, 0x5A, 0xDB, 0xFE, 0x1F, 0x10, 0x60, 0x56, 0x62, 0xF5, 0x60, + 0x29, 0x64, 0xA2, 0xDB, 0x10, 0x60, 0x2C, 0x62, 0xF5, 0x60, 0x15, 0x64, 0xA2, 0xDB, 0x10, 0x60, + 0x02, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x10, 0x60, 0x04, 0x62, 0x00, 0x60, 0x04, 0x64, 0xA2, 0xDB, + 0xF4, 0x60, 0x16, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x20, 0x44, 0x40, 0x26, + 0x03, 0x00, 0xF4, 0x60, 0xEA, 0x78, 0xFF, 0xFF, 0x20, 0x40, 0x52, 0x23, 0x07, 0x00, 0x5A, 0xF3, + 0xFF, 0xFF, 0x01, 0xA4, 0x5A, 0xFB, 0xF4, 0x60, 0xD7, 0x78, 0xFF, 0xFF, 0x40, 0x60, 0x00, 0x65, + 0x20, 0x44, 0x34, 0x80, 0x1C, 0x60, 0x92, 0x65, 0x02, 0x64, 0xA5, 0xDB, 0x1A, 0x60, 0xC4, 0x62, + 0x7E, 0x63, 0x00, 0x64, 0x5A, 0xDB, 0xFE, 0x1F, 0x1C, 0x60, 0x96, 0x62, 0xA2, 0xDD, 0x8C, 0xF3, + 0x58, 0xFB, 0x02, 0x64, 0x8C, 0xFB, 0xFF, 0xFF, 0xC1, 0xFE, 0x8C, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, + 0xFF, 0xFF, 0x0B, 0x03, 0x10, 0x60, 0x04, 0x62, 0x80, 0x60, 0x00, 0x64, 0xA2, 0xDB, 0xF4, 0x60, + 0x3D, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x04, 0x64, 0x53, 0xFB, 0x29, 0x60, + 0xA4, 0x64, 0x54, 0xFB, 0x0F, 0x4E, 0xEC, 0x60, 0x58, 0x4F, 0xB9, 0x78, 0xFF, 0xFF, 0x0E, 0x4F, + 0x10, 0x60, 0x02, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x10, 0x60, 0x04, 0x62, 0x10, 0x60, 0x00, 0x64, + 0xA2, 0xDB, 0xF4, 0x60, 0x67, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x58, 0xF3, + 0x8C, 0xFB, 0xCA, 0xFE, 0xC1, 0xFE, 0x1C, 0x60, 0xA2, 0x62, 0x66, 0x44, 0xA2, 0xDB, 0x5A, 0xDD, + 0x61, 0x44, 0x5A, 0xDB, 0x67, 0xF5, 0xCC, 0xF1, 0x19, 0xF8, 0xF8, 0x60, 0x80, 0x64, 0x0E, 0xFA, + 0xA9, 0xF1, 0x07, 0xF8, 0x01, 0x60, 0x60, 0x67, 0x2C, 0xFA, 0x1D, 0x64, 0x2D, 0xFA, 0x01, 0x64, + 0x2E, 0xFA, 0xEB, 0xF1, 0x2F, 0xF8, 0xEC, 0xF1, 0x30, 0xF8, 0xED, 0xF1, 0x31, 0xF8, 0x81, 0xF1, + 0x32, 0xF8, 0x82, 0xF1, 0x33, 0xF8, 0x83, 0xF1, 0x34, 0xF8, 0x08, 0x64, 0x2A, 0xFA, 0x40, 0x63, + 0x3F, 0xFC, 0x00, 0xF4, 0x02, 0x62, 0xCB, 0x83, 0x00, 0x64, 0x5A, 0xDA, 0xFE, 0x1F, 0x1C, 0x60, + 0x8E, 0x65, 0xA5, 0xD3, 0x02, 0xFA, 0x19, 0x60, 0x88, 0x64, 0xA0, 0xD1, 0x0A, 0x61, 0x41, 0xD3, + 0x03, 0xFA, 0x06, 0x61, 0x06, 0x63, 0x00, 0x65, 0x1B, 0x60, 0x86, 0x64, 0x44, 0xD1, 0x59, 0xD8, + 0x1B, 0x60, 0x46, 0x64, 0x44, 0xD1, 0x59, 0xD8, 0x1A, 0x60, 0xC6, 0x64, 0x44, 0xD1, 0x59, 0xD8, + 0x1B, 0x60, 0x06, 0x64, 0x44, 0xD1, 0x59, 0xD8, 0x65, 0x44, 0x02, 0xA4, 0x60, 0x45, 0xEC, 0x1F, + 0x67, 0xF5, 0x24, 0x60, 0x74, 0x62, 0x24, 0x60, 0x22, 0x64, 0xA2, 0xDB, 0x66, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x1C, 0x60, 0xA2, 0x62, 0xA2, 0xD5, 0x5A, 0xD3, + 0x5A, 0xD3, 0x60, 0x43, 0x60, 0x41, 0x0F, 0x60, 0xEA, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x20, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0xBF, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, 0xF3, 0x60, + 0x58, 0x4E, 0xD4, 0x78, 0xFF, 0xFF, 0x10, 0x60, 0x02, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x10, 0x60, + 0x04, 0x62, 0x10, 0x60, 0x02, 0x64, 0xA2, 0xDB, 0xF4, 0x60, 0x16, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x1C, 0x60, 0xA4, 0x63, 0x66, 0x44, 0xA3, 0xDB, 0x00, 0x60, 0x40, 0x61, + 0xAE, 0x60, 0x58, 0x4D, 0xC4, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0x67, 0xFB, 0x04, 0x64, 0x03, 0xFA, + 0x1C, 0x60, 0xA4, 0x63, 0xA3, 0xD1, 0x00, 0x64, 0x64, 0x46, 0xA3, 0xDB, 0x00, 0x60, 0x40, 0x65, + 0x20, 0x44, 0x34, 0x80, 0xF3, 0x60, 0x58, 0x4E, 0xB9, 0x78, 0xFF, 0xFF, 0x10, 0x60, 0x02, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x10, 0x60, 0x04, 0x62, 0x00, 0x60, 0x02, 0x64, 0xA2, 0xDB, 0xF4, 0x60, + 0x16, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x24, 0x60, 0xAA, 0x62, 0x1A, 0x60, + 0xBA, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x10, 0x60, 0x02, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x5A, 0xDB, 0xFF, 0x60, 0x9F, 0x65, 0x20, 0x44, 0x24, 0x80, 0x2F, 0x58, + 0xFF, 0xFF, 0x10, 0x60, 0x02, 0x62, 0xA2, 0xD1, 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + +}; /* fw_image_4_data */ + +static const CFG_IDENTITY_STRCT fw_image_infoidentity[] = { + { + sizeof( CFG_IDENTITY_STRCT ) / sizeof(hcf_16) - 1, + CFG_FW_IDENTITY, + COMP_ID_FW_STA, + 3, //Variant + 2, //Major + 36 //Minor + }, + { 0000, 0000, 0000, 0000, 0000, 0000 } //endsentinel +}; + +static const CFG_PROG_STRCT fw_image_code[] = { + { + 8, + CFG_PROG, + CFG_PROG_VOLATILE, // mode + 0x0186, // sizeof(fw_image_1_data), + 0x00000060, // Target address in NIC Memory + 0x0000, // CRC: yes/no TYPE: primary/station/tertiary + (hcf_8 FAR *) fw_image_1_data + }, + { + 8, + CFG_PROG, + CFG_PROG_VOLATILE, // mode + 0x2518, // sizeof(fw_image_2_data), + 0x00000C16, // Target address in NIC Memory + 0x0000, // CRC: yes/no TYPE: primary/station/tertiary + (hcf_8 FAR *) fw_image_2_data + }, + { + 8, + CFG_PROG, + CFG_PROG_VOLATILE, // mode + 0x3daa, // sizeof(fw_image_3_data), + 0x001E312E, // Target address in NIC Memory + 0x0000, // CRC: yes/no TYPE: primary/station/tertiary + (hcf_8 FAR *) fw_image_3_data + }, + { + 8, + CFG_PROG, + CFG_PROG_VOLATILE, // mode + 0xaa66, // sizeof(fw_image_4_data), + 0x001F4000, // Target address in NIC Memory + 0x0000, // CRC: yes/no TYPE: primary/station/tertiary + (hcf_8 FAR *) fw_image_4_data + }, + { + 5, + CFG_PROG, + CFG_PROG_STOP, // mode + 0000, + 0x000F368E, // Start execution address + }, + { 0000, 0000, 0000, 0000, 00000000, 0000, 00000000} +}; + +static const CFG_RANGE20_STRCT fw_image_infocompat[] = { + { 3 + ((20 * sizeof(CFG_RANGE_SPEC_STRCT)) / sizeof(hcf_16)), + CFG_FW_SUP_RANGE, + COMP_ROLE_SUPL, + COMP_ID_STA, + { + { 2, 2, 5 } //variant, bottom, top + } + }, + { 3 + ((20 * sizeof(CFG_RANGE_SPEC_STRCT)) / sizeof(hcf_16)), + CFG_MFI_ACT_RANGES_STA, + COMP_ROLE_ACT, + COMP_ID_MFI, + { + { 4, 6, 7 }, //variant, bottom, top + { 5, 6, 7 }, //variant, bottom, top + { 6, 6, 7 } //variant, bottom, top + } + }, + { 3 + ((20 * sizeof(CFG_RANGE_SPEC_STRCT)) / sizeof(hcf_16)), + CFG_CFI_ACT_RANGES_STA, + COMP_ROLE_ACT, + COMP_ID_CFI, + { + { 2, 1, 2 } //variant, bottom, top + } + }, + { 0000, 0000, 0000, 0000, { { 0000, 0000, 0000 } } } //endsentinel +}; + +memimage fw_image = { + "FUPU7D37dhfwci\001C", //signature, , C/Bin type + (CFG_PROG_STRCT *) fw_image_code, + 0x000F368E, + 00000000, //(dummy) pdaplug + 00000000, //(dummy) priplug + (CFG_RANGE20_STRCT *) fw_image_infocompat, + (CFG_IDENTITY_STRCT *) fw_image_infoidentity, +}; + diff --git a/drivers/staging/wlags49_h2/sta_h25.c b/drivers/staging/wlags49_h2/sta_h25.c new file mode 100644 index 000000000000..86ca1cdd8497 --- /dev/null +++ b/drivers/staging/wlags49_h2/sta_h25.c @@ -0,0 +1,5255 @@ +/* + * File: sta_h54.136 + * + * Abstract: This file contains memory image 'fw_image'. + * + * Contents: Total size of the memory image: 81742 bytes. + * Total number of blocks: 4 blocks. + * Block 1 : load address 00000060, 388 bytes. + * Block 2 : load address 00000C16, 11278 bytes. + * Block 3 : load address 001E3824, 21726 bytes. + * Block 4 : load address 001F4000, 48350 bytes. + * + * Identity: component id: 31 (variant 4) version 1.36 + * + * Compatibility: + * supplying interface 4 (variant 4) : 1 - 2 + * acting on interface 1 (variant 7) : 3 - 3 + * acting on interface 1 (variant 8) : 1 - 1 + * acting on interface 2 (variant 4) : 1 - 2 + * + * Generated: by g:\fw\fupu3.exe version 4.26 + * + * Commandline: g:\fw\fupu3.exe /f=4 /n=fw_image /i=r4013600.hex + */ + + +#include "hcfcfg.h" // to get hcf_16 etc defined as well as + // possible settings which inluence mdd.h or dhf.h +#include "mdd.h" //to get COMP_ID_STA etc defined +#include "dhf.h" //used to be "fhfmem.h", to get memblock,plugrecord, + +static const hcf_8 fw_image_1_data[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDA, 0x0C, 0x00, 0x00, + 0x00, 0x0D, 0x00, 0x00, 0x00, 0x0D, 0x65, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x1B, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB2, 0x1B, 0xB2, 0x1B, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEA, 0x00, 0x00, 0xFF, 0x07, + 0x01, 0x00, 0x64, 0x00, 0x64, 0x00, 0x10, 0x27, 0x10, 0x27, 0x14, 0x00, 0xD0, 0x07, 0xD0, 0x07, + 0x10, 0x27, 0x2F, 0x00, 0x32, 0x00, 0x32, 0x00, 0x05, 0x00, 0x02, 0x00, 0x02, 0x00, 0x10, 0x27, + 0x05, 0x00, 0x00, 0x02, 0x00, 0x02, 0x13, 0x00, 0x07, 0x00, 0x03, 0x00, 0x32, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x09, 0x2B, 0x09, 0x2B, 0x09, 0xFF, 0x0F, 0xF0, 0x0F, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x01, 0x00, 0x40, 0x00, 0x32, 0x00, 0x32, 0x00, 0x0A, 0x00, + 0x02, 0x00, 0x06, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + +}; /* fw_image_1_data */ + +static const hcf_8 fw_image_2_data[] = { + 0xF4, 0xA3, 0x00, 0x16, 0x08, 0x40, 0x0F, 0xD2, 0xE1, 0x28, 0xA5, 0x7C, 0x50, 0x30, 0xF1, 0x84, + 0x44, 0x08, 0xAB, 0xAE, 0xA5, 0xB8, 0xFC, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, + 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA5, 0xC6, 0x84, 0xF8, 0x99, 0xEE, + 0x8D, 0xF6, 0x0D, 0xFF, 0xBD, 0xD6, 0xB1, 0xDE, 0x54, 0x91, 0x50, 0x60, 0x03, 0x02, 0xA9, 0xCE, + 0x7D, 0x56, 0x19, 0xE7, 0x62, 0xB5, 0xE6, 0x4D, 0x9A, 0xEC, 0x45, 0x8F, 0x9D, 0x1F, 0x40, 0x89, + 0x87, 0xFA, 0x15, 0xEF, 0xEB, 0xB2, 0xC9, 0x8E, 0x0B, 0xFB, 0xEC, 0x41, 0x67, 0xB3, 0xFD, 0x5F, + 0xEA, 0x45, 0xBF, 0x23, 0xF7, 0x53, 0x96, 0xE4, 0x5B, 0x9B, 0xC2, 0x75, 0x1C, 0xE1, 0xAE, 0x3D, + 0x6A, 0x4C, 0x5A, 0x6C, 0x41, 0x7E, 0x02, 0xF5, 0x4F, 0x83, 0x5C, 0x68, 0xF4, 0x51, 0x34, 0xD1, + 0x08, 0xF9, 0x93, 0xE2, 0x73, 0xAB, 0x53, 0x62, 0x3F, 0x2A, 0x0C, 0x08, 0x52, 0x95, 0x65, 0x46, + 0x5E, 0x9D, 0x28, 0x30, 0xA1, 0x37, 0x0F, 0x0A, 0xB5, 0x2F, 0x09, 0x0E, 0x36, 0x24, 0x9B, 0x1B, + 0x3D, 0xDF, 0x26, 0xCD, 0x69, 0x4E, 0xCD, 0x7F, 0x9F, 0xEA, 0x1B, 0x12, 0x9E, 0x1D, 0x74, 0x58, + 0x2E, 0x34, 0x2D, 0x36, 0xB2, 0xDC, 0xEE, 0xB4, 0xFB, 0x5B, 0xF6, 0xA4, 0x4D, 0x76, 0x61, 0xB7, + 0xCE, 0x7D, 0x7B, 0x52, 0x3E, 0xDD, 0x71, 0x5E, 0x97, 0x13, 0xF5, 0xA6, 0x68, 0xB9, 0x00, 0x00, + 0x2C, 0xC1, 0x60, 0x40, 0x1F, 0xE3, 0xC8, 0x79, 0xED, 0xB6, 0xBE, 0xD4, 0x46, 0x8D, 0xD9, 0x67, + 0x4B, 0x72, 0xDE, 0x94, 0xD4, 0x98, 0xE8, 0xB0, 0x4A, 0x85, 0x6B, 0xBB, 0x2A, 0xC5, 0xE5, 0x4F, + 0x16, 0xED, 0xC5, 0x86, 0xD7, 0x9A, 0x55, 0x66, 0x94, 0x11, 0xCF, 0x8A, 0x10, 0xE9, 0x06, 0x04, + 0x81, 0xFE, 0xF0, 0xA0, 0x44, 0x78, 0xBA, 0x25, 0xE3, 0x4B, 0xF3, 0xA2, 0xFE, 0x5D, 0xC0, 0x80, + 0x8A, 0x05, 0xAD, 0x3F, 0xBC, 0x21, 0x48, 0x70, 0x04, 0xF1, 0xDF, 0x63, 0xC1, 0x77, 0x75, 0xAF, + 0x63, 0x42, 0x30, 0x20, 0x1A, 0xE5, 0x0E, 0xFD, 0x6D, 0xBF, 0x4C, 0x81, 0x14, 0x18, 0x35, 0x26, + 0x2F, 0xC3, 0xE1, 0xBE, 0xA2, 0x35, 0xCC, 0x88, 0x39, 0x2E, 0x57, 0x93, 0xF2, 0x55, 0x82, 0xFC, + 0x47, 0x7A, 0xAC, 0xC8, 0xE7, 0xBA, 0x2B, 0x32, 0x95, 0xE6, 0xA0, 0xC0, 0x98, 0x19, 0xD1, 0x9E, + 0x7F, 0xA3, 0x66, 0x44, 0x7E, 0x54, 0xAB, 0x3B, 0x83, 0x0B, 0xCA, 0x8C, 0x29, 0xC7, 0xD3, 0x6B, + 0x3C, 0x28, 0x79, 0xA7, 0xE2, 0xBC, 0x1D, 0x16, 0x76, 0xAD, 0x3B, 0xDB, 0x56, 0x64, 0x4E, 0x74, + 0x1E, 0x14, 0xDB, 0x92, 0x0A, 0x0C, 0x6C, 0x48, 0xE4, 0xB8, 0x5D, 0x9F, 0x6E, 0xBD, 0xEF, 0x43, + 0xA6, 0xC4, 0xA8, 0x39, 0xA4, 0x31, 0x37, 0xD3, 0x8B, 0xF2, 0x32, 0xD5, 0x43, 0x8B, 0x59, 0x6E, + 0xB7, 0xDA, 0x8C, 0x01, 0x64, 0xB1, 0xD2, 0x9C, 0xE0, 0x49, 0xB4, 0xD8, 0xFA, 0xAC, 0x07, 0xF3, + 0x25, 0xCF, 0xAF, 0xCA, 0x8E, 0xF4, 0xE9, 0x47, 0x18, 0x10, 0xD5, 0x6F, 0x88, 0xF0, 0x6F, 0x4A, + 0x72, 0x5C, 0x24, 0x38, 0xF1, 0x57, 0xC7, 0x73, 0x51, 0x97, 0x23, 0xCB, 0x7C, 0xA1, 0x9C, 0xE8, + 0x21, 0x3E, 0xDD, 0x96, 0xDC, 0x61, 0x86, 0x0D, 0x85, 0x0F, 0x90, 0xE0, 0x42, 0x7C, 0xC4, 0x71, + 0xAA, 0xCC, 0xD8, 0x90, 0x05, 0x06, 0x01, 0xF7, 0x12, 0x1C, 0xA3, 0xC2, 0x5F, 0x6A, 0xF9, 0xAE, + 0xD0, 0x69, 0x91, 0x17, 0x58, 0x99, 0x27, 0x3A, 0xB9, 0x27, 0x38, 0xD9, 0x13, 0xEB, 0xB3, 0x2B, + 0x33, 0x22, 0xBB, 0xD2, 0x70, 0xA9, 0x89, 0x07, 0xA7, 0x33, 0xB6, 0x2D, 0x22, 0x3C, 0x92, 0x15, + 0x20, 0xC9, 0x49, 0x87, 0xFF, 0xAA, 0x78, 0x50, 0x7A, 0xA5, 0x8F, 0x03, 0xF8, 0x59, 0x80, 0x09, + 0x17, 0x1A, 0xDA, 0x65, 0x31, 0xD7, 0xC6, 0x84, 0xB8, 0xD0, 0xC3, 0x82, 0xB0, 0x29, 0x77, 0x5A, + 0x11, 0x1E, 0xCB, 0x7B, 0xFC, 0xA8, 0xD6, 0x6D, 0x3A, 0x2C, 0x00, 0x30, 0x00, 0x31, 0x00, 0x33, + 0x00, 0x34, 0x00, 0x35, 0x00, 0x36, 0x00, 0x37, 0x00, 0x38, 0x00, 0x38, 0x00, 0x3A, 0x00, 0x3B, + 0x00, 0x3C, 0x00, 0x3D, 0x00, 0x3E, 0x00, 0x3F, 0x00, 0x3F, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE6, 0x28, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x0A, 0x02, 0x14, 0x05, 0x32, 0x0B, 0x37, 0x08, 0x50, 0x0B, 0x6E, + 0x02, 0x00, 0x04, 0x00, 0x0B, 0x00, 0x16, 0x00, 0x0C, 0x00, 0x12, 0x00, 0x18, 0x00, 0x24, 0x00, + 0x30, 0x00, 0x48, 0x00, 0x60, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x39, 0x00, 0x20, 0x00, 0x39, 0x00, 0x39, 0x00, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x10, + 0x3E, 0x11, 0xF6, 0x10, 0x38, 0x11, 0xFC, 0x10, 0x32, 0x11, 0x02, 0x11, 0x2C, 0x11, 0x08, 0x11, + 0x26, 0x11, 0x0E, 0x11, 0x20, 0x11, 0x14, 0x11, 0x1A, 0x11, 0x07, 0x01, 0x00, 0x00, 0x16, 0x22, + 0x00, 0x04, 0x08, 0x01, 0x00, 0x00, 0x16, 0x26, 0x00, 0x04, 0x09, 0x01, 0x00, 0x00, 0x16, 0x2A, + 0x00, 0x04, 0x0A, 0x01, 0x00, 0x00, 0x16, 0x2E, 0x00, 0x04, 0x0B, 0x01, 0x00, 0x00, 0x10, 0x24, + 0x04, 0x04, 0x0C, 0x01, 0x00, 0x00, 0x10, 0x28, 0x04, 0x04, 0x0D, 0x01, 0x00, 0x00, 0x10, 0x2C, + 0x04, 0x04, 0x0E, 0x01, 0x00, 0x00, 0x10, 0x30, 0x04, 0x04, 0x0F, 0x01, 0x00, 0x00, 0x14, 0x34, + 0x08, 0x84, 0x10, 0x01, 0x00, 0x00, 0x14, 0x38, 0x08, 0x84, 0x11, 0x01, 0x00, 0x00, 0x14, 0x3C, + 0x08, 0x84, 0x12, 0x01, 0x00, 0x00, 0x14, 0x40, 0x08, 0x84, 0x13, 0x01, 0x00, 0x00, 0x17, 0x64, + 0x0C, 0x8B, 0x14, 0x01, 0x00, 0x00, 0x17, 0x68, 0x0C, 0x8B, 0x15, 0x01, 0x00, 0x00, 0x17, 0x6C, + 0x0C, 0x8B, 0x16, 0x01, 0x00, 0x00, 0x17, 0x70, 0x0C, 0x8B, 0x17, 0x01, 0x00, 0x00, 0x17, 0x74, + 0x0C, 0x8B, 0x18, 0x01, 0x00, 0x00, 0x17, 0x78, 0x0C, 0x8B, 0x19, 0x01, 0x00, 0x00, 0x17, 0x7C, + 0x0C, 0x8B, 0x1A, 0x01, 0x00, 0x00, 0x17, 0x80, 0x0C, 0x8B, 0x1B, 0x01, 0x00, 0x00, 0x17, 0x84, + 0x0C, 0x8B, 0x1C, 0x01, 0x00, 0x00, 0x17, 0x88, 0x0C, 0x8B, 0x1D, 0x01, 0x00, 0x00, 0x17, 0x8C, + 0x0C, 0x8B, 0x1E, 0x01, 0x00, 0x00, 0x0E, 0x95, 0x17, 0x04, 0x1F, 0x01, 0x00, 0x00, 0x0E, 0x99, + 0x17, 0x04, 0x20, 0x01, 0x00, 0x00, 0x0E, 0x9D, 0x17, 0x04, 0x21, 0x01, 0x00, 0x00, 0x0E, 0xA1, + 0x17, 0x04, 0x22, 0x01, 0x00, 0x00, 0x0E, 0xA5, 0x00, 0x00, 0x60, 0x11, 0x80, 0x11, 0xA0, 0x11, + 0xC0, 0x11, 0x18, 0x12, 0x68, 0x11, 0x88, 0x11, 0xA8, 0x11, 0xC8, 0x11, 0x20, 0x12, 0x70, 0x11, + 0x90, 0x11, 0xB0, 0x11, 0xD0, 0x11, 0x28, 0x12, 0x78, 0x11, 0x98, 0x11, 0xB8, 0x11, 0xD8, 0x11, + 0x30, 0x12, 0xE0, 0x11, 0xE8, 0x11, 0xF0, 0x11, 0xF8, 0x11, 0x00, 0x12, 0x08, 0x12, 0x10, 0x12, + 0x38, 0x12, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x0A, 0x0A, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x1E, 0x1E, 0x1E, 0x1E, + 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x0A, 0x0A, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x10, 0x10, + 0x10, 0x10, 0x17, 0x17, 0x17, 0x17, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, + 0x14, 0x14, 0x14, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x11, 0x11, 0x11, 0x11, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x16, 0x16, + 0x16, 0x16, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x0A, + 0x0A, 0x0A, 0x0A, 0x7F, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, + 0x14, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x10, 0x10, 0x10, 0x10, 0x7F, 0x14, 0x14, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x0A, 0x0A, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x9D, 0x9D, 0xA1, 0xB4, + 0x10, 0x10, 0x00, 0x9D, 0x08, 0x02, 0x06, 0x00, 0xA5, 0xA5, 0xAA, 0xB4, 0x10, 0x10, 0x00, 0xA2, + 0x15, 0x05, 0x07, 0x00, 0xAA, 0xAA, 0xB4, 0xB4, 0x10, 0x10, 0x00, 0xA7, 0x1C, 0x0A, 0x08, 0x00, + 0xB7, 0xB7, 0xC1, 0xC1, 0x10, 0x10, 0x00, 0xB4, 0x29, 0x17, 0x08, 0x00, 0xBD, 0xBD, 0xC7, 0xC7, + 0x10, 0x10, 0x00, 0xBA, 0x2F, 0x1D, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC4, 0x1F, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x42, 0x2A, 0x5B, 0x2A, 0x7E, 0x2A, 0x71, 0x30, 0xEE, 0x29, 0x88, 0x30, 0xB8, 0x2A, + 0x9F, 0x30, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, 0x21, 0x35, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, + 0xEE, 0x29, 0xEE, 0x29, 0x93, 0x2C, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, + 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, + 0xEE, 0x29, 0xEE, 0x29, 0xDE, 0x2C, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, + 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, + 0xEE, 0x29, 0x61, 0x2C, 0x7C, 0x2C, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, 0xEE, 0x29, + 0xEE, 0x29, 0xE1, 0x27, 0xD7, 0x2A, 0xEA, 0x2A, 0x9A, 0x2B, 0x9E, 0x2B, 0xEE, 0x29, 0xEE, 0x29, + 0x4D, 0x2C, 0xA1, 0xF2, 0x62, 0xF2, 0x00, 0x00, 0x99, 0xF2, 0xEE, 0xF2, 0x12, 0xF3, 0x48, 0xF3, + 0x00, 0x00, 0x00, 0x00, 0x70, 0x2A, 0x94, 0x2A, 0x00, 0x00, 0x67, 0x30, 0x7E, 0x30, 0x95, 0x30, + 0xAF, 0x30, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFC, 0x45, 0x2D, 0xF7, 0x2F, 0x5A, 0x00, 0x02, 0x00, + 0xF9, 0xFF, 0x45, 0x2D, 0x5B, 0x2D, 0xFC, 0x00, 0x02, 0x00, 0xF7, 0xFF, 0x45, 0x2D, 0x5B, 0x2D, + 0xAA, 0x2D, 0x06, 0x00, 0xF0, 0xFF, 0x45, 0x2D, 0x22, 0x2D, 0x00, 0x00, 0x00, 0x02, 0xF6, 0xFF, + 0x45, 0x2D, 0x5B, 0x2D, 0x6C, 0x00, 0x02, 0x00, 0xF4, 0xFF, 0x45, 0x2D, 0x5B, 0x2D, 0xA6, 0x01, + 0x02, 0x00, 0xF5, 0xFF, 0x45, 0x2D, 0x00, 0x30, 0x9C, 0x2D, 0x02, 0x00, 0xED, 0xFF, 0x45, 0x2D, + 0x12, 0x30, 0x98, 0x32, 0x02, 0x00, 0xEC, 0xFF, 0x45, 0x2D, 0x40, 0x30, 0x9A, 0x32, 0x02, 0x00, + 0xEB, 0xFF, 0x45, 0x2D, 0x46, 0x30, 0x9C, 0x32, 0x02, 0x00, 0xEE, 0xFF, 0x45, 0x2D, 0x4C, 0x30, + 0x12, 0x33, 0x02, 0x00, 0xDA, 0xFF, 0x45, 0x2D, 0x5B, 0x2D, 0xF2, 0x13, 0x0C, 0x00, 0xEA, 0xFF, + 0x45, 0x2D, 0x22, 0x2D, 0x4C, 0x33, 0x06, 0x00, 0xE9, 0xFF, 0x45, 0x2D, 0x5B, 0x2D, 0x52, 0x33, + 0x02, 0x00, 0xE8, 0xFF, 0x45, 0x2D, 0x5B, 0x2D, 0x54, 0x33, 0x02, 0x00, 0xE7, 0xFF, 0x45, 0x2D, + 0x5B, 0x2D, 0x56, 0x33, 0x02, 0x00, 0xE6, 0xFF, 0x45, 0x2D, 0x5B, 0x2D, 0x58, 0x33, 0x02, 0x00, + 0xE5, 0xFF, 0x45, 0x2D, 0x5B, 0x2D, 0x5A, 0x33, 0x10, 0x00, 0xE4, 0xFF, 0x45, 0x2D, 0x5B, 0x2D, + 0x6A, 0x33, 0x18, 0x00, 0xDB, 0xFF, 0x45, 0x2D, 0x5B, 0x2D, 0x82, 0x33, 0x02, 0x00, 0xDC, 0xFF, + 0x45, 0x2D, 0x5B, 0x2D, 0x84, 0x33, 0x02, 0x00, 0xE1, 0xFF, 0x45, 0x2D, 0x5B, 0x2D, 0x5A, 0x34, + 0x02, 0x00, 0xE0, 0xFF, 0x45, 0x2D, 0x5B, 0x2D, 0x58, 0x34, 0x02, 0x00, 0xE3, 0xFF, 0x45, 0x2D, + 0x5B, 0x2D, 0x3C, 0x34, 0x02, 0x00, 0xE2, 0xFF, 0x93, 0x2D, 0x22, 0x2D, 0xF2, 0x33, 0x24, 0x00, + 0x03, 0xFC, 0x45, 0x2D, 0x01, 0x2F, 0x8C, 0x32, 0x02, 0x00, 0x04, 0xFC, 0x45, 0x2D, 0x55, 0x2D, + 0xB4, 0x2D, 0x22, 0x00, 0x06, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, 0x9A, 0x2D, 0x02, 0x00, 0x07, 0xFC, + 0x45, 0x2D, 0x5B, 0x2D, 0xF8, 0x2D, 0x02, 0x00, 0x0E, 0xFC, 0x45, 0x2D, 0x2A, 0x2F, 0x02, 0x2E, + 0x22, 0x00, 0xB1, 0xFC, 0x45, 0x2D, 0x39, 0x31, 0x00, 0x2F, 0x02, 0x00, 0x20, 0xFC, 0x45, 0x2D, + 0x5B, 0x2D, 0x28, 0x2E, 0x02, 0x00, 0x25, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, 0x34, 0x2E, 0x02, 0x00, + 0x26, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, 0x36, 0x2E, 0x02, 0x00, 0x27, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, + 0x38, 0x2E, 0x02, 0x00, 0xB2, 0xFC, 0x45, 0x2D, 0x55, 0x2D, 0x24, 0x2F, 0x22, 0x00, 0xC1, 0xFC, + 0x45, 0x2D, 0x5B, 0x2D, 0x9E, 0x33, 0x20, 0x00, 0xB0, 0xFC, 0x18, 0x2D, 0x3D, 0x31, 0x00, 0x00, + 0x00, 0x00, 0xC4, 0xFC, 0x18, 0x2D, 0x57, 0x30, 0x00, 0x00, 0x08, 0x00, 0xC8, 0xFC, 0x18, 0x2D, + 0x55, 0x30, 0x00, 0x00, 0x08, 0x00, 0xB4, 0xFC, 0x18, 0x2D, 0x71, 0x31, 0x00, 0x00, 0x00, 0x00, + 0xB6, 0xFC, 0x18, 0x2D, 0x19, 0x32, 0x00, 0x00, 0x00, 0x00, 0xB7, 0xFC, 0x18, 0x2D, 0x43, 0x32, + 0x00, 0x00, 0x00, 0x00, 0xB8, 0xFC, 0x18, 0x2D, 0x99, 0x32, 0x00, 0x00, 0x00, 0x00, 0xBC, 0xFC, + 0x18, 0x2D, 0xD2, 0x32, 0x00, 0x00, 0x00, 0x00, 0xBD, 0xFC, 0x18, 0x2D, 0x58, 0x33, 0x00, 0x00, + 0x00, 0x00, 0xBE, 0xFC, 0x18, 0x2D, 0x82, 0x33, 0x00, 0x00, 0x00, 0x00, 0xBF, 0xFC, 0x18, 0x2D, + 0xCF, 0x33, 0x00, 0x00, 0x00, 0x00, 0xB3, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, 0xA0, 0x0F, 0x10, 0x00, + 0xB5, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, 0x38, 0x34, 0x02, 0x00, 0xB9, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, + 0x3A, 0x34, 0x02, 0x00, 0x90, 0xFD, 0x45, 0x2D, 0x22, 0x2D, 0x3E, 0x34, 0x02, 0x00, 0x88, 0xFC, + 0x45, 0x2D, 0x5B, 0x2D, 0x72, 0x32, 0x04, 0x00, 0x89, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, 0x76, 0x32, + 0x04, 0x00, 0xC5, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, 0x7A, 0x32, 0x04, 0x00, 0x23, 0xFC, 0x45, 0x2D, + 0x5B, 0x2D, 0x2E, 0x2E, 0x04, 0x00, 0x2A, 0xFC, 0x45, 0x2D, 0xE9, 0x2D, 0xB0, 0x2D, 0x02, 0x00, + 0xC7, 0xFD, 0x45, 0x2D, 0x22, 0x2D, 0xA0, 0x32, 0x0A, 0x00, 0x29, 0xFC, 0x3C, 0x2E, 0x00, 0x2E, + 0x00, 0x00, 0x00, 0x00, 0xC2, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, 0x80, 0x32, 0x08, 0x00, 0x32, 0xFC, + 0x45, 0x2D, 0x5B, 0x2D, 0x98, 0x01, 0x02, 0x00, 0x33, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, 0x9A, 0x01, + 0x02, 0x00, 0x35, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, 0x88, 0x32, 0x02, 0x00, 0xC7, 0xFC, 0x45, 0x2D, + 0xD3, 0x2F, 0x8A, 0x32, 0x02, 0x00, 0x00, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, 0xB2, 0x2D, 0x02, 0x00, + 0x01, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, 0xAA, 0x2D, 0x06, 0x00, 0x02, 0xFC, 0x45, 0x2D, 0xD5, 0x2D, + 0x02, 0x2F, 0x22, 0x00, 0x05, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, 0xA0, 0x2D, 0x02, 0x00, 0x08, 0xFC, + 0x45, 0x2D, 0x5B, 0x2D, 0xA4, 0x2D, 0x06, 0x00, 0x09, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, 0xFA, 0x2D, + 0x02, 0x00, 0x0B, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, 0xFC, 0x2D, 0x02, 0x00, 0x0C, 0xFC, 0x45, 0x2D, + 0x5B, 0x2D, 0xFE, 0x2D, 0x02, 0x00, 0x0D, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, 0x00, 0x2E, 0x02, 0x00, + 0x21, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, 0x2A, 0x2E, 0x02, 0x00, 0x80, 0xFC, 0xB1, 0x2D, 0xC1, 0x2D, + 0x40, 0x2E, 0xC0, 0x00, 0x81, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, 0xA4, 0x01, 0x02, 0x00, 0x83, 0xFC, + 0x45, 0x2D, 0x5B, 0x2D, 0xA8, 0x01, 0x02, 0x00, 0x85, 0xFC, 0x45, 0x2D, 0x4A, 0x2F, 0xA0, 0x01, + 0x02, 0x00, 0x86, 0xFC, 0x45, 0x2D, 0x6E, 0x2F, 0xB0, 0x01, 0x02, 0x00, 0x28, 0xFC, 0x45, 0x2D, + 0x5B, 0x2D, 0x3A, 0x2E, 0x02, 0x00, 0x90, 0xFC, 0x45, 0x2D, 0x5C, 0x2F, 0xA2, 0x01, 0x02, 0x00, + 0x87, 0xFC, 0x45, 0x2D, 0x8C, 0x2F, 0x50, 0x2F, 0x22, 0x03, 0x30, 0xFC, 0x45, 0x2D, 0x5B, 0x2D, + 0x3C, 0x2E, 0x02, 0x00, 0x84, 0xFC, 0x45, 0x2D, 0x92, 0x2F, 0xAC, 0x01, 0x04, 0x00, 0x2B, 0xFC, + 0x45, 0x2D, 0x5B, 0x2D, 0xE2, 0x37, 0x02, 0x00, 0xF8, 0xFF, 0x45, 0x2D, 0x5B, 0x2D, 0xDC, 0x37, + 0x02, 0x00, 0xF3, 0xFF, 0x45, 0x2D, 0x5B, 0x2D, 0xE4, 0x37, 0x02, 0x00, 0x20, 0xFD, 0x76, 0x2D, + 0x22, 0x2D, 0x5E, 0x40, 0x08, 0x00, 0x21, 0xFD, 0x76, 0x2D, 0x22, 0x2D, 0x62, 0x40, 0x0A, 0x00, + 0x22, 0xFD, 0x76, 0x2D, 0x22, 0x2D, 0x67, 0x40, 0x16, 0x00, 0x23, 0xFD, 0x76, 0x2D, 0x22, 0x2D, + 0x72, 0x40, 0x0A, 0x00, 0x45, 0xFD, 0x45, 0x2D, 0x22, 0x2D, 0xFC, 0x00, 0x02, 0x00, 0x47, 0xFD, + 0x45, 0x2D, 0x22, 0x2D, 0x72, 0x01, 0x02, 0x00, 0x48, 0xFD, 0x91, 0x2E, 0x22, 0x2D, 0x98, 0x01, + 0x02, 0x00, 0x49, 0xFD, 0x91, 0x2E, 0x22, 0x2D, 0x9A, 0x01, 0x02, 0x00, 0x4A, 0xFD, 0x45, 0x2D, + 0x22, 0x2D, 0x92, 0x01, 0x02, 0x00, 0x4B, 0xFD, 0x45, 0x2D, 0x22, 0x2D, 0x94, 0x01, 0x02, 0x00, + 0x4D, 0xFD, 0x76, 0x2D, 0x22, 0x2D, 0x77, 0x40, 0x0C, 0x00, 0x4F, 0xFD, 0xA5, 0x2E, 0x22, 0x2D, + 0x90, 0x32, 0x02, 0x00, 0xC2, 0xFD, 0x9B, 0x2E, 0x22, 0x2D, 0x00, 0x00, 0x02, 0x00, 0x40, 0xFD, + 0x6E, 0x2D, 0x22, 0x2D, 0xB6, 0x01, 0x02, 0x00, 0x24, 0xFD, 0xB5, 0x2E, 0x22, 0x2D, 0x00, 0x00, + 0x02, 0x00, 0x91, 0xFD, 0x45, 0x2D, 0x22, 0x2D, 0xC6, 0x25, 0x02, 0x00, 0x93, 0xFD, 0x45, 0x2D, + 0x22, 0x2D, 0xCC, 0x25, 0x02, 0x00, 0x8F, 0xFD, 0xD5, 0x2E, 0x22, 0x2D, 0x00, 0x00, 0x08, 0x00, + 0xC1, 0xFD, 0x00, 0x31, 0x22, 0x2D, 0xFA, 0x00, 0x02, 0x00, 0xC6, 0xFD, 0x45, 0x2D, 0x22, 0x2D, + 0xF8, 0x37, 0x04, 0x00, 0x25, 0xFD, 0x45, 0x2D, 0x22, 0x2D, 0x9E, 0x01, 0x02, 0x00, 0x89, 0xFD, + 0xB9, 0x30, 0x22, 0x2D, 0x00, 0x00, 0x00, 0x00, 0x8A, 0xFD, 0x93, 0x2D, 0x22, 0x2D, 0x12, 0x34, + 0x24, 0x00, 0x41, 0xFD, 0x45, 0x2D, 0x22, 0x2D, 0xBE, 0x33, 0x22, 0x00, 0x42, 0xFD, 0x45, 0x2D, + 0x22, 0x2D, 0xFE, 0x00, 0x06, 0x00, 0x43, 0xFD, 0xC2, 0x2E, 0x22, 0x2D, 0x00, 0x00, 0x06, 0x00, + 0x44, 0xFD, 0xAC, 0x2E, 0x22, 0x2D, 0xB2, 0x01, 0x02, 0x00, 0x46, 0xFD, 0x21, 0x31, 0x22, 0x2D, + 0x00, 0x00, 0x00, 0x00, 0x4C, 0xFD, 0x45, 0x2D, 0x22, 0x2D, 0x46, 0x2F, 0x02, 0x00, 0x50, 0xFD, + 0x45, 0x2D, 0x22, 0x2D, 0xF2, 0x00, 0x02, 0x00, 0x51, 0xFD, 0x45, 0x2D, 0x22, 0x2D, 0xF4, 0x00, + 0x02, 0x00, 0x52, 0xFD, 0x45, 0x2D, 0x22, 0x2D, 0xC4, 0x01, 0x02, 0x00, 0x8C, 0xFD, 0x38, 0x2D, + 0x22, 0x2D, 0x98, 0x34, 0x56, 0x00, 0x8D, 0xFD, 0x38, 0x2D, 0x22, 0x2D, 0xF2, 0x34, 0x14, 0x00, + 0x00, 0xF1, 0x46, 0x00, 0xDC, 0x2C, 0x36, 0x01, 0x01, 0xF1, 0x84, 0x07, 0xDA, 0x2C, 0x38, 0x01, + 0x00, 0x03, 0xA0, 0x80, 0x1E, 0x00, 0x70, 0x01, 0xFA, 0x00, 0xD4, 0x01, 0xFE, 0x00, 0x3A, 0x01, + 0xB6, 0x01, 0xCC, 0x2C, 0x54, 0x01, 0xC6, 0x25, 0x20, 0x00, 0x00, 0x00, 0xC0, 0x1D, 0x00, 0x00, + 0xC4, 0x1F, 0x4E, 0x01, 0x0B, 0x00, 0xB8, 0x00, 0xEC, 0x00, 0x44, 0x00, 0x46, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1C, 0x09, 0x08, 0x24, 0x28, 0x06, 0x0C, 0x18, 0x08, 0x30, 0x14, 0x0C, + 0x08, 0x36, 0x10, 0x12, 0x24, 0xB7, 0x97, 0xB6, 0xA3, 0xB7, 0xAC, 0xB7, 0xA8, 0xB6, 0x3E, 0xB7, + 0x16, 0xB7, 0x79, 0x3E, 0x57, 0x3D, 0x79, 0x3E, 0xF9, 0x3D, 0x5F, 0x3D, 0x52, 0x3D, 0x33, 0x3E, + 0x55, 0x3E, 0x6A, 0x3E, 0xAC, 0x3E, 0xD8, 0x3E, 0xF8, 0x3D, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, + 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, 0x22, 0x46, + 0x23, 0x46, 0x23, 0x46, 0x23, 0x46, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, + 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, 0x1C, 0x47, + 0x1D, 0x47, 0x9A, 0x48, 0xDA, 0x48, 0x1A, 0x48, 0x5A, 0x48, 0x9A, 0x48, 0xDA, 0x48, 0x1A, 0x48, + 0x5A, 0x48, 0x9A, 0x48, 0xDA, 0x48, 0x1A, 0x48, 0x5A, 0x48, 0x9A, 0x48, 0x33, 0x48, 0x78, 0x49, + 0x78, 0x49, 0x79, 0x49, 0x79, 0x49, 0x79, 0x49, 0x79, 0x49, 0x7A, 0x49, 0x7A, 0x49, 0x7A, 0x49, + 0x7A, 0x49, 0x7B, 0x49, 0x7B, 0x49, 0x7B, 0x49, 0x7C, 0x49, 0xD8, 0x03, 0xDC, 0x03, 0xE0, 0x03, + 0xE4, 0x03, 0xF0, 0x03, 0xF4, 0x03, 0xF8, 0x03, 0x0A, 0x04, 0x0E, 0x04, 0x12, 0x04, 0x16, 0x04, + 0x0C, 0x04, 0x10, 0x04, 0x14, 0x04, 0x18, 0x04, 0x1C, 0x04, 0x20, 0x04, 0x24, 0x04, 0x28, 0x04, + 0x4C, 0x04, 0x50, 0x04, 0x54, 0x04, 0x58, 0x04, 0x5C, 0x04, 0x60, 0x04, 0x64, 0x04, 0x68, 0x04, + 0x6C, 0x04, 0x70, 0x04, 0x74, 0x04, 0x7D, 0x04, 0x81, 0x04, 0x85, 0x04, 0x89, 0x04, 0x8D, 0x04, + 0x10, 0x00, 0x8E, 0x19, 0xAC, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3C, 0x0C, 0x00, 0x00, + 0xFF, 0x3F, 0x44, 0x04, 0x00, 0x00, 0xD3, 0x22, 0x44, 0x04, 0x9C, 0x02, 0xCB, 0x54, 0x44, 0x04, + 0x00, 0x00, 0x01, 0x00, 0x44, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0C, 0x71, 0x00, 0x30, 0x50, + 0x20, 0x00, 0x80, 0xBF, 0x1F, 0xA6, 0x28, 0x00, 0x0B, 0x02, 0x60, 0x84, 0x4C, 0x00, 0x02, 0x00, + 0x4B, 0x1C, 0x98, 0x00, 0x00, 0x00, 0x20, 0x0B, 0x34, 0x04, 0xFD, 0x34, 0x34, 0x00, 0x38, 0x04, + 0xFD, 0x34, 0x34, 0x00, 0x3C, 0x04, 0x01, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x52, 0x14, 0x00, + 0x04, 0x08, 0x0E, 0x32, 0x00, 0xA6, 0x10, 0x08, 0xC4, 0x03, 0x50, 0x60, 0x18, 0x08, 0xF0, 0x3F, + 0xFC, 0x01, 0x10, 0x0C, 0x00, 0x00, 0x80, 0x04, 0x14, 0x0C, 0x00, 0x00, 0x00, 0x41, 0x20, 0x0C, + 0xB0, 0x00, 0xB0, 0xB8, 0x24, 0x0C, 0x00, 0x00, 0xAB, 0x05, 0x2C, 0x0C, 0x80, 0x05, 0x00, 0xFF, + 0x30, 0x0C, 0x00, 0x00, 0xB0, 0x04, 0x34, 0x0C, 0x03, 0x00, 0x00, 0xE8, 0x44, 0x0C, 0x04, 0x00, + 0xFF, 0x0F, 0x00, 0x10, 0x2E, 0x00, 0x0C, 0xE3, 0x44, 0x04, 0x00, 0x00, 0x01, 0x04, 0x44, 0x04, + 0x00, 0x00, 0x01, 0x01, 0x44, 0x04, 0x00, 0x00, 0x01, 0x00, 0x44, 0x04, 0x00, 0x00, 0x01, 0x04, + 0x44, 0x04, 0x00, 0x00, 0x80, 0x03, 0x48, 0x0C, 0x00, 0x00, 0x7F, 0x00, 0x04, 0x04, 0x08, 0x48, + 0x00, 0x00, 0x04, 0x04, 0x08, 0x40, 0x00, 0x00, 0x00, 0x0C, 0x71, 0x00, 0x30, 0x30, 0x00, 0x00, + 0x5E, 0x40, 0x01, 0x00, 0x18, 0x00, 0x36, 0xC0, 0xE8, 0x0E, 0x1C, 0x00, 0x78, 0xC8, 0xA5, 0x40, + 0x24, 0x00, 0x9E, 0xB0, 0xB9, 0x95, 0x08, 0x08, 0x00, 0xEA, 0x40, 0x01, 0x0C, 0x08, 0x00, 0xEA, + 0x00, 0x00, 0x1C, 0x08, 0x00, 0x00, 0x42, 0x07, 0x20, 0x08, 0x7B, 0x00, 0xD4, 0x09, 0x2C, 0x04, + 0x14, 0x00, 0x50, 0x14, 0x30, 0x04, 0x28, 0x0F, 0x28, 0x7F, 0x18, 0x08, 0x20, 0x00, 0xFC, 0x01, + 0x04, 0x10, 0x69, 0x00, 0xFD, 0xC3, 0x08, 0x10, 0x69, 0x00, 0xFD, 0xC3, 0x08, 0x0C, 0x00, 0x00, + 0x00, 0x00, 0x48, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x48, 0x0C, 0x00, 0x00, 0x7F, 0x00, 0x04, 0x04, + 0x08, 0x48, 0x02, 0x00, 0x00, 0x00, 0x5E, 0x48, 0x00, 0x00, 0x04, 0x04, 0x08, 0x40, 0x02, 0x00, + 0x00, 0x0C, 0x71, 0x00, 0x30, 0x50, 0x00, 0x00, 0x5E, 0x48, 0x01, 0x00, 0x18, 0x00, 0x3A, 0xC0, + 0xE8, 0x04, 0x1C, 0x00, 0x78, 0xD0, 0xA5, 0x40, 0x24, 0x00, 0x9E, 0xB0, 0xB9, 0x85, 0x2C, 0x04, + 0x14, 0x00, 0x50, 0x14, 0x30, 0x04, 0x28, 0x0F, 0x28, 0x7F, 0x08, 0x08, 0x00, 0xEA, 0x40, 0x01, + 0x0C, 0x08, 0x00, 0xEA, 0x00, 0x00, 0x1C, 0x08, 0x00, 0x00, 0x42, 0x07, 0x20, 0x08, 0x7B, 0x00, + 0xD4, 0x09, 0x18, 0x08, 0xF0, 0x3F, 0xFC, 0x01, 0x04, 0x10, 0x69, 0x00, 0xDD, 0xCD, 0x08, 0x10, + 0x69, 0x00, 0xDD, 0xCD, 0x08, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x48, 0x0C, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x04, 0x40, 0x01, 0x41, 0x01, 0x0C, 0x04, 0x40, 0x04, 0x41, 0x04, 0x10, 0x04, 0xD6, 0x08, + 0x56, 0x0A, 0x14, 0x04, 0x42, 0x02, 0x56, 0x0A, 0x18, 0x04, 0x56, 0x0A, 0x40, 0x02, 0x1C, 0x04, + 0x42, 0x0A, 0x42, 0x2A, 0x20, 0x04, 0xC2, 0x00, 0xD6, 0x08, 0x24, 0x04, 0xD6, 0x08, 0xC0, 0x00, + 0x28, 0x04, 0xC2, 0x08, 0xC2, 0x28, 0x08, 0x04, 0x40, 0x01, 0x41, 0x01, 0x0C, 0x04, 0x00, 0x01, + 0x01, 0x01, 0x10, 0x04, 0x56, 0x0A, 0x56, 0x0A, 0x14, 0x04, 0x42, 0x02, 0x56, 0x0A, 0x18, 0x04, + 0x56, 0x0A, 0x40, 0x02, 0x1C, 0x04, 0x42, 0x0A, 0x42, 0x2A, 0x20, 0x04, 0x42, 0x02, 0x56, 0x0A, + 0x24, 0x04, 0x56, 0x0A, 0x40, 0x02, 0x28, 0x04, 0x42, 0x0A, 0x42, 0x2A, 0x08, 0x04, 0x40, 0x01, + 0x41, 0x01, 0x0C, 0x04, 0x40, 0x04, 0x41, 0x04, 0x10, 0x04, 0xCE, 0x08, 0x4E, 0x0A, 0x14, 0x04, + 0x42, 0x02, 0x4E, 0x0A, 0x18, 0x04, 0x4E, 0x0A, 0x40, 0x02, 0x1C, 0x04, 0x42, 0x0A, 0x42, 0x2A, + 0x20, 0x04, 0xC2, 0x00, 0xCE, 0x08, 0x24, 0x04, 0xCE, 0x08, 0xC0, 0x00, 0x28, 0x04, 0xC2, 0x08, + 0xC2, 0x28, 0x08, 0x04, 0x40, 0x01, 0x41, 0x01, 0x0C, 0x04, 0x00, 0x01, 0x01, 0x01, 0x10, 0x04, + 0x4E, 0x0A, 0x4E, 0x0A, 0x14, 0x04, 0x42, 0x02, 0x4E, 0x0A, 0x18, 0x04, 0x4E, 0x0A, 0x40, 0x02, + 0x1C, 0x04, 0x42, 0x0A, 0x42, 0x2A, 0x20, 0x04, 0x42, 0x02, 0x4E, 0x0A, 0x24, 0x04, 0x4E, 0x0A, + 0x40, 0x02, 0x28, 0x04, 0x42, 0x0A, 0x42, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x05, 0x00, 0xA0, 0x16, 0xA0, 0x16, + 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, + 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, + 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x16, + 0xA0, 0x16, 0xA0, 0x16, 0xA0, 0x17, 0xA0, 0x17, 0xA0, 0x17, 0xA0, 0x18, 0xFF, 0x06, 0xFF, 0x06, + 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, + 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, + 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, + 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0xFF, 0x06, 0x00, 0x00, 0x65, 0x00, + 0x65, 0x00, 0x65, 0x00, 0x65, 0x00, 0x5D, 0x00, 0x52, 0x00, 0x48, 0x00, 0x40, 0x00, 0x38, 0x00, + 0x31, 0x00, 0x2C, 0x00, 0x27, 0x00, 0x23, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x65, 0x00, 0x65, 0x00, + 0x65, 0x00, 0x65, 0x00, 0x5D, 0x00, 0x52, 0x00, 0x48, 0x00, 0x40, 0x00, 0x38, 0x00, 0x31, 0x00, + 0x2C, 0x00, 0x27, 0x00, 0x23, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, + 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, + 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, + 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x15, 0x00, 0x6E, 0x6F, 0x6E, 0x2D, + 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x53, 0x53, 0x49, 0x44, 0x20, 0x21, + 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x09, + 0x00, 0x00, 0x01, 0x00, 0x64, 0x00, 0x64, 0x00, 0x00, 0x00, 0x48, 0x45, 0x52, 0x4D, 0x45, 0x53, + 0x20, 0x32, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x01, 0x00, 0x15, 0x00, + 0x6E, 0x6F, 0x6E, 0x2D, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x53, 0x53, + 0x49, 0x44, 0x20, 0x21, 0x21, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x01, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x00, 0x09, 0x00, 0x00, 0x01, 0x00, 0x64, 0x00, 0x64, 0x00, 0x00, 0x00, 0x48, 0x45, + 0x52, 0x4D, 0x45, 0x53, 0x20, 0x32, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x69, + 0x72, 0x73, 0x74, 0x20, 0x57, 0x61, 0x76, 0x65, 0x4C, 0x41, 0x4E, 0x20, 0x49, 0x49, 0x20, 0x53, + 0x53, 0x49, 0x44, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x0F, 0xF0, 0x0F, + 0x0F, 0x00, 0x50, 0x01, 0x02, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, + 0x14, 0x00, 0x14, 0x00, 0x14, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x24, 0x00, 0xFF, 0x00, 0x09, 0x00, 0x09, 0x00, 0x09, 0x00, 0x09, 0x00, 0x0A, 0x00, 0x0A, 0x00, + 0x0B, 0x00, 0x0B, 0x00, 0x14, 0x00, 0x14, 0x00, 0x14, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x02, 0x01, + 0x02, 0x04, 0x0B, 0x16, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01, 0x82, 0x84, 0x8B, 0x96, 0x00, 0x00, + 0x00, 0x00, 0x1C, 0x85, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x03, 0x00, 0x20, 0x00, 0x1B, 0x00, 0x17, 0x00, 0x11, 0x00, 0x10, 0x00, 0x0B, 0x00, + 0x0B, 0x00, 0x09, 0x00, 0x17, 0x00, 0x14, 0x00, 0x10, 0x00, 0x0D, 0x00, 0x0B, 0x00, 0x09, 0x00, + 0x08, 0x00, 0x07, 0x00, 0x0D, 0x00, 0x0A, 0x00, 0x09, 0x00, 0x08, 0x00, 0x05, 0x00, 0x05, 0x00, + 0xD8, 0x0C, 0xC0, 0x08, 0x90, 0x0D, 0x60, 0x09, 0x48, 0x0E, 0x30, 0x0A, 0x24, 0x0F, 0x18, 0x0B, + 0x0B, 0x6E, 0x0B, 0x37, 0x02, 0x14, 0x01, 0x0A, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x03, 0x00, + 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x43, 0x75, 0x72, 0x72, 0x65, + 0x6E, 0x74, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x53, 0x65, 0x74, 0x20, 0x49, + 0x64, 0x65, 0x6E, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x20, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x30, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xDD, 0x00, 0x50, + 0xF2, 0x01, 0x01, 0x00, 0x00, 0x50, 0xF2, 0x05, 0x02, 0x00, 0x00, 0x50, 0xF2, 0x02, 0x00, 0x50, + 0xF2, 0x04, 0x02, 0x00, 0x00, 0x50, 0xF2, 0x00, 0x00, 0x50, 0xF2, 0x01, 0x06, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x15, 0x00, 0x14, 0x00, 0x15, 0x00, 0x36, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x14, 0x00, + 0x11, 0x00, 0x36, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x10, 0x00, 0xBE, 0x33, 0x1E, 0x33, 0xCC, 0x35, 0xD0, 0x35, 0xD4, 0x35, 0x12, 0x34, + 0x04, 0x36, 0x08, 0x36, 0xF2, 0x33, 0x00, 0x00, 0x00, 0x00, 0x24, 0x2F, 0x14, 0x33, 0x08, 0x36, + 0xFF, 0xFF, 0x00, 0x00, 0xBE, 0x33, 0x1E, 0x33, 0xCC, 0x35, 0xD0, 0x35, 0xD4, 0x35, 0x12, 0x34, + 0x04, 0x36, 0x08, 0x36, 0xF2, 0x33, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x00, 0xBE, 0x33, 0x14, 0x33, 0x08, 0x36, 0x5C, 0x34, 0x2A, 0x33, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x00, 0x02, 0x06, 0x00, 0x00, 0x06, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x2A, + 0x00, 0x00, 0x08, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDD, 0x00, 0x30, 0x00, 0xFF, 0xFF, 0x1D, 0xFA, + 0xF9, 0xF9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x19, 0x0A, + 0x09, 0x46, 0x1C, 0x60, 0x18, 0x00, 0x19, 0x1D, 0x09, 0x42, 0x1C, 0x60, 0x00, 0x00, + +}; /* fw_image_2_data */ + +static const hcf_8 fw_image_3_data[] = { + 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x26, 0x1A, 0x00, 0x80, 0x3A, 0x15, 0x00, 0x7F, 0xF1, + 0x32, 0xF2, 0x33, 0xF2, 0xD0, 0x80, 0x80, 0xF1, 0x0F, 0x02, 0xD0, 0x80, 0x34, 0xF2, 0x81, 0xF1, + 0x0B, 0x02, 0xD0, 0x80, 0xFF, 0xFF, 0x08, 0x02, 0xE9, 0x60, 0x58, 0x4F, 0x30, 0x78, 0xFF, 0xFF, + 0x24, 0x60, 0x58, 0x4F, 0xE3, 0x78, 0xFF, 0xFF, 0x1C, 0x60, 0xD7, 0x78, 0xFF, 0xFF, 0x00, 0xF4, + 0xAA, 0x60, 0xAA, 0x65, 0x09, 0xF2, 0x5A, 0xD0, 0xD4, 0x80, 0x03, 0x64, 0x12, 0x02, 0xD0, 0x80, + 0x1D, 0x60, 0x60, 0x65, 0x0E, 0x02, 0x5A, 0xD2, 0xFF, 0xFF, 0xD4, 0x80, 0x01, 0x60, 0x00, 0x65, + 0x08, 0x02, 0x5A, 0xD2, 0xFF, 0xFF, 0xD4, 0x80, 0xFF, 0xFF, 0x03, 0x02, 0x1C, 0x60, 0xD7, 0x78, + 0xFF, 0xFF, 0x00, 0x60, 0xEA, 0xF1, 0x5A, 0xD1, 0x44, 0x48, 0x5A, 0xD1, 0x44, 0x4A, 0x26, 0x46, + 0x3F, 0xF2, 0x00, 0xF4, 0x44, 0x4C, 0xD8, 0x83, 0x70, 0x61, 0x68, 0x65, 0xD7, 0x80, 0xFF, 0xFF, + 0x07, 0x0E, 0x08, 0xF2, 0x08, 0x00, 0x68, 0x65, 0xD7, 0x80, 0xFF, 0xFF, 0x01, 0x0E, 0x03, 0x00, + 0x1C, 0x60, 0xED, 0x78, 0xFF, 0xFF, 0x58, 0x4F, 0x79, 0x00, 0x9C, 0x80, 0x01, 0x65, 0x02, 0x02, + 0x00, 0x65, 0x02, 0x00, 0xFF, 0x3B, 0xF7, 0x01, 0x58, 0x4F, 0x70, 0x00, 0x9C, 0x80, 0x45, 0x42, + 0xEA, 0x02, 0x58, 0x4F, 0x6B, 0x00, 0x9C, 0x80, 0xFF, 0xFF, 0xE5, 0x02, 0x58, 0x4F, 0x66, 0x00, + 0x9C, 0x80, 0xFF, 0xFF, 0x03, 0x02, 0x00, 0x65, 0x45, 0x42, 0xF8, 0x01, 0xFF, 0x3A, 0x29, 0x00, + 0x60, 0x47, 0xFF, 0xB5, 0x28, 0x44, 0xFF, 0xB4, 0x94, 0x80, 0xFF, 0xFF, 0xD4, 0x02, 0x60, 0x45, + 0x28, 0x47, 0x2A, 0x5F, 0x40, 0x48, 0x2A, 0x47, 0x2C, 0x5F, 0x40, 0x4A, 0x2C, 0x47, 0x65, 0x5F, + 0x40, 0x4C, 0x10, 0x64, 0x40, 0x42, 0x28, 0x45, 0x05, 0x00, 0x58, 0x4F, 0x47, 0x00, 0x94, 0x80, + 0x28, 0x45, 0x26, 0x02, 0x58, 0x4F, 0x42, 0x00, 0x94, 0x80, 0x2A, 0x45, 0x21, 0x02, 0x58, 0x4F, + 0x3D, 0x00, 0x94, 0x80, 0xFF, 0xFF, 0x1C, 0x02, 0x22, 0x44, 0x4C, 0x82, 0x2C, 0x45, 0x31, 0x03, + 0xEC, 0x01, 0x10, 0x65, 0x45, 0x42, 0x28, 0x45, 0x94, 0x80, 0x2A, 0x45, 0x21, 0x02, 0x58, 0x4F, + 0x2D, 0x00, 0x94, 0x80, 0x2C, 0x45, 0x1C, 0x02, 0x58, 0x4F, 0x28, 0x00, 0x94, 0x80, 0xFF, 0xFF, + 0x17, 0x02, 0x22, 0x44, 0x4C, 0x82, 0x28, 0x45, 0x1C, 0x03, 0x58, 0x4F, 0x1F, 0x00, 0xEC, 0x01, + 0x40, 0x4B, 0x28, 0x47, 0x40, 0x48, 0x2A, 0x47, 0x40, 0x4A, 0x2C, 0x47, 0x60, 0x45, 0x2A, 0x5E, + 0x40, 0x4C, 0x2A, 0x44, 0x28, 0x5E, 0x40, 0x4A, 0x28, 0x44, 0x65, 0x5E, 0x40, 0x48, 0x2B, 0x44, + 0x68, 0x65, 0xD7, 0x80, 0xFF, 0xFF, 0x17, 0x0E, 0x90, 0x01, 0x26, 0x46, 0xD0, 0x60, 0xB5, 0x78, + 0xFF, 0xFF, 0xB9, 0xFF, 0x26, 0x46, 0xD0, 0x60, 0xB5, 0x78, 0xFF, 0xFF, 0xC9, 0x81, 0xCB, 0x83, + 0x07, 0x1C, 0x01, 0x1D, 0x08, 0x00, 0x00, 0xF4, 0x01, 0xF2, 0xFF, 0xFF, 0xFF, 0xB4, 0xD8, 0x81, + 0x5A, 0xD2, 0x2F, 0x58, 0xFF, 0xFF, 0x26, 0x46, 0xD0, 0x60, 0x58, 0x4F, 0xD1, 0x78, 0xFF, 0xFF, + 0x01, 0x60, 0xFE, 0x61, 0x00, 0xF4, 0x12, 0x63, 0x6A, 0x64, 0x01, 0x65, 0xBD, 0xD0, 0xC8, 0x84, + 0x59, 0xD9, 0xFC, 0x02, 0x65, 0x40, 0x01, 0x3A, 0x05, 0x00, 0x00, 0xF4, 0x00, 0x65, 0x0E, 0x64, + 0x04, 0x63, 0xF4, 0x01, 0x2F, 0x60, 0x58, 0x64, 0x0E, 0x60, 0xD9, 0xFB, 0x1D, 0x60, 0xB0, 0x64, + 0xA0, 0xDF, 0x17, 0x60, 0xA8, 0xF3, 0x0E, 0x60, 0xDB, 0xFB, 0x0E, 0x60, 0xDB, 0xF3, 0x0E, 0x60, + 0xD8, 0xF3, 0x60, 0x45, 0xD4, 0x80, 0xFF, 0xFF, 0x03, 0x02, 0x1D, 0x60, 0x7B, 0x78, 0xFF, 0xFF, + 0x01, 0x64, 0x0E, 0x60, 0xD7, 0xFB, 0x0E, 0x60, 0xD9, 0xF3, 0x02, 0x60, 0x00, 0x61, 0x40, 0x48, + 0x40, 0x4A, 0xFA, 0xA4, 0xA0, 0xD3, 0x41, 0x4C, 0xDC, 0x84, 0xA8, 0x84, 0x0E, 0x60, 0xDC, 0xFB, + 0x28, 0x45, 0x44, 0x8B, 0x2B, 0xD3, 0x0E, 0x60, 0xDA, 0xFB, 0x28, 0x42, 0x4A, 0xD3, 0x2C, 0x45, + 0x44, 0x8C, 0x01, 0x64, 0x40, 0x48, 0x0E, 0x60, 0xDC, 0xF3, 0xFF, 0xFF, 0x36, 0x18, 0xCC, 0x84, + 0xA2, 0xDB, 0x0E, 0x60, 0xDA, 0xF3, 0x28, 0x45, 0xA4, 0x80, 0xFF, 0xFF, 0x08, 0x03, 0x60, 0xFE, + 0x2C, 0xD3, 0x2A, 0xD3, 0x60, 0x45, 0xD4, 0x80, 0x20, 0xFE, 0x01, 0x03, 0x12, 0x00, 0x28, 0x44, + 0xE0, 0x84, 0xFF, 0xFF, 0x02, 0x24, 0x01, 0x00, 0x06, 0x00, 0x2B, 0x44, 0x58, 0x8B, 0x2B, 0xD3, + 0x0E, 0x60, 0xDA, 0xFB, 0x01, 0x64, 0x40, 0x48, 0x2A, 0x44, 0x5C, 0x8A, 0x2C, 0x44, 0x5C, 0x8C, + 0xDA, 0x01, 0x00, 0x64, 0x0E, 0x60, 0xD7, 0xFB, 0x0E, 0x60, 0xD9, 0xF3, 0xFF, 0xFF, 0x60, 0x45, + 0xFA, 0xA4, 0xA0, 0xD3, 0xFF, 0xFF, 0xC4, 0x81, 0x65, 0x44, 0xFC, 0xA4, 0xA0, 0xD3, 0x06, 0xA1, + 0xDC, 0x84, 0xA8, 0x84, 0x44, 0x94, 0x0E, 0x60, 0xD9, 0xFB, 0x0E, 0x60, 0xD7, 0xF3, 0xFF, 0xFF, + 0x60, 0x40, 0x01, 0x26, 0x09, 0x00, 0x0E, 0x60, 0xD8, 0xF3, 0xFF, 0xFF, 0xDC, 0x84, 0xA2, 0xDB, + 0x94, 0x01, 0x1C, 0x60, 0xD7, 0x78, 0xFF, 0xFF, 0x1C, 0x60, 0xDB, 0x78, 0xFF, 0xFF, 0x00, 0x60, + 0x2E, 0x61, 0xB6, 0x60, 0x58, 0x4D, 0x25, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0x5F, 0xFB, 0x01, 0x60, + 0x05, 0x61, 0xB6, 0x60, 0x58, 0x4D, 0x25, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0x5E, 0xFB, 0x00, 0x60, + 0x02, 0x61, 0xB6, 0x60, 0x58, 0x4D, 0x25, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0x65, 0xFB, 0x1F, 0x60, + 0x6D, 0x64, 0x08, 0x60, 0x36, 0xFB, 0x2F, 0x58, 0xFF, 0xFF, 0x01, 0x64, 0xDB, 0xFB, 0xF1, 0xF3, + 0xFF, 0xFF, 0xFE, 0xB4, 0xF1, 0xFB, 0x10, 0x60, 0x30, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x00, 0x60, + 0x14, 0x63, 0x01, 0x60, 0xC2, 0x61, 0x2D, 0x60, 0x98, 0x64, 0x58, 0xD1, 0x59, 0xD9, 0xFD, 0x1F, + 0x00, 0x60, 0x8A, 0x63, 0x2D, 0x60, 0x0C, 0x61, 0x2D, 0x60, 0xB0, 0x64, 0x58, 0xD1, 0x59, 0xD9, + 0xFD, 0x1F, 0x16, 0x60, 0xAB, 0xF3, 0x19, 0x60, 0x48, 0xF1, 0xFF, 0xB5, 0x64, 0x40, 0x02, 0x2B, + 0x0B, 0x00, 0x60, 0x40, 0x03, 0x2E, 0x08, 0x00, 0x80, 0x2B, 0x06, 0x00, 0x32, 0x44, 0x00, 0x60, + 0x80, 0x63, 0x3C, 0x94, 0x40, 0x52, 0x05, 0x00, 0x32, 0x44, 0xFF, 0x60, 0x7F, 0x63, 0x2C, 0x94, + 0x40, 0x52, 0x65, 0x43, 0x16, 0x60, 0xAB, 0xFD, 0x16, 0x60, 0xC2, 0xF1, 0x66, 0x41, 0xA6, 0xF5, + 0x3A, 0xF2, 0x64, 0x40, 0x01, 0x36, 0x22, 0x64, 0x3A, 0xFA, 0x61, 0x46, 0x32, 0x45, 0x16, 0x60, + 0xCB, 0xF1, 0x10, 0x67, 0xB4, 0x85, 0x64, 0x40, 0x01, 0x2A, 0x94, 0x85, 0x45, 0x52, 0xFF, 0x60, + 0xE7, 0x65, 0x32, 0x41, 0xA5, 0x81, 0x16, 0x60, 0xC2, 0xF3, 0x08, 0x65, 0xFF, 0xA0, 0xFF, 0xFF, + 0x01, 0x03, 0x07, 0x00, 0x16, 0x60, 0xC4, 0xF3, 0xB5, 0x81, 0x10, 0x65, 0x60, 0x40, 0x01, 0x26, + 0xB5, 0x81, 0x41, 0x52, 0x19, 0x60, 0x48, 0xF3, 0x37, 0x60, 0xE6, 0x63, 0xF0, 0x84, 0xF0, 0x84, + 0xF0, 0x84, 0x03, 0xB5, 0xF0, 0x84, 0xF0, 0x84, 0x03, 0xB4, 0x65, 0x5C, 0xA3, 0xD9, 0x37, 0x60, + 0xE8, 0x63, 0x02, 0xA8, 0xA3, 0xDB, 0x15, 0x02, 0x00, 0x60, 0xC8, 0x64, 0x1B, 0x60, 0xF5, 0xFB, + 0x1B, 0x60, 0xF9, 0xFB, 0x07, 0x60, 0xD0, 0x64, 0x1B, 0x60, 0xF6, 0xFB, 0x1B, 0x60, 0xFA, 0xFB, + 0x01, 0x60, 0x90, 0x64, 0x1B, 0x60, 0xF7, 0xFB, 0x00, 0x60, 0x64, 0x64, 0x1B, 0x60, 0xF8, 0xFB, + 0x06, 0x00, 0x64, 0x64, 0x1B, 0x60, 0xF7, 0xFB, 0x64, 0x64, 0x1B, 0x60, 0xF8, 0xFB, 0x19, 0x60, + 0x48, 0xF1, 0x01, 0x64, 0x64, 0x40, 0x40, 0x2A, 0x02, 0x00, 0x1B, 0x60, 0xEE, 0xFB, 0x33, 0x60, + 0xBC, 0x61, 0x2D, 0x60, 0x0E, 0x64, 0x20, 0x63, 0x58, 0xD1, 0x59, 0xD9, 0xFD, 0x1F, 0xBA, 0xF1, + 0x7E, 0xF9, 0x1A, 0x63, 0x00, 0x60, 0xFC, 0x61, 0x00, 0x64, 0x59, 0xDB, 0xFE, 0x1F, 0x40, 0x40, + 0x01, 0x64, 0x85, 0xFB, 0x17, 0x60, 0x14, 0xF3, 0x35, 0x60, 0x36, 0x61, 0xFE, 0xA4, 0xE0, 0x84, + 0x04, 0x24, 0x0C, 0x00, 0xE0, 0x84, 0x41, 0x91, 0x1A, 0x60, 0x1F, 0xF3, 0xA1, 0xD1, 0x59, 0xD1, + 0xA0, 0x83, 0x1A, 0x60, 0x1B, 0xFD, 0xA0, 0x83, 0x1A, 0x60, 0x1A, 0xFD, 0xE4, 0xF3, 0x7D, 0xFB, + 0xCF, 0xF1, 0x10, 0x60, 0xEC, 0x63, 0x2F, 0x18, 0x60, 0x40, 0x01, 0x27, 0x12, 0x00, 0xCC, 0x84, + 0x06, 0xA3, 0xFD, 0x02, 0xA3, 0xD3, 0x10, 0x60, 0xF2, 0x63, 0x25, 0x1B, 0x11, 0x60, 0x44, 0x65, + 0xA3, 0xD3, 0x06, 0xA3, 0xD7, 0x80, 0x02, 0x1B, 0xFB, 0x04, 0x1D, 0x00, 0xF8, 0xA3, 0xA3, 0xD3, + 0x18, 0x00, 0x11, 0x60, 0x60, 0x63, 0x12, 0x60, 0x40, 0x65, 0xA3, 0xD1, 0x08, 0xA3, 0xD0, 0x80, + 0xD7, 0x80, 0x02, 0x03, 0xFA, 0x04, 0x0F, 0x00, 0xFA, 0xA3, 0xA3, 0xD3, 0x11, 0x60, 0x62, 0x63, + 0x0A, 0x1B, 0xA3, 0xD3, 0x08, 0xA3, 0xD7, 0x80, 0x02, 0x1B, 0xFB, 0x04, 0x04, 0x00, 0xF6, 0xA3, + 0xA3, 0xD3, 0xE4, 0xFB, 0x7D, 0xFB, 0x2E, 0x60, 0x2E, 0x64, 0x2D, 0x60, 0x8A, 0x63, 0xA0, 0xD1, + 0xA3, 0xD9, 0x64, 0x41, 0x58, 0xD1, 0x5B, 0xD9, 0x7D, 0xF3, 0x66, 0x45, 0xA6, 0xF5, 0x60, 0x40, + 0x01, 0x27, 0x08, 0x00, 0x91, 0xFA, 0x61, 0x44, 0xFD, 0x60, 0x58, 0x4E, 0xAC, 0x78, 0xFF, 0xFF, + 0x12, 0xFA, 0x07, 0x00, 0x11, 0xF8, 0x64, 0x44, 0xFD, 0x60, 0x58, 0x4E, 0xAC, 0x78, 0xFF, 0xFF, + 0x12, 0xFA, 0x65, 0x46, 0x46, 0x48, 0xE2, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x05, 0x3A, 0x03, 0x00, + 0x14, 0x60, 0x22, 0x66, 0x11, 0x00, 0x04, 0x3A, 0x03, 0x00, 0x14, 0x60, 0x16, 0x66, 0x0C, 0x00, + 0x03, 0x3A, 0x03, 0x00, 0x14, 0x60, 0x0A, 0x66, 0x07, 0x00, 0x02, 0x3A, 0x03, 0x00, 0x13, 0x60, + 0xFE, 0x66, 0x02, 0x00, 0x13, 0x60, 0xF2, 0x66, 0x60, 0xFE, 0xA6, 0xD3, 0xDE, 0x86, 0x13, 0x60, + 0xDC, 0xFB, 0xA6, 0xD3, 0xDE, 0x86, 0x28, 0x60, 0x29, 0x63, 0xA3, 0xDB, 0x28, 0x60, 0xA1, 0x63, + 0xA3, 0xDB, 0xA6, 0xD3, 0xDE, 0x86, 0x13, 0x60, 0xDB, 0xFB, 0xA6, 0xD3, 0xDE, 0x86, 0x27, 0x60, + 0xB9, 0x63, 0xA3, 0xDB, 0x20, 0xFE, 0xA6, 0xD3, 0xDA, 0x86, 0x60, 0x43, 0x1F, 0xB3, 0x63, 0x5C, + 0x1F, 0x60, 0x00, 0xB4, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xB0, 0x85, 0x14, 0x60, 0x12, 0xF3, + 0xFF, 0xFF, 0xFC, 0x60, 0x00, 0xB4, 0xB4, 0x84, 0xA2, 0xDB, 0x14, 0x60, 0x4E, 0xFB, 0x28, 0x60, + 0xC4, 0x63, 0xA3, 0xD3, 0xA6, 0xD1, 0xDE, 0x86, 0x80, 0x60, 0x7F, 0xB5, 0x64, 0x44, 0x60, 0x47, + 0xE8, 0x84, 0x7F, 0x60, 0x80, 0xB4, 0xB4, 0x84, 0xA3, 0xDB, 0x60, 0xFE, 0xA6, 0xD3, 0xDE, 0x86, + 0x13, 0x60, 0xDF, 0xFB, 0xA6, 0xD3, 0xDE, 0x86, 0x00, 0x60, 0xDF, 0xFB, 0xA6, 0xD3, 0xDE, 0x86, + 0x00, 0x60, 0xE0, 0xFB, 0xA6, 0xD3, 0x00, 0x60, 0xE1, 0xFB, 0x20, 0xFE, 0x28, 0x46, 0x19, 0x60, + 0x4D, 0xF1, 0x00, 0x60, 0xCF, 0xF3, 0x64, 0x40, 0x00, 0x3A, 0x0F, 0x00, 0x60, 0x40, 0x01, 0x36, + 0x05, 0x00, 0x02, 0x36, 0x03, 0x00, 0x07, 0x36, 0x01, 0x00, 0x07, 0x00, 0x10, 0x60, 0xF0, 0x64, + 0x00, 0x7C, 0x44, 0xA4, 0xA0, 0xD9, 0x06, 0xA4, 0xA0, 0xD9, 0x36, 0x40, 0x08, 0x3A, 0x03, 0x00, + 0xF3, 0x60, 0x0A, 0x78, 0xFF, 0xFF, 0x00, 0x63, 0x10, 0x60, 0x10, 0xFD, 0x10, 0x60, 0x30, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0A, 0x04, 0x40, 0x60, 0x00, 0x64, 0x08, 0x60, 0x19, 0xFB, + 0x1E, 0x60, 0x8D, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x7D, 0xF1, 0x13, 0x60, + 0x1A, 0xF9, 0x0C, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x07, 0x64, 0xCC, 0xFB, 0x20, 0x60, + 0x00, 0x64, 0x08, 0x60, 0x19, 0xFB, 0x1F, 0x60, 0x53, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x10, 0x60, 0x30, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xBE, 0xFE, 0x08, 0x60, 0x08, 0xF1, + 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0xC5, 0xFE, 0x08, 0x60, 0x15, 0xF1, + 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x00, 0x64, 0x08, 0x60, 0x18, 0xFB, + 0x5A, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, 0x30, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x02, 0x64, + 0x89, 0xFB, 0xFF, 0xFF, 0xC1, 0xFE, 0x08, 0x60, 0x30, 0xF1, 0x00, 0x60, 0xDF, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x01, 0x64, 0x13, 0x60, 0x21, 0xFB, 0xFF, 0xFF, 0x04, 0xFF, 0x08, 0x60, + 0x18, 0xF1, 0x00, 0x60, 0x08, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x00, 0x60, 0x08, 0x64, + 0x08, 0x60, 0x19, 0xFB, 0x1F, 0x60, 0x92, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x08, 0x60, 0x18, 0xF1, 0x7F, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x89, 0xF3, 0x00, 0x65, + 0xD4, 0x80, 0xFF, 0xFF, 0x0A, 0x03, 0x80, 0x60, 0x00, 0x64, 0x08, 0x60, 0x19, 0xFB, 0x1F, 0x60, + 0x92, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x95, 0xF3, 0xFF, 0xFF, 0x7F, 0xB4, + 0x95, 0xFB, 0xDE, 0xFE, 0x0A, 0x04, 0x20, 0x60, 0x00, 0x64, 0x08, 0x60, 0x19, 0xFB, 0x1F, 0x60, + 0xB7, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x26, 0x60, 0x34, 0x62, 0x06, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x00, 0x64, 0x08, 0x60, 0x18, 0xFB, 0x5A, 0xDB, 0xBE, 0xFE, + 0xDA, 0xFE, 0x25, 0x60, 0xDA, 0x61, 0x1F, 0x60, 0x58, 0x4E, 0xEA, 0x78, 0xFF, 0xFF, 0x25, 0x60, + 0xC8, 0x61, 0x1F, 0x60, 0x58, 0x4E, 0xEA, 0x78, 0xFF, 0xFF, 0x25, 0x60, 0xCE, 0x61, 0x1F, 0x60, + 0x58, 0x4E, 0xEA, 0x78, 0xFF, 0xFF, 0x25, 0x60, 0xEC, 0x61, 0x1F, 0x60, 0x58, 0x4E, 0xEA, 0x78, + 0xFF, 0xFF, 0x25, 0x60, 0xF2, 0x61, 0x1F, 0x60, 0x58, 0x4E, 0xEA, 0x78, 0xFF, 0xFF, 0x25, 0x60, + 0xFE, 0x61, 0x1F, 0x60, 0x58, 0x4E, 0xEA, 0x78, 0xFF, 0xFF, 0xC5, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0xA1, 0xD3, 0x0E, 0x57, 0x23, 0x00, 0x0E, 0xF2, 0x44, 0x4C, 0x80, 0xB0, 0x10, 0xB0, 0x0A, 0x03, + 0x00, 0x64, 0x13, 0x60, 0x0D, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0x13, 0x00, 0x12, 0x02, 0xF0, 0x37, 0x09, 0x00, 0x02, 0xF0, 0x09, 0x60, 0x08, 0x64, + 0xD0, 0x80, 0xA2, 0xFF, 0xAD, 0xF3, 0x02, 0x02, 0xCC, 0x84, 0xAD, 0xFB, 0x26, 0x60, 0x1A, 0x64, + 0x40, 0x4B, 0x34, 0x60, 0x58, 0x4D, 0x08, 0x78, 0xFF, 0xFF, 0x2C, 0x44, 0xAC, 0x86, 0x09, 0xF0, + 0xDA, 0x02, 0x37, 0x58, 0xFF, 0xFF, 0x2E, 0x58, 0xFF, 0xFF, 0x2E, 0x58, 0xFF, 0xFF, 0x23, 0x60, + 0x85, 0x64, 0x08, 0x60, 0x32, 0xFB, 0x1C, 0x60, 0xB6, 0x62, 0xA2, 0xDF, 0x06, 0xA2, 0x10, 0x60, + 0x88, 0x64, 0xA2, 0xDB, 0x06, 0x64, 0x5A, 0xDB, 0x5A, 0xDB, 0x1C, 0x60, 0xC2, 0x62, 0xA2, 0xDF, + 0x06, 0xA2, 0x10, 0x60, 0x8C, 0x64, 0xA2, 0xDB, 0x06, 0x64, 0x5A, 0xDB, 0x5A, 0xDB, 0x1C, 0x60, + 0xCE, 0x62, 0xA2, 0xDF, 0x06, 0xA2, 0x10, 0x60, 0x90, 0x64, 0xA2, 0xDB, 0x06, 0x64, 0x5A, 0xDB, + 0x5A, 0xDB, 0xBD, 0xF1, 0x0E, 0x60, 0x69, 0xF9, 0x24, 0x60, 0xC1, 0x64, 0x08, 0x60, 0x43, 0xFB, + 0x24, 0x60, 0xCA, 0x64, 0x08, 0x60, 0x45, 0xFB, 0x24, 0x60, 0xD3, 0x64, 0x08, 0x60, 0x47, 0xFB, + 0x00, 0x60, 0x3A, 0x61, 0xB6, 0x60, 0x58, 0x4D, 0x22, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0x62, 0xFB, + 0x04, 0x64, 0x03, 0xFA, 0xA6, 0xF3, 0x07, 0xFA, 0x00, 0x64, 0x3E, 0xFA, 0x3F, 0xFA, 0x00, 0x60, + 0x02, 0x64, 0x08, 0x60, 0x0D, 0xFB, 0x20, 0x60, 0x63, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x10, 0x60, 0x18, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x03, 0x64, 0x69, 0xFB, 0x0F, 0x4E, + 0xEA, 0x60, 0x58, 0x4F, 0x34, 0x78, 0xFF, 0xFF, 0x0E, 0x4F, 0x00, 0x64, 0x6B, 0xFB, 0x62, 0xF5, + 0xEA, 0xF3, 0x2F, 0xFA, 0xEB, 0xF3, 0x30, 0xFA, 0xEC, 0xF3, 0x31, 0xFA, 0x7F, 0xF3, 0x2C, 0xFA, + 0x32, 0xFA, 0x80, 0xF3, 0x2D, 0xFA, 0x33, 0xFA, 0x81, 0xF3, 0x2E, 0xFA, 0x34, 0xFA, 0xB9, 0xF3, + 0x19, 0xFA, 0x06, 0x60, 0x80, 0x64, 0x0E, 0xFA, 0xF7, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, + 0x08, 0x60, 0x08, 0xF1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x08, 0x60, + 0x0C, 0xF1, 0xFF, 0x60, 0x8F, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0xBE, 0xF1, 0x0E, 0x60, 0x63, 0xF9, + 0x1C, 0x60, 0xC2, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, + 0x00, 0x64, 0x6B, 0xFB, 0x00, 0x60, 0x74, 0x64, 0x08, 0x60, 0x0D, 0xFB, 0x20, 0x60, 0xAE, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x0C, 0xF1, 0x00, 0x60, 0x04, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x23, 0x60, 0x85, 0x78, 0xFF, 0xFF, + 0x00, 0x60, 0x40, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xE2, 0x01, + 0x00, 0x60, 0x20, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x11, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x20, 0x40, + 0x50, 0x27, 0xD8, 0x01, 0xAC, 0xF3, 0xFF, 0xFF, 0xFE, 0xA0, 0xFF, 0xFF, 0x0F, 0x06, 0x6B, 0xF3, + 0xFF, 0xFF, 0xEC, 0xA0, 0xDC, 0x84, 0x01, 0x05, 0xA2, 0xDB, 0xCC, 0x01, 0x00, 0x60, 0x10, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0xCF, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x01, 0x00, 0xC3, 0x01, 0x01, 0x64, + 0x19, 0x60, 0xF3, 0xFB, 0xDF, 0xF3, 0x29, 0x45, 0xD4, 0x80, 0x6B, 0xF3, 0x03, 0x04, 0x21, 0x60, + 0x28, 0x78, 0xFF, 0xFF, 0xEC, 0xA0, 0x00, 0x64, 0x04, 0x04, 0x40, 0x49, 0x21, 0x60, 0x28, 0x78, + 0xFF, 0xFF, 0x00, 0x60, 0x64, 0x64, 0x08, 0x60, 0x0D, 0xFB, 0x20, 0x60, 0xFD, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x0C, 0xF1, 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, + 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x23, 0x60, 0x85, 0x78, 0xFF, 0xFF, 0x00, 0x60, + 0x40, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xD0, 0x01, 0x00, 0x60, + 0x20, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0xE5, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x20, 0x40, 0x50, 0x27, + 0xE0, 0x01, 0xAC, 0xF3, 0xFF, 0xFF, 0xFE, 0xA0, 0xFF, 0xFF, 0x07, 0x06, 0x6B, 0xF3, 0xFF, 0xFF, + 0xEC, 0xA0, 0xDC, 0x84, 0x01, 0x05, 0xA2, 0xDB, 0xBA, 0x01, 0xB9, 0x01, 0x33, 0x60, 0xE6, 0x65, + 0xA5, 0xDF, 0xBF, 0xF1, 0x0E, 0x60, 0x63, 0xF9, 0xE0, 0xF3, 0x29, 0x45, 0x03, 0xA4, 0xD4, 0x80, + 0x01, 0x63, 0x01, 0x05, 0x00, 0x63, 0x53, 0xFD, 0x7D, 0xF3, 0x01, 0x60, 0x00, 0x65, 0xA4, 0x80, + 0x24, 0x44, 0xFE, 0xB4, 0x01, 0x03, 0x01, 0xBC, 0x40, 0x44, 0x21, 0x60, 0x45, 0x64, 0x6A, 0xFB, + 0x23, 0x60, 0xF6, 0x78, 0xFF, 0xFF, 0x1C, 0x60, 0xCE, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x08, 0x60, 0x0C, 0xF1, 0xFF, 0x60, 0xDF, 0x64, 0xA0, 0x84, + 0xA2, 0xDB, 0x86, 0xF1, 0x1B, 0x60, 0xB2, 0x63, 0xD3, 0x80, 0x67, 0xFD, 0x43, 0x03, 0x67, 0xF3, + 0xE1, 0xF1, 0x60, 0x43, 0x29, 0x44, 0xA3, 0xD3, 0xC0, 0x85, 0xD4, 0x80, 0x5B, 0xD3, 0x3A, 0x06, + 0x60, 0x43, 0x08, 0xA3, 0xBE, 0xD3, 0x81, 0xF1, 0xA3, 0xD3, 0xD0, 0x80, 0x80, 0xF1, 0x05, 0x02, + 0xBF, 0xD3, 0xD0, 0x80, 0x7F, 0xF1, 0x01, 0x02, 0xD0, 0x80, 0xF8, 0xA3, 0x28, 0x02, 0x21, 0x60, + 0x77, 0x64, 0x6A, 0xFB, 0x23, 0x60, 0xB4, 0x78, 0xFF, 0xFF, 0x01, 0xB0, 0x82, 0xF3, 0x22, 0x03, + 0x62, 0xF5, 0x48, 0x7E, 0x2A, 0xFA, 0x25, 0x60, 0xCE, 0x64, 0x13, 0x60, 0x0D, 0xFB, 0x66, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x00, 0x60, 0x01, 0x64, + 0x08, 0x60, 0x0D, 0xFB, 0x21, 0x60, 0x92, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x08, 0x60, 0x0C, 0xF1, 0xFF, 0x60, 0xFE, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x03, 0x00, 0x23, 0x60, + 0x7A, 0x78, 0xFF, 0xFF, 0x6B, 0xF3, 0xFF, 0xFF, 0xEC, 0xA0, 0x00, 0x64, 0x02, 0x04, 0x40, 0x49, + 0x15, 0x00, 0xDF, 0xF3, 0x29, 0x45, 0xD4, 0x80, 0xFF, 0xFF, 0x0B, 0x07, 0x1C, 0x60, 0xC2, 0x64, + 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x20, 0x60, 0x86, 0x78, + 0xFF, 0xFF, 0xE0, 0xF3, 0x29, 0x45, 0xD4, 0x80, 0xFF, 0xFF, 0x16, 0x06, 0x04, 0x65, 0xF1, 0x60, + 0x58, 0x4E, 0xC3, 0x78, 0xFF, 0xFF, 0x05, 0x64, 0xDB, 0xFB, 0xF1, 0xF3, 0xFF, 0xFF, 0x01, 0xBC, + 0xF1, 0xFB, 0x1C, 0x60, 0xC2, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0x22, 0x60, 0x1B, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x74, 0x64, 0x08, 0x60, 0x0D, 0xFB, + 0x21, 0x60, 0xD8, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x0C, 0xF1, + 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x23, 0x60, + 0x85, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x40, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0xB0, 0x01, 0x00, 0x60, 0x20, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x15, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0x20, 0x40, 0x50, 0x27, 0xA6, 0x01, 0xAC, 0xF3, 0x6B, 0xF3, 0xFE, 0xA0, 0xEC, 0xA0, + 0x0A, 0x06, 0x03, 0x04, 0x00, 0x64, 0x55, 0xFB, 0x40, 0x49, 0x6B, 0xF3, 0xFF, 0xFF, 0xEC, 0xA0, + 0xDC, 0x84, 0x01, 0x05, 0xA2, 0xDB, 0x96, 0x01, 0x00, 0x60, 0x10, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x0D, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x1C, 0x60, 0xCE, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x21, 0x60, 0x28, 0x78, 0xFF, 0xFF, 0x21, 0x60, 0x9C, 0x78, + 0xFF, 0xFF, 0x7D, 0xF3, 0x01, 0x60, 0x00, 0x65, 0xA4, 0x80, 0x24, 0x44, 0xFE, 0xB4, 0x01, 0x03, + 0x01, 0xBC, 0x02, 0xB0, 0xFB, 0xB4, 0x01, 0x03, 0x04, 0xBC, 0x40, 0x44, 0xC0, 0xF1, 0x0E, 0x60, + 0x63, 0xF9, 0xCF, 0xF3, 0x20, 0x60, 0x20, 0x65, 0x30, 0x1B, 0xA5, 0xD3, 0x24, 0x40, 0x01, 0x26, + 0x16, 0x00, 0x60, 0x40, 0x20, 0x26, 0x29, 0x00, 0x01, 0xBC, 0xA5, 0xDB, 0x08, 0x60, 0x1E, 0xF1, + 0x00, 0x60, 0x20, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x10, 0x60, 0x00, 0x64, 0x08, 0x60, + 0x0D, 0xFB, 0x22, 0x60, 0x5F, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x60, 0x40, + 0x10, 0x26, 0x13, 0x00, 0x01, 0xBC, 0xA5, 0xDB, 0x08, 0x60, 0x1E, 0xF1, 0x00, 0x60, 0x40, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x10, 0x60, 0x00, 0x64, 0x08, 0x60, 0x0D, 0xFB, 0x22, 0x60, + 0x5F, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0D, 0x64, 0x53, 0xFB, 0x22, 0x60, + 0x67, 0x64, 0x6A, 0xFB, 0x23, 0x60, 0xF6, 0x78, 0xFF, 0xFF, 0x1C, 0x60, 0xCE, 0x64, 0x13, 0x60, + 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x08, 0x60, 0x0C, 0xF1, 0xFF, 0x60, + 0xDF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x86, 0xF1, 0x1B, 0x60, 0xB2, 0x63, 0xD3, 0x80, 0x67, 0xFD, + 0x07, 0x02, 0x24, 0x44, 0x04, 0xB0, 0xFF, 0xFF, 0x36, 0x03, 0x05, 0xAC, 0x40, 0x44, 0xA6, 0x01, + 0x67, 0xF3, 0x29, 0x41, 0xA0, 0xD1, 0x58, 0xD3, 0xD1, 0x80, 0x64, 0x45, 0x60, 0x43, 0x2B, 0x05, + 0x08, 0xA3, 0xBE, 0xD3, 0x81, 0xF1, 0xA3, 0xD3, 0xD0, 0x80, 0x80, 0xF1, 0x05, 0x02, 0xBF, 0xD3, + 0xD0, 0x80, 0x7F, 0xF1, 0x01, 0x02, 0xD0, 0x80, 0xF8, 0xA3, 0x07, 0x02, 0x45, 0x49, 0x22, 0x60, + 0xCD, 0x64, 0x6A, 0xFB, 0x23, 0x60, 0xB4, 0x78, 0xFF, 0xFF, 0x05, 0x65, 0xF1, 0x60, 0x58, 0x4E, + 0xC3, 0x78, 0xFF, 0xFF, 0x04, 0x64, 0xDB, 0xFB, 0xF1, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, 0xF1, 0xFB, + 0x23, 0x60, 0x7A, 0x78, 0xFF, 0xFF, 0x67, 0xF3, 0x86, 0xF1, 0x04, 0xA4, 0xD0, 0x80, 0xFF, 0xFF, + 0x02, 0x03, 0x67, 0xFB, 0xCD, 0x01, 0x6B, 0xF3, 0xFF, 0xFF, 0xEC, 0xA0, 0xFF, 0xFF, 0x01, 0x04, + 0x75, 0x00, 0xE0, 0xF3, 0x29, 0x45, 0xD4, 0x80, 0xFF, 0xFF, 0x70, 0x05, 0x7D, 0xF3, 0xFF, 0xFF, + 0x60, 0x40, 0x01, 0x27, 0x08, 0x00, 0x22, 0x60, 0xCD, 0x63, 0x6A, 0xFD, 0x1C, 0x60, 0x78, 0x63, + 0x23, 0x60, 0xB4, 0x78, 0xFF, 0xFF, 0x1C, 0x60, 0xC2, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x05, 0x65, 0xF1, 0x60, 0x58, 0x4E, 0xC3, 0x78, 0xFF, 0xFF, + 0x20, 0x60, 0x14, 0x61, 0xA1, 0xDF, 0x04, 0x64, 0xDB, 0xFB, 0xF1, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, + 0xF1, 0xFB, 0x82, 0xF3, 0x62, 0xF5, 0x48, 0x7E, 0x2A, 0xFA, 0x02, 0x60, 0x00, 0x65, 0x20, 0x44, + 0x34, 0x80, 0x25, 0x60, 0xCE, 0x64, 0x13, 0x60, 0x0D, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x00, 0x60, 0x01, 0x64, 0x08, 0x60, 0x0D, 0xFB, + 0x23, 0x60, 0x00, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x0C, 0xF1, + 0xFF, 0x60, 0xFE, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x00, 0x60, 0x32, 0x64, 0x0E, 0x60, 0x63, 0xFB, + 0x1C, 0x60, 0xC2, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, + 0x00, 0x60, 0x10, 0x64, 0x08, 0x60, 0x0D, 0xFB, 0x23, 0x60, 0x1C, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x0C, 0xF1, 0xFF, 0x60, 0xEF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, + 0xFD, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x08, 0x60, 0x08, 0xF1, 0x80, 0x60, 0x00, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x20, 0x60, 0x86, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x74, 0x64, + 0x08, 0x60, 0x0D, 0xFB, 0x23, 0x60, 0x3A, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x08, 0x60, 0x0C, 0xF1, 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0x23, 0x60, 0x85, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x40, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x67, 0x01, 0x00, 0x60, 0x20, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x15, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x20, 0x40, 0x50, 0x27, 0xE0, 0x01, 0xAC, 0xF3, 0x6B, 0xF3, + 0xFE, 0xA0, 0xEC, 0xA0, 0x0A, 0x06, 0x03, 0x04, 0x00, 0x64, 0x55, 0xFB, 0x40, 0x49, 0x6B, 0xF3, + 0xFF, 0xFF, 0xEC, 0xA0, 0xDC, 0x84, 0x01, 0x05, 0xA2, 0xDB, 0x4D, 0x01, 0x00, 0x60, 0x10, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0xCB, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x1C, 0x60, 0xCE, 0x64, 0x13, 0x60, + 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x22, 0x60, 0x1B, 0x78, 0xFF, 0xFF, + 0x08, 0x60, 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, 0x08, 0x60, 0x15, 0xF1, 0x00, 0x60, 0x20, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x1C, 0x60, 0xB6, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x1C, 0x60, 0xC2, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x1C, 0x60, 0xCE, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x00, 0x64, 0x08, 0x60, 0x0C, 0xFB, 0x5A, 0xDB, 0x00, 0x64, + 0x69, 0xFB, 0x08, 0x60, 0x08, 0xF1, 0x02, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x00, 0x60, 0x02, 0x64, 0x08, 0x60, 0x0D, 0xFB, 0x20, 0x60, 0x63, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0xA3, 0xD3, 0x7D, 0xF1, 0x7C, 0xFB, 0xD0, 0x80, 0x00, 0x64, 0x39, 0x03, + 0x08, 0x60, 0x0C, 0xF1, 0xBF, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0xDE, 0xFE, 0x0A, 0x04, + 0x40, 0x60, 0x00, 0x64, 0x08, 0x60, 0x0D, 0xFB, 0x23, 0x60, 0xBA, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x0C, 0xF1, 0xDF, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, + 0x7C, 0xF1, 0x7D, 0xF9, 0x13, 0x60, 0x1A, 0xF9, 0x0E, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, + 0x20, 0x60, 0x00, 0x64, 0x08, 0x60, 0x0D, 0xFB, 0x23, 0x60, 0xE4, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0xBE, 0xFE, 0x08, 0x60, 0x0C, 0xF1, 0xDF, 0x60, 0xFF, 0x64, 0xA0, 0x84, + 0xA2, 0xDB, 0x08, 0x60, 0x08, 0xF1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x01, 0x64, 0x6A, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0x02, 0x60, 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, + 0x08, 0x60, 0x0C, 0xF1, 0x7F, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x20, 0x40, 0x51, 0x23, + 0x0A, 0x00, 0x80, 0x60, 0x00, 0x64, 0x08, 0x60, 0x0D, 0xFB, 0x23, 0x60, 0xFA, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x0C, 0xF1, 0x7F, 0x60, 0xFF, 0x61, 0xA1, 0x84, + 0x5A, 0xD1, 0x4A, 0xDB, 0xA1, 0x84, 0x5A, 0xDB, 0x02, 0x64, 0x8A, 0xFB, 0xFF, 0xFF, 0xC1, 0xFE, + 0x8A, 0xF3, 0x00, 0x65, 0xD4, 0x80, 0xFF, 0xFF, 0x10, 0x03, 0x08, 0x60, 0x0C, 0xF1, 0x7F, 0x60, + 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x80, 0x60, 0x00, 0x64, 0x08, 0x60, 0x0D, 0xFB, 0x24, 0x60, + 0x16, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x33, 0x60, 0xBE, 0x64, 0x54, 0xFB, + 0x08, 0x60, 0x0C, 0xF1, 0xEF, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x24, 0x44, 0x01, 0xB0, + 0xFF, 0xFF, 0x08, 0x02, 0x08, 0x60, 0x12, 0xF1, 0x00, 0x60, 0x10, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0x07, 0x00, 0x08, 0x60, 0x12, 0xF1, 0x00, 0x60, 0x20, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0x10, 0x60, 0x00, 0x64, 0x08, 0x60, 0x0D, 0xFB, 0x24, 0x60, 0x55, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x1C, 0x60, 0xC2, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x08, 0x60, 0x0C, 0xF1, 0xEF, 0x60, 0xEF, 0x64, 0xA0, 0x84, + 0xA2, 0xDB, 0x01, 0x64, 0x8A, 0xFB, 0x6B, 0xF3, 0x00, 0x60, 0x95, 0xF3, 0xEC, 0xA0, 0x40, 0xBC, + 0x06, 0x04, 0xA2, 0xDB, 0x69, 0xF1, 0xFF, 0x60, 0xFB, 0x64, 0xA0, 0x84, 0x69, 0xFB, 0xFD, 0x60, + 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x08, 0x60, 0x08, 0xF1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0xC1, 0xFE, 0x6A, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0xF1, 0x28, 0x44, + 0xD0, 0x84, 0x03, 0xA4, 0x03, 0x0E, 0xE8, 0x84, 0xE8, 0x84, 0x04, 0x00, 0xFA, 0xA4, 0xE8, 0x84, + 0xE8, 0x87, 0xC0, 0xBF, 0xC0, 0x84, 0xA2, 0xDB, 0x2E, 0x58, 0xFF, 0xFF, 0x56, 0xF1, 0x28, 0x44, + 0xD0, 0x84, 0x1F, 0xA4, 0x06, 0x0E, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, + 0x07, 0x00, 0xC2, 0xA4, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x87, 0xF8, 0xBF, + 0xC0, 0x84, 0x5B, 0xF1, 0x56, 0xFB, 0xD0, 0x80, 0xFF, 0xFF, 0x01, 0x05, 0x64, 0x44, 0x52, 0xFB, + 0x2E, 0x58, 0xFF, 0xFF, 0x52, 0xF1, 0x2F, 0x67, 0xD0, 0x80, 0x60, 0x45, 0x02, 0x28, 0x64, 0x45, + 0x55, 0xF1, 0x8B, 0x67, 0xD0, 0x80, 0x60, 0x41, 0x02, 0x24, 0x64, 0x41, 0xD5, 0x84, 0x80, 0x65, + 0xC4, 0x87, 0x01, 0x05, 0x00, 0x64, 0xFF, 0xB4, 0x40, 0x49, 0x2E, 0x58, 0xFF, 0xFF, 0x08, 0x60, + 0x0C, 0xF1, 0x00, 0x60, 0x08, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x08, 0x60, 0x0C, 0xF1, 0x00, 0x60, 0x10, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x08, 0x60, 0x0C, 0xF1, 0x00, 0x60, 0x20, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x08, 0x60, 0x1B, 0xF1, 0x00, 0x60, 0x40, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x26, 0x46, 0x27, 0xF2, 0x70, 0x63, 0x60, 0x40, 0x0A, 0x36, 0x10, 0x00, 0x14, 0x36, + 0x14, 0x00, 0x37, 0x36, 0x0E, 0x00, 0x6E, 0x36, 0x0E, 0x00, 0x06, 0x36, 0x04, 0x00, 0x09, 0x36, + 0x04, 0x00, 0x18, 0x63, 0x0A, 0x00, 0x30, 0x63, 0x08, 0x00, 0x26, 0x63, 0x06, 0x00, 0xD0, 0x63, + 0x04, 0x00, 0x33, 0x63, 0x02, 0x00, 0x21, 0x63, 0x00, 0x00, 0x10, 0x60, 0x0E, 0xFD, 0x26, 0x46, + 0x3F, 0xF2, 0x87, 0xF0, 0x00, 0xF4, 0x45, 0x43, 0x03, 0x4B, 0x60, 0x43, 0xF4, 0xA3, 0x00, 0x60, + 0x1D, 0x61, 0x00, 0x60, 0x01, 0x65, 0x01, 0x60, 0xFF, 0x64, 0x40, 0x4C, 0xFD, 0x60, 0x58, 0x4E, + 0x7A, 0x78, 0xFF, 0xFF, 0x00, 0xBB, 0xFF, 0xFF, 0x00, 0x02, 0x00, 0x64, 0x40, 0x4A, 0x60, 0xFE, + 0x02, 0x60, 0x00, 0x63, 0xBD, 0xD3, 0xBD, 0xD3, 0x60, 0x41, 0xFE, 0x60, 0x58, 0x4E, 0x2C, 0x78, + 0xFF, 0xFF, 0x20, 0xFE, 0x26, 0x46, 0x3F, 0xF2, 0x00, 0xF4, 0x60, 0x43, 0xF4, 0xA3, 0x00, 0x60, + 0x1D, 0x61, 0x00, 0x60, 0x32, 0x65, 0x01, 0x60, 0xFF, 0x64, 0x40, 0x4C, 0xFD, 0x60, 0x58, 0x4E, + 0x7A, 0x78, 0xFF, 0xFF, 0x00, 0xBB, 0xFF, 0xFF, 0x0B, 0x03, 0x60, 0xFE, 0x02, 0x60, 0x00, 0x63, + 0xBD, 0xD3, 0xBD, 0xD3, 0x60, 0x41, 0xFE, 0x60, 0x58, 0x4E, 0x2C, 0x78, 0xFF, 0xFF, 0x20, 0xFE, + 0x2A, 0x44, 0xFC, 0x60, 0x58, 0x4E, 0x34, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x3F, 0xF2, 0x01, 0x60, + 0x00, 0x65, 0xF4, 0xA4, 0xD4, 0x80, 0x60, 0x41, 0x02, 0x24, 0x65, 0x41, 0x41, 0x48, 0x00, 0xF4, + 0x1E, 0x65, 0x02, 0x60, 0x00, 0x63, 0xA5, 0xD0, 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, + 0x04, 0x65, 0x64, 0x44, 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, 0x05, 0x03, 0x64, 0x47, 0x00, 0x7F, + 0xCD, 0x81, 0xBD, 0xDB, 0xF0, 0x02, 0x02, 0x60, 0x00, 0x63, 0x28, 0x41, 0xBD, 0xD3, 0xBD, 0xD1, + 0xFD, 0xA0, 0xFE, 0xA1, 0x07, 0x03, 0x09, 0x06, 0x64, 0x44, 0xE0, 0x85, 0xD1, 0x81, 0xC7, 0x83, + 0xF5, 0x07, 0x03, 0x00, 0xA3, 0xD3, 0x0E, 0x60, 0x3C, 0xFB, 0x31, 0x40, 0x06, 0x26, 0x57, 0x00, + 0x00, 0x64, 0x6F, 0xFB, 0x02, 0x60, 0x00, 0x63, 0x28, 0x41, 0xBD, 0xD3, 0xBD, 0xD1, 0xFC, 0xA0, + 0xFB, 0xA0, 0x09, 0x03, 0x28, 0x03, 0x64, 0x44, 0xE0, 0x85, 0xC7, 0x83, 0xD1, 0x81, 0xFE, 0xA1, + 0x46, 0x06, 0xF3, 0x07, 0x44, 0x00, 0xBD, 0xD3, 0xBD, 0xD3, 0x00, 0xB8, 0x6F, 0xFB, 0x6E, 0xFB, + 0xBD, 0xD3, 0x3D, 0x02, 0xA3, 0xD3, 0x60, 0x45, 0x60, 0x47, 0xB4, 0x84, 0x60, 0x41, 0x3F, 0xB5, + 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0x71, 0xFB, 0x65, 0x47, + 0xE0, 0x84, 0xE0, 0x84, 0x70, 0xFB, 0x64, 0x44, 0xE0, 0x85, 0xFA, 0xA3, 0xC7, 0x83, 0x61, 0x44, + 0x0E, 0x60, 0x38, 0xFB, 0xD2, 0x01, 0xBD, 0xD3, 0xA3, 0xD3, 0x00, 0xB8, 0x6D, 0xFB, 0x73, 0xFB, + 0x1E, 0x02, 0x85, 0xF1, 0x6F, 0xF3, 0x6C, 0xF9, 0x04, 0x65, 0x60, 0x40, 0x00, 0x3A, 0x06, 0x65, + 0x31, 0x44, 0xB4, 0x84, 0x40, 0x51, 0x02, 0x2A, 0x0B, 0x00, 0x08, 0xBC, 0x40, 0x51, 0x71, 0xF3, + 0x70, 0xF1, 0x00, 0xB8, 0x64, 0x45, 0x01, 0x03, 0x67, 0x45, 0x65, 0x50, 0xCC, 0x84, 0x72, 0xFB, + 0x08, 0x60, 0x15, 0xF1, 0x01, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x08, 0x60, + 0x16, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x2A, 0x3F, 0x00, 0x01, 0x64, 0x10, 0x60, 0x0A, 0xFB, + 0x26, 0x60, 0x58, 0x4E, 0x65, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x00, 0xF4, 0x0D, 0xF2, 0x7E, 0xFB, + 0x00, 0x64, 0x84, 0xFB, 0x26, 0x46, 0x3F, 0xF2, 0x00, 0xF4, 0x60, 0x43, 0xF4, 0xA3, 0x00, 0x60, + 0x1D, 0x61, 0x00, 0x60, 0x07, 0x65, 0x01, 0x60, 0xFF, 0x64, 0x40, 0x4C, 0xFD, 0x60, 0x58, 0x4E, + 0x7A, 0x78, 0xFF, 0xFF, 0x00, 0xBB, 0xFF, 0xFF, 0x14, 0x03, 0x02, 0x60, 0x00, 0x65, 0xA5, 0xD3, + 0x1C, 0x60, 0xE6, 0x63, 0xFF, 0xB4, 0x01, 0xA4, 0x60, 0x41, 0xA5, 0xD1, 0xDA, 0x85, 0x64, 0x44, + 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, 0x05, 0x03, 0x64, 0x47, 0x00, 0x7F, 0xCD, 0x81, 0xBD, 0xDB, + 0xF4, 0x02, 0x08, 0x60, 0x15, 0xF1, 0x00, 0x60, 0x80, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x32, 0x00, 0x27, 0x60, 0x57, 0x78, 0xFF, 0xFF, 0xDB, 0xF3, 0xFF, 0xFF, 0x03, 0xA8, 0x02, 0xA8, + 0x02, 0x03, 0x3E, 0x02, 0xF6, 0x01, 0x08, 0x60, 0x15, 0xF1, 0xFF, 0x60, 0xFB, 0x64, 0xA0, 0x84, + 0xA2, 0xDB, 0x1C, 0x60, 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0x26, 0x46, 0x10, 0x60, 0x0E, 0xF3, 0x25, 0xF2, 0x60, 0x45, 0x24, 0xF0, 0x00, 0xF4, + 0x64, 0x43, 0xC7, 0x83, 0x60, 0x41, 0x02, 0x24, 0x01, 0xA1, 0x0A, 0xF0, 0x09, 0xF2, 0xD1, 0x80, + 0xFF, 0xFF, 0x09, 0x07, 0x04, 0x04, 0x63, 0x45, 0xD4, 0x80, 0xFF, 0xFF, 0x04, 0x06, 0x26, 0x60, + 0x58, 0x4E, 0x65, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x26, 0xF0, 0xFF, 0x67, 0x20, 0x88, 0x64, 0x5F, + 0x40, 0x4A, 0x24, 0x60, 0x58, 0x4E, 0x80, 0x78, 0xFF, 0xFF, 0x0A, 0x48, 0x24, 0x60, 0x58, 0x4E, + 0x90, 0x78, 0xFF, 0xFF, 0x24, 0x60, 0x58, 0x4E, 0xAC, 0x78, 0xFF, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, + 0x08, 0x60, 0x0D, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x40, 0x22, 0xB3, 0x01, 0x00, 0x60, 0x95, 0xF3, + 0xFF, 0xFF, 0xBF, 0xB4, 0xA2, 0xDB, 0x10, 0x60, 0x0E, 0xF3, 0x26, 0x46, 0x60, 0x45, 0x20, 0x60, + 0x04, 0x63, 0x00, 0xF4, 0x09, 0xF2, 0xBD, 0xDB, 0xFF, 0xFF, 0x0A, 0xF2, 0xBD, 0xDB, 0x0B, 0xF2, + 0xFF, 0xFF, 0xBD, 0xDB, 0x0C, 0xF2, 0xA3, 0xDB, 0xFA, 0xA3, 0x26, 0x46, 0xA3, 0xD3, 0x24, 0xF0, + 0x00, 0x61, 0xD0, 0x84, 0xF1, 0x81, 0xD4, 0x84, 0xF1, 0x81, 0xBD, 0xDB, 0xA3, 0xD3, 0x03, 0xB1, + 0x03, 0xA9, 0x25, 0xF0, 0x42, 0xFE, 0x05, 0x03, 0xFD, 0xA1, 0xCC, 0x84, 0x01, 0x02, 0xCC, 0x84, + 0x00, 0x61, 0xF1, 0x81, 0xD0, 0x84, 0xF1, 0x81, 0xBD, 0xDB, 0xA3, 0xD3, 0x03, 0xB1, 0x03, 0xA9, + 0x28, 0xF0, 0x42, 0xFE, 0x01, 0x03, 0xCC, 0x84, 0xF1, 0x81, 0xD0, 0x84, 0xF1, 0x81, 0xBD, 0xDB, + 0xA3, 0xD3, 0x03, 0xB1, 0x03, 0xA9, 0x29, 0xF0, 0x01, 0x03, 0xCC, 0x84, 0xD0, 0x84, 0xA3, 0xDB, + 0x10, 0x60, 0x0A, 0xF3, 0xFF, 0xFF, 0x02, 0xA8, 0xFF, 0xFF, 0x02, 0x02, 0x2E, 0x58, 0xFF, 0xFF, + 0xF5, 0xFE, 0x10, 0x60, 0x02, 0xF1, 0x06, 0xA2, 0xA2, 0xD3, 0x64, 0x45, 0x60, 0x40, 0x80, 0x2B, + 0x03, 0x00, 0xFF, 0x60, 0xFF, 0x64, 0x94, 0x85, 0x00, 0x60, 0x96, 0x64, 0xD4, 0x80, 0xFF, 0xFF, + 0x0A, 0x06, 0x10, 0x60, 0x0A, 0xF3, 0x69, 0xF3, 0x00, 0xA8, 0x04, 0xB0, 0x04, 0x02, 0x03, 0x03, + 0x27, 0x60, 0x33, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x00, 0xF4, 0x09, 0xF2, 0x5A, 0xD2, 0x40, 0x48, + 0x40, 0x4A, 0x5A, 0xD2, 0x5A, 0xD2, 0x40, 0x4C, 0x60, 0x41, 0x5A, 0xD0, 0x7E, 0xF9, 0x40, 0x63, + 0xAD, 0x80, 0xF0, 0xA3, 0x09, 0x02, 0x3C, 0x03, 0x2C, 0x41, 0x2A, 0x44, 0x40, 0x4C, 0x28, 0x44, + 0x40, 0x4A, 0x00, 0x64, 0x40, 0x48, 0xF4, 0x01, 0xD1, 0x80, 0x01, 0x02, 0x31, 0x04, 0x10, 0xA3, + 0x80, 0x60, 0x00, 0x65, 0xA5, 0x80, 0xCF, 0x83, 0x08, 0x02, 0x28, 0x44, 0x60, 0x88, 0x2A, 0x44, + 0x70, 0x8A, 0x2C, 0x44, 0x70, 0x8C, 0xF1, 0x81, 0xF5, 0x01, 0xE7, 0xA3, 0x64, 0x44, 0x00, 0xA8, + 0x00, 0x62, 0x02, 0x02, 0x00, 0x61, 0x1C, 0x00, 0xE0, 0x84, 0xDE, 0x82, 0xFD, 0x04, 0x42, 0xFE, + 0xF8, 0x84, 0x62, 0x45, 0xC7, 0x83, 0x60, 0x45, 0x02, 0xFE, 0xD5, 0x84, 0x02, 0x05, 0x01, 0x05, + 0x61, 0x44, 0xCF, 0x83, 0x60, 0x41, 0x08, 0x03, 0x28, 0x44, 0x60, 0x88, 0x2A, 0x44, 0x70, 0x8A, + 0x2C, 0x44, 0x70, 0x8C, 0xF1, 0x81, 0xF1, 0x01, 0xCE, 0x82, 0xE9, 0x81, 0xFD, 0x02, 0xF1, 0x81, + 0x09, 0xF2, 0xFF, 0xFF, 0x60, 0x47, 0xE8, 0x84, 0xE8, 0x84, 0x5A, 0xD2, 0x3F, 0xB5, 0xE0, 0x84, + 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xB4, 0x84, 0x61, 0x45, 0xD4, 0x84, + 0xC0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x93, 0x10, 0x60, 0x0A, 0xF3, 0xFF, 0xFF, + 0x02, 0x18, 0x2E, 0x58, 0xFF, 0xFF, 0x16, 0x65, 0x32, 0x40, 0x80, 0x26, 0x16, 0x65, 0x73, 0x44, + 0xD4, 0x93, 0x69, 0xF3, 0x26, 0x46, 0x04, 0xBC, 0xA2, 0xDB, 0x26, 0xF0, 0xFF, 0x67, 0x20, 0x88, + 0x64, 0x5F, 0x40, 0x4A, 0x24, 0x60, 0x58, 0x4E, 0x80, 0x78, 0xFF, 0xFF, 0x0A, 0x48, 0x24, 0x60, + 0x58, 0x4E, 0x90, 0x78, 0xFF, 0xFF, 0x24, 0x60, 0x58, 0x4E, 0xAC, 0x78, 0xFF, 0xFF, 0x6B, 0xF3, + 0xFF, 0xFF, 0xC8, 0x84, 0xFF, 0xFF, 0x01, 0x05, 0x00, 0x64, 0x6B, 0xFB, 0x08, 0x60, 0x0C, 0xF1, + 0x00, 0x60, 0x40, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x1C, 0x60, 0xCE, 0x64, 0x13, 0x60, + 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x08, 0x60, 0x0C, 0xF1, 0xFF, 0x60, + 0xDF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x26, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x1E, 0xF1, + 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x1C, 0x60, + 0xDA, 0x63, 0xA3, 0xDF, 0x06, 0xA3, 0x10, 0x60, 0xA4, 0x64, 0xBD, 0xDB, 0xBD, 0xDB, 0x06, 0x64, + 0xA3, 0xDB, 0x27, 0x60, 0x68, 0x64, 0x08, 0x60, 0x51, 0xFB, 0x10, 0x60, 0x0F, 0xF1, 0x0E, 0x60, + 0x6F, 0xF9, 0x27, 0x60, 0xCF, 0x64, 0x08, 0x60, 0x38, 0xFB, 0x11, 0x60, 0x44, 0x63, 0x08, 0x60, + 0x66, 0xFD, 0x12, 0x60, 0x40, 0x63, 0x08, 0x60, 0x67, 0xFD, 0xCF, 0xF3, 0x02, 0x63, 0x01, 0x1B, + 0xCF, 0xFD, 0xCF, 0xF3, 0xFF, 0xFF, 0xF7, 0xA0, 0x01, 0x64, 0x01, 0x06, 0xCF, 0xFB, 0xCF, 0xF3, + 0xCF, 0xFB, 0xCF, 0xF3, 0x12, 0x60, 0x78, 0x63, 0x26, 0x18, 0xCC, 0x84, 0xFF, 0xFF, 0x02, 0x03, + 0x2A, 0xA3, 0xFB, 0x01, 0x63, 0x46, 0x10, 0x60, 0xF2, 0x63, 0x0E, 0x61, 0x60, 0xFE, 0xA6, 0xD1, + 0xDE, 0x86, 0x01, 0x64, 0x64, 0x40, 0x7F, 0x36, 0x00, 0x64, 0xA3, 0xDB, 0xDB, 0x83, 0xA3, 0xD9, + 0xCD, 0x81, 0x04, 0xA3, 0xF4, 0x02, 0x11, 0x60, 0x62, 0x63, 0x1C, 0x61, 0xA6, 0xD1, 0xDE, 0x86, + 0x01, 0x64, 0x64, 0x40, 0x7F, 0x36, 0x00, 0x64, 0xA3, 0xDB, 0xDB, 0x83, 0xA3, 0xD9, 0xCD, 0x81, + 0x06, 0xA3, 0xF4, 0x02, 0x20, 0xFE, 0x00, 0x60, 0x60, 0x64, 0x08, 0x60, 0x1F, 0xFB, 0x27, 0x60, + 0xE1, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x11, 0x60, 0x44, 0x63, 0x08, 0x60, + 0x66, 0xFD, 0x12, 0x60, 0x40, 0x63, 0x08, 0x60, 0x67, 0xFD, 0x00, 0x60, 0x60, 0x64, 0x08, 0x60, + 0x1F, 0xFB, 0x27, 0x60, 0xE1, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x28, 0xF3, + 0xFF, 0xFF, 0x60, 0x47, 0x0F, 0xB4, 0x98, 0x00, 0xFF, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x04, 0x64, + 0x13, 0x60, 0x1C, 0xFB, 0x27, 0x00, 0x0C, 0x64, 0x3F, 0x40, 0x02, 0x2B, 0x23, 0x00, 0x29, 0xF1, + 0x13, 0x60, 0x1C, 0xFB, 0x5A, 0xD9, 0x27, 0x60, 0xFD, 0x64, 0x9F, 0xFB, 0xFF, 0xFF, 0x2D, 0xFF, + 0x2A, 0x60, 0x1D, 0x78, 0xFF, 0xFF, 0x29, 0x60, 0x1C, 0x63, 0x09, 0x61, 0x3D, 0x60, 0x58, 0x4D, + 0x23, 0x78, 0xFF, 0xFF, 0x75, 0x00, 0x95, 0xF3, 0xFF, 0xFF, 0x7F, 0xB4, 0x95, 0xFB, 0x06, 0x64, + 0x13, 0x60, 0x1C, 0xFB, 0xFF, 0xFF, 0x2D, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x08, 0x64, + 0x13, 0x60, 0x1C, 0xFB, 0x28, 0x60, 0x7A, 0x64, 0x9F, 0xFB, 0xFF, 0xFF, 0x2D, 0xFF, 0x2A, 0x60, + 0x1D, 0x78, 0xFF, 0xFF, 0x29, 0xF3, 0x12, 0x60, 0x45, 0x65, 0x60, 0x5C, 0x3F, 0x40, 0x02, 0x2B, + 0x13, 0x00, 0x00, 0x37, 0x11, 0x00, 0x01, 0x3B, 0x53, 0x00, 0x11, 0x60, 0x65, 0x63, 0xFF, 0xB7, + 0x60, 0x5C, 0xA3, 0xD3, 0x08, 0xA3, 0x00, 0x7E, 0xD0, 0x80, 0xD7, 0x80, 0x02, 0x03, 0xF9, 0x02, + 0x47, 0x00, 0xF4, 0xA3, 0xA3, 0xD3, 0x05, 0x00, 0x00, 0xBC, 0xF2, 0xA4, 0x41, 0x03, 0x40, 0x07, + 0x64, 0x44, 0x7D, 0xFB, 0xA1, 0xFB, 0x07, 0x64, 0xA2, 0xFB, 0x28, 0x60, 0x7A, 0x64, 0x9F, 0xFB, + 0xFF, 0xFF, 0xDF, 0xFE, 0x00, 0x64, 0x19, 0xFF, 0x2A, 0x60, 0x1D, 0x78, 0xFF, 0xFF, 0x88, 0xFF, + 0xBA, 0x60, 0x98, 0x71, 0x8D, 0xE2, 0x01, 0x11, 0x09, 0x00, 0x71, 0x40, 0x80, 0x27, 0xFB, 0x01, + 0x88, 0xE2, 0xBA, 0x60, 0xD0, 0x64, 0x03, 0xFB, 0x8D, 0xFF, 0x15, 0x00, 0x8D, 0xFF, 0x28, 0x60, + 0xFB, 0x63, 0x06, 0x60, 0x0B, 0xFD, 0xFF, 0xFF, 0x62, 0xFF, 0x28, 0x60, 0x67, 0x63, 0x9F, 0xFD, + 0xFF, 0xFF, 0x1A, 0xFF, 0x2A, 0x60, 0x1D, 0x78, 0xFF, 0xFF, 0xA3, 0x60, 0xF4, 0x63, 0x06, 0x60, + 0x0B, 0xFD, 0xFF, 0xFF, 0x62, 0xFF, 0x29, 0xF5, 0x26, 0x60, 0x20, 0x63, 0x25, 0x60, 0xF2, 0x64, + 0xBD, 0xDB, 0x66, 0x44, 0xBD, 0xDB, 0x02, 0x64, 0xA3, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xF9, 0xFE, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x68, 0x01, 0x00, 0x36, 0x69, 0x01, 0x01, 0x36, 0x6B, 0x01, + 0x02, 0x36, 0x81, 0x01, 0x03, 0x36, 0x8B, 0x01, 0x04, 0x36, 0xC1, 0x01, 0x05, 0x36, 0xBF, 0x01, + 0x06, 0x36, 0xF1, 0x01, 0x07, 0x36, 0xBB, 0x01, 0x08, 0x36, 0x8C, 0x01, 0x09, 0x36, 0x0C, 0x00, + 0x0A, 0x36, 0x0D, 0x00, 0x0B, 0x36, 0x0E, 0x00, 0x0C, 0x36, 0x17, 0x00, 0x0D, 0x36, 0x0D, 0x00, + 0x0E, 0x36, 0x1D, 0x00, 0x0F, 0x36, 0x41, 0x00, 0x02, 0x60, 0x00, 0x64, 0x08, 0x00, 0x04, 0x60, + 0x00, 0x64, 0x05, 0x00, 0x00, 0x60, 0x01, 0x64, 0x02, 0x00, 0x20, 0x60, 0x00, 0x64, 0x32, 0x45, + 0xB4, 0x85, 0x45, 0x52, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x29, 0x60, 0xDE, 0x63, 0x06, 0x60, + 0x0B, 0xFD, 0x62, 0xFF, 0xFF, 0xFF, 0x1A, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x3F, 0x40, + 0x02, 0x2B, 0x15, 0x00, 0x88, 0xFF, 0xBA, 0x60, 0x98, 0x71, 0x8D, 0xE2, 0x01, 0x11, 0x09, 0x00, + 0x71, 0x40, 0x80, 0x27, 0xFB, 0x01, 0x88, 0xE2, 0xBA, 0x60, 0xD0, 0x64, 0x03, 0xFB, 0x8D, 0xFF, + 0x11, 0x00, 0x8D, 0xFF, 0x90, 0x60, 0x00, 0xE8, 0x28, 0x60, 0xFB, 0x63, 0x04, 0x00, 0x91, 0x60, + 0x00, 0xE8, 0x29, 0x60, 0xC4, 0x63, 0x2A, 0xE8, 0x06, 0x60, 0x0B, 0xFD, 0xFF, 0xFF, 0x62, 0xFF, + 0xFF, 0xFF, 0x1A, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xF1, 0xF3, 0xFF, 0xFF, 0xEF, 0xB4, + 0xF1, 0xFB, 0xAD, 0x4F, 0xFD, 0xB4, 0xA0, 0x5D, 0xD0, 0x60, 0x00, 0xE8, 0x2A, 0xE8, 0xD9, 0x60, + 0xFE, 0x64, 0x32, 0x45, 0xA4, 0x85, 0x45, 0x52, 0x99, 0xFF, 0xA5, 0x4F, 0xFF, 0xB4, 0x07, 0xFB, + 0x98, 0xFF, 0xA3, 0x60, 0xF4, 0x63, 0x06, 0x60, 0x0B, 0xFD, 0x62, 0xFF, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x08, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x43, 0xFF, 0x01, 0x60, 0x00, 0xE1, 0x28, 0xF3, + 0x47, 0xFF, 0x60, 0x40, 0x07, 0x37, 0x66, 0x00, 0x05, 0x3B, 0x04, 0x00, 0xFF, 0x0A, 0x80, 0xE1, + 0xA1, 0xFF, 0xFF, 0xFF, 0x1B, 0x60, 0xF3, 0xF1, 0xAD, 0x4F, 0x00, 0x7F, 0xFA, 0xB4, 0x64, 0x41, + 0x7D, 0xF1, 0x02, 0xB1, 0x04, 0x65, 0x02, 0x02, 0x64, 0x40, 0x01, 0x2B, 0x01, 0x65, 0xB4, 0x84, + 0xA0, 0x5D, 0x29, 0xF5, 0x2A, 0xF3, 0x47, 0xFF, 0x3F, 0xF0, 0x01, 0x1B, 0x01, 0x64, 0x60, 0x56, + 0xAD, 0xE2, 0xB5, 0xFF, 0x6C, 0x40, 0x40, 0xE1, 0xA1, 0xFF, 0x00, 0xF4, 0x6E, 0x61, 0x12, 0x62, + 0x64, 0x43, 0x01, 0xE1, 0x03, 0x64, 0xE2, 0xD0, 0xC9, 0x81, 0x64, 0x4C, 0xCC, 0x84, 0xDA, 0x82, + 0xFA, 0x02, 0x01, 0x60, 0x00, 0x6B, 0x9A, 0xFF, 0xCA, 0x82, 0x03, 0x00, 0x00, 0xF4, 0x81, 0xF2, + 0xFF, 0xFF, 0x7A, 0xD0, 0xA1, 0xFF, 0x64, 0x4C, 0xFC, 0x1C, 0xF8, 0x1D, 0x00, 0xB9, 0x06, 0x1E, + 0x02, 0x02, 0x00, 0xF4, 0xDA, 0x82, 0x5A, 0xD2, 0xA1, 0xFF, 0x60, 0x4D, 0x3F, 0x40, 0x02, 0x2B, + 0x10, 0x00, 0x28, 0xF3, 0xA5, 0x60, 0xC4, 0x65, 0x60, 0x40, 0x0E, 0x3B, 0x0A, 0x00, 0xF1, 0xF3, + 0xFF, 0xFF, 0x10, 0xBC, 0xF1, 0xFB, 0xAD, 0x4F, 0x02, 0xBC, 0x00, 0x7F, 0xA0, 0x5D, 0x85, 0x4C, + 0xFE, 0x01, 0xF1, 0xF3, 0xFF, 0xFF, 0x02, 0xBC, 0xF1, 0xFB, 0xA1, 0xFF, 0x87, 0x4E, 0x87, 0x4C, + 0x87, 0x4C, 0x87, 0x4C, 0x87, 0x4C, 0x67, 0x4C, 0xFF, 0xFF, 0xBC, 0xFF, 0x00, 0xE1, 0xD5, 0xFE, + 0xA1, 0xFF, 0xFF, 0xFF, 0x00, 0x64, 0x40, 0x46, 0x60, 0x41, 0xB5, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, + 0x29, 0xF5, 0x3F, 0xF0, 0x24, 0xF2, 0x44, 0x43, 0x40, 0x4D, 0x00, 0xF4, 0xF3, 0x60, 0xA0, 0x65, + 0x10, 0x62, 0x5A, 0xD2, 0xD9, 0x81, 0xD4, 0x80, 0xFF, 0xFF, 0xFB, 0x02, 0x61, 0x45, 0x2D, 0x44, + 0xD4, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xFD, 0xA5, 0x48, 0x60, 0x00, 0x64, 0xC4, 0x9D, + 0x0D, 0x60, 0x00, 0x6B, 0x2D, 0x44, 0xC0, 0x83, 0xBB, 0xFF, 0x29, 0xF5, 0x01, 0xE1, 0x00, 0xF4, + 0x6C, 0x61, 0x10, 0x62, 0x05, 0x00, 0x00, 0xF4, 0x01, 0xF2, 0xFF, 0xFF, 0x60, 0x41, 0x04, 0x62, + 0xA1, 0xFF, 0xFF, 0xFF, 0x01, 0x10, 0x1A, 0x00, 0x26, 0x44, 0x01, 0x26, 0x0C, 0x00, 0x2D, 0x44, + 0xC8, 0x84, 0x40, 0x4D, 0x02, 0x03, 0x6C, 0x45, 0xF3, 0x01, 0x03, 0x15, 0x01, 0x64, 0x05, 0xFA, + 0x15, 0x00, 0x6C, 0x45, 0xED, 0x01, 0x23, 0x44, 0xC8, 0x84, 0x40, 0x43, 0x02, 0x03, 0x6C, 0x45, + 0xE7, 0x01, 0x00, 0x64, 0x01, 0x15, 0x01, 0x64, 0x6C, 0x45, 0x05, 0xFB, 0xE2, 0xD2, 0xDA, 0x82, + 0xC9, 0x81, 0x60, 0x4C, 0xDD, 0x1C, 0xD7, 0x03, 0xBC, 0xFF, 0xDA, 0x01, 0x00, 0xE1, 0xD5, 0xFE, + 0xA1, 0xFF, 0xFF, 0xFF, 0x08, 0xE1, 0xA1, 0xFF, 0x67, 0x4C, 0x43, 0xFF, 0xF1, 0xF3, 0xFF, 0xFF, + 0x10, 0xBC, 0xF1, 0xFB, 0xAD, 0x4F, 0x02, 0xBC, 0x00, 0x7F, 0xA0, 0x5D, 0x01, 0xE1, 0x01, 0x60, + 0x69, 0x6B, 0xA5, 0x60, 0xC4, 0x64, 0x60, 0x4C, 0xBB, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x60, 0x4C, + 0xA1, 0xFF, 0xFF, 0xFF, 0x60, 0x4C, 0xFC, 0x01, 0x29, 0xF3, 0x2A, 0xF1, 0x07, 0xB5, 0x04, 0xE1, + 0x65, 0x41, 0x64, 0x54, 0xCD, 0xE2, 0x95, 0x81, 0xA1, 0x5D, 0xA1, 0xFF, 0xFF, 0xFF, 0xF9, 0x01, + 0x61, 0x44, 0xFE, 0xFB, 0xFF, 0xFD, 0xFF, 0x01, 0x7F, 0x67, 0x01, 0x61, 0x23, 0x58, 0xFF, 0xFF, + 0xB1, 0xFE, 0x08, 0x05, 0xB0, 0xFE, 0x09, 0x05, 0xB2, 0xFE, 0xB3, 0xFE, 0x78, 0x43, 0x01, 0x61, + 0x29, 0x60, 0xEA, 0x78, 0x34, 0x60, 0x8D, 0x78, 0xFF, 0xFF, 0x28, 0xF3, 0x29, 0xF1, 0x40, 0x44, + 0x44, 0x45, 0x2A, 0xF1, 0x2B, 0xF1, 0x44, 0x46, 0x44, 0x47, 0x3F, 0xB4, 0xE0, 0x85, 0x20, 0x60, + 0x28, 0x64, 0x44, 0xD7, 0x58, 0x43, 0xFF, 0xFF, 0x60, 0x45, 0x0E, 0x60, 0xDD, 0xF3, 0x61, 0x43, + 0x04, 0xB4, 0x24, 0x44, 0x02, 0x03, 0x13, 0xFF, 0x06, 0x00, 0x3F, 0xB4, 0xB4, 0x84, 0xFF, 0x27, + 0x05, 0xFD, 0x04, 0xFB, 0x10, 0x75, 0xA1, 0xFF, 0xFF, 0xFF, 0x86, 0x3E, 0xB4, 0xFE, 0x0B, 0x05, + 0xB5, 0xFE, 0x02, 0x24, 0x9F, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0xB7, 0xFE, 0x07, 0x05, 0x78, 0x43, + 0x01, 0x61, 0x29, 0x60, 0xEA, 0x78, 0x34, 0x60, 0xC8, 0x78, 0xFF, 0xFF, 0x36, 0x44, 0x00, 0x7F, + 0xEE, 0xA0, 0x60, 0x45, 0x05, 0x05, 0x20, 0x60, 0xBA, 0x64, 0x44, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, + 0x78, 0x43, 0x01, 0x61, 0x29, 0x60, 0xEA, 0x78, 0x78, 0x43, 0x01, 0x61, 0x29, 0x60, 0xEA, 0x78, + 0x7F, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, 0x10, 0x02, 0x10, 0x64, + 0x40, 0x40, 0x02, 0x64, 0x40, 0x50, 0x61, 0xFF, 0x3F, 0x40, 0x40, 0x26, 0x04, 0x00, 0x10, 0xE0, + 0x46, 0x60, 0x09, 0xE0, 0x00, 0x00, 0x27, 0xF1, 0x00, 0x66, 0x20, 0x78, 0x42, 0xFE, 0x23, 0x58, + 0xFF, 0xFF, 0x7F, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, 0x1A, 0x02, + 0x0E, 0x60, 0xDD, 0xF3, 0x07, 0x7C, 0x20, 0xB5, 0x0C, 0xB5, 0x04, 0x03, 0x03, 0x02, 0xDB, 0xF9, + 0x00, 0x67, 0x10, 0x00, 0x00, 0x61, 0x41, 0x56, 0xC7, 0xFE, 0xAD, 0x01, 0x36, 0x47, 0xFF, 0x23, + 0x04, 0x00, 0x00, 0x7F, 0x60, 0x41, 0x7F, 0x67, 0x05, 0x00, 0x62, 0xFF, 0x20, 0x44, 0x80, 0xBC, + 0x40, 0x40, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x7F, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, + 0x7F, 0x67, 0x02, 0x61, 0x31, 0x02, 0x0E, 0x60, 0xDD, 0xF3, 0x01, 0x7C, 0x20, 0xB5, 0x0C, 0xB5, + 0x03, 0x03, 0x02, 0x02, 0xDB, 0xF9, 0xFF, 0xFF, 0x02, 0x61, 0x41, 0x56, 0xC7, 0xFE, 0x2A, 0x60, + 0x1D, 0x78, 0xFF, 0xFF, 0x9D, 0xF1, 0x20, 0x44, 0x64, 0x40, 0xFF, 0x26, 0x1C, 0x00, 0x7F, 0xB4, + 0x40, 0x40, 0x5C, 0x5E, 0x82, 0xFF, 0x26, 0x44, 0xFD, 0xB4, 0x40, 0x46, 0x5C, 0x41, 0x87, 0xFF, + 0x62, 0xFF, 0x13, 0x60, 0x02, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x04, 0x03, 0x09, 0xF2, + 0x8F, 0xFC, 0xAC, 0x86, 0xFB, 0x01, 0x95, 0xF3, 0xFF, 0xFF, 0x7F, 0xB4, 0x95, 0xFB, 0x06, 0x64, + 0x13, 0x60, 0x1C, 0xFB, 0x2D, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x00, 0x67, 0x20, 0x40, + 0x80, 0x2A, 0x02, 0x00, 0x7F, 0x67, 0x06, 0x61, 0x60, 0x45, 0x0E, 0x60, 0xDD, 0xF3, 0x61, 0x43, + 0x04, 0xB4, 0x24, 0x44, 0x02, 0x03, 0x13, 0xFF, 0x56, 0x01, 0x3F, 0xB4, 0xB4, 0x84, 0xFF, 0x27, + 0x05, 0xFD, 0x04, 0xFB, 0x20, 0x40, 0x80, 0x2A, 0x02, 0x00, 0x10, 0x75, 0x05, 0x00, 0x01, 0x64, + 0x19, 0x60, 0xF7, 0xFB, 0x08, 0x60, 0x10, 0x75, 0x46, 0x01, 0x25, 0x46, 0x01, 0xF2, 0x08, 0xF0, + 0x60, 0x47, 0x03, 0xB4, 0x03, 0xAC, 0x7F, 0x67, 0x03, 0x61, 0x08, 0x02, 0x26, 0x60, 0x20, 0x64, + 0x40, 0x4B, 0x34, 0x60, 0x58, 0x4D, 0x08, 0x78, 0xFF, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x24, 0x40, 0x01, 0x2B, 0x49, 0x00, 0x25, 0x44, 0x1F, 0xB4, 0xE0, 0x85, 0x2A, 0x60, 0xF4, 0x64, + 0xC4, 0x98, 0xFF, 0xFF, 0xC0, 0xFE, 0x3D, 0x00, 0xC1, 0xFE, 0x3B, 0x00, 0xC2, 0xFE, 0x39, 0x00, + 0xC3, 0xFE, 0x37, 0x00, 0xC4, 0xFE, 0x35, 0x00, 0xC5, 0xFE, 0x33, 0x00, 0xC6, 0xFE, 0x31, 0x00, + 0xC7, 0xFE, 0x2F, 0x00, 0xC8, 0xFE, 0x2D, 0x00, 0xC9, 0xFE, 0x2B, 0x00, 0xCA, 0xFE, 0x29, 0x00, + 0xCB, 0xFE, 0x27, 0x00, 0xCC, 0xFE, 0x25, 0x00, 0xCD, 0xFE, 0x23, 0x00, 0xCE, 0xFE, 0x21, 0x00, + 0xCF, 0xFE, 0x1F, 0x00, 0xD0, 0xFE, 0x1D, 0x00, 0xD1, 0xFE, 0x1B, 0x00, 0xD2, 0xFE, 0x19, 0x00, + 0xD3, 0xFE, 0x17, 0x00, 0xD4, 0xFE, 0x15, 0x00, 0xD5, 0xFE, 0x13, 0x00, 0xD6, 0xFE, 0x11, 0x00, + 0xD7, 0xFE, 0x0F, 0x00, 0xD8, 0xFE, 0x0D, 0x00, 0xD9, 0xFE, 0x0B, 0x00, 0xDA, 0xFE, 0x09, 0x00, + 0xDB, 0xFE, 0x07, 0x00, 0xDC, 0xFE, 0x05, 0x00, 0xDD, 0xFE, 0x03, 0x00, 0xDE, 0xFE, 0x01, 0x00, + 0xDF, 0xFE, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x00, 0x64, 0x9F, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, + 0x9E, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x9D, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x9C, 0xFE, 0xF0, 0x84, + 0xFF, 0xFF, 0x9B, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x9A, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x99, 0xFE, + 0xF0, 0x84, 0xFF, 0xFF, 0x98, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x97, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, + 0x96, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x95, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x94, 0xFE, 0xF0, 0x84, + 0xFF, 0xFF, 0x93, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x92, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x91, 0xFE, + 0xF0, 0x84, 0xFF, 0xFF, 0x90, 0xFE, 0xF0, 0x84, 0x06, 0xFB, 0x8F, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, + 0x8E, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x8D, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x8C, 0xFE, 0xF0, 0x84, + 0xFF, 0xFF, 0x8B, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x8A, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x89, 0xFE, + 0xF0, 0x84, 0xFF, 0xFF, 0x88, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x87, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, + 0x86, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x85, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x84, 0xFE, 0xF0, 0x84, + 0xFF, 0xFF, 0x83, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x82, 0xFE, 0xF0, 0x84, 0xFF, 0xFF, 0x81, 0xFE, + 0xF0, 0x84, 0xFF, 0xFF, 0x80, 0xFE, 0xF0, 0x84, 0x05, 0xFB, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x5C, 0x5C, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x24, 0x40, 0x01, 0x27, 0x55, 0x00, 0x05, 0x60, + 0x00, 0x63, 0x05, 0xFD, 0x30, 0x44, 0xBD, 0xDB, 0x31, 0x44, 0xBD, 0xDB, 0x32, 0x44, 0xBD, 0xDB, + 0x33, 0x44, 0xBD, 0xDB, 0x34, 0x44, 0xBD, 0xDB, 0x35, 0x44, 0xBD, 0xDB, 0x36, 0x44, 0xBD, 0xDB, + 0x37, 0x44, 0xBD, 0xDB, 0x38, 0x44, 0xBD, 0xDB, 0x39, 0x44, 0xBD, 0xDB, 0x3A, 0x44, 0xBD, 0xDB, + 0x3B, 0x44, 0xBD, 0xDB, 0x3C, 0x44, 0xBD, 0xDB, 0x3D, 0x44, 0xBD, 0xDB, 0x3E, 0x44, 0xBD, 0xDB, + 0x3F, 0x44, 0xBD, 0xDB, 0x02, 0x61, 0x61, 0x44, 0x02, 0x36, 0x82, 0xFF, 0x03, 0x36, 0x83, 0xFF, + 0x04, 0x36, 0x84, 0xFF, 0x05, 0x36, 0x85, 0xFF, 0x06, 0x36, 0x86, 0xFF, 0x07, 0x36, 0x87, 0xFF, + 0x20, 0x44, 0xBD, 0xDB, 0x21, 0x44, 0xBD, 0xDB, 0x22, 0x44, 0xBD, 0xDB, 0x23, 0x44, 0xBD, 0xDB, + 0x24, 0x44, 0xBD, 0xDB, 0x25, 0x44, 0xBD, 0xDB, 0x26, 0x44, 0xBD, 0xDB, 0x27, 0x44, 0xBD, 0xDB, + 0x28, 0x44, 0xBD, 0xDB, 0x29, 0x44, 0xBD, 0xDB, 0x2A, 0x44, 0xBD, 0xDB, 0x2B, 0x44, 0xBD, 0xDB, + 0x2C, 0x44, 0xBD, 0xDB, 0x2D, 0x44, 0xBD, 0xDB, 0x2E, 0x44, 0xBD, 0xDB, 0x2F, 0x44, 0xBD, 0xDB, + 0xDD, 0x81, 0x08, 0x3A, 0xD0, 0x01, 0x54, 0x00, 0x27, 0x40, 0x10, 0x26, 0x30, 0x00, 0x26, 0x44, + 0x01, 0x36, 0x2D, 0x00, 0x02, 0x36, 0x82, 0xFF, 0x03, 0x36, 0x83, 0xFF, 0x04, 0x36, 0x84, 0xFF, + 0x05, 0x36, 0x85, 0xFF, 0x06, 0x36, 0x86, 0xFF, 0x25, 0x44, 0x00, 0x36, 0x44, 0x40, 0x01, 0x36, + 0x44, 0x41, 0x02, 0x36, 0x44, 0x42, 0x03, 0x36, 0x44, 0x43, 0x04, 0x36, 0x44, 0x44, 0x05, 0x36, + 0x44, 0x45, 0x06, 0x36, 0x44, 0x46, 0x07, 0x36, 0x44, 0x47, 0x08, 0x36, 0x44, 0x48, 0x09, 0x36, + 0x44, 0x49, 0x0A, 0x36, 0x44, 0x4A, 0x0B, 0x36, 0x44, 0x4B, 0x0C, 0x36, 0x44, 0x4C, 0x0D, 0x36, + 0x44, 0x4D, 0x0E, 0x36, 0x44, 0x4E, 0x0F, 0x36, 0x44, 0x4F, 0x87, 0xFF, 0x21, 0x00, 0x25, 0x44, + 0x10, 0x36, 0x44, 0x50, 0x11, 0x36, 0x44, 0x51, 0x12, 0x36, 0x44, 0x52, 0x13, 0x36, 0x44, 0x53, + 0x14, 0x36, 0x44, 0x54, 0x15, 0x36, 0x44, 0x55, 0x16, 0x36, 0x44, 0x56, 0x17, 0x36, 0x44, 0x57, + 0x18, 0x36, 0x44, 0x58, 0x19, 0x36, 0x44, 0x59, 0x1A, 0x36, 0x44, 0x5A, 0x1B, 0x36, 0x44, 0x5B, + 0x1C, 0x36, 0x44, 0x5C, 0x1D, 0x36, 0x44, 0x5D, 0x1E, 0x36, 0x44, 0x5E, 0x1F, 0x36, 0x44, 0x5F, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x25, 0x46, 0xB5, 0x60, 0x58, 0x4F, 0xCE, 0x78, 0xFF, 0xFF, + 0x03, 0x61, 0x7F, 0x67, 0x0A, 0x02, 0x00, 0xF0, 0x04, 0x64, 0x13, 0x60, 0x10, 0xFB, 0x5A, 0xD9, + 0x0A, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x40, 0x60, + 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, 0x12, 0x02, 0x14, 0x64, 0x13, 0x60, + 0x1C, 0xFB, 0x00, 0x60, 0x50, 0x63, 0x5A, 0xDD, 0x2C, 0x60, 0x75, 0x64, 0x9F, 0xFB, 0x2D, 0xFF, + 0x2A, 0x60, 0x1D, 0x78, 0xFF, 0xFF, 0x2A, 0xF3, 0x05, 0xFB, 0x2B, 0xF3, 0x06, 0xFB, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x40, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, + 0x0E, 0x02, 0x16, 0x64, 0x13, 0x60, 0x1C, 0xFB, 0x00, 0x60, 0x50, 0x63, 0x5A, 0xDD, 0x2C, 0x60, + 0x90, 0x64, 0x9F, 0xFB, 0x2D, 0xFF, 0x2A, 0x60, 0x1D, 0x78, 0xFF, 0xFF, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x7F, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x02, 0x61, 0x38, 0x02, 0x25, 0x45, + 0x20, 0x44, 0x80, 0x2A, 0x34, 0x00, 0xF1, 0x60, 0x00, 0x64, 0xD4, 0x80, 0xFF, 0xFF, 0x06, 0x03, + 0xF1, 0x60, 0x02, 0x64, 0xD4, 0x80, 0xFF, 0xFF, 0x2F, 0x03, 0x28, 0x00, 0x19, 0x60, 0x40, 0xF1, + 0xB7, 0xF3, 0x20, 0x60, 0x22, 0x61, 0xA0, 0x84, 0xA1, 0xDB, 0x25, 0x45, 0x25, 0x60, 0x86, 0x63, + 0x02, 0x61, 0xBD, 0xD3, 0xBD, 0xD1, 0xD4, 0x80, 0xBD, 0xD3, 0xBD, 0xD5, 0xCD, 0x81, 0x02, 0x03, + 0x15, 0x03, 0xF7, 0x01, 0xA2, 0xFF, 0xA6, 0xD3, 0x40, 0x4C, 0x00, 0xA8, 0x67, 0x43, 0x0C, 0x02, + 0xA2, 0xDD, 0x42, 0x48, 0x64, 0x41, 0xB6, 0x60, 0x58, 0x4D, 0x25, 0x78, 0xFF, 0xFF, 0x66, 0x44, + 0x28, 0xDB, 0x02, 0x03, 0x2C, 0x58, 0xA3, 0xFF, 0x0C, 0x61, 0x03, 0x00, 0x04, 0x61, 0x7F, 0x67, + 0x01, 0x00, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x01, 0x64, 0x10, 0x60, 0x13, 0xFB, 0xFF, 0xFF, + 0xC4, 0xFE, 0xF7, 0x01, 0xC6, 0xFE, 0xF5, 0x01, 0x7E, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, + 0x02, 0x61, 0x3F, 0x02, 0x25, 0x45, 0xF8, 0x2B, 0x3B, 0x00, 0x2E, 0xF5, 0x67, 0x44, 0xD4, 0x80, + 0x20, 0x60, 0xCC, 0x63, 0x39, 0x03, 0x79, 0x61, 0x24, 0x44, 0x01, 0x27, 0x29, 0x00, 0xA3, 0xFC, + 0xA4, 0xF8, 0xBD, 0xD3, 0xA3, 0xD1, 0xD4, 0x80, 0xCD, 0x81, 0x08, 0x24, 0x64, 0x58, 0x08, 0xA3, + 0xF8, 0x02, 0x08, 0x60, 0x00, 0x63, 0xBD, 0xD3, 0xA3, 0xD1, 0xFE, 0xA0, 0xFA, 0x60, 0x00, 0x64, + 0xD0, 0x80, 0x14, 0x02, 0x13, 0x02, 0x04, 0xA3, 0xBE, 0xD3, 0xBD, 0xD1, 0x0F, 0x18, 0xD4, 0x80, + 0x0D, 0x18, 0x03, 0x03, 0xC3, 0x83, 0xC3, 0x83, 0xF7, 0x01, 0x64, 0x41, 0xDD, 0x81, 0xE1, 0x81, + 0xCB, 0x83, 0x46, 0x65, 0x36, 0x60, 0x58, 0x4F, 0x22, 0x78, 0xFF, 0xFF, 0x00, 0x67, 0x0A, 0x00, + 0xBD, 0xD3, 0xBE, 0xD1, 0xD4, 0x80, 0xCD, 0x81, 0x08, 0x24, 0x64, 0x58, 0x08, 0xA3, 0xF8, 0x02, + 0x04, 0x61, 0x7F, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x0F, 0x64, 0x23, 0xFA, 0x67, 0x44, 0x24, 0xFA, + 0x62, 0x41, 0x3C, 0x60, 0x00, 0x65, 0x1A, 0x63, 0x80, 0x60, 0x9E, 0x64, 0x65, 0x46, 0x58, 0xD0, + 0x2E, 0xF5, 0x59, 0xD8, 0xFB, 0x1F, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xCB, 0x83, 0xBF, 0xD1, + 0x4A, 0x65, 0x64, 0x43, 0xBD, 0xD3, 0xFF, 0xFF, 0x60, 0x41, 0x01, 0x26, 0xDC, 0x81, 0xE9, 0x84, + 0xDC, 0x84, 0x23, 0xFA, 0x09, 0x00, 0x4B, 0xD3, 0xFF, 0xFF, 0x60, 0x41, 0xE8, 0x84, 0xDC, 0x84, + 0x23, 0xFA, 0xBF, 0xD1, 0x4A, 0x65, 0x64, 0x43, 0x36, 0x60, 0x58, 0x4F, 0x22, 0x78, 0xFF, 0xFF, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x25, 0xF2, 0xFF, 0xFF, 0xE0, 0xA0, 0x20, 0x64, 0x01, 0x06, + 0x25, 0xFA, 0x23, 0xF2, 0xDF, 0xD1, 0xCC, 0x84, 0xE0, 0x85, 0x0B, 0x06, 0xBF, 0xD1, 0x64, 0x41, + 0xD5, 0x80, 0x64, 0x43, 0x01, 0x06, 0x65, 0x41, 0x4A, 0x65, 0x2E, 0x60, 0x58, 0x4F, 0x7A, 0x78, + 0xFF, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0xDB, 0xF3, 0x02, 0x63, 0x23, 0xFC, 0x07, 0xB4, + 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x4B, 0xD3, 0xBF, 0xD3, 0x60, 0x41, 0xC9, 0x83, + 0xE9, 0x81, 0xDD, 0x81, 0xA3, 0xFA, 0xE0, 0x81, 0x3C, 0x60, 0x00, 0x67, 0x02, 0x24, 0x02, 0xA4, + 0x60, 0x47, 0x40, 0x4B, 0xC9, 0x81, 0x4A, 0x65, 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0xA5, 0xD8, + 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0xF6, 0x1F, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0xFC, 0xA3, 0xA3, 0xD1, 0x4C, 0x65, 0xA4, 0xD3, 0xDA, 0x83, 0x60, 0x47, 0x25, 0xFA, + 0x00, 0x7E, 0x60, 0x47, 0x01, 0x26, 0xDC, 0x84, 0x60, 0x41, 0xE8, 0x84, 0xD8, 0x84, 0x23, 0xFA, + 0xAB, 0x01, 0xFC, 0xA3, 0xA3, 0xD1, 0x4C, 0x65, 0xA4, 0xD3, 0xDA, 0x83, 0x00, 0x7F, 0x25, 0xFA, + 0x60, 0x41, 0x01, 0x26, 0xDD, 0x81, 0xE9, 0x84, 0xD8, 0x84, 0x23, 0xFA, 0x9D, 0x01, 0x2E, 0x60, + 0x40, 0x63, 0xBF, 0xD3, 0xFF, 0xFF, 0x60, 0x41, 0xE8, 0x84, 0xDC, 0x84, 0x23, 0xFA, 0x4A, 0x65, + 0x36, 0x60, 0x58, 0x4F, 0x22, 0x78, 0xFF, 0xFF, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x2E, 0x60, + 0x40, 0x63, 0x23, 0xF2, 0xC0, 0x65, 0xCC, 0x84, 0xE0, 0x81, 0x0A, 0x04, 0xBF, 0xDB, 0xD5, 0x80, + 0x07, 0x03, 0x01, 0x06, 0x65, 0x41, 0x61, 0x44, 0xBF, 0xDB, 0x4A, 0x65, 0x58, 0x4F, 0xA8, 0x00, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x03, 0x4E, 0x2D, 0x60, 0x58, 0x43, 0x55, 0x78, 0xFF, 0xFF, + 0x2F, 0x60, 0x24, 0x61, 0x17, 0x60, 0x81, 0xF3, 0xA1, 0xDB, 0xCC, 0x84, 0xA8, 0x83, 0x05, 0x04, + 0x2F, 0x60, 0x02, 0x64, 0x58, 0xD1, 0x59, 0xD9, 0xFD, 0x1F, 0x0E, 0x43, 0x82, 0x01, 0x23, 0xF2, + 0x25, 0xF2, 0x02, 0xA8, 0xF8, 0xA0, 0x0F, 0x02, 0xEC, 0xA0, 0x0D, 0x04, 0x0C, 0x07, 0x19, 0x60, + 0x4F, 0xF1, 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, 0x04, 0x07, 0x19, 0x60, 0x4F, 0xFB, 0x19, 0x60, + 0x53, 0xFB, 0x16, 0x60, 0xD8, 0xFB, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, 0x1D, 0x60, + 0xAE, 0x65, 0x60, 0x41, 0x1D, 0x60, 0x4A, 0x63, 0xA3, 0xDB, 0xFF, 0xA1, 0x48, 0x64, 0x58, 0xD0, + 0x7E, 0xA8, 0x5B, 0xD9, 0x02, 0x02, 0x00, 0xF4, 0x02, 0x64, 0xFF, 0xA1, 0xD7, 0x80, 0x02, 0x03, + 0x01, 0x03, 0xF5, 0x01, 0x2E, 0xF5, 0x00, 0x60, 0x2F, 0x65, 0x25, 0xF2, 0x00, 0x63, 0xCC, 0x84, + 0x03, 0xA3, 0xFD, 0x05, 0x4A, 0x64, 0xD7, 0x80, 0x1C, 0x60, 0xE6, 0x61, 0x18, 0x05, 0xA1, 0xDD, + 0xE3, 0x83, 0xFE, 0xA3, 0x58, 0xD0, 0x7E, 0xA8, 0x59, 0xD9, 0x02, 0x02, 0x00, 0xF4, 0x02, 0x64, + 0xF9, 0x1F, 0x00, 0x63, 0x59, 0xDD, 0x2E, 0xF5, 0x25, 0xF0, 0x0E, 0x60, 0x73, 0xF3, 0xD3, 0x80, + 0x01, 0xB0, 0x04, 0x03, 0x01, 0xA4, 0x03, 0x03, 0xA2, 0xDB, 0x01, 0x00, 0xA2, 0xDD, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x1D, 0x60, 0x4A, 0x61, 0xA1, 0xD3, 0x23, 0xFA, 0xE0, 0x83, 0x4A, 0x65, + 0x04, 0x02, 0x02, 0x63, 0x23, 0xFC, 0xA5, 0xFC, 0x09, 0x00, 0xDB, 0x83, 0x59, 0xD1, 0xA5, 0xD8, + 0xDA, 0x85, 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0xF8, 0x1F, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x0E, 0x60, 0x73, 0xF3, 0x00, 0x61, 0x02, 0xA4, 0xFE, 0xA0, 0x23, 0xFA, 0x1B, 0x03, + 0xFA, 0xA4, 0xFD, 0xA4, 0x01, 0xA1, 0xFD, 0x07, 0x61, 0x43, 0x23, 0xF2, 0x25, 0xFC, 0xE0, 0x83, + 0x02, 0xA3, 0x1C, 0x60, 0xE6, 0x61, 0x00, 0x60, 0x4A, 0x64, 0x59, 0xD1, 0x58, 0xD8, 0x7E, 0x3A, + 0x02, 0x00, 0x00, 0xF4, 0x02, 0x64, 0xF9, 0x1F, 0x25, 0xF2, 0x23, 0xF2, 0x01, 0xB0, 0xCC, 0x84, + 0x04, 0x02, 0x23, 0xFA, 0x02, 0x00, 0x00, 0x64, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x41, 0x4B, 0x65, 0x42, 0x80, 0x64, 0xD4, 0x85, 0x2B, 0x41, 0x00, 0xA1, 0x55, 0x8B, 0x0D, 0x03, + 0x02, 0x04, 0x65, 0x41, 0x02, 0x00, 0x00, 0x64, 0x40, 0x4B, 0xCA, 0x84, 0x58, 0xD0, 0xC9, 0x81, + 0xBD, 0xD9, 0xFC, 0x02, 0x00, 0xF4, 0x04, 0x65, 0xEC, 0x01, 0x2F, 0x58, 0xFF, 0xFF, 0xFC, 0xA3, + 0xA3, 0xD3, 0x02, 0x7C, 0xA0, 0xD3, 0x23, 0xF8, 0xDC, 0x84, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x02, 0x64, 0x23, 0xFA, 0x01, 0x64, 0x9D, 0xFE, 0x02, 0x28, 0x02, 0x64, 0x25, 0xFA, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x02, 0x7C, 0x23, 0xF8, 0x01, 0x64, 0x25, 0xFA, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0xFC, 0xA3, 0xA3, 0xD1, 0x02, 0x64, 0x23, 0xFA, 0xA4, 0xD3, 0x25, 0xFA, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x02, 0x64, 0x23, 0xFA, 0x88, 0xFF, 0x75, 0x44, 0x8D, 0xFF, + 0xE8, 0x87, 0xE8, 0x84, 0xE8, 0x84, 0x03, 0xB4, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x04, 0x64, 0x23, 0xFA, 0x86, 0xFF, 0x29, 0x44, 0x87, 0xFF, 0x25, 0xFA, 0x55, 0xF3, 0x52, 0xF1, + 0x80, 0x65, 0xC4, 0x87, 0x00, 0x7F, 0x26, 0xFA, 0x64, 0x44, 0xC4, 0x87, 0x00, 0x7F, 0x27, 0xFA, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x05, 0x64, 0x23, 0xFA, 0x52, 0x63, 0xB4, 0xF3, 0x4B, 0xDA, + 0xB3, 0xF3, 0x4B, 0xDA, 0xB2, 0xF3, 0x4B, 0xDA, 0x60, 0x41, 0x88, 0xFF, 0x72, 0x5C, 0x89, 0xFF, + 0x4A, 0xD8, 0xA2, 0x48, 0x20, 0x23, 0x0E, 0x00, 0x64, 0x40, 0x80, 0x27, 0x15, 0x00, 0xDC, 0x84, + 0xBD, 0xDA, 0xBD, 0xD2, 0x11, 0x04, 0xDC, 0x84, 0xA2, 0xDA, 0xA3, 0xD2, 0x0D, 0x04, 0xDC, 0x84, + 0xA3, 0xDA, 0x0A, 0x00, 0x52, 0x63, 0xB4, 0xF3, 0x4B, 0xDA, 0xB3, 0xF3, 0x4B, 0xDA, 0xB2, 0xF3, + 0x4B, 0xDA, 0x54, 0x90, 0x4C, 0x63, 0xE0, 0x02, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x25, 0xF0, + 0x23, 0xF2, 0x19, 0x60, 0x46, 0xF9, 0x02, 0xA8, 0x64, 0x44, 0x1F, 0x02, 0x3F, 0x40, 0x02, 0x2B, + 0x16, 0x00, 0x00, 0x37, 0x14, 0x00, 0x01, 0x3B, 0x18, 0x00, 0x12, 0x60, 0x45, 0x65, 0x11, 0x60, + 0x65, 0x63, 0xFF, 0xB7, 0x60, 0x5C, 0xA3, 0xD3, 0x08, 0xA3, 0x00, 0x7E, 0xD0, 0x80, 0xD7, 0x80, + 0x03, 0x03, 0xF9, 0x02, 0x7F, 0x67, 0x0A, 0x00, 0xF4, 0xA3, 0xA3, 0xD1, 0x04, 0x00, 0x00, 0xBC, + 0xF2, 0xA4, 0x03, 0x03, 0x02, 0x07, 0x16, 0x60, 0xCF, 0xF9, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x20, 0x63, 0x2E, 0x60, 0x00, 0x61, 0x48, 0x64, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x25, 0xF0, + 0x20, 0x64, 0xD0, 0x81, 0xFF, 0xFF, 0x02, 0x07, 0x25, 0xFA, 0x0F, 0x00, 0x2E, 0x60, 0x04, 0x63, + 0xC3, 0x83, 0x01, 0x2A, 0x06, 0x00, 0xCF, 0x83, 0xA3, 0xD3, 0xCD, 0x81, 0x00, 0x7F, 0xBD, 0xDB, + 0x04, 0x03, 0x00, 0x64, 0xC9, 0x81, 0xBD, 0xDB, 0xFD, 0x02, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x23, 0xF2, 0x25, 0xF0, 0x02, 0xA8, 0x01, 0x60, 0xA0, 0x62, 0x09, 0x02, 0xA2, 0xD9, 0x64, 0x41, + 0x32, 0x44, 0x02, 0xB5, 0x00, 0xB9, 0xD4, 0x84, 0x08, 0x28, 0x02, 0xBC, 0x40, 0x52, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, 0x25, 0xF0, 0x02, 0xA8, 0x01, 0x60, 0xA2, 0x62, 0x09, 0x02, + 0xA2, 0xD9, 0x64, 0x41, 0x32, 0x44, 0x04, 0xB5, 0x00, 0xB9, 0xD4, 0x84, 0x08, 0x28, 0x04, 0xBC, + 0x40, 0x52, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, 0x25, 0xF0, 0x02, 0xA8, 0x01, 0x60, + 0xB0, 0x62, 0x15, 0x02, 0xA2, 0xD9, 0x64, 0x41, 0x32, 0x44, 0x40, 0xB5, 0x00, 0xB9, 0xD4, 0x84, + 0x08, 0x24, 0x0C, 0x00, 0x40, 0xBC, 0x02, 0xB5, 0xD4, 0x84, 0x43, 0xF9, 0x37, 0x60, 0x76, 0x63, + 0xD3, 0x80, 0x2F, 0x60, 0x50, 0x7C, 0x02, 0x03, 0x43, 0xFD, 0xA4, 0xDF, 0x40, 0x52, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x37, 0x60, 0x76, 0x64, 0x43, 0xFB, 0x2D, 0x60, 0x5B, 0x78, 0xFF, 0xFF, + 0x23, 0xF2, 0x25, 0xF0, 0x01, 0x60, 0xAC, 0x63, 0x7F, 0x67, 0x39, 0x18, 0xA3, 0xD9, 0x26, 0xF0, + 0x7F, 0x67, 0x35, 0x18, 0x5B, 0xD9, 0x16, 0x60, 0x87, 0xF3, 0x25, 0xF0, 0x60, 0x40, 0x03, 0x3A, + 0x2D, 0x00, 0xA6, 0xF3, 0x20, 0x63, 0xE3, 0x83, 0x60, 0x46, 0x0F, 0xF8, 0x30, 0x61, 0x94, 0xFA, + 0x01, 0x61, 0x91, 0xFA, 0x16, 0x64, 0x12, 0xFA, 0x60, 0x40, 0x10, 0x36, 0x05, 0x00, 0x12, 0x36, + 0x08, 0x00, 0x0C, 0x36, 0x0B, 0x00, 0x0F, 0x00, 0x40, 0x61, 0xA1, 0x80, 0x0A, 0x64, 0x11, 0x02, + 0xF3, 0x01, 0x10, 0x61, 0xA1, 0x80, 0x0E, 0x64, 0x0C, 0x02, 0xEE, 0x01, 0x08, 0x61, 0xA1, 0x80, + 0x10, 0x64, 0x07, 0x02, 0xE9, 0x01, 0xE1, 0x81, 0xA1, 0x80, 0x05, 0x05, 0xC8, 0x84, 0x01, 0x02, + 0xE3, 0x01, 0x12, 0xFA, 0x91, 0xFA, 0x66, 0x44, 0x02, 0xA6, 0xD7, 0x1F, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x25, 0xF2, 0x19, 0x60, 0x45, 0xFB, 0x19, 0x60, 0x4C, 0xF3, 0xFF, 0xFF, 0x60, 0x40, + 0x08, 0x26, 0x18, 0x00, 0x19, 0x60, 0x45, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, 0x0A, 0x00, + 0x19, 0x60, 0x7B, 0xF3, 0xFF, 0xFF, 0x02, 0xBC, 0x60, 0x44, 0xA2, 0xDB, 0x19, 0x60, 0x45, 0xF3, + 0xFF, 0xFF, 0x60, 0x40, 0x02, 0x2A, 0x06, 0x00, 0x19, 0x60, 0x7B, 0xF3, 0xFF, 0xFF, 0x04, 0xBC, + 0x60, 0x44, 0xA2, 0xDB, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, 0x25, 0xF0, 0x02, 0xA8, + 0x00, 0x67, 0x02, 0x02, 0x2D, 0xF9, 0x2C, 0xF9, 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, 0x25, 0xF2, + 0x02, 0xA8, 0x00, 0xA8, 0x0A, 0x02, 0x07, 0x03, 0xD0, 0xA0, 0x30, 0x65, 0x03, 0x04, 0xA7, 0xA0, + 0x59, 0x65, 0x01, 0x06, 0x65, 0x44, 0x16, 0x60, 0xCE, 0xFB, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x25, 0xF2, 0x19, 0x60, 0x4C, 0xFB, 0xFF, 0xFF, 0x08, 0x2A, 0x25, 0x00, 0x19, 0x60, 0x7B, 0xF3, + 0xFF, 0xFF, 0xE9, 0xB4, 0x60, 0x44, 0x19, 0x60, 0x4C, 0xF1, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x26, + 0x02, 0xBC, 0x64, 0x40, 0x02, 0x2A, 0x04, 0xBC, 0x64, 0x40, 0x04, 0x26, 0x08, 0x00, 0x19, 0x60, + 0x7B, 0xFB, 0x13, 0x64, 0xCB, 0xFB, 0x01, 0x60, 0x67, 0x64, 0x37, 0xFB, 0x0C, 0x00, 0x10, 0xBC, + 0x19, 0x60, 0x7B, 0xFB, 0x08, 0x64, 0xCB, 0xFB, 0xA1, 0xF3, 0x01, 0x60, 0x67, 0x7C, 0x60, 0x40, + 0x01, 0x27, 0x5B, 0x7C, 0x37, 0xF9, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x25, 0xF2, 0x19, 0x60, + 0x4D, 0xFB, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x25, 0xF2, 0x19, 0x60, 0x4E, 0xFB, 0x00, 0x67, + 0x23, 0x58, 0xFF, 0xFF, 0x25, 0xF2, 0x19, 0x60, 0x89, 0xFB, 0xFF, 0xFF, 0x0F, 0x22, 0x41, 0x75, + 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x01, 0x64, 0x01, 0x00, 0x00, 0x64, 0x1B, 0x60, 0xFE, 0xFB, + 0x7E, 0x60, 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, 0x0E, 0x02, 0x06, 0x61, + 0x41, 0x56, 0xC7, 0xFE, 0x2A, 0x60, 0x1D, 0x78, 0xFF, 0xFF, 0x36, 0x47, 0xFF, 0x23, 0x04, 0x00, + 0x00, 0x7F, 0x60, 0x41, 0x7F, 0x67, 0x01, 0x00, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x7F, 0x60, + 0xC0, 0x64, 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, 0x0E, 0x02, 0x08, 0x61, 0x41, 0x56, + 0xC7, 0xFE, 0x2A, 0x60, 0x1D, 0x78, 0xFF, 0xFF, 0x36, 0x47, 0xFF, 0x23, 0x04, 0x00, 0x00, 0x7F, + 0x60, 0x41, 0x7F, 0x67, 0x01, 0x00, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x7F, 0x60, 0xC0, 0x64, + 0x24, 0x45, 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, 0x0E, 0x02, 0x0A, 0x61, 0x41, 0x56, 0xC7, 0xFE, + 0x2A, 0x60, 0x1D, 0x78, 0xFF, 0xFF, 0x36, 0x47, 0xFF, 0x23, 0x04, 0x00, 0x00, 0x7F, 0x60, 0x41, + 0x7F, 0x67, 0x01, 0x00, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x7E, 0x60, 0xC0, 0x64, 0x24, 0x45, + 0xA4, 0x80, 0x7F, 0x67, 0x02, 0x61, 0x11, 0x02, 0x65, 0x43, 0x19, 0x60, 0xA5, 0xFD, 0x0C, 0x61, + 0x41, 0x56, 0xC7, 0xFE, 0x2A, 0x60, 0x1D, 0x78, 0xFF, 0xFF, 0x36, 0x47, 0xFF, 0x23, 0x04, 0x00, + 0x00, 0x7F, 0x60, 0x41, 0x7F, 0x67, 0x01, 0x00, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x20, 0x64, + 0x23, 0xFA, 0x4A, 0x61, 0x10, 0x60, 0xDA, 0x64, 0xA0, 0xD1, 0xA1, 0xD8, 0x58, 0xD1, 0x59, 0xD8, + 0x58, 0xD1, 0x59, 0xD8, 0x01, 0xA1, 0x10, 0x60, 0xF2, 0x63, 0x5D, 0x65, 0xA3, 0xD3, 0x02, 0xA3, + 0x02, 0x1B, 0x7F, 0x64, 0x01, 0x00, 0xA3, 0xD3, 0x60, 0xFE, 0x5D, 0xDA, 0x20, 0xFE, 0xD5, 0x80, + 0x04, 0xA3, 0xF4, 0x02, 0x01, 0xA1, 0x10, 0x60, 0xE0, 0x64, 0xA0, 0xD1, 0xA1, 0xD8, 0x58, 0xD1, + 0x59, 0xD8, 0x58, 0xD1, 0x59, 0xD8, 0x01, 0xA1, 0x60, 0xFE, 0x07, 0x63, 0x7F, 0x64, 0xCF, 0x83, + 0x5D, 0xDA, 0xFD, 0x02, 0x20, 0xFE, 0x12, 0x60, 0x40, 0x7C, 0x11, 0x60, 0x62, 0x63, 0x7F, 0x65, + 0xA3, 0xD3, 0x02, 0xA3, 0x02, 0x1B, 0x7F, 0x64, 0x01, 0x00, 0xA3, 0xD3, 0x60, 0xFE, 0x5D, 0xDA, + 0x20, 0xFE, 0xD5, 0x80, 0x06, 0xA3, 0x03, 0x02, 0x46, 0x45, 0x00, 0xF4, 0x03, 0x61, 0xD3, 0x80, + 0xFF, 0xFF, 0xEE, 0x04, 0x25, 0x46, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x02, 0x63, 0x7D, 0xF3, + 0x23, 0xFC, 0x60, 0x40, 0x01, 0x23, 0x17, 0x00, 0x01, 0x60, 0xFF, 0x65, 0xA4, 0x84, 0x11, 0x60, + 0x60, 0x61, 0x12, 0x60, 0x40, 0x65, 0xA1, 0xD1, 0xD5, 0x80, 0xD0, 0x80, 0x0B, 0x03, 0x02, 0x03, + 0x08, 0xA1, 0xF9, 0x01, 0x04, 0xA1, 0xA1, 0xD3, 0x01, 0x60, 0x00, 0x65, 0x60, 0x47, 0xFF, 0xB4, + 0xB4, 0x84, 0x01, 0x00, 0xFF, 0x64, 0x25, 0xFA, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x0C, 0x63, + 0x23, 0xFC, 0xE2, 0xF3, 0x13, 0x60, 0xF2, 0x63, 0xCC, 0x84, 0xFF, 0xFF, 0x02, 0x06, 0x0C, 0xA3, + 0xFB, 0x01, 0x48, 0x61, 0x61, 0x44, 0x18, 0xA5, 0x60, 0xFE, 0xBD, 0xD3, 0x20, 0xFE, 0x00, 0x7F, + 0x59, 0xDA, 0xD5, 0x80, 0xFF, 0xFF, 0xF8, 0x04, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, 0x25, 0xF0, + 0x17, 0x60, 0x80, 0xF9, 0x11, 0x00, 0x0C, 0x60, 0xFE, 0x62, 0x40, 0x63, 0x5A, 0xDF, 0xFE, 0x1F, + 0x04, 0x65, 0x0C, 0x60, 0xFE, 0x61, 0x48, 0x64, 0x3E, 0x63, 0x7C, 0xA8, 0x58, 0xD0, 0x59, 0xD9, + 0x02, 0x02, 0x00, 0xF4, 0x02, 0x64, 0xF9, 0x1F, 0x17, 0x60, 0x80, 0xF1, 0x0C, 0x60, 0xDA, 0x65, + 0x02, 0xFE, 0x64, 0x44, 0xF8, 0x84, 0xF8, 0x84, 0xF8, 0x87, 0x60, 0x41, 0x64, 0x44, 0xE0, 0x84, + 0xE0, 0x84, 0xC4, 0x84, 0x3E, 0xFB, 0x60, 0x42, 0x61, 0x44, 0x03, 0xA2, 0x60, 0xFE, 0xA2, 0xDB, + 0x20, 0xFE, 0x64, 0x44, 0x0D, 0x60, 0x00, 0x65, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, + 0xC4, 0x84, 0x40, 0xFB, 0xFF, 0xFF, 0x00, 0x67, 0x00, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x5C, 0x41, + 0x25, 0xF2, 0xFF, 0xFF, 0x40, 0x42, 0x80, 0x2B, 0x04, 0x00, 0xFF, 0xB4, 0x40, 0x42, 0x01, 0x64, + 0x40, 0x41, 0xA6, 0xF3, 0x46, 0x4B, 0x60, 0x46, 0x20, 0x63, 0xE3, 0x83, 0xAB, 0x46, 0x26, 0xF0, + 0xAB, 0x46, 0x59, 0xF8, 0xAB, 0x46, 0x27, 0xF0, 0xAB, 0x46, 0x5A, 0xF8, 0xAB, 0x46, 0x28, 0xF0, + 0xAB, 0x46, 0x5B, 0xF8, 0x66, 0x44, 0x02, 0xA6, 0xF1, 0x1F, 0xA6, 0xF3, 0xFF, 0xFF, 0x60, 0x46, + 0xAB, 0x46, 0x0C, 0x60, 0x38, 0x65, 0x22, 0x44, 0xFF, 0xB4, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, + 0xE0, 0x84, 0xC4, 0x81, 0xC9, 0x81, 0x52, 0x64, 0x0E, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, + 0x21, 0x44, 0x01, 0x2A, 0x08, 0x00, 0xAB, 0x46, 0xF0, 0xA1, 0x76, 0x64, 0x0E, 0x63, 0x59, 0xD1, + 0x58, 0xD8, 0xFD, 0x1F, 0xAB, 0x46, 0x22, 0x44, 0xFF, 0xB4, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, + 0x0C, 0x60, 0x9A, 0x65, 0xC4, 0x81, 0x60, 0x45, 0xC9, 0x81, 0x62, 0x64, 0x06, 0x63, 0x58, 0xD0, + 0x59, 0xD9, 0xFD, 0x1F, 0x21, 0x44, 0x01, 0x2A, 0x08, 0x00, 0xAB, 0x46, 0xF8, 0xA1, 0xB6, 0x64, + 0x06, 0x63, 0x59, 0xD1, 0x58, 0xD8, 0xFD, 0x1F, 0xAB, 0x46, 0x65, 0x44, 0x0C, 0x60, 0xBA, 0x65, + 0xC4, 0x81, 0xC9, 0x81, 0x6A, 0x64, 0x06, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x22, 0x44, + 0xFF, 0xB4, 0xE0, 0x84, 0xE0, 0x85, 0xC4, 0x84, 0x0C, 0x60, 0x80, 0x65, 0xC4, 0x81, 0x72, 0x64, + 0x04, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0xAB, 0x46, 0x21, 0x44, 0x01, 0x2A, 0x06, 0x00, + 0xFA, 0xA1, 0x90, 0x64, 0x04, 0x63, 0x59, 0xD1, 0x58, 0xD8, 0xFD, 0x1F, 0x3B, 0xF0, 0x21, 0x44, + 0x01, 0x2A, 0x13, 0x00, 0x22, 0x44, 0x3D, 0xFB, 0x60, 0x41, 0x02, 0xFE, 0xF8, 0x84, 0xF8, 0x84, + 0xF8, 0x84, 0x3C, 0xFB, 0x0C, 0x60, 0x7C, 0x63, 0x88, 0xFF, 0xCD, 0x81, 0x06, 0xA3, 0xFD, 0x0D, + 0x8D, 0xFF, 0x3B, 0xFD, 0x64, 0x47, 0x80, 0xBF, 0x60, 0x5C, 0x22, 0x43, 0x80, 0x61, 0x88, 0xFF, + 0xCF, 0x83, 0xE1, 0x81, 0xFD, 0x0D, 0x8D, 0xFF, 0x61, 0x47, 0x31, 0x91, 0xB1, 0x84, 0x3B, 0xFA, + 0x1F, 0x63, 0xE3, 0x83, 0x66, 0x44, 0x02, 0xA6, 0x3B, 0xF0, 0x66, 0x44, 0xB1, 0x9C, 0x3B, 0xF8, + 0x02, 0xA6, 0xFA, 0x1F, 0xAB, 0x46, 0x00, 0x67, 0x00, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, + 0x25, 0xF0, 0x02, 0xA8, 0x00, 0x67, 0x22, 0x02, 0x3D, 0xF1, 0x64, 0x44, 0x03, 0xB4, 0x40, 0x42, + 0xD0, 0x80, 0xA6, 0xF3, 0xFF, 0xFF, 0x60, 0x46, 0xBB, 0xF4, 0x80, 0x61, 0x02, 0x02, 0xE3, 0x83, + 0xEB, 0x83, 0x22, 0x44, 0x88, 0xFF, 0xCC, 0x84, 0xE1, 0x81, 0xFD, 0x0D, 0x8D, 0xFF, 0x61, 0x47, + 0x31, 0x91, 0x9D, 0x85, 0xA7, 0x83, 0x3B, 0xFC, 0x1F, 0x63, 0xE3, 0x83, 0x66, 0x44, 0x02, 0xA6, + 0xBB, 0xF2, 0x66, 0x44, 0xA5, 0x81, 0xBB, 0xFA, 0x02, 0xA6, 0xFA, 0x1F, 0x00, 0x67, 0x23, 0x58, + 0xFF, 0xFF, 0x27, 0xF2, 0x1D, 0x60, 0xC0, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, + 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x27, 0xF0, 0x63, 0x46, + 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x26, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, + 0x06, 0x02, 0x61, 0x46, 0x25, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, + 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0xA6, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x01, 0x03, + 0x2A, 0x00, 0x43, 0x4B, 0xAB, 0x46, 0x3B, 0xF2, 0x80, 0x60, 0x30, 0x7C, 0xB0, 0x84, 0xA2, 0xDA, + 0x4E, 0x61, 0x76, 0x64, 0x0E, 0x63, 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0x58, 0xD8, 0xFB, 0x1F, + 0x90, 0x64, 0x04, 0x63, 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0x58, 0xD8, 0xFB, 0x1F, 0xD9, 0x81, + 0xA0, 0x64, 0x04, 0x63, 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0x58, 0xD8, 0xFB, 0x1F, 0xD9, 0x81, + 0xB6, 0x64, 0x0E, 0x63, 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0x58, 0xD8, 0xFB, 0x1F, 0x00, 0x67, + 0x00, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x01, 0x67, 0x20, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x27, 0xF2, + 0x1D, 0x60, 0xC0, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, + 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x27, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, + 0x0C, 0x02, 0x61, 0x46, 0x26, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, + 0x25, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, + 0xE8, 0x1B, 0xA6, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x01, 0x03, 0x0D, 0x00, 0x43, 0x4B, + 0xAB, 0x46, 0x3B, 0xF2, 0x80, 0x60, 0x30, 0x61, 0x9D, 0x85, 0xA4, 0x84, 0xA2, 0xDA, 0xAB, 0x46, + 0x00, 0x67, 0x00, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x01, 0x67, 0x20, 0x61, 0x23, 0x58, 0xFF, 0xFF, + 0x00, 0x64, 0x40, 0x41, 0x4A, 0x64, 0xA0, 0xD2, 0xFF, 0xFF, 0x40, 0x42, 0x80, 0x2B, 0x04, 0x00, + 0xFF, 0xB4, 0x40, 0x42, 0x01, 0x64, 0x40, 0x41, 0xA6, 0xF3, 0x46, 0x4B, 0x60, 0x46, 0x20, 0x63, + 0xE3, 0x83, 0xAB, 0x46, 0x32, 0xF0, 0xAB, 0x46, 0x59, 0xF8, 0xAB, 0x46, 0x33, 0xF0, 0xAB, 0x46, + 0x5A, 0xF8, 0xAB, 0x46, 0x34, 0xF0, 0xAB, 0x46, 0x5B, 0xF8, 0x66, 0x44, 0x02, 0xA6, 0xF1, 0x1F, + 0xA6, 0xF3, 0xFF, 0xFF, 0x60, 0x46, 0xAB, 0x46, 0x0C, 0x60, 0x38, 0x65, 0x22, 0x44, 0xFF, 0xB4, + 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x81, 0xC9, 0x81, 0x4A, 0x64, 0x0E, 0x63, + 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x21, 0x44, 0x01, 0x2A, 0x08, 0x00, 0xAB, 0x46, 0xF0, 0xA1, + 0x76, 0x64, 0x0E, 0x63, 0x59, 0xD1, 0x58, 0xD8, 0xFD, 0x1F, 0xAB, 0x46, 0x22, 0x44, 0xFF, 0xB4, + 0xE0, 0x84, 0xE0, 0x85, 0xC4, 0x84, 0x0C, 0x60, 0x80, 0x65, 0xC4, 0x81, 0x5A, 0x64, 0x04, 0x63, + 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0xAB, 0x46, 0x21, 0x44, 0x01, 0x2A, 0x06, 0x00, 0xFA, 0xA1, + 0x90, 0x64, 0x04, 0x63, 0x59, 0xD1, 0x58, 0xD8, 0xFD, 0x1F, 0x3B, 0xF0, 0x21, 0x44, 0x01, 0x2A, + 0x13, 0x00, 0x22, 0x44, 0x3D, 0xFB, 0x60, 0x41, 0x02, 0xFE, 0xF8, 0x84, 0xF8, 0x84, 0xF8, 0x84, + 0x3C, 0xFB, 0x0C, 0x60, 0x7C, 0x63, 0x88, 0xFF, 0xCD, 0x81, 0x06, 0xA3, 0xFD, 0x0D, 0x8D, 0xFF, + 0x3B, 0xFD, 0x64, 0x47, 0x80, 0xBF, 0x60, 0x5C, 0x22, 0x43, 0x80, 0x61, 0x88, 0xFF, 0xCF, 0x83, + 0xE1, 0x81, 0xFD, 0x0D, 0x8D, 0xFF, 0x61, 0x47, 0x31, 0x91, 0xB1, 0x84, 0x3B, 0xFA, 0x1F, 0x63, + 0xE3, 0x83, 0x66, 0x44, 0x02, 0xA6, 0x3B, 0xF0, 0x66, 0x44, 0xB1, 0x9C, 0x3B, 0xF8, 0x02, 0xA6, + 0xFA, 0x1F, 0xAB, 0x46, 0x00, 0x67, 0x00, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x23, 0xF2, 0x25, 0xF0, + 0x02, 0xA8, 0x00, 0x67, 0x22, 0x02, 0x3D, 0xF1, 0x64, 0x44, 0x03, 0xB4, 0x40, 0x42, 0xD0, 0x80, + 0xA6, 0xF3, 0xFF, 0xFF, 0x60, 0x46, 0xBB, 0xF4, 0x80, 0x61, 0x02, 0x02, 0xE3, 0x83, 0xEB, 0x83, + 0x22, 0x44, 0x88, 0xFF, 0xCC, 0x84, 0xE1, 0x81, 0xFD, 0x0D, 0x8D, 0xFF, 0x61, 0x47, 0x31, 0x91, + 0x9D, 0x85, 0xA7, 0x83, 0x3B, 0xFC, 0x1F, 0x63, 0xE3, 0x83, 0x66, 0x44, 0x02, 0xA6, 0xBB, 0xF2, + 0x66, 0x44, 0xA5, 0x81, 0xBB, 0xFA, 0x02, 0xA6, 0xFA, 0x1F, 0x00, 0x67, 0x23, 0x58, 0xFF, 0xFF, + 0x27, 0xF2, 0x1D, 0x60, 0xC0, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, + 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x27, 0xF0, 0x63, 0x46, 0xD0, 0x80, + 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x26, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, + 0x61, 0x46, 0x25, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, + 0x63, 0x46, 0xE8, 0x1B, 0xA6, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x01, 0x03, 0x21, 0x00, + 0x43, 0x4B, 0xAB, 0x46, 0x3B, 0xF2, 0x80, 0x60, 0x30, 0x7C, 0xB0, 0x84, 0xA2, 0xDA, 0x4E, 0x61, + 0x76, 0x64, 0x0E, 0x63, 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0x58, 0xD8, 0xFB, 0x1F, 0x90, 0x64, + 0x04, 0x63, 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0x58, 0xD8, 0xFB, 0x1F, 0xA0, 0x64, 0x04, 0x63, + 0xAB, 0x46, 0x59, 0xD0, 0xAB, 0x46, 0x58, 0xD8, 0xFB, 0x1F, 0x00, 0x67, 0x00, 0x61, 0x23, 0x58, + 0xFF, 0xFF, 0x01, 0x67, 0x20, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0x27, 0xF2, 0x1D, 0x60, 0xC0, 0x65, + 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, + 0x16, 0x18, 0x61, 0x46, 0x27, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, + 0x26, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x25, 0xF0, 0x63, 0x46, + 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0xA6, 0xF3, + 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x01, 0x03, 0x0D, 0x00, 0x43, 0x4B, 0xAB, 0x46, 0x3B, 0xF2, + 0x80, 0x60, 0x30, 0x61, 0x9D, 0x85, 0xA4, 0x84, 0xA2, 0xDA, 0xAB, 0x46, 0x00, 0x67, 0x00, 0x61, + 0x23, 0x58, 0xFF, 0xFF, 0x01, 0x67, 0x20, 0x61, 0x23, 0x58, 0xFF, 0xFF, 0xA2, 0xFF, 0x46, 0x45, + 0x02, 0xF0, 0x09, 0x60, 0x08, 0x64, 0xD0, 0x80, 0x00, 0xF4, 0x01, 0xF2, 0x66, 0x5C, 0x25, 0x46, + 0x56, 0x02, 0x70, 0x27, 0x54, 0x00, 0x12, 0x64, 0x03, 0xFA, 0x04, 0xF8, 0x0E, 0xF2, 0x87, 0xFC, + 0x8D, 0xFC, 0x8E, 0xFC, 0xDA, 0x82, 0x16, 0x61, 0x00, 0x63, 0xC9, 0x81, 0x5A, 0xDC, 0xFD, 0x02, + 0x60, 0x40, 0xF0, 0x3B, 0x16, 0x00, 0x32, 0x44, 0xAC, 0xF3, 0x01, 0xB0, 0xFA, 0xA0, 0x08, 0x24, + 0x2C, 0x05, 0xDC, 0x83, 0xF0, 0x67, 0x0E, 0xFA, 0x26, 0x60, 0x04, 0x64, 0x2B, 0xDB, 0x66, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xAC, 0xFD, 0x2B, 0xFF, 0xFE, 0x64, 0x3B, 0x42, 0x4A, 0xDB, + 0x4F, 0x00, 0xAD, 0xF3, 0x05, 0x65, 0xD4, 0x80, 0xDC, 0x83, 0x17, 0x05, 0xAD, 0xFD, 0x98, 0xFE, + 0x04, 0x04, 0x00, 0x7F, 0x08, 0x7E, 0x0E, 0xFA, 0x3B, 0xFF, 0x25, 0x60, 0xF8, 0x64, 0x2B, 0xDB, + 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0x0E, 0xF2, 0x2B, 0xFF, 0x60, 0x40, 0x08, 0x26, + 0xF7, 0xFE, 0xFD, 0x64, 0x3B, 0x42, 0x4A, 0xDB, 0x32, 0x00, 0xA9, 0xF3, 0xFF, 0xFF, 0xD8, 0xA0, + 0xFF, 0xFF, 0x0D, 0x04, 0x26, 0x60, 0x10, 0x64, 0x2B, 0xDB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xFC, 0x64, 0x3B, 0x42, 0x4A, 0xDB, 0x21, 0x00, 0x46, 0x45, + 0x00, 0x64, 0x2B, 0xDB, 0x25, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xA2, 0xFF, 0x00, 0xF4, 0x01, 0xF0, 0x0A, 0x18, 0x70, 0x67, 0xA0, 0x80, 0xF0, 0x67, 0x06, 0x03, + 0xC0, 0x84, 0x01, 0xFA, 0x25, 0x46, 0x25, 0x44, 0x80, 0xFC, 0x05, 0xFA, 0xB6, 0x60, 0x58, 0x4E, + 0xF5, 0x78, 0xFF, 0xFF, 0xD4, 0xFE, 0xA3, 0xFF, 0xFF, 0x64, 0x3B, 0x42, 0x4A, 0xDB, 0xD4, 0xFE, + 0xA3, 0xFF, 0x2D, 0x58, 0xFF, 0xFF, 0x25, 0x60, 0xFE, 0x64, 0x40, 0x47, 0x58, 0x4F, 0x0D, 0x00, + 0x25, 0x60, 0xF2, 0x64, 0x40, 0x47, 0x58, 0x4F, 0x18, 0x00, 0x26, 0x60, 0x0A, 0x64, 0x40, 0x47, + 0x58, 0x4F, 0x03, 0x00, 0x2A, 0x60, 0x1D, 0x78, 0xFF, 0xFF, 0x27, 0xD5, 0x0E, 0xF2, 0x0B, 0x18, + 0x60, 0x40, 0x01, 0x2A, 0x08, 0x00, 0x26, 0x60, 0x20, 0x64, 0x40, 0x4B, 0x34, 0x60, 0x58, 0x4D, + 0x08, 0x78, 0xFF, 0xFF, 0xF2, 0x01, 0x2F, 0x58, 0xFF, 0xFF, 0x27, 0xD5, 0x0E, 0xF2, 0x14, 0x18, + 0x60, 0x40, 0x01, 0x2A, 0x11, 0x00, 0x02, 0xF0, 0x09, 0x60, 0x08, 0x64, 0xD0, 0x80, 0xA2, 0xFF, + 0xAD, 0xF3, 0x02, 0x02, 0xCC, 0x84, 0xAD, 0xFB, 0x26, 0x60, 0x20, 0x64, 0x40, 0x4B, 0x34, 0x60, + 0x58, 0x4D, 0x08, 0x78, 0xFF, 0xFF, 0xE9, 0x01, 0x2F, 0x58, 0xFF, 0xFF, 0xFB, 0x64, 0x3A, 0x42, + 0x4A, 0xDB, 0xA2, 0xFF, 0xB0, 0xF3, 0xAC, 0xF3, 0xCC, 0x80, 0xFD, 0xA0, 0x01, 0x14, 0x1D, 0x05, + 0xB5, 0x60, 0x58, 0x4D, 0xFA, 0x78, 0xFF, 0xFF, 0xA2, 0xFF, 0x17, 0x03, 0xF0, 0x67, 0x0E, 0xFA, + 0x26, 0x60, 0x04, 0x64, 0x13, 0x60, 0x10, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0xF6, 0x64, 0x3A, 0x42, 0x4A, 0xDB, 0xB0, 0xF3, 0xAC, 0xF3, 0xCC, 0x83, + 0xDC, 0x84, 0x01, 0x15, 0xB0, 0xFD, 0xAC, 0xFB, 0xD4, 0xFE, 0xAF, 0xF3, 0xAD, 0xF3, 0x00, 0xA8, + 0xAE, 0xF1, 0x03, 0x02, 0xD0, 0x80, 0xFF, 0xFF, 0x26, 0x05, 0xB5, 0x60, 0x58, 0x4D, 0xFA, 0x78, + 0xFF, 0xFF, 0xA2, 0xFF, 0x20, 0x03, 0x00, 0x63, 0xAF, 0xF3, 0x0E, 0xFC, 0xCC, 0x84, 0xFF, 0x3A, + 0xAF, 0xFB, 0x98, 0xFE, 0x03, 0x04, 0x08, 0xBB, 0x0E, 0xFC, 0x3B, 0xFF, 0x25, 0x60, 0xF8, 0x64, + 0x13, 0x60, 0x10, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xF7, 0x64, 0x3A, 0x42, 0x4A, 0xDB, 0xAD, 0xF3, 0x0E, 0xF2, 0xDC, 0x83, 0x08, 0xB0, 0xAD, 0xFD, + 0x08, 0x28, 0xF7, 0xFE, 0xD4, 0xFE, 0xA3, 0xFF, 0x2A, 0x60, 0x1D, 0x78, 0xFF, 0xFF, 0xB9, 0xFE, + 0x13, 0xFF, 0x24, 0x40, 0x80, 0x2B, 0x0B, 0x00, 0xA2, 0xFF, 0x25, 0x46, 0x09, 0xF4, 0x0E, 0xF2, + 0x05, 0x18, 0x08, 0xBC, 0x0E, 0xFA, 0xFF, 0xFF, 0xF7, 0xFE, 0x01, 0x00, 0xD8, 0xFE, 0xA3, 0xFF, + 0x25, 0x46, 0x3E, 0xF2, 0x00, 0xF4, 0x08, 0xF0, 0x25, 0x46, 0x06, 0xB4, 0xFF, 0x7F, 0x10, 0xBC, + 0x06, 0x26, 0xFD, 0x7F, 0x0E, 0xFA, 0x3E, 0xF2, 0x3F, 0xF2, 0x60, 0x41, 0x08, 0x2A, 0x64, 0x47, + 0x3F, 0xFA, 0x60, 0x45, 0xB9, 0xFC, 0x16, 0x60, 0xAA, 0xF3, 0xA3, 0xFC, 0xAB, 0xFC, 0x91, 0xFC, + 0xD4, 0x80, 0x18, 0x60, 0x21, 0x65, 0xA5, 0x80, 0x01, 0x04, 0x07, 0x03, 0x23, 0xF0, 0x08, 0x64, + 0xB0, 0x84, 0xA2, 0xDA, 0x35, 0x60, 0xEA, 0x78, 0xFF, 0xFF, 0x36, 0x60, 0x58, 0x4F, 0x30, 0x78, + 0xFF, 0xFF, 0x0B, 0x04, 0x23, 0xF0, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0x2C, 0x60, 0xEE, 0x64, + 0xF1, 0x60, 0x78, 0x41, 0xE4, 0x78, 0xB5, 0xF1, 0x83, 0x00, 0xDB, 0xF3, 0xA6, 0xF1, 0x07, 0xB4, + 0x64, 0x43, 0xFD, 0xA0, 0x2C, 0xF2, 0x71, 0x02, 0x01, 0xB0, 0x64, 0x43, 0x78, 0x02, 0x2E, 0xF2, + 0x1D, 0x60, 0xC0, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, + 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x2E, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, + 0x0C, 0x02, 0x61, 0x46, 0x2D, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, + 0x2C, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, + 0xE8, 0x1B, 0xA6, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x51, 0x03, 0x63, 0x46, 0x80, 0xF6, + 0x25, 0x46, 0x43, 0x18, 0x2E, 0xF2, 0x66, 0x41, 0x1D, 0x60, 0xC0, 0x65, 0x60, 0x47, 0x00, 0x7F, + 0xA6, 0xF1, 0xE0, 0x84, 0x44, 0xD3, 0x64, 0x43, 0x11, 0x18, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, + 0xFC, 0x1B, 0x66, 0x44, 0x64, 0x46, 0x80, 0xF0, 0x60, 0x46, 0x80, 0xF8, 0x65, 0x46, 0x65, 0x43, + 0x80, 0xF0, 0x01, 0xFA, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x0B, 0x00, 0x64, 0x46, 0x62, 0x43, + 0x00, 0xF2, 0xA3, 0xDB, 0x60, 0x46, 0x80, 0xF0, 0x81, 0xFC, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, + 0x60, 0x43, 0x61, 0x46, 0x43, 0x4B, 0x2C, 0xF0, 0xAD, 0xF0, 0x2E, 0xF2, 0xAB, 0x46, 0x03, 0xF8, + 0x84, 0xF8, 0x05, 0xFA, 0x03, 0x64, 0x06, 0xFA, 0xAB, 0x46, 0x1F, 0x60, 0xC2, 0x61, 0xA1, 0xD3, + 0x20, 0x60, 0x04, 0x7C, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0xA0, 0xDD, 0xDA, 0x9C, 0xA1, 0xD9, + 0x49, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xA1, 0xDB, 0x0A, 0x00, 0xDB, 0xF3, 0x02, 0xA3, 0xFE, 0xA0, + 0xF9, 0xA0, 0x01, 0x06, 0x04, 0x02, 0x23, 0xF0, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0x07, 0xFC, + 0x23, 0xF2, 0xFF, 0xFF, 0x24, 0x1B, 0x16, 0x60, 0xAB, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x00, 0x3A, + 0x0F, 0x00, 0x25, 0x60, 0xC8, 0x64, 0x13, 0x60, 0x10, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x0E, 0xF2, 0xC1, 0xFE, 0x10, 0xAC, 0x0E, 0xFA, 0x1D, 0x00, + 0x25, 0x60, 0xDA, 0x64, 0x13, 0x60, 0x10, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0x0E, 0xF2, 0xC8, 0xFE, 0x10, 0xAC, 0x0E, 0xFA, 0x0E, 0x00, 0x25, 0x60, + 0xEC, 0x64, 0x13, 0x60, 0x10, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0x0E, 0xF2, 0xCE, 0xFE, 0x10, 0xAC, 0x0E, 0xFA, 0x2A, 0x60, 0x1D, 0x78, 0xFF, 0xFF, + 0xCB, 0x84, 0xC9, 0x83, 0xFF, 0xFF, 0x08, 0x04, 0x58, 0xD1, 0xA5, 0xD8, 0xDA, 0x85, 0x80, 0x3A, + 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0xF8, 0x1F, 0x2F, 0x58, 0xFF, 0xFF, 0x3E, 0xF2, 0xC9, 0xF1, + 0x08, 0xB0, 0x19, 0xF8, 0x57, 0x02, 0xEA, 0xF1, 0x2F, 0xF8, 0xEB, 0xF3, 0x30, 0xFA, 0x60, 0x45, + 0xEC, 0xF3, 0x31, 0xFA, 0x46, 0x4A, 0x00, 0xF4, 0x60, 0x43, 0x05, 0xF2, 0x06, 0xF2, 0xD0, 0x80, + 0x07, 0xF0, 0x05, 0x02, 0xD4, 0x80, 0xD3, 0x80, 0x02, 0x02, 0xDB, 0xF3, 0x03, 0x03, 0xAA, 0x46, + 0x42, 0xFE, 0x41, 0x00, 0x60, 0x40, 0x03, 0x2A, 0x20, 0x00, 0x02, 0xF2, 0x03, 0xF0, 0x04, 0xF2, + 0x60, 0x43, 0xAA, 0x46, 0x2C, 0xFC, 0x2D, 0xF8, 0x2E, 0xFA, 0x7F, 0xF1, 0x32, 0xF8, 0x80, 0xF1, + 0x33, 0xF8, 0x81, 0xF1, 0x34, 0xF8, 0x08, 0x64, 0x32, 0x40, 0x04, 0x2A, 0x0D, 0x00, 0x2C, 0xF0, + 0x39, 0xF0, 0x64, 0x40, 0x01, 0x26, 0x08, 0x00, 0x3E, 0xF2, 0xFF, 0xFF, 0x00, 0x60, 0xC0, 0xB4, + 0xE8, 0x84, 0xB0, 0x9C, 0x39, 0xF8, 0x88, 0x64, 0x1C, 0x00, 0x02, 0xF2, 0x03, 0xF0, 0x04, 0xF2, + 0x60, 0x43, 0xAA, 0x46, 0x32, 0xFC, 0x33, 0xF8, 0x34, 0xFA, 0x7F, 0xF1, 0x2C, 0xF8, 0x80, 0xF1, + 0x2D, 0xF8, 0x81, 0xF1, 0x2E, 0xF8, 0x01, 0x60, 0x08, 0x64, 0x32, 0x40, 0x04, 0x2A, 0x09, 0x00, + 0x3E, 0xF2, 0x39, 0xF0, 0x00, 0x60, 0xC0, 0xB4, 0xE8, 0x84, 0xB0, 0x9C, 0x39, 0xF8, 0x01, 0x60, + 0x88, 0x64, 0x2A, 0xFA, 0x02, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x36, 0x60, 0x22, 0x63, 0x20, 0x44, + 0xBD, 0xDB, 0x21, 0x44, 0xBD, 0xDB, 0x22, 0x44, 0xBD, 0xDB, 0x23, 0x44, 0xBD, 0xDB, 0x24, 0x44, + 0xBD, 0xDB, 0x25, 0x44, 0xBD, 0xDB, 0x26, 0x44, 0xBD, 0xDB, 0x27, 0x44, 0xBD, 0xDB, 0x28, 0x44, + 0xBD, 0xDB, 0x29, 0x44, 0xBD, 0xDB, 0x2A, 0x44, 0xBD, 0xDB, 0x2B, 0x44, 0xBD, 0xDB, 0x2C, 0x44, + 0xBD, 0xDB, 0x2D, 0x44, 0xBD, 0xDB, 0x2E, 0x44, 0xBD, 0xDB, 0x2F, 0x44, 0xBD, 0xDB, 0x1B, 0x60, + 0x0B, 0xFD, 0x37, 0x60, 0x42, 0x63, 0x1B, 0x60, 0x0C, 0xFD, 0x30, 0x44, 0x1B, 0x60, 0x0D, 0xFB, + 0x31, 0x44, 0x1B, 0x60, 0x0E, 0xFB, 0x32, 0x44, 0x1B, 0x60, 0x0F, 0xFB, 0x33, 0x44, 0x1B, 0x60, + 0x10, 0xFB, 0x81, 0xFF, 0x91, 0xFF, 0x58, 0x51, 0x44, 0x00, 0x82, 0xFF, 0x92, 0xFF, 0x58, 0x51, + 0x40, 0x00, 0x83, 0xFF, 0x93, 0xFF, 0x58, 0x51, 0x3C, 0x00, 0x84, 0xFF, 0x94, 0xFF, 0x58, 0x51, + 0x38, 0x00, 0x85, 0xFF, 0x95, 0xFF, 0x58, 0x51, 0x34, 0x00, 0x86, 0xFF, 0x96, 0xFF, 0x58, 0x51, + 0x30, 0x00, 0x87, 0xFF, 0x97, 0xFF, 0x58, 0x51, 0x2C, 0x00, 0x80, 0xFF, 0x90, 0xFF, 0x99, 0xFF, + 0x1B, 0x60, 0x0B, 0xF1, 0x30, 0x44, 0x64, 0x43, 0xBD, 0xDB, 0x31, 0x44, 0xBD, 0xDB, 0x32, 0x44, + 0xBD, 0xDB, 0x33, 0x44, 0xBD, 0xDB, 0x34, 0x44, 0xBD, 0xDB, 0x35, 0x44, 0xBD, 0xDB, 0x36, 0x44, + 0xBD, 0xDB, 0x37, 0x44, 0xBD, 0xDB, 0x38, 0x44, 0xBD, 0xDB, 0x39, 0x44, 0xBD, 0xDB, 0x3A, 0x44, + 0xBD, 0xDB, 0x3B, 0x44, 0xBD, 0xDB, 0x3C, 0x44, 0xBD, 0xDB, 0x3D, 0x44, 0xBD, 0xDB, 0x3E, 0x44, + 0xBD, 0xDB, 0x3F, 0x44, 0xBD, 0xDB, 0xF6, 0x60, 0x16, 0x64, 0x0A, 0xFB, 0x40, 0x21, 0xFE, 0x01, + 0x74, 0x00, 0x42, 0x50, 0x40, 0x53, 0x1B, 0x60, 0x0C, 0xF3, 0xFF, 0xFF, 0x40, 0x52, 0x33, 0x44, + 0x32, 0x42, 0xA2, 0xDB, 0xDA, 0x82, 0xA2, 0xDD, 0xDA, 0x83, 0x65, 0x44, 0xBD, 0xDB, 0x61, 0x44, + 0xBD, 0xDB, 0x66, 0x44, 0xBD, 0xDB, 0xBD, 0xD9, 0x30, 0x44, 0xBD, 0xDB, 0x99, 0xFF, 0xA4, 0x4C, + 0xBD, 0xDB, 0xA5, 0x4C, 0xBD, 0xDB, 0xA0, 0x4C, 0xBD, 0xDB, 0xA1, 0x4C, 0xBD, 0xDB, 0x98, 0xFF, + 0x1B, 0x60, 0x0C, 0xFD, 0x1B, 0x60, 0x0D, 0xF3, 0xFF, 0xFF, 0x40, 0x50, 0x1B, 0x60, 0x0F, 0xF3, + 0xFF, 0xFF, 0x40, 0x52, 0x1B, 0x60, 0x10, 0xF3, 0xFF, 0xFF, 0x40, 0x53, 0x31, 0x41, 0x1B, 0x60, + 0x0E, 0xF3, 0xFF, 0xFF, 0x40, 0x51, 0x1B, 0x60, 0x0B, 0xF3, 0xFF, 0xFF, 0x60, 0x43, 0x20, 0x44, + 0xBD, 0xDB, 0x21, 0x44, 0xBD, 0xDB, 0x22, 0x44, 0xBD, 0xDB, 0x23, 0x44, 0xBD, 0xDB, 0x24, 0x44, + 0xBD, 0xDB, 0x25, 0x44, 0xBD, 0xDB, 0x26, 0x44, 0xBD, 0xDB, 0x27, 0x44, 0xBD, 0xDB, 0x28, 0x44, + 0xBD, 0xDB, 0x29, 0x44, 0xBD, 0xDB, 0x2A, 0x44, 0xBD, 0xDB, 0x2B, 0x44, 0xBD, 0xDB, 0x2C, 0x44, + 0xBD, 0xDB, 0x2D, 0x44, 0xBD, 0xDB, 0x2E, 0x44, 0xBD, 0xDB, 0x2F, 0x44, 0xBD, 0xDB, 0x1B, 0x60, + 0x0B, 0xFD, 0x61, 0x58, 0xFF, 0xFF, 0x2F, 0x60, 0x4E, 0x63, 0xA3, 0xD3, 0x33, 0x5C, 0x02, 0xA4, + 0xBD, 0xDB, 0xFE, 0xB4, 0xE0, 0x85, 0xC4, 0x85, 0x47, 0xD9, 0x34, 0x44, 0x5B, 0xDB, 0x44, 0xF3, + 0x5B, 0xDB, 0xA1, 0xFF, 0xFF, 0xFF, 0x87, 0x3E, 0x84, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x87, 0x3E, + 0xFF, 0x01, 0x86, 0xE1, 0x80, 0xFF, 0x90, 0xFF, 0x88, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x87, 0x3E, + 0x19, 0x60, 0xF7, 0xF3, 0xFF, 0xFF, 0x10, 0x1B, 0x32, 0x40, 0x80, 0x2A, 0xF6, 0x01, 0x9D, 0xFE, + 0xF4, 0x05, 0xDB, 0xF3, 0xFF, 0xFF, 0x04, 0xA8, 0x33, 0x60, 0xE2, 0x62, 0x01, 0x02, 0xBD, 0x00, + 0xA2, 0xD3, 0xFF, 0xFF, 0x4A, 0x1B, 0xE9, 0x01, 0x87, 0xFF, 0x20, 0x44, 0x80, 0xFF, 0x60, 0x40, + 0x80, 0x26, 0xE3, 0x01, 0xF1, 0xFC, 0xAD, 0x4F, 0xFD, 0xB4, 0xA0, 0x5D, 0xC0, 0x60, 0x40, 0xEC, + 0xC0, 0x60, 0x00, 0xED, 0xC0, 0x60, 0x80, 0xEE, 0xAC, 0x4F, 0xBF, 0xB4, 0xA0, 0x5C, 0x19, 0x60, + 0x48, 0xF1, 0xFF, 0xFF, 0x64, 0x40, 0x02, 0x27, 0x06, 0x00, 0x28, 0xE2, 0x24, 0xE2, 0x40, 0x21, + 0xFE, 0x01, 0x75, 0x40, 0x0D, 0x00, 0x28, 0xE2, 0x24, 0xE2, 0x75, 0x40, 0x80, 0x2B, 0xAB, 0xFF, + 0x14, 0xE0, 0x94, 0xE0, 0x40, 0x21, 0xFE, 0x01, 0x10, 0xE0, 0x75, 0x40, 0xFF, 0xFF, 0xFF, 0xFF, + 0x33, 0x60, 0xEE, 0x62, 0xA2, 0xDF, 0x01, 0x60, 0x39, 0xE2, 0x04, 0x60, 0x00, 0x7A, 0xAC, 0x4F, + 0x40, 0xBC, 0x00, 0x7F, 0xA0, 0x5C, 0xC0, 0x60, 0x59, 0xEC, 0xC0, 0x60, 0x07, 0xED, 0xC0, 0x60, + 0x8F, 0xEE, 0xAE, 0x4F, 0x04, 0xBC, 0x00, 0x7F, 0xA0, 0x5E, 0x26, 0x61, 0xCD, 0x81, 0xFF, 0xFF, + 0xFD, 0x02, 0xAE, 0x4F, 0xFB, 0xB4, 0xA0, 0x5E, 0xA0, 0x01, 0xF1, 0xFC, 0xAD, 0x4F, 0xFD, 0xB4, + 0xA0, 0x5D, 0x15, 0x60, 0x80, 0xE7, 0xC0, 0x60, 0x40, 0xEC, 0xC0, 0x60, 0x00, 0xED, 0xAC, 0x4F, + 0xBF, 0xB4, 0xA0, 0x5C, 0xC0, 0x60, 0x84, 0xEE, 0xAE, 0x4F, 0x04, 0xBC, 0x00, 0x7F, 0xA0, 0x5E, + 0x00, 0x7A, 0x0F, 0x60, 0x19, 0xE2, 0x0E, 0x60, 0x36, 0xF3, 0xFF, 0xFF, 0x60, 0x41, 0x75, 0x44, + 0x80, 0x2B, 0xAB, 0xFF, 0x80, 0x27, 0x08, 0x00, 0x14, 0xE0, 0x94, 0xE0, 0x34, 0xE2, 0x61, 0x5A, + 0x48, 0x21, 0xFE, 0x01, 0x00, 0xE0, 0x75, 0x40, 0x0A, 0x60, 0x19, 0xE2, 0x00, 0x64, 0x19, 0x60, + 0xF1, 0xFB, 0x08, 0x60, 0x15, 0xF1, 0x08, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x01, 0x64, 0x19, 0x60, 0xF2, 0xFB, 0xFF, 0xFF, 0x10, 0xE0, 0x01, 0x60, 0x34, 0xE2, 0xFF, 0xFF, + 0x05, 0x7A, 0xAC, 0x4F, 0x40, 0xBC, 0x00, 0x7F, 0xA0, 0x5C, 0xC0, 0x60, 0x59, 0xEC, 0xC0, 0x60, + 0x07, 0xED, 0xC0, 0x60, 0x8F, 0xEE, 0xAE, 0x4F, 0x04, 0xBC, 0x00, 0x7F, 0xA0, 0x5E, 0x1B, 0x60, + 0xF3, 0xF1, 0xAD, 0x4F, 0x00, 0x7F, 0xFA, 0xB4, 0x64, 0x41, 0x7D, 0xF1, 0x02, 0xB1, 0x04, 0x65, + 0x02, 0x02, 0x64, 0x40, 0x01, 0x2B, 0x01, 0x65, 0xB4, 0x84, 0xA0, 0x5D, 0x26, 0x61, 0xCD, 0x81, + 0xFF, 0xFF, 0xFD, 0x02, 0xAE, 0x4F, 0xFB, 0xB4, 0xA0, 0x5E, 0x1B, 0x60, 0xF3, 0xF1, 0xAD, 0x4F, + 0x00, 0x7F, 0xFA, 0xB4, 0x64, 0x41, 0x7D, 0xF1, 0x02, 0xB1, 0x04, 0x65, 0x02, 0x02, 0x64, 0x40, + 0x01, 0x2B, 0x01, 0x65, 0xB4, 0x84, 0xA0, 0x5D, 0x30, 0x01, 0x19, 0x60, 0xF3, 0xF3, 0xFF, 0xFF, + 0x01, 0x1B, 0x2B, 0x01, 0x31, 0x44, 0x04, 0x2A, 0x28, 0x01, 0x08, 0x26, 0x26, 0x01, 0x19, 0x60, + 0xF4, 0xF3, 0xFF, 0xFF, 0x01, 0x18, 0x21, 0x01, 0x7E, 0xF5, 0xF1, 0xFC, 0xAD, 0x4F, 0xFD, 0xB4, + 0xA0, 0x5D, 0x15, 0x60, 0x80, 0xE7, 0xC0, 0x60, 0x40, 0xEC, 0xC0, 0x60, 0x00, 0xED, 0xAC, 0x4F, + 0xBF, 0xB4, 0xA0, 0x5C, 0xC0, 0x60, 0x84, 0xEE, 0xAE, 0x4F, 0x04, 0xBC, 0x00, 0x7F, 0xA0, 0x5E, + 0x00, 0x7A, 0x2D, 0x60, 0x5A, 0x63, 0xA3, 0xD1, 0x05, 0x60, 0xDC, 0x64, 0xD0, 0x80, 0x00, 0x64, + 0x01, 0x06, 0x01, 0x64, 0x40, 0x4E, 0xB2, 0xF1, 0x66, 0x41, 0xE1, 0x81, 0xE1, 0x81, 0xE1, 0x81, + 0xE1, 0x81, 0x61, 0x46, 0x73, 0x42, 0x5A, 0x92, 0x3F, 0x64, 0xA0, 0x84, 0x60, 0x47, 0xE0, 0x84, + 0xE0, 0x85, 0x62, 0x47, 0xE8, 0x84, 0xE8, 0x84, 0x3F, 0xB4, 0x60, 0x41, 0x64, 0x44, 0x14, 0x90, + 0x3F, 0x26, 0xCC, 0x84, 0x14, 0x90, 0x3F, 0x26, 0xCC, 0x84, 0x62, 0x41, 0x60, 0x55, 0xB2, 0xFB, + 0x72, 0x5C, 0x67, 0x42, 0xD2, 0x80, 0xA2, 0x48, 0x20, 0x2B, 0x05, 0x00, 0x01, 0x02, 0x7C, 0x5C, + 0x04, 0x60, 0x00, 0x64, 0xC4, 0x85, 0xE8, 0xE2, 0xE4, 0xE2, 0x61, 0x42, 0x49, 0x91, 0x64, 0x44, + 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xB4, 0x84, 0x60, 0x45, + 0x51, 0x94, 0x04, 0x60, 0x00, 0x61, 0x01, 0x0D, 0x44, 0x94, 0x62, 0x41, 0x19, 0x60, 0xF5, 0xF1, + 0x61, 0x42, 0x64, 0x43, 0xCF, 0x83, 0xCF, 0x83, 0x03, 0x03, 0xE3, 0x83, 0x48, 0x94, 0xFE, 0x1F, + 0x2E, 0x40, 0x01, 0x26, 0xE0, 0x84, 0x60, 0x41, 0xE9, 0x81, 0xE9, 0x81, 0xE9, 0x81, 0xE9, 0x81, + 0x44, 0x94, 0xE9, 0x81, 0xE9, 0x81, 0x54, 0x94, 0xE9, 0x81, 0xE9, 0x81, 0xE9, 0x81, 0x44, 0x94, + 0xE9, 0x81, 0xE9, 0x81, 0xE9, 0x81, 0x54, 0x94, 0x19, 0xE2, 0x2E, 0x40, 0x01, 0x26, 0xE8, 0x84, + 0x29, 0x61, 0x54, 0x91, 0x61, 0x43, 0x11, 0x06, 0x75, 0x44, 0x80, 0x2B, 0xAB, 0xFF, 0x80, 0x27, + 0x0C, 0x00, 0x14, 0xE0, 0x94, 0xE0, 0x34, 0xE2, 0x61, 0x5A, 0x48, 0x21, 0xFE, 0x01, 0x00, 0xE0, + 0x7A, 0x43, 0x15, 0xA1, 0x75, 0x40, 0x80, 0x2B, 0x06, 0xA1, 0x5D, 0x91, 0x61, 0x44, 0x2E, 0x40, + 0x01, 0x26, 0xE0, 0x84, 0x60, 0x43, 0xEB, 0x83, 0xEB, 0x83, 0xEB, 0x83, 0x89, 0xFF, 0x10, 0xE0, + 0x80, 0x60, 0x00, 0x75, 0x88, 0xFF, 0xEB, 0x83, 0xEB, 0x83, 0x5C, 0x94, 0xEB, 0x83, 0x5C, 0x94, + 0xEB, 0x83, 0xEB, 0x83, 0xEB, 0x83, 0xEB, 0x83, 0xEB, 0x83, 0x4C, 0x94, 0x2E, 0x40, 0x01, 0x26, + 0xE8, 0x84, 0x60, 0x43, 0x65, 0x41, 0x62, 0x45, 0xD5, 0x85, 0x04, 0x60, 0x00, 0x61, 0x01, 0x0D, + 0xC5, 0x85, 0xC4, 0x84, 0x60, 0x43, 0x62, 0x41, 0xE1, 0x81, 0xE1, 0x81, 0xE1, 0x81, 0xE1, 0x81, + 0xE1, 0x81, 0xE1, 0x9C, 0x00, 0x61, 0xDD, 0x81, 0x58, 0x94, 0x4A, 0x92, 0xFC, 0x05, 0x41, 0x4F, + 0x00, 0x61, 0x62, 0x45, 0x1C, 0x60, 0x0A, 0xF3, 0xE3, 0x83, 0xF1, 0x81, 0xE3, 0x83, 0xF1, 0x81, + 0xE3, 0x83, 0xF1, 0x81, 0xE3, 0x83, 0xF1, 0x81, 0xE3, 0x83, 0xF1, 0x81, 0xE3, 0x83, 0xF1, 0x81, + 0xA0, 0x52, 0xB2, 0xF3, 0xC3, 0x9C, 0x44, 0x94, 0x01, 0x04, 0xDC, 0x84, 0x60, 0x55, 0xB2, 0xFB, + 0x64, 0x52, 0xE9, 0xE2, 0x65, 0x53, 0xB3, 0xF3, 0x06, 0x04, 0xDC, 0x84, 0xB3, 0xFB, 0xB4, 0xF3, + 0x02, 0x04, 0xDC, 0x84, 0xB4, 0xFB, 0x2F, 0x43, 0xCF, 0x83, 0x6C, 0xF3, 0xFF, 0xFF, 0x5C, 0x94, + 0xFF, 0xFF, 0x0C, 0x24, 0x01, 0x64, 0x6C, 0xFB, 0x16, 0x60, 0xAC, 0xF1, 0xFF, 0xFF, 0x03, 0x1B, + 0x31, 0x40, 0x02, 0x2A, 0x07, 0x00, 0x73, 0xF3, 0xFF, 0xFF, 0x5C, 0x94, 0xFF, 0xFF, 0x0C, 0x24, + 0x00, 0x64, 0x73, 0xFB, 0x19, 0x60, 0xF5, 0xF3, 0x01, 0x7C, 0x5C, 0x94, 0x00, 0x36, 0x01, 0x64, + 0xA2, 0xDB, 0x19, 0x60, 0xF2, 0xF9, 0x01, 0x60, 0x34, 0xE2, 0x32, 0x7A, 0xAC, 0x4F, 0x40, 0xBC, + 0x00, 0x7F, 0xA0, 0x5C, 0xC0, 0x60, 0x59, 0xEC, 0xC0, 0x60, 0x07, 0xED, 0xC0, 0x60, 0x8F, 0xEE, + 0xAE, 0x4F, 0x04, 0xBC, 0x00, 0x7F, 0xA0, 0x5E, 0x0A, 0x61, 0xCD, 0x81, 0xFF, 0xFF, 0xFD, 0x02, + 0xAE, 0x4F, 0xFB, 0xB4, 0xA0, 0x5E, 0x1B, 0x60, 0xF3, 0xF1, 0xAD, 0x4F, 0x00, 0x7F, 0xFA, 0xB4, + 0x64, 0x41, 0x7D, 0xF1, 0x02, 0xB1, 0x04, 0x65, 0x02, 0x02, 0x64, 0x40, 0x01, 0x2B, 0x01, 0x65, + 0xB4, 0x84, 0xA0, 0x5D, 0x37, 0x60, 0x7F, 0x78, 0xFF, 0xFF, 0x24, 0xE2, 0x2D, 0xF3, 0x2C, 0xF3, + 0x00, 0xBD, 0xCC, 0x84, 0x08, 0x03, 0x2C, 0xFB, 0x06, 0x02, 0x65, 0x44, 0x2C, 0xFB, 0x8A, 0xFF, + 0x80, 0x60, 0x00, 0x75, 0x88, 0xFF, 0x44, 0xF3, 0xFF, 0xFF, 0xDC, 0x84, 0x44, 0xFB, 0x2F, 0x60, + 0x4A, 0x65, 0x2F, 0x60, 0x48, 0x61, 0xA5, 0xD3, 0xA1, 0xD3, 0x11, 0x18, 0xCC, 0x84, 0xA1, 0xDB, + 0x0E, 0x02, 0xA5, 0xD3, 0xA1, 0xDB, 0x17, 0x60, 0xA7, 0xF3, 0x17, 0x60, 0xA6, 0xF1, 0xA2, 0xDB, + 0xD0, 0x80, 0xFF, 0xFF, 0x04, 0x03, 0x8A, 0xFF, 0x20, 0x60, 0x00, 0x75, 0x88, 0xFF, 0xF1, 0xF3, + 0x31, 0x40, 0x01, 0x2A, 0x3D, 0x00, 0x60, 0x43, 0x04, 0xB0, 0x02, 0xB0, 0x08, 0x24, 0x16, 0x02, + 0x10, 0xB0, 0x29, 0x44, 0x34, 0x02, 0x00, 0xA8, 0xCC, 0x81, 0x0D, 0x03, 0x41, 0x49, 0x2F, 0x02, + 0x63, 0x40, 0x08, 0x2A, 0x08, 0x00, 0xF7, 0xB3, 0x1B, 0x60, 0xF6, 0xF1, 0xAD, 0x4F, 0xFD, 0xB4, + 0xA0, 0x5D, 0x44, 0x49, 0x24, 0x00, 0x63, 0x40, 0x02, 0x2A, 0x10, 0x00, 0x1B, 0x60, 0xF7, 0xF3, + 0x1B, 0x60, 0xF5, 0xFB, 0x40, 0x49, 0x1B, 0x60, 0xF8, 0xF3, 0x1B, 0x60, 0xF6, 0xFB, 0x0C, 0xBB, + 0xFD, 0xB3, 0xAD, 0x4F, 0x02, 0xBC, 0x00, 0x7F, 0xA0, 0x5D, 0x11, 0x00, 0x1B, 0x60, 0xF9, 0xF3, + 0x37, 0x60, 0xEA, 0x7C, 0x0C, 0x18, 0xA4, 0xDB, 0x40, 0x49, 0x1B, 0x60, 0xFA, 0xF3, 0x1B, 0x60, + 0xF6, 0xFB, 0x08, 0xBB, 0xFB, 0xB3, 0xAD, 0x4F, 0x02, 0xBC, 0x00, 0x7F, 0xA0, 0x5D, 0xF1, 0xFD, + 0x00, 0x60, 0xA4, 0xF3, 0x62, 0x43, 0x17, 0x18, 0x58, 0xD3, 0x62, 0x41, 0x03, 0x18, 0xCC, 0x84, + 0xA1, 0xDB, 0x11, 0x00, 0x49, 0xD3, 0xA3, 0xDB, 0x06, 0xA1, 0xA1, 0xD3, 0x59, 0xD1, 0x60, 0x45, + 0xA5, 0xD3, 0x59, 0xD1, 0xB0, 0x84, 0xA5, 0xDB, 0x64, 0x44, 0x06, 0x36, 0xCD, 0xFE, 0x07, 0x36, + 0xD6, 0xFE, 0xE6, 0x01, 0x23, 0x46, 0xB8, 0x60, 0x03, 0x78, 0xFF, 0xFF, 0x46, 0x43, 0x26, 0x60, + 0x3E, 0x61, 0xA1, 0xD3, 0x59, 0xD1, 0x06, 0x1B, 0x59, 0xD3, 0x59, 0xD1, 0x03, 0x1B, 0x59, 0xD3, + 0x59, 0xD1, 0xF0, 0x18, 0x00, 0x63, 0x49, 0xDD, 0x60, 0x40, 0x02, 0x36, 0x11, 0x00, 0x03, 0x36, + 0x32, 0x00, 0x01, 0x36, 0x08, 0x00, 0x05, 0x3A, 0xEA, 0x01, 0xA4, 0xD3, 0x5A, 0xD3, 0x9C, 0x85, + 0xA4, 0x84, 0xA2, 0xDB, 0xE4, 0x01, 0x01, 0x60, 0x48, 0x61, 0x00, 0x64, 0xA1, 0xDB, 0xDF, 0x01, + 0x3A, 0x60, 0x3E, 0x64, 0x40, 0x45, 0x22, 0x00, 0x01, 0x60, 0x48, 0x66, 0xA6, 0xD3, 0x04, 0xA1, + 0x60, 0x43, 0xA1, 0xD3, 0xC9, 0x81, 0x60, 0x45, 0x00, 0xBB, 0xA1, 0xDB, 0xBE, 0xD3, 0x09, 0x03, + 0xD4, 0x84, 0x9C, 0x84, 0xDC, 0x84, 0xFF, 0xFF, 0x04, 0x0E, 0xA3, 0xD1, 0x63, 0x46, 0x64, 0x43, + 0xF2, 0x01, 0x9C, 0x84, 0xDC, 0x85, 0x49, 0xDD, 0x61, 0x44, 0x00, 0xBB, 0xA6, 0xDB, 0x02, 0x03, + 0x65, 0x44, 0xBE, 0xDB, 0xBC, 0x01, 0x3A, 0x60, 0x19, 0x64, 0x40, 0x45, 0x01, 0x60, 0x48, 0x66, + 0xA6, 0xD3, 0xFF, 0xFF, 0xD0, 0x80, 0x0F, 0x18, 0x02, 0x03, 0x60, 0x46, 0xF9, 0x01, 0x58, 0xD3, + 0xA4, 0xD3, 0x60, 0x45, 0x00, 0x63, 0xA4, 0xDD, 0x05, 0x18, 0x58, 0xD3, 0xFF, 0xFF, 0xC4, 0x83, + 0xA2, 0xDD, 0xCA, 0x84, 0xA6, 0xDB, 0x25, 0x58, 0x64, 0x41, 0x00, 0x60, 0x46, 0x74, 0xCD, 0xE2, + 0x04, 0xE1, 0x02, 0x60, 0x00, 0xE1, 0x3F, 0x44, 0x40, 0x26, 0x05, 0x00, 0x1C, 0x60, 0x0F, 0xF3, + 0x5A, 0xD1, 0xA0, 0x50, 0xA4, 0x50, 0x3F, 0x40, 0x02, 0x2B, 0x03, 0x00, 0x3A, 0x60, 0xB7, 0x78, + 0xFF, 0xFF, 0x04, 0x29, 0xFE, 0x01, 0xC4, 0xE2, 0x43, 0x64, 0x3A, 0xDB, 0xA1, 0xF3, 0xFF, 0xFF, + 0x60, 0x41, 0x3F, 0x44, 0xFF, 0x01, 0x3F, 0x40, 0x40, 0x26, 0x05, 0x00, 0x1C, 0x60, 0x0D, 0xF3, + 0x5A, 0xD1, 0xA0, 0x50, 0xA4, 0x52, 0xC4, 0xE2, 0x32, 0x7B, 0x4D, 0xE2, 0xBF, 0xFE, 0xC4, 0xE2, + 0x41, 0xFF, 0xE0, 0xFE, 0xE1, 0xFE, 0xE2, 0xFE, 0x43, 0xFF, 0x44, 0xFF, 0x46, 0xFF, 0xA2, 0xF3, + 0x62, 0xFF, 0x60, 0x40, 0x05, 0x36, 0x2D, 0xFF, 0x07, 0x36, 0xD5, 0xFE, 0x08, 0xE1, 0x88, 0x60, + 0x85, 0x71, 0x8D, 0xE2, 0xA2, 0x60, 0x41, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x10, 0x62, 0x3D, 0x60, + 0x58, 0x4D, 0x3B, 0x78, 0xFF, 0xFF, 0x64, 0x41, 0xA9, 0x9C, 0x60, 0x45, 0x3D, 0x60, 0x58, 0x4D, + 0x0F, 0x78, 0xFF, 0xFF, 0xA1, 0xF1, 0x09, 0x60, 0xB4, 0x61, 0x64, 0x44, 0x01, 0x27, 0x24, 0x00, + 0x60, 0x40, 0x0E, 0x3A, 0x0D, 0x00, 0x01, 0x7C, 0x14, 0x60, 0x6F, 0xF9, 0x44, 0x60, 0x08, 0x7C, + 0x14, 0x60, 0x41, 0xF9, 0x16, 0x60, 0x62, 0xF1, 0x02, 0x60, 0xB0, 0x61, 0xB1, 0x9C, 0x26, 0x00, + 0x00, 0x7C, 0x14, 0x60, 0x6F, 0xF9, 0x40, 0x60, 0x08, 0x7C, 0x14, 0x60, 0x41, 0xF9, 0x16, 0x60, + 0x62, 0xF1, 0x02, 0x60, 0x90, 0x61, 0xB1, 0x9C, 0x09, 0x60, 0x67, 0x65, 0xFF, 0xB4, 0xC4, 0x85, + 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x81, 0x12, 0x00, 0xFF, 0xB4, 0xED, 0xA0, 0x2C, 0x60, 0xC6, 0x61, + 0x04, 0x04, 0xE2, 0xA0, 0xD9, 0x81, 0x01, 0x04, 0xD9, 0x81, 0xA1, 0xD1, 0x02, 0x60, 0x50, 0x61, + 0x26, 0x60, 0xF0, 0x65, 0xE0, 0x84, 0x44, 0xD3, 0xB1, 0x9C, 0xC8, 0x81, 0x61, 0x47, 0x00, 0x7E, + 0xE9, 0x81, 0x07, 0x60, 0xF0, 0x65, 0xA5, 0x81, 0x0B, 0xB9, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x85, + 0xB5, 0x85, 0x04, 0x60, 0x44, 0x62, 0x3D, 0x60, 0x58, 0x4D, 0x0F, 0x78, 0xFF, 0xFF, 0xA1, 0xF3, + 0xC8, 0x61, 0x61, 0x54, 0xCD, 0xE2, 0x60, 0x40, 0x01, 0x27, 0x2E, 0x00, 0xCC, 0x84, 0xE0, 0x85, + 0x15, 0x60, 0xA2, 0xE7, 0x26, 0x60, 0x80, 0x64, 0x3D, 0x60, 0x58, 0x4F, 0x04, 0x78, 0xFF, 0xFF, + 0x26, 0x60, 0x9C, 0x64, 0x3D, 0x60, 0x58, 0x4F, 0x04, 0x78, 0xFF, 0xFF, 0x26, 0x60, 0xB8, 0x64, + 0x3D, 0x60, 0x58, 0x4F, 0x04, 0x78, 0xFF, 0xFF, 0x26, 0x60, 0xD4, 0x64, 0x3D, 0x60, 0x58, 0x4F, + 0x04, 0x78, 0xFF, 0xFF, 0x75, 0x64, 0x06, 0x61, 0x61, 0x48, 0x60, 0x44, 0x80, 0xBC, 0xFF, 0xB4, + 0x60, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x28, 0x60, 0xE6, 0x7C, 0x07, 0x60, 0xE8, 0xF9, + 0x28, 0x60, 0x6E, 0x63, 0x14, 0x61, 0x21, 0x00, 0x14, 0x60, 0xDF, 0xF1, 0xFF, 0xB4, 0xED, 0xA0, + 0x64, 0x41, 0x04, 0x04, 0xE2, 0xA0, 0xD9, 0x81, 0x01, 0x04, 0xD9, 0x81, 0xA1, 0xD1, 0x14, 0x60, + 0x0E, 0xF3, 0x64, 0x41, 0xFF, 0xB1, 0xFF, 0x60, 0x00, 0x65, 0xA4, 0x84, 0x34, 0x94, 0xA2, 0xDB, + 0x5A, 0xD3, 0x64, 0x41, 0xA5, 0x81, 0xFF, 0xB4, 0x34, 0x94, 0xA2, 0xDB, 0x29, 0x60, 0x52, 0x7C, + 0x07, 0x60, 0xE8, 0xF9, 0x27, 0x60, 0xFC, 0x63, 0x13, 0x61, 0x3D, 0x60, 0x58, 0x4D, 0x23, 0x78, + 0xFF, 0xFF, 0x07, 0x60, 0xE8, 0xF3, 0x31, 0x40, 0x80, 0x26, 0x36, 0xA4, 0x07, 0x60, 0xE8, 0xFB, + 0x60, 0x43, 0x09, 0x61, 0x3D, 0x60, 0x58, 0x4D, 0x23, 0x78, 0xFF, 0xFF, 0xA1, 0xF3, 0x29, 0x60, + 0xBE, 0x61, 0x00, 0x7C, 0x7E, 0x63, 0x59, 0xD9, 0xFE, 0x1F, 0x60, 0x40, 0x01, 0x27, 0x03, 0x00, + 0x2A, 0x60, 0x40, 0x65, 0x15, 0x00, 0xFF, 0xB4, 0xF9, 0xA0, 0x2A, 0x60, 0x62, 0x65, 0x01, 0x7C, + 0x0D, 0x04, 0xED, 0xA0, 0x2A, 0x60, 0x84, 0x65, 0x11, 0x7C, 0x08, 0x04, 0xE2, 0xA0, 0x2A, 0x60, + 0xA6, 0x65, 0x21, 0x7C, 0x03, 0x04, 0x2A, 0x60, 0xC8, 0x65, 0x31, 0x7C, 0x64, 0x5F, 0x7D, 0xFB, + 0xA5, 0xD3, 0xDA, 0x85, 0xF0, 0xA0, 0x29, 0x60, 0xBE, 0x61, 0x08, 0x06, 0x40, 0x54, 0x58, 0x53, + 0x08, 0xFF, 0x37, 0x60, 0x7A, 0x64, 0x43, 0xFB, 0x08, 0xFF, 0xFF, 0x01, 0x60, 0x43, 0x60, 0x46, + 0xA5, 0xD1, 0xDA, 0x85, 0xA5, 0xD3, 0xDA, 0x85, 0x59, 0xD9, 0x59, 0xDB, 0x59, 0xD9, 0x59, 0xDB, + 0xFB, 0x1F, 0x0C, 0x63, 0xA5, 0xD1, 0xDA, 0x85, 0xA5, 0xD3, 0xDA, 0x85, 0x59, 0xD9, 0x59, 0xDB, + 0x59, 0xD9, 0x59, 0xDB, 0xF7, 0x1F, 0x66, 0x44, 0x0E, 0x63, 0x53, 0x93, 0x60, 0x40, 0x10, 0x36, + 0x07, 0x00, 0x65, 0x44, 0x48, 0xD3, 0x59, 0xD9, 0x59, 0xDB, 0x59, 0xD9, 0x59, 0xDB, 0xFB, 0x1F, + 0x16, 0x60, 0x39, 0xF1, 0x7D, 0xF3, 0x64, 0x43, 0xDB, 0x81, 0x2C, 0x60, 0x54, 0x65, 0x60, 0x40, + 0x01, 0x37, 0x12, 0x00, 0x11, 0x37, 0x17, 0x00, 0x21, 0x37, 0x1D, 0x00, 0x31, 0x37, 0x22, 0x00, + 0xA3, 0xD1, 0x16, 0x60, 0x34, 0xF5, 0x64, 0x44, 0xFF, 0xB4, 0x16, 0x60, 0x33, 0xFB, 0x64, 0x47, + 0xFF, 0xB4, 0x16, 0x60, 0x2A, 0xF1, 0x1D, 0x00, 0xA1, 0xD3, 0x16, 0x60, 0x35, 0xF5, 0xFF, 0xB4, + 0x16, 0x60, 0x2B, 0xF1, 0x16, 0x00, 0xA1, 0xD3, 0x16, 0x60, 0x36, 0xF5, 0x60, 0x47, 0xFF, 0xB4, + 0x16, 0x60, 0x2C, 0xF1, 0x0E, 0x00, 0x59, 0xD3, 0x16, 0x60, 0x37, 0xF5, 0xFF, 0xB4, 0x16, 0x60, + 0x2D, 0xF1, 0x07, 0x00, 0x59, 0xD3, 0x16, 0x60, 0x38, 0xF5, 0x60, 0x47, 0xFF, 0xB4, 0x16, 0x60, + 0x2E, 0xF1, 0x16, 0x60, 0x32, 0xFB, 0x16, 0x60, 0x2F, 0xF9, 0x66, 0x42, 0xFC, 0xA2, 0xA2, 0xD3, + 0x2B, 0x60, 0x42, 0x63, 0xCC, 0x84, 0xE8, 0x84, 0xCC, 0x81, 0x63, 0x45, 0xA6, 0xD3, 0xDA, 0x82, + 0xFF, 0xB4, 0xFF, 0xFF, 0x03, 0x03, 0x60, 0x40, 0x80, 0x2B, 0x03, 0x00, 0xDA, 0x86, 0xCD, 0x81, + 0xF5, 0x01, 0x00, 0xB9, 0xA6, 0xD3, 0x0B, 0x03, 0x5A, 0xD1, 0xDA, 0x86, 0xFF, 0xB4, 0xE0, 0x84, + 0xC4, 0x84, 0x5C, 0x90, 0xBD, 0xD9, 0xFD, 0x02, 0xCD, 0x81, 0x66, 0x42, 0xF2, 0x02, 0x5A, 0xD3, + 0x2B, 0x60, 0x80, 0x65, 0xD7, 0x80, 0xBD, 0xDB, 0xFD, 0x02, 0x7D, 0xF3, 0x19, 0x60, 0x7B, 0xF1, + 0x60, 0x40, 0x01, 0x27, 0x09, 0x00, 0x64, 0x40, 0x10, 0x26, 0x06, 0x00, 0x13, 0x64, 0xCB, 0xFB, + 0x01, 0x60, 0x67, 0x64, 0x37, 0xFB, 0x09, 0x00, 0x08, 0x64, 0xCB, 0xFB, 0xA1, 0xF3, 0x01, 0x60, + 0x67, 0x7C, 0x60, 0x40, 0x01, 0x27, 0x5B, 0x7C, 0x37, 0xF9, 0x19, 0x60, 0x4D, 0xF1, 0x7D, 0xF3, + 0x64, 0x40, 0x00, 0x3A, 0x1B, 0x00, 0x60, 0x40, 0x01, 0x27, 0x0D, 0x00, 0x32, 0x60, 0xAB, 0x63, + 0x4C, 0x94, 0x0E, 0xA5, 0x60, 0xFE, 0xA0, 0xD1, 0xA5, 0xD3, 0x19, 0x60, 0x72, 0xF9, 0x19, 0x60, + 0x73, 0xFB, 0x20, 0xFE, 0x0B, 0x00, 0xFF, 0xB4, 0xF8, 0xA4, 0x32, 0x60, 0xC8, 0x63, 0x4C, 0x94, + 0x60, 0xFE, 0xA0, 0xD1, 0xFF, 0xFF, 0x19, 0x60, 0x73, 0xF9, 0x20, 0xFE, 0x19, 0x60, 0x75, 0xF3, + 0x16, 0x60, 0xD8, 0xF1, 0x60, 0x43, 0xD3, 0x80, 0x19, 0x60, 0x76, 0xF3, 0x01, 0x07, 0x63, 0x5C, + 0xD0, 0x80, 0xFF, 0xFF, 0x01, 0x07, 0x60, 0x5C, 0x19, 0x60, 0x4F, 0xF9, 0x19, 0x60, 0x53, 0xF9, + 0x7D, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x27, 0x0A, 0x00, 0xFF, 0xB5, 0x10, 0x60, 0xF4, 0x63, + 0x65, 0x41, 0xCD, 0x81, 0x06, 0xA3, 0xFD, 0x02, 0xFA, 0xA3, 0xA3, 0xD3, 0x0F, 0x00, 0x01, 0x60, + 0xFF, 0x65, 0xA4, 0x84, 0x11, 0x60, 0x60, 0x61, 0xA1, 0xD1, 0xFF, 0xFF, 0xD0, 0x80, 0x08, 0xA1, + 0xFB, 0x02, 0xFC, 0xA1, 0xA1, 0xD3, 0x19, 0x60, 0x4F, 0xF1, 0xFF, 0xB4, 0xD0, 0x80, 0xFF, 0xFF, + 0x04, 0x07, 0x19, 0x60, 0x4F, 0xFB, 0x19, 0x60, 0x53, 0xFB, 0x19, 0x60, 0x4F, 0xF3, 0x19, 0x60, + 0x72, 0xF1, 0x19, 0x60, 0x74, 0xFB, 0xD0, 0x80, 0xFF, 0xFF, 0x02, 0x04, 0x19, 0x60, 0x74, 0xF9, + 0x2C, 0x60, 0x74, 0x63, 0x2B, 0x60, 0x02, 0x65, 0x16, 0x60, 0x33, 0xF1, 0x2A, 0x60, 0xEA, 0x61, + 0x2C, 0x60, 0x62, 0x64, 0x40, 0x4F, 0x04, 0x64, 0xC3, 0x60, 0x58, 0x4D, 0x1A, 0x78, 0xFF, 0xFF, + 0x19, 0x60, 0x4F, 0xF3, 0x19, 0x60, 0x73, 0xF1, 0x19, 0x60, 0x74, 0xFB, 0xD0, 0x80, 0xFF, 0xFF, + 0x02, 0x04, 0x19, 0x60, 0x74, 0xF9, 0x2C, 0x60, 0x7C, 0x63, 0x16, 0x60, 0x32, 0xF1, 0x2B, 0x60, + 0x42, 0x65, 0x2C, 0x60, 0x60, 0x64, 0x40, 0x4F, 0x08, 0x64, 0xC3, 0x60, 0x58, 0x4D, 0x1A, 0x78, + 0xFF, 0xFF, 0x7D, 0xF3, 0x08, 0x7C, 0x38, 0xF9, 0x2B, 0x60, 0xDA, 0x61, 0x60, 0x40, 0x01, 0x2B, + 0x0E, 0x00, 0x01, 0x37, 0x06, 0x00, 0x11, 0x37, 0x03, 0x00, 0x21, 0x3B, 0x1E, 0xA1, 0x1E, 0xA1, + 0x1E, 0xA1, 0x1C, 0x63, 0x2B, 0x60, 0xBC, 0x64, 0x59, 0xD1, 0x58, 0xD9, 0xFD, 0x1F, 0x16, 0x60, + 0x2F, 0xF3, 0x00, 0x7C, 0x60, 0x45, 0x70, 0x62, 0x3D, 0x60, 0x58, 0x4D, 0x0F, 0x78, 0xFF, 0xFF, + 0x04, 0x29, 0xFE, 0x01, 0x00, 0x60, 0x10, 0x62, 0x3D, 0x60, 0x58, 0x4D, 0x3B, 0x78, 0xFF, 0xFF, + 0x01, 0x61, 0xB1, 0x9C, 0x60, 0x45, 0x3D, 0x60, 0x58, 0x4D, 0x0F, 0x78, 0xFF, 0xFF, 0x3A, 0x60, + 0x95, 0x78, 0xFF, 0xFF, 0x44, 0xD3, 0x80, 0x7C, 0x60, 0x48, 0x60, 0x47, 0x00, 0x7F, 0xB0, 0x8A, + 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x2F, 0x58, 0xFF, 0xFF, 0xD5, 0x60, 0x84, 0xE7, 0x62, 0x47, + 0x80, 0xBF, 0x60, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x64, 0x4A, 0xFF, 0xFF, 0x01, 0x16, + 0xFE, 0x01, 0x65, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x95, 0x60, 0x84, 0xE7, 0x2D, 0x58, + 0xFF, 0xFF, 0x00, 0x7C, 0xBD, 0xD3, 0xD5, 0x60, 0x84, 0xE7, 0x60, 0x47, 0x80, 0xBF, 0x60, 0x4A, + 0xBD, 0xD3, 0x01, 0x16, 0xFE, 0x01, 0x90, 0x8A, 0xBD, 0xD3, 0x01, 0x16, 0xFE, 0x01, 0x90, 0x8A, + 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0xCD, 0x81, 0x95, 0x60, 0x84, 0xE7, 0xEB, 0x02, 0x2D, 0x58, + 0xFF, 0xFF, 0xD5, 0x60, 0x84, 0xE7, 0x62, 0x4A, 0x02, 0x64, 0x01, 0x16, 0xFE, 0x01, 0xCC, 0x84, + 0xFF, 0xFF, 0xFD, 0x02, 0x7C, 0x49, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x68, 0x5C, 0x7C, 0x49, + 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x68, 0x44, 0x95, 0x60, 0x84, 0xE7, 0x2D, 0x58, 0xFF, 0xFF, + 0x40, 0xFF, 0x20, 0x44, 0xBF, 0xB4, 0x40, 0x40, 0x03, 0x00, 0x20, 0x44, 0x40, 0xBC, 0x40, 0x40, + 0x43, 0x45, 0x20, 0x44, 0x20, 0xBC, 0x40, 0x40, 0x02, 0x00, 0x43, 0x45, 0xF6, 0x01, 0x00, 0x64, + 0x19, 0x60, 0xF2, 0xFB, 0x3F, 0x44, 0x40, 0x26, 0x05, 0x00, 0x1C, 0x60, 0x0F, 0xF3, 0x5A, 0xD1, + 0xA0, 0x50, 0xA4, 0x50, 0xAE, 0x4F, 0xFD, 0xB4, 0x04, 0xBC, 0xA0, 0x5E, 0x00, 0x60, 0x02, 0x71, + 0x8D, 0xE2, 0x40, 0xE1, 0x40, 0x29, 0xFE, 0x01, 0x04, 0xAC, 0xA0, 0x5E, 0xFF, 0xFF, 0x00, 0x60, + 0x10, 0x62, 0x19, 0x60, 0x8E, 0x7C, 0x00, 0x60, 0xAC, 0x65, 0x3D, 0x60, 0x58, 0x4D, 0x0F, 0x78, + 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x60, 0x10, 0x62, 0x3D, 0x60, 0x58, 0x4D, 0x3B, 0x78, 0xFF, 0xFF, + 0x60, 0x40, 0x19, 0x60, 0x8E, 0x64, 0x64, 0x40, 0xD0, 0x80, 0x14, 0x71, 0x05, 0x03, 0x8D, 0xE2, + 0x40, 0xE1, 0x40, 0x29, 0xFE, 0x01, 0xE2, 0x01, 0x3F, 0x44, 0x40, 0x26, 0x05, 0x00, 0x1C, 0x60, + 0x0D, 0xF3, 0x5A, 0xD1, 0xA0, 0x50, 0xA4, 0x52, 0x27, 0x60, 0x36, 0x63, 0x1E, 0x61, 0x3D, 0x60, + 0x58, 0x4D, 0x23, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x14, 0x71, 0x8D, 0xE2, 0x40, 0xE1, 0x40, 0x29, + 0xFE, 0x01, 0x31, 0x44, 0x40, 0x26, 0x02, 0x00, 0x80, 0x26, 0x17, 0x00, 0x28, 0x60, 0xE6, 0x63, + 0x07, 0x60, 0xE8, 0xFD, 0x09, 0x61, 0x3D, 0x60, 0x58, 0x4D, 0x23, 0x78, 0xFF, 0xFF, 0x31, 0x44, + 0x40, 0x2A, 0x14, 0x00, 0x31, 0x44, 0x7F, 0xB4, 0x40, 0x51, 0xAE, 0x4C, 0x10, 0x26, 0x0E, 0x00, + 0x07, 0x60, 0xE9, 0xFB, 0x31, 0x44, 0x80, 0xBC, 0x40, 0x51, 0x29, 0x60, 0x1C, 0x63, 0x07, 0x60, + 0xE8, 0xFD, 0x09, 0x61, 0x3D, 0x60, 0x58, 0x4D, 0x23, 0x78, 0xFF, 0xFF, 0x27, 0x60, 0xEA, 0x63, + 0x03, 0x61, 0x3D, 0x60, 0x58, 0x4D, 0x23, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x10, 0x62, 0x19, 0x60, + 0x8F, 0x7C, 0x00, 0x60, 0xAC, 0x65, 0x3D, 0x60, 0x58, 0x4D, 0x0F, 0x78, 0xFF, 0xFF, 0x80, 0xE1, + 0xBF, 0xFE, 0xA1, 0x4F, 0x70, 0xB4, 0x50, 0x36, 0x0C, 0x00, 0x20, 0x36, 0x03, 0x00, 0x3A, 0x60, + 0x77, 0x78, 0xFF, 0xFF, 0x01, 0x60, 0x1A, 0xE1, 0xDF, 0xFE, 0x19, 0xFF, 0x00, 0xE1, 0xA1, 0xFF, + 0xFF, 0xFF, 0x20, 0x44, 0x40, 0x2A, 0x85, 0x00, 0x7D, 0xF1, 0x3B, 0x00, 0x83, 0x00, 0x19, 0x60, + 0xF2, 0xF3, 0xFF, 0xFF, 0x01, 0x18, 0x59, 0x01, 0x43, 0x45, 0x20, 0x44, 0x20, 0xBC, 0x40, 0x40, + 0x1C, 0x60, 0x0F, 0xF3, 0x3F, 0x40, 0x40, 0x26, 0x01, 0x00, 0xA0, 0x50, 0xAE, 0x4F, 0xFD, 0xB4, + 0xA0, 0x5E, 0xAC, 0x4F, 0x10, 0xBC, 0xA0, 0x5C, 0xFF, 0xFF, 0x10, 0xAC, 0xA0, 0x5C, 0x00, 0x60, + 0xC8, 0x71, 0x8D, 0xE2, 0x40, 0xE1, 0x40, 0x29, 0xFE, 0x01, 0x7D, 0xF1, 0x30, 0x61, 0x64, 0x44, + 0x01, 0x2B, 0x20, 0xA1, 0x30, 0x64, 0x61, 0x5F, 0x60, 0x45, 0x0C, 0x60, 0x00, 0x62, 0x00, 0x60, + 0x71, 0x7C, 0x3D, 0x60, 0x58, 0x4D, 0x0F, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0xC8, 0x71, 0x8D, 0xE2, + 0x40, 0xE1, 0x40, 0x29, 0xFE, 0x01, 0x01, 0x60, 0x08, 0xE1, 0x7D, 0xF1, 0x20, 0x44, 0x40, 0xBC, + 0x40, 0x40, 0x19, 0x60, 0xF2, 0xF3, 0xFF, 0xFF, 0x03, 0x18, 0x3D, 0x60, 0x57, 0x78, 0xFF, 0xFF, + 0x1B, 0x60, 0xF3, 0xF1, 0xAD, 0x4F, 0x00, 0x7F, 0xFA, 0xB4, 0x64, 0x41, 0x7D, 0xF1, 0x02, 0xB1, + 0x04, 0x65, 0x02, 0x02, 0x64, 0x40, 0x01, 0x2B, 0x01, 0x65, 0xB4, 0x84, 0xA0, 0x5D, 0x20, 0x44, + 0x40, 0x2A, 0x43, 0x45, 0x20, 0xBC, 0x40, 0x40, 0xA1, 0xF9, 0x05, 0x64, 0xA2, 0xFB, 0xDF, 0xFE, + 0x19, 0xFF, 0xDD, 0xFE, 0x26, 0x00, 0x20, 0x44, 0x20, 0xBC, 0x40, 0x40, 0x43, 0x45, 0xA4, 0xD1, + 0xDA, 0x83, 0xC3, 0x85, 0x80, 0xE1, 0xDF, 0xFE, 0xBD, 0xD3, 0xFF, 0xFF, 0x60, 0x48, 0x60, 0x47, + 0x80, 0xBC, 0x00, 0x7F, 0x60, 0x4A, 0xD7, 0x80, 0xA1, 0xFF, 0xF6, 0x02, 0xBF, 0xFE, 0x11, 0x00, + 0x43, 0x45, 0xA4, 0xD1, 0xDA, 0x83, 0x0D, 0x18, 0x64, 0x44, 0x00, 0x61, 0xFA, 0xA4, 0xDD, 0x81, + 0xFD, 0x02, 0x3D, 0x60, 0x58, 0x4D, 0x23, 0x78, 0xFF, 0xFF, 0xBF, 0xFE, 0x02, 0x00, 0xF1, 0xFE, + 0x01, 0x00, 0x25, 0x43, 0x21, 0xE1, 0x00, 0x64, 0xBF, 0xDB, 0x20, 0x44, 0x20, 0x2A, 0x07, 0x00, + 0x07, 0xB4, 0x04, 0x36, 0xC3, 0xFE, 0x06, 0x36, 0xCC, 0xFE, 0x07, 0x36, 0xD5, 0xFE, 0x20, 0x44, + 0x98, 0xB4, 0x40, 0x40, 0x26, 0x60, 0x26, 0x63, 0xBD, 0xD3, 0x03, 0x61, 0x0F, 0x1B, 0x04, 0xA3, + 0xBD, 0xD3, 0x04, 0x61, 0x0B, 0x1B, 0x04, 0xA3, 0xBD, 0xD3, 0x06, 0x61, 0x07, 0x1B, 0x04, 0xA3, + 0xBD, 0xD3, 0x07, 0x61, 0x03, 0x1B, 0xC3, 0x60, 0x48, 0x78, 0xFF, 0xFF, 0xA3, 0xD1, 0x40, 0x44, + 0x20, 0x44, 0x07, 0xB5, 0xD4, 0x85, 0x35, 0x80, 0x24, 0x45, 0x26, 0x60, 0x66, 0x64, 0x44, 0xD7, + 0xFF, 0xFF, 0xFF, 0xFF, 0x43, 0x45, 0x20, 0x44, 0x20, 0xBC, 0x40, 0x40, 0x64, 0x43, 0xBD, 0xD3, + 0xBD, 0xD1, 0x40, 0x44, 0x10, 0x27, 0x19, 0x00, 0x3F, 0x40, 0x02, 0x2B, 0x06, 0x00, 0x24, 0x47, + 0x08, 0x2B, 0x13, 0x00, 0x07, 0xB4, 0x01, 0x36, 0x11, 0x00, 0xFF, 0x60, 0x7F, 0x65, 0x15, 0x60, + 0xA2, 0x64, 0x24, 0x40, 0x08, 0x2B, 0xA4, 0x84, 0xA0, 0x57, 0xFF, 0xFF, 0x64, 0x49, 0xFF, 0xFF, + 0x68, 0x44, 0x01, 0x16, 0xFD, 0x01, 0x00, 0x7F, 0xA3, 0xDB, 0xAB, 0x01, 0x64, 0x42, 0x3D, 0x60, + 0x58, 0x4D, 0x3B, 0x78, 0xFF, 0xFF, 0xBD, 0xD9, 0xA3, 0xDB, 0xA3, 0x01, 0x43, 0x45, 0x20, 0x44, + 0x20, 0xBC, 0x40, 0x40, 0x64, 0x43, 0xBD, 0xD3, 0xA3, 0xD1, 0x40, 0x44, 0x10, 0x2B, 0x16, 0x00, + 0xBE, 0xD1, 0xFF, 0xFF, 0x15, 0x60, 0x80, 0xE7, 0x24, 0x40, 0x07, 0x27, 0x04, 0x00, 0xAC, 0x4F, + 0x10, 0xBC, 0x00, 0x7F, 0xA0, 0x5C, 0x64, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x24, 0x40, + 0x20, 0x27, 0x1D, 0x00, 0xAC, 0x4F, 0xEF, 0xB4, 0xA0, 0x5C, 0x19, 0x00, 0x3F, 0x40, 0x02, 0x2B, + 0x06, 0x00, 0x24, 0x47, 0x08, 0x2B, 0x13, 0x00, 0x07, 0xB4, 0x01, 0x36, 0x11, 0x00, 0x15, 0x60, + 0x22, 0x64, 0x24, 0x40, 0x08, 0x27, 0x80, 0xBC, 0x7C, 0x48, 0xBE, 0xD3, 0xA0, 0x57, 0x60, 0x48, + 0x64, 0x44, 0x80, 0xBC, 0xFF, 0xB4, 0x60, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x69, 0x01, + 0x01, 0x61, 0x3D, 0x60, 0x58, 0x4D, 0x23, 0x78, 0xFF, 0xFF, 0x63, 0x01, 0x30, 0x44, 0x02, 0xA8, + 0x00, 0xE1, 0x07, 0x02, 0x62, 0xFF, 0x63, 0xFF, 0x64, 0xFF, 0x65, 0xFF, 0x66, 0xFF, 0xBF, 0xFE, + 0xA1, 0xFF, 0x82, 0xFF, 0x88, 0xFF, 0x6C, 0x40, 0x41, 0xFF, 0xC4, 0xE2, 0x43, 0xFF, 0x5C, 0x49, + 0x08, 0xE1, 0xA2, 0x60, 0x41, 0x78, 0xFF, 0xFF, 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, 0x02, 0x02, + 0xA1, 0xFF, 0xFF, 0xFF, 0x82, 0xFF, 0x88, 0xFF, 0xA8, 0xE2, 0xCB, 0xF1, 0x00, 0x6B, 0x89, 0xFF, + 0x64, 0x54, 0x88, 0xFF, 0x9F, 0xFE, 0x02, 0x05, 0x64, 0x44, 0x60, 0x54, 0xCD, 0xE2, 0xC2, 0x64, + 0x3A, 0xDB, 0xBC, 0xFF, 0xB5, 0xFF, 0x1D, 0xFF, 0x26, 0x44, 0x02, 0xB4, 0x40, 0x46, 0x3C, 0x44, + 0x00, 0xBC, 0xFF, 0xFF, 0x06, 0x03, 0x27, 0x40, 0x26, 0x22, 0x03, 0x00, 0x02, 0x64, 0x31, 0xFB, + 0xC0, 0xFE, 0x27, 0x44, 0x20, 0x2A, 0x04, 0x00, 0xA0, 0x60, 0x00, 0xEA, 0xB0, 0x60, 0x00, 0xEA, + 0x5C, 0x44, 0x27, 0x44, 0x18, 0xB4, 0x40, 0x47, 0x00, 0xE1, 0x29, 0x40, 0x50, 0x2B, 0x37, 0x00, + 0xEF, 0x60, 0xFF, 0x65, 0x29, 0x44, 0x24, 0x89, 0x31, 0x40, 0x08, 0x26, 0x0B, 0x00, 0x21, 0x46, + 0xA7, 0xF4, 0x1D, 0xF2, 0xFF, 0xB3, 0x00, 0x7C, 0x05, 0x03, 0x06, 0x61, 0x5D, 0x91, 0x09, 0x60, + 0x02, 0x65, 0x02, 0x03, 0x00, 0x61, 0x15, 0x00, 0xD4, 0x80, 0x63, 0x45, 0xFB, 0x07, 0x65, 0x43, + 0x80, 0x60, 0x00, 0x62, 0xF6, 0x82, 0x53, 0x90, 0xE3, 0x83, 0xFC, 0x04, 0xEB, 0x83, 0xEB, 0x83, + 0xEA, 0x82, 0x5C, 0x94, 0xB2, 0x9C, 0xF3, 0x07, 0x64, 0x41, 0xDD, 0x81, 0xE1, 0x81, 0xE1, 0x81, + 0xE1, 0x81, 0x2B, 0x44, 0x54, 0x90, 0x70, 0x45, 0x02, 0x28, 0x61, 0x44, 0xC4, 0x84, 0xFF, 0xFF, + 0x04, 0x24, 0x00, 0xB4, 0x60, 0x50, 0x08, 0x28, 0x01, 0x00, 0x20, 0x29, 0x6D, 0xE2, 0xA4, 0xE2, + 0xC4, 0xE2, 0x47, 0xFF, 0xB6, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0x32, 0xF1, 0x08, 0x29, 0x09, 0x00, + 0x64, 0x40, 0x07, 0x22, 0x06, 0x00, 0x43, 0xFF, 0x27, 0x44, 0x10, 0xBC, 0x40, 0x47, 0x00, 0x64, + 0x32, 0xFB, 0x31, 0x41, 0x3C, 0x44, 0x01, 0xB1, 0x00, 0xBC, 0x0A, 0x02, 0x09, 0x03, 0x32, 0xF3, + 0x00, 0x7C, 0x01, 0xB4, 0xFF, 0xFF, 0x04, 0x03, 0x32, 0xF9, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, + 0xC8, 0x60, 0x09, 0x7D, 0x00, 0x60, 0x00, 0x6B, 0x00, 0x64, 0x33, 0xFB, 0x0C, 0x60, 0x16, 0x64, + 0xA0, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xE1, 0x30, 0x40, 0x02, 0x36, 0xA1, 0xFF, 0x83, 0xFF, + 0x8D, 0xFF, 0x5C, 0x44, 0x5C, 0x43, 0x5C, 0x42, 0x5C, 0x41, 0x5C, 0x40, 0xAC, 0xFF, 0xAD, 0xFF, + 0xE7, 0xE1, 0xB3, 0x60, 0xFC, 0x78, 0xFF, 0xFF, 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, 0x03, 0x02, + 0x28, 0xE2, 0x40, 0xFF, 0xA1, 0xFF, 0x84, 0xFF, 0xC2, 0x60, 0x45, 0x64, 0x40, 0x42, 0xB7, 0x60, + 0xF7, 0x64, 0x40, 0x40, 0xBA, 0xF3, 0x7E, 0xFB, 0x0F, 0x60, 0xE2, 0x63, 0xC7, 0xF3, 0xBD, 0xDB, + 0x00, 0x60, 0x9A, 0x64, 0xBD, 0xDB, 0x02, 0x64, 0xBD, 0xDB, 0x04, 0x64, 0xA3, 0xDB, 0x5C, 0x49, + 0x0A, 0x64, 0x40, 0x4B, 0x5C, 0x5C, 0x01, 0x60, 0x39, 0xE2, 0x04, 0x60, 0x00, 0x7A, 0x89, 0xFF, + 0x03, 0x60, 0xFF, 0x73, 0x88, 0xFF, 0xB7, 0x60, 0xF7, 0x78, 0xFF, 0xFF, 0x30, 0x44, 0x02, 0xA8, + 0x00, 0xE1, 0x06, 0x02, 0x40, 0xFF, 0x42, 0xFF, 0x43, 0xFF, 0x44, 0xFF, 0x45, 0xFF, 0xA1, 0xFF, + 0x88, 0xFF, 0x85, 0xFF, 0x21, 0xE1, 0x5C, 0x40, 0xC3, 0x60, 0x48, 0x78, 0xFF, 0xFF, 0xA2, 0xFF, + 0x30, 0x44, 0x02, 0xA8, 0x00, 0xE1, 0x01, 0x02, 0xA1, 0xFF, 0x86, 0xFF, 0x88, 0xFF, 0x5C, 0x46, + 0x5C, 0x49, 0x5C, 0x40, 0xEF, 0x60, 0x58, 0x4F, 0x1B, 0x78, 0xFF, 0xFF, 0x1D, 0x60, 0x58, 0x4F, + 0x81, 0x78, 0xFF, 0xFF, 0xD3, 0x60, 0x58, 0x4F, 0x58, 0x78, 0xFF, 0xFF, 0xE7, 0x60, 0x58, 0x4F, + 0x99, 0x78, 0xFF, 0xFF, 0x20, 0x60, 0x58, 0x4F, 0x19, 0x78, 0xFF, 0xFF, 0xF4, 0x60, 0x58, 0x4F, + 0xE9, 0x78, 0xFF, 0xFF, 0xE9, 0x60, 0x58, 0x4F, 0xCA, 0x78, 0xFF, 0xFF, 0x27, 0x60, 0x58, 0x4F, + 0x71, 0x78, 0xFF, 0xFF, 0xEE, 0x60, 0x58, 0x4F, 0x69, 0x78, 0xFF, 0xFF, 0x1F, 0xE1, 0xA3, 0xFF, + 0xCA, 0x60, 0xD4, 0x78, 0xFF, 0xFF, 0x03, 0xE1, 0xA3, 0xFF, 0xFE, 0xFC, 0xFF, 0xFC, 0x25, 0x60, + 0x96, 0x63, 0x17, 0xFD, 0xAE, 0xFF, 0x2A, 0x60, 0x1D, 0x78, 0xFF, 0xFF, 0x42, 0x6F, 0x6F, 0x74, + 0x63, 0x6F, 0x64, 0x65, 0x20, 0x21, 0x21, 0x20, 0x20, 0x00, 0x53, 0x54, 0x41, 0x2F, 0x41, 0x50, + 0x20, 0x46, 0x75, 0x6E, 0x63, 0x27, 0x73, 0x00, 0x1F, 0x00, 0x04, 0x00, 0x01, 0x00, 0x24, 0x00, + 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x06, 0x00, 0x07, 0x00, 0x05, 0x00, 0x06, 0x00, 0x07, 0x00, 0x06, 0x00, 0x06, 0x00, 0x07, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0xA6, 0xF3, 0x21, 0x61, 0x00, 0x7C, 0x01, 0x00, 0x00, 0xFA, + 0x60, 0x46, 0xFE, 0x63, 0xA3, 0xD8, 0xFE, 0x1F, 0xCD, 0x81, 0xD8, 0x84, 0xF8, 0x02, 0x21, 0x61, + 0x80, 0x67, 0x40, 0x4A, 0xA6, 0xF5, 0x05, 0x18, 0x2A, 0x43, 0x02, 0xFC, 0x5F, 0x8A, 0x00, 0xF4, + 0xFA, 0x01, 0x2E, 0x58, 0xFF, 0xFF, 0xA8, 0xF1, 0xA7, 0xF3, 0x7C, 0x63, 0xAA, 0xFB, 0x60, 0x46, + 0x01, 0xFC, 0xDC, 0x84, 0xD0, 0x80, 0x00, 0xFA, 0xFA, 0x04, 0xAB, 0xFB, 0x60, 0x46, 0x00, 0x64, + 0x00, 0xFA, 0x63, 0x44, 0x80, 0x7F, 0x01, 0xFA, 0xA8, 0xF3, 0xA7, 0xF1, 0xDC, 0x84, 0xD0, 0x84, + 0xA9, 0xFB, 0x03, 0x60, 0x26, 0x61, 0xB6, 0x60, 0x58, 0x4D, 0x0F, 0x78, 0xFF, 0xFF, 0x66, 0x44, + 0x2E, 0xFB, 0x82, 0xFF, 0x40, 0x42, 0x87, 0xFF, 0xA9, 0xF3, 0xB1, 0xFB, 0x00, 0x64, 0x40, 0x50, + 0x63, 0xFF, 0x60, 0xFF, 0x66, 0xFF, 0x65, 0xFF, 0x64, 0xFF, 0x61, 0xFF, 0x62, 0xFF, 0x49, 0x60, + 0x02, 0xE1, 0x52, 0x60, 0x02, 0xE1, 0x5C, 0x60, 0x02, 0xE1, 0x65, 0x60, 0x02, 0xE1, 0x6B, 0x60, + 0x02, 0xE1, 0x76, 0x60, 0x02, 0xE1, 0x41, 0x60, 0x02, 0xE1, 0x0C, 0x64, 0x13, 0x60, 0x1C, 0xFB, + 0x41, 0x60, 0x07, 0x64, 0x9F, 0xFB, 0x2D, 0xFF, 0x06, 0x61, 0x41, 0x4B, 0x09, 0x60, 0x08, 0x61, + 0xB6, 0x60, 0x58, 0x4D, 0x0F, 0x78, 0xFF, 0xFF, 0xF0, 0x67, 0x0E, 0xFA, 0x26, 0x60, 0x04, 0x64, + 0x13, 0x60, 0x10, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0x2B, 0x41, 0x4D, 0x8B, 0xFF, 0xFF, 0xEA, 0x02, 0x05, 0x61, 0x41, 0x4B, 0x09, 0x60, 0x08, 0x61, + 0xB6, 0x60, 0x58, 0x4D, 0x0F, 0x78, 0xFF, 0xFF, 0x25, 0x60, 0xF8, 0x64, 0x13, 0x60, 0x10, 0xFB, + 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x2B, 0x41, 0x4D, 0x8B, + 0xFF, 0xFF, 0xEC, 0x02, 0x40, 0x60, 0x45, 0x78, 0xFF, 0xFF, 0x00, 0xEA, 0x00, 0xEB, 0x50, 0x60, + 0x03, 0xEA, 0x51, 0x60, 0x13, 0xEA, 0x52, 0x60, 0x30, 0xEA, 0x53, 0x60, 0x40, 0xEA, 0x54, 0x60, + 0x52, 0xEA, 0x55, 0x60, 0x6D, 0xEA, 0x56, 0x60, 0x71, 0xEA, 0x57, 0x60, 0x8B, 0xEA, 0x58, 0x60, + 0x47, 0xEA, 0x59, 0x60, 0xA0, 0xEA, 0x5A, 0x60, 0xB2, 0xEA, 0x5B, 0x60, 0xC1, 0xEA, 0x5C, 0x60, + 0xD7, 0xEA, 0x5D, 0x60, 0xEB, 0xEA, 0x5E, 0x60, 0xA0, 0xEA, 0x50, 0x60, 0x36, 0xEB, 0x51, 0x60, + 0x37, 0xEB, 0x52, 0x60, 0x20, 0xEB, 0x53, 0x60, 0xE4, 0xEB, 0x54, 0x60, 0x34, 0xEB, 0x55, 0x60, + 0x58, 0xEB, 0x56, 0x60, 0x48, 0xEB, 0x57, 0x60, 0xD0, 0xEB, 0x58, 0x60, 0xC3, 0xEB, 0x59, 0x60, + 0xFC, 0xEB, 0x5A, 0x60, 0x34, 0xEB, 0x5B, 0x60, 0x58, 0xEB, 0x5C, 0x60, 0xC0, 0xEB, 0x5D, 0x60, + 0xD0, 0xEB, 0x5E, 0x60, 0x91, 0xEB, 0x00, 0xEA, 0x00, 0xEB, 0xE0, 0x60, 0x02, 0xEA, 0xE0, 0x60, + 0x03, 0xEB, 0xA0, 0x60, 0x00, 0xEB, 0xB0, 0x60, 0x00, 0xEB, 0xAB, 0x48, 0x40, 0x3B, 0x01, 0x00, + 0xFC, 0x01, 0x00, 0xEB, 0x03, 0x60, 0x02, 0x64, 0xA0, 0xDB, 0x0F, 0x64, 0x60, 0x7F, 0xA0, 0x5A, + 0x80, 0x60, 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, 0xD1, 0x60, 0x00, 0xEA, 0x24, 0x44, 0xFF, 0xB4, + 0x04, 0xFB, 0x50, 0x60, 0x00, 0x64, 0x05, 0xFB, 0x10, 0x60, 0x10, 0x75, 0x2A, 0x60, 0x1D, 0x78, + 0xFF, 0xFF, 0x3F, 0x40, 0x40, 0x26, 0x40, 0x00, 0x05, 0x60, 0xF9, 0xF1, 0x42, 0x60, 0x08, 0x64, + 0x09, 0x60, 0x19, 0x63, 0x64, 0x40, 0x01, 0x2B, 0x04, 0x00, 0x42, 0x60, 0x09, 0x64, 0x0A, 0x60, + 0x19, 0x63, 0x1C, 0x60, 0x0F, 0xFB, 0x04, 0x60, 0x00, 0xBC, 0x1C, 0x60, 0x0B, 0xFB, 0x1C, 0x60, + 0x0A, 0xFD, 0x1D, 0x60, 0x19, 0x63, 0x1C, 0x60, 0x0E, 0xFD, 0x80, 0x60, 0x1C, 0x64, 0x3F, 0x40, + 0x01, 0x2A, 0x02, 0x00, 0x60, 0x60, 0x1C, 0x64, 0x1C, 0x60, 0x10, 0xFB, 0x1C, 0x60, 0x0C, 0xFB, + 0x1C, 0x60, 0x0F, 0xF3, 0xA0, 0x50, 0xA0, 0x50, 0x0B, 0x60, 0xF8, 0x63, 0xA3, 0xD1, 0x38, 0x60, + 0x12, 0x61, 0xA1, 0xD3, 0xF8, 0xA3, 0x90, 0x84, 0xA2, 0xDB, 0xA3, 0xD1, 0x59, 0xD3, 0x06, 0xA3, + 0x90, 0x84, 0xA2, 0xDB, 0xA3, 0xD1, 0x59, 0xD3, 0xFE, 0xA3, 0x90, 0x84, 0xA2, 0xDB, 0xA3, 0xD1, + 0x59, 0xD3, 0xFF, 0xFF, 0x90, 0x84, 0xA2, 0xDB, 0x80, 0x60, 0x58, 0xEC, 0x80, 0x60, 0x00, 0xED, + 0x80, 0x60, 0x80, 0xEE, 0x40, 0xEC, 0x00, 0xED, 0x00, 0xEE, 0xC0, 0x60, 0x59, 0xEC, 0xC0, 0x60, + 0x07, 0xED, 0xC0, 0x60, 0x8F, 0xEE, 0xAD, 0x4F, 0xFA, 0xB4, 0xA0, 0x5D, 0x00, 0xF3, 0x28, 0xFB, + 0x40, 0x44, 0x37, 0x60, 0x7B, 0x7C, 0x20, 0xF9, 0x3F, 0x60, 0x18, 0x7C, 0x21, 0xF9, 0x3F, 0x60, + 0x2E, 0x7C, 0x22, 0xF9, 0x3F, 0x60, 0xC5, 0x7C, 0x23, 0xF9, 0x3F, 0x60, 0xD6, 0x7C, 0x24, 0xF9, + 0x40, 0x60, 0x00, 0x7C, 0x25, 0xF9, 0x40, 0x60, 0x11, 0x7C, 0x26, 0xF9, 0xD0, 0x60, 0x00, 0xE8, + 0x28, 0xE8, 0x44, 0x60, 0x01, 0xE6, 0x10, 0x67, 0x40, 0x52, 0x10, 0x60, 0x04, 0xE6, 0x08, 0x60, + 0x06, 0x63, 0xFD, 0x60, 0x0C, 0x65, 0x5B, 0xD3, 0xBF, 0xD1, 0x10, 0x18, 0xC3, 0x83, 0xD4, 0x80, + 0xC3, 0x83, 0xF9, 0x02, 0xFA, 0xA3, 0xA3, 0xD3, 0x02, 0x60, 0x00, 0x65, 0xF9, 0xA0, 0xFC, 0xA0, + 0x0D, 0x05, 0x04, 0x05, 0x78, 0x43, 0x02, 0x61, 0x29, 0x60, 0xEA, 0x78, 0x21, 0x60, 0x00, 0x65, + 0x3F, 0x43, 0x21, 0x60, 0x00, 0x65, 0xC0, 0x60, 0x8F, 0xEE, 0x08, 0x00, 0x02, 0x60, 0x00, 0x65, + 0x00, 0x60, 0x00, 0x64, 0x18, 0xFB, 0x3F, 0x43, 0x11, 0x60, 0x10, 0xE6, 0xB7, 0x84, 0x40, 0x5F, + 0x37, 0x60, 0xF8, 0x63, 0x3F, 0x40, 0x20, 0x27, 0x06, 0x00, 0x0F, 0x60, 0xFF, 0x64, 0xBD, 0xDB, + 0x0F, 0x60, 0xF0, 0x64, 0x03, 0x00, 0x0F, 0x64, 0xBD, 0xDB, 0x00, 0x64, 0xA3, 0xDB, 0x00, 0x60, + 0x30, 0xE2, 0x00, 0x60, 0x50, 0xE2, 0x00, 0x60, 0x79, 0xE2, 0x00, 0x60, 0x90, 0xE2, 0x01, 0x60, + 0xD0, 0xE2, 0x01, 0x60, 0xF0, 0xE2, 0x01, 0x60, 0xB0, 0xE2, 0x13, 0x64, 0xCB, 0xFB, 0x01, 0x60, + 0x67, 0x64, 0x37, 0xFB, 0x00, 0x60, 0x28, 0x64, 0x36, 0xFB, 0x09, 0x60, 0x2A, 0x64, 0xB6, 0xFB, + 0x82, 0xFF, 0x92, 0xFF, 0x5C, 0x41, 0x5C, 0x46, 0x5C, 0x47, 0x00, 0xE1, 0xA3, 0x60, 0xF4, 0x63, + 0x0C, 0x60, 0x16, 0x64, 0xA0, 0xDD, 0x87, 0xFF, 0x97, 0xFF, 0x0C, 0x60, 0x02, 0x64, 0x40, 0x5A, + 0x06, 0xA4, 0x40, 0x5B, 0x5C, 0x5E, 0x16, 0x60, 0xCF, 0xF3, 0x7D, 0xFB, 0x3F, 0x40, 0x01, 0x22, + 0x03, 0x00, 0x80, 0x60, 0x37, 0x7C, 0x02, 0x00, 0x80, 0x60, 0x27, 0x7C, 0x1A, 0x60, 0x1F, 0xF9, + 0x01, 0x60, 0x06, 0x64, 0xA7, 0xFB, 0x02, 0x60, 0x7F, 0x64, 0x00, 0x60, 0x42, 0x65, 0xD4, 0x84, + 0xA8, 0xFB, 0xDC, 0x84, 0xA6, 0xFB, 0x12, 0x60, 0xD8, 0xFB, 0x40, 0x60, 0x58, 0x4E, 0x7D, 0x78, + 0xFF, 0xFF, 0x3F, 0x40, 0x40, 0x26, 0x05, 0x00, 0x1C, 0x60, 0x0D, 0xF3, 0x5A, 0xD1, 0xA0, 0x50, + 0xA4, 0x52, 0x08, 0x60, 0x00, 0x63, 0xFA, 0x60, 0x00, 0x65, 0xBD, 0xD3, 0xA3, 0xD3, 0x02, 0xA8, + 0xD4, 0x80, 0x21, 0x02, 0x20, 0x02, 0x19, 0x60, 0x48, 0xF1, 0xFF, 0xFF, 0x64, 0x40, 0x80, 0x26, + 0x1A, 0x00, 0x04, 0xA3, 0xFD, 0x60, 0x0D, 0x65, 0x5B, 0xD3, 0xBF, 0xD1, 0x14, 0x18, 0xC3, 0x83, + 0xD4, 0x80, 0xC3, 0x83, 0xF9, 0x02, 0xBF, 0xD3, 0xAD, 0x49, 0xFE, 0xA0, 0x00, 0x64, 0x0C, 0x04, + 0x08, 0xB1, 0x20, 0xBC, 0x08, 0x28, 0x18, 0xBC, 0x07, 0x7C, 0x0E, 0x60, 0xDF, 0xF9, 0x05, 0x7C, + 0x0E, 0x60, 0xDE, 0xF9, 0x01, 0x00, 0x00, 0x64, 0x0E, 0x60, 0xDD, 0xFB, 0x40, 0x60, 0x95, 0x78, + 0xFF, 0xFF, 0x5C, 0x51, 0x3F, 0x41, 0xA5, 0x4C, 0x50, 0x37, 0x0B, 0x00, 0x01, 0xB9, 0x41, 0x5F, + 0xB5, 0x60, 0x55, 0xE0, 0x05, 0x60, 0xF9, 0xF1, 0xC0, 0x67, 0x90, 0x84, 0x3F, 0x40, 0x01, 0x26, + 0xA0, 0x50, 0x06, 0x60, 0x08, 0xF3, 0x01, 0x60, 0x01, 0x65, 0x01, 0x60, 0x02, 0x7C, 0xD4, 0x80, + 0xD0, 0x80, 0x01, 0x03, 0x10, 0x02, 0x5A, 0xD1, 0x5A, 0xD3, 0x3C, 0x60, 0x00, 0x66, 0xE0, 0x87, + 0x40, 0x4A, 0x80, 0x60, 0x9E, 0x61, 0x64, 0x44, 0xC8, 0x84, 0x0C, 0x63, 0xAA, 0x46, 0x58, 0xD0, + 0xAA, 0x46, 0x59, 0xD8, 0xFB, 0x1F, 0x08, 0x60, 0x00, 0x63, 0xFA, 0x60, 0x00, 0x65, 0xBD, 0xD3, + 0xA3, 0xD3, 0x02, 0xA8, 0xD4, 0x80, 0x07, 0x02, 0x06, 0x02, 0x8C, 0x60, 0xBA, 0x61, 0x3C, 0x60, + 0x00, 0x66, 0x41, 0x4B, 0x03, 0x00, 0x46, 0x60, 0x3B, 0x78, 0xFF, 0xFF, 0x2B, 0x41, 0x8D, 0x60, + 0x02, 0x7C, 0xD1, 0x80, 0xA1, 0xD2, 0x25, 0x05, 0x59, 0xD0, 0x60, 0x45, 0x59, 0xD2, 0x44, 0x47, + 0xE0, 0x87, 0x40, 0x4A, 0x59, 0xD2, 0x59, 0x8B, 0x40, 0x4C, 0x08, 0x60, 0x00, 0x63, 0xBE, 0xD3, + 0xBD, 0xD1, 0xEC, 0x18, 0xD4, 0x80, 0xEA, 0x18, 0x03, 0x03, 0xC3, 0x83, 0xC3, 0x83, 0xF7, 0x01, + 0x67, 0x44, 0xC0, 0x84, 0xE0, 0x85, 0x2C, 0x44, 0xD4, 0x80, 0x63, 0x41, 0x01, 0x06, 0x65, 0x44, + 0xC8, 0x83, 0xAA, 0x46, 0x59, 0xD1, 0x27, 0xD8, 0x5A, 0x87, 0xFC, 0x1F, 0xAA, 0x46, 0x2B, 0x41, + 0xD5, 0x01, 0x8D, 0x60, 0x02, 0x61, 0x41, 0x4B, 0x2B, 0x41, 0x8D, 0x60, 0x02, 0x7C, 0xD1, 0x80, + 0xA1, 0xD2, 0x27, 0x05, 0x59, 0xD0, 0x60, 0x45, 0x59, 0xD2, 0x44, 0x47, 0xE0, 0x87, 0x40, 0x4A, + 0x59, 0xD2, 0x59, 0x8B, 0x40, 0x4C, 0x08, 0x60, 0x00, 0x63, 0xBE, 0xD3, 0xBD, 0xD1, 0xEC, 0x18, + 0xD4, 0x80, 0xEA, 0x18, 0x03, 0x03, 0xC3, 0x83, 0xC3, 0x83, 0xF7, 0x01, 0x04, 0xA3, 0xA3, 0xD1, + 0x5A, 0x88, 0x2C, 0x43, 0xD3, 0x80, 0xFF, 0xFF, 0x01, 0x06, 0x64, 0x43, 0xCF, 0x83, 0xAA, 0x46, + 0x60, 0xFE, 0x28, 0xD1, 0x5E, 0x88, 0x27, 0xD8, 0x5A, 0x87, 0xFB, 0x1F, 0x20, 0xFE, 0xAA, 0x46, + 0xD3, 0x01, 0x07, 0x60, 0xEC, 0xF3, 0x20, 0x60, 0x00, 0x7C, 0x08, 0xB0, 0x10, 0xB0, 0x05, 0x02, + 0x04, 0x03, 0x07, 0x60, 0xEB, 0xF9, 0x07, 0x60, 0xEA, 0xF9, 0x02, 0xB0, 0x04, 0xB0, 0x0F, 0x02, + 0x13, 0x60, 0xD2, 0xF3, 0x0C, 0x03, 0x02, 0xBC, 0xA2, 0xDB, 0x14, 0x60, 0x65, 0xF3, 0x14, 0x60, + 0x29, 0xF3, 0x02, 0xBD, 0x02, 0xBC, 0xA2, 0xDB, 0x65, 0x44, 0x14, 0x60, 0x65, 0xFB, 0x07, 0x60, + 0xEC, 0xF3, 0x31, 0x41, 0x60, 0x40, 0x20, 0x2A, 0x40, 0xB9, 0x40, 0x26, 0x03, 0x00, 0x60, 0x40, + 0x01, 0x26, 0x80, 0xB9, 0x41, 0x51, 0xFA, 0x60, 0x3A, 0x65, 0x46, 0x60, 0x58, 0x4D, 0x4E, 0x78, + 0xFF, 0xFF, 0x03, 0x02, 0x44, 0x60, 0xAD, 0x78, 0xFF, 0xFF, 0x5B, 0xD3, 0xF8, 0x60, 0x3F, 0x65, + 0x00, 0x7F, 0xE0, 0x84, 0xE0, 0x84, 0x14, 0x60, 0x74, 0xF3, 0xE0, 0x9C, 0xA4, 0x84, 0xB0, 0x84, + 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0xBD, 0xD3, 0xFF, 0xFF, + 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0xE0, 0x84, 0x14, 0x60, 0x77, 0xF3, 0xE0, 0x9C, 0xA4, 0x84, + 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x28, 0x60, + 0xF4, 0x61, 0xA3, 0xD3, 0xFF, 0xFF, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0xE0, 0x84, 0xA1, 0xD3, + 0xE0, 0x9C, 0xA4, 0x84, 0xB0, 0x84, 0xA1, 0xDB, 0xA3, 0xD3, 0xFF, 0xFF, 0x00, 0x7F, 0xE0, 0x84, + 0xE0, 0x84, 0x59, 0xD3, 0xE0, 0x9C, 0xA4, 0x84, 0xB0, 0x84, 0xA1, 0xDB, 0x14, 0x60, 0x7D, 0xF3, + 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, + 0xA2, 0xDB, 0x14, 0x60, 0x80, 0xF3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, + 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x14, 0x60, 0x83, 0xF3, 0xFF, 0xFF, 0xA4, 0x84, + 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0xA3, 0xD3, + 0xFF, 0xFF, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0xE0, 0x84, 0x14, 0x60, 0x86, 0xF3, 0xE0, 0x9C, + 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, + 0x14, 0x60, 0x89, 0xF3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, + 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x14, 0x60, 0x8C, 0xF3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, + 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x02, 0xA3, 0xA3, 0xD3, + 0xF8, 0x60, 0x3F, 0x65, 0x00, 0x7F, 0xE0, 0x84, 0xE0, 0x84, 0x14, 0x60, 0x8F, 0xF3, 0xE0, 0x9C, + 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, + 0xBD, 0xD3, 0xFF, 0xFF, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0xE0, 0x84, 0x14, 0x60, 0x92, 0xF3, + 0xE0, 0x9C, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, + 0xA2, 0xDB, 0x29, 0x60, 0x2A, 0x61, 0xA3, 0xD3, 0xFF, 0xFF, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, + 0xE0, 0x84, 0xA1, 0xD3, 0xE0, 0x9C, 0xA4, 0x84, 0xB0, 0x84, 0xA1, 0xDB, 0xA3, 0xD3, 0xFF, 0xFF, + 0x00, 0x7F, 0xE0, 0x84, 0xE0, 0x84, 0x59, 0xD3, 0xE0, 0x9C, 0xA4, 0x84, 0xB0, 0x84, 0xA1, 0xDB, + 0x14, 0x60, 0x98, 0xF3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, + 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x14, 0x60, 0x9B, 0xF3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, + 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x14, 0x60, 0x9E, 0xF3, + 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, + 0xA2, 0xDB, 0xA3, 0xD3, 0xFF, 0xFF, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0xE0, 0x84, 0x14, 0x60, + 0xA1, 0xF3, 0xE0, 0x9C, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, + 0xB0, 0x84, 0xA2, 0xDB, 0x14, 0x60, 0xA4, 0xF3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, + 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x14, 0x60, 0xA7, 0xF3, 0xFF, 0xFF, + 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0xA4, 0x84, 0xB0, 0x84, 0xA2, 0xDB, + 0x00, 0x60, 0x6A, 0x63, 0x29, 0x60, 0x50, 0x61, 0x28, 0x60, 0xE4, 0x64, 0x58, 0xD1, 0x59, 0xD9, + 0xFD, 0x1F, 0x14, 0x60, 0xB0, 0xF3, 0xFF, 0xFF, 0x18, 0xAC, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, + 0x18, 0xAC, 0xA2, 0xDB, 0x14, 0x60, 0xB4, 0xF3, 0xFF, 0xFF, 0x18, 0xAC, 0xA2, 0xDB, 0x14, 0x60, + 0xB6, 0xF3, 0xFF, 0xFF, 0x18, 0xAC, 0xA2, 0xDB, 0x14, 0x60, 0xBD, 0xF3, 0xFF, 0xFF, 0x18, 0xAC, + 0xA2, 0xDB, 0x14, 0x60, 0xBF, 0xF3, 0xFF, 0xFF, 0x18, 0xAC, 0xA2, 0xDB, 0x14, 0x60, 0xCB, 0xF3, + 0xFF, 0xFF, 0x18, 0xAC, 0xA2, 0xDB, 0x5A, 0xD3, 0xFF, 0xFF, 0x18, 0xAC, 0xA2, 0xDB, 0x14, 0x60, + 0xCF, 0xF3, 0xFF, 0xFF, 0x18, 0xAC, 0xA2, 0xDB, 0x14, 0x60, 0xD1, 0xF3, 0xFF, 0xFF, 0x18, 0xAC, + 0xA2, 0xDB, 0x14, 0x60, 0xD8, 0xF3, 0xFF, 0xFF, 0x18, 0xAC, 0xA2, 0xDB, 0x14, 0x60, 0xDA, 0xF3, + 0xFF, 0xFF, 0x18, 0xAC, 0xA2, 0xDB, 0xFA, 0x60, 0x2C, 0x65, 0x46, 0x60, 0x58, 0x4D, 0x4E, 0x78, + 0xFF, 0xFF, 0x0E, 0x03, 0x63, 0x45, 0x2A, 0x60, 0xEA, 0x63, 0x06, 0x61, 0xA5, 0xD1, 0xDA, 0x85, + 0x64, 0x44, 0x0F, 0xB4, 0xBD, 0xDB, 0x64, 0x47, 0x0F, 0xB4, 0xCD, 0x81, 0xBD, 0xDB, 0xF6, 0x02, + 0xFA, 0x60, 0x30, 0x65, 0x46, 0x60, 0x58, 0x4D, 0x4E, 0x78, 0xFF, 0xFF, 0x14, 0x03, 0xBD, 0xD3, + 0x63, 0x46, 0x2B, 0x60, 0x82, 0x63, 0x15, 0x60, 0xD0, 0xFB, 0xDA, 0x85, 0xBD, 0xDB, 0x0E, 0x61, + 0xA6, 0xD1, 0xDA, 0x86, 0x64, 0x44, 0xFF, 0xB4, 0xA5, 0xDB, 0xDA, 0x85, 0x64, 0x47, 0xFF, 0xB4, + 0xCD, 0x81, 0xBD, 0xDB, 0xF5, 0x02, 0xFA, 0x60, 0x31, 0x65, 0x46, 0x60, 0x58, 0x4D, 0x4E, 0x78, + 0xFF, 0xFF, 0x22, 0x03, 0xBD, 0xD3, 0x15, 0x60, 0xEE, 0xFB, 0x5A, 0x81, 0x15, 0x60, 0xFD, 0xFB, + 0x5A, 0x82, 0x16, 0x60, 0x0C, 0xFB, 0x5A, 0x83, 0x16, 0x60, 0x1B, 0xFB, 0x5A, 0x84, 0x0E, 0x61, + 0xBD, 0xD1, 0xBD, 0xD5, 0x64, 0x44, 0xFF, 0xB4, 0x21, 0xDB, 0x5A, 0x81, 0x64, 0x47, 0xFF, 0xB4, + 0x22, 0xDB, 0x5A, 0x82, 0x66, 0x44, 0xFF, 0xB4, 0x23, 0xDB, 0x5A, 0x83, 0x66, 0x47, 0xFF, 0xB4, + 0x24, 0xDB, 0xCD, 0x81, 0x5A, 0x84, 0xEC, 0x02, 0xFA, 0x60, 0x47, 0x65, 0x46, 0x60, 0x58, 0x4D, + 0x4E, 0x78, 0xFF, 0xFF, 0x11, 0x03, 0x63, 0x45, 0x2C, 0x60, 0x54, 0x63, 0xA5, 0xD1, 0xDA, 0x85, + 0xBD, 0xD9, 0x02, 0x61, 0xA5, 0xD1, 0xDA, 0x85, 0x64, 0x47, 0x00, 0x7E, 0xBD, 0xDB, 0x64, 0x44, + 0x00, 0x7E, 0xCD, 0x81, 0xBD, 0xDB, 0xF6, 0x02, 0xFA, 0x60, 0x2E, 0x65, 0x46, 0x60, 0x58, 0x4D, + 0x4E, 0x78, 0xFF, 0xFF, 0x1F, 0x03, 0x63, 0x46, 0xFC, 0xA3, 0xA3, 0xD3, 0x2B, 0x60, 0x02, 0x63, + 0xCC, 0x84, 0xE8, 0x84, 0xCC, 0x81, 0x00, 0x36, 0x0D, 0x00, 0x63, 0x45, 0xA6, 0xD3, 0x5A, 0xD1, + 0xDA, 0x86, 0xFF, 0xB4, 0xE0, 0x84, 0xC4, 0x84, 0x5C, 0x90, 0xBD, 0xD9, 0xFD, 0x02, 0xCD, 0x81, + 0x66, 0x42, 0xF4, 0x02, 0x66, 0x42, 0x5A, 0xD3, 0x2B, 0x60, 0x42, 0x65, 0xBD, 0xDB, 0xD7, 0x80, + 0xFF, 0xFF, 0xFC, 0x02, 0x2C, 0x60, 0x68, 0x61, 0xFA, 0x60, 0x46, 0x65, 0x46, 0x60, 0x58, 0x4D, + 0x4E, 0x78, 0xFF, 0xFF, 0x01, 0x03, 0xA1, 0xDD, 0xD9, 0x81, 0xFA, 0x60, 0x2F, 0x65, 0x46, 0x60, + 0x58, 0x4D, 0x4E, 0x78, 0xFF, 0xFF, 0x01, 0x03, 0xA1, 0xDD, 0xD9, 0x81, 0xFA, 0x60, 0x3E, 0x65, + 0x46, 0x60, 0x58, 0x4D, 0x4E, 0x78, 0xFF, 0xFF, 0x01, 0x03, 0xA1, 0xDD, 0xD9, 0x81, 0xFA, 0x60, + 0x3F, 0x65, 0x46, 0x60, 0x58, 0x4D, 0x4E, 0x78, 0xFF, 0xFF, 0x01, 0x03, 0xA1, 0xDD, 0xD9, 0x81, + 0xFA, 0x60, 0x40, 0x65, 0x46, 0x60, 0x58, 0x4D, 0x4E, 0x78, 0xFF, 0xFF, 0x01, 0x03, 0xA1, 0xDD, + 0xD9, 0x81, 0xFA, 0x60, 0x3B, 0x65, 0x46, 0x60, 0x58, 0x4D, 0x4E, 0x78, 0xFF, 0xFF, 0x01, 0x03, + 0xA1, 0xDD, 0xFA, 0x60, 0x48, 0x65, 0x46, 0x60, 0x58, 0x4D, 0x4E, 0x78, 0xFF, 0xFF, 0x10, 0x03, + 0xBD, 0xD3, 0x2C, 0x60, 0xC4, 0x61, 0x0E, 0xB4, 0xBD, 0xD1, 0xA1, 0xDB, 0x64, 0x47, 0x0E, 0xB4, + 0xA3, 0xD1, 0x59, 0xDB, 0x64, 0x44, 0x0E, 0xB4, 0x59, 0xDB, 0x64, 0x47, 0x0E, 0xB4, 0x59, 0xDB, + 0xFA, 0x60, 0x29, 0x65, 0x46, 0x60, 0x58, 0x4D, 0x4E, 0x78, 0xFF, 0xFF, 0x07, 0x03, 0x04, 0xA3, + 0xA3, 0xD3, 0x20, 0x60, 0x00, 0x65, 0xB4, 0x84, 0x13, 0x60, 0xA6, 0xFB, 0xFA, 0x60, 0x2A, 0x65, + 0x46, 0x60, 0x58, 0x4D, 0x4E, 0x78, 0xFF, 0xFF, 0x30, 0x03, 0x04, 0xA3, 0xBD, 0xD1, 0x14, 0x60, + 0x4A, 0xF3, 0x64, 0x41, 0x64, 0x5E, 0xA2, 0xDB, 0x64, 0x47, 0x5A, 0xD3, 0x60, 0x5C, 0x64, 0x5F, + 0xA2, 0xDB, 0x14, 0x60, 0x60, 0xF3, 0xFF, 0x60, 0xC0, 0xB5, 0x61, 0x40, 0x80, 0x27, 0x05, 0x00, + 0xE9, 0x87, 0x3F, 0xB4, 0xB4, 0x84, 0xA2, 0xDB, 0x15, 0x00, 0x65, 0x44, 0xA2, 0xDB, 0xE1, 0x80, + 0xF9, 0x87, 0x01, 0x7F, 0x14, 0x60, 0x63, 0xF3, 0x60, 0x41, 0xE0, 0x84, 0xE0, 0x84, 0xE9, 0x81, + 0xF8, 0x84, 0xE9, 0x81, 0xF8, 0x84, 0xA2, 0xDB, 0x4A, 0xD3, 0xFF, 0x60, 0x80, 0x65, 0xA4, 0x84, + 0x34, 0x94, 0xA2, 0xDB, 0xDB, 0x83, 0x14, 0x60, 0xDF, 0xFD, 0xFA, 0x60, 0x2B, 0x65, 0x46, 0x60, + 0x58, 0x4D, 0x4E, 0x78, 0xFF, 0xFF, 0x07, 0x03, 0x04, 0xA3, 0xBD, 0xD3, 0x14, 0x60, 0x4D, 0xFB, + 0xA3, 0xD3, 0x14, 0x60, 0x11, 0xFB, 0xFA, 0x60, 0x3C, 0x65, 0x46, 0x60, 0x58, 0x4D, 0x4E, 0x78, + 0xFF, 0xFF, 0x1F, 0x03, 0xA3, 0xD3, 0xFC, 0x60, 0xFC, 0x65, 0xA4, 0x84, 0x60, 0x5C, 0x00, 0x7E, + 0xC0, 0x60, 0x00, 0xA0, 0x60, 0x43, 0x07, 0x04, 0x14, 0x60, 0x51, 0xF3, 0xFF, 0xFF, 0x03, 0x60, + 0xFF, 0xB4, 0x3C, 0x94, 0xA2, 0xDB, 0x28, 0x60, 0x2A, 0x61, 0x64, 0x44, 0x00, 0x7F, 0xC0, 0xA0, + 0x60, 0x47, 0x07, 0x04, 0x60, 0x43, 0xA1, 0xD3, 0xFF, 0xFF, 0x03, 0x60, 0xFF, 0xB4, 0x3C, 0x94, + 0xA1, 0xDB, 0xFA, 0x60, 0x49, 0x65, 0x46, 0x60, 0x58, 0x4D, 0x4E, 0x78, 0xFF, 0xFF, 0x1B, 0x03, + 0x32, 0x60, 0xAB, 0x61, 0x1C, 0x7C, 0x60, 0xFE, 0xA3, 0xD3, 0x5D, 0xD3, 0x0F, 0xB5, 0xD4, 0x84, + 0xA1, 0xDB, 0xBD, 0xD3, 0xFF, 0xFF, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0x5D, 0xD3, + 0x0F, 0xB5, 0xD4, 0x84, 0xA1, 0xDB, 0x67, 0x44, 0xC0, 0x9C, 0x64, 0x40, 0x00, 0x36, 0x10, 0x00, + 0x64, 0x40, 0x0E, 0x3A, 0xE9, 0x01, 0x20, 0xFE, 0xFA, 0x60, 0x4A, 0x65, 0x46, 0x60, 0x58, 0x4D, + 0x4E, 0x78, 0xFF, 0xFF, 0x05, 0x03, 0x32, 0x60, 0xC7, 0x61, 0x0E, 0x7C, 0x60, 0xFE, 0xDC, 0x01, + 0x20, 0xFE, 0xB8, 0xFE, 0xB9, 0xFE, 0xBA, 0xFE, 0xBB, 0xFE, 0xBD, 0xFE, 0xBF, 0xFE, 0x19, 0x60, + 0x48, 0xF3, 0x12, 0x63, 0x60, 0x40, 0x01, 0x27, 0x04, 0x00, 0x0B, 0x60, 0xEA, 0x62, 0x5A, 0xDF, + 0xFE, 0x1F, 0x41, 0x60, 0x6B, 0x78, 0xFF, 0xFF, 0x08, 0x60, 0x06, 0x63, 0xBE, 0xD3, 0xBD, 0xD1, + 0x07, 0x18, 0xD4, 0x80, 0x05, 0x18, 0x03, 0x03, 0xC3, 0x83, 0xC3, 0x83, 0xF7, 0x01, 0xDB, 0x83, + 0x00, 0xBC, 0x2D, 0x58, 0xFF, 0xFF, 0x86, 0xFD, 0xAA, 0x2D, 0x00, 0x00, 0x06, 0x00, 0x10, 0xFD, + 0x6E, 0x01, 0x00, 0x00, 0x02, 0x00, 0x14, 0xFD, 0x8E, 0x32, 0x00, 0x00, 0x0A, 0x00, 0x41, 0xFA, + 0x40, 0x2A, 0x00, 0x00, 0x22, 0x00, 0x42, 0xFA, 0x62, 0x2A, 0x00, 0x00, 0x22, 0x00, 0x43, 0xFA, + 0x84, 0x2A, 0x00, 0x00, 0x22, 0x00, 0x44, 0xFA, 0xA6, 0x2A, 0x00, 0x00, 0x22, 0x00, 0x45, 0xFA, + 0xC8, 0x2A, 0x00, 0x00, 0x22, 0x00, 0x25, 0xFD, 0x9E, 0x01, 0x00, 0x00, 0x02, 0x00, + +}; /* fw_image_3_data */ + +static const hcf_8 fw_image_4_data[] = { + 0x6C, 0x40, 0xA1, 0xFF, 0x98, 0xFF, 0x80, 0x3E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x41, 0xFF, 0x33, 0xF3, 0x02, 0x11, 0x31, 0x18, 0x1E, 0x00, 0x44, 0xFF, 0x2E, 0x00, 0xFF, 0xFF, + 0xC4, 0xE2, 0x27, 0x44, 0x20, 0x2A, 0x01, 0x00, 0xFF, 0xFF, 0x42, 0x64, 0x3A, 0xDB, 0x23, 0x00, + 0x41, 0xFF, 0xA2, 0x60, 0x45, 0x78, 0xE2, 0xFE, 0x40, 0x49, 0x02, 0x60, 0x01, 0xE1, 0x1D, 0x00, + 0x44, 0xFF, 0x1B, 0x09, 0x29, 0x44, 0x10, 0x2A, 0x04, 0x74, 0xCD, 0xE2, 0x10, 0x65, 0x0B, 0x00, + 0xA3, 0x60, 0xC1, 0x78, 0xA4, 0xE2, 0x29, 0x44, 0x20, 0x2A, 0x0D, 0x00, 0x20, 0xAC, 0xEC, 0x01, + 0xA3, 0x60, 0xC1, 0x78, 0x46, 0xFF, 0xB4, 0x84, 0x40, 0x49, 0xA1, 0xFF, 0xFF, 0xFF, 0x80, 0x3E, + 0xA3, 0x60, 0xC1, 0x78, 0xFF, 0xFF, 0x62, 0xFF, 0x08, 0xE1, 0xA1, 0xFF, 0x98, 0xFF, 0x80, 0x3E, + 0xAA, 0x60, 0xA5, 0x78, 0x4C, 0x4E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xAA, 0x60, 0xB3, 0x78, 0x44, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC4, 0xE2, 0x84, 0xFF, 0x22, 0x58, 0x82, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA4, 0x60, 0x39, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0xE1, 0x01, 0xFF, 0xFF, + 0x10, 0x29, 0xFA, 0x01, 0xE4, 0xE2, 0xAA, 0x60, 0x5F, 0x78, 0xB2, 0xF3, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC1, 0x60, 0xFC, 0x78, 0x64, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xAA, 0x60, 0x46, 0x78, 0xAC, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x80, 0x29, 0xE2, 0x01, 0xAA, 0x60, 0xA2, 0x78, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB5, 0x60, 0x5C, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB5, 0x60, 0x94, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB3, 0x60, 0xC9, 0x78, 0x42, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB3, 0x60, 0xFC, 0x78, 0x43, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB3, 0x60, 0xFC, 0x78, 0x44, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB7, 0x60, 0x20, 0x78, 0x45, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB3, 0x60, 0xFF, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x60, 0x83, 0x64, 0x80, 0x29, 0x09, 0xFB, 0xB5, 0x60, 0x25, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, + 0x98, 0xFF, 0x3A, 0x60, 0x18, 0x78, 0x40, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x39, 0x60, 0x8F, 0x78, 0x98, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC0, 0x60, 0x67, 0x78, 0x98, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xBF, 0x60, 0xE1, 0x78, 0x98, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xB7, 0x60, 0xE9, 0x78, 0x98, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xA1, 0xFF, 0x98, 0xFF, 0x83, 0x3E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC3, 0x60, 0x4D, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0x41, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0x42, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0xB0, 0xFF, 0xB1, 0xFF, 0x40, 0xFF, 0x43, 0xFF, 0xC3, 0x60, 0x48, 0x78, 0x44, 0xFF, 0xFF, 0x01, + 0xC3, 0x60, 0x4D, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0x3E, 0x60, 0x8C, 0x78, 0x45, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0xC3, 0x60, 0x48, 0x78, 0x84, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0xC3, 0x60, 0x47, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, + 0xCA, 0x60, 0xC8, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xF3, 0x60, 0x9A, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x42, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x85, 0x3E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xCA, 0x60, 0xD0, 0x78, 0x24, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xF2, 0x60, 0x47, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xCA, 0x60, 0xD0, 0x78, 0x44, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xCA, 0x60, 0xD0, 0x78, 0x84, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xCA, 0x60, 0xD0, 0x78, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x29, 0x60, 0xF2, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x2A, 0x60, 0x20, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x2A, 0x60, 0x3E, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x2A, 0x60, 0x1D, 0x78, 0x28, 0xE2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x2A, 0x60, 0x1D, 0x78, 0x44, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x2A, 0x60, 0x1D, 0x78, 0x45, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x2A, 0x60, 0x1D, 0x78, 0x46, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x60, 0x87, 0x64, 0x80, 0x29, 0x09, 0xFB, 0x47, 0xFF, 0x2A, 0x60, 0x1D, 0x78, 0xFF, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x43, 0xF7, 0xA7, 0xFF, 0x41, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x37, 0x60, 0x82, 0x78, 0x42, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x36, 0x60, 0x8F, 0x78, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x41, 0xFF, 0x00, 0x60, 0x03, 0xE1, 0x21, 0x46, 0x66, 0x45, 0x00, 0xF4, 0x2E, 0x44, 0x09, 0xFA, + 0x6A, 0x61, 0x7F, 0x60, 0xFE, 0x63, 0xA1, 0xFF, 0x9A, 0xFF, 0x05, 0x11, 0x0A, 0x00, 0x00, 0xF4, + 0x01, 0xF2, 0x17, 0x18, 0x7A, 0x61, 0x02, 0x25, 0x04, 0x00, 0x6C, 0x44, 0x7A, 0xDA, 0xFB, 0x1C, + 0xF6, 0x11, 0xD9, 0x81, 0x41, 0xFF, 0x02, 0x1C, 0x00, 0xF4, 0xDA, 0x82, 0x41, 0xFF, 0xC9, 0x81, + 0xCB, 0x83, 0x6C, 0x44, 0x5A, 0xDA, 0x02, 0x1C, 0x00, 0xF4, 0x81, 0xF2, 0x6C, 0x44, 0x5A, 0xDA, + 0xCB, 0x83, 0x02, 0x74, 0x02, 0x60, 0x04, 0xE1, 0x80, 0x60, 0x00, 0x61, 0x5D, 0x93, 0xB5, 0xFF, + 0x98, 0xFF, 0x26, 0x44, 0xFD, 0xB4, 0x84, 0xBC, 0x40, 0x46, 0x65, 0x46, 0x00, 0x64, 0x23, 0xFA, + 0x3F, 0xFC, 0x63, 0x47, 0x0A, 0x63, 0x0F, 0xFC, 0x00, 0xF4, 0x08, 0xFA, 0xCB, 0xFE, 0x18, 0xE1, + 0x44, 0xFF, 0xA1, 0xFF, 0x98, 0xFF, 0x80, 0x3E, 0xE2, 0xFE, 0x03, 0x04, 0xA3, 0x60, 0x05, 0x78, + 0xFF, 0xFF, 0xE0, 0xFE, 0x03, 0x04, 0xA3, 0x60, 0x1B, 0x78, 0xFF, 0xFF, 0xE1, 0xFE, 0x07, 0x05, + 0x9F, 0xFE, 0x03, 0x04, 0x3A, 0x60, 0x77, 0x78, 0xFF, 0xFF, 0x43, 0xFF, 0xA9, 0x01, 0x95, 0xF3, + 0xFF, 0xFF, 0x80, 0xB4, 0xFF, 0xFF, 0x08, 0x24, 0x16, 0x00, 0x29, 0x44, 0x08, 0x26, 0xE1, 0x01, + 0x72, 0x44, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xB2, 0xF3, 0xE8, 0x85, + 0xFF, 0xB7, 0xE0, 0x84, 0xE0, 0x84, 0xB4, 0x85, 0x73, 0x44, 0xD4, 0x84, 0x10, 0x65, 0xD4, 0x80, + 0xFF, 0xFF, 0x01, 0x05, 0x8F, 0x00, 0x80, 0x60, 0x01, 0xE0, 0xD5, 0x60, 0x84, 0xE7, 0xA1, 0xF3, + 0x7C, 0x45, 0x60, 0x40, 0x01, 0x23, 0x02, 0x65, 0x8C, 0x60, 0x48, 0x6A, 0xFF, 0xFF, 0x01, 0x16, + 0xFE, 0x01, 0x00, 0x60, 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, 0x7F, 0x6A, + 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x84, 0x60, 0x04, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, + 0x48, 0x60, 0x08, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x65, 0x4A, 0xFF, 0xFF, 0x01, 0x16, + 0xFE, 0x01, 0x84, 0x60, 0x04, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x40, 0x60, 0x08, 0x6A, + 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x65, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x95, 0x60, + 0x84, 0xE7, 0xBD, 0xFE, 0x0C, 0x60, 0x00, 0x62, 0x00, 0x60, 0x71, 0x7C, 0x00, 0x60, 0xB1, 0x65, + 0x3D, 0x60, 0x58, 0x4D, 0x0F, 0x78, 0xFF, 0xFF, 0x08, 0xE1, 0x62, 0xFF, 0xA3, 0xFF, 0xFF, 0xFF, + 0xA2, 0xFF, 0x02, 0x60, 0x08, 0xE1, 0xAE, 0x4F, 0x02, 0xBC, 0x00, 0x7F, 0xA0, 0x5E, 0x3F, 0x40, + 0x40, 0x26, 0x09, 0x00, 0x1C, 0x60, 0x09, 0xF3, 0x5A, 0xD1, 0xA0, 0x50, 0xA4, 0x52, 0x5A, 0xD3, + 0x5A, 0xD1, 0xA0, 0x50, 0xA4, 0x50, 0xDB, 0xF3, 0xF1, 0xF1, 0x01, 0xA8, 0x07, 0xA8, 0x0A, 0x03, + 0x09, 0x03, 0x64, 0x40, 0x01, 0x26, 0x09, 0x00, 0x1B, 0x60, 0xF3, 0xF3, 0xFF, 0xFF, 0x01, 0xB4, + 0xFF, 0xFF, 0x03, 0x02, 0xAD, 0x4F, 0xFA, 0xB4, 0xA0, 0x5D, 0x19, 0x60, 0xF6, 0xF1, 0x89, 0xFF, + 0x32, 0x40, 0x80, 0x2A, 0x1E, 0x00, 0x31, 0x40, 0x01, 0x2A, 0x1B, 0x00, 0x12, 0x60, 0xFF, 0xF3, + 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x05, 0x03, 0x0E, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, + 0x10, 0x00, 0x13, 0x60, 0x02, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x03, 0x03, 0x0F, 0xF2, + 0xFF, 0xFF, 0x07, 0x1B, 0x64, 0x40, 0x01, 0x26, 0x03, 0x00, 0x08, 0x60, 0x00, 0x75, 0x01, 0x00, + 0x10, 0xFF, 0x88, 0xFF, 0xA2, 0x60, 0x41, 0x78, 0xFF, 0xFF, 0x21, 0x46, 0x01, 0x5D, 0x5C, 0x62, + 0x03, 0xE1, 0x44, 0xFF, 0xA1, 0xFF, 0x9A, 0xFF, 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0x62, 0x62, + 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0xA1, 0xFF, 0x5A, 0xDC, 0x12, 0xE1, 0x02, 0x60, 0x01, 0xE1, + 0xA1, 0xFF, 0x98, 0xFF, 0x80, 0x3E, 0x28, 0x40, 0x40, 0x2B, 0x03, 0x00, 0x29, 0x40, 0x20, 0x27, + 0xA3, 0x00, 0xC8, 0x74, 0xCD, 0xE2, 0x29, 0x44, 0x08, 0xBC, 0x40, 0x49, 0x44, 0xFF, 0x05, 0xE1, + 0xDB, 0xF3, 0x37, 0x60, 0xE8, 0x63, 0x03, 0xA8, 0x04, 0xA8, 0x06, 0x03, 0x05, 0x03, 0xA3, 0xD3, + 0xFF, 0xFF, 0x01, 0xA8, 0x07, 0x18, 0x0A, 0x03, 0x28, 0x40, 0x08, 0x2A, 0x07, 0x00, 0x28, 0x40, + 0x48, 0x36, 0x04, 0x00, 0xF1, 0xF3, 0xFF, 0xFF, 0x02, 0xBC, 0xF1, 0xFB, 0x29, 0x44, 0xFF, 0x60, + 0xEF, 0x65, 0x24, 0x89, 0x40, 0x27, 0x3F, 0x00, 0x00, 0x00, 0x29, 0x40, 0x80, 0x27, 0x0B, 0x00, + 0x07, 0x61, 0xA1, 0xFF, 0xCD, 0x81, 0x04, 0x25, 0x61, 0x00, 0x87, 0x4C, 0xFB, 0x02, 0xF3, 0x60, + 0xA0, 0x64, 0x80, 0x4C, 0x07, 0x00, 0xA1, 0xFF, 0x9C, 0x4C, 0x9C, 0x4C, 0x9C, 0x4D, 0x05, 0x60, + 0xCF, 0x64, 0x80, 0x4C, 0x28, 0x40, 0x40, 0x2B, 0x05, 0x00, 0x29, 0x40, 0x20, 0x27, 0x02, 0x00, + 0x15, 0x60, 0x6F, 0x6B, 0x04, 0x25, 0x4A, 0x00, 0x30, 0x64, 0x3A, 0xDB, 0x44, 0xFF, 0x04, 0x25, + 0x45, 0x00, 0x04, 0x60, 0x00, 0x65, 0x25, 0x44, 0xB4, 0x84, 0x80, 0x4E, 0x2D, 0x41, 0x04, 0x25, + 0x3D, 0x00, 0x61, 0x4C, 0x00, 0x60, 0x8A, 0x65, 0xC5, 0x81, 0x61, 0x54, 0xA1, 0xFF, 0xFF, 0xFF, + 0x04, 0x25, 0x34, 0x00, 0x67, 0x4E, 0x07, 0x64, 0x1C, 0xFB, 0x00, 0xE1, 0x02, 0x60, 0x05, 0xE1, + 0xA1, 0xFF, 0x98, 0xFF, 0x80, 0x3E, 0x28, 0x40, 0x40, 0x27, 0x0A, 0x00, 0x1C, 0x65, 0x28, 0x40, + 0xA4, 0x36, 0x14, 0x65, 0x23, 0x44, 0xC4, 0x84, 0x28, 0x40, 0x08, 0x2A, 0x0C, 0x00, 0x07, 0x00, + 0x23, 0x44, 0x1C, 0xA4, 0x29, 0x40, 0x20, 0x27, 0x02, 0x00, 0x11, 0x60, 0x0F, 0x6B, 0x3C, 0x46, + 0x98, 0xF0, 0x23, 0x44, 0xC4, 0x84, 0x06, 0x74, 0x25, 0x5C, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, + 0xE0, 0x84, 0xB0, 0x84, 0x80, 0x4C, 0x9C, 0x4C, 0x44, 0xFF, 0x18, 0xE1, 0x0A, 0x64, 0x1E, 0x74, + 0x02, 0x60, 0x05, 0xE1, 0x40, 0x40, 0xA1, 0xFF, 0x98, 0xFF, 0x80, 0x3E, 0xC4, 0xE2, 0x27, 0x44, + 0x20, 0x2A, 0x06, 0x00, 0x42, 0x64, 0x3A, 0xDB, 0x67, 0x4C, 0xB1, 0x60, 0xAD, 0x78, 0xFF, 0xFF, + 0x41, 0x64, 0x3A, 0xDB, 0x62, 0xFF, 0x08, 0xE1, 0xE2, 0xFE, 0x72, 0x52, 0xA1, 0xFF, 0x98, 0xFF, + 0x80, 0x3E, 0xA1, 0xFF, 0x98, 0xFF, 0x80, 0x3E, 0x28, 0x40, 0x08, 0x27, 0x5A, 0x01, 0x3C, 0x46, + 0x8B, 0xFF, 0x84, 0x60, 0x00, 0xE4, 0x0F, 0x60, 0x90, 0x64, 0xC9, 0x60, 0x58, 0x4F, 0x56, 0x78, + 0xFF, 0xFF, 0x3F, 0xF2, 0x00, 0x60, 0x18, 0x70, 0x18, 0x71, 0x20, 0x72, 0x00, 0xF2, 0x60, 0x53, + 0x20, 0xE1, 0xA1, 0xFF, 0x88, 0x75, 0x00, 0xE1, 0xFF, 0xFF, 0x60, 0x50, 0x75, 0x44, 0x12, 0x71, + 0x6E, 0x72, 0x81, 0x75, 0xFF, 0xFF, 0x88, 0xFF, 0xA3, 0x60, 0x21, 0x78, 0xFF, 0xFF, 0x32, 0xF3, + 0x08, 0x29, 0x0A, 0x00, 0x60, 0x40, 0x07, 0x22, 0x07, 0x00, 0xFE, 0xB4, 0x32, 0xFB, 0x27, 0x44, + 0x10, 0xBC, 0xF7, 0xB4, 0x40, 0x47, 0x43, 0xFF, 0x00, 0x64, 0x3A, 0xDB, 0x01, 0x60, 0x08, 0xE1, + 0x31, 0x40, 0x01, 0x2A, 0x06, 0x00, 0x00, 0x64, 0x33, 0xFB, 0x01, 0x60, 0x0A, 0xE1, 0x25, 0x11, + 0x24, 0x0A, 0xE5, 0xFE, 0x2D, 0x05, 0x32, 0x40, 0x80, 0x2A, 0x05, 0x00, 0x19, 0x60, 0xF2, 0xF3, + 0xFF, 0xFF, 0x01, 0x18, 0x16, 0x00, 0x9F, 0xFE, 0x14, 0x05, 0x9D, 0xFE, 0x12, 0x04, 0x31, 0x41, + 0x40, 0x2A, 0x0F, 0x00, 0x07, 0x60, 0xE9, 0xF1, 0xAE, 0x4C, 0x90, 0x80, 0x10, 0x2A, 0x09, 0x00, + 0x7F, 0xB1, 0x07, 0x60, 0xE9, 0xFB, 0x60, 0x40, 0x10, 0x2A, 0x80, 0xB9, 0x41, 0x51, 0xDF, 0xFE, + 0x19, 0xFF, 0x9F, 0xFE, 0x02, 0x04, 0x40, 0xE1, 0x08, 0x00, 0x7C, 0xE1, 0x31, 0x44, 0x01, 0x2A, + 0x04, 0x00, 0xFD, 0xE1, 0x27, 0x44, 0x10, 0x26, 0x06, 0x00, 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, + 0xAA, 0x60, 0x6F, 0x78, 0xFF, 0xFF, 0x27, 0x44, 0x08, 0x26, 0xFF, 0xFF, 0xC1, 0x60, 0xA3, 0x78, + 0xFF, 0xFF, 0x48, 0xF3, 0x32, 0xF1, 0x00, 0x63, 0x64, 0x40, 0x07, 0x26, 0x03, 0x00, 0xA5, 0x60, + 0x0F, 0x78, 0xFF, 0xFF, 0x43, 0xFF, 0x31, 0x40, 0x08, 0x26, 0xF0, 0x01, 0xCD, 0xE2, 0x85, 0xE1, + 0x70, 0x41, 0xAD, 0x80, 0x71, 0x40, 0x80, 0x27, 0xE9, 0x12, 0x03, 0x03, 0xC2, 0x60, 0x15, 0x78, + 0xFF, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0xC4, 0xE2, 0x32, 0xFD, 0x60, 0x40, 0x01, 0x2A, 0xDB, 0x01, + 0x00, 0x63, 0x32, 0xFD, 0x3C, 0x46, 0x3E, 0xF2, 0x2A, 0xF0, 0x27, 0x41, 0x44, 0x48, 0x20, 0xB9, + 0x01, 0xB4, 0xF7, 0xB1, 0x0A, 0x03, 0x64, 0x40, 0x08, 0x27, 0x07, 0x00, 0x0F, 0x60, 0xDA, 0x63, + 0x00, 0x64, 0x45, 0xFB, 0x46, 0xFB, 0xBD, 0xDB, 0xA3, 0xDB, 0xC8, 0x0A, 0xC7, 0x11, 0x1B, 0x60, + 0xEE, 0xF3, 0xFF, 0xFF, 0x14, 0x18, 0x28, 0x40, 0xD4, 0x36, 0x11, 0x00, 0xAC, 0x4C, 0x80, 0x2A, + 0x0E, 0x00, 0x1B, 0x60, 0xF1, 0xF3, 0xFF, 0xFF, 0x0A, 0x18, 0x1B, 0x60, 0xF2, 0xF3, 0x1B, 0x60, + 0xEF, 0xF3, 0x60, 0x45, 0xD4, 0x80, 0xDC, 0x84, 0x02, 0x03, 0xA2, 0xDB, 0xAF, 0x01, 0x00, 0x64, + 0x1B, 0x60, 0xEF, 0xFB, 0x41, 0x47, 0x22, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x10, 0x26, 0x04, 0x00, + 0x01, 0x2A, 0x05, 0x00, 0x10, 0x2B, 0x03, 0x00, 0x29, 0x47, 0x20, 0xBF, 0x40, 0x49, 0x1B, 0x60, + 0xEE, 0xF3, 0xFF, 0xFF, 0x04, 0x18, 0xAE, 0x4F, 0x08, 0xBC, 0x00, 0x7F, 0xA0, 0x5E, 0x05, 0xE1, + 0x01, 0x60, 0x08, 0xE1, 0x2A, 0xE8, 0x3C, 0x46, 0x0F, 0xF0, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x2A, + 0x03, 0x00, 0xA7, 0x60, 0xE1, 0x78, 0xFF, 0xFF, 0x7D, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x27, + 0x0E, 0x00, 0x1F, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x40, 0x2B, 0x09, 0x00, 0x19, 0x60, 0x7B, 0xF3, + 0xFF, 0xFF, 0x60, 0x40, 0x02, 0x2A, 0x03, 0x00, 0xA8, 0x60, 0xEC, 0x78, 0xFF, 0xFF, 0x1F, 0xF2, + 0xC0, 0x60, 0x00, 0x65, 0xA4, 0x9C, 0x3F, 0x60, 0xCF, 0x65, 0x29, 0x44, 0xA4, 0x84, 0x30, 0x89, + 0x19, 0x60, 0x77, 0xF3, 0xFF, 0xFF, 0x19, 0x60, 0x55, 0xFB, 0x1F, 0xF2, 0x39, 0xF1, 0xE0, 0x60, + 0xFF, 0xB5, 0x0A, 0x18, 0x60, 0x47, 0x1F, 0xB4, 0xD0, 0x84, 0xE0, 0xA0, 0x02, 0x0D, 0x00, 0x64, + 0x02, 0x00, 0x01, 0x04, 0x1F, 0x64, 0x60, 0x47, 0xB4, 0x81, 0x07, 0x60, 0xEA, 0xF1, 0xFF, 0xFF, + 0xB1, 0x8C, 0x29, 0x40, 0x40, 0x2B, 0x10, 0x00, 0x29, 0x60, 0xC0, 0x65, 0x60, 0x47, 0x1F, 0xB4, + 0xE0, 0x84, 0xE0, 0x84, 0x44, 0xD3, 0x5A, 0xD1, 0x01, 0x60, 0x00, 0xE1, 0x01, 0x60, 0x09, 0x6B, + 0x60, 0x4C, 0xB5, 0xFF, 0x64, 0x4C, 0x14, 0x00, 0x29, 0x60, 0xC0, 0x65, 0x60, 0x47, 0x1F, 0xB4, + 0xE0, 0x84, 0xE0, 0x84, 0x44, 0xD3, 0x5A, 0xD1, 0x01, 0x60, 0x00, 0xE1, 0x05, 0x60, 0x69, 0x6B, + 0x60, 0x4C, 0xB5, 0xFF, 0x64, 0x4C, 0x7C, 0x44, 0x29, 0x40, 0x80, 0x2B, 0x67, 0x44, 0x60, 0x4C, + 0x00, 0xE1, 0x84, 0xFF, 0xC2, 0x60, 0x45, 0x64, 0x40, 0x42, 0x82, 0xFF, 0x0D, 0x00, 0xE5, 0xFE, + 0x03, 0x04, 0xAA, 0x60, 0x6F, 0x78, 0xFF, 0xFF, 0x32, 0xF1, 0xFF, 0xFF, 0x64, 0x40, 0x07, 0x22, + 0x43, 0xFF, 0xA3, 0x60, 0xF4, 0x78, 0xFF, 0xFF, 0x0B, 0x64, 0x3A, 0xDB, 0x01, 0x60, 0x0A, 0xE1, + 0x1C, 0x42, 0x22, 0x46, 0x13, 0xF2, 0xFF, 0x65, 0x60, 0x47, 0x2A, 0xF2, 0x40, 0x45, 0x40, 0x48, + 0x04, 0x2B, 0x13, 0x00, 0x16, 0xF2, 0x1D, 0xF2, 0x40, 0x43, 0x0F, 0xF2, 0x40, 0x4D, 0x0F, 0x64, + 0x14, 0xF0, 0x35, 0xF2, 0xA0, 0x82, 0x0F, 0xB4, 0xCA, 0x85, 0xD4, 0x80, 0x10, 0xF2, 0x01, 0x02, + 0x2B, 0xFA, 0x27, 0x44, 0x40, 0xBC, 0x40, 0x47, 0x13, 0x00, 0x17, 0xF2, 0x2C, 0xF0, 0x40, 0x43, + 0x1B, 0xF2, 0x1D, 0xFA, 0x40, 0x4D, 0x64, 0x40, 0x01, 0x2A, 0x02, 0x00, 0xAB, 0xFC, 0x05, 0x00, + 0x28, 0x40, 0xA4, 0x36, 0x02, 0x00, 0x11, 0xF2, 0x2B, 0xFA, 0x27, 0x44, 0xBF, 0xB4, 0x40, 0x47, + 0xF0, 0xFE, 0xB0, 0x60, 0xB0, 0x78, 0xFF, 0xFF, 0x22, 0x46, 0x2C, 0xF0, 0x27, 0x44, 0xDF, 0xB4, + 0x40, 0x47, 0x64, 0x40, 0x01, 0x26, 0x09, 0x00, 0x2A, 0xF2, 0x39, 0xF0, 0x8F, 0xB0, 0x88, 0x3A, + 0x0D, 0x00, 0x64, 0x44, 0x60, 0xB0, 0x20, 0x3A, 0x09, 0x00, 0x28, 0x44, 0x04, 0x27, 0x05, 0x00, + 0xD4, 0x3A, 0x03, 0x00, 0xAE, 0x4F, 0xF7, 0xB4, 0xA0, 0x5E, 0x11, 0x00, 0x2A, 0xF0, 0x01, 0x65, + 0x64, 0x40, 0xA4, 0x3A, 0x04, 0x65, 0x27, 0x44, 0x34, 0x87, 0x36, 0xF3, 0xFF, 0xFF, 0x60, 0x56, + 0xAD, 0xE2, 0x04, 0x64, 0x3A, 0xDB, 0x41, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, 0x06, 0x64, + 0x3A, 0xDB, 0x22, 0x46, 0x01, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0xC2, 0x60, 0x1E, 0x78, 0xFF, 0xFF, + 0x28, 0x40, 0xC4, 0x3A, 0x0C, 0x00, 0x27, 0x44, 0xFD, 0xB4, 0x40, 0x47, 0xA8, 0xE2, 0x05, 0xE1, + 0x01, 0x60, 0x08, 0xE1, 0x2A, 0xE8, 0x3C, 0x46, 0xA4, 0x60, 0xBF, 0x78, 0xFF, 0xFF, 0x3F, 0x40, + 0x01, 0x2B, 0x05, 0x00, 0x67, 0x4C, 0x01, 0x60, 0x00, 0xE1, 0x05, 0x60, 0x69, 0x6B, 0x07, 0x60, + 0xEB, 0xF1, 0x1F, 0xF2, 0x2A, 0xE8, 0xB0, 0x81, 0x29, 0x40, 0x40, 0x2B, 0x14, 0x00, 0x61, 0x4C, + 0x29, 0x60, 0xC0, 0x65, 0x61, 0x47, 0x1F, 0xB4, 0xE0, 0x84, 0xE0, 0x84, 0x44, 0xD3, 0x5A, 0xD1, + 0x01, 0x60, 0x00, 0xE1, 0x01, 0x60, 0x09, 0x6B, 0x60, 0x4C, 0xB5, 0xFF, 0xFF, 0x60, 0xF2, 0x64, + 0x64, 0x4C, 0x40, 0x43, 0x18, 0x00, 0x29, 0x47, 0x80, 0xB7, 0x34, 0x94, 0x60, 0x4C, 0x29, 0x60, + 0xC0, 0x65, 0x61, 0x47, 0x1F, 0xB4, 0xE0, 0x84, 0xE0, 0x84, 0x44, 0xD3, 0x5A, 0xD1, 0x01, 0x60, + 0x00, 0xE1, 0x05, 0x60, 0x69, 0x6B, 0x60, 0x4C, 0xB5, 0xFF, 0x64, 0x4C, 0x7C, 0x44, 0x29, 0x40, + 0x80, 0x2B, 0x67, 0x44, 0x60, 0x4C, 0x40, 0xE1, 0x01, 0x60, 0x08, 0xE1, 0x28, 0x45, 0xBF, 0x60, + 0xFF, 0x64, 0x24, 0x88, 0xC4, 0xE2, 0x08, 0x64, 0x3A, 0xDB, 0x21, 0x46, 0x2A, 0x44, 0x72, 0x45, + 0x24, 0xFA, 0xB2, 0xF3, 0x06, 0x04, 0xE4, 0xE2, 0xDC, 0x9C, 0x29, 0x40, 0x01, 0x26, 0x64, 0x44, + 0xB2, 0xF9, 0x25, 0xFA, 0xB3, 0xF3, 0x02, 0x04, 0xDC, 0x84, 0xB3, 0xFB, 0x28, 0xFA, 0xB4, 0xF3, + 0x02, 0x04, 0xDC, 0x84, 0xB4, 0xFB, 0x29, 0xFA, 0x24, 0x44, 0x04, 0x2A, 0x06, 0x00, 0x28, 0x40, + 0xA4, 0x36, 0x03, 0x00, 0xA6, 0x60, 0xB1, 0x78, 0xFF, 0xFF, 0x26, 0x43, 0x84, 0xBB, 0xFC, 0xB3, + 0x21, 0x46, 0x01, 0x5D, 0x0F, 0xFC, 0x5C, 0x46, 0x05, 0xFF, 0x27, 0x44, 0x01, 0x2A, 0x13, 0x00, + 0x50, 0xFE, 0x28, 0x40, 0x08, 0x3A, 0x12, 0x00, 0x2F, 0xF2, 0x30, 0xF0, 0x60, 0x43, 0x31, 0xF2, + 0x22, 0x46, 0x64, 0x41, 0x2C, 0xF0, 0x2D, 0xF0, 0xD3, 0x80, 0x2E, 0xF0, 0xD1, 0x80, 0xD0, 0x80, + 0x27, 0x44, 0x09, 0x0C, 0x03, 0x00, 0x27, 0x44, 0x06, 0x22, 0x05, 0x00, 0xB8, 0xB4, 0x40, 0x47, + 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0xD4, 0x64, 0x40, 0x48, 0x0D, 0x64, 0x3A, 0xDB, 0x7C, 0x44, + 0x1B, 0x60, 0xF0, 0xFB, 0x21, 0x46, 0x1C, 0xF2, 0x00, 0xE1, 0xF0, 0xFE, 0x00, 0x63, 0x28, 0x44, + 0xA4, 0x36, 0x0A, 0x00, 0x04, 0x2B, 0x08, 0x00, 0x30, 0xF3, 0x2D, 0x45, 0xD4, 0x84, 0xCA, 0x65, + 0xD4, 0x83, 0x01, 0x64, 0x1B, 0x60, 0xF0, 0xFB, 0xD4, 0x64, 0x35, 0x00, 0x0F, 0x64, 0x3A, 0xDB, + 0x21, 0x46, 0x29, 0x40, 0x40, 0x27, 0x15, 0x00, 0x80, 0x27, 0x02, 0x00, 0xCA, 0x65, 0x01, 0x00, + 0x6A, 0x65, 0x1C, 0xF2, 0xFF, 0xFF, 0x04, 0x7F, 0x40, 0x45, 0x0A, 0x36, 0x70, 0x64, 0x14, 0x36, + 0x38, 0x64, 0x37, 0x36, 0x15, 0x64, 0x6E, 0x3A, 0x17, 0x00, 0x84, 0x7F, 0x40, 0x45, 0x0B, 0x64, + 0x13, 0x00, 0x1C, 0xF2, 0x1E, 0x65, 0x40, 0x45, 0x0B, 0x36, 0x1E, 0x64, 0x0F, 0x36, 0x16, 0x64, + 0x0A, 0x36, 0x12, 0x64, 0x0E, 0x36, 0x0E, 0x64, 0x09, 0x36, 0x0E, 0x64, 0x0D, 0x36, 0x0A, 0x64, + 0x08, 0x36, 0x0A, 0x64, 0x0C, 0x36, 0x0A, 0x64, 0x40, 0x4D, 0x00, 0xE1, 0xF0, 0xFE, 0x2B, 0xF2, + 0xC4, 0x85, 0xD4, 0x83, 0xC4, 0x64, 0x40, 0x48, 0x2F, 0xF0, 0xB0, 0xF0, 0xB1, 0xF2, 0xA1, 0xFF, + 0x12, 0x74, 0xCD, 0xE2, 0x80, 0x4E, 0x12, 0x74, 0x83, 0x4C, 0x12, 0x74, 0x9A, 0xFF, 0x84, 0x4C, + 0x12, 0x74, 0x85, 0x4C, 0x12, 0x74, 0x81, 0x4C, 0x12, 0x74, 0xA1, 0xFF, 0x98, 0xFF, 0xB2, 0x60, + 0x58, 0x4F, 0x2D, 0x78, 0xFF, 0xFF, 0x01, 0x60, 0x18, 0xE1, 0x78, 0x44, 0x03, 0xA4, 0x35, 0xFB, + 0xB2, 0x60, 0x70, 0x78, 0xFF, 0xFF, 0x29, 0x44, 0xF7, 0xB4, 0x40, 0x49, 0x28, 0x40, 0xC4, 0x36, + 0x07, 0x00, 0x1B, 0x60, 0xF0, 0xF3, 0xFF, 0xFF, 0x03, 0x1B, 0xAE, 0x4F, 0xF7, 0xB4, 0xA0, 0x5E, + 0x27, 0x44, 0x01, 0x2A, 0x05, 0x00, 0xFE, 0xB4, 0x40, 0x47, 0xA5, 0x60, 0x7F, 0x78, 0xFF, 0xFF, + 0x16, 0x60, 0xAB, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x02, 0x36, 0xC1, 0xFE, 0xA3, 0x60, 0xE7, 0x78, + 0xFF, 0xFF, 0x28, 0x40, 0xB4, 0x3A, 0x0B, 0x00, 0x27, 0x44, 0x07, 0x22, 0x05, 0x00, 0xF8, 0xB4, + 0x40, 0x47, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0xA6, 0x60, 0x3E, 0x78, 0xFF, 0xFF, 0x28, 0x44, + 0xD4, 0x36, 0x03, 0x00, 0xA7, 0x60, 0xC8, 0x78, 0xFF, 0xFF, 0xA8, 0xE2, 0x27, 0x44, 0xFB, 0xB4, + 0x40, 0x47, 0x1C, 0x42, 0x22, 0x46, 0x19, 0x60, 0xCF, 0xF3, 0xFF, 0xFF, 0x34, 0xFB, 0x2A, 0xF0, + 0xF7, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDA, 0x60, 0x40, 0x40, 0x2B, 0xC4, 0x00, 0x22, 0xF2, + 0xFF, 0xFF, 0x60, 0x40, 0x22, 0x26, 0x3F, 0x00, 0x01, 0x26, 0x03, 0x00, 0x04, 0x26, 0x05, 0x00, + 0xBA, 0x00, 0x04, 0x2B, 0xB8, 0x00, 0xA6, 0xF5, 0x01, 0x00, 0x07, 0xF4, 0x4B, 0xF2, 0xFF, 0xFF, + 0xDC, 0x84, 0x4B, 0xFA, 0x0C, 0x60, 0xFC, 0x62, 0x80, 0xFF, 0xC8, 0x60, 0x78, 0x44, 0x02, 0xA4, + 0xA2, 0xDB, 0x8C, 0x78, 0xFF, 0xFF, 0x82, 0xFF, 0xA6, 0xF3, 0x66, 0x5C, 0xD0, 0x80, 0x00, 0x7C, + 0x07, 0x03, 0x66, 0x43, 0x22, 0x46, 0x22, 0xF2, 0x63, 0x46, 0x60, 0x40, 0x01, 0x2A, 0x01, 0x00, + 0x3C, 0xF1, 0x4B, 0xF0, 0x64, 0x41, 0x64, 0x47, 0x60, 0x5F, 0x20, 0xBC, 0x80, 0x26, 0x80, 0xAC, + 0x60, 0x47, 0x22, 0x46, 0x3A, 0xFA, 0x64, 0x44, 0x20, 0x7F, 0x34, 0x94, 0x3B, 0xFA, 0x08, 0x60, + 0x00, 0xEA, 0x0F, 0x64, 0x60, 0x7F, 0xA0, 0x5A, 0x80, 0x60, 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, + 0xD1, 0x60, 0x00, 0xEA, 0x80, 0x00, 0x2A, 0xF2, 0x00, 0x60, 0x7C, 0x62, 0x60, 0x40, 0x40, 0x2B, + 0x24, 0x00, 0xA2, 0xD3, 0x00, 0x61, 0x60, 0xFE, 0xA0, 0xD3, 0x5E, 0xD1, 0xFF, 0xFF, 0x20, 0xFE, + 0x64, 0x5F, 0xDC, 0x84, 0xF1, 0x81, 0xC0, 0x2B, 0x04, 0x00, 0x80, 0x2A, 0x02, 0x00, 0x7F, 0xA4, + 0xDC, 0x84, 0xFF, 0x3B, 0x03, 0x00, 0x60, 0x47, 0xDC, 0x87, 0x01, 0x61, 0xC0, 0x80, 0x00, 0x36, + 0xDC, 0x84, 0x4E, 0xDB, 0x60, 0xFE, 0x5A, 0xD1, 0xFF, 0xFF, 0xC1, 0x84, 0xF0, 0x22, 0x10, 0xA4, + 0xF0, 0x2A, 0x01, 0x00, 0x00, 0x64, 0xA2, 0xDB, 0x20, 0xFE, 0x00, 0x60, 0x3E, 0xF3, 0xFF, 0xFF, + 0xA0, 0xD3, 0x5A, 0xD1, 0x3A, 0xFA, 0x3B, 0xF8, 0x74, 0x62, 0xA2, 0xD0, 0xFF, 0xFF, 0x64, 0x44, + 0xE0, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xE1, 0x7F, 0x5A, 0xD0, 0xA0, 0x5A, 0x64, 0x44, 0xE2, 0x7F, + 0xA0, 0x5A, 0x00, 0x60, 0x40, 0xF3, 0xFF, 0xFF, 0xA0, 0xD1, 0x5A, 0xD1, 0x64, 0x45, 0x64, 0x44, + 0xE3, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xE4, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xE5, 0x7F, + 0xA0, 0x5A, 0x64, 0x47, 0xE6, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xE7, 0x7F, 0xA0, 0x5A, + 0x65, 0x40, 0x0D, 0x3A, 0x1C, 0x00, 0x64, 0x47, 0xE8, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, + 0xE9, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xEA, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xEB, 0x7F, + 0xA0, 0x5A, 0x64, 0x47, 0xEC, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xED, 0x7F, 0xA0, 0x5A, + 0x64, 0x47, 0xEE, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xEF, 0x7F, 0xA0, 0x5A, 0x08, 0x60, + 0x00, 0xEA, 0x65, 0x44, 0x02, 0xA4, 0x60, 0x7F, 0xA0, 0x5A, 0x80, 0x60, 0x00, 0xEA, 0xA0, 0x60, + 0x00, 0xEA, 0xD1, 0x60, 0x00, 0xEA, 0x0B, 0xF2, 0xFF, 0xFF, 0x7F, 0xB4, 0x0C, 0xF0, 0x04, 0x02, + 0x64, 0x46, 0x00, 0xF0, 0x04, 0x64, 0x22, 0x46, 0x03, 0xFA, 0x60, 0x41, 0x64, 0x46, 0x01, 0xF2, + 0xFC, 0xA1, 0x61, 0x45, 0xD4, 0x84, 0xFF, 0xFF, 0x08, 0x02, 0x00, 0xF0, 0x04, 0x63, 0x64, 0x46, + 0x01, 0xF2, 0x22, 0x46, 0x1A, 0xFA, 0x03, 0xFC, 0x02, 0x00, 0x22, 0x46, 0x1A, 0xFA, 0x35, 0xF2, + 0x04, 0xF8, 0xDC, 0x84, 0x35, 0xFA, 0x14, 0xF2, 0x0F, 0xB5, 0x0F, 0xB4, 0xCC, 0x84, 0x94, 0x80, + 0x04, 0x60, 0x00, 0x65, 0x2A, 0xF2, 0x01, 0x02, 0x94, 0x84, 0x2A, 0xFA, 0x95, 0xFC, 0x06, 0x00, + 0xC4, 0x3A, 0x07, 0x00, 0x27, 0x44, 0xFD, 0xB4, 0x40, 0x47, 0xA8, 0xE2, 0xA5, 0x60, 0x1C, 0x78, + 0xFF, 0xFF, 0x28, 0x44, 0x04, 0x26, 0x05, 0x00, 0x68, 0x3A, 0x03, 0x00, 0x32, 0x44, 0x00, 0x27, + 0x03, 0x00, 0xA3, 0x60, 0xF4, 0x78, 0xFF, 0xFF, 0x0A, 0x64, 0x3A, 0xDB, 0xA3, 0x60, 0xF4, 0x78, + 0xFF, 0xFF, 0x0E, 0x64, 0x3A, 0xDB, 0x3C, 0x44, 0x60, 0x46, 0x1E, 0xF0, 0x40, 0x42, 0x64, 0x40, + 0x40, 0x27, 0x48, 0x00, 0x1F, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x40, 0x27, 0x3C, 0x00, 0x80, 0x2B, + 0x0B, 0x00, 0xBF, 0x60, 0xFF, 0x65, 0x29, 0x44, 0x24, 0x89, 0x80, 0x60, 0x00, 0x65, 0x29, 0x44, + 0x34, 0x89, 0x80, 0x60, 0x00, 0x63, 0x05, 0x00, 0x3F, 0x60, 0xFF, 0x65, 0x29, 0x44, 0x24, 0x89, + 0x00, 0x63, 0x1E, 0xF2, 0x39, 0xF1, 0xC0, 0x60, 0xFF, 0xB5, 0x0A, 0x18, 0x60, 0x47, 0x1F, 0xB4, + 0xD0, 0x84, 0xE0, 0xA0, 0x02, 0x0D, 0x00, 0x64, 0x02, 0x00, 0x01, 0x04, 0x1F, 0x64, 0x60, 0x47, + 0xB4, 0x84, 0x07, 0x60, 0xEA, 0xF1, 0x3C, 0x94, 0xB0, 0x84, 0x60, 0x4C, 0x29, 0x60, 0xC0, 0x65, + 0x60, 0x47, 0x1F, 0xB4, 0xE0, 0x84, 0xE0, 0x84, 0x44, 0xD3, 0x5A, 0xD1, 0x01, 0x60, 0x00, 0xE1, + 0x05, 0x60, 0x69, 0x6B, 0x60, 0x4C, 0xB5, 0xFF, 0x64, 0x4C, 0x7C, 0x44, 0x29, 0x40, 0x80, 0x2B, + 0x67, 0x44, 0x60, 0x4C, 0x32, 0x00, 0x19, 0x60, 0x7B, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x04, 0x26, + 0xCB, 0x01, 0xBF, 0x01, 0x40, 0x60, 0x00, 0x65, 0x29, 0x44, 0x34, 0x89, 0x40, 0x60, 0x00, 0x63, + 0x9F, 0xF2, 0x1E, 0xF2, 0x39, 0xF1, 0xC0, 0x60, 0xFF, 0xB5, 0x0A, 0x18, 0x60, 0x47, 0x1F, 0xB4, + 0xD0, 0x84, 0xE0, 0xA0, 0x02, 0x0D, 0x00, 0x64, 0x02, 0x00, 0x01, 0x04, 0x1F, 0x64, 0x60, 0x47, + 0xB4, 0x84, 0x07, 0x60, 0xEA, 0xF1, 0x3C, 0x94, 0xB0, 0x81, 0x61, 0x4C, 0x29, 0x60, 0xC0, 0x65, + 0x61, 0x47, 0x1F, 0xB4, 0xE0, 0x84, 0xE0, 0x84, 0x44, 0xD3, 0x5A, 0xD1, 0x01, 0x60, 0x00, 0xE1, + 0x01, 0x60, 0x09, 0x6B, 0x60, 0x4C, 0xB5, 0xFF, 0x64, 0x4C, 0x40, 0xE1, 0x01, 0x60, 0x08, 0xE1, + 0x84, 0xFF, 0xC2, 0x60, 0x45, 0x64, 0x40, 0x42, 0x82, 0xFF, 0x2A, 0xF2, 0x10, 0x60, 0x00, 0x65, + 0xA4, 0x84, 0xB4, 0xBC, 0x1E, 0xF0, 0x40, 0x48, 0x64, 0x40, 0x40, 0x27, 0x17, 0x00, 0x1C, 0xF2, + 0xFF, 0xFF, 0x60, 0x40, 0x0A, 0x36, 0x06, 0x00, 0x14, 0x36, 0x07, 0x00, 0x37, 0x36, 0x08, 0x00, + 0x6E, 0x36, 0x09, 0x00, 0x70, 0x7C, 0xA0, 0x63, 0x0F, 0x00, 0x38, 0x7C, 0x50, 0x63, 0x0C, 0x00, + 0x15, 0x7C, 0x1E, 0x63, 0x09, 0x00, 0x0B, 0x7C, 0x0F, 0x63, 0x06, 0x00, 0x9C, 0xF4, 0xFF, 0x65, + 0x63, 0x47, 0xA4, 0x9C, 0xA7, 0x84, 0x23, 0x00, 0x40, 0x45, 0x43, 0x4D, 0x00, 0xE1, 0xF0, 0xFE, + 0x29, 0x40, 0x80, 0x2B, 0x03, 0x00, 0x00, 0x60, 0x6A, 0x65, 0x02, 0x00, 0x00, 0x60, 0xCA, 0x65, + 0x1F, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x40, 0x27, 0x0E, 0x00, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, + 0x04, 0x27, 0x03, 0x00, 0x65, 0x44, 0xE0, 0x85, 0x12, 0x00, 0x2B, 0xF2, 0x11, 0xF0, 0xC0, 0x84, + 0xD0, 0x84, 0xC4, 0x83, 0x11, 0x00, 0x1E, 0x64, 0xC4, 0x84, 0x60, 0x45, 0x08, 0x00, 0x40, 0x45, + 0xFF, 0x60, 0xF8, 0x64, 0x40, 0x43, 0x00, 0xE1, 0xF0, 0xFE, 0x00, 0x60, 0x3C, 0x65, 0x91, 0xF4, + 0x1B, 0xF0, 0xC3, 0x84, 0xC4, 0x84, 0xC0, 0x83, 0x28, 0x44, 0xA1, 0xFF, 0x12, 0x74, 0x80, 0x4E, + 0x12, 0x74, 0x83, 0x4C, 0x9A, 0xFF, 0x12, 0x74, 0x56, 0x62, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, + 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x5C, 0x62, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, + 0x7A, 0xD4, 0x12, 0x74, 0xA1, 0xFF, 0x98, 0xFF, 0xB2, 0x60, 0x58, 0x4F, 0x2D, 0x78, 0xFF, 0xFF, + 0xBC, 0xFF, 0xB5, 0xFF, 0x01, 0x60, 0x18, 0xE1, 0x47, 0xFF, 0x27, 0x44, 0x02, 0xBC, 0x40, 0x47, + 0x36, 0xF3, 0xB6, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0xC8, 0x60, 0x09, 0x7D, 0x7C, 0x4B, 0x60, 0x56, + 0xAD, 0xE2, 0xA5, 0x60, 0x79, 0x78, 0xFF, 0xFF, 0x19, 0x60, 0x7B, 0xF3, 0x19, 0x60, 0x3B, 0xF3, + 0x60, 0x40, 0x04, 0x26, 0x0B, 0x00, 0x07, 0xB4, 0x60, 0x40, 0x01, 0x36, 0x07, 0x00, 0x29, 0x44, + 0xBF, 0x60, 0xFF, 0xB7, 0x80, 0xBF, 0x40, 0x49, 0x80, 0x67, 0x05, 0x00, 0x3F, 0x60, 0xFF, 0x65, + 0x29, 0x44, 0x24, 0x89, 0x00, 0x64, 0x16, 0x60, 0x50, 0xF1, 0xFF, 0xFF, 0x19, 0x60, 0x55, 0xF9, + 0x39, 0xF1, 0x16, 0x60, 0x3C, 0xF1, 0x64, 0x41, 0x64, 0x5E, 0x60, 0x45, 0x64, 0x47, 0x1F, 0xB4, + 0x54, 0x94, 0xE0, 0xA0, 0x02, 0x0D, 0x00, 0x64, 0x02, 0x00, 0x01, 0x04, 0x1F, 0x64, 0x60, 0x47, + 0x07, 0x60, 0xEA, 0xF1, 0xB4, 0x84, 0xB0, 0x8C, 0x29, 0x60, 0xC0, 0x7C, 0x60, 0x47, 0x1F, 0xB4, + 0xE0, 0x84, 0xE0, 0x84, 0x40, 0xD3, 0x5A, 0xD1, 0x01, 0x60, 0x00, 0xE1, 0x05, 0x60, 0x69, 0x6B, + 0x60, 0x4C, 0xB5, 0xFF, 0x64, 0x4C, 0x7C, 0x44, 0x29, 0x40, 0x80, 0x2B, 0x67, 0x44, 0x60, 0x4C, + 0x40, 0xE1, 0x01, 0x60, 0x08, 0xE1, 0x84, 0xFF, 0xC2, 0x60, 0x45, 0x64, 0x40, 0x42, 0x82, 0xFF, + 0x3C, 0x44, 0x60, 0x46, 0x40, 0x42, 0x13, 0x64, 0x3A, 0xDB, 0x10, 0x60, 0x00, 0x65, 0x3C, 0x46, + 0x2A, 0xF2, 0x19, 0x60, 0x3B, 0xF1, 0xA4, 0x84, 0xC4, 0xBC, 0x40, 0x48, 0x64, 0x44, 0x04, 0x26, + 0x09, 0x00, 0x02, 0x26, 0x0A, 0x00, 0x01, 0x26, 0x0B, 0x00, 0x08, 0x2A, 0x03, 0x00, 0x0B, 0x63, + 0x6E, 0x64, 0x08, 0x00, 0x15, 0x63, 0x37, 0x64, 0x05, 0x00, 0x38, 0x63, 0x14, 0x64, 0x02, 0x00, + 0x70, 0x63, 0x0A, 0x64, 0x43, 0x4D, 0x40, 0x45, 0x00, 0xE1, 0xF0, 0xFE, 0x00, 0x60, 0x1E, 0x64, + 0x1B, 0xF0, 0x11, 0xF0, 0xC0, 0x84, 0xC0, 0x84, 0x60, 0x43, 0x28, 0x44, 0xA1, 0xFF, 0x12, 0x74, + 0x80, 0x4E, 0x12, 0x74, 0x83, 0x4C, 0x9A, 0xFF, 0x12, 0x74, 0x5C, 0x62, 0x7A, 0xD4, 0x12, 0x74, + 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0xA1, 0xFF, 0x98, 0xFF, 0xB2, 0x60, 0x58, 0x4F, + 0x2D, 0x78, 0xFF, 0xFF, 0x01, 0x60, 0x18, 0xE1, 0x78, 0x44, 0x03, 0xA4, 0x35, 0xFB, 0xB2, 0x60, + 0x70, 0x78, 0xFF, 0xFF, 0xC4, 0xE2, 0x08, 0x64, 0x3A, 0xDB, 0xA4, 0x60, 0xBF, 0x78, 0xFF, 0xFF, + 0x26, 0x43, 0x24, 0x40, 0x01, 0x2A, 0x0E, 0x00, 0x1D, 0xFF, 0x26, 0x44, 0x02, 0xBC, 0x40, 0x46, + 0x27, 0x44, 0x07, 0x22, 0x05, 0x00, 0xF8, 0xB4, 0x40, 0x47, 0x06, 0x64, 0x31, 0xFB, 0xC0, 0xFE, + 0x30, 0xF1, 0x81, 0x00, 0xFC, 0xB3, 0x32, 0x40, 0x01, 0x2A, 0x06, 0x00, 0x0A, 0xBB, 0x0F, 0xFC, + 0xCB, 0xFE, 0xA3, 0x60, 0xF4, 0x78, 0xFF, 0xFF, 0x24, 0x44, 0x04, 0x26, 0x29, 0x00, 0x0F, 0xFC, + 0x05, 0xFF, 0xDB, 0xF3, 0x28, 0x40, 0x80, 0x3A, 0x23, 0x00, 0x60, 0x40, 0x03, 0x3A, 0x20, 0x00, + 0x32, 0xF2, 0x7F, 0xF1, 0x33, 0xF2, 0xD0, 0x80, 0x80, 0xF1, 0x1A, 0x02, 0xD0, 0x80, 0x34, 0xF2, + 0x81, 0xF1, 0x16, 0x02, 0xD0, 0x80, 0x3C, 0x44, 0x13, 0x02, 0xAC, 0x86, 0xBB, 0xFE, 0x10, 0x03, + 0x2A, 0xF2, 0x21, 0x46, 0x60, 0x40, 0x80, 0x3A, 0x0B, 0x00, 0x01, 0x64, 0x31, 0xFB, 0xC0, 0xFE, + 0x00, 0x64, 0x32, 0xFB, 0x43, 0xFF, 0x84, 0xFF, 0xC2, 0x60, 0x45, 0x64, 0x40, 0x42, 0x82, 0xFF, + 0x30, 0xF1, 0x27, 0x44, 0x05, 0x22, 0x34, 0x00, 0xFA, 0xB4, 0x40, 0x47, 0x24, 0x44, 0x10, 0x2A, + 0x2B, 0x00, 0x28, 0x40, 0xD4, 0x3A, 0x28, 0x00, 0x31, 0x40, 0x08, 0x26, 0x00, 0x7C, 0x29, 0x40, + 0x50, 0x2B, 0x0D, 0x00, 0xEF, 0x60, 0xFF, 0x65, 0x29, 0x44, 0x24, 0x89, 0x31, 0x40, 0x08, 0x2A, + 0x06, 0x00, 0x1C, 0x60, 0x11, 0xF3, 0xFF, 0xFF, 0xE0, 0x85, 0x2B, 0x44, 0x05, 0x05, 0x2B, 0x44, + 0xFF, 0xA4, 0x01, 0xA4, 0x04, 0x24, 0x00, 0x64, 0xD0, 0x80, 0x70, 0x45, 0x02, 0x28, 0x64, 0x44, + 0xC4, 0x84, 0xFF, 0xFF, 0x04, 0x24, 0x00, 0xB4, 0x60, 0x50, 0x08, 0x28, 0x01, 0x00, 0x20, 0x29, + 0x6D, 0xE2, 0xA5, 0x60, 0x7F, 0x78, 0xFF, 0xFF, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x07, 0x00, + 0x02, 0x2A, 0x05, 0x00, 0xFD, 0xB4, 0x40, 0x47, 0x06, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x05, 0x64, + 0x3A, 0xDB, 0x28, 0x44, 0xA4, 0x3A, 0x07, 0x00, 0x01, 0x60, 0x02, 0x7C, 0x25, 0x44, 0x0A, 0x3A, + 0x02, 0x00, 0x01, 0x60, 0x3A, 0x7C, 0x31, 0x40, 0x08, 0x26, 0x00, 0x7C, 0x29, 0x40, 0x50, 0x2B, + 0x0D, 0x00, 0xEF, 0x60, 0xFF, 0x65, 0x29, 0x44, 0x24, 0x89, 0x31, 0x40, 0x08, 0x2A, 0x06, 0x00, + 0x1C, 0x60, 0x11, 0xF3, 0xFF, 0xFF, 0xE0, 0x85, 0x2B, 0x44, 0x05, 0x05, 0x2B, 0x44, 0xFF, 0xA4, + 0x01, 0xA4, 0x04, 0x24, 0x00, 0x64, 0xD0, 0x80, 0x70, 0x45, 0x02, 0x28, 0x64, 0x44, 0xC4, 0x84, + 0xFF, 0xFF, 0x04, 0x24, 0x00, 0xB4, 0x28, 0x40, 0xE4, 0x36, 0x00, 0xB4, 0x60, 0x50, 0x08, 0x28, + 0x01, 0x00, 0x20, 0x29, 0x6D, 0xE2, 0xA3, 0x60, 0xE7, 0x78, 0xFF, 0xFF, 0x27, 0x44, 0x05, 0x22, + 0x09, 0x00, 0xBA, 0xB4, 0x40, 0x47, 0x3C, 0x46, 0x02, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0xA3, 0x60, + 0xF4, 0x78, 0xFF, 0xFF, 0x27, 0x44, 0x02, 0x2A, 0x06, 0x00, 0xFD, 0xB4, 0x40, 0x47, 0x06, 0x64, + 0x31, 0xFB, 0xC0, 0xFE, 0xF4, 0x01, 0xF3, 0x0A, 0x7C, 0x50, 0x6D, 0xE2, 0xF0, 0x01, 0x72, 0x45, + 0xDC, 0x84, 0xB2, 0xFB, 0x11, 0x64, 0x3A, 0xDB, 0xB3, 0xF3, 0x06, 0x04, 0xDC, 0x84, 0xB3, 0xFB, + 0xB4, 0xF3, 0x02, 0x04, 0xDC, 0x84, 0xB4, 0xFB, 0xA4, 0x60, 0x01, 0x78, 0xFF, 0xFF, 0x00, 0x61, + 0x12, 0x64, 0x3A, 0xDB, 0x20, 0x60, 0x04, 0x63, 0xBD, 0xD3, 0x72, 0x45, 0x44, 0x8A, 0x02, 0x28, + 0x03, 0x00, 0xE4, 0xE2, 0xDD, 0x81, 0x04, 0x00, 0x02, 0x28, 0x02, 0x00, 0xE4, 0xE2, 0xDD, 0x81, + 0xBD, 0xD3, 0xB2, 0xF1, 0x61, 0x45, 0xC0, 0x84, 0x00, 0x61, 0x02, 0x24, 0x01, 0xB9, 0xC4, 0x84, + 0x60, 0x55, 0x2A, 0x52, 0xE4, 0xE2, 0xB2, 0xFB, 0x02, 0x24, 0x01, 0xB9, 0xBD, 0xD3, 0xB3, 0xF1, + 0x61, 0x45, 0xC0, 0x84, 0x00, 0x61, 0x02, 0x24, 0x01, 0xB9, 0xC4, 0x84, 0xB3, 0xFB, 0x02, 0x24, + 0x01, 0xB9, 0xBD, 0xD3, 0xB4, 0xF1, 0x61, 0x45, 0xC0, 0x84, 0xC4, 0x84, 0xB4, 0xFB, 0xA5, 0x60, + 0x14, 0x78, 0xFF, 0xFF, 0xB0, 0x60, 0x9E, 0x78, 0xFF, 0xFF, 0x47, 0xFF, 0x1B, 0x60, 0xEE, 0xF3, + 0xFF, 0xFF, 0x04, 0x18, 0xAE, 0x4F, 0x08, 0xBC, 0x00, 0x7F, 0xA0, 0x5E, 0xC8, 0x74, 0xCD, 0xE2, + 0xAA, 0x60, 0xB9, 0x78, 0x00, 0x61, 0xA3, 0x60, 0xF4, 0x78, 0xFF, 0xFF, 0xAB, 0x60, 0xE8, 0x78, + 0xFF, 0xFF, 0x21, 0x46, 0x5C, 0x44, 0x26, 0x44, 0x02, 0x26, 0x01, 0x00, 0x3E, 0x46, 0x09, 0xF2, + 0x46, 0x41, 0x66, 0x40, 0xF3, 0x18, 0x40, 0x5E, 0xFD, 0xFB, 0x02, 0x64, 0x40, 0x46, 0x41, 0x5D, + 0x00, 0x64, 0x31, 0xFA, 0x00, 0xF2, 0x46, 0x45, 0x87, 0xFC, 0xAC, 0xE2, 0x01, 0x64, 0x33, 0xFB, + 0x32, 0x40, 0x01, 0x2A, 0x21, 0x00, 0x19, 0xF3, 0x01, 0x60, 0x1E, 0xE1, 0x1D, 0x18, 0x80, 0x64, + 0x40, 0x49, 0x00, 0xE1, 0x19, 0xFF, 0x08, 0x64, 0x2A, 0xFA, 0x5A, 0xDA, 0x2C, 0xFA, 0x5A, 0xDA, + 0x5A, 0xDA, 0xF1, 0xF3, 0xFF, 0xFF, 0x02, 0xBC, 0xF1, 0xFB, 0x72, 0x44, 0x24, 0xFA, 0xB2, 0xF3, + 0x25, 0xFA, 0xA1, 0xFF, 0xFF, 0xFF, 0xB6, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0xC8, 0x60, 0x09, 0x7D, + 0x7C, 0x4B, 0xA3, 0x60, 0xF4, 0x78, 0xFF, 0xFF, 0x01, 0xE1, 0x01, 0x60, 0x1A, 0xE1, 0x3F, 0x60, + 0xCF, 0x65, 0x29, 0x44, 0x24, 0x89, 0x2E, 0x44, 0x00, 0x36, 0x48, 0x00, 0x01, 0x3A, 0xE5, 0x00, + 0x88, 0xFF, 0x40, 0x67, 0x29, 0x45, 0x34, 0x89, 0x04, 0x64, 0x89, 0xFF, 0x60, 0x54, 0x88, 0xFF, + 0xA1, 0xFF, 0x6C, 0x45, 0x65, 0x44, 0x0F, 0xB4, 0x40, 0x45, 0x1C, 0xFA, 0x65, 0x44, 0x29, 0x41, + 0xF9, 0x81, 0x52, 0x4A, 0x71, 0x89, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x83, 0x1D, 0xFC, + 0x1B, 0xFC, 0x10, 0x60, 0x00, 0x65, 0x29, 0x44, 0x34, 0x89, 0x50, 0x4B, 0x67, 0x50, 0x69, 0xE2, + 0xB6, 0xF1, 0xFC, 0xA3, 0xD3, 0x80, 0x43, 0x43, 0x03, 0x04, 0xAB, 0x60, 0xDE, 0x78, 0xFF, 0xFF, + 0x09, 0x7C, 0xD3, 0x80, 0x9A, 0xFF, 0x03, 0x07, 0xAB, 0x60, 0xDE, 0x78, 0xFF, 0xFF, 0x25, 0x44, + 0x01, 0x26, 0x0F, 0xAC, 0x26, 0x60, 0x4A, 0x65, 0x44, 0xD3, 0x12, 0x65, 0x45, 0x46, 0x60, 0x47, + 0x40, 0x7F, 0x27, 0xFA, 0x8F, 0xFC, 0x18, 0x61, 0xEA, 0xF1, 0xA1, 0xFF, 0x6C, 0x44, 0xDC, 0x80, + 0xFF, 0xFF, 0x21, 0x03, 0x50, 0xFE, 0xAC, 0x60, 0xC1, 0x78, 0xFF, 0xFF, 0xC8, 0x60, 0x0B, 0x7D, + 0x08, 0x60, 0x00, 0x6B, 0xB5, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0xAA, 0x74, 0xCD, 0xE2, 0x01, 0x64, + 0x89, 0xFF, 0x60, 0x54, 0x88, 0xFF, 0x01, 0x60, 0x08, 0xE1, 0x05, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, + 0x04, 0x25, 0x8B, 0x00, 0x6C, 0x44, 0x0A, 0x36, 0x07, 0x00, 0x14, 0x36, 0x05, 0x00, 0x37, 0x36, + 0x03, 0x00, 0x6E, 0x36, 0x01, 0x00, 0x81, 0x00, 0x40, 0x45, 0x32, 0x74, 0xA1, 0xFF, 0x1C, 0xFA, + 0x40, 0x4E, 0x8C, 0x44, 0x60, 0x43, 0x1D, 0xFA, 0x01, 0xE1, 0x20, 0x64, 0x3A, 0xDB, 0x2E, 0x44, + 0x14, 0x36, 0x12, 0x00, 0x0A, 0x36, 0x0F, 0x00, 0x63, 0x45, 0xE3, 0x83, 0xE3, 0x83, 0xC7, 0x83, + 0xE3, 0x83, 0xC7, 0x83, 0xFF, 0xFF, 0x37, 0x36, 0x05, 0x00, 0x6E, 0x36, 0x04, 0x00, 0xAC, 0x60, + 0xBF, 0x78, 0xFF, 0xFF, 0xEB, 0x83, 0xEB, 0x83, 0xEB, 0x83, 0xEB, 0x83, 0xFF, 0xFF, 0x80, 0x27, + 0xCF, 0x83, 0x1B, 0xFC, 0x01, 0x64, 0x51, 0xFB, 0xA1, 0xFF, 0x29, 0x41, 0xF9, 0x81, 0x52, 0x4A, + 0x71, 0x89, 0x2E, 0x44, 0x27, 0xFA, 0xB6, 0xF1, 0xFC, 0xA3, 0xD3, 0x80, 0x43, 0x43, 0x03, 0x04, + 0xAB, 0x60, 0xDE, 0x78, 0xFF, 0xFF, 0x9A, 0xFF, 0x54, 0x63, 0x12, 0x64, 0x40, 0x46, 0x8F, 0xFC, + 0x18, 0x61, 0xEA, 0xF1, 0x50, 0xFE, 0x6C, 0x40, 0x9E, 0x15, 0x01, 0x60, 0x08, 0xE1, 0x80, 0xE1, + 0x00, 0x64, 0x33, 0xFB, 0x29, 0x40, 0x50, 0x2B, 0x0F, 0x00, 0x2B, 0x44, 0x70, 0x45, 0xC4, 0x84, + 0xFF, 0xFF, 0x04, 0x24, 0x00, 0xB4, 0x60, 0x50, 0x08, 0x28, 0x01, 0x00, 0x20, 0x29, 0x6D, 0xE2, + 0xEF, 0x60, 0xFF, 0x65, 0x29, 0x44, 0x24, 0x89, 0x01, 0x60, 0x18, 0xE1, 0x01, 0x11, 0x12, 0x00, + 0x29, 0x44, 0x20, 0xBC, 0x40, 0x49, 0x01, 0x64, 0x33, 0xFB, 0xB6, 0xFF, 0x00, 0xE1, 0x01, 0x60, + 0x1A, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x6C, 0x40, 0xFC, 0x11, 0x01, 0x60, 0x18, 0xE1, 0xAE, 0x4F, + 0xF7, 0xB4, 0xA0, 0x5E, 0xB5, 0xFF, 0xB6, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0xC8, 0x60, 0x09, 0x7D, + 0x7C, 0x4B, 0x35, 0xE1, 0xAC, 0xE2, 0xAA, 0x60, 0x46, 0x78, 0xFF, 0xFF, 0x16, 0x60, 0x7F, 0xF3, + 0xFF, 0xFF, 0xDC, 0x84, 0x00, 0x36, 0x00, 0x3B, 0xA2, 0xDB, 0x21, 0x64, 0x3A, 0xDB, 0xBD, 0x01, + 0xAC, 0xE2, 0x01, 0x64, 0x33, 0xFB, 0x01, 0xE1, 0x3F, 0x60, 0xCF, 0x65, 0x29, 0x44, 0x24, 0x89, + 0x2E, 0x44, 0x00, 0x36, 0x21, 0x00, 0x01, 0x3A, 0xF0, 0x01, 0x88, 0xFF, 0x40, 0x67, 0x29, 0x45, + 0x34, 0x89, 0xA1, 0xFF, 0x6C, 0x45, 0x65, 0x44, 0x0F, 0xB4, 0x40, 0x45, 0x65, 0x44, 0x29, 0x41, + 0xF9, 0x81, 0x52, 0x4A, 0x71, 0x89, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x83, 0x0E, 0x7C, + 0xD3, 0x80, 0xFF, 0xFF, 0x03, 0x03, 0xAB, 0x60, 0xDE, 0x78, 0xFF, 0xFF, 0xA1, 0xFF, 0x6C, 0x44, + 0xDC, 0x80, 0xFF, 0xFF, 0xD2, 0x03, 0x41, 0x00, 0xC8, 0x60, 0x0B, 0x7D, 0x08, 0x60, 0x00, 0x6B, + 0xB5, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0xAA, 0x74, 0xCD, 0xE2, 0x01, 0x60, 0x08, 0xE1, 0x05, 0xE1, + 0xA1, 0xFF, 0xFF, 0xFF, 0x04, 0x25, 0xC1, 0x01, 0x6C, 0x44, 0x0A, 0x36, 0x07, 0x00, 0x14, 0x36, + 0x05, 0x00, 0x37, 0x36, 0x03, 0x00, 0x6E, 0x36, 0x01, 0x00, 0xB7, 0x01, 0x40, 0x45, 0x32, 0x74, + 0xA1, 0xFF, 0x40, 0x4E, 0x8C, 0x44, 0x60, 0x43, 0x01, 0xE1, 0x20, 0x64, 0x3A, 0xDB, 0x2E, 0x44, + 0x14, 0x36, 0x09, 0x00, 0x0A, 0x36, 0x07, 0x00, 0x37, 0x36, 0x05, 0x00, 0x6E, 0x36, 0x03, 0x00, + 0xAC, 0x60, 0xBF, 0x78, 0xFF, 0xFF, 0x01, 0x64, 0x51, 0xFB, 0xA1, 0xFF, 0x29, 0x41, 0xF9, 0x81, + 0x52, 0x4A, 0x71, 0x89, 0x0E, 0x7C, 0xD3, 0x80, 0x43, 0x43, 0x03, 0x03, 0xAB, 0x60, 0xDE, 0x78, + 0xFF, 0xFF, 0x6C, 0x40, 0xFF, 0xFF, 0x01, 0x15, 0x90, 0x01, 0x12, 0x64, 0x40, 0x46, 0xEA, 0xF1, + 0x50, 0xFE, 0xA1, 0xFF, 0x12, 0x61, 0x8C, 0x44, 0xEB, 0xF0, 0x40, 0x48, 0x8C, 0x44, 0x30, 0xFB, + 0x04, 0x61, 0x50, 0xFE, 0x8C, 0x44, 0xD0, 0x80, 0x8C, 0x44, 0xD4, 0x80, 0x8C, 0x44, 0xEC, 0xF1, + 0x00, 0x65, 0xD0, 0x80, 0x28, 0x44, 0x01, 0x0C, 0x13, 0x00, 0x10, 0x65, 0x60, 0x40, 0xC4, 0x36, + 0x04, 0x00, 0xD4, 0x3A, 0x0D, 0x00, 0x27, 0x40, 0x40, 0x26, 0x30, 0x65, 0x35, 0x84, 0xA1, 0xFF, + 0x8C, 0x44, 0x47, 0xFF, 0x50, 0x4B, 0x67, 0x50, 0x69, 0xE2, 0x6A, 0x44, 0x40, 0x2B, 0x09, 0x15, + 0x2C, 0x60, 0xEC, 0x64, 0xF1, 0x60, 0x78, 0x41, 0xE4, 0x78, 0xB5, 0xF1, 0x2A, 0x64, 0x3A, 0xDB, + 0x1C, 0x01, 0x29, 0x40, 0x10, 0x26, 0x02, 0x00, 0x04, 0x74, 0xCD, 0xE2, 0x8C, 0x44, 0xB6, 0xFF, + 0xB7, 0xFF, 0x01, 0x60, 0x18, 0xE1, 0x05, 0xE1, 0x00, 0x64, 0x33, 0xFB, 0xA1, 0xFF, 0x6C, 0x44, + 0xA1, 0xFF, 0x6C, 0x44, 0x29, 0x40, 0x40, 0x2B, 0x03, 0x00, 0xB6, 0xFF, 0xA1, 0xFF, 0x6C, 0x44, + 0xA1, 0xFF, 0x02, 0x74, 0x29, 0x44, 0x40, 0x27, 0x05, 0x74, 0xCD, 0xE2, 0xA1, 0xFF, 0xCB, 0xF3, + 0xC4, 0xE2, 0x89, 0xFF, 0x60, 0x54, 0x88, 0xFF, 0xDC, 0x84, 0xE0, 0x94, 0x26, 0x44, 0x84, 0xBC, + 0x40, 0x46, 0x23, 0x64, 0x3A, 0xDB, 0xB5, 0xFF, 0xBC, 0xFF, 0x47, 0xFF, 0xB6, 0xFF, 0xB7, 0xFF, + 0xB4, 0xFF, 0xC8, 0x60, 0x09, 0x7D, 0x7C, 0x4B, 0xA9, 0x60, 0x88, 0x78, 0xFF, 0xFF, 0x29, 0x64, + 0x3A, 0xDB, 0xA2, 0xFC, 0x32, 0x40, 0x01, 0x2A, 0xB9, 0x00, 0x01, 0x60, 0x1A, 0xE1, 0x23, 0x43, + 0xA1, 0xFF, 0xEC, 0x44, 0x2A, 0xFA, 0x40, 0x48, 0xA1, 0xFF, 0x7A, 0xDC, 0x7E, 0x36, 0x04, 0xA2, + 0xFC, 0x1C, 0x03, 0x1D, 0x00, 0x64, 0x3F, 0xFA, 0x2E, 0x00, 0x03, 0x2B, 0x04, 0x00, 0xA1, 0xFF, + 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0x8F, 0xB0, 0x88, 0x3A, 0x03, 0x00, 0x70, 0x62, 0xA1, 0xFF, + 0x7A, 0xDC, 0x28, 0x40, 0x40, 0x2B, 0x06, 0x00, 0x72, 0x62, 0xA1, 0xFF, 0x7A, 0xDC, 0x7A, 0xDC, + 0x7A, 0xDC, 0x7A, 0xDC, 0x3F, 0xFC, 0x00, 0xF4, 0x10, 0x62, 0x6E, 0x61, 0xA1, 0xFF, 0x05, 0x1D, + 0x12, 0x1E, 0x0C, 0x00, 0x00, 0xF4, 0x7C, 0x61, 0x02, 0x62, 0x7A, 0xDC, 0x63, 0x40, 0xFD, 0x1C, + 0xF9, 0x1D, 0xFF, 0xB1, 0x08, 0x1E, 0x02, 0x02, 0x00, 0xF4, 0x02, 0x62, 0xB6, 0xFF, 0xB7, 0xFF, + 0xA1, 0xFF, 0x6C, 0x44, 0x5A, 0xDA, 0x98, 0xFF, 0xA1, 0xFF, 0x6C, 0x40, 0xA1, 0xFF, 0x47, 0xFF, + 0x7C, 0x44, 0x33, 0xFB, 0x26, 0x44, 0xFD, 0xB4, 0x84, 0xBC, 0x01, 0x15, 0x7F, 0xB4, 0x40, 0x46, + 0x6C, 0x40, 0xB6, 0xFF, 0xB7, 0xFF, 0xA1, 0xFF, 0x6C, 0x45, 0xA1, 0xFF, 0x7F, 0x60, 0x7F, 0x7C, + 0x6C, 0x44, 0xA0, 0x84, 0x15, 0xA7, 0x15, 0xA4, 0x21, 0x46, 0x26, 0xFA, 0x29, 0x40, 0x40, 0x2B, + 0x07, 0x00, 0xB6, 0xFF, 0x40, 0x60, 0x00, 0x65, 0xA1, 0xFF, 0x6C, 0x44, 0x1A, 0xFA, 0x09, 0x00, + 0x65, 0x44, 0x0F, 0xB4, 0x06, 0xA8, 0x80, 0x60, 0x00, 0x65, 0x08, 0x28, 0x7C, 0x45, 0x29, 0x44, + 0x34, 0x89, 0x27, 0xF0, 0x65, 0x44, 0x64, 0x5E, 0x27, 0xFA, 0x81, 0xE1, 0x01, 0x60, 0x18, 0xE1, + 0x01, 0x11, 0x12, 0x00, 0x29, 0x44, 0x20, 0xBC, 0x40, 0x49, 0x01, 0x64, 0x33, 0xFB, 0xB6, 0xFF, + 0x00, 0xE1, 0x01, 0x60, 0x1A, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x6C, 0x40, 0xFC, 0x11, 0x01, 0x60, + 0x18, 0xE1, 0xAE, 0x4F, 0xF7, 0xB4, 0xA0, 0x5E, 0x00, 0x70, 0x00, 0x64, 0x40, 0x4B, 0x21, 0x46, + 0xB5, 0xFF, 0xBC, 0xFF, 0x47, 0xFF, 0xB6, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0xC8, 0x60, 0x09, 0x7D, + 0x7C, 0x4B, 0x28, 0x44, 0x04, 0x27, 0x09, 0x00, 0xD4, 0x36, 0x04, 0x00, 0x0C, 0x22, 0x02, 0x00, + 0x0C, 0x3A, 0x03, 0x00, 0xAE, 0x4F, 0xF7, 0xB4, 0xA0, 0x5E, 0x2A, 0x44, 0x72, 0x45, 0x24, 0xFA, + 0xB2, 0xF3, 0x06, 0x04, 0xE4, 0xE2, 0xDC, 0x9C, 0x29, 0x40, 0x01, 0x26, 0x64, 0x44, 0xB2, 0xF9, + 0x25, 0xFA, 0xB3, 0xF3, 0x02, 0x04, 0xDC, 0x84, 0xB3, 0xFB, 0x28, 0xFA, 0xB4, 0xF3, 0x02, 0x04, + 0xDC, 0x84, 0xB4, 0xFB, 0x29, 0xFA, 0xA9, 0x60, 0x88, 0x78, 0xFF, 0xFF, 0xA1, 0xFF, 0x19, 0x60, + 0xA3, 0xF3, 0x12, 0x61, 0x60, 0x40, 0x01, 0x2A, 0x08, 0x00, 0x00, 0x64, 0x3B, 0xFA, 0xBF, 0x60, + 0xFF, 0x65, 0x8C, 0x44, 0x3D, 0xFA, 0xA4, 0x84, 0x01, 0x00, 0x8C, 0x44, 0xEB, 0xF0, 0x2A, 0xFA, + 0x40, 0x48, 0x04, 0x26, 0x48, 0x00, 0xA1, 0xFF, 0x8C, 0x44, 0x5A, 0xDA, 0x30, 0xFB, 0x6C, 0x44, + 0x2C, 0xFA, 0xFF, 0xFF, 0x01, 0x26, 0x2B, 0x00, 0xD0, 0x80, 0xA1, 0xFF, 0x8C, 0x44, 0x6C, 0x5C, + 0x00, 0xE1, 0xF2, 0xFE, 0x2D, 0xFA, 0xEC, 0xF3, 0xD4, 0x80, 0xD0, 0x80, 0x2E, 0xF8, 0x24, 0x44, + 0x16, 0x0C, 0x32, 0x40, 0x02, 0x2A, 0x07, 0x00, 0x28, 0x42, 0x0C, 0xB2, 0x08, 0x3A, 0x03, 0x00, + 0x10, 0xBC, 0x40, 0x44, 0x61, 0x00, 0x04, 0x0A, 0xA1, 0xFF, 0xAB, 0x60, 0xE7, 0x78, 0xFF, 0xFF, + 0x11, 0xBC, 0x40, 0x44, 0x28, 0x45, 0xBF, 0x60, 0xFF, 0x64, 0x24, 0x88, 0x55, 0x00, 0x30, 0xBC, + 0x40, 0x44, 0x22, 0xF0, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0x4D, 0x00, 0x20, 0xB9, + 0x5C, 0x8E, 0xA1, 0xFF, 0x8C, 0x44, 0x2D, 0xFA, 0xDC, 0x9C, 0x6C, 0x44, 0x00, 0xE1, 0xF2, 0xFE, + 0x2E, 0xFA, 0x08, 0x28, 0x44, 0x4E, 0xDC, 0x84, 0x2E, 0x5C, 0xB0, 0x84, 0xEF, 0xB1, 0x08, 0x24, + 0x40, 0xB9, 0x41, 0x46, 0x39, 0x00, 0x23, 0x41, 0x13, 0x64, 0x51, 0x90, 0x56, 0x63, 0x03, 0x04, + 0xAB, 0x60, 0xDE, 0x78, 0xFF, 0xFF, 0x8C, 0x44, 0x04, 0x61, 0x2B, 0xFA, 0x50, 0xFE, 0x80, 0x27, + 0x00, 0x64, 0x30, 0xFB, 0x8C, 0x44, 0x2C, 0xFA, 0xD0, 0x80, 0x8C, 0x44, 0x2D, 0xFA, 0xD4, 0x80, + 0x00, 0x65, 0x8C, 0x44, 0xEC, 0xF1, 0x2E, 0xFA, 0xD0, 0x80, 0x28, 0x44, 0x03, 0x0C, 0xA0, 0x2A, + 0x0A, 0x00, 0x11, 0x00, 0x10, 0x65, 0x60, 0x40, 0xC4, 0x36, 0x04, 0x00, 0xD4, 0x3A, 0x08, 0x00, + 0x27, 0x40, 0x40, 0x26, 0x30, 0x65, 0x00, 0x64, 0x3F, 0xFA, 0x46, 0x4E, 0x35, 0x84, 0x64, 0x00, + 0x40, 0x26, 0xF9, 0x01, 0x30, 0x65, 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0x04, 0x61, 0xF3, 0x01, + 0xA1, 0xFF, 0xAB, 0x60, 0xA5, 0x78, 0xFF, 0xFF, 0xFF, 0x60, 0xFE, 0x65, 0x23, 0x43, 0xE8, 0xA3, + 0x80, 0x27, 0xF6, 0x01, 0x20, 0xE6, 0x08, 0x60, 0x00, 0xEB, 0x28, 0x44, 0x03, 0x2B, 0x05, 0x00, + 0x6A, 0x62, 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0x28, 0x44, 0x8F, 0xB0, 0x88, 0x3A, 0x03, 0x00, + 0x70, 0x62, 0x7A, 0xDC, 0x28, 0x44, 0x40, 0x2B, 0x0D, 0x00, 0x72, 0x62, 0x7A, 0xDC, 0xA1, 0xFF, + 0x6C, 0x5C, 0x5A, 0xD8, 0xE4, 0x40, 0x20, 0x2B, 0x03, 0x00, 0x7A, 0xDC, 0x7A, 0xDC, 0xF8, 0xA3, + 0x25, 0xFF, 0xB0, 0xFF, 0x3F, 0xFC, 0x00, 0xF4, 0x10, 0x62, 0x10, 0x61, 0x57, 0x90, 0x6C, 0x61, + 0xA1, 0xFF, 0x09, 0x07, 0x02, 0x1D, 0x28, 0x1E, 0x1F, 0x00, 0xCB, 0x83, 0x7A, 0xDC, 0xFE, 0x1C, + 0xD9, 0x81, 0x22, 0x1E, 0x19, 0x00, 0xCB, 0x83, 0x0E, 0xA3, 0xA7, 0x84, 0xF2, 0xA3, 0x7A, 0xDC, + 0xFE, 0x1C, 0x03, 0x1D, 0x7C, 0xA8, 0xD9, 0x81, 0x0A, 0x02, 0x00, 0xF4, 0x02, 0x62, 0xA7, 0x84, + 0x7A, 0x61, 0x7A, 0xDC, 0xFE, 0x1C, 0xF9, 0x1D, 0x7C, 0xA8, 0xD9, 0x81, 0xF6, 0x03, 0xFF, 0xB1, + 0x0B, 0x1E, 0x02, 0x02, 0x00, 0xF4, 0x02, 0x62, 0xA1, 0xFF, 0xFF, 0xFF, 0xB6, 0xFF, 0xB7, 0xFF, + 0x6C, 0x44, 0x5A, 0xDA, 0xCD, 0x81, 0x64, 0x40, 0x46, 0x45, 0x28, 0x44, 0x40, 0x2B, 0x0E, 0x00, + 0x64, 0x40, 0x20, 0x2B, 0x0B, 0x00, 0x01, 0xA2, 0x62, 0x44, 0x46, 0x45, 0x21, 0x46, 0x00, 0xF4, + 0x02, 0x62, 0x9A, 0xFF, 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0x7A, 0xDC, 0x01, 0x60, 0x18, 0xE1, + 0x24, 0x76, 0xAD, 0xE2, 0x41, 0xE1, 0x98, 0xFF, 0x00, 0xE6, 0x01, 0xF2, 0x61, 0x45, 0xD4, 0x9E, + 0x21, 0x46, 0x16, 0xFA, 0x25, 0x44, 0x06, 0xFA, 0xA1, 0xFF, 0x8C, 0x44, 0xA1, 0xFF, 0x47, 0xFF, + 0x29, 0x40, 0x50, 0x2B, 0x06, 0x00, 0x2B, 0x44, 0x1C, 0x60, 0x11, 0xFB, 0x70, 0x45, 0x44, 0x8B, + 0x01, 0x00, 0x50, 0x4B, 0x67, 0x50, 0x69, 0xE2, 0x25, 0x46, 0x01, 0xF2, 0x61, 0x45, 0xD4, 0x9E, + 0x21, 0x46, 0x16, 0xFA, 0x25, 0x45, 0x86, 0xF8, 0xFF, 0xFF, 0x6A, 0x44, 0x40, 0x2B, 0x03, 0x15, + 0xAF, 0x60, 0xF3, 0x78, 0xFF, 0xFF, 0x29, 0x40, 0x10, 0x26, 0x04, 0x00, 0x04, 0x74, 0xCD, 0xE2, + 0xA1, 0xFF, 0xFF, 0xFF, 0x6C, 0x44, 0xB6, 0xFF, 0xB7, 0xFF, 0xC4, 0xE2, 0x01, 0x60, 0x18, 0xE1, + 0x05, 0x76, 0xAD, 0xE2, 0x41, 0xE1, 0xA1, 0xFF, 0x6C, 0x45, 0xA1, 0xFF, 0x65, 0x41, 0x7F, 0x60, + 0x7F, 0x7C, 0x6C, 0x44, 0xA0, 0x84, 0x15, 0xA7, 0x15, 0xA4, 0x21, 0x46, 0x26, 0xFA, 0x22, 0x46, + 0x10, 0xFA, 0x21, 0x46, 0x29, 0x40, 0x40, 0x2B, 0x07, 0x00, 0xB6, 0xFF, 0xA1, 0xFF, 0x40, 0x60, + 0x00, 0x65, 0x6C, 0x44, 0x1A, 0xFA, 0x09, 0x00, 0x65, 0x44, 0x0F, 0xB4, 0x06, 0xA8, 0x80, 0x60, + 0x00, 0x65, 0x08, 0x28, 0x7C, 0x45, 0x29, 0x44, 0x34, 0x89, 0x00, 0x64, 0x33, 0xFB, 0x40, 0x21, + 0x00, 0x00, 0xAC, 0xE2, 0x05, 0xE1, 0x27, 0xF0, 0x65, 0x44, 0x64, 0x5E, 0x27, 0xFA, 0x28, 0x44, + 0x8F, 0xB0, 0x88, 0x3A, 0x09, 0x00, 0x39, 0xF2, 0xFF, 0xFF, 0x60, 0xB0, 0x20, 0x3A, 0x04, 0x00, + 0x24, 0x44, 0xFF, 0x60, 0xDF, 0xB4, 0x40, 0x44, 0x28, 0x40, 0x03, 0x26, 0xE2, 0x00, 0x31, 0x40, + 0x20, 0x2A, 0x03, 0x00, 0x28, 0x40, 0x50, 0x3A, 0xDC, 0x00, 0x24, 0x44, 0x20, 0x2A, 0xD9, 0x00, + 0x29, 0x40, 0x50, 0x2B, 0x0D, 0x00, 0xEF, 0x60, 0xFF, 0x65, 0x29, 0x44, 0x24, 0x89, 0x31, 0x40, + 0x08, 0x2A, 0x06, 0x00, 0x1C, 0x60, 0x11, 0xF3, 0xFF, 0xFF, 0xE0, 0x85, 0x2B, 0x44, 0x06, 0x05, + 0x2B, 0x44, 0xFF, 0xA4, 0x01, 0xA4, 0x04, 0x24, 0x00, 0x64, 0x40, 0x4B, 0xAC, 0x80, 0x28, 0x40, + 0xB4, 0x3A, 0x03, 0x00, 0x02, 0x03, 0x30, 0xFB, 0xBC, 0x00, 0x28, 0x44, 0xBF, 0x60, 0xFF, 0x65, + 0xA4, 0x84, 0x40, 0x48, 0x2B, 0x50, 0xA1, 0xFF, 0xFF, 0xFF, 0x01, 0x60, 0x08, 0xE1, 0x1C, 0xF2, + 0xC4, 0xE2, 0x40, 0x45, 0x28, 0x40, 0xC4, 0x36, 0x9C, 0x00, 0x29, 0x40, 0x40, 0x2B, 0x48, 0x00, + 0x32, 0x60, 0xFA, 0x63, 0x60, 0x40, 0x0B, 0x36, 0x20, 0x00, 0x0F, 0x36, 0x1B, 0x00, 0x0A, 0x36, + 0x16, 0x00, 0x0E, 0x36, 0x11, 0x00, 0x09, 0x36, 0x0C, 0x00, 0x0D, 0x36, 0x07, 0x00, 0x08, 0x36, + 0x02, 0x00, 0xA3, 0xD3, 0x15, 0x00, 0x02, 0xA3, 0xA3, 0xD3, 0x12, 0x00, 0x04, 0xA3, 0xA3, 0xD3, + 0x0F, 0x00, 0x06, 0xA3, 0xA3, 0xD3, 0x0C, 0x00, 0x08, 0xA3, 0xA3, 0xD3, 0x09, 0x00, 0x0A, 0xA3, + 0xA3, 0xD3, 0x06, 0x00, 0x0C, 0xA3, 0xA3, 0xD3, 0x03, 0x00, 0x0E, 0xA3, 0xA3, 0xD3, 0xFF, 0xFF, + 0x2C, 0x60, 0x7C, 0x63, 0x60, 0x40, 0x0C, 0x36, 0x19, 0x00, 0x08, 0x36, 0x15, 0x00, 0x0D, 0x36, + 0x11, 0x00, 0x09, 0x36, 0x0D, 0x00, 0x0E, 0x36, 0x09, 0x00, 0x0A, 0x36, 0x05, 0x00, 0x0F, 0x36, + 0x01, 0x00, 0x39, 0x00, 0x02, 0xA3, 0x37, 0x00, 0x04, 0xA3, 0x35, 0x00, 0x06, 0xA3, 0x33, 0x00, + 0x08, 0xA3, 0x31, 0x00, 0x0A, 0xA3, 0x2F, 0x00, 0x0C, 0xA3, 0x2D, 0x00, 0x0E, 0xA3, 0x2B, 0x00, + 0x33, 0x60, 0x0A, 0x63, 0x25, 0x44, 0x0A, 0x36, 0x0C, 0x00, 0x14, 0x36, 0x07, 0x00, 0x37, 0x36, + 0x02, 0x00, 0xA3, 0xD3, 0x09, 0x00, 0x02, 0xA3, 0xA3, 0xD3, 0x06, 0x00, 0x04, 0xA3, 0xA3, 0xD3, + 0x03, 0x00, 0x06, 0xA3, 0xA3, 0xD3, 0xFF, 0xFF, 0x40, 0x45, 0x0A, 0x36, 0x0D, 0x00, 0x14, 0x36, + 0x38, 0x64, 0x37, 0x3A, 0x03, 0x00, 0x04, 0x7F, 0x40, 0x45, 0x15, 0x64, 0x6E, 0x3A, 0x09, 0x00, + 0x84, 0x7F, 0x40, 0x45, 0x0B, 0x64, 0x05, 0x00, 0x29, 0x44, 0x7F, 0x60, 0xFF, 0xB4, 0x40, 0x49, + 0x70, 0x64, 0x40, 0x4D, 0x02, 0x00, 0x40, 0x45, 0x0A, 0x00, 0x2C, 0x60, 0x74, 0x63, 0x0A, 0x36, + 0x06, 0x00, 0x14, 0x36, 0x02, 0xA3, 0x37, 0x36, 0x04, 0xA3, 0x6E, 0x36, 0x06, 0xA3, 0x28, 0xA3, + 0xA3, 0xD1, 0xD8, 0xA3, 0x19, 0x60, 0x55, 0xF9, 0x39, 0xF1, 0xA3, 0xD1, 0x64, 0x41, 0x64, 0x5E, + 0x60, 0x45, 0x64, 0x47, 0x1F, 0xB4, 0x54, 0x94, 0xE0, 0xA0, 0x02, 0x0D, 0x00, 0x64, 0x02, 0x00, + 0x01, 0x04, 0x1F, 0x64, 0x60, 0x47, 0xB4, 0x85, 0x29, 0x44, 0xC0, 0x60, 0x00, 0xB4, 0xB4, 0x84, + 0x1F, 0xFA, 0xB5, 0xFF, 0xA1, 0xFF, 0xCB, 0xF3, 0xC4, 0xE2, 0x89, 0xFF, 0x60, 0x54, 0x88, 0xFF, + 0xDC, 0x84, 0xE0, 0x94, 0xFF, 0x60, 0xCF, 0x65, 0x29, 0x44, 0x24, 0x89, 0xA5, 0x60, 0x88, 0x78, + 0x04, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0xC4, 0xE2, 0xA1, 0xFF, 0xFF, 0x60, 0xCF, 0x65, 0x29, 0x44, + 0x24, 0x89, 0xCB, 0xF3, 0xC4, 0xE2, 0x89, 0xFF, 0x60, 0x54, 0x88, 0xFF, 0xDC, 0x84, 0xE0, 0x94, + 0x26, 0x44, 0x84, 0xBC, 0x24, 0x40, 0x0C, 0x22, 0xFD, 0xB4, 0x40, 0x46, 0x23, 0x64, 0x3A, 0xDB, + 0xAD, 0x60, 0x4F, 0x78, 0xFF, 0xFF, 0x27, 0x40, 0x26, 0x22, 0x05, 0x00, 0xF8, 0xB4, 0x40, 0x47, + 0x06, 0x64, 0x31, 0xFB, 0xC0, 0xFE, 0x29, 0x40, 0x10, 0x26, 0x02, 0x00, 0x04, 0x74, 0xCD, 0xE2, + 0x01, 0x60, 0x18, 0xE1, 0x01, 0x60, 0x18, 0xE1, 0x01, 0x11, 0x12, 0x00, 0x29, 0x44, 0x20, 0xBC, + 0x40, 0x49, 0x01, 0x64, 0x33, 0xFB, 0xB6, 0xFF, 0x00, 0xE1, 0x01, 0x60, 0x1A, 0xE1, 0xA1, 0xFF, + 0xFF, 0xFF, 0x6C, 0x40, 0xFC, 0x11, 0x01, 0x60, 0x18, 0xE1, 0xAE, 0x4F, 0xF7, 0xB4, 0xA0, 0x5E, + 0xB5, 0xFF, 0x47, 0xFF, 0xB6, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0xC8, 0x60, 0x09, 0x7D, 0x7C, 0x4B, + 0x29, 0x40, 0x50, 0x2B, 0x1B, 0x00, 0x31, 0x40, 0x08, 0x2A, 0x0D, 0x00, 0x1C, 0x60, 0x11, 0xF3, + 0xFF, 0xFF, 0xE0, 0x85, 0x2B, 0x44, 0x07, 0x04, 0x70, 0x45, 0xC4, 0x84, 0xEF, 0x60, 0xFF, 0x65, + 0x29, 0x44, 0x24, 0x89, 0x11, 0x00, 0x2B, 0x44, 0x70, 0x45, 0xC4, 0x84, 0xFF, 0xFF, 0x04, 0x24, + 0x00, 0xB4, 0x40, 0x4B, 0xEF, 0x60, 0xFF, 0x65, 0x29, 0x44, 0x24, 0x89, 0x37, 0xF3, 0x2B, 0x45, + 0xD4, 0x80, 0xFF, 0xFF, 0x02, 0x28, 0x65, 0x44, 0x60, 0x50, 0xA0, 0x4C, 0x20, 0xBC, 0xFF, 0xB4, + 0xA0, 0x51, 0x00, 0x60, 0x2E, 0x7C, 0x74, 0x44, 0xC0, 0x94, 0x32, 0x40, 0x02, 0x2A, 0x19, 0x00, + 0x28, 0x44, 0xA4, 0x36, 0x03, 0x00, 0x0C, 0xB4, 0x04, 0x36, 0x13, 0x00, 0x26, 0x43, 0xFD, 0xB3, + 0x04, 0xBB, 0x43, 0x46, 0x01, 0x2A, 0x03, 0x00, 0x28, 0x47, 0x40, 0xBF, 0x40, 0x48, 0x0A, 0xBB, + 0x0F, 0xFC, 0x50, 0x4B, 0x67, 0x50, 0x00, 0x64, 0x30, 0xFB, 0x05, 0xFF, 0xAD, 0x60, 0x4F, 0x78, + 0xFF, 0xFF, 0x24, 0x64, 0x3A, 0xDB, 0x28, 0x44, 0x04, 0x2A, 0x03, 0x00, 0xA3, 0x60, 0xE7, 0x78, + 0xFF, 0xFF, 0x32, 0x40, 0x04, 0x2A, 0x1C, 0x00, 0x28, 0x44, 0x0C, 0xB0, 0x08, 0x3A, 0x18, 0x00, + 0x2C, 0xF0, 0x22, 0xF0, 0x64, 0x40, 0x01, 0x26, 0x0B, 0x00, 0x64, 0x40, 0x40, 0x2B, 0x10, 0x00, + 0x8F, 0xB0, 0x88, 0x3A, 0x0D, 0x00, 0x39, 0xF2, 0xFF, 0xFF, 0x60, 0xB0, 0x20, 0x3A, 0x08, 0x00, + 0x26, 0x44, 0xFD, 0xB4, 0x04, 0xBC, 0x40, 0x46, 0xFC, 0xB4, 0x0F, 0xFA, 0x05, 0xFF, 0x01, 0x00, + 0x1D, 0xFF, 0x01, 0xE2, 0x26, 0x40, 0x10, 0x2A, 0x06, 0x00, 0x2C, 0x60, 0xEA, 0x64, 0xF1, 0x60, + 0x78, 0x41, 0xE4, 0x78, 0xB5, 0xF1, 0xA3, 0x60, 0xE7, 0x78, 0xFF, 0xFF, 0x03, 0x0A, 0xA3, 0x60, + 0xF4, 0x78, 0xFF, 0xFF, 0x01, 0x64, 0x51, 0xFB, 0x1B, 0x60, 0xEE, 0xF3, 0xFF, 0xFF, 0x04, 0x18, + 0xAE, 0x4F, 0x08, 0xBC, 0x00, 0x7F, 0xA0, 0x5E, 0xE1, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, + 0x54, 0x62, 0x22, 0x46, 0xA2, 0xD0, 0x16, 0x63, 0x7C, 0x41, 0x44, 0x48, 0x80, 0x36, 0x04, 0x61, + 0x28, 0x40, 0x50, 0x36, 0x04, 0x61, 0x41, 0x4E, 0x28, 0x44, 0xA4, 0x36, 0x0E, 0x63, 0x9A, 0xFF, + 0xA1, 0xFF, 0x19, 0x60, 0xA3, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, 0x06, 0x00, 0x3D, 0xF2, + 0xAA, 0xF0, 0xFF, 0xFF, 0xB4, 0x84, 0x08, 0x36, 0x2A, 0xFA, 0x12, 0x74, 0xCD, 0xE2, 0x54, 0x62, + 0xA2, 0xD2, 0xFF, 0xFF, 0x6A, 0x40, 0x80, 0x4E, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, + 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, + 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0xFF, 0xFF, 0x01, 0x1D, 0xB2, 0x00, 0x7A, 0xD4, 0x12, 0x74, + 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x28, 0x40, 0x03, 0x2B, + 0x06, 0x00, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x70, 0x62, + 0x28, 0x44, 0x8F, 0xB0, 0x88, 0x3A, 0x02, 0x00, 0x7A, 0xD4, 0x12, 0x74, 0x28, 0x40, 0x40, 0x2B, + 0x16, 0x00, 0x72, 0x62, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD2, 0x12, 0x74, 0x80, 0x4C, 0x20, 0x2B, + 0x05, 0x00, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x22, 0xF2, 0xFF, 0xFF, + 0x60, 0x40, 0x10, 0x26, 0x04, 0x00, 0x26, 0x26, 0x4D, 0x00, 0x26, 0x27, 0x4B, 0x00, 0x23, 0x43, + 0xFF, 0xFF, 0x06, 0x1D, 0x2E, 0x1E, 0x00, 0x00, 0x03, 0xF0, 0x04, 0xF4, 0x64, 0x42, 0x3D, 0x00, + 0x2E, 0x40, 0x04, 0x2A, 0x27, 0x00, 0xA1, 0xFF, 0x02, 0xFE, 0x10, 0x25, 0x42, 0xFE, 0x12, 0x74, + 0x72, 0x45, 0x65, 0x4C, 0xB2, 0xF3, 0x03, 0x04, 0xE4, 0xE2, 0xDC, 0x84, 0xB2, 0xFB, 0xA1, 0xFF, + 0x12, 0x74, 0x80, 0x4C, 0x12, 0x74, 0xB3, 0xF3, 0x02, 0x04, 0xDC, 0x84, 0xB3, 0xFB, 0x80, 0x4C, + 0x12, 0x74, 0xB4, 0xF3, 0x02, 0x04, 0xDC, 0x84, 0xB4, 0xFB, 0x80, 0x4C, 0x12, 0x74, 0x5C, 0x4E, + 0xF8, 0xA3, 0x03, 0xF2, 0x9A, 0xF2, 0x04, 0xF4, 0xFF, 0xB1, 0xF8, 0xA1, 0x06, 0xA4, 0x60, 0x42, + 0x0A, 0x00, 0x4E, 0x00, 0x03, 0xF2, 0x9A, 0xF2, 0x04, 0xF4, 0xC8, 0x82, 0xFF, 0xB1, 0x03, 0x00, + 0x00, 0xF4, 0x81, 0xF2, 0xFF, 0xB1, 0x7A, 0xD4, 0x12, 0x74, 0xFD, 0x1C, 0xF9, 0x1D, 0xFF, 0xB1, + 0x1B, 0x1E, 0x02, 0x02, 0x00, 0xF4, 0xDA, 0x82, 0xDA, 0x82, 0xA2, 0xD2, 0xA1, 0xFF, 0x09, 0x74, + 0x60, 0x4D, 0x12, 0x00, 0x03, 0xF2, 0x9A, 0xF2, 0x04, 0xF4, 0x23, 0x43, 0xA1, 0xFF, 0x12, 0x74, + 0xA0, 0xD2, 0xFE, 0xA1, 0xCB, 0x83, 0x60, 0x4E, 0xAF, 0x83, 0x03, 0x1D, 0x05, 0x03, 0x12, 0x74, + 0xEB, 0x01, 0xA1, 0xFF, 0x12, 0x74, 0xDF, 0x01, 0x12, 0x74, 0xDA, 0x83, 0x66, 0x44, 0x22, 0x46, + 0x0C, 0xFA, 0x22, 0xF2, 0x0B, 0xFC, 0x28, 0x40, 0x40, 0x2B, 0x1A, 0x00, 0x10, 0x26, 0x04, 0x00, + 0x26, 0x26, 0x0F, 0x00, 0x26, 0x27, 0x0D, 0x00, 0x00, 0xF4, 0x02, 0x62, 0xA1, 0xFF, 0x12, 0x74, + 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, 0x7A, 0xD4, 0x12, 0x74, + 0x07, 0x00, 0xA1, 0xFF, 0x12, 0x74, 0x9C, 0x4E, 0x12, 0x74, 0x9C, 0x4C, 0x12, 0x74, 0x00, 0x00, + 0x88, 0xFF, 0xA1, 0xFF, 0xB2, 0x60, 0x58, 0x4F, 0x2D, 0x78, 0xFF, 0xFF, 0x01, 0x60, 0x18, 0xE1, + 0x78, 0x44, 0x02, 0xA4, 0x35, 0xFB, 0xCC, 0x00, 0x29, 0x44, 0xF7, 0xB4, 0x40, 0x49, 0x34, 0x64, + 0x3A, 0xDB, 0x44, 0xE1, 0xA5, 0x60, 0x54, 0x78, 0xFF, 0xFF, 0x00, 0x6B, 0xBC, 0xFF, 0x15, 0xF3, + 0xFF, 0xFF, 0xDC, 0x84, 0x15, 0xFB, 0x78, 0x5C, 0x07, 0x00, 0x78, 0x5C, 0x2F, 0x00, 0x62, 0xFF, + 0xFF, 0xFF, 0xA1, 0xFF, 0x98, 0xFF, 0x80, 0x3E, 0x80, 0x60, 0x01, 0xE0, 0xD5, 0x60, 0x84, 0xE7, + 0xA1, 0xF3, 0x40, 0x60, 0x60, 0x40, 0x01, 0x23, 0x48, 0x60, 0x5E, 0x65, 0x80, 0x60, 0x00, 0x6A, + 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x65, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, + 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x80, 0x60, 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, + 0xFE, 0x01, 0x65, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, 0x01, 0x6A, 0xFF, 0xFF, + 0x01, 0x16, 0xFE, 0x01, 0x95, 0x60, 0x84, 0xE7, 0x64, 0x58, 0xFF, 0xFF, 0x80, 0x60, 0x01, 0xE0, + 0xD5, 0x60, 0x84, 0xE7, 0xA1, 0xF3, 0x7C, 0x45, 0x60, 0x40, 0x01, 0x23, 0x02, 0x65, 0x8C, 0x60, + 0x48, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, + 0xFE, 0x01, 0x00, 0x60, 0x7F, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x84, 0x60, 0x04, 0x6A, + 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x48, 0x60, 0x08, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, + 0x65, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x84, 0x60, 0x04, 0x6A, 0xFF, 0xFF, 0x01, 0x16, + 0xFE, 0x01, 0x40, 0x60, 0x08, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x65, 0x4A, 0xFF, 0xFF, + 0x01, 0x16, 0xFE, 0x01, 0x8C, 0x60, 0x48, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, + 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, + 0xFE, 0x01, 0x95, 0x60, 0x84, 0xE7, 0x64, 0x58, 0xFF, 0xFF, 0x12, 0x74, 0x6A, 0x40, 0x87, 0x4F, + 0x12, 0x74, 0x87, 0x4C, 0x12, 0x74, 0x29, 0x40, 0x40, 0x2B, 0x08, 0x00, 0x0A, 0x64, 0x89, 0xFF, + 0x60, 0x54, 0x88, 0xFF, 0x87, 0x4D, 0x12, 0x74, 0x87, 0x4D, 0x09, 0x00, 0x03, 0x64, 0x89, 0xFF, + 0x60, 0x54, 0x88, 0xFF, 0x87, 0x4F, 0x12, 0x74, 0x87, 0x4D, 0x12, 0x74, 0x87, 0x4D, 0x7C, 0x44, + 0x01, 0x08, 0x01, 0x00, 0x67, 0x44, 0x12, 0x74, 0x87, 0x4C, 0x12, 0x74, 0x87, 0x4C, 0x12, 0x74, + 0x87, 0x4C, 0x12, 0x74, 0x87, 0x4D, 0x12, 0x74, 0x87, 0x4D, 0x12, 0x74, 0x87, 0x4D, 0x12, 0x74, + 0x04, 0x21, 0x04, 0x00, 0xFF, 0x2A, 0x01, 0x00, 0x04, 0x00, 0x03, 0x00, 0xFF, 0x2A, 0x0D, 0x00, + 0x0C, 0x00, 0xBC, 0xFF, 0x61, 0xFF, 0x78, 0x5C, 0x57, 0x01, 0x78, 0x5C, 0x7F, 0x01, 0xB6, 0xFF, + 0xB7, 0xFF, 0xB4, 0xFF, 0xC8, 0x60, 0x09, 0x7D, 0x7C, 0x4B, 0x6A, 0x44, 0x2F, 0x58, 0xFF, 0xFF, + 0x04, 0x74, 0xC4, 0xE2, 0x04, 0xE1, 0x29, 0x40, 0x40, 0x2B, 0x05, 0x00, 0xA1, 0xFF, 0xFF, 0xFF, + 0xBC, 0xFF, 0x14, 0x74, 0x01, 0x00, 0x04, 0x74, 0xC4, 0xE2, 0x04, 0xE1, 0xBC, 0xFF, 0xB5, 0xFF, + 0x47, 0xFF, 0xB6, 0xFF, 0xB7, 0xFF, 0xB4, 0xFF, 0xC8, 0x60, 0x09, 0x7D, 0x7C, 0x4B, 0x29, 0x40, + 0x40, 0x27, 0x04, 0x00, 0xC2, 0x60, 0x58, 0x4F, 0xBA, 0x78, 0xFF, 0xFF, 0xA1, 0xFF, 0x29, 0x40, + 0x10, 0x26, 0x6D, 0x00, 0x80, 0x60, 0x01, 0xE0, 0xD5, 0x60, 0x84, 0xE7, 0xA1, 0xF3, 0x40, 0x60, + 0x60, 0x40, 0x01, 0x23, 0x48, 0x60, 0x5E, 0x65, 0x80, 0x60, 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, + 0xFE, 0x01, 0x65, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, 0x00, 0x6A, 0xFF, 0xFF, + 0x01, 0x16, 0xFE, 0x01, 0x80, 0x60, 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x65, 0x4A, + 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, 0x01, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, + 0x95, 0x60, 0x84, 0xE7, 0x80, 0x60, 0x01, 0xE0, 0xD5, 0x60, 0x84, 0xE7, 0xA1, 0xF3, 0x7C, 0x45, + 0x60, 0x40, 0x01, 0x23, 0x02, 0x65, 0x8C, 0x60, 0x48, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, + 0x00, 0x60, 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, 0x7F, 0x6A, 0xFF, 0xFF, + 0x01, 0x16, 0xFE, 0x01, 0x84, 0x60, 0x04, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x48, 0x60, + 0x08, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x65, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, + 0x84, 0x60, 0x04, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x40, 0x60, 0x08, 0x6A, 0xFF, 0xFF, + 0x01, 0x16, 0xFE, 0x01, 0x65, 0x4A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x8C, 0x60, 0x48, 0x6A, + 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x00, 0x60, 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, + 0x00, 0x60, 0x00, 0x6A, 0xFF, 0xFF, 0x01, 0x16, 0xFE, 0x01, 0x95, 0x60, 0x84, 0xE7, 0x01, 0x60, + 0x08, 0xE1, 0xFF, 0xFF, 0xC4, 0xE2, 0x29, 0x40, 0x40, 0x2B, 0x04, 0x00, 0xC2, 0x60, 0x58, 0x4F, + 0xBA, 0x78, 0xFF, 0xFF, 0xC2, 0x60, 0x58, 0x4F, 0xC5, 0x78, 0xFF, 0xFF, 0xA1, 0xFF, 0xCB, 0xF3, + 0xC4, 0xE2, 0x89, 0xFF, 0x60, 0x54, 0x88, 0xFF, 0xDC, 0x84, 0xE0, 0x94, 0x35, 0xF7, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0x01, 0x10, 0x61, 0x7F, 0x60, 0xC0, 0x64, 0xA0, 0x80, 0x7F, 0x67, 0x02, 0x63, + 0x25, 0x02, 0x98, 0xFE, 0x19, 0x05, 0x12, 0x60, 0xFC, 0xF5, 0x0E, 0xF2, 0x15, 0x18, 0x02, 0x18, + 0x09, 0xF4, 0xFB, 0x01, 0x23, 0x44, 0x00, 0xA8, 0x08, 0x7E, 0x0A, 0x02, 0x66, 0x44, 0x11, 0xFB, + 0x46, 0x43, 0x23, 0x47, 0x80, 0xBF, 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, 0x28, 0xB9, 0x10, 0x7E, + 0x00, 0x7F, 0x0E, 0xFA, 0x00, 0x67, 0x0A, 0x00, 0x20, 0x44, 0xDC, 0x85, 0x0F, 0xB4, 0xFB, 0xA0, + 0x7F, 0x67, 0x07, 0x63, 0x03, 0x05, 0x45, 0x40, 0x00, 0x67, 0xD8, 0xFE, 0xFF, 0x27, 0x05, 0xFD, + 0x0A, 0x7E, 0x04, 0xFB, 0x61, 0x55, 0x48, 0x00, 0x28, 0xFB, 0x01, 0xF3, 0x29, 0xFB, 0x44, 0x46, + 0x40, 0x45, 0x10, 0x61, 0x7E, 0x60, 0xC0, 0x64, 0xA0, 0x80, 0x7F, 0x67, 0x02, 0x63, 0x30, 0x02, + 0xB5, 0x60, 0x58, 0x4F, 0xCE, 0x78, 0xFF, 0xFF, 0x7F, 0x67, 0x03, 0x63, 0x29, 0x02, 0x26, 0x40, + 0x01, 0x2B, 0x23, 0x00, 0x98, 0xFE, 0x18, 0x05, 0x12, 0x60, 0xFC, 0xF5, 0x0E, 0xF2, 0x14, 0x18, + 0x02, 0x18, 0x09, 0xF4, 0xFB, 0x01, 0x23, 0x44, 0x00, 0xA8, 0x08, 0x7E, 0x0A, 0x02, 0x66, 0x44, + 0x11, 0xFB, 0x46, 0x43, 0x23, 0x47, 0x80, 0xBF, 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, 0x08, 0xB9, + 0x10, 0x7E, 0x00, 0x7F, 0x0E, 0xFA, 0x09, 0x00, 0x20, 0x44, 0xDC, 0x85, 0x0F, 0xB4, 0xFB, 0xA0, + 0x7F, 0x67, 0x07, 0x63, 0x05, 0x05, 0x45, 0x40, 0xD8, 0xFE, 0x00, 0x67, 0xD0, 0xFE, 0xD9, 0xFE, + 0xFF, 0x27, 0x05, 0xFD, 0x0B, 0x7E, 0x04, 0xFB, 0x0E, 0x60, 0xDD, 0xF3, 0xFF, 0xFF, 0x20, 0xB0, + 0x80, 0xBC, 0x08, 0x28, 0xA2, 0xDB, 0x61, 0x55, 0x66, 0x00, 0x04, 0xB5, 0x82, 0xB5, 0x25, 0x02, + 0x04, 0x03, 0x20, 0x44, 0x7F, 0xB4, 0x40, 0x40, 0xA3, 0xD3, 0x99, 0xFE, 0x04, 0x04, 0x02, 0xBC, + 0xFE, 0xB4, 0xA3, 0xDB, 0x59, 0x00, 0xDB, 0xF3, 0x20, 0x40, 0x80, 0x26, 0x55, 0x00, 0xA3, 0xD3, + 0xFF, 0xA0, 0xF8, 0xB4, 0x02, 0x02, 0xA3, 0xDB, 0x1C, 0x00, 0x04, 0xBC, 0xBF, 0xB4, 0xA3, 0xDB, + 0x08, 0xB0, 0x01, 0x64, 0x08, 0x24, 0x02, 0x64, 0x28, 0xFB, 0x20, 0x44, 0x80, 0xBC, 0x40, 0x40, + 0xD0, 0xFE, 0x42, 0x00, 0xBF, 0xB4, 0xA3, 0xDB, 0x3F, 0x00, 0x40, 0xB0, 0xFF, 0xFF, 0xFA, 0x02, + 0xF8, 0xB4, 0xA3, 0xDB, 0x08, 0xB5, 0x07, 0x7C, 0x01, 0x02, 0xDB, 0xF9, 0x20, 0x44, 0x7F, 0xB4, + 0x40, 0x40, 0x1D, 0x60, 0xBA, 0x63, 0xA3, 0xD3, 0xFF, 0xFF, 0x20, 0xB5, 0x07, 0xB5, 0x08, 0x28, + 0xC4, 0x02, 0x99, 0xFE, 0x29, 0x05, 0x20, 0x44, 0x80, 0x26, 0x26, 0x00, 0x20, 0x2A, 0x03, 0x00, + 0xDF, 0xB4, 0x40, 0x40, 0x74, 0x00, 0x40, 0x2A, 0x1F, 0x00, 0xBF, 0xB4, 0x40, 0x40, 0x09, 0x00, + 0xA8, 0xFF, 0x20, 0x44, 0x99, 0xFE, 0x02, 0x05, 0x80, 0x2A, 0x03, 0x00, 0x40, 0xBC, 0x40, 0x40, + 0x13, 0x00, 0x00, 0xF1, 0x80, 0xBC, 0x40, 0x40, 0x64, 0x44, 0xE0, 0x84, 0xE8, 0x84, 0x0A, 0x36, + 0x29, 0x01, 0x0B, 0x36, 0x59, 0x01, 0x28, 0xFB, 0x01, 0xF1, 0x29, 0xF9, 0x02, 0xF1, 0x2A, 0xF9, + 0x03, 0xF1, 0x2B, 0xF9, 0xD0, 0xFE, 0xAE, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x82, 0x3E, 0x75, 0x44, + 0x02, 0xB0, 0x01, 0xB0, 0x54, 0x02, 0xDC, 0x02, 0x04, 0xB0, 0x08, 0xB0, 0x10, 0x02, 0x2A, 0x02, + 0x40, 0x26, 0xA7, 0xFF, 0x8C, 0xFF, 0x75, 0x40, 0x80, 0x2B, 0x06, 0x00, 0xAB, 0xFF, 0x19, 0x60, + 0xF6, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, 0xA2, 0xDB, 0x75, 0x44, 0x8D, 0xFF, 0xE5, 0x01, 0x0A, 0xF3, + 0xAA, 0xFF, 0x60, 0x40, 0x20, 0x2B, 0x02, 0x00, 0x38, 0xFF, 0x0D, 0x00, 0x01, 0x26, 0x0C, 0x00, + 0xC0, 0x60, 0x00, 0x7C, 0xA0, 0x84, 0x80, 0x3B, 0x02, 0x00, 0xC0, 0x67, 0x03, 0x00, 0x40, 0x3B, + 0x02, 0x00, 0x00, 0x67, 0x0A, 0xFB, 0xD0, 0x01, 0x19, 0x60, 0xF6, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, + 0xA2, 0xDB, 0xCA, 0x01, 0x0B, 0xF1, 0xAB, 0xFF, 0x64, 0x44, 0xFF, 0x27, 0x1F, 0x00, 0x20, 0x26, + 0x03, 0x00, 0x02, 0x60, 0x00, 0x75, 0x1A, 0x00, 0x19, 0xF3, 0xFF, 0xFF, 0x03, 0x1B, 0x04, 0x60, + 0x00, 0x75, 0x0A, 0x64, 0xCC, 0x84, 0x19, 0xFB, 0x01, 0x60, 0x00, 0x75, 0x64, 0x40, 0x03, 0x22, + 0x0D, 0x00, 0x20, 0x44, 0x80, 0x2A, 0x03, 0x00, 0x20, 0xBC, 0x40, 0x40, 0x07, 0x00, 0xD9, 0xFE, + 0x81, 0x60, 0x0B, 0x64, 0x28, 0xFB, 0x2C, 0x44, 0x29, 0xFB, 0xD0, 0xFE, 0xA5, 0x01, 0xA9, 0xFF, + 0x77, 0x44, 0x60, 0x57, 0x40, 0x4A, 0x01, 0x2A, 0x31, 0x00, 0x24, 0x44, 0xAC, 0x86, 0x08, 0xF2, + 0x2D, 0x03, 0x25, 0x60, 0xFE, 0x65, 0xD4, 0x80, 0x0E, 0xF2, 0x02, 0x03, 0xA5, 0xD5, 0x04, 0x00, + 0x01, 0xBC, 0x0E, 0xFA, 0x09, 0xF4, 0xD1, 0xFE, 0x46, 0x44, 0x11, 0x1B, 0x32, 0x40, 0x80, 0x2A, + 0x1D, 0x00, 0x9D, 0xFE, 0x1B, 0x05, 0x13, 0x60, 0x02, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, + 0x03, 0x03, 0x0F, 0xF2, 0xFF, 0xFF, 0x12, 0x1B, 0x08, 0x60, 0x00, 0x75, 0x0F, 0x00, 0x3F, 0xF2, + 0x48, 0x65, 0xC4, 0x84, 0x13, 0xFB, 0x66, 0x44, 0x10, 0xFB, 0x66, 0x47, 0x20, 0xBF, 0x3B, 0x42, + 0x04, 0xA2, 0xA2, 0xDB, 0x0E, 0xF2, 0x41, 0x75, 0x10, 0xBC, 0x0E, 0xFA, 0x2A, 0x44, 0x08, 0x2A, + 0x17, 0x00, 0x23, 0x44, 0x00, 0xA8, 0x5C, 0x43, 0x13, 0x03, 0x12, 0x60, 0xFC, 0xF5, 0x01, 0x00, + 0x09, 0xF4, 0x0E, 0xF2, 0x0D, 0x18, 0x08, 0xB0, 0x18, 0xAC, 0xFA, 0x03, 0x0E, 0xFA, 0x66, 0x43, + 0x11, 0xFD, 0x46, 0x43, 0x23, 0x47, 0x80, 0xBF, 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, 0x28, 0x75, + 0x2A, 0x44, 0x06, 0x22, 0x2D, 0x00, 0x22, 0x44, 0x00, 0xA8, 0x60, 0x46, 0x0E, 0xF2, 0x28, 0x03, + 0x10, 0xB0, 0x01, 0xBC, 0x03, 0x02, 0x00, 0x64, 0x40, 0x42, 0x22, 0x00, 0x0E, 0xFA, 0xD1, 0xFE, + 0x25, 0x60, 0xF2, 0x64, 0x40, 0x47, 0x58, 0x4F, 0x94, 0x00, 0x46, 0x42, 0x19, 0x02, 0x22, 0x47, + 0x40, 0xBF, 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, 0x23, 0xF2, 0x66, 0x43, 0x00, 0xA8, 0x0E, 0xF2, + 0x08, 0x02, 0x60, 0x40, 0x02, 0x2A, 0xE4, 0x01, 0x12, 0xFD, 0x10, 0x64, 0x0E, 0xFA, 0x02, 0x75, + 0x07, 0x00, 0x60, 0x40, 0x04, 0x2A, 0xDC, 0x01, 0x12, 0xFD, 0x10, 0x64, 0x0E, 0xFA, 0x04, 0x75, + 0x2A, 0x44, 0x80, 0x2A, 0x19, 0x00, 0x21, 0x44, 0xAC, 0x86, 0x0E, 0xF2, 0x15, 0x03, 0x01, 0xBC, + 0x0E, 0xFA, 0xD1, 0xFE, 0x26, 0x60, 0x0A, 0x64, 0x40, 0x47, 0x58, 0x4F, 0x6A, 0x00, 0x46, 0x41, + 0x0B, 0x02, 0x21, 0x47, 0x10, 0xBF, 0x3B, 0x42, 0x04, 0xA2, 0xA2, 0xDB, 0x0E, 0xF2, 0x66, 0x43, + 0x08, 0xFD, 0x10, 0xBC, 0x0E, 0xFA, 0x80, 0x75, 0x2A, 0x44, 0x10, 0xB0, 0x20, 0x44, 0x18, 0x03, + 0x7F, 0xB4, 0x40, 0x40, 0x1D, 0x60, 0xBA, 0x63, 0xA3, 0xD3, 0xFF, 0xFF, 0x20, 0xB0, 0x80, 0xB0, + 0x09, 0x03, 0x08, 0x03, 0x40, 0xBC, 0x7F, 0xB4, 0x04, 0xB0, 0xA3, 0xDB, 0x03, 0x03, 0x20, 0x44, + 0x80, 0xBC, 0x40, 0x40, 0x2A, 0x40, 0x08, 0x27, 0x03, 0x00, 0xB3, 0x60, 0xC9, 0x78, 0xFF, 0xFF, + 0x2A, 0x40, 0x08, 0x2B, 0x0F, 0x00, 0x32, 0x40, 0x80, 0x26, 0x05, 0x00, 0x19, 0x60, 0xF7, 0xF3, + 0xFF, 0xFF, 0x01, 0x1B, 0x07, 0x00, 0x19, 0x60, 0xF6, 0xF3, 0xFF, 0xFF, 0x01, 0xBC, 0xA2, 0xDB, + 0xFF, 0xFF, 0x10, 0xFF, 0xB3, 0x60, 0xFC, 0x78, 0xFF, 0xFF, 0xE8, 0xFE, 0x14, 0x05, 0xEA, 0xFE, + 0x23, 0x05, 0xE9, 0xFE, 0x1C, 0x05, 0xE7, 0xFE, 0x09, 0x05, 0x47, 0xFF, 0x20, 0x44, 0x0F, 0x22, + 0x03, 0x00, 0xCC, 0x84, 0x40, 0x40, 0x0F, 0x22, 0xB8, 0xFE, 0xEC, 0x01, 0x23, 0x41, 0x00, 0xB9, + 0x5C, 0x4A, 0xE8, 0x02, 0x5A, 0x01, 0x24, 0x41, 0x00, 0xB9, 0x25, 0x60, 0xFE, 0x65, 0x45, 0x47, + 0xE1, 0x02, 0x58, 0x4F, 0x0E, 0x00, 0xDE, 0x02, 0x5C, 0x4A, 0x46, 0x44, 0x38, 0x01, 0x22, 0x41, + 0x00, 0xB9, 0x5C, 0x4A, 0xD7, 0x02, 0x6C, 0x01, 0x21, 0x41, 0x00, 0xB9, 0x5C, 0x4A, 0x92, 0x03, + 0xD1, 0x01, 0x27, 0xD3, 0x03, 0x00, 0x10, 0xB0, 0x09, 0xF2, 0x04, 0x03, 0xAC, 0x86, 0x0E, 0xF2, + 0xFA, 0x02, 0x08, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x0E, 0xF3, 0x0F, 0x60, 0xFE, 0x65, 0x0C, 0xF3, + 0x24, 0x86, 0x24, 0x46, 0x60, 0x40, 0xFB, 0x3B, 0x07, 0x00, 0x80, 0x26, 0x02, 0x00, 0x23, 0x46, + 0x03, 0x4C, 0x46, 0x61, 0x3A, 0x65, 0x0C, 0x00, 0x2E, 0xF3, 0x40, 0x45, 0xF8, 0x2B, 0x02, 0x00, + 0x40, 0x45, 0x03, 0x00, 0x58, 0x4F, 0x5A, 0x00, 0x07, 0x02, 0x58, 0x4F, 0x66, 0x00, 0x04, 0x05, + 0x66, 0x50, 0x65, 0x52, 0x61, 0x51, 0x09, 0x00, 0x26, 0x47, 0x00, 0xBF, 0x0E, 0xFB, 0x2E, 0xF5, + 0x05, 0xF0, 0x80, 0x60, 0x64, 0x50, 0x00, 0x72, 0x7E, 0x71, 0xAC, 0xFF, 0x31, 0x40, 0x01, 0x2A, + 0x08, 0x00, 0x19, 0x60, 0xF2, 0xF3, 0xFF, 0xFF, 0x04, 0x18, 0x0C, 0x64, 0x13, 0x60, 0x13, 0xFB, + 0x2D, 0xFF, 0xB3, 0x60, 0xFC, 0x78, 0xFF, 0xFF, 0x8E, 0xFF, 0x0F, 0xF3, 0x0F, 0x60, 0xFE, 0x65, + 0x24, 0x86, 0x0D, 0xF3, 0x24, 0x46, 0x60, 0x40, 0xFB, 0x3B, 0x07, 0x00, 0x80, 0x26, 0x02, 0x00, + 0x23, 0x46, 0x03, 0x4C, 0x46, 0x61, 0x3A, 0x65, 0x0C, 0x00, 0x2E, 0xF3, 0x40, 0x45, 0xF8, 0x2B, + 0x02, 0x00, 0x40, 0x45, 0x03, 0x00, 0x58, 0x4F, 0x21, 0x00, 0x07, 0x02, 0x58, 0x4F, 0x2D, 0x00, + 0x04, 0x05, 0x66, 0x50, 0x65, 0x52, 0x61, 0x51, 0x09, 0x00, 0x26, 0x47, 0x00, 0xBF, 0x0F, 0xFB, + 0x2E, 0xF5, 0x05, 0xF0, 0x80, 0x60, 0x64, 0x50, 0x00, 0x72, 0x7E, 0x71, 0x8D, 0xFF, 0xAD, 0xFF, + 0x31, 0x40, 0x01, 0x2A, 0xCE, 0x01, 0x19, 0x60, 0xF2, 0xF3, 0xFF, 0xFF, 0x04, 0x18, 0x0C, 0x64, + 0x13, 0x60, 0x13, 0xFB, 0x2D, 0xFF, 0xB3, 0x60, 0xFC, 0x78, 0xFF, 0xFF, 0x25, 0x44, 0xA7, 0xF1, + 0xA8, 0xF1, 0xD0, 0x80, 0xD0, 0x80, 0x07, 0x04, 0x01, 0x06, 0x05, 0x00, 0x25, 0x46, 0x01, 0xF0, + 0x03, 0x67, 0xA0, 0x85, 0x94, 0x80, 0x2F, 0x58, 0xFF, 0xFF, 0x25, 0x46, 0x26, 0x41, 0x46, 0x63, + 0x01, 0xF2, 0xFF, 0xFF, 0xFF, 0xB5, 0xD5, 0x81, 0x00, 0xF2, 0x05, 0x04, 0x04, 0x63, 0x60, 0x46, + 0xF7, 0x1B, 0x42, 0xFE, 0x0D, 0x00, 0x61, 0x44, 0xC5, 0x81, 0x63, 0x45, 0xC5, 0x81, 0x9C, 0x84, + 0xDC, 0x84, 0x01, 0xF2, 0xF0, 0x85, 0xF0, 0x80, 0x65, 0x44, 0xF8, 0x85, 0xFF, 0xFF, 0x02, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0xA2, 0xFF, 0x13, 0x60, 0x08, 0xF3, 0xFF, 0xFF, 0xAC, 0x86, 0x0E, 0xF2, + 0x07, 0x03, 0x00, 0xA8, 0x09, 0xF2, 0xFA, 0x02, 0x01, 0x67, 0x0E, 0xFA, 0x08, 0xFE, 0x17, 0x00, + 0xA9, 0xF3, 0xFF, 0xFF, 0xD8, 0xA0, 0x00, 0xB4, 0x12, 0x06, 0x09, 0x60, 0x08, 0x61, 0x41, 0x4A, + 0x7C, 0xA1, 0x0E, 0xA1, 0xA2, 0xFF, 0xB6, 0x60, 0x58, 0x4E, 0x44, 0x78, 0xFF, 0xFF, 0xA3, 0xFF, + 0x06, 0x03, 0x2A, 0x43, 0xB6, 0x60, 0x58, 0x4E, 0x65, 0x78, 0xFF, 0xFF, 0x08, 0xFE, 0xA3, 0xFF, + 0x2D, 0x58, 0xFF, 0xFF, 0x41, 0x4A, 0x42, 0xA1, 0x03, 0x00, 0x41, 0x4A, 0x7C, 0xA1, 0x0E, 0xA1, + 0xA2, 0xFF, 0xB6, 0x60, 0x58, 0x4E, 0x44, 0x78, 0xFF, 0xFF, 0x07, 0x03, 0x2A, 0x43, 0xB6, 0x60, + 0x58, 0x4E, 0x65, 0x78, 0xFF, 0xFF, 0x08, 0xFE, 0x0C, 0x00, 0x13, 0x60, 0x08, 0xF3, 0xFF, 0xFF, + 0xAC, 0x86, 0x0E, 0xF2, 0x06, 0x03, 0x00, 0xA8, 0x09, 0xF2, 0xFA, 0x02, 0x01, 0x67, 0x0E, 0xFA, + 0x08, 0xFE, 0xA3, 0xFF, 0x2D, 0x58, 0xFF, 0xFF, 0xAA, 0xF3, 0x7C, 0x63, 0x00, 0xBE, 0x40, 0x45, + 0x1A, 0x03, 0x00, 0x65, 0x65, 0x44, 0xDC, 0x85, 0x84, 0xA1, 0x00, 0xF2, 0x06, 0x06, 0x01, 0xFC, + 0x00, 0xA8, 0x60, 0x46, 0xF7, 0x02, 0x40, 0x45, 0x0E, 0x00, 0xA9, 0xF3, 0x00, 0x63, 0xD4, 0x84, + 0xA9, 0xFB, 0x80, 0x60, 0x7C, 0x64, 0x01, 0xFA, 0x00, 0xF0, 0x00, 0xFC, 0xD3, 0x80, 0xAA, 0xF9, + 0x02, 0x02, 0xAB, 0xF9, 0x08, 0xFE, 0x2E, 0x58, 0xFF, 0xFF, 0x66, 0x44, 0x25, 0x46, 0x05, 0xFA, + 0x06, 0xFA, 0x01, 0xF0, 0x03, 0x67, 0x02, 0xFC, 0xB0, 0x84, 0x3A, 0x7E, 0x01, 0xFA, 0x12, 0x64, + 0x03, 0xFA, 0x00, 0xF0, 0x04, 0xF8, 0x00, 0x64, 0x0C, 0x61, 0x10, 0x63, 0x59, 0xDA, 0xFE, 0x1F, + 0x2E, 0x58, 0xFF, 0xFF, 0x27, 0x43, 0xE3, 0x81, 0xE9, 0x81, 0x03, 0x05, 0x16, 0x03, 0x00, 0x61, + 0x01, 0x00, 0xEC, 0x63, 0x61, 0x46, 0xBF, 0xD2, 0x27, 0x45, 0xDC, 0x84, 0xA2, 0xDA, 0xBE, 0xD2, + 0x25, 0x46, 0x88, 0xF8, 0x04, 0x1B, 0x25, 0x44, 0x61, 0x46, 0xA3, 0xDA, 0x04, 0x00, 0x0A, 0xFA, + 0x60, 0x46, 0x25, 0x44, 0x09, 0xFA, 0x61, 0x46, 0xBE, 0xDA, 0x2F, 0x58, 0xFF, 0xFF, 0x25, 0x44, + 0x00, 0xA8, 0x07, 0x4B, 0x0C, 0x03, 0x58, 0x4F, 0x33, 0x00, 0x0B, 0x47, 0x26, 0x60, 0x04, 0x65, + 0x27, 0x44, 0xD4, 0x80, 0x00, 0x64, 0x01, 0x02, 0x0F, 0xFA, 0x58, 0x4F, 0xD3, 0x01, 0x70, 0x00, + 0x25, 0x43, 0xE3, 0x84, 0x7C, 0x41, 0x02, 0x04, 0xE8, 0x81, 0xEC, 0x63, 0x61, 0x46, 0xA3, 0xD2, + 0x00, 0x7C, 0x40, 0x45, 0xBF, 0xD8, 0xA3, 0xD8, 0xBE, 0xD8, 0x27, 0x42, 0x5A, 0xD3, 0x25, 0x5C, + 0x60, 0x41, 0x02, 0x1B, 0x27, 0xD9, 0x05, 0x00, 0x25, 0x46, 0x0A, 0xFA, 0x61, 0x46, 0x25, 0x44, + 0x09, 0xFA, 0x25, 0x44, 0x27, 0x43, 0x00, 0x61, 0x60, 0x46, 0x09, 0xF2, 0x08, 0xFC, 0x00, 0xA8, + 0xDD, 0x81, 0xFA, 0x02, 0xBF, 0xD1, 0x66, 0x44, 0xBE, 0xDB, 0xC1, 0x84, 0xBF, 0xDB, 0x48, 0x00, + 0x25, 0x46, 0xEC, 0x63, 0x08, 0xF2, 0x89, 0xF2, 0x1E, 0x18, 0x40, 0x47, 0xE0, 0x84, 0xE8, 0x85, + 0x02, 0x05, 0xE8, 0x83, 0x00, 0x65, 0x65, 0x46, 0xBF, 0xD2, 0x61, 0x5C, 0xCC, 0x84, 0xA2, 0xDA, + 0x25, 0x46, 0x0A, 0xF2, 0x00, 0xB9, 0x65, 0x46, 0x08, 0x24, 0xBE, 0xDA, 0x02, 0x1B, 0xA3, 0xD8, + 0x02, 0x00, 0x60, 0x46, 0x89, 0xFA, 0x00, 0xB9, 0x61, 0x46, 0x08, 0x28, 0x0A, 0xFA, 0x25, 0x46, + 0x89, 0xFC, 0x8A, 0xFC, 0x88, 0xFC, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x61, 0x28, 0x65, 0x25, 0x43, + 0xAB, 0xF3, 0xAF, 0x83, 0x00, 0xBE, 0x18, 0x03, 0x02, 0x03, 0x00, 0xFC, 0x01, 0x00, 0xAA, 0xFD, + 0x63, 0x46, 0x65, 0x44, 0xCC, 0x85, 0x00, 0xF2, 0x07, 0x02, 0xAB, 0xF5, 0x00, 0x64, 0x00, 0xFA, + 0xDE, 0x60, 0xAF, 0x64, 0x09, 0xFB, 0x08, 0x00, 0x66, 0x43, 0x00, 0xBE, 0xDD, 0x81, 0xF1, 0x02, + 0xA9, 0xF1, 0xAB, 0xFD, 0xC1, 0x84, 0xA9, 0xFB, 0x2E, 0x58, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x45, + 0x29, 0x43, 0xFC, 0xA3, 0x66, 0x44, 0xBD, 0xDB, 0x25, 0x44, 0xBD, 0xDB, 0x00, 0x64, 0xBD, 0xDB, + 0x03, 0x61, 0x0E, 0x65, 0x26, 0x60, 0x18, 0x63, 0x43, 0x49, 0xA3, 0xD3, 0x06, 0xA3, 0x00, 0xA8, + 0xCD, 0x81, 0x04, 0x02, 0xF9, 0x02, 0xB3, 0x60, 0xFC, 0x78, 0xFF, 0xFF, 0x01, 0x26, 0xE6, 0x01, + 0xD4, 0x80, 0x60, 0x45, 0xE3, 0x05, 0xF6, 0xA3, 0xBD, 0xD1, 0xBD, 0xD1, 0x44, 0x47, 0x44, 0x48, + 0x44, 0x45, 0x26, 0x60, 0x5A, 0x64, 0x44, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0x25, 0x60, 0xC8, 0x63, + 0x0D, 0x65, 0x00, 0x61, 0x41, 0x48, 0xA3, 0xD3, 0x06, 0xA3, 0xAC, 0x86, 0x00, 0x61, 0x09, 0x03, + 0x00, 0xF2, 0x09, 0xF0, 0xAC, 0x86, 0x00, 0xF2, 0xDD, 0x81, 0xFC, 0x02, 0x64, 0x44, 0xAC, 0x86, + 0xF6, 0x01, 0x61, 0x44, 0x25, 0x46, 0x27, 0xDA, 0x65, 0x44, 0x28, 0x45, 0x45, 0x88, 0xCC, 0x85, + 0x5A, 0x87, 0xE9, 0x02, 0x00, 0x64, 0x27, 0xDA, 0x5A, 0xDA, 0x5A, 0x87, 0xA6, 0xF3, 0xA5, 0xF1, + 0x02, 0xA4, 0x60, 0x46, 0x60, 0x45, 0x00, 0x61, 0x22, 0xF2, 0xFF, 0xFF, 0xAC, 0x86, 0x00, 0xF2, + 0x04, 0x03, 0xAC, 0x86, 0x00, 0xF2, 0xDD, 0x81, 0xFC, 0x02, 0x65, 0x44, 0x02, 0xA5, 0x65, 0x46, + 0x64, 0x44, 0xCC, 0x9C, 0xFF, 0xFF, 0xF0, 0x02, 0x61, 0x44, 0x25, 0x46, 0x27, 0xDA, 0x5A, 0x87, + 0x28, 0x45, 0x45, 0x88, 0x00, 0x64, 0x27, 0xDA, 0x5A, 0x87, 0x06, 0x60, 0x40, 0x65, 0xAA, 0xF3, + 0x01, 0x61, 0xAC, 0x86, 0x00, 0xF2, 0x03, 0x03, 0xD5, 0x80, 0xDD, 0x81, 0xFA, 0x04, 0xCD, 0x84, + 0x25, 0x46, 0x27, 0xDA, 0x28, 0x45, 0xC4, 0x84, 0x5A, 0xDA, 0xDA, 0x81, 0xA9, 0xF1, 0x59, 0xD8, + 0x25, 0x60, 0xC6, 0x64, 0x18, 0x63, 0xA0, 0xD1, 0x06, 0xA4, 0x59, 0xD8, 0xFC, 0x1F, 0x00, 0x64, + 0x59, 0xDA, 0x59, 0xDA, 0x01, 0x60, 0x56, 0x64, 0x0A, 0x63, 0x58, 0xD1, 0x59, 0xD8, 0xFD, 0x1F, + 0xDB, 0xF1, 0x59, 0xD8, 0x75, 0x01, 0x07, 0x4B, 0xB6, 0x60, 0x58, 0x4F, 0xD0, 0x78, 0xFF, 0xFF, + 0x0B, 0x47, 0x58, 0x4F, 0x21, 0x00, 0x6C, 0x01, 0x07, 0x4B, 0xB6, 0x60, 0x58, 0x4F, 0xD0, 0x78, + 0xFF, 0xFF, 0x0B, 0x47, 0x27, 0x44, 0x00, 0xBE, 0x08, 0xF0, 0x15, 0x03, 0x64, 0x42, 0x4A, 0xD3, + 0x09, 0xF2, 0xDC, 0x83, 0xA2, 0xDD, 0x25, 0x43, 0x09, 0xFC, 0x63, 0x46, 0x27, 0x43, 0x0A, 0xFC, + 0x09, 0xFA, 0x08, 0xF8, 0x00, 0xA8, 0x66, 0x43, 0x03, 0x02, 0x64, 0x44, 0x58, 0xDD, 0x03, 0x00, + 0x60, 0x46, 0x25, 0x44, 0x0A, 0xFA, 0x4C, 0x01, 0x27, 0x43, 0xE3, 0x81, 0xE9, 0x81, 0x03, 0x05, + 0x16, 0x03, 0x00, 0x61, 0x01, 0x00, 0xEC, 0x63, 0x61, 0x46, 0xBF, 0xD2, 0x27, 0x45, 0xDC, 0x84, + 0xA2, 0xDA, 0xA3, 0xD2, 0x25, 0x46, 0x88, 0xF8, 0x04, 0x1B, 0x25, 0x44, 0x61, 0x46, 0xBE, 0xDA, + 0x04, 0x00, 0x09, 0xFA, 0x60, 0x46, 0x25, 0x44, 0x0A, 0xFA, 0x61, 0x46, 0xA3, 0xDA, 0x2F, 0x58, + 0xFF, 0xFF, 0xA0, 0xFE, 0x07, 0x05, 0xA3, 0xFE, 0x07, 0x05, 0xA1, 0xFE, 0x48, 0x05, 0x60, 0x64, + 0x3B, 0xDB, 0x11, 0x00, 0x20, 0x58, 0xFF, 0xFF, 0x4F, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0x0E, 0x60, + 0xDF, 0xF3, 0xFF, 0xFF, 0xFB, 0xB4, 0xA2, 0xDB, 0xA0, 0x4C, 0x59, 0xBC, 0xFF, 0xB4, 0xA0, 0x51, + 0xA0, 0x4C, 0x7D, 0xB4, 0xA0, 0x51, 0xA1, 0xFF, 0xFF, 0xFF, 0x83, 0x3E, 0x40, 0x60, 0x0B, 0x65, + 0x2B, 0x44, 0x00, 0x63, 0xE8, 0x80, 0xF8, 0x84, 0x02, 0x24, 0x94, 0x84, 0xF3, 0x83, 0xCD, 0x81, + 0xFF, 0xFF, 0xF8, 0x02, 0xDF, 0x83, 0x2F, 0x58, 0x40, 0x4B, 0x00, 0x62, 0x01, 0x64, 0xD4, 0x80, + 0xE0, 0x84, 0x1A, 0x03, 0xD4, 0x80, 0xE0, 0x84, 0x15, 0x03, 0x61, 0x44, 0x11, 0x61, 0xE0, 0x84, + 0xCD, 0x81, 0xFD, 0x04, 0x01, 0x00, 0xE0, 0x84, 0xF2, 0x82, 0xFF, 0xFF, 0x02, 0x24, 0xC6, 0x82, + 0x02, 0x28, 0xD6, 0x82, 0xE2, 0x80, 0xCD, 0x81, 0x02, 0x28, 0x01, 0xBC, 0xF4, 0x02, 0x01, 0x2A, + 0xC6, 0x82, 0x03, 0x00, 0xE9, 0x81, 0xF2, 0x82, 0x61, 0x44, 0x2D, 0x58, 0xFF, 0xFF, 0x00, 0x64, + 0x3B, 0xDB, 0x3C, 0x44, 0xAC, 0x80, 0xFF, 0xFF, 0xC6, 0x02, 0x89, 0xF3, 0x8A, 0xF3, 0x02, 0xA8, + 0x02, 0xA8, 0x08, 0x02, 0x00, 0x64, 0x8B, 0xFB, 0x89, 0xFB, 0x8A, 0xFB, 0x00, 0x64, 0x8C, 0xFB, + 0xCA, 0xFE, 0x2A, 0x00, 0x03, 0x02, 0x00, 0x64, 0x8A, 0xFB, 0xCA, 0xFE, 0x01, 0x64, 0x3B, 0xDB, + 0x12, 0x60, 0xE7, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x13, 0x03, 0xDB, 0xF3, 0x2A, 0xF2, + 0xFD, 0xA0, 0x60, 0x40, 0x80, 0x3A, 0x33, 0x00, 0x32, 0x02, 0x9B, 0xFE, 0x30, 0x05, 0x00, 0x64, + 0x13, 0x60, 0x0A, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xE7, 0x01, 0x8A, 0xF3, 0xFF, 0xFF, 0x01, 0xA8, 0xFF, 0xFF, 0x06, 0x02, 0x12, 0x60, 0xE4, 0xF3, + 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x1B, 0x02, 0x86, 0xFF, 0x20, 0x40, 0x12, 0x27, 0x13, 0x00, + 0x9A, 0xFE, 0x11, 0x04, 0x9D, 0xFE, 0x0F, 0x04, 0x95, 0xF3, 0xFF, 0xFF, 0x80, 0xBC, 0x95, 0xFB, + 0x84, 0xFF, 0xC2, 0x60, 0x45, 0x64, 0x40, 0x42, 0x06, 0x64, 0x13, 0x60, 0x16, 0xFB, 0xFF, 0xFF, + 0x2D, 0xFF, 0x12, 0x64, 0x3B, 0xDB, 0x84, 0xFF, 0xB7, 0x60, 0xF7, 0x78, 0xFF, 0xFF, 0x66, 0x44, + 0xFC, 0xFB, 0x46, 0x5C, 0x19, 0x60, 0xCF, 0xF3, 0x0D, 0xF2, 0x60, 0x5C, 0x64, 0x5F, 0x0D, 0xFA, + 0x11, 0x64, 0x3B, 0xDB, 0x9D, 0xFE, 0x06, 0x05, 0x08, 0x64, 0x13, 0x60, 0x16, 0xFB, 0x2D, 0xFF, + 0xFF, 0xFF, 0xA3, 0xFE, 0x07, 0xF0, 0x00, 0x64, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x02, 0x23, 0xF0, + 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0xBF, 0x60, 0x79, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0x00, 0x63, + 0x40, 0x47, 0x50, 0x36, 0x05, 0x00, 0xA4, 0x36, 0x03, 0x00, 0x80, 0x36, 0x01, 0x00, 0x01, 0x63, + 0x48, 0xFD, 0x40, 0x47, 0x08, 0x2A, 0x08, 0x00, 0x03, 0x2F, 0x06, 0x00, 0x7F, 0xF1, 0x2C, 0xF8, + 0x80, 0xF1, 0x2D, 0xF8, 0x81, 0xF1, 0x2E, 0xF8, 0x4A, 0xF3, 0x35, 0xFA, 0x10, 0xA4, 0x4A, 0xFB, + 0x00, 0x64, 0x15, 0xFA, 0x16, 0xFA, 0x0F, 0xFA, 0x07, 0xF0, 0xA6, 0xF3, 0xFF, 0xFF, 0xD0, 0x80, + 0xFF, 0xFF, 0x05, 0x03, 0x66, 0x43, 0x64, 0x46, 0x11, 0xF2, 0xD9, 0xFB, 0x63, 0x46, 0x03, 0xF2, + 0x00, 0xF4, 0x01, 0xF2, 0xFC, 0xA5, 0x00, 0x7F, 0xD4, 0x84, 0x27, 0x45, 0x3C, 0x46, 0x1A, 0xFA, + 0x22, 0x63, 0x7B, 0x60, 0xFF, 0x64, 0xA4, 0x84, 0x03, 0x2B, 0x1C, 0x63, 0x2A, 0xFA, 0x8F, 0xB0, + 0x88, 0x36, 0x02, 0xA3, 0x60, 0x40, 0xA4, 0x36, 0x14, 0x63, 0x43, 0x4C, 0x18, 0xFC, 0x00, 0x7C, + 0x22, 0xF8, 0x64, 0x41, 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, 0x3A, 0xF2, 0x63, 0x46, 0xFF, 0xB4, + 0x22, 0xFA, 0x60, 0x40, 0x00, 0x36, 0x82, 0x00, 0x2A, 0xF2, 0xFF, 0xFF, 0x0C, 0xB0, 0x08, 0x3A, + 0xAD, 0x00, 0x60, 0x40, 0x40, 0x26, 0xAA, 0x00, 0x03, 0xF2, 0x00, 0xF4, 0xA0, 0xD2, 0xAA, 0x60, + 0xAA, 0x65, 0x5A, 0xD0, 0xD4, 0x80, 0x03, 0x64, 0x0A, 0x02, 0xD0, 0x80, 0x00, 0x64, 0x5A, 0xD0, + 0x06, 0x02, 0xD0, 0x80, 0xF8, 0x7F, 0xD0, 0x80, 0x01, 0x03, 0x01, 0x02, 0x01, 0x61, 0x62, 0x43, + 0x46, 0x43, 0x3C, 0x46, 0x07, 0xF4, 0x3A, 0xF2, 0xFF, 0xFF, 0xA3, 0x46, 0x60, 0x40, 0x22, 0x26, + 0x64, 0x00, 0x60, 0x45, 0x63, 0x42, 0x5A, 0xD0, 0xCD, 0x81, 0x3C, 0x46, 0x1B, 0x02, 0x64, 0x44, + 0x88, 0x3A, 0x18, 0x00, 0x8E, 0x37, 0x03, 0x00, 0xC7, 0x37, 0x01, 0x00, 0x13, 0x00, 0x65, 0x44, + 0x01, 0x26, 0x7C, 0x00, 0x04, 0x26, 0x03, 0x00, 0x10, 0x26, 0x01, 0x00, 0x31, 0x00, 0xA3, 0x46, + 0x3B, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x27, 0x5B, 0x00, 0xA3, 0x46, 0x00, 0x7C, 0x22, 0xF8, + 0xA3, 0x46, 0x6C, 0x00, 0xA3, 0x46, 0x65, 0x44, 0x01, 0x26, 0x0B, 0x00, 0x04, 0x26, 0x03, 0x00, + 0x10, 0x26, 0x01, 0x00, 0x1D, 0x00, 0x3B, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x27, 0x48, 0x00, + 0x17, 0x00, 0xA6, 0xF3, 0xFF, 0xFF, 0x60, 0x46, 0x3A, 0xF2, 0x66, 0x43, 0xFF, 0xB4, 0x3C, 0x46, + 0x22, 0xF0, 0x60, 0x47, 0xB0, 0x84, 0x22, 0xFA, 0x63, 0x46, 0x3B, 0xF0, 0x60, 0x40, 0x04, 0x27, + 0x03, 0x00, 0x10, 0x27, 0x01, 0x00, 0x04, 0x00, 0x64, 0x40, 0x80, 0x27, 0x31, 0x00, 0x00, 0x00, + 0x3C, 0x46, 0x02, 0x65, 0xBF, 0x60, 0x19, 0x78, 0xFF, 0xFF, 0xCD, 0x81, 0x63, 0x42, 0x5A, 0xD0, + 0x3C, 0x46, 0x26, 0x02, 0x64, 0x44, 0x88, 0x3A, 0x23, 0x00, 0x77, 0x37, 0x37, 0x00, 0x78, 0x37, + 0x35, 0x00, 0x8E, 0x37, 0x33, 0x00, 0xC7, 0x37, 0x31, 0x00, 0x1A, 0x00, 0x19, 0x60, 0xA3, 0xF3, + 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, 0x2A, 0x00, 0x06, 0x00, 0x19, 0x60, 0xA3, 0xF3, 0xFF, 0xFF, + 0x60, 0x40, 0x01, 0x2A, 0xE2, 0x01, 0x3C, 0x46, 0x3E, 0xF2, 0x40, 0x60, 0x00, 0x65, 0xF0, 0x84, + 0xA4, 0x84, 0x3D, 0xFA, 0x2A, 0xF2, 0xBF, 0x60, 0xFF, 0x65, 0xA4, 0x84, 0x2A, 0xFA, 0x16, 0x00, + 0x3C, 0x46, 0x22, 0xF0, 0x80, 0x67, 0xB0, 0x84, 0xA2, 0xDA, 0xFF, 0xFF, 0x3F, 0xF2, 0x3E, 0xF0, + 0x08, 0xA4, 0x60, 0x41, 0x22, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x26, 0x03, 0x00, 0x04, 0x26, + 0x03, 0x00, 0x04, 0x00, 0x04, 0x2B, 0x02, 0x00, 0x61, 0x44, 0x3F, 0xFA, 0x3C, 0x46, 0x2C, 0xF2, + 0x27, 0x40, 0x01, 0x27, 0x32, 0xF2, 0xD3, 0xF1, 0x60, 0x40, 0x01, 0x26, 0x47, 0x00, 0x09, 0x60, + 0x00, 0x64, 0xD0, 0x80, 0x3F, 0xF2, 0x09, 0x06, 0x2C, 0x45, 0xC4, 0x84, 0xD0, 0x80, 0x40, 0x4A, + 0x34, 0x06, 0x60, 0x43, 0x64, 0x44, 0x54, 0x88, 0x17, 0x00, 0x60, 0x45, 0x16, 0x60, 0xC8, 0xF3, + 0xDA, 0xF3, 0x00, 0xBC, 0x60, 0x47, 0xEC, 0xA0, 0x28, 0x03, 0x27, 0x07, 0x2C, 0x44, 0xC4, 0x81, + 0x02, 0x60, 0x1C, 0x65, 0x45, 0x4A, 0xD5, 0x80, 0x2C, 0x45, 0x1F, 0x06, 0x27, 0x40, 0x04, 0x27, + 0x25, 0x00, 0x2A, 0x43, 0xD7, 0x85, 0x45, 0x48, 0xD4, 0xF1, 0x0F, 0xF2, 0xD3, 0x80, 0x01, 0x65, + 0x01, 0x07, 0x00, 0x65, 0xB4, 0x84, 0x0F, 0xFA, 0x00, 0x63, 0x3F, 0xF2, 0x28, 0x45, 0x60, 0x41, + 0xD4, 0x84, 0xDF, 0x83, 0xFC, 0x07, 0x14, 0xFC, 0x17, 0xFA, 0x04, 0x60, 0x00, 0x64, 0x27, 0x45, + 0xB4, 0x84, 0x2A, 0xFA, 0x28, 0x43, 0x16, 0xFC, 0x0D, 0x00, 0x3F, 0xF2, 0x2C, 0x45, 0xD4, 0xF1, + 0xC4, 0x81, 0xD1, 0x80, 0x0F, 0xF2, 0x01, 0x06, 0x01, 0xBC, 0x0F, 0xFA, 0x3F, 0xF2, 0x17, 0xFA, + 0x01, 0x64, 0x14, 0xFA, 0xAA, 0xF2, 0x19, 0x60, 0x3F, 0xF3, 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, + 0x44, 0x44, 0x61, 0x40, 0x08, 0x26, 0x02, 0x00, 0x61, 0x40, 0x80, 0x36, 0x12, 0xF2, 0x63, 0x46, + 0x33, 0x60, 0x86, 0x61, 0x00, 0x7F, 0x60, 0x45, 0x45, 0xD3, 0xFF, 0xFF, 0x60, 0x45, 0x00, 0x7F, + 0x4B, 0xFB, 0x65, 0x44, 0x00, 0x7E, 0xDA, 0xFB, 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, 0x12, 0xF0, + 0x60, 0x47, 0x63, 0x46, 0x64, 0x40, 0x10, 0x2A, 0x1E, 0x00, 0x33, 0x60, 0x0A, 0x63, 0x60, 0x40, + 0x0A, 0x36, 0x0C, 0x00, 0x14, 0x36, 0x07, 0x00, 0x37, 0x36, 0x02, 0x00, 0xA3, 0xD3, 0x09, 0x00, + 0x02, 0xA3, 0xA3, 0xD3, 0x06, 0x00, 0x04, 0xA3, 0xA3, 0xD3, 0x03, 0x00, 0x06, 0xA3, 0xA3, 0xD3, + 0xFF, 0xFF, 0x60, 0x40, 0x0A, 0x36, 0x70, 0x64, 0x14, 0x36, 0x38, 0x64, 0x37, 0x36, 0x15, 0x64, + 0x6E, 0x36, 0x0B, 0x64, 0x39, 0x00, 0x32, 0x60, 0xFA, 0x63, 0x60, 0x40, 0x0B, 0x36, 0x20, 0x00, + 0x0F, 0x36, 0x1B, 0x00, 0x0A, 0x36, 0x16, 0x00, 0x0E, 0x36, 0x11, 0x00, 0x09, 0x36, 0x0C, 0x00, + 0x0D, 0x36, 0x07, 0x00, 0x08, 0x36, 0x02, 0x00, 0xA3, 0xD3, 0x15, 0x00, 0x02, 0xA3, 0xA3, 0xD3, + 0x12, 0x00, 0x04, 0xA3, 0xA3, 0xD3, 0x0F, 0x00, 0x06, 0xA3, 0xA3, 0xD3, 0x0C, 0x00, 0x08, 0xA3, + 0xA3, 0xD3, 0x09, 0x00, 0x0A, 0xA3, 0xA3, 0xD3, 0x06, 0x00, 0x0C, 0xA3, 0xA3, 0xD3, 0x03, 0x00, + 0x0E, 0xA3, 0xA3, 0xD3, 0xFF, 0xFF, 0x60, 0x40, 0x0B, 0x36, 0x1E, 0x64, 0x0F, 0x36, 0x16, 0x64, + 0x0A, 0x36, 0x12, 0x64, 0x0E, 0x36, 0x0E, 0x64, 0x09, 0x36, 0x0E, 0x64, 0x0D, 0x36, 0x0A, 0x64, + 0x08, 0x36, 0x0A, 0x64, 0x0C, 0x36, 0x0A, 0x64, 0x40, 0x46, 0x2A, 0xF2, 0x07, 0xF0, 0x60, 0x40, + 0xB0, 0x3A, 0x03, 0x00, 0x40, 0x3B, 0x01, 0x00, 0x12, 0x00, 0x0C, 0xB4, 0x08, 0x3A, 0x44, 0x00, + 0x22, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x2B, 0x3F, 0x00, 0x17, 0xF2, 0x22, 0xF0, 0xFF, 0xFF, + 0x64, 0x40, 0x22, 0x22, 0x04, 0x00, 0x00, 0xA8, 0x01, 0xA8, 0x36, 0x03, 0x35, 0x03, 0x3C, 0x46, + 0x2A, 0xF0, 0x40, 0x67, 0xB0, 0x84, 0xA2, 0xDA, 0x60, 0x45, 0x22, 0xF2, 0xFF, 0xFF, 0x60, 0x43, + 0x60, 0x40, 0x01, 0x26, 0x05, 0x00, 0x04, 0x26, 0x1D, 0x00, 0x10, 0x26, 0x10, 0x00, 0x04, 0x00, + 0x04, 0x27, 0x18, 0x00, 0x10, 0x27, 0x0B, 0x00, 0x65, 0x44, 0x2A, 0x61, 0x60, 0x40, 0x03, 0x2B, + 0x24, 0x61, 0x8F, 0xB0, 0x88, 0x36, 0x02, 0xA1, 0x41, 0x4C, 0x98, 0xFA, 0x15, 0x00, 0x65, 0x44, + 0x32, 0x61, 0x60, 0x40, 0x03, 0x2B, 0x2C, 0x61, 0x8F, 0xB0, 0x88, 0x36, 0x02, 0xA1, 0x41, 0x4C, + 0x98, 0xFA, 0x0A, 0x00, 0x65, 0x44, 0x2E, 0x61, 0x60, 0x40, 0x03, 0x2B, 0x28, 0x61, 0x8F, 0xB0, + 0x88, 0x36, 0x02, 0xA1, 0x41, 0x4C, 0x98, 0xFA, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x40, 0x27, + 0x03, 0x00, 0xBC, 0x60, 0x46, 0x78, 0xFF, 0xFF, 0x22, 0xF2, 0x46, 0x43, 0x60, 0x40, 0x22, 0x26, + 0x09, 0x00, 0x01, 0x26, 0x0A, 0x00, 0x04, 0x26, 0x4B, 0x00, 0x10, 0x26, 0x10, 0x00, 0xBC, 0x60, + 0x46, 0x78, 0xFF, 0xFF, 0xBB, 0x60, 0xC1, 0x78, 0xFF, 0xFF, 0x04, 0x27, 0x3D, 0x00, 0x10, 0x27, + 0x03, 0x00, 0xBC, 0x60, 0x46, 0x78, 0xFF, 0xFF, 0xA6, 0xF3, 0x3C, 0xF1, 0x02, 0x00, 0x07, 0xF2, + 0x00, 0x7C, 0x40, 0x43, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x27, 0x21, 0x00, 0xA3, 0x46, + 0x4B, 0xF2, 0xFF, 0xFF, 0xDC, 0x84, 0x4B, 0xFA, 0x4A, 0xF2, 0x08, 0x04, 0xDC, 0x84, 0x4A, 0xFA, + 0x49, 0xF2, 0x04, 0x04, 0xDC, 0x84, 0x49, 0xFA, 0x01, 0x04, 0xFF, 0xFF, 0xA6, 0xF3, 0x66, 0x5C, + 0xD0, 0x80, 0x00, 0x7C, 0x01, 0x02, 0x3C, 0xF1, 0x4B, 0xF0, 0x64, 0x47, 0x20, 0xBF, 0xA3, 0x46, + 0x3A, 0xF8, 0x3B, 0xFA, 0xA3, 0x46, 0x4A, 0xF2, 0x49, 0xF0, 0xA3, 0x46, 0x3C, 0xFA, 0x3D, 0xF8, + 0x0F, 0x60, 0x9E, 0x64, 0xA3, 0x46, 0x76, 0x61, 0x0E, 0x63, 0x59, 0xD0, 0x58, 0xD9, 0xFD, 0x1F, + 0xA3, 0x46, 0xBC, 0x60, 0x46, 0x78, 0xFF, 0xFF, 0xA6, 0xF3, 0xFF, 0xFF, 0x60, 0x46, 0x02, 0x00, + 0x07, 0xF4, 0xFF, 0xFF, 0xA3, 0x46, 0x2A, 0xF2, 0xA3, 0x46, 0x60, 0x40, 0x08, 0x27, 0x48, 0x00, + 0xA6, 0xF3, 0x66, 0x5C, 0xD0, 0x80, 0x3B, 0xF0, 0x08, 0x03, 0x64, 0x40, 0x10, 0x2A, 0x12, 0x00, + 0xFF, 0x60, 0xEF, 0x64, 0xA0, 0x84, 0x3B, 0xFA, 0x24, 0x00, 0x3D, 0xF3, 0x01, 0x61, 0x60, 0x43, + 0xCF, 0x83, 0xE1, 0x81, 0xFD, 0x0D, 0xE9, 0x81, 0xA1, 0x80, 0xFF, 0xFF, 0x03, 0x03, 0x91, 0x84, + 0x3B, 0xFA, 0x17, 0x00, 0x4B, 0xF2, 0xFF, 0xFF, 0x10, 0xA0, 0xFF, 0xFF, 0x02, 0x04, 0xFF, 0x60, + 0xFF, 0x64, 0xDC, 0x84, 0x4B, 0xFA, 0x4A, 0xF2, 0x16, 0x04, 0xDC, 0x84, 0x4A, 0xFA, 0x49, 0xF2, + 0x08, 0x04, 0xDC, 0x84, 0x49, 0xFA, 0x05, 0x04, 0x3B, 0xF2, 0xFF, 0xFF, 0xE0, 0x84, 0xE8, 0x84, + 0x3B, 0xFA, 0x0C, 0x60, 0xFC, 0x62, 0x80, 0xFF, 0x78, 0x44, 0x03, 0xA4, 0xA2, 0xDB, 0xC8, 0x60, + 0x15, 0x78, 0xFF, 0xFF, 0x84, 0xFF, 0x06, 0x60, 0x17, 0xE1, 0x77, 0x40, 0x8B, 0xFF, 0x02, 0x60, + 0x00, 0x75, 0xC9, 0x60, 0x58, 0x4F, 0xAD, 0x78, 0xFF, 0xFF, 0x01, 0x64, 0x06, 0x60, 0x7F, 0xFB, + 0x0C, 0x60, 0xFC, 0x62, 0x80, 0xFF, 0x78, 0x44, 0x03, 0xA4, 0xA2, 0xDB, 0xC8, 0x60, 0x8C, 0x78, + 0xFF, 0xFF, 0x84, 0xFF, 0x00, 0x7C, 0x06, 0x60, 0x7F, 0xF3, 0xA2, 0xD9, 0x60, 0x40, 0x01, 0x2A, + 0x04, 0x00, 0xC9, 0x60, 0x58, 0x4F, 0xF6, 0x78, 0xFF, 0xFF, 0x3C, 0x46, 0x07, 0xF4, 0xA6, 0xF3, + 0x66, 0x5C, 0xD0, 0x80, 0x00, 0x7C, 0x07, 0x03, 0x66, 0x43, 0x3C, 0x46, 0x22, 0xF2, 0x63, 0x46, + 0x60, 0x40, 0x01, 0x2A, 0x01, 0x00, 0x3C, 0xF1, 0x4B, 0xF0, 0x64, 0x41, 0x64, 0x47, 0xFF, 0xB4, + 0x60, 0x5F, 0x20, 0xBC, 0x80, 0x26, 0x80, 0xAC, 0x60, 0x47, 0xA3, 0x46, 0x3A, 0xFA, 0x64, 0x44, + 0x20, 0x7F, 0x34, 0x94, 0x3B, 0xFA, 0xA3, 0x46, 0x4A, 0xF2, 0x49, 0xF0, 0xA3, 0x46, 0x3C, 0xFA, + 0x3D, 0xF8, 0x80, 0x60, 0x10, 0xE0, 0x08, 0x60, 0x00, 0xEA, 0x0F, 0x64, 0x60, 0x7F, 0xA0, 0x5A, + 0x80, 0x60, 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, 0xD1, 0x60, 0x00, 0xEA, 0xBC, 0x60, 0x46, 0x78, + 0xFF, 0xFF, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x27, 0x31, 0x00, 0x2A, 0xF2, 0x00, 0x60, + 0x7C, 0x62, 0x60, 0x40, 0x40, 0x2B, 0x24, 0x00, 0xA2, 0xD3, 0x00, 0x61, 0x60, 0xFE, 0xA0, 0xD3, + 0x5E, 0xD1, 0xFF, 0xFF, 0x20, 0xFE, 0x64, 0x5F, 0xDC, 0x84, 0xF1, 0x81, 0xC0, 0x2B, 0x04, 0x00, + 0x80, 0x2A, 0x02, 0x00, 0x7F, 0xA4, 0xDC, 0x84, 0xFF, 0x3B, 0x03, 0x00, 0x60, 0x47, 0xDC, 0x87, + 0x01, 0x61, 0xC0, 0x80, 0x00, 0x36, 0xDC, 0x84, 0x4E, 0xDB, 0x60, 0xFE, 0x5A, 0xD1, 0xFF, 0xFF, + 0xC1, 0x84, 0xF0, 0x22, 0x10, 0xA4, 0xF0, 0x2A, 0x01, 0x00, 0x00, 0x64, 0xA2, 0xDB, 0x20, 0xFE, + 0x00, 0x60, 0x3E, 0xF3, 0xFF, 0xFF, 0xA0, 0xD3, 0x5A, 0xD1, 0x3A, 0xFA, 0x3B, 0xF8, 0x74, 0x62, + 0xA2, 0xD0, 0xFF, 0xFF, 0x64, 0x44, 0xE0, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xE1, 0x7F, 0x5A, 0xD0, + 0xA0, 0x5A, 0x64, 0x44, 0xE2, 0x7F, 0xA0, 0x5A, 0x00, 0x60, 0x40, 0xF3, 0xFF, 0xFF, 0xA0, 0xD1, + 0x5A, 0xD1, 0x64, 0x45, 0x64, 0x44, 0xE3, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xE4, 0x7F, 0x5A, 0xD1, + 0xA0, 0x5A, 0x64, 0x44, 0xE5, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xE6, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, + 0x64, 0x44, 0xE7, 0x7F, 0xA0, 0x5A, 0x65, 0x40, 0x0D, 0x3A, 0x1C, 0x00, 0x64, 0x47, 0xE8, 0x7F, + 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, 0xE9, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xEA, 0x7F, 0x5A, 0xD1, + 0xA0, 0x5A, 0x64, 0x44, 0xEB, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xEC, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, + 0x64, 0x44, 0xED, 0x7F, 0xA0, 0x5A, 0x64, 0x47, 0xEE, 0x7F, 0x5A, 0xD1, 0xA0, 0x5A, 0x64, 0x44, + 0xEF, 0x7F, 0xA0, 0x5A, 0x08, 0x60, 0x00, 0xEA, 0x65, 0x44, 0x02, 0xA4, 0x60, 0x7F, 0xA0, 0x5A, + 0x80, 0x60, 0x00, 0xEA, 0xA0, 0x60, 0x00, 0xEA, 0xD1, 0x60, 0x00, 0xEA, 0x66, 0x45, 0xAA, 0xF2, + 0x19, 0x60, 0x3F, 0xF3, 0x24, 0x46, 0x61, 0x40, 0x08, 0x26, 0x02, 0x00, 0x61, 0x40, 0x80, 0x36, + 0x12, 0xF2, 0x65, 0x46, 0x60, 0x40, 0x10, 0x26, 0x34, 0x00, 0x2C, 0x45, 0x17, 0xF2, 0x4B, 0xF1, + 0xC4, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x81, 0x64, 0x45, 0x16, 0xA1, 0xB8, 0x60, 0x58, 0x4D, + 0x15, 0x78, 0xFF, 0xFF, 0x7D, 0xF1, 0x01, 0xA4, 0xE0, 0x84, 0xE0, 0x84, 0x64, 0x40, 0x01, 0x2B, + 0x06, 0xA4, 0x1B, 0xFA, 0xDA, 0xF3, 0x2C, 0x60, 0x7C, 0x65, 0x60, 0x40, 0x0B, 0x37, 0x00, 0x63, + 0x0F, 0x37, 0x02, 0x63, 0x0A, 0x37, 0x04, 0x63, 0x0E, 0x37, 0x06, 0x63, 0x09, 0x37, 0x08, 0x63, + 0x0D, 0x37, 0x0A, 0x63, 0x08, 0x37, 0x0C, 0x63, 0x0C, 0x37, 0x0E, 0x63, 0x28, 0xA3, 0x47, 0xD1, + 0xD8, 0xA3, 0xD7, 0x83, 0x19, 0x60, 0x77, 0xF9, 0x47, 0xD1, 0x40, 0x67, 0xB0, 0x84, 0x1F, 0xFA, + 0x58, 0x00, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x36, 0x19, 0x00, 0x50, 0x36, 0x17, 0x00, + 0x40, 0x36, 0x15, 0x00, 0x00, 0x36, 0x13, 0x00, 0x20, 0x36, 0x11, 0x00, 0xA0, 0x36, 0x0F, 0x00, + 0xB0, 0x36, 0x0D, 0x00, 0xC0, 0x36, 0x0B, 0x00, 0xDA, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x0A, 0x37, + 0x06, 0x00, 0x19, 0x60, 0x7B, 0xF3, 0x80, 0x60, 0x00, 0x61, 0x60, 0x40, 0x04, 0x26, 0x00, 0x61, + 0xDA, 0xF3, 0x2C, 0x60, 0x74, 0x65, 0x60, 0x40, 0x0A, 0x37, 0x00, 0x63, 0x14, 0x37, 0x02, 0x63, + 0x37, 0x37, 0x04, 0x63, 0x6E, 0x37, 0x06, 0x63, 0x28, 0xA3, 0x47, 0xD1, 0xD8, 0xA3, 0xD7, 0x83, + 0x19, 0x60, 0x77, 0xF9, 0x47, 0xD1, 0xFF, 0xFF, 0xB1, 0x84, 0x1F, 0xFA, 0xDA, 0xF1, 0x2C, 0x45, + 0x64, 0x43, 0x17, 0xF2, 0x4B, 0xF1, 0xC4, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x81, 0x63, 0x40, + 0x37, 0x37, 0xE1, 0x81, 0x64, 0x45, 0xB8, 0x60, 0x58, 0x4D, 0x15, 0x78, 0xFF, 0xFF, 0xAE, 0x82, + 0xFC, 0xA2, 0x0A, 0x03, 0x63, 0x40, 0x6E, 0x3B, 0x06, 0x00, 0x60, 0x41, 0x04, 0x0D, 0x63, 0x44, + 0x80, 0x7E, 0xDA, 0xFB, 0x61, 0x44, 0xDC, 0x84, 0x2B, 0xF0, 0x1B, 0xFA, 0x64, 0x44, 0x80, 0x27, + 0x58, 0x00, 0x07, 0xF0, 0x66, 0x45, 0x64, 0x46, 0x12, 0xF2, 0x65, 0x46, 0x60, 0x40, 0x10, 0x2A, + 0x31, 0x00, 0x16, 0xF2, 0x0F, 0xF0, 0xAC, 0x84, 0x2C, 0x45, 0x2C, 0x03, 0x4B, 0xF1, 0xC4, 0x84, + 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x81, 0x63, 0x40, 0x37, 0x37, 0xE1, 0x81, 0x64, 0x45, 0x0F, 0xF0, + 0xB8, 0x60, 0x58, 0x4D, 0x15, 0x78, 0xFF, 0xFF, 0xAE, 0x82, 0xFC, 0xA2, 0x0A, 0x03, 0x63, 0x40, + 0x6E, 0x3B, 0x06, 0x00, 0x60, 0x41, 0x04, 0x0D, 0x80, 0x67, 0xB0, 0x84, 0x0F, 0xFA, 0x61, 0x44, + 0xDC, 0x84, 0x1D, 0xFA, 0x1F, 0xF0, 0x01, 0x60, 0x3E, 0x65, 0x64, 0x40, 0x80, 0x27, 0x02, 0x00, + 0x02, 0x60, 0x5E, 0x65, 0x1B, 0xF0, 0x26, 0x41, 0xE1, 0x81, 0xC5, 0x81, 0x44, 0x94, 0xC1, 0x81, + 0x2B, 0xFA, 0x90, 0xFA, 0x26, 0x44, 0x2C, 0xF0, 0x0A, 0xA4, 0x66, 0x45, 0x24, 0x46, 0x92, 0xF2, + 0x65, 0x46, 0x9F, 0xF0, 0x61, 0x40, 0x10, 0x2A, 0x05, 0x00, 0x60, 0xA4, 0x65, 0x40, 0x80, 0x2B, + 0x60, 0xA4, 0x01, 0x00, 0x14, 0xA4, 0x64, 0x40, 0x01, 0x26, 0x00, 0x64, 0x60, 0x45, 0x2A, 0xF2, + 0x39, 0xF0, 0x8F, 0xB0, 0x88, 0x3A, 0x04, 0x00, 0x64, 0x44, 0x60, 0xB0, 0x20, 0x36, 0x00, 0x65, + 0x65, 0x44, 0x11, 0xFA, 0xDA, 0xF3, 0x13, 0xFA, 0x7C, 0x44, 0x1D, 0xFA, 0x0F, 0xF0, 0xFF, 0xFF, + 0x64, 0x40, 0x01, 0x2A, 0x6F, 0x00, 0x7D, 0xF1, 0x19, 0x60, 0x7B, 0xF3, 0x64, 0x40, 0x01, 0x27, + 0x03, 0x00, 0x60, 0x40, 0x02, 0x26, 0x14, 0x00, 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, 0x12, 0xF0, + 0x19, 0x60, 0x7C, 0xF3, 0x63, 0x46, 0x64, 0x40, 0x10, 0x2A, 0x20, 0x00, 0x60, 0x40, 0x02, 0x26, + 0x07, 0x00, 0x01, 0x26, 0x08, 0x00, 0x04, 0x26, 0x09, 0x00, 0x06, 0x61, 0x6E, 0x63, 0x08, 0x00, + 0x02, 0x61, 0x14, 0x63, 0x05, 0x00, 0x00, 0x61, 0x0A, 0x63, 0x02, 0x00, 0x04, 0x61, 0x37, 0x63, + 0x00, 0x64, 0x2C, 0x60, 0x9C, 0x65, 0x45, 0xD1, 0xD5, 0x81, 0x19, 0x60, 0x78, 0xF9, 0x2C, 0x60, + 0x74, 0x65, 0x45, 0xD1, 0x1C, 0xFC, 0xB0, 0x84, 0x1E, 0xFA, 0x3C, 0x00, 0x60, 0x40, 0x10, 0x2A, + 0x04, 0x00, 0x08, 0x61, 0x1E, 0x60, 0x0B, 0x63, 0x27, 0x00, 0x20, 0x2A, 0x04, 0x00, 0x0A, 0x61, + 0x16, 0x60, 0x0F, 0x63, 0x21, 0x00, 0x40, 0x2A, 0x04, 0x00, 0x0C, 0x61, 0x12, 0x60, 0x0A, 0x63, + 0x1B, 0x00, 0x80, 0x2A, 0x04, 0x00, 0x0E, 0x61, 0x0E, 0x60, 0x0E, 0x63, 0x15, 0x00, 0x01, 0x2B, + 0x04, 0x00, 0x10, 0x61, 0x0E, 0x60, 0x09, 0x63, 0x0F, 0x00, 0x02, 0x2B, 0x04, 0x00, 0x12, 0x61, + 0x0A, 0x60, 0x0D, 0x63, 0x09, 0x00, 0x04, 0x2B, 0x04, 0x00, 0x14, 0x61, 0x0A, 0x60, 0x08, 0x63, + 0x03, 0x00, 0x16, 0x61, 0x0A, 0x60, 0x0C, 0x63, 0x1E, 0xF0, 0x40, 0x67, 0x2C, 0x60, 0x9C, 0x65, + 0x45, 0xD1, 0xD5, 0x81, 0x19, 0x60, 0x78, 0xF9, 0x2C, 0x60, 0x74, 0x65, 0x45, 0xD1, 0x1C, 0xFC, + 0xB0, 0x84, 0x1E, 0xFA, 0xFF, 0xFF, 0x0D, 0xF2, 0x3E, 0xF0, 0x60, 0x47, 0xFF, 0xB4, 0x64, 0x41, + 0x01, 0xB1, 0x01, 0x63, 0x17, 0x02, 0x60, 0x41, 0xFF, 0x22, 0x04, 0x00, 0xB8, 0x60, 0x58, 0x4F, + 0x06, 0x78, 0xFF, 0xFF, 0x07, 0x60, 0xED, 0xFD, 0x19, 0x60, 0xCF, 0xF3, 0xFF, 0xFF, 0x60, 0x41, + 0x01, 0x63, 0x61, 0x40, 0xFF, 0x22, 0x04, 0x00, 0xB8, 0x60, 0x58, 0x4F, 0x06, 0x78, 0xFF, 0xFF, + 0x07, 0x60, 0xEE, 0xFD, 0x02, 0x64, 0x3B, 0xDB, 0xBF, 0x60, 0xE4, 0x78, 0xFF, 0xFF, 0x66, 0x44, + 0xFC, 0xFB, 0x07, 0xF0, 0x00, 0x64, 0xD0, 0x80, 0xA6, 0xF3, 0x0E, 0x03, 0xD0, 0x80, 0xFF, 0xFF, + 0x0B, 0x03, 0x47, 0xF1, 0x07, 0xF0, 0x64, 0x40, 0x02, 0x26, 0x01, 0x00, 0x08, 0x00, 0x03, 0x12, + 0xBE, 0x60, 0xA0, 0x78, 0xFF, 0xFF, 0xFC, 0x0A, 0xBF, 0x60, 0x00, 0x78, 0xFF, 0xFF, 0x87, 0xF0, + 0xA6, 0xF3, 0x10, 0xF0, 0xD4, 0x80, 0xFF, 0xFF, 0x3D, 0x03, 0x66, 0x43, 0x65, 0x46, 0xFF, 0x67, + 0x20, 0x85, 0x64, 0x5F, 0x40, 0x44, 0x15, 0xF0, 0x25, 0x44, 0xD0, 0x84, 0x03, 0xA4, 0x03, 0x0E, + 0xE8, 0x84, 0xE8, 0x84, 0x04, 0x00, 0xFA, 0xA4, 0xE8, 0x84, 0xE8, 0x87, 0xC0, 0xBF, 0xC0, 0x84, + 0x15, 0xFA, 0x40, 0x45, 0x14, 0xF0, 0x24, 0x44, 0xD0, 0x84, 0x1F, 0xA4, 0x06, 0x0E, 0xE8, 0x84, + 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0x07, 0x00, 0xC2, 0xA4, 0xE8, 0x84, 0xE8, 0x84, + 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x87, 0xF8, 0xBF, 0xC0, 0x84, 0x14, 0xFA, 0x60, 0x5C, 0x2F, 0x67, + 0xD0, 0x80, 0x60, 0x45, 0x02, 0x28, 0x64, 0x45, 0x25, 0x5C, 0x8B, 0x67, 0xD0, 0x80, 0x60, 0x41, + 0x02, 0x24, 0x64, 0x41, 0xD5, 0x84, 0x80, 0x65, 0xC4, 0x87, 0x01, 0x05, 0x00, 0x64, 0xFF, 0xB4, + 0x0E, 0xFA, 0x63, 0x46, 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, 0x17, 0xF2, 0x63, 0x46, 0x60, 0x40, + 0x00, 0x36, 0x2E, 0x00, 0x01, 0x36, 0x1E, 0x00, 0x03, 0x3A, 0x25, 0x00, 0x64, 0x46, 0x10, 0xF2, + 0x11, 0xFA, 0x12, 0xF2, 0x00, 0x61, 0x60, 0x47, 0x00, 0x7F, 0x12, 0xFA, 0x97, 0xFA, 0x46, 0x44, + 0x63, 0x46, 0xC2, 0x60, 0x58, 0x4E, 0x4C, 0x78, 0xFF, 0xFF, 0x65, 0x40, 0x00, 0x3A, 0x04, 0x00, + 0xC2, 0x60, 0x58, 0x4E, 0x96, 0x78, 0xFF, 0xFF, 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, 0x96, 0xFC, + 0x63, 0x46, 0x43, 0x00, 0x64, 0x46, 0x16, 0xF2, 0x00, 0x61, 0x20, 0x28, 0xFF, 0xA4, 0x97, 0xFA, + 0x16, 0xFA, 0x63, 0x46, 0x3A, 0x00, 0x64, 0x46, 0x00, 0x61, 0x97, 0xFA, 0x63, 0x46, 0x35, 0x00, + 0x07, 0xF0, 0x66, 0x41, 0x64, 0x46, 0x16, 0xF2, 0xFF, 0xFF, 0x20, 0x28, 0xFF, 0xA4, 0x16, 0xFA, + 0x93, 0xF4, 0x12, 0xF2, 0x20, 0x28, 0xFF, 0xA3, 0x13, 0xFC, 0x61, 0x46, 0x63, 0x40, 0x00, 0x3A, + 0x24, 0x00, 0xC2, 0x60, 0x58, 0x4E, 0x6D, 0x78, 0xFF, 0xFF, 0x61, 0x40, 0xFF, 0x36, 0x1D, 0x00, + 0x66, 0x41, 0x64, 0x46, 0x12, 0xF2, 0x93, 0xF4, 0x61, 0x46, 0x20, 0x28, 0x16, 0x00, 0x44, 0x44, + 0xC2, 0x60, 0x58, 0x4E, 0x4C, 0x78, 0xFF, 0xFF, 0x24, 0x5C, 0x65, 0x40, 0x00, 0x36, 0x06, 0x00, + 0x66, 0x41, 0x64, 0x46, 0x01, 0x64, 0x17, 0xFA, 0x61, 0x46, 0x07, 0x00, 0x66, 0x43, 0x64, 0x46, + 0xC2, 0x60, 0x58, 0x4E, 0x96, 0x78, 0xFF, 0xFF, 0x63, 0x46, 0xBF, 0x60, 0x00, 0x78, 0xFF, 0xFF, + 0x07, 0xF0, 0x66, 0x43, 0x64, 0x46, 0x17, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0xFF, 0x27, 0xFF, 0xFF, + 0x00, 0x36, 0x07, 0x00, 0x01, 0x36, 0x1C, 0x00, 0x02, 0x36, 0x24, 0x00, 0x03, 0x36, 0x43, 0x00, + 0xFF, 0xFF, 0x19, 0x60, 0xA9, 0xF1, 0x16, 0xF2, 0x43, 0x44, 0xD0, 0x80, 0x33, 0x60, 0x84, 0x61, + 0x09, 0x03, 0xA1, 0xD1, 0x33, 0x60, 0x82, 0x63, 0xC0, 0x84, 0x16, 0xFA, 0xA3, 0xD3, 0xFF, 0xFF, + 0x13, 0xFA, 0x39, 0x00, 0x96, 0xFC, 0xC2, 0x60, 0x58, 0x4E, 0x96, 0x78, 0xFF, 0xFF, 0x33, 0x00, + 0x43, 0x44, 0xC2, 0x60, 0x58, 0x4E, 0x96, 0x78, 0xFF, 0xFF, 0x19, 0x60, 0xC1, 0xF3, 0x96, 0xFC, + 0x13, 0xFA, 0x29, 0x00, 0x63, 0x46, 0x33, 0x60, 0x54, 0x63, 0xA3, 0xD3, 0x15, 0xF2, 0x60, 0x45, + 0xD4, 0x80, 0x07, 0xF0, 0x0C, 0x03, 0x66, 0x41, 0x44, 0x44, 0x64, 0x46, 0x12, 0xF2, 0x61, 0x46, + 0xC2, 0x60, 0x58, 0x4E, 0x4C, 0x78, 0xFF, 0xFF, 0x65, 0x40, 0x00, 0x3A, 0x19, 0x00, 0x66, 0x43, + 0x24, 0x46, 0xC2, 0x60, 0x58, 0x4E, 0x96, 0x78, 0xFF, 0xFF, 0x12, 0xF2, 0x91, 0xF2, 0x90, 0xFA, + 0x60, 0x5F, 0x12, 0xFA, 0x04, 0x00, 0xC2, 0x60, 0x58, 0x4E, 0x96, 0x78, 0xFF, 0xFF, 0x03, 0x64, + 0x17, 0xFA, 0x63, 0x46, 0x05, 0x00, 0x24, 0x43, 0x02, 0x64, 0x17, 0xFA, 0x63, 0x46, 0x00, 0x00, + 0x03, 0x64, 0x3B, 0xDB, 0xCA, 0xFE, 0x47, 0xF1, 0x01, 0x65, 0x32, 0x40, 0x04, 0x27, 0x11, 0x00, + 0x2C, 0xF2, 0x64, 0x45, 0x02, 0x22, 0x0D, 0x00, 0x60, 0x40, 0x01, 0x26, 0x0A, 0x00, 0x2A, 0xF2, + 0x39, 0xF0, 0x8F, 0xB0, 0x88, 0x3A, 0x77, 0x00, 0x64, 0x44, 0x60, 0xB0, 0x20, 0x36, 0x01, 0x00, + 0x72, 0x00, 0x14, 0xF2, 0x65, 0x40, 0x01, 0x26, 0x0C, 0x00, 0x60, 0x45, 0x05, 0x64, 0x3B, 0xDB, + 0x65, 0x44, 0xCC, 0x85, 0x2C, 0x60, 0xD0, 0x64, 0xF1, 0x60, 0x78, 0x41, 0xF0, 0x78, 0xB5, 0xF1, + 0x50, 0x00, 0x60, 0x41, 0x2A, 0xF0, 0x00, 0x60, 0x0C, 0x64, 0xA0, 0x84, 0x04, 0x36, 0x02, 0x00, + 0x0C, 0x3A, 0x01, 0x00, 0x46, 0x00, 0x61, 0x45, 0x60, 0x43, 0x2C, 0x60, 0xD0, 0x64, 0xF1, 0x60, + 0x78, 0x41, 0xF0, 0x78, 0xB5, 0xF1, 0x63, 0x40, 0x08, 0x36, 0x01, 0x00, 0x3A, 0x00, 0x14, 0xF2, + 0x1C, 0x65, 0x60, 0x41, 0x00, 0x63, 0xCD, 0x81, 0xC7, 0x83, 0xFD, 0x02, 0x3F, 0xF0, 0x2C, 0xF2, + 0xC3, 0x83, 0x60, 0x40, 0x01, 0x2A, 0x0D, 0x00, 0x2C, 0x60, 0xCE, 0x64, 0xF1, 0x60, 0x78, 0x41, + 0xE4, 0x78, 0xB5, 0xF1, 0x2C, 0x60, 0xD4, 0x64, 0xF1, 0x60, 0x78, 0x41, 0xEF, 0x78, 0x63, 0x45, + 0x20, 0x00, 0x2C, 0x60, 0xCC, 0x64, 0xF1, 0x60, 0x78, 0x41, 0xE4, 0x78, 0xB5, 0xF1, 0x2C, 0x60, + 0xD2, 0x64, 0xF1, 0x60, 0x78, 0x41, 0xEF, 0x78, 0x63, 0x45, 0x15, 0xF2, 0xFF, 0xFF, 0x0F, 0xB4, + 0x00, 0xA8, 0x01, 0xA8, 0x0E, 0x03, 0x07, 0x03, 0x2C, 0x60, 0xDA, 0x64, 0xF1, 0x60, 0x78, 0x41, + 0xE4, 0x78, 0xB5, 0xF1, 0x06, 0x00, 0x2C, 0x60, 0xD8, 0x64, 0xF1, 0x60, 0x78, 0x41, 0xE4, 0x78, + 0xB5, 0xF1, 0x04, 0x64, 0x3B, 0xDB, 0x25, 0x60, 0xEC, 0x64, 0x13, 0x60, 0x0A, 0xFB, 0x3C, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x5C, 0x5C, 0xFC, 0xFC, 0xCE, 0xFE, + 0xB8, 0x60, 0x37, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0xFF, 0xFF, 0x50, 0xA8, 0x02, 0x7C, 0x09, 0x03, + 0x0F, 0xF0, 0x15, 0xF2, 0x64, 0x41, 0x01, 0x2A, 0x02, 0x00, 0xCD, 0xF1, 0x02, 0x00, 0xCC, 0xF1, + 0xFF, 0xFF, 0x64, 0x45, 0xDC, 0x84, 0xD4, 0x80, 0x15, 0xFA, 0x2D, 0x07, 0x61, 0x40, 0x01, 0x2A, + 0x08, 0x00, 0x16, 0x60, 0x80, 0xF3, 0xFF, 0xFF, 0xDC, 0x84, 0x00, 0x36, 0x00, 0x3B, 0xA2, 0xDB, + 0x07, 0x00, 0x16, 0x60, 0x81, 0xF3, 0xFF, 0xFF, 0xDC, 0x84, 0x00, 0x36, 0x00, 0x3B, 0xA2, 0xDB, + 0x2A, 0xF0, 0x08, 0x67, 0xB0, 0x84, 0xA2, 0xDA, 0x00, 0x64, 0x48, 0xFB, 0x19, 0x60, 0xA3, 0xF3, + 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, 0x0C, 0x00, 0x3C, 0x46, 0x3E, 0xF2, 0x40, 0x60, 0x00, 0x65, + 0xF0, 0x84, 0xA4, 0x84, 0x3D, 0xFA, 0x2A, 0xF2, 0xBF, 0x60, 0xFF, 0x65, 0xA4, 0x84, 0x2A, 0xFA, + 0xBA, 0x60, 0x02, 0x78, 0xFF, 0xFF, 0x00, 0x64, 0x49, 0xFB, 0x2C, 0x60, 0xDA, 0x64, 0xF1, 0x60, + 0x78, 0x41, 0xE4, 0x78, 0xB5, 0xF1, 0x2C, 0x60, 0xDC, 0x64, 0xF1, 0x60, 0x78, 0x41, 0xE4, 0x78, + 0xB5, 0xF1, 0x27, 0x44, 0xF7, 0xB4, 0x40, 0x47, 0x23, 0xF0, 0x01, 0x64, 0xB0, 0x84, 0xA2, 0xDA, + 0x98, 0x01, 0xC0, 0x60, 0x5F, 0x78, 0xFF, 0xFF, 0x21, 0x64, 0x3B, 0xDB, 0x31, 0xF3, 0x01, 0x63, + 0xC4, 0xB4, 0x31, 0xFB, 0x32, 0xFD, 0xC0, 0x60, 0x14, 0x62, 0x42, 0x40, 0xA0, 0x4C, 0x40, 0xBC, + 0x7D, 0xB4, 0xA0, 0x51, 0xA0, 0xFE, 0x1A, 0xFF, 0x25, 0x60, 0xE0, 0x64, 0x08, 0xF0, 0x07, 0xF0, + 0xD0, 0x80, 0x25, 0x60, 0xE6, 0x62, 0x13, 0x02, 0xA2, 0xD3, 0x01, 0x63, 0xAC, 0x86, 0x07, 0xF2, + 0x0E, 0x03, 0xD0, 0x80, 0x09, 0xF2, 0xFA, 0x02, 0x23, 0xFC, 0x25, 0x60, 0xEC, 0x64, 0x13, 0x60, + 0x0A, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x3C, 0x46, + 0x06, 0x64, 0xA1, 0xFF, 0x49, 0xFB, 0x83, 0x3E, 0x31, 0xF3, 0x87, 0x60, 0x80, 0x61, 0x1D, 0xF0, + 0x60, 0x40, 0x01, 0x2A, 0x0F, 0x00, 0xFE, 0xB4, 0x31, 0xFB, 0x00, 0x64, 0x49, 0xFB, 0x01, 0x64, + 0x47, 0xFB, 0x00, 0x71, 0x05, 0x64, 0x64, 0x5F, 0x0D, 0xFA, 0x40, 0x64, 0x3B, 0xDB, 0xC0, 0x60, + 0x5F, 0x78, 0xFF, 0xFF, 0x02, 0x2A, 0x18, 0x00, 0xD1, 0x91, 0x8D, 0xE2, 0x41, 0x64, 0x3B, 0xDB, + 0x31, 0xF3, 0x33, 0x60, 0xA6, 0x63, 0xFD, 0xB4, 0x31, 0xFB, 0xA3, 0xD3, 0x02, 0x63, 0x60, 0x5C, + 0x0D, 0xF2, 0x47, 0xFD, 0xFF, 0xB5, 0x60, 0x47, 0xFF, 0xB4, 0xD0, 0x80, 0xDC, 0x84, 0x1F, 0x03, + 0x60, 0x47, 0xB4, 0x84, 0x0D, 0xFA, 0x1B, 0x00, 0x08, 0x2A, 0x07, 0x00, 0x42, 0x64, 0x3B, 0xDB, + 0x31, 0xF3, 0xFF, 0xFF, 0xF7, 0xB4, 0x31, 0xFB, 0x12, 0x00, 0x10, 0x2A, 0x09, 0x00, 0x43, 0x64, + 0x3B, 0xDB, 0x31, 0xF3, 0xFF, 0xFF, 0xEF, 0xB4, 0x31, 0xFB, 0xBF, 0x60, 0xE4, 0x78, 0xFF, 0xFF, + 0x44, 0x64, 0x3B, 0xDB, 0x31, 0xF3, 0xFF, 0xFF, 0xDF, 0xB4, 0x31, 0xFB, 0x00, 0x00, 0x2A, 0x64, + 0x3B, 0xDB, 0xB7, 0x60, 0xF7, 0x64, 0x40, 0x40, 0xBD, 0x60, 0xD7, 0x78, 0xFF, 0xFF, 0x0E, 0x60, + 0xDF, 0xF3, 0xFF, 0xFF, 0x02, 0xB5, 0x04, 0xB5, 0x04, 0x03, 0x03, 0x03, 0xC1, 0x60, 0x70, 0x78, + 0xFF, 0xFF, 0x31, 0x40, 0x01, 0x26, 0x16, 0x00, 0xA0, 0x4C, 0x49, 0xBC, 0xFF, 0xB4, 0xA0, 0x51, + 0x0E, 0x60, 0xDF, 0xF3, 0xFF, 0xFF, 0x02, 0xB5, 0x04, 0xBC, 0x09, 0x03, 0x60, 0x40, 0x01, 0x26, + 0xED, 0xE2, 0xFE, 0xB4, 0xA2, 0xDB, 0xA0, 0x4C, 0x7D, 0xB4, 0xA0, 0x51, 0x03, 0x00, 0xA0, 0x4C, + 0x6D, 0xB4, 0xA0, 0x51, 0xDB, 0xF3, 0xFF, 0xFF, 0xFD, 0xA0, 0xFF, 0xFF, 0x08, 0x24, 0x59, 0x00, + 0x31, 0x40, 0x04, 0x2A, 0x38, 0x00, 0x01, 0x64, 0x19, 0x60, 0xF4, 0xFB, 0x6C, 0xF3, 0x73, 0xF3, + 0xCC, 0x83, 0x6C, 0xFD, 0xCC, 0x84, 0x73, 0xFB, 0x1E, 0x02, 0x31, 0x40, 0x02, 0x2A, 0x12, 0x00, + 0x6E, 0xF3, 0x6F, 0xF1, 0xCC, 0x84, 0x6E, 0xFB, 0x0D, 0x02, 0x6E, 0xF9, 0x31, 0x44, 0x08, 0xBC, + 0x40, 0x51, 0x71, 0xF3, 0x70, 0xF1, 0x00, 0xB8, 0x64, 0x45, 0x01, 0x03, 0x67, 0x45, 0x65, 0x50, + 0xCC, 0x84, 0x72, 0xFB, 0x16, 0x60, 0xAC, 0xF3, 0x6D, 0xF1, 0x00, 0xB8, 0x73, 0xF9, 0x03, 0x03, + 0x85, 0xF3, 0x6C, 0xFB, 0x04, 0x00, 0x6C, 0xF3, 0x85, 0xF1, 0x0D, 0x1B, 0x6C, 0xF9, 0x31, 0x40, + 0x01, 0x2A, 0x09, 0x00, 0x9D, 0xFE, 0x07, 0x05, 0xBA, 0xFE, 0x08, 0x64, 0x13, 0x60, 0x16, 0xFB, + 0x2D, 0xFF, 0xFF, 0xFF, 0xA3, 0xFE, 0x32, 0x40, 0x80, 0x2A, 0x12, 0x00, 0x31, 0x40, 0x04, 0x2A, + 0x0F, 0x00, 0x16, 0x60, 0xAC, 0xF3, 0x6C, 0xF1, 0x03, 0x1B, 0x31, 0x40, 0x02, 0x2A, 0x06, 0x00, + 0x73, 0xF3, 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, 0x01, 0x07, 0x60, 0x5C, 0x19, 0x60, 0xF5, 0xF9, + 0x00, 0x64, 0x19, 0x60, 0xF4, 0xFB, 0x0E, 0x60, 0x37, 0xF3, 0xFF, 0xFF, 0xCC, 0x84, 0xFF, 0x2B, + 0xA2, 0xDB, 0xCF, 0xF1, 0x07, 0x60, 0xE9, 0xF3, 0x64, 0x40, 0x02, 0x3A, 0x3A, 0x00, 0x0A, 0x60, + 0x18, 0xF1, 0x10, 0xB4, 0x90, 0x80, 0xFF, 0xFF, 0x34, 0x03, 0x0A, 0x60, 0x18, 0xFB, 0x01, 0x63, + 0x60, 0x40, 0x10, 0x22, 0x00, 0x63, 0x08, 0x60, 0xC1, 0xFD, 0x08, 0x60, 0xC5, 0xFD, 0x08, 0x60, + 0xC9, 0xFD, 0x08, 0x60, 0xCD, 0xFD, 0x7D, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x23, 0x21, 0x00, + 0x0B, 0x36, 0x07, 0x00, 0x0C, 0x36, 0x05, 0x00, 0x0D, 0x36, 0x03, 0x00, 0x0E, 0x36, 0x01, 0x00, + 0x18, 0x00, 0xDB, 0xF3, 0x01, 0x63, 0x0E, 0x60, 0x36, 0xFD, 0x60, 0x40, 0x03, 0x3A, 0x08, 0x00, + 0x08, 0x60, 0x15, 0xF1, 0x00, 0x60, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x09, 0x00, + 0x04, 0x3A, 0x07, 0x00, 0x08, 0x60, 0x15, 0xF1, 0x00, 0x60, 0x10, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0x10, 0x64, 0x3B, 0xDB, 0x7E, 0xF3, 0x73, 0x45, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, + 0xE0, 0x84, 0xC4, 0x93, 0xC9, 0xFE, 0x49, 0xF3, 0x3C, 0x46, 0x25, 0x18, 0xCC, 0x84, 0x49, 0xFB, + 0x22, 0x02, 0xC2, 0x60, 0x45, 0x64, 0x40, 0x42, 0xFC, 0xFC, 0x00, 0x64, 0x5C, 0x5C, 0x32, 0xFB, + 0x82, 0xFF, 0x5C, 0x47, 0x84, 0xFF, 0x62, 0xFF, 0x16, 0x60, 0x7E, 0xF3, 0xFF, 0xFF, 0xDC, 0x84, + 0x00, 0x36, 0x00, 0x3B, 0xA2, 0xDB, 0x23, 0xF0, 0x01, 0x64, 0xB0, 0x84, 0xA2, 0xDA, 0x25, 0x60, + 0xEC, 0x64, 0x13, 0x60, 0x0A, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0xC1, 0xFE, 0xCE, 0xFE, 0x69, 0xF3, 0xFF, 0xFF, 0x60, 0x41, 0xFD, 0xB4, 0xA2, 0xDB, + 0x61, 0x44, 0x01, 0xB0, 0x02, 0xB0, 0x0B, 0x03, 0x0A, 0x02, 0x9D, 0xFE, 0x08, 0x04, 0x1C, 0x60, + 0xCE, 0x64, 0x13, 0x60, 0x20, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x07, 0x00, + 0x7E, 0xF3, 0x73, 0x45, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xC4, 0x93, 0x1D, 0x60, + 0xBA, 0x63, 0xA3, 0xD3, 0xAD, 0x49, 0x20, 0xB5, 0x08, 0xB1, 0x22, 0x03, 0xE1, 0x81, 0x10, 0xB5, + 0x95, 0x81, 0x60, 0x41, 0x18, 0x02, 0x1D, 0x60, 0xBC, 0x7C, 0xA4, 0xD3, 0xFF, 0xFF, 0xCC, 0x84, + 0xA4, 0xDB, 0x16, 0x02, 0x05, 0x64, 0xA4, 0xDB, 0x61, 0x44, 0x07, 0xB4, 0xFF, 0xFF, 0x10, 0x02, + 0x08, 0xB1, 0xE1, 0x81, 0x95, 0x81, 0xA3, 0xD3, 0x0B, 0x03, 0x08, 0xAC, 0x01, 0xBC, 0xA3, 0xDB, + 0xFF, 0xFF, 0x13, 0xFF, 0x05, 0x00, 0x10, 0xAC, 0xA3, 0xDB, 0x05, 0x7C, 0x0E, 0x60, 0xDE, 0xF9, + 0xB8, 0x60, 0x03, 0x78, 0xFF, 0xFF, 0x46, 0xF3, 0x45, 0xF1, 0x04, 0x1B, 0x64, 0x44, 0x02, 0x1B, + 0x07, 0x60, 0xED, 0xF3, 0x45, 0xFB, 0x00, 0x63, 0x46, 0xFD, 0x60, 0x41, 0x25, 0x64, 0x3B, 0xDB, + 0x27, 0x44, 0xEF, 0xB4, 0x40, 0x47, 0x00, 0xB9, 0x71, 0x40, 0x80, 0x27, 0x01, 0x12, 0x27, 0x03, + 0xC1, 0x60, 0xC5, 0x62, 0x84, 0xFF, 0x42, 0x42, 0x82, 0xFF, 0xA0, 0x4C, 0x14, 0xBC, 0xFF, 0xB4, + 0xA0, 0x51, 0x2D, 0x0A, 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, 0x70, 0x44, 0xAC, 0x80, 0x27, 0x0A, + 0x71, 0x40, 0x80, 0x27, 0xF7, 0x12, 0x45, 0xF3, 0x48, 0x02, 0x11, 0x18, 0x1B, 0x60, 0xEE, 0xF3, + 0x1B, 0x60, 0xEF, 0xF3, 0x07, 0x18, 0x06, 0x18, 0xAC, 0x4C, 0x80, 0x26, 0x03, 0x00, 0x00, 0x64, + 0x45, 0xFB, 0x05, 0x00, 0x45, 0xF3, 0xFF, 0xFF, 0xCC, 0x84, 0x45, 0xFB, 0xE3, 0x02, 0x06, 0x0A, + 0xA0, 0x4C, 0xFB, 0xB4, 0xA0, 0x51, 0xA4, 0x60, 0x58, 0x78, 0xFF, 0xFF, 0x84, 0xFF, 0xC1, 0x60, + 0xA3, 0x64, 0x40, 0x42, 0x82, 0xFF, 0xA0, 0x4C, 0x14, 0xBC, 0xFF, 0xB4, 0xA0, 0x51, 0xB0, 0x60, + 0x9E, 0x78, 0xFF, 0xFF, 0x3C, 0x44, 0xAC, 0x80, 0x32, 0xF1, 0x25, 0x03, 0x64, 0x40, 0x07, 0x22, + 0x22, 0x00, 0xA4, 0x60, 0x36, 0x78, 0xFF, 0xFF, 0xA0, 0x4C, 0x1C, 0xBC, 0xDF, 0xB4, 0xA0, 0x51, + 0x31, 0x40, 0x08, 0x2A, 0xEF, 0x01, 0x72, 0xF3, 0x70, 0xF1, 0x00, 0xA0, 0xDC, 0x80, 0x05, 0x03, + 0x08, 0x03, 0xCC, 0x84, 0x72, 0xFB, 0x67, 0x50, 0x08, 0x00, 0xCC, 0x84, 0x72, 0xFB, 0x64, 0x50, + 0x04, 0x00, 0x31, 0x44, 0xF7, 0xB4, 0x40, 0x51, 0x06, 0x00, 0x28, 0x64, 0x3A, 0xDB, 0xA0, 0x4C, + 0x30, 0xBC, 0xF3, 0xB4, 0xA0, 0x51, 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, 0x28, 0x64, 0x3B, 0xDB, + 0x07, 0x60, 0xEE, 0xF3, 0x32, 0x40, 0x02, 0x27, 0x16, 0x00, 0x46, 0xFB, 0x14, 0x18, 0xC2, 0x60, + 0x33, 0x64, 0x84, 0xFF, 0x40, 0x42, 0x82, 0xFF, 0xA0, 0x4C, 0x15, 0xBC, 0xF7, 0xB4, 0xA0, 0x51, + 0xA1, 0xFF, 0xFF, 0xFF, 0x81, 0x3E, 0x70, 0x44, 0xAC, 0x80, 0x46, 0xF3, 0xB8, 0x0A, 0xDD, 0x02, + 0xCC, 0x84, 0x46, 0xFB, 0xF5, 0x02, 0x84, 0xFF, 0xC2, 0x60, 0x45, 0x64, 0x40, 0x42, 0x82, 0xFF, + 0x27, 0x44, 0x08, 0xBC, 0x40, 0x47, 0xF9, 0xE1, 0x04, 0x00, 0x78, 0xE1, 0x31, 0x40, 0x01, 0x26, + 0xF9, 0xE1, 0xA4, 0x60, 0x2D, 0x78, 0xFF, 0xFF, 0x19, 0x60, 0xAB, 0xF1, 0x60, 0x45, 0x33, 0x60, + 0x6A, 0x61, 0xC5, 0x83, 0xA3, 0xD3, 0xFF, 0xFF, 0x60, 0x41, 0x66, 0x45, 0x24, 0x46, 0x0E, 0xF2, + 0x65, 0x46, 0x64, 0x45, 0xD5, 0x81, 0x61, 0x45, 0x00, 0x7F, 0xD4, 0x80, 0x64, 0x43, 0x08, 0x04, + 0xE3, 0x83, 0x63, 0x45, 0xC5, 0x81, 0x61, 0x45, 0xD4, 0x80, 0x02, 0x65, 0x03, 0x07, 0x03, 0x00, + 0x00, 0x65, 0x01, 0x00, 0x01, 0x65, 0x2E, 0x58, 0xFF, 0xFF, 0x66, 0x43, 0x64, 0x46, 0x8F, 0xF0, + 0x12, 0xF2, 0x91, 0xF2, 0x60, 0x40, 0x10, 0x36, 0x05, 0x00, 0x12, 0x36, 0x08, 0x00, 0x0C, 0x36, + 0x0B, 0x00, 0x0F, 0x00, 0x40, 0x61, 0xA5, 0x80, 0x0A, 0x64, 0x13, 0x02, 0xF3, 0x01, 0x10, 0x61, + 0xA5, 0x80, 0x0E, 0x64, 0x0E, 0x02, 0xEE, 0x01, 0x08, 0x61, 0xA5, 0x80, 0x10, 0x64, 0x09, 0x02, + 0xE9, 0x01, 0xE1, 0x81, 0xA5, 0x80, 0x03, 0x05, 0xC8, 0x84, 0x03, 0x02, 0xE3, 0x01, 0xFF, 0x61, + 0x02, 0x00, 0x12, 0xFA, 0x91, 0xFA, 0x63, 0x46, 0x2E, 0x58, 0xFF, 0xFF, 0x8F, 0xF0, 0x12, 0xF2, + 0x91, 0xF2, 0x60, 0x40, 0x0A, 0x36, 0x05, 0x00, 0x0E, 0x36, 0x08, 0x00, 0x10, 0x36, 0x0B, 0x00, + 0x0F, 0x00, 0x08, 0x61, 0xA5, 0x80, 0x10, 0x7E, 0x11, 0x02, 0xF3, 0x01, 0x04, 0x61, 0xA5, 0x80, + 0x12, 0x7E, 0x0C, 0x02, 0xEE, 0x01, 0x20, 0x61, 0xA5, 0x80, 0x0C, 0x7E, 0x07, 0x02, 0xE9, 0x01, + 0xE9, 0x81, 0xA5, 0x80, 0x05, 0x05, 0xD8, 0x84, 0x01, 0x02, 0xE3, 0x01, 0x12, 0xFA, 0x91, 0xFA, + 0x2E, 0x58, 0xFF, 0xFF, 0x28, 0x40, 0x08, 0x3A, 0x06, 0x00, 0x04, 0x60, 0x40, 0x62, 0x3D, 0x60, + 0x58, 0x4D, 0x3B, 0x78, 0xFF, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x2B, 0x50, 0x00, + 0x28, 0x40, 0x08, 0x3A, 0x4D, 0x00, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0x19, 0x60, + 0x52, 0xFB, 0x7D, 0xF1, 0x2B, 0x60, 0x82, 0x63, 0x64, 0x40, 0x01, 0x27, 0x3C, 0xA3, 0x29, 0x40, + 0x40, 0x2B, 0x1E, 0xA3, 0xBD, 0xD1, 0x63, 0x45, 0x44, 0x4E, 0x0E, 0x61, 0xBD, 0xD1, 0xCD, 0x81, + 0xD0, 0x80, 0x01, 0x03, 0xFB, 0x04, 0xCB, 0x83, 0x19, 0x60, 0x55, 0xF3, 0x39, 0xF1, 0xD7, 0x83, + 0xEB, 0x83, 0x2E, 0x41, 0x5D, 0x93, 0xDF, 0x83, 0x19, 0x60, 0x51, 0xFD, 0x19, 0x60, 0x50, 0xFB, + 0x53, 0x93, 0xDF, 0x80, 0x10, 0x03, 0x38, 0xF3, 0xCF, 0x83, 0x08, 0x03, 0xDF, 0x83, 0x0B, 0x02, + 0xDF, 0x83, 0xDC, 0x84, 0xF0, 0xA0, 0x38, 0xFB, 0x06, 0x03, 0x03, 0x00, 0xCC, 0x84, 0x38, 0xFB, + 0x02, 0x03, 0x00, 0x63, 0x02, 0x00, 0x08, 0x64, 0x38, 0xFB, 0xE3, 0x80, 0xFB, 0x83, 0xC3, 0x83, + 0x63, 0x44, 0xFC, 0xA0, 0x02, 0x0E, 0x08, 0x07, 0x08, 0x00, 0x04, 0xA4, 0xFF, 0xFF, 0x05, 0x0D, + 0xFC, 0x64, 0xFF, 0x7F, 0x60, 0x43, 0x01, 0x00, 0x04, 0x63, 0x39, 0xFD, 0x19, 0x60, 0x54, 0xFD, + 0x2F, 0x58, 0xFF, 0xFF, 0x19, 0x60, 0x74, 0xF3, 0x40, 0x4E, 0x60, 0x46, 0x2F, 0xDB, 0x44, 0x44, + 0xA1, 0xD3, 0xD9, 0x81, 0x48, 0x94, 0x24, 0x5C, 0xD0, 0x9C, 0x66, 0x42, 0x04, 0x06, 0xD2, 0x9C, + 0x2F, 0xD9, 0x64, 0x46, 0x24, 0x44, 0xE0, 0x84, 0x44, 0xD3, 0xA3, 0xDB, 0xFF, 0xB4, 0x60, 0x5C, + 0x66, 0x44, 0x22, 0xA4, 0xD0, 0x84, 0xE0, 0xA0, 0x02, 0x0D, 0x00, 0x64, 0x02, 0x00, 0x01, 0x04, + 0x1F, 0x64, 0xA2, 0xD3, 0x60, 0x5C, 0x64, 0x5E, 0x60, 0x47, 0x2F, 0xD1, 0x28, 0xA3, 0xA3, 0xD9, + 0xD8, 0xA3, 0x2E, 0x42, 0x4E, 0x8E, 0xBD, 0xDB, 0xDB, 0x02, 0x2D, 0x58, 0xFF, 0xFF, 0x43, 0xFF, + 0x39, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x84, 0x3E, 0xFB, 0x01, 0x3D, 0x44, 0x00, 0xA8, 0xFF, 0xFF, + 0x03, 0x02, 0x40, 0xFF, 0x44, 0xFF, 0xF4, 0x01, 0xA0, 0x4C, 0x3D, 0x46, 0x2A, 0xF2, 0x46, 0x4D, + 0x92, 0xFC, 0x10, 0x25, 0x12, 0x00, 0x09, 0xE1, 0xA1, 0xFF, 0x2D, 0x46, 0x0F, 0xF2, 0x01, 0x29, + 0x06, 0x00, 0x2A, 0xF0, 0x40, 0xFF, 0x64, 0x40, 0x40, 0x2B, 0x08, 0xBC, 0x02, 0xBC, 0x0F, 0xFA, + 0x08, 0x25, 0xDD, 0x01, 0xCB, 0xFE, 0x5C, 0x5D, 0xDB, 0x01, 0x44, 0xFF, 0x31, 0xF2, 0x1D, 0x60, + 0xC0, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, + 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x31, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, + 0x61, 0x46, 0x30, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x2F, 0xF0, + 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, + 0xA6, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x07, 0xFC, 0x3F, 0xF2, 0x09, 0x60, 0xB0, 0x65, + 0xD4, 0x80, 0x2A, 0xF2, 0xC0, 0x05, 0x08, 0x25, 0xAA, 0x01, 0x5C, 0x4B, 0x0C, 0x60, 0xEA, 0x61, + 0xA1, 0xDF, 0x2D, 0x46, 0x3B, 0xF2, 0xA6, 0xF1, 0x87, 0xF4, 0x60, 0x40, 0x20, 0x2B, 0xC1, 0x00, + 0xD3, 0x80, 0x2C, 0xF0, 0xB0, 0x03, 0x07, 0xF4, 0x64, 0x40, 0x01, 0x26, 0xA6, 0xF5, 0xBA, 0xF4, + 0x2D, 0x46, 0x04, 0x64, 0x04, 0xB3, 0x22, 0xF0, 0x03, 0x03, 0xC5, 0x60, 0xE2, 0x78, 0xFF, 0xFF, + 0x10, 0x64, 0xB0, 0x9C, 0x3B, 0xF2, 0x22, 0xF8, 0x60, 0x47, 0xC0, 0xB7, 0x02, 0xFE, 0xF0, 0x84, + 0xF0, 0x84, 0xF0, 0x84, 0x00, 0xA8, 0x40, 0x4A, 0x17, 0x03, 0xE0, 0x81, 0x61, 0x43, 0x42, 0xFE, + 0x00, 0x64, 0xF0, 0x84, 0xFE, 0x1F, 0x40, 0x4A, 0xE1, 0x84, 0xE0, 0x84, 0x2D, 0x46, 0x07, 0xF4, + 0xE0, 0x81, 0x3B, 0xF0, 0x2A, 0x47, 0x0C, 0x60, 0x38, 0x63, 0xA0, 0x84, 0x47, 0x9C, 0x10, 0x03, + 0x7C, 0x44, 0x00, 0x60, 0xB2, 0x63, 0x1C, 0x00, 0x07, 0xF4, 0x3B, 0xF0, 0x66, 0x44, 0x64, 0x40, + 0x80, 0x2B, 0x06, 0x00, 0x00, 0x60, 0x78, 0x7C, 0x00, 0x60, 0xA2, 0x63, 0x43, 0x4C, 0x10, 0x00, + 0x2D, 0x46, 0xC5, 0x60, 0xD5, 0x78, 0xFF, 0xFF, 0x2D, 0x46, 0x22, 0xF2, 0x10, 0x60, 0x00, 0x7C, + 0xB0, 0x84, 0x22, 0xFA, 0x32, 0x40, 0x04, 0x26, 0x25, 0x00, 0xC5, 0x60, 0xD5, 0x78, 0xFF, 0xFF, + 0xED, 0xFB, 0xEE, 0xF9, 0xEF, 0xFD, 0xAD, 0x46, 0x3D, 0xF2, 0xAD, 0x46, 0xA3, 0xD0, 0xAD, 0x46, + 0xD0, 0x80, 0x3C, 0xF2, 0xAD, 0x46, 0x02, 0x03, 0x15, 0x07, 0xE6, 0x04, 0x5B, 0xD0, 0xAD, 0x46, + 0xD0, 0x80, 0x3A, 0xF2, 0x03, 0x03, 0xAD, 0x46, 0x0D, 0x07, 0xDE, 0x04, 0x3A, 0xF0, 0xAD, 0x46, + 0x5B, 0xD0, 0x64, 0x44, 0xD0, 0x80, 0x2B, 0x44, 0x05, 0x07, 0xD6, 0x03, 0xD0, 0x84, 0x10, 0xA4, + 0xFF, 0xFF, 0x00, 0x07, 0xEE, 0xF3, 0xED, 0xF5, 0xFE, 0xA4, 0x0F, 0x60, 0xBE, 0x61, 0x0E, 0x63, + 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x2D, 0x46, 0x8B, 0xFF, 0x2D, 0x46, 0x22, 0xF2, 0x20, 0x60, + 0x00, 0x7C, 0xB0, 0x84, 0x22, 0xFA, 0x0F, 0x60, 0xB0, 0x64, 0xC9, 0x60, 0x58, 0x4F, 0x56, 0x78, + 0xFF, 0xFF, 0x3F, 0xF2, 0x00, 0x60, 0x18, 0x70, 0x18, 0x71, 0x20, 0x72, 0x60, 0x53, 0x88, 0x75, + 0x00, 0xF2, 0x09, 0xE1, 0x60, 0x50, 0x12, 0x71, 0x6E, 0x72, 0x83, 0x75, 0xA1, 0xFF, 0xFF, 0xFF, + 0x08, 0x25, 0x1D, 0x00, 0x40, 0xFF, 0x02, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x75, 0x40, 0x03, 0x2A, + 0x03, 0x00, 0x80, 0x75, 0x0A, 0x64, 0x0B, 0x00, 0x80, 0x75, 0x1B, 0xF3, 0x8B, 0xFF, 0x02, 0x60, + 0x00, 0x75, 0xFF, 0xFF, 0x02, 0x60, 0x00, 0x75, 0xDC, 0x84, 0xA2, 0xDB, 0x02, 0x64, 0x98, 0xFF, + 0x2D, 0x46, 0x0F, 0xF0, 0xFF, 0xFF, 0xB0, 0x84, 0xA2, 0xDA, 0x88, 0xFF, 0x0B, 0x01, 0x8B, 0xFF, + 0x02, 0x60, 0x00, 0x75, 0xFF, 0xFF, 0x02, 0x60, 0x00, 0x75, 0x88, 0xFF, 0xC5, 0x60, 0xBB, 0x78, + 0xFF, 0xFF, 0x22, 0xF0, 0x22, 0x64, 0xB0, 0x84, 0x22, 0xFA, 0x3A, 0xF0, 0xFF, 0xFF, 0x64, 0x44, + 0xE0, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xE1, 0x7F, 0x5A, 0xD0, 0xA0, 0x5B, 0x64, 0x44, 0xE2, 0x7F, + 0xA0, 0x5B, 0x64, 0x47, 0x7C, 0x5F, 0xE8, 0x84, 0xE8, 0x85, 0x0D, 0x60, 0x00, 0x64, 0x44, 0xD3, + 0x5A, 0xD1, 0x03, 0x1B, 0xC5, 0x60, 0xD5, 0x78, 0xFF, 0xFF, 0x60, 0x45, 0x64, 0x44, 0xE3, 0x7F, + 0xA0, 0x5B, 0x64, 0x47, 0xE4, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, 0x64, 0x44, 0xE5, 0x7F, 0xA0, 0x5B, + 0x64, 0x47, 0xE6, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, 0x64, 0x44, 0xE7, 0x7F, 0xA0, 0x5B, 0x65, 0x40, + 0x0D, 0x3A, 0x1C, 0x00, 0x64, 0x47, 0xE8, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, 0x64, 0x44, 0xE9, 0x7F, + 0xA0, 0x5B, 0x64, 0x47, 0xEA, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, 0x64, 0x44, 0xEB, 0x7F, 0xA0, 0x5B, + 0x64, 0x47, 0xEC, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, 0x64, 0x44, 0xED, 0x7F, 0xA0, 0x5B, 0x64, 0x47, + 0xEE, 0x7F, 0x5A, 0xD1, 0xA0, 0x5B, 0x64, 0x44, 0xEF, 0x7F, 0xA0, 0x5B, 0x65, 0x44, 0xD8, 0x84, + 0x08, 0x25, 0x25, 0x00, 0x60, 0x7F, 0xA0, 0x5B, 0x80, 0x60, 0x00, 0xEB, 0xA0, 0x60, 0x00, 0xEB, + 0xD1, 0x60, 0x00, 0xEB, 0x22, 0xF2, 0x20, 0x60, 0x00, 0x7C, 0xB0, 0x84, 0x22, 0xFA, 0x3F, 0xF2, + 0x3B, 0xF0, 0x60, 0x43, 0xFC, 0xA4, 0x64, 0x40, 0x20, 0x2B, 0x04, 0x00, 0x08, 0xA4, 0x3F, 0xFA, + 0x08, 0xA3, 0xF8, 0xA3, 0x3F, 0xFA, 0x0A, 0xE1, 0xB3, 0xFF, 0x9A, 0xFF, 0xCB, 0x83, 0x00, 0xF4, + 0x10, 0x62, 0x6C, 0x61, 0x0E, 0xA3, 0xAB, 0x84, 0xF2, 0xA3, 0xA1, 0xFF, 0x09, 0x00, 0xDA, 0x00, + 0x00, 0xF4, 0x81, 0xF2, 0xFC, 0x18, 0x02, 0x62, 0xC9, 0x81, 0xAB, 0x84, 0x01, 0x00, 0xA2, 0xDC, + 0x7A, 0xD4, 0xFD, 0x1C, 0xA2, 0xDC, 0x08, 0x25, 0xCE, 0x00, 0xF2, 0x1D, 0x41, 0x44, 0x7C, 0xA8, + 0xD9, 0x81, 0xEE, 0x03, 0xFF, 0xB1, 0x98, 0xFF, 0x09, 0xE1, 0xA1, 0xFF, 0xFF, 0xFF, 0x64, 0x40, + 0x20, 0x27, 0x04, 0x00, 0x08, 0x25, 0xBF, 0x00, 0x7B, 0x1E, 0x6F, 0x00, 0x08, 0x25, 0xBB, 0x00, + 0x40, 0xFF, 0x42, 0x42, 0x46, 0x43, 0x06, 0x1E, 0x04, 0x02, 0x00, 0xF4, 0x02, 0x62, 0x42, 0x42, + 0x46, 0x43, 0x01, 0xA2, 0x63, 0x45, 0x01, 0xA2, 0x62, 0x43, 0x46, 0x4C, 0xC6, 0x60, 0x58, 0x4F, + 0x87, 0x78, 0xFF, 0xFF, 0x0A, 0xE1, 0x9A, 0xFF, 0x2D, 0x46, 0x12, 0xF2, 0x3B, 0xF0, 0x33, 0x1B, + 0x64, 0x40, 0x20, 0x2B, 0x38, 0x00, 0x2D, 0x5C, 0x24, 0x41, 0x02, 0xA1, 0x65, 0x43, 0x08, 0xA3, + 0x23, 0x46, 0x22, 0x42, 0x7E, 0x3A, 0x0A, 0x00, 0x00, 0xF4, 0x81, 0xF2, 0xB8, 0x18, 0x02, 0x62, + 0xC9, 0x81, 0xAB, 0x84, 0x03, 0x00, 0xA2, 0xDC, 0x7E, 0x36, 0xF6, 0x01, 0x15, 0x11, 0x7A, 0xD4, + 0xFF, 0xFF, 0xF9, 0x1C, 0xA2, 0xDC, 0xF0, 0x1D, 0xD9, 0x81, 0xFF, 0xB1, 0x41, 0x1E, 0x62, 0x40, + 0x7E, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x02, 0x62, 0x07, 0x11, 0x5A, 0xD2, 0x89, 0xFF, 0x80, 0x4F, + 0x6F, 0x44, 0xA2, 0xDA, 0x88, 0xFF, 0x34, 0x00, 0x62, 0x45, 0x33, 0xF3, 0xFF, 0xFF, 0x03, 0x1B, + 0x65, 0x42, 0xE5, 0x1D, 0xF2, 0x01, 0x98, 0xFF, 0x2D, 0x46, 0x01, 0x64, 0x12, 0xFA, 0x0F, 0xF0, + 0x0A, 0x64, 0xB0, 0x84, 0x41, 0x00, 0x24, 0x41, 0x02, 0xA1, 0x65, 0x43, 0x08, 0xA3, 0x23, 0x46, + 0x22, 0x42, 0x7E, 0x3A, 0x0A, 0x00, 0x00, 0xF4, 0x81, 0xF2, 0x5C, 0x18, 0x02, 0x62, 0xC9, 0x81, + 0xAB, 0x84, 0x03, 0x00, 0xA2, 0xDC, 0x7E, 0x36, 0xF6, 0x01, 0x7A, 0xD4, 0xFF, 0xFF, 0xFA, 0x1C, + 0xA2, 0xDC, 0xF1, 0x1D, 0xD9, 0x81, 0xFF, 0xB1, 0x0B, 0x1E, 0x62, 0x40, 0x7E, 0x3A, 0x02, 0x00, + 0x00, 0xF4, 0x02, 0x62, 0x5A, 0xD2, 0x89, 0xFF, 0x80, 0x4F, 0x6F, 0x44, 0xA2, 0xDA, 0x88, 0xFF, + 0x98, 0xFF, 0x2D, 0x46, 0x0F, 0xF0, 0x0A, 0x64, 0xB0, 0x84, 0x16, 0x14, 0xF7, 0xB4, 0xA2, 0xDA, + 0x06, 0x60, 0x75, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, 0x0B, 0x00, 0xF0, 0xF5, 0xEF, 0xF4, + 0x0C, 0x60, 0xEA, 0x61, 0x59, 0xD1, 0x3B, 0xF8, 0x05, 0x64, 0x59, 0xD1, 0xCC, 0x84, 0xBD, 0xD8, + 0xFC, 0x02, 0xC3, 0x60, 0x6A, 0x78, 0xFF, 0xFF, 0xA2, 0xDA, 0x2D, 0x46, 0x3B, 0xF0, 0xFF, 0xFF, + 0x64, 0x40, 0x20, 0x2B, 0x1C, 0x00, 0x07, 0xF4, 0xBB, 0xF0, 0x2A, 0x44, 0xA4, 0x84, 0xFF, 0xFF, + 0x2F, 0x26, 0x15, 0x00, 0x2D, 0x46, 0x64, 0x44, 0x3A, 0xF0, 0xBC, 0xF0, 0x64, 0x5F, 0x3D, 0xF0, + 0x07, 0xF4, 0xEF, 0xF4, 0xFF, 0xFF, 0x08, 0xA3, 0x5B, 0xD8, 0x65, 0x5C, 0x5B, 0xD8, 0x5B, 0xDA, + 0x2D, 0x46, 0xED, 0xF3, 0x3C, 0xFA, 0xEE, 0xF3, 0x3D, 0xFA, 0x2A, 0x44, 0x23, 0xFA, 0xC3, 0x60, + 0x6A, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0x98, 0xFF, 0x43, 0xFF, 0x40, 0xFF, 0xB0, 0xFF, 0xB1, 0xFF, + 0x2D, 0x46, 0x0C, 0x60, 0xEA, 0x61, 0xA1, 0xD3, 0x2D, 0x46, 0x60, 0x40, 0x01, 0x2A, 0x0A, 0x00, + 0xF0, 0xF5, 0xEF, 0xF4, 0x59, 0xD1, 0x3B, 0xF8, 0x05, 0x64, 0x59, 0xD1, 0xCC, 0x84, 0xBD, 0xD8, + 0xFC, 0x02, 0x2D, 0x46, 0xC3, 0x60, 0x48, 0x78, 0xFF, 0xFF, 0x98, 0xFF, 0x09, 0xE1, 0xA1, 0xFF, + 0x2D, 0x46, 0x08, 0x25, 0xE0, 0x01, 0x0F, 0xF2, 0x40, 0xFF, 0x02, 0xBC, 0xA2, 0xDA, 0xC3, 0x60, + 0x6A, 0x78, 0xFF, 0xFF, 0xB0, 0x84, 0x22, 0xFA, 0xA0, 0x60, 0x00, 0xEB, 0xB0, 0x60, 0x00, 0xEB, + 0x00, 0x63, 0x3B, 0xF2, 0x06, 0x60, 0x75, 0xFD, 0x60, 0x47, 0xC0, 0xB7, 0x02, 0xFE, 0xF0, 0x84, + 0xF0, 0x84, 0xF0, 0x84, 0x00, 0xA8, 0x40, 0x4A, 0x16, 0x03, 0xE0, 0x81, 0x61, 0x43, 0x42, 0xFE, + 0x00, 0x64, 0xF0, 0x84, 0xFE, 0x1F, 0x40, 0x4A, 0xE1, 0x84, 0xE0, 0x84, 0x2D, 0x46, 0x07, 0xF4, + 0xE0, 0x81, 0x3B, 0xF0, 0x2A, 0x47, 0x0C, 0x60, 0x38, 0x63, 0xA0, 0x84, 0x47, 0x9C, 0x10, 0x03, + 0x7C, 0x44, 0xA8, 0x63, 0x0F, 0x00, 0x07, 0xF4, 0x20, 0x64, 0x40, 0x4A, 0x3B, 0xF0, 0x66, 0x44, + 0x64, 0x40, 0x80, 0x2B, 0x05, 0x00, 0x00, 0x60, 0x78, 0x7C, 0x00, 0x60, 0x98, 0x63, 0x02, 0x00, + 0x2D, 0x46, 0xBB, 0x01, 0x2D, 0x46, 0xED, 0xFB, 0xEE, 0xF9, 0xEF, 0xFD, 0x07, 0xF2, 0xF0, 0xFB, + 0x60, 0x46, 0x3B, 0xF0, 0x2A, 0x44, 0x06, 0x60, 0x76, 0xF9, 0x5C, 0x4B, 0xA0, 0x84, 0xFF, 0xFF, + 0x3F, 0x22, 0x05, 0x00, 0x90, 0x84, 0x3B, 0xFA, 0x01, 0x64, 0x40, 0x4B, 0x2C, 0x00, 0xAD, 0x46, + 0x0A, 0xA3, 0x3D, 0xF2, 0xAD, 0x46, 0xA3, 0xD0, 0xAD, 0x46, 0xD0, 0x80, 0x3C, 0xF2, 0xAD, 0x46, + 0x02, 0x03, 0x21, 0x07, 0x14, 0x04, 0x5B, 0xD0, 0xAD, 0x46, 0xD0, 0x80, 0x3B, 0xF2, 0x03, 0x03, + 0xAD, 0x46, 0x19, 0x07, 0x0C, 0x04, 0x3A, 0xF0, 0xAD, 0x46, 0x5B, 0xD0, 0x64, 0x5F, 0xD0, 0x80, + 0x2B, 0x44, 0x22, 0x07, 0x04, 0x03, 0xD0, 0x84, 0x10, 0xA4, 0xFF, 0xFF, 0x1D, 0x07, 0x2D, 0x46, + 0x22, 0xF2, 0x10, 0x60, 0x00, 0x7C, 0xB0, 0x84, 0x22, 0xFA, 0x32, 0x40, 0x04, 0x26, 0x14, 0x00, + 0xC5, 0x60, 0xD5, 0x78, 0xFF, 0xFF, 0x01, 0x64, 0x06, 0x60, 0x75, 0xFB, 0x2D, 0x46, 0x0C, 0x60, + 0xFA, 0x62, 0x80, 0xFF, 0x78, 0x44, 0x03, 0xA4, 0xA2, 0xDB, 0xC6, 0x60, 0xBC, 0x78, 0xFF, 0xFF, + 0x85, 0xFF, 0x2D, 0x46, 0x08, 0x25, 0x4F, 0x01, 0x2D, 0x46, 0x0C, 0x60, 0xFA, 0x62, 0x80, 0xFF, + 0x78, 0x44, 0x03, 0xA4, 0xA2, 0xDB, 0xC7, 0x60, 0x44, 0x78, 0xFF, 0xFF, 0x85, 0xFF, 0x2D, 0x46, + 0x08, 0x25, 0x41, 0x01, 0x00, 0x60, 0x0F, 0x64, 0x08, 0x25, 0x3C, 0x01, 0x60, 0x7F, 0xA0, 0x5B, + 0x80, 0x60, 0x00, 0xEB, 0xD3, 0x60, 0x00, 0xEB, 0xC4, 0x60, 0xC2, 0x78, 0xFF, 0xFF, 0x2D, 0x46, + 0x3B, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x20, 0x2B, 0x23, 0x00, 0x08, 0x61, 0x23, 0x11, 0x2D, 0x46, + 0x00, 0xF4, 0x0A, 0x62, 0x56, 0x92, 0x5A, 0xD0, 0x2C, 0x46, 0x64, 0x47, 0x63, 0x40, 0x7F, 0x2A, + 0x03, 0x00, 0x00, 0xF4, 0x03, 0x63, 0x46, 0x4C, 0x60, 0xFE, 0xDE, 0xD8, 0x7F, 0x3A, 0x03, 0x00, + 0x00, 0xF4, 0x03, 0x63, 0x46, 0x4C, 0xDE, 0xDA, 0xFE, 0xA1, 0x20, 0xFE, 0xE7, 0x02, 0x63, 0x41, + 0xFD, 0xA1, 0x46, 0x4C, 0x01, 0xF2, 0x2D, 0x46, 0x61, 0x5E, 0x16, 0xFA, 0x2C, 0x44, 0x06, 0xFA, + 0x2F, 0x58, 0xFF, 0xFF, 0x2D, 0x5C, 0x3D, 0x44, 0x00, 0xA8, 0xD0, 0x80, 0xD8, 0x03, 0xD7, 0x03, + 0x2D, 0x46, 0x01, 0x64, 0x12, 0xFA, 0xF4, 0x01, 0x07, 0xF4, 0x66, 0x41, 0x03, 0xF2, 0x04, 0xF2, + 0x40, 0x42, 0x05, 0xF2, 0x40, 0x43, 0x40, 0x44, 0x61, 0x46, 0x3C, 0xF2, 0x3D, 0xF2, 0x40, 0x40, + 0x40, 0x41, 0x0D, 0x60, 0x70, 0x65, 0x00, 0x61, 0xEE, 0xF1, 0xED, 0xF5, 0x44, 0x4C, 0x2C, 0x5C, + 0xE9, 0x80, 0x00, 0x64, 0xF0, 0x84, 0xF0, 0x84, 0xC0, 0x83, 0xBD, 0xD2, 0x24, 0x5C, 0x90, 0x9C, + 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x47, 0x90, 0x9C, 0x20, 0x44, 0x40, 0x80, 0xDB, 0x83, 0xBD, 0xD2, 0x20, 0x5C, 0x90, 0x9C, + 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x47, 0x90, 0x9C, 0x21, 0x44, 0x40, 0x81, 0xDB, 0x83, 0xBD, 0xD2, 0x21, 0x5C, 0x90, 0x9C, + 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x47, 0x90, 0x9C, 0x22, 0x44, 0x40, 0x82, 0xDB, 0x83, 0xBD, 0xD2, 0x22, 0x5C, 0x90, 0x9C, + 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x47, 0x90, 0x9C, 0x23, 0x44, 0x40, 0x83, 0xF2, 0xA3, 0xBD, 0xD2, 0x23, 0x5C, 0x90, 0x9C, + 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x47, 0x90, 0x9C, 0x24, 0x44, 0xC0, 0x9C, 0x41, 0x84, 0xDD, 0x81, 0x08, 0x2A, 0xA7, 0x01, + 0x0C, 0x60, 0xEC, 0x61, 0x05, 0x64, 0xEF, 0xF4, 0xF0, 0xF5, 0xFE, 0xA3, 0x5B, 0xD0, 0xCC, 0x84, + 0x59, 0xD9, 0xFC, 0x02, 0xEF, 0xF3, 0xF0, 0xF5, 0x60, 0x42, 0x20, 0x44, 0xA2, 0xDA, 0x21, 0x44, + 0x5A, 0xDA, 0x22, 0x44, 0x5A, 0xDA, 0x23, 0x44, 0x5A, 0xDA, 0x24, 0x44, 0x5A, 0xDA, 0x61, 0x46, + 0x06, 0x60, 0x7D, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0x66, 0x41, 0xEF, 0xF3, 0xF0, 0xF5, 0xA0, 0xD2, + 0x5A, 0xD0, 0x40, 0x40, 0x44, 0x41, 0x5A, 0xD2, 0x5A, 0xD0, 0x40, 0x42, 0x5A, 0xD0, 0x44, 0x43, + 0x61, 0x46, 0xBA, 0xF0, 0x3B, 0xF2, 0x44, 0x44, 0x65, 0x5F, 0x40, 0x85, 0xEE, 0xF4, 0xED, 0xF5, + 0x43, 0x4C, 0x0D, 0x60, 0x70, 0x65, 0xBD, 0xD2, 0x25, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x20, 0x44, 0x40, 0x80, 0xBD, 0xD2, 0x20, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, + 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x21, 0x44, + 0x40, 0x81, 0xBD, 0xD2, 0x21, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x22, 0x44, 0x40, 0x82, + 0xBD, 0xD2, 0x22, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x23, 0x44, 0x40, 0x83, 0xBD, 0xD2, + 0x23, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x24, 0x44, 0x40, 0x84, 0xBD, 0xD2, 0x24, 0x5C, + 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, + 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x25, 0x44, 0x40, 0x85, 0x61, 0x46, 0x3A, 0xF0, 0xFF, 0xFF, + 0x64, 0x44, 0xE0, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xE1, 0x7F, 0x5A, 0xD0, 0xA0, 0x5B, 0x64, 0x44, + 0xE2, 0x7F, 0xA0, 0x5B, 0x64, 0x47, 0xED, 0xF5, 0xBD, 0xD2, 0x25, 0x5C, 0x90, 0x84, 0xE8, 0x80, + 0xF8, 0x84, 0x20, 0x5C, 0x40, 0x80, 0x20, 0x44, 0xE4, 0x7F, 0xA0, 0x5B, 0x20, 0x47, 0xE5, 0x7F, + 0xA0, 0x5B, 0xBD, 0xD2, 0x20, 0x5C, 0x90, 0x84, 0xE8, 0x80, 0xF8, 0x84, 0x21, 0x5C, 0x40, 0x81, + 0x21, 0x44, 0xE6, 0x7F, 0xA0, 0x5B, 0x21, 0x47, 0xE7, 0x7F, 0xA0, 0x5B, 0x21, 0x44, 0xE8, 0x80, + 0xF8, 0x84, 0x22, 0x5C, 0x40, 0x82, 0x22, 0x44, 0xE8, 0x7F, 0xA0, 0x5B, 0x22, 0x47, 0xE9, 0x7F, + 0xA0, 0x5B, 0x22, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x23, 0x5C, 0x40, 0x83, 0x23, 0x44, 0xEA, 0x7F, + 0xA0, 0x5B, 0x23, 0x47, 0xEB, 0x7F, 0xA0, 0x5B, 0x23, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x24, 0x5C, + 0x40, 0x84, 0x24, 0x44, 0xEC, 0x7F, 0xA0, 0x5B, 0x24, 0x47, 0xED, 0x7F, 0xA0, 0x5B, 0x24, 0x44, + 0xE8, 0x80, 0xF8, 0x84, 0x25, 0x5C, 0x40, 0x85, 0x25, 0x44, 0xEE, 0x7F, 0xA0, 0x5B, 0x25, 0x47, + 0xEF, 0x7F, 0xA0, 0x5B, 0x2C, 0x43, 0xA3, 0xD2, 0x25, 0x5C, 0x90, 0x81, 0xE9, 0x84, 0xE3, 0x7F, + 0xA0, 0x5B, 0x06, 0x60, 0x7D, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0xEA, 0xF3, 0x5A, 0xD3, 0x40, 0x48, + 0x5A, 0xD3, 0x40, 0x49, 0x40, 0x4A, 0x00, 0x60, 0x78, 0x7C, 0x44, 0x4D, 0x49, 0xF2, 0x4A, 0xF2, + 0x40, 0x47, 0x40, 0x46, 0x0D, 0x60, 0x70, 0x65, 0x00, 0x61, 0x2D, 0x5C, 0xE9, 0x80, 0x00, 0x64, + 0xF0, 0x84, 0xF0, 0x84, 0xC0, 0x83, 0xBD, 0xD2, 0x2A, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x26, 0x44, 0x40, 0x86, 0xDB, 0x83, 0xBD, 0xD2, 0x26, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x27, 0x44, 0x40, 0x87, 0xDB, 0x83, 0xBD, 0xD2, 0x27, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x28, 0x44, 0x40, 0x88, 0xDB, 0x83, 0xBD, 0xD2, 0x28, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x29, 0x44, 0x40, 0x89, 0xF2, 0xA3, 0xBD, 0xD2, 0x29, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x2A, 0x44, 0xC0, 0x9C, 0x41, 0x8A, 0xDD, 0x81, 0x08, 0x2A, 0xA7, 0x01, 0x26, 0x44, 0x44, 0xFA, + 0x27, 0x44, 0x45, 0xFA, 0x28, 0x44, 0x46, 0xFA, 0x29, 0x44, 0x47, 0xFA, 0x2A, 0x44, 0x48, 0xFA, + 0x06, 0x60, 0x7E, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x60, 0x88, 0x7C, 0x44, 0x4D, 0x2D, 0x42, + 0xA2, 0xD2, 0x5A, 0xD0, 0x40, 0x46, 0x44, 0x47, 0x5A, 0xD2, 0x5A, 0xD0, 0x40, 0x48, 0x5A, 0xD0, + 0x44, 0x49, 0x4B, 0xF2, 0x44, 0x4A, 0x40, 0x8B, 0x60, 0x5C, 0x64, 0x47, 0xE0, 0x7F, 0xA0, 0x5A, + 0xFF, 0xB4, 0x20, 0xBC, 0x7F, 0xB4, 0xE1, 0x7F, 0xA0, 0x5A, 0x64, 0x44, 0xE2, 0x7F, 0xA0, 0x5A, + 0x00, 0x60, 0x78, 0x63, 0x0D, 0x60, 0x70, 0x65, 0xBD, 0xD2, 0x2B, 0x5C, 0x90, 0x9C, 0x64, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, + 0x90, 0x9C, 0x26, 0x44, 0x40, 0x86, 0xBD, 0xD2, 0x26, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, + 0x27, 0x44, 0x40, 0x87, 0xBD, 0xD2, 0x27, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, + 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x28, 0x44, + 0x40, 0x88, 0xBD, 0xD2, 0x28, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, + 0x64, 0x44, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x29, 0x44, 0x40, 0x89, + 0xBD, 0xD2, 0x29, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x2A, 0x44, 0x40, 0x8A, 0xBD, 0xD2, + 0x2A, 0x5C, 0x90, 0x9C, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x44, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD1, 0x64, 0x47, 0x90, 0x9C, 0x2B, 0x44, 0x40, 0x8B, 0xBD, 0xD2, 0x2B, 0x5C, + 0x90, 0x84, 0xE8, 0x80, 0xF8, 0x84, 0x26, 0x5C, 0x40, 0x86, 0x26, 0x44, 0xE4, 0x7F, 0xA0, 0x5A, + 0x26, 0x47, 0xE5, 0x7F, 0xA0, 0x5A, 0xBD, 0xD2, 0x26, 0x5C, 0x90, 0x84, 0xE8, 0x80, 0xF8, 0x84, + 0x27, 0x5C, 0x40, 0x87, 0x27, 0x44, 0xE6, 0x7F, 0xA0, 0x5A, 0x27, 0x47, 0xE7, 0x7F, 0xA0, 0x5A, + 0x27, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x28, 0x5C, 0x40, 0x88, 0x28, 0x44, 0xE8, 0x7F, 0xA0, 0x5A, + 0x28, 0x47, 0xE9, 0x7F, 0xA0, 0x5A, 0x28, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x29, 0x5C, 0x40, 0x89, + 0x29, 0x44, 0xEA, 0x7F, 0xA0, 0x5A, 0x29, 0x47, 0xEB, 0x7F, 0xA0, 0x5A, 0x29, 0x44, 0xE8, 0x80, + 0xF8, 0x84, 0x2A, 0x5C, 0x40, 0x8A, 0x2A, 0x44, 0xEC, 0x7F, 0xA0, 0x5A, 0x2A, 0x47, 0xED, 0x7F, + 0xA0, 0x5A, 0x2A, 0x44, 0xE8, 0x80, 0xF8, 0x84, 0x2B, 0x5C, 0x40, 0x8B, 0x2B, 0x44, 0xEE, 0x7F, + 0xA0, 0x5A, 0x2B, 0x47, 0xEF, 0x7F, 0xA0, 0x5A, 0x3C, 0xF0, 0x2B, 0x44, 0x90, 0x84, 0xE8, 0x84, + 0xE3, 0x7F, 0xA0, 0x5A, 0x06, 0x60, 0x7E, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0x60, 0x45, 0x00, 0xF0, + 0x84, 0x60, 0x00, 0xE3, 0x04, 0x71, 0x64, 0x50, 0x01, 0x2A, 0x04, 0x71, 0x5C, 0x61, 0x04, 0x63, + 0x59, 0xD0, 0x58, 0xD9, 0xFD, 0x1F, 0x3D, 0xF2, 0x60, 0x43, 0x60, 0x47, 0x5B, 0xDB, 0x3C, 0xF2, + 0xFF, 0xFF, 0x60, 0x47, 0x5B, 0xDB, 0x3A, 0xF2, 0xFF, 0xFF, 0x60, 0x47, 0x5B, 0xDB, 0x3F, 0xF2, + 0xFF, 0xFF, 0x60, 0x47, 0x5B, 0xDB, 0x81, 0x60, 0x18, 0xE3, 0x65, 0x43, 0xE3, 0x84, 0x60, 0x47, + 0x00, 0x7F, 0x60, 0x50, 0x7F, 0x64, 0x23, 0x94, 0x60, 0x51, 0x7C, 0x72, 0x04, 0x75, 0x0C, 0x60, + 0x16, 0x61, 0x16, 0x60, 0x00, 0x63, 0x59, 0xDD, 0x2A, 0xF2, 0x87, 0x60, 0x8F, 0x65, 0xA4, 0x87, + 0x40, 0xBF, 0x59, 0xDB, 0x56, 0x64, 0x0A, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x62, 0x64, + 0x04, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x35, 0xF2, 0x0F, 0x65, 0xA4, 0x9C, 0x59, 0xD9, + 0x06, 0x63, 0x59, 0xDF, 0xFE, 0x1F, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x45, 0x03, 0x2B, 0x05, 0x00, + 0x6A, 0x64, 0x04, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x65, 0x40, 0x8F, 0xB0, 0x88, 0x3A, + 0x02, 0x00, 0x39, 0xF0, 0x59, 0xD9, 0x2F, 0x58, 0xFF, 0xFF, 0x0C, 0x60, 0x16, 0x61, 0xA3, 0x46, + 0x00, 0xF4, 0x02, 0x64, 0x0A, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x59, 0xDF, 0x59, 0xDF, + 0xA0, 0x4C, 0x04, 0xBC, 0xFF, 0xB4, 0xA0, 0x51, 0x23, 0x44, 0x01, 0xA7, 0x80, 0xBF, 0x60, 0x50, + 0x80, 0x60, 0x38, 0x71, 0x80, 0x60, 0x7C, 0x72, 0x01, 0x76, 0xFF, 0xFF, 0x76, 0x44, 0x01, 0x3A, + 0xFD, 0x01, 0x40, 0x76, 0x40, 0x76, 0x42, 0xFF, 0xFF, 0xFF, 0x40, 0x76, 0x80, 0x60, 0x18, 0x70, + 0x80, 0x60, 0x18, 0x71, 0x80, 0x60, 0x7C, 0x72, 0x80, 0x60, 0x10, 0x73, 0x02, 0x76, 0x76, 0x44, + 0xFF, 0xFF, 0x76, 0x44, 0x02, 0x3A, 0xFD, 0x01, 0x40, 0x76, 0x42, 0xFF, 0x3C, 0x46, 0x00, 0xF2, + 0x80, 0x60, 0x00, 0xBC, 0x60, 0x50, 0x80, 0x60, 0x12, 0x71, 0x80, 0x60, 0x6E, 0x72, 0x3F, 0xF2, + 0xFF, 0xFF, 0xF8, 0xA7, 0x80, 0xBF, 0x60, 0x53, 0x04, 0x76, 0xFF, 0xFF, 0x88, 0xFF, 0x3C, 0x46, + 0x07, 0xF2, 0xFF, 0xFF, 0x40, 0x43, 0xA3, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x77, 0x40, 0x8B, 0xFF, + 0xA0, 0x4B, 0x04, 0xE1, 0xFF, 0xFF, 0x76, 0x44, 0x04, 0x3A, 0xFD, 0x01, 0x40, 0x76, 0x42, 0xFF, + 0xFF, 0xFF, 0x10, 0x76, 0xFF, 0xFF, 0x76, 0x44, 0x20, 0x3A, 0xFD, 0x01, 0x40, 0x76, 0x42, 0xFF, + 0x63, 0x44, 0x00, 0x7F, 0xA0, 0x51, 0x02, 0x60, 0x00, 0x75, 0x88, 0xFF, 0xA0, 0x4C, 0xFB, 0xB4, + 0xA0, 0x51, 0x06, 0x60, 0x1F, 0xE1, 0x16, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0x26, 0x46, 0x3F, 0xF2, + 0xFF, 0xFF, 0xF8, 0xA4, 0x3F, 0xFA, 0x00, 0xF4, 0x60, 0x47, 0x08, 0xFA, 0xA0, 0x48, 0x08, 0x26, + 0x07, 0x00, 0xA0, 0x4C, 0x04, 0xE1, 0xFF, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x00, 0x7F, 0xA0, 0x51, + 0x42, 0xFF, 0x26, 0x46, 0x8B, 0xFF, 0x02, 0x60, 0x00, 0x75, 0x3C, 0xF2, 0x40, 0x76, 0x14, 0x1B, + 0x26, 0x46, 0x3B, 0xF2, 0x0C, 0x60, 0xBA, 0x63, 0x60, 0x47, 0xC0, 0xB4, 0xE8, 0x84, 0xE8, 0x84, + 0xE8, 0x84, 0x43, 0x93, 0xE3, 0x9C, 0x64, 0x47, 0x80, 0x7C, 0x64, 0x5F, 0x60, 0x50, 0x7F, 0x64, + 0x23, 0x97, 0x80, 0xBF, 0x60, 0x51, 0x07, 0x00, 0x01, 0xA7, 0x80, 0xBF, 0x60, 0x50, 0x80, 0x60, + 0x40, 0x71, 0x80, 0x60, 0x7C, 0x72, 0x01, 0x76, 0xFF, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x0C, 0x21, + 0xFC, 0x01, 0x04, 0x25, 0xD5, 0x01, 0x40, 0x76, 0x43, 0xFF, 0x0C, 0x60, 0x22, 0x61, 0x26, 0x46, + 0x00, 0xF4, 0x02, 0x64, 0x0A, 0x63, 0x58, 0xD0, 0x59, 0xD9, 0xFD, 0x1F, 0x59, 0xDF, 0x59, 0xDF, + 0x80, 0x60, 0x18, 0x70, 0x80, 0x60, 0x24, 0x71, 0x80, 0x60, 0x7C, 0x72, 0x80, 0x60, 0x10, 0x73, + 0x02, 0x76, 0xFF, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x0C, 0x21, 0xFC, 0x01, 0x04, 0x25, 0xB8, 0x01, + 0x40, 0x76, 0x43, 0xFF, 0x26, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0x60, 0x47, 0x80, 0xBF, 0x60, 0x50, + 0x80, 0x60, 0x12, 0x71, 0x3F, 0xF2, 0x80, 0x60, 0x6E, 0x72, 0x60, 0x47, 0x80, 0xBF, 0x60, 0x53, + 0x04, 0x76, 0xFF, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x0C, 0x21, 0xFC, 0x01, 0x04, 0x25, 0xA0, 0x01, + 0x40, 0x76, 0x43, 0xFF, 0x08, 0x76, 0xFF, 0xFF, 0xA1, 0xFF, 0xFF, 0xFF, 0x0C, 0x21, 0xFC, 0x01, + 0x04, 0x25, 0x96, 0x01, 0x76, 0x5C, 0xFF, 0xFF, 0x40, 0x76, 0x43, 0xFF, 0x88, 0xFF, 0x26, 0x46, + 0x2F, 0x58, 0xFF, 0xFF, 0xEE, 0x60, 0x60, 0x78, 0xFF, 0xFF, 0x08, 0x60, 0x08, 0xF1, 0x80, 0x60, + 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x00, 0xDB, 0xF3, 0x31, 0x41, 0x01, 0xB1, + 0x03, 0xA8, 0x2A, 0x03, 0x15, 0x02, 0x20, 0x40, 0x04, 0x2B, 0x0B, 0x00, 0xBB, 0xFE, 0xCA, 0xFE, + 0x1C, 0x60, 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, + 0x07, 0x00, 0x08, 0x60, 0x09, 0xF1, 0x00, 0x60, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x08, 0x60, 0x1B, 0xF1, 0x00, 0x60, 0x80, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x0C, 0x00, + 0xA9, 0xFE, 0xDB, 0x05, 0xAB, 0xFE, 0x0C, 0x05, 0xA8, 0xFE, 0xCC, 0x05, 0xAA, 0xFE, 0xCD, 0x05, + 0x78, 0x43, 0x01, 0x61, 0x29, 0x60, 0xEA, 0x78, 0xA1, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x85, 0x3E, + 0x13, 0x60, 0x02, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x03, 0x02, 0xCA, 0x60, 0xD4, 0x78, + 0xFF, 0xFF, 0x26, 0x45, 0xD4, 0x80, 0x0F, 0xF0, 0xF9, 0x03, 0x64, 0x44, 0x70, 0xB0, 0x70, 0x2A, + 0x13, 0x00, 0x16, 0x60, 0x85, 0xF3, 0xFF, 0xFF, 0xDC, 0x84, 0x00, 0x36, 0x00, 0x3B, 0xA2, 0xDB, + 0xA2, 0xFF, 0xAC, 0xF3, 0xFF, 0xFF, 0xCC, 0x84, 0xFE, 0xA0, 0xAC, 0xFB, 0x01, 0x07, 0xD4, 0xFE, + 0xA3, 0xFF, 0xD0, 0x60, 0xB5, 0x78, 0xFF, 0xFF, 0x64, 0x40, 0x02, 0x26, 0x09, 0x00, 0x66, 0x45, + 0x09, 0xF4, 0x0F, 0xF2, 0x02, 0x18, 0x65, 0x46, 0xE4, 0x1B, 0x00, 0x64, 0x40, 0x46, 0xCC, 0x01, + 0xA2, 0xFF, 0xAC, 0xF3, 0x46, 0x46, 0xCC, 0x84, 0xFE, 0xA0, 0xAC, 0xFB, 0x01, 0x07, 0xD4, 0xFE, + 0xA3, 0xFF, 0x0F, 0xF0, 0xA3, 0xFC, 0x64, 0x44, 0x80, 0x26, 0x35, 0x00, 0x2C, 0x60, 0xEA, 0x64, + 0xF1, 0x60, 0x78, 0x41, 0xE4, 0x78, 0xB5, 0xF1, 0x32, 0x44, 0x01, 0x2A, 0x03, 0x00, 0x07, 0x60, + 0x01, 0x64, 0x22, 0x00, 0x02, 0x2A, 0x03, 0x00, 0x00, 0x60, 0x01, 0x64, 0x1D, 0x00, 0x04, 0x2A, + 0x1F, 0x00, 0x2A, 0xF2, 0xFF, 0xFF, 0x0C, 0xB0, 0x08, 0x3A, 0x1A, 0x00, 0x2C, 0xF0, 0x22, 0xF0, + 0x64, 0x40, 0x01, 0x26, 0x0B, 0x00, 0x64, 0x40, 0x40, 0x2B, 0x12, 0x00, 0x8F, 0xB0, 0x88, 0x3A, + 0x0F, 0x00, 0x39, 0xF2, 0xFF, 0xFF, 0x60, 0xB0, 0x20, 0x3A, 0x0A, 0x00, 0x23, 0xF2, 0x00, 0x60, + 0x01, 0x7C, 0xB0, 0x84, 0x23, 0xFA, 0x0C, 0x00, 0x23, 0xFA, 0xD0, 0x60, 0xC1, 0x78, 0xFF, 0xFF, + 0xD0, 0x60, 0xB5, 0x78, 0xFF, 0xFF, 0x22, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x10, 0x27, 0xF8, 0x01, + 0x0F, 0xF0, 0xFF, 0xFF, 0x64, 0x44, 0x08, 0x26, 0x64, 0x00, 0x2A, 0xF2, 0x60, 0x63, 0x60, 0x40, + 0x02, 0x2B, 0x66, 0x63, 0xBE, 0xD2, 0x81, 0xF1, 0xA3, 0xD2, 0xD0, 0x80, 0x80, 0xF1, 0x0D, 0x02, + 0xBF, 0xD2, 0xD0, 0x80, 0x7F, 0xF1, 0x09, 0x02, 0xD0, 0x80, 0xFF, 0xFF, 0x06, 0x02, 0x2C, 0x60, + 0xF6, 0x64, 0xF1, 0x60, 0x78, 0x41, 0xE4, 0x78, 0xB5, 0xF1, 0x32, 0x44, 0x01, 0x2A, 0x03, 0x00, + 0x07, 0x60, 0x02, 0x64, 0x04, 0x00, 0x02, 0x2A, 0x06, 0x00, 0x00, 0x60, 0x02, 0x64, 0x23, 0xFA, + 0xD0, 0x60, 0xC1, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0xB0, 0x3A, 0x06, 0x00, + 0x00, 0x60, 0x02, 0x64, 0x23, 0xFA, 0xCC, 0x60, 0x31, 0x78, 0xFF, 0xFF, 0x32, 0x40, 0x04, 0x2A, + 0x2D, 0x00, 0x2A, 0xF2, 0xFF, 0xFF, 0x0C, 0xB0, 0x08, 0x3A, 0x28, 0x00, 0x2C, 0xF0, 0x22, 0xF0, + 0x64, 0x40, 0x01, 0x26, 0x0B, 0x00, 0x64, 0x40, 0x40, 0x2B, 0x20, 0x00, 0x8F, 0xB0, 0x88, 0x3A, + 0x1D, 0x00, 0x39, 0xF2, 0xFF, 0xFF, 0x60, 0xB0, 0x20, 0x3A, 0x18, 0x00, 0x2C, 0xF0, 0x66, 0x45, + 0x07, 0xF4, 0x64, 0x40, 0x01, 0x26, 0xA6, 0xF5, 0x3A, 0xF2, 0x65, 0x46, 0x60, 0x40, 0x00, 0x36, + 0x0D, 0x00, 0x22, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x10, 0x2A, 0x08, 0x00, 0x20, 0x2B, 0x06, 0x00, + 0x23, 0xF2, 0x00, 0x60, 0x02, 0x7C, 0xB0, 0x84, 0x23, 0xFA, 0x03, 0x00, 0xD0, 0x60, 0xB5, 0x78, + 0xFF, 0xFF, 0x32, 0x44, 0x01, 0x2A, 0x4A, 0x00, 0x2E, 0x60, 0x40, 0x63, 0xBF, 0xD3, 0x00, 0x65, + 0xB4, 0x81, 0xDB, 0x83, 0x3D, 0x03, 0xBF, 0xD3, 0xA3, 0xD3, 0x40, 0x48, 0xBE, 0xD3, 0x40, 0x4A, + 0x2E, 0xF0, 0x40, 0x4C, 0xD0, 0x80, 0x2D, 0xF0, 0x08, 0x02, 0x2A, 0x44, 0xD0, 0x80, 0x2C, 0xF0, + 0x04, 0x02, 0x28, 0x44, 0xD0, 0x80, 0xFF, 0xFF, 0x2B, 0x03, 0x31, 0xF0, 0x2C, 0x44, 0xD0, 0x80, + 0x30, 0xF0, 0x08, 0x02, 0x2A, 0x44, 0xD0, 0x80, 0x2F, 0xF0, 0x04, 0x02, 0x28, 0x44, 0xD0, 0x80, + 0xFF, 0xFF, 0x1E, 0x03, 0x34, 0xF0, 0x2C, 0x44, 0xD0, 0x80, 0x33, 0xF0, 0x08, 0x02, 0x2A, 0x44, + 0xD0, 0x80, 0x32, 0xF0, 0x04, 0x02, 0x28, 0x44, 0xD0, 0x80, 0xFF, 0xFF, 0x11, 0x03, 0x38, 0xF0, + 0x2C, 0x44, 0xD0, 0x80, 0x37, 0xF0, 0x08, 0x02, 0x2A, 0x44, 0xD0, 0x80, 0x36, 0xF0, 0x04, 0x02, + 0x28, 0x44, 0xD0, 0x80, 0xFF, 0xFF, 0x04, 0x03, 0xFA, 0xA1, 0x06, 0xA3, 0xB7, 0x03, 0xC3, 0x01, + 0x07, 0x60, 0x00, 0x64, 0x23, 0xFA, 0xD0, 0x60, 0xC1, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0x0F, 0xF0, + 0x60, 0x45, 0xA4, 0x36, 0x08, 0x00, 0x0C, 0xB4, 0x04, 0x36, 0x02, 0x00, 0x0C, 0x3A, 0x06, 0x00, + 0xD0, 0x60, 0xB5, 0x78, 0xFF, 0xFF, 0xCE, 0x60, 0x7C, 0x78, 0xFF, 0xFF, 0x0F, 0xF0, 0x65, 0x40, + 0x40, 0x2B, 0x17, 0x00, 0x32, 0x40, 0x08, 0x26, 0x14, 0x00, 0x07, 0xF4, 0x3A, 0xF2, 0xFF, 0xFF, + 0x37, 0xB4, 0x26, 0x46, 0x0E, 0x02, 0x2C, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x26, 0x06, 0x00, + 0x2C, 0x60, 0xF0, 0x64, 0xF1, 0x60, 0x78, 0x41, 0xE4, 0x78, 0xB5, 0xF1, 0xD0, 0x60, 0xB5, 0x78, + 0xFF, 0xFF, 0x2A, 0xF2, 0x64, 0x40, 0x60, 0x26, 0x03, 0x00, 0xCE, 0x60, 0x4E, 0x78, 0xFF, 0xFF, + 0x60, 0x41, 0xA6, 0xF3, 0x07, 0xFA, 0x61, 0x44, 0x80, 0x3A, 0x02, 0x00, 0x2A, 0xF2, 0x12, 0x00, + 0x60, 0x40, 0x40, 0x3A, 0x0F, 0x00, 0xDB, 0xF3, 0xFF, 0xFF, 0x07, 0xB4, 0x03, 0x3A, 0xE6, 0x01, + 0xD1, 0x60, 0x58, 0x4D, 0xA6, 0x78, 0xFF, 0xFF, 0xE1, 0x02, 0xA6, 0xF3, 0x07, 0xFA, 0xCD, 0x60, + 0xE1, 0x78, 0xFF, 0xFF, 0x5E, 0x63, 0x60, 0x40, 0x02, 0x2B, 0x64, 0x63, 0x50, 0xFE, 0xBD, 0xD2, + 0x7F, 0xF1, 0xBD, 0xD2, 0xD0, 0x80, 0x80, 0xF1, 0xBD, 0xD2, 0xD0, 0x80, 0x81, 0xF1, 0x2A, 0xF2, + 0xD0, 0x80, 0x60, 0x40, 0x08, 0x3A, 0x09, 0x00, 0x01, 0x0C, 0xC8, 0x01, 0xE9, 0x60, 0x58, 0x4F, + 0x08, 0x78, 0xFF, 0xFF, 0xCD, 0x60, 0xE1, 0x78, 0xFF, 0xFF, 0x23, 0x0C, 0xD1, 0x60, 0x58, 0x4D, + 0xA6, 0x78, 0xFF, 0xFF, 0xBB, 0x02, 0x02, 0x64, 0x10, 0x60, 0x0A, 0xFB, 0x00, 0x64, 0x10, 0x60, + 0x0E, 0xFB, 0x26, 0x60, 0x58, 0x4E, 0x65, 0x78, 0xFF, 0xFF, 0x10, 0x60, 0x05, 0xF3, 0xFF, 0xFF, + 0x60, 0x40, 0x80, 0x27, 0x07, 0x00, 0x08, 0x60, 0x15, 0xF1, 0x00, 0x60, 0x04, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x00, 0x64, 0x10, 0x60, 0x0A, 0xFB, 0xA0, 0x01, 0xCD, 0x60, 0xE1, 0x78, + 0xFF, 0xFF, 0xDB, 0xF3, 0xFF, 0xFF, 0x07, 0xB4, 0xFD, 0xA0, 0xFF, 0xFF, 0x03, 0x03, 0x20, 0x40, + 0x10, 0x22, 0xF4, 0x01, 0x08, 0x60, 0x07, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x36, 0x07, 0x00, + 0x01, 0x64, 0xA2, 0xDB, 0x01, 0x65, 0xF1, 0x60, 0x58, 0x4E, 0xC3, 0x78, 0xFF, 0xFF, 0x26, 0x46, + 0x31, 0xF2, 0x1D, 0x60, 0xC0, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, + 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x31, 0xF0, 0x63, 0x46, 0xD0, 0x80, + 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x30, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, + 0x61, 0x46, 0x2F, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, + 0x63, 0x46, 0xE8, 0x1B, 0xA6, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0xA6, 0xF1, 0x43, 0x43, + 0xD3, 0x80, 0xFF, 0xFF, 0x03, 0x03, 0xCD, 0x60, 0xD9, 0x78, 0xFF, 0xFF, 0xD0, 0x60, 0x58, 0x4F, + 0xFC, 0x78, 0xFF, 0xFF, 0x03, 0x4B, 0x3F, 0xF2, 0x00, 0xF4, 0x60, 0x43, 0xF4, 0xA3, 0x00, 0x60, + 0x1D, 0x61, 0x00, 0x60, 0x01, 0x65, 0x01, 0x60, 0xFF, 0x64, 0x40, 0x4C, 0xFD, 0x60, 0x58, 0x4E, + 0x7A, 0x78, 0xFF, 0xFF, 0x00, 0xBB, 0xFF, 0xFF, 0x00, 0x02, 0x00, 0x64, 0x40, 0x4A, 0x60, 0xFE, + 0x02, 0x60, 0x00, 0x63, 0xBD, 0xD3, 0xBD, 0xD3, 0x60, 0x41, 0xFE, 0x60, 0x58, 0x4E, 0x2C, 0x78, + 0xFF, 0xFF, 0x20, 0xFE, 0x00, 0x65, 0x00, 0x64, 0x19, 0x60, 0x3B, 0xFB, 0x02, 0x00, 0x20, 0xFE, + 0xFF, 0x65, 0x02, 0x60, 0x00, 0x63, 0x60, 0xFE, 0xBD, 0xD3, 0xBD, 0xD3, 0x60, 0x41, 0x20, 0xFE, + 0xCD, 0x81, 0x60, 0x40, 0x80, 0x2A, 0x39, 0x00, 0x7F, 0xB4, 0x02, 0x3A, 0x02, 0x00, 0x01, 0x64, + 0x2E, 0x00, 0x04, 0x3A, 0x02, 0x00, 0x02, 0x64, 0x2A, 0x00, 0x0B, 0x3A, 0x02, 0x00, 0x04, 0x64, + 0x26, 0x00, 0x16, 0x3A, 0x02, 0x00, 0x08, 0x64, 0x22, 0x00, 0x0C, 0x3A, 0x02, 0x00, 0x10, 0x64, + 0x1E, 0x00, 0x12, 0x3A, 0x02, 0x00, 0x20, 0x64, 0x1A, 0x00, 0x18, 0x3A, 0x02, 0x00, 0x40, 0x64, + 0x16, 0x00, 0x24, 0x3A, 0x02, 0x00, 0x80, 0x64, 0x12, 0x00, 0x30, 0x3A, 0x02, 0x00, 0x01, 0x67, + 0x0E, 0x00, 0x48, 0x3A, 0x02, 0x00, 0x02, 0x67, 0x0A, 0x00, 0x60, 0x3A, 0x02, 0x00, 0x04, 0x67, + 0x06, 0x00, 0x6C, 0x3A, 0x02, 0x00, 0x08, 0x67, 0x02, 0x00, 0x00, 0x64, 0x00, 0x00, 0x19, 0x60, + 0x3B, 0xF1, 0xFF, 0xFF, 0xB0, 0x84, 0x19, 0x60, 0x3B, 0xFB, 0x61, 0x40, 0x00, 0x36, 0x05, 0x00, + 0x60, 0xFE, 0xBD, 0xD3, 0xFF, 0xFF, 0x20, 0xFE, 0xBB, 0x01, 0x65, 0x40, 0x00, 0x3A, 0x1E, 0x00, + 0x26, 0x46, 0x3F, 0xF2, 0x00, 0xF4, 0x60, 0x43, 0xF4, 0xA3, 0x00, 0x60, 0x1D, 0x61, 0x00, 0x60, + 0x32, 0x65, 0x01, 0x60, 0xFF, 0x64, 0x40, 0x4C, 0xFD, 0x60, 0x58, 0x4E, 0x7A, 0x78, 0xFF, 0xFF, + 0x00, 0xBB, 0xFF, 0xFF, 0x0B, 0x03, 0x60, 0xFE, 0x02, 0x60, 0x00, 0x63, 0xBD, 0xD3, 0xBD, 0xD3, + 0x60, 0x41, 0xFE, 0x60, 0x58, 0x4E, 0x2C, 0x78, 0xFF, 0xFF, 0x91, 0x01, 0x20, 0xFE, 0x00, 0x65, + 0xFC, 0x60, 0x58, 0x4E, 0xC7, 0x78, 0xFF, 0xFF, 0xA1, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x27, + 0x04, 0x00, 0xFD, 0x60, 0x58, 0x4E, 0x11, 0x78, 0xFF, 0xFF, 0x20, 0xFE, 0x37, 0x60, 0xF8, 0x61, + 0xA1, 0xD1, 0xA1, 0xF3, 0x01, 0x60, 0xAC, 0x63, 0x60, 0x45, 0x2A, 0x44, 0x79, 0xFB, 0xA3, 0xD5, + 0x65, 0x40, 0x01, 0x27, 0x5B, 0xD5, 0x65, 0x40, 0x01, 0x27, 0x59, 0xD1, 0x66, 0x41, 0xA0, 0x84, + 0x24, 0x94, 0x2B, 0x46, 0x0F, 0xFA, 0x7A, 0xFB, 0x16, 0x64, 0x12, 0xFA, 0x01, 0x64, 0x11, 0xFA, + 0x66, 0x5C, 0xC2, 0x60, 0x58, 0x4E, 0x6D, 0x78, 0xFF, 0xFF, 0x7D, 0xF3, 0xFF, 0xFF, 0x60, 0x40, + 0x01, 0x27, 0x28, 0x00, 0x19, 0x60, 0x44, 0xF3, 0x32, 0x60, 0x88, 0x63, 0xA3, 0xD3, 0xFF, 0xFF, + 0x60, 0x40, 0x01, 0x2A, 0x0C, 0x00, 0x0F, 0x64, 0xFC, 0x60, 0x58, 0x4E, 0x34, 0x78, 0xFF, 0xFF, + 0xFF, 0x60, 0xFF, 0x63, 0x1A, 0x60, 0xB3, 0xFD, 0x1A, 0x60, 0xC3, 0xFD, 0x1C, 0x00, 0x19, 0x60, + 0x39, 0xF3, 0x3F, 0x40, 0x01, 0x27, 0x08, 0x00, 0x0F, 0x60, 0xFF, 0x65, 0xA4, 0x84, 0xFC, 0x60, + 0x58, 0x4E, 0x34, 0x78, 0xFF, 0xFF, 0x0F, 0x00, 0x0F, 0xB4, 0xFC, 0x60, 0x58, 0x4E, 0x34, 0x78, + 0xFF, 0xFF, 0x09, 0x00, 0x19, 0x60, 0x3A, 0xF3, 0x0F, 0x60, 0xFF, 0x65, 0xA4, 0x84, 0xFC, 0x60, + 0x58, 0x4E, 0x34, 0x78, 0xFF, 0xFF, 0xD3, 0x60, 0x58, 0x4E, 0x78, 0x78, 0xFF, 0xFF, 0x26, 0x46, + 0x23, 0x43, 0x32, 0x40, 0x08, 0x2A, 0x05, 0x00, 0x63, 0x46, 0x80, 0x60, 0x02, 0x64, 0x06, 0xFA, + 0x26, 0x46, 0x2C, 0x60, 0xE4, 0x64, 0xF1, 0x60, 0x78, 0x41, 0xE4, 0x78, 0xB5, 0xF1, 0x27, 0xF2, + 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x3B, 0x07, 0x00, 0x2C, 0x60, 0xF2, 0x64, 0xF1, 0x60, 0x78, 0x41, + 0xE4, 0x78, 0xB5, 0xF1, 0x08, 0x00, 0x02, 0x3B, 0x06, 0x00, 0x2C, 0x60, 0xF4, 0x64, 0xF1, 0x60, + 0x78, 0x41, 0xE4, 0x78, 0xB5, 0xF1, 0x1B, 0xF2, 0xFF, 0xFF, 0xE4, 0xA4, 0x3E, 0xFA, 0x2A, 0xF2, + 0x28, 0x41, 0x40, 0xA8, 0x01, 0xB1, 0x02, 0x02, 0x46, 0x02, 0x76, 0x00, 0x60, 0x40, 0x08, 0x2A, + 0x0F, 0x00, 0x2C, 0x60, 0xE2, 0x64, 0xF1, 0x60, 0x78, 0x41, 0xE4, 0x78, 0xB5, 0xF1, 0x1B, 0xF2, + 0xFF, 0xFF, 0x60, 0x45, 0x2C, 0x60, 0xE8, 0x64, 0xF1, 0x60, 0x78, 0x41, 0xF0, 0x78, 0xB5, 0xF1, + 0x0F, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x40, 0x26, 0x28, 0x00, 0x32, 0x44, 0x02, 0x26, 0x25, 0x00, + 0x10, 0x2B, 0x29, 0x00, 0x2E, 0x60, 0x40, 0x63, 0xBF, 0xD3, 0x2C, 0xF0, 0x00, 0xA8, 0x60, 0x41, + 0x0D, 0x03, 0x50, 0xFE, 0xBD, 0xD3, 0x2D, 0xF0, 0xD0, 0x80, 0xBD, 0xD3, 0x2E, 0xF0, 0xD0, 0x80, + 0xBD, 0xD3, 0x2C, 0xF0, 0xD0, 0x80, 0xFA, 0xA1, 0x10, 0x0C, 0xF3, 0x02, 0x50, 0xFE, 0x60, 0x60, + 0x01, 0x64, 0xD0, 0x80, 0x2D, 0xF0, 0x1D, 0x64, 0xD0, 0x80, 0x2E, 0xF0, 0x01, 0x64, 0xD0, 0x80, + 0xFF, 0xFF, 0x03, 0x0C, 0xD0, 0x60, 0xB5, 0x78, 0xFF, 0xFF, 0x32, 0x40, 0x40, 0x2A, 0x03, 0x00, + 0x1C, 0x60, 0x12, 0x78, 0xFF, 0xFF, 0xD0, 0x60, 0x6B, 0x78, 0xFF, 0xFF, 0x32, 0x40, 0x40, 0x26, + 0xF7, 0x01, 0x2A, 0xF0, 0xFF, 0xFF, 0x64, 0x40, 0x08, 0x2A, 0x2A, 0x00, 0xDB, 0xF3, 0xFF, 0xFF, + 0x07, 0xB4, 0x03, 0xA8, 0xFF, 0xFF, 0x03, 0x03, 0x32, 0x40, 0x02, 0x2A, 0x1D, 0x00, 0x03, 0x67, + 0xA0, 0x84, 0x00, 0x37, 0x64, 0x63, 0x60, 0x40, 0x02, 0x37, 0x5E, 0x63, 0x60, 0x40, 0x01, 0x37, + 0x58, 0x63, 0x60, 0x40, 0x03, 0x37, 0x0D, 0x00, 0xBD, 0xD2, 0x7F, 0xF1, 0xBD, 0xD2, 0xD0, 0x80, + 0x80, 0xF1, 0x07, 0x02, 0xD0, 0x80, 0xBD, 0xD2, 0x81, 0xF1, 0x03, 0x02, 0xD0, 0x80, 0xFF, 0xFF, + 0x03, 0x03, 0xD0, 0x60, 0xB5, 0x78, 0xFF, 0xFF, 0xE9, 0x60, 0x58, 0x4F, 0x08, 0x78, 0xFF, 0xFF, + 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x26, 0x06, 0x00, 0x20, 0x40, 0x10, 0x2B, 0x03, 0x00, + 0xD0, 0x60, 0x6B, 0x78, 0xFF, 0xFF, 0x87, 0xF4, 0xA6, 0xF1, 0x27, 0x1B, 0x31, 0xF2, 0x1D, 0x60, + 0xC0, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, + 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, 0x31, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, + 0x61, 0x46, 0x30, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x2F, 0xF0, + 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, + 0xA6, 0xF3, 0x08, 0xFE, 0x60, 0x43, 0x61, 0x46, 0x03, 0x00, 0xD3, 0x80, 0xFF, 0xFF, 0xD6, 0x03, + 0x43, 0x43, 0xDB, 0xF3, 0x32, 0x40, 0x02, 0x26, 0x04, 0x00, 0x07, 0xB4, 0x03, 0xA8, 0x2A, 0xF2, + 0x45, 0x02, 0xA6, 0xF1, 0x23, 0x43, 0xD3, 0x80, 0xFF, 0xFF, 0x40, 0x02, 0xD0, 0x60, 0x58, 0x4F, + 0xFC, 0x78, 0xFF, 0xFF, 0x32, 0x40, 0x02, 0x2A, 0x05, 0x00, 0x63, 0x46, 0x02, 0x64, 0x06, 0xFA, + 0x26, 0x46, 0x34, 0x00, 0x32, 0x40, 0x08, 0x2A, 0x05, 0x00, 0x63, 0x46, 0x80, 0x60, 0x02, 0x64, + 0x06, 0xFA, 0x26, 0x46, 0x43, 0x43, 0x7D, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x27, 0x09, 0x00, + 0x19, 0x60, 0x44, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, 0x03, 0x00, 0x23, 0x46, 0x0F, 0x64, + 0x10, 0x00, 0x37, 0x60, 0xF8, 0x61, 0xA1, 0xD1, 0xA1, 0xF3, 0x01, 0x60, 0xAC, 0x63, 0x60, 0x45, + 0xA3, 0xD3, 0x65, 0x40, 0x01, 0x27, 0x5B, 0xD3, 0x65, 0x40, 0x01, 0x27, 0x59, 0xD1, 0x23, 0x46, + 0xA0, 0x84, 0x0F, 0xFA, 0x7A, 0xFB, 0x79, 0xFB, 0x16, 0x64, 0x12, 0xFA, 0x01, 0x64, 0x11, 0xFA, + 0x66, 0x5C, 0xC2, 0x60, 0x58, 0x4E, 0x6D, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x07, 0xFC, 0x43, 0x43, + 0x2A, 0xF2, 0x63, 0x45, 0x0C, 0xB4, 0x08, 0x3A, 0x0A, 0x00, 0xDB, 0xF3, 0x23, 0x46, 0x07, 0xB4, + 0xFD, 0xA0, 0x06, 0xF2, 0x26, 0x46, 0x03, 0x03, 0x60, 0x40, 0x02, 0x2A, 0x0D, 0x00, 0x2A, 0xF2, + 0x35, 0xF0, 0x60, 0x40, 0xA4, 0x36, 0x0B, 0x00, 0x08, 0x2B, 0x0C, 0x00, 0x23, 0x46, 0x26, 0xF2, + 0x26, 0x46, 0xD0, 0x80, 0xFF, 0xFF, 0x06, 0x02, 0xD0, 0x60, 0xB5, 0x78, 0xFF, 0xFF, 0xD0, 0x60, + 0x6B, 0x78, 0xFF, 0xFF, 0x23, 0x46, 0x22, 0xF2, 0x26, 0x46, 0x44, 0x4C, 0x0F, 0x26, 0x1D, 0x00, + 0x00, 0xBC, 0x40, 0x45, 0x0B, 0x03, 0x00, 0x64, 0x23, 0x46, 0x22, 0xFA, 0x26, 0x46, 0xA2, 0xFF, + 0xB6, 0x60, 0x58, 0x4E, 0xF5, 0x78, 0xFF, 0xFF, 0xA3, 0xFF, 0x26, 0x46, 0x2A, 0xF0, 0x2C, 0x44, + 0x64, 0x40, 0x04, 0x27, 0x0A, 0x00, 0x23, 0x46, 0x26, 0xFA, 0x26, 0x46, 0x1B, 0xF2, 0xFF, 0xFF, + 0xE4, 0xA4, 0x3E, 0xFA, 0xD0, 0x60, 0x22, 0x78, 0xFF, 0xFF, 0x3F, 0xF2, 0x02, 0xFA, 0xA2, 0xFF, + 0x16, 0xF0, 0xFF, 0xFF, 0x64, 0x44, 0x01, 0x26, 0xDC, 0x9C, 0xB0, 0xF3, 0x2A, 0xF2, 0xDC, 0x83, + 0xB0, 0xFD, 0x06, 0xF4, 0x01, 0xF8, 0x26, 0x46, 0x60, 0x40, 0x40, 0x2B, 0x18, 0x00, 0x64, 0x44, + 0x00, 0x65, 0xFF, 0xB4, 0xFC, 0xA4, 0x06, 0xF0, 0x03, 0x03, 0x64, 0x46, 0x0C, 0x0D, 0x02, 0x65, + 0x26, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, 0x02, 0x03, 0x60, 0x46, 0xF9, 0x01, + 0x01, 0xF2, 0xFF, 0xFF, 0xD4, 0x84, 0x01, 0xFA, 0x66, 0x44, 0x26, 0x46, 0x06, 0xFA, 0x06, 0xF4, + 0x00, 0xF2, 0x80, 0xFC, 0x40, 0x45, 0xB6, 0x60, 0x58, 0x4E, 0xF5, 0x78, 0xFF, 0xFF, 0xA3, 0xFF, + 0x26, 0x46, 0x2C, 0x44, 0x0F, 0x26, 0x13, 0x00, 0x23, 0x46, 0x26, 0xFA, 0x26, 0x44, 0x22, 0xFA, + 0x26, 0x46, 0x1B, 0xF2, 0xFF, 0xFF, 0xE4, 0xA4, 0x3E, 0xFA, 0x00, 0x64, 0x13, 0x60, 0x0D, 0xFB, + 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x6E, 0x00, 0xA3, 0x46, + 0x26, 0xF2, 0x60, 0x45, 0xDC, 0x84, 0xD4, 0x80, 0x26, 0xFA, 0xA3, 0x46, 0x6B, 0x02, 0x2A, 0xF0, + 0xA3, 0x46, 0x22, 0xF2, 0xA3, 0x46, 0x00, 0xBC, 0x00, 0xF2, 0x01, 0x02, 0x63, 0x00, 0x44, 0x4C, + 0x3F, 0xF0, 0x60, 0x43, 0x23, 0x46, 0x22, 0xF4, 0x09, 0x60, 0x00, 0x65, 0x3F, 0xF2, 0x26, 0x46, + 0xC0, 0x84, 0xD4, 0x80, 0x60, 0x45, 0x56, 0x07, 0x80, 0xFC, 0x1B, 0xF2, 0x06, 0xF2, 0x60, 0x41, + 0x23, 0x46, 0x22, 0xF4, 0x1B, 0xF0, 0x06, 0xF0, 0xC1, 0x81, 0x06, 0xFA, 0x05, 0xFA, 0x9B, 0xFA, + 0x65, 0x44, 0x3F, 0xFA, 0x64, 0x46, 0x00, 0xFC, 0x63, 0x46, 0x01, 0xF2, 0x10, 0x61, 0xF2, 0xA4, + 0x01, 0xFA, 0xC8, 0x83, 0x02, 0x64, 0x59, 0xD0, 0x58, 0xD8, 0xFD, 0x1F, 0x06, 0x45, 0x00, 0x64, + 0x13, 0x60, 0x0D, 0xFB, 0x25, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xA2, 0xFF, 0x00, 0xF4, 0x01, 0xF0, 0x0A, 0x18, 0x70, 0x67, 0xA0, 0x80, 0xF0, 0x67, 0x06, 0x03, + 0xC0, 0x84, 0x01, 0xFA, 0x25, 0x46, 0x25, 0x44, 0x80, 0xFC, 0x05, 0xFA, 0xB6, 0x60, 0x58, 0x4E, + 0xF5, 0x78, 0xFF, 0xFF, 0xD4, 0xFE, 0xA3, 0xFF, 0x2C, 0x44, 0x04, 0x27, 0x16, 0x00, 0x23, 0x46, + 0x22, 0xF2, 0xA2, 0xFC, 0x60, 0x46, 0x46, 0x46, 0x3F, 0xF2, 0x00, 0xF4, 0x60, 0x47, 0x08, 0xFA, + 0x26, 0x46, 0x2C, 0x43, 0x2A, 0xFC, 0x06, 0xF4, 0x00, 0x64, 0x00, 0xFA, 0x01, 0xF0, 0x80, 0x60, + 0x00, 0x64, 0xB0, 0x84, 0x01, 0xFA, 0x26, 0x46, 0x1D, 0x00, 0x00, 0x66, 0x46, 0x46, 0xCA, 0x60, + 0xD8, 0x78, 0xFF, 0xFF, 0xA3, 0x46, 0x22, 0xF0, 0xA2, 0xFC, 0x00, 0x63, 0x33, 0x85, 0xA3, 0x46, + 0x0D, 0x03, 0xA3, 0x46, 0x26, 0xF2, 0x0F, 0x65, 0xA4, 0x85, 0xD4, 0x84, 0x26, 0xFA, 0xA3, 0x46, + 0xA2, 0xFF, 0xB6, 0x60, 0x58, 0x4E, 0xF5, 0x78, 0xFF, 0xFF, 0xA3, 0xFF, 0x26, 0x46, 0xD0, 0x60, + 0xB5, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0x32, 0xF0, 0x60, 0x40, 0x08, 0x2A, 0x24, 0x00, 0x01, 0x2B, + 0x13, 0x00, 0x64, 0x40, 0x01, 0x2A, 0x10, 0x00, 0x2C, 0x60, 0xE2, 0x64, 0xF1, 0x60, 0x78, 0x41, + 0xE4, 0x78, 0xB5, 0xF1, 0x1B, 0xF2, 0xFF, 0xFF, 0x60, 0x45, 0x2C, 0x60, 0xE8, 0x64, 0xF1, 0x60, + 0x78, 0x41, 0xF0, 0x78, 0xB5, 0xF1, 0x0F, 0x00, 0x2C, 0x60, 0xE0, 0x64, 0xF1, 0x60, 0x78, 0x41, + 0xE4, 0x78, 0xB5, 0xF1, 0x1B, 0xF2, 0xFF, 0xFF, 0x60, 0x45, 0x2C, 0x60, 0xE6, 0x64, 0xF1, 0x60, + 0x78, 0x41, 0xF0, 0x78, 0xB5, 0xF1, 0x07, 0xF4, 0xFF, 0xFF, 0x26, 0xF2, 0x26, 0x46, 0x0F, 0xB4, + 0xDC, 0x85, 0x2C, 0x60, 0xE4, 0x64, 0xF1, 0x60, 0x78, 0x41, 0xF0, 0x78, 0xB5, 0xF1, 0x27, 0xF2, + 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x3B, 0x07, 0x00, 0x2C, 0x60, 0xF2, 0x64, 0xF1, 0x60, 0x78, 0x41, + 0xE4, 0x78, 0xB5, 0xF1, 0x08, 0x00, 0x02, 0x3B, 0x06, 0x00, 0x2C, 0x60, 0xF4, 0x64, 0xF1, 0x60, + 0x78, 0x41, 0xE4, 0x78, 0xB5, 0xF1, 0x07, 0xF2, 0x26, 0xF0, 0x41, 0x18, 0x60, 0x46, 0xFF, 0x67, + 0x20, 0x88, 0x64, 0x5F, 0x40, 0x4A, 0x15, 0xF0, 0x28, 0x44, 0xD0, 0x84, 0x03, 0xA4, 0x03, 0x0E, + 0xE8, 0x84, 0xE8, 0x84, 0x04, 0x00, 0xFA, 0xA4, 0xE8, 0x84, 0xE8, 0x87, 0xC0, 0xBF, 0xC0, 0x84, + 0x15, 0xFA, 0x40, 0x48, 0x14, 0xF0, 0x2A, 0x44, 0xD0, 0x84, 0x1F, 0xA4, 0x06, 0x0E, 0xE8, 0x84, + 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0x07, 0x00, 0xC2, 0xA4, 0xE8, 0x84, 0xE8, 0x84, + 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x87, 0xF8, 0xBF, 0xC0, 0x84, 0x14, 0xFA, 0x33, 0x60, 0x4C, 0x63, + 0xBD, 0xDB, 0x60, 0x5C, 0x2F, 0x67, 0xD0, 0x80, 0x60, 0x45, 0x02, 0x28, 0x64, 0x45, 0x28, 0x5C, + 0xBD, 0xD9, 0x8B, 0x67, 0xD0, 0x80, 0x60, 0x41, 0x02, 0x24, 0x64, 0x41, 0xD5, 0x84, 0x80, 0x65, + 0xC4, 0x87, 0x01, 0x05, 0x00, 0x64, 0xFF, 0xB4, 0x0E, 0xFA, 0xA3, 0xDB, 0x26, 0x46, 0xD1, 0x60, + 0xDB, 0x78, 0xFF, 0xFF, 0xCA, 0x60, 0xD8, 0x78, 0xFF, 0xFF, 0x26, 0x60, 0x1A, 0x64, 0x40, 0x4B, + 0x34, 0x60, 0x58, 0x4D, 0x08, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0xCA, 0x60, 0xD8, 0x78, + 0xFF, 0xFF, 0x25, 0x60, 0xFE, 0x64, 0x13, 0x60, 0x0D, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xF8, 0xFE, 0x00, 0x66, 0x46, 0x46, 0xCA, 0x60, 0xD8, 0x78, + 0xFF, 0xFF, 0x2A, 0xF2, 0x58, 0x63, 0x60, 0x47, 0x01, 0x27, 0x64, 0x63, 0x61, 0x5C, 0x1B, 0x60, + 0xFB, 0xF9, 0xBD, 0xD0, 0xBD, 0xD0, 0x64, 0x45, 0x64, 0x41, 0xBD, 0xD0, 0x00, 0xF4, 0x04, 0xF8, + 0x83, 0xFA, 0x82, 0xF8, 0xA6, 0x46, 0x02, 0xB0, 0x5E, 0x63, 0x04, 0x03, 0x64, 0x63, 0x03, 0xB0, + 0x02, 0x3A, 0x6C, 0x63, 0x3F, 0xF2, 0xBD, 0xD0, 0xBD, 0xD0, 0x64, 0x45, 0x64, 0x41, 0xBD, 0xD0, + 0xA6, 0x46, 0x07, 0xF8, 0x86, 0xFA, 0x85, 0xF8, 0x60, 0x47, 0x08, 0xFA, 0x1B, 0x60, 0xFB, 0xF1, + 0x26, 0x46, 0x64, 0x41, 0x2F, 0x58, 0xFF, 0xFF, 0xA6, 0xF5, 0x00, 0xF2, 0x26, 0x46, 0x31, 0xF0, + 0x39, 0x18, 0x66, 0x41, 0x1D, 0x60, 0xC0, 0x65, 0x64, 0x47, 0x00, 0x7F, 0xA6, 0xF1, 0xE0, 0x84, + 0x44, 0xD3, 0x64, 0x43, 0x11, 0x18, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xFC, 0x1B, 0x66, 0x44, + 0x64, 0x46, 0x80, 0xF0, 0x60, 0x46, 0x80, 0xF8, 0x65, 0x46, 0x65, 0x43, 0x80, 0xF0, 0x01, 0xFA, + 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x0B, 0x00, 0x64, 0x46, 0x62, 0x43, 0x00, 0xF2, 0xA3, 0xDB, + 0x60, 0x46, 0x80, 0xF0, 0x81, 0xFC, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x60, 0x43, 0x61, 0x46, + 0x1F, 0x60, 0xC2, 0x61, 0xA1, 0xD3, 0x20, 0x60, 0x04, 0x7C, 0xD0, 0x80, 0xFF, 0xFF, 0x07, 0x03, + 0xA0, 0xDD, 0xDA, 0x9C, 0xA1, 0xD9, 0x49, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xA1, 0xDB, 0xD1, 0x60, + 0x97, 0x78, 0xFF, 0xFF, 0x20, 0x7C, 0x72, 0x44, 0xFF, 0xB4, 0xD0, 0x80, 0xFF, 0xFF, 0x02, 0x04, + 0xD0, 0x84, 0xFB, 0x01, 0xE0, 0x83, 0xA6, 0xF3, 0x02, 0xA3, 0x43, 0x93, 0xA6, 0xF3, 0xFF, 0xFF, + 0x02, 0xA5, 0xD7, 0x80, 0x04, 0xA5, 0x08, 0x24, 0x65, 0x43, 0x66, 0x41, 0x63, 0x46, 0x05, 0xF2, + 0x00, 0xF0, 0x81, 0xF0, 0x02, 0x18, 0x64, 0x46, 0x81, 0xF8, 0x07, 0x1B, 0x1D, 0x60, 0xC0, 0x65, + 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD9, 0x02, 0x00, 0x65, 0x46, 0x00, 0xF8, 0xA6, 0xF3, + 0x63, 0x45, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xD4, 0x80, 0x01, 0x18, 0xFA, 0x04, 0x80, 0xF8, + 0x65, 0x46, 0x00, 0xFA, 0x06, 0xF2, 0xFF, 0xFF, 0x00, 0x7E, 0x06, 0xFA, 0x61, 0x46, 0x31, 0xF0, + 0x66, 0x41, 0x1D, 0x60, 0xC0, 0x65, 0x64, 0x47, 0x00, 0x7F, 0xA6, 0xF1, 0xE0, 0x84, 0x44, 0xD3, + 0x64, 0x43, 0x11, 0x18, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xFC, 0x1B, 0x66, 0x44, 0x64, 0x46, + 0x80, 0xF0, 0x60, 0x46, 0x80, 0xF8, 0x65, 0x46, 0x65, 0x43, 0x80, 0xF0, 0x01, 0xFA, 0x80, 0xFC, + 0x64, 0x46, 0x80, 0xF8, 0x0B, 0x00, 0x64, 0x46, 0x62, 0x43, 0x00, 0xF2, 0xA3, 0xDB, 0x60, 0x46, + 0x80, 0xF0, 0x81, 0xFC, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x60, 0x43, 0x61, 0x46, 0x2F, 0xF2, + 0x30, 0xF0, 0x31, 0xF0, 0x64, 0x45, 0x46, 0x43, 0x63, 0x46, 0x03, 0xFA, 0x06, 0xF2, 0x84, 0xF8, + 0x00, 0x7E, 0x06, 0xFA, 0x05, 0xF8, 0xA3, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0xDB, 0xF3, 0x2A, 0xF2, + 0x07, 0xB0, 0x03, 0x3A, 0x2A, 0x00, 0x00, 0xF4, 0x09, 0xF2, 0x60, 0x45, 0x80, 0x3A, 0x05, 0x00, + 0x0E, 0xF2, 0xFF, 0xFF, 0x02, 0xB0, 0x0F, 0xF2, 0x20, 0x03, 0x60, 0x47, 0x00, 0x3A, 0x1D, 0x00, + 0x60, 0x41, 0x00, 0x36, 0x13, 0x00, 0xDA, 0x85, 0x33, 0x60, 0xBE, 0x63, 0xBD, 0xD1, 0xFF, 0xFF, + 0xD1, 0x80, 0xFF, 0xFF, 0x12, 0x02, 0x60, 0xFE, 0xBD, 0xD3, 0xA5, 0xD0, 0xDE, 0x85, 0xD0, 0x80, + 0xCD, 0x81, 0x0B, 0x02, 0xF9, 0x02, 0x20, 0xFE, 0x00, 0x64, 0x09, 0x00, 0x26, 0x46, 0x48, 0xFE, + 0x65, 0x40, 0x40, 0x3A, 0x02, 0x00, 0x01, 0x64, 0x02, 0x00, 0x28, 0xFE, 0x00, 0x64, 0x40, 0x48, + 0x26, 0x46, 0x2D, 0x58, 0xFF, 0xFF, 0x19, 0x60, 0xA3, 0xF3, 0x3D, 0xF2, 0x60, 0x40, 0x01, 0x26, + 0x2A, 0xFA, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x26, 0x03, 0x00, 0xD2, 0x60, 0xB5, 0x78, + 0xFF, 0xFF, 0x3F, 0xF0, 0x32, 0x40, 0x10, 0x2A, 0x0E, 0x00, 0x2C, 0xF0, 0x64, 0x41, 0x60, 0x40, + 0x40, 0x27, 0x09, 0x00, 0xCD, 0x81, 0xDD, 0x81, 0x06, 0x03, 0x05, 0x03, 0x64, 0x40, 0x01, 0x26, + 0x02, 0x00, 0x01, 0x61, 0x01, 0x00, 0x00, 0x61, 0x60, 0x40, 0x18, 0x36, 0x1F, 0x00, 0xD0, 0x60, + 0x58, 0x4F, 0xD1, 0x78, 0xFF, 0xFF, 0x0F, 0xF0, 0xEA, 0xF1, 0x64, 0x44, 0x60, 0x22, 0x19, 0x00, + 0xDB, 0xF3, 0xFF, 0xFF, 0x07, 0xB4, 0xFD, 0xA0, 0x2A, 0xF2, 0x03, 0x02, 0x08, 0xB0, 0xFF, 0xFF, + 0x10, 0x02, 0x32, 0xF2, 0x33, 0xF2, 0xD0, 0x80, 0xEB, 0xF1, 0x0B, 0x02, 0xD0, 0x80, 0x34, 0xF2, + 0x08, 0x02, 0xEC, 0xF1, 0xFF, 0xFF, 0xD0, 0x80, 0x0F, 0xF0, 0x03, 0x02, 0xD3, 0x60, 0x10, 0x78, + 0xFF, 0xFF, 0x00, 0xF4, 0xAA, 0x60, 0xAA, 0x65, 0x09, 0xF2, 0x5A, 0xD0, 0xD4, 0x80, 0x03, 0x64, + 0x57, 0x02, 0xD0, 0x80, 0x00, 0x64, 0x5A, 0xD0, 0x53, 0x02, 0x64, 0x45, 0xD4, 0x80, 0xF8, 0x7F, + 0x08, 0x02, 0x5A, 0xD0, 0x26, 0x46, 0x64, 0x45, 0x23, 0xF0, 0x20, 0x67, 0xB0, 0x84, 0xA2, 0xDA, + 0x0B, 0x00, 0xD4, 0x80, 0x1D, 0x60, 0x60, 0x64, 0x16, 0x02, 0x5A, 0xD0, 0x26, 0x46, 0x64, 0x45, + 0x23, 0xF0, 0x40, 0x67, 0xB0, 0x84, 0xA2, 0xDA, 0x65, 0x44, 0x88, 0x3A, 0x07, 0x00, 0x77, 0x37, + 0x08, 0x00, 0x78, 0x37, 0x06, 0x00, 0x8E, 0x37, 0x04, 0x00, 0x32, 0x00, 0x81, 0x3A, 0x30, 0x00, + 0x80, 0x37, 0x00, 0x61, 0x2D, 0x00, 0xD4, 0x80, 0x01, 0x60, 0x00, 0x64, 0x5A, 0xD0, 0x28, 0x02, + 0xD0, 0x80, 0x5A, 0xD0, 0x25, 0x02, 0x26, 0x46, 0x64, 0x47, 0x7F, 0xB4, 0xFD, 0xA0, 0x09, 0x03, + 0x1F, 0x07, 0x32, 0x40, 0x02, 0x26, 0x44, 0x00, 0x23, 0xF0, 0x60, 0x67, 0xB0, 0x84, 0xA2, 0xDA, + 0x3F, 0x00, 0x0F, 0xF2, 0x32, 0x40, 0x02, 0x26, 0x3B, 0x00, 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, + 0x08, 0x2A, 0x07, 0x00, 0x60, 0x40, 0x48, 0x36, 0x04, 0x00, 0xF1, 0xF3, 0xFF, 0xFF, 0x02, 0xBC, + 0xF1, 0xFB, 0xF4, 0x60, 0x58, 0x4F, 0x1D, 0x78, 0xFF, 0xFF, 0xD3, 0x60, 0x1A, 0x78, 0xFF, 0xFF, + 0x26, 0x46, 0x61, 0x40, 0x01, 0x2A, 0x07, 0x00, 0x2C, 0x60, 0xF8, 0x64, 0xF1, 0x60, 0x78, 0x41, + 0xE4, 0x78, 0xB5, 0xF1, 0x85, 0x00, 0x0F, 0xF2, 0x7F, 0xF1, 0x2A, 0xF2, 0x60, 0x40, 0x20, 0x2A, + 0x12, 0x00, 0x5E, 0x63, 0x60, 0x40, 0x02, 0x2B, 0x64, 0x63, 0xBD, 0xD2, 0xBD, 0xD2, 0xD0, 0x80, + 0x80, 0xF1, 0x08, 0x02, 0xD0, 0x80, 0xA3, 0xD2, 0x81, 0xF1, 0x04, 0x02, 0xD0, 0x80, 0xFF, 0xFF, + 0x01, 0x02, 0x06, 0x00, 0x6D, 0x00, 0x2A, 0xF2, 0xFF, 0xFF, 0xFF, 0xFF, 0x48, 0x36, 0x68, 0x00, + 0x2A, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x2A, 0x07, 0x00, 0x60, 0x40, 0x48, 0x36, 0x04, 0x00, + 0xF1, 0xF3, 0xFF, 0xFF, 0x02, 0xBC, 0xF1, 0xFB, 0x68, 0x00, 0x26, 0x46, 0x2A, 0xF2, 0xFF, 0xFF, + 0xFF, 0xFF, 0x0C, 0x26, 0x55, 0x00, 0xB0, 0x36, 0x15, 0x00, 0x10, 0x36, 0x13, 0x00, 0x30, 0x36, + 0x11, 0x00, 0xC0, 0x36, 0x02, 0x00, 0xA0, 0x3A, 0x12, 0x00, 0x7F, 0xF1, 0x32, 0xF2, 0x33, 0xF2, + 0xD0, 0x80, 0x80, 0xF1, 0x45, 0x02, 0xD0, 0x80, 0x34, 0xF2, 0x81, 0xF1, 0x41, 0x02, 0xD0, 0x80, + 0xFF, 0xFF, 0x3E, 0x02, 0xE6, 0x60, 0x58, 0x4F, 0x3D, 0x78, 0xFF, 0xFF, 0x35, 0x00, 0x50, 0x3A, + 0x05, 0x00, 0xF8, 0x60, 0x58, 0x4F, 0xE1, 0x78, 0xFF, 0xFF, 0x2E, 0x00, 0x40, 0x3A, 0x05, 0x00, + 0xF0, 0x60, 0x58, 0x4F, 0x99, 0x78, 0xFF, 0xFF, 0x27, 0x00, 0x80, 0x3A, 0x24, 0x00, 0x7F, 0xF1, + 0x32, 0xF2, 0x33, 0xF2, 0xD0, 0x80, 0x80, 0xF1, 0x23, 0x02, 0xD0, 0x80, 0x34, 0xF2, 0x81, 0xF1, + 0x1F, 0x02, 0xD0, 0x80, 0xFF, 0xFF, 0x1C, 0x02, 0xE9, 0x60, 0x58, 0x4F, 0x30, 0x78, 0xFF, 0xFF, + 0x7D, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x27, 0x0A, 0x00, 0x19, 0x60, 0x4C, 0xF3, 0xFF, 0xFF, + 0x60, 0x40, 0x08, 0x26, 0x04, 0x00, 0xEE, 0x60, 0x58, 0x4F, 0x81, 0x78, 0xFF, 0xFF, 0x24, 0x60, + 0x58, 0x4F, 0xE3, 0x78, 0xFF, 0xFF, 0x04, 0x00, 0x66, 0x44, 0x00, 0xA8, 0xFF, 0xFF, 0x0A, 0x03, + 0x26, 0x46, 0x26, 0x60, 0x1A, 0x64, 0x40, 0x4B, 0x34, 0x60, 0x58, 0x4D, 0x08, 0x78, 0xFF, 0xFF, + 0x00, 0x66, 0x46, 0x46, 0xD0, 0x60, 0xB2, 0x78, 0xFF, 0xFF, 0x2A, 0xF2, 0x3B, 0xF0, 0x60, 0x40, + 0x40, 0x2B, 0x06, 0x00, 0xC0, 0x60, 0x00, 0x64, 0x64, 0x40, 0x20, 0x2B, 0x01, 0x00, 0x03, 0x00, + 0xD3, 0x60, 0x4C, 0x78, 0xFF, 0xFF, 0x22, 0xF2, 0xFF, 0xFF, 0x04, 0xB4, 0xFF, 0xFF, 0xF8, 0x03, + 0x23, 0xF2, 0x07, 0xF4, 0xBB, 0xF0, 0x26, 0x46, 0xA4, 0x84, 0xFF, 0xFF, 0x60, 0x40, 0x2F, 0x26, + 0xD7, 0x01, 0x12, 0xF0, 0xFF, 0xFF, 0x10, 0x1B, 0xCA, 0x60, 0x58, 0x4F, 0x16, 0x78, 0xFF, 0xFF, + 0x64, 0x40, 0x18, 0x36, 0x09, 0x00, 0x04, 0x65, 0xF1, 0x60, 0x58, 0x4E, 0x96, 0x78, 0xFF, 0xFF, + 0x26, 0x46, 0xD3, 0x60, 0x10, 0x78, 0xFF, 0xFF, 0x25, 0x60, 0xFE, 0x64, 0x13, 0x60, 0x0D, 0xFB, + 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xF8, 0xFE, 0xC0, 0x01, + 0x1C, 0x60, 0x92, 0x63, 0x00, 0x64, 0xA3, 0xDB, 0x06, 0xA3, 0x10, 0x60, 0x94, 0x64, 0xBD, 0xDB, + 0xBD, 0xDB, 0x06, 0x64, 0xA3, 0xDB, 0x00, 0x63, 0x08, 0x60, 0x77, 0xFD, 0xD9, 0x60, 0xA5, 0x64, + 0x08, 0x60, 0x49, 0xFB, 0xD9, 0x60, 0x6A, 0x64, 0x08, 0x60, 0x35, 0xFB, 0x00, 0x60, 0x02, 0x64, + 0x08, 0x60, 0x16, 0xFB, 0xD3, 0x60, 0x9C, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x7D, 0xF3, 0x33, 0x60, 0x20, 0x63, 0x60, 0x40, 0x01, 0x27, 0x03, 0x00, 0x19, 0x60, 0x3B, 0xF3, + 0x02, 0x00, 0x19, 0x60, 0x3C, 0xF3, 0x08, 0x61, 0x60, 0xFE, 0xA3, 0xD1, 0xFF, 0xFF, 0x20, 0xFE, + 0x00, 0xA8, 0xE8, 0x84, 0x0F, 0x03, 0x60, 0xFE, 0x02, 0x28, 0xF6, 0x01, 0x80, 0x62, 0xB2, 0x9C, + 0xBD, 0xD9, 0x7B, 0xF9, 0xCD, 0x81, 0x00, 0x36, 0x01, 0x00, 0xEE, 0x01, 0x36, 0x60, 0x0A, 0x63, + 0x08, 0x61, 0xEA, 0x01, 0x2E, 0x58, 0xFF, 0xFF, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0xBA, 0xFE, 0x16, 0x60, 0x87, 0xF3, 0xFF, 0xFF, 0x03, 0xA8, 0x02, 0xA8, 0x04, 0x03, 0x28, 0x02, + 0xD9, 0x60, 0x41, 0x78, 0xFF, 0xFF, 0xD8, 0x60, 0xD4, 0x78, 0xFF, 0xFF, 0x08, 0x60, 0x15, 0xF1, + 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x11, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xAC, 0xF3, + 0xFF, 0xFF, 0xFE, 0xA0, 0xFF, 0xFF, 0x0A, 0x07, 0x1C, 0x60, 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, + 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0x20, 0x60, 0x20, 0x65, + 0xA5, 0xDF, 0x00, 0x64, 0x08, 0x60, 0x27, 0xFB, 0x5A, 0xDB, 0xD4, 0x60, 0xF6, 0x78, 0xFF, 0xFF, + 0x01, 0x63, 0x0E, 0x60, 0x36, 0xFD, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x00, 0x64, + 0x08, 0x60, 0x15, 0xFB, 0x5A, 0xDB, 0xBA, 0xFE, 0x02, 0x64, 0xDB, 0xFB, 0xF1, 0xF3, 0xFF, 0xFF, + 0x01, 0xBC, 0xF1, 0xFB, 0x44, 0x60, 0x44, 0x64, 0x7F, 0xFB, 0x80, 0xFB, 0x81, 0xFB, 0x08, 0x60, + 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, 0x08, 0x60, 0x77, 0xF3, 0xFF, 0xFF, 0x15, 0x18, 0xA2, 0xDF, + 0x40, 0x60, 0x58, 0x4E, 0x7D, 0x78, 0xFF, 0xFF, 0x1F, 0x60, 0xC4, 0x64, 0x0F, 0x60, 0xE1, 0xFB, + 0x4A, 0xDF, 0x01, 0x60, 0xFE, 0x63, 0x1D, 0x60, 0xBE, 0x61, 0x00, 0x64, 0x59, 0xDB, 0xFE, 0x1F, + 0x10, 0x60, 0x0E, 0x62, 0xA2, 0xDF, 0x5B, 0x00, 0xCF, 0xF3, 0xFF, 0xFF, 0x52, 0x1B, 0x10, 0x60, + 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x24, 0x40, 0x02, 0x22, 0x26, 0x00, 0x08, 0x60, 0x1E, 0xF1, + 0x00, 0x60, 0x20, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x10, 0x60, 0x00, 0x64, 0x08, 0x60, + 0x16, 0xFB, 0xD4, 0x60, 0x1F, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, + 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x08, 0x60, 0x1E, 0xF1, 0x00, 0x60, 0x40, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x10, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD4, 0x60, 0x59, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x24, 0x40, 0x01, 0x26, 0x11, 0x00, 0x08, 0x60, + 0x1E, 0xF1, 0x00, 0x60, 0x20, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x10, 0x60, 0x00, 0x64, + 0x08, 0x60, 0x16, 0xFB, 0xD4, 0x60, 0x59, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x08, 0x60, 0x1E, 0xF1, 0x00, 0x60, 0x40, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x10, 0x60, + 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD4, 0x60, 0x59, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0xFD, 0x60, 0x89, 0x65, 0xF3, 0x60, 0x58, 0x4E, 0x27, 0x78, 0xFF, 0xFF, 0x10, 0x60, + 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x00, 0x64, 0x08, 0x60, 0x15, 0xFB, 0x5A, 0xDB, 0x10, 0x60, + 0x4E, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xF7, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x08, 0x60, + 0x08, 0xF1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0xBB, 0xFE, 0xFD, 0x60, + 0x40, 0x65, 0xF3, 0x60, 0x58, 0x4E, 0x27, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x03, 0x64, 0x08, 0x60, + 0x28, 0xFB, 0xD4, 0x60, 0x87, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, + 0x27, 0xF1, 0x00, 0x60, 0x02, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x07, 0x03, 0xA0, 0x84, 0xA2, 0xDB, + 0x10, 0x60, 0x4E, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xE2, 0x01, 0x10, 0x60, 0x4E, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x00, 0x64, 0x08, 0x60, 0x27, 0xFB, 0x5A, 0xDB, 0x20, 0x40, 0x04, 0x2B, 0x14, 0x00, + 0x9B, 0xFE, 0x08, 0x04, 0xBB, 0xFE, 0x08, 0x60, 0x08, 0xF1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x80, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD4, 0x60, 0x95, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, + 0x16, 0x60, 0xCC, 0xF3, 0x00, 0x61, 0x60, 0x40, 0x00, 0x36, 0x00, 0xB9, 0x60, 0x40, 0x01, 0x36, + 0x01, 0xB9, 0x60, 0x40, 0x02, 0x36, 0x06, 0xB9, 0x60, 0x40, 0x03, 0x36, 0x07, 0xB9, 0x41, 0x44, + 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0A, 0x04, 0x40, 0x60, 0x00, 0x64, + 0x08, 0x60, 0x16, 0xFB, 0xD4, 0x60, 0xC8, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x7D, 0xF1, 0x13, 0x60, 0x1A, 0xF9, 0x0C, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x20, 0x60, + 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD4, 0x60, 0xE9, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xBE, 0xFE, 0x08, 0x60, 0x08, 0xF1, + 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x75, 0x00, 0x10, 0x60, 0x2A, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0xBA, 0xFE, 0x02, 0x64, 0xDB, 0xFB, 0xF1, 0xF3, 0xFF, 0xFF, 0x01, 0xBC, + 0xF1, 0xFB, 0x44, 0x60, 0x44, 0x64, 0x7F, 0xFB, 0x80, 0xFB, 0x81, 0xFB, 0xFF, 0xFF, 0x20, 0x40, + 0x04, 0x2B, 0x14, 0x00, 0x9B, 0xFE, 0x08, 0x04, 0xBB, 0xFE, 0x08, 0x60, 0x08, 0xF1, 0x80, 0x60, + 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x80, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, + 0xD5, 0x60, 0x07, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x00, 0x65, + 0x20, 0x44, 0x34, 0x80, 0x08, 0x60, 0x07, 0xF1, 0x02, 0x60, 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, + 0x64, 0x40, 0x01, 0x2A, 0x06, 0x00, 0xA2, 0xDF, 0x02, 0x65, 0xF1, 0x60, 0x58, 0x4E, 0xC3, 0x78, + 0xFF, 0xFF, 0xCF, 0xF3, 0x20, 0x60, 0x20, 0x65, 0x36, 0x1B, 0xA5, 0xD3, 0x24, 0x40, 0x01, 0x26, + 0x16, 0x00, 0x60, 0x40, 0x20, 0x26, 0x2F, 0x00, 0x01, 0xBC, 0xA5, 0xDB, 0x08, 0x60, 0x1E, 0xF1, + 0x00, 0x60, 0x20, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x10, 0x60, 0x00, 0x64, 0x08, 0x60, + 0x16, 0xFB, 0xD5, 0x60, 0x65, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x60, 0x40, + 0x10, 0x26, 0x19, 0x00, 0x01, 0xBC, 0xA5, 0xDB, 0x08, 0x60, 0x1E, 0xF1, 0x00, 0x60, 0x40, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x10, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD5, 0x60, + 0x65, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xFD, 0x60, 0x89, 0x65, 0xF3, 0x60, + 0x58, 0x4E, 0x27, 0x78, 0xFF, 0xFF, 0xCF, 0xF1, 0x07, 0x60, 0xE9, 0xF3, 0x64, 0x40, 0x02, 0x3A, + 0x0C, 0x00, 0x01, 0x63, 0x60, 0x40, 0x10, 0x22, 0x00, 0x63, 0x08, 0x60, 0xC1, 0xFD, 0x08, 0x60, + 0xC5, 0xFD, 0x08, 0x60, 0xC9, 0xFD, 0x08, 0x60, 0xCD, 0xFD, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x01, 0x64, 0x53, 0xFB, 0x2F, 0x60, 0x02, 0x64, 0x54, 0xFB, 0x24, 0x40, 0x01, 0x26, + 0x11, 0x00, 0x08, 0x60, 0x12, 0xF1, 0x00, 0x60, 0x10, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x10, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD5, 0x60, 0xAB, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x12, 0xF1, 0x00, 0x60, 0x20, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0x10, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD5, 0x60, 0xAB, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xFD, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x08, 0x60, + 0x08, 0xF1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x10, 0x60, 0x2A, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x86, 0xF1, 0x1B, 0x60, 0xB2, 0x63, 0xD3, 0x80, 0x20, 0x44, 0x03, 0x03, + 0xD8, 0x60, 0xD0, 0x78, 0xFF, 0xFF, 0x87, 0xF3, 0xFF, 0xFF, 0xD0, 0x80, 0xFF, 0xFF, 0x1B, 0x02, + 0x24, 0x44, 0x04, 0x22, 0x12, 0x00, 0x24, 0x44, 0x01, 0xAC, 0xFB, 0xB4, 0x40, 0x44, 0xF7, 0x60, + 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x08, 0x60, 0x08, 0xF1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0xD4, 0x60, 0xF6, 0x78, 0xFF, 0xFF, 0xD2, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, + 0xFF, 0xFF, 0x1F, 0x02, 0x87, 0x00, 0x20, 0x44, 0x10, 0xBC, 0x40, 0x40, 0x64, 0x42, 0x5A, 0xD1, + 0x06, 0x63, 0xA4, 0xD1, 0xC3, 0x83, 0x7D, 0xF9, 0xBD, 0xD1, 0x7F, 0xF9, 0xBD, 0xD1, 0xFF, 0xFF, + 0x80, 0xF9, 0xBD, 0xD1, 0x81, 0xF9, 0x04, 0xA3, 0xBD, 0xD1, 0x33, 0x60, 0xBE, 0x64, 0x64, 0x41, + 0xDD, 0x81, 0xFE, 0xB1, 0xA0, 0xD9, 0x04, 0x03, 0xBD, 0xD1, 0xC9, 0x81, 0x58, 0xD9, 0xFC, 0x02, + 0x39, 0x00, 0xE4, 0xF3, 0x7D, 0xFB, 0x66, 0x41, 0x60, 0x40, 0x01, 0x27, 0x06, 0x00, 0x10, 0x60, + 0xF0, 0x63, 0x11, 0x60, 0x44, 0x65, 0x06, 0x66, 0x05, 0x00, 0x11, 0x60, 0x60, 0x63, 0x12, 0x60, + 0x40, 0x65, 0x08, 0x66, 0xA3, 0xD1, 0x4B, 0x93, 0xD0, 0x80, 0xD7, 0x80, 0x02, 0x03, 0xFA, 0x04, + 0x04, 0x00, 0x5B, 0x93, 0x02, 0xA3, 0x01, 0x64, 0xA3, 0xDB, 0x61, 0x46, 0x2F, 0x60, 0x02, 0x61, + 0xA1, 0xD3, 0xFF, 0xFF, 0x00, 0xA8, 0x33, 0x60, 0xBE, 0x63, 0x02, 0x02, 0x2D, 0x60, 0x10, 0x61, + 0xA1, 0xD3, 0xBD, 0xDB, 0xDC, 0x84, 0xFE, 0xB4, 0x59, 0xD1, 0xC8, 0x84, 0xBD, 0xD9, 0xFC, 0x02, + 0xEC, 0xF3, 0x72, 0x45, 0xEB, 0xF3, 0x94, 0x83, 0x81, 0xFD, 0x94, 0x83, 0x80, 0xFD, 0x65, 0x5F, + 0x02, 0x64, 0x7F, 0xFB, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0A, 0x04, + 0x40, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD6, 0x60, 0x3A, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x7D, 0xF1, 0x13, 0x60, 0x1A, 0xF9, 0x0E, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x2D, 0xFF, 0x20, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD6, 0x60, 0x5B, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xBE, 0xFE, + 0x08, 0x60, 0x08, 0xF1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0xD7, 0x60, + 0x7B, 0x78, 0xFF, 0xFF, 0xFF, 0x60, 0xEF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x02, 0x64, 0xDB, 0xFB, + 0xF1, 0xF3, 0xFF, 0xFF, 0x01, 0xBC, 0xF1, 0xFB, 0xF7, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, + 0x08, 0x60, 0x08, 0xF1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x10, 0x60, + 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x24, 0x44, 0x02, 0x22, 0x03, 0x00, 0x01, 0xAC, 0x04, 0xBC, + 0x40, 0x44, 0x32, 0x40, 0x80, 0x2A, 0x8C, 0x00, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0xDE, 0xFE, 0x0A, 0x04, 0x40, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD6, 0x60, 0x8C, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x95, 0xF3, 0xFF, 0xFF, 0x7F, 0xB4, 0x95, 0xFB, 0x26, 0x60, 0x34, 0x62, 0x06, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x2D, 0xFF, 0xFF, 0xFF, 0xBE, 0xFE, 0x08, 0x60, 0x08, 0xF1, 0x40, 0x60, 0x00, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0xDA, 0xFE, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x12, 0x60, 0xFF, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x05, 0x03, 0x0E, 0xF2, 0xFF, 0xFF, + 0x60, 0x40, 0x01, 0x2A, 0x22, 0x00, 0x13, 0x60, 0x02, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, + 0x03, 0x03, 0x0F, 0xF2, 0xFF, 0xFF, 0x19, 0x1B, 0x08, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, + 0xD6, 0x60, 0xE5, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x01, 0x64, 0x19, 0x60, 0xF1, 0xFB, 0x19, 0x60, + 0xF6, 0xF1, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x26, 0x05, 0x00, 0x89, 0xFF, 0x08, 0x60, 0x00, 0x75, + 0x88, 0xFF, 0x01, 0x00, 0x10, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0xDE, 0xFE, 0x0A, 0x04, 0x40, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD6, 0x60, + 0xE5, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x7D, 0xF1, 0x13, 0x60, 0x1A, 0xF9, 0x08, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, + 0x20, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD7, 0x60, 0x0A, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0xBE, 0xFE, 0x08, 0x60, 0x08, 0xF1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0xBA, 0xFE, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x1E, 0x00, + 0xDA, 0xFE, 0xC1, 0xFE, 0x0E, 0x60, 0x36, 0xF1, 0x0E, 0x60, 0x4B, 0xF9, 0x1C, 0x60, 0x92, 0x64, + 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x00, 0x60, 0x06, 0x64, + 0x08, 0x60, 0x16, 0xFB, 0xD7, 0x60, 0x4E, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x00, 0x60, 0x02, 0x64, + 0x08, 0x60, 0x28, 0xFB, 0xD7, 0x60, 0x55, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x1C, 0x60, 0x6C, 0x61, + 0x75, 0x60, 0x30, 0x65, 0xA1, 0xD3, 0xFF, 0xFF, 0xFF, 0xA0, 0xE0, 0x84, 0x02, 0x02, 0x03, 0x60, + 0xE8, 0x64, 0xD4, 0x80, 0xFF, 0xFF, 0x01, 0x04, 0x65, 0x44, 0xA1, 0xDB, 0x32, 0x40, 0x80, 0x2A, + 0x03, 0x00, 0xD4, 0x60, 0xF6, 0x78, 0xFF, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x64, 0x08, 0x60, + 0x27, 0xFB, 0x5A, 0xDB, 0xD4, 0x60, 0xF6, 0x78, 0xFF, 0xFF, 0x20, 0x40, 0x06, 0x23, 0x10, 0x00, + 0x08, 0x60, 0x27, 0xF1, 0x7F, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x80, 0x60, 0x00, 0x64, + 0x08, 0x60, 0x28, 0xFB, 0xD7, 0x60, 0x55, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x10, 0x60, 0x4E, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x00, 0x64, 0x08, 0x60, 0x27, 0xFB, 0x5A, 0xDB, + 0x1C, 0x60, 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, + 0xD3, 0x60, 0xD0, 0x78, 0xFF, 0xFF, 0x78, 0xF3, 0x79, 0xFB, 0x20, 0x60, 0x14, 0x62, 0xA2, 0xDF, + 0xFF, 0x60, 0xDF, 0x65, 0x20, 0x44, 0x24, 0x80, 0xBC, 0xF1, 0x0E, 0x60, 0x4B, 0xF9, 0x1C, 0x60, + 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0xF7, 0x60, + 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x10, 0x26, 0x38, 0x00, 0x00, 0x64, 0xB2, 0xFB, 0xB3, 0xFB, + 0xB4, 0xFB, 0x00, 0x75, 0x00, 0x72, 0xBA, 0xF1, 0x7E, 0xF9, 0x64, 0x44, 0xE0, 0x84, 0xE0, 0x84, + 0xE0, 0x84, 0xE0, 0x93, 0xE5, 0xF1, 0x84, 0xF9, 0x7D, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x27, + 0x1E, 0x00, 0x19, 0x60, 0x44, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2A, 0x0A, 0x00, 0x0F, 0x64, + 0xFC, 0x60, 0x58, 0x4E, 0x34, 0x78, 0xFF, 0xFF, 0x67, 0x43, 0x1A, 0x60, 0xB3, 0xFD, 0x1A, 0x60, + 0xC3, 0xFD, 0xD3, 0x60, 0x58, 0x4E, 0x78, 0x78, 0xFF, 0xFF, 0x00, 0x65, 0xFC, 0x60, 0x58, 0x4E, + 0xC7, 0x78, 0xFF, 0xFF, 0xFD, 0x60, 0x58, 0x4E, 0x11, 0x78, 0xFF, 0xFF, 0x05, 0x00, 0xFF, 0x65, + 0xFC, 0x60, 0x58, 0x4E, 0xC7, 0x78, 0xFF, 0xFF, 0x44, 0x00, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x00, 0x60, 0x84, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD7, 0x60, 0xDB, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x15, 0xF1, 0x00, 0x60, 0x80, 0x64, 0xA0, 0x80, + 0x9C, 0x84, 0x2B, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x08, 0x60, 0x15, 0xF1, 0xFF, 0x60, 0x7F, 0x61, + 0xA1, 0x84, 0x5A, 0xD1, 0x4A, 0xDB, 0xA1, 0x84, 0x5A, 0xDB, 0x2E, 0x60, 0x2E, 0x64, 0x2D, 0x60, + 0x8A, 0x63, 0xA0, 0xD1, 0xA3, 0xD9, 0x64, 0x41, 0x58, 0xD1, 0x5B, 0xD9, 0x7D, 0xF3, 0x66, 0x45, + 0xA6, 0xF5, 0x60, 0x40, 0x01, 0x27, 0x08, 0x00, 0x91, 0xFA, 0x61, 0x44, 0xFD, 0x60, 0x58, 0x4E, + 0xAC, 0x78, 0xFF, 0xFF, 0x12, 0xFA, 0x07, 0x00, 0x11, 0xF8, 0x64, 0x44, 0xFD, 0x60, 0x58, 0x4E, + 0xAC, 0x78, 0xFF, 0xFF, 0x12, 0xFA, 0x65, 0x46, 0x04, 0x00, 0xBB, 0xFE, 0xD4, 0x60, 0xF6, 0x78, + 0xFF, 0xFF, 0x16, 0x60, 0xC2, 0xF1, 0x00, 0x65, 0x64, 0x40, 0x01, 0x36, 0x22, 0x65, 0x64, 0x40, + 0x07, 0x36, 0x01, 0x65, 0x64, 0x40, 0x0A, 0x36, 0x01, 0x65, 0x64, 0x40, 0x0B, 0x36, 0x22, 0x65, + 0xA6, 0xF3, 0x66, 0x5C, 0x60, 0x46, 0x1F, 0x63, 0xE3, 0x83, 0xBA, 0xF8, 0x02, 0xA6, 0x66, 0x44, + 0xFC, 0x1F, 0x16, 0x60, 0xC2, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x07, 0x36, 0x03, 0x00, 0x0A, 0x36, + 0x06, 0x00, 0x09, 0x00, 0xA6, 0xF3, 0x04, 0x65, 0x60, 0x46, 0xBA, 0xF8, 0x04, 0x00, 0xA6, 0xF3, + 0x10, 0x65, 0x60, 0x46, 0xBA, 0xF8, 0x64, 0x46, 0xA6, 0xF3, 0x32, 0x41, 0x60, 0x45, 0x08, 0xB1, + 0x66, 0x41, 0x16, 0x03, 0x65, 0x46, 0x17, 0x60, 0x80, 0xF3, 0x06, 0xF0, 0xE0, 0x84, 0xE0, 0x84, + 0xE0, 0x84, 0xE0, 0x84, 0x80, 0xBF, 0xB0, 0x84, 0x06, 0xFA, 0x66, 0x43, 0x02, 0xA3, 0x63, 0x46, + 0x06, 0xF0, 0xFF, 0xFF, 0xB0, 0x84, 0x06, 0xFA, 0x61, 0x46, 0x32, 0x44, 0x10, 0xBC, 0x40, 0x52, + 0x01, 0x64, 0x10, 0x60, 0x0A, 0xFB, 0x0F, 0x4E, 0xEF, 0x60, 0x58, 0x4F, 0x3A, 0x78, 0xFF, 0xFF, + 0x0E, 0x4F, 0x08, 0x60, 0x15, 0xF1, 0xFF, 0x60, 0xFB, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x00, 0x60, + 0x04, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD3, 0x60, 0xAE, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x1C, 0x60, + 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0xBB, 0xFE, + 0x20, 0x44, 0x04, 0x27, 0x11, 0x00, 0x10, 0x26, 0x02, 0x00, 0xDB, 0xFE, 0x14, 0x00, 0x08, 0x60, + 0x07, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x36, 0x07, 0x00, 0x01, 0x64, 0xA2, 0xDB, 0x01, 0x65, + 0xF1, 0x60, 0x58, 0x4E, 0xC3, 0x78, 0xFF, 0xFF, 0x08, 0x60, 0x08, 0xF1, 0x80, 0x60, 0x00, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x01, 0x64, 0x8A, 0xFB, 0xFF, 0x60, 0xEF, 0x65, 0x20, 0x44, + 0x24, 0x80, 0x03, 0x64, 0xDB, 0xFB, 0xF1, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, 0xF1, 0xFB, 0xC1, 0xFE, + 0x00, 0x60, 0x02, 0x64, 0x08, 0x60, 0x28, 0xFB, 0xD8, 0x60, 0xAA, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x20, 0x40, 0x06, 0x23, 0x10, 0x00, 0x08, 0x60, 0x27, 0xF1, 0x7F, 0x60, + 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x80, 0x60, 0x00, 0x64, 0x08, 0x60, 0x28, 0xFB, 0xD8, 0x60, + 0xAA, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, 0x4E, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x00, 0x64, 0x08, 0x60, 0x27, 0xFB, 0x5A, 0xDB, 0x1C, 0x60, 0x92, 0x64, 0x13, 0x60, + 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0xD3, 0x60, 0xD0, 0x78, 0xFF, 0xFF, + 0xBB, 0xFE, 0xD9, 0x60, 0xB0, 0x78, 0xFF, 0xFF, 0x16, 0x60, 0xC2, 0xF1, 0x00, 0x65, 0x64, 0x40, + 0x01, 0x36, 0x22, 0x65, 0xA6, 0xF3, 0x66, 0x5C, 0x60, 0x46, 0x1F, 0x63, 0xE3, 0x83, 0xBA, 0xF8, + 0x02, 0xA6, 0x66, 0x44, 0xFC, 0x1F, 0x64, 0x46, 0xA6, 0xF1, 0x02, 0x64, 0xC0, 0x85, 0x0C, 0x61, + 0x32, 0x40, 0x08, 0x2A, 0x14, 0x00, 0x17, 0x60, 0x80, 0xF3, 0x66, 0x41, 0x65, 0x46, 0x06, 0xF0, + 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0x80, 0xBF, 0xB0, 0x83, 0x06, 0xFC, 0x66, 0x42, + 0xFE, 0xA2, 0x62, 0x46, 0x06, 0xF0, 0xFF, 0xFF, 0xB0, 0x84, 0x06, 0xFA, 0x61, 0x46, 0x0B, 0x64, + 0xDB, 0xFB, 0xF1, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, 0xF1, 0xFB, 0x01, 0x65, 0xF1, 0x60, 0x58, 0x4E, + 0xC3, 0x78, 0xFF, 0xFF, 0xE4, 0xF1, 0x7D, 0xF9, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0xDE, 0xFE, 0x0A, 0x04, 0x40, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD9, 0x60, 0x0C, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x7D, 0xF1, 0x13, 0x60, 0x1A, 0xF9, 0x0E, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x20, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD9, 0x60, + 0x2D, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x64, 0x08, 0x60, 0x15, 0xFB, + 0x5A, 0xDB, 0xBE, 0xFE, 0x08, 0x60, 0x08, 0xF1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0x01, 0x64, 0x8A, 0xFB, 0xFF, 0x60, 0xDF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x2F, 0x58, + 0xFF, 0xFF, 0x06, 0x64, 0xDB, 0xFB, 0xF1, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, 0xF1, 0xFB, 0xE4, 0xF1, + 0x7D, 0xF9, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x01, 0x64, 0x8A, 0xFB, 0xFF, 0x60, + 0xDF, 0x65, 0x20, 0x44, 0x24, 0x80, 0xA6, 0xF1, 0x66, 0x45, 0x64, 0x46, 0x66, 0x43, 0x02, 0xA3, + 0x63, 0x46, 0x02, 0x64, 0x06, 0xFA, 0x04, 0x63, 0x04, 0x61, 0x01, 0x60, 0xCC, 0x64, 0x58, 0xD1, + 0x59, 0xD8, 0xFD, 0x1F, 0x65, 0x46, 0x01, 0x65, 0xF1, 0x60, 0x58, 0x4E, 0xC3, 0x78, 0xFF, 0xFF, + 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x64, 0x67, 0xFB, 0x68, 0xFB, 0xA6, 0xF1, 0x0E, 0x64, 0x66, 0x41, + 0x64, 0x42, 0x02, 0xA2, 0x62, 0x46, 0x06, 0xF0, 0xFF, 0x60, 0xFC, 0x64, 0xA0, 0x84, 0x06, 0xFA, + 0x61, 0x46, 0xDB, 0xF3, 0xFF, 0xFF, 0x04, 0xA8, 0x10, 0x60, 0x0E, 0x64, 0x07, 0x03, 0xA0, 0xD1, + 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x2A, 0x02, 0x00, 0x00, 0x63, 0xA0, 0xDD, 0x01, 0x64, 0xDB, 0xFB, + 0xF1, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, 0xF1, 0xFB, 0x00, 0x63, 0x08, 0x60, 0x77, 0xFD, 0x10, 0x60, + 0x4E, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x00, 0x64, 0x08, 0x60, 0x27, 0xFB, 0x5A, 0xDB, 0x10, 0x60, + 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x00, 0x60, 0x02, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD3, 0x60, + 0x9C, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x15, 0xF1, 0x00, 0x60, + 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x2E, 0x58, 0xFF, 0xFF, + 0x40, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0xB9, 0xF1, 0x0E, 0x60, 0x4B, 0xF9, 0x5F, 0xF5, 0xEA, 0xF1, + 0x2F, 0xF8, 0xEB, 0xF1, 0x30, 0xF8, 0xEC, 0xF1, 0x31, 0xF8, 0xB9, 0xF1, 0x19, 0xF8, 0xF8, 0x60, + 0x80, 0x64, 0x0E, 0xFA, 0x00, 0x64, 0x3E, 0xFA, 0xA6, 0xF1, 0x07, 0xF8, 0x1B, 0x60, 0xB0, 0x64, + 0x00, 0x60, 0x67, 0xFB, 0x44, 0x60, 0x44, 0x64, 0x7F, 0xFB, 0x80, 0xFB, 0x81, 0xFB, 0x31, 0x44, + 0xF9, 0xB4, 0x40, 0x51, 0x00, 0x60, 0xCE, 0x63, 0x01, 0x60, 0x0C, 0x65, 0xA3, 0xD3, 0xA5, 0xD1, + 0x04, 0xA4, 0xA3, 0xDB, 0xD0, 0x80, 0xA0, 0xD1, 0x0A, 0x06, 0x41, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xD6, 0x60, 0x6A, 0x78, 0xFF, 0xFF, 0x44, 0x47, + 0x16, 0x60, 0xC2, 0xF3, 0xFF, 0xFF, 0xFF, 0xA4, 0xFF, 0xFF, 0x09, 0x07, 0x0E, 0x61, 0x41, 0xD3, + 0x32, 0x40, 0x08, 0x26, 0x04, 0x00, 0x10, 0xB0, 0xFF, 0xFF, 0x01, 0x03, 0xD3, 0x01, 0x42, 0x64, + 0x3B, 0x42, 0x5A, 0xDB, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0A, 0x04, + 0x40, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xD9, 0x60, 0xFA, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x27, 0xD1, 0x7D, 0xF9, 0x13, 0x60, 0x1A, 0xF9, 0x0E, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x2D, 0xFF, 0x20, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xDA, 0x60, 0x1C, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0xBE, 0xFE, 0x08, 0x60, 0x08, 0xF1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x07, 0x60, 0xD0, 0x64, 0x0E, 0x60, 0x4B, 0xFB, 0x1C, 0x60, 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, + 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x27, 0x43, 0x06, 0xA3, 0xBD, 0xD3, 0x7F, 0xFB, + 0xBD, 0xD3, 0x80, 0xFB, 0xA3, 0xD3, 0x81, 0xFB, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x01, 0x60, 0x04, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xDA, 0x60, 0x4A, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0xB9, 0xF1, 0x0E, 0x60, 0x4B, 0xF9, 0x08, 0x60, 0x15, 0xF1, 0xFE, 0x60, + 0xFF, 0x61, 0xA1, 0x84, 0x5A, 0xD1, 0x4A, 0xDB, 0xA1, 0x84, 0x5A, 0xDB, 0x08, 0x60, 0x15, 0xF1, + 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xD9, 0x60, + 0xCA, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x08, 0x65, 0x20, 0x44, 0x34, 0x80, 0x7D, 0xF1, 0x32, 0x60, + 0x7A, 0x61, 0xA1, 0xD3, 0x64, 0x40, 0x01, 0x27, 0x59, 0xD3, 0x32, 0x60, 0x7E, 0x61, 0xFD, 0x60, + 0x58, 0x4E, 0xAC, 0x78, 0xFF, 0xFF, 0xA1, 0xDB, 0x5E, 0xF5, 0xEA, 0xF1, 0x2F, 0xF8, 0xEB, 0xF1, + 0x30, 0xF8, 0xEC, 0xF1, 0x31, 0xF8, 0xB9, 0xF1, 0x19, 0xF8, 0x80, 0x7E, 0xF8, 0x7F, 0x0E, 0xFA, + 0x00, 0x64, 0x3E, 0xFA, 0xA6, 0xF1, 0x07, 0xF8, 0x2B, 0xFA, 0xB0, 0x64, 0x2A, 0xFA, 0x27, 0x43, + 0x06, 0xA3, 0xBD, 0xD1, 0x2C, 0xF8, 0x32, 0xF8, 0xBD, 0xD1, 0x2D, 0xF8, 0x33, 0xF8, 0xA3, 0xD1, + 0x2E, 0xF8, 0x34, 0xF8, 0x06, 0x63, 0x3F, 0xFC, 0x20, 0x60, 0x16, 0x61, 0xDB, 0xF3, 0xA1, 0xD3, + 0x03, 0xA8, 0xAC, 0x83, 0x0E, 0x02, 0x0D, 0x03, 0x20, 0x60, 0x18, 0x61, 0xA1, 0xD1, 0x66, 0x45, + 0x00, 0xF4, 0x09, 0xFC, 0x01, 0x64, 0x0A, 0xFA, 0x0B, 0xF8, 0x20, 0x60, 0x16, 0x61, 0xA1, 0xDF, + 0x25, 0x00, 0x16, 0x60, 0xC3, 0xF3, 0x66, 0x45, 0x00, 0xF4, 0x60, 0x40, 0x01, 0x36, 0x15, 0x00, + 0x02, 0x36, 0xBD, 0x00, 0x03, 0x36, 0x07, 0x00, 0x04, 0x36, 0x0F, 0x00, 0x05, 0x36, 0xB7, 0x00, + 0x06, 0x36, 0x01, 0x00, 0x0A, 0x00, 0x80, 0x64, 0x09, 0xFA, 0x01, 0x63, 0x0A, 0xFC, 0x00, 0x64, + 0x0B, 0xFA, 0x80, 0x60, 0xF4, 0x62, 0xA2, 0xDF, 0x09, 0x00, 0x00, 0x64, 0x09, 0xFA, 0x01, 0x63, + 0x0A, 0xFC, 0x00, 0x64, 0x0B, 0xFA, 0x80, 0x60, 0xF4, 0x62, 0xA2, 0xDF, 0x25, 0x60, 0xCE, 0x64, + 0x13, 0x60, 0x0D, 0xFB, 0x65, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0x00, 0x66, 0xDB, 0xF3, 0x46, 0x46, 0xFD, 0xA0, 0xC1, 0xFE, 0x02, 0x02, 0x2F, 0x58, 0xFF, 0xFF, + 0x01, 0x64, 0x68, 0xFB, 0x43, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x0E, 0x60, 0x38, 0xF3, 0xFF, 0xFF, + 0x64, 0xA4, 0xA2, 0xDB, 0x0E, 0x60, 0x38, 0xF1, 0x0E, 0x60, 0x4B, 0xF9, 0x1C, 0x60, 0x92, 0x64, + 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x00, 0x60, 0x0C, 0x64, + 0x08, 0x60, 0x16, 0xFB, 0xDB, 0x60, 0x00, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x08, 0x60, 0x15, 0xF1, 0x00, 0x60, 0x08, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x55, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0x1C, 0x60, 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0x00, 0x64, 0x68, 0xFB, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x26, 0x46, + 0x00, 0xF4, 0x09, 0xF2, 0x0A, 0xF2, 0x00, 0xA8, 0x0B, 0xF2, 0x02, 0xA8, 0x16, 0x02, 0x00, 0xA8, + 0x1A, 0x02, 0x19, 0x02, 0x26, 0x46, 0x26, 0x60, 0x1A, 0x64, 0x40, 0x4B, 0x34, 0x60, 0x58, 0x4D, + 0x08, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0x20, 0x40, 0x08, 0x2A, 0x03, 0x00, 0xDC, 0x60, + 0xF6, 0x78, 0xFF, 0xFF, 0xE3, 0x60, 0x69, 0x78, 0xFF, 0xFF, 0x09, 0xF2, 0x0A, 0xF2, 0x80, 0xA8, + 0x0B, 0xF2, 0x02, 0xA8, 0xE4, 0x03, 0x44, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x0B, 0xF2, 0x26, 0x46, + 0x40, 0x59, 0x02, 0x60, 0x00, 0x61, 0x2F, 0xF2, 0xA1, 0xDB, 0x30, 0xF2, 0x41, 0x58, 0x59, 0xDB, + 0x31, 0xF2, 0x59, 0xDB, 0x26, 0x46, 0x26, 0x60, 0x1A, 0x64, 0x40, 0x4B, 0x34, 0x60, 0x58, 0x4D, + 0x08, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0x03, 0x65, 0xF1, 0x60, 0x58, 0x4E, 0x96, 0x78, + 0xFF, 0xFF, 0xE7, 0x60, 0x0B, 0x78, 0xFF, 0xFF, 0xFF, 0x60, 0xFB, 0x64, 0xA0, 0x84, 0xA2, 0xDB, + 0x00, 0x64, 0x68, 0xFB, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x20, 0x40, 0x08, 0x2A, + 0x03, 0x00, 0xD9, 0x60, 0xCA, 0x78, 0xFF, 0xFF, 0xE2, 0x60, 0x73, 0x78, 0xFF, 0xFF, 0x01, 0x63, + 0x09, 0xFC, 0x32, 0x40, 0x08, 0x26, 0x14, 0x00, 0x16, 0x60, 0xC2, 0xF3, 0xFF, 0xFF, 0x60, 0x40, + 0x0B, 0x36, 0x03, 0x00, 0xDA, 0x60, 0xC5, 0x78, 0xFF, 0xFF, 0x01, 0x64, 0xA2, 0xDB, 0x0B, 0x64, + 0x19, 0x60, 0xA4, 0xFB, 0xA6, 0xF1, 0x66, 0x41, 0x64, 0x46, 0x22, 0x64, 0x3A, 0xFA, 0x61, 0x46, + 0x01, 0x64, 0x0A, 0xFA, 0x00, 0x64, 0x0B, 0xFA, 0x01, 0x64, 0x40, 0x60, 0x7A, 0xFB, 0x01, 0x64, + 0x68, 0xFB, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x25, 0x60, 0xCE, 0x64, 0x13, 0x60, + 0x0D, 0xFB, 0x65, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x00, 0x66, + 0xDB, 0xF3, 0x46, 0x46, 0xFD, 0xA0, 0xC1, 0xFE, 0x02, 0x02, 0x2F, 0x58, 0xFF, 0xFF, 0x1C, 0x60, + 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x00, 0x60, + 0x0C, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xDB, 0x60, 0xB9, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x08, 0x60, 0x15, 0xF1, 0x00, 0x60, 0x08, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x3A, 0x03, + 0xA0, 0x84, 0xA2, 0xDB, 0x1C, 0x60, 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x04, 0xFF, 0x00, 0x64, 0x68, 0xFB, 0x26, 0x46, 0x00, 0xF4, 0x09, 0xF2, 0x0A, 0xF2, + 0x01, 0xA8, 0x0B, 0xF2, 0x02, 0xA8, 0x04, 0x02, 0x00, 0xA8, 0x02, 0x02, 0x01, 0x02, 0x31, 0x00, + 0xDC, 0x60, 0x58, 0x4D, 0xB9, 0x78, 0xFF, 0xFF, 0x0B, 0xF2, 0x26, 0x46, 0x40, 0x59, 0x02, 0x60, + 0x00, 0x61, 0x2F, 0xF2, 0xA1, 0xDB, 0x30, 0xF2, 0x41, 0x58, 0x59, 0xDB, 0x31, 0xF2, 0x59, 0xDB, + 0x26, 0x46, 0x26, 0x60, 0x1A, 0x64, 0x40, 0x4B, 0x34, 0x60, 0x58, 0x4D, 0x08, 0x78, 0xFF, 0xFF, + 0x00, 0x66, 0x46, 0x46, 0x03, 0x65, 0xF1, 0x60, 0x58, 0x4E, 0x96, 0x78, 0xFF, 0xFF, 0xE7, 0x60, + 0x0B, 0x78, 0xFF, 0xFF, 0xDC, 0x60, 0x58, 0x4D, 0xB9, 0x78, 0xFF, 0xFF, 0x00, 0x64, 0x68, 0xFB, + 0x20, 0x40, 0x08, 0x2A, 0x03, 0x00, 0xD9, 0x60, 0xCA, 0x78, 0xFF, 0xFF, 0xE2, 0x60, 0x73, 0x78, + 0xFF, 0xFF, 0x26, 0x46, 0x40, 0x60, 0x00, 0x65, 0x2A, 0xF2, 0x2F, 0xF0, 0xB4, 0x84, 0x2A, 0xFA, + 0x2C, 0xF8, 0x32, 0xF8, 0x30, 0xF2, 0x2D, 0xFA, 0x33, 0xFA, 0x31, 0xF2, 0x2E, 0xFA, 0x34, 0xFA, + 0xEA, 0xF3, 0x2F, 0xFA, 0xEB, 0xF3, 0x30, 0xFA, 0xEC, 0xF3, 0x31, 0xFA, 0xC9, 0xF1, 0x19, 0xF8, + 0x1C, 0xF0, 0x13, 0xF8, 0x00, 0x64, 0x3E, 0xFA, 0x00, 0xF4, 0x03, 0x64, 0x0A, 0xFA, 0x00, 0x64, + 0x0B, 0xFA, 0x01, 0x63, 0x68, 0xFD, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x25, 0x60, + 0xCE, 0x64, 0x13, 0x60, 0x0D, 0xFB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0x00, 0x66, 0xDB, 0xF3, 0x46, 0x46, 0xFD, 0xA0, 0xC1, 0xFE, 0x02, 0x02, 0x2F, 0x58, + 0xFF, 0xFF, 0x1C, 0x60, 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0x00, 0x60, 0x0C, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xDC, 0x60, 0x53, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x15, 0xF1, 0x00, 0x60, 0x08, 0x64, 0xA0, 0x80, + 0x9C, 0x84, 0x50, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x1C, 0x60, 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, + 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x00, 0x64, 0x68, 0xFB, 0x26, 0x46, 0x00, 0xF4, + 0x09, 0xF2, 0x0A, 0xF2, 0x01, 0xA8, 0x0B, 0xF2, 0x04, 0xA8, 0x1A, 0x02, 0x00, 0xA8, 0x18, 0x02, + 0x17, 0x02, 0xDC, 0x60, 0x58, 0x4D, 0xB9, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x26, 0x60, 0x1A, 0x64, + 0x40, 0x4B, 0x34, 0x60, 0x58, 0x4D, 0x08, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0x20, 0x40, + 0x08, 0x2A, 0x03, 0x00, 0xDC, 0x60, 0xF6, 0x78, 0xFF, 0xFF, 0xE3, 0x60, 0x69, 0x78, 0xFF, 0xFF, + 0xDC, 0x60, 0x58, 0x4D, 0xB9, 0x78, 0xFF, 0xFF, 0x0B, 0xF2, 0x26, 0x46, 0x40, 0x59, 0x02, 0x60, + 0x00, 0x61, 0x2F, 0xF2, 0xA1, 0xDB, 0x30, 0xF2, 0x41, 0x58, 0x59, 0xDB, 0x31, 0xF2, 0x59, 0xDB, + 0x26, 0x46, 0x26, 0x60, 0x1A, 0x64, 0x40, 0x4B, 0x34, 0x60, 0x58, 0x4D, 0x08, 0x78, 0xFF, 0xFF, + 0x00, 0x66, 0x46, 0x46, 0x03, 0x65, 0xF1, 0x60, 0x58, 0x4E, 0x96, 0x78, 0xFF, 0xFF, 0xE7, 0x60, + 0x0B, 0x78, 0xFF, 0xFF, 0xDC, 0x60, 0x58, 0x4D, 0xB9, 0x78, 0xFF, 0xFF, 0x00, 0x64, 0x68, 0xFB, + 0x20, 0x40, 0x08, 0x2A, 0x03, 0x00, 0xD9, 0x60, 0xCA, 0x78, 0xFF, 0xFF, 0xE2, 0x60, 0x73, 0x78, + 0xFF, 0xFF, 0x19, 0x60, 0xA4, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x0B, 0x3A, 0x06, 0x00, 0x0B, 0x64, + 0x16, 0x60, 0xC2, 0xFB, 0x33, 0x60, 0x48, 0x62, 0xA2, 0xDF, 0x2D, 0x58, 0xFF, 0xFF, 0x16, 0x60, + 0xC2, 0xF1, 0xA5, 0xD2, 0x64, 0x40, 0x0B, 0x2A, 0x20, 0x00, 0x85, 0x36, 0x0B, 0x00, 0x32, 0x3A, + 0x1E, 0x00, 0x60, 0x47, 0xFF, 0xB4, 0x02, 0xA4, 0xC4, 0x85, 0xA5, 0xD2, 0xFF, 0xFF, 0x60, 0x40, + 0x85, 0x3A, 0x15, 0x00, 0x65, 0x44, 0x0A, 0xA4, 0xA0, 0xD0, 0x33, 0x60, 0x46, 0x62, 0x64, 0x40, + 0x18, 0x26, 0x09, 0x00, 0xA2, 0xDF, 0x01, 0x64, 0x16, 0x60, 0xC2, 0xFB, 0x32, 0x41, 0x08, 0x65, + 0xB5, 0x81, 0x41, 0x52, 0x02, 0x00, 0x01, 0x64, 0xA2, 0xDB, 0x2D, 0x58, 0xFF, 0xFF, 0x33, 0x60, + 0x46, 0x62, 0xA2, 0xDF, 0x01, 0x64, 0x16, 0x60, 0xC2, 0xFB, 0xF7, 0x01, 0x45, 0x64, 0x3B, 0x42, + 0x5A, 0xDB, 0x35, 0x60, 0xAA, 0x7C, 0x35, 0x60, 0x98, 0x63, 0xA3, 0xD9, 0x64, 0x41, 0x2F, 0x60, + 0x02, 0x63, 0xBD, 0xD3, 0x00, 0x7C, 0x03, 0x1B, 0x27, 0x43, 0x10, 0xA3, 0xBD, 0xD3, 0xFF, 0xFF, + 0x60, 0x45, 0x64, 0x5F, 0xA1, 0xDB, 0x65, 0x44, 0xBD, 0xD1, 0xC8, 0x84, 0x59, 0xD8, 0xFC, 0x05, + 0x27, 0x41, 0x10, 0xA1, 0xA1, 0xD1, 0xFF, 0xFF, 0xC1, 0x81, 0x01, 0x26, 0xDD, 0x81, 0x41, 0x4C, + 0x59, 0xD1, 0x7C, 0x44, 0xB0, 0x84, 0x59, 0xD1, 0x59, 0xD1, 0xB0, 0x84, 0xB0, 0x84, 0xFF, 0xFF, + 0x02, 0x02, 0x67, 0x44, 0xC2, 0x00, 0x34, 0x60, 0x5C, 0x63, 0xD9, 0x81, 0x59, 0xD3, 0x38, 0x60, + 0x10, 0x62, 0x00, 0xBC, 0xA2, 0xDF, 0x09, 0x03, 0x01, 0x7C, 0xA2, 0xD9, 0x30, 0x60, 0x14, 0x64, + 0xBD, 0xDA, 0x00, 0x60, 0x01, 0x64, 0xBD, 0xDA, 0x58, 0x00, 0xDD, 0x60, 0x18, 0x64, 0xBD, 0xDA, + 0x50, 0x60, 0x00, 0x64, 0xBD, 0xDA, 0x01, 0x60, 0xF2, 0x64, 0xBD, 0xDA, 0x00, 0x60, 0x01, 0x64, + 0xBD, 0xDA, 0x2C, 0x41, 0x59, 0xD3, 0x50, 0x60, 0x00, 0x7C, 0x60, 0x40, 0x02, 0x2A, 0x03, 0x00, + 0x01, 0x60, 0xF2, 0x64, 0x0E, 0x00, 0x04, 0x2A, 0x03, 0x00, 0x02, 0x60, 0xF2, 0x64, 0x09, 0x00, + 0x10, 0x2A, 0x03, 0x00, 0x04, 0x60, 0xF2, 0x64, 0x04, 0x00, 0x20, 0x2A, 0x04, 0x00, 0x05, 0x60, + 0xF2, 0x64, 0xBD, 0xD9, 0xBD, 0xDB, 0x01, 0x64, 0xBD, 0xDB, 0x59, 0xD3, 0x50, 0x60, 0x00, 0x7C, + 0x60, 0x40, 0x02, 0x2A, 0x03, 0x00, 0x01, 0x60, 0xF2, 0x64, 0x0E, 0x00, 0x04, 0x2A, 0x03, 0x00, + 0x02, 0x60, 0xF2, 0x64, 0x09, 0x00, 0x10, 0x2A, 0x03, 0x00, 0x04, 0x60, 0xF2, 0x64, 0x04, 0x00, + 0x20, 0x2A, 0x04, 0x00, 0x05, 0x60, 0xF2, 0x64, 0xBD, 0xD9, 0xBD, 0xDB, 0x01, 0x64, 0xBD, 0xDB, + 0x59, 0xD3, 0x50, 0x60, 0x00, 0x7C, 0x60, 0x40, 0x01, 0x2A, 0x03, 0x00, 0x00, 0x60, 0xF2, 0x64, + 0x09, 0x00, 0x02, 0x2A, 0x03, 0x00, 0x01, 0x60, 0xF2, 0x64, 0x04, 0x00, 0x04, 0x2A, 0x02, 0x00, + 0x02, 0x60, 0xF2, 0x64, 0xBD, 0xD9, 0xBD, 0xDB, 0x4B, 0x00, 0x2C, 0x41, 0x59, 0xD3, 0x0F, 0x60, + 0x00, 0x7C, 0x60, 0x40, 0x02, 0x2A, 0x03, 0x00, 0x01, 0x60, 0xAC, 0x64, 0x0E, 0x00, 0x04, 0x2A, + 0x03, 0x00, 0x02, 0x60, 0xAC, 0x64, 0x09, 0x00, 0x10, 0x2A, 0x03, 0x00, 0x04, 0x60, 0xAC, 0x64, + 0x04, 0x00, 0x20, 0x2A, 0x04, 0x00, 0x05, 0x60, 0xAC, 0x64, 0xBD, 0xD9, 0xBD, 0xDB, 0x01, 0x64, + 0xBD, 0xDB, 0x59, 0xD3, 0x0F, 0x60, 0x00, 0x7C, 0x60, 0x40, 0x02, 0x2A, 0x03, 0x00, 0x01, 0x60, + 0xAC, 0x64, 0x0E, 0x00, 0x04, 0x2A, 0x03, 0x00, 0x02, 0x60, 0xAC, 0x64, 0x09, 0x00, 0x10, 0x2A, + 0x03, 0x00, 0x04, 0x60, 0xAC, 0x64, 0x04, 0x00, 0x20, 0x2A, 0x04, 0x00, 0x05, 0x60, 0xAC, 0x64, + 0xBD, 0xD9, 0xBD, 0xDB, 0x01, 0x64, 0xBD, 0xDB, 0x59, 0xD3, 0x0F, 0x60, 0x00, 0x7C, 0x60, 0x40, + 0x01, 0x2A, 0x03, 0x00, 0x00, 0x60, 0xAC, 0x64, 0x09, 0x00, 0x02, 0x2A, 0x03, 0x00, 0x01, 0x60, + 0xAC, 0x64, 0x04, 0x00, 0x04, 0x2A, 0x02, 0x00, 0x02, 0x60, 0xAC, 0x64, 0xBD, 0xD9, 0xBD, 0xDB, + 0x1C, 0x60, 0x08, 0xF3, 0xFF, 0xFF, 0x03, 0x18, 0x1A, 0x60, 0x2D, 0xF3, 0x03, 0x00, 0x1A, 0x60, + 0x1D, 0xF3, 0xFF, 0xFF, 0xBD, 0xDA, 0x34, 0x60, 0x5C, 0x64, 0x1A, 0x60, 0xCF, 0xFB, 0x5F, 0xF5, + 0x00, 0x64, 0x2B, 0xFA, 0x00, 0x64, 0x2A, 0xFA, 0x27, 0x43, 0x06, 0xA3, 0xBD, 0xD1, 0x2C, 0xF8, + 0x32, 0xF8, 0xBD, 0xD1, 0x2D, 0xF8, 0x33, 0xF8, 0xA3, 0xD1, 0x2E, 0xF8, 0x34, 0xF8, 0x00, 0xF4, + 0x01, 0x63, 0x32, 0x40, 0x08, 0x26, 0x10, 0xBB, 0x16, 0x60, 0xC2, 0xF1, 0xFF, 0xFF, 0x64, 0x40, + 0xFE, 0x26, 0x10, 0xBB, 0x7D, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x27, 0x0A, 0x00, 0x19, 0x60, + 0x45, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x02, 0x22, 0x20, 0xBB, 0x63, 0x44, 0xFF, 0xFF, 0x04, 0x7F, + 0x60, 0x43, 0x09, 0xFC, 0x27, 0x42, 0x0C, 0xA2, 0x2D, 0x60, 0x5A, 0x63, 0xA2, 0xD3, 0xA3, 0xD3, + 0x00, 0xBD, 0x01, 0x63, 0xAC, 0x81, 0x09, 0x03, 0x08, 0x03, 0xB8, 0x60, 0x58, 0x4D, 0x15, 0x78, + 0xFF, 0xFF, 0x00, 0xB8, 0x01, 0x63, 0x01, 0x03, 0x60, 0x43, 0x0E, 0x60, 0x35, 0xFD, 0x12, 0x61, + 0x59, 0xDC, 0x16, 0x60, 0xC2, 0xF3, 0xFF, 0x60, 0xFF, 0x7C, 0x60, 0x40, 0x0B, 0x2A, 0x02, 0x00, + 0x33, 0x60, 0x28, 0x7C, 0x1A, 0x60, 0xD0, 0xF9, 0x35, 0x60, 0x98, 0x64, 0x40, 0x48, 0xD9, 0x81, + 0xFF, 0x60, 0xF2, 0x64, 0xF1, 0x60, 0x58, 0x4D, 0x34, 0x78, 0xFF, 0xFF, 0x5F, 0xF5, 0x3F, 0xFC, + 0xDB, 0x83, 0x1A, 0x60, 0x4C, 0xFD, 0x00, 0x7C, 0x5A, 0xD9, 0x63, 0x41, 0x34, 0x60, 0x9C, 0x63, + 0x12, 0x65, 0x00, 0xF4, 0xCD, 0x84, 0x4C, 0x91, 0x60, 0x43, 0x60, 0xFE, 0xA5, 0xD2, 0xDE, 0x85, + 0x7F, 0x26, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0x5D, 0x93, 0xA3, 0xDB, 0x5D, 0x93, 0xA5, 0xD2, + 0xF6, 0x1F, 0x5D, 0x93, 0x20, 0xFE, 0xDF, 0x83, 0x5F, 0xF5, 0x25, 0x60, 0xCE, 0x64, 0x13, 0x60, + 0x0D, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x00, 0x66, + 0x46, 0x46, 0xC1, 0xFE, 0x06, 0x64, 0x68, 0xFB, 0x46, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x1C, 0x60, + 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x00, 0x60, + 0x1C, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xDE, 0x60, 0x84, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0xDE, 0x60, 0xCA, 0x78, 0xFF, 0xFF, 0x08, 0x60, 0x15, 0xF1, 0x00, 0x60, 0x08, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0xF6, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x1C, 0x60, 0x92, 0x64, 0x13, 0x60, + 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x26, 0x46, 0x00, 0xF4, 0x0A, 0xF2, 0x00, 0x63, 0x00, 0xA8, 0x68, 0xFD, 0x06, 0x02, + 0x09, 0xF2, 0xFF, 0xFF, 0x01, 0xB0, 0x01, 0x7C, 0x5A, 0x02, 0x0A, 0xF8, 0x0A, 0xF2, 0x26, 0x46, + 0x40, 0x59, 0x02, 0x60, 0x00, 0x61, 0x2F, 0xF2, 0xA1, 0xDB, 0x30, 0xF2, 0x41, 0x58, 0x59, 0xDB, + 0x31, 0xF2, 0x59, 0xDB, 0x26, 0x46, 0x26, 0x60, 0x1A, 0x64, 0x40, 0x4B, 0x34, 0x60, 0x58, 0x4D, + 0x08, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0x05, 0x65, 0xF1, 0x60, 0x58, 0x4E, 0x96, 0x78, + 0xFF, 0xFF, 0xE7, 0x60, 0x0B, 0x78, 0xFF, 0xFF, 0x47, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0xD9, 0x60, + 0xCA, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x10, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x20, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0x1C, 0x60, 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0x26, 0x46, 0x26, 0x60, 0x1A, 0x64, 0x40, 0x4B, 0x34, 0x60, 0x58, 0x4D, 0x08, 0x78, + 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0x00, 0x64, 0x68, 0xFB, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x49, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0xDA, 0x60, 0x62, 0x78, 0xFF, 0xFF, 0xFF, 0x60, + 0xFB, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x00, 0x64, 0x68, 0xFB, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x4A, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0xD9, 0x60, 0xCA, 0x78, 0xFF, 0xFF, 0x48, 0x64, + 0x3B, 0x42, 0x5A, 0xDB, 0x0C, 0xF2, 0xFF, 0xFF, 0x60, 0x41, 0xFF, 0xB1, 0xFF, 0xA1, 0x60, 0x47, + 0xFF, 0xB4, 0x9B, 0x02, 0x9A, 0x03, 0x34, 0x60, 0xF4, 0x63, 0x10, 0x64, 0xBD, 0xDB, 0x66, 0x45, + 0x26, 0x46, 0x3F, 0xF2, 0x34, 0x60, 0xF2, 0x61, 0xC2, 0xA0, 0xFF, 0xFF, 0x01, 0x04, 0x3E, 0x64, + 0x65, 0x46, 0x02, 0xA4, 0xA1, 0xDB, 0xC8, 0x81, 0x12, 0x65, 0xCD, 0x84, 0x4C, 0x91, 0x60, 0x43, + 0x60, 0xFE, 0xA5, 0xD2, 0xDE, 0x85, 0x7F, 0x26, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0x5D, 0x93, + 0xA3, 0xDB, 0x5D, 0x93, 0xA5, 0xD2, 0xF6, 0x1F, 0x5D, 0x93, 0x20, 0xFE, 0xDF, 0x83, 0x0C, 0xF2, + 0xFF, 0xFF, 0x1A, 0x65, 0x60, 0x47, 0xFF, 0xB4, 0xC4, 0x85, 0xDC, 0x60, 0x58, 0x4D, 0xC7, 0x78, + 0xFF, 0xFF, 0x0B, 0xF2, 0xFF, 0xFF, 0x07, 0xB4, 0x01, 0x61, 0x03, 0x03, 0xCC, 0x84, 0xE1, 0x81, + 0xFD, 0x02, 0x61, 0x44, 0x94, 0xFB, 0x27, 0x45, 0x02, 0x62, 0x46, 0xD3, 0x5A, 0xD1, 0x60, 0x47, + 0x56, 0xFB, 0x64, 0x47, 0x55, 0xFB, 0x00, 0x64, 0x5B, 0xFB, 0x0C, 0x62, 0x46, 0xD3, 0x7E, 0xFB, + 0x0B, 0xF0, 0x0F, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0x83, 0xFB, 0x26, 0x46, 0x32, 0xF0, 0x7F, 0xF9, + 0x33, 0xF0, 0x0E, 0x63, 0xC7, 0x81, 0x80, 0xF9, 0x34, 0xF0, 0x81, 0xF9, 0x59, 0xD1, 0xFF, 0xFF, + 0x64, 0x44, 0x01, 0x2A, 0xC8, 0x84, 0x60, 0x43, 0x33, 0x60, 0xBC, 0x64, 0x58, 0xD9, 0x59, 0xD1, + 0x58, 0xD9, 0xFD, 0x1F, 0x16, 0x60, 0xC2, 0xF1, 0x59, 0xD3, 0x64, 0x40, 0x01, 0x36, 0x22, 0x64, + 0x64, 0x40, 0x00, 0x36, 0x50, 0x94, 0xA6, 0xF1, 0xFF, 0xFF, 0x44, 0x47, 0xA7, 0x46, 0x3A, 0xFA, + 0xBB, 0xFC, 0xA7, 0x46, 0x0E, 0x60, 0x35, 0xF3, 0x85, 0xFB, 0x2E, 0x60, 0x2E, 0x64, 0x2D, 0x60, + 0x8A, 0x63, 0xA0, 0xD1, 0xA3, 0xD9, 0x64, 0x41, 0x58, 0xD1, 0x5B, 0xD9, 0x7D, 0xF3, 0x66, 0x45, + 0xA6, 0xF5, 0x60, 0x40, 0x01, 0x27, 0x08, 0x00, 0x91, 0xFA, 0x61, 0x44, 0xFD, 0x60, 0x58, 0x4E, + 0xAC, 0x78, 0xFF, 0xFF, 0x12, 0xFA, 0x07, 0x00, 0x11, 0xF8, 0x64, 0x44, 0xFD, 0x60, 0x58, 0x4E, + 0xAC, 0x78, 0xFF, 0xFF, 0x12, 0xFA, 0x65, 0x46, 0x31, 0xF2, 0x1D, 0x60, 0xC0, 0x65, 0x60, 0x47, + 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, + 0x61, 0x46, 0x31, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x30, 0xF0, + 0x63, 0x46, 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x2F, 0xF0, 0x63, 0x46, 0xD0, 0x80, + 0xFF, 0xFF, 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0xA6, 0xF3, 0x08, 0xFE, + 0x60, 0x43, 0x61, 0x46, 0xA6, 0xF1, 0xFF, 0xFF, 0xD3, 0x80, 0x31, 0xF2, 0x27, 0x02, 0x66, 0x41, + 0x1D, 0x60, 0xC0, 0x65, 0x60, 0x47, 0x00, 0x7F, 0xA6, 0xF1, 0xE0, 0x84, 0x44, 0xD3, 0x64, 0x43, + 0x11, 0x18, 0x60, 0x46, 0x00, 0xF2, 0xFF, 0xFF, 0xFC, 0x1B, 0x66, 0x44, 0x64, 0x46, 0x80, 0xF0, + 0x60, 0x46, 0x80, 0xF8, 0x65, 0x46, 0x65, 0x43, 0x80, 0xF0, 0x01, 0xFA, 0x80, 0xFC, 0x64, 0x46, + 0x80, 0xF8, 0x0B, 0x00, 0x64, 0x46, 0x62, 0x43, 0x00, 0xF2, 0xA3, 0xDB, 0x60, 0x46, 0x80, 0xF0, + 0x81, 0xFC, 0x80, 0xFC, 0x64, 0x46, 0x80, 0xF8, 0x60, 0x43, 0x61, 0x46, 0x43, 0x4B, 0x01, 0x65, + 0xFD, 0x60, 0x58, 0x4E, 0xDD, 0x78, 0xFF, 0xFF, 0x43, 0x47, 0x3F, 0xF2, 0x00, 0xF4, 0x60, 0x43, + 0xFA, 0xA3, 0x00, 0x60, 0x17, 0x61, 0x00, 0x60, 0x01, 0x65, 0x01, 0x60, 0xFF, 0x64, 0x40, 0x4C, + 0xFD, 0x60, 0x58, 0x4E, 0x7A, 0x78, 0xFF, 0xFF, 0x00, 0xBB, 0xFF, 0xFF, 0x00, 0x02, 0x00, 0x64, + 0x40, 0x4A, 0x60, 0xFE, 0x02, 0x60, 0x00, 0x63, 0xBD, 0xD3, 0xBD, 0xD3, 0x60, 0x41, 0xFE, 0x60, + 0x58, 0x4E, 0x2C, 0x78, 0xFF, 0xFF, 0x20, 0xFE, 0x00, 0x65, 0x00, 0x64, 0x19, 0x60, 0x3B, 0xFB, + 0x02, 0x00, 0x20, 0xFE, 0xFF, 0x65, 0x02, 0x60, 0x00, 0x63, 0x60, 0xFE, 0xBD, 0xD3, 0xBD, 0xD3, + 0x60, 0x41, 0x20, 0xFE, 0xCD, 0x81, 0x60, 0x40, 0x80, 0x2A, 0x39, 0x00, 0x7F, 0xB4, 0x02, 0x3A, + 0x02, 0x00, 0x01, 0x64, 0x2E, 0x00, 0x04, 0x3A, 0x02, 0x00, 0x02, 0x64, 0x2A, 0x00, 0x0B, 0x3A, + 0x02, 0x00, 0x04, 0x64, 0x26, 0x00, 0x16, 0x3A, 0x02, 0x00, 0x08, 0x64, 0x22, 0x00, 0x0C, 0x3A, + 0x02, 0x00, 0x10, 0x64, 0x1E, 0x00, 0x12, 0x3A, 0x02, 0x00, 0x20, 0x64, 0x1A, 0x00, 0x18, 0x3A, + 0x02, 0x00, 0x40, 0x64, 0x16, 0x00, 0x24, 0x3A, 0x02, 0x00, 0x80, 0x64, 0x12, 0x00, 0x30, 0x3A, + 0x02, 0x00, 0x01, 0x67, 0x0E, 0x00, 0x48, 0x3A, 0x02, 0x00, 0x02, 0x67, 0x0A, 0x00, 0x60, 0x3A, + 0x02, 0x00, 0x04, 0x67, 0x06, 0x00, 0x6C, 0x3A, 0x02, 0x00, 0x08, 0x67, 0x02, 0x00, 0x00, 0x64, + 0x00, 0x00, 0x19, 0x60, 0x3B, 0xF1, 0xFF, 0xFF, 0xB0, 0x84, 0x19, 0x60, 0x3B, 0xFB, 0x61, 0x40, + 0x00, 0x36, 0x05, 0x00, 0x60, 0xFE, 0xBD, 0xD3, 0xFF, 0xFF, 0x20, 0xFE, 0xBB, 0x01, 0x65, 0x40, + 0x00, 0x3A, 0x1E, 0x00, 0x26, 0x46, 0x3F, 0xF2, 0x00, 0xF4, 0x60, 0x43, 0xFA, 0xA3, 0x00, 0x60, + 0x17, 0x61, 0x00, 0x60, 0x32, 0x65, 0x01, 0x60, 0xFF, 0x64, 0x40, 0x4C, 0xFD, 0x60, 0x58, 0x4E, + 0x7A, 0x78, 0xFF, 0xFF, 0x00, 0xBB, 0xFF, 0xFF, 0x0B, 0x03, 0x60, 0xFE, 0x02, 0x60, 0x00, 0x63, + 0xBD, 0xD3, 0xBD, 0xD3, 0x60, 0x41, 0xFE, 0x60, 0x58, 0x4E, 0x2C, 0x78, 0xFF, 0xFF, 0x91, 0x01, + 0x20, 0xFE, 0x00, 0x65, 0xFC, 0x60, 0x58, 0x4E, 0xC7, 0x78, 0xFF, 0xFF, 0xA1, 0xF3, 0xFF, 0xFF, + 0x60, 0x40, 0x01, 0x27, 0x04, 0x00, 0xFD, 0x60, 0x58, 0x4E, 0x11, 0x78, 0xFF, 0xFF, 0x20, 0xFE, + 0x37, 0x60, 0xF8, 0x61, 0xA1, 0xD1, 0xA1, 0xF3, 0x01, 0x60, 0xAC, 0x63, 0x60, 0x45, 0x2A, 0x44, + 0x79, 0xFB, 0xA3, 0xD5, 0x65, 0x40, 0x01, 0x27, 0x5B, 0xD5, 0x65, 0x40, 0x01, 0x27, 0x59, 0xD1, + 0x66, 0x41, 0xA0, 0x84, 0x24, 0x94, 0x2B, 0x46, 0x0F, 0xFA, 0x7A, 0xFB, 0x16, 0x64, 0x12, 0xFA, + 0x01, 0x64, 0x11, 0xFA, 0x66, 0x5C, 0xC2, 0x60, 0x58, 0x4E, 0x6D, 0x78, 0xFF, 0xFF, 0x1A, 0x60, + 0x22, 0xF3, 0x1A, 0x60, 0x21, 0xF1, 0x60, 0x47, 0xB0, 0x84, 0x1C, 0x60, 0x08, 0xF1, 0xFF, 0xFF, + 0x01, 0x18, 0x80, 0xBC, 0x16, 0x60, 0xC2, 0xF1, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x36, 0x22, 0x64, + 0x64, 0x40, 0x00, 0x36, 0x50, 0x94, 0xA7, 0x46, 0x3A, 0xFA, 0xBB, 0xFC, 0xA7, 0x46, 0x80, 0x60, + 0x03, 0x65, 0x32, 0x40, 0x08, 0x2A, 0x03, 0x65, 0xA7, 0x46, 0x06, 0xF0, 0x7F, 0x60, 0xFF, 0x64, + 0xA0, 0x84, 0xB4, 0x84, 0x06, 0xFA, 0xBB, 0xFC, 0xA7, 0x46, 0x26, 0x46, 0x2F, 0xF0, 0x30, 0xF0, + 0x64, 0x43, 0x31, 0xF2, 0x27, 0x46, 0x03, 0xFC, 0x04, 0xF8, 0x05, 0xFA, 0x26, 0x46, 0xD9, 0x60, + 0x58, 0x4E, 0xAE, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x26, 0x60, 0x1A, 0x64, 0x40, 0x4B, 0x34, 0x60, + 0x58, 0x4D, 0x08, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0x01, 0x64, 0x8A, 0xFB, 0x16, 0x60, + 0xC9, 0xF3, 0x20, 0x41, 0x00, 0xBC, 0x20, 0xB9, 0x01, 0x03, 0x41, 0x40, 0x20, 0x60, 0x14, 0x61, + 0xA1, 0xDF, 0x04, 0x64, 0xC1, 0xFE, 0xDB, 0xFB, 0xF1, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, 0xF1, 0xFB, + 0xF7, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x08, 0x60, 0x08, 0xF1, 0x80, 0x60, 0x00, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x01, 0x65, 0xF1, 0x60, 0x58, 0x4E, 0xC3, 0x78, 0xFF, 0xFF, + 0x33, 0x60, 0xE6, 0x65, 0xA5, 0xDF, 0x08, 0x60, 0x0C, 0xF1, 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x0C, 0x64, 0x68, 0xFB, 0x00, 0x60, 0x31, 0x64, 0x08, 0x60, 0x16, 0xFB, + 0xE1, 0x60, 0x36, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x00, 0x60, 0x02, 0x64, 0x08, 0x60, 0x28, 0xFB, + 0xE1, 0x60, 0xF7, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x64, 0x08, 0x60, + 0x27, 0xFB, 0x5A, 0xDB, 0x08, 0x60, 0x15, 0xF1, 0x00, 0x60, 0x01, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x0F, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x1B, 0x60, 0xFE, 0xF3, 0xFF, 0xFF, 0x03, 0x1B, 0xE7, 0x60, + 0x2E, 0x78, 0xFF, 0xFF, 0xE7, 0x60, 0x2E, 0x78, 0xFF, 0xFF, 0xE1, 0x60, 0xE7, 0x78, 0xFF, 0xFF, + 0x00, 0x60, 0x10, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0xF8, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xA6, 0xF3, + 0xFF, 0xFF, 0x02, 0xA4, 0x60, 0x43, 0x66, 0x41, 0x63, 0x46, 0x05, 0xF2, 0x00, 0xF0, 0x81, 0xF0, + 0x02, 0x18, 0x64, 0x46, 0x81, 0xF8, 0x07, 0x1B, 0x1D, 0x60, 0xC0, 0x65, 0x60, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD9, 0x02, 0x00, 0x65, 0x46, 0x00, 0xF8, 0xA6, 0xF3, 0x63, 0x45, 0x60, 0x46, + 0x00, 0xF2, 0xFF, 0xFF, 0xD4, 0x80, 0x01, 0x18, 0xFA, 0x04, 0x80, 0xF8, 0x65, 0x46, 0x00, 0xFA, + 0x06, 0xF2, 0xFF, 0xFF, 0x00, 0x7E, 0x06, 0xFA, 0x61, 0x46, 0x4B, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x00, 0x60, 0x95, 0xF3, 0xFF, 0xFF, 0x10, 0xB0, + 0xFF, 0xFF, 0x11, 0x03, 0x04, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xE1, 0x60, 0x9B, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x08, 0x60, 0x1B, 0xF1, 0x01, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x69, 0xF3, 0xFF, 0xFF, 0x01, 0xB0, 0xFF, 0xFF, 0x11, 0x03, + 0x08, 0x60, 0x0C, 0xF1, 0x00, 0x60, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x02, 0x60, + 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xE1, 0x60, 0xB1, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x00, 0x64, 0x68, 0xFB, 0xE2, 0x60, + 0x58, 0x4E, 0x13, 0x78, 0xFF, 0xFF, 0x02, 0x64, 0x8A, 0xFB, 0x02, 0x64, 0xC1, 0xFE, 0xDB, 0xFB, + 0xF1, 0xF3, 0xFF, 0xFF, 0x01, 0xBC, 0xF1, 0xFB, 0x02, 0x65, 0xF1, 0x60, 0x58, 0x4E, 0xC3, 0x78, + 0xFF, 0xFF, 0x03, 0x60, 0xE8, 0x63, 0x0E, 0x60, 0x36, 0xFD, 0x08, 0x60, 0x77, 0xF3, 0xFF, 0xFF, + 0x13, 0x1B, 0x16, 0x60, 0xCC, 0xF3, 0x00, 0x61, 0x60, 0x40, 0x00, 0x36, 0x00, 0xB9, 0x60, 0x40, + 0x01, 0x36, 0x01, 0xB9, 0x60, 0x40, 0x02, 0x36, 0x06, 0xB9, 0x60, 0x40, 0x03, 0x36, 0x07, 0xB9, + 0x41, 0x44, 0xD4, 0x60, 0xF6, 0x78, 0xFF, 0xFF, 0xD3, 0x60, 0xD0, 0x78, 0xFF, 0xFF, 0x00, 0x60, + 0x20, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0xFF, 0xFF, 0x08, 0x24, 0x46, 0x01, 0xA0, 0x84, 0xA2, 0xDB, + 0x00, 0x63, 0x68, 0xFD, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x30, 0x00, 0x20, 0x40, + 0x06, 0x23, 0x10, 0x00, 0x08, 0x60, 0x27, 0xF1, 0x7F, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, + 0x80, 0x60, 0x00, 0x64, 0x08, 0x60, 0x28, 0xFB, 0xE1, 0x60, 0xF7, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x64, 0x08, 0x60, 0x27, 0xFB, 0x5A, 0xDB, 0x10, 0x60, 0x4E, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x44, 0x01, 0x1C, 0x60, 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x00, 0x64, 0x68, 0xFB, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x01, 0x64, 0x8A, 0xFB, 0xFF, 0xFF, 0xC1, 0xFE, 0x2E, 0x58, 0xFF, 0xFF, 0x50, 0x64, + 0x3B, 0x42, 0x5A, 0xDB, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x00, 0x60, 0x95, 0xF3, + 0xFF, 0xFF, 0x10, 0xB0, 0xFF, 0xFF, 0x11, 0x03, 0x08, 0x60, 0x1B, 0xF1, 0x01, 0x60, 0x00, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x04, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xE2, 0x60, + 0x2A, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xB9, 0xF1, 0x0E, 0x60, 0x4B, 0xF9, + 0x7D, 0xF1, 0x7C, 0xF9, 0x02, 0x64, 0x8A, 0xFB, 0xFF, 0xFF, 0xC1, 0xFE, 0x8A, 0xF3, 0x00, 0x65, + 0xD4, 0x80, 0xFF, 0xFF, 0x0E, 0x03, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x80, 0x60, + 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xE2, 0x60, 0x4A, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x51, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x1B, 0x60, 0xB0, 0x64, 0x67, 0xFB, 0x1C, 0x60, 0x72, 0x63, 0x7F, 0xF3, 0xBD, 0xDB, 0x80, 0xF3, + 0xBD, 0xDB, 0x81, 0xF3, 0xA3, 0xDB, 0x67, 0xF3, 0x00, 0x60, 0x86, 0xF1, 0x04, 0xA4, 0x67, 0xFB, + 0xD0, 0x80, 0xA0, 0xD3, 0x1F, 0x07, 0x40, 0x47, 0x60, 0x41, 0x0E, 0x65, 0x45, 0xD3, 0x16, 0x60, + 0xC2, 0xF1, 0xFF, 0xFF, 0x03, 0x1B, 0x10, 0xB0, 0xFF, 0xFF, 0xED, 0x02, 0x27, 0x44, 0x06, 0xA4, + 0x60, 0x41, 0xA1, 0xD1, 0x7F, 0xF3, 0x80, 0xF1, 0xD0, 0x80, 0x59, 0xD3, 0x08, 0x02, 0xD0, 0x80, + 0x81, 0xF3, 0x59, 0xD1, 0x04, 0x02, 0xD0, 0x80, 0xFF, 0xFF, 0x01, 0x02, 0x03, 0x00, 0xE2, 0x60, + 0xE6, 0x78, 0xFF, 0xFF, 0x1C, 0x60, 0x72, 0x63, 0xBD, 0xD3, 0x7F, 0xFB, 0xBD, 0xD3, 0x80, 0xFB, + 0xA3, 0xD3, 0x81, 0xFB, 0x53, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0xDE, 0xFE, 0x0A, 0x04, 0x40, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xE2, 0x60, + 0x9A, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x7C, 0xF1, 0x7D, 0xF9, 0x13, 0x60, + 0x1A, 0xF9, 0x0E, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x20, 0x60, 0x00, 0x64, 0x08, 0x60, + 0x16, 0xFB, 0xE2, 0x60, 0xC7, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, + 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xBE, 0xFE, 0x08, 0x60, 0x08, 0xF1, 0x40, 0x60, 0x00, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x01, 0x63, 0x8A, 0xFD, 0x08, 0x60, 0x0C, 0xF1, 0x00, 0x60, + 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0xC1, 0xFE, 0x54, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x31, 0x44, 0xF9, 0xB4, 0x40, 0x51, 0xE1, 0x60, 0x22, 0x78, 0xFF, 0xFF, 0x27, 0x43, 0x33, 0x60, + 0xBE, 0x65, 0xA5, 0xD3, 0x65, 0x41, 0x10, 0xA3, 0x01, 0xA4, 0xFE, 0xB4, 0xC4, 0x85, 0xFE, 0xA1, + 0xBD, 0xD3, 0x59, 0xD1, 0xFF, 0xFF, 0xD0, 0x80, 0xD5, 0x80, 0x02, 0x02, 0x04, 0x03, 0xF8, 0x01, + 0xE2, 0x60, 0x73, 0x78, 0xFF, 0xFF, 0x55, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x10, 0x60, 0x2A, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0A, 0x04, 0x40, 0x60, 0x00, 0x64, 0x08, 0x60, 0x16, 0xFB, + 0xE2, 0x60, 0xFE, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x27, 0xD1, 0x7D, 0xF9, + 0x13, 0x60, 0x1A, 0xF9, 0x0E, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x20, 0x60, 0x00, 0x64, + 0x08, 0x60, 0x16, 0xFB, 0xE3, 0x60, 0x20, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xBE, 0xFE, 0x08, 0x60, 0x08, 0xF1, 0x40, 0x60, + 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x07, 0x60, 0xD0, 0x64, 0x0E, 0x60, 0x4B, 0xFB, + 0x1C, 0x60, 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, + 0x27, 0x43, 0x06, 0xA3, 0xBD, 0xD3, 0x7F, 0xFB, 0xBD, 0xD3, 0x80, 0xFB, 0xA3, 0xD3, 0x81, 0xFB, + 0x31, 0x44, 0xF9, 0xB4, 0x40, 0x51, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x01, 0x60, + 0x04, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xE3, 0x60, 0x51, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0xB9, 0xF1, 0x0E, 0x60, 0x4B, 0xF9, 0x08, 0x60, 0x15, 0xF1, 0xFE, 0x60, 0xFF, 0x61, + 0xA1, 0x84, 0x5A, 0xD1, 0x4A, 0xDB, 0xA1, 0x84, 0x5A, 0xDB, 0x08, 0x60, 0x15, 0xF1, 0x00, 0x60, + 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xE2, 0x60, 0x73, 0x78, + 0xFF, 0xFF, 0x7D, 0xF1, 0x32, 0x60, 0x7A, 0x61, 0xA1, 0xD3, 0x64, 0x40, 0x01, 0x27, 0x59, 0xD3, + 0x32, 0x60, 0x7E, 0x61, 0xFD, 0x60, 0x58, 0x4E, 0xAC, 0x78, 0xFF, 0xFF, 0xA1, 0xDB, 0x27, 0x42, + 0x0C, 0xA2, 0xA2, 0xD3, 0x16, 0x60, 0xAD, 0xF3, 0x00, 0xBD, 0x01, 0x63, 0xAC, 0x81, 0x09, 0x03, + 0x08, 0x03, 0xB8, 0x60, 0x58, 0x4D, 0x15, 0x78, 0xFF, 0xFF, 0x00, 0xB8, 0x01, 0x63, 0x01, 0x03, + 0x60, 0x43, 0x0E, 0x60, 0x35, 0xFD, 0x5F, 0xF5, 0x00, 0x64, 0x2B, 0xFA, 0x20, 0x64, 0x2A, 0xFA, + 0x27, 0x43, 0x06, 0xA3, 0xBD, 0xD1, 0x2C, 0xF8, 0x32, 0xF8, 0xBD, 0xD1, 0x2D, 0xF8, 0x33, 0xF8, + 0xA3, 0xD1, 0x2E, 0xF8, 0x34, 0xF8, 0xEA, 0xF1, 0x2F, 0xF8, 0xEB, 0xF1, 0x30, 0xF8, 0xEC, 0xF1, + 0x31, 0xF8, 0xB9, 0xF1, 0x19, 0xF8, 0xF8, 0x60, 0x80, 0x64, 0x0E, 0xFA, 0x00, 0xF4, 0x01, 0x63, + 0x32, 0x40, 0x08, 0x26, 0x10, 0xBB, 0x16, 0x60, 0xC2, 0xF1, 0xFF, 0xFF, 0x64, 0x40, 0xFE, 0x26, + 0x10, 0xBB, 0x7D, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x27, 0x0A, 0x00, 0x19, 0x60, 0x45, 0xF3, + 0xFF, 0xFF, 0x60, 0x40, 0x02, 0x22, 0x20, 0xBB, 0x63, 0x44, 0xFF, 0xFF, 0x04, 0x7F, 0x60, 0x43, + 0x09, 0xFC, 0x0E, 0x60, 0x35, 0xF3, 0x12, 0x61, 0x59, 0xDA, 0x1C, 0x60, 0x72, 0x63, 0xBD, 0xD1, + 0x59, 0xD8, 0xBD, 0xD1, 0x59, 0xD8, 0xA3, 0xD1, 0x59, 0xD8, 0x35, 0x60, 0x98, 0x64, 0x40, 0x48, + 0xD9, 0x81, 0xFF, 0x60, 0xF2, 0x64, 0xF1, 0x60, 0x58, 0x4D, 0x34, 0x78, 0xFF, 0xFF, 0x5F, 0xF5, + 0x3F, 0xFC, 0xDB, 0x83, 0x1A, 0x60, 0x4C, 0xFD, 0x20, 0x7C, 0x5A, 0xD9, 0x63, 0x41, 0x34, 0x60, + 0x9C, 0x63, 0x12, 0x65, 0x00, 0xF4, 0xCD, 0x84, 0x4C, 0x91, 0x60, 0x43, 0x60, 0xFE, 0xA5, 0xD2, + 0xDE, 0x85, 0x7F, 0x26, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0x5D, 0x93, 0xA3, 0xDB, 0x5D, 0x93, + 0xA5, 0xD2, 0xF6, 0x1F, 0x5D, 0x93, 0x20, 0xFE, 0xDF, 0x83, 0x5F, 0xF5, 0x25, 0x60, 0xCE, 0x64, + 0x13, 0x60, 0x0D, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0x00, 0x66, 0x46, 0x46, 0xC1, 0xFE, 0x16, 0x64, 0x68, 0xFB, 0x56, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x0E, 0x60, 0x38, 0xF3, 0xFF, 0xFF, 0x64, 0xA4, 0xA2, 0xDB, 0x0E, 0x60, 0x38, 0xF1, 0x0E, 0x60, + 0x4B, 0xF9, 0x1C, 0x60, 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0x00, 0x60, 0x1C, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xE4, 0x60, 0x23, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x15, 0xF1, 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, + 0x9C, 0x84, 0x0E, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x57, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x00, 0x64, + 0x68, 0xFB, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xE2, 0x60, 0x73, 0x78, 0xFF, 0xFF, + 0x00, 0x60, 0x10, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x16, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x1C, 0x60, + 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x58, 0x64, + 0x3B, 0x42, 0x5A, 0xDB, 0x00, 0x64, 0x68, 0xFB, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0xE6, 0x60, 0x36, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x08, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x3D, 0x03, + 0xA0, 0x84, 0xA2, 0xDB, 0x1C, 0x60, 0x92, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x04, 0xFF, 0x00, 0x64, 0x68, 0xFB, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x26, 0x46, 0x00, 0xF4, 0x0A, 0xF2, 0x09, 0xF2, 0x04, 0x1B, 0x01, 0xB0, 0x01, 0x7C, 0x2D, 0x02, + 0x0A, 0xF8, 0x59, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0x0A, 0xF2, 0x26, 0x46, 0x40, 0x59, 0x02, 0x60, + 0x00, 0x61, 0x2F, 0xF2, 0xA1, 0xDB, 0x30, 0xF2, 0x41, 0x58, 0x59, 0xDB, 0x31, 0xF2, 0x59, 0xDB, + 0x26, 0x46, 0x26, 0x60, 0x1A, 0x64, 0x40, 0x4B, 0x34, 0x60, 0x58, 0x4D, 0x08, 0x78, 0xFF, 0xFF, + 0x00, 0x66, 0x46, 0x46, 0x05, 0x65, 0xF1, 0x60, 0x58, 0x4E, 0x96, 0x78, 0xFF, 0xFF, 0xE7, 0x60, + 0x0B, 0x78, 0xFF, 0xFF, 0xE2, 0x60, 0x73, 0x78, 0xFF, 0xFF, 0x5A, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x78, 0x43, 0x02, 0x61, 0x29, 0x60, 0xEA, 0x78, 0xFF, 0xFF, 0x5B, 0x64, 0x3B, 0x42, 0x5A, 0xDB, + 0x0C, 0xF2, 0xFF, 0xFF, 0x60, 0x41, 0xFF, 0xB1, 0xFF, 0xA1, 0x60, 0x47, 0xFF, 0xB4, 0xC8, 0x02, + 0xC7, 0x03, 0x34, 0x60, 0xF4, 0x63, 0x30, 0x64, 0xBD, 0xDB, 0x66, 0x45, 0x26, 0x46, 0x3F, 0xF2, + 0x34, 0x60, 0xF2, 0x61, 0xC2, 0xA0, 0xFF, 0xFF, 0x01, 0x04, 0x3E, 0x64, 0x65, 0x46, 0x02, 0xA4, + 0xA1, 0xDB, 0xC8, 0x81, 0x12, 0x65, 0xCD, 0x84, 0x4C, 0x91, 0x60, 0x43, 0x60, 0xFE, 0xA5, 0xD2, + 0xDE, 0x85, 0x7F, 0x26, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0x5D, 0x93, 0xA3, 0xDB, 0x5D, 0x93, + 0xA5, 0xD2, 0xF6, 0x1F, 0x5D, 0x93, 0x20, 0xFE, 0xDF, 0x83, 0x0C, 0xF2, 0xFF, 0xFF, 0x1A, 0x65, + 0x60, 0x47, 0xFF, 0xB4, 0xC4, 0x85, 0xDC, 0x60, 0x58, 0x4D, 0xC7, 0x78, 0xFF, 0xFF, 0x0B, 0xF2, + 0xFF, 0xFF, 0x07, 0xB4, 0x01, 0x61, 0x03, 0x03, 0xCC, 0x84, 0xE1, 0x81, 0xFD, 0x02, 0x61, 0x44, + 0x94, 0xFB, 0x27, 0x45, 0x02, 0x62, 0x46, 0xD3, 0x5A, 0xD1, 0x60, 0x47, 0x56, 0xFB, 0x64, 0x47, + 0x55, 0xFB, 0x00, 0x64, 0x5B, 0xFB, 0x0C, 0x62, 0x46, 0xD3, 0x7E, 0xFB, 0x0B, 0xF0, 0x0F, 0x60, + 0xFF, 0x64, 0xA0, 0x84, 0x83, 0xFB, 0x1C, 0x60, 0x6A, 0x62, 0xA2, 0xD3, 0x85, 0xFB, 0x26, 0x46, + 0x32, 0xF0, 0x7F, 0xF9, 0x33, 0xF0, 0x80, 0xF9, 0x34, 0xF0, 0x81, 0xF9, 0x2E, 0x60, 0x2E, 0x64, + 0x2D, 0x60, 0x8A, 0x63, 0xA0, 0xD1, 0xA3, 0xD9, 0x64, 0x41, 0x58, 0xD1, 0x5B, 0xD9, 0x7D, 0xF3, + 0x66, 0x45, 0xA6, 0xF5, 0x60, 0x40, 0x01, 0x27, 0x08, 0x00, 0x91, 0xFA, 0x61, 0x44, 0xFD, 0x60, + 0x58, 0x4E, 0xAC, 0x78, 0xFF, 0xFF, 0x12, 0xFA, 0x07, 0x00, 0x11, 0xF8, 0x64, 0x44, 0xFD, 0x60, + 0x58, 0x4E, 0xAC, 0x78, 0xFF, 0xFF, 0x12, 0xFA, 0x65, 0x46, 0xA6, 0xF3, 0xFF, 0xFF, 0x02, 0xA4, + 0x40, 0x4B, 0x3F, 0xF2, 0x00, 0xF4, 0x60, 0x43, 0xFA, 0xA3, 0x00, 0x60, 0x17, 0x61, 0x00, 0x60, + 0x01, 0x65, 0x01, 0x60, 0xFF, 0x64, 0x40, 0x4C, 0xFD, 0x60, 0x58, 0x4E, 0x7A, 0x78, 0xFF, 0xFF, + 0x00, 0xBB, 0xFF, 0xFF, 0x00, 0x02, 0x00, 0x64, 0x40, 0x4A, 0x60, 0xFE, 0x02, 0x60, 0x00, 0x63, + 0xBD, 0xD3, 0xBD, 0xD3, 0x60, 0x41, 0xFE, 0x60, 0x58, 0x4E, 0x2C, 0x78, 0xFF, 0xFF, 0x20, 0xFE, + 0x00, 0x65, 0x00, 0x64, 0x19, 0x60, 0x3B, 0xFB, 0x02, 0x00, 0x20, 0xFE, 0xFF, 0x65, 0x02, 0x60, + 0x00, 0x63, 0x60, 0xFE, 0xBD, 0xD3, 0xBD, 0xD3, 0x60, 0x41, 0x20, 0xFE, 0xCD, 0x81, 0x60, 0x40, + 0x80, 0x2A, 0x39, 0x00, 0x7F, 0xB4, 0x02, 0x3A, 0x02, 0x00, 0x01, 0x64, 0x2E, 0x00, 0x04, 0x3A, + 0x02, 0x00, 0x02, 0x64, 0x2A, 0x00, 0x0B, 0x3A, 0x02, 0x00, 0x04, 0x64, 0x26, 0x00, 0x16, 0x3A, + 0x02, 0x00, 0x08, 0x64, 0x22, 0x00, 0x0C, 0x3A, 0x02, 0x00, 0x10, 0x64, 0x1E, 0x00, 0x12, 0x3A, + 0x02, 0x00, 0x20, 0x64, 0x1A, 0x00, 0x18, 0x3A, 0x02, 0x00, 0x40, 0x64, 0x16, 0x00, 0x24, 0x3A, + 0x02, 0x00, 0x80, 0x64, 0x12, 0x00, 0x30, 0x3A, 0x02, 0x00, 0x01, 0x67, 0x0E, 0x00, 0x48, 0x3A, + 0x02, 0x00, 0x02, 0x67, 0x0A, 0x00, 0x60, 0x3A, 0x02, 0x00, 0x04, 0x67, 0x06, 0x00, 0x6C, 0x3A, + 0x02, 0x00, 0x08, 0x67, 0x02, 0x00, 0x00, 0x64, 0x00, 0x00, 0x19, 0x60, 0x3B, 0xF1, 0xFF, 0xFF, + 0xB0, 0x84, 0x19, 0x60, 0x3B, 0xFB, 0x61, 0x40, 0x00, 0x36, 0x05, 0x00, 0x60, 0xFE, 0xBD, 0xD3, + 0xFF, 0xFF, 0x20, 0xFE, 0xBB, 0x01, 0x65, 0x40, 0x00, 0x3A, 0x1E, 0x00, 0x26, 0x46, 0x3F, 0xF2, + 0x00, 0xF4, 0x60, 0x43, 0xFA, 0xA3, 0x00, 0x60, 0x17, 0x61, 0x00, 0x60, 0x32, 0x65, 0x01, 0x60, + 0xFF, 0x64, 0x40, 0x4C, 0xFD, 0x60, 0x58, 0x4E, 0x7A, 0x78, 0xFF, 0xFF, 0x00, 0xBB, 0xFF, 0xFF, + 0x0B, 0x03, 0x60, 0xFE, 0x02, 0x60, 0x00, 0x63, 0xBD, 0xD3, 0xBD, 0xD3, 0x60, 0x41, 0xFE, 0x60, + 0x58, 0x4E, 0x2C, 0x78, 0xFF, 0xFF, 0x91, 0x01, 0x20, 0xFE, 0x00, 0x65, 0xFC, 0x60, 0x58, 0x4E, + 0xC7, 0x78, 0xFF, 0xFF, 0xA1, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x27, 0x04, 0x00, 0xFD, 0x60, + 0x58, 0x4E, 0x11, 0x78, 0xFF, 0xFF, 0x20, 0xFE, 0x37, 0x60, 0xF8, 0x61, 0xA1, 0xD1, 0xA1, 0xF3, + 0x01, 0x60, 0xAC, 0x63, 0x60, 0x45, 0x2A, 0x44, 0x79, 0xFB, 0xA3, 0xD5, 0x65, 0x40, 0x01, 0x27, + 0x5B, 0xD5, 0x65, 0x40, 0x01, 0x27, 0x59, 0xD1, 0x66, 0x41, 0xA0, 0x84, 0x24, 0x94, 0x2B, 0x46, + 0x0F, 0xFA, 0x7A, 0xFB, 0x16, 0x64, 0x12, 0xFA, 0x01, 0x64, 0x11, 0xFA, 0x66, 0x5C, 0xC2, 0x60, + 0x58, 0x4E, 0x6D, 0x78, 0xFF, 0xFF, 0xA6, 0xF3, 0xFF, 0xFF, 0x02, 0xA4, 0x40, 0x4B, 0x60, 0x46, + 0x00, 0x64, 0x17, 0xFA, 0x00, 0x64, 0x16, 0xFA, 0x13, 0xFA, 0x00, 0x65, 0x26, 0x46, 0xFD, 0x60, + 0x58, 0x4E, 0xDD, 0x78, 0xFF, 0xFF, 0xA6, 0xF3, 0x1D, 0x60, 0xC0, 0x65, 0x02, 0xA4, 0x60, 0x46, + 0x05, 0xF0, 0x60, 0x41, 0x64, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x00, 0x7C, 0x44, 0xD9, 0x26, 0x46, + 0x31, 0xF2, 0x61, 0x5C, 0x60, 0x47, 0x00, 0x7F, 0xE0, 0x84, 0x44, 0xD9, 0x26, 0x46, 0x2F, 0xF0, + 0x61, 0x46, 0x03, 0xF8, 0x26, 0x46, 0x30, 0xF0, 0x61, 0x46, 0x04, 0xF8, 0x26, 0x46, 0x31, 0xF0, + 0x61, 0x46, 0x05, 0xF8, 0x26, 0x46, 0xD9, 0x60, 0x58, 0x4E, 0xAE, 0x78, 0xFF, 0xFF, 0x26, 0x46, + 0x26, 0x60, 0x1A, 0x64, 0x40, 0x4B, 0x34, 0x60, 0x58, 0x4D, 0x08, 0x78, 0xFF, 0xFF, 0x00, 0x66, + 0x46, 0x46, 0x03, 0x65, 0xF1, 0x60, 0x58, 0x4E, 0xC3, 0x78, 0xFF, 0xFF, 0x01, 0x63, 0x8A, 0xFD, + 0x08, 0x60, 0x0C, 0xF1, 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0xC1, 0xFE, + 0x5C, 0x64, 0x3B, 0x42, 0x5A, 0xDB, 0xE1, 0x60, 0x22, 0x78, 0xFF, 0xFF, 0xFF, 0x60, 0xF7, 0x65, + 0x20, 0x44, 0x24, 0x80, 0xDA, 0x60, 0x74, 0x78, 0xFF, 0xFF, 0xDB, 0xF3, 0xFF, 0xFF, 0xFD, 0xA0, + 0x2A, 0xF2, 0x03, 0x03, 0xE6, 0x60, 0xDE, 0x78, 0xFF, 0xFF, 0x60, 0x40, 0xB0, 0x36, 0x11, 0x00, + 0xC0, 0x36, 0x02, 0x00, 0x2F, 0x58, 0xFF, 0xFF, 0x26, 0x46, 0x26, 0x60, 0x1A, 0x64, 0x40, 0x4B, + 0x34, 0x60, 0x58, 0x4D, 0x08, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0xDA, 0x60, 0x74, 0x78, + 0xFF, 0xFF, 0x66, 0x45, 0x00, 0xF4, 0x0A, 0xF2, 0x0B, 0xF2, 0xFE, 0xA0, 0xF3, 0xA0, 0x67, 0x02, + 0x60, 0x41, 0x09, 0xF2, 0x1D, 0x03, 0x00, 0xA0, 0xFF, 0xA0, 0x4B, 0x03, 0x5D, 0x03, 0x00, 0xA0, + 0xFF, 0xFF, 0x47, 0x03, 0x01, 0x64, 0x10, 0x60, 0x0B, 0xFB, 0x0D, 0x64, 0x10, 0x60, 0x0C, 0xFB, + 0x03, 0x64, 0x10, 0x60, 0x0D, 0xFB, 0x26, 0x46, 0x26, 0x60, 0x1A, 0x64, 0x40, 0x4B, 0x34, 0x60, + 0x58, 0x4D, 0x08, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0xDA, 0x60, 0x74, 0x78, 0xFF, 0xFF, + 0x16, 0x60, 0xC3, 0xF3, 0xFF, 0xFF, 0xFE, 0xA0, 0x20, 0x60, 0x16, 0x61, 0x15, 0x02, 0x01, 0x64, + 0xA1, 0xDB, 0x00, 0x64, 0x10, 0x60, 0x0C, 0xFB, 0x01, 0x64, 0x10, 0x60, 0x0D, 0xFB, 0x26, 0x46, + 0x26, 0x60, 0x1A, 0x64, 0x40, 0x4B, 0x34, 0x60, 0x58, 0x4D, 0x08, 0x78, 0xFF, 0xFF, 0x00, 0x66, + 0x46, 0x46, 0xDA, 0x60, 0x74, 0x78, 0xFF, 0xFF, 0x02, 0x64, 0xA1, 0xDB, 0x00, 0x64, 0x10, 0x60, + 0x0C, 0xFB, 0x01, 0x64, 0x10, 0x60, 0x0D, 0xFB, 0x26, 0x46, 0x26, 0x60, 0x1A, 0x64, 0x40, 0x4B, + 0x34, 0x60, 0x58, 0x4D, 0x08, 0x78, 0xFF, 0xFF, 0x00, 0x66, 0x46, 0x46, 0xDA, 0x60, 0x74, 0x78, + 0xFF, 0xFF, 0x65, 0x46, 0x07, 0xF4, 0x06, 0xF2, 0xFF, 0xFF, 0x01, 0x7E, 0x06, 0xFA, 0x65, 0x46, + 0x26, 0x46, 0x26, 0x60, 0x1A, 0x64, 0x40, 0x4B, 0x34, 0x60, 0x58, 0x4D, 0x08, 0x78, 0xFF, 0xFF, + 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0xDC, 0x60, 0x09, 0x78, 0xFF, 0xFF, 0x0A, 0xF2, + 0x09, 0xF2, 0xFC, 0xA0, 0xFF, 0xA0, 0x11, 0x02, 0x0A, 0x02, 0x0B, 0xF2, 0x65, 0x46, 0x0A, 0x1B, + 0x66, 0x41, 0x07, 0xF4, 0x06, 0xF2, 0xFF, 0xFF, 0x01, 0x7E, 0x06, 0xFA, 0x61, 0x46, 0xDA, 0x60, + 0x74, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x65, 0x46, 0x68, 0xF1, 0x2A, 0xF2, + 0x64, 0x41, 0x60, 0x40, 0xA0, 0x3A, 0x02, 0x00, 0x08, 0xB1, 0x04, 0x00, 0xC0, 0x3A, 0x0B, 0x00, + 0x04, 0xB1, 0xFF, 0xFF, 0x1E, 0x03, 0x08, 0x60, 0x15, 0xF1, 0x00, 0x60, 0x10, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x16, 0x00, 0xB0, 0x3A, 0x02, 0x00, 0x01, 0x65, 0x07, 0x00, 0x10, 0x3A, + 0x02, 0x00, 0x02, 0x65, 0x03, 0x00, 0x30, 0x3A, 0x0C, 0x00, 0x10, 0x65, 0xA5, 0x80, 0xFF, 0xFF, + 0x08, 0x03, 0x08, 0x60, 0x15, 0xF1, 0x00, 0x60, 0x08, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x00, 0x66, 0x2F, 0x58, 0xFF, 0xFF, 0x16, 0x60, 0xC3, 0xF3, 0xFF, 0xFF, 0xFC, 0xA0, 0xFF, 0xFF, + 0x14, 0x04, 0x00, 0x60, 0x02, 0x64, 0x08, 0x60, 0x16, 0xFB, 0xE7, 0x60, 0x1B, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x19, 0x60, 0xA5, 0xF1, 0x01, 0x60, 0x00, 0x64, 0xA0, 0x80, + 0xFF, 0xFF, 0x03, 0x03, 0xDA, 0x60, 0x74, 0x78, 0xFF, 0xFF, 0x20, 0x40, 0x08, 0x2A, 0x03, 0x00, + 0xD9, 0x60, 0xCA, 0x78, 0xFF, 0xFF, 0xE2, 0x60, 0x73, 0x78, 0xFF, 0xFF, 0x4E, 0x64, 0x3B, 0x42, + 0x5A, 0xDB, 0x2E, 0xF5, 0xFF, 0xFF, 0x27, 0xF2, 0x1D, 0x60, 0xC0, 0x65, 0x60, 0x47, 0x00, 0x7F, + 0xE0, 0x84, 0x44, 0xD3, 0x66, 0x41, 0x60, 0x46, 0x60, 0x43, 0x05, 0xF2, 0x16, 0x18, 0x61, 0x46, + 0x27, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0x04, 0xF2, 0x0C, 0x02, 0x61, 0x46, 0x26, 0xF0, 0x63, 0x46, + 0xD0, 0x80, 0x03, 0xF2, 0x06, 0x02, 0x61, 0x46, 0x25, 0xF0, 0x63, 0x46, 0xD0, 0x80, 0xFF, 0xFF, + 0x07, 0x03, 0x80, 0xF4, 0xFF, 0xFF, 0x63, 0x46, 0xE8, 0x1B, 0xA6, 0xF3, 0x08, 0xFE, 0x60, 0x43, + 0x61, 0x46, 0x25, 0xF2, 0x26, 0xF0, 0xA7, 0xF2, 0xA8, 0xF0, 0x65, 0xF5, 0xFF, 0xFF, 0x00, 0xF4, + 0xFF, 0xFF, 0x89, 0xF8, 0x65, 0xF5, 0xFF, 0xFF, 0x07, 0xFC, 0x2C, 0xFA, 0x2D, 0xF8, 0xAE, 0xFA, + 0xEA, 0xF3, 0x2F, 0xFA, 0xEB, 0xF3, 0x30, 0xFA, 0xEC, 0xF3, 0x31, 0xFA, 0x7F, 0xF3, 0x32, 0xFA, + 0x80, 0xF3, 0x33, 0xFA, 0x81, 0xF3, 0x34, 0xFA, 0x1B, 0x60, 0xFE, 0xF3, 0xFF, 0xFF, 0x03, 0x1B, + 0x00, 0x60, 0xA0, 0x64, 0x02, 0x00, 0x00, 0x60, 0xC0, 0x64, 0x2A, 0xFA, 0x02, 0x63, 0x3F, 0xFC, + 0xAB, 0xFC, 0x00, 0x64, 0x3E, 0xFA, 0xC9, 0xF1, 0x19, 0xF8, 0x25, 0x60, 0xCE, 0x64, 0x13, 0x60, + 0x0D, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x00, 0x66, + 0x46, 0x46, 0xC1, 0xFE, 0x10, 0x60, 0x2A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xE1, 0x60, 0x34, 0x78, + 0xFF, 0xFF, 0x00, 0x60, 0x3A, 0x61, 0xB6, 0x60, 0x58, 0x4D, 0x22, 0x78, 0xFF, 0xFF, 0x66, 0x44, + 0x61, 0xFB, 0xA6, 0xF3, 0x07, 0xFA, 0x0C, 0x60, 0x80, 0x64, 0xB9, 0xF1, 0x19, 0xF8, 0x0E, 0xFA, + 0x00, 0x64, 0x3E, 0xFA, 0x3F, 0xFA, 0x00, 0x60, 0x3A, 0x61, 0xB6, 0x60, 0x58, 0x4D, 0x22, 0x78, + 0xFF, 0xFF, 0x66, 0x44, 0x60, 0xFB, 0xA6, 0xF3, 0x07, 0xFA, 0x0C, 0x60, 0x80, 0x64, 0x0E, 0xFA, + 0xB9, 0xF1, 0x19, 0xF8, 0x00, 0x64, 0x3E, 0xFA, 0x3F, 0xFA, 0xE8, 0x60, 0xEA, 0x64, 0x08, 0x60, + 0x33, 0xFB, 0x00, 0x60, 0x80, 0x64, 0x08, 0x60, 0x10, 0xFB, 0xE7, 0x60, 0xCB, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x16, 0x60, 0x87, 0xF3, 0xFF, 0xFF, 0x01, 0xA8, 0x03, 0xA8, + 0x04, 0x03, 0x03, 0x03, 0xE8, 0x60, 0xDC, 0x78, 0xFF, 0xFF, 0x04, 0x60, 0x00, 0x65, 0x20, 0x44, + 0x34, 0x80, 0x10, 0x60, 0x1E, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x9B, 0xFE, 0x03, 0x05, 0x20, 0x40, + 0x4B, 0x23, 0x0A, 0x00, 0x80, 0x60, 0x00, 0x64, 0x08, 0x60, 0x10, 0xFB, 0xE7, 0x60, 0xD9, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, 0x13, 0xF3, 0xFF, 0xFF, 0x60, 0x40, + 0x01, 0x2A, 0x07, 0x00, 0x90, 0x60, 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, 0x00, 0x64, 0xA2, 0xDB, + 0x04, 0x00, 0x10, 0x60, 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, 0x8A, 0xF3, 0x58, 0xFB, 0x82, 0xF1, + 0xBA, 0xFE, 0x01, 0xA8, 0x59, 0xF9, 0x04, 0x02, 0x02, 0x64, 0x8A, 0xFB, 0xFF, 0xFF, 0xC1, 0xFE, + 0x64, 0x47, 0xDB, 0xF3, 0x10, 0xB0, 0x04, 0xA8, 0x2B, 0x02, 0x2A, 0x02, 0x61, 0xF5, 0xEA, 0xF1, + 0x2F, 0xF8, 0xEB, 0xF1, 0x30, 0xF8, 0xEC, 0xF1, 0x31, 0xF8, 0x7F, 0xF1, 0x2C, 0xF8, 0x32, 0xF8, + 0x80, 0xF1, 0x2D, 0xF8, 0x33, 0xF8, 0x81, 0xF1, 0x2E, 0xF8, 0x34, 0xF8, 0x10, 0x60, 0x48, 0x64, + 0x2A, 0xFA, 0x25, 0x60, 0xCE, 0x64, 0x13, 0x60, 0x0D, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x00, 0x60, 0x01, 0x64, 0x08, 0x60, 0x10, 0xFB, + 0xE8, 0x60, 0x36, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x67, 0x82, 0xFB, + 0x8A, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, 0xFF, 0xFF, 0x0A, 0x03, 0x80, 0x60, 0x00, 0x64, 0x08, 0x60, + 0x10, 0xFB, 0xE8, 0x60, 0x38, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, + 0x1E, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x05, 0x7C, 0x53, 0xF9, 0x2F, 0x60, 0x24, 0x64, 0x54, 0xFB, + 0x19, 0x60, 0x40, 0xF3, 0xFF, 0xFF, 0x15, 0x18, 0x10, 0x60, 0x1E, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x08, 0x60, 0x12, 0xF1, 0x00, 0x60, 0x10, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x10, 0x60, + 0x00, 0x64, 0x08, 0x60, 0x10, 0xFB, 0xE8, 0x60, 0x69, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x19, 0x60, 0x41, 0xF3, 0xFF, 0x60, 0x80, 0x65, 0xA4, 0x80, 0x5A, 0xD3, 0x05, 0x02, + 0x04, 0x1B, 0x5A, 0xD3, 0xFF, 0xFF, 0x01, 0x1B, 0x15, 0x00, 0x10, 0x60, 0x1E, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x08, 0x60, 0x12, 0xF1, 0x00, 0x60, 0x20, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x10, 0x60, 0x00, 0x64, 0x08, 0x60, 0x10, 0xFB, 0xE8, 0x60, 0x8A, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0xFF, 0xFF, 0x59, 0xF3, 0x82, 0xFB, 0x60, 0x40, 0x10, 0x27, 0xDA, 0xFE, + 0xDB, 0xF3, 0x00, 0xA8, 0x04, 0xA8, 0x23, 0x02, 0x22, 0x02, 0x60, 0xF5, 0xEA, 0xF1, 0x2F, 0xF8, + 0xEB, 0xF1, 0x30, 0xF8, 0xEC, 0xF1, 0x31, 0xF8, 0x7F, 0xF1, 0x2C, 0xF8, 0x80, 0xF1, 0x2D, 0xF8, + 0x81, 0xF1, 0x2E, 0xF8, 0xA4, 0x64, 0x2A, 0xFA, 0x83, 0xF1, 0xC0, 0x67, 0xB0, 0x84, 0x2B, 0xFA, + 0x25, 0x60, 0xCE, 0x64, 0x13, 0x60, 0x0D, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x20, 0x60, 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, 0x00, 0x60, + 0x04, 0x61, 0xB6, 0x60, 0x58, 0x4D, 0x22, 0x78, 0xFF, 0xFF, 0x01, 0x64, 0x23, 0xFA, 0xF1, 0x60, + 0x02, 0x64, 0x24, 0xFA, 0x26, 0x60, 0x0A, 0x64, 0x13, 0x60, 0x0D, 0xFB, 0x66, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xFA, 0xFE, 0xEB, 0x60, 0xFF, 0x65, 0x20, 0x44, + 0x24, 0x80, 0x08, 0x60, 0x08, 0xF1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x58, 0xF3, 0x8A, 0xFB, 0xFF, 0xFF, 0xC1, 0xFE, 0x10, 0x60, 0x1E, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x00, 0x60, 0x80, 0x64, 0x08, 0x60, 0x10, 0xFB, 0xE7, 0x60, 0xCB, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x9C, 0xF1, 0x00, 0x64, 0xB0, 0x86, 0x9C, 0xFB, 0x07, 0x03, 0x26, 0x60, + 0x1A, 0x64, 0x40, 0x4B, 0x34, 0x60, 0x58, 0x4D, 0x08, 0x78, 0xFF, 0xFF, 0xEB, 0x60, 0xFF, 0x65, + 0x20, 0x44, 0x24, 0x80, 0x10, 0x60, 0x1E, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x00, 0x60, 0x80, 0x64, + 0x08, 0x60, 0x10, 0xFB, 0xE7, 0x60, 0xCB, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x95, 0xF3, 0x26, 0x46, 0x60, 0x43, 0x01, 0x2A, 0x20, 0x00, 0x0F, 0xF2, 0x2A, 0xF0, 0x60, 0x40, + 0x10, 0x2A, 0x0F, 0x00, 0x64, 0x40, 0x04, 0x27, 0x18, 0x00, 0xFD, 0xB3, 0x64, 0x40, 0x20, 0x27, + 0x02, 0xBB, 0x08, 0x60, 0x1B, 0xF1, 0x00, 0x60, 0x08, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x0B, 0x00, 0xFB, 0xB3, 0x64, 0x40, 0x20, 0x27, 0x04, 0xBB, 0x08, 0x60, 0x1B, 0xF1, 0x00, 0x60, + 0x10, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x95, 0xFD, 0x26, 0x46, 0x2F, 0x58, 0xFF, 0xFF, + 0xDB, 0xF3, 0x3F, 0xF2, 0x04, 0xA8, 0x57, 0xFB, 0x02, 0x03, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0xF4, + 0x1E, 0x63, 0x08, 0x64, 0x40, 0x48, 0xBD, 0xD2, 0xFF, 0xFF, 0x60, 0x47, 0x05, 0x36, 0x0B, 0x00, + 0xFF, 0xB5, 0xC7, 0x83, 0x01, 0x2A, 0xF7, 0x01, 0x4F, 0xD2, 0x5B, 0xD2, 0x60, 0x40, 0x05, 0x37, + 0x0B, 0x00, 0xDF, 0x83, 0xF5, 0x01, 0xFF, 0xB5, 0x65, 0x41, 0xA3, 0xD2, 0x47, 0x8A, 0x60, 0x47, + 0x40, 0x4C, 0x5B, 0xD2, 0xDF, 0x83, 0x08, 0x00, 0x40, 0x4C, 0x00, 0x7F, 0xDC, 0x85, 0x47, 0x8A, + 0x60, 0x41, 0x5B, 0xD2, 0xDB, 0x83, 0x60, 0x47, 0x01, 0xB0, 0xFE, 0xB5, 0x02, 0x03, 0x02, 0x64, + 0x40, 0x48, 0x2C, 0x47, 0xFF, 0xB4, 0x73, 0xF1, 0x08, 0x28, 0x73, 0xFB, 0x83, 0xF1, 0x65, 0x44, + 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0xFD, 0xA1, 0xE1, 0x81, 0xE1, 0x81, 0xE1, 0x85, 0xC4, 0x81, + 0xD0, 0x84, 0xD1, 0x80, 0x28, 0x07, 0x27, 0x06, 0x9C, 0x84, 0xDC, 0x84, 0xE8, 0x84, 0xE8, 0x84, + 0xE8, 0x85, 0x94, 0xF3, 0xC7, 0x83, 0x01, 0x26, 0x60, 0x47, 0xAB, 0x83, 0xFC, 0xA3, 0x02, 0x00, + 0x03, 0x04, 0x00, 0xF4, 0x84, 0xA3, 0xFC, 0x01, 0x80, 0x65, 0x47, 0xD0, 0x28, 0x41, 0xA0, 0x80, + 0xFE, 0xA1, 0x14, 0x03, 0x08, 0x02, 0x08, 0x60, 0x2D, 0xF1, 0x00, 0x60, 0x10, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x1B, 0x00, 0x08, 0x60, 0x2D, 0xF1, 0x00, 0x60, 0x04, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x13, 0x00, 0x28, 0x41, 0xFE, 0xA1, 0xFF, 0xFF, 0x08, 0x03, 0x08, 0x60, + 0x2D, 0xF1, 0x00, 0x60, 0x08, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x07, 0x00, 0x08, 0x60, + 0x2D, 0xF1, 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x08, 0x60, 0x1B, 0xF1, + 0x00, 0x60, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x26, 0x46, 0x2F, 0x58, 0xFF, 0xFF, + 0x08, 0x60, 0x1B, 0xF1, 0x00, 0x60, 0x20, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x08, 0x60, 0x1B, 0xF1, 0x02, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x63, 0x95, 0xFD, 0x1C, 0x60, 0x9E, 0x63, 0x00, 0x64, 0xA3, 0xDB, + 0x06, 0xA3, 0x10, 0x60, 0x98, 0x64, 0xBD, 0xDB, 0xBD, 0xDB, 0x06, 0x64, 0xA3, 0xDB, 0xE9, 0x60, + 0xB8, 0x64, 0x08, 0x60, 0x4B, 0xFB, 0xCE, 0xF1, 0x0E, 0x60, 0x51, 0xF9, 0x1C, 0x60, 0xAA, 0x63, + 0x00, 0x64, 0xA3, 0xDB, 0x06, 0xA3, 0x10, 0x60, 0x9C, 0x64, 0xBD, 0xDB, 0xBD, 0xDB, 0x06, 0x64, + 0xA3, 0xDB, 0xE9, 0x60, 0xC1, 0x64, 0x08, 0x60, 0x4D, 0xFB, 0x16, 0x60, 0xAE, 0xF1, 0x0E, 0x60, + 0x57, 0xF9, 0x00, 0x60, 0x3A, 0x61, 0xB6, 0x60, 0x58, 0x4D, 0x22, 0x78, 0xFF, 0xFF, 0x66, 0x44, + 0x63, 0xFB, 0xA6, 0xF3, 0x07, 0xFA, 0xB9, 0xF3, 0x19, 0xFA, 0xF8, 0x60, 0x80, 0x64, 0x0E, 0xFA, + 0x00, 0x64, 0x3E, 0xFA, 0x3F, 0xFA, 0x00, 0x60, 0x3A, 0x61, 0xB6, 0x60, 0x58, 0x4D, 0x22, 0x78, + 0xFF, 0xFF, 0x66, 0x44, 0x64, 0xFB, 0xA6, 0xF3, 0x07, 0xFA, 0xB9, 0xF3, 0x19, 0xFA, 0x24, 0x60, + 0x80, 0x64, 0x0E, 0xFA, 0x00, 0x64, 0x3E, 0xFA, 0x3F, 0xFA, 0x00, 0x64, 0x08, 0x60, 0x2D, 0xFB, + 0x5A, 0xDB, 0xEA, 0x60, 0x1F, 0x64, 0x08, 0x60, 0x37, 0xFB, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x63, + 0x95, 0xFD, 0xBA, 0xFE, 0xFE, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x82, 0xFD, 0x08, 0x60, + 0x15, 0xF1, 0x04, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x00, 0x64, 0x08, 0x60, + 0x1B, 0xFB, 0x5A, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0x16, 0x60, 0xAB, 0xF3, 0xFF, 0xFF, 0x01, 0xA8, + 0xFF, 0xFF, 0x05, 0x03, 0x19, 0x60, 0xF0, 0xF1, 0x0E, 0x60, 0x57, 0xF9, 0x04, 0x00, 0x16, 0x60, + 0xAE, 0xF1, 0x0E, 0x60, 0x57, 0xF9, 0x16, 0x60, 0xAB, 0xF3, 0xFF, 0xFF, 0x09, 0x1B, 0x00, 0x64, + 0x82, 0xFB, 0xBA, 0xFE, 0x00, 0x64, 0x08, 0x60, 0x1B, 0xFB, 0x5A, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, + 0xBA, 0xFE, 0x95, 0xF3, 0x00, 0x63, 0x82, 0xFD, 0x10, 0xBC, 0x95, 0xFB, 0xFE, 0x60, 0xFF, 0x65, + 0x20, 0x44, 0x24, 0x80, 0x08, 0x60, 0x08, 0xF1, 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0x00, 0x60, 0x64, 0x63, 0x0E, 0x60, 0x37, 0xFD, 0x10, 0x60, 0x36, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x01, 0x60, 0x04, 0x64, 0x08, 0x60, 0x1C, 0xFB, 0xEA, 0x60, 0x73, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x1B, 0xF1, 0x01, 0x60, 0x00, 0x64, 0xA0, 0x80, + 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xA2, 0x01, 0x31, 0x40, 0x04, 0x2A, 0xE5, 0x01, + 0x20, 0x40, 0x12, 0x23, 0x11, 0x00, 0x10, 0x60, 0x36, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x10, 0x60, + 0x5A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x81, 0x60, 0x00, 0x64, 0x08, 0x60, 0x1C, 0xFB, 0xEA, 0x60, + 0x73, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0xDD, 0x01, 0x10, 0x60, 0x36, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x01, 0x60, 0x00, 0x65, 0x20, 0x44, 0x34, 0x80, 0x64, 0xF5, 0xB9, 0xF1, 0x19, 0xF8, 0x7F, 0xF1, + 0x2C, 0xF8, 0x32, 0xF8, 0x80, 0xF1, 0x2D, 0xF8, 0x33, 0xF8, 0x81, 0xF1, 0x2E, 0xF8, 0x34, 0xF8, + 0xEA, 0xF1, 0x2F, 0xF8, 0xEB, 0xF1, 0x30, 0xF8, 0xEC, 0xF1, 0x31, 0xF8, 0x11, 0x60, 0x48, 0x64, + 0x2A, 0xFA, 0x00, 0x64, 0x2B, 0xFA, 0x23, 0xFA, 0x25, 0x60, 0xCE, 0x64, 0x13, 0x60, 0x0D, 0xFB, + 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x00, 0x60, + 0x01, 0x64, 0x08, 0x60, 0x1C, 0xFB, 0xEA, 0x60, 0xC9, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x64, 0xF5, 0x23, 0xF2, 0xFF, 0xFF, 0x01, 0x18, 0x82, 0x01, 0x10, 0x67, 0x82, 0xFB, + 0x03, 0x64, 0x96, 0xFB, 0xFE, 0x60, 0xFF, 0x65, 0x20, 0x44, 0x24, 0x80, 0x08, 0x60, 0x08, 0xF1, + 0x80, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x10, 0x60, 0x36, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0x81, 0x60, 0x00, 0x64, 0x08, 0x60, 0x1C, 0xFB, 0xEA, 0x60, 0xEA, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x0C, 0x00, 0x08, 0x60, 0x1B, 0xF1, 0x01, 0x60, 0x00, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x05, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xEA, 0x60, 0x1F, 0x78, 0xFF, 0xFF, 0x06, 0x60, 0x00, 0x65, + 0x20, 0x41, 0x8C, 0xF3, 0xA5, 0x80, 0x01, 0xB0, 0x01, 0x02, 0x06, 0x00, 0x10, 0x60, 0x36, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0x1C, 0x60, 0x6E, 0x65, 0xA5, 0xD3, 0x01, 0x63, + 0x8A, 0xFD, 0x26, 0x1B, 0x00, 0x60, 0x64, 0x64, 0xA5, 0xDB, 0x64, 0xF5, 0xB9, 0xF1, 0x19, 0xF8, + 0x7F, 0xF1, 0x2C, 0xF8, 0x32, 0xF8, 0x80, 0xF1, 0x2D, 0xF8, 0x33, 0xF8, 0x81, 0xF1, 0x2E, 0xF8, + 0x34, 0xF8, 0xEA, 0xF1, 0x2F, 0xF8, 0xEB, 0xF1, 0x30, 0xF8, 0xEC, 0xF1, 0x31, 0xF8, 0x11, 0x60, + 0x48, 0x64, 0x2A, 0xFA, 0x00, 0x64, 0x2B, 0xFA, 0x23, 0xFA, 0x25, 0x60, 0xCE, 0x64, 0x13, 0x60, + 0x0D, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x06, 0x00, + 0x95, 0xF3, 0x32, 0x40, 0x02, 0x26, 0x02, 0x00, 0x40, 0x2A, 0xDA, 0xFE, 0xC1, 0xFE, 0x10, 0x60, + 0x36, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x01, 0x60, 0x82, 0x64, 0x08, 0x60, 0x1C, 0xFB, 0xEB, 0x60, + 0x45, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x1B, 0xF1, 0x01, 0x60, + 0x00, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xEA, 0x60, 0x1F, 0x78, + 0xFF, 0xFF, 0x00, 0x60, 0x02, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x06, 0x03, 0xA0, 0x84, 0xA2, 0xDB, + 0xBA, 0xFE, 0xED, 0x60, 0x6D, 0x78, 0xFF, 0xFF, 0x02, 0x64, 0x8A, 0xFB, 0x01, 0x60, 0x00, 0x65, + 0x20, 0x44, 0x34, 0x80, 0xBA, 0xFE, 0xC1, 0xFE, 0x10, 0x60, 0x36, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x10, 0x60, 0x5A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x01, 0x60, 0x46, 0x64, 0x08, 0x60, 0x1C, 0xFB, + 0xEB, 0x60, 0x76, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x1B, 0xF1, + 0x01, 0x60, 0x00, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xEA, 0x60, + 0x1F, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x45, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0x08, 0x60, 0x2D, 0xF1, 0x00, 0x60, 0x08, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x0F, 0x03, + 0xA0, 0x84, 0xA2, 0xDB, 0x08, 0x60, 0x1B, 0xF1, 0x00, 0x60, 0x02, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x05, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xED, 0x60, 0x6D, 0x78, 0xFF, 0xFF, 0x31, 0x01, 0x00, 0x60, + 0x02, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x0B, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x16, 0x60, 0xAC, 0xF1, + 0x95, 0xF3, 0x00, 0x61, 0xD1, 0x80, 0xF7, 0xB4, 0xF1, 0x03, 0x95, 0xFB, 0x33, 0x00, 0x00, 0x60, + 0x10, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x0E, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x16, 0x60, 0xAC, 0xF1, + 0x95, 0xF3, 0x00, 0x61, 0xD1, 0x80, 0x08, 0xBC, 0x03, 0x02, 0xEC, 0x60, 0x9C, 0x78, 0xFF, 0xFF, + 0x95, 0xFB, 0x20, 0x00, 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0xEC, 0x60, 0x9C, 0x78, 0xFF, 0xFF, 0x08, 0x60, 0x1B, 0xF1, 0x00, 0x60, 0x40, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xC8, 0x01, 0x00, 0x60, 0x02, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0x05, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xED, 0x60, 0x6D, 0x78, 0xFF, 0xFF, + 0x2F, 0x58, 0xFF, 0xFF, 0x02, 0x63, 0x95, 0xF3, 0x8A, 0xFD, 0x01, 0xBC, 0xC1, 0xFE, 0x95, 0xFB, + 0xCE, 0xF1, 0x0E, 0x60, 0x51, 0xF9, 0x10, 0x60, 0x36, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x10, 0x60, + 0x5A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x01, 0x60, 0x34, 0x64, 0x08, 0x60, 0x1C, 0xFB, 0xEC, 0x60, + 0x05, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x1C, 0x60, 0x9E, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x1B, 0xF1, 0x01, 0x60, + 0x00, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x0D, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x1C, 0x60, 0x9E, 0x64, + 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0xEA, 0x60, 0x1F, 0x78, + 0xFF, 0xFF, 0x00, 0x60, 0x10, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x22, 0x03, 0xA0, 0x84, 0xA2, 0xDB, + 0x95, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x04, 0x2A, 0x01, 0x00, 0xD5, 0x01, 0x1C, 0x60, 0x9E, 0x64, + 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x95, 0xF3, 0xFF, 0xFF, + 0x60, 0x40, 0x08, 0x2A, 0x01, 0x00, 0x68, 0x00, 0x08, 0x60, 0x1B, 0xF1, 0x00, 0x60, 0x02, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0x59, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xED, 0x60, 0x6D, 0x78, 0xFF, 0xFF, + 0x08, 0x60, 0x2D, 0xF1, 0x00, 0x60, 0x10, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x08, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0x95, 0xF3, 0xFF, 0xFF, 0x08, 0xBC, 0x95, 0xFB, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x60, + 0x02, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xA4, 0x01, 0x00, 0x60, + 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x0B, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x1C, 0x60, 0x9E, 0x64, + 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x35, 0x00, 0x00, 0x60, + 0x08, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x0B, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x1C, 0x60, 0x9E, 0x64, + 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x1E, 0x00, 0x08, 0x60, + 0x1B, 0xF1, 0x00, 0x60, 0x20, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x14, 0x03, 0xA0, 0x84, 0xA2, 0xDB, + 0x95, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x08, 0x2A, 0x01, 0x00, 0x16, 0x00, 0x08, 0x60, 0x1B, 0xF1, + 0x00, 0x60, 0x02, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x08, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xED, 0x60, + 0x6D, 0x78, 0xFF, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x00, 0x95, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, + 0x95, 0xFB, 0xEA, 0x60, 0xD0, 0x78, 0xFF, 0xFF, 0x16, 0x60, 0xAB, 0xF3, 0xFF, 0xFF, 0x01, 0xA8, + 0xFF, 0xFF, 0x03, 0x02, 0xED, 0x60, 0x76, 0x78, 0xFF, 0xFF, 0x95, 0xF3, 0x01, 0x63, 0x8A, 0xFD, + 0x21, 0xBC, 0x95, 0xFB, 0x63, 0xF5, 0x7F, 0xF1, 0x2C, 0xF8, 0x80, 0xF1, 0x2D, 0xF8, 0x81, 0xF1, + 0x2E, 0xF8, 0x83, 0xF1, 0xC0, 0x67, 0xB0, 0x84, 0x2B, 0xFA, 0xB9, 0xF1, 0x19, 0xF8, 0xEA, 0xF1, + 0x2F, 0xF8, 0xEB, 0xF1, 0x30, 0xF8, 0xEC, 0xF1, 0x31, 0xF8, 0x10, 0x60, 0xA4, 0x64, 0x2A, 0xFA, + 0x25, 0x60, 0xCE, 0x64, 0x13, 0x60, 0x0D, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x00, 0x60, 0x50, 0x64, 0x0E, 0x60, 0x51, 0xFB, 0x1C, 0x60, + 0x9E, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x10, 0x60, + 0x36, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x10, 0x60, 0x5A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x01, 0x60, + 0x2C, 0x64, 0x08, 0x60, 0x1C, 0xFB, 0xEC, 0x60, 0xE9, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x08, 0x60, 0x1B, 0xF1, 0x01, 0x60, 0x00, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x0D, 0x03, + 0xA0, 0x84, 0xA2, 0xDB, 0x1C, 0x60, 0x9E, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, + 0xFF, 0xFF, 0x04, 0xFF, 0xEA, 0x60, 0x1F, 0x78, 0xFF, 0xFF, 0x08, 0x60, 0x2D, 0xF1, 0x00, 0x60, + 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x95, 0x01, 0x08, 0x60, + 0x1B, 0xF1, 0x00, 0x60, 0x08, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x08, 0x03, 0xA0, 0x84, 0xA2, 0xDB, + 0x95, 0xF3, 0xFF, 0xFF, 0x02, 0xB0, 0xFF, 0xFF, 0x49, 0x03, 0x86, 0x01, 0x00, 0x60, 0x08, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x40, 0x00, 0x00, 0x60, 0x02, 0x64, + 0xA0, 0x80, 0x9C, 0x84, 0x14, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x1C, 0x60, 0x9E, 0x64, 0x13, 0x60, + 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x16, 0x60, 0xAC, 0xF3, 0x95, 0xF3, + 0x00, 0xA8, 0xF7, 0xB4, 0x2B, 0x03, 0x95, 0xFB, 0xEB, 0x60, 0xE2, 0x78, 0xFF, 0xFF, 0x00, 0x60, + 0x10, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x15, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x1C, 0x60, 0x9E, 0x64, + 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x16, 0x60, 0xAC, 0xF3, + 0x95, 0xF3, 0x00, 0xA8, 0x08, 0xBC, 0x01, 0x02, 0x4F, 0x01, 0x95, 0xFB, 0xEB, 0x60, 0xE2, 0x78, + 0xFF, 0xFF, 0x08, 0x60, 0x1B, 0xF1, 0x00, 0x60, 0x20, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, + 0xA0, 0x84, 0xA2, 0xDB, 0x02, 0x00, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x00, 0x1C, 0x60, 0x9E, 0x64, + 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x95, 0xF3, 0xFF, 0xFF, + 0xFE, 0xB4, 0x95, 0xFB, 0xEA, 0x60, 0xD0, 0x78, 0xFF, 0xFF, 0x95, 0xF3, 0x01, 0x63, 0x8A, 0xFD, + 0x01, 0xBC, 0x95, 0xFB, 0x00, 0x64, 0x82, 0xFB, 0xC1, 0xFE, 0x28, 0x00, 0x95, 0xF3, 0x01, 0x63, + 0x8A, 0xFD, 0x01, 0xBC, 0x95, 0xFB, 0x00, 0x64, 0x82, 0xFB, 0x63, 0xF5, 0x7F, 0xF1, 0x2C, 0xF8, + 0x80, 0xF1, 0x2D, 0xF8, 0x81, 0xF1, 0x2E, 0xF8, 0x83, 0xF1, 0xC0, 0x67, 0xB0, 0x84, 0x2B, 0xFA, + 0xB9, 0xF1, 0x19, 0xF8, 0xEA, 0xF1, 0x2F, 0xF8, 0xEB, 0xF1, 0x30, 0xF8, 0xEC, 0xF1, 0x31, 0xF8, + 0x00, 0x60, 0xA4, 0x64, 0x2A, 0xFA, 0x25, 0x60, 0xCE, 0x64, 0x13, 0x60, 0x0D, 0xFB, 0x66, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x1C, 0x60, 0xAA, 0x64, + 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x10, 0x60, 0x36, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x10, 0x60, 0x5A, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x03, 0x60, 0x0E, 0x64, + 0x08, 0x60, 0x1C, 0xFB, 0xED, 0x60, 0xB8, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x08, 0x60, 0x1B, 0xF1, 0x01, 0x60, 0x00, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x0D, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0x1C, 0x60, 0xAA, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0xEA, 0x60, 0x1F, 0x78, 0xFF, 0xFF, 0x00, 0x60, 0x0A, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xCA, 0x01, 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, + 0x14, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x08, 0x60, 0x2D, 0xF1, 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, + 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x91, 0x01, 0x00, 0x60, 0x12, 0x64, 0xA0, 0x80, + 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0xB1, 0x01, 0x08, 0x60, 0x1B, 0xF1, 0x02, 0x60, + 0x00, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0xB2, 0x03, 0xA0, 0x84, 0xA2, 0xDB, 0x10, 0x67, 0x82, 0xFB, + 0x10, 0x60, 0x36, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x10, 0x60, 0x5A, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x64, 0xF5, 0xB9, 0xF1, 0x19, 0xF8, 0x7F, 0xF1, 0x2C, 0xF8, 0x32, 0xF8, 0x80, 0xF1, 0x2D, 0xF8, + 0x33, 0xF8, 0x81, 0xF1, 0x2E, 0xF8, 0x34, 0xF8, 0xEA, 0xF1, 0x2F, 0xF8, 0xEB, 0xF1, 0x30, 0xF8, + 0xEC, 0xF1, 0x31, 0xF8, 0x11, 0x60, 0x48, 0x64, 0x2A, 0xFA, 0x00, 0x64, 0x2B, 0xFA, 0x23, 0xFA, + 0x25, 0x60, 0xCE, 0x64, 0x13, 0x60, 0x0D, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0x95, 0xF3, 0xC1, 0xFE, 0xFE, 0xB4, 0x95, 0xFB, 0x00, 0x60, 0x03, 0x64, + 0x08, 0x60, 0x1C, 0xFB, 0xEE, 0x60, 0x30, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x08, 0x60, 0x1B, 0xF1, 0x00, 0x60, 0x02, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0x33, 0x01, 0x64, 0xF5, 0x23, 0xF2, 0x96, 0xF3, 0x04, 0x18, 0xCC, 0x84, 0x96, 0xFB, + 0x01, 0x03, 0x2B, 0x01, 0xEA, 0x60, 0xD0, 0x78, 0xFF, 0xFF, 0x16, 0x60, 0xAB, 0xF3, 0x82, 0xF1, + 0x02, 0xA8, 0x2A, 0xF2, 0x03, 0x02, 0xB0, 0x84, 0x2A, 0xFA, 0x07, 0x00, 0x08, 0x60, 0x1B, 0xF1, + 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x25, 0x60, 0xC8, 0x64, 0x13, 0x60, + 0x0D, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, + 0x12, 0x60, 0xED, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0xDF, 0x02, 0xCA, 0x60, 0xD4, 0x78, + 0xFF, 0xFF, 0x10, 0x60, 0x48, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x00, 0x60, 0x06, 0x64, 0x08, 0x60, + 0x25, 0xFB, 0xEE, 0x60, 0x77, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x60, + 0x18, 0x64, 0x08, 0x60, 0x25, 0xFB, 0xEE, 0x60, 0x77, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x26, 0x46, 0x00, 0xF4, 0xDB, 0xF3, 0xFF, 0xFF, 0x07, 0xB4, 0x03, 0x36, 0x1B, 0x00, + 0x0E, 0xF0, 0x19, 0x60, 0x7B, 0xF3, 0xFF, 0xFF, 0xEF, 0xB4, 0x60, 0x44, 0x64, 0x40, 0x04, 0x27, + 0x07, 0x00, 0xA2, 0xDB, 0x13, 0x64, 0xCB, 0xFB, 0x01, 0x60, 0x67, 0x64, 0x37, 0xFB, 0x0B, 0x00, + 0x10, 0xBC, 0xA2, 0xDB, 0x08, 0x64, 0xCB, 0xFB, 0xA1, 0xF3, 0x01, 0x60, 0x67, 0x7C, 0x60, 0x40, + 0x01, 0x27, 0x5B, 0x7C, 0x37, 0xF9, 0x26, 0x46, 0x3F, 0xF2, 0x00, 0xF4, 0x60, 0x43, 0xF4, 0xA3, + 0x00, 0x60, 0x1D, 0x61, 0x00, 0x60, 0x2A, 0x65, 0x01, 0x60, 0xFF, 0x64, 0x40, 0x4C, 0xFD, 0x60, + 0x58, 0x4E, 0x7A, 0x78, 0xFF, 0xFF, 0x00, 0xBB, 0xFF, 0xFF, 0x01, 0x02, 0x3B, 0x00, 0x02, 0x60, + 0x01, 0x63, 0xA3, 0xD1, 0xDB, 0xF3, 0xFF, 0xFF, 0x07, 0xB4, 0x03, 0x36, 0x1F, 0x00, 0x19, 0x60, + 0x45, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x26, 0x09, 0x00, 0x19, 0x60, 0x7B, 0xF3, 0xFF, 0xFF, + 0xFD, 0xB4, 0x60, 0x44, 0x64, 0x40, 0x02, 0x27, 0x02, 0xBC, 0xA2, 0xDB, 0x19, 0x60, 0x45, 0xF3, + 0xFF, 0xFF, 0x60, 0x40, 0x02, 0x26, 0x1C, 0x00, 0x19, 0x60, 0x7B, 0xF3, 0xFF, 0xFF, 0xFB, 0xB4, + 0x60, 0x44, 0x64, 0x40, 0x04, 0x27, 0x04, 0xBC, 0xA2, 0xDB, 0x12, 0x00, 0x64, 0x40, 0x02, 0x2B, + 0x06, 0x00, 0x19, 0x60, 0x7B, 0xF3, 0xFF, 0xFF, 0x02, 0xBC, 0x60, 0x44, 0xA2, 0xDB, 0x64, 0x40, + 0x04, 0x2B, 0x06, 0x00, 0x19, 0x60, 0x7B, 0xF3, 0xFF, 0xFF, 0x04, 0xBC, 0x60, 0x44, 0xA2, 0xDB, + 0x2F, 0x58, 0xFF, 0xFF, 0x0E, 0xF0, 0xDB, 0xF3, 0xFF, 0xFF, 0x07, 0xB4, 0x03, 0x36, 0x18, 0x00, + 0x19, 0x60, 0x7B, 0xF3, 0xFF, 0xFF, 0x02, 0xBC, 0x60, 0x44, 0xFB, 0xB4, 0x60, 0x44, 0x64, 0x40, + 0x20, 0x2A, 0x0A, 0x00, 0x60, 0x43, 0x19, 0x60, 0x45, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x02, 0x26, + 0x02, 0x00, 0x63, 0x44, 0x02, 0x00, 0x63, 0x44, 0x04, 0xBC, 0x19, 0x60, 0x7B, 0xFB, 0x09, 0x00, + 0x64, 0x40, 0x20, 0x26, 0x06, 0x00, 0x19, 0x60, 0x7B, 0xF3, 0xFF, 0xFF, 0x04, 0xBC, 0x60, 0x44, + 0xA2, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x60, 0xB0, 0x61, 0xB6, 0x60, 0x58, 0x4D, 0x25, 0x78, + 0xFF, 0xFF, 0x66, 0x44, 0x5C, 0xFB, 0x04, 0x64, 0x03, 0xFA, 0x80, 0x64, 0x2A, 0xFA, 0xC9, 0xF1, + 0x19, 0xF8, 0x00, 0x64, 0x3E, 0xFA, 0x00, 0x60, 0x80, 0x64, 0x0E, 0xFA, 0xA6, 0xF1, 0x07, 0xF8, + 0x67, 0x44, 0x2C, 0xFA, 0x2D, 0xFA, 0x2E, 0xFA, 0xF1, 0x60, 0x2C, 0x64, 0x08, 0x60, 0x31, 0xFB, + 0x2F, 0x58, 0xFF, 0xFF, 0x5C, 0xF5, 0xEA, 0xF1, 0x2F, 0xF8, 0xEB, 0xF1, 0x30, 0xF8, 0xEC, 0xF1, + 0x31, 0xF8, 0x7F, 0xF1, 0x32, 0xF8, 0x80, 0xF1, 0x33, 0xF8, 0x81, 0xF1, 0x34, 0xF8, 0x16, 0x60, + 0xC2, 0xF1, 0x02, 0x64, 0x64, 0x40, 0xFE, 0x26, 0x10, 0xBC, 0x32, 0x40, 0x08, 0x26, 0x10, 0xBC, + 0x20, 0xBC, 0xFB, 0x60, 0xFF, 0x65, 0x60, 0x44, 0xA4, 0x84, 0x1B, 0x60, 0x09, 0xFB, 0x16, 0x60, + 0xC1, 0xF1, 0x33, 0x60, 0xBE, 0x64, 0x02, 0x18, 0x2D, 0x60, 0x32, 0x64, 0x1A, 0x60, 0xAD, 0xFB, + 0x1A, 0x60, 0xBD, 0xFB, 0x34, 0x60, 0x18, 0x61, 0x17, 0x60, 0x14, 0xF3, 0x35, 0x60, 0x36, 0x65, + 0xFE, 0xA4, 0xE0, 0x84, 0x06, 0x05, 0x67, 0x44, 0x1A, 0x60, 0xB5, 0xFB, 0x1A, 0x60, 0xC5, 0xFB, + 0x4B, 0x00, 0xE0, 0x84, 0xC4, 0x85, 0x1A, 0x60, 0x1F, 0xF3, 0xA5, 0xD1, 0xDA, 0x85, 0xA0, 0x83, + 0x1A, 0x60, 0x1B, 0xFD, 0xA5, 0xD1, 0x34, 0x60, 0x34, 0x62, 0xA0, 0x83, 0xA2, 0xDD, 0x67, 0x44, + 0x1A, 0x60, 0xB5, 0xFB, 0x1A, 0x60, 0xC5, 0xFB, 0x1A, 0x60, 0x2C, 0xF3, 0xFF, 0xFF, 0x21, 0x18, + 0x33, 0x60, 0xF4, 0x61, 0x0F, 0x60, 0x00, 0x7C, 0x00, 0x60, 0xAC, 0x65, 0xEF, 0x60, 0x58, 0x4D, + 0xC1, 0x78, 0xFF, 0xFF, 0x1A, 0x60, 0x2D, 0xF1, 0x59, 0xD9, 0x33, 0x60, 0xF2, 0x65, 0xD5, 0x84, + 0x30, 0x7F, 0xA5, 0xDB, 0x65, 0x44, 0x1A, 0x60, 0xB5, 0xFB, 0x1A, 0x60, 0xC5, 0xFB, 0x1A, 0x60, + 0x2C, 0xF3, 0xFF, 0xFF, 0xFE, 0xA4, 0xFF, 0xFF, 0x08, 0x24, 0x03, 0x00, 0xFF, 0x60, 0xFF, 0x64, + 0x13, 0x00, 0x34, 0x60, 0x18, 0x61, 0x50, 0x60, 0x00, 0x7C, 0x00, 0x60, 0xF2, 0x65, 0xEF, 0x60, + 0x58, 0x4D, 0xC1, 0x78, 0xFF, 0xFF, 0x1A, 0x60, 0x1D, 0xF1, 0x59, 0xD9, 0x34, 0x60, 0x12, 0x65, + 0xD5, 0x84, 0xDD, 0x7F, 0xA5, 0xDB, 0x65, 0x44, 0x1A, 0x60, 0xB2, 0xFB, 0x1A, 0x60, 0xC2, 0xFB, + 0x79, 0x00, 0x1A, 0x60, 0x1E, 0xF3, 0x34, 0x60, 0x34, 0x62, 0xFD, 0xA0, 0xA2, 0xD3, 0xEE, 0x03, + 0x60, 0x40, 0x02, 0x2A, 0x02, 0x00, 0x01, 0x63, 0x0B, 0x00, 0x04, 0x2A, 0x02, 0x00, 0x02, 0x63, + 0x07, 0x00, 0x10, 0x2A, 0x02, 0x00, 0x04, 0x63, 0x03, 0x00, 0x20, 0x2A, 0x01, 0x00, 0x05, 0x63, + 0x63, 0x47, 0xB4, 0x83, 0x59, 0xD9, 0x59, 0xDD, 0x1A, 0x60, 0x1E, 0xF3, 0x1A, 0x60, 0x1B, 0xF3, + 0xFE, 0xA0, 0x40, 0x4C, 0xD3, 0x03, 0x00, 0x60, 0x00, 0x63, 0x59, 0xDD, 0x41, 0x4A, 0x2C, 0x40, + 0x01, 0x2A, 0x05, 0x00, 0x00, 0x63, 0x63, 0x47, 0xB4, 0x83, 0x59, 0xD9, 0x59, 0xDD, 0x2C, 0x40, + 0x02, 0x2A, 0x03, 0x00, 0x01, 0x63, 0x59, 0xD9, 0x59, 0xDD, 0x2C, 0x40, 0x04, 0x2A, 0x05, 0x00, + 0x02, 0x63, 0x63, 0x47, 0xB4, 0x83, 0x59, 0xD9, 0x59, 0xDD, 0x2C, 0x40, 0x10, 0x2A, 0x05, 0x00, + 0x04, 0x63, 0x63, 0x47, 0xB4, 0x83, 0x59, 0xD9, 0x59, 0xDD, 0x2C, 0x40, 0x20, 0x2A, 0x05, 0x00, + 0x05, 0x63, 0x63, 0x47, 0xB4, 0x83, 0x59, 0xD9, 0x59, 0xDD, 0x2A, 0x44, 0x51, 0x93, 0xEB, 0x83, + 0xEB, 0x83, 0xA0, 0xDD, 0x1A, 0x60, 0x1E, 0xF3, 0x1A, 0x60, 0x1C, 0xF3, 0xFF, 0xA0, 0x40, 0x4C, + 0x9D, 0x03, 0x59, 0xDF, 0x41, 0x4A, 0x2C, 0x40, 0x01, 0x2A, 0x05, 0x00, 0x00, 0x63, 0x63, 0x47, + 0xB4, 0x83, 0x59, 0xD9, 0x59, 0xDD, 0x2C, 0x40, 0x02, 0x2A, 0x05, 0x00, 0x01, 0x63, 0x63, 0x47, + 0xB4, 0x83, 0x59, 0xD9, 0x59, 0xDD, 0x2C, 0x40, 0x04, 0x2A, 0x05, 0x00, 0x02, 0x63, 0x63, 0x47, + 0xB4, 0x83, 0x59, 0xD9, 0x59, 0xDD, 0x2A, 0x44, 0x51, 0x93, 0xEB, 0x83, 0xEB, 0x83, 0xA0, 0xDD, + 0x2D, 0x58, 0xFF, 0xFF, 0x00, 0x60, 0x04, 0x64, 0x08, 0x60, 0x0A, 0xFB, 0xF0, 0x60, 0x44, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, 0x12, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0x7D, 0xF1, 0x35, 0x60, 0xCC, 0x64, 0x64, 0x40, 0x01, 0x2B, 0x01, 0x00, 0x67, 0x44, 0x1A, 0x60, + 0xAF, 0xFB, 0x1A, 0x60, 0xBF, 0xFB, 0x1A, 0x60, 0xE7, 0xF9, 0x35, 0x60, 0x62, 0x65, 0xF1, 0x60, + 0x58, 0x4D, 0x74, 0x78, 0xFF, 0xFF, 0x7D, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x2B, 0x05, 0x00, + 0xFF, 0x60, 0xFF, 0x63, 0x1A, 0x60, 0xB3, 0xFD, 0x08, 0x00, 0x36, 0x60, 0x04, 0x63, 0x1A, 0x60, + 0xB3, 0xFD, 0xF1, 0x60, 0x58, 0x4D, 0x8C, 0x78, 0xFF, 0xFF, 0x5C, 0xF5, 0x00, 0xF4, 0x7E, 0xF1, + 0x06, 0xF8, 0x1B, 0x60, 0x09, 0xF3, 0x19, 0x60, 0x7B, 0xF1, 0xFB, 0x60, 0xFF, 0x65, 0x60, 0x44, + 0xA4, 0x84, 0x60, 0x47, 0x64, 0x40, 0x10, 0x26, 0x04, 0xBC, 0x60, 0x47, 0x07, 0xFA, 0x35, 0x60, + 0x5A, 0x64, 0x40, 0x48, 0x10, 0x61, 0x00, 0x60, 0x00, 0x64, 0xF1, 0x60, 0x58, 0x4D, 0x34, 0x78, + 0xFF, 0xFF, 0x5C, 0xF5, 0x3F, 0xFC, 0xDB, 0xFE, 0x25, 0x60, 0xCE, 0x64, 0x13, 0x60, 0x0D, 0xFB, + 0x66, 0x44, 0x5A, 0xDB, 0x04, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0xDB, 0xF3, 0x9B, 0xFE, 0xFD, 0xA0, 0x25, 0x04, 0x24, 0x02, 0x04, 0x64, 0x03, 0xFA, + 0x00, 0xF4, 0x09, 0xF2, 0xFF, 0xFF, 0x60, 0x47, 0x00, 0x3A, 0x1C, 0x00, 0x60, 0x43, 0x00, 0x36, + 0x1C, 0x00, 0xE0, 0xA0, 0xDA, 0x85, 0x16, 0x07, 0x33, 0x60, 0xBE, 0x61, 0xA1, 0xD1, 0xFF, 0xFF, + 0xD3, 0x80, 0xCB, 0x83, 0x0F, 0x02, 0x07, 0x0E, 0x59, 0xD3, 0xA5, 0xD0, 0xDA, 0x85, 0xD0, 0x80, + 0xFF, 0xFF, 0x08, 0x02, 0xF9, 0x1F, 0x12, 0x1E, 0xA5, 0xD0, 0x59, 0xD3, 0xFF, 0xFF, 0x90, 0x80, + 0xFF, 0x22, 0x0C, 0x00, 0xF1, 0x60, 0x2A, 0x78, 0xFF, 0xFF, 0x16, 0x60, 0xC1, 0xF3, 0xFF, 0xFF, + 0x60, 0x40, 0x01, 0x2A, 0x03, 0x00, 0x2D, 0x60, 0x32, 0x64, 0x02, 0x00, 0x33, 0x60, 0xBE, 0x64, + 0x1A, 0x60, 0xBD, 0xFB, 0x26, 0x46, 0x2F, 0xF2, 0x2C, 0xFA, 0x30, 0xF2, 0x2D, 0xFA, 0x31, 0xF2, + 0x2E, 0xFA, 0xEA, 0xF1, 0x2F, 0xF8, 0xEB, 0xF1, 0x30, 0xF8, 0xEC, 0xF1, 0x31, 0xF8, 0x7F, 0xF1, + 0x32, 0xF8, 0x80, 0xF1, 0x33, 0xF8, 0x81, 0xF1, 0x34, 0xF8, 0x00, 0x65, 0xFD, 0x60, 0x58, 0x4E, + 0xDD, 0x78, 0xFF, 0xFF, 0x61, 0x44, 0x19, 0x60, 0x3F, 0xFB, 0x50, 0x63, 0x2A, 0xFC, 0xC9, 0xF3, + 0x19, 0xFA, 0x00, 0x64, 0x3E, 0xFA, 0xA6, 0xF3, 0x07, 0xFA, 0x00, 0xF4, 0x7E, 0xF1, 0x06, 0xF8, + 0x1B, 0x60, 0x09, 0xF3, 0x19, 0x60, 0x7B, 0xF1, 0xFB, 0x60, 0xFF, 0xB7, 0x64, 0x40, 0x10, 0x26, + 0x04, 0xBC, 0x60, 0x47, 0x07, 0xFA, 0x35, 0x60, 0x82, 0x65, 0xF1, 0x60, 0x58, 0x4D, 0x74, 0x78, + 0xFF, 0xFF, 0x7D, 0xF3, 0x36, 0x60, 0x04, 0x63, 0x60, 0x40, 0x01, 0x27, 0x67, 0x43, 0x1A, 0x60, + 0xC3, 0xFD, 0x35, 0x60, 0x7A, 0x64, 0x40, 0x48, 0x10, 0x61, 0x00, 0x60, 0x00, 0x64, 0xF1, 0x60, + 0x58, 0x4D, 0x34, 0x78, 0xFF, 0xFF, 0x26, 0x46, 0x3F, 0xFC, 0x25, 0x60, 0xCE, 0x64, 0x13, 0x60, + 0x0D, 0xFB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, + 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x64, 0x08, 0x60, 0x09, 0xFB, 0x5A, 0xDB, + 0x00, 0x64, 0x92, 0xFB, 0x2F, 0x58, 0xFF, 0xFF, 0x1B, 0x60, 0x0A, 0xFB, 0xCD, 0x81, 0x28, 0xD3, + 0x5A, 0x88, 0xDC, 0x83, 0x31, 0x18, 0xFB, 0x03, 0x61, 0x40, 0x7F, 0x3A, 0x06, 0x00, 0x1B, 0x60, + 0x0A, 0xF3, 0x03, 0x61, 0x7C, 0xA4, 0xA2, 0xDB, 0x00, 0xF4, 0x60, 0xFE, 0xA3, 0xD1, 0x5D, 0xD8, + 0x61, 0x40, 0x7F, 0x3A, 0x08, 0x00, 0x20, 0xFE, 0x1B, 0x60, 0x0A, 0xF3, 0x03, 0x61, 0x7C, 0xA4, + 0xA2, 0xDB, 0x00, 0xF4, 0x60, 0xFE, 0xBF, 0xD3, 0x5D, 0xDA, 0xFF, 0xB4, 0x00, 0x7F, 0x12, 0x03, + 0xDF, 0x83, 0x61, 0x40, 0x7F, 0x3A, 0x0A, 0x00, 0x20, 0xFE, 0x60, 0x45, 0x1B, 0x60, 0x0A, 0xF3, + 0x03, 0x61, 0x7C, 0xA4, 0xA2, 0xDB, 0x65, 0x44, 0x00, 0xF4, 0x60, 0xFE, 0xBD, 0xD1, 0xCC, 0x84, + 0x5D, 0xD8, 0xEF, 0x02, 0x20, 0xFE, 0xCB, 0x01, 0x1B, 0x60, 0x0A, 0xF1, 0xFD, 0xA1, 0xFF, 0xB1, + 0xC1, 0x83, 0xA2, 0xDD, 0x2D, 0x58, 0xFF, 0xFF, 0x67, 0x5C, 0x1C, 0x60, 0xE6, 0x61, 0xA1, 0xD3, + 0xA5, 0xD9, 0x10, 0x18, 0x60, 0x43, 0x35, 0x60, 0xD4, 0x64, 0xA5, 0xDB, 0x60, 0xFE, 0xA0, 0xDD, + 0x20, 0xFE, 0xDC, 0x84, 0xCF, 0x83, 0xE3, 0x83, 0x59, 0xD1, 0xDC, 0x84, 0x60, 0xFE, 0xA0, 0xD9, + 0x20, 0xFE, 0xFA, 0x1F, 0x2D, 0x58, 0xFF, 0xFF, 0x19, 0x60, 0x7B, 0xF3, 0x36, 0x60, 0x06, 0x62, + 0x07, 0xB4, 0x60, 0xFE, 0xA2, 0xDB, 0x20, 0xFE, 0x2D, 0x58, 0xFF, 0xFF, 0x0E, 0x57, 0x32, 0x40, + 0x40, 0x26, 0x27, 0x00, 0x45, 0x48, 0x00, 0x60, 0x10, 0x61, 0xB6, 0x60, 0x58, 0x4D, 0x22, 0x78, + 0xFF, 0xFF, 0x1F, 0x03, 0xF2, 0x60, 0x02, 0x64, 0x24, 0xFA, 0x00, 0x60, 0x48, 0x61, 0x28, 0x44, + 0x59, 0xDA, 0x03, 0x64, 0x38, 0x43, 0xBD, 0xD1, 0xCC, 0x84, 0x59, 0xD8, 0xFC, 0x02, 0x39, 0x44, + 0x59, 0xDA, 0x16, 0x60, 0xC3, 0xF3, 0x59, 0xDA, 0x07, 0x64, 0x23, 0xFA, 0x26, 0x60, 0x0A, 0x64, + 0x13, 0x60, 0x0D, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, + 0xFA, 0xFE, 0x37, 0x58, 0xFF, 0xFF, 0x0E, 0x57, 0x32, 0x40, 0x40, 0x26, 0x1B, 0x00, 0x45, 0x48, + 0x00, 0x60, 0x06, 0x61, 0xB6, 0x60, 0x58, 0x4D, 0x22, 0x78, 0xFF, 0xFF, 0x13, 0x03, 0x02, 0x64, + 0x23, 0xFA, 0xF2, 0x60, 0x00, 0x64, 0x5A, 0xDA, 0x28, 0x44, 0x5A, 0xDA, 0xFF, 0xFF, 0x26, 0x60, + 0x0A, 0x64, 0x13, 0x60, 0x0D, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0xFA, 0xFE, 0x37, 0x58, 0xFF, 0xFF, 0xA0, 0xD3, 0xFF, 0xFF, 0xDC, 0x84, 0xDC, 0x80, + 0xD0, 0x80, 0x03, 0x03, 0xA2, 0xDB, 0x08, 0x24, 0xC6, 0xFE, 0xDD, 0x98, 0xFF, 0xFF, 0xB5, 0xF1, + 0xA0, 0xD3, 0xFF, 0xFF, 0xD8, 0x80, 0xC4, 0x84, 0x0C, 0x03, 0x08, 0x05, 0xDC, 0x80, 0xD0, 0x80, + 0x05, 0x03, 0xA2, 0xDB, 0x02, 0x24, 0xC6, 0xFE, 0xDD, 0x98, 0xFF, 0xFF, 0xFF, 0x60, 0xFE, 0x64, + 0xA2, 0xDB, 0xDD, 0x98, 0xFF, 0xFF, 0xA2, 0xFF, 0x32, 0x40, 0x40, 0x26, 0x3C, 0x00, 0x9B, 0xF3, + 0x67, 0x43, 0xDC, 0x84, 0xCC, 0x84, 0x37, 0x03, 0x60, 0x46, 0x0A, 0x02, 0x9B, 0xFD, 0x00, 0x60, + 0x46, 0x61, 0xB6, 0x60, 0x58, 0x4D, 0x22, 0x78, 0xFF, 0xFF, 0x66, 0x44, 0x9B, 0xFB, 0x2C, 0x03, + 0x46, 0x4B, 0x2C, 0x60, 0xCA, 0x61, 0x18, 0x64, 0x23, 0xFA, 0xF1, 0x60, 0x00, 0x64, 0x24, 0xFA, + 0x4A, 0x65, 0xA2, 0xFF, 0x2C, 0x63, 0x59, 0xD1, 0xA2, 0xDF, 0xA5, 0xD8, 0xDA, 0x85, 0x80, 0x3A, + 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0xF7, 0x1F, 0x12, 0x63, 0x59, 0xD1, 0xA5, 0xD8, 0xDA, 0x85, + 0x80, 0x3A, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0xF8, 0x1F, 0x26, 0x60, 0x0A, 0x64, 0x13, 0x60, + 0x0D, 0xFB, 0x2B, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xFA, 0xFE, + 0xA6, 0xFE, 0x00, 0x64, 0x9B, 0xFB, 0xA3, 0xFF, 0xCA, 0x60, 0xD4, 0x78, 0xFF, 0xFF, 0xA6, 0xFE, + 0xBA, 0x05, 0xA7, 0xFE, 0x11, 0x05, 0xA5, 0xFE, 0x03, 0x04, 0xF2, 0x60, 0xD8, 0x78, 0xFF, 0xFF, + 0xA4, 0xFE, 0xF2, 0x04, 0x08, 0x60, 0x0F, 0xF1, 0x00, 0x60, 0x80, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0xCA, 0x60, 0xD4, 0x78, 0xFF, 0xFF, 0x36, 0x45, 0x20, 0x60, 0xA8, 0x64, 0x44, 0xD7, + 0xFF, 0xFF, 0xFF, 0xFF, 0x9D, 0xF3, 0xFF, 0xFF, 0x01, 0xB0, 0x00, 0x64, 0x2F, 0x03, 0x9D, 0xFB, + 0x31, 0x44, 0xE8, 0xB4, 0x40, 0x51, 0x6A, 0x44, 0xFF, 0xFF, 0x80, 0x26, 0xFC, 0x01, 0x61, 0xFF, + 0x62, 0xFF, 0x08, 0x60, 0x30, 0xF1, 0x00, 0x60, 0x20, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x40, 0x60, 0x58, 0x4E, 0x7D, 0x78, 0xFF, 0xFF, 0x1F, 0x60, 0xC4, 0x64, 0x0F, 0x60, 0xE1, 0xFB, + 0x4A, 0xDF, 0x01, 0x60, 0xFE, 0x63, 0x1D, 0x60, 0xBE, 0x61, 0x00, 0x64, 0x59, 0xDB, 0xFE, 0x1F, + 0x0E, 0x60, 0xDD, 0xF3, 0xFF, 0xFF, 0x04, 0xB0, 0xFF, 0xFF, 0x05, 0x03, 0x02, 0x65, 0xF1, 0x60, + 0x58, 0x4E, 0xC3, 0x78, 0xFF, 0xFF, 0xCA, 0x60, 0xD4, 0x78, 0xFF, 0xFF, 0xF2, 0x60, 0xD8, 0x78, + 0xFF, 0xFF, 0x08, 0x60, 0x15, 0xF1, 0x00, 0x60, 0x01, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x37, 0x00, 0x2D, 0x60, 0xAA, 0x63, 0xBD, 0xD3, 0xBD, 0xD1, 0xBD, 0xD1, 0xB0, 0x84, 0xB0, 0x84, + 0xFF, 0xFF, 0x07, 0x02, 0x8A, 0xFB, 0x31, 0x44, 0xFE, 0xB4, 0x40, 0x51, 0x0D, 0x64, 0x05, 0xFB, + 0x27, 0x00, 0x28, 0xF3, 0x9D, 0xF1, 0x60, 0x47, 0x64, 0x41, 0x07, 0xB1, 0x07, 0xB4, 0x50, 0xFB, + 0x01, 0x61, 0x03, 0x03, 0xCC, 0x84, 0xE1, 0x81, 0xFD, 0x02, 0xA1, 0x80, 0xB1, 0x83, 0x18, 0x02, + 0x9D, 0xFD, 0x16, 0x60, 0xCF, 0xF3, 0xE4, 0xFB, 0x7D, 0xFB, 0x13, 0x60, 0x02, 0xF3, 0xFF, 0xFF, + 0x00, 0xA8, 0x60, 0x46, 0x46, 0x5E, 0x31, 0x44, 0x01, 0xBC, 0x40, 0x51, 0xED, 0xE2, 0x0F, 0x4E, + 0x1D, 0x60, 0x58, 0x4F, 0x9F, 0x78, 0xFF, 0xFF, 0x0E, 0x4F, 0xCA, 0x60, 0xD4, 0x78, 0xFF, 0xFF, + 0xD7, 0xFE, 0xCA, 0x60, 0xD4, 0x78, 0xFF, 0xFF, 0xF2, 0x60, 0xE4, 0x64, 0x08, 0x60, 0x3B, 0xFB, + 0x2F, 0x58, 0xFF, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0x00, 0x64, 0x08, 0x60, 0x27, 0xFB, 0x5A, 0xDB, + 0x10, 0x60, 0x4E, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, 0x28, 0xF3, + 0xFF, 0xFF, 0x01, 0xB0, 0xFF, 0xFF, 0x1D, 0x03, 0x20, 0x40, 0x06, 0x23, 0x10, 0x00, 0x08, 0x60, + 0x27, 0xF1, 0x7F, 0x60, 0xFF, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x80, 0x60, 0x00, 0x64, 0x08, 0x60, + 0x28, 0xFB, 0xF2, 0x60, 0xF4, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x1D, 0x60, + 0xA9, 0x78, 0xFF, 0xFF, 0x08, 0x60, 0x27, 0xF1, 0x00, 0x60, 0x01, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0xC6, 0x01, 0x08, 0x60, 0x27, 0xF1, 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, + 0xCF, 0xFE, 0xDB, 0xF3, 0x01, 0x63, 0xFD, 0xA0, 0x08, 0x60, 0x77, 0xFD, 0x07, 0x02, 0x08, 0x60, + 0x30, 0xF1, 0x00, 0x60, 0x01, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0xB1, 0x01, 0x0E, 0x57, + 0x32, 0x40, 0x40, 0x26, 0x1B, 0x00, 0x45, 0x48, 0x00, 0x60, 0x06, 0x61, 0xB6, 0x60, 0x58, 0x4D, + 0x22, 0x78, 0xFF, 0xFF, 0x13, 0x03, 0x02, 0x64, 0x23, 0xFA, 0xF2, 0x60, 0x04, 0x64, 0x5A, 0xDA, + 0x28, 0x44, 0x5A, 0xDA, 0xFF, 0xFF, 0x26, 0x60, 0x0A, 0x64, 0x13, 0x60, 0x0D, 0xFB, 0x66, 0x44, + 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xFA, 0xFE, 0x37, 0x58, 0xFF, 0xFF, + 0x08, 0x60, 0x15, 0xF1, 0x00, 0x60, 0x02, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x88, 0x01, + 0x12, 0x60, 0xF6, 0xF3, 0xFF, 0xFF, 0x00, 0xA8, 0x60, 0x46, 0x0E, 0xF2, 0x4B, 0x03, 0x60, 0x40, + 0xF0, 0x37, 0x38, 0x00, 0xFF, 0x37, 0x2D, 0x00, 0xFD, 0x37, 0x25, 0x00, 0xF8, 0x37, 0x0A, 0x00, + 0x60, 0x47, 0xFF, 0xB5, 0x10, 0x60, 0x12, 0x62, 0x46, 0xD1, 0x00, 0x60, 0x01, 0x64, 0xB0, 0x84, + 0xA2, 0xDB, 0xCF, 0xFE, 0x00, 0x64, 0x13, 0x60, 0x0D, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xDC, 0x01, 0x06, 0xB4, 0xFD, 0x7F, 0x0E, 0xFA, 0x25, 0x60, + 0xF2, 0x64, 0x13, 0x60, 0x0D, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, + 0x2B, 0xFF, 0xF9, 0xFE, 0xCD, 0x01, 0x23, 0xF0, 0x60, 0x40, 0x04, 0x26, 0xED, 0x1B, 0x02, 0x26, + 0xEB, 0x18, 0xA2, 0xFF, 0x02, 0xF0, 0x09, 0x60, 0x08, 0x64, 0xD0, 0x80, 0xAD, 0xF3, 0x02, 0x02, + 0xCC, 0x84, 0xAD, 0xFB, 0x26, 0x60, 0x1A, 0x64, 0x40, 0x4B, 0x34, 0x60, 0x58, 0x4D, 0x08, 0x78, + 0xFF, 0xFF, 0xB6, 0x01, 0xAC, 0xFE, 0x09, 0x05, 0xAD, 0xFE, 0x0F, 0x05, 0xAE, 0xFE, 0xB0, 0x05, + 0xAF, 0xFE, 0x37, 0x05, 0xCA, 0x60, 0xD4, 0x78, 0xFF, 0xFF, 0x08, 0x60, 0x08, 0xF1, 0x20, 0x60, + 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0xF5, 0x01, 0x10, 0x60, 0x7A, 0x65, 0x0D, 0x61, + 0x07, 0x00, 0xA2, 0xDD, 0x58, 0x4F, 0x64, 0x58, 0xFF, 0xFF, 0x00, 0xB9, 0xFF, 0xFF, 0x08, 0x03, + 0x00, 0x63, 0xA5, 0xD1, 0x5A, 0xD3, 0xDA, 0x85, 0x00, 0xA8, 0xCD, 0x81, 0xF2, 0x02, 0xF8, 0x02, + 0xE1, 0x01, 0x10, 0x60, 0x0E, 0x62, 0x10, 0x60, 0x58, 0x65, 0xF3, 0x60, 0xD7, 0x63, 0x5A, 0xDF, + 0xD6, 0x80, 0xFF, 0xFF, 0x04, 0x03, 0x5A, 0xDF, 0x5A, 0xDF, 0x5A, 0xDD, 0xF9, 0x01, 0x10, 0x60, + 0x78, 0x65, 0x5A, 0xDF, 0xD6, 0x80, 0xFF, 0xFF, 0x02, 0x03, 0x5A, 0xDD, 0xFB, 0x01, 0x2F, 0x58, + 0xFF, 0xFF, 0x10, 0x60, 0x12, 0x64, 0x40, 0x41, 0x10, 0x60, 0x10, 0x63, 0xA3, 0xD1, 0x00, 0x64, + 0xD0, 0x80, 0x0C, 0x61, 0x08, 0x03, 0xBD, 0xDB, 0xA3, 0xD3, 0xFF, 0xFF, 0xB0, 0x84, 0xCD, 0x81, + 0xA3, 0xDB, 0x06, 0xA3, 0xF9, 0x02, 0x10, 0x60, 0x60, 0x63, 0xA3, 0xD1, 0x00, 0x64, 0xD0, 0x80, + 0x0D, 0x61, 0x19, 0x03, 0xBD, 0xDB, 0x64, 0x44, 0xFE, 0xA3, 0x02, 0xA3, 0xCD, 0x81, 0xE8, 0x84, + 0xE3, 0x03, 0x02, 0x05, 0xE1, 0x03, 0xF9, 0x01, 0x97, 0xFB, 0x99, 0xFD, 0x61, 0x5C, 0xA3, 0xD3, + 0x98, 0xF9, 0x03, 0x18, 0x58, 0x4F, 0x60, 0x58, 0xFF, 0xFF, 0x99, 0xF3, 0x98, 0xF1, 0x60, 0x43, + 0x97, 0xF3, 0x64, 0x41, 0xEA, 0x01, 0x21, 0x43, 0x10, 0x60, 0x5A, 0x65, 0xD7, 0x80, 0xBD, 0xD1, + 0xBD, 0xD3, 0x03, 0x02, 0xCA, 0x60, 0xD4, 0x78, 0xFF, 0xFF, 0xA0, 0x84, 0xBD, 0xD1, 0x43, 0x41, + 0xF5, 0x03, 0xF3, 0x60, 0xDC, 0x64, 0x64, 0x58, 0x40, 0x4F, 0x2A, 0xF0, 0x83, 0x60, 0xFF, 0x65, + 0x64, 0x47, 0x03, 0x2B, 0x01, 0x00, 0x14, 0x00, 0x03, 0x26, 0x03, 0xAC, 0x60, 0x47, 0xA4, 0x84, + 0x2A, 0xFA, 0x2F, 0xF2, 0x2C, 0xFA, 0x30, 0xF2, 0x2D, 0xFA, 0x31, 0xF2, 0x2E, 0xFA, 0x64, 0x41, + 0xEA, 0xF3, 0x2F, 0xFA, 0x60, 0x43, 0xEB, 0xF3, 0x30, 0xFA, 0xEC, 0xF1, 0x31, 0xF8, 0x19, 0x00, + 0x60, 0x47, 0xA4, 0x84, 0x2A, 0xFA, 0x2F, 0xF2, 0x2C, 0xFA, 0x30, 0xF2, 0x2D, 0xFA, 0x31, 0xF2, + 0x2E, 0xFA, 0x36, 0xF2, 0x32, 0xFA, 0x37, 0xF2, 0x33, 0xFA, 0x38, 0xF2, 0x34, 0xFA, 0xEA, 0xF3, + 0x2F, 0xFA, 0x36, 0xFA, 0xEB, 0xF3, 0x30, 0xFA, 0x37, 0xFA, 0xEC, 0xF3, 0x31, 0xFA, 0x38, 0xFA, + 0x64, 0x41, 0x1C, 0xF2, 0x13, 0xFA, 0x00, 0xF4, 0x0D, 0xF2, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x2B, + 0x17, 0x00, 0x81, 0x67, 0xA2, 0xDA, 0xF4, 0x60, 0x58, 0x4E, 0xCF, 0x78, 0xFF, 0xFF, 0x26, 0x46, + 0x3F, 0xFC, 0x25, 0x60, 0xCE, 0x64, 0x13, 0x60, 0x0D, 0xFB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, + 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xC1, 0xFE, 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, + 0x26, 0x46, 0x3F, 0xF0, 0x42, 0x64, 0xD0, 0x80, 0xFF, 0xFF, 0x01, 0x04, 0x3F, 0xFA, 0x07, 0xF2, + 0xA6, 0xF1, 0x01, 0x1B, 0x07, 0xF8, 0x1C, 0xF2, 0x13, 0xFA, 0x26, 0xF2, 0x27, 0xF0, 0x60, 0x47, + 0x00, 0xF4, 0x1F, 0xFA, 0x64, 0x47, 0x20, 0xFA, 0x61, 0x44, 0x21, 0xFA, 0x01, 0x67, 0x0D, 0xFA, + 0x10, 0x61, 0x2D, 0x60, 0x5E, 0x64, 0x1E, 0x63, 0x58, 0xD1, 0xCD, 0x81, 0xBD, 0xD8, 0xFC, 0x02, + 0xB8, 0xF1, 0xD6, 0xF1, 0x64, 0x5E, 0x64, 0x5F, 0x44, 0x63, 0xBD, 0xDA, 0x16, 0x60, 0xAC, 0xF3, + 0xFF, 0xFF, 0xE0, 0x84, 0xE0, 0x84, 0xE0, 0x84, 0x4A, 0xD3, 0x60, 0x45, 0x60, 0x40, 0x01, 0x36, + 0x03, 0x64, 0x02, 0x36, 0x01, 0x64, 0xB4, 0x84, 0x06, 0xA2, 0xA2, 0xD1, 0xBD, 0xDA, 0x64, 0x47, + 0xBD, 0xDA, 0xD3, 0xF3, 0xD4, 0xF1, 0x60, 0x47, 0xBD, 0xDA, 0x64, 0x47, 0xE2, 0xF1, 0xBD, 0xDA, + 0x64, 0x44, 0xBD, 0xDA, 0x26, 0x46, 0x00, 0x64, 0x23, 0xF0, 0x3B, 0xF0, 0x64, 0x40, 0x10, 0x2A, + 0x06, 0x00, 0xC0, 0x67, 0xA0, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0xE8, 0x84, 0x10, 0xBC, 0x3E, 0xFA, + 0x25, 0x60, 0xDA, 0x64, 0x13, 0x60, 0x0D, 0xFB, 0x26, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, + 0xFF, 0xFF, 0x2B, 0xFF, 0xC8, 0xFE, 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0xB1, 0xF3, + 0x1F, 0xFA, 0x32, 0x47, 0x07, 0xFA, 0x24, 0x7E, 0x01, 0x7F, 0x08, 0xFA, 0xD6, 0xF1, 0x09, 0xF8, + 0x01, 0x60, 0x01, 0x64, 0x0A, 0xFA, 0x01, 0x64, 0x0B, 0xFA, 0x18, 0x64, 0x13, 0x60, 0x0D, 0xFB, + 0x66, 0x44, 0x5A, 0xDB, 0x0A, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x52, 0x63, 0x2E, 0x58, + 0xFF, 0xFF, 0x00, 0x60, 0x2A, 0x61, 0xB6, 0x60, 0x58, 0x4D, 0x25, 0x78, 0xFF, 0xFF, 0x66, 0x44, + 0x5D, 0xFB, 0x04, 0x64, 0x03, 0xFA, 0x67, 0x44, 0x2C, 0xFA, 0x2D, 0xFA, 0x2E, 0xFA, 0x32, 0xFA, + 0x33, 0xFA, 0x34, 0xFA, 0x12, 0x60, 0x80, 0x64, 0xA6, 0xF1, 0x0E, 0xFA, 0x07, 0xF8, 0x00, 0x64, + 0x3E, 0xFA, 0x0E, 0x60, 0x3D, 0xFB, 0x06, 0xA2, 0x10, 0x60, 0x80, 0x64, 0xA2, 0xDB, 0x04, 0x64, + 0x5A, 0xDB, 0x06, 0x64, 0x5A, 0xDB, 0xF8, 0x60, 0xCF, 0x64, 0x08, 0x60, 0x3F, 0xFB, 0x00, 0x64, + 0x0E, 0x60, 0x43, 0xFB, 0x06, 0xA2, 0x10, 0x60, 0x84, 0x64, 0xA2, 0xDB, 0x08, 0x64, 0x5A, 0xDB, + 0x06, 0x64, 0x5A, 0xDB, 0xF8, 0x60, 0xD8, 0x64, 0x08, 0x60, 0x41, 0xFB, 0xF8, 0x60, 0xB4, 0x64, + 0x08, 0x60, 0x34, 0xFB, 0x00, 0x60, 0x30, 0x64, 0x08, 0x60, 0x13, 0xFB, 0xF5, 0x60, 0x31, 0x64, + 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0xF7, 0x60, 0x6C, 0x78, + 0xFF, 0xFF, 0x5D, 0xF5, 0xEA, 0xF1, 0x2F, 0xF8, 0xEB, 0xF1, 0x30, 0xF8, 0xEC, 0xF1, 0x31, 0xF8, + 0xC9, 0xF1, 0x19, 0xF8, 0x00, 0x63, 0x88, 0xFD, 0x1B, 0x60, 0xB2, 0x63, 0x86, 0xFD, 0x87, 0xFD, + 0x20, 0x40, 0x10, 0x2B, 0x00, 0x00, 0x5D, 0xF5, 0x40, 0x64, 0x2A, 0xFA, 0x7D, 0xF3, 0x7C, 0xFB, + 0x08, 0x60, 0x12, 0xF1, 0x00, 0x60, 0x10, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x03, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0x03, 0x00, 0xF6, 0x60, 0xC6, 0x78, 0xFF, 0xFF, 0x19, 0x60, 0x3D, 0xF3, 0xFD, 0x60, + 0x58, 0x4E, 0xAC, 0x78, 0xFF, 0xFF, 0x19, 0x60, 0x3F, 0xFB, 0x19, 0x60, 0x39, 0xF3, 0x3F, 0x40, + 0x01, 0x27, 0x08, 0x00, 0x0F, 0x60, 0xFF, 0x65, 0xA4, 0x84, 0xFC, 0x60, 0x58, 0x4E, 0x34, 0x78, + 0xFF, 0xFF, 0x05, 0x00, 0x0F, 0xB4, 0xFC, 0x60, 0x58, 0x4E, 0x34, 0x78, 0xFF, 0xFF, 0x5D, 0xF5, + 0x35, 0x60, 0x70, 0x64, 0x00, 0xF4, 0x40, 0x48, 0x2F, 0x60, 0x24, 0x64, 0x20, 0x40, 0x10, 0x27, + 0x02, 0x00, 0x2F, 0x60, 0x02, 0x64, 0x28, 0xDB, 0x04, 0x61, 0x00, 0x60, 0x00, 0x64, 0xF1, 0x60, + 0x58, 0x4D, 0x34, 0x78, 0xFF, 0xFF, 0x5D, 0xF5, 0x3F, 0xFC, 0x01, 0x64, 0x54, 0xF1, 0x10, 0x60, + 0x12, 0xFB, 0x7D, 0xFB, 0xA4, 0xD3, 0x04, 0x65, 0x53, 0xF3, 0x01, 0x18, 0x0C, 0x65, 0xF3, 0xB4, + 0xB4, 0x84, 0x53, 0xFB, 0x0D, 0x00, 0xF7, 0x60, 0x6C, 0x78, 0xFF, 0xFF, 0x53, 0xF1, 0x7D, 0xF3, + 0xFF, 0xFF, 0xF3, 0xA0, 0x04, 0xA4, 0x01, 0x04, 0xF1, 0xA4, 0x10, 0x36, 0xF4, 0x01, 0x7D, 0xFB, + 0x20, 0x40, 0x10, 0x2B, 0x10, 0x00, 0x7D, 0xF3, 0x32, 0x60, 0x80, 0x61, 0xA1, 0xD1, 0xCC, 0x84, + 0x01, 0x61, 0x08, 0x24, 0x03, 0x00, 0xE1, 0x81, 0xCC, 0x84, 0xFB, 0x01, 0xA1, 0x84, 0x53, 0xF1, + 0xE6, 0x03, 0x10, 0x60, 0x12, 0xFB, 0x7D, 0xF3, 0x10, 0x60, 0xF2, 0x61, 0xCC, 0x84, 0xFF, 0xFF, + 0x02, 0x03, 0x06, 0xA1, 0xFB, 0x01, 0xA1, 0xD3, 0x53, 0xF1, 0x01, 0xB0, 0x02, 0xB0, 0xD7, 0x03, + 0x64, 0x40, 0x01, 0x26, 0x05, 0x00, 0x20, 0x40, 0x10, 0x27, 0x02, 0x00, 0xD0, 0x03, 0x00, 0x00, + 0x9D, 0xFE, 0x3D, 0x05, 0xBA, 0xFE, 0x10, 0x60, 0x24, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, + 0x0A, 0x04, 0x40, 0x60, 0x00, 0x64, 0x08, 0x60, 0x13, 0xFB, 0xF5, 0x60, 0xCB, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, 0x24, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x7D, 0xF1, + 0x13, 0x60, 0x1A, 0xF9, 0x08, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x20, 0x60, 0x00, 0x64, + 0x08, 0x60, 0x13, 0xFB, 0xF5, 0x60, 0xF0, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0xBE, 0xFE, 0x08, 0x60, 0x08, 0xF1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x1B, 0x60, 0xF3, 0xF1, 0xAD, 0x4F, 0x00, 0x7F, 0xFA, 0xB4, 0x64, 0x41, 0x7D, 0xF1, 0x02, 0xB1, + 0x04, 0x65, 0x02, 0x02, 0x64, 0x40, 0x01, 0x2B, 0x01, 0x65, 0xB4, 0x84, 0xA0, 0x5D, 0x10, 0x60, + 0x24, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0xDE, 0xFE, 0x0A, 0x04, 0x40, 0x60, 0x00, 0x64, 0x08, 0x60, + 0x13, 0xFB, 0xF5, 0x60, 0xC8, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x7D, 0xF1, + 0x13, 0x60, 0x1A, 0xF9, 0x0E, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x20, 0x60, 0x00, 0x64, + 0x08, 0x60, 0x13, 0xFB, 0xF6, 0x60, 0x28, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0xBE, 0xFE, 0x08, 0x60, 0x08, 0xF1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, + 0x10, 0x60, 0x24, 0x62, 0x00, 0x64, 0xA2, 0xDB, 0x5D, 0xF5, 0x25, 0x60, 0xCE, 0x64, 0x13, 0x60, + 0x0D, 0xFB, 0x66, 0x44, 0x5A, 0xDB, 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0x00, 0x64, + 0x51, 0xFB, 0x00, 0x60, 0x01, 0x64, 0x08, 0x60, 0x13, 0xFB, 0xF6, 0x60, 0x4C, 0x64, 0x5A, 0xDB, + 0xCF, 0xFE, 0xC1, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x10, 0x60, 0x24, 0x62, 0x00, 0x64, 0xA2, 0xDB, + 0xC3, 0xF1, 0x0E, 0x60, 0x3F, 0xF9, 0x1C, 0x60, 0x7A, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0xC4, 0xF1, 0x0E, 0x60, 0x45, 0xF9, 0x26, 0x60, 0x42, 0x62, + 0xA2, 0xD3, 0xFF, 0xFF, 0xFD, 0x1B, 0x1C, 0x60, 0x86, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, + 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x00, 0x60, 0x08, 0x64, 0x08, 0x60, 0x13, 0xFB, 0xF6, 0x60, + 0x75, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x51, 0xF1, 0x10, 0x60, 0x24, 0x62, + 0x00, 0x64, 0xA2, 0xDB, 0x64, 0x40, 0xFF, 0x26, 0x0B, 0x00, 0x53, 0xF3, 0xFF, 0xFF, 0x80, 0xB0, + 0xFF, 0xFF, 0x03, 0x03, 0xF7, 0x60, 0x65, 0x78, 0xFF, 0xFF, 0xF5, 0x60, 0x96, 0x78, 0xFF, 0xFF, + 0x02, 0x0A, 0x00, 0x64, 0x51, 0xFB, 0xC5, 0xF1, 0x0E, 0x60, 0x45, 0xF9, 0x00, 0x60, 0x0C, 0x64, + 0x08, 0x60, 0x13, 0xFB, 0xF6, 0x60, 0xA0, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x1C, 0x60, 0x86, 0x64, + 0x13, 0x60, 0x22, 0xFB, 0x02, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, + 0x08, 0x60, 0x12, 0xF1, 0x00, 0x60, 0x04, 0x64, 0xA0, 0x80, 0x9C, 0x84, 0x0B, 0x03, 0xA0, 0x84, + 0xA2, 0xDB, 0x1C, 0x60, 0x86, 0x64, 0x13, 0x60, 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, + 0x04, 0xFF, 0x13, 0x00, 0xFF, 0x60, 0xF7, 0x64, 0xA0, 0x84, 0xA2, 0xDB, 0x51, 0xF3, 0xDE, 0x0A, + 0x00, 0xA0, 0x00, 0x64, 0x02, 0x03, 0x51, 0xFB, 0xD9, 0x01, 0x1C, 0x60, 0x7A, 0x64, 0x13, 0x60, + 0x22, 0xFB, 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0xB7, 0x01, 0x19, 0x60, 0x3E, 0xF3, + 0xFD, 0x60, 0x58, 0x4E, 0xAC, 0x78, 0xFF, 0xFF, 0x19, 0x60, 0x3F, 0xFB, 0x19, 0x60, 0x3A, 0xF3, + 0x0F, 0x60, 0xFF, 0x65, 0xA4, 0x84, 0xFC, 0x60, 0x58, 0x4E, 0x34, 0x78, 0xFF, 0xFF, 0x5D, 0xF5, + 0x35, 0x60, 0x70, 0x64, 0x00, 0xF4, 0x40, 0x48, 0x2F, 0x60, 0x24, 0x64, 0x20, 0x40, 0x10, 0x27, + 0x02, 0x00, 0x2F, 0x60, 0x02, 0x64, 0x28, 0xDB, 0x04, 0x61, 0x00, 0x60, 0x00, 0x64, 0xF1, 0x60, + 0x58, 0x4D, 0x34, 0x78, 0xFF, 0xFF, 0x5D, 0xF5, 0x3F, 0xFC, 0x53, 0xF3, 0x20, 0x40, 0x10, 0x23, + 0x02, 0x00, 0x20, 0xBC, 0x04, 0x00, 0x60, 0x40, 0x01, 0x22, 0x40, 0xBC, 0x04, 0xBC, 0x80, 0xBC, + 0x53, 0xFB, 0x11, 0x60, 0x62, 0x64, 0x08, 0x60, 0x6C, 0xFB, 0x06, 0x64, 0x08, 0x60, 0x73, 0xFB, + 0x19, 0x60, 0x43, 0xF3, 0xFF, 0xFF, 0x07, 0xB4, 0xA2, 0xDB, 0x53, 0xF3, 0x08, 0x60, 0x6C, 0xF1, + 0x60, 0x40, 0x20, 0x26, 0x03, 0x00, 0x01, 0x26, 0x32, 0x00, 0x45, 0x00, 0x08, 0x60, 0x73, 0xF3, + 0xFF, 0xFF, 0xDD, 0xA0, 0x01, 0xA4, 0x58, 0x03, 0xA2, 0xDB, 0x32, 0x60, 0x82, 0x61, 0xE0, 0xA0, + 0xF0, 0xA0, 0x05, 0x05, 0x01, 0x05, 0x05, 0x00, 0x02, 0xA1, 0xF0, 0xA4, 0x02, 0x00, 0x04, 0xA1, + 0xE0, 0xA4, 0xA1, 0xD1, 0x01, 0x61, 0xDC, 0x84, 0xCC, 0x84, 0xFF, 0xFF, 0x02, 0x03, 0xE1, 0x81, + 0xFB, 0x01, 0xA1, 0x80, 0x10, 0x60, 0xE6, 0x64, 0x01, 0x02, 0xE0, 0x01, 0xA0, 0xD3, 0x11, 0x60, + 0x5A, 0x63, 0xFA, 0xA4, 0xCC, 0x84, 0x08, 0xA3, 0xFD, 0x02, 0xCF, 0xF1, 0xA3, 0xD3, 0x01, 0x18, + 0xD5, 0x18, 0xFE, 0xA3, 0xA3, 0xD3, 0x7D, 0xFB, 0xF5, 0x60, 0xC8, 0x78, 0xFF, 0xFF, 0x12, 0x60, + 0x40, 0x65, 0x64, 0x41, 0xA1, 0xD3, 0xD5, 0x80, 0x00, 0xB8, 0x26, 0x07, 0x02, 0x02, 0x08, 0xA1, + 0xF9, 0x01, 0x61, 0x44, 0x08, 0x60, 0x6C, 0xFB, 0x01, 0x64, 0xA1, 0xDB, 0x49, 0xD3, 0x7D, 0xFB, + 0xF5, 0x60, 0xC8, 0x78, 0xFF, 0xFF, 0x12, 0x60, 0x40, 0x65, 0x64, 0x41, 0xA1, 0xD3, 0xD5, 0x80, + 0x04, 0xB0, 0x12, 0x07, 0x02, 0x02, 0x08, 0xA1, 0xF9, 0x01, 0x61, 0x44, 0x08, 0x60, 0x6C, 0xFB, + 0x49, 0xD3, 0x7D, 0xFB, 0xF5, 0x60, 0xC8, 0x78, 0xFF, 0xFF, 0x10, 0x60, 0xD8, 0x65, 0xA5, 0xD3, + 0xFF, 0xFF, 0x08, 0xA4, 0xA5, 0xDB, 0x99, 0x01, 0x1C, 0x60, 0x7A, 0x64, 0x13, 0x60, 0x22, 0xFB, + 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x53, 0xF3, 0xFF, 0xFF, 0xE3, 0xB4, 0x53, 0xFB, + 0x10, 0x60, 0x10, 0xF3, 0xFF, 0xFF, 0xFE, 0xB4, 0xA2, 0xDB, 0x10, 0x60, 0x24, 0x62, 0x00, 0x64, + 0xA2, 0xDB, 0xDE, 0xFE, 0x0A, 0x04, 0x40, 0x60, 0x00, 0x64, 0x08, 0x60, 0x13, 0xFB, 0xF7, 0x60, + 0x7D, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x7C, 0xF1, 0x7D, 0xF9, 0x13, 0x60, + 0x1A, 0xF9, 0x0E, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x2D, 0xFF, 0x20, 0x60, 0x00, 0x64, 0x08, 0x60, + 0x13, 0xFB, 0xF7, 0x60, 0x9F, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0xBE, 0xFE, + 0x08, 0x60, 0x08, 0xF1, 0x40, 0x60, 0x00, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x53, 0xF3, + 0xFF, 0xFF, 0x80, 0xB0, 0xFF, 0xFF, 0x54, 0x02, 0x1C, 0x60, 0x32, 0x63, 0x1C, 0x61, 0xCD, 0x81, + 0xBD, 0xDF, 0xFD, 0x02, 0x14, 0x60, 0x32, 0x61, 0x88, 0xF3, 0x61, 0x43, 0xC4, 0xA5, 0x47, 0xD1, + 0x0F, 0x04, 0xBE, 0xD5, 0x1C, 0x60, 0x2E, 0x63, 0xC3, 0x83, 0xC3, 0x83, 0xC3, 0x83, 0x43, 0xD3, + 0xBE, 0xD1, 0xDC, 0x84, 0xA3, 0xDB, 0x66, 0x44, 0xC0, 0x84, 0xBE, 0xDB, 0x65, 0x44, 0xED, 0x01, + 0x1C, 0x60, 0x32, 0x63, 0x0E, 0x61, 0x41, 0x4B, 0xBD, 0xD3, 0xBD, 0xD1, 0x00, 0xBD, 0x64, 0x41, + 0x19, 0x03, 0x01, 0xA8, 0x61, 0x44, 0x02, 0xA8, 0x15, 0x03, 0x02, 0x02, 0xE9, 0x84, 0x12, 0x00, + 0x65, 0x47, 0x60, 0x45, 0x61, 0x44, 0x09, 0x61, 0xCD, 0x81, 0xE0, 0x84, 0xFF, 0x23, 0xFC, 0x01, + 0x02, 0x24, 0xC4, 0x84, 0x02, 0x28, 0xD4, 0x84, 0xCD, 0x81, 0x01, 0x0E, 0x01, 0xBC, 0x02, 0x03, + 0xE0, 0x84, 0xF6, 0x01, 0x00, 0x7F, 0x2B, 0x41, 0x4D, 0x8B, 0xBF, 0xDB, 0xDD, 0x02, 0x14, 0x60, + 0x32, 0x61, 0x88, 0xF3, 0x61, 0x43, 0xC4, 0xA5, 0x47, 0xD1, 0x0A, 0x04, 0xDA, 0x86, 0x1C, 0x60, + 0x30, 0x63, 0xC3, 0x83, 0xC3, 0x83, 0xC3, 0x83, 0x43, 0xD1, 0xA6, 0xD9, 0x65, 0x44, 0xF2, 0x01, + 0x53, 0xF3, 0x88, 0xF1, 0xF3, 0xB4, 0x53, 0xFB, 0x14, 0x60, 0x32, 0x63, 0xC3, 0x85, 0x45, 0x4A, + 0x1B, 0x60, 0xB2, 0x65, 0x87, 0xF3, 0x45, 0x4C, 0x40, 0x48, 0x2A, 0x45, 0xD7, 0x80, 0x02, 0x65, + 0x17, 0x05, 0x47, 0xD1, 0x02, 0x65, 0x47, 0xD3, 0x0A, 0x65, 0xD0, 0x81, 0x47, 0xD3, 0x01, 0x05, + 0x00, 0x61, 0xF2, 0xA3, 0x01, 0xB0, 0x61, 0x44, 0x05, 0x03, 0x2C, 0xDB, 0x5A, 0xDD, 0x5A, 0x8C, + 0x3C, 0xA3, 0xEB, 0x01, 0x28, 0x42, 0x4A, 0xDD, 0x4A, 0xDB, 0x42, 0x48, 0x3C, 0xA3, 0xE5, 0x01, + 0x28, 0x44, 0x86, 0xFB, 0x86, 0xF1, 0x1B, 0x60, 0xB2, 0x63, 0x44, 0x48, 0x28, 0x45, 0xD7, 0x80, + 0xA3, 0xD1, 0x15, 0x05, 0x04, 0x65, 0x46, 0xD3, 0x28, 0x45, 0xD6, 0x80, 0xD0, 0x80, 0x02, 0x04, + 0x04, 0xA3, 0xF5, 0x01, 0xF7, 0x06, 0x62, 0x46, 0xA2, 0xD9, 0xA3, 0xDB, 0x5B, 0xD3, 0x66, 0x42, + 0x5A, 0xD1, 0xA2, 0xDB, 0xA3, 0xD9, 0xFE, 0xA3, 0xA3, 0xD1, 0x66, 0x42, 0xEB, 0x01, 0x86, 0xF3, + 0x87, 0xF1, 0x60, 0x43, 0x44, 0x48, 0x28, 0x45, 0xD7, 0x80, 0xA3, 0xD1, 0x15, 0x05, 0x04, 0x65, + 0x46, 0xD3, 0x28, 0x45, 0xD6, 0x80, 0xD0, 0x80, 0x02, 0x04, 0x04, 0xA3, 0xF5, 0x01, 0xF7, 0x06, + 0x62, 0x46, 0xA2, 0xD9, 0xA3, 0xDB, 0x5B, 0xD3, 0x66, 0x42, 0x5A, 0xD1, 0xA2, 0xDB, 0xA3, 0xD9, + 0xFE, 0xA3, 0xA3, 0xD1, 0x66, 0x42, 0xEB, 0x01, 0x08, 0x60, 0x08, 0xF1, 0x10, 0x60, 0x00, 0x64, + 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x7D, 0xF1, 0x19, 0x60, 0x3D, 0xF3, 0x64, 0x40, 0x01, 0x27, + 0x27, 0x00, 0xFD, 0x60, 0x58, 0x4E, 0xAC, 0x78, 0xFF, 0xFF, 0x19, 0x60, 0x3F, 0xFB, 0x19, 0x60, + 0x39, 0xF3, 0x3F, 0x40, 0x01, 0x27, 0x16, 0x00, 0x0F, 0x60, 0xFF, 0x65, 0x60, 0x41, 0xDB, 0xF3, + 0xFF, 0xFF, 0x60, 0x40, 0x03, 0x36, 0x07, 0x00, 0x19, 0x60, 0x44, 0xF3, 0xFF, 0xFF, 0x60, 0x40, + 0x01, 0x2A, 0x01, 0x00, 0x0F, 0x61, 0x61, 0x44, 0xA4, 0x84, 0xFC, 0x60, 0x58, 0x4E, 0x34, 0x78, + 0xFF, 0xFF, 0x16, 0x00, 0x0F, 0xB4, 0xFC, 0x60, 0x58, 0x4E, 0x34, 0x78, 0xFF, 0xFF, 0x10, 0x00, + 0x5A, 0xD3, 0xFD, 0x60, 0x58, 0x4E, 0xAC, 0x78, 0xFF, 0xFF, 0x19, 0x60, 0x3F, 0xFB, 0x19, 0x60, + 0x3A, 0xF3, 0x0F, 0x60, 0xFF, 0x65, 0xA4, 0x84, 0xFC, 0x60, 0x58, 0x4E, 0x34, 0x78, 0xFF, 0xFF, + 0x00, 0x60, 0x30, 0x64, 0x08, 0x60, 0x13, 0xFB, 0xF5, 0x60, 0x31, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, + 0x2F, 0x58, 0xFF, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0x1C, 0x60, 0x7A, 0x64, 0x13, 0x60, 0x22, 0xFB, + 0x03, 0x64, 0x4A, 0xDB, 0xFF, 0xFF, 0x04, 0xFF, 0x00, 0x64, 0x53, 0xFB, 0x00, 0x64, 0x08, 0x60, + 0x12, 0xFB, 0x5A, 0xDB, 0xBE, 0xFE, 0x00, 0x60, 0x30, 0x64, 0x08, 0x60, 0x13, 0xFB, 0xF5, 0x60, + 0x31, 0x64, 0x5A, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, 0x2F, 0x58, 0xFF, 0xFF, 0x08, 0x60, + 0x12, 0xF1, 0x00, 0x60, 0x04, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, 0xFF, 0xFF, + 0x08, 0x60, 0x12, 0xF1, 0x00, 0x60, 0x08, 0x64, 0xB0, 0x84, 0xA2, 0xDB, 0xCF, 0xFE, 0x2F, 0x58, + 0xFF, 0xFF, 0x20, 0x40, 0x90, 0x2B, 0x03, 0x00, 0xFB, 0x60, 0xFC, 0x78, 0xFF, 0xFF, 0x53, 0xF3, + 0x88, 0xF1, 0x04, 0xB0, 0x07, 0x60, 0x80, 0x64, 0xD0, 0x80, 0x20, 0x03, 0x1F, 0x06, 0x26, 0x46, + 0x88, 0xF1, 0x14, 0x60, 0x32, 0x63, 0xC3, 0x83, 0x7D, 0xF3, 0x26, 0xF0, 0xBD, 0xDB, 0x64, 0x44, + 0x00, 0x7F, 0xBD, 0xDB, 0x64, 0x47, 0x00, 0x7F, 0xBD, 0xDB, 0x32, 0xF0, 0xBD, 0xD9, 0x33, 0xF0, + 0xBD, 0xD9, 0x34, 0xF0, 0xBD, 0xD9, 0x00, 0xF4, 0x0D, 0xF0, 0xBD, 0xD9, 0x0E, 0xF0, 0xBD, 0xD9, + 0x0F, 0xF0, 0xA3, 0xDF, 0x64, 0x47, 0x60, 0x45, 0x00, 0x37, 0x03, 0x00, 0xFB, 0x60, 0xF7, 0x78, + 0xFF, 0xFF, 0xBD, 0xDB, 0xE0, 0xA0, 0x1F, 0x61, 0x00, 0xB8, 0xF8, 0x07, 0xF7, 0x03, 0x60, 0xFE, + 0x5D, 0xD0, 0xCC, 0x84, 0xBD, 0xD9, 0xFC, 0x02, 0x65, 0x40, 0x01, 0x26, 0xDF, 0x83, 0x5D, 0xD0, + 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x3A, 0x03, 0x00, 0x5D, 0xD0, 0xFF, 0xFF, 0xC1, 0x81, 0x5D, 0xD0, + 0xFF, 0xFF, 0x64, 0x40, 0x03, 0x36, 0x07, 0x00, 0x53, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x2A, + 0xDD, 0x01, 0xCD, 0x81, 0x13, 0x00, 0x53, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x2A, 0x04, 0x00, + 0x5D, 0xD0, 0xFF, 0xFF, 0xC1, 0x81, 0x0A, 0x00, 0x59, 0xD0, 0x7D, 0xF3, 0xFF, 0xFF, 0xD0, 0x80, + 0x20, 0xFE, 0x08, 0x24, 0x03, 0x00, 0xFB, 0x60, 0xF7, 0x78, 0xFF, 0xFF, 0x7C, 0x44, 0x1A, 0x60, + 0x24, 0xFB, 0x1A, 0x60, 0x25, 0xFB, 0x1A, 0x60, 0x26, 0xFB, 0x1A, 0x60, 0x27, 0xFB, 0x1C, 0x60, + 0x08, 0xFB, 0x1C, 0x60, 0x04, 0xFB, 0x00, 0x64, 0x1C, 0x60, 0x04, 0xFB, 0x20, 0xFE, 0x37, 0x60, + 0xFE, 0x64, 0x40, 0x4A, 0xF9, 0x60, 0x58, 0x4D, 0xC3, 0x78, 0xFF, 0xFF, 0x1C, 0x60, 0x04, 0xF3, + 0xFF, 0xFF, 0x09, 0x18, 0xFF, 0xFF, 0x1C, 0x60, 0x06, 0xF3, 0x1C, 0x60, 0x07, 0xF5, 0x60, 0x41, + 0x00, 0x64, 0x1C, 0x60, 0x04, 0xFB, 0x20, 0xFE, 0x2A, 0xD1, 0xDA, 0x85, 0x64, 0x44, 0x01, 0xA0, + 0xFF, 0xFF, 0x01, 0x02, 0x79, 0x00, 0x45, 0x4A, 0x7C, 0x44, 0x60, 0xFE, 0xA1, 0xD2, 0xFF, 0xFF, + 0xD0, 0x80, 0x20, 0xFE, 0x01, 0x03, 0xEF, 0x01, 0x1C, 0x60, 0x04, 0xF3, 0xFF, 0xFF, 0x02, 0x18, + 0xDD, 0x81, 0x35, 0x00, 0x60, 0xFE, 0x5D, 0xD2, 0xFF, 0xFF, 0x60, 0x5C, 0x41, 0x94, 0x81, 0xA0, + 0x20, 0xFE, 0x2D, 0x04, 0x01, 0x64, 0x1C, 0x60, 0x04, 0xFB, 0xC1, 0x84, 0x84, 0xA4, 0x1C, 0x60, + 0x06, 0xFB, 0x00, 0xF2, 0x1C, 0x60, 0x07, 0xFB, 0x1C, 0x60, 0x05, 0xFD, 0x02, 0x60, 0x00, 0x63, + 0xCD, 0x85, 0x64, 0x44, 0xD8, 0x81, 0xCD, 0x84, 0x4C, 0x91, 0x60, 0x43, 0x60, 0xFE, 0xA5, 0xD2, + 0xDE, 0x85, 0x7F, 0x26, 0x02, 0x00, 0x00, 0xF4, 0x04, 0x65, 0x5D, 0x93, 0xA3, 0xDB, 0x5D, 0x93, + 0xA5, 0xD2, 0xF6, 0x1F, 0x5D, 0x93, 0x20, 0xFE, 0xDF, 0x83, 0x00, 0x60, 0x01, 0x61, 0x02, 0x60, + 0x00, 0x64, 0xE0, 0x87, 0x60, 0x46, 0x1C, 0x60, 0x05, 0xF3, 0xFF, 0xFF, 0x60, 0x43, 0x60, 0xFE, + 0xCD, 0x81, 0x20, 0xFE, 0x2A, 0x44, 0x38, 0x60, 0x00, 0x7C, 0xD0, 0x84, 0x38, 0x60, 0x04, 0x65, + 0x44, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0x1C, 0x60, 0x04, 0xF3, 0xFF, 0xFF, 0x08, 0x18, 0x1C, 0x60, + 0x06, 0xF3, 0x1C, 0x60, 0x07, 0xF5, 0x60, 0x41, 0x00, 0x64, 0x1C, 0x60, 0x04, 0xFB, 0x26, 0x44, + 0x01, 0xA4, 0x58, 0x90, 0xFF, 0xFF, 0x03, 0x02, 0x61, 0x44, 0x0B, 0xA5, 0x04, 0x00, 0x61, 0x44, + 0xFC, 0xA4, 0x8B, 0x7C, 0xC0, 0x85, 0xDD, 0x81, 0x66, 0x44, 0x1C, 0x60, 0x07, 0xFB, 0x26, 0x46, + 0x1B, 0xF0, 0x1C, 0x60, 0x07, 0xF5, 0x64, 0x44, 0xD4, 0x80, 0xFF, 0xFF, 0x02, 0x06, 0x2D, 0x58, + 0xFF, 0xFF, 0xFA, 0x60, 0xE7, 0x78, 0xFF, 0xFF, 0x60, 0xFE, 0x5D, 0xD2, 0xFF, 0xFF, 0x20, 0xFE, + 0xFF, 0xB4, 0x41, 0x94, 0x81, 0xA0, 0xFF, 0xFF, 0x02, 0x04, 0x00, 0xF4, 0x84, 0xA4, 0x60, 0x41, + 0x5D, 0x01, 0x1A, 0x60, 0x2C, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x01, 0x3A, 0x6C, 0x01, 0x61, 0x5C, + 0x1A, 0x60, 0x2B, 0xF9, 0x60, 0xFE, 0x5D, 0xD2, 0xFF, 0xFF, 0xFE, 0xA4, 0xFF, 0xFF, 0x04, 0x20, + 0x02, 0x00, 0xFF, 0xA1, 0x60, 0x01, 0x5D, 0xD0, 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x36, 0x02, 0x00, + 0xFE, 0xA1, 0x59, 0x01, 0x5D, 0xD0, 0xFF, 0xFF, 0x64, 0x40, 0x00, 0x36, 0x02, 0x00, 0xFD, 0xA1, + 0x52, 0x01, 0x01, 0x7C, 0x1C, 0x60, 0x08, 0xF9, 0x4C, 0x00, 0x1A, 0x60, 0x2C, 0xF3, 0xFF, 0xFF, + 0x01, 0x18, 0x49, 0x01, 0x00, 0x7C, 0x1C, 0x60, 0x08, 0xF9, 0x61, 0x5C, 0x1A, 0x60, 0x2B, 0xF9, + 0x60, 0xFE, 0x5D, 0xD2, 0xFF, 0xFF, 0xFA, 0xA4, 0xFF, 0xFF, 0x04, 0x20, 0x04, 0x00, 0xFF, 0xA1, + 0xF9, 0x60, 0x6B, 0x78, 0xFF, 0xFF, 0x5D, 0xD0, 0xFF, 0xFF, 0x64, 0x40, 0x00, 0x36, 0x04, 0x00, + 0xC9, 0x81, 0xF9, 0x60, 0x6B, 0x78, 0xFF, 0xFF, 0x5D, 0xD0, 0xFF, 0xFF, 0x64, 0x40, 0x50, 0x36, + 0x04, 0x00, 0xFD, 0xA1, 0xF9, 0x60, 0x6B, 0x78, 0xFF, 0xFF, 0x5D, 0xD0, 0xFF, 0xFF, 0x64, 0x40, + 0xF2, 0x36, 0x04, 0x00, 0xFC, 0xA1, 0xF9, 0x60, 0x6B, 0x78, 0xFF, 0xFF, 0x5D, 0xD0, 0xFF, 0xFF, + 0x64, 0x40, 0x01, 0x36, 0x04, 0x00, 0xFB, 0xA1, 0xF9, 0x60, 0x6B, 0x78, 0xFF, 0xFF, 0x5D, 0xD0, + 0xFF, 0xFF, 0x64, 0x40, 0x01, 0x36, 0x04, 0x00, 0xFA, 0xA1, 0xF9, 0x60, 0x6B, 0x78, 0xFF, 0xFF, + 0x5D, 0xD0, 0xFF, 0xFF, 0x64, 0x40, 0x00, 0x36, 0x04, 0x00, 0xF9, 0xA1, 0xF9, 0x60, 0x6B, 0x78, + 0xFF, 0xFF, 0x60, 0x5C, 0x00, 0x36, 0x32, 0x00, 0x00, 0x64, 0xFB, 0x60, 0x58, 0x4E, 0x66, 0x78, + 0xFF, 0xFF, 0x65, 0x40, 0x08, 0x26, 0xF7, 0x01, 0x1A, 0x60, 0x24, 0xFB, 0x64, 0x40, 0x00, 0x36, + 0x2A, 0x00, 0x5D, 0xD2, 0xDD, 0x81, 0xFB, 0x60, 0x58, 0x4E, 0x66, 0x78, 0xFF, 0xFF, 0x65, 0x40, + 0x08, 0x26, 0xF6, 0x01, 0x1A, 0x60, 0x25, 0xFB, 0x64, 0x40, 0x00, 0x36, 0x21, 0x00, 0x5D, 0xD2, + 0xDD, 0x81, 0xFB, 0x60, 0x58, 0x4E, 0x66, 0x78, 0xFF, 0xFF, 0x65, 0x40, 0x08, 0x26, 0xF6, 0x01, + 0x1A, 0x60, 0x26, 0xFB, 0x64, 0x40, 0x00, 0x36, 0x18, 0x00, 0x5D, 0xD0, 0x34, 0x60, 0x4E, 0x62, + 0xA2, 0xD9, 0x5D, 0xD0, 0x34, 0x60, 0x4F, 0x62, 0xA2, 0xD9, 0x14, 0x00, 0x20, 0xFE, 0x00, 0x60, + 0x04, 0x64, 0x1A, 0x60, 0x24, 0xFB, 0x20, 0xFE, 0x00, 0x60, 0x04, 0x64, 0x1A, 0x60, 0x25, 0xFB, + 0x20, 0xFE, 0x00, 0x60, 0x02, 0x64, 0x1A, 0x60, 0x26, 0xFB, 0x20, 0xFE, 0x00, 0x60, 0x00, 0x64, + 0x1A, 0x60, 0x27, 0xFB, 0x20, 0xFE, 0x1C, 0x60, 0x08, 0xF1, 0xFF, 0xFF, 0x03, 0x18, 0x01, 0x7C, + 0x1C, 0x60, 0x08, 0xF9, 0x1A, 0x60, 0x2B, 0xF1, 0xA2, 0xDD, 0x61, 0x44, 0x1A, 0x60, 0x28, 0xFB, + 0xD1, 0x84, 0xDC, 0x84, 0x64, 0x45, 0x34, 0x60, 0x10, 0x63, 0xBD, 0xDB, 0x60, 0x41, 0xCD, 0x84, + 0x4C, 0x91, 0x60, 0x43, 0x60, 0xFE, 0xA5, 0xD2, 0xDE, 0x85, 0x7F, 0x26, 0x02, 0x00, 0x00, 0xF4, + 0x04, 0x65, 0x5D, 0x93, 0xA3, 0xDB, 0x5D, 0x93, 0xA5, 0xD2, 0xF6, 0x1F, 0x5D, 0x93, 0x20, 0xFE, + 0xDF, 0x83, 0x1A, 0x60, 0x09, 0xF3, 0xFF, 0xFF, 0x60, 0x47, 0xA2, 0xDB, 0x1A, 0x60, 0x28, 0xF3, + 0x1A, 0x60, 0x2B, 0xF1, 0x60, 0x41, 0x64, 0x43, 0xF9, 0x60, 0x56, 0x78, 0xFF, 0xFF, 0x20, 0xFE, + 0x7C, 0x44, 0x1A, 0x60, 0x20, 0xFB, 0x1A, 0x60, 0x1A, 0xF1, 0x1A, 0x60, 0x24, 0xF3, 0xFF, 0xFF, + 0xA0, 0x84, 0xFF, 0xFF, 0x10, 0x26, 0x07, 0x00, 0x04, 0x26, 0x07, 0x00, 0x20, 0x26, 0x07, 0x00, + 0x02, 0x26, 0x07, 0x00, 0x3F, 0x00, 0x10, 0x7C, 0x05, 0x00, 0x04, 0x7C, 0x03, 0x00, 0x20, 0x7C, + 0x01, 0x00, 0x02, 0x7C, 0x1A, 0x60, 0x20, 0xF9, 0x7C, 0x44, 0x1A, 0x60, 0x21, 0xFB, 0x1A, 0x60, + 0x1B, 0xF1, 0x1A, 0x60, 0x25, 0xF3, 0x34, 0x60, 0x40, 0x61, 0xA0, 0x84, 0xA1, 0xD1, 0xFF, 0xFF, + 0x10, 0x26, 0x05, 0x00, 0x04, 0x26, 0x05, 0x00, 0x01, 0x26, 0x08, 0x00, 0x23, 0x00, 0x10, 0x7C, + 0x06, 0x00, 0x64, 0x40, 0x10, 0x26, 0x1E, 0x00, 0x04, 0x7C, 0x01, 0x00, 0x01, 0x7C, 0x1A, 0x60, + 0x21, 0xF9, 0x7C, 0x44, 0x1A, 0x60, 0x22, 0xFB, 0x1A, 0x60, 0x1C, 0xF1, 0x1A, 0x60, 0x26, 0xF3, + 0xFF, 0xFF, 0xA0, 0x84, 0x60, 0x40, 0x02, 0x26, 0x05, 0x00, 0x04, 0x26, 0x05, 0x00, 0x01, 0x26, + 0x05, 0x00, 0x08, 0x00, 0x02, 0x7C, 0x03, 0x00, 0x04, 0x7C, 0x01, 0x00, 0x20, 0x7C, 0x1A, 0x60, + 0x22, 0xF9, 0x09, 0x00, 0x7C, 0x44, 0x1A, 0x60, 0x20, 0xFB, 0x1A, 0x60, 0x21, 0xFB, 0x1A, 0x60, + 0x22, 0xFB, 0x1A, 0x60, 0x23, 0xFB, 0x7C, 0x44, 0x1A, 0x60, 0x20, 0xF1, 0xBD, 0xD9, 0x1A, 0x60, + 0x21, 0xF1, 0xB0, 0x84, 0xBD, 0xD9, 0x1A, 0x60, 0x22, 0xF1, 0xB0, 0x84, 0xBD, 0xD9, 0x1A, 0x60, + 0x1D, 0xF1, 0xB0, 0x84, 0xBD, 0xD9, 0x04, 0x03, 0x1C, 0x60, 0x08, 0xF1, 0xBD, 0xD9, 0x72, 0x00, + 0x16, 0x60, 0xC2, 0xF3, 0xFF, 0xFF, 0xFF, 0xA0, 0xFF, 0xFF, 0x0C, 0x24, 0x6B, 0x00, 0x60, 0x40, + 0x0B, 0x36, 0x68, 0x00, 0x20, 0x40, 0x10, 0x27, 0x65, 0x00, 0x91, 0x00, 0x20, 0xFE, 0x00, 0x65, + 0x60, 0xFE, 0x1A, 0x60, 0x28, 0xFB, 0xE0, 0x84, 0xE0, 0x84, 0x08, 0x20, 0x03, 0x00, 0x01, 0x64, + 0xA2, 0xDB, 0x02, 0x64, 0x02, 0xA5, 0x64, 0x44, 0xD4, 0x9C, 0xD4, 0x80, 0x34, 0x60, 0x52, 0x62, + 0x02, 0x05, 0x08, 0x65, 0x4D, 0x00, 0xA2, 0xD9, 0x7C, 0x44, 0x34, 0x60, 0x54, 0x62, 0xA2, 0xDB, + 0x20, 0xFE, 0x00, 0x64, 0x60, 0xFE, 0x1C, 0x60, 0x08, 0xF3, 0xFF, 0xFF, 0x00, 0xA0, 0x5D, 0xD0, + 0x00, 0x65, 0x04, 0x03, 0x64, 0x40, 0x00, 0x3A, 0x01, 0x65, 0x03, 0x00, 0x64, 0x40, 0x00, 0x3A, + 0x01, 0x65, 0x5D, 0xD0, 0x04, 0x03, 0x64, 0x40, 0x0F, 0x3A, 0x01, 0x65, 0x03, 0x00, 0x64, 0x40, + 0x50, 0x3A, 0x01, 0x65, 0x5D, 0xD0, 0x04, 0x03, 0x64, 0x40, 0xAC, 0x3A, 0x01, 0x65, 0x03, 0x00, + 0x64, 0x40, 0xF2, 0x3A, 0x01, 0x65, 0x5D, 0xD0, 0x65, 0x40, 0x00, 0x3A, 0x17, 0x00, 0x00, 0x60, + 0x00, 0x65, 0x64, 0x40, 0x00, 0x36, 0x01, 0x65, 0x64, 0x40, 0x01, 0x36, 0x02, 0x65, 0x64, 0x40, + 0x02, 0x36, 0x04, 0x65, 0x64, 0x40, 0x04, 0x36, 0x10, 0x65, 0x64, 0x40, 0x05, 0x36, 0x20, 0x65, + 0x65, 0x5C, 0x1A, 0x60, 0x2A, 0xF3, 0xFF, 0xFF, 0xB0, 0x84, 0xA2, 0xDB, 0x1A, 0x60, 0x28, 0xF3, + 0x00, 0x65, 0xFF, 0xA4, 0xA2, 0xDB, 0xBC, 0x02, 0x1A, 0x60, 0x2A, 0xF3, 0x1A, 0x60, 0x29, 0xF1, + 0x2E, 0x58, 0xFF, 0xFF, 0x20, 0xFE, 0x88, 0xF3, 0xFF, 0xFF, 0x3C, 0xA4, 0x88, 0xFB, 0x87, 0xF3, + 0x7D, 0xF1, 0x04, 0xA4, 0x87, 0xFB, 0x53, 0xF3, 0xFF, 0xFF, 0x60, 0x40, 0x80, 0x26, 0x0D, 0x00, + 0x7D, 0xF3, 0x10, 0x60, 0xF2, 0x61, 0xCC, 0x84, 0xFF, 0xFF, 0x02, 0x03, 0x06, 0xA1, 0xFB, 0x01, + 0xA1, 0xD3, 0xFF, 0xFF, 0x02, 0xBC, 0xA1, 0xDB, 0x12, 0x00, 0x7D, 0xF3, 0x11, 0x60, 0x60, 0x63, + 0x01, 0x60, 0xFF, 0x65, 0xA4, 0x84, 0x12, 0x60, 0x40, 0x65, 0xA3, 0xD1, 0xD7, 0x80, 0xD0, 0x80, + 0x06, 0x03, 0x02, 0x03, 0x08, 0xA3, 0xF9, 0x01, 0x02, 0xA3, 0x04, 0x64, 0xA3, 0xDB, 0x20, 0xFE, + 0x26, 0x46, 0x31, 0x40, 0x20, 0x2A, 0x35, 0x00, 0x3F, 0xF2, 0x47, 0x65, 0xC4, 0x84, 0xE8, 0x84, + 0x23, 0xFA, 0xF1, 0x60, 0x02, 0x64, 0x24, 0xFA, 0x7D, 0xF3, 0x01, 0x60, 0xFF, 0x65, 0xA4, 0x84, + 0x01, 0x23, 0x14, 0x00, 0x11, 0x60, 0x60, 0x61, 0x12, 0x60, 0x40, 0x65, 0xA1, 0xD1, 0xD5, 0x80, + 0xD0, 0x80, 0x0B, 0x03, 0x02, 0x03, 0x08, 0xA1, 0xF9, 0x01, 0x04, 0xA1, 0xA1, 0xD3, 0x01, 0x60, + 0x00, 0x65, 0x60, 0x47, 0xFF, 0xB4, 0xB4, 0x84, 0x01, 0x00, 0x01, 0x64, 0x00, 0xF4, 0x08, 0xFA, + 0xFF, 0xFF, 0x26, 0x46, 0x26, 0x60, 0x0A, 0x64, 0x13, 0x60, 0x0D, 0xFB, 0x26, 0x44, 0x5A, 0xDB, + 0x02, 0x64, 0x5A, 0xDB, 0xFF, 0xFF, 0x2B, 0xFF, 0xFA, 0xFE, 0x00, 0x66, 0x46, 0x46, 0x2F, 0x58, + 0xFF, 0xFF, 0x26, 0x46, 0x2F, 0x58, 0xFF, 0xFF, 0x78, 0xFB, 0xAC, 0x85, 0x60, 0x41, 0x55, 0x03, + 0x32, 0x60, 0x00, 0x63, 0x1B, 0x60, 0x04, 0xFD, 0x62, 0x43, 0x1A, 0x60, 0xB4, 0xFD, 0x1A, 0x60, + 0xBA, 0xFD, 0x1A, 0x60, 0xC4, 0xFD, 0x1A, 0x60, 0xCE, 0xFD, 0x00, 0x63, 0xE9, 0x81, 0x08, 0x64, + 0x02, 0x24, 0xDF, 0x83, 0xFB, 0x02, 0x53, 0x94, 0x32, 0x7F, 0x03, 0x06, 0x1B, 0x60, 0x04, 0xFB, + 0x08, 0x63, 0x63, 0x5E, 0x01, 0x7F, 0x19, 0x60, 0x8A, 0xFB, 0x65, 0x41, 0x33, 0x60, 0x16, 0x65, + 0x0F, 0x60, 0xF4, 0x64, 0xE9, 0x81, 0x58, 0xD1, 0xFD, 0x04, 0xCF, 0x83, 0xA5, 0xD9, 0x0C, 0x03, + 0xE9, 0x81, 0x58, 0xD1, 0xFD, 0x04, 0x40, 0x48, 0xA5, 0xD1, 0x64, 0x5F, 0x64, 0x5E, 0xA5, 0xDB, + 0xDA, 0x85, 0xCF, 0x83, 0x28, 0x44, 0xEE, 0x02, 0x00, 0xB9, 0xD8, 0x83, 0x15, 0x03, 0x36, 0x60, + 0x0A, 0x65, 0xE9, 0x81, 0xBD, 0xD1, 0x02, 0x05, 0xFC, 0x02, 0x17, 0x00, 0xA5, 0xD9, 0x15, 0x03, + 0xE9, 0x81, 0xBD, 0xD1, 0x02, 0x05, 0xFC, 0x02, 0x10, 0x00, 0xA5, 0xD3, 0xFF, 0xFF, 0x64, 0x5F, + 0xA5, 0xDB, 0xDA, 0x85, 0xEE, 0x02, 0x09, 0x00, 0x67, 0x43, 0x1A, 0x60, 0xB4, 0xFD, 0x1A, 0x60, + 0xBA, 0xFD, 0x1A, 0x60, 0xC4, 0xFD, 0x1A, 0x60, 0xCE, 0xFD, 0x2E, 0x45, 0x25, 0x60, 0x46, 0x64, + 0xD4, 0x80, 0xFF, 0xFF, 0x10, 0x03, 0x20, 0x40, 0x10, 0x27, 0x0D, 0x00, 0x33, 0x60, 0x1E, 0x61, + 0x19, 0x60, 0x8A, 0xF3, 0xA1, 0xDB, 0xFF, 0xB4, 0xCC, 0x84, 0xA8, 0x83, 0x33, 0x60, 0x14, 0x64, + 0x58, 0xD1, 0x59, 0xD9, 0xFD, 0x1F, 0x7D, 0xF3, 0x33, 0x60, 0x20, 0x63, 0x60, 0x40, 0x01, 0x27, + 0x03, 0x00, 0x19, 0x60, 0x3B, 0xF3, 0x02, 0x00, 0x19, 0x60, 0x3C, 0xF3, 0x08, 0x61, 0x60, 0xFE, + 0xA3, 0xD1, 0xFF, 0xFF, 0x20, 0xFE, 0x00, 0xA8, 0xE8, 0x84, 0x0F, 0x03, 0x60, 0xFE, 0x02, 0x28, + 0xF6, 0x01, 0x80, 0x62, 0xB2, 0x9C, 0xBD, 0xD9, 0x7B, 0xF9, 0xCD, 0x81, 0x00, 0x36, 0x01, 0x00, + 0xEE, 0x01, 0x36, 0x60, 0x0A, 0x63, 0x08, 0x61, 0xEA, 0x01, 0x2E, 0x58, 0xFF, 0xFF, 0x32, 0x60, + 0x76, 0x63, 0x65, 0x40, 0xFF, 0x36, 0x02, 0xA3, 0xA3, 0xD3, 0xFF, 0xFF, 0xE8, 0x84, 0xE8, 0x84, + 0xE8, 0x84, 0xE8, 0x84, 0x40, 0x26, 0x7F, 0xB4, 0x20, 0x26, 0x3F, 0xB4, 0x60, 0x45, 0x80, 0x63, + 0xFD, 0x60, 0x58, 0x4D, 0x34, 0x78, 0xFF, 0xFF, 0x19, 0x60, 0x7D, 0xFB, 0x40, 0x63, 0xFD, 0x60, + 0x58, 0x4D, 0x34, 0x78, 0xFF, 0xFF, 0x19, 0x60, 0x7E, 0xFB, 0x20, 0x63, 0xFD, 0x60, 0x58, 0x4D, + 0x34, 0x78, 0xFF, 0xFF, 0x19, 0x60, 0x7F, 0xFB, 0x10, 0x63, 0xFD, 0x60, 0x58, 0x4D, 0x34, 0x78, + 0xFF, 0xFF, 0x19, 0x60, 0x80, 0xFB, 0x08, 0x63, 0xFD, 0x60, 0x58, 0x4D, 0x34, 0x78, 0xFF, 0xFF, + 0x19, 0x60, 0x81, 0xFB, 0x04, 0x63, 0xFD, 0x60, 0x58, 0x4D, 0x34, 0x78, 0xFF, 0xFF, 0x19, 0x60, + 0x82, 0xFB, 0x02, 0x63, 0xFD, 0x60, 0x58, 0x4D, 0x34, 0x78, 0xFF, 0xFF, 0x19, 0x60, 0x83, 0xFB, + 0x01, 0x63, 0xFD, 0x60, 0x58, 0x4D, 0x34, 0x78, 0xFF, 0xFF, 0x19, 0x60, 0x84, 0xFB, 0x2E, 0x58, + 0xFF, 0xFF, 0x19, 0x60, 0x3B, 0xF3, 0xFF, 0xFF, 0x0F, 0xB4, 0x60, 0x45, 0x08, 0x63, 0xFD, 0x60, + 0x58, 0x4D, 0x5F, 0x78, 0xFF, 0xFF, 0x19, 0x60, 0x85, 0xFB, 0x04, 0x63, 0xFD, 0x60, 0x58, 0x4D, + 0x5F, 0x78, 0xFF, 0xFF, 0x19, 0x60, 0x86, 0xFB, 0x02, 0x63, 0xFD, 0x60, 0x58, 0x4D, 0x5F, 0x78, + 0xFF, 0xFF, 0x19, 0x60, 0x87, 0xFB, 0x01, 0x63, 0xFD, 0x60, 0x58, 0x4D, 0x5F, 0x78, 0xFF, 0xFF, + 0x19, 0x60, 0x88, 0xFB, 0x2E, 0x58, 0xFF, 0xFF, 0x63, 0x5C, 0xA7, 0x84, 0xEB, 0x83, 0x14, 0x02, + 0x01, 0x03, 0xFB, 0x01, 0x64, 0x44, 0x01, 0x36, 0x0B, 0x64, 0x02, 0x36, 0x0B, 0x64, 0x04, 0x36, + 0x0A, 0x64, 0x08, 0x36, 0x0A, 0x64, 0x10, 0x36, 0x09, 0x64, 0x20, 0x36, 0x09, 0x64, 0x40, 0x36, + 0x09, 0x64, 0x80, 0x36, 0x09, 0x64, 0x11, 0x00, 0x60, 0x40, 0x01, 0x36, 0x0B, 0x64, 0x02, 0x36, + 0x0F, 0x64, 0x04, 0x36, 0x0A, 0x64, 0x08, 0x36, 0x0E, 0x64, 0x10, 0x36, 0x09, 0x64, 0x20, 0x36, + 0x0D, 0x64, 0x40, 0x36, 0x08, 0x64, 0x80, 0x36, 0x0C, 0x64, 0x2D, 0x58, 0xFF, 0xFF, 0x63, 0x5C, + 0xA7, 0x84, 0xEB, 0x83, 0x0C, 0x02, 0x01, 0x03, 0xFB, 0x01, 0x64, 0x44, 0x01, 0x36, 0x0A, 0x64, + 0x02, 0x36, 0x14, 0x64, 0x04, 0x36, 0x37, 0x64, 0x08, 0x36, 0x6E, 0x64, 0x09, 0x00, 0x60, 0x40, + 0x01, 0x36, 0x0A, 0x64, 0x02, 0x36, 0x14, 0x64, 0x04, 0x36, 0x37, 0x64, 0x08, 0x36, 0x6E, 0x64, + 0x2D, 0x58, 0xFF, 0xFF, 0x60, 0xFE, 0x81, 0xA1, 0x7F, 0xA1, 0x02, 0x06, 0x00, 0xF4, 0x03, 0x61, + 0x5D, 0xD2, 0xCF, 0x83, 0xD4, 0x80, 0x25, 0x03, 0x16, 0x03, 0xCF, 0x83, 0x61, 0x44, 0x80, 0xA0, + 0x20, 0x03, 0x02, 0x02, 0x00, 0xF4, 0x03, 0x61, 0x5D, 0xD2, 0xCF, 0x83, 0x81, 0xA1, 0x19, 0x03, + 0x05, 0x07, 0x7F, 0xA1, 0xCC, 0x84, 0xDD, 0x81, 0xE6, 0x03, 0xF7, 0x01, 0x00, 0xF4, 0x00, 0xB8, + 0x04, 0x61, 0xE6, 0x03, 0xF2, 0x01, 0x2C, 0x43, 0x5D, 0xD0, 0xDE, 0xD9, 0x64, 0x44, 0x5D, 0xD0, + 0xDE, 0xD9, 0xCC, 0x84, 0x81, 0xA1, 0x05, 0x03, 0x7F, 0xA1, 0xF9, 0x04, 0x00, 0xF4, 0x03, 0x61, + 0xF6, 0x01, 0x20, 0xFE, 0x2E, 0x58, 0xFF, 0xFF, 0x01, 0x3A, 0x02, 0x00, 0x16, 0x64, 0x2B, 0x00, + 0x02, 0x3A, 0x02, 0x00, 0x14, 0x64, 0x27, 0x00, 0x04, 0x3A, 0x02, 0x00, 0x12, 0x64, 0x23, 0x00, + 0x08, 0x3A, 0x02, 0x00, 0x10, 0x64, 0x1F, 0x00, 0x10, 0x3A, 0x02, 0x00, 0x0E, 0x64, 0x1B, 0x00, + 0x20, 0x3A, 0x02, 0x00, 0x0C, 0x64, 0x17, 0x00, 0x40, 0x3A, 0x02, 0x00, 0x0A, 0x64, 0x13, 0x00, + 0x80, 0x3A, 0x02, 0x00, 0x08, 0x64, 0x0F, 0x00, 0x01, 0x3B, 0x02, 0x00, 0x06, 0x64, 0x0B, 0x00, + 0x02, 0x3B, 0x02, 0x00, 0x04, 0x64, 0x07, 0x00, 0x04, 0x3B, 0x02, 0x00, 0x02, 0x64, 0x03, 0x00, + 0x08, 0x3B, 0xFF, 0x01, 0x00, 0x64, 0x2E, 0x58, 0xFF, 0xFF, 0x27, 0xF2, 0xFF, 0xFF, 0x60, 0x40, + 0x36, 0x3A, 0x02, 0x00, 0x00, 0x61, 0x30, 0x00, 0x30, 0x3A, 0x02, 0x00, 0x02, 0x61, 0x2C, 0x00, + 0x24, 0x3A, 0x02, 0x00, 0x04, 0x61, 0x28, 0x00, 0x18, 0x3A, 0x02, 0x00, 0x06, 0x61, 0x24, 0x00, + 0x12, 0x3A, 0x02, 0x00, 0x08, 0x61, 0x20, 0x00, 0x0C, 0x3A, 0x02, 0x00, 0x0A, 0x61, 0x1C, 0x00, + 0x09, 0x3A, 0x02, 0x00, 0x0C, 0x61, 0x18, 0x00, 0x06, 0x3A, 0x02, 0x00, 0x0E, 0x61, 0x14, 0x00, + 0x6E, 0x3A, 0x02, 0x00, 0x10, 0x61, 0x10, 0x00, 0x37, 0x3A, 0x02, 0x00, 0x12, 0x61, 0x0C, 0x00, + 0x14, 0x3A, 0x02, 0x00, 0x14, 0x61, 0x08, 0x00, 0x0A, 0x3A, 0x02, 0x00, 0x16, 0x61, 0x04, 0x00, + 0x78, 0x43, 0x03, 0x61, 0x29, 0x60, 0xEA, 0x78, 0x65, 0x40, 0x01, 0x3A, 0x13, 0x00, 0x66, 0x45, + 0x2B, 0x46, 0x92, 0xFA, 0x65, 0x46, 0x26, 0xF2, 0xFF, 0xFF, 0x60, 0x41, 0x00, 0x7F, 0x60, 0x45, + 0x61, 0x47, 0x00, 0x7F, 0xD4, 0x84, 0x66, 0x41, 0x2B, 0x46, 0x0E, 0xF2, 0x60, 0x45, 0x65, 0x5E, + 0x0E, 0xFA, 0x61, 0x46, 0x2E, 0x58, 0xFF, 0xFF, 0xCD, 0x81, 0x7F, 0xB4, 0x02, 0x3A, 0x02, 0x00, + 0x01, 0x64, 0x32, 0x00, 0x04, 0x3A, 0x02, 0x00, 0x02, 0x64, 0x2E, 0x00, 0x0B, 0x3A, 0x02, 0x00, + 0x04, 0x64, 0x2A, 0x00, 0x16, 0x3A, 0x02, 0x00, 0x08, 0x64, 0x26, 0x00, 0x0C, 0x3A, 0x02, 0x00, + 0x10, 0x64, 0x22, 0x00, 0x12, 0x3A, 0x02, 0x00, 0x20, 0x64, 0x1E, 0x00, 0x18, 0x3A, 0x02, 0x00, + 0x40, 0x64, 0x1A, 0x00, 0x24, 0x3A, 0x02, 0x00, 0x80, 0x64, 0x16, 0x00, 0x30, 0x3A, 0x03, 0x00, + 0x00, 0x7E, 0x01, 0x7F, 0x11, 0x00, 0x48, 0x3A, 0x03, 0x00, 0x00, 0x7E, 0x02, 0x7F, 0x0C, 0x00, + 0x60, 0x3A, 0x03, 0x00, 0x00, 0x7E, 0x04, 0x7F, 0x07, 0x00, 0x6C, 0x3A, 0x03, 0x00, 0x00, 0x7E, + 0x08, 0x7F, 0x02, 0x00, 0x00, 0x64, 0x00, 0x00, 0x20, 0xFE, 0x2A, 0x45, 0x34, 0x8A, 0x60, 0xFE, + 0x61, 0x40, 0x00, 0x36, 0x02, 0x00, 0xBD, 0xD3, 0xBF, 0x01, 0x2E, 0x58, 0xFF, 0xFF, + +}; /* fw_image_4_data */ + +static const CFG_IDENTITY_STRCT fw_image_infoidentity[] = { + { + sizeof( CFG_IDENTITY_STRCT ) / sizeof(hcf_16) - 1, + CFG_FW_IDENTITY, + COMP_ID_FW_STA, + 4, //Variant + 1, //Major + 36 //Minor + }, + { 0000, 0000, 0000, 0000, 0000, 0000 } //endsentinel +}; + +static const CFG_PROG_STRCT fw_image_code[] = { + { + 8, + CFG_PROG, + CFG_PROG_VOLATILE, // mode + 0x0184, // sizeof(fw_image_1_data), + 0x00000060, // Target address in NIC Memory + 0x0000, // CRC: yes/no TYPE: primary/station/tertiary + (hcf_8 FAR *) fw_image_1_data + }, + { + 8, + CFG_PROG, + CFG_PROG_VOLATILE, // mode + 0x2c0e, // sizeof(fw_image_2_data), + 0x00000C16, // Target address in NIC Memory + 0x0000, // CRC: yes/no TYPE: primary/station/tertiary + (hcf_8 FAR *) fw_image_2_data + }, + { + 8, + CFG_PROG, + CFG_PROG_VOLATILE, // mode + 0x54de, // sizeof(fw_image_3_data), + 0x001E3824, // Target address in NIC Memory + 0x0000, // CRC: yes/no TYPE: primary/station/tertiary + (hcf_8 FAR *) fw_image_3_data + }, + { + 8, + CFG_PROG, + CFG_PROG_VOLATILE, // mode + 0xbcde, // sizeof(fw_image_4_data), + 0x001F4000, // Target address in NIC Memory + 0x0000, // CRC: yes/no TYPE: primary/station/tertiary + (hcf_8 FAR *) fw_image_4_data + }, + { + 5, + CFG_PROG, + CFG_PROG_STOP, // mode + 0000, + 0x000F429B, // Start execution address + }, + { 0000, 0000, 0000, 0000, 00000000, 0000, 00000000} +}; + +static const CFG_RANGE20_STRCT fw_image_infocompat[] = { + { 3 + ((20 * sizeof(CFG_RANGE_SPEC_STRCT)) / sizeof(hcf_16)), + CFG_FW_SUP_RANGE, + COMP_ROLE_SUPL, + COMP_ID_STA, + { + { 4, 1, 2 } //variant, bottom, top + } + }, + { 3 + ((20 * sizeof(CFG_RANGE_SPEC_STRCT)) / sizeof(hcf_16)), + CFG_MFI_ACT_RANGES_STA, + COMP_ROLE_ACT, + COMP_ID_MFI, + { + { 7, 3, 3 }, //variant, bottom, top + { 8, 1, 1 } //variant, bottom, top + } + }, + { 3 + ((20 * sizeof(CFG_RANGE_SPEC_STRCT)) / sizeof(hcf_16)), + CFG_CFI_ACT_RANGES_STA, + COMP_ROLE_ACT, + COMP_ID_CFI, + { + { 4, 1, 2 } //variant, bottom, top + } + }, + { 0000, 0000, 0000, 0000, { { 0000, 0000, 0000 } } } //endsentinel +}; + +memimage fw_image = { + "FUPU7D37dhfwci\001C", //signature, , C/Bin type + (CFG_PROG_STRCT *) fw_image_code, + 0x000F429B, + 00000000, //(dummy) pdaplug + 00000000, //(dummy) priplug + (CFG_RANGE20_STRCT *) fw_image_infocompat, + (CFG_IDENTITY_STRCT *) fw_image_infoidentity, +}; + diff --git a/drivers/staging/wlags49_h2/wl_cs.c b/drivers/staging/wlags49_h2/wl_cs.c new file mode 100644 index 000000000000..c93e8c8b9699 --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_cs.c @@ -0,0 +1,715 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * This file contains processing and initialization specific to Card Services + * devices (PCMCIA, CF). + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/08/06 11:25:37 $ + * $Revision: 1.5 $ + * $Source: /usr/local/cvs/wl_lkm/wireless/wl_cs.c,v $ + * + ******************************************************************************/ + + +/******************************************************************************* + * include files + ******************************************************************************/ +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + + +/******************************************************************************* + * macro definitions + ******************************************************************************/ +#define CS_CHECK(fn, ret) do { \ + last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; \ + } while (0) + +/******************************************************************************* + * global definitions + ******************************************************************************/ +#if DBG +extern dbg_info_t *DbgInfo; +#endif /* DBG */ + + +/******************************************************************************* + * wl_adapter_attach() + ******************************************************************************* + * + * DESCRIPTION: + * + * Creates an instance of the driver, allocating local data structures for + * one device. The device is registered with Card Services. + * + * PARAMETERS: + * + * none + * + * RETURNS: + * + * pointer to an allocated dev_link_t structure + * NULL on failure + * + ******************************************************************************/ +static int wl_adapter_attach(struct pcmcia_device *link) +{ + struct net_device *dev; + struct wl_private *lp; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_adapter_attach" ); + DBG_ENTER( DbgInfo ); + + dev = wl_device_alloc(); + if(dev == NULL) { + DBG_ERROR( DbgInfo, "wl_device_alloc returned NULL\n"); + return -ENOMEM; + } + + link->io.NumPorts1 = HCF_NUM_IO_PORTS; + link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; + link->io.IOAddrLines = 6; + link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; + link->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_LEVEL_ID; + link->irq.Handler = &wl_isr; + link->conf.Attributes = CONF_ENABLE_IRQ; + link->conf.IntType = INT_MEMORY_AND_IO; + link->conf.ConfigIndex = 5; + link->conf.Present = PRESENT_OPTION; + + link->priv = link->irq.Instance = dev; + lp = wl_priv(dev); + lp->link = link; + + wl_adapter_insert(link); + + DBG_LEAVE( DbgInfo ); + return 0; +} // wl_adapter_attach +/*============================================================================*/ + + + +/******************************************************************************* + * wl_adapter_detach() + ******************************************************************************* + * + * DESCRIPTION: + * + * This deletes a driver "instance". The device is de-registered with Card + * Services. If it has been released, then the net device is unregistered, and + * all local data structures are freed. Otherwise, the structures will be + * freed when the device is released. + * + * PARAMETERS: + * + * link - pointer to the dev_link_t structure representing the device to + * detach + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +static void wl_adapter_detach(struct pcmcia_device *link) +{ + struct net_device *dev = link->priv; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wl_adapter_detach" ); + DBG_ENTER( DbgInfo ); + DBG_PARAM( DbgInfo, "link", "0x%p", link ); + + wl_adapter_release(link); + + if (dev) { + unregister_wlags_sysfs(dev); + unregister_netdev(dev); + } + + wl_device_dealloc(dev); + + DBG_LEAVE( DbgInfo ); +} // wl_adapter_detach +/*============================================================================*/ + + +/******************************************************************************* + * wl_adapter_release() + ******************************************************************************* + * + * DESCRIPTION: + * + * After a card is removed, this routine will release the PCMCIA + * configuration. If the device is still open, this will be postponed until it + * is closed. + * + * PARAMETERS: + * + * arg - a u_long representing a pointer to a dev_link_t structure for the + * device to be released. + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_adapter_release( struct pcmcia_device *link ) +{ + DBG_FUNC( "wl_adapter_release" ); + DBG_ENTER( DbgInfo ); + DBG_PARAM( DbgInfo, "link", "0x%p", link); + + /* Stop hardware */ + wl_remove(link->priv); + + pcmcia_disable_device(link); + + DBG_LEAVE( DbgInfo ); +} // wl_adapter_release +/*============================================================================*/ + +static int wl_adapter_suspend(struct pcmcia_device *link) +{ + struct net_device *dev = link->priv; + + //if (link->open) { + netif_device_detach(dev); + wl_suspend(dev); +//// CHECK! pcmcia_release_configuration(link->handle); + //} + + return 0; +} // wl_adapter_suspend + +static int wl_adapter_resume(struct pcmcia_device *link) +{ + struct net_device *dev = link->priv; + + wl_resume(dev); + + netif_device_attach( dev ); + + return 0; +} // wl_adapter_resume + +/******************************************************************************* + * wl_adapter_insert() + ******************************************************************************* + * + * DESCRIPTION: + * + * wl_adapter_insert() is scheduled to run after a CARD_INSERTION event is + * received, to configure the PCMCIA socket, and to make the ethernet device + * available to the system. + * + * PARAMETERS: + * + * link - pointer to the dev_link_t structure representing the device to + * insert + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_adapter_insert( struct pcmcia_device *link ) +{ + struct net_device *dev; + int i; + int last_fn, last_ret; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_adapter_insert" ); + DBG_ENTER( DbgInfo ); + DBG_PARAM( DbgInfo, "link", "0x%p", link ); + + dev = link->priv; + + /* Do we need to allocate an interrupt? */ + link->conf.Attributes |= CONF_ENABLE_IRQ; + + CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); + CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); + CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); + + + dev->irq = link->irq.AssignedIRQ; + dev->base_addr = link->io.BasePort1; + + SET_NETDEV_DEV(dev, &handle_to_dev(link)); + if (register_netdev(dev) != 0) { + printk("%s: register_netdev() failed\n", MODULE_NAME); + goto failed; + } + link->dev_node = &( wl_priv(dev) )->node; + strcpy(( wl_priv(dev) )->node.dev_name, dev->name); + register_wlags_sysfs(dev); + + printk(KERN_INFO "%s: Wireless, io_addr %#03lx, irq %d, ""mac_address ", + dev->name, dev->base_addr, dev->irq); + for( i = 0; i < ETH_ALEN; i++ ) { + printk("%02X%c", dev->dev_addr[i], ((i < (ETH_ALEN-1)) ? ':' : '\n')); + } + + DBG_LEAVE( DbgInfo ); + return; + + +cs_failed: + cs_error( link, last_fn, last_ret ); + + +failed: + wl_adapter_release( link ); + + DBG_LEAVE(DbgInfo); + return; +} // wl_adapter_insert +/*============================================================================*/ + + +/******************************************************************************* + * wl_adapter_open() + ******************************************************************************* + * + * DESCRIPTION: + * + * Open the device. + * + * PARAMETERS: + * + * dev - a pointer to a net_device structure representing the network + * device to open. + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wl_adapter_open( struct net_device *dev ) +{ + struct wl_private *lp = wl_priv(dev); + struct pcmcia_device *link = lp->link; + int result = 0; + int hcf_status = HCF_SUCCESS; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wl_adapter_open" ); + DBG_ENTER( DbgInfo ); + DBG_PRINT( "%s\n", VERSION_INFO ); + DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev ); + + if(!pcmcia_dev_present(link)) + { + DBG_LEAVE( DbgInfo ); + return -ENODEV; + } + + link->open++; + + hcf_status = wl_open( dev ); + + if( hcf_status != HCF_SUCCESS ) { + link->open--; + result = -ENODEV; + } + + DBG_LEAVE( DbgInfo ); + return result; +} // wl_adapter_open +/*============================================================================*/ + + +/******************************************************************************* + * wl_adapter_close() + ******************************************************************************* + * + * DESCRIPTION: + * + * Close the device. + * + * PARAMETERS: + * + * dev - a pointer to a net_device structure representing the network + * device to close. + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wl_adapter_close( struct net_device *dev ) +{ + struct wl_private *lp = wl_priv(dev); + struct pcmcia_device *link = lp->link; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wl_adapter_close" ); + DBG_ENTER( DbgInfo ); + DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev ); + + if( link == NULL ) { + DBG_LEAVE( DbgInfo ); + return -ENODEV; + } + + DBG_TRACE( DbgInfo, "%s: Shutting down adapter.\n", dev->name ); + wl_close( dev ); + + link->open--; + + DBG_LEAVE( DbgInfo ); + return 0; +} // wl_adapter_close +/*============================================================================*/ + +static struct pcmcia_device_id wl_adapter_ids[] = { +#if ! ((HCF_TYPE) & HCF_TYPE_HII5) + PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0003), + PCMCIA_DEVICE_PROD_ID12("Agere Systems", "Wireless PC Card Model 0110", + 0x33103a9b, 0xe175b0dd), +#else + PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0004), + PCMCIA_DEVICE_PROD_ID12("Linksys", "WCF54G_Wireless-G_CompactFlash_Card", + 0x0733cc81, 0x98a599e1), +#endif // (HCF_TYPE) & HCF_TYPE_HII5 + PCMCIA_DEVICE_NULL, + }; +MODULE_DEVICE_TABLE(pcmcia, wl_adapter_ids); + +static struct pcmcia_driver wlags49_driver = { + .owner = THIS_MODULE, + .drv = { + .name = DRIVER_NAME, + }, + .probe = wl_adapter_attach, + .remove = wl_adapter_detach, + .id_table = wl_adapter_ids, + .suspend = wl_adapter_suspend, + .resume = wl_adapter_resume, +}; + + + +/******************************************************************************* + * wl_adapter_init_module() + ******************************************************************************* + * + * DESCRIPTION: + * + * Called by init_module() to perform PCMCIA driver initialization. + * + * PARAMETERS: + * + * N/A + * + * RETURNS: + * + * 0 on success + * -1 on error + * + ******************************************************************************/ +int wl_adapter_init_module( void ) +{ + int ret; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wl_adapter_init_module" ); + DBG_ENTER( DbgInfo ); + DBG_TRACE( DbgInfo, "wl_adapter_init_module() -- PCMCIA\n" ); + + ret = pcmcia_register_driver(&wlags49_driver); + + DBG_LEAVE( DbgInfo ); + return ret; +} // wl_adapter_init_module +/*============================================================================*/ + + +/******************************************************************************* + * wl_adapter_cleanup_module() + ******************************************************************************* + * + * DESCRIPTION: + * + * Called by cleanup_module() to perform driver uninitialization. + * + * PARAMETERS: + * + * N/A + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_adapter_cleanup_module( void ) +{ + DBG_FUNC( "wl_adapter_cleanup_module" ); + DBG_ENTER( DbgInfo ); + DBG_TRACE( DbgInfo, "wl_adapter_cleanup_module() -- PCMCIA\n" ); + + + pcmcia_unregister_driver(&wlags49_driver); + + DBG_LEAVE( DbgInfo ); + return; +} // wl_adapter_cleanup_module +/*============================================================================*/ + + +/******************************************************************************* + * wl_adapter_is_open() + ******************************************************************************* + * + * DESCRIPTION: + * + * Check with Card Services to determine if this device is open. + * + * PARAMETERS: + * + * dev - a pointer to the net_device structure whose open status will be + * checked + * + * RETURNS: + * + * nonzero if device is open + * 0 otherwise + * + ******************************************************************************/ +int wl_adapter_is_open( struct net_device *dev ) +{ + struct wl_private *lp = wl_priv(dev); + struct pcmcia_device *link = lp->link; + + if(!pcmcia_dev_present(link)) { + return 0; + } + + return( link->open ); +} // wl_adapter_is_open +/*============================================================================*/ + + +#if DBG + +/******************************************************************************* + * DbgEvent() + ******************************************************************************* + * + * DESCRIPTION: + * + * Converts the card serivces events to text for debugging. + * + * PARAMETERS: + * + * mask - a integer representing the error(s) being reported by Card + * Services. + * + * RETURNS: + * + * a pointer to a string describing the error(s) + * + ******************************************************************************/ +const char* DbgEvent( int mask ) +{ + static char DbgBuffer[256]; + char *pBuf; + /*------------------------------------------------------------------------*/ + + + pBuf = DbgBuffer; + *pBuf = '\0'; + + + if( mask & CS_EVENT_WRITE_PROTECT ) + strcat( pBuf, "WRITE_PROTECT " ); + + if(mask & CS_EVENT_CARD_LOCK) + strcat( pBuf, "CARD_LOCK " ); + + if(mask & CS_EVENT_CARD_INSERTION) + strcat( pBuf, "CARD_INSERTION " ); + + if(mask & CS_EVENT_CARD_REMOVAL) + strcat( pBuf, "CARD_REMOVAL " ); + + if(mask & CS_EVENT_BATTERY_DEAD) + strcat( pBuf, "BATTERY_DEAD " ); + + if(mask & CS_EVENT_BATTERY_LOW) + strcat( pBuf, "BATTERY_LOW " ); + + if(mask & CS_EVENT_READY_CHANGE) + strcat( pBuf, "READY_CHANGE " ); + + if(mask & CS_EVENT_CARD_DETECT) + strcat( pBuf, "CARD_DETECT " ); + + if(mask & CS_EVENT_RESET_REQUEST) + strcat( pBuf, "RESET_REQUEST " ); + + if(mask & CS_EVENT_RESET_PHYSICAL) + strcat( pBuf, "RESET_PHYSICAL " ); + + if(mask & CS_EVENT_CARD_RESET) + strcat( pBuf, "CARD_RESET " ); + + if(mask & CS_EVENT_REGISTRATION_COMPLETE) + strcat( pBuf, "REGISTRATION_COMPLETE " ); + + // if(mask & CS_EVENT_RESET_COMPLETE) + // strcat( pBuf, "RESET_COMPLETE " ); + + if(mask & CS_EVENT_PM_SUSPEND) + strcat( pBuf, "PM_SUSPEND " ); + + if(mask & CS_EVENT_PM_RESUME) + strcat( pBuf, "PM_RESUME " ); + + if(mask & CS_EVENT_INSERTION_REQUEST) + strcat( pBuf, "INSERTION_REQUEST " ); + + if(mask & CS_EVENT_EJECTION_REQUEST) + strcat( pBuf, "EJECTION_REQUEST " ); + + if(mask & CS_EVENT_MTD_REQUEST) + strcat( pBuf, "MTD_REQUEST " ); + + if(mask & CS_EVENT_ERASE_COMPLETE) + strcat( pBuf, "ERASE_COMPLETE " ); + + if(mask & CS_EVENT_REQUEST_ATTENTION) + strcat( pBuf, "REQUEST_ATTENTION " ); + + if(mask & CS_EVENT_CB_DETECT) + strcat( pBuf, "CB_DETECT " ); + + if(mask & CS_EVENT_3VCARD) + strcat( pBuf, "3VCARD " ); + + if(mask & CS_EVENT_XVCARD) + strcat( pBuf, "XVCARD " ); + + + if( *pBuf ) { + pBuf[strlen(pBuf) - 1] = '\0'; + } else { + if( mask != 0x0 ) { + sprintf( pBuf, "<<0x%08x>>", mask ); + } + } + + return pBuf; +} // DbgEvent +/*============================================================================*/ + +#endif /* DBG */ diff --git a/drivers/staging/wlags49_h2/wl_cs.h b/drivers/staging/wlags49_h2/wl_cs.h new file mode 100644 index 000000000000..3971fbc4e6ef --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_cs.h @@ -0,0 +1,112 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * Header describing information required for the driver to support PCMCIA. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/07/19 08:16:15 $ + * $Revision: 1.2 $ + * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_cs.h,v $ + * + ******************************************************************************/ + + + + +#ifndef __WL_CS_H__ +#define __WL_CS_H__ + + + + +/******************************************************************************* + * function protoypes + ******************************************************************************/ + +void wl_adapter_insert(struct pcmcia_device *link); + +void wl_adapter_release(struct pcmcia_device *link); + +int wl_adapter_event(event_t event, int priority, event_callback_args_t *args ); + +int wl_adapter_init_module( void ); + +void wl_adapter_cleanup_module( void ); + +int wl_adapter_open(struct net_device *dev); + +int wl_adapter_close(struct net_device *dev); + +int wl_adapter_is_open(struct net_device *dev); + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) +void cs_error(client_handle_t handle, int func, int ret); +#endif + +const char *DbgEvent( int mask ); + + + +#endif // __WL_CS_H__ diff --git a/drivers/staging/wlags49_h2/wl_enc.c b/drivers/staging/wlags49_h2/wl_enc.c new file mode 100644 index 000000000000..33181da413cb --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_enc.c @@ -0,0 +1,248 @@ + +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * This file defines functions related to WEP key coding/decoding. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/07/19 08:16:15 $ + * $Revision: 1.2 $ + * $Source: /usr/local/cvs/wl_lkm/wireless/wl_enc.c,v $ + * + ******************************************************************************/ + + + + +/******************************************************************************* + * include files + ******************************************************************************/ +#include + +#include +#include + +#include + + + + +/******************************************************************************* + * global definitions + ******************************************************************************/ +#if DBG + +extern dbg_info_t *DbgInfo; + +#endif /* DBG */ + + + + +/******************************************************************************* + * wl_wep_code() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function encodes a set of wep keys for privacy + * + * PARAMETERS: + * + * szCrypt - + * szDest - + * Data - + * nLen - + * + * RETURNS: + * + * OK + * + ******************************************************************************/ +int wl_wep_code( char *szCrypt, char *szDest, void *Data, int nLen ) +{ + int i; + int t; + int k ; + char bits; + char *szData = (char *) Data; + /*------------------------------------------------------------------------*/ + + + for( i = bits = 0 ; i < MACADDRESS_STR_LEN; i++ ) { + bits ^= szCrypt[i]; + bits += szCrypt[i]; + } + + for( i = t = *szDest = 0; i < nLen; i++, t++ ) { + k = szData[i] ^ ( bits + i ); + + + switch( i % 3 ) { + + case 0 : + + szDest[t] = ((k & 0xFC) >> 2) + CH_START ; + szDest[t+1] = ((k & 0x03) << 4) + CH_START ; + szDest[t+2] = '\0'; + + break; + + + case 1 : + + szDest[t] += (( k & 0xF0 ) >> 4 ); + szDest[t+1] = (( k & 0x0F ) << 2 ) + CH_START ; + szDest[t+2] = '\0'; + + break; + + + case 2 : + + szDest[t] += (( k & 0xC0 ) >> 6 ); + szDest[t+1] = ( k & 0x3F ) + CH_START ; + szDest[t+2] = '\0'; + t++; + + break; + } + } + + return( strlen( szDest )) ; + +} +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_wep_decode() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function decodes a set of WEP keys for use by the card. + * + * PARAMETERS: + * + * szCrypt - + * szDest - + * Data - + * + * RETURNS: + * + * OK + * + ******************************************************************************/ +int wl_wep_decode( char *szCrypt, void *Dest, char *szData ) +{ + int i; + int t; + int nLen; + char bits; + char *szDest = Dest; + /*------------------------------------------------------------------------*/ + + + for( i = bits = 0 ; i < 12; i++ ) { + bits ^= szCrypt[i] ; + bits += szCrypt[i] ; + } + + nLen = ( strlen( szData ) * 3) / 4 ; + + for( i = t = 0; i < nLen; i++, t++ ) { + switch( i % 3 ) { + case 0 : + + szDest[i] = ((( szData[t]-CH_START ) & 0x3f ) << 2 ) + + ((( szData[t+1]-CH_START ) & 0x30 ) >> 4 ); + break; + + + case 1 : + szDest[i] = ((( szData[t]-CH_START ) & 0x0f ) << 4 ) + + ((( szData[t+1]-CH_START ) & 0x3c ) >> 2 ); + break; + + + case 2 : + szDest[i] = ((( szData[t]-CH_START ) & 0x03 ) << 6 ) + + (( szData[t+1]-CH_START ) & 0x3f ); + t++; + break; + } + + szDest[i] ^= ( bits + i ) ; + + } + + return( i ) ; + +} +/*============================================================================*/ + diff --git a/drivers/staging/wlags49_h2/wl_enc.h b/drivers/staging/wlags49_h2/wl_enc.h new file mode 100644 index 000000000000..15467a33b3b5 --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_enc.h @@ -0,0 +1,135 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * Header for performing coding/decoding of the WEP keys. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/07/19 08:16:15 $ + * $Revision: 1.2 $ + * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_enc.h,v $ + * + ******************************************************************************/ + + + + +#ifndef __WAVELAN2_ENCRYPTION_H__ +#define __WAVELAN2_ENCRYPTION_H__ + + + + +/******************************************************************************* + * constant definitions + ******************************************************************************/ +#define CRYPT_CODE "57617665A5D6" +#define ENCRYPTION_LEN 102 +#define ENCRYPTION_MAGIC 0x48576877L // HWhw +#define DEF_CRYPT_STR "G?TIUEA]d5MAdZV'eUb&&6.)'&:,'VF/(FR2)6^5*'*8*W6;+GB>,7NA-'ZD-X&G.H2J/8>M0(JP0XVS1HbV29.Y3):\\3YF_4IRb56" + +#define DEFAULT_CRYPT_MAC "W\x01\x6B\x66\xA5\x5A" +#define CH_START '&' +#define MACADDRESS_STR_LEN 12 + +#define KEY_LEN 14 +#define NUM_KEYS 4 + +#define KEY_LENGTH_NONE_ASCII 0 +#define KEY_LENGTH_64_BIT_ASCII 5 +#define KEY_LENGTH_128_BIT_ASCII 13 + +#define KEY_LENGTH_NONE_HEX ( KEY_LENGTH_NONE_ASCII * sizeof( unsigned short )) +#define KEY_LENGTH_64_BIT_HEX ( KEY_LENGTH_64_BIT_ASCII * sizeof( unsigned short )) +#define KEY_LENGTH_128_BIT_HEX ( KEY_LENGTH_128_BIT_ASCII * sizeof( unsigned short )) + + + + +/******************************************************************************* + * type definitions + ******************************************************************************/ +typedef struct _encstct +{ + hcf_32 dwMagic; + hcf_16 wTxKeyID; + hcf_16 wEnabled; + CFG_DEFAULT_KEYS_STRCT EncStr; +} +ENCSTRCT, *PENCSTRCT; + + + + +/******************************************************************************* + * function prrottypes + ******************************************************************************/ +int wl_wep_code( char *szCrypt, char *szDest, void *Data, int nLen ); + +int wl_wep_decode( char *szCrypt, void *Dest, char *szData ); + + + + +#endif // __WAVELAN2_ENCRYPTION_H__ diff --git a/drivers/staging/wlags49_h2/wl_if.h b/drivers/staging/wlags49_h2/wl_if.h new file mode 100644 index 000000000000..8f0cb10a5be6 --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_if.h @@ -0,0 +1,232 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * Driver common header for info needed by driver source and user-space + * processes communicating with the driver. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/07/19 08:16:15 $ + * $Revision: 1.2 $ + * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_if.h,v $ + * + ******************************************************************************/ + + + + +#ifndef __WAVELAN2_IF_H__ +#define __WAVELAN2_IF_H__ + + + + +/******************************************************************************* + * constant definitions + ******************************************************************************/ +#define MAX_LTV_BUF_SIZE (512 - (sizeof(hcf_16) * 2)) + +#define HCF_TALLIES_SIZE (sizeof(CFG_HERMES_TALLIES_STRCT) + \ + (sizeof(hcf_16) * 2)) + +#define HCF_MAX_MULTICAST 16 +#define HCF_MAX_NAME_LEN 32 +#define MAX_LINE_SIZE 256 +#define HCF_NUM_IO_PORTS 0x80 +#define TX_TIMEOUT ((800 * HZ) / 1000) + + +#define HCF_MIN_COMM_QUALITY 0 +#define HCF_MAX_COMM_QUALITY 92 +#define HCF_MIN_SIGNAL_LEVEL 47 +#define HCF_MAX_SIGNAL_LEVEL 138 +#define HCF_MIN_NOISE_LEVEL 47 +#define HCF_MAX_NOISE_LEVEL 138 +#define HCF_0DBM_OFFSET 149 + +/* For encryption (WEP) */ +#define MIN_KEY_SIZE 5 // 40 bits RC4 - WEP +#define MAX_KEY_SIZE 13 // 104 bits +#define MAX_KEYS 4 + +#define RADIO_CHANNELS 14 +#define RADIO_SENSITIVITY_LEVELS 3 +#define RADIO_TX_POWER_MWATT 32 +#define RADIO_TX_POWER_DBM 15 + +#define MIN_RTS_BYTES 0 +#define MAX_RTS_BYTES 2347 + +#define MAX_RATES 8 +#define MEGABIT 1024*1024 + +#define HCF_FAILURE 0xFF +#define UIL_FAILURE 0xFF +#define CFG_UIL_CONNECT 0xA123 // Define differently? +#define CFG_UIL_CONNECT_ACK_CODE 0x5653435A // VSCZ +#define WVLAN2_UIL_CONNECTED (0x01L << 0) +#define WVLAN2_UIL_BUSY (0x01L << 1) + + + + +/******************************************************************************* + * driver ioctl interface + ******************************************************************************/ +#define WVLAN2_IOCTL_UIL SIOCDEVPRIVATE + +/* The UIL Interface used in conjunction with the WVLAN2_IOCTL_UIL code above + is defined in mdd.h. A quick reference of the UIL codes is listed below */ +/* +UIL_FUN_CONNECT +UIL_FUN_DISCONNECT +UIL_FUN_ACTION + UIL_ACT_BLOCK + UIL_ACT_UNBLOCK + UIL_ACT_SCA + UIL_ACT_DIAG + UIL_ACT_APPLY +UIL_FUN_SEND_DIAG_MSG +UIL_FUN_GET_INFO +UIL_FUN_PUT_INFO +*/ + +#define SIOCSIWNETNAME SIOCDEVPRIVATE+1 +#define SIOCGIWNETNAME SIOCDEVPRIVATE+2 +#define SIOCSIWSTANAME SIOCDEVPRIVATE+3 +#define SIOCGIWSTANAME SIOCDEVPRIVATE+4 +#define SIOCSIWPORTTYPE SIOCDEVPRIVATE+5 +#define SIOCGIWPORTTYPE SIOCDEVPRIVATE+6 + +/* IOCTL code for the RTS interface */ +#define WL_IOCTL_RTS SIOCDEVPRIVATE+7 + +/* IOCTL subcodes for WL_IOCTL_RTS */ +#define WL_IOCTL_RTS_READ 1 +#define WL_IOCTL_RTS_WRITE 2 +#define WL_IOCTL_RTS_BATCH_READ 3 +#define WL_IOCTL_RTS_BATCH_WRITE 4 + + +/******************************************************************************* + * STRUCTURE DEFINITIONS + ******************************************************************************/ +typedef struct +{ + __u16 length; + __u8 name[HCF_MAX_NAME_LEN]; +} +wvName_t; + + +typedef struct +{ + hcf_16 len; + hcf_16 typ; + union + { + hcf_8 u8[MAX_LTV_BUF_SIZE / sizeof(hcf_8)]; + hcf_16 u16[MAX_LTV_BUF_SIZE / sizeof(hcf_16)]; + hcf_32 u32[MAX_LTV_BUF_SIZE / sizeof(hcf_32)]; + } u; +} +ltv_t; + + +struct uilreq +{ + union + { + char ifrn_name[IFNAMSIZ]; + } ifr_ifrn; + + IFBP hcfCtx; + __u8 command; + __u8 result; + + /* The data field in this structure is typically an LTV of some type. The + len field is the size of the buffer in bytes, as opposed to words (like + the L-field in the LTV */ + __u16 len; + void *data; +}; + + +struct rtsreq +{ + union + { + char ifrn_name[IFNAMSIZ]; + } + ifr_ifrn; + + __u16 typ; + __u16 reg; + __u16 len; + __u16 *data; +}; + + +#endif // __WAVELAN2_IF_H__ + diff --git a/drivers/staging/wlags49_h2/wl_internal.h b/drivers/staging/wlags49_h2/wl_internal.h new file mode 100644 index 000000000000..1d9bdfa2fbfb --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_internal.h @@ -0,0 +1,1073 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * Header for defintions and macros internal to the drvier. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/08/03 11:39:39 $ + * $Revision: 1.8 $ + * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_internal.h,v $ + * + ******************************************************************************/ + + + + +#ifndef __WAVELAN2_H__ +#define __WAVELAN2_H__ + + + + +/******************************************************************************* + * include files + ******************************************************************************/ +#include +#ifdef BUS_PCMCIA +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) +#include +#endif +#include +#include +#include +#include +#include +#include +#endif // BUS_PCMCIA + +#ifdef HAS_WIRELESS_EXTENSIONS +#include +#if WIRELESS_EXT > 13 +#include +#endif // WIRELESS_EXT > 13 +#define USE_DBM +#define RETURN_CURRENT_NETWORKNAME +#define USE_FREQUENCY +#endif // HAS_WIRELESS_EXTENSIONS/ + +#include + +#include + + + + +/******************************************************************************* + * constant definitions + ******************************************************************************/ +#define p_u8 __u8 +#define p_s8 __s8 +#define p_u16 __u16 +#define p_s16 __s16 +#define p_u32 __u32 +#define p_s32 __s32 +#define p_char char + +#define MAX_KEY_LEN (2 + (13 * 2)) // 0x plus 13 hex digit pairs +#define MB_SIZE 1024 +#define MAX_ENC_LEN 104 + +#define MAX_SCAN_TIME_SEC 8 +#define MAX_NAPS 32 + +#define CFG_MB_INFO 0x0820 //Mail Box Info Block + +#define NUM_WDS_PORTS 6 + +#define WVLAN_MAX_LOOKAHEAD (HCF_MAX_MSG+46) /* as per s0005MIC_4.doc */ + + +/* Min/Max/Default Parameter Values */ +#if 0 //;? (HCF_TYPE) & HCF_TYPE_AP +//;? why this difference depending on compile option, seems to me it should depend on runtime if anything +#define PARM_DEFAULT_SSID "LinuxAP" +#else +#define PARM_DEFAULT_SSID "ANY" +#endif // HCF_TYPE_AP + +#define PARM_MIN_NAME_LEN 1 +#define PARM_MAX_NAME_LEN 32 + + +/* The following definitions pertain to module and profile parameters */ +// #define PARM_AP_MODE APMode +// #define PARM_NAME_AP_MODE TEXT("APMode") +// #define PARM_DEFAULT_AP_MODE FALSE + +#define PARM_AUTHENTICATION Authentication +#define PARM_NAME_AUTHENTICATION TEXT("Authentication") +#define PARM_MIN_AUTHENTICATION 1 +#define PARM_MAX_AUTHENTICATION 2 +#define PARM_DEFAULT_AUTHENTICATION 1 + +#define PARM_AUTH_KEY_MGMT_SUITE AuthKeyMgmtSuite +#define PARM_NAME_AUTH_KEY_MGMT_SUITE TEXT("AuthKeyMgmtSuite") +#define PARM_MIN_AUTH_KEY_MGMT_SUITE 0 +#define PARM_MAX_AUTH_KEY_MGMT_SUITE 4 +#define PARM_DEFAULT_AUTH_KEY_MGMT_SUITE 0 + +#define PARM_BRSC_2GHZ BRSC2GHz +#define PARM_NAME_BRSC_2GHZ TEXT("BRSC2GHz") +#define PARM_MIN_BRSC 0x0000 +#define PARM_MAX_BRSC 0x0FFF +#define PARM_DEFAULT_BRSC_2GHZ 0x000F + +#define PARM_BRSC_5GHZ BRSC5GHz +#define PARM_NAME_BRSC_5GHZ TEXT("BRSC5GHz") +#define PARM_DEFAULT_BRSC_5GHZ 0x0150 + +#define PARM_COEXISTENCE Coexistence +#define PARM_NAME_COEXISTENCE TEXT("Coexistence") +#define PARM_MIN_COEXISTENCE 0x0000 +#define PARM_MAX_COEXISTENCE 0x0007 +#define PARM_DEFAULT_COEXISTENCE 0x0000 + +#define PARM_CONFIGURED Configured +#define PARM_NAME_CONFIGURED TEXT("Configured") + +#define PARM_CONNECTION_CONTROL ConnectionControl +#define PARM_NAME_CONNECTION_CONTROL TEXT("ConnectionControl") +#define PARM_MIN_CONNECTION_CONTROL 0 +#define PARM_MAX_CONNECTION_CONTROL 3 +#define PARM_DEFAULT_CONNECTION_CONTROL 2 + +#define PARM_CREATE_IBSS CreateIBSS +#define PARM_NAME_CREATE_IBSS TEXT("CreateIBSS") +#define PARM_DEFAULT_CREATE_IBSS FALSE +#define PARM_DEFAULT_CREATE_IBSS_STR "N" + +#define PARM_DEBUG_FLAG DebugFlag +#define PARM_NAME_DEBUG_FLAG TEXT("DebugFlag") +#define PARM_MIN_DEBUG_FLAG 0 +#define PARM_MAX_DEBUG_FLAG 0xFFFF +#define PARM_DEFAULT_DEBUG_FLAG 0xFFFF + +#define PARM_DESIRED_SSID DesiredSSID +#define PARM_NAME_DESIRED_SSID TEXT("DesiredSSID") + +#define PARM_DOWNLOAD_FIRMWARE DownloadFirmware +#define PARM_NAME_DOWNLOAD_FIRMWARE TEXT("DownloadFirmware") + +#define PARM_DRIVER_ENABLE DriverEnable +#define PARM_NAME_DRIVER_ENABLE TEXT("DriverEnable") +#define PARM_DEFAULT_DRIVER_ENABLE TRUE + +#define PARM_ENABLE_ENCRYPTION EnableEncryption +#define PARM_NAME_ENABLE_ENCRYPTION TEXT("EnableEncryption") +#define PARM_MIN_ENABLE_ENCRYPTION 0 +#define PARM_MAX_ENABLE_ENCRYPTION 7 +#define PARM_DEFAULT_ENABLE_ENCRYPTION 0 + +#define PARM_ENCRYPTION Encryption +#define PARM_NAME_ENCRYPTION TEXT("Encryption") + +#define PARM_EXCLUDE_UNENCRYPTED ExcludeUnencrypted +#define PARM_NAME_EXCLUDE_UNENCRYPTED TEXT("ExcludeUnencrypted") +#define PARM_DEFAULT_EXCLUDE_UNENCRYPTED TRUE +#define PARM_DEFAULT_EXCLUDE_UNENCRYPTED_STR "N" + +#define PARM_INTRA_BSS_RELAY IntraBSSRelay +#define PARM_NAME_INTRA_BSS_RELAY TEXT("IntraBSSRelay") +#define PARM_DEFAULT_INTRA_BSS_RELAY TRUE +#define PARM_DEFAULT_INTRA_BSS_RELAY_STR "Y" + +#define PARM_KEY1 Key1 +#define PARM_NAME_KEY1 TEXT("Key1") +#define PARM_KEY2 Key2 +#define PARM_NAME_KEY2 TEXT("Key2") +#define PARM_KEY3 Key3 +#define PARM_NAME_KEY3 TEXT("Key3") +#define PARM_KEY4 Key4 +#define PARM_NAME_KEY4 TEXT("Key4") + +//;? #define PARM_KEY_FORMAT AsciiHex +//;? #define PARM_NAME_KEY_FORMAT TEXT("AsciiHex") + +#define PARM_LOAD_BALANCING LoadBalancing +#define PARM_NAME_LOAD_BALANCING TEXT("LoadBalancing") +#define PARM_DEFAULT_LOAD_BALANCING TRUE +#define PARM_DEFAULT_LOAD_BALANCING_STR "Y" + +#define PARM_MAX_DATA_LENGTH MaxDataLength +#define PARM_NAME_MAX_DATA_LENGTH TEXT("MaxDataLength") + +#define PARM_MAX_SLEEP MaxSleepDuration +#define PARM_NAME_MAX_SLEEP TEXT("MaxSleepDuration") +#define PARM_MIN_MAX_PM_SLEEP 1 //;?names nearly right? +#define PARM_MAX_MAX_PM_SLEEP 65535 +#define PARM_DEFAULT_MAX_PM_SLEEP 100 + +#define PARM_MEDIUM_DISTRIBUTION MediumDistribution +#define PARM_NAME_MEDIUM_DISTRIBUTION TEXT("MediumDistribution") +#define PARM_DEFAULT_MEDIUM_DISTRIBUTION TRUE +#define PARM_DEFAULT_MEDIUM_DISTRIBUTION_STR "Y" + +#define PARM_MICROWAVE_ROBUSTNESS MicroWaveRobustness +#define PARM_NAME_MICROWAVE_ROBUSTNESS TEXT("MicroWaveRobustness") +#define PARM_DEFAULT_MICROWAVE_ROBUSTNESS FALSE +#define PARM_DEFAULT_MICROWAVE_ROBUSTNESS_STR "N" + +#define PARM_MULTICAST_PM_BUFFERING MulticastPMBuffering +#define PARM_NAME_MULTICAST_PM_BUFFERING TEXT("MulticastPMBuffering") +#define PARM_DEFAULT_MULTICAST_PM_BUFFERING TRUE +#define PARM_DEFAULT_MULTICAST_PM_BUFFERING_STR "Y" + +#define PARM_MULTICAST_RATE MulticastRate +#define PARM_NAME_MULTICAST_RATE TEXT("MulticastRate") +#ifdef WARP +#define PARM_MIN_MULTICAST_RATE 0x0001 +#define PARM_MAX_MULTICAST_RATE 0x0fff +#define PARM_DEFAULT_MULTICAST_RATE_2GHZ 0x0004 +#define PARM_DEFAULT_MULTICAST_RATE_5GHZ 0x0010 +#else +#define PARM_MIN_MULTICAST_RATE 0x0001 +#define PARM_MAX_MULTICAST_RATE 0x0004 +#define PARM_DEFAULT_MULTICAST_RATE_2GHZ 0x0002 +#define PARM_DEFAULT_MULTICAST_RATE_5GHZ 0x0000 +#endif // WARP + +#define PARM_MULTICAST_RX MulticastReceive +#define PARM_NAME_MULTICAST_RX TEXT("MulticastReceive") +#define PARM_DEFAULT_MULTICAST_RX TRUE +#define PARM_DEFAULT_MULTICAST_RX_STR "Y" + +#define PARM_NETWORK_ADDR NetworkAddress +#define PARM_NAME_NETWORK_ADDR TEXT("NetworkAddress") +#define PARM_DEFAULT_NETWORK_ADDR { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } + +#define PARM_NETWORK_TYPE NetworkType +#define PARM_NAME_NETWORK_TYPE TEXT("NetworkType") +#define PARM_DEFAULT_NETWORK_TYPE 0 + +#define PARM_OWN_ATIM_WINDOW OwnATIMWindow +#define PARM_NAME_OWN_ATIM_WINDOW TEXT("OwnATIMWindow") +#define PARM_MIN_OWN_ATIM_WINDOW 0 +#define PARM_MAX_OWN_ATIM_WINDOW 100 +#define PARM_DEFAULT_OWN_ATIM_WINDOW 0 + +#define PARM_OWN_BEACON_INTERVAL OwnBeaconInterval +#define PARM_NAME_OWN_BEACON_INTERVAL TEXT("OwnBeaconInterval") +#define PARM_MIN_OWN_BEACON_INTERVAL 20 +#define PARM_MAX_OWN_BEACON_INTERVAL 200 +#define PARM_DEFAULT_OWN_BEACON_INTERVAL 100 + +#define PARM_OWN_CHANNEL OwnChannel +#define PARM_NAME_OWN_CHANNEL TEXT("OwnChannel") +#define PARM_MIN_OWN_CHANNEL 1 +#define PARM_MAX_OWN_CHANNEL 161 +#define PARM_DEFAULT_OWN_CHANNEL 10 + +#define PARM_OWN_DTIM_PERIOD OwnDTIMPeriod +#define PARM_NAME_OWN_DTIM_PERIOD TEXT("OwnDTIMPeriod") +#define PARM_MIN_OWN_DTIM_PERIOD 1 +#define PARM_MAX_OWN_DTIM_PERIOD 65535 +#define PARM_DEFAULT_OWN_DTIM_PERIOD 1 + +#define PARM_OWN_NAME OwnName +#define PARM_NAME_OWN_NAME TEXT("OwnName") +#define PARM_DEFAULT_OWN_NAME "Linux" + +#define PARM_OWN_SSID OwnSSID +#define PARM_NAME_OWN_SSID TEXT("OwnSSID") + +#define PARM_PM_ENABLED PMEnabled +#define PARM_NAME_PM_ENABLED TEXT("PMEnabled") +#define PARM_MAX_PM_ENABLED 3 + +#define PARM_PMEPS PMEPS +#define PARM_NAME_PMEPS TEXT("PMEPS") + +#define PARM_PM_HOLDOVER_DURATION PMHoldoverDuration +#define PARM_NAME_PM_HOLDOVER_DURATION TEXT("PMHoldoverDuration") +#define PARM_MIN_PM_HOLDOVER_DURATION 1 +#define PARM_MAX_PM_HOLDOVER_DURATION 1000 +#define PARM_DEFAULT_PM_HOLDOVER_DURATION 100 + +#define PARM_PM_MODE PowerMode +#define PARM_NAME_PM_MODE TEXT("PowerMode") + +#define PARM_PORT_TYPE PortType +#define PARM_NAME_PORT_TYPE TEXT("PortType") +#define PARM_MIN_PORT_TYPE 1 +#define PARM_MAX_PORT_TYPE 3 +#define PARM_DEFAULT_PORT_TYPE 1 + +#define PARM_PROMISCUOUS_MODE PromiscuousMode +#define PARM_NAME_PROMISCUOUS_MODE TEXT("PromiscuousMode") +#define PARM_DEFAULT_PROMISCUOUS_MODE FALSE +#define PARM_DEFAULT_PROMISCUOUS_MODE_STR "N" + +#define PARM_REJECT_ANY RejectANY +#define PARM_NAME_REJECT_ANY TEXT("RejectANY") +#define PARM_DEFAULT_REJECT_ANY FALSE +#define PARM_DEFAULT_REJECT_ANY_STR "N" + +#define PARM_RTS_THRESHOLD RTSThreshold +#define PARM_NAME_RTS_THRESHOLD TEXT("RTSThreshold") +#define PARM_MIN_RTS_THRESHOLD 0 +#define PARM_MAX_RTS_THRESHOLD 2347 +#define PARM_DEFAULT_RTS_THRESHOLD 2347 + +#define PARM_RTS_THRESHOLD1 RTSThreshold1 +#define PARM_NAME_RTS_THRESHOLD1 TEXT("RTSThreshold1") +#define PARM_RTS_THRESHOLD2 RTSThreshold2 +#define PARM_NAME_RTS_THRESHOLD2 TEXT("RTSThreshold2") +#define PARM_RTS_THRESHOLD3 RTSThreshold3 +#define PARM_NAME_RTS_THRESHOLD3 TEXT("RTSThreshold3") +#define PARM_RTS_THRESHOLD4 RTSThreshold4 +#define PARM_NAME_RTS_THRESHOLD4 TEXT("RTSThreshold4") +#define PARM_RTS_THRESHOLD5 RTSThreshold5 +#define PARM_NAME_RTS_THRESHOLD5 TEXT("RTSThreshold5") +#define PARM_RTS_THRESHOLD6 RTSThreshold6 +#define PARM_NAME_RTS_THRESHOLD6 TEXT("RTSThreshold6") + +#define PARM_SRSC_2GHZ SRSC2GHz +#define PARM_NAME_SRSC_2GHZ TEXT("SRSC2GHz") +#define PARM_MIN_SRSC 0x0000 +#define PARM_MAX_SRSC 0x0FFF +#define PARM_DEFAULT_SRSC_2GHZ 0x0FFF + +#define PARM_SRSC_5GHZ SRSC5GHz +#define PARM_NAME_SRSC_5GHZ TEXT("SRSC5GHz") +#define PARM_DEFAULT_SRSC_5GHZ 0x0FF0 + +#define PARM_SYSTEM_SCALE SystemScale +#define PARM_NAME_SYSTEM_SCALE TEXT("SystemScale") +#define PARM_MIN_SYSTEM_SCALE 1 +#define PARM_MAX_SYSTEM_SCALE 5 +#define PARM_DEFAULT_SYSTEM_SCALE 1 + +#define PARM_TX_KEY TxKey +#define PARM_NAME_TX_KEY TEXT("TxKey") +#define PARM_MIN_TX_KEY 1 +#define PARM_MAX_TX_KEY 4 +#define PARM_DEFAULT_TX_KEY 1 + +#define PARM_TX_POW_LEVEL TxPowLevel +#define PARM_NAME_TX_POW_LEVEL TEXT("TxPowLevel") +#define PARM_MIN_TX_POW_LEVEL 1 // 20 dBm +#define PARM_MAX_TX_POW_LEVEL 6 // 8 dBm +#define PARM_DEFAULT_TX_POW_LEVEL 3 // 15 dBm + +#define PARM_TX_RATE TxRateControl +#define PARM_NAME_TX_RATE TEXT("TxRateControl") +#define PARM_MIN_TX_RATE 0x0001 +#ifdef WARP +#define PARM_MAX_TX_RATE 0x0FFF +#define PARM_DEFAULT_TX_RATE_2GHZ 0x0FFF +#define PARM_DEFAULT_TX_RATE_5GHZ 0x0FF0 +#else +#define PARM_MAX_TX_RATE 0x0007 +#define PARM_DEFAULT_TX_RATE_2GHZ 0x0003 +#define PARM_DEFAULT_TX_RATE_5GHZ 0x0000 +#endif // WARP + +#define PARM_TX_RATE1 TxRateControl1 +#define PARM_NAME_TX_RATE1 TEXT("TxRateControl1") +#define PARM_TX_RATE2 TxRateControl2 +#define PARM_NAME_TX_RATE2 TEXT("TxRateControl2") +#define PARM_TX_RATE3 TxRateControl3 +#define PARM_NAME_TX_RATE3 TEXT("TxRateControl3") +#define PARM_TX_RATE4 TxRateControl4 +#define PARM_NAME_TX_RATE4 TEXT("TxRateControl4") +#define PARM_TX_RATE5 TxRateControl5 +#define PARM_NAME_TX_RATE5 TEXT("TxRateControl5") +#define PARM_TX_RATE6 TxRateControl6 +#define PARM_NAME_TX_RATE6 TEXT("TxRateControl6") + +#define PARM_VENDORDESCRIPTION VendorDescription +#define PARM_NAME_VENDORDESCRIPTION TEXT("VendorDescription") + +#define PARM_WDS_ADDRESS WDSAddress +#define PARM_NAME_WDS_ADDRESS TEXT("WDSAddress") + +#define PARM_WDS_ADDRESS1 WDSAddress1 +#define PARM_NAME_WDS_ADDRESS1 TEXT("WDSAddress1") +#define PARM_WDS_ADDRESS2 WDSAddress2 +#define PARM_NAME_WDS_ADDRESS2 TEXT("WDSAddress2") +#define PARM_WDS_ADDRESS3 WDSAddress3 +#define PARM_NAME_WDS_ADDRESS3 TEXT("WDSAddress3") +#define PARM_WDS_ADDRESS4 WDSAddress4 +#define PARM_NAME_WDS_ADDRESS4 TEXT("WDSAddress4") +#define PARM_WDS_ADDRESS5 WDSAddress5 +#define PARM_NAME_WDS_ADDRESS5 TEXT("WDSAddress5") +#define PARM_WDS_ADDRESS6 WDSAddress6 +#define PARM_NAME_WDS_ADDRESS6 TEXT("WDSAddress6") + +/* +#define PARM_LONG_RETRY_LIMIT LongRetryLimit +#define PARM_NAME_LONG_RETRY_LIMIT TEXT("LongRetryLimit") +#define PARM_MIN_LONG_RETRY_LIMIT 1 +#define PARM_MAX_LONG_RETRY_LIMIT 15 +#define PARM_DEFAULT_LONG_RETRY_LIMIT 3 + + +#define PARM_PROBE_DATA_RATES ProbeDataRates +#define PARM_NAME_PROBE_DATA_RATES TEXT("ProbeDataRates") +#define PARM_MIN_PROBE_DATA_RATES 0x0000 +#define PARM_MAX_PROBE_DATA_RATES 0x0FFF +#define PARM_DEFAULT_PROBE_DATA_RATES_2GHZ 0x0002 +#define PARM_DEFAULT_PROBE_DATA_RATES_5GHZ 0x0010 + +#define PARM_SHORT_RETRY_LIMIT ShortRetryLimit +#define PARM_NAME_SHORT_RETRY_LIMIT TEXT("ShortRetryLimit") +#define PARM_MIN_SHORT_RETRY_LIMIT 1 +#define PARM_MAX_SHORT_RETRY_LIMIT 15 +#define PARM_DEFAULT_SHORT_RETRY_LIMIT 7 + + +*/ + +/******************************************************************************* + * state definitions + ******************************************************************************/ +/* The following constants are used to track state the device */ +#define WL_FRIMWARE_PRESENT 1 // Download if needed +#define WL_FRIMWARE_NOT_PRESENT 0 // Skip over download, assume its already there +#define WL_HANDLING_INT 1 // Actually call the HCF to switch interrupts on/off +#define WL_NOT_HANDLING_INT 0 // Not yet handling interrupts, do not switch on/off + +/******************************************************************************* + * macro definitions + ******************************************************************************/ +/* The following macro ensures that no symbols are exported, minimizing the + chance of a symbol collision in the kernel */ +// EXPORT_NO_SYMBOLS; + +#define NELEM(arr) (sizeof(arr) / sizeof(arr[0])) + +#define WVLAN_VALID_MAC_ADDRESS( x ) \ +((x[0]!=0xFF) && (x[1]!=0xFF) && (x[2]!=0xFF) && (x[3]!=0xFF) && (x[4]!=0xFF) && (x[5]!=0xFF)) + + + + +/******************************************************************************* + * type definitions + ******************************************************************************/ +#undef FALSE +#undef TRUE + +typedef enum +{ + FALSE = 0, + TRUE = 1 +} +bool_t; + + +typedef struct _ScanResult +{ + //hcf_16 len; + //hcf_16 typ; + int scan_complete; + int num_aps; + SCAN_RS_STRCT APTable [MAX_NAPS]; +} +ScanResult; + + +typedef struct _LINK_STATUS_STRCT +{ + hcf_16 len; + hcf_16 typ; + hcf_16 linkStatus; /* 1..5 */ +} +LINK_STATUS_STRCT; + + +typedef struct _ASSOC_STATUS_STRCT +{ + hcf_16 len; + hcf_16 typ; + hcf_16 assocStatus; /* 1..3 */ + hcf_8 staAddr[ETH_ALEN]; + hcf_8 oldApAddr[ETH_ALEN]; +} +ASSOC_STATUS_STRCT; + + +typedef struct _SECURITY_STATUS_STRCT +{ + hcf_16 len; + hcf_16 typ; + hcf_16 securityStatus; /* 1..3 */ + hcf_8 staAddr[ETH_ALEN]; + hcf_16 reason; +} +SECURITY_STATUS_STRCT; + +#define WVLAN_WMP_PDU_TYPE_LT_REQ 0x00 +#define WVLAN_WMP_PDU_TYPE_LT_RSP 0x01 +#define WVLAN_WMP_PDU_TYPE_APL_REQ 0x02 +#define WVLAN_WMP_PDU_TYPE_APL_RSP 0x03 + +typedef struct wvlan_eth_hdr +{ + unsigned char dst[ETH_ALEN]; /* Destination address. */ + unsigned char src[ETH_ALEN]; /* Source address. */ + unsigned short len; /* Length of the PDU. */ +} +WVLAN_ETH_HDR, *PWVLAN_ETH_HDR; + +typedef struct wvlan_llc_snap +{ + unsigned char dsap; /* DSAP (0xAA) */ + unsigned char ssap; /* SSAP (0xAA) */ + unsigned char ctrl; /* Control (0x03) */ + unsigned char oui[3]; /* Organization Unique ID (00-60-1d). */ + unsigned char specid[2]; /* Specific ID code (00-01). */ +} +WVLAN_LLC_SNAP, *PWVLAN_LLC_SNAP; + + +typedef struct wvlan_lt_hdr +{ + unsigned char version; /* Version (0x00) */ + unsigned char type; /* PDU type: 0-req/1-resp. */ + unsigned short id; /* Identifier to associate resp to req. */ +} +WVLAN_LT_HDR, *PWVLAN_LT_HDR; + + +typedef struct wvlan_wmp_hdr +{ + unsigned char version; /* Version */ + unsigned char type; /* PDU type */ +} +WVLAN_WMP_HDR, *PWVLAN_WMP_HDR; + + +#define FILLER_SIZE 1554 +#define TEST_PATTERN_SIZE 54 + + +typedef struct wvlan_lt_req +{ + unsigned char Filler[TEST_PATTERN_SIZE]; /* minimal length of 54 bytes */ +} +WVLAN_LT_REQ, *PWVLAN_LT_REQ; + + +typedef struct wvlan_lt_rsp +{ + char name[32]; + /* Measured Data */ + unsigned char signal; + unsigned char noise; + unsigned char rxFlow; + unsigned char dataRate; + unsigned short protocol; + /* Capabilities */ + unsigned char station; + unsigned char dataRateCap; + unsigned char powerMgmt[4]; + unsigned char robustness[4]; + unsigned char scaling; + unsigned char reserved[5]; +} +WVLAN_LT_RSP, *PWVLAN_LT_RSP; + + +typedef struct wvlan_rx_wmp_hdr +{ + unsigned short status; + unsigned short reserved1[2]; + unsigned char silence; + unsigned char signal; + unsigned char rate; + unsigned char rxFlow; + unsigned short reserved2[2]; + unsigned short frameControl; + unsigned short duration; + unsigned short address1[3]; + unsigned short address2[3]; + unsigned short address3[3]; + unsigned short sequenceControl; + unsigned short address4[3]; +#ifndef HERMES25 //;?just to be on the safe side of inherited but not comprehended code #ifdef HERMES2 + unsigned short seems_to_be_unused_reserved3[5]; //;? + unsigned short seems_to_be_unused_reserved4; //;? +#endif // HERMES25 + unsigned short HeaderDataLen; +} +WVLAN_RX_WMP_HDR, *PWVLAN_RX_WMP_HDR; + + +typedef struct wvlan_linktest_req_pdu +{ + WVLAN_ETH_HDR ethHdr; + WVLAN_LLC_SNAP llcSnap; + WVLAN_LT_HDR ltHdr; + WVLAN_LT_REQ ltReq; +} +WVLAN_LINKTEST_REQ_PDU, *PWVLAN_LINKTEST_REQ_PDU; + + +typedef struct wvlan_linktest_rsp_pdu +{ + WVLAN_RX_WMP_HDR wmpRxHdr; + WVLAN_ETH_HDR ethHdr; + WVLAN_LLC_SNAP llcSnap; + WVLAN_LT_HDR ltHdr; + WVLAN_LT_RSP ltRsp; +} +WVLAN_LINKTEST_RSP_PDU, *PWVLAN_LINKTEST_RSP_PDU; + + +typedef struct _LINKTEST_RSP_STRCT +{ + hcf_16 len; + hcf_16 typ; + WVLAN_LINKTEST_RSP_PDU ltRsp; +} +LINKTEST_RSP_STRCT; + + +typedef struct wvlan_wmp_rsp_pdu +{ + WVLAN_RX_WMP_HDR wmpRxHdr; + WVLAN_ETH_HDR ethHdr; + WVLAN_LLC_SNAP llcSnap; + WVLAN_WMP_HDR wmpHdr; +} +WVLAN_WMP_RSP_PDU, *PWVLAN_WMP_RSP_PDU; + + +typedef struct _WMP_RSP_STRCT +{ + hcf_16 len; + hcf_16 typ; + WVLAN_WMP_RSP_PDU wmpRsp; +} +WMP_RSP_STRCT; + + +typedef struct _PROBE_RESP +{ + // first part: 802.11 + hcf_16 length; + hcf_16 infoType; + hcf_16 reserved0; + //hcf_8 signal; + hcf_8 silence; + hcf_8 signal; // Moved signal here as signal/noise values were flipped + hcf_8 rxFlow; + hcf_8 rate; + hcf_16 reserved1[2]; + + // second part: + hcf_16 frameControl; + hcf_16 durID; + hcf_8 address1[6]; + hcf_8 address2[6]; + hcf_8 BSSID[6]; //! this is correct, right ? + hcf_16 sequence; + hcf_8 address4[6]; + +#ifndef WARP + hcf_8 reserved2[12]; +#endif // WARP + + hcf_16 dataLength; + // the information in the next 3 fields (DA/SA/LenType) is actually not filled in. + hcf_8 DA[6]; + hcf_8 SA[6]; + +#ifdef WARP + hcf_8 channel; + hcf_8 band; +#else + hcf_16 lenType; +#endif // WARP + + hcf_8 timeStamp[8]; + hcf_16 beaconInterval; + hcf_16 capability; + hcf_8 rawData[200]; //! <<< think about this number ! + hcf_16 flags; +} +PROBE_RESP, *PPROBE_RESP; + + +typedef struct _ProbeResult +{ + int scan_complete; + int num_aps; + PROBE_RESP ProbeTable[MAX_NAPS]; +} +ProbeResult; + +/* Definitions used to parse capabilities out of the probe responses */ +#define CAPABILITY_ESS 0x0001 +#define CAPABILITY_IBSS 0x0002 +#define CAPABILITY_PRIVACY 0x0010 + +/* Definitions used to parse the Information Elements out of probe responses */ +#define DS_INFO_ELEM 0x03 +#define GENERIC_INFO_ELEM 0xdd +#define WPA_MAX_IE_LEN 40 +#define WPA_SELECTOR_LEN 4 +#define WPA_OUI_TYPE { 0x00, 0x50, 0xf2, 1 } +#define WPA_VERSION 1 +#define WPA_AUTH_KEY_MGMT_UNSPEC_802_1X { 0x00, 0x50, 0xf2, 1 } +#define WPA_AUTH_KEY_MGMT_PSK_OVER_802_1X { 0x00, 0x50, 0xf2, 2 } +#define WPA_CIPHER_SUITE_NONE { 0x00, 0x50, 0xf2, 0 } +#define WPA_CIPHER_SUITE_WEP40 { 0x00, 0x50, 0xf2, 1 } +#define WPA_CIPHER_SUITE_TKIP { 0x00, 0x50, 0xf2, 2 } +#define WPA_CIPHER_SUITE_WRAP { 0x00, 0x50, 0xf2, 3 } +#define WPA_CIPHER_SUITE_CCMP { 0x00, 0x50, 0xf2, 4 } +#define WPA_CIPHER_SUITE_WEP104 { 0x00, 0x50, 0xf2, 5 } + +typedef enum wvlan_drv_mode +{ + WVLAN_DRV_MODE_NO_DOWNLOAD, /* this is the same as STA for Hermes 1 */ + /* it is also only applicable for Hermes 1 */ + WVLAN_DRV_MODE_STA, + WVLAN_DRV_MODE_AP, + WVLAN_DRV_MODE_MAX +} +WVLAN_DRV_MODE, *PWVLAN_DRV_MODE; + + +typedef enum wvlan_port_state +{ + WVLAN_PORT_STATE_ENABLED, + WVLAN_PORT_STATE_DISABLED, + WVLAN_PORT_STATE_CONNECTED +} +WVLAN_PORT_STATE, *PWVLAN_PORT_STATE; + +/* +typedef enum wvlan_connect_state +{ + WVLAN_CONNECT_STATE_CONNECTED, + WVLAN_CONNECT_STATE_DISCONNECTED +} +WVLAN_CONNECT_STATE, *PWVLAN_CONNECT_STATE; +*/ + +typedef enum wvlan_pm_state +{ + WVLAN_PM_STATE_DISABLED, + WVLAN_PM_STATE_ENHANCED, + WVLAN_PM_STATE_STANDARD +} +WVLAN_PM_STATE, *PWVLAN_PM_STATE; + + +typedef struct wvlan_frame +{ + struct sk_buff *skb; /* sk_buff for frame. */ + hcf_16 port; /* MAC port for the frame. */ + hcf_16 len; /* Length of the frame. */ +} +WVLAN_FRAME, *PWVLAN_FRAME; + + +typedef struct wvlan_lframe +{ + struct list_head node; /* Node in the list */ + WVLAN_FRAME frame; /* Frame. */ +} +WVLAN_LFRAME, *PWVLAN_LFRAME; + + + +#define DEFAULT_NUM_TX_FRAMES 48 +#define TX_Q_LOW_WATER_MARK (DEFAULT_NUM_TX_FRAMES/3) + +#define WVLAN_MAX_TX_QUEUES 1 + + +#ifdef USE_WDS + +typedef struct wvlan_wds_if +{ + struct net_device *dev; + int is_registered; + int netif_queue_on; + struct net_device_stats stats; + hcf_16 rtsThreshold; + hcf_16 txRateCntl; + hcf_8 wdsAddress[ETH_ALEN]; +} WVLAN_WDS_IF, *PWVLAN_WDS_IF; + +#endif // USE_WDS + + + +#define NUM_RX_DESC 5 +#define NUM_TX_DESC 5 + +typedef struct dma_strct +{ + DESC_STRCT *tx_packet[NUM_TX_DESC]; + DESC_STRCT *rx_packet[NUM_RX_DESC]; + DESC_STRCT *rx_reclaim_desc, *tx_reclaim_desc; // Descriptors for host-reclaim purposes (see HCF) + int tx_rsc_ind; // DMA Tx resource indicator is maintained in the MSF, not in the HCF + int rx_rsc_ind; // Also added rx rsource indicator so that cleanup can be performed if alloc fails + int status; +} DMA_STRCT; + + +/* Macros used in DMA support */ +/* get bus address of {rx,tx}dma structure member, in little-endian byte order */ +#define WL_DMA_BUS_ADDR_LE(str, i, mem) \ + cpu_to_le32(str##_dma_addr[(i)] + ((hcf_8 *)&str[(i)]->mem - (hcf_8 *)str[(i)])) + + +struct wl_private +{ + +#ifdef BUS_PCMCIA + dev_node_t node; + struct pcmcia_device *link; +#endif // BUS_PCMCIA + + + struct net_device *dev; +// struct net_device *dev_next; + spinlock_t slock; + struct tasklet_struct task; + struct net_device_stats stats; + + +#ifdef WIRELESS_EXT + struct iw_statistics wstats; +// int spy_number; +// u_char spy_address[IW_MAX_SPY][ETH_ALEN]; +// struct iw_quality spy_stat[IW_MAX_SPY]; + struct iw_spy_data spy_data; + struct iw_public_data wireless_data; +#endif // WIRELESS_EXT + + + IFB_STRCT hcfCtx; +//;? struct timer_list timer_oor; +//;? hcf_16 timer_oor_cnt; + u_long wlags49_type; //controls output in /proc/wlags49 + u_long flags; + hcf_16 DebugFlag; + int is_registered; + int is_handling_int; + int firmware_present; + char sysfsCreated; + CFG_DRV_INFO_STRCT driverInfo; + CFG_IDENTITY_STRCT driverIdentity; + CFG_FW_IDENTITY_STRCT StationIdentity; + CFG_PRI_IDENTITY_STRCT PrimaryIdentity; + CFG_PRI_IDENTITY_STRCT NICIdentity; + + ltv_t ltvRecord; + u_long txBytes; + hcf_16 maxPort; /* 0 for STA, 6 for AP */ + + /* Elements used for async notification from hardware */ + RID_LOG_STRCT RidList[10]; + ltv_t updatedRecord; + PROBE_RESP ProbeResp; + ASSOC_STATUS_STRCT assoc_stat; + SECURITY_STATUS_STRCT sec_stat; + + u_char lookAheadBuf[WVLAN_MAX_LOOKAHEAD]; + + hcf_8 PortType; // 1 - 3 (1 [Normal] | 3 [AdHoc]) + hcf_16 Channel; // 0 - 14 (0) + hcf_16 TxRateControl[2]; + hcf_8 DistanceBetweenAPs; // 1 - 3 (1) + hcf_16 RTSThreshold; // 0 - 2347 (2347) + hcf_16 PMEnabled; // 0 - 2, 8001 - 8002 (0) + hcf_8 MicrowaveRobustness;// 0 - 1 (0) + hcf_8 CreateIBSS; // 0 - 1 (0) + hcf_8 MulticastReceive; // 0 - 1 (1) + hcf_16 MaxSleepDuration; // 0 - 65535 (100) + hcf_8 MACAddress[ETH_ALEN]; + char NetworkName[HCF_MAX_NAME_LEN+1]; + char StationName[HCF_MAX_NAME_LEN+1]; + hcf_8 EnableEncryption; // 0 - 1 (0) + char Key1[MAX_KEY_LEN+1]; + char Key2[MAX_KEY_LEN+1]; + char Key3[MAX_KEY_LEN+1]; + char Key4[MAX_KEY_LEN+1]; + hcf_8 TransmitKeyID; // 1 - 4 (1) + CFG_DEFAULT_KEYS_STRCT DefaultKeys; + u_char mailbox[MB_SIZE]; + char szEncryption[MAX_ENC_LEN]; + + hcf_16 driverEnable; + hcf_16 wolasEnable; + hcf_16 atimWindow; + hcf_16 holdoverDuration; + hcf_16 MulticastRate[2]; + + hcf_16 authentication; // is this AP specific? + hcf_16 promiscuousMode; + WVLAN_DRV_MODE DownloadFirmware; // 0 - 2 (0 [None] | 1 [STA] | 2 [AP]) + + char fw_image_filename[MAX_LINE_SIZE+1]; + + hcf_16 AuthKeyMgmtSuite; + + hcf_16 loadBalancing; + hcf_16 mediumDistribution; + hcf_16 txPowLevel; + //hcf_16 shortRetryLimit; + //hcf_16 longRetryLimit; + hcf_16 srsc[2]; + hcf_16 brsc[2]; + hcf_16 connectionControl; + //hcf_16 probeDataRates[2]; + hcf_16 ownBeaconInterval; + hcf_16 coexistence; + + WVLAN_FRAME txF; + WVLAN_LFRAME txList[DEFAULT_NUM_TX_FRAMES]; + struct list_head txFree; + struct list_head txQ[WVLAN_MAX_TX_QUEUES]; + int netif_queue_on; + int txQ_count; + DESC_STRCT desc_rx; + DESC_STRCT desc_tx; + + WVLAN_PORT_STATE portState; + + ScanResult scan_results; + ProbeResult probe_results; + int probe_num_aps; + + int use_dma; + DMA_STRCT dma; +#ifdef USE_RTS + int useRTS; +#endif // USE_RTS + hcf_8 DTIMPeriod; // 1 - 255 (1) + hcf_16 multicastPMBuffering; + hcf_8 RejectAny; // 0 - 1 (0) + hcf_8 ExcludeUnencrypted; // 0 - 1 (1) + hcf_16 intraBSSRelay; +#ifdef USE_WDS + WVLAN_WDS_IF wds_port[NUM_WDS_PORTS]; +#endif // USE_WDS +}; // wl_private + +#ifdef HAVE_NETDEV_PRIV +#define wl_priv(dev) ((struct wl_private *) netdev_priv(dev)) +#else +extern inline struct wl_private *wl_priv(struct net_device *dev) +{ + return dev->priv; +} +#endif + +/********************************************************************/ +/* Locking and synchronization functions */ +/********************************************************************/ + +/* These functions *must* be inline or they will break horribly on + * SPARC, due to its weird semantics for save/restore flags. extern + * inline should prevent the kernel from linking or module from + * loading if they are not inlined. */ +extern inline void wl_lock(struct wl_private *lp, + unsigned long *flags) +{ + spin_lock_irqsave(&lp->slock, *flags); +} + +extern inline void wl_unlock(struct wl_private *lp, + unsigned long *flags) +{ + spin_unlock_irqrestore(&lp->slock, *flags); +} + +/********************************************************************/ +/* Interrupt enable disable functions */ +/********************************************************************/ + +extern inline void wl_act_int_on(struct wl_private *lp) +{ + /* + * Only do something when the driver is handling + * interrupts. Handling starts at wl_open and + * ends at wl_close when not in RTS mode + */ + if(lp->is_handling_int == WL_HANDLING_INT) { + hcf_action( &lp->hcfCtx, HCF_ACT_INT_ON ); + } +} + +extern inline void wl_act_int_off(struct wl_private *lp) +{ + /* + * Only do something when the driver is handling + * interrupts. Handling starts at wl_open and + * ends at wl_close when not in RTS mode + */ + if(lp->is_handling_int == WL_HANDLING_INT) { + hcf_action( &lp->hcfCtx, HCF_ACT_INT_OFF ); + } +} + +#endif // __WAVELAN2_H__ diff --git a/drivers/staging/wlags49_h2/wl_main.c b/drivers/staging/wlags49_h2/wl_main.c new file mode 100644 index 000000000000..69571938a676 --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_main.c @@ -0,0 +1,3878 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * This file contains the main driver entry points and other adapter + * specific routines. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/08/06 11:25:37 $ + * $Revision: 1.14 $ + * $Source: /usr/local/cvs/wl_lkm/wireless/wl_main.c,v $ + * + ******************************************************************************/ + +/******************************************************************************* + * constant definitions + ******************************************************************************/ + +/* Allow support for calling system fcns to access F/W iamge file */ +#define __KERNEL_SYSCALLS__ + +/******************************************************************************* + * include files + ******************************************************************************/ +#include + +#include +#include +#include +#include +// #include +// #include +// #include +// #include +// #include +// #include +//#include +// #include +// #include +// #include +// #include +// #include +// #include +#include +#include + +#include +#include +// #include +// #include +// #include + +#define BIN_DL 0 +#if BIN_DL +#include +#endif // BIN_DL + + +#include + +#include +#include +//in order to get around:: wl_main.c:2229: `HREG_EV_RDMAD' undeclared (first use in this function) +#include + +#include +#include +#include +#include +#include +#include + +#ifdef USE_PROFILE +#include +#endif /* USE_PROFILE */ + +#ifdef BUS_PCMCIA +#include +#endif /* BUS_PCMCIA */ + +#ifdef BUS_PCI +#include +#endif /* BUS_PCI */ +/******************************************************************************* + * macro defintions + ******************************************************************************/ +#define VALID_PARAM(C) \ + { \ + if (!(C)) \ + { \ + printk(KERN_INFO "Wireless, parameter error: \"%s\"\n", #C); \ + goto failed; \ + } \ + } +/******************************************************************************* + * local functions + ******************************************************************************/ +void wl_isr_handler( unsigned long p ); + +#if 0 //SCULL_USE_PROC /* don't waste space if unused */ +//int scull_read_procmem(char *buf, char **start, off_t offset, int len, int unused); +int scull_read_procmem(char *buf, char **start, off_t offset, int len, int *eof, void *data ); +static int write_int(struct file *file, const char *buffer, unsigned long count, void *data); +static void proc_write(const char *name, write_proc_t *w, void *data); + +#endif /* SCULL_USE_PROC */ + +/******************************************************************************* + * module parameter definitions - set with 'insmod' + ******************************************************************************/ +static p_u16 irq_mask = 0xdeb8; // IRQ3,4,5,7,9,10,11,12,14,15 +static p_s8 irq_list[4] = { -1 }; + +#if 0 +MODULE_PARM(irq_mask, "h"); +MODULE_PARM_DESC(irq_mask, "IRQ mask [0xdeb8]"); +MODULE_PARM(irq_list, "1-4b"); +MODULE_PARM_DESC(irq_list, "IRQ list []"); +#endif + +static p_u8 PARM_AUTHENTICATION = PARM_DEFAULT_AUTHENTICATION; +static p_u16 PARM_AUTH_KEY_MGMT_SUITE = PARM_DEFAULT_AUTH_KEY_MGMT_SUITE; +static p_u16 PARM_BRSC_2GHZ = PARM_DEFAULT_BRSC_2GHZ; +static p_u16 PARM_BRSC_5GHZ = PARM_DEFAULT_BRSC_5GHZ; +static p_u16 PARM_COEXISTENCE = PARM_DEFAULT_COEXISTENCE; +static p_u16 PARM_CONNECTION_CONTROL = PARM_DEFAULT_CONNECTION_CONTROL; //;?rename and move +static p_char *PARM_CREATE_IBSS = PARM_DEFAULT_CREATE_IBSS_STR; +static p_char *PARM_DESIRED_SSID = PARM_DEFAULT_SSID; +static p_char *PARM_DOWNLOAD_FIRMWARE = ""; +static p_u16 PARM_ENABLE_ENCRYPTION = PARM_DEFAULT_ENABLE_ENCRYPTION; +static p_char *PARM_EXCLUDE_UNENCRYPTED = PARM_DEFAULT_EXCLUDE_UNENCRYPTED_STR; +static p_char *PARM_INTRA_BSS_RELAY = PARM_DEFAULT_INTRA_BSS_RELAY_STR; +static p_char *PARM_KEY1 = ""; +static p_char *PARM_KEY2 = ""; +static p_char *PARM_KEY3 = ""; +static p_char *PARM_KEY4 = ""; +static p_char *PARM_LOAD_BALANCING = PARM_DEFAULT_LOAD_BALANCING_STR; +static p_u16 PARM_MAX_SLEEP = PARM_DEFAULT_MAX_PM_SLEEP; +static p_char *PARM_MEDIUM_DISTRIBUTION = PARM_DEFAULT_MEDIUM_DISTRIBUTION_STR; +static p_char *PARM_MICROWAVE_ROBUSTNESS = PARM_DEFAULT_MICROWAVE_ROBUSTNESS_STR; +static p_char *PARM_MULTICAST_PM_BUFFERING = PARM_DEFAULT_MULTICAST_PM_BUFFERING_STR; +static p_u16 PARM_MULTICAST_RATE = PARM_DEFAULT_MULTICAST_RATE_2GHZ; +static p_char *PARM_MULTICAST_RX = PARM_DEFAULT_MULTICAST_RX_STR; +static p_u8 PARM_NETWORK_ADDR[ETH_ALEN] = PARM_DEFAULT_NETWORK_ADDR; +static p_u16 PARM_OWN_ATIM_WINDOW = PARM_DEFAULT_OWN_ATIM_WINDOW; +static p_u16 PARM_OWN_BEACON_INTERVAL = PARM_DEFAULT_OWN_BEACON_INTERVAL; +static p_u8 PARM_OWN_CHANNEL = PARM_DEFAULT_OWN_CHANNEL; +static p_u8 PARM_OWN_DTIM_PERIOD = PARM_DEFAULT_OWN_DTIM_PERIOD; +static p_char *PARM_OWN_NAME = PARM_DEFAULT_OWN_NAME; +static p_char *PARM_OWN_SSID = PARM_DEFAULT_SSID; +static p_u16 PARM_PM_ENABLED = WVLAN_PM_STATE_DISABLED; +static p_u16 PARM_PM_HOLDOVER_DURATION = PARM_DEFAULT_PM_HOLDOVER_DURATION; +static p_u8 PARM_PORT_TYPE = PARM_DEFAULT_PORT_TYPE; +static p_char *PARM_PROMISCUOUS_MODE = PARM_DEFAULT_PROMISCUOUS_MODE_STR; +static p_char *PARM_REJECT_ANY = PARM_DEFAULT_REJECT_ANY_STR; +#ifdef USE_WDS +static p_u16 PARM_RTS_THRESHOLD1 = PARM_DEFAULT_RTS_THRESHOLD; +static p_u16 PARM_RTS_THRESHOLD2 = PARM_DEFAULT_RTS_THRESHOLD; +static p_u16 PARM_RTS_THRESHOLD3 = PARM_DEFAULT_RTS_THRESHOLD; +static p_u16 PARM_RTS_THRESHOLD4 = PARM_DEFAULT_RTS_THRESHOLD; +static p_u16 PARM_RTS_THRESHOLD5 = PARM_DEFAULT_RTS_THRESHOLD; +static p_u16 PARM_RTS_THRESHOLD6 = PARM_DEFAULT_RTS_THRESHOLD; +#endif // USE_WDS +static p_u16 PARM_RTS_THRESHOLD = PARM_DEFAULT_RTS_THRESHOLD; +static p_u16 PARM_SRSC_2GHZ = PARM_DEFAULT_SRSC_2GHZ; +static p_u16 PARM_SRSC_5GHZ = PARM_DEFAULT_SRSC_5GHZ; +static p_u8 PARM_SYSTEM_SCALE = PARM_DEFAULT_SYSTEM_SCALE; +static p_u8 PARM_TX_KEY = PARM_DEFAULT_TX_KEY; +static p_u16 PARM_TX_POW_LEVEL = PARM_DEFAULT_TX_POW_LEVEL; +#ifdef USE_WDS +static p_u16 PARM_TX_RATE1 = PARM_DEFAULT_TX_RATE_2GHZ; +static p_u16 PARM_TX_RATE2 = PARM_DEFAULT_TX_RATE_2GHZ; +static p_u16 PARM_TX_RATE3 = PARM_DEFAULT_TX_RATE_2GHZ; +static p_u16 PARM_TX_RATE4 = PARM_DEFAULT_TX_RATE_2GHZ; +static p_u16 PARM_TX_RATE5 = PARM_DEFAULT_TX_RATE_2GHZ; +static p_u16 PARM_TX_RATE6 = PARM_DEFAULT_TX_RATE_2GHZ; +#endif // USE_WDS +static p_u16 PARM_TX_RATE = PARM_DEFAULT_TX_RATE_2GHZ; +#ifdef USE_WDS +static p_u8 PARM_WDS_ADDRESS1[ETH_ALEN] = PARM_DEFAULT_NETWORK_ADDR; +static p_u8 PARM_WDS_ADDRESS2[ETH_ALEN] = PARM_DEFAULT_NETWORK_ADDR; +static p_u8 PARM_WDS_ADDRESS3[ETH_ALEN] = PARM_DEFAULT_NETWORK_ADDR; +static p_u8 PARM_WDS_ADDRESS4[ETH_ALEN] = PARM_DEFAULT_NETWORK_ADDR; +static p_u8 PARM_WDS_ADDRESS5[ETH_ALEN] = PARM_DEFAULT_NETWORK_ADDR; +static p_u8 PARM_WDS_ADDRESS6[ETH_ALEN] = PARM_DEFAULT_NETWORK_ADDR; +#endif // USE_WDS + + +#if 0 +MODULE_PARM(PARM_DESIRED_SSID, "s"); +MODULE_PARM_DESC(PARM_DESIRED_SSID, "Network Name () [ANY]"); +MODULE_PARM(PARM_OWN_SSID, "s"); +MODULE_PARM_DESC(PARM_OWN_SSID, "Network Name () [ANY]"); +MODULE_PARM(PARM_OWN_CHANNEL, "b"); +MODULE_PARM_DESC(PARM_OWN_CHANNEL, "Channel (0 - 14) [0]"); +MODULE_PARM(PARM_SYSTEM_SCALE, "b"); +MODULE_PARM_DESC(PARM_SYSTEM_SCALE, "Distance Between APs (1 - 3) [1]"); +MODULE_PARM(PARM_TX_RATE, "b"); +MODULE_PARM_DESC(PARM_TX_RATE, "Transmit Rate Control"); +MODULE_PARM(PARM_RTS_THRESHOLD, "h"); +MODULE_PARM_DESC(PARM_RTS_THRESHOLD, "Medium Reservation (RTS/CTS Fragment Length) (256 - 2347) [2347]"); +MODULE_PARM(PARM_MICROWAVE_ROBUSTNESS, "s"); +MODULE_PARM_DESC(PARM_MICROWAVE_ROBUSTNESS, "Microwave Oven Robustness Enabled ( N or Y) [N]"); +MODULE_PARM(PARM_OWN_NAME, "s"); +MODULE_PARM_DESC(PARM_OWN_NAME, "Station Name () [Linux]"); + +MODULE_PARM(PARM_ENABLE_ENCRYPTION, "b"); +MODULE_PARM_DESC(PARM_ENABLE_ENCRYPTION, "Encryption Mode (0 - 7) [0]"); + +MODULE_PARM(PARM_KEY1, "s"); +MODULE_PARM_DESC(PARM_KEY1, "Data Encryption Key 1 () []"); +MODULE_PARM(PARM_KEY2, "s"); +MODULE_PARM_DESC(PARM_KEY2, "Data Encryption Key 2 () []"); +MODULE_PARM(PARM_KEY3, "s"); +MODULE_PARM_DESC(PARM_KEY3, "Data Encryption Key 3 () []"); +MODULE_PARM(PARM_KEY4, "s"); +MODULE_PARM_DESC(PARM_KEY4, "Data Encryption Key 4 () []"); +MODULE_PARM(PARM_TX_KEY, "b"); +MODULE_PARM_DESC(PARM_TX_KEY, "Transmit Key ID (1 - 4) [1]"); +MODULE_PARM(PARM_MULTICAST_RATE, "b"); +MODULE_PARM_DESC(PARM_MULTICAST_RATE, "Multicast Rate"); +MODULE_PARM(PARM_DOWNLOAD_FIRMWARE, "s"); +MODULE_PARM_DESC(PARM_DOWNLOAD_FIRMWARE, "filename of firmware image"); + +MODULE_PARM(PARM_AUTH_KEY_MGMT_SUITE, "b"); +MODULE_PARM_DESC(PARM_AUTH_KEY_MGMT_SUITE, "Authentication Key Management suite (0-4) [0]"); + +MODULE_PARM(PARM_LOAD_BALANCING, "s"); +MODULE_PARM_DESC(PARM_LOAD_BALANCING, "Load Balancing Enabled ( N or Y) [Y]"); +MODULE_PARM(PARM_MEDIUM_DISTRIBUTION, "s"); +MODULE_PARM_DESC(PARM_MEDIUM_DISTRIBUTION, "Medium Distribution Enabled ( N or Y) [Y]"); +MODULE_PARM(PARM_TX_POW_LEVEL, "b"); +MODULE_PARM_DESC(PARM_TX_POW_LEVEL, "Transmit Power (0 - 6) [3]"); +MODULE_PARM(PARM_SRSC_2GHZ, "b"); +MODULE_PARM_DESC(PARM_SRSC_2GHZ, "Supported Rate Set Control 2.4 GHz"); +MODULE_PARM(PARM_SRSC_5GHZ, "b"); +MODULE_PARM_DESC(PARM_SRSC_5GHZ, "Supported Rate Set Control 5.0 GHz"); +MODULE_PARM(PARM_BRSC_2GHZ, "b"); +MODULE_PARM_DESC(PARM_BRSC_2GHZ, "Basic Rate Set Control 2.4 GHz"); +MODULE_PARM(PARM_BRSC_5GHZ, "b"); +MODULE_PARM_DESC(PARM_BRSC_5GHZ, "Basic Rate Set Control 5.0 GHz"); +#if 1 //;? (HCF_TYPE) & HCF_TYPE_STA +//;?seems reasonable that even an AP-only driver could afford this small additional footprint +MODULE_PARM(PARM_PM_ENABLED, "h"); +MODULE_PARM_DESC(PARM_PM_ENABLED, "Power Management State (0 - 2, 8001 - 8002) [0]"); +MODULE_PARM(PARM_PORT_TYPE, "b"); +MODULE_PARM_DESC(PARM_PORT_TYPE, "Port Type (1 - 3) [1]"); +//;?MODULE_PARM(PARM_CREATE_IBSS, "s"); +//;?MODULE_PARM_DESC(PARM_CREATE_IBSS, "Create IBSS ( N or Y) [N]"); +//;?MODULE_PARM(PARM_MULTICAST_RX, "s"); +//;?MODULE_PARM_DESC(PARM_MULTICAST_RX, "Multicast Receive Enable ( N or Y) [Y]"); +//;?MODULE_PARM(PARM_MAX_SLEEP, "h"); +//;?MODULE_PARM_DESC(PARM_MAX_SLEEP, "Maximum Power Management Sleep Duration (0 - 65535) [100]"); +//;?MODULE_PARM(PARM_NETWORK_ADDR, "6b"); +//;?MODULE_PARM_DESC(PARM_NETWORK_ADDR, "Hardware Ethernet Address ([0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff]) []"); +//;?MODULE_PARM(PARM_AUTHENTICATION, "b"); +// +//tracker 12448 +//;?MODULE_PARM_DESC(PARM_AUTHENTICATION, "Authentication Type (0-2) [0] 0=Open 1=SharedKey 2=LEAP"); +//;?MODULE_PARM_DESC(authentication, "Authentication Type (1-2) [1] 1=Open 2=SharedKey"); +//tracker 12448 +// +//;?MODULE_PARM(PARM_OWN_ATIM_WINDOW, "b"); +//;?MODULE_PARM_DESC(PARM_OWN_ATIM_WINDOW, "ATIM Window time in TU for IBSS creation (0-100) [0]"); +//;?MODULE_PARM(PARM_PM_HOLDOVER_DURATION, "b"); +//;?MODULE_PARM_DESC(PARM_PM_HOLDOVER_DURATION, "Time station remains awake after MAC frame transfer when PM is on (0-65535) [100]"); +//;?MODULE_PARM(PARM_PROMISCUOUS_MODE, "s"); +//;?MODULE_PARM_DESC(PARM_PROMISCUOUS_MODE, "Promiscuous Mode Enable ( Y or N ) [N]" ); +//;? +MODULE_PARM(PARM_CONNECTION_CONTROL, "b"); +MODULE_PARM_DESC(PARM_CONNECTION_CONTROL, "Connection Control (0 - 3) [2]"); +#endif /* HCF_STA */ +#if 1 //;? (HCF_TYPE) & HCF_TYPE_AP + //;?should we restore this to allow smaller memory footprint +MODULE_PARM(PARM_OWN_DTIM_PERIOD, "b"); +MODULE_PARM_DESC(PARM_OWN_DTIM_PERIOD, "DTIM Period (0 - 255) [1]"); +MODULE_PARM(PARM_REJECT_ANY, "s"); +MODULE_PARM_DESC(PARM_REJECT_ANY, "Closed System ( N or Y) [N]"); +MODULE_PARM(PARM_EXCLUDE_UNENCRYPTED, "s"); +MODULE_PARM_DESC(PARM_EXCLUDE_UNENCRYPTED, "Deny non-encrypted ( N or Y) [Y]"); +MODULE_PARM(PARM_MULTICAST_PM_BUFFERING,"s"); +MODULE_PARM_DESC(PARM_MULTICAST_PM_BUFFERING, "Buffer MAC frames for Tx after DTIM ( Y or N) [Y]"); +MODULE_PARM(PARM_INTRA_BSS_RELAY, "s"); +MODULE_PARM_DESC(PARM_INTRA_BSS_RELAY, "IntraBSS Relay ( N or Y) [Y]"); +MODULE_PARM(PARM_RTS_THRESHOLD1, "h"); +MODULE_PARM_DESC(PARM_RTS_THRESHOLD1, "RTS Threshold, WDS Port 1 (256 - 2347) [2347]"); +MODULE_PARM(PARM_RTS_THRESHOLD2, "h"); +MODULE_PARM_DESC(PARM_RTS_THRESHOLD2, "RTS Threshold, WDS Port 2 (256 - 2347) [2347]"); +MODULE_PARM(PARM_RTS_THRESHOLD3, "h"); +MODULE_PARM_DESC(PARM_RTS_THRESHOLD3, "RTS Threshold, WDS Port 3 (256 - 2347) [2347]"); +MODULE_PARM(PARM_RTS_THRESHOLD4, "h"); +MODULE_PARM_DESC(PARM_RTS_THRESHOLD4, "RTS Threshold, WDS Port 4 (256 - 2347) [2347]"); +MODULE_PARM(PARM_RTS_THRESHOLD5, "h"); +MODULE_PARM_DESC(PARM_RTS_THRESHOLD5, "RTS Threshold, WDS Port 5 (256 - 2347) [2347]"); +MODULE_PARM(PARM_RTS_THRESHOLD6, "h"); +MODULE_PARM_DESC(PARM_RTS_THRESHOLD6, "RTS Threshold, WDS Port 6 (256 - 2347) [2347]"); +MODULE_PARM(PARM_TX_RATE1, "b"); +MODULE_PARM_DESC(PARM_TX_RATE1, "Transmit Rate Control, WDS Port 1 (1 - 7) [3]"); +MODULE_PARM(PARM_TX_RATE2, "b"); +MODULE_PARM_DESC(PARM_TX_RATE2, "Transmit Rate Control, WDS Port 2 (1 - 7) [3]"); +MODULE_PARM(PARM_TX_RATE3, "b"); +MODULE_PARM_DESC(PARM_TX_RATE3, "Transmit Rate Control, WDS Port 3 (1 - 7) [3]"); +MODULE_PARM(PARM_TX_RATE4, "b"); +MODULE_PARM_DESC(PARM_TX_RATE4, "Transmit Rate Control, WDS Port 4 (1 - 7) [3]"); +MODULE_PARM(PARM_TX_RATE5, "b"); +MODULE_PARM_DESC(PARM_TX_RATE5, "Transmit Rate Control, WDS Port 5 (1 - 7) [3]"); +MODULE_PARM(PARM_TX_RATE6, "b"); +MODULE_PARM_DESC(PARM_TX_RATE6, "Transmit Rate Control, WDS Port 6 (1 - 7) [3]"); +MODULE_PARM(PARM_WDS_ADDRESS1, "6b"); +MODULE_PARM_DESC(PARM_WDS_ADDRESS1, "MAC Address, WDS Port 1 ([0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff]) [{0}]"); +MODULE_PARM(PARM_WDS_ADDRESS2, "6b"); +MODULE_PARM_DESC(PARM_WDS_ADDRESS2, "MAC Address, WDS Port 2 ([0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff]) [{0}]"); +MODULE_PARM(PARM_WDS_ADDRESS3, "6b"); +MODULE_PARM_DESC(PARM_WDS_ADDRESS3, "MAC Address, WDS Port 3 ([0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff]) [{0}]"); +MODULE_PARM(PARM_WDS_ADDRESS4, "6b"); +MODULE_PARM_DESC(PARM_WDS_ADDRESS4, "MAC Address, WDS Port 4 ([0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff]) [{0}]"); +MODULE_PARM(PARM_WDS_ADDRESS5, "6b"); +MODULE_PARM_DESC(PARM_WDS_ADDRESS5, "MAC Address, WDS Port 5 ([0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff]) [{0}]"); +MODULE_PARM(PARM_WDS_ADDRESS6, "6b"); +MODULE_PARM_DESC(PARM_WDS_ADDRESS6, "MAC Address, WDS Port 6 ([0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff]) [{0}]"); + +MODULE_PARM(PARM_OWN_BEACON_INTERVAL, "b"); +MODULE_PARM_DESC(PARM_OWN_BEACON_INTERVAL, "Own Beacon Interval (20 - 200) [100]"); +MODULE_PARM(PARM_COEXISTENCE, "b"); +MODULE_PARM_DESC(PARM_COEXISTENCE, "Coexistence (0-7) [0]"); + +#endif /* HCF_AP */ +#endif + +/* END NEW PARAMETERS */ +/******************************************************************************* + * debugging specifics + ******************************************************************************/ +#if DBG + +static p_u32 pc_debug = DBG_LVL; +//MODULE_PARM(pc_debug, "i"); +/*static ;?conflicts with my understanding of CL parameters and breaks now I moved + * the correspondig logic to wl_profile + */ p_u32 DebugFlag = ~0; //recognizable "undefined value" rather then DBG_DEFAULTS; +//MODULE_PARM(DebugFlag, "l"); + +dbg_info_t wl_info = { DBG_MOD_NAME, 0, 0 }; +dbg_info_t *DbgInfo = &wl_info; + +#endif /* DBG */ +#ifdef USE_RTS + +static p_char *useRTS = "N"; +MODULE_PARM( useRTS, "s" ); +MODULE_PARM_DESC( useRTS, "Use RTS test interface ( N or Y) [N]" ); + +#endif /* USE_RTS */ +/******************************************************************************* + * firmware download specifics + ******************************************************************************/ +extern struct CFG_RANGE2_STRCT BASED + cfg_drv_act_ranges_pri; // describes primary-actor range of HCF + +#if 0 //;? (HCF_TYPE) & HCF_TYPE_AP +extern memimage ap; // AP firmware image to be downloaded +#endif /* HCF_AP */ + +#if 1 //;? (HCF_TYPE) & HCF_TYPE_STA +//extern memimage station; // STA firmware image to be downloaded +extern memimage fw_image; // firmware image to be downloaded +#endif /* HCF_STA */ + + +/******************************************************************************* + * wl_insert() + ******************************************************************************* + * + * DESCRIPTION: + * + * wl_insert() is scheduled to run after a CARD_INSERTION event is + * received, to configure the PCMCIA socket, and to make the ethernet device + * available to the system. + * + * PARAMETERS: + * + * dev - a pointer to the net_device struct of the wireless device + * + * RETURNS: + * + * TRUE or FALSE + * + ******************************************************************************/ +int wl_insert( struct net_device *dev ) +{ + int result = 0; + int hcf_status = HCF_SUCCESS; + int i; + unsigned long flags = 0; + struct wl_private *lp = wl_priv(dev); + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wl_insert" ); + DBG_ENTER( DbgInfo ); + + /* Initialize the adapter hardware. */ + memset( &( lp->hcfCtx ), 0, sizeof( IFB_STRCT )); + + /* Initialize the adapter parameters. */ + spin_lock_init( &( lp->slock )); + + /* Intialize states */ + //lp->lockcount = 0; //PE1DNN + lp->is_handling_int = WL_NOT_HANDLING_INT; + lp->firmware_present = WL_FRIMWARE_NOT_PRESENT; + + lp->dev = dev; + + DBG_PARAM( DbgInfo, "irq_mask", "0x%04x", irq_mask & 0x0FFFF ); + DBG_PARAM( DbgInfo, "irq_list", "0x%02x 0x%02x 0x%02x 0x%02x", + irq_list[0] & 0x0FF, irq_list[1] & 0x0FF, + irq_list[2] & 0x0FF, irq_list[3] & 0x0FF ); + DBG_PARAM( DbgInfo, PARM_NAME_DESIRED_SSID, "\"%s\"", PARM_DESIRED_SSID ); + DBG_PARAM( DbgInfo, PARM_NAME_OWN_SSID, "\"%s\"", PARM_OWN_SSID ); + DBG_PARAM( DbgInfo, PARM_NAME_OWN_CHANNEL, "%d", PARM_OWN_CHANNEL); + DBG_PARAM( DbgInfo, PARM_NAME_SYSTEM_SCALE, "%d", PARM_SYSTEM_SCALE ); + DBG_PARAM( DbgInfo, PARM_NAME_TX_RATE, "%d", PARM_TX_RATE ); + DBG_PARAM( DbgInfo, PARM_NAME_RTS_THRESHOLD, "%d", PARM_RTS_THRESHOLD ); + DBG_PARAM( DbgInfo, PARM_NAME_MICROWAVE_ROBUSTNESS, "\"%s\"", PARM_MICROWAVE_ROBUSTNESS ); + DBG_PARAM( DbgInfo, PARM_NAME_OWN_NAME, "\"%s\"", PARM_OWN_NAME ); +//;? DBG_PARAM( DbgInfo, PARM_NAME_ENABLE_ENCRYPTION, "\"%s\"", PARM_ENABLE_ENCRYPTION ); + DBG_PARAM( DbgInfo, PARM_NAME_KEY1, "\"%s\"", PARM_KEY1 ); + DBG_PARAM( DbgInfo, PARM_NAME_KEY2, "\"%s\"", PARM_KEY2 ); + DBG_PARAM( DbgInfo, PARM_NAME_KEY3, "\"%s\"", PARM_KEY3 ); + DBG_PARAM( DbgInfo, PARM_NAME_KEY4, "\"%s\"", PARM_KEY4 ); + DBG_PARAM( DbgInfo, PARM_NAME_TX_KEY, "%d", PARM_TX_KEY ); + DBG_PARAM( DbgInfo, PARM_NAME_MULTICAST_RATE, "%d", PARM_MULTICAST_RATE ); + DBG_PARAM( DbgInfo, PARM_NAME_DOWNLOAD_FIRMWARE, "\"%s\"", PARM_DOWNLOAD_FIRMWARE ); + DBG_PARAM( DbgInfo, PARM_NAME_AUTH_KEY_MGMT_SUITE, "%d", PARM_AUTH_KEY_MGMT_SUITE ); +//;?#if (HCF_TYPE) & HCF_TYPE_STA + //;?should we make this code conditional depending on in STA mode +//;? DBG_PARAM( DbgInfo, PARM_NAME_PORT_TYPE, "%d", PARM_PORT_TYPE ); + DBG_PARAM( DbgInfo, PARM_NAME_PM_ENABLED, "%04x", PARM_PM_ENABLED ); +//;? DBG_PARAM( DbgInfo, PARM_NAME_CREATE_IBSS, "\"%s\"", PARM_CREATE_IBSS ); +//;? DBG_PARAM( DbgInfo, PARM_NAME_MULTICAST_RX, "\"%s\"", PARM_MULTICAST_RX ); +//;? DBG_PARAM( DbgInfo, PARM_NAME_MAX_SLEEP, "%d", PARM_MAX_SLEEP ); +//;? DBG_PARAM( DbgInfo, PARM_NAME_NETWORK_ADDR, "\"%s\"", DbgHwAddr( PARM_NETWORK_ADDR )); +//;? DBG_PARAM( DbgInfo, PARM_NAME_AUTHENTICATION, "%d", PARM_AUTHENTICATION ); +//;? DBG_PARAM( DbgInfo, PARM_NAME_OWN_ATIM_WINDOW, "%d", PARM_OWN_ATIM_WINDOW ); +//;? DBG_PARAM( DbgInfo, PARM_NAME_PM_HOLDOVER_DURATION, "%d", PARM_PM_HOLDOVER_DURATION ); +//;? DBG_PARAM( DbgInfo, PARM_NAME_PROMISCUOUS_MODE, "\"%s\"", PARM_PROMISCUOUS_MODE ); +//;?#endif /* HCF_STA */ +#if 1 //;? (HCF_TYPE) & HCF_TYPE_AP + //;?should we restore this to allow smaller memory footprint + //;?I guess: no, since this is Debug mode only + DBG_PARAM( DbgInfo, PARM_NAME_OWN_DTIM_PERIOD, "%d", PARM_OWN_DTIM_PERIOD ); + DBG_PARAM( DbgInfo, PARM_NAME_REJECT_ANY, "\"%s\"", PARM_REJECT_ANY ); + DBG_PARAM( DbgInfo, PARM_NAME_EXCLUDE_UNENCRYPTED, "\"%s\"", PARM_EXCLUDE_UNENCRYPTED ); + DBG_PARAM( DbgInfo, PARM_NAME_MULTICAST_PM_BUFFERING, "\"%s\"", PARM_MULTICAST_PM_BUFFERING ); + DBG_PARAM( DbgInfo, PARM_NAME_INTRA_BSS_RELAY, "\"%s\"", PARM_INTRA_BSS_RELAY ); +#ifdef USE_WDS + DBG_PARAM( DbgInfo, PARM_NAME_RTS_THRESHOLD1, "%d", PARM_RTS_THRESHOLD1 ); + DBG_PARAM( DbgInfo, PARM_NAME_RTS_THRESHOLD2, "%d", PARM_RTS_THRESHOLD2 ); + DBG_PARAM( DbgInfo, PARM_NAME_RTS_THRESHOLD3, "%d", PARM_RTS_THRESHOLD3 ); + DBG_PARAM( DbgInfo, PARM_NAME_RTS_THRESHOLD4, "%d", PARM_RTS_THRESHOLD4 ); + DBG_PARAM( DbgInfo, PARM_NAME_RTS_THRESHOLD5, "%d", PARM_RTS_THRESHOLD5 ); + DBG_PARAM( DbgInfo, PARM_NAME_RTS_THRESHOLD6, "%d", PARM_RTS_THRESHOLD6 ); + DBG_PARAM( DbgInfo, PARM_NAME_TX_RATE1, "%d", PARM_TX_RATE1 ); + DBG_PARAM( DbgInfo, PARM_NAME_TX_RATE2, "%d", PARM_TX_RATE2 ); + DBG_PARAM( DbgInfo, PARM_NAME_TX_RATE3, "%d", PARM_TX_RATE3 ); + DBG_PARAM( DbgInfo, PARM_NAME_TX_RATE4, "%d", PARM_TX_RATE4 ); + DBG_PARAM( DbgInfo, PARM_NAME_TX_RATE5, "%d", PARM_TX_RATE5 ); + DBG_PARAM( DbgInfo, PARM_NAME_TX_RATE6, "%d", PARM_TX_RATE6 ); + DBG_PARAM( DbgInfo, PARM_NAME_WDS_ADDRESS1, "\"%s\"", DbgHwAddr( PARM_WDS_ADDRESS1 )); + DBG_PARAM( DbgInfo, PARM_NAME_WDS_ADDRESS2, "\"%s\"", DbgHwAddr( PARM_WDS_ADDRESS2 )); + DBG_PARAM( DbgInfo, PARM_NAME_WDS_ADDRESS3, "\"%s\"", DbgHwAddr( PARM_WDS_ADDRESS3 )); + DBG_PARAM( DbgInfo, PARM_NAME_WDS_ADDRESS4, "\"%s\"", DbgHwAddr( PARM_WDS_ADDRESS4 )); + DBG_PARAM( DbgInfo, PARM_NAME_WDS_ADDRESS5, "\"%s\"", DbgHwAddr( PARM_WDS_ADDRESS5 )); + DBG_PARAM( DbgInfo, PARM_NAME_WDS_ADDRESS6, "\"%s\"", DbgHwAddr( PARM_WDS_ADDRESS6 )); +#endif /* USE_WDS */ +#endif /* HCF_AP */ + + VALID_PARAM( !PARM_DESIRED_SSID || ( strlen( PARM_DESIRED_SSID ) <= PARM_MAX_NAME_LEN )); + VALID_PARAM( !PARM_OWN_SSID || ( strlen( PARM_OWN_SSID ) <= PARM_MAX_NAME_LEN )); + VALID_PARAM(( PARM_OWN_CHANNEL <= PARM_MAX_OWN_CHANNEL )); + VALID_PARAM(( PARM_SYSTEM_SCALE >= PARM_MIN_SYSTEM_SCALE ) && ( PARM_SYSTEM_SCALE <= PARM_MAX_SYSTEM_SCALE )); + VALID_PARAM(( PARM_TX_RATE >= PARM_MIN_TX_RATE ) && ( PARM_TX_RATE <= PARM_MAX_TX_RATE )); + VALID_PARAM(( PARM_RTS_THRESHOLD <= PARM_MAX_RTS_THRESHOLD )); + VALID_PARAM( !PARM_MICROWAVE_ROBUSTNESS || strchr( "NnYy", PARM_MICROWAVE_ROBUSTNESS[0] ) != NULL ); + VALID_PARAM( !PARM_OWN_NAME || ( strlen( PARM_NAME_OWN_NAME ) <= PARM_MAX_NAME_LEN )); + VALID_PARAM(( PARM_ENABLE_ENCRYPTION <= PARM_MAX_ENABLE_ENCRYPTION )); + VALID_PARAM( is_valid_key_string( PARM_KEY1 )); + VALID_PARAM( is_valid_key_string( PARM_KEY2 )); + VALID_PARAM( is_valid_key_string( PARM_KEY3 )); + VALID_PARAM( is_valid_key_string( PARM_KEY4 )); + VALID_PARAM(( PARM_TX_KEY >= PARM_MIN_TX_KEY ) && ( PARM_TX_KEY <= PARM_MAX_TX_KEY )); + + VALID_PARAM(( PARM_MULTICAST_RATE >= PARM_MIN_MULTICAST_RATE ) && + ( PARM_MULTICAST_RATE <= PARM_MAX_MULTICAST_RATE )); + + VALID_PARAM( !PARM_DOWNLOAD_FIRMWARE || ( strlen( PARM_DOWNLOAD_FIRMWARE ) <= 255 /*;?*/ )); + VALID_PARAM(( PARM_AUTH_KEY_MGMT_SUITE < PARM_MAX_AUTH_KEY_MGMT_SUITE )); + + VALID_PARAM( !PARM_LOAD_BALANCING || strchr( "NnYy", PARM_LOAD_BALANCING[0] ) != NULL ); + VALID_PARAM( !PARM_MEDIUM_DISTRIBUTION || strchr( "NnYy", PARM_MEDIUM_DISTRIBUTION[0] ) != NULL ); + VALID_PARAM(( PARM_TX_POW_LEVEL <= PARM_MAX_TX_POW_LEVEL )); + + VALID_PARAM(( PARM_PORT_TYPE >= PARM_MIN_PORT_TYPE ) && ( PARM_PORT_TYPE <= PARM_MAX_PORT_TYPE )); + VALID_PARAM( PARM_PM_ENABLED <= WVLAN_PM_STATE_STANDARD || + ( PARM_PM_ENABLED & 0x7FFF ) <= WVLAN_PM_STATE_STANDARD ); + VALID_PARAM( !PARM_CREATE_IBSS || strchr( "NnYy", PARM_CREATE_IBSS[0] ) != NULL ); + VALID_PARAM( !PARM_MULTICAST_RX || strchr( "NnYy", PARM_MULTICAST_RX[0] ) != NULL ); + VALID_PARAM(( PARM_MAX_SLEEP <= PARM_MAX_MAX_PM_SLEEP )); + VALID_PARAM(( PARM_AUTHENTICATION <= PARM_MAX_AUTHENTICATION )); + VALID_PARAM(( PARM_OWN_ATIM_WINDOW <= PARM_MAX_OWN_ATIM_WINDOW )); + VALID_PARAM(( PARM_PM_HOLDOVER_DURATION <= PARM_MAX_PM_HOLDOVER_DURATION )); + VALID_PARAM( !PARM_PROMISCUOUS_MODE || strchr( "NnYy", PARM_PROMISCUOUS_MODE[0] ) != NULL ); + VALID_PARAM(( PARM_CONNECTION_CONTROL <= PARM_MAX_CONNECTION_CONTROL )); + + VALID_PARAM(( PARM_OWN_DTIM_PERIOD >= PARM_MIN_OWN_DTIM_PERIOD )); + VALID_PARAM( !PARM_REJECT_ANY || strchr( "NnYy", PARM_REJECT_ANY[0] ) != NULL ); + VALID_PARAM( !PARM_EXCLUDE_UNENCRYPTED || strchr( "NnYy", PARM_EXCLUDE_UNENCRYPTED[0] ) != NULL ); + VALID_PARAM( !PARM_MULTICAST_PM_BUFFERING || strchr( "NnYy", PARM_MULTICAST_PM_BUFFERING[0] ) != NULL ); + VALID_PARAM( !PARM_INTRA_BSS_RELAY || strchr( "NnYy", PARM_INTRA_BSS_RELAY[0] ) != NULL ); +#ifdef USE_WDS + VALID_PARAM(( PARM_RTS_THRESHOLD1 <= PARM_MAX_RTS_THRESHOLD )); + VALID_PARAM(( PARM_RTS_THRESHOLD2 <= PARM_MAX_RTS_THRESHOLD )); + VALID_PARAM(( PARM_RTS_THRESHOLD3 <= PARM_MAX_RTS_THRESHOLD )); + VALID_PARAM(( PARM_RTS_THRESHOLD4 <= PARM_MAX_RTS_THRESHOLD )); + VALID_PARAM(( PARM_RTS_THRESHOLD5 <= PARM_MAX_RTS_THRESHOLD )); + VALID_PARAM(( PARM_RTS_THRESHOLD6 <= PARM_MAX_RTS_THRESHOLD )); + VALID_PARAM(( PARM_TX_RATE1 >= PARM_MIN_TX_RATE ) && (PARM_TX_RATE1 <= PARM_MAX_TX_RATE )); + VALID_PARAM(( PARM_TX_RATE2 >= PARM_MIN_TX_RATE ) && (PARM_TX_RATE2 <= PARM_MAX_TX_RATE )); + VALID_PARAM(( PARM_TX_RATE3 >= PARM_MIN_TX_RATE ) && (PARM_TX_RATE3 <= PARM_MAX_TX_RATE )); + VALID_PARAM(( PARM_TX_RATE4 >= PARM_MIN_TX_RATE ) && (PARM_TX_RATE4 <= PARM_MAX_TX_RATE )); + VALID_PARAM(( PARM_TX_RATE5 >= PARM_MIN_TX_RATE ) && (PARM_TX_RATE5 <= PARM_MAX_TX_RATE )); + VALID_PARAM(( PARM_TX_RATE6 >= PARM_MIN_TX_RATE ) && (PARM_TX_RATE6 <= PARM_MAX_TX_RATE )); +#endif /* USE_WDS */ + + VALID_PARAM(( PARM_OWN_BEACON_INTERVAL >= PARM_MIN_OWN_BEACON_INTERVAL ) && ( PARM_OWN_BEACON_INTERVAL <= PARM_MAX_OWN_BEACON_INTERVAL )); + VALID_PARAM(( PARM_COEXISTENCE <= PARM_COEXISTENCE )); + + /* Set the driver parameters from the passed in parameters. */ + + /* THESE MODULE PARAMETERS ARE TO BE DEPRECATED IN FAVOR OF A NAMING CONVENTION + WHICH IS INLINE WITH THE FORTHCOMING WAVELAN API */ + + /* START NEW PARAMETERS */ + + lp->Channel = PARM_OWN_CHANNEL; + lp->DistanceBetweenAPs = PARM_SYSTEM_SCALE; + + /* Need to determine how to handle the new bands for 5GHz */ + lp->TxRateControl[0] = PARM_DEFAULT_TX_RATE_2GHZ; + lp->TxRateControl[1] = PARM_DEFAULT_TX_RATE_5GHZ; + + lp->RTSThreshold = PARM_RTS_THRESHOLD; + + /* Need to determine how to handle the new bands for 5GHz */ + lp->MulticastRate[0] = PARM_DEFAULT_MULTICAST_RATE_2GHZ; + lp->MulticastRate[1] = PARM_DEFAULT_MULTICAST_RATE_5GHZ; + + if ( strchr( "Yy", PARM_MICROWAVE_ROBUSTNESS[0] ) != NULL ) { + lp->MicrowaveRobustness = 1; + } else { + lp->MicrowaveRobustness = 0; + } + if ( PARM_DESIRED_SSID && ( strlen( PARM_DESIRED_SSID ) <= HCF_MAX_NAME_LEN )) { + strcpy( lp->NetworkName, PARM_DESIRED_SSID ); + } + if ( PARM_OWN_SSID && ( strlen( PARM_OWN_SSID ) <= HCF_MAX_NAME_LEN )) { + strcpy( lp->NetworkName, PARM_OWN_SSID ); + } + if ( PARM_OWN_NAME && ( strlen( PARM_OWN_NAME ) <= HCF_MAX_NAME_LEN )) { + strcpy( lp->StationName, PARM_OWN_NAME ); + } + lp->EnableEncryption = PARM_ENABLE_ENCRYPTION; + if ( PARM_KEY1 && ( strlen( PARM_KEY1 ) <= MAX_KEY_LEN )) { + strcpy( lp->Key1, PARM_KEY1 ); + } + if ( PARM_KEY2 && ( strlen( PARM_KEY2 ) <= MAX_KEY_LEN )) { + strcpy( lp->Key2, PARM_KEY2 ); + } + if ( PARM_KEY3 && ( strlen( PARM_KEY3 ) <= MAX_KEY_LEN )) { + strcpy( lp->Key3, PARM_KEY3 ); + } + if ( PARM_KEY4 && ( strlen( PARM_KEY4 ) <= MAX_KEY_LEN )) { + strcpy( lp->Key4, PARM_KEY4 ); + } + + lp->TransmitKeyID = PARM_TX_KEY; + + key_string2key( lp->Key1, &(lp->DefaultKeys.key[0] )); + key_string2key( lp->Key2, &(lp->DefaultKeys.key[1] )); + key_string2key( lp->Key3, &(lp->DefaultKeys.key[2] )); + key_string2key( lp->Key4, &(lp->DefaultKeys.key[3] )); + + lp->DownloadFirmware = 1 ; //;?to be upgraded PARM_DOWNLOAD_FIRMWARE; + lp->AuthKeyMgmtSuite = PARM_AUTH_KEY_MGMT_SUITE; + + if ( strchr( "Yy", PARM_LOAD_BALANCING[0] ) != NULL ) { + lp->loadBalancing = 1; + } else { + lp->loadBalancing = 0; + } + + if ( strchr( "Yy", PARM_MEDIUM_DISTRIBUTION[0] ) != NULL ) { + lp->mediumDistribution = 1; + } else { + lp->mediumDistribution = 0; + } + + lp->txPowLevel = PARM_TX_POW_LEVEL; + + lp->srsc[0] = PARM_SRSC_2GHZ; + lp->srsc[1] = PARM_SRSC_5GHZ; + lp->brsc[0] = PARM_BRSC_2GHZ; + lp->brsc[1] = PARM_BRSC_5GHZ; +#if 1 //;? (HCF_TYPE) & HCF_TYPE_STA +//;?seems reasonable that even an AP-only driver could afford this small additional footprint + lp->PortType = PARM_PORT_TYPE; + lp->MaxSleepDuration = PARM_MAX_SLEEP; + lp->authentication = PARM_AUTHENTICATION; + lp->atimWindow = PARM_OWN_ATIM_WINDOW; + lp->holdoverDuration = PARM_PM_HOLDOVER_DURATION; + lp->PMEnabled = PARM_PM_ENABLED; //;? + if ( strchr( "Yy", PARM_CREATE_IBSS[0] ) != NULL ) { + lp->CreateIBSS = 1; + } else { + lp->CreateIBSS = 0; + } + if ( strchr( "Nn", PARM_MULTICAST_RX[0] ) != NULL ) { + lp->MulticastReceive = 0; + } else { + lp->MulticastReceive = 1; + } + if ( strchr( "Yy", PARM_PROMISCUOUS_MODE[0] ) != NULL ) { + lp->promiscuousMode = 1; + } else { + lp->promiscuousMode = 0; + } + for( i = 0; i < ETH_ALEN; i++ ) { + lp->MACAddress[i] = PARM_NETWORK_ADDR[i]; + } + + lp->connectionControl = PARM_CONNECTION_CONTROL; + +#endif /* HCF_STA */ +#if 1 //;? (HCF_TYPE) & HCF_TYPE_AP + //;?should we restore this to allow smaller memory footprint + lp->DTIMPeriod = PARM_OWN_DTIM_PERIOD; + + if ( strchr( "Yy", PARM_REJECT_ANY[0] ) != NULL ) { + lp->RejectAny = 1; + } else { + lp->RejectAny = 0; + } + if ( strchr( "Nn", PARM_EXCLUDE_UNENCRYPTED[0] ) != NULL ) { + lp->ExcludeUnencrypted = 0; + } else { + lp->ExcludeUnencrypted = 1; + } + if ( strchr( "Yy", PARM_MULTICAST_PM_BUFFERING[0] ) != NULL ) { + lp->multicastPMBuffering = 1; + } else { + lp->multicastPMBuffering = 0; + } + if ( strchr( "Yy", PARM_INTRA_BSS_RELAY[0] ) != NULL ) { + lp->intraBSSRelay = 1; + } else { + lp->intraBSSRelay = 0; + } + + lp->ownBeaconInterval = PARM_OWN_BEACON_INTERVAL; + lp->coexistence = PARM_COEXISTENCE; + +#ifdef USE_WDS + lp->wds_port[0].rtsThreshold = PARM_RTS_THRESHOLD1; + lp->wds_port[1].rtsThreshold = PARM_RTS_THRESHOLD2; + lp->wds_port[2].rtsThreshold = PARM_RTS_THRESHOLD3; + lp->wds_port[3].rtsThreshold = PARM_RTS_THRESHOLD4; + lp->wds_port[4].rtsThreshold = PARM_RTS_THRESHOLD5; + lp->wds_port[5].rtsThreshold = PARM_RTS_THRESHOLD6; + lp->wds_port[0].txRateCntl = PARM_TX_RATE1; + lp->wds_port[1].txRateCntl = PARM_TX_RATE2; + lp->wds_port[2].txRateCntl = PARM_TX_RATE3; + lp->wds_port[3].txRateCntl = PARM_TX_RATE4; + lp->wds_port[4].txRateCntl = PARM_TX_RATE5; + lp->wds_port[5].txRateCntl = PARM_TX_RATE6; + + for( i = 0; i < ETH_ALEN; i++ ) { + lp->wds_port[0].wdsAddress[i] = PARM_WDS_ADDRESS1[i]; + } + for( i = 0; i < ETH_ALEN; i++ ) { + lp->wds_port[1].wdsAddress[i] = PARM_WDS_ADDRESS2[i]; + } + for( i = 0; i < ETH_ALEN; i++ ) { + lp->wds_port[2].wdsAddress[i] = PARM_WDS_ADDRESS3[i]; + } + for( i = 0; i < ETH_ALEN; i++ ) { + lp->wds_port[3].wdsAddress[i] = PARM_WDS_ADDRESS4[i]; + } + for( i = 0; i < ETH_ALEN; i++ ) { + lp->wds_port[4].wdsAddress[i] = PARM_WDS_ADDRESS5[i]; + } + for( i = 0; i < ETH_ALEN; i++ ) { + lp->wds_port[5].wdsAddress[i] = PARM_WDS_ADDRESS6[i]; + } +#endif /* USE_WDS */ +#endif /* HCF_AP */ +#ifdef USE_RTS + if ( strchr( "Yy", useRTS[0] ) != NULL ) { + lp->useRTS = 1; + } else { + lp->useRTS = 0; + } +#endif /* USE_RTS */ + + + /* END NEW PARAMETERS */ + + + wl_lock( lp, &flags ); + + /* Initialize the portState variable */ + lp->portState = WVLAN_PORT_STATE_DISABLED; + + /* Initialize the ScanResult struct */ + memset( &( lp->scan_results ), 0, sizeof( lp->scan_results )); + lp->scan_results.scan_complete = FALSE; + + /* Initialize the ProbeResult struct */ + memset( &( lp->probe_results ), 0, sizeof( lp->probe_results )); + lp->probe_results.scan_complete = FALSE; + lp->probe_num_aps = 0; + + + /* Initialize Tx queue stuff */ + memset( lp->txList, 0, sizeof( lp->txList )); + + INIT_LIST_HEAD( &( lp->txFree )); + + lp->txF.skb = NULL; + lp->txF.port = 0; + + + for( i = 0; i < DEFAULT_NUM_TX_FRAMES; i++ ) { + list_add_tail( &( lp->txList[i].node ), &( lp->txFree )); + } + + + for( i = 0; i < WVLAN_MAX_TX_QUEUES; i++ ) { + INIT_LIST_HEAD( &( lp->txQ[i] )); + } + + lp->netif_queue_on = TRUE; + lp->txQ_count = 0; + /* Initialize the use_dma element in the adapter structure. Not sure if + this should be a compile-time or run-time configurable. So for now, + implement as run-time and just define here */ +#ifdef WARP +#ifdef ENABLE_DMA + DBG_TRACE( DbgInfo, "HERMES 2.5 BUSMASTER DMA MODE\n" ); + lp->use_dma = 1; +#else + DBG_TRACE( DbgInfo, "HERMES 2.5 PORT I/O MODE\n" ); + lp->use_dma = 0; +#endif // ENABLE_DMA +#endif // WARP + + /* Register the ISR handler information here, so that it's not done + repeatedly in the ISR */ + tasklet_init(&lp->task, wl_isr_handler, (unsigned long)lp); + + /* Connect to the adapter */ + DBG_TRACE( DbgInfo, "Calling hcf_connect()...\n" ); + hcf_status = hcf_connect( &lp->hcfCtx, dev->base_addr ); + //HCF_ERR_INCOMP_FW is acceptable, because download must still take place + //HCF_ERR_INCOMP_PRI is not acceptable + if ( hcf_status != HCF_SUCCESS && hcf_status != HCF_ERR_INCOMP_FW ) { + DBG_ERROR( DbgInfo, "hcf_connect() failed, status: 0x%x\n", hcf_status ); + wl_unlock( lp, &flags ); + goto hcf_failed; + } + + //;?should set HCF_version and how about driver_stat + lp->driverInfo.IO_address = dev->base_addr; + lp->driverInfo.IO_range = HCF_NUM_IO_PORTS; //;?conditionally 0x40 or 0x80 seems better + lp->driverInfo.IRQ_number = dev->irq; + lp->driverInfo.card_stat = lp->hcfCtx.IFB_CardStat; + //;? what happened to frame_type + + /* Fill in the driver identity structure */ + lp->driverIdentity.len = ( sizeof( lp->driverIdentity ) / sizeof( hcf_16 )) - 1; + lp->driverIdentity.typ = CFG_DRV_IDENTITY; + lp->driverIdentity.comp_id = DRV_IDENTITY; + lp->driverIdentity.variant = DRV_VARIANT; + lp->driverIdentity.version_major = DRV_MAJOR_VERSION; + lp->driverIdentity.version_minor = DRV_MINOR_VERSION; + + + /* Start the card here - This needs to be done in order to get the + MAC address for the network layer */ + DBG_TRACE( DbgInfo, "Calling wvlan_go() to perform a card reset...\n" ); + hcf_status = wl_go( lp ); + + if ( hcf_status != HCF_SUCCESS ) { + DBG_ERROR( DbgInfo, "wl_go() failed\n" ); + wl_unlock( lp, &flags ); + goto hcf_failed; + } + + /* Certain RIDs must be set before enabling the ports */ + wl_put_ltv_init( lp ); + +#if 0 //;?why was this already commented out in wl_lkm_720 + /* Enable the ports */ + if ( wl_adapter_is_open( lp->dev )) { + /* Enable the ports */ + DBG_TRACE( DbgInfo, "Enabling Port 0\n" ); + hcf_status = wl_enable( lp ); + + if ( hcf_status != HCF_SUCCESS ) { + DBG_TRACE( DbgInfo, "Enable port 0 failed: 0x%x\n", hcf_status ); + } + +#if (HCF_TYPE) & HCF_TYPE_AP + DBG_TRACE( DbgInfo, "Enabling WDS Ports\n" ); + //wl_enable_wds_ports( lp ); +#endif /* (HCF_TYPE) & HCF_TYPE_AP */ + + } +#endif + + /* Fill out the MAC address information in the net_device struct */ + memcpy( lp->dev->dev_addr, lp->MACAddress, ETH_ALEN ); + dev->addr_len = ETH_ALEN; + + lp->is_registered = TRUE; + +#ifdef USE_PROFILE + /* Parse the config file for the sake of creating WDS ports if WDS is + configured there but not in the module options */ + parse_config( dev ); +#endif /* USE_PROFILE */ + + /* If we're going into AP Mode, register the "virtual" ethernet devices + needed for WDS */ + WL_WDS_NETDEV_REGISTER( lp ); + + /* Reset the DownloadFirmware variable in the private struct. If the + config file is not used, this will not matter; if it is used, it + will be reparsed in wl_open(). This is done because logic in wl_open + used to check if a firmware download is needed is broken by parsing + the file here; however, this parsing is needed to register WDS ports + in AP mode, if they are configured */ + lp->DownloadFirmware = WVLAN_DRV_MODE_STA; //;?download_firmware; + +#ifdef USE_RTS + if ( lp->useRTS == 1 ) { + DBG_TRACE( DbgInfo, "ENTERING RTS MODE...\n" ); + wl_act_int_off( lp ); + lp->is_handling_int = WL_NOT_HANDLING_INT; // Not handling interrupts anymore + + wl_disable( lp ); + + hcf_connect( &lp->hcfCtx, HCF_DISCONNECT); + } +#endif /* USE_RTS */ + + wl_unlock( lp, &flags ); + + DBG_TRACE( DbgInfo, "%s: Wireless, io_addr %#03lx, irq %d, ""mac_address ", + dev->name, dev->base_addr, dev->irq ); + + for( i = 0; i < ETH_ALEN; i++ ) { + printk( "%02X%c", dev->dev_addr[i], (( i < ( ETH_ALEN-1 )) ? ':' : '\n' )); + } + +#if 0 //SCULL_USE_PROC /* don't waste space if unused */ + create_proc_read_entry( "wlags", 0, NULL, scull_read_procmem, dev ); + proc_mkdir("driver/wlags49", 0); + proc_write("driver/wlags49/wlags49_type", write_int, &lp->wlags49_type); +#endif /* SCULL_USE_PROC */ + + DBG_LEAVE( DbgInfo ); + return result; + +hcf_failed: + wl_hcf_error( dev, hcf_status ); + +failed: + + DBG_ERROR( DbgInfo, "wl_insert() FAILED\n" ); + + if ( lp->is_registered == TRUE ) { + lp->is_registered = FALSE; + } + + WL_WDS_NETDEV_DEREGISTER( lp ); + + result = -EFAULT; + + + DBG_LEAVE( DbgInfo ); + return result; +} // wl_insert +/*============================================================================*/ + + +/******************************************************************************* + * wl_reset() + ******************************************************************************* + * + * DESCRIPTION: + * + * Reset the adapter. + * + * PARAMETERS: + * + * dev - a pointer to the net_device struct of the wireless device + * + * RETURNS: + * + * an HCF status code + * + ******************************************************************************/ +int wl_reset(struct net_device *dev) +{ + struct wl_private *lp = wl_priv(dev); + int hcf_status = HCF_SUCCESS; + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wl_reset" ); + DBG_ENTER( DbgInfo ); + DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev ); + DBG_PARAM( DbgInfo, "dev->base_addr", "(%#03lx)", dev->base_addr ); + + /* + * The caller should already have a lock and + * disable the interrupts, we do not lock here, + * nor do we enable/disable interrupts! + */ + + DBG_TRACE( DbgInfo, "Device Base Address: %#03lx\n", dev->base_addr ); + if ( dev->base_addr ) { + /* Shutdown the adapter. */ + hcf_connect( &lp->hcfCtx, HCF_DISCONNECT ); + + /* Reset the driver information. */ + lp->txBytes = 0; + + /* Connect to the adapter. */ + hcf_status = hcf_connect( &lp->hcfCtx, dev->base_addr ); + if ( hcf_status != HCF_SUCCESS && hcf_status != HCF_ERR_INCOMP_FW ) { + DBG_ERROR( DbgInfo, "hcf_connect() failed, status: 0x%x\n", hcf_status ); + goto out; + } + + /* Check if firmware is present, if not change state */ + if ( hcf_status == HCF_ERR_INCOMP_FW ) { + lp->firmware_present = WL_FRIMWARE_NOT_PRESENT; + } + + /* Initialize the portState variable */ + lp->portState = WVLAN_PORT_STATE_DISABLED; + + /* Restart the adapter. */ + hcf_status = wl_go( lp ); + if ( hcf_status != HCF_SUCCESS ) { + DBG_ERROR( DbgInfo, "wl_go() failed, status: 0x%x\n", hcf_status ); + goto out; + } + + /* Certain RIDs must be set before enabling the ports */ + wl_put_ltv_init( lp ); + } else { + DBG_ERROR( DbgInfo, "Device Base Address INVALID!!!\n" ); + } + +out: + DBG_LEAVE( DbgInfo ); + return hcf_status; +} // wl_reset +/*============================================================================*/ + + +/******************************************************************************* + * wl_go() + ******************************************************************************* + * + * DESCRIPTION: + * + * Reset the adapter. + * + * PARAMETERS: + * + * dev - a pointer to the net_device struct of the wireless device + * + * RETURNS: + * + * an HCF status code + * + ******************************************************************************/ +int wl_go( struct wl_private *lp ) +{ + int hcf_status = HCF_SUCCESS; + char *cp = NULL; //fw_image + int retries = 0; + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wl_go" ); + DBG_ENTER( DbgInfo ); + + hcf_status = wl_disable( lp ); + if ( hcf_status != HCF_SUCCESS ) { + DBG_TRACE( DbgInfo, "Disable port 0 failed: 0x%x\n", hcf_status ); + + while (( hcf_status != HCF_SUCCESS ) && (retries < 10)) { + retries++; + hcf_status = wl_disable( lp ); + } + if ( hcf_status == HCF_SUCCESS ) { + DBG_TRACE( DbgInfo, "Disable port 0 succes : %d retries\n", retries ); + } else { + DBG_TRACE( DbgInfo, "Disable port 0 failed after: %d retries\n", retries ); + } + } + +#if 1 //;? (HCF_TYPE) & HCF_TYPE_AP + //DBG_TRACE( DbgInfo, "Disabling WDS Ports\n" ); + //wl_disable_wds_ports( lp ); +#endif /* (HCF_TYPE) & HCF_TYPE_AP */ + +//;?what was the purpose of this +// /* load the appropriate firmware image, depending on driver mode */ +// lp->ltvRecord.len = ( sizeof( CFG_RANGE20_STRCT ) / sizeof( hcf_16 )) - 1; +// lp->ltvRecord.typ = CFG_DRV_ACT_RANGES_PRI; +// hcf_get_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + +#if BIN_DL + if ( strlen( lp->fw_image_filename ) ) { +mm_segment_t fs; +int file_desc; +int rc; + + DBG_TRACE( DbgInfo, "F/W image:%s:\n", lp->fw_image_filename ); + /* Obtain a user-space process context, storing the original context */ + fs = get_fs( ); + set_fs( get_ds( )); + file_desc = open( lp->fw_image_filename, O_RDONLY, 0 ); + if ( file_desc == -1 ) { + DBG_ERROR( DbgInfo, "No image file found\n" ); + } else { + DBG_TRACE( DbgInfo, "F/W image file found\n" ); +#define DHF_ALLOC_SIZE 96000 //just below 96K, let's hope it suffices for now and for the future + cp = (char*)vmalloc( DHF_ALLOC_SIZE ); + if ( cp == NULL ) { + DBG_ERROR( DbgInfo, "error in vmalloc\n" ); + } else { + rc = read( file_desc, cp, DHF_ALLOC_SIZE ); + if ( rc == DHF_ALLOC_SIZE ) { + DBG_ERROR( DbgInfo, "buffer too small, %d\n", DHF_ALLOC_SIZE ); + } else if ( rc > 0 ) { + DBG_TRACE( DbgInfo, "read O.K.: %d bytes %.12s\n", rc, cp ); + rc = read( file_desc, &cp[rc], 1 ); + if ( rc == 0 ) { //;/change to an until-loop at rc<=0 + DBG_TRACE( DbgInfo, "no more to read\n" ); + } + } + if ( rc != 0 ) { + DBG_ERROR( DbgInfo, "file not read in one swoop or other error"\ + ", give up, too complicated, rc = %0X\n", rc ); + DBG_ERROR( DbgInfo, "still have to change code to get a real download now !!!!!!!!\n" ); + } else { + DBG_TRACE( DbgInfo, "before dhf_download_binary\n" ); + hcf_status = dhf_download_binary( (memimage *)cp ); + DBG_TRACE( DbgInfo, "after dhf_download_binary, before dhf_download_fw\n" ); + //;?improve error flow/handling + hcf_status = dhf_download_fw( &lp->hcfCtx, (memimage *)cp ); + DBG_TRACE( DbgInfo, "after dhf_download_fw\n" ); + } + vfree( cp ); + } + close( file_desc ); + } + set_fs( fs ); /* Return to the original context */ + } +#endif // BIN_DL + + /* If firmware is present but the type is unknown then download anyway */ + if ( (lp->firmware_present == WL_FRIMWARE_PRESENT) + && + ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) != COMP_ID_FW_STA ) + && + ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) != COMP_ID_FW_AP ) ) { + /* Unknown type, download needed. */ + lp->firmware_present = WL_FRIMWARE_NOT_PRESENT; + } + + if(lp->firmware_present == WL_FRIMWARE_NOT_PRESENT) + { + if ( cp == NULL ) { + DBG_TRACE( DbgInfo, "Downloading STA firmware...\n" ); +// hcf_status = dhf_download_fw( &lp->hcfCtx, &station ); + hcf_status = dhf_download_fw( &lp->hcfCtx, &fw_image ); + } + if ( hcf_status != HCF_SUCCESS ) { + DBG_ERROR( DbgInfo, "Firmware Download failed\n" ); + DBG_LEAVE( DbgInfo ); + return hcf_status; + } + } + /* Report the FW versions */ + //;?obsolete, use the available IFB info:: wl_get_pri_records( lp ); + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_STA ) { + DBG_TRACE( DbgInfo, "downloaded station F/W\n" ); + } else if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) { + DBG_TRACE( DbgInfo, "downloaded AP F/W\n" ); + } else { + DBG_ERROR( DbgInfo, "unknown F/W type\n" ); + } + + /* + * Downloaded, no need to repeat this next time, assume the + * contents stays in the card until it is powered off. Note we + * do not switch firmware on the fly, the firmware is fixed in + * the driver for now. + */ + lp->firmware_present = WL_FRIMWARE_PRESENT; + + DBG_TRACE( DbgInfo, "ComponentID:%04x variant:%04x major:%04x minor:%04x\n", + CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ), + CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.variant ), + CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.version_major ), + CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.version_minor )); + + /* now we wil get the MAC address of the card */ + lp->ltvRecord.len = 4; + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) { + lp->ltvRecord.typ = CFG_NIC_MAC_ADDR; + } else + { + lp->ltvRecord.typ = CFG_CNF_OWN_MAC_ADDR; + } + hcf_status = hcf_get_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + if ( hcf_status != HCF_SUCCESS ) { + DBG_ERROR( DbgInfo, "Could not retrieve MAC address\n" ); + DBG_LEAVE( DbgInfo ); + return hcf_status; + } + memcpy( lp->MACAddress, &lp->ltvRecord.u.u8[0], ETH_ALEN ); + DBG_TRACE( DbgInfo, "Card MAC Address: %s\n", DbgHwAddr( lp->MACAddress )); + + /* Write out configuration to the device, enable, and reconnect. However, + only reconnect if in AP mode. For STA mode, need to wait for passive scan + completion before a connect can be issued */ + wl_put_ltv( lp ); + /* Enable the ports */ + hcf_status = wl_enable( lp ); + + if ( lp->DownloadFirmware == WVLAN_DRV_MODE_AP ) { +#ifdef USE_WDS + wl_enable_wds_ports( lp ); +#endif // USE_WDS + hcf_status = wl_connect( lp ); + } + DBG_LEAVE( DbgInfo ); + return hcf_status; +} // wl_go +/*============================================================================*/ + + +/******************************************************************************* + * wl_set_wep_keys() + ******************************************************************************* + * + * DESCRIPTION: + * + * Write TxKeyID and WEP keys to the adapter. This is separated from + * wl_apply() to allow dynamic WEP key updates through the wireless + * extensions. + * + * PARAMETERS: + * + * lp - a pointer to the wireless adapter's private structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_set_wep_keys( struct wl_private *lp ) +{ + int count = 0; + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wl_set_wep_keys" ); + DBG_ENTER( DbgInfo ); + DBG_PARAM( DbgInfo, "lp", "%s (0x%p)", lp->dev->name, lp ); + if ( lp->EnableEncryption ) { + /* NOTE: CFG_CNF_ENCRYPTION is set in wl_put_ltv() as it's a static + RID */ + + /* set TxKeyID */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_TX_KEY_ID; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->TransmitKeyID - 1); + + hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + DBG_TRACE( DbgInfo, "Key 1 len: %d\n", lp->DefaultKeys.key[0].len ); + DBG_TRACE( DbgInfo, "Key 2 len: %d\n", lp->DefaultKeys.key[1].len ); + DBG_TRACE( DbgInfo, "Key 3 len: %d\n", lp->DefaultKeys.key[2].len ); + DBG_TRACE( DbgInfo, "Key 4 len: %d\n", lp->DefaultKeys.key[3].len ); + + /* write keys */ + lp->DefaultKeys.len = sizeof( lp->DefaultKeys ) / sizeof( hcf_16 ) - 1; + lp->DefaultKeys.typ = CFG_DEFAULT_KEYS; + + /* endian translate the appropriate key information */ + for( count = 0; count < MAX_KEYS; count++ ) { + lp->DefaultKeys.key[count].len = CNV_INT_TO_LITTLE( lp->DefaultKeys.key[count].len ); + } + + hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->DefaultKeys )); + + /* Reverse the above endian translation, since these keys are accessed + elsewhere */ + for( count = 0; count < MAX_KEYS; count++ ) { + lp->DefaultKeys.key[count].len = CNV_INT_TO_LITTLE( lp->DefaultKeys.key[count].len ); + } + + DBG_NOTICE( DbgInfo, "encrypt: %d, ID: %d\n", lp->EnableEncryption, lp->TransmitKeyID ); + DBG_NOTICE( DbgInfo, "set key: %s(%d) [%d]\n", lp->DefaultKeys.key[lp->TransmitKeyID-1].key, lp->DefaultKeys.key[lp->TransmitKeyID-1].len, lp->TransmitKeyID-1 ); + } + + DBG_LEAVE( DbgInfo ); +} // wl_set_wep_keys +/*============================================================================*/ + + +/******************************************************************************* + * wl_apply() + ******************************************************************************* + * + * DESCRIPTION: + * + * Write the parameters to the adapter. (re-)enables the card if device is + * open. Returns hcf_status of hcf_enable(). + * + * PARAMETERS: + * + * lp - a pointer to the wireless adapter's private structure + * + * RETURNS: + * + * an HCF status code + * + ******************************************************************************/ +int wl_apply(struct wl_private *lp) +{ + int hcf_status = HCF_SUCCESS; + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wl_apply" ); + DBG_ENTER( DbgInfo ); + DBG_ASSERT( lp != NULL); + DBG_PARAM( DbgInfo, "lp", "%s (0x%p)", lp->dev->name, lp ); + + if ( !( lp->flags & WVLAN2_UIL_BUSY )) { + /* The adapter parameters have changed: + disable card + reload parameters + enable card + */ + + if ( wl_adapter_is_open( lp->dev )) { + /* Disconnect and disable if necessary */ + hcf_status = wl_disconnect( lp ); + if ( hcf_status != HCF_SUCCESS ) { + DBG_ERROR( DbgInfo, "Disconnect failed\n" ); + DBG_LEAVE( DbgInfo ); + return -1; + } + hcf_status = wl_disable( lp ); + if ( hcf_status != HCF_SUCCESS ) { + DBG_ERROR( DbgInfo, "Disable failed\n" ); + DBG_LEAVE( DbgInfo ); + return -1; + } else { + /* Write out configuration to the device, enable, and reconnect. + However, only reconnect if in AP mode. For STA mode, need to + wait for passive scan completion before a connect can be + issued */ + hcf_status = wl_put_ltv( lp ); + + if ( hcf_status == HCF_SUCCESS ) { + hcf_status = wl_enable( lp ); + + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) { + hcf_status = wl_connect( lp ); + } + } else { + DBG_WARNING( DbgInfo, "wl_put_ltv() failed\n" ); + } + } + } + } + + DBG_LEAVE( DbgInfo ); + return hcf_status; +} // wl_apply +/*============================================================================*/ + + +/******************************************************************************* + * wl_put_ltv_init() + ******************************************************************************* + * + * DESCRIPTION: + * + * Used to set basic parameters for card initialization. + * + * PARAMETERS: + * + * lp - a pointer to the wireless adapter's private structure + * + * RETURNS: + * + * an HCF status code + * + ******************************************************************************/ +int wl_put_ltv_init( struct wl_private *lp ) +{ + int i; + int hcf_status; + CFG_RID_LOG_STRCT *RidLog; + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wl_put_ltv_init" ); + DBG_ENTER( DbgInfo ); + if ( lp == NULL ) { + DBG_ERROR( DbgInfo, "lp pointer is NULL\n" ); + DBG_LEAVE( DbgInfo ); + return -1; + } + /* DMA/IO */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNTL_OPT; + + /* The Card Services build must ALWAYS configure for 16-bit I/O. PCI or + CardBus can be set to either 16/32 bit I/O, or Bus Master DMA, but only + for Hermes-2.5 */ +#ifdef BUS_PCMCIA + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( USE_16BIT ); +#else + if ( lp->use_dma ) { + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( USE_DMA ); + } else { + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 0 ); + } + +#endif + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + DBG_TRACE( DbgInfo, "CFG_CNTL_OPT : 0x%04x\n", + lp->ltvRecord.u.u16[0] ); + DBG_TRACE( DbgInfo, "CFG_CNTL_OPT result : 0x%04x\n", + hcf_status ); + + /* Register the list of RIDs on which asynchronous notification is + required. Note that this mechanism replaces the mailbox, so the mailbox + can be queried by the host (if desired) without contention from us */ + i=0; + + lp->RidList[i].len = sizeof( lp->ProbeResp ); + lp->RidList[i].typ = CFG_ACS_SCAN; + lp->RidList[i].bufp = (wci_recordp)&lp->ProbeResp; + //lp->ProbeResp.infoType = 0xFFFF; + i++; + + lp->RidList[i].len = sizeof( lp->assoc_stat ); + lp->RidList[i].typ = CFG_ASSOC_STAT; + lp->RidList[i].bufp = (wci_recordp)&lp->assoc_stat; + lp->assoc_stat.len = 0xFFFF; + i++; + + lp->RidList[i].len = 4; + lp->RidList[i].typ = CFG_UPDATED_INFO_RECORD; + lp->RidList[i].bufp = (wci_recordp)&lp->updatedRecord; + lp->updatedRecord.len = 0xFFFF; + i++; + + lp->RidList[i].len = sizeof( lp->sec_stat ); + lp->RidList[i].typ = CFG_SECURITY_STAT; + lp->RidList[i].bufp = (wci_recordp)&lp->sec_stat; + lp->sec_stat.len = 0xFFFF; + i++; + + lp->RidList[i].typ = 0; // Terminate List + + RidLog = (CFG_RID_LOG_STRCT *)&lp->ltvRecord; + RidLog->len = 3; + RidLog->typ = CFG_REG_INFO_LOG; + RidLog->recordp = (RID_LOGP)&lp->RidList[0]; + + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + DBG_TRACE( DbgInfo, "CFG_REG_INFO_LOG\n" ); + DBG_TRACE( DbgInfo, "CFG_REG_INFO_LOG result : 0x%04x\n", + hcf_status ); + DBG_LEAVE( DbgInfo ); + return hcf_status; +} // wl_put_ltv_init +/*============================================================================*/ + + +/******************************************************************************* + * wl_put_ltv() + ******************************************************************************* + * + * DESCRIPTION: + * + * Used by wvlan_apply() and wvlan_go to set the card's configuration. + * + * PARAMETERS: + * + * lp - a pointer to the wireless adapter's private structure + * + * RETURNS: + * + * an HCF status code + * + ******************************************************************************/ +int wl_put_ltv( struct wl_private *lp ) +{ + int len; + int hcf_status; + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wl_put_ltv" ); + DBG_ENTER( DbgInfo ); + + if ( lp == NULL ) { + DBG_ERROR( DbgInfo, "lp pointer is NULL\n" ); + return -1; + } + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) { + lp->maxPort = 6; //;?why set this here and not as part of download process + } else { + lp->maxPort = 0; + } + + /* Send our configuration to the card. Perform any endian translation + necessary */ + /* Register the Mailbox; VxWorks does this elsewhere; why;? */ + lp->ltvRecord.len = 4; + lp->ltvRecord.typ = CFG_REG_MB; + lp->ltvRecord.u.u32[0] = (u_long)&( lp->mailbox ); + lp->ltvRecord.u.u16[2] = ( MB_SIZE / sizeof( hcf_16 )); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Max Data Length */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_MAX_DATA_LEN; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( HCF_MAX_PACKET_SIZE ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* System Scale / Distance between APs */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_SYSTEM_SCALE; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->DistanceBetweenAPs ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Channel */ + if ( lp->CreateIBSS && ( lp->Channel == 0 )) { + DBG_TRACE( DbgInfo, "Create IBSS" ); + lp->Channel = 10; + } + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_OWN_CHANNEL; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->Channel ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Microwave Robustness */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_MICRO_WAVE; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->MicrowaveRobustness ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Load Balancing */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_LOAD_BALANCING; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->loadBalancing ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Medium Distribution */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_MEDIUM_DISTRIBUTION; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->mediumDistribution ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + /* Country Code */ + +#ifdef WARP + /* Tx Power Level (for supported cards) */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_TX_POW_LVL; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->txPowLevel ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Short Retry Limit */ + /*lp->ltvRecord.len = 2; + lp->ltvRecord.typ = 0xFC32; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->shortRetryLimit ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + */ + + /* Long Retry Limit */ + /*lp->ltvRecord.len = 2; + lp->ltvRecord.typ = 0xFC33; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->longRetryLimit ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + */ + + /* Supported Rate Set Control */ + lp->ltvRecord.len = 3; + lp->ltvRecord.typ = CFG_SUPPORTED_RATE_SET_CNTL; //0xFC88; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->srsc[0] ); + lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->srsc[1] ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Basic Rate Set Control */ + lp->ltvRecord.len = 3; + lp->ltvRecord.typ = CFG_BASIC_RATE_SET_CNTL; //0xFC89; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->brsc[0] ); + lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->brsc[1] ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Frame Burst Limit */ + /* Defined, but not currently available in Firmware */ + +#endif // WARP + +#ifdef WARP + /* Multicast Rate */ + lp->ltvRecord.len = 3; + lp->ltvRecord.typ = CFG_CNF_MCAST_RATE; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->MulticastRate[0] ); + lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->MulticastRate[1] ); +#else + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_MCAST_RATE; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->MulticastRate[0] ); +#endif // WARP + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Own Name (Station Nickname) */ + if (( len = ( strlen( lp->StationName ) + 1 ) & ~0x01 ) != 0 ) { + //DBG_TRACE( DbgInfo, "CFG_CNF_OWN_NAME : %s\n", + // lp->StationName ); + + lp->ltvRecord.len = 2 + ( len / sizeof( hcf_16 )); + lp->ltvRecord.typ = CFG_CNF_OWN_NAME; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( strlen( lp->StationName )); + + memcpy( &( lp->ltvRecord.u.u8[2] ), lp->StationName, len ); + } else { + //DBG_TRACE( DbgInfo, "CFG_CNF_OWN_NAME : EMPTY\n" ); + + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_OWN_NAME; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 0 ); + } + + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + //DBG_TRACE( DbgInfo, "CFG_CNF_OWN_NAME result : 0x%04x\n", + // hcf_status ); + + /* The following are set in STA mode only */ + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_STA ) { + + /* RTS Threshold */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_RTS_THRH; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->RTSThreshold ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Port Type */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_PORT_TYPE; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->PortType ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Tx Rate Control */ +#ifdef WARP + lp->ltvRecord.len = 3; + lp->ltvRecord.typ = CFG_TX_RATE_CNTL; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->TxRateControl[0] ); + lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->TxRateControl[1] ); +#else + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_TX_RATE_CNTL; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->TxRateControl[0] ); +#endif // WARP + +//;?skip temporarily to see whether the RID or something else is the probelm hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + DBG_TRACE( DbgInfo, "CFG_TX_RATE_CNTL 2.4GHz : 0x%04x\n", + lp->TxRateControl[0] ); + DBG_TRACE( DbgInfo, "CFG_TX_RATE_CNTL 5.0GHz : 0x%04x\n", + lp->TxRateControl[1] ); + DBG_TRACE( DbgInfo, "CFG_TX_RATE_CNTL result : 0x%04x\n", + hcf_status ); + /* Power Management */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_PM_ENABLED; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->PMEnabled ); +// lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 0x8001 ); + DBG_TRACE( DbgInfo, "CFG_CNF_PM_ENABLED : 0x%04x\n", lp->PMEnabled ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + /* Multicast Receive */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_MCAST_RX; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->MulticastReceive ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Max Sleep Duration */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_MAX_SLEEP_DURATION; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->MaxSleepDuration ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Create IBSS */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CREATE_IBSS; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->CreateIBSS ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Desired SSID */ + if ((( len = ( strlen( lp->NetworkName ) + 1 ) & ~0x01 ) != 0 ) && + ( strcmp( lp->NetworkName, "ANY" ) != 0 ) && + ( strcmp( lp->NetworkName, "any" ) != 0 )) { + //DBG_TRACE( DbgInfo, "CFG_DESIRED_SSID : %s\n", + // lp->NetworkName ); + + lp->ltvRecord.len = 2 + (len / sizeof(hcf_16)); + lp->ltvRecord.typ = CFG_DESIRED_SSID; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( strlen( lp->NetworkName )); + + memcpy( &( lp->ltvRecord.u.u8[2] ), lp->NetworkName, len ); + } else { + //DBG_TRACE( DbgInfo, "CFG_DESIRED_SSID : ANY\n" ); + + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_DESIRED_SSID; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 0 ); + } + + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + //DBG_TRACE( DbgInfo, "CFG_DESIRED_SSID result : 0x%04x\n", + // hcf_status ); + /* Own ATIM window */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_OWN_ATIM_WINDOW; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->atimWindow ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + + /* Holdover Duration */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_HOLDOVER_DURATION; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->holdoverDuration ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Promiscuous Mode */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_PROMISCUOUS_MODE; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->promiscuousMode ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Authentication */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_AUTHENTICATION; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->authentication ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); +#ifdef WARP + /* Connection Control */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_CONNECTION_CNTL; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->connectionControl ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + + + /* Probe data rate */ + /*lp->ltvRecord.len = 3; + lp->ltvRecord.typ = CFG_PROBE_DATA_RATE; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->probeDataRates[0] ); + lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->probeDataRates[1] ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + DBG_TRACE( DbgInfo, "CFG_PROBE_DATA_RATE 2.4GHz : 0x%04x\n", + lp->probeDataRates[0] ); + DBG_TRACE( DbgInfo, "CFG_PROBE_DATA_RATE 5.0GHz : 0x%04x\n", + lp->probeDataRates[1] ); + DBG_TRACE( DbgInfo, "CFG_PROBE_DATA_RATE result : 0x%04x\n", + hcf_status );*/ +#endif // WARP + } else { + /* The following are set in AP mode only */ +#if 0 //;? (HCF_TYPE) & HCF_TYPE_AP + //;?should we restore this to allow smaller memory footprint + + /* DTIM Period */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_OWN_DTIM_PERIOD; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->DTIMPeriod ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Multicast PM Buffering */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_MCAST_PM_BUF; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->multicastPMBuffering ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Reject ANY - Closed System */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_REJECT_ANY; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->RejectAny ); + + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Exclude Unencrypted */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_EXCL_UNENCRYPTED; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->ExcludeUnencrypted ); + + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* IntraBSS Relay */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_INTRA_BSS_RELAY; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->intraBSSRelay ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* RTS Threshold 0 */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_RTS_THRH0; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->RTSThreshold ); + + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Tx Rate Control 0 */ +#ifdef WARP + lp->ltvRecord.len = 3; + lp->ltvRecord.typ = CFG_TX_RATE_CNTL0; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->TxRateControl[0] ); + lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->TxRateControl[1] ); +#else + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_TX_RATE_CNTL0; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->TxRateControl[0] ); +#endif // WARP + + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Own Beacon Interval */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = 0xFC31; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->ownBeaconInterval ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Co-Existence Behavior */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = 0xFCC7; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->coexistence ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + +#ifdef USE_WDS + + /* RTS Threshold 1 */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_RTS_THRH1; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[0].rtsThreshold ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* RTS Threshold 2 */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_RTS_THRH2; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[1].rtsThreshold ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + + /* RTS Threshold 3 */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_RTS_THRH3; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[2].rtsThreshold ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + + /* RTS Threshold 4 */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_RTS_THRH4; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[3].rtsThreshold ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + + /* RTS Threshold 5 */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_RTS_THRH5; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[4].rtsThreshold ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* RTS Threshold 6 */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_RTS_THRH6; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[5].rtsThreshold ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); +#if 0 + /* TX Rate Control 1 */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_TX_RATE_CNTL1; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[0].txRateCntl ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* TX Rate Control 2 */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_TX_RATE_CNTL2; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[1].txRateCntl ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* TX Rate Control 3 */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_TX_RATE_CNTL3; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[2].txRateCntl ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* TX Rate Control 4 */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_TX_RATE_CNTL4; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[3].txRateCntl ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* TX Rate Control 5 */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_TX_RATE_CNTL5; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[4].txRateCntl ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* TX Rate Control 6 */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_TX_RATE_CNTL6; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[5].txRateCntl ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + +#endif + + /* WDS addresses. It's okay to blindly send these parameters, because + the port needs to be enabled, before anything is done with it. */ + + /* WDS Address 1 */ + lp->ltvRecord.len = 4; + lp->ltvRecord.typ = CFG_CNF_WDS_ADDR1; + + memcpy( &lp->ltvRecord.u.u8[0], lp->wds_port[0].wdsAddress, ETH_ALEN ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* WDS Address 2 */ + lp->ltvRecord.len = 4; + lp->ltvRecord.typ = CFG_CNF_WDS_ADDR2; + + memcpy( &lp->ltvRecord.u.u8[0], lp->wds_port[1].wdsAddress, ETH_ALEN ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* WDS Address 3 */ + lp->ltvRecord.len = 4; + lp->ltvRecord.typ = CFG_CNF_WDS_ADDR3; + + memcpy( &lp->ltvRecord.u.u8[0], lp->wds_port[2].wdsAddress, ETH_ALEN ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* WDS Address 4 */ + lp->ltvRecord.len = 4; + lp->ltvRecord.typ = CFG_CNF_WDS_ADDR4; + + memcpy( &lp->ltvRecord.u.u8[0], lp->wds_port[3].wdsAddress, ETH_ALEN ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* WDS Address 5 */ + lp->ltvRecord.len = 4; + lp->ltvRecord.typ = CFG_CNF_WDS_ADDR5; + + memcpy( &lp->ltvRecord.u.u8[0], lp->wds_port[4].wdsAddress, ETH_ALEN ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* WDS Address 6 */ + lp->ltvRecord.len = 4; + lp->ltvRecord.typ = CFG_CNF_WDS_ADDR6; + + memcpy( &lp->ltvRecord.u.u8[0], lp->wds_port[5].wdsAddress, ETH_ALEN ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); +#endif /* USE_WDS */ +#endif /* (HCF_TYPE) & HCF_TYPE_AP */ + } + + /* Own MAC Address */ + //DBG_TRACE( DbgInfo, "MAC Address : %s\n", + // DbgHwAddr( lp->MACAddress )); + + if ( WVLAN_VALID_MAC_ADDRESS( lp->MACAddress )) { + /* Make the MAC address valid by: + Clearing the multicast bit + Setting the local MAC address bit + */ + //lp->MACAddress[0] &= ~0x03; //;?why is this commented out already in 720 + //lp->MACAddress[0] |= 0x02; + + lp->ltvRecord.len = 1 + ( ETH_ALEN / sizeof( hcf_16 )); + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) { + //DBG_TRACE( DbgInfo, "CFG_NIC_MAC_ADDR\n" ); + lp->ltvRecord.typ = CFG_NIC_MAC_ADDR; + } else { + //DBG_TRACE( DbgInfo, "CFG_CNF_OWN_MAC_ADDR\n" ); + lp->ltvRecord.typ = CFG_CNF_OWN_MAC_ADDR; + } + /* MAC address is byte aligned, no endian conversion needed */ + memcpy( &( lp->ltvRecord.u.u8[0] ), lp->MACAddress, ETH_ALEN ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + //DBG_TRACE( DbgInfo, "CFG_XXX_MAC_ADDR result : 0x%04x\n", + // hcf_status ); + + /* Update the MAC address in the netdevice struct */ + memcpy( lp->dev->dev_addr, lp->MACAddress, ETH_ALEN ); //;?what is the purpose of this seemingly complex logic + } + /* Own SSID */ + if ((( len = ( strlen( lp->NetworkName ) + 1 ) & ~0x01 ) != 0 ) && + ( strcmp( lp->NetworkName, "ANY" ) != 0 ) && + ( strcmp( lp->NetworkName, "any" ) != 0 )) { + //DBG_TRACE( DbgInfo, "CFG_CNF_OWN_SSID : %s\n", + // lp->NetworkName ); + lp->ltvRecord.len = 2 + (len / sizeof(hcf_16)); + lp->ltvRecord.typ = CFG_CNF_OWN_SSID; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( strlen( lp->NetworkName )); + + memcpy( &( lp->ltvRecord.u.u8[2] ), lp->NetworkName, len ); + } else { + //DBG_TRACE( DbgInfo, "CFG_CNF_OWN_SSID : ANY\n" ); + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_OWN_SSID; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 0 ); + } + + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + //DBG_TRACE( DbgInfo, "CFG_CNF_OWN_SSID result : 0x%04x\n", + // hcf_status ); + /* enable/disable encryption */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_ENCRYPTION; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->EnableEncryption ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + /* Set the Authentication Key Management Suite */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_SET_WPA_AUTH_KEY_MGMT_SUITE; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->AuthKeyMgmtSuite ); + hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + /* WEP Keys */ + wl_set_wep_keys( lp ); + + /* Country Code */ + /* countryInfo, ltvCountryInfo, CFG_CNF_COUNTRY_INFO */ + + DBG_LEAVE( DbgInfo ); + return hcf_status; +} // wl_put_ltv +/*============================================================================*/ + + +/******************************************************************************* + * init_module() + ******************************************************************************* + * + * DESCRIPTION: + * + * Load the kernel module. + * + * PARAMETERS: + * + * N/A + * + * RETURNS: + * + * 0 on success + * an errno value otherwise + * + ******************************************************************************/ +static int __init wl_module_init( void ) +{ + int result; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_module_init" ); + +#if DBG + /* Convert "standard" PCMCIA parameter pc_debug to a reasonable DebugFlag value. + * NOTE: The values all fall through to the lower values. */ + DbgInfo->DebugFlag = 0; + DbgInfo->DebugFlag = DBG_TRACE_ON; //;?get this mess resolved one day + if ( pc_debug ) switch( pc_debug ) { + case 8: + DbgInfo->DebugFlag |= DBG_DS_ON; + case 7: + DbgInfo->DebugFlag |= DBG_RX_ON | DBG_TX_ON; + case 6: + DbgInfo->DebugFlag |= DBG_PARAM_ON; + case 5: + DbgInfo->DebugFlag |= DBG_TRACE_ON; + case 4: + DbgInfo->DebugFlag |= DBG_VERBOSE_ON; + case 1: + DbgInfo->DebugFlag |= DBG_DEFAULTS; + default: + break; + } +#endif /* DBG */ + + DBG_ENTER( DbgInfo ); + printk(KERN_INFO "%s\n", VERSION_INFO); + printk(KERN_INFO "*** Modified for kernel 2.6 by Henk de Groot \n"); + printk(KERN_INFO "*** Based on 7.18 version by Andrey Borzenkov $Revision: 39 $\n"); + + +// ;?#if (HCF_TYPE) & HCF_TYPE_AP +// DBG_PRINT( "Access Point Mode (AP) Support: YES\n" ); +// #else +// DBG_PRINT( "Access Point Mode (AP) Support: NO\n" ); +// #endif /* (HCF_TYPE) & HCF_TYPE_AP */ + + result = wl_adapter_init_module( ); + DBG_LEAVE( DbgInfo ); + return result; +} // init_module +/*============================================================================*/ + + +/******************************************************************************* + * cleanup_module() + ******************************************************************************* + * + * DESCRIPTION: + * + * Unload the kernel module. + * + * PARAMETERS: + * + * N/A + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +static void __exit wl_module_exit( void ) +{ + DBG_FUNC( "wl_module_exit" ); + DBG_ENTER(DbgInfo); + + wl_adapter_cleanup_module( ); +#if 0 //SCULL_USE_PROC /* don't waste space if unused */ + remove_proc_entry( "wlags", NULL ); //;?why so a-symmetric compared to location of create_proc_read_entry +#endif + + DBG_LEAVE( DbgInfo ); + return; +} // cleanup_module +/*============================================================================*/ + +module_init(wl_module_init); +module_exit(wl_module_exit); + +/******************************************************************************* + * wl_isr() + ******************************************************************************* + * + * DESCRIPTION: + * + * The Interrupt Service Routine for the driver. + * + * PARAMETERS: + * + * irq - the irq the interrupt came in on + * dev_id - a buffer containing information about the request + * regs - + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +irqreturn_t wl_isr( int irq, void *dev_id, struct pt_regs *regs ) +{ + int events; + struct net_device *dev = (struct net_device *) dev_id; + struct wl_private *lp = NULL; + /*------------------------------------------------------------------------*/ + if (( dev == NULL ) || ( !netif_device_present( dev ))) { + return IRQ_NONE; + } + + /* Set the wl_private pointer (lp), now that we know that dev is non-null */ + lp = wl_priv(dev); + +#ifdef USE_RTS + if ( lp->useRTS == 1 ) { + DBG_PRINT( "EXITING ISR, IN RTS MODE...\n" ); + return; + } +#endif /* USE_RTS */ + + /* If we have interrupts pending, then put them on a system task + queue. Otherwise turn interrupts back on */ + events = hcf_action( &lp->hcfCtx, HCF_ACT_INT_OFF ); + + if ( events == HCF_INT_PENDING ) { + /* Schedule the ISR handler as a bottom-half task in the + tq_immediate queue */ + tasklet_schedule(&lp->task); + } else { + //DBG_PRINT( "NOT OUR INTERRUPT\n" ); + hcf_action( &lp->hcfCtx, HCF_ACT_INT_ON ); + } + + return IRQ_RETVAL(events == HCF_INT_PENDING); +} // wl_isr +/*============================================================================*/ + + +/******************************************************************************* + * wl_isr_handler() + ******************************************************************************* + * + * DESCRIPTION: + * + * The ISR handler, scheduled to run in a deferred context by the ISR. This + * is where the ISR's work actually gets done. + * + * PARAMETERS: + * + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +#define WVLAN_MAX_INT_SERVICES 50 + +void wl_isr_handler( unsigned long p ) +{ + struct net_device *dev; + unsigned long flags; + bool_t stop = TRUE; + int count; + int result; + struct wl_private *lp = (struct wl_private *)p; + /*------------------------------------------------------------------------*/ + + if ( lp == NULL ) { + DBG_PRINT( "wl_isr_handler lp adapter pointer is NULL!!!\n" ); + } else { + wl_lock( lp, &flags ); + + dev = (struct net_device *)lp->dev; + if ( dev != NULL && netif_device_present( dev ) ) stop = FALSE; + for( count = 0; stop == FALSE && count < WVLAN_MAX_INT_SERVICES; count++ ) { + stop = TRUE; + result = hcf_service_nic( &lp->hcfCtx, + (wci_bufp)lp->lookAheadBuf, + sizeof( lp->lookAheadBuf )); + if ( result == HCF_ERR_MIC ) { + wl_wext_event_mic_failed( dev ); /* Send an event that MIC failed */ + //;?this seems wrong if HCF_ERR_MIC coincides with another event, stop gets FALSE + //so why not do it always ;? + } + +#ifndef USE_MBOX_SYNC + if ( lp->hcfCtx.IFB_MBInfoLen != 0 ) { /* anything in the mailbox */ + wl_mbx( lp ); + stop = FALSE; + } +#endif + /* Check for a Link status event */ + if ( ( lp->hcfCtx.IFB_LinkStat & CFG_LINK_STAT_FW ) != 0 ) { + wl_process_link_status( lp ); + stop = FALSE; + } + /* Check for probe response events */ + if ( lp->ProbeResp.infoType != 0 && + lp->ProbeResp.infoType != 0xFFFF ) { + wl_process_probe_response( lp ); + memset( &lp->ProbeResp, 0, sizeof( lp->ProbeResp )); + lp->ProbeResp.infoType = 0xFFFF; + stop = FALSE; + } + /* Check for updated record events */ + if ( lp->updatedRecord.len != 0xFFFF ) { + wl_process_updated_record( lp ); + lp->updatedRecord.len = 0xFFFF; + stop = FALSE; + } + /* Check for association status events */ + if ( lp->assoc_stat.len != 0xFFFF ) { + wl_process_assoc_status( lp ); + lp->assoc_stat.len = 0xFFFF; + stop = FALSE; + } + /* Check for security status events */ + if ( lp->sec_stat.len != 0xFFFF ) { + wl_process_security_status( lp ); + lp->sec_stat.len = 0xFFFF; + stop = FALSE; + } + +#ifdef ENABLE_DMA + if ( lp->use_dma ) { + /* Check for DMA Rx packets */ + if ( lp->hcfCtx.IFB_DmaPackets & HREG_EV_RDMAD ) { + wl_rx_dma( dev ); + stop = FALSE; + } + /* Return Tx DMA descriptors to host */ + if ( lp->hcfCtx.IFB_DmaPackets & HREG_EV_TDMAD ) { + wl_pci_dma_hcf_reclaim_tx( lp ); + stop = FALSE; + } + } + else +#endif // ENABLE_DMA + { + /* Check for Rx packets */ + if ( lp->hcfCtx.IFB_RxLen != 0 ) { + wl_rx( dev ); + stop = FALSE; + } + /* Make sure that queued frames get sent */ + if ( wl_send( lp )) { + stop = FALSE; + } + } + } + /* We're done, so turn interrupts which were turned off in wl_isr, back on */ + hcf_action( &lp->hcfCtx, HCF_ACT_INT_ON ); + wl_unlock( lp, &flags ); + } + return; +} // wl_isr_handler +/*============================================================================*/ + + +/******************************************************************************* + * wl_remove() + ******************************************************************************* + * + * DESCRIPTION: + * + * Notify the adapter that it has been removed. Since the adapter is gone, + * we should no longer try to talk to it. + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_remove( struct net_device *dev ) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wl_remove" ); + DBG_ENTER( DbgInfo ); + + DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev ); + + wl_lock( lp, &flags ); + + /* stop handling interrupts */ + wl_act_int_off( lp ); + lp->is_handling_int = WL_NOT_HANDLING_INT; + + /* + * Disable the ports: just change state: since the + * card is gone it is useless to talk to it and at + * disconnect all state information is lost anyway. + */ + /* Reset portState */ + lp->portState = WVLAN_PORT_STATE_DISABLED; + +#if 0 //;? (HCF_TYPE) & HCF_TYPE_AP +#ifdef USE_WDS + //wl_disable_wds_ports( lp ); +#endif // USE_WDS +#endif /* (HCF_TYPE) & HCF_TYPE_AP */ + + /* Mark the device as unregistered */ + lp->is_registered = FALSE; + + /* Deregister the WDS ports as well */ + WL_WDS_NETDEV_DEREGISTER( lp ); +#ifdef USE_RTS + if ( lp->useRTS == 1 ) { + wl_unlock( lp, &flags ); + + DBG_LEAVE( DbgInfo ); + return; + } +#endif /* USE_RTS */ + + /* Inform the HCF that the card has been removed */ + hcf_connect( &lp->hcfCtx, HCF_DISCONNECT ); + + wl_unlock( lp, &flags ); + + DBG_LEAVE( DbgInfo ); + return; +} // wl_remove +/*============================================================================*/ + + +/******************************************************************************* + * wl_suspend() + ******************************************************************************* + * + * DESCRIPTION: + * + * Power-down and halt the adapter. + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_suspend( struct net_device *dev ) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wl_suspend" ); + DBG_ENTER( DbgInfo ); + + DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev ); + + /* The adapter is suspended: + Stop the adapter + Power down + */ + wl_lock( lp, &flags ); + + /* Disable interrupt handling */ + wl_act_int_off( lp ); + + /* Disconnect */ + wl_disconnect( lp ); + + /* Disable */ + wl_disable( lp ); + + /* Disconnect from the adapter */ + hcf_connect( &lp->hcfCtx, HCF_DISCONNECT ); + + /* Reset portState to be sure (should have been done by wl_disable */ + lp->portState = WVLAN_PORT_STATE_DISABLED; + + wl_unlock( lp, &flags ); + + DBG_LEAVE( DbgInfo ); + return; +} // wl_suspend +/*============================================================================*/ + + +/******************************************************************************* + * wl_resume() + ******************************************************************************* + * + * DESCRIPTION: + * + * Resume a previously suspended adapter. + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_resume(struct net_device *dev) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wl_resume" ); + DBG_ENTER( DbgInfo ); + + DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev ); + + wl_lock( lp, &flags ); + + /* Connect to the adapter */ + hcf_connect( &lp->hcfCtx, dev->base_addr ); + + /* Reset portState */ + lp->portState = WVLAN_PORT_STATE_DISABLED; + + /* Power might have been off, assume the card lost the firmware*/ + lp->firmware_present = WL_FRIMWARE_NOT_PRESENT; + + /* Reload the firmware and restart */ + wl_reset( dev ); + + /* Resume interrupt handling */ + wl_act_int_on( lp ); + + wl_unlock( lp, &flags ); + + DBG_LEAVE( DbgInfo ); + return; +} // wl_resume +/*============================================================================*/ + + +/******************************************************************************* + * wl_release() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function perfroms a check on the device and calls wl_remove() if + * necessary. This function can be used for all bus types, but exists mostly + * for the benefit of the Card Services driver, as there are times when + * wl_remove() does not get called. + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_release( struct net_device *dev ) +{ + struct wl_private *lp = wl_priv(dev); + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wl_release" ); + DBG_ENTER( DbgInfo ); + + DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev ); + /* If wl_remove() hasn't been called (i.e. when Card Services is shut + down with the card in the slot), then call it */ + if ( lp->is_registered == TRUE ) { + DBG_TRACE( DbgInfo, "Calling unregister_netdev(), as it wasn't called yet\n" ); + wl_remove( dev ); + + lp->is_registered = FALSE; + } + + DBG_LEAVE( DbgInfo ); + return; +} // wl_release +/*============================================================================*/ + + +/******************************************************************************* + * wl_get_irq_mask() + ******************************************************************************* + * + * DESCRIPTION: + * + * Accessor function to retrieve the irq_mask module parameter + * + * PARAMETERS: + * + * N/A + * + * RETURNS: + * + * The irq_mask module parameter + * + ******************************************************************************/ +p_u16 wl_get_irq_mask( void ) +{ + return irq_mask; +} // wl_get_irq_mask +/*============================================================================*/ + + +/******************************************************************************* + * wl_get_irq_list() + ******************************************************************************* + * + * DESCRIPTION: + * + * Accessor function to retrieve the irq_list module parameter + * + * PARAMETERS: + * + * N/A + * + * RETURNS: + * + * The irq_list module parameter + * + ******************************************************************************/ +p_s8 * wl_get_irq_list( void ) +{ + return irq_list; +} // wl_get_irq_list +/*============================================================================*/ + + + +/******************************************************************************* + * wl_enable() + ******************************************************************************* + * + * DESCRIPTION: + * + * Used to enable MAC ports + * + * PARAMETERS: + * + * lp - pointer to the device's private adapter structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +int wl_enable( struct wl_private *lp ) +{ + int hcf_status = HCF_SUCCESS; + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wl_enable" ); + DBG_ENTER( DbgInfo ); + + if ( lp->portState == WVLAN_PORT_STATE_ENABLED ) { + DBG_TRACE( DbgInfo, "No action: Card already enabled\n" ); + } else if ( lp->portState == WVLAN_PORT_STATE_CONNECTED ) { + //;?suspicuous logic, how can you be connected without being enabled so this is probably dead code + DBG_TRACE( DbgInfo, "No action: Card already connected\n" ); + } else { + hcf_status = hcf_cntl( &lp->hcfCtx, HCF_CNTL_ENABLE ); + if ( hcf_status == HCF_SUCCESS ) { + /* Set the status of the NIC to enabled */ + lp->portState = WVLAN_PORT_STATE_ENABLED; //;?bad mnemonic, NIC iso PORT +#ifdef ENABLE_DMA + if ( lp->use_dma ) { + wl_pci_dma_hcf_supply( lp ); //;?always succes? + } +#endif + } + } + if ( hcf_status != HCF_SUCCESS ) { //;?make this an assert + DBG_TRACE( DbgInfo, "failed: 0x%x\n", hcf_status ); + } + DBG_LEAVE( DbgInfo ); + return hcf_status; +} // wl_enable +/*============================================================================*/ + + +#ifdef USE_WDS +/******************************************************************************* + * wl_enable_wds_ports() + ******************************************************************************* + * + * DESCRIPTION: + * + * Used to enable the WDS MAC ports 1-6 + * + * PARAMETERS: + * + * lp - pointer to the device's private adapter structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_enable_wds_ports( struct wl_private * lp ) +{ + + DBG_FUNC( "wl_enable_wds_ports" ); + DBG_ENTER( DbgInfo ); + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ){ + DBG_ERROR( DbgInfo, "!!!!;? someone misunderstood something !!!!!\n" ); + } + DBG_LEAVE( DbgInfo ); + return; +} // wl_enable_wds_ports +#endif /* USE_WDS */ +/*============================================================================*/ + + +/******************************************************************************* + * wl_connect() + ******************************************************************************* + * + * DESCRIPTION: + * + * Used to connect a MAC port + * + * PARAMETERS: + * + * lp - pointer to the device's private adapter structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +int wl_connect( struct wl_private *lp ) +{ + int hcf_status; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_connect" ); + DBG_ENTER( DbgInfo ); + + if ( lp->portState != WVLAN_PORT_STATE_ENABLED ) { + DBG_TRACE( DbgInfo, "No action: Not in enabled state\n" ); + DBG_LEAVE( DbgInfo ); + return HCF_SUCCESS; + } + hcf_status = hcf_cntl( &lp->hcfCtx, HCF_CNTL_CONNECT ); + if ( hcf_status == HCF_SUCCESS ) { + lp->portState = WVLAN_PORT_STATE_CONNECTED; + } + DBG_LEAVE( DbgInfo ); + return hcf_status; +} // wl_connect +/*============================================================================*/ + + +/******************************************************************************* + * wl_disconnect() + ******************************************************************************* + * + * DESCRIPTION: + * + * Used to disconnect a MAC port + * + * PARAMETERS: + * + * lp - pointer to the device's private adapter structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +int wl_disconnect( struct wl_private *lp ) +{ + int hcf_status; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_disconnect" ); + DBG_ENTER( DbgInfo ); + + if ( lp->portState != WVLAN_PORT_STATE_CONNECTED ) { + DBG_TRACE( DbgInfo, "No action: Not in connected state\n" ); + DBG_LEAVE( DbgInfo ); + return HCF_SUCCESS; + } + hcf_status = hcf_cntl( &lp->hcfCtx, HCF_CNTL_DISCONNECT ); + if ( hcf_status == HCF_SUCCESS ) { + lp->portState = WVLAN_PORT_STATE_ENABLED; + } + DBG_LEAVE( DbgInfo ); + return hcf_status; +} // wl_disconnect +/*============================================================================*/ + + +/******************************************************************************* + * wl_disable() + ******************************************************************************* + * + * DESCRIPTION: + * + * Used to disable MAC ports + * + * PARAMETERS: + * + * lp - pointer to the device's private adapter structure + * port - the MAC port to disable + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +int wl_disable( struct wl_private *lp ) +{ + int hcf_status = HCF_SUCCESS; + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wl_disable" ); + DBG_ENTER( DbgInfo ); + + if ( lp->portState == WVLAN_PORT_STATE_DISABLED ) { + DBG_TRACE( DbgInfo, "No action: Port state is disabled\n" ); + } else { + hcf_status = hcf_cntl( &lp->hcfCtx, HCF_CNTL_DISABLE ); + if ( hcf_status == HCF_SUCCESS ) { + /* Set the status of the port to disabled */ //;?bad mnemonic use NIC iso PORT + lp->portState = WVLAN_PORT_STATE_DISABLED; + +#ifdef ENABLE_DMA + if ( lp->use_dma ) { + wl_pci_dma_hcf_reclaim( lp ); + } +#endif + } + } + if ( hcf_status != HCF_SUCCESS ) { + DBG_TRACE( DbgInfo, "failed: 0x%x\n", hcf_status ); + } + DBG_LEAVE( DbgInfo ); + return hcf_status; +} // wl_disable +/*============================================================================*/ + + +#ifdef USE_WDS +/******************************************************************************* + * wl_disable_wds_ports() + ******************************************************************************* + * + * DESCRIPTION: + * + * Used to disable the WDS MAC ports 1-6 + * + * PARAMETERS: + * + * lp - pointer to the device's private adapter structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_disable_wds_ports( struct wl_private * lp ) +{ + + DBG_FUNC( "wl_disable_wds_ports" ); + DBG_ENTER( DbgInfo ); + + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ){ + DBG_ERROR( DbgInfo, "!!!!;? someone misunderstood something !!!!!\n" ); + } +// if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) { +// wl_disable( lp, HCF_PORT_1 ); +// wl_disable( lp, HCF_PORT_2 ); +// wl_disable( lp, HCF_PORT_3 ); +// wl_disable( lp, HCF_PORT_4 ); +// wl_disable( lp, HCF_PORT_5 ); +// wl_disable( lp, HCF_PORT_6 ); +// } + DBG_LEAVE( DbgInfo ); + return; +} // wl_disable_wds_ports +#endif // USE_WDS +/*============================================================================*/ + + +#ifndef USE_MBOX_SYNC +/******************************************************************************* + * wl_mbx() + ******************************************************************************* + * + * DESCRIPTION: + * This function is used to read and process a mailbox message. + * + * + * PARAMETERS: + * + * lp - pointer to the device's private adapter structure + * + * RETURNS: + * + * an HCF status code + * + ******************************************************************************/ +int wl_mbx( struct wl_private *lp ) +{ + int hcf_status = HCF_SUCCESS; + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wl_mbx" ); + DBG_ENTER( DbgInfo ); + DBG_TRACE( DbgInfo, "Mailbox Info: IFB_MBInfoLen: %d\n", + lp->hcfCtx.IFB_MBInfoLen ); + + memset( &( lp->ltvRecord ), 0, sizeof( ltv_t )); + + lp->ltvRecord.len = MB_SIZE; + lp->ltvRecord.typ = CFG_MB_INFO; + hcf_status = hcf_get_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord )); + + if ( hcf_status != HCF_SUCCESS ) { + DBG_ERROR( DbgInfo, "hcf_get_info returned 0x%x\n", hcf_status ); + + DBG_LEAVE( DbgInfo ); + return hcf_status; + } + + if ( lp->ltvRecord.typ == CFG_MB_INFO ) { + DBG_LEAVE( DbgInfo ); + return hcf_status; + } + /* Endian translate the mailbox data, then process the message */ + wl_endian_translate_mailbox( &( lp->ltvRecord )); + wl_process_mailbox( lp ); + DBG_LEAVE( DbgInfo ); + return hcf_status; +} // wl_mbx +/*============================================================================*/ + + +/******************************************************************************* + * wl_endian_translate_mailbox() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function will perform the tedious task of endian translating all + * fields withtin a mailbox message which need translating. + * + * PARAMETERS: + * + * ltv - pointer to the LTV to endian translate + * + * RETURNS: + * + * none + * + ******************************************************************************/ +void wl_endian_translate_mailbox( ltv_t *ltv ) +{ + + DBG_FUNC( "wl_endian_translate_mailbox" ); + DBG_ENTER( DbgInfo ); + switch( ltv->typ ) { + case CFG_TALLIES: + break; + + case CFG_SCAN: + { + int num_aps; + SCAN_RS_STRCT *aps = (SCAN_RS_STRCT *)<v->u.u8[0]; + + num_aps = (hcf_16)(( (size_t)(ltv->len - 1 ) * 2 ) / + ( sizeof( SCAN_RS_STRCT ))); + + while( num_aps >= 1 ) { + num_aps--; + + aps[num_aps].channel_id = + CNV_LITTLE_TO_INT( aps[num_aps].channel_id ); + + aps[num_aps].noise_level = + CNV_LITTLE_TO_INT( aps[num_aps].noise_level ); + + aps[num_aps].signal_level = + CNV_LITTLE_TO_INT( aps[num_aps].signal_level ); + + aps[num_aps].beacon_interval_time = + CNV_LITTLE_TO_INT( aps[num_aps].beacon_interval_time ); + + aps[num_aps].capability = + CNV_LITTLE_TO_INT( aps[num_aps].capability ); + + aps[num_aps].ssid_len = + CNV_LITTLE_TO_INT( aps[num_aps].ssid_len ); + + aps[num_aps].ssid_val[aps[num_aps].ssid_len] = 0; + } + } + break; + + case CFG_ACS_SCAN: + { + PROBE_RESP *probe_resp = (PROBE_RESP *)ltv; + + probe_resp->frameControl = CNV_LITTLE_TO_INT( probe_resp->frameControl ); + probe_resp->durID = CNV_LITTLE_TO_INT( probe_resp->durID ); + probe_resp->sequence = CNV_LITTLE_TO_INT( probe_resp->sequence ); + probe_resp->dataLength = CNV_LITTLE_TO_INT( probe_resp->dataLength ); +#ifndef WARP + probe_resp->lenType = CNV_LITTLE_TO_INT( probe_resp->lenType ); +#endif // WARP + probe_resp->beaconInterval = CNV_LITTLE_TO_INT( probe_resp->beaconInterval ); + probe_resp->capability = CNV_LITTLE_TO_INT( probe_resp->capability ); + probe_resp->flags = CNV_LITTLE_TO_INT( probe_resp->flags ); + } + break; + + case CFG_LINK_STAT: +#define ls ((LINK_STATUS_STRCT *)ltv) + ls->linkStatus = CNV_LITTLE_TO_INT( ls->linkStatus ); + break; +#undef ls + + case CFG_ASSOC_STAT: + { + ASSOC_STATUS_STRCT *as = (ASSOC_STATUS_STRCT *)ltv; + + as->assocStatus = CNV_LITTLE_TO_INT( as->assocStatus ); + } + break; + + case CFG_SECURITY_STAT: + { + SECURITY_STATUS_STRCT *ss = (SECURITY_STATUS_STRCT *)ltv; + + ss->securityStatus = CNV_LITTLE_TO_INT( ss->securityStatus ); + ss->reason = CNV_LITTLE_TO_INT( ss->reason ); + } + break; + + case CFG_WMP: + break; + + case CFG_NULL: + break; + + default: + break; + } + + DBG_LEAVE( DbgInfo ); + return; +} // wl_endian_translate_mailbox +/*============================================================================*/ + +/******************************************************************************* + * wl_process_mailbox() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function will process the mailbox data. + * + * PARAMETERS: + * + * ltv - pointer to the LTV to be processed. + * + * RETURNS: + * + * none + * + ******************************************************************************/ +void wl_process_mailbox( struct wl_private *lp ) +{ + ltv_t *ltv; + hcf_16 ltv_val = 0xFFFF; + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wl_process_mailbox" ); + DBG_ENTER( DbgInfo ); + ltv = &( lp->ltvRecord ); + + switch( ltv->typ ) { + + case CFG_TALLIES: + DBG_TRACE( DbgInfo, "CFG_TALLIES\n" ); + break; + case CFG_SCAN: + DBG_TRACE( DbgInfo, "CFG_SCAN\n" ); + + { + int num_aps; + SCAN_RS_STRCT *aps = (SCAN_RS_STRCT *)<v->u.u8[0]; + + num_aps = (hcf_16)(( (size_t)(ltv->len - 1 ) * 2 ) / + ( sizeof( SCAN_RS_STRCT ))); + + lp->scan_results.num_aps = num_aps; + + DBG_TRACE( DbgInfo, "Number of APs: %d\n", num_aps ); + + while( num_aps >= 1 ) { + num_aps--; + + DBG_TRACE( DbgInfo, "AP : %d\n", num_aps ); + DBG_TRACE( DbgInfo, "=========================\n" ); + DBG_TRACE( DbgInfo, "Channel ID : 0x%04x\n", + aps[num_aps].channel_id ); + DBG_TRACE( DbgInfo, "Noise Level : 0x%04x\n", + aps[num_aps].noise_level ); + DBG_TRACE( DbgInfo, "Signal Level : 0x%04x\n", + aps[num_aps].signal_level ); + DBG_TRACE( DbgInfo, "Beacon Interval : 0x%04x\n", + aps[num_aps].beacon_interval_time ); + DBG_TRACE( DbgInfo, "Capability : 0x%04x\n", + aps[num_aps].capability ); + DBG_TRACE( DbgInfo, "SSID Length : 0x%04x\n", + aps[num_aps].ssid_len ); + DBG_TRACE( DbgInfo, "BSSID : %s\n", + DbgHwAddr( aps[num_aps].bssid )); + + if ( aps[num_aps].ssid_len != 0 ) { + DBG_TRACE( DbgInfo, "SSID : %s.\n", + aps[num_aps].ssid_val ); + } else { + DBG_TRACE( DbgInfo, "SSID : %s.\n", "ANY" ); + } + + DBG_TRACE( DbgInfo, "\n" ); + + /* Copy the info to the ScanResult structure in the private + adapter struct */ + memcpy( &( lp->scan_results.APTable[num_aps]), &( aps[num_aps] ), + sizeof( SCAN_RS_STRCT )); + } + + /* Set scan result to true so that any scan requests will + complete */ + lp->scan_results.scan_complete = TRUE; + } + + break; + case CFG_ACS_SCAN: + DBG_TRACE( DbgInfo, "CFG_ACS_SCAN\n" ); + + { + PROBE_RESP *probe_rsp = (PROBE_RESP *)ltv; + hcf_8 *wpa_ie = NULL; + hcf_16 wpa_ie_len = 0; + + DBG_TRACE( DbgInfo, "(%s) =========================\n", + lp->dev->name ); + + DBG_TRACE( DbgInfo, "(%s) length : 0x%04x.\n", + lp->dev->name, probe_rsp->length ); + + if ( probe_rsp->length > 1 ) { + DBG_TRACE( DbgInfo, "(%s) infoType : 0x%04x.\n", + lp->dev->name, probe_rsp->infoType ); + + DBG_TRACE( DbgInfo, "(%s) signal : 0x%02x.\n", + lp->dev->name, probe_rsp->signal ); + + DBG_TRACE( DbgInfo, "(%s) silence : 0x%02x.\n", + lp->dev->name, probe_rsp->silence ); + + DBG_TRACE( DbgInfo, "(%s) rxFlow : 0x%02x.\n", + lp->dev->name, probe_rsp->rxFlow ); + + DBG_TRACE( DbgInfo, "(%s) rate : 0x%02x.\n", + lp->dev->name, probe_rsp->rate ); + + DBG_TRACE( DbgInfo, "(%s) frame cntl : 0x%04x.\n", + lp->dev->name, probe_rsp->frameControl ); + + DBG_TRACE( DbgInfo, "(%s) durID : 0x%04x.\n", + lp->dev->name, probe_rsp->durID ); + + DBG_TRACE( DbgInfo, "(%s) address1 : %s\n", + lp->dev->name, DbgHwAddr( probe_rsp->address1 )); + + DBG_TRACE( DbgInfo, "(%s) address2 : %s\n", + lp->dev->name, DbgHwAddr( probe_rsp->address2 )); + + DBG_TRACE( DbgInfo, "(%s) BSSID : %s\n", + lp->dev->name, DbgHwAddr( probe_rsp->BSSID )); + + DBG_TRACE( DbgInfo, "(%s) sequence : 0x%04x.\n", + lp->dev->name, probe_rsp->sequence ); + + DBG_TRACE( DbgInfo, "(%s) address4 : %s\n", + lp->dev->name, DbgHwAddr( probe_rsp->address4 )); + + DBG_TRACE( DbgInfo, "(%s) datalength : 0x%04x.\n", + lp->dev->name, probe_rsp->dataLength ); + + DBG_TRACE( DbgInfo, "(%s) DA : %s\n", + lp->dev->name, DbgHwAddr( probe_rsp->DA )); + + DBG_TRACE( DbgInfo, "(%s) SA : %s\n", + lp->dev->name, DbgHwAddr( probe_rsp->SA )); + + //DBG_TRACE( DbgInfo, "(%s) lenType : 0x%04x.\n", + // lp->dev->name, probe_rsp->lenType ); + + DBG_TRACE( DbgInfo, "(%s) timeStamp : %s\n", + lp->dev->name, DbgHwAddr( probe_rsp->timeStamp )); + + DBG_TRACE( DbgInfo, "(%s) beaconInt : 0x%04x.\n", + lp->dev->name, probe_rsp->beaconInterval ); + + DBG_TRACE( DbgInfo, "(%s) capability : 0x%04x.\n", + lp->dev->name, probe_rsp->capability ); + + DBG_TRACE( DbgInfo, "(%s) SSID len : 0x%04x.\n", + lp->dev->name, probe_rsp->rawData[1] ); + + if ( probe_rsp->rawData[1] > 0 ) { + char ssid[HCF_MAX_NAME_LEN]; + + memset( ssid, 0, sizeof( ssid )); + strncpy( ssid, &probe_rsp->rawData[2], + probe_rsp->rawData[1] ); + + DBG_TRACE( DbgInfo, "(%s) SSID : %s\n", + lp->dev->name, ssid ); + } + + /* Parse out the WPA-IE, if one exists */ + wpa_ie = wl_parse_wpa_ie( probe_rsp, &wpa_ie_len ); + if ( wpa_ie != NULL ) { + DBG_TRACE( DbgInfo, "(%s) WPA-IE : %s\n", + lp->dev->name, wl_print_wpa_ie( wpa_ie, wpa_ie_len )); + } + + DBG_TRACE( DbgInfo, "(%s) flags : 0x%04x.\n", + lp->dev->name, probe_rsp->flags ); + } + + DBG_TRACE( DbgInfo, "\n\n" ); + /* If probe response length is 1, then the scan is complete */ + if ( probe_rsp->length == 1 ) { + DBG_TRACE( DbgInfo, "SCAN COMPLETE\n" ); + lp->probe_results.num_aps = lp->probe_num_aps; + lp->probe_results.scan_complete = TRUE; + + /* Reset the counter for the next scan request */ + lp->probe_num_aps = 0; + + /* Send a wireless extensions event that the scan completed */ + wl_wext_event_scan_complete( lp->dev ); + } else { + /* Only copy to the table if the entry is unique; APs sometimes + respond more than once to a probe */ + if ( lp->probe_num_aps == 0 ) { + /* Copy the info to the ScanResult structure in the private + adapter struct */ + memcpy( &( lp->probe_results.ProbeTable[lp->probe_num_aps] ), + probe_rsp, sizeof( PROBE_RESP )); + + /* Increment the number of APs detected */ + lp->probe_num_aps++; + } else { + int count; + int unique = 1; + + for( count = 0; count < lp->probe_num_aps; count++ ) { + if ( memcmp( &( probe_rsp->BSSID ), + lp->probe_results.ProbeTable[count].BSSID, + ETH_ALEN ) == 0 ) { + unique = 0; + } + } + + if ( unique ) { + /* Copy the info to the ScanResult structure in the + private adapter struct. Only copy if there's room in the + table */ + if ( lp->probe_num_aps < MAX_NAPS ) + { + memcpy( &( lp->probe_results.ProbeTable[lp->probe_num_aps] ), + probe_rsp, sizeof( PROBE_RESP )); + } + else + { + DBG_WARNING( DbgInfo, "Num of scan results exceeds storage, truncating\n" ); + } + + /* Increment the number of APs detected. Note I do this + here even when I don't copy the probe response to the + buffer in order to detect the overflow condition */ + lp->probe_num_aps++; + } + } + } + } + + break; + + case CFG_LINK_STAT: +#define ls ((LINK_STATUS_STRCT *)ltv) + DBG_TRACE( DbgInfo, "CFG_LINK_STAT\n" ); + + switch( ls->linkStatus ) { + case 1: + DBG_TRACE( DbgInfo, "Link Status : Connected\n" ); + wl_wext_event_ap( lp->dev ); + break; + + case 2: + DBG_TRACE( DbgInfo, "Link Status : Disconnected\n" ); + break; + + case 3: + DBG_TRACE( DbgInfo, "Link Status : Access Point Change\n" ); + break; + + case 4: + DBG_TRACE( DbgInfo, "Link Status : Access Point Out of Range\n" ); + break; + + case 5: + DBG_TRACE( DbgInfo, "Link Status : Access Point In Range\n" ); + break; + + default: + DBG_TRACE( DbgInfo, "Link Status : UNKNOWN (0x%04x)\n", + ls->linkStatus ); + break; + } + + break; +#undef ls + + case CFG_ASSOC_STAT: + DBG_TRACE( DbgInfo, "CFG_ASSOC_STAT\n" ); + + { + ASSOC_STATUS_STRCT *as = (ASSOC_STATUS_STRCT *)ltv; + + switch( as->assocStatus ) { + case 1: + DBG_TRACE( DbgInfo, "Association Status : STA Associated\n" ); + break; + + case 2: + DBG_TRACE( DbgInfo, "Association Status : STA Reassociated\n" ); + break; + + case 3: + DBG_TRACE( DbgInfo, "Association Status : STA Disassociated\n" ); + break; + + default: + DBG_TRACE( DbgInfo, "Association Status : UNKNOWN (0x%04x)\n", + as->assocStatus ); + break; + } + + DBG_TRACE( DbgInfo, "STA Address : %s\n", + DbgHwAddr( as->staAddr )); + + if (( as->assocStatus == 2 ) && ( as->len == 8 )) { + DBG_TRACE( DbgInfo, "Old AP Address : %s\n", + DbgHwAddr( as->oldApAddr )); + } + } + + break; + + case CFG_SECURITY_STAT: + DBG_TRACE( DbgInfo, "CFG_SECURITY_STAT\n" ); + + { + SECURITY_STATUS_STRCT *ss = (SECURITY_STATUS_STRCT *)ltv; + + switch( ss->securityStatus ) { + case 1: + DBG_TRACE( DbgInfo, "Security Status : Dissassociate [AP]\n" ); + break; + + case 2: + DBG_TRACE( DbgInfo, "Security Status : Deauthenticate [AP]\n" ); + break; + + case 3: + DBG_TRACE( DbgInfo, "Security Status : Authenticate Fail [STA] or [AP]\n" ); + break; + + case 4: + DBG_TRACE( DbgInfo, "Security Status : MIC Fail\n" ); + break; + + case 5: + DBG_TRACE( DbgInfo, "Security Status : Associate Fail\n" ); + break; + + default: + DBG_TRACE( DbgInfo, "Security Status : UNKNOWN %d\n", + ss->securityStatus ); + break; + } + + DBG_TRACE( DbgInfo, "STA Address : %s\n", DbgHwAddr( ss->staAddr )); + + DBG_TRACE( DbgInfo, "Reason : 0x%04x \n", ss->reason ); + } + + break; + + case CFG_WMP: + DBG_TRACE( DbgInfo, "CFG_WMP, size is %d bytes\n", ltv->len ); + { + WMP_RSP_STRCT *wmp_rsp = (WMP_RSP_STRCT *)ltv; + + DBG_TRACE( DbgInfo, "CFG_WMP, pdu type is 0x%x\n", + wmp_rsp->wmpRsp.wmpHdr.type ); + + switch( wmp_rsp->wmpRsp.wmpHdr.type ) { + case WVLAN_WMP_PDU_TYPE_LT_RSP: + { +#if DBG + LINKTEST_RSP_STRCT *lt_rsp = (LINKTEST_RSP_STRCT *)ltv; +#endif // DBG + DBG_TRACE( DbgInfo, "LINK TEST RESULT\n" ); + DBG_TRACE( DbgInfo, "================\n" ); + DBG_TRACE( DbgInfo, "Length : %d.\n", lt_rsp->len ); + + DBG_TRACE( DbgInfo, "Name : %s.\n", lt_rsp->ltRsp.ltRsp.name ); + DBG_TRACE( DbgInfo, "Signal Level : 0x%02x.\n", lt_rsp->ltRsp.ltRsp.signal ); + DBG_TRACE( DbgInfo, "Noise Level : 0x%02x.\n", lt_rsp->ltRsp.ltRsp.noise ); + DBG_TRACE( DbgInfo, "Receive Flow : 0x%02x.\n", lt_rsp->ltRsp.ltRsp.rxFlow ); + DBG_TRACE( DbgInfo, "Data Rate : 0x%02x.\n", lt_rsp->ltRsp.ltRsp.dataRate ); + DBG_TRACE( DbgInfo, "Protocol : 0x%04x.\n", lt_rsp->ltRsp.ltRsp.protocol ); + DBG_TRACE( DbgInfo, "Station : 0x%02x.\n", lt_rsp->ltRsp.ltRsp.station ); + DBG_TRACE( DbgInfo, "Data Rate Cap : 0x%02x.\n", lt_rsp->ltRsp.ltRsp.dataRateCap ); + + DBG_TRACE( DbgInfo, "Power Mgmt : 0x%02x 0x%02x 0x%02x 0x%02x.\n", + lt_rsp->ltRsp.ltRsp.powerMgmt[0], + lt_rsp->ltRsp.ltRsp.powerMgmt[1], + lt_rsp->ltRsp.ltRsp.powerMgmt[2], + lt_rsp->ltRsp.ltRsp.powerMgmt[3] ); + + DBG_TRACE( DbgInfo, "Robustness : 0x%02x 0x%02x 0x%02x 0x%02x.\n", + lt_rsp->ltRsp.ltRsp.robustness[0], + lt_rsp->ltRsp.ltRsp.robustness[1], + lt_rsp->ltRsp.ltRsp.robustness[2], + lt_rsp->ltRsp.ltRsp.robustness[3] ); + + DBG_TRACE( DbgInfo, "Scaling : 0x%02x.\n", lt_rsp->ltRsp.ltRsp.scaling ); + } + + break; + + default: + break; + } + } + + break; + + case CFG_NULL: + DBG_TRACE( DbgInfo, "CFG_NULL\n" ); + break; + + case CFG_UPDATED_INFO_RECORD: // Updated Information Record + DBG_TRACE( DbgInfo, "UPDATED INFORMATION RECORD\n" ); + + ltv_val = CNV_INT_TO_LITTLE( ltv->u.u16[0] ); + + /* Check and see which RID was updated */ + switch( ltv_val ) { + case CFG_CUR_COUNTRY_INFO: // Indicate Passive Scan Completion + DBG_TRACE( DbgInfo, "Updated country info\n" ); + + /* Do I need to hold off on updating RIDs until the process is + complete? */ + wl_connect( lp ); + break; + + case CFG_PORT_STAT: // Wait for Connect Event + //wl_connect( lp ); + + break; + + default: + DBG_WARNING( DbgInfo, "Unknown RID: 0x%04x\n", ltv_val ); + } + + break; + + default: + DBG_TRACE( DbgInfo, "UNKNOWN MESSAGE: 0x%04x\n", ltv->typ ); + break; + } + DBG_LEAVE( DbgInfo ); + return; +} // wl_process_mailbox +/*============================================================================*/ +#endif /* ifndef USE_MBOX_SYNC */ + +#ifdef USE_WDS +/******************************************************************************* + * wl_wds_netdev_register() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function registers net_device structures with the system's network + * layer for use with the WDS ports. + * + * + * PARAMETERS: + * + * lp - pointer to the device's private adapter structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_wds_netdev_register( struct wl_private *lp ) +{ + int count; + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wl_wds_netdev_register" ); + DBG_ENTER( DbgInfo ); + //;?why is there no USE_WDS clause like in wl_enable_wds_ports + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) { + for( count = 0; count < NUM_WDS_PORTS; count++ ) { + if ( WVLAN_VALID_MAC_ADDRESS( lp->wds_port[count].wdsAddress )) { + if ( register_netdev( lp->wds_port[count].dev ) != 0 ) { + DBG_WARNING( DbgInfo, "net device for WDS port %d could not be registered\n", + ( count + 1 )); + } + lp->wds_port[count].is_registered = TRUE; + + /* Fill out the net_device structs with the MAC addr */ + memcpy( lp->wds_port[count].dev->dev_addr, lp->MACAddress, ETH_ALEN ); + lp->wds_port[count].dev->addr_len = ETH_ALEN; + } + } + } + DBG_LEAVE( DbgInfo ); + return; +} // wl_wds_netdev_register +/*============================================================================*/ + + +/******************************************************************************* + * wl_wds_netdev_deregister() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function deregisters the WDS net_device structures used by the + * system's network layer. + * + * + * PARAMETERS: + * + * lp - pointer to the device's private adapter structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_wds_netdev_deregister( struct wl_private *lp ) +{ + int count; + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wl_wds_netdev_deregister" ); + DBG_ENTER( DbgInfo ); + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) { + for( count = 0; count < NUM_WDS_PORTS; count++ ) { + if ( WVLAN_VALID_MAC_ADDRESS( lp->wds_port[count].wdsAddress )) { + unregister_netdev( lp->wds_port[count].dev ); + } + lp->wds_port[count].is_registered = FALSE; + } + } + DBG_LEAVE( DbgInfo ); + return; +} // wl_wds_netdev_deregister +/*============================================================================*/ +#endif /* USE_WDS */ + + +#if 0 //SCULL_USE_PROC /* don't waste space if unused */ +/* + * The proc filesystem: function to read and entry + */ +int printf_hcf_16( char *s, char *buf, hcf_16* p, int n ); +int printf_hcf_16( char *s, char *buf, hcf_16* p, int n ) { + +int i, len; + + len = sprintf(buf, "%s", s ); + while ( len < 20 ) len += sprintf(buf+len, " " ); + len += sprintf(buf+len,": " ); + for ( i = 0; i < n; i++ ) { + if ( len % 80 > 75 ) { + len += sprintf(buf+len,"\n" ); + } + len += sprintf(buf+len,"%04X ", p[i] ); + } + len += sprintf(buf+len,"\n" ); + return len; +} // printf_hcf_16 + +int printf_hcf_8( char *s, char *buf, hcf_8* p, int n ); +int printf_hcf_8( char *s, char *buf, hcf_8* p, int n ) { + +int i, len; + + len = sprintf(buf, "%s", s ); + while ( len < 20 ) len += sprintf(buf+len, " " ); + len += sprintf(buf+len,": " ); + for ( i = 0; i <= n; i++ ) { + if ( len % 80 > 77 ) { + len += sprintf(buf+len,"\n" ); + } + len += sprintf(buf+len,"%02X ", p[i] ); + } + len += sprintf(buf+len,"\n" ); + return len; +} // printf_hcf8 + +int printf_strct( char *s, char *buf, hcf_16* p ); +int printf_strct( char *s, char *buf, hcf_16* p ) { + +int i, len; + + len = sprintf(buf, "%s", s ); + while ( len < 20 ) len += sprintf(buf+len, " " ); + len += sprintf(buf+len,": " ); + for ( i = 0; i <= *p; i++ ) { + if ( len % 80 > 75 ) { + len += sprintf(buf+len,"\n" ); + } + len += sprintf(buf+len,"%04X ", p[i] ); + } + len += sprintf(buf+len,"\n" ); + return len; +} // printf_strct + +int scull_read_procmem(char *buf, char **start, off_t offset, int len, int *eof, void *data ) +{ + struct wl_private *lp = NULL; + IFBP ifbp; + CFG_HERMES_TALLIES_STRCT *p; + + #define LIMIT (PAGE_SIZE-80) /* don't print any more after this size */ + + len=0; + + if ( ( lp = ((struct net_device *)data)->priv ) == NULL ) { + len += sprintf(buf+len,"No wl_private in scull_read_procmem\n" ); + } else if ( lp->wlags49_type == 0 ){ + ifbp = &lp->hcfCtx; + len += sprintf(buf+len,"Magic: 0x%04X\n", ifbp->IFB_Magic ); + len += sprintf(buf+len,"IOBase: 0x%04X\n", ifbp->IFB_IOBase ); + len += sprintf(buf+len,"LinkStat: 0x%04X\n", ifbp->IFB_LinkStat ); + len += sprintf(buf+len,"DSLinkStat: 0x%04X\n", ifbp->IFB_DSLinkStat ); + len += sprintf(buf+len,"TickIni: 0x%08lX\n", ifbp->IFB_TickIni ); + len += sprintf(buf+len,"TickCnt: 0x%04X\n", ifbp->IFB_TickCnt ); + len += sprintf(buf+len,"IntOffCnt: 0x%04X\n", ifbp->IFB_IntOffCnt ); + len += printf_hcf_16( "IFB_FWIdentity", &buf[len], + &ifbp->IFB_FWIdentity.len, ifbp->IFB_FWIdentity.len + 1 ); + } else if ( lp->wlags49_type == 1 ) { + len += sprintf(buf+len,"Channel: 0x%04X\n", lp->Channel ); +/****** len += sprintf(buf+len,"slock: %d\n", lp->slock ); */ +//x struct tq_struct "task: 0x%04X\n", lp->task ); +//x struct net_device_stats "stats: 0x%04X\n", lp->stats ); +#ifdef WIRELESS_EXT +//x struct iw_statistics "wstats: 0x%04X\n", lp->wstats ); +//x len += sprintf(buf+len,"spy_number: 0x%04X\n", lp->spy_number ); +//x u_char spy_address[IW_MAX_SPY][ETH_ALEN]; +//x struct iw_quality spy_stat[IW_MAX_SPY]; +#endif // WIRELESS_EXT + len += sprintf(buf+len,"IFB: 0x%p\n", &lp->hcfCtx ); + len += sprintf(buf+len,"flags: %#.8lX\n", lp->flags ); //;?use this format from now on + len += sprintf(buf+len,"DebugFlag(wl_private) 0x%04X\n", lp->DebugFlag ); +#if DBG + len += sprintf(buf+len,"DebugFlag (DbgInfo): 0x%08lX\n", DbgInfo->DebugFlag ); +#endif // DBG + len += sprintf(buf+len,"is_registered: 0x%04X\n", lp->is_registered ); +//x CFG_DRV_INFO_STRCT "driverInfo: 0x%04X\n", lp->driverInfo ); + len += printf_strct( "driverInfo", &buf[len], (hcf_16*)&lp->driverInfo ); +//x CFG_IDENTITY_STRCT "driverIdentity: 0x%04X\n", lp->driverIdentity ); + len += printf_strct( "driverIdentity", &buf[len], (hcf_16*)&lp->driverIdentity ); +//x CFG_FW_IDENTITY_STRCT "StationIdentity: 0x%04X\n", lp->StationIdentity ); + len += printf_strct( "StationIdentity", &buf[len], (hcf_16*)&lp->StationIdentity ); +//x CFG_PRI_IDENTITY_STRCT "PrimaryIdentity: 0x%04X\n", lp->PrimaryIdentity ); + len += printf_strct( "PrimaryIdentity", &buf[len], (hcf_16*)&lp->hcfCtx.IFB_PRIIdentity ); + len += printf_strct( "PrimarySupplier", &buf[len], (hcf_16*)&lp->hcfCtx.IFB_PRISup ); +//x CFG_PRI_IDENTITY_STRCT "NICIdentity: 0x%04X\n", lp->NICIdentity ); + len += printf_strct( "NICIdentity", &buf[len], (hcf_16*)&lp->NICIdentity ); +//x ltv_t "ltvRecord: 0x%04X\n", lp->ltvRecord ); + len += sprintf(buf+len,"txBytes: 0x%08lX\n", lp->txBytes ); + len += sprintf(buf+len,"maxPort: 0x%04X\n", lp->maxPort ); /* 0 for STA, 6 for AP */ + /* Elements used for async notification from hardware */ +//x RID_LOG_STRCT RidList[10]; +//x ltv_t "updatedRecord: 0x%04X\n", lp->updatedRecord ); +//x PROBE_RESP "ProbeResp: 0x%04X\n", lp->ProbeResp ); +//x ASSOC_STATUS_STRCT "assoc_stat: 0x%04X\n", lp->assoc_stat ); +//x SECURITY_STATUS_STRCT "sec_stat: 0x%04X\n", lp->sec_stat ); +//x u_char lookAheadBuf[WVLAN_MAX_LOOKAHEAD]; + len += sprintf(buf+len,"PortType: 0x%04X\n", lp->PortType ); // 1 - 3 (1 [Normal] | 3 [AdHoc]) + len += sprintf(buf+len,"Channel: 0x%04X\n", lp->Channel ); // 0 - 14 (0) +//x hcf_16 TxRateControl[2]; + len += sprintf(buf+len,"TxRateControl[2]: 0x%04X 0x%04X\n", + lp->TxRateControl[0], lp->TxRateControl[1] ); + len += sprintf(buf+len,"DistanceBetweenAPs: 0x%04X\n", lp->DistanceBetweenAPs ); // 1 - 3 (1) + len += sprintf(buf+len,"RTSThreshold: 0x%04X\n", lp->RTSThreshold ); // 0 - 2347 (2347) + len += sprintf(buf+len,"PMEnabled: 0x%04X\n", lp->PMEnabled ); // 0 - 2, 8001 - 8002 (0) + len += sprintf(buf+len,"MicrowaveRobustness: 0x%04X\n", lp->MicrowaveRobustness );// 0 - 1 (0) + len += sprintf(buf+len,"CreateIBSS: 0x%04X\n", lp->CreateIBSS ); // 0 - 1 (0) + len += sprintf(buf+len,"MulticastReceive: 0x%04X\n", lp->MulticastReceive ); // 0 - 1 (1) + len += sprintf(buf+len,"MaxSleepDuration: 0x%04X\n", lp->MaxSleepDuration ); // 0 - 65535 (100) +//x hcf_8 MACAddress[ETH_ALEN]; + len += printf_hcf_8( "MACAddress", &buf[len], lp->MACAddress, ETH_ALEN ); +//x char NetworkName[HCF_MAX_NAME_LEN+1]; + len += sprintf(buf+len,"NetworkName: %.32s\n", lp->NetworkName ); +//x char StationName[HCF_MAX_NAME_LEN+1]; + len += sprintf(buf+len,"EnableEncryption: 0x%04X\n", lp->EnableEncryption ); // 0 - 1 (0) +//x char Key1[MAX_KEY_LEN+1]; + len += printf_hcf_8( "Key1", &buf[len], lp->Key1, MAX_KEY_LEN ); +//x char Key2[MAX_KEY_LEN+1]; +//x char Key3[MAX_KEY_LEN+1]; +//x char Key4[MAX_KEY_LEN+1]; + len += sprintf(buf+len,"TransmitKeyID: 0x%04X\n", lp->TransmitKeyID ); // 1 - 4 (1) +//x CFG_DEFAULT_KEYS_STRCT "DefaultKeys: 0x%04X\n", lp->DefaultKeys ); +//x u_char mailbox[MB_SIZE]; +//x char szEncryption[MAX_ENC_LEN]; + len += sprintf(buf+len,"driverEnable: 0x%04X\n", lp->driverEnable ); + len += sprintf(buf+len,"wolasEnable: 0x%04X\n", lp->wolasEnable ); + len += sprintf(buf+len,"atimWindow: 0x%04X\n", lp->atimWindow ); + len += sprintf(buf+len,"holdoverDuration: 0x%04X\n", lp->holdoverDuration ); +//x hcf_16 MulticastRate[2]; + len += sprintf(buf+len,"authentication: 0x%04X\n", lp->authentication ); // is this AP specific? + len += sprintf(buf+len,"promiscuousMode: 0x%04X\n", lp->promiscuousMode ); + len += sprintf(buf+len,"DownloadFirmware: 0x%04X\n", lp->DownloadFirmware ); // 0 - 2 (0 [None] | 1 [STA] | 2 [AP]) + len += sprintf(buf+len,"AuthKeyMgmtSuite: 0x%04X\n", lp->AuthKeyMgmtSuite ); + len += sprintf(buf+len,"loadBalancing: 0x%04X\n", lp->loadBalancing ); + len += sprintf(buf+len,"mediumDistribution: 0x%04X\n", lp->mediumDistribution ); + len += sprintf(buf+len,"txPowLevel: 0x%04X\n", lp->txPowLevel ); +// len += sprintf(buf+len,"shortRetryLimit: 0x%04X\n", lp->shortRetryLimit ); +// len += sprintf(buf+len,"longRetryLimit: 0x%04X\n", lp->longRetryLimit ); +//x hcf_16 srsc[2]; +//x hcf_16 brsc[2]; + len += sprintf(buf+len,"connectionControl: 0x%04X\n", lp->connectionControl ); +//x //hcf_16 probeDataRates[2]; + len += sprintf(buf+len,"ownBeaconInterval: 0x%04X\n", lp->ownBeaconInterval ); + len += sprintf(buf+len,"coexistence: 0x%04X\n", lp->coexistence ); +//x WVLAN_FRAME "txF: 0x%04X\n", lp->txF ); +//x WVLAN_LFRAME txList[DEFAULT_NUM_TX_FRAMES]; +//x struct list_head "txFree: 0x%04X\n", lp->txFree ); +//x struct list_head txQ[WVLAN_MAX_TX_QUEUES]; + len += sprintf(buf+len,"netif_queue_on: 0x%04X\n", lp->netif_queue_on ); + len += sprintf(buf+len,"txQ_count: 0x%04X\n", lp->txQ_count ); +//x DESC_STRCT "desc_rx: 0x%04X\n", lp->desc_rx ); +//x DESC_STRCT "desc_tx: 0x%04X\n", lp->desc_tx ); +//x WVLAN_PORT_STATE "portState: 0x%04X\n", lp->portState ); +//x ScanResult "scan_results: 0x%04X\n", lp->scan_results ); +//x ProbeResult "probe_results: 0x%04X\n", lp->probe_results ); + len += sprintf(buf+len,"probe_num_aps: 0x%04X\n", lp->probe_num_aps ); + len += sprintf(buf+len,"use_dma: 0x%04X\n", lp->use_dma ); +//x DMA_STRCT "dma: 0x%04X\n", lp->dma ); +#ifdef USE_RTS + len += sprintf(buf+len,"useRTS: 0x%04X\n", lp->useRTS ); +#endif // USE_RTS +#if 1 //;? (HCF_TYPE) & HCF_TYPE_AP + //;?should we restore this to allow smaller memory footprint + //;?I guess not. This should be brought under Debug mode only + len += sprintf(buf+len,"DTIMPeriod: 0x%04X\n", lp->DTIMPeriod ); // 1 - 255 (1) + len += sprintf(buf+len,"multicastPMBuffering: 0x%04X\n", lp->multicastPMBuffering ); + len += sprintf(buf+len,"RejectAny: 0x%04X\n", lp->RejectAny ); // 0 - 1 (0) + len += sprintf(buf+len,"ExcludeUnencrypted: 0x%04X\n", lp->ExcludeUnencrypted ); // 0 - 1 (1) + len += sprintf(buf+len,"intraBSSRelay: 0x%04X\n", lp->intraBSSRelay ); + len += sprintf(buf+len,"wlags49_type: 0x%08lX\n", lp->wlags49_type ); +#ifdef USE_WDS +//x WVLAN_WDS_IF wds_port[NUM_WDS_PORTS]; +#endif // USE_WDS +#endif // HCF_AP + } else if ( lp->wlags49_type == 2 ){ + len += sprintf(buf+len,"tallies to be added\n" ); +//Hermes Tallies (IFB substructure) { + p = &lp->hcfCtx.IFB_NIC_Tallies; + len += sprintf(buf+len,"TxUnicastFrames: %08lX\n", p->TxUnicastFrames ); + len += sprintf(buf+len,"TxMulticastFrames: %08lX\n", p->TxMulticastFrames ); + len += sprintf(buf+len,"TxFragments: %08lX\n", p->TxFragments ); + len += sprintf(buf+len,"TxUnicastOctets: %08lX\n", p->TxUnicastOctets ); + len += sprintf(buf+len,"TxMulticastOctets: %08lX\n", p->TxMulticastOctets ); + len += sprintf(buf+len,"TxDeferredTransmissions: %08lX\n", p->TxDeferredTransmissions ); + len += sprintf(buf+len,"TxSingleRetryFrames: %08lX\n", p->TxSingleRetryFrames ); + len += sprintf(buf+len,"TxMultipleRetryFrames: %08lX\n", p->TxMultipleRetryFrames ); + len += sprintf(buf+len,"TxRetryLimitExceeded: %08lX\n", p->TxRetryLimitExceeded ); + len += sprintf(buf+len,"TxDiscards: %08lX\n", p->TxDiscards ); + len += sprintf(buf+len,"RxUnicastFrames: %08lX\n", p->RxUnicastFrames ); + len += sprintf(buf+len,"RxMulticastFrames: %08lX\n", p->RxMulticastFrames ); + len += sprintf(buf+len,"RxFragments: %08lX\n", p->RxFragments ); + len += sprintf(buf+len,"RxUnicastOctets: %08lX\n", p->RxUnicastOctets ); + len += sprintf(buf+len,"RxMulticastOctets: %08lX\n", p->RxMulticastOctets ); + len += sprintf(buf+len,"RxFCSErrors: %08lX\n", p->RxFCSErrors ); + len += sprintf(buf+len,"RxDiscardsNoBuffer: %08lX\n", p->RxDiscardsNoBuffer ); + len += sprintf(buf+len,"TxDiscardsWrongSA: %08lX\n", p->TxDiscardsWrongSA ); + len += sprintf(buf+len,"RxWEPUndecryptable: %08lX\n", p->RxWEPUndecryptable ); + len += sprintf(buf+len,"RxMsgInMsgFragments: %08lX\n", p->RxMsgInMsgFragments ); + len += sprintf(buf+len,"RxMsgInBadMsgFragments: %08lX\n", p->RxMsgInBadMsgFragments ); + len += sprintf(buf+len,"RxDiscardsWEPICVError: %08lX\n", p->RxDiscardsWEPICVError ); + len += sprintf(buf+len,"RxDiscardsWEPExcluded: %08lX\n", p->RxDiscardsWEPExcluded ); +#if (HCF_EXT) & HCF_EXT_TALLIES_FW + //to be added ;? +#endif // HCF_EXT_TALLIES_FW + } else if ( lp->wlags49_type & 0x8000 ) { //;?kludgy but it is unclear to me were else to place this +#if DBG + DbgInfo->DebugFlag = lp->wlags49_type & 0x7FFF; +#endif // DBG + lp->wlags49_type = 0; //default to IFB again ;? + } else { + len += sprintf(buf+len,"unknown value for wlags49_type: 0x%08lX\n", lp->wlags49_type ); + len += sprintf(buf+len,"0x0000 - IFB\n" ); + len += sprintf(buf+len,"0x0001 - wl_private\n" ); + len += sprintf(buf+len,"0x0002 - Tallies\n" ); + len += sprintf(buf+len,"0x8xxx - Change debufflag\n" ); + len += sprintf(buf+len,"ERROR 0001\nWARNING 0002\nNOTICE 0004\nTRACE 0008\n" ); + len += sprintf(buf+len,"VERBOSE 0010\nPARAM 0020\nBREAK 0040\nRX 0100\n" ); + len += sprintf(buf+len,"TX 0200\nDS 0400\n" ); + } + return len; +} // scull_read_procmem + +static void proc_write(const char *name, write_proc_t *w, void *data) +{ + struct proc_dir_entry * entry = create_proc_entry(name, S_IFREG | S_IWUSR, NULL); + if (entry) { + entry->write_proc = w; + entry->data = data; + } +} // proc_write + +static int write_int(struct file *file, const char *buffer, unsigned long count, void *data) +{ + static char proc_number[11]; + unsigned int nr = 0; + + DBG_FUNC( "write_int" ); + DBG_ENTER( DbgInfo ); + + if (count > 9) { + count = -EINVAL; + } else if ( copy_from_user(proc_number, buffer, count) ) { + count = -EFAULT; + } + if (count > 0 ) { + proc_number[count] = 0; + nr = wl_atoi( proc_number ); + *(unsigned int *)data = nr; + if ( nr & 0x8000 ) { //;?kludgy but it is unclear to me were else to place this +#if DBG + DbgInfo->DebugFlag = nr & 0x7FFF; +#endif // DBG + } + } + DBG_PRINT( "value: %08X\n", nr ); + DBG_LEAVE( DbgInfo ); + return count; +} // write_int + +#endif /* SCULL_USE_PROC */ + +#ifdef DN554 +#define RUN_AT(x) (jiffies+(x)) //"borrowed" from include/pcmcia/k_compat.h +#define DS_OOR 0x8000 //Deepsleep OutOfRange Status + + lp->timer_oor_cnt = DS_OOR; + init_timer( &lp->timer_oor ); + lp->timer_oor.function = timer_oor; + lp->timer_oor.data = (unsigned long)lp; + lp->timer_oor.expires = RUN_AT( 3 * HZ ); + add_timer( &lp->timer_oor ); + printk( "<5>wl_enable: %ld\n", jiffies ); //;?remove me 1 day +#endif //DN554 +#ifdef DN554 +/******************************************************************************* + * timer_oor() + ******************************************************************************* + * + * DESCRIPTION: + * + * + * PARAMETERS: + * + * arg - a u_long representing a pointer to a dev_link_t structure for the + * device to be released. + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void timer_oor( u_long arg ) +{ + struct wl_private *lp = (struct wl_private *)arg; + + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "timer_oor" ); + DBG_ENTER( DbgInfo ); + DBG_PARAM( DbgInfo, "arg", "0x%08lx", arg ); + + printk( "<5>timer_oor: %ld 0x%04X\n", jiffies, lp->timer_oor_cnt ); //;?remove me 1 day + lp->timer_oor_cnt += 10; + if ( (lp->timer_oor_cnt & ~DS_OOR) > 300 ) { + lp->timer_oor_cnt = 300; + } + lp->timer_oor_cnt |= DS_OOR; + init_timer( &lp->timer_oor ); + lp->timer_oor.function = timer_oor; + lp->timer_oor.data = (unsigned long)lp; + lp->timer_oor.expires = RUN_AT( (lp->timer_oor_cnt & ~DS_OOR) * HZ ); + add_timer( &lp->timer_oor ); + + DBG_LEAVE( DbgInfo ); +} // timer_oor +#endif //DN554 + +MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/staging/wlags49_h2/wl_main.h b/drivers/staging/wlags49_h2/wl_main.h new file mode 100644 index 000000000000..e57e2cb074bc --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_main.h @@ -0,0 +1,155 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * Header describing device specific routines and driver init/un-init. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/07/23 04:51:21 $ + * $Revision: 1.4 $ + * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_main.h,v $ + * + ******************************************************************************/ + + + + +#ifndef __WL_MAIN_H__ +#define __WL_MAIN_H__ + + + + +/******************************************************************************* + * function prototypes + ******************************************************************************/ +int wl_insert( struct net_device *dev ); + +void wl_set_wep_keys( struct wl_private *lp ); + +int wl_put_ltv_init( struct wl_private *lp ); + +int wl_put_ltv( struct wl_private *lp ); + +p_u16 wl_get_irq_mask( void ); + +p_s8 * wl_get_irq_list( void ); + +int wl_reset( struct net_device *dev ); + +int wl_go( struct wl_private *lp ); + +int wl_apply( struct wl_private *lp ); + +irqreturn_t wl_isr( int irq, void *dev_id, struct pt_regs *regs ); + +void wl_remove( struct net_device *dev ); + +void wl_suspend( struct net_device *dev ); + +void wl_resume( struct net_device *dev ); + +void wl_release( struct net_device *dev ); + +int wl_enable( struct wl_private *lp ); + +int wl_connect( struct wl_private *lp ); + +int wl_disable( struct wl_private *lp ); + +int wl_disconnect( struct wl_private *lp ); + +void wl_enable_wds_ports( struct wl_private * lp ); + +void wl_disable_wds_ports( struct wl_private * lp ); + +#ifndef USE_MBOX_SYNC + +int wl_mbx( struct wl_private *lp ); +void wl_endian_translate_mailbox( ltv_t *ltv ); +void wl_process_mailbox( struct wl_private *lp ); + +#endif /* USE_MBOX_SYNC */ + + +#ifdef USE_WDS + +void wl_wds_netdev_register( struct wl_private *lp ); +void wl_wds_netdev_deregister( struct wl_private *lp ); + +#endif /* USE_WDS */ + + +#ifdef USE_WDS + +#define WL_WDS_NETDEV_REGISTER( ARG ) wl_wds_netdev_register( ARG ) +#define WL_WDS_NETDEV_DEREGISTER( ARG ) wl_wds_netdev_deregister( ARG ) + +#else + +#define WL_WDS_NETDEV_REGISTER( ARG ) +#define WL_WDS_NETDEV_DEREGISTER( ARG ) + +#endif /* USE_WDS */ +#endif // __WL_MAIN_H__ diff --git a/drivers/staging/wlags49_h2/wl_netdev.c b/drivers/staging/wlags49_h2/wl_netdev.c new file mode 100644 index 000000000000..a00207b17d2b --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_netdev.c @@ -0,0 +1,2085 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * This file contains handler functions registered with the net_device + * structure. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/08/03 13:33:44 $ + * $Revision: 1.8 $ + * $Source: /usr/local/cvs/wl_lkm/wireless/wl_netdev.c,v $ + * + ******************************************************************************/ + + + +/******************************************************************************* + * include files + ******************************************************************************/ +#include + +#include +#include +#include +// #include +// #include +// #include +// #include +// #include +//#include +// #include +// #include +// #include +// #include +// #include +// #include +// #include + +#include +#include +#include +// #include +// #include +// #include + +#include + +#include +#include +// #include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef USE_PROFILE +#include +#endif /* USE_PROFILE */ + +#ifdef BUS_PCMCIA +#include +#endif /* BUS_PCMCIA */ + +#ifdef BUS_PCI +#include +#endif /* BUS_PCI */ + + +/******************************************************************************* + * global variables + ******************************************************************************/ +#if DBG +extern dbg_info_t *DbgInfo; +#endif /* DBG */ + + +#if HCF_ENCAP +#define MTU_MAX (HCF_MAX_MSG - ETH_HLEN - 8) +#else +#define MTU_MAX (HCF_MAX_MSG - ETH_HLEN) +#endif + +//static int mtu = MTU_MAX; +//MODULE_PARM(mtu, "i"); +//MODULE_PARM_DESC(mtu, "MTU"); + +/******************************************************************************* + * macros + ******************************************************************************/ +#define BLOCK_INPUT(buf, len) \ + desc->buf_addr = buf; \ + desc->BUF_SIZE = len; \ + status = hcf_rcv_msg(&(lp->hcfCtx), desc, 0) + +#define BLOCK_INPUT_DMA(buf, len) memcpy( buf, desc_next->buf_addr, pktlen ) + +/******************************************************************************* + * function prototypes + ******************************************************************************/ + +/******************************************************************************* + * wl_init() + ******************************************************************************* + * + * DESCRIPTION: + * + * We never need to do anything when a "Wireless" device is "initialized" + * by the net software, because we only register already-found cards. + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wl_init( struct net_device *dev ) +{ +// unsigned long flags; +// struct wl_private *lp = wl_priv(dev); + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_init" ); + DBG_ENTER( DbgInfo ); + + DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev ); + + /* Nothing to do, but grab the spinlock anyway just in case we ever need + this routine */ +// wl_lock( lp, &flags ); +// wl_unlock( lp, &flags ); + + DBG_LEAVE( DbgInfo ); + return 0; +} // wl_init +/*============================================================================*/ + +/******************************************************************************* + * wl_config() + ******************************************************************************* + * + * DESCRIPTION: + * + * Implement the SIOCSIFMAP interface. + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device structure + * map - a pointer to the device's ifmap structure + * + * RETURNS: + * + * 0 on success + * errno otherwise + * + ******************************************************************************/ +int wl_config( struct net_device *dev, struct ifmap *map ) +{ + DBG_FUNC( "wl_config" ); + DBG_ENTER( DbgInfo ); + + DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev ); + DBG_PARAM( DbgInfo, "map", "0x%p", map ); + + /* The only thing we care about here is a port change. Since this not needed, + ignore the request. */ + DBG_TRACE( DbgInfo, "%s: %s called.\n", dev->name, __FUNC__ ); + + DBG_LEAVE( DbgInfo ); + return 0; +} // wl_config +/*============================================================================*/ + +/******************************************************************************* + * wl_stats() + ******************************************************************************* + * + * DESCRIPTION: + * + * Return the current device statistics. + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device structure + * + * RETURNS: + * + * a pointer to a net_device_stats structure containing the network + * statistics. + * + ******************************************************************************/ +struct net_device_stats *wl_stats( struct net_device *dev ) +{ +#ifdef USE_WDS + int count; +#endif /* USE_WDS */ + unsigned long flags; + struct net_device_stats *pStats; + struct wl_private *lp = wl_priv(dev); + /*------------------------------------------------------------------------*/ + + //DBG_FUNC( "wl_stats" ); + //DBG_ENTER( DbgInfo ); + //DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev ); + + pStats = NULL; + + wl_lock( lp, &flags ); + +#ifdef USE_RTS + if( lp->useRTS == 1 ) { + wl_unlock( lp, &flags ); + + //DBG_LEAVE( DbgInfo ); + return NULL; + } +#endif /* USE_RTS */ + + /* Return the statistics for the appropriate device */ +#ifdef USE_WDS + + for( count = 0; count < NUM_WDS_PORTS; count++ ) { + if( dev == lp->wds_port[count].dev ) { + pStats = &( lp->wds_port[count].stats ); + } + } + +#endif /* USE_WDS */ + + /* If pStats is still NULL, then the device is not a WDS port */ + if( pStats == NULL ) { + pStats = &( lp->stats ); + } + + wl_unlock( lp, &flags ); + + //DBG_LEAVE( DbgInfo ); + + return pStats; +} // wl_stats +/*============================================================================*/ + +/******************************************************************************* + * wl_open() + ******************************************************************************* + * + * DESCRIPTION: + * + * Open the device. + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device structure + * + * RETURNS: + * + * 0 on success + * errno otherwise + * + ******************************************************************************/ +int wl_open(struct net_device *dev) +{ + int status = HCF_SUCCESS; + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_open" ); + DBG_ENTER( DbgInfo ); + + wl_lock( lp, &flags ); + +#ifdef USE_RTS + if( lp->useRTS == 1 ) { + DBG_TRACE( DbgInfo, "Skipping device open, in RTS mode\n" ); + wl_unlock( lp, &flags ); + DBG_LEAVE( DbgInfo ); + return -EIO; + } +#endif /* USE_RTS */ + +#ifdef USE_PROFILE + parse_config( dev ); +#endif + + if( lp->portState == WVLAN_PORT_STATE_DISABLED ) { + DBG_TRACE( DbgInfo, "Enabling Port 0\n" ); + status = wl_enable( lp ); + + if( status != HCF_SUCCESS ) { + DBG_TRACE( DbgInfo, "Enable port 0 failed: 0x%x\n", status ); + } + } + + // Holding the lock too long, make a gap to allow other processes + wl_unlock(lp, &flags); + wl_lock( lp, &flags ); + + if ( strlen( lp->fw_image_filename ) ) { + DBG_TRACE( DbgInfo, ";???? Kludgy way to force a download\n" ); + status = wl_go( lp ); + } else { + status = wl_apply( lp ); + } + + // Holding the lock too long, make a gap to allow other processes + wl_unlock(lp, &flags); + wl_lock( lp, &flags ); + + if( status != HCF_SUCCESS ) { + // Unsuccesfull, try reset of the card to recover + status = wl_reset( dev ); + } + + // Holding the lock too long, make a gap to allow other processes + wl_unlock(lp, &flags); + wl_lock( lp, &flags ); + + if( status == HCF_SUCCESS ) { + netif_carrier_on( dev ); + WL_WDS_NETIF_CARRIER_ON( lp ); + + lp->is_handling_int = WL_HANDLING_INT; // Start handling interrupts + wl_act_int_on( lp ); + + netif_start_queue( dev ); + WL_WDS_NETIF_START_QUEUE( lp ); + } else { + wl_hcf_error( dev, status ); /* Report the error */ + netif_device_detach( dev ); /* Stop the device and queue */ + } + + wl_unlock( lp, &flags ); + + DBG_LEAVE( DbgInfo ); + return status; +} // wl_open +/*============================================================================*/ + +/******************************************************************************* + * wl_close() + ******************************************************************************* + * + * DESCRIPTION: + * + * Close the device. + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device structure + * + * RETURNS: + * + * 0 on success + * errno otherwise + * + ******************************************************************************/ +int wl_close( struct net_device *dev ) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + /*------------------------------------------------------------------------*/ + + DBG_FUNC("wl_close"); + DBG_ENTER(DbgInfo); + DBG_PARAM(DbgInfo, "dev", "%s (0x%p)", dev->name, dev); + + /* Mark the adapter as busy */ + netif_stop_queue( dev ); + WL_WDS_NETIF_STOP_QUEUE( lp ); + + netif_carrier_off( dev ); + WL_WDS_NETIF_CARRIER_OFF( lp ); + + /* Shutdown the adapter: + Disable adapter interrupts + Stop Tx/Rx + Update statistics + Set low power mode + */ + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + lp->is_handling_int = WL_NOT_HANDLING_INT; // Stop handling interrupts + +#ifdef USE_RTS + if( lp->useRTS == 1 ) { + DBG_TRACE( DbgInfo, "Skipping device close, in RTS mode\n" ); + wl_unlock( lp, &flags ); + DBG_LEAVE( DbgInfo ); + return -EIO; + } +#endif /* USE_RTS */ + + /* Disable the ports */ + wl_disable( lp ); + + wl_unlock( lp, &flags ); + + DBG_LEAVE( DbgInfo ); + return 0; +} // wl_close +/*============================================================================*/ + +static void wl_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) +{ + strncpy(info->driver, DRIVER_NAME, sizeof(info->driver) - 1); + strncpy(info->version, DRV_VERSION_STR, sizeof(info->version) - 1); +// strncpy(info.fw_version, priv->fw_name, +// sizeof(info.fw_version) - 1); + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)) + if (dev->dev.parent) { + dev_set_name(dev->dev.parent, "%s", info->bus_info); + //strncpy(info->bus_info, dev->dev.parent->bus_id, + // sizeof(info->bus_info) - 1); +#else + if (dev->class_dev.parent) { + sizeof(info->bus_info) - 1); +#endif + } else { + snprintf(info->bus_info, sizeof(info->bus_info) - 1, + "PCMCIA FIXME"); +// "PCMCIA 0x%lx", priv->hw.iobase); + } +} // wl_get_drvinfo + +static struct ethtool_ops wl_ethtool_ops = { + .get_drvinfo = wl_get_drvinfo, + .get_link = ethtool_op_get_link, +}; + + +/******************************************************************************* + * wl_ioctl() + ******************************************************************************* + * + * DESCRIPTION: + * + * The IOCTL handler for the device. + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device struct. + * rq - a pointer to the IOCTL request buffer. + * cmd - the IOCTL command code. + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wl_ioctl( struct net_device *dev, struct ifreq *rq, int cmd ) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_ioctl" ); + DBG_ENTER(DbgInfo); + DBG_PARAM(DbgInfo, "dev", "%s (0x%p)", dev->name, dev); + DBG_PARAM(DbgInfo, "rq", "0x%p", rq); + DBG_PARAM(DbgInfo, "cmd", "0x%04x", cmd); + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + +#ifdef USE_RTS + if( lp->useRTS == 1 ) { + /* Handle any RTS IOCTL here */ + if( cmd == WL_IOCTL_RTS ) { + DBG_TRACE( DbgInfo, "IOCTL: WL_IOCTL_RTS\n" ); + ret = wvlan_rts( (struct rtsreq *)rq, dev->base_addr ); + } else { + DBG_TRACE( DbgInfo, "IOCTL not supported in RTS mode: 0x%X\n", cmd ); + ret = -EOPNOTSUPP; + } + + goto out_act_int_on_unlock; + } +#endif /* USE_RTS */ + + /* Only handle UIL IOCTL requests when the UIL has the system blocked. */ + if( !(( lp->flags & WVLAN2_UIL_BUSY ) && ( cmd != WVLAN2_IOCTL_UIL ))) { +#ifdef USE_UIL + struct uilreq *urq = (struct uilreq *)rq; +#endif /* USE_UIL */ + + switch( cmd ) { + // ================== Private IOCTLs (up to 16) ================== +#ifdef USE_UIL + case WVLAN2_IOCTL_UIL: + DBG_TRACE( DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL\n" ); + ret = wvlan_uil( urq, lp ); + break; +#endif /* USE_UIL */ + + default: + DBG_TRACE(DbgInfo, "IOCTL CODE NOT SUPPORTED: 0x%X\n", cmd ); + ret = -EOPNOTSUPP; + break; + } + } else { + DBG_WARNING( DbgInfo, "DEVICE IS BUSY, CANNOT PROCESS REQUEST\n" ); + ret = -EBUSY; + } + +#ifdef USE_RTS +out_act_int_on_unlock: +#endif /* USE_RTS */ + wl_act_int_on( lp ); + + wl_unlock( lp, &flags ); + + DBG_LEAVE( DbgInfo ); + return ret; +} // wl_ioctl +/*============================================================================*/ + +#ifdef CONFIG_NET_POLL_CONTROLLER +void wl_poll(struct net_device *dev) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + struct pt_regs regs; + + wl_lock( lp, &flags ); + wl_isr(dev->irq, dev, ®s); + wl_unlock( lp, &flags ); +} +#endif + +/******************************************************************************* + * wl_tx_timeout() + ******************************************************************************* + * + * DESCRIPTION: + * + * The handler called when, for some reason, a Tx request is not completed. + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device struct. + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_tx_timeout( struct net_device *dev ) +{ +#ifdef USE_WDS + int count; +#endif /* USE_WDS */ + unsigned long flags; + struct wl_private *lp = wl_priv(dev); + struct net_device_stats *pStats = NULL; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_tx_timeout" ); + DBG_ENTER( DbgInfo ); + + DBG_WARNING( DbgInfo, "%s: Transmit timeout.\n", dev->name ); + + wl_lock( lp, &flags ); + +#ifdef USE_RTS + if( lp->useRTS == 1 ) { + DBG_TRACE( DbgInfo, "Skipping tx_timeout handler, in RTS mode\n" ); + wl_unlock( lp, &flags ); + + DBG_LEAVE( DbgInfo ); + return; + } +#endif /* USE_RTS */ + + /* Figure out which device (the "root" device or WDS port) this timeout + is for */ +#ifdef USE_WDS + + for( count = 0; count < NUM_WDS_PORTS; count++ ) { + if( dev == lp->wds_port[count].dev ) { + pStats = &( lp->wds_port[count].stats ); + + /* Break the loop so that we can use the counter to access WDS + information in the private structure */ + break; + } + } + +#endif /* USE_WDS */ + + /* If pStats is still NULL, then the device is not a WDS port */ + if( pStats == NULL ) { + pStats = &( lp->stats ); + } + + /* Accumulate the timeout error */ + pStats->tx_errors++; + + wl_unlock( lp, &flags ); + + DBG_LEAVE( DbgInfo ); + return; +} // wl_tx_timeout +/*============================================================================*/ + +/******************************************************************************* + * wl_send() + ******************************************************************************* + * + * DESCRIPTION: + * + * The routine which performs data transmits. + * + * PARAMETERS: + * + * lp - a pointer to the device's wl_private struct. + * + * RETURNS: + * + * 0 on success + * 1 on error + * + ******************************************************************************/ +int wl_send( struct wl_private *lp ) +{ + + int status; + DESC_STRCT *desc; + WVLAN_LFRAME *txF = NULL; + struct list_head *element; + int len; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_send" ); + + if( lp == NULL ) { + DBG_ERROR( DbgInfo, "Private adapter struct is NULL\n" ); + return FALSE; + } + if( lp->dev == NULL ) { + DBG_ERROR( DbgInfo, "net_device struct in wl_private is NULL\n" ); + return FALSE; + } + + /* Check for the availability of FIDs; if none are available, don't take any + frames off the txQ */ + if( lp->hcfCtx.IFB_RscInd == 0 ) { + return FALSE; + } + + /* Reclaim the TxQ Elements and place them back on the free queue */ + if( !list_empty( &( lp->txQ[0] ))) { + element = lp->txQ[0].next; + + txF = (WVLAN_LFRAME * )list_entry( element, WVLAN_LFRAME, node ); + if( txF != NULL ) { + lp->txF.skb = txF->frame.skb; + lp->txF.port = txF->frame.port; + + txF->frame.skb = NULL; + txF->frame.port = 0; + + list_del( &( txF->node )); + list_add( element, &( lp->txFree )); + + lp->txQ_count--; + + if( lp->txQ_count < TX_Q_LOW_WATER_MARK ) { + if( lp->netif_queue_on == FALSE ) { + DBG_TX( DbgInfo, "Kickstarting Q: %d\n", lp->txQ_count ); + netif_wake_queue( lp->dev ); + WL_WDS_NETIF_WAKE_QUEUE( lp ); + lp->netif_queue_on = TRUE; + } + } + } + } + + if( lp->txF.skb == NULL ) { + return FALSE; + } + + /* If the device has resources (FIDs) available, then Tx the packet */ + /* Format the TxRequest and send it to the adapter */ + len = lp->txF.skb->len < ETH_ZLEN ? ETH_ZLEN : lp->txF.skb->len; + + desc = &( lp->desc_tx ); + desc->buf_addr = lp->txF.skb->data; + desc->BUF_CNT = len; + desc->next_desc_addr = NULL; + + status = hcf_send_msg( &( lp->hcfCtx ), desc, lp->txF.port ); + + if( status == HCF_SUCCESS ) { + lp->dev->trans_start = jiffies; + + DBG_TX( DbgInfo, "Transmit...\n" ); + + if( lp->txF.port == HCF_PORT_0 ) { + lp->stats.tx_packets++; + lp->stats.tx_bytes += lp->txF.skb->len; + } + +#ifdef USE_WDS + else + { + lp->wds_port[(( lp->txF.port >> 8 ) - 1)].stats.tx_packets++; + lp->wds_port[(( lp->txF.port >> 8 ) - 1)].stats.tx_bytes += lp->txF.skb->len; + } + +#endif /* USE_WDS */ + + /* Free the skb and perform queue cleanup, as the buffer was + transmitted successfully */ + dev_kfree_skb( lp->txF.skb ); + + lp->txF.skb = NULL; + lp->txF.port = 0; + } + + return TRUE; +} // wl_send +/*============================================================================*/ + +/******************************************************************************* + * wl_tx() + ******************************************************************************* + * + * DESCRIPTION: + * + * The Tx handler function for the network layer. + * + * PARAMETERS: + * + * skb - a pointer to the sk_buff structure containing the data to transfer. + * dev - a pointer to the device's net_device structure. + * + * RETURNS: + * + * 0 on success + * 1 on error + * + ******************************************************************************/ +int wl_tx( struct sk_buff *skb, struct net_device *dev, int port ) +{ + unsigned long flags; + struct wl_private *lp = wl_priv(dev); + WVLAN_LFRAME *txF = NULL; + struct list_head *element; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_tx" ); + + /* Grab the spinlock */ + wl_lock( lp, &flags ); + + if( lp->flags & WVLAN2_UIL_BUSY ) { + DBG_WARNING( DbgInfo, "UIL has device blocked\n" ); + /* Start dropping packets here??? */ + wl_unlock( lp, &flags ); + return 1; + } + +#ifdef USE_RTS + if( lp->useRTS == 1 ) { + DBG_PRINT( "RTS: we're getting a Tx...\n" ); + wl_unlock( lp, &flags ); + return 1; + } +#endif /* USE_RTS */ + + if( !lp->use_dma ) { + /* Get an element from the queue */ + element = lp->txFree.next; + txF = (WVLAN_LFRAME *)list_entry( element, WVLAN_LFRAME, node ); + if( txF == NULL ) { + DBG_ERROR( DbgInfo, "Problem with list_entry\n" ); + wl_unlock( lp, &flags ); + return 1; + } + /* Fill out the frame */ + txF->frame.skb = skb; + txF->frame.port = port; + /* Move the frame to the txQ */ + /* NOTE: Here's where we would do priority queueing */ + list_del( &( txF->node )); + list_add( &( txF->node ), &( lp->txQ[0] )); + + lp->txQ_count++; + if( lp->txQ_count >= DEFAULT_NUM_TX_FRAMES ) { + DBG_TX( DbgInfo, "Q Full: %d\n", lp->txQ_count ); + if( lp->netif_queue_on == TRUE ) { + netif_stop_queue( lp->dev ); + WL_WDS_NETIF_STOP_QUEUE( lp ); + lp->netif_queue_on = FALSE; + } + } + } + wl_act_int_off( lp ); /* Disable Interrupts */ + + /* Send the data to the hardware using the appropriate method */ +#ifdef ENABLE_DMA + if( lp->use_dma ) { + wl_send_dma( lp, skb, port ); + } + else +#endif + { + wl_send( lp ); + } + /* Re-enable Interrupts, release the spinlock and return */ + wl_act_int_on( lp ); + wl_unlock( lp, &flags ); + return 0; +} // wl_tx +/*============================================================================*/ + +/******************************************************************************* + * wl_rx() + ******************************************************************************* + * + * DESCRIPTION: + * + * The routine which performs data reception. + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device structure. + * + * RETURNS: + * + * 0 on success + * 1 on error + * + ******************************************************************************/ +int wl_rx(struct net_device *dev) +{ + int port; + struct sk_buff *skb; + struct wl_private *lp = wl_priv(dev); + int status; + hcf_16 pktlen; + hcf_16 hfs_stat; + DESC_STRCT *desc; + /*------------------------------------------------------------------------*/ + + DBG_FUNC("wl_rx") + DBG_PARAM(DbgInfo, "dev", "%s (0x%p)", dev->name, dev); + + if(!( lp->flags & WVLAN2_UIL_BUSY )) { + +#ifdef USE_RTS + if( lp->useRTS == 1 ) { + DBG_PRINT( "RTS: We're getting an Rx...\n" ); + return -EIO; + } +#endif /* USE_RTS */ + + /* Read the HFS_STAT register from the lookahead buffer */ + hfs_stat = (hcf_16)(( lp->lookAheadBuf[HFS_STAT] ) | + ( lp->lookAheadBuf[HFS_STAT + 1] << 8 )); + + /* Make sure the frame isn't bad */ + if(( hfs_stat & HFS_STAT_ERR ) != HCF_SUCCESS ) { + DBG_WARNING( DbgInfo, "HFS_STAT_ERROR (0x%x) in Rx Packet\n", + lp->lookAheadBuf[HFS_STAT] ); + return -EIO; + } + + /* Determine what port this packet is for */ + port = ( hfs_stat >> 8 ) & 0x0007; + DBG_RX( DbgInfo, "Rx frame for port %d\n", port ); + + if(( pktlen = lp->hcfCtx.IFB_RxLen ) != 0 ) { + if(( skb = ALLOC_SKB( pktlen )) != NULL ) { + /* Set the netdev based on the port */ + switch( port ) { +#ifdef USE_WDS + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + skb->dev = lp->wds_port[port-1].dev; + break; +#endif /* USE_WDS */ + + case 0: + default: + skb->dev = dev; + break; + } + + desc = &( lp->desc_rx ); + + desc->next_desc_addr = NULL; + +/* +#define BLOCK_INPUT(buf, len) \ + desc->buf_addr = buf; \ + desc->BUF_SIZE = len; \ + status = hcf_rcv_msg(&(lp->hcfCtx), desc, 0) +*/ + + GET_PACKET( skb->dev, skb, pktlen ); + + if( status == HCF_SUCCESS ) { + netif_rx( skb ); + + if( port == 0 ) { + lp->stats.rx_packets++; + lp->stats.rx_bytes += pktlen; + } +#ifdef USE_WDS + else + { + lp->wds_port[port-1].stats.rx_packets++; + lp->wds_port[port-1].stats.rx_bytes += pktlen; + } +#endif /* USE_WDS */ + + dev->last_rx = jiffies; + +#ifdef WIRELESS_EXT +#ifdef WIRELESS_SPY + if( lp->spydata.spy_number > 0 ) { + char *srcaddr = skb->mac.raw + MAC_ADDR_SIZE; + + wl_spy_gather( dev, srcaddr ); + } +#endif /* WIRELESS_SPY */ +#endif /* WIRELESS_EXT */ + } else { + DBG_ERROR( DbgInfo, "Rx request to card FAILED\n" ); + + if( port == 0 ) { + lp->stats.rx_dropped++; + } +#ifdef USE_WDS + else + { + lp->wds_port[port-1].stats.rx_dropped++; + } +#endif /* USE_WDS */ + + dev_kfree_skb( skb ); + } + } else { + DBG_ERROR( DbgInfo, "Could not alloc skb\n" ); + + if( port == 0 ) { + lp->stats.rx_dropped++; + } +#ifdef USE_WDS + else + { + lp->wds_port[port-1].stats.rx_dropped++; + } +#endif /* USE_WDS */ + } + } + } + + return 0; +} // wl_rx +/*============================================================================*/ + +/******************************************************************************* + * wl_multicast() + ******************************************************************************* + * + * DESCRIPTION: + * + * Function to handle multicast packets + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device structure. + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +#ifdef NEW_MULTICAST + +void wl_multicast( struct net_device *dev ) +{ +#if 1 //;? (HCF_TYPE) & HCF_TYPE_STA //;?should we return an error status in AP mode +//;?seems reasonable that even an AP-only driver could afford this small additional footprint + + int x; + struct dev_mc_list *mclist; + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_multicast" ); + DBG_ENTER( DbgInfo ); + DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev ); + + if( !wl_adapter_is_open( dev )) { + DBG_LEAVE( DbgInfo ); + return; + } + +#if DBG + if( DBG_FLAGS( DbgInfo ) & DBG_PARAM_ON ) { + DBG_PRINT(" flags: %s%s%s\n", + ( dev->flags & IFF_PROMISC ) ? "Promiscous " : "", + ( dev->flags & IFF_MULTICAST ) ? "Multicast " : "", + ( dev->flags & IFF_ALLMULTI ) ? "All-Multicast" : "" ); + + DBG_PRINT( " mc_count: %d\n", dev->mc_count ); + + for( x = 0, mclist = dev->mc_list; mclist && x < dev->mc_count; + x++, mclist = mclist->next ) { + DBG_PRINT( " %s (%d)\n", DbgHwAddr(mclist->dmi_addr), + mclist->dmi_addrlen ); + } + } +#endif /* DBG */ + + if(!( lp->flags & WVLAN2_UIL_BUSY )) { + +#ifdef USE_RTS + if( lp->useRTS == 1 ) { + DBG_TRACE( DbgInfo, "Skipping multicast, in RTS mode\n" ); + + DBG_LEAVE( DbgInfo ); + return; + } +#endif /* USE_RTS */ + + wl_lock( lp, &flags ); + wl_act_int_off( lp ); + + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_STA ) { + if( dev->flags & IFF_PROMISC ) { + /* Enable promiscuous mode */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_PROMISCUOUS_MODE; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 1 ); + DBG_PRINT( "Enabling Promiscuous mode (IFF_PROMISC)\n" ); + hcf_put_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + } + else if(( dev->mc_count > HCF_MAX_MULTICAST ) || + ( dev->flags & IFF_ALLMULTI )) { + /* Shutting off this filter will enable all multicast frames to + be sent up from the device; however, this is a static RID, so + a call to wl_apply() is needed */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_RX_ALL_GROUP_ADDR; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 0 ); + DBG_PRINT( "Enabling all multicast mode (IFF_ALLMULTI)\n" ); + hcf_put_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + wl_apply( lp ); + } + else if( dev->mc_count != 0 ) { + /* Set the multicast addresses */ + lp->ltvRecord.len = ( dev->mc_count * 3 ) + 1; + lp->ltvRecord.typ = CFG_GROUP_ADDR; + + for( x = 0, mclist = dev->mc_list; + ( x < dev->mc_count ) && ( mclist != NULL ); + x++, mclist = mclist->next ) { + memcpy( &( lp->ltvRecord.u.u8[x * ETH_ALEN] ), + mclist->dmi_addr, ETH_ALEN ); + } + DBG_PRINT( "Setting multicast list\n" ); + hcf_put_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + } else { + /* Disable promiscuous mode */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_PROMISCUOUS_MODE; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 0 ); + DBG_PRINT( "Disabling Promiscuous mode\n" ); + hcf_put_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + + /* Disable multicast mode */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_GROUP_ADDR; + DBG_PRINT( "Disabling Multicast mode\n" ); + hcf_put_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + + /* Turning on this filter will prevent all multicast frames from + being sent up from the device; however, this is a static RID, + so a call to wl_apply() is needed */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CNF_RX_ALL_GROUP_ADDR; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 1 ); + DBG_PRINT( "Disabling all multicast mode (IFF_ALLMULTI)\n" ); + hcf_put_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + wl_apply( lp ); + } + } + wl_act_int_on( lp ); + wl_unlock( lp, &flags ); + } + DBG_LEAVE( DbgInfo ); +#endif /* HCF_STA */ +} // wl_multicast +/*============================================================================*/ + +#else /* NEW_MULTICAST */ + +void wl_multicast( struct net_device *dev, int num_addrs, void *addrs ) +{ + DBG_FUNC( "wl_multicast"); + DBG_ENTER(DbgInfo); + + DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev ); + DBG_PARAM( DbgInfo, "num_addrs", "%d", num_addrs ); + DBG_PARAM( DbgInfo, "addrs", "0x%p", addrs ); + +#error Obsolete set multicast interface! + + DBG_LEAVE( DbgInfo ); +} // wl_multicast +/*============================================================================*/ + +#endif /* NEW_MULTICAST */ + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) +static const struct net_device_ops wl_netdev_ops = +{ + .ndo_start_xmit = &wl_tx_port0, + + .ndo_set_config = &wl_config, + .ndo_get_stats = &wl_stats, + .ndo_set_multicast_list = &wl_multicast, + + .ndo_init = &wl_insert, + .ndo_open = &wl_adapter_open, + .ndo_stop = &wl_adapter_close, + .ndo_do_ioctl = &wl_ioctl, + +#ifdef HAVE_TX_TIMEOUT + .ndo_tx_timeout = &wl_tx_timeout, +#endif + +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = wl_poll, +#endif +}; +#endif // (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) + +/******************************************************************************* + * wl_device_alloc() + ******************************************************************************* + * + * DESCRIPTION: + * + * Create instances of net_device and wl_private for the new adapter + * and register the device's entry points in the net_device structure. + * + * PARAMETERS: + * + * N/A + * + * RETURNS: + * + * a pointer to an allocated and initialized net_device struct for this + * device. + * + ******************************************************************************/ +struct net_device * wl_device_alloc( void ) +{ + struct net_device *dev = NULL; + struct wl_private *lp = NULL; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_device_alloc" ); + DBG_ENTER( DbgInfo ); + + /* Alloc a net_device struct */ + dev = alloc_etherdev(sizeof(struct wl_private)); + if (!dev) + return NULL; + + /* Initialize the 'next' pointer in the struct. Currently only used for PCI, + but do it here just in case it's used for other buses in the future */ + lp = wl_priv(dev); + + + /* Check MTU */ + if( dev->mtu > MTU_MAX ) + { + DBG_WARNING( DbgInfo, "%s: MTU set too high, limiting to %d.\n", + dev->name, MTU_MAX ); + dev->mtu = MTU_MAX; + } + + /* Setup the function table in the device structure. */ + + dev->wireless_handlers = (struct iw_handler_def *)&wl_iw_handler_def; + lp->wireless_data.spy_data = &lp->spy_data; + dev->wireless_data = &lp->wireless_data; + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) + dev->netdev_ops = &wl_netdev_ops; +#else + dev->hard_start_xmit = &wl_tx_port0; + + dev->set_config = &wl_config; + dev->get_stats = &wl_stats; + dev->set_multicast_list = &wl_multicast; + + dev->init = &wl_insert; + dev->open = &wl_adapter_open; + dev->stop = &wl_adapter_close; + dev->do_ioctl = &wl_ioctl; + +#ifdef HAVE_TX_TIMEOUT + dev->tx_timeout = &wl_tx_timeout; +#endif + +#ifdef CONFIG_NET_POLL_CONTROLLER + dev->poll_controller = wl_poll; +#endif + +#endif // (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) + +#ifdef HAVE_TX_TIMEOUT + dev->watchdog_timeo = TX_TIMEOUT; +#endif + + dev->ethtool_ops = &wl_ethtool_ops; + + netif_stop_queue( dev ); + + /* Allocate virutal devices for WDS support if needed */ + WL_WDS_DEVICE_ALLOC( lp ); + + DBG_LEAVE( DbgInfo ); + return dev; +} // wl_device_alloc +/*============================================================================*/ + +/******************************************************************************* + * wl_device_dealloc() + ******************************************************************************* + * + * DESCRIPTION: + * + * Free instances of net_device and wl_private strcutres for an adapter + * and perform basic cleanup. + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device structure. + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_device_dealloc( struct net_device *dev ) +{ +// struct wl_private *lp = wl_priv(dev); + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_device_dealloc" ); + DBG_ENTER( DbgInfo ); + + /* Dealloc the WDS ports */ + WL_WDS_DEVICE_DEALLOC( lp ); + + free_netdev( dev ); + + DBG_LEAVE( DbgInfo ); + return; +} // wl_device_dealloc +/*============================================================================*/ + +/******************************************************************************* + * wl_tx_port0() + ******************************************************************************* + * + * DESCRIPTION: + * + * The handler routine for Tx over HCF_PORT_0. + * + * PARAMETERS: + * + * skb - a pointer to the sk_buff to transmit. + * dev - a pointer to a net_device structure representing HCF_PORT_0. + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +int wl_tx_port0( struct sk_buff *skb, struct net_device *dev ) +{ + DBG_TX( DbgInfo, "Tx on Port 0\n" ); + + return wl_tx( skb, dev, HCF_PORT_0 ); +#ifdef ENABLE_DMA + return wl_tx_dma( skb, dev, HCF_PORT_0 ); +#endif +} // wl_tx_port0 +/*============================================================================*/ + +#ifdef USE_WDS + +/******************************************************************************* + * wl_tx_port1() + ******************************************************************************* + * + * DESCRIPTION: + * + * The handler routine for Tx over HCF_PORT_1. + * + * PARAMETERS: + * + * skb - a pointer to the sk_buff to transmit. + * dev - a pointer to a net_device structure representing HCF_PORT_1. + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +int wl_tx_port1( struct sk_buff *skb, struct net_device *dev ) +{ + DBG_TX( DbgInfo, "Tx on Port 1\n" ); + return wl_tx( skb, dev, HCF_PORT_1 ); +} // wl_tx_port1 +/*============================================================================*/ + +/******************************************************************************* + * wl_tx_port2() + ******************************************************************************* + * + * DESCRIPTION: + * + * The handler routine for Tx over HCF_PORT_2. + * + * PARAMETERS: + * + * skb - a pointer to the sk_buff to transmit. + * dev - a pointer to a net_device structure representing HCF_PORT_2. + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +int wl_tx_port2( struct sk_buff *skb, struct net_device *dev ) +{ + DBG_TX( DbgInfo, "Tx on Port 2\n" ); + return wl_tx( skb, dev, HCF_PORT_2 ); +} // wl_tx_port2 +/*============================================================================*/ + +/******************************************************************************* + * wl_tx_port3() + ******************************************************************************* + * + * DESCRIPTION: + * + * The handler routine for Tx over HCF_PORT_3. + * + * PARAMETERS: + * + * skb - a pointer to the sk_buff to transmit. + * dev - a pointer to a net_device structure representing HCF_PORT_3. + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +int wl_tx_port3( struct sk_buff *skb, struct net_device *dev ) +{ + DBG_TX( DbgInfo, "Tx on Port 3\n" ); + return wl_tx( skb, dev, HCF_PORT_3 ); +} // wl_tx_port3 +/*============================================================================*/ + +/******************************************************************************* + * wl_tx_port4() + ******************************************************************************* + * + * DESCRIPTION: + * + * The handler routine for Tx over HCF_PORT_4. + * + * PARAMETERS: + * + * skb - a pointer to the sk_buff to transmit. + * dev - a pointer to a net_device structure representing HCF_PORT_4. + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +int wl_tx_port4( struct sk_buff *skb, struct net_device *dev ) +{ + DBG_TX( DbgInfo, "Tx on Port 4\n" ); + return wl_tx( skb, dev, HCF_PORT_4 ); +} // wl_tx_port4 +/*============================================================================*/ + +/******************************************************************************* + * wl_tx_port5() + ******************************************************************************* + * + * DESCRIPTION: + * + * The handler routine for Tx over HCF_PORT_5. + * + * PARAMETERS: + * + * skb - a pointer to the sk_buff to transmit. + * dev - a pointer to a net_device structure representing HCF_PORT_5. + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +int wl_tx_port5( struct sk_buff *skb, struct net_device *dev ) +{ + DBG_TX( DbgInfo, "Tx on Port 5\n" ); + return wl_tx( skb, dev, HCF_PORT_5 ); +} // wl_tx_port5 +/*============================================================================*/ + +/******************************************************************************* + * wl_tx_port6() + ******************************************************************************* + * + * DESCRIPTION: + * + * The handler routine for Tx over HCF_PORT_6. + * + * PARAMETERS: + * + * skb - a pointer to the sk_buff to transmit. + * dev - a pointer to a net_device structure representing HCF_PORT_6. + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +int wl_tx_port6( struct sk_buff *skb, struct net_device *dev ) +{ + DBG_TX( DbgInfo, "Tx on Port 6\n" ); + return wl_tx( skb, dev, HCF_PORT_6 ); +} // wl_tx_port6 +/*============================================================================*/ + +/******************************************************************************* + * wl_wds_device_alloc() + ******************************************************************************* + * + * DESCRIPTION: + * + * Create instances of net_device to represent the WDS ports, and register + * the device's entry points in the net_device structure. + * + * PARAMETERS: + * + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * N/A, but will place pointers to the allocated and initialized net_device + * structs in the private adapter structure. + * + ******************************************************************************/ +void wl_wds_device_alloc( struct wl_private *lp ) +{ + int count; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_wds_device_alloc" ); + DBG_ENTER( DbgInfo ); + + /* WDS support requires additional net_device structs to be allocated, + so that user space apps can use these virtual devices to specify the + port on which to Tx/Rx */ + for( count = 0; count < NUM_WDS_PORTS; count++ ) { + struct net_device *dev_wds = NULL; + + dev_wds = kmalloc( sizeof( struct net_device ), GFP_KERNEL ); + memset( dev_wds, 0, sizeof( struct net_device )); + + ether_setup( dev_wds ); + + lp->wds_port[count].dev = dev_wds; + + /* Re-use wl_init for all the devices, as it currently does nothing, but + is required. Re-use the stats/tx_timeout handler for all as well; the + WDS port which is requesting these operations can be determined by + the net_device pointer. Set the private member of all devices to point + to the same net_device struct; that way, all information gets + funnelled through the one "real" net_device. Name the WDS ports + "wds" */ + lp->wds_port[count].dev->init = &wl_init; + lp->wds_port[count].dev->get_stats = &wl_stats; + lp->wds_port[count].dev->tx_timeout = &wl_tx_timeout; + lp->wds_port[count].dev->watchdog_timeo = TX_TIMEOUT; + lp->wds_port[count].dev->priv = lp; + + sprintf( lp->wds_port[count].dev->name, "wds%d", count ); + } + + /* Register the Tx handlers */ + lp->wds_port[0].dev->hard_start_xmit = &wl_tx_port1; + lp->wds_port[1].dev->hard_start_xmit = &wl_tx_port2; + lp->wds_port[2].dev->hard_start_xmit = &wl_tx_port3; + lp->wds_port[3].dev->hard_start_xmit = &wl_tx_port4; + lp->wds_port[4].dev->hard_start_xmit = &wl_tx_port5; + lp->wds_port[5].dev->hard_start_xmit = &wl_tx_port6; + + WL_WDS_NETIF_STOP_QUEUE( lp ); + + DBG_LEAVE( DbgInfo ); + return; +} // wl_wds_device_alloc +/*============================================================================*/ + +/******************************************************************************* + * wl_wds_device_dealloc() + ******************************************************************************* + * + * DESCRIPTION: + * + * Free instances of net_device structures used to support WDS. + * + * PARAMETERS: + * + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_wds_device_dealloc( struct wl_private *lp ) +{ + int count; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_wds_device_dealloc" ); + DBG_ENTER( DbgInfo ); + + for( count = 0; count < NUM_WDS_PORTS; count++ ) { + struct net_device *dev_wds = NULL; + + dev_wds = lp->wds_port[count].dev; + + if( dev_wds != NULL ) { + if( dev_wds->flags & IFF_UP ) { + dev_close( dev_wds ); + dev_wds->flags &= ~( IFF_UP | IFF_RUNNING ); + } + + kfree( dev_wds ); + lp->wds_port[count].dev = NULL; + } + } + + DBG_LEAVE( DbgInfo ); + return; +} // wl_wds_device_dealloc +/*============================================================================*/ + +/******************************************************************************* + * wl_wds_netif_start_queue() + ******************************************************************************* + * + * DESCRIPTION: + * + * Used to start the netif queues of all the "virtual" network devices + * which repesent the WDS ports. + * + * PARAMETERS: + * + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_wds_netif_start_queue( struct wl_private *lp ) +{ + int count; + /*------------------------------------------------------------------------*/ + + if( lp != NULL ) { + for( count = 0; count < NUM_WDS_PORTS; count++ ) { + if( lp->wds_port[count].is_registered && + lp->wds_port[count].netif_queue_on == FALSE ) { + netif_start_queue( lp->wds_port[count].dev ); + lp->wds_port[count].netif_queue_on = TRUE; + } + } + } + + return; +} // wl_wds_netif_start_queue +/*============================================================================*/ + +/******************************************************************************* + * wl_wds_netif_stop_queue() + ******************************************************************************* + * + * DESCRIPTION: + * + * Used to stop the netif queues of all the "virtual" network devices + * which repesent the WDS ports. + * + * PARAMETERS: + * + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_wds_netif_stop_queue( struct wl_private *lp ) +{ + int count; + /*------------------------------------------------------------------------*/ + + if( lp != NULL ) { + for( count = 0; count < NUM_WDS_PORTS; count++ ) { + if( lp->wds_port[count].is_registered && + lp->wds_port[count].netif_queue_on == TRUE ) { + netif_stop_queue( lp->wds_port[count].dev ); + lp->wds_port[count].netif_queue_on = FALSE; + } + } + } + + return; +} // wl_wds_netif_stop_queue +/*============================================================================*/ + +/******************************************************************************* + * wl_wds_netif_wake_queue() + ******************************************************************************* + * + * DESCRIPTION: + * + * Used to wake the netif queues of all the "virtual" network devices + * which repesent the WDS ports. + * + * PARAMETERS: + * + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_wds_netif_wake_queue( struct wl_private *lp ) +{ + int count; + /*------------------------------------------------------------------------*/ + + if( lp != NULL ) { + for( count = 0; count < NUM_WDS_PORTS; count++ ) { + if( lp->wds_port[count].is_registered && + lp->wds_port[count].netif_queue_on == FALSE ) { + netif_wake_queue( lp->wds_port[count].dev ); + lp->wds_port[count].netif_queue_on = TRUE; + } + } + } + + return; +} // wl_wds_netif_wake_queue +/*============================================================================*/ + +/******************************************************************************* + * wl_wds_netif_carrier_on() + ******************************************************************************* + * + * DESCRIPTION: + * + * Used to signal the network layer that carrier is present on all of the + * "virtual" network devices which repesent the WDS ports. + * + * PARAMETERS: + * + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_wds_netif_carrier_on( struct wl_private *lp ) +{ + int count; + /*------------------------------------------------------------------------*/ + + if( lp != NULL ) { + for( count = 0; count < NUM_WDS_PORTS; count++ ) { + if( lp->wds_port[count].is_registered ) { + netif_carrier_on( lp->wds_port[count].dev ); + } + } + } + + return; +} // wl_wds_netif_carrier_on +/*============================================================================*/ + +/******************************************************************************* + * wl_wds_netif_carrier_off() + ******************************************************************************* + * + * DESCRIPTION: + * + * Used to signal the network layer that carrier is NOT present on all of + * the "virtual" network devices which repesent the WDS ports. + * + * PARAMETERS: + * + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_wds_netif_carrier_off( struct wl_private *lp ) +{ + int count; + /*------------------------------------------------------------------------*/ + + if( lp != NULL ) { + for( count = 0; count < NUM_WDS_PORTS; count++ ) { + if( lp->wds_port[count].is_registered ) { + netif_carrier_off( lp->wds_port[count].dev ); + } + } + } + + return; +} // wl_wds_netif_carrier_off +/*============================================================================*/ + +#endif /* USE_WDS */ + +#ifdef ENABLE_DMA +/******************************************************************************* + * wl_send_dma() + ******************************************************************************* + * + * DESCRIPTION: + * + * The routine which performs data transmits when using busmaster DMA. + * + * PARAMETERS: + * + * lp - a pointer to the device's wl_private struct. + * skb - a pointer to the network layer's data buffer. + * port - the Hermes port on which to transmit. + * + * RETURNS: + * + * 0 on success + * 1 on error + * + ******************************************************************************/ +int wl_send_dma( struct wl_private *lp, struct sk_buff *skb, int port ) +{ + int len; + DESC_STRCT *desc = NULL; + DESC_STRCT *desc_next = NULL; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_send_dma" ); + + if( lp == NULL ) + { + DBG_ERROR( DbgInfo, "Private adapter struct is NULL\n" ); + return FALSE; + } + + if( lp->dev == NULL ) + { + DBG_ERROR( DbgInfo, "net_device struct in wl_private is NULL\n" ); + return FALSE; + } + + /* AGAIN, ALL THE QUEUEING DONE HERE IN I/O MODE IS NOT PERFORMED */ + + if( skb == NULL ) + { + DBG_WARNING (DbgInfo, "Nothing to send.\n"); + return FALSE; + } + + len = skb->len; + + /* Get a free descriptor */ + desc = wl_pci_dma_get_tx_packet( lp ); + + if( desc == NULL ) + { + if( lp->netif_queue_on == TRUE ) { + netif_stop_queue( lp->dev ); + WL_WDS_NETIF_STOP_QUEUE( lp ); + lp->netif_queue_on = FALSE; + + dev_kfree_skb( skb ); + return 0; + } + } + + SET_BUF_CNT( desc, /*HCF_DMA_FD_CNT*/HFS_ADDR_DEST ); + SET_BUF_SIZE( desc, HCF_DMA_TX_BUF1_SIZE ); + + desc_next = desc->next_desc_addr; + + if( desc_next->buf_addr == NULL ) + { + DBG_ERROR( DbgInfo, "DMA descriptor buf_addr is NULL\n" ); + return FALSE; + } + + /* Copy the payload into the DMA packet */ + memcpy( desc_next->buf_addr, skb->data, len ); + + SET_BUF_CNT( desc_next, len ); + SET_BUF_SIZE( desc_next, HCF_MAX_PACKET_SIZE ); + + hcf_dma_tx_put( &( lp->hcfCtx ), desc, 0 ); + + /* Free the skb and perform queue cleanup, as the buffer was + transmitted successfully */ + dev_kfree_skb( skb ); + + return TRUE; +} // wl_send_dma +/*============================================================================*/ + +/******************************************************************************* + * wl_rx_dma() + ******************************************************************************* + * + * DESCRIPTION: + * + * The routine which performs data reception when using busmaster DMA. + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device structure. + * + * RETURNS: + * + * 0 on success + * 1 on error + * + ******************************************************************************/ +int wl_rx_dma( struct net_device *dev ) +{ + int port; + hcf_16 pktlen; + hcf_16 hfs_stat; + struct sk_buff *skb; + struct wl_private *lp = NULL; + DESC_STRCT *desc, *desc_next; + //CFG_MB_INFO_RANGE2_STRCT x; + /*------------------------------------------------------------------------*/ + + DBG_FUNC("wl_rx") + DBG_PARAM(DbgInfo, "dev", "%s (0x%p)", dev->name, dev); + + if((( lp = (struct wl_private *)dev->priv ) != NULL ) && + !( lp->flags & WVLAN2_UIL_BUSY )) { + +#ifdef USE_RTS + if( lp->useRTS == 1 ) { + DBG_PRINT( "RTS: We're getting an Rx...\n" ); + return -EIO; + } +#endif /* USE_RTS */ + + //if( lp->dma.status == 0 ) + //{ + desc = hcf_dma_rx_get( &( lp->hcfCtx )); + + if( desc != NULL ) + { + /* Check and see if we rcvd. a WMP frame */ + /* + if((( *(hcf_8 *)&desc->buf_addr[HFS_STAT] ) & + ( HFS_STAT_MSG_TYPE | HFS_STAT_ERR )) == HFS_STAT_WMP_MSG ) + { + DBG_TRACE( DbgInfo, "Got a WMP frame\n" ); + + x.len = sizeof( CFG_MB_INFO_RANGE2_STRCT ) / sizeof( hcf_16 ); + x.typ = CFG_MB_INFO; + x.base_typ = CFG_WMP; + x.frag_cnt = 2; + x.frag_buf[0].frag_len = GET_BUF_CNT( descp ) / sizeof( hcf_16 ); + x.frag_buf[0].frag_addr = (hcf_8 *) descp->buf_addr ; + x.frag_buf[1].frag_len = ( GET_BUF_CNT( descp->next_desc_addr ) + 1 ) / sizeof( hcf_16 ); + x.frag_buf[1].frag_addr = (hcf_8 *) descp->next_desc_addr->buf_addr ; + + hcf_put_info( &( lp->hcfCtx ), (LTVP)&x ); + } + */ + + desc_next = desc->next_desc_addr; + + /* Make sure the buffer isn't empty */ + if( GET_BUF_CNT( desc ) == 0 ) { + DBG_WARNING( DbgInfo, "Buffer is empty!\n" ); + + /* Give the descriptor back to the HCF */ + hcf_dma_rx_put( &( lp->hcfCtx ), desc ); + return -EIO; + } + + /* Read the HFS_STAT register from the lookahead buffer */ + hfs_stat = (hcf_16)( desc->buf_addr[HFS_STAT/2] ); + + /* Make sure the frame isn't bad */ + if(( hfs_stat & HFS_STAT_ERR ) != HCF_SUCCESS ) + { + DBG_WARNING( DbgInfo, "HFS_STAT_ERROR (0x%x) in Rx Packet\n", + desc->buf_addr[HFS_STAT/2] ); + + /* Give the descriptor back to the HCF */ + hcf_dma_rx_put( &( lp->hcfCtx ), desc ); + return -EIO; + } + + /* Determine what port this packet is for */ + port = ( hfs_stat >> 8 ) & 0x0007; + DBG_RX( DbgInfo, "Rx frame for port %d\n", port ); + + if(( pktlen = GET_BUF_CNT( desc_next )) != 0 ) { + if(( skb = ALLOC_SKB( pktlen )) != NULL ) { + switch( port ) { +#ifdef USE_WDS + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + skb->dev = lp->wds_port[port-1].dev; + break; +#endif /* USE_WDS */ + + case 0: + default: + skb->dev = dev; + break; + } + + GET_PACKET_DMA( skb->dev, skb, pktlen ); + + /* Give the descriptor back to the HCF */ + hcf_dma_rx_put( &( lp->hcfCtx ), desc ); + + netif_rx( skb ); + + if( port == 0 ) { + lp->stats.rx_packets++; + lp->stats.rx_bytes += pktlen; + } +#ifdef USE_WDS + else + { + lp->wds_port[port-1].stats.rx_packets++; + lp->wds_port[port-1].stats.rx_bytes += pktlen; + } +#endif /* USE_WDS */ + + dev->last_rx = jiffies; + + } else { + DBG_ERROR( DbgInfo, "Could not alloc skb\n" ); + + if( port == 0 ) + { + lp->stats.rx_dropped++; + } +#ifdef USE_WDS + else + { + lp->wds_port[port-1].stats.rx_dropped++; + } +#endif /* USE_WDS */ + } + } + } + //} + } + + return 0; +} // wl_rx_dma +/*============================================================================*/ +#endif // ENABLE_DMA diff --git a/drivers/staging/wlags49_h2/wl_netdev.h b/drivers/staging/wlags49_h2/wl_netdev.h new file mode 100644 index 000000000000..ad04c8eedabf --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_netdev.h @@ -0,0 +1,171 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * Header describing information required by the network layerentry points + * into the driver. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/07/19 08:16:15 $ + * $Revision: 1.2 $ + * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_netdev.h,v $ + * + ******************************************************************************/ + + + + +#ifndef __WL_NETDEV_H__ +#define __WL_NETDEV_H__ + + + + +/******************************************************************************* + * function prototypes + ******************************************************************************/ +int wl_init( struct net_device *dev ); + +int wl_config( struct net_device *dev, struct ifmap *map ); + +struct net_device *wl_device_alloc( void ); + +void wl_device_dealloc( struct net_device *dev ); + +int wl_open( struct net_device *dev ); + +int wl_close( struct net_device *dev ); + +int wl_ioctl( struct net_device *dev, struct ifreq *rq, int cmd ); + +int wl_tx( struct sk_buff *skb, struct net_device *dev, int port ); + +int wl_send( struct wl_private *lp ); + +int wl_rx( struct net_device *dev ); + +void wl_tx_timeout( struct net_device *dev ); + +struct net_device_stats *wl_stats( struct net_device *dev ); + + +#ifdef ENABLE_DMA +int wl_send_dma( struct wl_private *lp, struct sk_buff *skb, int port ); +int wl_rx_dma( struct net_device *dev ); +#endif + +#ifdef NEW_MULTICAST +void wl_multicast( struct net_device *dev ); +#else +void wl_multicast( struct net_device *dev, int num_addrs, void *addrs ); +#endif // NEW_MULTICAST + + +int wl_tx_port0( struct sk_buff *skb, struct net_device *dev ); + + +#ifdef USE_WDS + +int wl_tx_port1( struct sk_buff *skb, struct net_device *dev ); +int wl_tx_port2( struct sk_buff *skb, struct net_device *dev ); +int wl_tx_port3( struct sk_buff *skb, struct net_device *dev ); +int wl_tx_port4( struct sk_buff *skb, struct net_device *dev ); +int wl_tx_port5( struct sk_buff *skb, struct net_device *dev ); +int wl_tx_port6( struct sk_buff *skb, struct net_device *dev ); + +void wl_wds_device_alloc( struct wl_private *lp ); +void wl_wds_device_dealloc( struct wl_private *lp ); +void wl_wds_netif_start_queue( struct wl_private *lp ); +void wl_wds_netif_stop_queue( struct wl_private *lp ); +void wl_wds_netif_wake_queue( struct wl_private *lp ); +void wl_wds_netif_carrier_on( struct wl_private *lp ); +void wl_wds_netif_carrier_off( struct wl_private *lp ); + +#endif /* USE_WDS */ + + +#ifdef USE_WDS + +#define WL_WDS_DEVICE_ALLOC( ARG ) wl_wds_device_alloc( ARG ) +#define WL_WDS_DEVICE_DEALLOC( ARG ) wl_wds_device_dealloc( ARG ) +#define WL_WDS_NETIF_START_QUEUE( ARG ) wl_wds_netif_start_queue( ARG ) +#define WL_WDS_NETIF_STOP_QUEUE( ARG ) wl_wds_netif_stop_queue( ARG ) +#define WL_WDS_NETIF_WAKE_QUEUE( ARG ) wl_wds_netif_wake_queue( ARG ) +#define WL_WDS_NETIF_CARRIER_ON( ARG ) wl_wds_netif_carrier_on( ARG ) +#define WL_WDS_NETIF_CARRIER_OFF( ARG ) wl_wds_netif_carrier_off( ARG ) + +#else + +#define WL_WDS_DEVICE_ALLOC( ARG ) +#define WL_WDS_DEVICE_DEALLOC( ARG ) +#define WL_WDS_NETIF_START_QUEUE( ARG ) +#define WL_WDS_NETIF_STOP_QUEUE( ARG ) +#define WL_WDS_NETIF_WAKE_QUEUE( ARG ) +#define WL_WDS_NETIF_CARRIER_ON( ARG ) +#define WL_WDS_NETIF_CARRIER_OFF( ARG ) + +#endif /* USE_WDS */ + + +#endif // __WL_NETDEV_H__ diff --git a/drivers/staging/wlags49_h2/wl_pci.c b/drivers/staging/wlags49_h2/wl_pci.c new file mode 100644 index 000000000000..4567100bcbf6 --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_pci.c @@ -0,0 +1,1596 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * This file contains processing and initialization specific to PCI/miniPCI + * devices. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/08/06 11:25:37 $ + * $Revision: 1.7 $ + * $Source: /usr/local/cvs/wl_lkm/wireless/wl_pci.c,v $ + * + ******************************************************************************/ + + + +/******************************************************************************* + * include files + ******************************************************************************/ +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + +/******************************************************************************* + * global variables + ******************************************************************************/ +#if DBG +extern dbg_info_t *DbgInfo; +#endif // DBG + +/* define the PCI device Table Cardname and id tables */ +enum hermes_pci_versions { + CH_Agere_Systems_Mini_PCI_V1 = 0, +}; + +static struct pci_device_id wl_pci_tbl[] __devinitdata = { + { WL_LKM_PCI_VENDOR_ID, WL_LKM_PCI_DEVICE_ID_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_Agere_Systems_Mini_PCI_V1 }, + { WL_LKM_PCI_VENDOR_ID, WL_LKM_PCI_DEVICE_ID_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_Agere_Systems_Mini_PCI_V1 }, + { WL_LKM_PCI_VENDOR_ID, WL_LKM_PCI_DEVICE_ID_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_Agere_Systems_Mini_PCI_V1 }, + { } /* Terminating entry */ +}; + +MODULE_DEVICE_TABLE(pci, wl_pci_tbl); + +/******************************************************************************* + * function prototypes + ******************************************************************************/ +int __devinit wl_pci_probe( struct pci_dev *pdev, + const struct pci_device_id *ent ); +void __devexit wl_pci_remove(struct pci_dev *pdev); +int wl_pci_setup( struct pci_dev *pdev ); +void wl_pci_enable_cardbus_interrupts( struct pci_dev *pdev ); + +#ifdef ENABLE_DMA +int wl_pci_dma_alloc( struct pci_dev *pdev, struct wl_private *lp ); +int wl_pci_dma_free( struct pci_dev *pdev, struct wl_private *lp ); +int wl_pci_dma_alloc_tx_packet( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT **desc ); +int wl_pci_dma_free_tx_packet( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT **desc ); +int wl_pci_dma_alloc_rx_packet( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT **desc ); +int wl_pci_dma_free_rx_packet( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT **desc ); +int wl_pci_dma_alloc_desc_and_buf( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT **desc, int size ); +int wl_pci_dma_free_desc_and_buf( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT **desc ); +int wl_pci_dma_alloc_desc( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT **desc ); +int wl_pci_dma_free_desc( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT **desc ); +int wl_pci_dma_alloc_buf( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT *desc, int size ); +int wl_pci_dma_free_buf( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT *desc ); + +void wl_pci_dma_hcf_reclaim_rx( struct wl_private *lp ); +#endif // ENABLE_DMA + +/******************************************************************************* + * PCI module function registration + ******************************************************************************/ +static struct pci_driver wl_driver = +{ + name: MODULE_NAME, + id_table: wl_pci_tbl, + probe: wl_pci_probe, + remove: __devexit_p(wl_pci_remove), + suspend: NULL, + resume: NULL, +}; + +/******************************************************************************* + * wl_adapter_init_module() + ******************************************************************************* + * + * DESCRIPTION: + * + * Called by init_module() to perform PCI-specific driver initialization. + * + * PARAMETERS: + * + * N/A + * + * RETURNS: + * + * 0 + * + ******************************************************************************/ +int wl_adapter_init_module( void ) +{ + int result; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_adapter_init_module()" ); + DBG_ENTER( DbgInfo ); + DBG_TRACE( DbgInfo, "wl_adapter_init_module() -- PCI\n" ); + + result = pci_register_driver( &wl_driver ); //;?replace with pci_module_init, Rubini pg 490 + //;? why not do something with the result + + DBG_LEAVE( DbgInfo ); + return 0; +} // wl_adapter_init_module +/*============================================================================*/ + +/******************************************************************************* + * wl_adapter_cleanup_module() + ******************************************************************************* + * + * DESCRIPTION: + * + * Called by cleanup_module() to perform PCI-specific driver cleanup. + * + * PARAMETERS: + * + * N/A + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_adapter_cleanup_module( void ) +{ + //;?how comes wl_adapter_cleanup_module is located in a seemingly pci specific module + DBG_FUNC( "wl_adapter_cleanup_module" ); + DBG_ENTER( DbgInfo ); + + //;?DBG_TRACE below feels like nearly redundant in the light of DBG_ENTER above + DBG_TRACE( DbgInfo, "wl_adapter_cleanup_module() -- PCI\n" ); + + pci_unregister_driver( &wl_driver ); + + DBG_LEAVE( DbgInfo ); + return; +} // wl_adapter_cleanup_module +/*============================================================================*/ + +/******************************************************************************* + * wl_adapter_insert() + ******************************************************************************* + * + * DESCRIPTION: + * + * Called by wl_pci_probe() to continue the process of device insertion. + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device structure + * + * RETURNS: + * + * TRUE or FALSE + * + ******************************************************************************/ +int wl_adapter_insert( struct net_device *dev ) +{ + int result = FALSE; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_adapter_insert" ); + DBG_ENTER( DbgInfo ); + + DBG_TRACE( DbgInfo, "wl_adapter_insert() -- PCI\n" ); + + if( dev == NULL ) { + DBG_ERROR( DbgInfo, "net_device pointer is NULL!!!\n" ); + } else if( dev->priv == NULL ) { + DBG_ERROR( DbgInfo, "wl_private pointer is NULL!!!\n" ); + } else if( wl_insert( dev ) ) { /* Perform remaining device initialization */ + result = TRUE; + } else { + DBG_TRACE( DbgInfo, "wl_insert() FAILED\n" ); + } + DBG_LEAVE( DbgInfo ); + return result; +} // wl_adapter_insert +/*============================================================================*/ + +/******************************************************************************* + * wl_adapter_open() + ******************************************************************************* + * + * DESCRIPTION: + * + * Open the device. + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device structure + * + * RETURNS: + * + * an HCF status code + * + ******************************************************************************/ +int wl_adapter_open( struct net_device *dev ) +{ + int result = 0; + int hcf_status = HCF_SUCCESS; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_adapter_open" ); + DBG_ENTER( DbgInfo ); + + DBG_TRACE( DbgInfo, "wl_adapter_open() -- PCI\n" ); + + hcf_status = wl_open( dev ); + + if( hcf_status != HCF_SUCCESS ) { + result = -ENODEV; + } + + DBG_LEAVE( DbgInfo ); + return result; +} // wl_adapter_open +/*============================================================================*/ + +/******************************************************************************* + * wl_adapter_close() + ******************************************************************************* + * + * DESCRIPTION: + * + * Close the device + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device structure + * + * RETURNS: + * + * 0 + * + ******************************************************************************/ +int wl_adapter_close( struct net_device *dev ) +{ + DBG_FUNC( "wl_adapter_close" ); + DBG_ENTER( DbgInfo ); + + DBG_TRACE( DbgInfo, "wl_adapter_close() -- PCI\n" ); + DBG_TRACE( DbgInfo, "%s: Shutting down adapter.\n", dev->name ); + + wl_close( dev ); + + DBG_LEAVE( DbgInfo ); + return 0; +} // wl_adapter_close +/*============================================================================*/ + +/******************************************************************************* + * wl_adapter_is_open() + ******************************************************************************* + * + * DESCRIPTION: + * + * Check whether this device is open. Returns + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device structure + * + * RETURNS: + * + * nonzero if device is open. + * + ******************************************************************************/ +int wl_adapter_is_open( struct net_device *dev ) +{ + /* This function is used in PCMCIA to check the status of the 'open' field + in the dev_link_t structure associated with a network device. There + doesn't seem to be an analog to this for PCI, and checking the status + contained in the net_device structure doesn't have the same effect. + For now, return TRUE, but find out if this is necessary for PCI. */ + + return TRUE; +} // wl_adapter_is_open +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_probe() + ******************************************************************************* + * + * DESCRIPTION: + * + * Registered in the pci_driver structure, this function is called when the + * PCI subsystem finds a new PCI device which matches the infomation contained + * in the pci_device_id table. + * + * PARAMETERS: + * + * pdev - a pointer to the device's pci_dev structure + * ent - this device's entry in the pci_device_id table + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int __devinit wl_pci_probe( struct pci_dev *pdev, + const struct pci_device_id *ent ) +{ + int result; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_pci_probe" ); + DBG_ENTER( DbgInfo ); + DBG_PRINT( "%s\n", VERSION_INFO ); + + result = wl_pci_setup( pdev ); + + DBG_LEAVE( DbgInfo ); + + return result; +} // wl_pci_probe +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_remove() + ******************************************************************************* + * + * DESCRIPTION: + * + * Registered in the pci_driver structure, this function is called when the + * PCI subsystem detects that a PCI device which matches the infomation + * contained in the pci_device_id table has been removed. + * + * PARAMETERS: + * + * pdev - a pointer to the device's pci_dev structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void __devexit wl_pci_remove(struct pci_dev *pdev) +{ + struct net_device *dev = NULL; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_pci_remove" ); + DBG_ENTER( DbgInfo ); + + /* Make sure the pci_dev pointer passed in is valid */ + if( pdev == NULL ) { + DBG_ERROR( DbgInfo, "PCI subsys passed in an invalid pci_dev pointer\n" ); + return; + } + + dev = (struct net_device *)pci_get_drvdata( pdev ); + if( dev == NULL ) { + DBG_ERROR( DbgInfo, "Could not retrieve net_device structure\n" ); + return; + } + + /* Perform device cleanup */ + wl_remove( dev ); + free_irq( dev->irq, dev ); + +#ifdef ENABLE_DMA + wl_pci_dma_free( pdev, (struct wl_private *)dev->priv ); +#endif + + wl_device_dealloc( dev ); + + DBG_LEAVE( DbgInfo ); + return; +} // wl_pci_remove +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_setup() + ******************************************************************************* + * + * DESCRIPTION: + * + * Called by wl_pci_probe() to begin a device's initialization process. + * + * PARAMETERS: + * + * pdev - a pointer to the device's pci_dev structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wl_pci_setup( struct pci_dev *pdev ) +{ + int result = 0; + struct net_device *dev = NULL; + struct wl_private *lp = NULL; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_pci_setup" ); + DBG_ENTER( DbgInfo ); + + /* Make sure the pci_dev pointer passed in is valid */ + if( pdev == NULL ) { + DBG_ERROR( DbgInfo, "PCI subsys passed in an invalid pci_dev pointer\n" ); + return -ENODEV; + } + + result = pci_enable_device( pdev ); + if( result != 0 ) { + DBG_ERROR( DbgInfo, "pci_enable_device() failed\n" ); + DBG_LEAVE( DbgInfo ); + return result; + } + + /* We found our device! Let's register it with the system */ + DBG_TRACE( DbgInfo, "Found our device, now registering\n" ); + dev = wl_device_alloc( ); + if( dev == NULL ) { + DBG_ERROR( DbgInfo, "Could not register device!!!\n" ); + DBG_LEAVE( DbgInfo ); + return -ENOMEM; + } + + /* Make sure that space was allocated for our private adapter struct */ + if( dev->priv == NULL ) { + DBG_ERROR( DbgInfo, "Private adapter struct was not allocated!!!\n" ); + DBG_LEAVE( DbgInfo ); + return -ENOMEM; + } + +#ifdef ENABLE_DMA + /* Allocate DMA Descriptors */ + if( wl_pci_dma_alloc( pdev, (struct wl_private *)dev->priv ) < 0 ) { + DBG_ERROR( DbgInfo, "Could not allocate DMA descriptor memory!!!\n" ); + DBG_LEAVE( DbgInfo ); + return -ENOMEM; + } +#endif + + /* Register our private adapter structure with PCI */ + pci_set_drvdata( pdev, dev ); + + /* Fill out bus specific information in the net_device struct */ + dev->irq = pdev->irq; + SET_MODULE_OWNER( dev ); + + DBG_TRACE( DbgInfo, "Device Base Address: %#03lx\n", pdev->resource[0].start ); + dev->base_addr = pdev->resource[0].start; + + /* Initialize our device here */ + if( !wl_adapter_insert( dev )) { + DBG_ERROR( DbgInfo, "wl_adapter_insert() FAILED!!!\n" ); + wl_device_dealloc( dev ); + DBG_LEAVE( DbgInfo ); + return -EINVAL; + } + + /* Register our ISR */ + DBG_TRACE( DbgInfo, "Registering ISR...\n" ); + + result = request_irq(dev->irq, wl_isr, SA_SHIRQ, dev->name, dev); + if( result ) { + DBG_WARNING( DbgInfo, "Could not register ISR!!!\n" ); + DBG_LEAVE( DbgInfo ); + return result; + } + + /* Make sure interrupts are enabled properly for CardBus */ + lp = (struct wl_private *)dev->priv; + + if( lp->hcfCtx.IFB_BusType == CFG_NIC_BUS_TYPE_CARDBUS || + lp->hcfCtx.IFB_BusType == CFG_NIC_BUS_TYPE_PCI ) { + DBG_TRACE( DbgInfo, "This is a PCI/CardBus card, enable interrupts\n" ); + wl_pci_enable_cardbus_interrupts( pdev ); + } + + /* Enable bus mastering */ + pci_set_master( pdev ); + + DBG_LEAVE( DbgInfo ); + return 0; +} // wl_pci_setup +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_enable_cardbus_interrupts() + ******************************************************************************* + * + * DESCRIPTION: + * + * Called by wl_pci_setup() to enable interrupts on a CardBus device. This + * is done by writing bit 15 to the function event mask register. This + * CardBus-specific register is located in BAR2 (counting from BAR0), in memory + * space at byte offset 1f4 (7f4 for WARP). + * + * PARAMETERS: + * + * pdev - a pointer to the device's pci_dev structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_pci_enable_cardbus_interrupts( struct pci_dev *pdev ) +{ + u32 bar2_reg; + u32 mem_addr_bus; + u32 func_evt_mask_reg; + void *mem_addr_kern = NULL; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_pci_enable_cardbus_interrupts" ); + DBG_ENTER( DbgInfo ); + + /* Initialize to known bad values */ + bar2_reg = 0xdeadbeef; + mem_addr_bus = 0xdeadbeef; + + /* Read the BAR2 register; this register contains the base address of the + memory region where the function event mask register lives */ + pci_read_config_dword( pdev, PCI_BASE_ADDRESS_2, &bar2_reg ); + mem_addr_bus = bar2_reg & PCI_BASE_ADDRESS_MEM_MASK; + + /* Once the base address is obtained, remap the memory region to kernel + space so we can retrieve the register */ + mem_addr_kern = ioremap( mem_addr_bus, 0x200 ); + +#ifdef HERMES25 +#define REG_OFFSET 0x07F4 +#else +#define REG_OFFSET 0x01F4 +#endif // HERMES25 + +#define BIT15 0x8000 + + /* Retrieve the functional event mask register, enable interrupts by + setting Bit 15, and write back the value */ + func_evt_mask_reg = *(u32 *)( mem_addr_kern + REG_OFFSET ); + func_evt_mask_reg |= BIT15; + *(u32 *)( mem_addr_kern + REG_OFFSET ) = func_evt_mask_reg; + + /* Once complete, unmap the region and exit */ + iounmap( mem_addr_kern ); + + DBG_LEAVE( DbgInfo ); + return; +} // wl_pci_enable_cardbus_interrupts +/*============================================================================*/ + +#ifdef ENABLE_DMA +/******************************************************************************* + * wl_pci_dma_alloc() + ******************************************************************************* + * + * DESCRIPTION: + * + * Allocates all resources needed for PCI/CardBus DMA operation + * + * PARAMETERS: + * + * pdev - a pointer to the device's pci_dev structure + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wl_pci_dma_alloc( struct pci_dev *pdev, struct wl_private *lp ) +{ + int i; + int status = 0; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_pci_dma_alloc" ); + DBG_ENTER( DbgInfo ); + +// lp->dma.tx_rsc_ind = lp->dma.rx_rsc_ind = 0; +// +// /* Alloc for the Tx chain and its reclaim descriptor */ +// for( i = 0; i < NUM_TX_DESC; i++ ) { +// status = wl_pci_dma_alloc_tx_packet( pdev, lp, &lp->dma.tx_packet[i] ); +// if( status == 0 ) { +// DBG_PRINT( "lp->dma.tx_packet[%d] : 0x%p\n", i, lp->dma.tx_packet[i] ); +// DBG_PRINT( "lp->dma.tx_packet[%d]->next_desc_addr : 0x%p\n", i, lp->dma.tx_packet[i]->next_desc_addr ); +// lp->dma.tx_rsc_ind++; +// } else { +// DBG_ERROR( DbgInfo, "Could not alloc DMA Tx Packet\n" ); +// break; +// } +// } +// if( status == 0 ) { +// status = wl_pci_dma_alloc_desc( pdev, lp, &lp->dma.tx_reclaim_desc ); +// DBG_PRINT( "lp->dma.tx_reclaim_desc: 0x%p\n", lp->dma.tx_reclaim_desc ); +// } +// /* Alloc for the Rx chain and its reclaim descriptor */ +// if( status == 0 ) { +// for( i = 0; i < NUM_RX_DESC; i++ ) { +// status = wl_pci_dma_alloc_rx_packet( pdev, lp, &lp->dma.rx_packet[i] ); +// if( status == 0 ) { +// DBG_PRINT( "lp->dma.rx_packet[%d] : 0x%p\n", i, lp->dma.rx_packet[i] ); +// DBG_PRINT( "lp->dma.rx_packet[%d]->next_desc_addr : 0x%p\n", i, lp->dma.rx_packet[i]->next_desc_addr ); +// lp->dma.rx_rsc_ind++; +// } else { +// DBG_ERROR( DbgInfo, "Could not alloc DMA Rx Packet\n" ); +// break; +// } +// } +// } +// if( status == 0 ) { +// status = wl_pci_dma_alloc_desc( pdev, lp, &lp->dma.rx_reclaim_desc ); +// DBG_PRINT( "lp->dma.rx_reclaim_desc: 0x%p\n", lp->dma.rx_reclaim_desc ); +// } +// /* Store status, as host should not call HCF functions if this fails */ +// lp->dma.status = status; //;?all useages of dma.status have been commented out +// DBG_LEAVE( DbgInfo ); + return status; +} // wl_pci_dma_alloc +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_dma_free() + ******************************************************************************* + * + * DESCRIPTION: + * + * Deallocated all resources needed for PCI/CardBus DMA operation + * + * PARAMETERS: + * + * pdev - a pointer to the device's pci_dev structure + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wl_pci_dma_free( struct pci_dev *pdev, struct wl_private *lp ) +{ + int i; + int status = 0; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_pci_dma_free" ); + DBG_ENTER( DbgInfo ); + + /* Reclaim all Rx packets that were handed over to the HCF */ + /* Do I need to do this? Before this free is called, I've already disabled + the port which will call wl_pci_dma_hcf_reclaim */ + //if( lp->dma.status == 0 ) + //{ + // wl_pci_dma_hcf_reclaim( lp ); + //} + + /* Free everything needed for DMA Rx */ + for( i = 0; i < NUM_RX_DESC; i++ ) { + if( lp->dma.rx_packet[i] ) { + status = wl_pci_dma_free_rx_packet( pdev, lp, &lp->dma.rx_packet[i] ); + if( status != 0 ) { + DBG_WARNING( DbgInfo, "Problem freeing Rx packet\n" ); + } + } + } + lp->dma.rx_rsc_ind = 0; + + if( lp->dma.rx_reclaim_desc ) { + status = wl_pci_dma_free_desc( pdev, lp, &lp->dma.rx_reclaim_desc ); + if( status != 0 ) { + DBG_WARNING( DbgInfo, "Problem freeing Rx reclaim descriptor\n" ); + } + } + + /* Free everything needed for DMA Tx */ + for( i = 0; i < NUM_TX_DESC; i++ ) { + if( lp->dma.tx_packet[i] ) { + status = wl_pci_dma_free_tx_packet( pdev, lp, &lp->dma.tx_packet[i] ); + if( status != 0 ) { + DBG_WARNING( DbgInfo, "Problem freeing Tx packet\n" ); + } + } + } + lp->dma.tx_rsc_ind = 0; + + if( lp->dma.tx_reclaim_desc ) { + status = wl_pci_dma_free_desc( pdev, lp, &lp->dma.tx_reclaim_desc ); + if( status != 0 ) { + DBG_WARNING( DbgInfo, "Problem freeing Tx reclaim descriptor\n" ); + } + } + + DBG_LEAVE( DbgInfo ); + return status; +} // wl_pci_dma_free + +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_dma_alloc_tx_packet() + ******************************************************************************* + * + * DESCRIPTION: + * + * Allocates a single Tx packet, consisting of several descriptors and + * buffers. Data to transmit is first copied into the 'payload' buffer + * before being transmitted. + * + * PARAMETERS: + * + * pdev - a pointer to the device's pci_dev structure + * lp - the device's private adapter structure + * desc - a pointer which will reference the descriptor to be alloc'd. + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wl_pci_dma_alloc_tx_packet( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT **desc ) +{ +// int status = 0; +// /*------------------------------------------------------------------------*/ +// +// if( desc == NULL ) { +// status = -EFAULT; +// } +// if( status == 0 ) { +// status = wl_pci_dma_alloc_desc_and_buf( pdev, lp, desc, +// HCF_DMA_TX_BUF1_SIZE ); +// +// if( status == 0 ) { +// status = wl_pci_dma_alloc_desc_and_buf( pdev, lp, +// &( (*desc)->next_desc_addr ), +// HCF_MAX_PACKET_SIZE ); +// } +// } +// if( status == 0 ) { +// (*desc)->next_desc_phys_addr = (*desc)->next_desc_addr->desc_phys_addr; +// } +// return status; +} // wl_pci_dma_alloc_tx_packet +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_dma_free_tx_packet() + ******************************************************************************* + * + * DESCRIPTION: + * + * Frees a single Tx packet, described in the corresponding alloc function. + * + * PARAMETERS: + * + * pdev - a pointer to the device's pci_dev structure + * lp - the device's private adapter structure + * desc - a pointer which will reference the descriptor to be alloc'd. + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wl_pci_dma_free_tx_packet( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT **desc ) +{ + int status = 0; + /*------------------------------------------------------------------------*/ + + if( *desc == NULL ) { + DBG_PRINT( "Null descriptor\n" ); + status = -EFAULT; + } + //;?the "limited" NDIS strategy, assuming a frame consists ALWAYS out of 2 + //descriptors, make this robust + if( status == 0 && (*desc)->next_desc_addr ) { + status = wl_pci_dma_free_desc_and_buf( pdev, lp, &(*desc)->next_desc_addr ); + } + if( status == 0 ) { + status = wl_pci_dma_free_desc_and_buf( pdev, lp, desc ); + } + return status; +} // wl_pci_dma_free_tx_packet +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_dma_alloc_rx_packet() + ******************************************************************************* + * + * DESCRIPTION: + * + * Allocates a single Rx packet, consisting of two descriptors and one + * contiguous buffer. THe buffer starts with the hermes-specific header. + * One descriptor points at the start, the other at offset 0x3a of the + * buffer. + * + * PARAMETERS: + * + * pdev - a pointer to the device's pci_dev structure + * lp - the device's private adapter structure + * desc - a pointer which will reference the descriptor to be alloc'd. + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wl_pci_dma_alloc_rx_packet( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT **desc ) +{ + int status = 0; + DESC_STRCT *p; + /*------------------------------------------------------------------------*/ + +// if( desc == NULL ) { +// status = -EFAULT; +// } +// //;?the "limited" NDIS strategy, assuming a frame consists ALWAYS out of 2 +// //descriptors, make this robust +// if( status == 0 ) { +// status = wl_pci_dma_alloc_desc( pdev, lp, desc ); +// } +// if( status == 0 ) { +// status = wl_pci_dma_alloc_buf( pdev, lp, *desc, HCF_MAX_PACKET_SIZE ); +// } +// if( status == 0 ) { +// status = wl_pci_dma_alloc_desc( pdev, lp, &p ); +// } +// if( status == 0 ) { +// /* Size of 1st descriptor becomes 0x3a bytes */ +// SET_BUF_SIZE( *desc, HCF_DMA_RX_BUF1_SIZE ); +// +// /* Make 2nd descriptor point at offset 0x3a of the buffer */ +// SET_BUF_SIZE( p, ( HCF_MAX_PACKET_SIZE - HCF_DMA_RX_BUF1_SIZE )); +// p->buf_addr = (*desc)->buf_addr + HCF_DMA_RX_BUF1_SIZE; +// p->buf_phys_addr = (*desc)->buf_phys_addr + HCF_DMA_RX_BUF1_SIZE; +// p->next_desc_addr = NULL; +// +// /* Chain 2nd descriptor to 1st descriptor */ +// (*desc)->next_desc_addr = p; +// (*desc)->next_desc_phys_addr = p->desc_phys_addr; +// } + + return status; +} // wl_pci_dma_alloc_rx_packet +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_dma_free_rx_packet() + ******************************************************************************* + * + * DESCRIPTION: + * + * Frees a single Rx packet, described in the corresponding alloc function. + * + * PARAMETERS: + * + * pdev - a pointer to the device's pci_dev structure + * lp - the device's private adapter structure + * desc - a pointer which will reference the descriptor to be alloc'd. + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wl_pci_dma_free_rx_packet( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT **desc ) +{ + int status = 0; + DESC_STRCT *p; + /*------------------------------------------------------------------------*/ + + if( *desc == NULL ) { + status = -EFAULT; + } + if( status == 0 ) { + p = (*desc)->next_desc_addr; + + /* Free the 2nd descriptor */ + if( p != NULL ) { + p->buf_addr = NULL; + p->buf_phys_addr = 0; + + status = wl_pci_dma_free_desc( pdev, lp, &p ); + } + } + + /* Free the buffer and 1st descriptor */ + if( status == 0 ) { + SET_BUF_SIZE( *desc, HCF_MAX_PACKET_SIZE ); + status = wl_pci_dma_free_desc_and_buf( pdev, lp, desc ); + } + return status; +} // wl_pci_dma_free_rx_packet +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_dma_alloc_desc_and_buf() + ******************************************************************************* + * + * DESCRIPTION: + * + * Allocates a DMA descriptor and buffer, and associates them with one + * another. + * + * PARAMETERS: + * + * pdev - a pointer to the device's pci_dev structure + * lp - the device's private adapter structure + * desc - a pointer which will reference the descriptor to be alloc'd + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wl_pci_dma_alloc_desc_and_buf( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT **desc, int size ) +{ + int status = 0; + /*------------------------------------------------------------------------*/ + +// if( desc == NULL ) { +// status = -EFAULT; +// } +// if( status == 0 ) { +// status = wl_pci_dma_alloc_desc( pdev, lp, desc ); +// +// if( status == 0 ) { +// status = wl_pci_dma_alloc_buf( pdev, lp, *desc, size ); +// } +// } + return status; +} // wl_pci_dma_alloc_desc_and_buf +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_dma_free_desc_and_buf() + ******************************************************************************* + * + * DESCRIPTION: + * + * Frees a DMA descriptor and associated buffer. + * + * PARAMETERS: + * + * pdev - a pointer to the device's pci_dev structure + * lp - the device's private adapter structure + * desc - a pointer which will reference the descriptor to be alloc'd + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wl_pci_dma_free_desc_and_buf( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT **desc ) +{ + int status = 0; + /*------------------------------------------------------------------------*/ + + if( desc == NULL ) { + status = -EFAULT; + } + if( status == 0 && *desc == NULL ) { + status = -EFAULT; + } + if( status == 0 ) { + status = wl_pci_dma_free_buf( pdev, lp, *desc ); + + if( status == 0 ) { + status = wl_pci_dma_free_desc( pdev, lp, desc ); + } + } + return status; +} // wl_pci_dma_free_desc_and_buf +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_dma_alloc_desc() + ******************************************************************************* + * + * DESCRIPTION: + * + * Allocates one DMA descriptor in cache coherent memory. + * + * PARAMETERS: + * + * pdev - a pointer to the device's pci_dev structure + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wl_pci_dma_alloc_desc( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT **desc ) +{ +// int status = 0; +// dma_addr_t pa; +// /*------------------------------------------------------------------------*/ +// +// DBG_FUNC( "wl_pci_dma_alloc_desc" ); +// DBG_ENTER( DbgInfo ); +// +// if( desc == NULL ) { +// status = -EFAULT; +// } +// if( status == 0 ) { +// *desc = pci_alloc_consistent( pdev, sizeof( DESC_STRCT ), &pa ); +// } +// if( *desc == NULL ) { +// DBG_ERROR( DbgInfo, "pci_alloc_consistent() failed\n" ); +// status = -ENOMEM; +// } else { +// memset( *desc, 0, sizeof( DESC_STRCT )); +// (*desc)->desc_phys_addr = cpu_to_le32( pa ); +// } +// DBG_LEAVE( DbgInfo ); +// return status; +} // wl_pci_dma_alloc_desc +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_dma_free_desc() + ******************************************************************************* + * + * DESCRIPTION: + * + * Frees one DMA descriptor in cache coherent memory. + * + * PARAMETERS: + * + * pdev - a pointer to the device's pci_dev structure + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wl_pci_dma_free_desc( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT **desc ) +{ + int status = 0; + /*------------------------------------------------------------------------*/ + + if( *desc == NULL ) { + status = -EFAULT; + } + if( status == 0 ) { + pci_free_consistent( pdev, sizeof( DESC_STRCT ), *desc, + (*desc)->desc_phys_addr ); + } + *desc = NULL; + return status; +} // wl_pci_dma_free_desc +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_dma_alloc_buf() + ******************************************************************************* + * + * DESCRIPTION: + * + * Allocates one DMA buffer in cache coherent memory, and associates a DMA + * descriptor with this buffer. + * + * PARAMETERS: + * + * pdev - a pointer to the device's pci_dev structure + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wl_pci_dma_alloc_buf( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT *desc, int size ) +{ + int status = 0; + dma_addr_t pa; + /*------------------------------------------------------------------------*/ + +// DBG_FUNC( "wl_pci_dma_alloc_buf" ); +// DBG_ENTER( DbgInfo ); +// +// if( desc == NULL ) { +// status = -EFAULT; +// } +// if( status == 0 && desc->buf_addr != NULL ) { +// status = -EFAULT; +// } +// if( status == 0 ) { +// desc->buf_addr = pci_alloc_consistent( pdev, size, &pa ); +// } +// if( desc->buf_addr == NULL ) { +// DBG_ERROR( DbgInfo, "pci_alloc_consistent() failed\n" ); +// status = -ENOMEM; +// } else { +// desc->buf_phys_addr = cpu_to_le32( pa ); +// SET_BUF_SIZE( desc, size ); +// } +// DBG_LEAVE( DbgInfo ); + return status; +} // wl_pci_dma_alloc_buf +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_dma_free_buf() + ******************************************************************************* + * + * DESCRIPTION: + * + * Allocates one DMA buffer in cache coherent memory, and associates a DMA + * descriptor with this buffer. + * + * PARAMETERS: + * + * pdev - a pointer to the device's pci_dev structure + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wl_pci_dma_free_buf( struct pci_dev *pdev, struct wl_private *lp, + DESC_STRCT *desc ) +{ + int status = 0; + /*------------------------------------------------------------------------*/ + + if( desc == NULL ) { + status = -EFAULT; + } + if( status == 0 && desc->buf_addr == NULL ) { + status = -EFAULT; + } + if( status == 0 ) { + pci_free_consistent( pdev, GET_BUF_SIZE( desc ), desc->buf_addr, + desc->buf_phys_addr ); + + desc->buf_addr = 0; + desc->buf_phys_addr = 0; + SET_BUF_SIZE( desc, 0 ); + } + return status; +} // wl_pci_dma_free_buf +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_dma_hcf_supply() + ******************************************************************************* + * + * DESCRIPTION: + * + * Supply HCF with DMA-related resources. These consist of: + * - buffers and descriptors for receive purposes + * - one 'reclaim' descriptor for the transmit path, used to fulfill a + * certain H25 DMA engine requirement + * - one 'reclaim' descriptor for the receive path, used to fulfill a + * certain H25 DMA engine requirement + * + * This function is called at start-of-day or at re-initialization. + * + * PARAMETERS: + * + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +void wl_pci_dma_hcf_supply( struct wl_private *lp ) +{ + int i; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_pci_dma_hcf_supply" ); + DBG_ENTER( DbgInfo ); + + //if( lp->dma.status == 0 ); + //{ + /* Hand over the Rx/Tx reclaim descriptors to the HCF */ + if( lp->dma.tx_reclaim_desc ) { + DBG_PRINT( "lp->dma.tx_reclaim_desc: 0x%p\n", lp->dma.tx_reclaim_desc ); + hcf_dma_tx_put( &lp->hcfCtx, lp->dma.tx_reclaim_desc, 0 ); + lp->dma.tx_reclaim_desc = NULL; + DBG_PRINT( "lp->dma.tx_reclaim_desc: 0x%p\n", lp->dma.tx_reclaim_desc ); + } + if( lp->dma.rx_reclaim_desc ) { + DBG_PRINT( "lp->dma.rx_reclaim_desc: 0x%p\n", lp->dma.rx_reclaim_desc ); + hcf_dma_rx_put( &lp->hcfCtx, lp->dma.rx_reclaim_desc ); + lp->dma.rx_reclaim_desc = NULL; + DBG_PRINT( "lp->dma.rx_reclaim_desc: 0x%p\n", lp->dma.rx_reclaim_desc ); + } + /* Hand over the Rx descriptor chain to the HCF */ + for( i = 0; i < NUM_RX_DESC; i++ ) { + DBG_PRINT( "lp->dma.rx_packet[%d]: 0x%p\n", i, lp->dma.rx_packet[i] ); + hcf_dma_rx_put( &lp->hcfCtx, lp->dma.rx_packet[i] ); + lp->dma.rx_packet[i] = NULL; + DBG_PRINT( "lp->dma.rx_packet[%d]: 0x%p\n", i, lp->dma.rx_packet[i] ); + } + //} + + DBG_LEAVE( DbgInfo ); + return; +} // wl_pci_dma_hcf_supply +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_dma_hcf_reclaim() + ******************************************************************************* + * + * DESCRIPTION: + * + * Return DMA-related resources from the HCF. These consist of: + * - buffers and descriptors for receive purposes + * - buffers and descriptors for transmit purposes + * - one 'reclaim' descriptor for the transmit path, used to fulfill a + * certain H25 DMA engine requirement + * - one 'reclaim' descriptor for the receive path, used to fulfill a + * certain H25 DMA engine requirement + * + * This function is called at end-of-day or at re-initialization. + * + * PARAMETERS: + * + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +void wl_pci_dma_hcf_reclaim( struct wl_private *lp ) +{ + int i; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_pci_dma_hcf_reclaim" ); + DBG_ENTER( DbgInfo ); + + wl_pci_dma_hcf_reclaim_rx( lp ); + for( i = 0; i < NUM_RX_DESC; i++ ) { + DBG_PRINT( "rx_packet[%d] 0x%p\n", i, lp->dma.rx_packet[i] ); +// if( lp->dma.rx_packet[i] == NULL ) { +// DBG_PRINT( "wl_pci_dma_hcf_reclaim: rx_packet[%d] NULL\n", i ); +// } + } + + wl_pci_dma_hcf_reclaim_tx( lp ); + for( i = 0; i < NUM_TX_DESC; i++ ) { + DBG_PRINT( "tx_packet[%d] 0x%p\n", i, lp->dma.tx_packet[i] ); +// if( lp->dma.tx_packet[i] == NULL ) { +// DBG_PRINT( "wl_pci_dma_hcf_reclaim: tx_packet[%d] NULL\n", i ); +// } + } + + DBG_LEAVE( DbgInfo ); + return; +} // wl_pci_dma_hcf_reclaim +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_dma_hcf_reclaim_rx() + ******************************************************************************* + * + * DESCRIPTION: + * + * Reclaim Rx packets that have already been processed by the HCF. + * + * PARAMETERS: + * + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +void wl_pci_dma_hcf_reclaim_rx( struct wl_private *lp ) +{ + int i; + DESC_STRCT *p; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_pci_dma_hcf_reclaim_rx" ); + DBG_ENTER( DbgInfo ); + + //if( lp->dma.status == 0 ) + //{ + while ( ( p = hcf_dma_rx_get( &lp->hcfCtx ) ) != NULL ) { + if( p && p->buf_addr == NULL ) { + /* A reclaim descriptor is being given back by the HCF. Reclaim + descriptors have a NULL buf_addr */ + lp->dma.rx_reclaim_desc = p; + DBG_PRINT( "reclaim_descriptor: 0x%p\n", p ); + continue; + } + for( i = 0; i < NUM_RX_DESC; i++ ) { + if( lp->dma.rx_packet[i] == NULL ) { + break; + } + } + /* An Rx buffer descriptor is being given back by the HCF */ + lp->dma.rx_packet[i] = p; + lp->dma.rx_rsc_ind++; + DBG_PRINT( "rx_packet[%d] 0x%p\n", i, lp->dma.rx_packet[i] ); + } + //} + DBG_LEAVE( DbgInfo ); +} // wl_pci_dma_hcf_reclaim_rx +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_dma_get_tx_packet() + ******************************************************************************* + * + * DESCRIPTION: + * + * Obtains a Tx descriptor from the chain to use for Tx. + * + * PARAMETERS: + * + * lp - a pointer to the device's wl_private structure. + * + * RETURNS: + * + * A pointer to the retrieved descriptor + * + ******************************************************************************/ +DESC_STRCT * wl_pci_dma_get_tx_packet( struct wl_private *lp ) +{ + int i; + DESC_STRCT *desc = NULL; + /*------------------------------------------------------------------------*/ + + for( i = 0; i < NUM_TX_DESC; i++ ) { + if( lp->dma.tx_packet[i] ) { + break; + } + } + + if( i != NUM_TX_DESC ) { + desc = lp->dma.tx_packet[i]; + + lp->dma.tx_packet[i] = NULL; + lp->dma.tx_rsc_ind--; + + memset( desc->buf_addr, 0, HCF_DMA_TX_BUF1_SIZE ); + } + + return desc; +} // wl_pci_dma_get_tx_packet +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_dma_put_tx_packet() + ******************************************************************************* + * + * DESCRIPTION: + * + * Returns a Tx descriptor to the chain. + * + * PARAMETERS: + * + * lp - a pointer to the device's wl_private structure. + * desc - a pointer to the descriptor to return. + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_pci_dma_put_tx_packet( struct wl_private *lp, DESC_STRCT *desc ) +{ + int i; + /*------------------------------------------------------------------------*/ + + for( i = 0; i < NUM_TX_DESC; i++ ) { + if( lp->dma.tx_packet[i] == NULL ) { + break; + } + } + + if( i != NUM_TX_DESC ) { + lp->dma.tx_packet[i] = desc; + lp->dma.tx_rsc_ind++; + } +} // wl_pci_dma_put_tx_packet +/*============================================================================*/ + +/******************************************************************************* + * wl_pci_dma_hcf_reclaim_tx() + ******************************************************************************* + * + * DESCRIPTION: + * + * Reclaim Tx packets that have either been processed by the HCF due to a + * port disable or a Tx completion. + * + * PARAMETERS: + * + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +void wl_pci_dma_hcf_reclaim_tx( struct wl_private *lp ) +{ + int i; + DESC_STRCT *p; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_pci_dma_hcf_reclaim_tx" ); + DBG_ENTER( DbgInfo ); + + //if( lp->dma.status == 0 ) + //{ + while ( ( p = hcf_dma_tx_get( &lp->hcfCtx ) ) != NULL ) { + + if( p != NULL && p->buf_addr == NULL ) { + /* A Reclaim descriptor is being given back by the HCF. Reclaim + descriptors have a NULL buf_addr */ + lp->dma.tx_reclaim_desc = p; + DBG_PRINT( "reclaim_descriptor: 0x%p\n", p ); + continue; + } + for( i = 0; i < NUM_TX_DESC; i++ ) { + if( lp->dma.tx_packet[i] == NULL ) { + break; + } + } + /* An Rx buffer descriptor is being given back by the HCF */ + lp->dma.tx_packet[i] = p; + lp->dma.tx_rsc_ind++; + DBG_PRINT( "tx_packet[%d] 0x%p\n", i, lp->dma.tx_packet[i] ); + } + //} + + if( lp->netif_queue_on == FALSE ) { + netif_wake_queue( lp->dev ); + WL_WDS_NETIF_WAKE_QUEUE( lp ); + lp->netif_queue_on = TRUE; + } + DBG_LEAVE( DbgInfo ); + return; +} // wl_pci_dma_hcf_reclaim_tx +/*============================================================================*/ +#endif // ENABLE_DMA diff --git a/drivers/staging/wlags49_h2/wl_pci.h b/drivers/staging/wlags49_h2/wl_pci.h new file mode 100644 index 000000000000..32ea7b913ec8 --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_pci.h @@ -0,0 +1,126 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * Header describing information required for the driver to support PCI. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/07/19 08:16:15 $ + * $Revision: 1.2 $ + * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_pci.h,v $ + * + ******************************************************************************/ + + + + +#ifndef __WL_PCI_H__ +#define __WL_PCI_H__ + + + + +/******************************************************************************* + * constant definitions + ******************************************************************************/ +#define WL_LKM_PCI_VENDOR_ID 0x11C1 // Lucent Microelectronics +#define WL_LKM_PCI_DEVICE_ID_0 0xAB30 // Mini PCI +#define WL_LKM_PCI_DEVICE_ID_1 0xAB34 // Mini PCI +#define WL_LKM_PCI_DEVICE_ID_2 0xAB11 // WARP CardBus + + + + +/******************************************************************************* + * function prototypes + ******************************************************************************/ +int wl_adapter_init_module( void ); + +void wl_adapter_cleanup_module( void ); + +int wl_adapter_insert( struct net_device *dev ); + +int wl_adapter_open( struct net_device *dev ); + +int wl_adapter_close( struct net_device *dev ); + +int wl_adapter_is_open( struct net_device *dev ); + + +#ifdef ENABLE_DMA + +void wl_pci_dma_hcf_supply( struct wl_private *lp ); + +void wl_pci_dma_hcf_reclaim( struct wl_private *lp ); + +DESC_STRCT * wl_pci_dma_get_tx_packet( struct wl_private *lp ); + +void wl_pci_dma_put_tx_packet( struct wl_private *lp, DESC_STRCT *desc ); + +void wl_pci_dma_hcf_reclaim_tx( struct wl_private *lp ); + +#endif // ENABLE_DMA + + +#endif // __WL_PCI_H__ diff --git a/drivers/staging/wlags49_h2/wl_priv.c b/drivers/staging/wlags49_h2/wl_priv.c new file mode 100644 index 000000000000..3a0844582f45 --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_priv.c @@ -0,0 +1,2095 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * This file defines handling routines for the private IOCTLs + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/08/03 11:39:39 $ + * $Revision: 1.5 $ + * $Source: /usr/local/cvs/wl_lkm/wireless/wl_priv.c,v $ + * + ******************************************************************************/ + + + + +/******************************************************************************* + * include files + ******************************************************************************/ +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +int wvlan_uil_connect( struct uilreq *urq, struct wl_private *lp ); +int wvlan_uil_disconnect( struct uilreq *urq, struct wl_private *lp ); +int wvlan_uil_action( struct uilreq *urq, struct wl_private *lp ); +int wvlan_uil_block( struct uilreq *urq, struct wl_private *lp ); +int wvlan_uil_unblock( struct uilreq *urq, struct wl_private *lp ); +int wvlan_uil_send_diag_msg( struct uilreq *urq, struct wl_private *lp ); +int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ); +int wvlan_uil_get_info( struct uilreq *urq, struct wl_private *lp ); + +int cfg_driver_info( struct uilreq *urq, struct wl_private *lp ); +int cfg_driver_identity( struct uilreq *urq, struct wl_private *lp ); + + +/******************************************************************************* + * global variables + ******************************************************************************/ +#if DBG +extern dbg_info_t *DbgInfo; +#endif // DBG + + + + +/* If USE_UIL is not defined, then none of the UIL Interface code below will + be included in the build */ +#ifdef USE_UIL + +/******************************************************************************* + * wvlan_uil() + ******************************************************************************* + * + * DESCRIPTION: + * + * The handler function for the UIL interface. + * + * PARAMETERS: + * + * urq - a pointer to the UIL request buffer + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wvlan_uil( struct uilreq *urq, struct wl_private *lp ) +{ + int ioctl_ret = 0; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wvlan_uil" ); + DBG_ENTER( DbgInfo ); + + switch( urq->command ) { + case UIL_FUN_CONNECT: + DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_CONNECT\n"); + ioctl_ret = wvlan_uil_connect( urq, lp ); + break; + case UIL_FUN_DISCONNECT: + DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_DISCONNECT\n"); + ioctl_ret = wvlan_uil_disconnect( urq, lp ); + break; + case UIL_FUN_ACTION: + DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_ACTION\n" ); + ioctl_ret = wvlan_uil_action( urq, lp ); + break; + case UIL_FUN_SEND_DIAG_MSG: + DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_SEND_DIAG_MSG\n"); + ioctl_ret = wvlan_uil_send_diag_msg( urq, lp ); + break; + case UIL_FUN_GET_INFO: + DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_GET_INFO\n"); + ioctl_ret = wvlan_uil_get_info( urq, lp ); + break; + case UIL_FUN_PUT_INFO: + DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- WVLAN2_UIL_PUT_INFO\n"); + ioctl_ret = wvlan_uil_put_info( urq, lp ); + break; + default: + DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_UIL -- UNSUPPORTED UIL CODE: 0x%X", urq->command ); + ioctl_ret = -EOPNOTSUPP; + break; + } + DBG_LEAVE( DbgInfo ); + return ioctl_ret; +} // wvlan_uil +/*============================================================================*/ + + + + +/******************************************************************************* + * wvlan_uil_connect() + ******************************************************************************* + * + * DESCRIPTION: + * + * Connect to the UIL in order to make a request. + * + * PARAMETERS: + * + * urq - a pointer to the UIL request buffer + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * UIL_SUCCESS + * UIL_ERR_xxx value otherwise + * + ******************************************************************************/ +int wvlan_uil_connect( struct uilreq *urq, struct wl_private *lp ) +{ + int result = 0; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wvlan_uil_connect" ); + DBG_ENTER( DbgInfo ); + + + if( !( lp->flags & WVLAN2_UIL_CONNECTED )) { + lp->flags |= WVLAN2_UIL_CONNECTED; + urq->hcfCtx = &( lp->hcfCtx ); + urq->result = UIL_SUCCESS; + } else { + DBG_WARNING( DbgInfo, "UIL_ERR_IN_USE\n" ); + urq->result = UIL_ERR_IN_USE; + } + + DBG_LEAVE( DbgInfo ); + return result; +} // wvlan_uil_connect +/*============================================================================*/ + + + + +/******************************************************************************* + * wvlan_uil_disconnect() + ******************************************************************************* + * + * DESCRIPTION: + * + * Disonnect from the UIL after a request has been completed. + * + * PARAMETERS: + * + * urq - a pointer to the UIL request buffer + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * UIL_SUCCESS + * UIL_ERR_xxx value otherwise + * + ******************************************************************************/ +int wvlan_uil_disconnect( struct uilreq *urq, struct wl_private *lp ) +{ + int result = 0; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wvlan_uil_disconnect" ); + DBG_ENTER( DbgInfo ); + + + if( urq->hcfCtx == &( lp->hcfCtx )) { + if (lp->flags & WVLAN2_UIL_CONNECTED) { + lp->flags &= ~WVLAN2_UIL_CONNECTED; + /* + if (lp->flags & WVLAN2_UIL_BUSY) { + lp->flags &= ~WVLAN2_UIL_BUSY; + netif_start_queue(lp->dev); + } + */ + } + + urq->hcfCtx = NULL; + urq->result = UIL_SUCCESS; + } else { + DBG_ERROR( DbgInfo, "UIL_ERR_WRONG_IFB\n" ); + urq->result = UIL_ERR_WRONG_IFB; + } + + DBG_LEAVE( DbgInfo ); + return result; +} // wvlan_uil_disconnect +/*============================================================================*/ + + + + +/******************************************************************************* + * wvlan_uil_action() + ******************************************************************************* + * + * DESCRIPTION: + * + * Handler for the UIL_ACT_xxx subcodes associated with UIL_FUN_ACTION + * + * PARAMETERS: + * + * urq - a pointer to the UIL request buffer + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * UIL_SUCCESS + * UIL_ERR_xxx value otherwise + * + ******************************************************************************/ +int wvlan_uil_action( struct uilreq *urq, struct wl_private *lp ) +{ + int result = 0; + ltv_t *ltv; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wvlan_uil_action" ); + DBG_ENTER( DbgInfo ); + + + if( urq->hcfCtx == &( lp->hcfCtx )) { + /* Make sure there's an LTV in the request buffer */ + ltv = (ltv_t *)urq->data; + if( ltv != NULL ) { + /* Switch on the Type field of the LTV contained in the request + buffer */ + switch( ltv->typ ) { + case UIL_ACT_BLOCK: + DBG_TRACE( DbgInfo, "UIL_ACT_BLOCK\n" ); + result = wvlan_uil_block( urq, lp ); + break; + case UIL_ACT_UNBLOCK: + DBG_TRACE( DbgInfo, "UIL_ACT_UNBLOCK\n" ); + result = wvlan_uil_unblock( urq, lp ); + break; + case UIL_ACT_SCAN: + DBG_TRACE( DbgInfo, "UIL_ACT_SCAN\n" ); + urq->result = hcf_action( &( lp->hcfCtx ), MDD_ACT_SCAN ); + break; + case UIL_ACT_APPLY: + DBG_TRACE( DbgInfo, "UIL_ACT_APPLY\n" ); + urq->result = wl_apply( lp ); + break; + case UIL_ACT_RESET: + DBG_TRACE( DbgInfo, "UIL_ACT_RESET\n" ); + urq->result = wl_go( lp ); + break; + default: + DBG_WARNING( DbgInfo, "Unknown action code: 0x%x\n", ltv->typ ); + break; + } + } else { + DBG_ERROR( DbgInfo, "Bad LTV for this action\n" ); + urq->result = UIL_ERR_LEN; + } + } else { + DBG_ERROR( DbgInfo, "UIL_ERR_WRONG_IFB\n" ); + urq->result = UIL_ERR_WRONG_IFB; + } + + DBG_LEAVE( DbgInfo ); + return result; +} // wvlan_uil_action +/*============================================================================*/ + + + + +/******************************************************************************* + * wvlan_uil_block() + ******************************************************************************* + * + * DESCRIPTION: + * + * Sets a block in the driver to prevent access to the card by other + * processes. + * + * PARAMETERS: + * + * urq - a pointer to the UIL request buffer + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * UIL_SUCCESS + * UIL_ERR_xxx value otherwise + * + ******************************************************************************/ + +int wvlan_uil_block( struct uilreq *urq, struct wl_private *lp ) +{ + int result = 0; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wvlan_uil_block" ); + DBG_ENTER( DbgInfo ); + + if( urq->hcfCtx == &( lp->hcfCtx )) { + if( capable( CAP_NET_ADMIN )) { + lp->flags |= WVLAN2_UIL_BUSY; + netif_stop_queue(lp->dev); + WL_WDS_NETIF_STOP_QUEUE( lp ); + urq->result = UIL_SUCCESS; + } else { + DBG_ERROR( DbgInfo, "EPERM\n" ); + urq->result = UIL_FAILURE; + result = -EPERM; + } + } else { + DBG_ERROR( DbgInfo, "UIL_ERR_WRONG_IFB\n" ); + urq->result = UIL_ERR_WRONG_IFB; + } + + DBG_LEAVE( DbgInfo ); + return result; +} // wvlan_uil_block +/*============================================================================*/ + + + + +/******************************************************************************* + * wvlan_uil_unblock() + ******************************************************************************* + * + * DESCRIPTION: + * + * Unblocks the driver to restore access to the card by other processes. + * + * PARAMETERS: + * + * urq - a pointer to the UIL request buffer + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * UIL_SUCCESS + * UIL_ERR_xxx value otherwise + * + ******************************************************************************/ +int wvlan_uil_unblock( struct uilreq *urq, struct wl_private *lp ) +{ + int result = 0; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wvlan_uil_unblock" ); + DBG_ENTER( DbgInfo ); + + if( urq->hcfCtx == &( lp->hcfCtx )) { + if( capable( CAP_NET_ADMIN )) { + if (lp->flags & WVLAN2_UIL_BUSY) { + lp->flags &= ~WVLAN2_UIL_BUSY; + netif_wake_queue(lp->dev); + WL_WDS_NETIF_WAKE_QUEUE( lp ); + } + } else { + DBG_ERROR( DbgInfo, "EPERM\n" ); + urq->result = UIL_FAILURE; + result = -EPERM; + } + } else { + DBG_ERROR( DbgInfo, "UIL_ERR_WRONG_IFB\n" ); + urq->result = UIL_ERR_WRONG_IFB; + } + + DBG_LEAVE( DbgInfo ); + return result; +} // wvlan_uil_unblock +/*============================================================================*/ + + + + +/******************************************************************************* + * wvlan_uil_send_diag_msg() + ******************************************************************************* + * + * DESCRIPTION: + * + * Sends a diagnostic message to the card. + * + * PARAMETERS: + * + * urq - a pointer to the UIL request buffer + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * UIL_SUCCESS + * UIL_ERR_xxx value otherwise + * + ******************************************************************************/ +int wvlan_uil_send_diag_msg( struct uilreq *urq, struct wl_private *lp ) +{ + int result = 0; + DESC_STRCT Descp[1]; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wvlan_uil_send_diag_msg" ); + DBG_ENTER( DbgInfo ); + + if( urq->hcfCtx == &( lp->hcfCtx )) { + if( capable( CAP_NET_ADMIN )) { + if ((urq->data != NULL) && (urq->len != 0)) { + if (lp->hcfCtx.IFB_RscInd != 0) { + u_char *data; + + // Verify the user buffer + result = verify_area(VERIFY_READ, urq->data, urq->len); + if (result != 0) { + DBG_ERROR( DbgInfo, "verify_area failed, result: %d\n", result ); + urq->result = UIL_FAILURE; + DBG_LEAVE( DbgInfo ); + return result; + } + + if ((data = kmalloc(urq->len, GFP_KERNEL)) != NULL) { + memset( Descp, 0, sizeof( DESC_STRCT )); + memcpy( data, urq->data, urq->len ); + + Descp[0].buf_addr = (wci_bufp)data; + Descp[0].BUF_CNT = urq->len; + Descp[0].next_desc_addr = 0; // terminate list + + hcf_send_msg( &(lp->hcfCtx), &Descp[0], HCF_PORT_0 ); + kfree( data ); + } else { + DBG_ERROR( DbgInfo, "ENOMEM\n" ); + urq->result = UIL_FAILURE; + result = -ENOMEM; + DBG_LEAVE( DbgInfo ); + return result; + } + + } else { + urq->result = UIL_ERR_BUSY; + } + + } else { + urq->result = UIL_FAILURE; + } + } else { + DBG_ERROR( DbgInfo, "EPERM\n" ); + urq->result = UIL_FAILURE; + result = -EPERM; + } + } else { + DBG_ERROR( DbgInfo, "UIL_ERR_WRONG_IFB\n" ); + urq->result = UIL_ERR_WRONG_IFB; + } + + DBG_LEAVE( DbgInfo ); + return result; +} // wvlan_uil_send_diag_msg +/*============================================================================*/ + + +/******************************************************************************* + * wvlan_uil_put_info() + ******************************************************************************* + * + * DESCRIPTION: + * + * Sends a specific RID directly to the driver to set configuration info. + * + * PARAMETERS: + * + * urq - a pointer to the UIL request buffer + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * UIL_SUCCESS + * UIL_ERR_xxx value otherwise + * + ******************************************************************************/ +int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ) +{ + int result = 0; + ltv_t *pLtv; + bool_t ltvAllocated = FALSE; + ENCSTRCT sEncryption; + +#ifdef USE_WDS + hcf_16 hcfPort = HCF_PORT_0; +#endif /* USE_WDS */ + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wvlan_uil_put_info" ); + DBG_ENTER( DbgInfo ); + + + if( urq->hcfCtx == &( lp->hcfCtx )) { + if( capable( CAP_NET_ADMIN )) { + if(( urq->data != NULL ) && ( urq->len != 0 )) { + /* Make sure that we have at least a command and length to send. */ + if( urq->len < ( sizeof( hcf_16 ) * 2 )) { + urq->len = sizeof( lp->ltvRecord ); + urq->result = UIL_ERR_LEN; + DBG_ERROR( DbgInfo, "No Length/Type in LTV!!!\n" ); + DBG_ERROR( DbgInfo, "UIL_ERR_LEN\n" ); + DBG_LEAVE( DbgInfo ); + return result; + } + + /* Verify the user buffer */ + result = verify_area( VERIFY_READ, urq->data, urq->len ); + if( result != 0 ) { + urq->result = UIL_FAILURE; + DBG_ERROR( DbgInfo, "verify_area(), VERIFY_READ FAILED\n" ); + DBG_LEAVE( DbgInfo ); + return result; + } + + /* Get only the command and length information. */ + copy_from_user( &( lp->ltvRecord ), urq->data, sizeof( hcf_16 ) * 2 ); + + /* Make sure the incoming LTV record length is within the bounds of the + IOCTL length */ + if((( lp->ltvRecord.len + 1 ) * sizeof( hcf_16 )) > urq->len ) { + urq->len = sizeof( lp->ltvRecord ); + urq->result = UIL_ERR_LEN; + DBG_ERROR( DbgInfo, "UIL_ERR_LEN\n" ); + DBG_LEAVE( DbgInfo ); + return result; + } + + /* If the requested length is greater than the size of our local + LTV record, try to allocate it from the kernel stack. + Otherwise, we just use our local LTV record. */ + if( urq->len > sizeof( lp->ltvRecord )) { + if(( pLtv = (ltv_t *)kmalloc( urq->len, GFP_KERNEL )) != NULL ) { + ltvAllocated = TRUE; + } else { + DBG_ERROR( DbgInfo, "Alloc FAILED\n" ); + urq->len = sizeof( lp->ltvRecord ); + urq->result = UIL_ERR_LEN; + result = -ENOMEM; + DBG_LEAVE( DbgInfo ); + return result; + } + } else { + pLtv = &( lp->ltvRecord ); + } + + /* Copy the data from the user's buffer into the local LTV + record data area. */ + copy_from_user( pLtv, urq->data, urq->len ); + + + /* We need to snoop the commands to see if there is anything we + need to store for the purposes of a reset or start/stop + sequence. Perform endian translation as needed */ + switch( pLtv->typ ) { + case CFG_CNF_PORT_TYPE: + lp->PortType = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + case CFG_CNF_OWN_MAC_ADDR: + /* TODO: determine if we are going to store anything based on this */ + break; + case CFG_CNF_OWN_CHANNEL: + lp->Channel = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + /* CFG_CNF_OWN_SSID currently same as CNF_DESIRED_SSID. Do we + need seperate storage for this? */ + //case CFG_CNF_OWN_SSID: + case CFG_CNF_OWN_ATIM_WINDOW: + lp->atimWindow = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + case CFG_CNF_SYSTEM_SCALE: + lp->DistanceBetweenAPs = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + + case CFG_CNF_MAX_DATA_LEN: + /* TODO: determine if we are going to store anything based + on this */ + break; + case CFG_CNF_PM_ENABLED: + lp->PMEnabled = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + case CFG_CNF_MCAST_RX: + lp->MulticastReceive = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + case CFG_CNF_MAX_SLEEP_DURATION: + lp->MaxSleepDuration = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + case CFG_CNF_HOLDOVER_DURATION: + lp->holdoverDuration = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + case CFG_CNF_OWN_NAME: + memset( lp->StationName, 0, sizeof( lp->StationName )); + memcpy( (void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + case CFG_CNF_LOAD_BALANCING: + lp->loadBalancing = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + case CFG_CNF_MEDIUM_DISTRIBUTION: + lp->mediumDistribution = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; +#ifdef WARP + case CFG_CNF_TX_POW_LVL: + lp->txPowLevel = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + //case CFG_CNF_SHORT_RETRY_LIMIT: // Short Retry Limit + //case 0xFC33: // Long Retry Limit + case CFG_SUPPORTED_RATE_SET_CNTL: // Supported Rate Set Control + lp->srsc[0] = pLtv->u.u16[0]; + lp->srsc[1] = pLtv->u.u16[1]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[1] = CNV_INT_TO_LITTLE( pLtv->u.u16[1] ); + break; + case CFG_BASIC_RATE_SET_CNTL: // Basic Rate Set Control + lp->brsc[0] = pLtv->u.u16[0]; + lp->brsc[1] = pLtv->u.u16[1]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[1] = CNV_INT_TO_LITTLE( pLtv->u.u16[1] ); + break; + case CFG_CNF_CONNECTION_CNTL: + lp->connectionControl = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + //case CFG_PROBE_DATA_RATE: +#endif // HERMES25 + +#if 1 //;? (HCF_TYPE) & HCF_TYPE_AP + //;?should we restore this to allow smaller memory footprint + + case CFG_CNF_OWN_DTIM_PERIOD: + lp->DTIMPeriod = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; +#ifdef WARP + case CFG_CNF_OWN_BEACON_INTERVAL: // Own Beacon Interval + lp->ownBeaconInterval = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; +#endif // WARP + case CFG_COEXISTENSE_BEHAVIOUR: // Coexistence behavior + lp->coexistence = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; +#ifdef USE_WDS + case CFG_CNF_WDS_ADDR1: + memcpy( &lp->wds_port[0].wdsAddress, &pLtv->u.u8[0], ETH_ALEN ); + hcfPort = HCF_PORT_1; + break; + case CFG_CNF_WDS_ADDR2: + memcpy( &lp->wds_port[1].wdsAddress, &pLtv->u.u8[0], ETH_ALEN ); + hcfPort = HCF_PORT_2; + break; + case CFG_CNF_WDS_ADDR3: + memcpy( &lp->wds_port[2].wdsAddress, &pLtv->u.u8[0], ETH_ALEN ); + hcfPort = HCF_PORT_3; + break; + case CFG_CNF_WDS_ADDR4: + memcpy( &lp->wds_port[3].wdsAddress, &pLtv->u.u8[0], ETH_ALEN ); + hcfPort = HCF_PORT_4; + break; + case CFG_CNF_WDS_ADDR5: + memcpy( &lp->wds_port[4].wdsAddress, &pLtv->u.u8[0], ETH_ALEN ); + hcfPort = HCF_PORT_5; + break; + case CFG_CNF_WDS_ADDR6: + memcpy( &lp->wds_port[5].wdsAddress, &pLtv->u.u8[0], ETH_ALEN ); + hcfPort = HCF_PORT_6; + break; +#endif /* USE_WDS */ + + case CFG_CNF_MCAST_PM_BUF: + lp->multicastPMBuffering = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + case CFG_CNF_REJECT_ANY: + lp->RejectAny = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; +#endif + + case CFG_CNF_ENCRYPTION: + lp->EnableEncryption = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + case CFG_CNF_AUTHENTICATION: + lp->authentication = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; +#if 1 //;? (HCF_TYPE) & HCF_TYPE_AP + //;?should we restore this to allow smaller memory footprint + + //case CFG_CNF_EXCL_UNENCRYPTED: + //lp->ExcludeUnencrypted = pLtv->u.u16[0]; + //pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + //break; + case CFG_CNF_MCAST_RATE: + /* TODO: determine if we are going to store anything based on this */ + break; + case CFG_CNF_INTRA_BSS_RELAY: + lp->intraBSSRelay = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; +#endif + + case CFG_CNF_MICRO_WAVE: + /* TODO: determine if we are going to store anything based on this */ + break; + //case CFG_CNF_LOAD_BALANCING: + /* TODO: determine if we are going to store anything based on this */ + //break; + //case CFG_CNF_MEDIUM_DISTRIBUTION: + /* TODO: determine if we are going to store anything based on this */ + //break; + //case CFG_CNF_RX_ALL_GROUP_ADDRESS: + // TODO: determine if we are going to store anything based on this + //break; + //case CFG_CNF_COUNTRY_INFO: + /* TODO: determine if we are going to store anything based on this */ + //break; + case CFG_CNF_OWN_SSID: + //case CNF_DESIRED_SSID: + case CFG_DESIRED_SSID: + memset( lp->NetworkName, 0, sizeof( lp->NetworkName )); + memcpy( (void *)lp->NetworkName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0] ); + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + + /* take care of the special network name "ANY" case */ + if(( strlen( &pLtv->u.u8[2] ) == 0 ) || + ( strcmp( &pLtv->u.u8[2], "ANY" ) == 0 ) || + ( strcmp( &pLtv->u.u8[2], "any" ) == 0 )) { + /* set the SSID_STRCT llen field (u16[0]) to zero, and the + effectually null the string u8[2] */ + pLtv->u.u16[0] = 0; + pLtv->u.u8[2] = 0; + } + break; + case CFG_GROUP_ADDR: + /* TODO: determine if we are going to store anything based on this */ + break; + case CFG_CREATE_IBSS: + lp->CreateIBSS = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + case CFG_RTS_THRH: + lp->RTSThreshold = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + case CFG_TX_RATE_CNTL: + lp->TxRateControl[0] = pLtv->u.u16[0]; + lp->TxRateControl[1] = pLtv->u.u16[1]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + pLtv->u.u16[1] = CNV_INT_TO_LITTLE( pLtv->u.u16[1] ); + break; + case CFG_PROMISCUOUS_MODE: + /* TODO: determine if we are going to store anything based on this */ + break; + //case CFG_WAKE_ON_LAN: + /* TODO: determine if we are going to store anything based on this */ + //break; +#if 1 //;? #if (HCF_TYPE) & HCF_TYPE_AP + //;?should we restore this to allow smaller memory footprint + case CFG_RTS_THRH0: + lp->RTSThreshold = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + case CFG_TX_RATE_CNTL0: +//;?no idea what this should be, get going so comment it out lp->TxRateControl = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; +#ifdef USE_WDS + case CFG_RTS_THRH1: + lp->wds_port[0].rtsThreshold = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + hcfPort = HCF_PORT_1; + break; + case CFG_RTS_THRH2: + lp->wds_port[1].rtsThreshold = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + hcfPort = HCF_PORT_2; + break; + case CFG_RTS_THRH3: + lp->wds_port[2].rtsThreshold = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + hcfPort = HCF_PORT_3; + break; + case CFG_RTS_THRH4: + lp->wds_port[3].rtsThreshold = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + hcfPort = HCF_PORT_4; + break; + case CFG_RTS_THRH5: + lp->wds_port[4].rtsThreshold = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + hcfPort = HCF_PORT_5; + break; + case CFG_RTS_THRH6: + lp->wds_port[5].rtsThreshold = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + hcfPort = HCF_PORT_6; + break; + case CFG_TX_RATE_CNTL1: + lp->wds_port[0].txRateCntl = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + hcfPort = HCF_PORT_1; + break; + case CFG_TX_RATE_CNTL2: + lp->wds_port[1].txRateCntl = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + hcfPort = HCF_PORT_2; + break; + case CFG_TX_RATE_CNTL3: + lp->wds_port[2].txRateCntl = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + hcfPort = HCF_PORT_3; + break; + case CFG_TX_RATE_CNTL4: + lp->wds_port[3].txRateCntl = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + hcfPort = HCF_PORT_4; + break; + case CFG_TX_RATE_CNTL5: + lp->wds_port[4].txRateCntl = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + hcfPort = HCF_PORT_5; + break; + case CFG_TX_RATE_CNTL6: + lp->wds_port[5].txRateCntl = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + hcfPort = HCF_PORT_6; + break; +#endif /* USE_WDS */ +#endif /* (HCF_TYPE) & HCF_TYPE_AP */ + + case CFG_DEFAULT_KEYS: + { + CFG_DEFAULT_KEYS_STRCT *pKeys = (CFG_DEFAULT_KEYS_STRCT *)pLtv; + + pKeys->key[0].len = CNV_INT_TO_LITTLE( pKeys->key[0].len ); + pKeys->key[1].len = CNV_INT_TO_LITTLE( pKeys->key[1].len ); + pKeys->key[2].len = CNV_INT_TO_LITTLE( pKeys->key[2].len ); + pKeys->key[3].len = CNV_INT_TO_LITTLE( pKeys->key[3].len ); + + memcpy( (void *)&(lp->DefaultKeys), (void *)pKeys, + sizeof( CFG_DEFAULT_KEYS_STRCT )); + } + break; + case CFG_TX_KEY_ID: + lp->TransmitKeyID = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + case CFG_SCAN_SSID: + /* TODO: determine if we are going to store anything based on this */ + break; + case CFG_TICK_TIME: + /* TODO: determine if we are going to store anything based on this */ + break; + /* these RIDS are Info RIDs, and should they be allowed for puts??? */ + case CFG_MAX_LOAD_TIME: + case CFG_DL_BUF: + //case CFG_HSI_SUP_RANGE: + case CFG_NIC_SERIAL_NUMBER: + case CFG_NIC_IDENTITY: + case CFG_NIC_MFI_SUP_RANGE: + case CFG_NIC_CFI_SUP_RANGE: + case CFG_NIC_TEMP_TYPE: + case CFG_NIC_PROFILE: + case CFG_FW_IDENTITY: + case CFG_FW_SUP_RANGE: + case CFG_MFI_ACT_RANGES_STA: + case CFG_CFI_ACT_RANGES_STA: + case CFG_PORT_STAT: + case CFG_CUR_SSID: + case CFG_CUR_BSSID: + case CFG_COMMS_QUALITY: + case CFG_CUR_TX_RATE: + case CFG_CUR_BEACON_INTERVAL: + case CFG_CUR_SCALE_THRH: + case CFG_PROTOCOL_RSP_TIME: + case CFG_CUR_SHORT_RETRY_LIMIT: + case CFG_CUR_LONG_RETRY_LIMIT: + case CFG_MAX_TX_LIFETIME: + case CFG_MAX_RX_LIFETIME: + case CFG_CF_POLLABLE: + case CFG_AUTHENTICATION_ALGORITHMS: + case CFG_PRIVACY_OPT_IMPLEMENTED: + //case CFG_CURRENT_REMOTE_RATES: + //case CFG_CURRENT_USED_RATES: + //case CFG_CURRENT_SYSTEM_SCALE: + //case CFG_CURRENT_TX_RATE1: + //case CFG_CURRENT_TX_RATE2: + //case CFG_CURRENT_TX_RATE3: + //case CFG_CURRENT_TX_RATE4: + //case CFG_CURRENT_TX_RATE5: + //case CFG_CURRENT_TX_RATE6: + case CFG_NIC_MAC_ADDR: + case CFG_PCF_INFO: + //case CFG_CURRENT_COUNTRY_INFO: + case CFG_PHY_TYPE: + case CFG_CUR_CHANNEL: + //case CFG_CURRENT_POWER_STATE: + //case CFG_CCAMODE: + case CFG_SUPPORTED_DATA_RATES: + break; + case CFG_AP_MODE: +//;? lp->DownloadFirmware = ( pLtv->u.u16[0] ) + 1; + DBG_ERROR( DbgInfo, "set CFG_AP_MODE no longer supported\n" ); + break; + case CFG_ENCRYPT_STRING: + /* TODO: ENDIAN TRANSLATION HERE??? */ + memset( lp->szEncryption, 0, sizeof( lp->szEncryption )); + memcpy( (void *)lp->szEncryption, (void *)&pLtv->u.u8[0], + ( pLtv->len * sizeof( hcf_16 )) ); + wl_wep_decode( CRYPT_CODE, &sEncryption, + lp->szEncryption ); + + /* the Linux driver likes to use 1-4 for the key IDs, and then + convert to 0-3 when sending to the card. The Windows code + base used 0-3 in the API DLL, which was ported to Linux. For + the sake of the user experience, we decided to keep 0-3 as the + numbers used in the DLL; and will perform the +1 conversion here. + We could have converted the entire Linux driver, but this is + less obtrusive. This may be a "todo" to convert the whole driver */ + lp->TransmitKeyID = sEncryption.wTxKeyID + 1; + lp->EnableEncryption = sEncryption.wEnabled; + + memcpy( &lp->DefaultKeys, &sEncryption.EncStr, + sizeof( CFG_DEFAULT_KEYS_STRCT )); + break; + /*case CFG_COUNTRY_STRING: + memset( lp->countryString, 0, sizeof( lp->countryString )); + memcpy( (void *)lp->countryString, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); + break; + */ + + case CFG_DRIVER_ENABLE: + lp->driverEnable = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + case CFG_WOLAS_ENABLE: + lp->wolasEnable = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + case CFG_SET_WPA_AUTH_KEY_MGMT_SUITE: + lp->AuthKeyMgmtSuite = pLtv->u.u16[0]; + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + case CFG_DISASSOCIATE_ADDR: + pLtv->u.u16[ETH_ALEN / 2] = CNV_INT_TO_LITTLE( pLtv->u.u16[ETH_ALEN / 2] ); + break; + case CFG_ADD_TKIP_DEFAULT_KEY: + case CFG_REMOVE_TKIP_DEFAULT_KEY: + /* Endian convert the Tx Key Information */ + pLtv->u.u16[0] = CNV_INT_TO_LITTLE( pLtv->u.u16[0] ); + break; + case CFG_ADD_TKIP_MAPPED_KEY: + break; + case CFG_REMOVE_TKIP_MAPPED_KEY: + break; + /* some RIDs just can't be put */ + case CFG_MB_INFO: + case CFG_IFB: + default: + break; + } + + /* This code will prevent Static Configuration Entities from + being sent to the card, as they require a call to + UIL_ACT_APPLY to take effect. Dynamic Entities will be sent + immediately */ + switch( pLtv->typ ) { + case CFG_CNF_PORT_TYPE: + case CFG_CNF_OWN_MAC_ADDR: + case CFG_CNF_OWN_CHANNEL: + case CFG_CNF_OWN_SSID: + case CFG_CNF_OWN_ATIM_WINDOW: + case CFG_CNF_SYSTEM_SCALE: + case CFG_CNF_MAX_DATA_LEN: + case CFG_CNF_PM_ENABLED: + case CFG_CNF_MCAST_RX: + case CFG_CNF_MAX_SLEEP_DURATION: + case CFG_CNF_HOLDOVER_DURATION: + case CFG_CNF_OWN_NAME: + case CFG_CNF_LOAD_BALANCING: + case CFG_CNF_MEDIUM_DISTRIBUTION: +#ifdef WARP + case CFG_CNF_TX_POW_LVL: + case CFG_CNF_CONNECTION_CNTL: + //case CFG_PROBE_DATA_RATE: +#endif // HERMES25 +#if 1 //;? (HCF_TYPE) & HCF_TYPE_AP + //;?should we restore this to allow smaller memory footprint + case CFG_CNF_OWN_DTIM_PERIOD: +#ifdef WARP + case CFG_CNF_OWN_BEACON_INTERVAL: // Own Beacon Interval +#endif // WARP +#ifdef USE_WDS + case CFG_CNF_WDS_ADDR1: + case CFG_CNF_WDS_ADDR2: + case CFG_CNF_WDS_ADDR3: + case CFG_CNF_WDS_ADDR4: + case CFG_CNF_WDS_ADDR5: + case CFG_CNF_WDS_ADDR6: +#endif + case CFG_CNF_MCAST_PM_BUF: + case CFG_CNF_REJECT_ANY: +#endif + + case CFG_CNF_ENCRYPTION: + case CFG_CNF_AUTHENTICATION: +#if 1 //;? (HCF_TYPE) & HCF_TYPE_AP + //;?should we restore this to allow smaller memory footprint + + case CFG_CNF_EXCL_UNENCRYPTED: + case CFG_CNF_MCAST_RATE: + case CFG_CNF_INTRA_BSS_RELAY: +#endif + + case CFG_CNF_MICRO_WAVE: + //case CFG_CNF_LOAD_BALANCING: + //case CFG_CNF_MEDIUM_DISTRIBUTION: + //case CFG_CNF_RX_ALL_GROUP_ADDRESS: + //case CFG_CNF_COUNTRY_INFO: + //case CFG_COUNTRY_STRING: + case CFG_AP_MODE: + case CFG_ENCRYPT_STRING: + //case CFG_DRIVER_ENABLE: + case CFG_WOLAS_ENABLE: + case CFG_MB_INFO: + case CFG_IFB: + break; + /* Deal with this dynamic MSF RID, as it's required for WPA */ + case CFG_DRIVER_ENABLE: + if( lp->driverEnable ) { + //hcf_cntl_port( &( lp->hcfCtx ), + // HCF_PORT_ENABLE | HCF_PORT_0 ); + // //hcf_cntl( &( lp->hcfCtx ), + // // HCF_PORT_ENABLE | HCF_PORT_0 ); + //hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_ENABLE ); + // //hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_CONNECT ); + + hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_ENABLE | HCF_PORT_0 ); + hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_CONNECT ); + } else { + //hcf_cntl_port( &( lp->hcfCtx ), + // HCF_PORT_DISABLE | HCF_PORT_0 ); + // //hcf_cntl( &( lp->hcfCtx ), + // // HCF_PORT_DISABLE | HCF_PORT_0 ); + //hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_DISABLE ); + // //hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_DISCONNECT ); + + hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_DISABLE | HCF_PORT_0 ); + hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_DISCONNECT ); + } + break; + default: + wl_act_int_off( lp ); + urq->result = hcf_put_info(&(lp->hcfCtx), (LTVP) pLtv); + wl_act_int_on( lp ); + break; + } + + if( ltvAllocated ) { + kfree( pLtv ); + } + } else { + urq->result = UIL_FAILURE; + } + } else { + DBG_ERROR( DbgInfo, "EPERM\n" ); + urq->result = UIL_FAILURE; + result = -EPERM; + } + } else { + DBG_ERROR( DbgInfo, "UIL_ERR_WRONG_IFB\n" ); + urq->result = UIL_ERR_WRONG_IFB; + } + + DBG_LEAVE( DbgInfo ); + return result; +} // wvlan_uil_put_info +/*============================================================================*/ + +/******************************************************************************* + * wvlan_uil_get_info() + ******************************************************************************* + * + * DESCRIPTION: + * + * Sends a specific RID directly to the driver to retrieve configuration + * info. + * + * PARAMETERS: + * + * urq - a pointer to the UIL request buffer + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * UIL_SUCCESS + * UIL_ERR_xxx value otherwise + * + ******************************************************************************/ +int wvlan_uil_get_info( struct uilreq *urq, struct wl_private *lp ) +{ + int result = 0; + int i; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wvlan_uil_get_info" ); + DBG_ENTER( DbgInfo ); + + if( urq->hcfCtx == &( lp->hcfCtx )) { + if(( urq->data != NULL ) && ( urq->len != 0 )) { + ltv_t *pLtv; + bool_t ltvAllocated = FALSE; + + /* Make sure that we have at least a command and length */ + if( urq->len < ( sizeof( hcf_16 ) * 2 )) { + urq->len = sizeof( lp->ltvRecord ); + DBG_ERROR( DbgInfo, "No Length/Type in LTV!!!\n" ); + DBG_ERROR( DbgInfo, "UIL_ERR_LEN\n" ); + urq->result = UIL_ERR_LEN; + DBG_LEAVE( DbgInfo ); + return result; + } + + /* Verify the user's LTV record header. */ + result = verify_area( VERIFY_READ, urq->data, sizeof( hcf_16 ) * 2 ); + if( result != 0 ) { + DBG_ERROR( DbgInfo, "verify_area(), VERIFY_READ FAILED\n" ); + urq->result = UIL_FAILURE; + DBG_LEAVE( DbgInfo ); + return result; + } + + /* Get only the command and length information. */ + result = copy_from_user( &( lp->ltvRecord ), urq->data, sizeof( hcf_16 ) * 2 ); + + /* Make sure the incoming LTV record length is within the bounds of + the IOCTL length. */ + if((( lp->ltvRecord.len + 1 ) * sizeof( hcf_16 )) > urq->len ) { + DBG_ERROR( DbgInfo, "Incoming LTV too big\n" ); + urq->len = sizeof( lp->ltvRecord ); + urq->result = UIL_ERR_LEN; + DBG_LEAVE( DbgInfo ); + return result; + } + + /* Determine if hcf_get_info() is needed or not */ + switch ( lp->ltvRecord.typ ) { + case CFG_NIC_IDENTITY: + memcpy( &lp->ltvRecord.u.u8[0], &lp->NICIdentity, sizeof( lp->NICIdentity )); + break; + case CFG_PRI_IDENTITY: + memcpy( &lp->ltvRecord.u.u8[0], &lp->PrimaryIdentity, sizeof( lp->PrimaryIdentity )); + break; + case CFG_AP_MODE: + DBG_ERROR( DbgInfo, "set CFG_AP_MODE no longer supported, so is get useful ????\n" ); + lp->ltvRecord.u.u16[0] = + CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP; + break; + //case CFG_DRV_INFO: + case CFG_ENCRYPT_STRING: + case CFG_COUNTRY_STRING: + case CFG_DRIVER_ENABLE: + case CFG_WOLAS_ENABLE: + // TODO: determine if we're going to support these + urq->result = UIL_FAILURE; + break; + case CFG_DRV_INFO: + DBG_TRACE( DbgInfo, "Intercept CFG_DRV_INFO\n" ); + result = cfg_driver_info( urq, lp ); + break; + case CFG_DRV_IDENTITY: + DBG_TRACE( DbgInfo, "Intercept CFG_DRV_IDENTITY\n" ); + result = cfg_driver_identity( urq, lp ); + break; + case CFG_IFB: + /* IFB can be a security hole */ + if( !capable( CAP_NET_ADMIN )) { + result = -EPERM; + break; + } + + /* Else fall through to the default */ + + case CFG_FW_IDENTITY: // For Hermes-1, this is cached + default: + + /* Verify the user buffer */ + result = verify_area( VERIFY_WRITE, urq->data, urq->len ); + if( result != 0 ) { + DBG_ERROR( DbgInfo, "verify_area(), VERIFY_WRITE FAILED\n" ); + urq->result = UIL_FAILURE; + break; + } + + /* If the requested length is greater than the size of our local + LTV record, try to allocate it from the kernel stack. + Otherwise, we just use our local LTV record. */ + if( urq->len > sizeof( lp->ltvRecord )) { + if(( pLtv = (ltv_t *)kmalloc( urq->len, GFP_KERNEL )) != NULL ) { + ltvAllocated = TRUE; + + /* Copy the command/length information into the new buffer. */ + memcpy( pLtv, &( lp->ltvRecord ), sizeof( hcf_16 ) * 2 ); + } else { + urq->len = sizeof( lp->ltvRecord ); + urq->result = UIL_ERR_LEN; + DBG_ERROR( DbgInfo, "kmalloc FAILED\n" ); + DBG_ERROR( DbgInfo, "UIL_ERR_LEN\n" ); + result = -ENOMEM; + break; + } + } else { + pLtv = &( lp->ltvRecord ); + } + + wl_act_int_off( lp ); + urq->result = hcf_get_info( &( lp->hcfCtx ), (LTVP) pLtv ); + wl_act_int_on( lp ); + + // Copy the LTV into the user's buffer. + //copy_to_user( urq->data, pLtv, urq->len ); + + //if( ltvAllocated ) + //{ + // kfree( pLtv ); + //} + + //urq->result = UIL_SUCCESS; + break; + } + + /* Handle endian conversion of special fields */ + switch( lp->ltvRecord.typ ) { + /* simple int gets just need the first hcf_16 byte flipped */ + case CFG_CNF_PORT_TYPE: + case CFG_CNF_OWN_CHANNEL: + case CFG_CNF_OWN_ATIM_WINDOW: + case CFG_CNF_SYSTEM_SCALE: + case CFG_CNF_MAX_DATA_LEN: + case CFG_CNF_PM_ENABLED: + case CFG_CNF_MCAST_RX: + case CFG_CNF_MAX_SLEEP_DURATION: + case CFG_CNF_HOLDOVER_DURATION: + case CFG_CNF_OWN_DTIM_PERIOD: + case CFG_CNF_MCAST_PM_BUF: + case CFG_CNF_REJECT_ANY: + case CFG_CNF_ENCRYPTION: + case CFG_CNF_AUTHENTICATION: + case CFG_CNF_EXCL_UNENCRYPTED: + case CFG_CNF_INTRA_BSS_RELAY: + case CFG_CNF_MICRO_WAVE: + case CFG_CNF_LOAD_BALANCING: + case CFG_CNF_MEDIUM_DISTRIBUTION: +#ifdef WARP + case CFG_CNF_TX_POW_LVL: + case CFG_CNF_CONNECTION_CNTL: + case CFG_CNF_OWN_BEACON_INTERVAL: // Own Beacon Interval + case CFG_COEXISTENSE_BEHAVIOUR: // Coexistence Behavior + //case CFG_CNF_RX_ALL_GROUP_ADDRESS: +#endif // HERMES25 + case CFG_CREATE_IBSS: + case CFG_RTS_THRH: + case CFG_PROMISCUOUS_MODE: + //case CFG_WAKE_ON_LAN: + case CFG_RTS_THRH0: + case CFG_RTS_THRH1: + case CFG_RTS_THRH2: + case CFG_RTS_THRH3: + case CFG_RTS_THRH4: + case CFG_RTS_THRH5: + case CFG_RTS_THRH6: + case CFG_TX_RATE_CNTL0: + case CFG_TX_RATE_CNTL1: + case CFG_TX_RATE_CNTL2: + case CFG_TX_RATE_CNTL3: + case CFG_TX_RATE_CNTL4: + case CFG_TX_RATE_CNTL5: + case CFG_TX_RATE_CNTL6: + case CFG_TX_KEY_ID: + case CFG_TICK_TIME: + case CFG_MAX_LOAD_TIME: + case CFG_NIC_TEMP_TYPE: + case CFG_PORT_STAT: + case CFG_CUR_TX_RATE: + case CFG_CUR_BEACON_INTERVAL: + case CFG_PROTOCOL_RSP_TIME: + case CFG_CUR_SHORT_RETRY_LIMIT: + case CFG_CUR_LONG_RETRY_LIMIT: + case CFG_MAX_TX_LIFETIME: + case CFG_MAX_RX_LIFETIME: + case CFG_CF_POLLABLE: + case CFG_PRIVACY_OPT_IMPLEMENTED: + //case CFG_CURRENT_REMOTE_RATES: + //case CFG_CURRENT_USED_RATES: + //case CFG_CURRENT_SYSTEM_SCALE: + //case CFG_CURRENT_TX_RATE1: + //case CFG_CURRENT_TX_RATE2: + //case CFG_CURRENT_TX_RATE3: + //case CFG_CURRENT_TX_RATE4: + //case CFG_CURRENT_TX_RATE5: + //case CFG_CURRENT_TX_RATE6: + case CFG_PHY_TYPE: + case CFG_CUR_CHANNEL: + //case CFG_CURRENT_POWER_STATE: + //case CFG_CCAMODE: + // lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[0] ); + // break; + /* name string gets just need the first hcf_16 byte flipped (length of string) */ + case CFG_CNF_OWN_SSID: + case CFG_CNF_OWN_NAME: + //case CNF_DESIRED_SSID: + case CFG_DESIRED_SSID: + case CFG_SCAN_SSID: + case CFG_CUR_SSID: + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[0] ); + break; + /* non-length counted strings need no byte flipping */ + case CFG_CNF_OWN_MAC_ADDR: + /* this case is no longer valid: CFG_CNF_WDS_ADDR */ + case CFG_CNF_WDS_ADDR1: + case CFG_CNF_WDS_ADDR2: + case CFG_CNF_WDS_ADDR3: + case CFG_CNF_WDS_ADDR4: + case CFG_CNF_WDS_ADDR5: + case CFG_CNF_WDS_ADDR6: + case CFG_GROUP_ADDR: + case CFG_NIC_SERIAL_NUMBER: + case CFG_CUR_BSSID: + case CFG_NIC_MAC_ADDR: + case CFG_SUPPORTED_DATA_RATES: /* need to ensure we can treat this as a string */ + break; + //case CFG_CNF_COUNTRY_INFO: /* special case, see page 75 of 022486, Rev C. */ + //case CFG_CURRENT_COUNTRY_INFO: /* special case, see page 101 of 022486, Rev C. */ + /* + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[0] ); + lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[3] ); + + for( i = 4; i < lp->ltvRecord.len; i++ ) { + lp->ltvRecord.u.u16[i] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[i] ); + } + break; + */ + + case CFG_DEFAULT_KEYS: + { + CFG_DEFAULT_KEYS_STRCT *pKeys = (CFG_DEFAULT_KEYS_STRCT *)&lp->ltvRecord.u.u8[0]; + + pKeys[0].len = CNV_INT_TO_LITTLE( pKeys[0].len ); + pKeys[1].len = CNV_INT_TO_LITTLE( pKeys[1].len ); + pKeys[2].len = CNV_INT_TO_LITTLE( pKeys[2].len ); + pKeys[3].len = CNV_INT_TO_LITTLE( pKeys[3].len ); + } + break; + case CFG_CNF_MCAST_RATE: + case CFG_TX_RATE_CNTL: + case CFG_SUPPORTED_RATE_SET_CNTL: // Supported Rate Set Control + case CFG_BASIC_RATE_SET_CNTL: // Basic Rate Set Control + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[0] ); + lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[1] ); + break; + case CFG_DL_BUF: + case CFG_NIC_IDENTITY: + case CFG_COMMS_QUALITY: + case CFG_PCF_INFO: + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[0] ); + lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[1] ); + lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[2] ); + break; + case CFG_FW_IDENTITY: + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[0] ); + lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[1] ); + lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[2] ); + lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[3] ); + break; + //case CFG_HSI_SUP_RANGE: + case CFG_NIC_MFI_SUP_RANGE: + case CFG_NIC_CFI_SUP_RANGE: + case CFG_NIC_PROFILE: + case CFG_FW_SUP_RANGE: + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[0] ); + lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[1] ); + lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[2] ); + lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[3] ); + lp->ltvRecord.u.u16[4] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[4] ); + break; + case CFG_MFI_ACT_RANGES_STA: + case CFG_CFI_ACT_RANGES_STA: + case CFG_CUR_SCALE_THRH: + case CFG_AUTHENTICATION_ALGORITHMS: + for( i = 0; i < ( lp->ltvRecord.len - 1 ); i++ ) { + lp->ltvRecord.u.u16[i] = CNV_INT_TO_LITTLE( lp->ltvRecord.u.u16[i] ); + } + break; + /* done at init time, and endian handled then */ + case CFG_PRI_IDENTITY: + break; + case CFG_MB_INFO: + //wvlanEndianTranslateMailbox( pLtv ); + break; + /* MSF and HCF RIDS */ + case CFG_IFB: + case CFG_DRV_INFO: + case CFG_AP_MODE: + case CFG_ENCRYPT_STRING: + case CFG_COUNTRY_STRING: + case CFG_DRIVER_ENABLE: + case CFG_WOLAS_ENABLE: + default: + break; + } + + // Copy the LTV into the user's buffer. + copy_to_user( urq->data, &( lp->ltvRecord ), urq->len ); + + if( ltvAllocated ) { + kfree( &( lp->ltvRecord )); + } + + urq->result = UIL_SUCCESS; + } else { + urq->result = UIL_FAILURE; + } + } else { + DBG_ERROR( DbgInfo, "UIL_ERR_WRONG_IFB\n" ); + urq->result = UIL_ERR_WRONG_IFB; + } + + DBG_LEAVE( DbgInfo ); + return result; +} // wvlan_uil_get_info +/*============================================================================*/ + + + + + +/******************************************************************************* + * cfg_driver_info() + ******************************************************************************* + * + * DESCRIPTION: + * + * Retrieves driver information. + * + * PARAMETERS: + * + * urq - a pointer to the UIL request buffer + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * UIL_SUCCESS + * UIL_ERR_xxx value otherwise + * + ******************************************************************************/ +int cfg_driver_info( struct uilreq *urq, struct wl_private *lp ) +{ + int result = 0; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "cfg_driver_info" ); + DBG_ENTER( DbgInfo ); + + + /* Make sure that user buffer can handle the driver information buffer */ + if( urq->len < sizeof( lp->driverInfo )) { + urq->len = sizeof( lp->driverInfo ); + urq->result = UIL_ERR_LEN; + DBG_LEAVE( DbgInfo ); + return result; + } + + /* Verify the user buffer. */ + result = verify_area( VERIFY_WRITE, urq->data, sizeof( lp->driverInfo )); + if( result != 0 ) { + urq->result = UIL_FAILURE; + DBG_LEAVE( DbgInfo ); + return result; + } + + lp->driverInfo.card_stat = lp->hcfCtx.IFB_CardStat; + + // Copy the driver information into the user's buffer. + urq->result = UIL_SUCCESS; + copy_to_user( urq->data, &( lp->driverInfo ), sizeof( lp->driverInfo )); + + DBG_LEAVE( DbgInfo ); + return result; +} // cfg_driver_info +/*============================================================================*/ + + + + +/******************************************************************************* + * cfg_driver_identity() + ******************************************************************************* + * + * DESCRIPTION: + * + * Retrieves ID information from the card. + * + * PARAMETERS: + * + * urq - a pointer to the UIL request buffer + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * UIL_SUCCESS + * UIL_ERR_xxx value otherwise + * + ******************************************************************************/ +int cfg_driver_identity( struct uilreq *urq, struct wl_private *lp ) +{ + int result = 0; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wvlan_driver_identity" ); + DBG_ENTER( DbgInfo ); + + + /* Make sure that user buffer can handle the driver identity structure. */ + if( urq->len < sizeof( lp->driverIdentity )) { + urq->len = sizeof( lp->driverIdentity ); + urq->result = UIL_ERR_LEN; + DBG_LEAVE( DbgInfo ); + return result; + } + + /* Verify the user buffer. */ + result = verify_area( VERIFY_WRITE, urq->data, sizeof( lp->driverIdentity )); + if( result != 0 ) { + urq->result = UIL_FAILURE; + DBG_LEAVE( DbgInfo ); + return result; + } + + /* Copy the driver identity into the user's buffer. */ + urq->result = UIL_SUCCESS; + copy_to_user( urq->data, &( lp->driverIdentity ), sizeof( lp->driverIdentity )); + + DBG_LEAVE( DbgInfo ); + return result; +} // cfg_driver_identity +/*============================================================================*/ + + +#endif /* USE_UIL */ + + +/* If WIRELESS_EXT is not defined, then the functions that follow will not be + included in the build. */ +/* NOTE: Are these still even needed? */ +#ifdef WIRELESS_EXT + + +/******************************************************************************* + * wvlan_set_netname() + ******************************************************************************* + * + * DESCRIPTION: + * + * Set the ESSID of the card. + * + * PARAMETERS: + * + * wrq - a pointer to the wireless request buffer + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wvlan_set_netname(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, + char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wvlan_set_netname" ); + DBG_ENTER( DbgInfo ); + + wl_lock(lp, &flags); + + memset( lp->NetworkName, 0, sizeof( lp->NetworkName )); + memcpy( lp->NetworkName, extra, wrqu->data.length); + + /* Commit the adapter parameters */ + wl_apply(lp); + wl_unlock(lp, &flags); + + DBG_LEAVE( DbgInfo ); + return ret; +} // wvlan_set_netname +/*============================================================================*/ + + + + +/******************************************************************************* + * wvlan_get_netname() + ******************************************************************************* + * + * DESCRIPTION: + * + * Get the ESSID of the card. + * + * PARAMETERS: + * + * wrq - a pointer to the wireless request buffer + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wvlan_get_netname(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, + char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + int status = -1; + wvName_t *pName; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wvlan_get_netname" ); + DBG_ENTER( DbgInfo ); + + wl_lock(lp, &flags); + + /* Get the current network name */ + lp->ltvRecord.len = 1 + ( sizeof( *pName ) / sizeof( hcf_16 )); + lp->ltvRecord.typ = CFG_CUR_SSID; + + status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + + if( status == HCF_SUCCESS ) { + pName = (wvName_t *)&( lp->ltvRecord.u.u32 ); + + memset(extra, '\0', HCF_MAX_NAME_LEN); + wrqu->data.length = pName->length; + + memcpy(extra, pName->name, pName->length); + } else { + ret = -EFAULT; + } + + wl_unlock(lp, &flags); + + DBG_LEAVE( DbgInfo ); + return ret; +} // wvlan_get_netname +/*============================================================================*/ + + + + +/******************************************************************************* + * wvlan_set_station_nickname() + ******************************************************************************* + * + * DESCRIPTION: + * + * Set the card's station nickname. + * + * PARAMETERS: + * + * wrq - a pointer to the wireless request buffer + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wvlan_set_station_nickname(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, + char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wvlan_set_station_nickname" ); + DBG_ENTER( DbgInfo ); + + wl_lock(lp, &flags); + + memset( lp->StationName, 0, sizeof( lp->StationName )); + + memcpy( lp->StationName, extra, wrqu->data.length); + + /* Commit the adapter parameters */ + wl_apply( lp ); + wl_unlock(lp, &flags); + + DBG_LEAVE( DbgInfo ); + return ret; +} // wvlan_set_station_nickname +/*============================================================================*/ + + + + +/******************************************************************************* + * wvlan_get_station_nickname() + ******************************************************************************* + * + * DESCRIPTION: + * + * Get the card's station nickname. + * + * PARAMETERS: + * + * wrq - a pointer to the wireless request buffer + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wvlan_get_station_nickname(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, + char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + int status = -1; + wvName_t *pName; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wvlan_get_station_nickname" ); + DBG_ENTER( DbgInfo ); + + wl_lock( lp, &flags ); + + /* Get the current station name */ + lp->ltvRecord.len = 1 + ( sizeof( *pName ) / sizeof( hcf_16 )); + lp->ltvRecord.typ = CFG_CNF_OWN_NAME; + + status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + + if( status == HCF_SUCCESS ) { + pName = (wvName_t *)&( lp->ltvRecord.u.u32 ); + + memset(extra, '\0', HCF_MAX_NAME_LEN); + wrqu->data.length = pName->length; + memcpy(extra, pName->name, pName->length); + } else { + ret = -EFAULT; + } + + wl_unlock(lp, &flags); + +//out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wvlan_get_station_nickname +/*============================================================================*/ + + + + +/******************************************************************************* + * wvlan_set_porttype() + ******************************************************************************* + * + * DESCRIPTION: + * + * Set the card's porttype + * + * PARAMETERS: + * + * wrq - a pointer to the wireless request buffer + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wvlan_set_porttype(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, + char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + hcf_16 portType; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wvlan_set_porttype" ); + DBG_ENTER( DbgInfo ); + + wl_lock(lp, &flags); + + /* Validate the new value */ + portType = *((__u32 *)extra); + + if( !(( portType == 1 ) || ( portType == 3 ))) { + ret = -EINVAL; + goto out_unlock; + } + + lp->PortType = portType; + + /* Commit the adapter parameters */ + wl_apply( lp ); + +out_unlock: + wl_unlock(lp, &flags); + +//out: + DBG_LEAVE( DbgInfo ); + return ret; +} + +/*============================================================================*/ + + +/******************************************************************************* + * wvlan_get_porttype() + ******************************************************************************* + * + * DESCRIPTION: + * + * Get the card's porttype + * + * PARAMETERS: + * + * wrq - a pointer to the wireless request buffer + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wvlan_get_porttype(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, + char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + int status = -1; + hcf_16 *pPortType; + __u32 *pData = (__u32 *)extra; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wvlan_get_porttype" ); + DBG_ENTER( DbgInfo ); + + wl_lock( lp, &flags ); + + /* Get the current port type */ + lp->ltvRecord.len = 1 + ( sizeof( *pPortType ) / sizeof( hcf_16 )); + lp->ltvRecord.typ = CFG_CNF_PORT_TYPE; + + status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + + if( status == HCF_SUCCESS ) { + pPortType = (hcf_16 *)&( lp->ltvRecord.u.u32 ); + + *pData = CNV_LITTLE_TO_INT( *pPortType ); + } else { + ret = -EFAULT; + } + + wl_unlock(lp, &flags); + +//out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wvlan_get_porttype +/*============================================================================*/ + +#endif // WIRELESS_EXT + + + + +#ifdef USE_RTS +/******************************************************************************* + * wvlan_rts() + ******************************************************************************* + * + * DESCRIPTION: + * + * IOCTL handler for RTS commands + * + * PARAMETERS: + * + * rrq - a pointer to the rts request buffer + * lp - a pointer to the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wvlan_rts( struct rtsreq *rrq, __u32 io_base ) +{ + int ioctl_ret = 0; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wvlan_rts" ); + DBG_ENTER( DbgInfo ); + + + DBG_PRINT( "io_base: 0x%08x\n", io_base ); + + switch( rrq->typ ) { + case WL_IOCTL_RTS_READ: + DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_READ\n"); + rrq->data[0] = IN_PORT_WORD( io_base + rrq->reg ); + DBG_TRACE( DbgInfo, " reg 0x%04x ==> 0x%04x\n", rrq->reg, CNV_LITTLE_TO_SHORT( rrq->data[0] ) ); + break; + case WL_IOCTL_RTS_WRITE: + DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_WRITE\n"); + OUT_PORT_WORD( io_base + rrq->reg, rrq->data[0] ); + DBG_TRACE( DbgInfo, " reg 0x%04x <== 0x%04x\n", rrq->reg, CNV_LITTLE_TO_SHORT( rrq->data[0] ) ); + break; + case WL_IOCTL_RTS_BATCH_READ: + DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_BATCH_READ\n"); + IN_PORT_STRING_16( io_base + rrq->reg, rrq->data, rrq->len ); + DBG_TRACE( DbgInfo, " reg 0x%04x ==> %d bytes\n", rrq->reg, rrq->len * sizeof (__u16 ) ); + break; + case WL_IOCTL_RTS_BATCH_WRITE: + DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- WL_IOCTL_RTS_BATCH_WRITE\n"); + OUT_PORT_STRING_16( io_base + rrq->reg, rrq->data, rrq->len ); + DBG_TRACE( DbgInfo, " reg 0x%04x <== %d bytes\n", rrq->reg, rrq->len * sizeof (__u16) ); + break; + default: + + DBG_TRACE(DbgInfo, "IOCTL: WVLAN2_IOCTL_RTS -- UNSUPPORTED RTS CODE: 0x%X", rrq->typ ); + ioctl_ret = -EOPNOTSUPP; + break; + } + + DBG_LEAVE( DbgInfo ); + return ioctl_ret; +} // wvlan_rts +/*============================================================================*/ + +#endif /* USE_RTS */ diff --git a/drivers/staging/wlags49_h2/wl_priv.h b/drivers/staging/wlags49_h2/wl_priv.h new file mode 100644 index 000000000000..039b317d1296 --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_priv.h @@ -0,0 +1,138 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * Header describing information required for the private IOCTL handlers. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/07/19 08:16:15 $ + * $Revision: 1.2 $ + * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_priv.h,v $ + * + ******************************************************************************/ + + + + +#ifndef __WL_PRIV_H__ +#define __WL_PRIV_H__ + + + + +/******************************************************************************* + * function prototypes + ******************************************************************************/ +#ifdef WIRELESS_EXT + + +int wvlan_set_netname( struct net_device *, struct iw_request_info *, union iwreq_data *, char *extra ); + +int wvlan_get_netname( struct net_device *, struct iw_request_info *, union iwreq_data *, char *extra ); + +int wvlan_set_station_nickname( struct net_device *, struct iw_request_info *, union iwreq_data *, char *extra ); + +int wvlan_get_station_nickname( struct net_device *, struct iw_request_info *, union iwreq_data *, char *extra ); + +int wvlan_set_porttype( struct net_device *, struct iw_request_info *, union iwreq_data *, char *extra ); + +int wvlan_get_porttype( struct net_device *, struct iw_request_info *, union iwreq_data *, char *extra ); + + +#endif // WIRELESS_EXT + + + + +#ifdef USE_UIL + +int wvlan_uil( struct uilreq *urq, struct wl_private *lp ); + +// int wvlan_uil_connect( struct uilreq *urq, struct wl_private *lp ); +// int wvlan_uil_disconnect( struct uilreq *urq, struct wl_private *lp ); +// int wvlan_uil_action( struct uilreq *urq, struct wl_private *lp ); +// int wvlan_uil_block( struct uilreq *urq, struct wl_private *lp ); +// int wvlan_uil_unblock( struct uilreq *urq, struct wl_private *lp ); +// int wvlan_uil_send_diag_msg( struct uilreq *urq, struct wl_private *lp ); +// int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ); +// int wvlan_uil_get_info( struct uilreq *urq, struct wl_private *lp ); + +//int cfg_driver_info( struct uilreq *urq, struct wl_private *lp ); +//int cfg_driver_identity( struct uilreq *urq, struct wl_private *lp ); + +#endif // USE_UIL + + +#ifdef USE_RTS + +int wvlan_rts( struct rtsreq *rrq, __u32 io_base ); +int wvlan_rts_read( __u16 reg, __u16 *val, __u32 io_base ); +int wvlan_rts_write( __u16 reg, __u16 val, __u32 io_base ); +int wvlan_rts_batch_read( struct rtsreq *rrq, __u32 io_base ); +int wvlan_rts_batch_write( struct rtsreq *rrq, __u32 io_base ); + +#endif // USE_RTS + + +#endif // __WL_PRIV_H__ diff --git a/drivers/staging/wlags49_h2/wl_profile.c b/drivers/staging/wlags49_h2/wl_profile.c new file mode 100644 index 000000000000..4130e6a0ea76 --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_profile.c @@ -0,0 +1,1128 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * This file defines routines required to parse configuration parameters + * listed in a config file, if that config file exists. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/08/04 12:36:10 $ + * $Revision: 1.10 $ + * $Source: /usr/local/cvs/wl_lkm/wireless/wl_profile.c,v $ + * + ******************************************************************************/ + + + + +/* Only include this file if USE_PROFILE is defined */ +#ifdef USE_PROFILE + + + + +/******************************************************************************* + * constant definitions + ******************************************************************************/ + + +/* Allow support for calling system fcns to parse config file */ +#define __KERNEL_SYSCALLS__ + + + + +/******************************************************************************* + * include files + ******************************************************************************/ +#include + +#include +#include +#include +#include +#include + +#define BIN_DL 1 + +#include +#include +//#include + +#include +#include +#include +#include +#include +#include + + +/******************************************************************************* + * global variables + ******************************************************************************/ + +/* Definition needed to prevent unresolved external in unistd.h */ +static int errno; + +#if DBG +extern p_u32 DebugFlag; +extern dbg_info_t *DbgInfo; +#endif + +int parse_yes_no( char* value ); + + +int parse_yes_no( char* value ) { +int rc = 0; //default to NO for invalid parameters + + if ( strlen( value ) == 1 ) { + if ( ( value[0] | ('Y'^'y') ) == 'y' ) rc = 1; +// } else { +// this should not be debug time info, it is an enduser data entry error ;? +// DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_MICROWAVE_ROBUSTNESS ); + } + return rc; +} // parse_yes_no + + +/******************************************************************************* + * parse_config() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function opens the device's config file and parses the options from + * it, so that it can properly configure itself. If no configuration file + * or configuration is present, then continue to use the options already + * parsed from config.opts or wireless.opts. + * + * PARAMETERS: + * + * dev - a pointer to the device's net_device structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void parse_config( struct net_device *dev ) +{ + int file_desc; +#if 0 // BIN_DL + int rc; + char *cp = NULL; +#endif // BIN_DL + char buffer[MAX_LINE_SIZE]; + char filename[MAX_LINE_SIZE]; + mm_segment_t fs; + struct wl_private *wvlan_config = NULL; + ENCSTRCT sEncryption; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "parse_config" ); + DBG_ENTER( DbgInfo ); + + /* Get the wavelan specific info for this device */ + wvlan_config = (struct wl_private *)dev->priv; + if ( wvlan_config == NULL ) { + DBG_ERROR( DbgInfo, "Wavelan specific info struct not present?\n" ); + return; + } + + /* setup the default encryption string */ + strcpy( wvlan_config->szEncryption, DEF_CRYPT_STR ); + + /* Obtain a user-space process context, storing the original context */ + fs = get_fs( ); + set_fs( get_ds( )); + + /* Determine the filename for this device and attempt to open it */ + sprintf( filename, "%s%s", ROOT_CONFIG_FILENAME, dev->name ); + file_desc = open( filename, O_RDONLY, 0 ); + if ( file_desc != -1 ) { + DBG_TRACE( DbgInfo, "Wireless config file found. Parsing options...\n" ); + + /* Read out the options */ + while( readline( file_desc, buffer )) { + translate_option( buffer, wvlan_config ); + } + /* Close the file */ + close( file_desc ); //;?even if file_desc == -1 ??? + } else { + DBG_TRACE( DbgInfo, "No iwconfig file found for this device; " + "config.opts or wireless.opts will be used\n" ); + } + /* Return to the original context */ + set_fs( fs ); + + /* convert the WEP keys, if read in as key1, key2, type of data */ + if ( wvlan_config->EnableEncryption ) { + memset( &sEncryption, 0, sizeof( sEncryption )); + + wl_wep_decode( CRYPT_CODE, &sEncryption, + wvlan_config->szEncryption ); + + /* the Linux driver likes to use 1-4 for the key IDs, and then + convert to 0-3 when sending to the card. The Windows code + base used 0-3 in the API DLL, which was ported to Linux. For + the sake of the user experience, we decided to keep 0-3 as the + numbers used in the DLL; and will perform the +1 conversion here. + We could have converted the entire Linux driver, but this is + less obtrusive. This may be a "todo" to convert the whole driver */ + sEncryption.wEnabled = wvlan_config->EnableEncryption; + sEncryption.wTxKeyID = wvlan_config->TransmitKeyID - 1; + + memcpy( &sEncryption.EncStr, &wvlan_config->DefaultKeys, + sizeof( CFG_DEFAULT_KEYS_STRCT )); + + memset( wvlan_config->szEncryption, 0, sizeof( wvlan_config->szEncryption )); + + wl_wep_code( CRYPT_CODE, wvlan_config->szEncryption, &sEncryption, + sizeof( sEncryption )); + } + + /* decode the encryption string for the call to wl_commit() */ + wl_wep_decode( CRYPT_CODE, &sEncryption, wvlan_config->szEncryption ); + + wvlan_config->TransmitKeyID = sEncryption.wTxKeyID + 1; + wvlan_config->EnableEncryption = sEncryption.wEnabled; + + memcpy( &wvlan_config->DefaultKeys, &sEncryption.EncStr, + sizeof( CFG_DEFAULT_KEYS_STRCT )); + +#if 0 //BIN_DL + /* Obtain a user-space process context, storing the original context */ + fs = get_fs( ); + set_fs( get_ds( )); + + //;?just to fake something + strcpy(/*wvlan_config->fw_image_*/filename, "/etc/agere/fw.bin" ); + file_desc = open( /*wvlan_config->fw_image_*/filename, 0, 0 ); + if ( file_desc == -1 ) { + DBG_ERROR( DbgInfo, "No image file found\n" ); + } else { + DBG_TRACE( DbgInfo, "F/W image file found\n" ); +#define DHF_ALLOC_SIZE 96000 //just below 96K, let's hope it suffices for now and for the future + cp = (char*)vmalloc( DHF_ALLOC_SIZE ); + if ( cp == NULL ) { + DBG_ERROR( DbgInfo, "error in vmalloc\n" ); + } else { + rc = read( file_desc, cp, DHF_ALLOC_SIZE ); + if ( rc == DHF_ALLOC_SIZE ) { + DBG_ERROR( DbgInfo, "buffer too small, %d\n", DHF_ALLOC_SIZE ); + } else if ( rc > 0 ) { + DBG_TRACE( DbgInfo, "read O.K.: %d bytes %.12s\n", rc, cp ); + rc = read( file_desc, &cp[rc], 1 ); + if ( rc == 0 ) { + DBG_TRACE( DbgInfo, "no more to read\n" ); + } + } + if ( rc != 0 ) { + DBG_ERROR( DbgInfo, "file not read in one swoop or other error"\ + ", give up, too complicated, rc = %0X\n", rc ); + } + vfree( cp ); + } + close( file_desc ); + } + set_fs( fs ); /* Return to the original context */ +#endif // BIN_DL + + DBG_LEAVE( DbgInfo ); + return; +} // parse_config + +/******************************************************************************* + * readline() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function reads in data from a given file one line at a time, + * converting the detected newline character '\n' to a null '\0'. Note that + * the file descriptor must be valid before calling this function. + * + * PARAMETERS: + * + * filedesc - the file descriptor for the open configuration file + * buffer - a buffer pointer, passed in by the caller, to which the + * line will be stored. + * + * RETURNS: + * + * the number of bytes read + * -1 on error + * + ******************************************************************************/ +int readline( int filedesc, char *buffer ) +{ + int result = -1; + int bytes_read = 0; + /*------------------------------------------------------------------------*/ + + /* Make sure the file descriptor is good */ + if ( filedesc != -1 ) { + /* Read in from the file byte by byte until a newline is reached */ + while(( result = read( filedesc, &buffer[bytes_read], 1 )) == 1 ) { + if ( buffer[bytes_read] == '\n' ) { + buffer[bytes_read] = '\0'; + bytes_read++; + break; + } + bytes_read++; + } + } + + /* Return the number of bytes read */ + if ( result == -1 ) { + return result; + } else { + return bytes_read; + } +} // readline +/*============================================================================*/ + +/******************************************************************************* + * translate_option() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function takes a line read in from the config file and parses out + * the key/value pairs. It then determines which key has been parsed and sets + * the card's configuration based on the value given. + * + * PARAMETERS: + * + * buffer - a buffer containing a line to translate + * config - a pointer to the device's private adapter structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void translate_option( char *buffer, struct wl_private *lp ) +{ + unsigned int value_convert = 0; + int string_length = 0; + char *key = NULL; + char *value = NULL; + u_char mac_value[ETH_ALEN]; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "translate_option" ); + + if ( buffer == NULL || lp == NULL ) { + DBG_ERROR( DbgInfo, "Config file buffer and/or wavelan buffer ptr NULL\n" ); + return; + } + + ParseConfigLine( buffer, &key, &value ); + + if ( key == NULL || value == NULL ) { + return; + } + + /* Determine which key it is and perform the appropriate action */ + + /* Configuration parameters used in all scenarios */ +#if DBG + /* handle DebugFlag as early as possible so it starts its influence as early + * as possible + */ + if ( strcmp( key, PARM_NAME_DEBUG_FLAG ) == 0 ) { + if ( DebugFlag == ~0 ) { //if DebugFlag is not specified on the command line + if ( DbgInfo->DebugFlag == 0 ) { /* if pc_debug did not set DebugFlag (i.e.pc_debug is + * not specified or specified outside the 4-8 range + */ + DbgInfo->DebugFlag |= DBG_DEFAULTS; + } + } else { + DbgInfo->DebugFlag = wl_atoi( value ); //;?DebugFlag; + } + DbgInfo->DebugFlag = wl_atoi( value ); //;?Delete ASAP + } +#endif /* DBG */ + if ( strcmp( key, PARM_NAME_AUTH_KEY_MGMT_SUITE ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_AUTH_KEY_MGMT_SUITE, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_AUTH_KEY_MGMT_SUITE ) || ( value_convert <= PARM_MAX_AUTH_KEY_MGMT_SUITE )) { + lp->AuthKeyMgmtSuite = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_AUTH_KEY_MGMT_SUITE ); + } + } + else if ( strcmp( key, PARM_NAME_BRSC_2GHZ ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_BRSC_2GHZ, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_BRSC ) || ( value_convert <= PARM_MAX_BRSC )) { + lp->brsc[0] = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invaid; will be ignored\n", PARM_NAME_BRSC_2GHZ ); + } + } + else if ( strcmp( key, PARM_NAME_BRSC_5GHZ ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_BRSC_5GHZ, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_BRSC ) || ( value_convert <= PARM_MAX_BRSC )) { + lp->brsc[1] = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invaid; will be ignored\n", PARM_NAME_BRSC_5GHZ ); + } + } + else if (( strcmp( key, PARM_NAME_DESIRED_SSID ) == 0 ) || ( strcmp( key, PARM_NAME_OWN_SSID ) == 0 )) { + DBG_TRACE( DbgInfo, "SSID, value: %s\n", value ); + + memset( lp->NetworkName, 0, ( PARM_MAX_NAME_LEN + 1 )); + + /* Make sure the value isn't too long */ + string_length = strlen( value ); + if ( string_length > PARM_MAX_NAME_LEN ) { + DBG_WARNING( DbgInfo, "SSID too long; will be truncated\n" ); + string_length = PARM_MAX_NAME_LEN; + } + + memcpy( lp->NetworkName, value, string_length ); + } +#if 0 + else if ( strcmp( key, PARM_NAME_DOWNLOAD_FIRMWARE ) == 0 ) { + DBG_TRACE( DbgInfo, "DOWNLOAD_FIRMWARE, value: %s\n", value ); + memset( lp->fw_image_filename, 0, ( MAX_LINE_SIZE + 1 )); + /* Make sure the value isn't too long */ + string_length = strlen( value ); + if ( string_length > MAX_LINE_SIZE ) { + DBG_WARNING( DbgInfo, "F/W image file name too long; will be ignored\n" ); + } else { + memcpy( lp->fw_image_filename, value, string_length ); + } + } +#endif + else if ( strcmp( key, PARM_NAME_ENABLE_ENCRYPTION ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_ENABLE_ENCRYPTION, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_ENABLE_ENCRYPTION ) && ( value_convert <= PARM_MAX_ENABLE_ENCRYPTION )) { + lp->EnableEncryption = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_ENABLE_ENCRYPTION ); + } + } + else if ( strcmp( key, PARM_NAME_ENCRYPTION ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_ENCRYPTION, value ); + + memset( lp->szEncryption, 0, sizeof( lp->szEncryption )); + + /* Make sure the value isn't too long */ + string_length = strlen( value ); + if ( string_length > sizeof( lp->szEncryption ) ) { + DBG_WARNING( DbgInfo, "%s too long; will be truncated\n", PARM_NAME_ENCRYPTION ); + string_length = sizeof( lp->szEncryption ); + } + + memcpy( lp->szEncryption, value, string_length ); + } + else if ( strcmp( key, PARM_NAME_KEY1 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_KEY1, value ); + + if ( is_valid_key_string( value )) { + memset( lp->DefaultKeys.key[0].key, 0, MAX_KEY_SIZE ); + + key_string2key( value, &lp->DefaultKeys.key[0] ); + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_KEY1 ); + } + } + else if ( strcmp( key, PARM_NAME_KEY2 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_KEY2, value ); + + if ( is_valid_key_string( value )) { + memset( lp->DefaultKeys.key[1].key, 0, MAX_KEY_SIZE ); + + key_string2key( value, &lp->DefaultKeys.key[1] ); + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_KEY2 ); + } + } + else if ( strcmp( key, PARM_NAME_KEY3 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_KEY3, value ); + + if ( is_valid_key_string( value )) { + memset( lp->DefaultKeys.key[2].key, 0, MAX_KEY_SIZE ); + + key_string2key( value, &lp->DefaultKeys.key[2] ); + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_KEY3 ); + } + } + else if ( strcmp( key, PARM_NAME_KEY4 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_KEY4, value ); + + if ( is_valid_key_string( value )) { + memset( lp->DefaultKeys.key[3].key, 0, MAX_KEY_SIZE ); + + key_string2key( value, &lp->DefaultKeys.key[3] ); + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_KEY4 ); + } + } + /* New Parameters for WARP */ + else if ( strcmp( key, PARM_NAME_LOAD_BALANCING ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_LOAD_BALANCING, value ); + lp->loadBalancing = parse_yes_no(value); + } + else if ( strcmp( key, PARM_NAME_MEDIUM_DISTRIBUTION ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_MEDIUM_DISTRIBUTION, value ); + lp->mediumDistribution = parse_yes_no(value); + } + else if ( strcmp( key, PARM_NAME_MICROWAVE_ROBUSTNESS) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_MICROWAVE_ROBUSTNESS, value ); + lp->MicrowaveRobustness = parse_yes_no(value); + } + else if ( strcmp( key, PARM_NAME_MULTICAST_RATE ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_MULTICAST_RATE, value ); + + value_convert = wl_atoi( value ); + + if (( value_convert >= PARM_MIN_MULTICAST_RATE ) && ( value_convert <= PARM_MAX_MULTICAST_RATE )) { + lp->MulticastRate[0] = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_MULTICAST_RATE ); + } + } + else if ( strcmp( key, PARM_NAME_OWN_CHANNEL ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_CHANNEL, value ); + + value_convert = wl_atoi( value ); + if ( wl_is_a_valid_chan( value_convert )) { + if ( value_convert > 14 ) { + value_convert = value_convert | 0x100; + } + lp->Channel = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_OWN_CHANNEL ); + } + } + else if ( strcmp( key, PARM_NAME_OWN_NAME ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_NAME, value ); + + memset( lp->StationName, 0, ( PARM_MAX_NAME_LEN + 1 )); + + /* Make sure the value isn't too long */ + string_length = strlen( value ); + if ( string_length > PARM_MAX_NAME_LEN ) { + DBG_WARNING( DbgInfo, "%s too long; will be truncated\n", PARM_NAME_OWN_NAME ); + string_length = PARM_MAX_NAME_LEN; + } + + memcpy( lp->StationName, value, string_length ); + } + else if ( strcmp( key, PARM_NAME_RTS_THRESHOLD ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_RTS_THRESHOLD ) && ( value_convert <= PARM_MAX_RTS_THRESHOLD )) { + lp->RTSThreshold = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD ); + } + } + else if ( strcmp( key, PARM_NAME_SRSC_2GHZ ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_SRSC_2GHZ, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_SRSC ) || ( value_convert <= PARM_MAX_SRSC )) { + lp->srsc[0] = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invaid; will be ignored\n", PARM_NAME_SRSC_2GHZ ); + } + } + else if ( strcmp( key, PARM_NAME_SRSC_5GHZ ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_SRSC_5GHZ, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_SRSC ) || ( value_convert <= PARM_MAX_SRSC )) { + lp->srsc[1] = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invaid; will be ignored\n", PARM_NAME_SRSC_5GHZ ); + } + } + else if ( strcmp( key, PARM_NAME_SYSTEM_SCALE ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_SYSTEM_SCALE, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_SYSTEM_SCALE ) && ( value_convert <= PARM_MAX_SYSTEM_SCALE )) { + lp->DistanceBetweenAPs = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_SYSTEM_SCALE ); + } + } + else if ( strcmp( key, PARM_NAME_TX_KEY ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_TX_KEY, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_TX_KEY ) && ( value_convert <= PARM_MAX_TX_KEY )) { + lp->TransmitKeyID = wl_atoi( value ); + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_KEY ); + } + } + else if ( strcmp( key, PARM_NAME_TX_RATE ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_TX_RATE ) && ( value_convert <= PARM_MAX_TX_RATE )) { + lp->TxRateControl[0] = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE ); + } + } + else if ( strcmp( key, PARM_NAME_TX_POW_LEVEL ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_TX_POW_LEVEL, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_TX_POW_LEVEL ) || ( value_convert <= PARM_MAX_TX_POW_LEVEL )) { + lp->txPowLevel = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_POW_LEVEL ); + } + } + + /* Need to add? : Country code, Short/Long retry */ + + /* Configuration parameters specific to STA mode */ +#if 1 //;? (HCF_TYPE) & HCF_TYPE_STA +//;?seems reasonable that even an AP-only driver could afford this small additional footprint + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_STA ) { + //;?should we return an error status in AP mode + if ( strcmp( key, PARM_NAME_PORT_TYPE ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_PORT_TYPE, value ); + + value_convert = wl_atoi( value ); + if (( value_convert == PARM_MIN_PORT_TYPE ) || ( value_convert == PARM_MAX_PORT_TYPE )) { + lp->PortType = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_PORT_TYPE ); + } + } + else if ( strcmp( key, PARM_NAME_PM_ENABLED ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_PM_ENABLED, value ); + value_convert = wl_atoi( value ); + /* ;? how about wl_main.c containing + * VALID_PARAM( PARM_PM_ENABLED <= WVLAN_PM_STATE_STANDARD || + * ( PARM_PM_ENABLED & 0x7FFF ) <= WVLAN_PM_STATE_STANDARD ); + */ + if ( ( value_convert & 0x7FFF ) <= PARM_MAX_PM_ENABLED) { + lp->PMEnabled = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_PM_ENABLED ); + //;?this is a data entry error, hence not a DBG_WARNING + } + } + else if ( strcmp( key, PARM_NAME_CREATE_IBSS ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_CREATE_IBSS, value ); + lp->CreateIBSS = parse_yes_no(value); + } + else if ( strcmp( key, PARM_NAME_MULTICAST_RX ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_MULTICAST_RX, value ); + lp->MulticastReceive = parse_yes_no(value); + } + else if ( strcmp( key, PARM_NAME_MAX_SLEEP ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_MAX_SLEEP, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= 0 ) && ( value_convert <= 65535 )) { + lp->MaxSleepDuration = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_MAX_SLEEP ); + } + } + else if ( strcmp( key, PARM_NAME_NETWORK_ADDR ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_NETWORK_ADDR, value ); + + if ( parse_mac_address( value, mac_value ) == ETH_ALEN ) { + memcpy( lp->MACAddress, mac_value, ETH_ALEN ); + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_NETWORK_ADDR ); + } + } + else if ( strcmp( key, PARM_NAME_AUTHENTICATION ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_AUTHENTICATION, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_AUTHENTICATION ) && ( value_convert <= PARM_MAX_AUTHENTICATION )) { + lp->authentication = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_AUTHENTICATION ); + } + } + else if ( strcmp( key, PARM_NAME_OWN_ATIM_WINDOW ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_ATIM_WINDOW, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_OWN_ATIM_WINDOW ) && ( value_convert <= PARM_MAX_OWN_ATIM_WINDOW )) { + lp->atimWindow = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_OWN_ATIM_WINDOW ); + } + } + else if ( strcmp( key, PARM_NAME_PM_HOLDOVER_DURATION ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_PM_HOLDOVER_DURATION, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_PM_HOLDOVER_DURATION ) && ( value_convert <= PARM_MAX_PM_HOLDOVER_DURATION )) { + lp->holdoverDuration = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_PM_HOLDOVER_DURATION ); + } + } + else if ( strcmp( key, PARM_NAME_PROMISCUOUS_MODE ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_PROMISCUOUS_MODE, value ); + lp->promiscuousMode = parse_yes_no(value); + } + else if ( strcmp( key, PARM_NAME_CONNECTION_CONTROL ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_CONNECTION_CONTROL, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_CONNECTION_CONTROL ) && ( value_convert <= PARM_MAX_CONNECTION_CONTROL )) { + lp->connectionControl = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_CONNECTION_CONTROL ); + } + } + + /* Need to add? : Probe Data Rate */ + } +#endif /* (HCF_TYPE) & HCF_TYPE_STA */ + + /* Configuration parameters specific to AP mode */ +#if 1 //;? (HCF_TYPE) & HCF_TYPE_AP + //;?should we restore this to allow smaller memory footprint + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) { + if ( strcmp( key, PARM_NAME_OWN_DTIM_PERIOD ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_DTIM_PERIOD, value ); + + value_convert = wl_atoi( value ); + if ( value_convert >= PARM_MIN_OWN_DTIM_PERIOD ) { + lp->DTIMPeriod = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_OWN_DTIM_PERIOD ); + } + } + else if ( strcmp( key, PARM_NAME_REJECT_ANY ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_REJECT_ANY, value ); + lp->RejectAny = parse_yes_no(value); + } + else if ( strcmp( key, PARM_NAME_EXCLUDE_UNENCRYPTED ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_EXCLUDE_UNENCRYPTED, value ); + lp->ExcludeUnencrypted = parse_yes_no(value); + } + else if ( strcmp( key, PARM_NAME_MULTICAST_PM_BUFFERING ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_MULTICAST_PM_BUFFERING, value ); + lp->ExcludeUnencrypted = parse_yes_no(value); + } + else if ( strcmp( key, PARM_NAME_INTRA_BSS_RELAY ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_INTRA_BSS_RELAY, value ); + lp->ExcludeUnencrypted = parse_yes_no(value); + } + else if ( strcmp( key, PARM_NAME_OWN_BEACON_INTERVAL ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_BEACON_INTERVAL, value ); + + value_convert = wl_atoi( value ); + if ( value_convert >= PARM_MIN_OWN_BEACON_INTERVAL ) { + lp->ownBeaconInterval = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_OWN_BEACON_INTERVAL ); + } + } + else if ( strcmp( key, PARM_NAME_COEXISTENCE ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_COEXISTENCE, value ); + + value_convert = wl_atoi( value ); + if ( value_convert >= PARM_MIN_COEXISTENCE ) { + lp->coexistence = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_COEXISTENCE ); + } + } + +#ifdef USE_WDS + else if ( strcmp( key, PARM_NAME_RTS_THRESHOLD1 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD1, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_RTS_THRESHOLD ) && ( value_convert <= PARM_MAX_RTS_THRESHOLD )) { + lp->wds_port[0].rtsThreshold = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD1 ); + } + } + else if ( strcmp( key, PARM_NAME_RTS_THRESHOLD2 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD2, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_RTS_THRESHOLD ) && ( value_convert <= PARM_MAX_RTS_THRESHOLD )) { + lp->wds_port[1].rtsThreshold = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD2 ); + } + } + else if ( strcmp( key, PARM_NAME_RTS_THRESHOLD3 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD3, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_RTS_THRESHOLD ) && ( value_convert <= PARM_MAX_RTS_THRESHOLD )) { + lp->wds_port[2].rtsThreshold = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD3 ); + } + } + else if ( strcmp( key, PARM_NAME_RTS_THRESHOLD4 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD4, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_RTS_THRESHOLD ) && ( value_convert <= PARM_MAX_RTS_THRESHOLD )) { + lp->wds_port[3].rtsThreshold = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD4 ); + } + } + else if ( strcmp( key, PARM_NAME_RTS_THRESHOLD5 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD5, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_RTS_THRESHOLD ) && ( value_convert <= PARM_MAX_RTS_THRESHOLD )) { + lp->wds_port[4].rtsThreshold = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD5 ); + } + } + else if ( strcmp( key, PARM_NAME_RTS_THRESHOLD6 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD6, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_RTS_THRESHOLD ) && ( value_convert <= PARM_MAX_RTS_THRESHOLD )) { + lp->wds_port[5].rtsThreshold = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD6 ); + } + } + else if ( strcmp( key, PARM_NAME_TX_RATE1 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE1, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_TX_RATE ) && ( value_convert <= PARM_MAX_TX_RATE )) { + lp->wds_port[0].txRateCntl = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE1 ); + } + } + else if ( strcmp( key, PARM_NAME_TX_RATE2 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE2, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_TX_RATE ) && ( value_convert <= PARM_MAX_TX_RATE )) { + lp->wds_port[1].txRateCntl = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE2 ); + } + } + else if ( strcmp( key, PARM_NAME_TX_RATE3 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE3, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_TX_RATE ) && ( value_convert <= PARM_MAX_TX_RATE )) { + lp->wds_port[2].txRateCntl = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE3 ); + } + } + else if ( strcmp( key, PARM_NAME_TX_RATE4 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE4, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_TX_RATE ) && ( value_convert <= PARM_MAX_TX_RATE )) { + lp->wds_port[3].txRateCntl = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE4 ); + } + } + else if ( strcmp( key, PARM_NAME_TX_RATE5 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE5, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_TX_RATE ) && ( value_convert <= PARM_MAX_TX_RATE )) { + lp->wds_port[4].txRateCntl = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE5 ); + } + } + else if ( strcmp( key, PARM_NAME_TX_RATE6 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE6, value ); + + value_convert = wl_atoi( value ); + if (( value_convert >= PARM_MIN_TX_RATE ) && ( value_convert <= PARM_MAX_TX_RATE )) { + lp->wds_port[5].txRateCntl = value_convert; + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE6 ); + } + } + else if ( strcmp( key, PARM_NAME_WDS_ADDRESS1 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS1, value ); + + if ( parse_mac_address( value, mac_value ) == ETH_ALEN ) { + memcpy( lp->wds_port[0].wdsAddress, mac_value, ETH_ALEN ); + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS1 ); + } + } + else if ( strcmp( key, PARM_NAME_WDS_ADDRESS2 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS2, value ); + + if ( parse_mac_address( value, mac_value ) == ETH_ALEN ) { + memcpy( lp->wds_port[1].wdsAddress, mac_value, ETH_ALEN ); + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS2 ); + } + } + else if ( strcmp( key, PARM_NAME_WDS_ADDRESS3 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS3, value ); + + if ( parse_mac_address( value, mac_value ) == ETH_ALEN ) { + memcpy( lp->wds_port[2].wdsAddress, mac_value, ETH_ALEN ); + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS3 ); + } + } + else if ( strcmp( key, PARM_NAME_WDS_ADDRESS4 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS4, value ); + + if ( parse_mac_address( value, mac_value ) == ETH_ALEN ) { + memcpy( lp->wds_port[3].wdsAddress, mac_value, ETH_ALEN ); + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS4 ); + } + } + else if ( strcmp( key, PARM_NAME_WDS_ADDRESS5 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS5, value ); + + if ( parse_mac_address( value, mac_value ) == ETH_ALEN ) { + memcpy( lp->wds_port[4].wdsAddress, mac_value, ETH_ALEN ); + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS5 ); + } + } + else if ( strcmp( key, PARM_NAME_WDS_ADDRESS6 ) == 0 ) { + DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS6, value ); + + if ( parse_mac_address( value, mac_value ) == ETH_ALEN ) { + memcpy( lp->wds_port[5].wdsAddress, mac_value, ETH_ALEN ); + } else { + DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS6 ); + } + } +#endif /* USE_WDS */ + } +#endif /* (HCF_TYPE) & HCF_TYPE_AP */ + + return; +} // translate_option +/*============================================================================*/ + +/******************************************************************************* + * parse_mac_address() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function will parse a mac address string and convert it to a byte + * array. + * + * PARAMETERS: + * + * value - the MAC address, represented as a string + * byte_array - the MAC address, represented as a byte array of length + * ETH_ALEN + * + * RETURNS: + * + * The number of bytes in the final MAC address, should equal to ETH_ALEN. + * + ******************************************************************************/ +int parse_mac_address( char *value, u_char *byte_array ) +{ + int value_offset = 0; + int array_offset = 0; + int field_offset = 0; + char byte_field[3]; + /*------------------------------------------------------------------------*/ + + memset( byte_field, '\0', 3 ); + + while( value[value_offset] != '\0' ) { + /* Skip over the colon chars seperating the bytes, if they exist */ + if ( value[value_offset] == ':' ) { + value_offset++; + continue; + } + + byte_field[field_offset] = value[value_offset]; + field_offset++; + value_offset++; + + /* Once the byte_field is filled, convert it and store it */ + if ( field_offset == 2 ) { + byte_field[field_offset] = '\0'; + byte_array[array_offset] = simple_strtoul( byte_field, NULL, 16 ); + field_offset = 0; + array_offset++; + } + } + + /* Use the array_offset as a check; 6 bytes should be written to the + byte_array */ + return array_offset; +} // parse_mac_address +/*============================================================================*/ + +/******************************************************************************* + * ParseConfigLine() + ******************************************************************************* + * + * DESCRIPTION: + * + * Parses a line from the configuration file into an L-val and an R-val, + * representing a key/value pair. + * + * PARAMETERS: + * + * pszLine - the line from the config file to parse + * ppszLVal - the resulting L-val (Key) + * ppszRVal - the resulting R-val (Value) + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void ParseConfigLine( char *pszLine, char **ppszLVal, char **ppszRVal ) +{ + int i; + int size; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "ParseConfigLine" ); + DBG_ENTER( DbgInfo ); + + /* get a snapshot of our string size */ + size = strlen( pszLine ); + *ppszLVal = NULL; + *ppszRVal = NULL; + + if ( pszLine[0] != '#' && /* skip the line if it is a comment */ + pszLine[0] != '\n'&& /* if it's an empty UNIX line, do nothing */ + !( pszLine[0] == '\r' && pszLine[1] == '\n' ) /* if it's an empty MS-DOS line, do nothing */ + ) { + /* advance past any whitespace, and assign the L-value */ + for( i = 0; i < size; i++ ) { + if ( pszLine[i] != ' ' ) { + *ppszLVal = &pszLine[i]; + break; + } + } + /* advance to the end of the l-value*/ + for( i++; i < size; i++ ) { + if ( pszLine[i] == ' ' || pszLine[i] == '=' ) { + pszLine[i] = '\0'; + break; + } + } + /* make any whitespace and the equal sign a NULL character, and + advance to the R-Value */ + for( i++; i < size; i++ ) { + if ( pszLine[i] == ' ' || pszLine[i] == '=' ) { + pszLine[i] = '\0'; + continue; + } + *ppszRVal = &pszLine[i]; + break; + } + /* make the line ending character(s) a NULL */ + for( i++; i < size; i++ ) { + if ( pszLine[i] == '\n' ) { + pszLine[i] = '\0'; + } + if (( pszLine[i] == '\r' ) && ( pszLine[i+1] == '\n' )) { + pszLine[i] = '\0'; + } + } + } + DBG_LEAVE( DbgInfo ); +} // ParseConfigLine +/*============================================================================*/ + +#endif // USE_PROFILE diff --git a/drivers/staging/wlags49_h2/wl_profile.h b/drivers/staging/wlags49_h2/wl_profile.h new file mode 100644 index 000000000000..a6ac4a3277bc --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_profile.h @@ -0,0 +1,104 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * Header describing information required for the config parsing routines. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/07/23 11:46:19 $ + * $Revision: 1.3 $ + * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_profile.h,v $ + * + ******************************************************************************/ + + + + +#ifndef __WL_PROFILE_H__ +#define __WL_PROFILE_H__ + + + + +/******************************************************************************* + * constant definitions + ******************************************************************************/ +#define ROOT_CONFIG_FILENAME "/etc/agere/iwconfig-" + + +/******************************************************************************* + * function prototypes + ******************************************************************************/ +void parse_config( struct net_device *dev ); + +int readline( int filedesc, char *buffer ); + +void translate_option( char *buffer, struct wl_private *lp ); + +int parse_mac_address( char *value, u_char *byte_array ); + +void ParseConfigLine( char *pszLine, char **ppszLVal, char **ppszRVal ); + + +#endif // __WL_PROFILE_H__ diff --git a/drivers/staging/wlags49_h2/wl_sysfs.c b/drivers/staging/wlags49_h2/wl_sysfs.c new file mode 100644 index 000000000000..864e01a736c8 --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_sysfs.c @@ -0,0 +1,135 @@ +/* + * ex: sw=4 + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +static inline int dev_isalive(const struct net_device *dev) +{ + return dev->reg_state == NETREG_REGISTERED; +} + +/* + * empirically even if tallies are defined as 32 bits entities, only + * high 16 bits are relevant; low half is always zero. It means tallies + * are pretty much useless for traffic counting but at least give overview + * about where error come from + */ +static ssize_t show_tallies(struct device *d, struct device_attribute *attr, + char *buf) +{ + struct net_device *dev = to_net_dev(d); + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + CFG_HERMES_TALLIES_STRCT tallies; + ssize_t ret = -EINVAL; + + read_lock(&dev_base_lock); + if (dev_isalive(dev)) { + wl_lock(lp, &flags); + + if ((ret = wl_get_tallies(lp, &tallies)) == 0) { + wl_unlock(lp, &flags); + ret = snprintf(buf, PAGE_SIZE, + "TxUnicastFrames: %u\n" + "TxMulticastFrames: %u\n" + "TxFragments: %u\n" + "TxUnicastOctets: %u\n" + "TxMulticastOctets: %u\n" + "TxDeferredTransmissions: %u\n" + "TxSingleRetryFrames: %u\n" + "TxMultipleRetryFrames: %u\n" + "TxRetryLimitExceeded: %u\n" + "TxDiscards: %u\n" + "RxUnicastFrames: %u\n" + "RxMulticastFrames: %u\n" + "RxFragments: %u\n" + "RxUnicastOctets: %u\n" + "RxMulticastOctets: %u\n" + "RxFCSErrors: %u\n" + "RxDiscardsNoBuffer: %u\n" + "TxDiscardsWrongSA: %u\n" + "RxWEPUndecryptable: %u\n" + "RxMsgInMsgFragments: %u\n" + "RxMsgInBadMsgFragments: %u\n" + "RxDiscardsWEPICVError: %u\n" + "RxDiscardsWEPExcluded: %u\n" + , + (unsigned int)tallies.TxUnicastFrames, + (unsigned int)tallies.TxMulticastFrames, + (unsigned int)tallies.TxFragments, + (unsigned int)tallies.TxUnicastOctets, + (unsigned int)tallies.TxMulticastOctets, + (unsigned int)tallies.TxDeferredTransmissions, + (unsigned int)tallies.TxSingleRetryFrames, + (unsigned int)tallies.TxMultipleRetryFrames, + (unsigned int)tallies.TxRetryLimitExceeded, + (unsigned int)tallies.TxDiscards, + (unsigned int)tallies.RxUnicastFrames, + (unsigned int)tallies.RxMulticastFrames, + (unsigned int)tallies.RxFragments, + (unsigned int)tallies.RxUnicastOctets, + (unsigned int)tallies.RxMulticastOctets, + (unsigned int)tallies.RxFCSErrors, + (unsigned int)tallies.RxDiscardsNoBuffer, + (unsigned int)tallies.TxDiscardsWrongSA, + (unsigned int)tallies.RxWEPUndecryptable, + (unsigned int)tallies.RxMsgInMsgFragments, + (unsigned int)tallies.RxMsgInBadMsgFragments, + (unsigned int)tallies.RxDiscardsWEPICVError, + (unsigned int)tallies.RxDiscardsWEPExcluded); + } else { + wl_unlock( lp, &flags ); + } + } + + read_unlock(&dev_base_lock); + return ret; +} + +static DEVICE_ATTR(tallies, S_IRUGO, show_tallies, NULL); + +static struct attribute *wlags_attrs[] = { + &dev_attr_tallies.attr, + NULL +}; + +static struct attribute_group wlags_group = { + .name = "wlags", + .attrs = wlags_attrs, +}; + +void register_wlags_sysfs(struct net_device *net) +{ + struct device *dev = &(net->dev); + struct wl_private *lp = wl_priv(net); + + lp->sysfsCreated = sysfs_create_group(&dev->kobj, &wlags_group); +} + +void unregister_wlags_sysfs(struct net_device *net) +{ + struct device *dev = &(net->dev); + struct wl_private *lp = wl_priv(net); + + if (lp->sysfsCreated) + sysfs_remove_group(&dev->kobj, &wlags_group); +} diff --git a/drivers/staging/wlags49_h2/wl_sysfs.h b/drivers/staging/wlags49_h2/wl_sysfs.h new file mode 100644 index 000000000000..6d96d03cf490 --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_sysfs.h @@ -0,0 +1,7 @@ +#ifdef CONFIG_SYSFS +extern void register_wlags_sysfs(struct net_device *); +extern void unregister_wlags_sysfs(struct net_device *); +#else +static void register_wlags_sysfs(struct net_device *) { return; }; +static void unregister_wlags_sysfs(struct net_device *) { return; }; +#endif diff --git a/drivers/staging/wlags49_h2/wl_util.c b/drivers/staging/wlags49_h2/wl_util.c new file mode 100644 index 000000000000..aba05d29a838 --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_util.c @@ -0,0 +1,1604 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * This file defines misc utility functions. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/08/04 12:36:10 $ + * $Revision: 1.6 $ + * $Source: /usr/local/cvs/wl_lkm/wireless/wl_util.c,v $ + * + ******************************************************************************/ + + + + +/******************************************************************************* + * include files + ******************************************************************************/ +#include + +#include +// #include +// #include +#include +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include + +#include +#include +// #include +// #include +// #include + +#include +#include +// #include + +#include +#include +#include +#include +#include + + + +/******************************************************************************* + * global variables + ******************************************************************************/ + +/* A matrix which maps channels to frequencies */ +#define MAX_CHAN_FREQ_MAP_ENTRIES 50 +static const long chan_freq_list[][MAX_CHAN_FREQ_MAP_ENTRIES] = +{ + {1,2412}, + {2,2417}, + {3,2422}, + {4,2427}, + {5,2432}, + {6,2437}, + {7,2442}, + {8,2447}, + {9,2452}, + {10,2457}, + {11,2462}, + {12,2467}, + {13,2472}, + {14,2484}, + {36,5180}, + {40,5200}, + {44,5220}, + {48,5240}, + {52,5260}, + {56,5280}, + {60,5300}, + {64,5320}, + {149,5745}, + {153,5765}, + {157,5785}, + {161,5805} +}; + +#if DBG +extern dbg_info_t *DbgInfo; +#endif /* DBG */ + + + + +/******************************************************************************* + * dbm() + ******************************************************************************* + * + * DESCRIPTION: + * + * Return an energy value in dBm. + * + * PARAMETERS: + * + * value - the energy value to be converted + * + * RETURNS: + * + * the value in dBm + * + ******************************************************************************/ +int dbm( int value ) +{ + /* Truncate the value to be between min and max. */ + if( value < HCF_MIN_SIGNAL_LEVEL ) + value = HCF_MIN_SIGNAL_LEVEL; + + if( value > HCF_MAX_SIGNAL_LEVEL ) + value = HCF_MAX_SIGNAL_LEVEL; + + /* Return the energy value in dBm. */ + return ( value - HCF_0DBM_OFFSET ); +} // dbm +/*============================================================================*/ + + + + +/******************************************************************************* + * percent() + ******************************************************************************* + * + * DESCRIPTION: + * + * Return a value as a percentage of min to max. + * + * PARAMETERS: + * + * value - the value in question + * min - the minimum range value + * max - the maximum range value + * + * RETURNS: + * + * the percentage value + * + ******************************************************************************/ +int percent( int value, int min, int max ) +{ + /* Truncate the value to be between min and max. */ + if( value < min ) + value = min; + + if( value > max ) + value = max; + + /* Return the value as a percentage of min to max. */ + return ((( value - min ) * 100 ) / ( max - min )); +} // percent +/*============================================================================*/ + + + + +/******************************************************************************* + * is_valid_key_string() + ******************************************************************************* + * + * DESCRIPTION: + * + * Checks to determine if the WEP key string is valid + * + * PARAMETERS: + * + * s - the string in question + * + * RETURNS: + * + * non-zero if the string contains a valid key + * + ******************************************************************************/ +int is_valid_key_string( char *s ) +{ + int l; + int i; + /*------------------------------------------------------------------------*/ + + + l = strlen( s ); + + /* 0x followed by 5 or 13 hexadecimal digit pairs is valid */ + if( s[0] == '0' && ( s[1] == 'x' || s[1] == 'X' )) { + if( l == 12 || l == 28 ) { + for( i = 2; i < l; i++ ) { + if( !isxdigit( s[i] )) + return 0; + } + + return 1; + } else { + return 0; + } + } + + /* string with 0, 5, or 13 characters is valid */ + else + { + return( l == 0 || l == 5 || l == 13 ); + } +} // is_valid_key_string +/*============================================================================*/ + + + + +/******************************************************************************* + * hexdigit2int() + ******************************************************************************* + * + * DESCRIPTION: + * + * Converts a hexadecimal digit character to an integer + * + * PARAMETERS: + * + * c - the hexadecimal digit character + * + * RETURNS: + * + * the converted integer + * + ******************************************************************************/ +int hexdigit2int( char c ) +{ + if( c >= '0' && c <= '9' ) + return c - '0'; + + if( c >= 'A' && c <= 'F' ) + return c - 'A' + 10; + + if( c >= 'a' && c <= 'f' ) + return c - 'a' + 10; + + return 0; +} // hexdigit2int +/*============================================================================*/ + + + + +/******************************************************************************* + * key_string2key() + ******************************************************************************* + * + * DESCRIPTION: + * + * Converts a key_string to a key, Assumes the key_string is validated with + * is_valid_key_string(). + * + * PARAMETERS: + * + * ks - the valid key string + * key - a pointer to a KEY_STRUCT where the converted key information will + * be stored. + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void key_string2key( char *ks, KEY_STRCT *key ) +{ + int l,i,n; + char *p; + /*------------------------------------------------------------------------*/ + + + l = strlen( ks ); + + /* 0x followed by hexadecimal digit pairs */ + if( ks[0] == '0' && ( ks[1] == 'x' || ks[1] == 'X' )) { + n = 0; + p = (char *)key->key; + + for( i = 2; i < l; i+=2 ) { + *p++ = ( hexdigit2int( ks[i] ) << 4 ) + hexdigit2int (ks[i+1] ); + n++; + } + + /* Note that endian translation of the length field is not needed here + because it's performed in wl_put_ltv() */ + key->len = n; + } + /* character string */ + else + { + strcpy( (char *)key->key, ks ); + key->len = l; + } + + return; +} // key_string2key +/*============================================================================*/ + + + + +#if DBG +/******************************************************************************* + * DbgHwAddr() + ******************************************************************************* + * + * DESCRIPTION: + * + * Convert a hardware ethernet address to a character string + * + * PARAMETERS: + * + * hwAddr - an ethernet address + * + * RETURNS: + * + * a pointer to a string representing the ethernet address + * + ******************************************************************************/ +const char *DbgHwAddr(unsigned char *hwAddr) +{ + static char buffer[18]; + /*------------------------------------------------------------------------*/ + + + sprintf( buffer, "%02X:%02X:%02X:%02X:%02X:%02X", + hwAddr[0], hwAddr[1], hwAddr[2], hwAddr[3], hwAddr[4], hwAddr[5] ); + + return buffer; +} // DbgHwAddr +/*============================================================================*/ + +#endif /* DBG */ + + + + +/******************************************************************************* + * wl_has_wep() + ******************************************************************************* + * + * DESCRIPTION: + * + * Checks to see if the device supports WEP + * + * PARAMETERS: + * + * ifbp - the IFB pointer of the device in question + * + * RETURNS: + * + * 1 if WEP is known enabled, else 0 + * + ******************************************************************************/ +int wl_has_wep (IFBP ifbp) +{ + CFG_PRIVACY_OPT_IMPLEMENTED_STRCT ltv; + int rc, privacy; + /*------------------------------------------------------------------------*/ + + + /* This function allows us to distiguish bronze cards from other types, to + know if WEP exists. Does not distinguish (because there's no way to) + between silver and gold cards. */ + ltv.len = 2; + ltv.typ = CFG_PRIVACY_OPT_IMPLEMENTED; + + rc = hcf_get_info( ifbp, (LTVP) <v ); + + privacy = CNV_LITTLE_TO_INT( ltv.privacy_opt_implemented ); + + //return rc ? 0 : privacy; + return 1; +} // wl_has_wep +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_hcf_error() + ******************************************************************************* + * + * DESCRIPTION: + * + * Report the type of HCF error message + * + * PARAMETERS: + * + * none + * + * RETURNS: + * + * A descriptive string indicating the error, quiet otherwise. + * + ******************************************************************************/ +void wl_hcf_error( struct net_device *dev, int hcfStatus ) +{ + char buffer[64], *pMsg; + /*------------------------------------------------------------------------*/ + + + if( hcfStatus != HCF_SUCCESS ) { + switch( hcfStatus ) { + + case HCF_ERR_TIME_OUT: + + pMsg = "Expected adapter event did not occur in expected time"; + break; + + + case HCF_ERR_NO_NIC: + + pMsg = "Card not found (ejected unexpectedly)"; + break; + + + case HCF_ERR_LEN: + + pMsg = "Command buffer size insufficient"; + break; + + + case HCF_ERR_INCOMP_PRI: + + pMsg = "Primary functions are not compatible"; + break; + + + case HCF_ERR_INCOMP_FW: + + pMsg = "Primary functions are compatible, " + "station/ap functions are not"; + break; + + + case HCF_ERR_BUSY: + + pMsg = "Inquire cmd while another Inquire in progress"; + break; + + + //case HCF_ERR_SEQ_BUG: + + // pMsg = "Unexpected command completed"; + // break; + + + case HCF_ERR_DEFUNCT_AUX: + + pMsg = "Timeout on ack for enable/disable of AUX registers"; + break; + + + case HCF_ERR_DEFUNCT_TIMER: + pMsg = "Timeout on timer calibration during initialization process"; + break; + + + case HCF_ERR_DEFUNCT_TIME_OUT: + pMsg = "Timeout on Busy bit drop during BAP setup"; + break; + + + case HCF_ERR_DEFUNCT_CMD_SEQ: + pMsg = "Hermes and HCF are out of sync"; + break; + + + default: + + sprintf( buffer, "Error code %d", hcfStatus ); + pMsg = buffer; + break; + } + + printk( KERN_INFO "%s: Wireless, HCF failure: \"%s\"\n", + dev->name, pMsg ); + } +} // wl_hcf_error +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_endian_translate_event() + ******************************************************************************* + * + * DESCRIPTION: + * + * Determines what type of data is in the mailbox and performs the proper + * endian translation. + * + * PARAMETERS: + * + * pLtv - an LTV pointer + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_endian_translate_event( ltv_t *pLtv ) +{ + DBG_FUNC( "wl_endian_translate_event" ); + DBG_ENTER( DbgInfo ); + + + switch( pLtv->typ ) { + case CFG_TALLIES: + break; + + + case CFG_SCAN: + { + int numAPs; + SCAN_RS_STRCT *pAps = (SCAN_RS_STRCT*)&pLtv->u.u8[0]; + + numAPs = (hcf_16)(( (size_t)( pLtv->len - 1 ) * 2 ) / + (sizeof( SCAN_RS_STRCT ))); + + while( numAPs >= 1 ) { + numAPs--; + + pAps[numAPs].channel_id = + CNV_LITTLE_TO_INT( pAps[numAPs].channel_id ); + + pAps[numAPs].noise_level = + CNV_LITTLE_TO_INT( pAps[numAPs].noise_level ); + + pAps[numAPs].signal_level = + CNV_LITTLE_TO_INT( pAps[numAPs].signal_level ); + + pAps[numAPs].beacon_interval_time = + CNV_LITTLE_TO_INT( pAps[numAPs].beacon_interval_time ); + + pAps[numAPs].capability = + CNV_LITTLE_TO_INT( pAps[numAPs].capability ); + + pAps[numAPs].ssid_len = + CNV_LITTLE_TO_INT( pAps[numAPs].ssid_len ); + + pAps[numAPs].ssid_val[pAps[numAPs].ssid_len] = 0; + + } + } + break; + + + case CFG_ACS_SCAN: + { + PROBE_RESP *probe_resp = (PROBE_RESP *)pLtv; + + probe_resp->frameControl = CNV_LITTLE_TO_INT( probe_resp->frameControl ); + probe_resp->durID = CNV_LITTLE_TO_INT( probe_resp->durID ); + probe_resp->sequence = CNV_LITTLE_TO_INT( probe_resp->sequence ); + probe_resp->dataLength = CNV_LITTLE_TO_INT( probe_resp->dataLength ); + +#ifndef WARP + probe_resp->lenType = CNV_LITTLE_TO_INT( probe_resp->lenType ); +#endif // WARP + + probe_resp->beaconInterval = CNV_LITTLE_TO_INT( probe_resp->beaconInterval ); + probe_resp->capability = CNV_LITTLE_TO_INT( probe_resp->capability ); + probe_resp->flags = CNV_LITTLE_TO_INT( probe_resp->flags ); + } + break; + + + case CFG_LINK_STAT: +#define ls ((LINK_STATUS_STRCT *)pLtv) + ls->linkStatus = CNV_LITTLE_TO_INT( ls->linkStatus ); + break; +#undef ls + + case CFG_ASSOC_STAT: + { + ASSOC_STATUS_STRCT *pAs = (ASSOC_STATUS_STRCT *)pLtv; + + pAs->assocStatus = CNV_LITTLE_TO_INT( pAs->assocStatus ); + } + break; + + + case CFG_SECURITY_STAT: + { + SECURITY_STATUS_STRCT *pSs = (SECURITY_STATUS_STRCT *)pLtv; + + pSs->securityStatus = CNV_LITTLE_TO_INT( pSs->securityStatus ); + pSs->reason = CNV_LITTLE_TO_INT( pSs->reason ); + } + break; + + + case CFG_WMP: + break; + + + case CFG_NULL: + break; + + + default: + break; + } + + DBG_LEAVE( DbgInfo ); + return; +} // wl_endian_translate_event +/*============================================================================*/ + + +/******************************************************************************* + * msf_assert() + ******************************************************************************* + * + * DESCRIPTION: + * + * Print statement used to display asserts from within the HCF. Only called + * when asserts in the HCF are turned on. See hcfcfg.h for more information. + * + * PARAMETERS: + * + * file_namep - the filename in which the assert occurred. + * line_number - the line number on which the assert occurred. + * trace - a comment associated with the assert. + * qual - return code or other value related to the assert + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void msf_assert( unsigned int line_number, hcf_16 trace, hcf_32 qual ) +{ + DBG_PRINT( "HCF ASSERT: Line %d, VAL: 0x%.8x\n", line_number, /*;?*/(u32)qual ); +} // msf_assert +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_parse_ds_ie() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function parses the Direct Sequence Parameter Set IE, used to + * determine channel/frequency information. + * + * PARAMETERS: + * + * probe_rsp - a pointer to a PROBE_RESP structure containing the probe + * response. + * + * RETURNS: + * + * The channel on which the BSS represented by this probe response is + * transmitting. + * + ******************************************************************************/ +hcf_8 wl_parse_ds_ie( PROBE_RESP *probe_rsp ) +{ + int i; + int ie_length = 0; + hcf_8 *buf; + hcf_8 buf_size; + /*------------------------------------------------------------------------*/ + + + if( probe_rsp == NULL ) { + return 0; + } + + buf = probe_rsp->rawData; + buf_size = sizeof( probe_rsp->rawData ); + + + for( i = 0; i < buf_size; i++ ) { + if( buf[i] == DS_INFO_ELEM ) { + /* Increment by 1 to get the length, and test it; in a DS element, + length should always be 1 */ + i++; + ie_length = buf[i]; + + if( buf[i] == 1 ) { + /* Get the channel information */ + i++; + return buf[i]; + } + } + } + + /* If we get here, we didn't find a DS-IE, which is strange */ + return 0; +} // wl_parse_ds_ie + + +/******************************************************************************* + * wl_parse_wpa_ie() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function parses the Probe Response for a valid WPA-IE. + * + * PARAMETERS: + * + * probe_rsp - a pointer to a PROBE_RESP structure containing the probe + * response + * length - a pointer to an hcf_16 in which the size of the WPA-IE will + * be stored (if found). + * + * RETURNS: + * + * A pointer to the location in the probe response buffer where a valid + * WPA-IE lives. The length of this IE is written back to the 'length' + * argument passed to the function. + * + ******************************************************************************/ +hcf_8 * wl_parse_wpa_ie( PROBE_RESP *probe_rsp, hcf_16 *length ) +{ + int i; + int ie_length = 0; + hcf_8 *buf; + hcf_8 buf_size; + hcf_8 wpa_oui[] = WPA_OUI_TYPE; + /*------------------------------------------------------------------------*/ + + + if( probe_rsp == NULL || length == NULL ) { + return NULL; + } + + buf = probe_rsp->rawData; + buf_size = sizeof( probe_rsp->rawData ); + *length = 0; + + + for( i = 0; i < buf_size; i++ ) { + if( buf[i] == GENERIC_INFO_ELEM ) { + /* Increment by one to get the IE length */ + i++; + ie_length = probe_rsp->rawData[i]; + + /* Increment by one to point to the IE payload */ + i++; + + /* Does the IE contain a WPA OUI? If not, it's a proprietary IE */ + if( memcmp( &buf[i], &wpa_oui, WPA_SELECTOR_LEN ) == 0 ) { + /* Pass back length and return a pointer to the WPA-IE */ + /* NOTE: Length contained in the WPA-IE is only the length of + the payload. The entire WPA-IE, including the IE identifier + and the length, is 2 bytes larger */ + *length = ie_length + 2; + + /* Back up the pointer 2 bytes to include the IE identifier and + the length in the buffer returned */ + i -= 2; + return &buf[i]; + } + + /* Increment past this non-WPA IE and continue looking */ + i += ( ie_length - 1 ); + } + } + + /* If we're here, we didn't find a WPA-IE in the buffer */ + return NULL; +} // wl_parse_wpa_ie + + +/******************************************************************************* + * wl_print_wpa_ie() + ******************************************************************************* + * + * DESCRIPTION: + * + * Function used to take a WPA Information Element (WPA-IE) buffer and + * display it in a readable format. + * + * PARAMETERS: + * + * buffer - the byte buffer containing the WPA-IE + * length - the length of the above buffer + * + * RETURNS: + * + * A pointer to the formatted WPA-IE string. Note that the format used is + * byte-by-byte printing as %02x hex values with no spaces. This is + * required for proper operation with some WPA supplicants. + * + ******************************************************************************/ +hcf_8 * wl_print_wpa_ie( hcf_8 *buffer, int length ) +{ + int count; + int rows; + int remainder; + int rowsize = 4; + hcf_8 row_buf[64]; + static hcf_8 output[512]; + /*------------------------------------------------------------------------*/ + + + memset( output, 0, sizeof( output )); + memset( row_buf, 0, sizeof( row_buf )); + + + /* Determine how many rows will be needed, and the remainder */ + rows = length / rowsize; + remainder = length % rowsize; + + + /* Format the rows */ + for( count = 0; count < rows; count++ ) { + sprintf( row_buf, "%02x%02x%02x%02x", + buffer[count*rowsize], buffer[count*rowsize+1], + buffer[count*rowsize+2], buffer[count*rowsize+3]); + strcat( output, row_buf ); + } + + memset( row_buf, 0, sizeof( row_buf )); + + + /* Format the remainder */ + for( count = 0; count < remainder; count++ ) { + sprintf( row_buf, "%02x", buffer[(rows*rowsize)+count]); + strcat( output, row_buf ); + } + + return output; +} // wl_print_wpa_ie +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_is_a_valid_chan() + ******************************************************************************* + * + * DESCRIPTION: + * + * Checks if a given channel is valid + * + * PARAMETERS: + * + * channel - the channel + * + * RETURNS: + * + * 1 if TRUE + * 0 if FALSE + * + ******************************************************************************/ +int wl_is_a_valid_chan( int channel ) +{ + int i; + /*------------------------------------------------------------------------*/ + + + /* Strip out the high bit set by the FW for 802.11a channels */ + if( channel & 0x100 ) { + channel = channel & 0x0FF; + } + + /* Iterate through the matrix and retrieve the frequency */ + for( i = 0; i < MAX_CHAN_FREQ_MAP_ENTRIES; i++ ) { + if( chan_freq_list[i][0] == channel ) { + return 1; + } + } + + return 0; +} // wl_is_a_valid_chan +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_get_chan_from_freq() + ******************************************************************************* + * + * DESCRIPTION: + * + * Checks if a given frequency is valid + * + * PARAMETERS: + * + * freq - the frequency + * + * RETURNS: + * + * 1 if TRUE + * 0 if FALSE + * + ******************************************************************************/ +int wl_is_a_valid_freq( long frequency ) +{ + int i; + /*------------------------------------------------------------------------*/ + + + /* Iterate through the matrix and retrieve the channel */ + for( i = 0; i < MAX_CHAN_FREQ_MAP_ENTRIES; i++ ) { + if( chan_freq_list[i][1] == frequency ) { + return 1; + } + } + + return 0; +} // wl_is_a_valid_freq +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_get_freq_from_chan() + ******************************************************************************* + * + * DESCRIPTION: + * + * Function used to look up the frequency for a given channel on which the + * adapter is Tx/Rx. + * + * PARAMETERS: + * + * channel - the channel + * + * RETURNS: + * + * The corresponding frequency + * + ******************************************************************************/ +long wl_get_freq_from_chan( int channel ) +{ + int i; + /*------------------------------------------------------------------------*/ + + + /* Strip out the high bit set by the FW for 802.11a channels */ + if( channel & 0x100 ) { + channel = channel & 0x0FF; + } + + /* Iterate through the matrix and retrieve the frequency */ + for( i = 0; i < MAX_CHAN_FREQ_MAP_ENTRIES; i++ ) { + if( chan_freq_list[i][0] == channel ) { + return chan_freq_list[i][1]; + } + } + + return 0; +} // wl_get_freq_from_chan +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_get_chan_from_freq() + ******************************************************************************* + * + * DESCRIPTION: + * + * Function used to look up the channel for a given frequency on which the + * adapter is Tx/Rx. + * + * PARAMETERS: + * + * frequency - the frequency + * + * RETURNS: + * + * The corresponding channel + * + ******************************************************************************/ +int wl_get_chan_from_freq( long frequency ) +{ + int i; + /*------------------------------------------------------------------------*/ + + + /* Iterate through the matrix and retrieve the channel */ + for( i = 0; i < MAX_CHAN_FREQ_MAP_ENTRIES; i++ ) { + if( chan_freq_list[i][1] == frequency ) { + return chan_freq_list[i][0]; + } + } + + return 0; +} // wl_get_chan_from_freq +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_process_link_status() + ******************************************************************************* + * + * DESCRIPTION: + * + * Process the link status message signaled by the device. + * + * PARAMETERS: + * + * lp - a pointer to the device's private structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_process_link_status( struct wl_private *lp ) +{ + hcf_16 link_stat; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_process_link_status" ); + DBG_ENTER( DbgInfo ); + + if( lp != NULL ) { + //link_stat = lp->hcfCtx.IFB_DSLinkStat & CFG_LINK_STAT_FW; + link_stat = lp->hcfCtx.IFB_LinkStat & CFG_LINK_STAT_FW; + switch( link_stat ) { + case 1: + DBG_TRACE( DbgInfo, "Link Status : Connected\n" ); + wl_wext_event_ap( lp->dev ); + break; + case 2: + DBG_TRACE( DbgInfo, "Link Status : Disconnected\n" ); + break; + case 3: + DBG_TRACE( DbgInfo, "Link Status : Access Point Change\n" ); + break; + case 4: + DBG_TRACE( DbgInfo, "Link Status : Access Point Out of Range\n" ); + break; + case 5: + DBG_TRACE( DbgInfo, "Link Status : Access Point In Range\n" ); + break; + default: + DBG_TRACE( DbgInfo, "Link Status : UNKNOWN (0x%04x)\n", link_stat ); + break; + } + } + DBG_LEAVE( DbgInfo ); + return; +} // wl_process_link_status +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_process_probe_response() + ******************************************************************************* + * + * DESCRIPTION: + * + * Process the probe responses retunred by the device as a result of an + * active scan. + * + * PARAMETERS: + * + * lp - a pointer to the device's private structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_process_probe_response( struct wl_private *lp ) +{ + PROBE_RESP *probe_rsp; + hcf_8 *wpa_ie = NULL; + hcf_16 wpa_ie_len = 0; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wl_process_probe_response" ); + DBG_ENTER( DbgInfo ); + + + if( lp != NULL ) { + probe_rsp = (PROBE_RESP *)&lp->ProbeResp; + + wl_endian_translate_event( (ltv_t *)probe_rsp ); + + DBG_TRACE( DbgInfo, "(%s) =========================\n", lp->dev->name ); + DBG_TRACE( DbgInfo, "(%s) length : 0x%04x.\n", lp->dev->name, + probe_rsp->length ); + + if( probe_rsp->length > 1 ) { + DBG_TRACE( DbgInfo, "(%s) infoType : 0x%04x.\n", lp->dev->name, + probe_rsp->infoType ); + + DBG_TRACE( DbgInfo, "(%s) signal : 0x%02x.\n", lp->dev->name, + probe_rsp->signal ); + + DBG_TRACE( DbgInfo, "(%s) silence : 0x%02x.\n", lp->dev->name, + probe_rsp->silence ); + + DBG_TRACE( DbgInfo, "(%s) rxFlow : 0x%02x.\n", lp->dev->name, + probe_rsp->rxFlow ); + + DBG_TRACE( DbgInfo, "(%s) rate : 0x%02x.\n", lp->dev->name, + probe_rsp->rate ); + + DBG_TRACE( DbgInfo, "(%s) frame cntl : 0x%04x.\n", lp->dev->name, + probe_rsp->frameControl ); + + DBG_TRACE( DbgInfo, "(%s) durID : 0x%04x.\n", lp->dev->name, + probe_rsp->durID ); + + DBG_TRACE( DbgInfo, "(%s) address1 : %s\n", lp->dev->name, + DbgHwAddr( probe_rsp->address1 )); + + DBG_TRACE( DbgInfo, "(%s) address2 : %s\n", lp->dev->name, + DbgHwAddr( probe_rsp->address2 )); + + DBG_TRACE( DbgInfo, "(%s) BSSID : %s\n", lp->dev->name, + DbgHwAddr( probe_rsp->BSSID )); + + DBG_TRACE( DbgInfo, "(%s) sequence : 0x%04x.\n", lp->dev->name, + probe_rsp->sequence ); + + DBG_TRACE( DbgInfo, "(%s) address4 : %s\n", lp->dev->name, + DbgHwAddr( probe_rsp->address4 )); + + DBG_TRACE( DbgInfo, "(%s) datalength : 0x%04x.\n", lp->dev->name, + probe_rsp->dataLength ); + + DBG_TRACE( DbgInfo, "(%s) DA : %s\n", lp->dev->name, + DbgHwAddr( probe_rsp->DA )); + + DBG_TRACE( DbgInfo, "(%s) SA : %s\n", lp->dev->name, + DbgHwAddr( probe_rsp->SA )); + +#ifdef WARP + + DBG_TRACE( DbgInfo, "(%s) channel : %d\n", lp->dev->name, + probe_rsp->channel ); + + DBG_TRACE( DbgInfo, "(%s) band : %d\n", lp->dev->name, + probe_rsp->band ); +#else + DBG_TRACE( DbgInfo, "(%s) lenType : 0x%04x.\n", lp->dev->name, + probe_rsp->lenType ); +#endif // WARP + + DBG_TRACE( DbgInfo, "(%s) timeStamp : %d.%d.%d.%d.%d.%d.%d.%d\n", + lp->dev->name, + probe_rsp->timeStamp[0], + probe_rsp->timeStamp[1], + probe_rsp->timeStamp[2], + probe_rsp->timeStamp[3], + probe_rsp->timeStamp[4], + probe_rsp->timeStamp[5], + probe_rsp->timeStamp[6], + probe_rsp->timeStamp[7]); + + DBG_TRACE( DbgInfo, "(%s) beaconInt : 0x%04x.\n", lp->dev->name, + probe_rsp->beaconInterval ); + + DBG_TRACE( DbgInfo, "(%s) capability : 0x%04x.\n", lp->dev->name, + probe_rsp->capability ); + + DBG_TRACE( DbgInfo, "(%s) SSID len : 0x%04x.\n", lp->dev->name, + probe_rsp->rawData[1] ); + + + if( probe_rsp->rawData[1] > 0 ) { + char ssid[HCF_MAX_NAME_LEN]; + + memset( ssid, 0, sizeof( ssid )); + strncpy( ssid, &probe_rsp->rawData[2], + probe_rsp->rawData[1] ); + + DBG_TRACE( DbgInfo, "(%s) SSID : %s\n", + lp->dev->name, ssid ); + } + + + /* Parse out the WPA-IE, if one exists */ + wpa_ie = wl_parse_wpa_ie( probe_rsp, &wpa_ie_len ); + if( wpa_ie != NULL ) { + DBG_TRACE( DbgInfo, "(%s) WPA-IE : %s\n", + lp->dev->name, wl_print_wpa_ie( wpa_ie, wpa_ie_len )); + } + + DBG_TRACE( DbgInfo, "(%s) flags : 0x%04x.\n", + lp->dev->name, probe_rsp->flags ); + } + + DBG_TRACE( DbgInfo, "\n" ); + + + /* If probe response length is 1, then the scan is complete */ + if( probe_rsp->length == 1 ) { + DBG_TRACE( DbgInfo, "SCAN COMPLETE\n" ); + lp->probe_results.num_aps = lp->probe_num_aps; + lp->probe_results.scan_complete = TRUE; + + /* Reset the counter for the next scan request */ + lp->probe_num_aps = 0; + + /* Send a wireless extensions event that the scan completed */ + wl_wext_event_scan_complete( lp->dev ); + } else { + /* Only copy to the table if the entry is unique; APs sometimes + respond more than once to a probe */ + if( lp->probe_num_aps == 0 ) { + /* Copy the info to the ScanResult structure in the private + adapter struct */ + memcpy( &( lp->probe_results.ProbeTable[lp->probe_num_aps] ), + probe_rsp, sizeof( PROBE_RESP )); + + /* Increment the number of APs detected */ + lp->probe_num_aps++; + } else { + int count; + int unique = 1; + + for( count = 0; count < lp->probe_num_aps; count++ ) { + if( memcmp( &( probe_rsp->BSSID ), + lp->probe_results.ProbeTable[count].BSSID, + ETH_ALEN ) == 0 ) { + unique = 0; + } + } + + if( unique ) { + /* Copy the info to the ScanResult structure in the + private adapter struct. Only copy if there's room in the + table */ + if( lp->probe_num_aps < MAX_NAPS ) + { + memcpy( &( lp->probe_results.ProbeTable[lp->probe_num_aps] ), + probe_rsp, sizeof( PROBE_RESP )); + } + else + { + DBG_WARNING( DbgInfo, "Num of scan results exceeds storage, truncating\n" ); + } + + /* Increment the number of APs detected. Note I do this + here even when I don't copy the probe response to the + buffer in order to detect the overflow condition */ + lp->probe_num_aps++; + } + } + } + } + + DBG_LEAVE( DbgInfo ); + return; +} // wl_process_probe_response +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_process_updated_record() + ******************************************************************************* + * + * DESCRIPTION: + * + * Process the updated information record message signaled by the device. + * + * PARAMETERS: + * + * lp - a pointer to the device's private structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_process_updated_record( struct wl_private *lp ) +{ + DBG_FUNC( "wl_process_updated_record" ); + DBG_ENTER( DbgInfo ); + + + if( lp != NULL ) { + lp->updatedRecord.u.u16[0] = CNV_LITTLE_TO_INT( lp->updatedRecord.u.u16[0] ); + + switch( lp->updatedRecord.u.u16[0] ) { + case CFG_CUR_COUNTRY_INFO: + DBG_TRACE( DbgInfo, "Updated Record: CFG_CUR_COUNTRY_INFO\n" ); + wl_connect( lp ); + break; + + case CFG_PORT_STAT: + DBG_TRACE( DbgInfo, "Updated Record: WAIT_FOR_CONNECT (0xFD40)\n" ); + //wl_connect( lp ); + break; + + default: + DBG_TRACE( DbgInfo, "UNKNOWN: 0x%04x\n", + lp->updatedRecord.u.u16[0] ); + } + } + + DBG_LEAVE( DbgInfo ); + return; +} // wl_process_updated_record +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_process_assoc_status() + ******************************************************************************* + * + * DESCRIPTION: + * + * Process the association status event signaled by the device. + * + * PARAMETERS: + * + * lp - a pointer to the device's private structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_process_assoc_status( struct wl_private *lp ) +{ + ASSOC_STATUS_STRCT *assoc_stat; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wl_process_assoc_status" ); + DBG_ENTER( DbgInfo ); + + + if( lp != NULL ) { + assoc_stat = (ASSOC_STATUS_STRCT *)&lp->assoc_stat; + + wl_endian_translate_event( (ltv_t *)assoc_stat ); + + switch( assoc_stat->assocStatus ) { + case 1: + DBG_TRACE( DbgInfo, "Association Status : STA Associated\n" ); + break; + + case 2: + DBG_TRACE( DbgInfo, "Association Status : STA Reassociated\n" ); + break; + + case 3: + DBG_TRACE( DbgInfo, "Association Status : STA Disassociated\n" ); + break; + + default: + DBG_TRACE( DbgInfo, "Association Status : UNKNOWN (0x%04x)\n", + assoc_stat->assocStatus ); + break; + } + + DBG_TRACE( DbgInfo, "STA Address : %s\n", + DbgHwAddr( assoc_stat->staAddr )); + + if(( assoc_stat->assocStatus == 2 ) && ( assoc_stat->len == 8 )) { + DBG_TRACE( DbgInfo, "Old AP Address : %s\n", + DbgHwAddr( assoc_stat->oldApAddr )); + } + } + + DBG_LEAVE( DbgInfo ); + return; +} // wl_process_assoc_status +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_process_security_status() + ******************************************************************************* + * + * DESCRIPTION: + * + * Process the security status message signaled by the device. + * + * PARAMETERS: + * + * lp - a pointer to the device's private structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_process_security_status( struct wl_private *lp ) +{ + SECURITY_STATUS_STRCT *sec_stat; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wl_process_security_status" ); + DBG_ENTER( DbgInfo ); + + + if( lp != NULL ) { + sec_stat = (SECURITY_STATUS_STRCT *)&lp->sec_stat; + + wl_endian_translate_event( (ltv_t *)sec_stat ); + + switch( sec_stat->securityStatus ) { + case 1: + DBG_TRACE( DbgInfo, "Security Status : Dissassociate [AP]\n" ); + break; + + case 2: + DBG_TRACE( DbgInfo, "Security Status : Deauthenticate [AP]\n" ); + break; + + case 3: + DBG_TRACE( DbgInfo, "Security Status : Authenticate Fail [STA] or [AP]\n" ); + break; + + case 4: + DBG_TRACE( DbgInfo, "Security Status : MIC Fail\n" ); + break; + + case 5: + DBG_TRACE( DbgInfo, "Security Status : Associate Fail\n" ); + break; + + default: + DBG_TRACE( DbgInfo, "Security Status : UNKNOWN (0x%04x)\n", + sec_stat->securityStatus ); + break; + } + + DBG_TRACE( DbgInfo, "STA Address : %s\n", + DbgHwAddr( sec_stat->staAddr )); + DBG_TRACE( DbgInfo, "Reason : 0x%04x \n", sec_stat->reason ); + + } + + DBG_LEAVE( DbgInfo ); + return; +} // wl_process_security_status +/*============================================================================*/ + +int wl_get_tallies(struct wl_private *lp, + CFG_HERMES_TALLIES_STRCT *tallies) +{ + int ret = 0; + int status; + CFG_HERMES_TALLIES_STRCT *pTallies; + + DBG_FUNC( "wl_get_tallies" ); + DBG_ENTER(DbgInfo); + + /* Get the current tallies from the adapter */ + lp->ltvRecord.len = 1 + HCF_TOT_TAL_CNT * sizeof(hcf_16); + lp->ltvRecord.typ = CFG_TALLIES; + + status = hcf_get_info(&(lp->hcfCtx), (LTVP)&(lp->ltvRecord)); + + if( status == HCF_SUCCESS ) { + pTallies = (CFG_HERMES_TALLIES_STRCT *)&(lp->ltvRecord.u.u32); + memcpy(tallies, pTallies, sizeof(*tallies)); + DBG_TRACE( DbgInfo, "Get tallies okay, dixe: %d\n", sizeof(*tallies) ); + } else { + DBG_TRACE( DbgInfo, "Get tallies failed\n" ); + ret = -EFAULT; + } + + DBG_LEAVE( DbgInfo ); + + return ret; +} + +/******************************************************************************* + * wl_atoi() + ******************************************************************************* + * + * DESCRIPTION: + * + * Believe it or not, we need our own implementation of atoi in the kernel. + * + * PARAMETERS: + * + * string - the ASCII string to convert to an integer + * + * RETURNS: + * + * unsigned integer + * + ******************************************************************************/ +unsigned int wl_atoi( char *string ) +{ +unsigned int base = 10; //default to decimal +unsigned int value = 0; +unsigned int c; +int i = strlen( string ); + + if ( i > 2 && string[0] == '0' && ( string[1] | ('X'^'x') ) == 'x' ) { + base = 16; + string +=2; + } + while ( ( c = *string++ ) != '\0' ) { + if ( value > UINT_MAX / base ) { //test for overrun + DBG_FUNC( "wl_atoi" ); //don't overload the log file with good messages + DBG_ENTER( DbgInfo ); + DBG_ERROR( DbgInfo, "string \"%s\", lenght exceeds expectations\n", string ); + printk( "<1>string \"%s\", lenght exceeds expectations\n", string ); + DBG_LEAVE( DbgInfo ); + break; + } + c -= '0'; + if ( 0 <= c && c <= 9 ) value = base * value + c; + else if ( base == 16 ) { + c += '0'; + c |= 'A'^'a'; + c = c - 'a'+ 10; + if ( 10 <= c && c <= 15 ) value = base * value + c; + } + } + return value; +} // wl_atoi + diff --git a/drivers/staging/wlags49_h2/wl_util.h b/drivers/staging/wlags49_h2/wl_util.h new file mode 100644 index 000000000000..b7593375480f --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_util.h @@ -0,0 +1,119 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * Header describing information required for utility functions used + * throughout the driver. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/07/19 08:16:15 $ + * $Revision: 1.2 $ + * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_util.h,v $ + * + ******************************************************************************/ + +#ifndef __WL_UTIL_H__ +#define __WL_UTIL_H__ + +/******************************************************************************* + * function prototypes + ******************************************************************************/ +int dbm( int value ); + +int is_valid_key_string( char *s ); + +void key_string2key( char *ks, KEY_STRCT *key ); + +int hexdigit2int( char c ); + +void wl_hcf_error( struct net_device *dev, int hcfStatus ); + +void wl_endian_translate_event( ltv_t *pLtv ); + +int wl_has_wep( IFBP ifbp ); + + +#if DBG +const char *DbgHwAddr( unsigned char *hwAddr ); +#endif // DBG + +hcf_8 wl_parse_ds_ie( PROBE_RESP *probe_rsp ); +hcf_8 * wl_parse_wpa_ie( PROBE_RESP *probe_rsp, hcf_16 *length ); +hcf_8 * wl_print_wpa_ie( hcf_8 *buffer, int length ); + +int wl_get_tallies(struct wl_private *, CFG_HERMES_TALLIES_STRCT *); +int wl_is_a_valid_chan( int channel ); +int wl_is_a_valid_freq( long frequency ); +long wl_get_freq_from_chan( int channel ); +int wl_get_chan_from_freq( long frequency ); + +void wl_process_link_status( struct wl_private *lp ); +void wl_process_probe_response( struct wl_private *lp ); +void wl_process_updated_record( struct wl_private *lp ); +void wl_process_assoc_status( struct wl_private *lp ); +void wl_process_security_status( struct wl_private *lp ); + +unsigned int wl_atoi( char *string ); + +#endif // __WL_UTIL_H__ diff --git a/drivers/staging/wlags49_h2/wl_version.h b/drivers/staging/wlags49_h2/wl_version.h new file mode 100644 index 000000000000..909a5bc97d01 --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_version.h @@ -0,0 +1,193 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * This header file contains version information for the code base, as well as + * special definitions and macros needed by certain versions of the code. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/08/04 12:36:10 $ + * $Revision: 1.7 $ + * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_version.h,v $ + * + ******************************************************************************/ + +#ifndef __WL_VERSION_H__ +#define __WL_VERSION_H__ + +/******************************************************************************* + * include files + ******************************************************************************/ +//#include +#include + +#ifndef CONFIG_MODVERSIONS +#define __NO_VERSION__ +#endif // CONFIG_MODVERSIONS + +/******************************************************************************* + * constant definitions + ******************************************************************************/ + +#define VENDOR_NAME "Agere Systems, http://www.agere.com" + +#define DRIVER_NAME "wlags49" +#define DRV_IDENTITY 49 + +#define DRV_MAJOR_VERSION 7 +#define DRV_MINOR_VERSION 22 +#define DRV_VERSION_STR "7.22" + + +#if defined BUS_PCMCIA +#define BUS_TYPE "PCMCIA" +#elif defined BUS_PCI +#define BUS_TYPE "PCI" +#else +err: define bus type; +#endif // BUS_XXX + +#if defined HERMES25 +#define HW_TYPE "HII.5" +#else +#define HW_TYPE "HII" +#endif // HERMES25 + +#if defined WARP +#define FW_TYPE "WARP" +#else +#define FW_TYPE "BEAGLE" +#endif // WARP + +#if defined HERMES25 +#if defined WARP +#define DRV_VARIANT 3 +#else +#define DRV_VARIANT 4 +#endif // WARP +#else +#define DRV_VARIANT 2 +#endif // HERMES25 + +#ifdef BUS_PCMCIA +#if defined HERMES25 +#define MODULE_NAME DRIVER_NAME "_h25_cs" +#else +#define MODULE_NAME DRIVER_NAME "_h2_cs" +#endif /* HERMES25 */ +#elif defined BUS_PCI +#if defined HERMES25 +#define MODULE_NAME DRIVER_NAME "_h25" +#else +#define MODULE_NAME DRIVER_NAME "_h2" +#endif /* HERMES25 */ +#endif /* BUS_XXX */ + +#ifdef DBG +#define MODULE_DATE __DATE__ " " __TIME__ +#else +#define MODULE_DATE "07/18/2004 13:30:00" +#endif // DBG + +//#define STR2(m) #m +//#define STR1(m) STR2(m) +//#define MODULE_NAME STR1( MOD_NAME ) + +#define VERSION_INFO MODULE_NAME " v" DRV_VERSION_STR \ + " for " BUS_TYPE ", " \ + MODULE_DATE " by " VENDOR_NAME + +#define WIRELESS_SUPPORT 15 // The version of wireless extensions we support + +//#define DBG_MOD_NAME DRIVER_NAME ":" BUS_TYPE ":" HW_TYPE ":" FW_TYPE +#define DBG_MOD_NAME MODULE_NAME + + + +/******************************************************************************* + * bus architechture specific defines, includes, etc. + ******************************************************************************/ +/* + * There doesn't seem to be a difference for PCMCIA and PCI anymore, at least + * for PCMCIA the same defines are needed now as previously only used for PCI + */ +#if USE_WEXT +#define HAS_WIRELESS_EXTENSIONS +#endif // USE_WEXT + +#define NEW_MULTICAST +#define ALLOC_SKB(len) dev_alloc_skb(len+2) +#define GET_PACKET(dev, skb, count)\ + skb_reserve((skb), 2); \ + BLOCK_INPUT(skb_put((skb), (count)), (count)); \ + (skb)->protocol = eth_type_trans((skb), (dev)) +#define GET_PACKET_DMA(dev, skb, count)\ + skb_reserve((skb), 2); \ + BLOCK_INPUT_DMA(skb_put((skb), (count)), (count)); \ + (skb)->protocol = eth_type_trans((skb), (dev)) + + + + +#endif // __WL_VERSION_H__ diff --git a/drivers/staging/wlags49_h2/wl_wext.c b/drivers/staging/wlags49_h2/wl_wext.c new file mode 100644 index 000000000000..82ae027b5905 --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_wext.c @@ -0,0 +1,4138 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/08/03 11:39:39 $ + * $Revision: 1.6 $ + * $Source: /usr/local/cvs/wl_lkm/wireless/wl_wext.c,v $ + * + ******************************************************************************/ + + + + +/******************************************************************************* + * include files + ******************************************************************************/ +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + + +/* If WIRELESS_EXT is not defined (as a result of HAS_WIRELESS_EXTENSIONS + #including linux/wireless.h), then these functions do not need to be included + in the build. */ +#ifdef WIRELESS_EXT + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) +#define IWE_STREAM_ADD_EVENT(info, buf, end, iwe, len) \ + iwe_stream_add_event(buf, end, iwe, len) +#define IWE_STREAM_ADD_POINT(info, buf, end, iwe, msg) \ + iwe_stream_add_point(buf, end, iwe, msg) +#else +#define IWE_STREAM_ADD_EVENT(info, buf, end, iwe, len) \ + iwe_stream_add_event(info, buf, end, iwe, len) +#define IWE_STREAM_ADD_POINT(info, buf, end, iwe, msg) \ + iwe_stream_add_point(info, buf, end, iwe, msg) +#endif + + + +/******************************************************************************* + * global definitions + ******************************************************************************/ +#if DBG +extern dbg_info_t *DbgInfo; +#endif // DBG + + + + +/******************************************************************************* + * wireless_commit() + ******************************************************************************* + * + * DESCRIPTION: + * + * Commit + * protocol used. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +static int wireless_commit(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *rqu, char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wireless_commit" ); + DBG_ENTER(DbgInfo); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + wl_apply(lp); + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_commit +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_get_protocol() + ******************************************************************************* + * + * DESCRIPTION: + * + * Returns a vendor-defined string that should identify the wireless + * protocol used. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +static int wireless_get_protocol(struct net_device *dev, struct iw_request_info *info, char *name, char *extra) +{ + DBG_FUNC( "wireless_get_protocol" ); + DBG_ENTER( DbgInfo ); + + /* Originally, the driver was placing the string "Wireless" here. However, + the wireless extensions (/linux/wireless.h) indicate this string should + describe the wireless protocol. */ + + strcpy(name, "IEEE 802.11b"); + + DBG_LEAVE(DbgInfo); + return 0; +} // wireless_get_protocol +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_set_frequency() + ******************************************************************************* + * + * DESCRIPTION: + * + * Sets the frequency (channel) on which the card should Tx/Rx. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_set_frequency(struct net_device *dev, struct iw_request_info *info, struct iw_freq *freq, char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int channel = 0; + int ret = 0; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wireless_set_frequency" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + if( !capable( CAP_NET_ADMIN )) { + ret = -EPERM; + DBG_LEAVE( DbgInfo ); + return ret; + } + + + /* If frequency specified, look up channel */ + if( freq->e == 1 ) { + int f = freq->m / 100000; + channel = wl_get_chan_from_freq( f ); + } + + + /* Channel specified */ + if( freq->e == 0 ) { + channel = freq->m; + } + + + /* If the channel is an 802.11a channel, set Bit 8 */ + if( channel > 14 ) { + channel = channel | 0x100; + } + + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + lp->Channel = channel; + + + /* Commit the adapter parameters */ + wl_apply( lp ); + + /* Send an event that channel/freq has been set */ + wl_wext_event_freq( lp->dev ); + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_set_frequency +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_get_frequency() + ******************************************************************************* + * + * DESCRIPTION: + * + * Gets the frequency (channel) on which the card is Tx/Rx. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +static int wireless_get_frequency(struct net_device *dev, struct iw_request_info *info, struct iw_freq *freq, char *extra) + +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = -1; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wireless_get_frequency" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CUR_CHANNEL; + + ret = hcf_get_info( &(lp->hcfCtx), (LTVP)&( lp->ltvRecord )); + if( ret == HCF_SUCCESS ) { + hcf_16 channel = CNV_LITTLE_TO_INT( lp->ltvRecord.u.u16[0] ); + +#ifdef USE_FREQUENCY + + freq->m = wl_get_freq_from_chan( channel ) * 100000; + freq->e = 1; +#else + + freq->m = channel; + freq->e = 0; + +#endif /* USE_FREQUENCY */ + } + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + + ret = (ret == HCF_SUCCESS ? 0 : -EFAULT); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_get_frequency +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_get_range() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function is used to provide misc info and statistics about the + * wireless device. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_get_range(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + struct iw_range *range = (struct iw_range *) extra; + int ret = 0; + int status = -1; + int count; + __u16 *pTxRate; + int retries = 0; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wireless_get_range" ); + DBG_ENTER( DbgInfo ); + + /* Set range information */ + data->length = sizeof(struct iw_range); + memset(range, 0, sizeof(struct iw_range)); + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + /* Set range information */ + memset( range, 0, sizeof( struct iw_range )); + +retry: + /* Get the current transmit rate from the adapter */ + lp->ltvRecord.len = 1 + (sizeof(*pTxRate) / sizeof(hcf_16)); + lp->ltvRecord.typ = CFG_CUR_TX_RATE; + + status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + if( status != HCF_SUCCESS ) { + /* Recovery action: reset and retry up to 10 times */ + DBG_TRACE( DbgInfo, "Get CFG_CUR_TX_RATE failed: 0x%x\n", status ); + + if (retries < 10) { + retries++; + + /* Holding the lock too long, make a gap to allow other processes */ + wl_unlock(lp, &flags); + wl_lock( lp, &flags ); + + status = wl_reset( dev ); + if ( status != HCF_SUCCESS ) { + DBG_TRACE( DbgInfo, "reset failed: 0x%x\n", status ); + + ret = -EFAULT; + goto out_unlock; + } + + /* Holding the lock too long, make a gap to allow other processes */ + wl_unlock(lp, &flags); + wl_lock( lp, &flags ); + + goto retry; + + } else { + DBG_TRACE( DbgInfo, "Get CFG_CUR_TX_RATE failed: %d retries\n", retries ); + ret = -EFAULT; + goto out_unlock; + } + } + + /* Holding the lock too long, make a gap to allow other processes */ + wl_unlock(lp, &flags); + wl_lock( lp, &flags ); + + pTxRate = (__u16 *)&( lp->ltvRecord.u.u32 ); + + range->throughput = CNV_LITTLE_TO_INT( *pTxRate ) * MEGABIT; + + if (retries > 0) { + DBG_TRACE( DbgInfo, "Get CFG_CUR_TX_RATE succes: %d retries\n", retries ); + } + + // NWID - NOT SUPPORTED + + + /* Channel/Frequency Info */ + range->num_channels = RADIO_CHANNELS; + + + /* Signal Level Thresholds */ + range->sensitivity = RADIO_SENSITIVITY_LEVELS; + + + /* Link quality */ +#ifdef USE_DBM + + range->max_qual.qual = (u_char)HCF_MAX_COMM_QUALITY; + + /* If the value returned in /proc/net/wireless is greater than the maximum range, + iwconfig assumes that the value is in dBm. Because an unsigned char is used, + it requires a bit of contorsion... */ + + range->max_qual.level = (u_char)( dbm( HCF_MIN_SIGNAL_LEVEL ) - 1 ); + range->max_qual.noise = (u_char)( dbm( HCF_MIN_NOISE_LEVEL ) - 1 ); +#else + + range->max_qual.qual = 100; + range->max_qual.level = 100; + range->max_qual.noise = 100; + +#endif /* USE_DBM */ + + + /* Set available rates */ + range->num_bitrates = 0; + + lp->ltvRecord.len = 6; + lp->ltvRecord.typ = CFG_SUPPORTED_DATA_RATES; + + status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + if( status == HCF_SUCCESS ) { + for( count = 0; count < MAX_RATES; count++ ) + if( lp->ltvRecord.u.u8[count+2] != 0 ) { + range->bitrate[count] = lp->ltvRecord.u.u8[count+2] * MEGABIT / 2; + range->num_bitrates++; + } + } else { + DBG_TRACE( DbgInfo, "CFG_SUPPORTED_DATA_RATES: 0x%x\n", status ); + ret = -EFAULT; + goto out_unlock; + } + + /* RTS Threshold info */ + range->min_rts = MIN_RTS_BYTES; + range->max_rts = MAX_RTS_BYTES; + + // Frag Threshold info - NOT SUPPORTED + + // Power Management info - NOT SUPPORTED + + /* Encryption */ + +#if WIRELESS_EXT > 8 + + /* Holding the lock too long, make a gap to allow other processes */ + wl_unlock(lp, &flags); + wl_lock( lp, &flags ); + + /* Is WEP supported? */ + + if( wl_has_wep( &( lp->hcfCtx ))) { + /* WEP: RC4 40 bits */ + range->encoding_size[0] = MIN_KEY_SIZE; + + /* RC4 ~128 bits */ + range->encoding_size[1] = MAX_KEY_SIZE; + range->num_encoding_sizes = 2; + range->max_encoding_tokens = MAX_KEYS; + } + +#endif /* WIRELESS_EXT > 8 */ + + /* Tx Power Info */ + range->txpower_capa = IW_TXPOW_MWATT; + range->num_txpower = 1; + range->txpower[0] = RADIO_TX_POWER_MWATT; + +#if WIRELESS_EXT > 10 + + /* Wireless Extension Info */ + range->we_version_compiled = WIRELESS_EXT; + range->we_version_source = WIRELESS_SUPPORT; + + // Retry Limits and Lifetime - NOT SUPPORTED + +#endif + + +#if WIRELESS_EXT > 11 + + /* Holding the lock too long, make a gap to allow other processes */ + wl_unlock(lp, &flags); + wl_lock( lp, &flags ); + + DBG_TRACE( DbgInfo, "calling wl_wireless_stats\n" ); + wl_wireless_stats( lp->dev ); + range->avg_qual = lp->wstats.qual; + DBG_TRACE( DbgInfo, "wl_wireless_stats done\n" ); + +#endif + + /* Event capability (kernel + driver) */ + range->event_capa[0] = (IW_EVENT_CAPA_K_0 | + IW_EVENT_CAPA_MASK(SIOCGIWAP) | + IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); + range->event_capa[1] = IW_EVENT_CAPA_K_1; + range->event_capa[4] = (IW_EVENT_CAPA_MASK(IWEVREGISTERED) | + IW_EVENT_CAPA_MASK(IWEVCUSTOM) | + IW_EVENT_CAPA_MASK(IWEVEXPIRED)); + + range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_CIPHER_TKIP; + +out_unlock: + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + + DBG_LEAVE(DbgInfo); + return ret; +} // wireless_get_range +/*============================================================================*/ + + +/******************************************************************************* + * wireless_get_bssid() + ******************************************************************************* + * + * DESCRIPTION: + * + * Gets the BSSID the wireless device is currently associated with. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_get_bssid(struct net_device *dev, struct iw_request_info *info, struct sockaddr *ap_addr, char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; +#if 1 //;? (HCF_TYPE) & HCF_TYPE_STA + int status = -1; +#endif /* (HCF_TYPE) & HCF_TYPE_STA */ + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wireless_get_bssid" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + memset( &ap_addr->sa_data, 0, ETH_ALEN ); + + ap_addr->sa_family = ARPHRD_ETHER; + + /* Assume AP mode here, which means the BSSID is our own MAC address. In + STA mode, this address will be overwritten with the actual BSSID using + the code below. */ + memcpy(&ap_addr->sa_data, lp->dev->dev_addr, ETH_ALEN); + + +#if 1 //;? (HCF_TYPE) & HCF_TYPE_STA + //;?should we return an error status in AP mode + + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_STA ) { + /* Get Current BSSID */ + lp->ltvRecord.typ = CFG_CUR_BSSID; + lp->ltvRecord.len = 4; + status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + + if( status == HCF_SUCCESS ) { + /* Copy info into sockaddr struct */ + memcpy(&ap_addr->sa_data, lp->ltvRecord.u.u8, ETH_ALEN); + } else { + ret = -EFAULT; + } + } + +#endif // (HCF_TYPE) & HCF_TYPE_STA + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE(DbgInfo); + return ret; +} // wireless_get_bssid +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_get_ap_list() + ******************************************************************************* + * + * DESCRIPTION: + * + * Gets the results of a network scan. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + * NOTE: SIOCGIWAPLIST has been deprecated by SIOCSIWSCAN. This function + * implements SIOCGIWAPLIST only to provide backwards compatibility. For + * all systems using WIRELESS_EXT v14 and higher, use SIOCSIWSCAN! + * + ******************************************************************************/ +static int wireless_get_ap_list (struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret; + int num_aps = -1; + int sec_count = 0; + hcf_32 count; + struct sockaddr *hwa = NULL; + struct iw_quality *qual = NULL; +#ifdef WARP + ScanResult *p = &lp->scan_results; +#else + ProbeResult *p = &lp->probe_results; +#endif // WARP + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wireless_get_ap_list" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + /* Set the completion state to FALSE */ + lp->scan_results.scan_complete = FALSE; + lp->probe_results.scan_complete = FALSE; + /* Channels to scan */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_SCAN_CHANNELS_2GHZ; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 0x7FFF ); + ret = hcf_put_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + DBG_TRACE( DbgInfo, "CFG_SCAN_CHANNELS_2GHZ result: 0x%x\n", ret ); + + /* Set the SCAN_SSID to "ANY". Using this RID for scan prevents the need to + disassociate from the network we are currently on */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_SCAN_SSID; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 0 ); + ret = hcf_put_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + DBG_TRACE( DbgInfo, "CFG_SCAN_SSID to 'any' ret: 0x%x\n", ret ); + + /* Initiate the scan */ +#ifdef WARP + ret = hcf_action( &( lp->hcfCtx ), MDD_ACT_SCAN ); +#else + ret = hcf_action( &( lp->hcfCtx ), HCF_ACT_ACS_SCAN ); +#endif // WARP + + wl_act_int_on( lp ); + + //;? unlock? what about the access to lp below? is it broken? + wl_unlock(lp, &flags); + + if( ret == HCF_SUCCESS ) { + DBG_TRACE( DbgInfo, "SUCCESSFULLY INITIATED SCAN...\n" ); + while( (*p).scan_complete == FALSE && ret == HCF_SUCCESS ) { + DBG_TRACE( DbgInfo, "Waiting for scan results...\n" ); + /* Abort the scan if we've waited for more than MAX_SCAN_TIME_SEC */ + if( sec_count++ > MAX_SCAN_TIME_SEC ) { + ret = -EIO; + } else { + /* Wait for 1 sec in 10ms intervals, scheduling the kernel to do + other things in the meantime, This prevents system lockups by + giving some time back to the kernel */ + for( count = 0; count < 100; count ++ ) { + mdelay( 10 ); + schedule( ); + } + } + } + + rmb(); + + if ( ret != HCF_SUCCESS ) { + DBG_ERROR( DbgInfo, "timeout waiting for scan results\n" ); + } else { + num_aps = (*p)/*lp->probe_results*/.num_aps; + if (num_aps > IW_MAX_AP) { + num_aps = IW_MAX_AP; + } + data->length = num_aps; + hwa = (struct sockaddr *)extra; + qual = (struct iw_quality *) extra + + ( sizeof( struct sockaddr ) * num_aps ); + + /* This flag is used to tell the user if we provide quality + information. Since we provide signal/noise levels but no + quality info on a scan, this is set to 0. Setting to 1 and + providing a quality of 0 produces weird results. If we ever + provide quality (or can calculate it), this can be changed */ + data->flags = 0; + + for( count = 0; count < num_aps; count++ ) { +#ifdef WARP + memcpy( hwa[count].sa_data, + (*p)/*lp->scan_results*/.APTable[count].bssid, ETH_ALEN ); +#else //;?why use BSSID and bssid as names in seemingly very comparable situations + DBG_PRINT( "BSSID: %s\n", DbgHwAddr( (*p)/*lp->probe_results*/.ProbeTable[count].BSSID )); + memcpy( hwa[count].sa_data, + (*p)/*lp->probe_results*/.ProbeTable[count].BSSID, ETH_ALEN ); +#endif // WARP + } + /* Once the data is copied to the wireless struct, invalidate the + scan result to initiate a rescan on the next request */ + (*p)/*lp->probe_results*/.scan_complete = FALSE; + /* Send the wireless event that the scan has completed, just in case + it's needed */ + wl_wext_event_scan_complete( lp->dev ); + } + } +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_get_ap_list +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_set_sensitivity() + ******************************************************************************* + * + * DESCRIPTION: + * + * Sets the sensitivity (distance between APs) of the wireless card. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_set_sensitivity(struct net_device *dev, struct iw_request_info *info, struct iw_param *sens, char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + int dens = sens->value; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wireless_set_sensitivity" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + if(( dens < 1 ) || ( dens > 3 )) { + ret = -EINVAL; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + lp->DistanceBetweenAPs = dens; + wl_apply( lp ); + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_set_sensitivity +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_get_sensitivity() + ******************************************************************************* + * + * DESCRIPTION: + * + * Gets the sensitivity (distance between APs) of the wireless card. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_get_sensitivity(struct net_device *dev, struct iw_request_info *info, struct iw_param *sens, char *extra) +{ + struct wl_private *lp = wl_priv(dev); + int ret = 0; + /*------------------------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wireless_get_sensitivity" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + /* not worth locking ... */ + sens->value = lp->DistanceBetweenAPs; + sens->fixed = 0; /* auto */ +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_get_sensitivity +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_set_essid() + ******************************************************************************* + * + * DESCRIPTION: + * + * Sets the ESSID (network name) that the wireless device should associate + * with. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_set_essid(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *ssid) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + + DBG_FUNC( "wireless_set_essid" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + if (data->flags != 0 && data->length > HCF_MAX_NAME_LEN + 1) { + ret = -EINVAL; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + memset( lp->NetworkName, 0, sizeof( lp->NetworkName )); + + /* data->flags is zero to ask for "any" */ + if( data->flags == 0 ) { + /* Need this because in STAP build PARM_DEFAULT_SSID is "LinuxAP" + * ;?but there ain't no STAP anymore*/ + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_STA ) { + strcpy( lp->NetworkName, "ANY" ); + } else { + //strcpy( lp->NetworkName, "ANY" ); + strcpy( lp->NetworkName, PARM_DEFAULT_SSID ); + } + } else { + memcpy( lp->NetworkName, ssid, data->length ); + } + + DBG_NOTICE( DbgInfo, "set NetworkName: %s\n", ssid ); + + /* Commit the adapter parameters */ + wl_apply( lp ); + + /* Send an event that ESSID has been set */ + wl_wext_event_essid( lp->dev ); + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_set_essid +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_get_essid() + ******************************************************************************* + * + * DESCRIPTION: + * + * Gets the ESSID (network name) that the wireless device is associated + * with. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_get_essid(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *essid) + +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + int status = -1; + wvName_t *pName; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wireless_get_essid" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + /* Get the desired network name */ + lp->ltvRecord.len = 1 + ( sizeof( *pName ) / sizeof( hcf_16 )); + + +#if 1 //;? (HCF_TYPE) & HCF_TYPE_STA + //;?should we return an error status in AP mode + + lp->ltvRecord.typ = CFG_DESIRED_SSID; + +#endif + + +#if 1 //;? (HCF_TYPE) & HCF_TYPE_AP + //;?should we restore this to allow smaller memory footprint + + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) { + lp->ltvRecord.typ = CFG_CNF_OWN_SSID; + } + +#endif // HCF_AP + + + status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + if( status == HCF_SUCCESS ) { + pName = (wvName_t *)&( lp->ltvRecord.u.u32 ); + + /* Endian translate the string length */ + pName->length = CNV_LITTLE_TO_INT( pName->length ); + + /* Copy the information into the user buffer */ + data->length = pName->length; + + /* NOTE: Null terminating is necessary for proper display of the SSID in + the wireless tools */ + data->length = pName->length + 1; + if( pName->length < HCF_MAX_NAME_LEN ) { + pName->name[pName->length] = '\0'; + } + + data->flags = 1; + + +#if 1 //;? (HCF_TYPE) & HCF_TYPE_STA + //;?should we return an error status in AP mode +#ifdef RETURN_CURRENT_NETWORKNAME + + /* if desired is null ("any"), return current or "any" */ + if( pName->name[0] == '\0' ) { + /* Get the current network name */ + lp->ltvRecord.len = 1 + ( sizeof(*pName ) / sizeof( hcf_16 )); + lp->ltvRecord.typ = CFG_CUR_SSID; + + status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + + if( status == HCF_SUCCESS ) { + pName = (wvName_t *)&( lp->ltvRecord.u.u32 ); + + /* Endian translate the string length */ + pName->length = CNV_LITTLE_TO_INT( pName->length ); + + /* Copy the information into the user buffer */ + data->length = pName->length + 1; + if( pName->length < HCF_MAX_NAME_LEN ) { + pName->name[pName->length] = '\0'; + } + + data->flags = 1; + } else { + ret = -EFAULT; + goto out_unlock; + } + } + +#endif // RETURN_CURRENT_NETWORKNAME +#endif // HCF_STA + + data->length--; + + if (pName->length > IW_ESSID_MAX_SIZE) { + ret = -EFAULT; + goto out_unlock; + } + + memcpy(essid, pName->name, pName->length); + } else { + ret = -EFAULT; + goto out_unlock; + } + +out_unlock: + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_get_essid +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_set_encode() + ******************************************************************************* + * + * DESCRIPTION: + * + * Sets the encryption keys and status (enable or disable). + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_set_encode(struct net_device *dev, struct iw_request_info *info, struct iw_point *erq, char *keybuf) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + +#if 1 //;? #if WIRELESS_EXT > 8 - used unconditionally in the rest of the code... + hcf_8 encryption_state; +#endif // WIRELESS_EXT > 8 + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wireless_set_encode" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + /* Is encryption supported? */ + if( !wl_has_wep( &( lp->hcfCtx ))) { + DBG_WARNING( DbgInfo, "WEP not supported on this device\n" ); + ret = -EOPNOTSUPP; + goto out_unlock; + } + + DBG_NOTICE( DbgInfo, "pointer: %p, length: %d, flags: %#x\n", + keybuf, erq->length, + erq->flags); + + /* Save state of Encryption switch */ + encryption_state = lp->EnableEncryption; + + /* Basic checking: do we have a key to set? */ + if((erq->length) != 0) { + int index = ( erq->flags & IW_ENCODE_INDEX ) - 1; + int tk = lp->TransmitKeyID - 1; // current key + + + /* Check the size of the key */ + switch(erq->length) { + case 0: + break; + + case MIN_KEY_SIZE: + case MAX_KEY_SIZE: + + /* Check the index */ + if(( index < 0 ) || ( index >= MAX_KEYS )) { + index = tk; + } + + /* Cleanup */ + memset( lp->DefaultKeys.key[index].key, 0, MAX_KEY_SIZE ); + + /* Copy the key in the driver */ + memcpy( lp->DefaultKeys.key[index].key, keybuf, erq->length); + + /* Set the length */ + lp->DefaultKeys.key[index].len = erq->length; + + DBG_NOTICE( DbgInfo, "encoding.length: %d\n", erq->length ); + DBG_NOTICE( DbgInfo, "set key: %s(%d) [%d]\n", lp->DefaultKeys.key[index].key, + lp->DefaultKeys.key[index].len, index ); + + /* Enable WEP (if possible) */ + if(( index == tk ) && ( lp->DefaultKeys.key[tk].len > 0 )) { + lp->EnableEncryption = 1; + } + + break; + + default: + DBG_WARNING( DbgInfo, "Invalid Key length\n" ); + ret = -EINVAL; + goto out_unlock; + } + } else { + int index = ( erq->flags & IW_ENCODE_INDEX ) - 1; + + + /* Do we want to just set the current transmit key? */ + if(( index >= 0 ) && ( index < MAX_KEYS )) { + DBG_NOTICE( DbgInfo, "index: %d; len: %d\n", index, + lp->DefaultKeys.key[index].len ); + + if( lp->DefaultKeys.key[index].len > 0 ) { + lp->TransmitKeyID = index + 1; + lp->EnableEncryption = 1; + } else { + DBG_WARNING( DbgInfo, "Problem setting the current TxKey\n" ); + DBG_LEAVE( DbgInfo ); + ret = -EINVAL; + } + } + } + + /* Read the flags */ + if( erq->flags & IW_ENCODE_DISABLED ) { + lp->EnableEncryption = 0; // disable encryption + } else { + lp->EnableEncryption = 1; + } + + if( erq->flags & IW_ENCODE_RESTRICTED ) { + DBG_WARNING( DbgInfo, "IW_ENCODE_RESTRICTED invalid\n" ); + ret = -EINVAL; // Invalid + } + + DBG_TRACE( DbgInfo, "encryption_state : %d\n", encryption_state ); + DBG_TRACE( DbgInfo, "lp->EnableEncryption : %d\n", lp->EnableEncryption ); + DBG_TRACE( DbgInfo, "erq->length : %d\n", + erq->length); + DBG_TRACE( DbgInfo, "erq->flags : 0x%x\n", + erq->flags); + + /* Write the changes to the card */ + if( ret == 0 ) { + DBG_NOTICE( DbgInfo, "encrypt: %d, ID: %d\n", lp->EnableEncryption, + lp->TransmitKeyID ); + + if( lp->EnableEncryption == encryption_state ) { + if( erq->length != 0 ) { + /* Dynamic WEP key update */ + wl_set_wep_keys( lp ); + } + } else { + /* To switch encryption on/off, soft reset is required */ + wl_apply( lp ); + } + } + + /* Send an event that Encryption has been set */ + wl_wext_event_encode( dev ); + +out_unlock: + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_set_encode +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_get_encode() + ******************************************************************************* + * + * DESCRIPTION: + * + * Gets the encryption keys and status. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_get_encode(struct net_device *dev, struct iw_request_info *info, struct iw_point *erq, char *key) + +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + int index; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wireless_get_encode" ); + DBG_ENTER( DbgInfo ); + DBG_NOTICE(DbgInfo, "GIWENCODE: encrypt: %d, ID: %d\n", lp->EnableEncryption, lp->TransmitKeyID); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + /* Only super-user can see WEP key */ + if( !capable( CAP_NET_ADMIN )) { + ret = -EPERM; + DBG_LEAVE( DbgInfo ); + return ret; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + /* Is it supported? */ + if( !wl_has_wep( &( lp->hcfCtx ))) { + ret = -EOPNOTSUPP; + goto out_unlock; + } + + /* Basic checking */ + index = (erq->flags & IW_ENCODE_INDEX ) - 1; + + + /* Set the flags */ + erq->flags = 0; + + if( lp->EnableEncryption == 0 ) { + erq->flags |= IW_ENCODE_DISABLED; + } + + /* Which key do we want */ + if(( index < 0 ) || ( index >= MAX_KEYS )) { + index = lp->TransmitKeyID - 1; + } + + erq->flags |= index + 1; + + /* Copy the key to the user buffer */ + erq->length = lp->DefaultKeys.key[index].len; + + memcpy(key, lp->DefaultKeys.key[index].key, erq->length); + +out_unlock: + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_get_encode +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_set_nickname() + ******************************************************************************* + * + * DESCRIPTION: + * + * Sets the nickname, or station name, of the wireless device. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_set_nickname(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *nickname) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wireless_set_nickname" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + +#if 0 //;? Needed, was present in original code but not in 7.18 Linux 2.6 kernel version + if( !capable(CAP_NET_ADMIN )) { + ret = -EPERM; + DBG_LEAVE( DbgInfo ); + return ret; + } +#endif + + /* Validate the new value */ + if(data->length > HCF_MAX_NAME_LEN) { + ret = -EINVAL; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + memset( lp->StationName, 0, sizeof( lp->StationName )); + + memcpy( lp->StationName, nickname, data->length ); + + /* Commit the adapter parameters */ + wl_apply( lp ); + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_set_nickname +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_get_nickname() + ******************************************************************************* + * + * DESCRIPTION: + * + * Gets the nickname, or station name, of the wireless device. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_get_nickname(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *nickname) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + int status = -1; + wvName_t *pName; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wireless_get_nickname" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + /* Get the current station name */ + lp->ltvRecord.len = 1 + ( sizeof( *pName ) / sizeof( hcf_16 )); + lp->ltvRecord.typ = CFG_CNF_OWN_NAME; + + status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + + if( status == HCF_SUCCESS ) { + pName = (wvName_t *)&( lp->ltvRecord.u.u32 ); + + /* Endian translate the length */ + pName->length = CNV_LITTLE_TO_INT( pName->length ); + + if ( pName->length > IW_ESSID_MAX_SIZE ) { + ret = -EFAULT; + } else { + /* Copy the information into the user buffer */ + data->length = pName->length; + memcpy(nickname, pName->name, pName->length); + } + } else { + ret = -EFAULT; + } + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE(DbgInfo); + return ret; +} // wireless_get_nickname +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_set_porttype() + ******************************************************************************* + * + * DESCRIPTION: + * + * Sets the port type of the wireless device. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_set_porttype(struct net_device *dev, struct iw_request_info *info, __u32 *mode, char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + hcf_16 portType; + hcf_16 createIBSS; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wireless_set_porttype" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + /* Validate the new value */ + switch( *mode ) { + case IW_MODE_ADHOC: + + /* When user requests ad-hoc, set IBSS mode! */ + portType = 1; + createIBSS = 1; + + lp->DownloadFirmware = WVLAN_DRV_MODE_STA; //1; + + break; + + + case IW_MODE_AUTO: + case IW_MODE_INFRA: + + /* Both automatic and infrastructure set port to BSS/STA mode */ + portType = 1; + createIBSS = 0; + + lp->DownloadFirmware = WVLAN_DRV_MODE_STA; //1; + + break; + + +#if 0 //;? (HCF_TYPE) & HCF_TYPE_AP + + case IW_MODE_MASTER: + + /* Set BSS/AP mode */ + portType = 1; + + lp->CreateIBSS = 0; + lp->DownloadFirmware = WVLAN_DRV_MODE_AP; //2; + + break; + +#endif /* (HCF_TYPE) & HCF_TYPE_AP */ + + + default: + + portType = 0; + createIBSS = 0; + ret = -EINVAL; + } + + if( portType != 0 ) { + /* Only do something if there is a mode change */ + if( ( lp->PortType != portType ) || (lp->CreateIBSS != createIBSS)) { + lp->PortType = portType; + lp->CreateIBSS = createIBSS; + + /* Commit the adapter parameters */ + wl_go( lp ); + + /* Send an event that mode has been set */ + wl_wext_event_mode( lp->dev ); + } + } + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_set_porttype +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_get_porttype() + ******************************************************************************* + * + * DESCRIPTION: + * + * Gets the port type of the wireless device. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_get_porttype(struct net_device *dev, struct iw_request_info *info, __u32 *mode, char *extra) + +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + int status = -1; + hcf_16 *pPortType; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wireless_get_porttype" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + /* Get the current port type */ + lp->ltvRecord.len = 1 + ( sizeof( *pPortType ) / sizeof( hcf_16 )); + lp->ltvRecord.typ = CFG_CNF_PORT_TYPE; + + status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + + if( status == HCF_SUCCESS ) { + pPortType = (hcf_16 *)&( lp->ltvRecord.u.u32 ); + + *pPortType = CNV_LITTLE_TO_INT( *pPortType ); + + switch( *pPortType ) { + case 1: + +#if 0 +#if (HCF_TYPE) & HCF_TYPE_AP + + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) { + *mode = IW_MODE_MASTER; + } else { + *mode = IW_MODE_INFRA; + } + +#else + + *mode = IW_MODE_INFRA; + +#endif /* (HCF_TYPE) & HCF_TYPE_AP */ +#endif + + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) { + *mode = IW_MODE_MASTER; + } else { + if( lp->CreateIBSS ) { + *mode = IW_MODE_ADHOC; + } else { + *mode = IW_MODE_INFRA; + } + } + + break; + + + case 3: + *mode = IW_MODE_ADHOC; + break; + + default: + ret = -EFAULT; + break; + } + } else { + ret = -EFAULT; + } + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_get_porttype +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_set_power() + ******************************************************************************* + * + * DESCRIPTION: + * + * Sets the power management settings of the wireless device. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_set_power(struct net_device *dev, struct iw_request_info *info, struct iw_param *wrq, char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wireless_set_power" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + DBG_PRINT( "THIS CORRUPTS PMEnabled ;?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" ); + +#if 0 //;? Needed, was present in original code but not in 7.18 Linux 2.6 kernel version + if( !capable( CAP_NET_ADMIN )) { + ret = -EPERM; + + DBG_LEAVE( DbgInfo ); + return ret; + } +#endif + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + /* Set the power management state based on the 'disabled' value */ + if( wrq->disabled ) { + lp->PMEnabled = 0; + } else { + lp->PMEnabled = 1; + } + + /* Commit the adapter parameters */ + wl_apply( lp ); + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_set_power +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_get_power() + ******************************************************************************* + * + * DESCRIPTION: + * + * Gets the power management settings of the wireless device. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_get_power(struct net_device *dev, struct iw_request_info *info, struct iw_param *rrq, char *extra) + +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wireless_get_power" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + DBG_PRINT( "THIS IS PROBABLY AN OVER-SIMPLIFICATION ;?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" ); + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + rrq->flags = 0; + rrq->value = 0; + + if( lp->PMEnabled ) { + rrq->disabled = 0; + } else { + rrq->disabled = 1; + } + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_get_power +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_get_tx_power() + ******************************************************************************* + * + * DESCRIPTION: + * + * Gets the transmit power of the wireless device's radio. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_get_tx_power(struct net_device *dev, struct iw_request_info *info, struct iw_param *rrq, char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + /*------------------------------------------------------------------------*/ + DBG_FUNC( "wireless_get_tx_power" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + +#ifdef USE_POWER_DBM + rrq->value = RADIO_TX_POWER_DBM; + rrq->flags = IW_TXPOW_DBM; +#else + rrq->value = RADIO_TX_POWER_MWATT; + rrq->flags = IW_TXPOW_MWATT; +#endif + rrq->fixed = 1; + rrq->disabled = 0; + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_get_tx_power +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_set_rts_threshold() + ******************************************************************************* + * + * DESCRIPTION: + * + * Sets the RTS threshold for the wireless card. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_set_rts_threshold (struct net_device *dev, struct iw_request_info *info, struct iw_param *rts, char *extra) +{ + int ret = 0; + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int rthr = rts->value; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wireless_set_rts_threshold" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + if(rts->fixed == 0) { + ret = -EINVAL; + goto out; + } + +#if WIRELESS_EXT > 8 + if( rts->disabled ) { + rthr = 2347; + } +#endif /* WIRELESS_EXT > 8 */ + + if(( rthr < 256 ) || ( rthr > 2347 )) { + ret = -EINVAL; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + lp->RTSThreshold = rthr; + + wl_apply( lp ); + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_set_rts_threshold +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_get_rts_threshold() + ******************************************************************************* + * + * DESCRIPTION: + * + * Gets the RTS threshold for the wireless card. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_get_rts_threshold (struct net_device *dev, struct iw_request_info *info, struct iw_param *rts, char *extra) +{ + int ret = 0; + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wireless_get_rts_threshold" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + rts->value = lp->RTSThreshold; + +#if WIRELESS_EXT > 8 + + rts->disabled = ( rts->value == 2347 ); + +#endif /* WIRELESS_EXT > 8 */ + + rts->fixed = 1; + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_get_rts_threshold +/*============================================================================*/ + + + + + +/******************************************************************************* + * wireless_set_rate() + ******************************************************************************* + * + * DESCRIPTION: + * + * Set the default data rate setting used by the wireless device. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_set_rate(struct net_device *dev, struct iw_request_info *info, struct iw_param *rrq, char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; +#ifdef WARP + int status = -1; + int index = 0; +#endif // WARP + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wireless_set_rate" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + +#ifdef WARP + + /* Determine if the card is operating in the 2.4 or 5.0 GHz band; check + if Bit 9 is set in the current channel RID */ + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_CUR_CHANNEL; + + status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + + if( status == HCF_SUCCESS ) { + index = ( CNV_LITTLE_TO_INT( lp->ltvRecord.u.u16[0] ) & 0x100 ) ? 1 : 0; + + DBG_PRINT( "Index: %d\n", index ); + } else { + DBG_ERROR( DbgInfo, "Could not determine radio frequency\n" ); + DBG_LEAVE( DbgInfo ); + ret = -EINVAL; + goto out_unlock; + } + + if( rrq->value > 0 && + rrq->value <= 1 * MEGABIT ) { + lp->TxRateControl[index] = 0x0001; + } + else if( rrq->value > 1 * MEGABIT && + rrq->value <= 2 * MEGABIT ) { + if( rrq->fixed == 1 ) { + lp->TxRateControl[index] = 0x0002; + } else { + lp->TxRateControl[index] = 0x0003; + } + } + else if( rrq->value > 2 * MEGABIT && + rrq->value <= 5 * MEGABIT ) { + if( rrq->fixed == 1 ) { + lp->TxRateControl[index] = 0x0004; + } else { + lp->TxRateControl[index] = 0x0007; + } + } + else if( rrq->value > 5 * MEGABIT && + rrq->value <= 6 * MEGABIT ) { + if( rrq->fixed == 1 ) { + lp->TxRateControl[index] = 0x0010; + } else { + lp->TxRateControl[index] = 0x0017; + } + } + else if( rrq->value > 6 * MEGABIT && + rrq->value <= 9 * MEGABIT ) { + if( rrq->fixed == 1 ) { + lp->TxRateControl[index] = 0x0020; + } else { + lp->TxRateControl[index] = 0x0037; + } + } + else if( rrq->value > 9 * MEGABIT && + rrq->value <= 11 * MEGABIT ) { + if( rrq->fixed == 1 ) { + lp->TxRateControl[index] = 0x0008; + } else { + lp->TxRateControl[index] = 0x003F; + } + } + else if( rrq->value > 11 * MEGABIT && + rrq->value <= 12 * MEGABIT ) { + if( rrq->fixed == 1 ) { + lp->TxRateControl[index] = 0x0040; + } else { + lp->TxRateControl[index] = 0x007F; + } + } + else if( rrq->value > 12 * MEGABIT && + rrq->value <= 18 * MEGABIT ) { + if( rrq->fixed == 1 ) { + lp->TxRateControl[index] = 0x0080; + } else { + lp->TxRateControl[index] = 0x00FF; + } + } + else if( rrq->value > 18 * MEGABIT && + rrq->value <= 24 * MEGABIT ) { + if( rrq->fixed == 1 ) { + lp->TxRateControl[index] = 0x0100; + } else { + lp->TxRateControl[index] = 0x01FF; + } + } + else if( rrq->value > 24 * MEGABIT && + rrq->value <= 36 * MEGABIT ) { + if( rrq->fixed == 1 ) { + lp->TxRateControl[index] = 0x0200; + } else { + lp->TxRateControl[index] = 0x03FF; + } + } + else if( rrq->value > 36 * MEGABIT && + rrq->value <= 48 * MEGABIT ) { + if( rrq->fixed == 1 ) { + lp->TxRateControl[index] = 0x0400; + } else { + lp->TxRateControl[index] = 0x07FF; + } + } + else if( rrq->value > 48 * MEGABIT && + rrq->value <= 54 * MEGABIT ) { + if( rrq->fixed == 1 ) { + lp->TxRateControl[index] = 0x0800; + } else { + lp->TxRateControl[index] = 0x0FFF; + } + } + else if( rrq->fixed == 0 ) { + /* In this case, the user has not specified a bitrate, only the "auto" + moniker. So, set to all supported rates */ + lp->TxRateControl[index] = PARM_MAX_TX_RATE; + } else { + rrq->value = 0; + ret = -EINVAL; + goto out_unlock; + } + + +#else + + if( rrq->value > 0 && + rrq->value <= 1 * MEGABIT ) { + lp->TxRateControl[0] = 1; + } + else if( rrq->value > 1 * MEGABIT && + rrq->value <= 2 * MEGABIT ) { + if( rrq->fixed ) { + lp->TxRateControl[0] = 2; + } else { + lp->TxRateControl[0] = 6; + } + } + else if( rrq->value > 2 * MEGABIT && + rrq->value <= 5 * MEGABIT ) { + if( rrq->fixed ) { + lp->TxRateControl[0] = 4; + } else { + lp->TxRateControl[0] = 7; + } + } + else if( rrq->value > 5 * MEGABIT && + rrq->value <= 11 * MEGABIT ) { + if( rrq->fixed) { + lp->TxRateControl[0] = 5; + } else { + lp->TxRateControl[0] = 3; + } + } + else if( rrq->fixed == 0 ) { + /* In this case, the user has not specified a bitrate, only the "auto" + moniker. So, set the rate to 11Mb auto */ + lp->TxRateControl[0] = 3; + } else { + rrq->value = 0; + ret = -EINVAL; + goto out_unlock; + } + +#endif // WARP + + + /* Commit the adapter parameters */ + wl_apply( lp ); + +out_unlock: + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_set_rate +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_get_rate() + ******************************************************************************* + * + * DESCRIPTION: + * + * Get the default data rate setting used by the wireless device. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_get_rate(struct net_device *dev, struct iw_request_info *info, struct iw_param *rrq, char *extra) + +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + int status = -1; + hcf_16 txRate; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wireless_get_rate" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + /* Get the current transmit rate from the adapter */ + lp->ltvRecord.len = 1 + ( sizeof(txRate)/sizeof(hcf_16)); + lp->ltvRecord.typ = CFG_CUR_TX_RATE; + + status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + + if( status == HCF_SUCCESS ) { +#ifdef WARP + + txRate = CNV_LITTLE_TO_INT( lp->ltvRecord.u.u16[0] ); + + if( txRate & 0x0001 ) { + txRate = 1; + } + else if( txRate & 0x0002 ) { + txRate = 2; + } + else if( txRate & 0x0004 ) { + txRate = 5; + } + else if( txRate & 0x0008 ) { + txRate = 11; + } + else if( txRate & 0x00010 ) { + txRate = 6; + } + else if( txRate & 0x00020 ) { + txRate = 9; + } + else if( txRate & 0x00040 ) { + txRate = 12; + } + else if( txRate & 0x00080 ) { + txRate = 18; + } + else if( txRate & 0x00100 ) { + txRate = 24; + } + else if( txRate & 0x00200 ) { + txRate = 36; + } + else if( txRate & 0x00400 ) { + txRate = 48; + } + else if( txRate & 0x00800 ) { + txRate = 54; + } + +#else + + txRate = (hcf_16)CNV_LITTLE_TO_LONG( lp->ltvRecord.u.u32[0] ); + +#endif // WARP + + rrq->value = txRate * MEGABIT; + } else { + rrq->value = 0; + ret = -EFAULT; + } + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_get_rate +/*============================================================================*/ + + + + +#if 0 //;? Not used anymore +/******************************************************************************* + * wireless_get_private_interface() + ******************************************************************************* + * + * DESCRIPTION: + * + * Returns the Linux Wireless Extensions' compatible private interface of + * the driver. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +int wireless_get_private_interface( struct iwreq *wrq, struct wl_private *lp ) +{ + int ret = 0; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wireless_get_private_interface" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + if( wrq->u.data.pointer != NULL ) { + struct iw_priv_args priv[] = + { + { SIOCSIWNETNAME, IW_PRIV_TYPE_CHAR | HCF_MAX_NAME_LEN, 0, "snetwork_name" }, + { SIOCGIWNETNAME, 0, IW_PRIV_TYPE_CHAR | HCF_MAX_NAME_LEN, "gnetwork_name" }, + { SIOCSIWSTANAME, IW_PRIV_TYPE_CHAR | HCF_MAX_NAME_LEN, 0, "sstation_name" }, + { SIOCGIWSTANAME, 0, IW_PRIV_TYPE_CHAR | HCF_MAX_NAME_LEN, "gstation_name" }, + { SIOCSIWPORTTYPE, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, 0, "sport_type" }, + { SIOCGIWPORTTYPE, 0, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, "gport_type" }, + }; + + /* Verify the user buffer */ + ret = verify_area( VERIFY_WRITE, wrq->u.data.pointer, sizeof( priv )); + + if( ret != 0 ) { + DBG_LEAVE( DbgInfo ); + return ret; + } + + /* Copy the data into the user's buffer */ + wrq->u.data.length = NELEM( priv ); + copy_to_user( wrq->u.data.pointer, &priv, sizeof( priv )); + } + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_get_private_interface +/*============================================================================*/ +#endif + + + +#if WIRELESS_EXT > 13 + +/******************************************************************************* + * wireless_set_scan() + ******************************************************************************* + * + * DESCRIPTION: + * + * Instructs the driver to initiate a network scan. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_set_scan(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + int status = -1; + int retries = 0; + /*------------------------------------------------------------------------*/ + + //;? Note: shows results as trace, retruns always 0 unless BUSY + + DBG_FUNC( "wireless_set_scan" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + /* + * This looks like a nice place to test if the HCF is still + * communicating with the card. It seems that sometimes BAP_1 + * gets corrupted. By looking at the comments in HCF the + * cause is still a mistery. Okay, the communication to the + * card is dead, reset the card to revive. + */ + if((lp->hcfCtx.IFB_CardStat & CARD_STAT_DEFUNCT) != 0) + { + DBG_TRACE( DbgInfo, "CARD is in DEFUNCT mode, reset it to bring it back to life\n" ); + wl_reset( dev ); + } + +retry: + /* Set the completion state to FALSE */ + lp->probe_results.scan_complete = FALSE; + + + /* Channels to scan */ +#ifdef WARP + lp->ltvRecord.len = 5; + lp->ltvRecord.typ = CFG_SCAN_CHANNEL; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 0x3FFF ); // 2.4 GHz Band + lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( 0xFFFF ); // 5.0 GHz Band + lp->ltvRecord.u.u16[2] = CNV_INT_TO_LITTLE( 0xFFFF ); // .. + lp->ltvRecord.u.u16[3] = CNV_INT_TO_LITTLE( 0x0007 ); // .. +#else + lp->ltvRecord.len = 2; + lp->ltvRecord.typ = CFG_SCAN_CHANNEL; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 0x7FFF ); +#endif // WARP + + status = hcf_put_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + + DBG_TRACE( DbgInfo, "CFG_SCAN_CHANNEL result : 0x%x\n", status ); + + // Holding the lock too long, make a gap to allow other processes + wl_unlock(lp, &flags); + wl_lock( lp, &flags ); + + if( status != HCF_SUCCESS ) { + //Recovery + retries++; + if(retries <= 10) { + DBG_TRACE( DbgInfo, "Reset card to recover, attempt: %d\n", retries ); + wl_reset( dev ); + + // Holding the lock too long, make a gap to allow other processes + wl_unlock(lp, &flags); + wl_lock( lp, &flags ); + + goto retry; + } + } + + /* Set the SCAN_SSID to "ANY". Using this RID for scan prevents the need to + disassociate from the network we are currently on */ + lp->ltvRecord.len = 18; + lp->ltvRecord.typ = CFG_SCAN_SSID; + lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 0 ); + lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( 0 ); + + status = hcf_put_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + + // Holding the lock too long, make a gap to allow other processes + wl_unlock(lp, &flags); + wl_lock( lp, &flags ); + + DBG_TRACE( DbgInfo, "CFG_SCAN_SSID to 'any' status: 0x%x\n", status ); + + /* Initiate the scan */ + /* NOTE: Using HCF_ACT_SCAN has been removed, as using HCF_ACT_ACS_SCAN to + retrieve probe responses must always be used to support WPA */ + status = hcf_action( &( lp->hcfCtx ), HCF_ACT_ACS_SCAN ); + + if( status == HCF_SUCCESS ) { + DBG_TRACE( DbgInfo, "SUCCESSFULLY INITIATED SCAN...\n" ); + } else { + DBG_TRACE( DbgInfo, "INITIATE SCAN FAILED...\n" ); + } + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE(DbgInfo); + return ret; +} // wireless_set_scan +/*============================================================================*/ + + + + +/******************************************************************************* + * wireless_get_scan() + ******************************************************************************* + * + * DESCRIPTION: + * + * Instructs the driver to gather and return the results of a network scan. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +static int wireless_get_scan(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + int count; + char *buf; + char *buf_end; + struct iw_event iwe; + PROBE_RESP *probe_resp; + hcf_8 msg[512]; + hcf_8 *wpa_ie; + hcf_16 wpa_ie_len; + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wireless_get_scan" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + /* If the scan is not done, tell the calling process to try again later */ + if( !lp->probe_results.scan_complete ) { + ret = -EAGAIN; + goto out_unlock; + } + + DBG_TRACE( DbgInfo, "SCAN COMPLETE, Num of APs: %d\n", + lp->probe_results.num_aps ); + + buf = extra; + buf_end = extra + IW_SCAN_MAX_DATA; + + for( count = 0; count < lp->probe_results.num_aps; count++ ) { + /* Reference the probe response from the table */ + probe_resp = (PROBE_RESP *)&lp->probe_results.ProbeTable[count]; + + + /* First entry MUST be the 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, probe_resp->BSSID, ETH_ALEN); + iwe.len = IW_EV_ADDR_LEN; + + buf = IWE_STREAM_ADD_EVENT(info, buf, buf_end, &iwe, IW_EV_ADDR_LEN); + + + /* Use the mode to indicate if it's a station or AP */ + /* Won't always be an AP if in IBSS mode */ + memset( &iwe, 0, sizeof( iwe )); + + iwe.cmd = SIOCGIWMODE; + + if( probe_resp->capability & CAPABILITY_IBSS ) { + iwe.u.mode = IW_MODE_INFRA; + } else { + iwe.u.mode = IW_MODE_MASTER; + } + + iwe.len = IW_EV_UINT_LEN; + + buf = IWE_STREAM_ADD_EVENT(info, buf, buf_end, &iwe, IW_EV_UINT_LEN); + + + /* Any quality information */ + memset(&iwe, 0, sizeof(iwe)); + + iwe.cmd = IWEVQUAL; + iwe.u.qual.level = dbm(probe_resp->signal); + iwe.u.qual.noise = dbm(probe_resp->silence); + iwe.u.qual.qual = iwe.u.qual.level - iwe.u.qual.noise; + iwe.u.qual.updated = lp->probe_results.scan_complete; + iwe.len = IW_EV_QUAL_LEN; + + buf = IWE_STREAM_ADD_EVENT(info, buf, buf_end, &iwe, IW_EV_QUAL_LEN); + + + /* ESSID information */ + if( probe_resp->rawData[1] > 0 ) { + memset( &iwe, 0, sizeof( iwe )); + + iwe.cmd = SIOCGIWESSID; + iwe.u.data.length = probe_resp->rawData[1]; + iwe.u.data.flags = 1; + + buf = IWE_STREAM_ADD_POINT(info, buf, buf_end, &iwe, &probe_resp->rawData[2]); + } + + + /* Encryption Information */ + memset( &iwe, 0, sizeof( iwe )); + + iwe.cmd = SIOCGIWENCODE; + iwe.u.data.length = 0; + + /* Check the capabilities field of the Probe Response to see if + 'privacy' is supported on the AP in question */ + if( probe_resp->capability & CAPABILITY_PRIVACY ) { + iwe.u.data.flags |= IW_ENCODE_ENABLED; + } else { + iwe.u.data.flags |= IW_ENCODE_DISABLED; + } + + buf = IWE_STREAM_ADD_POINT(info, buf, buf_end, &iwe, NULL); + + + /* Frequency Info */ + memset( &iwe, 0, sizeof( iwe )); + + iwe.cmd = SIOCGIWFREQ; + iwe.len = IW_EV_FREQ_LEN; + iwe.u.freq.m = wl_parse_ds_ie( probe_resp ); + iwe.u.freq.e = 0; + + buf = IWE_STREAM_ADD_EVENT(info, buf, buf_end, &iwe, IW_EV_FREQ_LEN); + + +#if WIRELESS_EXT > 14 + /* Custom info (Beacon Interval) */ + memset( &iwe, 0, sizeof( iwe )); + memset( msg, 0, sizeof( msg )); + + iwe.cmd = IWEVCUSTOM; + sprintf( msg, "beacon_interval=%d", probe_resp->beaconInterval ); + iwe.u.data.length = strlen( msg ); + + buf = IWE_STREAM_ADD_POINT(info, buf, buf_end, &iwe, msg); + + + /* Custom info (WPA-IE) */ + wpa_ie = NULL; + wpa_ie_len = 0; + + wpa_ie = wl_parse_wpa_ie( probe_resp, &wpa_ie_len ); + if( wpa_ie != NULL ) { + memset( &iwe, 0, sizeof( iwe )); + memset( msg, 0, sizeof( msg )); + + iwe.cmd = IWEVCUSTOM; + sprintf( msg, "wpa_ie=%s", wl_print_wpa_ie( wpa_ie, wpa_ie_len )); + iwe.u.data.length = strlen( msg ); + + buf = IWE_STREAM_ADD_POINT(info, buf, buf_end, &iwe, msg); + } + + /* Add other custom info in formatted string format as needed... */ +#endif + } + + data->length = buf - extra; + +out_unlock: + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_get_scan +/*============================================================================*/ + +#endif // WIRELESS_EXT > 13 + + +#if WIRELESS_EXT > 17 + +static int wireless_set_auth(struct net_device *dev, + struct iw_request_info *info, + struct iw_param *data, char *extra) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret; + int iwa_idx = data->flags & IW_AUTH_INDEX; + int iwa_val = data->value; + + DBG_FUNC( "wireless_set_auth" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + switch (iwa_idx) { + case IW_AUTH_WPA_VERSION: + DBG_TRACE( DbgInfo, "IW_AUTH_WPA_VERSION\n"); + /* We do support WPA only; how should DISABLED be treated? */ + if (iwa_val == IW_AUTH_WPA_VERSION_WPA) + ret = 0; + else + ret = -EINVAL; + break; + + case IW_AUTH_WPA_ENABLED: + DBG_TRACE( DbgInfo, "IW_AUTH_WPA_ENABLED: val = %d\n", iwa_val); + if (iwa_val) + lp->EnableEncryption = 2; + else + lp->EnableEncryption = 0; + ret = 0; + break; + + case IW_AUTH_TKIP_COUNTERMEASURES: + DBG_TRACE( DbgInfo, "IW_AUTH_TKIP_COUNTERMEASURES\n"); + lp->driverEnable = !iwa_val; + if(lp->driverEnable) + hcf_cntl(&(lp->hcfCtx), HCF_CNTL_ENABLE | HCF_PORT_0); + else + hcf_cntl(&(lp->hcfCtx), HCF_CNTL_DISABLE | HCF_PORT_0); + ret = 0; + break; + + case IW_AUTH_DROP_UNENCRYPTED: + DBG_TRACE( DbgInfo, "IW_AUTH_DROP_UNENCRYPTED\n"); + /* We do not actually do anything here, just to silence + * wpa_supplicant */ + ret = 0; + break; + + case IW_AUTH_CIPHER_PAIRWISE: + DBG_TRACE( DbgInfo, "IW_AUTH_CIPHER_PAIRWISE\n"); + /* not implemented, return an error */ + ret = -EINVAL; + break; + + case IW_AUTH_CIPHER_GROUP: + DBG_TRACE( DbgInfo, "IW_AUTH_CIPHER_GROUP\n"); + /* not implemented, return an error */ + ret = -EINVAL; + break; + + case IW_AUTH_KEY_MGMT: + DBG_TRACE( DbgInfo, "IW_AUTH_KEY_MGMT\n"); + /* not implemented, return an error */ + ret = -EINVAL; + break; + + case IW_AUTH_80211_AUTH_ALG: + DBG_TRACE( DbgInfo, "IW_AUTH_80211_AUTH_ALG\n"); + /* not implemented, return an error */ + ret = -EINVAL; + break; + + case IW_AUTH_RX_UNENCRYPTED_EAPOL: + DBG_TRACE( DbgInfo, "IW_AUTH_RX_UNENCRYPTED_EAPOL\n"); + /* not implemented, return an error */ + ret = -EINVAL; + break; + + case IW_AUTH_ROAMING_CONTROL: + DBG_TRACE( DbgInfo, "IW_AUTH_ROAMING_CONTROL\n"); + /* not implemented, return an error */ + ret = -EINVAL; + break; + + case IW_AUTH_PRIVACY_INVOKED: + DBG_TRACE( DbgInfo, "IW_AUTH_PRIVACY_INVOKED\n"); + /* not implemented, return an error */ + ret = -EINVAL; + break; + + default: + DBG_TRACE( DbgInfo, "IW_AUTH_?? (%d) unknown\n", iwa_idx); + /* return an error */ + ret = -EINVAL; + break; + } + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_set_auth +/*============================================================================*/ + + + +static int hermes_set_key(ltv_t *ltv, int alg, int key_idx, u8 *addr, + int set_tx, u8 *seq, u8 *key, size_t key_len) +{ + int ret = -EINVAL; + // int count = 0; + int buf_idx = 0; + hcf_8 tsc[IW_ENCODE_SEQ_MAX_SIZE] = + { 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 }; + + DBG_FUNC( "hermes_set_key" ); + DBG_ENTER( DbgInfo ); + + /* + * Check the key index here; if 0, load as Pairwise Key, otherwise, + * load as a group key. Note that for the Hermes, the RIDs for + * group/pariwise keys are different from each other and different + * than the default WEP keys as well. + */ + switch (alg) + { + case IW_ENCODE_ALG_TKIP: + DBG_TRACE( DbgInfo, "IW_ENCODE_ALG_TKIP: key(%d)\n", key_idx); +#if 0 + /* + * Make sure that there is no data queued up in the firmware + * before setting the TKIP keys. If this check is not + * performed, some data may be sent out with incorrect MIC + * and cause synchronizarion errors with the AP + */ + /* Check every 1ms for 100ms */ + for( count = 0; count < 100; count++ ) + { + usleep( 1000 ); + + ltv.len = 2; + ltv.typ = 0xFD91; // This RID not defined in HCF yet!!! + ltv.u.u16[0] = 0; + + wl_get_info( sock, <v, ifname ); + + if( ltv.u.u16[0] == 0 ) + { + break; + } + } + + if( count == 100 ) + { + wpa_printf( MSG_DEBUG, "Timed out waiting for TxQ!" ); + } +#endif + + switch (key_idx) { + case 0: + ltv->len = 28; + ltv->typ = CFG_ADD_TKIP_MAPPED_KEY; + + /* Load the BSSID */ + memcpy(<v->u.u8[buf_idx], addr, ETH_ALEN); + buf_idx += ETH_ALEN; + + /* Load the TKIP key */ + memcpy(<v->u.u8[buf_idx], &key[0], 16); + buf_idx += 16; + + /* Load the TSC */ + memcpy(<v->u.u8[buf_idx], tsc, IW_ENCODE_SEQ_MAX_SIZE); + buf_idx += IW_ENCODE_SEQ_MAX_SIZE; + + /* Load the RSC */ + memcpy(<v->u.u8[buf_idx], seq, IW_ENCODE_SEQ_MAX_SIZE); + buf_idx += IW_ENCODE_SEQ_MAX_SIZE; + + /* Load the TxMIC key */ + memcpy(<v->u.u8[buf_idx], &key[16], 8); + buf_idx += 8; + + /* Load the RxMIC key */ + memcpy(<v->u.u8[buf_idx], &key[24], 8); + + ret = 0; + break; + case 1: + case 2: + case 3: + ltv->len = 26; + ltv->typ = CFG_ADD_TKIP_DEFAULT_KEY; + + /* Load the key Index */ + ltv->u.u16[buf_idx] = key_idx; + /* If this is a Tx Key, set bit 8000 */ + if(set_tx) + ltv->u.u16[buf_idx] |= 0x8000; + buf_idx += 2; + + /* Load the RSC */ + memcpy(<v->u.u8[buf_idx], seq, IW_ENCODE_SEQ_MAX_SIZE); + buf_idx += IW_ENCODE_SEQ_MAX_SIZE; + + /* Load the TKIP, TxMIC, and RxMIC keys in one shot, because in + CFG_ADD_TKIP_DEFAULT_KEY they are back-to-back */ + memcpy(<v->u.u8[buf_idx], key, key_len); + buf_idx += key_len; + + /* Load the TSC */ + memcpy(<v->u.u8[buf_idx], tsc, IW_ENCODE_SEQ_MAX_SIZE); + + ltv->u.u16[0] = CNV_INT_TO_LITTLE(ltv->u.u16[0]); + + ret = 0; + break; + default: + break; + } + + break; + + case IW_ENCODE_ALG_WEP: + DBG_TRACE( DbgInfo, "IW_ENCODE_ALG_WEP: key(%d)\n", key_idx); + break; + + case IW_ENCODE_ALG_CCMP: + DBG_TRACE( DbgInfo, "IW_ENCODE_ALG_CCMP: key(%d)\n", key_idx); + break; + + case IW_ENCODE_ALG_NONE: + DBG_TRACE( DbgInfo, "IW_ENCODE_ALG_NONE: key(%d)\n", key_idx); + switch (key_idx) { + case 0: + if (memcmp(addr, "\xff\xff\xff\xff\xff\xff", ETH_ALEN) != 0) { + //if (addr != NULL) { + ltv->len = 7; + ltv->typ = CFG_REMOVE_TKIP_MAPPED_KEY; + memcpy(<v->u.u8[0], addr, ETH_ALEN); + ret = 0; + } + break; + case 1: + case 2: + case 3: + /* Clear the Group TKIP keys by index */ + ltv->len = 2; + ltv->typ = CFG_REMOVE_TKIP_DEFAULT_KEY; + ltv->u.u16[0] = key_idx; + + ret = 0; + break; + default: + break; + } + break; + default: + DBG_TRACE( DbgInfo, "IW_ENCODE_??: key(%d)\n", key_idx); + break; + } + + DBG_LEAVE( DbgInfo ); + return ret; +} // hermes_set_key +/*============================================================================*/ + + + +static int wireless_set_encodeext (struct net_device *dev, + struct iw_request_info *info, + struct iw_point *erq, char *keybuf) +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret; + int key_idx = (erq->flags&IW_ENCODE_INDEX) - 1; + ltv_t ltv; + struct iw_encode_ext *ext = (struct iw_encode_ext *)keybuf; + + DBG_FUNC( "wireless_set_encodeext" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + if (sizeof(ext->rx_seq) != 8) { + DBG_TRACE(DbgInfo, "rz_seq size mismatch\n"); + DBG_LEAVE(DbgInfo); + return -EINVAL; + } + + /* Handle WEP keys via the old set encode procedure */ + if(ext->alg == IW_ENCODE_ALG_WEP) { + struct iw_point wep_erq; + char *wep_keybuf; + + /* Build request structure */ + wep_erq.flags = erq->flags; // take over flags with key index + wep_erq.length = ext->key_len; // take length from extended key info + wep_keybuf = ext->key; // pointer to the key text + + /* Call wireless_set_encode tot handle the WEP key */ + ret = wireless_set_encode(dev, info, &wep_erq, wep_keybuf); + goto out; + } + + /* Proceed for extended encode functions for WAP and NONE */ + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + memset(<v, 0, sizeof(ltv)); + ret = hermes_set_key(<v, ext->alg, key_idx, ext->addr.sa_data, + ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY, + ext->rx_seq, ext->key, ext->key_len); + + if (ret != 0) { + DBG_TRACE( DbgInfo, "hermes_set_key returned != 0, key not set\n"); + goto out_unlock; + } + + /* Put the key in HCF */ + ret = hcf_put_info(&(lp->hcfCtx), (LTVP)<v); + +out_unlock: + if(ret == HCF_SUCCESS) { + DBG_TRACE( DbgInfo, "Put key info succes\n"); + } else { + DBG_TRACE( DbgInfo, "Put key info failed, key not set\n"); + } + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} // wireless_set_encodeext +/*============================================================================*/ + + + +static int wireless_get_genie(struct net_device *dev, + struct iw_request_info *info, + struct iw_point *data, char *extra) + +{ + struct wl_private *lp = wl_priv(dev); + unsigned long flags; + int ret = 0; + ltv_t ltv; + + DBG_FUNC( "wireless_get_genie" ); + DBG_ENTER( DbgInfo ); + + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + ret = -EBUSY; + goto out; + } + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + + memset(<v, 0, sizeof(ltv)); + ltv.len = 2; + ltv.typ = CFG_SET_WPA_AUTH_KEY_MGMT_SUITE; + lp->AuthKeyMgmtSuite = ltv.u.u16[0] = 4; + ltv.u.u16[0] = CNV_INT_TO_LITTLE(ltv.u.u16[0]); + + ret = hcf_put_info(&(lp->hcfCtx), (LTVP)<v); + + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + +out: + DBG_LEAVE( DbgInfo ); + return ret; +} +/*============================================================================*/ + + +#endif // WIRELESS_EXT > 17 + +/******************************************************************************* + * wl_wireless_stats() + ******************************************************************************* + * + * DESCRIPTION: + * + * Return the current device wireless statistics. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +struct iw_statistics * wl_wireless_stats( struct net_device *dev ) +{ + struct iw_statistics *pStats; + struct wl_private *lp = wl_priv(dev); + /*------------------------------------------------------------------------*/ + + + DBG_FUNC( "wl_wireless_stats" ); + DBG_ENTER(DbgInfo); + DBG_PARAM(DbgInfo, "dev", "%s (0x%p)", dev->name, dev); + + pStats = NULL; + + /* Initialize the statistics */ + pStats = &( lp->wstats ); + pStats->qual.updated = 0x00; + + if( !( lp->flags & WVLAN2_UIL_BUSY )) + { + CFG_COMMS_QUALITY_STRCT *pQual; + CFG_HERMES_TALLIES_STRCT tallies; + int status; + + /* Update driver status */ + pStats->status = 0; + + /* Get the current link quality information */ + lp->ltvRecord.len = 1 + ( sizeof( *pQual ) / sizeof( hcf_16 )); + lp->ltvRecord.typ = CFG_COMMS_QUALITY; + + status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + + if( status == HCF_SUCCESS ) { + pQual = (CFG_COMMS_QUALITY_STRCT *)&( lp->ltvRecord ); + +#ifdef USE_DBM + pStats->qual.qual = (u_char) CNV_LITTLE_TO_INT( pQual->coms_qual ); + pStats->qual.level = (u_char) dbm( CNV_LITTLE_TO_INT( pQual->signal_lvl )); + pStats->qual.noise = (u_char) dbm( CNV_LITTLE_TO_INT( pQual->noise_lvl )); +#else + pStats->qual.qual = percent( CNV_LITTLE_TO_INT( pQual->coms_qual ), + HCF_MIN_COMM_QUALITY, + HCF_MAX_COMM_QUALITY ); + + pStats->qual.level = percent( CNV_LITTLE_TO_INT( pQual->signal_lvl ), + HCF_MIN_SIGNAL_LEVEL, + HCF_MAX_SIGNAL_LEVEL ); + + pStats->qual.noise = percent( CNV_LITTLE_TO_INT( pQual->noise_lvl ), + HCF_MIN_NOISE_LEVEL, + HCF_MAX_NOISE_LEVEL ); +#endif /* USE_DBM */ + + pStats->qual.updated |= 0x07; + } else { + memset( &( pStats->qual ), 0, sizeof( pStats->qual )); + } + + /* Get the current tallies from the adapter */ + /* Only possible when the device is open */ + if(lp->portState == WVLAN_PORT_STATE_DISABLED) { + if( wl_get_tallies( lp, &tallies ) == 0 ) { + /* No endian translation is needed here, as CFG_TALLIES is an + MSF RID; all processing is done on the host, not the card! */ + pStats->discard.nwid = 0L; + pStats->discard.code = tallies.RxWEPUndecryptable; + pStats->discard.misc = tallies.TxDiscards + + tallies.RxFCSErrors + + //tallies.RxDiscardsNoBuffer + + tallies.TxDiscardsWrongSA; + //;? Extra taken over from Linux driver based on 7.18 version + pStats->discard.retries = tallies.TxRetryLimitExceeded; + pStats->discard.fragment = tallies.RxMsgInBadMsgFragments; + } else { + memset( &( pStats->discard ), 0, sizeof( pStats->discard )); + } + } else { + memset( &( pStats->discard ), 0, sizeof( pStats->discard )); + } + } + + DBG_LEAVE( DbgInfo ); + return pStats; +} // wl_wireless_stats +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_get_wireless_stats() + ******************************************************************************* + * + * DESCRIPTION: + * + * Return the current device wireless statistics. This function calls + * wl_wireless_stats, but acquires spinlocks first as it can be called + * directly by the network layer. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +struct iw_statistics * wl_get_wireless_stats( struct net_device *dev ) +{ + unsigned long flags; + struct wl_private *lp = wl_priv(dev); + struct iw_statistics *pStats = NULL; + /*------------------------------------------------------------------------*/ + + DBG_FUNC( "wl_get_wireless_stats" ); + DBG_ENTER(DbgInfo); + + wl_lock( lp, &flags ); + + wl_act_int_off( lp ); + +#ifdef USE_RTS + if( lp->useRTS == 1 ) { + DBG_TRACE( DbgInfo, "Skipping wireless stats, in RTS mode\n" ); + } else +#endif + { + pStats = wl_wireless_stats( dev ); + } + wl_act_int_on( lp ); + + wl_unlock(lp, &flags); + + DBG_LEAVE( DbgInfo ); + return pStats; +} // wl_get_wireless_stats + + +/******************************************************************************* + * wl_spy_gather() + ******************************************************************************* + * + * DESCRIPTION: + * + * Gather wireless spy statistics. + * + * PARAMETERS: + * + * wrq - the wireless request buffer + * lp - the device's private adapter structure + * + * RETURNS: + * + * 0 on success + * errno value otherwise + * + ******************************************************************************/ +inline void wl_spy_gather( struct net_device *dev, u_char *mac ) +{ + struct iw_quality wstats; + int status; + u_char stats[2]; + DESC_STRCT desc[1]; + struct wl_private *lp = wl_priv(dev); + /*------------------------------------------------------------------------*/ + + /* shortcut */ + if (!lp->spy_data.spy_number) { + return; + } + + /* Gather wireless spy statistics: for each packet, compare the source + address with out list, and if match, get the stats. */ + memset( stats, 0, sizeof(stats)); + memset( desc, 0, sizeof(DESC_STRCT)); + + desc[0].buf_addr = stats; + desc[0].BUF_SIZE = sizeof(stats); + desc[0].next_desc_addr = 0; // terminate list + + status = hcf_rcv_msg( &( lp->hcfCtx ), &desc[0], 0 ); + + if( status == HCF_SUCCESS ) { + wstats.level = (u_char) dbm(stats[1]); + wstats.noise = (u_char) dbm(stats[0]); + wstats.qual = wstats.level > wstats.noise ? wstats.level - wstats.noise : 0; + + wstats.updated = 7; + + wireless_spy_update( dev, mac, &wstats ); + } +} // wl_spy_gather +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_wext_event_freq() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function is used to send an event that the channel/freq + * configuration for a specific device has changed. + * + * + * PARAMETERS: + * + * dev - the network device for which this event is to be issued + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_wext_event_freq( struct net_device *dev ) +{ +#if WIRELESS_EXT > 13 + union iwreq_data wrqu; + struct wl_private *lp = wl_priv(dev); + /*------------------------------------------------------------------------*/ + + + memset( &wrqu, 0, sizeof( wrqu )); + + wrqu.freq.m = lp->Channel; + wrqu.freq.e = 0; + + wireless_send_event( dev, SIOCSIWFREQ, &wrqu, NULL ); +#endif /* WIRELESS_EXT > 13 */ + + return; +} // wl_wext_event_freq +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_wext_event_mode() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function is used to send an event that the mode of operation + * for a specific device has changed. + * + * + * PARAMETERS: + * + * dev - the network device for which this event is to be issued + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_wext_event_mode( struct net_device *dev ) +{ +#if WIRELESS_EXT > 13 + union iwreq_data wrqu; + struct wl_private *lp = wl_priv(dev); + /*------------------------------------------------------------------------*/ + + + memset( &wrqu, 0, sizeof( wrqu )); + + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_STA ) { + wrqu.mode = IW_MODE_INFRA; + } else { + wrqu.mode = IW_MODE_MASTER; + } + + wireless_send_event( dev, SIOCSIWMODE, &wrqu, NULL ); +#endif /* WIRELESS_EXT > 13 */ + + return; +} // wl_wext_event_mode +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_wext_event_essid() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function is used to send an event that the ESSID configuration for + * a specific device has changed. + * + * + * PARAMETERS: + * + * dev - the network device for which this event is to be issued + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_wext_event_essid( struct net_device *dev ) +{ +#if WIRELESS_EXT > 13 + union iwreq_data wrqu; + struct wl_private *lp = wl_priv(dev); + /*------------------------------------------------------------------------*/ + + + memset( &wrqu, 0, sizeof( wrqu )); + + /* Fill out the buffer. Note that the buffer doesn't actually contain the + ESSID, but a pointer to the contents. In addition, the 'extra' field of + the call to wireless_send_event() must also point to where the ESSID + lives */ + wrqu.essid.length = strlen( lp->NetworkName ); + wrqu.essid.pointer = (caddr_t)lp->NetworkName; + wrqu.essid.flags = 1; + + wireless_send_event( dev, SIOCSIWESSID, &wrqu, lp->NetworkName ); +#endif /* WIRELESS_EXT > 13 */ + + return; +} // wl_wext_event_essid +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_wext_event_encode() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function is used to send an event that the encryption configuration + * for a specific device has changed. + * + * + * PARAMETERS: + * + * dev - the network device for which this event is to be issued + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_wext_event_encode( struct net_device *dev ) +{ +#if WIRELESS_EXT > 13 + union iwreq_data wrqu; + struct wl_private *lp = wl_priv(dev); + int index = 0; + /*------------------------------------------------------------------------*/ + + + memset( &wrqu, 0, sizeof( wrqu )); + + if( lp->EnableEncryption == 0 ) { + wrqu.encoding.flags = IW_ENCODE_DISABLED; + } else { + wrqu.encoding.flags |= lp->TransmitKeyID; + + index = lp->TransmitKeyID - 1; + + /* Only set IW_ENCODE_RESTRICTED/OPEN flag using lp->ExcludeUnencrypted + if we're in AP mode */ +#if 1 //;? (HCF_TYPE) & HCF_TYPE_AP + //;?should we restore this to allow smaller memory footprint + + if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) { + if( lp->ExcludeUnencrypted ) { + wrqu.encoding.flags |= IW_ENCODE_RESTRICTED; + } else { + wrqu.encoding.flags |= IW_ENCODE_OPEN; + } + } + +#endif // HCF_TYPE_AP + + /* Only provide the key if permissions allow */ + if( capable( CAP_NET_ADMIN )) { + wrqu.encoding.pointer = (caddr_t)lp->DefaultKeys.key[index].key; + wrqu.encoding.length = lp->DefaultKeys.key[index].len; + } else { + wrqu.encoding.flags |= IW_ENCODE_NOKEY; + } + } + + wireless_send_event( dev, SIOCSIWENCODE, &wrqu, + lp->DefaultKeys.key[index].key ); +#endif /* WIRELESS_EXT > 13 */ + + return; +} // wl_wext_event_encode +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_wext_event_ap() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function is used to send an event that the device has been + * associated to a new AP. + * + * + * PARAMETERS: + * + * dev - the network device for which this event is to be issued + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_wext_event_ap( struct net_device *dev ) +{ +#if WIRELESS_EXT > 13 + union iwreq_data wrqu; + struct wl_private *lp = wl_priv(dev); + int status; + /*------------------------------------------------------------------------*/ + + + /* Retrieve the WPA-IEs used by the firmware and send an event. We must send + this event BEFORE sending the association event, as there are timing + issues with the hostap supplicant. The supplicant will attempt to process + an EAPOL-Key frame from an AP before receiving this information, which + is required properly process the said frame. */ + wl_wext_event_assoc_ie( dev ); + + /* Get the BSSID */ + lp->ltvRecord.typ = CFG_CUR_BSSID; + lp->ltvRecord.len = 4; + + status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + if( status == HCF_SUCCESS ) { + memset( &wrqu, 0, sizeof( wrqu )); + + memcpy( wrqu.addr.sa_data, lp->ltvRecord.u.u8, ETH_ALEN ); + + wrqu.addr.sa_family = ARPHRD_ETHER; + + wireless_send_event( dev, SIOCGIWAP, &wrqu, NULL ); + } + +#endif /* WIRELESS_EXT > 13 */ + + return; +} // wl_wext_event_ap +/*============================================================================*/ + + + +/******************************************************************************* + * wl_wext_event_scan_complete() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function is used to send an event that a request for a network scan + * has completed. + * + * + * PARAMETERS: + * + * dev - the network device for which this event is to be issued + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_wext_event_scan_complete( struct net_device *dev ) +{ +#if WIRELESS_EXT > 13 + union iwreq_data wrqu; + /*------------------------------------------------------------------------*/ + + + memset( &wrqu, 0, sizeof( wrqu )); + + wrqu.addr.sa_family = ARPHRD_ETHER; + wireless_send_event( dev, SIOCGIWSCAN, &wrqu, NULL ); +#endif /* WIRELESS_EXT > 13 */ + + return; +} // wl_wext_event_scan_complete +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_wext_event_new_sta() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function is used to send an event that an AP has registered a new + * station. + * + * + * PARAMETERS: + * + * dev - the network device for which this event is to be issued + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_wext_event_new_sta( struct net_device *dev ) +{ +#if WIRELESS_EXT > 14 + union iwreq_data wrqu; + /*------------------------------------------------------------------------*/ + + + memset( &wrqu, 0, sizeof( wrqu )); + + /* Send the station's mac address here */ + memcpy( wrqu.addr.sa_data, dev->dev_addr, ETH_ALEN ); + wrqu.addr.sa_family = ARPHRD_ETHER; + wireless_send_event( dev, IWEVREGISTERED, &wrqu, NULL ); +#endif /* WIRELESS_EXT > 14 */ + + return; +} // wl_wext_event_new_sta +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_wext_event_expired_sta() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function is used to send an event that an AP has deregistered a + * station. + * + * + * PARAMETERS: + * + * dev - the network device for which this event is to be issued + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_wext_event_expired_sta( struct net_device *dev ) +{ +#if WIRELESS_EXT > 14 + union iwreq_data wrqu; + /*------------------------------------------------------------------------*/ + + + memset( &wrqu, 0, sizeof( wrqu )); + + memcpy( wrqu.addr.sa_data, dev->dev_addr, ETH_ALEN ); + wrqu.addr.sa_family = ARPHRD_ETHER; + wireless_send_event( dev, IWEVEXPIRED, &wrqu, NULL ); +#endif /* WIRELESS_EXT > 14 */ + + return; +} // wl_wext_event_expired_sta +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_wext_event_mic_failed() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function is used to send an event that MIC calculations failed. + * + * + * PARAMETERS: + * + * dev - the network device for which this event is to be issued + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_wext_event_mic_failed( struct net_device *dev ) +{ +#if WIRELESS_EXT > 14 + char msg[512]; + union iwreq_data wrqu; + struct wl_private *lp = wl_priv(dev); + int key_idx; + char *addr1; + char *addr2; + WVLAN_RX_WMP_HDR *hdr; + /*------------------------------------------------------------------------*/ + + + key_idx = lp->lookAheadBuf[HFS_STAT+1] >> 3; + key_idx &= 0x03; + + /* Cast the lookahead buffer into a RFS format */ + hdr = (WVLAN_RX_WMP_HDR *)&lp->lookAheadBuf[HFS_STAT]; + + /* Cast the addresses to byte buffers, as in the above RFS they are word + length */ + addr1 = (char *)hdr->address1; + addr2 = (char *)hdr->address2; + + DBG_PRINT( "MIC FAIL - KEY USED : %d, STATUS : 0x%04x\n", key_idx, + hdr->status ); + + memset( &wrqu, 0, sizeof( wrqu )); + memset( msg, 0, sizeof( msg )); + + + /* Becuase MIC failures are not part of the Wireless Extensions yet, they + must be passed as a string using an IWEVCUSTOM event. In order for the + event to be effective, the string format must be known by both the + driver and the supplicant. The following is the string format used by the + hostap project's WPA supplicant, and will be used here until the Wireless + Extensions interface adds this support: + + MLME-MICHAELMICFAILURE.indication(keyid=# broadcast/unicast addr=addr2) + */ + + /* NOTE: Format of MAC address (using colons to seperate bytes) may cause + a problem in future versions of the supplicant, if they ever + actually parse these parameters */ +#if DBG + sprintf( msg, "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr=" + "%s)", key_idx, addr1[0] & 0x01 ? "broad" : "uni", + DbgHwAddr( addr2 )); +#endif + wrqu.data.length = strlen( msg ); + wireless_send_event( dev, IWEVCUSTOM, &wrqu, msg ); +#endif /* WIRELESS_EXT > 14 */ + + return; +} // wl_wext_event_mic_failed +/*============================================================================*/ + + + + +/******************************************************************************* + * wl_wext_event_assoc_ie() + ******************************************************************************* + * + * DESCRIPTION: + * + * This function is used to send an event containing the WPA-IE generated + * by the firmware in an association request. + * + * + * PARAMETERS: + * + * dev - the network device for which this event is to be issued + * + * RETURNS: + * + * N/A + * + ******************************************************************************/ +void wl_wext_event_assoc_ie( struct net_device *dev ) +{ +#if WIRELESS_EXT > 14 + char msg[512]; + union iwreq_data wrqu; + struct wl_private *lp = wl_priv(dev); + int status; + PROBE_RESP data; + hcf_16 length; + hcf_8 *wpa_ie; + /*------------------------------------------------------------------------*/ + + + memset( &wrqu, 0, sizeof( wrqu )); + memset( msg, 0, sizeof( msg )); + + /* Retrieve the Association Request IE */ + lp->ltvRecord.len = 45; + lp->ltvRecord.typ = CFG_CUR_ASSOC_REQ_INFO; + + status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); + if( status == HCF_SUCCESS ) + { + length = 0; + memcpy( &data.rawData, &( lp->ltvRecord.u.u8[1] ), 88 ); + wpa_ie = wl_parse_wpa_ie( &data, &length ); + + /* Becuase this event (Association WPA-IE) is not part of the Wireless + Extensions yet, it must be passed as a string using an IWEVCUSTOM event. + In order for the event to be effective, the string format must be known + by both the driver and the supplicant. The following is the string format + used by the hostap project's WPA supplicant, and will be used here until + the Wireless Extensions interface adds this support: + + ASSOCINFO(ReqIEs=WPA-IE RespIEs=WPA-IE) + */ + + if( length != 0 ) + { + sprintf( msg, "ASSOCINFO(ReqIEs=%s)", wl_print_wpa_ie( wpa_ie, length )); + wrqu.data.length = strlen( msg ); + wireless_send_event( dev, IWEVCUSTOM, &wrqu, msg ); + } + } +#endif /* WIRELESS_EXT > 14 */ + + return; +} // wl_wext_event_assoc_ie +/*============================================================================*/ +/* Structures to export the Wireless Handlers */ + +static const iw_handler wl_handler[] = +{ + (iw_handler) wireless_commit, /* SIOCSIWCOMMIT */ + (iw_handler) wireless_get_protocol, /* SIOCGIWNAME */ + (iw_handler) NULL, /* SIOCSIWNWID */ + (iw_handler) NULL, /* SIOCGIWNWID */ + (iw_handler) wireless_set_frequency, /* SIOCSIWFREQ */ + (iw_handler) wireless_get_frequency, /* SIOCGIWFREQ */ + (iw_handler) wireless_set_porttype, /* SIOCSIWMODE */ + (iw_handler) wireless_get_porttype, /* SIOCGIWMODE */ + (iw_handler) wireless_set_sensitivity, /* SIOCSIWSENS */ + (iw_handler) wireless_get_sensitivity, /* SIOCGIWSENS */ + (iw_handler) NULL , /* SIOCSIWRANGE */ + (iw_handler) wireless_get_range, /* SIOCGIWRANGE */ + (iw_handler) NULL , /* SIOCSIWPRIV */ + (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */ + (iw_handler) NULL , /* SIOCSIWSTATS */ + (iw_handler) NULL /* kernel code */, /* SIOCGIWSTATS */ + iw_handler_set_spy, /* SIOCSIWSPY */ + iw_handler_get_spy, /* SIOCGIWSPY */ + NULL, /* SIOCSIWTHRSPY */ + NULL, /* SIOCGIWTHRSPY */ + (iw_handler) NULL, /* SIOCSIWAP */ +#if 1 //;? (HCF_TYPE) & HCF_TYPE_STA + (iw_handler) wireless_get_bssid, /* SIOCGIWAP */ +#else + (iw_handler) NULL, /* SIOCGIWAP */ +#endif + (iw_handler) NULL, /* SIOCSIWMLME */ + (iw_handler) wireless_get_ap_list, /* SIOCGIWAPLIST */ + (iw_handler) wireless_set_scan, /* SIOCSIWSCAN */ + (iw_handler) wireless_get_scan, /* SIOCGIWSCAN */ + (iw_handler) wireless_set_essid, /* SIOCSIWESSID */ + (iw_handler) wireless_get_essid, /* SIOCGIWESSID */ + (iw_handler) wireless_set_nickname, /* SIOCSIWNICKN */ + (iw_handler) wireless_get_nickname, /* SIOCGIWNICKN */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) wireless_set_rate, /* SIOCSIWRATE */ + (iw_handler) wireless_get_rate, /* SIOCGIWRATE */ + (iw_handler) wireless_set_rts_threshold,/* SIOCSIWRTS */ + (iw_handler) wireless_get_rts_threshold,/* SIOCGIWRTS */ + (iw_handler) NULL, /* SIOCSIWFRAG */ + (iw_handler) NULL, /* SIOCGIWFRAG */ + (iw_handler) NULL, /* SIOCSIWTXPOW */ + (iw_handler) wireless_get_tx_power, /* SIOCGIWTXPOW */ + (iw_handler) NULL, /* SIOCSIWRETRY */ + (iw_handler) NULL, /* SIOCGIWRETRY */ + (iw_handler) wireless_set_encode, /* SIOCSIWENCODE */ + (iw_handler) wireless_get_encode, /* SIOCGIWENCODE */ + (iw_handler) wireless_set_power, /* SIOCSIWPOWER */ + (iw_handler) wireless_get_power, /* SIOCGIWPOWER */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) wireless_get_genie, /* SIOCSIWGENIE */ + (iw_handler) NULL, /* SIOCGIWGENIE */ + (iw_handler) wireless_set_auth, /* SIOCSIWAUTH */ + (iw_handler) NULL, /* SIOCGIWAUTH */ + (iw_handler) wireless_set_encodeext, /* SIOCSIWENCODEEXT */ + (iw_handler) NULL, /* SIOCGIWENCODEEXT */ + (iw_handler) NULL, /* SIOCSIWPMKSA */ + (iw_handler) NULL, /* -- hole -- */ +}; + +static const iw_handler wl_private_handler[] = +{ /* SIOCIWFIRSTPRIV + */ + wvlan_set_netname, /* 0: SIOCSIWNETNAME */ + wvlan_get_netname, /* 1: SIOCGIWNETNAME */ + wvlan_set_station_nickname, /* 2: SIOCSIWSTANAME */ + wvlan_get_station_nickname, /* 3: SIOCGIWSTANAME */ +#if 1 //;? (HCF_TYPE) & HCF_TYPE_STA + wvlan_set_porttype, /* 4: SIOCSIWPORTTYPE */ + wvlan_get_porttype, /* 5: SIOCGIWPORTTYPE */ +#endif +}; + +struct iw_priv_args wl_priv_args[] = { + {SIOCSIWNETNAME, IW_PRIV_TYPE_CHAR | HCF_MAX_NAME_LEN, 0, "snetwork_name" }, + {SIOCGIWNETNAME, 0, IW_PRIV_TYPE_CHAR | HCF_MAX_NAME_LEN, "gnetwork_name" }, + {SIOCSIWSTANAME, IW_PRIV_TYPE_CHAR | HCF_MAX_NAME_LEN, 0, "sstation_name" }, + {SIOCGIWSTANAME, 0, IW_PRIV_TYPE_CHAR | HCF_MAX_NAME_LEN, "gstation_name" }, +#if 1 //;? #if (HCF_TYPE) & HCF_TYPE_STA + {SIOCSIWPORTTYPE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "sport_type" }, + {SIOCGIWPORTTYPE, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "gport_type" }, +#endif +}; + +const struct iw_handler_def wl_iw_handler_def = +{ + .num_private = sizeof(wl_private_handler) / sizeof(iw_handler), + .private = (iw_handler *) wl_private_handler, + .private_args = (struct iw_priv_args *) wl_priv_args, + .num_private_args = sizeof(wl_priv_args) / sizeof(struct iw_priv_args), + .num_standard = sizeof(wl_handler) / sizeof(iw_handler), + .standard = (iw_handler *) wl_handler, + .get_wireless_stats = wl_get_wireless_stats, +}; + +#endif // WIRELESS_EXT diff --git a/drivers/staging/wlags49_h2/wl_wext.h b/drivers/staging/wlags49_h2/wl_wext.h new file mode 100644 index 000000000000..9d09de8b84fa --- /dev/null +++ b/drivers/staging/wlags49_h2/wl_wext.h @@ -0,0 +1,113 @@ +/******************************************************************************* + * Agere Systems Inc. + * Wireless device driver for Linux (wlags49). + * + * Copyright (c) 1998-2003 Agere Systems Inc. + * All rights reserved. + * http://www.agere.com + * + * Initially developed by TriplePoint, Inc. + * http://www.triplepoint.com + * + *------------------------------------------------------------------------------ + * + * Header describing information required for the wireless IOCTL handlers. + * + *------------------------------------------------------------------------------ + * + * SOFTWARE LICENSE + * + * This software is provided subject to the following terms and conditions, + * which you should read carefully before using the software. Using this + * software indicates your acceptance of these terms and conditions. If you do + * not agree with these terms and conditions, do not use the software. + * + * Copyright © 2003 Agere Systems Inc. + * All rights reserved. + * + * Redistribution and use in source or binary forms, with or without + * modifications, are permitted provided that the following conditions are met: + * + * . Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following Disclaimer as comments in the code as + * well as in the documentation and/or other materials provided with the + * distribution. + * + * . Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following Disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * . Neither the name of Agere Systems Inc. nor the names of the contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Disclaimer + * + * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY + * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN + * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + ******************************************************************************/ + + + + +/******************************************************************************* + * VERSION CONTROL INFORMATION + ******************************************************************************* + * + * $Author: nico $ + * $Date: 2004/07/19 08:16:15 $ + * $Revision: 1.2 $ + * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_wext.h,v $ + * + ******************************************************************************/ + + + + +#ifndef __WL_WEXT_H__ +#define __WL_WEXT_H__ + + +#ifdef WIRELESS_EXT + + +/******************************************************************************* + * function protoypes + ******************************************************************************/ + +struct iw_statistics *wl_wireless_stats( struct net_device *dev ); + +struct iw_statistics * wl_get_wireless_stats( struct net_device *dev ); + +inline void wl_spy_gather (struct net_device *dev, u_char *mac); + +void wl_wext_event_freq( struct net_device *dev ); +void wl_wext_event_mode( struct net_device *dev ); +void wl_wext_event_essid( struct net_device *dev ); +void wl_wext_event_encode( struct net_device *dev ); +void wl_wext_event_ap( struct net_device *dev ); +void wl_wext_event_scan_complete( struct net_device *dev ); +void wl_wext_event_new_sta( struct net_device *dev ); +void wl_wext_event_expired_sta( struct net_device *dev ); +void wl_wext_event_mic_failed( struct net_device *dev ); +void wl_wext_event_assoc_ie( struct net_device *dev ); + +extern const struct iw_handler_def wl_iw_handler_def; + +#else +#error WIRELESS_EXT +#endif // WIRELESS_EXT + + +#endif // __WL_WEXT_H__ diff --git a/drivers/staging/wlags49_h25/Kconfig b/drivers/staging/wlags49_h25/Kconfig new file mode 100644 index 000000000000..1df08e0b3468 --- /dev/null +++ b/drivers/staging/wlags49_h25/Kconfig @@ -0,0 +1,8 @@ +config WLAGS49_H25 + tristate "Linksys HERMES II.5 WCF54G_Wireless-G_CompactFlash_Card" + depends on WLAN_80211 && WIRELESS_EXT + ---help--- + Driver for wireless cards using Agere's HERMES II.5 chipset + which are identified with Manufacture ID: 0156,0004 + The software is a modified version of wl_lkm_722_abg.tar.gz + from the Agere Systems website, addapted for Ubuntu 9.04. diff --git a/drivers/staging/wlags49_h25/Makefile b/drivers/staging/wlags49_h25/Makefile new file mode 100644 index 000000000000..d0b23d4ff95a --- /dev/null +++ b/drivers/staging/wlags49_h25/Makefile @@ -0,0 +1,81 @@ +# +# Makefile for wlags49_h2_cs.ko and wlags49_h25_cs.ko +# +# Default build for Hermes-II base cards (possibly identified with +# "manfid: 0x0156, 0x0003" in "pccardctl ident" output), comment +# -DHERMES25 below +# +# If you want to build for Hermes-II.5 base cards (possibly identified with +# "manfid: 0x0156, 0x0004" in "pccardctl ident" output), uncomment +# -DHERMES25 below +# +# If you want to build AP support (untested), comment out -DSTA_ONLY + +INSTALLDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless +EXTRA_CFLAGS += -I$(KERNELDIR)/include +EXTRA_CFLAGS += -I$(src) \ + -DBUS_PCMCIA \ + -DUSE_WPA \ + -DUSE_WEXT \ + -DSTA_ONLY \ + -DWVLAN_49 \ + -DHERMES25 \ +# -DDBG \ +# -DDBG_LVL=5 \ +# -DUSE_UIL \ +# -DUSE_PROFILE \ + +ifeq ($(findstring HERMES25,$(EXTRA_CFLAGS)),) +WLNAME := wlags49_h2_cs +$(WLNAME)-y := sta_h2.o +ifeq ($(findstring STA_ONLY,$(EXTRA_CFLAGS)),) +$(WLNAME)-y += ap_h2.o +endif +else +WLNAME=wlags49_h25_cs +$(WLNAME)-y := sta_h25.o +ifeq ($(findstring STA_ONLY,$(EXTRA_CFLAGS)),) +$(WLNAME)-y += ap_h25.o +endif +endif + +# If KERNELRELEASE is defined, we've been invoked from the +# kernel build system and can use its language. +ifneq ($(KERNELRELEASE),) + +obj-m += $(WLNAME).o + +$(WLNAME)-y += wl_profile.o \ + wl_wext.o \ + wl_priv.o \ + wl_main.o \ + wl_enc.o \ + wl_util.o \ + wl_netdev.o \ + wl_cs.o \ + mmd.o \ + hcf.o \ + dhf.o + +$(WLNAME)-$(CONFIG_SYSFS) += wl_sysfs.o + +# Otherwise we were called directly from the command +# line; invoke the kernel build system. +else + KERNELDIR ?= /lib/modules/$(shell uname -r)/build + PWD := $(shell pwd) + +default: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules +endif + +clean: + rm -fr *.o *.ko *.mod.c *.mod.o .*.*.cmd Module.symvers \ + Module.markers modules.order .tmp_versions + +install: default + -rmmod $(WLNAME) + install -d $(INSTALLDIR) + install -m 0644 -o root -g root $(WLNAME).ko $(INSTALLDIR) + /sbin/depmod -aq + diff --git a/drivers/staging/wlags49_h25/README.txt b/drivers/staging/wlags49_h25/README.txt new file mode 100644 index 000000000000..4c7a836972d7 --- /dev/null +++ b/drivers/staging/wlags49_h25/README.txt @@ -0,0 +1,30 @@ +======================================================================= +WLAN driver for cards using the HERMES II and HERMES II.5 chipset + +HERMES II Card + +PCMCIA Info: "Agere Systems" "Wireless PC Card Model 0110" + Manufacture ID: 0156,0003 + +HERMES II.5 Card + +PCMCIA Info: "Linksys" "WCF54G_Wireless-G_CompactFlash_Card" + Manufacture ID: 0156,0004 + +Based on Agere Systems Linux LKM Wireless Driver Source Code, +Version 7.22; complies with Open Source BSD License. +======================================================================= + +DESCRIPTION + +This directory only contains files that refer to the source in wlags49_h2. +Only real sourcefiles are the Makefile which has been configured to build +the driver for the HERMES II.5 chipset and Kconfig to describe the driver. + +The wlags49_h2 directory contains the full source, including the files +exclusively used by this driver. + +For more information about the driver look at the wlags49_h2 direcory. + +======================================================================= + diff --git a/drivers/staging/wlags49_h25/ap_h25.c b/drivers/staging/wlags49_h25/ap_h25.c new file mode 100644 index 000000000000..0344fa58dda6 --- /dev/null +++ b/drivers/staging/wlags49_h25/ap_h25.c @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/ap_h25.c" diff --git a/drivers/staging/wlags49_h25/debug.h b/drivers/staging/wlags49_h25/debug.h new file mode 100644 index 000000000000..b5fb136a2d54 --- /dev/null +++ b/drivers/staging/wlags49_h25/debug.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/debug.h" diff --git a/drivers/staging/wlags49_h25/dhf.c b/drivers/staging/wlags49_h25/dhf.c new file mode 100644 index 000000000000..81762c80189c --- /dev/null +++ b/drivers/staging/wlags49_h25/dhf.c @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/dhf.c" diff --git a/drivers/staging/wlags49_h25/dhf.h b/drivers/staging/wlags49_h25/dhf.h new file mode 100644 index 000000000000..54181dc70a72 --- /dev/null +++ b/drivers/staging/wlags49_h25/dhf.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/dhf.h" diff --git a/drivers/staging/wlags49_h25/dhfcfg.h b/drivers/staging/wlags49_h25/dhfcfg.h new file mode 100644 index 000000000000..2586e3980214 --- /dev/null +++ b/drivers/staging/wlags49_h25/dhfcfg.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/dhfcfg.h" diff --git a/drivers/staging/wlags49_h25/hcf.c b/drivers/staging/wlags49_h25/hcf.c new file mode 100644 index 000000000000..eeeba1f5553e --- /dev/null +++ b/drivers/staging/wlags49_h25/hcf.c @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/hcf.c" diff --git a/drivers/staging/wlags49_h25/hcf.h b/drivers/staging/wlags49_h25/hcf.h new file mode 100644 index 000000000000..d1143d9fce2d --- /dev/null +++ b/drivers/staging/wlags49_h25/hcf.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/hcf.h" diff --git a/drivers/staging/wlags49_h25/hcfcfg.h b/drivers/staging/wlags49_h25/hcfcfg.h new file mode 100644 index 000000000000..f88c4bcb3ff8 --- /dev/null +++ b/drivers/staging/wlags49_h25/hcfcfg.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/hcfcfg.h" diff --git a/drivers/staging/wlags49_h25/hcfdef.h b/drivers/staging/wlags49_h25/hcfdef.h new file mode 100644 index 000000000000..f6a0060c3a53 --- /dev/null +++ b/drivers/staging/wlags49_h25/hcfdef.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/hcfdef.h" diff --git a/drivers/staging/wlags49_h25/mdd.h b/drivers/staging/wlags49_h25/mdd.h new file mode 100644 index 000000000000..4d8e142ffa34 --- /dev/null +++ b/drivers/staging/wlags49_h25/mdd.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/mdd.h" diff --git a/drivers/staging/wlags49_h25/mmd.c b/drivers/staging/wlags49_h25/mmd.c new file mode 100644 index 000000000000..b20782d334d2 --- /dev/null +++ b/drivers/staging/wlags49_h25/mmd.c @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/mmd.c" diff --git a/drivers/staging/wlags49_h25/mmd.h b/drivers/staging/wlags49_h25/mmd.h new file mode 100644 index 000000000000..8284dd9155ed --- /dev/null +++ b/drivers/staging/wlags49_h25/mmd.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/mmd.h" diff --git a/drivers/staging/wlags49_h25/sta_h25.c b/drivers/staging/wlags49_h25/sta_h25.c new file mode 100644 index 000000000000..83c76bbdc6e7 --- /dev/null +++ b/drivers/staging/wlags49_h25/sta_h25.c @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/sta_h25.c" diff --git a/drivers/staging/wlags49_h25/wl_cs.c b/drivers/staging/wlags49_h25/wl_cs.c new file mode 100644 index 000000000000..e6e1f199ea68 --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_cs.c @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_cs.c" diff --git a/drivers/staging/wlags49_h25/wl_cs.h b/drivers/staging/wlags49_h25/wl_cs.h new file mode 100644 index 000000000000..657acee525cb --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_cs.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_cs.h" diff --git a/drivers/staging/wlags49_h25/wl_enc.c b/drivers/staging/wlags49_h25/wl_enc.c new file mode 100644 index 000000000000..fe59df145150 --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_enc.c @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_enc.c" diff --git a/drivers/staging/wlags49_h25/wl_enc.h b/drivers/staging/wlags49_h25/wl_enc.h new file mode 100644 index 000000000000..f2e860e14be9 --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_enc.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_enc.h" diff --git a/drivers/staging/wlags49_h25/wl_if.h b/drivers/staging/wlags49_h25/wl_if.h new file mode 100644 index 000000000000..70d86f09f87a --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_if.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_if.h" diff --git a/drivers/staging/wlags49_h25/wl_internal.h b/drivers/staging/wlags49_h25/wl_internal.h new file mode 100644 index 000000000000..c1687a3056cd --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_internal.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_internal.h" diff --git a/drivers/staging/wlags49_h25/wl_main.c b/drivers/staging/wlags49_h25/wl_main.c new file mode 100644 index 000000000000..d2c06ad8f88a --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_main.c @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_main.c" diff --git a/drivers/staging/wlags49_h25/wl_main.h b/drivers/staging/wlags49_h25/wl_main.h new file mode 100644 index 000000000000..c98376e71957 --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_main.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_main.h" diff --git a/drivers/staging/wlags49_h25/wl_netdev.c b/drivers/staging/wlags49_h25/wl_netdev.c new file mode 100644 index 000000000000..f7512c3891a8 --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_netdev.c @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_netdev.c" diff --git a/drivers/staging/wlags49_h25/wl_netdev.h b/drivers/staging/wlags49_h25/wl_netdev.h new file mode 100644 index 000000000000..519cd5f0461c --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_netdev.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_netdev.h" diff --git a/drivers/staging/wlags49_h25/wl_priv.c b/drivers/staging/wlags49_h25/wl_priv.c new file mode 100644 index 000000000000..160c8014051a --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_priv.c @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_priv.c" diff --git a/drivers/staging/wlags49_h25/wl_priv.h b/drivers/staging/wlags49_h25/wl_priv.h new file mode 100644 index 000000000000..28492b362db4 --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_priv.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_priv.h" diff --git a/drivers/staging/wlags49_h25/wl_profile.c b/drivers/staging/wlags49_h25/wl_profile.c new file mode 100644 index 000000000000..6baa201c132a --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_profile.c @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_profile.c" diff --git a/drivers/staging/wlags49_h25/wl_profile.h b/drivers/staging/wlags49_h25/wl_profile.h new file mode 100644 index 000000000000..5f253a5fb60e --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_profile.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_profile.h" diff --git a/drivers/staging/wlags49_h25/wl_sysfs.c b/drivers/staging/wlags49_h25/wl_sysfs.c new file mode 100644 index 000000000000..6458ee63350d --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_sysfs.c @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_sysfs.c" diff --git a/drivers/staging/wlags49_h25/wl_sysfs.h b/drivers/staging/wlags49_h25/wl_sysfs.h new file mode 100644 index 000000000000..eb819a5ef8b5 --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_sysfs.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_sysfs.h" diff --git a/drivers/staging/wlags49_h25/wl_util.c b/drivers/staging/wlags49_h25/wl_util.c new file mode 100644 index 000000000000..771bebeeac4c --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_util.c @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_util.c" diff --git a/drivers/staging/wlags49_h25/wl_util.h b/drivers/staging/wlags49_h25/wl_util.h new file mode 100644 index 000000000000..ccd74e73a4be --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_util.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_util.h" diff --git a/drivers/staging/wlags49_h25/wl_version.h b/drivers/staging/wlags49_h25/wl_version.h new file mode 100644 index 000000000000..ad38e8f7214c --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_version.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_version.h" diff --git a/drivers/staging/wlags49_h25/wl_wext.c b/drivers/staging/wlags49_h25/wl_wext.c new file mode 100644 index 000000000000..f660e791b620 --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_wext.c @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_wext.c" diff --git a/drivers/staging/wlags49_h25/wl_wext.h b/drivers/staging/wlags49_h25/wl_wext.h new file mode 100644 index 000000000000..31d63865c222 --- /dev/null +++ b/drivers/staging/wlags49_h25/wl_wext.h @@ -0,0 +1,2 @@ +/* Use common source from wlags49_h2 */ +#include "../wlags49_h2/wl_wext.h" -- GitLab From a6f95b6ee60e4e0f8768419c15e625b5bef44cb6 Mon Sep 17 00:00:00 2001 From: Henk de Groot Date: Wed, 28 Oct 2009 23:43:55 +0100 Subject: [PATCH 136/235] Staging: wlags49_h2: add TODO files Adds TODO to the wlags_h2 and wlags_h5 staging drivers. Signed-off-by: Henk de Groot Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlags49_h2/TODO | 33 ++++++++++++++++++++++++++++++++ drivers/staging/wlags49_h25/TODO | 33 ++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 drivers/staging/wlags49_h2/TODO create mode 100644 drivers/staging/wlags49_h25/TODO diff --git a/drivers/staging/wlags49_h2/TODO b/drivers/staging/wlags49_h2/TODO new file mode 100644 index 000000000000..14aa415b1a82 --- /dev/null +++ b/drivers/staging/wlags49_h2/TODO @@ -0,0 +1,33 @@ +First of all, the best thing would be that this driver becomes obsolte by +adding support for Hermes II and Hermes II.5 cards to the existing orinoco +driver. The orinoco driver currently only supports Hermes I based cards. +Since this will not happen by magic and has not happend until now this +driver provides a stop-gap solution for these type of cards. + +Having said that, the following wishlist comes to mind to make the driver +suitable as fully supported kernel driver. Feel free to expand/enhance the +list. + +TODO: + - verify against a Hermes II.5 card + - verify with WPA encription (both with H2 and H2.5 cards) + - sometimes the card does not initialize correctly, retry mechanisms + are build in to catch most cases but not all + - once the driver runs it is very stable, but I have the impression + some the crittical sections take to long + - the driver is split into a Hermes II and a Hermes II.5 part, it + would be nice to handle both with one module instead of two + - review by the wireless developer community + - verify the code against the coding standards for a propper linux + driver + - resolve license issues (?) + +DONE: + - verified against a Hermes II card (Thomson Speedtouch 110 PCMCIA + card) + - verified with WEP encription + +Please send any patches or complaints about this driver to Greg +Kroah-Hartman and Cc: Henk de Groot +Don't bother the upstream wireless kernel developers about it, they +want nothing to do with it. diff --git a/drivers/staging/wlags49_h25/TODO b/drivers/staging/wlags49_h25/TODO new file mode 100644 index 000000000000..14aa415b1a82 --- /dev/null +++ b/drivers/staging/wlags49_h25/TODO @@ -0,0 +1,33 @@ +First of all, the best thing would be that this driver becomes obsolte by +adding support for Hermes II and Hermes II.5 cards to the existing orinoco +driver. The orinoco driver currently only supports Hermes I based cards. +Since this will not happen by magic and has not happend until now this +driver provides a stop-gap solution for these type of cards. + +Having said that, the following wishlist comes to mind to make the driver +suitable as fully supported kernel driver. Feel free to expand/enhance the +list. + +TODO: + - verify against a Hermes II.5 card + - verify with WPA encription (both with H2 and H2.5 cards) + - sometimes the card does not initialize correctly, retry mechanisms + are build in to catch most cases but not all + - once the driver runs it is very stable, but I have the impression + some the crittical sections take to long + - the driver is split into a Hermes II and a Hermes II.5 part, it + would be nice to handle both with one module instead of two + - review by the wireless developer community + - verify the code against the coding standards for a propper linux + driver + - resolve license issues (?) + +DONE: + - verified against a Hermes II card (Thomson Speedtouch 110 PCMCIA + card) + - verified with WEP encription + +Please send any patches or complaints about this driver to Greg +Kroah-Hartman and Cc: Henk de Groot +Don't bother the upstream wireless kernel developers about it, they +want nothing to do with it. -- GitLab From bfb97bf833785525eb128cbcee81f686d0239aa4 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Fri, 30 Oct 2009 11:01:43 -0700 Subject: [PATCH 137/235] Staging: wlags49: fix kconfigs dependancy Fix depends/selects in wlags49 drivers. ERROR: "wireless_spy_update" [drivers/staging/wlags49_h2/wlags49_h2_cs.ko] undefined! ERROR: "iw_handler_get_spy" [drivers/staging/wlags49_h2/wlags49_h2_cs.ko] undefined! ERROR: "iw_handler_set_spy" [drivers/staging/wlags49_h2/wlags49_h2_cs.ko] undefined! ERROR: "pcmcia_dev_present" [drivers/staging/wlags49_h25/wlags49_h25_cs.ko] undefined! ERROR: "pcmcia_request_irq" [drivers/staging/wlags49_h25/wlags49_h25_cs.ko] undefined! ERROR: "pcmcia_register_driver" [drivers/staging/wlags49_h25/wlags49_h25_cs.ko] undefined! ERROR: "pcmcia_request_configuration" [drivers/staging/wlags49_h25/wlags49_h25_cs.ko] undefined! ERROR: "pcmcia_request_io" [drivers/staging/wlags49_h25/wlags49_h25_cs.ko] undefined! ERROR: "pcmcia_error_ret" [drivers/staging/wlags49_h25/wlags49_h25_cs.ko] undefined! ERROR: "pcmcia_error_func" [drivers/staging/wlags49_h25/wlags49_h25_cs.ko] undefined! ERROR: "pcmcia_unregister_driver" [drivers/staging/wlags49_h25/wlags49_h25_cs.ko] undefined! ERROR: "pcmcia_disable_device" [drivers/staging/wlags49_h25/wlags49_h25_cs.ko] undefined! ERROR: "pcmcia_dev_present" [drivers/staging/wlags49_h2/wlags49_h2_cs.ko] undefined! ERROR: "pcmcia_request_irq" [drivers/staging/wlags49_h2/wlags49_h2_cs.ko] undefined! ERROR: "pcmcia_register_driver" [drivers/staging/wlags49_h2/wlags49_h2_cs.ko] undefined! ERROR: "pcmcia_request_configuration" [drivers/staging/wlags49_h2/wlags49_h2_cs.ko] undefined! ERROR: "pcmcia_request_io" [drivers/staging/wlags49_h2/wlags49_h2_cs.ko] undefined! ERROR: "pcmcia_error_ret" [drivers/staging/wlags49_h2/wlags49_h2_cs.ko] undefined! ERROR: "pcmcia_error_func" [drivers/staging/wlags49_h2/wlags49_h2_cs.ko] undefined! ERROR: "pcmcia_unregister_driver" [drivers/staging/wlags49_h2/wlags49_h2_cs.ko] undefined! ERROR: "pcmcia_disable_device" [drivers/staging/wlags49_h2/wlags49_h2_cs.ko] undefined! Signed-off-by: Randy Dunlap Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlags49_h2/Kconfig | 3 ++- drivers/staging/wlags49_h25/Kconfig | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wlags49_h2/Kconfig b/drivers/staging/wlags49_h2/Kconfig index f9978fc40d4b..92053fe70130 100644 --- a/drivers/staging/wlags49_h2/Kconfig +++ b/drivers/staging/wlags49_h2/Kconfig @@ -1,6 +1,7 @@ config WLAGS49_H2 tristate "Agere Systems HERMES II Wireless PC Card Model 0110" - depends on WLAN_80211 && WIRELESS_EXT + depends on WLAN_80211 && WIRELESS_EXT && PCMCIA + select WEXT_SPY ---help--- Driver for wireless cards using Agere's HERMES II chipset which are identified with Manufacture ID: 0156,0003 diff --git a/drivers/staging/wlags49_h25/Kconfig b/drivers/staging/wlags49_h25/Kconfig index 1df08e0b3468..304a8c96ce33 100644 --- a/drivers/staging/wlags49_h25/Kconfig +++ b/drivers/staging/wlags49_h25/Kconfig @@ -1,6 +1,7 @@ config WLAGS49_H25 tristate "Linksys HERMES II.5 WCF54G_Wireless-G_CompactFlash_Card" - depends on WLAN_80211 && WIRELESS_EXT + depends on WLAN_80211 && WIRELESS_EXT && PCMCIA + select WEXT_SPY ---help--- Driver for wireless cards using Agere's HERMES II.5 chipset which are identified with Manufacture ID: 0156,0004 -- GitLab From ff933693a4749a20662dee92f5fe8c8484ec3153 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Sun, 11 Oct 2009 11:05:08 +0200 Subject: [PATCH 138/235] Staging: dream: make it independant from CONFIG_ANDROID Make Dream support independent of CONFIG_ANDROID. Signed-off-by: Pavel Machek --- drivers/staging/Makefile | 2 +- drivers/staging/dream/Kconfig | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 9852d449a047..3c6135b4126c 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -25,7 +25,7 @@ obj-$(CONFIG_RTL8192E) += rtl8192e/ obj-$(CONFIG_INPUT_MIMIO) += mimio/ obj-$(CONFIG_TRANZPORT) += frontier/ obj-$(CONFIG_ANDROID) += android/ -obj-$(CONFIG_ANDROID) += dream/ +obj-$(CONFIG_DREAM) += dream/ obj-$(CONFIG_DST) += dst/ obj-$(CONFIG_POHMELFS) += pohmelfs/ obj-$(CONFIG_B3DFG) += b3dfg/ diff --git a/drivers/staging/dream/Kconfig b/drivers/staging/dream/Kconfig index 52bd187de5a7..1268d38ac728 100644 --- a/drivers/staging/dream/Kconfig +++ b/drivers/staging/dream/Kconfig @@ -1,3 +1,6 @@ +config DREAM + tristate "HTC Dream support" + source "drivers/staging/dream/smd/Kconfig" source "drivers/staging/dream/camera/Kconfig" -- GitLab From b7fa31849c237b0bbcc03cd65536f0060ee6117d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 26 Oct 2009 16:43:54 -0700 Subject: [PATCH 139/235] Staging: dream: mark as BROKEN It doesn't build, and hasn't for a long time (if ever). So mark it BROKEN for now. Cc: Pavel Machek Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dream/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/dream/Kconfig b/drivers/staging/dream/Kconfig index 1268d38ac728..4afa081c870c 100644 --- a/drivers/staging/dream/Kconfig +++ b/drivers/staging/dream/Kconfig @@ -1,5 +1,6 @@ config DREAM tristate "HTC Dream support" + depends on BROKEN source "drivers/staging/dream/smd/Kconfig" -- GitLab From 05d42522017df477f16c0ebc2d65aa8bde6e0e86 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Fri, 18 Sep 2009 12:59:22 -0700 Subject: [PATCH 140/235] Staging: dream: Synaptics touchscreen for HTC Dream: check that smbus is available Check that SMBUS APIs are available in touchscreen driver. Signed-off-by: Pavel Machek Cc: Trilok Soni Cc: Cc: Brian Swetland Cc: Dmitry Torokhov Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dream/synaptics_i2c_rmi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/dream/synaptics_i2c_rmi.c b/drivers/staging/dream/synaptics_i2c_rmi.c index ae696d3bc8e6..4de6bc917595 100644 --- a/drivers/staging/dream/synaptics_i2c_rmi.c +++ b/drivers/staging/dream/synaptics_i2c_rmi.c @@ -379,6 +379,12 @@ static int __devinit synaptics_ts_probe( goto err_check_functionality_failed; } + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA)) { + pr_err("synaptics_ts_probe: need I2C_FUNC_SMBUS_WORD_DATA\n"); + ret = -ENODEV; + goto err_check_functionality_failed; + } + ts = kzalloc(sizeof(*ts), GFP_KERNEL); if (ts == NULL) { ret = -ENOMEM; -- GitLab From ace9e7915badc44d0240b12ca9817b0171623f29 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Thu, 22 Oct 2009 11:03:54 +0200 Subject: [PATCH 141/235] Staging: dream: remove wakelock support Includes changed so that is now needed for TASK_INTERRUPTIBLE and friends, so include it. Remove hooks for features not in mainline, such as earlysuspend and wakelocks. Signed-off-by: Pavel Machek Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dream/camera/msm_camera.c | 7 +------ drivers/staging/dream/camera/msm_vfe7x.c | 1 + drivers/staging/dream/gpio_event.c | 3 +-- drivers/staging/dream/gpio_input.c | 7 ------- drivers/staging/dream/gpio_matrix.c | 8 -------- drivers/staging/dream/qdsp5/adsp.c | 5 ----- drivers/staging/dream/qdsp5/audio_out.c | 4 ---- drivers/staging/dream/smd/smd_qmi.c | 5 ----- drivers/staging/dream/smd/smd_rpcrouter.c | 12 ------------ drivers/staging/dream/smd/smd_tty.c | 5 ----- 10 files changed, 3 insertions(+), 54 deletions(-) diff --git a/drivers/staging/dream/camera/msm_camera.c b/drivers/staging/dream/camera/msm_camera.c index 88165998698c..7d938772eacc 100644 --- a/drivers/staging/dream/camera/msm_camera.c +++ b/drivers/staging/dream/camera/msm_camera.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -1597,7 +1598,6 @@ static int __msm_release(struct msm_sync *sync) MSM_DRAIN_QUEUE(sync, pict_frame_q); sync->sctrl.s_release(); - wake_unlock(&sync->wake_lock); sync->apps_id = NULL; CDBG("msm_release completed!\n"); @@ -1806,7 +1806,6 @@ static int __msm_open(struct msm_sync *sync, const char *const apps_id) sync->apps_id = apps_id; if (!sync->opencnt) { - wake_lock(&sync->wake_lock); msm_camvfe_fn_init(&sync->vfefn, sync); if (sync->vfefn.vfe_init) { @@ -2044,8 +2043,6 @@ static int msm_sync_init(struct msm_sync *sync, INIT_LIST_HEAD(&sync->pict_frame_q); init_waitqueue_head(&sync->pict_frame_wait); - wake_lock_init(&sync->wake_lock, WAKE_LOCK_IDLE, "msm_camera"); - rc = msm_camio_probe_on(pdev); if (rc < 0) return rc; @@ -2058,7 +2055,6 @@ static int msm_sync_init(struct msm_sync *sync, if (rc < 0) { pr_err("msm_camera: failed to initialize %s\n", sync->sdata->sensor_name); - wake_lock_destroy(&sync->wake_lock); return rc; } @@ -2070,7 +2066,6 @@ static int msm_sync_init(struct msm_sync *sync, static int msm_sync_destroy(struct msm_sync *sync) { - wake_lock_destroy(&sync->wake_lock); return 0; } diff --git a/drivers/staging/dream/camera/msm_vfe7x.c b/drivers/staging/dream/camera/msm_vfe7x.c index 5de96c5d6352..33ab3ac6ac57 100644 --- a/drivers/staging/dream/camera/msm_vfe7x.c +++ b/drivers/staging/dream/camera/msm_vfe7x.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/staging/dream/gpio_event.c b/drivers/staging/dream/gpio_event.c index 8b64c1e579ba..e60e2c0db9c0 100644 --- a/drivers/staging/dream/gpio_event.c +++ b/drivers/staging/dream/gpio_event.c @@ -13,7 +13,7 @@ * */ -#include + #include #include #include @@ -23,7 +23,6 @@ struct gpio_event { struct input_dev *input_dev; const struct gpio_event_platform_data *info; - struct early_suspend early_suspend; void *state[0]; }; diff --git a/drivers/staging/dream/gpio_input.c b/drivers/staging/dream/gpio_input.c index 7e307f267a2a..0638ec43601a 100644 --- a/drivers/staging/dream/gpio_input.c +++ b/drivers/staging/dream/gpio_input.c @@ -19,7 +19,6 @@ #include #include #include -#include enum { DEBOUNCE_UNSTABLE = BIT(0), /* Got irq, while debouncing */ @@ -44,7 +43,6 @@ struct gpio_input_state { int use_irq; int debounce_count; spinlock_t irq_lock; - struct wake_lock wake_lock; struct gpio_key_state key_state[0]; }; @@ -143,8 +141,6 @@ static enum hrtimer_restart gpio_event_input_timer_func(struct hrtimer *timer) hrtimer_start(timer, ds->info->debounce_time, HRTIMER_MODE_REL); else if (!ds->use_irq) hrtimer_start(timer, ds->info->poll_time, HRTIMER_MODE_REL); - else - wake_unlock(&ds->wake_lock); spin_unlock_irqrestore(&ds->irq_lock, irqflags); @@ -170,7 +166,6 @@ static irqreturn_t gpio_event_input_irq_handler(int irq, void *dev_id) if (ks->debounce & DEBOUNCE_WAIT_IRQ) { ks->debounce = DEBOUNCE_UNKNOWN; if (ds->debounce_count++ == 0) { - wake_lock(&ds->wake_lock); hrtimer_start( &ds->timer, ds->info->debounce_time, HRTIMER_MODE_REL); @@ -277,7 +272,6 @@ int gpio_event_input_func(struct input_dev *input_dev, ds->debounce_count = di->keymap_size; ds->input_dev = input_dev; ds->info = di; - wake_lock_init(&ds->wake_lock, WAKE_LOCK_SUSPEND, "gpio_input"); spin_lock_init(&ds->irq_lock); for (i = 0; i < di->keymap_size; i++) { @@ -336,7 +330,6 @@ err_gpio_configure_failed: err_gpio_request_failed: ; } - wake_lock_destroy(&ds->wake_lock); kfree(ds); err_ds_alloc_failed: return ret; diff --git a/drivers/staging/dream/gpio_matrix.c b/drivers/staging/dream/gpio_matrix.c index c1f47651a493..796de4faf859 100644 --- a/drivers/staging/dream/gpio_matrix.c +++ b/drivers/staging/dream/gpio_matrix.c @@ -18,13 +18,11 @@ #include #include #include -#include struct gpio_kp { struct input_dev *input_dev; struct gpio_event_matrix_info *keypad_info; struct hrtimer timer; - struct wake_lock wake_lock; int current_output; unsigned int use_irq:1; unsigned int key_state_changed:1; @@ -199,7 +197,6 @@ static enum hrtimer_restart gpio_keypad_timer_func(struct hrtimer *timer) } for (in = 0; in < mi->ninputs; in++) enable_irq(gpio_to_irq(mi->input_gpios[in])); - wake_unlock(&kp->wake_lock); return HRTIMER_NORESTART; } @@ -222,7 +219,6 @@ static irqreturn_t gpio_keypad_irq_handler(int irq_in, void *dev_id) else gpio_direction_input(mi->output_gpios[i]); } - wake_lock(&kp->wake_lock); hrtimer_start(&kp->timer, ktime_set(0, 0), HRTIMER_MODE_REL); return IRQ_HANDLED; } @@ -363,7 +359,6 @@ int gpio_event_matrix_func(struct input_dev *input_dev, hrtimer_init(&kp->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); kp->timer.function = gpio_keypad_timer_func; - wake_lock_init(&kp->wake_lock, WAKE_LOCK_SUSPEND, "gpio_kp"); err = gpio_keypad_request_irqs(kp); kp->use_irq = err == 0; @@ -371,8 +366,6 @@ int gpio_event_matrix_func(struct input_dev *input_dev, "in %s mode\n", input_dev->name, kp->use_irq ? "interrupt" : "polling"); - if (kp->use_irq) - wake_lock(&kp->wake_lock); hrtimer_start(&kp->timer, ktime_set(0, 0), HRTIMER_MODE_REL); return 0; @@ -386,7 +379,6 @@ int gpio_event_matrix_func(struct input_dev *input_dev, free_irq(gpio_to_irq(mi->input_gpios[i]), kp); hrtimer_cancel(&kp->timer); - wake_lock_destroy(&kp->wake_lock); for (i = mi->noutputs - 1; i >= 0; i--) { err_gpio_direction_input_failed: gpio_free(mi->input_gpios[i]); diff --git a/drivers/staging/dream/qdsp5/adsp.c b/drivers/staging/dream/qdsp5/adsp.c index d096456688da..9069535fcaf1 100644 --- a/drivers/staging/dream/qdsp5/adsp.c +++ b/drivers/staging/dream/qdsp5/adsp.c @@ -32,16 +32,12 @@ #include #include #include -#include -static struct wake_lock adsp_wake_lock; static inline void prevent_suspend(void) { - wake_lock(&adsp_wake_lock); } static inline void allow_suspend(void) { - wake_unlock(&adsp_wake_lock); } #include @@ -1046,7 +1042,6 @@ static int msm_adsp_probe(struct platform_device *pdev) pr_info("adsp: probe\n"); - wake_lock_init(&adsp_wake_lock, WAKE_LOCK_SUSPEND, "adsp"); #if CONFIG_MSM_AMSS_VERSION >= 6350 adsp_info.init_info_ptr = kzalloc( (sizeof(struct adsp_rtos_mp_mtoa_init_info_type)), GFP_KERNEL); diff --git a/drivers/staging/dream/qdsp5/audio_out.c b/drivers/staging/dream/qdsp5/audio_out.c index d1adcf65f2bd..df87ca337b94 100644 --- a/drivers/staging/dream/qdsp5/audio_out.c +++ b/drivers/staging/dream/qdsp5/audio_out.c @@ -38,8 +38,6 @@ #include #include -#include - #include "evlog.h" #define LOG_AUDIO_EVENTS 1 @@ -260,7 +258,6 @@ static int audio_enable(struct audio *audio) } audio->enabled = 1; - htc_pwrsink_set(PWRSINK_AUDIO, 100); return 0; } @@ -695,7 +692,6 @@ static int audio_release(struct inode *inode, struct file *file) audio_flush(audio); audio->opened = 0; mutex_unlock(&audio->lock); - htc_pwrsink_set(PWRSINK_AUDIO, 0); return 0; } diff --git a/drivers/staging/dream/smd/smd_qmi.c b/drivers/staging/dream/smd/smd_qmi.c index d4e7d8804626..687db142904c 100644 --- a/drivers/staging/dream/smd/smd_qmi.c +++ b/drivers/staging/dream/smd/smd_qmi.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -74,7 +73,6 @@ struct qmi_ctxt { smd_channel_t *ch; const char *ch_name; - struct wake_lock wake_lock; struct work_struct open_work; struct work_struct read_work; @@ -90,7 +88,6 @@ void qmi_ctxt_init(struct qmi_ctxt *ctxt, unsigned n) mutex_init(&ctxt->lock); INIT_WORK(&ctxt->read_work, qmi_read_work); INIT_WORK(&ctxt->open_work, qmi_open_work); - wake_lock_init(&ctxt->wake_lock, WAKE_LOCK_SUSPEND, ctxt->misc.name); ctxt->ctl_txn_id = 1; ctxt->wds_txn_id = 1; ctxt->wds_busy = 1; @@ -454,7 +451,6 @@ static void qmi_process_qmux(struct qmi_ctxt *ctxt, break; } mutex_unlock(&ctxt->lock); - wake_up(&qmi_wait_queue); } @@ -509,7 +505,6 @@ static void qmi_notify(void *priv, unsigned event) int sz; sz = smd_cur_packet_size(ctxt->ch); if ((sz > 0) && (sz <= smd_read_avail(ctxt->ch))) { - wake_lock_timeout(&ctxt->wake_lock, HZ / 2); queue_work(qmi_wq, &ctxt->read_work); } break; diff --git a/drivers/staging/dream/smd/smd_rpcrouter.c b/drivers/staging/dream/smd/smd_rpcrouter.c index d4a4a887e428..5ac2cd4a5978 100644 --- a/drivers/staging/dream/smd/smd_rpcrouter.c +++ b/drivers/staging/dream/smd/smd_rpcrouter.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -96,7 +95,6 @@ static DEFINE_SPINLOCK(server_list_lock); static DEFINE_SPINLOCK(smd_lock); static struct workqueue_struct *rpcrouter_workqueue; -static struct wake_lock rpcrouter_wake_lock; static int rpcrouter_need_len; static atomic_t next_xid = ATOMIC_INIT(1); @@ -290,7 +288,6 @@ struct msm_rpc_endpoint *msm_rpcrouter_create_local_endpoint(dev_t dev) init_waitqueue_head(&ept->wait_q); INIT_LIST_HEAD(&ept->read_q); spin_lock_init(&ept->read_q_lock); - wake_lock_init(&ept->read_q_wake_lock, WAKE_LOCK_SUSPEND, "rpc_read"); INIT_LIST_HEAD(&ept->incomplete); spin_lock_irqsave(&local_endpoints_lock, flags); @@ -313,7 +310,6 @@ int msm_rpcrouter_destroy_local_endpoint(struct msm_rpc_endpoint *ept) if (rc < 0) return rc; - wake_lock_destroy(&ept->read_q_wake_lock); list_del(&ept->list); kfree(ept); return 0; @@ -540,8 +536,6 @@ static void rpcrouter_smdnotify(void *_dev, unsigned event) if (event != SMD_EVENT_DATA) return; - if (smd_read_avail(smd_channel) >= rpcrouter_need_len) - wake_lock(&rpcrouter_wake_lock); wake_up(&smd_wait); } @@ -576,7 +570,6 @@ static int rr_read(void *data, int len) return -EIO; } rpcrouter_need_len = len; - wake_unlock(&rpcrouter_wake_lock); spin_unlock_irqrestore(&smd_lock, flags); // printk("rr_read: waiting (%d)\n", len); @@ -676,7 +669,6 @@ static void do_read_data(struct work_struct *work) packet_complete: spin_lock_irqsave(&ept->read_q_lock, flags); - wake_lock(&ept->read_q_wake_lock); list_add_tail(&pkt->list, &ept->read_q); wake_up(&ept->wait_q); spin_unlock_irqrestore(&ept->read_q_lock, flags); @@ -699,7 +691,6 @@ done: fail_io: fail_data: printk(KERN_ERR "rpc_router has died\n"); - wake_unlock(&rpcrouter_wake_lock); } void msm_rpc_setup_req(struct rpc_request_hdr *hdr, uint32_t prog, @@ -1061,8 +1052,6 @@ int __msm_rpc_read(struct msm_rpc_endpoint *ept, return -ETOOSMALL; } list_del(&pkt->list); - if (list_empty(&ept->read_q)) - wake_unlock(&ept->read_q_wake_lock); spin_unlock_irqrestore(&ept->read_q_lock, flags); rc = pkt->length; @@ -1229,7 +1218,6 @@ static int msm_rpcrouter_probe(struct platform_device *pdev) init_waitqueue_head(&newserver_wait); init_waitqueue_head(&smd_wait); - wake_lock_init(&rpcrouter_wake_lock, WAKE_LOCK_SUSPEND, "SMD_RPCCALL"); rpcrouter_workqueue = create_singlethread_workqueue("rpcrouter"); if (!rpcrouter_workqueue) diff --git a/drivers/staging/dream/smd/smd_tty.c b/drivers/staging/dream/smd/smd_tty.c index 2edd9d1ec2dc..f40944958d44 100644 --- a/drivers/staging/dream/smd/smd_tty.c +++ b/drivers/staging/dream/smd/smd_tty.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -34,7 +33,6 @@ static DEFINE_MUTEX(smd_tty_lock); struct smd_tty_info { smd_channel_t *ch; struct tty_struct *tty; - struct wake_lock wake_lock; int open_count; }; @@ -69,7 +67,6 @@ static void smd_tty_notify(void *priv, unsigned event) printk(KERN_ERR "OOPS - smd_tty_buffer mismatch?!"); } - wake_lock_timeout(&info->wake_lock, HZ / 2); tty_flip_buffer_push(tty); } @@ -95,7 +92,6 @@ static int smd_tty_open(struct tty_struct *tty, struct file *f) info = smd_tty + n; mutex_lock(&smd_tty_lock); - wake_lock_init(&info->wake_lock, WAKE_LOCK_SUSPEND, name); tty->driver_data = info; if (info->open_count++ == 0) { @@ -122,7 +118,6 @@ static void smd_tty_close(struct tty_struct *tty, struct file *f) if (--info->open_count == 0) { info->tty = 0; tty->driver_data = 0; - wake_lock_destroy(&info->wake_lock); if (info->ch) { smd_close(info->ch); info->ch = 0; -- GitLab From 3001fa0522b87cbd756896a7ffa30a38fdf7a388 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Sat, 24 Oct 2009 22:01:08 +0200 Subject: [PATCH 142/235] Staging: dream: remove wakelock support from smd_rpcrouter.h wakelocks are power optimalization, not supported in mainline. Remove them so that code compiles on mainline. Signed-off-by: Pavel Machek Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dream/smd/smd_rpcrouter.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/dream/smd/smd_rpcrouter.h b/drivers/staging/dream/smd/smd_rpcrouter.h index a7416a2ec58c..86ab997b1b79 100644 --- a/drivers/staging/dream/smd/smd_rpcrouter.h +++ b/drivers/staging/dream/smd/smd_rpcrouter.h @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -144,7 +143,6 @@ struct msm_rpc_endpoint { /* complete packets waiting to be read */ struct list_head read_q; spinlock_t read_q_lock; - struct wake_lock read_q_wake_lock; wait_queue_head_t wait_q; unsigned flags; -- GitLab From dba0da373d389b9e12bb739d25cbe116dee5f55b Mon Sep 17 00:00:00 2001 From: Mithlesh Thukral Date: Mon, 26 Oct 2009 21:21:39 -0700 Subject: [PATCH 143/235] Staging: otus : checkpatch.pl cleanup for header files Fix for checkpatch.pl errors and warnings in header files of otus driver. (There is a typedef which still remains. Plan to clean it up in next set of patches) Signed-off-by: Mithlesh Thukral Signed-off-by: Greg Kroah-Hartman --- drivers/staging/otus/athr_common.h | 10 +-- drivers/staging/otus/oal_dt.h | 10 +-- drivers/staging/otus/oal_marc.h | 84 +++++++++-------- drivers/staging/otus/usbdrv.h | 140 ++++++++++++++--------------- drivers/staging/otus/zdusb.h | 4 +- 5 files changed, 126 insertions(+), 122 deletions(-) diff --git a/drivers/staging/otus/athr_common.h b/drivers/staging/otus/athr_common.h index 620f78a41d5f..3e32f5b4ac68 100644 --- a/drivers/staging/otus/athr_common.h +++ b/drivers/staging/otus/athr_common.h @@ -68,7 +68,7 @@ #define ZM_WAPI_KEY_SIZE 32 #define ZM_WAPI_IV_LEN 16 -#endif //ZM_ENALBE_WAPI +#endif /* ZM_ENALBE_WAPI */ /* structure definition */ struct athr_wlan_param { @@ -123,7 +123,7 @@ struct athr_wapi_param { u8 key[ZM_WAPI_KEY_SIZE]; } crypt; struct { - u8 wapi_policy; + u8 wapi_policy; } info; } u; }; @@ -132,10 +132,10 @@ struct athr_wapi_sta_info { u16 msg_type; u16 datalen; - u8 sta_mac[ETH_ALEN]; + u8 sta_mac[ETH_ALEN]; u8 reserve_data[2]; - u8 gsn[ZM_WAPI_IV_LEN]; + u8 gsn[ZM_WAPI_IV_LEN]; u8 wie[256]; }; -#endif //ZM_ENALBE_WAPI +#endif /* ZM_ENALBE_WAPI */ #endif diff --git a/drivers/staging/otus/oal_dt.h b/drivers/staging/otus/oal_dt.h index e82b9770fca1..fb6d11a99cc5 100644 --- a/drivers/staging/otus/oal_dt.h +++ b/drivers/staging/otus/oal_dt.h @@ -39,15 +39,15 @@ typedef long s32_t; typedef short s16_t; typedef char s8_t; -#ifndef TRUE -#define TRUE (1==1) +#ifndef TRUE +#define TRUE (1 == 1) #endif -#ifndef FALSE -#define FALSE (1==0) +#ifndef FALSE +#define FALSE (1 == 0) #endif -#ifndef NULL +#ifndef NULL #define NULL 0 #endif diff --git a/drivers/staging/otus/oal_marc.h b/drivers/staging/otus/oal_marc.h index 206111616a03..e7a9081b1a7c 100644 --- a/drivers/staging/otus/oal_marc.h +++ b/drivers/staging/otus/oal_marc.h @@ -34,17 +34,19 @@ /***** Critical section *****/ /* Declare for critical section */ #ifndef ZM_HALPLUS_LOCK -#define zmw_get_wlan_dev(dev) struct zsWlanDev *wd = (struct zsWlanDev*) ((((struct usbdrv_private*)dev->priv)->wd)) +#define zmw_get_wlan_dev(dev) struct zsWlanDev *wd = (struct zsWlanDev *) \ + ((((struct usbdrv_private *)dev->priv)->wd)) #define zmw_declare_for_critical_section() unsigned long irqFlag; /* Enter critical section */ -#define zmw_enter_critical_section(dev) \ - spin_lock_irqsave(&(((struct usbdrv_private *)(dev->priv))->cs_lock), irqFlag); +#define zmw_enter_critical_section(dev) spin_lock_irqsave( \ + &(((struct usbdrv_private *)(dev->priv))->cs_lock), irqFlag); /* leave critical section */ #define zmw_leave_critical_section(dev) \ - spin_unlock_irqrestore(&(((struct usbdrv_private *)(dev->priv))->cs_lock), irqFlag); + spin_unlock_irqrestore(&(((struct usbdrv_private *) \ + (dev->priv))->cs_lock), irqFlag); #else #define zmw_get_wlan_dev(dev) struct zsWlanDev *wd = zfwGetWlanDev(dev); @@ -52,31 +54,29 @@ #define zmw_declare_for_critical_section() /* Enter critical section */ -#define zmw_enter_critical_section(dev) \ - zfwEnterCriticalSection(dev); +#define zmw_enter_critical_section(dev) zfwEnterCriticalSection(dev); /* leave critical section */ -#define zmw_leave_critical_section(dev) \ - zfwLeaveCriticalSection(dev); +#define zmw_leave_critical_section(dev) zfwLeaveCriticalSection(dev); #endif /***** Byte order converting *****/ #ifdef ZM_CONFIG_BIG_ENDIAN -#define zmw_cpu_to_le32(v) (((v & 0xff000000) >> 24) | \ - ((v & 0x00ff0000) >> 8) | \ - ((v & 0x0000ff00) << 8) | \ - ((v & 0x000000ff) << 24)) +#define zmw_cpu_to_le32(v) (((v & 0xff000000) >> 24) | \ + ((v & 0x00ff0000) >> 8) | \ + ((v & 0x0000ff00) << 8) | \ + ((v & 0x000000ff) << 24)) -#define zmw_le32_to_cpu(v) (((v & 0xff000000) >> 24) | \ - ((v & 0x00ff0000) >> 8) | \ - ((v & 0x0000ff00) << 8) | \ - ((v & 0x000000ff) << 24)) +#define zmw_le32_to_cpu(v) (((v & 0xff000000) >> 24) | \ + ((v & 0x00ff0000) >> 8) | \ + ((v & 0x0000ff00) << 8) | \ + ((v & 0x000000ff) << 24)) #define zmw_cpu_to_le16(v) (((v & 0xff00) >> 8) | \ - ((v & 0x00ff) << 8)) + ((v & 0x00ff) << 8)) #define zmw_le16_to_cpu(v) (((v & 0xff00) >> 8) | \ - ((v & 0x00ff) << 8)) + ((v & 0x00ff) << 8)) #else #define zmw_cpu_to_le32(v) (v) #define zmw_le32_to_cpu(v) (v) @@ -88,33 +88,41 @@ /* Called to read/write buffer */ #ifndef ZM_HALPLUS_LOCK -#define zmw_buf_readb(dev, buf, offset) *(u8_t*)((u8_t*)buf->data+offset) -#define zmw_buf_readh(dev, buf, offset) zmw_cpu_to_le16(*(u16_t*)((u8_t*)buf->data+offset)) -#define zmw_buf_writeb(dev, buf, offset, value) *(u8_t*)((u8_t*)buf->data+offset) = value -#define zmw_buf_writeh(dev, buf, offset, value) *(u16_t*)((u8_t*)buf->data+offset) = zmw_cpu_to_le16(value) -#define zmw_buf_get_buffer(dev, buf) (u8_t*)(buf->data) +#define zmw_buf_readb(dev, buf, offset) (*(u8_t *)((u8_t *)buf->data+offset)) +#define zmw_buf_readh(dev, buf, offset) zmw_cpu_to_le16(*(u16_t *) \ + ((u8_t *)buf->data+offset)) +#define zmw_buf_writeb(dev, buf, offset, value) (*(u8_t *) \ + ((u8_t *)buf->data+offset) = value) +#define zmw_buf_writeh(dev, buf, offset, value) (*(u16_t *) \ + ((u8_t *)buf->data+offset) = zmw_cpu_to_le16(value)) +#define zmw_buf_get_buffer(dev, buf) (u8_t *)(buf->data) #else #define zmw_buf_readb(dev, buf, offset) zfwBufReadByte(dev, buf, offset) #define zmw_buf_readh(dev, buf, offset) zfwBufReadHalfWord(dev, buf, offset) -#define zmw_buf_writeb(dev, buf, offset, value) zfwBufWriteByte(dev, buf, offset, value) -#define zmw_buf_writeh(dev, buf, offset, value) zfwBufWriteHalfWord(dev, buf, offset, value) +#define zmw_buf_writeb(dev, buf, offset, value) \ + zfwBufWriteByte(dev, buf, offset, value) +#define zmw_buf_writeh(dev, buf, offset, value) \ + zfwBufWriteHalfWord(dev, buf, offset, value) #define zmw_buf_get_buffer(dev, buf) zfwGetBuffer(dev, buf) #endif /***** Debug message *****/ #if 0 -#define zm_debug_msg0(msg) printk("%s:%s\n", __func__, msg); -#define zm_debug_msg1(msg, val) printk("%s:%s%ld\n", __func__, \ - msg, (u32_t)val); -#define zm_debug_msg2(msg, val) printk("%s:%s%lxh\n", __func__, \ - msg, (u32_t)val); -#define zm_debug_msg_s(msg, val) printk("%s:%s%s\n", __func__, \ - msg, val); -#define zm_debug_msg_p(msg, val1, val2) printk("%s:%s%01ld.%02ld\n", __func__, \ - msg, (val1/val2), (((val1*100)/val2)%100)); +#define zm_debug_msg0(msg) printk(KERN_DEBUG "%s:%s\n", __func__, msg); +#define zm_debug_msg1(msg, val) printk(KERN_DEBUG "%s:%s%ld\n", __func__, \ + msg, (u32_t)val); +#define zm_debug_msg2(msg, val) printk(KERN_DEBUG "%s:%s%lxh\n", __func__, \ + msg, (u32_t)val); +#define zm_debug_msg_s(msg, val) printk(KERN_DEBUG "%s:%s%s\n", __func__, \ + msg, val); +#define zm_debug_msg_p(msg, val1, val2) do { \ + printk(KERN_DEBUG "%s:%s%01ld.%02ld\n", \ + __func__, \ + msg, (val1/val2), (((val1*100)/val2)%100)); + } while (0) #define zm_dbg(S) printk S #else #define zm_debug_msg0(msg) @@ -125,10 +133,10 @@ #define zm_dbg(S) #endif -#define zm_assert(expr) if(!(expr)) { \ - printk( "Atheors Assertion failed! %s,%s,%s,line=%d\n", \ - #expr,__FILE__,__func__,__LINE__); \ - } +#define zm_assert(expr) if (!(expr)) { \ + printk(KERN_ERR "Atheors Assertion failed! %s, %s, %s,line=%d\n",\ + #expr, __FILE__, __func__, __LINE__); \ + } #define DbgPrint printk diff --git a/drivers/staging/otus/usbdrv.h b/drivers/staging/otus/usbdrv.h index 78004062caba..330d1b95cb88 100644 --- a/drivers/staging/otus/usbdrv.h +++ b/drivers/staging/otus/usbdrv.h @@ -45,7 +45,7 @@ #include "oal_dt.h" #include "oal_marc.h" #include "80211core/pub_zfi.h" -//#include "pub_zfw.h" +/* #include "pub_zfw.h" */ #include "80211core/pub_usb.h" #include @@ -86,8 +86,7 @@ struct driver_stats { #define ZM_MAX_RX_URB_NUM 16 #define ZM_MAX_TX_BUF_NUM 128 -typedef struct UsbTxQ -{ +typedef struct UsbTxQ { zbuf_t *buf; u8_t hdr[80]; u16_t hdrlen; @@ -100,17 +99,16 @@ typedef struct UsbTxQ struct zdap_ioctl { - u16_t cmd; /* Command to run */ - u32_t addr; /* Length of the data buffer */ - u32_t value; /* Pointer to the data buffer */ + u16_t cmd; /* Command to run */ + u32_t addr; /* Length of the data buffer */ + u32_t value; /* Pointer to the data buffer */ u8_t data[0x100]; }; #define ZM_OAL_MAX_STA_SUPPORT 16 -struct usbdrv_private -{ - //linux used +struct usbdrv_private { + /* linux used */ struct net_device *device; #if (WLAN_HOSTIF == WLAN_PCI) struct pci_dev *pdev; @@ -121,7 +119,7 @@ struct usbdrv_private #endif struct driver_stats drv_stats; char ifname[IFNAMSIZ]; - int using_dac; + int using_dac; u8_t rev_id; /* adapter PCI revision ID */ rwlock_t isolate_lock; spinlock_t cs_lock; @@ -130,78 +128,76 @@ struct usbdrv_private void *regp; #endif - /* timer for heart beat */ + /* timer for heart beat */ struct timer_list hbTimer10ms; /* For driver core */ - void* wd; + void *wd; #if (WLAN_HOSTIF == WLAN_USB) - u8_t txUsbBuf[ZM_MAX_TX_URB_NUM][ZM_USB_TX_BUF_SIZE]; - u8_t regUsbReadBuf[ZM_USB_REG_MAX_BUF_SIZE]; - u8_t regUsbWriteBuf[ZM_USB_REG_MAX_BUF_SIZE]; + u8_t txUsbBuf[ZM_MAX_TX_URB_NUM][ZM_USB_TX_BUF_SIZE]; + u8_t regUsbReadBuf[ZM_USB_REG_MAX_BUF_SIZE]; + u8_t regUsbWriteBuf[ZM_USB_REG_MAX_BUF_SIZE]; urb_t *WlanTxDataUrb[ZM_MAX_TX_URB_NUM]; urb_t *WlanRxDataUrb[ZM_MAX_RX_URB_NUM]; urb_t *RegOutUrb; urb_t *RegInUrb; - UsbTxQ_t UsbTxBufQ[ZM_MAX_TX_BUF_NUM]; - zbuf_t *UsbRxBufQ[ZM_MAX_RX_URB_NUM]; - u16_t TxBufHead; - u16_t TxBufTail; - u16_t TxBufCnt; - u16_t TxUrbHead; - u16_t TxUrbTail; - u16_t TxUrbCnt; - u16_t RxBufHead; - u16_t RxBufTail; - u16_t RxBufCnt; + UsbTxQ_t UsbTxBufQ[ZM_MAX_TX_BUF_NUM]; + zbuf_t *UsbRxBufQ[ZM_MAX_RX_URB_NUM]; + u16_t TxBufHead; + u16_t TxBufTail; + u16_t TxBufCnt; + u16_t TxUrbHead; + u16_t TxUrbTail; + u16_t TxUrbCnt; + u16_t RxBufHead; + u16_t RxBufTail; + u16_t RxBufCnt; #endif #if ZM_USB_STREAM_MODE == 1 - zbuf_t *reamin_buf; + zbuf_t *reamin_buf; #endif #ifdef ZM_HOSTAPD_SUPPORT - struct athr_wlan_param athr_wpa_req; + struct athr_wlan_param athr_wpa_req; #endif - struct sock *netlink_sk; - u8_t DeviceOpened; //CWYang(+) - u8_t supIe[50]; - u8_t supLen; - struct ieee80211req_wpaie stawpaie[ZM_OAL_MAX_STA_SUPPORT]; - u8_t forwardMgmt; - - struct zfCbUsbFuncTbl usbCbFunctions; - - /* For keventd */ - u32_t flags; - unsigned long kevent_flags; - u16_t kevent_ready; - - struct semaphore ioctl_sem; - struct work_struct kevent; - wait_queue_head_t wait_queue_event; + struct sock *netlink_sk; + u8_t DeviceOpened; /* CWYang(+) */ + u8_t supIe[50]; + u8_t supLen; + struct ieee80211req_wpaie stawpaie[ZM_OAL_MAX_STA_SUPPORT]; + u8_t forwardMgmt; + + struct zfCbUsbFuncTbl usbCbFunctions; + + /* For keventd */ + u32_t flags; + unsigned long kevent_flags; + u16_t kevent_ready; + + struct semaphore ioctl_sem; + struct work_struct kevent; + wait_queue_head_t wait_queue_event; #ifdef ZM_HALPLUS_LOCK - unsigned long hal_irqFlag; + unsigned long hal_irqFlag; #endif - u16_t adapterState; + u16_t adapterState; }; /* WDS */ #define ZM_WDS_PORT_NUMBER 6 -struct zsWdsStruct -{ - struct net_device* dev; +struct zsWdsStruct { + struct net_device *dev; u16_t openFlag; }; /* VAP */ #define ZM_VAP_PORT_NUMBER 7 -struct zsVapStruct -{ - struct net_device* dev; +struct zsVapStruct { + struct net_device *dev; u16_t openFlag; }; @@ -215,25 +211,25 @@ struct zsVapStruct #define ZM_IOCTL_RXD_DUMP 0x07 #define ZM_IOCTL_MEM_READ 0x0B #define ZM_IOCTL_MEM_WRITE 0x0C -#define ZM_IOCTL_DMA_TEST 0x10 -#define ZM_IOCTL_REG_TEST 0x11 -#define ZM_IOCTL_TEST 0x80 -#define ZM_IOCTL_TALLY 0x81 //CWYang(+) -#define ZM_IOCTL_RTS 0xA0 -#define ZM_IOCTL_MIX_MODE 0xA1 -#define ZM_IOCTL_FRAG 0xA2 -#define ZM_IOCTL_SCAN 0xA3 -#define ZM_IOCTL_KEY 0xA4 -#define ZM_IOCTL_RATE 0xA5 -#define ZM_IOCTL_ENCRYPTION_MODE 0xA6 -#define ZM_IOCTL_GET_TXCNT 0xA7 -#define ZM_IOCTL_GET_DEAGG_CNT 0xA8 -#define ZM_IOCTL_DURATION_MODE 0xA9 -#define ZM_IOCTL_SET_AES_KEY 0xAA -#define ZM_IOCTL_SET_AES_MODE 0xAB -#define ZM_IOCTL_SIGNAL_STRENGTH 0xAC //CWYang(+) -#define ZM_IOCTL_SIGNAL_QUALITY 0xAD //CWYang(+) -#define ZM_IOCTL_SET_PIBSS_MODE 0xAE +#define ZM_IOCTL_DMA_TEST 0x10 +#define ZM_IOCTL_REG_TEST 0x11 +#define ZM_IOCTL_TEST 0x80 +#define ZM_IOCTL_TALLY 0x81 /* CWYang(+) */ +#define ZM_IOCTL_RTS 0xA0 +#define ZM_IOCTL_MIX_MODE 0xA1 +#define ZM_IOCTL_FRAG 0xA2 +#define ZM_IOCTL_SCAN 0xA3 +#define ZM_IOCTL_KEY 0xA4 +#define ZM_IOCTL_RATE 0xA5 +#define ZM_IOCTL_ENCRYPTION_MODE 0xA6 +#define ZM_IOCTL_GET_TXCNT 0xA7 +#define ZM_IOCTL_GET_DEAGG_CNT 0xA8 +#define ZM_IOCTL_DURATION_MODE 0xA9 +#define ZM_IOCTL_SET_AES_KEY 0xAA +#define ZM_IOCTL_SET_AES_MODE 0xAB +#define ZM_IOCTL_SIGNAL_STRENGTH 0xAC /* CWYang(+) */ +#define ZM_IOCTL_SIGNAL_QUALITY 0xAD /* CWYang(+) */ +#define ZM_IOCTL_SET_PIBSS_MODE 0xAE #define ZDAPIOCTL SIOCDEVPRIVATE diff --git a/drivers/staging/otus/zdusb.h b/drivers/staging/otus/zdusb.h index 9f8ab2e96169..97e4ef09567a 100644 --- a/drivers/staging/otus/zdusb.h +++ b/drivers/staging/otus/zdusb.h @@ -34,10 +34,10 @@ #define VERSIONID "0.0.0.999" /* Define these values to match your device */ -#define VENDOR_ATHR 0x0CF3 //Atheros +#define VENDOR_ATHR 0x0CF3 /* Atheros */ #define PRODUCT_AR9170 0x9170 -#define VENDOR_DLINK 0x07D1 //Dlink +#define VENDOR_DLINK 0x07D1 /* Dlink */ #define PRODUCT_DWA160A 0x3C10 #define VENDOR_NETGEAR 0x0846 /* NetGear */ -- GitLab From b767fa1d110230f342243034e285ceadcbbb709e Mon Sep 17 00:00:00 2001 From: Mithlesh Thukral Date: Mon, 26 Oct 2009 21:22:20 -0700 Subject: [PATCH 144/235] Staging: otus : checkpatch.pl cleanup for .c files First patch for checkpatch.pl error and warning fixes for .c files of otus driver in staging tree. Signed-off-by: Mithlesh Thukral Signed-off-by: Greg Kroah-Hartman --- drivers/staging/otus/apdbg.c | 667 +++++++++++++++----------------- drivers/staging/otus/wrap_dbg.c | 61 ++- drivers/staging/otus/wrap_mem.c | 90 +++-- 3 files changed, 384 insertions(+), 434 deletions(-) diff --git a/drivers/staging/otus/apdbg.c b/drivers/staging/otus/apdbg.c index d3e2f6224196..0eb93f19958a 100644 --- a/drivers/staging/otus/apdbg.c +++ b/drivers/staging/otus/apdbg.c @@ -38,39 +38,39 @@ #include -#define ZM_IOCTL_REG_READ 0x01 -#define ZM_IOCTL_REG_WRITE 0x02 -#define ZM_IOCTL_MEM_DUMP 0x03 -#define ZM_IOCTL_REG_DUMP 0x05 -#define ZM_IOCTL_TXD_DUMP 0x06 -#define ZM_IOCTL_RXD_DUMP 0x07 -#define ZM_IOCTL_MEM_READ 0x0B -#define ZM_IOCTL_MEM_WRITE 0x0C -#define ZM_IOCTL_DMA_TEST 0x10 -#define ZM_IOCTL_REG_TEST 0x11 -#define ZM_IOCTL_TEST 0x80 -#define ZM_IOCTL_TALLY 0x81 //CWYang(+) -#define ZM_IOCTL_RTS 0xA0 -#define ZM_IOCTL_MIX_MODE 0xA1 -#define ZM_IOCTL_FRAG 0xA2 -#define ZM_IOCTL_SCAN 0xA3 -#define ZM_IOCTL_KEY 0xA4 -#define ZM_IOCTL_RATE 0xA5 -#define ZM_IOCTL_ENCRYPTION_MODE 0xA6 -#define ZM_IOCTL_GET_TXCNT 0xA7 -#define ZM_IOCTL_GET_DEAGG_CNT 0xA8 -#define ZM_IOCTL_DURATION_MODE 0xA9 -#define ZM_IOCTL_SET_AES_KEY 0xAA -#define ZM_IOCTL_SET_AES_MODE 0xAB -#define ZM_IOCTL_SIGNAL_STRENGTH 0xAC //CWYang(+) -#define ZM_IOCTL_SIGNAL_QUALITY 0xAD //CWYang(+) -#define ZM_IOCTL_SET_PIBSS_MODE 0xAE -#define ZDAPIOCTL SIOCDEVPRIVATE +#define ZM_IOCTL_REG_READ 0x01 +#define ZM_IOCTL_REG_WRITE 0x02 +#define ZM_IOCTL_MEM_DUMP 0x03 +#define ZM_IOCTL_REG_DUMP 0x05 +#define ZM_IOCTL_TXD_DUMP 0x06 +#define ZM_IOCTL_RXD_DUMP 0x07 +#define ZM_IOCTL_MEM_READ 0x0B +#define ZM_IOCTL_MEM_WRITE 0x0C +#define ZM_IOCTL_DMA_TEST 0x10 +#define ZM_IOCTL_REG_TEST 0x11 +#define ZM_IOCTL_TEST 0x80 +#define ZM_IOCTL_TALLY 0x81 /* CWYang(+) */ +#define ZM_IOCTL_RTS 0xA0 +#define ZM_IOCTL_MIX_MODE 0xA1 +#define ZM_IOCTL_FRAG 0xA2 +#define ZM_IOCTL_SCAN 0xA3 +#define ZM_IOCTL_KEY 0xA4 +#define ZM_IOCTL_RATE 0xA5 +#define ZM_IOCTL_ENCRYPTION_MODE 0xA6 +#define ZM_IOCTL_GET_TXCNT 0xA7 +#define ZM_IOCTL_GET_DEAGG_CNT 0xA8 +#define ZM_IOCTL_DURATION_MODE 0xA9 +#define ZM_IOCTL_SET_AES_KEY 0xAA +#define ZM_IOCTL_SET_AES_MODE 0xAB +#define ZM_IOCTL_SIGNAL_STRENGTH 0xAC /* CWYang(+) */ +#define ZM_IOCTL_SIGNAL_QUALITY 0xAD /* CWYang(+) */ +#define ZM_IOCTL_SET_PIBSS_MODE 0xAE +#define ZDAPIOCTL SIOCDEVPRIVATE struct zdap_ioctl { - unsigned short cmd; /* Command to run */ - unsigned int addr; /* Length of the data buffer */ - unsigned int value; /* Pointer to the data buffer */ + unsigned short cmd; /* Command to run */ + unsigned int addr; /* Length of the data buffer */ + unsigned int value; /* Pointer to the data buffer */ unsigned char data[0x100]; }; @@ -79,13 +79,13 @@ struct zdap_ioctl { #if 0 #define SKIP_ELEM { \ - while(isxdigit(*p)) \ - p++; \ + while (isxdigit(*p)) \ + p++; \ } #define SKIP_DELIMETER { \ - if(*p == ':' || *p == ' ') \ - p++; \ + if (*p == ':' || *p == ' ') \ + p++; \ } #endif @@ -97,361 +97,308 @@ char *prgname; int set_ioctl(int sock, struct ifreq *req) { - if (ioctl(sock, ZDAPIOCTL, req) < 0) { - fprintf(stderr, "%s: ioctl(SIOCGIFMAP): %s\n", - prgname, strerror(errno)); - return -1; - } + if (ioctl(sock, ZDAPIOCTL, req) < 0) { + fprintf(stderr, "%s: ioctl(SIOCGIFMAP): %s\n", + prgname, strerror(errno)); + return -1; + } - return 0; + return 0; } int read_reg(int sock, struct ifreq *req) { - struct zdap_ioctl *zdreq = 0; + struct zdap_ioctl *zdreq = 0; - if (!set_ioctl(sock, req)) - return -1; + if (!set_ioctl(sock, req)) + return -1; - //zdreq = (struct zdap_ioctl *)req->ifr_data; - //printf( "reg = %4x, value = %4x\n", zdreq->addr, zdreq->value); + /* + * zdreq = (struct zdap_ioctl *)req->ifr_data; + * printf( "reg = %4x, value = %4x\n", zdreq->addr, zdreq->value); + */ - return 0; + return 0; } int read_mem(int sock, struct ifreq *req) { - struct zdap_ioctl *zdreq = 0; - int i; - - if (!set_ioctl(sock, req)) - return -1; - - /*zdreq = (struct zdap_ioctl *)req->ifr_data; - printf( "dump mem from %x, length = %x\n", zdreq->addr, zdreq->value); - - for (i=0; ivalue; i++) { - printf("%02x", zdreq->data[i]); - printf(" "); - - if ((i>0) && ((i+1)%16 == 0)) - printf("\n"); - }*/ - - return 0; + struct zdap_ioctl *zdreq = 0; + int i; + + if (!set_ioctl(sock, req)) + return -1; + + /* + * zdreq = (struct zdap_ioctl *)req->ifr_data; + * printf("dump mem from %x, length = %x\n", zdreq->addr, zdreq->value); + * + * for (i=0; ivalue; i++) { + * printf("%02x", zdreq->data[i]); + * printf(" "); + * + * if ((i>0) && ((i+1)%16 == 0)) + * printf("\n"); + * } + */ + + return 0; } int main(int argc, char **argv) { - int sock; - int addr, value; - struct ifreq req; - char *action = NULL; - struct zdap_ioctl zdreq; - - prgname = argv[0]; - - if (argc < 3) { - fprintf(stderr,"%s: usage is \"%s [
] []\"\n", - prgname, prgname); - fprintf(stderr,"valid operation: read, write, mem, reg,\n"); - fprintf(stderr," : txd, rxd, rmem, wmem\n"); - fprintf(stderr," : dmat, regt, test\n"); - - fprintf(stderr," scan, Channel Scan\n"); - fprintf(stderr," rts , Set RTS Threshold\n"); - fprintf(stderr," frag , Set Fragment Threshold\n"); - fprintf(stderr," rate <0-28>, 0:AUTO, 1-4:CCK, 5-12:OFDM, 13-28:HT\n"); - fprintf(stderr," TBD mix <0 or 1>, Set 1 to enable mixed mode\n"); - fprintf(stderr," enc, <0-3>, 0=>OPEN, 1=>WEP64, 2=>WEP128, 3=>WEP256\n"); - fprintf(stderr," skey , Set WEP key\n"); - fprintf(stderr," txcnt, Get TxQ Cnt\n"); - fprintf(stderr," dagcnt, Get Deaggregate Cnt\n"); - fprintf(stderr," durmode , Set Duration Mode 0=>HW, 1=>SW\n"); - fprintf(stderr," aeskey \n"); - fprintf(stderr," aesmode \n"); - fprintf(stderr," wlanmode <0,1> 0:Station mode, 1:PIBSS mode\n"); - fprintf(stderr," tal <0,1>, Get Current Tally Info, 0=>read, 1=>read and reset\n"); - - exit(1); - } - - strcpy(req.ifr_name, argv[1]); - zdreq.addr = 0; - zdreq.value = 0; - - /* a silly raw socket just for ioctl()ling it */ - sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); - if (sock < 0) { - fprintf(stderr, "%s: socket(): %s\n", argv[0], strerror(errno)); - exit(1); - } - - if (argc >= 4) - { - sscanf(argv[3], "%x", &addr); - } - - if (argc >= 5) - { - sscanf(argv[4], "%x", &value); - } - - zdreq.addr = addr; - zdreq.value = value; - - if (!strcmp(argv[2], "read")) - { - zdreq.cmd = ZM_IOCTL_REG_READ; - } - else if (!strcmp(argv[2], "mem")) - { - zdreq.cmd = ZM_IOCTL_MEM_DUMP; - } - else if (!strcmp(argv[2], "write")) - { - zdreq.cmd = ZM_IOCTL_REG_WRITE; - } - else if (!strcmp(argv[2], "reg")) - { - zdreq.cmd = ZM_IOCTL_REG_DUMP; - } - else if (!strcmp(argv[2], "txd")) - { - zdreq.cmd = ZM_IOCTL_TXD_DUMP; - } - else if (!strcmp(argv[2], "rxd")) - { - zdreq.cmd = ZM_IOCTL_RXD_DUMP; - } - else if (!strcmp(argv[2], "rmem")) - { - zdreq.cmd = ZM_IOCTL_MEM_READ; - } - else if (!strcmp(argv[2], "wmem")) - { - zdreq.cmd = ZM_IOCTL_MEM_WRITE; - } - else if (!strcmp(argv[2], "dmat")) - { - zdreq.cmd = ZM_IOCTL_DMA_TEST; - } - else if (!strcmp(argv[2], "regt")) - { - zdreq.cmd = ZM_IOCTL_REG_TEST; - } - else if (!strcmp(argv[2], "test")) - { - zdreq.cmd = ZM_IOCTL_TEST; - } - else if (!strcmp(argv[2], "tal")) - { - sscanf(argv[3], "%d", &addr); - zdreq.addr = addr; - zdreq.cmd = ZM_IOCTL_TALLY; - } - else if (!strcmp(argv[2], "rts")) - { - sscanf(argv[3], "%d", &addr); - zdreq.addr = addr; - zdreq.cmd = ZM_IOCTL_RTS; - } - else if (!strcmp(argv[2], "mix")) - { - zdreq.cmd = ZM_IOCTL_MIX_MODE; - } - else if (!strcmp(argv[2], "frag")) - { - sscanf(argv[3], "%d", &addr); - zdreq.addr = addr; - zdreq.cmd = ZM_IOCTL_FRAG; - } - else if (!strcmp(argv[2], "scan")) - { - zdreq.cmd = ZM_IOCTL_SCAN; - } - else if (!strcmp(argv[2], "skey")) - { - zdreq.cmd = ZM_IOCTL_KEY; - - if (argc >= 4) - { - unsigned char temp[29]; - int i; - int keyLen; - int encType; - - keyLen = strlen(argv[3]); - - if (keyLen == 10) - { - sscanf(argv[3], "%02x%02x%02x%02x%02x", &temp[0], &temp[1], - &temp[2], &temp[3], &temp[4]); - } - else if (keyLen == 26) - { - sscanf(argv[3], "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", - &temp[0], &temp[1], &temp[2], &temp[3], &temp[4], - &temp[5], &temp[6], &temp[7], &temp[8], &temp[9], - &temp[10], &temp[11], &temp[12]); - } - else if (keyLen == 58) - { - sscanf(argv[3], "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", - &temp[0], &temp[1], &temp[2], &temp[3], &temp[4], - &temp[5], &temp[6], &temp[7], &temp[8], &temp[9], - &temp[10], &temp[11], &temp[12], &temp[13], &temp[14], - &temp[15], &temp[16], &temp[17], &temp[18], &temp[19], - &temp[20], &temp[21], &temp[22], &temp[23], &temp[24], - &temp[25], &temp[26], &temp[27], &temp[28]); - } - else - { - fprintf(stderr, "Invalid key length\n"); - exit(1); - } - zdreq.addr = keyLen/2; - - for(i=0; i 28) - { - fprintf(stderr, "Invalid rate, range:0~28\n"); - exit(1); - } - zdreq.addr = addr; - zdreq.cmd = ZM_IOCTL_RATE; - } - else if (!strcmp(argv[2], "enc")) - { - sscanf(argv[3], "%d", &addr); - - if (addr > 3) - { - fprintf(stderr, "Invalid encryption mode, range:0~3\n"); - exit(1); - } - - if (addr == 2) - { - addr = 5; - } - else if (addr == 3) - { - addr = 6; - } - - zdreq.addr = addr; - zdreq.cmd = ZM_IOCTL_ENCRYPTION_MODE; - } - else if (!strcmp(argv[2], "txcnt")) - { - zdreq.cmd = ZM_IOCTL_GET_TXCNT; - } - else if (!strcmp(argv[2], "dagcnt")) - { - sscanf(argv[3], "%d", &addr); - - if (addr != 0 && addr != 1) - { - fprintf(stderr, "The value should be 0 or 1\n"); - exit(0); - } - - zdreq.addr = addr; - zdreq.cmd = ZM_IOCTL_GET_DEAGG_CNT; - } - else if (!strcmp(argv[2], "durmode")) - { - sscanf(argv[3], "%d", &addr); - - if (addr != 0 && addr != 1) - { - fprintf(stderr, "The Duration mode should be 0 or 1\n"); - exit(0); - } - - zdreq.addr = addr; - zdreq.cmd = ZM_IOCTL_DURATION_MODE; - } - else if (!strcmp(argv[2], "aeskey")) - { - unsigned char temp[16]; - int i; - - sscanf(argv[3], "%d", &addr); - - sscanf(argv[4], "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", &temp[0], &temp[1], &temp[2], &temp[3], &temp[4], &temp[5], &temp[6], &temp[7], &temp[8], &temp[9], &temp[10], &temp[11], &temp[12], &temp[13], &temp[14], &temp[15]); - - for(i = 0; i < 16; i++) - { - zdreq.data[i] = temp[i]; - } - - zdreq.addr = addr; - zdreq.cmd = ZM_IOCTL_SET_AES_KEY; - } - else if (!strcmp(argv[2], "aesmode")) - { - sscanf(argv[3], "%d", &addr); - - zdreq.addr = addr; - zdreq.cmd = ZM_IOCTL_SET_AES_MODE; - } - else if (!strcmp(argv[2], "wlanmode")) - { - sscanf(argv[3], "%d", &addr); - - zdreq.addr = addr; - zdreq.cmd = ZM_IOCTL_SET_PIBSS_MODE; - } - else - { - fprintf(stderr, "error action\n"); - exit(1); - } - - req.ifr_data = (char *)&zdreq; - set_ioctl(sock, &req); + int sock; + int addr, value; + struct ifreq req; + char *action = NULL; + struct zdap_ioctl zdreq; + + prgname = argv[0]; + + if (argc < 3) { + fprintf(stderr, "%s: usage is \"%s " + "[
] []\"\n", prgname, prgname); + fprintf(stderr, "valid operation : read, write, mem, reg, \n"); + fprintf(stderr, " : txd, rxd, rmem, wmem\n"); + fprintf(stderr, " : dmat, regt, test\n"); + + fprintf(stderr, " scan, Channel Scan\n"); + fprintf(stderr, " rts , Set RTS Threshold\n"); + fprintf(stderr, " frag , Set Fragment" + " Threshold\n"); + fprintf(stderr, " rate <0-28>, 0:AUTO, 1-4:CCK," + " 5-12:OFDM, 13-28:HT\n"); + fprintf(stderr, " TBD mix <0 or 1>, Set 1 to enable" + " mixed mode\n"); + fprintf(stderr, " enc, <0-3>, 0=>OPEN, 1=>WEP64, " + "2=>WEP128, 3=>WEP256\n"); + fprintf(stderr, " skey , Set WEP key\n"); + fprintf(stderr, " txcnt, Get TxQ Cnt\n"); + fprintf(stderr, " dagcnt, Get Deaggregate Cnt\n"); + fprintf(stderr, " durmode , Set Duration Mode " + "0=>HW, 1=>SW\n"); + fprintf(stderr, " aeskey \n"); + fprintf(stderr, " aesmode \n"); + fprintf(stderr, " wlanmode <0,1> 0:Station mode, " + "1:PIBSS mode\n"); + fprintf(stderr, " tal <0,1>, Get Current Tally Info, " + "0=>read, 1=>read and reset\n"); + + exit(1); + } + + strcpy(req.ifr_name, argv[1]); + zdreq.addr = 0; + zdreq.value = 0; + + /* a silly raw socket just for ioctl()ling it */ + sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); + if (sock < 0) { + fprintf(stderr, "%s: socket(): %s\n", argv[0], strerror(errno)); + exit(1); + } + + if (argc >= 4) + sscanf(argv[3], "%x", &addr); + + if (argc >= 5) + sscanf(argv[4], "%x", &value); + + zdreq.addr = addr; + zdreq.value = value; + + if (!strcmp(argv[2], "read")) + zdreq.cmd = ZM_IOCTL_REG_READ; + else if (!strcmp(argv[2], "mem")) + zdreq.cmd = ZM_IOCTL_MEM_DUMP; + else if (!strcmp(argv[2], "write")) + zdreq.cmd = ZM_IOCTL_REG_WRITE; + else if (!strcmp(argv[2], "reg")) + zdreq.cmd = ZM_IOCTL_REG_DUMP; + else if (!strcmp(argv[2], "txd")) + zdreq.cmd = ZM_IOCTL_TXD_DUMP; + else if (!strcmp(argv[2], "rxd")) + zdreq.cmd = ZM_IOCTL_RXD_DUMP; + else if (!strcmp(argv[2], "rmem")) + zdreq.cmd = ZM_IOCTL_MEM_READ; + else if (!strcmp(argv[2], "wmem")) + zdreq.cmd = ZM_IOCTL_MEM_WRITE; + else if (!strcmp(argv[2], "dmat")) + zdreq.cmd = ZM_IOCTL_DMA_TEST; + else if (!strcmp(argv[2], "regt")) + zdreq.cmd = ZM_IOCTL_REG_TEST; + else if (!strcmp(argv[2], "test")) + zdreq.cmd = ZM_IOCTL_TEST; + else if (!strcmp(argv[2], "tal")) { + sscanf(argv[3], "%d", &addr); + zdreq.addr = addr; + zdreq.cmd = ZM_IOCTL_TALLY; + } else if (!strcmp(argv[2], "rts")) { + sscanf(argv[3], "%d", &addr); + zdreq.addr = addr; + zdreq.cmd = ZM_IOCTL_RTS; + } else if (!strcmp(argv[2], "mix")) { + zdreq.cmd = ZM_IOCTL_MIX_MODE; + } else if (!strcmp(argv[2], "frag")) { + sscanf(argv[3], "%d", &addr); + zdreq.addr = addr; + zdreq.cmd = ZM_IOCTL_FRAG; + } else if (!strcmp(argv[2], "scan")) { + zdreq.cmd = ZM_IOCTL_SCAN; + } else if (!strcmp(argv[2], "skey")) { + zdreq.cmd = ZM_IOCTL_KEY; + + if (argc >= 4) { + unsigned char temp[29]; + int i; + int keyLen; + int encType; + + keyLen = strlen(argv[3]); + + if (keyLen == 10) + sscanf(argv[3], "%02x%02x%02x%02x%02x", + &temp[0], &temp[1], &temp[2], &temp[3], + &temp[4]); + else if (keyLen == 26) + sscanf(argv[3], "%02x%02x%02x%02x%02x%02x" + "%02x%02x%02x%02x%02x%02x%02x", + &temp[0], &temp[1], &temp[2], &temp[3], + &temp[4], &temp[5], &temp[6], &temp[7], + &temp[8], &temp[9], &temp[10], + &temp[11], &temp[12]); + else if (keyLen == 58) + sscanf(argv[3], "%02x%02x%02x%02x%02x%02x" + "%02x%02x%02x%02x%02x%02x%02x%02x%02x" + "%02x%02x%02x%02x%02x%02x%02x%02x%02x" + "%02x%02x%02x%02x%02x", + &temp[0], &temp[1], &temp[2], &temp[3], + &temp[4], &temp[5], &temp[6], &temp[7], + &temp[8], &temp[9], &temp[10], + &temp[11], &temp[12], &temp[13], + &temp[14], &temp[15], &temp[16], + &temp[17], &temp[18], &temp[19], + &temp[20], &temp[21], &temp[22], + &temp[23], &temp[24], &temp[25], + &temp[26], &temp[27], &temp[28]); + else { + fprintf(stderr, "Invalid key length\n"); + exit(1); + } + zdreq.addr = keyLen/2; + + for (i = 0; i < zdreq.addr; i++) + zdreq.data[i] = temp[i]; + } else { + printf("Error : Key required!\n"); + } + } else if (!strcmp(argv[2], "rate")) { + sscanf(argv[3], "%d", &addr); + + if (addr > 28) { + fprintf(stderr, "Invalid rate, range:0~28\n"); + exit(1); + } + zdreq.addr = addr; + zdreq.cmd = ZM_IOCTL_RATE; + } else if (!strcmp(argv[2], "enc")) { + sscanf(argv[3], "%d", &addr); + + if (addr > 3) { + fprintf(stderr, "Invalid encryption mode, range:0~3\n"); + exit(1); + } + + if (addr == 2) + addr = 5; + else if (addr == 3) + addr = 6; + + zdreq.addr = addr; + zdreq.cmd = ZM_IOCTL_ENCRYPTION_MODE; + } else if (!strcmp(argv[2], "txcnt")) { + zdreq.cmd = ZM_IOCTL_GET_TXCNT; + } else if (!strcmp(argv[2], "dagcnt")) { + sscanf(argv[3], "%d", &addr); + + if (addr != 0 && addr != 1) { + fprintf(stderr, "The value should be 0 or 1\n"); + exit(0); + } + + zdreq.addr = addr; + zdreq.cmd = ZM_IOCTL_GET_DEAGG_CNT; + } else if (!strcmp(argv[2], "durmode")) { + sscanf(argv[3], "%d", &addr); + + if (addr != 0 && addr != 1) { + fprintf(stderr, "The Duration mode should be 0 or 1\n"); + exit(0); + } + + zdreq.addr = addr; + zdreq.cmd = ZM_IOCTL_DURATION_MODE; + } else if (!strcmp(argv[2], "aeskey")) { + unsigned char temp[16]; + int i; + + sscanf(argv[3], "%d", &addr); + + sscanf(argv[4], "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" + "%02x%02x%02x%02x%02x%02x", &temp[0], &temp[1], + &temp[2], &temp[3], &temp[4], &temp[5], &temp[6], + &temp[7], &temp[8], &temp[9], &temp[10], &temp[11], + &temp[12], &temp[13], &temp[14], &temp[15]); + + for (i = 0; i < 16; i++) + zdreq.data[i] = temp[i]; + + zdreq.addr = addr; + zdreq.cmd = ZM_IOCTL_SET_AES_KEY; + } else if (!strcmp(argv[2], "aesmode")) { + sscanf(argv[3], "%d", &addr); + + zdreq.addr = addr; + zdreq.cmd = ZM_IOCTL_SET_AES_MODE; + } else if (!strcmp(argv[2], "wlanmode")) { + sscanf(argv[3], "%d", &addr); + + zdreq.addr = addr; + zdreq.cmd = ZM_IOCTL_SET_PIBSS_MODE; + } else { + fprintf(stderr, "error action\n"); + exit(1); + } + + req.ifr_data = (char *)&zdreq; + set_ioctl(sock, &req); fail: - exit(0); + exit(0); } unsigned char asctohex(char *str) { - unsigned char value; + unsigned char value; - value = hex(*str) & 0x0f; - value = value << 4; - str++; - value |= hex(*str) & 0x0f; + value = hex(*str) & 0x0f; + value = value << 4; + str++; + value |= hex(*str) & 0x0f; - return value; + return value; } char hex(char v) { - if(isdigit(v)) - return v - '0'; - else if(isxdigit(v)) - return (tolower(v) - 'a' + 10); - else - return 0; + if (isdigit(v)) + return v - '0'; + else if (isxdigit(v)) + return tolower(v) - 'a' + 10; + else + return 0; } diff --git a/drivers/staging/otus/wrap_dbg.c b/drivers/staging/otus/wrap_dbg.c index d47e9ab9179a..ee0ee1532601 100644 --- a/drivers/staging/otus/wrap_dbg.c +++ b/drivers/staging/otus/wrap_dbg.c @@ -29,70 +29,67 @@ #include #include -void zfwDumpBuf(zdev_t* dev, zbuf_t* buf) +void zfwDumpBuf(zdev_t *dev, zbuf_t *buf) { - u16_t i; - - for (i=0; ilen; i++) - { - printk("%02x ", *(((u8_t*)buf->data)+i)); - if ((i&0xf)==0xf) - { - printk("\n"); - } - } - printk("\n"); + u16_t i; + + for (i = 0; i < buf->len; i++) { + printk(KERN_DEBUG "%02x ", *(((u8_t *)buf->data)+i)); + if ((i & 0xf) == 0xf) + printk(KERN_DEBUG "\n"); + } + printk(KERN_DEBUG "\n"); } -void zfwDbgReadRegDone(zdev_t* dev, u32_t addr, u32_t val) +void zfwDbgReadRegDone(zdev_t *dev, u32_t addr, u32_t val) { - printk("Read addr:%x = %x\n", addr, val); + printk(KERN_DEBUG "Read addr:%x = %x\n", addr, val); } -void zfwDbgWriteRegDone(zdev_t* dev, u32_t addr, u32_t val) +void zfwDbgWriteRegDone(zdev_t *dev, u32_t addr, u32_t val) { - printk("Write addr:%x = %x\n", addr, val); + printk(KERN_DEBUG "Write addr:%x = %x\n", addr, val); } -void zfwDbgReadTallyDone(zdev_t* dev) +void zfwDbgReadTallyDone(zdev_t *dev) { - //printk("Read Tall Done\n"); + /* printk(KERN_DEBUG "Read Tall Done\n"); */ } -void zfwDbgWriteEepromDone(zdev_t* dev, u32_t addr, u32_t val) +void zfwDbgWriteEepromDone(zdev_t *dev, u32_t addr, u32_t val) { } -void zfwDbgQueryHwTxBusyDone(zdev_t* dev, u32_t val) +void zfwDbgQueryHwTxBusyDone(zdev_t *dev, u32_t val) { } -//For Evl ++ -void zfwDbgReadFlashDone(zdev_t* dev, u32_t addr, u32_t* rspdata, u32_t datalen) +/* For Evl ++ */ +void zfwDbgReadFlashDone(zdev_t *dev, u32_t addr, u32_t *rspdata, u32_t datalen) { - printk("Read Flash addr:%x length:%x\n", addr, datalen); + printk(KERN_DEBUG "Read Flash addr:%x length:%x\n", addr, datalen); } -void zfwDbgProgrameFlashDone(zdev_t* dev) +void zfwDbgProgrameFlashDone(zdev_t *dev) { - printk("Program Flash Done\n"); + printk(KERN_DEBUG "Program Flash Done\n"); } -void zfwDbgProgrameFlashChkDone(zdev_t* dev) +void zfwDbgProgrameFlashChkDone(zdev_t *dev) { - printk("Program Flash Done\n"); + printk(KERN_DEBUG "Program Flash Done\n"); } -void zfwDbgGetFlashChkSumDone(zdev_t* dev, u32_t* rspdata) +void zfwDbgGetFlashChkSumDone(zdev_t *dev, u32_t *rspdata) { - printk("Get Flash ChkSum Done\n"); + printk(KERN_DEBUG "Get Flash ChkSum Done\n"); } -void zfwDbgDownloadFwInitDone(zdev_t* dev) +void zfwDbgDownloadFwInitDone(zdev_t *dev) { - printk("Download FW Init Done\n"); + printk(KERN_DEBUG "Download FW Init Done\n"); } -//For Evl -- +/* For Evl -- */ /* Leave an empty line below to remove warning message on some compiler */ diff --git a/drivers/staging/otus/wrap_mem.c b/drivers/staging/otus/wrap_mem.c index 32416d77a471..47cbce1346a9 100644 --- a/drivers/staging/otus/wrap_mem.c +++ b/drivers/staging/otus/wrap_mem.c @@ -30,69 +30,75 @@ #include /* Memory management */ -/* Called to allocate uncached memory, allocated memory must */ -/* in 4-byte boundary */ -void* zfwMemAllocate(zdev_t* dev, u32_t size) +/* Called to allocate uncached memory, allocated memory must */ +/* in 4-byte boundary */ +void *zfwMemAllocate(zdev_t *dev, u32_t size) { - void* mem = NULL; - mem = kmalloc(size, GFP_ATOMIC); - return mem; + void *mem = NULL; + mem = kmalloc(size, GFP_ATOMIC); + return mem; } /* Called to free allocated memory */ -void zfwMemFree(zdev_t* dev, void* mem, u32_t size) +void zfwMemFree(zdev_t *dev, void *mem, u32_t size) { - kfree(mem); - return; + kfree(mem); + return; } -void zfwMemoryCopy(u8_t* dst, u8_t* src, u16_t length) +void zfwMemoryCopy(u8_t *dst, u8_t *src, u16_t length) { - //u16_t i; + /* u16_t i; */ - memcpy(dst, src, length); - //for(i=0; i Date: Mon, 26 Oct 2009 21:22:55 -0700 Subject: [PATCH 145/235] Staging: otus : checkpatch.pl cleanup for some more .c files Second lot of checkpatch.pl error and warning fixes for .c files of otus driver in staging tree. (Externs would be removed in a seperate patch) Signed-off-by: Mithlesh Thukral Signed-off-by: Greg Kroah-Hartman --- drivers/staging/otus/usbdrv.c | 35 ++-- drivers/staging/otus/wrap_buf.c | 20 +- drivers/staging/otus/wrap_ev.c | 350 +++++++++++++++++--------------- drivers/staging/otus/wrap_mis.c | 61 +++--- drivers/staging/otus/wrap_pkt.c | 210 +++++++++---------- drivers/staging/otus/wrap_sec.c | 123 +++++------ drivers/staging/otus/wrap_usb.c | 213 ++++++++++--------- 7 files changed, 502 insertions(+), 510 deletions(-) diff --git a/drivers/staging/otus/usbdrv.c b/drivers/staging/otus/usbdrv.c index 48aa30a62164..b0adbc8b2dc2 100644 --- a/drivers/staging/otus/usbdrv.c +++ b/drivers/staging/otus/usbdrv.c @@ -111,7 +111,7 @@ extern u8_t zfLnxCreateThread(zdev_t *dev); /* Definition of Wireless Extension */ -//wireless extension helper functions +/* wireless extension helper functions */ extern int usbdrv_ioctl_setessid(struct net_device *dev, struct iw_point *erq); extern int usbdrv_ioctl_setrts(struct net_device *dev, struct iw_param *rrq); /* Wireless Extension Handler functions */ @@ -282,8 +282,8 @@ static struct iw_handler_def p80211wext_handler_def = { }; /* WDS */ -//struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER]; -//void zfInitWdsStruct(void); +/* struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER]; */ +/* void zfInitWdsStruct(void); */ /* VAP */ struct zsVapStruct vap[ZM_VAP_PORT_NUMBER]; @@ -314,13 +314,11 @@ irqreturn_t usbdrv_intr(int irq, void *dev_inst, struct pt_regs *regs) return IRQ_NONE; /* the device is closed, don't continue or else bad things may happen. */ - if (!netif_running(dev)) { + if (!netif_running(dev)) return IRQ_NONE; - } - if (macp->driver_isolated) { + if (macp->driver_isolated) return IRQ_NONE; - } #if (WLAN_HOSTIF == WLAN_PCI) //zfiIsrPci(dev); @@ -340,9 +338,11 @@ int usbdrv_open(struct net_device *dev) printk("Enter open()\n"); -//#ifndef CONFIG_SMP -// read_lock(&(macp->isolate_lock)); -//#endif +/* + * #ifndef CONFIG_SMP + * read_lock(&(macp->isolate_lock)); + * #endif + */ if (macp->driver_isolated) { rc = -EBUSY; goto exit; @@ -393,11 +393,11 @@ int usbdrv_open(struct net_device *dev) dev->dev_addr[4] = addr[4]; dev->dev_addr[5] = addr[5]; #endif - //zfwMacAddressNotify() will be called to setup dev->dev_addr[] + /* zfwMacAddressNotify() will be called to setup dev->dev_addr[] */ zfLnxCreateThread(dev); - mod_timer(&(macp->hbTimer10ms), jiffies + (1*HZ)/100); //10 ms + mod_timer(&(macp->hbTimer10ms), jiffies + (1*HZ)/100); /* 10 ms */ netif_carrier_on(dev); @@ -425,15 +425,15 @@ int usbdrv_open(struct net_device *dev) #if ZM_SHARE_AUTH == 1 zfiWlanSetAuthenticationMode(dev, 1); - #endif //#if ZM_SHARE_AUTH == 1 - #endif //#if ZM_WEP_MOME == 1 + #endif /* #if ZM_SHARE_AUTH == 1 */ + #endif /* #if ZM_WEP_MOME == 1 */ #elif ZM_PIBSS_MODE == 1 zfiWlanSetWlanMode(dev, ZM_MODE_PSEUDO); #else zfiWlanSetWlanMode(dev, ZM_MODE_INFRASTRUCTURE); #endif - //zfiWlanSetChannel(dev, ZM_CHANNEL, FALSE); + /* zfiWlanSetChannel(dev, ZM_CHANNEL, FALSE); */ zfiWlanSetFrequency(dev, 2462000, FALSE); zfiWlanSetRtsThreshold(dev, 32767); zfiWlanSetFragThreshold(dev, 0); @@ -720,7 +720,7 @@ void zfLnxInitVapStruct(void) { u16_t i; - for (i=0; ilen > size); + /* zm_assert(buf->len > size); */ buf->data += size; buf->len -= size; @@ -68,7 +68,7 @@ u16_t zfwBufRemoveHead(zdev_t* dev, zbuf_t* buf, u16_t size) /* Used to chain Rx buffer to form a frame. if the prepared Rx buffer */ /* is greater than an ethernet frame(1518+32 byte), then this function */ /* will only be called with head=NULL. */ -u16_t zfwBufChain(zdev_t* dev, zbuf_t** head, zbuf_t* tail) +u16_t zfwBufChain(zdev_t *dev, zbuf_t **head, zbuf_t *tail) { *head = tail; @@ -77,7 +77,7 @@ u16_t zfwBufChain(zdev_t* dev, zbuf_t** head, zbuf_t* tail) /* Called when doing infra-bss forwarding */ -u16_t zfwBufCopy(zdev_t* dev, zbuf_t* dst, zbuf_t* src) +u16_t zfwBufCopy(zdev_t *dev, zbuf_t *dst, zbuf_t *src) { memcpy(dst->data, src->data, src->len); dst->tail = dst->data; @@ -87,7 +87,7 @@ u16_t zfwBufCopy(zdev_t* dev, zbuf_t* dst, zbuf_t* src) /* Called to adjust buffer size and tail pointer */ -u16_t zfwBufSetSize(zdev_t* dev, zbuf_t* buf, u16_t size) +u16_t zfwBufSetSize(zdev_t *dev, zbuf_t *buf, u16_t size) { #ifdef NET_SKBUFF_DATA_USES_OFFSET buf->tail = 0; @@ -101,11 +101,11 @@ u16_t zfwBufSetSize(zdev_t* dev, zbuf_t* buf, u16_t size) return 0; } -u16_t zfwBufGetSize(zdev_t* dev, zbuf_t* buf) +u16_t zfwBufGetSize(zdev_t *dev, zbuf_t *buf) { return buf->len; } -void zfwCopyBufContext(zdev_t* dev, zbuf_t* source, zbuf_t* dst) +void zfwCopyBufContext(zdev_t *dev, zbuf_t *source, zbuf_t *dst) { } diff --git a/drivers/staging/otus/wrap_ev.c b/drivers/staging/otus/wrap_ev.c index bcda0b9673dc..29f560372555 100644 --- a/drivers/staging/otus/wrap_ev.c +++ b/drivers/staging/otus/wrap_ev.c @@ -32,202 +32,214 @@ /***** Management *****/ -u16_t zfLnxAuthNotify(zdev_t* dev, u16_t* macAddr) +u16_t zfLnxAuthNotify(zdev_t *dev, u16_t *macAddr) { - return 0; + return 0; } -u16_t zfLnxAsocNotify(zdev_t* dev, u16_t* macAddr, u8_t* body, u16_t bodySize, u16_t port) +u16_t zfLnxAsocNotify(zdev_t *dev, u16_t *macAddr, u8_t *body, u16_t bodySize, + u16_t port) { -//#ifdef ZM_HOSTAPD_SUPPORT - struct usbdrv_private *macp = dev->ml_priv; - union iwreq_data wreq; - u8_t *addr = (u8_t *) macAddr; - u16_t i, j; - - memset(&wreq, 0, sizeof(wreq)); - memcpy(wreq.addr.sa_data, macAddr, ETH_ALEN); - wreq.addr.sa_family = ARPHRD_ETHER; - printk(KERN_DEBUG "join_event of MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", - addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); - - for(i = 0; i < ZM_OAL_MAX_STA_SUPPORT; i++) - { - for(j = 0; j < IEEE80211_ADDR_LEN; j++) - { - if ((macp->stawpaie[i].wpa_macaddr[j] != 0) && - (macp->stawpaie[i].wpa_macaddr[j] != addr[j])) - break; - } - if (j == 6) - break; - } - if (i < ZM_OAL_MAX_STA_SUPPORT) - { - //printk("zfwAsocNotify - store wpa ie in macp, index = %d\n", i); - memcpy(macp->stawpaie[i].wpa_macaddr, macAddr, IEEE80211_ADDR_LEN); - memcpy(macp->stawpaie[i].wpa_ie, body, bodySize); - } - //if(macp->cardSetting.BssType == INFRASTRUCTURE_BSS) { - // //wireless_send_event(macp->device, SIOCGIWSCAN, &wreq, NULL); - // wireless_send_event(macp->device, SIOCGIWAP, &wreq, NULL); - //} - //else if(macp->cardSetting.BssType == AP_BSS) { -// if (port == 0) -// { - wireless_send_event(dev, IWEVREGISTERED, &wreq, NULL); -// } -// else -// { -// /* Check whether the VAP device is valid */ -// if (vap[port].dev != NULL) -// { -// wireless_send_event(vap[port].dev, IWEVREGISTERED, &wreq, NULL); -// } -// else -// { -// printk(KERN_ERR "Can' find a valid VAP device, port: %d\n", port); -// } -// } - //} -//#endif - - return 0; +/* #ifdef ZM_HOSTAPD_SUPPORT */ + struct usbdrv_private *macp = dev->ml_priv; + union iwreq_data wreq; + u8_t *addr = (u8_t *) macAddr; + u16_t i, j; + + memset(&wreq, 0, sizeof(wreq)); + memcpy(wreq.addr.sa_data, macAddr, ETH_ALEN); + wreq.addr.sa_family = ARPHRD_ETHER; + printk(KERN_DEBUG "join_event of MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", + addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); + + for (i = 0; i < ZM_OAL_MAX_STA_SUPPORT; i++) { + for (j = 0; j < IEEE80211_ADDR_LEN; j++) { + if ((macp->stawpaie[i].wpa_macaddr[j] != 0) && + (macp->stawpaie[i].wpa_macaddr[j] != addr[j])) + break; + } + if (j == 6) + break; + } + if (i < ZM_OAL_MAX_STA_SUPPORT) { + /* + * printk("zfwAsocNotify - store wpa ie in macp, + * index = %d\n", i); + */ + memcpy(macp->stawpaie[i].wpa_macaddr, macAddr, + IEEE80211_ADDR_LEN); + memcpy(macp->stawpaie[i].wpa_ie, body, bodySize); + } + /* + * if(macp->cardSetting.BssType == INFRASTRUCTURE_BSS) { + * wireless_send_event(macp->device, SIOCGIWSCAN, &wreq, NULL); + * wireless_send_event(macp->device, SIOCGIWAP, &wreq, NULL); + * } + * else if(macp->cardSetting.BssType == AP_BSS) { + * if (port == 0) + * { + */ + wireless_send_event(dev, IWEVREGISTERED, &wreq, NULL); + /* + * } + * else + * { + * Check whether the VAP device is valid + * if (vap[port].dev != NULL) + * { + * wireless_send_event(vap[port].dev, + * IWEVREGISTERED, &wreq, NULL); + * } + * else + * { + * printk(KERN_ERR "Can' find a valid VAP device, + * port: %d\n", port); + * } + * } + * } + */ +/* #endif */ + + return 0; } /* Notification that a STA is disassociated from AP */ /* AP mode only */ -u16_t zfLnxDisAsocNotify(zdev_t* dev, u8_t* macAddr, u16_t port) +u16_t zfLnxDisAsocNotify(zdev_t *dev, u8_t *macAddr, u16_t port) { - union iwreq_data wreq; - u8_t *addr = (u8_t *) macAddr; + union iwreq_data wreq; + u8_t *addr = (u8_t *) macAddr; - memset(&wreq, 0, sizeof(wreq)); - memcpy(wreq.addr.sa_data, macAddr, ETH_ALEN); - wreq.addr.sa_family = ARPHRD_ETHER; - printk(KERN_DEBUG "zfwDisAsocNotify(), MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", - addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); + memset(&wreq, 0, sizeof(wreq)); + memcpy(wreq.addr.sa_data, macAddr, ETH_ALEN); + wreq.addr.sa_family = ARPHRD_ETHER; + printk(KERN_DEBUG "zfwDisAsocNotify(), MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", + addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); - return 0; + return 0; } /* Notification that a STA is connect to AP */ /* AP mode only */ -u16_t zfLnxApConnectNotify(zdev_t* dev, u8_t* macAddr, u16_t port) +u16_t zfLnxApConnectNotify(zdev_t *dev, u8_t *macAddr, u16_t port) { - union iwreq_data wreq; - u8_t *addr = (u8_t *) macAddr; + union iwreq_data wreq; + u8_t *addr = (u8_t *) macAddr; - memset(&wreq, 0, sizeof(wreq)); - memcpy(wreq.addr.sa_data, macAddr, ETH_ALEN); - wreq.addr.sa_family = ARPHRD_ETHER; - printk(KERN_DEBUG "zfwApConnectNotify(), MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", - addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); + memset(&wreq, 0, sizeof(wreq)); + memcpy(wreq.addr.sa_data, macAddr, ETH_ALEN); + wreq.addr.sa_family = ARPHRD_ETHER; + printk(KERN_DEBUG "zfwApConnectNotify(), MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", + addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); - return 0; + return 0; } -void zfLnxConnectNotify(zdev_t* dev, u16_t status, u16_t* bssid) +void zfLnxConnectNotify(zdev_t *dev, u16_t status, u16_t *bssid) { - union iwreq_data wreq; - u8_t *addr = (u8_t *) bssid; - struct usbdrv_private *macp = dev->ml_priv; - - if (bssid != NULL) - { - memset(&wreq, 0, sizeof(wreq)); - if (status == ZM_STATUS_MEDIA_CONNECT) - memcpy(wreq.addr.sa_data, bssid, ETH_ALEN); - wreq.addr.sa_family = ARPHRD_ETHER; - - if (status == ZM_STATUS_MEDIA_CONNECT) - { + union iwreq_data wreq; + u8_t *addr = (u8_t *) bssid; + struct usbdrv_private *macp = dev->ml_priv; + + if (bssid != NULL) { + memset(&wreq, 0, sizeof(wreq)); + if (status == ZM_STATUS_MEDIA_CONNECT) + memcpy(wreq.addr.sa_data, bssid, ETH_ALEN); + wreq.addr.sa_family = ARPHRD_ETHER; + + if (status == ZM_STATUS_MEDIA_CONNECT) { #ifdef ZM_CONFIG_BIG_ENDIAN - printk(KERN_DEBUG "Connected to AP, MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", - addr[1], addr[0], addr[3], addr[2], addr[5], addr[4]); + printk(KERN_DEBUG "Connected to AP, MAC:" + "%02x:%02x:%02x:%02x:%02x:%02x\n", + addr[1], addr[0], addr[3], addr[2], + addr[5], addr[4]); #else - printk(KERN_DEBUG "Connected to AP, MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", - addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); + printk(KERN_DEBUG "Connected to AP, MAC:" + "%02x:%02x:%02x:%02x:%02x:%02x\n", + addr[0], addr[1], addr[2], addr[3], + addr[4], addr[5]); #endif - netif_start_queue(dev); - } - else if ((status == ZM_STATUS_MEDIA_DISCONNECT) || - (status == ZM_STATUS_MEDIA_DISABLED) || - (status == ZM_STATUS_MEDIA_CONNECTION_DISABLED) || - (status == ZM_STATUS_MEDIA_CONNECTION_RESET) || - (status == ZM_STATUS_MEDIA_RESET) || - (status == ZM_STATUS_MEDIA_DISCONNECT_DEAUTH) || - (status == ZM_STATUS_MEDIA_DISCONNECT_DISASOC) || - (status == ZM_STATUS_MEDIA_DISCONNECT_BEACON_MISS) || - (status == ZM_STATUS_MEDIA_DISCONNECT_NOT_FOUND) || - (status == ZM_STATUS_MEDIA_DISCONNECT_TIMEOUT)) - { - printk(KERN_DEBUG "Disconnection Notify\n"); - - netif_stop_queue(dev); - } + netif_start_queue(dev); + } else if ((status == ZM_STATUS_MEDIA_DISCONNECT) || + (status == ZM_STATUS_MEDIA_DISABLED) || + (status == ZM_STATUS_MEDIA_CONNECTION_DISABLED) || + (status == ZM_STATUS_MEDIA_CONNECTION_RESET) || + (status == ZM_STATUS_MEDIA_RESET) || + (status == ZM_STATUS_MEDIA_DISCONNECT_DEAUTH) || + (status == ZM_STATUS_MEDIA_DISCONNECT_DISASOC) || + (status == ZM_STATUS_MEDIA_DISCONNECT_BEACON_MISS) || + (status == ZM_STATUS_MEDIA_DISCONNECT_NOT_FOUND) || + (status == ZM_STATUS_MEDIA_DISCONNECT_TIMEOUT)) { + printk(KERN_DEBUG "Disconnection Notify\n"); + + netif_stop_queue(dev); + } /* Save the connected status */ macp->adapterState = status; - if(zfiWlanQueryWlanMode(dev) == ZM_MODE_INFRASTRUCTURE) { - // //wireless_send_event(dev, SIOCGIWSCAN, &wreq, NULL); - wireless_send_event(dev, SIOCGIWAP, &wreq, NULL); - } - else if(zfiWlanQueryWlanMode(dev) == ZM_MODE_AP) { - //if (port == 0) - //{ - wireless_send_event(dev, IWEVREGISTERED, &wreq, NULL); - //} - //else - //{ - // /* Check whether the VAP device is valid */ - // if (vap[port].dev != NULL) - // { - // wireless_send_event(vap[port].dev, IWEVREGISTERED, &wreq, NULL); - // } - // else - // { - // printk(KERN_ERR "Can' find a valid VAP device, port: %d\n", port); - // } - //} - } - } - //return 0; + if (zfiWlanQueryWlanMode(dev) == ZM_MODE_INFRASTRUCTURE) { + /*wireless_send_event(dev, SIOCGIWSCAN, &wreq, NULL);*/ + wireless_send_event(dev, SIOCGIWAP, &wreq, NULL); + } else if (zfiWlanQueryWlanMode(dev) == ZM_MODE_AP) { + /* + * if (port == 0) + * { + * wireless_send_event(dev, IWEVREGISTERED, + * &wreq, NULL); + * } + * else + * { + * Check whether the VAP device is valid + * if (vap[port].dev != NULL) + * { + * wireless_send_event(vap[port].dev, + * IWEVREGISTERED, &wreq, NULL); + * } + * else + * { + * printk(KERN_ERR "Can' find a valid VAP" + * " device, port: %d\n", port); + * } + * } + */ + } + } + /* return 0; */ } -void zfLnxScanNotify(zdev_t* dev, struct zsScanResult* result) +void zfLnxScanNotify(zdev_t *dev, struct zsScanResult *result) { - return; + return; } -void zfLnxStatisticsNotify(zdev_t* dev, struct zsStastics* result) +void zfLnxStatisticsNotify(zdev_t *dev, struct zsStastics *result) { - return; + return; } -//void zfwMicFailureNotify(zdev_t* dev, u8_t* message, u16_t event) -void zfLnxMicFailureNotify(zdev_t* dev, u16_t* addr, u16_t status) +/* void zfwMicFailureNotify(zdev_t *dev, u8_t *message, u16_t event) */ +void zfLnxMicFailureNotify(zdev_t *dev, u16_t *addr, u16_t status) { static const char *tag = "MLME-MICHAELMICFAILURE.indication"; union iwreq_data wrqu; char buf[128]; /* TODO: needed parameters: count, type, src address */ - //snprintf(buf, sizeof(buf), "%s(%scast addr=%s)", tag, - // (status == ZM_MIC_GROUP_ERROR) ? "broad" : "uni", - // ether_sprintf((u8_t *)addr)); + /* + * snprintf(buf, sizeof(buf), "%s(%scast addr=%s)", tag, + * (status == ZM_MIC_GROUP_ERROR) ? "broad" : "uni", + * ether_sprintf((u8_t *)addr)); + */ if (zfiWlanQueryWlanMode(dev) == ZM_MODE_INFRASTRUCTURE) - { strcpy(buf, tag); - } memset(&wrqu, 0, sizeof(wrqu)); wrqu.data.length = strlen(buf); @@ -235,42 +247,46 @@ void zfLnxMicFailureNotify(zdev_t* dev, u16_t* addr, u16_t status) } -void zfLnxApMicFailureNotify(zdev_t* dev, u8_t* addr, zbuf_t* buf) +void zfLnxApMicFailureNotify(zdev_t *dev, u8_t *addr, zbuf_t *buf) { - union iwreq_data wreq; + union iwreq_data wreq; - memset(&wreq, 0, sizeof(wreq)); - memcpy(wreq.addr.sa_data, addr, ETH_ALEN); - wreq.addr.sa_family = ARPHRD_ETHER; - printk(KERN_DEBUG "zfwApMicFailureNotify(), MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", - addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); + memset(&wreq, 0, sizeof(wreq)); + memcpy(wreq.addr.sa_data, addr, ETH_ALEN); + wreq.addr.sa_family = ARPHRD_ETHER; + printk(KERN_DEBUG "zfwApMicFailureNotify(), " + "MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", + addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); - return; + return; } - -// status = 0 => partner lost -// = 1 => partner alive -//void zfwIbssPartnerNotify(zdev_t* dev, u8_t status) -void zfLnxIbssPartnerNotify(zdev_t* dev, u16_t status, struct zsPartnerNotifyEvent *event) +/* + * status = 0 => partner lost + * = 1 => partner alive + * void zfwIbssPartnerNotify(zdev_t* dev, u8_t status) + */ +void zfLnxIbssPartnerNotify(zdev_t *dev, u16_t status, + struct zsPartnerNotifyEvent *event) { } -void zfLnxMacAddressNotify(zdev_t* dev, u8_t* addr) +void zfLnxMacAddressNotify(zdev_t *dev, u8_t *addr) { - dev->dev_addr[0] = addr[0]; - dev->dev_addr[1] = addr[1]; - dev->dev_addr[2] = addr[2]; - dev->dev_addr[3] = addr[3]; - dev->dev_addr[4] = addr[4]; - dev->dev_addr[5] = addr[5]; + dev->dev_addr[0] = addr[0]; + dev->dev_addr[1] = addr[1]; + dev->dev_addr[2] = addr[2]; + dev->dev_addr[3] = addr[3]; + dev->dev_addr[4] = addr[4]; + dev->dev_addr[5] = addr[5]; } -void zfLnxSendCompleteIndication(zdev_t* dev, zbuf_t* buf) +void zfLnxSendCompleteIndication(zdev_t *dev, zbuf_t *buf) { } -void zfLnxRestoreBufData(zdev_t* dev, zbuf_t* buf) { +void zfLnxRestoreBufData(zdev_t *dev, zbuf_t *buf) +{ } /* Leave an empty line below to remove warning message on some compiler */ diff --git a/drivers/staging/otus/wrap_mis.c b/drivers/staging/otus/wrap_mis.c index ea2199fecbbe..26f49b7ec834 100644 --- a/drivers/staging/otus/wrap_mis.c +++ b/drivers/staging/otus/wrap_mis.c @@ -30,76 +30,73 @@ #include #include -//extern struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER]; +/* extern struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER]; */ extern struct zsVapStruct vap[ZM_VAP_PORT_NUMBER]; -extern u16_t zfLnxGetVapId(zdev_t* dev); +extern u16_t zfLnxGetVapId(zdev_t *dev); /* Simply return 0xffff if VAP function is not supported */ -u16_t zfwGetVapId(zdev_t* dev) +u16_t zfwGetVapId(zdev_t *dev) { - return zfLnxGetVapId(dev); + return zfLnxGetVapId(dev); } -void zfwSleep(zdev_t* dev, u32_t ms) +void zfwSleep(zdev_t *dev, u32_t ms) { - if (in_interrupt() == 0) - { - mdelay(ms); - } - else - { - int ii; - int iter = 100000 * ms; - - for (ii = 0; ii < iter; ii++) - { - - } - } + if (in_interrupt() == 0) + mdelay(ms); + else { + int ii; + int iter = 100000 * ms; + + for (ii = 0; ii < iter; ii++) { + } + } } #ifdef ZM_HALPLUS_LOCK -asmlinkage struct zsWlanDev *zfwGetWlanDev(zdev_t* dev) +asmlinkage struct zsWlanDev *zfwGetWlanDev(zdev_t *dev) { struct usbdrv_private *macp = dev->ml_priv; return macp->wd; } -asmlinkage void zfwEnterCriticalSection(zdev_t* dev) +asmlinkage void zfwEnterCriticalSection(zdev_t *dev) { struct usbdrv_private *macp = dev->ml_priv; spin_lock_irqsave(&macp->cs_lock, macp->hal_irqFlag); } -asmlinkage void zfwLeaveCriticalSection(zdev_t* dev) +asmlinkage void zfwLeaveCriticalSection(zdev_t *dev) { struct usbdrv_private *macp = dev->ml_priv; spin_unlock_irqrestore(&macp->cs_lock, macp->hal_irqFlag); } -asmlinkage u8_t zfwBufReadByte(zdev_t* dev, zbuf_t* buf, u16_t offset) +asmlinkage u8_t zfwBufReadByte(zdev_t *dev, zbuf_t *buf, u16_t offset) { - return *(u8_t*)((u8_t*)buf->data+offset); + return *(u8_t *)((u8_t *)buf->data+offset); } -asmlinkage u16_t zfwBufReadHalfWord(zdev_t* dev, zbuf_t* buf, u16_t offset) +asmlinkage u16_t zfwBufReadHalfWord(zdev_t *dev, zbuf_t *buf, u16_t offset) { - return zmw_cpu_to_le16(*(u16_t*)((u8_t*)buf->data+offset)); + return zmw_cpu_to_le16(*(u16_t *)((u8_t *)buf->data+offset)); } -asmlinkage void zfwBufWriteByte(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t value) +asmlinkage void zfwBufWriteByte(zdev_t *dev, zbuf_t *buf, u16_t offset, + u8_t value) { - *(u8_t*)((u8_t*)buf->data+offset) = value; + *(u8_t *)((u8_t *)buf->data+offset) = value; } -asmlinkage void zfwBufWriteHalfWord(zdev_t* dev, zbuf_t* buf, u16_t offset, u16_t value) +asmlinkage void zfwBufWriteHalfWord(zdev_t *dev, zbuf_t *buf, u16_t offset, + u16_t value) { - *(u16_t*)((u8_t*)buf->data+offset) = zmw_cpu_to_le16(value); + *(u16_t *)((u8_t *)buf->data+offset) = zmw_cpu_to_le16(value); } -asmlinkage u8_t *zfwGetBuffer(zdev_t* dev, zbuf_t* buf) +asmlinkage u8_t *zfwGetBuffer(zdev_t *dev, zbuf_t *buf) { - return (u8_t*)(buf->data); + return (u8_t *)(buf->data); } #endif diff --git a/drivers/staging/otus/wrap_pkt.c b/drivers/staging/otus/wrap_pkt.c index 0d5920fdf4f3..75bb952fd0a5 100644 --- a/drivers/staging/otus/wrap_pkt.c +++ b/drivers/staging/otus/wrap_pkt.c @@ -31,136 +31,122 @@ #include -//extern struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER]; +/* extern struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER]; */ extern struct zsVapStruct vap[ZM_VAP_PORT_NUMBER]; /***** Rx *****/ -void zfLnxRecv80211(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo) +void zfLnxRecv80211(zdev_t *dev, zbuf_t *buf, struct zsAdditionInfo *addInfo) { - u16_t frameType; - u16_t frameCtrl; - u16_t frameSubtype; - zbuf_t *skb1; - struct usbdrv_private *macp = dev->ml_priv; - - //frameCtrl = zmw_buf_readb(dev, buf, 0); - frameCtrl = *(u8_t*)((u8_t*)buf->data); - frameType = frameCtrl & 0xf; - frameSubtype = frameCtrl & 0xf0; - - if ((frameType == 0x0) && (macp->forwardMgmt)) - { - switch (frameSubtype) - { - /* Beacon */ - case 0x80 : - /* Probe response */ - case 0x50 : - skb1 = skb_copy(buf, GFP_ATOMIC); - if(skb1 != NULL) - { - skb1->dev = dev; - skb1->mac_header = skb1->data; - skb1->ip_summed = CHECKSUM_NONE; - skb1->pkt_type = PACKET_OTHERHOST; - skb1->protocol = __constant_htons(0x0019); /* ETH_P_80211_RAW */ - netif_rx(skb1); - } - break; - default: - break; - } - } - - zfiRecv80211(dev, buf, addInfo); - return; + u16_t frameType; + u16_t frameCtrl; + u16_t frameSubtype; + zbuf_t *skb1; + struct usbdrv_private *macp = dev->ml_priv; + + /* frameCtrl = zmw_buf_readb(dev, buf, 0); */ + frameCtrl = *(u8_t *)((u8_t *)buf->data); + frameType = frameCtrl & 0xf; + frameSubtype = frameCtrl & 0xf0; + + if ((frameType == 0x0) && (macp->forwardMgmt)) { + switch (frameSubtype) { + /* Beacon */ + case 0x80: + /* Probe response */ + case 0x50: + skb1 = skb_copy(buf, GFP_ATOMIC); + if (skb1 != NULL) { + skb1->dev = dev; + skb1->mac_header = skb1->data; + skb1->ip_summed = CHECKSUM_NONE; + skb1->pkt_type = PACKET_OTHERHOST; + /* ETH_P_80211_RAW */ + skb1->protocol = __constant_htons(0x0019); + netif_rx(skb1); + } + break; + default: + break; + } + } + + zfiRecv80211(dev, buf, addInfo); + return; } #define ZM_AVOID_UDP_LARGE_PACKET_FAIL -void zfLnxRecvEth(zdev_t* dev, zbuf_t* buf, u16_t port) +void zfLnxRecvEth(zdev_t *dev, zbuf_t *buf, u16_t port) { - struct usbdrv_private *macp = dev->ml_priv; + struct usbdrv_private *macp = dev->ml_priv; #ifdef ZM_AVOID_UDP_LARGE_PACKET_FAIL - zbuf_t *new_buf; + zbuf_t *new_buf; - //new_buf = dev_alloc_skb(2048); - new_buf = dev_alloc_skb(buf->len); + /* new_buf = dev_alloc_skb(2048); */ + new_buf = dev_alloc_skb(buf->len); #ifdef NET_SKBUFF_DATA_USES_OFFSET - new_buf->tail = 0; - new_buf->len = 0; + new_buf->tail = 0; + new_buf->len = 0; #else - new_buf->tail = new_buf->data; - new_buf->len = 0; + new_buf->tail = new_buf->data; + new_buf->len = 0; #endif - skb_put(new_buf, buf->len); - memcpy(new_buf->data, buf->data, buf->len); - - /* Free buffer */ - dev_kfree_skb_any(buf); - - if (port == 0) - { - new_buf->dev = dev; - new_buf->protocol = eth_type_trans(new_buf, dev); - } - else - { - /* VAP */ - if (vap[0].dev != NULL) - { - new_buf->dev = vap[0].dev; - new_buf->protocol = eth_type_trans(new_buf, vap[0].dev); - } - else - { - new_buf->dev = dev; - new_buf->protocol = eth_type_trans(new_buf, dev); - } - } - - new_buf->ip_summed = CHECKSUM_NONE; - dev->last_rx = jiffies; - - switch(netif_rx(new_buf)) + skb_put(new_buf, buf->len); + memcpy(new_buf->data, buf->data, buf->len); + + /* Free buffer */ + dev_kfree_skb_any(buf); + + if (port == 0) { + new_buf->dev = dev; + new_buf->protocol = eth_type_trans(new_buf, dev); + } else { + /* VAP */ + if (vap[0].dev != NULL) { + new_buf->dev = vap[0].dev; + new_buf->protocol = eth_type_trans(new_buf, vap[0].dev); + } else { + new_buf->dev = dev; + new_buf->protocol = eth_type_trans(new_buf, dev); + } + } + + new_buf->ip_summed = CHECKSUM_NONE; + dev->last_rx = jiffies; + + switch (netif_rx(new_buf)) #else - if (port == 0) - { - buf->dev = dev; - buf->protocol = eth_type_trans(buf, dev); - } - else - { - /* VAP */ - if (vap[0].dev != NULL) - { - buf->dev = vap[0].dev; - buf->protocol = eth_type_trans(buf, vap[0].dev); - } - else - { - buf->dev = dev; - buf->protocol = eth_type_trans(buf, dev); - } - } - - buf->ip_summed = CHECKSUM_NONE; - dev->last_rx = jiffies; - - switch(netif_rx(buf)) + if (port == 0) { + buf->dev = dev; + buf->protocol = eth_type_trans(buf, dev); + } else { + /* VAP */ + if (vap[0].dev != NULL) { + buf->dev = vap[0].dev; + buf->protocol = eth_type_trans(buf, vap[0].dev); + } else { + buf->dev = dev; + buf->protocol = eth_type_trans(buf, dev); + } + } + + buf->ip_summed = CHECKSUM_NONE; + dev->last_rx = jiffies; + + switch (netif_rx(buf)) #endif - { - case NET_RX_DROP: - break; - default: - macp->drv_stats.net_stats.rx_packets++; - macp->drv_stats.net_stats.rx_bytes += buf->len; - break; - } - - return; + { + case NET_RX_DROP: + break; + default: + macp->drv_stats.net_stats.rx_packets++; + macp->drv_stats.net_stats.rx_bytes += buf->len; + break; + } + + return; } /* Leave an empty line below to remove warning message on some compiler */ diff --git a/drivers/staging/otus/wrap_sec.c b/drivers/staging/otus/wrap_sec.c index 0f780bacc598..0b238e9999bf 100644 --- a/drivers/staging/otus/wrap_sec.c +++ b/drivers/staging/otus/wrap_sec.c @@ -33,92 +33,93 @@ #ifdef ZM_ENABLE_CENC extern int zfLnxCencSendMsg(struct sock *netlink_sk, u_int8_t *msg, int len); -u16_t zfLnxCencAsocNotify(zdev_t* dev, u16_t* macAddr, u8_t* body, u16_t bodySize, u16_t port) +u16_t zfLnxCencAsocNotify(zdev_t *dev, u16_t *macAddr, u8_t *body, + u16_t bodySize, u16_t port) { - struct usbdrv_private *macp = (struct usbdrv_private *)dev->priv; - struct zydas_cenc_sta_info cenc_info; - //struct sock *netlink_sk; - u8_t ie_len; - int ii; + struct usbdrv_private *macp = (struct usbdrv_private *)dev->priv; + struct zydas_cenc_sta_info cenc_info; + /* struct sock *netlink_sk; */ + u8_t ie_len; + int ii; - /* Create NETLINK socket */ - //netlink_sk = netlink_kernel_create(NETLINK_USERSOCK, NULL); + /* Create NETLINK socket */ + /*netlink_sk = netlink_kernel_create(NETLINK_USERSOCK, NULL); */ - if (macp->netlink_sk == NULL) - { - printk(KERN_ERR "NETLINK Socket is NULL\n"); - return -1; - } + if (macp->netlink_sk == NULL) { + printk(KERN_ERR "NETLINK Socket is NULL\n"); + return -1; + } - memset(&cenc_info, 0, sizeof(cenc_info)); + memset(&cenc_info, 0, sizeof(cenc_info)); - //memcpy(cenc_info.gsn, vap->iv_cencmsk_keys.wk_txiv, ZM_CENC_IV_LEN); - zfiWlanQueryGSN(dev, cenc_info.gsn, port); - cenc_info.datalen += ZM_CENC_IV_LEN; - ie_len = body[1] + 2; - memcpy(cenc_info.wie, body, ie_len); - cenc_info.datalen += ie_len; + /* memcpy(cenc_info.gsn, vap->iv_cencmsk_keys.wk_txiv, + * ZM_CENC_IV_LEN); + */ + zfiWlanQueryGSN(dev, cenc_info.gsn, port); + cenc_info.datalen += ZM_CENC_IV_LEN; + ie_len = body[1] + 2; + memcpy(cenc_info.wie, body, ie_len); + cenc_info.datalen += ie_len; - memcpy(cenc_info.sta_mac, macAddr, 6); - cenc_info.msg_type = ZM_CENC_WAI_REQUEST; - cenc_info.datalen += 6 + 2; + memcpy(cenc_info.sta_mac, macAddr, 6); + cenc_info.msg_type = ZM_CENC_WAI_REQUEST; + cenc_info.datalen += 6 + 2; - printk(KERN_ERR "===== zfwCencSendMsg, bodySize: %d =====\n", bodySize); + printk(KERN_ERR "===== zfwCencSendMsg, bodySize: %d =====\n", bodySize); - for(ii = 0; ii < bodySize; ii++) - { - printk(KERN_ERR "%02x ", body[ii]); + for (ii = 0; ii < bodySize; ii++) { + printk(KERN_ERR "%02x ", body[ii]); - if ((ii & 0xf) == 0xf) - { - printk(KERN_ERR "\n"); - } - } + if ((ii & 0xf) == 0xf) + printk(KERN_ERR "\n"); + } - zfLnxCencSendMsg(macp->netlink_sk, (u8_t *)&cenc_info, cenc_info.datalen+4); + zfLnxCencSendMsg(macp->netlink_sk, (u8_t *)&cenc_info, + cenc_info.datalen+4); - /* Close NETLINK socket */ - //sock_release(netlink_sk); + /* Close NETLINK socket */ + /* sock_release(netlink_sk); */ - return 0; + return 0; } -#endif //ZM_ENABLE_CENC +#endif /* ZM_ENABLE_CENC */ -u8_t zfwCencHandleBeaconProbrespon(zdev_t* dev, u8_t *pWIEc, - u8_t *pPeerSSIDc, u8_t *pPeerAddrc) +u8_t zfwCencHandleBeaconProbrespon(zdev_t *dev, u8_t *pWIEc, + u8_t *pPeerSSIDc, u8_t *pPeerAddrc) { - return 0; + return 0; } -u8_t zfwGetPktEncExemptionActionType(zdev_t* dev, zbuf_t* buf) +u8_t zfwGetPktEncExemptionActionType(zdev_t *dev, zbuf_t *buf) { - return ZM_ENCRYPTION_EXEMPT_NO_EXEMPTION; + return ZM_ENCRYPTION_EXEMPT_NO_EXEMPTION; } -void copyToIntTxBuffer(zdev_t* dev, zbuf_t* buf, u8_t* src, - u16_t offset, u16_t length) +void copyToIntTxBuffer(zdev_t *dev, zbuf_t *buf, u8_t *src, + u16_t offset, u16_t length) { - u16_t i; + u16_t i; - for(i=0; idata+offset+i) = src[i]; - } + for (i = 0; i < length; i++) { + /* zmw_tx_buf_writeb(dev, buf, offset+i, src[i]); */ + *(u8_t *)((u8_t *)buf->data+offset+i) = src[i]; + } } -u16_t zfwStaAddIeWpaRsn(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t frameType) +u16_t zfwStaAddIeWpaRsn(zdev_t *dev, zbuf_t *buf, u16_t offset, u8_t frameType) { - struct usbdrv_private *macp = dev->ml_priv; - //zm_msg1_mm(ZM_LV_0, "CWY - add wpaie content Length : ", macp->supIe[1]); - if (macp->supIe[1] != 0) - { - copyToIntTxBuffer(dev, buf, macp->supIe, offset, macp->supIe[1]+2); - //memcpy(buf->data[offset], macp->supIe, macp->supIe[1]+2); - offset += (macp->supIe[1]+2); - } - - return offset; + struct usbdrv_private *macp = dev->ml_priv; + /* zm_msg1_mm(ZM_LV_0, "CWY - add wpaie content Length : " + * , macp->supIe[1]); + */ + if (macp->supIe[1] != 0) { + copyToIntTxBuffer(dev, buf, macp->supIe, offset, + macp->supIe[1]+2); + /* memcpy(buf->data[offset], macp->supIe, macp->supIe[1]+2);*/ + offset += (macp->supIe[1]+2); + } + + return offset; } /* Leave an empty line below to remove warning message on some compiler */ diff --git a/drivers/staging/otus/wrap_usb.c b/drivers/staging/otus/wrap_usb.c index 70fd410bc894..6b336ede8867 100644 --- a/drivers/staging/otus/wrap_usb.c +++ b/drivers/staging/otus/wrap_usb.c @@ -30,159 +30,152 @@ #include #include -extern void zfLnxInitUsbTxQ(zdev_t* dev); -extern void zfLnxInitUsbRxQ(zdev_t* dev); +extern void zfLnxInitUsbTxQ(zdev_t *dev); +extern void zfLnxInitUsbRxQ(zdev_t *dev); extern u32_t zfLnxSubmitRegInUrb(zdev_t *dev); -u32_t zfLnxUsbOut(zdev_t* dev, u8_t *hdr, u16_t hdrlen, u8_t *snap, u16_t snapLen, - u8_t *tail, u16_t tailLen, zbuf_t *buf, u16_t offset); -u32_t zfLnxUsbWriteReg(zdev_t* dev, u32_t* cmd, u16_t cmdLen); +u32_t zfLnxUsbOut(zdev_t *dev, u8_t *hdr, u16_t hdrlen, u8_t *snap, + u16_t snapLen, u8_t *tail, u16_t tailLen, zbuf_t *buf, + u16_t offset); +u32_t zfLnxUsbWriteReg(zdev_t *dev, u32_t *cmd, u16_t cmdLen); -void zfwUsbRegisterCallBack(zdev_t* dev, struct zfCbUsbFuncTbl *zfUsbFunc) { - struct usbdrv_private *macp = dev->ml_priv; +void zfwUsbRegisterCallBack(zdev_t *dev, struct zfCbUsbFuncTbl *zfUsbFunc) +{ + struct usbdrv_private *macp = dev->ml_priv; - macp->usbCbFunctions.zfcbUsbRecv = zfUsbFunc->zfcbUsbRecv; - macp->usbCbFunctions.zfcbUsbRegIn = zfUsbFunc->zfcbUsbRegIn; - macp->usbCbFunctions.zfcbUsbOutComplete = zfUsbFunc->zfcbUsbOutComplete; + macp->usbCbFunctions.zfcbUsbRecv = zfUsbFunc->zfcbUsbRecv; + macp->usbCbFunctions.zfcbUsbRegIn = zfUsbFunc->zfcbUsbRegIn; + macp->usbCbFunctions.zfcbUsbOutComplete = zfUsbFunc->zfcbUsbOutComplete; - return; + return; } -u32_t zfwUsbGetFreeTxQSize(zdev_t* dev) +u32_t zfwUsbGetFreeTxQSize(zdev_t *dev) { - struct usbdrv_private *macp = dev->ml_priv; - u32_t freeTxQSize; - unsigned long irqFlag; - //zmw_declare_for_critical_section(); + struct usbdrv_private *macp = dev->ml_priv; + u32_t freeTxQSize; + unsigned long irqFlag; + /* zmw_declare_for_critical_section(); */ - //zmw_enter_critical_section(dev); - spin_lock_irqsave(&macp->cs_lock, irqFlag); + /* zmw_enter_critical_section(dev); */ + spin_lock_irqsave(&macp->cs_lock, irqFlag); - freeTxQSize = ZM_MAX_TX_BUF_NUM - macp->TxBufCnt; + freeTxQSize = ZM_MAX_TX_BUF_NUM - macp->TxBufCnt; - //zmw_leave_critical_section(dev); - spin_unlock_irqrestore(&macp->cs_lock, irqFlag); + /* zmw_leave_critical_section(dev); */ + spin_unlock_irqrestore(&macp->cs_lock, irqFlag); - return freeTxQSize; + return freeTxQSize; } -u32_t zfwUsbGetMaxTxQSize(zdev_t* dev) +u32_t zfwUsbGetMaxTxQSize(zdev_t *dev) { - return ZM_MAX_TX_BUF_NUM; + return ZM_MAX_TX_BUF_NUM; } u32_t zfwUsbEnableIntEpt(zdev_t *dev, u8_t endpt) { - /* Initialize USB TxQ */ - zfLnxInitUsbTxQ(dev); + /* Initialize USB TxQ */ + zfLnxInitUsbTxQ(dev); - /* Initialize USB RxQ */ - zfLnxInitUsbRxQ(dev); + /* Initialize USB RxQ */ + zfLnxInitUsbRxQ(dev); - /* Initialize USB Register In URB */ - //zfwUsbSubmitRegIn(dev); - /* Initialize USB Register In URB */ - zfLnxSubmitRegInUrb(dev); + /* Initialize USB Register In URB */ + /* zfwUsbSubmitRegIn(dev); */ + /* Initialize USB Register In URB */ + zfLnxSubmitRegInUrb(dev); - return 0; + return 0; } -int zfwUsbEnableRxEpt(zdev_t* dev, u8_t endpt) +int zfwUsbEnableRxEpt(zdev_t *dev, u8_t endpt) { - return 0; + return 0; } -u32_t zfwUsbSubmitControl(zdev_t* dev, u8_t req, u16_t value, u16_t index, void *data, u32_t size) +u32_t zfwUsbSubmitControl(zdev_t *dev, u8_t req, u16_t value, u16_t index, + void *data, u32_t size) { - int result = 0; - u32_t ret = 0; - struct usbdrv_private *macp = dev->ml_priv; - u8_t* buf; - - if (size > 0) - { - buf = kmalloc(size, GFP_KERNEL); - memcpy(buf, (u8_t*)data, size); - } - else - { - buf = NULL; - } + int result = 0; + u32_t ret = 0; + struct usbdrv_private *macp = dev->ml_priv; + u8_t *buf; + + if (size > 0) { + buf = kmalloc(size, GFP_KERNEL); + memcpy(buf, (u8_t *)data, size); + } else + buf = NULL; #if 0 - printk(KERN_ERR "req = 0x%02x\n", req); - printk(KERN_ERR "value = 0x%04x\n", value); - printk(KERN_ERR "index = 0x%04x\n", index); - printk(KERN_ERR "data = 0x%lx\n", (u32_t) data); - printk(KERN_ERR "size = %ld\n", size); + printk(KERN_ERR "req = 0x%02x\n", req); + printk(KERN_ERR "value = 0x%04x\n", value); + printk(KERN_ERR "index = 0x%04x\n", index); + printk(KERN_ERR "data = 0x%lx\n", (u32_t) data); + printk(KERN_ERR "size = %ld\n", size); #endif - result = usb_control_msg(macp->udev, usb_sndctrlpipe(macp->udev, 0), - req, USB_DIR_OUT | 0x40, value, index, buf, size, HZ); + result = usb_control_msg(macp->udev, usb_sndctrlpipe(macp->udev, 0), + req, USB_DIR_OUT | 0x40, value, index, buf, size, HZ); - if (result < 0) - { - printk("zfwUsbSubmitControl() failed, result=0x%x\n", result); - ret = 1; - } - kfree(buf); + if (result < 0) { + printk(KERN_ERR "zfwUsbSubmitControl() failed, result = 0x%x\n", + result); + ret = 1; + } + kfree(buf); - return ret; + return ret; } -void zfwUsbCmd(zdev_t* dev, u8_t endpt, u32_t* cmd, u16_t cmdLen) +void zfwUsbCmd(zdev_t *dev, u8_t endpt, u32_t *cmd, u16_t cmdLen) { - struct usbdrv_private *macp = dev->ml_priv; - u32_t ret; - - //MPUsbCommand(dev, endpt, cmd, cmdLen); - ret = zfLnxUsbWriteReg(dev, cmd, cmdLen); - - /* if zfLnxUsbWriteReg() return error, free and allocate urb, resend again */ - if (ret != 0) - { - usb_free_urb(macp->RegOutUrb); - macp->RegOutUrb = usb_alloc_urb(0, GFP_ATOMIC); - ret = zfLnxUsbWriteReg(dev, cmd, cmdLen); - } + struct usbdrv_private *macp = dev->ml_priv; + u32_t ret; + + /* MPUsbCommand(dev, endpt, cmd, cmdLen); */ + ret = zfLnxUsbWriteReg(dev, cmd, cmdLen); + + /* + * if zfLnxUsbWriteReg() return error, free and allocate urb, + * resend again + */ + if (ret != 0) { + usb_free_urb(macp->RegOutUrb); + macp->RegOutUrb = usb_alloc_urb(0, GFP_ATOMIC); + ret = zfLnxUsbWriteReg(dev, cmd, cmdLen); + } } -u32_t zfwUsbSend(zdev_t* dev, u8_t endpt, u8_t *hdr, u16_t hdrlen, u8_t *snap, u16_t snapLen, - u8_t *tail, u16_t tailLen, zbuf_t *buf, u16_t offset) +u32_t zfwUsbSend(zdev_t *dev, u8_t endpt, u8_t *hdr, u16_t hdrlen, u8_t *snap, + u16_t snapLen, u8_t *tail, u16_t tailLen, + zbuf_t *buf, u16_t offset) { - u32_t status; + u32_t status; #ifdef ZM_CONFIG_BIG_ENDIAN - u32_t ii = 0; - u16_t *pc = NULL; - - pc = (u16_t *)hdr; - for(ii=0; ii<(hdrlen>>1); ii++) - { - pc[ii] = cpu_to_le16(pc[ii]); - } - - pc = (u16_t *)snap; - for(ii=0; ii<(snapLen>>1); ii++) - { - pc[ii] = cpu_to_le16(pc[ii]); - } - - pc = (u16_t *)tail; - for(ii=0; ii<(tailLen>>1); ii++) - { - pc[ii] = cpu_to_le16(pc[ii]); - } + u32_t ii = 0; + u16_t *pc = NULL; + + pc = (u16_t *)hdr; + for (ii = 0; ii < (hdrlen >> 1); ii++) + pc[ii] = cpu_to_le16(pc[ii]); + + pc = (u16_t *)snap; + for (ii = 0; ii < (snapLen >> 1); ii++) + pc[ii] = cpu_to_le16(pc[ii]); + + pc = (u16_t *)tail; + for (ii = 0; ii < (tailLen>>1); ii++) + pc[ii] = cpu_to_le16(pc[ii]); #endif - status = zfLnxUsbOut(dev, hdr, hdrlen, snap, snapLen, tail, tailLen, buf, offset); - if ( status == 0 ) - { - return 0; - } - else - { - return 1; - } + status = zfLnxUsbOut(dev, hdr, hdrlen, snap, snapLen, tail, tailLen, + buf, offset); + if (status == 0) + return 0; + else + return 1; } /* Leave an empty line below to remove warning message on some compiler */ -- GitLab From fbedb45f6a547901781d23d0e70ef77e0724cb1c Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Wed, 21 Oct 2009 22:43:51 +0200 Subject: [PATCH 146/235] Staging: rt28x0: remove unused ->eewrite methods Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/common/ee_efuse.c | 17 --------- drivers/staging/rt2860/common/ee_prom.c | 48 ------------------------ drivers/staging/rt2860/common/eeprom.c | 3 -- drivers/staging/rt2860/eeprom.h | 15 -------- drivers/staging/rt2860/rtmp.h | 1 - drivers/staging/rt2860/rtmp_chip.h | 4 -- drivers/staging/rt2870/common/rtusb_io.c | 11 ------ 7 files changed, 99 deletions(-) diff --git a/drivers/staging/rt2860/common/ee_efuse.c b/drivers/staging/rt2860/common/ee_efuse.c index f52224441d23..f29445096cfc 100644 --- a/drivers/staging/rt2860/common/ee_efuse.c +++ b/drivers/staging/rt2860/common/ee_efuse.c @@ -1271,23 +1271,6 @@ int rtmp_ee_efuse_read16( return (*pValue); } - -int rtmp_ee_efuse_write16( - IN RTMP_ADAPTER *pAd, - IN USHORT Offset, - IN USHORT data) -{ - if(pAd->bFroceEEPROMBuffer||pAd->bEEPROMFile) - { - DBGPRINT(RT_DEBUG_TRACE, ("Write to EEPROM Buffer\n")); - NdisMoveMemory(&(pAd->EEPROMImage[Offset]), &data, 2); - } - else - eFuseWriteRegisters(pAd, Offset, 2, &data); - return 0; -} - - int RtmpEfuseSupportCheck( IN RTMP_ADAPTER *pAd) { diff --git a/drivers/staging/rt2860/common/ee_prom.c b/drivers/staging/rt2860/common/ee_prom.c index 9ebff8b9e568..d600e9b829a0 100644 --- a/drivers/staging/rt2860/common/ee_prom.c +++ b/drivers/staging/rt2860/common/ee_prom.c @@ -220,51 +220,3 @@ int rtmp_ee_prom_read16( return NDIS_STATUS_SUCCESS; } - - -int rtmp_ee_prom_write16( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Data) -{ - UINT32 x; - - - Offset /= 2; - - EWEN(pAd); - - // reset bits and set EECS - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - x &= ~(EEDI | EEDO | EESK); - x |= EECS; - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - - // patch can not access e-Fuse issue - if (!(IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) - { - // kick a pulse - RaiseClock(pAd, &x); - LowerClock(pAd, &x); - } - - // output the read_opcode ,register number and data in that order - ShiftOutBits(pAd, EEPROM_WRITE_OPCODE, 3); - ShiftOutBits(pAd, Offset, pAd->EEPROMAddressNum); - ShiftOutBits(pAd, Data, 16); // 16-bit access - - // read DO status - RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - - EEpromCleanup(pAd); - - RTMPusecDelay(10000); //delay for twp(MAX)=10ms - - EWDS(pAd); - - EEpromCleanup(pAd); - - - return NDIS_STATUS_SUCCESS; - -} diff --git a/drivers/staging/rt2860/common/eeprom.c b/drivers/staging/rt2860/common/eeprom.c index 03b8454bf74f..d7a2664bb73a 100644 --- a/drivers/staging/rt2860/common/eeprom.c +++ b/drivers/staging/rt2860/common/eeprom.c @@ -66,7 +66,6 @@ INT RtmpChipOpsEepromHook( { pChipOps->eeinit = eFuse_init; pChipOps->eeread = rtmp_ee_efuse_read16; - pChipOps->eewrite = rtmp_ee_efuse_write16; return 0 ; } else @@ -83,14 +82,12 @@ INT RtmpChipOpsEepromHook( case RTMP_DEV_INF_PCI: pChipOps->eeinit = NULL; pChipOps->eeread = rtmp_ee_prom_read16; - pChipOps->eewrite = rtmp_ee_prom_write16; break; #endif // RTMP_PCI_SUPPORT // #ifdef RTMP_USB_SUPPORT case RTMP_DEV_INF_USB: pChipOps->eeinit = NULL; pChipOps->eeread = RTUSBReadEEPROM16; - pChipOps->eewrite = RTUSBWriteEEPROM16; break; #endif // RTMP_USB_SUPPORT // diff --git a/drivers/staging/rt2860/eeprom.h b/drivers/staging/rt2860/eeprom.h index f1aef0c17b00..9979fef97b02 100644 --- a/drivers/staging/rt2860/eeprom.h +++ b/drivers/staging/rt2860/eeprom.h @@ -48,11 +48,6 @@ int rtmp_ee_prom_read16( IN PRTMP_ADAPTER pAd, IN USHORT Offset, OUT USHORT *pValue); - -int rtmp_ee_prom_write16( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT value); #endif // RTMP_PCI_SUPPORT // #ifdef RTMP_USB_SUPPORT /************************************************************************* @@ -62,11 +57,6 @@ NTSTATUS RTUSBReadEEPROM16( IN PRTMP_ADAPTER pAd, IN USHORT offset, OUT PUSHORT pData); - -NTSTATUS RTUSBWriteEEPROM16( - IN RTMP_ADAPTER *pAd, - IN USHORT offset, - IN USHORT value); #endif // RTMP_USB_SUPPORT // #ifdef RT30xx @@ -75,11 +65,6 @@ int rtmp_ee_efuse_read16( IN RTMP_ADAPTER *pAd, IN USHORT Offset, OUT USHORT *pValue); - -int rtmp_ee_efuse_write16( - IN RTMP_ADAPTER *pAd, - IN USHORT Offset, - IN USHORT data); #endif // RTMP_EFUSE_SUPPORT // #endif // RT30xx // diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h index 12b14654e67e..3e284f241fc2 100644 --- a/drivers/staging/rt2860/rtmp.h +++ b/drivers/staging/rt2860/rtmp.h @@ -1790,7 +1790,6 @@ struct _RTMP_CHIP_OP_ /* Calibration access related callback functions */ int (*eeinit)(RTMP_ADAPTER *pAd); /* int (*eeinit)(RTMP_ADAPTER *pAd); */ int (*eeread)(RTMP_ADAPTER *pAd, USHORT offset, PUSHORT pValue); /* int (*eeread)(RTMP_ADAPTER *pAd, int offset, PUSHORT pValue); */ - int (*eewrite)(RTMP_ADAPTER *pAd, USHORT offset, USHORT value);; /* int (*eewrite)(RTMP_ADAPTER *pAd, int offset, USHORT value); */ /* MCU related callback functions */ int (*loadFirmware)(RTMP_ADAPTER *pAd); /* int (*loadFirmware)(RTMP_ADAPTER *pAd); */ diff --git a/drivers/staging/rt2860/rtmp_chip.h b/drivers/staging/rt2860/rtmp_chip.h index 1284a446786e..1098a8547d9d 100644 --- a/drivers/staging/rt2860/rtmp_chip.h +++ b/drivers/staging/rt2860/rtmp_chip.h @@ -167,10 +167,6 @@ #define RT28xx_EEPROM_READ16(_pAd, _offset, _value) \ (_pAd)->chipOps.eeread((RTMP_ADAPTER *)(_pAd), (USHORT)(_offset), (PUSHORT)&(_value)) -#define RT28xx_EEPROM_WRITE16(_pAd, _offset, _value) \ - (_pAd)->chipOps.eewrite((RTMP_ADAPTER *)(_pAd), (USHORT)(_offset), (USHORT)(_value)) - - // ------------------------------------------------------------------- // E2PROM data layout diff --git a/drivers/staging/rt2870/common/rtusb_io.c b/drivers/staging/rt2870/common/rtusb_io.c index a93fde5e5725..b01a24ac251c 100644 --- a/drivers/staging/rt2870/common/rtusb_io.c +++ b/drivers/staging/rt2870/common/rtusb_io.c @@ -619,17 +619,6 @@ NTSTATUS RTUSBReadEEPROM16( } -NTSTATUS RTUSBWriteEEPROM16( - IN RTMP_ADAPTER *pAd, - IN USHORT offset, - IN USHORT value) -{ - USHORT tmpVal; - - tmpVal = cpu2le16(value); - return RTUSBWriteEEPROM(pAd, offset, (PUCHAR)&(tmpVal), 2); -} - /* ======================================================================== -- GitLab From abf1794e698d9bbdade846ef6ffd23b247cfb59f Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Wed, 21 Oct 2009 22:43:57 +0200 Subject: [PATCH 147/235] Staging: rt28x0: remove unused code from common/ee_efuse-c Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/common/ee_efuse.c | 340 ----------------------- drivers/staging/rt2860/rtmp.h | 12 - 2 files changed, 352 deletions(-) diff --git a/drivers/staging/rt2860/common/ee_efuse.c b/drivers/staging/rt2860/common/ee_efuse.c index f29445096cfc..5807cc4ff968 100644 --- a/drivers/staging/rt2860/common/ee_efuse.c +++ b/drivers/staging/rt2860/common/ee_efuse.c @@ -67,31 +67,6 @@ typedef union _EFUSE_CTRL_STRUC { UINT32 word; } EFUSE_CTRL_STRUC, *PEFUSE_CTRL_STRUC; -static UCHAR eFuseReadRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - OUT USHORT* pData); - -static VOID eFuseReadPhysical( - IN PRTMP_ADAPTER pAd, - IN PUSHORT lpInBuffer, - IN ULONG nInBufferSize, - OUT PUSHORT lpOutBuffer, - IN ULONG nOutBufferSize); - -static VOID eFusePhysicalWriteRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - OUT USHORT* pData); - -static NTSTATUS eFuseWriteRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - IN USHORT* pData); - static VOID eFuseWritePhysical( IN PRTMP_ADAPTER pAd, PUSHORT lpInBuffer, @@ -293,37 +268,6 @@ static VOID eFuseReadPhysical( } } -/* -======================================================================== - - Routine Description: - - Arguments: - - Return Value: - - Note: - -======================================================================== -*/ -NTSTATUS eFuseRead( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - OUT PUCHAR pData, - IN USHORT Length) -{ - USHORT* pOutBuf = (USHORT*)pData; - NTSTATUS Status = STATUS_SUCCESS; - UCHAR EFSROM_AOUT; - int i; - - for(i=0; i48*16-3(reserved)=2FC - for (i=EFUSE_USAGE_MAP_START; i<=EFUSE_USAGE_MAP_END; i+=2) - { - //Retrive the logical block nubmer form each logical address pointer - //It will access two logical address pointer each time. - eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); - if( (LogicalAddress & 0xff) == 0) - {//Not used logical address pointer - BlkNum = i-EFUSE_USAGE_MAP_START; - break; - } - else if(( (LogicalAddress >> 8) & 0xff) == 0) - {//Not used logical address pointer - if (i != EFUSE_USAGE_MAP_END) - { - BlkNum = i-EFUSE_USAGE_MAP_START+1; - } - break; - } - } - } - else - { - BlkNum = EFSROM_AOUT; - } - - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters BlkNum = %d \n", BlkNum)); - - if(BlkNum == 0xffff) - { - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters: out of free E-fuse space!!!\n")); - return FALSE; - } - - //Step 1. Save data of this block which is pointed by the avaible logical address pointer - // read and save the original block data - for(i =0; i<8; i++) - { - addr = BlkNum * 0x10 ; - - InBuf[0] = addr+2*i; - InBuf[1] = 2; - InBuf[2] = 0x0; - - eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); - - buffer[i] = InBuf[2]; - } - - //Step 2. Update the data in buffer, and write the data to Efuse - buffer[ (Offset >> 1) % 8] = pData[0]; - - do - { Loop++; - //Step 3. Write the data to Efuse - if(!bWriteSuccess) - { - for(i =0; i<8; i++) - { - addr = BlkNum * 0x10 ; - - InBuf[0] = addr+2*i; - InBuf[1] = 2; - InBuf[2] = buffer[i]; - - eFuseWritePhysical(pAd, &InBuf[0], 6, NULL, 2); - } - } - else - { - addr = BlkNum * 0x10 ; - - InBuf[0] = addr+(Offset % 16); - InBuf[1] = 2; - InBuf[2] = pData[0]; - - eFuseWritePhysical(pAd, &InBuf[0], 6, NULL, 2); - } - - //Step 4. Write mapping table - addr = EFUSE_USAGE_MAP_START+BlkNum; - - tmpaddr = addr; - - if(addr % 2 != 0) - addr = addr -1; - InBuf[0] = addr; - InBuf[1] = 2; - - //convert the address from 10 to 8 bit ( bit7, 6 = parity and bit5 ~ 0 = bit9~4), and write to logical map entry - tmpOffset = Offset; - tmpOffset >>= 4; - tmpOffset |= ((~((tmpOffset & 0x01) ^ ( tmpOffset >> 1 & 0x01) ^ (tmpOffset >> 2 & 0x01) ^ (tmpOffset >> 3 & 0x01))) << 6) & 0x40; - tmpOffset |= ((~( (tmpOffset >> 2 & 0x01) ^ (tmpOffset >> 3 & 0x01) ^ (tmpOffset >> 4 & 0x01) ^ ( tmpOffset >> 5 & 0x01))) << 7) & 0x80; - - // write the logical address - if(tmpaddr%2 != 0) - InBuf[2] = tmpOffset<<8; - else - InBuf[2] = tmpOffset; - - eFuseWritePhysical(pAd,&InBuf[0], 6, NULL, 0); - - //Step 5. Compare data if not the same, invalidate the mapping entry, then re-write the data until E-fuse is exhausted - bWriteSuccess = TRUE; - for(i =0; i<8; i++) - { - addr = BlkNum * 0x10 ; - - InBuf[0] = addr+2*i; - InBuf[1] = 2; - InBuf[2] = 0x0; - - eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); - - if(buffer[i] != InBuf[2]) - { - bWriteSuccess = FALSE; - break; - } - } - - //Step 6. invlidate mapping entry and find a free mapping entry if not succeed - if (!bWriteSuccess) - { - DBGPRINT(RT_DEBUG_TRACE, ("Not bWriteSuccess BlkNum = %d\n", BlkNum)); - - // the offset of current mapping entry - addr = EFUSE_USAGE_MAP_START+BlkNum; - - //find a new mapping entry - BlkNum = 0xffff; - for (i=EFUSE_USAGE_MAP_START; i<=EFUSE_USAGE_MAP_END; i+=2) - { - eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); - if( (LogicalAddress & 0xff) == 0) - { - BlkNum = i-EFUSE_USAGE_MAP_START; - break; - } - else if(( (LogicalAddress >> 8) & 0xff) == 0) - { - if (i != EFUSE_USAGE_MAP_END) - { - BlkNum = i+1-EFUSE_USAGE_MAP_START; - } - break; - } - } - DBGPRINT(RT_DEBUG_TRACE, ("Not bWriteSuccess new BlkNum = %d\n", BlkNum)); - if(BlkNum == 0xffff) - { - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters: out of free E-fuse space!!!\n")); - return FALSE; - } - - //invalidate the original mapping entry if new entry is not found - tmpaddr = addr; - - if(addr % 2 != 0) - addr = addr -1; - InBuf[0] = addr; - InBuf[1] = 2; - - eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); - - // write the logical address - if(tmpaddr%2 != 0) - { - // Invalidate the high byte - for (i=8; i<15; i++) - { - if( ( (InBuf[2] >> i) & 0x01) == 0) - { - InBuf[2] |= (0x1 <> i) & 0x01) == 0) - { - InBuf[2] |= (0x1 < #endif // RTMP_EFUSE_SUPPORT // -- GitLab From 468d0c507b9c11a2e3ae95ff149eb551d05be8b9 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Wed, 21 Oct 2009 22:44:05 +0200 Subject: [PATCH 148/235] Staging: rt28x0: remove private RTPRIV_IOCTL_SET ioctl Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/sta_ioctl.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/rt2860/sta_ioctl.c b/drivers/staging/rt2860/sta_ioctl.c index e5e294284108..b6ba561bfb5f 100644 --- a/drivers/staging/rt2860/sta_ioctl.c +++ b/drivers/staging/rt2860/sta_ioctl.c @@ -2978,6 +2978,7 @@ INT rt28xx_sta_ioctl( case SIOCSIWRETRY: //set retry limits and lifetime case RT_PRIV_IOCTL: case RT_PRIV_IOCTL_EXT: + case RTPRIV_IOCTL_SET: Status = -EOPNOTSUPP; break; case SIOCGIWPRIV: @@ -2990,11 +2991,6 @@ INT rt28xx_sta_ioctl( Status = -EFAULT; } break; - case RTPRIV_IOCTL_SET: - if(access_ok(VERIFY_READ, wrq->u.data.pointer, wrq->u.data.length) != TRUE) - break; - rt_ioctl_setparam(net_dev, NULL, NULL, wrq->u.data.pointer); - break; case RTPRIV_IOCTL_GSITESURVEY: RTMPIoctlGetSiteSurvey(pAd, wrq); break; -- GitLab From 725fef147b29eaf37aaee6e80c2c19c5c9c4bff9 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Wed, 21 Oct 2009 22:44:12 +0200 Subject: [PATCH 149/235] Staging: rt28x0: remove private RTPRIV_IOCTL_GSITESURVEY ioctl Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/common/cmm_info.c | 57 ------------------------ drivers/staging/rt2860/rtmp.h | 12 ----- drivers/staging/rt2860/sta_ioctl.c | 4 +- 3 files changed, 1 insertion(+), 72 deletions(-) diff --git a/drivers/staging/rt2860/common/cmm_info.c b/drivers/staging/rt2860/common/cmm_info.c index 49e9bdfad3da..0f4aab9394b8 100644 --- a/drivers/staging/rt2860/common/cmm_info.c +++ b/drivers/staging/rt2860/common/cmm_info.c @@ -1969,63 +1969,6 @@ VOID RTMPCommSiteSurveyData( return; } -VOID RTMPIoctlGetSiteSurvey( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq) -{ - PSTRING msg; - INT i=0; - INT WaitCnt; - INT Status=0; - INT max_len = LINE_LEN; - PBSS_ENTRY pBss; - - - os_alloc_mem(NULL, (PUCHAR *)&msg, sizeof(CHAR)*((MAX_LEN_OF_BSS_TABLE)*max_len)); - - if (msg == NULL) - { - DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - msg memory alloc fail.\n")); - return; - } - - memset(msg, 0 ,(MAX_LEN_OF_BSS_TABLE)*max_len ); - sprintf(msg,"%s","\n"); - sprintf(msg+strlen(msg),"%-4s%-33s%-20s%-23s%-9s%-7s%-7s%-3s\n", - "Ch", "SSID", "BSSID", "Security", "Siganl(%)", "W-Mode", " ExtCH"," NT"); - - - - WaitCnt = 0; - pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE; - while ((ScanRunning(pAdapter) == TRUE) && (WaitCnt++ < 200)) - OS_WAIT(500); - - for(i=0; iScanTab.BssNr ;i++) - { - pBss = &pAdapter->ScanTab.BssEntry[i]; - - if( pBss->Channel==0) - break; - - if((strlen(msg)+max_len ) >= IW_SCAN_MAX_DATA) - break; - - - RTMPCommSiteSurveyData(msg, pBss); - - - } - - pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE; - wrq->u.data.length = strlen(msg); - Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length); - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - wrq->u.data.length = %d\n", wrq->u.data.length)); - os_free_mem(NULL, (PUCHAR)msg); -} - - #define MAC_LINE_LEN (14+4+4+10+10+10+6+6) // Addr+aid+psm+datatime+rxbyte+txbyte+current tx rate+last tx rate VOID RTMPIoctlGetMacTable( IN PRTMP_ADAPTER pAd, diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h index c9e3045b3a60..32e553a946b4 100644 --- a/drivers/staging/rt2860/rtmp.h +++ b/drivers/staging/rt2860/rtmp.h @@ -4991,18 +4991,6 @@ PNDIS_PACKET RTMPDeFragmentDataFrame( IN PRTMP_ADAPTER pAd, IN RX_BLK *pRxBlk); -//////////////////////////////////////// - -VOID RTMPIoctlGetSiteSurvey( - IN PRTMP_ADAPTER pAdapter, - IN struct iwreq *wrq); - - - - - - - enum { DIDmsg_lnxind_wlansniffrm = 0x00000044, DIDmsg_lnxind_wlansniffrm_hosttime = 0x00010044, diff --git a/drivers/staging/rt2860/sta_ioctl.c b/drivers/staging/rt2860/sta_ioctl.c index b6ba561bfb5f..a3aeb1ea63a3 100644 --- a/drivers/staging/rt2860/sta_ioctl.c +++ b/drivers/staging/rt2860/sta_ioctl.c @@ -2979,6 +2979,7 @@ INT rt28xx_sta_ioctl( case RT_PRIV_IOCTL: case RT_PRIV_IOCTL_EXT: case RTPRIV_IOCTL_SET: + case RTPRIV_IOCTL_GSITESURVEY: Status = -EOPNOTSUPP; break; case SIOCGIWPRIV: @@ -2991,9 +2992,6 @@ INT rt28xx_sta_ioctl( Status = -EFAULT; } break; - case RTPRIV_IOCTL_GSITESURVEY: - RTMPIoctlGetSiteSurvey(pAd, wrq); - break; case SIOCETHTOOL: break; default: -- GitLab From 4c96e89320b6327e8967c31761cc0730cace8b4c Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Wed, 21 Oct 2009 22:44:19 +0200 Subject: [PATCH 150/235] Staging: rt28x0: remove private WEXT handlers Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/common/cmm_info.c | 3980 +++++----------------- drivers/staging/rt2860/rtmp.h | 204 -- drivers/staging/rt2860/sta_ioctl.c | 1305 +------ 3 files changed, 767 insertions(+), 4722 deletions(-) diff --git a/drivers/staging/rt2860/common/cmm_info.c b/drivers/staging/rt2860/common/cmm_info.c index 0f4aab9394b8..3c47b810355f 100644 --- a/drivers/staging/rt2860/common/cmm_info.c +++ b/drivers/staging/rt2860/common/cmm_info.c @@ -28,3378 +28,930 @@ #include #include "../rt_config.h" -INT Show_SSID_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_WirelessMode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_TxBurst_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_TxPreamble_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_TxPower_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_Channel_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_BGProtection_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_RTSThreshold_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_FragThreshold_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtBw_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtMcs_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtGi_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtOpMode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtExtcha_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtMpduDensity_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtBaWinSize_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtRdg_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtAmsdu_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_HtAutoBa_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_CountryRegion_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_CountryRegionABand_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_CountryCode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -#ifdef AGGREGATION_SUPPORT -INT Show_PktAggregate_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); -#endif // AGGREGATION_SUPPORT // - -#ifdef WMM_SUPPORT -INT Show_WmmCapable_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); -#endif // WMM_SUPPORT // - -INT Show_IEEE80211H_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_NetworkType_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_AuthMode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_EncrypType_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_DefaultKeyID_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_Key1_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_Key2_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_Key3_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_Key4_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -INT Show_WPAPSK_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf); - -static struct { - PSTRING name; - INT (*show_proc)(PRTMP_ADAPTER pAdapter, PSTRING arg); -} *PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC, RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC[] = { - {"SSID", Show_SSID_Proc}, - {"WirelessMode", Show_WirelessMode_Proc}, - {"TxBurst", Show_TxBurst_Proc}, - {"TxPreamble", Show_TxPreamble_Proc}, - {"TxPower", Show_TxPower_Proc}, - {"Channel", Show_Channel_Proc}, - {"BGProtection", Show_BGProtection_Proc}, - {"RTSThreshold", Show_RTSThreshold_Proc}, - {"FragThreshold", Show_FragThreshold_Proc}, - {"HtBw", Show_HtBw_Proc}, - {"HtMcs", Show_HtMcs_Proc}, - {"HtGi", Show_HtGi_Proc}, - {"HtOpMode", Show_HtOpMode_Proc}, - {"HtExtcha", Show_HtExtcha_Proc}, - {"HtMpduDensity", Show_HtMpduDensity_Proc}, - {"HtBaWinSize", Show_HtBaWinSize_Proc}, - {"HtRdg", Show_HtRdg_Proc}, - {"HtAmsdu", Show_HtAmsdu_Proc}, - {"HtAutoBa", Show_HtAutoBa_Proc}, - {"CountryRegion", Show_CountryRegion_Proc}, - {"CountryRegionABand", Show_CountryRegionABand_Proc}, - {"CountryCode", Show_CountryCode_Proc}, -#ifdef AGGREGATION_SUPPORT - {"PktAggregate", Show_PktAggregate_Proc}, -#endif - -#ifdef WMM_SUPPORT - {"WmmCapable", Show_WmmCapable_Proc}, -#endif - {"IEEE80211H", Show_IEEE80211H_Proc}, - {"NetworkType", Show_NetworkType_Proc}, - {"AuthMode", Show_AuthMode_Proc}, - {"EncrypType", Show_EncrypType_Proc}, - {"DefaultKeyID", Show_DefaultKeyID_Proc}, - {"Key1", Show_Key1_Proc}, - {"Key2", Show_Key2_Proc}, - {"Key3", Show_Key3_Proc}, - {"Key4", Show_Key4_Proc}, - {"WPAPSK", Show_WPAPSK_Proc}, - {NULL, NULL} -}; - -/* - ========================================================================== - Description: - Get Driver version. - - Return: - ========================================================================== -*/ -INT Set_DriverVersion_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - - DBGPRINT(RT_DEBUG_TRACE, ("Driver version-%s\n", STA_DRIVER_VERSION)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Country Region. - This command will not work, if the field of CountryRegion in eeprom is programmed. - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_CountryRegion_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - int retval; - - - retval = RT_CfgSetCountryRegion(pAd, arg, BAND_24G); - if (retval == FALSE) - return FALSE; - - // if set country region, driver needs to be reset - BuildChannelList(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegion_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegion)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Country Region for A band. - This command will not work, if the field of CountryRegion in eeprom is programmed. - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_CountryRegionABand_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - int retval; - - - retval = RT_CfgSetCountryRegion(pAd, arg, BAND_5G); - if (retval == FALSE) - return FALSE; - - // if set country region, driver needs to be reset - BuildChannelList(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegionABand_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegionForABand)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Wireless Mode - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_WirelessMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - INT success = TRUE; - - success = RT_CfgSetWirelessMode(pAd, arg); - if (success) - { - { - LONG WirelessMode = pAd->CommonCfg.PhyMode; - - RTMPSetPhyMode(pAd, WirelessMode); - if (WirelessMode >= PHY_11ABGN_MIXED) - { - pAd->CommonCfg.BACapability.field.AutoBA = TRUE; - pAd->CommonCfg.REGBACapability.field.AutoBA = TRUE; - } - else - { - pAd->CommonCfg.BACapability.field.AutoBA = FALSE; - pAd->CommonCfg.REGBACapability.field.AutoBA = FALSE; - } - - // Set AdhocMode rates - if (pAd->StaCfg.BssType == BSS_ADHOC) - { - MlmeUpdateTxRates(pAd, FALSE, 0); - MakeIbssBeacon(pAd); // re-build BEACON frame - AsicEnableIbssSync(pAd); // copy to on-chip memory - } - } - - // it is needed to set SSID to take effect - SetCommonHT(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("Set_WirelessMode_Proc::(=%d)\n", pAd->CommonCfg.PhyMode)); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("Set_WirelessMode_Proc::parameters out of range\n")); - } - - return success; -} - -/* - ========================================================================== - Description: - Set Channel - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Channel_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - INT success = TRUE; - UCHAR Channel; - - Channel = (UCHAR) simple_strtol(arg, 0, 10); - - // check if this channel is valid - if (ChannelSanity(pAd, Channel) == TRUE) - { - { - pAd->CommonCfg.Channel = Channel; - - if (MONITOR_ON(pAd)) - { - N_ChannelCheck(pAd); - if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED && - pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40) - { - N_SetCenCh(pAd); - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - DBGPRINT(RT_DEBUG_TRACE, ("BW_40, control_channel(%d), CentralChannel(%d) \n", - pAd->CommonCfg.Channel, pAd->CommonCfg.CentralChannel)); - } - else - { - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - DBGPRINT(RT_DEBUG_TRACE, ("BW_20, Channel(%d)\n", pAd->CommonCfg.Channel)); - } - } - } - success = TRUE; - } - else - { - success = FALSE; - } - - - if (success == TRUE) - DBGPRINT(RT_DEBUG_TRACE, ("Set_Channel_Proc::(Channel=%d)\n", pAd->CommonCfg.Channel)); - - return success; -} - -/* - ========================================================================== - Description: - Set Short Slot Time Enable or Disable - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_ShortSlot_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - int retval; - - retval = RT_CfgSetShortSlot(pAd, arg); - if (retval == TRUE) - DBGPRINT(RT_DEBUG_TRACE, ("Set_ShortSlot_Proc::(ShortSlot=%d)\n", pAd->CommonCfg.bUseShortSlotTime)); - - return retval; -} - - -/* - ========================================================================== - Description: - Set Tx power - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_TxPower_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - LONG TxPower; - INT success = FALSE; - - TxPower = simple_strtol(arg, 0, 10); - if (TxPower <= 100) - { - { - pAd->CommonCfg.TxPowerDefault = TxPower; - pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault; - } - success = TRUE; - } - else - success = FALSE; - - DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPower_Proc::(TxPowerPercentage=%ld)\n", pAd->CommonCfg.TxPowerPercentage)); - - return success; -} - -/* - ========================================================================== - Description: - Set 11B/11G Protection - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_BGProtection_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - switch (simple_strtol(arg, 0, 10)) - { - case 0: //AUTO - pAd->CommonCfg.UseBGProtection = 0; - break; - case 1: //Always On - pAd->CommonCfg.UseBGProtection = 1; - break; - case 2: //Always OFF - pAd->CommonCfg.UseBGProtection = 2; - break; - default: //Invalid argument - return FALSE; - } - - - DBGPRINT(RT_DEBUG_TRACE, ("Set_BGProtection_Proc::(BGProtection=%ld)\n", pAd->CommonCfg.UseBGProtection)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set TxPreamble - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_TxPreamble_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - RT_802_11_PREAMBLE Preamble; - - Preamble = simple_strtol(arg, 0, 10); - - - switch (Preamble) - { - case Rt802_11PreambleShort: - pAd->CommonCfg.TxPreamble = Preamble; - - MlmeSetTxPreamble(pAd, Rt802_11PreambleShort); - break; - case Rt802_11PreambleLong: - case Rt802_11PreambleAuto: - // if user wants AUTO, initialize to LONG here, then change according to AP's - // capability upon association. - pAd->CommonCfg.TxPreamble = Preamble; - - MlmeSetTxPreamble(pAd, Rt802_11PreambleLong); - break; - default: //Invalid argument - return FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPreamble_Proc::(TxPreamble=%ld)\n", pAd->CommonCfg.TxPreamble)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set RTS Threshold - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_RTSThreshold_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - NDIS_802_11_RTS_THRESHOLD RtsThresh; - - RtsThresh = simple_strtol(arg, 0, 10); - - if((RtsThresh > 0) && (RtsThresh <= MAX_RTS_THRESHOLD)) - pAd->CommonCfg.RtsThreshold = (USHORT)RtsThresh; - else if (RtsThresh == 0) - pAd->CommonCfg.RtsThreshold = MAX_RTS_THRESHOLD; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_RTSThreshold_Proc::(RTSThreshold=%d)\n", pAd->CommonCfg.RtsThreshold)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Fragment Threshold - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_FragThreshold_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh; - - FragThresh = simple_strtol(arg, 0, 10); - - if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD) - { - //Illegal FragThresh so we set it to default - pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD; - } - else if (FragThresh % 2 == 1) - { - // The length of each fragment shall always be an even number of octets, except for the last fragment - // of an MSDU or MMPDU, which may be either an even or an odd number of octets. - pAd->CommonCfg.FragmentThreshold = (USHORT)(FragThresh - 1); - } - else - { - pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh; - } - - { - if (pAd->CommonCfg.FragmentThreshold == MAX_FRAG_THRESHOLD) - pAd->CommonCfg.bUseZeroToDisableFragment = TRUE; - else - pAd->CommonCfg.bUseZeroToDisableFragment = FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("Set_FragThreshold_Proc::(FragThreshold=%d)\n", pAd->CommonCfg.FragmentThreshold)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set TxBurst - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_TxBurst_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - LONG TxBurst; - - TxBurst = simple_strtol(arg, 0, 10); - if (TxBurst == 1) - pAd->CommonCfg.bEnableTxBurst = TRUE; - else if (TxBurst == 0) - pAd->CommonCfg.bEnableTxBurst = FALSE; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_TxBurst_Proc::(TxBurst=%d)\n", pAd->CommonCfg.bEnableTxBurst)); - - return TRUE; -} - -#ifdef AGGREGATION_SUPPORT -/* - ========================================================================== - Description: - Set TxBurst - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_PktAggregate_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - LONG aggre; - - aggre = simple_strtol(arg, 0, 10); - - if (aggre == 1) - pAd->CommonCfg.bAggregationCapable = TRUE; - else if (aggre == 0) - pAd->CommonCfg.bAggregationCapable = FALSE; - else - return FALSE; //Invalid argument - - - DBGPRINT(RT_DEBUG_TRACE, ("Set_PktAggregate_Proc::(AGGRE=%d)\n", pAd->CommonCfg.bAggregationCapable)); - - return TRUE; -} -#endif - -/* - ========================================================================== - Description: - Set IEEE80211H. - This parameter is 1 when needs radar detection, otherwise 0 - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_IEEE80211H_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - LONG ieee80211h; - - ieee80211h = simple_strtol(arg, 0, 10); - - if (ieee80211h == 1) - pAd->CommonCfg.bIEEE80211H = TRUE; - else if (ieee80211h == 0) - pAd->CommonCfg.bIEEE80211H = FALSE; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_IEEE80211H_Proc::(IEEE80211H=%d)\n", pAd->CommonCfg.bIEEE80211H)); - - return TRUE; -} - - -#ifdef DBG -/* - ========================================================================== - Description: - For Debug information - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Debug_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - DBGPRINT(RT_DEBUG_TRACE, ("==> Set_Debug_Proc *******************\n")); - - if(simple_strtol(arg, 0, 10) <= RT_DEBUG_LOUD) - RTDebugLevel = simple_strtol(arg, 0, 10); - - DBGPRINT(RT_DEBUG_TRACE, ("<== Set_Debug_Proc(RTDebugLevel = %ld)\n", RTDebugLevel)); - - return TRUE; -} -#endif - -INT Show_DescInfo_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ -#ifdef RTMP_MAC_PCI - INT i, QueIdx=0; -// ULONG RegValue; - PRT28XX_RXD_STRUC pRxD; - PTXD_STRUC pTxD; - PRTMP_TX_RING pTxRing = &pAd->TxRing[QueIdx]; - PRTMP_MGMT_RING pMgmtRing = &pAd->MgmtRing; - PRTMP_RX_RING pRxRing = &pAd->RxRing; - - for(i=0;iCell[i].AllocVa; - DBGPRINT(RT_DEBUG_OFF, ("Desc #%d\n",i)); - hex_dump("Tx Descriptor", (PUCHAR)pTxD, 16); - DBGPRINT(RT_DEBUG_OFF, ("pTxD->DMADONE = %x\n", pTxD->DMADONE)); - } - DBGPRINT(RT_DEBUG_OFF, ("---------------------------------------------------\n")); - for(i=0;iCell[i].AllocVa; - DBGPRINT(RT_DEBUG_OFF, ("Desc #%d\n",i)); - hex_dump("Mgmt Descriptor", (PUCHAR)pTxD, 16); - DBGPRINT(RT_DEBUG_OFF, ("pMgmt->DMADONE = %x\n", pTxD->DMADONE)); - } - DBGPRINT(RT_DEBUG_OFF, ("---------------------------------------------------\n")); - for(i=0;iCell[i].AllocVa; - DBGPRINT(RT_DEBUG_OFF, ("Desc #%d\n",i)); - hex_dump("Rx Descriptor", (PUCHAR)pRxD, 16); - DBGPRINT(RT_DEBUG_OFF, ("pRxD->DDONE = %x\n", pRxD->DDONE)); - } -#endif // RTMP_MAC_PCI // - - return TRUE; -} - -/* - ========================================================================== - Description: - Reset statistics counter - - Arguments: - pAdapter Pointer to our adapter - arg - - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_ResetStatCounter_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - //UCHAR i; - //MAC_TABLE_ENTRY *pEntry; - - DBGPRINT(RT_DEBUG_TRACE, ("==>Set_ResetStatCounter_Proc\n")); - - // add the most up-to-date h/w raw counters into software counters - NICUpdateRawCounters(pAd); - - NdisZeroMemory(&pAd->WlanCounters, sizeof(COUNTER_802_11)); - NdisZeroMemory(&pAd->Counters8023, sizeof(COUNTER_802_3)); - NdisZeroMemory(&pAd->RalinkCounters, sizeof(COUNTER_RALINK)); - - // Reset HotSpot counter - - - return TRUE; -} - -/* - ======================================================================== - - Routine Description: - Add WPA key process. - In Adhoc WPANONE, bPairwise = 0; KeyIdx = 0; - - Arguments: - pAd Pointer to our adapter - pBuf Pointer to the where the key stored - - Return Value: - NDIS_SUCCESS Add key successfully - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ - -BOOLEAN RTMPCheckStrPrintAble( - IN CHAR *pInPutStr, - IN UCHAR strLen) -{ - UCHAR i=0; - - for (i=0; i 0x7E)) - return FALSE; - } - - return TRUE; -} - -/* - ======================================================================== - - Routine Description: - Remove WPA Key process - - Arguments: - pAd Pointer to our adapter - pBuf Pointer to the where the key stored - - Return Value: - NDIS_SUCCESS Add key successfully - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPSetDesiredRates( - IN PRTMP_ADAPTER pAdapter, - IN LONG Rates) -{ - NDIS_802_11_RATES aryRates; - - memset(&aryRates, 0x00, sizeof(NDIS_802_11_RATES)); - switch (pAdapter->CommonCfg.PhyMode) - { - case PHY_11A: // A only - switch (Rates) - { - case 6000000: //6M - aryRates[0] = 0x0c; // 6M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0; - break; - case 9000000: //9M - aryRates[0] = 0x12; // 9M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1; - break; - case 12000000: //12M - aryRates[0] = 0x18; // 12M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2; - break; - case 18000000: //18M - aryRates[0] = 0x24; // 18M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3; - break; - case 24000000: //24M - aryRates[0] = 0x30; // 24M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4; - break; - case 36000000: //36M - aryRates[0] = 0x48; // 36M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5; - break; - case 48000000: //48M - aryRates[0] = 0x60; // 48M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6; - break; - case 54000000: //54M - aryRates[0] = 0x6c; // 54M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7; - break; - case -1: //Auto - default: - aryRates[0] = 0x6c; // 54Mbps - aryRates[1] = 0x60; // 48Mbps - aryRates[2] = 0x48; // 36Mbps - aryRates[3] = 0x30; // 24Mbps - aryRates[4] = 0x24; // 18M - aryRates[5] = 0x18; // 12M - aryRates[6] = 0x12; // 9M - aryRates[7] = 0x0c; // 6M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; - break; - } - break; - case PHY_11BG_MIXED: // B/G Mixed - case PHY_11B: // B only - case PHY_11ABG_MIXED: // A/B/G Mixed - default: - switch (Rates) - { - case 1000000: //1M - aryRates[0] = 0x02; - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0; - break; - case 2000000: //2M - aryRates[0] = 0x04; - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1; - break; - case 5000000: //5.5M - aryRates[0] = 0x0b; // 5.5M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2; - break; - case 11000000: //11M - aryRates[0] = 0x16; // 11M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3; - break; - case 6000000: //6M - aryRates[0] = 0x0c; // 6M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0; - break; - case 9000000: //9M - aryRates[0] = 0x12; // 9M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1; - break; - case 12000000: //12M - aryRates[0] = 0x18; // 12M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2; - break; - case 18000000: //18M - aryRates[0] = 0x24; // 18M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3; - break; - case 24000000: //24M - aryRates[0] = 0x30; // 24M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4; - break; - case 36000000: //36M - aryRates[0] = 0x48; // 36M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5; - break; - case 48000000: //48M - aryRates[0] = 0x60; // 48M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6; - break; - case 54000000: //54M - aryRates[0] = 0x6c; // 54M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7; - break; - case -1: //Auto - default: - if (pAdapter->CommonCfg.PhyMode == PHY_11B) - { //B Only - aryRates[0] = 0x16; // 11Mbps - aryRates[1] = 0x0b; // 5.5Mbps - aryRates[2] = 0x04; // 2Mbps - aryRates[3] = 0x02; // 1Mbps - } - else - { //(B/G) Mixed or (A/B/G) Mixed - aryRates[0] = 0x6c; // 54Mbps - aryRates[1] = 0x60; // 48Mbps - aryRates[2] = 0x48; // 36Mbps - aryRates[3] = 0x30; // 24Mbps - aryRates[4] = 0x16; // 11Mbps - aryRates[5] = 0x0b; // 5.5Mbps - aryRates[6] = 0x04; // 2Mbps - aryRates[7] = 0x02; // 1Mbps - } - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; - break; - } - break; - } - - NdisZeroMemory(pAdapter->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES); - NdisMoveMemory(pAdapter->CommonCfg.DesireRate, &aryRates, sizeof(NDIS_802_11_RATES)); - DBGPRINT(RT_DEBUG_TRACE, (" RTMPSetDesiredRates (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n", - pAdapter->CommonCfg.DesireRate[0],pAdapter->CommonCfg.DesireRate[1], - pAdapter->CommonCfg.DesireRate[2],pAdapter->CommonCfg.DesireRate[3], - pAdapter->CommonCfg.DesireRate[4],pAdapter->CommonCfg.DesireRate[5], - pAdapter->CommonCfg.DesireRate[6],pAdapter->CommonCfg.DesireRate[7] )); - // Changing DesiredRate may affect the MAX TX rate we used to TX frames out - MlmeUpdateTxRates(pAdapter, FALSE, 0); -} - -NDIS_STATUS RTMPWPARemoveKeyProc( - IN PRTMP_ADAPTER pAd, - IN PVOID pBuf) -{ - PNDIS_802_11_REMOVE_KEY pKey; - ULONG KeyIdx; - NDIS_STATUS Status = NDIS_STATUS_FAILURE; - BOOLEAN bTxKey; // Set the key as transmit key - BOOLEAN bPairwise; // Indicate the key is pairwise key - BOOLEAN bKeyRSC; // indicate the receive SC set by KeyRSC value. - // Otherwise, it will set by the NIC. - BOOLEAN bAuthenticator; // indicate key is set by authenticator. - INT i; - - DBGPRINT(RT_DEBUG_TRACE,("---> RTMPWPARemoveKeyProc\n")); - - pKey = (PNDIS_802_11_REMOVE_KEY) pBuf; - KeyIdx = pKey->KeyIndex & 0xff; - // Bit 31 of Add-key, Tx Key - bTxKey = (pKey->KeyIndex & 0x80000000) ? TRUE : FALSE; - // Bit 30 of Add-key PairwiseKey - bPairwise = (pKey->KeyIndex & 0x40000000) ? TRUE : FALSE; - // Bit 29 of Add-key KeyRSC - bKeyRSC = (pKey->KeyIndex & 0x20000000) ? TRUE : FALSE; - // Bit 28 of Add-key Authenticator - bAuthenticator = (pKey->KeyIndex & 0x10000000) ? TRUE : FALSE; - - // 1. If bTx is TRUE, return failure information - if (bTxKey == TRUE) - return(NDIS_STATUS_INVALID_DATA); - - // 2. Check Pairwise Key - if (bPairwise) - { - // a. If BSSID is broadcast, remove all pairwise keys. - // b. If not broadcast, remove the pairwise specified by BSSID - for (i = 0; i < SHARE_KEY_NUM; i++) - { - if (MAC_ADDR_EQUAL(pAd->SharedKey[BSS0][i].BssId, pKey->BSSID)) - { - DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%d)\n", i)); - pAd->SharedKey[BSS0][i].KeyLen = 0; - pAd->SharedKey[BSS0][i].CipherAlg = CIPHER_NONE; - AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)i); - Status = NDIS_STATUS_SUCCESS; - break; - } - } - } - // 3. Group Key - else - { - // a. If BSSID is broadcast, remove all group keys indexed - // b. If BSSID matched, delete the group key indexed. - DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%ld)\n", KeyIdx)); - pAd->SharedKey[BSS0][KeyIdx].KeyLen = 0; - pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE; - AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)KeyIdx); - Status = NDIS_STATUS_SUCCESS; - } - - return (Status); -} - -/* - ======================================================================== - - Routine Description: - Remove All WPA Keys - - Arguments: - pAd Pointer to our adapter - - Return Value: - None - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -VOID RTMPWPARemoveAllKeys( - IN PRTMP_ADAPTER pAd) -{ - - UCHAR i; - - DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus)); - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); - // For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after - // Link up. And it will be replaced if user changed it. - if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA) - return; - - // For WPA-None, there is no need to remove it, since WinXP won't set it again after - // Link up. And it will be replaced if user changed it. - if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) - return; - - // set BSSID wcid entry of the Pair-wise Key table as no-security mode - AsicRemovePairwiseKeyEntry(pAd, BSS0, BSSID_WCID); - - // set all shared key mode as no-security. - for (i = 0; i < SHARE_KEY_NUM; i++) - { - DBGPRINT(RT_DEBUG_TRACE,("remove %s key #%d\n", CipherName[pAd->SharedKey[BSS0][i].CipherAlg], i)); - NdisZeroMemory(&pAd->SharedKey[BSS0][i], sizeof(CIPHER_KEY)); - - AsicRemoveSharedKeyEntry(pAd, BSS0, i); - } - RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); -} - - -/* - ======================================================================== - - Routine Description: - As STA's BSSID is a WC too, it uses shared key table. - This function write correct unicast TX key to ASIC WCID. - And we still make a copy in our MacTab.Content[BSSID_WCID].PairwiseKey. - Caller guarantee TKIP/AES always has keyidx = 0. (pairwise key) - Caller guarantee WEP calls this function when set Txkey, default key index=0~3. - - Arguments: - pAd Pointer to our adapter - pKey Pointer to the where the key stored - - Return Value: - NDIS_SUCCESS Add key successfully - - IRQL = DISPATCH_LEVEL - - Note: - - ======================================================================== -*/ -/* - ======================================================================== - Routine Description: - Change NIC PHY mode. Re-association may be necessary. possible settings - include - PHY_11B, PHY_11BG_MIXED, PHY_11A, and PHY_11ABG_MIXED - - Arguments: - pAd - Pointer to our adapter - phymode - - - IRQL = PASSIVE_LEVEL - IRQL = DISPATCH_LEVEL - - ======================================================================== -*/ -VOID RTMPSetPhyMode( - IN PRTMP_ADAPTER pAd, - IN ULONG phymode) -{ - INT i; - // the selected phymode must be supported by the RF IC encoded in E2PROM - - // if no change, do nothing - /* bug fix - if (pAd->CommonCfg.PhyMode == phymode) - return; - */ - pAd->CommonCfg.PhyMode = (UCHAR)phymode; - - DBGPRINT(RT_DEBUG_TRACE,("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", pAd->CommonCfg.PhyMode, pAd->CommonCfg.Channel)); - - BuildChannelList(pAd); - - // sanity check user setting - for (i = 0; i < pAd->ChannelListNum; i++) - { - if (pAd->CommonCfg.Channel == pAd->ChannelList[i].Channel) - break; - } - - if (i == pAd->ChannelListNum) - { - pAd->CommonCfg.Channel = FirstChannel(pAd); - DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetPhyMode: channel is out of range, use first channel=%d \n", pAd->CommonCfg.Channel)); - } - - NdisZeroMemory(pAd->CommonCfg.SupRate, MAX_LEN_OF_SUPPORTED_RATES); - NdisZeroMemory(pAd->CommonCfg.ExtRate, MAX_LEN_OF_SUPPORTED_RATES); - NdisZeroMemory(pAd->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES); - switch (phymode) { - case PHY_11B: - pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRateLen = 4; - pAd->CommonCfg.ExtRateLen = 0; - pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps - //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use - break; - - case PHY_11G: - case PHY_11BG_MIXED: - case PHY_11ABG_MIXED: - case PHY_11N_2_4G: - case PHY_11ABGN_MIXED: - case PHY_11BGN_MIXED: - case PHY_11GN_MIXED: - pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[4] = 0x12; // 9 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[5] = 0x24; // 18 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[6] = 0x48; // 36 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRateLen = 8; - pAd->CommonCfg.ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps - pAd->CommonCfg.ExtRate[1] = 0x18; // 12 mbps, in units of 0.5 Mbps - pAd->CommonCfg.ExtRate[2] = 0x30; // 24 mbps, in units of 0.5 Mbps - pAd->CommonCfg.ExtRate[3] = 0x60; // 48 mbps, in units of 0.5 Mbps - pAd->CommonCfg.ExtRateLen = 4; - pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[4] = 12; // 6 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[5] = 18; // 9 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[6] = 24; // 12 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[7] = 36; // 18 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[8] = 48; // 24 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[9] = 72; // 36 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[10] = 96; // 48 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[11] = 108; // 54 mbps, in units of 0.5 Mbps - break; - - case PHY_11A: - case PHY_11AN_MIXED: - case PHY_11AGN_MIXED: - case PHY_11N_5G: - pAd->CommonCfg.SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRateLen = 8; - pAd->CommonCfg.ExtRateLen = 0; - pAd->CommonCfg.DesireRate[0] = 12; // 6 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[1] = 18; // 9 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[2] = 24; // 12 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[3] = 36; // 18 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[4] = 48; // 24 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[5] = 72; // 36 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[6] = 96; // 48 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[7] = 108; // 54 mbps, in units of 0.5 Mbps - //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use - break; - - default: - break; - } - - - pAd->CommonCfg.BandState = UNKNOWN_BAND; -} - -/* - ======================================================================== - Routine Description: - Caller ensures we has 802.11n support. - Calls at setting HT from AP/STASetinformation - - Arguments: - pAd - Pointer to our adapter - phymode - - - ======================================================================== -*/ -VOID RTMPSetHT( - IN PRTMP_ADAPTER pAd, - IN OID_SET_HT_PHYMODE *pHTPhyMode) -{ - //ULONG *pmcs; - UINT32 Value = 0; - UCHAR BBPValue = 0; - UCHAR BBP3Value = 0; - UCHAR RxStream = pAd->CommonCfg.RxStream; - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n", - pHTPhyMode->HtMode, pHTPhyMode->ExtOffset, - pHTPhyMode->MCS, pHTPhyMode->BW, - pHTPhyMode->STBC, pHTPhyMode->SHORTGI)); - - // Don't zero supportedHyPhy structure. - RTMPZeroMemory(&pAd->CommonCfg.HtCapability, sizeof(pAd->CommonCfg.HtCapability)); - RTMPZeroMemory(&pAd->CommonCfg.AddHTInfo, sizeof(pAd->CommonCfg.AddHTInfo)); - RTMPZeroMemory(&pAd->CommonCfg.NewExtChanOffset, sizeof(pAd->CommonCfg.NewExtChanOffset)); - RTMPZeroMemory(&pAd->CommonCfg.DesiredHtPhy, sizeof(pAd->CommonCfg.DesiredHtPhy)); - - if (pAd->CommonCfg.bRdg) - { - pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 1; - pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 1; - } - else - { - pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 0; - pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 0; - } - - pAd->CommonCfg.HtCapability.HtCapParm.MaxRAmpduFactor = 3; - pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor = 3; - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : RxBAWinLimit = %d\n", pAd->CommonCfg.BACapability.field.RxBAWinLimit)); - - // Mimo power save, A-MSDU size, - pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable; - pAd->CommonCfg.DesiredHtPhy.AmsduSize = (UCHAR)pAd->CommonCfg.BACapability.field.AmsduSize; - pAd->CommonCfg.DesiredHtPhy.MimoPs = (UCHAR)pAd->CommonCfg.BACapability.field.MMPSmode; - pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity; - - pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize; - pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode; - pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity; - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n", - pAd->CommonCfg.DesiredHtPhy.AmsduSize, - pAd->CommonCfg.DesiredHtPhy.MimoPs, - pAd->CommonCfg.DesiredHtPhy.MpduDensity, - pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor)); - - if(pHTPhyMode->HtMode == HTMODE_GF) - { - pAd->CommonCfg.HtCapability.HtCapInfo.GF = 1; - pAd->CommonCfg.DesiredHtPhy.GF = 1; - } - else - pAd->CommonCfg.DesiredHtPhy.GF = 0; - - // Decide Rx MCSSet - switch (RxStream) - { - case 1: - pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff; - pAd->CommonCfg.HtCapability.MCSSet[1] = 0x00; - break; - - case 2: - pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff; - pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff; - break; - - case 3: // 3*3 - pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff; - pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff; - pAd->CommonCfg.HtCapability.MCSSet[2] = 0xff; - break; - } - - if (pAd->CommonCfg.bForty_Mhz_Intolerant && (pAd->CommonCfg.Channel <= 14) && (pHTPhyMode->BW == BW_40) ) - { - pHTPhyMode->BW = BW_20; - pAd->CommonCfg.HtCapability.HtCapInfo.Forty_Mhz_Intolerant = 1; - } - - if(pHTPhyMode->BW == BW_40) - { - pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; // MCS 32 - pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 1; - if (pAd->CommonCfg.Channel <= 14) - pAd->CommonCfg.HtCapability.HtCapInfo.CCKmodein40 = 1; - - pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 1; - pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 1; - pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = (pHTPhyMode->ExtOffset == EXTCHA_BELOW)? (EXTCHA_BELOW): EXTCHA_ABOVE; - // Set Regsiter for extension channel position. - RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value); - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBP3Value); - if ((pHTPhyMode->ExtOffset == EXTCHA_BELOW)) - { - Value |= 0x1; - BBP3Value |= (0x20); - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); - } - else if ((pHTPhyMode->ExtOffset == EXTCHA_ABOVE)) - { - Value &= 0xfe; - BBP3Value &= (~0x20); - RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); - } - - // Turn on BBP 40MHz mode now only as AP . - // Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection. - if ((pAd->OpMode == OPMODE_AP) || INFRA_ON(pAd) || ADHOC_ON(pAd) - ) - { - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue &= (~0x18); - BBPValue |= 0x10; - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBP3Value); - pAd->CommonCfg.BBPCurrentBW = BW_40; - } - } - else - { - pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 0; - pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 0; - pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 0; - pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = EXTCHA_NONE; - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; - // Turn on BBP 20MHz mode by request here. - { - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue &= (~0x18); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - pAd->CommonCfg.BBPCurrentBW = BW_20; - } - } - - if(pHTPhyMode->STBC == STBC_USE) - { - pAd->CommonCfg.HtCapability.HtCapInfo.TxSTBC = 1; - pAd->CommonCfg.DesiredHtPhy.TxSTBC = 1; - pAd->CommonCfg.HtCapability.HtCapInfo.RxSTBC = 1; - pAd->CommonCfg.DesiredHtPhy.RxSTBC = 1; - } - else - { - pAd->CommonCfg.DesiredHtPhy.TxSTBC = 0; - pAd->CommonCfg.DesiredHtPhy.RxSTBC = 0; - } - - if(pHTPhyMode->SHORTGI == GI_400) - { - pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 1; - pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 1; - pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 1; - pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 1; - } - else - { - pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 0; - pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 0; - pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 0; - pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 0; - } - - // We support link adaptation for unsolicit MCS feedback, set to 2. - pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; //MCSFBK_UNSOLICIT; - pAd->CommonCfg.AddHTInfo.ControlChan = pAd->CommonCfg.Channel; - // 1, the extension channel above the control channel. - - // EDCA parameters used for AP's own transmission - if (pAd->CommonCfg.APEdcaParm.bValid == FALSE) - { - pAd->CommonCfg.APEdcaParm.bValid = TRUE; - pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3; - pAd->CommonCfg.APEdcaParm.Aifsn[1] = 7; - pAd->CommonCfg.APEdcaParm.Aifsn[2] = 1; - pAd->CommonCfg.APEdcaParm.Aifsn[3] = 1; - - pAd->CommonCfg.APEdcaParm.Cwmin[0] = 4; - pAd->CommonCfg.APEdcaParm.Cwmin[1] = 4; - pAd->CommonCfg.APEdcaParm.Cwmin[2] = 3; - pAd->CommonCfg.APEdcaParm.Cwmin[3] = 2; - - pAd->CommonCfg.APEdcaParm.Cwmax[0] = 6; - pAd->CommonCfg.APEdcaParm.Cwmax[1] = 10; - pAd->CommonCfg.APEdcaParm.Cwmax[2] = 4; - pAd->CommonCfg.APEdcaParm.Cwmax[3] = 3; - - pAd->CommonCfg.APEdcaParm.Txop[0] = 0; - pAd->CommonCfg.APEdcaParm.Txop[1] = 0; - pAd->CommonCfg.APEdcaParm.Txop[2] = 94; - pAd->CommonCfg.APEdcaParm.Txop[3] = 47; - } - AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm); - - { - RTMPSetIndividualHT(pAd, 0); - } - -} - -/* - ======================================================================== - Routine Description: - Caller ensures we has 802.11n support. - Calls at setting HT from AP/STASetinformation - - Arguments: - pAd - Pointer to our adapter - phymode - - - ======================================================================== -*/ -VOID RTMPSetIndividualHT( - IN PRTMP_ADAPTER pAd, - IN UCHAR apidx) -{ - PRT_HT_PHY_INFO pDesired_ht_phy = NULL; - UCHAR TxStream = pAd->CommonCfg.TxStream; - UCHAR DesiredMcs = MCS_AUTO; - - do - { - { - pDesired_ht_phy = &pAd->StaCfg.DesiredHtPhyInfo; - DesiredMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS; - //pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE; - break; - } - } while (FALSE); - - if (pDesired_ht_phy == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetIndividualHT: invalid apidx(%d)\n", apidx)); - return; - } - RTMPZeroMemory(pDesired_ht_phy, sizeof(RT_HT_PHY_INFO)); - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs)); - // Check the validity of MCS - if ((TxStream == 1) && ((DesiredMcs >= MCS_8) && (DesiredMcs <= MCS_15))) - { - DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS(%d) is invalid in 1S, reset it as MCS_7\n", DesiredMcs)); - DesiredMcs = MCS_7; - } - - if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_20) && (DesiredMcs == MCS_32)) - { - DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS_32 is only supported in 40-MHz, reset it as MCS_0\n")); - DesiredMcs = MCS_0; - } - - pDesired_ht_phy->bHtEnable = TRUE; - - // Decide desired Tx MCS - switch (TxStream) - { - case 1: - if (DesiredMcs == MCS_AUTO) - { - pDesired_ht_phy->MCSSet[0]= 0xff; - pDesired_ht_phy->MCSSet[1]= 0x00; - } - else if (DesiredMcs <= MCS_7) - { - pDesired_ht_phy->MCSSet[0]= 1<MCSSet[1]= 0x00; - } - break; - - case 2: - if (DesiredMcs == MCS_AUTO) - { - pDesired_ht_phy->MCSSet[0]= 0xff; - pDesired_ht_phy->MCSSet[1]= 0xff; - } - else if (DesiredMcs <= MCS_15) - { - ULONG mode; - - mode = DesiredMcs / 8; - if (mode < 2) - pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8)); - } - break; - - case 3: // 3*3 - if (DesiredMcs == MCS_AUTO) - { - /* MCS0 ~ MCS23, 3 bytes */ - pDesired_ht_phy->MCSSet[0]= 0xff; - pDesired_ht_phy->MCSSet[1]= 0xff; - pDesired_ht_phy->MCSSet[2]= 0xff; - } - else if (DesiredMcs <= MCS_23) - { - ULONG mode; - - mode = DesiredMcs / 8; - if (mode < 3) - pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8)); - } - break; - } - - if(pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_40) - { - if (DesiredMcs == MCS_AUTO || DesiredMcs == MCS_32) - pDesired_ht_phy->MCSSet[4] = 0x1; - } - - // update HT Rate setting - if (pAd->OpMode == OPMODE_STA) - MlmeUpdateHtTxRates(pAd, BSS0); - else - MlmeUpdateHtTxRates(pAd, apidx); -} - - -/* - ======================================================================== - Routine Description: - Update HT IE from our capability. - - Arguments: - Send all HT IE in beacon/probe rsp/assoc rsp/action frame. - - - ======================================================================== -*/ -VOID RTMPUpdateHTIE( - IN RT_HT_CAPABILITY *pRtHt, - IN UCHAR *pMcsSet, - OUT HT_CAPABILITY_IE *pHtCapability, - OUT ADD_HT_INFO_IE *pAddHtInfo) -{ - RTMPZeroMemory(pHtCapability, sizeof(HT_CAPABILITY_IE)); - RTMPZeroMemory(pAddHtInfo, sizeof(ADD_HT_INFO_IE)); - - pHtCapability->HtCapInfo.ChannelWidth = pRtHt->ChannelWidth; - pHtCapability->HtCapInfo.MimoPs = pRtHt->MimoPs; - pHtCapability->HtCapInfo.GF = pRtHt->GF; - pHtCapability->HtCapInfo.ShortGIfor20 = pRtHt->ShortGIfor20; - pHtCapability->HtCapInfo.ShortGIfor40 = pRtHt->ShortGIfor40; - pHtCapability->HtCapInfo.TxSTBC = pRtHt->TxSTBC; - pHtCapability->HtCapInfo.RxSTBC = pRtHt->RxSTBC; - pHtCapability->HtCapInfo.AMsduSize = pRtHt->AmsduSize; - pHtCapability->HtCapParm.MaxRAmpduFactor = pRtHt->MaxRAmpduFactor; - pHtCapability->HtCapParm.MpduDensity = pRtHt->MpduDensity; - - pAddHtInfo->AddHtInfo.ExtChanOffset = pRtHt->ExtChanOffset ; - pAddHtInfo->AddHtInfo.RecomWidth = pRtHt->RecomWidth; - pAddHtInfo->AddHtInfo2.OperaionMode = pRtHt->OperaionMode; - pAddHtInfo->AddHtInfo2.NonGfPresent = pRtHt->NonGfPresent; - RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet*/pMcsSet, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar. - - DBGPRINT(RT_DEBUG_TRACE,("RTMPUpdateHTIE <== \n")); -} - -/* - ======================================================================== - Description: - Add Client security information into ASIC WCID table and IVEIV table. - Return: - ======================================================================== -*/ -VOID RTMPAddWcidAttributeEntry( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssIdx, - IN UCHAR KeyIdx, - IN UCHAR CipherAlg, - IN MAC_TABLE_ENTRY *pEntry) -{ - UINT32 WCIDAttri = 0; - USHORT offset; - UCHAR IVEIV = 0; - USHORT Wcid = 0; - - { - { - if (BssIdx > BSS0) - { - DBGPRINT(RT_DEBUG_ERROR, ("RTMPAddWcidAttributeEntry: The BSS-index(%d) is out of range for Infra link. \n", BssIdx)); - return; - } - - // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists. - // 2. In Infra mode, the AID:1 MUST be wcid of infra STA. - // the AID:2~ assign to mesh link entry. - if (pEntry) - Wcid = pEntry->Aid; - else - Wcid = MCAST_WCID; - } - } - - // Update WCID attribute table - offset = MAC_WCID_ATTRIBUTE_BASE + (Wcid * HW_WCID_ATTRI_SIZE); - - { - if (pEntry && pEntry->ValidAsMesh) - WCIDAttri = (CipherAlg<<1) | PAIRWISEKEYTABLE; - else - WCIDAttri = (CipherAlg<<1) | SHAREDKEYTABLE; - } - - RTMP_IO_WRITE32(pAd, offset, WCIDAttri); - - - // Update IV/EIV table - offset = MAC_IVEIV_TABLE_BASE + (Wcid * HW_IVEIV_ENTRY_SIZE); - - // WPA mode - if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) || (CipherAlg == CIPHER_AES)) - { - // Eiv bit on. keyid always is 0 for pairwise key - IVEIV = (KeyIdx <<6) | 0x20; - } - else - { - // WEP KeyIdx is default tx key. - IVEIV = (KeyIdx << 6); - } - - // For key index and ext IV bit, so only need to update the position(offset+3). -#ifdef RTMP_MAC_PCI - RTMP_IO_WRITE8(pAd, offset+3, IVEIV); -#endif // RTMP_MAC_PCI // -#ifdef RTMP_MAC_USB - RTUSBMultiWrite_OneByte(pAd, offset+3, &IVEIV); -#endif // RTMP_MAC_USB // - - DBGPRINT(RT_DEBUG_TRACE,("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",Wcid, KeyIdx, CipherName[CipherAlg])); - DBGPRINT(RT_DEBUG_TRACE,(" WCIDAttri = 0x%x \n", WCIDAttri)); - -} - -/* - ========================================================================== - Description: - Parse encryption type -Arguments: - pAdapter Pointer to our adapter - wrq Pointer to the ioctl argument - - Return Value: - None - - Note: - ========================================================================== -*/ -PSTRING GetEncryptType(CHAR enc) -{ - if(enc == Ndis802_11WEPDisabled) - return "NONE"; - if(enc == Ndis802_11WEPEnabled) - return "WEP"; - if(enc == Ndis802_11Encryption2Enabled) - return "TKIP"; - if(enc == Ndis802_11Encryption3Enabled) - return "AES"; - if(enc == Ndis802_11Encryption4Enabled) - return "TKIPAES"; - else - return "UNKNOW"; -} - -PSTRING GetAuthMode(CHAR auth) -{ - if(auth == Ndis802_11AuthModeOpen) - return "OPEN"; - if(auth == Ndis802_11AuthModeShared) - return "SHARED"; - if(auth == Ndis802_11AuthModeAutoSwitch) - return "AUTOWEP"; - if(auth == Ndis802_11AuthModeWPA) - return "WPA"; - if(auth == Ndis802_11AuthModeWPAPSK) - return "WPAPSK"; - if(auth == Ndis802_11AuthModeWPANone) - return "WPANONE"; - if(auth == Ndis802_11AuthModeWPA2) - return "WPA2"; - if(auth == Ndis802_11AuthModeWPA2PSK) - return "WPA2PSK"; - if(auth == Ndis802_11AuthModeWPA1WPA2) - return "WPA1WPA2"; - if(auth == Ndis802_11AuthModeWPA1PSKWPA2PSK) - return "WPA1PSKWPA2PSK"; - - return "UNKNOW"; -} - -/* - ========================================================================== - Description: - Get site survey results - Arguments: - pAdapter Pointer to our adapter - wrq Pointer to the ioctl argument - - Return Value: - None - - Note: - Usage: - 1.) UI needs to wait 4 seconds after issue a site survey command - 2.) iwpriv ra0 get_site_survey - 3.) UI needs to prepare at least 4096bytes to get the results - ========================================================================== -*/ -#define LINE_LEN (4+33+20+23+9+7+7+3) // Channel+SSID+Bssid+Security+Signal+WiressMode+ExtCh+NetworkType -VOID RTMPCommSiteSurveyData( - IN PSTRING msg, - IN PBSS_ENTRY pBss) -{ - INT Rssi = 0; - UINT Rssi_Quality = 0; - NDIS_802_11_NETWORK_TYPE wireless_mode; - CHAR Ssid[MAX_LEN_OF_SSID +1]; - STRING SecurityStr[32] = {0}; - NDIS_802_11_ENCRYPTION_STATUS ap_cipher = Ndis802_11EncryptionDisabled; - NDIS_802_11_AUTHENTICATION_MODE ap_auth_mode = Ndis802_11AuthModeOpen; - - memset(Ssid, 0 ,(MAX_LEN_OF_SSID +1)); - - //Channel - sprintf(msg+strlen(msg),"%-4d", pBss->Channel); - //SSID - memcpy(Ssid, pBss->Ssid, pBss->SsidLen); - Ssid[pBss->SsidLen] = '\0'; - sprintf(msg+strlen(msg),"%-33s", Ssid); - //BSSID - sprintf(msg+strlen(msg),"%02x:%02x:%02x:%02x:%02x:%02x ", - pBss->Bssid[0], - pBss->Bssid[1], - pBss->Bssid[2], - pBss->Bssid[3], - pBss->Bssid[4], - pBss->Bssid[5]); - - //Security - if ((Ndis802_11AuthModeWPA <= pBss->AuthMode) && - (pBss->AuthMode <= Ndis802_11AuthModeWPA1PSKWPA2PSK)) - { - if (pBss->AuthModeAux == Ndis802_11AuthModeWPANone) - { - ap_auth_mode = pBss->AuthMode; - if (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled) - ap_cipher = pBss->WPA.PairCipher; - else - ap_cipher = Ndis802_11Encryption4Enabled; - } - else if (pBss->AuthModeAux == Ndis802_11AuthModeOpen) - { - ap_auth_mode = pBss->AuthMode; - if ((ap_auth_mode == Ndis802_11AuthModeWPA) || - (ap_auth_mode == Ndis802_11AuthModeWPAPSK)) - { - if (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled) - ap_cipher = pBss->WPA.PairCipher; - else - ap_cipher = Ndis802_11Encryption4Enabled; - } - else if ((ap_auth_mode == Ndis802_11AuthModeWPA2) || - (ap_auth_mode == Ndis802_11AuthModeWPA2PSK)) - { - if (pBss->WPA2.PairCipherAux == Ndis802_11WEPDisabled) - ap_cipher = pBss->WPA2.PairCipher; - else - ap_cipher = Ndis802_11Encryption4Enabled; - } - } - else if ((pBss->AuthMode == Ndis802_11AuthModeWPAPSK) || - (pBss->AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - if ((pBss->AuthModeAux == Ndis802_11AuthModeWPAPSK) || - (pBss->AuthModeAux == Ndis802_11AuthModeWPA2PSK)) - ap_auth_mode = Ndis802_11AuthModeWPA1PSKWPA2PSK; - else - ap_auth_mode = pBss->AuthMode; - - if (pBss->WPA.PairCipher != pBss->WPA2.PairCipher) - ap_cipher = Ndis802_11Encryption4Enabled; - else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && - (pBss->WPA.PairCipherAux != pBss->WPA2.PairCipherAux)) - ap_cipher = Ndis802_11Encryption4Enabled; - else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && - (pBss->WPA.PairCipherAux == pBss->WPA2.PairCipherAux) && - (pBss->WPA.PairCipherAux != Ndis802_11WEPDisabled)) - ap_cipher = Ndis802_11Encryption4Enabled; - else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && - (pBss->WPA.PairCipherAux == pBss->WPA2.PairCipherAux) && - (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled)) - ap_cipher = pBss->WPA.PairCipher; - } - else if ((pBss->AuthMode == Ndis802_11AuthModeWPA) || - (pBss->AuthMode == Ndis802_11AuthModeWPA2)) - { - if ((pBss->AuthModeAux == Ndis802_11AuthModeWPA) || - (pBss->AuthMode == Ndis802_11AuthModeWPA2)) - ap_auth_mode = Ndis802_11AuthModeWPA1WPA2; - else - ap_auth_mode = pBss->AuthMode; - - if (pBss->WPA.PairCipher != pBss->WPA2.PairCipher) - ap_cipher = Ndis802_11Encryption4Enabled; - else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && - (pBss->WPA.PairCipherAux != pBss->WPA2.PairCipherAux)) - ap_cipher = Ndis802_11Encryption4Enabled; - else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && - (pBss->WPA.PairCipherAux == pBss->WPA2.PairCipherAux) && - (pBss->WPA.PairCipherAux != Ndis802_11WEPDisabled)) - ap_cipher = Ndis802_11Encryption4Enabled; - else if ((pBss->WPA.PairCipher == pBss->WPA2.PairCipher) && - (pBss->WPA.PairCipherAux == pBss->WPA2.PairCipherAux) && - (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled)) - ap_cipher = pBss->WPA.PairCipher; - } - - sprintf(SecurityStr, "%s/%s", GetAuthMode((CHAR)ap_auth_mode), GetEncryptType((CHAR)ap_cipher)); - } - else - { - ap_auth_mode = pBss->AuthMode; - ap_cipher = pBss->WepStatus; - if (ap_cipher == Ndis802_11WEPDisabled) - sprintf(SecurityStr, "NONE"); - else if (ap_cipher == Ndis802_11WEPEnabled) - sprintf(SecurityStr, "WEP"); - else - sprintf(SecurityStr, "%s/%s", GetAuthMode((CHAR)ap_auth_mode), GetEncryptType((CHAR)ap_cipher)); - } - - sprintf(msg+strlen(msg), "%-23s", SecurityStr); - - // Rssi - Rssi = (INT)pBss->Rssi; - if (Rssi >= -50) - Rssi_Quality = 100; - else if (Rssi >= -80) // between -50 ~ -80dbm - Rssi_Quality = (UINT)(24 + ((Rssi + 80) * 26)/10); - else if (Rssi >= -90) // between -80 ~ -90dbm - Rssi_Quality = (UINT)(((Rssi + 90) * 26)/10); - else // < -84 dbm - Rssi_Quality = 0; - sprintf(msg+strlen(msg),"%-9d", Rssi_Quality); - // Wireless Mode - wireless_mode = NetworkTypeInUseSanity(pBss); - if (wireless_mode == Ndis802_11FH || - wireless_mode == Ndis802_11DS) - sprintf(msg+strlen(msg),"%-7s", "11b"); - else if (wireless_mode == Ndis802_11OFDM5) - sprintf(msg+strlen(msg),"%-7s", "11a"); - else if (wireless_mode == Ndis802_11OFDM5_N) - sprintf(msg+strlen(msg),"%-7s", "11a/n"); - else if (wireless_mode == Ndis802_11OFDM24) - sprintf(msg+strlen(msg),"%-7s", "11b/g"); - else if (wireless_mode == Ndis802_11OFDM24_N) - sprintf(msg+strlen(msg),"%-7s", "11b/g/n"); - else - sprintf(msg+strlen(msg),"%-7s", "unknow"); - - // Ext Channel - if (pBss->AddHtInfoLen > 0) - { - if (pBss->AddHtInfo.AddHtInfo.ExtChanOffset == EXTCHA_ABOVE) - sprintf(msg+strlen(msg),"%-7s", " ABOVE"); - else if (pBss->AddHtInfo.AddHtInfo.ExtChanOffset == EXTCHA_BELOW) - sprintf(msg+strlen(msg),"%-7s", " BELOW"); - else - sprintf(msg+strlen(msg),"%-7s", " NONE"); - } - else - { - sprintf(msg+strlen(msg),"%-7s", " NONE"); - } - - //Network Type - if (pBss->BssType == BSS_ADHOC) - sprintf(msg+strlen(msg),"%-3s", " Ad"); - else - sprintf(msg+strlen(msg),"%-3s", " In"); - - sprintf(msg+strlen(msg),"\n"); - - return; -} - -#define MAC_LINE_LEN (14+4+4+10+10+10+6+6) // Addr+aid+psm+datatime+rxbyte+txbyte+current tx rate+last tx rate -VOID RTMPIoctlGetMacTable( - IN PRTMP_ADAPTER pAd, - IN struct iwreq *wrq) -{ - INT i; - RT_802_11_MAC_TABLE MacTab; - char *msg; - - MacTab.Num = 0; - for (i=0; iMacTab.Content[i].ValidAsCLI && (pAd->MacTab.Content[i].Sst == SST_ASSOC)) - { - COPY_MAC_ADDR(MacTab.Entry[MacTab.Num].Addr, &pAd->MacTab.Content[i].Addr); - MacTab.Entry[MacTab.Num].Aid = (UCHAR)pAd->MacTab.Content[i].Aid; - MacTab.Entry[MacTab.Num].Psm = pAd->MacTab.Content[i].PsMode; - MacTab.Entry[MacTab.Num].MimoPs = pAd->MacTab.Content[i].MmpsMode; - - // Fill in RSSI per entry - MacTab.Entry[MacTab.Num].AvgRssi0 = pAd->MacTab.Content[i].RssiSample.AvgRssi0; - MacTab.Entry[MacTab.Num].AvgRssi1 = pAd->MacTab.Content[i].RssiSample.AvgRssi1; - MacTab.Entry[MacTab.Num].AvgRssi2 = pAd->MacTab.Content[i].RssiSample.AvgRssi2; - - // the connected time per entry - MacTab.Entry[MacTab.Num].ConnectedTime = pAd->MacTab.Content[i].StaConnectTime; - MacTab.Entry[MacTab.Num].TxRate.field.MCS = pAd->MacTab.Content[i].HTPhyMode.field.MCS; - MacTab.Entry[MacTab.Num].TxRate.field.BW = pAd->MacTab.Content[i].HTPhyMode.field.BW; - MacTab.Entry[MacTab.Num].TxRate.field.ShortGI = pAd->MacTab.Content[i].HTPhyMode.field.ShortGI; - MacTab.Entry[MacTab.Num].TxRate.field.STBC = pAd->MacTab.Content[i].HTPhyMode.field.STBC; - MacTab.Entry[MacTab.Num].TxRate.field.rsv = pAd->MacTab.Content[i].HTPhyMode.field.rsv; - MacTab.Entry[MacTab.Num].TxRate.field.MODE = pAd->MacTab.Content[i].HTPhyMode.field.MODE; - MacTab.Entry[MacTab.Num].TxRate.word = pAd->MacTab.Content[i].HTPhyMode.word; - - MacTab.Num += 1; - } - } - wrq->u.data.length = sizeof(RT_802_11_MAC_TABLE); - if (copy_to_user(wrq->u.data.pointer, &MacTab, wrq->u.data.length)) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s: copy_to_user() fail\n", __func__)); - } - - msg = kmalloc(sizeof(CHAR)*(MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN), MEM_ALLOC_FLAG); - if (msg == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s():Alloc memory failed\n", __func__)); - return; - } - memset(msg, 0 ,MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN ); - sprintf(msg,"%s","\n"); - sprintf(msg+strlen(msg),"%-14s%-4s%-4s%-10s%-10s%-10s%-6s%-6s\n", - "MAC", "AID", "PSM", "LDT", "RxB", "TxB","CTxR", "LTxR"); - - for (i=0; iMacTab.Content[i]; - if (pEntry->ValidAsCLI && (pEntry->Sst == SST_ASSOC)) - { - if((strlen(msg)+MAC_LINE_LEN ) >= (MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN) ) - break; - sprintf(msg+strlen(msg),"%02x%02x%02x%02x%02x%02x ", - pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2], - pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]); - sprintf(msg+strlen(msg),"%-4d", (int)pEntry->Aid); - sprintf(msg+strlen(msg),"%-4d", (int)pEntry->PsMode); - sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.LastDataPacketTime*/); // ToDo - sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalRxByteCount*/); // ToDo - sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalTxByteCount*/); // ToDo - sprintf(msg+strlen(msg),"%-6d",RateIdToMbps[pAd->MacTab.Content[i].CurrTxRate]); - sprintf(msg+strlen(msg),"%-6d\n",0/*RateIdToMbps[pAd->MacTab.Content[i].LastTxRate]*/); // ToDo - } - } - // for compatible with old API just do the printk to console - //wrq->u.data.length = strlen(msg); - //if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length)) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s", msg)); - } - - kfree(msg); -} - - -INT Set_BASetup_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR mac[6], tid; - PSTRING token; - STRING sepValue[] = ":", DASH = '-'; - INT i; - MAC_TABLE_ENTRY *pEntry; - -/* - The BASetup inupt string format should be xx:xx:xx:xx:xx:xx-d, - =>The six 2 digit hex-decimal number previous are the Mac address, - =>The seventh decimal number is the tid value. -*/ - //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg)); - - if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format. - return FALSE; - - token = strchr(arg, DASH); - if ((token != NULL) && (strlen(token)>1)) - { - tid = (UCHAR) simple_strtol((token+1), 0, 10); - if (tid > 15) - return FALSE; - - *token = '\0'; - for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++) - { - if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1)))) - return FALSE; - AtoH(token, (&mac[i]), 1); - } - if(i != 6) - return FALSE; - - DBGPRINT(RT_DEBUG_OFF, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x\n", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], tid)); - - pEntry = MacTableLookup(pAd, (PUCHAR) mac); - - if (pEntry) { - DBGPRINT(RT_DEBUG_OFF, ("\nSetup BA Session: Tid = %d\n", tid)); - BAOriSessionSetUp(pAd, pEntry, tid, 0, 100, TRUE); - } - - return TRUE; - } - - return FALSE; - -} - -INT Set_BADecline_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG bBADecline; - - bBADecline = simple_strtol(arg, 0, 10); - - if (bBADecline == 0) - { - pAd->CommonCfg.bBADecline = FALSE; - } - else if (bBADecline == 1) - { - pAd->CommonCfg.bBADecline = TRUE; - } - else - { - return FALSE; //Invalid argument - } - - DBGPRINT(RT_DEBUG_TRACE, ("Set_BADecline_Proc::(BADecline=%d)\n", pAd->CommonCfg.bBADecline)); - - return TRUE; -} - -INT Set_BAOriTearDown_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR mac[6], tid; - PSTRING token; - STRING sepValue[] = ":", DASH = '-'; - INT i; - MAC_TABLE_ENTRY *pEntry; - - //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg)); -/* - The BAOriTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d, - =>The six 2 digit hex-decimal number previous are the Mac address, - =>The seventh decimal number is the tid value. -*/ - if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format. - return FALSE; - - token = strchr(arg, DASH); - if ((token != NULL) && (strlen(token)>1)) - { - tid = simple_strtol((token+1), 0, 10); - if (tid > NUM_OF_TID) - return FALSE; - - *token = '\0'; - for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++) - { - if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1)))) - return FALSE; - AtoH(token, (&mac[i]), 1); - } - if(i != 6) - return FALSE; - - DBGPRINT(RT_DEBUG_OFF, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], tid)); - - pEntry = MacTableLookup(pAd, (PUCHAR) mac); - - if (pEntry) { - DBGPRINT(RT_DEBUG_OFF, ("\nTear down Ori BA Session: Tid = %d\n", tid)); - BAOriSessionTearDown(pAd, pEntry->Aid, tid, FALSE, TRUE); - } - - return TRUE; - } - - return FALSE; - -} - -INT Set_BARecTearDown_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR mac[6], tid; - PSTRING token; - STRING sepValue[] = ":", DASH = '-'; - INT i; - MAC_TABLE_ENTRY *pEntry; - - //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg)); -/* - The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d, - =>The six 2 digit hex-decimal number previous are the Mac address, - =>The seventh decimal number is the tid value. -*/ - if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format. - return FALSE; - - token = strchr(arg, DASH); - if ((token != NULL) && (strlen(token)>1)) - { - tid = simple_strtol((token+1), 0, 10); - if (tid > NUM_OF_TID) - return FALSE; - - *token = '\0'; - for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++) - { - if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1)))) - return FALSE; - AtoH(token, (&mac[i]), 1); - } - if(i != 6) - return FALSE; - - DBGPRINT(RT_DEBUG_OFF, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], tid)); - - pEntry = MacTableLookup(pAd, (PUCHAR) mac); - - if (pEntry) { - DBGPRINT(RT_DEBUG_OFF, ("\nTear down Rec BA Session: Tid = %d\n", tid)); - BARecSessionTearDown(pAd, pEntry->Aid, tid, FALSE); - } - - return TRUE; - } - - return FALSE; - -} - -INT Set_HtBw_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG HtBw; - - HtBw = simple_strtol(arg, 0, 10); - if (HtBw == BW_40) - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40; - else if (HtBw == BW_20) - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBw_Proc::(HtBw=%d)\n", pAd->CommonCfg.RegTransmitSetting.field.BW)); - - return TRUE; -} - -INT Set_HtMcs_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG HtMcs, Mcs_tmp; - BOOLEAN bAutoRate = FALSE; - - Mcs_tmp = simple_strtol(arg, 0, 10); - - if (Mcs_tmp <= 15 || Mcs_tmp == 32) - HtMcs = Mcs_tmp; - else - HtMcs = MCS_AUTO; - - { - pAd->StaCfg.DesiredTransmitSetting.field.MCS = HtMcs; - pAd->StaCfg.bAutoTxRateSwitch = (HtMcs == MCS_AUTO) ? TRUE:FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(HtMcs=%d, bAutoTxRateSwitch = %d)\n", - pAd->StaCfg.DesiredTransmitSetting.field.MCS, pAd->StaCfg.bAutoTxRateSwitch)); - - if ((pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED) || - (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE < MODE_HTMIX)) - { - if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) && - (HtMcs >= 0 && HtMcs <= 3) && - (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_CCK)) - { - RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs] * 1000000)); - } - else if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) && - (HtMcs >= 0 && HtMcs <= 7) && - (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_OFDM)) - { - RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs+4] * 1000000)); - } - else - bAutoRate = TRUE; - - if (bAutoRate) - { - pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; - RTMPSetDesiredRates(pAd, -1); - } - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(FixedTxMode=%d)\n",pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode)); - } - if (ADHOC_ON(pAd)) - return TRUE; - } - - SetCommonHT(pAd); - - return TRUE; -} - -INT Set_HtGi_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG HtGi; - - HtGi = simple_strtol(arg, 0, 10); - - if ( HtGi == GI_400) - pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_400; - else if ( HtGi == GI_800 ) - pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_800; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtGi_Proc::(ShortGI=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.ShortGI)); - - return TRUE; -} - - -INT Set_HtTxBASize_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR Size; - - Size = simple_strtol(arg, 0, 10); - - if (Size <=0 || Size >=64) - { - Size = 8; - } - pAd->CommonCfg.TxBASize = Size-1; - DBGPRINT(RT_DEBUG_ERROR, ("Set_HtTxBASize ::(TxBASize= %d)\n", Size)); - - return TRUE; -} - -INT Set_HtDisallowTKIP_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value == 1) - { - pAd->CommonCfg.HT_DisallowTKIP = TRUE; - } - else - { - pAd->CommonCfg.HT_DisallowTKIP = FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtDisallowTKIP_Proc ::%s\n", - (pAd->CommonCfg.HT_DisallowTKIP == TRUE) ? "enabled" : "disabled")); - - return TRUE; -} - -INT Set_HtOpMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value == HTMODE_GF) - pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_GF; - else if ( Value == HTMODE_MM ) - pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_MM; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtOpMode_Proc::(HtOpMode=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.HTMODE)); - - return TRUE; - -} - -INT Set_HtStbc_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value == STBC_USE) - pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_USE; - else if ( Value == STBC_NONE ) - pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_NONE; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_Stbc_Proc::(HtStbc=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.STBC)); - - return TRUE; -} - -INT Set_HtHtc_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->HTCEnable = FALSE; - else if ( Value ==1 ) - pAd->HTCEnable = TRUE; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtHtc_Proc::(HtHtc=%d)\n",pAd->HTCEnable)); - - return TRUE; -} - -INT Set_HtExtcha_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value == 0) - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW; - else if ( Value ==1 ) - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtExtcha_Proc::(HtExtcha=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.EXTCHA)); - - return TRUE; -} - -INT Set_HtMpduDensity_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value <=7 && Value >= 0) - pAd->CommonCfg.BACapability.field.MpduDensity = Value; - else - pAd->CommonCfg.BACapability.field.MpduDensity = 4; - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMpduDensity_Proc::(HtMpduDensity=%d)\n",pAd->CommonCfg.BACapability.field.MpduDensity)); - - return TRUE; -} - -INT Set_HtBaWinSize_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - - if (Value >=1 && Value <= 64) - { - pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = Value; - pAd->CommonCfg.BACapability.field.RxBAWinLimit = Value; - } - else - { - pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = 64; - pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64; - } - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBaWinSize_Proc::(HtBaWinSize=%d)\n",pAd->CommonCfg.BACapability.field.RxBAWinLimit)); - - return TRUE; -} - -INT Set_HtRdg_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - - if (Value == 0) - pAd->CommonCfg.bRdg = FALSE; - else if ( Value ==1 ) - { - pAd->HTCEnable = TRUE; - pAd->CommonCfg.bRdg = TRUE; - } - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtRdg_Proc::(HtRdg=%d)\n",pAd->CommonCfg.bRdg)); - - return TRUE; -} - -INT Set_HtLinkAdapt_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->bLinkAdapt = FALSE; - else if ( Value ==1 ) - { - pAd->HTCEnable = TRUE; - pAd->bLinkAdapt = TRUE; - } - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtLinkAdapt_Proc::(HtLinkAdapt=%d)\n",pAd->bLinkAdapt)); - - return TRUE; -} - -INT Set_HtAmsdu_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->CommonCfg.BACapability.field.AmsduEnable = FALSE; - else if ( Value == 1 ) - pAd->CommonCfg.BACapability.field.AmsduEnable = TRUE; - else - return FALSE; //Invalid argument - - SetCommonHT(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAmsdu_Proc::(HtAmsdu=%d)\n",pAd->CommonCfg.BACapability.field.AmsduEnable)); - - return TRUE; -} - -INT Set_HtAutoBa_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.BACapability.field.AutoBA = FALSE; - pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE; - } - else if (Value == 1) - { - pAd->CommonCfg.BACapability.field.AutoBA = TRUE; - pAd->CommonCfg.BACapability.field.Policy = IMMED_BA; - } - else - return FALSE; //Invalid argument +/* + ======================================================================== - pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA; - pAd->CommonCfg.REGBACapability.field.Policy = pAd->CommonCfg.BACapability.field.Policy; + Routine Description: + Remove WPA Key process - SetCommonHT(pAd); + Arguments: + pAd Pointer to our adapter + pBuf Pointer to the where the key stored - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAutoBa_Proc::(HtAutoBa=%d)\n",pAd->CommonCfg.BACapability.field.AutoBA)); + Return Value: + NDIS_SUCCESS Add key successfully - return TRUE; + IRQL = DISPATCH_LEVEL -} + Note: -INT Set_HtProtect_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) + ======================================================================== +*/ +VOID RTMPSetDesiredRates( + IN PRTMP_ADAPTER pAdapter, + IN LONG Rates) { - ULONG Value; - - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->CommonCfg.bHTProtect = FALSE; - else if (Value == 1) - pAd->CommonCfg.bHTProtect = TRUE; - else - return FALSE; //Invalid argument + NDIS_802_11_RATES aryRates; - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtProtect_Proc::(HtProtect=%d)\n",pAd->CommonCfg.bHTProtect)); + memset(&aryRates, 0x00, sizeof(NDIS_802_11_RATES)); + switch (pAdapter->CommonCfg.PhyMode) + { + case PHY_11A: // A only + switch (Rates) + { + case 6000000: //6M + aryRates[0] = 0x0c; // 6M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0; + break; + case 9000000: //9M + aryRates[0] = 0x12; // 9M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1; + break; + case 12000000: //12M + aryRates[0] = 0x18; // 12M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2; + break; + case 18000000: //18M + aryRates[0] = 0x24; // 18M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3; + break; + case 24000000: //24M + aryRates[0] = 0x30; // 24M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4; + break; + case 36000000: //36M + aryRates[0] = 0x48; // 36M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5; + break; + case 48000000: //48M + aryRates[0] = 0x60; // 48M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6; + break; + case 54000000: //54M + aryRates[0] = 0x6c; // 54M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7; + break; + case -1: //Auto + default: + aryRates[0] = 0x6c; // 54Mbps + aryRates[1] = 0x60; // 48Mbps + aryRates[2] = 0x48; // 36Mbps + aryRates[3] = 0x30; // 24Mbps + aryRates[4] = 0x24; // 18M + aryRates[5] = 0x18; // 12M + aryRates[6] = 0x12; // 9M + aryRates[7] = 0x0c; // 6M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; + break; + } + break; + case PHY_11BG_MIXED: // B/G Mixed + case PHY_11B: // B only + case PHY_11ABG_MIXED: // A/B/G Mixed + default: + switch (Rates) + { + case 1000000: //1M + aryRates[0] = 0x02; + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0; + break; + case 2000000: //2M + aryRates[0] = 0x04; + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1; + break; + case 5000000: //5.5M + aryRates[0] = 0x0b; // 5.5M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2; + break; + case 11000000: //11M + aryRates[0] = 0x16; // 11M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3; + break; + case 6000000: //6M + aryRates[0] = 0x0c; // 6M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0; + break; + case 9000000: //9M + aryRates[0] = 0x12; // 9M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1; + break; + case 12000000: //12M + aryRates[0] = 0x18; // 12M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2; + break; + case 18000000: //18M + aryRates[0] = 0x24; // 18M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3; + break; + case 24000000: //24M + aryRates[0] = 0x30; // 24M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4; + break; + case 36000000: //36M + aryRates[0] = 0x48; // 36M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5; + break; + case 48000000: //48M + aryRates[0] = 0x60; // 48M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6; + break; + case 54000000: //54M + aryRates[0] = 0x6c; // 54M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7; + break; + case -1: //Auto + default: + if (pAdapter->CommonCfg.PhyMode == PHY_11B) + { //B Only + aryRates[0] = 0x16; // 11Mbps + aryRates[1] = 0x0b; // 5.5Mbps + aryRates[2] = 0x04; // 2Mbps + aryRates[3] = 0x02; // 1Mbps + } + else + { //(B/G) Mixed or (A/B/G) Mixed + aryRates[0] = 0x6c; // 54Mbps + aryRates[1] = 0x60; // 48Mbps + aryRates[2] = 0x48; // 36Mbps + aryRates[3] = 0x30; // 24Mbps + aryRates[4] = 0x16; // 11Mbps + aryRates[5] = 0x0b; // 5.5Mbps + aryRates[6] = 0x04; // 2Mbps + aryRates[7] = 0x02; // 1Mbps + } + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; + break; + } + break; + } - return TRUE; + NdisZeroMemory(pAdapter->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES); + NdisMoveMemory(pAdapter->CommonCfg.DesireRate, &aryRates, sizeof(NDIS_802_11_RATES)); + DBGPRINT(RT_DEBUG_TRACE, (" RTMPSetDesiredRates (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n", + pAdapter->CommonCfg.DesireRate[0],pAdapter->CommonCfg.DesireRate[1], + pAdapter->CommonCfg.DesireRate[2],pAdapter->CommonCfg.DesireRate[3], + pAdapter->CommonCfg.DesireRate[4],pAdapter->CommonCfg.DesireRate[5], + pAdapter->CommonCfg.DesireRate[6],pAdapter->CommonCfg.DesireRate[7] )); + // Changing DesiredRate may affect the MAX TX rate we used to TX frames out + MlmeUpdateTxRates(pAdapter, FALSE, 0); } -INT Set_SendPSMPAction_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UCHAR mac[6], mode; - PSTRING token; - STRING sepValue[] = ":", DASH = '-'; - INT i; - MAC_TABLE_ENTRY *pEntry; - - //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg)); /* - The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d, - =>The six 2 digit hex-decimal number previous are the Mac address, - =>The seventh decimal number is the mode value. -*/ - if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and mode value in decimal format. - return FALSE; - - token = strchr(arg, DASH); - if ((token != NULL) && (strlen(token)>1)) - { - mode = simple_strtol((token+1), 0, 10); - if (mode > MMPS_ENABLE) - return FALSE; + ======================================================================== - *token = '\0'; - for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++) - { - if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1)))) - return FALSE; - AtoH(token, (&mac[i]), 1); - } - if(i != 6) - return FALSE; + Routine Description: + Remove All WPA Keys - DBGPRINT(RT_DEBUG_OFF, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], mode)); + Arguments: + pAd Pointer to our adapter - pEntry = MacTableLookup(pAd, mac); + Return Value: + None - if (pEntry) { - DBGPRINT(RT_DEBUG_OFF, ("\nSendPSMPAction MIPS mode = %d\n", mode)); - SendPSMPAction(pAd, pEntry->Aid, mode); - } + IRQL = DISPATCH_LEVEL - return TRUE; - } + Note: - return FALSE; + ======================================================================== +*/ +VOID RTMPWPARemoveAllKeys( + IN PRTMP_ADAPTER pAd) +{ + UCHAR i; -} + DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus)); + RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); + // For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after + // Link up. And it will be replaced if user changed it. + if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA) + return; -INT Set_HtMIMOPSmode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; + // For WPA-None, there is no need to remove it, since WinXP won't set it again after + // Link up. And it will be replaced if user changed it. + if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) + return; - Value = simple_strtol(arg, 0, 10); + // set BSSID wcid entry of the Pair-wise Key table as no-security mode + AsicRemovePairwiseKeyEntry(pAd, BSS0, BSSID_WCID); - if (Value <=3 && Value >= 0) - pAd->CommonCfg.BACapability.field.MMPSmode = Value; - else - pAd->CommonCfg.BACapability.field.MMPSmode = 3; + // set all shared key mode as no-security. + for (i = 0; i < SHARE_KEY_NUM; i++) + { + DBGPRINT(RT_DEBUG_TRACE,("remove %s key #%d\n", CipherName[pAd->SharedKey[BSS0][i].CipherAlg], i)); + NdisZeroMemory(&pAd->SharedKey[BSS0][i], sizeof(CIPHER_KEY)); - SetCommonHT(pAd); + AsicRemoveSharedKeyEntry(pAd, BSS0, i); + } + RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); +} - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMIMOPSmode_Proc::(MIMOPS mode=%d)\n",pAd->CommonCfg.BACapability.field.MMPSmode)); - return TRUE; -} +/* + ======================================================================== + Routine Description: + As STA's BSSID is a WC too, it uses shared key table. + This function write correct unicast TX key to ASIC WCID. + And we still make a copy in our MacTab.Content[BSSID_WCID].PairwiseKey. + Caller guarantee TKIP/AES always has keyidx = 0. (pairwise key) + Caller guarantee WEP calls this function when set Txkey, default key index=0~3. -INT Set_ForceShortGI_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; + Arguments: + pAd Pointer to our adapter + pKey Pointer to the where the key stored - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->WIFItestbed.bShortGI = FALSE; - else if (Value == 1) - pAd->WIFItestbed.bShortGI = TRUE; - else - return FALSE; //Invalid argument + Return Value: + NDIS_SUCCESS Add key successfully - SetCommonHT(pAd); + IRQL = DISPATCH_LEVEL - DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceShortGI_Proc::(ForceShortGI=%d)\n", pAd->WIFItestbed.bShortGI)); + Note: - return TRUE; -} + ======================================================================== +*/ +/* + ======================================================================== + Routine Description: + Change NIC PHY mode. Re-association may be necessary. possible settings + include - PHY_11B, PHY_11BG_MIXED, PHY_11A, and PHY_11ABG_MIXED + Arguments: + pAd - Pointer to our adapter + phymode - + IRQL = PASSIVE_LEVEL + IRQL = DISPATCH_LEVEL -INT Set_ForceGF_Proc( + ======================================================================== +*/ +VOID RTMPSetPhyMode( IN PRTMP_ADAPTER pAd, - IN PSTRING arg) + IN ULONG phymode) { - ULONG Value; + INT i; + // the selected phymode must be supported by the RF IC encoded in E2PROM - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->WIFItestbed.bGreenField = FALSE; - else if (Value == 1) - pAd->WIFItestbed.bGreenField = TRUE; - else - return FALSE; //Invalid argument + // if no change, do nothing + /* bug fix + if (pAd->CommonCfg.PhyMode == phymode) + return; + */ + pAd->CommonCfg.PhyMode = (UCHAR)phymode; - SetCommonHT(pAd); + DBGPRINT(RT_DEBUG_TRACE,("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", pAd->CommonCfg.PhyMode, pAd->CommonCfg.Channel)); - DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceGF_Proc::(ForceGF=%d)\n", pAd->WIFItestbed.bGreenField)); + BuildChannelList(pAd); - return TRUE; -} + // sanity check user setting + for (i = 0; i < pAd->ChannelListNum; i++) + { + if (pAd->CommonCfg.Channel == pAd->ChannelList[i].Channel) + break; + } -INT Set_HtMimoPs_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG Value; + if (i == pAd->ChannelListNum) + { + pAd->CommonCfg.Channel = FirstChannel(pAd); + DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetPhyMode: channel is out of range, use first channel=%d \n", pAd->CommonCfg.Channel)); + } - Value = simple_strtol(arg, 0, 10); - if (Value == 0) - pAd->CommonCfg.bMIMOPSEnable = FALSE; - else if (Value == 1) - pAd->CommonCfg.bMIMOPSEnable = TRUE; - else - return FALSE; //Invalid argument + NdisZeroMemory(pAd->CommonCfg.SupRate, MAX_LEN_OF_SUPPORTED_RATES); + NdisZeroMemory(pAd->CommonCfg.ExtRate, MAX_LEN_OF_SUPPORTED_RATES); + NdisZeroMemory(pAd->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES); + switch (phymode) { + case PHY_11B: + pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRateLen = 4; + pAd->CommonCfg.ExtRateLen = 0; + pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps + //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use + break; - DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMimoPs_Proc::(HtMimoPs=%d)\n",pAd->CommonCfg.bMIMOPSEnable)); + case PHY_11G: + case PHY_11BG_MIXED: + case PHY_11ABG_MIXED: + case PHY_11N_2_4G: + case PHY_11ABGN_MIXED: + case PHY_11BGN_MIXED: + case PHY_11GN_MIXED: + pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[4] = 0x12; // 9 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRate[5] = 0x24; // 18 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRate[6] = 0x48; // 36 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRateLen = 8; + pAd->CommonCfg.ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps + pAd->CommonCfg.ExtRate[1] = 0x18; // 12 mbps, in units of 0.5 Mbps + pAd->CommonCfg.ExtRate[2] = 0x30; // 24 mbps, in units of 0.5 Mbps + pAd->CommonCfg.ExtRate[3] = 0x60; // 48 mbps, in units of 0.5 Mbps + pAd->CommonCfg.ExtRateLen = 4; + pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[4] = 12; // 6 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[5] = 18; // 9 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[6] = 24; // 12 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[7] = 36; // 18 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[8] = 48; // 24 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[9] = 72; // 36 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[10] = 96; // 48 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[11] = 108; // 54 mbps, in units of 0.5 Mbps + break; - return TRUE; -} + case PHY_11A: + case PHY_11AN_MIXED: + case PHY_11AGN_MIXED: + case PHY_11N_5G: + pAd->CommonCfg.SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRateLen = 8; + pAd->CommonCfg.ExtRateLen = 0; + pAd->CommonCfg.DesireRate[0] = 12; // 6 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[1] = 18; // 9 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[2] = 24; // 12 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[3] = 36; // 18 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[4] = 48; // 24 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[5] = 72; // 36 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[6] = 96; // 48 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[7] = 108; // 54 mbps, in units of 0.5 Mbps + //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use + break; -INT SetCommonHT( - IN PRTMP_ADAPTER pAd) -{ - OID_SET_HT_PHYMODE SetHT; + default: + break; + } - if (pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED) - return FALSE; - SetHT.PhyMode = pAd->CommonCfg.PhyMode; - SetHT.TransmitNo = ((UCHAR)pAd->Antenna.field.TxPath); - SetHT.HtMode = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.HTMODE; - SetHT.ExtOffset = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.EXTCHA; - SetHT.MCS = MCS_AUTO; - SetHT.BW = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.BW; - SetHT.STBC = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.STBC; - SetHT.SHORTGI = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.ShortGI; + pAd->CommonCfg.BandState = UNKNOWN_BAND; +} - RTMPSetHT(pAd, &SetHT); +/* + ======================================================================== + Routine Description: + Caller ensures we has 802.11n support. + Calls at setting HT from AP/STASetinformation - return TRUE; -} + Arguments: + pAd - Pointer to our adapter + phymode - -INT Set_FixedTxMode_Proc( + ======================================================================== +*/ +VOID RTMPSetHT( IN PRTMP_ADAPTER pAd, - IN PSTRING arg) + IN OID_SET_HT_PHYMODE *pHTPhyMode) { - UCHAR fix_tx_mode = FIXED_TXMODE_HT; + //ULONG *pmcs; + UINT32 Value = 0; + UCHAR BBPValue = 0; + UCHAR BBP3Value = 0; + UCHAR RxStream = pAd->CommonCfg.RxStream; - if (strcmp(arg, "OFDM") == 0 || strcmp(arg, "ofdm") == 0) + DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n", + pHTPhyMode->HtMode, pHTPhyMode->ExtOffset, + pHTPhyMode->MCS, pHTPhyMode->BW, + pHTPhyMode->STBC, pHTPhyMode->SHORTGI)); + + // Don't zero supportedHyPhy structure. + RTMPZeroMemory(&pAd->CommonCfg.HtCapability, sizeof(pAd->CommonCfg.HtCapability)); + RTMPZeroMemory(&pAd->CommonCfg.AddHTInfo, sizeof(pAd->CommonCfg.AddHTInfo)); + RTMPZeroMemory(&pAd->CommonCfg.NewExtChanOffset, sizeof(pAd->CommonCfg.NewExtChanOffset)); + RTMPZeroMemory(&pAd->CommonCfg.DesiredHtPhy, sizeof(pAd->CommonCfg.DesiredHtPhy)); + + if (pAd->CommonCfg.bRdg) { - fix_tx_mode = FIXED_TXMODE_OFDM; + pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 1; + pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 1; } - else if (strcmp(arg, "CCK") == 0 || strcmp(arg, "cck") == 0) + else { - fix_tx_mode = FIXED_TXMODE_CCK; + pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 0; + pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 0; } - pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode = fix_tx_mode; + pAd->CommonCfg.HtCapability.HtCapParm.MaxRAmpduFactor = 3; + pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor = 3; - DBGPRINT(RT_DEBUG_TRACE, ("Set_FixedTxMode_Proc::(FixedTxMode=%d)\n", fix_tx_mode)); + DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : RxBAWinLimit = %d\n", pAd->CommonCfg.BACapability.field.RxBAWinLimit)); - return TRUE; -} + // Mimo power save, A-MSDU size, + pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable; + pAd->CommonCfg.DesiredHtPhy.AmsduSize = (UCHAR)pAd->CommonCfg.BACapability.field.AmsduSize; + pAd->CommonCfg.DesiredHtPhy.MimoPs = (UCHAR)pAd->CommonCfg.BACapability.field.MMPSmode; + pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity; -#if defined(RT305x)||defined(RT3070) -INT Set_HiPower_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - pAdapter->CommonCfg.HighPowerPatchDisabled = !(simple_strtol(arg, 0, 10)); + pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize; + pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode; + pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity; - if (pAdapter->CommonCfg.HighPowerPatchDisabled != 0) + DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n", + pAd->CommonCfg.DesiredHtPhy.AmsduSize, + pAd->CommonCfg.DesiredHtPhy.MimoPs, + pAd->CommonCfg.DesiredHtPhy.MpduDensity, + pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor)); + + if(pHTPhyMode->HtMode == HTMODE_GF) { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R82, 0x62); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R67, 0x20); -#ifdef RT3070 - if ((IS_RT3070(pAdapter) && ((pAdapter->MACVersion & 0xffff) < 0x0201))) -#endif // RT3070 // - RT30xxWriteRFRegister(pAdapter, RF_R27, 0x23); + pAd->CommonCfg.HtCapability.HtCapInfo.GF = 1; + pAd->CommonCfg.DesiredHtPhy.GF = 1; } - return TRUE; -} -#endif - -INT Set_LongRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - TX_RTY_CFG_STRUC tx_rty_cfg; - UCHAR LongRetryLimit = (UCHAR)simple_strtol(arg, 0, 10); - - RTMP_IO_READ32(pAdapter, TX_RTY_CFG, &tx_rty_cfg.word); - tx_rty_cfg.field.LongRtyLimit = LongRetryLimit; - RTMP_IO_WRITE32(pAdapter, TX_RTY_CFG, tx_rty_cfg.word); - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_LongRetryLimit_Proc::(tx_rty_cfg=0x%x)\n", tx_rty_cfg.word)); - return TRUE; -} + else + pAd->CommonCfg.DesiredHtPhy.GF = 0; -INT Set_ShortRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - TX_RTY_CFG_STRUC tx_rty_cfg; - UCHAR ShortRetryLimit = (UCHAR)simple_strtol(arg, 0, 10); + // Decide Rx MCSSet + switch (RxStream) + { + case 1: + pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff; + pAd->CommonCfg.HtCapability.MCSSet[1] = 0x00; + break; - RTMP_IO_READ32(pAdapter, TX_RTY_CFG, &tx_rty_cfg.word); - tx_rty_cfg.field.ShortRtyLimit = ShortRetryLimit; - RTMP_IO_WRITE32(pAdapter, TX_RTY_CFG, tx_rty_cfg.word); - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_ShortRetryLimit_Proc::(tx_rty_cfg=0x%x)\n", tx_rty_cfg.word)); - return TRUE; -} + case 2: + pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff; + pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff; + break; + case 3: // 3*3 + pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff; + pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff; + pAd->CommonCfg.HtCapability.MCSSet[2] = 0xff; + break; + } -///////////////////////////////////////////////////////////////////////// -PSTRING RTMPGetRalinkAuthModeStr( - IN NDIS_802_11_AUTHENTICATION_MODE authMode) -{ - switch(authMode) + if (pAd->CommonCfg.bForty_Mhz_Intolerant && (pAd->CommonCfg.Channel <= 14) && (pHTPhyMode->BW == BW_40) ) { - case Ndis802_11AuthModeOpen: - return "OPEN"; - case Ndis802_11AuthModeWPAPSK: - return "WPAPSK"; - case Ndis802_11AuthModeShared: - return "SHARED"; - case Ndis802_11AuthModeWPA: - return "WPA"; - case Ndis802_11AuthModeWPA2: - return "WPA2"; - case Ndis802_11AuthModeWPA2PSK: - return "WPA2PSK"; - case Ndis802_11AuthModeWPA1PSKWPA2PSK: - return "WPAPSKWPA2PSK"; - case Ndis802_11AuthModeWPA1WPA2: - return "WPA1WPA2"; - case Ndis802_11AuthModeWPANone: - return "WPANONE"; - default: - return "UNKNOW"; + pHTPhyMode->BW = BW_20; + pAd->CommonCfg.HtCapability.HtCapInfo.Forty_Mhz_Intolerant = 1; } -} -PSTRING RTMPGetRalinkEncryModeStr( - IN USHORT encryMode) -{ - switch(encryMode) + if(pHTPhyMode->BW == BW_40) { - case Ndis802_11WEPDisabled: - return "NONE"; - case Ndis802_11WEPEnabled: - return "WEP"; - case Ndis802_11Encryption2Enabled: - return "TKIP"; - case Ndis802_11Encryption3Enabled: - return "AES"; - case Ndis802_11Encryption4Enabled: - return "TKIPAES"; - default: - return "UNKNOW"; - } -} + pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; // MCS 32 + pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 1; + if (pAd->CommonCfg.Channel <= 14) + pAd->CommonCfg.HtCapability.HtCapInfo.CCKmodein40 = 1; + + pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 1; + pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 1; + pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = (pHTPhyMode->ExtOffset == EXTCHA_BELOW)? (EXTCHA_BELOW): EXTCHA_ABOVE; + // Set Regsiter for extension channel position. + RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value); + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBP3Value); + if ((pHTPhyMode->ExtOffset == EXTCHA_BELOW)) + { + Value |= 0x1; + BBP3Value |= (0x20); + RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); + } + else if ((pHTPhyMode->ExtOffset == EXTCHA_ABOVE)) + { + Value &= 0xfe; + BBP3Value &= (~0x20); + RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); + } -INT RTMPShowCfgValue( - IN PRTMP_ADAPTER pAd, - IN PSTRING pName, - IN PSTRING pBuf) -{ - INT Status = 0; + // Turn on BBP 40MHz mode now only as AP . + // Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection. + if ((pAd->OpMode == OPMODE_AP) || INFRA_ON(pAd) || ADHOC_ON(pAd) + ) + { + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); + BBPValue &= (~0x18); + BBPValue |= 0x10; + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - for (PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC = RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC; PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name; PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC++) + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBP3Value); + pAd->CommonCfg.BBPCurrentBW = BW_40; + } + } + else { - if (!strcmp(pName, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name)) + pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 0; + pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 0; + pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 0; + pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = EXTCHA_NONE; + pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; + // Turn on BBP 20MHz mode by request here. { - if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->show_proc(pAd, pBuf)) - Status = -EINVAL; - break; //Exit for loop. + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); + BBPValue &= (~0x18); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); + pAd->CommonCfg.BBPCurrentBW = BW_20; } } - if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name == NULL) + if(pHTPhyMode->STBC == STBC_USE) + { + pAd->CommonCfg.HtCapability.HtCapInfo.TxSTBC = 1; + pAd->CommonCfg.DesiredHtPhy.TxSTBC = 1; + pAd->CommonCfg.HtCapability.HtCapInfo.RxSTBC = 1; + pAd->CommonCfg.DesiredHtPhy.RxSTBC = 1; + } + else { - sprintf(pBuf, "\n"); - for (PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC = RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC; PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name; PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC++) - sprintf(pBuf + strlen(pBuf), "%s\n", PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name); + pAd->CommonCfg.DesiredHtPhy.TxSTBC = 0; + pAd->CommonCfg.DesiredHtPhy.RxSTBC = 0; } - return Status; -} + if(pHTPhyMode->SHORTGI == GI_400) + { + pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 1; + pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 1; + pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 1; + pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 1; + } + else + { + pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 0; + pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 0; + pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 0; + pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 0; + } -INT Show_SSID_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.Ssid); - return 0; -} + // We support link adaptation for unsolicit MCS feedback, set to 2. + pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; //MCSFBK_UNSOLICIT; + pAd->CommonCfg.AddHTInfo.ControlChan = pAd->CommonCfg.Channel; + // 1, the extension channel above the control channel. -INT Show_WirelessMode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->CommonCfg.PhyMode) + // EDCA parameters used for AP's own transmission + if (pAd->CommonCfg.APEdcaParm.bValid == FALSE) { - case PHY_11BG_MIXED: - sprintf(pBuf, "\t11B/G"); - break; - case PHY_11B: - sprintf(pBuf, "\t11B"); - break; - case PHY_11A: - sprintf(pBuf, "\t11A"); - break; - case PHY_11ABG_MIXED: - sprintf(pBuf, "\t11A/B/G"); - break; - case PHY_11G: - sprintf(pBuf, "\t11G"); - break; - case PHY_11ABGN_MIXED: - sprintf(pBuf, "\t11A/B/G/N"); - break; - case PHY_11N_2_4G: - sprintf(pBuf, "\t11N only with 2.4G"); - break; - case PHY_11GN_MIXED: - sprintf(pBuf, "\t11G/N"); - break; - case PHY_11AN_MIXED: - sprintf(pBuf, "\t11A/N"); - break; - case PHY_11BGN_MIXED: - sprintf(pBuf, "\t11B/G/N"); - break; - case PHY_11AGN_MIXED: - sprintf(pBuf, "\t11A/G/N"); - break; - case PHY_11N_5G: - sprintf(pBuf, "\t11N only with 5G"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%d)", pAd->CommonCfg.PhyMode); - break; - } - return 0; -} + pAd->CommonCfg.APEdcaParm.bValid = TRUE; + pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3; + pAd->CommonCfg.APEdcaParm.Aifsn[1] = 7; + pAd->CommonCfg.APEdcaParm.Aifsn[2] = 1; + pAd->CommonCfg.APEdcaParm.Aifsn[3] = 1; + pAd->CommonCfg.APEdcaParm.Cwmin[0] = 4; + pAd->CommonCfg.APEdcaParm.Cwmin[1] = 4; + pAd->CommonCfg.APEdcaParm.Cwmin[2] = 3; + pAd->CommonCfg.APEdcaParm.Cwmin[3] = 2; -INT Show_TxBurst_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.bEnableTxBurst ? "TRUE":"FALSE"); - return 0; -} + pAd->CommonCfg.APEdcaParm.Cwmax[0] = 6; + pAd->CommonCfg.APEdcaParm.Cwmax[1] = 10; + pAd->CommonCfg.APEdcaParm.Cwmax[2] = 4; + pAd->CommonCfg.APEdcaParm.Cwmax[3] = 3; -INT Show_TxPreamble_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->CommonCfg.TxPreamble) - { - case Rt802_11PreambleShort: - sprintf(pBuf, "\tShort"); - break; - case Rt802_11PreambleLong: - sprintf(pBuf, "\tLong"); - break; - case Rt802_11PreambleAuto: - sprintf(pBuf, "\tAuto"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.TxPreamble); - break; + pAd->CommonCfg.APEdcaParm.Txop[0] = 0; + pAd->CommonCfg.APEdcaParm.Txop[1] = 0; + pAd->CommonCfg.APEdcaParm.Txop[2] = 94; + pAd->CommonCfg.APEdcaParm.Txop[3] = 47; } + AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm); - return 0; -} - -INT Show_TxPower_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%lu", pAd->CommonCfg.TxPowerPercentage); - return 0; -} + { + RTMPSetIndividualHT(pAd, 0); + } -INT Show_Channel_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%d", pAd->CommonCfg.Channel); - return 0; } -INT Show_BGProtection_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->CommonCfg.UseBGProtection) - { - case 1: //Always On - sprintf(pBuf, "\tON"); - break; - case 2: //Always OFF - sprintf(pBuf, "\tOFF"); - break; - case 0: //AUTO - sprintf(pBuf, "\tAuto"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.UseBGProtection); - break; - } - return 0; -} +/* + ======================================================================== + Routine Description: + Caller ensures we has 802.11n support. + Calls at setting HT from AP/STASetinformation -INT Show_RTSThreshold_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%u", pAd->CommonCfg.RtsThreshold); - return 0; -} + Arguments: + pAd - Pointer to our adapter + phymode - -INT Show_FragThreshold_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) + ======================================================================== +*/ +VOID RTMPSetIndividualHT( + IN PRTMP_ADAPTER pAd, + IN UCHAR apidx) { - sprintf(pBuf, "\t%u", pAd->CommonCfg.FragmentThreshold); - return 0; -} + PRT_HT_PHY_INFO pDesired_ht_phy = NULL; + UCHAR TxStream = pAd->CommonCfg.TxStream; + UCHAR DesiredMcs = MCS_AUTO; -INT Show_HtBw_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40) + do { - sprintf(pBuf, "\t40 MHz"); - } - else + { + pDesired_ht_phy = &pAd->StaCfg.DesiredHtPhyInfo; + DesiredMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS; + //pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE; + break; + } + } while (FALSE); + + if (pDesired_ht_phy == NULL) { - sprintf(pBuf, "\t20 MHz"); + DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetIndividualHT: invalid apidx(%d)\n", apidx)); + return; } - return 0; -} - -INT Show_HtMcs_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%u", pAd->StaCfg.DesiredTransmitSetting.field.MCS); - return 0; -} + RTMPZeroMemory(pDesired_ht_phy, sizeof(RT_HT_PHY_INFO)); -INT Show_HtGi_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->CommonCfg.RegTransmitSetting.field.ShortGI) + DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs)); + // Check the validity of MCS + if ((TxStream == 1) && ((DesiredMcs >= MCS_8) && (DesiredMcs <= MCS_15))) { - case GI_400: - sprintf(pBuf, "\tGI_400"); - break; - case GI_800: - sprintf(pBuf, "\tGI_800"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.ShortGI); - break; + DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS(%d) is invalid in 1S, reset it as MCS_7\n", DesiredMcs)); + DesiredMcs = MCS_7; } - return 0; -} -INT Show_HtOpMode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->CommonCfg.RegTransmitSetting.field.HTMODE) + if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_20) && (DesiredMcs == MCS_32)) { - case HTMODE_GF: - sprintf(pBuf, "\tGF"); - break; - case HTMODE_MM: - sprintf(pBuf, "\tMM"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.HTMODE); - break; + DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS_32 is only supported in 40-MHz, reset it as MCS_0\n")); + DesiredMcs = MCS_0; } - return 0; -} -INT Show_HtExtcha_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->CommonCfg.RegTransmitSetting.field.EXTCHA) + pDesired_ht_phy->bHtEnable = TRUE; + + // Decide desired Tx MCS + switch (TxStream) { - case EXTCHA_BELOW: - sprintf(pBuf, "\tBelow"); + case 1: + if (DesiredMcs == MCS_AUTO) + { + pDesired_ht_phy->MCSSet[0]= 0xff; + pDesired_ht_phy->MCSSet[1]= 0x00; + } + else if (DesiredMcs <= MCS_7) + { + pDesired_ht_phy->MCSSet[0]= 1<MCSSet[1]= 0x00; + } break; - case EXTCHA_ABOVE: - sprintf(pBuf, "\tAbove"); + + case 2: + if (DesiredMcs == MCS_AUTO) + { + pDesired_ht_phy->MCSSet[0]= 0xff; + pDesired_ht_phy->MCSSet[1]= 0xff; + } + else if (DesiredMcs <= MCS_15) + { + ULONG mode; + + mode = DesiredMcs / 8; + if (mode < 2) + pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8)); + } break; - default: - sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.EXTCHA); + + case 3: // 3*3 + if (DesiredMcs == MCS_AUTO) + { + /* MCS0 ~ MCS23, 3 bytes */ + pDesired_ht_phy->MCSSet[0]= 0xff; + pDesired_ht_phy->MCSSet[1]= 0xff; + pDesired_ht_phy->MCSSet[2]= 0xff; + } + else if (DesiredMcs <= MCS_23) + { + ULONG mode; + + mode = DesiredMcs / 8; + if (mode < 3) + pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8)); + } break; } - return 0; -} + if(pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_40) + { + if (DesiredMcs == MCS_AUTO || DesiredMcs == MCS_32) + pDesired_ht_phy->MCSSet[4] = 0x1; + } -INT Show_HtMpduDensity_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.MpduDensity); - return 0; + // update HT Rate setting + if (pAd->OpMode == OPMODE_STA) + MlmeUpdateHtTxRates(pAd, BSS0); + else + MlmeUpdateHtTxRates(pAd, apidx); } -INT Show_HtBaWinSize_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.RxBAWinLimit); - return 0; -} -INT Show_HtRdg_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.bRdg ? "TRUE":"FALSE"); - return 0; -} +/* + ======================================================================== + Routine Description: + Update HT IE from our capability. -INT Show_HtAmsdu_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AmsduEnable ? "TRUE":"FALSE"); - return 0; -} + Arguments: + Send all HT IE in beacon/probe rsp/assoc rsp/action frame. -INT Show_HtAutoBa_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AutoBA ? "TRUE":"FALSE"); - return 0; -} -INT Show_CountryRegion_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) + ======================================================================== +*/ +VOID RTMPUpdateHTIE( + IN RT_HT_CAPABILITY *pRtHt, + IN UCHAR *pMcsSet, + OUT HT_CAPABILITY_IE *pHtCapability, + OUT ADD_HT_INFO_IE *pAddHtInfo) { - sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegion); - return 0; -} + RTMPZeroMemory(pHtCapability, sizeof(HT_CAPABILITY_IE)); + RTMPZeroMemory(pAddHtInfo, sizeof(ADD_HT_INFO_IE)); -INT Show_CountryRegionABand_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegionForABand); - return 0; -} + pHtCapability->HtCapInfo.ChannelWidth = pRtHt->ChannelWidth; + pHtCapability->HtCapInfo.MimoPs = pRtHt->MimoPs; + pHtCapability->HtCapInfo.GF = pRtHt->GF; + pHtCapability->HtCapInfo.ShortGIfor20 = pRtHt->ShortGIfor20; + pHtCapability->HtCapInfo.ShortGIfor40 = pRtHt->ShortGIfor40; + pHtCapability->HtCapInfo.TxSTBC = pRtHt->TxSTBC; + pHtCapability->HtCapInfo.RxSTBC = pRtHt->RxSTBC; + pHtCapability->HtCapInfo.AMsduSize = pRtHt->AmsduSize; + pHtCapability->HtCapParm.MaxRAmpduFactor = pRtHt->MaxRAmpduFactor; + pHtCapability->HtCapParm.MpduDensity = pRtHt->MpduDensity; -INT Show_CountryCode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.CountryCode); - return 0; -} + pAddHtInfo->AddHtInfo.ExtChanOffset = pRtHt->ExtChanOffset ; + pAddHtInfo->AddHtInfo.RecomWidth = pRtHt->RecomWidth; + pAddHtInfo->AddHtInfo2.OperaionMode = pRtHt->OperaionMode; + pAddHtInfo->AddHtInfo2.NonGfPresent = pRtHt->NonGfPresent; + RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet*/pMcsSet, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar. -#ifdef AGGREGATION_SUPPORT -INT Show_PktAggregate_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.bAggregationCapable ? "TRUE":"FALSE"); - return 0; + DBGPRINT(RT_DEBUG_TRACE,("RTMPUpdateHTIE <== \n")); } -#endif // AGGREGATION_SUPPORT // -#ifdef WMM_SUPPORT -INT Show_WmmCapable_Proc( +/* + ======================================================================== + Description: + Add Client security information into ASIC WCID table and IVEIV table. + Return: + ======================================================================== +*/ +VOID RTMPAddWcidAttributeEntry( IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) + IN UCHAR BssIdx, + IN UCHAR KeyIdx, + IN UCHAR CipherAlg, + IN MAC_TABLE_ENTRY *pEntry) { - sprintf(pBuf, "\t%s", pAd->CommonCfg.bWmmCapable ? "TRUE":"FALSE"); + UINT32 WCIDAttri = 0; + USHORT offset; + UCHAR IVEIV = 0; + USHORT Wcid = 0; - return 0; -} -#endif // WMM_SUPPORT // + { + { + if (BssIdx > BSS0) + { + DBGPRINT(RT_DEBUG_ERROR, ("RTMPAddWcidAttributeEntry: The BSS-index(%d) is out of range for Infra link. \n", BssIdx)); + return; + } -INT Show_IEEE80211H_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - sprintf(pBuf, "\t%s", pAd->CommonCfg.bIEEE80211H ? "TRUE":"FALSE"); - return 0; -} + // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists. + // 2. In Infra mode, the AID:1 MUST be wcid of infra STA. + // the AID:2~ assign to mesh link entry. + if (pEntry) + Wcid = pEntry->Aid; + else + Wcid = MCAST_WCID; + } + } + + // Update WCID attribute table + offset = MAC_WCID_ATTRIBUTE_BASE + (Wcid * HW_WCID_ATTRI_SIZE); -INT Show_NetworkType_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - switch(pAd->StaCfg.BssType) { - case BSS_ADHOC: - sprintf(pBuf, "\tAdhoc"); - break; - case BSS_INFRA: - sprintf(pBuf, "\tInfra"); - break; - case BSS_ANY: - sprintf(pBuf, "\tAny"); - break; - case BSS_MONITOR: - sprintf(pBuf, "\tMonitor"); - break; - default: - sprintf(pBuf, "\tUnknow Value(%d)", pAd->StaCfg.BssType); - break; + if (pEntry && pEntry->ValidAsMesh) + WCIDAttri = (CipherAlg<<1) | PAIRWISEKEYTABLE; + else + WCIDAttri = (CipherAlg<<1) | SHAREDKEYTABLE; } - return 0; -} - + RTMP_IO_WRITE32(pAd, offset, WCIDAttri); -INT Show_AuthMode_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - NDIS_802_11_AUTHENTICATION_MODE AuthMode = Ndis802_11AuthModeOpen; - AuthMode = pAd->StaCfg.AuthMode; + // Update IV/EIV table + offset = MAC_IVEIV_TABLE_BASE + (Wcid * HW_IVEIV_ENTRY_SIZE); - if ((AuthMode >= Ndis802_11AuthModeOpen) && - (AuthMode <= Ndis802_11AuthModeWPA1PSKWPA2PSK)) - sprintf(pBuf, "\t%s", RTMPGetRalinkAuthModeStr(AuthMode)); + // WPA mode + if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) || (CipherAlg == CIPHER_AES)) + { + // Eiv bit on. keyid always is 0 for pairwise key + IVEIV = (KeyIdx <<6) | 0x20; + } else - sprintf(pBuf, "\tUnknow Value(%d)", AuthMode); - - return 0; -} - -INT Show_EncrypType_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - NDIS_802_11_WEP_STATUS WepStatus = Ndis802_11WEPDisabled; + { + // WEP KeyIdx is default tx key. + IVEIV = (KeyIdx << 6); + } - WepStatus = pAd->StaCfg.WepStatus; + // For key index and ext IV bit, so only need to update the position(offset+3). +#ifdef RTMP_MAC_PCI + RTMP_IO_WRITE8(pAd, offset+3, IVEIV); +#endif // RTMP_MAC_PCI // +#ifdef RTMP_MAC_USB + RTUSBMultiWrite_OneByte(pAd, offset+3, &IVEIV); +#endif // RTMP_MAC_USB // - if ((WepStatus >= Ndis802_11WEPEnabled) && - (WepStatus <= Ndis802_11Encryption4KeyAbsent)) - sprintf(pBuf, "\t%s", RTMPGetRalinkEncryModeStr(WepStatus)); - else - sprintf(pBuf, "\tUnknow Value(%d)", WepStatus); + DBGPRINT(RT_DEBUG_TRACE,("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",Wcid, KeyIdx, CipherName[CipherAlg])); + DBGPRINT(RT_DEBUG_TRACE,(" WCIDAttri = 0x%x \n", WCIDAttri)); - return 0; } -INT Show_DefaultKeyID_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - UCHAR DefaultKeyId = 0; - - DefaultKeyId = pAd->StaCfg.DefaultKeyId; - - sprintf(pBuf, "\t%d", DefaultKeyId); +/* + ========================================================================== + Description: + Parse encryption type +Arguments: + pAdapter Pointer to our adapter + wrq Pointer to the ioctl argument - return 0; -} + Return Value: + None -INT Show_WepKey_Proc( - IN PRTMP_ADAPTER pAd, - IN INT KeyIdx, - OUT PSTRING pBuf) + Note: + ========================================================================== +*/ +PSTRING GetEncryptType(CHAR enc) { - UCHAR Key[16] = {0}, KeyLength = 0; - INT index = BSS0; - - KeyLength = pAd->SharedKey[index][KeyIdx].KeyLen; - NdisMoveMemory(Key, pAd->SharedKey[index][KeyIdx].Key, KeyLength); - - //check key string is ASCII or not - if (RTMPCheckStrPrintAble((PCHAR)Key, KeyLength)) - sprintf(pBuf, "\t%s", Key); + if(enc == Ndis802_11WEPDisabled) + return "NONE"; + if(enc == Ndis802_11WEPEnabled) + return "WEP"; + if(enc == Ndis802_11Encryption2Enabled) + return "TKIP"; + if(enc == Ndis802_11Encryption3Enabled) + return "AES"; + if(enc == Ndis802_11Encryption4Enabled) + return "TKIPAES"; else - { - int idx; - sprintf(pBuf, "\t"); - for (idx = 0; idx < KeyLength; idx++) - sprintf(pBuf+strlen(pBuf), "%02X", Key[idx]); - } - return 0; -} - -INT Show_Key1_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - Show_WepKey_Proc(pAd, 0, pBuf); - return 0; + return "UNKNOW"; } -INT Show_Key2_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) +PSTRING GetAuthMode(CHAR auth) { - Show_WepKey_Proc(pAd, 1, pBuf); - return 0; -} + if(auth == Ndis802_11AuthModeOpen) + return "OPEN"; + if(auth == Ndis802_11AuthModeShared) + return "SHARED"; + if(auth == Ndis802_11AuthModeAutoSwitch) + return "AUTOWEP"; + if(auth == Ndis802_11AuthModeWPA) + return "WPA"; + if(auth == Ndis802_11AuthModeWPAPSK) + return "WPAPSK"; + if(auth == Ndis802_11AuthModeWPANone) + return "WPANONE"; + if(auth == Ndis802_11AuthModeWPA2) + return "WPA2"; + if(auth == Ndis802_11AuthModeWPA2PSK) + return "WPA2PSK"; + if(auth == Ndis802_11AuthModeWPA1WPA2) + return "WPA1WPA2"; + if(auth == Ndis802_11AuthModeWPA1PSKWPA2PSK) + return "WPA1PSKWPA2PSK"; -INT Show_Key3_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - Show_WepKey_Proc(pAd, 2, pBuf); - return 0; + return "UNKNOW"; } -INT Show_Key4_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) +INT SetCommonHT( + IN PRTMP_ADAPTER pAd) { - Show_WepKey_Proc(pAd, 3, pBuf); - return 0; -} + OID_SET_HT_PHYMODE SetHT; -INT Show_WPAPSK_Proc( - IN PRTMP_ADAPTER pAd, - OUT PSTRING pBuf) -{ - INT idx; - UCHAR PMK[32] = {0}; + if (pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED) + return FALSE; - NdisMoveMemory(PMK, pAd->StaCfg.PMK, 32); + SetHT.PhyMode = pAd->CommonCfg.PhyMode; + SetHT.TransmitNo = ((UCHAR)pAd->Antenna.field.TxPath); + SetHT.HtMode = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.HTMODE; + SetHT.ExtOffset = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.EXTCHA; + SetHT.MCS = MCS_AUTO; + SetHT.BW = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.BW; + SetHT.STBC = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.STBC; + SetHT.SHORTGI = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.ShortGI; - sprintf(pBuf, "\tPMK = "); - for (idx = 0; idx < 32; idx++) - sprintf(pBuf+strlen(pBuf), "%02X", PMK[idx]); + RTMPSetHT(pAd, &SetHT); - return 0; + return TRUE; } +PSTRING RTMPGetRalinkEncryModeStr( + IN USHORT encryMode) +{ + switch(encryMode) + { + case Ndis802_11WEPDisabled: + return "NONE"; + case Ndis802_11WEPEnabled: + return "WEP"; + case Ndis802_11Encryption2Enabled: + return "TKIP"; + case Ndis802_11Encryption3Enabled: + return "AES"; + case Ndis802_11Encryption4Enabled: + return "TKIPAES"; + default: + return "UNKNOW"; + } +} diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h index 32e553a946b4..59fd05bf9804 100644 --- a/drivers/staging/rt2860/rtmp.h +++ b/drivers/staging/rt2860/rtmp.h @@ -4237,17 +4237,9 @@ INT RT_CfgSetWPAPSKKey( // // Prototypes of function definition in cmm_info.c // -NDIS_STATUS RTMPWPARemoveKeyProc( - IN PRTMP_ADAPTER pAd, - IN PVOID pBuf); - VOID RTMPWPARemoveAllKeys( IN PRTMP_ADAPTER pAd); -BOOLEAN RTMPCheckStrPrintAble( - IN CHAR *pInPutStr, - IN UCHAR strLen); - VOID RTMPSetPhyMode( IN PRTMP_ADAPTER pAd, IN ULONG phymode); @@ -4683,183 +4675,9 @@ int rtinet_aton( unsigned int *addr); ////////// common ioctl functions ////////// -INT Set_DriverVersion_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_CountryRegion_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_CountryRegionABand_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_WirelessMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_Channel_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ShortSlot_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_TxPower_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_BGProtection_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_TxPreamble_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_RTSThreshold_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_FragThreshold_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_TxBurst_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -#ifdef AGGREGATION_SUPPORT -INT Set_PktAggregate_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); -#endif // AGGREGATION_SUPPORT // - -INT Set_IEEE80211H_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -#ifdef DBG -INT Set_Debug_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); -#endif - -INT Show_DescInfo_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ResetStatCounter_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_BASetup_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_BADecline_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_BAOriTearDown_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_BARecTearDown_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtBw_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtMcs_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtGi_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtOpMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtStbc_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtHtc_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtExtcha_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtMpduDensity_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtBaWinSize_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtRdg_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtLinkAdapt_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtAmsdu_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtAutoBa_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtProtect_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtMimoPs_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - - -INT Set_ForceShortGI_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ForceGF_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - INT SetCommonHT( IN PRTMP_ADAPTER pAd); -INT Set_SendPSMPAction_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtMIMOPSmode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - - -INT Set_HtTxBASize_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_HtDisallowTKIP_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - INT WpaCheckEapCode( IN PRTMP_ADAPTER pAd, IN PUCHAR pFrame, @@ -5103,15 +4921,6 @@ INT Set_FixedTxMode_Proc( IN PRTMP_ADAPTER pAd, IN PSTRING arg); - -INT Set_LongRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_ShortRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - BOOLEAN RT28XXChipsetCheck( IN void *_dev_p); @@ -5661,19 +5470,6 @@ void RtmpTimerQInit( IN RTMP_ADAPTER *pAd); #endif // RTMP_TIMER_TASK_SUPPORT // -/////////////////////////////////////// -INT RTMPShowCfgValue( - IN PRTMP_ADAPTER pAd, - IN PSTRING pName, - IN PSTRING pBuf); - -PSTRING RTMPGetRalinkAuthModeStr( - IN NDIS_802_11_AUTHENTICATION_MODE authMode); - -PSTRING RTMPGetRalinkEncryModeStr( - IN USHORT encryMode); -////////////////////////////////////// - VOID AsicStaBbpTuning( IN PRTMP_ADAPTER pAd); diff --git a/drivers/staging/rt2860/sta_ioctl.c b/drivers/staging/rt2860/sta_ioctl.c index a3aeb1ea63a3..df6130c981cd 100644 --- a/drivers/staging/rt2860/sta_ioctl.c +++ b/drivers/staging/rt2860/sta_ioctl.c @@ -61,42 +61,6 @@ typedef struct PACKED _RT_VERSION_INFO{ UINT DriverBuildDay; } RT_VERSION_INFO, *PRT_VERSION_INFO; -struct iw_priv_args privtab[] = { -{ RTPRIV_IOCTL_SET, - IW_PRIV_TYPE_CHAR | 1024, 0, - "set"}, - -{ RTPRIV_IOCTL_SHOW, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, - ""}, -/* --- sub-ioctls definitions --- */ - { SHOW_CONN_STATUS, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "connStatus" }, - { SHOW_DRVIER_VERION, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "driverVer" }, - { SHOW_BA_INFO, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "bainfo" }, - { SHOW_DESC_INFO, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "descinfo" }, - { RAIO_OFF, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "radio_off" }, - { RAIO_ON, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "radio_on" }, - { SHOW_CFG_VALUE, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "show" }, - { SHOW_ADHOC_ENTRY_INFO, - IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, "adhocEntry" }, -/* --- sub-ioctls relations --- */ - -{ RTPRIV_IOCTL_STATISTICS, - 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, - "stat"}, -{ RTPRIV_IOCTL_GSITESURVEY, - 0, IW_PRIV_TYPE_CHAR | 1024, - "get_site_survey"}, - - -}; - static __s32 ralinkrate[] = {2, 4, 11, 22, // CCK 12, 18, 24, 36, 48, 72, 96, 108, // OFDM @@ -113,190 +77,10 @@ INT Set_SSID_Proc( IN PRTMP_ADAPTER pAdapter, IN PSTRING arg); -#ifdef WMM_SUPPORT -INT Set_WmmCapable_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); -#endif - INT Set_NetworkType_Proc( IN PRTMP_ADAPTER pAdapter, IN PSTRING arg); -INT Set_AuthMode_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_EncrypType_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_DefaultKeyID_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_Key1_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_Key2_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_Key3_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_Key4_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_WPAPSK_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - - -INT Set_PSMode_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -#ifdef RT3090 -INT Set_PCIePSLevel_Proc( -IN PRTMP_ADAPTER pAdapter, -IN PUCHAR arg); -#endif // RT3090 // - -INT Set_Wpa_Support( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -NDIS_STATUS RTMPWPANoneAddKeyProc( - IN PRTMP_ADAPTER pAd, - IN PVOID pBuf); - -INT Set_FragTest_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_TGnWifiTest_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_LongRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - -INT Set_ShortRetryLimit_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); - - - -INT Show_Adhoc_MacTable_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING extra); - -INT Set_BeaconLostTime_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_AutoRoaming_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_SiteSurvey_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_ForceTxBurst_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -static struct { - PSTRING name; - INT (*set_proc)(PRTMP_ADAPTER pAdapter, PSTRING arg); -} *PRTMP_PRIVATE_SET_PROC, RTMP_PRIVATE_SUPPORT_PROC[] = { - {"DriverVersion", Set_DriverVersion_Proc}, - {"CountryRegion", Set_CountryRegion_Proc}, - {"CountryRegionABand", Set_CountryRegionABand_Proc}, - {"SSID", Set_SSID_Proc}, - {"WirelessMode", Set_WirelessMode_Proc}, - {"TxBurst", Set_TxBurst_Proc}, - {"TxPreamble", Set_TxPreamble_Proc}, - {"TxPower", Set_TxPower_Proc}, - {"Channel", Set_Channel_Proc}, - {"BGProtection", Set_BGProtection_Proc}, - {"RTSThreshold", Set_RTSThreshold_Proc}, - {"FragThreshold", Set_FragThreshold_Proc}, - {"HtBw", Set_HtBw_Proc}, - {"HtMcs", Set_HtMcs_Proc}, - {"HtGi", Set_HtGi_Proc}, - {"HtOpMode", Set_HtOpMode_Proc}, - {"HtExtcha", Set_HtExtcha_Proc}, - {"HtMpduDensity", Set_HtMpduDensity_Proc}, - {"HtBaWinSize", Set_HtBaWinSize_Proc}, - {"HtRdg", Set_HtRdg_Proc}, - {"HtAmsdu", Set_HtAmsdu_Proc}, - {"HtAutoBa", Set_HtAutoBa_Proc}, - {"HtBaDecline", Set_BADecline_Proc}, - {"HtProtect", Set_HtProtect_Proc}, - {"HtMimoPs", Set_HtMimoPs_Proc}, - {"HtDisallowTKIP", Set_HtDisallowTKIP_Proc}, -#ifdef AGGREGATION_SUPPORT - {"PktAggregate", Set_PktAggregate_Proc}, -#endif // AGGREGATION_SUPPORT // - -#ifdef WMM_SUPPORT - {"WmmCapable", Set_WmmCapable_Proc}, -#endif - {"IEEE80211H", Set_IEEE80211H_Proc}, - {"NetworkType", Set_NetworkType_Proc}, - {"AuthMode", Set_AuthMode_Proc}, - {"EncrypType", Set_EncrypType_Proc}, - {"DefaultKeyID", Set_DefaultKeyID_Proc}, - {"Key1", Set_Key1_Proc}, - {"Key2", Set_Key2_Proc}, - {"Key3", Set_Key3_Proc}, - {"Key4", Set_Key4_Proc}, - {"WPAPSK", Set_WPAPSK_Proc}, - {"ResetCounter", Set_ResetStatCounter_Proc}, - {"PSMode", Set_PSMode_Proc}, -#ifdef DBG - {"Debug", Set_Debug_Proc}, -#endif // DBG // - - - {"WpaSupport", Set_Wpa_Support}, - - - - - - {"FixedTxMode", Set_FixedTxMode_Proc}, - {"TGnWifiTest", Set_TGnWifiTest_Proc}, - {"ForceGF", Set_ForceGF_Proc}, - {"LongRetry", Set_LongRetryLimit_Proc}, - {"ShortRetry", Set_ShortRetryLimit_Proc}, - -//2008/09/11:KH add to support efuse<-- -#ifdef RT30xx -#ifdef RTMP_EFUSE_SUPPORT - {"efuseFreeNumber", set_eFuseGetFreeBlockCount_Proc}, - {"efuseDump", set_eFusedump_Proc}, - {"efuseLoadFromBin", set_eFuseLoadFromBin_Proc}, - {"efuseBufferModeWriteBack", set_eFuseBufferModeWriteBack_Proc}, -#endif // RTMP_EFUSE_SUPPORT // -#endif // RT30xx // -//2008/09/11:KH add to support efuse--> - {"BeaconLostTime", Set_BeaconLostTime_Proc}, - {"AutoRoaming", Set_AutoRoaming_Proc}, - {"SiteSurvey", Set_SiteSurvey_Proc}, - {"ForceTxBurst", Set_ForceTxBurst_Proc}, - - {NULL,} -}; - - VOID RTMPAddKey( IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) @@ -1656,117 +1440,6 @@ rt_ioctl_giwencode(struct net_device *dev, } -static int -rt_ioctl_setparam(struct net_device *dev, struct iw_request_info *info, - void *w, char *extra) -{ - PRTMP_ADAPTER pAdapter; - POS_COOKIE pObj; - PSTRING this_char = extra; - PSTRING value; - int Status=0; - - GET_PAD_FROM_NET_DEV(pAdapter, dev); - - pObj = (POS_COOKIE) pAdapter->OS_Cookie; - { - pObj->ioctl_if_type = INT_MAIN; - pObj->ioctl_if = MAIN_MBSSID; - } - - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - if (!*this_char) - return -EINVAL; - - if ((value = rtstrchr(this_char, '=')) != NULL) - *value++ = 0; - - if (!value && (strcmp(this_char, "SiteSurvey") != 0)) - return -EINVAL; - else - goto SET_PROC; - - // reject setting nothing besides ANY ssid(ssidLen=0) - if (!*value && (strcmp(this_char, "SSID") != 0)) - return -EINVAL; - -SET_PROC: - for (PRTMP_PRIVATE_SET_PROC = RTMP_PRIVATE_SUPPORT_PROC; PRTMP_PRIVATE_SET_PROC->name; PRTMP_PRIVATE_SET_PROC++) - { - if (strcmp(this_char, PRTMP_PRIVATE_SET_PROC->name) == 0) - { - if(!PRTMP_PRIVATE_SET_PROC->set_proc(pAdapter, value)) - { //FALSE:Set private failed then return Invalid argument - Status = -EINVAL; - } - break; //Exit for loop. - } - } - - if(PRTMP_PRIVATE_SET_PROC->name == NULL) - { //Not found argument - Status = -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("===>rt_ioctl_setparam:: (iwpriv) Not Support Set Command [%s=%s]\n", this_char, value)); - } - - return Status; -} - - -static int -rt_private_get_statistics(struct net_device *dev, struct iw_request_info *info, - struct iw_point *wrq, char *extra) -{ - INT Status = 0; - PRTMP_ADAPTER pAd = NULL; - - GET_PAD_FROM_NET_DEV(pAd, dev); - - if (extra == NULL) - { - wrq->length = 0; - return -EIO; - } - - memset(extra, 0x00, IW_PRIV_SIZE_MASK); - sprintf(extra, "\n\n"); - - { - sprintf(extra+strlen(extra), "Tx success = %ld\n", (ULONG)pAd->WlanCounters.TransmittedFragmentCount.QuadPart); - sprintf(extra+strlen(extra), "Tx success without retry = %ld\n", (ULONG)pAd->WlanCounters.TransmittedFragmentCount.QuadPart - (ULONG)pAd->WlanCounters.RetryCount.QuadPart); - } - sprintf(extra+strlen(extra), "Tx success after retry = %ld\n", (ULONG)pAd->WlanCounters.RetryCount.QuadPart); - sprintf(extra+strlen(extra), "Tx fail to Rcv ACK after retry = %ld\n", (ULONG)pAd->WlanCounters.FailedCount.QuadPart); - sprintf(extra+strlen(extra), "RTS Success Rcv CTS = %ld\n", (ULONG)pAd->WlanCounters.RTSSuccessCount.QuadPart); - sprintf(extra+strlen(extra), "RTS Fail Rcv CTS = %ld\n", (ULONG)pAd->WlanCounters.RTSFailureCount.QuadPart); - - sprintf(extra+strlen(extra), "Rx success = %ld\n", (ULONG)pAd->WlanCounters.ReceivedFragmentCount.QuadPart); - sprintf(extra+strlen(extra), "Rx with CRC = %ld\n", (ULONG)pAd->WlanCounters.FCSErrorCount.QuadPart); - sprintf(extra+strlen(extra), "Rx drop due to out of resource = %ld\n", (ULONG)pAd->Counters8023.RxNoBuffer); - sprintf(extra+strlen(extra), "Rx duplicate frame = %ld\n", (ULONG)pAd->WlanCounters.FrameDuplicateCount.QuadPart); - - sprintf(extra+strlen(extra), "False CCA (one second) = %ld\n", (ULONG)pAd->RalinkCounters.OneSecFalseCCACnt); - { - sprintf(extra+strlen(extra), "RSSI-A = %ld\n", (LONG)(pAd->StaCfg.RssiSample.LastRssi0 - pAd->BbpRssiToDbmDelta)); - sprintf(extra+strlen(extra), "RSSI-B (if available) = %ld\n", (LONG)(pAd->StaCfg.RssiSample.LastRssi1 - pAd->BbpRssiToDbmDelta)); - sprintf(extra+strlen(extra), "RSSI-C (if available) = %ld\n\n", (LONG)(pAd->StaCfg.RssiSample.LastRssi2 - pAd->BbpRssiToDbmDelta)); - } - sprintf(extra+strlen(extra), "WpaSupplicantUP = %d\n\n", pAd->StaCfg.WpaSupplicantUP); - - - - wrq->length = strlen(extra) + 1; // 1: size of '\0' - DBGPRINT(RT_DEBUG_TRACE, ("<== rt_private_get_statistics, wrq->length = %d\n", wrq->length)); - - return Status; -} - void getBaInfo( IN PRTMP_ADAPTER pAd, IN PSTRING pOutBuf) @@ -1814,143 +1487,6 @@ void getBaInfo( return; } -static int -rt_private_show(struct net_device *dev, struct iw_request_info *info, - struct iw_point *wrq, PSTRING extra) -{ - INT Status = 0; - PRTMP_ADAPTER pAd; - POS_COOKIE pObj; - u32 subcmd = wrq->flags; - - GET_PAD_FROM_NET_DEV(pAd, dev); - - pObj = (POS_COOKIE) pAd->OS_Cookie; - if (extra == NULL) - { - wrq->length = 0; - return -EIO; - } - memset(extra, 0x00, IW_PRIV_SIZE_MASK); - - { - pObj->ioctl_if_type = INT_MAIN; - pObj->ioctl_if = MAIN_MBSSID; - } - - switch(subcmd) - { - - case SHOW_CONN_STATUS: - if (MONITOR_ON(pAd)) - { - if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED && - pAd->CommonCfg.RegTransmitSetting.field.BW) - sprintf(extra, "Monitor Mode(CentralChannel %d)\n", pAd->CommonCfg.CentralChannel); - else - sprintf(extra, "Monitor Mode(Channel %d)\n", pAd->CommonCfg.Channel); - } - else - { - if (pAd->IndicateMediaState == NdisMediaStateConnected) - { - if (INFRA_ON(pAd)) - { - sprintf(extra, "Connected(AP: %s[%02X:%02X:%02X:%02X:%02X:%02X])\n", - pAd->CommonCfg.Ssid, - pAd->CommonCfg.Bssid[0], - pAd->CommonCfg.Bssid[1], - pAd->CommonCfg.Bssid[2], - pAd->CommonCfg.Bssid[3], - pAd->CommonCfg.Bssid[4], - pAd->CommonCfg.Bssid[5]); - DBGPRINT(RT_DEBUG_TRACE ,("Ssid=%s ,Ssidlen = %d\n",pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen)); - } - else if (ADHOC_ON(pAd)) - sprintf(extra, "Connected\n"); - } - else - { - sprintf(extra, "Disconnected\n"); - DBGPRINT(RT_DEBUG_TRACE ,("ConnStatus is not connected\n")); - } - } - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; - case SHOW_DRVIER_VERION: - sprintf(extra, "Driver version-%s, %s %s\n", STA_DRIVER_VERSION, __DATE__, __TIME__ ); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; - case SHOW_BA_INFO: - getBaInfo(pAd, extra); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; - case SHOW_DESC_INFO: - { - Show_DescInfo_Proc(pAd, NULL); - wrq->length = 0; // 1: size of '\0' - } - break; - case RAIO_OFF: - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - { - if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { - RTMP_MLME_RESET_STATE_MACHINE(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); - } - } - pAd->StaCfg.bSwRadio = FALSE; - if (pAd->StaCfg.bRadio != (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio)) - { - pAd->StaCfg.bRadio = (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio); - if (pAd->StaCfg.bRadio == FALSE) - { - MlmeRadioOff(pAd); - // Update extra information - pAd->ExtraInfo = SW_RADIO_OFF; - } - } - sprintf(extra, "Radio Off\n"); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; - case RAIO_ON: - pAd->StaCfg.bSwRadio = TRUE; - //if (pAd->StaCfg.bRadio != (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio)) - { - pAd->StaCfg.bRadio = (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio); - if (pAd->StaCfg.bRadio == TRUE) - { - MlmeRadioOn(pAd); - // Update extra information - pAd->ExtraInfo = EXTRA_INFO_CLEAR; - } - } - sprintf(extra, "Radio On\n"); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; - - - - case SHOW_CFG_VALUE: - { - Status = RTMPShowCfgValue(pAd, (PSTRING) wrq->pointer, extra); - if (Status == 0) - wrq->length = strlen(extra) + 1; // 1: size of '\0' - } - break; - case SHOW_ADHOC_ENTRY_INFO: - Show_Adhoc_MacTable_Proc(pAd, extra); - wrq->length = strlen(extra) + 1; // 1: size of '\0' - break; - default: - DBGPRINT(RT_DEBUG_TRACE, ("%s - unknow subcmd = %d\n", __func__, subcmd)); - break; - } - - return Status; -} - int rt_ioctl_siwmlme(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, @@ -2774,43 +2310,10 @@ static const iw_handler rt_handler[] = (iw_handler) rt_ioctl_siwpmksa, /* SIOCSIWPMKSA */ }; -static const iw_handler rt_priv_handlers[] = { - (iw_handler) NULL, /* + 0x00 */ - (iw_handler) NULL, /* + 0x01 */ - (iw_handler) rt_ioctl_setparam, /* + 0x02 */ - (iw_handler) NULL, /* + 0x03 */ - (iw_handler) NULL, /* + 0x04 */ - (iw_handler) NULL, /* + 0x05 */ - (iw_handler) NULL, /* + 0x06 */ - (iw_handler) NULL, /* + 0x07 */ - (iw_handler) NULL, /* + 0x08 */ - (iw_handler) rt_private_get_statistics, /* + 0x09 */ - (iw_handler) NULL, /* + 0x0A */ - (iw_handler) NULL, /* + 0x0B */ - (iw_handler) NULL, /* + 0x0C */ - (iw_handler) NULL, /* + 0x0D */ - (iw_handler) NULL, /* + 0x0E */ - (iw_handler) NULL, /* + 0x0F */ - (iw_handler) NULL, /* + 0x10 */ - (iw_handler) rt_private_show, /* + 0x11 */ - (iw_handler) NULL, /* + 0x12 */ - (iw_handler) NULL, /* + 0x13 */ - (iw_handler) NULL, /* + 0x14 */ - (iw_handler) NULL, /* + 0x15 */ - (iw_handler) NULL, /* + 0x16 */ - (iw_handler) NULL, /* + 0x17 */ - (iw_handler) NULL, /* + 0x18 */ -}; - const struct iw_handler_def rt28xx_iw_handler_def = { -#define N(a) (sizeof (a) / sizeof (a[0])) .standard = (iw_handler *) rt_handler, .num_standard = sizeof(rt_handler) / sizeof(iw_handler), - .private = (iw_handler *) rt_priv_handlers, - .num_private = N(rt_priv_handlers), - .private_args = (struct iw_priv_args *) privtab, - .num_private_args = N(privtab), #if IW_HANDLER_VERSION >= 7 .get_wireless_stats = rt28xx_get_wireless_stats, #endif @@ -2980,17 +2483,8 @@ INT rt28xx_sta_ioctl( case RT_PRIV_IOCTL_EXT: case RTPRIV_IOCTL_SET: case RTPRIV_IOCTL_GSITESURVEY: - Status = -EOPNOTSUPP; - break; case SIOCGIWPRIV: - if (wrq->u.data.pointer) - { - if ( access_ok(VERIFY_WRITE, wrq->u.data.pointer, sizeof(privtab)) != TRUE) - break; - wrq->u.data.length = sizeof(privtab) / sizeof(privtab[0]); - if (copy_to_user(wrq->u.data.pointer, privtab, sizeof(privtab))) - Status = -EFAULT; - } + Status = -EOPNOTSUPP; break; case SIOCETHTOOL: break; @@ -3087,41 +2581,6 @@ INT Set_SSID_Proc( return success; } -#ifdef WMM_SUPPORT -/* - ========================================================================== - Description: - Set WmmCapable Enable or Disable - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_WmmCapable_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - BOOLEAN bWmmCapable; - - bWmmCapable = simple_strtol(arg, 0, 10); - - if ((bWmmCapable == 1) -#ifdef RTMP_MAC_USB - && (pAd->NumberOfPipes >= 5) -#endif // RTMP_MAC_USB // - ) - pAd->CommonCfg.bWmmCapable = TRUE; - else if (bWmmCapable == 0) - pAd->CommonCfg.bWmmCapable = FALSE; - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_WmmCapable_Proc::(bWmmCapable=%d)\n", - pAd->CommonCfg.bWmmCapable)); - - return TRUE; -} -#endif // WMM_SUPPORT // - /* ========================================================================== Description: @@ -3306,765 +2765,3 @@ INT Set_NetworkType_Proc( return TRUE; } - -/* - ========================================================================== - Description: - Set Authentication mode - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_AuthMode_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - if ((strcmp(arg, "WEPAUTO") == 0) || (strcmp(arg, "wepauto") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeAutoSwitch; - else if ((strcmp(arg, "OPEN") == 0) || (strcmp(arg, "open") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; - else if ((strcmp(arg, "SHARED") == 0) || (strcmp(arg, "shared") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeShared; - else if ((strcmp(arg, "WPAPSK") == 0) || (strcmp(arg, "wpapsk") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPAPSK; - else if ((strcmp(arg, "WPANONE") == 0) || (strcmp(arg, "wpanone") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPANone; - else if ((strcmp(arg, "WPA2PSK") == 0) || (strcmp(arg, "wpa2psk") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPA2PSK; - else if ((strcmp(arg, "WPA") == 0) || (strcmp(arg, "wpa") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPA; - else if ((strcmp(arg, "WPA2") == 0) || (strcmp(arg, "wpa2") == 0)) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPA2; - else - return FALSE; - - pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - - DBGPRINT(RT_DEBUG_TRACE, ("Set_AuthMode_Proc::(AuthMode=%d)\n", pAdapter->StaCfg.AuthMode)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Encryption Type - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_EncrypType_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - if ((strcmp(arg, "NONE") == 0) || (strcmp(arg, "none") == 0)) - { - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - pAdapter->StaCfg.WepStatus = Ndis802_11WEPDisabled; - pAdapter->StaCfg.PairCipher = Ndis802_11WEPDisabled; - pAdapter->StaCfg.GroupCipher = Ndis802_11WEPDisabled; - } - else if ((strcmp(arg, "WEP") == 0) || (strcmp(arg, "wep") == 0)) - { - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - pAdapter->StaCfg.WepStatus = Ndis802_11WEPEnabled; - pAdapter->StaCfg.PairCipher = Ndis802_11WEPEnabled; - pAdapter->StaCfg.GroupCipher = Ndis802_11WEPEnabled; - } - else if ((strcmp(arg, "TKIP") == 0) || (strcmp(arg, "tkip") == 0)) - { - if (pAdapter->StaCfg.AuthMode < Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - pAdapter->StaCfg.WepStatus = Ndis802_11Encryption2Enabled; - pAdapter->StaCfg.PairCipher = Ndis802_11Encryption2Enabled; - pAdapter->StaCfg.GroupCipher = Ndis802_11Encryption2Enabled; - } - else if ((strcmp(arg, "AES") == 0) || (strcmp(arg, "aes") == 0)) - { - if (pAdapter->StaCfg.AuthMode < Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - pAdapter->StaCfg.WepStatus = Ndis802_11Encryption3Enabled; - pAdapter->StaCfg.PairCipher = Ndis802_11Encryption3Enabled; - pAdapter->StaCfg.GroupCipher = Ndis802_11Encryption3Enabled; - } - else - return FALSE; - - pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; - - DBGPRINT(RT_DEBUG_TRACE, ("Set_EncrypType_Proc::(EncrypType=%d)\n", pAdapter->StaCfg.WepStatus)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Default Key ID - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_DefaultKeyID_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - ULONG KeyIdx; - - KeyIdx = simple_strtol(arg, 0, 10); - if((KeyIdx >= 1 ) && (KeyIdx <= 4)) - pAdapter->StaCfg.DefaultKeyId = (UCHAR) (KeyIdx - 1 ); - else - return FALSE; //Invalid argument - - DBGPRINT(RT_DEBUG_TRACE, ("Set_DefaultKeyID_Proc::(DefaultKeyID=%d)\n", pAdapter->StaCfg.DefaultKeyId)); - - return TRUE; -} - -/* - ========================================================================== - Description: - Set WEP KEY1 - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Key1_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - int KeyLen; - int i; - UCHAR CipherAlg=CIPHER_WEP64; - - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - KeyLen = strlen(arg); - - switch (KeyLen) - { - case 5: //wep 40 Ascii type - pAdapter->SharedKey[BSS0][0].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][0].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key1_Proc::(Key1=%s and type=%s)\n", arg, "Ascii")); - break; - case 10: //wep 40 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][0].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][0].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key1_Proc::(Key1=%s and type=%s)\n", arg, "Hex")); - break; - case 13: //wep 104 Ascii type - pAdapter->SharedKey[BSS0][0].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][0].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key1_Proc::(Key1=%s and type=%s)\n", arg, "Ascii")); - break; - case 26: //wep 104 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][0].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][0].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key1_Proc::(Key1=%s and type=%s)\n", arg, "Hex")); - break; - default: //Invalid argument - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key1_Proc::Invalid argument (=%s)\n", arg)); - return FALSE; - } - - pAdapter->SharedKey[BSS0][0].CipherAlg = CipherAlg; - - // Set keys (into ASIC) - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - ; // not support - else // Old WEP stuff - { - AsicAddSharedKeyEntry(pAdapter, - 0, - 0, - pAdapter->SharedKey[BSS0][0].CipherAlg, - pAdapter->SharedKey[BSS0][0].Key, - NULL, - NULL); - } - - return TRUE; -} -/* - ========================================================================== - - Description: - Set WEP KEY2 - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Key2_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - int KeyLen; - int i; - UCHAR CipherAlg=CIPHER_WEP64; - - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - KeyLen = strlen(arg); - - switch (KeyLen) - { - case 5: //wep 40 Ascii type - pAdapter->SharedKey[BSS0][1].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][1].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key2_Proc::(Key2=%s and type=%s)\n", arg, "Ascii")); - break; - case 10: //wep 40 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][1].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][1].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key2_Proc::(Key2=%s and type=%s)\n", arg, "Hex")); - break; - case 13: //wep 104 Ascii type - pAdapter->SharedKey[BSS0][1].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][1].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key2_Proc::(Key2=%s and type=%s)\n", arg, "Ascii")); - break; - case 26: //wep 104 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][1].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][1].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key2_Proc::(Key2=%s and type=%s)\n", arg, "Hex")); - break; - default: //Invalid argument - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key2_Proc::Invalid argument (=%s)\n", arg)); - return FALSE; - } - pAdapter->SharedKey[BSS0][1].CipherAlg = CipherAlg; - - // Set keys (into ASIC) - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - ; // not support - else // Old WEP stuff - { - AsicAddSharedKeyEntry(pAdapter, - 0, - 1, - pAdapter->SharedKey[BSS0][1].CipherAlg, - pAdapter->SharedKey[BSS0][1].Key, - NULL, - NULL); - } - - return TRUE; -} -/* - ========================================================================== - Description: - Set WEP KEY3 - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Key3_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - int KeyLen; - int i; - UCHAR CipherAlg=CIPHER_WEP64; - - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - KeyLen = strlen(arg); - - switch (KeyLen) - { - case 5: //wep 40 Ascii type - pAdapter->SharedKey[BSS0][2].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][2].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key3_Proc::(Key3=%s and type=Ascii)\n", arg)); - break; - case 10: //wep 40 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][2].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][2].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key3_Proc::(Key3=%s and type=Hex)\n", arg)); - break; - case 13: //wep 104 Ascii type - pAdapter->SharedKey[BSS0][2].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][2].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key3_Proc::(Key3=%s and type=Ascii)\n", arg)); - break; - case 26: //wep 104 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][2].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][2].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key3_Proc::(Key3=%s and type=Hex)\n", arg)); - break; - default: //Invalid argument - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key3_Proc::Invalid argument (=%s)\n", arg)); - return FALSE; - } - pAdapter->SharedKey[BSS0][2].CipherAlg = CipherAlg; - - // Set keys (into ASIC) - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - ; // not support - else // Old WEP stuff - { - AsicAddSharedKeyEntry(pAdapter, - 0, - 2, - pAdapter->SharedKey[BSS0][2].CipherAlg, - pAdapter->SharedKey[BSS0][2].Key, - NULL, - NULL); - } - - return TRUE; -} -/* - ========================================================================== - Description: - Set WEP KEY4 - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Key4_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - int KeyLen; - int i; - UCHAR CipherAlg=CIPHER_WEP64; - - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - return TRUE; // do nothing - - KeyLen = strlen(arg); - - switch (KeyLen) - { - case 5: //wep 40 Ascii type - pAdapter->SharedKey[BSS0][3].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][3].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key4_Proc::(Key4=%s and type=%s)\n", arg, "Ascii")); - break; - case 10: //wep 40 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][3].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][3].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP64; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key4_Proc::(Key4=%s and type=%s)\n", arg, "Hex")); - break; - case 13: //wep 104 Ascii type - pAdapter->SharedKey[BSS0][3].KeyLen = KeyLen; - memcpy(pAdapter->SharedKey[BSS0][3].Key, arg, KeyLen); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key4_Proc::(Key4=%s and type=%s)\n", arg, "Ascii")); - break; - case 26: //wep 104 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(arg+i)) ) - return FALSE; //Not Hex value; - } - pAdapter->SharedKey[BSS0][3].KeyLen = KeyLen / 2 ; - AtoH(arg, pAdapter->SharedKey[BSS0][3].Key, KeyLen / 2); - CipherAlg = CIPHER_WEP128; - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key4_Proc::(Key4=%s and type=%s)\n", arg, "Hex")); - break; - default: //Invalid argument - DBGPRINT(RT_DEBUG_TRACE, ("Set_Key4_Proc::Invalid argument (=%s)\n", arg)); - return FALSE; - } - pAdapter->SharedKey[BSS0][3].CipherAlg = CipherAlg; - - // Set keys (into ASIC) - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - ; // not support - else // Old WEP stuff - { - AsicAddSharedKeyEntry(pAdapter, - 0, - 3, - pAdapter->SharedKey[BSS0][3].CipherAlg, - pAdapter->SharedKey[BSS0][3].Key, - NULL, - NULL); - } - - return TRUE; -} - -/* - ========================================================================== - Description: - Set WPA PSK key - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_WPAPSK_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - int status; - - if ((pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPAPSK) && - (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPA2PSK) && - (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPANone) - ) - return TRUE; // do nothing - - DBGPRINT(RT_DEBUG_TRACE, ("Set_WPAPSK_Proc::(WPAPSK=%s)\n", arg)); - - status = RT_CfgSetWPAPSKKey(pAd, arg, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, pAd->StaCfg.PMK); - if (status == FALSE) - { - DBGPRINT(RT_DEBUG_TRACE, ("Set_WPAPSK_Proc(): Set key failed!\n")); - return FALSE; - } - NdisZeroMemory(pAd->StaCfg.WpaPassPhrase, 64); - NdisMoveMemory(pAd->StaCfg.WpaPassPhrase, arg, strlen(arg)); - pAd->StaCfg.WpaPassPhraseLen = (UINT)strlen(arg); - - - - if(pAd->StaCfg.BssType == BSS_ADHOC && - pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) - { - pAd->StaCfg.WpaState = SS_NOTUSE; - } - else - { - // Start STA supplicant state machine - pAd->StaCfg.WpaState = SS_START; - } - - return TRUE; -} - -/* - ========================================================================== - Description: - Set Power Saving mode - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_PSMode_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) -{ - if (pAdapter->StaCfg.BssType == BSS_INFRA) - { - if ((strcmp(arg, "Max_PSP") == 0) || - (strcmp(arg, "max_psp") == 0) || - (strcmp(arg, "MAX_PSP") == 0)) - { - // do NOT turn on PSM bit here, wait until MlmeCheckPsmChange() - // to exclude certain situations. - if (pAdapter->StaCfg.bWindowsACCAMEnable == FALSE) - pAdapter->StaCfg.WindowsPowerMode = Ndis802_11PowerModeMAX_PSP; - pAdapter->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeMAX_PSP; - OPSTATUS_SET_FLAG(pAdapter, fOP_STATUS_RECEIVE_DTIM); - pAdapter->StaCfg.DefaultListenCount = 5; - - } - else if ((strcmp(arg, "Fast_PSP") == 0) || - (strcmp(arg, "fast_psp") == 0) || - (strcmp(arg, "FAST_PSP") == 0)) - { - // do NOT turn on PSM bit here, wait until MlmeCheckPsmChange() - // to exclude certain situations. - OPSTATUS_SET_FLAG(pAdapter, fOP_STATUS_RECEIVE_DTIM); - if (pAdapter->StaCfg.bWindowsACCAMEnable == FALSE) - pAdapter->StaCfg.WindowsPowerMode = Ndis802_11PowerModeFast_PSP; - pAdapter->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeFast_PSP; - pAdapter->StaCfg.DefaultListenCount = 3; - } - else if ((strcmp(arg, "Legacy_PSP") == 0) || - (strcmp(arg, "legacy_psp") == 0) || - (strcmp(arg, "LEGACY_PSP") == 0)) - { - // do NOT turn on PSM bit here, wait until MlmeCheckPsmChange() - // to exclude certain situations. - OPSTATUS_SET_FLAG(pAdapter, fOP_STATUS_RECEIVE_DTIM); - if (pAdapter->StaCfg.bWindowsACCAMEnable == FALSE) - pAdapter->StaCfg.WindowsPowerMode = Ndis802_11PowerModeLegacy_PSP; - pAdapter->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeLegacy_PSP; - pAdapter->StaCfg.DefaultListenCount = 3; - } - else - { - //Default Ndis802_11PowerModeCAM - // clear PSM bit immediately - RTMP_SET_PSM_BIT(pAdapter, PWR_ACTIVE); - OPSTATUS_SET_FLAG(pAdapter, fOP_STATUS_RECEIVE_DTIM); - if (pAdapter->StaCfg.bWindowsACCAMEnable == FALSE) - pAdapter->StaCfg.WindowsPowerMode = Ndis802_11PowerModeCAM; - pAdapter->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeCAM; - } - - DBGPRINT(RT_DEBUG_TRACE, ("Set_PSMode_Proc::(PSMode=%ld)\n", pAdapter->StaCfg.WindowsPowerMode)); - } - else - return FALSE; - - - return TRUE; -} - -/* - ========================================================================== - Description: - Set WpaSupport flag. - Value: - 0: Driver ignore wpa_supplicant. - 1: wpa_supplicant initiates scanning and AP selection. - 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters. - Return: - TRUE if all parameters are OK, FALSE otherwise - ========================================================================== -*/ -INT Set_Wpa_Support( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - - if ( simple_strtol(arg, 0, 10) == 0) - pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_DISABLE; - else if ( simple_strtol(arg, 0, 10) == 1) - pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_ENABLE; - else if ( simple_strtol(arg, 0, 10) == 2) - pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_ENABLE_WITH_WEB_UI; - else - pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_DISABLE; - - DBGPRINT(RT_DEBUG_TRACE, ("Set_Wpa_Support::(WpaSupplicantUP=%d)\n", pAd->StaCfg.WpaSupplicantUP)); - - return TRUE; -} - -INT Set_TGnWifiTest_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - if (simple_strtol(arg, 0, 10) == 0) - pAd->StaCfg.bTGnWifiTest = FALSE; - else - pAd->StaCfg.bTGnWifiTest = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_TGnWifiTest_Proc::(bTGnWifiTest=%d)\n", pAd->StaCfg.bTGnWifiTest)); - return TRUE; -} - - - - -INT Show_Adhoc_MacTable_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING extra) -{ - INT i; - - sprintf(extra, "\n"); - - sprintf(extra + strlen(extra), "HT Operating Mode : %d\n", pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode); - - sprintf(extra + strlen(extra), "\n%-19s%-4s%-4s%-7s%-7s%-7s%-10s%-6s%-6s%-6s%-6s\n", - "MAC", "AID", "BSS", "RSSI0", "RSSI1", "RSSI2", "PhMd", "BW", "MCS", "SGI", "STBC"); - - for (i=1; iMacTab.Content[i]; - - if (strlen(extra) > (IW_PRIV_SIZE_MASK - 30)) - break; - if ((pEntry->ValidAsCLI || pEntry->ValidAsApCli) && (pEntry->Sst == SST_ASSOC)) - { - sprintf(extra + strlen(extra), "%02X:%02X:%02X:%02X:%02X:%02X ", - pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2], - pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]); - sprintf(extra + strlen(extra), "%-4d", (int)pEntry->Aid); - sprintf(extra + strlen(extra), "%-4d", (int)pEntry->apidx); - sprintf(extra + strlen(extra), "%-7d", pEntry->RssiSample.AvgRssi0); - sprintf(extra + strlen(extra), "%-7d", pEntry->RssiSample.AvgRssi1); - sprintf(extra + strlen(extra), "%-7d", pEntry->RssiSample.AvgRssi2); - sprintf(extra + strlen(extra), "%-10s", GetPhyMode(pEntry->HTPhyMode.field.MODE)); - sprintf(extra + strlen(extra), "%-6s", GetBW(pEntry->HTPhyMode.field.BW)); - sprintf(extra + strlen(extra), "%-6d", pEntry->HTPhyMode.field.MCS); - sprintf(extra + strlen(extra), "%-6d", pEntry->HTPhyMode.field.ShortGI); - sprintf(extra + strlen(extra), "%-6d", pEntry->HTPhyMode.field.STBC); - sprintf(extra + strlen(extra), "%-10d, %d, %d%%\n", pEntry->DebugFIFOCount, pEntry->DebugTxCount, - (pEntry->DebugTxCount) ? ((pEntry->DebugTxCount-pEntry->DebugFIFOCount)*100/pEntry->DebugTxCount) : 0); - sprintf(extra, "%s\n", extra); - } - } - - return TRUE; -} - - -INT Set_BeaconLostTime_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - ULONG ltmp = (ULONG)simple_strtol(arg, 0, 10); - - if ((ltmp != 0) && (ltmp <= 60)) - pAd->StaCfg.BeaconLostTime = (ltmp * OS_HZ); - - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_BeaconLostTime_Proc::(BeaconLostTime=%ld)\n", pAd->StaCfg.BeaconLostTime)); - return TRUE; -} - -INT Set_AutoRoaming_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - if (simple_strtol(arg, 0, 10) == 0) - pAd->StaCfg.bAutoRoaming = FALSE; - else - pAd->StaCfg.bAutoRoaming = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_AutoRoaming_Proc::(bAutoRoaming=%d)\n", pAd->StaCfg.bAutoRoaming)); - return TRUE; -} - - -/* - ========================================================================== - Description: - Issue a site survey command to driver - Arguments: - pAdapter Pointer to our adapter - wrq Pointer to the ioctl argument - - Return Value: - None - - Note: - Usage: - 1.) iwpriv ra0 set site_survey - ========================================================================== -*/ -INT Set_SiteSurvey_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - NDIS_802_11_SSID Ssid; - - //check if the interface is down - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - if (MONITOR_ON(pAd)) - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! Driver is in Monitor Mode now !!!\n")); - return -EINVAL; - } - - RTMPZeroMemory(&Ssid, sizeof(NDIS_802_11_SSID)); - Ssid.SsidLength = 0; - if ((arg != NULL) && - (strlen(arg) <= MAX_LEN_OF_SSID)) - { - RTMPMoveMemory(Ssid.Ssid, arg, strlen(arg)); - Ssid.SsidLength = strlen(arg); - } - - pAd->StaCfg.bScanReqIsFromWebUI = TRUE; - - if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { - RTMP_MLME_RESET_STATE_MACHINE(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); - } - - // tell CNTL state machine to call NdisMSetInformationComplete() after completing - // this request, because this request is initiated by NDIS. - pAd->MlmeAux.CurrReqIsFromNdis = FALSE; - // Reset allowed scan retries - pAd->StaCfg.ScanCnt = 0; - NdisGetSystemUpTime(&pAd->StaCfg.LastScanTime); - - MlmeEnqueue(pAd, - MLME_CNTL_STATE_MACHINE, - OID_802_11_BSSID_LIST_SCAN, - Ssid.SsidLength, - Ssid.Ssid); - - RTMP_MLME_HANDLER(pAd); - - DBGPRINT(RT_DEBUG_TRACE, ("Set_SiteSurvey_Proc\n")); - - return TRUE; -} - -INT Set_ForceTxBurst_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - if (simple_strtol(arg, 0, 10) == 0) - pAd->StaCfg.bForceTxBurst = FALSE; - else - pAd->StaCfg.bForceTxBurst = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, ("IF Set_ForceTxBurst_Proc::(bForceTxBurst=%d)\n", pAd->StaCfg.bForceTxBurst)); - return TRUE; -} -- GitLab From 782f1111256557c75415f57cd360ebf9d1377a55 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Wed, 21 Oct 2009 22:44:27 +0200 Subject: [PATCH 151/235] Staging: rt28x0: remove support for private driver parameters Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/Makefile | 1 - drivers/staging/rt2860/common/rtmp_init.c | 9 --- drivers/staging/rt2860/rt_profile.c | 95 ----------------------- drivers/staging/rt2860/rtmp.h | 3 - drivers/staging/rt2870/Makefile | 1 - 5 files changed, 109 deletions(-) delete mode 100644 drivers/staging/rt2860/rt_profile.c diff --git a/drivers/staging/rt2860/Makefile b/drivers/staging/rt2860/Makefile index ba171427ac9d..09e448a0ff84 100644 --- a/drivers/staging/rt2860/Makefile +++ b/drivers/staging/rt2860/Makefile @@ -38,7 +38,6 @@ rt2860sta-objs := \ sta/connect.o \ sta/wpa.o \ rt_linux.o \ - rt_profile.o \ rt_main_dev.o \ sta_ioctl.o \ common/ba_action.o \ diff --git a/drivers/staging/rt2860/common/rtmp_init.c b/drivers/staging/rt2860/common/rtmp_init.c index 3b43101102f3..9e1c73dbfb26 100644 --- a/drivers/staging/rt2860/common/rtmp_init.c +++ b/drivers/staging/rt2860/common/rtmp_init.c @@ -3439,16 +3439,7 @@ int rt28xx_init( goto err3; } - // Read parameters from Config File - Status = RTMPReadParametersHook(pAd); - DBGPRINT(RT_DEBUG_OFF, ("1. Phy Mode = %d\n", pAd->CommonCfg.PhyMode)); - if (Status != NDIS_STATUS_SUCCESS) - { - DBGPRINT_ERR(("NICReadRegParameters failed, Status[=0x%08x]\n",Status)); -// goto err4; - Status = 0; - } #ifdef RTMP_MAC_USB pAd->CommonCfg.bMultipleIRP = FALSE; diff --git a/drivers/staging/rt2860/rt_profile.c b/drivers/staging/rt2860/rt_profile.c deleted file mode 100644 index 4355331a2f2c..000000000000 --- a/drivers/staging/rt2860/rt_profile.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* - - Module Name: - rt_profile.c - - Abstract: - - Revision History: - Who When What - --------- ---------- ---------------------------------------------- - */ - -#include "rt_config.h" - - -NDIS_STATUS RTMPReadParametersHook( - IN PRTMP_ADAPTER pAd) -{ - PSTRING src = NULL; - RTMP_OS_FD srcf; - RTMP_OS_FS_INFO osFSInfo; - INT retval = NDIS_STATUS_FAILURE; - PSTRING buffer; - - buffer = kmalloc(MAX_INI_BUFFER_SIZE, MEM_ALLOC_FLAG); - if(buffer == NULL) - return NDIS_STATUS_FAILURE; - memset(buffer, 0x00, MAX_INI_BUFFER_SIZE); - - { - { - src = STA_PROFILE_PATH; - } - } - - if (src && *src) - { - RtmpOSFSInfoChange(&osFSInfo, TRUE); - srcf = RtmpOSFileOpen(src, O_RDONLY, 0); - if (IS_FILE_OPEN_ERR(srcf)) - { - DBGPRINT(RT_DEBUG_ERROR, ("Open file \"%s\" failed!\n", src)); - } - else - { - retval =RtmpOSFileRead(srcf, buffer, MAX_INI_BUFFER_SIZE); - if (retval > 0) - { - RTMPSetProfileParameters(pAd, buffer); - retval = NDIS_STATUS_SUCCESS; - } - else - DBGPRINT(RT_DEBUG_ERROR, ("Read file \"%s\" failed(errCode=%d)!\n", src, retval)); - - retval = RtmpOSFileClose(srcf); - if ( retval != 0) - { - retval = NDIS_STATUS_FAILURE; - DBGPRINT(RT_DEBUG_ERROR, ("Close file \"%s\" failed(errCode=%d)!\n", src, retval)); - } - } - - RtmpOSFSInfoChange(&osFSInfo, FALSE); - } - - kfree(buffer); - - return (retval); - -} - diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h index 59fd05bf9804..3ec50b5f61c7 100644 --- a/drivers/staging/rt2860/rtmp.h +++ b/drivers/staging/rt2860/rtmp.h @@ -2453,9 +2453,6 @@ NDIS_STATUS RTMPAllocAdapterBlock( NDIS_STATUS RTMPAllocTxRxRingMemory( IN PRTMP_ADAPTER pAd); -NDIS_STATUS RTMPReadParametersHook( - IN PRTMP_ADAPTER pAd); - NDIS_STATUS RTMPSetProfileParameters( IN RTMP_ADAPTER *pAd, IN PSTRING pBuffer); diff --git a/drivers/staging/rt2870/Makefile b/drivers/staging/rt2870/Makefile index 661cdf9b6157..92668eb349e1 100644 --- a/drivers/staging/rt2870/Makefile +++ b/drivers/staging/rt2870/Makefile @@ -39,7 +39,6 @@ rt2870sta-objs := \ sta/connect.o \ sta/wpa.o \ rt_linux.o \ - rt_profile.o \ rt_main_dev.o \ sta_ioctl.o \ common/ba_action.o \ -- GitLab From 44c68c23b16c85127d187fd720f95aa2e7a94d2e Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Wed, 21 Oct 2009 22:44:35 +0200 Subject: [PATCH 152/235] Staging: rt28x0: remove optional loading of EEPROM from file in eFuse mode Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/common/cmm_profile.c | 10 - drivers/staging/rt2860/common/ee_efuse.c | 788 +------------------- drivers/staging/rt2860/common/eeprom.c | 3 - drivers/staging/rt2860/common/rtmp_init.c | 9 - drivers/staging/rt2860/rt_linux.c | 20 - drivers/staging/rt2860/rtmp.h | 21 - 6 files changed, 1 insertion(+), 850 deletions(-) diff --git a/drivers/staging/rt2860/common/cmm_profile.c b/drivers/staging/rt2860/common/cmm_profile.c index 056cffda42b1..117ee0777284 100644 --- a/drivers/staging/rt2860/common/cmm_profile.c +++ b/drivers/staging/rt2860/common/cmm_profile.c @@ -1194,16 +1194,6 @@ NDIS_STATUS RTMPSetProfileParameters( retval = RT_CfgSetCountryRegion(pAd, tmpbuf, BAND_5G); DBGPRINT(RT_DEBUG_TRACE, ("CountryRegionABand=%d\n", pAd->CommonCfg.CountryRegionForABand)); } -#ifdef RTMP_EFUSE_SUPPORT -#ifdef RT30xx - //EfuseBufferMode - if(RTMPGetKeyParameter("EfuseBufferMode", tmpbuf, 25, pBuffer, TRUE)) - { - pAd->bEEPROMFile = (UCHAR) simple_strtol(tmpbuf, 0, 10); - DBGPRINT(RT_DEBUG_TRACE, ("EfuseBufferMode=%d\n", pAd->bUseEfuse)); - } -#endif // RT30xx // -#endif // RTMP_EFUSE_SUPPORT // //CountryCode if(RTMPGetKeyParameter("CountryCode", tmpbuf, 25, pBuffer, TRUE)) { diff --git a/drivers/staging/rt2860/common/ee_efuse.c b/drivers/staging/rt2860/common/ee_efuse.c index 5807cc4ff968..4bff473ccf38 100644 --- a/drivers/staging/rt2860/common/ee_efuse.c +++ b/drivers/staging/rt2860/common/ee_efuse.c @@ -67,21 +67,6 @@ typedef union _EFUSE_CTRL_STRUC { UINT32 word; } EFUSE_CTRL_STRUC, *PEFUSE_CTRL_STRUC; -static VOID eFuseWritePhysical( - IN PRTMP_ADAPTER pAd, - PUSHORT lpInBuffer, - ULONG nInBufferSize, - PUCHAR lpOutBuffer, - ULONG nOutBufferSize); - - -static NTSTATUS eFuseWriteRegistersFromBin( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - IN USHORT* pData); - - /* ======================================================================== @@ -268,164 +253,6 @@ static VOID eFuseReadPhysical( } } -/* -======================================================================== - - Routine Description: - - Arguments: - - Return Value: - - Note: - -======================================================================== -*/ -static VOID eFusePhysicalWriteRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - OUT USHORT* pData) -{ - EFUSE_CTRL_STRUC eFuseCtrlStruc; - int i; - USHORT efuseDataOffset; - UINT32 data, eFuseDataBuffer[4]; - - //Step0. Write 16-byte of data to EFUSE_DATA0-3 (0x590-0x59C), where EFUSE_DATA0 is the LSB DW, EFUSE_DATA3 is the MSB DW. - - ///////////////////////////////////////////////////////////////// - //read current values of 16-byte block - RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); - - //Step0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. - eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0; - - //Step1. Write EFSROM_MODE (0x580, bit7:bit6) to 1. - eFuseCtrlStruc.field.EFSROM_MODE = 1; - - //Step2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure. - eFuseCtrlStruc.field.EFSROM_KICK = 1; - - NdisMoveMemory(&data, &eFuseCtrlStruc, 4); - RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); - - //Step3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. - i = 0; - while(i < 500) - { - RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); - - if(eFuseCtrlStruc.field.EFSROM_KICK == 0) - break; - RTMPusecDelay(2); - i++; - } - - //Step4. Read 16-byte of data from EFUSE_DATA0-3 (0x59C-0x590) - efuseDataOffset = EFUSE_DATA3; - for(i=0; i< 4; i++) - { - RTMP_IO_READ32(pAd, efuseDataOffset, (PUINT32) &eFuseDataBuffer[i]); - efuseDataOffset -= 4; - } - - //Update the value, the offset is multiple of 2, length is 2 - efuseDataOffset = (Offset & 0xc) >> 2; - data = pData[0] & 0xffff; - //The offset should be 0x***10 or 0x***00 - if((Offset % 4) != 0) - { - eFuseDataBuffer[efuseDataOffset] = (eFuseDataBuffer[efuseDataOffset] & 0xffff) | (data << 16); - } - else - { - eFuseDataBuffer[efuseDataOffset] = (eFuseDataBuffer[efuseDataOffset] & 0xffff0000) | data; - } - - efuseDataOffset = EFUSE_DATA3; - for(i=0; i< 4; i++) - { - RTMP_IO_WRITE32(pAd, efuseDataOffset, eFuseDataBuffer[i]); - efuseDataOffset -= 4; - } - ///////////////////////////////////////////////////////////////// - - //Step1. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. - - RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); - - eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0; - - //Step2. Write EFSROM_MODE (0x580, bit7:bit6) to 3. - eFuseCtrlStruc.field.EFSROM_MODE = 3; - - //Step3. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical write procedure. - eFuseCtrlStruc.field.EFSROM_KICK = 1; - - NdisMoveMemory(&data, &eFuseCtrlStruc, 4); - RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); - - //Step4. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. It¡¦s done. - i = 0; - - while(i < 500) - { - RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); - - if(eFuseCtrlStruc.field.EFSROM_KICK == 0) - break; - - RTMPusecDelay(2); - i++; - } -} - -/* -======================================================================== - - Routine Description: - - Arguments: - - Return Value: - - Note: - -======================================================================== -*/ -static VOID eFuseWritePhysical( - IN PRTMP_ADAPTER pAd, - PUSHORT lpInBuffer, - ULONG nInBufferSize, - PUCHAR lpOutBuffer, - ULONG nOutBufferSize -) -{ - USHORT* pInBuf = (USHORT*)lpInBuffer; - int i; - //USHORT* pOutBuf = (USHORT*)ioBuffer; - USHORT Offset = pInBuf[0]; // addr - USHORT Length = pInBuf[1]; // length - USHORT* pValueX = &pInBuf[2]; // value ... - - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWritePhysical Offset=0x%x, length=%d\n", Offset, Length)); - - { - // Little-endian S | S Big-endian - // addr 3 2 1 0 | 0 1 2 3 - // Ori-V D C B A | A B C D - // After swapping - // D C B A | D C B A - // Both the little and big-endian use the same sequence to write data. - // Therefore, we only need swap data when read the data. - for (i=0; i0) - NdisMoveMemory(src, arg, strlen(arg)); - else - NdisMoveMemory(src, EFUSE_EEPROM_DEFULT_FILE, strlen(EFUSE_EEPROM_DEFULT_FILE)); - DBGPRINT(RT_DEBUG_TRACE, ("FileName=%s\n",src)); - - RtmpOSFSInfoChange(&osfsInfo, TRUE); - - srcf = RtmpOSFileOpen(src, O_RDONLY, 0); - if (IS_FILE_OPEN_ERR(srcf)) - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error opening file %s\n", src)); - retval = FALSE; - goto recoverFS; - } - else - { - // The object must have a read method - while(RtmpOSFileRead(srcf, &buffer[i], 1)==1) - { - i++; - if(i>MAX_EEPROM_BIN_FILE_SIZE) - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error reading file %s, file size too large[>%d]\n", src, MAX_EEPROM_BIN_FILE_SIZE)); - retval = FALSE; - goto closeFile; - } - } - - retval = RtmpOSFileClose(srcf); - if (retval) - DBGPRINT(RT_DEBUG_TRACE, ("--> Error closing file %s\n", src)); - } - - - RtmpOSFSInfoChange(&osfsInfo, FALSE); - - for(j=0;j48*16-3(reserved)=2FC - bAllocateNewBlk=TRUE; - for (i=EFUSE_USAGE_MAP_START; i<=EFUSE_USAGE_MAP_END; i+=2) - { - //Retrive the logical block nubmer form each logical address pointer - //It will access two logical address pointer each time. - eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); - if( (LogicalAddress & 0xff) == 0) - {//Not used logical address pointer - BlkNum = i-EFUSE_USAGE_MAP_START; - break; - } - else if(( (LogicalAddress >> 8) & 0xff) == 0) - {//Not used logical address pointer - if (i != EFUSE_USAGE_MAP_END) - { - BlkNum = i-EFUSE_USAGE_MAP_START+1; - } - break; - } - } - } - else - { - bAllocateNewBlk=FALSE; - BlkNum = EFSROM_AOUT; - } - - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters BlkNum = %d \n", BlkNum)); - - if(BlkNum == 0xffff) - { - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegisters: out of free E-fuse space!!!\n")); - return FALSE; - } - //Step 1.1.0 - //If the block is not existing in mapping table, create one - //and write down the 16-bytes data to the new block - if(bAllocateNewBlk) - { - DBGPRINT(RT_DEBUG_TRACE, ("Allocate New Blk\n")); - efuseDataOffset = EFUSE_DATA3; - for(i=0; i< 4; i++) - { - DBGPRINT(RT_DEBUG_TRACE, ("Allocate New Blk, Data%d=%04x%04x\n",3-i,pData[2*i+1],pData[2*i])); - tempbuffer=((pData[2*i+1]<<16)&0xffff0000)|pData[2*i]; - - - RTMP_IO_WRITE32(pAd, efuseDataOffset,tempbuffer); - efuseDataOffset -= 4; - - } - ///////////////////////////////////////////////////////////////// - - //Step1.1.1. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. - RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); - eFuseCtrlStruc.field.EFSROM_AIN = BlkNum* 0x10 ; - - //Step1.1.2. Write EFSROM_MODE (0x580, bit7:bit6) to 3. - eFuseCtrlStruc.field.EFSROM_MODE = 3; - - //Step1.1.3. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical write procedure. - eFuseCtrlStruc.field.EFSROM_KICK = 1; - - NdisMoveMemory(&data, &eFuseCtrlStruc, 4); - - RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); - - //Step1.1.4. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. It¡¦s done. - i = 0; - while(i < 100) - { - RTMP_IO_READ32(pAd, EFUSE_CTRL, (PUINT32) &eFuseCtrlStruc); - - if(eFuseCtrlStruc.field.EFSROM_KICK == 0) - break; - - RTMPusecDelay(2); - i++; - } - - } - else - { //Step1.2. - //If the same logical number is existing, check if the writting data and the data - //saving in this block are the same. - ///////////////////////////////////////////////////////////////// - //read current values of 16-byte block - RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); - - //Step1.2.0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. - eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0; - - //Step1.2.1. Write EFSROM_MODE (0x580, bit7:bit6) to 1. - eFuseCtrlStruc.field.EFSROM_MODE = 0; - - //Step1.2.2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure. - eFuseCtrlStruc.field.EFSROM_KICK = 1; - - NdisMoveMemory(&data, &eFuseCtrlStruc, 4); - RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); - - //Step1.2.3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. - i = 0; - while(i < 500) - { - RTMP_IO_READ32(pAd, EFUSE_CTRL, (PUINT32) &eFuseCtrlStruc); - - if(eFuseCtrlStruc.field.EFSROM_KICK == 0) - break; - RTMPusecDelay(2); - i++; - } - - //Step1.2.4. Read 16-byte of data from EFUSE_DATA0-3 (0x59C-0x590) - efuseDataOffset = EFUSE_DATA3; - for(i=0; i< 4; i++) - { - RTMP_IO_READ32(pAd, efuseDataOffset, (PUINT32) &buffer[i]); - efuseDataOffset -= 4; - } - //Step1.2.5. Check if the data of efuse and the writing data are the same. - for(i =0; i<4; i++) - { - tempbuffer=((pData[2*i+1]<<16)&0xffff0000)|pData[2*i]; - DBGPRINT(RT_DEBUG_TRACE, ("buffer[%d]=%x,pData[%d]=%x,pData[%d]=%x,tempbuffer=%x\n",i,buffer[i],2*i,pData[2*i],2*i+1,pData[2*i+1],tempbuffer)); - - if(((buffer[i]&0xffff0000)==(pData[2*i+1]<<16))&&((buffer[i]&0xffff)==pData[2*i])) - bNotWrite&=TRUE; - else - { - bNotWrite&=FALSE; - break; - } - } - if(!bNotWrite) - { - printk("The data is not the same\n"); - - for(i =0; i<8; i++) - { - addr = BlkNum * 0x10 ; - - InBuf[0] = addr+2*i; - InBuf[1] = 2; - InBuf[2] = pData[i]; - - eFuseWritePhysical(pAd, &InBuf[0], 6, NULL, 2); - } - - } - else - return TRUE; - } - - - - //Step 2. Write mapping table - addr = EFUSE_USAGE_MAP_START+BlkNum; - - tmpaddr = addr; - - if(addr % 2 != 0) - addr = addr -1; - InBuf[0] = addr; - InBuf[1] = 2; - - //convert the address from 10 to 8 bit ( bit7, 6 = parity and bit5 ~ 0 = bit9~4), and write to logical map entry - tmpOffset = Offset; - tmpOffset >>= 4; - tmpOffset |= ((~((tmpOffset & 0x01) ^ ( tmpOffset >> 1 & 0x01) ^ (tmpOffset >> 2 & 0x01) ^ (tmpOffset >> 3 & 0x01))) << 6) & 0x40; - tmpOffset |= ((~( (tmpOffset >> 2 & 0x01) ^ (tmpOffset >> 3 & 0x01) ^ (tmpOffset >> 4 & 0x01) ^ ( tmpOffset >> 5 & 0x01))) << 7) & 0x80; - - // write the logical address - if(tmpaddr%2 != 0) - InBuf[2] = tmpOffset<<8; - else - InBuf[2] = tmpOffset; - - eFuseWritePhysical(pAd,&InBuf[0], 6, NULL, 0); - - //Step 3. Compare data if not the same, invalidate the mapping entry, then re-write the data until E-fuse is exhausted - bWriteSuccess = TRUE; - for(i =0; i<8; i++) - { - addr = BlkNum * 0x10 ; - - InBuf[0] = addr+2*i; - InBuf[1] = 2; - InBuf[2] = 0x0; - - eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); - DBGPRINT(RT_DEBUG_TRACE, ("addr=%x, buffer[i]=%x,InBuf[2]=%x\n",InBuf[0],pData[i],InBuf[2])); - if(pData[i] != InBuf[2]) - { - bWriteSuccess = FALSE; - break; - } - } - - //Step 4. invlidate mapping entry and find a free mapping entry if not succeed - - if (!bWriteSuccess&&Loop<2) - { - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegistersFromBin::Not bWriteSuccess BlkNum = %d\n", BlkNum)); - - // the offset of current mapping entry - addr = EFUSE_USAGE_MAP_START+BlkNum; - - //find a new mapping entry - BlkNum = 0xffff; - for (i=EFUSE_USAGE_MAP_START; i<=EFUSE_USAGE_MAP_END; i+=2) - { - eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); - if( (LogicalAddress & 0xff) == 0) - { - BlkNum = i-EFUSE_USAGE_MAP_START; - break; - } - else if(( (LogicalAddress >> 8) & 0xff) == 0) - { - if (i != EFUSE_USAGE_MAP_END) - { - BlkNum = i+1-EFUSE_USAGE_MAP_START; - } - break; - } - } - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegistersFromBin::Not bWriteSuccess new BlkNum = %d\n", BlkNum)); - if(BlkNum == 0xffff) - { - DBGPRINT(RT_DEBUG_TRACE, ("eFuseWriteRegistersFromBin: out of free E-fuse space!!!\n")); - return FALSE; - } - - //invalidate the original mapping entry if new entry is not found - tmpaddr = addr; - - if(addr % 2 != 0) - addr = addr -1; - InBuf[0] = addr; - InBuf[1] = 2; - - eFuseReadPhysical(pAd, &InBuf[0], 4, &InBuf[2], 2); - - // write the logical address - if(tmpaddr%2 != 0) - { - // Invalidate the high byte - for (i=8; i<15; i++) - { - if( ( (InBuf[2] >> i) & 0x01) == 0) - { - InBuf[2] |= (0x1 <> i) & 0x01) == 0) - { - InBuf[2] |= (0x1 <bFroceEEPROMBuffer || pAd->bEEPROMFile) - { - DBGPRINT(RT_DEBUG_TRACE, ("Read from EEPROM Buffer\n")); - NdisMoveMemory(pValue, &(pAd->EEPROMImage[Offset]), 2); - } - else - eFuseReadRegisters(pAd, Offset, 2, pValue); + eFuseReadRegisters(pAd, Offset, 2, pValue); return (*pValue); } @@ -944,177 +341,6 @@ int RtmpEfuseSupportCheck( return 0; } -INT set_eFuseBufferModeWriteBack_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) -{ - UINT Enable; - - - if(strlen(arg)>0) - { - Enable= simple_strtol(arg, 0, 16); - } - else - return FALSE; - if(Enable==1) - { - DBGPRINT(RT_DEBUG_TRACE, ("set_eFuseBufferMode_Proc:: Call WRITEEEPROMBUF")); - eFuseWriteEeeppromBuf(pAd); - } - else - return FALSE; - return TRUE; -} - - -/* - ======================================================================== - - Routine Description: - Load EEPROM from bin file for eFuse mode - - Arguments: - Adapter Pointer to our adapter - - Return Value: - NDIS_STATUS_SUCCESS firmware image load ok - NDIS_STATUS_FAILURE image not found - - IRQL = PASSIVE_LEVEL - - ======================================================================== -*/ -INT eFuseLoadEEPROM( - IN PRTMP_ADAPTER pAd) -{ - PSTRING src = NULL; - INT retval; - RTMP_OS_FD srcf; - RTMP_OS_FS_INFO osFSInfo; - - - src=EFUSE_BUFFER_PATH; - DBGPRINT(RT_DEBUG_TRACE, ("FileName=%s\n",src)); - - - RtmpOSFSInfoChange(&osFSInfo, TRUE); - - if (src && *src) - { - srcf = RtmpOSFileOpen(src, O_RDONLY, 0); - if (IS_FILE_OPEN_ERR(srcf)) - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error %ld opening %s\n", -PTR_ERR(srcf),src)); - return FALSE; - } - else - { - - memset(pAd->EEPROMImage, 0x00, MAX_EEPROM_BIN_FILE_SIZE); - - - retval =RtmpOSFileRead(srcf, (PSTRING)pAd->EEPROMImage, MAX_EEPROM_BIN_FILE_SIZE); - if (retval > 0) - { - RTMPSetProfileParameters(pAd, (PSTRING)pAd->EEPROMImage); - retval = NDIS_STATUS_SUCCESS; - } - else - DBGPRINT(RT_DEBUG_ERROR, ("Read file \"%s\" failed(errCode=%d)!\n", src, retval)); - - } - - - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error src or srcf is null\n")); - return FALSE; - - } - - retval=RtmpOSFileClose(srcf); - - if (retval) - { - DBGPRINT(RT_DEBUG_TRACE, ("--> Error %d closing %s\n", -retval, src)); - } - - - RtmpOSFSInfoChange(&osFSInfo, FALSE); - - return TRUE; -} - -INT eFuseWriteEeeppromBuf( - IN PRTMP_ADAPTER pAd) -{ - - PSTRING src = NULL; - INT retval; - RTMP_OS_FD srcf; - RTMP_OS_FS_INFO osFSInfo; - - - src=EFUSE_BUFFER_PATH; - DBGPRINT(RT_DEBUG_TRACE, ("FileName=%s\n",src)); - - RtmpOSFSInfoChange(&osFSInfo, TRUE); - - - - if (src && *src) - { - srcf = RtmpOSFileOpen(src, O_WRONLY|O_CREAT, 0); - - if (IS_FILE_OPEN_ERR(srcf)) - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error %ld opening %s\n", -PTR_ERR(srcf),src)); - return FALSE; - } - else - { -/* - // The object must have a read method - if (srcf->f_op && srcf->f_op->write) - { - // The object must have a read method - srcf->f_op->write(srcf, pAd->EEPROMImage, 1024, &srcf->f_pos); - - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error!! System doest not support read function\n")); - return FALSE; - } -*/ - - RtmpOSFileWrite(srcf, (PSTRING)pAd->EEPROMImage,MAX_EEPROM_BIN_FILE_SIZE); - - } - - - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("--> Error src or srcf is null\n")); - return FALSE; - - } - - retval=RtmpOSFileClose(srcf); - - if (retval) - { - DBGPRINT(RT_DEBUG_TRACE, ("--> Error %d closing %s\n", -retval, src)); - } - - RtmpOSFSInfoChange(&osFSInfo, FALSE); - return TRUE; -} - - VOID eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, PUINT EfuseFreeBlock) { @@ -1151,18 +377,6 @@ INT eFuse_init( UINT EfuseFreeBlock=0; DBGPRINT(RT_DEBUG_ERROR, ("NVM is Efuse and its size =%x[%x-%x] \n",EFUSE_USAGE_MAP_SIZE,EFUSE_USAGE_MAP_START,EFUSE_USAGE_MAP_END)); eFuseGetFreeBlockCount(pAd, &EfuseFreeBlock); - //If the used block of efuse is less than 5. We assume the default value - // of this efuse is empty and change to the buffer mode in odrder to - //bring up interfaces successfully. - if(EfuseFreeBlock > (EFUSE_USAGE_MAP_END-5)) - { - DBGPRINT(RT_DEBUG_ERROR, ("NVM is Efuse and the information is too less to bring up interface. Force to use EEPROM Buffer Mode\n")); - pAd->bFroceEEPROMBuffer = TRUE; - eFuseLoadEEPROM(pAd); - } - else - pAd->bFroceEEPROMBuffer = FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("NVM is Efuse and force to use EEPROM Buffer Mode=%x\n",pAd->bFroceEEPROMBuffer)); return 0; } diff --git a/drivers/staging/rt2860/common/eeprom.c b/drivers/staging/rt2860/common/eeprom.c index d7a2664bb73a..39276ca64c19 100644 --- a/drivers/staging/rt2860/common/eeprom.c +++ b/drivers/staging/rt2860/common/eeprom.c @@ -69,10 +69,7 @@ INT RtmpChipOpsEepromHook( return 0 ; } else - { - pAd->bFroceEEPROMBuffer = FALSE; DBGPRINT(RT_DEBUG_TRACE, ("NVM is EEPROM\n")); - } #endif // RTMP_EFUSE_SUPPORT // #endif // RT30xx // diff --git a/drivers/staging/rt2860/common/rtmp_init.c b/drivers/staging/rt2860/common/rtmp_init.c index 9e1c73dbfb26..fe8327b9b13c 100644 --- a/drivers/staging/rt2860/common/rtmp_init.c +++ b/drivers/staging/rt2860/common/rtmp_init.c @@ -694,15 +694,6 @@ VOID NICReadEEPROMParameters( if (pAd->chipOps.eeinit) pAd->chipOps.eeinit(pAd); -#ifdef RTMP_EFUSE_SUPPORT -#ifdef RT30xx - if(!pAd->bFroceEEPROMBuffer && pAd->bEEPROMFile) - { - DBGPRINT(RT_DEBUG_TRACE, ("--> NICReadEEPROMParameters::(Efuse)Load to EEPROM Buffer Mode\n")); - eFuseLoadEEPROM(pAd); - } -#endif // RT30xx // -#endif // RTMP_EFUSE_SUPPORT // // Init EEPROM Address Number, before access EEPROM; if 93c46, EEPROMAddressNum=6, else if 93c66, EEPROMAddressNum=8 RTMP_IO_READ32(pAd, E2PROM_CSR, &data); diff --git a/drivers/staging/rt2860/rt_linux.c b/drivers/staging/rt2860/rt_linux.c index b57836086600..cdda24724c5b 100644 --- a/drivers/staging/rt2860/rt_linux.c +++ b/drivers/staging/rt2860/rt_linux.c @@ -1065,26 +1065,6 @@ int RtmpOSFileWrite(RTMP_OS_FD osfd, char *pDataPtr, int writeLen) return osfd->f_op->write(osfd, pDataPtr, (size_t)writeLen, &osfd->f_pos); } - -void RtmpOSFSInfoChange(RTMP_OS_FS_INFO *pOSFSInfo, BOOLEAN bSet) -{ - if (bSet) - { - // Save uid and gid used for filesystem access. - // Set user and group to 0 (root) - pOSFSInfo->fsuid = current_fsuid(); - pOSFSInfo->fsgid = current_fsgid(); - pOSFSInfo->fs = get_fs(); - set_fs(KERNEL_DS); - } - else - { - set_fs(pOSFSInfo->fs); - } -} - - - /******************************************************************************* Task create/management/kill related functions. diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h index 3ec50b5f61c7..c43c8eafae4a 100644 --- a/drivers/staging/rt2860/rtmp.h +++ b/drivers/staging/rt2860/rtmp.h @@ -2258,8 +2258,6 @@ struct _RTMP_ADAPTER #ifdef RT30xx #ifdef RTMP_EFUSE_SUPPORT BOOLEAN bUseEfuse; - BOOLEAN bEEPROMFile; - BOOLEAN bFroceEEPROMBuffer; UCHAR EEPROMImage[1024]; #endif // RTMP_EFUSE_SUPPORT // #endif // RT30xx // @@ -4021,10 +4019,6 @@ INT set_eFusedump_Proc( IN PRTMP_ADAPTER pAd, IN PSTRING arg); -INT set_eFuseLoadFromBin_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - VOID eFusePhysicalReadRegisters( IN PRTMP_ADAPTER pAd, IN USHORT Offset, @@ -4034,16 +4028,6 @@ VOID eFusePhysicalReadRegisters( int RtmpEfuseSupportCheck( IN RTMP_ADAPTER *pAd); -INT set_eFuseBufferModeWriteBack_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT eFuseLoadEEPROM( - IN PRTMP_ADAPTER pAd); - -INT eFuseWriteEeeppromBuf( - IN PRTMP_ADAPTER pAd); - VOID eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, PUINT EfuseFreeBlock); @@ -5632,10 +5616,5 @@ int RtmpOSFileWrite( IN char *pDataPtr, IN int writeLen); -void RtmpOSFSInfoChange( - IN RTMP_OS_FS_INFO *pOSFSInfo, - IN BOOLEAN bSet); - - #endif // __RTMP_H__ -- GitLab From ca58fb303757d73876af32238d86091c59b88507 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Wed, 21 Oct 2009 22:44:42 +0200 Subject: [PATCH 153/235] Staging: rt28x0: fix some build warnings Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/chip/rtmp_phy.h | 8 ++--- drivers/staging/rt2860/chips/rt30xx.c | 2 ++ drivers/staging/rt2860/common/cmm_asic.c | 6 ++-- drivers/staging/rt2860/common/cmm_mac_pci.c | 7 ++--- drivers/staging/rt2860/common/mlme.c | 1 - drivers/staging/rt2860/common/rtmp_init.c | 3 +- drivers/staging/rt2860/common/rtmp_mcu.c | 2 ++ drivers/staging/rt2860/pci_main_dev.c | 35 +++++++++++++-------- drivers/staging/rt2860/rt_linux.c | 10 +++--- drivers/staging/rt2860/rt_main_dev.c | 6 ++-- drivers/staging/rt2860/sta/connect.c | 1 - drivers/staging/rt2860/usb_main_dev.c | 7 +++-- 12 files changed, 48 insertions(+), 40 deletions(-) diff --git a/drivers/staging/rt2860/chip/rtmp_phy.h b/drivers/staging/rt2860/chip/rtmp_phy.h index 87516f3a111a..e2b90a14bf6c 100644 --- a/drivers/staging/rt2860/chip/rtmp_phy.h +++ b/drivers/staging/rt2860/chip/rtmp_phy.h @@ -552,8 +552,8 @@ #ifdef RT30xx #define RTMP_ASIC_MMPS_DISABLE(_pAd) \ do{ \ - UCHAR _bbpData; \ - UINT32 _macData; \ + UINT32 _macData; \ + UCHAR _bbpData = 0; \ /* disable MMPS BBP control register */ \ RTMP_BBP_IO_READ8_BY_REG_ID(_pAd, BBP_R3, &_bbpData); \ _bbpData &= ~(0x04); /*bit 2*/ \ @@ -568,8 +568,8 @@ #define RTMP_ASIC_MMPS_ENABLE(_pAd) \ do{ \ - UCHAR _bbpData; \ - UINT32 _macData; \ + UINT32 _macData; \ + UCHAR _bbpData = 0; \ /* enable MMPS BBP control register */ \ RTMP_BBP_IO_READ8_BY_REG_ID(_pAd, BBP_R3, &_bbpData); \ _bbpData |= (0x04); /*bit 2*/ \ diff --git a/drivers/staging/rt2860/chips/rt30xx.c b/drivers/staging/rt2860/chips/rt30xx.c index f29d11d6de47..c69fab568984 100644 --- a/drivers/staging/rt2860/chips/rt30xx.c +++ b/drivers/staging/rt2860/chips/rt30xx.c @@ -86,7 +86,9 @@ VOID RT30xxSetRxAnt( IN UCHAR Ant) { UINT32 Value; +#ifdef RTMP_MAC_PCI UINT32 x; +#endif if ((pAd->EepromAccess) || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) || diff --git a/drivers/staging/rt2860/common/cmm_asic.c b/drivers/staging/rt2860/common/cmm_asic.c index 5d3a387f76a2..406e0bbf9530 100644 --- a/drivers/staging/rt2860/common/cmm_asic.c +++ b/drivers/staging/rt2860/common/cmm_asic.c @@ -810,9 +810,9 @@ VOID AsicSwitchChannel( #if defined(RT3090) || defined(RT3390) // PCIe PHY Transmit attenuation adjustment - if (IS_RT3090A(pAd) || IS_RT3390(pAd)) - { - TX_ATTENUATION_CTRL_STRUC TxAttenuationCtrl = {0}; + if (IS_RT3090A(pAd) || IS_RT3390(pAd)) { + TX_ATTENUATION_CTRL_STRUC + TxAttenuationCtrl = { .word = 0 }; RTMP_IO_READ32(pAd, PCIE_PHY_TX_ATTENUATION_CTRL, &TxAttenuationCtrl.word); diff --git a/drivers/staging/rt2860/common/cmm_mac_pci.c b/drivers/staging/rt2860/common/cmm_mac_pci.c index 73992cb4ee67..d910bfdbd2f3 100644 --- a/drivers/staging/rt2860/common/cmm_mac_pci.c +++ b/drivers/staging/rt2860/common/cmm_mac_pci.c @@ -1173,10 +1173,9 @@ BOOLEAN RT28xxPciAsicRadioOn( pAd->Mlme.bPsPollTimerRunning = FALSE; RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); } - if ((pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)&& - ((Level == GUIRADIO_OFF) || (Level == GUI_IDLE_POWER_SAVE)) - ||(RTMP_TEST_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND))) - { + if ((pAd->StaCfg.PSControl.field.EnableNewPS == TRUE && + (Level == GUIRADIO_OFF || Level == GUI_IDLE_POWER_SAVE)) || + RTMP_TEST_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND)) { // Some chips don't need to delay 6ms, so copy RTMPPCIePowerLinkCtrlRestore // return condition here. /* diff --git a/drivers/staging/rt2860/common/mlme.c b/drivers/staging/rt2860/common/mlme.c index 7647c090c349..9fa853eba672 100644 --- a/drivers/staging/rt2860/common/mlme.c +++ b/drivers/staging/rt2860/common/mlme.c @@ -679,7 +679,6 @@ VOID MlmePeriodicExec( { ULONG TxTotalCnt; PRTMP_ADAPTER pAd = (RTMP_ADAPTER *)FunctionContext; - SHORT realavgrssi; #ifdef RTMP_MAC_PCI { diff --git a/drivers/staging/rt2860/common/rtmp_init.c b/drivers/staging/rt2860/common/rtmp_init.c index fe8327b9b13c..5deba8d698c5 100644 --- a/drivers/staging/rt2860/common/rtmp_init.c +++ b/drivers/staging/rt2860/common/rtmp_init.c @@ -3621,7 +3621,8 @@ INT RtmpRaDevCtrlInit( #ifdef RTMP_MAC_USB init_MUTEX(&(pAd->UsbVendorReq_semaphore)); - os_alloc_mem(pAd, (PUCHAR)&pAd->UsbVendorReqBuf, MAX_PARAM_BUFFER_SIZE - 1); + os_alloc_mem(pAd, (PUCHAR *)&pAd->UsbVendorReqBuf, + MAX_PARAM_BUFFER_SIZE - 1); if (pAd->UsbVendorReqBuf == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("Allocate vendor request temp buffer failed!\n")); diff --git a/drivers/staging/rt2860/common/rtmp_mcu.c b/drivers/staging/rt2860/common/rtmp_mcu.c index 229ea05e9336..e5d19020ef7a 100644 --- a/drivers/staging/rt2860/common/rtmp_mcu.c +++ b/drivers/staging/rt2860/common/rtmp_mcu.c @@ -119,7 +119,9 @@ NDIS_STATUS RtmpAsicLoadFirmware( PUCHAR pFirmwareImage = NULL; ULONG FileLength, Index; UINT32 MacReg = 0; +#ifdef RTMP_MAC_USB UINT32 Version = (pAd->MACVersion >> 16); +#endif // New 8k byte firmware size for RT3071/RT3072 { diff --git a/drivers/staging/rt2860/pci_main_dev.c b/drivers/staging/rt2860/pci_main_dev.c index 1436a60e894b..38bc429067e2 100644 --- a/drivers/staging/rt2860/pci_main_dev.c +++ b/drivers/staging/rt2860/pci_main_dev.c @@ -310,7 +310,7 @@ static INT __devinit rt2860_probe( return rv; } - print_name = pci_name(pci_dev); + print_name = (PSTRING)pci_name(pci_dev); if ((rv = pci_request_regions(pci_dev, print_name)) != 0) { @@ -883,7 +883,7 @@ VOID RTMPPCIeLinkCtrlValueRestore( #endif // RT2860 // // Check PSControl Configuration if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) - return TRUE; + return; //3090 will not execute the following codes. // Check interface : If not PCIe interface, return. @@ -977,7 +977,7 @@ VOID RTMPPCIeLinkCtrlSetting( #endif // RT2860 // // Check PSControl Configuration if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) - return TRUE; + return; // Check interface : If not PCIe interface, return. //Block 3090 to enter the following function @@ -1086,17 +1086,17 @@ VOID RTMPrt3xSetPCIePowerLinkCtrl( IN PRTMP_ADAPTER pAd) { - ULONG HostConfiguration; + ULONG HostConfiguration = 0; ULONG Configuration; - ULONG Vendor; - ULONG offset; POS_COOKIE pObj; INT pos; USHORT reg16; pObj = (POS_COOKIE) pAd->OS_Cookie; - DBGPRINT(RT_DEBUG_INFO, ("RTMPrt3xSetPCIePowerLinkCtrl.===> %x\n", pAd->StaCfg.PSControl.word)); + DBGPRINT(RT_DEBUG_INFO, + ("RTMPrt3xSetPCIePowerLinkCtrl.===> %lx\n", + pAd->StaCfg.PSControl.word)); // Check PSControl Configuration if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) @@ -1104,7 +1104,6 @@ VOID RTMPrt3xSetPCIePowerLinkCtrl( RTMPFindHostPCIDev(pAd); if (pObj->parent_pci_dev) { - USHORT vendor_id; // Find PCI-to-PCI Bridge Express Capability Offset pos = pci_find_capability(pObj->parent_pci_dev, PCI_CAP_ID_EXP); @@ -1129,7 +1128,10 @@ VOID RTMPrt3xSetPCIePowerLinkCtrl( // Because in rt30xxForceASPMTest Mode, Force turn on L0s, L1. // Fix HostConfiguration bit0:1 = 0x3 for later use. HostConfiguration = 0x3; - DBGPRINT(RT_DEBUG_TRACE, ("PSM : Force ASPM : Host device L1/L0s Value = 0x%x\n", HostConfiguration)); + DBGPRINT(RT_DEBUG_TRACE, + ("PSM : Force ASPM : " + "Host device L1/L0s Value = 0x%lx\n", + HostConfiguration)); } } else if (pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM == 1) @@ -1141,7 +1143,10 @@ VOID RTMPrt3xSetPCIePowerLinkCtrl( PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, HostConfiguration); pAd->Rt3xxHostLinkCtrl = HostConfiguration; HostConfiguration &= 0x3; - DBGPRINT(RT_DEBUG_TRACE, ("PSM : Follow Host ASPM : Host device L1/L0s Value = 0x%x\n", HostConfiguration)); + DBGPRINT(RT_DEBUG_TRACE, + ("PSM : Follow Host ASPM : " + "Host device L1/L0s Value = 0x%lx\n", + HostConfiguration)); } } } @@ -1155,8 +1160,10 @@ VOID RTMPrt3xSetPCIePowerLinkCtrl( pAd->RLnkCtrlOffset = pos + PCI_EXP_LNKCTL; pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, ®16); Configuration = le2cpu16(reg16); - DBGPRINT(RT_DEBUG_TRACE, ("Read (Ralink PCIe Link Control Register) offset 0x%x = 0x%x\n", - pAd->RLnkCtrlOffset, Configuration)); + DBGPRINT(RT_DEBUG_TRACE, + ("Read (Ralink PCIe Link Control Register) " + "offset 0x%x = 0x%lx\n", + pAd->RLnkCtrlOffset, Configuration)); Configuration |= 0x100; if ((pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM == 1) || (pAd->StaCfg.PSControl.field.rt30xxForceASPMTest == 1)) @@ -1182,7 +1189,9 @@ VOID RTMPrt3xSetPCIePowerLinkCtrl( reg16 = cpu2le16(Configuration); pci_write_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, reg16); pAd->Rt3xxRalinkLinkCtrl = Configuration; - DBGPRINT(RT_DEBUG_TRACE, ("PSM :Write Ralink device L1/L0s Value = 0x%x\n", Configuration)); + DBGPRINT(RT_DEBUG_TRACE, + ("PSM :Write Ralink device L1/L0s Value = 0x%lx\n", + Configuration)); } DBGPRINT(RT_DEBUG_INFO,("PSM :RTMPrt3xSetPCIePowerLinkCtrl <==============\n")); } diff --git a/drivers/staging/rt2860/rt_linux.c b/drivers/staging/rt2860/rt_linux.c index cdda24724c5b..d57013fb7bf1 100644 --- a/drivers/staging/rt2860/rt_linux.c +++ b/drivers/staging/rt2860/rt_linux.c @@ -965,6 +965,7 @@ err_free_sk_buff: *******************************************************************************/ int RtmpOSIRQRequest(IN PNET_DEV pNetDev) { +#ifdef RTMP_PCI_SUPPORT struct net_device *net_dev = pNetDev; PRTMP_ADAPTER pAd = NULL; int retval = 0; @@ -973,7 +974,6 @@ int RtmpOSIRQRequest(IN PNET_DEV pNetDev) ASSERT(pAd); -#ifdef RTMP_PCI_SUPPORT if (pAd->infType == RTMP_DEV_INF_PCI) { POS_COOKIE _pObj = (POS_COOKIE)(pAd->OS_Cookie); @@ -982,14 +982,13 @@ int RtmpOSIRQRequest(IN PNET_DEV pNetDev) if (retval != 0) printk("RT2860: request_irq ERROR(%d)\n", retval); } -#endif // RTMP_PCI_SUPPORT // - return retval; - +#else + return 0; +#endif } - int RtmpOSIRQRelease(IN PNET_DEV pNetDev) { struct net_device *net_dev = pNetDev; @@ -1149,7 +1148,6 @@ NDIS_STATUS RtmpOSTaskAttach( IN void *arg) { NDIS_STATUS status = NDIS_STATUS_SUCCESS; - pid_t pid_number = -1; #ifdef KTHREAD_SUPPORT pTask->task_killed = 0; diff --git a/drivers/staging/rt2860/rt_main_dev.c b/drivers/staging/rt2860/rt_main_dev.c index 7ea85e6a3363..3a735717bcf6 100644 --- a/drivers/staging/rt2860/rt_main_dev.c +++ b/drivers/staging/rt2860/rt_main_dev.c @@ -209,15 +209,13 @@ int rt28xx_close(IN PNET_DEV dev) BOOLEAN Cancelled; UINT32 i = 0; - GET_PAD_FROM_NET_DEV(pAd, net_dev); - #ifdef RTMP_MAC_USB DECLARE_WAIT_QUEUE_HEAD(unlink_wakeup); DECLARE_WAITQUEUE(wait, current); - - //RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS); #endif // RTMP_MAC_USB // + GET_PAD_FROM_NET_DEV(pAd, net_dev); + DBGPRINT(RT_DEBUG_TRACE, ("===> rt28xx_close\n")); Cancelled = FALSE; diff --git a/drivers/staging/rt2860/sta/connect.c b/drivers/staging/rt2860/sta/connect.c index 7f263a66d79a..43edd8e1f284 100644 --- a/drivers/staging/rt2860/sta/connect.c +++ b/drivers/staging/rt2860/sta/connect.c @@ -1809,7 +1809,6 @@ VOID LinkDown( IN BOOLEAN IsReqFromAP) { UCHAR i, ByteValue = 0; - BOOLEAN Cancelled; // Do nothing if monitor mode is on if (MONITOR_ON(pAd)) diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c index 16e1bbfce435..00732be4f005 100644 --- a/drivers/staging/rt2860/usb_main_dev.c +++ b/drivers/staging/rt2860/usb_main_dev.c @@ -686,9 +686,10 @@ VOID RTUSBWatchDog(IN RTMP_ADAPTER *pAd) RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[idx], irqFlags); - - printk("%d:%d LTL=%d , TL=%d L:%d\n",idx,pAd->watchDogTxPendingCnt[idx],pAd->TransferedLength[idx] - ,actual_length,transfer_buffer_length); + printk(KERN_INFO "%d:%lu LTL=%d , TL=%d L:%d\n", + idx, pAd->watchDogTxPendingCnt[idx], + pAd->TransferedLength[idx], + actual_length, transfer_buffer_length); if (pUrb) { -- GitLab From f4e54708bc60be380b3640e6db2b3f73cb13eebd Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Wed, 21 Oct 2009 22:44:48 +0200 Subject: [PATCH 154/235] Staging: rt28x0: remove optional cmm profile parameters Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/Makefile | 1 - drivers/staging/rt2860/common/cmm_profile.c | 1769 ------------------- drivers/staging/rt2860/rtmp.h | 34 - drivers/staging/rt2870/Makefile | 1 - 4 files changed, 1805 deletions(-) delete mode 100644 drivers/staging/rt2860/common/cmm_profile.c diff --git a/drivers/staging/rt2860/Makefile b/drivers/staging/rt2860/Makefile index 09e448a0ff84..23ae07f00ead 100644 --- a/drivers/staging/rt2860/Makefile +++ b/drivers/staging/rt2860/Makefile @@ -27,7 +27,6 @@ rt2860sta-objs := \ common/spectrum.o \ common/rtmp_timer.o \ common/rt_channel.o \ - common/cmm_profile.o \ common/cmm_asic.o \ sta/assoc.o \ sta/auth.o \ diff --git a/drivers/staging/rt2860/common/cmm_profile.c b/drivers/staging/rt2860/common/cmm_profile.c deleted file mode 100644 index 117ee0777284..000000000000 --- a/drivers/staging/rt2860/common/cmm_profile.c +++ /dev/null @@ -1,1769 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* -*/ - -#include "../rt_config.h" - - -#define ETH_MAC_ADDR_STR_LEN 17 // in format of xx:xx:xx:xx:xx:xx - -// We assume the s1 is a sting, s2 is a memory space with 6 bytes. and content of s1 will be changed. -BOOLEAN rtstrmactohex(PSTRING s1, PSTRING s2) -{ - int i = 0; - PSTRING ptokS = s1, ptokE = s1; - - if (strlen(s1) != ETH_MAC_ADDR_STR_LEN) - return FALSE; - - while((*ptokS) != '\0') - { - if((ptokE = strchr(ptokS, ':')) != NULL) - *ptokE++ = '\0'; - if ((strlen(ptokS) != 2) || (!isxdigit(*ptokS)) || (!isxdigit(*(ptokS+1)))) - break; // fail - AtoH(ptokS, (PUCHAR)&s2[i++], 1); - ptokS = ptokE; - if (i == 6) - break; // parsing finished - } - - return ( i == 6 ? TRUE : FALSE); - -} - - -// we assume the s1 and s2 both are strings. -BOOLEAN rtstrcasecmp(PSTRING s1, PSTRING s2) -{ - PSTRING p1 = s1, p2 = s2; - - if (strlen(s1) != strlen(s2)) - return FALSE; - - while(*p1 != '\0') - { - if((*p1 != *p2) && ((*p1 ^ *p2) != 0x20)) - return FALSE; - p1++; - p2++; - } - - return TRUE; -} - -// we assume the s1 (buffer) and s2 (key) both are strings. -PSTRING rtstrstruncasecmp(PSTRING s1, PSTRING s2) -{ - INT l1, l2, i; - char temp1, temp2; - - l2 = strlen(s2); - if (!l2) - return (char *) s1; - - l1 = strlen(s1); - - while (l1 >= l2) - { - l1--; - - for(i=0; i= l2) - { - l1--; - if (!memcmp(s1,s2,l2)) - return s1; - s1++; - } - - return NULL; -} - -/** - * rstrtok - Split a string into tokens - * @s: The string to be searched - * @ct: The characters to search for - * * WARNING: strtok is deprecated, use strsep instead. However strsep is not compatible with old architecture. - */ -PSTRING __rstrtok; -PSTRING rstrtok(PSTRING s,const PSTRING ct) -{ - PSTRING sbegin, send; - - sbegin = s ? s : __rstrtok; - if (!sbegin) - { - return NULL; - } - - sbegin += strspn(sbegin,ct); - if (*sbegin == '\0') - { - __rstrtok = NULL; - return( NULL ); - } - - send = strpbrk( sbegin, ct); - if (send && *send != '\0') - *send++ = '\0'; - - __rstrtok = send; - - return (sbegin); -} - -/** - * delimitcnt - return the count of a given delimiter in a given string. - * @s: The string to be searched. - * @ct: The delimiter to search for. - * Notice : We suppose the delimiter is a single-char string(for example : ";"). - */ -INT delimitcnt(PSTRING s,PSTRING ct) -{ - INT count = 0; - /* point to the beginning of the line */ - PSTRING token = s; - - for ( ;; ) - { - token = strpbrk(token, ct); /* search for delimiters */ - - if ( token == NULL ) - { - /* advanced to the terminating null character */ - break; - } - /* skip the delimiter */ - ++token; - - /* - * Print the found text: use len with %.*s to specify field width. - */ - - /* accumulate delimiter count */ - ++count; - } - return count; -} - -/* - * converts the Internet host address from the standard numbers-and-dots notation - * into binary data. - * returns nonzero if the address is valid, zero if not. - */ -int rtinet_aton(PSTRING cp, unsigned int *addr) -{ - unsigned int val; - int base, n; - STRING c; - unsigned int parts[4]; - unsigned int *pp = parts; - - for (;;) - { - /* - * Collect number up to ``.''. - * Values are specified as for C: - * 0x=hex, 0=octal, other=decimal. - */ - val = 0; - base = 10; - if (*cp == '0') - { - if (*++cp == 'x' || *cp == 'X') - base = 16, cp++; - else - base = 8; - } - while ((c = *cp) != '\0') - { - if (isdigit((unsigned char) c)) - { - val = (val * base) + (c - '0'); - cp++; - continue; - } - if (base == 16 && isxdigit((unsigned char) c)) - { - val = (val << 4) + - (c + 10 - (islower((unsigned char) c) ? 'a' : 'A')); - cp++; - continue; - } - break; - } - if (*cp == '.') - { - /* - * Internet format: a.b.c.d a.b.c (with c treated as 16-bits) - * a.b (with b treated as 24 bits) - */ - if (pp >= parts + 3 || val > 0xff) - return 0; - *pp++ = val, cp++; - } - else - break; - } - - /* - * Check for trailing junk. - */ - while (*cp) - if (!isspace((unsigned char) *cp++)) - return 0; - - /* - * Concoct the address according to the number of parts specified. - */ - n = pp - parts + 1; - switch (n) - { - - case 1: /* a -- 32 bits */ - break; - - case 2: /* a.b -- 8.24 bits */ - if (val > 0xffffff) - return 0; - val |= parts[0] << 24; - break; - - case 3: /* a.b.c -- 8.8.16 bits */ - if (val > 0xffff) - return 0; - val |= (parts[0] << 24) | (parts[1] << 16); - break; - - case 4: /* a.b.c.d -- 8.8.8.8 bits */ - if (val > 0xff) - return 0; - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); - break; - } - - *addr = htonl(val); - return 1; - -} - -/* - ======================================================================== - - Routine Description: - Find key section for Get key parameter. - - Arguments: - buffer Pointer to the buffer to start find the key section - section the key of the secion to be find - - Return Value: - NULL Fail - Others Success - ======================================================================== -*/ -PSTRING RTMPFindSection( - IN PSTRING buffer) -{ - STRING temp_buf[32]; - PSTRING ptr; - - strcpy(temp_buf, "Default"); - - if((ptr = rtstrstr(buffer, temp_buf)) != NULL) - return (ptr+strlen("\n")); - else - return NULL; -} - -/* - ======================================================================== - - Routine Description: - Get key parameter. - - Arguments: - key Pointer to key string - dest Pointer to destination - destsize The datasize of the destination - buffer Pointer to the buffer to start find the key - bTrimSpace Set true if you want to strip the space character of the result pattern - - Return Value: - TRUE Success - FALSE Fail - - Note: - This routine get the value with the matched key (case case-sensitive) - For SSID and security key related parameters, we SHALL NOT trim the space(' ') character. - ======================================================================== -*/ -INT RTMPGetKeyParameter( - IN PSTRING key, - OUT PSTRING dest, - IN INT destsize, - IN PSTRING buffer, - IN BOOLEAN bTrimSpace) -{ - PSTRING pMemBuf, temp_buf1 = NULL, temp_buf2 = NULL; - PSTRING start_ptr, end_ptr; - PSTRING ptr; - PSTRING offset = NULL; - INT len, keyLen; - - - keyLen = strlen(key); - os_alloc_mem(NULL, (PUCHAR *)&pMemBuf, MAX_PARAM_BUFFER_SIZE * 2); - if (pMemBuf == NULL) - return (FALSE); - - memset(pMemBuf, 0, MAX_PARAM_BUFFER_SIZE * 2); - temp_buf1 = pMemBuf; - temp_buf2 = (PSTRING)(pMemBuf + MAX_PARAM_BUFFER_SIZE); - - - //find section - if((offset = RTMPFindSection(buffer)) == NULL) - { - os_free_mem(NULL, (PUCHAR)pMemBuf); - return (FALSE); - } - - strcpy(temp_buf1, "\n"); - strcat(temp_buf1, key); - strcat(temp_buf1, "="); - - //search key - if((start_ptr=rtstrstr(offset, temp_buf1)) == NULL) - { - os_free_mem(NULL, (PUCHAR)pMemBuf); - return (FALSE); - } - - start_ptr += strlen("\n"); - if((end_ptr = rtstrstr(start_ptr, "\n"))==NULL) - end_ptr = start_ptr+strlen(start_ptr); - - if (end_ptr= 1 ) && (KeyIdx <= 4)) - pAd->StaCfg.DefaultKeyId = (UCHAR) (KeyIdx - 1); - else - pAd->StaCfg.DefaultKeyId = 0; - - DBGPRINT(RT_DEBUG_TRACE, ("DefaultKeyID(0~3)=%d\n", pAd->StaCfg.DefaultKeyId)); - } - } - - - for (idx = 0; idx < 4; idx++) - { - sprintf(tok_str, "Key%dType", idx + 1); - //Key1Type - if (RTMPGetKeyParameter(tok_str, tmpbuf, 128, buffer, TRUE)) - { - for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++) - { - /* - do sanity check for KeyType length; - or in station mode, the KeyType length > 1, - the code will overwrite the stack of caller - (RTMPSetProfileParameters) and cause srcbuf = NULL - */ - if (i < MAX_MBSSID_NUM) - KeyType[i] = simple_strtol(macptr, 0, 10); - } - - { - sprintf(tok_str, "Key%dStr", idx + 1); - if (RTMPGetKeyParameter(tok_str, tmpbuf, 128, buffer, FALSE)) - { - rtmp_parse_key_buffer_from_file(pAd, tmpbuf, KeyType[BSS0], BSS0, idx); - } - } - } - } -} - - - -static void rtmp_read_sta_wmm_parms_from_file(IN PRTMP_ADAPTER pAd, char *tmpbuf, char *buffer) -{ - PSTRING macptr; - INT i=0; - BOOLEAN bWmmEnable = FALSE; - - //WmmCapable - if(RTMPGetKeyParameter("WmmCapable", tmpbuf, 32, buffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) //Enable - { - pAd->CommonCfg.bWmmCapable = TRUE; - bWmmEnable = TRUE; - } - else //Disable - { - pAd->CommonCfg.bWmmCapable = FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("WmmCapable=%d\n", pAd->CommonCfg.bWmmCapable)); - } - - - //AckPolicy for AC_BK, AC_BE, AC_VI, AC_VO - if(RTMPGetKeyParameter("AckPolicy", tmpbuf, 32, buffer, TRUE)) - { - for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++) - { - pAd->CommonCfg.AckPolicy[i] = (UCHAR)simple_strtol(macptr, 0, 10); - - DBGPRINT(RT_DEBUG_TRACE, ("AckPolicy[%d]=%d\n", i, pAd->CommonCfg.AckPolicy[i])); - } - } - - if (bWmmEnable) - { - //APSDCapable - if(RTMPGetKeyParameter("APSDCapable", tmpbuf, 10, buffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) //Enable - pAd->CommonCfg.bAPSDCapable = TRUE; - else - pAd->CommonCfg.bAPSDCapable = FALSE; - - DBGPRINT(RT_DEBUG_TRACE, ("APSDCapable=%d\n", pAd->CommonCfg.bAPSDCapable)); - } - - //MaxSPLength - if(RTMPGetKeyParameter("MaxSPLength", tmpbuf, 10, buffer, TRUE)) - { - pAd->CommonCfg.MaxSPLength = simple_strtol(tmpbuf, 0, 10); - - DBGPRINT(RT_DEBUG_TRACE, ("MaxSPLength=%d\n", pAd->CommonCfg.MaxSPLength)); - } - - //APSDAC for AC_BE, AC_BK, AC_VI, AC_VO - if(RTMPGetKeyParameter("APSDAC", tmpbuf, 32, buffer, TRUE)) - { - BOOLEAN apsd_ac[4]; - - for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++) - { - apsd_ac[i] = (BOOLEAN)simple_strtol(macptr, 0, 10); - - DBGPRINT(RT_DEBUG_TRACE, ("APSDAC%d %d\n", i, apsd_ac[i])); - } - - pAd->CommonCfg.bAPSDAC_BE = apsd_ac[0]; - pAd->CommonCfg.bAPSDAC_BK = apsd_ac[1]; - pAd->CommonCfg.bAPSDAC_VI = apsd_ac[2]; - pAd->CommonCfg.bAPSDAC_VO = apsd_ac[3]; - - pAd->CommonCfg.bACMAPSDTr[0] = apsd_ac[0]; - pAd->CommonCfg.bACMAPSDTr[1] = apsd_ac[1]; - pAd->CommonCfg.bACMAPSDTr[2] = apsd_ac[2]; - pAd->CommonCfg.bACMAPSDTr[3] = apsd_ac[3]; - } - } - -} - - -static void HTParametersHook( - IN PRTMP_ADAPTER pAd, - IN PSTRING pValueStr, - IN PSTRING pInput) -{ - - long Value; - - if (RTMPGetKeyParameter("HT_PROTECT", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bHTProtect = FALSE; - } - else - { - pAd->CommonCfg.bHTProtect = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Protection = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - if (RTMPGetKeyParameter("HT_MIMOPSEnable", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bMIMOPSEnable = FALSE; - } - else - { - pAd->CommonCfg.bMIMOPSEnable = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: MIMOPSEnable = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - - if (RTMPGetKeyParameter("HT_MIMOPSMode", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value > MMPS_ENABLE) - { - pAd->CommonCfg.BACapability.field.MMPSmode = MMPS_ENABLE; - } - else - { - //TODO: add mimo power saving mechanism - pAd->CommonCfg.BACapability.field.MMPSmode = MMPS_ENABLE; - //pAd->CommonCfg.BACapability.field.MMPSmode = Value; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: MIMOPS Mode = %d\n", (INT) Value)); - } - - if (RTMPGetKeyParameter("HT_BADecline", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bBADecline = FALSE; - } - else - { - pAd->CommonCfg.bBADecline = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: BA Decline = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - - if (RTMPGetKeyParameter("HT_DisableReordering", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bDisableReordering = FALSE; - } - else - { - pAd->CommonCfg.bDisableReordering = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: DisableReordering = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - if (RTMPGetKeyParameter("HT_AutoBA", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.BACapability.field.AutoBA = FALSE; - pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE; - } - else - { - pAd->CommonCfg.BACapability.field.AutoBA = TRUE; - pAd->CommonCfg.BACapability.field.Policy = IMMED_BA; - } - pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA; - DBGPRINT(RT_DEBUG_TRACE, ("HT: Auto BA = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - // Tx_+HTC frame - if (RTMPGetKeyParameter("HT_HTC", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->HTCEnable = FALSE; - } - else - { - pAd->HTCEnable = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Tx +HTC frame = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - // Enable HT Link Adaptation Control - if (RTMPGetKeyParameter("HT_LinkAdapt", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->bLinkAdapt = FALSE; - } - else - { - pAd->HTCEnable = TRUE; - pAd->bLinkAdapt = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Link Adaptation Control = %s\n", (Value==0) ? "Disable" : "Enable(+HTC)")); - } - - // Reverse Direction Mechanism - if (RTMPGetKeyParameter("HT_RDG", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bRdg = FALSE; - } - else - { - pAd->HTCEnable = TRUE; - pAd->CommonCfg.bRdg = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: RDG = %s\n", (Value==0) ? "Disable" : "Enable(+HTC)")); - } - - - - - // Tx A-MSUD ? - if (RTMPGetKeyParameter("HT_AMSDU", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.BACapability.field.AmsduEnable = FALSE; - } - else - { - pAd->CommonCfg.BACapability.field.AmsduEnable = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Tx A-MSDU = %s\n", (Value==0) ? "Disable" : "Enable")); - } - - // MPDU Density - if (RTMPGetKeyParameter("HT_MpduDensity", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value <=7 && Value >= 0) - { - pAd->CommonCfg.BACapability.field.MpduDensity = Value; - DBGPRINT(RT_DEBUG_TRACE, ("HT: MPDU Density = %d\n", (INT) Value)); - } - else - { - pAd->CommonCfg.BACapability.field.MpduDensity = 4; - DBGPRINT(RT_DEBUG_TRACE, ("HT: MPDU Density = %d (Default)\n", 4)); - } - } - - // Max Rx BA Window Size - if (RTMPGetKeyParameter("HT_BAWinSize", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - - if (Value >=1 && Value <= 64) - { - pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = Value; - pAd->CommonCfg.BACapability.field.RxBAWinLimit = Value; - DBGPRINT(RT_DEBUG_TRACE, ("HT: BA Windw Size = %d\n", (INT) Value)); - } - else - { - pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = 64; - pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64; - DBGPRINT(RT_DEBUG_TRACE, ("HT: BA Windw Size = 64 (Defualt)\n")); - } - - } - - // Guard Interval - if (RTMPGetKeyParameter("HT_GI", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - - if (Value == GI_400) - { - pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_400; - } - else - { - pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_800; - } - - DBGPRINT(RT_DEBUG_TRACE, ("HT: Guard Interval = %s\n", (Value==GI_400) ? "400" : "800" )); - } - - // HT Operation Mode : Mixed Mode , Green Field - if (RTMPGetKeyParameter("HT_OpMode", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - - if (Value == HTMODE_GF) - { - - pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_GF; - } - else - { - pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_MM; - } - - DBGPRINT(RT_DEBUG_TRACE, ("HT: Operate Mode = %s\n", (Value==HTMODE_GF) ? "Green Field" : "Mixed Mode" )); - } - - // Fixed Tx mode : CCK, OFDM - if (RTMPGetKeyParameter("FixedTxMode", pValueStr, 25, pInput, TRUE)) - { - UCHAR fix_tx_mode; - - { - fix_tx_mode = FIXED_TXMODE_HT; - - if (strcmp(pValueStr, "OFDM") == 0 || strcmp(pValueStr, "ofdm") == 0) - { - fix_tx_mode = FIXED_TXMODE_OFDM; - } - else if (strcmp(pValueStr, "CCK") == 0 || strcmp(pValueStr, "cck") == 0) - { - fix_tx_mode = FIXED_TXMODE_CCK; - } - else if (strcmp(pValueStr, "HT") == 0 || strcmp(pValueStr, "ht") == 0) - { - fix_tx_mode = FIXED_TXMODE_HT; - } - else - { - Value = simple_strtol(pValueStr, 0, 10); - // 1 : CCK - // 2 : OFDM - // otherwise : HT - if (Value == FIXED_TXMODE_CCK || Value == FIXED_TXMODE_OFDM) - fix_tx_mode = Value; - else - fix_tx_mode = FIXED_TXMODE_HT; - } - - pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode = fix_tx_mode; - DBGPRINT(RT_DEBUG_TRACE, ("Fixed Tx Mode = %d\n", fix_tx_mode)); - - } - } - - - // Channel Width - if (RTMPGetKeyParameter("HT_BW", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - - if (Value == BW_40) - { - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40; - } - else - { - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - } - - DBGPRINT(RT_DEBUG_TRACE, ("HT: Channel Width = %s\n", (Value==BW_40) ? "40 MHz" : "20 MHz" )); - } - - if (RTMPGetKeyParameter("HT_EXTCHA", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - - if (Value == 0) - { - - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW; - } - else - { - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("HT: Ext Channel = %s\n", (Value==0) ? "BELOW" : "ABOVE" )); - } - - // MSC - if (RTMPGetKeyParameter("HT_MCS", pValueStr, 50, pInput, TRUE)) - { - { - Value = simple_strtol(pValueStr, 0, 10); - -// if ((Value >= 0 && Value <= 15) || (Value == 32)) - if ((Value >= 0 && Value <= 23) || (Value == 32)) // 3*3 - { - pAd->StaCfg.DesiredTransmitSetting.field.MCS = Value; - pAd->StaCfg.bAutoTxRateSwitch = FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("HT: MCS = %d\n", pAd->StaCfg.DesiredTransmitSetting.field.MCS)); - } - else - { - pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; - pAd->StaCfg.bAutoTxRateSwitch = TRUE; - DBGPRINT(RT_DEBUG_TRACE, ("HT: MCS = AUTO\n")); - } - } - } - - // STBC - if (RTMPGetKeyParameter("HT_STBC", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == STBC_USE) - { - pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_USE; - } - else - { - pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_NONE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: STBC = %d\n", pAd->CommonCfg.RegTransmitSetting.field.STBC)); - } - - // 40_Mhz_Intolerant - if (RTMPGetKeyParameter("HT_40MHZ_INTOLERANT", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bForty_Mhz_Intolerant = FALSE; - } - else - { - pAd->CommonCfg.bForty_Mhz_Intolerant = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: 40MHZ INTOLERANT = %d\n", pAd->CommonCfg.bForty_Mhz_Intolerant)); - } - //HT_TxStream - if(RTMPGetKeyParameter("HT_TxStream", pValueStr, 10, pInput, TRUE)) - { - switch (simple_strtol(pValueStr, 0, 10)) - { - case 1: - pAd->CommonCfg.TxStream = 1; - break; - case 2: - pAd->CommonCfg.TxStream = 2; - break; - case 3: // 3*3 - default: - pAd->CommonCfg.TxStream = 3; - - if (pAd->MACVersion < RALINK_2883_VERSION) - pAd->CommonCfg.TxStream = 2; // only 2 tx streams for RT2860 series - break; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Tx Stream = %d\n", pAd->CommonCfg.TxStream)); - } - //HT_RxStream - if(RTMPGetKeyParameter("HT_RxStream", pValueStr, 10, pInput, TRUE)) - { - switch (simple_strtol(pValueStr, 0, 10)) - { - case 1: - pAd->CommonCfg.RxStream = 1; - break; - case 2: - pAd->CommonCfg.RxStream = 2; - break; - case 3: - default: - pAd->CommonCfg.RxStream = 3; - - if (pAd->MACVersion < RALINK_2883_VERSION) - pAd->CommonCfg.RxStream = 2; // only 2 rx streams for RT2860 series - break; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Rx Stream = %d\n", pAd->CommonCfg.RxStream)); - } - //2008/11/05: KH add to support Antenna power-saving of AP<-- - //Green AP - if(RTMPGetKeyParameter("GreenAP", pValueStr, 10, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - if (Value == 0) - { - pAd->CommonCfg.bGreenAPEnable = FALSE; - } - else - { - pAd->CommonCfg.bGreenAPEnable = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("HT: Green AP= %d\n", pAd->CommonCfg.bGreenAPEnable)); - } - - // HT_DisallowTKIP - if (RTMPGetKeyParameter("HT_DisallowTKIP", pValueStr, 25, pInput, TRUE)) - { - Value = simple_strtol(pValueStr, 0, 10); - - if (Value == 1) - { - pAd->CommonCfg.HT_DisallowTKIP = TRUE; - } - else - { - pAd->CommonCfg.HT_DisallowTKIP = FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("HT: Disallow TKIP mode = %s\n", (pAd->CommonCfg.HT_DisallowTKIP == TRUE) ? "ON" : "OFF" )); - } - - - //2008/11/05:KH add to support Antenna power-saving of AP--> -} - - -NDIS_STATUS RTMPSetProfileParameters( - IN RTMP_ADAPTER *pAd, - IN PSTRING pBuffer) -{ - PSTRING tmpbuf; - ULONG RtsThresh; - ULONG FragThresh; - PSTRING macptr; - INT i = 0, retval; - tmpbuf = kmalloc(MAX_PARAM_BUFFER_SIZE, MEM_ALLOC_FLAG); - if(tmpbuf == NULL) - return NDIS_STATUS_FAILURE; - - do - { - // set file parameter to portcfg - //CountryRegion - if(RTMPGetKeyParameter("CountryRegion", tmpbuf, 25, pBuffer, TRUE)) - { - retval = RT_CfgSetCountryRegion(pAd, tmpbuf, BAND_24G); - DBGPRINT(RT_DEBUG_TRACE, ("CountryRegion=%d\n", pAd->CommonCfg.CountryRegion)); - } - //CountryRegionABand - if(RTMPGetKeyParameter("CountryRegionABand", tmpbuf, 25, pBuffer, TRUE)) - { - retval = RT_CfgSetCountryRegion(pAd, tmpbuf, BAND_5G); - DBGPRINT(RT_DEBUG_TRACE, ("CountryRegionABand=%d\n", pAd->CommonCfg.CountryRegionForABand)); - } - //CountryCode - if(RTMPGetKeyParameter("CountryCode", tmpbuf, 25, pBuffer, TRUE)) - { - NdisMoveMemory(pAd->CommonCfg.CountryCode, tmpbuf , 2); - if (strlen((PSTRING) pAd->CommonCfg.CountryCode) != 0) - { - pAd->CommonCfg.bCountryFlag = TRUE; - } - DBGPRINT(RT_DEBUG_TRACE, ("CountryCode=%s\n", pAd->CommonCfg.CountryCode)); - } - //ChannelGeography - if(RTMPGetKeyParameter("ChannelGeography", tmpbuf, 25, pBuffer, TRUE)) - { - UCHAR Geography = (UCHAR) simple_strtol(tmpbuf, 0, 10); - if (Geography <= BOTH) - { - pAd->CommonCfg.Geography = Geography; - pAd->CommonCfg.CountryCode[2] = - (pAd->CommonCfg.Geography == BOTH) ? ' ' : ((pAd->CommonCfg.Geography == IDOR) ? 'I' : 'O'); - DBGPRINT(RT_DEBUG_TRACE, ("ChannelGeography=%d\n", pAd->CommonCfg.Geography)); - } - } - else - { - pAd->CommonCfg.Geography = BOTH; - pAd->CommonCfg.CountryCode[2] = ' '; - } - - { - //SSID - if (RTMPGetKeyParameter("SSID", tmpbuf, 256, pBuffer, FALSE)) - { - if (strlen(tmpbuf) <= 32) - { - pAd->CommonCfg.SsidLen = (UCHAR) strlen(tmpbuf); - NdisZeroMemory(pAd->CommonCfg.Ssid, NDIS_802_11_LENGTH_SSID); - NdisMoveMemory(pAd->CommonCfg.Ssid, tmpbuf, pAd->CommonCfg.SsidLen); - pAd->MlmeAux.AutoReconnectSsidLen = pAd->CommonCfg.SsidLen; - NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, NDIS_802_11_LENGTH_SSID); - NdisMoveMemory(pAd->MlmeAux.AutoReconnectSsid, tmpbuf, pAd->MlmeAux.AutoReconnectSsidLen); - pAd->MlmeAux.SsidLen = pAd->CommonCfg.SsidLen; - NdisZeroMemory(pAd->MlmeAux.Ssid, NDIS_802_11_LENGTH_SSID); - NdisMoveMemory(pAd->MlmeAux.Ssid, tmpbuf, pAd->MlmeAux.SsidLen); - DBGPRINT(RT_DEBUG_TRACE, ("%s::(SSID=%s)\n", __func__, tmpbuf)); - } - } - } - - { - //NetworkType - if (RTMPGetKeyParameter("NetworkType", tmpbuf, 25, pBuffer, TRUE)) - { - pAd->bConfigChanged = TRUE; - if (strcmp(tmpbuf, "Adhoc") == 0) - pAd->StaCfg.BssType = BSS_ADHOC; - else //Default Infrastructure mode - pAd->StaCfg.BssType = BSS_INFRA; - // Reset Ralink supplicant to not use, it will be set to start when UI set PMK key - pAd->StaCfg.WpaState = SS_NOTUSE; - DBGPRINT(RT_DEBUG_TRACE, ("%s::(NetworkType=%d)\n", __func__, pAd->StaCfg.BssType)); - } - } -#ifdef RTMP_MAC_PCI - //NewPCIePS - if(RTMPGetKeyParameter("NewPCIePS", tmpbuf, 10, pBuffer, TRUE)) - { - UCHAR temp_buffer = (UCHAR) simple_strtol(tmpbuf, 0, 10); - if(temp_buffer>0) - pAd->StaCfg.PSControl.field.EnableNewPS=TRUE; - else - pAd->StaCfg.PSControl.field.EnableNewPS=FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("NewPCIePS=%d\n", pAd->StaCfg.PSControl.field.EnableNewPS)); - } -#endif // RTMP_MAC_PCI // -#ifdef RT3090 - //PCIePowerLevel - - if(RTMPGetKeyParameter("PCIePowerLevel", tmpbuf, 10, pBuffer, TRUE)) - { - pAd->StaCfg.PSControl.field.rt30xxPowerMode = (UCHAR) simple_strtol(tmpbuf, 0, 10); - DBGPRINT(RT_DEBUG_TRACE, ("PCIePowerLevel=%d\n", pAd->StaCfg.PSControl.field.rt30xxPowerMode)); - } - //FollowHostASPM - if(RTMPGetKeyParameter("FollowHostASPM", tmpbuf, 10, pBuffer, TRUE)) - { - UCHAR temp_buffer = (UCHAR) simple_strtol(tmpbuf, 0, 10); - - if(temp_buffer>0) - pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM=TRUE; - else - pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM=FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("rt30xxFollowHostASPM=%d\n", pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM)); - } - //ForceTestASPM - if(RTMPGetKeyParameter("ForceTestASPM", tmpbuf, 10, pBuffer, TRUE)) - { - UCHAR temp_buffer = (UCHAR) simple_strtol(tmpbuf, 0, 10); - - if(temp_buffer>0) - pAd->StaCfg.PSControl.field.rt30xxForceASPMTest=TRUE; - else - pAd->StaCfg.PSControl.field.rt30xxForceASPMTest=FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("rt30xxForceASPM=%d\n", pAd->StaCfg.PSControl.field.rt30xxForceASPMTest)); - } -#endif // RT3090 // - //Channel - if(RTMPGetKeyParameter("Channel", tmpbuf, 10, pBuffer, TRUE)) - { - pAd->CommonCfg.Channel = (UCHAR) simple_strtol(tmpbuf, 0, 10); - DBGPRINT(RT_DEBUG_TRACE, ("Channel=%d\n", pAd->CommonCfg.Channel)); - } - //WirelessMode - if(RTMPGetKeyParameter("WirelessMode", tmpbuf, 10, pBuffer, TRUE)) - { - RT_CfgSetWirelessMode(pAd, tmpbuf); - DBGPRINT(RT_DEBUG_TRACE, ("PhyMode=%d\n", pAd->CommonCfg.PhyMode)); - } - //BasicRate - if(RTMPGetKeyParameter("BasicRate", tmpbuf, 10, pBuffer, TRUE)) - { - pAd->CommonCfg.BasicRateBitmap = (ULONG) simple_strtol(tmpbuf, 0, 10); - DBGPRINT(RT_DEBUG_TRACE, ("BasicRate=%ld\n", pAd->CommonCfg.BasicRateBitmap)); - } - //BeaconPeriod - if(RTMPGetKeyParameter("BeaconPeriod", tmpbuf, 10, pBuffer, TRUE)) - { - pAd->CommonCfg.BeaconPeriod = (USHORT) simple_strtol(tmpbuf, 0, 10); - DBGPRINT(RT_DEBUG_TRACE, ("BeaconPeriod=%d\n", pAd->CommonCfg.BeaconPeriod)); - } - //TxPower - if(RTMPGetKeyParameter("TxPower", tmpbuf, 10, pBuffer, TRUE)) - { - pAd->CommonCfg.TxPowerPercentage = (ULONG) simple_strtol(tmpbuf, 0, 10); - pAd->CommonCfg.TxPowerDefault = pAd->CommonCfg.TxPowerPercentage; - DBGPRINT(RT_DEBUG_TRACE, ("TxPower=%ld\n", pAd->CommonCfg.TxPowerPercentage)); - } - //BGProtection - if(RTMPGetKeyParameter("BGProtection", tmpbuf, 10, pBuffer, TRUE)) - { - //#if 0 //#ifndef WIFI_TEST - // pAd->CommonCfg.UseBGProtection = 2;// disable b/g protection for throughput test - //#else - switch (simple_strtol(tmpbuf, 0, 10)) - { - case 1: //Always On - pAd->CommonCfg.UseBGProtection = 1; - break; - case 2: //Always OFF - pAd->CommonCfg.UseBGProtection = 2; - break; - case 0: //AUTO - default: - pAd->CommonCfg.UseBGProtection = 0; - break; - } - //#endif - DBGPRINT(RT_DEBUG_TRACE, ("BGProtection=%ld\n", pAd->CommonCfg.UseBGProtection)); - } - //OLBCDetection - if(RTMPGetKeyParameter("DisableOLBC", tmpbuf, 10, pBuffer, TRUE)) - { - switch (simple_strtol(tmpbuf, 0, 10)) - { - case 1: //disable OLBC Detection - pAd->CommonCfg.DisableOLBCDetect = 1; - break; - case 0: //enable OLBC Detection - pAd->CommonCfg.DisableOLBCDetect = 0; - break; - default: - pAd->CommonCfg.DisableOLBCDetect= 0; - break; - } - DBGPRINT(RT_DEBUG_TRACE, ("OLBCDetection=%ld\n", pAd->CommonCfg.DisableOLBCDetect)); - } - //TxPreamble - if(RTMPGetKeyParameter("TxPreamble", tmpbuf, 10, pBuffer, TRUE)) - { - switch (simple_strtol(tmpbuf, 0, 10)) - { - case Rt802_11PreambleShort: - pAd->CommonCfg.TxPreamble = Rt802_11PreambleShort; - break; - case Rt802_11PreambleLong: - default: - pAd->CommonCfg.TxPreamble = Rt802_11PreambleLong; - break; - } - DBGPRINT(RT_DEBUG_TRACE, ("TxPreamble=%ld\n", pAd->CommonCfg.TxPreamble)); - } - //RTSThreshold - if(RTMPGetKeyParameter("RTSThreshold", tmpbuf, 10, pBuffer, TRUE)) - { - RtsThresh = simple_strtol(tmpbuf, 0, 10); - if( (RtsThresh >= 1) && (RtsThresh <= MAX_RTS_THRESHOLD) ) - pAd->CommonCfg.RtsThreshold = (USHORT)RtsThresh; - else - pAd->CommonCfg.RtsThreshold = MAX_RTS_THRESHOLD; - - DBGPRINT(RT_DEBUG_TRACE, ("RTSThreshold=%d\n", pAd->CommonCfg.RtsThreshold)); - } - //FragThreshold - if(RTMPGetKeyParameter("FragThreshold", tmpbuf, 10, pBuffer, TRUE)) - { - FragThresh = simple_strtol(tmpbuf, 0, 10); - pAd->CommonCfg.bUseZeroToDisableFragment = FALSE; - - if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD) - { //illegal FragThresh so we set it to default - pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD; - pAd->CommonCfg.bUseZeroToDisableFragment = TRUE; - } - else if (FragThresh % 2 == 1) - { - // The length of each fragment shall always be an even number of octets, except for the last fragment - // of an MSDU or MMPDU, which may be either an even or an odd number of octets. - pAd->CommonCfg.FragmentThreshold = (USHORT)(FragThresh - 1); - } - else - { - pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh; - } - //pAd->CommonCfg.AllowFragSize = (pAd->CommonCfg.FragmentThreshold) - LENGTH_802_11 - LENGTH_CRC; - DBGPRINT(RT_DEBUG_TRACE, ("FragThreshold=%d\n", pAd->CommonCfg.FragmentThreshold)); - } - //TxBurst - if(RTMPGetKeyParameter("TxBurst", tmpbuf, 10, pBuffer, TRUE)) - { - //#ifdef WIFI_TEST - // pAd->CommonCfg.bEnableTxBurst = FALSE; - //#else - if(simple_strtol(tmpbuf, 0, 10) != 0) //Enable - pAd->CommonCfg.bEnableTxBurst = TRUE; - else //Disable - pAd->CommonCfg.bEnableTxBurst = FALSE; - //#endif - DBGPRINT(RT_DEBUG_TRACE, ("TxBurst=%d\n", pAd->CommonCfg.bEnableTxBurst)); - } - -#ifdef AGGREGATION_SUPPORT - //PktAggregate - if(RTMPGetKeyParameter("PktAggregate", tmpbuf, 10, pBuffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) //Enable - pAd->CommonCfg.bAggregationCapable = TRUE; - else //Disable - pAd->CommonCfg.bAggregationCapable = FALSE; -#ifdef PIGGYBACK_SUPPORT - pAd->CommonCfg.bPiggyBackCapable = pAd->CommonCfg.bAggregationCapable; -#endif // PIGGYBACK_SUPPORT // - DBGPRINT(RT_DEBUG_TRACE, ("PktAggregate=%d\n", pAd->CommonCfg.bAggregationCapable)); - } -#else - pAd->CommonCfg.bAggregationCapable = FALSE; - pAd->CommonCfg.bPiggyBackCapable = FALSE; -#endif // AGGREGATION_SUPPORT // - - // WmmCapable - - rtmp_read_sta_wmm_parms_from_file(pAd, tmpbuf, pBuffer); - - //ShortSlot - if(RTMPGetKeyParameter("ShortSlot", tmpbuf, 10, pBuffer, TRUE)) - { - RT_CfgSetShortSlot(pAd, tmpbuf); - DBGPRINT(RT_DEBUG_TRACE, ("ShortSlot=%d\n", pAd->CommonCfg.bUseShortSlotTime)); - } - //IEEE80211H - if(RTMPGetKeyParameter("IEEE80211H", tmpbuf, 10, pBuffer, TRUE)) - { - for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++) - { - if(simple_strtol(macptr, 0, 10) != 0) //Enable - pAd->CommonCfg.bIEEE80211H = TRUE; - else //Disable - pAd->CommonCfg.bIEEE80211H = FALSE; - - DBGPRINT(RT_DEBUG_TRACE, ("IEEE80211H=%d\n", pAd->CommonCfg.bIEEE80211H)); - } - } - //CSPeriod - if(RTMPGetKeyParameter("CSPeriod", tmpbuf, 10, pBuffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) - pAd->CommonCfg.RadarDetect.CSPeriod = simple_strtol(tmpbuf, 0, 10); - else - pAd->CommonCfg.RadarDetect.CSPeriod = 0; - - DBGPRINT(RT_DEBUG_TRACE, ("CSPeriod=%d\n", pAd->CommonCfg.RadarDetect.CSPeriod)); - } - - //RDRegion - if(RTMPGetKeyParameter("RDRegion", tmpbuf, 128, pBuffer, TRUE)) - { - RADAR_DETECT_STRUCT *pRadarDetect = &pAd->CommonCfg.RadarDetect; - if ((strncmp(tmpbuf, "JAP_W53", 7) == 0) || (strncmp(tmpbuf, "jap_w53", 7) == 0)) - { - pRadarDetect->RDDurRegion = JAP_W53; - pRadarDetect->DfsSessionTime = 15; - } - else if ((strncmp(tmpbuf, "JAP_W56", 7) == 0) || (strncmp(tmpbuf, "jap_w56", 7) == 0)) - { - pRadarDetect->RDDurRegion = JAP_W56; - pRadarDetect->DfsSessionTime = 13; - } - else if ((strncmp(tmpbuf, "JAP", 3) == 0) || (strncmp(tmpbuf, "jap", 3) == 0)) - { - pRadarDetect->RDDurRegion = JAP; - pRadarDetect->DfsSessionTime = 5; - } - else if ((strncmp(tmpbuf, "FCC", 3) == 0) || (strncmp(tmpbuf, "fcc", 3) == 0)) - { - pRadarDetect->RDDurRegion = FCC; - pRadarDetect->DfsSessionTime = 5; - } - else if ((strncmp(tmpbuf, "CE", 2) == 0) || (strncmp(tmpbuf, "ce", 2) == 0)) - { - pRadarDetect->RDDurRegion = CE; - pRadarDetect->DfsSessionTime = 13; - } - else - { - pRadarDetect->RDDurRegion = CE; - pRadarDetect->DfsSessionTime = 13; - } - - DBGPRINT(RT_DEBUG_TRACE, ("RDRegion=%d\n", pRadarDetect->RDDurRegion)); - } - else - { - pAd->CommonCfg.RadarDetect.RDDurRegion = CE; - pAd->CommonCfg.RadarDetect.DfsSessionTime = 13; - } - - //WirelessEvent - if(RTMPGetKeyParameter("WirelessEvent", tmpbuf, 10, pBuffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) - pAd->CommonCfg.bWirelessEvent = simple_strtol(tmpbuf, 0, 10); - else - pAd->CommonCfg.bWirelessEvent = 0; // disable - DBGPRINT(RT_DEBUG_TRACE, ("WirelessEvent=%d\n", pAd->CommonCfg.bWirelessEvent)); - } - if(RTMPGetKeyParameter("WiFiTest", tmpbuf, 10, pBuffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) != 0) - pAd->CommonCfg.bWiFiTest= simple_strtol(tmpbuf, 0, 10); - else - pAd->CommonCfg.bWiFiTest = 0; // disable - - DBGPRINT(RT_DEBUG_TRACE, ("WiFiTest=%d\n", pAd->CommonCfg.bWiFiTest)); - } - //AuthMode - if(RTMPGetKeyParameter("AuthMode", tmpbuf, 128, pBuffer, TRUE)) - { - { - if ((strcmp(tmpbuf, "WEPAUTO") == 0) || (strcmp(tmpbuf, "wepauto") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeAutoSwitch; - else if ((strcmp(tmpbuf, "SHARED") == 0) || (strcmp(tmpbuf, "shared") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeShared; - else if ((strcmp(tmpbuf, "WPAPSK") == 0) || (strcmp(tmpbuf, "wpapsk") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPAPSK; - else if ((strcmp(tmpbuf, "WPANONE") == 0) || (strcmp(tmpbuf, "wpanone") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPANone; - else if ((strcmp(tmpbuf, "WPA2PSK") == 0) || (strcmp(tmpbuf, "wpa2psk") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPA2PSK; - else if ((strcmp(tmpbuf, "WPA") == 0) || (strcmp(tmpbuf, "wpa") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPA; - else if ((strcmp(tmpbuf, "WPA2") == 0) || (strcmp(tmpbuf, "wpa2") == 0)) - pAd->StaCfg.AuthMode = Ndis802_11AuthModeWPA2; - else - pAd->StaCfg.AuthMode = Ndis802_11AuthModeOpen; - - pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - - DBGPRINT(RT_DEBUG_TRACE, ("%s::(AuthMode=%d)\n", __func__, pAd->StaCfg.AuthMode)); - } - } - //EncrypType - if(RTMPGetKeyParameter("EncrypType", tmpbuf, 128, pBuffer, TRUE)) - { - { - if ((strcmp(tmpbuf, "WEP") == 0) || (strcmp(tmpbuf, "wep") == 0)) - pAd->StaCfg.WepStatus = Ndis802_11WEPEnabled; - else if ((strcmp(tmpbuf, "TKIP") == 0) || (strcmp(tmpbuf, "tkip") == 0)) - pAd->StaCfg.WepStatus = Ndis802_11Encryption2Enabled; - else if ((strcmp(tmpbuf, "AES") == 0) || (strcmp(tmpbuf, "aes") == 0)) - pAd->StaCfg.WepStatus = Ndis802_11Encryption3Enabled; - else - pAd->StaCfg.WepStatus = Ndis802_11WEPDisabled; - - // Update all wepstatus related - pAd->StaCfg.PairCipher = pAd->StaCfg.WepStatus; - pAd->StaCfg.GroupCipher = pAd->StaCfg.WepStatus; - pAd->StaCfg.OrigWepStatus = pAd->StaCfg.WepStatus; - pAd->StaCfg.bMixCipher = FALSE; - - //RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, 0); - DBGPRINT(RT_DEBUG_TRACE, ("%s::(EncrypType=%d)\n", __func__, pAd->StaCfg.WepStatus)); - } - } - - { - if(RTMPGetKeyParameter("WPAPSK", tmpbuf, 512, pBuffer, FALSE)) - { - int ret = TRUE; - - tmpbuf[strlen(tmpbuf)] = '\0'; // make STA can process .$^& for WPAPSK input - - if ((pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPAPSK) && - (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPA2PSK) && - (pAd->StaCfg.AuthMode != Ndis802_11AuthModeWPANone) - ) - { - ret = FALSE; - } - else - { - ret = RT_CfgSetWPAPSKKey(pAd, tmpbuf, (PUCHAR)pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen, pAd->StaCfg.PMK); - } - - if (ret == TRUE) - { - RTMPZeroMemory(pAd->StaCfg.WpaPassPhrase, 64); - RTMPMoveMemory(pAd->StaCfg.WpaPassPhrase, tmpbuf, strlen(tmpbuf)); - pAd->StaCfg.WpaPassPhraseLen= strlen(tmpbuf); - - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - // Start STA supplicant state machine - pAd->StaCfg.WpaState = SS_START; - } - else if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) - { - pAd->StaCfg.WpaState = SS_NOTUSE; - } - DBGPRINT(RT_DEBUG_TRACE, ("%s::(WPAPSK=%s)\n", __func__, tmpbuf)); - } - } - } - - //DefaultKeyID, KeyType, KeyStr - rtmp_read_key_parms_from_file(pAd, tmpbuf, pBuffer); - - - //HSCounter - /*if(RTMPGetKeyParameter("HSCounter", tmpbuf, 10, pBuffer, TRUE)) - { - switch (simple_strtol(tmpbuf, 0, 10)) - { - case 1: //Enable - pAd->CommonCfg.bEnableHSCounter = TRUE; - break; - case 0: //Disable - default: - pAd->CommonCfg.bEnableHSCounter = FALSE; - break; - } - DBGPRINT(RT_DEBUG_TRACE, "HSCounter=%d\n", pAd->CommonCfg.bEnableHSCounter); - }*/ - - HTParametersHook(pAd, tmpbuf, pBuffer); - - { - //PSMode - if (RTMPGetKeyParameter("PSMode", tmpbuf, 10, pBuffer, TRUE)) - { - if (pAd->StaCfg.BssType == BSS_INFRA) - { - if ((strcmp(tmpbuf, "MAX_PSP") == 0) || (strcmp(tmpbuf, "max_psp") == 0)) - { - // do NOT turn on PSM bit here, wait until MlmeCheckForPsmChange() - // to exclude certain situations. - // MlmeSetPsm(pAd, PWR_SAVE); - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); - if (pAd->StaCfg.bWindowsACCAMEnable == FALSE) - pAd->StaCfg.WindowsPowerMode = Ndis802_11PowerModeMAX_PSP; - pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeMAX_PSP; - pAd->StaCfg.DefaultListenCount = 5; - } - else if ((strcmp(tmpbuf, "Fast_PSP") == 0) || (strcmp(tmpbuf, "fast_psp") == 0) - || (strcmp(tmpbuf, "FAST_PSP") == 0)) - { - // do NOT turn on PSM bit here, wait until MlmeCheckForPsmChange() - // to exclude certain situations. - // RTMP_SET_PSM_BIT(pAd, PWR_SAVE); - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); - if (pAd->StaCfg.bWindowsACCAMEnable == FALSE) - pAd->StaCfg.WindowsPowerMode = Ndis802_11PowerModeFast_PSP; - pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeFast_PSP; - pAd->StaCfg.DefaultListenCount = 3; - } - else if ((strcmp(tmpbuf, "Legacy_PSP") == 0) || (strcmp(tmpbuf, "legacy_psp") == 0) - || (strcmp(tmpbuf, "LEGACY_PSP") == 0)) - { - // do NOT turn on PSM bit here, wait until MlmeCheckForPsmChange() - // to exclude certain situations. - // RTMP_SET_PSM_BIT(pAd, PWR_SAVE); - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); - if (pAd->StaCfg.bWindowsACCAMEnable == FALSE) - pAd->StaCfg.WindowsPowerMode = Ndis802_11PowerModeLegacy_PSP; - pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeLegacy_PSP; - pAd->StaCfg.DefaultListenCount = 3; - } - else - { //Default Ndis802_11PowerModeCAM - // clear PSM bit immediately - RTMP_SET_PSM_BIT(pAd, PWR_ACTIVE); - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); - if (pAd->StaCfg.bWindowsACCAMEnable == FALSE) - pAd->StaCfg.WindowsPowerMode = Ndis802_11PowerModeCAM; - pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeCAM; - } - DBGPRINT(RT_DEBUG_TRACE, ("PSMode=%ld\n", pAd->StaCfg.WindowsPowerMode)); - } - } - // AutoRoaming by RSSI - if (RTMPGetKeyParameter("AutoRoaming", tmpbuf, 32, pBuffer, TRUE)) - { - if (simple_strtol(tmpbuf, 0, 10) == 0) - pAd->StaCfg.bAutoRoaming = FALSE; - else - pAd->StaCfg.bAutoRoaming = TRUE; - - DBGPRINT(RT_DEBUG_TRACE, ("AutoRoaming=%d\n", pAd->StaCfg.bAutoRoaming)); - } - // RoamThreshold - if (RTMPGetKeyParameter("RoamThreshold", tmpbuf, 32, pBuffer, TRUE)) - { - long lInfo = simple_strtol(tmpbuf, 0, 10); - - if (lInfo > 90 || lInfo < 60) - pAd->StaCfg.dBmToRoam = -70; - else - pAd->StaCfg.dBmToRoam = (CHAR)(-1)*lInfo; - - DBGPRINT(RT_DEBUG_TRACE, ("RoamThreshold=%d dBm\n", pAd->StaCfg.dBmToRoam)); - } - - if(RTMPGetKeyParameter("TGnWifiTest", tmpbuf, 10, pBuffer, TRUE)) - { - if(simple_strtol(tmpbuf, 0, 10) == 0) - pAd->StaCfg.bTGnWifiTest = FALSE; - else - pAd->StaCfg.bTGnWifiTest = TRUE; - DBGPRINT(RT_DEBUG_TRACE, ("TGnWifiTest=%d\n", pAd->StaCfg.bTGnWifiTest)); - } - - // Beacon Lost Time - if (RTMPGetKeyParameter("BeaconLostTime", tmpbuf, 32, pBuffer, TRUE)) - { - ULONG lInfo = (ULONG)simple_strtol(tmpbuf, 0, 10); - - if ((lInfo != 0) && (lInfo <= 60)) - pAd->StaCfg.BeaconLostTime = (lInfo * OS_HZ); - DBGPRINT(RT_DEBUG_TRACE, ("BeaconLostTime=%ld \n", pAd->StaCfg.BeaconLostTime)); - } - - - } - - - - - }while(0); - - - kfree(tmpbuf); - - return NDIS_STATUS_SUCCESS; - -} diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h index c43c8eafae4a..d213387d74bd 100644 --- a/drivers/staging/rt2860/rtmp.h +++ b/drivers/staging/rt2860/rtmp.h @@ -2451,17 +2451,6 @@ NDIS_STATUS RTMPAllocAdapterBlock( NDIS_STATUS RTMPAllocTxRxRingMemory( IN PRTMP_ADAPTER pAd); -NDIS_STATUS RTMPSetProfileParameters( - IN RTMP_ADAPTER *pAd, - IN PSTRING pBuffer); - -INT RTMPGetKeyParameter( - IN PSTRING key, - OUT PSTRING dest, - IN INT destsize, - IN PSTRING buffer, - IN BOOLEAN bTrimSpace); - VOID RTMPFreeAdapter( IN PRTMP_ADAPTER pAd); @@ -4628,33 +4617,10 @@ VOID BARecSessionTearDown( BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num); void ba_reordering_resource_release(PRTMP_ADAPTER pAd); - - - -BOOLEAN rtstrmactohex( - IN PSTRING s1, - IN PSTRING s2); - -BOOLEAN rtstrcasecmp( - IN PSTRING s1, - IN PSTRING s2); - -PSTRING rtstrstruncasecmp( - IN PSTRING s1, - IN PSTRING s2); - -PSTRING rtstrstr( - IN const PSTRING s1, - IN const PSTRING s2); - PSTRING rstrtok( IN PSTRING s, IN const PSTRING ct); -int rtinet_aton( - const PSTRING cp, - unsigned int *addr); - ////////// common ioctl functions ////////// INT SetCommonHT( IN PRTMP_ADAPTER pAd); diff --git a/drivers/staging/rt2870/Makefile b/drivers/staging/rt2870/Makefile index 92668eb349e1..523e7e738d00 100644 --- a/drivers/staging/rt2870/Makefile +++ b/drivers/staging/rt2870/Makefile @@ -28,7 +28,6 @@ rt2870sta-objs := \ common/spectrum.o \ common/rtmp_timer.o \ common/rt_channel.o \ - common/cmm_profile.o \ common/cmm_asic.o \ sta/assoc.o \ sta/auth.o \ -- GitLab From 46ff62398cdabb87522c0564d1ebfa397132abe4 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Wed, 21 Oct 2009 22:44:55 +0200 Subject: [PATCH 155/235] Staging: rt28x0: remove dead code from rtmp_phy.h Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/chip/rtmp_phy.h | 28 +------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/drivers/staging/rt2860/chip/rtmp_phy.h b/drivers/staging/rt2860/chip/rtmp_phy.h index e2b90a14bf6c..36f438b82150 100644 --- a/drivers/staging/rt2860/chip/rtmp_phy.h +++ b/drivers/staging/rt2860/chip/rtmp_phy.h @@ -278,18 +278,6 @@ But for some chipset which didn't have mcu (e.g., RBUS based chipset), we will use this function too and didn't access the bbp register via the MCU. */ -#if 0 -#define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \ - do{ \ - if ((_A)->bPCIclkOff == FALSE) \ - { \ - if ((_A)->infType == RTMP_DEV_INF_RBUS) \ - RTMP_BBP_IO_READ8((_A), (_I), (_pV), FALSE); \ - else \ - RTMP_BBP_IO_READ8((_A), (_I), (_pV), TRUE); \ - } \ - }while(0) -#else // Read BBP register by register's ID. Generate PER to test BA #define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \ { \ @@ -381,7 +369,6 @@ *(_pV) = (_A)->BbpWriteLatch[_I]; \ } \ } -#endif // 0 // /* basic marco for BBP write operation. @@ -441,18 +428,6 @@ But for some chipset which didn't have mcu (e.g., RBUS based chipset), we will use this function too and didn't access the bbp register via the MCU. */ -#if 0 -#define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _pV) \ - do{ \ - if ((_A)->bPCIclkOff == FALSE) \ - { \ - if ((_A)->infType == RTMP_DEV_INF_RBUS) \ - RTMP_BBP_IO_WRITE8((_A), (_I), (_pV), FALSE); \ - else \ - RTMP_BBP_IO_WRITE8((_A), (_I), (_pV), TRUE); \ - } \ - }while(0) -#else // Write BBP register by register's ID & value #define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \ { \ @@ -538,9 +513,8 @@ DBGPRINT_ERR(("****** BBP_Write_Latch Buffer exceeds max boundry ****** \n")); \ } \ } -#endif // 0 // - #endif // RTMP_MAC_PCI // + #ifdef RTMP_MAC_USB #define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) RTUSBReadBBPRegister(_A, _I, _pV) #define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) RTUSBWriteBBPRegister(_A, _I, _V) -- GitLab From ef3e746815954ada673fab6545679e7418d1b1d3 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Wed, 21 Oct 2009 22:45:02 +0200 Subject: [PATCH 156/235] Staging: rt28x0: remove unused SHA256 code Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/common/crypt_sha2.c | 257 --------------------- drivers/staging/rt2860/crypt_hmac.h | 11 - drivers/staging/rt2860/crypt_sha2.h | 28 --- 3 files changed, 296 deletions(-) diff --git a/drivers/staging/rt2860/common/crypt_sha2.c b/drivers/staging/rt2860/common/crypt_sha2.c index cb3f7c27b622..d4b23966cb64 100644 --- a/drivers/staging/rt2860/common/crypt_sha2.c +++ b/drivers/staging/rt2860/common/crypt_sha2.c @@ -47,42 +47,7 @@ static const UINT32 SHA1_K[4] = { static const UINT32 SHA1_DefaultHashValue[5] = { 0x67452301UL, 0xefcdab89UL, 0x98badcfeUL, 0x10325476UL, 0xc3d2e1f0UL }; -#endif /* SHA1_SUPPORT */ - - -#ifdef SHA256_SUPPORT -/* SHA256 functions */ -#define Zsigma_256_0(x) (ROTR32(x,2) ^ ROTR32(x,13) ^ ROTR32(x,22)) -#define Zsigma_256_1(x) (ROTR32(x,6) ^ ROTR32(x,11) ^ ROTR32(x,25)) -#define Sigma_256_0(x) (ROTR32(x,7) ^ ROTR32(x,18) ^ SHR(x,3)) -#define Sigma_256_1(x) (ROTR32(x,17) ^ ROTR32(x,19) ^ SHR(x,10)) -/* SHA256 constants */ -static const UINT32 SHA256_K[64] = { - 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, - 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, - 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL, - 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL, - 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL, - 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, - 0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, - 0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL, - 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL, - 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL, - 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, - 0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, - 0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL, - 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL, - 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL, - 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL -}; -static const UINT32 SHA256_DefaultHashValue[8] = { - 0x6a09e667UL, 0xbb67ae85UL, 0x3c6ef372UL, 0xa54ff53aUL, - 0x510e527fUL, 0x9b05688cUL, 0x1f83d9abUL, 0x5be0cd19UL -}; -#endif /* SHA256_SUPPORT */ - -#ifdef SHA1_SUPPORT /* ======================================================================== Routine Description: @@ -310,226 +275,4 @@ VOID RT_SHA1 ( } /* End of RT_SHA1 */ #endif /* SHA1_SUPPORT */ - -#ifdef SHA256_SUPPORT -/* -======================================================================== -Routine Description: - Initial SHA256_CTX_STRUC - -Arguments: - pSHA_CTX Pointer to SHA256_CTX_STRUC - -Return Value: - None - -Note: - None -======================================================================== -*/ -VOID SHA256_Init ( - IN SHA256_CTX_STRUC *pSHA_CTX) -{ - NdisMoveMemory(pSHA_CTX->HashValue, SHA256_DefaultHashValue, - sizeof(SHA256_DefaultHashValue)); - NdisZeroMemory(pSHA_CTX->Block, SHA256_BLOCK_SIZE); - pSHA_CTX->MessageLen = 0; - pSHA_CTX->BlockLen = 0; -} /* End of SHA256_Init */ - - -/* -======================================================================== -Routine Description: - SHA256 computation for one block (512 bits) - -Arguments: - pSHA_CTX Pointer to SHA256_CTX_STRUC - -Return Value: - None - -Note: - None -======================================================================== -*/ -VOID SHA256_Hash ( - IN SHA256_CTX_STRUC *pSHA_CTX) -{ - UINT32 W_i,t; - UINT32 W[64]; - UINT32 a,b,c,d,e,f,g,h,T1,T2; - - /* Prepare the message schedule, {W_i}, 0 < t < 15 */ - NdisMoveMemory(W, pSHA_CTX->Block, SHA256_BLOCK_SIZE); - for (W_i = 0; W_i < 16; W_i++) - W[W_i] = cpu2be32(W[W_i]); /* Endian Swap */ - /* End of for */ - - /* SHA256 hash computation */ - /* Initialize the working variables */ - a = pSHA_CTX->HashValue[0]; - b = pSHA_CTX->HashValue[1]; - c = pSHA_CTX->HashValue[2]; - d = pSHA_CTX->HashValue[3]; - e = pSHA_CTX->HashValue[4]; - f = pSHA_CTX->HashValue[5]; - g = pSHA_CTX->HashValue[6]; - h = pSHA_CTX->HashValue[7]; - - /* 64 rounds */ - for (t = 0;t < 64;t++) { - if (t > 15) /* Prepare the message schedule, {W_i}, 16 < t < 63 */ - W[t] = Sigma_256_1(W[t-2]) + W[t-7] + Sigma_256_0(W[t-15]) + W[t-16]; - /* End of if */ - T1 = h + Zsigma_256_1(e) + Ch(e,f,g) + SHA256_K[t] + W[t]; - T2 = Zsigma_256_0(a) + Maj(a,b,c); - h = g; - g = f; - f = e; - e = d + T1; - d = c; - c = b; - b = a; - a = T1 + T2; - } /* End of for */ - - /* Compute the i^th intermediate hash value H^(i) */ - pSHA_CTX->HashValue[0] += a; - pSHA_CTX->HashValue[1] += b; - pSHA_CTX->HashValue[2] += c; - pSHA_CTX->HashValue[3] += d; - pSHA_CTX->HashValue[4] += e; - pSHA_CTX->HashValue[5] += f; - pSHA_CTX->HashValue[6] += g; - pSHA_CTX->HashValue[7] += h; - - NdisZeroMemory(pSHA_CTX->Block, SHA256_BLOCK_SIZE); - pSHA_CTX->BlockLen = 0; -} /* End of SHA256_Hash */ - - -/* -======================================================================== -Routine Description: - The message is appended to block. If block size > 64 bytes, the SHA256_Hash -will be called. - -Arguments: - pSHA_CTX Pointer to SHA256_CTX_STRUC - message Message context - messageLen The length of message in bytes - -Return Value: - None - -Note: - None -======================================================================== -*/ -VOID SHA256_Append ( - IN SHA256_CTX_STRUC *pSHA_CTX, - IN const UINT8 Message[], - IN UINT MessageLen) -{ - UINT appendLen = 0; - UINT diffLen = 0; - - while (appendLen != MessageLen) { - diffLen = MessageLen - appendLen; - if ((pSHA_CTX->BlockLen + diffLen) < SHA256_BLOCK_SIZE) { - NdisMoveMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, - Message + appendLen, diffLen); - pSHA_CTX->BlockLen += diffLen; - appendLen += diffLen; - } - else - { - NdisMoveMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, - Message + appendLen, SHA256_BLOCK_SIZE - pSHA_CTX->BlockLen); - appendLen += (SHA256_BLOCK_SIZE - pSHA_CTX->BlockLen); - pSHA_CTX->BlockLen = SHA256_BLOCK_SIZE; - SHA256_Hash(pSHA_CTX); - } /* End of if */ - } /* End of while */ - pSHA_CTX->MessageLen += MessageLen; -} /* End of SHA256_Append */ - - -/* -======================================================================== -Routine Description: - 1. Append bit 1 to end of the message - 2. Append the length of message in rightmost 64 bits - 3. Transform the Hash Value to digest message - -Arguments: - pSHA_CTX Pointer to SHA256_CTX_STRUC - -Return Value: - digestMessage Digest message - -Note: - None -======================================================================== -*/ -VOID SHA256_End ( - IN SHA256_CTX_STRUC *pSHA_CTX, - OUT UINT8 DigestMessage[]) -{ - UINT index; - UINT64 message_length_bits; - - /* Append bit 1 to end of the message */ - NdisFillMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, 1, 0x80); - - /* 55 = 64 - 8 - 1: append 1 bit(1 byte) and message length (8 bytes) */ - if (pSHA_CTX->BlockLen > 55) - SHA256_Hash(pSHA_CTX); - /* End of if */ - - /* Append the length of message in rightmost 64 bits */ - message_length_bits = pSHA_CTX->MessageLen*8; - message_length_bits = cpu2be64(message_length_bits); - NdisMoveMemory(&pSHA_CTX->Block[56], &message_length_bits, 8); - SHA256_Hash(pSHA_CTX); - - /* Return message digest, transform the UINT32 hash value to bytes */ - for (index = 0; index < 8;index++) - pSHA_CTX->HashValue[index] = cpu2be32(pSHA_CTX->HashValue[index]); - /* End of for */ - NdisMoveMemory(DigestMessage, pSHA_CTX->HashValue, SHA256_DIGEST_SIZE); -} /* End of SHA256_End */ - - -/* -======================================================================== -Routine Description: - SHA256 algorithm - -Arguments: - message Message context - messageLen The length of message in bytes - -Return Value: - digestMessage Digest message - -Note: - None -======================================================================== -*/ -VOID RT_SHA256 ( - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 DigestMessage[]) -{ - SHA256_CTX_STRUC sha_ctx; - - NdisZeroMemory(&sha_ctx, sizeof(SHA256_CTX_STRUC)); - SHA256_Init(&sha_ctx); - SHA256_Append(&sha_ctx, Message, MessageLen); - SHA256_End(&sha_ctx, DigestMessage); -} /* End of RT_SHA256 */ -#endif /* SHA256_SUPPORT */ - /* End of crypt_sha2.c */ diff --git a/drivers/staging/rt2860/crypt_hmac.h b/drivers/staging/rt2860/crypt_hmac.h index 9314ff7547b5..717b8a26fd12 100644 --- a/drivers/staging/rt2860/crypt_hmac.h +++ b/drivers/staging/rt2860/crypt_hmac.h @@ -57,17 +57,6 @@ VOID HMAC_SHA1 ( IN UINT MACLen); #endif /* SHA1_SUPPORT */ -#ifdef SHA256_SUPPORT -#define HMAC_SHA256_SUPPORT -VOID HMAC_SHA256 ( - IN const UINT8 Key[], - IN UINT KeyLen, - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 MAC[], - IN UINT MACLen); -#endif /* SHA256_SUPPORT */ - #ifdef MD5_SUPPORT #define HMAC_MD5_SUPPORT VOID HMAC_MD5 ( diff --git a/drivers/staging/rt2860/crypt_sha2.h b/drivers/staging/rt2860/crypt_sha2.h index 055efb15a45f..5b95965e4d14 100644 --- a/drivers/staging/rt2860/crypt_sha2.h +++ b/drivers/staging/rt2860/crypt_sha2.h @@ -50,7 +50,6 @@ /* Algorithm options */ #define SHA1_SUPPORT -#define SHA256_SUPPORT #ifdef SHA1_SUPPORT #define SHA1_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ @@ -79,31 +78,4 @@ VOID RT_SHA1 ( OUT UINT8 DigestMessage[]); #endif /* SHA1_SUPPORT */ -#ifdef SHA256_SUPPORT -#define SHA256_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ -#define SHA256_DIGEST_SIZE 32 /* 256 bits = 32 bytes */ -typedef struct _SHA256_CTX_STRUC { - UINT32 HashValue[8]; /* 8 = (SHA256_DIGEST_SIZE / 32) */ - UINT64 MessageLen; /* total size */ - UINT8 Block[SHA256_BLOCK_SIZE]; - UINT BlockLen; -} SHA256_CTX_STRUC, *PSHA256_CTX_STRUC; - -VOID SHA256_Init ( - IN SHA256_CTX_STRUC *pSHA_CTX); -VOID SHA256_Hash ( - IN SHA256_CTX_STRUC *pSHA_CTX); -VOID SHA256_Append ( - IN SHA256_CTX_STRUC *pSHA_CTX, - IN const UINT8 Message[], - IN UINT MessageLen); -VOID SHA256_End ( - IN SHA256_CTX_STRUC *pSHA_CTX, - OUT UINT8 DigestMessage[]); -VOID RT_SHA256 ( - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 DigestMessage[]); -#endif /* SHA256_SUPPORT */ - #endif /* __CRYPT_SHA2_H__ */ -- GitLab From 5a1322317abff17a6cdaf53bd33a4102d456ec23 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Wed, 21 Oct 2009 22:45:09 +0200 Subject: [PATCH 157/235] Staging: rt28x0: remove dead code Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/oid.h | 19 ------------------- drivers/staging/rt2860/rt_config.h | 8 -------- drivers/staging/rt2860/rt_linux.h | 10 ---------- drivers/staging/rt2860/rtmp.h | 13 ------------- drivers/staging/rt2860/rtmp_def.h | 9 --------- 5 files changed, 59 deletions(-) diff --git a/drivers/staging/rt2860/oid.h b/drivers/staging/rt2860/oid.h index a03293cabd87..f3fb5ff74061 100644 --- a/drivers/staging/rt2860/oid.h +++ b/drivers/staging/rt2860/oid.h @@ -502,19 +502,6 @@ typedef struct _NDIS_802_11_AUTHENTICATION_EVENT NDIS_802_11_AUTHENTICATION_REQUEST Request[1]; } NDIS_802_11_AUTHENTICATION_EVENT, *PNDIS_802_11_AUTHENTICATION_EVENT; -/* -typedef struct _NDIS_802_11_TEST -{ - ULONG Length; - ULONG Type; - union - { - NDIS_802_11_AUTHENTICATION_EVENT AuthenticationEvent; - NDIS_802_11_RSSI RssiTrigger; - }; -} NDIS_802_11_TEST, *PNDIS_802_11_TEST; - */ - // 802.11 Media stream constraints, associated with OID_802_11_MEDIA_STREAM_MODE typedef enum _NDIS_802_11_MEDIA_STREAM_MODE { @@ -553,10 +540,6 @@ typedef struct _NDIS_802_11_CAPABILITY NDIS_802_11_AUTHENTICATION_ENCRYPTION AuthenticationEncryptionSupported[1]; } NDIS_802_11_CAPABILITY, *PNDIS_802_11_CAPABILITY; -#ifdef LINUX -#endif // LINUX // - - #define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x01) // Sync. with AP for wsc upnp daemon #define RTPRIV_IOCTL_SET (SIOCIWFIRSTPRIV + 0x02) @@ -593,8 +576,6 @@ enum { #define OID_802_11_GET_COUNTRY_CODE 0x0716 #define OID_802_11_GET_CHANNEL_GEOGRAPHY 0x0717 -//#define RT_OID_802_11_STATISTICS (OID_GET_SET_TOGGLE | OID_802_11_STATISTICS) - #define RT_OID_WSC_SET_PASSPHRASE 0x0740 // passphrase for wpa(2)-psk #define RT_OID_WSC_DRIVER_AUTO_CONNECT 0x0741 #define RT_OID_WSC_QUERY_DEFAULT_PROFILE 0x0742 diff --git a/drivers/staging/rt2860/rt_config.h b/drivers/staging/rt2860/rt_config.h index 67b957b271e9..9e684ae1f4bb 100644 --- a/drivers/staging/rt2860/rt_config.h +++ b/drivers/staging/rt2860/rt_config.h @@ -64,14 +64,6 @@ #include "rtmp_mcu.h" #endif -#undef AP_WSC_INCLUDED -#undef STA_WSC_INCLUDED -#undef WSC_INCLUDED - - - - - #ifdef IGMP_SNOOP_SUPPORT #include "igmp_snoop.h" #endif // IGMP_SNOOP_SUPPORT // diff --git a/drivers/staging/rt2860/rt_linux.h b/drivers/staging/rt2860/rt_linux.h index e8c7d887de1e..d16bcf3bbd39 100644 --- a/drivers/staging/rt2860/rt_linux.h +++ b/drivers/staging/rt2860/rt_linux.h @@ -75,16 +75,6 @@ #include #endif // KTHREAD_SUPPORT // -#undef AP_WSC_INCLUDED -#undef STA_WSC_INCLUDED -#undef WSC_INCLUDED - - - - -#ifdef KTHREAD_SUPPORT -#endif // KTHREAD_SUPPORT // - /*********************************************************************************** * Profile related sections ***********************************************************************************/ diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h index d213387d74bd..2ca1ca68b818 100644 --- a/drivers/staging/rt2860/rtmp.h +++ b/drivers/staging/rt2860/rtmp.h @@ -41,23 +41,10 @@ #define __RTMP_H__ #include "spectrum_def.h" - #include "rtmp_dot11.h" - -#undef AP_WSC_INCLUDED -#undef STA_WSC_INCLUDED -#undef WSC_INCLUDED - - - -#if defined(AP_WSC_INCLUDED) || defined(STA_WSC_INCLUDED) -#define WSC_INCLUDED -#endif - #include "rtmp_chip.h" - typedef struct _RTMP_ADAPTER RTMP_ADAPTER; typedef struct _RTMP_ADAPTER *PRTMP_ADAPTER; diff --git a/drivers/staging/rt2860/rtmp_def.h b/drivers/staging/rt2860/rtmp_def.h index ca700d064a91..816ae6294449 100644 --- a/drivers/staging/rt2860/rtmp_def.h +++ b/drivers/staging/rt2860/rtmp_def.h @@ -41,15 +41,6 @@ #include "oid.h" -#undef AP_WSC_INCLUDED -#undef STA_WSC_INCLUDED -#undef WSC_INCLUDED - - - -#if defined(AP_WSC_INCLUDED) || defined(STA_WSC_INCLUDED) -#define WSC_INCLUDED -#endif // // Debug information verbosity: lower values indicate higher urgency // -- GitLab From 460bb8df1e910a8c5d36ad363fbc1f0164cf0b85 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 11 Dec 2009 12:23:13 -0800 Subject: [PATCH 158/235] Staging: rt28x0: remove __LINE__ instances Remove instances of __LINE__ preprocessor directive to make validation of resulting binary output files easier. Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/common/mlme.c | 7 ++----- drivers/staging/rt2860/common/rtmp_init.c | 3 ++- drivers/staging/rt2860/pci_main_dev.c | 1 - 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rt2860/common/mlme.c b/drivers/staging/rt2860/common/mlme.c index 9fa853eba672..9c250c2b3294 100644 --- a/drivers/staging/rt2860/common/mlme.c +++ b/drivers/staging/rt2860/common/mlme.c @@ -1222,13 +1222,11 @@ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) { - DBGPRINT(RT_DEBUG_TRACE, ("%s::%d\n",__FUNCTION__,__LINE__)); - + DBGPRINT(RT_DEBUG_TRACE, ("%s\n", __func__)); RT28xxPciAsicRadioOff(pAd, GUI_IDLE_POWER_SAVE, 0); } else { - DBGPRINT(RT_DEBUG_TRACE, ("%s::%d\n",__FUNCTION__,__LINE__)); AsicSendCommandToMcu(pAd, 0x30, PowerSafeCID, 0xff, 0x2); // Wait command success AsicCheckCommanOk(pAd, PowerSafeCID); @@ -1240,12 +1238,11 @@ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) { - DBGPRINT(RT_DEBUG_TRACE, ("%s::%d\n",__FUNCTION__,__LINE__)); + DBGPRINT(RT_DEBUG_TRACE, ("%s\n", __func__)); RT28xxPciAsicRadioOff(pAd, GUI_IDLE_POWER_SAVE, 0); } else { - DBGPRINT(RT_DEBUG_TRACE, ("%s::%d\n",__FUNCTION__,__LINE__)); AsicSendCommandToMcu(pAd, 0x30, PowerSafeCID, 0xff, 0x02); // Wait command success AsicCheckCommanOk(pAd, PowerSafeCID); diff --git a/drivers/staging/rt2860/common/rtmp_init.c b/drivers/staging/rt2860/common/rtmp_init.c index 5deba8d698c5..1cc6e44e257e 100644 --- a/drivers/staging/rt2860/common/rtmp_init.c +++ b/drivers/staging/rt2860/common/rtmp_init.c @@ -1261,7 +1261,8 @@ VOID NICInitAsicFromEEPROM( && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) { - DBGPRINT(RT_DEBUG_TRACE,("%s::%d,release Mcu Lock\n",__FUNCTION__,__LINE__)); + DBGPRINT(RT_DEBUG_TRACE, + ("%s, release Mcu Lock\n", __func__)); RTMP_SEM_LOCK(&pAd->McuCmdLock); pAd->brt30xxBanMcuCmd = FALSE; RTMP_SEM_UNLOCK(&pAd->McuCmdLock); diff --git a/drivers/staging/rt2860/pci_main_dev.c b/drivers/staging/rt2860/pci_main_dev.c index 38bc429067e2..2c51d9d4f397 100644 --- a/drivers/staging/rt2860/pci_main_dev.c +++ b/drivers/staging/rt2860/pci_main_dev.c @@ -599,7 +599,6 @@ VOID RTMPInitPCIeLinkCtrlValue( } DBGPRINT(RT_DEBUG_TRACE, ("====> rt28xx Write 0x83 Command = 0x%x.\n", PCIePowerSaveLevel)); - printk("\n\n\n%s:%d\n",__FUNCTION__,__LINE__); AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSaveLevel, 0x00); } -- GitLab From 66cd8d6ec97bbfac53b5e67df9ef4668c3f96085 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 11 Dec 2009 12:23:13 -0800 Subject: [PATCH 159/235] Staging: rt28x0: run *.c files through Lindent Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/chips/rt3070.c | 74 +- drivers/staging/rt2860/chips/rt3090.c | 32 +- drivers/staging/rt2860/chips/rt30xx.c | 273 +- drivers/staging/rt2860/pci_main_dev.c | 1016 +++--- drivers/staging/rt2860/rt_linux.c | 1067 +++--- drivers/staging/rt2860/rt_main_dev.c | 399 ++- drivers/staging/rt2860/rt_pci_rbus.c | 481 ++- drivers/staging/rt2860/rt_usb.c | 649 ++-- drivers/staging/rt2860/sta_ioctl.c | 3437 ++++++++++---------- drivers/staging/rt2860/usb_main_dev.c | 699 ++-- drivers/staging/rt2870/common/rtusb_bulk.c | 896 ++--- drivers/staging/rt2870/common/rtusb_data.c | 173 +- drivers/staging/rt2870/common/rtusb_io.c | 2390 ++++++++------ 13 files changed, 5933 insertions(+), 5653 deletions(-) diff --git a/drivers/staging/rt2860/chips/rt3070.c b/drivers/staging/rt2860/chips/rt3070.c index 5a3e668601ab..eb3b214add26 100644 --- a/drivers/staging/rt2860/chips/rt3070.c +++ b/drivers/staging/rt2860/chips/rt3070.c @@ -39,12 +39,10 @@ #include "../rt_config.h" - #ifndef RTMP_RF_RW_SUPPORT #error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" #endif // RTMP_RF_RW_SUPPORT // - VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd) { INT i; @@ -52,61 +50,55 @@ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd) // Driver must read EEPROM to get RfIcType before initial RF registers // Initialize RF register to default value - if (IS_RT3070(pAd) || IS_RT3071(pAd)) - { + if (IS_RT3070(pAd) || IS_RT3071(pAd)) { // Init RF calibration // Driver should toggle RF R30 bit7 before init RF registers UINT32 RfReg = 0; UINT32 data; - RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg); + RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR) & RfReg); RfReg |= 0x80; - RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); + RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR) RfReg); RTMPusecDelay(1000); RfReg &= 0x7F; - RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); + RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR) RfReg); // Initialize RF register to default value - for (i = 0; i < NUM_RF_REG_PARMS; i++) - { - RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value); + for (i = 0; i < NUM_RF_REG_PARMS; i++) { + RT30xxWriteRFRegister(pAd, + RT30xx_RFRegTable[i].Register, + RT30xx_RFRegTable[i].Value); } // add by johnli - if (IS_RT3070(pAd)) - { + if (IS_RT3070(pAd)) { // // The DAC issue(LDO_CFG0) has been fixed in RT3070(F). // The voltage raising patch is no longer needed for RT3070(F) // - if ((pAd->MACVersion & 0xffff) < 0x0201) - { + if ((pAd->MACVersion & 0xffff) < 0x0201) { // Update MAC 0x05D4 from 01xxxxxx to 0Dxxxxxx (voltage 1.2V to 1.35V) for RT3070 to improve yield rate RTUSBReadMACRegister(pAd, LDO_CFG0, &data); data = ((data & 0xF0FFFFFF) | 0x0D000000); RTUSBWriteMACRegister(pAd, LDO_CFG0, data); } - } - else if (IS_RT3071(pAd)) - { + } else if (IS_RT3071(pAd)) { // Driver should set RF R6 bit6 on before init RF registers - RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RfReg); + RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR) & RfReg); RfReg |= 0x40; - RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg); + RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR) RfReg); // init R31 RT30xxWriteRFRegister(pAd, RF_R31, 0x14); // RT3071 version E has fixed this issue - if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211)) - { + if ((pAd->NicConfig2.field.DACTestBit == 1) + && ((pAd->MACVersion & 0xffff) < 0x0211)) { // patch tx EVM issue temporarily RTUSBReadMACRegister(pAd, LDO_CFG0, &data); data = ((data & 0xE0FFFFFF) | 0x0D000000); RTUSBWriteMACRegister(pAd, LDO_CFG0, data); - } - else - { + } else { RTMP_IO_READ32(pAd, LDO_CFG0, &data); data = ((data & 0xE0FFFFFF) | 0x01000000); RTMP_IO_WRITE32(pAd, LDO_CFG0, data); @@ -117,8 +109,7 @@ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd) data &= ~(0x20); RTUSBWriteMACRegister(pAd, GPIO_SWITCH, data); } - - //For RF filter Calibration + //For RF filter Calibration RTMPFilterCalibration(pAd); // Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration() @@ -126,15 +117,12 @@ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd) // TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F). // Raising RF voltage is no longer needed for RT3070(F) // - if ((IS_RT3070(pAd)) && ((pAd->MACVersion & 0xffff) < 0x0201)) - { + if ((IS_RT3070(pAd)) && ((pAd->MACVersion & 0xffff) < 0x0201)) { RT30xxWriteRFRegister(pAd, RF_R27, 0x3); - } - else if ((IS_RT3071(pAd)) && ((pAd->MACVersion & 0xffff) < 0x0211)) - { + } else if ((IS_RT3071(pAd)) + && ((pAd->MACVersion & 0xffff) < 0x0211)) { RT30xxWriteRFRegister(pAd, RF_R27, 0x3); } - // set led open drain enable RTUSBReadMACRegister(pAd, OPT_14, &data); data |= 0x01; @@ -145,29 +133,25 @@ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd) RT30xxReadRFRegister(pAd, RF_R17, &RFValue); RFValue &= (~0x08); // to fix rx long range issue - if (pAd->NicConfig2.field.ExternalLNAForG == 0) - { - if ((IS_RT3071(pAd) && ((pAd->MACVersion & 0xffff) >= 0x0211)) || IS_RT3070(pAd)) - { + if (pAd->NicConfig2.field.ExternalLNAForG == 0) { + if ((IS_RT3071(pAd) + && ((pAd->MACVersion & 0xffff) >= 0x0211)) + || IS_RT3070(pAd)) { RFValue |= 0x20; } } // set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h - if (pAd->TxMixerGain24G >= 1) - { - RFValue &= (~0x7); // clean bit [2:0] + if (pAd->TxMixerGain24G >= 1) { + RFValue &= (~0x7); // clean bit [2:0] RFValue |= pAd->TxMixerGain24G; } RT30xxWriteRFRegister(pAd, RF_R17, RFValue); - if (IS_RT3071(pAd)) - { + if (IS_RT3071(pAd)) { // add by johnli, RF power sequence setup, load RF normal operation-mode setup RT30xxLoadRFNormalModeSetup(pAd); - } - else if (IS_RT3070(pAd)) - { - /* add by johnli, reset RF_R27 when interface down & up to fix throughput problem*/ + } else if (IS_RT3070(pAd)) { + /* add by johnli, reset RF_R27 when interface down & up to fix throughput problem */ // LDORF_VC, RF R27 register Bit 2 to 0 RT30xxReadRFRegister(pAd, RF_R27, &RFValue); // TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F). diff --git a/drivers/staging/rt2860/chips/rt3090.c b/drivers/staging/rt2860/chips/rt3090.c index 35c549dc4ce1..143529422f89 100644 --- a/drivers/staging/rt2860/chips/rt3090.c +++ b/drivers/staging/rt2860/chips/rt3090.c @@ -39,44 +39,39 @@ #include "../rt_config.h" - #ifndef RTMP_RF_RW_SUPPORT #error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" #endif // RTMP_RF_RW_SUPPORT // - VOID NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd) { - INT i; + INT i; // Driver must read EEPROM to get RfIcType before initial RF registers // Initialize RF register to default value - if (IS_RT3090(pAd)) - { + if (IS_RT3090(pAd)) { // Init RF calibration // Driver should toggle RF R30 bit7 before init RF registers UINT32 RfReg = 0, data; - RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg); + RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR) & RfReg); RfReg |= 0x80; - RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); + RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR) RfReg); RTMPusecDelay(1000); RfReg &= 0x7F; - RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg); + RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR) RfReg); // init R24, R31 RT30xxWriteRFRegister(pAd, RF_R24, 0x0F); RT30xxWriteRFRegister(pAd, RF_R31, 0x0F); // RT309x version E has fixed this issue - if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211)) - { + if ((pAd->NicConfig2.field.DACTestBit == 1) + && ((pAd->MACVersion & 0xffff) < 0x0211)) { // patch tx EVM issue temporarily RTMP_IO_READ32(pAd, LDO_CFG0, &data); data = ((data & 0xE0FFFFFF) | 0x0D000000); RTMP_IO_WRITE32(pAd, LDO_CFG0, data); - } - else - { + } else { RTMP_IO_READ32(pAd, LDO_CFG0, &data); data = ((data & 0xE0FFFFFF) | 0x01000000); RTMP_IO_WRITE32(pAd, LDO_CFG0, data); @@ -88,15 +83,16 @@ VOID NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd) RTMP_IO_WRITE32(pAd, GPIO_SWITCH, data); // Initialize RF register to default value - for (i = 0; i < NUM_RF_REG_PARMS; i++) - { - RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value); + for (i = 0; i < NUM_RF_REG_PARMS; i++) { + RT30xxWriteRFRegister(pAd, + RT30xx_RFRegTable[i].Register, + RT30xx_RFRegTable[i].Value); } // Driver should set RF R6 bit6 on before calibration - RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RfReg); + RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR) & RfReg); RfReg |= 0x40; - RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg); + RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR) RfReg); //For RF filter Calibration RTMPFilterCalibration(pAd); diff --git a/drivers/staging/rt2860/chips/rt30xx.c b/drivers/staging/rt2860/chips/rt30xx.c index c69fab568984..940f731a61c4 100644 --- a/drivers/staging/rt2860/chips/rt30xx.c +++ b/drivers/staging/rt2860/chips/rt30xx.c @@ -35,73 +35,82 @@ -------- ---------- ---------------------------------------------- */ - #ifdef RT30xx - #ifndef RTMP_RF_RW_SUPPORT #error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" #endif // RTMP_RF_RW_SUPPORT // #include "../rt_config.h" - // // RF register initialization set // -REG_PAIR RT30xx_RFRegTable[] = { - {RF_R04, 0x40}, - {RF_R05, 0x03}, - {RF_R06, 0x02}, - {RF_R07, 0x70}, - {RF_R09, 0x0F}, - {RF_R10, 0x41}, - {RF_R11, 0x21}, - {RF_R12, 0x7B}, - {RF_R14, 0x90}, - {RF_R15, 0x58}, - {RF_R16, 0xB3}, - {RF_R17, 0x92}, - {RF_R18, 0x2C}, - {RF_R19, 0x02}, - {RF_R20, 0xBA}, - {RF_R21, 0xDB}, - {RF_R24, 0x16}, - {RF_R25, 0x01}, - {RF_R29, 0x1F}, +REG_PAIR RT30xx_RFRegTable[] = { + {RF_R04, 0x40} + , + {RF_R05, 0x03} + , + {RF_R06, 0x02} + , + {RF_R07, 0x70} + , + {RF_R09, 0x0F} + , + {RF_R10, 0x41} + , + {RF_R11, 0x21} + , + {RF_R12, 0x7B} + , + {RF_R14, 0x90} + , + {RF_R15, 0x58} + , + {RF_R16, 0xB3} + , + {RF_R17, 0x92} + , + {RF_R18, 0x2C} + , + {RF_R19, 0x02} + , + {RF_R20, 0xBA} + , + {RF_R21, 0xDB} + , + {RF_R24, 0x16} + , + {RF_R25, 0x01} + , + {RF_R29, 0x1F} + , }; UCHAR NUM_RF_REG_PARMS = (sizeof(RT30xx_RFRegTable) / sizeof(REG_PAIR)); - - // Antenna divesity use GPIO3 and EESK pin for control // Antenna and EEPROM access are both using EESK pin, // Therefor we should avoid accessing EESK at the same time // Then restore antenna after EEPROM access // The original name of this function is AsicSetRxAnt(), now change to //VOID AsicSetRxAnt( -VOID RT30xxSetRxAnt( - IN PRTMP_ADAPTER pAd, - IN UCHAR Ant) +VOID RT30xxSetRxAnt(IN PRTMP_ADAPTER pAd, IN UCHAR Ant) { - UINT32 Value; + UINT32 Value; #ifdef RTMP_MAC_PCI - UINT32 x; + UINT32 x; #endif if ((pAd->EepromAccess) || - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) || - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) || - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) || - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) - { + (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) || + (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) || + (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) || + (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) { return; } - // the antenna selection is through firmware and MAC register(GPIO3) - if (Ant == 0) - { + if (Ant == 0) { // Main antenna #ifdef RTMP_MAC_PCI RTMP_IO_READ32(pAd, E2PROM_CSR, &x); @@ -114,10 +123,9 @@ VOID RT30xxSetRxAnt( RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value); Value &= ~(0x0808); RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to main antenna\n")); - } - else - { + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("AsicSetRxAnt, switch to main antenna\n")); + } else { // Aux antenna #ifdef RTMP_MAC_PCI RTMP_IO_READ32(pAd, E2PROM_CSR, &x); @@ -130,11 +138,11 @@ VOID RT30xxSetRxAnt( Value &= ~(0x0808); Value |= 0x08; RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to aux antenna\n")); + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("AsicSetRxAnt, switch to aux antenna\n")); } } - /* ======================================================================== @@ -151,46 +159,43 @@ VOID RT30xxSetRxAnt( ======================================================================== */ -VOID RTMPFilterCalibration( - IN PRTMP_ADAPTER pAd) +VOID RTMPFilterCalibration(IN PRTMP_ADAPTER pAd) { - UCHAR R55x = 0, value, FilterTarget = 0x1E, BBPValue=0; - UINT loop = 0, count = 0, loopcnt = 0, ReTry = 0; - UCHAR RF_R24_Value = 0; + UCHAR R55x = 0, value, FilterTarget = 0x1E, BBPValue = 0; + UINT loop = 0, count = 0, loopcnt = 0, ReTry = 0; + UCHAR RF_R24_Value = 0; // Give bbp filter initial value pAd->Mlme.CaliBW20RfR24 = 0x1F; - pAd->Mlme.CaliBW40RfR24 = 0x2F; //Bit[5] must be 1 for BW 40 + pAd->Mlme.CaliBW40RfR24 = 0x2F; //Bit[5] must be 1 for BW 40 - do - { + do { if (loop == 1) //BandWidth = 40 MHz { // Write 0x27 to RF_R24 to program filter RF_R24_Value = 0x27; RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - if (IS_RT3090(pAd) || IS_RT3572(pAd)|| IS_RT3390(pAd)) + if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) FilterTarget = 0x15; else FilterTarget = 0x19; // when calibrate BW40, BBP mask must set to BW40. RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue&= (~0x18); - BBPValue|= (0x10); + BBPValue &= (~0x18); + BBPValue |= (0x10); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); // set to BW40 RT30xxReadRFRegister(pAd, RF_R31, &value); value |= 0x20; RT30xxWriteRFRegister(pAd, RF_R31, value); - } - else //BandWidth = 20 MHz + } else //BandWidth = 20 MHz { // Write 0x07 to RF_R24 to program filter RF_R24_Value = 0x07; RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - if (IS_RT3090(pAd) || IS_RT3572(pAd)|| IS_RT3390(pAd)) + if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) FilterTarget = 0x13; else FilterTarget = 0x16; @@ -209,8 +214,7 @@ VOID RTMPFilterCalibration( // Write 0x00 to BBP_R24 to set power & frequency of passband test tone RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0); - do - { + do { // Write 0x90 to BBP_R25 to transmit test tone RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90); @@ -224,8 +228,7 @@ VOID RTMPFilterCalibration( // Write 0x06 to BBP_R24 to set power & frequency of stopband test tone RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0x06); - while(TRUE) - { + while (TRUE) { // Write 0x90 to BBP_R25 to transmit test tone RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90); @@ -233,59 +236,47 @@ VOID RTMPFilterCalibration( RTMPusecDelay(1000); RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value); value &= 0xFF; - if ((R55x - value) < FilterTarget) - { - RF_R24_Value ++; - } - else if ((R55x - value) == FilterTarget) - { - RF_R24_Value ++; - count ++; - } - else - { + if ((R55x - value) < FilterTarget) { + RF_R24_Value++; + } else if ((R55x - value) == FilterTarget) { + RF_R24_Value++; + count++; + } else { break; } // prevent infinite loop cause driver hang. - if (loopcnt++ > 100) - { - DBGPRINT(RT_DEBUG_ERROR, ("RTMPFilterCalibration - can't find a valid value, loopcnt=%d stop calibrating", loopcnt)); + if (loopcnt++ > 100) { + DBGPRINT(RT_DEBUG_ERROR, + ("RTMPFilterCalibration - can't find a valid value, loopcnt=%d stop calibrating", + loopcnt)); break; } - // Write RF_R24 to program filter RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); } - if (count > 0) - { + if (count > 0) { RF_R24_Value = RF_R24_Value - ((count) ? (1) : (0)); } - // Store for future usage - if (loopcnt < 100) - { - if (loop++ == 0) - { + if (loopcnt < 100) { + if (loop++ == 0) { //BandWidth = 20 MHz - pAd->Mlme.CaliBW20RfR24 = (UCHAR)RF_R24_Value; - } - else - { + pAd->Mlme.CaliBW20RfR24 = (UCHAR) RF_R24_Value; + } else { //BandWidth = 40 MHz - pAd->Mlme.CaliBW40RfR24 = (UCHAR)RF_R24_Value; + pAd->Mlme.CaliBW40RfR24 = (UCHAR) RF_R24_Value; break; } - } - else + } else break; RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); // reset count count = 0; - } while(TRUE); + } while (TRUE); // // Set back to initial state @@ -298,13 +289,14 @@ VOID RTMPFilterCalibration( // set BBP back to BW20 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); - BBPValue&= (~0x18); + BBPValue &= (~0x18); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - DBGPRINT(RT_DEBUG_TRACE, ("RTMPFilterCalibration - CaliBW20RfR24=0x%x, CaliBW40RfR24=0x%x\n", pAd->Mlme.CaliBW20RfR24, pAd->Mlme.CaliBW40RfR24)); + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPFilterCalibration - CaliBW20RfR24=0x%x, CaliBW40RfR24=0x%x\n", + pAd->Mlme.CaliBW20RfR24, pAd->Mlme.CaliBW40RfR24)); } - // add by johnli, RF power sequence setup /* ========================================================================== @@ -314,8 +306,7 @@ VOID RTMPFilterCalibration( ========================================================================== */ -VOID RT30xxLoadRFNormalModeSetup( - IN PRTMP_ADAPTER pAd) +VOID RT30xxLoadRFNormalModeSetup(IN PRTMP_ADAPTER pAd) { UCHAR RFValue; @@ -330,22 +321,22 @@ VOID RT30xxLoadRFNormalModeSetup( RT30xxWriteRFRegister(pAd, RF_R15, RFValue); /* move to NICInitRT30xxRFRegisters - // TX_LO1_en, RF R17 register Bit 3 to 0 - RT30xxReadRFRegister(pAd, RF_R17, &RFValue); - RFValue &= (~0x08); - // to fix rx long range issue - if (((pAd->MACVersion & 0xffff) >= 0x0211) && (pAd->NicConfig2.field.ExternalLNAForG == 0)) - { - RFValue |= 0x20; - } - // set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h - if (pAd->TxMixerGain24G >= 2) - { - RFValue &= (~0x7); // clean bit [2:0] - RFValue |= pAd->TxMixerGain24G; - } - RT30xxWriteRFRegister(pAd, RF_R17, RFValue); - */ + // TX_LO1_en, RF R17 register Bit 3 to 0 + RT30xxReadRFRegister(pAd, RF_R17, &RFValue); + RFValue &= (~0x08); + // to fix rx long range issue + if (((pAd->MACVersion & 0xffff) >= 0x0211) && (pAd->NicConfig2.field.ExternalLNAForG == 0)) + { + RFValue |= 0x20; + } + // set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h + if (pAd->TxMixerGain24G >= 2) + { + RFValue &= (~0x7); // clean bit [2:0] + RFValue |= pAd->TxMixerGain24G; + } + RT30xxWriteRFRegister(pAd, RF_R17, RFValue); + */ // RX_LO1_en, RF R20 register Bit 3 to 0 RT30xxReadRFRegister(pAd, RF_R20, &RFValue); @@ -357,7 +348,7 @@ VOID RT30xxLoadRFNormalModeSetup( RFValue &= (~0x08); RT30xxWriteRFRegister(pAd, RF_R21, RFValue); - /* add by johnli, reset RF_R27 when interface down & up to fix throughput problem*/ + /* add by johnli, reset RF_R27 when interface down & up to fix throughput problem */ // LDORF_VC, RF R27 register Bit 2 to 0 RT30xxReadRFRegister(pAd, RF_R27, &RFValue); // TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F). @@ -381,15 +372,13 @@ VOID RT30xxLoadRFNormalModeSetup( ========================================================================== */ -VOID RT30xxLoadRFSleepModeSetup( - IN PRTMP_ADAPTER pAd) +VOID RT30xxLoadRFSleepModeSetup(IN PRTMP_ADAPTER pAd) { UCHAR RFValue; UINT32 MACValue; - #ifdef RTMP_MAC_USB - if(!IS_RT3572(pAd)) + if (!IS_RT3572(pAd)) #endif // RTMP_MAC_USB // { // RF_BLOCK_en. RF R1 register Bit 0 to 0 @@ -414,9 +403,8 @@ VOID RT30xxLoadRFSleepModeSetup( } if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72 - IS_RT3572(pAd) || - (IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) - { + IS_RT3572(pAd) || + (IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) { #ifdef RTMP_MAC_USB if (!IS_RT3572(pAd)) #endif // RTMP_MAC_USB // @@ -440,14 +428,13 @@ VOID RT30xxLoadRFSleepModeSetup( ========================================================================== */ -VOID RT30xxReverseRFSleepModeSetup( - IN PRTMP_ADAPTER pAd) +VOID RT30xxReverseRFSleepModeSetup(IN PRTMP_ADAPTER pAd) { UCHAR RFValue; UINT32 MACValue; #ifdef RTMP_MAC_USB - if(!IS_RT3572(pAd)) + if (!IS_RT3572(pAd)) #endif // RTMP_MAC_USB // { // RF_BLOCK_en, RF R1 register Bit 0 to 1 @@ -472,10 +459,9 @@ VOID RT30xxReverseRFSleepModeSetup( } if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72 - IS_RT3572(pAd) || - IS_RT3390(pAd) || - (IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) - { + IS_RT3572(pAd) || + IS_RT3390(pAd) || + (IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) { #ifdef RTMP_MAC_USB if (!IS_RT3572(pAd)) #endif // RTMP_MAC_USB // @@ -487,48 +473,41 @@ VOID RT30xxReverseRFSleepModeSetup( RFValue = (RFValue & (~0x77)); RT30xxWriteRFRegister(pAd, RF_R27, RFValue); } - // RT3071 version E has fixed this issue - if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211)) - { + if ((pAd->NicConfig2.field.DACTestBit == 1) + && ((pAd->MACVersion & 0xffff) < 0x0211)) { // patch tx EVM issue temporarily RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue); MACValue = ((MACValue & 0xE0FFFFFF) | 0x0D000000); RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue); - } - else - { + } else { RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue); MACValue = ((MACValue & 0xE0FFFFFF) | 0x01000000); RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue); } } - if(IS_RT3572(pAd)) + if (IS_RT3572(pAd)) RT30xxWriteRFRegister(pAd, RF_R08, 0x80); } + // end johnli -VOID RT30xxHaltAction( - IN PRTMP_ADAPTER pAd) +VOID RT30xxHaltAction(IN PRTMP_ADAPTER pAd) { - UINT32 TxPinCfg = 0x00050F0F; + UINT32 TxPinCfg = 0x00050F0F; // // Turn off LNA_PE or TRSW_POL // - if (IS_RT3070(pAd) || IS_RT3071(pAd) || IS_RT3572(pAd)) - { + if (IS_RT3070(pAd) || IS_RT3071(pAd) || IS_RT3572(pAd)) { if ((IS_RT3071(pAd) || IS_RT3572(pAd)) #ifdef RTMP_EFUSE_SUPPORT - && (pAd->bUseEfuse) + && (pAd->bUseEfuse) #endif // RTMP_EFUSE_SUPPORT // - ) - { - TxPinCfg &= 0xFFFBF0F0; // bit18 off - } - else - { + ) { + TxPinCfg &= 0xFFFBF0F0; // bit18 off + } else { TxPinCfg &= 0xFFFFF0F0; } diff --git a/drivers/staging/rt2860/pci_main_dev.c b/drivers/staging/rt2860/pci_main_dev.c index 2c51d9d4f397..2a22e458ae00 100644 --- a/drivers/staging/rt2860/pci_main_dev.c +++ b/drivers/staging/rt2860/pci_main_dev.c @@ -53,13 +53,13 @@ extern int rt28xx_close(IN struct net_device *net_dev); extern int rt28xx_open(struct net_device *net_dev); static VOID __devexit rt2860_remove_one(struct pci_dev *pci_dev); -static INT __devinit rt2860_probe(struct pci_dev *pci_dev, const struct pci_device_id *ent); +static INT __devinit rt2860_probe(struct pci_dev *pci_dev, + const struct pci_device_id *ent); static void __exit rt2860_cleanup_module(void); static int __init rt2860_init_module(void); - static VOID RTMPInitPCIeDevice( - IN struct pci_dev *pci_dev, - IN PRTMP_ADAPTER pAd); +static VOID RTMPInitPCIeDevice(IN struct pci_dev *pci_dev, + IN PRTMP_ADAPTER pAd); #ifdef CONFIG_PM static int rt2860_suspend(struct pci_dev *pci_dev, pm_message_t state); @@ -69,10 +69,9 @@ static int rt2860_resume(struct pci_dev *pci_dev); // // Ralink PCI device table, include all supported chipsets // -static struct pci_device_id rt2860_pci_tbl[] __devinitdata = -{ +static struct pci_device_id rt2860_pci_tbl[] __devinitdata = { #ifdef RT2860 - {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2860_PCI_DEVICE_ID)}, //RT28602.4G + {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2860_PCI_DEVICE_ID)}, //RT28602.4G {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2860_PCIe_DEVICE_ID)}, {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2760_PCI_DEVICE_ID)}, {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2790_PCIe_DEVICE_ID)}, @@ -95,7 +94,7 @@ static struct pci_device_id rt2860_pci_tbl[] __devinitdata = {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3391_PCIe_DEVICE_ID)}, {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3392_PCIe_DEVICE_ID)}, #endif // RT3390 // - {0,} // terminate list + {0,} // terminate list }; MODULE_DEVICE_TABLE(pci, rt2860_pci_tbl); @@ -103,23 +102,20 @@ MODULE_DEVICE_TABLE(pci, rt2860_pci_tbl); MODULE_VERSION(STA_DRIVER_VERSION); #endif - // // Our PCI driver structure // -static struct pci_driver rt2860_driver = -{ - name: "rt2860", - id_table: rt2860_pci_tbl, - probe: rt2860_probe, - remove: __devexit_p(rt2860_remove_one), +static struct pci_driver rt2860_driver = { +name: "rt2860", +id_table:rt2860_pci_tbl, +probe: rt2860_probe, +remove:__devexit_p(rt2860_remove_one), #ifdef CONFIG_PM - suspend: rt2860_suspend, - resume: rt2860_resume, +suspend:rt2860_suspend, +resume:rt2860_resume, #endif }; - /*************************************************************************** * * PCI device initialization related procedures. @@ -127,37 +123,29 @@ static struct pci_driver rt2860_driver = ***************************************************************************/ #ifdef CONFIG_PM -VOID RT2860RejectPendingPackets( - IN PRTMP_ADAPTER pAd) +VOID RT2860RejectPendingPackets(IN PRTMP_ADAPTER pAd) { // clear PS packets // clear TxSw packets } -static int rt2860_suspend( - struct pci_dev *pci_dev, - pm_message_t state) +static int rt2860_suspend(struct pci_dev *pci_dev, pm_message_t state) { struct net_device *net_dev = pci_get_drvdata(pci_dev); - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)NULL; + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) NULL; INT32 retval = 0; - DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_suspend()\n")); - if (net_dev == NULL) - { + if (net_dev == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("net_dev == NULL!\n")); - } - else - { + } else { GET_PAD_FROM_NET_DEV(pAd, net_dev); /* we can not use IFF_UP because ra0 down but ra1 up */ /* and 1 suspend/resume function for 1 module, not for each interface */ /* so Linux will call suspend/resume function once */ - if (VIRTUAL_IF_NUM(pAd) > 0) - { + if (VIRTUAL_IF_NUM(pAd) > 0) { // avoid users do suspend after interface is down // stop interface @@ -172,7 +160,7 @@ static int rt2860_suspend( RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); // take down the device - rt28xx_close((PNET_DEV)net_dev); + rt28xx_close((PNET_DEV) net_dev); RT_MOD_DEC_USE_COUNT(); } @@ -193,14 +181,12 @@ static int rt2860_suspend( return retval; } -static int rt2860_resume( - struct pci_dev *pci_dev) +static int rt2860_resume(struct pci_dev *pci_dev) { struct net_device *net_dev = pci_get_drvdata(pci_dev); - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)NULL; + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) NULL; INT32 retval; - // set the power state of a PCI device // PCI has 4 power states, DO (normal) ~ D3(less power) // in include/linux/pci.h, you can find that @@ -217,38 +203,32 @@ static int rt2860_resume( pci_restore_state(pci_dev); // initialize device before it's used by a driver - if (pci_enable_device(pci_dev)) - { + if (pci_enable_device(pci_dev)) { printk("pci enable fail!\n"); return 0; } DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_resume()\n")); - if (net_dev == NULL) - { + if (net_dev == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("net_dev == NULL!\n")); - } - else + } else GET_PAD_FROM_NET_DEV(pAd, net_dev); - if (pAd != NULL) - { + if (pAd != NULL) { /* we can not use IFF_UP because ra0 down but ra1 up */ /* and 1 suspend/resume function for 1 module, not for each interface */ /* so Linux will call suspend/resume function once */ - if (VIRTUAL_IF_NUM(pAd) > 0) - { + if (VIRTUAL_IF_NUM(pAd) > 0) { // mark device as attached from system and restart if needed netif_device_attach(net_dev); - if (rt28xx_open((PNET_DEV)net_dev) != 0) - { + if (rt28xx_open((PNET_DEV) net_dev) != 0) { // open fail - DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_resume()\n")); + DBGPRINT(RT_DEBUG_TRACE, + ("<=== rt2860_resume()\n")); return 0; } - // increase MODULE use count RT_MOD_INC_USE_COUNT(); @@ -266,113 +246,111 @@ static int rt2860_resume( } #endif // CONFIG_PM // - static INT __init rt2860_init_module(VOID) { return pci_register_driver(&rt2860_driver); } - // // Driver module unload function // static VOID __exit rt2860_cleanup_module(VOID) { - pci_unregister_driver(&rt2860_driver); + pci_unregister_driver(&rt2860_driver); } module_init(rt2860_init_module); module_exit(rt2860_cleanup_module); - // // PCI device probe & initialization function // -static INT __devinit rt2860_probe( - IN struct pci_dev *pci_dev, - IN const struct pci_device_id *pci_id) +static INT __devinit rt2860_probe(IN struct pci_dev *pci_dev, + IN const struct pci_device_id *pci_id) { - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)NULL; - struct net_device *net_dev; - PVOID handle; - PSTRING print_name; - ULONG csr_addr; + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) NULL; + struct net_device *net_dev; + PVOID handle; + PSTRING print_name; + ULONG csr_addr; INT rv = 0; - RTMP_OS_NETDEV_OP_HOOK netDevHook; + RTMP_OS_NETDEV_OP_HOOK netDevHook; DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_probe\n")); //PCIDevInit============================================== // wake up and enable device - if ((rv = pci_enable_device(pci_dev))!= 0) - { - DBGPRINT(RT_DEBUG_ERROR, ("Enable PCI device failed, errno=%d!\n", rv)); + if ((rv = pci_enable_device(pci_dev)) != 0) { + DBGPRINT(RT_DEBUG_ERROR, + ("Enable PCI device failed, errno=%d!\n", rv)); return rv; } - print_name = (PSTRING)pci_name(pci_dev); + print_name = (PSTRING) pci_name(pci_dev); - if ((rv = pci_request_regions(pci_dev, print_name)) != 0) - { - DBGPRINT(RT_DEBUG_ERROR, ("Request PCI resource failed, errno=%d!\n", rv)); + if ((rv = pci_request_regions(pci_dev, print_name)) != 0) { + DBGPRINT(RT_DEBUG_ERROR, + ("Request PCI resource failed, errno=%d!\n", rv)); goto err_out; } - // map physical address to virtual address for accessing register - csr_addr = (unsigned long) ioremap(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); - if (!csr_addr) - { - DBGPRINT(RT_DEBUG_ERROR, ("ioremap failed for device %s, region 0x%lX @ 0x%lX\n", - print_name, (ULONG)pci_resource_len(pci_dev, 0), (ULONG)pci_resource_start(pci_dev, 0))); + csr_addr = + (unsigned long)ioremap(pci_resource_start(pci_dev, 0), + pci_resource_len(pci_dev, 0)); + if (!csr_addr) { + DBGPRINT(RT_DEBUG_ERROR, + ("ioremap failed for device %s, region 0x%lX @ 0x%lX\n", + print_name, (ULONG) pci_resource_len(pci_dev, 0), + (ULONG) pci_resource_start(pci_dev, 0))); goto err_out_free_res; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("%s: at 0x%lx, VA 0x%lx, IRQ %d. \n", print_name, - (ULONG)pci_resource_start(pci_dev, 0), (ULONG)csr_addr, pci_dev->irq)); + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("%s: at 0x%lx, VA 0x%lx, IRQ %d. \n", print_name, + (ULONG) pci_resource_start(pci_dev, 0), + (ULONG) csr_addr, pci_dev->irq)); } // Set DMA master pci_set_master(pci_dev); - //RtmpDevInit============================================== // Allocate RTMP_ADAPTER adapter structure handle = kmalloc(sizeof(struct os_cookie), GFP_KERNEL); - if (handle == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s(): Allocate memory for os handle failed!\n", __func__)); + if (handle == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s(): Allocate memory for os handle failed!\n", + __func__)); goto err_out_iounmap; } - ((POS_COOKIE)handle)->pci_dev = pci_dev; + ((POS_COOKIE) handle)->pci_dev = pci_dev; rv = RTMPAllocAdapterBlock(handle, &pAd); //shiang: we may need the pci_dev for allocate structure of "RTMP_ADAPTER" if (rv != NDIS_STATUS_SUCCESS) goto err_out_iounmap; // Here are the RTMP_ADAPTER structure with pci-bus specific parameters. - pAd->CSRBaseAddress = (PUCHAR)csr_addr; - DBGPRINT(RT_DEBUG_ERROR, ("pAd->CSRBaseAddress =0x%lx, csr_addr=0x%lx!\n", (ULONG)pAd->CSRBaseAddress, csr_addr)); + pAd->CSRBaseAddress = (PUCHAR) csr_addr; + DBGPRINT(RT_DEBUG_ERROR, + ("pAd->CSRBaseAddress =0x%lx, csr_addr=0x%lx!\n", + (ULONG) pAd->CSRBaseAddress, csr_addr)); RtmpRaDevCtrlInit(pAd, RTMP_DEV_INF_PCI); - //NetDevInit============================================== net_dev = RtmpPhyNetDevInit(pAd, &netDevHook); if (net_dev == NULL) goto err_out_free_radev; // Here are the net_device structure with pci-bus specific parameters. - net_dev->irq = pci_dev->irq; // Interrupt IRQ number - net_dev->base_addr = csr_addr; // Save CSR virtual address and irq to device structure + net_dev->irq = pci_dev->irq; // Interrupt IRQ number + net_dev->base_addr = csr_addr; // Save CSR virtual address and irq to device structure pci_set_drvdata(pci_dev, net_dev); // Set driver data /* for supporting Network Manager */ /* Set the sysfs physical device reference for the network logical device - * if set prior to registration will cause a symlink during initialization. + * if set prior to registration will cause a symlink during initialization. */ SET_NETDEV_DEV(net_dev, &(pci_dev->dev)); - //All done, it's time to register the net device to linux kernel. // Register this device rv = RtmpOSNetDevAttach(net_dev, &netDevHook); @@ -384,20 +362,20 @@ static INT __devinit rt2860_probe( DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_probe\n")); - return 0; // probe ok - + return 0; // probe ok /* --------------------------- ERROR HANDLE --------------------------- */ err_out_free_netdev: RtmpOSNetDevFree(net_dev); err_out_free_radev: - /* free RTMP_ADAPTER strcuture and os_cookie*/ + /* free RTMP_ADAPTER strcuture and os_cookie */ RTMPFreeAdapter(pAd); err_out_iounmap: iounmap((void *)(csr_addr)); - release_mem_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); + release_mem_region(pci_resource_start(pci_dev, 0), + pci_resource_len(pci_dev, 0)); err_out_free_res: pci_release_regions(pci_dev); @@ -405,25 +383,23 @@ err_out_free_res: err_out: pci_disable_device(pci_dev); - DBGPRINT(RT_DEBUG_ERROR, ("<=== rt2860_probe failed with rv = %d!\n", rv)); + DBGPRINT(RT_DEBUG_ERROR, + ("<=== rt2860_probe failed with rv = %d!\n", rv)); - return -ENODEV; /* probe fail */ + return -ENODEV; /* probe fail */ } - -static VOID __devexit rt2860_remove_one( - IN struct pci_dev *pci_dev) +static VOID __devexit rt2860_remove_one(IN struct pci_dev *pci_dev) { - PNET_DEV net_dev = pci_get_drvdata(pci_dev); - RTMP_ADAPTER *pAd = NULL; - ULONG csr_addr = net_dev->base_addr; // pAd->CSRBaseAddress; + PNET_DEV net_dev = pci_get_drvdata(pci_dev); + RTMP_ADAPTER *pAd = NULL; + ULONG csr_addr = net_dev->base_addr; // pAd->CSRBaseAddress; GET_PAD_FROM_NET_DEV(pAd, net_dev); - DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_remove_one\n")); + DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_remove_one\n")); - if (pAd != NULL) - { + if (pAd != NULL) { // Unregister/Free all allocated net_device. RtmpPhyNetDevExit(pAd, net_dev); @@ -431,14 +407,13 @@ static VOID __devexit rt2860_remove_one( iounmap((char *)(csr_addr)); // release memory region - release_mem_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); + release_mem_region(pci_resource_start(pci_dev, 0), + pci_resource_len(pci_dev, 0)); // Free RTMP_ADAPTER related structures. RtmpRaDevCtrlExit(pAd); - } - else - { + } else { // Unregister network device RtmpOSNetDevDetach(net_dev); @@ -446,7 +421,8 @@ static VOID __devexit rt2860_remove_one( iounmap((char *)(net_dev->base_addr)); // release memory region - release_mem_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); + release_mem_region(pci_resource_start(pci_dev, 0), + pci_resource_len(pci_dev, 0)); } // Free the root net_device @@ -454,7 +430,6 @@ static VOID __devexit rt2860_remove_one( } - /* ======================================================================== Routine Description: @@ -470,24 +445,20 @@ Return Value: Note: ======================================================================== */ -BOOLEAN RT28XXChipsetCheck( - IN void *_dev_p) +BOOLEAN RT28XXChipsetCheck(IN void *_dev_p) { /* always TRUE */ return TRUE; } - /*************************************************************************** * * PCIe device initialization related procedures. * ***************************************************************************/ - static VOID RTMPInitPCIeDevice( - IN struct pci_dev *pci_dev, - IN PRTMP_ADAPTER pAd) +static VOID RTMPInitPCIeDevice(IN struct pci_dev *pci_dev, IN PRTMP_ADAPTER pAd) { - USHORT device_id; + USHORT device_id; POS_COOKIE pObj; pObj = (POS_COOKIE) pAd->OS_Cookie; @@ -496,20 +467,18 @@ BOOLEAN RT28XXChipsetCheck( pObj->DeviceID = device_id; if ( #ifdef RT2860 - (device_id == NIC2860_PCIe_DEVICE_ID) || - (device_id == NIC2790_PCIe_DEVICE_ID) || - (device_id == VEN_AWT_PCIe_DEVICE_ID) || + (device_id == NIC2860_PCIe_DEVICE_ID) || + (device_id == NIC2790_PCIe_DEVICE_ID) || + (device_id == VEN_AWT_PCIe_DEVICE_ID) || #endif #ifdef RT3090 - (device_id == NIC3090_PCIe_DEVICE_ID) || - (device_id == NIC3091_PCIe_DEVICE_ID) || - (device_id == NIC3092_PCIe_DEVICE_ID) || + (device_id == NIC3090_PCIe_DEVICE_ID) || + (device_id == NIC3091_PCIe_DEVICE_ID) || + (device_id == NIC3092_PCIe_DEVICE_ID) || #endif // RT3090 // - 0) - { - UINT32 MacCsr0 = 0, Index= 0; - do - { + 0) { + UINT32 MacCsr0 = 0, Index = 0; + do { RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0); if ((MacCsr0 != 0x00) && (MacCsr0 != 0xFFFFFFFF)) @@ -520,21 +489,18 @@ BOOLEAN RT28XXChipsetCheck( // Support advanced power save after 2892/2790. // MAC version at offset 0x1000 is 0x2872XXXX/0x2870XXXX(PCIe, USB, SDIO). - if ((MacCsr0&0xffff0000) != 0x28600000) - { + if ((MacCsr0 & 0xffff0000) != 0x28600000) { OPSTATUS_SET_FLAG(pAd, fOP_STATUS_PCIE_DEVICE); } } } - -VOID RTMPInitPCIeLinkCtrlValue( - IN PRTMP_ADAPTER pAd) +VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) { - INT pos; - USHORT reg16, data2, PCIePowerSaveLevel, Configuration; + INT pos; + USHORT reg16, data2, PCIePowerSaveLevel, Configuration; UINT32 MacValue; - BOOLEAN bFindIntel = FALSE; + BOOLEAN bFindIntel = FALSE; POS_COOKIE pObj; pObj = (POS_COOKIE) pAd->OS_Cookie; @@ -542,79 +508,83 @@ VOID RTMPInitPCIeLinkCtrlValue( if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) return; - DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __func__)); + DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __func__)); // Init EEPROM, and save settings - if (!(IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) - { + if (!(IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) { RT28xx_EEPROM_READ16(pAd, 0x22, PCIePowerSaveLevel); pAd->PCIePowerSaveLevel = PCIePowerSaveLevel & 0xff; pAd->LnkCtrlBitMask = 0; - if ((PCIePowerSaveLevel&0xff) == 0xff) - { + if ((PCIePowerSaveLevel & 0xff) == 0xff) { OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_PCIE_DEVICE); - DBGPRINT(RT_DEBUG_TRACE, ("====> PCIePowerSaveLevel = 0x%x.\n", PCIePowerSaveLevel)); + DBGPRINT(RT_DEBUG_TRACE, + ("====> PCIePowerSaveLevel = 0x%x.\n", + PCIePowerSaveLevel)); return; - } - else - { - PCIePowerSaveLevel &= 0x3; - RT28xx_EEPROM_READ16(pAd, 0x24, data2); + } else { + PCIePowerSaveLevel &= 0x3; + RT28xx_EEPROM_READ16(pAd, 0x24, data2); - if( !(((data2&0xff00) == 0x9200) && ((data2&0x80) !=0)) ) - { - if (PCIePowerSaveLevel > 1 ) - PCIePowerSaveLevel = 1; - } + if (! + (((data2 & 0xff00) == 0x9200) + && ((data2 & 0x80) != 0))) { + if (PCIePowerSaveLevel > 1) + PCIePowerSaveLevel = 1; + } - DBGPRINT(RT_DEBUG_TRACE, ("====> Write 0x83 = 0x%x.\n", PCIePowerSaveLevel)); - AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSaveLevel, 0x00); - RT28xx_EEPROM_READ16(pAd, 0x22, PCIePowerSaveLevel); - PCIePowerSaveLevel &= 0xff; - PCIePowerSaveLevel = PCIePowerSaveLevel >> 6; - switch(PCIePowerSaveLevel) - { - case 0: // Only support L0 - pAd->LnkCtrlBitMask = 0; + DBGPRINT(RT_DEBUG_TRACE, + ("====> Write 0x83 = 0x%x.\n", + PCIePowerSaveLevel)); + AsicSendCommandToMcu(pAd, 0x83, 0xff, + (UCHAR) PCIePowerSaveLevel, 0x00); + RT28xx_EEPROM_READ16(pAd, 0x22, PCIePowerSaveLevel); + PCIePowerSaveLevel &= 0xff; + PCIePowerSaveLevel = PCIePowerSaveLevel >> 6; + switch (PCIePowerSaveLevel) { + case 0: // Only support L0 + pAd->LnkCtrlBitMask = 0; break; - case 1: // Only enable L0s - pAd->LnkCtrlBitMask = 1; + case 1: // Only enable L0s + pAd->LnkCtrlBitMask = 1; break; - case 2: // enable L1, L0s - pAd->LnkCtrlBitMask = 3; + case 2: // enable L1, L0s + pAd->LnkCtrlBitMask = 3; break; - case 3: // sync with host clk and enable L1, L0s + case 3: // sync with host clk and enable L1, L0s pAd->LnkCtrlBitMask = 0x103; break; - } + } RT28xx_EEPROM_READ16(pAd, 0x24, data2); - if ((PCIePowerSaveLevel&0xff) != 0xff) - { + if ((PCIePowerSaveLevel & 0xff) != 0xff) { PCIePowerSaveLevel &= 0x3; - if( !(((data2&0xff00) == 0x9200) && ((data2&0x80) !=0)) ) - { - if (PCIePowerSaveLevel > 1 ) + if (! + (((data2 & 0xff00) == 0x9200) + && ((data2 & 0x80) != 0))) { + if (PCIePowerSaveLevel > 1) PCIePowerSaveLevel = 1; } - DBGPRINT(RT_DEBUG_TRACE, ("====> rt28xx Write 0x83 Command = 0x%x.\n", PCIePowerSaveLevel)); + DBGPRINT(RT_DEBUG_TRACE, + ("====> rt28xx Write 0x83 Command = 0x%x.\n", + PCIePowerSaveLevel)); - AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSaveLevel, 0x00); + AsicSendCommandToMcu(pAd, 0x83, 0xff, + (UCHAR) PCIePowerSaveLevel, + 0x00); } - DBGPRINT(RT_DEBUG_TRACE, ("====> LnkCtrlBitMask = 0x%x.\n", pAd->LnkCtrlBitMask)); - } - } - else if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) - { - UCHAR LinkCtrlSetting = 0; + DBGPRINT(RT_DEBUG_TRACE, + ("====> LnkCtrlBitMask = 0x%x.\n", + pAd->LnkCtrlBitMask)); + } + } else if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) { + UCHAR LinkCtrlSetting = 0; // Check 3090E special setting chip. - RT28xx_EEPROM_READ16(pAd, 0x24, data2); - if ((data2 == 0x9280) && ((pAd->MACVersion&0xffff) == 0x0211)) - { + RT28xx_EEPROM_READ16(pAd, 0x24, data2); + if ((data2 == 0x9280) && ((pAd->MACVersion & 0xffff) == 0x0211)) { pAd->b3090ESpecialChip = TRUE; - DBGPRINT_RAW(RT_DEBUG_ERROR,("Special 3090E chip \n")); + DBGPRINT_RAW(RT_DEBUG_ERROR, ("Special 3090E chip \n")); } RTMP_IO_READ32(pAd, AUX_CTRL, &MacValue); @@ -622,130 +592,148 @@ VOID RTMPInitPCIeLinkCtrlValue( //Force PCIE 125MHz CLK to toggle MacValue |= 0x402; RTMP_IO_WRITE32(pAd, AUX_CTRL, MacValue); - DBGPRINT_RAW(RT_DEBUG_ERROR,(" AUX_CTRL = 0x%32x\n", MacValue)); - - + DBGPRINT_RAW(RT_DEBUG_ERROR, + (" AUX_CTRL = 0x%32x\n", MacValue)); // for RT30xx F and after, PCIe infterface, and for power solution 3 if ((IS_VERSION_AFTER_F(pAd)) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode >= 2) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode <= 3)) - { + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode >= 2) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode <= 3)) { RTMP_IO_READ32(pAd, AUX_CTRL, &MacValue); - DBGPRINT_RAW(RT_DEBUG_ERROR,(" Read AUX_CTRL = 0x%x\n", MacValue)); + DBGPRINT_RAW(RT_DEBUG_ERROR, + (" Read AUX_CTRL = 0x%x\n", MacValue)); // turn on bit 12. //enable 32KHz clock mode for power saving MacValue |= 0x1000; - if (MacValue != 0xffffffff) - { + if (MacValue != 0xffffffff) { RTMP_IO_WRITE32(pAd, AUX_CTRL, MacValue); - DBGPRINT_RAW(RT_DEBUG_ERROR,(" Write AUX_CTRL = 0x%x\n", MacValue)); + DBGPRINT_RAW(RT_DEBUG_ERROR, + (" Write AUX_CTRL = 0x%x\n", + MacValue)); // 1. if use PCIePowerSetting is 2 or 3, need to program OSC_CTRL to 0x3ff11. MacValue = 0x3ff11; RTMP_IO_WRITE32(pAd, OSC_CTRL, MacValue); - DBGPRINT_RAW(RT_DEBUG_ERROR,(" OSC_CTRL = 0x%x\n", MacValue)); + DBGPRINT_RAW(RT_DEBUG_ERROR, + (" OSC_CTRL = 0x%x\n", MacValue)); // 2. Write PCI register Clk ref bit RTMPrt3xSetPCIePowerLinkCtrl(pAd); - } - else - { + } else { // Error read Aux_Ctrl value. Force to use solution 1 - DBGPRINT(RT_DEBUG_ERROR,(" Error Value in AUX_CTRL = 0x%x\n", MacValue)); + DBGPRINT(RT_DEBUG_ERROR, + (" Error Value in AUX_CTRL = 0x%x\n", + MacValue)); pAd->StaCfg.PSControl.field.rt30xxPowerMode = 1; - DBGPRINT(RT_DEBUG_ERROR,(" Force to use power solution1 \n")); + DBGPRINT(RT_DEBUG_ERROR, + (" Force to use power solution1 \n")); } } // 1. read setting from inf file. - PCIePowerSaveLevel = (USHORT)pAd->StaCfg.PSControl.field.rt30xxPowerMode; - DBGPRINT(RT_DEBUG_ERROR, ("====> rt30xx Read PowerLevelMode = 0x%x.\n", PCIePowerSaveLevel)); + PCIePowerSaveLevel = + (USHORT) pAd->StaCfg.PSControl.field.rt30xxPowerMode; + DBGPRINT(RT_DEBUG_ERROR, + ("====> rt30xx Read PowerLevelMode = 0x%x.\n", + PCIePowerSaveLevel)); // 2. Check EnableNewPS. if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) PCIePowerSaveLevel = 1; - if (IS_VERSION_BEFORE_F(pAd) && (pAd->b3090ESpecialChip == FALSE)) - { + if (IS_VERSION_BEFORE_F(pAd) + && (pAd->b3090ESpecialChip == FALSE)) { // Chip Version E only allow 1, So force set 1. PCIePowerSaveLevel &= 0x1; - pAd->PCIePowerSaveLevel = (USHORT)PCIePowerSaveLevel; - DBGPRINT(RT_DEBUG_TRACE, ("====> rt30xx E Write 0x83 Command = 0x%x.\n", PCIePowerSaveLevel)); - - AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSaveLevel, 0x00); - } - else - { + pAd->PCIePowerSaveLevel = (USHORT) PCIePowerSaveLevel; + DBGPRINT(RT_DEBUG_TRACE, + ("====> rt30xx E Write 0x83 Command = 0x%x.\n", + PCIePowerSaveLevel)); + + AsicSendCommandToMcu(pAd, 0x83, 0xff, + (UCHAR) PCIePowerSaveLevel, 0x00); + } else { // Chip Version F and after only allow 1 or 2 or 3. This might be modified after new chip version come out. - if (!((PCIePowerSaveLevel == 1) || (PCIePowerSaveLevel == 3))) + if (! + ((PCIePowerSaveLevel == 1) + || (PCIePowerSaveLevel == 3))) PCIePowerSaveLevel = 1; - DBGPRINT(RT_DEBUG_ERROR, ("====> rt30xx F Write 0x83 Command = 0x%x.\n", PCIePowerSaveLevel)); - pAd->PCIePowerSaveLevel = (USHORT)PCIePowerSaveLevel; + DBGPRINT(RT_DEBUG_ERROR, + ("====> rt30xx F Write 0x83 Command = 0x%x.\n", + PCIePowerSaveLevel)); + pAd->PCIePowerSaveLevel = (USHORT) PCIePowerSaveLevel; // for 3090F , we need to add high-byte arg for 0x83 command to indicate the link control setting in // PCI Configuration Space. Because firmware can't read PCI Configuration Space - if ((pAd->Rt3xxRalinkLinkCtrl & 0x2) && (pAd->Rt3xxHostLinkCtrl & 0x2)) - { + if ((pAd->Rt3xxRalinkLinkCtrl & 0x2) + && (pAd->Rt3xxHostLinkCtrl & 0x2)) { LinkCtrlSetting = 1; } - DBGPRINT(RT_DEBUG_TRACE, ("====> rt30xxF LinkCtrlSetting = 0x%x.\n", LinkCtrlSetting)); - AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR)PCIePowerSaveLevel, LinkCtrlSetting); + DBGPRINT(RT_DEBUG_TRACE, + ("====> rt30xxF LinkCtrlSetting = 0x%x.\n", + LinkCtrlSetting)); + AsicSendCommandToMcu(pAd, 0x83, 0xff, + (UCHAR) PCIePowerSaveLevel, + LinkCtrlSetting); } } - - // Find Ralink PCIe Device's Express Capability Offset + // Find Ralink PCIe Device's Express Capability Offset pos = pci_find_capability(pObj->pci_dev, PCI_CAP_ID_EXP); - if (pos != 0) - { - // Ralink PCIe Device's Link Control Register Offset - pAd->RLnkCtrlOffset = pos + PCI_EXP_LNKCTL; - pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, ®16); - Configuration = le2cpu16(reg16); - DBGPRINT(RT_DEBUG_TRACE, ("Read (Ralink PCIe Link Control Register) offset 0x%x = 0x%x\n", - pAd->RLnkCtrlOffset, Configuration)); - pAd->RLnkCtrlConfiguration = (Configuration & 0x103); - Configuration &= 0xfefc; - Configuration |= (0x0); + if (pos != 0) { + // Ralink PCIe Device's Link Control Register Offset + pAd->RLnkCtrlOffset = pos + PCI_EXP_LNKCTL; + pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, + ®16); + Configuration = le2cpu16(reg16); + DBGPRINT(RT_DEBUG_TRACE, + ("Read (Ralink PCIe Link Control Register) offset 0x%x = 0x%x\n", + pAd->RLnkCtrlOffset, Configuration)); + pAd->RLnkCtrlConfiguration = (Configuration & 0x103); + Configuration &= 0xfefc; + Configuration |= (0x0); #ifdef RT2860 if ((pObj->DeviceID == NIC2860_PCIe_DEVICE_ID) - ||(pObj->DeviceID == NIC2790_PCIe_DEVICE_ID)) - { + || (pObj->DeviceID == NIC2790_PCIe_DEVICE_ID)) { reg16 = cpu2le16(Configuration); - pci_write_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, reg16); - DBGPRINT(RT_DEBUG_TRACE, ("Write (Ralink PCIe Link Control Register) offset 0x%x = 0x%x\n", - pos + PCI_EXP_LNKCTL, Configuration)); + pci_write_config_word(pObj->pci_dev, + pAd->RLnkCtrlOffset, reg16); + DBGPRINT(RT_DEBUG_TRACE, + ("Write (Ralink PCIe Link Control Register) offset 0x%x = 0x%x\n", + pos + PCI_EXP_LNKCTL, Configuration)); } #endif // RT2860 // - RTMPFindHostPCIDev(pAd); - if (pObj->parent_pci_dev) - { - USHORT vendor_id; + RTMPFindHostPCIDev(pAd); + if (pObj->parent_pci_dev) { + USHORT vendor_id; - pci_read_config_word(pObj->parent_pci_dev, PCI_VENDOR_ID, &vendor_id); - vendor_id = le2cpu16(vendor_id); - if (vendor_id == PCIBUS_INTEL_VENDOR) - { - bFindIntel = TRUE; - RTMP_SET_PSFLAG(pAd, fRTMP_PS_TOGGLE_L1); - } - - // Find PCI-to-PCI Bridge Express Capability Offset - pos = pci_find_capability(pObj->parent_pci_dev, PCI_CAP_ID_EXP); - - if (pos != 0) - { - BOOLEAN bChange = FALSE; - // PCI-to-PCI Bridge Link Control Register Offset - pAd->HostLnkCtrlOffset = pos + PCI_EXP_LNKCTL; - pci_read_config_word(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, ®16); - Configuration = le2cpu16(reg16); - DBGPRINT(RT_DEBUG_TRACE, ("Read (Host PCI-to-PCI Bridge Link Control Register) offset 0x%x = 0x%x\n", - pAd->HostLnkCtrlOffset, Configuration)); - pAd->HostLnkCtrlConfiguration = (Configuration & 0x103); - Configuration &= 0xfefc; - Configuration |= (0x0); + pci_read_config_word(pObj->parent_pci_dev, + PCI_VENDOR_ID, &vendor_id); + vendor_id = le2cpu16(vendor_id); + if (vendor_id == PCIBUS_INTEL_VENDOR) { + bFindIntel = TRUE; + RTMP_SET_PSFLAG(pAd, fRTMP_PS_TOGGLE_L1); + } + // Find PCI-to-PCI Bridge Express Capability Offset + pos = + pci_find_capability(pObj->parent_pci_dev, + PCI_CAP_ID_EXP); + + if (pos != 0) { + BOOLEAN bChange = FALSE; + // PCI-to-PCI Bridge Link Control Register Offset + pAd->HostLnkCtrlOffset = pos + PCI_EXP_LNKCTL; + pci_read_config_word(pObj->parent_pci_dev, + pAd->HostLnkCtrlOffset, + ®16); + Configuration = le2cpu16(reg16); + DBGPRINT(RT_DEBUG_TRACE, + ("Read (Host PCI-to-PCI Bridge Link Control Register) offset 0x%x = 0x%x\n", + pAd->HostLnkCtrlOffset, + Configuration)); + pAd->HostLnkCtrlConfiguration = + (Configuration & 0x103); + Configuration &= 0xfefc; + Configuration |= (0x0); - switch (pObj->DeviceID) - { + switch (pObj->DeviceID) { #ifdef RT2860 case NIC2860_PCIe_DEVICE_ID: case NIC2790_PCIe_DEVICE_ID: @@ -757,98 +745,104 @@ VOID RTMPInitPCIeLinkCtrlValue( case NIC3091_PCIe_DEVICE_ID: case NIC3092_PCIe_DEVICE_ID: if (bFindIntel == FALSE) - bChange = TRUE; + bChange = TRUE; break; #endif // RT3090 // default: break; - } + } - if (bChange) - { - reg16 = cpu2le16(Configuration); - pci_write_config_word(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, reg16); - DBGPRINT(RT_DEBUG_TRACE, ("Write (Host PCI-to-PCI Bridge Link Control Register) offset 0x%x = 0x%x\n", - pAd->HostLnkCtrlOffset, Configuration)); + if (bChange) { + reg16 = cpu2le16(Configuration); + pci_write_config_word(pObj-> + parent_pci_dev, + pAd-> + HostLnkCtrlOffset, + reg16); + DBGPRINT(RT_DEBUG_TRACE, + ("Write (Host PCI-to-PCI Bridge Link Control Register) offset 0x%x = 0x%x\n", + pAd->HostLnkCtrlOffset, + Configuration)); + } + } else { + pAd->HostLnkCtrlOffset = 0; + DBGPRINT(RT_DEBUG_ERROR, + ("%s: cannot find PCI-to-PCI Bridge PCI Express Capability!\n", + __func__)); } } - else - { - pAd->HostLnkCtrlOffset = 0; - DBGPRINT(RT_DEBUG_ERROR, ("%s: cannot find PCI-to-PCI Bridge PCI Express Capability!\n", __func__)); - } - } - } - else - { - pAd->RLnkCtrlOffset = 0; - pAd->HostLnkCtrlOffset = 0; - DBGPRINT(RT_DEBUG_ERROR, ("%s: cannot find Ralink PCIe Device's PCI Express Capability!\n", __func__)); - } - - if (bFindIntel == FALSE) - { - DBGPRINT(RT_DEBUG_TRACE, ("Doesn't find Intel PCI host controller. \n")); + } else { + pAd->RLnkCtrlOffset = 0; + pAd->HostLnkCtrlOffset = 0; + DBGPRINT(RT_DEBUG_ERROR, + ("%s: cannot find Ralink PCIe Device's PCI Express Capability!\n", + __func__)); + } + + if (bFindIntel == FALSE) { + DBGPRINT(RT_DEBUG_TRACE, + ("Doesn't find Intel PCI host controller. \n")); // Doesn't switch L0, L1, So set PCIePowerSaveLevel to 0xff pAd->PCIePowerSaveLevel = 0xff; if ((pAd->RLnkCtrlOffset != 0) #ifdef RT3090 - && ((pObj->DeviceID == NIC3090_PCIe_DEVICE_ID) - ||(pObj->DeviceID == NIC3091_PCIe_DEVICE_ID) - ||(pObj->DeviceID == NIC3092_PCIe_DEVICE_ID)) + && ((pObj->DeviceID == NIC3090_PCIe_DEVICE_ID) + || (pObj->DeviceID == NIC3091_PCIe_DEVICE_ID) + || (pObj->DeviceID == NIC3092_PCIe_DEVICE_ID)) #endif // RT3090 // - ) - { - pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, ®16); + ) { + pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, + ®16); Configuration = le2cpu16(reg16); - DBGPRINT(RT_DEBUG_TRACE, ("Read (Ralink 30xx PCIe Link Control Register) offset 0x%x = 0x%x\n", - pAd->RLnkCtrlOffset, Configuration)); + DBGPRINT(RT_DEBUG_TRACE, + ("Read (Ralink 30xx PCIe Link Control Register) offset 0x%x = 0x%x\n", + pAd->RLnkCtrlOffset, Configuration)); pAd->RLnkCtrlConfiguration = (Configuration & 0x103); Configuration &= 0xfefc; Configuration |= (0x0); reg16 = cpu2le16(Configuration); - pci_write_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, reg16); - DBGPRINT(RT_DEBUG_TRACE, ("Write (Ralink PCIe Link Control Register) offset 0x%x = 0x%x\n", - pos + PCI_EXP_LNKCTL, Configuration)); + pci_write_config_word(pObj->pci_dev, + pAd->RLnkCtrlOffset, reg16); + DBGPRINT(RT_DEBUG_TRACE, + ("Write (Ralink PCIe Link Control Register) offset 0x%x = 0x%x\n", + pos + PCI_EXP_LNKCTL, Configuration)); } } } -VOID RTMPFindHostPCIDev( - IN PRTMP_ADAPTER pAd) +VOID RTMPFindHostPCIDev(IN PRTMP_ADAPTER pAd) { - USHORT reg16; - UCHAR reg8; - UINT DevFn; - PPCI_DEV pPci_dev; - POS_COOKIE pObj; + USHORT reg16; + UCHAR reg8; + UINT DevFn; + PPCI_DEV pPci_dev; + POS_COOKIE pObj; pObj = (POS_COOKIE) pAd->OS_Cookie; if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) return; - DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __func__)); - - pObj->parent_pci_dev = NULL; - if (pObj->pci_dev->bus->parent) - { - for (DevFn = 0; DevFn < 255; DevFn++) - { - pPci_dev = pci_get_slot(pObj->pci_dev->bus->parent, DevFn); - if (pPci_dev) - { - pci_read_config_word(pPci_dev, PCI_CLASS_DEVICE, ®16); - reg16 = le2cpu16(reg16); - pci_read_config_byte(pPci_dev, PCI_CB_CARD_BUS, ®8); - if ((reg16 == PCI_CLASS_BRIDGE_PCI) && - (reg8 == pObj->pci_dev->bus->number)) - { - pObj->parent_pci_dev = pPci_dev; - } - } - } - } + DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __func__)); + + pObj->parent_pci_dev = NULL; + if (pObj->pci_dev->bus->parent) { + for (DevFn = 0; DevFn < 255; DevFn++) { + pPci_dev = + pci_get_slot(pObj->pci_dev->bus->parent, DevFn); + if (pPci_dev) { + pci_read_config_word(pPci_dev, PCI_CLASS_DEVICE, + ®16); + reg16 = le2cpu16(reg16); + pci_read_config_byte(pPci_dev, PCI_CB_CARD_BUS, + ®8); + if ((reg16 == PCI_CLASS_BRIDGE_PCI) + && (reg8 == pObj->pci_dev->bus->number)) { + pObj->parent_pci_dev = pPci_dev; + } + } + } + } } /* @@ -862,13 +856,11 @@ VOID RTMPFindHostPCIDev( ======================================================================== */ -VOID RTMPPCIeLinkCtrlValueRestore( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level) +VOID RTMPPCIeLinkCtrlValueRestore(IN PRTMP_ADAPTER pAd, IN UCHAR Level) { - USHORT PCIePowerSaveLevel, reg16; - USHORT Configuration; - POS_COOKIE pObj; + USHORT PCIePowerSaveLevel, reg16; + USHORT Configuration; + POS_COOKIE pObj; pObj = (POS_COOKIE) pAd->OS_Cookie; @@ -877,7 +869,7 @@ VOID RTMPPCIeLinkCtrlValueRestore( #ifdef RT2860 if (!((pObj->DeviceID == NIC2860_PCIe_DEVICE_ID) - ||(pObj->DeviceID == NIC2790_PCIe_DEVICE_ID))) + || (pObj->DeviceID == NIC2790_PCIe_DEVICE_ID))) return; #endif // RT2860 // // Check PSControl Configuration @@ -889,60 +881,62 @@ VOID RTMPPCIeLinkCtrlValueRestore( #ifdef RT3090 if ((pObj->DeviceID == NIC3090_PCIe_DEVICE_ID) - ||(pObj->DeviceID == NIC3091_PCIe_DEVICE_ID) - ||(pObj->DeviceID == NIC3092_PCIe_DEVICE_ID)) + || (pObj->DeviceID == NIC3091_PCIe_DEVICE_ID) + || (pObj->DeviceID == NIC3092_PCIe_DEVICE_ID)) return; #endif // RT3090 // DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __func__)); PCIePowerSaveLevel = pAd->PCIePowerSaveLevel; - if ((PCIePowerSaveLevel&0xff) == 0xff) - { - DBGPRINT(RT_DEBUG_TRACE,("return \n")); + if ((PCIePowerSaveLevel & 0xff) == 0xff) { + DBGPRINT(RT_DEBUG_TRACE, ("return \n")); return; } - if (pObj->parent_pci_dev && (pAd->HostLnkCtrlOffset != 0)) - { - PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, Configuration); - if ((Configuration != 0) && - (Configuration != 0xFFFF)) - { - Configuration &= 0xfefc; - // If call from interface down, restore to orginial setting. - if (Level == RESTORE_CLOSE) - { - Configuration |= pAd->HostLnkCtrlConfiguration; - } - else - Configuration |= 0x0; - PCI_REG_WIRTE_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, Configuration); - DBGPRINT(RT_DEBUG_TRACE, ("Restore PCI host : offset 0x%x = 0x%x\n", pAd->HostLnkCtrlOffset, Configuration)); - } - else - DBGPRINT(RT_DEBUG_ERROR, ("Restore PCI host : PCI_REG_READ_WORD failed (Configuration = 0x%x)\n", Configuration)); - } - - if (pObj->pci_dev && (pAd->RLnkCtrlOffset != 0)) - { - PCI_REG_READ_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, Configuration); - if ((Configuration != 0) && - (Configuration != 0xFFFF)) - { - Configuration &= 0xfefc; + if (pObj->parent_pci_dev && (pAd->HostLnkCtrlOffset != 0)) { + PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, + Configuration); + if ((Configuration != 0) && (Configuration != 0xFFFF)) { + Configuration &= 0xfefc; + // If call from interface down, restore to orginial setting. + if (Level == RESTORE_CLOSE) { + Configuration |= pAd->HostLnkCtrlConfiguration; + } else + Configuration |= 0x0; + PCI_REG_WIRTE_WORD(pObj->parent_pci_dev, + pAd->HostLnkCtrlOffset, + Configuration); + DBGPRINT(RT_DEBUG_TRACE, + ("Restore PCI host : offset 0x%x = 0x%x\n", + pAd->HostLnkCtrlOffset, Configuration)); + } else + DBGPRINT(RT_DEBUG_ERROR, + ("Restore PCI host : PCI_REG_READ_WORD failed (Configuration = 0x%x)\n", + Configuration)); + } + + if (pObj->pci_dev && (pAd->RLnkCtrlOffset != 0)) { + PCI_REG_READ_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, + Configuration); + if ((Configuration != 0) && (Configuration != 0xFFFF)) { + Configuration &= 0xfefc; // If call from interface down, restore to orginial setting. if (Level == RESTORE_CLOSE) - Configuration |= pAd->RLnkCtrlConfiguration; + Configuration |= pAd->RLnkCtrlConfiguration; else Configuration |= 0x0; - PCI_REG_WIRTE_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, Configuration); - DBGPRINT(RT_DEBUG_TRACE, ("Restore Ralink : offset 0x%x = 0x%x\n", pAd->RLnkCtrlOffset, Configuration)); - } - else - DBGPRINT(RT_DEBUG_ERROR, ("Restore Ralink : PCI_REG_READ_WORD failed (Configuration = 0x%x)\n", Configuration)); + PCI_REG_WIRTE_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, + Configuration); + DBGPRINT(RT_DEBUG_TRACE, + ("Restore Ralink : offset 0x%x = 0x%x\n", + pAd->RLnkCtrlOffset, Configuration)); + } else + DBGPRINT(RT_DEBUG_ERROR, + ("Restore Ralink : PCI_REG_READ_WORD failed (Configuration = 0x%x)\n", + Configuration)); } - DBGPRINT(RT_DEBUG_TRACE,("%s <===\n", __func__)); + DBGPRINT(RT_DEBUG_TRACE, ("%s <===\n", __func__)); } /* @@ -956,13 +950,11 @@ VOID RTMPPCIeLinkCtrlValueRestore( ======================================================================== */ -VOID RTMPPCIeLinkCtrlSetting( - IN PRTMP_ADAPTER pAd, - IN USHORT Max) +VOID RTMPPCIeLinkCtrlSetting(IN PRTMP_ADAPTER pAd, IN USHORT Max) { - USHORT PCIePowerSaveLevel, reg16; - USHORT Configuration; - POS_COOKIE pObj; + USHORT PCIePowerSaveLevel, reg16; + USHORT Configuration; + POS_COOKIE pObj; pObj = (POS_COOKIE) pAd->OS_Cookie; @@ -971,7 +963,7 @@ VOID RTMPPCIeLinkCtrlSetting( #ifdef RT2860 if (!((pObj->DeviceID == NIC2860_PCIe_DEVICE_ID) - ||(pObj->DeviceID == NIC2790_PCIe_DEVICE_ID))) + || (pObj->DeviceID == NIC2790_PCIe_DEVICE_ID))) return; #endif // RT2860 // // Check PSControl Configuration @@ -983,94 +975,97 @@ VOID RTMPPCIeLinkCtrlSetting( #ifdef RT3090 if ((pObj->DeviceID == NIC3090_PCIe_DEVICE_ID) - ||(pObj->DeviceID == NIC3091_PCIe_DEVICE_ID) - ||(pObj->DeviceID == NIC3092_PCIe_DEVICE_ID)) + || (pObj->DeviceID == NIC3091_PCIe_DEVICE_ID) + || (pObj->DeviceID == NIC3092_PCIe_DEVICE_ID)) return; #endif // RT3090 // - if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP)) - { - DBGPRINT(RT_DEBUG_INFO, ("RTMPPCIePowerLinkCtrl return on fRTMP_PS_CAN_GO_SLEEP flag\n")); + if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP)) { + DBGPRINT(RT_DEBUG_INFO, + ("RTMPPCIePowerLinkCtrl return on fRTMP_PS_CAN_GO_SLEEP flag\n")); return; } - DBGPRINT(RT_DEBUG_TRACE,("%s===>\n", __func__)); + DBGPRINT(RT_DEBUG_TRACE, ("%s===>\n", __func__)); PCIePowerSaveLevel = pAd->PCIePowerSaveLevel; - if ((PCIePowerSaveLevel&0xff) == 0xff) - { - DBGPRINT(RT_DEBUG_TRACE,("return \n")); + if ((PCIePowerSaveLevel & 0xff) == 0xff) { + DBGPRINT(RT_DEBUG_TRACE, ("return \n")); return; } - PCIePowerSaveLevel = PCIePowerSaveLevel>>6; - - // Skip non-exist deice right away - if (pObj->parent_pci_dev && (pAd->HostLnkCtrlOffset != 0)) - { - PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, Configuration); - switch (PCIePowerSaveLevel) - { - case 0: - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 00 - Configuration &= 0xfefc; - break; - case 1: - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 01 - Configuration &= 0xfefc; - Configuration |= 0x1; - break; - case 2: - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 - Configuration &= 0xfefc; - Configuration |= 0x3; - break; - case 3: - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 and bit 8 of LinkControl of 2892 to 1 - Configuration &= 0xfefc; - Configuration |= 0x103; - break; + PCIePowerSaveLevel = PCIePowerSaveLevel >> 6; + + // Skip non-exist deice right away + if (pObj->parent_pci_dev && (pAd->HostLnkCtrlOffset != 0)) { + PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, + Configuration); + switch (PCIePowerSaveLevel) { + case 0: + // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 00 + Configuration &= 0xfefc; + break; + case 1: + // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 01 + Configuration &= 0xfefc; + Configuration |= 0x1; + break; + case 2: + // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 + Configuration &= 0xfefc; + Configuration |= 0x3; + break; + case 3: + // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 and bit 8 of LinkControl of 2892 to 1 + Configuration &= 0xfefc; + Configuration |= 0x103; + break; } - PCI_REG_WIRTE_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, Configuration); - DBGPRINT(RT_DEBUG_TRACE, ("Write PCI host offset 0x%x = 0x%x\n", pAd->HostLnkCtrlOffset, Configuration)); + PCI_REG_WIRTE_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, + Configuration); + DBGPRINT(RT_DEBUG_TRACE, + ("Write PCI host offset 0x%x = 0x%x\n", + pAd->HostLnkCtrlOffset, Configuration)); } - if (pObj->pci_dev && (pAd->RLnkCtrlOffset != 0)) - { + if (pObj->pci_dev && (pAd->RLnkCtrlOffset != 0)) { // first 2892 chip not allow to frequently set mode 3. will cause hang problem. if (PCIePowerSaveLevel > Max) PCIePowerSaveLevel = Max; - PCI_REG_READ_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, Configuration); - switch (PCIePowerSaveLevel) - { - case 0: - // No PCI power safe - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 00 . - Configuration &= 0xfefc; - break; - case 1: - // L0 - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 01 . - Configuration &= 0xfefc; - Configuration |= 0x1; - break; - case 2: - // L0 and L1 - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 - Configuration &= 0xfefc; - Configuration |= 0x3; - break; - case 3: - // L0 , L1 and clock management. - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 and bit 8 of LinkControl of 2892 to 1 - Configuration &= 0xfefc; - Configuration |= 0x103; - pAd->bPCIclkOff = TRUE; - break; + PCI_REG_READ_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, + Configuration); + switch (PCIePowerSaveLevel) { + case 0: + // No PCI power safe + // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 00 . + Configuration &= 0xfefc; + break; + case 1: + // L0 + // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 01 . + Configuration &= 0xfefc; + Configuration |= 0x1; + break; + case 2: + // L0 and L1 + // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 + Configuration &= 0xfefc; + Configuration |= 0x3; + break; + case 3: + // L0 , L1 and clock management. + // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 and bit 8 of LinkControl of 2892 to 1 + Configuration &= 0xfefc; + Configuration |= 0x103; + pAd->bPCIclkOff = TRUE; + break; } - PCI_REG_WIRTE_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, Configuration); - DBGPRINT(RT_DEBUG_TRACE, ("Write Ralink device : offset 0x%x = 0x%x\n", pAd->RLnkCtrlOffset, Configuration)); + PCI_REG_WIRTE_WORD(pObj->pci_dev, pAd->RLnkCtrlOffset, + Configuration); + DBGPRINT(RT_DEBUG_TRACE, + ("Write Ralink device : offset 0x%x = 0x%x\n", + pAd->RLnkCtrlOffset, Configuration)); } - DBGPRINT(RT_DEBUG_TRACE,("RTMPPCIePowerLinkCtrl <==============\n")); + DBGPRINT(RT_DEBUG_TRACE, ("RTMPPCIePowerLinkCtrl <==============\n")); } /* @@ -1081,15 +1076,14 @@ VOID RTMPPCIeLinkCtrlSetting( ======================================================================== */ -VOID RTMPrt3xSetPCIePowerLinkCtrl( - IN PRTMP_ADAPTER pAd) +VOID RTMPrt3xSetPCIePowerLinkCtrl(IN PRTMP_ADAPTER pAd) { - ULONG HostConfiguration = 0; - ULONG Configuration; - POS_COOKIE pObj; - INT pos; - USHORT reg16; + ULONG HostConfiguration = 0; + ULONG Configuration; + POS_COOKIE pObj; + INT pos; + USHORT reg16; pObj = (POS_COOKIE) pAd->OS_Cookie; @@ -1101,28 +1095,28 @@ VOID RTMPrt3xSetPCIePowerLinkCtrl( if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) return; RTMPFindHostPCIDev(pAd); - if (pObj->parent_pci_dev) - { + if (pObj->parent_pci_dev) { // Find PCI-to-PCI Bridge Express Capability Offset pos = pci_find_capability(pObj->parent_pci_dev, PCI_CAP_ID_EXP); - if (pos != 0) - { + if (pos != 0) { pAd->HostLnkCtrlOffset = pos + PCI_EXP_LNKCTL; } - // If configurared to turn on L1. - HostConfiguration = 0; - if (pAd->StaCfg.PSControl.field.rt30xxForceASPMTest == 1) - { - DBGPRINT(RT_DEBUG_TRACE, ("Enter,PSM : Force ASPM \n")); + // If configurared to turn on L1. + HostConfiguration = 0; + if (pAd->StaCfg.PSControl.field.rt30xxForceASPMTest == 1) { + DBGPRINT(RT_DEBUG_TRACE, ("Enter,PSM : Force ASPM \n")); // Skip non-exist deice right away - if ((pAd->HostLnkCtrlOffset != 0)) - { - PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, HostConfiguration); + if ((pAd->HostLnkCtrlOffset != 0)) { + PCI_REG_READ_WORD(pObj->parent_pci_dev, + pAd->HostLnkCtrlOffset, + HostConfiguration); // Prepare Configuration to write to Host HostConfiguration |= 0x3; - PCI_REG_WIRTE_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, HostConfiguration); + PCI_REG_WIRTE_WORD(pObj->parent_pci_dev, + pAd->HostLnkCtrlOffset, + HostConfiguration); pAd->Rt3xxHostLinkCtrl = HostConfiguration; // Because in rt30xxForceASPMTest Mode, Force turn on L0s, L1. // Fix HostConfiguration bit0:1 = 0x3 for later use. @@ -1132,14 +1126,14 @@ VOID RTMPrt3xSetPCIePowerLinkCtrl( "Host device L1/L0s Value = 0x%lx\n", HostConfiguration)); } - } - else if (pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM == 1) - { + } else if (pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM == + 1) { // Skip non-exist deice right away - if ((pAd->HostLnkCtrlOffset != 0)) - { - PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, HostConfiguration); + if ((pAd->HostLnkCtrlOffset != 0)) { + PCI_REG_READ_WORD(pObj->parent_pci_dev, + pAd->HostLnkCtrlOffset, + HostConfiguration); pAd->Rt3xxHostLinkCtrl = HostConfiguration; HostConfiguration &= 0x3; DBGPRINT(RT_DEBUG_TRACE, @@ -1148,49 +1142,49 @@ VOID RTMPrt3xSetPCIePowerLinkCtrl( HostConfiguration)); } } - } + } // Prepare to write Ralink setting. // Find Ralink PCIe Device's Express Capability Offset pos = pci_find_capability(pObj->pci_dev, PCI_CAP_ID_EXP); - if (pos != 0) - { - // Ralink PCIe Device's Link Control Register Offset - pAd->RLnkCtrlOffset = pos + PCI_EXP_LNKCTL; - pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, ®16); - Configuration = le2cpu16(reg16); + if (pos != 0) { + // Ralink PCIe Device's Link Control Register Offset + pAd->RLnkCtrlOffset = pos + PCI_EXP_LNKCTL; + pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, + ®16); + Configuration = le2cpu16(reg16); DBGPRINT(RT_DEBUG_TRACE, ("Read (Ralink PCIe Link Control Register) " "offset 0x%x = 0x%lx\n", pAd->RLnkCtrlOffset, Configuration)); Configuration |= 0x100; if ((pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM == 1) - || (pAd->StaCfg.PSControl.field.rt30xxForceASPMTest == 1)) - { - switch(HostConfiguration) - { - case 0: - Configuration &= 0xffffffc; - break; - case 1: - Configuration &= 0xffffffc; - Configuration |= 0x1; - break; - case 2: - Configuration &= 0xffffffc; - Configuration |= 0x2; - break; - case 3: - Configuration |= 0x3; - break; + || (pAd->StaCfg.PSControl.field.rt30xxForceASPMTest == 1)) { + switch (HostConfiguration) { + case 0: + Configuration &= 0xffffffc; + break; + case 1: + Configuration &= 0xffffffc; + Configuration |= 0x1; + break; + case 2: + Configuration &= 0xffffffc; + Configuration |= 0x2; + break; + case 3: + Configuration |= 0x3; + break; } } reg16 = cpu2le16(Configuration); - pci_write_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, reg16); + pci_write_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, + reg16); pAd->Rt3xxRalinkLinkCtrl = Configuration; DBGPRINT(RT_DEBUG_TRACE, ("PSM :Write Ralink device L1/L0s Value = 0x%lx\n", Configuration)); } - DBGPRINT(RT_DEBUG_INFO,("PSM :RTMPrt3xSetPCIePowerLinkCtrl <==============\n")); + DBGPRINT(RT_DEBUG_INFO, + ("PSM :RTMPrt3xSetPCIePowerLinkCtrl <==============\n")); } diff --git a/drivers/staging/rt2860/rt_linux.c b/drivers/staging/rt2860/rt_linux.c index d57013fb7bf1..fd577e08082e 100644 --- a/drivers/staging/rt2860/rt_linux.c +++ b/drivers/staging/rt2860/rt_linux.c @@ -28,128 +28,114 @@ #include #include "rt_config.h" -ULONG RTDebugLevel = RT_DEBUG_ERROR; - +ULONG RTDebugLevel = RT_DEBUG_ERROR; // for wireless system event message char const *pWirelessSysEventText[IW_SYS_EVENT_TYPE_NUM] = { // system status event - "had associated successfully", /* IW_ASSOC_EVENT_FLAG */ - "had disassociated", /* IW_DISASSOC_EVENT_FLAG */ - "had deauthenticated", /* IW_DEAUTH_EVENT_FLAG */ - "had been aged-out and disassociated", /* IW_AGEOUT_EVENT_FLAG */ - "occurred CounterMeasures attack", /* IW_COUNTER_MEASURES_EVENT_FLAG */ - "occurred replay counter different in Key Handshaking", /* IW_REPLAY_COUNTER_DIFF_EVENT_FLAG */ - "occurred RSNIE different in Key Handshaking", /* IW_RSNIE_DIFF_EVENT_FLAG */ - "occurred MIC different in Key Handshaking", /* IW_MIC_DIFF_EVENT_FLAG */ - "occurred ICV error in RX", /* IW_ICV_ERROR_EVENT_FLAG */ - "occurred MIC error in RX", /* IW_MIC_ERROR_EVENT_FLAG */ - "Group Key Handshaking timeout", /* IW_GROUP_HS_TIMEOUT_EVENT_FLAG */ - "Pairwise Key Handshaking timeout", /* IW_PAIRWISE_HS_TIMEOUT_EVENT_FLAG */ - "RSN IE sanity check failure", /* IW_RSNIE_SANITY_FAIL_EVENT_FLAG */ - "set key done in WPA/WPAPSK", /* IW_SET_KEY_DONE_WPA1_EVENT_FLAG */ - "set key done in WPA2/WPA2PSK", /* IW_SET_KEY_DONE_WPA2_EVENT_FLAG */ - "connects with our wireless client", /* IW_STA_LINKUP_EVENT_FLAG */ - "disconnects with our wireless client", /* IW_STA_LINKDOWN_EVENT_FLAG */ - "scan completed" /* IW_SCAN_COMPLETED_EVENT_FLAG */ - "scan terminate!! Busy!! Enqueue fail!!" /* IW_SCAN_ENQUEUE_FAIL_EVENT_FLAG */ - }; + "had associated successfully", /* IW_ASSOC_EVENT_FLAG */ + "had disassociated", /* IW_DISASSOC_EVENT_FLAG */ + "had deauthenticated", /* IW_DEAUTH_EVENT_FLAG */ + "had been aged-out and disassociated", /* IW_AGEOUT_EVENT_FLAG */ + "occurred CounterMeasures attack", /* IW_COUNTER_MEASURES_EVENT_FLAG */ + "occurred replay counter different in Key Handshaking", /* IW_REPLAY_COUNTER_DIFF_EVENT_FLAG */ + "occurred RSNIE different in Key Handshaking", /* IW_RSNIE_DIFF_EVENT_FLAG */ + "occurred MIC different in Key Handshaking", /* IW_MIC_DIFF_EVENT_FLAG */ + "occurred ICV error in RX", /* IW_ICV_ERROR_EVENT_FLAG */ + "occurred MIC error in RX", /* IW_MIC_ERROR_EVENT_FLAG */ + "Group Key Handshaking timeout", /* IW_GROUP_HS_TIMEOUT_EVENT_FLAG */ + "Pairwise Key Handshaking timeout", /* IW_PAIRWISE_HS_TIMEOUT_EVENT_FLAG */ + "RSN IE sanity check failure", /* IW_RSNIE_SANITY_FAIL_EVENT_FLAG */ + "set key done in WPA/WPAPSK", /* IW_SET_KEY_DONE_WPA1_EVENT_FLAG */ + "set key done in WPA2/WPA2PSK", /* IW_SET_KEY_DONE_WPA2_EVENT_FLAG */ + "connects with our wireless client", /* IW_STA_LINKUP_EVENT_FLAG */ + "disconnects with our wireless client", /* IW_STA_LINKDOWN_EVENT_FLAG */ + "scan completed" /* IW_SCAN_COMPLETED_EVENT_FLAG */ + "scan terminate!! Busy!! Enqueue fail!!" /* IW_SCAN_ENQUEUE_FAIL_EVENT_FLAG */ +}; // for wireless IDS_spoof_attack event message char const *pWirelessSpoofEventText[IW_SPOOF_EVENT_TYPE_NUM] = { - "detected conflict SSID", /* IW_CONFLICT_SSID_EVENT_FLAG */ - "detected spoofed association response", /* IW_SPOOF_ASSOC_RESP_EVENT_FLAG */ - "detected spoofed reassociation responses", /* IW_SPOOF_REASSOC_RESP_EVENT_FLAG */ - "detected spoofed probe response", /* IW_SPOOF_PROBE_RESP_EVENT_FLAG */ - "detected spoofed beacon", /* IW_SPOOF_BEACON_EVENT_FLAG */ - "detected spoofed disassociation", /* IW_SPOOF_DISASSOC_EVENT_FLAG */ - "detected spoofed authentication", /* IW_SPOOF_AUTH_EVENT_FLAG */ - "detected spoofed deauthentication", /* IW_SPOOF_DEAUTH_EVENT_FLAG */ - "detected spoofed unknown management frame", /* IW_SPOOF_UNKNOWN_MGMT_EVENT_FLAG */ - "detected replay attack" /* IW_REPLAY_ATTACK_EVENT_FLAG */ - }; + "detected conflict SSID", /* IW_CONFLICT_SSID_EVENT_FLAG */ + "detected spoofed association response", /* IW_SPOOF_ASSOC_RESP_EVENT_FLAG */ + "detected spoofed reassociation responses", /* IW_SPOOF_REASSOC_RESP_EVENT_FLAG */ + "detected spoofed probe response", /* IW_SPOOF_PROBE_RESP_EVENT_FLAG */ + "detected spoofed beacon", /* IW_SPOOF_BEACON_EVENT_FLAG */ + "detected spoofed disassociation", /* IW_SPOOF_DISASSOC_EVENT_FLAG */ + "detected spoofed authentication", /* IW_SPOOF_AUTH_EVENT_FLAG */ + "detected spoofed deauthentication", /* IW_SPOOF_DEAUTH_EVENT_FLAG */ + "detected spoofed unknown management frame", /* IW_SPOOF_UNKNOWN_MGMT_EVENT_FLAG */ + "detected replay attack" /* IW_REPLAY_ATTACK_EVENT_FLAG */ +}; // for wireless IDS_flooding_attack event message char const *pWirelessFloodEventText[IW_FLOOD_EVENT_TYPE_NUM] = { - "detected authentication flooding", /* IW_FLOOD_AUTH_EVENT_FLAG */ - "detected association request flooding", /* IW_FLOOD_ASSOC_REQ_EVENT_FLAG */ - "detected reassociation request flooding", /* IW_FLOOD_REASSOC_REQ_EVENT_FLAG */ - "detected probe request flooding", /* IW_FLOOD_PROBE_REQ_EVENT_FLAG */ - "detected disassociation flooding", /* IW_FLOOD_DISASSOC_EVENT_FLAG */ - "detected deauthentication flooding", /* IW_FLOOD_DEAUTH_EVENT_FLAG */ - "detected 802.1x eap-request flooding" /* IW_FLOOD_EAP_REQ_EVENT_FLAG */ - }; + "detected authentication flooding", /* IW_FLOOD_AUTH_EVENT_FLAG */ + "detected association request flooding", /* IW_FLOOD_ASSOC_REQ_EVENT_FLAG */ + "detected reassociation request flooding", /* IW_FLOOD_REASSOC_REQ_EVENT_FLAG */ + "detected probe request flooding", /* IW_FLOOD_PROBE_REQ_EVENT_FLAG */ + "detected disassociation flooding", /* IW_FLOOD_DISASSOC_EVENT_FLAG */ + "detected deauthentication flooding", /* IW_FLOOD_DEAUTH_EVENT_FLAG */ + "detected 802.1x eap-request flooding" /* IW_FLOOD_EAP_REQ_EVENT_FLAG */ +}; /* timeout -- ms */ -VOID RTMP_SetPeriodicTimer( - IN NDIS_MINIPORT_TIMER *pTimer, - IN unsigned long timeout) +VOID RTMP_SetPeriodicTimer(IN NDIS_MINIPORT_TIMER * pTimer, + IN unsigned long timeout) { - timeout = ((timeout*OS_HZ) / 1000); + timeout = ((timeout * OS_HZ) / 1000); pTimer->expires = jiffies + timeout; add_timer(pTimer); } /* convert NdisMInitializeTimer --> RTMP_OS_Init_Timer */ -VOID RTMP_OS_Init_Timer( - IN PRTMP_ADAPTER pAd, - IN NDIS_MINIPORT_TIMER *pTimer, - IN TIMER_FUNCTION function, - IN PVOID data) +VOID RTMP_OS_Init_Timer(IN PRTMP_ADAPTER pAd, + IN NDIS_MINIPORT_TIMER * pTimer, + IN TIMER_FUNCTION function, IN PVOID data) { init_timer(pTimer); - pTimer->data = (unsigned long)data; - pTimer->function = function; + pTimer->data = (unsigned long)data; + pTimer->function = function; } - -VOID RTMP_OS_Add_Timer( - IN NDIS_MINIPORT_TIMER *pTimer, - IN unsigned long timeout) +VOID RTMP_OS_Add_Timer(IN NDIS_MINIPORT_TIMER * pTimer, + IN unsigned long timeout) { if (timer_pending(pTimer)) return; - timeout = ((timeout*OS_HZ) / 1000); + timeout = ((timeout * OS_HZ) / 1000); pTimer->expires = jiffies + timeout; add_timer(pTimer); } -VOID RTMP_OS_Mod_Timer( - IN NDIS_MINIPORT_TIMER *pTimer, - IN unsigned long timeout) +VOID RTMP_OS_Mod_Timer(IN NDIS_MINIPORT_TIMER * pTimer, + IN unsigned long timeout) { - timeout = ((timeout*OS_HZ) / 1000); + timeout = ((timeout * OS_HZ) / 1000); mod_timer(pTimer, jiffies + timeout); } -VOID RTMP_OS_Del_Timer( - IN NDIS_MINIPORT_TIMER *pTimer, - OUT BOOLEAN *pCancelled) +VOID RTMP_OS_Del_Timer(IN NDIS_MINIPORT_TIMER * pTimer, + OUT BOOLEAN * pCancelled) { - if (timer_pending(pTimer)) - { + if (timer_pending(pTimer)) { *pCancelled = del_timer_sync(pTimer); - } - else - { + } else { *pCancelled = TRUE; } } -VOID RTMP_OS_Release_Packet( - IN PRTMP_ADAPTER pAd, - IN PQUEUE_ENTRY pEntry) +VOID RTMP_OS_Release_Packet(IN PRTMP_ADAPTER pAd, IN PQUEUE_ENTRY pEntry) { //RTMPFreeNdisPacket(pAd, (struct sk_buff *)pEntry); } // Unify all delay routine by using udelay -VOID RTMPusecDelay( - IN ULONG usec) +VOID RTMPusecDelay(IN ULONG usec) { - ULONG i; + ULONG i; for (i = 0; i < (usec / 50); i++) udelay(50); @@ -158,16 +144,13 @@ VOID RTMPusecDelay( udelay(usec % 50); } -void RTMP_GetCurrentSystemTime(LARGE_INTEGER *time) +void RTMP_GetCurrentSystemTime(LARGE_INTEGER * time) { time->u.LowPart = jiffies; } // pAd MUST allow to be NULL -NDIS_STATUS os_alloc_mem( - IN RTMP_ADAPTER *pAd, - OUT UCHAR **mem, - IN ULONG size) +NDIS_STATUS os_alloc_mem(IN RTMP_ADAPTER * pAd, OUT UCHAR ** mem, IN ULONG size) { *mem = (PUCHAR) kmalloc(size, GFP_ATOMIC); if (*mem) @@ -177,9 +160,7 @@ NDIS_STATUS os_alloc_mem( } // pAd MUST allow to be NULL -NDIS_STATUS os_free_mem( - IN PRTMP_ADAPTER pAd, - IN PVOID mem) +NDIS_STATUS os_free_mem(IN PRTMP_ADAPTER pAd, IN PVOID mem) { ASSERT(mem); @@ -187,80 +168,64 @@ NDIS_STATUS os_free_mem( return (NDIS_STATUS_SUCCESS); } - - - -PNDIS_PACKET RtmpOSNetPktAlloc( - IN RTMP_ADAPTER *pAd, - IN int size) +PNDIS_PACKET RtmpOSNetPktAlloc(IN RTMP_ADAPTER * pAd, IN int size) { struct sk_buff *skb; - /* Add 2 more bytes for ip header alignment*/ - skb = dev_alloc_skb(size+2); + /* Add 2 more bytes for ip header alignment */ + skb = dev_alloc_skb(size + 2); - return ((PNDIS_PACKET)skb); + return ((PNDIS_PACKET) skb); } - -PNDIS_PACKET RTMP_AllocateFragPacketBuffer( - IN PRTMP_ADAPTER pAd, - IN ULONG Length) +PNDIS_PACKET RTMP_AllocateFragPacketBuffer(IN PRTMP_ADAPTER pAd, + IN ULONG Length) { struct sk_buff *pkt; pkt = dev_alloc_skb(Length); - if (pkt == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("can't allocate frag rx %ld size packet\n",Length)); + if (pkt == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("can't allocate frag rx %ld size packet\n", Length)); } - if (pkt) - { + if (pkt) { RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pkt), PKTSRC_NDIS); } return (PNDIS_PACKET) pkt; } - -PNDIS_PACKET RTMP_AllocateTxPacketBuffer( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress) +PNDIS_PACKET RTMP_AllocateTxPacketBuffer(IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID * VirtualAddress) { struct sk_buff *pkt; pkt = dev_alloc_skb(Length); - if (pkt == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("can't allocate tx %ld size packet\n",Length)); + if (pkt == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("can't allocate tx %ld size packet\n", Length)); } - if (pkt) - { + if (pkt) { RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pkt), PKTSRC_NDIS); *VirtualAddress = (PVOID) pkt->data; - } - else - { + } else { *VirtualAddress = (PVOID) NULL; } return (PNDIS_PACKET) pkt; } - -VOID build_tx_packet( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN PUCHAR pFrame, - IN ULONG FrameLen) +VOID build_tx_packet(IN PRTMP_ADAPTER pAd, + IN PNDIS_PACKET pPacket, + IN PUCHAR pFrame, IN ULONG FrameLen) { - struct sk_buff *pTxPkt; + struct sk_buff *pTxPkt; ASSERT(pPacket); pTxPkt = RTPKT_TO_OSPKT(pPacket); @@ -268,40 +233,36 @@ VOID build_tx_packet( NdisMoveMemory(skb_put(pTxPkt, FrameLen), pFrame, FrameLen); } -VOID RTMPFreeAdapter( - IN PRTMP_ADAPTER pAd) +VOID RTMPFreeAdapter(IN PRTMP_ADAPTER pAd) { - POS_COOKIE os_cookie; + POS_COOKIE os_cookie; int index; - os_cookie=(POS_COOKIE)pAd->OS_Cookie; + os_cookie = (POS_COOKIE) pAd->OS_Cookie; if (pAd->BeaconBuf) - kfree(pAd->BeaconBuf); - + kfree(pAd->BeaconBuf); NdisFreeSpinLock(&pAd->MgmtRingLock); #ifdef RTMP_MAC_PCI NdisFreeSpinLock(&pAd->RxRingLock); #ifdef RT3090 -NdisFreeSpinLock(&pAd->McuCmdLock); + NdisFreeSpinLock(&pAd->McuCmdLock); #endif // RT3090 // #endif // RTMP_MAC_PCI // - for (index =0 ; index < NUM_OF_TX_RING; index++) - { - NdisFreeSpinLock(&pAd->TxSwQueueLock[index]); + for (index = 0; index < NUM_OF_TX_RING; index++) { + NdisFreeSpinLock(&pAd->TxSwQueueLock[index]); NdisFreeSpinLock(&pAd->DeQueueLock[index]); pAd->DeQueueRunning[index] = FALSE; } NdisFreeSpinLock(&pAd->irq_lock); - - vfree(pAd); // pci_free_consistent(os_cookie->pci_dev,sizeof(RTMP_ADAPTER),pAd,os_cookie->pAd_pa); + vfree(pAd); // pci_free_consistent(os_cookie->pci_dev,sizeof(RTMP_ADAPTER),pAd,os_cookie->pAd_pa); if (os_cookie) - kfree(os_cookie); + kfree(os_cookie); } BOOLEAN OS_Need_Clone_Packet(void) @@ -309,8 +270,6 @@ BOOLEAN OS_Need_Clone_Packet(void) return (FALSE); } - - /* ======================================================================== @@ -333,11 +292,10 @@ BOOLEAN OS_Need_Clone_Packet(void) ======================================================================== */ -NDIS_STATUS RTMPCloneNdisPacket( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN pInsAMSDUHdr, - IN PNDIS_PACKET pInPacket, - OUT PNDIS_PACKET *ppOutPacket) +NDIS_STATUS RTMPCloneNdisPacket(IN PRTMP_ADAPTER pAd, + IN BOOLEAN pInsAMSDUHdr, + IN PNDIS_PACKET pInPacket, + OUT PNDIS_PACKET * ppOutPacket) { struct sk_buff *pkt; @@ -348,16 +306,15 @@ NDIS_STATUS RTMPCloneNdisPacket( // 1. Allocate a packet pkt = dev_alloc_skb(2048); - if (pkt == NULL) - { + if (pkt == NULL) { return NDIS_STATUS_FAILURE; } - skb_put(pkt, GET_OS_PKT_LEN(pInPacket)); - NdisMoveMemory(pkt->data, GET_OS_PKT_DATAPTR(pInPacket), GET_OS_PKT_LEN(pInPacket)); + skb_put(pkt, GET_OS_PKT_LEN(pInPacket)); + NdisMoveMemory(pkt->data, GET_OS_PKT_DATAPTR(pInPacket), + GET_OS_PKT_LEN(pInPacket)); *ppOutPacket = OSPKT_TO_RTPKT(pkt); - RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pkt), PKTSRC_NDIS); printk("###Clone###\n"); @@ -365,42 +322,40 @@ NDIS_STATUS RTMPCloneNdisPacket( return NDIS_STATUS_SUCCESS; } - // the allocated NDIS PACKET must be freed via RTMPFreeNdisPacket() -NDIS_STATUS RTMPAllocateNdisPacket( - IN PRTMP_ADAPTER pAd, - OUT PNDIS_PACKET *ppPacket, - IN PUCHAR pHeader, - IN UINT HeaderLen, - IN PUCHAR pData, - IN UINT DataLen) +NDIS_STATUS RTMPAllocateNdisPacket(IN PRTMP_ADAPTER pAd, + OUT PNDIS_PACKET * ppPacket, + IN PUCHAR pHeader, + IN UINT HeaderLen, + IN PUCHAR pData, IN UINT DataLen) { - PNDIS_PACKET pPacket; + PNDIS_PACKET pPacket; ASSERT(pData); ASSERT(DataLen); // 1. Allocate a packet - pPacket = (PNDIS_PACKET *) dev_alloc_skb(HeaderLen + DataLen + RTMP_PKT_TAIL_PADDING); - if (pPacket == NULL) - { + pPacket = + (PNDIS_PACKET *) dev_alloc_skb(HeaderLen + DataLen + + RTMP_PKT_TAIL_PADDING); + if (pPacket == NULL) { *ppPacket = NULL; #ifdef DEBUG printk("RTMPAllocateNdisPacket Fail\n\n"); #endif return NDIS_STATUS_FAILURE; } - // 2. clone the frame content if (HeaderLen > 0) NdisMoveMemory(GET_OS_PKT_DATAPTR(pPacket), pHeader, HeaderLen); if (DataLen > 0) - NdisMoveMemory(GET_OS_PKT_DATAPTR(pPacket) + HeaderLen, pData, DataLen); + NdisMoveMemory(GET_OS_PKT_DATAPTR(pPacket) + HeaderLen, pData, + DataLen); // 3. update length of packet - skb_put(GET_OS_PKT_TYPE(pPacket), HeaderLen+DataLen); + skb_put(GET_OS_PKT_TYPE(pPacket), HeaderLen + DataLen); RTMP_SET_PACKET_SOURCE(pPacket, PKTSRC_NDIS); -// printk("%s : pPacket = %p, len = %d\n", __func__, pPacket, GET_OS_PKT_LEN(pPacket)); +// printk("%s : pPacket = %p, len = %d\n", __func__, pPacket, GET_OS_PKT_LEN(pPacket)); *ppPacket = pPacket; return NDIS_STATUS_SUCCESS; } @@ -412,38 +367,30 @@ NDIS_STATUS RTMPAllocateNdisPacket( corresponding NDIS_BUFFER and allocated memory. ======================================================================== */ -VOID RTMPFreeNdisPacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket) +VOID RTMPFreeNdisPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) { dev_kfree_skb_any(RTPKT_TO_OSPKT(pPacket)); } - // IRQL = DISPATCH_LEVEL // NOTE: we do have an assumption here, that Byte0 and Byte1 always reasid at the same -// scatter gather buffer -NDIS_STATUS Sniff2BytesFromNdisBuffer( - IN PNDIS_BUFFER pFirstBuffer, - IN UCHAR DesiredOffset, - OUT PUCHAR pByte0, - OUT PUCHAR pByte1) +// scatter gather buffer +NDIS_STATUS Sniff2BytesFromNdisBuffer(IN PNDIS_BUFFER pFirstBuffer, + IN UCHAR DesiredOffset, + OUT PUCHAR pByte0, OUT PUCHAR pByte1) { - *pByte0 = *(PUCHAR)(pFirstBuffer + DesiredOffset); - *pByte1 = *(PUCHAR)(pFirstBuffer + DesiredOffset + 1); + *pByte0 = *(PUCHAR) (pFirstBuffer + DesiredOffset); + *pByte1 = *(PUCHAR) (pFirstBuffer + DesiredOffset + 1); return NDIS_STATUS_SUCCESS; } - -void RTMP_QueryPacketInfo( - IN PNDIS_PACKET pPacket, - OUT PACKET_INFO *pPacketInfo, - OUT PUCHAR *pSrcBufVA, - OUT UINT *pSrcBufLen) +void RTMP_QueryPacketInfo(IN PNDIS_PACKET pPacket, + OUT PACKET_INFO * pPacketInfo, + OUT PUCHAR * pSrcBufVA, OUT UINT * pSrcBufLen) { pPacketInfo->BufferCount = 1; - pPacketInfo->pFirstBuffer = (PNDIS_BUFFER)GET_OS_PKT_DATAPTR(pPacket); + pPacketInfo->pFirstBuffer = (PNDIS_BUFFER) GET_OS_PKT_DATAPTR(pPacket); pPacketInfo->PhysicalBufferCount = 1; pPacketInfo->TotalPacketLength = GET_OS_PKT_LEN(pPacket); @@ -451,30 +398,26 @@ void RTMP_QueryPacketInfo( *pSrcBufLen = GET_OS_PKT_LEN(pPacket); } -void RTMP_QueryNextPacketInfo( - IN PNDIS_PACKET *ppPacket, - OUT PACKET_INFO *pPacketInfo, - OUT PUCHAR *pSrcBufVA, - OUT UINT *pSrcBufLen) +void RTMP_QueryNextPacketInfo(IN PNDIS_PACKET * ppPacket, + OUT PACKET_INFO * pPacketInfo, + OUT PUCHAR * pSrcBufVA, OUT UINT * pSrcBufLen) { PNDIS_PACKET pPacket = NULL; if (*ppPacket) pPacket = GET_OS_PKT_NEXT(*ppPacket); - if (pPacket) - { + if (pPacket) { pPacketInfo->BufferCount = 1; - pPacketInfo->pFirstBuffer = (PNDIS_BUFFER)GET_OS_PKT_DATAPTR(pPacket); + pPacketInfo->pFirstBuffer = + (PNDIS_BUFFER) GET_OS_PKT_DATAPTR(pPacket); pPacketInfo->PhysicalBufferCount = 1; pPacketInfo->TotalPacketLength = GET_OS_PKT_LEN(pPacket); *pSrcBufVA = GET_OS_PKT_DATAPTR(pPacket); *pSrcBufLen = GET_OS_PKT_LEN(pPacket); *ppPacket = GET_OS_PKT_NEXT(pPacket); - } - else - { + } else { pPacketInfo->BufferCount = 0; pPacketInfo->pFirstBuffer = NULL; pPacketInfo->PhysicalBufferCount = 0; @@ -486,24 +429,19 @@ void RTMP_QueryNextPacketInfo( } } - -PNDIS_PACKET DuplicatePacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN UCHAR FromWhichBSSID) +PNDIS_PACKET DuplicatePacket(IN PRTMP_ADAPTER pAd, + IN PNDIS_PACKET pPacket, IN UCHAR FromWhichBSSID) { - struct sk_buff *skb; - PNDIS_PACKET pRetPacket = NULL; - USHORT DataSize; - UCHAR *pData; + struct sk_buff *skb; + PNDIS_PACKET pRetPacket = NULL; + USHORT DataSize; + UCHAR *pData; DataSize = (USHORT) GET_OS_PKT_LEN(pPacket); pData = (PUCHAR) GET_OS_PKT_DATAPTR(pPacket); - skb = skb_clone(RTPKT_TO_OSPKT(pPacket), MEM_ALLOC_FLAG); - if (skb) - { + if (skb) { skb->dev = get_netdev_from_bssid(pAd, FromWhichBSSID); pRetPacket = OSPKT_TO_RTPKT(skb); } @@ -512,20 +450,17 @@ PNDIS_PACKET DuplicatePacket( } -PNDIS_PACKET duplicate_pkt( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, - IN ULONG DataSize, - IN UCHAR FromWhichBSSID) +PNDIS_PACKET duplicate_pkt(IN PRTMP_ADAPTER pAd, + IN PUCHAR pHeader802_3, + IN UINT HdrLen, + IN PUCHAR pData, + IN ULONG DataSize, IN UCHAR FromWhichBSSID) { - struct sk_buff *skb; - PNDIS_PACKET pPacket = NULL; - + struct sk_buff *skb; + PNDIS_PACKET pPacket = NULL; - if ((skb = __dev_alloc_skb(HdrLen + DataSize + 2, MEM_ALLOC_FLAG)) != NULL) - { + if ((skb = + __dev_alloc_skb(HdrLen + DataSize + 2, MEM_ALLOC_FLAG)) != NULL) { skb_reserve(skb, 2); NdisMoveMemory(skb->tail, pHeader802_3, HdrLen); skb_put(skb, HdrLen); @@ -538,24 +473,22 @@ PNDIS_PACKET duplicate_pkt( return pPacket; } - #define TKIP_TX_MIC_SIZE 8 -PNDIS_PACKET duplicate_pkt_with_TKIP_MIC( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket) +PNDIS_PACKET duplicate_pkt_with_TKIP_MIC(IN PRTMP_ADAPTER pAd, + IN PNDIS_PACKET pPacket) { - struct sk_buff *skb, *newskb; - + struct sk_buff *skb, *newskb; skb = RTPKT_TO_OSPKT(pPacket); - if (skb_tailroom(skb) < TKIP_TX_MIC_SIZE) - { + if (skb_tailroom(skb) < TKIP_TX_MIC_SIZE) { // alloc a new skb and copy the packet - newskb = skb_copy_expand(skb, skb_headroom(skb), TKIP_TX_MIC_SIZE, GFP_ATOMIC); + newskb = + skb_copy_expand(skb, skb_headroom(skb), TKIP_TX_MIC_SIZE, + GFP_ATOMIC); dev_kfree_skb_any(skb); - if (newskb == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("Extend Tx.MIC for packet failed!, dropping packet!\n")); + if (newskb == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("Extend Tx.MIC for packet failed!, dropping packet!\n")); return NULL; } skb = newskb; @@ -564,17 +497,12 @@ PNDIS_PACKET duplicate_pkt_with_TKIP_MIC( return OSPKT_TO_RTPKT(skb); } - - - -PNDIS_PACKET ClonePacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN PUCHAR pData, - IN ULONG DataSize) +PNDIS_PACKET ClonePacket(IN PRTMP_ADAPTER pAd, + IN PNDIS_PACKET pPacket, + IN PUCHAR pData, IN ULONG DataSize) { - struct sk_buff *pRxPkt; - struct sk_buff *pClonedPkt; + struct sk_buff *pRxPkt; + struct sk_buff *pClonedPkt; ASSERT(pPacket); pRxPkt = RTPKT_TO_OSPKT(pPacket); @@ -582,13 +510,12 @@ PNDIS_PACKET ClonePacket( // clone the packet pClonedPkt = skb_clone(pRxPkt, MEM_ALLOC_FLAG); - if (pClonedPkt) - { - // set the correct dataptr and data len - pClonedPkt->dev = pRxPkt->dev; - pClonedPkt->data = pData; - pClonedPkt->len = DataSize; - pClonedPkt->tail = pClonedPkt->data + pClonedPkt->len; + if (pClonedPkt) { + // set the correct dataptr and data len + pClonedPkt->dev = pRxPkt->dev; + pClonedPkt->data = pData; + pClonedPkt->len = DataSize; + pClonedPkt->tail = pClonedPkt->data + pClonedPkt->len; ASSERT(DataSize < 1530); } return pClonedPkt; @@ -597,12 +524,10 @@ PNDIS_PACKET ClonePacket( // // change OS packet DataPtr and DataLen // -void update_os_packet_info( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) +void update_os_packet_info(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) { - struct sk_buff *pOSPkt; + struct sk_buff *pOSPkt; ASSERT(pRxBlk->pRxPacket); pOSPkt = RTPKT_TO_OSPKT(pRxBlk->pRxPacket); @@ -613,14 +538,12 @@ void update_os_packet_info( pOSPkt->tail = pOSPkt->data + pOSPkt->len; } - -void wlan_802_11_to_802_3_packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN PUCHAR pHeader802_3, - IN UCHAR FromWhichBSSID) +void wlan_802_11_to_802_3_packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, + IN PUCHAR pHeader802_3, + IN UCHAR FromWhichBSSID) { - struct sk_buff *pOSPkt; + struct sk_buff *pOSPkt; ASSERT(pRxBlk->pRxPacket); ASSERT(pHeader802_3); @@ -637,34 +560,30 @@ void wlan_802_11_to_802_3_packet( // // - NdisMoveMemory(skb_push(pOSPkt, LENGTH_802_3), pHeader802_3, LENGTH_802_3); - } - - + NdisMoveMemory(skb_push(pOSPkt, LENGTH_802_3), pHeader802_3, + LENGTH_802_3); +} -void announce_802_3_packet( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket) +void announce_802_3_packet(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) { - struct sk_buff *pRxPkt; + struct sk_buff *pRxPkt; ASSERT(pPacket); pRxPkt = RTPKT_TO_OSPKT(pPacket); - /* Push up the protocol stack */ + /* Push up the protocol stack */ pRxPkt->protocol = eth_type_trans(pRxPkt, pRxPkt->dev); netif_rx(pRxPkt); } - PRTMP_SCATTER_GATHER_LIST -rt_get_sg_list_from_packet(PNDIS_PACKET pPacket, RTMP_SCATTER_GATHER_LIST *sg) +rt_get_sg_list_from_packet(PNDIS_PACKET pPacket, RTMP_SCATTER_GATHER_LIST * sg) { sg->NumberOfElements = 1; - sg->Elements[0].Address = GET_OS_PKT_DATAPTR(pPacket); + sg->Elements[0].Address = GET_OS_PKT_DATAPTR(pPacket); sg->Elements[0].Length = GET_OS_PKT_LEN(pPacket); return (sg); } @@ -678,13 +597,13 @@ void hex_dump(char *str, unsigned char *pSrcBufVA, unsigned int SrcBufLen) return; pt = pSrcBufVA; - printk("%s: %p, len = %d\n",str, pSrcBufVA, SrcBufLen); - for (x=0; x= event_table_len) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s : The event(%0x02x) is not valid.\n", __func__, event)); + if (event >= event_table_len) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s : The event(%0x02x) is not valid.\n", __func__, + event)); return; } - //Allocate memory and copy the msg. - if((pBuf = kmalloc(IW_CUSTOM_MAX_LEN, GFP_ATOMIC)) != NULL) - { + if ((pBuf = kmalloc(IW_CUSTOM_MAX_LEN, GFP_ATOMIC)) != NULL) { //Prepare the payload memset(pBuf, 0, IW_CUSTOM_MAX_LEN); pBufPtr = pBuf; if (pAddr) - pBufPtr += sprintf(pBufPtr, "(RT2860) STA(%02x:%02x:%02x:%02x:%02x:%02x) ", PRINT_MAC(pAddr)); + pBufPtr += + sprintf(pBufPtr, + "(RT2860) STA(%02x:%02x:%02x:%02x:%02x:%02x) ", + PRINT_MAC(pAddr)); else if (BssIdx < MAX_MBSSID_NUM) - pBufPtr += sprintf(pBufPtr, "(RT2860) BSS(wlan%d) ", BssIdx); + pBufPtr += + sprintf(pBufPtr, "(RT2860) BSS(wlan%d) ", BssIdx); else pBufPtr += sprintf(pBufPtr, "(RT2860) "); if (type == IW_SYS_EVENT_FLAG_START) - pBufPtr += sprintf(pBufPtr, "%s", pWirelessSysEventText[event]); + pBufPtr += + sprintf(pBufPtr, "%s", + pWirelessSysEventText[event]); else if (type == IW_SPOOF_EVENT_FLAG_START) - pBufPtr += sprintf(pBufPtr, "%s (RSSI=%d)", pWirelessSpoofEventText[event], Rssi); + pBufPtr += + sprintf(pBufPtr, "%s (RSSI=%d)", + pWirelessSpoofEventText[event], Rssi); else if (type == IW_FLOOD_EVENT_FLAG_START) - pBufPtr += sprintf(pBufPtr, "%s", pWirelessFloodEventText[event]); + pBufPtr += + sprintf(pBufPtr, "%s", + pWirelessFloodEventText[event]); else pBufPtr += sprintf(pBufPtr, "%s", "unknown event"); pBufPtr[pBufPtr - pBuf] = '\0'; BufLen = pBufPtr - pBuf; - RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, Event_flag, NULL, (PUCHAR)pBuf, BufLen); + RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, Event_flag, NULL, + (PUCHAR) pBuf, BufLen); //DBGPRINT(RT_DEBUG_TRACE, ("%s : %s\n", __func__, pBuf)); kfree(pBuf); - } - else - DBGPRINT(RT_DEBUG_ERROR, ("%s : Can't allocate memory for wireless event.\n", __func__)); + } else + DBGPRINT(RT_DEBUG_ERROR, + ("%s : Can't allocate memory for wireless event.\n", + __func__)); } -void send_monitor_packets( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk) +void send_monitor_packets(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) { - struct sk_buff *pOSPkt; - wlan_ng_prism2_header *ph; - int rate_index = 0; - USHORT header_len = 0; - UCHAR temp_header[40] = {0}; - - u_int32_t ralinkrate[256] = {2,4,11,22, 12,18,24,36,48,72,96, 108, 109, 110, 111, 112, 13, 26, 39, 52,78,104, 117, 130, 26, 52, 78,104, 156, 208, 234, 260, 27, 54,81,108,162, 216, 243, 270, // Last 38 - 54, 108, 162, 216, 324, 432, 486, 540, 14, 29, 43, 57, 87, 115, 130, 144, 29, 59,87,115, 173, 230,260, 288, 30, 60,90,120,180,240,270,300,60,120,180,240,360,480,540,600, 0,1,2,3,4,5,6,7,8,9,10, - 11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80}; - + struct sk_buff *pOSPkt; + wlan_ng_prism2_header *ph; + int rate_index = 0; + USHORT header_len = 0; + UCHAR temp_header[40] = { 0 }; + + u_int32_t ralinkrate[256] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108, 109, 110, 111, 112, 13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78, 104, 156, 208, 234, 260, 27, 54, 81, 108, 162, 216, 243, 270, // Last 38 + 54, 108, 162, 216, 324, 432, 486, 540, 14, 29, 43, 57, 87, 115, + 130, 144, 29, 59, 87, 115, 173, 230, 260, 288, 30, 60, 90, + 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 480, 540, + 600, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80 + }; - ASSERT(pRxBlk->pRxPacket); - if (pRxBlk->DataSize < 10) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s : Size is too small! (%d)\n", __func__, pRxBlk->DataSize)); + ASSERT(pRxBlk->pRxPacket); + if (pRxBlk->DataSize < 10) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s : Size is too small! (%d)\n", __func__, + pRxBlk->DataSize)); goto err_free_sk_buff; - } + } - if (pRxBlk->DataSize + sizeof(wlan_ng_prism2_header) > RX_BUFFER_AGGRESIZE) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s : Size is too large! (%zu)\n", __func__, pRxBlk->DataSize + sizeof(wlan_ng_prism2_header))); + if (pRxBlk->DataSize + sizeof(wlan_ng_prism2_header) > + RX_BUFFER_AGGRESIZE) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s : Size is too large! (%zu)\n", __func__, + pRxBlk->DataSize + sizeof(wlan_ng_prism2_header))); goto err_free_sk_buff; - } + } - pOSPkt = RTPKT_TO_OSPKT(pRxBlk->pRxPacket); + pOSPkt = RTPKT_TO_OSPKT(pRxBlk->pRxPacket); pOSPkt->dev = get_netdev_from_bssid(pAd, BSS0); - if (pRxBlk->pHeader->FC.Type == BTYPE_DATA) - { - pRxBlk->DataSize -= LENGTH_802_11; - if ((pRxBlk->pHeader->FC.ToDs == 1) && - (pRxBlk->pHeader->FC.FrDs == 1)) - header_len = LENGTH_802_11_WITH_ADDR4; - else - header_len = LENGTH_802_11; - - // QOS - if (pRxBlk->pHeader->FC.SubType & 0x08) - { - header_len += 2; - // Data skip QOS contorl field - pRxBlk->DataSize -=2; - } - - // Order bit: A-Ralink or HTC+ - if (pRxBlk->pHeader->FC.Order) - { - header_len += 4; + if (pRxBlk->pHeader->FC.Type == BTYPE_DATA) { + pRxBlk->DataSize -= LENGTH_802_11; + if ((pRxBlk->pHeader->FC.ToDs == 1) && + (pRxBlk->pHeader->FC.FrDs == 1)) + header_len = LENGTH_802_11_WITH_ADDR4; + else + header_len = LENGTH_802_11; + + // QOS + if (pRxBlk->pHeader->FC.SubType & 0x08) { + header_len += 2; + // Data skip QOS contorl field + pRxBlk->DataSize -= 2; + } + // Order bit: A-Ralink or HTC+ + if (pRxBlk->pHeader->FC.Order) { + header_len += 4; // Data skip HTC contorl field pRxBlk->DataSize -= 4; - } - - // Copy Header - if (header_len <= 40) - NdisMoveMemory(temp_header, pRxBlk->pData, header_len); - - // skip HW padding - if (pRxBlk->RxD.L2PAD) - pRxBlk->pData += (header_len + 2); - else - pRxBlk->pData += header_len; - } //end if + } + // Copy Header + if (header_len <= 40) + NdisMoveMemory(temp_header, pRxBlk->pData, header_len); + // skip HW padding + if (pRxBlk->RxD.L2PAD) + pRxBlk->pData += (header_len + 2); + else + pRxBlk->pData += header_len; + } //end if if (pRxBlk->DataSize < pOSPkt->len) { - skb_trim(pOSPkt,pRxBlk->DataSize); - } else { - skb_put(pOSPkt,(pRxBlk->DataSize - pOSPkt->len)); - } //end if - - if ((pRxBlk->pData - pOSPkt->data) > 0) { - skb_put(pOSPkt,(pRxBlk->pData - pOSPkt->data)); - skb_pull(pOSPkt,(pRxBlk->pData - pOSPkt->data)); - } //end if - - if (skb_headroom(pOSPkt) < (sizeof(wlan_ng_prism2_header)+ header_len)) { - if (pskb_expand_head(pOSPkt, (sizeof(wlan_ng_prism2_header) + header_len), 0, GFP_ATOMIC)) { - DBGPRINT(RT_DEBUG_ERROR, ("%s : Reallocate header size of sk_buff fail!\n", __func__)); + skb_trim(pOSPkt, pRxBlk->DataSize); + } else { + skb_put(pOSPkt, (pRxBlk->DataSize - pOSPkt->len)); + } //end if + + if ((pRxBlk->pData - pOSPkt->data) > 0) { + skb_put(pOSPkt, (pRxBlk->pData - pOSPkt->data)); + skb_pull(pOSPkt, (pRxBlk->pData - pOSPkt->data)); + } //end if + + if (skb_headroom(pOSPkt) < (sizeof(wlan_ng_prism2_header) + header_len)) { + if (pskb_expand_head + (pOSPkt, (sizeof(wlan_ng_prism2_header) + header_len), 0, + GFP_ATOMIC)) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s : Reallocate header size of sk_buff fail!\n", + __func__)); goto err_free_sk_buff; - } //end if - } //end if + } //end if + } //end if - if (header_len > 0) - NdisMoveMemory(skb_push(pOSPkt, header_len), temp_header, header_len); + if (header_len > 0) + NdisMoveMemory(skb_push(pOSPkt, header_len), temp_header, + header_len); - ph = (wlan_ng_prism2_header *) skb_push(pOSPkt, sizeof(wlan_ng_prism2_header)); + ph = (wlan_ng_prism2_header *) skb_push(pOSPkt, + sizeof(wlan_ng_prism2_header)); NdisZeroMemory(ph, sizeof(wlan_ng_prism2_header)); - ph->msgcode = DIDmsg_lnxind_wlansniffrm; - ph->msglen = sizeof(wlan_ng_prism2_header); + ph->msgcode = DIDmsg_lnxind_wlansniffrm; + ph->msglen = sizeof(wlan_ng_prism2_header); strcpy((PSTRING) ph->devname, (PSTRING) pAd->net_dev->name); - ph->hosttime.did = DIDmsg_lnxind_wlansniffrm_hosttime; + ph->hosttime.did = DIDmsg_lnxind_wlansniffrm_hosttime; ph->hosttime.status = 0; ph->hosttime.len = 4; ph->hosttime.data = jiffies; @@ -893,63 +828,71 @@ void send_monitor_packets( ph->mactime.len = 0; ph->mactime.data = 0; - ph->istx.did = DIDmsg_lnxind_wlansniffrm_istx; + ph->istx.did = DIDmsg_lnxind_wlansniffrm_istx; ph->istx.status = 0; ph->istx.len = 0; ph->istx.data = 0; - ph->channel.did = DIDmsg_lnxind_wlansniffrm_channel; + ph->channel.did = DIDmsg_lnxind_wlansniffrm_channel; ph->channel.status = 0; ph->channel.len = 4; - ph->channel.data = (u_int32_t)pAd->CommonCfg.Channel; + ph->channel.data = (u_int32_t) pAd->CommonCfg.Channel; - ph->rssi.did = DIDmsg_lnxind_wlansniffrm_rssi; + ph->rssi.did = DIDmsg_lnxind_wlansniffrm_rssi; ph->rssi.status = 0; ph->rssi.len = 4; - ph->rssi.data = (u_int32_t)RTMPMaxRssi(pAd, ConvertToRssi(pAd, pRxBlk->pRxWI->RSSI0, RSSI_0), ConvertToRssi(pAd, pRxBlk->pRxWI->RSSI1, RSSI_1), ConvertToRssi(pAd, pRxBlk->pRxWI->RSSI2, RSSI_2));; + ph->rssi.data = + (u_int32_t) RTMPMaxRssi(pAd, + ConvertToRssi(pAd, pRxBlk->pRxWI->RSSI0, + RSSI_0), ConvertToRssi(pAd, + pRxBlk-> + pRxWI-> + RSSI1, + RSSI_1), + ConvertToRssi(pAd, pRxBlk->pRxWI->RSSI2, + RSSI_2));; ph->signal.did = DIDmsg_lnxind_wlansniffrm_signal; ph->signal.status = 0; ph->signal.len = 4; - ph->signal.data = 0; //rssi + noise; + ph->signal.data = 0; //rssi + noise; ph->noise.did = DIDmsg_lnxind_wlansniffrm_noise; ph->noise.status = 0; ph->noise.len = 4; ph->noise.data = 0; - if (pRxBlk->pRxWI->PHYMODE >= MODE_HTMIX) - { - rate_index = 16 + ((UCHAR)pRxBlk->pRxWI->BW *16) + ((UCHAR)pRxBlk->pRxWI->ShortGI *32) + ((UCHAR)pRxBlk->pRxWI->MCS); - } - else - if (pRxBlk->pRxWI->PHYMODE == MODE_OFDM) - rate_index = (UCHAR)(pRxBlk->pRxWI->MCS) + 4; - else - rate_index = (UCHAR)(pRxBlk->pRxWI->MCS); - if (rate_index < 0) - rate_index = 0; - if (rate_index > 255) - rate_index = 255; + if (pRxBlk->pRxWI->PHYMODE >= MODE_HTMIX) { + rate_index = + 16 + ((UCHAR) pRxBlk->pRxWI->BW * 16) + + ((UCHAR) pRxBlk->pRxWI->ShortGI * 32) + + ((UCHAR) pRxBlk->pRxWI->MCS); + } else if (pRxBlk->pRxWI->PHYMODE == MODE_OFDM) + rate_index = (UCHAR) (pRxBlk->pRxWI->MCS) + 4; + else + rate_index = (UCHAR) (pRxBlk->pRxWI->MCS); + if (rate_index < 0) + rate_index = 0; + if (rate_index > 255) + rate_index = 255; ph->rate.did = DIDmsg_lnxind_wlansniffrm_rate; ph->rate.status = 0; ph->rate.len = 4; - ph->rate.data = ralinkrate[rate_index]; + ph->rate.data = ralinkrate[rate_index]; ph->frmlen.did = DIDmsg_lnxind_wlansniffrm_frmlen; - ph->frmlen.status = 0; + ph->frmlen.status = 0; ph->frmlen.len = 4; - ph->frmlen.data = (u_int32_t)pRxBlk->DataSize; - + ph->frmlen.data = (u_int32_t) pRxBlk->DataSize; - pOSPkt->pkt_type = PACKET_OTHERHOST; - pOSPkt->protocol = eth_type_trans(pOSPkt, pOSPkt->dev); - pOSPkt->ip_summed = CHECKSUM_NONE; - netif_rx(pOSPkt); + pOSPkt->pkt_type = PACKET_OTHERHOST; + pOSPkt->protocol = eth_type_trans(pOSPkt, pOSPkt->dev); + pOSPkt->ip_summed = CHECKSUM_NONE; + netif_rx(pOSPkt); - return; + return; err_free_sk_buff: RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); @@ -957,7 +900,6 @@ err_free_sk_buff: } - /******************************************************************************* Device IRQ related functions. @@ -974,11 +916,12 @@ int RtmpOSIRQRequest(IN PNET_DEV pNetDev) ASSERT(pAd); - if (pAd->infType == RTMP_DEV_INF_PCI) - { - POS_COOKIE _pObj = (POS_COOKIE)(pAd->OS_Cookie); + if (pAd->infType == RTMP_DEV_INF_PCI) { + POS_COOKIE _pObj = (POS_COOKIE) (pAd->OS_Cookie); RTMP_MSI_ENABLE(pAd); - retval = request_irq(_pObj->pci_dev->irq, rt2860_interrupt, SA_SHIRQ, (net_dev)->name, (net_dev)); + retval = + request_irq(_pObj->pci_dev->irq, rt2860_interrupt, SA_SHIRQ, + (net_dev)->name, (net_dev)); if (retval != 0) printk("RT2860: request_irq ERROR(%d)\n", retval); } @@ -999,36 +942,34 @@ int RtmpOSIRQRelease(IN PNET_DEV pNetDev) ASSERT(pAd); #ifdef RTMP_PCI_SUPPORT - if (pAd->infType == RTMP_DEV_INF_PCI) - { - POS_COOKIE pObj = (POS_COOKIE)(pAd->OS_Cookie); + if (pAd->infType == RTMP_DEV_INF_PCI) { + POS_COOKIE pObj = (POS_COOKIE) (pAd->OS_Cookie); synchronize_irq(pObj->pci_dev->irq); free_irq(pObj->pci_dev->irq, (net_dev)); RTMP_MSI_DISABLE(pAd); } #endif // RTMP_PCI_SUPPORT // - return 0; } - /******************************************************************************* File open/close related functions. *******************************************************************************/ -RTMP_OS_FD RtmpOSFileOpen(char *pPath, int flag, int mode) +RTMP_OS_FD RtmpOSFileOpen(char *pPath, int flag, int mode) { - struct file *filePtr; + struct file *filePtr; filePtr = filp_open(pPath, flag, 0); - if (IS_ERR(filePtr)) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s(): Error %ld opening %s\n", __func__, -PTR_ERR(filePtr), pPath)); + if (IS_ERR(filePtr)) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s(): Error %ld opening %s\n", __func__, + -PTR_ERR(filePtr), pPath)); } - return (RTMP_OS_FD)filePtr; + return (RTMP_OS_FD) filePtr; } int RtmpOSFileClose(RTMP_OS_FD osfd) @@ -1037,31 +978,26 @@ int RtmpOSFileClose(RTMP_OS_FD osfd) return 0; } - void RtmpOSFileSeek(RTMP_OS_FD osfd, int offset) { osfd->f_pos = offset; } - int RtmpOSFileRead(RTMP_OS_FD osfd, char *pDataPtr, int readLen) { // The object must have a read method - if (osfd->f_op && osfd->f_op->read) - { - return osfd->f_op->read(osfd, pDataPtr, readLen, &osfd->f_pos); - } - else - { + if (osfd->f_op && osfd->f_op->read) { + return osfd->f_op->read(osfd, pDataPtr, readLen, &osfd->f_pos); + } else { DBGPRINT(RT_DEBUG_ERROR, ("no file read method\n")); return -1; } } - int RtmpOSFileWrite(RTMP_OS_FD osfd, char *pDataPtr, int writeLen) { - return osfd->f_op->write(osfd, pDataPtr, (size_t)writeLen, &osfd->f_pos); + return osfd->f_op->write(osfd, pDataPtr, (size_t) writeLen, + &osfd->f_pos); } /******************************************************************************* @@ -1069,35 +1005,32 @@ int RtmpOSFileWrite(RTMP_OS_FD osfd, char *pDataPtr, int writeLen) Task create/management/kill related functions. *******************************************************************************/ -NDIS_STATUS RtmpOSTaskKill( - IN RTMP_OS_TASK *pTask) +NDIS_STATUS RtmpOSTaskKill(IN RTMP_OS_TASK * pTask) { RTMP_ADAPTER *pAd; int ret = NDIS_STATUS_FAILURE; - pAd = (RTMP_ADAPTER *)pTask->priv; + pAd = (RTMP_ADAPTER *) pTask->priv; #ifdef KTHREAD_SUPPORT - if (pTask->kthread_task) - { + if (pTask->kthread_task) { kthread_stop(pTask->kthread_task); ret = NDIS_STATUS_SUCCESS; } #else - CHECK_PID_LEGALITY(pTask->taskPID) - { - printk("Terminate the task(%s) with pid(%d)!\n", pTask->taskName, GET_PID_NUMBER(pTask->taskPID)); + CHECK_PID_LEGALITY(pTask->taskPID) { + printk("Terminate the task(%s) with pid(%d)!\n", + pTask->taskName, GET_PID_NUMBER(pTask->taskPID)); mb(); pTask->task_killed = 1; mb(); ret = KILL_THREAD_PID(pTask->taskPID, SIGTERM, 1); - if (ret) - { - printk(KERN_WARNING "kill task(%s) with pid(%d) failed(retVal=%d)!\n", - pTask->taskName, GET_PID_NUMBER(pTask->taskPID), ret); - } - else - { + if (ret) { + printk(KERN_WARNING + "kill task(%s) with pid(%d) failed(retVal=%d)!\n", + pTask->taskName, GET_PID_NUMBER(pTask->taskPID), + ret); + } else { wait_for_completion(&pTask->taskComplete); pTask->taskPID = THREAD_PID_INIT_VALUE; pTask->task_killed = 0; @@ -1110,9 +1043,7 @@ NDIS_STATUS RtmpOSTaskKill( } - -INT RtmpOSTaskNotifyToExit( - IN RTMP_OS_TASK *pTask) +INT RtmpOSTaskNotifyToExit(IN RTMP_OS_TASK * pTask) { #ifndef KTHREAD_SUPPORT @@ -1122,14 +1053,12 @@ INT RtmpOSTaskNotifyToExit( return 0; } - -void RtmpOSTaskCustomize( - IN RTMP_OS_TASK *pTask) +void RtmpOSTaskCustomize(IN RTMP_OS_TASK * pTask) { #ifndef KTHREAD_SUPPORT - daemonize((PSTRING)&pTask->taskName[0]/*"%s",pAd->net_dev->name*/); + daemonize((PSTRING) & pTask->taskName[0] /*"%s",pAd->net_dev->name */ ); allow_signal(SIGTERM); allow_signal(SIGKILL); @@ -1141,11 +1070,8 @@ void RtmpOSTaskCustomize( #endif } - -NDIS_STATUS RtmpOSTaskAttach( - IN RTMP_OS_TASK *pTask, - IN int (*fn)(void *), - IN void *arg) +NDIS_STATUS RtmpOSTaskAttach(IN RTMP_OS_TASK * pTask, + IN int (*fn) (void *), IN void *arg) { NDIS_STATUS status = NDIS_STATUS_SUCCESS; @@ -1157,13 +1083,11 @@ NDIS_STATUS RtmpOSTaskAttach( status = NDIS_STATUS_FAILURE; #else pid_number = kernel_thread(fn, arg, RTMP_OS_MGMT_TASK_FLAGS); - if (pid_number < 0) - { - DBGPRINT (RT_DEBUG_ERROR, ("Attach task(%s) failed!\n", pTask->taskName)); + if (pid_number < 0) { + DBGPRINT(RT_DEBUG_ERROR, + ("Attach task(%s) failed!\n", pTask->taskName)); status = NDIS_STATUS_FAILURE; - } - else - { + } else { pTask->taskPID = GET_PID(pid_number); // Wait for the thread to start @@ -1174,22 +1098,21 @@ NDIS_STATUS RtmpOSTaskAttach( return status; } - -NDIS_STATUS RtmpOSTaskInit( - IN RTMP_OS_TASK *pTask, - IN PSTRING pTaskName, - IN VOID *pPriv) +NDIS_STATUS RtmpOSTaskInit(IN RTMP_OS_TASK * pTask, + IN PSTRING pTaskName, IN VOID * pPriv) { int len; ASSERT(pTask); #ifndef KTHREAD_SUPPORT - NdisZeroMemory((PUCHAR)(pTask), sizeof(RTMP_OS_TASK)); + NdisZeroMemory((PUCHAR) (pTask), sizeof(RTMP_OS_TASK)); #endif len = strlen(pTaskName); - len = len > (RTMP_OS_TASK_NAME_LEN -1) ? (RTMP_OS_TASK_NAME_LEN-1) : len; + len = + len > + (RTMP_OS_TASK_NAME_LEN - 1) ? (RTMP_OS_TASK_NAME_LEN - 1) : len; NdisMoveMemory(&pTask->taskName[0], pTaskName, len); pTask->priv = pPriv; @@ -1197,58 +1120,51 @@ NDIS_STATUS RtmpOSTaskInit( RTMP_SEM_EVENT_INIT_LOCKED(&(pTask->taskSema)); pTask->taskPID = THREAD_PID_INIT_VALUE; - init_completion (&pTask->taskComplete); + init_completion(&pTask->taskComplete); #endif return NDIS_STATUS_SUCCESS; } - -void RTMP_IndicateMediaState( - IN PRTMP_ADAPTER pAd) +void RTMP_IndicateMediaState(IN PRTMP_ADAPTER pAd) { - if (pAd->CommonCfg.bWirelessEvent) - { - if (pAd->IndicateMediaState == NdisMediaStateConnected) - { - RTMPSendWirelessEvent(pAd, IW_STA_LINKUP_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - } - else - { - RTMPSendWirelessEvent(pAd, IW_STA_LINKDOWN_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); + if (pAd->CommonCfg.bWirelessEvent) { + if (pAd->IndicateMediaState == NdisMediaStateConnected) { + RTMPSendWirelessEvent(pAd, IW_STA_LINKUP_EVENT_FLAG, + pAd->MacTab.Content[BSSID_WCID]. + Addr, BSS0, 0); + } else { + RTMPSendWirelessEvent(pAd, IW_STA_LINKDOWN_EVENT_FLAG, + pAd->MacTab.Content[BSSID_WCID]. + Addr, BSS0, 0); } } } -int RtmpOSWrielessEventSend( - IN RTMP_ADAPTER *pAd, - IN UINT32 eventType, - IN INT flags, - IN PUCHAR pSrcMac, - IN PUCHAR pData, - IN UINT32 dataLen) +int RtmpOSWrielessEventSend(IN RTMP_ADAPTER * pAd, + IN UINT32 eventType, + IN INT flags, + IN PUCHAR pSrcMac, + IN PUCHAR pData, IN UINT32 dataLen) { - union iwreq_data wrqu; + union iwreq_data wrqu; - memset(&wrqu, 0, sizeof(wrqu)); + memset(&wrqu, 0, sizeof(wrqu)); - if (flags>-1) - wrqu.data.flags = flags; + if (flags > -1) + wrqu.data.flags = flags; if (pSrcMac) memcpy(wrqu.ap_addr.sa_data, pSrcMac, MAC_ADDR_LEN); - if ((pData!= NULL) && (dataLen > 0)) + if ((pData != NULL) && (dataLen > 0)) wrqu.data.length = dataLen; - wireless_send_event(pAd->net_dev, eventType, &wrqu, (char *)pData); + wireless_send_event(pAd->net_dev, eventType, &wrqu, (char *)pData); return 0; } - -int RtmpOSNetDevAddrSet( - IN PNET_DEV pNetDev, - IN PUCHAR pMacAddr) +int RtmpOSNetDevAddrSet(IN PNET_DEV pNetDev, IN PUCHAR pMacAddr) { struct net_device *net_dev; RTMP_ADAPTER *pAd; @@ -1259,7 +1175,8 @@ int RtmpOSNetDevAddrSet( // work-around for the SuSE due to it has it's own interface name management system. { NdisZeroMemory(pAd->StaCfg.dev_name, 16); - NdisMoveMemory(pAd->StaCfg.dev_name, net_dev->name, strlen(net_dev->name)); + NdisMoveMemory(pAd->StaCfg.dev_name, net_dev->name, + strlen(net_dev->name)); } NdisMoveMemory(net_dev->dev_addr, pMacAddr, 6); @@ -1267,29 +1184,23 @@ int RtmpOSNetDevAddrSet( return 0; } - - /* * Assign the network dev name for created Ralink WiFi interface. */ -static int RtmpOSNetDevRequestName( - IN RTMP_ADAPTER *pAd, - IN PNET_DEV dev, - IN PSTRING pPrefixStr, - IN INT devIdx) +static int RtmpOSNetDevRequestName(IN RTMP_ADAPTER * pAd, + IN PNET_DEV dev, + IN PSTRING pPrefixStr, IN INT devIdx) { - PNET_DEV existNetDev; - STRING suffixName[IFNAMSIZ]; - STRING desiredName[IFNAMSIZ]; - int ifNameIdx, prefixLen, slotNameLen; + PNET_DEV existNetDev; + STRING suffixName[IFNAMSIZ]; + STRING desiredName[IFNAMSIZ]; + int ifNameIdx, prefixLen, slotNameLen; int Status; - prefixLen = strlen(pPrefixStr); ASSERT((prefixLen < IFNAMSIZ)); - for (ifNameIdx = devIdx; ifNameIdx < 32; ifNameIdx++) - { + for (ifNameIdx = devIdx; ifNameIdx < 32; ifNameIdx++) { memset(suffixName, 0, IFNAMSIZ); memset(desiredName, 0, IFNAMSIZ); strncpy(&desiredName[0], pPrefixStr, prefixLen); @@ -1307,29 +1218,24 @@ static int RtmpOSNetDevRequestName( RtmpOSNetDeviceRefPut(existNetDev); } - if(ifNameIdx < 32) - { + if (ifNameIdx < 32) { strcpy(&dev->name[0], &desiredName[0]); Status = NDIS_STATUS_SUCCESS; - } - else - { + } else { DBGPRINT(RT_DEBUG_ERROR, - ("Cannot request DevName with preifx(%s) and in range(0~32) as suffix from OS!\n", pPrefixStr)); + ("Cannot request DevName with preifx(%s) and in range(0~32) as suffix from OS!\n", + pPrefixStr)); Status = NDIS_STATUS_FAILURE; } return Status; } - -void RtmpOSNetDevClose( - IN PNET_DEV pNetDev) +void RtmpOSNetDevClose(IN PNET_DEV pNetDev) { dev_close(pNetDev); } - void RtmpOSNetDevFree(PNET_DEV pNetDev) { ASSERT(pNetDev); @@ -1337,15 +1243,14 @@ void RtmpOSNetDevFree(PNET_DEV pNetDev) free_netdev(pNetDev); } - -INT RtmpOSNetDevAlloc( - IN PNET_DEV *new_dev_p, - IN UINT32 privDataSize) +INT RtmpOSNetDevAlloc(IN PNET_DEV * new_dev_p, IN UINT32 privDataSize) { // assign it as null first. *new_dev_p = NULL; - DBGPRINT(RT_DEBUG_TRACE, ("Allocate a net device with private data size=%d!\n", privDataSize)); + DBGPRINT(RT_DEBUG_TRACE, + ("Allocate a net device with private data size=%d!\n", + privDataSize)); *new_dev_p = alloc_etherdev(privDataSize); if (*new_dev_p) return NDIS_STATUS_SUCCESS; @@ -1353,32 +1258,27 @@ INT RtmpOSNetDevAlloc( return NDIS_STATUS_FAILURE; } - PNET_DEV RtmpOSNetDevGetByName(PNET_DEV pNetDev, PSTRING pDevName) { - PNET_DEV pTargetNetDev = NULL; + PNET_DEV pTargetNetDev = NULL; pTargetNetDev = dev_get_by_name(dev_net(pNetDev), pDevName); return pTargetNetDev; } - void RtmpOSNetDeviceRefPut(PNET_DEV pNetDev) { /* - every time dev_get_by_name is called, and it has returned a valid struct - net_device*, dev_put should be called afterwards, because otherwise the - machine hangs when the device is unregistered (since dev->refcnt > 1). - */ - if(pNetDev) + every time dev_get_by_name is called, and it has returned a valid struct + net_device*, dev_put should be called afterwards, because otherwise the + machine hangs when the device is unregistered (since dev->refcnt > 1). + */ + if (pNetDev) dev_put(pNetDev); } - -INT RtmpOSNetDevDestory( - IN RTMP_ADAPTER *pAd, - IN PNET_DEV pNetDev) +INT RtmpOSNetDevDestory(IN RTMP_ADAPTER * pAd, IN PNET_DEV pNetDev) { // TODO: Need to fix this @@ -1386,23 +1286,19 @@ INT RtmpOSNetDevDestory( return 0; } - void RtmpOSNetDevDetach(PNET_DEV pNetDev) { unregister_netdev(pNetDev); } - -int RtmpOSNetDevAttach( - IN PNET_DEV pNetDev, - IN RTMP_OS_NETDEV_OP_HOOK *pDevOpHook) +int RtmpOSNetDevAttach(IN PNET_DEV pNetDev, + IN RTMP_OS_NETDEV_OP_HOOK * pDevOpHook) { int ret, rtnl_locked = FALSE; DBGPRINT(RT_DEBUG_TRACE, ("RtmpOSNetDevAttach()--->\n")); // If we need hook some callback function to the net device structrue, now do it. - if (pDevOpHook) - { + if (pDevOpHook) { PRTMP_ADAPTER pAd = NULL; GET_PAD_FROM_NET_DEV(pAd, pNetDev); @@ -1412,15 +1308,13 @@ int RtmpOSNetDevAttach( /* OS specific flags, here we used to indicate if we are virtual interface */ pNetDev->priv_flags = pDevOpHook->priv_flags; - - if (pAd->OpMode == OPMODE_STA) - { + if (pAd->OpMode == OPMODE_STA) { pNetDev->wireless_handlers = &rt28xx_iw_handler_def; } - // copy the net device mac address to the net_device structure. - NdisMoveMemory(pNetDev->dev_addr, &pDevOpHook->devAddr[0], MAC_ADDR_LEN); + NdisMoveMemory(pNetDev->dev_addr, &pDevOpHook->devAddr[0], + MAC_ADDR_LEN); rtnl_locked = pDevOpHook->needProtcted; } @@ -1437,41 +1331,38 @@ int RtmpOSNetDevAttach( return NDIS_STATUS_FAILURE; } - -PNET_DEV RtmpOSNetDevCreate( - IN RTMP_ADAPTER *pAd, - IN INT devType, - IN INT devNum, - IN INT privMemSize, - IN PSTRING pNamePrefix) +PNET_DEV RtmpOSNetDevCreate(IN RTMP_ADAPTER * pAd, + IN INT devType, + IN INT devNum, + IN INT privMemSize, IN PSTRING pNamePrefix) { struct net_device *pNetDev = NULL; int status; - /* allocate a new network device */ - status = RtmpOSNetDevAlloc(&pNetDev, 0 /*privMemSize*/); - if (status != NDIS_STATUS_SUCCESS) - { + status = RtmpOSNetDevAlloc(&pNetDev, 0 /*privMemSize */ ); + if (status != NDIS_STATUS_SUCCESS) { /* allocation fail, exit */ - DBGPRINT(RT_DEBUG_ERROR, ("Allocate network device fail (%s)...\n", pNamePrefix)); + DBGPRINT(RT_DEBUG_ERROR, + ("Allocate network device fail (%s)...\n", + pNamePrefix)); return NULL; } - /* find a available interface name, max 32 interfaces */ status = RtmpOSNetDevRequestName(pAd, pNetDev, pNamePrefix, devNum); - if (status != NDIS_STATUS_SUCCESS) - { + if (status != NDIS_STATUS_SUCCESS) { /* error! no any available ra name can be used! */ - DBGPRINT(RT_DEBUG_ERROR, ("Assign interface name (%s with suffix 0~32) failed...\n", pNamePrefix)); + DBGPRINT(RT_DEBUG_ERROR, + ("Assign interface name (%s with suffix 0~32) failed...\n", + pNamePrefix)); RtmpOSNetDevFree(pNetDev); return NULL; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("The name of the new %s interface is %s...\n", pNamePrefix, pNetDev->name)); + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("The name of the new %s interface is %s...\n", + pNamePrefix, pNetDev->name)); } return pNetDev; diff --git a/drivers/staging/rt2860/rt_main_dev.c b/drivers/staging/rt2860/rt_main_dev.c index 3a735717bcf6..8f65e469b512 100644 --- a/drivers/staging/rt2860/rt_main_dev.c +++ b/drivers/staging/rt2860/rt_main_dev.c @@ -37,17 +37,14 @@ #include "rt_config.h" - - /*---------------------------------------------------------------------*/ /* Private Variables Used */ /*---------------------------------------------------------------------*/ -PSTRING mac = ""; // default 00:00:00:00:00:00 -PSTRING hostname = ""; // default CMPC -module_param (mac, charp, 0); -MODULE_PARM_DESC (mac, "rt28xx: wireless mac addr"); - +PSTRING mac = ""; // default 00:00:00:00:00:00 +PSTRING hostname = ""; // default CMPC +module_param(mac, charp, 0); +MODULE_PARM_DESC(mac, "rt28xx: wireless mac addr"); /*---------------------------------------------------------------------*/ /* Prototypes of Functions Used */ @@ -58,11 +55,11 @@ int rt28xx_close(IN struct net_device *net_dev); int rt28xx_open(struct net_device *net_dev); // private function prototype -static INT rt28xx_send_packets(IN struct sk_buff *skb_p, IN struct net_device *net_dev); - +static INT rt28xx_send_packets(IN struct sk_buff *skb_p, + IN struct net_device *net_dev); -static struct net_device_stats *RT28xx_get_ether_stats( - IN struct net_device *net_dev); +static struct net_device_stats *RT28xx_get_ether_stats(IN struct net_device + *net_dev); /* ======================================================================== @@ -86,57 +83,66 @@ Note: */ int MainVirtualIF_close(IN struct net_device *net_dev) { - RTMP_ADAPTER *pAd = NULL; + RTMP_ADAPTER *pAd = NULL; GET_PAD_FROM_NET_DEV(pAd, net_dev); // Sanity check for pAd if (pAd == NULL) - return 0; // close ok + return 0; // close ok netif_carrier_off(pAd->net_dev); netif_stop_queue(pAd->net_dev); { - BOOLEAN Cancelled; + BOOLEAN Cancelled; if (INFRA_ON(pAd) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) - { - MLME_DISASSOC_REQ_STRUCT DisReq; - MLME_QUEUE_ELEM *MsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); - - if (MsgElem) - { - COPY_MAC_ADDR(DisReq.Addr, pAd->CommonCfg.Bssid); - DisReq.Reason = REASON_DEAUTH_STA_LEAVING; - - MsgElem->Machine = ASSOC_STATE_MACHINE; - MsgElem->MsgType = MT2_MLME_DISASSOC_REQ; - MsgElem->MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT); - NdisMoveMemory(MsgElem->Msg, &DisReq, sizeof(MLME_DISASSOC_REQ_STRUCT)); - - // Prevent to connect AP again in STAMlmePeriodicExec - pAd->MlmeAux.AutoReconnectSsidLen= 32; - NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen); - - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC; - MlmeDisassocReqAction(pAd, MsgElem); - kfree(MsgElem); + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) { + MLME_DISASSOC_REQ_STRUCT DisReq; + MLME_QUEUE_ELEM *MsgElem = + (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), + MEM_ALLOC_FLAG); + + if (MsgElem) { + COPY_MAC_ADDR(DisReq.Addr, + pAd->CommonCfg.Bssid); + DisReq.Reason = REASON_DEAUTH_STA_LEAVING; + + MsgElem->Machine = ASSOC_STATE_MACHINE; + MsgElem->MsgType = MT2_MLME_DISASSOC_REQ; + MsgElem->MsgLen = + sizeof(MLME_DISASSOC_REQ_STRUCT); + NdisMoveMemory(MsgElem->Msg, &DisReq, + sizeof + (MLME_DISASSOC_REQ_STRUCT)); + + // Prevent to connect AP again in STAMlmePeriodicExec + pAd->MlmeAux.AutoReconnectSsidLen = 32; + NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, + pAd->MlmeAux. + AutoReconnectSsidLen); + + pAd->Mlme.CntlMachine.CurrState = + CNTL_WAIT_OID_DISASSOC; + MlmeDisassocReqAction(pAd, MsgElem); + kfree(MsgElem); } RTMPusecDelay(1000); } - RTMPCancelTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, &Cancelled); - RTMPCancelTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, &Cancelled); + RTMPCancelTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, + &Cancelled); + RTMPCancelTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, + &Cancelled); } VIRTUAL_IF_DOWN(pAd); RT_MOD_DEC_USE_COUNT(); - return 0; // close ok + return 0; // close ok } /* @@ -161,13 +167,13 @@ Note: */ int MainVirtualIF_open(IN struct net_device *net_dev) { - RTMP_ADAPTER *pAd = NULL; + RTMP_ADAPTER *pAd = NULL; GET_PAD_FROM_NET_DEV(pAd, net_dev); // Sanity check for pAd if (pAd == NULL) - return 0; // close ok + return 0; // close ok if (VIRTUAL_IF_UP(pAd) != 0) return -1; @@ -204,10 +210,10 @@ Note: */ int rt28xx_close(IN PNET_DEV dev) { - struct net_device * net_dev = (struct net_device *)dev; - RTMP_ADAPTER *pAd = NULL; - BOOLEAN Cancelled; - UINT32 i = 0; + struct net_device *net_dev = (struct net_device *)dev; + RTMP_ADAPTER *pAd = NULL; + BOOLEAN Cancelled; + UINT32 i = 0; #ifdef RTMP_MAC_USB DECLARE_WAIT_QUEUE_HEAD(unlink_wakeup); @@ -216,12 +222,12 @@ int rt28xx_close(IN PNET_DEV dev) GET_PAD_FROM_NET_DEV(pAd, net_dev); - DBGPRINT(RT_DEBUG_TRACE, ("===> rt28xx_close\n")); + DBGPRINT(RT_DEBUG_TRACE, ("===> rt28xx_close\n")); Cancelled = FALSE; // Sanity check for pAd if (pAd == NULL) - return 0; // close ok + return 0; // close ok { #ifdef RTMP_MAC_PCI @@ -230,13 +236,11 @@ int rt28xx_close(IN PNET_DEV dev) // If dirver doesn't wake up firmware here, // NICLoadFirmware will hang forever when interface is up again. - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - AsicForceWakeup(pAd, TRUE); - } - + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { + AsicForceWakeup(pAd, TRUE); + } #ifdef RTMP_MAC_USB - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS); + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS); #endif // RTMP_MAC_USB // MlmeRadioOff(pAd); @@ -247,30 +251,28 @@ int rt28xx_close(IN PNET_DEV dev) RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); - for (i = 0 ; i < NUM_OF_TX_RING; i++) - { - while (pAd->DeQueueRunning[i] == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE, ("Waiting for TxQueue[%d] done..........\n", i)); + for (i = 0; i < NUM_OF_TX_RING; i++) { + while (pAd->DeQueueRunning[i] == TRUE) { + DBGPRINT(RT_DEBUG_TRACE, + ("Waiting for TxQueue[%d] done..........\n", + i)); RTMPusecDelay(1000); } } #ifdef RTMP_MAC_USB // ensure there are no more active urbs. - add_wait_queue (&unlink_wakeup, &wait); + add_wait_queue(&unlink_wakeup, &wait); pAd->wait = &unlink_wakeup; // maybe wait for deletions to finish. i = 0; //while((i < 25) && atomic_read(&pAd->PendingRx) > 0) - while(i < 25) - { + while (i < 25) { unsigned long IrqFlags; RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags); - if (pAd->PendingRx == 0) - { + if (pAd->PendingRx == 0) { RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); break; } @@ -280,7 +282,7 @@ int rt28xx_close(IN PNET_DEV dev) i++; } pAd->wait = NULL; - remove_wait_queue (&unlink_wakeup, &wait); + remove_wait_queue(&unlink_wakeup, &wait); #endif // RTMP_MAC_USB // // Stop Mlme state machine @@ -293,42 +295,37 @@ int rt28xx_close(IN PNET_DEV dev) MacTableReset(pAd); } - MeasureReqTabExit(pAd); TpcReqTabExit(pAd); - // Close kernel threads RtmpMgmtTaskExit(pAd); #ifdef RTMP_MAC_PCI { - BOOLEAN brc; - // ULONG Value; - - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) - { - RTMP_ASIC_INTERRUPT_DISABLE(pAd); - } - - // Receive packets to clear DMA index after disable interrupt. - //RTMPHandleRxDoneInterrupt(pAd); - // put to radio off to save power when driver unload. After radiooff, can't write /read register. So need to finish all - // register access before Radio off. + BOOLEAN brc; + // ULONG Value; + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) { + RTMP_ASIC_INTERRUPT_DISABLE(pAd); + } + // Receive packets to clear DMA index after disable interrupt. + //RTMPHandleRxDoneInterrupt(pAd); + // put to radio off to save power when driver unload. After radiooff, can't write /read register. So need to finish all + // register access before Radio off. - brc=RT28xxPciAsicRadioOff(pAd, RTMP_HALT, 0); + brc = RT28xxPciAsicRadioOff(pAd, RTMP_HALT, 0); //In solution 3 of 3090F, the bPCIclkOff will be set to TRUE after calling RT28xxPciAsicRadioOff - pAd->bPCIclkOff = FALSE; + pAd->bPCIclkOff = FALSE; - if (brc==FALSE) - { - DBGPRINT(RT_DEBUG_ERROR,("%s call RT28xxPciAsicRadioOff fail !!\n", __func__)); - } + if (brc == FALSE) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s call RT28xxPciAsicRadioOff fail !!\n", + __func__)); + } } - /* if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) { @@ -341,15 +338,13 @@ int rt28xx_close(IN PNET_DEV dev) #endif // RTMP_MAC_PCI // // Free IRQ - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { #ifdef RTMP_MAC_PCI // Deregister interrupt function RtmpOSIRQRelease(net_dev); #endif // RTMP_MAC_PCI // - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE); - } - + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE); + } // Free Ring or USB buffers RTMPFreeTxRxRingMemory(pAd); @@ -358,7 +353,6 @@ int rt28xx_close(IN PNET_DEV dev) // Free BA reorder resource ba_reordering_resource_release(pAd); - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_START_UP); /*+++Modify by woody to solve the bulk fail+++*/ @@ -366,9 +360,8 @@ int rt28xx_close(IN PNET_DEV dev) } DBGPRINT(RT_DEBUG_TRACE, ("<=== rt28xx_close\n")); - return 0; // close ok -} /* End of rt28xx_close */ - + return 0; // close ok +} /* End of rt28xx_close */ /* ======================================================================== @@ -387,7 +380,7 @@ Note: */ int rt28xx_open(IN PNET_DEV dev) { - struct net_device * net_dev = (struct net_device *)dev; + struct net_device *net_dev = (struct net_device *)dev; PRTMP_ADAPTER pAd = NULL; int retval = 0; //POS_COOKIE pObj; @@ -395,24 +388,21 @@ int rt28xx_open(IN PNET_DEV dev) GET_PAD_FROM_NET_DEV(pAd, net_dev); // Sanity check for pAd - if (pAd == NULL) - { + if (pAd == NULL) { /* if 1st open fail, pAd will be free; So the net_dev->ml_priv will be NULL in 2rd open */ return -1; } - if (net_dev->priv_flags == INT_MAIN) - { + if (net_dev->priv_flags == INT_MAIN) { if (pAd->OpMode == OPMODE_STA) - net_dev->wireless_handlers = (struct iw_handler_def *) &rt28xx_iw_handler_def; + net_dev->wireless_handlers = + (struct iw_handler_def *)&rt28xx_iw_handler_def; } - // Request interrupt service routine for PCI device // register the interrupt routine with the os RtmpOSIRQRequest(net_dev); - // Init IRQ parameters stored in pAd RTMP_IRQ_INIT(pAd); @@ -420,7 +410,6 @@ int rt28xx_open(IN PNET_DEV dev) if (rt28xx_init(pAd, mac, hostname) == FALSE) goto err; - // Enable Interrupt RTMP_IRQ_ENABLE(pAd); @@ -429,25 +418,25 @@ int rt28xx_open(IN PNET_DEV dev) RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_START_UP); { - UINT32 reg = 0; - RTMP_IO_READ32(pAd, 0x1300, ®); // clear garbage interrupts - printk("0x1300 = %08x\n", reg); + UINT32 reg = 0; + RTMP_IO_READ32(pAd, 0x1300, ®); // clear garbage interrupts + printk("0x1300 = %08x\n", reg); } { -// u32 reg; -// UINT8 byte; -// u16 tmp; +// u32 reg; +// UINT8 byte; +// u16 tmp; -// RTMP_IO_READ32(pAd, XIFS_TIME_CFG, ®); +// RTMP_IO_READ32(pAd, XIFS_TIME_CFG, ®); -// tmp = 0x0805; -// reg = (reg & 0xffff0000) | tmp; -// RTMP_IO_WRITE32(pAd, XIFS_TIME_CFG, reg); +// tmp = 0x0805; +// reg = (reg & 0xffff0000) | tmp; +// RTMP_IO_WRITE32(pAd, XIFS_TIME_CFG, reg); } #ifdef RTMP_MAC_PCI - RTMPInitPCIeLinkCtrlValue(pAd); + RTMPInitPCIeLinkCtrlValue(pAd); #endif // RTMP_MAC_PCI // return (retval); @@ -457,39 +446,41 @@ err: RtmpOSIRQRelease(net_dev); //---Add by shiang, move from rt28xx_init() to here. return (-1); -} /* End of rt28xx_open */ +} /* End of rt28xx_open */ static const struct net_device_ops rt2860_netdev_ops = { - .ndo_open = MainVirtualIF_open, - .ndo_stop = MainVirtualIF_close, - .ndo_do_ioctl = rt28xx_sta_ioctl, - .ndo_get_stats = RT28xx_get_ether_stats, - .ndo_validate_addr = NULL, - .ndo_set_mac_address = eth_mac_addr, - .ndo_change_mtu = eth_change_mtu, - .ndo_start_xmit = rt28xx_send_packets, + .ndo_open = MainVirtualIF_open, + .ndo_stop = MainVirtualIF_close, + .ndo_do_ioctl = rt28xx_sta_ioctl, + .ndo_get_stats = RT28xx_get_ether_stats, + .ndo_validate_addr = NULL, + .ndo_set_mac_address = eth_mac_addr, + .ndo_change_mtu = eth_change_mtu, + .ndo_start_xmit = rt28xx_send_packets, }; -PNET_DEV RtmpPhyNetDevInit( - IN RTMP_ADAPTER *pAd, - IN RTMP_OS_NETDEV_OP_HOOK *pNetDevHook) +PNET_DEV RtmpPhyNetDevInit(IN RTMP_ADAPTER * pAd, + IN RTMP_OS_NETDEV_OP_HOOK * pNetDevHook) { - struct net_device *net_dev = NULL; -// NDIS_STATUS Status; - - net_dev = RtmpOSNetDevCreate(pAd, INT_MAIN, 0, sizeof(PRTMP_ADAPTER), INF_MAIN_DEV_NAME); - if (net_dev == NULL) - { - printk("RtmpPhyNetDevInit(): creation failed for main physical net device!\n"); + struct net_device *net_dev = NULL; +// NDIS_STATUS Status; + + net_dev = + RtmpOSNetDevCreate(pAd, INT_MAIN, 0, sizeof(PRTMP_ADAPTER), + INF_MAIN_DEV_NAME); + if (net_dev == NULL) { + printk + ("RtmpPhyNetDevInit(): creation failed for main physical net device!\n"); return NULL; - } + } - NdisZeroMemory((unsigned char *)pNetDevHook, sizeof(RTMP_OS_NETDEV_OP_HOOK)); + NdisZeroMemory((unsigned char *)pNetDevHook, + sizeof(RTMP_OS_NETDEV_OP_HOOK)); pNetDevHook->netdev_ops = &rt2860_netdev_ops; pNetDevHook->priv_flags = INT_MAIN; pNetDevHook->needProtcted = FALSE; - net_dev->ml_priv = (PVOID)pAd; + net_dev->ml_priv = (PVOID) pAd; pAd->net_dev = net_dev; netif_stop_queue(net_dev); @@ -498,7 +489,6 @@ PNET_DEV RtmpPhyNetDevInit( } - /* ======================================================================== Routine Description: @@ -529,16 +519,14 @@ int rt28xx_packet_xmit(struct sk_buff *skb) { // Drop send request since we are in monitor mode - if (MONITOR_ON(pAd)) - { + if (MONITOR_ON(pAd)) { RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); goto done; } } - // EapolStart size is 18 - if (skb->len < 14) - { + // EapolStart size is 18 + if (skb->len < 14) { //printk("bad packet size: %d\n", pkt->len); hex_dump("bad packet", skb->data, skb->len); RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); @@ -546,7 +534,7 @@ int rt28xx_packet_xmit(struct sk_buff *skb) } RTMP_SET_PACKET_5VT(pPacket, 0); - STASendPackets((NDIS_HANDLE)pAd, (PPNDIS_PACKET) &pPacket, 1); + STASendPackets((NDIS_HANDLE) pAd, (PPNDIS_PACKET) & pPacket, 1); status = NETDEV_TX_OK; done: @@ -554,7 +542,6 @@ done: return status; } - /* ======================================================================== Routine Description: @@ -571,30 +558,27 @@ Return Value: Note: ======================================================================== */ -static int rt28xx_send_packets( - IN struct sk_buff *skb_p, - IN struct net_device *net_dev) +static int rt28xx_send_packets(IN struct sk_buff *skb_p, + IN struct net_device *net_dev) { RTMP_ADAPTER *pAd = NULL; GET_PAD_FROM_NET_DEV(pAd, net_dev); - if (!(net_dev->flags & IFF_UP)) - { - RELEASE_NDIS_PACKET(pAd, (PNDIS_PACKET)skb_p, NDIS_STATUS_FAILURE); + if (!(net_dev->flags & IFF_UP)) { + RELEASE_NDIS_PACKET(pAd, (PNDIS_PACKET) skb_p, + NDIS_STATUS_FAILURE); return NETDEV_TX_OK; } - NdisZeroMemory((PUCHAR)&skb_p->cb[CB_OFF], 15); + NdisZeroMemory((PUCHAR) & skb_p->cb[CB_OFF], 15); RTMP_SET_PACKET_NET_DEVICE_MBSSID(skb_p, MAIN_MBSSID); return rt28xx_packet_xmit(skb_p); } - // This function will be called when query /proc -struct iw_statistics *rt28xx_get_wireless_stats( - IN struct net_device *net_dev) +struct iw_statistics *rt28xx_get_wireless_stats(IN struct net_device *net_dev) { PRTMP_ADAPTER pAd = NULL; @@ -602,42 +586,41 @@ struct iw_statistics *rt28xx_get_wireless_stats( DBGPRINT(RT_DEBUG_TRACE, ("rt28xx_get_wireless_stats --->\n")); - pAd->iw_stats.status = 0; // Status - device dependent for now + pAd->iw_stats.status = 0; // Status - device dependent for now // link quality if (pAd->OpMode == OPMODE_STA) - pAd->iw_stats.qual.qual = ((pAd->Mlme.ChannelQuality * 12)/10 + 10); + pAd->iw_stats.qual.qual = + ((pAd->Mlme.ChannelQuality * 12) / 10 + 10); - if(pAd->iw_stats.qual.qual > 100) + if (pAd->iw_stats.qual.qual > 100) pAd->iw_stats.qual.qual = 100; - if (pAd->OpMode == OPMODE_STA) - { + if (pAd->OpMode == OPMODE_STA) { pAd->iw_stats.qual.level = - RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, - pAd->StaCfg.RssiSample.LastRssi1, - pAd->StaCfg.RssiSample.LastRssi2); + RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, + pAd->StaCfg.RssiSample.LastRssi1, + pAd->StaCfg.RssiSample.LastRssi2); } - pAd->iw_stats.qual.noise = pAd->BbpWriteLatch[66]; // noise level (dBm) + pAd->iw_stats.qual.noise = pAd->BbpWriteLatch[66]; // noise level (dBm) pAd->iw_stats.qual.noise += 256 - 143; - pAd->iw_stats.qual.updated = 1; // Flags to know if updated + pAd->iw_stats.qual.updated = 1; // Flags to know if updated #ifdef IW_QUAL_DBM pAd->iw_stats.qual.updated |= IW_QUAL_DBM; // Level + Noise are dBm #endif // IW_QUAL_DBM // - pAd->iw_stats.discard.nwid = 0; // Rx : Wrong nwid/essid - pAd->iw_stats.miss.beacon = 0; // Missed beacons/superframe + pAd->iw_stats.discard.nwid = 0; // Rx : Wrong nwid/essid + pAd->iw_stats.miss.beacon = 0; // Missed beacons/superframe DBGPRINT(RT_DEBUG_TRACE, ("<--- rt28xx_get_wireless_stats\n")); return &pAd->iw_stats; } - void tbtt_tasklet(unsigned long data) { -//#define MAX_TX_IN_TBTT (16) +//#define MAX_TX_IN_TBTT (16) } @@ -657,19 +640,20 @@ void tbtt_tasklet(unsigned long data) ======================================================================== */ -static struct net_device_stats *RT28xx_get_ether_stats( - IN struct net_device *net_dev) +static struct net_device_stats *RT28xx_get_ether_stats(IN struct net_device + *net_dev) { - RTMP_ADAPTER *pAd = NULL; + RTMP_ADAPTER *pAd = NULL; if (net_dev) GET_PAD_FROM_NET_DEV(pAd, net_dev); - if (pAd) - { + if (pAd) { - pAd->stats.rx_packets = pAd->WlanCounters.ReceivedFragmentCount.QuadPart; - pAd->stats.tx_packets = pAd->WlanCounters.TransmittedFragmentCount.QuadPart; + pAd->stats.rx_packets = + pAd->WlanCounters.ReceivedFragmentCount.QuadPart; + pAd->stats.tx_packets = + pAd->WlanCounters.TransmittedFragmentCount.QuadPart; pAd->stats.rx_bytes = pAd->RalinkCounters.ReceivedByteCount; pAd->stats.tx_bytes = pAd->RalinkCounters.TransmittedByteCount; @@ -680,45 +664,40 @@ static struct net_device_stats *RT28xx_get_ether_stats( pAd->stats.rx_dropped = 0; pAd->stats.tx_dropped = 0; - pAd->stats.multicast = pAd->WlanCounters.MulticastReceivedFrameCount.QuadPart; // multicast packets received - pAd->stats.collisions = pAd->Counters8023.OneCollision + pAd->Counters8023.MoreCollisions; // Collision packets + pAd->stats.multicast = pAd->WlanCounters.MulticastReceivedFrameCount.QuadPart; // multicast packets received + pAd->stats.collisions = pAd->Counters8023.OneCollision + pAd->Counters8023.MoreCollisions; // Collision packets - pAd->stats.rx_length_errors = 0; - pAd->stats.rx_over_errors = pAd->Counters8023.RxNoBuffer; // receiver ring buff overflow - pAd->stats.rx_crc_errors = 0;//pAd->WlanCounters.FCSErrorCount; // recved pkt with crc error - pAd->stats.rx_frame_errors = pAd->Counters8023.RcvAlignmentErrors; // recv'd frame alignment error - pAd->stats.rx_fifo_errors = pAd->Counters8023.RxNoBuffer; // recv'r fifo overrun - pAd->stats.rx_missed_errors = 0; // receiver missed packet + pAd->stats.rx_length_errors = 0; + pAd->stats.rx_over_errors = pAd->Counters8023.RxNoBuffer; // receiver ring buff overflow + pAd->stats.rx_crc_errors = 0; //pAd->WlanCounters.FCSErrorCount; // recved pkt with crc error + pAd->stats.rx_frame_errors = pAd->Counters8023.RcvAlignmentErrors; // recv'd frame alignment error + pAd->stats.rx_fifo_errors = pAd->Counters8023.RxNoBuffer; // recv'r fifo overrun + pAd->stats.rx_missed_errors = 0; // receiver missed packet - // detailed tx_errors - pAd->stats.tx_aborted_errors = 0; - pAd->stats.tx_carrier_errors = 0; - pAd->stats.tx_fifo_errors = 0; - pAd->stats.tx_heartbeat_errors = 0; - pAd->stats.tx_window_errors = 0; + // detailed tx_errors + pAd->stats.tx_aborted_errors = 0; + pAd->stats.tx_carrier_errors = 0; + pAd->stats.tx_fifo_errors = 0; + pAd->stats.tx_heartbeat_errors = 0; + pAd->stats.tx_window_errors = 0; - // for cslip etc - pAd->stats.rx_compressed = 0; - pAd->stats.tx_compressed = 0; + // for cslip etc + pAd->stats.rx_compressed = 0; + pAd->stats.tx_compressed = 0; return &pAd->stats; - } - else - return NULL; + } else + return NULL; } - -BOOLEAN RtmpPhyNetDevExit( - IN RTMP_ADAPTER *pAd, - IN PNET_DEV net_dev) +BOOLEAN RtmpPhyNetDevExit(IN RTMP_ADAPTER * pAd, IN PNET_DEV net_dev) { - - // Unregister network device - if (net_dev != NULL) - { - printk("RtmpOSNetDevDetach(): RtmpOSNetDeviceDetach(), dev->name=%s!\n", net_dev->name); + if (net_dev != NULL) { + printk + ("RtmpOSNetDevDetach(): RtmpOSNetDeviceDetach(), dev->name=%s!\n", + net_dev->name); RtmpOSNetDevDetach(net_dev); } @@ -726,7 +705,6 @@ BOOLEAN RtmpPhyNetDevExit( } - /* ======================================================================== Routine Description: @@ -743,17 +721,14 @@ Return Value: Note: ======================================================================== */ -NDIS_STATUS AdapterBlockAllocateMemory( - IN PVOID handle, - OUT PVOID *ppAd) +NDIS_STATUS AdapterBlockAllocateMemory(IN PVOID handle, OUT PVOID * ppAd) { - *ppAd = (PVOID)vmalloc(sizeof(RTMP_ADAPTER)); //pci_alloc_consistent(pci_dev, sizeof(RTMP_ADAPTER), phy_addr); + *ppAd = (PVOID) vmalloc(sizeof(RTMP_ADAPTER)); //pci_alloc_consistent(pci_dev, sizeof(RTMP_ADAPTER), phy_addr); - if (*ppAd) - { + if (*ppAd) { NdisZeroMemory(*ppAd, sizeof(RTMP_ADAPTER)); - ((PRTMP_ADAPTER)*ppAd)->OS_Cookie = handle; + ((PRTMP_ADAPTER) * ppAd)->OS_Cookie = handle; return (NDIS_STATUS_SUCCESS); } else { return (NDIS_STATUS_FAILURE); diff --git a/drivers/staging/rt2860/rt_pci_rbus.c b/drivers/staging/rt2860/rt_pci_rbus.c index 59900011b552..8ae0e3eb50ef 100644 --- a/drivers/staging/rt2860/rt_pci_rbus.c +++ b/drivers/staging/rt2860/rt_pci_rbus.c @@ -48,31 +48,28 @@ static void ac2_dma_done_tasklet(unsigned long data); static void ac3_dma_done_tasklet(unsigned long data); static void fifo_statistic_full_tasklet(unsigned long data); - - /*---------------------------------------------------------------------*/ /* Symbol & Macro Definitions */ /*---------------------------------------------------------------------*/ -#define RT2860_INT_RX_DLY (1<<0) // bit 0 -#define RT2860_INT_TX_DLY (1<<1) // bit 1 -#define RT2860_INT_RX_DONE (1<<2) // bit 2 -#define RT2860_INT_AC0_DMA_DONE (1<<3) // bit 3 -#define RT2860_INT_AC1_DMA_DONE (1<<4) // bit 4 -#define RT2860_INT_AC2_DMA_DONE (1<<5) // bit 5 -#define RT2860_INT_AC3_DMA_DONE (1<<6) // bit 6 -#define RT2860_INT_HCCA_DMA_DONE (1<<7) // bit 7 -#define RT2860_INT_MGMT_DONE (1<<8) // bit 8 +#define RT2860_INT_RX_DLY (1<<0) // bit 0 +#define RT2860_INT_TX_DLY (1<<1) // bit 1 +#define RT2860_INT_RX_DONE (1<<2) // bit 2 +#define RT2860_INT_AC0_DMA_DONE (1<<3) // bit 3 +#define RT2860_INT_AC1_DMA_DONE (1<<4) // bit 4 +#define RT2860_INT_AC2_DMA_DONE (1<<5) // bit 5 +#define RT2860_INT_AC3_DMA_DONE (1<<6) // bit 6 +#define RT2860_INT_HCCA_DMA_DONE (1<<7) // bit 7 +#define RT2860_INT_MGMT_DONE (1<<8) // bit 8 #define INT_RX RT2860_INT_RX_DONE -#define INT_AC0_DLY (RT2860_INT_AC0_DMA_DONE) //| RT2860_INT_TX_DLY) -#define INT_AC1_DLY (RT2860_INT_AC1_DMA_DONE) //| RT2860_INT_TX_DLY) -#define INT_AC2_DLY (RT2860_INT_AC2_DMA_DONE) //| RT2860_INT_TX_DLY) -#define INT_AC3_DLY (RT2860_INT_AC3_DMA_DONE) //| RT2860_INT_TX_DLY) -#define INT_HCCA_DLY (RT2860_INT_HCCA_DMA_DONE) //| RT2860_INT_TX_DLY) +#define INT_AC0_DLY (RT2860_INT_AC0_DMA_DONE) //| RT2860_INT_TX_DLY) +#define INT_AC1_DLY (RT2860_INT_AC1_DMA_DONE) //| RT2860_INT_TX_DLY) +#define INT_AC2_DLY (RT2860_INT_AC2_DMA_DONE) //| RT2860_INT_TX_DLY) +#define INT_AC3_DLY (RT2860_INT_AC3_DMA_DONE) //| RT2860_INT_TX_DLY) +#define INT_HCCA_DLY (RT2860_INT_HCCA_DMA_DONE) //| RT2860_INT_TX_DLY) #define INT_MGMT_DLY RT2860_INT_MGMT_DONE - /*************************************************************************** * * Interface-depended memory allocation/Free related procedures. @@ -80,92 +77,90 @@ static void fifo_statistic_full_tasklet(unsigned long data); * **************************************************************************/ // Function for TxDesc Memory allocation. -void RTMP_AllocateTxDescMemory( - IN PRTMP_ADAPTER pAd, - IN UINT Index, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) +void RTMP_AllocateTxDescMemory(IN PRTMP_ADAPTER pAd, + IN UINT Index, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID * VirtualAddress, + OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) { - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - *VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); + *VirtualAddress = + (PVOID) pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, + PhysicalAddress); } - // Function for MgmtDesc Memory allocation. -void RTMP_AllocateMgmtDescMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) +void RTMP_AllocateMgmtDescMemory(IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID * VirtualAddress, + OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) { - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - *VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); + *VirtualAddress = + (PVOID) pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, + PhysicalAddress); } - // Function for RxDesc Memory allocation. -void RTMP_AllocateRxDescMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) +void RTMP_AllocateRxDescMemory(IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID * VirtualAddress, + OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) { - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - *VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); + *VirtualAddress = + (PVOID) pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, + PhysicalAddress); } - // Function for free allocated Desc Memory. -void RTMP_FreeDescMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN PVOID VirtualAddress, - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress) +void RTMP_FreeDescMemory(IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN PVOID VirtualAddress, + IN NDIS_PHYSICAL_ADDRESS PhysicalAddress) { - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - pci_free_consistent(pObj->pci_dev, Length, VirtualAddress, PhysicalAddress); + pci_free_consistent(pObj->pci_dev, Length, VirtualAddress, + PhysicalAddress); } - // Function for TxData DMA Memory allocation. -void RTMP_AllocateFirstTxBuffer( - IN PRTMP_ADAPTER pAd, - IN UINT Index, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) +void RTMP_AllocateFirstTxBuffer(IN PRTMP_ADAPTER pAd, + IN UINT Index, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID * VirtualAddress, + OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) { - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - *VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); + *VirtualAddress = + (PVOID) pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, + PhysicalAddress); } - -void RTMP_FreeFirstTxBuffer( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - IN PVOID VirtualAddress, - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress) +void RTMP_FreeFirstTxBuffer(IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN BOOLEAN Cached, + IN PVOID VirtualAddress, + IN NDIS_PHYSICAL_ADDRESS PhysicalAddress) { - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - pci_free_consistent(pObj->pci_dev, Length, VirtualAddress, PhysicalAddress); + pci_free_consistent(pObj->pci_dev, Length, VirtualAddress, + PhysicalAddress); } - /* * FUNCTION: Allocate a common buffer for DMA * ARGUMENTS: @@ -175,19 +170,19 @@ void RTMP_FreeFirstTxBuffer( * VirtualAddress: Pointer to memory is returned here * PhysicalAddress: Physical address corresponding to virtual address */ -void RTMP_AllocateSharedMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) +void RTMP_AllocateSharedMemory(IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID * VirtualAddress, + OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) { - POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - *VirtualAddress = (PVOID)pci_alloc_consistent(pObj->pci_dev,sizeof(char)*Length, PhysicalAddress); + *VirtualAddress = + (PVOID) pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, + PhysicalAddress); } - /* * FUNCTION: Allocate a packet buffer for DMA * ARGUMENTS: @@ -199,25 +194,28 @@ void RTMP_AllocateSharedMemory( * Notes: * Cached is ignored: always cached memory */ -PNDIS_PACKET RTMP_AllocateRxPacketBuffer( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) +PNDIS_PACKET RTMP_AllocateRxPacketBuffer(IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID * VirtualAddress, + OUT PNDIS_PHYSICAL_ADDRESS + PhysicalAddress) { struct sk_buff *pkt; pkt = dev_alloc_skb(Length); if (pkt == NULL) { - DBGPRINT(RT_DEBUG_ERROR, ("can't allocate rx %ld size packet\n",Length)); + DBGPRINT(RT_DEBUG_ERROR, + ("can't allocate rx %ld size packet\n", Length)); } if (pkt) { RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pkt), PKTSRC_NDIS); *VirtualAddress = (PVOID) pkt->data; - *PhysicalAddress = PCI_MAP_SINGLE(pAd, *VirtualAddress, Length, -1, PCI_DMA_FROMDEVICE); + *PhysicalAddress = + PCI_MAP_SINGLE(pAd, *VirtualAddress, Length, -1, + PCI_DMA_FROMDEVICE); } else { *VirtualAddress = (PVOID) NULL; *PhysicalAddress = (NDIS_PHYSICAL_ADDRESS) NULL; @@ -226,36 +224,40 @@ PNDIS_PACKET RTMP_AllocateRxPacketBuffer( return (PNDIS_PACKET) pkt; } - -VOID Invalid_Remaining_Packet( - IN PRTMP_ADAPTER pAd, - IN ULONG VirtualAddress) +VOID Invalid_Remaining_Packet(IN PRTMP_ADAPTER pAd, IN ULONG VirtualAddress) { NDIS_PHYSICAL_ADDRESS PhysicalAddress; - PhysicalAddress = PCI_MAP_SINGLE(pAd, (void *)(VirtualAddress+1600), RX_BUFFER_NORMSIZE-1600, -1, PCI_DMA_FROMDEVICE); + PhysicalAddress = + PCI_MAP_SINGLE(pAd, (void *)(VirtualAddress + 1600), + RX_BUFFER_NORMSIZE - 1600, -1, PCI_DMA_FROMDEVICE); } -NDIS_STATUS RtmpNetTaskInit(IN RTMP_ADAPTER *pAd) +NDIS_STATUS RtmpNetTaskInit(IN RTMP_ADAPTER * pAd) { POS_COOKIE pObj; pObj = (POS_COOKIE) pAd->OS_Cookie; tasklet_init(&pObj->rx_done_task, rx_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->mgmt_dma_done_task, mgmt_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac0_dma_done_task, ac0_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac1_dma_done_task, ac1_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac2_dma_done_task, ac2_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac3_dma_done_task, ac3_dma_done_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->mgmt_dma_done_task, mgmt_dma_done_tasklet, + (unsigned long)pAd); + tasklet_init(&pObj->ac0_dma_done_task, ac0_dma_done_tasklet, + (unsigned long)pAd); + tasklet_init(&pObj->ac1_dma_done_task, ac1_dma_done_tasklet, + (unsigned long)pAd); + tasklet_init(&pObj->ac2_dma_done_task, ac2_dma_done_tasklet, + (unsigned long)pAd); + tasklet_init(&pObj->ac3_dma_done_task, ac3_dma_done_tasklet, + (unsigned long)pAd); tasklet_init(&pObj->tbtt_task, tbtt_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->fifo_statistic_full_task, fifo_statistic_full_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->fifo_statistic_full_task, + fifo_statistic_full_tasklet, (unsigned long)pAd); return NDIS_STATUS_SUCCESS; } - -void RtmpNetTaskExit(IN RTMP_ADAPTER *pAd) +void RtmpNetTaskExit(IN RTMP_ADAPTER * pAd) { POS_COOKIE pObj; @@ -271,15 +273,12 @@ void RtmpNetTaskExit(IN RTMP_ADAPTER *pAd) tasklet_kill(&pObj->fifo_statistic_full_task); } - -NDIS_STATUS RtmpMgmtTaskInit(IN RTMP_ADAPTER *pAd) +NDIS_STATUS RtmpMgmtTaskInit(IN RTMP_ADAPTER * pAd) { - return NDIS_STATUS_SUCCESS; } - /* ======================================================================== Routine Description: @@ -294,15 +293,12 @@ Return Value: Note: ======================================================================== */ -VOID RtmpMgmtTaskExit( - IN RTMP_ADAPTER *pAd) +VOID RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd) { - return; } - static inline void rt2860_int_enable(PRTMP_ADAPTER pAd, unsigned int mode) { u32 regValue; @@ -311,31 +307,28 @@ static inline void rt2860_int_enable(PRTMP_ADAPTER pAd, unsigned int mode) regValue = pAd->int_enable_reg & ~(pAd->int_disable_mask); //if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { - RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); // 1:enable + RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); // 1:enable } //else - // DBGPRINT(RT_DEBUG_TRACE, ("fOP_STATUS_DOZE !\n")); + // DBGPRINT(RT_DEBUG_TRACE, ("fOP_STATUS_DOZE !\n")); if (regValue != 0) RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE); } - static inline void rt2860_int_disable(PRTMP_ADAPTER pAd, unsigned int mode) { u32 regValue; pAd->int_disable_mask |= mode; - regValue = pAd->int_enable_reg & ~(pAd->int_disable_mask); - RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); // 0: disable + regValue = pAd->int_enable_reg & ~(pAd->int_disable_mask); + RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); // 0: disable - if (regValue == 0) - { + if (regValue == 0) { RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE); } } - /*************************************************************************** * * tasklet related procedures. @@ -345,17 +338,18 @@ static void mgmt_dma_done_tasklet(unsigned long data) { unsigned long flags; PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - INT_SOURCE_CSR_STRUC IntSource; + INT_SOURCE_CSR_STRUC IntSource; POS_COOKIE pObj; // Do nothing if the driver is starting halt state. // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + if (RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (POS_COOKIE) pAd->OS_Cookie; -// printk("mgmt_dma_done_process\n"); +// printk("mgmt_dma_done_process\n"); IntSource.word = 0; IntSource.field.MgmtDmaDone = 1; pAd->int_pending &= ~INT_MGMT_DLY; @@ -368,8 +362,7 @@ static void mgmt_dma_done_tasklet(unsigned long data) /* * double check to avoid lose of interrupts */ - if (pAd->int_pending & INT_MGMT_DLY) - { + if (pAd->int_pending & INT_MGMT_DLY) { tasklet_hi_schedule(&pObj->mgmt_dma_done_task); RTMP_INT_UNLOCK(&pAd->irq_lock, flags); return; @@ -380,30 +373,29 @@ static void mgmt_dma_done_tasklet(unsigned long data) RTMP_INT_UNLOCK(&pAd->irq_lock, flags); } - static void rx_done_tasklet(unsigned long data) { unsigned long flags; PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - BOOLEAN bReschedule = 0; + BOOLEAN bReschedule = 0; POS_COOKIE pObj; // Do nothing if the driver is starting halt state. // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + if (RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (POS_COOKIE) pAd->OS_Cookie; pAd->int_pending &= ~(INT_RX); - bReschedule = STARxDoneInterruptHandle(pAd, 0); + bReschedule = STARxDoneInterruptHandle(pAd, 0); RTMP_INT_LOCK(&pAd->irq_lock, flags); /* * double check to avoid rotting packet */ - if (pAd->int_pending & INT_RX || bReschedule) - { + if (pAd->int_pending & INT_RX || bReschedule) { tasklet_hi_schedule(&pObj->rx_done_task); RTMP_INT_UNLOCK(&pAd->irq_lock, flags); return; @@ -415,7 +407,6 @@ static void rx_done_tasklet(unsigned long data) } - void fifo_statistic_full_tasklet(unsigned long data) { unsigned long flags; @@ -424,10 +415,11 @@ void fifo_statistic_full_tasklet(unsigned long data) // Do nothing if the driver is starting halt state. // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + if (RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (POS_COOKIE) pAd->OS_Cookie; pAd->int_pending &= ~(FifoStaFullInt); NICUpdateFifoStaCounters(pAd); @@ -436,8 +428,7 @@ void fifo_statistic_full_tasklet(unsigned long data) /* * double check to avoid rotting packet */ - if (pAd->int_pending & FifoStaFullInt) - { + if (pAd->int_pending & FifoStaFullInt) { tasklet_hi_schedule(&pObj->fifo_statistic_full_task); RTMP_INT_UNLOCK(&pAd->irq_lock, flags); return; @@ -454,18 +445,19 @@ static void ac3_dma_done_tasklet(unsigned long data) { unsigned long flags; PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - INT_SOURCE_CSR_STRUC IntSource; + INT_SOURCE_CSR_STRUC IntSource; POS_COOKIE pObj; BOOLEAN bReschedule = 0; // Do nothing if the driver is starting halt state. // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + if (RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (POS_COOKIE) pAd->OS_Cookie; -// printk("ac0_dma_done_process\n"); +// printk("ac0_dma_done_process\n"); IntSource.word = 0; IntSource.field.Ac3DmaDone = 1; pAd->int_pending &= ~INT_AC3_DLY; @@ -476,8 +468,7 @@ static void ac3_dma_done_tasklet(unsigned long data) /* * double check to avoid lose of interrupts */ - if ((pAd->int_pending & INT_AC3_DLY) || bReschedule) - { + if ((pAd->int_pending & INT_AC3_DLY) || bReschedule) { tasklet_hi_schedule(&pObj->ac3_dma_done_task); RTMP_INT_UNLOCK(&pAd->irq_lock, flags); return; @@ -488,21 +479,21 @@ static void ac3_dma_done_tasklet(unsigned long data) RTMP_INT_UNLOCK(&pAd->irq_lock, flags); } - static void ac2_dma_done_tasklet(unsigned long data) { unsigned long flags; PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - INT_SOURCE_CSR_STRUC IntSource; + INT_SOURCE_CSR_STRUC IntSource; POS_COOKIE pObj; BOOLEAN bReschedule = 0; // Do nothing if the driver is starting halt state. // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + if (RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (POS_COOKIE) pAd->OS_Cookie; IntSource.word = 0; IntSource.field.Ac2DmaDone = 1; @@ -515,8 +506,7 @@ static void ac2_dma_done_tasklet(unsigned long data) /* * double check to avoid lose of interrupts */ - if ((pAd->int_pending & INT_AC2_DLY) || bReschedule) - { + if ((pAd->int_pending & INT_AC2_DLY) || bReschedule) { tasklet_hi_schedule(&pObj->ac2_dma_done_task); RTMP_INT_UNLOCK(&pAd->irq_lock, flags); return; @@ -527,23 +517,23 @@ static void ac2_dma_done_tasklet(unsigned long data) RTMP_INT_UNLOCK(&pAd->irq_lock, flags); } - static void ac1_dma_done_tasklet(unsigned long data) { unsigned long flags; PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - INT_SOURCE_CSR_STRUC IntSource; + INT_SOURCE_CSR_STRUC IntSource; POS_COOKIE pObj; BOOLEAN bReschedule = 0; // Do nothing if the driver is starting halt state. // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + if (RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (POS_COOKIE) pAd->OS_Cookie; -// printk("ac0_dma_done_process\n"); +// printk("ac0_dma_done_process\n"); IntSource.word = 0; IntSource.field.Ac1DmaDone = 1; pAd->int_pending &= ~INT_AC1_DLY; @@ -554,8 +544,7 @@ static void ac1_dma_done_tasklet(unsigned long data) /* * double check to avoid lose of interrupts */ - if ((pAd->int_pending & INT_AC1_DLY) || bReschedule) - { + if ((pAd->int_pending & INT_AC1_DLY) || bReschedule) { tasklet_hi_schedule(&pObj->ac1_dma_done_task); RTMP_INT_UNLOCK(&pAd->irq_lock, flags); return; @@ -566,36 +555,35 @@ static void ac1_dma_done_tasklet(unsigned long data) RTMP_INT_UNLOCK(&pAd->irq_lock, flags); } - static void ac0_dma_done_tasklet(unsigned long data) { unsigned long flags; PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - INT_SOURCE_CSR_STRUC IntSource; + INT_SOURCE_CSR_STRUC IntSource; POS_COOKIE pObj; BOOLEAN bReschedule = 0; // Do nothing if the driver is starting halt state. // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + if (RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; pObj = (POS_COOKIE) pAd->OS_Cookie; -// printk("ac0_dma_done_process\n"); +// printk("ac0_dma_done_process\n"); IntSource.word = 0; IntSource.field.Ac0DmaDone = 1; pAd->int_pending &= ~INT_AC0_DLY; -// RTMPHandleMgmtRingDmaDoneInterrupt(pAd); +// RTMPHandleMgmtRingDmaDoneInterrupt(pAd); bReschedule = RTMPHandleTxRingDmaDoneInterrupt(pAd, IntSource); RTMP_INT_LOCK(&pAd->irq_lock, flags); /* * double check to avoid lose of interrupts */ - if ((pAd->int_pending & INT_AC0_DLY) || bReschedule) - { + if ((pAd->int_pending & INT_AC0_DLY) || bReschedule) { tasklet_hi_schedule(&pObj->ac0_dma_done_task); RTMP_INT_UNLOCK(&pAd->irq_lock, flags); return; @@ -606,9 +594,6 @@ static void ac0_dma_done_tasklet(unsigned long data) RTMP_INT_UNLOCK(&pAd->irq_lock, flags); } - - - /*************************************************************************** * * interrupt handler related procedures. @@ -618,27 +603,25 @@ int print_int_count; IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) { - struct net_device *net_dev = (struct net_device *) dev_instance; + struct net_device *net_dev = (struct net_device *)dev_instance; PRTMP_ADAPTER pAd = NULL; - INT_SOURCE_CSR_STRUC IntSource; + INT_SOURCE_CSR_STRUC IntSource; POS_COOKIE pObj; GET_PAD_FROM_NET_DEV(pAd, net_dev); pObj = (POS_COOKIE) pAd->OS_Cookie; - /* Note 03312008: we can not return here before - RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IntSource.word); - RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, IntSource.word); - Or kernel will panic after ifconfig ra0 down sometimes */ - + RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IntSource.word); + RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, IntSource.word); + Or kernel will panic after ifconfig ra0 down sometimes */ // // Inital the Interrupt source. // IntSource.word = 0x00000000L; -// McuIntSource.word = 0x00000000L; +// McuIntSource.word = 0x00000000L; // // Get the interrupt sources & saved to local variable @@ -655,25 +638,26 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) // // RT2661 => when ASIC is sleeping, MAC register cannot be read and written. // RT2860 => when ASIC is sleeping, MAC register can be read and written. -// if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) +// if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IntSource.word); - RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, IntSource.word); // write 1 to clear + RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, IntSource.word); // write 1 to clear } -// else -// DBGPRINT(RT_DEBUG_TRACE, (">>>fOP_STATUS_DOZE<<<\n")); +// else +// DBGPRINT(RT_DEBUG_TRACE, (">>>fOP_STATUS_DOZE<<<\n")); -// RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IsrAfterClear); -// RTMP_IO_READ32(pAd, MCU_INT_SOURCE_CSR, &McuIsrAfterClear); -// DBGPRINT(RT_DEBUG_INFO, ("====> RTMPHandleInterrupt(ISR=%08x,Mcu ISR=%08x, After clear ISR=%08x, MCU ISR=%08x)\n", -// IntSource.word, McuIntSource.word, IsrAfterClear, McuIsrAfterClear)); +// RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IsrAfterClear); +// RTMP_IO_READ32(pAd, MCU_INT_SOURCE_CSR, &McuIsrAfterClear); +// DBGPRINT(RT_DEBUG_INFO, ("====> RTMPHandleInterrupt(ISR=%08x,Mcu ISR=%08x, After clear ISR=%08x, MCU ISR=%08x)\n", +// IntSource.word, McuIntSource.word, IsrAfterClear, McuIsrAfterClear)); // Do nothing if Reset in progress - if (RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS |fRTMP_ADAPTER_HALT_IN_PROGRESS))) - { - return IRQ_HANDLED; + if (RTMP_TEST_FLAG + (pAd, + (fRTMP_ADAPTER_RESET_IN_PROGRESS | + fRTMP_ADAPTER_HALT_IN_PROGRESS))) { + return IRQ_HANDLED; } - // // Handle interrupt, walk through all bits // Should start from highest priority interrupt @@ -684,7 +668,6 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) #endif - pAd->bPCIclkOff = FALSE; // If required spinlock, each interrupt service routine has to acquire @@ -692,28 +675,25 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) // // Do nothing if NIC doesn't exist - if (IntSource.word == 0xffffffff) - { - RTMP_SET_FLAG(pAd, (fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_HALT_IN_PROGRESS)); - return IRQ_HANDLED; + if (IntSource.word == 0xffffffff) { + RTMP_SET_FLAG(pAd, + (fRTMP_ADAPTER_NIC_NOT_EXIST | + fRTMP_ADAPTER_HALT_IN_PROGRESS)); + return IRQ_HANDLED; } - if (IntSource.word & TxCoherent) - { + if (IntSource.word & TxCoherent) { DBGPRINT(RT_DEBUG_ERROR, (">>>TxCoherent<<<\n")); RTMPHandleRxCoherentInterrupt(pAd); } - if (IntSource.word & RxCoherent) - { + if (IntSource.word & RxCoherent) { DBGPRINT(RT_DEBUG_ERROR, (">>>RxCoherent<<<\n")); RTMPHandleRxCoherentInterrupt(pAd); } - if (IntSource.word & FifoStaFullInt) - { - if ((pAd->int_disable_mask & FifoStaFullInt) == 0) - { + if (IntSource.word & FifoStaFullInt) { + if ((pAd->int_disable_mask & FifoStaFullInt) == 0) { /* mask FifoStaFullInt */ rt2860_int_disable(pAd, FifoStaFullInt); tasklet_hi_schedule(&pObj->fifo_statistic_full_task); @@ -721,20 +701,16 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) pAd->int_pending |= FifoStaFullInt; } - if (IntSource.word & INT_MGMT_DLY) - { - if ((pAd->int_disable_mask & INT_MGMT_DLY) ==0 ) - { + if (IntSource.word & INT_MGMT_DLY) { + if ((pAd->int_disable_mask & INT_MGMT_DLY) == 0) { rt2860_int_disable(pAd, INT_MGMT_DLY); tasklet_hi_schedule(&pObj->mgmt_dma_done_task); } - pAd->int_pending |= INT_MGMT_DLY ; + pAd->int_pending |= INT_MGMT_DLY; } - if (IntSource.word & INT_RX) - { - if ((pAd->int_disable_mask & INT_RX) == 0) - { + if (IntSource.word & INT_RX) { + if ((pAd->int_disable_mask & INT_RX) == 0) { /* mask RxINT */ rt2860_int_disable(pAd, INT_RX); @@ -743,11 +719,9 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) pAd->int_pending |= INT_RX; } - if (IntSource.word & INT_AC3_DLY) - { + if (IntSource.word & INT_AC3_DLY) { - if ((pAd->int_disable_mask & INT_AC3_DLY) == 0) - { + if ((pAd->int_disable_mask & INT_AC3_DLY) == 0) { /* mask TxDataInt */ rt2860_int_disable(pAd, INT_AC3_DLY); tasklet_hi_schedule(&pObj->ac3_dma_done_task); @@ -755,11 +729,9 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) pAd->int_pending |= INT_AC3_DLY; } - if (IntSource.word & INT_AC2_DLY) - { + if (IntSource.word & INT_AC2_DLY) { - if ((pAd->int_disable_mask & INT_AC2_DLY) == 0) - { + if ((pAd->int_disable_mask & INT_AC2_DLY) == 0) { /* mask TxDataInt */ rt2860_int_disable(pAd, INT_AC2_DLY); tasklet_hi_schedule(&pObj->ac2_dma_done_task); @@ -767,13 +739,11 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) pAd->int_pending |= INT_AC2_DLY; } - if (IntSource.word & INT_AC1_DLY) - { + if (IntSource.word & INT_AC1_DLY) { pAd->int_pending |= INT_AC1_DLY; - if ((pAd->int_disable_mask & INT_AC1_DLY) == 0) - { + if ((pAd->int_disable_mask & INT_AC1_DLY) == 0) { /* mask TxDataInt */ rt2860_int_disable(pAd, INT_AC1_DLY); tasklet_hi_schedule(&pObj->ac1_dma_done_task); @@ -781,8 +751,7 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) } - if (IntSource.word & INT_AC0_DLY) - { + if (IntSource.word & INT_AC0_DLY) { /* if (IntSource.word & 0x2) { @@ -793,8 +762,7 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) */ pAd->int_pending |= INT_AC0_DLY; - if ((pAd->int_disable_mask & INT_AC0_DLY) == 0) - { + if ((pAd->int_disable_mask & INT_AC0_DLY) == 0) { /* mask TxDataInt */ rt2860_int_disable(pAd, INT_AC0_DLY); tasklet_hi_schedule(&pObj->ac0_dma_done_task); @@ -802,14 +770,11 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) } - - if (IntSource.word & PreTBTTInt) - { + if (IntSource.word & PreTBTTInt) { RTMPHandlePreTBTTInterrupt(pAd); } - if (IntSource.word & TBTTInt) - { + if (IntSource.word & TBTTInt) { RTMPHandleTBTTInterrupt(pAd); } @@ -818,57 +783,57 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) RTMPHandleTwakeupInterrupt(pAd); } - return IRQ_HANDLED; + return IRQ_HANDLED; } /* * invaild or writeback cache * and convert virtual address to physical address */ -dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, int sd_idx, int direction) +dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, + int sd_idx, int direction) { PRTMP_ADAPTER pAd; POS_COOKIE pObj; /* - ------ Porting Information ------ - > For Tx Alloc: - mgmt packets => sd_idx = 0 - SwIdx: pAd->MgmtRing.TxCpuIdx - pTxD : pAd->MgmtRing.Cell[SwIdx].AllocVa; - - data packets => sd_idx = 1 - TxIdx : pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx - QueIdx: pTxBlk->QueIdx - pTxD : pAd->TxRing[pTxBlk->QueIdx].Cell[TxIdx].AllocVa; - - > For Rx Alloc: - sd_idx = -1 - */ + ------ Porting Information ------ + > For Tx Alloc: + mgmt packets => sd_idx = 0 + SwIdx: pAd->MgmtRing.TxCpuIdx + pTxD : pAd->MgmtRing.Cell[SwIdx].AllocVa; + + data packets => sd_idx = 1 + TxIdx : pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx + QueIdx: pTxBlk->QueIdx + pTxD : pAd->TxRing[pTxBlk->QueIdx].Cell[TxIdx].AllocVa; + + > For Rx Alloc: + sd_idx = -1 + */ - pAd = (PRTMP_ADAPTER)handle; - pObj = (POS_COOKIE)pAd->OS_Cookie; + pAd = (PRTMP_ADAPTER) handle; + pObj = (POS_COOKIE) pAd->OS_Cookie; - if (sd_idx == 1) - { - PTX_BLK pTxBlk; - pTxBlk = (PTX_BLK)ptr; - return pci_map_single(pObj->pci_dev, pTxBlk->pSrcBufData, pTxBlk->SrcBufLen, direction); - } - else - { + if (sd_idx == 1) { + PTX_BLK pTxBlk; + pTxBlk = (PTX_BLK) ptr; + return pci_map_single(pObj->pci_dev, pTxBlk->pSrcBufData, + pTxBlk->SrcBufLen, direction); + } else { return pci_map_single(pObj->pci_dev, ptr, size, direction); } } -void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int direction) +void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, + int direction) { PRTMP_ADAPTER pAd; POS_COOKIE pObj; - pAd=(PRTMP_ADAPTER)handle; - pObj = (POS_COOKIE)pAd->OS_Cookie; + pAd = (PRTMP_ADAPTER) handle; + pObj = (POS_COOKIE) pAd->OS_Cookie; pci_unmap_single(pObj->pci_dev, dma_addr, size, direction); diff --git a/drivers/staging/rt2860/rt_usb.c b/drivers/staging/rt2860/rt_usb.c index 1e6d347a9663..30fc4bb750ff 100644 --- a/drivers/staging/rt2860/rt_usb.c +++ b/drivers/staging/rt2860/rt_usb.c @@ -38,7 +38,7 @@ #include "rt_config.h" - void dump_urb(struct urb* purb) +void dump_urb(struct urb *purb) { printk("urb :0x%08lx\n", (unsigned long)purb); printk("\tdev :0x%08lx\n", (unsigned long)purb->dev); @@ -46,16 +46,20 @@ printk("\tpipe :0x%08x\n", purb->pipe); printk("\tstatus :%d\n", purb->status); printk("\ttransfer_flags :0x%08x\n", purb->transfer_flags); - printk("\ttransfer_buffer :0x%08lx\n", (unsigned long)purb->transfer_buffer); + printk("\ttransfer_buffer :0x%08lx\n", + (unsigned long)purb->transfer_buffer); printk("\ttransfer_buffer_length:%d\n", purb->transfer_buffer_length); printk("\tactual_length :%d\n", purb->actual_length); - printk("\tsetup_packet :0x%08lx\n", (unsigned long)purb->setup_packet); + printk("\tsetup_packet :0x%08lx\n", + (unsigned long)purb->setup_packet); printk("\tstart_frame :%d\n", purb->start_frame); printk("\tnumber_of_packets :%d\n", purb->number_of_packets); printk("\tinterval :%d\n", purb->interval); printk("\terror_count :%d\n", purb->error_count); - printk("\tcontext :0x%08lx\n", (unsigned long)purb->context); - printk("\tcomplete :0x%08lx\n\n", (unsigned long)purb->complete); + printk("\tcontext :0x%08lx\n", + (unsigned long)purb->context); + printk("\tcomplete :0x%08lx\n\n", + (unsigned long)purb->complete); } /* @@ -73,23 +77,22 @@ Return Value: Note: ======================================================================== */ -NDIS_STATUS RtmpMgmtTaskInit( - IN RTMP_ADAPTER *pAd) +NDIS_STATUS RtmpMgmtTaskInit(IN RTMP_ADAPTER * pAd) { RTMP_OS_TASK *pTask; NDIS_STATUS status; /* - Creat TimerQ Thread, We need init timerQ related structure before create the timer thread. - */ + Creat TimerQ Thread, We need init timerQ related structure before create the timer thread. + */ RtmpTimerQInit(pAd); pTask = &pAd->timerTask; RtmpOSTaskInit(pTask, "RtmpTimerTask", pAd); status = RtmpOSTaskAttach(pTask, RtmpTimerQThread, pTask); - if (status == NDIS_STATUS_FAILURE) - { - printk (KERN_WARNING "%s: unable to start RtmpTimerQThread\n", RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev)); + if (status == NDIS_STATUS_FAILURE) { + printk(KERN_WARNING "%s: unable to start RtmpTimerQThread\n", + RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev)); return NDIS_STATUS_FAILURE; } @@ -97,9 +100,9 @@ NDIS_STATUS RtmpMgmtTaskInit( pTask = &pAd->mlmeTask; RtmpOSTaskInit(pTask, "RtmpMlmeTask", pAd); status = RtmpOSTaskAttach(pTask, MlmeThread, pTask); - if (status == NDIS_STATUS_FAILURE) - { - printk (KERN_WARNING "%s: unable to start MlmeThread\n", RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev)); + if (status == NDIS_STATUS_FAILURE) { + printk(KERN_WARNING "%s: unable to start MlmeThread\n", + RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev)); return NDIS_STATUS_FAILURE; } @@ -107,18 +110,15 @@ NDIS_STATUS RtmpMgmtTaskInit( pTask = &pAd->cmdQTask; RtmpOSTaskInit(pTask, "RtmpCmdQTask", pAd); status = RtmpOSTaskAttach(pTask, RTUSBCmdThread, pTask); - if (status == NDIS_STATUS_FAILURE) - { - printk (KERN_WARNING "%s: unable to start RTUSBCmdThread\n", RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev)); + if (status == NDIS_STATUS_FAILURE) { + printk(KERN_WARNING "%s: unable to start RTUSBCmdThread\n", + RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev)); return NDIS_STATUS_FAILURE; } - return NDIS_STATUS_SUCCESS; } - - /* ======================================================================== Routine Description: @@ -133,11 +133,10 @@ Return Value: Note: ======================================================================== */ -VOID RtmpMgmtTaskExit( - IN RTMP_ADAPTER *pAd) +VOID RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd) { - INT ret; - RTMP_OS_TASK *pTask; + INT ret; + RTMP_OS_TASK *pTask; // Sleep 50 milliseconds so pending io might finish normally RTMPusecDelay(50000); @@ -153,10 +152,11 @@ VOID RtmpMgmtTaskExit( /* Terminate Mlme Thread */ pTask = &pAd->mlmeTask; ret = RtmpOSTaskKill(pTask); - if (ret == NDIS_STATUS_FAILURE) - { + if (ret == NDIS_STATUS_FAILURE) { DBGPRINT(RT_DEBUG_ERROR, ("%s: kill task(%s) failed!\n", - RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev), pTask->taskName)); + RTMP_OS_NETDEV_GET_DEVNAME(pAd-> + net_dev), + pTask->taskName)); } /* Terminate cmdQ thread */ @@ -174,10 +174,11 @@ VOID RtmpMgmtTaskExit( mb(); //RTUSBCMDUp(pAd); ret = RtmpOSTaskKill(pTask); - if (ret == NDIS_STATUS_FAILURE) - { + if (ret == NDIS_STATUS_FAILURE) { DBGPRINT(RT_DEBUG_ERROR, ("%s: kill task(%s) failed!\n", - RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev), pTask->taskName)); + RTMP_OS_NETDEV_GET_DEVNAME + (pAd->net_dev), + pTask->taskName)); } pAd->CmdQ.CmdQState = RTMP_TASK_STAT_UNKNOWN; } @@ -185,47 +186,44 @@ VOID RtmpMgmtTaskExit( /* Terminate timer thread */ pTask = &pAd->timerTask; ret = RtmpOSTaskKill(pTask); - if (ret == NDIS_STATUS_FAILURE) - { + if (ret == NDIS_STATUS_FAILURE) { DBGPRINT(RT_DEBUG_ERROR, ("%s: kill task(%s) failed!\n", - RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev), pTask->taskName)); + RTMP_OS_NETDEV_GET_DEVNAME(pAd-> + net_dev), + pTask->taskName)); } - } - static void rtusb_dataout_complete(unsigned long data) { - PRTMP_ADAPTER pAd; - purbb_t pUrb; - POS_COOKIE pObj; - PHT_TX_CONTEXT pHTTXContext; - UCHAR BulkOutPipeId; - NTSTATUS Status; - unsigned long IrqFlags; - - - pUrb = (purbb_t)data; - pHTTXContext = (PHT_TX_CONTEXT)pUrb->context; - pAd = pHTTXContext->pAd; - pObj = (POS_COOKIE) pAd->OS_Cookie; - Status = pUrb->status; + PRTMP_ADAPTER pAd; + purbb_t pUrb; + POS_COOKIE pObj; + PHT_TX_CONTEXT pHTTXContext; + UCHAR BulkOutPipeId; + NTSTATUS Status; + unsigned long IrqFlags; + + pUrb = (purbb_t) data; + pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; + pAd = pHTTXContext->pAd; + pObj = (POS_COOKIE) pAd->OS_Cookie; + Status = pUrb->status; // Store BulkOut PipeId BulkOutPipeId = pHTTXContext->BulkOutPipeId; pAd->BulkOutDataOneSecCount++; //DBGPRINT(RT_DEBUG_LOUD, ("Done-B(%d):I=0x%lx, CWPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", BulkOutPipeId, in_interrupt(), pHTTXContext->CurWritePosition, - // pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad)); + // pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad)); RTMP_IRQ_LOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); pAd->BulkOutPending[BulkOutPipeId] = FALSE; pHTTXContext->IRPPending = FALSE; pAd->watchDogTxPendingCnt[BulkOutPipeId] = 0; - if (Status == USB_ST_NOERROR) - { + if (Status == USB_ST_NOERROR) { pAd->BulkOutComplete++; RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); @@ -235,30 +233,37 @@ static void rtusb_dataout_complete(unsigned long data) FREE_HTTX_RING(pAd, BulkOutPipeId, pHTTXContext); //RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); - - } - else // STATUS_OTHER + } else // STATUS_OTHER { - PUCHAR pBuf; + PUCHAR pBuf; pAd->BulkOutCompleteOther++; - pBuf = &pHTTXContext->TransferBuffer->field.WirelessPacket[pHTTXContext->NextBulkOutPosition]; + pBuf = + &pHTTXContext->TransferBuffer->field. + WirelessPacket[pHTTXContext->NextBulkOutPosition]; if (!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST | - fRTMP_ADAPTER_BULKOUT_RESET))) - { + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST | + fRTMP_ADAPTER_BULKOUT_RESET))) { RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); pAd->bulkResetPipeid = BulkOutPipeId; pAd->bulkResetReq[BulkOutPipeId] = pAd->BulkOutReq; } RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); - DBGPRINT_RAW(RT_DEBUG_ERROR, ("BulkOutDataPacket failed: ReasonCode=%d!\n", Status)); - DBGPRINT_RAW(RT_DEBUG_ERROR, ("\t>>BulkOut Req=0x%lx, Complete=0x%lx, Other=0x%lx\n", pAd->BulkOutReq, pAd->BulkOutComplete, pAd->BulkOutCompleteOther)); - DBGPRINT_RAW(RT_DEBUG_ERROR, ("\t>>BulkOut Header:%x %x %x %x %x %x %x %x\n", pBuf[0], pBuf[1], pBuf[2], pBuf[3], pBuf[4], pBuf[5], pBuf[6], pBuf[7])); + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("BulkOutDataPacket failed: ReasonCode=%d!\n", + Status)); + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("\t>>BulkOut Req=0x%lx, Complete=0x%lx, Other=0x%lx\n", + pAd->BulkOutReq, pAd->BulkOutComplete, + pAd->BulkOutCompleteOther)); + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("\t>>BulkOut Header:%x %x %x %x %x %x %x %x\n", + pBuf[0], pBuf[1], pBuf[2], pBuf[3], pBuf[4], + pBuf[5], pBuf[6], pBuf[7])); //DBGPRINT_RAW(RT_DEBUG_ERROR, (">>BulkOutCompleteCancel=0x%x, BulkOutCompleteOther=0x%x\n", pAd->BulkOutCompleteCancel, pAd->BulkOutCompleteOther)); } @@ -268,12 +273,17 @@ static void rtusb_dataout_complete(unsigned long data) // bWaitingBulkOut = TRUE, means the TX data are waiting for bulk out. // //RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); - if ((pHTTXContext->ENextBulkOutPosition != pHTTXContext->CurWritePosition) && - (pHTTXContext->ENextBulkOutPosition != (pHTTXContext->CurWritePosition+8)) && - !RTUSB_TEST_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_FRAG << BulkOutPipeId))) - { + if ((pHTTXContext->ENextBulkOutPosition != + pHTTXContext->CurWritePosition) + && (pHTTXContext->ENextBulkOutPosition != + (pHTTXContext->CurWritePosition + 8)) + && !RTUSB_TEST_BULK_FLAG(pAd, + (fRTUSB_BULK_OUT_DATA_FRAG << + BulkOutPipeId))) { // Indicate There is data avaliable - RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId)); + RTUSB_SET_BULK_FLAG(pAd, + (fRTUSB_BULK_OUT_DATA_NORMAL << + BulkOutPipeId)); } //RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); @@ -282,49 +292,46 @@ static void rtusb_dataout_complete(unsigned long data) RTUSBKickBulkOut(pAd); } - static void rtusb_null_frame_done_tasklet(unsigned long data) { - PRTMP_ADAPTER pAd; - PTX_CONTEXT pNullContext; - purbb_t pUrb; - NTSTATUS Status; - unsigned long irqFlag; - - - pUrb = (purbb_t)data; - pNullContext = (PTX_CONTEXT)pUrb->context; - pAd = pNullContext->pAd; - Status = pUrb->status; + PRTMP_ADAPTER pAd; + PTX_CONTEXT pNullContext; + purbb_t pUrb; + NTSTATUS Status; + unsigned long irqFlag; + + pUrb = (purbb_t) data; + pNullContext = (PTX_CONTEXT) pUrb->context; + pAd = pNullContext->pAd; + Status = pUrb->status; // Reset Null frame context flags RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], irqFlag); - pNullContext->IRPPending = FALSE; - pNullContext->InUse = FALSE; + pNullContext->IRPPending = FALSE; + pNullContext->InUse = FALSE; pAd->BulkOutPending[0] = FALSE; pAd->watchDogTxPendingCnt[0] = 0; - if (Status == USB_ST_NOERROR) - { + if (Status == USB_ST_NOERROR) { RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); - } - else // STATUS_OTHER + } else // STATUS_OTHER { if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out Null Frame Failed, ReasonCode=%d!\n", Status)); + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) { + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("Bulk Out Null Frame Failed, ReasonCode=%d!\n", + Status)); RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); - pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG); + pAd->bulkResetPipeid = + (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG); RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); - } - else - { + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, + NULL, 0); + } else { RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); } } @@ -334,46 +341,42 @@ static void rtusb_null_frame_done_tasklet(unsigned long data) RTUSBKickBulkOut(pAd); } - static void rtusb_rts_frame_done_tasklet(unsigned long data) { - PRTMP_ADAPTER pAd; - PTX_CONTEXT pRTSContext; - purbb_t pUrb; - NTSTATUS Status; - unsigned long irqFlag; - - - pUrb = (purbb_t)data; - pRTSContext = (PTX_CONTEXT)pUrb->context; - pAd = pRTSContext->pAd; - Status = pUrb->status; + PRTMP_ADAPTER pAd; + PTX_CONTEXT pRTSContext; + purbb_t pUrb; + NTSTATUS Status; + unsigned long irqFlag; + + pUrb = (purbb_t) data; + pRTSContext = (PTX_CONTEXT) pUrb->context; + pAd = pRTSContext->pAd; + Status = pUrb->status; // Reset RTS frame context flags RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], irqFlag); pRTSContext->IRPPending = FALSE; - pRTSContext->InUse = FALSE; + pRTSContext->InUse = FALSE; - if (Status == USB_ST_NOERROR) - { + if (Status == USB_ST_NOERROR) { RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); - } - else // STATUS_OTHER + } else // STATUS_OTHER { if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out RTS Frame Failed\n")); + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) { + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("Bulk Out RTS Frame Failed\n")); RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); - pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG); + pAd->bulkResetPipeid = + (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG); RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); - } - else - { + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, + NULL, 0); + } else { RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); } } @@ -386,44 +389,40 @@ static void rtusb_rts_frame_done_tasklet(unsigned long data) // The protectioon of rest bulk should be in BulkOut routine RTUSBKickBulkOut(pAd); - } - static void rtusb_pspoll_frame_done_tasklet(unsigned long data) { - PRTMP_ADAPTER pAd; - PTX_CONTEXT pPsPollContext; - purbb_t pUrb; - NTSTATUS Status; - - - - pUrb = (purbb_t)data; - pPsPollContext = (PTX_CONTEXT)pUrb->context; - pAd = pPsPollContext->pAd; - Status = pUrb->status; + PRTMP_ADAPTER pAd; + PTX_CONTEXT pPsPollContext; + purbb_t pUrb; + NTSTATUS Status; + + pUrb = (purbb_t) data; + pPsPollContext = (PTX_CONTEXT) pUrb->context; + pAd = pPsPollContext->pAd; + Status = pUrb->status; // Reset PsPoll context flags - pPsPollContext->IRPPending = FALSE; - pPsPollContext->InUse = FALSE; + pPsPollContext->IRPPending = FALSE; + pPsPollContext->InUse = FALSE; pAd->watchDogTxPendingCnt[0] = 0; - if (Status == USB_ST_NOERROR) - { + if (Status == USB_ST_NOERROR) { RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); - } - else // STATUS_OTHER + } else // STATUS_OTHER { if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out PSPoll Failed\n")); + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) { + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("Bulk Out PSPoll Failed\n")); RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); - pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG); - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); + pAd->bulkResetPipeid = + (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG); + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, + NULL, 0); } } @@ -437,7 +436,6 @@ static void rtusb_pspoll_frame_done_tasklet(unsigned long data) } - /* ======================================================================== Routine Description: @@ -454,18 +452,17 @@ Note: */ static void rx_done_tasklet(unsigned long data) { - purbb_t pUrb; - PRX_CONTEXT pRxContext; - PRTMP_ADAPTER pAd; - NTSTATUS Status; - unsigned int IrqFlags; - - pUrb = (purbb_t)data; - pRxContext = (PRX_CONTEXT)pUrb->context; - pAd = pRxContext->pAd; + purbb_t pUrb; + PRX_CONTEXT pRxContext; + PRTMP_ADAPTER pAd; + NTSTATUS Status; + unsigned int IrqFlags; + + pUrb = (purbb_t) data; + pRxContext = (PRX_CONTEXT) pUrb->context; + pAd = pRxContext->pAd; Status = pUrb->status; - RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags); pRxContext->InUse = FALSE; pRxContext->IRPPending = FALSE; @@ -473,8 +470,7 @@ static void rx_done_tasklet(unsigned long data) //NdisInterlockedDecrement(&pAd->PendingRx); pAd->PendingRx--; - if (Status == USB_ST_NOERROR) - { + if (Status == USB_ST_NOERROR) { pAd->BulkInComplete++; pAd->NextRxBulkInPosition = 0; if (pRxContext->BulkInOffset) // As jan's comment, it may bulk-in success but size is zero. @@ -483,8 +479,7 @@ static void rx_done_tasklet(unsigned long data) INC_RING_INDEX(pAd->NextRxBulkInIndex, RX_RING_SIZE); } RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); - } - else // STATUS_OTHER + } else // STATUS_OTHER { pAd->BulkInCompleteFail++; // Still read this packet although it may comtain wrong bytes. @@ -493,16 +488,19 @@ static void rx_done_tasklet(unsigned long data) // Parsing all packets. because after reset, the index will reset to all zero. if ((!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_BULKIN_RESET | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST)))) - { + fRTMP_ADAPTER_BULKIN_RESET | + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST)))) { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk In Failed. Status=%d, BIIdx=0x%x, BIRIdx=0x%x, actual_length= 0x%x\n", - Status, pAd->NextRxBulkInIndex, pAd->NextRxBulkInReadIndex, pRxContext->pUrb->actual_length)); + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("Bulk In Failed. Status=%d, BIIdx=0x%x, BIRIdx=0x%x, actual_length= 0x%x\n", + Status, pAd->NextRxBulkInIndex, + pAd->NextRxBulkInReadIndex, + pRxContext->pUrb->actual_length)); RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKIN_RESET); - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_IN, NULL, 0); + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_IN, + NULL, 0); } } @@ -510,46 +508,43 @@ static void rx_done_tasklet(unsigned long data) RTUSBBulkReceive(pAd); - return; } - static void rtusb_mgmt_dma_done_tasklet(unsigned long data) { - PRTMP_ADAPTER pAd; - PTX_CONTEXT pMLMEContext; - int index; - PNDIS_PACKET pPacket; - purbb_t pUrb; - NTSTATUS Status; - unsigned long IrqFlags; - - - pUrb = (purbb_t)data; - pMLMEContext = (PTX_CONTEXT)pUrb->context; - pAd = pMLMEContext->pAd; - Status = pUrb->status; - index = pMLMEContext->SelfIdx; + PRTMP_ADAPTER pAd; + PTX_CONTEXT pMLMEContext; + int index; + PNDIS_PACKET pPacket; + purbb_t pUrb; + NTSTATUS Status; + unsigned long IrqFlags; + + pUrb = (purbb_t) data; + pMLMEContext = (PTX_CONTEXT) pUrb->context; + pAd = pMLMEContext->pAd; + Status = pUrb->status; + index = pMLMEContext->SelfIdx; ASSERT((pAd->MgmtRing.TxDmaIdx == index)); RTMP_IRQ_LOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags); - - if (Status != USB_ST_NOERROR) - { + if (Status != USB_ST_NOERROR) { //Bulk-Out fail status handle if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out MLME Failed, Status=%d!\n", Status)); + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))) { + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("Bulk Out MLME Failed, Status=%d!\n", + Status)); // TODO: How to handle about the MLMEBulkOut failed issue. Need to resend the mgmt pkt? RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); - pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG); + pAd->bulkResetPipeid = + (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG); } } @@ -576,163 +571,141 @@ static void rtusb_mgmt_dma_done_tasklet(unsigned long data) RTMPFreeNdisPacket(pAd, pPacket); if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST)))) - { + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST)))) { // do nothing and return directly. - } - else - { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET) && - ((pAd->bulkResetPipeid & BULKOUT_MGMT_RESET_FLAG) == BULKOUT_MGMT_RESET_FLAG)) - { // For Mgmt Bulk-Out failed, ignore it now. - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); - } - else - { + } else { + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET) && ((pAd->bulkResetPipeid & BULKOUT_MGMT_RESET_FLAG) == BULKOUT_MGMT_RESET_FLAG)) { // For Mgmt Bulk-Out failed, ignore it now. + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, + NULL, 0); + } else { // Always call Bulk routine, even reset bulk. // The protectioon of rest bulk should be in BulkOut routine - if (pAd->MgmtRing.TxSwFreeIdx < MGMT_RING_SIZE /* pMLMEContext->bWaitingBulkOut == TRUE */) - { + if (pAd->MgmtRing.TxSwFreeIdx < + MGMT_RING_SIZE + /* pMLMEContext->bWaitingBulkOut == TRUE */ ) { RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_MLME); } - RTUSBKickBulkOut(pAd); - } + RTUSBKickBulkOut(pAd); } - + } } static void rtusb_ac3_dma_done_tasklet(unsigned long data) { - PRTMP_ADAPTER pAd; - PHT_TX_CONTEXT pHTTXContext; - UCHAR BulkOutPipeId = 3; - purbb_t pUrb; - + PRTMP_ADAPTER pAd; + PHT_TX_CONTEXT pHTTXContext; + UCHAR BulkOutPipeId = 3; + purbb_t pUrb; - pUrb = (purbb_t)data; - pHTTXContext = (PHT_TX_CONTEXT)pUrb->context; - pAd = pHTTXContext->pAd; + pUrb = (purbb_t) data; + pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; + pAd = pHTTXContext->pAd; rtusb_dataout_complete((unsigned long)pUrb); if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST)))) - { + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST)))) { // do nothing and return directly. - } - else - { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) - { - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); - } - else - { pHTTXContext = &pAd->TxContext[BulkOutPipeId]; + } else { + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) { + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, + NULL, 0); + } else { + pHTTXContext = &pAd->TxContext[BulkOutPipeId]; if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) && - /*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */ - (pAd->DeQueueRunning[BulkOutPipeId] == FALSE) && - (pHTTXContext->bCurWriting == FALSE)) - { - RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS); + /*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */ + (pAd->DeQueueRunning[BulkOutPipeId] == FALSE) && + (pHTTXContext->bCurWriting == FALSE)) { + RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, + MAX_TX_PROCESS); } - RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL<<3); + RTUSB_SET_BULK_FLAG(pAd, + fRTUSB_BULK_OUT_DATA_NORMAL << 3); RTUSBKickBulkOut(pAd); } } - return; } - static void rtusb_ac2_dma_done_tasklet(unsigned long data) { - PRTMP_ADAPTER pAd; - PHT_TX_CONTEXT pHTTXContext; - UCHAR BulkOutPipeId = 2; - purbb_t pUrb; - + PRTMP_ADAPTER pAd; + PHT_TX_CONTEXT pHTTXContext; + UCHAR BulkOutPipeId = 2; + purbb_t pUrb; - pUrb = (purbb_t)data; - pHTTXContext = (PHT_TX_CONTEXT)pUrb->context; - pAd = pHTTXContext->pAd; + pUrb = (purbb_t) data; + pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; + pAd = pHTTXContext->pAd; rtusb_dataout_complete((unsigned long)pUrb); if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST)))) - { + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST)))) { // do nothing and return directly. - } - else - { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) - { - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); - } - else - { pHTTXContext = &pAd->TxContext[BulkOutPipeId]; + } else { + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) { + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, + NULL, 0); + } else { + pHTTXContext = &pAd->TxContext[BulkOutPipeId]; if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) && - /*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */ - (pAd->DeQueueRunning[BulkOutPipeId] == FALSE) && - (pHTTXContext->bCurWriting == FALSE)) - { - RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS); + /*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */ + (pAd->DeQueueRunning[BulkOutPipeId] == FALSE) && + (pHTTXContext->bCurWriting == FALSE)) { + RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, + MAX_TX_PROCESS); } - RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL<<2); + RTUSB_SET_BULK_FLAG(pAd, + fRTUSB_BULK_OUT_DATA_NORMAL << 2); RTUSBKickBulkOut(pAd); } } - return; } - static void rtusb_ac1_dma_done_tasklet(unsigned long data) { - PRTMP_ADAPTER pAd; - PHT_TX_CONTEXT pHTTXContext; - UCHAR BulkOutPipeId = 1; - purbb_t pUrb; - + PRTMP_ADAPTER pAd; + PHT_TX_CONTEXT pHTTXContext; + UCHAR BulkOutPipeId = 1; + purbb_t pUrb; - pUrb = (purbb_t)data; - pHTTXContext = (PHT_TX_CONTEXT)pUrb->context; - pAd = pHTTXContext->pAd; + pUrb = (purbb_t) data; + pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; + pAd = pHTTXContext->pAd; rtusb_dataout_complete((unsigned long)pUrb); if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST)))) - { + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST)))) { // do nothing and return directly. - } - else - { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) - { - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); - } - else - { pHTTXContext = &pAd->TxContext[BulkOutPipeId]; + } else { + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) { + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, + NULL, 0); + } else { + pHTTXContext = &pAd->TxContext[BulkOutPipeId]; if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) && - /*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */ - (pAd->DeQueueRunning[BulkOutPipeId] == FALSE) && - (pHTTXContext->bCurWriting == FALSE)) - { - RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS); + /*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */ + (pAd->DeQueueRunning[BulkOutPipeId] == FALSE) && + (pHTTXContext->bCurWriting == FALSE)) { + RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, + MAX_TX_PROCESS); } - RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL<<1); + RTUSB_SET_BULK_FLAG(pAd, + fRTUSB_BULK_OUT_DATA_NORMAL << 1); RTUSBKickBulkOut(pAd); } } @@ -740,41 +713,35 @@ static void rtusb_ac1_dma_done_tasklet(unsigned long data) } - static void rtusb_ac0_dma_done_tasklet(unsigned long data) { - PRTMP_ADAPTER pAd; - PHT_TX_CONTEXT pHTTXContext; - UCHAR BulkOutPipeId = 0; - purbb_t pUrb; + PRTMP_ADAPTER pAd; + PHT_TX_CONTEXT pHTTXContext; + UCHAR BulkOutPipeId = 0; + purbb_t pUrb; - - pUrb = (purbb_t)data; - pHTTXContext = (PHT_TX_CONTEXT)pUrb->context; - pAd = pHTTXContext->pAd; + pUrb = (purbb_t) data; + pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; + pAd = pHTTXContext->pAd; rtusb_dataout_complete((unsigned long)pUrb); if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST)))) - { + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST)))) { // do nothing and return directly. - } - else - { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) - { - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); - } - else - { pHTTXContext = &pAd->TxContext[BulkOutPipeId]; + } else { + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) { + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, + NULL, 0); + } else { + pHTTXContext = &pAd->TxContext[BulkOutPipeId]; if ((pAd->TxSwQueue[BulkOutPipeId].Number > 0) && - /* ((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */ - (pAd->DeQueueRunning[BulkOutPipeId] == FALSE) && - (pHTTXContext->bCurWriting == FALSE)) - { - RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS); + /* ((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */ + (pAd->DeQueueRunning[BulkOutPipeId] == FALSE) && + (pHTTXContext->bCurWriting == FALSE)) { + RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, + MAX_TX_PROCESS); } RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL); @@ -782,34 +749,38 @@ static void rtusb_ac0_dma_done_tasklet(unsigned long data) } } - return; } - -NDIS_STATUS RtmpNetTaskInit( - IN RTMP_ADAPTER *pAd) +NDIS_STATUS RtmpNetTaskInit(IN RTMP_ADAPTER * pAd) { POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; // Create receive tasklet - tasklet_init(&pObj->rx_done_task, rx_done_tasklet, (ULONG)pAd); - tasklet_init(&pObj->mgmt_dma_done_task, rtusb_mgmt_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac0_dma_done_task, rtusb_ac0_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac1_dma_done_task, rtusb_ac1_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac2_dma_done_task, rtusb_ac2_dma_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->ac3_dma_done_task, rtusb_ac3_dma_done_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->rx_done_task, rx_done_tasklet, (ULONG) pAd); + tasklet_init(&pObj->mgmt_dma_done_task, rtusb_mgmt_dma_done_tasklet, + (unsigned long)pAd); + tasklet_init(&pObj->ac0_dma_done_task, rtusb_ac0_dma_done_tasklet, + (unsigned long)pAd); + tasklet_init(&pObj->ac1_dma_done_task, rtusb_ac1_dma_done_tasklet, + (unsigned long)pAd); + tasklet_init(&pObj->ac2_dma_done_task, rtusb_ac2_dma_done_tasklet, + (unsigned long)pAd); + tasklet_init(&pObj->ac3_dma_done_task, rtusb_ac3_dma_done_tasklet, + (unsigned long)pAd); tasklet_init(&pObj->tbtt_task, tbtt_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->null_frame_complete_task, rtusb_null_frame_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->rts_frame_complete_task, rtusb_rts_frame_done_tasklet, (unsigned long)pAd); - tasklet_init(&pObj->pspoll_frame_complete_task, rtusb_pspoll_frame_done_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->null_frame_complete_task, + rtusb_null_frame_done_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->rts_frame_complete_task, + rtusb_rts_frame_done_tasklet, (unsigned long)pAd); + tasklet_init(&pObj->pspoll_frame_complete_task, + rtusb_pspoll_frame_done_tasklet, (unsigned long)pAd); return NDIS_STATUS_SUCCESS; } - -void RtmpNetTaskExit(IN RTMP_ADAPTER *pAd) +void RtmpNetTaskExit(IN RTMP_ADAPTER * pAd) { POS_COOKIE pObj; diff --git a/drivers/staging/rt2860/sta_ioctl.c b/drivers/staging/rt2860/sta_ioctl.c index df6130c981cd..dc1f60010ec9 100644 --- a/drivers/staging/rt2860/sta_ioctl.c +++ b/drivers/staging/rt2860/sta_ioctl.c @@ -40,7 +40,7 @@ #include "rt_config.h" #ifdef DBG -extern ULONG RTDebugLevel; +extern ULONG RTDebugLevel; #endif #define NR_WEP_KEYS 4 @@ -49,235 +49,296 @@ extern ULONG RTDebugLevel; #define GROUP_KEY_NO 4 -extern UCHAR CipherWpa2Template[]; +extern UCHAR CipherWpa2Template[]; -typedef struct PACKED _RT_VERSION_INFO{ - UCHAR DriverVersionW; - UCHAR DriverVersionX; - UCHAR DriverVersionY; - UCHAR DriverVersionZ; - UINT DriverBuildYear; - UINT DriverBuildMonth; - UINT DriverBuildDay; +typedef struct PACKED _RT_VERSION_INFO { + UCHAR DriverVersionW; + UCHAR DriverVersionX; + UCHAR DriverVersionY; + UCHAR DriverVersionZ; + UINT DriverBuildYear; + UINT DriverBuildMonth; + UINT DriverBuildDay; } RT_VERSION_INFO, *PRT_VERSION_INFO; -static __s32 ralinkrate[] = - {2, 4, 11, 22, // CCK - 12, 18, 24, 36, 48, 72, 96, 108, // OFDM - 13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78, 104, 156, 208, 234, 260, // 20MHz, 800ns GI, MCS: 0 ~ 15 - 39, 78, 117, 156, 234, 312, 351, 390, // 20MHz, 800ns GI, MCS: 16 ~ 23 - 27, 54, 81, 108, 162, 216, 243, 270, 54, 108, 162, 216, 324, 432, 486, 540, // 40MHz, 800ns GI, MCS: 0 ~ 15 - 81, 162, 243, 324, 486, 648, 729, 810, // 40MHz, 800ns GI, MCS: 16 ~ 23 - 14, 29, 43, 57, 87, 115, 130, 144, 29, 59, 87, 115, 173, 230, 260, 288, // 20MHz, 400ns GI, MCS: 0 ~ 15 - 43, 87, 130, 173, 260, 317, 390, 433, // 20MHz, 400ns GI, MCS: 16 ~ 23 - 30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 480, 540, 600, // 40MHz, 400ns GI, MCS: 0 ~ 15 - 90, 180, 270, 360, 540, 720, 810, 900}; +static __s32 ralinkrate[] = { 2, 4, 11, 22, // CCK + 12, 18, 24, 36, 48, 72, 96, 108, // OFDM + 13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78, 104, 156, 208, 234, 260, // 20MHz, 800ns GI, MCS: 0 ~ 15 + 39, 78, 117, 156, 234, 312, 351, 390, // 20MHz, 800ns GI, MCS: 16 ~ 23 + 27, 54, 81, 108, 162, 216, 243, 270, 54, 108, 162, 216, 324, 432, 486, 540, // 40MHz, 800ns GI, MCS: 0 ~ 15 + 81, 162, 243, 324, 486, 648, 729, 810, // 40MHz, 800ns GI, MCS: 16 ~ 23 + 14, 29, 43, 57, 87, 115, 130, 144, 29, 59, 87, 115, 173, 230, 260, 288, // 20MHz, 400ns GI, MCS: 0 ~ 15 + 43, 87, 130, 173, 260, 317, 390, 433, // 20MHz, 400ns GI, MCS: 16 ~ 23 + 30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 480, 540, 600, // 40MHz, 400ns GI, MCS: 0 ~ 15 + 90, 180, 270, 360, 540, 720, 810, 900 +}; -INT Set_SSID_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); +INT Set_SSID_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg); -INT Set_NetworkType_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg); +INT Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg); -VOID RTMPAddKey( - IN PRTMP_ADAPTER pAd, - IN PNDIS_802_11_KEY pKey) +VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) { - ULONG KeyIdx; - MAC_TABLE_ENTRY *pEntry; + ULONG KeyIdx; + MAC_TABLE_ENTRY *pEntry; + + DBGPRINT(RT_DEBUG_TRACE, ("RTMPAddKey ------>\n")); + + if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) { + if (pKey->KeyIndex & 0x80000000) { + if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) { + NdisZeroMemory(pAd->StaCfg.PMK, 32); + NdisMoveMemory(pAd->StaCfg.PMK, + pKey->KeyMaterial, + pKey->KeyLength); + goto end; + } + // Update PTK + NdisZeroMemory(&pAd->SharedKey[BSS0][0], + sizeof(CIPHER_KEY)); + pAd->SharedKey[BSS0][0].KeyLen = LEN_TKIP_EK; + NdisMoveMemory(pAd->SharedKey[BSS0][0].Key, + pKey->KeyMaterial, LEN_TKIP_EK); + + if (pAd->StaCfg.PairCipher == + Ndis802_11Encryption2Enabled) { + NdisMoveMemory(pAd->SharedKey[BSS0][0].RxMic, + pKey->KeyMaterial + LEN_TKIP_EK, + LEN_TKIP_TXMICK); + NdisMoveMemory(pAd->SharedKey[BSS0][0].TxMic, + pKey->KeyMaterial + LEN_TKIP_EK + + LEN_TKIP_TXMICK, + LEN_TKIP_RXMICK); + } else { + NdisMoveMemory(pAd->SharedKey[BSS0][0].TxMic, + pKey->KeyMaterial + LEN_TKIP_EK, + LEN_TKIP_TXMICK); + NdisMoveMemory(pAd->SharedKey[BSS0][0].RxMic, + pKey->KeyMaterial + LEN_TKIP_EK + + LEN_TKIP_TXMICK, + LEN_TKIP_RXMICK); + } - DBGPRINT(RT_DEBUG_TRACE, ("RTMPAddKey ------>\n")); + // Decide its ChiperAlg + if (pAd->StaCfg.PairCipher == + Ndis802_11Encryption2Enabled) + pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_TKIP; + else if (pAd->StaCfg.PairCipher == + Ndis802_11Encryption3Enabled) + pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_AES; + else + pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_NONE; + + // Update these related information to MAC_TABLE_ENTRY + pEntry = &pAd->MacTab.Content[BSSID_WCID]; + NdisMoveMemory(pEntry->PairwiseKey.Key, + pAd->SharedKey[BSS0][0].Key, + LEN_TKIP_EK); + NdisMoveMemory(pEntry->PairwiseKey.RxMic, + pAd->SharedKey[BSS0][0].RxMic, + LEN_TKIP_RXMICK); + NdisMoveMemory(pEntry->PairwiseKey.TxMic, + pAd->SharedKey[BSS0][0].TxMic, + LEN_TKIP_TXMICK); + pEntry->PairwiseKey.CipherAlg = + pAd->SharedKey[BSS0][0].CipherAlg; + + // Update pairwise key information to ASIC Shared Key Table + AsicAddSharedKeyEntry(pAd, + BSS0, + 0, + pAd->SharedKey[BSS0][0].CipherAlg, + pAd->SharedKey[BSS0][0].Key, + pAd->SharedKey[BSS0][0].TxMic, + pAd->SharedKey[BSS0][0].RxMic); + + // Update ASIC WCID attribute table and IVEIV table + RTMPAddWcidAttributeEntry(pAd, + BSS0, + 0, + pAd->SharedKey[BSS0][0]. + CipherAlg, pEntry); - if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - { - if (pKey->KeyIndex & 0x80000000) - { - if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) - { - NdisZeroMemory(pAd->StaCfg.PMK, 32); - NdisMoveMemory(pAd->StaCfg.PMK, pKey->KeyMaterial, pKey->KeyLength); - goto end; - } - // Update PTK - NdisZeroMemory(&pAd->SharedKey[BSS0][0], sizeof(CIPHER_KEY)); - pAd->SharedKey[BSS0][0].KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pAd->SharedKey[BSS0][0].Key, pKey->KeyMaterial, LEN_TKIP_EK); - - if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) - { - NdisMoveMemory(pAd->SharedKey[BSS0][0].RxMic, pKey->KeyMaterial + LEN_TKIP_EK, LEN_TKIP_TXMICK); - NdisMoveMemory(pAd->SharedKey[BSS0][0].TxMic, pKey->KeyMaterial + LEN_TKIP_EK + LEN_TKIP_TXMICK, LEN_TKIP_RXMICK); - } - else - { - NdisMoveMemory(pAd->SharedKey[BSS0][0].TxMic, pKey->KeyMaterial + LEN_TKIP_EK, LEN_TKIP_TXMICK); - NdisMoveMemory(pAd->SharedKey[BSS0][0].RxMic, pKey->KeyMaterial + LEN_TKIP_EK + LEN_TKIP_TXMICK, LEN_TKIP_RXMICK); - } - - // Decide its ChiperAlg - if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) - pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_TKIP; - else if (pAd->StaCfg.PairCipher == Ndis802_11Encryption3Enabled) - pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_AES; - else - pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_NONE; - - // Update these related information to MAC_TABLE_ENTRY - pEntry = &pAd->MacTab.Content[BSSID_WCID]; - NdisMoveMemory(pEntry->PairwiseKey.Key, pAd->SharedKey[BSS0][0].Key, LEN_TKIP_EK); - NdisMoveMemory(pEntry->PairwiseKey.RxMic, pAd->SharedKey[BSS0][0].RxMic, LEN_TKIP_RXMICK); - NdisMoveMemory(pEntry->PairwiseKey.TxMic, pAd->SharedKey[BSS0][0].TxMic, LEN_TKIP_TXMICK); - pEntry->PairwiseKey.CipherAlg = pAd->SharedKey[BSS0][0].CipherAlg; - - // Update pairwise key information to ASIC Shared Key Table - AsicAddSharedKeyEntry(pAd, - BSS0, - 0, - pAd->SharedKey[BSS0][0].CipherAlg, - pAd->SharedKey[BSS0][0].Key, - pAd->SharedKey[BSS0][0].TxMic, - pAd->SharedKey[BSS0][0].RxMic); - - // Update ASIC WCID attribute table and IVEIV table - RTMPAddWcidAttributeEntry(pAd, - BSS0, - 0, - pAd->SharedKey[BSS0][0].CipherAlg, - pEntry); - - if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA2) - { - // set 802.1x port control - //pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA2) { + // set 802.1x port control + //pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; STA_PORT_SECURED(pAd); - // Indicate Connected for GUI - pAd->IndicateMediaState = NdisMediaStateConnected; - } - } - else - { - // Update GTK - pAd->StaCfg.DefaultKeyId = (pKey->KeyIndex & 0xFF); - NdisZeroMemory(&pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId], sizeof(CIPHER_KEY)); - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].Key, pKey->KeyMaterial, LEN_TKIP_EK); - - if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption2Enabled) - { - NdisMoveMemory(pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].RxMic, pKey->KeyMaterial + LEN_TKIP_EK, LEN_TKIP_TXMICK); - NdisMoveMemory(pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].TxMic, pKey->KeyMaterial + LEN_TKIP_EK + LEN_TKIP_TXMICK, LEN_TKIP_RXMICK); - } - else - { - NdisMoveMemory(pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].TxMic, pKey->KeyMaterial + LEN_TKIP_EK, LEN_TKIP_TXMICK); - NdisMoveMemory(pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].RxMic, pKey->KeyMaterial + LEN_TKIP_EK + LEN_TKIP_TXMICK, LEN_TKIP_RXMICK); - } - - // Update Shared Key CipherAlg - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_NONE; - if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption2Enabled) - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_TKIP; - else if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption3Enabled) - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg = CIPHER_AES; - - // Update group key information to ASIC Shared Key Table - AsicAddSharedKeyEntry(pAd, - BSS0, - pAd->StaCfg.DefaultKeyId, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].Key, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].TxMic, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].RxMic); - - // Update ASIC WCID attribute table and IVEIV table - RTMPAddWcidAttributeEntry(pAd, - BSS0, - pAd->StaCfg.DefaultKeyId, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg, - NULL); - - // set 802.1x port control - //pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + // Indicate Connected for GUI + pAd->IndicateMediaState = + NdisMediaStateConnected; + } + } else { + // Update GTK + pAd->StaCfg.DefaultKeyId = (pKey->KeyIndex & 0xFF); + NdisZeroMemory(&pAd-> + SharedKey[BSS0][pAd->StaCfg. + DefaultKeyId], + sizeof(CIPHER_KEY)); + pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].KeyLen = + LEN_TKIP_EK; + NdisMoveMemory(pAd-> + SharedKey[BSS0][pAd->StaCfg. + DefaultKeyId].Key, + pKey->KeyMaterial, LEN_TKIP_EK); + + if (pAd->StaCfg.GroupCipher == + Ndis802_11Encryption2Enabled) { + NdisMoveMemory(pAd-> + SharedKey[BSS0][pAd->StaCfg. + DefaultKeyId]. + RxMic, + pKey->KeyMaterial + LEN_TKIP_EK, + LEN_TKIP_TXMICK); + NdisMoveMemory(pAd-> + SharedKey[BSS0][pAd->StaCfg. + DefaultKeyId]. + TxMic, + pKey->KeyMaterial + LEN_TKIP_EK + + LEN_TKIP_TXMICK, + LEN_TKIP_RXMICK); + } else { + NdisMoveMemory(pAd-> + SharedKey[BSS0][pAd->StaCfg. + DefaultKeyId]. + TxMic, + pKey->KeyMaterial + LEN_TKIP_EK, + LEN_TKIP_TXMICK); + NdisMoveMemory(pAd-> + SharedKey[BSS0][pAd->StaCfg. + DefaultKeyId]. + RxMic, + pKey->KeyMaterial + LEN_TKIP_EK + + LEN_TKIP_TXMICK, + LEN_TKIP_RXMICK); + } + + // Update Shared Key CipherAlg + pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId]. + CipherAlg = CIPHER_NONE; + if (pAd->StaCfg.GroupCipher == + Ndis802_11Encryption2Enabled) + pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId]. + CipherAlg = CIPHER_TKIP; + else if (pAd->StaCfg.GroupCipher == + Ndis802_11Encryption3Enabled) + pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId]. + CipherAlg = CIPHER_AES; + + // Update group key information to ASIC Shared Key Table + AsicAddSharedKeyEntry(pAd, + BSS0, + pAd->StaCfg.DefaultKeyId, + pAd->SharedKey[BSS0][pAd->StaCfg. + DefaultKeyId]. + CipherAlg, + pAd->SharedKey[BSS0][pAd->StaCfg. + DefaultKeyId]. + Key, + pAd->SharedKey[BSS0][pAd->StaCfg. + DefaultKeyId]. + TxMic, + pAd->SharedKey[BSS0][pAd->StaCfg. + DefaultKeyId]. + RxMic); + + // Update ASIC WCID attribute table and IVEIV table + RTMPAddWcidAttributeEntry(pAd, + BSS0, + pAd->StaCfg.DefaultKeyId, + pAd->SharedKey[BSS0][pAd-> + StaCfg. + DefaultKeyId]. + CipherAlg, NULL); + + // set 802.1x port control + //pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; STA_PORT_SECURED(pAd); - // Indicate Connected for GUI - pAd->IndicateMediaState = NdisMediaStateConnected; - } - } - else // dynamic WEP from wpa_supplicant + // Indicate Connected for GUI + pAd->IndicateMediaState = NdisMediaStateConnected; + } + } else // dynamic WEP from wpa_supplicant { - UCHAR CipherAlg; - PUCHAR Key; + UCHAR CipherAlg; + PUCHAR Key; - if(pKey->KeyLength == 32) + if (pKey->KeyLength == 32) goto end; KeyIdx = pKey->KeyIndex & 0x0fffffff; - if (KeyIdx < 4) - { + if (KeyIdx < 4) { // it is a default shared key, for Pairwise key setting - if (pKey->KeyIndex & 0x80000000) - { + if (pKey->KeyIndex & 0x80000000) { pEntry = MacTableLookup(pAd, pKey->BSSID); - if (pEntry) - { - DBGPRINT(RT_DEBUG_TRACE, ("RTMPAddKey: Set Pair-wise Key\n")); + if (pEntry) { + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPAddKey: Set Pair-wise Key\n")); // set key material and key length - pEntry->PairwiseKey.KeyLen = (UCHAR)pKey->KeyLength; - NdisMoveMemory(pEntry->PairwiseKey.Key, &pKey->KeyMaterial, pKey->KeyLength); + pEntry->PairwiseKey.KeyLen = + (UCHAR) pKey->KeyLength; + NdisMoveMemory(pEntry->PairwiseKey.Key, + &pKey->KeyMaterial, + pKey->KeyLength); // set Cipher type if (pKey->KeyLength == 5) - pEntry->PairwiseKey.CipherAlg = CIPHER_WEP64; + pEntry->PairwiseKey.CipherAlg = + CIPHER_WEP64; else - pEntry->PairwiseKey.CipherAlg = CIPHER_WEP128; + pEntry->PairwiseKey.CipherAlg = + CIPHER_WEP128; // Add Pair-wise key to Asic - AsicAddPairwiseKeyEntry( - pAd, - pEntry->Addr, - (UCHAR)pEntry->Aid, - &pEntry->PairwiseKey); + AsicAddPairwiseKeyEntry(pAd, + pEntry->Addr, + (UCHAR) pEntry-> + Aid, + &pEntry-> + PairwiseKey); // update WCID attribute table and IVEIV table for this entry - RTMPAddWcidAttributeEntry( - pAd, - BSS0, - KeyIdx, // The value may be not zero - pEntry->PairwiseKey.CipherAlg, - pEntry); + RTMPAddWcidAttributeEntry(pAd, BSS0, KeyIdx, // The value may be not zero + pEntry-> + PairwiseKey. + CipherAlg, + pEntry); } - } - else - { + } else { // Default key for tx (shared key) pAd->StaCfg.DefaultKeyId = (UCHAR) KeyIdx; // set key material and key length - pAd->SharedKey[BSS0][KeyIdx].KeyLen = (UCHAR) pKey->KeyLength; - NdisMoveMemory(pAd->SharedKey[BSS0][KeyIdx].Key, &pKey->KeyMaterial, pKey->KeyLength); + pAd->SharedKey[BSS0][KeyIdx].KeyLen = + (UCHAR) pKey->KeyLength; + NdisMoveMemory(pAd->SharedKey[BSS0][KeyIdx].Key, + &pKey->KeyMaterial, + pKey->KeyLength); // Set Ciper type if (pKey->KeyLength == 5) - pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_WEP64; + pAd->SharedKey[BSS0][KeyIdx].CipherAlg = + CIPHER_WEP64; else - pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_WEP128; + pAd->SharedKey[BSS0][KeyIdx].CipherAlg = + CIPHER_WEP128; - CipherAlg = pAd->SharedKey[BSS0][KeyIdx].CipherAlg; - Key = pAd->SharedKey[BSS0][KeyIdx].Key; + CipherAlg = + pAd->SharedKey[BSS0][KeyIdx].CipherAlg; + Key = pAd->SharedKey[BSS0][KeyIdx].Key; // Set Group key material to Asic - AsicAddSharedKeyEntry(pAd, BSS0, KeyIdx, CipherAlg, Key, NULL, NULL); + AsicAddSharedKeyEntry(pAd, BSS0, KeyIdx, + CipherAlg, Key, NULL, + NULL); // Update WCID attribute table and IVEIV table for this group key table - RTMPAddWcidAttributeEntry(pAd, BSS0, KeyIdx, CipherAlg, NULL); + RTMPAddWcidAttributeEntry(pAd, BSS0, KeyIdx, + CipherAlg, NULL); } } @@ -286,12 +347,12 @@ end: return; } -char * rtstrchr(const char * s, int c) +char *rtstrchr(const char *s, int c) { - for(; *s != (char) c; ++s) - if (*s == '\0') - return NULL; - return (char *) s; + for (; *s != (char)c; ++s) + if (*s == '\0') + return NULL; + return (char *)s; } /* @@ -300,8 +361,7 @@ This is required for LinEX2004/kernel2.6.7 to provide iwlist scanning function int rt_ioctl_giwname(struct net_device *dev, - struct iw_request_info *info, - char *name, char *extra) + struct iw_request_info *info, char *name, char *extra) { strncpy(name, "Ralink STA", IFNAMSIZ); // RT2870 2.1.0.0 uses "RT2870 Wireless" @@ -310,89 +370,87 @@ rt_ioctl_giwname(struct net_device *dev, } int rt_ioctl_siwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *freq, char *extra) + struct iw_request_info *info, + struct iw_freq *freq, char *extra) { PRTMP_ADAPTER pAdapter = NULL; - int chan = -1; + int chan = -1; GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - + //check if the interface is down + if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + return -ENETDOWN; + } if (freq->e > 1) return -EINVAL; - if((freq->e == 0) && (freq->m <= 1000)) + if ((freq->e == 0) && (freq->m <= 1000)) chan = freq->m; // Setting by channel number else - MAP_KHZ_TO_CHANNEL_ID( (freq->m /100) , chan); // Setting by frequency - search the table , like 2.412G, 2.422G, - - if (ChannelSanity(pAdapter, chan) == TRUE) - { - pAdapter->CommonCfg.Channel = chan; - DBGPRINT(RT_DEBUG_ERROR, ("==>rt_ioctl_siwfreq::SIOCSIWFREQ[cmd=0x%x] (Channel=%d)\n", SIOCSIWFREQ, pAdapter->CommonCfg.Channel)); - } - else - return -EINVAL; + MAP_KHZ_TO_CHANNEL_ID((freq->m / 100), chan); // Setting by frequency - search the table , like 2.412G, 2.422G, + + if (ChannelSanity(pAdapter, chan) == TRUE) { + pAdapter->CommonCfg.Channel = chan; + DBGPRINT(RT_DEBUG_ERROR, + ("==>rt_ioctl_siwfreq::SIOCSIWFREQ[cmd=0x%x] (Channel=%d)\n", + SIOCSIWFREQ, pAdapter->CommonCfg.Channel)); + } else + return -EINVAL; return 0; } + int rt_ioctl_giwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *freq, char *extra) + struct iw_request_info *info, + struct iw_freq *freq, char *extra) { PRTMP_ADAPTER pAdapter = NULL; UCHAR ch; - ULONG m = 2412000; + ULONG m = 2412000; GET_PAD_FROM_NET_DEV(pAdapter, dev); - ch = pAdapter->CommonCfg.Channel; + ch = pAdapter->CommonCfg.Channel; - DBGPRINT(RT_DEBUG_TRACE,("==>rt_ioctl_giwfreq %d\n", ch)); + DBGPRINT(RT_DEBUG_TRACE, ("==>rt_ioctl_giwfreq %d\n", ch)); - MAP_CHANNEL_ID_TO_KHZ(ch, m); + MAP_CHANNEL_ID_TO_KHZ(ch, m); freq->m = m * 100; freq->e = 1; return 0; } int rt_ioctl_siwmode(struct net_device *dev, - struct iw_request_info *info, - __u32 *mode, char *extra) + struct iw_request_info *info, __u32 * mode, char *extra) { PRTMP_ADAPTER pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } + if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + return -ENETDOWN; + } - switch (*mode) - { - case IW_MODE_ADHOC: - Set_NetworkType_Proc(pAdapter, "Adhoc"); - break; - case IW_MODE_INFRA: - Set_NetworkType_Proc(pAdapter, "Infra"); - break; - case IW_MODE_MONITOR: - Set_NetworkType_Proc(pAdapter, "Monitor"); - break; - default: - DBGPRINT(RT_DEBUG_TRACE, ("===>rt_ioctl_siwmode::SIOCSIWMODE (unknown %d)\n", *mode)); - return -EINVAL; + switch (*mode) { + case IW_MODE_ADHOC: + Set_NetworkType_Proc(pAdapter, "Adhoc"); + break; + case IW_MODE_INFRA: + Set_NetworkType_Proc(pAdapter, "Infra"); + break; + case IW_MODE_MONITOR: + Set_NetworkType_Proc(pAdapter, "Monitor"); + break; + default: + DBGPRINT(RT_DEBUG_TRACE, + ("===>rt_ioctl_siwmode::SIOCSIWMODE (unknown %d)\n", + *mode)); + return -EINVAL; } // Reset Ralink supplicant to not use, it will be set to start when UI set PMK key @@ -402,8 +460,7 @@ int rt_ioctl_siwmode(struct net_device *dev, } int rt_ioctl_giwmode(struct net_device *dev, - struct iw_request_info *info, - __u32 *mode, char *extra) + struct iw_request_info *info, __u32 * mode, char *extra) { PRTMP_ADAPTER pAdapter = NULL; @@ -411,63 +468,57 @@ int rt_ioctl_giwmode(struct net_device *dev, if (ADHOC_ON(pAdapter)) *mode = IW_MODE_ADHOC; - else if (INFRA_ON(pAdapter)) + else if (INFRA_ON(pAdapter)) *mode = IW_MODE_INFRA; - else if (MONITOR_ON(pAdapter)) - { - *mode = IW_MODE_MONITOR; - } - else - *mode = IW_MODE_AUTO; + else if (MONITOR_ON(pAdapter)) { + *mode = IW_MODE_MONITOR; + } else + *mode = IW_MODE_AUTO; DBGPRINT(RT_DEBUG_TRACE, ("==>rt_ioctl_giwmode(mode=%d)\n", *mode)); return 0; } int rt_ioctl_siwsens(struct net_device *dev, - struct iw_request_info *info, - char *name, char *extra) + struct iw_request_info *info, char *name, char *extra) { PRTMP_ADAPTER pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } + if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + return -ENETDOWN; + } return 0; } int rt_ioctl_giwsens(struct net_device *dev, - struct iw_request_info *info, - char *name, char *extra) + struct iw_request_info *info, char *name, char *extra) { return 0; } int rt_ioctl_giwrange(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) + struct iw_request_info *info, + struct iw_point *data, char *extra) { PRTMP_ADAPTER pAdapter = NULL; - struct iw_range *range = (struct iw_range *) extra; + struct iw_range *range = (struct iw_range *)extra; u16 val; int i; GET_PAD_FROM_NET_DEV(pAdapter, dev); - DBGPRINT(RT_DEBUG_TRACE ,("===>rt_ioctl_giwrange\n")); + DBGPRINT(RT_DEBUG_TRACE, ("===>rt_ioctl_giwrange\n")); data->length = sizeof(struct iw_range); memset(range, 0, sizeof(struct iw_range)); range->txpower_capa = IW_TXPOW_DBM; - if (INFRA_ON(pAdapter)||ADHOC_ON(pAdapter)) - { + if (INFRA_ON(pAdapter) || ADHOC_ON(pAdapter)) { range->min_pmp = 1 * 1024; range->max_pmp = 65535 * 1024; range->min_pmt = 1 * 1024; @@ -475,7 +526,7 @@ int rt_ioctl_giwrange(struct net_device *dev, range->pmp_flags = IW_POWER_PERIOD; range->pmt_flags = IW_POWER_TIMEOUT; range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | - IW_POWER_UNICAST_R | IW_POWER_ALL_R; + IW_POWER_UNICAST_R | IW_POWER_ALL_R; } range->we_version_compiled = WIRELESS_EXT; @@ -486,15 +537,14 @@ int rt_ioctl_giwrange(struct net_device *dev, range->min_retry = 0; range->max_retry = 255; - range->num_channels = pAdapter->ChannelListNum; + range->num_channels = pAdapter->ChannelListNum; val = 0; - for (i = 1; i <= range->num_channels; i++) - { + for (i = 1; i <= range->num_channels; i++) { u32 m = 2412000; - range->freq[val].i = pAdapter->ChannelList[i-1].Channel; - MAP_CHANNEL_ID_TO_KHZ(pAdapter->ChannelList[i-1].Channel, m); - range->freq[val].m = m * 100; /* OS_HZ */ + range->freq[val].i = pAdapter->ChannelList[i - 1].Channel; + MAP_CHANNEL_ID_TO_KHZ(pAdapter->ChannelList[i - 1].Channel, m); + range->freq[val].m = m * 100; /* OS_HZ */ range->freq[val].e = 1; val++; @@ -503,11 +553,11 @@ int rt_ioctl_giwrange(struct net_device *dev, } range->num_frequency = val; - range->max_qual.qual = 100; /* what is correct max? This was not - * documented exactly. At least - * 69 has been observed. */ - range->max_qual.level = 0; /* dB */ - range->max_qual.noise = 0; /* dB */ + range->max_qual.qual = 100; /* what is correct max? This was not + * documented exactly. At least + * 69 has been observed. */ + range->max_qual.level = 0; /* dB */ + range->max_qual.noise = 0; /* dB */ /* What would be suitable values for "average/typical" qual? */ range->avg_qual.qual = 20; @@ -527,74 +577,68 @@ int rt_ioctl_giwrange(struct net_device *dev, /* IW_ENC_CAPA_* bit field */ range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | - IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; + IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; return 0; } int rt_ioctl_siwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, char *extra) + struct iw_request_info *info, + struct sockaddr *ap_addr, char *extra) { PRTMP_ADAPTER pAdapter = NULL; - NDIS_802_11_MAC_ADDRESS Bssid; + NDIS_802_11_MAC_ADDRESS Bssid; GET_PAD_FROM_NET_DEV(pAdapter, dev); //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { - RTMP_MLME_RESET_STATE_MACHINE(pAdapter); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); - } - - // tell CNTL state machine to call NdisMSetInformationComplete() after completing - // this request, because this request is initiated by NDIS. - pAdapter->MlmeAux.CurrReqIsFromNdis = FALSE; + if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + return -ENETDOWN; + } + + if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) { + RTMP_MLME_RESET_STATE_MACHINE(pAdapter); + DBGPRINT(RT_DEBUG_TRACE, + ("!!! MLME busy, reset MLME state machine !!!\n")); + } + // tell CNTL state machine to call NdisMSetInformationComplete() after completing + // this request, because this request is initiated by NDIS. + pAdapter->MlmeAux.CurrReqIsFromNdis = FALSE; // Prevent to connect AP again in STAMlmePeriodicExec - pAdapter->MlmeAux.AutoReconnectSsidLen= 32; + pAdapter->MlmeAux.AutoReconnectSsidLen = 32; - memset(Bssid, 0, MAC_ADDR_LEN); - memcpy(Bssid, ap_addr->sa_data, MAC_ADDR_LEN); - MlmeEnqueue(pAdapter, - MLME_CNTL_STATE_MACHINE, - OID_802_11_BSSID, - sizeof(NDIS_802_11_MAC_ADDRESS), - (VOID *)&Bssid); + memset(Bssid, 0, MAC_ADDR_LEN); + memcpy(Bssid, ap_addr->sa_data, MAC_ADDR_LEN); + MlmeEnqueue(pAdapter, + MLME_CNTL_STATE_MACHINE, + OID_802_11_BSSID, + sizeof(NDIS_802_11_MAC_ADDRESS), (VOID *) & Bssid); - DBGPRINT(RT_DEBUG_TRACE, ("IOCTL::SIOCSIWAP %02x:%02x:%02x:%02x:%02x:%02x\n", - Bssid[0], Bssid[1], Bssid[2], Bssid[3], Bssid[4], Bssid[5])); + DBGPRINT(RT_DEBUG_TRACE, + ("IOCTL::SIOCSIWAP %02x:%02x:%02x:%02x:%02x:%02x\n", Bssid[0], + Bssid[1], Bssid[2], Bssid[3], Bssid[4], Bssid[5])); return 0; } int rt_ioctl_giwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, char *extra) + struct iw_request_info *info, + struct sockaddr *ap_addr, char *extra) { PRTMP_ADAPTER pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); - if (INFRA_ON(pAdapter) || ADHOC_ON(pAdapter)) - { + if (INFRA_ON(pAdapter) || ADHOC_ON(pAdapter)) { ap_addr->sa_family = ARPHRD_ETHER; memcpy(ap_addr->sa_data, &pAdapter->CommonCfg.Bssid, ETH_ALEN); } - // Add for RT2870 - else if (pAdapter->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) - { - ap_addr->sa_family = ARPHRD_ETHER; - memcpy(ap_addr->sa_data, &pAdapter->MlmeAux.Bssid, ETH_ALEN); - } - else - { + // Add for RT2870 + else if (pAdapter->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) { + ap_addr->sa_family = ARPHRD_ETHER; + memcpy(ap_addr->sa_data, &pAdapter->MlmeAux.Bssid, ETH_ALEN); + } else { DBGPRINT(RT_DEBUG_TRACE, ("IOCTL::SIOCGIWAP(=EMPTY)\n")); return -ENOTCONN; } @@ -619,32 +663,31 @@ int rt_ioctl_giwap(struct net_device *dev, * drivers for compatibility */ static void set_quality(PRTMP_ADAPTER pAdapter, - struct iw_quality *iq, - signed char rssi) + struct iw_quality *iq, signed char rssi) { __u8 ChannelQuality; // Normalize Rssi if (rssi >= -50) ChannelQuality = 100; - else if (rssi >= -80) // between -50 ~ -80dbm - ChannelQuality = (__u8)(24 + ((rssi + 80) * 26)/10); - else if (rssi >= -90) // between -80 ~ -90dbm - ChannelQuality = (__u8)((rssi + 90) * 26)/10; + else if (rssi >= -80) // between -50 ~ -80dbm + ChannelQuality = (__u8) (24 + ((rssi + 80) * 26) / 10); + else if (rssi >= -90) // between -80 ~ -90dbm + ChannelQuality = (__u8) ((rssi + 90) * 26) / 10; else ChannelQuality = 0; - iq->qual = (__u8)ChannelQuality; + iq->qual = (__u8) ChannelQuality; - iq->level = (__u8)(rssi); - iq->noise = (pAdapter->BbpWriteLatch[66] > pAdapter->BbpTuning.FalseCcaUpperThreshold) ? ((__u8)pAdapter->BbpTuning.FalseCcaUpperThreshold) : ((__u8) pAdapter->BbpWriteLatch[66]); // noise level (dBm) - iq->noise += 256 - 143; - iq->updated = pAdapter->iw_stats.qual.updated; + iq->level = (__u8) (rssi); + iq->noise = (pAdapter->BbpWriteLatch[66] > pAdapter->BbpTuning.FalseCcaUpperThreshold) ? ((__u8) pAdapter->BbpTuning.FalseCcaUpperThreshold) : ((__u8) pAdapter->BbpWriteLatch[66]); // noise level (dBm) + iq->noise += 256 - 143; + iq->updated = pAdapter->iw_stats.qual.updated; } int rt_ioctl_iwaplist(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) + struct iw_request_info *info, + struct iw_point *data, char *extra) { PRTMP_ADAPTER pAdapter = NULL; @@ -654,91 +697,90 @@ int rt_ioctl_iwaplist(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + //check if the interface is down + if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); data->length = 0; return 0; - //return -ENETDOWN; + //return -ENETDOWN; } - for (i = 0; i = pAdapter->ScanTab.BssNr) + for (i = 0; i < IW_MAX_AP; i++) { + if (i >= pAdapter->ScanTab.BssNr) break; addr[i].sa_family = ARPHRD_ETHER; - memcpy(addr[i].sa_data, &pAdapter->ScanTab.BssEntry[i].Bssid, MAC_ADDR_LEN); - set_quality(pAdapter, &qual[i], pAdapter->ScanTab.BssEntry[i].Rssi); + memcpy(addr[i].sa_data, &pAdapter->ScanTab.BssEntry[i].Bssid, + MAC_ADDR_LEN); + set_quality(pAdapter, &qual[i], + pAdapter->ScanTab.BssEntry[i].Rssi); } data->length = i; - memcpy(extra, &addr, i*sizeof(addr[0])); - data->flags = 1; /* signal quality present (sort of) */ - memcpy(extra + i*sizeof(addr[0]), &qual, i*sizeof(qual[i])); + memcpy(extra, &addr, i * sizeof(addr[0])); + data->flags = 1; /* signal quality present (sort of) */ + memcpy(extra + i * sizeof(addr[0]), &qual, i * sizeof(qual[i])); return 0; } int rt_ioctl_siwscan(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) + struct iw_request_info *info, + struct iw_point *data, char *extra) { PRTMP_ADAPTER pAdapter = NULL; - ULONG Now; + ULONG Now; int Status = NDIS_STATUS_SUCCESS; GET_PAD_FROM_NET_DEV(pAdapter, dev); //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { + if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); return -ENETDOWN; } - if (MONITOR_ON(pAdapter)) - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! Driver is in Monitor Mode now !!!\n")); - return -EINVAL; - } - + if (MONITOR_ON(pAdapter)) { + DBGPRINT(RT_DEBUG_TRACE, + ("!!! Driver is in Monitor Mode now !!!\n")); + return -EINVAL; + } - if (pAdapter->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) - { + if (pAdapter->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) { pAdapter->StaCfg.WpaSupplicantScanCount++; } - pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE; + pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE; if (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) return NDIS_STATUS_SUCCESS; - do{ + do { Now = jiffies; - if ((pAdapter->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) && - (pAdapter->StaCfg.WpaSupplicantScanCount > 3)) - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! WpaSupplicantScanCount > 3\n")); + if ((pAdapter->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) + && (pAdapter->StaCfg.WpaSupplicantScanCount > 3)) { + DBGPRINT(RT_DEBUG_TRACE, + ("!!! WpaSupplicantScanCount > 3\n")); Status = NDIS_STATUS_SUCCESS; break; } - if ((OPSTATUS_TEST_FLAG(pAdapter, fOP_STATUS_MEDIA_STATE_CONNECTED)) && - ((pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || - (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) && - (pAdapter->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED)) - { - DBGPRINT(RT_DEBUG_TRACE, ("!!! Link UP, Port Not Secured! ignore this set::OID_802_11_BSSID_LIST_SCAN\n")); + if ((OPSTATUS_TEST_FLAG + (pAdapter, fOP_STATUS_MEDIA_STATE_CONNECTED)) + && ((pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPA) + || (pAdapter->StaCfg.AuthMode == + Ndis802_11AuthModeWPAPSK)) + && (pAdapter->StaCfg.PortSecured == + WPA_802_1X_PORT_NOT_SECURED)) { + DBGPRINT(RT_DEBUG_TRACE, + ("!!! Link UP, Port Not Secured! ignore this set::OID_802_11_BSSID_LIST_SCAN\n")); Status = NDIS_STATUS_SUCCESS; break; } - if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { + if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) { RTMP_MLME_RESET_STATE_MACHINE(pAdapter); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); + DBGPRINT(RT_DEBUG_TRACE, + ("!!! MLME busy, reset MLME state machine !!!\n")); } - // tell CNTL state machine to call NdisMSetInformationComplete() after completing // this request, because this request is initiated by NDIS. pAdapter->MlmeAux.CurrReqIsFromNdis = FALSE; @@ -747,148 +789,151 @@ int rt_ioctl_siwscan(struct net_device *dev, pAdapter->StaCfg.LastScanTime = Now; MlmeEnqueue(pAdapter, - MLME_CNTL_STATE_MACHINE, - OID_802_11_BSSID_LIST_SCAN, - 0, - NULL); + MLME_CNTL_STATE_MACHINE, + OID_802_11_BSSID_LIST_SCAN, 0, NULL); Status = NDIS_STATUS_SUCCESS; RTMP_MLME_HANDLER(pAdapter); - }while(0); + } while (0); return NDIS_STATUS_SUCCESS; } int rt_ioctl_giwscan(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) + struct iw_request_info *info, + struct iw_point *data, char *extra) { PRTMP_ADAPTER pAdapter = NULL; - int i=0; + int i = 0; PSTRING current_ev = extra, previous_ev = extra; PSTRING end_buf; PSTRING current_val; - STRING custom[MAX_CUSTOM_LEN] = {0}; + STRING custom[MAX_CUSTOM_LEN] = { 0 }; struct iw_event iwe; GET_PAD_FROM_NET_DEV(pAdapter, dev); - if (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - { + if (RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) { /* * Still scanning, indicate the caller should try again. */ return -EAGAIN; } - if (pAdapter->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) - { + if (pAdapter->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) { pAdapter->StaCfg.WpaSupplicantScanCount = 0; } - if (pAdapter->ScanTab.BssNr == 0) - { + if (pAdapter->ScanTab.BssNr == 0) { data->length = 0; return 0; } - if (data->length > 0) - end_buf = extra + data->length; - else - end_buf = extra + IW_SCAN_MAX_DATA; + if (data->length > 0) + end_buf = extra + data->length; + else + end_buf = extra + IW_SCAN_MAX_DATA; - for (i = 0; i < pAdapter->ScanTab.BssNr; i++) - { - if (current_ev >= end_buf) - { + for (i = 0; i < pAdapter->ScanTab.BssNr; i++) { + if (current_ev >= end_buf) { return -E2BIG; - } - + } //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, &pAdapter->ScanTab.BssEntry[i].Bssid, ETH_ALEN); + memcpy(iwe.u.ap_addr.sa_data, + &pAdapter->ScanTab.BssEntry[i].Bssid, ETH_ALEN); - previous_ev = current_ev; - current_ev = iwe_stream_add_event(info, current_ev,end_buf, &iwe, IW_EV_ADDR_LEN); - if (current_ev == previous_ev) - return -E2BIG; + previous_ev = current_ev; + current_ev = + iwe_stream_add_event(info, current_ev, end_buf, &iwe, + IW_EV_ADDR_LEN); + if (current_ev == previous_ev) + return -E2BIG; /* - Protocol: - it will show scanned AP's WirelessMode . - it might be - 802.11a - 802.11a/n - 802.11g/n - 802.11b/g/n - 802.11g - 802.11b/g - */ + Protocol: + it will show scanned AP's WirelessMode . + it might be + 802.11a + 802.11a/n + 802.11g/n + 802.11b/g/n + 802.11g + 802.11b/g + */ memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWNAME; - - { - PBSS_ENTRY pBssEntry=&pAdapter->ScanTab.BssEntry[i]; - BOOLEAN isGonly=FALSE; - int rateCnt=0; - - if (pBssEntry->Channel>14) - { - if (pBssEntry->HtCapabilityLen!=0) - strcpy(iwe.u.name,"802.11a/n"); - else - strcpy(iwe.u.name,"802.11a"); - } - else { - /* - if one of non B mode rate is set supported rate . it mean G only. - */ - for (rateCnt=0;rateCntSupRateLen;rateCnt++) - { - /* - 6Mbps(140) 9Mbps(146) and >=12Mbps(152) are supported rate , it mean G only. - */ - if (pBssEntry->SupRate[rateCnt]==140 || pBssEntry->SupRate[rateCnt]==146 || pBssEntry->SupRate[rateCnt]>=152) - isGonly=TRUE; - } + PBSS_ENTRY pBssEntry = &pAdapter->ScanTab.BssEntry[i]; + BOOLEAN isGonly = FALSE; + int rateCnt = 0; - for (rateCnt=0;rateCntExtRateLen;rateCnt++) - { - if (pBssEntry->ExtRate[rateCnt]==140 || pBssEntry->ExtRate[rateCnt]==146 || pBssEntry->ExtRate[rateCnt]>=152) - isGonly=TRUE; - } + if (pBssEntry->Channel > 14) { + if (pBssEntry->HtCapabilityLen != 0) + strcpy(iwe.u.name, "802.11a/n"); + else + strcpy(iwe.u.name, "802.11a"); + } else { + /* + if one of non B mode rate is set supported rate . it mean G only. + */ + for (rateCnt = 0; + rateCnt < pBssEntry->SupRateLen; + rateCnt++) { + /* + 6Mbps(140) 9Mbps(146) and >=12Mbps(152) are supported rate , it mean G only. + */ + if (pBssEntry->SupRate[rateCnt] == 140 + || pBssEntry->SupRate[rateCnt] == + 146 + || pBssEntry->SupRate[rateCnt] >= + 152) + isGonly = TRUE; + } + for (rateCnt = 0; + rateCnt < pBssEntry->ExtRateLen; + rateCnt++) { + if (pBssEntry->ExtRate[rateCnt] == 140 + || pBssEntry->ExtRate[rateCnt] == + 146 + || pBssEntry->ExtRate[rateCnt] >= + 152) + isGonly = TRUE; + } - if (pBssEntry->HtCapabilityLen!=0) - { - if (isGonly==TRUE) - strcpy(iwe.u.name,"802.11g/n"); - else - strcpy(iwe.u.name,"802.11b/g/n"); - } - else - { - if (isGonly==TRUE) - strcpy(iwe.u.name,"802.11g"); - else - { - if (pBssEntry->SupRateLen==4 && pBssEntry->ExtRateLen==0) - strcpy(iwe.u.name,"802.11b"); + if (pBssEntry->HtCapabilityLen != 0) { + if (isGonly == TRUE) + strcpy(iwe.u.name, "802.11g/n"); else - strcpy(iwe.u.name,"802.11b/g"); + strcpy(iwe.u.name, + "802.11b/g/n"); + } else { + if (isGonly == TRUE) + strcpy(iwe.u.name, "802.11g"); + else { + if (pBssEntry->SupRateLen == 4 + && pBssEntry->ExtRateLen == + 0) + strcpy(iwe.u.name, + "802.11b"); + else + strcpy(iwe.u.name, + "802.11b/g"); + } } } } - } previous_ev = current_ev; - current_ev = iwe_stream_add_event(info, current_ev,end_buf, &iwe, IW_EV_ADDR_LEN); - if (current_ev == previous_ev) - return -E2BIG; + current_ev = + iwe_stream_add_event(info, current_ev, end_buf, &iwe, + IW_EV_ADDR_LEN); + if (current_ev == previous_ev) + return -E2BIG; //ESSID //================================ @@ -897,33 +942,34 @@ int rt_ioctl_giwscan(struct net_device *dev, iwe.u.data.length = pAdapter->ScanTab.BssEntry[i].SsidLen; iwe.u.data.flags = 1; - previous_ev = current_ev; - current_ev = iwe_stream_add_point(info, current_ev,end_buf, &iwe, (PSTRING) pAdapter->ScanTab.BssEntry[i].Ssid); - if (current_ev == previous_ev) - return -E2BIG; + previous_ev = current_ev; + current_ev = + iwe_stream_add_point(info, current_ev, end_buf, &iwe, + (PSTRING) pAdapter->ScanTab. + BssEntry[i].Ssid); + if (current_ev == previous_ev) + return -E2BIG; //Network Type //================================ memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWMODE; - if (pAdapter->ScanTab.BssEntry[i].BssType == Ndis802_11IBSS) - { + if (pAdapter->ScanTab.BssEntry[i].BssType == Ndis802_11IBSS) { iwe.u.mode = IW_MODE_ADHOC; - } - else if (pAdapter->ScanTab.BssEntry[i].BssType == Ndis802_11Infrastructure) - { + } else if (pAdapter->ScanTab.BssEntry[i].BssType == + Ndis802_11Infrastructure) { iwe.u.mode = IW_MODE_INFRA; - } - else - { + } else { iwe.u.mode = IW_MODE_AUTO; } iwe.len = IW_EV_UINT_LEN; - previous_ev = current_ev; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN); - if (current_ev == previous_ev) - return -E2BIG; + previous_ev = current_ev; + current_ev = + iwe_stream_add_event(info, current_ev, end_buf, &iwe, + IW_EV_UINT_LEN); + if (current_ev == previous_ev) + return -E2BIG; //Channel and Frequency //================================ @@ -937,190 +983,217 @@ int rt_ioctl_giwscan(struct net_device *dev, iwe.u.freq.i = 0; previous_ev = current_ev; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); - if (current_ev == previous_ev) - return -E2BIG; - - //Add quality statistics - //================================ - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVQUAL; - iwe.u.qual.level = 0; - iwe.u.qual.noise = 0; - set_quality(pAdapter, &iwe.u.qual, pAdapter->ScanTab.BssEntry[i].Rssi); - current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); - if (current_ev == previous_ev) - return -E2BIG; + current_ev = + iwe_stream_add_event(info, current_ev, end_buf, &iwe, + IW_EV_FREQ_LEN); + if (current_ev == previous_ev) + return -E2BIG; + + //Add quality statistics + //================================ + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = IWEVQUAL; + iwe.u.qual.level = 0; + iwe.u.qual.noise = 0; + set_quality(pAdapter, &iwe.u.qual, + pAdapter->ScanTab.BssEntry[i].Rssi); + current_ev = + iwe_stream_add_event(info, current_ev, end_buf, &iwe, + IW_EV_QUAL_LEN); + if (current_ev == previous_ev) + return -E2BIG; //Encyption key //================================ memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWENCODE; - if (CAP_IS_PRIVACY_ON (pAdapter->ScanTab.BssEntry[i].CapabilityInfo )) - iwe.u.data.flags =IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; + if (CAP_IS_PRIVACY_ON + (pAdapter->ScanTab.BssEntry[i].CapabilityInfo)) + iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; else iwe.u.data.flags = IW_ENCODE_DISABLED; - previous_ev = current_ev; - current_ev = iwe_stream_add_point(info, current_ev, end_buf,&iwe, (char *)pAdapter->SharedKey[BSS0][(iwe.u.data.flags & IW_ENCODE_INDEX)-1].Key); - if (current_ev == previous_ev) - return -E2BIG; + previous_ev = current_ev; + current_ev = + iwe_stream_add_point(info, current_ev, end_buf, &iwe, + (char *)pAdapter-> + SharedKey[BSS0][(iwe.u.data. + flags & + IW_ENCODE_INDEX) - + 1].Key); + if (current_ev == previous_ev) + return -E2BIG; //Bit Rate //================================ - if (pAdapter->ScanTab.BssEntry[i].SupRateLen) - { - UCHAR tmpRate = pAdapter->ScanTab.BssEntry[i].SupRate[pAdapter->ScanTab.BssEntry[i].SupRateLen-1]; + if (pAdapter->ScanTab.BssEntry[i].SupRateLen) { + UCHAR tmpRate = + pAdapter->ScanTab.BssEntry[i].SupRate[pAdapter-> + ScanTab. + BssEntry[i]. + SupRateLen - + 1]; memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWRATE; - current_val = current_ev + IW_EV_LCP_LEN; - if (tmpRate == 0x82) - iwe.u.bitrate.value = 1 * 1000000; - else if (tmpRate == 0x84) - iwe.u.bitrate.value = 2 * 1000000; - else if (tmpRate == 0x8B) - iwe.u.bitrate.value = 5.5 * 1000000; - else if (tmpRate == 0x96) - iwe.u.bitrate.value = 11 * 1000000; - else - iwe.u.bitrate.value = (tmpRate/2) * 1000000; - - if (tmpRate == 0x6c && pAdapter->ScanTab.BssEntry[i].HtCapabilityLen > 0) - { - int rate_count = sizeof(ralinkrate)/sizeof(__s32); - HT_CAP_INFO capInfo = pAdapter->ScanTab.BssEntry[i].HtCapability.HtCapInfo; - int shortGI = capInfo.ChannelWidth ? capInfo.ShortGIfor40 : capInfo.ShortGIfor20; - int maxMCS = pAdapter->ScanTab.BssEntry[i].HtCapability.MCSSet[1] ? 15 : 7; - int rate_index = 12 + ((UCHAR)capInfo.ChannelWidth * 24) + ((UCHAR)shortGI *48) + ((UCHAR)maxMCS); + current_val = current_ev + IW_EV_LCP_LEN; + if (tmpRate == 0x82) + iwe.u.bitrate.value = 1 * 1000000; + else if (tmpRate == 0x84) + iwe.u.bitrate.value = 2 * 1000000; + else if (tmpRate == 0x8B) + iwe.u.bitrate.value = 5.5 * 1000000; + else if (tmpRate == 0x96) + iwe.u.bitrate.value = 11 * 1000000; + else + iwe.u.bitrate.value = (tmpRate / 2) * 1000000; + + if (tmpRate == 0x6c + && pAdapter->ScanTab.BssEntry[i].HtCapabilityLen > + 0) { + int rate_count = + sizeof(ralinkrate) / sizeof(__s32); + HT_CAP_INFO capInfo = + pAdapter->ScanTab.BssEntry[i].HtCapability. + HtCapInfo; + int shortGI = + capInfo.ChannelWidth ? capInfo. + ShortGIfor40 : capInfo.ShortGIfor20; + int maxMCS = + pAdapter->ScanTab.BssEntry[i].HtCapability. + MCSSet[1] ? 15 : 7; + int rate_index = + 12 + ((UCHAR) capInfo.ChannelWidth * 24) + + ((UCHAR) shortGI * 48) + ((UCHAR) maxMCS); if (rate_index < 0) rate_index = 0; if (rate_index > rate_count) rate_index = rate_count; - iwe.u.bitrate.value = ralinkrate[rate_index] * 500000; + iwe.u.bitrate.value = + ralinkrate[rate_index] * 500000; } iwe.u.bitrate.disabled = 0; 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; - else - return -E2BIG; - } + current_val, end_buf, + &iwe, + IW_EV_PARAM_LEN); + if ((current_val - current_ev) > IW_EV_LCP_LEN) + current_ev = current_val; + else + return -E2BIG; + } //WPA IE - if (pAdapter->ScanTab.BssEntry[i].WpaIE.IELen > 0) - { + if (pAdapter->ScanTab.BssEntry[i].WpaIE.IELen > 0) { memset(&iwe, 0, sizeof(iwe)); memset(&custom[0], 0, MAX_CUSTOM_LEN); - memcpy(custom, &(pAdapter->ScanTab.BssEntry[i].WpaIE.IE[0]), - pAdapter->ScanTab.BssEntry[i].WpaIE.IELen); + memcpy(custom, + &(pAdapter->ScanTab.BssEntry[i].WpaIE.IE[0]), + pAdapter->ScanTab.BssEntry[i].WpaIE.IELen); iwe.cmd = IWEVGENIE; - iwe.u.data.length = pAdapter->ScanTab.BssEntry[i].WpaIE.IELen; - current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, custom); + iwe.u.data.length = + pAdapter->ScanTab.BssEntry[i].WpaIE.IELen; + current_ev = + iwe_stream_add_point(info, current_ev, end_buf, + &iwe, custom); if (current_ev == previous_ev) return -E2BIG; } - //WPA2 IE - if (pAdapter->ScanTab.BssEntry[i].RsnIE.IELen > 0) - { - memset(&iwe, 0, sizeof(iwe)); + if (pAdapter->ScanTab.BssEntry[i].RsnIE.IELen > 0) { + memset(&iwe, 0, sizeof(iwe)); memset(&custom[0], 0, MAX_CUSTOM_LEN); - memcpy(custom, &(pAdapter->ScanTab.BssEntry[i].RsnIE.IE[0]), - pAdapter->ScanTab.BssEntry[i].RsnIE.IELen); + memcpy(custom, + &(pAdapter->ScanTab.BssEntry[i].RsnIE.IE[0]), + pAdapter->ScanTab.BssEntry[i].RsnIE.IELen); iwe.cmd = IWEVGENIE; - iwe.u.data.length = pAdapter->ScanTab.BssEntry[i].RsnIE.IELen; - current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, custom); + iwe.u.data.length = + pAdapter->ScanTab.BssEntry[i].RsnIE.IELen; + current_ev = + iwe_stream_add_point(info, current_ev, end_buf, + &iwe, custom); if (current_ev == previous_ev) return -E2BIG; - } + } } data->length = current_ev - extra; - pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE; - DBGPRINT(RT_DEBUG_ERROR ,("===>rt_ioctl_giwscan. %d(%d) BSS returned, data->length = %d\n",i , pAdapter->ScanTab.BssNr, data->length)); + pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE; + DBGPRINT(RT_DEBUG_ERROR, + ("===>rt_ioctl_giwscan. %d(%d) BSS returned, data->length = %d\n", + i, pAdapter->ScanTab.BssNr, data->length)); return 0; } int rt_ioctl_siwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *essid) + struct iw_request_info *info, + struct iw_point *data, char *essid) { PRTMP_ADAPTER pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } + if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + return -ENETDOWN; + } - if (data->flags) - { - PSTRING pSsidString = NULL; + if (data->flags) { + PSTRING pSsidString = NULL; // Includes null character. if (data->length > (IW_ESSID_MAX_SIZE + 1)) return -E2BIG; - pSsidString = kmalloc(MAX_LEN_OF_SSID+1, MEM_ALLOC_FLAG); - if (pSsidString) - { - NdisZeroMemory(pSsidString, MAX_LEN_OF_SSID+1); + pSsidString = kmalloc(MAX_LEN_OF_SSID + 1, MEM_ALLOC_FLAG); + if (pSsidString) { + NdisZeroMemory(pSsidString, MAX_LEN_OF_SSID + 1); NdisMoveMemory(pSsidString, essid, data->length); if (Set_SSID_Proc(pAdapter, pSsidString) == FALSE) return -EINVAL; - } - else + } else return -ENOMEM; - } - else - { + } else { // ANY ssid if (Set_SSID_Proc(pAdapter, "") == FALSE) return -EINVAL; - } + } return 0; } int rt_ioctl_giwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *essid) + struct iw_request_info *info, + struct iw_point *data, char *essid) { PRTMP_ADAPTER pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); data->flags = 1; - if (MONITOR_ON(pAdapter)) - { - data->length = 0; - return 0; - } + if (MONITOR_ON(pAdapter)) { + data->length = 0; + return 0; + } - if (OPSTATUS_TEST_FLAG(pAdapter, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - DBGPRINT(RT_DEBUG_TRACE ,("MediaState is connected\n")); + if (OPSTATUS_TEST_FLAG(pAdapter, fOP_STATUS_MEDIA_STATE_CONNECTED)) { + DBGPRINT(RT_DEBUG_TRACE, ("MediaState is connected\n")); data->length = pAdapter->CommonCfg.SsidLen; - memcpy(essid, pAdapter->CommonCfg.Ssid, pAdapter->CommonCfg.SsidLen); + memcpy(essid, pAdapter->CommonCfg.Ssid, + pAdapter->CommonCfg.SsidLen); } #ifdef RTMP_MAC_USB - // Add for RT2870 - else if (pAdapter->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) - { - data->length = pAdapter->CommonCfg.SsidLen; - memcpy(essid, pAdapter->CommonCfg.Ssid, pAdapter->CommonCfg.SsidLen); + // Add for RT2870 + else if (pAdapter->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) { + data->length = pAdapter->CommonCfg.SsidLen; + memcpy(essid, pAdapter->CommonCfg.Ssid, + pAdapter->CommonCfg.SsidLen); } #endif // RTMP_MAC_USB // - else - {//the ANY ssid was specified - data->length = 0; - DBGPRINT(RT_DEBUG_TRACE ,("MediaState is not connected, ess\n")); + else { //the ANY ssid was specified + data->length = 0; + DBGPRINT(RT_DEBUG_TRACE, + ("MediaState is not connected, ess\n")); } return 0; @@ -1128,19 +1201,18 @@ int rt_ioctl_giwessid(struct net_device *dev, } int rt_ioctl_siwnickn(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *nickname) + struct iw_request_info *info, + struct iw_point *data, char *nickname) { PRTMP_ADAPTER pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE ,("INFO::Network is down!\n")); - return -ENETDOWN; - } + //check if the interface is down + if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + return -ENETDOWN; + } if (data->length > IW_ESSID_MAX_SIZE) return -EINVAL; @@ -1148,13 +1220,12 @@ int rt_ioctl_siwnickn(struct net_device *dev, memset(pAdapter->nickname, 0, IW_ESSID_MAX_SIZE + 1); memcpy(pAdapter->nickname, nickname, data->length); - return 0; } int rt_ioctl_giwnickn(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *nickname) + struct iw_request_info *info, + struct iw_point *data, char *nickname) { PRTMP_ADAPTER pAdapter = NULL; @@ -1163,34 +1234,33 @@ int rt_ioctl_giwnickn(struct net_device *dev, if (data->length > strlen((PSTRING) pAdapter->nickname) + 1) data->length = strlen((PSTRING) pAdapter->nickname) + 1; if (data->length > 0) { - memcpy(nickname, pAdapter->nickname, data->length-1); - nickname[data->length-1] = '\0'; + memcpy(nickname, pAdapter->nickname, data->length - 1); + nickname[data->length - 1] = '\0'; } return 0; } int rt_ioctl_siwrts(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rts, char *extra) + struct iw_request_info *info, + struct iw_param *rts, char *extra) { PRTMP_ADAPTER pAdapter = NULL; u16 val; GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } + //check if the interface is down + if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + return -ENETDOWN; + } if (rts->disabled) val = MAX_RTS_THRESHOLD; else if (rts->value < 0 || rts->value > MAX_RTS_THRESHOLD) return -EINVAL; else if (rts->value == 0) - val = MAX_RTS_THRESHOLD; + val = MAX_RTS_THRESHOLD; else val = rts->value; @@ -1201,19 +1271,18 @@ int rt_ioctl_siwrts(struct net_device *dev, } int rt_ioctl_giwrts(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rts, char *extra) + struct iw_request_info *info, + struct iw_param *rts, char *extra) { PRTMP_ADAPTER pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } + if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + return -ENETDOWN; + } rts->value = pAdapter->CommonCfg.RtsThreshold; rts->disabled = (rts->value == MAX_RTS_THRESHOLD); @@ -1223,8 +1292,8 @@ int rt_ioctl_giwrts(struct net_device *dev, } int rt_ioctl_siwfrag(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *frag, char *extra) + struct iw_request_info *info, + struct iw_param *frag, char *extra) { PRTMP_ADAPTER pAdapter = NULL; u16 val; @@ -1232,18 +1301,18 @@ int rt_ioctl_siwfrag(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } + if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + return -ENETDOWN; + } if (frag->disabled) val = MAX_FRAG_THRESHOLD; - else if (frag->value >= MIN_FRAG_THRESHOLD && frag->value <= MAX_FRAG_THRESHOLD) - val = __cpu_to_le16(frag->value & ~0x1); /* even numbers only */ + else if (frag->value >= MIN_FRAG_THRESHOLD + && frag->value <= MAX_FRAG_THRESHOLD) + val = __cpu_to_le16(frag->value & ~0x1); /* even numbers only */ else if (frag->value == 0) - val = MAX_FRAG_THRESHOLD; + val = MAX_FRAG_THRESHOLD; else return -EINVAL; @@ -1252,19 +1321,18 @@ int rt_ioctl_siwfrag(struct net_device *dev, } int rt_ioctl_giwfrag(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *frag, char *extra) + struct iw_request_info *info, + struct iw_param *frag, char *extra) { PRTMP_ADAPTER pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } + if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + return -ENETDOWN; + } frag->value = pAdapter->CommonCfg.FragmentThreshold; frag->disabled = (frag->value == MAX_FRAG_THRESHOLD); @@ -1276,113 +1344,111 @@ int rt_ioctl_giwfrag(struct net_device *dev, #define MAX_WEP_KEY_SIZE 13 #define MIN_WEP_KEY_SIZE 5 int rt_ioctl_siwencode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, char *extra) + struct iw_request_info *info, + struct iw_point *erq, char *extra) { PRTMP_ADAPTER pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - - if ((erq->length == 0) && - (erq->flags & IW_ENCODE_DISABLED)) - { + if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + return -ENETDOWN; + } + + if ((erq->length == 0) && (erq->flags & IW_ENCODE_DISABLED)) { pAdapter->StaCfg.PairCipher = Ndis802_11WEPDisabled; pAdapter->StaCfg.GroupCipher = Ndis802_11WEPDisabled; pAdapter->StaCfg.WepStatus = Ndis802_11WEPDisabled; - pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; - goto done; - } - else if (erq->flags & IW_ENCODE_RESTRICTED || erq->flags & IW_ENCODE_OPEN) - { - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; + pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; + goto done; + } else if (erq->flags & IW_ENCODE_RESTRICTED + || erq->flags & IW_ENCODE_OPEN) { + //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; STA_PORT_SECURED(pAdapter); pAdapter->StaCfg.PairCipher = Ndis802_11WEPEnabled; pAdapter->StaCfg.GroupCipher = Ndis802_11WEPEnabled; pAdapter->StaCfg.WepStatus = Ndis802_11WEPEnabled; - pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; + pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; if (erq->flags & IW_ENCODE_RESTRICTED) pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeShared; - else + else pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; } - if (erq->length > 0) - { + if (erq->length > 0) { int keyIdx = (erq->flags & IW_ENCODE_INDEX) - 1; /* Check the size of the key */ - if (erq->length > MAX_WEP_KEY_SIZE) - { + if (erq->length > MAX_WEP_KEY_SIZE) { return -EINVAL; } /* Check key index */ - if ((keyIdx < 0) || (keyIdx >= NR_WEP_KEYS)) - { - DBGPRINT(RT_DEBUG_TRACE ,("==>rt_ioctl_siwencode::Wrong keyIdx=%d! Using default key instead (%d)\n", - keyIdx, pAdapter->StaCfg.DefaultKeyId)); + if ((keyIdx < 0) || (keyIdx >= NR_WEP_KEYS)) { + DBGPRINT(RT_DEBUG_TRACE, + ("==>rt_ioctl_siwencode::Wrong keyIdx=%d! Using default key instead (%d)\n", + keyIdx, pAdapter->StaCfg.DefaultKeyId)); - //Using default key + //Using default key keyIdx = pAdapter->StaCfg.DefaultKeyId; - } - else + } else pAdapter->StaCfg.DefaultKeyId = keyIdx; - NdisZeroMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, 16); - - if (erq->length == MAX_WEP_KEY_SIZE) - { - pAdapter->SharedKey[BSS0][keyIdx].KeyLen = MAX_WEP_KEY_SIZE; - pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = CIPHER_WEP128; - } - else if (erq->length == MIN_WEP_KEY_SIZE) - { - pAdapter->SharedKey[BSS0][keyIdx].KeyLen = MIN_WEP_KEY_SIZE; - pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = CIPHER_WEP64; - } - else + NdisZeroMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, 16); + + if (erq->length == MAX_WEP_KEY_SIZE) { + pAdapter->SharedKey[BSS0][keyIdx].KeyLen = + MAX_WEP_KEY_SIZE; + pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = + CIPHER_WEP128; + } else if (erq->length == MIN_WEP_KEY_SIZE) { + pAdapter->SharedKey[BSS0][keyIdx].KeyLen = + MIN_WEP_KEY_SIZE; + pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = + CIPHER_WEP64; + } else /* Disable the key */ pAdapter->SharedKey[BSS0][keyIdx].KeyLen = 0; /* Check if the key is not marked as invalid */ - if(!(erq->flags & IW_ENCODE_NOKEY)) - { + if (!(erq->flags & IW_ENCODE_NOKEY)) { /* Copy the key in the driver */ - NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, extra, erq->length); - } - } - else - { + NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, + extra, erq->length); + } + } else { /* Do we want to just set the transmit key index ? */ int index = (erq->flags & IW_ENCODE_INDEX) - 1; - if ((index >= 0) && (index < 4)) - { + if ((index >= 0) && (index < 4)) { pAdapter->StaCfg.DefaultKeyId = index; - } - else + } else /* Don't complain if only change the mode */ - if (!(erq->flags & IW_ENCODE_MODE)) - return -EINVAL; - } + if (!(erq->flags & IW_ENCODE_MODE)) + return -EINVAL; + } done: - DBGPRINT(RT_DEBUG_TRACE ,("==>rt_ioctl_siwencode::erq->flags=%x\n",erq->flags)); - DBGPRINT(RT_DEBUG_TRACE ,("==>rt_ioctl_siwencode::AuthMode=%x\n",pAdapter->StaCfg.AuthMode)); - DBGPRINT(RT_DEBUG_TRACE ,("==>rt_ioctl_siwencode::DefaultKeyId=%x, KeyLen = %d\n",pAdapter->StaCfg.DefaultKeyId , pAdapter->SharedKey[BSS0][pAdapter->StaCfg.DefaultKeyId].KeyLen)); - DBGPRINT(RT_DEBUG_TRACE ,("==>rt_ioctl_siwencode::WepStatus=%x\n",pAdapter->StaCfg.WepStatus)); + DBGPRINT(RT_DEBUG_TRACE, + ("==>rt_ioctl_siwencode::erq->flags=%x\n", erq->flags)); + DBGPRINT(RT_DEBUG_TRACE, + ("==>rt_ioctl_siwencode::AuthMode=%x\n", + pAdapter->StaCfg.AuthMode)); + DBGPRINT(RT_DEBUG_TRACE, + ("==>rt_ioctl_siwencode::DefaultKeyId=%x, KeyLen = %d\n", + pAdapter->StaCfg.DefaultKeyId, + pAdapter->SharedKey[BSS0][pAdapter->StaCfg.DefaultKeyId]. + KeyLen)); + DBGPRINT(RT_DEBUG_TRACE, + ("==>rt_ioctl_siwencode::WepStatus=%x\n", + pAdapter->StaCfg.WepStatus)); return 0; } int rt_ioctl_giwencode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, char *key) + struct iw_request_info *info, + struct iw_point *erq, char *key) { int kid; PRTMP_ADAPTER pAdapter = NULL; @@ -1390,49 +1456,49 @@ rt_ioctl_giwencode(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; + if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + return -ENETDOWN; } kid = erq->flags & IW_ENCODE_INDEX; - DBGPRINT(RT_DEBUG_TRACE, ("===>rt_ioctl_giwencode %d\n", erq->flags & IW_ENCODE_INDEX)); + DBGPRINT(RT_DEBUG_TRACE, + ("===>rt_ioctl_giwencode %d\n", erq->flags & IW_ENCODE_INDEX)); - if (pAdapter->StaCfg.WepStatus == Ndis802_11WEPDisabled) - { + if (pAdapter->StaCfg.WepStatus == Ndis802_11WEPDisabled) { erq->length = 0; erq->flags = IW_ENCODE_DISABLED; - } - else if ((kid > 0) && (kid <=4)) - { + } else if ((kid > 0) && (kid <= 4)) { // copy wep key - erq->flags = kid ; /* NB: base 1 */ - if (erq->length > pAdapter->SharedKey[BSS0][kid-1].KeyLen) - erq->length = pAdapter->SharedKey[BSS0][kid-1].KeyLen; - memcpy(key, pAdapter->SharedKey[BSS0][kid-1].Key, erq->length); + erq->flags = kid; /* NB: base 1 */ + if (erq->length > pAdapter->SharedKey[BSS0][kid - 1].KeyLen) + erq->length = pAdapter->SharedKey[BSS0][kid - 1].KeyLen; + memcpy(key, pAdapter->SharedKey[BSS0][kid - 1].Key, + erq->length); //if ((kid == pAdapter->PortCfg.DefaultKeyId)) - //erq->flags |= IW_ENCODE_ENABLED; /* XXX */ + //erq->flags |= IW_ENCODE_ENABLED; /* XXX */ if (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeShared) - erq->flags |= IW_ENCODE_RESTRICTED; /* XXX */ + erq->flags |= IW_ENCODE_RESTRICTED; /* XXX */ else - erq->flags |= IW_ENCODE_OPEN; /* XXX */ + erq->flags |= IW_ENCODE_OPEN; /* XXX */ - } - else if (kid == 0) - { + } else if (kid == 0) { if (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeShared) - erq->flags |= IW_ENCODE_RESTRICTED; /* XXX */ + erq->flags |= IW_ENCODE_RESTRICTED; /* XXX */ else - erq->flags |= IW_ENCODE_OPEN; /* XXX */ - erq->length = pAdapter->SharedKey[BSS0][pAdapter->StaCfg.DefaultKeyId].KeyLen; - memcpy(key, pAdapter->SharedKey[BSS0][pAdapter->StaCfg.DefaultKeyId].Key, erq->length); + erq->flags |= IW_ENCODE_OPEN; /* XXX */ + erq->length = + pAdapter->SharedKey[BSS0][pAdapter->StaCfg.DefaultKeyId]. + KeyLen; + memcpy(key, + pAdapter->SharedKey[BSS0][pAdapter->StaCfg.DefaultKeyId]. + Key, erq->length); // copy default key ID if (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeShared) - erq->flags |= IW_ENCODE_RESTRICTED; /* XXX */ + erq->flags |= IW_ENCODE_RESTRICTED; /* XXX */ else - erq->flags |= IW_ENCODE_OPEN; /* XXX */ - erq->flags = pAdapter->StaCfg.DefaultKeyId + 1; /* NB: base 1 */ + erq->flags |= IW_ENCODE_OPEN; /* XXX */ + erq->flags = pAdapter->StaCfg.DefaultKeyId + 1; /* NB: base 1 */ erq->flags |= IW_ENCODE_ENABLED; /* XXX */ } @@ -1440,63 +1506,71 @@ rt_ioctl_giwencode(struct net_device *dev, } -void getBaInfo( - IN PRTMP_ADAPTER pAd, - IN PSTRING pOutBuf) +void getBaInfo(IN PRTMP_ADAPTER pAd, IN PSTRING pOutBuf) { INT i, j; BA_ORI_ENTRY *pOriBAEntry; BA_REC_ENTRY *pRecBAEntry; - for (i=0; iMacTab.Content[i]; - if (((pEntry->ValidAsCLI || pEntry->ValidAsApCli) && (pEntry->Sst == SST_ASSOC)) - || (pEntry->ValidAsWDS) || (pEntry->ValidAsMesh)) - { - sprintf(pOutBuf + strlen(pOutBuf), "\n%02X:%02X:%02X:%02X:%02X:%02X (Aid = %d) (AP) -\n", - pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2], - pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5], pEntry->Aid); + if (((pEntry->ValidAsCLI || pEntry->ValidAsApCli) + && (pEntry->Sst == SST_ASSOC)) + || (pEntry->ValidAsWDS) || (pEntry->ValidAsMesh)) { + sprintf(pOutBuf + strlen(pOutBuf), + "\n%02X:%02X:%02X:%02X:%02X:%02X (Aid = %d) (AP) -\n", + pEntry->Addr[0], pEntry->Addr[1], + pEntry->Addr[2], pEntry->Addr[3], + pEntry->Addr[4], pEntry->Addr[5], pEntry->Aid); sprintf(pOutBuf, "%s[Recipient]\n", pOutBuf); - for (j=0; j < NUM_OF_TID; j++) - { - if (pEntry->BARecWcidArray[j] != 0) - { - pRecBAEntry =&pAd->BATable.BARecEntry[pEntry->BARecWcidArray[j]]; - sprintf(pOutBuf + strlen(pOutBuf), "TID=%d, BAWinSize=%d, LastIndSeq=%d, ReorderingPkts=%d\n", j, pRecBAEntry->BAWinSize, pRecBAEntry->LastIndSeq, pRecBAEntry->list.qlen); + for (j = 0; j < NUM_OF_TID; j++) { + if (pEntry->BARecWcidArray[j] != 0) { + pRecBAEntry = + &pAd->BATable.BARecEntry[pEntry-> + BARecWcidArray + [j]]; + sprintf(pOutBuf + strlen(pOutBuf), + "TID=%d, BAWinSize=%d, LastIndSeq=%d, ReorderingPkts=%d\n", + j, pRecBAEntry->BAWinSize, + pRecBAEntry->LastIndSeq, + pRecBAEntry->list.qlen); } } sprintf(pOutBuf, "%s\n", pOutBuf); sprintf(pOutBuf, "%s[Originator]\n", pOutBuf); - for (j=0; j < NUM_OF_TID; j++) - { - if (pEntry->BAOriWcidArray[j] != 0) - { - pOriBAEntry =&pAd->BATable.BAOriEntry[pEntry->BAOriWcidArray[j]]; - sprintf(pOutBuf + strlen(pOutBuf), "TID=%d, BAWinSize=%d, StartSeq=%d, CurTxSeq=%d\n", j, pOriBAEntry->BAWinSize, pOriBAEntry->Sequence, pEntry->TxSeq[j]); + for (j = 0; j < NUM_OF_TID; j++) { + if (pEntry->BAOriWcidArray[j] != 0) { + pOriBAEntry = + &pAd->BATable.BAOriEntry[pEntry-> + BAOriWcidArray + [j]]; + sprintf(pOutBuf + strlen(pOutBuf), + "TID=%d, BAWinSize=%d, StartSeq=%d, CurTxSeq=%d\n", + j, pOriBAEntry->BAWinSize, + pOriBAEntry->Sequence, + pEntry->TxSeq[j]); } } sprintf(pOutBuf, "%s\n\n", pOutBuf); } - if (strlen(pOutBuf) > (IW_PRIV_SIZE_MASK - 30)) - break; + if (strlen(pOutBuf) > (IW_PRIV_SIZE_MASK - 30)) + break; } return; } int rt_ioctl_siwmlme(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = NULL; + PRTMP_ADAPTER pAd = NULL; struct iw_mlme *pMlme = (struct iw_mlme *)wrqu->data.pointer; - MLME_QUEUE_ELEM MsgElem; - MLME_DISASSOC_REQ_STRUCT DisAssocReq; - MLME_DEAUTH_REQ_STRUCT DeAuthReq; + MLME_QUEUE_ELEM MsgElem; + MLME_DISASSOC_REQ_STRUCT DisAssocReq; + MLME_DEAUTH_REQ_STRUCT DeAuthReq; GET_PAD_FROM_NET_DEV(pAd, dev); @@ -1505,405 +1579,444 @@ int rt_ioctl_siwmlme(struct net_device *dev, if (pMlme == NULL) return -EINVAL; - switch(pMlme->cmd) - { + switch (pMlme->cmd) { #ifdef IW_MLME_DEAUTH - case IW_MLME_DEAUTH: - DBGPRINT(RT_DEBUG_TRACE, ("====> %s - IW_MLME_DEAUTH\n", __func__)); - COPY_MAC_ADDR(DeAuthReq.Addr, pAd->CommonCfg.Bssid); - DeAuthReq.Reason = pMlme->reason_code; - MsgElem.MsgLen = sizeof(MLME_DEAUTH_REQ_STRUCT); - NdisMoveMemory(MsgElem.Msg, &DeAuthReq, sizeof(MLME_DEAUTH_REQ_STRUCT)); - MlmeDeauthReqAction(pAd, &MsgElem); - if (INFRA_ON(pAd)) - { - LinkDown(pAd, FALSE); - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - } - break; + case IW_MLME_DEAUTH: + DBGPRINT(RT_DEBUG_TRACE, + ("====> %s - IW_MLME_DEAUTH\n", __func__)); + COPY_MAC_ADDR(DeAuthReq.Addr, pAd->CommonCfg.Bssid); + DeAuthReq.Reason = pMlme->reason_code; + MsgElem.MsgLen = sizeof(MLME_DEAUTH_REQ_STRUCT); + NdisMoveMemory(MsgElem.Msg, &DeAuthReq, + sizeof(MLME_DEAUTH_REQ_STRUCT)); + MlmeDeauthReqAction(pAd, &MsgElem); + if (INFRA_ON(pAd)) { + LinkDown(pAd, FALSE); + pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; + } + break; #endif // IW_MLME_DEAUTH // #ifdef IW_MLME_DISASSOC - case IW_MLME_DISASSOC: - DBGPRINT(RT_DEBUG_TRACE, ("====> %s - IW_MLME_DISASSOC\n", __func__)); - COPY_MAC_ADDR(DisAssocReq.Addr, pAd->CommonCfg.Bssid); - DisAssocReq.Reason = pMlme->reason_code; - - MsgElem.Machine = ASSOC_STATE_MACHINE; - MsgElem.MsgType = MT2_MLME_DISASSOC_REQ; - MsgElem.MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT); - NdisMoveMemory(MsgElem.Msg, &DisAssocReq, sizeof(MLME_DISASSOC_REQ_STRUCT)); - - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC; - MlmeDisassocReqAction(pAd, &MsgElem); - break; + case IW_MLME_DISASSOC: + DBGPRINT(RT_DEBUG_TRACE, + ("====> %s - IW_MLME_DISASSOC\n", __func__)); + COPY_MAC_ADDR(DisAssocReq.Addr, pAd->CommonCfg.Bssid); + DisAssocReq.Reason = pMlme->reason_code; + + MsgElem.Machine = ASSOC_STATE_MACHINE; + MsgElem.MsgType = MT2_MLME_DISASSOC_REQ; + MsgElem.MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT); + NdisMoveMemory(MsgElem.Msg, &DisAssocReq, + sizeof(MLME_DISASSOC_REQ_STRUCT)); + + pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC; + MlmeDisassocReqAction(pAd, &MsgElem); + break; #endif // IW_MLME_DISASSOC // - default: - DBGPRINT(RT_DEBUG_TRACE, ("====> %s - Unknow Command\n", __func__)); - break; + default: + DBGPRINT(RT_DEBUG_TRACE, + ("====> %s - Unknow Command\n", __func__)); + break; } return 0; } int rt_ioctl_siwauth(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + PRTMP_ADAPTER pAdapter = NULL; struct iw_param *param = &wrqu->param; GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; + //check if the interface is down + if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + return -ENETDOWN; } switch (param->flags & IW_AUTH_INDEX) { - case IW_AUTH_WPA_VERSION: - if (param->value == IW_AUTH_WPA_VERSION_WPA) - { - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPAPSK; - if (pAdapter->StaCfg.BssType == BSS_ADHOC) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPANone; - } - else if (param->value == IW_AUTH_WPA_VERSION_WPA2) - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPA2PSK; - - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_WPA_VERSION - param->value = %d!\n", __func__, param->value)); - break; - case IW_AUTH_CIPHER_PAIRWISE: - if (param->value == IW_AUTH_CIPHER_NONE) - { - pAdapter->StaCfg.WepStatus = Ndis802_11WEPDisabled; - pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; - pAdapter->StaCfg.PairCipher = Ndis802_11WEPDisabled; - } - else if (param->value == IW_AUTH_CIPHER_WEP40 || - param->value == IW_AUTH_CIPHER_WEP104) - { - pAdapter->StaCfg.WepStatus = Ndis802_11WEPEnabled; - pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; - pAdapter->StaCfg.PairCipher = Ndis802_11WEPEnabled; - pAdapter->StaCfg.IEEE8021X = FALSE; - } - else if (param->value == IW_AUTH_CIPHER_TKIP) - { - pAdapter->StaCfg.WepStatus = Ndis802_11Encryption2Enabled; - pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; - pAdapter->StaCfg.PairCipher = Ndis802_11Encryption2Enabled; - } - else if (param->value == IW_AUTH_CIPHER_CCMP) - { - pAdapter->StaCfg.WepStatus = Ndis802_11Encryption3Enabled; - pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; - pAdapter->StaCfg.PairCipher = Ndis802_11Encryption3Enabled; - } - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_CIPHER_PAIRWISE - param->value = %d!\n", __func__, param->value)); - break; - case IW_AUTH_CIPHER_GROUP: - if (param->value == IW_AUTH_CIPHER_NONE) - { - pAdapter->StaCfg.GroupCipher = Ndis802_11WEPDisabled; - } - else if (param->value == IW_AUTH_CIPHER_WEP40 || - param->value == IW_AUTH_CIPHER_WEP104) - { - pAdapter->StaCfg.GroupCipher = Ndis802_11WEPEnabled; - } - else if (param->value == IW_AUTH_CIPHER_TKIP) - { - pAdapter->StaCfg.GroupCipher = Ndis802_11Encryption2Enabled; - } - else if (param->value == IW_AUTH_CIPHER_CCMP) - { - pAdapter->StaCfg.GroupCipher = Ndis802_11Encryption3Enabled; - } - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_CIPHER_GROUP - param->value = %d!\n", __func__, param->value)); - break; - case IW_AUTH_KEY_MGMT: - if (param->value == IW_AUTH_KEY_MGMT_802_1X) - { - if (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) - { - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPA; - pAdapter->StaCfg.IEEE8021X = FALSE; - } - else if (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) - { - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPA2; - pAdapter->StaCfg.IEEE8021X = FALSE; - } - else - // WEP 1x - pAdapter->StaCfg.IEEE8021X = TRUE; - } - else if (param->value == 0) - { - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - STA_PORT_SECURED(pAdapter); - } - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_KEY_MGMT - param->value = %d!\n", __func__, param->value)); - break; - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - break; - case IW_AUTH_PRIVACY_INVOKED: - /*if (param->value == 0) - { - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; - pAdapter->StaCfg.WepStatus = Ndis802_11WEPDisabled; - pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; - pAdapter->StaCfg.PairCipher = Ndis802_11WEPDisabled; - pAdapter->StaCfg.GroupCipher = Ndis802_11WEPDisabled; - }*/ - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_PRIVACY_INVOKED - param->value = %d!\n", __func__, param->value)); - break; - case IW_AUTH_DROP_UNENCRYPTED: - if (param->value != 0) - pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - else - { - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - STA_PORT_SECURED(pAdapter); - } - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_WPA_VERSION - param->value = %d!\n", __func__, param->value)); - break; - case IW_AUTH_80211_AUTH_ALG: - if (param->value & IW_AUTH_ALG_SHARED_KEY) - { - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeShared; - } - else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM) - { - pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; - } - else - return -EINVAL; - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_80211_AUTH_ALG - param->value = %d!\n", __func__, param->value)); - break; - case IW_AUTH_WPA_ENABLED: - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_AUTH_WPA_ENABLED - Driver supports WPA!(param->value = %d)\n", __func__, param->value)); - break; - default: - return -EOPNOTSUPP; -} + case IW_AUTH_WPA_VERSION: + if (param->value == IW_AUTH_WPA_VERSION_WPA) { + pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPAPSK; + if (pAdapter->StaCfg.BssType == BSS_ADHOC) + pAdapter->StaCfg.AuthMode = + Ndis802_11AuthModeWPANone; + } else if (param->value == IW_AUTH_WPA_VERSION_WPA2) + pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeWPA2PSK; + + DBGPRINT(RT_DEBUG_TRACE, + ("%s::IW_AUTH_WPA_VERSION - param->value = %d!\n", + __func__, param->value)); + break; + case IW_AUTH_CIPHER_PAIRWISE: + if (param->value == IW_AUTH_CIPHER_NONE) { + pAdapter->StaCfg.WepStatus = Ndis802_11WEPDisabled; + pAdapter->StaCfg.OrigWepStatus = + pAdapter->StaCfg.WepStatus; + pAdapter->StaCfg.PairCipher = Ndis802_11WEPDisabled; + } else if (param->value == IW_AUTH_CIPHER_WEP40 || + param->value == IW_AUTH_CIPHER_WEP104) { + pAdapter->StaCfg.WepStatus = Ndis802_11WEPEnabled; + pAdapter->StaCfg.OrigWepStatus = + pAdapter->StaCfg.WepStatus; + pAdapter->StaCfg.PairCipher = Ndis802_11WEPEnabled; + pAdapter->StaCfg.IEEE8021X = FALSE; + } else if (param->value == IW_AUTH_CIPHER_TKIP) { + pAdapter->StaCfg.WepStatus = + Ndis802_11Encryption2Enabled; + pAdapter->StaCfg.OrigWepStatus = + pAdapter->StaCfg.WepStatus; + pAdapter->StaCfg.PairCipher = + Ndis802_11Encryption2Enabled; + } else if (param->value == IW_AUTH_CIPHER_CCMP) { + pAdapter->StaCfg.WepStatus = + Ndis802_11Encryption3Enabled; + pAdapter->StaCfg.OrigWepStatus = + pAdapter->StaCfg.WepStatus; + pAdapter->StaCfg.PairCipher = + Ndis802_11Encryption3Enabled; + } + DBGPRINT(RT_DEBUG_TRACE, + ("%s::IW_AUTH_CIPHER_PAIRWISE - param->value = %d!\n", + __func__, param->value)); + break; + case IW_AUTH_CIPHER_GROUP: + if (param->value == IW_AUTH_CIPHER_NONE) { + pAdapter->StaCfg.GroupCipher = Ndis802_11WEPDisabled; + } else if (param->value == IW_AUTH_CIPHER_WEP40 || + param->value == IW_AUTH_CIPHER_WEP104) { + pAdapter->StaCfg.GroupCipher = Ndis802_11WEPEnabled; + } else if (param->value == IW_AUTH_CIPHER_TKIP) { + pAdapter->StaCfg.GroupCipher = + Ndis802_11Encryption2Enabled; + } else if (param->value == IW_AUTH_CIPHER_CCMP) { + pAdapter->StaCfg.GroupCipher = + Ndis802_11Encryption3Enabled; + } + DBGPRINT(RT_DEBUG_TRACE, + ("%s::IW_AUTH_CIPHER_GROUP - param->value = %d!\n", + __func__, param->value)); + break; + case IW_AUTH_KEY_MGMT: + if (param->value == IW_AUTH_KEY_MGMT_802_1X) { + if (pAdapter->StaCfg.AuthMode == + Ndis802_11AuthModeWPAPSK) { + pAdapter->StaCfg.AuthMode = + Ndis802_11AuthModeWPA; + pAdapter->StaCfg.IEEE8021X = FALSE; + } else if (pAdapter->StaCfg.AuthMode == + Ndis802_11AuthModeWPA2PSK) { + pAdapter->StaCfg.AuthMode = + Ndis802_11AuthModeWPA2; + pAdapter->StaCfg.IEEE8021X = FALSE; + } else + // WEP 1x + pAdapter->StaCfg.IEEE8021X = TRUE; + } else if (param->value == 0) { + //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + STA_PORT_SECURED(pAdapter); + } + DBGPRINT(RT_DEBUG_TRACE, + ("%s::IW_AUTH_KEY_MGMT - param->value = %d!\n", + __func__, param->value)); + break; + case IW_AUTH_RX_UNENCRYPTED_EAPOL: + break; + case IW_AUTH_PRIVACY_INVOKED: + /*if (param->value == 0) + { + pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; + pAdapter->StaCfg.WepStatus = Ndis802_11WEPDisabled; + pAdapter->StaCfg.OrigWepStatus = pAdapter->StaCfg.WepStatus; + pAdapter->StaCfg.PairCipher = Ndis802_11WEPDisabled; + pAdapter->StaCfg.GroupCipher = Ndis802_11WEPDisabled; + } */ + DBGPRINT(RT_DEBUG_TRACE, + ("%s::IW_AUTH_PRIVACY_INVOKED - param->value = %d!\n", + __func__, param->value)); + break; + case IW_AUTH_DROP_UNENCRYPTED: + if (param->value != 0) + pAdapter->StaCfg.PortSecured = + WPA_802_1X_PORT_NOT_SECURED; + else { + //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + STA_PORT_SECURED(pAdapter); + } + DBGPRINT(RT_DEBUG_TRACE, + ("%s::IW_AUTH_WPA_VERSION - param->value = %d!\n", + __func__, param->value)); + break; + case IW_AUTH_80211_AUTH_ALG: + if (param->value & IW_AUTH_ALG_SHARED_KEY) { + pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeShared; + } else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM) { + pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; + } else + return -EINVAL; + DBGPRINT(RT_DEBUG_TRACE, + ("%s::IW_AUTH_80211_AUTH_ALG - param->value = %d!\n", + __func__, param->value)); + break; + case IW_AUTH_WPA_ENABLED: + DBGPRINT(RT_DEBUG_TRACE, + ("%s::IW_AUTH_WPA_ENABLED - Driver supports WPA!(param->value = %d)\n", + __func__, param->value)); + break; + default: + return -EOPNOTSUPP; + } return 0; } int rt_ioctl_giwauth(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + PRTMP_ADAPTER pAdapter = NULL; struct iw_param *param = &wrqu->param; GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } + //check if the interface is down + if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + return -ENETDOWN; + } switch (param->flags & IW_AUTH_INDEX) { case IW_AUTH_DROP_UNENCRYPTED: - param->value = (pAdapter->StaCfg.WepStatus == Ndis802_11WEPDisabled) ? 0 : 1; + param->value = + (pAdapter->StaCfg.WepStatus == + Ndis802_11WEPDisabled) ? 0 : 1; break; case IW_AUTH_80211_AUTH_ALG: - param->value = (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeShared) ? IW_AUTH_ALG_SHARED_KEY : IW_AUTH_ALG_OPEN_SYSTEM; + param->value = + (pAdapter->StaCfg.AuthMode == + Ndis802_11AuthModeShared) ? IW_AUTH_ALG_SHARED_KEY : + IW_AUTH_ALG_OPEN_SYSTEM; break; case IW_AUTH_WPA_ENABLED: - param->value = (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) ? 1 : 0; + param->value = + (pAdapter->StaCfg.AuthMode >= + Ndis802_11AuthModeWPA) ? 1 : 0; break; default: return -EOPNOTSUPP; } - DBGPRINT(RT_DEBUG_TRACE, ("rt_ioctl_giwauth::param->value = %d!\n", param->value)); + DBGPRINT(RT_DEBUG_TRACE, + ("rt_ioctl_giwauth::param->value = %d!\n", param->value)); return 0; } -void fnSetCipherKey( - IN PRTMP_ADAPTER pAdapter, - IN INT keyIdx, - IN UCHAR CipherAlg, - IN BOOLEAN bGTK, - IN struct iw_encode_ext *ext) +void fnSetCipherKey(IN PRTMP_ADAPTER pAdapter, + IN INT keyIdx, + IN UCHAR CipherAlg, + IN BOOLEAN bGTK, IN struct iw_encode_ext *ext) { - NdisZeroMemory(&pAdapter->SharedKey[BSS0][keyIdx], sizeof(CIPHER_KEY)); - pAdapter->SharedKey[BSS0][keyIdx].KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, ext->key, LEN_TKIP_EK); - NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].TxMic, ext->key + LEN_TKIP_EK, LEN_TKIP_TXMICK); - NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].RxMic, ext->key + LEN_TKIP_EK + LEN_TKIP_TXMICK, LEN_TKIP_RXMICK); - pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = CipherAlg; - - // Update group key information to ASIC Shared Key Table + NdisZeroMemory(&pAdapter->SharedKey[BSS0][keyIdx], sizeof(CIPHER_KEY)); + pAdapter->SharedKey[BSS0][keyIdx].KeyLen = LEN_TKIP_EK; + NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, ext->key, + LEN_TKIP_EK); + NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].TxMic, + ext->key + LEN_TKIP_EK, LEN_TKIP_TXMICK); + NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].RxMic, + ext->key + LEN_TKIP_EK + LEN_TKIP_TXMICK, + LEN_TKIP_RXMICK); + pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = CipherAlg; + + // Update group key information to ASIC Shared Key Table AsicAddSharedKeyEntry(pAdapter, - BSS0, - keyIdx, - pAdapter->SharedKey[BSS0][keyIdx].CipherAlg, - pAdapter->SharedKey[BSS0][keyIdx].Key, - pAdapter->SharedKey[BSS0][keyIdx].TxMic, - pAdapter->SharedKey[BSS0][keyIdx].RxMic); - - if (bGTK) - // Update ASIC WCID attribute table and IVEIV table - RTMPAddWcidAttributeEntry(pAdapter, - BSS0, - keyIdx, - pAdapter->SharedKey[BSS0][keyIdx].CipherAlg, - NULL); - else - // Update ASIC WCID attribute table and IVEIV table - RTMPAddWcidAttributeEntry(pAdapter, - BSS0, - keyIdx, - pAdapter->SharedKey[BSS0][keyIdx].CipherAlg, - &pAdapter->MacTab.Content[BSSID_WCID]); + BSS0, + keyIdx, + pAdapter->SharedKey[BSS0][keyIdx].CipherAlg, + pAdapter->SharedKey[BSS0][keyIdx].Key, + pAdapter->SharedKey[BSS0][keyIdx].TxMic, + pAdapter->SharedKey[BSS0][keyIdx].RxMic); + + if (bGTK) + // Update ASIC WCID attribute table and IVEIV table + RTMPAddWcidAttributeEntry(pAdapter, + BSS0, + keyIdx, + pAdapter->SharedKey[BSS0][keyIdx]. + CipherAlg, NULL); + else + // Update ASIC WCID attribute table and IVEIV table + RTMPAddWcidAttributeEntry(pAdapter, + BSS0, + keyIdx, + pAdapter->SharedKey[BSS0][keyIdx]. + CipherAlg, + &pAdapter->MacTab. + Content[BSSID_WCID]); } int rt_ioctl_siwencodeext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra) - { - PRTMP_ADAPTER pAdapter = NULL; + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + PRTMP_ADAPTER pAdapter = NULL; struct iw_point *encoding = &wrqu->encoding; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int keyIdx, alg = ext->alg; + int keyIdx, alg = ext->alg; GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down - if(!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; + //check if the interface is down + if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + return -ENETDOWN; } - if (encoding->flags & IW_ENCODE_DISABLED) - { - keyIdx = (encoding->flags & IW_ENCODE_INDEX) - 1; - // set BSSID wcid entry of the Pair-wise Key table as no-security mode - AsicRemovePairwiseKeyEntry(pAdapter, BSS0, BSSID_WCID); - pAdapter->SharedKey[BSS0][keyIdx].KeyLen = 0; + if (encoding->flags & IW_ENCODE_DISABLED) { + keyIdx = (encoding->flags & IW_ENCODE_INDEX) - 1; + // set BSSID wcid entry of the Pair-wise Key table as no-security mode + AsicRemovePairwiseKeyEntry(pAdapter, BSS0, BSSID_WCID); + pAdapter->SharedKey[BSS0][keyIdx].KeyLen = 0; pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = CIPHER_NONE; - AsicRemoveSharedKeyEntry(pAdapter, 0, (UCHAR)keyIdx); - NdisZeroMemory(&pAdapter->SharedKey[BSS0][keyIdx], sizeof(CIPHER_KEY)); - DBGPRINT(RT_DEBUG_TRACE, ("%s::Remove all keys!(encoding->flags = %x)\n", __func__, encoding->flags)); - } - else - { - // Get Key Index and convet to our own defined key index - keyIdx = (encoding->flags & IW_ENCODE_INDEX) - 1; - if((keyIdx < 0) || (keyIdx >= NR_WEP_KEYS)) - return -EINVAL; - - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) - { - pAdapter->StaCfg.DefaultKeyId = keyIdx; - DBGPRINT(RT_DEBUG_TRACE, ("%s::DefaultKeyId = %d\n", __func__, pAdapter->StaCfg.DefaultKeyId)); - } - - switch (alg) { - case IW_ENCODE_ALG_NONE: - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_ENCODE_ALG_NONE\n", __func__)); - break; - case IW_ENCODE_ALG_WEP: - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_ENCODE_ALG_WEP - ext->key_len = %d, keyIdx = %d\n", __func__, ext->key_len, keyIdx)); - if (ext->key_len == MAX_WEP_KEY_SIZE) - { - pAdapter->SharedKey[BSS0][keyIdx].KeyLen = MAX_WEP_KEY_SIZE; - pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = CIPHER_WEP128; - } - else if (ext->key_len == MIN_WEP_KEY_SIZE) - { - pAdapter->SharedKey[BSS0][keyIdx].KeyLen = MIN_WEP_KEY_SIZE; - pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = CIPHER_WEP64; - } - else - return -EINVAL; + AsicRemoveSharedKeyEntry(pAdapter, 0, (UCHAR) keyIdx); + NdisZeroMemory(&pAdapter->SharedKey[BSS0][keyIdx], + sizeof(CIPHER_KEY)); + DBGPRINT(RT_DEBUG_TRACE, + ("%s::Remove all keys!(encoding->flags = %x)\n", + __func__, encoding->flags)); + } else { + // Get Key Index and convet to our own defined key index + keyIdx = (encoding->flags & IW_ENCODE_INDEX) - 1; + if ((keyIdx < 0) || (keyIdx >= NR_WEP_KEYS)) + return -EINVAL; - NdisZeroMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, 16); - NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, ext->key, ext->key_len); - if (pAdapter->StaCfg.GroupCipher == Ndis802_11GroupWEP40Enabled || - pAdapter->StaCfg.GroupCipher == Ndis802_11GroupWEP104Enabled) - { - // Set Group key material to Asic - AsicAddSharedKeyEntry(pAdapter, BSS0, keyIdx, pAdapter->SharedKey[BSS0][keyIdx].CipherAlg, pAdapter->SharedKey[BSS0][keyIdx].Key, NULL, NULL); + if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { + pAdapter->StaCfg.DefaultKeyId = keyIdx; + DBGPRINT(RT_DEBUG_TRACE, + ("%s::DefaultKeyId = %d\n", __func__, + pAdapter->StaCfg.DefaultKeyId)); + } - // Update WCID attribute table and IVEIV table for this group key table - RTMPAddWcidAttributeEntry(pAdapter, BSS0, keyIdx, pAdapter->SharedKey[BSS0][keyIdx].CipherAlg, NULL); + switch (alg) { + case IW_ENCODE_ALG_NONE: + DBGPRINT(RT_DEBUG_TRACE, + ("%s::IW_ENCODE_ALG_NONE\n", __func__)); + break; + case IW_ENCODE_ALG_WEP: + DBGPRINT(RT_DEBUG_TRACE, + ("%s::IW_ENCODE_ALG_WEP - ext->key_len = %d, keyIdx = %d\n", + __func__, ext->key_len, keyIdx)); + if (ext->key_len == MAX_WEP_KEY_SIZE) { + pAdapter->SharedKey[BSS0][keyIdx].KeyLen = + MAX_WEP_KEY_SIZE; + pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = + CIPHER_WEP128; + } else if (ext->key_len == MIN_WEP_KEY_SIZE) { + pAdapter->SharedKey[BSS0][keyIdx].KeyLen = + MIN_WEP_KEY_SIZE; + pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = + CIPHER_WEP64; + } else + return -EINVAL; - STA_PORT_SECURED(pAdapter); + NdisZeroMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, + 16); + NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, + ext->key, ext->key_len); + if (pAdapter->StaCfg.GroupCipher == + Ndis802_11GroupWEP40Enabled + || pAdapter->StaCfg.GroupCipher == + Ndis802_11GroupWEP104Enabled) { + // Set Group key material to Asic + AsicAddSharedKeyEntry(pAdapter, BSS0, keyIdx, + pAdapter-> + SharedKey[BSS0][keyIdx]. + CipherAlg, + pAdapter-> + SharedKey[BSS0][keyIdx]. + Key, NULL, NULL); + + // Update WCID attribute table and IVEIV table for this group key table + RTMPAddWcidAttributeEntry(pAdapter, BSS0, + keyIdx, + pAdapter-> + SharedKey[BSS0] + [keyIdx].CipherAlg, + NULL); + + STA_PORT_SECURED(pAdapter); + + // Indicate Connected for GUI + pAdapter->IndicateMediaState = + NdisMediaStateConnected; + } + break; + case IW_ENCODE_ALG_TKIP: + DBGPRINT(RT_DEBUG_TRACE, + ("%s::IW_ENCODE_ALG_TKIP - keyIdx = %d, ext->key_len = %d\n", + __func__, keyIdx, ext->key_len)); + if (ext->key_len == 32) { + if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { + fnSetCipherKey(pAdapter, keyIdx, + CIPHER_TKIP, FALSE, ext); + if (pAdapter->StaCfg.AuthMode >= + Ndis802_11AuthModeWPA2) { + //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + STA_PORT_SECURED(pAdapter); + pAdapter->IndicateMediaState = + NdisMediaStateConnected; + } + } else if (ext-> + ext_flags & IW_ENCODE_EXT_GROUP_KEY) + { + fnSetCipherKey(pAdapter, keyIdx, + CIPHER_TKIP, TRUE, ext); - // Indicate Connected for GUI - pAdapter->IndicateMediaState = NdisMediaStateConnected; + // set 802.1x port control + //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + STA_PORT_SECURED(pAdapter); + pAdapter->IndicateMediaState = + NdisMediaStateConnected; } - break; - case IW_ENCODE_ALG_TKIP: - DBGPRINT(RT_DEBUG_TRACE, ("%s::IW_ENCODE_ALG_TKIP - keyIdx = %d, ext->key_len = %d\n", __func__, keyIdx, ext->key_len)); - if (ext->key_len == 32) - { - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) - { - fnSetCipherKey(pAdapter, keyIdx, CIPHER_TKIP, FALSE, ext); - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA2) - { - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - STA_PORT_SECURED(pAdapter); - pAdapter->IndicateMediaState = NdisMediaStateConnected; - } - } - else if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) - { - fnSetCipherKey(pAdapter, keyIdx, CIPHER_TKIP, TRUE, ext); - - // set 802.1x port control - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - STA_PORT_SECURED(pAdapter); - pAdapter->IndicateMediaState = NdisMediaStateConnected; - } - } - else - return -EINVAL; - break; - case IW_ENCODE_ALG_CCMP: - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) - { - fnSetCipherKey(pAdapter, keyIdx, CIPHER_AES, FALSE, ext); - if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA2) - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - STA_PORT_SECURED(pAdapter); - pAdapter->IndicateMediaState = NdisMediaStateConnected; - } - else if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) - { - fnSetCipherKey(pAdapter, keyIdx, CIPHER_AES, TRUE, ext); - - // set 802.1x port control - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - STA_PORT_SECURED(pAdapter); - pAdapter->IndicateMediaState = NdisMediaStateConnected; - } - break; - default: - return -EINVAL; + } else + return -EINVAL; + break; + case IW_ENCODE_ALG_CCMP: + if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { + fnSetCipherKey(pAdapter, keyIdx, CIPHER_AES, + FALSE, ext); + if (pAdapter->StaCfg.AuthMode >= + Ndis802_11AuthModeWPA2) + //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + STA_PORT_SECURED(pAdapter); + pAdapter->IndicateMediaState = + NdisMediaStateConnected; + } else if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { + fnSetCipherKey(pAdapter, keyIdx, CIPHER_AES, + TRUE, ext); + + // set 802.1x port control + //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + STA_PORT_SECURED(pAdapter); + pAdapter->IndicateMediaState = + NdisMediaStateConnected; + } + break; + default: + return -EINVAL; } - } + } - return 0; + return 0; } int rt_ioctl_giwencodeext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { PRTMP_ADAPTER pAd = NULL; PCHAR pKey = NULL; @@ -1913,72 +2026,65 @@ rt_ioctl_giwencodeext(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAd, dev); - DBGPRINT(RT_DEBUG_TRACE ,("===> rt_ioctl_giwencodeext\n")); + DBGPRINT(RT_DEBUG_TRACE, ("===> rt_ioctl_giwencodeext\n")); max_key_len = encoding->length - sizeof(*ext); if (max_key_len < 0) return -EINVAL; idx = encoding->flags & IW_ENCODE_INDEX; - if (idx) - { + if (idx) { if (idx < 1 || idx > 4) return -EINVAL; idx--; if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) || - (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled)) - { - if (idx != pAd->StaCfg.DefaultKeyId) - { + (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled)) { + if (idx != pAd->StaCfg.DefaultKeyId) { ext->key_len = 0; return 0; } } - } - else + } else idx = pAd->StaCfg.DefaultKeyId; encoding->flags = idx + 1; memset(ext, 0, sizeof(*ext)); ext->key_len = 0; - switch(pAd->StaCfg.WepStatus) { - case Ndis802_11WEPDisabled: - ext->alg = IW_ENCODE_ALG_NONE; - encoding->flags |= IW_ENCODE_DISABLED; - break; - case Ndis802_11WEPEnabled: - ext->alg = IW_ENCODE_ALG_WEP; - if (pAd->SharedKey[BSS0][idx].KeyLen > max_key_len) - return -E2BIG; - else - { - ext->key_len = pAd->SharedKey[BSS0][idx].KeyLen; - pKey = (PCHAR)&(pAd->SharedKey[BSS0][idx].Key[0]); - } - break; - case Ndis802_11Encryption2Enabled: - case Ndis802_11Encryption3Enabled: - if (pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) - ext->alg = IW_ENCODE_ALG_TKIP; - else - ext->alg = IW_ENCODE_ALG_CCMP; + switch (pAd->StaCfg.WepStatus) { + case Ndis802_11WEPDisabled: + ext->alg = IW_ENCODE_ALG_NONE; + encoding->flags |= IW_ENCODE_DISABLED; + break; + case Ndis802_11WEPEnabled: + ext->alg = IW_ENCODE_ALG_WEP; + if (pAd->SharedKey[BSS0][idx].KeyLen > max_key_len) + return -E2BIG; + else { + ext->key_len = pAd->SharedKey[BSS0][idx].KeyLen; + pKey = (PCHAR) & (pAd->SharedKey[BSS0][idx].Key[0]); + } + break; + case Ndis802_11Encryption2Enabled: + case Ndis802_11Encryption3Enabled: + if (pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) + ext->alg = IW_ENCODE_ALG_TKIP; + else + ext->alg = IW_ENCODE_ALG_CCMP; - if (max_key_len < 32) - return -E2BIG; - else - { - ext->key_len = 32; - pKey = (PCHAR)&pAd->StaCfg.PMK[0]; - } - break; - default: - return -EINVAL; + if (max_key_len < 32) + return -E2BIG; + else { + ext->key_len = 32; + pKey = (PCHAR) & pAd->StaCfg.PMK[0]; + } + break; + default: + return -EINVAL; } - if (ext->key_len && pKey) - { + if (ext->key_len && pKey) { encoding->flags |= IW_ENCODE_ENABLED; memcpy(ext->key, pKey, ext->key_len); } @@ -1987,27 +2093,25 @@ rt_ioctl_giwencodeext(struct net_device *dev, } int rt_ioctl_siwgenie(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = NULL; + PRTMP_ADAPTER pAd = NULL; GET_PAD_FROM_NET_DEV(pAd, dev); - DBGPRINT(RT_DEBUG_TRACE ,("===> rt_ioctl_siwgenie\n")); + DBGPRINT(RT_DEBUG_TRACE, ("===> rt_ioctl_siwgenie\n")); pAd->StaCfg.bRSN_IE_FromWpaSupplicant = FALSE; if (wrqu->data.length > MAX_LEN_OF_RSNIE || (wrqu->data.length && extra == NULL)) return -EINVAL; - if (wrqu->data.length) - { + if (wrqu->data.length) { pAd->StaCfg.RSNIE_Len = wrqu->data.length; - NdisMoveMemory(&pAd->StaCfg.RSN_IE[0], extra, pAd->StaCfg.RSNIE_Len); + NdisMoveMemory(&pAd->StaCfg.RSN_IE[0], extra, + pAd->StaCfg.RSNIE_Len); pAd->StaCfg.bRSN_IE_FromWpaSupplicant = TRUE; - } - else - { + } else { pAd->StaCfg.RSNIE_Len = 0; NdisZeroMemory(&pAd->StaCfg.RSN_IE[0], MAX_LEN_OF_RSNIE); } @@ -2016,188 +2120,212 @@ int rt_ioctl_siwgenie(struct net_device *dev, } int rt_ioctl_giwgenie(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = NULL; + PRTMP_ADAPTER pAd = NULL; GET_PAD_FROM_NET_DEV(pAd, dev); if ((pAd->StaCfg.RSNIE_Len == 0) || - (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA)) - { + (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA)) { wrqu->data.length = 0; return 0; } - if (pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) - { - if (wrqu->data.length < pAd->StaCfg.RSNIE_Len) - return -E2BIG; + if (pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) { + if (wrqu->data.length < pAd->StaCfg.RSNIE_Len) + return -E2BIG; - wrqu->data.length = pAd->StaCfg.RSNIE_Len; - memcpy(extra, &pAd->StaCfg.RSN_IE[0], pAd->StaCfg.RSNIE_Len); - } - else - { + wrqu->data.length = pAd->StaCfg.RSNIE_Len; + memcpy(extra, &pAd->StaCfg.RSN_IE[0], pAd->StaCfg.RSNIE_Len); + } else { UCHAR RSNIe = IE_WPA; - if (wrqu->data.length < (pAd->StaCfg.RSNIE_Len + 2)) // ID, Len + if (wrqu->data.length < (pAd->StaCfg.RSNIE_Len + 2)) // ID, Len return -E2BIG; wrqu->data.length = pAd->StaCfg.RSNIE_Len + 2; if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2)) + (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2)) RSNIe = IE_RSN; extra[0] = (char)RSNIe; extra[1] = pAd->StaCfg.RSNIE_Len; - memcpy(extra+2, &pAd->StaCfg.RSN_IE[0], pAd->StaCfg.RSNIE_Len); + memcpy(extra + 2, &pAd->StaCfg.RSN_IE[0], + pAd->StaCfg.RSNIE_Len); } return 0; } int rt_ioctl_siwpmksa(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = NULL; + PRTMP_ADAPTER pAd = NULL; struct iw_pmksa *pPmksa = (struct iw_pmksa *)wrqu->data.pointer; - INT CachedIdx = 0, idx = 0; + INT CachedIdx = 0, idx = 0; GET_PAD_FROM_NET_DEV(pAd, dev); if (pPmksa == NULL) return -EINVAL; - DBGPRINT(RT_DEBUG_TRACE ,("===> rt_ioctl_siwpmksa\n")); - switch(pPmksa->cmd) - { - case IW_PMKSA_FLUSH: - NdisZeroMemory(pAd->StaCfg.SavedPMK, sizeof(BSSID_INFO)*PMKID_NO); - DBGPRINT(RT_DEBUG_TRACE ,("rt_ioctl_siwpmksa - IW_PMKSA_FLUSH\n")); - break; - case IW_PMKSA_REMOVE: - for (CachedIdx = 0; CachedIdx < pAd->StaCfg.SavedPMKNum; CachedIdx++) - { - // compare the BSSID - if (NdisEqualMemory(pPmksa->bssid.sa_data, pAd->StaCfg.SavedPMK[CachedIdx].BSSID, MAC_ADDR_LEN)) - { - NdisZeroMemory(pAd->StaCfg.SavedPMK[CachedIdx].BSSID, MAC_ADDR_LEN); - NdisZeroMemory(pAd->StaCfg.SavedPMK[CachedIdx].PMKID, 16); - for (idx = CachedIdx; idx < (pAd->StaCfg.SavedPMKNum - 1); idx++) - { - NdisMoveMemory(&pAd->StaCfg.SavedPMK[idx].BSSID[0], &pAd->StaCfg.SavedPMK[idx+1].BSSID[0], MAC_ADDR_LEN); - NdisMoveMemory(&pAd->StaCfg.SavedPMK[idx].PMKID[0], &pAd->StaCfg.SavedPMK[idx+1].PMKID[0], 16); - } - pAd->StaCfg.SavedPMKNum--; - break; - } - } + DBGPRINT(RT_DEBUG_TRACE, ("===> rt_ioctl_siwpmksa\n")); + switch (pPmksa->cmd) { + case IW_PMKSA_FLUSH: + NdisZeroMemory(pAd->StaCfg.SavedPMK, + sizeof(BSSID_INFO) * PMKID_NO); + DBGPRINT(RT_DEBUG_TRACE, + ("rt_ioctl_siwpmksa - IW_PMKSA_FLUSH\n")); + break; + case IW_PMKSA_REMOVE: + for (CachedIdx = 0; CachedIdx < pAd->StaCfg.SavedPMKNum; + CachedIdx++) { + // compare the BSSID + if (NdisEqualMemory + (pPmksa->bssid.sa_data, + pAd->StaCfg.SavedPMK[CachedIdx].BSSID, + MAC_ADDR_LEN)) { + NdisZeroMemory(pAd->StaCfg.SavedPMK[CachedIdx]. + BSSID, MAC_ADDR_LEN); + NdisZeroMemory(pAd->StaCfg.SavedPMK[CachedIdx]. + PMKID, 16); + for (idx = CachedIdx; + idx < (pAd->StaCfg.SavedPMKNum - 1); + idx++) { + NdisMoveMemory(&pAd->StaCfg. + SavedPMK[idx].BSSID[0], + &pAd->StaCfg. + SavedPMK[idx + + 1].BSSID[0], + MAC_ADDR_LEN); + NdisMoveMemory(&pAd->StaCfg. + SavedPMK[idx].PMKID[0], + &pAd->StaCfg. + SavedPMK[idx + + 1].PMKID[0], + 16); + } + pAd->StaCfg.SavedPMKNum--; + break; + } + } - DBGPRINT(RT_DEBUG_TRACE ,("rt_ioctl_siwpmksa - IW_PMKSA_REMOVE\n")); - break; - case IW_PMKSA_ADD: - for (CachedIdx = 0; CachedIdx < pAd->StaCfg.SavedPMKNum; CachedIdx++) - { - // compare the BSSID - if (NdisEqualMemory(pPmksa->bssid.sa_data, pAd->StaCfg.SavedPMK[CachedIdx].BSSID, MAC_ADDR_LEN)) - break; - } - - // Found, replace it - if (CachedIdx < PMKID_NO) - { - DBGPRINT(RT_DEBUG_OFF, ("Update PMKID, idx = %d\n", CachedIdx)); - NdisMoveMemory(&pAd->StaCfg.SavedPMK[CachedIdx].BSSID[0], pPmksa->bssid.sa_data, MAC_ADDR_LEN); - NdisMoveMemory(&pAd->StaCfg.SavedPMK[CachedIdx].PMKID[0], pPmksa->pmkid, 16); - pAd->StaCfg.SavedPMKNum++; - } - // Not found, replace the last one - else - { - // Randomly replace one - CachedIdx = (pPmksa->bssid.sa_data[5] % PMKID_NO); - DBGPRINT(RT_DEBUG_OFF, ("Update PMKID, idx = %d\n", CachedIdx)); - NdisMoveMemory(&pAd->StaCfg.SavedPMK[CachedIdx].BSSID[0], pPmksa->bssid.sa_data, MAC_ADDR_LEN); - NdisMoveMemory(&pAd->StaCfg.SavedPMK[CachedIdx].PMKID[0], pPmksa->pmkid, 16); - } - - DBGPRINT(RT_DEBUG_TRACE ,("rt_ioctl_siwpmksa - IW_PMKSA_ADD\n")); - break; - default: - DBGPRINT(RT_DEBUG_TRACE ,("rt_ioctl_siwpmksa - Unknow Command!!\n")); - break; + DBGPRINT(RT_DEBUG_TRACE, + ("rt_ioctl_siwpmksa - IW_PMKSA_REMOVE\n")); + break; + case IW_PMKSA_ADD: + for (CachedIdx = 0; CachedIdx < pAd->StaCfg.SavedPMKNum; + CachedIdx++) { + // compare the BSSID + if (NdisEqualMemory + (pPmksa->bssid.sa_data, + pAd->StaCfg.SavedPMK[CachedIdx].BSSID, + MAC_ADDR_LEN)) + break; + } + + // Found, replace it + if (CachedIdx < PMKID_NO) { + DBGPRINT(RT_DEBUG_OFF, + ("Update PMKID, idx = %d\n", CachedIdx)); + NdisMoveMemory(&pAd->StaCfg.SavedPMK[CachedIdx]. + BSSID[0], pPmksa->bssid.sa_data, + MAC_ADDR_LEN); + NdisMoveMemory(&pAd->StaCfg.SavedPMK[CachedIdx]. + PMKID[0], pPmksa->pmkid, 16); + pAd->StaCfg.SavedPMKNum++; + } + // Not found, replace the last one + else { + // Randomly replace one + CachedIdx = (pPmksa->bssid.sa_data[5] % PMKID_NO); + DBGPRINT(RT_DEBUG_OFF, + ("Update PMKID, idx = %d\n", CachedIdx)); + NdisMoveMemory(&pAd->StaCfg.SavedPMK[CachedIdx]. + BSSID[0], pPmksa->bssid.sa_data, + MAC_ADDR_LEN); + NdisMoveMemory(&pAd->StaCfg.SavedPMK[CachedIdx]. + PMKID[0], pPmksa->pmkid, 16); + } + + DBGPRINT(RT_DEBUG_TRACE, + ("rt_ioctl_siwpmksa - IW_PMKSA_ADD\n")); + break; + default: + DBGPRINT(RT_DEBUG_TRACE, + ("rt_ioctl_siwpmksa - Unknow Command!!\n")); + break; } return 0; } int rt_ioctl_siwrate(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = NULL; - UINT32 rate = wrqu->bitrate.value, fixed = wrqu->bitrate.fixed; + PRTMP_ADAPTER pAd = NULL; + UINT32 rate = wrqu->bitrate.value, fixed = wrqu->bitrate.fixed; GET_PAD_FROM_NET_DEV(pAd, dev); - //check if the interface is down - if(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("rt_ioctl_siwrate::Network is down!\n")); - return -ENETDOWN; + //check if the interface is down + if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + DBGPRINT(RT_DEBUG_TRACE, + ("rt_ioctl_siwrate::Network is down!\n")); + return -ENETDOWN; } - DBGPRINT(RT_DEBUG_TRACE, ("rt_ioctl_siwrate::(rate = %d, fixed = %d)\n", rate, fixed)); - /* rate = -1 => auto rate - rate = X, fixed = 1 => (fixed rate X) - */ - if (rate == -1) - { + DBGPRINT(RT_DEBUG_TRACE, + ("rt_ioctl_siwrate::(rate = %d, fixed = %d)\n", rate, fixed)); + /* rate = -1 => auto rate + rate = X, fixed = 1 => (fixed rate X) + */ + if (rate == -1) { //Auto Rate pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; pAd->StaCfg.bAutoTxRateSwitch = TRUE; if ((pAd->CommonCfg.PhyMode <= PHY_11G) || - (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE <= MODE_OFDM)) + (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE <= + MODE_OFDM)) RTMPSetDesiredRates(pAd, -1); SetCommonHT(pAd); - } - else - { - if (fixed) - { - pAd->StaCfg.bAutoTxRateSwitch = FALSE; - if ((pAd->CommonCfg.PhyMode <= PHY_11G) || - (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE <= MODE_OFDM)) - RTMPSetDesiredRates(pAd, rate); - else - { - pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; - SetCommonHT(pAd); - } - DBGPRINT(RT_DEBUG_TRACE, ("rt_ioctl_siwrate::(HtMcs=%d)\n",pAd->StaCfg.DesiredTransmitSetting.field.MCS)); - } - else - { - // TODO: rate = X, fixed = 0 => (rates <= X) - return -EOPNOTSUPP; - } - } - - return 0; + } else { + if (fixed) { + pAd->StaCfg.bAutoTxRateSwitch = FALSE; + if ((pAd->CommonCfg.PhyMode <= PHY_11G) || + (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field. + MODE <= MODE_OFDM)) + RTMPSetDesiredRates(pAd, rate); + else { + pAd->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_AUTO; + SetCommonHT(pAd); + } + DBGPRINT(RT_DEBUG_TRACE, + ("rt_ioctl_siwrate::(HtMcs=%d)\n", + pAd->StaCfg.DesiredTransmitSetting.field. + MCS)); + } else { + // TODO: rate = X, fixed = 0 => (rates <= X) + return -EOPNOTSUPP; + } + } + + return 0; } int rt_ioctl_giwrate(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = NULL; - int rate_index = 0, rate_count = 0; - HTTRANSMIT_SETTING ht_setting; + PRTMP_ADAPTER pAd = NULL; + int rate_index = 0, rate_count = 0; + HTTRANSMIT_SETTING ht_setting; /* Remove to global variable __s32 ralinkrate[] = {2, 4, 11, 22, // CCK @@ -2213,289 +2341,292 @@ int rt_ioctl_giwrate(struct net_device *dev, */ GET_PAD_FROM_NET_DEV(pAd, dev); - rate_count = sizeof(ralinkrate)/sizeof(__s32); - //check if the interface is down - if(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; + rate_count = sizeof(ralinkrate) / sizeof(__s32); + //check if the interface is down + if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + return -ENETDOWN; } - if ((pAd->StaCfg.bAutoTxRateSwitch == FALSE) && - (INFRA_ON(pAd)) && - ((pAd->CommonCfg.PhyMode <= PHY_11G) || (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE <= MODE_OFDM))) - ht_setting.word = pAd->StaCfg.HTPhyMode.word; - else - ht_setting.word = pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word; - - if (ht_setting.field.MODE >= MODE_HTMIX) - { -// rate_index = 12 + ((UCHAR)ht_setting.field.BW *16) + ((UCHAR)ht_setting.field.ShortGI *32) + ((UCHAR)ht_setting.field.MCS); - rate_index = 12 + ((UCHAR)ht_setting.field.BW *24) + ((UCHAR)ht_setting.field.ShortGI *48) + ((UCHAR)ht_setting.field.MCS); - } - else - if (ht_setting.field.MODE == MODE_OFDM) - rate_index = (UCHAR)(ht_setting.field.MCS) + 4; - else if (ht_setting.field.MODE == MODE_CCK) - rate_index = (UCHAR)(ht_setting.field.MCS); - - if (rate_index < 0) - rate_index = 0; - - if (rate_index > rate_count) - rate_index = rate_count; - - wrqu->bitrate.value = ralinkrate[rate_index] * 500000; - wrqu->bitrate.disabled = 0; - - return 0; + if ((pAd->StaCfg.bAutoTxRateSwitch == FALSE) && + (INFRA_ON(pAd)) && + ((pAd->CommonCfg.PhyMode <= PHY_11G) + || (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE <= + MODE_OFDM))) + ht_setting.word = pAd->StaCfg.HTPhyMode.word; + else + ht_setting.word = + pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word; + + if (ht_setting.field.MODE >= MODE_HTMIX) { +// rate_index = 12 + ((UCHAR)ht_setting.field.BW *16) + ((UCHAR)ht_setting.field.ShortGI *32) + ((UCHAR)ht_setting.field.MCS); + rate_index = + 12 + ((UCHAR) ht_setting.field.BW * 24) + + ((UCHAR) ht_setting.field.ShortGI * 48) + + ((UCHAR) ht_setting.field.MCS); + } else if (ht_setting.field.MODE == MODE_OFDM) + rate_index = (UCHAR) (ht_setting.field.MCS) + 4; + else if (ht_setting.field.MODE == MODE_CCK) + rate_index = (UCHAR) (ht_setting.field.MCS); + + if (rate_index < 0) + rate_index = 0; + + if (rate_index > rate_count) + rate_index = rate_count; + + wrqu->bitrate.value = ralinkrate[rate_index] * 500000; + wrqu->bitrate.disabled = 0; + + return 0; } -static const iw_handler rt_handler[] = -{ - (iw_handler) NULL, /* SIOCSIWCOMMIT */ - (iw_handler) rt_ioctl_giwname, /* SIOCGIWNAME */ - (iw_handler) NULL, /* SIOCSIWNWID */ - (iw_handler) NULL, /* SIOCGIWNWID */ - (iw_handler) rt_ioctl_siwfreq, /* SIOCSIWFREQ */ - (iw_handler) rt_ioctl_giwfreq, /* SIOCGIWFREQ */ - (iw_handler) rt_ioctl_siwmode, /* SIOCSIWMODE */ - (iw_handler) rt_ioctl_giwmode, /* SIOCGIWMODE */ - (iw_handler) NULL, /* SIOCSIWSENS */ - (iw_handler) NULL, /* SIOCGIWSENS */ - (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */ - (iw_handler) rt_ioctl_giwrange, /* SIOCGIWRANGE */ - (iw_handler) NULL /* not used */, /* SIOCSIWPRIV */ - (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */ - (iw_handler) NULL /* not used */, /* SIOCSIWSTATS */ - (iw_handler) rt28xx_get_wireless_stats /* kernel code */, /* SIOCGIWSTATS */ - (iw_handler) NULL, /* SIOCSIWSPY */ - (iw_handler) NULL, /* SIOCGIWSPY */ - (iw_handler) NULL, /* SIOCSIWTHRSPY */ - (iw_handler) NULL, /* SIOCGIWTHRSPY */ - (iw_handler) rt_ioctl_siwap, /* SIOCSIWAP */ - (iw_handler) rt_ioctl_giwap, /* SIOCGIWAP */ - (iw_handler) rt_ioctl_siwmlme, /* SIOCSIWMLME */ - (iw_handler) rt_ioctl_iwaplist, /* SIOCGIWAPLIST */ - (iw_handler) rt_ioctl_siwscan, /* SIOCSIWSCAN */ - (iw_handler) rt_ioctl_giwscan, /* SIOCGIWSCAN */ - (iw_handler) rt_ioctl_siwessid, /* SIOCSIWESSID */ - (iw_handler) rt_ioctl_giwessid, /* SIOCGIWESSID */ - (iw_handler) rt_ioctl_siwnickn, /* SIOCSIWNICKN */ - (iw_handler) rt_ioctl_giwnickn, /* SIOCGIWNICKN */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) rt_ioctl_siwrate, /* SIOCSIWRATE */ - (iw_handler) rt_ioctl_giwrate, /* SIOCGIWRATE */ - (iw_handler) rt_ioctl_siwrts, /* SIOCSIWRTS */ - (iw_handler) rt_ioctl_giwrts, /* SIOCGIWRTS */ - (iw_handler) rt_ioctl_siwfrag, /* SIOCSIWFRAG */ - (iw_handler) rt_ioctl_giwfrag, /* SIOCGIWFRAG */ - (iw_handler) NULL, /* SIOCSIWTXPOW */ - (iw_handler) NULL, /* SIOCGIWTXPOW */ - (iw_handler) NULL, /* SIOCSIWRETRY */ - (iw_handler) NULL, /* SIOCGIWRETRY */ - (iw_handler) rt_ioctl_siwencode, /* SIOCSIWENCODE */ - (iw_handler) rt_ioctl_giwencode, /* SIOCGIWENCODE */ - (iw_handler) NULL, /* SIOCSIWPOWER */ - (iw_handler) NULL, /* SIOCGIWPOWER */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) rt_ioctl_siwgenie, /* SIOCSIWGENIE */ - (iw_handler) rt_ioctl_giwgenie, /* SIOCGIWGENIE */ - (iw_handler) rt_ioctl_siwauth, /* SIOCSIWAUTH */ - (iw_handler) rt_ioctl_giwauth, /* SIOCGIWAUTH */ - (iw_handler) rt_ioctl_siwencodeext, /* SIOCSIWENCODEEXT */ - (iw_handler) rt_ioctl_giwencodeext, /* SIOCGIWENCODEEXT */ - (iw_handler) rt_ioctl_siwpmksa, /* SIOCSIWPMKSA */ +static const iw_handler rt_handler[] = { + (iw_handler) NULL, /* SIOCSIWCOMMIT */ + (iw_handler) rt_ioctl_giwname, /* SIOCGIWNAME */ + (iw_handler) NULL, /* SIOCSIWNWID */ + (iw_handler) NULL, /* SIOCGIWNWID */ + (iw_handler) rt_ioctl_siwfreq, /* SIOCSIWFREQ */ + (iw_handler) rt_ioctl_giwfreq, /* SIOCGIWFREQ */ + (iw_handler) rt_ioctl_siwmode, /* SIOCSIWMODE */ + (iw_handler) rt_ioctl_giwmode, /* SIOCGIWMODE */ + (iw_handler) NULL, /* SIOCSIWSENS */ + (iw_handler) NULL, /* SIOCGIWSENS */ + (iw_handler) NULL /* not used */ , /* SIOCSIWRANGE */ + (iw_handler) rt_ioctl_giwrange, /* SIOCGIWRANGE */ + (iw_handler) NULL /* not used */ , /* SIOCSIWPRIV */ + (iw_handler) NULL /* kernel code */ , /* SIOCGIWPRIV */ + (iw_handler) NULL /* not used */ , /* SIOCSIWSTATS */ + (iw_handler) rt28xx_get_wireless_stats /* kernel code */ , /* SIOCGIWSTATS */ + (iw_handler) NULL, /* SIOCSIWSPY */ + (iw_handler) NULL, /* SIOCGIWSPY */ + (iw_handler) NULL, /* SIOCSIWTHRSPY */ + (iw_handler) NULL, /* SIOCGIWTHRSPY */ + (iw_handler) rt_ioctl_siwap, /* SIOCSIWAP */ + (iw_handler) rt_ioctl_giwap, /* SIOCGIWAP */ + (iw_handler) rt_ioctl_siwmlme, /* SIOCSIWMLME */ + (iw_handler) rt_ioctl_iwaplist, /* SIOCGIWAPLIST */ + (iw_handler) rt_ioctl_siwscan, /* SIOCSIWSCAN */ + (iw_handler) rt_ioctl_giwscan, /* SIOCGIWSCAN */ + (iw_handler) rt_ioctl_siwessid, /* SIOCSIWESSID */ + (iw_handler) rt_ioctl_giwessid, /* SIOCGIWESSID */ + (iw_handler) rt_ioctl_siwnickn, /* SIOCSIWNICKN */ + (iw_handler) rt_ioctl_giwnickn, /* SIOCGIWNICKN */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) rt_ioctl_siwrate, /* SIOCSIWRATE */ + (iw_handler) rt_ioctl_giwrate, /* SIOCGIWRATE */ + (iw_handler) rt_ioctl_siwrts, /* SIOCSIWRTS */ + (iw_handler) rt_ioctl_giwrts, /* SIOCGIWRTS */ + (iw_handler) rt_ioctl_siwfrag, /* SIOCSIWFRAG */ + (iw_handler) rt_ioctl_giwfrag, /* SIOCGIWFRAG */ + (iw_handler) NULL, /* SIOCSIWTXPOW */ + (iw_handler) NULL, /* SIOCGIWTXPOW */ + (iw_handler) NULL, /* SIOCSIWRETRY */ + (iw_handler) NULL, /* SIOCGIWRETRY */ + (iw_handler) rt_ioctl_siwencode, /* SIOCSIWENCODE */ + (iw_handler) rt_ioctl_giwencode, /* SIOCGIWENCODE */ + (iw_handler) NULL, /* SIOCSIWPOWER */ + (iw_handler) NULL, /* SIOCGIWPOWER */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) rt_ioctl_siwgenie, /* SIOCSIWGENIE */ + (iw_handler) rt_ioctl_giwgenie, /* SIOCGIWGENIE */ + (iw_handler) rt_ioctl_siwauth, /* SIOCSIWAUTH */ + (iw_handler) rt_ioctl_giwauth, /* SIOCGIWAUTH */ + (iw_handler) rt_ioctl_siwencodeext, /* SIOCSIWENCODEEXT */ + (iw_handler) rt_ioctl_giwencodeext, /* SIOCGIWENCODEEXT */ + (iw_handler) rt_ioctl_siwpmksa, /* SIOCSIWPMKSA */ }; -const struct iw_handler_def rt28xx_iw_handler_def = -{ - .standard = (iw_handler *) rt_handler, - .num_standard = sizeof(rt_handler) / sizeof(iw_handler), +const struct iw_handler_def rt28xx_iw_handler_def = { + .standard = (iw_handler *) rt_handler, + .num_standard = sizeof(rt_handler) / sizeof(iw_handler), #if IW_HANDLER_VERSION >= 7 - .get_wireless_stats = rt28xx_get_wireless_stats, + .get_wireless_stats = rt28xx_get_wireless_stats, #endif }; -INT rt28xx_sta_ioctl( - IN struct net_device *net_dev, - IN OUT struct ifreq *rq, - IN INT cmd) +INT rt28xx_sta_ioctl(IN struct net_device *net_dev, + IN OUT struct ifreq *rq, IN INT cmd) { - POS_COOKIE pObj; - RTMP_ADAPTER *pAd = NULL; - struct iwreq *wrq = (struct iwreq *) rq; - BOOLEAN StateMachineTouched = FALSE; - INT Status = NDIS_STATUS_SUCCESS; + POS_COOKIE pObj; + RTMP_ADAPTER *pAd = NULL; + struct iwreq *wrq = (struct iwreq *)rq; + BOOLEAN StateMachineTouched = FALSE; + INT Status = NDIS_STATUS_SUCCESS; GET_PAD_FROM_NET_DEV(pAd, net_dev); pObj = (POS_COOKIE) pAd->OS_Cookie; - //check if the interface is down - if(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { - { - DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); - return -ENETDOWN; - } - } + //check if the interface is down + if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { + { + DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); + return -ENETDOWN; + } + } - { // determine this ioctl command is comming from which interface. + { // determine this ioctl command is comming from which interface. pObj->ioctl_if_type = INT_MAIN; pObj->ioctl_if = MAIN_MBSSID; } - switch(cmd) - { - case SIOCGIFHWADDR: - DBGPRINT(RT_DEBUG_TRACE, ("IOCTL::SIOCGIFHWADDR\n")); - memcpy(wrq->u.name, pAd->CurrentAddress, ETH_ALEN); - break; - case SIOCGIWNAME: - { - char *name=&wrq->u.name[0]; - rt_ioctl_giwname(net_dev, NULL, name, NULL); + switch (cmd) { + case SIOCGIFHWADDR: + DBGPRINT(RT_DEBUG_TRACE, ("IOCTL::SIOCGIFHWADDR\n")); + memcpy(wrq->u.name, pAd->CurrentAddress, ETH_ALEN); + break; + case SIOCGIWNAME: + { + char *name = &wrq->u.name[0]; + rt_ioctl_giwname(net_dev, NULL, name, NULL); break; } - case SIOCGIWESSID: //Get ESSID - { - struct iw_point *essid=&wrq->u.essid; - rt_ioctl_giwessid(net_dev, NULL, essid, essid->pointer); + case SIOCGIWESSID: //Get ESSID + { + struct iw_point *essid = &wrq->u.essid; + rt_ioctl_giwessid(net_dev, NULL, essid, essid->pointer); break; } - case SIOCSIWESSID: //Set ESSID - { - struct iw_point *essid=&wrq->u.essid; - rt_ioctl_siwessid(net_dev, NULL, essid, essid->pointer); + case SIOCSIWESSID: //Set ESSID + { + struct iw_point *essid = &wrq->u.essid; + rt_ioctl_siwessid(net_dev, NULL, essid, essid->pointer); break; } - case SIOCSIWNWID: // set network id (the cell) - case SIOCGIWNWID: // get network id - Status = -EOPNOTSUPP; - break; - case SIOCSIWFREQ: //set channel/frequency (Hz) - { - struct iw_freq *freq=&wrq->u.freq; - rt_ioctl_siwfreq(net_dev, NULL, freq, NULL); + case SIOCSIWNWID: // set network id (the cell) + case SIOCGIWNWID: // get network id + Status = -EOPNOTSUPP; + break; + case SIOCSIWFREQ: //set channel/frequency (Hz) + { + struct iw_freq *freq = &wrq->u.freq; + rt_ioctl_siwfreq(net_dev, NULL, freq, NULL); break; } - case SIOCGIWFREQ: // get channel/frequency (Hz) - { - struct iw_freq *freq=&wrq->u.freq; - rt_ioctl_giwfreq(net_dev, NULL, freq, NULL); + case SIOCGIWFREQ: // get channel/frequency (Hz) + { + struct iw_freq *freq = &wrq->u.freq; + rt_ioctl_giwfreq(net_dev, NULL, freq, NULL); break; } - case SIOCSIWNICKN: //set node name/nickname - { - //struct iw_point *data=&wrq->u.data; - //rt_ioctl_siwnickn(net_dev, NULL, data, NULL); + case SIOCSIWNICKN: //set node name/nickname + { + //struct iw_point *data=&wrq->u.data; + //rt_ioctl_siwnickn(net_dev, NULL, data, NULL); break; } - case SIOCGIWNICKN: //get node name/nickname - { - struct iw_point *erq = NULL; - erq = &wrq->u.data; - erq->length = strlen((PSTRING) pAd->nickname); - Status = copy_to_user(erq->pointer, pAd->nickname, erq->length); + case SIOCGIWNICKN: //get node name/nickname + { + struct iw_point *erq = NULL; + erq = &wrq->u.data; + erq->length = strlen((PSTRING) pAd->nickname); + Status = + copy_to_user(erq->pointer, pAd->nickname, + erq->length); break; } - case SIOCGIWRATE: //get default bit rate (bps) - rt_ioctl_giwrate(net_dev, NULL, &wrq->u, NULL); - break; - case SIOCSIWRATE: //set default bit rate (bps) - rt_ioctl_siwrate(net_dev, NULL, &wrq->u, NULL); - break; - case SIOCGIWRTS: // get RTS/CTS threshold (bytes) - { - struct iw_param *rts=&wrq->u.rts; - rt_ioctl_giwrts(net_dev, NULL, rts, NULL); + case SIOCGIWRATE: //get default bit rate (bps) + rt_ioctl_giwrate(net_dev, NULL, &wrq->u, NULL); + break; + case SIOCSIWRATE: //set default bit rate (bps) + rt_ioctl_siwrate(net_dev, NULL, &wrq->u, NULL); + break; + case SIOCGIWRTS: // get RTS/CTS threshold (bytes) + { + struct iw_param *rts = &wrq->u.rts; + rt_ioctl_giwrts(net_dev, NULL, rts, NULL); break; } - case SIOCSIWRTS: //set RTS/CTS threshold (bytes) - { - struct iw_param *rts=&wrq->u.rts; - rt_ioctl_siwrts(net_dev, NULL, rts, NULL); + case SIOCSIWRTS: //set RTS/CTS threshold (bytes) + { + struct iw_param *rts = &wrq->u.rts; + rt_ioctl_siwrts(net_dev, NULL, rts, NULL); break; } - case SIOCGIWFRAG: //get fragmentation thr (bytes) - { - struct iw_param *frag=&wrq->u.frag; - rt_ioctl_giwfrag(net_dev, NULL, frag, NULL); + case SIOCGIWFRAG: //get fragmentation thr (bytes) + { + struct iw_param *frag = &wrq->u.frag; + rt_ioctl_giwfrag(net_dev, NULL, frag, NULL); break; } - case SIOCSIWFRAG: //set fragmentation thr (bytes) - { - struct iw_param *frag=&wrq->u.frag; - rt_ioctl_siwfrag(net_dev, NULL, frag, NULL); + case SIOCSIWFRAG: //set fragmentation thr (bytes) + { + struct iw_param *frag = &wrq->u.frag; + rt_ioctl_siwfrag(net_dev, NULL, frag, NULL); break; } - case SIOCGIWENCODE: //get encoding token & mode - { - struct iw_point *erq=&wrq->u.encoding; - if(erq) - rt_ioctl_giwencode(net_dev, NULL, erq, erq->pointer); + case SIOCGIWENCODE: //get encoding token & mode + { + struct iw_point *erq = &wrq->u.encoding; + if (erq) + rt_ioctl_giwencode(net_dev, NULL, erq, + erq->pointer); break; } - case SIOCSIWENCODE: //set encoding token & mode - { - struct iw_point *erq=&wrq->u.encoding; - if(erq) - rt_ioctl_siwencode(net_dev, NULL, erq, erq->pointer); + case SIOCSIWENCODE: //set encoding token & mode + { + struct iw_point *erq = &wrq->u.encoding; + if (erq) + rt_ioctl_siwencode(net_dev, NULL, erq, + erq->pointer); break; } - case SIOCGIWAP: //get access point MAC addresses - { - struct sockaddr *ap_addr=&wrq->u.ap_addr; - rt_ioctl_giwap(net_dev, NULL, ap_addr, ap_addr->sa_data); + case SIOCGIWAP: //get access point MAC addresses + { + struct sockaddr *ap_addr = &wrq->u.ap_addr; + rt_ioctl_giwap(net_dev, NULL, ap_addr, + ap_addr->sa_data); break; } - case SIOCSIWAP: //set access point MAC addresses - { - struct sockaddr *ap_addr=&wrq->u.ap_addr; - rt_ioctl_siwap(net_dev, NULL, ap_addr, ap_addr->sa_data); + case SIOCSIWAP: //set access point MAC addresses + { + struct sockaddr *ap_addr = &wrq->u.ap_addr; + rt_ioctl_siwap(net_dev, NULL, ap_addr, + ap_addr->sa_data); break; } - case SIOCGIWMODE: //get operation mode - { - __u32 *mode=&wrq->u.mode; - rt_ioctl_giwmode(net_dev, NULL, mode, NULL); + case SIOCGIWMODE: //get operation mode + { + __u32 *mode = &wrq->u.mode; + rt_ioctl_giwmode(net_dev, NULL, mode, NULL); break; } - case SIOCSIWMODE: //set operation mode - { - __u32 *mode=&wrq->u.mode; - rt_ioctl_siwmode(net_dev, NULL, mode, NULL); + case SIOCSIWMODE: //set operation mode + { + __u32 *mode = &wrq->u.mode; + rt_ioctl_siwmode(net_dev, NULL, mode, NULL); break; } - case SIOCGIWSENS: //get sensitivity (dBm) - case SIOCSIWSENS: //set sensitivity (dBm) - case SIOCGIWPOWER: //get Power Management settings - case SIOCSIWPOWER: //set Power Management settings - case SIOCGIWTXPOW: //get transmit power (dBm) - case SIOCSIWTXPOW: //set transmit power (dBm) - case SIOCGIWRANGE: //Get range of parameters - case SIOCGIWRETRY: //get retry limits and lifetime - case SIOCSIWRETRY: //set retry limits and lifetime - case RT_PRIV_IOCTL: - case RT_PRIV_IOCTL_EXT: - case RTPRIV_IOCTL_SET: - case RTPRIV_IOCTL_GSITESURVEY: - case SIOCGIWPRIV: - Status = -EOPNOTSUPP; - break; - case SIOCETHTOOL: - break; - default: - DBGPRINT(RT_DEBUG_ERROR, ("IOCTL::unknown IOCTL's cmd = 0x%08x\n", cmd)); - Status = -EOPNOTSUPP; - break; + case SIOCGIWSENS: //get sensitivity (dBm) + case SIOCSIWSENS: //set sensitivity (dBm) + case SIOCGIWPOWER: //get Power Management settings + case SIOCSIWPOWER: //set Power Management settings + case SIOCGIWTXPOW: //get transmit power (dBm) + case SIOCSIWTXPOW: //set transmit power (dBm) + case SIOCGIWRANGE: //Get range of parameters + case SIOCGIWRETRY: //get retry limits and lifetime + case SIOCSIWRETRY: //set retry limits and lifetime + case RT_PRIV_IOCTL: + case RT_PRIV_IOCTL_EXT: + case RTPRIV_IOCTL_SET: + case RTPRIV_IOCTL_GSITESURVEY: + case SIOCGIWPRIV: + Status = -EOPNOTSUPP; + break; + case SIOCETHTOOL: + break; + default: + DBGPRINT(RT_DEBUG_ERROR, + ("IOCTL::unknown IOCTL's cmd = 0x%08x\n", cmd)); + Status = -EOPNOTSUPP; + break; } - if(StateMachineTouched) // Upper layer sent a MLME-related operations - RTMP_MLME_HANDLER(pAd); + if (StateMachineTouched) // Upper layer sent a MLME-related operations + RTMP_MLME_HANDLER(pAd); return Status; } @@ -2508,77 +2639,75 @@ INT rt28xx_sta_ioctl( TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -INT Set_SSID_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) +INT Set_SSID_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) { - NDIS_802_11_SSID Ssid, *pSsid=NULL; - BOOLEAN StateMachineTouched = FALSE; - int success = TRUE; - - if( strlen(arg) <= MAX_LEN_OF_SSID) - { - NdisZeroMemory(&Ssid, sizeof(NDIS_802_11_SSID)); - if (strlen(arg) != 0) - { - NdisMoveMemory(Ssid.Ssid, arg, strlen(arg)); - Ssid.SsidLength = strlen(arg); - } - else //ANY ssid - { - Ssid.SsidLength = 0; - memcpy(Ssid.Ssid, "", 0); + NDIS_802_11_SSID Ssid, *pSsid = NULL; + BOOLEAN StateMachineTouched = FALSE; + int success = TRUE; + + if (strlen(arg) <= MAX_LEN_OF_SSID) { + NdisZeroMemory(&Ssid, sizeof(NDIS_802_11_SSID)); + if (strlen(arg) != 0) { + NdisMoveMemory(Ssid.Ssid, arg, strlen(arg)); + Ssid.SsidLength = strlen(arg); + } else //ANY ssid + { + Ssid.SsidLength = 0; + memcpy(Ssid.Ssid, "", 0); pAdapter->StaCfg.BssType = BSS_INFRA; pAdapter->StaCfg.AuthMode = Ndis802_11AuthModeOpen; - pAdapter->StaCfg.WepStatus = Ndis802_11EncryptionDisabled; + pAdapter->StaCfg.WepStatus = + Ndis802_11EncryptionDisabled; } - pSsid = &Ssid; + pSsid = &Ssid; - if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) - { - RTMP_MLME_RESET_STATE_MACHINE(pAdapter); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); - } + if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) { + RTMP_MLME_RESET_STATE_MACHINE(pAdapter); + DBGPRINT(RT_DEBUG_TRACE, + ("!!! MLME busy, reset MLME state machine !!!\n")); + } if ((pAdapter->StaCfg.WpaPassPhraseLen >= 8) && - (pAdapter->StaCfg.WpaPassPhraseLen <= 64)) - { - STRING passphrase_str[65] = {0}; + (pAdapter->StaCfg.WpaPassPhraseLen <= 64)) { + STRING passphrase_str[65] = { 0 }; UCHAR keyMaterial[40]; - RTMPMoveMemory(passphrase_str, pAdapter->StaCfg.WpaPassPhrase, pAdapter->StaCfg.WpaPassPhraseLen); + RTMPMoveMemory(passphrase_str, + pAdapter->StaCfg.WpaPassPhrase, + pAdapter->StaCfg.WpaPassPhraseLen); RTMPZeroMemory(pAdapter->StaCfg.PMK, 32); - if (pAdapter->StaCfg.WpaPassPhraseLen == 64) - { - AtoH((PSTRING) pAdapter->StaCfg.WpaPassPhrase, pAdapter->StaCfg.PMK, 32); - } - else - { - PasswordHash((PSTRING) pAdapter->StaCfg.WpaPassPhrase, Ssid.Ssid, Ssid.SsidLength, keyMaterial); - NdisMoveMemory(pAdapter->StaCfg.PMK, keyMaterial, 32); + if (pAdapter->StaCfg.WpaPassPhraseLen == 64) { + AtoH((PSTRING) pAdapter->StaCfg.WpaPassPhrase, + pAdapter->StaCfg.PMK, 32); + } else { + PasswordHash((PSTRING) pAdapter->StaCfg. + WpaPassPhrase, Ssid.Ssid, + Ssid.SsidLength, keyMaterial); + NdisMoveMemory(pAdapter->StaCfg.PMK, + keyMaterial, 32); } } - pAdapter->MlmeAux.CurrReqIsFromNdis = TRUE; - pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE; + pAdapter->MlmeAux.CurrReqIsFromNdis = TRUE; + pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE; pAdapter->bConfigChanged = TRUE; - MlmeEnqueue(pAdapter, - MLME_CNTL_STATE_MACHINE, - OID_802_11_SSID, - sizeof(NDIS_802_11_SSID), - (VOID *)pSsid); - - StateMachineTouched = TRUE; - DBGPRINT(RT_DEBUG_TRACE, ("Set_SSID_Proc::(Len=%d,Ssid=%s)\n", Ssid.SsidLength, Ssid.Ssid)); - } - else - success = FALSE; - - if (StateMachineTouched) // Upper layer sent a MLME-related operations - RTMP_MLME_HANDLER(pAdapter); + MlmeEnqueue(pAdapter, + MLME_CNTL_STATE_MACHINE, + OID_802_11_SSID, + sizeof(NDIS_802_11_SSID), (VOID *) pSsid); + + StateMachineTouched = TRUE; + DBGPRINT(RT_DEBUG_TRACE, + ("Set_SSID_Proc::(Len=%d,Ssid=%s)\n", Ssid.SsidLength, + Ssid.Ssid)); + } else + success = FALSE; + + if (StateMachineTouched) // Upper layer sent a MLME-related operations + RTMP_MLME_HANDLER(pAdapter); - return success; + return success; } /* @@ -2589,156 +2718,176 @@ INT Set_SSID_Proc( TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -INT Set_NetworkType_Proc( - IN PRTMP_ADAPTER pAdapter, - IN PSTRING arg) +INT Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) { - UINT32 Value = 0; + UINT32 Value = 0; - if (strcmp(arg, "Adhoc") == 0) - { - if (pAdapter->StaCfg.BssType != BSS_ADHOC) - { + if (strcmp(arg, "Adhoc") == 0) { + if (pAdapter->StaCfg.BssType != BSS_ADHOC) { // Config has changed pAdapter->bConfigChanged = TRUE; - if (MONITOR_ON(pAdapter)) - { - RTMP_IO_WRITE32(pAdapter, RX_FILTR_CFG, STANORMAL); - RTMP_IO_READ32(pAdapter, MAC_SYS_CTRL, &Value); + if (MONITOR_ON(pAdapter)) { + RTMP_IO_WRITE32(pAdapter, RX_FILTR_CFG, + STANORMAL); + RTMP_IO_READ32(pAdapter, MAC_SYS_CTRL, &Value); Value &= (~0x80); RTMP_IO_WRITE32(pAdapter, MAC_SYS_CTRL, Value); - OPSTATUS_CLEAR_FLAG(pAdapter, fOP_STATUS_MEDIA_STATE_CONNECTED); - pAdapter->StaCfg.bAutoReconnect = TRUE; - LinkDown(pAdapter, FALSE); - } - if (INFRA_ON(pAdapter)) - { + OPSTATUS_CLEAR_FLAG(pAdapter, + fOP_STATUS_MEDIA_STATE_CONNECTED); + pAdapter->StaCfg.bAutoReconnect = TRUE; + LinkDown(pAdapter, FALSE); + } + if (INFRA_ON(pAdapter)) { //BOOLEAN Cancelled; // Set the AutoReconnectSsid to prevent it reconnect to old SSID // Since calling this indicate user don't want to connect to that SSID anymore. - pAdapter->MlmeAux.AutoReconnectSsidLen= 32; - NdisZeroMemory(pAdapter->MlmeAux.AutoReconnectSsid, pAdapter->MlmeAux.AutoReconnectSsidLen); + pAdapter->MlmeAux.AutoReconnectSsidLen = 32; + NdisZeroMemory(pAdapter->MlmeAux. + AutoReconnectSsid, + pAdapter->MlmeAux. + AutoReconnectSsidLen); LinkDown(pAdapter, FALSE); - DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_DISCONNECT Event BB!\n")); + DBGPRINT(RT_DEBUG_TRACE, + ("NDIS_STATUS_MEDIA_DISCONNECT Event BB!\n")); } } pAdapter->StaCfg.BssType = BSS_ADHOC; - pAdapter->net_dev->type = pAdapter->StaCfg.OriDevType; - DBGPRINT(RT_DEBUG_TRACE, ("===>Set_NetworkType_Proc::(AD-HOC)\n")); - } - else if (strcmp(arg, "Infra") == 0) - { - if (pAdapter->StaCfg.BssType != BSS_INFRA) - { + pAdapter->net_dev->type = pAdapter->StaCfg.OriDevType; + DBGPRINT(RT_DEBUG_TRACE, + ("===>Set_NetworkType_Proc::(AD-HOC)\n")); + } else if (strcmp(arg, "Infra") == 0) { + if (pAdapter->StaCfg.BssType != BSS_INFRA) { // Config has changed pAdapter->bConfigChanged = TRUE; - if (MONITOR_ON(pAdapter)) - { - RTMP_IO_WRITE32(pAdapter, RX_FILTR_CFG, STANORMAL); - RTMP_IO_READ32(pAdapter, MAC_SYS_CTRL, &Value); + if (MONITOR_ON(pAdapter)) { + RTMP_IO_WRITE32(pAdapter, RX_FILTR_CFG, + STANORMAL); + RTMP_IO_READ32(pAdapter, MAC_SYS_CTRL, &Value); Value &= (~0x80); RTMP_IO_WRITE32(pAdapter, MAC_SYS_CTRL, Value); - OPSTATUS_CLEAR_FLAG(pAdapter, fOP_STATUS_MEDIA_STATE_CONNECTED); - pAdapter->StaCfg.bAutoReconnect = TRUE; - LinkDown(pAdapter, FALSE); - } - if (ADHOC_ON(pAdapter)) - { + OPSTATUS_CLEAR_FLAG(pAdapter, + fOP_STATUS_MEDIA_STATE_CONNECTED); + pAdapter->StaCfg.bAutoReconnect = TRUE; + LinkDown(pAdapter, FALSE); + } + if (ADHOC_ON(pAdapter)) { // Set the AutoReconnectSsid to prevent it reconnect to old SSID // Since calling this indicate user don't want to connect to that SSID anymore. - pAdapter->MlmeAux.AutoReconnectSsidLen= 32; - NdisZeroMemory(pAdapter->MlmeAux.AutoReconnectSsid, pAdapter->MlmeAux.AutoReconnectSsidLen); + pAdapter->MlmeAux.AutoReconnectSsidLen = 32; + NdisZeroMemory(pAdapter->MlmeAux. + AutoReconnectSsid, + pAdapter->MlmeAux. + AutoReconnectSsidLen); LinkDown(pAdapter, FALSE); } } pAdapter->StaCfg.BssType = BSS_INFRA; - pAdapter->net_dev->type = pAdapter->StaCfg.OriDevType; - DBGPRINT(RT_DEBUG_TRACE, ("===>Set_NetworkType_Proc::(INFRA)\n")); - } - else if (strcmp(arg, "Monitor") == 0) - { - UCHAR bbpValue = 0; + pAdapter->net_dev->type = pAdapter->StaCfg.OriDevType; + DBGPRINT(RT_DEBUG_TRACE, + ("===>Set_NetworkType_Proc::(INFRA)\n")); + } else if (strcmp(arg, "Monitor") == 0) { + UCHAR bbpValue = 0; BCN_TIME_CFG_STRUC csr; OPSTATUS_CLEAR_FLAG(pAdapter, fOP_STATUS_INFRA_ON); - OPSTATUS_CLEAR_FLAG(pAdapter, fOP_STATUS_ADHOC_ON); + OPSTATUS_CLEAR_FLAG(pAdapter, fOP_STATUS_ADHOC_ON); OPSTATUS_SET_FLAG(pAdapter, fOP_STATUS_MEDIA_STATE_CONNECTED); // disable all periodic state machine pAdapter->StaCfg.bAutoReconnect = FALSE; // reset all mlme state machine - RTMP_MLME_RESET_STATE_MACHINE(pAdapter); - DBGPRINT(RT_DEBUG_TRACE, ("fOP_STATUS_MEDIA_STATE_CONNECTED \n")); - if (pAdapter->CommonCfg.CentralChannel == 0) - { - if (pAdapter->CommonCfg.PhyMode == PHY_11AN_MIXED) - pAdapter->CommonCfg.CentralChannel = 36; - else - pAdapter->CommonCfg.CentralChannel = 6; - } - else - N_ChannelCheck(pAdapter); - - if (pAdapter->CommonCfg.PhyMode >= PHY_11ABGN_MIXED && - pAdapter->CommonCfg.RegTransmitSetting.field.BW == BW_40 && - pAdapter->CommonCfg.RegTransmitSetting.field.EXTCHA == EXTCHA_ABOVE) - { + RTMP_MLME_RESET_STATE_MACHINE(pAdapter); + DBGPRINT(RT_DEBUG_TRACE, + ("fOP_STATUS_MEDIA_STATE_CONNECTED \n")); + if (pAdapter->CommonCfg.CentralChannel == 0) { + if (pAdapter->CommonCfg.PhyMode == PHY_11AN_MIXED) + pAdapter->CommonCfg.CentralChannel = 36; + else + pAdapter->CommonCfg.CentralChannel = 6; + } else + N_ChannelCheck(pAdapter); + + if (pAdapter->CommonCfg.PhyMode >= PHY_11ABGN_MIXED && + pAdapter->CommonCfg.RegTransmitSetting.field.BW == BW_40 && + pAdapter->CommonCfg.RegTransmitSetting.field.EXTCHA == + EXTCHA_ABOVE) { // 40MHz ,control channel at lower - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R4, &bbpValue); + RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R4, + &bbpValue); bbpValue &= (~0x18); bbpValue |= 0x10; - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R4, bbpValue); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R4, + bbpValue); pAdapter->CommonCfg.BBPCurrentBW = BW_40; // RX : control channel at lower - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R3, &bbpValue); + RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R3, + &bbpValue); bbpValue &= (~0x20); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R3, bbpValue); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R3, + bbpValue); RTMP_IO_READ32(pAdapter, TX_BAND_CFG, &Value); Value &= 0xfffffffe; RTMP_IO_WRITE32(pAdapter, TX_BAND_CFG, Value); - pAdapter->CommonCfg.CentralChannel = pAdapter->CommonCfg.Channel + 2; - AsicSwitchChannel(pAdapter, pAdapter->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAdapter, pAdapter->CommonCfg.CentralChannel); - DBGPRINT(RT_DEBUG_TRACE, ("BW_40 ,control_channel(%d), CentralChannel(%d) \n", - pAdapter->CommonCfg.Channel, - pAdapter->CommonCfg.CentralChannel)); - } - else if (pAdapter->CommonCfg.PhyMode >= PHY_11ABGN_MIXED && - pAdapter->CommonCfg.RegTransmitSetting.field.BW == BW_40 && - pAdapter->CommonCfg.RegTransmitSetting.field.EXTCHA == EXTCHA_BELOW) - { + pAdapter->CommonCfg.CentralChannel = + pAdapter->CommonCfg.Channel + 2; + AsicSwitchChannel(pAdapter, + pAdapter->CommonCfg.CentralChannel, + FALSE); + AsicLockChannel(pAdapter, + pAdapter->CommonCfg.CentralChannel); + DBGPRINT(RT_DEBUG_TRACE, + ("BW_40 ,control_channel(%d), CentralChannel(%d) \n", + pAdapter->CommonCfg.Channel, + pAdapter->CommonCfg.CentralChannel)); + } else if (pAdapter->CommonCfg.PhyMode >= PHY_11ABGN_MIXED + && pAdapter->CommonCfg.RegTransmitSetting.field.BW == + BW_40 + && pAdapter->CommonCfg.RegTransmitSetting.field. + EXTCHA == EXTCHA_BELOW) { // 40MHz ,control channel at upper - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R4, &bbpValue); + RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R4, + &bbpValue); bbpValue &= (~0x18); bbpValue |= 0x10; - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R4, bbpValue); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R4, + bbpValue); pAdapter->CommonCfg.BBPCurrentBW = BW_40; RTMP_IO_READ32(pAdapter, TX_BAND_CFG, &Value); Value |= 0x1; RTMP_IO_WRITE32(pAdapter, TX_BAND_CFG, Value); - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R3, &bbpValue); + RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R3, + &bbpValue); bbpValue |= (0x20); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R3, bbpValue); - pAdapter->CommonCfg.CentralChannel = pAdapter->CommonCfg.Channel - 2; - AsicSwitchChannel(pAdapter, pAdapter->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAdapter, pAdapter->CommonCfg.CentralChannel); - DBGPRINT(RT_DEBUG_TRACE, ("BW_40 ,control_channel(%d), CentralChannel(%d) \n", - pAdapter->CommonCfg.Channel, - pAdapter->CommonCfg.CentralChannel)); - } - else - { + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R3, + bbpValue); + pAdapter->CommonCfg.CentralChannel = + pAdapter->CommonCfg.Channel - 2; + AsicSwitchChannel(pAdapter, + pAdapter->CommonCfg.CentralChannel, + FALSE); + AsicLockChannel(pAdapter, + pAdapter->CommonCfg.CentralChannel); + DBGPRINT(RT_DEBUG_TRACE, + ("BW_40 ,control_channel(%d), CentralChannel(%d) \n", + pAdapter->CommonCfg.Channel, + pAdapter->CommonCfg.CentralChannel)); + } else { // 20MHz - RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R4, &bbpValue); + RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R4, + &bbpValue); bbpValue &= (~0x18); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R4, bbpValue); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R4, + bbpValue); pAdapter->CommonCfg.BBPCurrentBW = BW_20; - AsicSwitchChannel(pAdapter, pAdapter->CommonCfg.Channel, FALSE); + AsicSwitchChannel(pAdapter, pAdapter->CommonCfg.Channel, + FALSE); AsicLockChannel(pAdapter, pAdapter->CommonCfg.Channel); - DBGPRINT(RT_DEBUG_TRACE, ("BW_20, Channel(%d)\n", pAdapter->CommonCfg.Channel)); + DBGPRINT(RT_DEBUG_TRACE, + ("BW_20, Channel(%d)\n", + pAdapter->CommonCfg.Channel)); } // Enable Rx with promiscuous reception RTMP_IO_WRITE32(pAdapter, RX_FILTR_CFG, 0x3); @@ -2754,14 +2903,16 @@ INT Set_NetworkType_Proc( RTMP_IO_WRITE32(pAdapter, BCN_TIME_CFG, csr.word); pAdapter->StaCfg.BssType = BSS_MONITOR; - pAdapter->net_dev->type = ARPHRD_IEEE80211_PRISM; //ARPHRD_IEEE80211; // IEEE80211 - DBGPRINT(RT_DEBUG_TRACE, ("===>Set_NetworkType_Proc::(MONITOR)\n")); - } - - // Reset Ralink supplicant to not use, it will be set to start when UI set PMK key - pAdapter->StaCfg.WpaState = SS_NOTUSE; + pAdapter->net_dev->type = ARPHRD_IEEE80211_PRISM; //ARPHRD_IEEE80211; // IEEE80211 + DBGPRINT(RT_DEBUG_TRACE, + ("===>Set_NetworkType_Proc::(MONITOR)\n")); + } + // Reset Ralink supplicant to not use, it will be set to start when UI set PMK key + pAdapter->StaCfg.WpaState = SS_NOTUSE; - DBGPRINT(RT_DEBUG_TRACE, ("Set_NetworkType_Proc::(NetworkType=%d)\n", pAdapter->StaCfg.BssType)); + DBGPRINT(RT_DEBUG_TRACE, + ("Set_NetworkType_Proc::(NetworkType=%d)\n", + pAdapter->StaCfg.BssType)); - return TRUE; + return TRUE; } diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c index 00732be4f005..ebc22616d1ed 100644 --- a/drivers/staging/rt2860/usb_main_dev.c +++ b/drivers/staging/rt2860/usb_main_dev.c @@ -26,7 +26,6 @@ #include "rt_config.h" - // Following information will be show when you run 'modinfo' // *** If you have a solution for the bug in current version of driver, please mail to me. // Otherwise post to forum in ralinktech's web site(www.ralinktech.com) and let all users help you. *** @@ -37,141 +36,135 @@ MODULE_LICENSE("GPL"); MODULE_VERSION(STA_DRIVER_VERSION); #endif - /* module table */ struct usb_device_id rtusb_usb_id[] = { #ifdef RT2870 - {USB_DEVICE(0x148F,0x2770)}, /* Ralink */ - {USB_DEVICE(0x148F,0x2870)}, /* Ralink */ - {USB_DEVICE(0x07B8,0x2870)}, /* AboCom */ - {USB_DEVICE(0x07B8,0x2770)}, /* AboCom */ - {USB_DEVICE(0x0DF6,0x0039)}, /* Sitecom 2770 */ - {USB_DEVICE(0x083A,0x7512)}, /* Arcadyan 2770 */ - {USB_DEVICE(0x0789,0x0162)}, /* Logitec 2870 */ - {USB_DEVICE(0x0789,0x0163)}, /* Logitec 2870 */ - {USB_DEVICE(0x0789,0x0164)}, /* Logitec 2870 */ - {USB_DEVICE(0x177f,0x0302)}, /* lsusb */ - {USB_DEVICE(0x0B05,0x1731)}, /* Asus */ - {USB_DEVICE(0x0B05,0x1732)}, /* Asus */ - {USB_DEVICE(0x0B05,0x1742)}, /* Asus */ - {USB_DEVICE(0x0DF6,0x0017)}, /* Sitecom */ - {USB_DEVICE(0x0DF6,0x002B)}, /* Sitecom */ - {USB_DEVICE(0x0DF6,0x002C)}, /* Sitecom */ - {USB_DEVICE(0x0DF6,0x002D)}, /* Sitecom */ - {USB_DEVICE(0x14B2,0x3C06)}, /* Conceptronic */ - {USB_DEVICE(0x14B2,0x3C28)}, /* Conceptronic */ - {USB_DEVICE(0x2019,0xED06)}, /* Planex Communications, Inc. */ - {USB_DEVICE(0x07D1,0x3C09)}, /* D-Link */ - {USB_DEVICE(0x07D1,0x3C11)}, /* D-Link */ - {USB_DEVICE(0x14B2,0x3C07)}, /* AL */ - {USB_DEVICE(0x050D,0x8053)}, /* Belkin */ - {USB_DEVICE(0x14B2,0x3C23)}, /* Airlink */ - {USB_DEVICE(0x14B2,0x3C27)}, /* Airlink */ - {USB_DEVICE(0x07AA,0x002F)}, /* Corega */ - {USB_DEVICE(0x07AA,0x003C)}, /* Corega */ - {USB_DEVICE(0x07AA,0x003F)}, /* Corega */ - {USB_DEVICE(0x1044,0x800B)}, /* Gigabyte */ - {USB_DEVICE(0x15A9,0x0006)}, /* Sparklan */ - {USB_DEVICE(0x083A,0xB522)}, /* SMC */ - {USB_DEVICE(0x083A,0xA618)}, /* SMC */ - {USB_DEVICE(0x083A,0x8522)}, /* Arcadyan */ - {USB_DEVICE(0x083A,0x7522)}, /* Arcadyan */ - {USB_DEVICE(0x0CDE,0x0022)}, /* ZCOM */ - {USB_DEVICE(0x0586,0x3416)}, /* Zyxel */ - {USB_DEVICE(0x0CDE,0x0025)}, /* Zyxel */ - {USB_DEVICE(0x1740,0x9701)}, /* EnGenius */ - {USB_DEVICE(0x1740,0x9702)}, /* EnGenius */ - {USB_DEVICE(0x0471,0x200f)}, /* Philips */ - {USB_DEVICE(0x14B2,0x3C25)}, /* Draytek */ - {USB_DEVICE(0x13D3,0x3247)}, /* AzureWave */ - {USB_DEVICE(0x083A,0x6618)}, /* Accton */ - {USB_DEVICE(0x15c5,0x0008)}, /* Amit */ - {USB_DEVICE(0x0E66,0x0001)}, /* Hawking */ - {USB_DEVICE(0x0E66,0x0003)}, /* Hawking */ - {USB_DEVICE(0x129B,0x1828)}, /* Siemens */ - {USB_DEVICE(0x157E,0x300E)}, /* U-Media */ - {USB_DEVICE(0x050d,0x805c)}, - {USB_DEVICE(0x050d,0x815c)}, - {USB_DEVICE(0x1482,0x3C09)}, /* Abocom*/ - {USB_DEVICE(0x14B2,0x3C09)}, /* Alpha */ - {USB_DEVICE(0x04E8,0x2018)}, /* samsung */ - {USB_DEVICE(0x5A57,0x0280)}, /* Zinwell */ - {USB_DEVICE(0x5A57,0x0282)}, /* Zinwell */ - {USB_DEVICE(0x7392,0x7718)}, - {USB_DEVICE(0x7392,0x7717)}, - {USB_DEVICE(0x1737,0x0070)}, /* Linksys WUSB100 */ - {USB_DEVICE(0x1737,0x0071)}, /* Linksys WUSB600N */ - {USB_DEVICE(0x0411,0x00e8)}, /* Buffalo WLI-UC-G300N*/ - {USB_DEVICE(0x050d,0x815c)}, /* Belkin F5D8053 */ + {USB_DEVICE(0x148F, 0x2770)}, /* Ralink */ + {USB_DEVICE(0x148F, 0x2870)}, /* Ralink */ + {USB_DEVICE(0x07B8, 0x2870)}, /* AboCom */ + {USB_DEVICE(0x07B8, 0x2770)}, /* AboCom */ + {USB_DEVICE(0x0DF6, 0x0039)}, /* Sitecom 2770 */ + {USB_DEVICE(0x083A, 0x7512)}, /* Arcadyan 2770 */ + {USB_DEVICE(0x0789, 0x0162)}, /* Logitec 2870 */ + {USB_DEVICE(0x0789, 0x0163)}, /* Logitec 2870 */ + {USB_DEVICE(0x0789, 0x0164)}, /* Logitec 2870 */ + {USB_DEVICE(0x177f, 0x0302)}, /* lsusb */ + {USB_DEVICE(0x0B05, 0x1731)}, /* Asus */ + {USB_DEVICE(0x0B05, 0x1732)}, /* Asus */ + {USB_DEVICE(0x0B05, 0x1742)}, /* Asus */ + {USB_DEVICE(0x0DF6, 0x0017)}, /* Sitecom */ + {USB_DEVICE(0x0DF6, 0x002B)}, /* Sitecom */ + {USB_DEVICE(0x0DF6, 0x002C)}, /* Sitecom */ + {USB_DEVICE(0x0DF6, 0x002D)}, /* Sitecom */ + {USB_DEVICE(0x14B2, 0x3C06)}, /* Conceptronic */ + {USB_DEVICE(0x14B2, 0x3C28)}, /* Conceptronic */ + {USB_DEVICE(0x2019, 0xED06)}, /* Planex Communications, Inc. */ + {USB_DEVICE(0x07D1, 0x3C09)}, /* D-Link */ + {USB_DEVICE(0x07D1, 0x3C11)}, /* D-Link */ + {USB_DEVICE(0x14B2, 0x3C07)}, /* AL */ + {USB_DEVICE(0x050D, 0x8053)}, /* Belkin */ + {USB_DEVICE(0x14B2, 0x3C23)}, /* Airlink */ + {USB_DEVICE(0x14B2, 0x3C27)}, /* Airlink */ + {USB_DEVICE(0x07AA, 0x002F)}, /* Corega */ + {USB_DEVICE(0x07AA, 0x003C)}, /* Corega */ + {USB_DEVICE(0x07AA, 0x003F)}, /* Corega */ + {USB_DEVICE(0x1044, 0x800B)}, /* Gigabyte */ + {USB_DEVICE(0x15A9, 0x0006)}, /* Sparklan */ + {USB_DEVICE(0x083A, 0xB522)}, /* SMC */ + {USB_DEVICE(0x083A, 0xA618)}, /* SMC */ + {USB_DEVICE(0x083A, 0x8522)}, /* Arcadyan */ + {USB_DEVICE(0x083A, 0x7522)}, /* Arcadyan */ + {USB_DEVICE(0x0CDE, 0x0022)}, /* ZCOM */ + {USB_DEVICE(0x0586, 0x3416)}, /* Zyxel */ + {USB_DEVICE(0x0CDE, 0x0025)}, /* Zyxel */ + {USB_DEVICE(0x1740, 0x9701)}, /* EnGenius */ + {USB_DEVICE(0x1740, 0x9702)}, /* EnGenius */ + {USB_DEVICE(0x0471, 0x200f)}, /* Philips */ + {USB_DEVICE(0x14B2, 0x3C25)}, /* Draytek */ + {USB_DEVICE(0x13D3, 0x3247)}, /* AzureWave */ + {USB_DEVICE(0x083A, 0x6618)}, /* Accton */ + {USB_DEVICE(0x15c5, 0x0008)}, /* Amit */ + {USB_DEVICE(0x0E66, 0x0001)}, /* Hawking */ + {USB_DEVICE(0x0E66, 0x0003)}, /* Hawking */ + {USB_DEVICE(0x129B, 0x1828)}, /* Siemens */ + {USB_DEVICE(0x157E, 0x300E)}, /* U-Media */ + {USB_DEVICE(0x050d, 0x805c)}, + {USB_DEVICE(0x050d, 0x815c)}, + {USB_DEVICE(0x1482, 0x3C09)}, /* Abocom */ + {USB_DEVICE(0x14B2, 0x3C09)}, /* Alpha */ + {USB_DEVICE(0x04E8, 0x2018)}, /* samsung */ + {USB_DEVICE(0x5A57, 0x0280)}, /* Zinwell */ + {USB_DEVICE(0x5A57, 0x0282)}, /* Zinwell */ + {USB_DEVICE(0x7392, 0x7718)}, + {USB_DEVICE(0x7392, 0x7717)}, + {USB_DEVICE(0x1737, 0x0070)}, /* Linksys WUSB100 */ + {USB_DEVICE(0x1737, 0x0071)}, /* Linksys WUSB600N */ + {USB_DEVICE(0x0411, 0x00e8)}, /* Buffalo WLI-UC-G300N */ + {USB_DEVICE(0x050d, 0x815c)}, /* Belkin F5D8053 */ #endif // RT2870 // #ifdef RT3070 - {USB_DEVICE(0x148F,0x3070)}, /* Ralink 3070 */ - {USB_DEVICE(0x148F,0x3071)}, /* Ralink 3071 */ - {USB_DEVICE(0x148F,0x3072)}, /* Ralink 3072 */ - {USB_DEVICE(0x0DB0,0x3820)}, /* Ralink 3070 */ - {USB_DEVICE(0x0DF6,0x003E)}, /* Sitecom 3070 */ - {USB_DEVICE(0x0DF6,0x0042)}, /* Sitecom 3072 */ - {USB_DEVICE(0x14B2,0x3C12)}, /* AL 3070 */ - {USB_DEVICE(0x18C5,0x0012)}, /* Corega 3070 */ - {USB_DEVICE(0x083A,0x7511)}, /* Arcadyan 3070 */ - {USB_DEVICE(0x1740,0x9703)}, /* EnGenius 3070 */ - {USB_DEVICE(0x1740,0x9705)}, /* EnGenius 3071 */ - {USB_DEVICE(0x1740,0x9706)}, /* EnGenius 3072 */ - {USB_DEVICE(0x13D3,0x3273)}, /* AzureWave 3070*/ - {USB_DEVICE(0x1044,0x800D)}, /* Gigabyte GN-WB32L 3070 */ - {USB_DEVICE(0x2019,0xAB25)}, /* Planex Communications, Inc. RT3070 */ - {USB_DEVICE(0x07B8,0x3070)}, /* AboCom 3070 */ - {USB_DEVICE(0x07B8,0x3071)}, /* AboCom 3071 */ - {USB_DEVICE(0x07B8,0x3072)}, /* Abocom 3072 */ - {USB_DEVICE(0x7392,0x7711)}, /* Edimax 3070 */ - {USB_DEVICE(0x1A32,0x0304)}, /* Quanta 3070 */ - {USB_DEVICE(0x1EDA,0x2310)}, /* AirTies 3070 */ - {USB_DEVICE(0x07D1,0x3C0A)}, /* D-Link 3072 */ - {USB_DEVICE(0x07D1,0x3C0D)}, /* D-Link 3070 */ - {USB_DEVICE(0x07D1,0x3C0E)}, /* D-Link 3070 */ - {USB_DEVICE(0x07D1,0x3C0F)}, /* D-Link 3070 */ - {USB_DEVICE(0x1D4D,0x000C)}, /* Pegatron Corporation 3070 */ - {USB_DEVICE(0x1D4D,0x000E)}, /* Pegatron Corporation 3070 */ - {USB_DEVICE(0x5A57,0x5257)}, /* Zinwell 3070 */ - {USB_DEVICE(0x5A57,0x0283)}, /* Zinwell 3072 */ - {USB_DEVICE(0x04BB,0x0945)}, /* I-O DATA 3072 */ - {USB_DEVICE(0x203D,0x1480)}, /* Encore 3070 */ + {USB_DEVICE(0x148F, 0x3070)}, /* Ralink 3070 */ + {USB_DEVICE(0x148F, 0x3071)}, /* Ralink 3071 */ + {USB_DEVICE(0x148F, 0x3072)}, /* Ralink 3072 */ + {USB_DEVICE(0x0DB0, 0x3820)}, /* Ralink 3070 */ + {USB_DEVICE(0x0DF6, 0x003E)}, /* Sitecom 3070 */ + {USB_DEVICE(0x0DF6, 0x0042)}, /* Sitecom 3072 */ + {USB_DEVICE(0x14B2, 0x3C12)}, /* AL 3070 */ + {USB_DEVICE(0x18C5, 0x0012)}, /* Corega 3070 */ + {USB_DEVICE(0x083A, 0x7511)}, /* Arcadyan 3070 */ + {USB_DEVICE(0x1740, 0x9703)}, /* EnGenius 3070 */ + {USB_DEVICE(0x1740, 0x9705)}, /* EnGenius 3071 */ + {USB_DEVICE(0x1740, 0x9706)}, /* EnGenius 3072 */ + {USB_DEVICE(0x13D3, 0x3273)}, /* AzureWave 3070 */ + {USB_DEVICE(0x1044, 0x800D)}, /* Gigabyte GN-WB32L 3070 */ + {USB_DEVICE(0x2019, 0xAB25)}, /* Planex Communications, Inc. RT3070 */ + {USB_DEVICE(0x07B8, 0x3070)}, /* AboCom 3070 */ + {USB_DEVICE(0x07B8, 0x3071)}, /* AboCom 3071 */ + {USB_DEVICE(0x07B8, 0x3072)}, /* Abocom 3072 */ + {USB_DEVICE(0x7392, 0x7711)}, /* Edimax 3070 */ + {USB_DEVICE(0x1A32, 0x0304)}, /* Quanta 3070 */ + {USB_DEVICE(0x1EDA, 0x2310)}, /* AirTies 3070 */ + {USB_DEVICE(0x07D1, 0x3C0A)}, /* D-Link 3072 */ + {USB_DEVICE(0x07D1, 0x3C0D)}, /* D-Link 3070 */ + {USB_DEVICE(0x07D1, 0x3C0E)}, /* D-Link 3070 */ + {USB_DEVICE(0x07D1, 0x3C0F)}, /* D-Link 3070 */ + {USB_DEVICE(0x1D4D, 0x000C)}, /* Pegatron Corporation 3070 */ + {USB_DEVICE(0x1D4D, 0x000E)}, /* Pegatron Corporation 3070 */ + {USB_DEVICE(0x5A57, 0x5257)}, /* Zinwell 3070 */ + {USB_DEVICE(0x5A57, 0x0283)}, /* Zinwell 3072 */ + {USB_DEVICE(0x04BB, 0x0945)}, /* I-O DATA 3072 */ + {USB_DEVICE(0x203D, 0x1480)}, /* Encore 3070 */ #endif // RT3070 // - { USB_DEVICE(0x0DF6, 0x003F) }, /* Sitecom WL-608 */ - { USB_DEVICE(0x1737, 0x0077) }, /* Linksys WUSB54GC-EU v3 */ - { USB_DEVICE(0x2001, 0x3C09) }, /* D-Link */ - { USB_DEVICE(0x2001, 0x3C0A) }, /* D-Link 3072*/ - { USB_DEVICE(0x2019, 0xED14) }, /* Planex Communications, Inc. */ - { }/* Terminating entry */ + {USB_DEVICE(0x0DF6, 0x003F)}, /* Sitecom WL-608 */ + {USB_DEVICE(0x1737, 0x0077)}, /* Linksys WUSB54GC-EU v3 */ + {USB_DEVICE(0x2001, 0x3C09)}, /* D-Link */ + {USB_DEVICE(0x2001, 0x3C0A)}, /* D-Link 3072 */ + {USB_DEVICE(0x2019, 0xED14)}, /* Planex Communications, Inc. */ + {} /* Terminating entry */ }; -INT const rtusb_usb_id_len = sizeof(rtusb_usb_id) / sizeof(struct usb_device_id); +INT const rtusb_usb_id_len = + sizeof(rtusb_usb_id) / sizeof(struct usb_device_id); MODULE_DEVICE_TABLE(usb, rtusb_usb_id); -static void rt2870_disconnect( - IN struct usb_device *dev, - IN PRTMP_ADAPTER pAd); +static void rt2870_disconnect(IN struct usb_device *dev, IN PRTMP_ADAPTER pAd); -static int __devinit rt2870_probe( - IN struct usb_interface *intf, - IN struct usb_device *usb_dev, - IN const struct usb_device_id *dev_id, - IN RTMP_ADAPTER **ppAd); +static int __devinit rt2870_probe(IN struct usb_interface *intf, + IN struct usb_device *usb_dev, + IN const struct usb_device_id *dev_id, + IN RTMP_ADAPTER ** ppAd); #ifndef PF_NOFREEZE #define PF_NOFREEZE 0 #endif - extern int rt28xx_close(IN struct net_device *net_dev); extern int rt28xx_open(struct net_device *net_dev); -static BOOLEAN USBDevConfigInit( - IN struct usb_device *dev, - IN struct usb_interface *intf, - IN RTMP_ADAPTER *pAd); - +static BOOLEAN USBDevConfigInit(IN struct usb_device *dev, + IN struct usb_interface *intf, + IN RTMP_ADAPTER * pAd); /* ======================================================================== @@ -188,27 +181,23 @@ Return Value: Note: ======================================================================== */ -BOOLEAN RT28XXChipsetCheck( - IN void *_dev_p) +BOOLEAN RT28XXChipsetCheck(IN void *_dev_p) { struct usb_interface *intf = (struct usb_interface *)_dev_p; struct usb_device *dev_p = interface_to_usbdev(intf); UINT32 i; - - for(i=0; idescriptor.idVendor == rtusb_usb_id[i].idVendor && - dev_p->descriptor.idProduct == rtusb_usb_id[i].idProduct) - { + dev_p->descriptor.idProduct == rtusb_usb_id[i].idProduct) { printk("rt2870: idVendor = 0x%x, idProduct = 0x%x\n", - dev_p->descriptor.idVendor, dev_p->descriptor.idProduct); + dev_p->descriptor.idVendor, + dev_p->descriptor.idProduct); break; } } - if (i == rtusb_usb_id_len) - { + if (i == rtusb_usb_id_len) { printk("rt2870: Error! Device Descriptor not matching!\n"); return FALSE; } @@ -227,61 +216,76 @@ static int rt2870_suspend(struct usb_interface *intf, pm_message_t state); static int rt2870_resume(struct usb_interface *intf); #endif // CONFIG_PM // -static int rtusb_probe (struct usb_interface *intf, - const struct usb_device_id *id); +static int rtusb_probe(struct usb_interface *intf, + const struct usb_device_id *id); static void rtusb_disconnect(struct usb_interface *intf); -static BOOLEAN USBDevConfigInit( - IN struct usb_device *dev, - IN struct usb_interface *intf, - IN RTMP_ADAPTER *pAd) +static BOOLEAN USBDevConfigInit(IN struct usb_device *dev, + IN struct usb_interface *intf, + IN RTMP_ADAPTER * pAd) { struct usb_host_interface *iface_desc; ULONG BulkOutIdx; UINT32 i; - /* get the active interface descriptor */ iface_desc = intf->cur_altsetting; /* get # of enpoints */ pAd->NumberOfPipes = iface_desc->desc.bNumEndpoints; - DBGPRINT(RT_DEBUG_TRACE, ("NumEndpoints=%d\n", iface_desc->desc.bNumEndpoints)); + DBGPRINT(RT_DEBUG_TRACE, + ("NumEndpoints=%d\n", iface_desc->desc.bNumEndpoints)); /* Configure Pipes */ BulkOutIdx = 0; - for(i=0; iNumberOfPipes; i++) - { + for (i = 0; i < pAd->NumberOfPipes; i++) { if ((iface_desc->endpoint[i].desc.bmAttributes == - USB_ENDPOINT_XFER_BULK) && - ((iface_desc->endpoint[i].desc.bEndpointAddress & - USB_ENDPOINT_DIR_MASK) == USB_DIR_IN)) - { - pAd->BulkInEpAddr = iface_desc->endpoint[i].desc.bEndpointAddress; - pAd->BulkInMaxPacketSize = le2cpu16(iface_desc->endpoint[i].desc.wMaxPacketSize); - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("BULK IN MaxPacketSize = %d\n", pAd->BulkInMaxPacketSize)); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("EP address = 0x%2x\n", iface_desc->endpoint[i].desc.bEndpointAddress)); - } - else if ((iface_desc->endpoint[i].desc.bmAttributes == - USB_ENDPOINT_XFER_BULK) && - ((iface_desc->endpoint[i].desc.bEndpointAddress & - USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT)) - { + USB_ENDPOINT_XFER_BULK) && + ((iface_desc->endpoint[i].desc.bEndpointAddress & + USB_ENDPOINT_DIR_MASK) == USB_DIR_IN)) { + pAd->BulkInEpAddr = + iface_desc->endpoint[i].desc.bEndpointAddress; + pAd->BulkInMaxPacketSize = + le2cpu16(iface_desc->endpoint[i].desc. + wMaxPacketSize); + + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("BULK IN MaxPacketSize = %d\n", + pAd->BulkInMaxPacketSize)); + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("EP address = 0x%2x\n", + iface_desc->endpoint[i].desc. + bEndpointAddress)); + } else + if ((iface_desc->endpoint[i].desc.bmAttributes == + USB_ENDPOINT_XFER_BULK) + && + ((iface_desc->endpoint[i].desc. + bEndpointAddress & USB_ENDPOINT_DIR_MASK) == + USB_DIR_OUT)) { // there are 6 bulk out EP. EP6 highest priority. // EP1-4 is EDCA. EP5 is HCCA. - pAd->BulkOutEpAddr[BulkOutIdx++] = iface_desc->endpoint[i].desc.bEndpointAddress; - pAd->BulkOutMaxPacketSize = le2cpu16(iface_desc->endpoint[i].desc.wMaxPacketSize); - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("BULK OUT MaxPacketSize = %d\n", pAd->BulkOutMaxPacketSize)); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("EP address = 0x%2x \n", iface_desc->endpoint[i].desc.bEndpointAddress)); + pAd->BulkOutEpAddr[BulkOutIdx++] = + iface_desc->endpoint[i].desc.bEndpointAddress; + pAd->BulkOutMaxPacketSize = + le2cpu16(iface_desc->endpoint[i].desc. + wMaxPacketSize); + + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("BULK OUT MaxPacketSize = %d\n", + pAd->BulkOutMaxPacketSize)); + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("EP address = 0x%2x \n", + iface_desc->endpoint[i].desc. + bEndpointAddress)); } } - if (!(pAd->BulkInEpAddr && pAd->BulkOutEpAddr[0])) - { - printk("%s: Could not find both bulk-in and bulk-out endpoints\n", __FUNCTION__); + if (!(pAd->BulkInEpAddr && pAd->BulkOutEpAddr[0])) { + printk + ("%s: Could not find both bulk-in and bulk-out endpoints\n", + __FUNCTION__); return FALSE; } @@ -292,10 +296,8 @@ static BOOLEAN USBDevConfigInit( } - - -static int rtusb_probe (struct usb_interface *intf, - const struct usb_device_id *id) +static int rtusb_probe(struct usb_interface *intf, + const struct usb_device_id *id) { RTMP_ADAPTER *pAd; struct usb_device *dev; @@ -311,12 +313,10 @@ static int rtusb_probe (struct usb_interface *intf, return rv; } - static void rtusb_disconnect(struct usb_interface *intf) { - struct usb_device *dev = interface_to_usbdev(intf); - PRTMP_ADAPTER pAd; - + struct usb_device *dev = interface_to_usbdev(intf); + PRTMP_ADAPTER pAd; pAd = usb_get_intfdata(intf); usb_set_intfdata(intf, NULL); @@ -324,36 +324,31 @@ static void rtusb_disconnect(struct usb_interface *intf) rt2870_disconnect(dev, pAd); } - struct usb_driver rtusb_driver = { - .name="rt2870", - .probe=rtusb_probe, - .disconnect=rtusb_disconnect, - .id_table=rtusb_usb_id, + .name = "rt2870", + .probe = rtusb_probe, + .disconnect = rtusb_disconnect, + .id_table = rtusb_usb_id, #ifdef CONFIG_PM - suspend: rt2870_suspend, - resume: rt2870_resume, +suspend:rt2870_suspend, +resume:rt2870_resume, #endif - }; +}; #ifdef CONFIG_PM -VOID RT2870RejectPendingPackets( - IN PRTMP_ADAPTER pAd) +VOID RT2870RejectPendingPackets(IN PRTMP_ADAPTER pAd) { // clear PS packets // clear TxSw packets } -static int rt2870_suspend( - struct usb_interface *intf, - pm_message_t state) +static int rt2870_suspend(struct usb_interface *intf, pm_message_t state) { struct net_device *net_dev; PRTMP_ADAPTER pAd = usb_get_intfdata(intf); - DBGPRINT(RT_DEBUG_TRACE, ("===> rt2870_suspend()\n")); net_dev = pAd->net_dev; netif_device_detach(net_dev); @@ -367,13 +362,11 @@ static int rt2870_suspend( return 0; } -static int rt2870_resume( - struct usb_interface *intf) +static int rt2870_resume(struct usb_interface *intf) { struct net_device *net_dev; PRTMP_ADAPTER pAd = usb_get_intfdata(intf); - DBGPRINT(RT_DEBUG_TRACE, ("===> rt2870_resume()\n")); pAd->PM_FlgSuspend = 0; @@ -405,9 +398,6 @@ VOID __exit rtusb_exit(void) module_init(rtusb_init); module_exit(rtusb_exit); - - - /*--------------------------------------------------------------------- */ /* function declarations */ /*--------------------------------------------------------------------- */ @@ -426,35 +416,32 @@ Return Value: Note: ======================================================================== */ -INT MlmeThread( - IN void *Context) +INT MlmeThread(IN void *Context) { RTMP_ADAPTER *pAd; RTMP_OS_TASK *pTask; int status; status = 0; - pTask = (RTMP_OS_TASK *)Context; - pAd = (PRTMP_ADAPTER)pTask->priv; + pTask = (RTMP_OS_TASK *) Context; + pAd = (PRTMP_ADAPTER) pTask->priv; RtmpOSTaskCustomize(pTask); - while(!pTask->task_killed) - { + while (!pTask->task_killed) { #ifdef KTHREAD_SUPPORT RTMP_WAIT_EVENT_INTERRUPTIBLE(pAd, pTask); #else RTMP_SEM_EVENT_WAIT(&(pTask->taskSema), status); /* unlock the device pointers */ - if (status != 0) - { + if (status != 0) { RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); break; } #endif - /* lock the device pointers , need to check if required*/ + /* lock the device pointers , need to check if required */ //down(&(pAd->usbdev_semaphore)); if (!pAd->PM_FlgSuspend) @@ -475,16 +462,15 @@ INT MlmeThread( * This is important in preemption kernels, which transfer the flow * of execution immediately upon a complete(). */ - DBGPRINT(RT_DEBUG_TRACE,( "<---%s\n",__FUNCTION__)); + DBGPRINT(RT_DEBUG_TRACE, ("<---%s\n", __FUNCTION__)); #ifndef KTHREAD_SUPPORT pTask->taskPID = THREAD_PID_INIT_VALUE; - complete_and_exit (&pTask->taskComplete, 0); + complete_and_exit(&pTask->taskComplete, 0); #endif return 0; } - /* ======================================================================== Routine Description: @@ -499,16 +485,15 @@ Return Value: Note: ======================================================================== */ -INT RTUSBCmdThread( - IN void * Context) +INT RTUSBCmdThread(IN void *Context) { RTMP_ADAPTER *pAd; RTMP_OS_TASK *pTask; int status; status = 0; - pTask = (RTMP_OS_TASK *)Context; - pAd = (PRTMP_ADAPTER)pTask->priv; + pTask = (RTMP_OS_TASK *) Context; + pAd = (PRTMP_ADAPTER) pTask->priv; RtmpOSTaskCustomize(pTask); @@ -516,16 +501,14 @@ INT RTUSBCmdThread( pAd->CmdQ.CmdQState = RTMP_TASK_STAT_RUNNING; NdisReleaseSpinLock(&pAd->CmdQLock); - while (pAd && pAd->CmdQ.CmdQState == RTMP_TASK_STAT_RUNNING) - { + while (pAd && pAd->CmdQ.CmdQState == RTMP_TASK_STAT_RUNNING) { #ifdef KTHREAD_SUPPORT RTMP_WAIT_EVENT_INTERRUPTIBLE(pAd, pTask); #else /* lock the device pointers */ RTMP_SEM_EVENT_WAIT(&(pTask->taskSema), status); - if (status != 0) - { + if (status != 0) { RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); break; } @@ -538,28 +521,25 @@ INT RTUSBCmdThread( CMDHandler(pAd); } - if (pAd && !pAd->PM_FlgSuspend) - { // Clear the CmdQElements. - CmdQElmt *pCmdQElmt = NULL; + if (pAd && !pAd->PM_FlgSuspend) { // Clear the CmdQElements. + CmdQElmt *pCmdQElmt = NULL; NdisAcquireSpinLock(&pAd->CmdQLock); pAd->CmdQ.CmdQState = RTMP_TASK_STAT_STOPED; - while(pAd->CmdQ.size) - { + while (pAd->CmdQ.size) { RTUSBDequeueCmd(&pAd->CmdQ, &pCmdQElmt); - if (pCmdQElmt) - { - if (pCmdQElmt->CmdFromNdis == TRUE) - { + if (pCmdQElmt) { + if (pCmdQElmt->CmdFromNdis == TRUE) { if (pCmdQElmt->buffer != NULL) - os_free_mem(pAd, pCmdQElmt->buffer); - os_free_mem(pAd, (PUCHAR)pCmdQElmt); - } - else - { - if ((pCmdQElmt->buffer != NULL) && (pCmdQElmt->bufferlength != 0)) - os_free_mem(pAd, pCmdQElmt->buffer); - os_free_mem(pAd, (PUCHAR)pCmdQElmt); + os_free_mem(pAd, + pCmdQElmt->buffer); + os_free_mem(pAd, (PUCHAR) pCmdQElmt); + } else { + if ((pCmdQElmt->buffer != NULL) + && (pCmdQElmt->bufferlength != 0)) + os_free_mem(pAd, + pCmdQElmt->buffer); + os_free_mem(pAd, (PUCHAR) pCmdQElmt); } } } @@ -580,52 +560,54 @@ INT RTUSBCmdThread( * This is important in preemption kernels, which transfer the flow * of execution immediately upon a complete(). */ - DBGPRINT(RT_DEBUG_TRACE,( "<---RTUSBCmdThread\n")); + DBGPRINT(RT_DEBUG_TRACE, ("<---RTUSBCmdThread\n")); #ifndef KTHREAD_SUPPORT pTask->taskPID = THREAD_PID_INIT_VALUE; - complete_and_exit (&pTask->taskComplete, 0); + complete_and_exit(&pTask->taskComplete, 0); #endif return 0; } - -VOID RTUSBWatchDog(IN RTMP_ADAPTER *pAd) +VOID RTUSBWatchDog(IN RTMP_ADAPTER * pAd) { - PHT_TX_CONTEXT pHTTXContext; - int idx; - ULONG irqFlags; - PURB pUrb; - BOOLEAN needDumpSeq = FALSE; - UINT32 MACValue; - UINT32 TxRxQ_Pcnt; + PHT_TX_CONTEXT pHTTXContext; + int idx; + ULONG irqFlags; + PURB pUrb; + BOOLEAN needDumpSeq = FALSE; + UINT32 MACValue; + UINT32 TxRxQ_Pcnt; idx = 0; RTMP_IO_READ32(pAd, TXRXQ_PCNT, &MACValue); - if ((MACValue & 0xff) !=0 ) - { - DBGPRINT(RT_DEBUG_TRACE, ("TX QUEUE 0 Not EMPTY(Value=0x%0x). !!!!!!!!!!!!!!!\n", MACValue)); + if ((MACValue & 0xff) != 0) { + DBGPRINT(RT_DEBUG_TRACE, + ("TX QUEUE 0 Not EMPTY(Value=0x%0x). !!!!!!!!!!!!!!!\n", + MACValue)); RTMP_IO_WRITE32(pAd, PBF_CFG, 0xf40012); - while((MACValue &0xff) != 0 && (idx++ < 10)) - { - RTMP_IO_READ32(pAd, TXRXQ_PCNT, &MACValue); - RTMPusecDelay(1); + while ((MACValue & 0xff) != 0 && (idx++ < 10)) { + RTMP_IO_READ32(pAd, TXRXQ_PCNT, &MACValue); + RTMPusecDelay(1); } RTMP_IO_WRITE32(pAd, PBF_CFG, 0xf40006); } - if (pAd->watchDogRxOverFlowCnt >= 2) - { - DBGPRINT(RT_DEBUG_TRACE, ("Maybe the Rx Bulk-In hanged! Cancel the pending Rx bulks request!\n")); - if ((!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_BULKIN_RESET | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST)))) - { - DBGPRINT(RT_DEBUG_TRACE, ("Call CMDTHREAD_RESET_BULK_IN to cancel the pending Rx Bulk!\n")); + if (pAd->watchDogRxOverFlowCnt >= 2) { + DBGPRINT(RT_DEBUG_TRACE, + ("Maybe the Rx Bulk-In hanged! Cancel the pending Rx bulks request!\n")); + if ((!RTMP_TEST_FLAG + (pAd, + (fRTMP_ADAPTER_RESET_IN_PROGRESS | + fRTMP_ADAPTER_BULKIN_RESET | + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST)))) { + DBGPRINT(RT_DEBUG_TRACE, + ("Call CMDTHREAD_RESET_BULK_IN to cancel the pending Rx Bulk!\n")); RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKIN_RESET); - RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_IN, NULL, 0); + RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_IN, + NULL, 0); needDumpSeq = TRUE; } pAd->watchDogRxOverFlowCnt = 0; @@ -633,126 +615,139 @@ VOID RTUSBWatchDog(IN RTMP_ADAPTER *pAd) RTUSBReadMACRegister(pAd, 0x438, &TxRxQ_Pcnt); - for (idx = 0; idx < NUM_OF_TX_RING; idx++) - { + for (idx = 0; idx < NUM_OF_TX_RING; idx++) { pUrb = NULL; RTMP_IRQ_LOCK(&pAd->BulkOutLock[idx], irqFlags); - if ((pAd->BulkOutPending[idx] == TRUE) && pAd->watchDogTxPendingCnt) - { - INT actual_length=0,transfer_buffer_length=0; - BOOLEAN isDataPacket=FALSE; + if ((pAd->BulkOutPending[idx] == TRUE) + && pAd->watchDogTxPendingCnt) { + INT actual_length = 0, transfer_buffer_length = 0; + BOOLEAN isDataPacket = FALSE; pAd->watchDogTxPendingCnt[idx]++; if ((pAd->watchDogTxPendingCnt[idx] > 2) && - (!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_BULKOUT_RESET))) - ) - { + (!RTMP_TEST_FLAG + (pAd, + (fRTMP_ADAPTER_RESET_IN_PROGRESS | + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST | + fRTMP_ADAPTER_BULKOUT_RESET))) + ) { // FIXME: Following code just support single bulk out. If you wanna support multiple bulk out. Modify it! - pHTTXContext = (PHT_TX_CONTEXT)(&pAd->TxContext[idx]); - if (pHTTXContext->IRPPending) - { // Check TxContext. + pHTTXContext = + (PHT_TX_CONTEXT) (&pAd->TxContext[idx]); + if (pHTTXContext->IRPPending) { // Check TxContext. pUrb = pHTTXContext->pUrb; - actual_length=pUrb->actual_length; - transfer_buffer_length=pUrb->transfer_buffer_length; - isDataPacket=TRUE; - } - else if (idx == MGMTPIPEIDX) - { - PTX_CONTEXT pMLMEContext, pNULLContext, pPsPollContext; + actual_length = pUrb->actual_length; + transfer_buffer_length = + pUrb->transfer_buffer_length; + isDataPacket = TRUE; + } else if (idx == MGMTPIPEIDX) { + PTX_CONTEXT pMLMEContext, pNULLContext, + pPsPollContext; //Check MgmtContext. - pMLMEContext = (PTX_CONTEXT)(pAd->MgmtRing.Cell[pAd->MgmtRing.TxDmaIdx].AllocVa); - pPsPollContext = (PTX_CONTEXT)(&pAd->PsPollContext); - pNULLContext = (PTX_CONTEXT)(&pAd->NullContext); - - if (pMLMEContext->IRPPending) - { - ASSERT(pMLMEContext->IRPPending); + pMLMEContext = + (PTX_CONTEXT) (pAd->MgmtRing. + Cell[pAd->MgmtRing. + TxDmaIdx]. + AllocVa); + pPsPollContext = + (PTX_CONTEXT) (&pAd->PsPollContext); + pNULLContext = + (PTX_CONTEXT) (&pAd->NullContext); + + if (pMLMEContext->IRPPending) { + ASSERT(pMLMEContext-> + IRPPending); pUrb = pMLMEContext->pUrb; - } - else if (pNULLContext->IRPPending) - { - ASSERT(pNULLContext->IRPPending); + } else if (pNULLContext->IRPPending) { + ASSERT(pNULLContext-> + IRPPending); pUrb = pNULLContext->pUrb; - } - else if (pPsPollContext->IRPPending) - { - ASSERT(pPsPollContext->IRPPending); + } else if (pPsPollContext->IRPPending) { + ASSERT(pPsPollContext-> + IRPPending); pUrb = pPsPollContext->pUrb; } } - RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[idx], irqFlags); + RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[idx], + irqFlags); printk(KERN_INFO "%d:%lu LTL=%d , TL=%d L:%d\n", idx, pAd->watchDogTxPendingCnt[idx], pAd->TransferedLength[idx], actual_length, transfer_buffer_length); - if (pUrb) - { + if (pUrb) { if ((isDataPacket - && pAd->TransferedLength[idx]==actual_length - && pAd->TransferedLength[idx]watchDogTxPendingCnt[idx]>3) - || isDataPacket==FALSE || pAd->watchDogTxPendingCnt[idx]>6) - { - DBGPRINT(RT_DEBUG_TRACE, ("Maybe the Tx Bulk-Out hanged! Cancel the pending Tx bulks request of idx(%d)!\n", idx)); - DBGPRINT(RT_DEBUG_TRACE, ("Unlink the pending URB!\n")); - // unlink it now - RTUSB_UNLINK_URB(pUrb); - // Sleep 200 microseconds to give cancellation time to work + && pAd->TransferedLength[idx] == + actual_length + && pAd->TransferedLength[idx] < + transfer_buffer_length + && actual_length != 0 +// && TxRxQ_Pcnt==0 + && pAd->watchDogTxPendingCnt[idx] > + 3) + || isDataPacket == FALSE + || pAd->watchDogTxPendingCnt[idx] > + 6) { + DBGPRINT(RT_DEBUG_TRACE, + ("Maybe the Tx Bulk-Out hanged! Cancel the pending Tx bulks request of idx(%d)!\n", + idx)); + DBGPRINT(RT_DEBUG_TRACE, + ("Unlink the pending URB!\n")); + // unlink it now + RTUSB_UNLINK_URB(pUrb); + // Sleep 200 microseconds to give cancellation time to work //RTMPusecDelay(200); - needDumpSeq = TRUE; + needDumpSeq = TRUE; } + } else { + DBGPRINT(RT_DEBUG_ERROR, + ("Unkonw bulkOut URB maybe hanged!!!!!!!!!!!!\n")); } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("Unkonw bulkOut URB maybe hanged!!!!!!!!!!!!\n")); - } - } - else - { - RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[idx], irqFlags); + } else { + RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[idx], + irqFlags); } - if (isDataPacket==TRUE) - pAd->TransferedLength[idx]=actual_length; - } - else - { + if (isDataPacket == TRUE) + pAd->TransferedLength[idx] = actual_length; + } else { RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[idx], irqFlags); } } // For Sigma debug, dump the ba_reordering sequence. - if((needDumpSeq == TRUE) && (pAd->CommonCfg.bDisableReordering == 0)) - { - USHORT Idx; - PBA_REC_ENTRY pBAEntry = NULL; - UCHAR count = 0; + if ((needDumpSeq == TRUE) && (pAd->CommonCfg.bDisableReordering == 0)) { + USHORT Idx; + PBA_REC_ENTRY pBAEntry = NULL; + UCHAR count = 0; struct reordering_mpdu *mpdu_blk; Idx = pAd->MacTab.Content[BSSID_WCID].BARecWcidArray[0]; pBAEntry = &pAd->BATable.BARecEntry[Idx]; - if((pBAEntry->list.qlen > 0) && (pBAEntry->list.next != NULL)) - { - DBGPRINT(RT_DEBUG_TRACE, ("NICUpdateRawCounters():The Queueing pkt in reordering buffer:\n")); + if ((pBAEntry->list.qlen > 0) && (pBAEntry->list.next != NULL)) { + DBGPRINT(RT_DEBUG_TRACE, + ("NICUpdateRawCounters():The Queueing pkt in reordering buffer:\n")); NdisAcquireSpinLock(&pBAEntry->RxReRingLock); mpdu_blk = pBAEntry->list.next; - while (mpdu_blk) - { - DBGPRINT(RT_DEBUG_TRACE, ("\t%d:Seq-%d, bAMSDU-%d!\n", count, mpdu_blk->Sequence, mpdu_blk->bAMSDU)); + while (mpdu_blk) { + DBGPRINT(RT_DEBUG_TRACE, + ("\t%d:Seq-%d, bAMSDU-%d!\n", count, + mpdu_blk->Sequence, + mpdu_blk->bAMSDU)); mpdu_blk = mpdu_blk->next; count++; } - DBGPRINT(RT_DEBUG_TRACE, ("\npBAEntry->LastIndSeq=%d!\n", pBAEntry->LastIndSeq)); + DBGPRINT(RT_DEBUG_TRACE, + ("\npBAEntry->LastIndSeq=%d!\n", + pBAEntry->LastIndSeq)); NdisReleaseSpinLock(&pBAEntry->RxReRingLock); } } @@ -775,10 +770,10 @@ Note: */ static void rt2870_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd) { - DBGPRINT(RT_DEBUG_ERROR, ("rtusb_disconnect: unregister usbnet usb-%s-%s\n", - dev->bus->bus_name, dev->devpath)); - if (!pAd) - { + DBGPRINT(RT_DEBUG_ERROR, + ("rtusb_disconnect: unregister usbnet usb-%s-%s\n", + dev->bus->bus_name, dev->devpath)); + if (!pAd) { usb_put_dev(dev); printk("rtusb_disconnect: pAd == NULL!\n"); return; @@ -788,7 +783,6 @@ static void rt2870_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd) // for debug, wait to show some messages to /proc system udelay(1); - RtmpPhyNetDevExit(pAd, pAd->net_dev); // FIXME: Shall we need following delay and flush the schedule?? @@ -808,43 +802,38 @@ static void rt2870_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_ERROR, (" RTUSB disconnect successfully\n")); } - -static int __devinit rt2870_probe( - IN struct usb_interface *intf, - IN struct usb_device *usb_dev, - IN const struct usb_device_id *dev_id, - IN RTMP_ADAPTER **ppAd) +static int __devinit rt2870_probe(IN struct usb_interface *intf, + IN struct usb_device *usb_dev, + IN const struct usb_device_id *dev_id, + IN RTMP_ADAPTER ** ppAd) { - struct net_device *net_dev = NULL; - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) NULL; - INT status, rv; - PVOID handle; - RTMP_OS_NETDEV_OP_HOOK netDevHook; - + struct net_device *net_dev = NULL; + RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) NULL; + INT status, rv; + PVOID handle; + RTMP_OS_NETDEV_OP_HOOK netDevHook; DBGPRINT(RT_DEBUG_TRACE, ("===>rt2870_probe()!\n")); // Check chipset vendor/product ID //if (RT28XXChipsetCheck(_dev_p) == FALSE) - // goto err_out; + // goto err_out; //RtmpDevInit============================================= // Allocate RTMP_ADAPTER adapter structure handle = kmalloc(sizeof(struct os_cookie), GFP_KERNEL); - if (handle == NULL) - { - printk("rt2870_probe(): Allocate memory for os handle failed!\n"); + if (handle == NULL) { + printk + ("rt2870_probe(): Allocate memory for os handle failed!\n"); return -ENOMEM; } - ((POS_COOKIE)handle)->pUsb_Dev = usb_dev; + ((POS_COOKIE) handle)->pUsb_Dev = usb_dev; rv = RTMPAllocAdapterBlock(handle, &pAd); - if (rv != NDIS_STATUS_SUCCESS) - { + if (rv != NDIS_STATUS_SUCCESS) { kfree(handle); goto err_out; } - //USBDevInit============================================== if (USBDevConfigInit(usb_dev, intf, pAd) == FALSE) goto err_out_free_radev; @@ -858,12 +847,12 @@ static int __devinit rt2870_probe( // Here are the net_device structure with usb specific parameters. /* for supporting Network Manager. - * Set the sysfs physical device reference for the network logical device if set prior to registration will - * cause a symlink during initialization. + * Set the sysfs physical device reference for the network logical device if set prior to registration will + * cause a symlink during initialization. */ SET_NETDEV_DEV(net_dev, &(usb_dev->dev)); - pAd->StaCfg.OriDevType = net_dev->type; + pAd->StaCfg.OriDevType = net_dev->type; //All done, it's time to register the net device to linux kernel. // Register this device diff --git a/drivers/staging/rt2870/common/rtusb_bulk.c b/drivers/staging/rt2870/common/rtusb_bulk.c index 82b23ae9facd..269dedc7c066 100644 --- a/drivers/staging/rt2870/common/rtusb_bulk.c +++ b/drivers/staging/rt2870/common/rtusb_bulk.c @@ -39,35 +39,32 @@ #ifdef RTMP_MAC_USB - #include "../rt_config.h" // Match total 6 bulkout endpoint to corresponding queue. -UCHAR EpToQueue[6]={FIFO_EDCA, FIFO_EDCA, FIFO_EDCA, FIFO_EDCA, FIFO_EDCA, FIFO_MGMT}; +UCHAR EpToQueue[6] = + { FIFO_EDCA, FIFO_EDCA, FIFO_EDCA, FIFO_EDCA, FIFO_EDCA, FIFO_MGMT }; //static BOOLEAN SingleBulkOut = FALSE; -void RTUSB_FILL_BULK_URB (struct urb *pUrb, - struct usb_device *pUsb_Dev, - unsigned int bulkpipe, - void *pTransferBuf, - int BufSize, - usb_complete_t Complete, - void *pContext) +void RTUSB_FILL_BULK_URB(struct urb *pUrb, + struct usb_device *pUsb_Dev, + unsigned int bulkpipe, + void *pTransferBuf, + int BufSize, usb_complete_t Complete, void *pContext) { - usb_fill_bulk_urb(pUrb, pUsb_Dev, bulkpipe, pTransferBuf, BufSize, (usb_complete_t)Complete, pContext); + usb_fill_bulk_urb(pUrb, pUsb_Dev, bulkpipe, pTransferBuf, BufSize, + (usb_complete_t) Complete, pContext); } -VOID RTUSBInitTxDesc( - IN PRTMP_ADAPTER pAd, - IN PTX_CONTEXT pTxContext, - IN UCHAR BulkOutPipeId, - IN usb_complete_t Func) +VOID RTUSBInitTxDesc(IN PRTMP_ADAPTER pAd, + IN PTX_CONTEXT pTxContext, + IN UCHAR BulkOutPipeId, IN usb_complete_t Func) { - PURB pUrb; - PUCHAR pSrc = NULL; - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + PURB pUrb; + PUCHAR pSrc = NULL; + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; pUrb = pTxContext->pUrb; ASSERT(pUrb); @@ -75,44 +72,38 @@ VOID RTUSBInitTxDesc( // Store BulkOut PipeId pTxContext->BulkOutPipeId = BulkOutPipeId; - if (pTxContext->bAggregatible) - { + if (pTxContext->bAggregatible) { pSrc = &pTxContext->TransferBuffer->Aggregation[2]; - } - else - { - pSrc = (PUCHAR) pTxContext->TransferBuffer->field.WirelessPacket; + } else { + pSrc = + (PUCHAR) pTxContext->TransferBuffer->field.WirelessPacket; } - //Initialize a tx bulk urb RTUSB_FILL_BULK_URB(pUrb, - pObj->pUsb_Dev, - usb_sndbulkpipe(pObj->pUsb_Dev, pAd->BulkOutEpAddr[BulkOutPipeId]), - pSrc, - pTxContext->BulkOutSize, - Func, - pTxContext); + pObj->pUsb_Dev, + usb_sndbulkpipe(pObj->pUsb_Dev, + pAd->BulkOutEpAddr[BulkOutPipeId]), + pSrc, pTxContext->BulkOutSize, Func, pTxContext); if (pTxContext->bAggregatible) - pUrb->transfer_dma = (pTxContext->data_dma + TX_BUFFER_NORMSIZE + 2); + pUrb->transfer_dma = + (pTxContext->data_dma + TX_BUFFER_NORMSIZE + 2); else - pUrb->transfer_dma = pTxContext->data_dma; + pUrb->transfer_dma = pTxContext->data_dma; pUrb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; } -VOID RTUSBInitHTTxDesc( - IN PRTMP_ADAPTER pAd, - IN PHT_TX_CONTEXT pTxContext, - IN UCHAR BulkOutPipeId, - IN ULONG BulkOutSize, - IN usb_complete_t Func) +VOID RTUSBInitHTTxDesc(IN PRTMP_ADAPTER pAd, + IN PHT_TX_CONTEXT pTxContext, + IN UCHAR BulkOutPipeId, + IN ULONG BulkOutSize, IN usb_complete_t Func) { - PURB pUrb; - PUCHAR pSrc = NULL; - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + PURB pUrb; + PUCHAR pSrc = NULL; + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; pUrb = pTxContext->pUrb; ASSERT(pUrb); @@ -120,53 +111,50 @@ VOID RTUSBInitHTTxDesc( // Store BulkOut PipeId pTxContext->BulkOutPipeId = BulkOutPipeId; - pSrc = &pTxContext->TransferBuffer->field.WirelessPacket[pTxContext->NextBulkOutPosition]; - + pSrc = + &pTxContext->TransferBuffer->field.WirelessPacket[pTxContext-> + NextBulkOutPosition]; //Initialize a tx bulk urb RTUSB_FILL_BULK_URB(pUrb, - pObj->pUsb_Dev, - usb_sndbulkpipe(pObj->pUsb_Dev, pAd->BulkOutEpAddr[BulkOutPipeId]), - pSrc, - BulkOutSize, - Func, - pTxContext); - - pUrb->transfer_dma = (pTxContext->data_dma + pTxContext->NextBulkOutPosition); + pObj->pUsb_Dev, + usb_sndbulkpipe(pObj->pUsb_Dev, + pAd->BulkOutEpAddr[BulkOutPipeId]), + pSrc, BulkOutSize, Func, pTxContext); + + pUrb->transfer_dma = + (pTxContext->data_dma + pTxContext->NextBulkOutPosition); pUrb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; } -VOID RTUSBInitRxDesc( - IN PRTMP_ADAPTER pAd, - IN PRX_CONTEXT pRxContext) +VOID RTUSBInitRxDesc(IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext) { - PURB pUrb; - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - ULONG RX_bulk_size; - + PURB pUrb; + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + ULONG RX_bulk_size; pUrb = pRxContext->pUrb; ASSERT(pUrb); - if ( pAd->BulkInMaxPacketSize == 64) + if (pAd->BulkInMaxPacketSize == 64) RX_bulk_size = 4096; else RX_bulk_size = MAX_RXBULK_SIZE; //Initialize a rx bulk urb RTUSB_FILL_BULK_URB(pUrb, - pObj->pUsb_Dev, - usb_rcvbulkpipe(pObj->pUsb_Dev, pAd->BulkInEpAddr), - &(pRxContext->TransferBuffer[pAd->NextRxBulkInPosition]), - RX_bulk_size - (pAd->NextRxBulkInPosition), - (usb_complete_t)RTUSBBulkRxComplete, - (void *)pRxContext); - - pUrb->transfer_dma = pRxContext->data_dma + pAd->NextRxBulkInPosition; + pObj->pUsb_Dev, + usb_rcvbulkpipe(pObj->pUsb_Dev, pAd->BulkInEpAddr), + &(pRxContext-> + TransferBuffer[pAd->NextRxBulkInPosition]), + RX_bulk_size - (pAd->NextRxBulkInPosition), + (usb_complete_t) RTUSBBulkRxComplete, + (void *)pRxContext); + + pUrb->transfer_dma = pRxContext->data_dma + pAd->NextRxBulkInPosition; pUrb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; - } /* @@ -191,179 +179,215 @@ VOID RTUSBInitRxDesc( if(1 /*!(in_interrupt() & 0xffff0000)*/) \ RTMP_IRQ_UNLOCK((pLock), IrqFlags); - -VOID RTUSBBulkOutDataPacket( - IN PRTMP_ADAPTER pAd, - IN UCHAR BulkOutPipeId, - IN UCHAR Index) +VOID RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, + IN UCHAR BulkOutPipeId, IN UCHAR Index) { - PHT_TX_CONTEXT pHTTXContext; - PURB pUrb; - int ret = 0; - PTXINFO_STRUC pTxInfo, pLastTxInfo = NULL; - PTXWI_STRUC pTxWI; - ULONG TmpBulkEndPos, ThisBulkSize; - unsigned long IrqFlags = 0, IrqFlags2 = 0; - PUCHAR pWirelessPkt, pAppendant; - BOOLEAN bTxQLastRound = FALSE; - UCHAR allzero[4]= {0x0,0x0,0x0,0x0}; + PHT_TX_CONTEXT pHTTXContext; + PURB pUrb; + int ret = 0; + PTXINFO_STRUC pTxInfo, pLastTxInfo = NULL; + PTXWI_STRUC pTxWI; + ULONG TmpBulkEndPos, ThisBulkSize; + unsigned long IrqFlags = 0, IrqFlags2 = 0; + PUCHAR pWirelessPkt, pAppendant; + BOOLEAN bTxQLastRound = FALSE; + UCHAR allzero[4] = { 0x0, 0x0, 0x0, 0x0 }; BULK_OUT_LOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); - if ((pAd->BulkOutPending[BulkOutPipeId] == TRUE) || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NEED_STOP_TX)) - { + if ((pAd->BulkOutPending[BulkOutPipeId] == TRUE) + || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NEED_STOP_TX)) { BULK_OUT_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); return; } pAd->BulkOutPending[BulkOutPipeId] = TRUE; if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) - ) - { + ) { pAd->BulkOutPending[BulkOutPipeId] = FALSE; BULK_OUT_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); return; } BULK_OUT_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); - pHTTXContext = &(pAd->TxContext[BulkOutPipeId]); BULK_OUT_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags2); - if ((pHTTXContext->ENextBulkOutPosition == pHTTXContext->CurWritePosition) - || ((pHTTXContext->ENextBulkOutPosition-8) == pHTTXContext->CurWritePosition)) - { - BULK_OUT_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags2); + if ((pHTTXContext->ENextBulkOutPosition == + pHTTXContext->CurWritePosition) + || ((pHTTXContext->ENextBulkOutPosition - 8) == + pHTTXContext->CurWritePosition)) { + BULK_OUT_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], + IrqFlags2); BULK_OUT_LOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); pAd->BulkOutPending[BulkOutPipeId] = FALSE; // Clear Data flag - RTUSB_CLEAR_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_FRAG << BulkOutPipeId)); - RTUSB_CLEAR_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId)); + RTUSB_CLEAR_BULK_FLAG(pAd, + (fRTUSB_BULK_OUT_DATA_FRAG << + BulkOutPipeId)); + RTUSB_CLEAR_BULK_FLAG(pAd, + (fRTUSB_BULK_OUT_DATA_NORMAL << + BulkOutPipeId)); BULK_OUT_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); return; } - // Clear Data flag - RTUSB_CLEAR_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_FRAG << BulkOutPipeId)); - RTUSB_CLEAR_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId)); + RTUSB_CLEAR_BULK_FLAG(pAd, + (fRTUSB_BULK_OUT_DATA_FRAG << BulkOutPipeId)); + RTUSB_CLEAR_BULK_FLAG(pAd, + (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId)); //DBGPRINT(RT_DEBUG_TRACE,("BulkOut-B:I=0x%lx, CWPos=%ld, CWRPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", in_interrupt(), - // pHTTXContext->CurWritePosition, pHTTXContext->CurWriteRealPos, pHTTXContext->NextBulkOutPosition, - // pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad)); + // pHTTXContext->CurWritePosition, pHTTXContext->CurWriteRealPos, pHTTXContext->NextBulkOutPosition, + // pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad)); pHTTXContext->NextBulkOutPosition = pHTTXContext->ENextBulkOutPosition; ThisBulkSize = 0; TmpBulkEndPos = pHTTXContext->NextBulkOutPosition; pWirelessPkt = &pHTTXContext->TransferBuffer->field.WirelessPacket[0]; - if ((pHTTXContext->bCopySavePad == TRUE)) - { - if (RTMPEqualMemory(pHTTXContext->SavedPad, allzero,4)) - { - DBGPRINT_RAW(RT_DEBUG_ERROR,("e1, allzero : %x %x %x %x %x %x %x %x \n", - pHTTXContext->SavedPad[0], pHTTXContext->SavedPad[1], pHTTXContext->SavedPad[2],pHTTXContext->SavedPad[3] - ,pHTTXContext->SavedPad[4], pHTTXContext->SavedPad[5], pHTTXContext->SavedPad[6],pHTTXContext->SavedPad[7])); + if ((pHTTXContext->bCopySavePad == TRUE)) { + if (RTMPEqualMemory(pHTTXContext->SavedPad, allzero, 4)) { + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("e1, allzero : %x %x %x %x %x %x %x %x \n", + pHTTXContext->SavedPad[0], + pHTTXContext->SavedPad[1], + pHTTXContext->SavedPad[2], + pHTTXContext->SavedPad[3] + , pHTTXContext->SavedPad[4], + pHTTXContext->SavedPad[5], + pHTTXContext->SavedPad[6], + pHTTXContext->SavedPad[7])); } - NdisMoveMemory(&pWirelessPkt[TmpBulkEndPos], pHTTXContext->SavedPad, 8); + NdisMoveMemory(&pWirelessPkt[TmpBulkEndPos], + pHTTXContext->SavedPad, 8); pHTTXContext->bCopySavePad = FALSE; if (pAd->bForcePrintTX == TRUE) - DBGPRINT(RT_DEBUG_TRACE,("RTUSBBulkOutDataPacket --> COPY PAD. CurWrite = %ld, NextBulk = %ld. ENextBulk = %ld.\n", pHTTXContext->CurWritePosition, pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition)); + DBGPRINT(RT_DEBUG_TRACE, + ("RTUSBBulkOutDataPacket --> COPY PAD. CurWrite = %ld, NextBulk = %ld. ENextBulk = %ld.\n", + pHTTXContext->CurWritePosition, + pHTTXContext->NextBulkOutPosition, + pHTTXContext->ENextBulkOutPosition)); } - do - { - pTxInfo = (PTXINFO_STRUC)&pWirelessPkt[TmpBulkEndPos]; - pTxWI = (PTXWI_STRUC)&pWirelessPkt[TmpBulkEndPos + TXINFO_SIZE]; + do { + pTxInfo = (PTXINFO_STRUC) & pWirelessPkt[TmpBulkEndPos]; + pTxWI = + (PTXWI_STRUC) & pWirelessPkt[TmpBulkEndPos + TXINFO_SIZE]; if (pAd->bForcePrintTX == TRUE) - DBGPRINT(RT_DEBUG_TRACE, ("RTUSBBulkOutDataPacket AMPDU = %d.\n", pTxWI->AMPDU)); + DBGPRINT(RT_DEBUG_TRACE, + ("RTUSBBulkOutDataPacket AMPDU = %d.\n", + pTxWI->AMPDU)); // add by Iverson, limit BulkOut size to 4k to pass WMM b mode 2T1R test items //if ((ThisBulkSize != 0) && (pTxWI->AMPDU == 0)) - if ((ThisBulkSize != 0) && (pTxWI->PHYMODE == MODE_CCK)) - { - if (((ThisBulkSize&0xffff8000) != 0) || ((ThisBulkSize&0x1000) == 0x1000)) - { + if ((ThisBulkSize != 0) && (pTxWI->PHYMODE == MODE_CCK)) { + if (((ThisBulkSize & 0xffff8000) != 0) + || ((ThisBulkSize & 0x1000) == 0x1000)) { // Limit BulkOut size to about 4k bytes. - pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos; + pHTTXContext->ENextBulkOutPosition = + TmpBulkEndPos; break; - } - else if (((pAd->BulkOutMaxPacketSize < 512) && ((ThisBulkSize&0xfffff800) != 0) ) /*|| ( (ThisBulkSize != 0) && (pTxWI->AMPDU == 0))*/) - { + } else + if (((pAd->BulkOutMaxPacketSize < 512) + && ((ThisBulkSize & 0xfffff800) != + 0)) + /*|| ( (ThisBulkSize != 0) && (pTxWI->AMPDU == 0)) */ + ) { // For USB 1.1 or peer which didn't support AMPDU, limit the BulkOut size. // For performence in b/g mode, now just check for USB 1.1 and didn't care about the APMDU or not! 2008/06/04. - pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos; + pHTTXContext->ENextBulkOutPosition = + TmpBulkEndPos; break; } } // end Iverson - else - { - if (((ThisBulkSize&0xffff8000) != 0) || ((ThisBulkSize&0x6000) == 0x6000)) - { // Limit BulkOut size to about 24k bytes. - pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos; + else { + if (((ThisBulkSize & 0xffff8000) != 0) || ((ThisBulkSize & 0x6000) == 0x6000)) { // Limit BulkOut size to about 24k bytes. + pHTTXContext->ENextBulkOutPosition = + TmpBulkEndPos; break; - } - else if (((pAd->BulkOutMaxPacketSize < 512) && ((ThisBulkSize&0xfffff800) != 0) ) /*|| ( (ThisBulkSize != 0) && (pTxWI->AMPDU == 0))*/) - { // For USB 1.1 or peer which didn't support AMPDU, limit the BulkOut size. + } else if (((pAd->BulkOutMaxPacketSize < 512) && ((ThisBulkSize & 0xfffff800) != 0)) /*|| ( (ThisBulkSize != 0) && (pTxWI->AMPDU == 0)) */ ) { // For USB 1.1 or peer which didn't support AMPDU, limit the BulkOut size. // For performence in b/g mode, now just check for USB 1.1 and didn't care about the APMDU or not! 2008/06/04. - pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos; + pHTTXContext->ENextBulkOutPosition = + TmpBulkEndPos; break; } } - if (TmpBulkEndPos == pHTTXContext->CurWritePosition) - { + if (TmpBulkEndPos == pHTTXContext->CurWritePosition) { pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos; break; } - if (pTxInfo->QSEL != FIFO_EDCA) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s(): ====> pTxInfo->QueueSel(%d)!= FIFO_EDCA!!!!\n", - __FUNCTION__, pTxInfo->QSEL)); - DBGPRINT(RT_DEBUG_ERROR, ("\tCWPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", - pHTTXContext->CurWritePosition, pHTTXContext->NextBulkOutPosition, - pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad)); - hex_dump("Wrong QSel Pkt:", (PUCHAR)&pWirelessPkt[TmpBulkEndPos], (pHTTXContext->CurWritePosition - pHTTXContext->NextBulkOutPosition)); + if (pTxInfo->QSEL != FIFO_EDCA) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s(): ====> pTxInfo->QueueSel(%d)!= FIFO_EDCA!!!!\n", + __FUNCTION__, pTxInfo->QSEL)); + DBGPRINT(RT_DEBUG_ERROR, + ("\tCWPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", + pHTTXContext->CurWritePosition, + pHTTXContext->NextBulkOutPosition, + pHTTXContext->ENextBulkOutPosition, + pHTTXContext->bCopySavePad)); + hex_dump("Wrong QSel Pkt:", + (PUCHAR) & pWirelessPkt[TmpBulkEndPos], + (pHTTXContext->CurWritePosition - + pHTTXContext->NextBulkOutPosition)); } - if (pTxInfo->USBDMATxPktLen <= 8) - { - BULK_OUT_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags2); - DBGPRINT(RT_DEBUG_ERROR /*RT_DEBUG_TRACE*/,("e2, USBDMATxPktLen==0, Size=%ld, bCSPad=%d, CWPos=%ld, NBPos=%ld, CWRPos=%ld!\n", - pHTTXContext->BulkOutSize, pHTTXContext->bCopySavePad, pHTTXContext->CurWritePosition, pHTTXContext->NextBulkOutPosition, pHTTXContext->CurWriteRealPos)); + if (pTxInfo->USBDMATxPktLen <= 8) { + BULK_OUT_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], + IrqFlags2); + DBGPRINT(RT_DEBUG_ERROR /*RT_DEBUG_TRACE */ , + ("e2, USBDMATxPktLen==0, Size=%ld, bCSPad=%d, CWPos=%ld, NBPos=%ld, CWRPos=%ld!\n", + pHTTXContext->BulkOutSize, + pHTTXContext->bCopySavePad, + pHTTXContext->CurWritePosition, + pHTTXContext->NextBulkOutPosition, + pHTTXContext->CurWriteRealPos)); { - DBGPRINT_RAW(RT_DEBUG_ERROR /*RT_DEBUG_TRACE*/,("%x %x %x %x %x %x %x %x \n", - pHTTXContext->SavedPad[0], pHTTXContext->SavedPad[1], pHTTXContext->SavedPad[2],pHTTXContext->SavedPad[3] - ,pHTTXContext->SavedPad[4], pHTTXContext->SavedPad[5], pHTTXContext->SavedPad[6],pHTTXContext->SavedPad[7])); + DBGPRINT_RAW(RT_DEBUG_ERROR /*RT_DEBUG_TRACE */ + , + ("%x %x %x %x %x %x %x %x \n", + pHTTXContext->SavedPad[0], + pHTTXContext->SavedPad[1], + pHTTXContext->SavedPad[2], + pHTTXContext->SavedPad[3] + , pHTTXContext->SavedPad[4], + pHTTXContext->SavedPad[5], + pHTTXContext->SavedPad[6], + pHTTXContext->SavedPad[7])); } pAd->bForcePrintTX = TRUE; - BULK_OUT_LOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); + BULK_OUT_LOCK(&pAd->BulkOutLock[BulkOutPipeId], + IrqFlags); pAd->BulkOutPending[BulkOutPipeId] = FALSE; - BULK_OUT_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); + BULK_OUT_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], + IrqFlags); //DBGPRINT(RT_DEBUG_LOUD,("Out:pTxInfo->USBDMATxPktLen=%d!\n", pTxInfo->USBDMATxPktLen)); return; } - - // Increase Total transmit byte counter - pAd->RalinkCounters.OneSecTransmittedByteCount += pTxWI->MPDUtotalByteCount; - pAd->RalinkCounters.TransmittedByteCount += pTxWI->MPDUtotalByteCount; + // Increase Total transmit byte counter + pAd->RalinkCounters.OneSecTransmittedByteCount += + pTxWI->MPDUtotalByteCount; + pAd->RalinkCounters.TransmittedByteCount += + pTxWI->MPDUtotalByteCount; pLastTxInfo = pTxInfo; // Make sure we use EDCA QUEUE. pTxInfo->QSEL = FIFO_EDCA; - ThisBulkSize += (pTxInfo->USBDMATxPktLen+4); - TmpBulkEndPos += (pTxInfo->USBDMATxPktLen+4); + ThisBulkSize += (pTxInfo->USBDMATxPktLen + 4); + TmpBulkEndPos += (pTxInfo->USBDMATxPktLen + 4); if (TmpBulkEndPos != pHTTXContext->CurWritePosition) pTxInfo->USBDMANextVLD = 1; - if (pTxInfo->SwUseLastRound == 1) - { + if (pTxInfo->SwUseLastRound == 1) { if (pHTTXContext->CurWritePosition == 8) pTxInfo->USBDMANextVLD = 0; pTxInfo->SwUseLastRound = 0; @@ -371,73 +395,90 @@ VOID RTUSBBulkOutDataPacket( bTxQLastRound = TRUE; pHTTXContext->ENextBulkOutPosition = 8; - break; } - - }while (TRUE); + } while (TRUE); // adjust the pTxInfo->USBDMANextVLD value of last pTxInfo. - if (pLastTxInfo) - { + if (pLastTxInfo) { pLastTxInfo->USBDMANextVLD = 0; } /* - We need to copy SavedPad when following condition matched! - 1. Not the last round of the TxQueue and - 2. any match of following cases: - (1). The End Position of this bulk out is reach to the Currenct Write position and - the TxInfo and related header already write to the CurWritePosition. - =>(ENextBulkOutPosition == CurWritePosition) && (CurWriteRealPos > CurWritePosition) - - (2). The EndPosition of the bulk out is not reach to the Current Write Position. - =>(ENextBulkOutPosition != CurWritePosition) - */ + We need to copy SavedPad when following condition matched! + 1. Not the last round of the TxQueue and + 2. any match of following cases: + (1). The End Position of this bulk out is reach to the Currenct Write position and + the TxInfo and related header already write to the CurWritePosition. + =>(ENextBulkOutPosition == CurWritePosition) && (CurWriteRealPos > CurWritePosition) + + (2). The EndPosition of the bulk out is not reach to the Current Write Position. + =>(ENextBulkOutPosition != CurWritePosition) + */ if ((bTxQLastRound == FALSE) && - (((pHTTXContext->ENextBulkOutPosition == pHTTXContext->CurWritePosition) && (pHTTXContext->CurWriteRealPos > pHTTXContext->CurWritePosition)) || - (pHTTXContext->ENextBulkOutPosition != pHTTXContext->CurWritePosition)) - ) - { - NdisMoveMemory(pHTTXContext->SavedPad, &pWirelessPkt[pHTTXContext->ENextBulkOutPosition], 8); + (((pHTTXContext->ENextBulkOutPosition == + pHTTXContext->CurWritePosition) + && (pHTTXContext->CurWriteRealPos > + pHTTXContext->CurWritePosition)) + || (pHTTXContext->ENextBulkOutPosition != + pHTTXContext->CurWritePosition)) + ) { + NdisMoveMemory(pHTTXContext->SavedPad, + &pWirelessPkt[pHTTXContext-> + ENextBulkOutPosition], 8); pHTTXContext->bCopySavePad = TRUE; - if (RTMPEqualMemory(pHTTXContext->SavedPad, allzero,4)) - { - PUCHAR pBuf = &pHTTXContext->SavedPad[0]; - DBGPRINT_RAW(RT_DEBUG_ERROR,("WARNING-Zero-3:%02x%02x%02x%02x%02x%02x%02x%02x,CWPos=%ld, CWRPos=%ld, bCW=%d, NBPos=%ld, TBPos=%ld, TBSize=%ld\n", - pBuf[0], pBuf[1], pBuf[2],pBuf[3],pBuf[4], pBuf[5], pBuf[6],pBuf[7], pHTTXContext->CurWritePosition, pHTTXContext->CurWriteRealPos, - pHTTXContext->bCurWriting, pHTTXContext->NextBulkOutPosition, TmpBulkEndPos, ThisBulkSize)); + if (RTMPEqualMemory(pHTTXContext->SavedPad, allzero, 4)) { + PUCHAR pBuf = &pHTTXContext->SavedPad[0]; + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("WARNING-Zero-3:%02x%02x%02x%02x%02x%02x%02x%02x,CWPos=%ld, CWRPos=%ld, bCW=%d, NBPos=%ld, TBPos=%ld, TBSize=%ld\n", + pBuf[0], pBuf[1], pBuf[2], pBuf[3], + pBuf[4], pBuf[5], pBuf[6], pBuf[7], + pHTTXContext->CurWritePosition, + pHTTXContext->CurWriteRealPos, + pHTTXContext->bCurWriting, + pHTTXContext->NextBulkOutPosition, + TmpBulkEndPos, ThisBulkSize)); pBuf = &pWirelessPkt[pHTTXContext->CurWritePosition]; - DBGPRINT_RAW(RT_DEBUG_ERROR,("\tCWPos=%02x%02x%02x%02x%02x%02x%02x%02x\n", pBuf[0], pBuf[1], pBuf[2],pBuf[3],pBuf[4], pBuf[5], pBuf[6],pBuf[7])); + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("\tCWPos=%02x%02x%02x%02x%02x%02x%02x%02x\n", + pBuf[0], pBuf[1], pBuf[2], pBuf[3], + pBuf[4], pBuf[5], pBuf[6], pBuf[7])); } //DBGPRINT(RT_DEBUG_LOUD,("ENPos==CWPos=%ld, CWRPos=%ld, bCSPad=%d!\n", pHTTXContext->CurWritePosition, pHTTXContext->CurWriteRealPos, pHTTXContext->bCopySavePad)); } if (pAd->bForcePrintTX == TRUE) - DBGPRINT(RT_DEBUG_TRACE,("BulkOut-A:Size=%ld, CWPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", ThisBulkSize, pHTTXContext->CurWritePosition, pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad)); + DBGPRINT(RT_DEBUG_TRACE, + ("BulkOut-A:Size=%ld, CWPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", + ThisBulkSize, pHTTXContext->CurWritePosition, + pHTTXContext->NextBulkOutPosition, + pHTTXContext->ENextBulkOutPosition, + pHTTXContext->bCopySavePad)); //DBGPRINT(RT_DEBUG_LOUD,("BulkOut-A:Size=%ld, CWPos=%ld, CWRPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d, bLRound=%d!\n", ThisBulkSize, pHTTXContext->CurWritePosition, pHTTXContext->CurWriteRealPos, pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad, bTxQLastRound)); - // USB DMA engine requires to pad extra 4 bytes. This pad doesn't count into real bulkoutsize. + // USB DMA engine requires to pad extra 4 bytes. This pad doesn't count into real bulkoutsize. pAppendant = &pWirelessPkt[TmpBulkEndPos]; NdisZeroMemory(pAppendant, 8); + ThisBulkSize += 4; + pHTTXContext->LastOne = TRUE; + if ((ThisBulkSize % pAd->BulkOutMaxPacketSize) == 0) ThisBulkSize += 4; - pHTTXContext->LastOne = TRUE; - if ((ThisBulkSize % pAd->BulkOutMaxPacketSize) == 0) - ThisBulkSize += 4; pHTTXContext->BulkOutSize = ThisBulkSize; pAd->watchDogTxPendingCnt[BulkOutPipeId] = 1; BULK_OUT_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags2); // Init Tx context descriptor - RTUSBInitHTTxDesc(pAd, pHTTXContext, BulkOutPipeId, ThisBulkSize, (usb_complete_t)RTUSBBulkOutDataPacketComplete); + RTUSBInitHTTxDesc(pAd, pHTTXContext, BulkOutPipeId, ThisBulkSize, + (usb_complete_t) RTUSBBulkOutDataPacketComplete); pUrb = pHTTXContext->pUrb; - if((ret = RTUSB_SUBMIT_URB(pUrb))!=0) - { - DBGPRINT(RT_DEBUG_ERROR, ("RTUSBBulkOutDataPacket: Submit Tx URB failed %d\n", ret)); + if ((ret = RTUSB_SUBMIT_URB(pUrb)) != 0) { + DBGPRINT(RT_DEBUG_ERROR, + ("RTUSBBulkOutDataPacket: Submit Tx URB failed %d\n", + ret)); BULK_OUT_LOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); pAd->BulkOutPending[BulkOutPipeId] = FALSE; @@ -454,47 +495,42 @@ VOID RTUSBBulkOutDataPacket( } - -VOID RTUSBBulkOutDataPacketComplete(purbb_t pUrb, struct pt_regs *pt_regs) +VOID RTUSBBulkOutDataPacketComplete(purbb_t pUrb, struct pt_regs * pt_regs) { - PHT_TX_CONTEXT pHTTXContext; - PRTMP_ADAPTER pAd; - POS_COOKIE pObj; - UCHAR BulkOutPipeId; + PHT_TX_CONTEXT pHTTXContext; + PRTMP_ADAPTER pAd; + POS_COOKIE pObj; + UCHAR BulkOutPipeId; - - pHTTXContext = (PHT_TX_CONTEXT)pUrb->context; - pAd = pHTTXContext->pAd; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; + pAd = pHTTXContext->pAd; + pObj = (POS_COOKIE) pAd->OS_Cookie; // Store BulkOut PipeId - BulkOutPipeId = pHTTXContext->BulkOutPipeId; + BulkOutPipeId = pHTTXContext->BulkOutPipeId; pAd->BulkOutDataOneSecCount++; - switch (BulkOutPipeId) - { - case 0: - pObj->ac0_dma_done_task.data = (unsigned long)pUrb; - tasklet_hi_schedule(&pObj->ac0_dma_done_task); - break; - case 1: - pObj->ac1_dma_done_task.data = (unsigned long)pUrb; - tasklet_hi_schedule(&pObj->ac1_dma_done_task); - break; - case 2: - pObj->ac2_dma_done_task.data = (unsigned long)pUrb; - tasklet_hi_schedule(&pObj->ac2_dma_done_task); - break; - case 3: - pObj->ac3_dma_done_task.data = (unsigned long)pUrb; - tasklet_hi_schedule(&pObj->ac3_dma_done_task); - break; + switch (BulkOutPipeId) { + case 0: + pObj->ac0_dma_done_task.data = (unsigned long)pUrb; + tasklet_hi_schedule(&pObj->ac0_dma_done_task); + break; + case 1: + pObj->ac1_dma_done_task.data = (unsigned long)pUrb; + tasklet_hi_schedule(&pObj->ac1_dma_done_task); + break; + case 2: + pObj->ac2_dma_done_task.data = (unsigned long)pUrb; + tasklet_hi_schedule(&pObj->ac2_dma_done_task); + break; + case 3: + pObj->ac3_dma_done_task.data = (unsigned long)pUrb; + tasklet_hi_schedule(&pObj->ac3_dma_done_task); + break; } - } - /* ======================================================================== @@ -508,17 +544,16 @@ VOID RTUSBBulkOutDataPacketComplete(purbb_t pUrb, struct pt_regs *pt_regs) ======================================================================== */ -VOID RTUSBBulkOutNullFrame( - IN PRTMP_ADAPTER pAd) +VOID RTUSBBulkOutNullFrame(IN PRTMP_ADAPTER pAd) { - PTX_CONTEXT pNullContext = &(pAd->NullContext); - PURB pUrb; - int ret = 0; - unsigned long IrqFlags; + PTX_CONTEXT pNullContext = &(pAd->NullContext); + PURB pUrb; + int ret = 0; + unsigned long IrqFlags; RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], IrqFlags); - if ((pAd->BulkOutPending[0] == TRUE) || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NEED_STOP_TX)) - { + if ((pAd->BulkOutPending[0] == TRUE) + || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NEED_STOP_TX)) { RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], IrqFlags); return; } @@ -528,42 +563,42 @@ VOID RTUSBBulkOutNullFrame( RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], IrqFlags); // Increase Total transmit byte counter - pAd->RalinkCounters.TransmittedByteCount += pNullContext->BulkOutSize; - + pAd->RalinkCounters.TransmittedByteCount += pNullContext->BulkOutSize; // Clear Null frame bulk flag RTUSB_CLEAR_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NULL); // Init Tx context descriptor - RTUSBInitTxDesc(pAd, pNullContext, 0, (usb_complete_t)RTUSBBulkOutNullFrameComplete); + RTUSBInitTxDesc(pAd, pNullContext, 0, + (usb_complete_t) RTUSBBulkOutNullFrameComplete); pUrb = pNullContext->pUrb; - if((ret = RTUSB_SUBMIT_URB(pUrb))!=0) - { + if ((ret = RTUSB_SUBMIT_URB(pUrb)) != 0) { RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], IrqFlags); pAd->BulkOutPending[0] = FALSE; pAd->watchDogTxPendingCnt[0] = 0; pNullContext->IRPPending = FALSE; RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], IrqFlags); - DBGPRINT(RT_DEBUG_ERROR, ("RTUSBBulkOutNullFrame: Submit Tx URB failed %d\n", ret)); + DBGPRINT(RT_DEBUG_ERROR, + ("RTUSBBulkOutNullFrame: Submit Tx URB failed %d\n", + ret)); return; } } // NULL frame use BulkOutPipeId = 0 -VOID RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs) +VOID RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs * pt_regs) { - PRTMP_ADAPTER pAd; - PTX_CONTEXT pNullContext; - NTSTATUS Status; - POS_COOKIE pObj; - + PRTMP_ADAPTER pAd; + PTX_CONTEXT pNullContext; + NTSTATUS Status; + POS_COOKIE pObj; - pNullContext = (PTX_CONTEXT)pUrb->context; - pAd = pNullContext->pAd; - Status = pUrb->status; + pNullContext = (PTX_CONTEXT) pUrb->context; + pAd = pNullContext->pAd; + Status = pUrb->status; pObj = (POS_COOKIE) pAd->OS_Cookie; pObj->null_frame_complete_task.data = (unsigned long)pUrb; @@ -583,23 +618,20 @@ VOID RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs) ======================================================================== */ -VOID RTUSBBulkOutMLMEPacket( - IN PRTMP_ADAPTER pAd, - IN UCHAR Index) +VOID RTUSBBulkOutMLMEPacket(IN PRTMP_ADAPTER pAd, IN UCHAR Index) { - PTX_CONTEXT pMLMEContext; - PURB pUrb; - int ret = 0; - unsigned long IrqFlags; + PTX_CONTEXT pMLMEContext; + PURB pUrb; + int ret = 0; + unsigned long IrqFlags; - pMLMEContext = (PTX_CONTEXT)pAd->MgmtRing.Cell[pAd->MgmtRing.TxDmaIdx].AllocVa; + pMLMEContext = + (PTX_CONTEXT) pAd->MgmtRing.Cell[pAd->MgmtRing.TxDmaIdx].AllocVa; pUrb = pMLMEContext->pUrb; if ((pAd->MgmtRing.TxSwFreeIdx >= MGMT_RING_SIZE) || - (pMLMEContext->InUse == FALSE) || - (pMLMEContext->bWaitingBulkOut == FALSE)) - { - + (pMLMEContext->InUse == FALSE) || + (pMLMEContext->bWaitingBulkOut == FALSE)) { // Clear MLME bulk flag RTUSB_CLEAR_BULK_FLAG(pAd, fRTUSB_BULK_OUT_MLME); @@ -607,10 +639,9 @@ VOID RTUSBBulkOutMLMEPacket( return; } - RTMP_IRQ_LOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags); - if ((pAd->BulkOutPending[MGMTPIPEIDX] == TRUE) || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NEED_STOP_TX)) - { + if ((pAd->BulkOutPending[MGMTPIPEIDX] == TRUE) + || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NEED_STOP_TX)) { RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags); return; } @@ -622,22 +653,24 @@ VOID RTUSBBulkOutMLMEPacket( RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags); // Increase Total transmit byte counter - pAd->RalinkCounters.TransmittedByteCount += pMLMEContext->BulkOutSize; + pAd->RalinkCounters.TransmittedByteCount += pMLMEContext->BulkOutSize; // Clear MLME bulk flag RTUSB_CLEAR_BULK_FLAG(pAd, fRTUSB_BULK_OUT_MLME); // Init Tx context descriptor - RTUSBInitTxDesc(pAd, pMLMEContext, MGMTPIPEIDX, (usb_complete_t)RTUSBBulkOutMLMEPacketComplete); + RTUSBInitTxDesc(pAd, pMLMEContext, MGMTPIPEIDX, + (usb_complete_t) RTUSBBulkOutMLMEPacketComplete); //For mgmt urb buffer, because we use sk_buff, so we need to notify the USB controller do dma mapping. - pUrb->transfer_dma = 0; + pUrb->transfer_dma = 0; pUrb->transfer_flags &= (~URB_NO_TRANSFER_DMA_MAP); pUrb = pMLMEContext->pUrb; - if((ret = RTUSB_SUBMIT_URB(pUrb))!=0) - { - DBGPRINT(RT_DEBUG_ERROR, ("RTUSBBulkOutMLMEPacket: Submit MLME URB failed %d\n", ret)); + if ((ret = RTUSB_SUBMIT_URB(pUrb)) != 0) { + DBGPRINT(RT_DEBUG_ERROR, + ("RTUSBBulkOutMLMEPacket: Submit MLME URB failed %d\n", + ret)); RTMP_IRQ_LOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags); pAd->BulkOutPending[MGMTPIPEIDX] = FALSE; pAd->watchDogTxPendingCnt[MGMTPIPEIDX] = 0; @@ -647,32 +680,29 @@ VOID RTUSBBulkOutMLMEPacket( return; } - //DBGPRINT_RAW(RT_DEBUG_INFO, ("<---RTUSBBulkOutMLMEPacket \n")); -// printk("<---RTUSBBulkOutMLMEPacket,Cpu=%d!, Dma=%d, SwIdx=%d!\n", pAd->MgmtRing.TxCpuIdx, pAd->MgmtRing.TxDmaIdx, pAd->MgmtRing.TxSwFreeIdx); +// printk("<---RTUSBBulkOutMLMEPacket,Cpu=%d!, Dma=%d, SwIdx=%d!\n", pAd->MgmtRing.TxCpuIdx, pAd->MgmtRing.TxDmaIdx, pAd->MgmtRing.TxSwFreeIdx); } - -VOID RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs *pt_regs) +VOID RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs * pt_regs) { - PTX_CONTEXT pMLMEContext; - PRTMP_ADAPTER pAd; - NTSTATUS Status; - POS_COOKIE pObj; - int index; + PTX_CONTEXT pMLMEContext; + PRTMP_ADAPTER pAd; + NTSTATUS Status; + POS_COOKIE pObj; + int index; //DBGPRINT_RAW(RT_DEBUG_INFO, ("--->RTUSBBulkOutMLMEPacketComplete\n")); - pMLMEContext = (PTX_CONTEXT)pUrb->context; - pAd = pMLMEContext->pAd; - pObj = (POS_COOKIE)pAd->OS_Cookie; - Status = pUrb->status; - index = pMLMEContext->SelfIdx; + pMLMEContext = (PTX_CONTEXT) pUrb->context; + pAd = pMLMEContext->pAd; + pObj = (POS_COOKIE) pAd->OS_Cookie; + Status = pUrb->status; + index = pMLMEContext->SelfIdx; pObj->mgmt_dma_done_task.data = (unsigned long)pUrb; tasklet_hi_schedule(&pObj->mgmt_dma_done_task); } - /* ======================================================================== @@ -686,17 +716,16 @@ VOID RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs *pt_regs) ======================================================================== */ -VOID RTUSBBulkOutPsPoll( - IN PRTMP_ADAPTER pAd) +VOID RTUSBBulkOutPsPoll(IN PRTMP_ADAPTER pAd) { - PTX_CONTEXT pPsPollContext = &(pAd->PsPollContext); - PURB pUrb; - int ret = 0; - unsigned long IrqFlags; + PTX_CONTEXT pPsPollContext = &(pAd->PsPollContext); + PURB pUrb; + int ret = 0; + unsigned long IrqFlags; RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], IrqFlags); - if ((pAd->BulkOutPending[0] == TRUE) || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NEED_STOP_TX)) - { + if ((pAd->BulkOutPending[0] == TRUE) + || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NEED_STOP_TX)) { RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], IrqFlags); return; } @@ -705,38 +734,38 @@ VOID RTUSBBulkOutPsPoll( pPsPollContext->IRPPending = TRUE; RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], IrqFlags); - // Clear PS-Poll bulk flag RTUSB_CLEAR_BULK_FLAG(pAd, fRTUSB_BULK_OUT_PSPOLL); // Init Tx context descriptor - RTUSBInitTxDesc(pAd, pPsPollContext, MGMTPIPEIDX, (usb_complete_t)RTUSBBulkOutPsPollComplete); + RTUSBInitTxDesc(pAd, pPsPollContext, MGMTPIPEIDX, + (usb_complete_t) RTUSBBulkOutPsPollComplete); pUrb = pPsPollContext->pUrb; - if((ret = RTUSB_SUBMIT_URB(pUrb))!=0) - { + if ((ret = RTUSB_SUBMIT_URB(pUrb)) != 0) { RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], IrqFlags); pAd->BulkOutPending[0] = FALSE; pAd->watchDogTxPendingCnt[0] = 0; pPsPollContext->IRPPending = FALSE; RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], IrqFlags); - DBGPRINT(RT_DEBUG_ERROR, ("RTUSBBulkOutPsPoll: Submit Tx URB failed %d\n", ret)); + DBGPRINT(RT_DEBUG_ERROR, + ("RTUSBBulkOutPsPoll: Submit Tx URB failed %d\n", + ret)); return; } } // PS-Poll frame use BulkOutPipeId = 0 -VOID RTUSBBulkOutPsPollComplete(purbb_t pUrb,struct pt_regs *pt_regs) +VOID RTUSBBulkOutPsPollComplete(purbb_t pUrb, struct pt_regs * pt_regs) { - PRTMP_ADAPTER pAd; - PTX_CONTEXT pPsPollContext; - NTSTATUS Status; - POS_COOKIE pObj; - + PRTMP_ADAPTER pAd; + PTX_CONTEXT pPsPollContext; + NTSTATUS Status; + POS_COOKIE pObj; - pPsPollContext= (PTX_CONTEXT)pUrb->context; + pPsPollContext = (PTX_CONTEXT) pUrb->context; pAd = pPsPollContext->pAd; Status = pUrb->status; @@ -745,17 +774,17 @@ VOID RTUSBBulkOutPsPollComplete(purbb_t pUrb,struct pt_regs *pt_regs) tasklet_hi_schedule(&pObj->pspoll_frame_complete_task); } -VOID DoBulkIn(IN RTMP_ADAPTER *pAd) +VOID DoBulkIn(IN RTMP_ADAPTER * pAd) { - PRX_CONTEXT pRxContext; - PURB pUrb; - int ret = 0; - unsigned long IrqFlags; + PRX_CONTEXT pRxContext; + PURB pUrb; + int ret = 0; + unsigned long IrqFlags; RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags); pRxContext = &(pAd->RxContext[pAd->NextRxBulkInIndex]); - if ((pAd->PendingRx > 0) || (pRxContext->Readable == TRUE) || (pRxContext->InUse == TRUE)) - { + if ((pAd->PendingRx > 0) || (pRxContext->Readable == TRUE) + || (pRxContext->InUse == TRUE)) { RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); return; } @@ -770,8 +799,7 @@ VOID DoBulkIn(IN RTMP_ADAPTER *pAd) RTUSBInitRxDesc(pAd, pRxContext); pUrb = pRxContext->pUrb; - if ((ret = RTUSB_SUBMIT_URB(pUrb))!=0) - { // fail + if ((ret = RTUSB_SUBMIT_URB(pUrb)) != 0) { // fail RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags); pRxContext->InUse = FALSE; @@ -779,16 +807,14 @@ VOID DoBulkIn(IN RTMP_ADAPTER *pAd) pAd->PendingRx--; pAd->BulkInReq--; RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); - DBGPRINT(RT_DEBUG_ERROR, ("RTUSBBulkReceive: Submit Rx URB failed %d\n", ret)); - } - else - { // success + DBGPRINT(RT_DEBUG_ERROR, + ("RTUSBBulkReceive: Submit Rx URB failed %d\n", ret)); + } else { // success ASSERT((pRxContext->InUse == pRxContext->IRPPending)); //printk("BIDone, Pend=%d,BIIdx=%d,BIRIdx=%d!\n", pAd->PendingRx, pAd->NextRxBulkInIndex, pAd->NextRxBulkInReadIndex); } } - /* ======================================================================== @@ -819,25 +845,22 @@ VOID DoBulkIn(IN RTMP_ADAPTER *pAd) fRTMP_ADAPTER_RADIO_OFF | fRTMP_ADAPTER_RESET_IN_PROGRESS | \ fRTMP_ADAPTER_REMOVE_IN_PROGRESS) -VOID RTUSBBulkReceive( - IN PRTMP_ADAPTER pAd) +VOID RTUSBBulkReceive(IN PRTMP_ADAPTER pAd) { - PRX_CONTEXT pRxContext; - unsigned long IrqFlags; - + PRX_CONTEXT pRxContext; + unsigned long IrqFlags; /* sanity check */ if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NEED_STOP_HANDLE_RX)) return; - while(1) - { + while (1) { RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags); pRxContext = &(pAd->RxContext[pAd->NextRxBulkInReadIndex]); - if (((pRxContext->InUse == FALSE) && (pRxContext->Readable == TRUE)) && - (pRxContext->bRxHandling == FALSE)) - { + if (((pRxContext->InUse == FALSE) + && (pRxContext->Readable == TRUE)) + && (pRxContext->bRxHandling == FALSE)) { pRxContext->bRxHandling = TRUE; RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); @@ -851,12 +874,11 @@ VOID RTUSBBulkReceive( pRxContext->bRxHandling = FALSE; pAd->ReadPosition = 0; pAd->TransferBufferLength = 0; - INC_RING_INDEX(pAd->NextRxBulkInReadIndex, RX_RING_SIZE); + INC_RING_INDEX(pAd->NextRxBulkInReadIndex, + RX_RING_SIZE); RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); - } - else - { + } else { RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); break; } @@ -867,7 +889,6 @@ VOID RTUSBBulkReceive( } - /* ======================================================================== @@ -896,22 +917,19 @@ VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs) // use a receive tasklet to handle received packets; // or sometimes hardware IRQ will be disabled here, so we can not // use spin_lock_bh()/spin_unlock_bh() after IRQ is disabled. :< - PRX_CONTEXT pRxContext; - PRTMP_ADAPTER pAd; - POS_COOKIE pObj; + PRX_CONTEXT pRxContext; + PRTMP_ADAPTER pAd; + POS_COOKIE pObj; - - pRxContext = (PRX_CONTEXT)pUrb->context; - pAd = pRxContext->pAd; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pRxContext = (PRX_CONTEXT) pUrb->context; + pAd = pRxContext->pAd; + pObj = (POS_COOKIE) pAd->OS_Cookie; pObj->rx_done_task.data = (unsigned long)pUrb; tasklet_hi_schedule(&pObj->rx_done_task); } - - /* ======================================================================== @@ -925,76 +943,78 @@ VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs) ======================================================================== */ -VOID RTUSBKickBulkOut( - IN PRTMP_ADAPTER pAd) +VOID RTUSBKickBulkOut(IN PRTMP_ADAPTER pAd) { // BulkIn Reset will reset whole USB PHY. So we need to make sure fRTMP_ADAPTER_BULKIN_RESET not flaged. - if (!RTMP_TEST_FLAG(pAd ,fRTMP_ADAPTER_NEED_STOP_TX) - ) - { + if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NEED_STOP_TX) + ) { // 2. PS-Poll frame is next - if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_PSPOLL)) - { + if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_PSPOLL)) { RTUSBBulkOutPsPoll(pAd); } - // 5. Mlme frame is next else if ((RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_MLME)) || - (pAd->MgmtRing.TxSwFreeIdx < MGMT_RING_SIZE)) - { + (pAd->MgmtRing.TxSwFreeIdx < MGMT_RING_SIZE)) { RTUSBBulkOutMLMEPacket(pAd, pAd->MgmtRing.TxDmaIdx); } - // 6. Data frame normal is next - if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL)) - { - if (((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) || - (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - )) - { - RTUSBBulkOutDataPacket(pAd, 0, pAd->NextBulkOutIndex[0]); + if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL)) { + if (((!RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) + || + (!OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) + )) { + RTUSBBulkOutDataPacket(pAd, 0, + pAd-> + NextBulkOutIndex[0]); } } - if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL_2)) - { - if (((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) || - (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - )) - { - RTUSBBulkOutDataPacket(pAd, 1, pAd->NextBulkOutIndex[1]); + if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL_2)) { + if (((!RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) + || + (!OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) + )) { + RTUSBBulkOutDataPacket(pAd, 1, + pAd-> + NextBulkOutIndex[1]); } } - if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL_3)) - { - if (((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) || - (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - )) - { - RTUSBBulkOutDataPacket(pAd, 2, pAd->NextBulkOutIndex[2]); + if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL_3)) { + if (((!RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) + || + (!OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) + )) { + RTUSBBulkOutDataPacket(pAd, 2, + pAd-> + NextBulkOutIndex[2]); } } - if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL_4)) - { - if (((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) || - (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - )) - { - RTUSBBulkOutDataPacket(pAd, 3, pAd->NextBulkOutIndex[3]); + if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL_4)) { + if (((!RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) + || + (!OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) + )) { + RTUSBBulkOutDataPacket(pAd, 3, + pAd-> + NextBulkOutIndex[3]); } } - // 7. Null frame is the last - else if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NULL)) - { - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - { + else if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NULL)) { + if (!RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) { RTUSBBulkOutNullFrame(pAd); } } - // 8. No data avaliable - else - { + else { } } @@ -1013,16 +1033,14 @@ VOID RTUSBKickBulkOut( ======================================================================== */ -VOID RTUSBCleanUpDataBulkOutQueue( - IN PRTMP_ADAPTER pAd) +VOID RTUSBCleanUpDataBulkOutQueue(IN PRTMP_ADAPTER pAd) { - UCHAR Idx; - PHT_TX_CONTEXT pTxContext; + UCHAR Idx; + PHT_TX_CONTEXT pTxContext; DBGPRINT(RT_DEBUG_TRACE, ("--->CleanUpDataBulkOutQueue\n")); - for (Idx = 0; Idx < 4; Idx++) - { + for (Idx = 0; Idx < 4; Idx++) { pTxContext = &pAd->TxContext[Idx]; pTxContext->CurWritePosition = pTxContext->NextBulkOutPosition; @@ -1048,14 +1066,12 @@ VOID RTUSBCleanUpDataBulkOutQueue( ======================================================================== */ -VOID RTUSBCleanUpMLMEBulkOutQueue( - IN PRTMP_ADAPTER pAd) +VOID RTUSBCleanUpMLMEBulkOutQueue(IN PRTMP_ADAPTER pAd) { DBGPRINT(RT_DEBUG_TRACE, ("--->CleanUpMLMEBulkOutQueue\n")); DBGPRINT(RT_DEBUG_TRACE, ("<---CleanUpMLMEBulkOutQueue\n")); } - /* ======================================================================== @@ -1065,13 +1081,11 @@ VOID RTUSBCleanUpMLMEBulkOutQueue( Return Value: - Note: ======================================================================== */ -VOID RTUSBCancelPendingIRPs( - IN PRTMP_ADAPTER pAd) +VOID RTUSBCancelPendingIRPs(IN PRTMP_ADAPTER pAd) { RTUSBCancelPendingBulkInIRP(pAd); RTUSBCancelPendingBulkOutIRP(pAd); @@ -1090,18 +1104,15 @@ VOID RTUSBCancelPendingIRPs( ======================================================================== */ -VOID RTUSBCancelPendingBulkInIRP( - IN PRTMP_ADAPTER pAd) +VOID RTUSBCancelPendingBulkInIRP(IN PRTMP_ADAPTER pAd) { - PRX_CONTEXT pRxContext; - UINT i; + PRX_CONTEXT pRxContext; + UINT i; DBGPRINT_RAW(RT_DEBUG_TRACE, ("--->RTUSBCancelPendingBulkInIRP\n")); - for ( i = 0; i < (RX_RING_SIZE); i++) - { + for (i = 0; i < (RX_RING_SIZE); i++) { pRxContext = &(pAd->RxContext[i]); - if(pRxContext->IRPPending == TRUE) - { + if (pRxContext->IRPPending == TRUE) { RTUSB_UNLINK_URB(pRxContext->pUrb); pRxContext->IRPPending = FALSE; pRxContext->InUse = FALSE; @@ -1112,7 +1123,6 @@ VOID RTUSBCancelPendingBulkInIRP( DBGPRINT_RAW(RT_DEBUG_TRACE, ("<---RTUSBCancelPendingBulkInIRP\n")); } - /* ======================================================================== @@ -1126,34 +1136,30 @@ VOID RTUSBCancelPendingBulkInIRP( ======================================================================== */ -VOID RTUSBCancelPendingBulkOutIRP( - IN PRTMP_ADAPTER pAd) +VOID RTUSBCancelPendingBulkOutIRP(IN PRTMP_ADAPTER pAd) { - PHT_TX_CONTEXT pHTTXContext; - PTX_CONTEXT pMLMEContext; - PTX_CONTEXT pBeaconContext; - PTX_CONTEXT pNullContext; - PTX_CONTEXT pPsPollContext; - PTX_CONTEXT pRTSContext; - UINT i, Idx; -// unsigned int IrqFlags; -// NDIS_SPIN_LOCK *pLock; -// BOOLEAN *pPending; - - -// pLock = &pAd->BulkOutLock[MGMTPIPEIDX]; -// pPending = &pAd->BulkOutPending[MGMTPIPEIDX]; - - for (Idx = 0; Idx < 4; Idx++) - { + PHT_TX_CONTEXT pHTTXContext; + PTX_CONTEXT pMLMEContext; + PTX_CONTEXT pBeaconContext; + PTX_CONTEXT pNullContext; + PTX_CONTEXT pPsPollContext; + PTX_CONTEXT pRTSContext; + UINT i, Idx; +// unsigned int IrqFlags; +// NDIS_SPIN_LOCK *pLock; +// BOOLEAN *pPending; + +// pLock = &pAd->BulkOutLock[MGMTPIPEIDX]; +// pPending = &pAd->BulkOutPending[MGMTPIPEIDX]; + + for (Idx = 0; Idx < 4; Idx++) { pHTTXContext = &(pAd->TxContext[Idx]); - if (pHTTXContext->IRPPending == TRUE) - { + if (pHTTXContext->IRPPending == TRUE) { // Get the USB_CONTEXT and cancel it's IRP; the completion routine will itself // remove it from the HeadPendingSendList and NULL out HeadPendingSendList - // when the last IRP on the list has been cancelled; that's how we exit this loop + // when the last IRP on the list has been cancelled; that's how we exit this loop // RTUSB_UNLINK_URB(pHTTXContext->pUrb); @@ -1166,15 +1172,13 @@ VOID RTUSBCancelPendingBulkOutIRP( } //RTMP_IRQ_LOCK(pLock, IrqFlags); - for (i = 0; i < MGMT_RING_SIZE; i++) - { - pMLMEContext = (PTX_CONTEXT)pAd->MgmtRing.Cell[i].AllocVa; - if(pMLMEContext && (pMLMEContext->IRPPending == TRUE)) - { + for (i = 0; i < MGMT_RING_SIZE; i++) { + pMLMEContext = (PTX_CONTEXT) pAd->MgmtRing.Cell[i].AllocVa; + if (pMLMEContext && (pMLMEContext->IRPPending == TRUE)) { // Get the USB_CONTEXT and cancel it's IRP; the completion routine will itself // remove it from the HeadPendingSendList and NULL out HeadPendingSendList - // when the last IRP on the list has been cancelled; that's how we exit this loop + // when the last IRP on the list has been cancelled; that's how we exit this loop // RTUSB_UNLINK_URB(pMLMEContext->pUrb); @@ -1187,17 +1191,14 @@ VOID RTUSBCancelPendingBulkOutIRP( pAd->BulkOutPending[MGMTPIPEIDX] = FALSE; //RTMP_IRQ_UNLOCK(pLock, IrqFlags); - - for (i = 0; i < BEACON_RING_SIZE; i++) - { + for (i = 0; i < BEACON_RING_SIZE; i++) { pBeaconContext = &(pAd->BeaconContext[i]); - if(pBeaconContext->IRPPending == TRUE) - { + if (pBeaconContext->IRPPending == TRUE) { // Get the USB_CONTEXT and cancel it's IRP; the completion routine will itself // remove it from the HeadPendingSendList and NULL out HeadPendingSendList - // when the last IRP on the list has been cancelled; that's how we exit this loop + // when the last IRP on the list has been cancelled; that's how we exit this loop // RTUSB_UNLINK_URB(pBeaconContext->pUrb); @@ -1219,8 +1220,7 @@ VOID RTUSBCancelPendingBulkOutIRP( if (pPsPollContext->IRPPending == TRUE) RTUSB_UNLINK_URB(pPsPollContext->pUrb); - for (Idx = 0; Idx < 4; Idx++) - { + for (Idx = 0; Idx < 4; Idx++) { NdisAcquireSpinLock(&pAd->BulkOutLock[Idx]); pAd->BulkOutPending[Idx] = FALSE; NdisReleaseSpinLock(&pAd->BulkOutLock[Idx]); diff --git a/drivers/staging/rt2870/common/rtusb_data.c b/drivers/staging/rt2870/common/rtusb_data.c index 807b32a69cec..d662f7fe6b6b 100644 --- a/drivers/staging/rt2870/common/rtusb_data.c +++ b/drivers/staging/rt2870/common/rtusb_data.c @@ -39,40 +39,33 @@ #ifdef RTMP_MAC_USB - #include "../rt_config.h" -extern UCHAR Phy11BGNextRateUpward[]; // defined in mlme.c -extern UCHAR EpToQueue[]; +extern UCHAR Phy11BGNextRateUpward[]; // defined in mlme.c +extern UCHAR EpToQueue[]; -VOID REPORT_AMSDU_FRAMES_TO_LLC( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataSize) +VOID REPORT_AMSDU_FRAMES_TO_LLC(IN PRTMP_ADAPTER pAd, + IN PUCHAR pData, IN ULONG DataSize) { - PNDIS_PACKET pPacket; - UINT nMSDU; - struct sk_buff *pSkb; + PNDIS_PACKET pPacket; + UINT nMSDU; + struct sk_buff *pSkb; nMSDU = 0; /* allocate a rx packet */ pSkb = dev_alloc_skb(RX_BUFFER_AGGRESIZE); - pPacket = (PNDIS_PACKET)OSPKT_TO_RTPKT(pSkb); - if (pSkb) - { + pPacket = (PNDIS_PACKET) OSPKT_TO_RTPKT(pSkb); + if (pSkb) { /* convert 802.11 to 802.3 packet */ pSkb->dev = get_netdev_from_bssid(pAd, BSS0); RTMP_SET_PACKET_SOURCE(pPacket, PKTSRC_NDIS); deaggregate_AMSDU_announce(pAd, pPacket, pData, DataSize); - } - else - { - DBGPRINT(RT_DEBUG_ERROR,("Can't allocate skb\n")); + } else { + DBGPRINT(RT_DEBUG_ERROR, ("Can't allocate skb\n")); } } - /* ======================================================================== @@ -92,50 +85,53 @@ VOID REPORT_AMSDU_FRAMES_TO_LLC( ======================================================================== */ -NDIS_STATUS RTUSBFreeDescriptorRequest( - IN PRTMP_ADAPTER pAd, - IN UCHAR BulkOutPipeId, - IN UINT32 NumberRequired) +NDIS_STATUS RTUSBFreeDescriptorRequest(IN PRTMP_ADAPTER pAd, + IN UCHAR BulkOutPipeId, + IN UINT32 NumberRequired) { -// UCHAR FreeNumber = 0; -// UINT Index; - NDIS_STATUS Status = NDIS_STATUS_FAILURE; - unsigned long IrqFlags; - HT_TX_CONTEXT *pHTTXContext; - +// UCHAR FreeNumber = 0; +// UINT Index; + NDIS_STATUS Status = NDIS_STATUS_FAILURE; + unsigned long IrqFlags; + HT_TX_CONTEXT *pHTTXContext; pHTTXContext = &pAd->TxContext[BulkOutPipeId]; RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); - if ((pHTTXContext->CurWritePosition < pHTTXContext->NextBulkOutPosition) && ((pHTTXContext->CurWritePosition + NumberRequired + LOCAL_TXBUF_SIZE) > pHTTXContext->NextBulkOutPosition)) - { - - RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId)); - } - else if ((pHTTXContext->CurWritePosition == 8) && (pHTTXContext->NextBulkOutPosition < (NumberRequired + LOCAL_TXBUF_SIZE))) - { - RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId)); - } - else if (pHTTXContext->bCurWriting == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE,("RTUSBFreeD c3 --> QueIdx=%d, CWPos=%ld, NBOutPos=%ld!\n", BulkOutPipeId, pHTTXContext->CurWritePosition, pHTTXContext->NextBulkOutPosition)); - RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId)); - } - else - { + if ((pHTTXContext->CurWritePosition < pHTTXContext->NextBulkOutPosition) + && + ((pHTTXContext->CurWritePosition + NumberRequired + + LOCAL_TXBUF_SIZE) > pHTTXContext->NextBulkOutPosition)) { + + RTUSB_SET_BULK_FLAG(pAd, + (fRTUSB_BULK_OUT_DATA_NORMAL << + BulkOutPipeId)); + } else if ((pHTTXContext->CurWritePosition == 8) + && (pHTTXContext->NextBulkOutPosition < + (NumberRequired + LOCAL_TXBUF_SIZE))) { + RTUSB_SET_BULK_FLAG(pAd, + (fRTUSB_BULK_OUT_DATA_NORMAL << + BulkOutPipeId)); + } else if (pHTTXContext->bCurWriting == TRUE) { + DBGPRINT(RT_DEBUG_TRACE, + ("RTUSBFreeD c3 --> QueIdx=%d, CWPos=%ld, NBOutPos=%ld!\n", + BulkOutPipeId, pHTTXContext->CurWritePosition, + pHTTXContext->NextBulkOutPosition)); + RTUSB_SET_BULK_FLAG(pAd, + (fRTUSB_BULK_OUT_DATA_NORMAL << + BulkOutPipeId)); + } else { Status = NDIS_STATUS_SUCCESS; } RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); - return (Status); } -NDIS_STATUS RTUSBFreeDescriptorRelease( - IN RTMP_ADAPTER *pAd, - IN UCHAR BulkOutPipeId) +NDIS_STATUS RTUSBFreeDescriptorRelease(IN RTMP_ADAPTER * pAd, + IN UCHAR BulkOutPipeId) { - unsigned long IrqFlags; - HT_TX_CONTEXT *pHTTXContext; + unsigned long IrqFlags; + HT_TX_CONTEXT *pHTTXContext; pHTTXContext = &pAd->TxContext[BulkOutPipeId]; RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); @@ -145,28 +141,32 @@ NDIS_STATUS RTUSBFreeDescriptorRelease( return (NDIS_STATUS_SUCCESS); } - -BOOLEAN RTUSBNeedQueueBackForAgg( - IN RTMP_ADAPTER *pAd, - IN UCHAR BulkOutPipeId) +BOOLEAN RTUSBNeedQueueBackForAgg(IN RTMP_ADAPTER * pAd, IN UCHAR BulkOutPipeId) { - unsigned long IrqFlags; - HT_TX_CONTEXT *pHTTXContext; - BOOLEAN needQueBack = FALSE; + unsigned long IrqFlags; + HT_TX_CONTEXT *pHTTXContext; + BOOLEAN needQueBack = FALSE; pHTTXContext = &pAd->TxContext[BulkOutPipeId]; RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); - if ((pHTTXContext->IRPPending == TRUE) /*&& (pAd->TxSwQueue[BulkOutPipeId].Number == 0) */) - { - if ((pHTTXContext->CurWritePosition < pHTTXContext->ENextBulkOutPosition) && - (((pHTTXContext->ENextBulkOutPosition+MAX_AGGREGATION_SIZE) < MAX_TXBULK_LIMIT) || (pHTTXContext->CurWritePosition > MAX_AGGREGATION_SIZE))) - { + if ((pHTTXContext->IRPPending == + TRUE) /*&& (pAd->TxSwQueue[BulkOutPipeId].Number == 0) */ ) { + if ((pHTTXContext->CurWritePosition < + pHTTXContext->ENextBulkOutPosition) + && + (((pHTTXContext->ENextBulkOutPosition + + MAX_AGGREGATION_SIZE) < MAX_TXBULK_LIMIT) + || (pHTTXContext->CurWritePosition > + MAX_AGGREGATION_SIZE))) { needQueBack = TRUE; - } - else if ((pHTTXContext->CurWritePosition > pHTTXContext->ENextBulkOutPosition) && - ((pHTTXContext->ENextBulkOutPosition + MAX_AGGREGATION_SIZE) < pHTTXContext->CurWritePosition)) - { + } else + if ((pHTTXContext->CurWritePosition > + pHTTXContext->ENextBulkOutPosition) + && + ((pHTTXContext->ENextBulkOutPosition + + MAX_AGGREGATION_SIZE) < + pHTTXContext->CurWritePosition)) { needQueBack = TRUE; } } @@ -176,7 +176,6 @@ BOOLEAN RTUSBNeedQueueBackForAgg( } - /* ======================================================================== @@ -192,21 +191,17 @@ BOOLEAN RTUSBNeedQueueBackForAgg( ======================================================================== */ -VOID RTUSBRejectPendingPackets( - IN PRTMP_ADAPTER pAd) +VOID RTUSBRejectPendingPackets(IN PRTMP_ADAPTER pAd) { - UCHAR Index; - PQUEUE_ENTRY pEntry; - PNDIS_PACKET pPacket; - PQUEUE_HEADER pQueue; + UCHAR Index; + PQUEUE_ENTRY pEntry; + PNDIS_PACKET pPacket; + PQUEUE_HEADER pQueue; - - for (Index = 0; Index < 4; Index++) - { + for (Index = 0; Index < 4; Index++) { NdisAcquireSpinLock(&pAd->TxSwQueueLock[Index]); - while (pAd->TxSwQueue[Index].Head != NULL) - { - pQueue = (PQUEUE_HEADER) &(pAd->TxSwQueue[Index]); + while (pAd->TxSwQueue[Index].Head != NULL) { + pQueue = (PQUEUE_HEADER) & (pAd->TxSwQueue[Index]); pEntry = RemoveHeadQueue(pQueue); pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); @@ -217,7 +212,6 @@ VOID RTUSBRejectPendingPackets( } - /* ======================================================================== @@ -246,21 +240,18 @@ VOID RTUSBRejectPendingPackets( ======================================================================== */ - -VOID RTMPWriteTxInfo( - IN PRTMP_ADAPTER pAd, - IN PTXINFO_STRUC pTxInfo, - IN USHORT USBDMApktLen, - IN BOOLEAN bWiv, - IN UCHAR QueueSel, - IN UCHAR NextValid, - IN UCHAR TxBurst) +VOID RTMPWriteTxInfo(IN PRTMP_ADAPTER pAd, + IN PTXINFO_STRUC pTxInfo, + IN USHORT USBDMApktLen, + IN BOOLEAN bWiv, + IN UCHAR QueueSel, IN UCHAR NextValid, IN UCHAR TxBurst) { pTxInfo->USBDMATxPktLen = USBDMApktLen; pTxInfo->QSEL = QueueSel; if (QueueSel != FIFO_EDCA) - DBGPRINT(RT_DEBUG_TRACE, ("====> QueueSel != FIFO_EDCA<============\n")); - pTxInfo->USBDMANextVLD = FALSE; //NextValid; // Need to check with Jan about this. + DBGPRINT(RT_DEBUG_TRACE, + ("====> QueueSel != FIFO_EDCA<============\n")); + pTxInfo->USBDMANextVLD = FALSE; //NextValid; // Need to check with Jan about this. pTxInfo->USBDMATxburst = TxBurst; pTxInfo->WIV = bWiv; pTxInfo->SwUseLastRound = 0; diff --git a/drivers/staging/rt2870/common/rtusb_io.c b/drivers/staging/rt2870/common/rtusb_io.c index b01a24ac251c..9a32bc859c6b 100644 --- a/drivers/staging/rt2870/common/rtusb_io.c +++ b/drivers/staging/rt2870/common/rtusb_io.c @@ -38,10 +38,8 @@ #ifdef RTMP_MAC_USB - #include "../rt_config.h" - /* ======================================================================== @@ -58,26 +56,18 @@ ======================================================================== */ -static NTSTATUS RTUSBFirmwareRun( - IN PRTMP_ADAPTER pAd) +static NTSTATUS RTUSBFirmwareRun(IN PRTMP_ADAPTER pAd) { - NTSTATUS Status; - - Status = RTUSB_VendorRequest( - pAd, - USBD_TRANSFER_DIRECTION_OUT, - DEVICE_VENDOR_REQUEST_OUT, - 0x01, - 0x8, - 0, - NULL, - 0); + NTSTATUS Status; + + Status = RTUSB_VendorRequest(pAd, + USBD_TRANSFER_DIRECTION_OUT, + DEVICE_VENDOR_REQUEST_OUT, + 0x01, 0x8, 0, NULL, 0); return Status; } - - /* ======================================================================== @@ -93,19 +83,16 @@ static NTSTATUS RTUSBFirmwareRun( ======================================================================== */ -NTSTATUS RTUSBFirmwareWrite( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pFwImage, - IN ULONG FwLen) +NTSTATUS RTUSBFirmwareWrite(IN PRTMP_ADAPTER pAd, + IN PUCHAR pFwImage, IN ULONG FwLen) { - UINT32 MacReg; - NTSTATUS Status; -// ULONG i; - USHORT writeLen; + UINT32 MacReg; + NTSTATUS Status; +// ULONG i; + USHORT writeLen; Status = RTUSBReadMACRegister(pAd, MAC_CSR0, &MacReg); - writeLen = FwLen; RTUSBMultiWrite(pAd, FIRMWARE_IMAGE_BASE, pFwImage, writeLen); @@ -115,32 +102,26 @@ NTSTATUS RTUSBFirmwareWrite( //2008/11/28:KH add to fix the dead rf frequency offset bug<-- RTMPusecDelay(10000); - RTUSBWriteMACRegister(pAd,H2M_MAILBOX_CSR,0); - AsicSendCommandToMcu(pAd, 0x72, 0x00, 0x00, 0x00); //reset rf by MCU supported by new firmware + RTUSBWriteMACRegister(pAd, H2M_MAILBOX_CSR, 0); + AsicSendCommandToMcu(pAd, 0x72, 0x00, 0x00, 0x00); //reset rf by MCU supported by new firmware //2008/11/28:KH add to fix the dead rf frequency offset bug--> return Status; } - -NTSTATUS RTUSBVenderReset( - IN PRTMP_ADAPTER pAd) +NTSTATUS RTUSBVenderReset(IN PRTMP_ADAPTER pAd) { - NTSTATUS Status; + NTSTATUS Status; DBGPRINT_RAW(RT_DEBUG_ERROR, ("-->RTUSBVenderReset\n")); - Status = RTUSB_VendorRequest( - pAd, - USBD_TRANSFER_DIRECTION_OUT, - DEVICE_VENDOR_REQUEST_OUT, - 0x01, - 0x1, - 0, - NULL, - 0); + Status = RTUSB_VendorRequest(pAd, + USBD_TRANSFER_DIRECTION_OUT, + DEVICE_VENDOR_REQUEST_OUT, + 0x01, 0x1, 0, NULL, 0); DBGPRINT_RAW(RT_DEBUG_ERROR, ("<--RTUSBVenderReset\n")); return Status; } + /* ======================================================================== @@ -156,23 +137,16 @@ NTSTATUS RTUSBVenderReset( ======================================================================== */ -NTSTATUS RTUSBMultiRead( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - OUT PUCHAR pData, - IN USHORT length) +NTSTATUS RTUSBMultiRead(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, OUT PUCHAR pData, IN USHORT length) { - NTSTATUS Status; - - Status = RTUSB_VendorRequest( - pAd, - (USBD_TRANSFER_DIRECTION_IN | USBD_SHORT_TRANSFER_OK), - DEVICE_VENDOR_REQUEST_IN, - 0x7, - 0, - Offset, - pData, - length); + NTSTATUS Status; + + Status = RTUSB_VendorRequest(pAd, + (USBD_TRANSFER_DIRECTION_IN | + USBD_SHORT_TRANSFER_OK), + DEVICE_VENDOR_REQUEST_IN, 0x7, 0, Offset, + pData, length); return Status; } @@ -192,77 +166,56 @@ NTSTATUS RTUSBMultiRead( ======================================================================== */ -NTSTATUS RTUSBMultiWrite_OneByte( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN PUCHAR pData) +NTSTATUS RTUSBMultiWrite_OneByte(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, IN PUCHAR pData) { - NTSTATUS Status; + NTSTATUS Status; // TODO: In 2870, use this funciton carefully cause it's not stable. - Status = RTUSB_VendorRequest( - pAd, - USBD_TRANSFER_DIRECTION_OUT, - DEVICE_VENDOR_REQUEST_OUT, - 0x6, - 0, - Offset, - pData, - 1); + Status = RTUSB_VendorRequest(pAd, + USBD_TRANSFER_DIRECTION_OUT, + DEVICE_VENDOR_REQUEST_OUT, + 0x6, 0, Offset, pData, 1); return Status; } -NTSTATUS RTUSBMultiWrite( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN PUCHAR pData, - IN USHORT length) +NTSTATUS RTUSBMultiWrite(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, IN PUCHAR pData, IN USHORT length) { - NTSTATUS Status; - - - USHORT index = 0,Value; - PUCHAR pSrc = pData; - USHORT resude = 0; - - resude = length % 2; - length += resude; - do - { - Value =(USHORT)( *pSrc | (*(pSrc + 1) << 8)); - Status = RTUSBSingleWrite(pAd,Offset + index,Value); - index +=2; - length -= 2; - pSrc = pSrc + 2; - }while(length > 0); + NTSTATUS Status; + + USHORT index = 0, Value; + PUCHAR pSrc = pData; + USHORT resude = 0; + + resude = length % 2; + length += resude; + do { + Value = (USHORT) (*pSrc | (*(pSrc + 1) << 8)); + Status = RTUSBSingleWrite(pAd, Offset + index, Value); + index += 2; + length -= 2; + pSrc = pSrc + 2; + } while (length > 0); return Status; } - -NTSTATUS RTUSBSingleWrite( - IN RTMP_ADAPTER *pAd, - IN USHORT Offset, - IN USHORT Value) +NTSTATUS RTUSBSingleWrite(IN RTMP_ADAPTER * pAd, + IN USHORT Offset, IN USHORT Value) { - NTSTATUS Status; - - Status = RTUSB_VendorRequest( - pAd, - USBD_TRANSFER_DIRECTION_OUT, - DEVICE_VENDOR_REQUEST_OUT, - 0x2, - Value, - Offset, - NULL, - 0); + NTSTATUS Status; + + Status = RTUSB_VendorRequest(pAd, + USBD_TRANSFER_DIRECTION_OUT, + DEVICE_VENDOR_REQUEST_OUT, + 0x2, Value, Offset, NULL, 0); return Status; } - /* ======================================================================== @@ -278,26 +231,19 @@ NTSTATUS RTUSBSingleWrite( ======================================================================== */ -NTSTATUS RTUSBReadMACRegister( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - OUT PUINT32 pValue) +NTSTATUS RTUSBReadMACRegister(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, OUT PUINT32 pValue) { - NTSTATUS Status = 0; - UINT32 localVal; - - Status = RTUSB_VendorRequest( - pAd, - (USBD_TRANSFER_DIRECTION_IN | USBD_SHORT_TRANSFER_OK), - DEVICE_VENDOR_REQUEST_IN, - 0x7, - 0, - Offset, - &localVal, - 4); + NTSTATUS Status = 0; + UINT32 localVal; - *pValue = le2cpu32(localVal); + Status = RTUSB_VendorRequest(pAd, + (USBD_TRANSFER_DIRECTION_IN | + USBD_SHORT_TRANSFER_OK), + DEVICE_VENDOR_REQUEST_IN, 0x7, 0, Offset, + &localVal, 4); + *pValue = le2cpu32(localVal); if (Status < 0) *pValue = 0xffffffff; @@ -305,7 +251,6 @@ NTSTATUS RTUSBReadMACRegister( return Status; } - /* ======================================================================== @@ -321,24 +266,22 @@ NTSTATUS RTUSBReadMACRegister( ======================================================================== */ -NTSTATUS RTUSBWriteMACRegister( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN UINT32 Value) +NTSTATUS RTUSBWriteMACRegister(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, IN UINT32 Value) { - NTSTATUS Status; - UINT32 localVal; + NTSTATUS Status; + UINT32 localVal; localVal = Value; - Status = RTUSBSingleWrite(pAd, Offset, (USHORT)(localVal & 0xffff)); - Status = RTUSBSingleWrite(pAd, Offset + 2, (USHORT)((localVal & 0xffff0000) >> 16)); + Status = RTUSBSingleWrite(pAd, Offset, (USHORT) (localVal & 0xffff)); + Status = + RTUSBSingleWrite(pAd, Offset + 2, + (USHORT) ((localVal & 0xffff0000) >> 16)); return Status; } - - /* ======================================================================== @@ -354,78 +297,77 @@ NTSTATUS RTUSBWriteMACRegister( ======================================================================== */ -NTSTATUS RTUSBReadBBPRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR Id, - IN PUCHAR pValue) +NTSTATUS RTUSBReadBBPRegister(IN PRTMP_ADAPTER pAd, + IN UCHAR Id, IN PUCHAR pValue) { - BBP_CSR_CFG_STRUC BbpCsr; - UINT i = 0; - NTSTATUS status; + BBP_CSR_CFG_STRUC BbpCsr; + UINT i = 0; + NTSTATUS status; // Verify the busy condition - do - { + do { status = RTUSBReadMACRegister(pAd, BBP_CSR_CFG, &BbpCsr.word); - if(status >= 0) - { - if (!(BbpCsr.field.Busy == BUSY)) - break; + if (status >= 0) { + if (!(BbpCsr.field.Busy == BUSY)) + break; } - DBGPRINT(RT_DEBUG_TRACE, ("RTUSBReadBBPRegister(BBP_CSR_CFG_1):retry count=%d!\n", i)); + DBGPRINT(RT_DEBUG_TRACE, + ("RTUSBReadBBPRegister(BBP_CSR_CFG_1):retry count=%d!\n", + i)); i++; - }while ((i < RETRY_LIMIT) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); + } while ((i < RETRY_LIMIT) + && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); - if ((i == RETRY_LIMIT) || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) - { + if ((i == RETRY_LIMIT) + || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) { // // Read failed then Return Default value. // *pValue = pAd->BbpWriteLatch[Id]; - DBGPRINT_RAW(RT_DEBUG_ERROR, ("Retry count exhausted or device removed!!!\n")); + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("Retry count exhausted or device removed!!!\n")); return STATUS_UNSUCCESSFUL; } - // Prepare for write material - BbpCsr.word = 0; - BbpCsr.field.fRead = 1; - BbpCsr.field.Busy = 1; - BbpCsr.field.RegNum = Id; + BbpCsr.word = 0; + BbpCsr.field.fRead = 1; + BbpCsr.field.Busy = 1; + BbpCsr.field.RegNum = Id; RTUSBWriteMACRegister(pAd, BBP_CSR_CFG, BbpCsr.word); i = 0; // Verify the busy condition - do - { + do { status = RTUSBReadMACRegister(pAd, BBP_CSR_CFG, &BbpCsr.word); - if (status >= 0) - { - if (!(BbpCsr.field.Busy == BUSY)) - { - *pValue = (UCHAR)BbpCsr.field.Value; - break; - } + if (status >= 0) { + if (!(BbpCsr.field.Busy == BUSY)) { + *pValue = (UCHAR) BbpCsr.field.Value; + break; + } } - DBGPRINT(RT_DEBUG_TRACE, ("RTUSBReadBBPRegister(BBP_CSR_CFG_2):retry count=%d!\n", i)); + DBGPRINT(RT_DEBUG_TRACE, + ("RTUSBReadBBPRegister(BBP_CSR_CFG_2):retry count=%d!\n", + i)); i++; - }while ((i < RETRY_LIMIT) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); + } while ((i < RETRY_LIMIT) + && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); - if ((i == RETRY_LIMIT) || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) - { + if ((i == RETRY_LIMIT) + || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) { // // Read failed then Return Default value. // *pValue = pAd->BbpWriteLatch[Id]; - DBGPRINT_RAW(RT_DEBUG_ERROR, ("Retry count exhausted or device removed!!!\n")); + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("Retry count exhausted or device removed!!!\n")); return STATUS_UNSUCCESSFUL; } return STATUS_SUCCESS; } - /* ======================================================================== @@ -441,46 +383,46 @@ NTSTATUS RTUSBReadBBPRegister( ======================================================================== */ -NTSTATUS RTUSBWriteBBPRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR Id, - IN UCHAR Value) +NTSTATUS RTUSBWriteBBPRegister(IN PRTMP_ADAPTER pAd, + IN UCHAR Id, IN UCHAR Value) { - BBP_CSR_CFG_STRUC BbpCsr; - UINT i = 0; - NTSTATUS status; + BBP_CSR_CFG_STRUC BbpCsr; + UINT i = 0; + NTSTATUS status; // Verify the busy condition - do - { + do { status = RTUSBReadMACRegister(pAd, BBP_CSR_CFG, &BbpCsr.word); - if (status >= 0) - { - if (!(BbpCsr.field.Busy == BUSY)) - break; + if (status >= 0) { + if (!(BbpCsr.field.Busy == BUSY)) + break; } - DBGPRINT(RT_DEBUG_TRACE, ("RTUSBWriteBBPRegister(BBP_CSR_CFG):retry count=%d!\n", i)); + DBGPRINT(RT_DEBUG_TRACE, + ("RTUSBWriteBBPRegister(BBP_CSR_CFG):retry count=%d!\n", + i)); i++; } - while ((i < RETRY_LIMIT) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); + while ((i < RETRY_LIMIT) + && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); - if ((i == RETRY_LIMIT) || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("Retry count exhausted or device removed!!!\n")); + if ((i == RETRY_LIMIT) + || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) { + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("Retry count exhausted or device removed!!!\n")); return STATUS_UNSUCCESSFUL; } - // Prepare for write material - BbpCsr.word = 0; - BbpCsr.field.fRead = 0; - BbpCsr.field.Value = Value; - BbpCsr.field.Busy = 1; - BbpCsr.field.RegNum = Id; + BbpCsr.word = 0; + BbpCsr.field.fRead = 0; + BbpCsr.field.Value = Value; + BbpCsr.field.Busy = 1; + BbpCsr.field.RegNum = Id; RTUSBWriteMACRegister(pAd, BBP_CSR_CFG, BbpCsr.word); pAd->BbpWriteLatch[Id] = Value; return STATUS_SUCCESS; } + /* ======================================================================== @@ -496,31 +438,31 @@ NTSTATUS RTUSBWriteBBPRegister( ======================================================================== */ -NTSTATUS RTUSBWriteRFRegister( - IN PRTMP_ADAPTER pAd, - IN UINT32 Value) +NTSTATUS RTUSBWriteRFRegister(IN PRTMP_ADAPTER pAd, IN UINT32 Value) { - PHY_CSR4_STRUC PhyCsr4; - UINT i = 0; - NTSTATUS status; + PHY_CSR4_STRUC PhyCsr4; + UINT i = 0; + NTSTATUS status; NdisZeroMemory(&PhyCsr4, sizeof(PHY_CSR4_STRUC)); - do - { + do { status = RTUSBReadMACRegister(pAd, RF_CSR_CFG0, &PhyCsr4.word); - if (status >= 0) - { - if (!(PhyCsr4.field.Busy)) - break; + if (status >= 0) { + if (!(PhyCsr4.field.Busy)) + break; } - DBGPRINT(RT_DEBUG_TRACE, ("RTUSBWriteRFRegister(RF_CSR_CFG0):retry count=%d!\n", i)); + DBGPRINT(RT_DEBUG_TRACE, + ("RTUSBWriteRFRegister(RF_CSR_CFG0):retry count=%d!\n", + i)); i++; } - while ((i < RETRY_LIMIT) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); + while ((i < RETRY_LIMIT) + && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); - if ((i == RETRY_LIMIT) || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("Retry count exhausted or device removed!!!\n")); + if ((i == RETRY_LIMIT) + || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) { + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("Retry count exhausted or device removed!!!\n")); return STATUS_UNSUCCESSFUL; } @@ -529,7 +471,6 @@ NTSTATUS RTUSBWriteRFRegister( return STATUS_SUCCESS; } - /* ======================================================================== @@ -545,23 +486,16 @@ NTSTATUS RTUSBWriteRFRegister( ======================================================================== */ -NTSTATUS RTUSBReadEEPROM( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - OUT PUCHAR pData, - IN USHORT length) +NTSTATUS RTUSBReadEEPROM(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, OUT PUCHAR pData, IN USHORT length) { - NTSTATUS Status = STATUS_SUCCESS; - - Status = RTUSB_VendorRequest( - pAd, - (USBD_TRANSFER_DIRECTION_IN | USBD_SHORT_TRANSFER_OK), - DEVICE_VENDOR_REQUEST_IN, - 0x9, - 0, - Offset, - pData, - length); + NTSTATUS Status = STATUS_SUCCESS; + + Status = RTUSB_VendorRequest(pAd, + (USBD_TRANSFER_DIRECTION_IN | + USBD_SHORT_TRANSFER_OK), + DEVICE_VENDOR_REQUEST_IN, 0x9, 0, Offset, + pData, length); return Status; } @@ -581,37 +515,26 @@ NTSTATUS RTUSBReadEEPROM( ======================================================================== */ -NTSTATUS RTUSBWriteEEPROM( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN PUCHAR pData, - IN USHORT length) +NTSTATUS RTUSBWriteEEPROM(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, IN PUCHAR pData, IN USHORT length) { - NTSTATUS Status = STATUS_SUCCESS; - - Status = RTUSB_VendorRequest( - pAd, - USBD_TRANSFER_DIRECTION_OUT, - DEVICE_VENDOR_REQUEST_OUT, - 0x8, - 0, - Offset, - pData, - length); + NTSTATUS Status = STATUS_SUCCESS; + + Status = RTUSB_VendorRequest(pAd, + USBD_TRANSFER_DIRECTION_OUT, + DEVICE_VENDOR_REQUEST_OUT, + 0x8, 0, Offset, pData, length); return Status; } - -NTSTATUS RTUSBReadEEPROM16( - IN PRTMP_ADAPTER pAd, - IN USHORT offset, - OUT PUSHORT pData) +NTSTATUS RTUSBReadEEPROM16(IN PRTMP_ADAPTER pAd, + IN USHORT offset, OUT PUSHORT pData) { NTSTATUS status; - USHORT localData; + USHORT localData; - status = RTUSBReadEEPROM(pAd, offset, (PUCHAR)(&localData), 2); + status = RTUSBReadEEPROM(pAd, offset, (PUCHAR) (&localData), 2); if (status == STATUS_SUCCESS) *pData = le2cpu16(localData); @@ -634,13 +557,12 @@ NTSTATUS RTUSBReadEEPROM16( ======================================================================== */ -VOID RTUSBPutToSleep( - IN PRTMP_ADAPTER pAd) +VOID RTUSBPutToSleep(IN PRTMP_ADAPTER pAd) { - UINT32 value; + UINT32 value; // Timeout 0x40 x 50us - value = (SLEEPCID<<16)+(OWNERMCU<<24)+ (0x40<<8)+1; + value = (SLEEPCID << 16) + (OWNERMCU << 24) + (0x40 << 8) + 1; RTUSBWriteMACRegister(pAd, 0x7010, value); RTUSBWriteMACRegister(pAd, 0x404, 0x30); //RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); @@ -663,20 +585,14 @@ VOID RTUSBPutToSleep( ======================================================================== */ -NTSTATUS RTUSBWakeUp( - IN PRTMP_ADAPTER pAd) +NTSTATUS RTUSBWakeUp(IN PRTMP_ADAPTER pAd) { - NTSTATUS Status; - - Status = RTUSB_VendorRequest( - pAd, - USBD_TRANSFER_DIRECTION_OUT, - DEVICE_VENDOR_REQUEST_OUT, - 0x01, - 0x09, - 0, - NULL, - 0); + NTSTATUS Status; + + Status = RTUSB_VendorRequest(pAd, + USBD_TRANSFER_DIRECTION_OUT, + DEVICE_VENDOR_REQUEST_OUT, + 0x01, 0x09, 0, NULL, 0); return Status; } @@ -696,8 +612,7 @@ NTSTATUS RTUSBWakeUp( ======================================================================== */ -VOID RTUSBInitializeCmdQ( - IN PCmdQ cmdq) +VOID RTUSBInitializeCmdQ(IN PCmdQ cmdq) { cmdq->head = NULL; cmdq->tail = NULL; @@ -720,48 +635,45 @@ VOID RTUSBInitializeCmdQ( ======================================================================== */ -NDIS_STATUS RTUSBEnqueueCmdFromNdis( - IN PRTMP_ADAPTER pAd, - IN NDIS_OID Oid, - IN BOOLEAN SetInformation, - IN PVOID pInformationBuffer, - IN UINT32 InformationBufferLength) +NDIS_STATUS RTUSBEnqueueCmdFromNdis(IN PRTMP_ADAPTER pAd, + IN NDIS_OID Oid, + IN BOOLEAN SetInformation, + IN PVOID pInformationBuffer, + IN UINT32 InformationBufferLength) { - NDIS_STATUS status; - PCmdQElmt cmdqelmt = NULL; - RTMP_OS_TASK *pTask = &pAd->cmdQTask; + NDIS_STATUS status; + PCmdQElmt cmdqelmt = NULL; + RTMP_OS_TASK *pTask = &pAd->cmdQTask; #ifdef KTHREAD_SUPPORT if (pTask->kthread_task == NULL) #else - CHECK_PID_LEGALITY(pTask->taskPID) - { + CHECK_PID_LEGALITY(pTask->taskPID) { } else #endif - return (NDIS_STATUS_RESOURCES); + return (NDIS_STATUS_RESOURCES); - status = os_alloc_mem(pAd, (PUCHAR *)(&cmdqelmt), sizeof(CmdQElmt)); + status = os_alloc_mem(pAd, (PUCHAR *) (&cmdqelmt), sizeof(CmdQElmt)); if ((status != NDIS_STATUS_SUCCESS) || (cmdqelmt == NULL)) return (NDIS_STATUS_RESOURCES); - cmdqelmt->buffer = NULL; - if (pInformationBuffer != NULL) - { - status = os_alloc_mem(pAd, (PUCHAR *)&cmdqelmt->buffer, InformationBufferLength); - if ((status != NDIS_STATUS_SUCCESS) || (cmdqelmt->buffer == NULL)) - { - kfree(cmdqelmt); - return (NDIS_STATUS_RESOURCES); - } - else - { - NdisMoveMemory(cmdqelmt->buffer, pInformationBuffer, InformationBufferLength); - cmdqelmt->bufferlength = InformationBufferLength; - } + cmdqelmt->buffer = NULL; + if (pInformationBuffer != NULL) { + status = + os_alloc_mem(pAd, (PUCHAR *) & cmdqelmt->buffer, + InformationBufferLength); + if ((status != NDIS_STATUS_SUCCESS) + || (cmdqelmt->buffer == NULL)) { + kfree(cmdqelmt); + return (NDIS_STATUS_RESOURCES); + } else { + NdisMoveMemory(cmdqelmt->buffer, pInformationBuffer, + InformationBufferLength); + cmdqelmt->bufferlength = InformationBufferLength; } - else - cmdqelmt->bufferlength = 0; + } else + cmdqelmt->bufferlength = 0; cmdqelmt->command = Oid; cmdqelmt->CmdFromNdis = TRUE; @@ -771,28 +683,22 @@ NDIS_STATUS RTUSBEnqueueCmdFromNdis( cmdqelmt->SetOperation = FALSE; NdisAcquireSpinLock(&pAd->CmdQLock); - if (pAd->CmdQ.CmdQState & RTMP_TASK_CAN_DO_INSERT) - { + if (pAd->CmdQ.CmdQState & RTMP_TASK_CAN_DO_INSERT) { EnqueueCmd((&pAd->CmdQ), cmdqelmt); status = NDIS_STATUS_SUCCESS; - } - else - { + } else { status = NDIS_STATUS_FAILURE; } NdisReleaseSpinLock(&pAd->CmdQLock); - if (status == NDIS_STATUS_FAILURE) - { + if (status == NDIS_STATUS_FAILURE) { if (cmdqelmt->buffer) os_free_mem(pAd, cmdqelmt->buffer); os_free_mem(pAd, cmdqelmt); - } - else - RTUSBCMDUp(pAd); - + } else + RTUSBCMDUp(pAd); - return(NDIS_STATUS_SUCCESS); + return (NDIS_STATUS_SUCCESS); } /* @@ -810,37 +716,33 @@ NDIS_STATUS RTUSBEnqueueCmdFromNdis( ======================================================================== */ -NDIS_STATUS RTUSBEnqueueInternalCmd( - IN PRTMP_ADAPTER pAd, - IN NDIS_OID Oid, - IN PVOID pInformationBuffer, - IN UINT32 InformationBufferLength) +NDIS_STATUS RTUSBEnqueueInternalCmd(IN PRTMP_ADAPTER pAd, + IN NDIS_OID Oid, + IN PVOID pInformationBuffer, + IN UINT32 InformationBufferLength) { - NDIS_STATUS status; - PCmdQElmt cmdqelmt = NULL; - + NDIS_STATUS status; + PCmdQElmt cmdqelmt = NULL; - status = os_alloc_mem(pAd, (PUCHAR *)&cmdqelmt, sizeof(CmdQElmt)); + status = os_alloc_mem(pAd, (PUCHAR *) & cmdqelmt, sizeof(CmdQElmt)); if ((status != NDIS_STATUS_SUCCESS) || (cmdqelmt == NULL)) return (NDIS_STATUS_RESOURCES); NdisZeroMemory(cmdqelmt, sizeof(CmdQElmt)); - if(InformationBufferLength > 0) - { - status = os_alloc_mem(pAd, (PUCHAR *)&cmdqelmt->buffer, InformationBufferLength); - if ((status != NDIS_STATUS_SUCCESS) || (cmdqelmt->buffer == NULL)) - { + if (InformationBufferLength > 0) { + status = + os_alloc_mem(pAd, (PUCHAR *) & cmdqelmt->buffer, + InformationBufferLength); + if ((status != NDIS_STATUS_SUCCESS) + || (cmdqelmt->buffer == NULL)) { os_free_mem(pAd, cmdqelmt); return (NDIS_STATUS_RESOURCES); - } - else - { - NdisMoveMemory(cmdqelmt->buffer, pInformationBuffer, InformationBufferLength); + } else { + NdisMoveMemory(cmdqelmt->buffer, pInformationBuffer, + InformationBufferLength); cmdqelmt->bufferlength = InformationBufferLength; } - } - else - { + } else { cmdqelmt->buffer = NULL; cmdqelmt->bufferlength = 0; } @@ -848,30 +750,24 @@ NDIS_STATUS RTUSBEnqueueInternalCmd( cmdqelmt->command = Oid; cmdqelmt->CmdFromNdis = FALSE; - if (cmdqelmt != NULL) - { + if (cmdqelmt != NULL) { NdisAcquireSpinLock(&pAd->CmdQLock); - if (pAd->CmdQ.CmdQState & RTMP_TASK_CAN_DO_INSERT) - { + if (pAd->CmdQ.CmdQState & RTMP_TASK_CAN_DO_INSERT) { EnqueueCmd((&pAd->CmdQ), cmdqelmt); status = NDIS_STATUS_SUCCESS; - } - else - { + } else { status = NDIS_STATUS_FAILURE; } NdisReleaseSpinLock(&pAd->CmdQLock); - if (status == NDIS_STATUS_FAILURE) - { + if (status == NDIS_STATUS_FAILURE) { if (cmdqelmt->buffer) os_free_mem(pAd, cmdqelmt->buffer); os_free_mem(pAd, cmdqelmt); - } - else - RTUSBCMDUp(pAd); + } else + RTUSBCMDUp(pAd); } - return(NDIS_STATUS_SUCCESS); + return (NDIS_STATUS_SUCCESS); } /* @@ -889,14 +785,11 @@ NDIS_STATUS RTUSBEnqueueInternalCmd( ======================================================================== */ -VOID RTUSBDequeueCmd( - IN PCmdQ cmdq, - OUT PCmdQElmt *pcmdqelmt) +VOID RTUSBDequeueCmd(IN PCmdQ cmdq, OUT PCmdQElmt * pcmdqelmt) { *pcmdqelmt = cmdq->head; - if (*pcmdqelmt != NULL) - { + if (*pcmdqelmt != NULL) { cmdq->head = cmdq->head->next; cmdq->size--; if (cmdq->size == 0) @@ -930,7 +823,6 @@ VOID RTUSBDequeueCmd( method can wait for it to complete. Since you don't have a handle on the URB used, you can't cancel the request. - Routine Description: Arguments: @@ -941,81 +833,102 @@ VOID RTUSBDequeueCmd( ======================================================================== */ -NTSTATUS RTUSB_VendorRequest( - IN PRTMP_ADAPTER pAd, - IN UINT32 TransferFlags, - IN UCHAR RequestType, - IN UCHAR Request, - IN USHORT Value, - IN USHORT Index, - IN PVOID TransferBuffer, - IN UINT32 TransferBufferLength) +NTSTATUS RTUSB_VendorRequest(IN PRTMP_ADAPTER pAd, + IN UINT32 TransferFlags, + IN UCHAR RequestType, + IN UCHAR Request, + IN USHORT Value, + IN USHORT Index, + IN PVOID TransferBuffer, + IN UINT32 TransferBufferLength) { - int ret = 0; - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + int ret = 0; + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) - { + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) { DBGPRINT(RT_DEBUG_ERROR, ("device disconnected\n")); return -1; - } - else if (in_interrupt()) - { - DBGPRINT(RT_DEBUG_ERROR, ("in_interrupt, RTUSB_VendorRequest Request%02x Value%04x Offset%04x\n",Request,Value,Index)); + } else if (in_interrupt()) { + DBGPRINT(RT_DEBUG_ERROR, + ("in_interrupt, RTUSB_VendorRequest Request%02x Value%04x Offset%04x\n", + Request, Value, Index)); return -1; - } - else - { + } else { #define MAX_RETRY_COUNT 10 int retryCount = 0; - void *tmpBuf = TransferBuffer; + void *tmpBuf = TransferBuffer; ret = down_interruptible(&(pAd->UsbVendorReq_semaphore)); - if (pAd->UsbVendorReqBuf) - { - ASSERT(TransferBufferLength UsbVendorReqBuf) { + ASSERT(TransferBufferLength < MAX_PARAM_BUFFER_SIZE); tmpBuf = (void *)pAd->UsbVendorReqBuf; - NdisZeroMemory(pAd->UsbVendorReqBuf, TransferBufferLength); + NdisZeroMemory(pAd->UsbVendorReqBuf, + TransferBufferLength); if (RequestType == DEVICE_VENDOR_REQUEST_OUT) - NdisMoveMemory(tmpBuf, TransferBuffer, TransferBufferLength); + NdisMoveMemory(tmpBuf, TransferBuffer, + TransferBufferLength); } do { - if( RequestType == DEVICE_VENDOR_REQUEST_OUT) - ret=usb_control_msg(pObj->pUsb_Dev, usb_sndctrlpipe( pObj->pUsb_Dev, 0 ), Request, RequestType, Value,Index, tmpBuf, TransferBufferLength, CONTROL_TIMEOUT_JIFFIES); - else if(RequestType == DEVICE_VENDOR_REQUEST_IN) - ret=usb_control_msg(pObj->pUsb_Dev, usb_rcvctrlpipe( pObj->pUsb_Dev, 0 ), Request, RequestType, Value,Index, tmpBuf, TransferBufferLength, CONTROL_TIMEOUT_JIFFIES); - else - { - DBGPRINT(RT_DEBUG_ERROR, ("vendor request direction is failed\n")); - ret = -1; - } + if (RequestType == DEVICE_VENDOR_REQUEST_OUT) + ret = + usb_control_msg(pObj->pUsb_Dev, + usb_sndctrlpipe(pObj-> + pUsb_Dev, + 0), Request, + RequestType, Value, Index, + tmpBuf, + TransferBufferLength, + CONTROL_TIMEOUT_JIFFIES); + else if (RequestType == DEVICE_VENDOR_REQUEST_IN) + ret = + usb_control_msg(pObj->pUsb_Dev, + usb_rcvctrlpipe(pObj-> + pUsb_Dev, + 0), Request, + RequestType, Value, Index, + tmpBuf, + TransferBufferLength, + CONTROL_TIMEOUT_JIFFIES); + else { + DBGPRINT(RT_DEBUG_ERROR, + ("vendor request direction is failed\n")); + ret = -1; + } retryCount++; if (ret < 0) { DBGPRINT(RT_DEBUG_OFF, ("#\n")); RTMPusecDelay(5000); } - } while((ret < 0) && (retryCount < MAX_RETRY_COUNT)); + } while ((ret < 0) && (retryCount < MAX_RETRY_COUNT)); - if ((pAd->UsbVendorReqBuf) && (RequestType == DEVICE_VENDOR_REQUEST_IN)) - NdisMoveMemory(TransferBuffer, tmpBuf, TransferBufferLength); + if ((pAd->UsbVendorReqBuf) + && (RequestType == DEVICE_VENDOR_REQUEST_IN)) + NdisMoveMemory(TransferBuffer, tmpBuf, + TransferBufferLength); up(&(pAd->UsbVendorReq_semaphore)); - if (ret < 0) { - DBGPRINT(RT_DEBUG_ERROR, ("RTUSB_VendorRequest failed(%d),TxFlags=0x%x, ReqType=%s, Req=0x%x, Index=0x%x\n", - ret, TransferFlags, (RequestType == DEVICE_VENDOR_REQUEST_OUT ? "OUT" : "IN"), Request, Index)); + if (ret < 0) { + DBGPRINT(RT_DEBUG_ERROR, + ("RTUSB_VendorRequest failed(%d),TxFlags=0x%x, ReqType=%s, Req=0x%x, Index=0x%x\n", + ret, TransferFlags, + (RequestType == + DEVICE_VENDOR_REQUEST_OUT ? "OUT" : "IN"), + Request, Index)); if (Request == 0x2) - DBGPRINT(RT_DEBUG_ERROR, ("\tRequest Value=0x%04x!\n", Value)); - - if ((TransferBuffer!= NULL) && (TransferBufferLength > 0)) - hex_dump("Failed TransferBuffer value", TransferBuffer, TransferBufferLength); - } + DBGPRINT(RT_DEBUG_ERROR, + ("\tRequest Value=0x%04x!\n", Value)); + if ((TransferBuffer != NULL) + && (TransferBufferLength > 0)) + hex_dump("Failed TransferBuffer value", + TransferBuffer, TransferBufferLength); + } } @@ -1041,28 +954,25 @@ NTSTATUS RTUSB_VendorRequest( ======================================================================== */ -NTSTATUS RTUSB_ResetDevice( - IN PRTMP_ADAPTER pAd) +NTSTATUS RTUSB_ResetDevice(IN PRTMP_ADAPTER pAd) { - NTSTATUS Status = TRUE; + NTSTATUS Status = TRUE; DBGPRINT_RAW(RT_DEBUG_TRACE, ("--->USB_ResetDevice\n")); //RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS); return Status; } -VOID CMDHandler( - IN PRTMP_ADAPTER pAd) +VOID CMDHandler(IN PRTMP_ADAPTER pAd) { - PCmdQElmt cmdqelmt; - PUCHAR pData; - NDIS_STATUS NdisStatus = NDIS_STATUS_SUCCESS; -// ULONG Now = 0; - NTSTATUS ntStatus; -// unsigned long IrqFlags; - - while (pAd && pAd->CmdQ.size > 0) - { + PCmdQElmt cmdqelmt; + PUCHAR pData; + NDIS_STATUS NdisStatus = NDIS_STATUS_SUCCESS; +// ULONG Now = 0; + NTSTATUS ntStatus; +// unsigned long IrqFlags; + + while (pAd && pAd->CmdQ.size > 0) { NdisStatus = NDIS_STATUS_SUCCESS; NdisAcquireSpinLock(&pAd->CmdQLock); @@ -1074,645 +984,1129 @@ VOID CMDHandler( pData = cmdqelmt->buffer; - if(!(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST) || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS))) - { - switch (cmdqelmt->command) - { - case CMDTHREAD_CHECK_GPIO: - { - UINT32 data; + if (! + (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST) + || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS))) { + switch (cmdqelmt->command) { + case CMDTHREAD_CHECK_GPIO: + { + UINT32 data; - { - // Read GPIO pin2 as Hardware controlled radio state - - RTUSBReadMACRegister( pAd, GPIO_CTRL_CFG, &data); - - if (data & 0x04) - { - pAd->StaCfg.bHwRadio = TRUE; - } - else - { - pAd->StaCfg.bHwRadio = FALSE; - } - - if(pAd->StaCfg.bRadio != (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio)) - { - pAd->StaCfg.bRadio = (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio); - if(pAd->StaCfg.bRadio == TRUE) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("!!! Radio On !!!\n")); - - MlmeRadioOn(pAd); - // Update extra information - pAd->ExtraInfo = EXTRA_INFO_CLEAR; - } - else - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("!!! Radio Off !!!\n")); + { + // Read GPIO pin2 as Hardware controlled radio state + + RTUSBReadMACRegister(pAd, + GPIO_CTRL_CFG, + &data); + + if (data & 0x04) { + pAd->StaCfg.bHwRadio = + TRUE; + } else { + pAd->StaCfg.bHwRadio = + FALSE; + } - MlmeRadioOff(pAd); - // Update extra information - pAd->ExtraInfo = HW_RADIO_OFF; - } + if (pAd->StaCfg.bRadio != + (pAd->StaCfg.bHwRadio + && pAd->StaCfg.bSwRadio)) { + pAd->StaCfg.bRadio = + (pAd->StaCfg. + bHwRadio + && pAd->StaCfg. + bSwRadio); + if (pAd->StaCfg. + bRadio == TRUE) { + DBGPRINT_RAW + (RT_DEBUG_ERROR, + ("!!! Radio On !!!\n")); + + MlmeRadioOn + (pAd); + // Update extra information + pAd->ExtraInfo = + EXTRA_INFO_CLEAR; + } else { + DBGPRINT_RAW + (RT_DEBUG_ERROR, + ("!!! Radio Off !!!\n")); + + MlmeRadioOff + (pAd); + // Update extra information + pAd->ExtraInfo = + HW_RADIO_OFF; } } } - break; - - case CMDTHREAD_QKERIODIC_EXECUT: - { - StaQuickResponeForRateUpExec(NULL, pAd, NULL, NULL); - } - break; + } + break; + + case CMDTHREAD_QKERIODIC_EXECUT: + { + StaQuickResponeForRateUpExec(NULL, pAd, + NULL, + NULL); + } + break; + + case CMDTHREAD_RESET_BULK_OUT: + { + UINT32 MACValue; + UCHAR Index; + int ret = 0; + PHT_TX_CONTEXT pHTTXContext; +// RTMP_TX_RING *pTxRing; + unsigned long IrqFlags; + + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("CmdThread : CMDTHREAD_RESET_BULK_OUT(ResetPipeid=0x%0x)===>\n", + pAd->bulkResetPipeid)); + // All transfers must be aborted or cancelled before attempting to reset the pipe. + //RTUSBCancelPendingBulkOutIRP(pAd); + // Wait 10ms to let previous packet that are already in HW FIFO to clear. by MAXLEE 12-25-2007 + Index = 0; + do { + RTUSBReadMACRegister(pAd, + TXRXQ_PCNT, + &MACValue); + if ((MACValue & 0xf00000 + /*0x800000 */ ) == 0) + break; + Index++; + RTMPusecDelay(10000); + } while (Index < 100); + MACValue = 0; + RTUSBReadMACRegister(pAd, USB_DMA_CFG, + &MACValue); + // To prevent Read Register error, we 2nd check the validity. + if ((MACValue & 0xc00000) == 0) + RTUSBReadMACRegister(pAd, + USB_DMA_CFG, + &MACValue); + // To prevent Read Register error, we 3rd check the validity. + if ((MACValue & 0xc00000) == 0) + RTUSBReadMACRegister(pAd, + USB_DMA_CFG, + &MACValue); + MACValue |= 0x80000; + RTUSBWriteMACRegister(pAd, USB_DMA_CFG, + MACValue); + + // Wait 1ms to prevent next URB to bulkout before HW reset. by MAXLEE 12-25-2007 + RTMPusecDelay(1000); + + MACValue &= (~0x80000); + RTUSBWriteMACRegister(pAd, USB_DMA_CFG, + MACValue); + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("\tSet 0x2a0 bit19. Clear USB DMA TX path\n")); + + // Wait 5ms to prevent next URB to bulkout before HW reset. by MAXLEE 12-25-2007 + //RTMPusecDelay(5000); + + if ((pAd-> + bulkResetPipeid & + BULKOUT_MGMT_RESET_FLAG) == + BULKOUT_MGMT_RESET_FLAG) { + RTMP_CLEAR_FLAG(pAd, + fRTMP_ADAPTER_BULKOUT_RESET); + if (pAd->MgmtRing.TxSwFreeIdx < + MGMT_RING_SIZE + /* pMLMEContext->bWaitingBulkOut == TRUE */ + ) { + RTUSB_SET_BULK_FLAG(pAd, + fRTUSB_BULK_OUT_MLME); + } + RTUSBKickBulkOut(pAd); + + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("\tTX MGMT RECOVER Done!\n")); + } else { + pHTTXContext = + &(pAd-> + TxContext[pAd-> + bulkResetPipeid]); + //NdisAcquireSpinLock(&pAd->BulkOutLock[pAd->bulkResetPipeid]); + RTMP_INT_LOCK(&pAd-> + BulkOutLock[pAd-> + bulkResetPipeid], + IrqFlags); + if (pAd-> + BulkOutPending[pAd-> + bulkResetPipeid] + == FALSE) { + pAd-> + BulkOutPending[pAd-> + bulkResetPipeid] + = TRUE; + pHTTXContext-> + IRPPending = TRUE; + pAd-> + watchDogTxPendingCnt + [pAd-> + bulkResetPipeid] = + 1; - case CMDTHREAD_RESET_BULK_OUT: - { - UINT32 MACValue; - UCHAR Index; - int ret=0; - PHT_TX_CONTEXT pHTTXContext; -// RTMP_TX_RING *pTxRing; - unsigned long IrqFlags; - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("CmdThread : CMDTHREAD_RESET_BULK_OUT(ResetPipeid=0x%0x)===>\n", pAd->bulkResetPipeid)); - // All transfers must be aborted or cancelled before attempting to reset the pipe. - //RTUSBCancelPendingBulkOutIRP(pAd); - // Wait 10ms to let previous packet that are already in HW FIFO to clear. by MAXLEE 12-25-2007 - Index = 0; - do - { - RTUSBReadMACRegister(pAd, TXRXQ_PCNT, &MACValue); - if ((MACValue & 0xf00000/*0x800000*/) == 0) - break; - Index++; - RTMPusecDelay(10000); - }while(Index < 100); - MACValue = 0; - RTUSBReadMACRegister(pAd, USB_DMA_CFG, &MACValue); - // To prevent Read Register error, we 2nd check the validity. - if ((MACValue & 0xc00000) == 0) - RTUSBReadMACRegister(pAd, USB_DMA_CFG, &MACValue); - // To prevent Read Register error, we 3rd check the validity. - if ((MACValue & 0xc00000) == 0) - RTUSBReadMACRegister(pAd, USB_DMA_CFG, &MACValue); - MACValue |= 0x80000; - RTUSBWriteMACRegister(pAd, USB_DMA_CFG, MACValue); - - // Wait 1ms to prevent next URB to bulkout before HW reset. by MAXLEE 12-25-2007 - RTMPusecDelay(1000); - - MACValue &= (~0x80000); - RTUSBWriteMACRegister(pAd, USB_DMA_CFG, MACValue); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("\tSet 0x2a0 bit19. Clear USB DMA TX path\n")); - - // Wait 5ms to prevent next URB to bulkout before HW reset. by MAXLEE 12-25-2007 - //RTMPusecDelay(5000); - - if ((pAd->bulkResetPipeid & BULKOUT_MGMT_RESET_FLAG) == BULKOUT_MGMT_RESET_FLAG) - { - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); - if (pAd->MgmtRing.TxSwFreeIdx < MGMT_RING_SIZE /* pMLMEContext->bWaitingBulkOut == TRUE */) + // no matter what, clean the flag + RTMP_CLEAR_FLAG(pAd, + fRTMP_ADAPTER_BULKOUT_RESET); + + //NdisReleaseSpinLock(&pAd->BulkOutLock[pAd->bulkResetPipeid]); + RTMP_INT_UNLOCK(&pAd-> + BulkOutLock + [pAd-> + bulkResetPipeid], + IrqFlags); { - RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_MLME); - } - RTUSBKickBulkOut(pAd); + RTUSBInitHTTxDesc + (pAd, + pHTTXContext, + pAd-> + bulkResetPipeid, + pHTTXContext-> + BulkOutSize, + (usb_complete_t) + RTUSBBulkOutDataPacketComplete); + + if ((ret = + RTUSB_SUBMIT_URB + (pHTTXContext-> + pUrb)) != + 0) { + RTMP_INT_LOCK + (&pAd-> + BulkOutLock + [pAd-> + bulkResetPipeid], + IrqFlags); + pAd-> + BulkOutPending + [pAd-> + bulkResetPipeid] + = + FALSE; + pHTTXContext-> + IRPPending + = + FALSE; + pAd-> + watchDogTxPendingCnt + [pAd-> + bulkResetPipeid] + = 0; + RTMP_INT_UNLOCK + (&pAd-> + BulkOutLock + [pAd-> + bulkResetPipeid], + IrqFlags); + + DBGPRINT + (RT_DEBUG_ERROR, + ("CmdThread : CMDTHREAD_RESET_BULK_OUT: Submit Tx URB failed %d\n", + ret)); + } else { + RTMP_IRQ_LOCK + (&pAd-> + BulkOutLock + [pAd-> + bulkResetPipeid], + IrqFlags); + DBGPRINT_RAW + (RT_DEBUG_TRACE, + ("\tCMDTHREAD_RESET_BULK_OUT: TxContext[%d]:CWPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d, pending=%d!\n", + pAd-> + bulkResetPipeid, + pHTTXContext-> + CurWritePosition, + pHTTXContext-> + NextBulkOutPosition, + pHTTXContext-> + ENextBulkOutPosition, + pHTTXContext-> + bCopySavePad, + pAd-> + BulkOutPending + [pAd-> + bulkResetPipeid])); + DBGPRINT_RAW + (RT_DEBUG_TRACE, + ("\t\tBulkOut Req=0x%lx, Complete=0x%lx, Other=0x%lx\n", + pAd-> + BulkOutReq, + pAd-> + BulkOutComplete, + pAd-> + BulkOutCompleteOther)); + RTMP_IRQ_UNLOCK + (&pAd-> + BulkOutLock + [pAd-> + bulkResetPipeid], + IrqFlags); + DBGPRINT_RAW + (RT_DEBUG_TRACE, + ("\tCMDTHREAD_RESET_BULK_OUT: Submit Tx DATA URB for failed BulkReq(0x%lx) Done, status=%d!\n", + pAd-> + bulkResetReq + [pAd-> + bulkResetPipeid], + pHTTXContext-> + pUrb-> + status)); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("\tTX MGMT RECOVER Done!\n")); - } - else - { - pHTTXContext = &(pAd->TxContext[pAd->bulkResetPipeid]); - //NdisAcquireSpinLock(&pAd->BulkOutLock[pAd->bulkResetPipeid]); - RTMP_INT_LOCK(&pAd->BulkOutLock[pAd->bulkResetPipeid], IrqFlags); - if ( pAd->BulkOutPending[pAd->bulkResetPipeid] == FALSE) - { - pAd->BulkOutPending[pAd->bulkResetPipeid] = TRUE; - pHTTXContext->IRPPending = TRUE; - pAd->watchDogTxPendingCnt[pAd->bulkResetPipeid] = 1; - - // no matter what, clean the flag - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); - - //NdisReleaseSpinLock(&pAd->BulkOutLock[pAd->bulkResetPipeid]); - RTMP_INT_UNLOCK(&pAd->BulkOutLock[pAd->bulkResetPipeid], IrqFlags); - { - RTUSBInitHTTxDesc(pAd, pHTTXContext, pAd->bulkResetPipeid, pHTTXContext->BulkOutSize, (usb_complete_t)RTUSBBulkOutDataPacketComplete); - - if((ret = RTUSB_SUBMIT_URB(pHTTXContext->pUrb))!=0) - { - RTMP_INT_LOCK(&pAd->BulkOutLock[pAd->bulkResetPipeid], IrqFlags); - pAd->BulkOutPending[pAd->bulkResetPipeid] = FALSE; - pHTTXContext->IRPPending = FALSE; - pAd->watchDogTxPendingCnt[pAd->bulkResetPipeid] = 0; - RTMP_INT_UNLOCK(&pAd->BulkOutLock[pAd->bulkResetPipeid], IrqFlags); - - DBGPRINT(RT_DEBUG_ERROR, ("CmdThread : CMDTHREAD_RESET_BULK_OUT: Submit Tx URB failed %d\n", ret)); - } - else - { - RTMP_IRQ_LOCK(&pAd->BulkOutLock[pAd->bulkResetPipeid], IrqFlags); - DBGPRINT_RAW(RT_DEBUG_TRACE,("\tCMDTHREAD_RESET_BULK_OUT: TxContext[%d]:CWPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d, pending=%d!\n", - pAd->bulkResetPipeid, pHTTXContext->CurWritePosition, pHTTXContext->NextBulkOutPosition, - pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad, pAd->BulkOutPending[pAd->bulkResetPipeid])); - DBGPRINT_RAW(RT_DEBUG_TRACE,("\t\tBulkOut Req=0x%lx, Complete=0x%lx, Other=0x%lx\n", - pAd->BulkOutReq, pAd->BulkOutComplete, pAd->BulkOutCompleteOther)); - RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[pAd->bulkResetPipeid], IrqFlags); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("\tCMDTHREAD_RESET_BULK_OUT: Submit Tx DATA URB for failed BulkReq(0x%lx) Done, status=%d!\n", pAd->bulkResetReq[pAd->bulkResetPipeid], pHTTXContext->pUrb->status)); - - } } } - else - { - //NdisReleaseSpinLock(&pAd->BulkOutLock[pAd->bulkResetPipeid]); - //RTMP_INT_UNLOCK(&pAd->BulkOutLock[pAd->bulkResetPipeid], IrqFlags); - - DBGPRINT_RAW(RT_DEBUG_ERROR, ("CmdThread : TX DATA RECOVER FAIL for BulkReq(0x%lx) because BulkOutPending[%d] is TRUE!\n", pAd->bulkResetReq[pAd->bulkResetPipeid], pAd->bulkResetPipeid)); - if (pAd->bulkResetPipeid == 0) - { - UCHAR pendingContext = 0; - PHT_TX_CONTEXT pHTTXContext = (PHT_TX_CONTEXT)(&pAd->TxContext[pAd->bulkResetPipeid ]); - PTX_CONTEXT pMLMEContext = (PTX_CONTEXT)(pAd->MgmtRing.Cell[pAd->MgmtRing.TxDmaIdx].AllocVa); - PTX_CONTEXT pNULLContext = (PTX_CONTEXT)(&pAd->PsPollContext); - PTX_CONTEXT pPsPollContext = (PTX_CONTEXT)(&pAd->NullContext); - - if (pHTTXContext->IRPPending) - pendingContext |= 1; - else if (pMLMEContext->IRPPending) - pendingContext |= 2; - else if (pNULLContext->IRPPending) - pendingContext |= 4; - else if (pPsPollContext->IRPPending) - pendingContext |= 8; - else - pendingContext = 0; - - DBGPRINT_RAW(RT_DEBUG_ERROR, ("\tTX Occupied by %d!\n", pendingContext)); - } - - // no matter what, clean the flag - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); - - RTMP_INT_UNLOCK(&pAd->BulkOutLock[pAd->bulkResetPipeid], IrqFlags); + } else { + //NdisReleaseSpinLock(&pAd->BulkOutLock[pAd->bulkResetPipeid]); + //RTMP_INT_UNLOCK(&pAd->BulkOutLock[pAd->bulkResetPipeid], IrqFlags); + + DBGPRINT_RAW + (RT_DEBUG_ERROR, + ("CmdThread : TX DATA RECOVER FAIL for BulkReq(0x%lx) because BulkOutPending[%d] is TRUE!\n", + pAd-> + bulkResetReq[pAd-> + bulkResetPipeid], + pAd-> + bulkResetPipeid)); + if (pAd-> + bulkResetPipeid == + 0) { + UCHAR + pendingContext + = 0; + PHT_TX_CONTEXT + pHTTXContext + = + (PHT_TX_CONTEXT) + (&pAd-> + TxContext + [pAd-> + bulkResetPipeid]); + PTX_CONTEXT + pMLMEContext + = + (PTX_CONTEXT) + (pAd-> + MgmtRing. + Cell[pAd-> + MgmtRing. + TxDmaIdx]. + AllocVa); + PTX_CONTEXT + pNULLContext + = + (PTX_CONTEXT) + (&pAd-> + PsPollContext); + PTX_CONTEXT + pPsPollContext + = + (PTX_CONTEXT) + (&pAd-> + NullContext); + + if (pHTTXContext->IRPPending) + pendingContext + |= + 1; + else if + (pMLMEContext-> + IRPPending) + pendingContext + |= + 2; + else if + (pNULLContext-> + IRPPending) + pendingContext + |= + 4; + else if + (pPsPollContext-> + IRPPending) + pendingContext + |= + 8; + else + pendingContext + = 0; - RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << pAd->bulkResetPipeid)); + DBGPRINT_RAW + (RT_DEBUG_ERROR, + ("\tTX Occupied by %d!\n", + pendingContext)); } - - RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); - //RTUSBKickBulkOut(pAd); + // no matter what, clean the flag + RTMP_CLEAR_FLAG(pAd, + fRTMP_ADAPTER_BULKOUT_RESET); + + RTMP_INT_UNLOCK(&pAd-> + BulkOutLock + [pAd-> + bulkResetPipeid], + IrqFlags); + + RTUSB_SET_BULK_FLAG(pAd, + (fRTUSB_BULK_OUT_DATA_NORMAL + << + pAd-> + bulkResetPipeid)); } + RTMPDeQueuePacket(pAd, FALSE, + NUM_OF_TX_RING, + MAX_TX_PROCESS); + //RTUSBKickBulkOut(pAd); } - /* - // Don't cancel BULKIN. - while ((atomic_read(&pAd->PendingRx) > 0) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) - { - if (atomic_read(&pAd->PendingRx) > 0) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("BulkIn IRP Pending!!cancel it!\n")); - RTUSBCancelPendingBulkInIRP(pAd); - } - RTMPusecDelay(100000); - } - - if ((atomic_read(&pAd->PendingRx) == 0) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS))) - { - UCHAR i; - RTUSBRxPacket(pAd); - pAd->NextRxBulkInReadIndex = 0; // Next Rx Read index - pAd->NextRxBulkInIndex = 0; // Rx Bulk pointer - for (i = 0; i < (RX_RING_SIZE); i++) - { - PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); - - pRxContext->pAd = pAd; - pRxContext->InUse = FALSE; - pRxContext->IRPPending = FALSE; - pRxContext->Readable = FALSE; - pRxContext->ReorderInUse = FALSE; - - } - RTUSBBulkReceive(pAd); - DBGPRINT_RAW(RT_DEBUG_ERROR, ("RTUSBBulkReceive\n")); - }*/ - DBGPRINT_RAW(RT_DEBUG_TRACE, ("CmdThread : CMDTHREAD_RESET_BULK_OUT<===\n")); - break; - case CMDTHREAD_RESET_BULK_IN: - DBGPRINT_RAW(RT_DEBUG_TRACE, ("CmdThread : CMDTHREAD_RESET_BULK_IN === >\n")); + } + /* + // Don't cancel BULKIN. + while ((atomic_read(&pAd->PendingRx) > 0) && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) + { + if (atomic_read(&pAd->PendingRx) > 0) + { + DBGPRINT_RAW(RT_DEBUG_ERROR, ("BulkIn IRP Pending!!cancel it!\n")); + RTUSBCancelPendingBulkInIRP(pAd); + } + RTMPusecDelay(100000); + } + + if ((atomic_read(&pAd->PendingRx) == 0) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS))) + { + UCHAR i; + RTUSBRxPacket(pAd); + pAd->NextRxBulkInReadIndex = 0; // Next Rx Read index + pAd->NextRxBulkInIndex = 0; // Rx Bulk pointer + for (i = 0; i < (RX_RING_SIZE); i++) + { + PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); + + pRxContext->pAd = pAd; + pRxContext->InUse = FALSE; + pRxContext->IRPPending = FALSE; + pRxContext->Readable = FALSE; + pRxContext->ReorderInUse = FALSE; + + } + RTUSBBulkReceive(pAd); + DBGPRINT_RAW(RT_DEBUG_ERROR, ("RTUSBBulkReceive\n")); + } */ + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("CmdThread : CMDTHREAD_RESET_BULK_OUT<===\n")); + break; + + case CMDTHREAD_RESET_BULK_IN: + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("CmdThread : CMDTHREAD_RESET_BULK_IN === >\n")); + + // All transfers must be aborted or cancelled before attempting to reset the pipe. + { + UINT32 MACValue; - // All transfers must be aborted or cancelled before attempting to reset the pipe. { - UINT32 MACValue; - - { //while ((atomic_read(&pAd->PendingRx) > 0) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) - if((pAd->PendingRx > 0) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) + if ((pAd->PendingRx > 0) + && + (!RTMP_TEST_FLAG + (pAd, + fRTMP_ADAPTER_NIC_NOT_EXIST))) { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("BulkIn IRP Pending!!!\n")); - RTUSBCancelPendingBulkInIRP(pAd); + DBGPRINT_RAW + (RT_DEBUG_ERROR, + ("BulkIn IRP Pending!!!\n")); + RTUSBCancelPendingBulkInIRP + (pAd); RTMPusecDelay(100000); pAd->PendingRx = 0; } - } - - // Wait 10ms before reading register. - RTMPusecDelay(10000); - ntStatus = RTUSBReadMACRegister(pAd, MAC_CSR0, &MACValue); - - if ((NT_SUCCESS(ntStatus) == TRUE) && - (!(RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_RADIO_OFF | - fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))))) - { - UCHAR i; + } - if (RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_RADIO_OFF | - fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))) + // Wait 10ms before reading register. + RTMPusecDelay(10000); + ntStatus = + RTUSBReadMACRegister(pAd, MAC_CSR0, + &MACValue); + + if ((NT_SUCCESS(ntStatus) == TRUE) && + (!(RTMP_TEST_FLAG + (pAd, + (fRTMP_ADAPTER_RESET_IN_PROGRESS + | fRTMP_ADAPTER_RADIO_OFF | + fRTMP_ADAPTER_HALT_IN_PROGRESS + | + fRTMP_ADAPTER_NIC_NOT_EXIST))))) + { + UCHAR i; + + if (RTMP_TEST_FLAG + (pAd, + (fRTMP_ADAPTER_RESET_IN_PROGRESS + | fRTMP_ADAPTER_RADIO_OFF + | + fRTMP_ADAPTER_HALT_IN_PROGRESS + | + fRTMP_ADAPTER_NIC_NOT_EXIST))) + break; + pAd->NextRxBulkInPosition = + pAd->RxContext[pAd-> + NextRxBulkInIndex]. + BulkInOffset; + DBGPRINT(RT_DEBUG_TRACE, + ("BULK_IN_RESET: NBIIdx=0x%x,NBIRIdx=0x%x, BIRPos=0x%lx. BIReq=x%lx, BIComplete=0x%lx, BICFail0x%lx\n", + pAd-> + NextRxBulkInIndex, + pAd-> + NextRxBulkInReadIndex, + pAd-> + NextRxBulkInPosition, + pAd->BulkInReq, + pAd->BulkInComplete, + pAd-> + BulkInCompleteFail)); + for (i = 0; i < RX_RING_SIZE; + i++) { + DBGPRINT(RT_DEBUG_TRACE, + ("\tRxContext[%d]: IRPPending=%d, InUse=%d, Readable=%d!\n", + i, + pAd-> + RxContext[i]. + IRPPending, + pAd-> + RxContext[i]. + InUse, + pAd-> + RxContext[i]. + Readable)); + } + /* + + DBGPRINT_RAW(RT_DEBUG_ERROR, ("==========================================\n")); + + pAd->NextRxBulkInReadIndex = 0; // Next Rx Read index + pAd->NextRxBulkInIndex = 0; // Rx Bulk pointer + for (i = 0; i < (RX_RING_SIZE); i++) + { + PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); + + pRxContext->pAd = pAd; + pRxContext->InUse = FALSE; + pRxContext->IRPPending = FALSE; + pRxContext->Readable = FALSE; + pRxContext->ReorderInUse = FALSE; + + } */ + RTMP_CLEAR_FLAG(pAd, + fRTMP_ADAPTER_BULKIN_RESET); + for (i = 0; + i < + pAd->CommonCfg. + NumOfBulkInIRP; i++) { + //RTUSBBulkReceive(pAd); + PRX_CONTEXT pRxContext; + PURB pUrb; + int ret = 0; + unsigned long IrqFlags; + + RTMP_IRQ_LOCK(&pAd-> + BulkInLock, + IrqFlags); + pRxContext = + &(pAd-> + RxContext[pAd-> + NextRxBulkInIndex]); + if ((pAd->PendingRx > 0) + || (pRxContext-> + Readable == + TRUE) + || (pRxContext-> + InUse == + TRUE)) { + RTMP_IRQ_UNLOCK + (&pAd-> + BulkInLock, + IrqFlags); break; - pAd->NextRxBulkInPosition = pAd->RxContext[pAd->NextRxBulkInIndex].BulkInOffset; - DBGPRINT(RT_DEBUG_TRACE, ("BULK_IN_RESET: NBIIdx=0x%x,NBIRIdx=0x%x, BIRPos=0x%lx. BIReq=x%lx, BIComplete=0x%lx, BICFail0x%lx\n", - pAd->NextRxBulkInIndex, pAd->NextRxBulkInReadIndex, pAd->NextRxBulkInPosition, pAd->BulkInReq, pAd->BulkInComplete, pAd->BulkInCompleteFail)); - for (i = 0; i < RX_RING_SIZE; i++) - { - DBGPRINT(RT_DEBUG_TRACE, ("\tRxContext[%d]: IRPPending=%d, InUse=%d, Readable=%d!\n" - , i, pAd->RxContext[i].IRPPending, pAd->RxContext[i].InUse, pAd->RxContext[i].Readable)); - } - /* - - DBGPRINT_RAW(RT_DEBUG_ERROR, ("==========================================\n")); - - pAd->NextRxBulkInReadIndex = 0; // Next Rx Read index - pAd->NextRxBulkInIndex = 0; // Rx Bulk pointer - for (i = 0; i < (RX_RING_SIZE); i++) - { - PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); - - pRxContext->pAd = pAd; - pRxContext->InUse = FALSE; - pRxContext->IRPPending = FALSE; - pRxContext->Readable = FALSE; - pRxContext->ReorderInUse = FALSE; - - }*/ - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BULKIN_RESET); - for (i = 0; i < pAd->CommonCfg.NumOfBulkInIRP; i++) - { - //RTUSBBulkReceive(pAd); - PRX_CONTEXT pRxContext; - PURB pUrb; - int ret = 0; - unsigned long IrqFlags; - - - RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags); - pRxContext = &(pAd->RxContext[pAd->NextRxBulkInIndex]); - if ((pAd->PendingRx > 0) || (pRxContext->Readable == TRUE) || (pRxContext->InUse == TRUE)) - { - RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); - break; - } - pRxContext->InUse = TRUE; - pRxContext->IRPPending = TRUE; - pAd->PendingRx++; - pAd->BulkInReq++; - RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); - - // Init Rx context descriptor - RTUSBInitRxDesc(pAd, pRxContext); - pUrb = pRxContext->pUrb; - if ((ret = RTUSB_SUBMIT_URB(pUrb))!=0) - { // fail - - RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags); - pRxContext->InUse = FALSE; - pRxContext->IRPPending = FALSE; - pAd->PendingRx--; - pAd->BulkInReq--; - RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); - DBGPRINT(RT_DEBUG_ERROR, ("CMDTHREAD_RESET_BULK_IN: Submit Rx URB failed(%d), status=%d\n", ret, pUrb->status)); - } - else - { // success - //DBGPRINT(RT_DEBUG_TRACE, ("BIDone, Pend=%d,BIIdx=%d,BIRIdx=%d!\n", - // pAd->PendingRx, pAd->NextRxBulkInIndex, pAd->NextRxBulkInReadIndex)); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("CMDTHREAD_RESET_BULK_IN: Submit Rx URB Done, status=%d!\n", pUrb->status)); - ASSERT((pRxContext->InUse == pRxContext->IRPPending)); - } } - - } - else - { - // Card must be removed - if (NT_SUCCESS(ntStatus) != TRUE) - { - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST); - DBGPRINT_RAW(RT_DEBUG_ERROR, ("CMDTHREAD_RESET_BULK_IN: Read Register Failed!Card must be removed!!\n\n")); + pRxContext->InUse = + TRUE; + pRxContext->IRPPending = + TRUE; + pAd->PendingRx++; + pAd->BulkInReq++; + RTMP_IRQ_UNLOCK(&pAd-> + BulkInLock, + IrqFlags); + + // Init Rx context descriptor + RTUSBInitRxDesc(pAd, + pRxContext); + pUrb = pRxContext->pUrb; + if ((ret = RTUSB_SUBMIT_URB(pUrb)) != 0) { // fail + + RTMP_IRQ_LOCK + (&pAd-> + BulkInLock, + IrqFlags); + pRxContext-> + InUse = + FALSE; + pRxContext-> + IRPPending = + FALSE; + pAd-> + PendingRx--; + pAd-> + BulkInReq--; + RTMP_IRQ_UNLOCK + (&pAd-> + BulkInLock, + IrqFlags); + DBGPRINT + (RT_DEBUG_ERROR, + ("CMDTHREAD_RESET_BULK_IN: Submit Rx URB failed(%d), status=%d\n", + ret, + pUrb-> + status)); + } else { // success + //DBGPRINT(RT_DEBUG_TRACE, ("BIDone, Pend=%d,BIIdx=%d,BIRIdx=%d!\n", + // pAd->PendingRx, pAd->NextRxBulkInIndex, pAd->NextRxBulkInReadIndex)); + DBGPRINT_RAW + (RT_DEBUG_TRACE, + ("CMDTHREAD_RESET_BULK_IN: Submit Rx URB Done, status=%d!\n", + pUrb-> + status)); + ASSERT((pRxContext->InUse == pRxContext->IRPPending)); } - else - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("CMDTHREAD_RESET_BULK_IN: Cannot do bulk in because flags(0x%lx) on !\n", pAd->Flags)); } - } - } - DBGPRINT_RAW(RT_DEBUG_TRACE, ("CmdThread : CMDTHREAD_RESET_BULK_IN <===\n")); - break; - - case CMDTHREAD_SET_ASIC_WCID: - { - RT_SET_ASIC_WCID SetAsicWcid; - USHORT offset; - UINT32 MACValue, MACRValue = 0; - SetAsicWcid = *((PRT_SET_ASIC_WCID)(pData)); - - if (SetAsicWcid.WCID >= MAX_LEN_OF_MAC_TABLE) - return; - - offset = MAC_WCID_BASE + ((UCHAR)SetAsicWcid.WCID)*HW_WCID_ENTRY_SIZE; - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("CmdThread : CMDTHREAD_SET_ASIC_WCID : WCID = %ld, SetTid = %lx, DeleteTid = %lx.\n", SetAsicWcid.WCID, SetAsicWcid.SetTid, SetAsicWcid.DeleteTid)); - MACValue = (pAd->MacTab.Content[SetAsicWcid.WCID].Addr[3]<<24)+(pAd->MacTab.Content[SetAsicWcid.WCID].Addr[2]<<16)+(pAd->MacTab.Content[SetAsicWcid.WCID].Addr[1]<<8)+(pAd->MacTab.Content[SetAsicWcid.WCID].Addr[0]); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("1-MACValue= %x,\n", MACValue)); - RTUSBWriteMACRegister(pAd, offset, MACValue); - // Read bitmask - RTUSBReadMACRegister(pAd, offset+4, &MACRValue); - if ( SetAsicWcid.DeleteTid != 0xffffffff) - MACRValue &= (~SetAsicWcid.DeleteTid); - if (SetAsicWcid.SetTid != 0xffffffff) - MACRValue |= (SetAsicWcid.SetTid); - MACRValue &= 0xffff0000; - - MACValue = (pAd->MacTab.Content[SetAsicWcid.WCID].Addr[5]<<8)+pAd->MacTab.Content[SetAsicWcid.WCID].Addr[4]; - MACValue |= MACRValue; - RTUSBWriteMACRegister(pAd, offset+4, MACValue); - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("2-MACValue= %x,\n", MACValue)); - } - break; - - case CMDTHREAD_SET_ASIC_WCID_CIPHER: - { - RT_SET_ASIC_WCID_ATTRI SetAsicWcidAttri; - USHORT offset; - UINT32 MACRValue = 0; - SHAREDKEY_MODE_STRUC csr1; - SetAsicWcidAttri = *((PRT_SET_ASIC_WCID_ATTRI)(pData)); - - if (SetAsicWcidAttri.WCID >= MAX_LEN_OF_MAC_TABLE) - return; - - offset = MAC_WCID_ATTRIBUTE_BASE + ((UCHAR)SetAsicWcidAttri.WCID)*HW_WCID_ATTRI_SIZE; - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("Cmd : CMDTHREAD_SET_ASIC_WCID_CIPHER : WCID = %ld, Cipher = %lx.\n", SetAsicWcidAttri.WCID, SetAsicWcidAttri.Cipher)); - // Read bitmask - RTUSBReadMACRegister(pAd, offset, &MACRValue); - MACRValue = 0; - MACRValue |= (((UCHAR)SetAsicWcidAttri.Cipher) << 1); - - RTUSBWriteMACRegister(pAd, offset, MACRValue); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("2-offset = %x , MACValue= %x,\n", offset, MACRValue)); - - offset = PAIRWISE_IVEIV_TABLE_BASE + ((UCHAR)SetAsicWcidAttri.WCID)*HW_IVEIV_ENTRY_SIZE; - MACRValue = 0; - if ( (SetAsicWcidAttri.Cipher <= CIPHER_WEP128)) - MACRValue |= ( pAd->StaCfg.DefaultKeyId << 30); - else - MACRValue |= (0x20000000); - RTUSBWriteMACRegister(pAd, offset, MACRValue); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("2-offset = %x , MACValue= %x,\n", offset, MACRValue)); - - // - // Update cipher algorithm. WSTA always use BSS0 - // - // for adhoc mode only ,because wep status slow than add key, when use zero config - if (pAd->StaCfg.BssType == BSS_ADHOC ) - { - offset = MAC_WCID_ATTRIBUTE_BASE; - RTUSBReadMACRegister(pAd, offset, &MACRValue); - MACRValue &= (~0xe); - MACRValue |= (((UCHAR)SetAsicWcidAttri.Cipher) << 1); - - RTUSBWriteMACRegister(pAd, offset, MACRValue); - - //Update group key cipher,,because wep status slow than add key, when use zero config - RTUSBReadMACRegister(pAd, SHARED_KEY_MODE_BASE+4*(0/2), &csr1.word); - - csr1.field.Bss0Key0CipherAlg = SetAsicWcidAttri.Cipher; - csr1.field.Bss0Key1CipherAlg = SetAsicWcidAttri.Cipher; - - RTUSBWriteMACRegister(pAd, SHARED_KEY_MODE_BASE+4*(0/2), csr1.word); + } else { + // Card must be removed + if (NT_SUCCESS(ntStatus) != + TRUE) { + RTMP_SET_FLAG(pAd, + fRTMP_ADAPTER_NIC_NOT_EXIST); + DBGPRINT_RAW + (RT_DEBUG_ERROR, + ("CMDTHREAD_RESET_BULK_IN: Read Register Failed!Card must be removed!!\n\n")); + } else { + DBGPRINT_RAW + (RT_DEBUG_ERROR, + ("CMDTHREAD_RESET_BULK_IN: Cannot do bulk in because flags(0x%lx) on !\n", + pAd->Flags)); } } - break; - -//Benson modified for USB interface, avoid in interrupt when write key, 20080724 --> - case RT_CMD_SET_KEY_TABLE: //General call for AsicAddPairwiseKeyEntry() - { - RT_ADD_PAIRWISE_KEY_ENTRY KeyInfo; - KeyInfo = *((PRT_ADD_PAIRWISE_KEY_ENTRY)(pData)); - AsicAddPairwiseKeyEntry(pAd, - KeyInfo.MacAddr, - (UCHAR)KeyInfo.MacTabMatchWCID, - &KeyInfo.CipherKey); + } + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("CmdThread : CMDTHREAD_RESET_BULK_IN <===\n")); + break; + + case CMDTHREAD_SET_ASIC_WCID: + { + RT_SET_ASIC_WCID SetAsicWcid; + USHORT offset; + UINT32 MACValue, MACRValue = 0; + SetAsicWcid = + *((PRT_SET_ASIC_WCID) (pData)); + + if (SetAsicWcid.WCID >= + MAX_LEN_OF_MAC_TABLE) + return; + + offset = + MAC_WCID_BASE + + ((UCHAR) SetAsicWcid.WCID) * + HW_WCID_ENTRY_SIZE; + + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("CmdThread : CMDTHREAD_SET_ASIC_WCID : WCID = %ld, SetTid = %lx, DeleteTid = %lx.\n", + SetAsicWcid.WCID, + SetAsicWcid.SetTid, + SetAsicWcid.DeleteTid)); + MACValue = + (pAd->MacTab. + Content[SetAsicWcid.WCID]. + Addr[3] << 24) + + (pAd->MacTab. + Content[SetAsicWcid.WCID]. + Addr[2] << 16) + + (pAd->MacTab. + Content[SetAsicWcid.WCID]. + Addr[1] << 8) + + (pAd->MacTab. + Content[SetAsicWcid.WCID].Addr[0]); + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("1-MACValue= %x,\n", + MACValue)); + RTUSBWriteMACRegister(pAd, offset, + MACValue); + // Read bitmask + RTUSBReadMACRegister(pAd, offset + 4, + &MACRValue); + if (SetAsicWcid.DeleteTid != 0xffffffff) + MACRValue &= + (~SetAsicWcid.DeleteTid); + if (SetAsicWcid.SetTid != 0xffffffff) + MACRValue |= + (SetAsicWcid.SetTid); + MACRValue &= 0xffff0000; + + MACValue = + (pAd->MacTab. + Content[SetAsicWcid.WCID]. + Addr[5] << 8) + + pAd->MacTab.Content[SetAsicWcid. + WCID].Addr[4]; + MACValue |= MACRValue; + RTUSBWriteMACRegister(pAd, offset + 4, + MACValue); + + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("2-MACValue= %x,\n", + MACValue)); + } + break; + + case CMDTHREAD_SET_ASIC_WCID_CIPHER: + { + RT_SET_ASIC_WCID_ATTRI SetAsicWcidAttri; + USHORT offset; + UINT32 MACRValue = 0; + SHAREDKEY_MODE_STRUC csr1; + SetAsicWcidAttri = + *((PRT_SET_ASIC_WCID_ATTRI) + (pData)); + + if (SetAsicWcidAttri.WCID >= + MAX_LEN_OF_MAC_TABLE) + return; + + offset = + MAC_WCID_ATTRIBUTE_BASE + + ((UCHAR) SetAsicWcidAttri.WCID) * + HW_WCID_ATTRI_SIZE; + + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("Cmd : CMDTHREAD_SET_ASIC_WCID_CIPHER : WCID = %ld, Cipher = %lx.\n", + SetAsicWcidAttri.WCID, + SetAsicWcidAttri.Cipher)); + // Read bitmask + RTUSBReadMACRegister(pAd, offset, + &MACRValue); + MACRValue = 0; + MACRValue |= + (((UCHAR) SetAsicWcidAttri. + Cipher) << 1); + + RTUSBWriteMACRegister(pAd, offset, + MACRValue); + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("2-offset = %x , MACValue= %x,\n", + offset, MACRValue)); + + offset = + PAIRWISE_IVEIV_TABLE_BASE + + ((UCHAR) SetAsicWcidAttri.WCID) * + HW_IVEIV_ENTRY_SIZE; + MACRValue = 0; + if ((SetAsicWcidAttri.Cipher <= + CIPHER_WEP128)) + MACRValue |= + (pAd->StaCfg. + DefaultKeyId << 30); + else + MACRValue |= (0x20000000); + RTUSBWriteMACRegister(pAd, offset, + MACRValue); + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("2-offset = %x , MACValue= %x,\n", + offset, MACRValue)); + + // + // Update cipher algorithm. WSTA always use BSS0 + // + // for adhoc mode only ,because wep status slow than add key, when use zero config + if (pAd->StaCfg.BssType == BSS_ADHOC) { + offset = + MAC_WCID_ATTRIBUTE_BASE; + + RTUSBReadMACRegister(pAd, + offset, + &MACRValue); + MACRValue &= (~0xe); + MACRValue |= + (((UCHAR) SetAsicWcidAttri. + Cipher) << 1); + + RTUSBWriteMACRegister(pAd, + offset, + MACRValue); + + //Update group key cipher,,because wep status slow than add key, when use zero config + RTUSBReadMACRegister(pAd, + SHARED_KEY_MODE_BASE + + + 4 * (0 / + 2), + &csr1. + word); + + csr1.field.Bss0Key0CipherAlg = + SetAsicWcidAttri.Cipher; + csr1.field.Bss0Key1CipherAlg = + SetAsicWcidAttri.Cipher; + + RTUSBWriteMACRegister(pAd, + SHARED_KEY_MODE_BASE + + + 4 * (0 / + 2), + csr1. + word); } - break; + } + break; - case RT_CMD_SET_RX_WCID_TABLE: //General call for RTMPAddWcidAttributeEntry() - { - PMAC_TABLE_ENTRY pEntry ; - UCHAR KeyIdx = 0; - UCHAR CipherAlg = CIPHER_NONE; - UCHAR ApIdx = BSS0; - - pEntry = (PMAC_TABLE_ENTRY)(pData); - - - - RTMPAddWcidAttributeEntry( - pAd, - ApIdx, - KeyIdx, - CipherAlg, - pEntry); - } - break; +//Benson modified for USB interface, avoid in interrupt when write key, 20080724 --> + case RT_CMD_SET_KEY_TABLE: //General call for AsicAddPairwiseKeyEntry() + { + RT_ADD_PAIRWISE_KEY_ENTRY KeyInfo; + KeyInfo = + *((PRT_ADD_PAIRWISE_KEY_ENTRY) + (pData)); + AsicAddPairwiseKeyEntry(pAd, + KeyInfo.MacAddr, + (UCHAR) KeyInfo. + MacTabMatchWCID, + &KeyInfo. + CipherKey); + } + break; + + case RT_CMD_SET_RX_WCID_TABLE: //General call for RTMPAddWcidAttributeEntry() + { + PMAC_TABLE_ENTRY pEntry; + UCHAR KeyIdx = 0; + UCHAR CipherAlg = CIPHER_NONE; + UCHAR ApIdx = BSS0; + + pEntry = (PMAC_TABLE_ENTRY) (pData); + + RTMPAddWcidAttributeEntry(pAd, + ApIdx, + KeyIdx, + CipherAlg, + pEntry); + } + break; //Benson modified for USB interface, avoid in interrupt when write key, 20080724 <-- - case CMDTHREAD_SET_CLIENT_MAC_ENTRY: - { - MAC_TABLE_ENTRY *pEntry; - pEntry = (MAC_TABLE_ENTRY *)pData; + case CMDTHREAD_SET_CLIENT_MAC_ENTRY: + { + MAC_TABLE_ENTRY *pEntry; + pEntry = (MAC_TABLE_ENTRY *) pData; + { + AsicRemovePairwiseKeyEntry(pAd, + pEntry-> + apidx, + (UCHAR) + pEntry-> + Aid); + if ((pEntry->AuthMode <= + Ndis802_11AuthModeAutoSwitch) + && (pEntry->WepStatus == + Ndis802_11Encryption1Enabled)) { - AsicRemovePairwiseKeyEntry(pAd, pEntry->apidx, (UCHAR)pEntry->Aid); - if ((pEntry->AuthMode <= Ndis802_11AuthModeAutoSwitch) && (pEntry->WepStatus == Ndis802_11Encryption1Enabled)) - { - UINT32 uIV = 1; - PUCHAR ptr; - - ptr = (PUCHAR) &uIV; - *(ptr + 3) = (pAd->StaCfg.DefaultKeyId << 6); - AsicUpdateWCIDIVEIV(pAd, pEntry->Aid, uIV, 0); - AsicUpdateWCIDAttribute(pAd, pEntry->Aid, BSS0, pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg, FALSE); - } - else if (pEntry->AuthMode == Ndis802_11AuthModeWPANone) - { - UINT32 uIV = 1; - PUCHAR ptr; - - ptr = (PUCHAR) &uIV; - *(ptr + 3) = (pAd->StaCfg.DefaultKeyId << 6); - AsicUpdateWCIDIVEIV(pAd, pEntry->Aid, uIV, 0); - AsicUpdateWCIDAttribute(pAd, pEntry->Aid, BSS0, pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].CipherAlg, FALSE); - } - else - { - // - // Other case, disable engine. - // Don't worry WPA key, we will add WPA Key after 4-Way handshaking. - // - USHORT offset; - offset = MAC_WCID_ATTRIBUTE_BASE + (pEntry->Aid * HW_WCID_ATTRI_SIZE); - // RX_PKEY_MODE:0 for no security; RX_KEY_TAB:0 for shared key table; BSS_IDX:0 - RTUSBWriteMACRegister(pAd, offset, 0); - } + UINT32 uIV = 1; + PUCHAR ptr; + + ptr = (PUCHAR) & uIV; + *(ptr + 3) = + (pAd->StaCfg. + DefaultKeyId << 6); + AsicUpdateWCIDIVEIV(pAd, + pEntry-> + Aid, + uIV, + 0); + AsicUpdateWCIDAttribute + (pAd, pEntry->Aid, + BSS0, + pAd-> + SharedKey[BSS0] + [pAd->StaCfg. + DefaultKeyId]. + CipherAlg, FALSE); + } else if (pEntry->AuthMode == + Ndis802_11AuthModeWPANone) + { + UINT32 uIV = 1; + PUCHAR ptr; + + ptr = (PUCHAR) & uIV; + *(ptr + 3) = + (pAd->StaCfg. + DefaultKeyId << 6); + AsicUpdateWCIDIVEIV(pAd, + pEntry-> + Aid, + uIV, + 0); + AsicUpdateWCIDAttribute + (pAd, pEntry->Aid, + BSS0, + pAd-> + SharedKey[BSS0] + [pAd->StaCfg. + DefaultKeyId]. + CipherAlg, FALSE); + } else { + // + // Other case, disable engine. + // Don't worry WPA key, we will add WPA Key after 4-Way handshaking. + // + USHORT offset; + offset = + MAC_WCID_ATTRIBUTE_BASE + + + (pEntry->Aid * + HW_WCID_ATTRI_SIZE); + // RX_PKEY_MODE:0 for no security; RX_KEY_TAB:0 for shared key table; BSS_IDX:0 + RTUSBWriteMACRegister + (pAd, offset, 0); } - - AsicUpdateRxWCIDTable(pAd, pEntry->Aid, pEntry->Addr); - DBGPRINT(RT_DEBUG_TRACE, ("UpdateRxWCIDTable(): Aid=%d, Addr=%02x:%02x:%02x:%02x:%02x:%02x!\n", pEntry->Aid, - pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2], pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5])); } - break; + + AsicUpdateRxWCIDTable(pAd, pEntry->Aid, + pEntry->Addr); + DBGPRINT(RT_DEBUG_TRACE, + ("UpdateRxWCIDTable(): Aid=%d, Addr=%02x:%02x:%02x:%02x:%02x:%02x!\n", + pEntry->Aid, pEntry->Addr[0], + pEntry->Addr[1], + pEntry->Addr[2], + pEntry->Addr[3], + pEntry->Addr[4], + pEntry->Addr[5])); + } + break; // add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet - case CMDTHREAD_UPDATE_PROTECT: - { - AsicUpdateProtect(pAd, 0, (ALLN_SETPROTECT), TRUE, 0); - } - break; + case CMDTHREAD_UPDATE_PROTECT: + { + AsicUpdateProtect(pAd, 0, + (ALLN_SETPROTECT), + TRUE, 0); + } + break; // end johnli - case OID_802_11_ADD_WEP: - { - UINT i; - UINT32 KeyIdx; - PNDIS_802_11_WEP pWepKey; - - DBGPRINT(RT_DEBUG_TRACE, ("CmdThread::OID_802_11_ADD_WEP \n")); + case OID_802_11_ADD_WEP: + { + UINT i; + UINT32 KeyIdx; + PNDIS_802_11_WEP pWepKey; + + DBGPRINT(RT_DEBUG_TRACE, + ("CmdThread::OID_802_11_ADD_WEP \n")); + + pWepKey = (PNDIS_802_11_WEP) pData; + KeyIdx = pWepKey->KeyIndex & 0x0fffffff; + + // it is a shared key + if ((KeyIdx >= 4) + || ((pWepKey->KeyLength != 5) + && (pWepKey->KeyLength != + 13))) { + NdisStatus = + NDIS_STATUS_INVALID_DATA; + DBGPRINT(RT_DEBUG_ERROR, + ("CmdThread::OID_802_11_ADD_WEP, INVALID_DATA!!\n")); + } else { + UCHAR CipherAlg; + pAd->SharedKey[BSS0][KeyIdx]. + KeyLen = + (UCHAR) pWepKey->KeyLength; + NdisMoveMemory(pAd-> + SharedKey[BSS0] + [KeyIdx].Key, + &pWepKey-> + KeyMaterial, + pWepKey-> + KeyLength); + CipherAlg = + (pAd-> + SharedKey[BSS0][KeyIdx]. + KeyLen == + 5) ? CIPHER_WEP64 : + CIPHER_WEP128; - pWepKey = (PNDIS_802_11_WEP)pData; - KeyIdx = pWepKey->KeyIndex & 0x0fffffff; + // + // Change the WEP cipher to CKIP cipher if CKIP KP on. + // Funk UI or Meetinghouse UI will add ckip key from this path. + // - // it is a shared key - if ((KeyIdx >= 4) || ((pWepKey->KeyLength != 5) && (pWepKey->KeyLength != 13))) - { - NdisStatus = NDIS_STATUS_INVALID_DATA; - DBGPRINT(RT_DEBUG_ERROR, ("CmdThread::OID_802_11_ADD_WEP, INVALID_DATA!!\n")); + if (pAd->OpMode == OPMODE_STA) { + pAd->MacTab. + Content[BSSID_WCID]. + PairwiseKey. + CipherAlg = + pAd-> + SharedKey[BSS0] + [KeyIdx].CipherAlg; + pAd->MacTab. + Content[BSSID_WCID]. + PairwiseKey.KeyLen = + pAd-> + SharedKey[BSS0] + [KeyIdx].KeyLen; } - else - { - UCHAR CipherAlg; - pAd->SharedKey[BSS0][KeyIdx].KeyLen = (UCHAR) pWepKey->KeyLength; - NdisMoveMemory(pAd->SharedKey[BSS0][KeyIdx].Key, &pWepKey->KeyMaterial, pWepKey->KeyLength); - CipherAlg = (pAd->SharedKey[BSS0][KeyIdx].KeyLen == 5)? CIPHER_WEP64 : CIPHER_WEP128; - - // - // Change the WEP cipher to CKIP cipher if CKIP KP on. - // Funk UI or Meetinghouse UI will add ckip key from this path. - // - - if (pAd->OpMode == OPMODE_STA) - { - pAd->MacTab.Content[BSSID_WCID].PairwiseKey.CipherAlg = pAd->SharedKey[BSS0][KeyIdx].CipherAlg; - pAd->MacTab.Content[BSSID_WCID].PairwiseKey.KeyLen = pAd->SharedKey[BSS0][KeyIdx].KeyLen; - } - pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CipherAlg; - if (pWepKey->KeyIndex & 0x80000000) - { - // Default key for tx (shared key) - UCHAR IVEIV[8]; - UINT32 WCIDAttri, Value; - USHORT offset, offset2; - NdisZeroMemory(IVEIV, 8); - pAd->StaCfg.DefaultKeyId = (UCHAR) KeyIdx; - // Add BSSID to WCTable. because this is Tx wep key. - // WCID Attribute UDF:3, BSSIdx:3, Alg:3, Keytable:1=PAIRWISE KEY, BSSIdx is 0 - WCIDAttri = (CipherAlg<<1)|SHAREDKEYTABLE; - - offset = MAC_WCID_ATTRIBUTE_BASE + (BSSID_WCID* HW_WCID_ATTRI_SIZE); - RTUSBWriteMACRegister(pAd, offset, WCIDAttri); - // 1. IV/EIV - // Specify key index to find shared key. - IVEIV[3] = (UCHAR)(KeyIdx<< 6); //WEP Eiv bit off. groupkey index is not 0 - offset = PAIRWISE_IVEIV_TABLE_BASE + (BSS0Mcast_WCID * HW_IVEIV_ENTRY_SIZE); - offset2 = PAIRWISE_IVEIV_TABLE_BASE + (BSSID_WCID* HW_IVEIV_ENTRY_SIZE); - for (i=0; i<8;) - { - Value = IVEIV[i]; - Value += (IVEIV[i+1]<<8); - Value += (IVEIV[i+2]<<16); - Value += (IVEIV[i+3]<<24); - RTUSBWriteMACRegister(pAd, offset+i, Value); - RTUSBWriteMACRegister(pAd, offset2+i, Value); - i+=4; - } - - // 2. WCID Attribute UDF:3, BSSIdx:3, Alg:3, Keytable:use share key, BSSIdx is 0 - WCIDAttri = (pAd->SharedKey[BSS0][KeyIdx].CipherAlg<<1)|SHAREDKEYTABLE; - offset = MAC_WCID_ATTRIBUTE_BASE + (BSS0Mcast_WCID* HW_WCID_ATTRI_SIZE); - DBGPRINT(RT_DEBUG_TRACE, ("BSS0Mcast_WCID : offset = %x, WCIDAttri = %x\n", offset, WCIDAttri)); - RTUSBWriteMACRegister(pAd, offset, WCIDAttri); - + pAd->SharedKey[BSS0][KeyIdx]. + CipherAlg = CipherAlg; + if (pWepKey-> + KeyIndex & 0x80000000) { + // Default key for tx (shared key) + UCHAR IVEIV[8]; + UINT32 WCIDAttri, Value; + USHORT offset, offset2; + NdisZeroMemory(IVEIV, + 8); + pAd->StaCfg. + DefaultKeyId = + (UCHAR) KeyIdx; + // Add BSSID to WCTable. because this is Tx wep key. + // WCID Attribute UDF:3, BSSIdx:3, Alg:3, Keytable:1=PAIRWISE KEY, BSSIdx is 0 + WCIDAttri = + (CipherAlg << 1) | + SHAREDKEYTABLE; + + offset = + MAC_WCID_ATTRIBUTE_BASE + + + (BSSID_WCID * + HW_WCID_ATTRI_SIZE); + RTUSBWriteMACRegister + (pAd, offset, + WCIDAttri); + // 1. IV/EIV + // Specify key index to find shared key. + IVEIV[3] = (UCHAR) (KeyIdx << 6); //WEP Eiv bit off. groupkey index is not 0 + offset = + PAIRWISE_IVEIV_TABLE_BASE + + + (BSS0Mcast_WCID * + HW_IVEIV_ENTRY_SIZE); + offset2 = + PAIRWISE_IVEIV_TABLE_BASE + + + (BSSID_WCID * + HW_IVEIV_ENTRY_SIZE); + for (i = 0; i < 8;) { + Value = + IVEIV[i]; + Value += + (IVEIV + [i + + 1] << 8); + Value += + (IVEIV + [i + + 2] << 16); + Value += + (IVEIV + [i + + 3] << 24); + RTUSBWriteMACRegister + (pAd, + offset + i, + Value); + RTUSBWriteMACRegister + (pAd, + offset2 + + i, Value); + i += 4; } - AsicAddSharedKeyEntry(pAd, BSS0, (UCHAR)KeyIdx, CipherAlg, pWepKey->KeyMaterial, NULL, NULL); - DBGPRINT(RT_DEBUG_TRACE, ("CmdThread::OID_802_11_ADD_WEP (KeyIdx=%d, Len=%d-byte)\n", KeyIdx, pWepKey->KeyLength)); - } - } - break; - - case CMDTHREAD_802_11_COUNTER_MEASURE: - break; - - case CMDTHREAD_SET_GROUP_KEY: - WpaStaGroupKeySetting(pAd); - break; - case CMDTHREAD_SET_PAIRWISE_KEY: - WpaStaPairwiseKeySetting(pAd); - break; + // 2. WCID Attribute UDF:3, BSSIdx:3, Alg:3, Keytable:use share key, BSSIdx is 0 + WCIDAttri = + (pAd-> + SharedKey[BSS0] + [KeyIdx]. + CipherAlg << 1) | + SHAREDKEYTABLE; + offset = + MAC_WCID_ATTRIBUTE_BASE + + + (BSS0Mcast_WCID * + HW_WCID_ATTRI_SIZE); + DBGPRINT(RT_DEBUG_TRACE, + ("BSS0Mcast_WCID : offset = %x, WCIDAttri = %x\n", + offset, + WCIDAttri)); + RTUSBWriteMACRegister + (pAd, offset, + WCIDAttri); - case CMDTHREAD_SET_PSM_BIT: - { - USHORT *pPsm = (USHORT *)pData; - MlmeSetPsmBit(pAd, *pPsm); + } + AsicAddSharedKeyEntry(pAd, BSS0, + (UCHAR) + KeyIdx, + CipherAlg, + pWepKey-> + KeyMaterial, + NULL, + NULL); + DBGPRINT(RT_DEBUG_TRACE, + ("CmdThread::OID_802_11_ADD_WEP (KeyIdx=%d, Len=%d-byte)\n", + KeyIdx, + pWepKey->KeyLength)); } - break; - case CMDTHREAD_FORCE_WAKE_UP: - AsicForceWakeup(pAd, TRUE); - break; - - default: - DBGPRINT(RT_DEBUG_ERROR, ("--> Control Thread !! ERROR !! Unknown(cmdqelmt->command=0x%x) !! \n", cmdqelmt->command)); - break; + } + break; + + case CMDTHREAD_802_11_COUNTER_MEASURE: + break; + + case CMDTHREAD_SET_GROUP_KEY: + WpaStaGroupKeySetting(pAd); + break; + + case CMDTHREAD_SET_PAIRWISE_KEY: + WpaStaPairwiseKeySetting(pAd); + break; + + case CMDTHREAD_SET_PSM_BIT: + { + USHORT *pPsm = (USHORT *) pData; + MlmeSetPsmBit(pAd, *pPsm); + } + break; + case CMDTHREAD_FORCE_WAKE_UP: + AsicForceWakeup(pAd, TRUE); + break; + + default: + DBGPRINT(RT_DEBUG_ERROR, + ("--> Control Thread !! ERROR !! Unknown(cmdqelmt->command=0x%x) !! \n", + cmdqelmt->command)); + break; } } - if (cmdqelmt->CmdFromNdis == TRUE) - { - if (cmdqelmt->buffer != NULL) + if (cmdqelmt->CmdFromNdis == TRUE) { + if (cmdqelmt->buffer != NULL) os_free_mem(pAd, cmdqelmt->buffer); os_free_mem(pAd, cmdqelmt); - } - else - { - if ((cmdqelmt->buffer != NULL) && (cmdqelmt->bufferlength != 0)) + } else { + if ((cmdqelmt->buffer != NULL) + && (cmdqelmt->bufferlength != 0)) os_free_mem(pAd, cmdqelmt->buffer); os_free_mem(pAd, cmdqelmt); } - } /* end of while */ + } /* end of while */ } #endif // RTMP_MAC_USB // -- GitLab From 96b3c83dc27dca271594463aa99e166974a91171 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 11 Dec 2009 12:23:13 -0800 Subject: [PATCH 160/235] Staging: rt28x0: run common/*.c files through Lindent Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/common/action.c | 610 +- drivers/staging/rt2860/common/ba_action.c | 1454 ++--- drivers/staging/rt2860/common/cmm_aes.c | 1103 ++-- drivers/staging/rt2860/common/cmm_asic.c | 2443 +++---- drivers/staging/rt2860/common/cmm_cfg.c | 216 +- drivers/staging/rt2860/common/cmm_data.c | 1808 +++-- drivers/staging/rt2860/common/cmm_data_pci.c | 711 +- drivers/staging/rt2860/common/cmm_data_usb.c | 755 ++- drivers/staging/rt2860/common/cmm_info.c | 1056 ++- drivers/staging/rt2860/common/cmm_mac_pci.c | 1641 +++-- drivers/staging/rt2860/common/cmm_mac_usb.c | 703 +- drivers/staging/rt2860/common/cmm_sanity.c | 1606 +++-- drivers/staging/rt2860/common/cmm_sync.c | 734 ++- drivers/staging/rt2860/common/cmm_tkip.c | 627 +- drivers/staging/rt2860/common/cmm_wep.c | 186 +- drivers/staging/rt2860/common/cmm_wpa.c | 2920 ++++----- drivers/staging/rt2860/common/crypt_hmac.c | 231 +- drivers/staging/rt2860/common/crypt_md5.c | 373 +- drivers/staging/rt2860/common/crypt_sha2.c | 271 +- drivers/staging/rt2860/common/dfs.c | 12 +- drivers/staging/rt2860/common/ee_efuse.c | 234 +- drivers/staging/rt2860/common/ee_prom.c | 91 +- drivers/staging/rt2860/common/eeprom.c | 56 +- drivers/staging/rt2860/common/mlme.c | 6165 +++++++++--------- drivers/staging/rt2860/common/rt_channel.c | 2585 +++++--- drivers/staging/rt2860/common/rt_rf.c | 86 +- drivers/staging/rt2860/common/rtmp_init.c | 2375 ++++--- drivers/staging/rt2860/common/rtmp_mcu.c | 178 +- drivers/staging/rt2860/common/rtmp_timer.c | 119 +- drivers/staging/rt2860/common/spectrum.c | 1591 ++--- 30 files changed, 16252 insertions(+), 16688 deletions(-) diff --git a/drivers/staging/rt2860/common/action.c b/drivers/staging/rt2860/common/action.c index 5593966f0a94..f6efdb6671b3 100644 --- a/drivers/staging/rt2860/common/action.c +++ b/drivers/staging/rt2860/common/action.c @@ -39,10 +39,7 @@ #include "../rt_config.h" #include "action.h" - -static VOID ReservedAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +static VOID ReservedAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); /* ========================================================================== @@ -61,75 +58,89 @@ static VOID ReservedAction( MT2_CLS3ERR cls3err_action ========================================================================== */ -VOID ActionStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - OUT STATE_MACHINE_FUNC Trans[]) +VOID ActionStateMachineInit(IN PRTMP_ADAPTER pAd, + IN STATE_MACHINE * S, + OUT STATE_MACHINE_FUNC Trans[]) { - StateMachineInit(S, (STATE_MACHINE_FUNC *)Trans, MAX_ACT_STATE, MAX_ACT_MSG, (STATE_MACHINE_FUNC)Drop, ACT_IDLE, ACT_MACHINE_BASE); - - StateMachineSetAction(S, ACT_IDLE, MT2_PEER_SPECTRUM_CATE, (STATE_MACHINE_FUNC)PeerSpectrumAction); - StateMachineSetAction(S, ACT_IDLE, MT2_PEER_QOS_CATE, (STATE_MACHINE_FUNC)PeerQOSAction); - - StateMachineSetAction(S, ACT_IDLE, MT2_PEER_DLS_CATE, (STATE_MACHINE_FUNC)ReservedAction); - - StateMachineSetAction(S, ACT_IDLE, MT2_PEER_BA_CATE, (STATE_MACHINE_FUNC)PeerBAAction); - StateMachineSetAction(S, ACT_IDLE, MT2_PEER_HT_CATE, (STATE_MACHINE_FUNC)PeerHTAction); - StateMachineSetAction(S, ACT_IDLE, MT2_MLME_ADD_BA_CATE, (STATE_MACHINE_FUNC)MlmeADDBAAction); - StateMachineSetAction(S, ACT_IDLE, MT2_MLME_ORI_DELBA_CATE, (STATE_MACHINE_FUNC)MlmeDELBAAction); - StateMachineSetAction(S, ACT_IDLE, MT2_MLME_REC_DELBA_CATE, (STATE_MACHINE_FUNC)MlmeDELBAAction); - - StateMachineSetAction(S, ACT_IDLE, MT2_PEER_PUBLIC_CATE, (STATE_MACHINE_FUNC)PeerPublicAction); - StateMachineSetAction(S, ACT_IDLE, MT2_PEER_RM_CATE, (STATE_MACHINE_FUNC)PeerRMAction); - - StateMachineSetAction(S, ACT_IDLE, MT2_MLME_QOS_CATE, (STATE_MACHINE_FUNC)MlmeQOSAction); - StateMachineSetAction(S, ACT_IDLE, MT2_MLME_DLS_CATE, (STATE_MACHINE_FUNC)MlmeDLSAction); - StateMachineSetAction(S, ACT_IDLE, MT2_ACT_INVALID, (STATE_MACHINE_FUNC)MlmeInvalidAction); + StateMachineInit(S, (STATE_MACHINE_FUNC *) Trans, MAX_ACT_STATE, + MAX_ACT_MSG, (STATE_MACHINE_FUNC) Drop, ACT_IDLE, + ACT_MACHINE_BASE); + + StateMachineSetAction(S, ACT_IDLE, MT2_PEER_SPECTRUM_CATE, + (STATE_MACHINE_FUNC) PeerSpectrumAction); + StateMachineSetAction(S, ACT_IDLE, MT2_PEER_QOS_CATE, + (STATE_MACHINE_FUNC) PeerQOSAction); + + StateMachineSetAction(S, ACT_IDLE, MT2_PEER_DLS_CATE, + (STATE_MACHINE_FUNC) ReservedAction); + + StateMachineSetAction(S, ACT_IDLE, MT2_PEER_BA_CATE, + (STATE_MACHINE_FUNC) PeerBAAction); + StateMachineSetAction(S, ACT_IDLE, MT2_PEER_HT_CATE, + (STATE_MACHINE_FUNC) PeerHTAction); + StateMachineSetAction(S, ACT_IDLE, MT2_MLME_ADD_BA_CATE, + (STATE_MACHINE_FUNC) MlmeADDBAAction); + StateMachineSetAction(S, ACT_IDLE, MT2_MLME_ORI_DELBA_CATE, + (STATE_MACHINE_FUNC) MlmeDELBAAction); + StateMachineSetAction(S, ACT_IDLE, MT2_MLME_REC_DELBA_CATE, + (STATE_MACHINE_FUNC) MlmeDELBAAction); + + StateMachineSetAction(S, ACT_IDLE, MT2_PEER_PUBLIC_CATE, + (STATE_MACHINE_FUNC) PeerPublicAction); + StateMachineSetAction(S, ACT_IDLE, MT2_PEER_RM_CATE, + (STATE_MACHINE_FUNC) PeerRMAction); + + StateMachineSetAction(S, ACT_IDLE, MT2_MLME_QOS_CATE, + (STATE_MACHINE_FUNC) MlmeQOSAction); + StateMachineSetAction(S, ACT_IDLE, MT2_MLME_DLS_CATE, + (STATE_MACHINE_FUNC) MlmeDLSAction); + StateMachineSetAction(S, ACT_IDLE, MT2_ACT_INVALID, + (STATE_MACHINE_FUNC) MlmeInvalidAction); } -VOID MlmeADDBAAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) - +VOID MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { MLME_ADDBA_REQ_STRUCT *pInfo; - UCHAR Addr[6]; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG Idx; - FRAME_ADDBA_REQ Frame; - ULONG FrameLen; - BA_ORI_ENTRY *pBAEntry = NULL; - - pInfo = (MLME_ADDBA_REQ_STRUCT *)Elem->Msg; + UCHAR Addr[6]; + PUCHAR pOutBuffer = NULL; + NDIS_STATUS NStatus; + ULONG Idx; + FRAME_ADDBA_REQ Frame; + ULONG FrameLen; + BA_ORI_ENTRY *pBAEntry = NULL; + + pInfo = (MLME_ADDBA_REQ_STRUCT *) Elem->Msg; NdisZeroMemory(&Frame, sizeof(FRAME_ADDBA_REQ)); - if(MlmeAddBAReqSanity(pAd, Elem->Msg, Elem->MsgLen, Addr)) - { - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE,("BA - MlmeADDBAAction() allocate memory failed \n")); + if (MlmeAddBAReqSanity(pAd, Elem->Msg, Elem->MsgLen, Addr)) { + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_TRACE, + ("BA - MlmeADDBAAction() allocate memory failed \n")); return; } // 1. find entry - Idx = pAd->MacTab.Content[pInfo->Wcid].BAOriWcidArray[pInfo->TID]; - if (Idx == 0) - { + Idx = + pAd->MacTab.Content[pInfo->Wcid].BAOriWcidArray[pInfo->TID]; + if (Idx == 0) { MlmeFreeMemory(pAd, pOutBuffer); - DBGPRINT(RT_DEBUG_ERROR,("BA - MlmeADDBAAction() can't find BAOriEntry \n")); + DBGPRINT(RT_DEBUG_ERROR, + ("BA - MlmeADDBAAction() can't find BAOriEntry \n")); return; - } - else - { - pBAEntry =&pAd->BATable.BAOriEntry[Idx]; + } else { + pBAEntry = &pAd->BATable.BAOriEntry[Idx]; } { if (ADHOC_ON(pAd)) - ActHeaderInit(pAd, &Frame.Hdr, pInfo->pAddr, pAd->CurrentAddress, pAd->CommonCfg.Bssid); + ActHeaderInit(pAd, &Frame.Hdr, pInfo->pAddr, + pAd->CurrentAddress, + pAd->CommonCfg.Bssid); else - ActHeaderInit(pAd, &Frame.Hdr, pAd->CommonCfg.Bssid, pAd->CurrentAddress, pInfo->pAddr); + ActHeaderInit(pAd, &Frame.Hdr, + pAd->CommonCfg.Bssid, + pAd->CurrentAddress, + pInfo->pAddr); } Frame.Category = CATEGORY_BA; @@ -141,22 +152,29 @@ VOID MlmeADDBAAction( Frame.Token = pInfo->Token; Frame.TimeOutValue = pInfo->TimeOutValue; Frame.BaStartSeq.field.FragNum = 0; - Frame.BaStartSeq.field.StartSeq = pAd->MacTab.Content[pInfo->Wcid].TxSeq[pInfo->TID]; + Frame.BaStartSeq.field.StartSeq = + pAd->MacTab.Content[pInfo->Wcid].TxSeq[pInfo->TID]; - *(USHORT *)(&Frame.BaParm) = cpu2le16(*(USHORT *)(&Frame.BaParm)); + *(USHORT *) (&Frame.BaParm) = + cpu2le16(*(USHORT *) (&Frame.BaParm)); Frame.TimeOutValue = cpu2le16(Frame.TimeOutValue); Frame.BaStartSeq.word = cpu2le16(Frame.BaStartSeq.word); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_ADDBA_REQ), &Frame, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer, &FrameLen, + sizeof(FRAME_ADDBA_REQ), &Frame, END_OF_ARGS); - MiniportMMRequest(pAd, (MGMT_USE_QUEUE_FLAG | MapUserPriorityToAccessCategory[pInfo->TID]), pOutBuffer, FrameLen); + MiniportMMRequest(pAd, + (MGMT_USE_QUEUE_FLAG | + MapUserPriorityToAccessCategory[pInfo->TID]), + pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); - DBGPRINT(RT_DEBUG_TRACE, ("BA - Send ADDBA request. StartSeq = %x, FrameLen = %ld. BufSize = %d\n", Frame.BaStartSeq.field.StartSeq, FrameLen, Frame.BaParm.BufSize)); - } + DBGPRINT(RT_DEBUG_TRACE, + ("BA - Send ADDBA request. StartSeq = %x, FrameLen = %ld. BufSize = %d\n", + Frame.BaStartSeq.field.StartSeq, FrameLen, + Frame.BaParm.BufSize)); + } } /* @@ -170,282 +188,271 @@ VOID MlmeADDBAAction( ========================================================================== */ -VOID MlmeDELBAAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { MLME_DELBA_REQ_STRUCT *pInfo; - PUCHAR pOutBuffer = NULL; - PUCHAR pOutBuffer2 = NULL; - NDIS_STATUS NStatus; - ULONG Idx; - FRAME_DELBA_REQ Frame; - ULONG FrameLen; - FRAME_BAR FrameBar; - - pInfo = (MLME_DELBA_REQ_STRUCT *)Elem->Msg; + PUCHAR pOutBuffer = NULL; + PUCHAR pOutBuffer2 = NULL; + NDIS_STATUS NStatus; + ULONG Idx; + FRAME_DELBA_REQ Frame; + ULONG FrameLen; + FRAME_BAR FrameBar; + + pInfo = (MLME_DELBA_REQ_STRUCT *) Elem->Msg; // must send back DELBA NdisZeroMemory(&Frame, sizeof(FRAME_DELBA_REQ)); - DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeDELBAAction(), Initiator(%d) \n", pInfo->Initiator)); - - if(MlmeDelBAReqSanity(pAd, Elem->Msg, Elem->MsgLen)) - { - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_ERROR,("BA - MlmeDELBAAction() allocate memory failed 1. \n")); + DBGPRINT(RT_DEBUG_TRACE, + ("==> MlmeDELBAAction(), Initiator(%d) \n", pInfo->Initiator)); + + if (MlmeDelBAReqSanity(pAd, Elem->Msg, Elem->MsgLen)) { + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_ERROR, + ("BA - MlmeDELBAAction() allocate memory failed 1. \n")); return; } - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2); //Get an unused nonpaged memory + if (NStatus != NDIS_STATUS_SUCCESS) { MlmeFreeMemory(pAd, pOutBuffer); - DBGPRINT(RT_DEBUG_ERROR, ("BA - MlmeDELBAAction() allocate memory failed 2. \n")); + DBGPRINT(RT_DEBUG_ERROR, + ("BA - MlmeDELBAAction() allocate memory failed 2. \n")); return; } - // SEND BAR (Send BAR to refresh peer reordering buffer.) - Idx = pAd->MacTab.Content[pInfo->Wcid].BAOriWcidArray[pInfo->TID]; - - BarHeaderInit(pAd, &FrameBar, pAd->MacTab.Content[pInfo->Wcid].Addr, pAd->CurrentAddress); - - FrameBar.StartingSeq.field.FragNum = 0; // make sure sequence not clear in DEL funciton. - FrameBar.StartingSeq.field.StartSeq = pAd->MacTab.Content[pInfo->Wcid].TxSeq[pInfo->TID]; // make sure sequence not clear in DEL funciton. - FrameBar.BarControl.TID = pInfo->TID; // make sure sequence not clear in DEL funciton. - FrameBar.BarControl.ACKPolicy = IMMED_BA; // make sure sequence not clear in DEL funciton. - FrameBar.BarControl.Compressed = 1; // make sure sequence not clear in DEL funciton. - FrameBar.BarControl.MTID = 0; // make sure sequence not clear in DEL funciton. - - MakeOutgoingFrame(pOutBuffer2, &FrameLen, - sizeof(FRAME_BAR), &FrameBar, - END_OF_ARGS); + Idx = + pAd->MacTab.Content[pInfo->Wcid].BAOriWcidArray[pInfo->TID]; + + BarHeaderInit(pAd, &FrameBar, + pAd->MacTab.Content[pInfo->Wcid].Addr, + pAd->CurrentAddress); + + FrameBar.StartingSeq.field.FragNum = 0; // make sure sequence not clear in DEL funciton. + FrameBar.StartingSeq.field.StartSeq = pAd->MacTab.Content[pInfo->Wcid].TxSeq[pInfo->TID]; // make sure sequence not clear in DEL funciton. + FrameBar.BarControl.TID = pInfo->TID; // make sure sequence not clear in DEL funciton. + FrameBar.BarControl.ACKPolicy = IMMED_BA; // make sure sequence not clear in DEL funciton. + FrameBar.BarControl.Compressed = 1; // make sure sequence not clear in DEL funciton. + FrameBar.BarControl.MTID = 0; // make sure sequence not clear in DEL funciton. + + MakeOutgoingFrame(pOutBuffer2, &FrameLen, + sizeof(FRAME_BAR), &FrameBar, END_OF_ARGS); MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer2, FrameLen); MlmeFreeMemory(pAd, pOutBuffer2); - DBGPRINT(RT_DEBUG_TRACE,("BA - MlmeDELBAAction() . Send BAR to refresh peer reordering buffer \n")); + DBGPRINT(RT_DEBUG_TRACE, + ("BA - MlmeDELBAAction() . Send BAR to refresh peer reordering buffer \n")); // SEND DELBA FRAME FrameLen = 0; { if (ADHOC_ON(pAd)) - ActHeaderInit(pAd, &Frame.Hdr, pAd->MacTab.Content[pInfo->Wcid].Addr, pAd->CurrentAddress, pAd->CommonCfg.Bssid); + ActHeaderInit(pAd, &Frame.Hdr, + pAd->MacTab.Content[pInfo->Wcid]. + Addr, pAd->CurrentAddress, + pAd->CommonCfg.Bssid); else - ActHeaderInit(pAd, &Frame.Hdr, pAd->CommonCfg.Bssid, pAd->CurrentAddress, pAd->MacTab.Content[pInfo->Wcid].Addr); + ActHeaderInit(pAd, &Frame.Hdr, + pAd->CommonCfg.Bssid, + pAd->CurrentAddress, + pAd->MacTab.Content[pInfo->Wcid]. + Addr); } Frame.Category = CATEGORY_BA; Frame.Action = DELBA; Frame.DelbaParm.Initiator = pInfo->Initiator; Frame.DelbaParm.TID = pInfo->TID; - Frame.ReasonCode = 39; // Time Out - *(USHORT *)(&Frame.DelbaParm) = cpu2le16(*(USHORT *)(&Frame.DelbaParm)); + Frame.ReasonCode = 39; // Time Out + *(USHORT *) (&Frame.DelbaParm) = + cpu2le16(*(USHORT *) (&Frame.DelbaParm)); Frame.ReasonCode = cpu2le16(Frame.ReasonCode); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_DELBA_REQ), &Frame, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer, &FrameLen, + sizeof(FRAME_DELBA_REQ), &Frame, END_OF_ARGS); MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); - DBGPRINT(RT_DEBUG_TRACE, ("BA - MlmeDELBAAction() . 3 DELBA sent. Initiator(%d)\n", pInfo->Initiator)); - } + DBGPRINT(RT_DEBUG_TRACE, + ("BA - MlmeDELBAAction() . 3 DELBA sent. Initiator(%d)\n", + pInfo->Initiator)); + } } -VOID MlmeQOSAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID MlmeQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { } -VOID MlmeDLSAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID MlmeDLSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { } -VOID MlmeInvalidAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID MlmeInvalidAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - //PUCHAR pOutBuffer = NULL; + //PUCHAR pOutBuffer = NULL; //Return the receiving frame except the MSB of category filed set to 1. 7.3.1.11 } -VOID PeerQOSAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { } -VOID PeerBAAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Action = Elem->Msg[LENGTH_802_11+1]; - - switch(Action) - { - case ADDBA_REQ: - PeerAddBAReqAction(pAd,Elem); - break; - case ADDBA_RESP: - PeerAddBARspAction(pAd,Elem); - break; - case DELBA: - PeerDelBAAction(pAd,Elem); - break; + UCHAR Action = Elem->Msg[LENGTH_802_11 + 1]; + + switch (Action) { + case ADDBA_REQ: + PeerAddBAReqAction(pAd, Elem); + break; + case ADDBA_RESP: + PeerAddBARspAction(pAd, Elem); + break; + case DELBA: + PeerDelBAAction(pAd, Elem); + break; } } -VOID PeerPublicAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerPublicAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { if (Elem->Wcid >= MAX_LEN_OF_MAC_TABLE) return; } - -static VOID ReservedAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +static VOID ReservedAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { UCHAR Category; - if (Elem->MsgLen <= LENGTH_802_11) - { + if (Elem->MsgLen <= LENGTH_802_11) { return; } Category = Elem->Msg[LENGTH_802_11]; - DBGPRINT(RT_DEBUG_TRACE,("Rcv reserved category(%d) Action Frame\n", Category)); + DBGPRINT(RT_DEBUG_TRACE, + ("Rcv reserved category(%d) Action Frame\n", Category)); hex_dump("Reserved Action Frame", &Elem->Msg[0], Elem->MsgLen); } -VOID PeerRMAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) - +VOID PeerRMAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { return; } -static VOID respond_ht_information_exchange_action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +static VOID respond_ht_information_exchange_action(IN PRTMP_ADAPTER pAd, + IN MLME_QUEUE_ELEM * Elem) { - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen; - FRAME_HT_INFO HTINFOframe, *pFrame; - UCHAR *pAddr; - + PUCHAR pOutBuffer = NULL; + NDIS_STATUS NStatus; + ULONG FrameLen; + FRAME_HT_INFO HTINFOframe, *pFrame; + UCHAR *pAddr; // 2. Always send back ADDBA Response - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE,("ACTION - respond_ht_information_exchange_action() allocate memory failed \n")); + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_TRACE, + ("ACTION - respond_ht_information_exchange_action() allocate memory failed \n")); return; } - // get RA - pFrame = (FRAME_HT_INFO *) &Elem->Msg[0]; + pFrame = (FRAME_HT_INFO *) & Elem->Msg[0]; pAddr = pFrame->Hdr.Addr2; NdisZeroMemory(&HTINFOframe, sizeof(FRAME_HT_INFO)); // 2-1. Prepare ADDBA Response frame. { if (ADHOC_ON(pAd)) - ActHeaderInit(pAd, &HTINFOframe.Hdr, pAddr, pAd->CurrentAddress, pAd->CommonCfg.Bssid); + ActHeaderInit(pAd, &HTINFOframe.Hdr, pAddr, + pAd->CurrentAddress, + pAd->CommonCfg.Bssid); else - ActHeaderInit(pAd, &HTINFOframe.Hdr, pAd->CommonCfg.Bssid, pAd->CurrentAddress, pAddr); + ActHeaderInit(pAd, &HTINFOframe.Hdr, + pAd->CommonCfg.Bssid, pAd->CurrentAddress, + pAddr); } HTINFOframe.Category = CATEGORY_HT; HTINFOframe.Action = HT_INFO_EXCHANGE; HTINFOframe.HT_Info.Request = 0; - HTINFOframe.HT_Info.Forty_MHz_Intolerant = pAd->CommonCfg.HtCapability.HtCapInfo.Forty_Mhz_Intolerant; - HTINFOframe.HT_Info.STA_Channel_Width = pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth; + HTINFOframe.HT_Info.Forty_MHz_Intolerant = + pAd->CommonCfg.HtCapability.HtCapInfo.Forty_Mhz_Intolerant; + HTINFOframe.HT_Info.STA_Channel_Width = + pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth; - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_HT_INFO), &HTINFOframe, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer, &FrameLen, + sizeof(FRAME_HT_INFO), &HTINFOframe, END_OF_ARGS); MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); } -VOID PeerHTAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Action = Elem->Msg[LENGTH_802_11+1]; + UCHAR Action = Elem->Msg[LENGTH_802_11 + 1]; if (Elem->Wcid >= MAX_LEN_OF_MAC_TABLE) return; - switch(Action) - { - case NOTIFY_BW_ACTION: - DBGPRINT(RT_DEBUG_TRACE,("ACTION - HT Notify Channel bandwidth action----> \n")); - - if(pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) - { - // Note, this is to patch DIR-1353 AP. When the AP set to Wep, it will use legacy mode. But AP still keeps - // sending BW_Notify Action frame, and cause us to linkup and linkdown. - // In legacy mode, don't need to parse HT action frame. - DBGPRINT(RT_DEBUG_TRACE,("ACTION -Ignore HT Notify Channel BW when link as legacy mode. BW = %d---> \n", - Elem->Msg[LENGTH_802_11+2] )); - break; - } - - if (Elem->Msg[LENGTH_802_11+2] == 0) // 7.4.8.2. if value is 1, keep the same as supported channel bandwidth. - pAd->MacTab.Content[Elem->Wcid].HTPhyMode.field.BW = 0; - + switch (Action) { + case NOTIFY_BW_ACTION: + DBGPRINT(RT_DEBUG_TRACE, + ("ACTION - HT Notify Channel bandwidth action----> \n")); + + if (pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) { + // Note, this is to patch DIR-1353 AP. When the AP set to Wep, it will use legacy mode. But AP still keeps + // sending BW_Notify Action frame, and cause us to linkup and linkdown. + // In legacy mode, don't need to parse HT action frame. + DBGPRINT(RT_DEBUG_TRACE, + ("ACTION -Ignore HT Notify Channel BW when link as legacy mode. BW = %d---> \n", + Elem->Msg[LENGTH_802_11 + 2])); break; - case SMPS_ACTION: - // 7.3.1.25 - DBGPRINT(RT_DEBUG_TRACE,("ACTION - SMPS action----> \n")); - if (((Elem->Msg[LENGTH_802_11+2]&0x1) == 0)) - { - pAd->MacTab.Content[Elem->Wcid].MmpsMode = MMPS_ENABLE; - } - else if (((Elem->Msg[LENGTH_802_11+2]&0x2) == 0)) - { - pAd->MacTab.Content[Elem->Wcid].MmpsMode = MMPS_STATIC; - } - else - { - pAd->MacTab.Content[Elem->Wcid].MmpsMode = MMPS_DYNAMIC; - } + } - DBGPRINT(RT_DEBUG_TRACE,("Aid(%d) MIMO PS = %d\n", Elem->Wcid, pAd->MacTab.Content[Elem->Wcid].MmpsMode)); - // rt2860c : add something for smps change. - break; + if (Elem->Msg[LENGTH_802_11 + 2] == 0) // 7.4.8.2. if value is 1, keep the same as supported channel bandwidth. + pAd->MacTab.Content[Elem->Wcid].HTPhyMode.field.BW = 0; + + break; + case SMPS_ACTION: + // 7.3.1.25 + DBGPRINT(RT_DEBUG_TRACE, ("ACTION - SMPS action----> \n")); + if (((Elem->Msg[LENGTH_802_11 + 2] & 0x1) == 0)) { + pAd->MacTab.Content[Elem->Wcid].MmpsMode = MMPS_ENABLE; + } else if (((Elem->Msg[LENGTH_802_11 + 2] & 0x2) == 0)) { + pAd->MacTab.Content[Elem->Wcid].MmpsMode = MMPS_STATIC; + } else { + pAd->MacTab.Content[Elem->Wcid].MmpsMode = MMPS_DYNAMIC; + } - case SETPCO_ACTION: - break; - case MIMO_CHA_MEASURE_ACTION: - break; - case HT_INFO_EXCHANGE: - { - HT_INFORMATION_OCTET *pHT_info; - - pHT_info = (HT_INFORMATION_OCTET *) &Elem->Msg[LENGTH_802_11+2]; - // 7.4.8.10 - DBGPRINT(RT_DEBUG_TRACE,("ACTION - HT Information Exchange action----> \n")); - if (pHT_info->Request) - { - respond_ht_information_exchange_action(pAd, Elem); - } + DBGPRINT(RT_DEBUG_TRACE, + ("Aid(%d) MIMO PS = %d\n", Elem->Wcid, + pAd->MacTab.Content[Elem->Wcid].MmpsMode)); + // rt2860c : add something for smps change. + break; + + case SETPCO_ACTION: + break; + case MIMO_CHA_MEASURE_ACTION: + break; + case HT_INFO_EXCHANGE: + { + HT_INFORMATION_OCTET *pHT_info; + + pHT_info = + (HT_INFORMATION_OCTET *) & Elem->Msg[LENGTH_802_11 + + 2]; + // 7.4.8.10 + DBGPRINT(RT_DEBUG_TRACE, + ("ACTION - HT Information Exchange action----> \n")); + if (pHT_info->Request) { + respond_ht_information_exchange_action(pAd, + Elem); } - break; + } + break; } } - /* ========================================================================== Description: @@ -460,80 +467,79 @@ VOID PeerHTAction( FALSE , then continue indicaterx at this moment. ========================================================================== */ -VOID ORIBATimerTimeout( - IN PRTMP_ADAPTER pAd) +VOID ORIBATimerTimeout(IN PRTMP_ADAPTER pAd) { - MAC_TABLE_ENTRY *pEntry; - INT i, total; - UCHAR TID; + MAC_TABLE_ENTRY *pEntry; + INT i, total; + UCHAR TID; total = pAd->MacTab.Size * NUM_OF_TID; - for (i = 1; ((i 0)) ; i++) - { - if (pAd->BATable.BAOriEntry[i].ORI_BA_Status == Originator_Done) - { - pEntry = &pAd->MacTab.Content[pAd->BATable.BAOriEntry[i].Wcid]; + for (i = 1; ((i < MAX_LEN_OF_BA_ORI_TABLE) && (total > 0)); i++) { + if (pAd->BATable.BAOriEntry[i].ORI_BA_Status == Originator_Done) { + pEntry = + &pAd->MacTab.Content[pAd->BATable.BAOriEntry[i]. + Wcid]; TID = pAd->BATable.BAOriEntry[i].TID; - ASSERT(pAd->BATable.BAOriEntry[i].Wcid < MAX_LEN_OF_MAC_TABLE); + ASSERT(pAd->BATable.BAOriEntry[i].Wcid < + MAX_LEN_OF_MAC_TABLE); } - total --; + total--; } } - -VOID SendRefreshBAR( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry) +VOID SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) { - FRAME_BAR FrameBar; - ULONG FrameLen; - NDIS_STATUS NStatus; - PUCHAR pOutBuffer = NULL; - USHORT Sequence; - UCHAR i, TID; - USHORT idx; - BA_ORI_ENTRY *pBAEntry; - - for (i = 0; i BAOriWcidArray[i]; - if (idx == 0) - { + if (idx == 0) { continue; } pBAEntry = &pAd->BATable.BAOriEntry[idx]; - if (pBAEntry->ORI_BA_Status == Originator_Done) - { + if (pBAEntry->ORI_BA_Status == Originator_Done) { TID = pBAEntry->TID; ASSERT(pBAEntry->Wcid < MAX_LEN_OF_MAC_TABLE); - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_ERROR,("BA - MlmeADDBAAction() allocate memory failed \n")); + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_ERROR, + ("BA - MlmeADDBAAction() allocate memory failed \n")); return; } Sequence = pEntry->TxSeq[TID]; - BarHeaderInit(pAd, &FrameBar, pEntry->Addr, pAd->CurrentAddress); + BarHeaderInit(pAd, &FrameBar, pEntry->Addr, + pAd->CurrentAddress); - FrameBar.StartingSeq.field.FragNum = 0; // make sure sequence not clear in DEL function. - FrameBar.StartingSeq.field.StartSeq = Sequence; // make sure sequence not clear in DEL funciton. - FrameBar.BarControl.TID = TID; // make sure sequence not clear in DEL funciton. + FrameBar.StartingSeq.field.FragNum = 0; // make sure sequence not clear in DEL function. + FrameBar.StartingSeq.field.StartSeq = Sequence; // make sure sequence not clear in DEL funciton. + FrameBar.BarControl.TID = TID; // make sure sequence not clear in DEL funciton. - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_BAR), &FrameBar, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer, &FrameLen, + sizeof(FRAME_BAR), &FrameBar, + END_OF_ARGS); //if (!(CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_RALINK_CHIPSET))) if (1) // Now we always send BAR. { //MiniportMMRequestUnlock(pAd, 0, pOutBuffer, FrameLen); - MiniportMMRequest(pAd, (MGMT_USE_QUEUE_FLAG | MapUserPriorityToAccessCategory[TID]), pOutBuffer, FrameLen); + MiniportMMRequest(pAd, + (MGMT_USE_QUEUE_FLAG | + MapUserPriorityToAccessCategory + [TID]), pOutBuffer, + FrameLen); } MlmeFreeMemory(pAd, pOutBuffer); @@ -541,43 +547,36 @@ VOID SendRefreshBAR( } } -VOID ActHeaderInit( - IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, - IN PUCHAR Addr1, - IN PUCHAR Addr2, - IN PUCHAR Addr3) +VOID ActHeaderInit(IN PRTMP_ADAPTER pAd, + IN OUT PHEADER_802_11 pHdr80211, + IN PUCHAR Addr1, IN PUCHAR Addr2, IN PUCHAR Addr3) { - NdisZeroMemory(pHdr80211, sizeof(HEADER_802_11)); - pHdr80211->FC.Type = BTYPE_MGMT; - pHdr80211->FC.SubType = SUBTYPE_ACTION; + NdisZeroMemory(pHdr80211, sizeof(HEADER_802_11)); + pHdr80211->FC.Type = BTYPE_MGMT; + pHdr80211->FC.SubType = SUBTYPE_ACTION; - COPY_MAC_ADDR(pHdr80211->Addr1, Addr1); + COPY_MAC_ADDR(pHdr80211->Addr1, Addr1); COPY_MAC_ADDR(pHdr80211->Addr2, Addr2); - COPY_MAC_ADDR(pHdr80211->Addr3, Addr3); + COPY_MAC_ADDR(pHdr80211->Addr3, Addr3); } -VOID BarHeaderInit( - IN PRTMP_ADAPTER pAd, - IN OUT PFRAME_BAR pCntlBar, - IN PUCHAR pDA, - IN PUCHAR pSA) +VOID BarHeaderInit(IN PRTMP_ADAPTER pAd, + IN OUT PFRAME_BAR pCntlBar, IN PUCHAR pDA, IN PUCHAR pSA) { NdisZeroMemory(pCntlBar, sizeof(FRAME_BAR)); pCntlBar->FC.Type = BTYPE_CNTL; pCntlBar->FC.SubType = SUBTYPE_BLOCK_ACK_REQ; - pCntlBar->BarControl.MTID = 0; + pCntlBar->BarControl.MTID = 0; pCntlBar->BarControl.Compressed = 1; pCntlBar->BarControl.ACKPolicy = 0; - - pCntlBar->Duration = 16 + RTMPCalcDuration(pAd, RATE_1, sizeof(FRAME_BA)); + pCntlBar->Duration = + 16 + RTMPCalcDuration(pAd, RATE_1, sizeof(FRAME_BA)); COPY_MAC_ADDR(pCntlBar->Addr1, pDA); COPY_MAC_ADDR(pCntlBar->Addr2, pSA); } - /* ========================================================================== Description: @@ -592,19 +591,14 @@ VOID BarHeaderInit( Return : None. ========================================================================== */ -VOID InsertActField( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 Category, - IN UINT8 ActCode) +VOID InsertActField(IN PRTMP_ADAPTER pAd, + OUT PUCHAR pFrameBuf, + OUT PULONG pFrameLen, IN UINT8 Category, IN UINT8 ActCode) { ULONG TempLen; - MakeOutgoingFrame( pFrameBuf, &TempLen, - 1, &Category, - 1, &ActCode, - END_OF_ARGS); + MakeOutgoingFrame(pFrameBuf, &TempLen, + 1, &Category, 1, &ActCode, END_OF_ARGS); *pFrameLen = *pFrameLen + TempLen; diff --git a/drivers/staging/rt2860/common/ba_action.c b/drivers/staging/rt2860/common/ba_action.c index ff4dce6786fd..dedbe52e0906 100644 --- a/drivers/staging/rt2860/common/ba_action.c +++ b/drivers/staging/rt2860/common/ba_action.c @@ -27,9 +27,7 @@ #include "../rt_config.h" - - -#define BA_ORI_INIT_SEQ (pEntry->TxSeq[TID]) //1 // inital sequence number of BA session +#define BA_ORI_INIT_SEQ (pEntry->TxSeq[TID]) //1 // inital sequence number of BA session #define ORI_SESSION_MAX_RETRY 8 #define ORI_BA_SESSION_TIMEOUT (2000) // ms @@ -40,29 +38,22 @@ #define RESET_RCV_SEQ (0xFFFF) -static void ba_mpdu_blk_free(PRTMP_ADAPTER pAd, struct reordering_mpdu *mpdu_blk); - +static void ba_mpdu_blk_free(PRTMP_ADAPTER pAd, + struct reordering_mpdu *mpdu_blk); -BA_ORI_ENTRY *BATableAllocOriEntry( - IN PRTMP_ADAPTER pAd, - OUT USHORT *Idx); +BA_ORI_ENTRY *BATableAllocOriEntry(IN PRTMP_ADAPTER pAd, OUT USHORT * Idx); -BA_REC_ENTRY *BATableAllocRecEntry( - IN PRTMP_ADAPTER pAd, - OUT USHORT *Idx); +BA_REC_ENTRY *BATableAllocRecEntry(IN PRTMP_ADAPTER pAd, OUT USHORT * Idx); -VOID BAOriSessionSetupTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID BARecSessionIdleTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); +VOID BAOriSessionSetupTimeout(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3); +VOID BARecSessionIdleTimeout(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3); BUILD_TIMER_FUNCTION(BAOriSessionSetupTimeout); BUILD_TIMER_FUNCTION(BARecSessionIdleTimeout); @@ -70,91 +61,78 @@ BUILD_TIMER_FUNCTION(BARecSessionIdleTimeout); #define ANNOUNCE_REORDERING_PACKET(_pAd, _mpdu_blk) \ Announce_Reordering_Packet(_pAd, _mpdu_blk); -VOID BA_MaxWinSizeReasign( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntryPeer, - OUT UCHAR *pWinSize) +VOID BA_MaxWinSizeReasign(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntryPeer, OUT UCHAR * pWinSize) { UCHAR MaxSize; - - if (pAd->MACVersion >= RALINK_2883_VERSION) // 3*3 + if (pAd->MACVersion >= RALINK_2883_VERSION) // 3*3 { - if (pAd->MACVersion >= RALINK_3070_VERSION) - { - if (pEntryPeer->WepStatus != Ndis802_11EncryptionDisabled) - MaxSize = 7; // for non-open mode + if (pAd->MACVersion >= RALINK_3070_VERSION) { + if (pEntryPeer->WepStatus != + Ndis802_11EncryptionDisabled) + MaxSize = 7; // for non-open mode else MaxSize = 13; - } - else + } else MaxSize = 31; - } - else if (pAd->MACVersion >= RALINK_2880E_VERSION) // 2880 e + } else if (pAd->MACVersion >= RALINK_2880E_VERSION) // 2880 e { if (pEntryPeer->WepStatus != Ndis802_11EncryptionDisabled) - MaxSize = 7; // for non-open mode + MaxSize = 7; // for non-open mode else MaxSize = 13; - } - else + } else MaxSize = 7; DBGPRINT(RT_DEBUG_TRACE, ("ba> Win Size = %d, Max Size = %d\n", - *pWinSize, MaxSize)); + *pWinSize, MaxSize)); - if ((*pWinSize) > MaxSize) - { - DBGPRINT(RT_DEBUG_TRACE, ("ba> reassign max win size from %d to %d\n", - *pWinSize, MaxSize)); + if ((*pWinSize) > MaxSize) { + DBGPRINT(RT_DEBUG_TRACE, + ("ba> reassign max win size from %d to %d\n", + *pWinSize, MaxSize)); *pWinSize = MaxSize; } } -void Announce_Reordering_Packet(IN PRTMP_ADAPTER pAd, - IN struct reordering_mpdu *mpdu) +void Announce_Reordering_Packet(IN PRTMP_ADAPTER pAd, + IN struct reordering_mpdu *mpdu) { - PNDIS_PACKET pPacket; + PNDIS_PACKET pPacket; pPacket = mpdu->pPacket; - if (mpdu->bAMSDU) - { + if (mpdu->bAMSDU) { ASSERT(0); BA_Reorder_AMSDU_Annnounce(pAd, pPacket); - } - else - { + } else { // // pass this 802.3 packet to upper layer or forward this packet to WM directly // - ANNOUNCE_OR_FORWARD_802_3_PACKET(pAd, pPacket, RTMP_GET_PACKET_IF(pPacket)); + ANNOUNCE_OR_FORWARD_802_3_PACKET(pAd, pPacket, + RTMP_GET_PACKET_IF(pPacket)); } } /* * Insert a reordering mpdu into sorted linked list by sequence no. */ -BOOLEAN ba_reordering_mpdu_insertsorted(struct reordering_list *list, struct reordering_mpdu *mpdu) +BOOLEAN ba_reordering_mpdu_insertsorted(struct reordering_list *list, + struct reordering_mpdu *mpdu) { struct reordering_mpdu **ppScan = &list->next; - while (*ppScan != NULL) - { - if (SEQ_SMALLER((*ppScan)->Sequence, mpdu->Sequence, MAXSEQ)) - { + while (*ppScan != NULL) { + if (SEQ_SMALLER((*ppScan)->Sequence, mpdu->Sequence, MAXSEQ)) { ppScan = &(*ppScan)->next; - } - else if ((*ppScan)->Sequence == mpdu->Sequence) - { + } else if ((*ppScan)->Sequence == mpdu->Sequence) { /* give up this duplicated frame */ - return(FALSE); - } - else - { + return (FALSE); + } else { /* find position */ break; } @@ -166,11 +144,11 @@ BOOLEAN ba_reordering_mpdu_insertsorted(struct reordering_list *list, struct reo return TRUE; } - /* * caller lock critical section if necessary */ -static inline void ba_enqueue(struct reordering_list *list, struct reordering_mpdu *mpdu_blk) +static inline void ba_enqueue(struct reordering_list *list, + struct reordering_mpdu *mpdu_blk) { list->qlen++; mpdu_blk->next = list->next; @@ -180,47 +158,46 @@ static inline void ba_enqueue(struct reordering_list *list, struct reordering_mp /* * caller lock critical section if necessary */ -static inline struct reordering_mpdu * ba_dequeue(struct reordering_list *list) +static inline struct reordering_mpdu *ba_dequeue(struct reordering_list *list) { struct reordering_mpdu *mpdu_blk = NULL; ASSERT(list); - if (list->qlen) - { - list->qlen--; - mpdu_blk = list->next; - if (mpdu_blk) - { - list->next = mpdu_blk->next; - mpdu_blk->next = NULL; - } + if (list->qlen) { + list->qlen--; + mpdu_blk = list->next; + if (mpdu_blk) { + list->next = mpdu_blk->next; + mpdu_blk->next = NULL; } + } return mpdu_blk; } - -static inline struct reordering_mpdu *ba_reordering_mpdu_dequeue(struct reordering_list *list) +static inline struct reordering_mpdu *ba_reordering_mpdu_dequeue(struct + reordering_list + *list) { - return(ba_dequeue(list)); + return (ba_dequeue(list)); } - -static inline struct reordering_mpdu *ba_reordering_mpdu_probe(struct reordering_list *list) - { +static inline struct reordering_mpdu *ba_reordering_mpdu_probe(struct + reordering_list + *list) +{ ASSERT(list); - return(list->next); - } - + return (list->next); +} /* * free all resource for reordering mechanism */ void ba_reordering_resource_release(PRTMP_ADAPTER pAd) { - BA_TABLE *Tab; - PBA_REC_ENTRY pBAEntry; + BA_TABLE *Tab; + PBA_REC_ENTRY pBAEntry; struct reordering_mpdu *mpdu_blk; int i; @@ -228,15 +205,14 @@ void ba_reordering_resource_release(PRTMP_ADAPTER pAd) /* I. release all pending reordering packet */ NdisAcquireSpinLock(&pAd->BATabLock); - for (i = 0; i < MAX_LEN_OF_BA_REC_TABLE; i++) - { + for (i = 0; i < MAX_LEN_OF_BA_REC_TABLE; i++) { pBAEntry = &Tab->BARecEntry[i]; - if (pBAEntry->REC_BA_Status != Recipient_NONE) - { - while ((mpdu_blk = ba_reordering_mpdu_dequeue(&pBAEntry->list))) - { + if (pBAEntry->REC_BA_Status != Recipient_NONE) { + while ((mpdu_blk = + ba_reordering_mpdu_dequeue(&pBAEntry->list))) { ASSERT(mpdu_blk->pPacket); - RELEASE_NDIS_PACKET(pAd, mpdu_blk->pPacket, NDIS_STATUS_FAILURE); + RELEASE_NDIS_PACKET(pAd, mpdu_blk->pPacket, + NDIS_STATUS_FAILURE); ba_mpdu_blk_free(pAd, mpdu_blk); } } @@ -250,15 +226,13 @@ void ba_reordering_resource_release(PRTMP_ADAPTER pAd) NdisReleaseSpinLock(&pAd->mpdu_blk_pool.lock); } - - /* * Allocate all resource for reordering mechanism */ BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num) { - int i; - PUCHAR mem; + int i; + PUCHAR mem; struct reordering_mpdu *mpdu_blk; struct reordering_list *freelist; @@ -270,24 +244,26 @@ BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num) freelist->next = NULL; freelist->qlen = 0; - DBGPRINT(RT_DEBUG_TRACE, ("Allocate %d memory for BA reordering\n", (UINT32)(num*sizeof(struct reordering_mpdu)))); + DBGPRINT(RT_DEBUG_TRACE, + ("Allocate %d memory for BA reordering\n", + (UINT32) (num * sizeof(struct reordering_mpdu)))); /* allocate number of mpdu_blk memory */ - os_alloc_mem(pAd, (PUCHAR *)&mem, (num*sizeof(struct reordering_mpdu))); + os_alloc_mem(pAd, (PUCHAR *) & mem, + (num * sizeof(struct reordering_mpdu))); pAd->mpdu_blk_pool.mem = mem; - if (mem == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("Can't Allocate Memory for BA Reordering\n")); - return(FALSE); + if (mem == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("Can't Allocate Memory for BA Reordering\n")); + return (FALSE); } /* build mpdu_blk free list */ - for (i=0; impdu_blk_pool.lock); mpdu_blk = ba_dequeue(&pAd->mpdu_blk_pool.freelist); - if (mpdu_blk) - { -// blk_count++; + if (mpdu_blk) { +// blk_count++; /* reset mpdu_blk */ NdisZeroMemory(mpdu_blk, sizeof(struct reordering_mpdu)); } @@ -317,43 +292,40 @@ static struct reordering_mpdu *ba_mpdu_blk_alloc(PRTMP_ADAPTER pAd) return mpdu_blk; } -static void ba_mpdu_blk_free(PRTMP_ADAPTER pAd, struct reordering_mpdu *mpdu_blk) +static void ba_mpdu_blk_free(PRTMP_ADAPTER pAd, + struct reordering_mpdu *mpdu_blk) { ASSERT(mpdu_blk); NdisAcquireSpinLock(&pAd->mpdu_blk_pool.lock); -// blk_count--; +// blk_count--; ba_enqueue(&pAd->mpdu_blk_pool.freelist, mpdu_blk); NdisReleaseSpinLock(&pAd->mpdu_blk_pool.lock); } - -static USHORT ba_indicate_reordering_mpdus_in_order( - IN PRTMP_ADAPTER pAd, - IN PBA_REC_ENTRY pBAEntry, - IN USHORT StartSeq) +static USHORT ba_indicate_reordering_mpdus_in_order(IN PRTMP_ADAPTER pAd, + IN PBA_REC_ENTRY pBAEntry, + IN USHORT StartSeq) { struct reordering_mpdu *mpdu_blk; - USHORT LastIndSeq = RESET_RCV_SEQ; + USHORT LastIndSeq = RESET_RCV_SEQ; NdisAcquireSpinLock(&pBAEntry->RxReRingLock); - while ((mpdu_blk = ba_reordering_mpdu_probe(&pBAEntry->list))) - { - /* find in-order frame */ - if (!SEQ_STEPONE(mpdu_blk->Sequence, StartSeq, MAXSEQ)) - { - break; - } - /* dequeue in-order frame from reodering list */ - mpdu_blk = ba_reordering_mpdu_dequeue(&pBAEntry->list); - /* pass this frame up */ + while ((mpdu_blk = ba_reordering_mpdu_probe(&pBAEntry->list))) { + /* find in-order frame */ + if (!SEQ_STEPONE(mpdu_blk->Sequence, StartSeq, MAXSEQ)) { + break; + } + /* dequeue in-order frame from reodering list */ + mpdu_blk = ba_reordering_mpdu_dequeue(&pBAEntry->list); + /* pass this frame up */ ANNOUNCE_REORDERING_PACKET(pAd, mpdu_blk); /* move to next sequence */ - StartSeq = mpdu_blk->Sequence; + StartSeq = mpdu_blk->Sequence; LastIndSeq = StartSeq; /* free mpdu_blk */ - ba_mpdu_blk_free(pAd, mpdu_blk); + ba_mpdu_blk_free(pAd, mpdu_blk); } NdisReleaseSpinLock(&pBAEntry->RxReRingLock); @@ -362,51 +334,44 @@ static USHORT ba_indicate_reordering_mpdus_in_order( return LastIndSeq; } -static void ba_indicate_reordering_mpdus_le_seq( - IN PRTMP_ADAPTER pAd, - IN PBA_REC_ENTRY pBAEntry, - IN USHORT Sequence) +static void ba_indicate_reordering_mpdus_le_seq(IN PRTMP_ADAPTER pAd, + IN PBA_REC_ENTRY pBAEntry, + IN USHORT Sequence) { struct reordering_mpdu *mpdu_blk; NdisAcquireSpinLock(&pBAEntry->RxReRingLock); - while ((mpdu_blk = ba_reordering_mpdu_probe(&pBAEntry->list))) - { - /* find in-order frame */ - if ((mpdu_blk->Sequence == Sequence) || SEQ_SMALLER(mpdu_blk->Sequence, Sequence, MAXSEQ)) - { + while ((mpdu_blk = ba_reordering_mpdu_probe(&pBAEntry->list))) { + /* find in-order frame */ + if ((mpdu_blk->Sequence == Sequence) + || SEQ_SMALLER(mpdu_blk->Sequence, Sequence, MAXSEQ)) { /* dequeue in-order frame from reodering list */ mpdu_blk = ba_reordering_mpdu_dequeue(&pBAEntry->list); /* pass this frame up */ ANNOUNCE_REORDERING_PACKET(pAd, mpdu_blk); /* free mpdu_blk */ ba_mpdu_blk_free(pAd, mpdu_blk); + } else { + break; } - else - { - break; - } } NdisReleaseSpinLock(&pBAEntry->RxReRingLock); } - -static void ba_refresh_reordering_mpdus( - IN PRTMP_ADAPTER pAd, - PBA_REC_ENTRY pBAEntry) +static void ba_refresh_reordering_mpdus(IN PRTMP_ADAPTER pAd, + PBA_REC_ENTRY pBAEntry) { struct reordering_mpdu *mpdu_blk; NdisAcquireSpinLock(&pBAEntry->RxReRingLock); - /* dequeue in-order frame from reodering list */ - while ((mpdu_blk = ba_reordering_mpdu_dequeue(&pBAEntry->list))) - { - /* pass this frame up */ + /* dequeue in-order frame from reodering list */ + while ((mpdu_blk = ba_reordering_mpdu_dequeue(&pBAEntry->list))) { + /* pass this frame up */ ANNOUNCE_REORDERING_PACKET(pAd, mpdu_blk); pBAEntry->LastIndSeq = mpdu_blk->Sequence; - ba_mpdu_blk_free(pAd, mpdu_blk); + ba_mpdu_blk_free(pAd, mpdu_blk); /* update last indicated sequence */ } @@ -415,109 +380,106 @@ static void ba_refresh_reordering_mpdus( NdisReleaseSpinLock(&pBAEntry->RxReRingLock); } - //static -void ba_flush_reordering_timeout_mpdus( - IN PRTMP_ADAPTER pAd, - IN PBA_REC_ENTRY pBAEntry, - IN ULONG Now32) - +void ba_flush_reordering_timeout_mpdus(IN PRTMP_ADAPTER pAd, + IN PBA_REC_ENTRY pBAEntry, + IN ULONG Now32) { USHORT Sequence; -// if ((RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+REORDERING_PACKET_TIMEOUT)) && -// (pBAEntry->list.qlen > ((pBAEntry->BAWinSize*7)/8))) //|| -// (RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+(10*REORDERING_PACKET_TIMEOUT))) && -// (pBAEntry->list.qlen > (pBAEntry->BAWinSize/8))) - if (RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+(MAX_REORDERING_PACKET_TIMEOUT/6))) - &&(pBAEntry->list.qlen > 1) - ) - { - DBGPRINT(RT_DEBUG_TRACE,("timeout[%d] (%08lx-%08lx = %d > %d): %x, flush all!\n ", pBAEntry->list.qlen, Now32, (pBAEntry->LastIndSeqAtTimer), - (int)((long) Now32 - (long)(pBAEntry->LastIndSeqAtTimer)), MAX_REORDERING_PACKET_TIMEOUT, - pBAEntry->LastIndSeq)); +// if ((RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+REORDERING_PACKET_TIMEOUT)) && +// (pBAEntry->list.qlen > ((pBAEntry->BAWinSize*7)/8))) //|| +// (RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+(10*REORDERING_PACKET_TIMEOUT))) && +// (pBAEntry->list.qlen > (pBAEntry->BAWinSize/8))) + if (RTMP_TIME_AFTER + ((unsigned long)Now32, + (unsigned long)(pBAEntry->LastIndSeqAtTimer + + (MAX_REORDERING_PACKET_TIMEOUT / 6))) + && (pBAEntry->list.qlen > 1) + ) { + DBGPRINT(RT_DEBUG_TRACE, + ("timeout[%d] (%08lx-%08lx = %d > %d): %x, flush all!\n ", + pBAEntry->list.qlen, Now32, + (pBAEntry->LastIndSeqAtTimer), + (int)((long)Now32 - + (long)(pBAEntry->LastIndSeqAtTimer)), + MAX_REORDERING_PACKET_TIMEOUT, pBAEntry->LastIndSeq)); ba_refresh_reordering_mpdus(pAd, pBAEntry); pBAEntry->LastIndSeqAtTimer = Now32; - } - else - if (RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+(REORDERING_PACKET_TIMEOUT))) + } else + if (RTMP_TIME_AFTER + ((unsigned long)Now32, + (unsigned long)(pBAEntry->LastIndSeqAtTimer + + (REORDERING_PACKET_TIMEOUT))) && (pBAEntry->list.qlen > 0) - ) - { - // + ) { + // // force LastIndSeq to shift to LastIndSeq+1 - // - Sequence = (pBAEntry->LastIndSeq+1) & MAXSEQ; - ba_indicate_reordering_mpdus_le_seq(pAd, pBAEntry, Sequence); - pBAEntry->LastIndSeqAtTimer = Now32; + // + Sequence = (pBAEntry->LastIndSeq + 1) & MAXSEQ; + ba_indicate_reordering_mpdus_le_seq(pAd, pBAEntry, Sequence); + pBAEntry->LastIndSeqAtTimer = Now32; + pBAEntry->LastIndSeq = Sequence; + // + // indicate in-order mpdus + // + Sequence = + ba_indicate_reordering_mpdus_in_order(pAd, pBAEntry, + Sequence); + if (Sequence != RESET_RCV_SEQ) { pBAEntry->LastIndSeq = Sequence; - // - // indicate in-order mpdus - // - Sequence = ba_indicate_reordering_mpdus_in_order(pAd, pBAEntry, Sequence); - if (Sequence != RESET_RCV_SEQ) - { - pBAEntry->LastIndSeq = Sequence; - } + } - DBGPRINT(RT_DEBUG_OFF, ("%x, flush one!\n", pBAEntry->LastIndSeq)); + DBGPRINT(RT_DEBUG_OFF, + ("%x, flush one!\n", pBAEntry->LastIndSeq)); } } - /* * generate ADDBA request to * set up BA agreement */ -VOID BAOriSessionSetUp( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN UCHAR TID, - IN USHORT TimeOut, - IN ULONG DelayTime, - IN BOOLEAN isForced) - +VOID BAOriSessionSetUp(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, + IN UCHAR TID, + IN USHORT TimeOut, + IN ULONG DelayTime, IN BOOLEAN isForced) { - //MLME_ADDBA_REQ_STRUCT AddbaReq; - BA_ORI_ENTRY *pBAEntry = NULL; - USHORT Idx; - BOOLEAN Cancelled; + //MLME_ADDBA_REQ_STRUCT AddbaReq; + BA_ORI_ENTRY *pBAEntry = NULL; + USHORT Idx; + BOOLEAN Cancelled; - if ((pAd->CommonCfg.BACapability.field.AutoBA != TRUE) && (isForced == FALSE)) + if ((pAd->CommonCfg.BACapability.field.AutoBA != TRUE) + && (isForced == FALSE)) return; // if this entry is limited to use legacy tx mode, it doesn't generate BA. if (RTMPStaFixedTxMode(pAd, pEntry) != FIXED_TXMODE_HT) return; - if ((pEntry->BADeclineBitmap & (1<BADeclineBitmap & (1 << TID)) && (isForced == FALSE)) { // try again after 3 secs DelayTime = 3000; -// DBGPRINT(RT_DEBUG_TRACE, ("DeCline BA from Peer\n")); -// return; +// DBGPRINT(RT_DEBUG_TRACE, ("DeCline BA from Peer\n")); +// return; } - Idx = pEntry->BAOriWcidArray[TID]; - if (Idx == 0) - { + if (Idx == 0) { // allocate a BA session pBAEntry = BATableAllocOriEntry(pAd, &Idx); - if (pBAEntry == NULL) - { - DBGPRINT(RT_DEBUG_TRACE,("ADDBA - MlmeADDBAAction() allocate BA session failed \n")); + if (pBAEntry == NULL) { + DBGPRINT(RT_DEBUG_TRACE, + ("ADDBA - MlmeADDBAAction() allocate BA session failed \n")); return; } - } - else - { - pBAEntry =&pAd->BATable.BAOriEntry[Idx]; + } else { + pBAEntry = &pAd->BATable.BAOriEntry[Idx]; } - if (pBAEntry->ORI_BA_Status >= Originator_WaitRes) - { + if (pBAEntry->ORI_BA_Status >= Originator_WaitRes) { return; } @@ -533,129 +495,125 @@ VOID BAOriSessionSetUp( pBAEntry->TimeOutValue = TimeOut; pBAEntry->pAdapter = pAd; - if (!(pEntry->TXBAbitmap & (1<ORIBATimer, GET_TIMER_FUNCTION(BAOriSessionSetupTimeout), pBAEntry, FALSE); - } - else + if (!(pEntry->TXBAbitmap & (1 << TID))) { + RTMPInitTimer(pAd, &pBAEntry->ORIBATimer, + GET_TIMER_FUNCTION(BAOriSessionSetupTimeout), + pBAEntry, FALSE); + } else RTMPCancelTimer(&pBAEntry->ORIBATimer, &Cancelled); // set timer to send ADDBA request RTMPSetTimer(&pBAEntry->ORIBATimer, DelayTime); } -VOID BAOriSessionAdd( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN PFRAME_ADDBA_RSP pFrame) +VOID BAOriSessionAdd(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, IN PFRAME_ADDBA_RSP pFrame) { - BA_ORI_ENTRY *pBAEntry = NULL; - BOOLEAN Cancelled; - UCHAR TID; - USHORT Idx; - PUCHAR pOutBuffer2 = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen; - FRAME_BAR FrameBar; + BA_ORI_ENTRY *pBAEntry = NULL; + BOOLEAN Cancelled; + UCHAR TID; + USHORT Idx; + PUCHAR pOutBuffer2 = NULL; + NDIS_STATUS NStatus; + ULONG FrameLen; + FRAME_BAR FrameBar; TID = pFrame->BaParm.TID; Idx = pEntry->BAOriWcidArray[TID]; - pBAEntry =&pAd->BATable.BAOriEntry[Idx]; + pBAEntry = &pAd->BATable.BAOriEntry[Idx]; // Start fill in parameters. - if ((Idx !=0) && (pBAEntry->TID == TID) && (pBAEntry->ORI_BA_Status == Originator_WaitRes)) - { - pBAEntry->BAWinSize = min(pBAEntry->BAWinSize, ((UCHAR)pFrame->BaParm.BufSize)); + if ((Idx != 0) && (pBAEntry->TID == TID) + && (pBAEntry->ORI_BA_Status == Originator_WaitRes)) { + pBAEntry->BAWinSize = + min(pBAEntry->BAWinSize, ((UCHAR) pFrame->BaParm.BufSize)); BA_MaxWinSizeReasign(pAd, pEntry, &pBAEntry->BAWinSize); pBAEntry->TimeOutValue = pFrame->TimeOutValue; pBAEntry->ORI_BA_Status = Originator_Done; - pAd->BATable.numDoneOriginator ++; + pAd->BATable.numDoneOriginator++; // reset sequence number pBAEntry->Sequence = BA_ORI_INIT_SEQ; // Set Bitmap flag. - pEntry->TXBAbitmap |= (1<ORIBATimer, &Cancelled); + pEntry->TXBAbitmap |= (1 << TID); + RTMPCancelTimer(&pBAEntry->ORIBATimer, &Cancelled); pBAEntry->ORIBATimer.TimerValue = 0; //pFrame->TimeOutValue; - DBGPRINT(RT_DEBUG_TRACE,("%s : TXBAbitmap = %x, BAWinSize = %d, TimeOut = %ld\n", __func__, pEntry->TXBAbitmap, - pBAEntry->BAWinSize, pBAEntry->ORIBATimer.TimerValue)); + DBGPRINT(RT_DEBUG_TRACE, + ("%s : TXBAbitmap = %x, BAWinSize = %d, TimeOut = %ld\n", + __func__, pEntry->TXBAbitmap, pBAEntry->BAWinSize, + pBAEntry->ORIBATimer.TimerValue)); // SEND BAR ; - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE,("BA - BAOriSessionAdd() allocate memory failed \n")); + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2); //Get an unused nonpaged memory + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_TRACE, + ("BA - BAOriSessionAdd() allocate memory failed \n")); return; } - BarHeaderInit(pAd, &FrameBar, pAd->MacTab.Content[pBAEntry->Wcid].Addr, pAd->CurrentAddress); + BarHeaderInit(pAd, &FrameBar, + pAd->MacTab.Content[pBAEntry->Wcid].Addr, + pAd->CurrentAddress); FrameBar.StartingSeq.field.FragNum = 0; // make sure sequence not clear in DEL function. - FrameBar.StartingSeq.field.StartSeq = pBAEntry->Sequence; // make sure sequence not clear in DEL funciton. - FrameBar.BarControl.TID = pBAEntry->TID; // make sure sequence not clear in DEL funciton. - MakeOutgoingFrame(pOutBuffer2, &FrameLen, - sizeof(FRAME_BAR), &FrameBar, - END_OF_ARGS); + FrameBar.StartingSeq.field.StartSeq = pBAEntry->Sequence; // make sure sequence not clear in DEL funciton. + FrameBar.BarControl.TID = pBAEntry->TID; // make sure sequence not clear in DEL funciton. + MakeOutgoingFrame(pOutBuffer2, &FrameLen, + sizeof(FRAME_BAR), &FrameBar, END_OF_ARGS); MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer2, FrameLen); MlmeFreeMemory(pAd, pOutBuffer2); - if (pBAEntry->ORIBATimer.TimerValue) - RTMPSetTimer(&pBAEntry->ORIBATimer, pBAEntry->ORIBATimer.TimerValue); // in mSec + RTMPSetTimer(&pBAEntry->ORIBATimer, pBAEntry->ORIBATimer.TimerValue); // in mSec } } -BOOLEAN BARecSessionAdd( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN PFRAME_ADDBA_REQ pFrame) +BOOLEAN BARecSessionAdd(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, IN PFRAME_ADDBA_REQ pFrame) { - BA_REC_ENTRY *pBAEntry = NULL; - BOOLEAN Status = TRUE; - BOOLEAN Cancelled; - USHORT Idx; - UCHAR TID; - UCHAR BAWinSize; + BA_REC_ENTRY *pBAEntry = NULL; + BOOLEAN Status = TRUE; + BOOLEAN Cancelled; + USHORT Idx; + UCHAR TID; + UCHAR BAWinSize; //UINT32 Value; //UINT offset; - ASSERT(pEntry); // find TID TID = pFrame->BaParm.TID; - BAWinSize = min(((UCHAR)pFrame->BaParm.BufSize), (UCHAR)pAd->CommonCfg.BACapability.field.RxBAWinLimit); + BAWinSize = + min(((UCHAR) pFrame->BaParm.BufSize), + (UCHAR) pAd->CommonCfg.BACapability.field.RxBAWinLimit); // Intel patch - if (BAWinSize == 0) - { + if (BAWinSize == 0) { BAWinSize = 64; } Idx = pEntry->BARecWcidArray[TID]; - - if (Idx == 0) - { + if (Idx == 0) { pBAEntry = BATableAllocRecEntry(pAd, &Idx); - } - else - { + } else { pBAEntry = &pAd->BATable.BARecEntry[Idx]; // flush all pending reordering mpdus ba_refresh_reordering_mpdus(pAd, pBAEntry); } - DBGPRINT(RT_DEBUG_TRACE,("%s(%ld): Idx = %d, BAWinSize(req %d) = %d\n", __func__, pAd->BATable.numAsRecipient, Idx, - pFrame->BaParm.BufSize, BAWinSize)); + DBGPRINT(RT_DEBUG_TRACE, + ("%s(%ld): Idx = %d, BAWinSize(req %d) = %d\n", __func__, + pAd->BATable.numAsRecipient, Idx, pFrame->BaParm.BufSize, + BAWinSize)); // Start fill in parameters. - if (pBAEntry != NULL) - { + if (pBAEntry != NULL) { ASSERT(pBAEntry->list.qlen == 0); pBAEntry->REC_BA_Status = Recipient_HandleRes; @@ -665,64 +623,60 @@ BOOLEAN BARecSessionAdd( pBAEntry->TimeOutValue = pFrame->TimeOutValue; pBAEntry->REC_BA_Status = Recipient_Accept; // initial sequence number - pBAEntry->LastIndSeq = RESET_RCV_SEQ; //pFrame->BaStartSeq.field.StartSeq; + pBAEntry->LastIndSeq = RESET_RCV_SEQ; //pFrame->BaStartSeq.field.StartSeq; - DBGPRINT(RT_DEBUG_OFF, ("Start Seq = %08x\n", pFrame->BaStartSeq.field.StartSeq)); + DBGPRINT(RT_DEBUG_OFF, + ("Start Seq = %08x\n", + pFrame->BaStartSeq.field.StartSeq)); - if (pEntry->RXBAbitmap & (1<RXBAbitmap & (1 << TID)) { RTMPCancelTimer(&pBAEntry->RECBATimer, &Cancelled); - } - else - { - RTMPInitTimer(pAd, &pBAEntry->RECBATimer, GET_TIMER_FUNCTION(BARecSessionIdleTimeout), pBAEntry, TRUE); + } else { + RTMPInitTimer(pAd, &pBAEntry->RECBATimer, + GET_TIMER_FUNCTION + (BARecSessionIdleTimeout), pBAEntry, + TRUE); } // Set Bitmap flag. - pEntry->RXBAbitmap |= (1<RXBAbitmap |= (1 << TID); pEntry->BARecWcidArray[TID] = Idx; - pEntry->BADeclineBitmap &= ~(1<BADeclineBitmap &= ~(1 << TID); // Set BA session mask in WCID table. RTMP_ADD_BA_SESSION_TO_ASIC(pAd, pEntry->Aid, TID); - DBGPRINT(RT_DEBUG_TRACE,("MACEntry[%d]RXBAbitmap = 0x%x. BARecWcidArray=%d\n", - pEntry->Aid, pEntry->RXBAbitmap, pEntry->BARecWcidArray[TID])); - } - else - { + DBGPRINT(RT_DEBUG_TRACE, + ("MACEntry[%d]RXBAbitmap = 0x%x. BARecWcidArray=%d\n", + pEntry->Aid, pEntry->RXBAbitmap, + pEntry->BARecWcidArray[TID])); + } else { Status = FALSE; - DBGPRINT(RT_DEBUG_TRACE,("Can't Accept ADDBA for %02x:%02x:%02x:%02x:%02x:%02x TID = %d\n", - PRINT_MAC(pEntry->Addr), TID)); + DBGPRINT(RT_DEBUG_TRACE, + ("Can't Accept ADDBA for %02x:%02x:%02x:%02x:%02x:%02x TID = %d\n", + PRINT_MAC(pEntry->Addr), TID)); } - return(Status); + return (Status); } - -BA_REC_ENTRY *BATableAllocRecEntry( - IN PRTMP_ADAPTER pAd, - OUT USHORT *Idx) +BA_REC_ENTRY *BATableAllocRecEntry(IN PRTMP_ADAPTER pAd, OUT USHORT * Idx) { - int i; - BA_REC_ENTRY *pBAEntry = NULL; - + int i; + BA_REC_ENTRY *pBAEntry = NULL; NdisAcquireSpinLock(&pAd->BATabLock); - if (pAd->BATable.numAsRecipient >= MAX_BARECI_SESSION) - { + if (pAd->BATable.numAsRecipient >= MAX_BARECI_SESSION) { DBGPRINT(RT_DEBUG_OFF, ("BA Recipeint Session (%ld) > %d\n", - pAd->BATable.numAsRecipient, MAX_BARECI_SESSION)); + pAd->BATable.numAsRecipient, + MAX_BARECI_SESSION)); goto done; } - // reserve idx 0 to identify BAWcidArray[TID] as empty - for (i=1; i < MAX_LEN_OF_BA_REC_TABLE; i++) - { - pBAEntry =&pAd->BATable.BARecEntry[i]; - if ((pBAEntry->REC_BA_Status == Recipient_NONE)) - { + for (i = 1; i < MAX_LEN_OF_BA_REC_TABLE; i++) { + pBAEntry = &pAd->BATable.BARecEntry[i]; + if ((pBAEntry->REC_BA_Status == Recipient_NONE)) { // get one pAd->BATable.numAsRecipient++; pBAEntry->REC_BA_Status = Recipient_USED; @@ -736,26 +690,20 @@ done: return pBAEntry; } -BA_ORI_ENTRY *BATableAllocOriEntry( - IN PRTMP_ADAPTER pAd, - OUT USHORT *Idx) +BA_ORI_ENTRY *BATableAllocOriEntry(IN PRTMP_ADAPTER pAd, OUT USHORT * Idx) { - int i; - BA_ORI_ENTRY *pBAEntry = NULL; + int i; + BA_ORI_ENTRY *pBAEntry = NULL; NdisAcquireSpinLock(&pAd->BATabLock); - if (pAd->BATable.numAsOriginator >= (MAX_LEN_OF_BA_ORI_TABLE)) - { + if (pAd->BATable.numAsOriginator >= (MAX_LEN_OF_BA_ORI_TABLE)) { goto done; } - // reserve idx 0 to identify BAWcidArray[TID] as empty - for (i=1; iBATable.BAOriEntry[i]; - if ((pBAEntry->ORI_BA_Status == Originator_NONE)) - { + for (i = 1; i < MAX_LEN_OF_BA_ORI_TABLE; i++) { + pBAEntry = &pAd->BATable.BAOriEntry[i]; + if ((pBAEntry->ORI_BA_Status == Originator_NONE)) { // get one pAd->BATable.numAsOriginator++; pBAEntry->ORI_BA_Status = Originator_USED; @@ -770,32 +718,27 @@ done: return pBAEntry; } - -VOID BATableFreeOriEntry( - IN PRTMP_ADAPTER pAd, - IN ULONG Idx) +VOID BATableFreeOriEntry(IN PRTMP_ADAPTER pAd, IN ULONG Idx) { - BA_ORI_ENTRY *pBAEntry = NULL; + BA_ORI_ENTRY *pBAEntry = NULL; MAC_TABLE_ENTRY *pEntry; - if ((Idx == 0) || (Idx >= MAX_LEN_OF_BA_ORI_TABLE)) return; - pBAEntry =&pAd->BATable.BAOriEntry[Idx]; + pBAEntry = &pAd->BATable.BAOriEntry[Idx]; - if (pBAEntry->ORI_BA_Status != Originator_NONE) - { + if (pBAEntry->ORI_BA_Status != Originator_NONE) { pEntry = &pAd->MacTab.Content[pBAEntry->Wcid]; pEntry->BAOriWcidArray[pBAEntry->TID] = 0; - NdisAcquireSpinLock(&pAd->BATabLock); - if (pBAEntry->ORI_BA_Status == Originator_Done) - { + if (pBAEntry->ORI_BA_Status == Originator_Done) { pAd->BATable.numDoneOriginator -= 1; - pEntry->TXBAbitmap &= (~(1<<(pBAEntry->TID) )); - DBGPRINT(RT_DEBUG_TRACE, ("BATableFreeOriEntry numAsOriginator= %ld\n", pAd->BATable.numAsRecipient)); + pEntry->TXBAbitmap &= (~(1 << (pBAEntry->TID))); + DBGPRINT(RT_DEBUG_TRACE, + ("BATableFreeOriEntry numAsOriginator= %ld\n", + pAd->BATable.numAsRecipient)); // Erase Bitmap flag. } @@ -809,22 +752,17 @@ VOID BATableFreeOriEntry( } } - -VOID BATableFreeRecEntry( - IN PRTMP_ADAPTER pAd, - IN ULONG Idx) +VOID BATableFreeRecEntry(IN PRTMP_ADAPTER pAd, IN ULONG Idx) { - BA_REC_ENTRY *pBAEntry = NULL; + BA_REC_ENTRY *pBAEntry = NULL; MAC_TABLE_ENTRY *pEntry; - if ((Idx == 0) || (Idx >= MAX_LEN_OF_BA_REC_TABLE)) return; - pBAEntry =&pAd->BATable.BARecEntry[Idx]; + pBAEntry = &pAd->BATable.BARecEntry[Idx]; - if (pBAEntry->REC_BA_Status != Recipient_NONE) - { + if (pBAEntry->REC_BA_Status != Recipient_NONE) { pEntry = &pAd->MacTab.Content[pBAEntry->Wcid]; pEntry->BARecWcidArray[pBAEntry->TID] = 0; @@ -839,111 +777,105 @@ VOID BATableFreeRecEntry( } } - -VOID BAOriSessionTearDown( - IN OUT PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR TID, - IN BOOLEAN bPassive, - IN BOOLEAN bForceSend) +VOID BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd, + IN UCHAR Wcid, + IN UCHAR TID, + IN BOOLEAN bPassive, IN BOOLEAN bForceSend) { - ULONG Idx = 0; - BA_ORI_ENTRY *pBAEntry; - BOOLEAN Cancelled; + ULONG Idx = 0; + BA_ORI_ENTRY *pBAEntry; + BOOLEAN Cancelled; - if (Wcid >= MAX_LEN_OF_MAC_TABLE) - { + if (Wcid >= MAX_LEN_OF_MAC_TABLE) { return; } - // // Locate corresponding BA Originator Entry in BA Table with the (pAddr,TID). // Idx = pAd->MacTab.Content[Wcid].BAOriWcidArray[TID]; - if ((Idx == 0) || (Idx >= MAX_LEN_OF_BA_ORI_TABLE)) - { - if (bForceSend == TRUE) - { + if ((Idx == 0) || (Idx >= MAX_LEN_OF_BA_ORI_TABLE)) { + if (bForceSend == TRUE) { // force send specified TID DelBA - MLME_DELBA_REQ_STRUCT DelbaReq; - MLME_QUEUE_ELEM *Elem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); - if (Elem != NULL) - { - NdisZeroMemory(&DelbaReq, sizeof(DelbaReq)); - NdisZeroMemory(Elem, sizeof(MLME_QUEUE_ELEM)); - - COPY_MAC_ADDR(DelbaReq.Addr, pAd->MacTab.Content[Wcid].Addr); - DelbaReq.Wcid = Wcid; - DelbaReq.TID = TID; - DelbaReq.Initiator = ORIGINATOR; - Elem->MsgLen = sizeof(DelbaReq); - NdisMoveMemory(Elem->Msg, &DelbaReq, sizeof(DelbaReq)); - MlmeDELBAAction(pAd, Elem); - kfree(Elem); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("%s(bForceSend):alloc memory failed!\n", __func__)); + MLME_DELBA_REQ_STRUCT DelbaReq; + MLME_QUEUE_ELEM *Elem = + (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), + MEM_ALLOC_FLAG); + if (Elem != NULL) { + NdisZeroMemory(&DelbaReq, sizeof(DelbaReq)); + NdisZeroMemory(Elem, sizeof(MLME_QUEUE_ELEM)); + + COPY_MAC_ADDR(DelbaReq.Addr, + pAd->MacTab.Content[Wcid].Addr); + DelbaReq.Wcid = Wcid; + DelbaReq.TID = TID; + DelbaReq.Initiator = ORIGINATOR; + Elem->MsgLen = sizeof(DelbaReq); + NdisMoveMemory(Elem->Msg, &DelbaReq, + sizeof(DelbaReq)); + MlmeDELBAAction(pAd, Elem); + kfree(Elem); + } else { + DBGPRINT(RT_DEBUG_ERROR, + ("%s(bForceSend):alloc memory failed!\n", + __func__)); } } return; } - DBGPRINT(RT_DEBUG_TRACE,("%s===>Wcid=%d.TID=%d \n", __func__, Wcid, TID)); + DBGPRINT(RT_DEBUG_TRACE, + ("%s===>Wcid=%d.TID=%d \n", __func__, Wcid, TID)); pBAEntry = &pAd->BATable.BAOriEntry[Idx]; - DBGPRINT(RT_DEBUG_TRACE,("\t===>Idx = %ld, Wcid=%d.TID=%d, ORI_BA_Status = %d \n", Idx, Wcid, TID, pBAEntry->ORI_BA_Status)); + DBGPRINT(RT_DEBUG_TRACE, + ("\t===>Idx = %ld, Wcid=%d.TID=%d, ORI_BA_Status = %d \n", Idx, + Wcid, TID, pBAEntry->ORI_BA_Status)); // // Prepare DelBA action frame and send to the peer. // - if ((bPassive == FALSE) && (TID == pBAEntry->TID) && (pBAEntry->ORI_BA_Status == Originator_Done)) - { - MLME_DELBA_REQ_STRUCT DelbaReq; - MLME_QUEUE_ELEM *Elem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); - if (Elem != NULL) - { - NdisZeroMemory(&DelbaReq, sizeof(DelbaReq)); - NdisZeroMemory(Elem, sizeof(MLME_QUEUE_ELEM)); - - COPY_MAC_ADDR(DelbaReq.Addr, pAd->MacTab.Content[Wcid].Addr); - DelbaReq.Wcid = Wcid; - DelbaReq.TID = pBAEntry->TID; - DelbaReq.Initiator = ORIGINATOR; - Elem->MsgLen = sizeof(DelbaReq); - NdisMoveMemory(Elem->Msg, &DelbaReq, sizeof(DelbaReq)); - MlmeDELBAAction(pAd, Elem); - kfree(Elem); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("%s():alloc memory failed!\n", __func__)); + if ((bPassive == FALSE) && (TID == pBAEntry->TID) + && (pBAEntry->ORI_BA_Status == Originator_Done)) { + MLME_DELBA_REQ_STRUCT DelbaReq; + MLME_QUEUE_ELEM *Elem = + (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), + MEM_ALLOC_FLAG); + if (Elem != NULL) { + NdisZeroMemory(&DelbaReq, sizeof(DelbaReq)); + NdisZeroMemory(Elem, sizeof(MLME_QUEUE_ELEM)); + + COPY_MAC_ADDR(DelbaReq.Addr, + pAd->MacTab.Content[Wcid].Addr); + DelbaReq.Wcid = Wcid; + DelbaReq.TID = pBAEntry->TID; + DelbaReq.Initiator = ORIGINATOR; + Elem->MsgLen = sizeof(DelbaReq); + NdisMoveMemory(Elem->Msg, &DelbaReq, sizeof(DelbaReq)); + MlmeDELBAAction(pAd, Elem); + kfree(Elem); + } else { + DBGPRINT(RT_DEBUG_ERROR, + ("%s():alloc memory failed!\n", __func__)); return; } } RTMPCancelTimer(&pBAEntry->ORIBATimer, &Cancelled); BATableFreeOriEntry(pAd, Idx); - if (bPassive) - { + if (bPassive) { //BAOriSessionSetUp(pAd, &pAd->MacTab.Content[Wcid], TID, 0, 10000, TRUE); } } -VOID BARecSessionTearDown( - IN OUT PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR TID, - IN BOOLEAN bPassive) +VOID BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd, + IN UCHAR Wcid, IN UCHAR TID, IN BOOLEAN bPassive) { - ULONG Idx = 0; - BA_REC_ENTRY *pBAEntry; + ULONG Idx = 0; + BA_REC_ENTRY *pBAEntry; - if (Wcid >= MAX_LEN_OF_MAC_TABLE) - { + if (Wcid >= MAX_LEN_OF_MAC_TABLE) { return; } - // // Locate corresponding BA Originator Entry in BA Table with the (pAddr,TID). // @@ -951,18 +883,20 @@ VOID BARecSessionTearDown( if (Idx == 0) return; - DBGPRINT(RT_DEBUG_TRACE,("%s===>Wcid=%d.TID=%d \n", __func__, Wcid, TID)); - + DBGPRINT(RT_DEBUG_TRACE, + ("%s===>Wcid=%d.TID=%d \n", __func__, Wcid, TID)); pBAEntry = &pAd->BATable.BARecEntry[Idx]; - DBGPRINT(RT_DEBUG_TRACE,("\t===>Idx = %ld, Wcid=%d.TID=%d, REC_BA_Status = %d \n", Idx, Wcid, TID, pBAEntry->REC_BA_Status)); + DBGPRINT(RT_DEBUG_TRACE, + ("\t===>Idx = %ld, Wcid=%d.TID=%d, REC_BA_Status = %d \n", Idx, + Wcid, TID, pBAEntry->REC_BA_Status)); // // Prepare DelBA action frame and send to the peer. // - if ((TID == pBAEntry->TID) && (pBAEntry->REC_BA_Status == Recipient_Accept)) - { - MLME_DELBA_REQ_STRUCT DelbaReq; - BOOLEAN Cancelled; + if ((TID == pBAEntry->TID) + && (pBAEntry->REC_BA_Status == Recipient_Accept)) { + MLME_DELBA_REQ_STRUCT DelbaReq; + BOOLEAN Cancelled; //ULONG offset; //UINT32 VALUE; @@ -971,31 +905,32 @@ VOID BARecSessionTearDown( // // 1. Send DELBA Action Frame // - if (bPassive == FALSE) - { - MLME_QUEUE_ELEM *Elem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); - if (Elem != NULL) - { - NdisZeroMemory(&DelbaReq, sizeof(DelbaReq)); - NdisZeroMemory(Elem, sizeof(MLME_QUEUE_ELEM)); - - COPY_MAC_ADDR(DelbaReq.Addr, pAd->MacTab.Content[Wcid].Addr); - DelbaReq.Wcid = Wcid; - DelbaReq.TID = TID; - DelbaReq.Initiator = RECIPIENT; - Elem->MsgLen = sizeof(DelbaReq); - NdisMoveMemory(Elem->Msg, &DelbaReq, sizeof(DelbaReq)); - MlmeDELBAAction(pAd, Elem); - kfree(Elem); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("%s():alloc memory failed!\n", __func__)); + if (bPassive == FALSE) { + MLME_QUEUE_ELEM *Elem = + (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), + MEM_ALLOC_FLAG); + if (Elem != NULL) { + NdisZeroMemory(&DelbaReq, sizeof(DelbaReq)); + NdisZeroMemory(Elem, sizeof(MLME_QUEUE_ELEM)); + + COPY_MAC_ADDR(DelbaReq.Addr, + pAd->MacTab.Content[Wcid].Addr); + DelbaReq.Wcid = Wcid; + DelbaReq.TID = TID; + DelbaReq.Initiator = RECIPIENT; + Elem->MsgLen = sizeof(DelbaReq); + NdisMoveMemory(Elem->Msg, &DelbaReq, + sizeof(DelbaReq)); + MlmeDELBAAction(pAd, Elem); + kfree(Elem); + } else { + DBGPRINT(RT_DEBUG_ERROR, + ("%s():alloc memory failed!\n", + __func__)); return; } } - // // 2. Free resource of BA session // @@ -1008,7 +943,8 @@ VOID BARecSessionTearDown( pBAEntry->LastIndSeq = RESET_RCV_SEQ; pBAEntry->BAWinSize = 0; // Erase Bitmap flag at software mactable - pAd->MacTab.Content[Wcid].RXBAbitmap &= (~(1<<(pBAEntry->TID))); + pAd->MacTab.Content[Wcid].RXBAbitmap &= + (~(1 << (pBAEntry->TID))); pAd->MacTab.Content[Wcid].BARecWcidArray[TID] = 0; RTMP_DEL_BA_SESSION_FROM_ASIC(pAd, Wcid, TID); @@ -1020,20 +956,16 @@ VOID BARecSessionTearDown( BATableFreeRecEntry(pAd, Idx); } -VOID BASessionTearDownALL( - IN OUT PRTMP_ADAPTER pAd, - IN UCHAR Wcid) +VOID BASessionTearDownALL(IN OUT PRTMP_ADAPTER pAd, IN UCHAR Wcid) { int i; - for (i=0; ipAdapter; { - // Do nothing if monitor mode is on - if (MONITOR_ON(pAd)) - return; + // Do nothing if monitor mode is on + if (MONITOR_ON(pAd)) + return; } - pEntry = &pAd->MacTab.Content[pBAEntry->Wcid]; - if ((pBAEntry->ORI_BA_Status == Originator_WaitRes) && (pBAEntry->Token < ORI_SESSION_MAX_RETRY)) - { - MLME_ADDBA_REQ_STRUCT AddbaReq; + if ((pBAEntry->ORI_BA_Status == Originator_WaitRes) + && (pBAEntry->Token < ORI_SESSION_MAX_RETRY)) { + MLME_ADDBA_REQ_STRUCT AddbaReq; NdisZeroMemory(&AddbaReq, sizeof(AddbaReq)); COPY_MAC_ADDR(AddbaReq.pAddr, pEntry->Addr); - AddbaReq.Wcid = (UCHAR)(pEntry->Aid); + AddbaReq.Wcid = (UCHAR) (pEntry->Aid); AddbaReq.TID = pBAEntry->TID; - AddbaReq.BaBufSize = pAd->CommonCfg.BACapability.field.RxBAWinLimit; + AddbaReq.BaBufSize = + pAd->CommonCfg.BACapability.field.RxBAWinLimit; AddbaReq.TimeOutValue = 0; AddbaReq.Token = pBAEntry->Token; - MlmeEnqueue(pAd, ACTION_STATE_MACHINE, MT2_MLME_ADD_BA_CATE, sizeof(MLME_ADDBA_REQ_STRUCT), (PVOID)&AddbaReq); + MlmeEnqueue(pAd, ACTION_STATE_MACHINE, MT2_MLME_ADD_BA_CATE, + sizeof(MLME_ADDBA_REQ_STRUCT), (PVOID) & AddbaReq); RTMP_MLME_HANDLER(pAd); - DBGPRINT(RT_DEBUG_TRACE,("BA Ori Session Timeout(%d) : Send ADD BA again\n", pBAEntry->Token)); + DBGPRINT(RT_DEBUG_TRACE, + ("BA Ori Session Timeout(%d) : Send ADD BA again\n", + pBAEntry->Token)); pBAEntry->Token++; RTMPSetTimer(&pBAEntry->ORIBATimer, ORI_BA_SESSION_TIMEOUT); - } - else - { + } else { BATableFreeOriEntry(pAd, pEntry->BAOriWcidArray[pBAEntry->TID]); } } @@ -1110,54 +1042,51 @@ VOID BAOriSessionSetupTimeout( FALSE , then continue indicaterx at this moment. ========================================================================== */ -VOID BARecSessionIdleTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +VOID BARecSessionIdleTimeout(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) { - BA_REC_ENTRY *pBAEntry = (BA_REC_ENTRY *)FunctionContext; - PRTMP_ADAPTER pAd; - ULONG Now32; + BA_REC_ENTRY *pBAEntry = (BA_REC_ENTRY *) FunctionContext; + PRTMP_ADAPTER pAd; + ULONG Now32; if (pBAEntry == NULL) return; - if ((pBAEntry->REC_BA_Status == Recipient_Accept)) - { + if ((pBAEntry->REC_BA_Status == Recipient_Accept)) { NdisGetSystemUpTime(&Now32); - if (RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer + REC_BA_SESSION_IDLE_TIMEOUT))) - { + if (RTMP_TIME_AFTER + ((unsigned long)Now32, + (unsigned long)(pBAEntry->LastIndSeqAtTimer + + REC_BA_SESSION_IDLE_TIMEOUT))) { pAd = pBAEntry->pAdapter; // flush all pending reordering mpdus ba_refresh_reordering_mpdus(pAd, pBAEntry); - DBGPRINT(RT_DEBUG_OFF, ("%ld: REC BA session Timeout\n", Now32)); + DBGPRINT(RT_DEBUG_OFF, + ("%ld: REC BA session Timeout\n", Now32)); } } } - -VOID PeerAddBAReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) - +VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - // 7.4.4.1 - //ULONG Idx; - UCHAR Status = 1; - UCHAR pAddr[6]; + // 7.4.4.1 + //ULONG Idx; + UCHAR Status = 1; + UCHAR pAddr[6]; FRAME_ADDBA_RSP ADDframe; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - PFRAME_ADDBA_REQ pAddreqFrame = NULL; - //UCHAR BufSize; - ULONG FrameLen; - PULONG ptemp; - PMAC_TABLE_ENTRY pMacEntry; + PUCHAR pOutBuffer = NULL; + NDIS_STATUS NStatus; + PFRAME_ADDBA_REQ pAddreqFrame = NULL; + //UCHAR BufSize; + ULONG FrameLen; + PULONG ptemp; + PMAC_TABLE_ENTRY pMacEntry; - DBGPRINT(RT_DEBUG_TRACE, ("%s ==> (Wcid = %d)\n", __func__, Elem->Wcid)); + DBGPRINT(RT_DEBUG_TRACE, + ("%s ==> (Wcid = %d)\n", __func__, Elem->Wcid)); //hex_dump("AddBAReq", Elem->Msg, Elem->MsgLen); @@ -1166,37 +1095,37 @@ VOID PeerAddBAReqAction( return; pMacEntry = &pAd->MacTab.Content[Elem->Wcid]; - DBGPRINT(RT_DEBUG_TRACE,("BA - PeerAddBAReqAction----> \n")); - ptemp = (PULONG)Elem->Msg; + DBGPRINT(RT_DEBUG_TRACE, ("BA - PeerAddBAReqAction----> \n")); + ptemp = (PULONG) Elem->Msg; //DBGPRINT_RAW(RT_DEBUG_EMU, ("%08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x\n", *(ptemp), *(ptemp+1), *(ptemp+2), *(ptemp+3), *(ptemp+4), *(ptemp+5), *(ptemp+6), *(ptemp+7), *(ptemp+8))); - if (PeerAddBAReqActionSanity(pAd, Elem->Msg, Elem->MsgLen, pAddr)) - { + if (PeerAddBAReqActionSanity(pAd, Elem->Msg, Elem->MsgLen, pAddr)) { - if ((pAd->CommonCfg.bBADecline == FALSE) && IS_HT_STA(pMacEntry)) - { - pAddreqFrame = (PFRAME_ADDBA_REQ)(&Elem->Msg[0]); - DBGPRINT(RT_DEBUG_OFF, ("Rcv Wcid(%d) AddBAReq\n", Elem->Wcid)); - if (BARecSessionAdd(pAd, &pAd->MacTab.Content[Elem->Wcid], pAddreqFrame)) + if ((pAd->CommonCfg.bBADecline == FALSE) + && IS_HT_STA(pMacEntry)) { + pAddreqFrame = (PFRAME_ADDBA_REQ) (&Elem->Msg[0]); + DBGPRINT(RT_DEBUG_OFF, + ("Rcv Wcid(%d) AddBAReq\n", Elem->Wcid)); + if (BARecSessionAdd + (pAd, &pAd->MacTab.Content[Elem->Wcid], + pAddreqFrame)) Status = 0; else - Status = 38; // more parameters have invalid values - } - else - { - Status = 37; // the request has been declined. + Status = 38; // more parameters have invalid values + } else { + Status = 37; // the request has been declined. } } if (pAd->MacTab.Content[Elem->Wcid].ValidAsCLI) ASSERT(pAd->MacTab.Content[Elem->Wcid].Sst == SST_ASSOC); - pAddreqFrame = (PFRAME_ADDBA_REQ)(&Elem->Msg[0]); + pAddreqFrame = (PFRAME_ADDBA_REQ) (&Elem->Msg[0]); // 2. Always send back ADDBA Response - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE,("ACTION - PeerBAAction() allocate memory failed \n")); + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_TRACE, + ("ACTION - PeerBAAction() allocate memory failed \n")); return; } @@ -1205,9 +1134,12 @@ VOID PeerAddBAReqAction( // 2-1. Prepare ADDBA Response frame. { if (ADHOC_ON(pAd)) - ActHeaderInit(pAd, &ADDframe.Hdr, pAddr, pAd->CurrentAddress, pAd->CommonCfg.Bssid); + ActHeaderInit(pAd, &ADDframe.Hdr, pAddr, + pAd->CurrentAddress, + pAd->CommonCfg.Bssid); else - ActHeaderInit(pAd, &ADDframe.Hdr, pAd->CommonCfg.Bssid, pAd->CurrentAddress, pAddr); + ActHeaderInit(pAd, &ADDframe.Hdr, pAd->CommonCfg.Bssid, + pAd->CurrentAddress, pAddr); } ADDframe.Category = CATEGORY_BA; @@ -1218,37 +1150,35 @@ VOID PeerAddBAReqAction( ADDframe.BaParm.BAPolicy = IMMED_BA; ADDframe.BaParm.AMSDUSupported = 0; ADDframe.BaParm.TID = pAddreqFrame->BaParm.TID; - ADDframe.BaParm.BufSize = min(((UCHAR)pAddreqFrame->BaParm.BufSize), (UCHAR)pAd->CommonCfg.BACapability.field.RxBAWinLimit); - if (ADDframe.BaParm.BufSize == 0) - { + ADDframe.BaParm.BufSize = + min(((UCHAR) pAddreqFrame->BaParm.BufSize), + (UCHAR) pAd->CommonCfg.BACapability.field.RxBAWinLimit); + if (ADDframe.BaParm.BufSize == 0) { ADDframe.BaParm.BufSize = 64; } - ADDframe.TimeOutValue = 0; //pAddreqFrame->TimeOutValue; + ADDframe.TimeOutValue = 0; //pAddreqFrame->TimeOutValue; - *(USHORT *)(&ADDframe.BaParm) = cpu2le16(*(USHORT *)(&ADDframe.BaParm)); + *(USHORT *) (&ADDframe.BaParm) = + cpu2le16(*(USHORT *) (&ADDframe.BaParm)); ADDframe.StatusCode = cpu2le16(ADDframe.StatusCode); ADDframe.TimeOutValue = cpu2le16(ADDframe.TimeOutValue); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_ADDBA_RSP), &ADDframe, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer, &FrameLen, + sizeof(FRAME_ADDBA_RSP), &ADDframe, END_OF_ARGS); MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); - DBGPRINT(RT_DEBUG_TRACE, ("%s(%d): TID(%d), BufSize(%d) <== \n", __func__, Elem->Wcid, ADDframe.BaParm.TID, - ADDframe.BaParm.BufSize)); + DBGPRINT(RT_DEBUG_TRACE, + ("%s(%d): TID(%d), BufSize(%d) <== \n", __func__, Elem->Wcid, + ADDframe.BaParm.TID, ADDframe.BaParm.BufSize)); } - -VOID PeerAddBARspAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) - +VOID PeerAddBARspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - //UCHAR Idx, i; - //PUCHAR pOutBuffer = NULL; - PFRAME_ADDBA_RSP pFrame = NULL; - //PBA_ORI_ENTRY pBAEntry; + //UCHAR Idx, i; + //PUCHAR pOutBuffer = NULL; + PFRAME_ADDBA_RSP pFrame = NULL; + //PBA_ORI_ENTRY pBAEntry; //ADDBA Response from unknown peer, ignore this. if (Elem->Wcid >= MAX_LEN_OF_MAC_TABLE) @@ -1258,120 +1188,119 @@ VOID PeerAddBARspAction( //hex_dump("PeerAddBARspAction()", Elem->Msg, Elem->MsgLen); - if (PeerAddBARspActionSanity(pAd, Elem->Msg, Elem->MsgLen)) - { - pFrame = (PFRAME_ADDBA_RSP)(&Elem->Msg[0]); + if (PeerAddBARspActionSanity(pAd, Elem->Msg, Elem->MsgLen)) { + pFrame = (PFRAME_ADDBA_RSP) (&Elem->Msg[0]); - DBGPRINT(RT_DEBUG_TRACE, ("\t\t StatusCode = %d\n", pFrame->StatusCode)); - switch (pFrame->StatusCode) - { - case 0: - // I want a BAsession with this peer as an originator. - BAOriSessionAdd(pAd, &pAd->MacTab.Content[Elem->Wcid], pFrame); - break; - default: - // check status == USED ??? - BAOriSessionTearDown(pAd, Elem->Wcid, pFrame->BaParm.TID, TRUE, FALSE); - break; + DBGPRINT(RT_DEBUG_TRACE, + ("\t\t StatusCode = %d\n", pFrame->StatusCode)); + switch (pFrame->StatusCode) { + case 0: + // I want a BAsession with this peer as an originator. + BAOriSessionAdd(pAd, &pAd->MacTab.Content[Elem->Wcid], + pFrame); + break; + default: + // check status == USED ??? + BAOriSessionTearDown(pAd, Elem->Wcid, + pFrame->BaParm.TID, TRUE, FALSE); + break; } // Rcv Decline StatusCode if ((pFrame->StatusCode == 37) - || ((pAd->OpMode == OPMODE_STA) && STA_TGN_WIFI_ON(pAd) && (pFrame->StatusCode != 0)) - ) - { - pAd->MacTab.Content[Elem->Wcid].BADeclineBitmap |= 1<BaParm.TID; + || ((pAd->OpMode == OPMODE_STA) && STA_TGN_WIFI_ON(pAd) + && (pFrame->StatusCode != 0)) + ) { + pAd->MacTab.Content[Elem->Wcid].BADeclineBitmap |= + 1 << pFrame->BaParm.TID; } } } -VOID PeerDelBAAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) - +VOID PeerDelBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - //UCHAR Idx; - //PUCHAR pOutBuffer = NULL; - PFRAME_DELBA_REQ pDelFrame = NULL; + //UCHAR Idx; + //PUCHAR pOutBuffer = NULL; + PFRAME_DELBA_REQ pDelFrame = NULL; - DBGPRINT(RT_DEBUG_TRACE,("%s ==>\n", __func__)); + DBGPRINT(RT_DEBUG_TRACE, ("%s ==>\n", __func__)); //DELBA Request from unknown peer, ignore this. - if (PeerDelBAActionSanity(pAd, Elem->Wcid, Elem->Msg, Elem->MsgLen)) - { - pDelFrame = (PFRAME_DELBA_REQ)(&Elem->Msg[0]); - if (pDelFrame->DelbaParm.Initiator == ORIGINATOR) - { - DBGPRINT(RT_DEBUG_TRACE,("BA - PeerDelBAAction----> ORIGINATOR\n")); - BARecSessionTearDown(pAd, Elem->Wcid, pDelFrame->DelbaParm.TID, TRUE); - } - else - { - DBGPRINT(RT_DEBUG_TRACE,("BA - PeerDelBAAction----> RECIPIENT, Reason = %d\n", pDelFrame->ReasonCode)); + if (PeerDelBAActionSanity(pAd, Elem->Wcid, Elem->Msg, Elem->MsgLen)) { + pDelFrame = (PFRAME_DELBA_REQ) (&Elem->Msg[0]); + if (pDelFrame->DelbaParm.Initiator == ORIGINATOR) { + DBGPRINT(RT_DEBUG_TRACE, + ("BA - PeerDelBAAction----> ORIGINATOR\n")); + BARecSessionTearDown(pAd, Elem->Wcid, + pDelFrame->DelbaParm.TID, TRUE); + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("BA - PeerDelBAAction----> RECIPIENT, Reason = %d\n", + pDelFrame->ReasonCode)); //hex_dump("DelBA Frame", pDelFrame, Elem->MsgLen); - BAOriSessionTearDown(pAd, Elem->Wcid, pDelFrame->DelbaParm.TID, TRUE, FALSE); + BAOriSessionTearDown(pAd, Elem->Wcid, + pDelFrame->DelbaParm.TID, TRUE, + FALSE); } } } - -BOOLEAN CntlEnqueueForRecv( - IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN ULONG MsgLen, - IN PFRAME_BA_REQ pMsg) +BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd, + IN ULONG Wcid, + IN ULONG MsgLen, IN PFRAME_BA_REQ pMsg) { - PFRAME_BA_REQ pFrame = pMsg; - //PRTMP_REORDERBUF pBuffer; - //PRTMP_REORDERBUF pDmaBuf; + PFRAME_BA_REQ pFrame = pMsg; + //PRTMP_REORDERBUF pBuffer; + //PRTMP_REORDERBUF pDmaBuf; PBA_REC_ENTRY pBAEntry; - //BOOLEAN Result; - ULONG Idx; - //UCHAR NumRxPkt; - UCHAR TID;//, i; + //BOOLEAN Result; + ULONG Idx; + //UCHAR NumRxPkt; + UCHAR TID; //, i; - TID = (UCHAR)pFrame->BARControl.TID; + TID = (UCHAR) pFrame->BARControl.TID; - DBGPRINT(RT_DEBUG_TRACE, ("%s(): BAR-Wcid(%ld), Tid (%d)\n", __func__, Wcid, TID)); + DBGPRINT(RT_DEBUG_TRACE, + ("%s(): BAR-Wcid(%ld), Tid (%d)\n", __func__, Wcid, TID)); //hex_dump("BAR", (PCHAR) pFrame, MsgLen); // Do nothing if the driver is starting halt state. // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + if (RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return FALSE; // First check the size, it MUST not exceed the mlme queue size - if (MsgLen > MGMT_DMA_BUFFER_SIZE) - { + if (MsgLen > MGMT_DMA_BUFFER_SIZE) { DBGPRINT_ERR(("CntlEnqueueForRecv: frame too large, size = %ld \n", MsgLen)); return FALSE; - } - else if (MsgLen != sizeof(FRAME_BA_REQ)) - { + } else if (MsgLen != sizeof(FRAME_BA_REQ)) { DBGPRINT_ERR(("CntlEnqueueForRecv: BlockAck Request frame length size = %ld incorrect\n", MsgLen)); return FALSE; - } - else if (MsgLen != sizeof(FRAME_BA_REQ)) - { + } else if (MsgLen != sizeof(FRAME_BA_REQ)) { DBGPRINT_ERR(("CntlEnqueueForRecv: BlockAck Request frame length size = %ld incorrect\n", MsgLen)); return FALSE; } - if ((Wcid < MAX_LEN_OF_MAC_TABLE) && (TID < 8)) - { + if ((Wcid < MAX_LEN_OF_MAC_TABLE) && (TID < 8)) { // if this receiving packet is from SA that is in our OriEntry. Since WCID <9 has direct mapping. no need search. Idx = pAd->MacTab.Content[Wcid].BARecWcidArray[TID]; pBAEntry = &pAd->BATable.BARecEntry[Idx]; - } - else - { + } else { return FALSE; } - DBGPRINT(RT_DEBUG_TRACE, ("BAR(%ld) : Tid (%d) - %04x:%04x\n", Wcid, TID, pFrame->BAStartingSeq.field.StartSeq, pBAEntry->LastIndSeq )); + DBGPRINT(RT_DEBUG_TRACE, + ("BAR(%ld) : Tid (%d) - %04x:%04x\n", Wcid, TID, + pFrame->BAStartingSeq.field.StartSeq, pBAEntry->LastIndSeq)); - if (SEQ_SMALLER(pBAEntry->LastIndSeq, pFrame->BAStartingSeq.field.StartSeq, MAXSEQ)) - { + if (SEQ_SMALLER + (pBAEntry->LastIndSeq, pFrame->BAStartingSeq.field.StartSeq, + MAXSEQ)) { //DBGPRINT(RT_DEBUG_TRACE, ("BAR Seq = %x, LastIndSeq = %x\n", pFrame->BAStartingSeq.field.StartSeq, pBAEntry->LastIndSeq)); - ba_indicate_reordering_mpdus_le_seq(pAd, pBAEntry, pFrame->BAStartingSeq.field.StartSeq); - pBAEntry->LastIndSeq = (pFrame->BAStartingSeq.field.StartSeq == 0) ? MAXSEQ :(pFrame->BAStartingSeq.field.StartSeq -1); + ba_indicate_reordering_mpdus_le_seq(pAd, pBAEntry, + pFrame->BAStartingSeq.field. + StartSeq); + pBAEntry->LastIndSeq = + (pFrame->BAStartingSeq.field.StartSeq == + 0) ? MAXSEQ : (pFrame->BAStartingSeq.field.StartSeq - 1); } //ba_refresh_reordering_mpdus(pAd, pBAEntry); return TRUE; @@ -1380,101 +1309,91 @@ BOOLEAN CntlEnqueueForRecv( /* Description : Send PSMP Action frame If PSMP mode switches. */ -VOID SendPSMPAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR Psmp) +VOID SendPSMPAction(IN PRTMP_ADAPTER pAd, IN UCHAR Wcid, IN UCHAR Psmp) { - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; + PUCHAR pOutBuffer = NULL; + NDIS_STATUS NStatus; //ULONG Idx; - FRAME_PSMP_ACTION Frame; - ULONG FrameLen; + FRAME_PSMP_ACTION Frame; + ULONG FrameLen; - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_ERROR,("BA - MlmeADDBAAction() allocate memory failed \n")); + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_ERROR, + ("BA - MlmeADDBAAction() allocate memory failed \n")); return; } - ActHeaderInit(pAd, &Frame.Hdr, pAd->CommonCfg.Bssid, pAd->CurrentAddress, pAd->MacTab.Content[Wcid].Addr); + ActHeaderInit(pAd, &Frame.Hdr, pAd->CommonCfg.Bssid, + pAd->CurrentAddress, pAd->MacTab.Content[Wcid].Addr); Frame.Category = CATEGORY_HT; Frame.Action = SMPS_ACTION; - switch (Psmp) - { - case MMPS_ENABLE: + switch (Psmp) { + case MMPS_ENABLE: #ifdef RT30xx - if (IS_RT30xx(pAd) - &&(pAd->Antenna.field.RxPath>1||pAd->Antenna.field.TxPath>1)) - { - RTMP_ASIC_MMPS_DISABLE(pAd); - } + if (IS_RT30xx(pAd) + && (pAd->Antenna.field.RxPath > 1 + || pAd->Antenna.field.TxPath > 1)) { + RTMP_ASIC_MMPS_DISABLE(pAd); + } #endif // RT30xx // - Frame.Psmp = 0; - break; - case MMPS_DYNAMIC: - Frame.Psmp = 3; - break; - case MMPS_STATIC: + Frame.Psmp = 0; + break; + case MMPS_DYNAMIC: + Frame.Psmp = 3; + break; + case MMPS_STATIC: #ifdef RT30xx - if (IS_RT30xx(pAd) - &&(pAd->Antenna.field.RxPath>1||pAd->Antenna.field.TxPath>1)) - { - RTMP_ASIC_MMPS_ENABLE(pAd); - } + if (IS_RT30xx(pAd) + && (pAd->Antenna.field.RxPath > 1 + || pAd->Antenna.field.TxPath > 1)) { + RTMP_ASIC_MMPS_ENABLE(pAd); + } #endif // RT30xx // - Frame.Psmp = 1; - break; + Frame.Psmp = 1; + break; } - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_PSMP_ACTION), &Frame, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer, &FrameLen, + sizeof(FRAME_PSMP_ACTION), &Frame, END_OF_ARGS); MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); - DBGPRINT(RT_DEBUG_ERROR,("HT - SendPSMPAction( %d ) \n", Frame.Psmp)); + DBGPRINT(RT_DEBUG_ERROR, ("HT - SendPSMPAction( %d ) \n", Frame.Psmp)); } - #define RADIO_MEASUREMENT_REQUEST_ACTION 0 -typedef struct PACKED -{ - UCHAR RegulatoryClass; - UCHAR ChannelNumber; - USHORT RandomInterval; - USHORT MeasurementDuration; - UCHAR MeasurementMode; - UCHAR BSSID[MAC_ADDR_LEN]; - UCHAR ReportingCondition; - UCHAR Threshold; - UCHAR SSIDIE[2]; // 2 byte +typedef struct PACKED { + UCHAR RegulatoryClass; + UCHAR ChannelNumber; + USHORT RandomInterval; + USHORT MeasurementDuration; + UCHAR MeasurementMode; + UCHAR BSSID[MAC_ADDR_LEN]; + UCHAR ReportingCondition; + UCHAR Threshold; + UCHAR SSIDIE[2]; // 2 byte } BEACON_REQUEST; -typedef struct PACKED -{ - UCHAR ID; - UCHAR Length; - UCHAR Token; - UCHAR RequestMode; - UCHAR Type; +typedef struct PACKED { + UCHAR ID; + UCHAR Length; + UCHAR Token; + UCHAR RequestMode; + UCHAR Type; } MEASUREMENT_REQ; - - - -void convert_reordering_packet_to_preAMSDU_or_802_3_packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) +void convert_reordering_packet_to_preAMSDU_or_802_3_packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, + IN UCHAR + FromWhichBSSID) { - PNDIS_PACKET pRxPkt; - UCHAR Header802_3[LENGTH_802_3]; + PNDIS_PACKET pRxPkt; + UCHAR Header802_3[LENGTH_802_3]; // 1. get 802.3 Header // 2. remove LLC - // a. pointer pRxBlk->pData to payload + // a. pointer pRxBlk->pData to payload // b. modify pRxBlk->DataSize RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(pRxBlk, Header802_3); @@ -1490,17 +1409,16 @@ void convert_reordering_packet_to_preAMSDU_or_802_3_packet( // // copy 802.3 header, if necessary // - if (!RX_BLK_TEST_FLAG(pRxBlk, fRX_AMSDU)) - { + if (!RX_BLK_TEST_FLAG(pRxBlk, fRX_AMSDU)) { { #ifdef LINUX - NdisMoveMemory(skb_push(pRxPkt, LENGTH_802_3), Header802_3, LENGTH_802_3); + NdisMoveMemory(skb_push(pRxPkt, LENGTH_802_3), + Header802_3, LENGTH_802_3); #endif - } + } } } - #define INDICATE_LEGACY_OR_AMSDU(_pAd, _pRxBlk, _fromWhichBSSID) \ do \ { \ @@ -1518,21 +1436,16 @@ void convert_reordering_packet_to_preAMSDU_or_802_3_packet( } \ } while (0); - - -static VOID ba_enqueue_reordering_packet( - IN PRTMP_ADAPTER pAd, - IN PBA_REC_ENTRY pBAEntry, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) +static VOID ba_enqueue_reordering_packet(IN PRTMP_ADAPTER pAd, + IN PBA_REC_ENTRY pBAEntry, + IN RX_BLK * pRxBlk, + IN UCHAR FromWhichBSSID) { struct reordering_mpdu *mpdu_blk; - UINT16 Sequence = (UINT16) pRxBlk->pHeader->Sequence; + UINT16 Sequence = (UINT16) pRxBlk->pHeader->Sequence; mpdu_blk = ba_mpdu_blk_alloc(pAd); - if ((mpdu_blk != NULL) && - (!RX_BLK_TEST_FLAG(pRxBlk, fRX_EAP))) - { + if ((mpdu_blk != NULL) && (!RX_BLK_TEST_FLAG(pRxBlk, fRX_EAP))) { // Write RxD buffer address & allocated buffer length NdisAcquireSpinLock(&pBAEntry->RxReRingLock); @@ -1540,11 +1453,13 @@ static VOID ba_enqueue_reordering_packet( mpdu_blk->bAMSDU = RX_BLK_TEST_FLAG(pRxBlk, fRX_AMSDU); - convert_reordering_packet_to_preAMSDU_or_802_3_packet(pAd, pRxBlk, FromWhichBSSID); + convert_reordering_packet_to_preAMSDU_or_802_3_packet(pAd, + pRxBlk, + FromWhichBSSID); STATS_INC_RX_PACKETS(pAd, FromWhichBSSID); - // + // // it is necessary for reordering packet to record // which BSS it come from // @@ -1552,21 +1467,22 @@ static VOID ba_enqueue_reordering_packet( mpdu_blk->pPacket = pRxBlk->pRxPacket; - if (ba_reordering_mpdu_insertsorted(&pBAEntry->list, mpdu_blk) == FALSE) - { + if (ba_reordering_mpdu_insertsorted(&pBAEntry->list, mpdu_blk) + == FALSE) { // had been already within reordering list // don't indicate - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_SUCCESS); + RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, + NDIS_STATUS_SUCCESS); ba_mpdu_blk_free(pAd, mpdu_blk); } - ASSERT((0<= pBAEntry->list.qlen) && (pBAEntry->list.qlen <= pBAEntry->BAWinSize)); + ASSERT((0 <= pBAEntry->list.qlen) + && (pBAEntry->list.qlen <= pBAEntry->BAWinSize)); NdisReleaseSpinLock(&pBAEntry->RxReRingLock); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("!!! (%d) Can't allocate reordering mpdu blk\n", - pBAEntry->list.qlen)); + } else { + DBGPRINT(RT_DEBUG_ERROR, + ("!!! (%d) Can't allocate reordering mpdu blk\n", + pBAEntry->list.qlen)); /* * flush all pending reordering mpdus @@ -1581,7 +1497,6 @@ static VOID ba_enqueue_reordering_packet( } } - /* ========================================================================== Description: @@ -1600,43 +1515,38 @@ static VOID ba_enqueue_reordering_packet( ========================================================================== */ -VOID Indicate_AMPDU_Packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) +VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) { - USHORT Idx; - PBA_REC_ENTRY pBAEntry = NULL; - UINT16 Sequence = pRxBlk->pHeader->Sequence; - ULONG Now32; - UCHAR Wcid = pRxBlk->pRxWI->WirelessCliID; - UCHAR TID = pRxBlk->pRxWI->TID; - - - if (!RX_BLK_TEST_FLAG(pRxBlk, fRX_AMSDU) && (pRxBlk->DataSize > MAX_RX_PKT_LEN)) - { + USHORT Idx; + PBA_REC_ENTRY pBAEntry = NULL; + UINT16 Sequence = pRxBlk->pHeader->Sequence; + ULONG Now32; + UCHAR Wcid = pRxBlk->pRxWI->WirelessCliID; + UCHAR TID = pRxBlk->pRxWI->TID; + + if (!RX_BLK_TEST_FLAG(pRxBlk, fRX_AMSDU) + && (pRxBlk->DataSize > MAX_RX_PKT_LEN)) { // release packet - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); + RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, + NDIS_STATUS_FAILURE); return; } - if (Wcid < MAX_LEN_OF_MAC_TABLE) - { + if (Wcid < MAX_LEN_OF_MAC_TABLE) { Idx = pAd->MacTab.Content[Wcid].BARecWcidArray[TID]; - if (Idx == 0) - { + if (Idx == 0) { /* Rec BA Session had been torn down */ INDICATE_LEGACY_OR_AMSDU(pAd, pRxBlk, FromWhichBSSID); return; } pBAEntry = &pAd->BATable.BARecEntry[Idx]; - } - else - { + } else { // impossible !!! ASSERT(0); // release packet - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); + RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, + NDIS_STATUS_FAILURE); return; } @@ -1647,16 +1557,15 @@ VOID Indicate_AMPDU_Packet( pBAEntry->rcvSeq = Sequence; - ba_flush_reordering_timeout_mpdus(pAd, pBAEntry, Now32); pBAEntry->LastIndSeqAtTimer = Now32; // // Reset Last Indicate Sequence // - if (pBAEntry->LastIndSeq == RESET_RCV_SEQ) - { - ASSERT((pBAEntry->list.qlen == 0) && (pBAEntry->list.next == NULL)); + if (pBAEntry->LastIndSeq == RESET_RCV_SEQ) { + ASSERT((pBAEntry->list.qlen == 0) + && (pBAEntry->list.next == NULL)); // reset rcv sequence of BA session pBAEntry->LastIndSeq = Sequence; @@ -1665,19 +1574,18 @@ VOID Indicate_AMPDU_Packet( return; } - // // I. Check if in order. // - if (SEQ_STEPONE(Sequence, pBAEntry->LastIndSeq, MAXSEQ)) - { - USHORT LastIndSeq; + if (SEQ_STEPONE(Sequence, pBAEntry->LastIndSeq, MAXSEQ)) { + USHORT LastIndSeq; pBAEntry->LastIndSeq = Sequence; INDICATE_LEGACY_OR_AMSDU(pAd, pRxBlk, FromWhichBSSID); - LastIndSeq = ba_indicate_reordering_mpdus_in_order(pAd, pBAEntry, pBAEntry->LastIndSeq); - if (LastIndSeq != RESET_RCV_SEQ) - { + LastIndSeq = + ba_indicate_reordering_mpdus_in_order(pAd, pBAEntry, + pBAEntry->LastIndSeq); + if (LastIndSeq != RESET_RCV_SEQ) { pBAEntry->LastIndSeq = LastIndSeq; } pBAEntry->LastIndSeqAtTimer = Now32; @@ -1685,54 +1593,56 @@ VOID Indicate_AMPDU_Packet( // // II. Drop Duplicated Packet // - else if (Sequence == pBAEntry->LastIndSeq) - { + else if (Sequence == pBAEntry->LastIndSeq) { // drop and release packet pBAEntry->nDropPacket++; - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); + RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, + NDIS_STATUS_FAILURE); } // // III. Drop Old Received Packet // - else if (SEQ_SMALLER(Sequence, pBAEntry->LastIndSeq, MAXSEQ)) - { + else if (SEQ_SMALLER(Sequence, pBAEntry->LastIndSeq, MAXSEQ)) { // drop and release packet pBAEntry->nDropPacket++; - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); + RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, + NDIS_STATUS_FAILURE); } // // IV. Receive Sequence within Window Size // - else if (SEQ_SMALLER(Sequence, (((pBAEntry->LastIndSeq+pBAEntry->BAWinSize+1)) & MAXSEQ), MAXSEQ)) - { - ba_enqueue_reordering_packet(pAd, pBAEntry, pRxBlk, FromWhichBSSID); + else if (SEQ_SMALLER + (Sequence, + (((pBAEntry->LastIndSeq + pBAEntry->BAWinSize + 1)) & MAXSEQ), + MAXSEQ)) { + ba_enqueue_reordering_packet(pAd, pBAEntry, pRxBlk, + FromWhichBSSID); } // // V. Receive seq surpasses Win(lastseq + nMSDU). So refresh all reorder buffer // - else - { + else { LONG WinStartSeq, TmpSeq; - - TmpSeq = Sequence - (pBAEntry->BAWinSize) -1; - if (TmpSeq < 0) - { - TmpSeq = (MAXSEQ+1) + TmpSeq; + TmpSeq = Sequence - (pBAEntry->BAWinSize) - 1; + if (TmpSeq < 0) { + TmpSeq = (MAXSEQ + 1) + TmpSeq; } - WinStartSeq = (TmpSeq+1) & MAXSEQ; + WinStartSeq = (TmpSeq + 1) & MAXSEQ; ba_indicate_reordering_mpdus_le_seq(pAd, pBAEntry, WinStartSeq); - pBAEntry->LastIndSeq = WinStartSeq; //TmpSeq; + pBAEntry->LastIndSeq = WinStartSeq; //TmpSeq; pBAEntry->LastIndSeqAtTimer = Now32; - ba_enqueue_reordering_packet(pAd, pBAEntry, pRxBlk, FromWhichBSSID); + ba_enqueue_reordering_packet(pAd, pBAEntry, pRxBlk, + FromWhichBSSID); - TmpSeq = ba_indicate_reordering_mpdus_in_order(pAd, pBAEntry, pBAEntry->LastIndSeq); - if (TmpSeq != RESET_RCV_SEQ) - { + TmpSeq = + ba_indicate_reordering_mpdus_in_order(pAd, pBAEntry, + pBAEntry->LastIndSeq); + if (TmpSeq != RESET_RCV_SEQ) { pBAEntry->LastIndSeq = TmpSeq; } } diff --git a/drivers/staging/rt2860/common/cmm_aes.c b/drivers/staging/rt2860/common/cmm_aes.c index 2c311b166784..a3758b0b8a29 100644 --- a/drivers/staging/rt2860/common/cmm_aes.c +++ b/drivers/staging/rt2860/common/cmm_aes.c @@ -37,21 +37,17 @@ #include "../rt_config.h" - -typedef struct -{ - UINT32 erk[64]; /* encryption round keys */ - UINT32 drk[64]; /* decryption round keys */ - int nr; /* number of rounds */ -} -aes_context; +typedef struct { + UINT32 erk[64]; /* encryption round keys */ + UINT32 drk[64]; /* decryption round keys */ + int nr; /* number of rounds */ +} aes_context; /*****************************/ /******** SBOX Table *********/ /*****************************/ -UCHAR SboxTable[256] = -{ +UCHAR SboxTable[256] = { 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, @@ -86,46 +82,34 @@ UCHAR SboxTable[256] = 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 }; -VOID xor_32( - IN PUCHAR a, - IN PUCHAR b, - OUT PUCHAR out) +VOID xor_32(IN PUCHAR a, IN PUCHAR b, OUT PUCHAR out) { INT i; - for (i=0;i<4; i++) - { + for (i = 0; i < 4; i++) { out[i] = a[i] ^ b[i]; } } -VOID xor_128( - IN PUCHAR a, - IN PUCHAR b, - OUT PUCHAR out) +VOID xor_128(IN PUCHAR a, IN PUCHAR b, OUT PUCHAR out) { INT i; - for (i=0;i<16; i++) - { + for (i = 0; i < 16; i++) { out[i] = a[i] ^ b[i]; } } -UCHAR RTMPCkipSbox( - IN UCHAR a) +UCHAR RTMPCkipSbox(IN UCHAR a) { return SboxTable[(int)a]; } -VOID next_key( - IN PUCHAR key, - IN INT round) +VOID next_key(IN PUCHAR key, IN INT round) { - UCHAR rcon; - UCHAR sbox_key[4]; - UCHAR rcon_table[12] = - { + UCHAR rcon; + UCHAR sbox_key[4]; + UCHAR rcon_table[12] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x36, 0x36 }; @@ -145,14 +129,11 @@ VOID next_key( xor_32(&key[12], &key[8], &key[12]); } -VOID byte_sub( - IN PUCHAR in, - OUT PUCHAR out) +VOID byte_sub(IN PUCHAR in, OUT PUCHAR out) { INT i; - for (i=0; i< 16; i++) - { + for (i = 0; i < 16; i++) { out[i] = RTMPCkipSbox(in[i]); } } @@ -165,26 +146,23 @@ VOID byte_sub( void bitwise_xor(unsigned char *ina, unsigned char *inb, unsigned char *out) { int i; - for (i=0; i<16; i++) - { + for (i = 0; i < 16; i++) { out[i] = ina[i] ^ inb[i]; } } -VOID shift_row( - IN PUCHAR in, - OUT PUCHAR out) +VOID shift_row(IN PUCHAR in, OUT PUCHAR out) { - out[0] = in[0]; - out[1] = in[5]; - out[2] = in[10]; - out[3] = in[15]; - out[4] = in[4]; - out[5] = in[9]; - out[6] = in[14]; - out[7] = in[3]; - out[8] = in[8]; - out[9] = in[13]; + out[0] = in[0]; + out[1] = in[5]; + out[2] = in[10]; + out[3] = in[15]; + out[4] = in[4]; + out[5] = in[9]; + out[6] = in[14]; + out[7] = in[3]; + out[8] = in[8]; + out[9] = in[13]; out[10] = in[2]; out[11] = in[7]; out[12] = in[12]; @@ -193,34 +171,31 @@ VOID shift_row( out[15] = in[11]; } -VOID mix_column( - IN PUCHAR in, - OUT PUCHAR out) +VOID mix_column(IN PUCHAR in, OUT PUCHAR out) { - INT i; - UCHAR add1b[4]; - UCHAR add1bf7[4]; - UCHAR rotl[4]; - UCHAR swap_halfs[4]; - UCHAR andf7[4]; - UCHAR rotr[4]; - UCHAR temp[4]; - UCHAR tempb[4]; - - for (i=0 ; i<4; i++) - { - if ((in[i] & 0x80)== 0x80) + INT i; + UCHAR add1b[4]; + UCHAR add1bf7[4]; + UCHAR rotl[4]; + UCHAR swap_halfs[4]; + UCHAR andf7[4]; + UCHAR rotr[4]; + UCHAR temp[4]; + UCHAR tempb[4]; + + for (i = 0; i < 4; i++) { + if ((in[i] & 0x80) == 0x80) add1b[i] = 0x1b; else add1b[i] = 0x00; } - swap_halfs[0] = in[2]; /* Swap halfs */ + swap_halfs[0] = in[2]; /* Swap halfs */ swap_halfs[1] = in[3]; swap_halfs[2] = in[0]; swap_halfs[3] = in[1]; - rotl[0] = in[3]; /* Rotate left 8 bits */ + rotl[0] = in[3]; /* Rotate left 8 bits */ rotl[1] = in[0]; rotl[2] = in[1]; rotl[3] = in[2]; @@ -230,11 +205,9 @@ VOID mix_column( andf7[2] = in[2] & 0x7f; andf7[3] = in[3] & 0x7f; - for (i = 3; i>0; i--) /* logical shift left 1 bit */ - { + for (i = 3; i > 0; i--) { /* logical shift left 1 bit */ andf7[i] = andf7[i] << 1; - if ((andf7[i-1] & 0x80) == 0x80) - { + if ((andf7[i - 1] & 0x80) == 0x80) { andf7[i] = (andf7[i] | 0x01); } } @@ -245,40 +218,37 @@ VOID mix_column( xor_32(in, add1bf7, rotr); - temp[0] = rotr[0]; /* Rotate right 8 bits */ + temp[0] = rotr[0]; /* Rotate right 8 bits */ rotr[0] = rotr[1]; rotr[1] = rotr[2]; rotr[2] = rotr[3]; rotr[3] = temp[0]; xor_32(add1bf7, rotr, temp); - xor_32(swap_halfs, rotl,tempb); + xor_32(swap_halfs, rotl, tempb); xor_32(temp, tempb, out); } - /************************************************/ /* construct_mic_header1() */ /* Builds the first MIC header block from */ /* header fields. */ /************************************************/ -void construct_mic_header1( - unsigned char *mic_header1, - int header_length, - unsigned char *mpdu) +void construct_mic_header1(unsigned char *mic_header1, + int header_length, unsigned char *mpdu) { mic_header1[0] = (unsigned char)((header_length - 2) / 256); mic_header1[1] = (unsigned char)((header_length - 2) % 256); - mic_header1[2] = mpdu[0] & 0xcf; /* Mute CF poll & CF ack bits */ - mic_header1[3] = mpdu[1] & 0xc7; /* Mute retry, more data and pwr mgt bits */ - mic_header1[4] = mpdu[4]; /* A1 */ + mic_header1[2] = mpdu[0] & 0xcf; /* Mute CF poll & CF ack bits */ + mic_header1[3] = mpdu[1] & 0xc7; /* Mute retry, more data and pwr mgt bits */ + mic_header1[4] = mpdu[4]; /* A1 */ mic_header1[5] = mpdu[5]; mic_header1[6] = mpdu[6]; mic_header1[7] = mpdu[7]; mic_header1[8] = mpdu[8]; mic_header1[9] = mpdu[9]; - mic_header1[10] = mpdu[10]; /* A2 */ + mic_header1[10] = mpdu[10]; /* A2 */ mic_header1[11] = mpdu[11]; mic_header1[12] = mpdu[12]; mic_header1[13] = mpdu[13]; @@ -292,17 +262,15 @@ void construct_mic_header1( /* header fields. */ /************************************************/ -void construct_mic_header2( - unsigned char *mic_header2, - unsigned char *mpdu, - int a4_exists, - int qc_exists) +void construct_mic_header2(unsigned char *mic_header2, + unsigned char *mpdu, int a4_exists, int qc_exists) { int i; - for (i = 0; i<16; i++) mic_header2[i]=0x00; + for (i = 0; i < 16; i++) + mic_header2[i] = 0x00; - mic_header2[0] = mpdu[16]; /* A3 */ + mic_header2[0] = mpdu[16]; /* A3 */ mic_header2[1] = mpdu[17]; mic_header2[2] = mpdu[18]; mic_header2[3] = mpdu[19]; @@ -310,66 +278,62 @@ void construct_mic_header2( mic_header2[5] = mpdu[21]; // In Sequence Control field, mute sequence numer bits (12-bit) - mic_header2[6] = mpdu[22] & 0x0f; /* SC */ - mic_header2[7] = 0x00; /* mpdu[23]; */ + mic_header2[6] = mpdu[22] & 0x0f; /* SC */ + mic_header2[7] = 0x00; /* mpdu[23]; */ - if ((!qc_exists) & a4_exists) - { - for (i=0;i<6;i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ + if ((!qc_exists) & a4_exists) { + for (i = 0; i < 6; i++) + mic_header2[8 + i] = mpdu[24 + i]; /* A4 */ } - if (qc_exists && (!a4_exists)) - { - mic_header2[8] = mpdu[24] & 0x0f; /* mute bits 15 - 4 */ + if (qc_exists && (!a4_exists)) { + mic_header2[8] = mpdu[24] & 0x0f; /* mute bits 15 - 4 */ mic_header2[9] = mpdu[25] & 0x00; } - if (qc_exists && a4_exists) - { - for (i=0;i<6;i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ + if (qc_exists && a4_exists) { + for (i = 0; i < 6; i++) + mic_header2[8 + i] = mpdu[24 + i]; /* A4 */ mic_header2[14] = mpdu[30] & 0x0f; mic_header2[15] = mpdu[31] & 0x00; } } - /************************************************/ /* construct_mic_iv() */ /* Builds the MIC IV from header fields and PN */ /************************************************/ -void construct_mic_iv( - unsigned char *mic_iv, - int qc_exists, - int a4_exists, - unsigned char *mpdu, - unsigned int payload_length, - unsigned char *pn_vector) +void construct_mic_iv(unsigned char *mic_iv, + int qc_exists, + int a4_exists, + unsigned char *mpdu, + unsigned int payload_length, unsigned char *pn_vector) { int i; mic_iv[0] = 0x59; if (qc_exists && a4_exists) - mic_iv[1] = mpdu[30] & 0x0f; /* QoS_TC */ + mic_iv[1] = mpdu[30] & 0x0f; /* QoS_TC */ if (qc_exists && !a4_exists) - mic_iv[1] = mpdu[24] & 0x0f; /* mute bits 7-4 */ + mic_iv[1] = mpdu[24] & 0x0f; /* mute bits 7-4 */ if (!qc_exists) mic_iv[1] = 0x00; for (i = 2; i < 8; i++) - mic_iv[i] = mpdu[i + 8]; /* mic_iv[2:7] = A2[0:5] = mpdu[10:15] */ + mic_iv[i] = mpdu[i + 8]; /* mic_iv[2:7] = A2[0:5] = mpdu[10:15] */ #ifdef CONSISTENT_PN_ORDER - for (i = 8; i < 14; i++) - mic_iv[i] = pn_vector[i - 8]; /* mic_iv[8:13] = PN[0:5] */ + for (i = 8; i < 14; i++) + mic_iv[i] = pn_vector[i - 8]; /* mic_iv[8:13] = PN[0:5] */ #else - for (i = 8; i < 14; i++) - mic_iv[i] = pn_vector[13 - i]; /* mic_iv[8:13] = PN[5:0] */ + for (i = 8; i < 14; i++) + mic_iv[i] = pn_vector[13 - i]; /* mic_iv[8:13] = PN[5:0] */ #endif i = (payload_length / 256); i = (payload_length % 256); - mic_iv[14] = (unsigned char) (payload_length / 256); - mic_iv[15] = (unsigned char) (payload_length % 256); + mic_iv[14] = (unsigned char)(payload_length / 256); + mic_iv[15] = (unsigned char)(payload_length % 256); } @@ -378,7 +342,8 @@ void construct_mic_iv( /* Performs a 128 bit AES encrypt with */ /* 128 bit data. */ /****************************************/ -void aes128k128d(unsigned char *key, unsigned char *data, unsigned char *ciphertext) +void aes128k128d(unsigned char *key, unsigned char *data, + unsigned char *ciphertext) { int round; int i; @@ -386,23 +351,19 @@ void aes128k128d(unsigned char *key, unsigned char *data, unsigned char *ciphert unsigned char intermediateb[16]; unsigned char round_key[16]; - for(i=0; i<16; i++) round_key[i] = key[i]; + for (i = 0; i < 16; i++) + round_key[i] = key[i]; - for (round = 0; round < 11; round++) - { - if (round == 0) - { + for (round = 0; round < 11; round++) { + if (round == 0) { xor_128(round_key, data, ciphertext); next_key(round_key, round); - } - else if (round == 10) - { + } else if (round == 10) { byte_sub(ciphertext, intermediatea); shift_row(intermediatea, intermediateb); xor_128(intermediateb, round_key, ciphertext); - } - else /* 1 - 9 */ - { + } else { /* 1 - 9 */ + byte_sub(ciphertext, intermediatea); shift_row(intermediatea, intermediateb); mix_column(&intermediateb[0], &intermediatea[0]); @@ -416,75 +377,72 @@ void aes128k128d(unsigned char *key, unsigned char *data, unsigned char *ciphert } -void construct_ctr_preload( - unsigned char *ctr_preload, - int a4_exists, - int qc_exists, - unsigned char *mpdu, - unsigned char *pn_vector, - int c) +void construct_ctr_preload(unsigned char *ctr_preload, + int a4_exists, + int qc_exists, + unsigned char *mpdu, unsigned char *pn_vector, int c) { int i = 0; - for (i=0; i<16; i++) ctr_preload[i] = 0x00; + for (i = 0; i < 16; i++) + ctr_preload[i] = 0x00; i = 0; - ctr_preload[0] = 0x01; /* flag */ - if (qc_exists && a4_exists) ctr_preload[1] = mpdu[30] & 0x0f; /* QoC_Control */ - if (qc_exists && !a4_exists) ctr_preload[1] = mpdu[24] & 0x0f; + ctr_preload[0] = 0x01; /* flag */ + if (qc_exists && a4_exists) + ctr_preload[1] = mpdu[30] & 0x0f; /* QoC_Control */ + if (qc_exists && !a4_exists) + ctr_preload[1] = mpdu[24] & 0x0f; for (i = 2; i < 8; i++) - ctr_preload[i] = mpdu[i + 8]; /* ctr_preload[2:7] = A2[0:5] = mpdu[10:15] */ + ctr_preload[i] = mpdu[i + 8]; /* ctr_preload[2:7] = A2[0:5] = mpdu[10:15] */ #ifdef CONSISTENT_PN_ORDER - for (i = 8; i < 14; i++) - ctr_preload[i] = pn_vector[i - 8]; /* ctr_preload[8:13] = PN[0:5] */ + for (i = 8; i < 14; i++) + ctr_preload[i] = pn_vector[i - 8]; /* ctr_preload[8:13] = PN[0:5] */ #else - for (i = 8; i < 14; i++) - ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */ + for (i = 8; i < 14; i++) + ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */ #endif - ctr_preload[14] = (unsigned char) (c / 256); // Ctr - ctr_preload[15] = (unsigned char) (c % 256); + ctr_preload[14] = (unsigned char)(c / 256); // Ctr + ctr_preload[15] = (unsigned char)(c % 256); } -BOOLEAN RTMPSoftDecryptAES( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, - IN PCIPHER_KEY pWpaKey) +BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, + IN PUCHAR pData, + IN ULONG DataByteCnt, IN PCIPHER_KEY pWpaKey) { - UCHAR KeyID; - UINT HeaderLen; - UCHAR PN[6]; - UINT payload_len; - UINT num_blocks; - UINT payload_remainder; - USHORT fc; - UCHAR fc0; - UCHAR fc1; - UINT frame_type; - UINT frame_subtype; - UINT from_ds; - UINT to_ds; - INT a4_exists; - INT qc_exists; - UCHAR aes_out[16]; - int payload_index; - UINT i; - UCHAR ctr_preload[16]; - UCHAR chain_buffer[16]; - UCHAR padded_buffer[16]; - UCHAR mic_iv[16]; - UCHAR mic_header1[16]; - UCHAR mic_header2[16]; - UCHAR MIC[8]; - UCHAR TrailMIC[8]; - + UCHAR KeyID; + UINT HeaderLen; + UCHAR PN[6]; + UINT payload_len; + UINT num_blocks; + UINT payload_remainder; + USHORT fc; + UCHAR fc0; + UCHAR fc1; + UINT frame_type; + UINT frame_subtype; + UINT from_ds; + UINT to_ds; + INT a4_exists; + INT qc_exists; + UCHAR aes_out[16]; + int payload_index; + UINT i; + UCHAR ctr_preload[16]; + UCHAR chain_buffer[16]; + UCHAR padded_buffer[16]; + UCHAR mic_iv[16]; + UCHAR mic_header1[16]; + UCHAR mic_header2[16]; + UCHAR MIC[8]; + UCHAR TrailMIC[8]; fc0 = *pData; fc1 = *(pData + 1); - fc = *((PUSHORT)pData); + fc = *((PUSHORT) pData); frame_type = ((fc0 >> 2) & 0x03); frame_subtype = ((fc0 >> 4) & 0x0f); @@ -493,49 +451,42 @@ BOOLEAN RTMPSoftDecryptAES( to_ds = (fc1 & 0x1); a4_exists = (from_ds & to_ds); - qc_exists = ((frame_subtype == 0x08) || /* Assumed QoS subtypes */ - (frame_subtype == 0x09) || /* Likely to change. */ - (frame_subtype == 0x0a) || - (frame_subtype == 0x0b) - ); + qc_exists = ((frame_subtype == 0x08) || /* Assumed QoS subtypes */ + (frame_subtype == 0x09) || /* Likely to change. */ + (frame_subtype == 0x0a) || (frame_subtype == 0x0b) + ); HeaderLen = 24; if (a4_exists) HeaderLen += 6; - KeyID = *((PUCHAR)(pData+ HeaderLen + 3)); + KeyID = *((PUCHAR) (pData + HeaderLen + 3)); KeyID = KeyID >> 6; - if (pWpaKey[KeyID].KeyLen == 0) - { - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSoftDecryptAES failed!(KeyID[%d] Length can not be 0)\n", KeyID)); + if (pWpaKey[KeyID].KeyLen == 0) { + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPSoftDecryptAES failed!(KeyID[%d] Length can not be 0)\n", + KeyID)); return FALSE; } - PN[0] = *(pData+ HeaderLen); - PN[1] = *(pData+ HeaderLen + 1); - PN[2] = *(pData+ HeaderLen + 4); - PN[3] = *(pData+ HeaderLen + 5); - PN[4] = *(pData+ HeaderLen + 6); - PN[5] = *(pData+ HeaderLen + 7); + PN[0] = *(pData + HeaderLen); + PN[1] = *(pData + HeaderLen + 1); + PN[2] = *(pData + HeaderLen + 4); + PN[3] = *(pData + HeaderLen + 5); + PN[4] = *(pData + HeaderLen + 6); + PN[5] = *(pData + HeaderLen + 7); payload_len = DataByteCnt - HeaderLen - 8 - 8; // 8 bytes for CCMP header , 8 bytes for MIC payload_remainder = (payload_len) % 16; num_blocks = (payload_len) / 16; - - // Find start of payload - payload_index = HeaderLen + 8; //IV+EIV + payload_index = HeaderLen + 8; //IV+EIV - for (i=0; i< num_blocks; i++) - { + for (i = 0; i < num_blocks; i++) { construct_ctr_preload(ctr_preload, - a4_exists, - qc_exists, - pData, - PN, - i+1 ); + a4_exists, qc_exists, pData, PN, i + 1); aes128k128d(pWpaKey[KeyID].Key, ctr_preload, aes_out); @@ -548,34 +499,26 @@ BOOLEAN RTMPSoftDecryptAES( // If there is a short final block, then pad it // encrypt it and copy the unpadded part back // - if (payload_remainder > 0) - { + if (payload_remainder > 0) { construct_ctr_preload(ctr_preload, - a4_exists, - qc_exists, - pData, - PN, - num_blocks + 1); + a4_exists, + qc_exists, pData, PN, num_blocks + 1); NdisZeroMemory(padded_buffer, 16); - NdisMoveMemory(padded_buffer, pData + payload_index, payload_remainder); + NdisMoveMemory(padded_buffer, pData + payload_index, + payload_remainder); aes128k128d(pWpaKey[KeyID].Key, ctr_preload, aes_out); bitwise_xor(aes_out, padded_buffer, chain_buffer); - NdisMoveMemory(pData + payload_index - 8, chain_buffer, payload_remainder); + NdisMoveMemory(pData + payload_index - 8, chain_buffer, + payload_remainder); payload_index += payload_remainder; } - // // Descrypt the MIC // - construct_ctr_preload(ctr_preload, - a4_exists, - qc_exists, - pData, - PN, - 0); + construct_ctr_preload(ctr_preload, a4_exists, qc_exists, pData, PN, 0); NdisZeroMemory(padded_buffer, 16); NdisMoveMemory(padded_buffer, pData + payload_index, 8); @@ -585,7 +528,6 @@ BOOLEAN RTMPSoftDecryptAES( NdisMoveMemory(TrailMIC, chain_buffer, 8); - // // Calculate MIC // @@ -597,24 +539,11 @@ BOOLEAN RTMPSoftDecryptAES( // Because the CCMP header has been removed payload_index = HeaderLen; - construct_mic_iv( - mic_iv, - qc_exists, - a4_exists, - pData, - payload_len, - PN); - - construct_mic_header1( - mic_header1, - HeaderLen, - pData); - - construct_mic_header2( - mic_header2, - pData, - a4_exists, - qc_exists); + construct_mic_iv(mic_iv, qc_exists, a4_exists, pData, payload_len, PN); + + construct_mic_header1(mic_header1, HeaderLen, pData); + + construct_mic_header2(mic_header2, pData, a4_exists, qc_exists); aes128k128d(pWpaKey[KeyID].Key, mic_iv, aes_out); bitwise_xor(aes_out, mic_header1, chain_buffer); @@ -623,34 +552,31 @@ BOOLEAN RTMPSoftDecryptAES( aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); // iterate through each 16 byte payload block - for (i = 0; i < num_blocks; i++) - { + for (i = 0; i < num_blocks; i++) { bitwise_xor(aes_out, pData + payload_index, chain_buffer); payload_index += 16; aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); } // Add on the final payload block if it needs padding - if (payload_remainder > 0) - { + if (payload_remainder > 0) { NdisZeroMemory(padded_buffer, 16); - NdisMoveMemory(padded_buffer, pData + payload_index, payload_remainder); + NdisMoveMemory(padded_buffer, pData + payload_index, + payload_remainder); bitwise_xor(aes_out, padded_buffer, chain_buffer); aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); } - // aes_out contains padded mic, discard most significant // 8 bytes to generate 64 bit MIC - for (i = 0 ; i < 8; i++) MIC[i] = aes_out[i]; + for (i = 0; i < 8; i++) + MIC[i] = aes_out[i]; - if (!NdisEqualMemory(MIC, TrailMIC, 8)) - { - DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptAES, MIC Error !\n")); //MIC error. + if (!NdisEqualMemory(MIC, TrailMIC, 8)) { + DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptAES, MIC Error !\n")); //MIC error. return FALSE; } - return TRUE; } @@ -664,40 +590,39 @@ BOOLEAN RTMPSoftDecryptAES( #endif /* forward S-box */ -static uint32 FSb[256] = -{ - 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, - 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76, - 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, - 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0, - 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, - 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15, - 0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, - 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75, - 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, - 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84, - 0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, - 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF, - 0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, - 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8, - 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, - 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2, - 0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, - 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73, - 0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, - 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB, - 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, - 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79, - 0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, - 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08, - 0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, - 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A, - 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, - 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E, - 0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, - 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF, - 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, - 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16 +static uint32 FSb[256] = { + 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, + 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76, + 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, + 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0, + 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, + 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15, + 0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, + 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75, + 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, + 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84, + 0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, + 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF, + 0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, + 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8, + 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, + 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2, + 0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, + 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73, + 0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, + 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB, + 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, + 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79, + 0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, + 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08, + 0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, + 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A, + 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, + 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E, + 0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, + 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF, + 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, + 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16 }; /* forward table */ @@ -770,58 +695,61 @@ static uint32 FSb[256] = #define V(a,b,c,d) 0x##a##b##c##d static uint32 FT0[256] = { FT }; + #undef V #define V(a,b,c,d) 0x##d##a##b##c static uint32 FT1[256] = { FT }; + #undef V #define V(a,b,c,d) 0x##c##d##a##b static uint32 FT2[256] = { FT }; + #undef V #define V(a,b,c,d) 0x##b##c##d##a static uint32 FT3[256] = { FT }; + #undef V #undef FT /* reverse S-box */ -static uint32 RSb[256] = -{ - 0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, - 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB, - 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, - 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB, - 0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, - 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E, - 0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, - 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25, - 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, - 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92, - 0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, - 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84, - 0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, - 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06, - 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, - 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B, - 0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, - 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73, - 0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, - 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E, - 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, - 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B, - 0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, - 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4, - 0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, - 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F, - 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, - 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF, - 0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, - 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61, - 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, - 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D +static uint32 RSb[256] = { + 0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, + 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB, + 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, + 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB, + 0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, + 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E, + 0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, + 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25, + 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, + 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92, + 0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, + 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84, + 0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, + 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06, + 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, + 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B, + 0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, + 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73, + 0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, + 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E, + 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, + 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B, + 0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, + 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4, + 0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, + 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F, + 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, + 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF, + 0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, + 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61, + 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, + 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D }; /* reverse table */ @@ -895,29 +823,32 @@ static uint32 RSb[256] = #define V(a,b,c,d) 0x##a##b##c##d static uint32 RT0[256] = { RT }; + #undef V #define V(a,b,c,d) 0x##d##a##b##c static uint32 RT1[256] = { RT }; + #undef V #define V(a,b,c,d) 0x##c##d##a##b static uint32 RT2[256] = { RT }; + #undef V #define V(a,b,c,d) 0x##b##c##d##a static uint32 RT3[256] = { RT }; + #undef V #undef RT /* round constants */ -static uint32 RCON[10] = -{ - 0x01000000, 0x02000000, 0x04000000, 0x08000000, - 0x10000000, 0x20000000, 0x40000000, 0x80000000, - 0x1B000000, 0x36000000 +static uint32 RCON[10] = { + 0x01000000, 0x02000000, 0x04000000, 0x08000000, + 0x10000000, 0x20000000, 0x40000000, 0x80000000, + 0x1B000000, 0x36000000 }; /* key schedule tables */ @@ -947,60 +878,61 @@ static uint32 KT3[256]; (b)[(i) + 3] = (uint8) ( (n) ); \ } - -int rt_aes_set_key( aes_context *ctx, uint8 *key, int nbits ) +int rt_aes_set_key(aes_context * ctx, uint8 * key, int nbits) { - int i; - uint32 *RK, *SK; - - switch( nbits ) - { - case 128: ctx->nr = 10; break; - case 192: ctx->nr = 12; break; - case 256: ctx->nr = 14; break; - default : return( 1 ); + int i; + uint32 *RK, *SK; + + switch (nbits) { + case 128: + ctx->nr = 10; + break; + case 192: + ctx->nr = 12; + break; + case 256: + ctx->nr = 14; + break; + default: + return (1); } RK = (uint32 *) ctx->erk; - for( i = 0; i < (nbits >> 5); i++ ) - { - GET_UINT32( RK[i], key, i * 4 ); + for (i = 0; i < (nbits >> 5); i++) { + GET_UINT32(RK[i], key, i * 4); } - /* setup encryption round keys */ + /* setup encryption round keys */ - switch( nbits ) - { + switch (nbits) { case 128: - for( i = 0; i < 10; i++, RK += 4 ) - { - RK[4] = RK[0] ^ RCON[i] ^ - ( FSb[ (uint8) ( RK[3] >> 16 ) ] << 24 ) ^ - ( FSb[ (uint8) ( RK[3] >> 8 ) ] << 16 ) ^ - ( FSb[ (uint8) ( RK[3] ) ] << 8 ) ^ - ( FSb[ (uint8) ( RK[3] >> 24 ) ] ); - - RK[5] = RK[1] ^ RK[4]; - RK[6] = RK[2] ^ RK[5]; - RK[7] = RK[3] ^ RK[6]; + for (i = 0; i < 10; i++, RK += 4) { + RK[4] = RK[0] ^ RCON[i] ^ + (FSb[(uint8) (RK[3] >> 16)] << 24) ^ + (FSb[(uint8) (RK[3] >> 8)] << 16) ^ + (FSb[(uint8) (RK[3])] << 8) ^ + (FSb[(uint8) (RK[3] >> 24)]); + + RK[5] = RK[1] ^ RK[4]; + RK[6] = RK[2] ^ RK[5]; + RK[7] = RK[3] ^ RK[6]; } break; case 192: - for( i = 0; i < 8; i++, RK += 6 ) - { - RK[6] = RK[0] ^ RCON[i] ^ - ( FSb[ (uint8) ( RK[5] >> 16 ) ] << 24 ) ^ - ( FSb[ (uint8) ( RK[5] >> 8 ) ] << 16 ) ^ - ( FSb[ (uint8) ( RK[5] ) ] << 8 ) ^ - ( FSb[ (uint8) ( RK[5] >> 24 ) ] ); - - RK[7] = RK[1] ^ RK[6]; - RK[8] = RK[2] ^ RK[7]; - RK[9] = RK[3] ^ RK[8]; + for (i = 0; i < 8; i++, RK += 6) { + RK[6] = RK[0] ^ RCON[i] ^ + (FSb[(uint8) (RK[5] >> 16)] << 24) ^ + (FSb[(uint8) (RK[5] >> 8)] << 16) ^ + (FSb[(uint8) (RK[5])] << 8) ^ + (FSb[(uint8) (RK[5] >> 24)]); + + RK[7] = RK[1] ^ RK[6]; + RK[8] = RK[2] ^ RK[7]; + RK[9] = RK[3] ^ RK[8]; RK[10] = RK[4] ^ RK[9]; RK[11] = RK[5] ^ RK[10]; } @@ -1008,23 +940,22 @@ int rt_aes_set_key( aes_context *ctx, uint8 *key, int nbits ) case 256: - for( i = 0; i < 7; i++, RK += 8 ) - { - RK[8] = RK[0] ^ RCON[i] ^ - ( FSb[ (uint8) ( RK[7] >> 16 ) ] << 24 ) ^ - ( FSb[ (uint8) ( RK[7] >> 8 ) ] << 16 ) ^ - ( FSb[ (uint8) ( RK[7] ) ] << 8 ) ^ - ( FSb[ (uint8) ( RK[7] >> 24 ) ] ); + for (i = 0; i < 7; i++, RK += 8) { + RK[8] = RK[0] ^ RCON[i] ^ + (FSb[(uint8) (RK[7] >> 16)] << 24) ^ + (FSb[(uint8) (RK[7] >> 8)] << 16) ^ + (FSb[(uint8) (RK[7])] << 8) ^ + (FSb[(uint8) (RK[7] >> 24)]); - RK[9] = RK[1] ^ RK[8]; + RK[9] = RK[1] ^ RK[8]; RK[10] = RK[2] ^ RK[9]; RK[11] = RK[3] ^ RK[10]; RK[12] = RK[4] ^ - ( FSb[ (uint8) ( RK[11] >> 24 ) ] << 24 ) ^ - ( FSb[ (uint8) ( RK[11] >> 16 ) ] << 16 ) ^ - ( FSb[ (uint8) ( RK[11] >> 8 ) ] << 8 ) ^ - ( FSb[ (uint8) ( RK[11] ) ] ); + (FSb[(uint8) (RK[11] >> 24)] << 24) ^ + (FSb[(uint8) (RK[11] >> 16)] << 16) ^ + (FSb[(uint8) (RK[11] >> 8)] << 8) ^ + (FSb[(uint8) (RK[11])]); RK[13] = RK[5] ^ RK[12]; RK[14] = RK[6] ^ RK[13]; @@ -1033,74 +964,75 @@ int rt_aes_set_key( aes_context *ctx, uint8 *key, int nbits ) break; } - /* setup decryption round keys */ + /* setup decryption round keys */ - if( KT_init ) - { - for( i = 0; i < 256; i++ ) - { - KT0[i] = RT0[ FSb[i] ]; - KT1[i] = RT1[ FSb[i] ]; - KT2[i] = RT2[ FSb[i] ]; - KT3[i] = RT3[ FSb[i] ]; + if (KT_init) { + for (i = 0; i < 256; i++) { + KT0[i] = RT0[FSb[i]]; + KT1[i] = RT1[FSb[i]]; + KT2[i] = RT2[FSb[i]]; + KT3[i] = RT3[FSb[i]]; } - KT_init = 0; + KT_init = 0; } SK = (uint32 *) ctx->drk; - *SK++ = *RK++; - *SK++ = *RK++; - *SK++ = *RK++; - *SK++ = *RK++; + *SK++ = *RK++; + *SK++ = *RK++; + *SK++ = *RK++; + *SK++ = *RK++; - for( i = 1; i < ctx->nr; i++ ) - { + for (i = 1; i < ctx->nr; i++) { RK -= 8; - *SK++ = KT0[ (uint8) ( *RK >> 24 ) ] ^ - KT1[ (uint8) ( *RK >> 16 ) ] ^ - KT2[ (uint8) ( *RK >> 8 ) ] ^ - KT3[ (uint8) ( *RK ) ]; RK++; - - *SK++ = KT0[ (uint8) ( *RK >> 24 ) ] ^ - KT1[ (uint8) ( *RK >> 16 ) ] ^ - KT2[ (uint8) ( *RK >> 8 ) ] ^ - KT3[ (uint8) ( *RK ) ]; RK++; - - *SK++ = KT0[ (uint8) ( *RK >> 24 ) ] ^ - KT1[ (uint8) ( *RK >> 16 ) ] ^ - KT2[ (uint8) ( *RK >> 8 ) ] ^ - KT3[ (uint8) ( *RK ) ]; RK++; - - *SK++ = KT0[ (uint8) ( *RK >> 24 ) ] ^ - KT1[ (uint8) ( *RK >> 16 ) ] ^ - KT2[ (uint8) ( *RK >> 8 ) ] ^ - KT3[ (uint8) ( *RK ) ]; RK++; + *SK++ = KT0[(uint8) (*RK >> 24)] ^ + KT1[(uint8) (*RK >> 16)] ^ + KT2[(uint8) (*RK >> 8)] ^ KT3[(uint8) (*RK)]; + RK++; + + *SK++ = KT0[(uint8) (*RK >> 24)] ^ + KT1[(uint8) (*RK >> 16)] ^ + KT2[(uint8) (*RK >> 8)] ^ KT3[(uint8) (*RK)]; + RK++; + + *SK++ = KT0[(uint8) (*RK >> 24)] ^ + KT1[(uint8) (*RK >> 16)] ^ + KT2[(uint8) (*RK >> 8)] ^ KT3[(uint8) (*RK)]; + RK++; + + *SK++ = KT0[(uint8) (*RK >> 24)] ^ + KT1[(uint8) (*RK >> 16)] ^ + KT2[(uint8) (*RK >> 8)] ^ KT3[(uint8) (*RK)]; + RK++; } RK -= 8; - *SK++ = *RK++; - *SK++ = *RK++; - *SK++ = *RK++; - *SK++ = *RK++; + *SK++ = *RK++; + *SK++ = *RK++; + *SK++ = *RK++; + *SK++ = *RK++; - return( 0 ); + return (0); } /* AES 128-bit block encryption routine */ -void rt_aes_encrypt(aes_context *ctx, uint8 input[16], uint8 output[16] ) +void rt_aes_encrypt(aes_context * ctx, uint8 input[16], uint8 output[16]) { - uint32 *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3; + uint32 *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3; RK = (uint32 *) ctx->erk; - GET_UINT32( X0, input, 0 ); X0 ^= RK[0]; - GET_UINT32( X1, input, 4 ); X1 ^= RK[1]; - GET_UINT32( X2, input, 8 ); X2 ^= RK[2]; - GET_UINT32( X3, input, 12 ); X3 ^= RK[3]; + GET_UINT32(X0, input, 0); + X0 ^= RK[0]; + GET_UINT32(X1, input, 4); + X1 ^= RK[1]; + GET_UINT32(X2, input, 8); + X2 ^= RK[2]; + GET_UINT32(X3, input, 12); + X3 ^= RK[3]; #define AES_FROUND(X0,X1,X2,X3,Y0,Y1,Y2,Y3) \ { \ @@ -1127,70 +1059,68 @@ void rt_aes_encrypt(aes_context *ctx, uint8 input[16], uint8 output[16] ) FT3[ (uint8) ( Y2 ) ]; \ } - AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 1 */ - AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 2 */ - AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 3 */ - AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 4 */ - AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 5 */ - AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 6 */ - AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 7 */ - AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 8 */ - AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 9 */ - - if( ctx->nr > 10 ) - { - AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 10 */ - AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 11 */ + AES_FROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 1 */ + AES_FROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 2 */ + AES_FROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 3 */ + AES_FROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 4 */ + AES_FROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 5 */ + AES_FROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 6 */ + AES_FROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 7 */ + AES_FROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 8 */ + AES_FROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 9 */ + + if (ctx->nr > 10) { + AES_FROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 10 */ + AES_FROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 11 */ } - if( ctx->nr > 12 ) - { - AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 12 */ - AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 13 */ + if (ctx->nr > 12) { + AES_FROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 12 */ + AES_FROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 13 */ } - /* last round */ + /* last round */ RK += 4; - X0 = RK[0] ^ ( FSb[ (uint8) ( Y0 >> 24 ) ] << 24 ) ^ - ( FSb[ (uint8) ( Y1 >> 16 ) ] << 16 ) ^ - ( FSb[ (uint8) ( Y2 >> 8 ) ] << 8 ) ^ - ( FSb[ (uint8) ( Y3 ) ] ); - - X1 = RK[1] ^ ( FSb[ (uint8) ( Y1 >> 24 ) ] << 24 ) ^ - ( FSb[ (uint8) ( Y2 >> 16 ) ] << 16 ) ^ - ( FSb[ (uint8) ( Y3 >> 8 ) ] << 8 ) ^ - ( FSb[ (uint8) ( Y0 ) ] ); - - X2 = RK[2] ^ ( FSb[ (uint8) ( Y2 >> 24 ) ] << 24 ) ^ - ( FSb[ (uint8) ( Y3 >> 16 ) ] << 16 ) ^ - ( FSb[ (uint8) ( Y0 >> 8 ) ] << 8 ) ^ - ( FSb[ (uint8) ( Y1 ) ] ); - - X3 = RK[3] ^ ( FSb[ (uint8) ( Y3 >> 24 ) ] << 24 ) ^ - ( FSb[ (uint8) ( Y0 >> 16 ) ] << 16 ) ^ - ( FSb[ (uint8) ( Y1 >> 8 ) ] << 8 ) ^ - ( FSb[ (uint8) ( Y2 ) ] ); - - PUT_UINT32( X0, output, 0 ); - PUT_UINT32( X1, output, 4 ); - PUT_UINT32( X2, output, 8 ); - PUT_UINT32( X3, output, 12 ); + X0 = RK[0] ^ (FSb[(uint8) (Y0 >> 24)] << 24) ^ + (FSb[(uint8) (Y1 >> 16)] << 16) ^ + (FSb[(uint8) (Y2 >> 8)] << 8) ^ (FSb[(uint8) (Y3)]); + + X1 = RK[1] ^ (FSb[(uint8) (Y1 >> 24)] << 24) ^ + (FSb[(uint8) (Y2 >> 16)] << 16) ^ + (FSb[(uint8) (Y3 >> 8)] << 8) ^ (FSb[(uint8) (Y0)]); + + X2 = RK[2] ^ (FSb[(uint8) (Y2 >> 24)] << 24) ^ + (FSb[(uint8) (Y3 >> 16)] << 16) ^ + (FSb[(uint8) (Y0 >> 8)] << 8) ^ (FSb[(uint8) (Y1)]); + + X3 = RK[3] ^ (FSb[(uint8) (Y3 >> 24)] << 24) ^ + (FSb[(uint8) (Y0 >> 16)] << 16) ^ + (FSb[(uint8) (Y1 >> 8)] << 8) ^ (FSb[(uint8) (Y2)]); + + PUT_UINT32(X0, output, 0); + PUT_UINT32(X1, output, 4); + PUT_UINT32(X2, output, 8); + PUT_UINT32(X3, output, 12); } /* AES 128-bit block decryption routine */ -void rt_aes_decrypt( aes_context *ctx, uint8 input[16], uint8 output[16] ) +void rt_aes_decrypt(aes_context * ctx, uint8 input[16], uint8 output[16]) { - uint32 *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3; + uint32 *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3; RK = (uint32 *) ctx->drk; - GET_UINT32( X0, input, 0 ); X0 ^= RK[0]; - GET_UINT32( X1, input, 4 ); X1 ^= RK[1]; - GET_UINT32( X2, input, 8 ); X2 ^= RK[2]; - GET_UINT32( X3, input, 12 ); X3 ^= RK[3]; + GET_UINT32(X0, input, 0); + X0 ^= RK[0]; + GET_UINT32(X1, input, 4); + X1 ^= RK[1]; + GET_UINT32(X2, input, 8); + X2 ^= RK[2]; + GET_UINT32(X3, input, 12); + X3 ^= RK[3]; #define AES_RROUND(X0,X1,X2,X3,Y0,Y1,Y2,Y3) \ { \ @@ -1217,56 +1147,50 @@ void rt_aes_decrypt( aes_context *ctx, uint8 input[16], uint8 output[16] ) RT3[ (uint8) ( Y0 ) ]; \ } - AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 1 */ - AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 2 */ - AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 3 */ - AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 4 */ - AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 5 */ - AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 6 */ - AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 7 */ - AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 8 */ - AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 9 */ - - if( ctx->nr > 10 ) - { - AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 10 */ - AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 11 */ + AES_RROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 1 */ + AES_RROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 2 */ + AES_RROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 3 */ + AES_RROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 4 */ + AES_RROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 5 */ + AES_RROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 6 */ + AES_RROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 7 */ + AES_RROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 8 */ + AES_RROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 9 */ + + if (ctx->nr > 10) { + AES_RROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 10 */ + AES_RROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 11 */ } - if( ctx->nr > 12 ) - { - AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); /* round 12 */ - AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); /* round 13 */ + if (ctx->nr > 12) { + AES_RROUND(X0, X1, X2, X3, Y0, Y1, Y2, Y3); /* round 12 */ + AES_RROUND(Y0, Y1, Y2, Y3, X0, X1, X2, X3); /* round 13 */ } - /* last round */ + /* last round */ RK += 4; - X0 = RK[0] ^ ( RSb[ (uint8) ( Y0 >> 24 ) ] << 24 ) ^ - ( RSb[ (uint8) ( Y3 >> 16 ) ] << 16 ) ^ - ( RSb[ (uint8) ( Y2 >> 8 ) ] << 8 ) ^ - ( RSb[ (uint8) ( Y1 ) ] ); - - X1 = RK[1] ^ ( RSb[ (uint8) ( Y1 >> 24 ) ] << 24 ) ^ - ( RSb[ (uint8) ( Y0 >> 16 ) ] << 16 ) ^ - ( RSb[ (uint8) ( Y3 >> 8 ) ] << 8 ) ^ - ( RSb[ (uint8) ( Y2 ) ] ); - - X2 = RK[2] ^ ( RSb[ (uint8) ( Y2 >> 24 ) ] << 24 ) ^ - ( RSb[ (uint8) ( Y1 >> 16 ) ] << 16 ) ^ - ( RSb[ (uint8) ( Y0 >> 8 ) ] << 8 ) ^ - ( RSb[ (uint8) ( Y3 ) ] ); - - X3 = RK[3] ^ ( RSb[ (uint8) ( Y3 >> 24 ) ] << 24 ) ^ - ( RSb[ (uint8) ( Y2 >> 16 ) ] << 16 ) ^ - ( RSb[ (uint8) ( Y1 >> 8 ) ] << 8 ) ^ - ( RSb[ (uint8) ( Y0 ) ] ); - - PUT_UINT32( X0, output, 0 ); - PUT_UINT32( X1, output, 4 ); - PUT_UINT32( X2, output, 8 ); - PUT_UINT32( X3, output, 12 ); + X0 = RK[0] ^ (RSb[(uint8) (Y0 >> 24)] << 24) ^ + (RSb[(uint8) (Y3 >> 16)] << 16) ^ + (RSb[(uint8) (Y2 >> 8)] << 8) ^ (RSb[(uint8) (Y1)]); + + X1 = RK[1] ^ (RSb[(uint8) (Y1 >> 24)] << 24) ^ + (RSb[(uint8) (Y0 >> 16)] << 16) ^ + (RSb[(uint8) (Y3 >> 8)] << 8) ^ (RSb[(uint8) (Y2)]); + + X2 = RK[2] ^ (RSb[(uint8) (Y2 >> 24)] << 24) ^ + (RSb[(uint8) (Y1 >> 16)] << 16) ^ + (RSb[(uint8) (Y0 >> 8)] << 8) ^ (RSb[(uint8) (Y3)]); + + X3 = RK[3] ^ (RSb[(uint8) (Y3 >> 24)] << 24) ^ + (RSb[(uint8) (Y2 >> 16)] << 16) ^ + (RSb[(uint8) (Y1 >> 8)] << 8) ^ (RSb[(uint8) (Y0)]); + + PUT_UINT32(X0, output, 0); + PUT_UINT32(X1, output, 4); + PUT_UINT32(X2, output, 8); + PUT_UINT32(X3, output, 12); } /* @@ -1278,57 +1202,51 @@ void rt_aes_decrypt( aes_context *ctx, uint8 input[16], uint8 output[16] ) Return: ========================================================================== */ -VOID AES_GTK_KEY_WRAP( - IN UCHAR *key, - IN UCHAR *plaintext, - IN UINT32 p_len, - OUT UCHAR *ciphertext) +VOID AES_GTK_KEY_WRAP(IN UCHAR * key, + IN UCHAR * plaintext, + IN UINT32 p_len, OUT UCHAR * ciphertext) { - UCHAR A[8], BIN[16], BOUT[16]; - UCHAR R[512]; - INT num_blocks = p_len/8; // unit:64bits - INT i, j; - aes_context aesctx; - UCHAR xor; - - rt_aes_set_key(&aesctx, key, 128); - - // Init IA - for (i = 0; i < 8; i++) - A[i] = 0xa6; - - //Input plaintext - for (i = 0; i < num_blocks; i++) - { - for (j = 0 ; j < 8; j++) - R[8 * (i + 1) + j] = plaintext[8 * i + j]; - } - - // Key Mix - for (j = 0; j < 6; j++) - { - for(i = 1; i <= num_blocks; i++) - { - //phase 1 - NdisMoveMemory(BIN, A, 8); - NdisMoveMemory(&BIN[8], &R[8 * i], 8); - rt_aes_encrypt(&aesctx, BIN, BOUT); - - NdisMoveMemory(A, &BOUT[0], 8); - xor = num_blocks * j + i; - A[7] = BOUT[7] ^ xor; - NdisMoveMemory(&R[8 * i], &BOUT[8], 8); - } - } - - // Output ciphertext - NdisMoveMemory(ciphertext, A, 8); - - for (i = 1; i <= num_blocks; i++) - { - for (j = 0 ; j < 8; j++) - ciphertext[8 * i + j] = R[8 * i + j]; - } + UCHAR A[8], BIN[16], BOUT[16]; + UCHAR R[512]; + INT num_blocks = p_len / 8; // unit:64bits + INT i, j; + aes_context aesctx; + UCHAR xor; + + rt_aes_set_key(&aesctx, key, 128); + + // Init IA + for (i = 0; i < 8; i++) + A[i] = 0xa6; + + //Input plaintext + for (i = 0; i < num_blocks; i++) { + for (j = 0; j < 8; j++) + R[8 * (i + 1) + j] = plaintext[8 * i + j]; + } + + // Key Mix + for (j = 0; j < 6; j++) { + for (i = 1; i <= num_blocks; i++) { + //phase 1 + NdisMoveMemory(BIN, A, 8); + NdisMoveMemory(&BIN[8], &R[8 * i], 8); + rt_aes_encrypt(&aesctx, BIN, BOUT); + + NdisMoveMemory(A, &BOUT[0], 8); + xor = num_blocks * j + i; + A[7] = BOUT[7] ^ xor; + NdisMoveMemory(&R[8 * i], &BOUT[8], 8); + } + } + + // Output ciphertext + NdisMoveMemory(ciphertext, A, 8); + + for (i = 1; i <= num_blocks; i++) { + for (j = 0; j < 8; j++) + ciphertext[8 * i + j] = R[8 * i + j]; + } } /* @@ -1346,59 +1264,50 @@ VOID AES_GTK_KEY_WRAP( ======================================================================== */ -VOID AES_GTK_KEY_UNWRAP( - IN UCHAR *key, - OUT UCHAR *plaintext, - IN UINT32 c_len, - IN UCHAR *ciphertext) - +VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key, + OUT UCHAR * plaintext, + IN UINT32 c_len, IN UCHAR * ciphertext) { - UCHAR A[8], BIN[16], BOUT[16]; - UCHAR xor; - INT i, j; + UCHAR A[8], BIN[16], BOUT[16]; + UCHAR xor; + INT i, j; aes_context aesctx; - UCHAR *R; - INT num_blocks = c_len/8; // unit:64bits + UCHAR *R; + INT num_blocks = c_len / 8; // unit:64bits + os_alloc_mem(NULL, (PUCHAR *) & R, 512); - os_alloc_mem(NULL, (PUCHAR *)&R, 512); - - if (R == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("!!!AES_GTK_KEY_UNWRAP: no memory!!!\n")); - return; - } /* End of if */ - + if (R == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("!!!AES_GTK_KEY_UNWRAP: no memory!!!\n")); + return; + } + /* End of if */ // Initialize NdisMoveMemory(A, ciphertext, 8); //Input plaintext - for(i = 0; i < (c_len-8); i++) - { - R[ i] = ciphertext[i + 8]; + for (i = 0; i < (c_len - 8); i++) { + R[i] = ciphertext[i + 8]; } rt_aes_set_key(&aesctx, key, 128); - for(j = 5; j >= 0; j--) - { - for(i = (num_blocks-1); i > 0; i--) - { - xor = (num_blocks -1 )* j + i; + for (j = 5; j >= 0; j--) { + for (i = (num_blocks - 1); i > 0; i--) { + xor = (num_blocks - 1) * j + i; NdisMoveMemory(BIN, A, 8); BIN[7] = A[7] ^ xor; - NdisMoveMemory(&BIN[8], &R[(i-1)*8], 8); + NdisMoveMemory(&BIN[8], &R[(i - 1) * 8], 8); rt_aes_decrypt(&aesctx, BIN, BOUT); NdisMoveMemory(A, &BOUT[0], 8); - NdisMoveMemory(&R[(i-1)*8], &BOUT[8], 8); + NdisMoveMemory(&R[(i - 1) * 8], &BOUT[8], 8); } } // OUTPUT - for(i = 0; i < c_len; i++) - { + for (i = 0; i < c_len; i++) { plaintext[i] = R[i]; } - os_free_mem(NULL, R); } diff --git a/drivers/staging/rt2860/common/cmm_asic.c b/drivers/staging/rt2860/common/cmm_asic.c index 406e0bbf9530..7205b36281e4 100644 --- a/drivers/staging/rt2860/common/cmm_asic.c +++ b/drivers/staging/rt2860/common/cmm_asic.c @@ -37,124 +37,195 @@ #include "../rt_config.h" - // Reset the RFIC setting to new series RTMP_RF_REGS RF2850RegTable[] = { -// ch R1 R2 R3(TX0~4=0) R4 - {1, 0x98402ecc, 0x984c0786, 0x9816b455, 0x9800510b}, - {2, 0x98402ecc, 0x984c0786, 0x98168a55, 0x9800519f}, - {3, 0x98402ecc, 0x984c078a, 0x98168a55, 0x9800518b}, - {4, 0x98402ecc, 0x984c078a, 0x98168a55, 0x9800519f}, - {5, 0x98402ecc, 0x984c078e, 0x98168a55, 0x9800518b}, - {6, 0x98402ecc, 0x984c078e, 0x98168a55, 0x9800519f}, - {7, 0x98402ecc, 0x984c0792, 0x98168a55, 0x9800518b}, - {8, 0x98402ecc, 0x984c0792, 0x98168a55, 0x9800519f}, - {9, 0x98402ecc, 0x984c0796, 0x98168a55, 0x9800518b}, - {10, 0x98402ecc, 0x984c0796, 0x98168a55, 0x9800519f}, - {11, 0x98402ecc, 0x984c079a, 0x98168a55, 0x9800518b}, - {12, 0x98402ecc, 0x984c079a, 0x98168a55, 0x9800519f}, - {13, 0x98402ecc, 0x984c079e, 0x98168a55, 0x9800518b}, - {14, 0x98402ecc, 0x984c07a2, 0x98168a55, 0x98005193}, - - // 802.11 UNI / HyperLan 2 - {36, 0x98402ecc, 0x984c099a, 0x98158a55, 0x980ed1a3}, - {38, 0x98402ecc, 0x984c099e, 0x98158a55, 0x980ed193}, - {40, 0x98402ec8, 0x984c0682, 0x98158a55, 0x980ed183}, - {44, 0x98402ec8, 0x984c0682, 0x98158a55, 0x980ed1a3}, - {46, 0x98402ec8, 0x984c0686, 0x98158a55, 0x980ed18b}, - {48, 0x98402ec8, 0x984c0686, 0x98158a55, 0x980ed19b}, - {52, 0x98402ec8, 0x984c068a, 0x98158a55, 0x980ed193}, - {54, 0x98402ec8, 0x984c068a, 0x98158a55, 0x980ed1a3}, - {56, 0x98402ec8, 0x984c068e, 0x98158a55, 0x980ed18b}, - {60, 0x98402ec8, 0x984c0692, 0x98158a55, 0x980ed183}, - {62, 0x98402ec8, 0x984c0692, 0x98158a55, 0x980ed193}, - {64, 0x98402ec8, 0x984c0692, 0x98158a55, 0x980ed1a3}, // Plugfest#4, Day4, change RFR3 left4th 9->5. - - // 802.11 HyperLan 2 - {100, 0x98402ec8, 0x984c06b2, 0x98178a55, 0x980ed783}, - - // 2008.04.30 modified - // The system team has AN to improve the EVM value - // for channel 102 to 108 for the RT2850/RT2750 dual band solution. - {102, 0x98402ec8, 0x985c06b2, 0x98578a55, 0x980ed793}, - {104, 0x98402ec8, 0x985c06b2, 0x98578a55, 0x980ed1a3}, - {108, 0x98402ecc, 0x985c0a32, 0x98578a55, 0x980ed193}, - - {110, 0x98402ecc, 0x984c0a36, 0x98178a55, 0x980ed183}, - {112, 0x98402ecc, 0x984c0a36, 0x98178a55, 0x980ed19b}, - {116, 0x98402ecc, 0x984c0a3a, 0x98178a55, 0x980ed1a3}, - {118, 0x98402ecc, 0x984c0a3e, 0x98178a55, 0x980ed193}, - {120, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed183}, - {124, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed193}, - {126, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed15b}, // 0x980ed1bb->0x980ed15b required by Rory 20070927 - {128, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed1a3}, - {132, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed18b}, - {134, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed193}, - {136, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed19b}, - {140, 0x98402ec4, 0x984c038a, 0x98178a55, 0x980ed183}, - - // 802.11 UNII - {149, 0x98402ec4, 0x984c038a, 0x98178a55, 0x980ed1a7}, - {151, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed187}, - {153, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed18f}, - {157, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed19f}, - {159, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed1a7}, - {161, 0x98402ec4, 0x984c0392, 0x98178a55, 0x980ed187}, - {165, 0x98402ec4, 0x984c0392, 0x98178a55, 0x980ed197}, - {167, 0x98402ec4, 0x984c03d2, 0x98179855, 0x9815531f}, - {169, 0x98402ec4, 0x984c03d2, 0x98179855, 0x98155327}, - {171, 0x98402ec4, 0x984c03d6, 0x98179855, 0x98155307}, - {173, 0x98402ec4, 0x984c03d6, 0x98179855, 0x9815530f}, - - // Japan - {184, 0x95002ccc, 0x9500491e, 0x9509be55, 0x950c0a0b}, - {188, 0x95002ccc, 0x95004922, 0x9509be55, 0x950c0a13}, - {192, 0x95002ccc, 0x95004926, 0x9509be55, 0x950c0a1b}, - {196, 0x95002ccc, 0x9500492a, 0x9509be55, 0x950c0a23}, - {208, 0x95002ccc, 0x9500493a, 0x9509be55, 0x950c0a13}, - {212, 0x95002ccc, 0x9500493e, 0x9509be55, 0x950c0a1b}, - {216, 0x95002ccc, 0x95004982, 0x9509be55, 0x950c0a23}, - - // still lack of MMAC(Japan) ch 34,38,42,46 +// ch R1 R2 R3(TX0~4=0) R4 + {1, 0x98402ecc, 0x984c0786, 0x9816b455, 0x9800510b} + , + {2, 0x98402ecc, 0x984c0786, 0x98168a55, 0x9800519f} + , + {3, 0x98402ecc, 0x984c078a, 0x98168a55, 0x9800518b} + , + {4, 0x98402ecc, 0x984c078a, 0x98168a55, 0x9800519f} + , + {5, 0x98402ecc, 0x984c078e, 0x98168a55, 0x9800518b} + , + {6, 0x98402ecc, 0x984c078e, 0x98168a55, 0x9800519f} + , + {7, 0x98402ecc, 0x984c0792, 0x98168a55, 0x9800518b} + , + {8, 0x98402ecc, 0x984c0792, 0x98168a55, 0x9800519f} + , + {9, 0x98402ecc, 0x984c0796, 0x98168a55, 0x9800518b} + , + {10, 0x98402ecc, 0x984c0796, 0x98168a55, 0x9800519f} + , + {11, 0x98402ecc, 0x984c079a, 0x98168a55, 0x9800518b} + , + {12, 0x98402ecc, 0x984c079a, 0x98168a55, 0x9800519f} + , + {13, 0x98402ecc, 0x984c079e, 0x98168a55, 0x9800518b} + , + {14, 0x98402ecc, 0x984c07a2, 0x98168a55, 0x98005193} + , + + // 802.11 UNI / HyperLan 2 + {36, 0x98402ecc, 0x984c099a, 0x98158a55, 0x980ed1a3} + , + {38, 0x98402ecc, 0x984c099e, 0x98158a55, 0x980ed193} + , + {40, 0x98402ec8, 0x984c0682, 0x98158a55, 0x980ed183} + , + {44, 0x98402ec8, 0x984c0682, 0x98158a55, 0x980ed1a3} + , + {46, 0x98402ec8, 0x984c0686, 0x98158a55, 0x980ed18b} + , + {48, 0x98402ec8, 0x984c0686, 0x98158a55, 0x980ed19b} + , + {52, 0x98402ec8, 0x984c068a, 0x98158a55, 0x980ed193} + , + {54, 0x98402ec8, 0x984c068a, 0x98158a55, 0x980ed1a3} + , + {56, 0x98402ec8, 0x984c068e, 0x98158a55, 0x980ed18b} + , + {60, 0x98402ec8, 0x984c0692, 0x98158a55, 0x980ed183} + , + {62, 0x98402ec8, 0x984c0692, 0x98158a55, 0x980ed193} + , + {64, 0x98402ec8, 0x984c0692, 0x98158a55, 0x980ed1a3} + , // Plugfest#4, Day4, change RFR3 left4th 9->5. + + // 802.11 HyperLan 2 + {100, 0x98402ec8, 0x984c06b2, 0x98178a55, 0x980ed783} + , + + // 2008.04.30 modified + // The system team has AN to improve the EVM value + // for channel 102 to 108 for the RT2850/RT2750 dual band solution. + {102, 0x98402ec8, 0x985c06b2, 0x98578a55, 0x980ed793} + , + {104, 0x98402ec8, 0x985c06b2, 0x98578a55, 0x980ed1a3} + , + {108, 0x98402ecc, 0x985c0a32, 0x98578a55, 0x980ed193} + , + + {110, 0x98402ecc, 0x984c0a36, 0x98178a55, 0x980ed183} + , + {112, 0x98402ecc, 0x984c0a36, 0x98178a55, 0x980ed19b} + , + {116, 0x98402ecc, 0x984c0a3a, 0x98178a55, 0x980ed1a3} + , + {118, 0x98402ecc, 0x984c0a3e, 0x98178a55, 0x980ed193} + , + {120, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed183} + , + {124, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed193} + , + {126, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed15b} + , // 0x980ed1bb->0x980ed15b required by Rory 20070927 + {128, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed1a3} + , + {132, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed18b} + , + {134, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed193} + , + {136, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed19b} + , + {140, 0x98402ec4, 0x984c038a, 0x98178a55, 0x980ed183} + , + + // 802.11 UNII + {149, 0x98402ec4, 0x984c038a, 0x98178a55, 0x980ed1a7} + , + {151, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed187} + , + {153, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed18f} + , + {157, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed19f} + , + {159, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed1a7} + , + {161, 0x98402ec4, 0x984c0392, 0x98178a55, 0x980ed187} + , + {165, 0x98402ec4, 0x984c0392, 0x98178a55, 0x980ed197} + , + {167, 0x98402ec4, 0x984c03d2, 0x98179855, 0x9815531f} + , + {169, 0x98402ec4, 0x984c03d2, 0x98179855, 0x98155327} + , + {171, 0x98402ec4, 0x984c03d6, 0x98179855, 0x98155307} + , + {173, 0x98402ec4, 0x984c03d6, 0x98179855, 0x9815530f} + , + + // Japan + {184, 0x95002ccc, 0x9500491e, 0x9509be55, 0x950c0a0b} + , + {188, 0x95002ccc, 0x95004922, 0x9509be55, 0x950c0a13} + , + {192, 0x95002ccc, 0x95004926, 0x9509be55, 0x950c0a1b} + , + {196, 0x95002ccc, 0x9500492a, 0x9509be55, 0x950c0a23} + , + {208, 0x95002ccc, 0x9500493a, 0x9509be55, 0x950c0a13} + , + {212, 0x95002ccc, 0x9500493e, 0x9509be55, 0x950c0a1b} + , + {216, 0x95002ccc, 0x95004982, 0x9509be55, 0x950c0a23} + , + + // still lack of MMAC(Japan) ch 34,38,42,46 }; -UCHAR NUM_OF_2850_CHNL = (sizeof(RF2850RegTable) / sizeof(RTMP_RF_REGS)); -FREQUENCY_ITEM FreqItems3020[] = -{ +UCHAR NUM_OF_2850_CHNL = (sizeof(RF2850RegTable) / sizeof(RTMP_RF_REGS)); + +FREQUENCY_ITEM FreqItems3020[] = { /**************************************************/ // ISM : 2.4 to 2.483 GHz // /**************************************************/ // 11g /**************************************************/ //-CH---N-------R---K----------- - {1, 241, 2, 2}, - {2, 241, 2, 7}, - {3, 242, 2, 2}, - {4, 242, 2, 7}, - {5, 243, 2, 2}, - {6, 243, 2, 7}, - {7, 244, 2, 2}, - {8, 244, 2, 7}, - {9, 245, 2, 2}, - {10, 245, 2, 7}, - {11, 246, 2, 2}, - {12, 246, 2, 7}, - {13, 247, 2, 2}, - {14, 248, 2, 4}, + {1, 241, 2, 2} + , + {2, 241, 2, 7} + , + {3, 242, 2, 2} + , + {4, 242, 2, 7} + , + {5, 243, 2, 2} + , + {6, 243, 2, 7} + , + {7, 244, 2, 2} + , + {8, 244, 2, 7} + , + {9, 245, 2, 2} + , + {10, 245, 2, 7} + , + {11, 246, 2, 2} + , + {12, 246, 2, 7} + , + {13, 247, 2, 2} + , + {14, 248, 2, 4} + , }; -UCHAR NUM_OF_3020_CHNL = (sizeof(FreqItems3020) / sizeof(FREQUENCY_ITEM)); +UCHAR NUM_OF_3020_CHNL = (sizeof(FreqItems3020) / sizeof(FREQUENCY_ITEM)); -VOID AsicUpdateAutoFallBackTable( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pRateTable) +VOID AsicUpdateAutoFallBackTable(IN PRTMP_ADAPTER pAd, IN PUCHAR pRateTable) { - UCHAR i; - HT_FBK_CFG0_STRUC HtCfg0; - HT_FBK_CFG1_STRUC HtCfg1; - LG_FBK_CFG0_STRUC LgCfg0; - LG_FBK_CFG1_STRUC LgCfg1; - PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate; + UCHAR i; + HT_FBK_CFG0_STRUC HtCfg0; + HT_FBK_CFG1_STRUC HtCfg1; + LG_FBK_CFG0_STRUC LgCfg0; + LG_FBK_CFG1_STRUC LgCfg1; + PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate; // set to initial value HtCfg0.word = 0x65432100; @@ -162,106 +233,162 @@ VOID AsicUpdateAutoFallBackTable( LgCfg0.word = 0xedcba988; LgCfg1.word = 0x00002100; - pNextTxRate = (PRTMP_TX_RATE_SWITCH)pRateTable+1; - for (i = 1; i < *((PUCHAR) pRateTable); i++) - { - pCurrTxRate = (PRTMP_TX_RATE_SWITCH)pRateTable+1+i; - switch (pCurrTxRate->Mode) - { - case 0: //CCK - break; - case 1: //OFDM - { - switch(pCurrTxRate->CurrMCS) - { - case 0: - LgCfg0.field.OFDMMCS0FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 1: - LgCfg0.field.OFDMMCS1FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 2: - LgCfg0.field.OFDMMCS2FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 3: - LgCfg0.field.OFDMMCS3FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 4: - LgCfg0.field.OFDMMCS4FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 5: - LgCfg0.field.OFDMMCS5FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 6: - LgCfg0.field.OFDMMCS6FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - case 7: - LgCfg0.field.OFDMMCS7FBK = (pNextTxRate->Mode == MODE_OFDM) ? (pNextTxRate->CurrMCS+8): pNextTxRate->CurrMCS; - break; - } + pNextTxRate = (PRTMP_TX_RATE_SWITCH) pRateTable + 1; + for (i = 1; i < *((PUCHAR) pRateTable); i++) { + pCurrTxRate = (PRTMP_TX_RATE_SWITCH) pRateTable + 1 + i; + switch (pCurrTxRate->Mode) { + case 0: //CCK + break; + case 1: //OFDM + { + switch (pCurrTxRate->CurrMCS) { + case 0: + LgCfg0.field.OFDMMCS0FBK = + (pNextTxRate->Mode == + MODE_OFDM) ? (pNextTxRate-> + CurrMCS + + 8) : pNextTxRate-> + CurrMCS; + break; + case 1: + LgCfg0.field.OFDMMCS1FBK = + (pNextTxRate->Mode == + MODE_OFDM) ? (pNextTxRate-> + CurrMCS + + 8) : pNextTxRate-> + CurrMCS; + break; + case 2: + LgCfg0.field.OFDMMCS2FBK = + (pNextTxRate->Mode == + MODE_OFDM) ? (pNextTxRate-> + CurrMCS + + 8) : pNextTxRate-> + CurrMCS; + break; + case 3: + LgCfg0.field.OFDMMCS3FBK = + (pNextTxRate->Mode == + MODE_OFDM) ? (pNextTxRate-> + CurrMCS + + 8) : pNextTxRate-> + CurrMCS; + break; + case 4: + LgCfg0.field.OFDMMCS4FBK = + (pNextTxRate->Mode == + MODE_OFDM) ? (pNextTxRate-> + CurrMCS + + 8) : pNextTxRate-> + CurrMCS; + break; + case 5: + LgCfg0.field.OFDMMCS5FBK = + (pNextTxRate->Mode == + MODE_OFDM) ? (pNextTxRate-> + CurrMCS + + 8) : pNextTxRate-> + CurrMCS; + break; + case 6: + LgCfg0.field.OFDMMCS6FBK = + (pNextTxRate->Mode == + MODE_OFDM) ? (pNextTxRate-> + CurrMCS + + 8) : pNextTxRate-> + CurrMCS; + break; + case 7: + LgCfg0.field.OFDMMCS7FBK = + (pNextTxRate->Mode == + MODE_OFDM) ? (pNextTxRate-> + CurrMCS + + 8) : pNextTxRate-> + CurrMCS; + break; } - break; - case 2: //HT-MIX - case 3: //HT-GF - { - if ((pNextTxRate->Mode >= MODE_HTMIX) && (pCurrTxRate->CurrMCS != pNextTxRate->CurrMCS)) - { - switch(pCurrTxRate->CurrMCS) - { - case 0: - HtCfg0.field.HTMCS0FBK = pNextTxRate->CurrMCS; - break; - case 1: - HtCfg0.field.HTMCS1FBK = pNextTxRate->CurrMCS; - break; - case 2: - HtCfg0.field.HTMCS2FBK = pNextTxRate->CurrMCS; - break; - case 3: - HtCfg0.field.HTMCS3FBK = pNextTxRate->CurrMCS; - break; - case 4: - HtCfg0.field.HTMCS4FBK = pNextTxRate->CurrMCS; - break; - case 5: - HtCfg0.field.HTMCS5FBK = pNextTxRate->CurrMCS; - break; - case 6: - HtCfg0.field.HTMCS6FBK = pNextTxRate->CurrMCS; - break; - case 7: - HtCfg0.field.HTMCS7FBK = pNextTxRate->CurrMCS; - break; - case 8: - HtCfg1.field.HTMCS8FBK = pNextTxRate->CurrMCS; - break; - case 9: - HtCfg1.field.HTMCS9FBK = pNextTxRate->CurrMCS; - break; - case 10: - HtCfg1.field.HTMCS10FBK = pNextTxRate->CurrMCS; - break; - case 11: - HtCfg1.field.HTMCS11FBK = pNextTxRate->CurrMCS; - break; - case 12: - HtCfg1.field.HTMCS12FBK = pNextTxRate->CurrMCS; - break; - case 13: - HtCfg1.field.HTMCS13FBK = pNextTxRate->CurrMCS; - break; - case 14: - HtCfg1.field.HTMCS14FBK = pNextTxRate->CurrMCS; - break; - case 15: - HtCfg1.field.HTMCS15FBK = pNextTxRate->CurrMCS; - break; - default: - DBGPRINT(RT_DEBUG_ERROR, ("AsicUpdateAutoFallBackTable: not support CurrMCS=%d\n", pCurrTxRate->CurrMCS)); - } + } + break; + case 2: //HT-MIX + case 3: //HT-GF + { + if ((pNextTxRate->Mode >= MODE_HTMIX) + && (pCurrTxRate->CurrMCS != + pNextTxRate->CurrMCS)) { + switch (pCurrTxRate->CurrMCS) { + case 0: + HtCfg0.field.HTMCS0FBK = + pNextTxRate->CurrMCS; + break; + case 1: + HtCfg0.field.HTMCS1FBK = + pNextTxRate->CurrMCS; + break; + case 2: + HtCfg0.field.HTMCS2FBK = + pNextTxRate->CurrMCS; + break; + case 3: + HtCfg0.field.HTMCS3FBK = + pNextTxRate->CurrMCS; + break; + case 4: + HtCfg0.field.HTMCS4FBK = + pNextTxRate->CurrMCS; + break; + case 5: + HtCfg0.field.HTMCS5FBK = + pNextTxRate->CurrMCS; + break; + case 6: + HtCfg0.field.HTMCS6FBK = + pNextTxRate->CurrMCS; + break; + case 7: + HtCfg0.field.HTMCS7FBK = + pNextTxRate->CurrMCS; + break; + case 8: + HtCfg1.field.HTMCS8FBK = + pNextTxRate->CurrMCS; + break; + case 9: + HtCfg1.field.HTMCS9FBK = + pNextTxRate->CurrMCS; + break; + case 10: + HtCfg1.field.HTMCS10FBK = + pNextTxRate->CurrMCS; + break; + case 11: + HtCfg1.field.HTMCS11FBK = + pNextTxRate->CurrMCS; + break; + case 12: + HtCfg1.field.HTMCS12FBK = + pNextTxRate->CurrMCS; + break; + case 13: + HtCfg1.field.HTMCS13FBK = + pNextTxRate->CurrMCS; + break; + case 14: + HtCfg1.field.HTMCS14FBK = + pNextTxRate->CurrMCS; + break; + case 15: + HtCfg1.field.HTMCS15FBK = + pNextTxRate->CurrMCS; + break; + default: + DBGPRINT(RT_DEBUG_ERROR, + ("AsicUpdateAutoFallBackTable: not support CurrMCS=%d\n", + pCurrTxRate-> + CurrMCS)); } } - break; + } + break; } pNextTxRate = pCurrTxRate; @@ -290,49 +417,39 @@ VOID AsicUpdateAutoFallBackTable( we should choose not to use GF. But still set correct ASIC registers. ======================================================================== */ -VOID AsicUpdateProtect( - IN PRTMP_ADAPTER pAd, - IN USHORT OperationMode, - IN UCHAR SetMask, - IN BOOLEAN bDisableBGProtect, - IN BOOLEAN bNonGFExist) +VOID AsicUpdateProtect(IN PRTMP_ADAPTER pAd, + IN USHORT OperationMode, + IN UCHAR SetMask, + IN BOOLEAN bDisableBGProtect, IN BOOLEAN bNonGFExist) { - PROT_CFG_STRUC ProtCfg, ProtCfg4; + PROT_CFG_STRUC ProtCfg, ProtCfg4; UINT32 Protect[6]; - USHORT offset; - UCHAR i; + USHORT offset; + UCHAR i; UINT32 MacReg = 0; - - if (!(pAd->CommonCfg.bHTProtect) && (OperationMode != 8)) - { + if (!(pAd->CommonCfg.bHTProtect) && (OperationMode != 8)) { return; } - if (pAd->BATable.numDoneOriginator) - { + if (pAd->BATable.numDoneOriginator) { // // enable the RTS/CTS to avoid channel collision // SetMask = ALLN_SETPROTECT; OperationMode = 8; } - // Config ASIC RTS threshold register RTMP_IO_READ32(pAd, TX_RTS_CFG, &MacReg); MacReg &= 0xFF0000FF; // If the user want disable RtsThreshold and enable Amsdu/Ralink-Aggregation, set the RtsThreshold as 4096 - if (( - (pAd->CommonCfg.BACapability.field.AmsduEnable) || - (pAd->CommonCfg.bAggregationCapable == TRUE)) - && pAd->CommonCfg.RtsThreshold == MAX_RTS_THRESHOLD) - { - MacReg |= (0x1000 << 8); - } - else - { - MacReg |= (pAd->CommonCfg.RtsThreshold << 8); - } + if (((pAd->CommonCfg.BACapability.field.AmsduEnable) || + (pAd->CommonCfg.bAggregationCapable == TRUE)) + && pAd->CommonCfg.RtsThreshold == MAX_RTS_THRESHOLD) { + MacReg |= (0x1000 << 8); + } else { + MacReg |= (pAd->CommonCfg.RtsThreshold << 8); + } RTMP_IO_WRITE32(pAd, TX_RTS_CFG, MacReg); @@ -355,165 +472,155 @@ VOID AsicUpdateProtect( ProtCfg.field.ProtectRate |= pAd->CommonCfg.RtsRate; // Handle legacy(B/G) protection - if (bDisableBGProtect) - { + if (bDisableBGProtect) { //ProtCfg.field.ProtectRate = pAd->CommonCfg.RtsRate; ProtCfg.field.ProtectCtrl = 0; Protect[0] = ProtCfg.word; Protect[1] = ProtCfg.word; - pAd->FlgCtsEnabled = 0; /* CTS-self is not used */ - } - else - { + pAd->FlgCtsEnabled = 0; /* CTS-self is not used */ + } else { //ProtCfg.field.ProtectRate = pAd->CommonCfg.RtsRate; - ProtCfg.field.ProtectCtrl = 0; // CCK do not need to be protected + ProtCfg.field.ProtectCtrl = 0; // CCK do not need to be protected Protect[0] = ProtCfg.word; ProtCfg.field.ProtectCtrl = ASIC_CTS; // OFDM needs using CCK to protect Protect[1] = ProtCfg.word; - pAd->FlgCtsEnabled = 1; /* CTS-self is used */ + pAd->FlgCtsEnabled = 1; /* CTS-self is used */ } // Decide HT frame protection. - if ((SetMask & ALLN_SETPROTECT) != 0) - { - switch(OperationMode) - { - case 0x0: - // NO PROTECT - // 1.All STAs in the BSS are 20/40 MHz HT - // 2. in ai 20/40MHz BSS - // 3. all STAs are 20MHz in a 20MHz BSS - // Pure HT. no protection. - - // MM20_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 010111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4004 (OFDM 24M) - Protect[2] = 0x01744004; - - // MM40_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 111111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4084 (duplicate OFDM 24M) - Protect[3] = 0x03f44084; - - // CF20_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 010111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4004 (OFDM 24M) - Protect[4] = 0x01744004; - - // CF40_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 111111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4084 (duplicate OFDM 24M) - Protect[5] = 0x03f44084; - - if (bNonGFExist) - { - // PROT_NAV(19:18) -- 01 (Short NAV protectiion) - // PROT_CTRL(17:16) -- 01 (RTS/CTS) - Protect[4] = 0x01754004; - Protect[5] = 0x03f54084; - } - pAd->CommonCfg.IOTestParm.bRTSLongProtOn = FALSE; - break; + if ((SetMask & ALLN_SETPROTECT) != 0) { + switch (OperationMode) { + case 0x0: + // NO PROTECT + // 1.All STAs in the BSS are 20/40 MHz HT + // 2. in ai 20/40MHz BSS + // 3. all STAs are 20MHz in a 20MHz BSS + // Pure HT. no protection. + + // MM20_PROT_CFG + // Reserved (31:27) + // PROT_TXOP(25:20) -- 010111 + // PROT_NAV(19:18) -- 01 (Short NAV protection) + // PROT_CTRL(17:16) -- 00 (None) + // PROT_RATE(15:0) -- 0x4004 (OFDM 24M) + Protect[2] = 0x01744004; + + // MM40_PROT_CFG + // Reserved (31:27) + // PROT_TXOP(25:20) -- 111111 + // PROT_NAV(19:18) -- 01 (Short NAV protection) + // PROT_CTRL(17:16) -- 00 (None) + // PROT_RATE(15:0) -- 0x4084 (duplicate OFDM 24M) + Protect[3] = 0x03f44084; + + // CF20_PROT_CFG + // Reserved (31:27) + // PROT_TXOP(25:20) -- 010111 + // PROT_NAV(19:18) -- 01 (Short NAV protection) + // PROT_CTRL(17:16) -- 00 (None) + // PROT_RATE(15:0) -- 0x4004 (OFDM 24M) + Protect[4] = 0x01744004; + + // CF40_PROT_CFG + // Reserved (31:27) + // PROT_TXOP(25:20) -- 111111 + // PROT_NAV(19:18) -- 01 (Short NAV protection) + // PROT_CTRL(17:16) -- 00 (None) + // PROT_RATE(15:0) -- 0x4084 (duplicate OFDM 24M) + Protect[5] = 0x03f44084; + + if (bNonGFExist) { + // PROT_NAV(19:18) -- 01 (Short NAV protectiion) + // PROT_CTRL(17:16) -- 01 (RTS/CTS) + Protect[4] = 0x01754004; + Protect[5] = 0x03f54084; + } + pAd->CommonCfg.IOTestParm.bRTSLongProtOn = FALSE; + break; - case 1: - // This is "HT non-member protection mode." - // If there may be non-HT STAs my BSS - ProtCfg.word = 0x01744004; // PROT_CTRL(17:16) : 0 (None) - ProtCfg4.word = 0x03f44084; // duplicaet legacy 24M. BW set 1. - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_BG_PROTECTION_INUSED)) - { - ProtCfg.word = 0x01740003; //ERP use Protection bit is set, use protection rate at Clause 18.. - ProtCfg4.word = 0x03f40003; // Don't duplicate RTS/CTS in CCK mode. 0x03f40083; - } - //Assign Protection method for 20&40 MHz packets + case 1: + // This is "HT non-member protection mode." + // If there may be non-HT STAs my BSS + ProtCfg.word = 0x01744004; // PROT_CTRL(17:16) : 0 (None) + ProtCfg4.word = 0x03f44084; // duplicaet legacy 24M. BW set 1. + if (OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_BG_PROTECTION_INUSED)) { + ProtCfg.word = 0x01740003; //ERP use Protection bit is set, use protection rate at Clause 18.. + ProtCfg4.word = 0x03f40003; // Don't duplicate RTS/CTS in CCK mode. 0x03f40083; + } + //Assign Protection method for 20&40 MHz packets + ProtCfg.field.ProtectCtrl = ASIC_RTS; + ProtCfg.field.ProtectNav = ASIC_SHORTNAV; + ProtCfg4.field.ProtectCtrl = ASIC_RTS; + ProtCfg4.field.ProtectNav = ASIC_SHORTNAV; + Protect[2] = ProtCfg.word; + Protect[3] = ProtCfg4.word; + Protect[4] = ProtCfg.word; + Protect[5] = ProtCfg4.word; + pAd->CommonCfg.IOTestParm.bRTSLongProtOn = TRUE; + break; + + case 2: + // If only HT STAs are in BSS. at least one is 20MHz. Only protect 40MHz packets + ProtCfg.word = 0x01744004; // PROT_CTRL(17:16) : 0 (None) + ProtCfg4.word = 0x03f44084; // duplicaet legacy 24M. BW set 1. + + //Assign Protection method for 40MHz packets + ProtCfg4.field.ProtectCtrl = ASIC_RTS; + ProtCfg4.field.ProtectNav = ASIC_SHORTNAV; + Protect[2] = ProtCfg.word; + Protect[3] = ProtCfg4.word; + if (bNonGFExist) { ProtCfg.field.ProtectCtrl = ASIC_RTS; ProtCfg.field.ProtectNav = ASIC_SHORTNAV; - ProtCfg4.field.ProtectCtrl = ASIC_RTS; - ProtCfg4.field.ProtectNav = ASIC_SHORTNAV; - Protect[2] = ProtCfg.word; - Protect[3] = ProtCfg4.word; - Protect[4] = ProtCfg.word; - Protect[5] = ProtCfg4.word; - pAd->CommonCfg.IOTestParm.bRTSLongProtOn = TRUE; - break; - - case 2: - // If only HT STAs are in BSS. at least one is 20MHz. Only protect 40MHz packets - ProtCfg.word = 0x01744004; // PROT_CTRL(17:16) : 0 (None) - ProtCfg4.word = 0x03f44084; // duplicaet legacy 24M. BW set 1. - - //Assign Protection method for 40MHz packets - ProtCfg4.field.ProtectCtrl = ASIC_RTS; - ProtCfg4.field.ProtectNav = ASIC_SHORTNAV; - Protect[2] = ProtCfg.word; - Protect[3] = ProtCfg4.word; - if (bNonGFExist) - { - ProtCfg.field.ProtectCtrl = ASIC_RTS; - ProtCfg.field.ProtectNav = ASIC_SHORTNAV; - } - Protect[4] = ProtCfg.word; - Protect[5] = ProtCfg4.word; + } + Protect[4] = ProtCfg.word; + Protect[5] = ProtCfg4.word; - pAd->CommonCfg.IOTestParm.bRTSLongProtOn = FALSE; - break; + pAd->CommonCfg.IOTestParm.bRTSLongProtOn = FALSE; + break; - case 3: - // HT mixed mode. PROTECT ALL! - // Assign Rate - ProtCfg.word = 0x01744004; //duplicaet legacy 24M. BW set 1. - ProtCfg4.word = 0x03f44084; - // both 20MHz and 40MHz are protected. Whether use RTS or CTS-to-self depends on the - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_BG_PROTECTION_INUSED)) - { - ProtCfg.word = 0x01740003; //ERP use Protection bit is set, use protection rate at Clause 18.. - ProtCfg4.word = 0x03f40003; // Don't duplicate RTS/CTS in CCK mode. 0x03f40083 - } - //Assign Protection method for 20&40 MHz packets - ProtCfg.field.ProtectCtrl = ASIC_RTS; - ProtCfg.field.ProtectNav = ASIC_SHORTNAV; - ProtCfg4.field.ProtectCtrl = ASIC_RTS; - ProtCfg4.field.ProtectNav = ASIC_SHORTNAV; - Protect[2] = ProtCfg.word; - Protect[3] = ProtCfg4.word; - Protect[4] = ProtCfg.word; - Protect[5] = ProtCfg4.word; - pAd->CommonCfg.IOTestParm.bRTSLongProtOn = TRUE; - break; + case 3: + // HT mixed mode. PROTECT ALL! + // Assign Rate + ProtCfg.word = 0x01744004; //duplicaet legacy 24M. BW set 1. + ProtCfg4.word = 0x03f44084; + // both 20MHz and 40MHz are protected. Whether use RTS or CTS-to-self depends on the + if (OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_BG_PROTECTION_INUSED)) { + ProtCfg.word = 0x01740003; //ERP use Protection bit is set, use protection rate at Clause 18.. + ProtCfg4.word = 0x03f40003; // Don't duplicate RTS/CTS in CCK mode. 0x03f40083 + } + //Assign Protection method for 20&40 MHz packets + ProtCfg.field.ProtectCtrl = ASIC_RTS; + ProtCfg.field.ProtectNav = ASIC_SHORTNAV; + ProtCfg4.field.ProtectCtrl = ASIC_RTS; + ProtCfg4.field.ProtectNav = ASIC_SHORTNAV; + Protect[2] = ProtCfg.word; + Protect[3] = ProtCfg4.word; + Protect[4] = ProtCfg.word; + Protect[5] = ProtCfg4.word; + pAd->CommonCfg.IOTestParm.bRTSLongProtOn = TRUE; + break; - case 8: - // Special on for Atheros problem n chip. - Protect[2] = 0x01754004; - Protect[3] = 0x03f54084; - Protect[4] = 0x01754004; - Protect[5] = 0x03f54084; - pAd->CommonCfg.IOTestParm.bRTSLongProtOn = TRUE; - break; + case 8: + // Special on for Atheros problem n chip. + Protect[2] = 0x01754004; + Protect[3] = 0x03f54084; + Protect[4] = 0x01754004; + Protect[5] = 0x03f54084; + pAd->CommonCfg.IOTestParm.bRTSLongProtOn = TRUE; + break; } } offset = CCK_PROT_CFG; - for (i = 0;i < 6;i++) - { - if ((SetMask & (1<< i))) - { - RTMP_IO_WRITE32(pAd, offset + i*4, Protect[i]); + for (i = 0; i < 6; i++) { + if ((SetMask & (1 << i))) { + RTMP_IO_WRITE32(pAd, offset + i * 4, Protect[i]); + } } } -} - /* ========================================================================== @@ -524,54 +631,51 @@ VOID AsicUpdateProtect( ========================================================================== */ -VOID AsicSwitchChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel, - IN BOOLEAN bScan) +VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) { - ULONG R2 = 0, R3 = DEFAULT_RF_TX_POWER, R4 = 0; - CHAR TxPwer = 0, TxPwer2 = DEFAULT_RF_TX_POWER; //Bbp94 = BBPR94_DEFAULT, TxPwer2 = DEFAULT_RF_TX_POWER; - UCHAR index; - UINT32 Value = 0; //BbpReg, Value; + ULONG R2 = 0, R3 = DEFAULT_RF_TX_POWER, R4 = 0; + CHAR TxPwer = 0, TxPwer2 = DEFAULT_RF_TX_POWER; //Bbp94 = BBPR94_DEFAULT, TxPwer2 = DEFAULT_RF_TX_POWER; + UCHAR index; + UINT32 Value = 0; //BbpReg, Value; RTMP_RF_REGS *RFRegTable; - UCHAR RFValue; + UCHAR RFValue; RFValue = 0; // Search Tx power value // We can't use ChannelList to search channel, since some central channl's txpowr doesn't list // in ChannelList, so use TxPower array instead. // - for (index = 0; index < MAX_NUM_OF_CHANNELS; index++) - { - if (Channel == pAd->TxPower[index].Channel) - { + for (index = 0; index < MAX_NUM_OF_CHANNELS; index++) { + if (Channel == pAd->TxPower[index].Channel) { TxPwer = pAd->TxPower[index].Power; TxPwer2 = pAd->TxPower[index].Power2; break; } } - if (index == MAX_NUM_OF_CHANNELS) - { - DBGPRINT(RT_DEBUG_ERROR, ("AsicSwitchChannel: Can't find the Channel#%d \n", Channel)); + if (index == MAX_NUM_OF_CHANNELS) { + DBGPRINT(RT_DEBUG_ERROR, + ("AsicSwitchChannel: Can't find the Channel#%d \n", + Channel)); } - #ifdef RT30xx // The RF programming sequence is difference between 3xxx and 2xxx - if ((IS_RT3070(pAd) || IS_RT3090(pAd)||IS_RT3390(pAd)) && ((pAd->RfIcType == RFIC_3020) || (pAd->RfIcType == RFIC_2020) || - (pAd->RfIcType == RFIC_3021) || (pAd->RfIcType == RFIC_3022))) - { + if ((IS_RT3070(pAd) || IS_RT3090(pAd) || IS_RT3390(pAd)) + && ((pAd->RfIcType == RFIC_3020) || (pAd->RfIcType == RFIC_2020) + || (pAd->RfIcType == RFIC_3021) + || (pAd->RfIcType == RFIC_3022))) { /* modify by WY for Read RF Reg. error */ - for (index = 0; index < NUM_OF_3020_CHNL; index++) - { - if (Channel == FreqItems3020[index].Channel) - { + for (index = 0; index < NUM_OF_3020_CHNL; index++) { + if (Channel == FreqItems3020[index].Channel) { // Programming channel parameters - RT30xxWriteRFRegister(pAd, RF_R02, FreqItems3020[index].N); - RT30xxWriteRFRegister(pAd, RF_R03, FreqItems3020[index].K); + RT30xxWriteRFRegister(pAd, RF_R02, + FreqItems3020[index].N); + RT30xxWriteRFRegister(pAd, RF_R03, + FreqItems3020[index].K); RT30xxReadRFRegister(pAd, RF_R06, &RFValue); - RFValue = (RFValue & 0xFC) | FreqItems3020[index].R; + RFValue = + (RFValue & 0xFC) | FreqItems3020[index].R; RT30xxWriteRFRegister(pAd, RF_R06, RFValue); // Set Tx0 Power @@ -587,7 +691,7 @@ VOID AsicSwitchChannel( // Tx/Rx Stream setting RT30xxReadRFRegister(pAd, RF_R01, &RFValue); //if (IS_RT3090(pAd)) - // RFValue |= 0x01; // Enable RF block. + // RFValue |= 0x01; // Enable RF block. RFValue &= 0x03; //clear bit[7~2] if (pAd->Antenna.field.TxPath == 1) RFValue |= 0xA0; @@ -605,13 +709,11 @@ VOID AsicSwitchChannel( RT30xxWriteRFRegister(pAd, RF_R23, RFValue); // Set BW - if (!bScan && (pAd->CommonCfg.BBPCurrentBW == BW_40)) - { + if (!bScan + && (pAd->CommonCfg.BBPCurrentBW == BW_40)) { RFValue = pAd->Mlme.CaliBW40RfR24; //DISABLE_11N_CHECK(pAd); - } - else - { + } else { RFValue = pAd->Mlme.CaliBW20RfR24; } RT30xxWriteRFRegister(pAd, RF_R24, RFValue); @@ -625,166 +727,186 @@ VOID AsicSwitchChannel( // latch channel for future usage. pAd->LatchRfRegs.Channel = Channel; - DBGPRINT(RT_DEBUG_TRACE, ("SwitchChannel#%d(RF=%d, Pwr0=%d, Pwr1=%d, %dT), N=0x%02X, K=0x%02X, R=0x%02X\n", - Channel, - pAd->RfIcType, - TxPwer, - TxPwer2, - pAd->Antenna.field.TxPath, - FreqItems3020[index].N, - FreqItems3020[index].K, - FreqItems3020[index].R)); + DBGPRINT(RT_DEBUG_TRACE, + ("SwitchChannel#%d(RF=%d, Pwr0=%d, Pwr1=%d, %dT), N=0x%02X, K=0x%02X, R=0x%02X\n", + Channel, pAd->RfIcType, TxPwer, + TxPwer2, pAd->Antenna.field.TxPath, + FreqItems3020[index].N, + FreqItems3020[index].K, + FreqItems3020[index].R)); break; } } - } - else + } else #endif // RT30xx // { RFRegTable = RF2850RegTable; - switch (pAd->RfIcType) - { - case RFIC_2820: - case RFIC_2850: - case RFIC_2720: - case RFIC_2750: - - for (index = 0; index < NUM_OF_2850_CHNL; index++) - { - if (Channel == RFRegTable[index].Channel) - { - R2 = RFRegTable[index].R2; - if (pAd->Antenna.field.TxPath == 1) - { - R2 |= 0x4000; // If TXpath is 1, bit 14 = 1; - } + switch (pAd->RfIcType) { + case RFIC_2820: + case RFIC_2850: + case RFIC_2720: + case RFIC_2750: - if (pAd->Antenna.field.RxPath == 2) - { - R2 |= 0x40; // write 1 to off Rxpath. - } - else if (pAd->Antenna.field.RxPath == 1) - { - R2 |= 0x20040; // write 1 to off RxPath - } + for (index = 0; index < NUM_OF_2850_CHNL; index++) { + if (Channel == RFRegTable[index].Channel) { + R2 = RFRegTable[index].R2; + if (pAd->Antenna.field.TxPath == 1) { + R2 |= 0x4000; // If TXpath is 1, bit 14 = 1; + } - if (Channel > 14) - { - // initialize R3, R4 - R3 = (RFRegTable[index].R3 & 0xffffc1ff); - R4 = (RFRegTable[index].R4 & (~0x001f87c0)) | (pAd->RfFreqOffset << 15); - - // 5G band power range: 0xF9~0X0F, TX0 Reg3 bit9/TX1 Reg4 bit6="0" means the TX power reduce 7dB - // R3 - if ((TxPwer >= -7) && (TxPwer < 0)) - { - TxPwer = (7+TxPwer); - TxPwer = (TxPwer > 0xF) ? (0xF) : (TxPwer); - R3 |= (TxPwer << 10); - DBGPRINT(RT_DEBUG_ERROR, ("AsicSwitchChannel: TxPwer=%d \n", TxPwer)); - } - else - { - TxPwer = (TxPwer > 0xF) ? (0xF) : (TxPwer); - R3 |= (TxPwer << 10) | (1 << 9); - } - - // R4 - if ((TxPwer2 >= -7) && (TxPwer2 < 0)) - { - TxPwer2 = (7+TxPwer2); - TxPwer2 = (TxPwer2 > 0xF) ? (0xF) : (TxPwer2); - R4 |= (TxPwer2 << 7); - DBGPRINT(RT_DEBUG_ERROR, ("AsicSwitchChannel: TxPwer2=%d \n", TxPwer2)); - } - else - { - TxPwer2 = (TxPwer2 > 0xF) ? (0xF) : (TxPwer2); - R4 |= (TxPwer2 << 7) | (1 << 6); - } - } - else - { - R3 = (RFRegTable[index].R3 & 0xffffc1ff) | (TxPwer << 9); // set TX power0 - R4 = (RFRegTable[index].R4 & (~0x001f87c0)) | (pAd->RfFreqOffset << 15) | (TxPwer2 <<6);// Set freq Offset & TxPwr1 - } + if (pAd->Antenna.field.RxPath == 2) { + R2 |= 0x40; // write 1 to off Rxpath. + } else if (pAd->Antenna.field.RxPath == + 1) { + R2 |= 0x20040; // write 1 to off RxPath + } - // Based on BBP current mode before changing RF channel. - if (!bScan && (pAd->CommonCfg.BBPCurrentBW == BW_40)) - { - R4 |=0x200000; + if (Channel > 14) { + // initialize R3, R4 + R3 = (RFRegTable[index]. + R3 & 0xffffc1ff); + R4 = (RFRegTable[index]. + R4 & (~0x001f87c0)) | + (pAd->RfFreqOffset << 15); + + // 5G band power range: 0xF9~0X0F, TX0 Reg3 bit9/TX1 Reg4 bit6="0" means the TX power reduce 7dB + // R3 + if ((TxPwer >= -7) + && (TxPwer < 0)) { + TxPwer = (7 + TxPwer); + TxPwer = + (TxPwer > + 0xF) ? (0xF) + : (TxPwer); + R3 |= (TxPwer << 10); + DBGPRINT(RT_DEBUG_ERROR, + ("AsicSwitchChannel: TxPwer=%d \n", + TxPwer)); + } else { + TxPwer = + (TxPwer > + 0xF) ? (0xF) + : (TxPwer); + R3 |= + (TxPwer << 10) | (1 + << + 9); } - // Update variables - pAd->LatchRfRegs.Channel = Channel; - pAd->LatchRfRegs.R1 = RFRegTable[index].R1; - pAd->LatchRfRegs.R2 = R2; - pAd->LatchRfRegs.R3 = R3; - pAd->LatchRfRegs.R4 = R4; - - // Set RF value 1's set R3[bit2] = [0] - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R1); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R2); - RTMP_RF_IO_WRITE32(pAd, (pAd->LatchRfRegs.R3 & (~0x04))); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R4); - - RTMPusecDelay(200); - - // Set RF value 2's set R3[bit2] = [1] - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R1); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R2); - RTMP_RF_IO_WRITE32(pAd, (pAd->LatchRfRegs.R3 | 0x04)); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R4); - - RTMPusecDelay(200); - - // Set RF value 3's set R3[bit2] = [0] - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R1); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R2); - RTMP_RF_IO_WRITE32(pAd, (pAd->LatchRfRegs.R3 & (~0x04))); - RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R4); + // R4 + if ((TxPwer2 >= -7) + && (TxPwer2 < 0)) { + TxPwer2 = (7 + TxPwer2); + TxPwer2 = + (TxPwer2 > + 0xF) ? (0xF) + : (TxPwer2); + R4 |= (TxPwer2 << 7); + DBGPRINT(RT_DEBUG_ERROR, + ("AsicSwitchChannel: TxPwer2=%d \n", + TxPwer2)); + } else { + TxPwer2 = + (TxPwer2 > + 0xF) ? (0xF) + : (TxPwer2); + R4 |= + (TxPwer2 << 7) | (1 + << + 6); + } + } else { + R3 = (RFRegTable[index].R3 & 0xffffc1ff) | (TxPwer << 9); // set TX power0 + R4 = (RFRegTable[index].R4 & (~0x001f87c0)) | (pAd->RfFreqOffset << 15) | (TxPwer2 << 6); // Set freq Offset & TxPwr1 + } - break; + // Based on BBP current mode before changing RF channel. + if (!bScan + && (pAd->CommonCfg.BBPCurrentBW == + BW_40)) { + R4 |= 0x200000; } + // Update variables + pAd->LatchRfRegs.Channel = Channel; + pAd->LatchRfRegs.R1 = + RFRegTable[index].R1; + pAd->LatchRfRegs.R2 = R2; + pAd->LatchRfRegs.R3 = R3; + pAd->LatchRfRegs.R4 = R4; + + // Set RF value 1's set R3[bit2] = [0] + RTMP_RF_IO_WRITE32(pAd, + pAd->LatchRfRegs.R1); + RTMP_RF_IO_WRITE32(pAd, + pAd->LatchRfRegs.R2); + RTMP_RF_IO_WRITE32(pAd, + (pAd->LatchRfRegs. + R3 & (~0x04))); + RTMP_RF_IO_WRITE32(pAd, + pAd->LatchRfRegs.R4); + + RTMPusecDelay(200); + + // Set RF value 2's set R3[bit2] = [1] + RTMP_RF_IO_WRITE32(pAd, + pAd->LatchRfRegs.R1); + RTMP_RF_IO_WRITE32(pAd, + pAd->LatchRfRegs.R2); + RTMP_RF_IO_WRITE32(pAd, + (pAd->LatchRfRegs. + R3 | 0x04)); + RTMP_RF_IO_WRITE32(pAd, + pAd->LatchRfRegs.R4); + + RTMPusecDelay(200); + + // Set RF value 3's set R3[bit2] = [0] + RTMP_RF_IO_WRITE32(pAd, + pAd->LatchRfRegs.R1); + RTMP_RF_IO_WRITE32(pAd, + pAd->LatchRfRegs.R2); + RTMP_RF_IO_WRITE32(pAd, + (pAd->LatchRfRegs. + R3 & (~0x04))); + RTMP_RF_IO_WRITE32(pAd, + pAd->LatchRfRegs.R4); + + break; } - break; + } + break; - default: - break; + default: + break; } - DBGPRINT(RT_DEBUG_TRACE, ("SwitchChannel#%d(RF=%d, Pwr0=%lu, Pwr1=%lu, %dT) to , R1=0x%08lx, R2=0x%08lx, R3=0x%08lx, R4=0x%08lx\n", - Channel, - pAd->RfIcType, - (R3 & 0x00003e00) >> 9, - (R4 & 0x000007c0) >> 6, - pAd->Antenna.field.TxPath, - pAd->LatchRfRegs.R1, - pAd->LatchRfRegs.R2, - pAd->LatchRfRegs.R3, - pAd->LatchRfRegs.R4)); + DBGPRINT(RT_DEBUG_TRACE, + ("SwitchChannel#%d(RF=%d, Pwr0=%lu, Pwr1=%lu, %dT) to , R1=0x%08lx, R2=0x%08lx, R3=0x%08lx, R4=0x%08lx\n", + Channel, pAd->RfIcType, (R3 & 0x00003e00) >> 9, + (R4 & 0x000007c0) >> 6, pAd->Antenna.field.TxPath, + pAd->LatchRfRegs.R1, pAd->LatchRfRegs.R2, + pAd->LatchRfRegs.R3, pAd->LatchRfRegs.R4)); } // Change BBP setting during siwtch from a->g, g->a - if (Channel <= 14) - { - ULONG TxPinCfg = 0x00050F0A;//Gary 2007/08/09 0x050A0A - - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R62, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R63, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R64, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R86, 0);//(0x44 - GET_LNA_GAIN(pAd))); // According the Rory's suggestion to solve the middle range issue. + if (Channel <= 14) { + ULONG TxPinCfg = 0x00050F0A; //Gary 2007/08/09 0x050A0A + + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R62, + (0x37 - GET_LNA_GAIN(pAd))); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R63, + (0x37 - GET_LNA_GAIN(pAd))); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R64, + (0x37 - GET_LNA_GAIN(pAd))); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R86, 0); //(0x44 - GET_LNA_GAIN(pAd))); // According the Rory's suggestion to solve the middle range issue. //RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0x62); // Rx High power VGA offset for LNA select - if (pAd->NicConfig2.field.ExternalLNAForG) - { + if (pAd->NicConfig2.field.ExternalLNAForG) { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0x62); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x46); - } - else - { + } else { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0x84); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x50); } @@ -796,58 +918,54 @@ VOID AsicSwitchChannel( RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); // Turn off unused PA or LNA when only 1T or 1R - if (pAd->Antenna.field.TxPath == 1) - { + if (pAd->Antenna.field.TxPath == 1) { TxPinCfg &= 0xFFFFFFF3; } - if (pAd->Antenna.field.RxPath == 1) - { + if (pAd->Antenna.field.RxPath == 1) { TxPinCfg &= 0xFFFFF3FF; } - RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg); #if defined(RT3090) || defined(RT3390) // PCIe PHY Transmit attenuation adjustment if (IS_RT3090A(pAd) || IS_RT3390(pAd)) { - TX_ATTENUATION_CTRL_STRUC - TxAttenuationCtrl = { .word = 0 }; + TX_ATTENUATION_CTRL_STRUC TxAttenuationCtrl = { + .word = 0}; - RTMP_IO_READ32(pAd, PCIE_PHY_TX_ATTENUATION_CTRL, &TxAttenuationCtrl.word); + RTMP_IO_READ32(pAd, PCIE_PHY_TX_ATTENUATION_CTRL, + &TxAttenuationCtrl.word); - if (Channel == 14) // Channel #14 + if (Channel == 14) // Channel #14 { - TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_EN = 1; // Enable PCIe PHY Tx attenuation - TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_VALUE = 4; // 9/16 full drive level - } - else // Channel #1~#13 + TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_EN = 1; // Enable PCIe PHY Tx attenuation + TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_VALUE = 4; // 9/16 full drive level + } else // Channel #1~#13 { - TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_EN = 0; // Disable PCIe PHY Tx attenuation - TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_VALUE = 0; // n/a + TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_EN = 0; // Disable PCIe PHY Tx attenuation + TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_VALUE = 0; // n/a } - RTMP_IO_WRITE32(pAd, PCIE_PHY_TX_ATTENUATION_CTRL, TxAttenuationCtrl.word); + RTMP_IO_WRITE32(pAd, PCIE_PHY_TX_ATTENUATION_CTRL, + TxAttenuationCtrl.word); } #endif - } - else - { - ULONG TxPinCfg = 0x00050F05;//Gary 2007/8/9 0x050505 - - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R62, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R63, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R64, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R86, 0);//(0x44 - GET_LNA_GAIN(pAd))); // According the Rory's suggestion to solve the middle range issue. - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0xF2); + } else { + ULONG TxPinCfg = 0x00050F05; //Gary 2007/8/9 0x050505 + + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R62, + (0x37 - GET_LNA_GAIN(pAd))); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R63, + (0x37 - GET_LNA_GAIN(pAd))); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R64, + (0x37 - GET_LNA_GAIN(pAd))); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R86, 0); //(0x44 - GET_LNA_GAIN(pAd))); // According the Rory's suggestion to solve the middle range issue. + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0xF2); // Rx High power VGA offset for LNA select - if (pAd->NicConfig2.field.ExternalLNAForA) - { + if (pAd->NicConfig2.field.ExternalLNAForA) { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x46); - } - else - { + } else { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x50); } @@ -858,16 +976,13 @@ VOID AsicSwitchChannel( RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); // Turn off unused PA or LNA when only 1T or 1R - if (pAd->Antenna.field.TxPath == 1) - { + if (pAd->Antenna.field.TxPath == 1) { TxPinCfg &= 0xFFFFFFF3; } - if (pAd->Antenna.field.RxPath == 1) - { + if (pAd->Antenna.field.RxPath == 1) { TxPinCfg &= 0xFFFFF3FF; } - RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg); } @@ -887,10 +1002,9 @@ VOID AsicSwitchChannel( RTMPusecDelay(1000); } -VOID AsicResetBBPAgent( -IN PRTMP_ADAPTER pAd) +VOID AsicResetBBPAgent(IN PRTMP_ADAPTER pAd) { - BBP_CSR_CFG_STRUC BbpCsr; + BBP_CSR_CFG_STRUC BbpCsr; DBGPRINT(RT_DEBUG_ERROR, ("Reset BBP Agent busy bit.!! \n")); // Still need to find why BBP agent keeps busy, but in fact, hardware still function ok. Now clear busy first. RTMP_IO_READ32(pAd, H2M_BBP_AGENT, &BbpCsr.word); @@ -911,17 +1025,13 @@ IN PRTMP_ADAPTER pAd) ========================================================================== */ -VOID AsicLockChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel) +VOID AsicLockChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel) { } -VOID AsicRfTuningExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +VOID AsicRfTuningExec(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) { } @@ -942,65 +1052,53 @@ VOID AsicRfTuningExec( it should be called AFTER MlmeDynamicTxRatSwitching() ========================================================================== */ -VOID AsicAdjustTxPower( - IN PRTMP_ADAPTER pAd) +VOID AsicAdjustTxPower(IN PRTMP_ADAPTER pAd) { - INT i, j; - CHAR DeltaPwr = 0; - BOOLEAN bAutoTxAgc = FALSE; - UCHAR TssiRef, *pTssiMinusBoundary, *pTssiPlusBoundary, TxAgcStep; - UCHAR BbpR1 = 0, BbpR49 = 0, idx; - PCHAR pTxAgcCompensate; - ULONG TxPwr[5]; - CHAR Value; - CHAR Rssi = -127; - - + INT i, j; + CHAR DeltaPwr = 0; + BOOLEAN bAutoTxAgc = FALSE; + UCHAR TssiRef, *pTssiMinusBoundary, *pTssiPlusBoundary, TxAgcStep; + UCHAR BbpR1 = 0, BbpR49 = 0, idx; + PCHAR pTxAgcCompensate; + ULONG TxPwr[5]; + CHAR Value; + CHAR Rssi = -127; if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) || #ifdef RTMP_MAC_PCI - (pAd->bPCIclkOff == TRUE) || + (pAd->bPCIclkOff == TRUE) || #endif // RTMP_MAC_PCI // - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) + RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF) || + RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) return; - Rssi = RTMPMaxRssi(pAd, - pAd->StaCfg.RssiSample.AvgRssi0, - pAd->StaCfg.RssiSample.AvgRssi1, - pAd->StaCfg.RssiSample.AvgRssi2); + Rssi = RTMPMaxRssi(pAd, + pAd->StaCfg.RssiSample.AvgRssi0, + pAd->StaCfg.RssiSample.AvgRssi1, + pAd->StaCfg.RssiSample.AvgRssi2); - if (pAd->CommonCfg.BBPCurrentBW == BW_40) - { - if (pAd->CommonCfg.CentralChannel > 14) - { + if (pAd->CommonCfg.BBPCurrentBW == BW_40) { + if (pAd->CommonCfg.CentralChannel > 14) { TxPwr[0] = pAd->Tx40MPwrCfgABand[0]; TxPwr[1] = pAd->Tx40MPwrCfgABand[1]; TxPwr[2] = pAd->Tx40MPwrCfgABand[2]; TxPwr[3] = pAd->Tx40MPwrCfgABand[3]; TxPwr[4] = pAd->Tx40MPwrCfgABand[4]; - } - else - { + } else { TxPwr[0] = pAd->Tx40MPwrCfgGBand[0]; TxPwr[1] = pAd->Tx40MPwrCfgGBand[1]; TxPwr[2] = pAd->Tx40MPwrCfgGBand[2]; TxPwr[3] = pAd->Tx40MPwrCfgGBand[3]; TxPwr[4] = pAd->Tx40MPwrCfgGBand[4]; } - } - else - { - if (pAd->CommonCfg.Channel > 14) - { + } else { + if (pAd->CommonCfg.Channel > 14) { TxPwr[0] = pAd->Tx20MPwrCfgABand[0]; TxPwr[1] = pAd->Tx20MPwrCfgABand[1]; TxPwr[2] = pAd->Tx20MPwrCfgABand[2]; TxPwr[3] = pAd->Tx20MPwrCfgABand[3]; TxPwr[4] = pAd->Tx20MPwrCfgABand[4]; - } - else - { + } else { TxPwr[0] = pAd->Tx20MPwrCfgGBand[0]; TxPwr[1] = pAd->Tx20MPwrCfgGBand[1]; TxPwr[2] = pAd->Tx20MPwrCfgGBand[2]; @@ -1010,31 +1108,26 @@ VOID AsicAdjustTxPower( } // TX power compensation for temperature variation based on TSSI. try every 4 second - if (pAd->Mlme.OneSecPeriodicRound % 4 == 0) - { - if (pAd->CommonCfg.Channel <= 14) - { + if (pAd->Mlme.OneSecPeriodicRound % 4 == 0) { + if (pAd->CommonCfg.Channel <= 14) { /* bg channel */ - bAutoTxAgc = pAd->bAutoTxAgcG; - TssiRef = pAd->TssiRefG; + bAutoTxAgc = pAd->bAutoTxAgcG; + TssiRef = pAd->TssiRefG; pTssiMinusBoundary = &pAd->TssiMinusBoundaryG[0]; - pTssiPlusBoundary = &pAd->TssiPlusBoundaryG[0]; - TxAgcStep = pAd->TxAgcStepG; - pTxAgcCompensate = &pAd->TxAgcCompensateG; - } - else - { + pTssiPlusBoundary = &pAd->TssiPlusBoundaryG[0]; + TxAgcStep = pAd->TxAgcStepG; + pTxAgcCompensate = &pAd->TxAgcCompensateG; + } else { /* a channel */ - bAutoTxAgc = pAd->bAutoTxAgcA; - TssiRef = pAd->TssiRefA; + bAutoTxAgc = pAd->bAutoTxAgcA; + TssiRef = pAd->TssiRefA; pTssiMinusBoundary = &pAd->TssiMinusBoundaryA[0]; - pTssiPlusBoundary = &pAd->TssiPlusBoundaryA[0]; - TxAgcStep = pAd->TxAgcStepA; - pTxAgcCompensate = &pAd->TxAgcCompensateA; + pTssiPlusBoundary = &pAd->TssiPlusBoundaryA[0]; + TxAgcStep = pAd->TxAgcStepA; + pTxAgcCompensate = &pAd->TxAgcCompensateA; } - if (bAutoTxAgc) - { + if (bAutoTxAgc) { /* BbpR1 is unsigned char */ RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R49, &BbpR49); @@ -1051,59 +1144,50 @@ VOID AsicAdjustTxPower( /* if value is between p1 ~ o1 or o1 ~ s1, no need to adjust tx power */ /* if value is 0xa5, tx power will be -= TxAgcStep*(2-1) */ - if (BbpR49 > pTssiMinusBoundary[1]) - { + if (BbpR49 > pTssiMinusBoundary[1]) { // Reading is larger than the reference value // check for how large we need to decrease the Tx power - for (idx = 1; idx < 5; idx++) - { - if (BbpR49 <= pTssiMinusBoundary[idx]) // Found the range + for (idx = 1; idx < 5; idx++) { + if (BbpR49 <= pTssiMinusBoundary[idx]) // Found the range break; } // The index is the step we should decrease, idx = 0 means there is nothing to compensate -// if (R3 > (ULONG) (TxAgcStep * (idx-1))) - *pTxAgcCompensate = -(TxAgcStep * (idx-1)); -// else -// *pTxAgcCompensate = -((UCHAR)R3); +// if (R3 > (ULONG) (TxAgcStep * (idx-1))) + *pTxAgcCompensate = -(TxAgcStep * (idx - 1)); +// else +// *pTxAgcCompensate = -((UCHAR)R3); DeltaPwr += (*pTxAgcCompensate); - DBGPRINT(RT_DEBUG_TRACE, ("-- Tx Power, BBP R1=%x, TssiRef=%x, TxAgcStep=%x, step = -%d\n", - BbpR49, TssiRef, TxAgcStep, idx-1)); - } - else if (BbpR49 < pTssiPlusBoundary[1]) - { + DBGPRINT(RT_DEBUG_TRACE, + ("-- Tx Power, BBP R1=%x, TssiRef=%x, TxAgcStep=%x, step = -%d\n", + BbpR49, TssiRef, TxAgcStep, idx - 1)); + } else if (BbpR49 < pTssiPlusBoundary[1]) { // Reading is smaller than the reference value // check for how large we need to increase the Tx power - for (idx = 1; idx < 5; idx++) - { - if (BbpR49 >= pTssiPlusBoundary[idx]) // Found the range + for (idx = 1; idx < 5; idx++) { + if (BbpR49 >= pTssiPlusBoundary[idx]) // Found the range break; } // The index is the step we should increase, idx = 0 means there is nothing to compensate - *pTxAgcCompensate = TxAgcStep * (idx-1); + *pTxAgcCompensate = TxAgcStep * (idx - 1); DeltaPwr += (*pTxAgcCompensate); - DBGPRINT(RT_DEBUG_TRACE, ("++ Tx Power, BBP R1=%x, TssiRef=%x, TxAgcStep=%x, step = +%d\n", - BbpR49, TssiRef, TxAgcStep, idx-1)); - } - else - { + DBGPRINT(RT_DEBUG_TRACE, + ("++ Tx Power, BBP R1=%x, TssiRef=%x, TxAgcStep=%x, step = +%d\n", + BbpR49, TssiRef, TxAgcStep, idx - 1)); + } else { *pTxAgcCompensate = 0; - DBGPRINT(RT_DEBUG_TRACE, (" Tx Power, BBP R49=%x, TssiRef=%x, TxAgcStep=%x, step = +%d\n", - BbpR49, TssiRef, TxAgcStep, 0)); + DBGPRINT(RT_DEBUG_TRACE, + (" Tx Power, BBP R49=%x, TssiRef=%x, TxAgcStep=%x, step = +%d\n", + BbpR49, TssiRef, TxAgcStep, 0)); } } - } - else - { - if (pAd->CommonCfg.Channel <= 14) - { - bAutoTxAgc = pAd->bAutoTxAgcG; - pTxAgcCompensate = &pAd->TxAgcCompensateG; - } - else - { - bAutoTxAgc = pAd->bAutoTxAgcA; - pTxAgcCompensate = &pAd->TxAgcCompensateA; + } else { + if (pAd->CommonCfg.Channel <= 14) { + bAutoTxAgc = pAd->bAutoTxAgcG; + pTxAgcCompensate = &pAd->TxAgcCompensateG; + } else { + bAutoTxAgc = pAd->bAutoTxAgcA; + pTxAgcCompensate = &pAd->TxAgcCompensateA; } if (bAutoTxAgc) @@ -1113,46 +1197,35 @@ VOID AsicAdjustTxPower( RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &BbpR1); BbpR1 &= 0xFC; - /* calculate delta power based on the percentage specified from UI */ // E2PROM setting is calibrated for maximum TX power (i.e. 100%) // We lower TX power here according to the percentage specified from UI - if (pAd->CommonCfg.TxPowerPercentage == 0xffffffff) // AUTO TX POWER control + if (pAd->CommonCfg.TxPowerPercentage == 0xffffffff) // AUTO TX POWER control { { // to patch high power issue with some APs, like Belkin N1. - if (Rssi > -35) - { - BbpR1 |= 0x02; // DeltaPwr -= 12; - } - else if (Rssi > -40) - { - BbpR1 |= 0x01; // DeltaPwr -= 6; - } - else - ; + if (Rssi > -35) { + BbpR1 |= 0x02; // DeltaPwr -= 12; + } else if (Rssi > -40) { + BbpR1 |= 0x01; // DeltaPwr -= 6; + } else; } - } - else if (pAd->CommonCfg.TxPowerPercentage > 90) // 91 ~ 100% & AUTO, treat as 100% in terms of mW + } else if (pAd->CommonCfg.TxPowerPercentage > 90) // 91 ~ 100% & AUTO, treat as 100% in terms of mW ; - else if (pAd->CommonCfg.TxPowerPercentage > 60) // 61 ~ 90%, treat as 75% in terms of mW // DeltaPwr -= 1; + else if (pAd->CommonCfg.TxPowerPercentage > 60) // 61 ~ 90%, treat as 75% in terms of mW // DeltaPwr -= 1; { DeltaPwr -= 1; - } - else if (pAd->CommonCfg.TxPowerPercentage > 30) // 31 ~ 60%, treat as 50% in terms of mW // DeltaPwr -= 3; + } else if (pAd->CommonCfg.TxPowerPercentage > 30) // 31 ~ 60%, treat as 50% in terms of mW // DeltaPwr -= 3; { DeltaPwr -= 3; - } - else if (pAd->CommonCfg.TxPowerPercentage > 15) // 16 ~ 30%, treat as 25% in terms of mW // DeltaPwr -= 6; + } else if (pAd->CommonCfg.TxPowerPercentage > 15) // 16 ~ 30%, treat as 25% in terms of mW // DeltaPwr -= 6; { BbpR1 |= 0x01; - } - else if (pAd->CommonCfg.TxPowerPercentage > 9) // 10 ~ 15%, treat as 12.5% in terms of mW // DeltaPwr -= 9; + } else if (pAd->CommonCfg.TxPowerPercentage > 9) // 10 ~ 15%, treat as 12.5% in terms of mW // DeltaPwr -= 9; { BbpR1 |= 0x01; DeltaPwr -= 3; - } - else // 0 ~ 9 %, treat as MIN(~3%) in terms of mW // DeltaPwr -= 12; + } else // 0 ~ 9 %, treat as MIN(~3%) in terms of mW // DeltaPwr -= 12; { BbpR1 |= 0x02; } @@ -1160,45 +1233,38 @@ VOID AsicAdjustTxPower( RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R1, BbpR1); /* reset different new tx power for different TX rate */ - for(i=0; i<5; i++) - { - if (TxPwr[i] != 0xffffffff) - { - for (j=0; j<8; j++) - { - Value = (CHAR)((TxPwr[i] >> j*4) & 0x0F); /* 0 ~ 15 */ - - if ((Value + DeltaPwr) < 0) - { - Value = 0; /* min */ - } - else if ((Value + DeltaPwr) > 0xF) - { - Value = 0xF; /* max */ - } - else - { - Value += DeltaPwr; /* temperature compensation */ + for (i = 0; i < 5; i++) { + if (TxPwr[i] != 0xffffffff) { + for (j = 0; j < 8; j++) { + Value = (CHAR) ((TxPwr[i] >> j * 4) & 0x0F); /* 0 ~ 15 */ + + if ((Value + DeltaPwr) < 0) { + Value = 0; /* min */ + } else if ((Value + DeltaPwr) > 0xF) { + Value = 0xF; /* max */ + } else { + Value += DeltaPwr; /* temperature compensation */ } /* fill new value to CSR offset */ - TxPwr[i] = (TxPwr[i] & ~(0x0000000F << j*4)) | (Value << j*4); + TxPwr[i] = + (TxPwr[i] & ~(0x0000000F << j * 4)) | (Value + << j + * 4); } /* write tx power value to CSR */ - /* TX_PWR_CFG_0 (8 tx rate) for TX power for OFDM 12M/18M - TX power for OFDM 6M/9M - TX power for CCK5.5M/11M - TX power for CCK1M/2M */ + /* TX_PWR_CFG_0 (8 tx rate) for TX power for OFDM 12M/18M + TX power for OFDM 6M/9M + TX power for CCK5.5M/11M + TX power for CCK1M/2M */ /* TX_PWR_CFG_1 ~ TX_PWR_CFG_4 */ - RTMP_IO_WRITE32(pAd, TX_PWR_CFG_0 + i*4, TxPwr[i]); + RTMP_IO_WRITE32(pAd, TX_PWR_CFG_0 + i * 4, TxPwr[i]); } } - } - /* ========================================================================== Description: @@ -1211,9 +1277,8 @@ VOID AsicAdjustTxPower( ========================================================================== */ -VOID AsicSleepThenAutoWakeup( - IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp) +VOID AsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, + IN USHORT TbttNumToNextWakeUp) { RTMP_STA_SLEEP_THEN_AUTO_WAKEUP(pAd, TbttNumToNextWakeUp); } @@ -1226,8 +1291,7 @@ VOID AsicSleepThenAutoWakeup( in INFRA BSS, we should use AsicSleepThenAutoWakeup() instead. ========================================================================== */ -VOID AsicForceSleep( - IN PRTMP_ADAPTER pAd) +VOID AsicForceSleep(IN PRTMP_ADAPTER pAd) { } @@ -1242,15 +1306,12 @@ VOID AsicForceSleep( IRQL = DISPATCH_LEVEL ========================================================================== */ -VOID AsicForceWakeup( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bFromTx) +VOID AsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) { - DBGPRINT(RT_DEBUG_INFO, ("--> AsicForceWakeup \n")); - RTMP_STA_FORCE_WAKEUP(pAd, bFromTx); + DBGPRINT(RT_DEBUG_INFO, ("--> AsicForceWakeup \n")); + RTMP_STA_FORCE_WAKEUP(pAd, bFromTx); } - /* ========================================================================== Description: @@ -1260,36 +1321,33 @@ VOID AsicForceWakeup( ========================================================================== */ -VOID AsicSetBssid( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pBssid) +VOID AsicSetBssid(IN PRTMP_ADAPTER pAd, IN PUCHAR pBssid) { - ULONG Addr4; - DBGPRINT(RT_DEBUG_TRACE, ("==============> AsicSetBssid %x:%x:%x:%x:%x:%x\n", - pBssid[0],pBssid[1],pBssid[2],pBssid[3], pBssid[4],pBssid[5])); - - Addr4 = (ULONG)(pBssid[0]) | - (ULONG)(pBssid[1] << 8) | - (ULONG)(pBssid[2] << 16) | - (ULONG)(pBssid[3] << 24); + ULONG Addr4; + DBGPRINT(RT_DEBUG_TRACE, + ("==============> AsicSetBssid %x:%x:%x:%x:%x:%x\n", pBssid[0], + pBssid[1], pBssid[2], pBssid[3], pBssid[4], pBssid[5])); + + Addr4 = (ULONG) (pBssid[0]) | + (ULONG) (pBssid[1] << 8) | + (ULONG) (pBssid[2] << 16) | (ULONG) (pBssid[3] << 24); RTMP_IO_WRITE32(pAd, MAC_BSSID_DW0, Addr4); Addr4 = 0; // always one BSSID in STA mode - Addr4 = (ULONG)(pBssid[4]) | (ULONG)(pBssid[5] << 8); + Addr4 = (ULONG) (pBssid[4]) | (ULONG) (pBssid[5] << 8); RTMP_IO_WRITE32(pAd, MAC_BSSID_DW1, Addr4); } -VOID AsicSetMcastWC( - IN PRTMP_ADAPTER pAd) +VOID AsicSetMcastWC(IN PRTMP_ADAPTER pAd) { MAC_TABLE_ENTRY *pEntry = &pAd->MacTab.Content[MCAST_WCID]; - USHORT offset; + USHORT offset; - pEntry->Sst = SST_ASSOC; - pEntry->Aid = MCAST_WCID; // Softap supports 1 BSSID and use WCID=0 as multicast Wcid index - pEntry->PsMode = PWR_ACTIVE; + pEntry->Sst = SST_ASSOC; + pEntry->Aid = MCAST_WCID; // Softap supports 1 BSSID and use WCID=0 as multicast Wcid index + pEntry->PsMode = PWR_ACTIVE; pEntry->CurrTxRate = pAd->CommonCfg.MlmeRate; offset = MAC_WCID_BASE + BSS0Mcast_WCID * HW_WCID_ENTRY_SIZE; } @@ -1302,14 +1360,12 @@ VOID AsicSetMcastWC( ========================================================================== */ -VOID AsicDelWcidTab( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid) +VOID AsicDelWcidTab(IN PRTMP_ADAPTER pAd, IN UCHAR Wcid) { - ULONG Addr0 = 0x0, Addr1 = 0x0; - ULONG offset; + ULONG Addr0 = 0x0, Addr1 = 0x0; + ULONG offset; - DBGPRINT(RT_DEBUG_TRACE, ("AsicDelWcidTab==>Wcid = 0x%x\n",Wcid)); + DBGPRINT(RT_DEBUG_TRACE, ("AsicDelWcidTab==>Wcid = 0x%x\n", Wcid)); offset = MAC_WCID_BASE + Wcid * HW_WCID_ENTRY_SIZE; RTMP_IO_WRITE32(pAd, offset, Addr0); offset += 4; @@ -1324,19 +1380,18 @@ VOID AsicDelWcidTab( ========================================================================== */ -VOID AsicEnableRDG( - IN PRTMP_ADAPTER pAd) +VOID AsicEnableRDG(IN PRTMP_ADAPTER pAd) { - TX_LINK_CFG_STRUC TxLinkCfg; - UINT32 Data = 0; + TX_LINK_CFG_STRUC TxLinkCfg; + UINT32 Data = 0; RTMP_IO_READ32(pAd, TX_LINK_CFG, &TxLinkCfg.word); TxLinkCfg.field.TxRDGEn = 1; RTMP_IO_WRITE32(pAd, TX_LINK_CFG, TxLinkCfg.word); RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &Data); - Data &= 0xFFFFFF00; - Data |= 0x80; + Data &= 0xFFFFFF00; + Data |= 0x80; RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Data); //OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); @@ -1350,12 +1405,10 @@ VOID AsicEnableRDG( ========================================================================== */ -VOID AsicDisableRDG( - IN PRTMP_ADAPTER pAd) +VOID AsicDisableRDG(IN PRTMP_ADAPTER pAd) { - TX_LINK_CFG_STRUC TxLinkCfg; - UINT32 Data = 0; - + TX_LINK_CFG_STRUC TxLinkCfg; + UINT32 Data = 0; RTMP_IO_READ32(pAd, TX_LINK_CFG, &TxLinkCfg.word); TxLinkCfg.field.TxRDGEn = 0; @@ -1363,19 +1416,18 @@ VOID AsicDisableRDG( RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &Data); - Data &= 0xFFFFFF00; + Data &= 0xFFFFFF00; //Data |= 0x20; #ifndef WIFI_TEST //if ( pAd->CommonCfg.bEnableTxBurst ) - // Data |= 0x60; // for performance issue not set the TXOP to 0 + // Data |= 0x60; // for performance issue not set the TXOP to 0 #endif if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_DYNAMIC_BE_TXOP_ACTIVE) - && (pAd->MacTab.fAnyStationMIMOPSDynamic == FALSE) - ) - { + && (pAd->MacTab.fAnyStationMIMOPSDynamic == FALSE) + ) { // For CWC test, change txop from 0x30 to 0x20 in TxBurst mode if (pAd->CommonCfg.bEnableTxBurst) - Data |= 0x20; + Data |= 0x20; } RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Data); } @@ -1389,16 +1441,15 @@ VOID AsicDisableRDG( ========================================================================== */ -VOID AsicDisableSync( - IN PRTMP_ADAPTER pAd) +VOID AsicDisableSync(IN PRTMP_ADAPTER pAd) { BCN_TIME_CFG_STRUC csr; DBGPRINT(RT_DEBUG_TRACE, ("--->Disable TSF synchronization\n")); // 2003-12-20 disable TSF and TBTT while NIC in power-saving have side effect - // that NIC will never wakes up because TSF stops and no more - // TBTT interrupts + // that NIC will never wakes up because TSF stops and no more + // TBTT interrupts pAd->TbttTickCount = 0; RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr.word); csr.field.bBeaconGen = 0; @@ -1417,20 +1468,19 @@ VOID AsicDisableSync( ========================================================================== */ -VOID AsicEnableBssSync( - IN PRTMP_ADAPTER pAd) +VOID AsicEnableBssSync(IN PRTMP_ADAPTER pAd) { BCN_TIME_CFG_STRUC csr; DBGPRINT(RT_DEBUG_TRACE, ("--->AsicEnableBssSync(INFRA mode)\n")); RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr.word); -// RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, 0x00000000); +// RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, 0x00000000); { - csr.field.BeaconInterval = pAd->CommonCfg.BeaconPeriod << 4; // ASIC register in units of 1/16 TU + csr.field.BeaconInterval = pAd->CommonCfg.BeaconPeriod << 4; // ASIC register in units of 1/16 TU csr.field.bTsfTicking = 1; - csr.field.TsfSyncMode = 1; // sync TSF in INFRASTRUCTURE mode - csr.field.bBeaconGen = 0; // do NOT generate BEACON + csr.field.TsfSyncMode = 1; // sync TSF in INFRASTRUCTURE mode + csr.field.bBeaconGen = 0; // do NOT generate BEACON csr.field.bTBTTEnable = 1; } RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr.word); @@ -1448,14 +1498,15 @@ VOID AsicEnableBssSync( ========================================================================== */ -VOID AsicEnableIbssSync( - IN PRTMP_ADAPTER pAd) +VOID AsicEnableIbssSync(IN PRTMP_ADAPTER pAd) { BCN_TIME_CFG_STRUC csr9; - PUCHAR ptr; + PUCHAR ptr; UINT i; - DBGPRINT(RT_DEBUG_TRACE, ("--->AsicEnableIbssSync(ADHOC mode. MPDUtotalByteCount = %d)\n", pAd->BeaconTxWI.MPDUtotalByteCount)); + DBGPRINT(RT_DEBUG_TRACE, + ("--->AsicEnableIbssSync(ADHOC mode. MPDUtotalByteCount = %d)\n", + pAd->BeaconTxWI.MPDUtotalByteCount)); RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr9.word); csr9.field.bBeaconGen = 0; @@ -1465,27 +1516,30 @@ VOID AsicEnableIbssSync( #ifdef RTMP_MAC_PCI // move BEACON TXD and frame content to on-chip memory - ptr = (PUCHAR)&pAd->BeaconTxWI; - for (i=0; iBeaconTxWI; + for (i = 0; i < TXWI_SIZE; i += 4) // 16-byte TXWI field { - UINT32 longptr = *ptr + (*(ptr+1)<<8) + (*(ptr+2)<<16) + (*(ptr+3)<<24); + UINT32 longptr = + *ptr + (*(ptr + 1) << 8) + (*(ptr + 2) << 16) + + (*(ptr + 3) << 24); RTMP_IO_WRITE32(pAd, HW_BEACON_BASE0 + i, longptr); ptr += 4; } // start right after the 16-byte TXWI field ptr = pAd->BeaconBuf; - for (i=0; i< pAd->BeaconTxWI.MPDUtotalByteCount; i+=4) - { - UINT32 longptr = *ptr + (*(ptr+1)<<8) + (*(ptr+2)<<16) + (*(ptr+3)<<24); + for (i = 0; i < pAd->BeaconTxWI.MPDUtotalByteCount; i += 4) { + UINT32 longptr = + *ptr + (*(ptr + 1) << 8) + (*(ptr + 2) << 16) + + (*(ptr + 3) << 24); RTMP_IO_WRITE32(pAd, HW_BEACON_BASE0 + TXWI_SIZE + i, longptr); - ptr +=4; + ptr += 4; } #endif // RTMP_MAC_PCI // #ifdef RTMP_MAC_USB // move BEACON TXD and frame content to on-chip memory - ptr = (PUCHAR)&pAd->BeaconTxWI; - for (i=0; iBeaconTxWI; + for (i = 0; i < TXWI_SIZE; i += 2) // 16-byte TXWI field { //UINT32 longptr = *ptr + (*(ptr+1)<<8) + (*(ptr+2)<<16) + (*(ptr+3)<<24); //RTMP_IO_WRITE32(pAd, HW_BEACON_BASE0 + i, longptr); @@ -1495,12 +1549,11 @@ VOID AsicEnableIbssSync( // start right after the 16-byte TXWI field ptr = pAd->BeaconBuf; - for (i=0; i< pAd->BeaconTxWI.MPDUtotalByteCount; i+=2) - { + for (i = 0; i < pAd->BeaconTxWI.MPDUtotalByteCount; i += 2) { //UINT32 longptr = *ptr + (*(ptr+1)<<8) + (*(ptr+2)<<16) + (*(ptr+3)<<24); //RTMP_IO_WRITE32(pAd, HW_BEACON_BASE0 + TXWI_SIZE + i, longptr); RTUSBMultiWrite(pAd, HW_BEACON_BASE0 + TXWI_SIZE + i, ptr, 2); - ptr +=2; + ptr += 2; } #endif // RTMP_MAC_USB // @@ -1511,9 +1564,9 @@ VOID AsicEnableIbssSync( //RTMP_IO_WRITE32(pAd, TBTT_SYNC_CFG, 0x00001010); // start sending BEACON - csr9.field.BeaconInterval = pAd->CommonCfg.BeaconPeriod << 4; // ASIC register in units of 1/16 TU + csr9.field.BeaconInterval = pAd->CommonCfg.BeaconPeriod << 4; // ASIC register in units of 1/16 TU csr9.field.bTsfTicking = 1; - csr9.field.TsfSyncMode = 2; // sync TSF in IBSS mode + csr9.field.TsfSyncMode = 2; // sync TSF in IBSS mode csr9.field.bTBTTEnable = 1; csr9.field.bBeaconGen = 1; RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr9.word); @@ -1528,45 +1581,42 @@ VOID AsicEnableIbssSync( ========================================================================== */ -VOID AsicSetEdcaParm( - IN PRTMP_ADAPTER pAd, - IN PEDCA_PARM pEdcaParm) +VOID AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm) { - EDCA_AC_CFG_STRUC Ac0Cfg, Ac1Cfg, Ac2Cfg, Ac3Cfg; + EDCA_AC_CFG_STRUC Ac0Cfg, Ac1Cfg, Ac2Cfg, Ac3Cfg; AC_TXOP_CSR0_STRUC csr0; AC_TXOP_CSR1_STRUC csr1; - AIFSN_CSR_STRUC AifsnCsr; - CWMIN_CSR_STRUC CwminCsr; - CWMAX_CSR_STRUC CwmaxCsr; + AIFSN_CSR_STRUC AifsnCsr; + CWMIN_CSR_STRUC CwminCsr; + CWMAX_CSR_STRUC CwmaxCsr; int i; Ac0Cfg.word = 0; Ac1Cfg.word = 0; Ac2Cfg.word = 0; Ac3Cfg.word = 0; - if ((pEdcaParm == NULL) || (pEdcaParm->bValid == FALSE)) - { - DBGPRINT(RT_DEBUG_TRACE,("AsicSetEdcaParm\n")); + if ((pEdcaParm == NULL) || (pEdcaParm->bValid == FALSE)) { + DBGPRINT(RT_DEBUG_TRACE, ("AsicSetEdcaParm\n")); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_WMM_INUSED); - for (i=0; iMacTab.Content[i].ValidAsCLI || pAd->MacTab.Content[i].ValidAsApCli) - CLIENT_STATUS_CLEAR_FLAG(&pAd->MacTab.Content[i], fCLIENT_STATUS_WMM_CAPABLE); + for (i = 0; i < MAX_LEN_OF_MAC_TABLE; i++) { + if (pAd->MacTab.Content[i].ValidAsCLI + || pAd->MacTab.Content[i].ValidAsApCli) + CLIENT_STATUS_CLEAR_FLAG(&pAd->MacTab. + Content[i], + fCLIENT_STATUS_WMM_CAPABLE); } //======================================================== // MAC Register has a copy . //======================================================== //#ifndef WIFI_TEST - if( pAd->CommonCfg.bEnableTxBurst ) - { + if (pAd->CommonCfg.bEnableTxBurst) { // For CWC test, change txop from 0x30 to 0x20 in TxBurst mode - Ac0Cfg.field.AcTxop = 0x20; // Suggest by John for TxBurst in HT Mode - } - else + Ac0Cfg.field.AcTxop = 0x20; // Suggest by John for TxBurst in HT Mode + } else Ac0Cfg.field.AcTxop = 0; // QID_AC_BE //#else -// Ac0Cfg.field.AcTxop = 0; // QID_AC_BE +// Ac0Cfg.field.AcTxop = 0; // QID_AC_BE //#endif Ac0Cfg.field.Cwmin = CW_MIN_IN_BITS; Ac0Cfg.field.Cwmax = CW_MAX_IN_BITS; @@ -1579,13 +1629,10 @@ VOID AsicSetEdcaParm( Ac1Cfg.field.Aifsn = 2; RTMP_IO_WRITE32(pAd, EDCA_AC1_CFG, Ac1Cfg.word); - if (pAd->CommonCfg.PhyMode == PHY_11B) - { + if (pAd->CommonCfg.PhyMode == PHY_11B) { Ac2Cfg.field.AcTxop = 192; // AC_VI: 192*32us ~= 6ms Ac3Cfg.field.AcTxop = 96; // AC_VO: 96*32us ~= 3ms - } - else - { + } else { Ac2Cfg.field.AcTxop = 96; // AC_VI: 96*32us ~= 3ms Ac3Cfg.field.AcTxop = 48; // AC_VO: 48*32us ~= 1.5ms } @@ -1601,18 +1648,15 @@ VOID AsicSetEdcaParm( //======================================================== // DMA Register has a copy too. //======================================================== - csr0.field.Ac0Txop = 0; // QID_AC_BE - csr0.field.Ac1Txop = 0; // QID_AC_BK + csr0.field.Ac0Txop = 0; // QID_AC_BE + csr0.field.Ac1Txop = 0; // QID_AC_BK RTMP_IO_WRITE32(pAd, WMM_TXOP0_CFG, csr0.word); - if (pAd->CommonCfg.PhyMode == PHY_11B) - { - csr1.field.Ac2Txop = 192; // AC_VI: 192*32us ~= 6ms - csr1.field.Ac3Txop = 96; // AC_VO: 96*32us ~= 3ms - } - else - { - csr1.field.Ac2Txop = 96; // AC_VI: 96*32us ~= 3ms - csr1.field.Ac3Txop = 48; // AC_VO: 48*32us ~= 1.5ms + if (pAd->CommonCfg.PhyMode == PHY_11B) { + csr1.field.Ac2Txop = 192; // AC_VI: 192*32us ~= 6ms + csr1.field.Ac3Txop = 96; // AC_VO: 96*32us ~= 3ms + } else { + csr1.field.Ac2Txop = 96; // AC_VI: 96*32us ~= 3ms + csr1.field.Ac3Txop = 48; // AC_VO: 48*32us ~= 1.5ms } RTMP_IO_WRITE32(pAd, WMM_TXOP1_CFG, csr1.word); @@ -1633,9 +1677,7 @@ VOID AsicSetEdcaParm( RTMP_IO_WRITE32(pAd, WMM_AIFSN_CFG, 0x00002222); NdisZeroMemory(&pAd->CommonCfg.APEdcaParm, sizeof(EDCA_PARM)); - } - else - { + } else { OPSTATUS_SET_FLAG(pAd, fOP_STATUS_WMM_INUSED); //======================================================== // MAC Register has a copy. @@ -1646,26 +1688,23 @@ VOID AsicSetEdcaParm( // //pEdcaParm->Txop[QID_AC_VI] = pEdcaParm->Txop[QID_AC_VI] * 7 / 10; // rt2860c need this - Ac0Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BE]; - Ac0Cfg.field.Cwmin= pEdcaParm->Cwmin[QID_AC_BE]; + Ac0Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BE]; + Ac0Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_BE]; Ac0Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_BE]; - Ac0Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BE]; //+1; + Ac0Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BE]; //+1; - Ac1Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BK]; - Ac1Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_BK]; //+2; + Ac1Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BK]; + Ac1Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_BK]; //+2; Ac1Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_BK]; - Ac1Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BK]; //+1; + Ac1Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BK]; //+1; Ac2Cfg.field.AcTxop = (pEdcaParm->Txop[QID_AC_VI] * 6) / 10; - if(pAd->Antenna.field.TxPath == 1) - { + if (pAd->Antenna.field.TxPath == 1) { Ac2Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_VI] + 1; Ac2Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_VI] + 1; - } - else - { - Ac2Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_VI]; - Ac2Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_VI]; + } else { + Ac2Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_VI]; + Ac2Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_VI]; } Ac2Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_VI] + 1; #ifdef RTMP_MAC_USB @@ -1675,20 +1714,19 @@ VOID AsicSetEdcaParm( { // Tuning for Wi-Fi WMM S06 if (pAd->CommonCfg.bWiFiTest && - pEdcaParm->Aifsn[QID_AC_VI] == 10) + pEdcaParm->Aifsn[QID_AC_VI] == 10) Ac2Cfg.field.Aifsn -= 1; // Tuning for TGn Wi-Fi 5.2.32 // STA TestBed changes in this item: conexant legacy sta ==> broadcom 11n sta if (STA_TGN_WIFI_ON(pAd) && - pEdcaParm->Aifsn[QID_AC_VI] == 10) - { + pEdcaParm->Aifsn[QID_AC_VI] == 10) { Ac0Cfg.field.Aifsn = 3; Ac2Cfg.field.AcTxop = 5; } #ifdef RT30xx - if (pAd->RfIcType == RFIC_3020 || pAd->RfIcType == RFIC_2020) - { + if (pAd->RfIcType == RFIC_3020 + || pAd->RfIcType == RFIC_2020) { // Tuning for WiFi WMM S3-T07: connexant legacy sta ==> broadcom 11n sta. Ac2Cfg.field.Aifsn = 5; } @@ -1701,16 +1739,19 @@ VOID AsicSetEdcaParm( Ac3Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_VO]; //#ifdef WIFI_TEST - if (pAd->CommonCfg.bWiFiTest) - { - if (Ac3Cfg.field.AcTxop == 102) - { - Ac0Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BE] ? pEdcaParm->Txop[QID_AC_BE] : 10; - Ac0Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BE]-1; /* AIFSN must >= 1 */ - Ac1Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BK]; - Ac1Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BK]; - Ac2Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_VI]; - } /* End of if */ + if (pAd->CommonCfg.bWiFiTest) { + if (Ac3Cfg.field.AcTxop == 102) { + Ac0Cfg.field.AcTxop = + pEdcaParm->Txop[QID_AC_BE] ? pEdcaParm-> + Txop[QID_AC_BE] : 10; + Ac0Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BE] - 1; /* AIFSN must >= 1 */ + Ac1Cfg.field.AcTxop = + pEdcaParm->Txop[QID_AC_BK]; + Ac1Cfg.field.Aifsn = + pEdcaParm->Aifsn[QID_AC_BK]; + Ac2Cfg.field.AcTxop = + pEdcaParm->Txop[QID_AC_VI]; + } /* End of if */ } //#endif // WIFI_TEST // @@ -1719,7 +1760,6 @@ VOID AsicSetEdcaParm( RTMP_IO_WRITE32(pAd, EDCA_AC2_CFG, Ac2Cfg.word); RTMP_IO_WRITE32(pAd, EDCA_AC3_CFG, Ac3Cfg.word); - //======================================================== // DMA Register has a copy too. //======================================================== @@ -1735,7 +1775,7 @@ VOID AsicSetEdcaParm( CwminCsr.field.Cwmin0 = pEdcaParm->Cwmin[QID_AC_BE]; CwminCsr.field.Cwmin1 = pEdcaParm->Cwmin[QID_AC_BK]; CwminCsr.field.Cwmin2 = pEdcaParm->Cwmin[QID_AC_VI]; - CwminCsr.field.Cwmin3 = pEdcaParm->Cwmin[QID_AC_VO] - 1; //for TGn wifi test + CwminCsr.field.Cwmin3 = pEdcaParm->Cwmin[QID_AC_VO] - 1; //for TGn wifi test RTMP_IO_WRITE32(pAd, WMM_CWMIN_CFG, CwminCsr.word); CwmaxCsr.word = 0; @@ -1746,69 +1786,68 @@ VOID AsicSetEdcaParm( RTMP_IO_WRITE32(pAd, WMM_CWMAX_CFG, CwmaxCsr.word); AifsnCsr.word = 0; - AifsnCsr.field.Aifsn0 = Ac0Cfg.field.Aifsn; //pEdcaParm->Aifsn[QID_AC_BE]; - AifsnCsr.field.Aifsn1 = Ac1Cfg.field.Aifsn; //pEdcaParm->Aifsn[QID_AC_BK]; - AifsnCsr.field.Aifsn2 = Ac2Cfg.field.Aifsn; //pEdcaParm->Aifsn[QID_AC_VI]; + AifsnCsr.field.Aifsn0 = Ac0Cfg.field.Aifsn; //pEdcaParm->Aifsn[QID_AC_BE]; + AifsnCsr.field.Aifsn1 = Ac1Cfg.field.Aifsn; //pEdcaParm->Aifsn[QID_AC_BK]; + AifsnCsr.field.Aifsn2 = Ac2Cfg.field.Aifsn; //pEdcaParm->Aifsn[QID_AC_VI]; { // Tuning for Wi-Fi WMM S06 if (pAd->CommonCfg.bWiFiTest && - pEdcaParm->Aifsn[QID_AC_VI] == 10) + pEdcaParm->Aifsn[QID_AC_VI] == 10) AifsnCsr.field.Aifsn2 = Ac2Cfg.field.Aifsn - 4; // Tuning for TGn Wi-Fi 5.2.32 // STA TestBed changes in this item: connexant legacy sta ==> broadcom 11n sta if (STA_TGN_WIFI_ON(pAd) && - pEdcaParm->Aifsn[QID_AC_VI] == 10) - { + pEdcaParm->Aifsn[QID_AC_VI] == 10) { AifsnCsr.field.Aifsn0 = 3; AifsnCsr.field.Aifsn2 = 7; } if (INFRA_ON(pAd)) - CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[BSSID_WCID], fCLIENT_STATUS_WMM_CAPABLE); + CLIENT_STATUS_SET_FLAG(&pAd->MacTab. + Content[BSSID_WCID], + fCLIENT_STATUS_WMM_CAPABLE); } { - AifsnCsr.field.Aifsn3 = Ac3Cfg.field.Aifsn - 1; //pEdcaParm->Aifsn[QID_AC_VO]; //for TGn wifi test + AifsnCsr.field.Aifsn3 = Ac3Cfg.field.Aifsn - 1; //pEdcaParm->Aifsn[QID_AC_VO]; //for TGn wifi test #ifdef RT30xx // TODO: Shiang, this modification also suitable for RT3052/RT3050 ??? - if (pAd->RfIcType == RFIC_3020 || pAd->RfIcType == RFIC_2020) - { - AifsnCsr.field.Aifsn2 = 0x2; //pEdcaParm->Aifsn[QID_AC_VI]; //for WiFi WMM S4-T04. + if (pAd->RfIcType == RFIC_3020 + || pAd->RfIcType == RFIC_2020) { + AifsnCsr.field.Aifsn2 = 0x2; //pEdcaParm->Aifsn[QID_AC_VI]; //for WiFi WMM S4-T04. } #endif // RT30xx // } RTMP_IO_WRITE32(pAd, WMM_AIFSN_CFG, AifsnCsr.word); - NdisMoveMemory(&pAd->CommonCfg.APEdcaParm, pEdcaParm, sizeof(EDCA_PARM)); - if (!ADHOC_ON(pAd)) - { - DBGPRINT(RT_DEBUG_TRACE,("EDCA [#%d]: AIFSN CWmin CWmax TXOP(us) ACM\n", pEdcaParm->EdcaUpdateCount)); - DBGPRINT(RT_DEBUG_TRACE,(" AC_BE %2d %2d %2d %4d %d\n", - pEdcaParm->Aifsn[0], - pEdcaParm->Cwmin[0], - pEdcaParm->Cwmax[0], - pEdcaParm->Txop[0]<<5, - pEdcaParm->bACM[0])); - DBGPRINT(RT_DEBUG_TRACE,(" AC_BK %2d %2d %2d %4d %d\n", - pEdcaParm->Aifsn[1], - pEdcaParm->Cwmin[1], - pEdcaParm->Cwmax[1], - pEdcaParm->Txop[1]<<5, - pEdcaParm->bACM[1])); - DBGPRINT(RT_DEBUG_TRACE,(" AC_VI %2d %2d %2d %4d %d\n", - pEdcaParm->Aifsn[2], - pEdcaParm->Cwmin[2], - pEdcaParm->Cwmax[2], - pEdcaParm->Txop[2]<<5, - pEdcaParm->bACM[2])); - DBGPRINT(RT_DEBUG_TRACE,(" AC_VO %2d %2d %2d %4d %d\n", - pEdcaParm->Aifsn[3], - pEdcaParm->Cwmin[3], - pEdcaParm->Cwmax[3], - pEdcaParm->Txop[3]<<5, - pEdcaParm->bACM[3])); + NdisMoveMemory(&pAd->CommonCfg.APEdcaParm, pEdcaParm, + sizeof(EDCA_PARM)); + if (!ADHOC_ON(pAd)) { + DBGPRINT(RT_DEBUG_TRACE, + ("EDCA [#%d]: AIFSN CWmin CWmax TXOP(us) ACM\n", + pEdcaParm->EdcaUpdateCount)); + DBGPRINT(RT_DEBUG_TRACE, + (" AC_BE %2d %2d %2d %4d %d\n", + pEdcaParm->Aifsn[0], pEdcaParm->Cwmin[0], + pEdcaParm->Cwmax[0], pEdcaParm->Txop[0] << 5, + pEdcaParm->bACM[0])); + DBGPRINT(RT_DEBUG_TRACE, + (" AC_BK %2d %2d %2d %4d %d\n", + pEdcaParm->Aifsn[1], pEdcaParm->Cwmin[1], + pEdcaParm->Cwmax[1], pEdcaParm->Txop[1] << 5, + pEdcaParm->bACM[1])); + DBGPRINT(RT_DEBUG_TRACE, + (" AC_VI %2d %2d %2d %4d %d\n", + pEdcaParm->Aifsn[2], pEdcaParm->Cwmin[2], + pEdcaParm->Cwmax[2], pEdcaParm->Txop[2] << 5, + pEdcaParm->bACM[2])); + DBGPRINT(RT_DEBUG_TRACE, + (" AC_VO %2d %2d %2d %4d %d\n", + pEdcaParm->Aifsn[3], pEdcaParm->Cwmin[3], + pEdcaParm->Cwmax[3], pEdcaParm->Txop[3] << 5, + pEdcaParm->bACM[3])); } } @@ -1823,19 +1862,19 @@ VOID AsicSetEdcaParm( ========================================================================== */ -VOID AsicSetSlotTime( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bUseShortSlotTime) +VOID AsicSetSlotTime(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUseShortSlotTime) { - ULONG SlotTime; - UINT32 RegValue = 0; + ULONG SlotTime; + UINT32 RegValue = 0; if (pAd->CommonCfg.Channel > 14) bUseShortSlotTime = TRUE; - if (bUseShortSlotTime && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED)) + if (bUseShortSlotTime + && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED)) return; - else if ((!bUseShortSlotTime) && (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED))) + else if ((!bUseShortSlotTime) + && (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED))) return; if (bUseShortSlotTime) @@ -1843,19 +1882,19 @@ VOID AsicSetSlotTime( else OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED); - SlotTime = (bUseShortSlotTime)? 9 : 20; + SlotTime = (bUseShortSlotTime) ? 9 : 20; { // force using short SLOT time for FAE to demo performance when TxBurst is ON - if (((pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) && (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED))) - || ((pAd->StaActive.SupportedPhyInfo.bHtEnable == TRUE) && (pAd->CommonCfg.BACapability.field.Policy == BA_NOTUSE)) - ) - { + if (((pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) + && (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED))) + || ((pAd->StaActive.SupportedPhyInfo.bHtEnable == TRUE) + && (pAd->CommonCfg.BACapability.field.Policy == + BA_NOTUSE)) + ) { // In this case, we will think it is doing Wi-Fi test // And we will not set to short slot when bEnableTxBurst is TRUE. - } - else if (pAd->CommonCfg.bEnableTxBurst) - { + } else if (pAd->CommonCfg.bEnableTxBurst) { OPSTATUS_SET_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED); SlotTime = 9; } @@ -1867,8 +1906,7 @@ VOID AsicSetSlotTime( // ToDo: Should consider capability with 11B // { - if (pAd->StaCfg.BssType == BSS_ADHOC) - { + if (pAd->StaCfg.BssType == BSS_ADHOC) { OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED); SlotTime = 20; } @@ -1892,92 +1930,97 @@ VOID AsicSetSlotTime( Return: ======================================================================== */ -VOID AsicAddSharedKeyEntry( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssIndex, - IN UCHAR KeyIdx, - IN UCHAR CipherAlg, - IN PUCHAR pKey, - IN PUCHAR pTxMic, - IN PUCHAR pRxMic) +VOID AsicAddSharedKeyEntry(IN PRTMP_ADAPTER pAd, + IN UCHAR BssIndex, + IN UCHAR KeyIdx, + IN UCHAR CipherAlg, + IN PUCHAR pKey, IN PUCHAR pTxMic, IN PUCHAR pRxMic) { - ULONG offset; //, csr0; + ULONG offset; //, csr0; SHAREDKEY_MODE_STRUC csr1; #ifdef RTMP_MAC_PCI - INT i; + INT i; #endif // RTMP_MAC_PCI // - DBGPRINT(RT_DEBUG_TRACE, ("AsicAddSharedKeyEntry BssIndex=%d, KeyIdx=%d\n", BssIndex,KeyIdx)); + DBGPRINT(RT_DEBUG_TRACE, + ("AsicAddSharedKeyEntry BssIndex=%d, KeyIdx=%d\n", BssIndex, + KeyIdx)); //============================================================================================ - DBGPRINT(RT_DEBUG_TRACE,("AsicAddSharedKeyEntry: %s key #%d\n", CipherName[CipherAlg], BssIndex*4 + KeyIdx)); - DBGPRINT_RAW(RT_DEBUG_TRACE, (" Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", - pKey[0],pKey[1],pKey[2],pKey[3],pKey[4],pKey[5],pKey[6],pKey[7],pKey[8],pKey[9],pKey[10],pKey[11],pKey[12],pKey[13],pKey[14],pKey[15])); - if (pRxMic) - { - DBGPRINT_RAW(RT_DEBUG_TRACE, (" Rx MIC Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", - pRxMic[0],pRxMic[1],pRxMic[2],pRxMic[3],pRxMic[4],pRxMic[5],pRxMic[6],pRxMic[7])); + DBGPRINT(RT_DEBUG_TRACE, + ("AsicAddSharedKeyEntry: %s key #%d\n", CipherName[CipherAlg], + BssIndex * 4 + KeyIdx)); + DBGPRINT_RAW(RT_DEBUG_TRACE, + (" Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", + pKey[0], pKey[1], pKey[2], pKey[3], pKey[4], + pKey[5], pKey[6], pKey[7], pKey[8], pKey[9], + pKey[10], pKey[11], pKey[12], pKey[13], pKey[14], + pKey[15])); + if (pRxMic) { + DBGPRINT_RAW(RT_DEBUG_TRACE, + (" Rx MIC Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", + pRxMic[0], pRxMic[1], pRxMic[2], pRxMic[3], + pRxMic[4], pRxMic[5], pRxMic[6], pRxMic[7])); } - if (pTxMic) - { - DBGPRINT_RAW(RT_DEBUG_TRACE, (" Tx MIC Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", - pTxMic[0],pTxMic[1],pTxMic[2],pTxMic[3],pTxMic[4],pTxMic[5],pTxMic[6],pTxMic[7])); + if (pTxMic) { + DBGPRINT_RAW(RT_DEBUG_TRACE, + (" Tx MIC Key = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", + pTxMic[0], pTxMic[1], pTxMic[2], pTxMic[3], + pTxMic[4], pTxMic[5], pTxMic[6], pTxMic[7])); } //============================================================================================ // // fill key material - key + TX MIC + RX MIC // #ifdef RTMP_MAC_PCI - offset = SHARED_KEY_TABLE_BASE + (4*BssIndex + KeyIdx)*HW_KEY_ENTRY_SIZE; - for (i=0; iKey; -// ULONG KeyLen = pCipherKey->KeyLen; - PUCHAR pTxMic = pCipherKey->TxMic; - PUCHAR pRxMic = pCipherKey->RxMic; - PUCHAR pTxtsc = pCipherKey->TxTsc; - UCHAR CipherAlg = pCipherKey->CipherAlg; + ULONG offset; +// ULONG WCIDAttri = 0; + UCHAR IV4 = 0; + PUCHAR pKey = pCipherKey->Key; +// ULONG KeyLen = pCipherKey->KeyLen; + PUCHAR pTxMic = pCipherKey->TxMic; + PUCHAR pRxMic = pCipherKey->RxMic; + PUCHAR pTxtsc = pCipherKey->TxTsc; + UCHAR CipherAlg = pCipherKey->CipherAlg; SHAREDKEY_MODE_STRUC csr1; #ifdef RTMP_MAC_PCI - UCHAR i; + UCHAR i; #endif // RTMP_MAC_PCI // -// ASSERT(KeyLen <= MAX_LEN_OF_PEER_KEY); +// ASSERT(KeyLen <= MAX_LEN_OF_PEER_KEY); DBGPRINT(RT_DEBUG_TRACE, ("==> AsicAddKeyEntry\n")); // @@ -2158,15 +2193,16 @@ VOID AsicAddKeyEntry( if (bUsePairewiseKeyTable) offset = PAIRWISE_KEY_TABLE_BASE + (WCID * HW_KEY_ENTRY_SIZE); else - offset = SHARED_KEY_TABLE_BASE + (4 * BssIndex + KeyIdx) * HW_KEY_ENTRY_SIZE; + offset = + SHARED_KEY_TABLE_BASE + (4 * BssIndex + + KeyIdx) * HW_KEY_ENTRY_SIZE; // // 2.) Set Key to Asic // //for (i = 0; i < KeyLen; i++) #ifdef RTMP_MAC_PCI - for (i = 0; i < MAX_LEN_OF_PEER_KEY; i++) - { + for (i = 0; i < MAX_LEN_OF_PEER_KEY; i++) { RTMP_IO_WRITE8(pAd, offset + i, pKey[i]); } offset += MAX_LEN_OF_PEER_KEY; @@ -2174,19 +2210,15 @@ VOID AsicAddKeyEntry( // // 3.) Set MIC key if available // - if (pTxMic) - { - for (i = 0; i < 8; i++) - { + if (pTxMic) { + for (i = 0; i < 8; i++) { RTMP_IO_WRITE8(pAd, offset + i, pTxMic[i]); } } offset += LEN_TKIP_TXMICK; - if (pRxMic) - { - for (i = 0; i < 8; i++) - { + if (pRxMic) { + for (i = 0; i < 8; i++) { RTMP_IO_WRITE8(pAd, offset + i, pRxMic[i]); } } @@ -2198,14 +2230,12 @@ VOID AsicAddKeyEntry( // // 3.) Set MIC key if available // - if (pTxMic) - { + if (pTxMic) { RTUSBMultiWrite(pAd, offset, pTxMic, 8); } offset += LEN_TKIP_TXMICK; - if (pRxMic) - { + if (pRxMic) { RTUSBMultiWrite(pAd, offset, pRxMic, 8); } #endif // RTMP_MAC_USB // @@ -2214,8 +2244,7 @@ VOID AsicAddKeyEntry( // 4.) Modify IV/EIV if needs // This will force Asic to use this key ID by setting IV. // - if (bTxKey) - { + if (bTxKey) { #ifdef RTMP_MAC_PCI offset = MAC_IVEIV_TABLE_BASE + (WCID * HW_IVEIV_ENTRY_SIZE); // @@ -2226,8 +2255,10 @@ VOID AsicAddKeyEntry( RTMP_IO_WRITE8(pAd, offset + 2, pTxtsc[0]); IV4 = (KeyIdx << 6); - if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) ||(CipherAlg == CIPHER_AES)) - IV4 |= 0x20; // turn on extension bit means EIV existence + if ((CipherAlg == CIPHER_TKIP) + || (CipherAlg == CIPHER_TKIP_NO_MIC) + || (CipherAlg == CIPHER_AES)) + IV4 |= 0x20; // turn on extension bit means EIV existence RTMP_IO_WRITE8(pAd, offset + 3, IV4); @@ -2235,8 +2266,7 @@ VOID AsicAddKeyEntry( // Write EIV // offset += 4; - for (i = 0; i < 4; i++) - { + for (i = 0; i < 4; i++) { RTMP_IO_WRITE8(pAd, offset + i, pTxtsc[i + 2]); } #endif // RTMP_MAC_PCI // @@ -2247,30 +2277,34 @@ VOID AsicAddKeyEntry( // Write IV // IV4 = (KeyIdx << 6); - if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) ||(CipherAlg == CIPHER_AES)) - IV4 |= 0x20; // turn on extension bit means EIV existence - - tmpVal = pTxtsc[1] + (((pTxtsc[1] | 0x20) & 0x7f) << 8) + (pTxtsc[0] << 16) + (IV4 << 24); + if ((CipherAlg == CIPHER_TKIP) + || (CipherAlg == CIPHER_TKIP_NO_MIC) + || (CipherAlg == CIPHER_AES)) + IV4 |= 0x20; // turn on extension bit means EIV existence + + tmpVal = + pTxtsc[1] + (((pTxtsc[1] | 0x20) & 0x7f) << 8) + + (pTxtsc[0] << 16) + (IV4 << 24); RTMP_IO_WRITE32(pAd, offset, tmpVal); // // Write EIV // offset += 4; - RTMP_IO_WRITE32(pAd, offset, *(PUINT32)&pCipherKey->TxTsc[2]); + RTMP_IO_WRITE32(pAd, offset, *(PUINT32) & pCipherKey->TxTsc[2]); #endif // RTMP_MAC_USB // - AsicUpdateWCIDAttribute(pAd, WCID, BssIndex, CipherAlg, bUsePairewiseKeyTable); + AsicUpdateWCIDAttribute(pAd, WCID, BssIndex, CipherAlg, + bUsePairewiseKeyTable); } - if (!bUsePairewiseKeyTable) - { + if (!bUsePairewiseKeyTable) { // // Only update the shared key security mode // - RTMP_IO_READ32(pAd, SHARED_KEY_MODE_BASE + 4 * (BssIndex / 2), &csr1.word); - if ((BssIndex % 2) == 0) - { + RTMP_IO_READ32(pAd, SHARED_KEY_MODE_BASE + 4 * (BssIndex / 2), + &csr1.word); + if ((BssIndex % 2) == 0) { if (KeyIdx == 0) csr1.field.Bss0Key0CipherAlg = CipherAlg; else if (KeyIdx == 1) @@ -2279,9 +2313,7 @@ VOID AsicAddKeyEntry( csr1.field.Bss0Key2CipherAlg = CipherAlg; else csr1.field.Bss0Key3CipherAlg = CipherAlg; - } - else - { + } else { if (KeyIdx == 0) csr1.field.Bss1Key0CipherAlg = CipherAlg; else if (KeyIdx == 1) @@ -2291,13 +2323,13 @@ VOID AsicAddKeyEntry( else csr1.field.Bss1Key3CipherAlg = CipherAlg; } - RTMP_IO_WRITE32(pAd, SHARED_KEY_MODE_BASE + 4 * (BssIndex / 2), csr1.word); + RTMP_IO_WRITE32(pAd, SHARED_KEY_MODE_BASE + 4 * (BssIndex / 2), + csr1.word); } DBGPRINT(RT_DEBUG_TRACE, ("<== AsicAddKeyEntry\n")); } - /* ======================================================================== Description: @@ -2307,34 +2339,30 @@ VOID AsicAddKeyEntry( Return: ======================================================================== */ -VOID AsicAddPairwiseKeyEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR WCID, - IN CIPHER_KEY *pCipherKey) +VOID AsicAddPairwiseKeyEntry(IN PRTMP_ADAPTER pAd, + IN PUCHAR pAddr, + IN UCHAR WCID, IN CIPHER_KEY * pCipherKey) { INT i; - ULONG offset; - PUCHAR pKey = pCipherKey->Key; - PUCHAR pTxMic = pCipherKey->TxMic; - PUCHAR pRxMic = pCipherKey->RxMic; + ULONG offset; + PUCHAR pKey = pCipherKey->Key; + PUCHAR pTxMic = pCipherKey->TxMic; + PUCHAR pRxMic = pCipherKey->RxMic; #ifdef DBG - UCHAR CipherAlg = pCipherKey->CipherAlg; + UCHAR CipherAlg = pCipherKey->CipherAlg; #endif // DBG // // EKEY offset = PAIRWISE_KEY_TABLE_BASE + (WCID * HW_KEY_ENTRY_SIZE); #ifdef RTMP_MAC_PCI - for (i=0; iKey[0], MAX_LEN_OF_PEER_KEY); #endif // RTMP_MAC_USB // - for (i=0; ichipOps.sendCommandToMcu) @@ -2418,10 +2445,7 @@ BOOLEAN AsicSendCommandToMcu( return TRUE; } - -VOID AsicSetRxAnt( - IN PRTMP_ADAPTER pAd, - IN UCHAR Ant) +VOID AsicSetRxAnt(IN PRTMP_ADAPTER pAd, IN UCHAR Ant) { #ifdef RT30xx /* RT3572 ATE need not to do this. */ @@ -2429,132 +2453,113 @@ VOID AsicSetRxAnt( #endif // RT30xx // } - -VOID AsicTurnOffRFClk( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel) +VOID AsicTurnOffRFClk(IN PRTMP_ADAPTER pAd, IN UCHAR Channel) { - if (pAd->chipOps.AsicRfTurnOff) - { + if (pAd->chipOps.AsicRfTurnOff) { pAd->chipOps.AsicRfTurnOff(pAd); - } - else - { + } else { // RF R2 bit 18 = 0 - UINT32 R1 = 0, R2 = 0, R3 = 0; - UCHAR index; - RTMP_RF_REGS *RFRegTable; + UINT32 R1 = 0, R2 = 0, R3 = 0; + UCHAR index; + RTMP_RF_REGS *RFRegTable; RFRegTable = RF2850RegTable; - switch (pAd->RfIcType) - { - case RFIC_2820: - case RFIC_2850: - case RFIC_2720: - case RFIC_2750: - - for (index = 0; index < NUM_OF_2850_CHNL; index++) - { - if (Channel == RFRegTable[index].Channel) - { - R1 = RFRegTable[index].R1 & 0xffffdfff; - R2 = RFRegTable[index].R2 & 0xfffbffff; - R3 = RFRegTable[index].R3 & 0xfff3ffff; - - RTMP_RF_IO_WRITE32(pAd, R1); - RTMP_RF_IO_WRITE32(pAd, R2); - - // Program R1b13 to 1, R3/b18,19 to 0, R2b18 to 0. - // Set RF R2 bit18=0, R3 bit[18:19]=0 - //if (pAd->StaCfg.bRadio == FALSE) - if (1) - { - RTMP_RF_IO_WRITE32(pAd, R3); - - DBGPRINT(RT_DEBUG_TRACE, ("AsicTurnOffRFClk#%d(RF=%d, ) , R2=0x%08x, R3 = 0x%08x \n", - Channel, pAd->RfIcType, R2, R3)); - } - else - DBGPRINT(RT_DEBUG_TRACE, ("AsicTurnOffRFClk#%d(RF=%d, ) , R2=0x%08x \n", - Channel, pAd->RfIcType, R2)); - break; - } + switch (pAd->RfIcType) { + case RFIC_2820: + case RFIC_2850: + case RFIC_2720: + case RFIC_2750: + + for (index = 0; index < NUM_OF_2850_CHNL; index++) { + if (Channel == RFRegTable[index].Channel) { + R1 = RFRegTable[index].R1 & 0xffffdfff; + R2 = RFRegTable[index].R2 & 0xfffbffff; + R3 = RFRegTable[index].R3 & 0xfff3ffff; + + RTMP_RF_IO_WRITE32(pAd, R1); + RTMP_RF_IO_WRITE32(pAd, R2); + + // Program R1b13 to 1, R3/b18,19 to 0, R2b18 to 0. + // Set RF R2 bit18=0, R3 bit[18:19]=0 + //if (pAd->StaCfg.bRadio == FALSE) + if (1) { + RTMP_RF_IO_WRITE32(pAd, R3); + + DBGPRINT(RT_DEBUG_TRACE, + ("AsicTurnOffRFClk#%d(RF=%d, ) , R2=0x%08x, R3 = 0x%08x \n", + Channel, + pAd->RfIcType, R2, + R3)); + } else + DBGPRINT(RT_DEBUG_TRACE, + ("AsicTurnOffRFClk#%d(RF=%d, ) , R2=0x%08x \n", + Channel, + pAd->RfIcType, R2)); + break; } - break; + } + break; - default: - break; + default: + break; } } } - -VOID AsicTurnOnRFClk( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel) +VOID AsicTurnOnRFClk(IN PRTMP_ADAPTER pAd, IN UCHAR Channel) { // RF R2 bit 18 = 0 - UINT32 R1 = 0, R2 = 0, R3 = 0; - UCHAR index; - RTMP_RF_REGS *RFRegTable; + UINT32 R1 = 0, R2 = 0, R3 = 0; + UCHAR index; + RTMP_RF_REGS *RFRegTable; #ifdef PCIE_PS_SUPPORT // The RF programming sequence is difference between 3xxx and 2xxx - if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) - { + if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) { return; } #endif // PCIE_PS_SUPPORT // RFRegTable = RF2850RegTable; - switch (pAd->RfIcType) - { - case RFIC_2820: - case RFIC_2850: - case RFIC_2720: - case RFIC_2750: - - for (index = 0; index < NUM_OF_2850_CHNL; index++) - { - if (Channel == RFRegTable[index].Channel) - { - R3 = pAd->LatchRfRegs.R3; - R3 &= 0xfff3ffff; - R3 |= 0x00080000; - RTMP_RF_IO_WRITE32(pAd, R3); - - R1 = RFRegTable[index].R1; - RTMP_RF_IO_WRITE32(pAd, R1); - - R2 = RFRegTable[index].R2; - if (pAd->Antenna.field.TxPath == 1) - { - R2 |= 0x4000; // If TXpath is 1, bit 14 = 1; - } - - if (pAd->Antenna.field.RxPath == 2) - { - R2 |= 0x40; // write 1 to off Rxpath. - } - else if (pAd->Antenna.field.RxPath == 1) - { - R2 |= 0x20040; // write 1 to off RxPath - } - RTMP_RF_IO_WRITE32(pAd, R2); + switch (pAd->RfIcType) { + case RFIC_2820: + case RFIC_2850: + case RFIC_2720: + case RFIC_2750: + + for (index = 0; index < NUM_OF_2850_CHNL; index++) { + if (Channel == RFRegTable[index].Channel) { + R3 = pAd->LatchRfRegs.R3; + R3 &= 0xfff3ffff; + R3 |= 0x00080000; + RTMP_RF_IO_WRITE32(pAd, R3); + + R1 = RFRegTable[index].R1; + RTMP_RF_IO_WRITE32(pAd, R1); + + R2 = RFRegTable[index].R2; + if (pAd->Antenna.field.TxPath == 1) { + R2 |= 0x4000; // If TXpath is 1, bit 14 = 1; + } - break; + if (pAd->Antenna.field.RxPath == 2) { + R2 |= 0x40; // write 1 to off Rxpath. + } else if (pAd->Antenna.field.RxPath == 1) { + R2 |= 0x20040; // write 1 to off RxPath } + RTMP_RF_IO_WRITE32(pAd, R2); + + break; } - break; + } + break; - default: - break; + default: + break; } DBGPRINT(RT_DEBUG_TRACE, ("AsicTurnOnRFClk#%d(RF=%d, ) , R2=0x%08x\n", - Channel, - pAd->RfIcType, - R2)); + Channel, pAd->RfIcType, R2)); } diff --git a/drivers/staging/rt2860/common/cmm_cfg.c b/drivers/staging/rt2860/common/cmm_cfg.c index c1cf2bf4680d..9f337176b80c 100644 --- a/drivers/staging/rt2860/common/cmm_cfg.c +++ b/drivers/staging/rt2860/common/cmm_cfg.c @@ -35,50 +35,41 @@ --------- ---------- ---------------------------------------------- */ - - #include "../rt_config.h" - -char* GetPhyMode( - int Mode) +char *GetPhyMode(int Mode) { - switch(Mode) - { - case MODE_CCK: - return "CCK"; - - case MODE_OFDM: - return "OFDM"; - case MODE_HTMIX: - return "HTMIX"; - - case MODE_HTGREENFIELD: - return "GREEN"; - default: - return "N/A"; + switch (Mode) { + case MODE_CCK: + return "CCK"; + + case MODE_OFDM: + return "OFDM"; + case MODE_HTMIX: + return "HTMIX"; + + case MODE_HTGREENFIELD: + return "GREEN"; + default: + return "N/A"; } } - -char* GetBW( - int BW) +char *GetBW(int BW) { - switch(BW) - { - case BW_10: - return "10M"; - - case BW_20: - return "20M"; - case BW_40: - return "40M"; - default: - return "N/A"; + switch (BW) { + case BW_10: + return "10M"; + + case BW_20: + return "20M"; + case BW_40: + return "40M"; + default: + return "N/A"; } } - /* ========================================================================== Description: @@ -89,46 +80,37 @@ char* GetBW( TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -INT RT_CfgSetCountryRegion( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg, - IN INT band) +INT RT_CfgSetCountryRegion(IN PRTMP_ADAPTER pAd, IN PSTRING arg, IN INT band) { LONG region, regionMax; UCHAR *pCountryRegion; region = simple_strtol(arg, 0, 10); - if (band == BAND_24G) - { + if (band == BAND_24G) { pCountryRegion = &pAd->CommonCfg.CountryRegion; regionMax = REGION_MAXIMUM_BG_BAND; - } - else - { + } else { pCountryRegion = &pAd->CommonCfg.CountryRegionForABand; regionMax = REGION_MAXIMUM_A_BAND; } // TODO: Is it neccesay for following check??? // Country can be set only when EEPROM not programmed - if (*pCountryRegion & 0x80) - { - DBGPRINT(RT_DEBUG_ERROR, ("CfgSetCountryRegion():CountryRegion in eeprom was programmed\n")); + if (*pCountryRegion & 0x80) { + DBGPRINT(RT_DEBUG_ERROR, + ("CfgSetCountryRegion():CountryRegion in eeprom was programmed\n")); return FALSE; } - if((region >= 0) && (region <= REGION_MAXIMUM_BG_BAND)) - { - *pCountryRegion= (UCHAR) region; - } - else if ((region == REGION_31_BG_BAND) && (band == BAND_24G)) - { + if ((region >= 0) && (region <= REGION_MAXIMUM_BG_BAND)) { *pCountryRegion = (UCHAR) region; - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("CfgSetCountryRegion():region(%ld) out of range!\n", region)); + } else if ((region == REGION_31_BG_BAND) && (band == BAND_24G)) { + *pCountryRegion = (UCHAR) region; + } else { + DBGPRINT(RT_DEBUG_ERROR, + ("CfgSetCountryRegion():region(%ld) out of range!\n", + region)); return FALSE; } @@ -136,7 +118,6 @@ INT RT_CfgSetCountryRegion( } - /* ========================================================================== Description: @@ -145,18 +126,15 @@ INT RT_CfgSetCountryRegion( TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -INT RT_CfgSetWirelessMode( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) +INT RT_CfgSetWirelessMode(IN PRTMP_ADAPTER pAd, IN PSTRING arg) { - INT MaxPhyMode = PHY_11G; - LONG WirelessMode; + INT MaxPhyMode = PHY_11G; + LONG WirelessMode; MaxPhyMode = PHY_11N_5G; WirelessMode = simple_strtol(arg, 0, 10); - if (WirelessMode <= MaxPhyMode) - { + if (WirelessMode <= MaxPhyMode) { pAd->CommonCfg.PhyMode = WirelessMode; return TRUE; } @@ -165,10 +143,7 @@ INT RT_CfgSetWirelessMode( } - -INT RT_CfgSetShortSlot( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) +INT RT_CfgSetShortSlot(IN PRTMP_ADAPTER pAd, IN PSTRING arg) { LONG ShortSlot; @@ -179,12 +154,11 @@ INT RT_CfgSetShortSlot( else if (ShortSlot == 0) pAd->CommonCfg.bUseShortSlotTime = FALSE; else - return FALSE; //Invalid argument + return FALSE; //Invalid argument return TRUE; } - /* ========================================================================== Description: @@ -193,54 +167,53 @@ INT RT_CfgSetShortSlot( TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -INT RT_CfgSetWepKey( - IN PRTMP_ADAPTER pAd, - IN PSTRING keyString, - IN CIPHER_KEY *pSharedKey, - IN INT keyIdx) +INT RT_CfgSetWepKey(IN PRTMP_ADAPTER pAd, + IN PSTRING keyString, + IN CIPHER_KEY * pSharedKey, IN INT keyIdx) { - INT KeyLen; - INT i; - UCHAR CipherAlg = CIPHER_NONE; - BOOLEAN bKeyIsHex = FALSE; + INT KeyLen; + INT i; + UCHAR CipherAlg = CIPHER_NONE; + BOOLEAN bKeyIsHex = FALSE; // TODO: Shall we do memset for the original key info?? memset(pSharedKey, 0, sizeof(CIPHER_KEY)); KeyLen = strlen(keyString); - switch (KeyLen) - { - case 5: //wep 40 Ascii type - case 13: //wep 104 Ascii type - bKeyIsHex = FALSE; - pSharedKey->KeyLen = KeyLen; - NdisMoveMemory(pSharedKey->Key, keyString, KeyLen); - break; - - case 10: //wep 40 Hex type - case 26: //wep 104 Hex type - for(i=0; i < KeyLen; i++) - { - if( !isxdigit(*(keyString+i)) ) - return FALSE; //Not Hex value; - } - bKeyIsHex = TRUE; - pSharedKey->KeyLen = KeyLen/2 ; - AtoH(keyString, pSharedKey->Key, pSharedKey->KeyLen); - break; - - default: //Invalid argument - DBGPRINT(RT_DEBUG_TRACE, ("RT_CfgSetWepKey(keyIdx=%d):Invalid argument (arg=%s)\n", keyIdx, keyString)); - return FALSE; + switch (KeyLen) { + case 5: //wep 40 Ascii type + case 13: //wep 104 Ascii type + bKeyIsHex = FALSE; + pSharedKey->KeyLen = KeyLen; + NdisMoveMemory(pSharedKey->Key, keyString, KeyLen); + break; + + case 10: //wep 40 Hex type + case 26: //wep 104 Hex type + for (i = 0; i < KeyLen; i++) { + if (!isxdigit(*(keyString + i))) + return FALSE; //Not Hex value; + } + bKeyIsHex = TRUE; + pSharedKey->KeyLen = KeyLen / 2; + AtoH(keyString, pSharedKey->Key, pSharedKey->KeyLen); + break; + + default: //Invalid argument + DBGPRINT(RT_DEBUG_TRACE, + ("RT_CfgSetWepKey(keyIdx=%d):Invalid argument (arg=%s)\n", + keyIdx, keyString)); + return FALSE; } pSharedKey->CipherAlg = ((KeyLen % 5) ? CIPHER_WEP128 : CIPHER_WEP64); - DBGPRINT(RT_DEBUG_TRACE, ("RT_CfgSetWepKey:(KeyIdx=%d,type=%s, Alg=%s)\n", - keyIdx, (bKeyIsHex == FALSE ? "Ascii" : "Hex"), CipherName[CipherAlg])); + DBGPRINT(RT_DEBUG_TRACE, + ("RT_CfgSetWepKey:(KeyIdx=%d,type=%s, Alg=%s)\n", keyIdx, + (bKeyIsHex == FALSE ? "Ascii" : "Hex"), + CipherName[CipherAlg])); return TRUE; } - /* ========================================================================== Description: @@ -257,33 +230,28 @@ INT RT_CfgSetWepKey( TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -INT RT_CfgSetWPAPSKKey( - IN RTMP_ADAPTER *pAd, - IN PSTRING keyString, - IN UCHAR *pHashStr, - IN INT hashStrLen, - OUT PUCHAR pPMKBuf) +INT RT_CfgSetWPAPSKKey(IN RTMP_ADAPTER * pAd, + IN PSTRING keyString, + IN UCHAR * pHashStr, + IN INT hashStrLen, OUT PUCHAR pPMKBuf) { int keyLen; UCHAR keyMaterial[40]; keyLen = strlen(keyString); - if ((keyLen < 8) || (keyLen > 64)) - { - DBGPRINT(RT_DEBUG_TRACE, ("WPAPSK Key length(%d) error, required 8 ~ 64 characters!(keyStr=%s)\n", - keyLen, keyString)); + if ((keyLen < 8) || (keyLen > 64)) { + DBGPRINT(RT_DEBUG_TRACE, + ("WPAPSK Key length(%d) error, required 8 ~ 64 characters!(keyStr=%s)\n", + keyLen, keyString)); return FALSE; } memset(pPMKBuf, 0, 32); - if (keyLen == 64) - { - AtoH(keyString, pPMKBuf, 32); - } - else - { - PasswordHash(keyString, pHashStr, hashStrLen, keyMaterial); - NdisMoveMemory(pPMKBuf, keyMaterial, 32); + if (keyLen == 64) { + AtoH(keyString, pPMKBuf, 32); + } else { + PasswordHash(keyString, pHashStr, hashStrLen, keyMaterial); + NdisMoveMemory(pPMKBuf, keyMaterial, 32); } return TRUE; diff --git a/drivers/staging/rt2860/common/cmm_data.c b/drivers/staging/rt2860/common/cmm_data.c index 36969134696b..033a4ead7d15 100644 --- a/drivers/staging/rt2860/common/cmm_data.c +++ b/drivers/staging/rt2860/common/cmm_data.c @@ -25,52 +25,60 @@ ************************************************************************* */ - #include "../rt_config.h" +UCHAR SNAP_802_1H[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; +UCHAR SNAP_BRIDGE_TUNNEL[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; -UCHAR SNAP_802_1H[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; -UCHAR SNAP_BRIDGE_TUNNEL[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8}; // Add Cisco Aironet SNAP heade for CCX2 support -UCHAR SNAP_AIRONET[] = {0xaa, 0xaa, 0x03, 0x00, 0x40, 0x96, 0x00, 0x00}; -UCHAR CKIP_LLC_SNAP[] = {0xaa, 0xaa, 0x03, 0x00, 0x40, 0x96, 0x00, 0x02}; -UCHAR EAPOL_LLC_SNAP[]= {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8e}; -UCHAR EAPOL[] = {0x88, 0x8e}; -UCHAR TPID[] = {0x81, 0x00}; /* VLAN related */ - -UCHAR IPX[] = {0x81, 0x37}; -UCHAR APPLE_TALK[] = {0x80, 0xf3}; -UCHAR RateIdToPlcpSignal[12] = { - 0, /* RATE_1 */ 1, /* RATE_2 */ 2, /* RATE_5_5 */ 3, /* RATE_11 */ // see BBP spec - 11, /* RATE_6 */ 15, /* RATE_9 */ 10, /* RATE_12 */ 14, /* RATE_18 */ // see IEEE802.11a-1999 p.14 - 9, /* RATE_24 */ 13, /* RATE_36 */ 8, /* RATE_48 */ 12 /* RATE_54 */ }; // see IEEE802.11a-1999 p.14 - -UCHAR OfdmSignalToRateId[16] = { - RATE_54, RATE_54, RATE_54, RATE_54, // OFDM PLCP Signal = 0, 1, 2, 3 respectively - RATE_54, RATE_54, RATE_54, RATE_54, // OFDM PLCP Signal = 4, 5, 6, 7 respectively - RATE_48, RATE_24, RATE_12, RATE_6, // OFDM PLCP Signal = 8, 9, 10, 11 respectively - RATE_54, RATE_36, RATE_18, RATE_9, // OFDM PLCP Signal = 12, 13, 14, 15 respectively +UCHAR SNAP_AIRONET[] = { 0xaa, 0xaa, 0x03, 0x00, 0x40, 0x96, 0x00, 0x00 }; +UCHAR CKIP_LLC_SNAP[] = { 0xaa, 0xaa, 0x03, 0x00, 0x40, 0x96, 0x00, 0x02 }; +UCHAR EAPOL_LLC_SNAP[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8e }; +UCHAR EAPOL[] = { 0x88, 0x8e }; +UCHAR TPID[] = { 0x81, 0x00 }; /* VLAN related */ + +UCHAR IPX[] = { 0x81, 0x37 }; +UCHAR APPLE_TALK[] = { 0x80, 0xf3 }; + +UCHAR RateIdToPlcpSignal[12] = { + 0, /* RATE_1 */ 1, /* RATE_2 */ 2, /* RATE_5_5 */ 3, /* RATE_11 */// see BBP spec + 11, /* RATE_6 */ 15, /* RATE_9 */ 10, /* RATE_12 */ 14, /* RATE_18 */// see IEEE802.11a-1999 p.14 + 9, /* RATE_24 */ 13, /* RATE_36 */ 8, /* RATE_48 */ 12 /* RATE_54 */ +}; // see IEEE802.11a-1999 p.14 + +UCHAR OfdmSignalToRateId[16] = { + RATE_54, RATE_54, RATE_54, RATE_54, // OFDM PLCP Signal = 0, 1, 2, 3 respectively + RATE_54, RATE_54, RATE_54, RATE_54, // OFDM PLCP Signal = 4, 5, 6, 7 respectively + RATE_48, RATE_24, RATE_12, RATE_6, // OFDM PLCP Signal = 8, 9, 10, 11 respectively + RATE_54, RATE_36, RATE_18, RATE_9, // OFDM PLCP Signal = 12, 13, 14, 15 respectively }; -UCHAR OfdmRateToRxwiMCS[12] = { - 0, 0, 0, 0, - 0, 1, 2, 3, // OFDM rate 6,9,12,18 = rxwi mcs 0,1,2,3 - 4, 5, 6, 7, // OFDM rate 24,36,48,54 = rxwi mcs 4,5,6,7 +UCHAR OfdmRateToRxwiMCS[12] = { + 0, 0, 0, 0, + 0, 1, 2, 3, // OFDM rate 6,9,12,18 = rxwi mcs 0,1,2,3 + 4, 5, 6, 7, // OFDM rate 24,36,48,54 = rxwi mcs 4,5,6,7 }; -UCHAR RxwiMCSToOfdmRate[12] = { - RATE_6, RATE_9, RATE_12, RATE_18, - RATE_24, RATE_36, RATE_48, RATE_54, // OFDM rate 6,9,12,18 = rxwi mcs 0,1,2,3 - 4, 5, 6, 7, // OFDM rate 24,36,48,54 = rxwi mcs 4,5,6,7 + +UCHAR RxwiMCSToOfdmRate[12] = { + RATE_6, RATE_9, RATE_12, RATE_18, + RATE_24, RATE_36, RATE_48, RATE_54, // OFDM rate 6,9,12,18 = rxwi mcs 0,1,2,3 + 4, 5, 6, 7, // OFDM rate 24,36,48,54 = rxwi mcs 4,5,6,7 }; -char* MCSToMbps[] = {"1Mbps","2Mbps","5.5Mbps","11Mbps","06Mbps","09Mbps","12Mbps","18Mbps","24Mbps","36Mbps","48Mbps","54Mbps","MM-0","MM-1","MM-2","MM-3","MM-4","MM-5","MM-6","MM-7","MM-8","MM-9","MM-10","MM-11","MM-12","MM-13","MM-14","MM-15","MM-32","ee1","ee2","ee3"}; +char *MCSToMbps[] = + { "1Mbps", "2Mbps", "5.5Mbps", "11Mbps", "06Mbps", "09Mbps", "12Mbps", +"18Mbps", "24Mbps", "36Mbps", "48Mbps", "54Mbps", "MM-0", "MM-1", "MM-2", "MM-3", +"MM-4", "MM-5", "MM-6", "MM-7", "MM-8", "MM-9", "MM-10", "MM-11", "MM-12", "MM-13", +"MM-14", "MM-15", "MM-32", "ee1", "ee2", "ee3" }; -UCHAR default_cwmin[]={CW_MIN_IN_BITS, CW_MIN_IN_BITS, CW_MIN_IN_BITS-1, CW_MIN_IN_BITS-2}; +UCHAR default_cwmin[] = + { CW_MIN_IN_BITS, CW_MIN_IN_BITS, CW_MIN_IN_BITS - 1, CW_MIN_IN_BITS - 2 }; //UCHAR default_cwmax[]={CW_MAX_IN_BITS, CW_MAX_IN_BITS, CW_MIN_IN_BITS, CW_MIN_IN_BITS-1}; -UCHAR default_sta_aifsn[]={3,7,2,2}; - -UCHAR MapUserPriorityToAccessCategory[8] = {QID_AC_BE, QID_AC_BK, QID_AC_BK, QID_AC_BE, QID_AC_VI, QID_AC_VI, QID_AC_VO, QID_AC_VO}; +UCHAR default_sta_aifsn[] = { 3, 7, 2, 2 }; +UCHAR MapUserPriorityToAccessCategory[8] = + { QID_AC_BE, QID_AC_BK, QID_AC_BK, QID_AC_BE, QID_AC_VI, QID_AC_VI, +QID_AC_VO, QID_AC_VO }; /* ======================================================================== @@ -96,120 +104,112 @@ UCHAR MapUserPriorityToAccessCategory[8] = {QID_AC_BE, QID_AC_BK, QID_AC_BK, QID ======================================================================== */ -NDIS_STATUS MiniportMMRequest( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PUCHAR pData, - IN UINT Length) +NDIS_STATUS MiniportMMRequest(IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, IN PUCHAR pData, IN UINT Length) { - PNDIS_PACKET pPacket; - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - ULONG FreeNum; - UCHAR rtmpHwHdr[TXINFO_SIZE + TXWI_SIZE]; //RTMP_HW_HDR_LEN]; + PNDIS_PACKET pPacket; + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + ULONG FreeNum; + UCHAR rtmpHwHdr[TXINFO_SIZE + TXWI_SIZE]; //RTMP_HW_HDR_LEN]; #ifdef RTMP_MAC_PCI - unsigned long IrqFlags = 0; - UCHAR IrqState; + unsigned long IrqFlags = 0; + UCHAR IrqState; #endif // RTMP_MAC_PCI // - BOOLEAN bUseDataQ = FALSE; - int retryCnt = 0; + BOOLEAN bUseDataQ = FALSE; + int retryCnt = 0; ASSERT(Length <= MGMT_DMA_BUFFER_SIZE); - if ((QueIdx & MGMT_USE_QUEUE_FLAG) == MGMT_USE_QUEUE_FLAG) - { + if ((QueIdx & MGMT_USE_QUEUE_FLAG) == MGMT_USE_QUEUE_FLAG) { bUseDataQ = TRUE; QueIdx &= (~MGMT_USE_QUEUE_FLAG); } - #ifdef RTMP_MAC_PCI // 2860C use Tx Ring IrqState = pAd->irq_disabled; - if (pAd->MACVersion == 0x28600100) - { - QueIdx = (bUseDataQ ==TRUE ? QueIdx : 3); + if (pAd->MACVersion == 0x28600100) { + QueIdx = (bUseDataQ == TRUE ? QueIdx : 3); bUseDataQ = TRUE; } if (bUseDataQ && (!IrqState)) RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); #endif // RTMP_MAC_PCI // - do - { + do { // Reset is in progress, stop immediately if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)|| - !RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_START_UP)) - { + RTMP_TEST_FLAG(pAd, + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST) + || !RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_START_UP)) { Status = NDIS_STATUS_FAILURE; break; } - // Check Free priority queue // Since we use PBF Queue2 for management frame. Its corresponding DMA ring should be using TxRing. #ifdef RTMP_MAC_PCI - if (bUseDataQ) - { + if (bUseDataQ) { retryCnt = MAX_DATAMM_RETRY; // free Tx(QueIdx) resources RTMPFreeTXDUponTxDmaDone(pAd, QueIdx); FreeNum = GET_TXRING_FREENO(pAd, QueIdx); - } - else + } else #endif // RTMP_MAC_PCI // { FreeNum = GET_MGMTRING_FREENO(pAd); } - if ((FreeNum > 0)) - { + if ((FreeNum > 0)) { // We need to reserve space for rtmp hardware header. i.e., TxWI for RT2860 and TxInfo+TxWI for RT2870 NdisZeroMemory(&rtmpHwHdr, (TXINFO_SIZE + TXWI_SIZE)); - Status = RTMPAllocateNdisPacket(pAd, &pPacket, (PUCHAR)&rtmpHwHdr, (TXINFO_SIZE + TXWI_SIZE), pData, Length); - if (Status != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_WARN, ("MiniportMMRequest (error:: can't allocate NDIS PACKET)\n")); + Status = + RTMPAllocateNdisPacket(pAd, &pPacket, + (PUCHAR) & rtmpHwHdr, + (TXINFO_SIZE + TXWI_SIZE), + pData, Length); + if (Status != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_WARN, + ("MiniportMMRequest (error:: can't allocate NDIS PACKET)\n")); break; } - //pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_CCK; //pAd->CommonCfg.MlmeRate = RATE_2; - #ifdef RTMP_MAC_PCI - if (bUseDataQ) - { - Status = MlmeDataHardTransmit(pAd, QueIdx, pPacket); + if (bUseDataQ) { + Status = + MlmeDataHardTransmit(pAd, QueIdx, pPacket); retryCnt--; - } - else + } else #endif // RTMP_MAC_PCI // - Status = MlmeHardTransmit(pAd, QueIdx, pPacket); + Status = MlmeHardTransmit(pAd, QueIdx, pPacket); if (Status == NDIS_STATUS_SUCCESS) retryCnt = 0; else RTMPFreeNdisPacket(pAd, pPacket); - } - else - { + } else { pAd->RalinkCounters.MgmtRingFullCount++; #ifdef RTMP_MAC_PCI - if (bUseDataQ) - { + if (bUseDataQ) { retryCnt--; - DBGPRINT(RT_DEBUG_TRACE, ("retryCnt %d\n", retryCnt)); - if (retryCnt == 0) - { - DBGPRINT(RT_DEBUG_ERROR, ("Qidx(%d), not enough space in DataRing, MgmtRingFullCount=%ld!\n", - QueIdx, pAd->RalinkCounters.MgmtRingFullCount)); + DBGPRINT(RT_DEBUG_TRACE, + ("retryCnt %d\n", retryCnt)); + if (retryCnt == 0) { + DBGPRINT(RT_DEBUG_ERROR, + ("Qidx(%d), not enough space in DataRing, MgmtRingFullCount=%ld!\n", + QueIdx, + pAd->RalinkCounters. + MgmtRingFullCount)); } } #endif // RTMP_MAC_PCI // - DBGPRINT(RT_DEBUG_ERROR, ("Qidx(%d), not enough space in MgmtRing, MgmtRingFullCount=%ld!\n", - QueIdx, pAd->RalinkCounters.MgmtRingFullCount)); + DBGPRINT(RT_DEBUG_ERROR, + ("Qidx(%d), not enough space in MgmtRing, MgmtRingFullCount=%ld!\n", + QueIdx, + pAd->RalinkCounters.MgmtRingFullCount)); } } while (retryCnt > 0); - #ifdef RTMP_MAC_PCI if (bUseDataQ && (!IrqState)) RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); @@ -218,9 +218,6 @@ NDIS_STATUS MiniportMMRequest( return Status; } - - - /* ======================================================================== @@ -245,19 +242,16 @@ NDIS_STATUS MiniportMMRequest( ======================================================================== */ -NDIS_STATUS MlmeHardTransmit( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket) +NDIS_STATUS MlmeHardTransmit(IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, IN PNDIS_PACKET pPacket) { - PACKET_INFO PacketInfo; - PUCHAR pSrcBufVA; - UINT SrcBufLen; - PHEADER_802_11 pHeader_802_11; + PACKET_INFO PacketInfo; + PUCHAR pSrcBufVA; + UINT SrcBufLen; + PHEADER_802_11 pHeader_802_11; if ((pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) - ) - { + ) { return NDIS_STATUS_FAILURE; } @@ -267,77 +261,66 @@ NDIS_STATUS MlmeHardTransmit( pHeader_802_11 = (PHEADER_802_11) (pSrcBufVA + TXINFO_SIZE + TXWI_SIZE); - #ifdef RTMP_MAC_PCI - if ( pAd->MACVersion == 0x28600100 ) - return MlmeHardTransmitTxRing(pAd,QueIdx,pPacket); + if (pAd->MACVersion == 0x28600100) + return MlmeHardTransmitTxRing(pAd, QueIdx, pPacket); else #endif // RTMP_MAC_PCI // - return MlmeHardTransmitMgmtRing(pAd,QueIdx,pPacket); + return MlmeHardTransmitMgmtRing(pAd, QueIdx, pPacket); } - -NDIS_STATUS MlmeHardTransmitMgmtRing( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket) +NDIS_STATUS MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, IN PNDIS_PACKET pPacket) { - PACKET_INFO PacketInfo; - PUCHAR pSrcBufVA; - UINT SrcBufLen; - PHEADER_802_11 pHeader_802_11; - BOOLEAN bAckRequired, bInsertTimestamp; - UCHAR MlmeRate; - PTXWI_STRUC pFirstTxWI; - MAC_TABLE_ENTRY *pMacEntry = NULL; - UCHAR PID; + PACKET_INFO PacketInfo; + PUCHAR pSrcBufVA; + UINT SrcBufLen; + PHEADER_802_11 pHeader_802_11; + BOOLEAN bAckRequired, bInsertTimestamp; + UCHAR MlmeRate; + PTXWI_STRUC pFirstTxWI; + MAC_TABLE_ENTRY *pMacEntry = NULL; + UCHAR PID; RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); // Make sure MGMT ring resource won't be used by other threads RTMP_SEM_LOCK(&pAd->MgmtRingLock); - if (pSrcBufVA == NULL) - { + if (pSrcBufVA == NULL) { // The buffer shouldn't be NULL RTMP_SEM_UNLOCK(&pAd->MgmtRingLock); return NDIS_STATUS_FAILURE; } { - // outgoing frame always wakeup PHY to prevent frame lost - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - AsicForceWakeup(pAd, TRUE); + // outgoing frame always wakeup PHY to prevent frame lost + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) + AsicForceWakeup(pAd, TRUE); } - pFirstTxWI = (PTXWI_STRUC)(pSrcBufVA + TXINFO_SIZE); - pHeader_802_11 = (PHEADER_802_11) (pSrcBufVA + TXINFO_SIZE + TXWI_SIZE); //TXWI_SIZE); + pFirstTxWI = (PTXWI_STRUC) (pSrcBufVA + TXINFO_SIZE); + pHeader_802_11 = (PHEADER_802_11) (pSrcBufVA + TXINFO_SIZE + TXWI_SIZE); //TXWI_SIZE); - if (pHeader_802_11->Addr1[0] & 0x01) - { + if (pHeader_802_11->Addr1[0] & 0x01) { MlmeRate = pAd->CommonCfg.BasicMlmeRate; - } - else - { + } else { MlmeRate = pAd->CommonCfg.MlmeRate; } // Verify Mlme rate for a / g bands. - if ((pAd->LatchRfRegs.Channel > 14) && (MlmeRate < RATE_6)) // 11A band + if ((pAd->LatchRfRegs.Channel > 14) && (MlmeRate < RATE_6)) // 11A band MlmeRate = RATE_6; if ((pHeader_802_11->FC.Type == BTYPE_DATA) && - (pHeader_802_11->FC.SubType == SUBTYPE_QOS_NULL)) - { + (pHeader_802_11->FC.SubType == SUBTYPE_QOS_NULL)) { pMacEntry = MacTableLookup(pAd, pHeader_802_11->Addr1); } { // Fixed W52 with Activity scan issue in ABG_MIXED and ABGN_MIXED mode. if (pAd->CommonCfg.PhyMode == PHY_11ABG_MIXED - || pAd->CommonCfg.PhyMode == PHY_11ABGN_MIXED - ) - { + || pAd->CommonCfg.PhyMode == PHY_11ABGN_MIXED) { if (pAd->LatchRfRegs.Channel > 14) pAd->CommonCfg.MlmeTransmit.field.MODE = 1; else @@ -350,82 +333,76 @@ NDIS_STATUS MlmeHardTransmitMgmtRing( // Snice it's been set to 0 while on MgtMacHeaderInit // By the way this will cause frame to be send on PWR_SAVE failed. // - pHeader_802_11->FC.PwrMgmt = PWR_ACTIVE; // (pAd->StaCfg.Psm == PWR_SAVE); + pHeader_802_11->FC.PwrMgmt = PWR_ACTIVE; // (pAd->StaCfg.Psm == PWR_SAVE); // // In WMM-UAPSD, mlme frame should be set psm as power saving but probe request frame - // Data-Null packets alse pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD -// if ((pHeader_802_11->FC.Type != BTYPE_DATA) && (pHeader_802_11->FC.Type != BTYPE_CNTL)) + // Data-Null packets alse pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD +// if ((pHeader_802_11->FC.Type != BTYPE_DATA) && (pHeader_802_11->FC.Type != BTYPE_CNTL)) { if ((pHeader_802_11->FC.SubType == SUBTYPE_ACTION) || - ((pHeader_802_11->FC.Type == BTYPE_DATA) && - ((pHeader_802_11->FC.SubType == SUBTYPE_QOS_NULL) || - (pHeader_802_11->FC.SubType == SUBTYPE_NULL_FUNC)))) - { + ((pHeader_802_11->FC.Type == BTYPE_DATA) && + ((pHeader_802_11->FC.SubType == SUBTYPE_QOS_NULL) || + (pHeader_802_11->FC.SubType == SUBTYPE_NULL_FUNC)))) { if (pAd->StaCfg.Psm == PWR_SAVE) - pHeader_802_11->FC.PwrMgmt = PWR_SAVE; - else - pHeader_802_11->FC.PwrMgmt = pAd->CommonCfg.bAPSDForcePowerSave; - } + pHeader_802_11->FC.PwrMgmt = PWR_SAVE; + else + pHeader_802_11->FC.PwrMgmt = + pAd->CommonCfg.bAPSDForcePowerSave; + } } - - - - bInsertTimestamp = FALSE; - if (pHeader_802_11->FC.Type == BTYPE_CNTL) // must be PS-POLL + if (pHeader_802_11->FC.Type == BTYPE_CNTL) // must be PS-POLL { //Set PM bit in ps-poll, to fix WLK 1.2 PowerSaveMode_ext failure issue. - if ((pAd->OpMode == OPMODE_STA) && (pHeader_802_11->FC.SubType == SUBTYPE_PS_POLL)) - { + if ((pAd->OpMode == OPMODE_STA) + && (pHeader_802_11->FC.SubType == SUBTYPE_PS_POLL)) { pHeader_802_11->FC.PwrMgmt = PWR_SAVE; } bAckRequired = FALSE; - } - else // BTYPE_MGMT or BTYPE_DATA(must be NULL frame) + } else // BTYPE_MGMT or BTYPE_DATA(must be NULL frame) { //pAd->Sequence++; //pHeader_802_11->Sequence = pAd->Sequence; - if (pHeader_802_11->Addr1[0] & 0x01) // MULTICAST, BROADCAST + if (pHeader_802_11->Addr1[0] & 0x01) // MULTICAST, BROADCAST { bAckRequired = FALSE; pHeader_802_11->Duration = 0; - } - else - { + } else { bAckRequired = TRUE; - pHeader_802_11->Duration = RTMPCalcDuration(pAd, MlmeRate, 14); - if ((pHeader_802_11->FC.SubType == SUBTYPE_PROBE_RSP) && (pHeader_802_11->FC.Type == BTYPE_MGMT)) - { + pHeader_802_11->Duration = + RTMPCalcDuration(pAd, MlmeRate, 14); + if ((pHeader_802_11->FC.SubType == SUBTYPE_PROBE_RSP) + && (pHeader_802_11->FC.Type == BTYPE_MGMT)) { bInsertTimestamp = TRUE; - bAckRequired = FALSE; // Disable ACK to prevent retry 0x1f for Probe Response - } - else if ((pHeader_802_11->FC.SubType == SUBTYPE_PROBE_REQ) && (pHeader_802_11->FC.Type == BTYPE_MGMT)) - { - bAckRequired = FALSE; // Disable ACK to prevent retry 0x1f for Probe Request + bAckRequired = FALSE; // Disable ACK to prevent retry 0x1f for Probe Response + } else + if ((pHeader_802_11->FC.SubType == + SUBTYPE_PROBE_REQ) + && (pHeader_802_11->FC.Type == BTYPE_MGMT)) { + bAckRequired = FALSE; // Disable ACK to prevent retry 0x1f for Probe Request } } } pHeader_802_11->Sequence = pAd->Sequence++; - if (pAd->Sequence >0xfff) + if (pAd->Sequence > 0xfff) pAd->Sequence = 0; // Before radar detection done, mgmt frame can not be sent but probe req // Because we need to use probe req to trigger driver to send probe req in passive scan if ((pHeader_802_11->FC.SubType != SUBTYPE_PROBE_REQ) - && (pAd->CommonCfg.bIEEE80211H == 1) - && (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE)) - { - DBGPRINT(RT_DEBUG_ERROR,("MlmeHardTransmit --> radar detect not in normal mode !!!\n")); -// if (!IrqState) + && (pAd->CommonCfg.bIEEE80211H == 1) + && (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE)) { + DBGPRINT(RT_DEBUG_ERROR, + ("MlmeHardTransmit --> radar detect not in normal mode !!!\n")); +// if (!IrqState) RTMP_SEM_UNLOCK(&pAd->MgmtRingLock); return (NDIS_STATUS_FAILURE); } - // // fill scatter-and-gather buffer list into TXD. Internally created NDIS PACKET // should always has only one physical buffer, and the whole frame size equals @@ -435,38 +412,37 @@ NDIS_STATUS MlmeHardTransmitMgmtRing( // Initialize TX Descriptor // For inter-frame gap, the number is for this frame and next frame // For MLME rate, we will fix as 2Mb to match other vendor's implement -// pAd->CommonCfg.MlmeTransmit.field.MODE = 1; +// pAd->CommonCfg.MlmeTransmit.field.MODE = 1; // management frame doesn't need encryption. so use RESERVED_WCID no matter u are sending to specific wcid or not. PID = PID_MGMT; - - if (pMacEntry == NULL) - { - RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, bInsertTimestamp, FALSE, bAckRequired, FALSE, - 0, RESERVED_WCID, (SrcBufLen - TXINFO_SIZE - TXWI_SIZE), PID, 0, (UCHAR)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); - } - else - { + if (pMacEntry == NULL) { + RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, bInsertTimestamp, + FALSE, bAckRequired, FALSE, 0, RESERVED_WCID, + (SrcBufLen - TXINFO_SIZE - TXWI_SIZE), PID, 0, + (UCHAR) pAd->CommonCfg.MlmeTransmit.field.MCS, + IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); + } else { /* dont use low rate to send QoS Null data frame */ RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, - bInsertTimestamp, FALSE, bAckRequired, FALSE, - 0, pMacEntry->Aid, (SrcBufLen - TXINFO_SIZE - TXWI_SIZE), - pMacEntry->MaxHTPhyMode.field.MCS, 0, - (UCHAR)pMacEntry->MaxHTPhyMode.field.MCS, - IFS_BACKOFF, FALSE, &pMacEntry->MaxHTPhyMode); + bInsertTimestamp, FALSE, bAckRequired, FALSE, + 0, pMacEntry->Aid, + (SrcBufLen - TXINFO_SIZE - TXWI_SIZE), + pMacEntry->MaxHTPhyMode.field.MCS, 0, + (UCHAR) pMacEntry->MaxHTPhyMode.field.MCS, + IFS_BACKOFF, FALSE, &pMacEntry->MaxHTPhyMode); } // Now do hardware-depened kick out. HAL_KickOutMgmtTx(pAd, QueIdx, pPacket, pSrcBufVA, SrcBufLen); // Make sure to release MGMT ring resource -// if (!IrqState) +// if (!IrqState) RTMP_SEM_UNLOCK(&pAd->MgmtRingLock); return NDIS_STATUS_SUCCESS; } - /******************************************************************************** New DeQueue Procedures. @@ -530,79 +506,68 @@ NDIS_STATUS MlmeHardTransmitMgmtRing( (2).Normal ======================================================================== */ -static UCHAR TxPktClassification( - IN RTMP_ADAPTER *pAd, - IN PNDIS_PACKET pPacket) +static UCHAR TxPktClassification(IN RTMP_ADAPTER * pAd, IN PNDIS_PACKET pPacket) { - UCHAR TxFrameType = TX_UNKOWN_FRAME; - UCHAR Wcid; - MAC_TABLE_ENTRY *pMacEntry = NULL; - BOOLEAN bHTRate = FALSE; + UCHAR TxFrameType = TX_UNKOWN_FRAME; + UCHAR Wcid; + MAC_TABLE_ENTRY *pMacEntry = NULL; + BOOLEAN bHTRate = FALSE; Wcid = RTMP_GET_PACKET_WCID(pPacket); - if (Wcid == MCAST_WCID) - { // Handle for RA is Broadcast/Multicast Address. + if (Wcid == MCAST_WCID) { // Handle for RA is Broadcast/Multicast Address. return TX_MCAST_FRAME; } - // Handle for unicast packets pMacEntry = &pAd->MacTab.Content[Wcid]; - if (RTMP_GET_PACKET_LOWRATE(pPacket)) - { // It's a specific packet need to force low rate, i.e., bDHCPFrame, bEAPOLFrame, bWAIFrame + if (RTMP_GET_PACKET_LOWRATE(pPacket)) { // It's a specific packet need to force low rate, i.e., bDHCPFrame, bEAPOLFrame, bWAIFrame TxFrameType = TX_LEGACY_FRAME; - } - else if (IS_HT_RATE(pMacEntry)) - { // it's a 11n capable packet + } else if (IS_HT_RATE(pMacEntry)) { // it's a 11n capable packet // Depends on HTPhyMode to check if the peer support the HTRate transmission. - // Currently didn't support A-MSDU embedded in A-MPDU + // Currently didn't support A-MSDU embedded in A-MPDU bHTRate = TRUE; - if (RTMP_GET_PACKET_MOREDATA(pPacket) || (pMacEntry->PsMode == PWR_SAVE)) + if (RTMP_GET_PACKET_MOREDATA(pPacket) + || (pMacEntry->PsMode == PWR_SAVE)) TxFrameType = TX_LEGACY_FRAME; - else if((pMacEntry->TXBAbitmap & (1<<(RTMP_GET_PACKET_UP(pPacket)))) != 0) + else if ((pMacEntry-> + TXBAbitmap & (1 << (RTMP_GET_PACKET_UP(pPacket)))) != + 0) return TX_AMPDU_FRAME; - else if(CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_AMSDU_INUSED)) + else if (CLIENT_STATUS_TEST_FLAG + (pMacEntry, fCLIENT_STATUS_AMSDU_INUSED)) return TX_AMSDU_FRAME; else TxFrameType = TX_LEGACY_FRAME; - } - else - { // it's a legacy b/g packet. - if ((CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_AGGREGATION_CAPABLE) && pAd->CommonCfg.bAggregationCapable) && - (RTMP_GET_PACKET_TXRATE(pPacket) >= RATE_6) && - (!(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_WMM_CAPABLE)))) - { // if peer support Ralink Aggregation, we use it. + } else { // it's a legacy b/g packet. + if ((CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_AGGREGATION_CAPABLE) && pAd->CommonCfg.bAggregationCapable) && (RTMP_GET_PACKET_TXRATE(pPacket) >= RATE_6) && (!(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_WMM_CAPABLE)))) { // if peer support Ralink Aggregation, we use it. TxFrameType = TX_RALINK_FRAME; - } - else - { + } else { TxFrameType = TX_LEGACY_FRAME; } } // Currently, our fragment only support when a unicast packet send as NOT-ARALINK, NOT-AMSDU and NOT-AMPDU. - if ((RTMP_GET_PACKET_FRAGMENTS(pPacket) > 1) && (TxFrameType == TX_LEGACY_FRAME)) + if ((RTMP_GET_PACKET_FRAGMENTS(pPacket) > 1) + && (TxFrameType == TX_LEGACY_FRAME)) TxFrameType = TX_FRAG_FRAME; return TxFrameType; } - -BOOLEAN RTMP_FillTxBlkInfo( - IN RTMP_ADAPTER *pAd, - IN TX_BLK *pTxBlk) +BOOLEAN RTMP_FillTxBlkInfo(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) { - PACKET_INFO PacketInfo; - PNDIS_PACKET pPacket; - PMAC_TABLE_ENTRY pMacEntry = NULL; + PACKET_INFO PacketInfo; + PNDIS_PACKET pPacket; + PMAC_TABLE_ENTRY pMacEntry = NULL; pPacket = pTxBlk->pPacket; - RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pTxBlk->pSrcBufHeader, &pTxBlk->SrcBufLen); + RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pTxBlk->pSrcBufHeader, + &pTxBlk->SrcBufLen); - pTxBlk->Wcid = RTMP_GET_PACKET_WCID(pPacket); - pTxBlk->apidx = RTMP_GET_PACKET_IF(pPacket); - pTxBlk->UserPriority = RTMP_GET_PACKET_UP(pPacket); - pTxBlk->FrameGap = IFS_HTTXOP; // ASIC determine Frame Gap + pTxBlk->Wcid = RTMP_GET_PACKET_WCID(pPacket); + pTxBlk->apidx = RTMP_GET_PACKET_IF(pPacket); + pTxBlk->UserPriority = RTMP_GET_PACKET_UP(pPacket); + pTxBlk->FrameGap = IFS_HTTXOP; // ASIC determine Frame Gap if (RTMP_GET_PACKET_CLEAR_EAP_FRAME(pTxBlk->pPacket)) TX_BLK_SET_FLAG(pTxBlk, fTX_bClearEAPFrame); @@ -612,32 +577,27 @@ BOOLEAN RTMP_FillTxBlkInfo( // Default to clear this flag TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bForceNonQoS); - - if (pTxBlk->Wcid == MCAST_WCID) - { + if (pTxBlk->Wcid == MCAST_WCID) { pTxBlk->pMacEntry = NULL; { - pTxBlk->pTransmit = &pAd->MacTab.Content[MCAST_WCID].HTPhyMode; + pTxBlk->pTransmit = + &pAd->MacTab.Content[MCAST_WCID].HTPhyMode; } TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bAckRequired); // AckRequired = FALSE, when broadcast packet in Adhoc mode. //TX_BLK_SET_FLAG(pTxBlk, fTX_bForceLowRate); TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bAllowFrag); TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bWMM); - if (RTMP_GET_PACKET_MOREDATA(pPacket)) - { + if (RTMP_GET_PACKET_MOREDATA(pPacket)) { TX_BLK_SET_FLAG(pTxBlk, fTX_bMoreData); } - } - else - { + } else { pTxBlk->pMacEntry = &pAd->MacTab.Content[pTxBlk->Wcid]; pTxBlk->pTransmit = &pTxBlk->pMacEntry->HTPhyMode; pMacEntry = pTxBlk->pMacEntry; - // For all unicast packets, need Ack unless the Ack Policy is not set as NORMAL_ACK. if (pAd->CommonCfg.AckPolicy[pTxBlk->QueIdx] != NORMAL_ACK) TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bAckRequired); @@ -645,56 +605,54 @@ BOOLEAN RTMP_FillTxBlkInfo( TX_BLK_SET_FLAG(pTxBlk, fTX_bAckRequired); if ((pAd->OpMode == OPMODE_STA) && - (ADHOC_ON(pAd)) && - (RX_FILTER_TEST_FLAG(pAd, fRX_FILTER_ACCEPT_PROMISCUOUS))) - { - if(pAd->CommonCfg.PSPXlink) + (ADHOC_ON(pAd)) && + (RX_FILTER_TEST_FLAG(pAd, fRX_FILTER_ACCEPT_PROMISCUOUS))) { + if (pAd->CommonCfg.PSPXlink) TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bAckRequired); } { - { + { - // If support WMM, enable it. - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && - CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_WMM_CAPABLE)) - TX_BLK_SET_FLAG(pTxBlk, fTX_bWMM); + // If support WMM, enable it. + if (OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_WMM_INUSED) + && CLIENT_STATUS_TEST_FLAG(pMacEntry, + fCLIENT_STATUS_WMM_CAPABLE)) + TX_BLK_SET_FLAG(pTxBlk, fTX_bWMM); -// if (pAd->StaCfg.bAutoTxRateSwitch) -// TX_BLK_SET_FLAG(pTxBlk, fTX_AutoRateSwitch); +// if (pAd->StaCfg.bAutoTxRateSwitch) +// TX_BLK_SET_FLAG(pTxBlk, fTX_AutoRateSwitch); } } - if (pTxBlk->TxFrameType == TX_LEGACY_FRAME) - { - if ( (RTMP_GET_PACKET_LOWRATE(pPacket)) || - ((pAd->OpMode == OPMODE_AP) && (pMacEntry->MaxHTPhyMode.field.MODE == MODE_CCK) && (pMacEntry->MaxHTPhyMode.field.MCS == RATE_1))) - { // Specific packet, i.e., bDHCPFrame, bEAPOLFrame, bWAIFrame, need force low rate. - pTxBlk->pTransmit = &pAd->MacTab.Content[MCAST_WCID].HTPhyMode; + if (pTxBlk->TxFrameType == TX_LEGACY_FRAME) { + if ((RTMP_GET_PACKET_LOWRATE(pPacket)) || ((pAd->OpMode == OPMODE_AP) && (pMacEntry->MaxHTPhyMode.field.MODE == MODE_CCK) && (pMacEntry->MaxHTPhyMode.field.MCS == RATE_1))) { // Specific packet, i.e., bDHCPFrame, bEAPOLFrame, bWAIFrame, need force low rate. + pTxBlk->pTransmit = + &pAd->MacTab.Content[MCAST_WCID].HTPhyMode; // Modify the WMM bit for ICV issue. If we have a packet with EOSP field need to set as 1, how to handle it??? if (IS_HT_STA(pTxBlk->pMacEntry) && - (CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_RALINK_CHIPSET)) && - ((pAd->CommonCfg.bRdg == TRUE) && CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_RDG_CAPABLE))) + (CLIENT_STATUS_TEST_FLAG + (pMacEntry, fCLIENT_STATUS_RALINK_CHIPSET)) + && ((pAd->CommonCfg.bRdg == TRUE) + && CLIENT_STATUS_TEST_FLAG(pMacEntry, + fCLIENT_STATUS_RDG_CAPABLE))) { TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bWMM); - TX_BLK_SET_FLAG(pTxBlk, fTX_bForceNonQoS); + TX_BLK_SET_FLAG(pTxBlk, + fTX_bForceNonQoS); } } - if ( (IS_HT_RATE(pMacEntry) == FALSE) && - (CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_PIGGYBACK_CAPABLE))) - { // Currently piggy-back only support when peer is operate in b/g mode. + if ((IS_HT_RATE(pMacEntry) == FALSE) && (CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_PIGGYBACK_CAPABLE))) { // Currently piggy-back only support when peer is operate in b/g mode. TX_BLK_SET_FLAG(pTxBlk, fTX_bPiggyBack); } - if (RTMP_GET_PACKET_MOREDATA(pPacket)) - { + if (RTMP_GET_PACKET_MOREDATA(pPacket)) { TX_BLK_SET_FLAG(pTxBlk, fTX_bMoreData); } - } - else if (pTxBlk->TxFrameType == TX_FRAG_FRAME) - { + } else if (pTxBlk->TxFrameType == TX_FRAG_FRAME) { TX_BLK_SET_FLAG(pTxBlk, fTX_bAllowFrag); } @@ -704,11 +662,8 @@ BOOLEAN RTMP_FillTxBlkInfo( return TRUE; } - -BOOLEAN CanDoAggregateTransmit( - IN RTMP_ADAPTER *pAd, - IN NDIS_PACKET *pPacket, - IN TX_BLK *pTxBlk) +BOOLEAN CanDoAggregateTransmit(IN RTMP_ADAPTER * pAd, + IN NDIS_PACKET * pPacket, IN TX_BLK * pTxBlk) { //DBGPRINT(RT_DEBUG_TRACE, ("Check if can do aggregation! TxFrameType=%d!\n", pTxBlk->TxFrameType)); @@ -717,30 +672,24 @@ BOOLEAN CanDoAggregateTransmit( return FALSE; if (RTMP_GET_PACKET_DHCP(pPacket) || - RTMP_GET_PACKET_EAPOL(pPacket) || - RTMP_GET_PACKET_WAI(pPacket)) + RTMP_GET_PACKET_EAPOL(pPacket) || RTMP_GET_PACKET_WAI(pPacket)) return FALSE; - if ((pTxBlk->TxFrameType == TX_AMSDU_FRAME) && - ((pTxBlk->TotalFrameLen + GET_OS_PKT_LEN(pPacket))> (RX_BUFFER_AGGRESIZE - 100))) - { // For AMSDU, allow the packets with total length < max-amsdu size + if ((pTxBlk->TxFrameType == TX_AMSDU_FRAME) && ((pTxBlk->TotalFrameLen + GET_OS_PKT_LEN(pPacket)) > (RX_BUFFER_AGGRESIZE - 100))) { // For AMSDU, allow the packets with total length < max-amsdu size return FALSE; } - if ((pTxBlk->TxFrameType == TX_RALINK_FRAME) && - (pTxBlk->TxPacketList.Number == 2)) - { // For RALINK-Aggregation, allow two frames in one batch. + if ((pTxBlk->TxFrameType == TX_RALINK_FRAME) && (pTxBlk->TxPacketList.Number == 2)) { // For RALINK-Aggregation, allow two frames in one batch. return FALSE; } - if ((INFRA_ON(pAd)) && (pAd->OpMode == OPMODE_STA)) // must be unicast to AP + if ((INFRA_ON(pAd)) && (pAd->OpMode == OPMODE_STA)) // must be unicast to AP return TRUE; else return FALSE; } - /* ======================================================================== @@ -763,51 +712,41 @@ BOOLEAN CanDoAggregateTransmit( ======================================================================== */ -VOID RTMPDeQueuePacket( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bIntContext, - IN UCHAR QIdx, /* BulkOutPipeId */ - IN UCHAR Max_Tx_Packets) +VOID RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, IN UCHAR QIdx, /* BulkOutPipeId */ + IN UCHAR Max_Tx_Packets) { - PQUEUE_ENTRY pEntry = NULL; - PNDIS_PACKET pPacket; - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - UCHAR Count=0; - PQUEUE_HEADER pQueue; - ULONG FreeNumber[NUM_OF_TX_RING]; - UCHAR QueIdx, sQIdx, eQIdx; - unsigned long IrqFlags = 0; - BOOLEAN hasTxDesc = FALSE; - TX_BLK TxBlk; - TX_BLK *pTxBlk; - - - - if (QIdx == NUM_OF_TX_RING) - { + PQUEUE_ENTRY pEntry = NULL; + PNDIS_PACKET pPacket; + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + UCHAR Count = 0; + PQUEUE_HEADER pQueue; + ULONG FreeNumber[NUM_OF_TX_RING]; + UCHAR QueIdx, sQIdx, eQIdx; + unsigned long IrqFlags = 0; + BOOLEAN hasTxDesc = FALSE; + TX_BLK TxBlk; + TX_BLK *pTxBlk; + + if (QIdx == NUM_OF_TX_RING) { sQIdx = 0; eQIdx = 3; // 4 ACs, start from 0. - } - else - { + } else { sQIdx = eQIdx = QIdx; } - for (QueIdx=sQIdx; QueIdx <= eQIdx; QueIdx++) - { - Count=0; + for (QueIdx = sQIdx; QueIdx <= eQIdx; QueIdx++) { + Count = 0; RTMP_START_DEQUEUE(pAd, QueIdx, IrqFlags); - - while (1) - { - if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS | - fRTMP_ADAPTER_RADIO_OFF | - fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST)))) - { + while (1) { + if ((RTMP_TEST_FLAG + (pAd, + (fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS | + fRTMP_ADAPTER_RADIO_OFF | + fRTMP_ADAPTER_RESET_IN_PROGRESS | + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST)))) { RTMP_STOP_DEQUEUE(pAd, QueIdx, IrqFlags); return; } @@ -816,47 +755,47 @@ VOID RTMPDeQueuePacket( break; DEQUEUE_LOCK(&pAd->irq_lock, bIntContext, IrqFlags); - if (&pAd->TxSwQueue[QueIdx] == NULL) - { - DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, IrqFlags); + if (&pAd->TxSwQueue[QueIdx] == NULL) { + DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, + IrqFlags); break; } - #ifdef RTMP_MAC_PCI FreeNumber[QueIdx] = GET_TXRING_FREENO(pAd, QueIdx); - - if (FreeNumber[QueIdx] <= 5) - { + if (FreeNumber[QueIdx] <= 5) { // free Tx(QueIdx) resources RTMPFreeTXDUponTxDmaDone(pAd, QueIdx); - FreeNumber[QueIdx] = GET_TXRING_FREENO(pAd, QueIdx); + FreeNumber[QueIdx] = + GET_TXRING_FREENO(pAd, QueIdx); } #endif // RTMP_MAC_PCI // // probe the Queue Head pQueue = &pAd->TxSwQueue[QueIdx]; - if ((pEntry = pQueue->Head) == NULL) - { - DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, IrqFlags); + if ((pEntry = pQueue->Head) == NULL) { + DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, + IrqFlags); break; } pTxBlk = &TxBlk; - NdisZeroMemory((PUCHAR)pTxBlk, sizeof(TX_BLK)); - //InitializeQueueHeader(&pTxBlk->TxPacketList); // Didn't need it because we already memzero it. + NdisZeroMemory((PUCHAR) pTxBlk, sizeof(TX_BLK)); + //InitializeQueueHeader(&pTxBlk->TxPacketList); // Didn't need it because we already memzero it. pTxBlk->QueIdx = QueIdx; pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); - // Early check to make sure we have enoguh Tx Resource. - hasTxDesc = RTMP_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, FreeNumber[QueIdx], pPacket); - if (!hasTxDesc) - { + hasTxDesc = + RTMP_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, + FreeNumber[QueIdx], + pPacket); + if (!hasTxDesc) { pAd->PrivateInfo.TxRingFullCnt++; - DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, IrqFlags); + DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, + IrqFlags); break; } @@ -867,27 +806,41 @@ VOID RTMPDeQueuePacket( pTxBlk->TotalFragNum += RTMP_GET_PACKET_FRAGMENTS(pPacket); // The real fragment number maybe vary pTxBlk->TotalFrameLen += GET_OS_PKT_LEN(pPacket); pTxBlk->pPacket = pPacket; - InsertTailQueue(&pTxBlk->TxPacketList, PACKET_TO_QUEUE_ENTRY(pPacket)); + InsertTailQueue(&pTxBlk->TxPacketList, + PACKET_TO_QUEUE_ENTRY(pPacket)); - if (pTxBlk->TxFrameType == TX_RALINK_FRAME || pTxBlk->TxFrameType == TX_AMSDU_FRAME) - { + if (pTxBlk->TxFrameType == TX_RALINK_FRAME + || pTxBlk->TxFrameType == TX_AMSDU_FRAME) { // Enhance SW Aggregation Mechanism - if (NEED_QUEUE_BACK_FOR_AGG(pAd, QueIdx, FreeNumber[QueIdx], pTxBlk->TxFrameType)) - { - InsertHeadQueue(pQueue, PACKET_TO_QUEUE_ENTRY(pPacket)); - DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, IrqFlags); + if (NEED_QUEUE_BACK_FOR_AGG + (pAd, QueIdx, FreeNumber[QueIdx], + pTxBlk->TxFrameType)) { + InsertHeadQueue(pQueue, + PACKET_TO_QUEUE_ENTRY + (pPacket)); + DEQUEUE_UNLOCK(&pAd->irq_lock, + bIntContext, IrqFlags); break; } - do{ - if((pEntry = pQueue->Head) == NULL) + do { + if ((pEntry = pQueue->Head) == NULL) break; // For TX_AMSDU_FRAME/TX_RALINK_FRAME, Need to check if next pakcet can do aggregation. pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); - FreeNumber[QueIdx] = GET_TXRING_FREENO(pAd, QueIdx); - hasTxDesc = RTMP_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, FreeNumber[QueIdx], pPacket); - if ((hasTxDesc == FALSE) || (CanDoAggregateTransmit(pAd, pPacket, pTxBlk) == FALSE)) + FreeNumber[QueIdx] = + GET_TXRING_FREENO(pAd, QueIdx); + hasTxDesc = + RTMP_HAS_ENOUGH_FREE_DESC(pAd, + pTxBlk, + FreeNumber + [QueIdx], + pPacket); + if ((hasTxDesc == FALSE) + || + (CanDoAggregateTransmit + (pAd, pPacket, pTxBlk) == FALSE)) break; //Remove the packet from the TxSwQueue and insert into pTxBlk @@ -896,14 +849,16 @@ VOID RTMPDeQueuePacket( pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); pTxBlk->TotalFrameNum++; pTxBlk->TotalFragNum += RTMP_GET_PACKET_FRAGMENTS(pPacket); // The real fragment number maybe vary - pTxBlk->TotalFrameLen += GET_OS_PKT_LEN(pPacket); - InsertTailQueue(&pTxBlk->TxPacketList, PACKET_TO_QUEUE_ENTRY(pPacket)); - }while(1); + pTxBlk->TotalFrameLen += + GET_OS_PKT_LEN(pPacket); + InsertTailQueue(&pTxBlk->TxPacketList, + PACKET_TO_QUEUE_ENTRY + (pPacket)); + } while (1); if (pTxBlk->TxPacketList.Number == 1) pTxBlk->TxFrameType = TX_LEGACY_FRAME; } - #ifdef RTMP_MAC_USB DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, IrqFlags); #endif // RTMP_MAC_USB // @@ -916,7 +871,7 @@ VOID RTMPDeQueuePacket( DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, IrqFlags); // static rate also need NICUpdateFifoStaCounters() function. //if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) - NICUpdateFifoStaCounters(pAd); + NICUpdateFifoStaCounters(pAd); #endif // RTMP_MAC_PCI // } @@ -931,7 +886,6 @@ VOID RTMPDeQueuePacket( } - /* ======================================================================== @@ -954,40 +908,37 @@ VOID RTMPDeQueuePacket( ======================================================================== */ -USHORT RTMPCalcDuration( - IN PRTMP_ADAPTER pAd, - IN UCHAR Rate, - IN ULONG Size) +USHORT RTMPCalcDuration(IN PRTMP_ADAPTER pAd, IN UCHAR Rate, IN ULONG Size) { - ULONG Duration = 0; + ULONG Duration = 0; - if (Rate < RATE_FIRST_OFDM_RATE) // CCK + if (Rate < RATE_FIRST_OFDM_RATE) // CCK { - if ((Rate > RATE_1) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED)) + if ((Rate > RATE_1) + && OPSTATUS_TEST_FLAG(pAd, + fOP_STATUS_SHORT_PREAMBLE_INUSED)) Duration = 96; // 72+24 preamble+plcp else - Duration = 192; // 144+48 preamble+plcp + Duration = 192; // 144+48 preamble+plcp - Duration += (USHORT)((Size << 4) / RateIdTo500Kbps[Rate]); + Duration += (USHORT) ((Size << 4) / RateIdTo500Kbps[Rate]); if ((Size << 4) % RateIdTo500Kbps[Rate]) - Duration ++; - } - else if (Rate <= RATE_LAST_OFDM_RATE)// OFDM rates + Duration++; + } else if (Rate <= RATE_LAST_OFDM_RATE) // OFDM rates { - Duration = 20 + 6; // 16+4 preamble+plcp + Signal Extension - Duration += 4 * (USHORT)((11 + Size * 4) / RateIdTo500Kbps[Rate]); + Duration = 20 + 6; // 16+4 preamble+plcp + Signal Extension + Duration += + 4 * (USHORT) ((11 + Size * 4) / RateIdTo500Kbps[Rate]); if ((11 + Size * 4) % RateIdTo500Kbps[Rate]) Duration += 4; - } - else //mimo rate + } else //mimo rate { - Duration = 20 + 6; // 16+4 preamble+plcp + Signal Extension + Duration = 20 + 6; // 16+4 preamble+plcp + Signal Extension } - return (USHORT)Duration; + return (USHORT) Duration; } - /* ======================================================================== @@ -1017,28 +968,19 @@ USHORT RTMPCalcDuration( ======================================================================== */ -VOID RTMPWriteTxWI( - IN PRTMP_ADAPTER pAd, - IN PTXWI_STRUC pOutTxWI, - IN BOOLEAN FRAG, - IN BOOLEAN CFACK, - IN BOOLEAN InsTimestamp, - IN BOOLEAN AMPDU, - IN BOOLEAN Ack, - IN BOOLEAN NSeq, // HW new a sequence. - IN UCHAR BASize, - IN UCHAR WCID, - IN ULONG Length, - IN UCHAR PID, - IN UCHAR TID, - IN UCHAR TxRate, - IN UCHAR Txopmode, - IN BOOLEAN CfAck, - IN HTTRANSMIT_SETTING *pTransmit) +VOID RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pOutTxWI, IN BOOLEAN FRAG, IN BOOLEAN CFACK, IN BOOLEAN InsTimestamp, IN BOOLEAN AMPDU, IN BOOLEAN Ack, IN BOOLEAN NSeq, // HW new a sequence. + IN UCHAR BASize, + IN UCHAR WCID, + IN ULONG Length, + IN UCHAR PID, + IN UCHAR TID, + IN UCHAR TxRate, + IN UCHAR Txopmode, + IN BOOLEAN CfAck, IN HTTRANSMIT_SETTING * pTransmit) { - PMAC_TABLE_ENTRY pMac = NULL; - TXWI_STRUC TxWI; - PTXWI_STRUC pTxWI; + PMAC_TABLE_ENTRY pMac = NULL; + TXWI_STRUC TxWI; + PTXWI_STRUC pTxWI; if (WCID < MAX_LEN_OF_MAC_TABLE) pMac = &pAd->MacTab.Content[WCID]; @@ -1051,26 +993,23 @@ VOID RTMPWriteTxWI( NdisZeroMemory(&TxWI, TXWI_SIZE); pTxWI = &TxWI; - pTxWI->FRAG= FRAG; + pTxWI->FRAG = FRAG; pTxWI->CFACK = CFACK; - pTxWI->TS= InsTimestamp; + pTxWI->TS = InsTimestamp; pTxWI->AMPDU = AMPDU; pTxWI->ACK = Ack; - pTxWI->txop= Txopmode; + pTxWI->txop = Txopmode; pTxWI->NSEQ = NSeq; // John tune the performace with Intel Client in 20 MHz performance BASize = pAd->CommonCfg.TxBASize; - if (pAd->MACVersion == 0x28720200) - { - if( BASize >13 ) - BASize =13; - } - else - { - if( BASize >7 ) - BASize =7; + if (pAd->MACVersion == 0x28720200) { + if (BASize > 13) + BASize = 13; + } else { + if (BASize > 7) + BASize = 7; } pTxWI->BAWinSize = BASize; pTxWI->ShortGI = pTransmit->field.ShortGI; @@ -1081,38 +1020,34 @@ VOID RTMPWriteTxWI( pTxWI->PacketId = PID; // If CCK or OFDM, BW must be 20 - pTxWI->BW = (pTransmit->field.MODE <= MODE_OFDM) ? (BW_20) : (pTransmit->field.BW); + pTxWI->BW = + (pTransmit->field.MODE <= + MODE_OFDM) ? (BW_20) : (pTransmit->field.BW); pTxWI->MCS = pTransmit->field.MCS; pTxWI->PHYMODE = pTransmit->field.MODE; pTxWI->CFACK = CfAck; - if (pMac) - { - if (pAd->CommonCfg.bMIMOPSEnable) - { - if ((pMac->MmpsMode == MMPS_DYNAMIC) && (pTransmit->field.MCS > 7)) - { + if (pMac) { + if (pAd->CommonCfg.bMIMOPSEnable) { + if ((pMac->MmpsMode == MMPS_DYNAMIC) + && (pTransmit->field.MCS > 7)) { // Dynamic MIMO Power Save Mode pTxWI->MIMOps = 1; - } - else if (pMac->MmpsMode == MMPS_STATIC) - { + } else if (pMac->MmpsMode == MMPS_STATIC) { // Static MIMO Power Save Mode - if (pTransmit->field.MODE >= MODE_HTMIX && pTransmit->field.MCS > 7) - { + if (pTransmit->field.MODE >= MODE_HTMIX + && pTransmit->field.MCS > 7) { pTxWI->MCS = 7; pTxWI->MIMOps = 0; } } } //pTxWI->MIMOps = (pMac->PsMode == PWR_MMPS)? 1:0; - if (pMac->bIAmBadAtheros && (pMac->WepStatus != Ndis802_11WEPDisabled)) - { + if (pMac->bIAmBadAtheros + && (pMac->WepStatus != Ndis802_11WEPDisabled)) { pTxWI->MpduDensity = 7; - } - else - { + } else { pTxWI->MpduDensity = pMac->MpduDensity; } } @@ -1121,22 +1056,18 @@ VOID RTMPWriteTxWI( NdisMoveMemory(pOutTxWI, &TxWI, sizeof(TXWI_STRUC)); } - -VOID RTMPWriteTxWI_Data( - IN PRTMP_ADAPTER pAd, - IN OUT PTXWI_STRUC pTxWI, - IN TX_BLK *pTxBlk) +VOID RTMPWriteTxWI_Data(IN PRTMP_ADAPTER pAd, + IN OUT PTXWI_STRUC pTxWI, IN TX_BLK * pTxBlk) { - HTTRANSMIT_SETTING *pTransmit; - PMAC_TABLE_ENTRY pMacEntry; - UCHAR BASize; + HTTRANSMIT_SETTING *pTransmit; + PMAC_TABLE_ENTRY pMacEntry; + UCHAR BASize; ASSERT(pTxWI); pTransmit = pTxBlk->pTransmit; pMacEntry = pTxBlk->pMacEntry; - // // Always use Long preamble before verifiation short preamble functionality works well. // Todo: remove the following line if short preamble functionality works @@ -1144,26 +1075,28 @@ VOID RTMPWriteTxWI_Data( OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); NdisZeroMemory(pTxWI, TXWI_SIZE); - pTxWI->FRAG = TX_BLK_TEST_FLAG(pTxBlk, fTX_bAllowFrag); - pTxWI->ACK = TX_BLK_TEST_FLAG(pTxBlk, fTX_bAckRequired); - pTxWI->txop = pTxBlk->FrameGap; + pTxWI->FRAG = TX_BLK_TEST_FLAG(pTxBlk, fTX_bAllowFrag); + pTxWI->ACK = TX_BLK_TEST_FLAG(pTxBlk, fTX_bAckRequired); + pTxWI->txop = pTxBlk->FrameGap; - pTxWI->WirelessCliID = pTxBlk->Wcid; + pTxWI->WirelessCliID = pTxBlk->Wcid; - pTxWI->MPDUtotalByteCount = pTxBlk->MpduHeaderLen + pTxBlk->SrcBufLen; - pTxWI->CFACK = TX_BLK_TEST_FLAG(pTxBlk, fTX_bPiggyBack); + pTxWI->MPDUtotalByteCount = pTxBlk->MpduHeaderLen + pTxBlk->SrcBufLen; + pTxWI->CFACK = TX_BLK_TEST_FLAG(pTxBlk, fTX_bPiggyBack); // If CCK or OFDM, BW must be 20 - pTxWI->BW = (pTransmit->field.MODE <= MODE_OFDM) ? (BW_20) : (pTransmit->field.BW); - pTxWI->AMPDU = ((pTxBlk->TxFrameType == TX_AMPDU_FRAME) ? TRUE : FALSE); + pTxWI->BW = + (pTransmit->field.MODE <= + MODE_OFDM) ? (BW_20) : (pTransmit->field.BW); + pTxWI->AMPDU = ((pTxBlk->TxFrameType == TX_AMPDU_FRAME) ? TRUE : FALSE); // John tune the performace with Intel Client in 20 MHz performance BASize = pAd->CommonCfg.TxBASize; - if((pTxBlk->TxFrameType == TX_AMPDU_FRAME) && (pMacEntry)) - { - UCHAR RABAOriIdx = 0; //The RA's BA Originator table index. + if ((pTxBlk->TxFrameType == TX_AMPDU_FRAME) && (pMacEntry)) { + UCHAR RABAOriIdx = 0; //The RA's BA Originator table index. - RABAOriIdx = pTxBlk->pMacEntry->BAOriWcidArray[pTxBlk->UserPriority]; + RABAOriIdx = + pTxBlk->pMacEntry->BAOriWcidArray[pTxBlk->UserPriority]; BASize = pAd->BATable.BAOriEntry[RABAOriIdx].BAWinSize; } @@ -1175,46 +1108,37 @@ VOID RTMPWriteTxWI_Data( pTxWI->MCS = pTransmit->field.MCS; pTxWI->PHYMODE = pTransmit->field.MODE; - if (pMacEntry) - { - if ((pMacEntry->MmpsMode == MMPS_DYNAMIC) && (pTransmit->field.MCS > 7)) - { + if (pMacEntry) { + if ((pMacEntry->MmpsMode == MMPS_DYNAMIC) + && (pTransmit->field.MCS > 7)) { // Dynamic MIMO Power Save Mode pTxWI->MIMOps = 1; - } - else if (pMacEntry->MmpsMode == MMPS_STATIC) - { + } else if (pMacEntry->MmpsMode == MMPS_STATIC) { // Static MIMO Power Save Mode - if (pTransmit->field.MODE >= MODE_HTMIX && pTransmit->field.MCS > 7) - { + if (pTransmit->field.MODE >= MODE_HTMIX + && pTransmit->field.MCS > 7) { pTxWI->MCS = 7; pTxWI->MIMOps = 0; } } - if (pMacEntry->bIAmBadAtheros && (pMacEntry->WepStatus != Ndis802_11WEPDisabled)) - { + if (pMacEntry->bIAmBadAtheros + && (pMacEntry->WepStatus != Ndis802_11WEPDisabled)) { pTxWI->MpduDensity = 7; - } - else - { + } else { pTxWI->MpduDensity = pMacEntry->MpduDensity; } } - // for rate adapation pTxWI->PacketId = pTxWI->MCS; } - -VOID RTMPWriteTxWI_Cache( - IN PRTMP_ADAPTER pAd, - IN OUT PTXWI_STRUC pTxWI, - IN TX_BLK *pTxBlk) +VOID RTMPWriteTxWI_Cache(IN PRTMP_ADAPTER pAd, + IN OUT PTXWI_STRUC pTxWI, IN TX_BLK * pTxBlk) { - PHTTRANSMIT_SETTING /*pTxHTPhyMode,*/ pTransmit; - PMAC_TABLE_ENTRY pMacEntry; + PHTTRANSMIT_SETTING /*pTxHTPhyMode, */ pTransmit; + PMAC_TABLE_ENTRY pMacEntry; // // update TXWI @@ -1225,12 +1149,13 @@ VOID RTMPWriteTxWI_Cache( //if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) //if (RTMPCheckEntryEnableAutoRateSwitch(pAd, pMacEntry)) //if (TX_BLK_TEST_FLAG(pTxBlk, fTX_AutoRateSwitch)) - if (pMacEntry->bAutoTxRateSwitch) - { + if (pMacEntry->bAutoTxRateSwitch) { pTxWI->txop = IFS_HTTXOP; // If CCK or OFDM, BW must be 20 - pTxWI->BW = (pTransmit->field.MODE <= MODE_OFDM) ? (BW_20) : (pTransmit->field.BW); + pTxWI->BW = + (pTransmit->field.MODE <= + MODE_OFDM) ? (BW_20) : (pTransmit->field.BW); pTxWI->ShortGI = pTransmit->field.ShortGI; pTxWI->STBC = pTransmit->field.STBC; @@ -1241,43 +1166,36 @@ VOID RTMPWriteTxWI_Cache( pTxWI->PacketId = pTransmit->field.MCS; } - pTxWI->AMPDU = ((pMacEntry->NoBADataCountDown == 0) ? TRUE: FALSE); + pTxWI->AMPDU = ((pMacEntry->NoBADataCountDown == 0) ? TRUE : FALSE); pTxWI->MIMOps = 0; - if (pAd->CommonCfg.bMIMOPSEnable) - { + if (pAd->CommonCfg.bMIMOPSEnable) { // MIMO Power Save Mode - if ((pMacEntry->MmpsMode == MMPS_DYNAMIC) && (pTransmit->field.MCS > 7)) - { + if ((pMacEntry->MmpsMode == MMPS_DYNAMIC) + && (pTransmit->field.MCS > 7)) { // Dynamic MIMO Power Save Mode pTxWI->MIMOps = 1; - } - else if (pMacEntry->MmpsMode == MMPS_STATIC) - { + } else if (pMacEntry->MmpsMode == MMPS_STATIC) { // Static MIMO Power Save Mode - if ((pTransmit->field.MODE >= MODE_HTMIX) && (pTransmit->field.MCS > 7)) - { + if ((pTransmit->field.MODE >= MODE_HTMIX) + && (pTransmit->field.MCS > 7)) { pTxWI->MCS = 7; pTxWI->MIMOps = 0; } } } - pTxWI->MPDUtotalByteCount = pTxBlk->MpduHeaderLen + pTxBlk->SrcBufLen; } - // should be called only when - // 1. MEADIA_CONNECTED // 2. AGGREGATION_IN_USED // 3. Fragmentation not in used // 4. either no previous frame (pPrevAddr1=NULL) .OR. previoud frame is aggregatible -BOOLEAN TxFrameIsAggregatible( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pPrevAddr1, - IN PUCHAR p8023hdr) +BOOLEAN TxFrameIsAggregatible(IN PRTMP_ADAPTER pAd, + IN PUCHAR pPrevAddr1, IN PUCHAR p8023hdr) { // can't aggregate EAPOL (802.1x) frame @@ -1288,15 +1206,14 @@ BOOLEAN TxFrameIsAggregatible( if (p8023hdr[0] & 0x01) return FALSE; - if (INFRA_ON(pAd)) // must be unicast to AP + if (INFRA_ON(pAd)) // must be unicast to AP return TRUE; - else if ((pPrevAddr1 == NULL) || MAC_ADDR_EQUAL(pPrevAddr1, p8023hdr)) // unicast to same STA + else if ((pPrevAddr1 == NULL) || MAC_ADDR_EQUAL(pPrevAddr1, p8023hdr)) // unicast to same STA return TRUE; else return FALSE; } - /* ======================================================================== @@ -1313,23 +1230,18 @@ BOOLEAN TxFrameIsAggregatible( ======================================================================== */ -BOOLEAN PeerIsAggreOn( - IN PRTMP_ADAPTER pAd, - IN ULONG TxRate, - IN PMAC_TABLE_ENTRY pMacEntry) +BOOLEAN PeerIsAggreOn(IN PRTMP_ADAPTER pAd, + IN ULONG TxRate, IN PMAC_TABLE_ENTRY pMacEntry) { - ULONG AFlags = (fCLIENT_STATUS_AMSDU_INUSED | fCLIENT_STATUS_AGGREGATION_CAPABLE); + ULONG AFlags = + (fCLIENT_STATUS_AMSDU_INUSED | fCLIENT_STATUS_AGGREGATION_CAPABLE); - if (pMacEntry != NULL && CLIENT_STATUS_TEST_FLAG(pMacEntry, AFlags)) - { - if (pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX) - { + if (pMacEntry != NULL && CLIENT_STATUS_TEST_FLAG(pMacEntry, AFlags)) { + if (pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX) { return TRUE; } - #ifdef AGGREGATION_SUPPORT - if (TxRate >= RATE_6 && pAd->CommonCfg.bAggregationCapable && (!(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_WMM_CAPABLE)))) - { // legacy Ralink Aggregation support + if (TxRate >= RATE_6 && pAd->CommonCfg.bAggregationCapable && (!(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_WMM_CAPABLE)))) { // legacy Ralink Aggregation support return TRUE; } #endif // AGGREGATION_SUPPORT // @@ -1339,7 +1251,6 @@ BOOLEAN PeerIsAggreOn( } - /* ======================================================================== @@ -1358,49 +1269,38 @@ BOOLEAN PeerIsAggreOn( ======================================================================== */ -PQUEUE_HEADER RTMPCheckTxSwQueue( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pQueIdx) +PQUEUE_HEADER RTMPCheckTxSwQueue(IN PRTMP_ADAPTER pAd, OUT PUCHAR pQueIdx) { - ULONG Number; + ULONG Number; // 2004-11-15 to be removed. test aggregation only -// if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED)) && (*pNumber < 2)) -// return NULL; +// if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED)) && (*pNumber < 2)) +// return NULL; Number = pAd->TxSwQueue[QID_AC_BK].Number - + pAd->TxSwQueue[QID_AC_BE].Number - + pAd->TxSwQueue[QID_AC_VI].Number - + pAd->TxSwQueue[QID_AC_VO].Number; + + pAd->TxSwQueue[QID_AC_BE].Number + + pAd->TxSwQueue[QID_AC_VI].Number + + pAd->TxSwQueue[QID_AC_VO].Number; - if (pAd->TxSwQueue[QID_AC_VO].Head != NULL) - { + if (pAd->TxSwQueue[QID_AC_VO].Head != NULL) { *pQueIdx = QID_AC_VO; return (&pAd->TxSwQueue[QID_AC_VO]); - } - else if (pAd->TxSwQueue[QID_AC_VI].Head != NULL) - { + } else if (pAd->TxSwQueue[QID_AC_VI].Head != NULL) { *pQueIdx = QID_AC_VI; return (&pAd->TxSwQueue[QID_AC_VI]); - } - else if (pAd->TxSwQueue[QID_AC_BE].Head != NULL) - { + } else if (pAd->TxSwQueue[QID_AC_BE].Head != NULL) { *pQueIdx = QID_AC_BE; return (&pAd->TxSwQueue[QID_AC_BE]); - } - else if (pAd->TxSwQueue[QID_AC_BK].Head != NULL) - { + } else if (pAd->TxSwQueue[QID_AC_BK].Head != NULL) { *pQueIdx = QID_AC_BK; return (&pAd->TxSwQueue[QID_AC_BK]); } - // No packet pending in Tx Sw queue *pQueIdx = QID_AC_BK; return (NULL); } - /* ======================================================================== @@ -1417,27 +1317,25 @@ PQUEUE_HEADER RTMPCheckTxSwQueue( ======================================================================== */ -VOID RTMPSuspendMsduTransmission( - IN PRTMP_ADAPTER pAd) +VOID RTMPSuspendMsduTransmission(IN PRTMP_ADAPTER pAd) { - DBGPRINT(RT_DEBUG_TRACE,("SCANNING, suspend MSDU transmission ...\n")); - + DBGPRINT(RT_DEBUG_TRACE, ("SCANNING, suspend MSDU transmission ...\n")); // // Before BSS_SCAN_IN_PROGRESS, we need to keep Current R66 value and // use Lowbound as R66 value on ScanNextChannel(...) // - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R66, &pAd->BbpTuning.R66CurrentValue); + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R66, + &pAd->BbpTuning.R66CurrentValue); // set BBP_R66 to 0x30/0x40 when scanning (AsicSwitchChannel will set R66 according to channel when scanning) //RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, (0x26 + GET_LNA_GAIN(pAd))); RTMPSetAGCInitValue(pAd, BW_20); RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); - //RTMP_IO_WRITE32(pAd, TX_CNTL_CSR, 0x000f0000); // abort all TX rings + //RTMP_IO_WRITE32(pAd, TX_CNTL_CSR, 0x000f0000); // abort all TX rings } - /* ======================================================================== @@ -1456,70 +1354,61 @@ VOID RTMPSuspendMsduTransmission( ======================================================================== */ -VOID RTMPResumeMsduTransmission( - IN PRTMP_ADAPTER pAd) +VOID RTMPResumeMsduTransmission(IN PRTMP_ADAPTER pAd) { -// UCHAR IrqState; - - DBGPRINT(RT_DEBUG_TRACE,("SCAN done, resume MSDU transmission ...\n")); +// UCHAR IrqState; + DBGPRINT(RT_DEBUG_TRACE, ("SCAN done, resume MSDU transmission ...\n")); // After finish BSS_SCAN_IN_PROGRESS, we need to restore Current R66 value // R66 should not be 0 - if (pAd->BbpTuning.R66CurrentValue == 0) - { + if (pAd->BbpTuning.R66CurrentValue == 0) { pAd->BbpTuning.R66CurrentValue = 0x38; DBGPRINT_ERR(("RTMPResumeMsduTransmission, R66CurrentValue=0...\n")); } - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, pAd->BbpTuning.R66CurrentValue); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, + pAd->BbpTuning.R66CurrentValue); RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); // sample, for IRQ LOCK to SEM LOCK // IrqState = pAd->irq_disabled; -// if (IrqState) -// RTMPDeQueuePacket(pAd, TRUE, NUM_OF_TX_RING, MAX_TX_PROCESS); +// if (IrqState) +// RTMPDeQueuePacket(pAd, TRUE, NUM_OF_TX_RING, MAX_TX_PROCESS); // else RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); } - -UINT deaggregate_AMSDU_announce( - IN PRTMP_ADAPTER pAd, - PNDIS_PACKET pPacket, - IN PUCHAR pData, - IN ULONG DataSize) +UINT deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, + PNDIS_PACKET pPacket, + IN PUCHAR pData, IN ULONG DataSize) { - USHORT PayloadSize; - USHORT SubFrameSize; - PHEADER_802_3 pAMSDUsubheader; - UINT nMSDU; - UCHAR Header802_3[14]; - - PUCHAR pPayload, pDA, pSA, pRemovedLLCSNAP; - PNDIS_PACKET pClonePacket; - + USHORT PayloadSize; + USHORT SubFrameSize; + PHEADER_802_3 pAMSDUsubheader; + UINT nMSDU; + UCHAR Header802_3[14]; + PUCHAR pPayload, pDA, pSA, pRemovedLLCSNAP; + PNDIS_PACKET pClonePacket; nMSDU = 0; - while (DataSize > LENGTH_802_3) - { + while (DataSize > LENGTH_802_3) { nMSDU++; //hex_dump("subheader", pData, 64); - pAMSDUsubheader = (PHEADER_802_3)pData; + pAMSDUsubheader = (PHEADER_802_3) pData; //pData += LENGTH_802_3; - PayloadSize = pAMSDUsubheader->Octet[1] + (pAMSDUsubheader->Octet[0]<<8); + PayloadSize = + pAMSDUsubheader->Octet[1] + + (pAMSDUsubheader->Octet[0] << 8); SubFrameSize = PayloadSize + LENGTH_802_3; - - if ((DataSize < SubFrameSize) || (PayloadSize > 1518 )) - { + if ((DataSize < SubFrameSize) || (PayloadSize > 1518)) { break; } - //DBGPRINT(RT_DEBUG_TRACE,("%d subframe: Size = %d\n", nMSDU, PayloadSize)); pPayload = pData + LENGTH_802_3; @@ -1527,55 +1416,58 @@ UINT deaggregate_AMSDU_announce( pSA = pData + MAC_ADDR_LEN; // convert to 802.3 header - CONVERT_TO_802_3(Header802_3, pDA, pSA, pPayload, PayloadSize, pRemovedLLCSNAP); + CONVERT_TO_802_3(Header802_3, pDA, pSA, pPayload, PayloadSize, + pRemovedLLCSNAP); - if ((Header802_3[12] == 0x88) && (Header802_3[13] == 0x8E) ) - { + if ((Header802_3[12] == 0x88) && (Header802_3[13] == 0x8E)) { /* avoid local heap overflow, use dyanamic allocation */ - MLME_QUEUE_ELEM *Elem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); - if (Elem != NULL) - { - memmove(Elem->Msg+(LENGTH_802_11 + LENGTH_802_1_H), pPayload, PayloadSize); - Elem->MsgLen = LENGTH_802_11 + LENGTH_802_1_H + PayloadSize; + MLME_QUEUE_ELEM *Elem = + (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), + MEM_ALLOC_FLAG); + if (Elem != NULL) { + memmove(Elem->Msg + + (LENGTH_802_11 + LENGTH_802_1_H), + pPayload, PayloadSize); + Elem->MsgLen = + LENGTH_802_11 + LENGTH_802_1_H + + PayloadSize; //WpaEAPOLKeyAction(pAd, Elem); - REPORT_MGMT_FRAME_TO_MLME(pAd, BSSID_WCID, Elem->Msg, Elem->MsgLen, 0, 0, 0, 0); - kfree(Elem); - } + REPORT_MGMT_FRAME_TO_MLME(pAd, BSSID_WCID, + Elem->Msg, + Elem->MsgLen, 0, 0, 0, + 0); + kfree(Elem); + } } { - if (pRemovedLLCSNAP) - { - pPayload -= LENGTH_802_3; - PayloadSize += LENGTH_802_3; - NdisMoveMemory(pPayload, &Header802_3[0], LENGTH_802_3); - } + if (pRemovedLLCSNAP) { + pPayload -= LENGTH_802_3; + PayloadSize += LENGTH_802_3; + NdisMoveMemory(pPayload, &Header802_3[0], + LENGTH_802_3); + } } pClonePacket = ClonePacket(pAd, pPacket, pPayload, PayloadSize); - if (pClonePacket) - { - ANNOUNCE_OR_FORWARD_802_3_PACKET(pAd, pClonePacket, RTMP_GET_PACKET_IF(pPacket)); + if (pClonePacket) { + ANNOUNCE_OR_FORWARD_802_3_PACKET(pAd, pClonePacket, + RTMP_GET_PACKET_IF + (pPacket)); } - // A-MSDU has padding to multiple of 4 including subframe header. // align SubFrameSize up to multiple of 4 - SubFrameSize = (SubFrameSize+3)&(~0x3); - + SubFrameSize = (SubFrameSize + 3) & (~0x3); - if (SubFrameSize > 1528 || SubFrameSize < 32) - { + if (SubFrameSize > 1528 || SubFrameSize < 32) { break; } - if (DataSize > SubFrameSize) - { + if (DataSize > SubFrameSize) { pData += SubFrameSize; DataSize -= SubFrameSize; - } - else - { + } else { // end of A-MSDU DataSize = 0; } @@ -1587,14 +1479,11 @@ UINT deaggregate_AMSDU_announce( return nMSDU; } - -UINT BA_Reorder_AMSDU_Annnounce( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket) +UINT BA_Reorder_AMSDU_Annnounce(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) { - PUCHAR pData; - USHORT DataSize; - UINT nMSDU = 0; + PUCHAR pData; + USHORT DataSize; + UINT nMSDU = 0; pData = (PUCHAR) GET_OS_PKT_DATAPTR(pPacket); DataSize = (USHORT) GET_OS_PKT_LEN(pPacket); @@ -1604,7 +1493,6 @@ UINT BA_Reorder_AMSDU_Annnounce( return nMSDU; } - /* ========================================================================== Description: @@ -1613,9 +1501,7 @@ UINT BA_Reorder_AMSDU_Annnounce( pEntry - pointer to the MAC entry; NULL is not found ========================================================================== */ -MAC_TABLE_ENTRY *MacTableLookup( - IN PRTMP_ADAPTER pAd, - PUCHAR pAddr) +MAC_TABLE_ENTRY *MacTableLookup(IN PRTMP_ADAPTER pAd, PUCHAR pAddr) { ULONG HashIdx; MAC_TABLE_ENTRY *pEntry = NULL; @@ -1623,30 +1509,27 @@ MAC_TABLE_ENTRY *MacTableLookup( HashIdx = MAC_ADDR_HASH_INDEX(pAddr); pEntry = pAd->MacTab.Hash[HashIdx]; - while (pEntry && (pEntry->ValidAsCLI || pEntry->ValidAsWDS || pEntry->ValidAsApCli || pEntry->ValidAsMesh)) - { - if (MAC_ADDR_EQUAL(pEntry->Addr, pAddr)) - { + while (pEntry + && (pEntry->ValidAsCLI || pEntry->ValidAsWDS + || pEntry->ValidAsApCli || pEntry->ValidAsMesh)) { + if (MAC_ADDR_EQUAL(pEntry->Addr, pAddr)) { break; - } - else + } else pEntry = pEntry->pNext; } return pEntry; } -MAC_TABLE_ENTRY *MacTableInsertEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR apidx, - IN BOOLEAN CleanAll) +MAC_TABLE_ENTRY *MacTableInsertEntry(IN PRTMP_ADAPTER pAd, + IN PUCHAR pAddr, + IN UCHAR apidx, IN BOOLEAN CleanAll) { UCHAR HashIdx; int i, FirstWcid; MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry; -// USHORT offset; -// ULONG addr; +// USHORT offset; +// ULONG addr; // if FULL, return if (pAd->MacTab.Size >= MAX_LEN_OF_MAC_TABLE) @@ -1659,18 +1542,16 @@ MAC_TABLE_ENTRY *MacTableInsertEntry( // allocate one MAC entry NdisAcquireSpinLock(&pAd->MacTabLock); - for (i = FirstWcid; i< MAX_LEN_OF_MAC_TABLE; i++) // skip entry#0 so that "entry index == AID" for fast lookup + for (i = FirstWcid; i < MAX_LEN_OF_MAC_TABLE; i++) // skip entry#0 so that "entry index == AID" for fast lookup { // pick up the first available vacancy if ((pAd->MacTab.Content[i].ValidAsCLI == FALSE) && - (pAd->MacTab.Content[i].ValidAsWDS == FALSE) && - (pAd->MacTab.Content[i].ValidAsApCli== FALSE) && - (pAd->MacTab.Content[i].ValidAsMesh == FALSE) - ) - { + (pAd->MacTab.Content[i].ValidAsWDS == FALSE) && + (pAd->MacTab.Content[i].ValidAsApCli == FALSE) && + (pAd->MacTab.Content[i].ValidAsMesh == FALSE) + ) { pEntry = &pAd->MacTab.Content[i]; - if (CleanAll == TRUE) - { + if (CleanAll == TRUE) { pEntry->MaxSupportedRate = RATE_11; pEntry->CurrTxRate = RATE_11; NdisZeroMemory(pEntry, sizeof(MAC_TABLE_ENTRY)); @@ -1690,27 +1571,37 @@ MAC_TABLE_ENTRY *MacTableInsertEntry( pEntry->bIAmBadAtheros = FALSE; pEntry->pAd = pAd; pEntry->CMTimerRunning = FALSE; - pEntry->EnqueueEapolStartTimerRunning = EAPOL_START_DISABLE; + pEntry->EnqueueEapolStartTimerRunning = + EAPOL_START_DISABLE; pEntry->RSNIE_Len = 0; - NdisZeroMemory(pEntry->R_Counter, sizeof(pEntry->R_Counter)); + NdisZeroMemory(pEntry->R_Counter, + sizeof(pEntry->R_Counter)); pEntry->ReTryCounter = PEER_MSG1_RETRY_TIMER_CTR; if (pEntry->ValidAsMesh) - pEntry->apidx = (apidx - MIN_NET_DEVICE_FOR_MESH); + pEntry->apidx = + (apidx - MIN_NET_DEVICE_FOR_MESH); else if (pEntry->ValidAsApCli) - pEntry->apidx = (apidx - MIN_NET_DEVICE_FOR_APCLI); + pEntry->apidx = + (apidx - MIN_NET_DEVICE_FOR_APCLI); else if (pEntry->ValidAsWDS) - pEntry->apidx = (apidx - MIN_NET_DEVICE_FOR_WDS); + pEntry->apidx = + (apidx - MIN_NET_DEVICE_FOR_WDS); else pEntry->apidx = apidx; { { pEntry->AuthMode = pAd->StaCfg.AuthMode; - pEntry->WepStatus = pAd->StaCfg.WepStatus; - pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; + pEntry->WepStatus = + pAd->StaCfg.WepStatus; + pEntry->PrivacyFilter = + Ndis802_11PrivFilterAcceptAll; #ifdef RTMP_MAC_PCI - AsicRemovePairwiseKeyEntry(pAd, pEntry->apidx, (UCHAR)i); + AsicRemovePairwiseKeyEntry(pAd, + pEntry-> + apidx, + (UCHAR) i); #endif // RTMP_MAC_PCI // } } @@ -1724,7 +1615,7 @@ MAC_TABLE_ENTRY *MacTableInsertEntry( COPY_MAC_ADDR(pEntry->Addr, pAddr); pEntry->Sst = SST_NOT_AUTH; pEntry->AuthState = AS_NOT_AUTH; - pEntry->Aid = (USHORT)i; //0; + pEntry->Aid = (USHORT) i; //0; pEntry->CapabilityInfo = 0; pEntry->PsMode = PWR_ACTIVE; pEntry->PsQIdleCount = 0; @@ -1733,28 +1624,23 @@ MAC_TABLE_ENTRY *MacTableInsertEntry( pEntry->ContinueTxFailCnt = 0; InitializeQueueHeader(&pEntry->PsQueue); - - pAd->MacTab.Size ++; + pAd->MacTab.Size++; // Add this entry into ASIC RX WCID search table RTMP_STA_ENTRY_ADD(pAd, pEntry); - - - DBGPRINT(RT_DEBUG_TRACE, ("MacTableInsertEntry - allocate entry #%d, Total= %d\n",i, pAd->MacTab.Size)); + DBGPRINT(RT_DEBUG_TRACE, + ("MacTableInsertEntry - allocate entry #%d, Total= %d\n", + i, pAd->MacTab.Size)); break; } } // add this MAC entry into HASH table - if (pEntry) - { + if (pEntry) { HashIdx = MAC_ADDR_HASH_INDEX(pAddr); - if (pAd->MacTab.Hash[HashIdx] == NULL) - { + if (pAd->MacTab.Hash[HashIdx] == NULL) { pAd->MacTab.Hash[HashIdx] = pEntry; - } - else - { + } else { pCurrEntry = pAd->MacTab.Hash[HashIdx]; while (pCurrEntry->pNext != NULL) pCurrEntry = pCurrEntry->pNext; @@ -1772,16 +1658,14 @@ MAC_TABLE_ENTRY *MacTableInsertEntry( Delete a specified client from MAC table ========================================================================== */ -BOOLEAN MacTableDeleteEntry( - IN PRTMP_ADAPTER pAd, - IN USHORT wcid, - IN PUCHAR pAddr) +BOOLEAN MacTableDeleteEntry(IN PRTMP_ADAPTER pAd, + IN USHORT wcid, IN PUCHAR pAddr) { USHORT HashIdx; MAC_TABLE_ENTRY *pEntry, *pPrevEntry, *pProbeEntry; BOOLEAN Cancelled; - //USHORT offset; // unused variable - //UCHAR j; // unused variable + //USHORT offset; // unused variable + //UCHAR j; // unused variable if (wcid >= MAX_LEN_OF_MAC_TABLE) return FALSE; @@ -1792,11 +1676,10 @@ BOOLEAN MacTableDeleteEntry( //pEntry = pAd->MacTab.Hash[HashIdx]; pEntry = &pAd->MacTab.Content[wcid]; - if (pEntry && (pEntry->ValidAsCLI || pEntry->ValidAsApCli || pEntry->ValidAsWDS || pEntry->ValidAsMesh - )) - { - if (MAC_ADDR_EQUAL(pEntry->Addr, pAddr)) - { + if (pEntry + && (pEntry->ValidAsCLI || pEntry->ValidAsApCli || pEntry->ValidAsWDS + || pEntry->ValidAsMesh)) { + if (MAC_ADDR_EQUAL(pEntry->Addr, pAddr)) { // Delete this entry from ASIC on-chip WCID Table RTMP_STA_ENTRY_MAC_RESET(pAd, wcid); @@ -1809,17 +1692,14 @@ BOOLEAN MacTableDeleteEntry( ASSERT(pProbeEntry); // update Hash list - do - { - if (pProbeEntry == pEntry) - { - if (pPrevEntry == NULL) - { - pAd->MacTab.Hash[HashIdx] = pEntry->pNext; - } - else - { - pPrevEntry->pNext = pEntry->pNext; + do { + if (pProbeEntry == pEntry) { + if (pPrevEntry == NULL) { + pAd->MacTab.Hash[HashIdx] = + pEntry->pNext; + } else { + pPrevEntry->pNext = + pEntry->pNext; } break; } @@ -1833,38 +1713,39 @@ BOOLEAN MacTableDeleteEntry( RTMP_STA_ENTRY_KEY_DEL(pAd, BSS0, wcid); + if (pEntry->EnqueueEapolStartTimerRunning != + EAPOL_START_DISABLE) { + RTMPCancelTimer(&pEntry-> + EnqueueStartForPSKTimer, + &Cancelled); + pEntry->EnqueueEapolStartTimerRunning = + EAPOL_START_DISABLE; + } - if (pEntry->EnqueueEapolStartTimerRunning != EAPOL_START_DISABLE) - { - RTMPCancelTimer(&pEntry->EnqueueStartForPSKTimer, &Cancelled); - pEntry->EnqueueEapolStartTimerRunning = EAPOL_START_DISABLE; - } - - - NdisZeroMemory(pEntry, sizeof(MAC_TABLE_ENTRY)); - pAd->MacTab.Size --; - DBGPRINT(RT_DEBUG_TRACE, ("MacTableDeleteEntry1 - Total= %d\n", pAd->MacTab.Size)); - } - else - { - DBGPRINT(RT_DEBUG_OFF, ("\n%s: Impossible Wcid = %d !!!!!\n", __func__, wcid)); + NdisZeroMemory(pEntry, sizeof(MAC_TABLE_ENTRY)); + pAd->MacTab.Size--; + DBGPRINT(RT_DEBUG_TRACE, + ("MacTableDeleteEntry1 - Total= %d\n", + pAd->MacTab.Size)); + } else { + DBGPRINT(RT_DEBUG_OFF, + ("\n%s: Impossible Wcid = %d !!!!!\n", + __func__, wcid)); } } NdisReleaseSpinLock(&pAd->MacTabLock); //Reset operating mode when no Sta. - if (pAd->MacTab.Size == 0) - { + if (pAd->MacTab.Size == 0) { pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode = 0; //AsicUpdateProtect(pAd, 0 /*pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode*/, (ALLN_SETPROTECT), TRUE, 0 /*pAd->MacTab.fAnyStationNonGF*/); - RTMP_UPDATE_PROTECT(pAd); // edit by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet + RTMP_UPDATE_PROTECT(pAd); // edit by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet } return TRUE; } - /* ========================================================================== Description: @@ -1872,23 +1753,18 @@ BOOLEAN MacTableDeleteEntry( the power-saving queues are freed here. ========================================================================== */ -VOID MacTableReset( - IN PRTMP_ADAPTER pAd) +VOID MacTableReset(IN PRTMP_ADAPTER pAd) { - int i; + int i; DBGPRINT(RT_DEBUG_TRACE, ("MacTableReset\n")); //NdisAcquireSpinLock(&pAd->MacTabLock); - - for (i=1; iMacTab.Content[i].ValidAsCLI == TRUE) - { - + if (pAd->MacTab.Content[i].ValidAsCLI == TRUE) { // free resources of BA BASessionTearDownALL(pAd, i); @@ -1915,22 +1791,19 @@ VOID MacTableReset( ========================================================================== */ -VOID AssocParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_ASSOC_REQ_STRUCT *AssocReq, - IN PUCHAR pAddr, - IN USHORT CapabilityInfo, - IN ULONG Timeout, - IN USHORT ListenIntv) +VOID AssocParmFill(IN PRTMP_ADAPTER pAd, + IN OUT MLME_ASSOC_REQ_STRUCT * AssocReq, + IN PUCHAR pAddr, + IN USHORT CapabilityInfo, + IN ULONG Timeout, IN USHORT ListenIntv) { COPY_MAC_ADDR(AssocReq->Addr, pAddr); // Add mask to support 802.11b mode only - AssocReq->CapabilityInfo = CapabilityInfo & SUPPORTED_CAPABILITY_INFO; // not cf-pollable, not cf-poll-request + AssocReq->CapabilityInfo = CapabilityInfo & SUPPORTED_CAPABILITY_INFO; // not cf-pollable, not cf-poll-request AssocReq->Timeout = Timeout; AssocReq->ListenIntv = ListenIntv; } - /* ========================================================================== Description: @@ -1939,17 +1812,14 @@ VOID AssocParmFill( ========================================================================== */ -VOID DisassocParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_DISASSOC_REQ_STRUCT *DisassocReq, - IN PUCHAR pAddr, - IN USHORT Reason) +VOID DisassocParmFill(IN PRTMP_ADAPTER pAd, + IN OUT MLME_DISASSOC_REQ_STRUCT * DisassocReq, + IN PUCHAR pAddr, IN USHORT Reason) { COPY_MAC_ADDR(DisassocReq->Addr, pAddr); DisassocReq->Reason = Reason; } - /* ======================================================================== @@ -1984,22 +1854,21 @@ VOID DisassocParmFill( ======================================================================== */ -BOOLEAN RTMPCheckDHCPFrame( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket) +BOOLEAN RTMPCheckDHCPFrame(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) { - PACKET_INFO PacketInfo; - ULONG NumberOfBytesRead = 0; - ULONG CurrentOffset = 0; - PVOID pVirtualAddress = NULL; - UINT NdisBufferLength; - PUCHAR pSrc; - USHORT Protocol; - UCHAR ByteOffset36 = 0; - UCHAR ByteOffset38 = 0; - BOOLEAN ReadFirstParm = TRUE; - - RTMP_QueryPacketInfo(pPacket, &PacketInfo, (PUCHAR *)&pVirtualAddress, &NdisBufferLength); + PACKET_INFO PacketInfo; + ULONG NumberOfBytesRead = 0; + ULONG CurrentOffset = 0; + PVOID pVirtualAddress = NULL; + UINT NdisBufferLength; + PUCHAR pSrc; + USHORT Protocol; + UCHAR ByteOffset36 = 0; + UCHAR ByteOffset38 = 0; + BOOLEAN ReadFirstParm = TRUE; + + RTMP_QueryPacketInfo(pPacket, &PacketInfo, (PUCHAR *) & pVirtualAddress, + &NdisBufferLength); NumberOfBytesRead += NdisBufferLength; pSrc = (PUCHAR) pVirtualAddress; @@ -2008,18 +1877,17 @@ BOOLEAN RTMPCheckDHCPFrame( // // Check DHCP & BOOTP protocol // - while (NumberOfBytesRead <= PacketInfo.TotalPacketLength) - { - if ((NumberOfBytesRead >= 35) && (ReadFirstParm == TRUE)) - { - CurrentOffset = 35 - (NumberOfBytesRead - NdisBufferLength); + while (NumberOfBytesRead <= PacketInfo.TotalPacketLength) { + if ((NumberOfBytesRead >= 35) && (ReadFirstParm == TRUE)) { + CurrentOffset = + 35 - (NumberOfBytesRead - NdisBufferLength); ByteOffset36 = *(pSrc + CurrentOffset); ReadFirstParm = FALSE; } - if (NumberOfBytesRead >= 37) - { - CurrentOffset = 37 - (NumberOfBytesRead - NdisBufferLength); + if (NumberOfBytesRead >= 37) { + CurrentOffset = + 37 - (NumberOfBytesRead - NdisBufferLength); ByteOffset38 = *(pSrc + CurrentOffset); //End of Read break; @@ -2028,32 +1896,27 @@ BOOLEAN RTMPCheckDHCPFrame( } // Check for DHCP & BOOTP protocol - if ((ByteOffset36 != 0x44) || (ByteOffset38 != 0x43)) - { + if ((ByteOffset36 != 0x44) || (ByteOffset38 != 0x43)) { // // 2054 (hex 0806) for ARP datagrams // if this packet is not ARP datagrams, then do nothing // ARP datagrams will also be duplicate at 1mb broadcast frames // - if (Protocol != 0x0806 ) + if (Protocol != 0x0806) return FALSE; - } + } return TRUE; } - -BOOLEAN RTMPCheckEtherType( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket) +BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) { - USHORT TypeLen; - UCHAR Byte0, Byte1; - PUCHAR pSrcBuf; - UINT32 pktLen; - UINT16 srcPort, dstPort; - BOOLEAN status = TRUE; - + USHORT TypeLen; + UCHAR Byte0, Byte1; + PUCHAR pSrcBuf; + UINT32 pktLen; + UINT16 srcPort, dstPort; + BOOLEAN status = TRUE; pSrcBuf = GET_OS_PKT_DATAPTR(pPacket); pktLen = GET_OS_PKT_LEN(pPacket); @@ -2067,30 +1930,26 @@ BOOLEAN RTMPCheckEtherType( pSrcBuf += LENGTH_802_3; // Skip the Ethernet Header. - if (TypeLen <= 1500) - { // 802.3, 802.3 LLC + if (TypeLen <= 1500) { // 802.3, 802.3 LLC /* - DestMAC(6) + SrcMAC(6) + Lenght(2) + - DSAP(1) + SSAP(1) + Control(1) + - if the DSAP = 0xAA, SSAP=0xAA, Contorl = 0x03, it has a 5-bytes SNAP header. - => + SNAP (5, OriginationID(3) + etherType(2)) - */ - if (pSrcBuf[0] == 0xAA && pSrcBuf[1] == 0xAA && pSrcBuf[2] == 0x03) - { - Sniff2BytesFromNdisBuffer((PNDIS_BUFFER)pSrcBuf, 6, &Byte0, &Byte1); + DestMAC(6) + SrcMAC(6) + Lenght(2) + + DSAP(1) + SSAP(1) + Control(1) + + if the DSAP = 0xAA, SSAP=0xAA, Contorl = 0x03, it has a 5-bytes SNAP header. + => + SNAP (5, OriginationID(3) + etherType(2)) + */ + if (pSrcBuf[0] == 0xAA && pSrcBuf[1] == 0xAA + && pSrcBuf[2] == 0x03) { + Sniff2BytesFromNdisBuffer((PNDIS_BUFFER) pSrcBuf, 6, + &Byte0, &Byte1); RTMP_SET_PACKET_LLCSNAP(pPacket, 1); - TypeLen = (USHORT)((Byte0 << 8) + Byte1); - pSrcBuf += 8; // Skip this LLC/SNAP header - } - else - { + TypeLen = (USHORT) ((Byte0 << 8) + Byte1); + pSrcBuf += 8; // Skip this LLC/SNAP header + } else { //It just has 3-byte LLC header, maybe a legacy ether type frame. we didn't handle it. } } - // If it's a VLAN packet, get the real Type/Length field. - if (TypeLen == 0x8100) - { + if (TypeLen == 0x8100) { /* 0x8100 means VLAN packets */ /* Dest. MAC Address (6-bytes) + @@ -2103,141 +1962,141 @@ BOOLEAN RTMPCheckEtherType( Frame Check Sequence (4-bytes) */ RTMP_SET_PACKET_VLAN(pPacket, 1); - Sniff2BytesFromNdisBuffer((PNDIS_BUFFER)pSrcBuf, 2, &Byte0, &Byte1); - TypeLen = (USHORT)((Byte0 << 8) + Byte1); + Sniff2BytesFromNdisBuffer((PNDIS_BUFFER) pSrcBuf, 2, &Byte0, + &Byte1); + TypeLen = (USHORT) ((Byte0 << 8) + Byte1); - pSrcBuf += 4; // Skip the VLAN Header. + pSrcBuf += 4; // Skip the VLAN Header. } - switch (TypeLen) - { - case 0x0800: - { - ASSERT((pktLen > 34)); - if (*(pSrcBuf + 9) == 0x11) - { // udp packet - ASSERT((pktLen > 34)); // 14 for ethernet header, 20 for IP header - - pSrcBuf += 20; // Skip the IP header - srcPort = OS_NTOHS(get_unaligned((PUINT16)(pSrcBuf))); - dstPort = OS_NTOHS(get_unaligned((PUINT16)(pSrcBuf+2))); - - if ((srcPort==0x44 && dstPort==0x43) || (srcPort==0x43 && dstPort==0x44)) - { //It's a BOOTP/DHCP packet - RTMP_SET_PACKET_DHCP(pPacket, 1); - } + switch (TypeLen) { + case 0x0800: + { + ASSERT((pktLen > 34)); + if (*(pSrcBuf + 9) == 0x11) { // udp packet + ASSERT((pktLen > 34)); // 14 for ethernet header, 20 for IP header + + pSrcBuf += 20; // Skip the IP header + srcPort = + OS_NTOHS(get_unaligned + ((PUINT16) (pSrcBuf))); + dstPort = + OS_NTOHS(get_unaligned + ((PUINT16) (pSrcBuf + 2))); + + if ((srcPort == 0x44 && dstPort == 0x43) || (srcPort == 0x43 && dstPort == 0x44)) { //It's a BOOTP/DHCP packet + RTMP_SET_PACKET_DHCP(pPacket, 1); } } - break; - case 0x0806: - { - //ARP Packet. - RTMP_SET_PACKET_DHCP(pPacket, 1); - } - break; - case 0x888e: - { - // EAPOL Packet. - RTMP_SET_PACKET_EAPOL(pPacket, 1); - } - break; - default: - status = FALSE; - break; + } + break; + case 0x0806: + { + //ARP Packet. + RTMP_SET_PACKET_DHCP(pPacket, 1); + } + break; + case 0x888e: + { + // EAPOL Packet. + RTMP_SET_PACKET_EAPOL(pPacket, 1); + } + break; + default: + status = FALSE; + break; } return status; } +VOID Update_Rssi_Sample(IN PRTMP_ADAPTER pAd, + IN RSSI_SAMPLE * pRssi, IN PRXWI_STRUC pRxWI) +{ + CHAR rssi0 = pRxWI->RSSI0; + CHAR rssi1 = pRxWI->RSSI1; + CHAR rssi2 = pRxWI->RSSI2; - -VOID Update_Rssi_Sample( - IN PRTMP_ADAPTER pAd, - IN RSSI_SAMPLE *pRssi, - IN PRXWI_STRUC pRxWI) - { - CHAR rssi0 = pRxWI->RSSI0; - CHAR rssi1 = pRxWI->RSSI1; - CHAR rssi2 = pRxWI->RSSI2; - - if (rssi0 != 0) - { - pRssi->LastRssi0 = ConvertToRssi(pAd, (CHAR)rssi0, RSSI_0); - pRssi->AvgRssi0X8 = (pRssi->AvgRssi0X8 - pRssi->AvgRssi0) + pRssi->LastRssi0; - pRssi->AvgRssi0 = pRssi->AvgRssi0X8 >> 3; + if (rssi0 != 0) { + pRssi->LastRssi0 = ConvertToRssi(pAd, (CHAR) rssi0, RSSI_0); + pRssi->AvgRssi0X8 = + (pRssi->AvgRssi0X8 - pRssi->AvgRssi0) + pRssi->LastRssi0; + pRssi->AvgRssi0 = pRssi->AvgRssi0X8 >> 3; } - if (rssi1 != 0) - { - pRssi->LastRssi1 = ConvertToRssi(pAd, (CHAR)rssi1, RSSI_1); - pRssi->AvgRssi1X8 = (pRssi->AvgRssi1X8 - pRssi->AvgRssi1) + pRssi->LastRssi1; - pRssi->AvgRssi1 = pRssi->AvgRssi1X8 >> 3; + if (rssi1 != 0) { + pRssi->LastRssi1 = ConvertToRssi(pAd, (CHAR) rssi1, RSSI_1); + pRssi->AvgRssi1X8 = + (pRssi->AvgRssi1X8 - pRssi->AvgRssi1) + pRssi->LastRssi1; + pRssi->AvgRssi1 = pRssi->AvgRssi1X8 >> 3; } - if (rssi2 != 0) - { - pRssi->LastRssi2 = ConvertToRssi(pAd, (CHAR)rssi2, RSSI_2); - pRssi->AvgRssi2X8 = (pRssi->AvgRssi2X8 - pRssi->AvgRssi2) + pRssi->LastRssi2; + if (rssi2 != 0) { + pRssi->LastRssi2 = ConvertToRssi(pAd, (CHAR) rssi2, RSSI_2); + pRssi->AvgRssi2X8 = + (pRssi->AvgRssi2X8 - pRssi->AvgRssi2) + pRssi->LastRssi2; pRssi->AvgRssi2 = pRssi->AvgRssi2X8 >> 3; } } - - // Normal legacy Rx packet indication -VOID Indicate_Legacy_Packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) +VOID Indicate_Legacy_Packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) { - PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; - UCHAR Header802_3[LENGTH_802_3]; + PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; + UCHAR Header802_3[LENGTH_802_3]; // 1. get 802.3 Header // 2. remove LLC - // a. pointer pRxBlk->pData to payload + // a. pointer pRxBlk->pData to payload // b. modify pRxBlk->DataSize RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(pRxBlk, Header802_3); - if (pRxBlk->DataSize > MAX_RX_PKT_LEN) - { + if (pRxBlk->DataSize > MAX_RX_PKT_LEN) { // release packet RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); return; } - STATS_INC_RX_PACKETS(pAd, FromWhichBSSID); #ifdef RTMP_MAC_USB - if (pAd->CommonCfg.bDisableReordering == 0) - { - PBA_REC_ENTRY pBAEntry; - ULONG Now32; - UCHAR Wcid = pRxBlk->pRxWI->WirelessCliID; - UCHAR TID = pRxBlk->pRxWI->TID; - USHORT Idx; + if (pAd->CommonCfg.bDisableReordering == 0) { + PBA_REC_ENTRY pBAEntry; + ULONG Now32; + UCHAR Wcid = pRxBlk->pRxWI->WirelessCliID; + UCHAR TID = pRxBlk->pRxWI->TID; + USHORT Idx; #define REORDERING_PACKET_TIMEOUT ((100 * OS_HZ)/1000) // system ticks -- 100 ms - if (Wcid < MAX_LEN_OF_MAC_TABLE) - { + if (Wcid < MAX_LEN_OF_MAC_TABLE) { Idx = pAd->MacTab.Content[Wcid].BARecWcidArray[TID]; - if (Idx != 0) - { + if (Idx != 0) { pBAEntry = &pAd->BATable.BARecEntry[Idx]; // update last rx time NdisGetSystemUpTime(&Now32); if ((pBAEntry->list.qlen > 0) && - RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+(REORDERING_PACKET_TIMEOUT))) - ) - { - DBGPRINT(RT_DEBUG_OFF, ("Indicate_Legacy_Packet():flush reordering_timeout_mpdus! RxWI->Flags=%d, pRxWI.TID=%d, RxD->AMPDU=%d!\n", - pRxBlk->Flags, pRxBlk->pRxWI->TID, pRxBlk->RxD.AMPDU)); - hex_dump("Dump the legacy Packet:", GET_OS_PKT_DATAPTR(pRxBlk->pRxPacket), 64); - ba_flush_reordering_timeout_mpdus(pAd, pBAEntry, Now32); + RTMP_TIME_AFTER((unsigned long)Now32, + (unsigned long)(pBAEntry-> + LastIndSeqAtTimer + + + (REORDERING_PACKET_TIMEOUT))) + ) { + DBGPRINT(RT_DEBUG_OFF, + ("Indicate_Legacy_Packet():flush reordering_timeout_mpdus! RxWI->Flags=%d, pRxWI.TID=%d, RxD->AMPDU=%d!\n", + pRxBlk->Flags, + pRxBlk->pRxWI->TID, + pRxBlk->RxD.AMPDU)); + hex_dump("Dump the legacy Packet:", + GET_OS_PKT_DATAPTR(pRxBlk-> + pRxPacket), + 64); + ba_flush_reordering_timeout_mpdus(pAd, + pBAEntry, + Now32); } } } @@ -2252,58 +2111,43 @@ VOID Indicate_Legacy_Packet( ANNOUNCE_OR_FORWARD_802_3_PACKET(pAd, pRxPacket, FromWhichBSSID); } - // Normal, AMPDU or AMSDU -VOID CmmRxnonRalinkFrameIndicate( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) +VOID CmmRxnonRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) { - if (RX_BLK_TEST_FLAG(pRxBlk, fRX_AMPDU) && (pAd->CommonCfg.bDisableReordering == 0)) - { + if (RX_BLK_TEST_FLAG(pRxBlk, fRX_AMPDU) + && (pAd->CommonCfg.bDisableReordering == 0)) { Indicate_AMPDU_Packet(pAd, pRxBlk, FromWhichBSSID); - } - else - { - if (RX_BLK_TEST_FLAG(pRxBlk, fRX_AMSDU)) - { + } else { + if (RX_BLK_TEST_FLAG(pRxBlk, fRX_AMSDU)) { // handle A-MSDU Indicate_AMSDU_Packet(pAd, pRxBlk, FromWhichBSSID); - } - else - { + } else { Indicate_Legacy_Packet(pAd, pRxBlk, FromWhichBSSID); } } } - -VOID CmmRxRalinkFrameIndicate( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) +VOID CmmRxRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, + IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) { - UCHAR Header802_3[LENGTH_802_3]; - UINT16 Msdu2Size; - UINT16 Payload1Size, Payload2Size; - PUCHAR pData2; - PNDIS_PACKET pPacket2 = NULL; - + UCHAR Header802_3[LENGTH_802_3]; + UINT16 Msdu2Size; + UINT16 Payload1Size, Payload2Size; + PUCHAR pData2; + PNDIS_PACKET pPacket2 = NULL; + Msdu2Size = *(pRxBlk->pData) + (*(pRxBlk->pData + 1) << 8); - Msdu2Size = *(pRxBlk->pData) + (*(pRxBlk->pData+1) << 8); - - if ((Msdu2Size <= 1536) && (Msdu2Size < pRxBlk->DataSize)) - { + if ((Msdu2Size <= 1536) && (Msdu2Size < pRxBlk->DataSize)) { /* skip two byte MSDU2 len */ pRxBlk->pData += 2; pRxBlk->DataSize -= 2; - } - else - { + } else { // release packet - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); + RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, + NDIS_STATUS_FAILURE); return; } @@ -2313,34 +2157,34 @@ VOID CmmRxRalinkFrameIndicate( ASSERT(pRxBlk->pRxPacket); // Ralink Aggregation frame - pAd->RalinkCounters.OneSecRxAggregationCount ++; + pAd->RalinkCounters.OneSecRxAggregationCount++; Payload1Size = pRxBlk->DataSize - Msdu2Size; Payload2Size = Msdu2Size - LENGTH_802_3; pData2 = pRxBlk->pData + Payload1Size + LENGTH_802_3; - pPacket2 = duplicate_pkt(pAd, (pData2-LENGTH_802_3), LENGTH_802_3, pData2, Payload2Size, FromWhichBSSID); + pPacket2 = + duplicate_pkt(pAd, (pData2 - LENGTH_802_3), LENGTH_802_3, pData2, + Payload2Size, FromWhichBSSID); - if (!pPacket2) - { + if (!pPacket2) { // release packet - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); + RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, + NDIS_STATUS_FAILURE); return; } - // update payload size of 1st packet pRxBlk->DataSize = Payload1Size; wlan_802_11_to_802_3_packet(pAd, pRxBlk, Header802_3, FromWhichBSSID); - ANNOUNCE_OR_FORWARD_802_3_PACKET(pAd, pRxBlk->pRxPacket, FromWhichBSSID); + ANNOUNCE_OR_FORWARD_802_3_PACKET(pAd, pRxBlk->pRxPacket, + FromWhichBSSID); - if (pPacket2) - { + if (pPacket2) { ANNOUNCE_OR_FORWARD_802_3_PACKET(pAd, pPacket2, FromWhichBSSID); } } - #define RESET_FRAGFRAME(_fragFrame) \ { \ _fragFrame.RxSize = 0; \ @@ -2349,81 +2193,76 @@ VOID CmmRxRalinkFrameIndicate( _fragFrame.Flags = 0; \ } - -PNDIS_PACKET RTMPDeFragmentDataFrame( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk) +PNDIS_PACKET RTMPDeFragmentDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) { - PHEADER_802_11 pHeader = pRxBlk->pHeader; - PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; - UCHAR *pData = pRxBlk->pData; - USHORT DataSize = pRxBlk->DataSize; - PNDIS_PACKET pRetPacket = NULL; - UCHAR *pFragBuffer = NULL; - BOOLEAN bReassDone = FALSE; - UCHAR HeaderRoom = 0; - + PHEADER_802_11 pHeader = pRxBlk->pHeader; + PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; + UCHAR *pData = pRxBlk->pData; + USHORT DataSize = pRxBlk->DataSize; + PNDIS_PACKET pRetPacket = NULL; + UCHAR *pFragBuffer = NULL; + BOOLEAN bReassDone = FALSE; + UCHAR HeaderRoom = 0; ASSERT(pHeader); - HeaderRoom = pData - (UCHAR *)pHeader; + HeaderRoom = pData - (UCHAR *) pHeader; // Re-assemble the fragmented packets - if (pHeader->Frag == 0) // Frag. Number is 0 : First frag or only one pkt + if (pHeader->Frag == 0) // Frag. Number is 0 : First frag or only one pkt { // the first pkt of fragment, record it. - if (pHeader->FC.MoreFrag) - { + if (pHeader->FC.MoreFrag) { ASSERT(pAd->FragFrame.pFragPacket); - pFragBuffer = GET_OS_PKT_DATAPTR(pAd->FragFrame.pFragPacket); - pAd->FragFrame.RxSize = DataSize + HeaderRoom; - NdisMoveMemory(pFragBuffer, pHeader, pAd->FragFrame.RxSize); + pFragBuffer = + GET_OS_PKT_DATAPTR(pAd->FragFrame.pFragPacket); + pAd->FragFrame.RxSize = DataSize + HeaderRoom; + NdisMoveMemory(pFragBuffer, pHeader, + pAd->FragFrame.RxSize); pAd->FragFrame.Sequence = pHeader->Sequence; - pAd->FragFrame.LastFrag = pHeader->Frag; // Should be 0 + pAd->FragFrame.LastFrag = pHeader->Frag; // Should be 0 ASSERT(pAd->FragFrame.LastFrag == 0); goto done; // end of processing this frame } - } - else //Middle & End of fragment + } else //Middle & End of fragment { if ((pHeader->Sequence != pAd->FragFrame.Sequence) || - (pHeader->Frag != (pAd->FragFrame.LastFrag + 1))) - { + (pHeader->Frag != (pAd->FragFrame.LastFrag + 1))) { // Fragment is not the same sequence or out of fragment number order // Reset Fragment control blk RESET_FRAGFRAME(pAd->FragFrame); - DBGPRINT(RT_DEBUG_ERROR, ("Fragment is not the same sequence or out of fragment number order.\n")); - goto done; // give up this frame - } - else if ((pAd->FragFrame.RxSize + DataSize) > MAX_FRAME_SIZE) - { + DBGPRINT(RT_DEBUG_ERROR, + ("Fragment is not the same sequence or out of fragment number order.\n")); + goto done; // give up this frame + } else if ((pAd->FragFrame.RxSize + DataSize) > MAX_FRAME_SIZE) { // Fragment frame is too large, it exeeds the maximum frame size. // Reset Fragment control blk RESET_FRAGFRAME(pAd->FragFrame); - DBGPRINT(RT_DEBUG_ERROR, ("Fragment frame is too large, it exeeds the maximum frame size.\n")); - goto done; // give up this frame + DBGPRINT(RT_DEBUG_ERROR, + ("Fragment frame is too large, it exeeds the maximum frame size.\n")); + goto done; // give up this frame } - - // + // // Broadcom AP(BCM94704AGR) will send out LLC in fragment's packet, LLC only can accpet at first fragment. // In this case, we will dropt it. // - if (NdisEqualMemory(pData, SNAP_802_1H, sizeof(SNAP_802_1H))) - { - DBGPRINT(RT_DEBUG_ERROR, ("Find another LLC at Middle or End fragment(SN=%d, Frag=%d)\n", pHeader->Sequence, pHeader->Frag)); - goto done; // give up this frame + if (NdisEqualMemory(pData, SNAP_802_1H, sizeof(SNAP_802_1H))) { + DBGPRINT(RT_DEBUG_ERROR, + ("Find another LLC at Middle or End fragment(SN=%d, Frag=%d)\n", + pHeader->Sequence, pHeader->Frag)); + goto done; // give up this frame } pFragBuffer = GET_OS_PKT_DATAPTR(pAd->FragFrame.pFragPacket); // concatenate this fragment into the re-assembly buffer - NdisMoveMemory((pFragBuffer + pAd->FragFrame.RxSize), pData, DataSize); - pAd->FragFrame.RxSize += DataSize; - pAd->FragFrame.LastFrag = pHeader->Frag; // Update fragment number + NdisMoveMemory((pFragBuffer + pAd->FragFrame.RxSize), pData, + DataSize); + pAd->FragFrame.RxSize += DataSize; + pAd->FragFrame.LastFrag = pHeader->Frag; // Update fragment number // Last fragment - if (pHeader->FC.MoreFrag == FALSE) - { + if (pHeader->FC.MoreFrag == FALSE) { bReassDone = TRUE; } } @@ -2434,24 +2273,22 @@ done: // return defragmented packet if packet is reassembled completely // otherwise return NULL - if (bReassDone) - { + if (bReassDone) { PNDIS_PACKET pNewFragPacket; // allocate a new packet buffer for fragment - pNewFragPacket = RTMP_AllocateFragPacketBuffer(pAd, RX_BUFFER_NORMSIZE); - if (pNewFragPacket) - { + pNewFragPacket = + RTMP_AllocateFragPacketBuffer(pAd, RX_BUFFER_NORMSIZE); + if (pNewFragPacket) { // update RxBlk pRetPacket = pAd->FragFrame.pFragPacket; pAd->FragFrame.pFragPacket = pNewFragPacket; - pRxBlk->pHeader = (PHEADER_802_11) GET_OS_PKT_DATAPTR(pRetPacket); - pRxBlk->pData = (UCHAR *)pRxBlk->pHeader + HeaderRoom; + pRxBlk->pHeader = + (PHEADER_802_11) GET_OS_PKT_DATAPTR(pRetPacket); + pRxBlk->pData = (UCHAR *) pRxBlk->pHeader + HeaderRoom; pRxBlk->DataSize = pAd->FragFrame.RxSize - HeaderRoom; pRxBlk->pRxPacket = pRetPacket; - } - else - { + } else { RESET_FRAGFRAME(pAd->FragFrame); } } @@ -2459,23 +2296,20 @@ done: return pRetPacket; } - -VOID Indicate_AMSDU_Packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) +VOID Indicate_AMSDU_Packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) { - UINT nMSDU; + UINT nMSDU; update_os_packet_info(pAd, pRxBlk, FromWhichBSSID); RTMP_SET_PACKET_IF(pRxBlk->pRxPacket, FromWhichBSSID); - nMSDU = deaggregate_AMSDU_announce(pAd, pRxBlk->pRxPacket, pRxBlk->pData, pRxBlk->DataSize); + nMSDU = + deaggregate_AMSDU_announce(pAd, pRxBlk->pRxPacket, pRxBlk->pData, + pRxBlk->DataSize); } -VOID Indicate_EAPOL_Packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) +VOID Indicate_EAPOL_Packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) { MAC_TABLE_ENTRY *pEntry = NULL; @@ -2485,22 +2319,21 @@ VOID Indicate_EAPOL_Packet( return; } - if (pEntry == NULL) - { - DBGPRINT(RT_DEBUG_WARN, ("Indicate_EAPOL_Packet: drop and release the invalid packet.\n")); + if (pEntry == NULL) { + DBGPRINT(RT_DEBUG_WARN, + ("Indicate_EAPOL_Packet: drop and release the invalid packet.\n")); // release packet - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); + RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, + NDIS_STATUS_FAILURE); return; } } #define BCN_TBTT_OFFSET 64 //defer 64 us -VOID ReSyncBeaconTime( - IN PRTMP_ADAPTER pAd) +VOID ReSyncBeaconTime(IN PRTMP_ADAPTER pAd) { - UINT32 Offset; - + UINT32 Offset; Offset = (pAd->TbttTickCount) % (BCN_TBTT_OFFSET); @@ -2510,23 +2343,18 @@ VOID ReSyncBeaconTime( // The updated BeaconInterval Value will affect Beacon Interval after two TBTT // beacasue the original BeaconInterval had been loaded into next TBTT_TIMER // - if (Offset == (BCN_TBTT_OFFSET-2)) - { + if (Offset == (BCN_TBTT_OFFSET - 2)) { BCN_TIME_CFG_STRUC csr; RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr.word); - csr.field.BeaconInterval = (pAd->CommonCfg.BeaconPeriod << 4) - 1 ; // ASIC register in units of 1/16 TU = 64us + csr.field.BeaconInterval = (pAd->CommonCfg.BeaconPeriod << 4) - 1; // ASIC register in units of 1/16 TU = 64us RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr.word); - } - else - { - if (Offset == (BCN_TBTT_OFFSET-1)) - { + } else { + if (Offset == (BCN_TBTT_OFFSET - 1)) { BCN_TIME_CFG_STRUC csr; RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr.word); - csr.field.BeaconInterval = (pAd->CommonCfg.BeaconPeriod) << 4; // ASIC register in units of 1/16 TU + csr.field.BeaconInterval = (pAd->CommonCfg.BeaconPeriod) << 4; // ASIC register in units of 1/16 TU RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr.word); } } } - diff --git a/drivers/staging/rt2860/common/cmm_data_pci.c b/drivers/staging/rt2860/common/cmm_data_pci.c index e9739b45ba37..f98f1a887201 100644 --- a/drivers/staging/rt2860/common/cmm_data_pci.c +++ b/drivers/staging/rt2860/common/cmm_data_pci.c @@ -32,20 +32,17 @@ */ #include "../rt_config.h" - -USHORT RtmpPCI_WriteTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN BOOLEAN bIsLast, - OUT USHORT *FreeNumber) +USHORT RtmpPCI_WriteTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN BOOLEAN bIsLast, OUT USHORT * FreeNumber) { - UCHAR *pDMAHeaderBufVA; - USHORT TxIdx, RetTxIdx; - PTXD_STRUC pTxD; - UINT32 BufBasePaLow; - PRTMP_TX_RING pTxRing; - USHORT hwHeaderLen; + UCHAR *pDMAHeaderBufVA; + USHORT TxIdx, RetTxIdx; + PTXD_STRUC pTxD; + UINT32 BufBasePaLow; + PRTMP_TX_RING pTxRing; + USHORT hwHeaderLen; // // get Tx Ring Resource @@ -53,20 +50,21 @@ USHORT RtmpPCI_WriteTxResource( pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; - BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); + BufBasePaLow = + RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); // copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer - if (pTxBlk->TxFrameType == TX_AMSDU_FRAME) - { + if (pTxBlk->TxFrameType == TX_AMSDU_FRAME) { //hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD; - hwHeaderLen = pTxBlk->MpduHeaderLen - LENGTH_AMSDU_SUBFRAMEHEAD + pTxBlk->HdrPadLen + LENGTH_AMSDU_SUBFRAMEHEAD; - } - else - { + hwHeaderLen = + pTxBlk->MpduHeaderLen - LENGTH_AMSDU_SUBFRAMEHEAD + + pTxBlk->HdrPadLen + LENGTH_AMSDU_SUBFRAMEHEAD; + } else { //hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); hwHeaderLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; } - NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, TXINFO_SIZE + TXWI_SIZE + hwHeaderLen); + NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, + TXINFO_SIZE + TXWI_SIZE + hwHeaderLen); pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket; pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; @@ -79,7 +77,7 @@ USHORT RtmpPCI_WriteTxResource( NdisZeroMemory(pTxD, TXD_SIZE); pTxD->SDPtr0 = BufBasePaLow; - pTxD->SDLen0 = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; // include padding + pTxD->SDLen0 = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; // include padding pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE); pTxD->SDLen1 = pTxBlk->SrcBufLen; pTxD->LastSec0 = 0; @@ -99,20 +97,18 @@ USHORT RtmpPCI_WriteTxResource( return RetTxIdx; } - -USHORT RtmpPCI_WriteSingleTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN BOOLEAN bIsLast, - OUT USHORT *FreeNumber) +USHORT RtmpPCI_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN BOOLEAN bIsLast, + OUT USHORT * FreeNumber) { - UCHAR *pDMAHeaderBufVA; - USHORT TxIdx, RetTxIdx; - PTXD_STRUC pTxD; - UINT32 BufBasePaLow; - PRTMP_TX_RING pTxRing; - USHORT hwHeaderLen; + UCHAR *pDMAHeaderBufVA; + USHORT TxIdx, RetTxIdx; + PTXD_STRUC pTxD; + UINT32 BufBasePaLow; + PRTMP_TX_RING pTxRing; + USHORT hwHeaderLen; // // get Tx Ring Resource @@ -120,13 +116,15 @@ USHORT RtmpPCI_WriteSingleTxResource( pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; - BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); + BufBasePaLow = + RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); // copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer //hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); hwHeaderLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; - NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, TXINFO_SIZE + TXWI_SIZE + hwHeaderLen); + NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, + TXINFO_SIZE + TXWI_SIZE + hwHeaderLen); pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket; pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; @@ -138,7 +136,7 @@ USHORT RtmpPCI_WriteSingleTxResource( NdisZeroMemory(pTxD, TXD_SIZE); pTxD->SDPtr0 = BufBasePaLow; - pTxD->SDLen0 = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; // include padding + pTxD->SDLen0 = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; // include padding pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE);; pTxD->SDLen1 = pTxBlk->SrcBufLen; pTxD->LastSec0 = 0; @@ -158,21 +156,18 @@ USHORT RtmpPCI_WriteSingleTxResource( return RetTxIdx; } - -USHORT RtmpPCI_WriteMultiTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR frameNum, - OUT USHORT *FreeNumber) +USHORT RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN UCHAR frameNum, OUT USHORT * FreeNumber) { BOOLEAN bIsLast; - UCHAR *pDMAHeaderBufVA; - USHORT TxIdx, RetTxIdx; - PTXD_STRUC pTxD; - UINT32 BufBasePaLow; - PRTMP_TX_RING pTxRing; - USHORT hwHdrLen; - UINT32 firstDMALen; + UCHAR *pDMAHeaderBufVA; + USHORT TxIdx, RetTxIdx; + PTXD_STRUC pTxD; + UINT32 BufBasePaLow; + PRTMP_TX_RING pTxRing; + USHORT hwHdrLen; + UINT32 firstDMALen; bIsLast = ((frameNum == (pTxBlk->TotalFrameNum - 1)) ? 1 : 0); @@ -182,25 +177,28 @@ USHORT RtmpPCI_WriteMultiTxResource( pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; - BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); + BufBasePaLow = + RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); - if (frameNum == 0) - { + if (frameNum == 0) { // copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer if (pTxBlk->TxFrameType == TX_AMSDU_FRAME) //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD; - hwHdrLen = pTxBlk->MpduHeaderLen - LENGTH_AMSDU_SUBFRAMEHEAD + pTxBlk->HdrPadLen + LENGTH_AMSDU_SUBFRAMEHEAD; + hwHdrLen = + pTxBlk->MpduHeaderLen - LENGTH_AMSDU_SUBFRAMEHEAD + + pTxBlk->HdrPadLen + LENGTH_AMSDU_SUBFRAMEHEAD; else if (pTxBlk->TxFrameType == TX_RALINK_FRAME) //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_ARALINK_HEADER_FIELD, 4)+LENGTH_ARALINK_HEADER_FIELD; - hwHdrLen = pTxBlk->MpduHeaderLen - LENGTH_ARALINK_HEADER_FIELD + pTxBlk->HdrPadLen + LENGTH_ARALINK_HEADER_FIELD; + hwHdrLen = + pTxBlk->MpduHeaderLen - + LENGTH_ARALINK_HEADER_FIELD + pTxBlk->HdrPadLen + + LENGTH_ARALINK_HEADER_FIELD; else //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); hwHdrLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; firstDMALen = TXINFO_SIZE + TXWI_SIZE + hwHdrLen; - } - else - { + } else { firstDMALen = pTxBlk->MpduHeaderLen; } @@ -216,7 +214,7 @@ USHORT RtmpPCI_WriteMultiTxResource( NdisZeroMemory(pTxD, TXD_SIZE); pTxD->SDPtr0 = BufBasePaLow; - pTxD->SDLen0 = firstDMALen; // include padding + pTxD->SDLen0 = firstDMALen; // include padding pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE);; pTxD->SDLen1 = pTxBlk->SrcBufLen; pTxD->LastSec0 = 0; @@ -224,7 +222,6 @@ USHORT RtmpPCI_WriteMultiTxResource( RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); - RetTxIdx = TxIdx; // // Update Tx index @@ -238,16 +235,13 @@ USHORT RtmpPCI_WriteMultiTxResource( } - -VOID RtmpPCI_FinalWriteTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN USHORT totalMPDUSize, - IN USHORT FirstTxIdx) +VOID RtmpPCI_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN USHORT totalMPDUSize, IN USHORT FirstTxIdx) { - PTXWI_STRUC pTxWI; - PRTMP_TX_RING pTxRing; + PTXWI_STRUC pTxWI; + PRTMP_TX_RING pTxRing; // // get Tx Ring Resource @@ -258,14 +252,11 @@ VOID RtmpPCI_FinalWriteTxResource( } - -VOID RtmpPCIDataLastTxIdx( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN USHORT LastTxIdx) +VOID RtmpPCIDataLastTxIdx(IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, IN USHORT LastTxIdx) { - PTXD_STRUC pTxD; - PRTMP_TX_RING pTxRing; + PTXD_STRUC pTxD; + PRTMP_TX_RING pTxRing; // // get Tx Ring Resource @@ -279,23 +270,19 @@ VOID RtmpPCIDataLastTxIdx( pTxD->LastSec1 = 1; - } - -USHORT RtmpPCI_WriteFragTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR fragNum, - OUT USHORT *FreeNumber) +USHORT RtmpPCI_WriteFragTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN UCHAR fragNum, OUT USHORT * FreeNumber) { - UCHAR *pDMAHeaderBufVA; - USHORT TxIdx, RetTxIdx; - PTXD_STRUC pTxD; - UINT32 BufBasePaLow; - PRTMP_TX_RING pTxRing; - USHORT hwHeaderLen; - UINT32 firstDMALen; + UCHAR *pDMAHeaderBufVA; + USHORT TxIdx, RetTxIdx; + PTXD_STRUC pTxD; + UINT32 BufBasePaLow; + PRTMP_TX_RING pTxRing; + USHORT hwHeaderLen; + UINT32 firstDMALen; // // Get Tx Ring Resource @@ -303,7 +290,8 @@ USHORT RtmpPCI_WriteFragTxResource( pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; - BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); + BufBasePaLow = + RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); // // Copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer @@ -314,21 +302,19 @@ USHORT RtmpPCI_WriteFragTxResource( firstDMALen = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, firstDMALen); - // // Build Tx Descriptor // pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; NdisZeroMemory(pTxD, TXD_SIZE); - if (fragNum == pTxBlk->TotalFragNum) - { + if (fragNum == pTxBlk->TotalFragNum) { pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket; pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; } pTxD->SDPtr0 = BufBasePaLow; - pTxD->SDLen0 = firstDMALen; // include padding + pTxD->SDLen0 = firstDMALen; // include padding pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE); pTxD->SDLen1 = pTxBlk->SrcBufLen; pTxD->LastSec0 = 0; @@ -336,7 +322,6 @@ USHORT RtmpPCI_WriteFragTxResource( RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); - RetTxIdx = TxIdx; pTxBlk->Priv += pTxBlk->SrcBufLen; @@ -352,22 +337,19 @@ USHORT RtmpPCI_WriteFragTxResource( } - /* Must be run in Interrupt context This function handle PCI specific TxDesc and cpu index update and kick the packet out. */ -int RtmpPCIMgmtKickOut( - IN RTMP_ADAPTER *pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket, - IN PUCHAR pSrcBufVA, - IN UINT SrcBufLen) +int RtmpPCIMgmtKickOut(IN RTMP_ADAPTER * pAd, + IN UCHAR QueIdx, + IN PNDIS_PACKET pPacket, + IN PUCHAR pSrcBufVA, IN UINT SrcBufLen) { - PTXD_STRUC pTxD; - ULONG SwIdx = pAd->MgmtRing.TxCpuIdx; + PTXD_STRUC pTxD; + ULONG SwIdx = pAd->MgmtRing.TxCpuIdx; - pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[SwIdx].AllocVa; + pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[SwIdx].AllocVa; pAd->MgmtRing.Cell[SwIdx].pNdisPacket = pPacket; pAd->MgmtRing.Cell[SwIdx].pNextNdisPacket = NULL; @@ -377,10 +359,10 @@ int RtmpPCIMgmtKickOut( pTxD->LastSec1 = 1; pTxD->DMADONE = 0; pTxD->SDLen1 = 0; - pTxD->SDPtr0 = PCI_MAP_SINGLE(pAd, pSrcBufVA, SrcBufLen, 0, PCI_DMA_TODEVICE); + pTxD->SDPtr0 = + PCI_MAP_SINGLE(pAd, pSrcBufVA, SrcBufLen, 0, PCI_DMA_TODEVICE); pTxD->SDLen0 = SrcBufLen; - //================================================================== /* DBGPRINT_RAW(RT_DEBUG_TRACE, ("MLMEHardTransmit\n")); for (i = 0; i < (TXWI_SIZE+24); i++) @@ -401,12 +383,11 @@ int RtmpPCIMgmtKickOut( // Increase TX_CTX_IDX, but write to register later. INC_RING_INDEX(pAd->MgmtRing.TxCpuIdx, MGMT_RING_SIZE); - RTMP_IO_WRITE32(pAd, TX_MGMTCTX_IDX, pAd->MgmtRing.TxCpuIdx); + RTMP_IO_WRITE32(pAd, TX_MGMTCTX_IDX, pAd->MgmtRing.TxCpuIdx); return 0; } - /* ======================================================================== @@ -424,18 +405,15 @@ int RtmpPCIMgmtKickOut( ======================================================================== */ -NDIS_STATUS RTMPCheckRxError( - IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHeader, - IN PRXWI_STRUC pRxWI, - IN PRT28XX_RXD_STRUC pRxD) +NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd, + IN PHEADER_802_11 pHeader, + IN PRXWI_STRUC pRxWI, IN PRT28XX_RXD_STRUC pRxD) { PCIPHER_KEY pWpaKey; INT dBm; // Phy errors & CRC errors - if (/*(pRxD->PhyErr) ||*/ (pRxD->Crc)) - { + if ( /*(pRxD->PhyErr) || */ (pRxD->Crc)) { // Check RSSI for Noise Hist statistic collection. dBm = (INT) (pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta; if (dBm <= -87) @@ -455,157 +433,166 @@ NDIS_STATUS RTMPCheckRxError( else if (dBm > -57) pAd->StaCfg.RPIDensity[7] += 1; - return(NDIS_STATUS_FAILURE); + return (NDIS_STATUS_FAILURE); } - // Add Rx size to channel load counter, we should ignore error counts pAd->StaCfg.CLBusyBytes += (pRxD->SDL0 + 14); // Drop ToDs promiscous frame, it is opened due to CCX 2 channel load statistics - if (pHeader != NULL) - { - if (pHeader->FC.ToDs) - { - return(NDIS_STATUS_FAILURE); + if (pHeader != NULL) { + if (pHeader->FC.ToDs) { + return (NDIS_STATUS_FAILURE); } } - // Drop not U2M frames, cant's drop here because we will drop beacon in this case // I am kind of doubting the U2M bit operation // if (pRxD->U2M == 0) - // return(NDIS_STATUS_FAILURE); + // return(NDIS_STATUS_FAILURE); // drop decyption fail frame - if (pRxD->CipherErr) - { - if (pRxD->CipherErr == 2) - {DBGPRINT_RAW(RT_DEBUG_TRACE,("pRxD ERROR: ICV ok but MICErr "));} - else if (pRxD->CipherErr == 1) - {DBGPRINT_RAW(RT_DEBUG_TRACE,("pRxD ERROR: ICV Err "));} - else if (pRxD->CipherErr == 3) - DBGPRINT_RAW(RT_DEBUG_TRACE,("pRxD ERROR: Key not valid ")); - - if (((pRxD->CipherErr & 1) == 1) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) - RTMPSendWirelessEvent(pAd, IW_ICV_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - - DBGPRINT_RAW(RT_DEBUG_TRACE,(" %d (len=%d, Mcast=%d, MyBss=%d, Wcid=%d, KeyId=%d)\n", - pRxD->CipherErr, - pRxD->SDL0, - pRxD->Mcast | pRxD->Bcast, - pRxD->MyBss, - pRxWI->WirelessCliID, -// CipherName[pRxD->CipherAlg], - pRxWI->KeyIndex)); + if (pRxD->CipherErr) { + if (pRxD->CipherErr == 2) { + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("pRxD ERROR: ICV ok but MICErr ")); + } else if (pRxD->CipherErr == 1) { + DBGPRINT_RAW(RT_DEBUG_TRACE, ("pRxD ERROR: ICV Err ")); + } else if (pRxD->CipherErr == 3) + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("pRxD ERROR: Key not valid ")); + + if (((pRxD->CipherErr & 1) == 1) + && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) + RTMPSendWirelessEvent(pAd, IW_ICV_ERROR_EVENT_FLAG, + pAd->MacTab.Content[BSSID_WCID]. + Addr, BSS0, 0); + + DBGPRINT_RAW(RT_DEBUG_TRACE, + (" %d (len=%d, Mcast=%d, MyBss=%d, Wcid=%d, KeyId=%d)\n", + pRxD->CipherErr, pRxD->SDL0, + pRxD->Mcast | pRxD->Bcast, pRxD->MyBss, + pRxWI->WirelessCliID, +// CipherName[pRxD->CipherAlg], + pRxWI->KeyIndex)); // // MIC Error // - if (pRxD->CipherErr == 2) - { + if (pRxD->CipherErr == 2) { pWpaKey = &pAd->SharedKey[BSS0][pRxWI->KeyIndex]; - if (pAd->StaCfg.WpaSupplicantUP) - WpaSendMicFailureToWpaSupplicant(pAd, - (pWpaKey->Type == PAIRWISEKEY) ? TRUE:FALSE); - else - RTMPReportMicError(pAd, pWpaKey); - - if (((pRxD->CipherErr & 2) == 2) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) - RTMPSendWirelessEvent(pAd, IW_MIC_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - - DBGPRINT_RAW(RT_DEBUG_ERROR,("Rx MIC Value error\n")); + if (pAd->StaCfg.WpaSupplicantUP) + WpaSendMicFailureToWpaSupplicant(pAd, + (pWpaKey-> + Type == + PAIRWISEKEY) ? + TRUE : FALSE); + else + RTMPReportMicError(pAd, pWpaKey); + + if (((pRxD->CipherErr & 2) == 2) + && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) + RTMPSendWirelessEvent(pAd, + IW_MIC_ERROR_EVENT_FLAG, + pAd->MacTab. + Content[BSSID_WCID].Addr, + BSS0, 0); + + DBGPRINT_RAW(RT_DEBUG_ERROR, ("Rx MIC Value error\n")); } if (pHeader == NULL) - return(NDIS_STATUS_SUCCESS); + return (NDIS_STATUS_SUCCESS); /*if ((pRxD->CipherAlg == CIPHER_AES) && - (pHeader->Sequence == pAd->FragFrame.Sequence)) - { - // - // Acceptable since the First FragFrame no CipherErr problem. - // - return(NDIS_STATUS_SUCCESS); - }*/ + (pHeader->Sequence == pAd->FragFrame.Sequence)) + { + // + // Acceptable since the First FragFrame no CipherErr problem. + // + return(NDIS_STATUS_SUCCESS); + } */ - return(NDIS_STATUS_FAILURE); + return (NDIS_STATUS_FAILURE); } - return(NDIS_STATUS_SUCCESS); + return (NDIS_STATUS_SUCCESS); } - -BOOLEAN RTMPFreeTXDUponTxDmaDone( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx) +BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx) { PRTMP_TX_RING pTxRing; - PTXD_STRUC pTxD; - PNDIS_PACKET pPacket; - UCHAR FREE = 0; - TXD_STRUC TxD, *pOriTxD; - //ULONG IrqFlags; - BOOLEAN bReschedule = FALSE; - + PTXD_STRUC pTxD; + PNDIS_PACKET pPacket; + UCHAR FREE = 0; + TXD_STRUC TxD, *pOriTxD; + //ULONG IrqFlags; + BOOLEAN bReschedule = FALSE; ASSERT(QueIdx < NUM_OF_TX_RING); pTxRing = &pAd->TxRing[QueIdx]; - RTMP_IO_READ32(pAd, TX_DTX_IDX0 + QueIdx * RINGREG_DIFF, &pTxRing->TxDmaIdx); - while (pTxRing->TxSwFreeIdx != pTxRing->TxDmaIdx) - { -// RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); + RTMP_IO_READ32(pAd, TX_DTX_IDX0 + QueIdx * RINGREG_DIFF, + &pTxRing->TxDmaIdx); + while (pTxRing->TxSwFreeIdx != pTxRing->TxDmaIdx) { +// RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); // static rate also need NICUpdateFifoStaCounters() function. //if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) - NICUpdateFifoStaCounters(pAd); + NICUpdateFifoStaCounters(pAd); /* Note : If (pAd->ate.bQATxStart == TRUE), we will never reach here. */ FREE++; - pTxD = (PTXD_STRUC) (pTxRing->Cell[pTxRing->TxSwFreeIdx].AllocVa); + pTxD = + (PTXD_STRUC) (pTxRing->Cell[pTxRing->TxSwFreeIdx].AllocVa); pOriTxD = pTxD; - NdisMoveMemory(&TxD, pTxD, sizeof(TXD_STRUC)); + NdisMoveMemory(&TxD, pTxD, sizeof(TXD_STRUC)); pTxD = &TxD; pTxD->DMADONE = 0; - { - pPacket = pTxRing->Cell[pTxRing->TxSwFreeIdx].pNdisPacket; - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); + pPacket = + pTxRing->Cell[pTxRing->TxSwFreeIdx].pNdisPacket; + if (pPacket) { + PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, + pTxD->SDLen1, + PCI_DMA_TODEVICE); + RELEASE_NDIS_PACKET(pAd, pPacket, + NDIS_STATUS_SUCCESS); } //Always assign pNdisPacket as NULL after clear pTxRing->Cell[pTxRing->TxSwFreeIdx].pNdisPacket = NULL; - pPacket = pTxRing->Cell[pTxRing->TxSwFreeIdx].pNextNdisPacket; + pPacket = + pTxRing->Cell[pTxRing->TxSwFreeIdx].pNextNdisPacket; ASSERT(pPacket == NULL); - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); + if (pPacket) { + PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, + pTxD->SDLen1, + PCI_DMA_TODEVICE); + RELEASE_NDIS_PACKET(pAd, pPacket, + NDIS_STATUS_SUCCESS); } //Always assign pNextNdisPacket as NULL after clear - pTxRing->Cell[pTxRing->TxSwFreeIdx].pNextNdisPacket = NULL; + pTxRing->Cell[pTxRing->TxSwFreeIdx].pNextNdisPacket = + NULL; } - pAd->RalinkCounters.TransmittedByteCount += (pTxD->SDLen1 + pTxD->SDLen0); - pAd->RalinkCounters.OneSecDmaDoneCount[QueIdx] ++; + pAd->RalinkCounters.TransmittedByteCount += + (pTxD->SDLen1 + pTxD->SDLen0); + pAd->RalinkCounters.OneSecDmaDoneCount[QueIdx]++; INC_RING_INDEX(pTxRing->TxSwFreeIdx, TX_RING_SIZE); /* get tx_tdx_idx again */ - RTMP_IO_READ32(pAd, TX_DTX_IDX0 + QueIdx * RINGREG_DIFF , &pTxRing->TxDmaIdx); - NdisMoveMemory(pOriTxD, pTxD, sizeof(TXD_STRUC)); + RTMP_IO_READ32(pAd, TX_DTX_IDX0 + QueIdx * RINGREG_DIFF, + &pTxRing->TxDmaIdx); + NdisMoveMemory(pOriTxD, pTxD, sizeof(TXD_STRUC)); // RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); } - - return bReschedule; + return bReschedule; } - /* ======================================================================== @@ -622,13 +609,12 @@ BOOLEAN RTMPFreeTXDUponTxDmaDone( ======================================================================== */ -BOOLEAN RTMPHandleTxRingDmaDoneInterrupt( - IN PRTMP_ADAPTER pAd, - IN INT_SOURCE_CSR_STRUC TxRingBitmap) +BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd, + IN INT_SOURCE_CSR_STRUC TxRingBitmap) { -// UCHAR Count = 0; - unsigned long IrqFlags; - BOOLEAN bReschedule = FALSE; +// UCHAR Count = 0; + unsigned long IrqFlags; + BOOLEAN bReschedule = FALSE; // Make sure Tx ring resource won't be used by other threads //NdisAcquireSpinLock(&pAd->TxRingLock); @@ -654,10 +640,9 @@ BOOLEAN RTMPHandleTxRingDmaDoneInterrupt( // Dequeue outgoing frames from TxSwQueue[] and process it RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); - return bReschedule; + return bReschedule; } - /* ======================================================================== @@ -676,37 +661,37 @@ BOOLEAN RTMPHandleTxRingDmaDoneInterrupt( ======================================================================== */ -VOID RTMPHandleMgmtRingDmaDoneInterrupt( - IN PRTMP_ADAPTER pAd) +VOID RTMPHandleMgmtRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd) { - PTXD_STRUC pTxD; + PTXD_STRUC pTxD; PNDIS_PACKET pPacket; -// int i; - UCHAR FREE = 0; +// int i; + UCHAR FREE = 0; PRTMP_MGMT_RING pMgmtRing = &pAd->MgmtRing; NdisAcquireSpinLock(&pAd->MgmtRingLock); RTMP_IO_READ32(pAd, TX_MGMTDTX_IDX, &pMgmtRing->TxDmaIdx); - while (pMgmtRing->TxSwFreeIdx!= pMgmtRing->TxDmaIdx) - { + while (pMgmtRing->TxSwFreeIdx != pMgmtRing->TxDmaIdx) { FREE++; - pTxD = (PTXD_STRUC) (pMgmtRing->Cell[pAd->MgmtRing.TxSwFreeIdx].AllocVa); + pTxD = + (PTXD_STRUC) (pMgmtRing->Cell[pAd->MgmtRing.TxSwFreeIdx]. + AllocVa); pTxD->DMADONE = 0; pPacket = pMgmtRing->Cell[pMgmtRing->TxSwFreeIdx].pNdisPacket; - - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, PCI_DMA_TODEVICE); + if (pPacket) { + PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, + PCI_DMA_TODEVICE); RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); } pMgmtRing->Cell[pMgmtRing->TxSwFreeIdx].pNdisPacket = NULL; - pPacket = pMgmtRing->Cell[pMgmtRing->TxSwFreeIdx].pNextNdisPacket; - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); + pPacket = + pMgmtRing->Cell[pMgmtRing->TxSwFreeIdx].pNextNdisPacket; + if (pPacket) { + PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, + PCI_DMA_TODEVICE); RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); } pMgmtRing->Cell[pMgmtRing->TxSwFreeIdx].pNextNdisPacket = NULL; @@ -717,7 +702,6 @@ VOID RTMPHandleMgmtRingDmaDoneInterrupt( } - /* ======================================================================== @@ -729,17 +713,14 @@ VOID RTMPHandleMgmtRingDmaDoneInterrupt( ======================================================================== */ -VOID RTMPHandleTBTTInterrupt( - IN PRTMP_ADAPTER pAd) +VOID RTMPHandleTBTTInterrupt(IN PRTMP_ADAPTER pAd) { { - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { } } } - /* ======================================================================== @@ -751,33 +732,29 @@ VOID RTMPHandleTBTTInterrupt( ======================================================================== */ -VOID RTMPHandlePreTBTTInterrupt( - IN PRTMP_ADAPTER pAd) +VOID RTMPHandlePreTBTTInterrupt(IN PRTMP_ADAPTER pAd) { { - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("RTMPHandlePreTBTTInterrupt...\n")); + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPHandlePreTBTTInterrupt...\n")); } } - } -VOID RTMPHandleRxCoherentInterrupt( - IN PRTMP_ADAPTER pAd) +VOID RTMPHandleRxCoherentInterrupt(IN PRTMP_ADAPTER pAd) { - WPDMA_GLO_CFG_STRUC GloCfg; + WPDMA_GLO_CFG_STRUC GloCfg; - if (pAd == NULL) - { + if (pAd == NULL) { DBGPRINT(RT_DEBUG_TRACE, ("====> pAd is NULL, return.\n")); return; } DBGPRINT(RT_DEBUG_TRACE, ("==> RTMPHandleRxCoherentInterrupt \n")); - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG , &GloCfg.word); + RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); GloCfg.field.EnTXWriteBackDDONE = 0; GloCfg.field.EnableRxDMA = 0; @@ -796,39 +773,38 @@ VOID RTMPHandleRxCoherentInterrupt( DBGPRINT(RT_DEBUG_TRACE, ("<== RTMPHandleRxCoherentInterrupt \n")); } -PNDIS_PACKET GetPacketFromRxRing( - IN PRTMP_ADAPTER pAd, - OUT PRT28XX_RXD_STRUC pSaveRxD, - OUT BOOLEAN *pbReschedule, - IN OUT UINT32 *pRxPending) +PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, + OUT PRT28XX_RXD_STRUC pSaveRxD, + OUT BOOLEAN * pbReschedule, + IN OUT UINT32 * pRxPending) { - PRXD_STRUC pRxD; - PNDIS_PACKET pRxPacket = NULL; - PNDIS_PACKET pNewPacket; - PVOID AllocVa; - NDIS_PHYSICAL_ADDRESS AllocPa; - BOOLEAN bReschedule = FALSE; - RTMP_DMACB *pRxCell; + PRXD_STRUC pRxD; + PNDIS_PACKET pRxPacket = NULL; + PNDIS_PACKET pNewPacket; + PVOID AllocVa; + NDIS_PHYSICAL_ADDRESS AllocPa; + BOOLEAN bReschedule = FALSE; + RTMP_DMACB *pRxCell; RTMP_SEM_LOCK(&pAd->RxRingLock); - if (*pRxPending == 0) - { + if (*pRxPending == 0) { // Get how may packets had been received - RTMP_IO_READ32(pAd, RX_DRX_IDX , &pAd->RxRing.RxDmaIdx); + RTMP_IO_READ32(pAd, RX_DRX_IDX, &pAd->RxRing.RxDmaIdx); - if (pAd->RxRing.RxSwReadIdx == pAd->RxRing.RxDmaIdx) - { + if (pAd->RxRing.RxSwReadIdx == pAd->RxRing.RxDmaIdx) { // no more rx packets bReschedule = FALSE; goto done; } - // get rx pending count if (pAd->RxRing.RxDmaIdx > pAd->RxRing.RxSwReadIdx) - *pRxPending = pAd->RxRing.RxDmaIdx - pAd->RxRing.RxSwReadIdx; + *pRxPending = + pAd->RxRing.RxDmaIdx - pAd->RxRing.RxSwReadIdx; else - *pRxPending = pAd->RxRing.RxDmaIdx + RX_RING_SIZE - pAd->RxRing.RxSwReadIdx; + *pRxPending = + pAd->RxRing.RxDmaIdx + RX_RING_SIZE - + pAd->RxRing.RxSwReadIdx; } @@ -837,36 +813,33 @@ PNDIS_PACKET GetPacketFromRxRing( // Point to Rx indexed rx ring descriptor pRxD = (PRXD_STRUC) pRxCell->AllocVa; - if (pRxD->DDONE == 0) - { + if (pRxD->DDONE == 0) { *pRxPending = 0; // DMAIndx had done but DDONE bit not ready bReschedule = TRUE; goto done; } - // return rx descriptor NdisMoveMemory(pSaveRxD, pRxD, RXD_SIZE); - pNewPacket = RTMP_AllocateRxPacketBuffer(pAd, RX_BUFFER_AGGRESIZE, FALSE, &AllocVa, &AllocPa); + pNewPacket = + RTMP_AllocateRxPacketBuffer(pAd, RX_BUFFER_AGGRESIZE, FALSE, + &AllocVa, &AllocPa); - if (pNewPacket) - { + if (pNewPacket) { // unmap the rx buffer PCI_UNMAP_SINGLE(pAd, pRxCell->DmaBuf.AllocPa, - pRxCell->DmaBuf.AllocSize, PCI_DMA_FROMDEVICE); + pRxCell->DmaBuf.AllocSize, PCI_DMA_FROMDEVICE); pRxPacket = pRxCell->pNdisPacket; - pRxCell->DmaBuf.AllocSize = RX_BUFFER_AGGRESIZE; - pRxCell->pNdisPacket = (PNDIS_PACKET) pNewPacket; - pRxCell->DmaBuf.AllocVa = AllocVa; - pRxCell->DmaBuf.AllocPa = AllocPa; + pRxCell->DmaBuf.AllocSize = RX_BUFFER_AGGRESIZE; + pRxCell->pNdisPacket = (PNDIS_PACKET) pNewPacket; + pRxCell->DmaBuf.AllocVa = AllocVa; + pRxCell->DmaBuf.AllocPa = AllocPa; /* update SDP0 to new buffer of rx packet */ pRxD->SDP0 = AllocPa; - } - else - { + } else { //DBGPRINT(RT_DEBUG_TRACE,("No Rx Buffer\n")); pRxPacket = NULL; bReschedule = TRUE; @@ -880,7 +853,9 @@ PNDIS_PACKET GetPacketFromRxRing( // update rx descriptor and kick rx INC_RING_INDEX(pAd->RxRing.RxSwReadIdx, RX_RING_SIZE); - pAd->RxRing.RxCpuIdx = (pAd->RxRing.RxSwReadIdx == 0) ? (RX_RING_SIZE-1) : (pAd->RxRing.RxSwReadIdx-1); + pAd->RxRing.RxCpuIdx = + (pAd->RxRing.RxSwReadIdx == + 0) ? (RX_RING_SIZE - 1) : (pAd->RxRing.RxSwReadIdx - 1); RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RxCpuIdx); done: @@ -889,55 +864,46 @@ done: return pRxPacket; } - -NDIS_STATUS MlmeHardTransmitTxRing( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket) +NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, IN PNDIS_PACKET pPacket) { - PACKET_INFO PacketInfo; - PUCHAR pSrcBufVA; - UINT SrcBufLen; - PTXD_STRUC pTxD; - PHEADER_802_11 pHeader_802_11; - BOOLEAN bAckRequired, bInsertTimestamp; - ULONG SrcBufPA; - //UCHAR TxBufIdx; - UCHAR MlmeRate; - ULONG SwIdx = pAd->TxRing[QueIdx].TxCpuIdx; - PTXWI_STRUC pFirstTxWI; - //ULONG i; - //HTTRANSMIT_SETTING MlmeTransmit; //Rate for this MGMT frame. - ULONG FreeNum; - MAC_TABLE_ENTRY *pMacEntry = NULL; - + PACKET_INFO PacketInfo; + PUCHAR pSrcBufVA; + UINT SrcBufLen; + PTXD_STRUC pTxD; + PHEADER_802_11 pHeader_802_11; + BOOLEAN bAckRequired, bInsertTimestamp; + ULONG SrcBufPA; + //UCHAR TxBufIdx; + UCHAR MlmeRate; + ULONG SwIdx = pAd->TxRing[QueIdx].TxCpuIdx; + PTXWI_STRUC pFirstTxWI; + //ULONG i; + //HTTRANSMIT_SETTING MlmeTransmit; //Rate for this MGMT frame. + ULONG FreeNum; + MAC_TABLE_ENTRY *pMacEntry = NULL; RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); - - if (pSrcBufVA == NULL) - { + if (pSrcBufVA == NULL) { // The buffer shouldn't be NULL return NDIS_STATUS_FAILURE; } - // Make sure MGMT ring resource won't be used by other threads //NdisAcquireSpinLock(&pAd->TxRingLock); FreeNum = GET_TXRING_FREENO(pAd, QueIdx); - if (FreeNum == 0) - { + if (FreeNum == 0) { //NdisReleaseSpinLock(&pAd->TxRingLock); return NDIS_STATUS_FAILURE; } SwIdx = pAd->TxRing[QueIdx].TxCpuIdx; - pTxD = (PTXD_STRUC) pAd->TxRing[QueIdx].Cell[SwIdx].AllocVa; + pTxD = (PTXD_STRUC) pAd->TxRing[QueIdx].Cell[SwIdx].AllocVa; - if (pAd->TxRing[QueIdx].Cell[SwIdx].pNdisPacket) - { + if (pAd->TxRing[QueIdx].Cell[SwIdx].pNdisPacket) { DBGPRINT(RT_DEBUG_OFF, ("MlmeHardTransmit Error\n")); //NdisReleaseSpinLock(&pAd->TxRingLock); return NDIS_STATUS_FAILURE; @@ -949,26 +915,21 @@ NDIS_STATUS MlmeHardTransmitTxRing( if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) AsicForceWakeup(pAd, TRUE); } - pFirstTxWI =(PTXWI_STRUC)pSrcBufVA; + pFirstTxWI = (PTXWI_STRUC) pSrcBufVA; pHeader_802_11 = (PHEADER_802_11) (pSrcBufVA + TXWI_SIZE); - if (pHeader_802_11->Addr1[0] & 0x01) - { + if (pHeader_802_11->Addr1[0] & 0x01) { MlmeRate = pAd->CommonCfg.BasicMlmeRate; - } - else - { + } else { MlmeRate = pAd->CommonCfg.MlmeRate; } if ((pHeader_802_11->FC.Type == BTYPE_DATA) && - (pHeader_802_11->FC.SubType == SUBTYPE_QOS_NULL)) - { + (pHeader_802_11->FC.SubType == SUBTYPE_QOS_NULL)) { pMacEntry = MacTableLookup(pAd, pHeader_802_11->Addr1); } - // Verify Mlme rate for a / g bands. - if ((pAd->LatchRfRegs.Channel > 14) && (MlmeRate < RATE_6)) // 11A band + if ((pAd->LatchRfRegs.Channel > 14) && (MlmeRate < RATE_6)) // 11A band MlmeRate = RATE_6; // @@ -978,37 +939,33 @@ NDIS_STATUS MlmeHardTransmitTxRing( // // // In WMM-UAPSD, mlme frame should be set psm as power saving but probe request frame - // Data-Null packets alse pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD - if (pHeader_802_11->FC.Type != BTYPE_DATA) - { - if ((pHeader_802_11->FC.SubType == SUBTYPE_PROBE_REQ) || !(pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable)) - { - pHeader_802_11->FC.PwrMgmt = PWR_ACTIVE; - } - else - { - pHeader_802_11->FC.PwrMgmt = pAd->CommonCfg.bAPSDForcePowerSave; + // Data-Null packets alse pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD + if (pHeader_802_11->FC.Type != BTYPE_DATA) { + if ((pHeader_802_11->FC.SubType == SUBTYPE_PROBE_REQ) + || !(pAd->CommonCfg.bAPSDCapable + && pAd->CommonCfg.APEdcaParm.bAPSDCapable)) { + pHeader_802_11->FC.PwrMgmt = PWR_ACTIVE; + } else { + pHeader_802_11->FC.PwrMgmt = + pAd->CommonCfg.bAPSDForcePowerSave; + } } - } bInsertTimestamp = FALSE; - if (pHeader_802_11->FC.Type == BTYPE_CNTL) // must be PS-POLL + if (pHeader_802_11->FC.Type == BTYPE_CNTL) // must be PS-POLL { bAckRequired = FALSE; - } - else // BTYPE_MGMT or BTYPE_DATA(must be NULL frame) + } else // BTYPE_MGMT or BTYPE_DATA(must be NULL frame) { - if (pHeader_802_11->Addr1[0] & 0x01) // MULTICAST, BROADCAST + if (pHeader_802_11->Addr1[0] & 0x01) // MULTICAST, BROADCAST { bAckRequired = FALSE; pHeader_802_11->Duration = 0; - } - else - { + } else { bAckRequired = TRUE; - pHeader_802_11->Duration = RTMPCalcDuration(pAd, MlmeRate, 14); - if (pHeader_802_11->FC.SubType == SUBTYPE_PROBE_RSP) - { + pHeader_802_11->Duration = + RTMPCalcDuration(pAd, MlmeRate, 14); + if (pHeader_802_11->FC.SubType == SUBTYPE_PROBE_RSP) { bInsertTimestamp = TRUE; } } @@ -1019,14 +976,13 @@ NDIS_STATUS MlmeHardTransmitTxRing( // Before radar detection done, mgmt frame can not be sent but probe req // Because we need to use probe req to trigger driver to send probe req in passive scan if ((pHeader_802_11->FC.SubType != SUBTYPE_PROBE_REQ) - && (pAd->CommonCfg.bIEEE80211H == 1) - && (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE)) - { - DBGPRINT(RT_DEBUG_ERROR,("MlmeHardTransmit --> radar detect not in normal mode !!!\n")); + && (pAd->CommonCfg.bIEEE80211H == 1) + && (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE)) { + DBGPRINT(RT_DEBUG_ERROR, + ("MlmeHardTransmit --> radar detect not in normal mode !!!\n")); //NdisReleaseSpinLock(&pAd->TxRingLock); return (NDIS_STATUS_FAILURE); } - // // fill scatter-and-gather buffer list into TXD. Internally created NDIS PACKET // should always has only one ohysical buffer, and the whole frame size equals @@ -1036,30 +992,30 @@ NDIS_STATUS MlmeHardTransmitTxRing( // Initialize TX Descriptor // For inter-frame gap, the number is for this frame and next frame // For MLME rate, we will fix as 2Mb to match other vendor's implement -// pAd->CommonCfg.MlmeTransmit.field.MODE = 1; +// pAd->CommonCfg.MlmeTransmit.field.MODE = 1; // management frame doesn't need encryption. so use RESERVED_WCID no matter u are sending to specific wcid or not. // Only beacon use Nseq=TRUE. So here we use Nseq=FALSE. - if (pMacEntry == NULL) - { - RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, bInsertTimestamp, FALSE, bAckRequired, FALSE, - 0, RESERVED_WCID, (SrcBufLen - TXWI_SIZE), PID_MGMT, 0, (UCHAR)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); - } - else - { + if (pMacEntry == NULL) { + RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, bInsertTimestamp, + FALSE, bAckRequired, FALSE, 0, RESERVED_WCID, + (SrcBufLen - TXWI_SIZE), PID_MGMT, 0, + (UCHAR) pAd->CommonCfg.MlmeTransmit.field.MCS, + IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); + } else { RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, - bInsertTimestamp, FALSE, bAckRequired, FALSE, - 0, pMacEntry->Aid, (SrcBufLen - TXWI_SIZE), - pMacEntry->MaxHTPhyMode.field.MCS, 0, - (UCHAR)pMacEntry->MaxHTPhyMode.field.MCS, - IFS_BACKOFF, FALSE, &pMacEntry->MaxHTPhyMode); + bInsertTimestamp, FALSE, bAckRequired, FALSE, + 0, pMacEntry->Aid, (SrcBufLen - TXWI_SIZE), + pMacEntry->MaxHTPhyMode.field.MCS, 0, + (UCHAR) pMacEntry->MaxHTPhyMode.field.MCS, + IFS_BACKOFF, FALSE, &pMacEntry->MaxHTPhyMode); } pAd->TxRing[QueIdx].Cell[SwIdx].pNdisPacket = pPacket; pAd->TxRing[QueIdx].Cell[SwIdx].pNextNdisPacket = NULL; -// pFirstTxWI->MPDUtotalByteCount = SrcBufLen - TXWI_SIZE; - SrcBufPA = PCI_MAP_SINGLE(pAd, pSrcBufVA, SrcBufLen, 0, PCI_DMA_TODEVICE); - +// pFirstTxWI->MPDUtotalByteCount = SrcBufLen - TXWI_SIZE; + SrcBufPA = + PCI_MAP_SINGLE(pAd, pSrcBufVA, SrcBufLen, 0, PCI_DMA_TODEVICE); RTMPWriteTxDescriptor(pAd, pTxD, TRUE, FIFO_EDCA); pTxD->LastSec0 = 1; @@ -1069,37 +1025,32 @@ NDIS_STATUS MlmeHardTransmitTxRing( pTxD->SDPtr0 = SrcBufPA; pTxD->DMADONE = 0; - pAd->RalinkCounters.KickTxCount++; pAd->RalinkCounters.OneSecTxDoneCount++; // Increase TX_CTX_IDX, but write to register later. INC_RING_INDEX(pAd->TxRing[QueIdx].TxCpuIdx, TX_RING_SIZE); - RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + QueIdx*0x10, pAd->TxRing[QueIdx].TxCpuIdx); + RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + QueIdx * 0x10, + pAd->TxRing[QueIdx].TxCpuIdx); // Make sure to release MGMT ring resource -// NdisReleaseSpinLock(&pAd->TxRingLock); +// NdisReleaseSpinLock(&pAd->TxRingLock); return NDIS_STATUS_SUCCESS; } - -NDIS_STATUS MlmeDataHardTransmit( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket) +NDIS_STATUS MlmeDataHardTransmit(IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, IN PNDIS_PACKET pPacket) { if ((pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) - ) - { + ) { return NDIS_STATUS_FAILURE; } - return MlmeHardTransmitTxRing(pAd,QueIdx,pPacket); + return MlmeHardTransmitTxRing(pAd, QueIdx, pPacket); } - /* ======================================================================== @@ -1127,11 +1078,9 @@ NDIS_STATUS MlmeDataHardTransmit( ======================================================================== */ -VOID RTMPWriteTxDescriptor( - IN PRTMP_ADAPTER pAd, - IN PTXD_STRUC pTxD, - IN BOOLEAN bWIV, - IN UCHAR QueueSEL) +VOID RTMPWriteTxDescriptor(IN PRTMP_ADAPTER pAd, + IN PTXD_STRUC pTxD, + IN BOOLEAN bWIV, IN UCHAR QueueSEL) { // // Always use Long preamble before verifiation short preamble functionality works well. @@ -1139,8 +1088,8 @@ VOID RTMPWriteTxDescriptor( // OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); - pTxD->WIV = (bWIV) ? 1: 0; - pTxD->QSEL= (QueueSEL); + pTxD->WIV = (bWIV) ? 1 : 0; + pTxD->QSEL = (QueueSEL); //RT2860c?? fixed using EDCA queue for test... We doubt Queue1 has problem. 2006-09-26 Jan //pTxD->QSEL= FIFO_EDCA; pTxD->DMADONE = 0; diff --git a/drivers/staging/rt2860/common/cmm_data_usb.c b/drivers/staging/rt2860/common/cmm_data_usb.c index bd6f9d8de9b8..fbcb3a37214b 100644 --- a/drivers/staging/rt2860/common/cmm_data_usb.c +++ b/drivers/staging/rt2860/common/cmm_data_usb.c @@ -33,52 +33,44 @@ #ifdef RTMP_MAC_USB - #include "../rt_config.h" - /* We can do copy the frame into pTxContext when match following conditions. => => => */ -static inline NDIS_STATUS RtmpUSBCanDoWrite( - IN RTMP_ADAPTER *pAd, - IN UCHAR QueIdx, - IN HT_TX_CONTEXT *pHTTXContext) +static inline NDIS_STATUS RtmpUSBCanDoWrite(IN RTMP_ADAPTER * pAd, + IN UCHAR QueIdx, + IN HT_TX_CONTEXT * pHTTXContext) { - NDIS_STATUS canWrite = NDIS_STATUS_RESOURCES; - - if (((pHTTXContext->CurWritePosition) < pHTTXContext->NextBulkOutPosition) && (pHTTXContext->CurWritePosition + LOCAL_TXBUF_SIZE) > pHTTXContext->NextBulkOutPosition) - { - DBGPRINT(RT_DEBUG_ERROR,("RtmpUSBCanDoWrite c1!\n")); - RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << QueIdx)); - } - else if ((pHTTXContext->CurWritePosition == 8) && (pHTTXContext->NextBulkOutPosition < LOCAL_TXBUF_SIZE)) - { - DBGPRINT(RT_DEBUG_ERROR,("RtmpUSBCanDoWrite c2!\n")); - RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << QueIdx)); - } - else if (pHTTXContext->bCurWriting == TRUE) - { - DBGPRINT(RT_DEBUG_ERROR,("RtmpUSBCanDoWrite c3!\n")); - } - else - { + NDIS_STATUS canWrite = NDIS_STATUS_RESOURCES; + + if (((pHTTXContext->CurWritePosition) < + pHTTXContext->NextBulkOutPosition) + && (pHTTXContext->CurWritePosition + LOCAL_TXBUF_SIZE) > + pHTTXContext->NextBulkOutPosition) { + DBGPRINT(RT_DEBUG_ERROR, ("RtmpUSBCanDoWrite c1!\n")); + RTUSB_SET_BULK_FLAG(pAd, + (fRTUSB_BULK_OUT_DATA_NORMAL << QueIdx)); + } else if ((pHTTXContext->CurWritePosition == 8) + && (pHTTXContext->NextBulkOutPosition < LOCAL_TXBUF_SIZE)) { + DBGPRINT(RT_DEBUG_ERROR, ("RtmpUSBCanDoWrite c2!\n")); + RTUSB_SET_BULK_FLAG(pAd, + (fRTUSB_BULK_OUT_DATA_NORMAL << QueIdx)); + } else if (pHTTXContext->bCurWriting == TRUE) { + DBGPRINT(RT_DEBUG_ERROR, ("RtmpUSBCanDoWrite c3!\n")); + } else { canWrite = NDIS_STATUS_SUCCESS; } - return canWrite; } - -USHORT RtmpUSB_WriteSubTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN BOOLEAN bIsLast, - OUT USHORT *FreeNumber) +USHORT RtmpUSB_WriteSubTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN BOOLEAN bIsLast, OUT USHORT * FreeNumber) { // Dummy function. Should be removed in the future. @@ -86,83 +78,80 @@ USHORT RtmpUSB_WriteSubTxResource( } -USHORT RtmpUSB_WriteFragTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR fragNum, - OUT USHORT *FreeNumber) +USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN UCHAR fragNum, OUT USHORT * FreeNumber) { - HT_TX_CONTEXT *pHTTXContext; - USHORT hwHdrLen; // The hwHdrLen consist of 802.11 header length plus the header padding length. - UINT32 fillOffset; - TXINFO_STRUC *pTxInfo; - TXWI_STRUC *pTxWI; - PUCHAR pWirelessPacket = NULL; - UCHAR QueIdx; - NDIS_STATUS Status; - unsigned long IrqFlags; - UINT32 USBDMApktLen = 0, DMAHdrLen, padding; - BOOLEAN TxQLastRound = FALSE; + HT_TX_CONTEXT *pHTTXContext; + USHORT hwHdrLen; // The hwHdrLen consist of 802.11 header length plus the header padding length. + UINT32 fillOffset; + TXINFO_STRUC *pTxInfo; + TXWI_STRUC *pTxWI; + PUCHAR pWirelessPacket = NULL; + UCHAR QueIdx; + NDIS_STATUS Status; + unsigned long IrqFlags; + UINT32 USBDMApktLen = 0, DMAHdrLen, padding; + BOOLEAN TxQLastRound = FALSE; // // get Tx Ring Resource & Dma Buffer address // QueIdx = pTxBlk->QueIdx; - pHTTXContext = &pAd->TxContext[QueIdx]; + pHTTXContext = &pAd->TxContext[QueIdx]; RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); - pHTTXContext = &pAd->TxContext[QueIdx]; + pHTTXContext = &pAd->TxContext[QueIdx]; fillOffset = pHTTXContext->CurWritePosition; - if(fragNum == 0) - { + if (fragNum == 0) { // Check if we have enough space for this bulk-out batch. Status = RtmpUSBCanDoWrite(pAd, QueIdx, pHTTXContext); - if (Status == NDIS_STATUS_SUCCESS) - { + if (Status == NDIS_STATUS_SUCCESS) { pHTTXContext->bCurWriting = TRUE; // Reserve space for 8 bytes padding. - if ((pHTTXContext->ENextBulkOutPosition == pHTTXContext->CurWritePosition)) - { + if ((pHTTXContext->ENextBulkOutPosition == + pHTTXContext->CurWritePosition)) { pHTTXContext->ENextBulkOutPosition += 8; pHTTXContext->CurWritePosition += 8; fillOffset += 8; } pTxBlk->Priv = 0; - pHTTXContext->CurWriteRealPos = pHTTXContext->CurWritePosition; - } - else - { - RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); - - RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_FAILURE); - return(Status); + pHTTXContext->CurWriteRealPos = + pHTTXContext->CurWritePosition; + } else { + RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], + IrqFlags); + + RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, + NDIS_STATUS_FAILURE); + return (Status); } - } - else - { + } else { // For sub-sequent frames of this bulk-out batch. Just copy it to our bulk-out buffer. - Status = ((pHTTXContext->bCurWriting == TRUE) ? NDIS_STATUS_SUCCESS : NDIS_STATUS_FAILURE); - if (Status == NDIS_STATUS_SUCCESS) - { + Status = + ((pHTTXContext->bCurWriting == + TRUE) ? NDIS_STATUS_SUCCESS : NDIS_STATUS_FAILURE); + if (Status == NDIS_STATUS_SUCCESS) { fillOffset += pTxBlk->Priv; - } - else - { - RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); + } else { + RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], + IrqFlags); - RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_FAILURE); - return(Status); + RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, + NDIS_STATUS_FAILURE); + return (Status); } } - NdisZeroMemory((PUCHAR)(&pTxBlk->HeaderBuf[0]), TXINFO_SIZE); - pTxInfo = (PTXINFO_STRUC)(&pTxBlk->HeaderBuf[0]); - pTxWI= (PTXWI_STRUC)(&pTxBlk->HeaderBuf[TXINFO_SIZE]); + NdisZeroMemory((PUCHAR) (&pTxBlk->HeaderBuf[0]), TXINFO_SIZE); + pTxInfo = (PTXINFO_STRUC) (&pTxBlk->HeaderBuf[0]); + pTxWI = (PTXWI_STRUC) (&pTxBlk->HeaderBuf[TXINFO_SIZE]); - pWirelessPacket = &pHTTXContext->TransferBuffer->field.WirelessPacket[fillOffset]; + pWirelessPacket = + &pHTTXContext->TransferBuffer->field.WirelessPacket[fillOffset]; // copy TXWI + WLAN Header + LLC into DMA Header Buffer //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); @@ -177,23 +166,22 @@ USHORT RtmpUSB_WriteFragTxResource( pTxBlk->Priv += (TXINFO_SIZE + USBDMApktLen); // For TxInfo, the length of USBDMApktLen = TXWI_SIZE + 802.11 header + payload - RTMPWriteTxInfo(pAd, pTxInfo, (USHORT)(USBDMApktLen), FALSE, FIFO_EDCA, FALSE /*NextValid*/, FALSE); + RTMPWriteTxInfo(pAd, pTxInfo, (USHORT) (USBDMApktLen), FALSE, FIFO_EDCA, + FALSE /*NextValid */ , FALSE); - if (fragNum == pTxBlk->TotalFragNum) - { + if (fragNum == pTxBlk->TotalFragNum) { pTxInfo->USBDMATxburst = 0; - if ((pHTTXContext->CurWritePosition + pTxBlk->Priv + 3906)> MAX_TXBULK_LIMIT) - { + if ((pHTTXContext->CurWritePosition + pTxBlk->Priv + 3906) > + MAX_TXBULK_LIMIT) { pTxInfo->SwUseLastRound = 1; TxQLastRound = TRUE; } - } - else - { + } else { pTxInfo->USBDMATxburst = 1; } - NdisMoveMemory(pWirelessPacket, pTxBlk->HeaderBuf, TXINFO_SIZE + TXWI_SIZE + hwHdrLen); + NdisMoveMemory(pWirelessPacket, pTxBlk->HeaderBuf, + TXINFO_SIZE + TXWI_SIZE + hwHdrLen); pWirelessPacket += (TXINFO_SIZE + TXWI_SIZE + hwHdrLen); pHTTXContext->CurWriteRealPos += (TXINFO_SIZE + TXWI_SIZE + hwHdrLen); @@ -201,12 +189,11 @@ USHORT RtmpUSB_WriteFragTxResource( NdisMoveMemory(pWirelessPacket, pTxBlk->pSrcBufData, pTxBlk->SrcBufLen); - // Zero the last padding. + // Zero the last padding. pWirelessPacket += pTxBlk->SrcBufLen; NdisZeroMemory(pWirelessPacket, padding + 8); - if (fragNum == pTxBlk->TotalFragNum) - { + if (fragNum == pTxBlk->TotalFragNum) { RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); // Update the pHTTXContext->CurWritePosition. 3906 used to prevent the NextBulkOut is a A-RALINK/A-MSDU Frame. @@ -215,9 +202,8 @@ USHORT RtmpUSB_WriteFragTxResource( pHTTXContext->CurWritePosition = 8; pHTTXContext->CurWriteRealPos = pHTTXContext->CurWritePosition; - // Finally, set bCurWriting as FALSE - pHTTXContext->bCurWriting = FALSE; + pHTTXContext->bCurWriting = FALSE; RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); @@ -225,64 +211,59 @@ USHORT RtmpUSB_WriteFragTxResource( RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_SUCCESS); } - - return(Status); + return (Status); } - -USHORT RtmpUSB_WriteSingleTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN BOOLEAN bIsLast, - OUT USHORT *FreeNumber) +USHORT RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN BOOLEAN bIsLast, + OUT USHORT * FreeNumber) { - HT_TX_CONTEXT *pHTTXContext; - USHORT hwHdrLen; - UINT32 fillOffset; - TXINFO_STRUC *pTxInfo; - TXWI_STRUC *pTxWI; - PUCHAR pWirelessPacket; - UCHAR QueIdx; - unsigned long IrqFlags; - NDIS_STATUS Status; - UINT32 USBDMApktLen = 0, DMAHdrLen, padding; - BOOLEAN bTxQLastRound = FALSE; + HT_TX_CONTEXT *pHTTXContext; + USHORT hwHdrLen; + UINT32 fillOffset; + TXINFO_STRUC *pTxInfo; + TXWI_STRUC *pTxWI; + PUCHAR pWirelessPacket; + UCHAR QueIdx; + unsigned long IrqFlags; + NDIS_STATUS Status; + UINT32 USBDMApktLen = 0, DMAHdrLen, padding; + BOOLEAN bTxQLastRound = FALSE; // For USB, didn't need PCI_MAP_SINGLE() //SrcBufPA = PCI_MAP_SINGLE(pAd, (char *) pTxBlk->pSrcBufData, pTxBlk->SrcBufLen, PCI_DMA_TODEVICE); - // // get Tx Ring Resource & Dma Buffer address // QueIdx = pTxBlk->QueIdx; RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); - pHTTXContext = &pAd->TxContext[QueIdx]; + pHTTXContext = &pAd->TxContext[QueIdx]; fillOffset = pHTTXContext->CurWritePosition; - - // Check ring full. Status = RtmpUSBCanDoWrite(pAd, QueIdx, pHTTXContext); - if(Status == NDIS_STATUS_SUCCESS) - { + if (Status == NDIS_STATUS_SUCCESS) { pHTTXContext->bCurWriting = TRUE; - pTxInfo = (PTXINFO_STRUC)(&pTxBlk->HeaderBuf[0]); - pTxWI= (PTXWI_STRUC)(&pTxBlk->HeaderBuf[TXINFO_SIZE]); + pTxInfo = (PTXINFO_STRUC) (&pTxBlk->HeaderBuf[0]); + pTxWI = (PTXWI_STRUC) (&pTxBlk->HeaderBuf[TXINFO_SIZE]); // Reserve space for 8 bytes padding. - if ((pHTTXContext->ENextBulkOutPosition == pHTTXContext->CurWritePosition)) - { + if ((pHTTXContext->ENextBulkOutPosition == + pHTTXContext->CurWritePosition)) { pHTTXContext->ENextBulkOutPosition += 8; pHTTXContext->CurWritePosition += 8; fillOffset += 8; } pHTTXContext->CurWriteRealPos = pHTTXContext->CurWritePosition; - pWirelessPacket = &pHTTXContext->TransferBuffer->field.WirelessPacket[fillOffset]; + pWirelessPacket = + &pHTTXContext->TransferBuffer->field. + WirelessPacket[fillOffset]; // copy TXWI + WLAN Header + LLC into DMA Header Buffer //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); @@ -297,30 +278,34 @@ USHORT RtmpUSB_WriteSingleTxResource( pTxBlk->Priv = (TXINFO_SIZE + USBDMApktLen); // For TxInfo, the length of USBDMApktLen = TXWI_SIZE + 802.11 header + payload - RTMPWriteTxInfo(pAd, pTxInfo, (USHORT)(USBDMApktLen), FALSE, FIFO_EDCA, FALSE /*NextValid*/, FALSE); + RTMPWriteTxInfo(pAd, pTxInfo, (USHORT) (USBDMApktLen), FALSE, + FIFO_EDCA, FALSE /*NextValid */ , FALSE); - if ((pHTTXContext->CurWritePosition + 3906 + pTxBlk->Priv) > MAX_TXBULK_LIMIT) - { + if ((pHTTXContext->CurWritePosition + 3906 + pTxBlk->Priv) > + MAX_TXBULK_LIMIT) { pTxInfo->SwUseLastRound = 1; bTxQLastRound = TRUE; } - NdisMoveMemory(pWirelessPacket, pTxBlk->HeaderBuf, TXINFO_SIZE + TXWI_SIZE + hwHdrLen); + NdisMoveMemory(pWirelessPacket, pTxBlk->HeaderBuf, + TXINFO_SIZE + TXWI_SIZE + hwHdrLen); pWirelessPacket += (TXINFO_SIZE + TXWI_SIZE + hwHdrLen); // We unlock it here to prevent the first 8 bytes maybe over-writed issue. - // 1. First we got CurWritePosition but the first 8 bytes still not write to the pTxcontext. - // 2. An interrupt break our routine and handle bulk-out complete. - // 3. In the bulk-out compllete, it need to do another bulk-out, - // if the ENextBulkOutPosition is just the same as CurWritePosition, it will save the first 8 bytes from CurWritePosition, - // but the payload still not copyed. the pTxContext->SavedPad[] will save as allzero. and set the bCopyPad = TRUE. - // 4. Interrupt complete. + // 1. First we got CurWritePosition but the first 8 bytes still not write to the pTxcontext. + // 2. An interrupt break our routine and handle bulk-out complete. + // 3. In the bulk-out compllete, it need to do another bulk-out, + // if the ENextBulkOutPosition is just the same as CurWritePosition, it will save the first 8 bytes from CurWritePosition, + // but the payload still not copyed. the pTxContext->SavedPad[] will save as allzero. and set the bCopyPad = TRUE. + // 4. Interrupt complete. // 5. Our interrupted routine go back and fill the first 8 bytes to pTxContext. - // 6. Next time when do bulk-out, it found the bCopyPad==TRUE and will copy the SavedPad[] to pTxContext->NextBulkOutPosition. - // and the packet will wrong. - pHTTXContext->CurWriteRealPos += (TXINFO_SIZE + TXWI_SIZE + hwHdrLen); + // 6. Next time when do bulk-out, it found the bCopyPad==TRUE and will copy the SavedPad[] to pTxContext->NextBulkOutPosition. + // and the packet will wrong. + pHTTXContext->CurWriteRealPos += + (TXINFO_SIZE + TXWI_SIZE + hwHdrLen); RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); - NdisMoveMemory(pWirelessPacket, pTxBlk->pSrcBufData, pTxBlk->SrcBufLen); + NdisMoveMemory(pWirelessPacket, pTxBlk->pSrcBufData, + pTxBlk->SrcBufLen); pWirelessPacket += pTxBlk->SrcBufLen; NdisZeroMemory(pWirelessPacket, padding + 8); @@ -331,135 +316,144 @@ USHORT RtmpUSB_WriteSingleTxResource( pHTTXContext->CurWritePosition = 8; pHTTXContext->CurWriteRealPos = pHTTXContext->CurWritePosition; - pHTTXContext->bCurWriting = FALSE; + pHTTXContext->bCurWriting = FALSE; } - RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); - // succeed and release the skb buffer RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_SUCCESS); - return(Status); + return (Status); } - -USHORT RtmpUSB_WriteMultiTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR frameNum, - OUT USHORT *FreeNumber) +USHORT RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN UCHAR frameNum, OUT USHORT * FreeNumber) { - HT_TX_CONTEXT *pHTTXContext; - USHORT hwHdrLen; // The hwHdrLen consist of 802.11 header length plus the header padding length. - UINT32 fillOffset; - TXINFO_STRUC *pTxInfo; - TXWI_STRUC *pTxWI; - PUCHAR pWirelessPacket = NULL; - UCHAR QueIdx; - NDIS_STATUS Status; - unsigned long IrqFlags; - //UINT32 USBDMApktLen = 0, DMAHdrLen, padding; + HT_TX_CONTEXT *pHTTXContext; + USHORT hwHdrLen; // The hwHdrLen consist of 802.11 header length plus the header padding length. + UINT32 fillOffset; + TXINFO_STRUC *pTxInfo; + TXWI_STRUC *pTxWI; + PUCHAR pWirelessPacket = NULL; + UCHAR QueIdx; + NDIS_STATUS Status; + unsigned long IrqFlags; + //UINT32 USBDMApktLen = 0, DMAHdrLen, padding; // // get Tx Ring Resource & Dma Buffer address // QueIdx = pTxBlk->QueIdx; - pHTTXContext = &pAd->TxContext[QueIdx]; + pHTTXContext = &pAd->TxContext[QueIdx]; RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); - if(frameNum == 0) - { + if (frameNum == 0) { // Check if we have enough space for this bulk-out batch. Status = RtmpUSBCanDoWrite(pAd, QueIdx, pHTTXContext); - if (Status == NDIS_STATUS_SUCCESS) - { + if (Status == NDIS_STATUS_SUCCESS) { pHTTXContext->bCurWriting = TRUE; - pTxInfo = (PTXINFO_STRUC)(&pTxBlk->HeaderBuf[0]); - pTxWI= (PTXWI_STRUC)(&pTxBlk->HeaderBuf[TXINFO_SIZE]); - + pTxInfo = (PTXINFO_STRUC) (&pTxBlk->HeaderBuf[0]); + pTxWI = (PTXWI_STRUC) (&pTxBlk->HeaderBuf[TXINFO_SIZE]); // Reserve space for 8 bytes padding. - if ((pHTTXContext->ENextBulkOutPosition == pHTTXContext->CurWritePosition)) - { + if ((pHTTXContext->ENextBulkOutPosition == + pHTTXContext->CurWritePosition)) { pHTTXContext->CurWritePosition += 8; pHTTXContext->ENextBulkOutPosition += 8; } fillOffset = pHTTXContext->CurWritePosition; - pHTTXContext->CurWriteRealPos = pHTTXContext->CurWritePosition; + pHTTXContext->CurWriteRealPos = + pHTTXContext->CurWritePosition; - pWirelessPacket = &pHTTXContext->TransferBuffer->field.WirelessPacket[fillOffset]; + pWirelessPacket = + &pHTTXContext->TransferBuffer->field. + WirelessPacket[fillOffset]; // // Copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer // if (pTxBlk->TxFrameType == TX_AMSDU_FRAME) //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD; - hwHdrLen = pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD + pTxBlk->HdrPadLen + LENGTH_AMSDU_SUBFRAMEHEAD; + hwHdrLen = + pTxBlk->MpduHeaderLen - + LENGTH_AMSDU_SUBFRAMEHEAD + + pTxBlk->HdrPadLen + + LENGTH_AMSDU_SUBFRAMEHEAD; else if (pTxBlk->TxFrameType == TX_RALINK_FRAME) //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_ARALINK_HEADER_FIELD, 4)+LENGTH_ARALINK_HEADER_FIELD; - hwHdrLen = pTxBlk->MpduHeaderLen-LENGTH_ARALINK_HEADER_FIELD + pTxBlk->HdrPadLen + LENGTH_ARALINK_HEADER_FIELD; + hwHdrLen = + pTxBlk->MpduHeaderLen - + LENGTH_ARALINK_HEADER_FIELD + + pTxBlk->HdrPadLen + + LENGTH_ARALINK_HEADER_FIELD; else //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); - hwHdrLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; + hwHdrLen = + pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; // Update the pTxBlk->Priv. pTxBlk->Priv = TXINFO_SIZE + TXWI_SIZE + hwHdrLen; - // pTxInfo->USBDMApktLen now just a temp value and will to correct latter. - RTMPWriteTxInfo(pAd, pTxInfo, (USHORT)(pTxBlk->Priv), FALSE, FIFO_EDCA, FALSE /*NextValid*/, FALSE); + // pTxInfo->USBDMApktLen now just a temp value and will to correct latter. + RTMPWriteTxInfo(pAd, pTxInfo, (USHORT) (pTxBlk->Priv), + FALSE, FIFO_EDCA, FALSE /*NextValid */ , + FALSE); // Copy it. - NdisMoveMemory(pWirelessPacket, pTxBlk->HeaderBuf, pTxBlk->Priv); + NdisMoveMemory(pWirelessPacket, pTxBlk->HeaderBuf, + pTxBlk->Priv); pHTTXContext->CurWriteRealPos += pTxBlk->Priv; pWirelessPacket += pTxBlk->Priv; } - } - else - { // For sub-sequent frames of this bulk-out batch. Just copy it to our bulk-out buffer. - - Status = ((pHTTXContext->bCurWriting == TRUE) ? NDIS_STATUS_SUCCESS : NDIS_STATUS_FAILURE); - if (Status == NDIS_STATUS_SUCCESS) - { - fillOffset = (pHTTXContext->CurWritePosition + pTxBlk->Priv); - pWirelessPacket = &pHTTXContext->TransferBuffer->field.WirelessPacket[fillOffset]; + } else { // For sub-sequent frames of this bulk-out batch. Just copy it to our bulk-out buffer. + + Status = + ((pHTTXContext->bCurWriting == + TRUE) ? NDIS_STATUS_SUCCESS : NDIS_STATUS_FAILURE); + if (Status == NDIS_STATUS_SUCCESS) { + fillOffset = + (pHTTXContext->CurWritePosition + pTxBlk->Priv); + pWirelessPacket = + &pHTTXContext->TransferBuffer->field. + WirelessPacket[fillOffset]; //hwHdrLen = pTxBlk->MpduHeaderLen; - NdisMoveMemory(pWirelessPacket, pTxBlk->HeaderBuf, pTxBlk->MpduHeaderLen); + NdisMoveMemory(pWirelessPacket, pTxBlk->HeaderBuf, + pTxBlk->MpduHeaderLen); pWirelessPacket += (pTxBlk->MpduHeaderLen); pTxBlk->Priv += pTxBlk->MpduHeaderLen; - } - else - { // It should not happened now unless we are going to shutdown. - DBGPRINT(RT_DEBUG_ERROR, ("WriteMultiTxResource():bCurWriting is FALSE when handle sub-sequent frames.\n")); + } else { // It should not happened now unless we are going to shutdown. + DBGPRINT(RT_DEBUG_ERROR, + ("WriteMultiTxResource():bCurWriting is FALSE when handle sub-sequent frames.\n")); Status = NDIS_STATUS_FAILURE; } } - // We unlock it here to prevent the first 8 bytes maybe over-write issue. - // 1. First we got CurWritePosition but the first 8 bytes still not write to the pTxContext. - // 2. An interrupt break our routine and handle bulk-out complete. - // 3. In the bulk-out compllete, it need to do another bulk-out, - // if the ENextBulkOutPosition is just the same as CurWritePosition, it will save the first 8 bytes from CurWritePosition, - // but the payload still not copyed. the pTxContext->SavedPad[] will save as allzero. and set the bCopyPad = TRUE. - // 4. Interrupt complete. + // 1. First we got CurWritePosition but the first 8 bytes still not write to the pTxContext. + // 2. An interrupt break our routine and handle bulk-out complete. + // 3. In the bulk-out compllete, it need to do another bulk-out, + // if the ENextBulkOutPosition is just the same as CurWritePosition, it will save the first 8 bytes from CurWritePosition, + // but the payload still not copyed. the pTxContext->SavedPad[] will save as allzero. and set the bCopyPad = TRUE. + // 4. Interrupt complete. // 5. Our interrupted routine go back and fill the first 8 bytes to pTxContext. - // 6. Next time when do bulk-out, it found the bCopyPad==TRUE and will copy the SavedPad[] to pTxContext->NextBulkOutPosition. - // and the packet will wrong. + // 6. Next time when do bulk-out, it found the bCopyPad==TRUE and will copy the SavedPad[] to pTxContext->NextBulkOutPosition. + // and the packet will wrong. RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); - if (Status != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_ERROR,("WriteMultiTxResource: CWPos = %ld, NBOutPos = %ld.\n", pHTTXContext->CurWritePosition, pHTTXContext->NextBulkOutPosition)); + if (Status != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_ERROR, + ("WriteMultiTxResource: CWPos = %ld, NBOutPos = %ld.\n", + pHTTXContext->CurWritePosition, + pHTTXContext->NextBulkOutPosition)); goto done; } - // Copy the frame content into DMA buffer and update the pTxBlk->Priv NdisMoveMemory(pWirelessPacket, pTxBlk->pSrcBufData, pTxBlk->SrcBufLen); pWirelessPacket += pTxBlk->SrcBufLen; @@ -469,45 +463,46 @@ done: // Release the skb buffer here RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_SUCCESS); - return(Status); + return (Status); } - -VOID RtmpUSB_FinalWriteTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN USHORT totalMPDUSize, - IN USHORT TxIdx) +VOID RtmpUSB_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN USHORT totalMPDUSize, IN USHORT TxIdx) { - UCHAR QueIdx; - HT_TX_CONTEXT *pHTTXContext; - UINT32 fillOffset; - TXINFO_STRUC *pTxInfo; - TXWI_STRUC *pTxWI; - UINT32 USBDMApktLen, padding; - unsigned long IrqFlags; - PUCHAR pWirelessPacket; + UCHAR QueIdx; + HT_TX_CONTEXT *pHTTXContext; + UINT32 fillOffset; + TXINFO_STRUC *pTxInfo; + TXWI_STRUC *pTxWI; + UINT32 USBDMApktLen, padding; + unsigned long IrqFlags; + PUCHAR pWirelessPacket; QueIdx = pTxBlk->QueIdx; - pHTTXContext = &pAd->TxContext[QueIdx]; + pHTTXContext = &pAd->TxContext[QueIdx]; RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); - if (pHTTXContext->bCurWriting == TRUE) - { + if (pHTTXContext->bCurWriting == TRUE) { fillOffset = pHTTXContext->CurWritePosition; - if (((pHTTXContext->ENextBulkOutPosition == pHTTXContext->CurWritePosition) || ((pHTTXContext->ENextBulkOutPosition-8) == pHTTXContext->CurWritePosition)) - && (pHTTXContext->bCopySavePad == TRUE)) - pWirelessPacket = (PUCHAR)(&pHTTXContext->SavedPad[0]); + if (((pHTTXContext->ENextBulkOutPosition == + pHTTXContext->CurWritePosition) + || ((pHTTXContext->ENextBulkOutPosition - 8) == + pHTTXContext->CurWritePosition)) + && (pHTTXContext->bCopySavePad == TRUE)) + pWirelessPacket = (PUCHAR) (&pHTTXContext->SavedPad[0]); else - pWirelessPacket = (PUCHAR)(&pHTTXContext->TransferBuffer->field.WirelessPacket[fillOffset]); + pWirelessPacket = + (PUCHAR) (&pHTTXContext->TransferBuffer->field. + WirelessPacket[fillOffset]); // // Update TxInfo->USBDMApktLen , - // the length = TXWI_SIZE + 802.11_hdr + 802.11_hdr_pad + payload_of_all_batch_frames + Bulk-Out-padding + // the length = TXWI_SIZE + 802.11_hdr + 802.11_hdr_pad + payload_of_all_batch_frames + Bulk-Out-padding // - pTxInfo = (PTXINFO_STRUC)(pWirelessPacket); + pTxInfo = (PTXINFO_STRUC) (pWirelessPacket); // Calculate the bulk-out padding USBDMApktLen = pTxBlk->Priv - TXINFO_SIZE; @@ -518,51 +513,46 @@ VOID RtmpUSB_FinalWriteTxResource( // // Update TXWI->MPDUtotalByteCount , - // the length = 802.11 header + payload_of_all_batch_frames - pTxWI= (PTXWI_STRUC)(pWirelessPacket + TXINFO_SIZE); + // the length = 802.11 header + payload_of_all_batch_frames + pTxWI = (PTXWI_STRUC) (pWirelessPacket + TXINFO_SIZE); pTxWI->MPDUtotalByteCount = totalMPDUSize; // // Update the pHTTXContext->CurWritePosition // pHTTXContext->CurWritePosition += (TXINFO_SIZE + USBDMApktLen); - if ((pHTTXContext->CurWritePosition + 3906)> MAX_TXBULK_LIMIT) - { // Add 3906 for prevent the NextBulkOut packet size is a A-RALINK/A-MSDU Frame. + if ((pHTTXContext->CurWritePosition + 3906) > MAX_TXBULK_LIMIT) { // Add 3906 for prevent the NextBulkOut packet size is a A-RALINK/A-MSDU Frame. pHTTXContext->CurWritePosition = 8; pTxInfo->SwUseLastRound = 1; } pHTTXContext->CurWriteRealPos = pHTTXContext->CurWritePosition; - // - // Zero the last padding. + // Zero the last padding. // - pWirelessPacket = (&pHTTXContext->TransferBuffer->field.WirelessPacket[fillOffset + pTxBlk->Priv]); + pWirelessPacket = + (&pHTTXContext->TransferBuffer->field. + WirelessPacket[fillOffset + pTxBlk->Priv]); NdisZeroMemory(pWirelessPacket, padding + 8); // Finally, set bCurWriting as FALSE pHTTXContext->bCurWriting = FALSE; - } - else - { // It should not happened now unless we are going to shutdown. - DBGPRINT(RT_DEBUG_ERROR, ("FinalWriteTxResource():bCurWriting is FALSE when handle last frames.\n")); + } else { // It should not happened now unless we are going to shutdown. + DBGPRINT(RT_DEBUG_ERROR, + ("FinalWriteTxResource():bCurWriting is FALSE when handle last frames.\n")); } RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); } - -VOID RtmpUSBDataLastTxIdx( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN USHORT TxIdx) +VOID RtmpUSBDataLastTxIdx(IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, IN USHORT TxIdx) { // DO nothing for USB. } - /* When can do bulk-out: 1. TxSwFreeIdx < TX_RING_SIZE; @@ -571,45 +561,41 @@ VOID RtmpUSBDataLastTxIdx( Check if the CurWriting flag is FALSE, if it's FALSE, we can do kick out. */ -VOID RtmpUSBDataKickOut( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR QueIdx) +VOID RtmpUSBDataKickOut(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, IN UCHAR QueIdx) { RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << QueIdx)); RTUSBKickBulkOut(pAd); } - /* Must be run in Interrupt context This function handle RT2870 specific TxDesc and cpu index update and kick the packet out. */ -int RtmpUSBMgmtKickOut( - IN RTMP_ADAPTER *pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket, - IN PUCHAR pSrcBufVA, - IN UINT SrcBufLen) +int RtmpUSBMgmtKickOut(IN RTMP_ADAPTER * pAd, + IN UCHAR QueIdx, + IN PNDIS_PACKET pPacket, + IN PUCHAR pSrcBufVA, IN UINT SrcBufLen) { - PTXINFO_STRUC pTxInfo; - ULONG BulkOutSize; - UCHAR padLen; - PUCHAR pDest; - ULONG SwIdx = pAd->MgmtRing.TxCpuIdx; - PTX_CONTEXT pMLMEContext = (PTX_CONTEXT)pAd->MgmtRing.Cell[SwIdx].AllocVa; - unsigned long IrqFlags; + PTXINFO_STRUC pTxInfo; + ULONG BulkOutSize; + UCHAR padLen; + PUCHAR pDest; + ULONG SwIdx = pAd->MgmtRing.TxCpuIdx; + PTX_CONTEXT pMLMEContext = + (PTX_CONTEXT) pAd->MgmtRing.Cell[SwIdx].AllocVa; + unsigned long IrqFlags; - - pTxInfo = (PTXINFO_STRUC)(pSrcBufVA); + pTxInfo = (PTXINFO_STRUC) (pSrcBufVA); // Build our URB for USBD BulkOutSize = SrcBufLen; BulkOutSize = (BulkOutSize + 3) & (~3); - RTMPWriteTxInfo(pAd, pTxInfo, (USHORT)(BulkOutSize - TXINFO_SIZE), TRUE, EpToQueue[MGMTPIPEIDX], FALSE, FALSE); + RTMPWriteTxInfo(pAd, pTxInfo, (USHORT) (BulkOutSize - TXINFO_SIZE), + TRUE, EpToQueue[MGMTPIPEIDX], FALSE, FALSE); - BulkOutSize += 4; // Always add 4 extra bytes at every packet. + BulkOutSize += 4; // Always add 4 extra bytes at every packet. // If BulkOutSize is multiple of BulkOutMaxPacketSize, add extra 4 bytes again. if ((BulkOutSize % pAd->BulkOutMaxPacketSize) == 0) @@ -619,21 +605,21 @@ int RtmpUSBMgmtKickOut( ASSERT((padLen <= RTMP_PKT_TAIL_PADDING)); // Now memzero all extra padding bytes. - pDest = (PUCHAR)(pSrcBufVA + SrcBufLen); + pDest = (PUCHAR) (pSrcBufVA + SrcBufLen); skb_put(GET_OS_PKT_TYPE(pPacket), padLen); NdisZeroMemory(pDest, padLen); RTMP_IRQ_LOCK(&pAd->MLMEBulkOutLock, IrqFlags); pAd->MgmtRing.Cell[pAd->MgmtRing.TxCpuIdx].pNdisPacket = pPacket; - pMLMEContext->TransferBuffer = (PTX_BUFFER)(GET_OS_PKT_DATAPTR(pPacket)); + pMLMEContext->TransferBuffer = + (PTX_BUFFER) (GET_OS_PKT_DATAPTR(pPacket)); // Length in TxInfo should be 8 less than bulkout size. pMLMEContext->BulkOutSize = BulkOutSize; pMLMEContext->InUse = TRUE; pMLMEContext->bWaitingBulkOut = TRUE; - //for debug //hex_dump("RtmpUSBMgmtKickOut", &pMLMEContext->TransferBuffer->field.WirelessPacket[0], (pMLMEContext->BulkOutSize > 16 ? 16 : pMLMEContext->BulkOutSize)); @@ -641,7 +627,7 @@ int RtmpUSBMgmtKickOut( //pAd->RalinkCounters.OneSecTxDoneCount++; //if (pAd->MgmtRing.TxSwFreeIdx == MGMT_RING_SIZE) - // needKickOut = TRUE; + // needKickOut = TRUE; // Decrease the TxSwFreeIdx and Increase the TX_CTX_IDX pAd->MgmtRing.TxSwFreeIdx--; @@ -656,40 +642,46 @@ int RtmpUSBMgmtKickOut( return 0; } - -VOID RtmpUSBNullFrameKickOut( - IN RTMP_ADAPTER *pAd, - IN UCHAR QueIdx, - IN UCHAR *pNullFrame, - IN UINT32 frameLen) +VOID RtmpUSBNullFrameKickOut(IN RTMP_ADAPTER * pAd, + IN UCHAR QueIdx, + IN UCHAR * pNullFrame, IN UINT32 frameLen) { - if (pAd->NullContext.InUse == FALSE) - { - PTX_CONTEXT pNullContext; - PTXINFO_STRUC pTxInfo; - PTXWI_STRUC pTxWI; - PUCHAR pWirelessPkt; + if (pAd->NullContext.InUse == FALSE) { + PTX_CONTEXT pNullContext; + PTXINFO_STRUC pTxInfo; + PTXWI_STRUC pTxWI; + PUCHAR pWirelessPkt; pNullContext = &(pAd->NullContext); // Set the in use bit pNullContext->InUse = TRUE; - pWirelessPkt = (PUCHAR)&pNullContext->TransferBuffer->field.WirelessPacket[0]; + pWirelessPkt = + (PUCHAR) & pNullContext->TransferBuffer->field. + WirelessPacket[0]; RTMPZeroMemory(&pWirelessPkt[0], 100); - pTxInfo = (PTXINFO_STRUC)&pWirelessPkt[0]; - RTMPWriteTxInfo(pAd, pTxInfo, (USHORT)(sizeof(HEADER_802_11)+TXWI_SIZE), TRUE, EpToQueue[MGMTPIPEIDX], FALSE, FALSE); + pTxInfo = (PTXINFO_STRUC) & pWirelessPkt[0]; + RTMPWriteTxInfo(pAd, pTxInfo, + (USHORT) (sizeof(HEADER_802_11) + TXWI_SIZE), + TRUE, EpToQueue[MGMTPIPEIDX], FALSE, FALSE); pTxInfo->QSEL = FIFO_EDCA; - pTxWI = (PTXWI_STRUC)&pWirelessPkt[TXINFO_SIZE]; - RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0, BSSID_WCID, (sizeof(HEADER_802_11)), - 0, 0, (UCHAR)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_HTTXOP, FALSE, &pAd->CommonCfg.MlmeTransmit); + pTxWI = (PTXWI_STRUC) & pWirelessPkt[TXINFO_SIZE]; + RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, FALSE, FALSE, TRUE, + FALSE, 0, BSSID_WCID, (sizeof(HEADER_802_11)), 0, + 0, (UCHAR) pAd->CommonCfg.MlmeTransmit.field.MCS, + IFS_HTTXOP, FALSE, &pAd->CommonCfg.MlmeTransmit); - RTMPMoveMemory(&pWirelessPkt[TXWI_SIZE+TXINFO_SIZE], &pAd->NullFrame, sizeof(HEADER_802_11)); - pAd->NullContext.BulkOutSize = TXINFO_SIZE + TXWI_SIZE + sizeof(pAd->NullFrame) + 4; + RTMPMoveMemory(&pWirelessPkt[TXWI_SIZE + TXINFO_SIZE], + &pAd->NullFrame, sizeof(HEADER_802_11)); + pAd->NullContext.BulkOutSize = + TXINFO_SIZE + TXWI_SIZE + sizeof(pAd->NullFrame) + 4; // Fill out frame length information for global Bulk out arbitor //pNullContext->BulkOutSize = TransferBufferLength; - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - send NULL Frame @%d Mbps...\n", RateIdToMbps[pAd->CommonCfg.TxRate])); + DBGPRINT(RT_DEBUG_TRACE, + ("SYNC - send NULL Frame @%d Mbps...\n", + RateIdToMbps[pAd->CommonCfg.TxRate])); RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NULL); // Kick bulk out @@ -698,7 +690,6 @@ VOID RtmpUSBNullFrameKickOut( } - /* ======================================================================== Routine Description: @@ -716,79 +707,83 @@ Return Value: Note: ======================================================================== */ -PNDIS_PACKET GetPacketFromRxRing( - IN PRTMP_ADAPTER pAd, - OUT PRT28XX_RXD_STRUC pSaveRxD, - OUT BOOLEAN *pbReschedule, - IN OUT UINT32 *pRxPending) +PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, + OUT PRT28XX_RXD_STRUC pSaveRxD, + OUT BOOLEAN * pbReschedule, + IN OUT UINT32 * pRxPending) { - PRX_CONTEXT pRxContext; - PNDIS_PACKET pSkb; - PUCHAR pData; - ULONG ThisFrameLen; - ULONG RxBufferLength; - PRXWI_STRUC pRxWI; + PRX_CONTEXT pRxContext; + PNDIS_PACKET pSkb; + PUCHAR pData; + ULONG ThisFrameLen; + ULONG RxBufferLength; + PRXWI_STRUC pRxWI; pRxContext = &pAd->RxContext[pAd->NextRxBulkInReadIndex]; if ((pRxContext->Readable == FALSE) || (pRxContext->InUse == TRUE)) return NULL; RxBufferLength = pRxContext->BulkInOffset - pAd->ReadPosition; - if (RxBufferLength < (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXWI_STRUC) + sizeof(RXINFO_STRUC))) - { + if (RxBufferLength < + (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXWI_STRUC) + + sizeof(RXINFO_STRUC))) { goto label_null; } - pData = &pRxContext->TransferBuffer[pAd->ReadPosition]; /* 4KB */ + pData = &pRxContext->TransferBuffer[pAd->ReadPosition]; /* 4KB */ // The RXDMA field is 4 bytes, now just use the first 2 bytes. The Length including the (RXWI + MSDU + Padding) - ThisFrameLen = *pData + (*(pData+1)<<8); - if (ThisFrameLen == 0) - { - DBGPRINT(RT_DEBUG_TRACE, ("BIRIdx(%d): RXDMALen is zero.[%ld], BulkInBufLen = %ld)\n", - pAd->NextRxBulkInReadIndex, ThisFrameLen, pRxContext->BulkInOffset)); + ThisFrameLen = *pData + (*(pData + 1) << 8); + if (ThisFrameLen == 0) { + DBGPRINT(RT_DEBUG_TRACE, + ("BIRIdx(%d): RXDMALen is zero.[%ld], BulkInBufLen = %ld)\n", + pAd->NextRxBulkInReadIndex, ThisFrameLen, + pRxContext->BulkInOffset)); goto label_null; } - if ((ThisFrameLen&0x3) != 0) - { - DBGPRINT(RT_DEBUG_ERROR, ("BIRIdx(%d): RXDMALen not multiple of 4.[%ld], BulkInBufLen = %ld)\n", - pAd->NextRxBulkInReadIndex, ThisFrameLen, pRxContext->BulkInOffset)); + if ((ThisFrameLen & 0x3) != 0) { + DBGPRINT(RT_DEBUG_ERROR, + ("BIRIdx(%d): RXDMALen not multiple of 4.[%ld], BulkInBufLen = %ld)\n", + pAd->NextRxBulkInReadIndex, ThisFrameLen, + pRxContext->BulkInOffset)); goto label_null; } - if ((ThisFrameLen + 8)> RxBufferLength) // 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC)) + if ((ThisFrameLen + 8) > RxBufferLength) // 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC)) { - DBGPRINT(RT_DEBUG_TRACE,("BIRIdx(%d):FrameLen(0x%lx) outranges. BulkInLen=0x%lx, remaining RxBufLen=0x%lx, ReadPos=0x%lx\n", - pAd->NextRxBulkInReadIndex, ThisFrameLen, pRxContext->BulkInOffset, RxBufferLength, pAd->ReadPosition)); + DBGPRINT(RT_DEBUG_TRACE, + ("BIRIdx(%d):FrameLen(0x%lx) outranges. BulkInLen=0x%lx, remaining RxBufLen=0x%lx, ReadPos=0x%lx\n", + pAd->NextRxBulkInReadIndex, ThisFrameLen, + pRxContext->BulkInOffset, RxBufferLength, + pAd->ReadPosition)); // error frame. finish this loop goto label_null; } - // skip USB frame length field pData += RT2870_RXDMALEN_FIELD_SIZE; - pRxWI = (PRXWI_STRUC)pData; - if (pRxWI->MPDUtotalByteCount > ThisFrameLen) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s():pRxWIMPDUtotalByteCount(%d) large than RxDMALen(%ld)\n", - __FUNCTION__, pRxWI->MPDUtotalByteCount, ThisFrameLen)); + pRxWI = (PRXWI_STRUC) pData; + if (pRxWI->MPDUtotalByteCount > ThisFrameLen) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s():pRxWIMPDUtotalByteCount(%d) large than RxDMALen(%ld)\n", + __FUNCTION__, pRxWI->MPDUtotalByteCount, + ThisFrameLen)); goto label_null; } - // allocate a rx packet pSkb = dev_alloc_skb(ThisFrameLen); - if (pSkb == NULL) - { - DBGPRINT(RT_DEBUG_ERROR,("%s():Cannot Allocate sk buffer for this Bulk-In buffer!\n", __FUNCTION__)); + if (pSkb == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s():Cannot Allocate sk buffer for this Bulk-In buffer!\n", + __FUNCTION__)); goto label_null; } - // copy the rx packet memcpy(skb_put(pSkb, ThisFrameLen), pData, ThisFrameLen); RTPKT_TO_OSPKT(pSkb)->dev = get_netdev_from_bssid(pAd, BSS0); RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pSkb), PKTSRC_NDIS); // copy RxD - *pSaveRxD = *(PRXINFO_STRUC)(pData + ThisFrameLen); + *pSaveRxD = *(PRXINFO_STRUC) (pData + ThisFrameLen); // update next packet read position. pAd->ReadPosition += (ThisFrameLen + RT2870_RXDMALEN_FIELD_SIZE + RXINFO_SIZE); // 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC)) @@ -800,7 +795,6 @@ label_null: return NULL; } - /* ======================================================================== @@ -818,23 +812,20 @@ label_null: ======================================================================== */ -NDIS_STATUS RTMPCheckRxError( - IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHeader, - IN PRXWI_STRUC pRxWI, - IN PRT28XX_RXD_STRUC pRxINFO) +NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd, + IN PHEADER_802_11 pHeader, + IN PRXWI_STRUC pRxWI, IN PRT28XX_RXD_STRUC pRxINFO) { PCIPHER_KEY pWpaKey; - INT dBm; + INT dBm; if (pAd->bPromiscuous == TRUE) - return(NDIS_STATUS_SUCCESS); - if(pRxINFO == NULL) - return(NDIS_STATUS_FAILURE); + return (NDIS_STATUS_SUCCESS); + if (pRxINFO == NULL) + return (NDIS_STATUS_FAILURE); // Phy errors & CRC errors - if (pRxINFO->Crc) - { + if (pRxINFO->Crc) { // Check RSSI for Noise Hist statistic collection. dBm = (INT) (pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta; if (dBm <= -87) @@ -854,77 +845,73 @@ NDIS_STATUS RTMPCheckRxError( else if (dBm > -57) pAd->StaCfg.RPIDensity[7] += 1; - return(NDIS_STATUS_FAILURE); + return (NDIS_STATUS_FAILURE); } - // Add Rx size to channel load counter, we should ignore error counts - pAd->StaCfg.CLBusyBytes += (pRxWI->MPDUtotalByteCount+ 14); + pAd->StaCfg.CLBusyBytes += (pRxWI->MPDUtotalByteCount + 14); // Drop ToDs promiscous frame, it is opened due to CCX 2 channel load statistics - if (pHeader->FC.ToDs) - { + if (pHeader->FC.ToDs) { DBGPRINT_RAW(RT_DEBUG_ERROR, ("Err;FC.ToDs\n")); return NDIS_STATUS_FAILURE; } - // Paul 04-03 for OFDM Rx length issue - if (pRxWI->MPDUtotalByteCount > MAX_AGGREGATION_SIZE) - { + if (pRxWI->MPDUtotalByteCount > MAX_AGGREGATION_SIZE) { DBGPRINT_RAW(RT_DEBUG_ERROR, ("received packet too long\n")); return NDIS_STATUS_FAILURE; } - // Drop not U2M frames, cant's drop here because we will drop beacon in this case // I am kind of doubting the U2M bit operation // if (pRxD->U2M == 0) - // return(NDIS_STATUS_FAILURE); + // return(NDIS_STATUS_FAILURE); // drop decyption fail frame - if (pRxINFO->Decrypted && pRxINFO->CipherErr) - { - - if (((pRxINFO->CipherErr & 1) == 1) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) - RTMPSendWirelessEvent(pAd, IW_ICV_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - - if (((pRxINFO->CipherErr & 2) == 2) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) - RTMPSendWirelessEvent(pAd, IW_MIC_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); + if (pRxINFO->Decrypted && pRxINFO->CipherErr) { + + if (((pRxINFO->CipherErr & 1) == 1) + && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) + RTMPSendWirelessEvent(pAd, IW_ICV_ERROR_EVENT_FLAG, + pAd->MacTab.Content[BSSID_WCID]. + Addr, BSS0, 0); + + if (((pRxINFO->CipherErr & 2) == 2) + && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) + RTMPSendWirelessEvent(pAd, IW_MIC_ERROR_EVENT_FLAG, + pAd->MacTab.Content[BSSID_WCID]. + Addr, BSS0, 0); // // MIC Error // - if ((pRxINFO->CipherErr == 2) && pRxINFO->MyBss) - { + if ((pRxINFO->CipherErr == 2) && pRxINFO->MyBss) { pWpaKey = &pAd->SharedKey[BSS0][pRxWI->KeyIndex]; RTMPReportMicError(pAd, pWpaKey); - DBGPRINT_RAW(RT_DEBUG_ERROR,("Rx MIC Value error\n")); + DBGPRINT_RAW(RT_DEBUG_ERROR, ("Rx MIC Value error\n")); } if (pRxINFO->Decrypted && - (pAd->SharedKey[BSS0][pRxWI->KeyIndex].CipherAlg == CIPHER_AES) && - (pHeader->Sequence == pAd->FragFrame.Sequence)) - { + (pAd->SharedKey[BSS0][pRxWI->KeyIndex].CipherAlg == + CIPHER_AES) + && (pHeader->Sequence == pAd->FragFrame.Sequence)) { // // Acceptable since the First FragFrame no CipherErr problem. // - return(NDIS_STATUS_SUCCESS); + return (NDIS_STATUS_SUCCESS); } - return(NDIS_STATUS_FAILURE); + return (NDIS_STATUS_FAILURE); } - return(NDIS_STATUS_SUCCESS); + return (NDIS_STATUS_SUCCESS); } -VOID RtmpUsbStaAsicForceWakeupTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +VOID RtmpUsbStaAsicForceWakeupTimeout(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; - + RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; - if (pAd && pAd->Mlme.AutoWakeupTimerRunning) - { + if (pAd && pAd->Mlme.AutoWakeupTimerRunning) { AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); @@ -932,11 +919,9 @@ VOID RtmpUsbStaAsicForceWakeupTimeout( } } -VOID RT28xxUsbStaAsicForceWakeup( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bFromTx) +VOID RT28xxUsbStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) { - BOOLEAN Canceled; + BOOLEAN Canceled; if (pAd->Mlme.AutoWakeupTimerRunning) RTMPCancelTimer(&pAd->Mlme.AutoWakeupTimer, &Canceled); @@ -946,12 +931,10 @@ VOID RT28xxUsbStaAsicForceWakeup( OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); } -VOID RT28xxUsbStaAsicSleepThenAutoWakeup( - IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp) +VOID RT28xxUsbStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, + IN USHORT TbttNumToNextWakeUp) { - // we have decided to SLEEP, so at least do it for a BEACON period. if (TbttNumToNextWakeUp == 0) TbttNumToNextWakeUp = 1; @@ -959,7 +942,7 @@ VOID RT28xxUsbStaAsicSleepThenAutoWakeup( RTMPSetTimer(&pAd->Mlme.AutoWakeupTimer, AUTO_WAKEUP_TIMEOUT); pAd->Mlme.AutoWakeupTimerRunning = TRUE; - AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02); // send POWER-SAVE command to MCU. Timeout 40us. + AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02); // send POWER-SAVE command to MCU. Timeout 40us. OPSTATUS_SET_FLAG(pAd, fOP_STATUS_DOZE); diff --git a/drivers/staging/rt2860/common/cmm_info.c b/drivers/staging/rt2860/common/cmm_info.c index 3c47b810355f..be01b07c543e 100644 --- a/drivers/staging/rt2860/common/cmm_info.c +++ b/drivers/staging/rt2860/common/cmm_info.c @@ -47,153 +47,174 @@ ======================================================================== */ -VOID RTMPSetDesiredRates( - IN PRTMP_ADAPTER pAdapter, - IN LONG Rates) +VOID RTMPSetDesiredRates(IN PRTMP_ADAPTER pAdapter, IN LONG Rates) { - NDIS_802_11_RATES aryRates; - - memset(&aryRates, 0x00, sizeof(NDIS_802_11_RATES)); - switch (pAdapter->CommonCfg.PhyMode) - { - case PHY_11A: // A only - switch (Rates) - { - case 6000000: //6M - aryRates[0] = 0x0c; // 6M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0; - break; - case 9000000: //9M - aryRates[0] = 0x12; // 9M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1; - break; - case 12000000: //12M - aryRates[0] = 0x18; // 12M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2; - break; - case 18000000: //18M - aryRates[0] = 0x24; // 18M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3; - break; - case 24000000: //24M - aryRates[0] = 0x30; // 24M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4; - break; - case 36000000: //36M - aryRates[0] = 0x48; // 36M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5; - break; - case 48000000: //48M - aryRates[0] = 0x60; // 48M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6; - break; - case 54000000: //54M - aryRates[0] = 0x6c; // 54M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7; - break; - case -1: //Auto - default: - aryRates[0] = 0x6c; // 54Mbps - aryRates[1] = 0x60; // 48Mbps - aryRates[2] = 0x48; // 36Mbps - aryRates[3] = 0x30; // 24Mbps - aryRates[4] = 0x24; // 18M - aryRates[5] = 0x18; // 12M - aryRates[6] = 0x12; // 9M - aryRates[7] = 0x0c; // 6M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; - break; - } - break; - case PHY_11BG_MIXED: // B/G Mixed - case PHY_11B: // B only - case PHY_11ABG_MIXED: // A/B/G Mixed - default: - switch (Rates) - { - case 1000000: //1M - aryRates[0] = 0x02; - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0; - break; - case 2000000: //2M - aryRates[0] = 0x04; - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1; - break; - case 5000000: //5.5M - aryRates[0] = 0x0b; // 5.5M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2; - break; - case 11000000: //11M - aryRates[0] = 0x16; // 11M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3; - break; - case 6000000: //6M - aryRates[0] = 0x0c; // 6M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0; - break; - case 9000000: //9M - aryRates[0] = 0x12; // 9M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1; - break; - case 12000000: //12M - aryRates[0] = 0x18; // 12M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2; - break; - case 18000000: //18M - aryRates[0] = 0x24; // 18M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3; - break; - case 24000000: //24M - aryRates[0] = 0x30; // 24M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4; - break; - case 36000000: //36M - aryRates[0] = 0x48; // 36M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5; - break; - case 48000000: //48M - aryRates[0] = 0x60; // 48M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6; - break; - case 54000000: //54M - aryRates[0] = 0x6c; // 54M - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7; - break; - case -1: //Auto - default: - if (pAdapter->CommonCfg.PhyMode == PHY_11B) - { //B Only - aryRates[0] = 0x16; // 11Mbps - aryRates[1] = 0x0b; // 5.5Mbps - aryRates[2] = 0x04; // 2Mbps - aryRates[3] = 0x02; // 1Mbps - } - else - { //(B/G) Mixed or (A/B/G) Mixed - aryRates[0] = 0x6c; // 54Mbps - aryRates[1] = 0x60; // 48Mbps - aryRates[2] = 0x48; // 36Mbps - aryRates[3] = 0x30; // 24Mbps - aryRates[4] = 0x16; // 11Mbps - aryRates[5] = 0x0b; // 5.5Mbps - aryRates[6] = 0x04; // 2Mbps - aryRates[7] = 0x02; // 1Mbps - } - pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; - break; - } - break; - } - - NdisZeroMemory(pAdapter->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES); - NdisMoveMemory(pAdapter->CommonCfg.DesireRate, &aryRates, sizeof(NDIS_802_11_RATES)); - DBGPRINT(RT_DEBUG_TRACE, (" RTMPSetDesiredRates (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n", - pAdapter->CommonCfg.DesireRate[0],pAdapter->CommonCfg.DesireRate[1], - pAdapter->CommonCfg.DesireRate[2],pAdapter->CommonCfg.DesireRate[3], - pAdapter->CommonCfg.DesireRate[4],pAdapter->CommonCfg.DesireRate[5], - pAdapter->CommonCfg.DesireRate[6],pAdapter->CommonCfg.DesireRate[7] )); - // Changing DesiredRate may affect the MAX TX rate we used to TX frames out - MlmeUpdateTxRates(pAdapter, FALSE, 0); + NDIS_802_11_RATES aryRates; + + memset(&aryRates, 0x00, sizeof(NDIS_802_11_RATES)); + switch (pAdapter->CommonCfg.PhyMode) { + case PHY_11A: // A only + switch (Rates) { + case 6000000: //6M + aryRates[0] = 0x0c; // 6M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_0; + break; + case 9000000: //9M + aryRates[0] = 0x12; // 9M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_1; + break; + case 12000000: //12M + aryRates[0] = 0x18; // 12M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_2; + break; + case 18000000: //18M + aryRates[0] = 0x24; // 18M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_3; + break; + case 24000000: //24M + aryRates[0] = 0x30; // 24M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_4; + break; + case 36000000: //36M + aryRates[0] = 0x48; // 36M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_5; + break; + case 48000000: //48M + aryRates[0] = 0x60; // 48M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_6; + break; + case 54000000: //54M + aryRates[0] = 0x6c; // 54M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_7; + break; + case -1: //Auto + default: + aryRates[0] = 0x6c; // 54Mbps + aryRates[1] = 0x60; // 48Mbps + aryRates[2] = 0x48; // 36Mbps + aryRates[3] = 0x30; // 24Mbps + aryRates[4] = 0x24; // 18M + aryRates[5] = 0x18; // 12M + aryRates[6] = 0x12; // 9M + aryRates[7] = 0x0c; // 6M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_AUTO; + break; + } + break; + case PHY_11BG_MIXED: // B/G Mixed + case PHY_11B: // B only + case PHY_11ABG_MIXED: // A/B/G Mixed + default: + switch (Rates) { + case 1000000: //1M + aryRates[0] = 0x02; + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_0; + break; + case 2000000: //2M + aryRates[0] = 0x04; + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_1; + break; + case 5000000: //5.5M + aryRates[0] = 0x0b; // 5.5M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_2; + break; + case 11000000: //11M + aryRates[0] = 0x16; // 11M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_3; + break; + case 6000000: //6M + aryRates[0] = 0x0c; // 6M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_0; + break; + case 9000000: //9M + aryRates[0] = 0x12; // 9M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_1; + break; + case 12000000: //12M + aryRates[0] = 0x18; // 12M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_2; + break; + case 18000000: //18M + aryRates[0] = 0x24; // 18M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_3; + break; + case 24000000: //24M + aryRates[0] = 0x30; // 24M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_4; + break; + case 36000000: //36M + aryRates[0] = 0x48; // 36M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_5; + break; + case 48000000: //48M + aryRates[0] = 0x60; // 48M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_6; + break; + case 54000000: //54M + aryRates[0] = 0x6c; // 54M + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_7; + break; + case -1: //Auto + default: + if (pAdapter->CommonCfg.PhyMode == PHY_11B) { //B Only + aryRates[0] = 0x16; // 11Mbps + aryRates[1] = 0x0b; // 5.5Mbps + aryRates[2] = 0x04; // 2Mbps + aryRates[3] = 0x02; // 1Mbps + } else { //(B/G) Mixed or (A/B/G) Mixed + aryRates[0] = 0x6c; // 54Mbps + aryRates[1] = 0x60; // 48Mbps + aryRates[2] = 0x48; // 36Mbps + aryRates[3] = 0x30; // 24Mbps + aryRates[4] = 0x16; // 11Mbps + aryRates[5] = 0x0b; // 5.5Mbps + aryRates[6] = 0x04; // 2Mbps + aryRates[7] = 0x02; // 1Mbps + } + pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = + MCS_AUTO; + break; + } + break; + } + + NdisZeroMemory(pAdapter->CommonCfg.DesireRate, + MAX_LEN_OF_SUPPORTED_RATES); + NdisMoveMemory(pAdapter->CommonCfg.DesireRate, &aryRates, + sizeof(NDIS_802_11_RATES)); + DBGPRINT(RT_DEBUG_TRACE, + (" RTMPSetDesiredRates (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n", + pAdapter->CommonCfg.DesireRate[0], + pAdapter->CommonCfg.DesireRate[1], + pAdapter->CommonCfg.DesireRate[2], + pAdapter->CommonCfg.DesireRate[3], + pAdapter->CommonCfg.DesireRate[4], + pAdapter->CommonCfg.DesireRate[5], + pAdapter->CommonCfg.DesireRate[6], + pAdapter->CommonCfg.DesireRate[7])); + // Changing DesiredRate may affect the MAX TX rate we used to TX frames out + MlmeUpdateTxRates(pAdapter, FALSE, 0); } /* @@ -214,13 +235,14 @@ VOID RTMPSetDesiredRates( ======================================================================== */ -VOID RTMPWPARemoveAllKeys( - IN PRTMP_ADAPTER pAd) +VOID RTMPWPARemoveAllKeys(IN PRTMP_ADAPTER pAd) { - UCHAR i; + UCHAR i; - DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus)); + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", + pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus)); RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); // For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after // Link up. And it will be replaced if user changed it. @@ -236,9 +258,10 @@ VOID RTMPWPARemoveAllKeys( AsicRemovePairwiseKeyEntry(pAd, BSS0, BSSID_WCID); // set all shared key mode as no-security. - for (i = 0; i < SHARE_KEY_NUM; i++) - { - DBGPRINT(RT_DEBUG_TRACE,("remove %s key #%d\n", CipherName[pAd->SharedKey[BSS0][i].CipherAlg], i)); + for (i = 0; i < SHARE_KEY_NUM; i++) { + DBGPRINT(RT_DEBUG_TRACE, + ("remove %s key #%d\n", + CipherName[pAd->SharedKey[BSS0][i].CipherAlg], i)); NdisZeroMemory(&pAd->SharedKey[BSS0][i], sizeof(CIPHER_KEY)); AsicRemoveSharedKeyEntry(pAd, BSS0, i); @@ -246,7 +269,6 @@ VOID RTMPWPARemoveAllKeys( RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); } - /* ======================================================================== @@ -285,120 +307,119 @@ VOID RTMPWPARemoveAllKeys( ======================================================================== */ -VOID RTMPSetPhyMode( - IN PRTMP_ADAPTER pAd, - IN ULONG phymode) +VOID RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, IN ULONG phymode) { INT i; // the selected phymode must be supported by the RF IC encoded in E2PROM // if no change, do nothing /* bug fix - if (pAd->CommonCfg.PhyMode == phymode) - return; - */ - pAd->CommonCfg.PhyMode = (UCHAR)phymode; + if (pAd->CommonCfg.PhyMode == phymode) + return; + */ + pAd->CommonCfg.PhyMode = (UCHAR) phymode; - DBGPRINT(RT_DEBUG_TRACE,("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", pAd->CommonCfg.PhyMode, pAd->CommonCfg.Channel)); + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", + pAd->CommonCfg.PhyMode, pAd->CommonCfg.Channel)); BuildChannelList(pAd); // sanity check user setting - for (i = 0; i < pAd->ChannelListNum; i++) - { + for (i = 0; i < pAd->ChannelListNum; i++) { if (pAd->CommonCfg.Channel == pAd->ChannelList[i].Channel) break; } - if (i == pAd->ChannelListNum) - { + if (i == pAd->ChannelListNum) { pAd->CommonCfg.Channel = FirstChannel(pAd); - DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetPhyMode: channel is out of range, use first channel=%d \n", pAd->CommonCfg.Channel)); + DBGPRINT(RT_DEBUG_ERROR, + ("RTMPSetPhyMode: channel is out of range, use first channel=%d \n", + pAd->CommonCfg.Channel)); } NdisZeroMemory(pAd->CommonCfg.SupRate, MAX_LEN_OF_SUPPORTED_RATES); NdisZeroMemory(pAd->CommonCfg.ExtRate, MAX_LEN_OF_SUPPORTED_RATES); NdisZeroMemory(pAd->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES); switch (phymode) { - case PHY_11B: - pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRateLen = 4; - pAd->CommonCfg.ExtRateLen = 0; - pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps - //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use - break; - - case PHY_11G: - case PHY_11BG_MIXED: - case PHY_11ABG_MIXED: - case PHY_11N_2_4G: - case PHY_11ABGN_MIXED: - case PHY_11BGN_MIXED: - case PHY_11GN_MIXED: - pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[4] = 0x12; // 9 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[5] = 0x24; // 18 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[6] = 0x48; // 36 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRateLen = 8; - pAd->CommonCfg.ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps - pAd->CommonCfg.ExtRate[1] = 0x18; // 12 mbps, in units of 0.5 Mbps - pAd->CommonCfg.ExtRate[2] = 0x30; // 24 mbps, in units of 0.5 Mbps - pAd->CommonCfg.ExtRate[3] = 0x60; // 48 mbps, in units of 0.5 Mbps - pAd->CommonCfg.ExtRateLen = 4; - pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[4] = 12; // 6 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[5] = 18; // 9 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[6] = 24; // 12 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[7] = 36; // 18 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[8] = 48; // 24 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[9] = 72; // 36 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[10] = 96; // 48 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[11] = 108; // 54 mbps, in units of 0.5 Mbps - break; - - case PHY_11A: - case PHY_11AN_MIXED: - case PHY_11AGN_MIXED: - case PHY_11N_5G: - pAd->CommonCfg.SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRateLen = 8; - pAd->CommonCfg.ExtRateLen = 0; - pAd->CommonCfg.DesireRate[0] = 12; // 6 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[1] = 18; // 9 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[2] = 24; // 12 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[3] = 36; // 18 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[4] = 48; // 24 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[5] = 72; // 36 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[6] = 96; // 48 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[7] = 108; // 54 mbps, in units of 0.5 Mbps - //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use - break; - - default: - break; + case PHY_11B: + pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRateLen = 4; + pAd->CommonCfg.ExtRateLen = 0; + pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps + //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use + break; + + case PHY_11G: + case PHY_11BG_MIXED: + case PHY_11ABG_MIXED: + case PHY_11N_2_4G: + case PHY_11ABGN_MIXED: + case PHY_11BGN_MIXED: + case PHY_11GN_MIXED: + pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[4] = 0x12; // 9 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRate[5] = 0x24; // 18 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRate[6] = 0x48; // 36 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRateLen = 8; + pAd->CommonCfg.ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps + pAd->CommonCfg.ExtRate[1] = 0x18; // 12 mbps, in units of 0.5 Mbps + pAd->CommonCfg.ExtRate[2] = 0x30; // 24 mbps, in units of 0.5 Mbps + pAd->CommonCfg.ExtRate[3] = 0x60; // 48 mbps, in units of 0.5 Mbps + pAd->CommonCfg.ExtRateLen = 4; + pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[4] = 12; // 6 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[5] = 18; // 9 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[6] = 24; // 12 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[7] = 36; // 18 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[8] = 48; // 24 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[9] = 72; // 36 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[10] = 96; // 48 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[11] = 108; // 54 mbps, in units of 0.5 Mbps + break; + + case PHY_11A: + case PHY_11AN_MIXED: + case PHY_11AGN_MIXED: + case PHY_11N_5G: + pAd->CommonCfg.SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRateLen = 8; + pAd->CommonCfg.ExtRateLen = 0; + pAd->CommonCfg.DesireRate[0] = 12; // 6 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[1] = 18; // 9 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[2] = 24; // 12 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[3] = 36; // 18 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[4] = 48; // 24 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[5] = 72; // 36 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[6] = 96; // 48 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[7] = 108; // 54 mbps, in units of 0.5 Mbps + //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use + break; + + default: + break; } - pAd->CommonCfg.BandState = UNKNOWN_BAND; } @@ -414,34 +435,33 @@ VOID RTMPSetPhyMode( ======================================================================== */ -VOID RTMPSetHT( - IN PRTMP_ADAPTER pAd, - IN OID_SET_HT_PHYMODE *pHTPhyMode) +VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode) { - //ULONG *pmcs; - UINT32 Value = 0; - UCHAR BBPValue = 0; - UCHAR BBP3Value = 0; - UCHAR RxStream = pAd->CommonCfg.RxStream; + //ULONG *pmcs; + UINT32 Value = 0; + UCHAR BBPValue = 0; + UCHAR BBP3Value = 0; + UCHAR RxStream = pAd->CommonCfg.RxStream; - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n", - pHTPhyMode->HtMode, pHTPhyMode->ExtOffset, - pHTPhyMode->MCS, pHTPhyMode->BW, - pHTPhyMode->STBC, pHTPhyMode->SHORTGI)); + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n", + pHTPhyMode->HtMode, pHTPhyMode->ExtOffset, pHTPhyMode->MCS, + pHTPhyMode->BW, pHTPhyMode->STBC, pHTPhyMode->SHORTGI)); // Don't zero supportedHyPhy structure. - RTMPZeroMemory(&pAd->CommonCfg.HtCapability, sizeof(pAd->CommonCfg.HtCapability)); - RTMPZeroMemory(&pAd->CommonCfg.AddHTInfo, sizeof(pAd->CommonCfg.AddHTInfo)); - RTMPZeroMemory(&pAd->CommonCfg.NewExtChanOffset, sizeof(pAd->CommonCfg.NewExtChanOffset)); - RTMPZeroMemory(&pAd->CommonCfg.DesiredHtPhy, sizeof(pAd->CommonCfg.DesiredHtPhy)); - - if (pAd->CommonCfg.bRdg) - { + RTMPZeroMemory(&pAd->CommonCfg.HtCapability, + sizeof(pAd->CommonCfg.HtCapability)); + RTMPZeroMemory(&pAd->CommonCfg.AddHTInfo, + sizeof(pAd->CommonCfg.AddHTInfo)); + RTMPZeroMemory(&pAd->CommonCfg.NewExtChanOffset, + sizeof(pAd->CommonCfg.NewExtChanOffset)); + RTMPZeroMemory(&pAd->CommonCfg.DesiredHtPhy, + sizeof(pAd->CommonCfg.DesiredHtPhy)); + + if (pAd->CommonCfg.bRdg) { pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 1; pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 1; - } - else - { + } else { pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 0; pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 0; } @@ -449,89 +469,92 @@ VOID RTMPSetHT( pAd->CommonCfg.HtCapability.HtCapParm.MaxRAmpduFactor = 3; pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor = 3; - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : RxBAWinLimit = %d\n", pAd->CommonCfg.BACapability.field.RxBAWinLimit)); + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPSetHT : RxBAWinLimit = %d\n", + pAd->CommonCfg.BACapability.field.RxBAWinLimit)); // Mimo power save, A-MSDU size, - pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable; - pAd->CommonCfg.DesiredHtPhy.AmsduSize = (UCHAR)pAd->CommonCfg.BACapability.field.AmsduSize; - pAd->CommonCfg.DesiredHtPhy.MimoPs = (UCHAR)pAd->CommonCfg.BACapability.field.MMPSmode; - pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity; - - pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize; - pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode; - pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity; - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n", - pAd->CommonCfg.DesiredHtPhy.AmsduSize, - pAd->CommonCfg.DesiredHtPhy.MimoPs, - pAd->CommonCfg.DesiredHtPhy.MpduDensity, - pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor)); - - if(pHTPhyMode->HtMode == HTMODE_GF) - { + pAd->CommonCfg.DesiredHtPhy.AmsduEnable = + (USHORT) pAd->CommonCfg.BACapability.field.AmsduEnable; + pAd->CommonCfg.DesiredHtPhy.AmsduSize = + (UCHAR) pAd->CommonCfg.BACapability.field.AmsduSize; + pAd->CommonCfg.DesiredHtPhy.MimoPs = + (UCHAR) pAd->CommonCfg.BACapability.field.MMPSmode; + pAd->CommonCfg.DesiredHtPhy.MpduDensity = + (UCHAR) pAd->CommonCfg.BACapability.field.MpduDensity; + + pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = + (USHORT) pAd->CommonCfg.BACapability.field.AmsduSize; + pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = + (USHORT) pAd->CommonCfg.BACapability.field.MMPSmode; + pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = + (UCHAR) pAd->CommonCfg.BACapability.field.MpduDensity; + + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n", + pAd->CommonCfg.DesiredHtPhy.AmsduSize, + pAd->CommonCfg.DesiredHtPhy.MimoPs, + pAd->CommonCfg.DesiredHtPhy.MpduDensity, + pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor)); + + if (pHTPhyMode->HtMode == HTMODE_GF) { pAd->CommonCfg.HtCapability.HtCapInfo.GF = 1; pAd->CommonCfg.DesiredHtPhy.GF = 1; - } - else + } else pAd->CommonCfg.DesiredHtPhy.GF = 0; // Decide Rx MCSSet - switch (RxStream) - { - case 1: - pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff; - pAd->CommonCfg.HtCapability.MCSSet[1] = 0x00; - break; - - case 2: - pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff; - pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff; - break; - - case 3: // 3*3 - pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff; - pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff; - pAd->CommonCfg.HtCapability.MCSSet[2] = 0xff; - break; + switch (RxStream) { + case 1: + pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff; + pAd->CommonCfg.HtCapability.MCSSet[1] = 0x00; + break; + + case 2: + pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff; + pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff; + break; + + case 3: // 3*3 + pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff; + pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff; + pAd->CommonCfg.HtCapability.MCSSet[2] = 0xff; + break; } - if (pAd->CommonCfg.bForty_Mhz_Intolerant && (pAd->CommonCfg.Channel <= 14) && (pHTPhyMode->BW == BW_40) ) - { + if (pAd->CommonCfg.bForty_Mhz_Intolerant + && (pAd->CommonCfg.Channel <= 14) && (pHTPhyMode->BW == BW_40)) { pHTPhyMode->BW = BW_20; pAd->CommonCfg.HtCapability.HtCapInfo.Forty_Mhz_Intolerant = 1; } - if(pHTPhyMode->BW == BW_40) - { - pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; // MCS 32 + if (pHTPhyMode->BW == BW_40) { + pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; // MCS 32 pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 1; if (pAd->CommonCfg.Channel <= 14) pAd->CommonCfg.HtCapability.HtCapInfo.CCKmodein40 = 1; pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 1; pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 1; - pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = (pHTPhyMode->ExtOffset == EXTCHA_BELOW)? (EXTCHA_BELOW): EXTCHA_ABOVE; + pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = + (pHTPhyMode->ExtOffset == + EXTCHA_BELOW) ? (EXTCHA_BELOW) : EXTCHA_ABOVE; // Set Regsiter for extension channel position. RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value); RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBP3Value); - if ((pHTPhyMode->ExtOffset == EXTCHA_BELOW)) - { + if ((pHTPhyMode->ExtOffset == EXTCHA_BELOW)) { Value |= 0x1; BBP3Value |= (0x20); RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); - } - else if ((pHTPhyMode->ExtOffset == EXTCHA_ABOVE)) - { + } else if ((pHTPhyMode->ExtOffset == EXTCHA_ABOVE)) { Value &= 0xfe; BBP3Value &= (~0x20); RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); } - // Turn on BBP 40MHz mode now only as AP . // Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection. if ((pAd->OpMode == OPMODE_AP) || INFRA_ON(pAd) || ADHOC_ON(pAd) - ) - { + ) { RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); BBPValue &= (~0x18); BBPValue |= 0x10; @@ -540,9 +563,7 @@ VOID RTMPSetHT( RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBP3Value); pAd->CommonCfg.BBPCurrentBW = BW_40; } - } - else - { + } else { pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 0; pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 0; pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 0; @@ -557,28 +578,22 @@ VOID RTMPSetHT( } } - if(pHTPhyMode->STBC == STBC_USE) - { + if (pHTPhyMode->STBC == STBC_USE) { pAd->CommonCfg.HtCapability.HtCapInfo.TxSTBC = 1; pAd->CommonCfg.DesiredHtPhy.TxSTBC = 1; pAd->CommonCfg.HtCapability.HtCapInfo.RxSTBC = 1; pAd->CommonCfg.DesiredHtPhy.RxSTBC = 1; - } - else - { + } else { pAd->CommonCfg.DesiredHtPhy.TxSTBC = 0; pAd->CommonCfg.DesiredHtPhy.RxSTBC = 0; } - if(pHTPhyMode->SHORTGI == GI_400) - { + if (pHTPhyMode->SHORTGI == GI_400) { pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 1; pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 1; pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 1; pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 1; - } - else - { + } else { pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 0; pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 0; pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 0; @@ -586,13 +601,12 @@ VOID RTMPSetHT( } // We support link adaptation for unsolicit MCS feedback, set to 2. - pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; //MCSFBK_UNSOLICIT; + pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; //MCSFBK_UNSOLICIT; pAd->CommonCfg.AddHTInfo.ControlChan = pAd->CommonCfg.Channel; // 1, the extension channel above the control channel. // EDCA parameters used for AP's own transmission - if (pAd->CommonCfg.APEdcaParm.bValid == FALSE) - { + if (pAd->CommonCfg.APEdcaParm.bValid == FALSE) { pAd->CommonCfg.APEdcaParm.bValid = TRUE; pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3; pAd->CommonCfg.APEdcaParm.Aifsn[1] = 7; @@ -609,16 +623,16 @@ VOID RTMPSetHT( pAd->CommonCfg.APEdcaParm.Cwmax[2] = 4; pAd->CommonCfg.APEdcaParm.Cwmax[3] = 3; - pAd->CommonCfg.APEdcaParm.Txop[0] = 0; - pAd->CommonCfg.APEdcaParm.Txop[1] = 0; - pAd->CommonCfg.APEdcaParm.Txop[2] = 94; - pAd->CommonCfg.APEdcaParm.Txop[3] = 47; + pAd->CommonCfg.APEdcaParm.Txop[0] = 0; + pAd->CommonCfg.APEdcaParm.Txop[1] = 0; + pAd->CommonCfg.APEdcaParm.Txop[2] = 94; + pAd->CommonCfg.APEdcaParm.Txop[3] = 47; } AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm); - { - RTMPSetIndividualHT(pAd, 0); - } + { + RTMPSetIndividualHT(pAd, 0); + } } @@ -634,112 +648,103 @@ VOID RTMPSetHT( ======================================================================== */ -VOID RTMPSetIndividualHT( - IN PRTMP_ADAPTER pAd, - IN UCHAR apidx) +VOID RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) { - PRT_HT_PHY_INFO pDesired_ht_phy = NULL; - UCHAR TxStream = pAd->CommonCfg.TxStream; - UCHAR DesiredMcs = MCS_AUTO; + PRT_HT_PHY_INFO pDesired_ht_phy = NULL; + UCHAR TxStream = pAd->CommonCfg.TxStream; + UCHAR DesiredMcs = MCS_AUTO; - do - { + do { { pDesired_ht_phy = &pAd->StaCfg.DesiredHtPhyInfo; - DesiredMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS; + DesiredMcs = + pAd->StaCfg.DesiredTransmitSetting.field.MCS; //pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE; - break; + break; } } while (FALSE); - if (pDesired_ht_phy == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetIndividualHT: invalid apidx(%d)\n", apidx)); + if (pDesired_ht_phy == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("RTMPSetIndividualHT: invalid apidx(%d)\n", apidx)); return; } RTMPZeroMemory(pDesired_ht_phy, sizeof(RT_HT_PHY_INFO)); - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs)); + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs)); // Check the validity of MCS - if ((TxStream == 1) && ((DesiredMcs >= MCS_8) && (DesiredMcs <= MCS_15))) - { - DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS(%d) is invalid in 1S, reset it as MCS_7\n", DesiredMcs)); + if ((TxStream == 1) + && ((DesiredMcs >= MCS_8) && (DesiredMcs <= MCS_15))) { + DBGPRINT(RT_DEBUG_WARN, + ("RTMPSetIndividualHT: MCS(%d) is invalid in 1S, reset it as MCS_7\n", + DesiredMcs)); DesiredMcs = MCS_7; } - if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_20) && (DesiredMcs == MCS_32)) - { - DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS_32 is only supported in 40-MHz, reset it as MCS_0\n")); + if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_20) + && (DesiredMcs == MCS_32)) { + DBGPRINT(RT_DEBUG_WARN, + ("RTMPSetIndividualHT: MCS_32 is only supported in 40-MHz, reset it as MCS_0\n")); DesiredMcs = MCS_0; } pDesired_ht_phy->bHtEnable = TRUE; // Decide desired Tx MCS - switch (TxStream) - { - case 1: - if (DesiredMcs == MCS_AUTO) - { - pDesired_ht_phy->MCSSet[0]= 0xff; - pDesired_ht_phy->MCSSet[1]= 0x00; - } - else if (DesiredMcs <= MCS_7) - { - pDesired_ht_phy->MCSSet[0]= 1<MCSSet[1]= 0x00; - } - break; - - case 2: - if (DesiredMcs == MCS_AUTO) - { - pDesired_ht_phy->MCSSet[0]= 0xff; - pDesired_ht_phy->MCSSet[1]= 0xff; - } - else if (DesiredMcs <= MCS_15) - { - ULONG mode; - - mode = DesiredMcs / 8; - if (mode < 2) - pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8)); - } - break; - - case 3: // 3*3 - if (DesiredMcs == MCS_AUTO) - { - /* MCS0 ~ MCS23, 3 bytes */ - pDesired_ht_phy->MCSSet[0]= 0xff; - pDesired_ht_phy->MCSSet[1]= 0xff; - pDesired_ht_phy->MCSSet[2]= 0xff; - } - else if (DesiredMcs <= MCS_23) - { - ULONG mode; - - mode = DesiredMcs / 8; - if (mode < 3) - pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8)); - } - break; + switch (TxStream) { + case 1: + if (DesiredMcs == MCS_AUTO) { + pDesired_ht_phy->MCSSet[0] = 0xff; + pDesired_ht_phy->MCSSet[1] = 0x00; + } else if (DesiredMcs <= MCS_7) { + pDesired_ht_phy->MCSSet[0] = 1 << DesiredMcs; + pDesired_ht_phy->MCSSet[1] = 0x00; + } + break; + + case 2: + if (DesiredMcs == MCS_AUTO) { + pDesired_ht_phy->MCSSet[0] = 0xff; + pDesired_ht_phy->MCSSet[1] = 0xff; + } else if (DesiredMcs <= MCS_15) { + ULONG mode; + + mode = DesiredMcs / 8; + if (mode < 2) + pDesired_ht_phy->MCSSet[mode] = + (1 << (DesiredMcs - mode * 8)); + } + break; + + case 3: // 3*3 + if (DesiredMcs == MCS_AUTO) { + /* MCS0 ~ MCS23, 3 bytes */ + pDesired_ht_phy->MCSSet[0] = 0xff; + pDesired_ht_phy->MCSSet[1] = 0xff; + pDesired_ht_phy->MCSSet[2] = 0xff; + } else if (DesiredMcs <= MCS_23) { + ULONG mode; + + mode = DesiredMcs / 8; + if (mode < 3) + pDesired_ht_phy->MCSSet[mode] = + (1 << (DesiredMcs - mode * 8)); + } + break; } - if(pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_40) - { + if (pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_40) { if (DesiredMcs == MCS_AUTO || DesiredMcs == MCS_32) pDesired_ht_phy->MCSSet[4] = 0x1; } - // update HT Rate setting - if (pAd->OpMode == OPMODE_STA) - MlmeUpdateHtTxRates(pAd, BSS0); - else - MlmeUpdateHtTxRates(pAd, apidx); + if (pAd->OpMode == OPMODE_STA) + MlmeUpdateHtTxRates(pAd, BSS0); + else + MlmeUpdateHtTxRates(pAd, apidx); } - /* ======================================================================== Routine Description: @@ -748,36 +753,34 @@ VOID RTMPSetIndividualHT( Arguments: Send all HT IE in beacon/probe rsp/assoc rsp/action frame. - ======================================================================== */ -VOID RTMPUpdateHTIE( - IN RT_HT_CAPABILITY *pRtHt, - IN UCHAR *pMcsSet, - OUT HT_CAPABILITY_IE *pHtCapability, - OUT ADD_HT_INFO_IE *pAddHtInfo) +VOID RTMPUpdateHTIE(IN RT_HT_CAPABILITY * pRtHt, + IN UCHAR * pMcsSet, + OUT HT_CAPABILITY_IE * pHtCapability, + OUT ADD_HT_INFO_IE * pAddHtInfo) { RTMPZeroMemory(pHtCapability, sizeof(HT_CAPABILITY_IE)); RTMPZeroMemory(pAddHtInfo, sizeof(ADD_HT_INFO_IE)); - pHtCapability->HtCapInfo.ChannelWidth = pRtHt->ChannelWidth; - pHtCapability->HtCapInfo.MimoPs = pRtHt->MimoPs; - pHtCapability->HtCapInfo.GF = pRtHt->GF; - pHtCapability->HtCapInfo.ShortGIfor20 = pRtHt->ShortGIfor20; - pHtCapability->HtCapInfo.ShortGIfor40 = pRtHt->ShortGIfor40; - pHtCapability->HtCapInfo.TxSTBC = pRtHt->TxSTBC; - pHtCapability->HtCapInfo.RxSTBC = pRtHt->RxSTBC; - pHtCapability->HtCapInfo.AMsduSize = pRtHt->AmsduSize; - pHtCapability->HtCapParm.MaxRAmpduFactor = pRtHt->MaxRAmpduFactor; - pHtCapability->HtCapParm.MpduDensity = pRtHt->MpduDensity; - - pAddHtInfo->AddHtInfo.ExtChanOffset = pRtHt->ExtChanOffset ; - pAddHtInfo->AddHtInfo.RecomWidth = pRtHt->RecomWidth; - pAddHtInfo->AddHtInfo2.OperaionMode = pRtHt->OperaionMode; - pAddHtInfo->AddHtInfo2.NonGfPresent = pRtHt->NonGfPresent; - RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet*/pMcsSet, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar. - - DBGPRINT(RT_DEBUG_TRACE,("RTMPUpdateHTIE <== \n")); + pHtCapability->HtCapInfo.ChannelWidth = pRtHt->ChannelWidth; + pHtCapability->HtCapInfo.MimoPs = pRtHt->MimoPs; + pHtCapability->HtCapInfo.GF = pRtHt->GF; + pHtCapability->HtCapInfo.ShortGIfor20 = pRtHt->ShortGIfor20; + pHtCapability->HtCapInfo.ShortGIfor40 = pRtHt->ShortGIfor40; + pHtCapability->HtCapInfo.TxSTBC = pRtHt->TxSTBC; + pHtCapability->HtCapInfo.RxSTBC = pRtHt->RxSTBC; + pHtCapability->HtCapInfo.AMsduSize = pRtHt->AmsduSize; + pHtCapability->HtCapParm.MaxRAmpduFactor = pRtHt->MaxRAmpduFactor; + pHtCapability->HtCapParm.MpduDensity = pRtHt->MpduDensity; + + pAddHtInfo->AddHtInfo.ExtChanOffset = pRtHt->ExtChanOffset; + pAddHtInfo->AddHtInfo.RecomWidth = pRtHt->RecomWidth; + pAddHtInfo->AddHtInfo2.OperaionMode = pRtHt->OperaionMode; + pAddHtInfo->AddHtInfo2.NonGfPresent = pRtHt->NonGfPresent; + RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet */ pMcsSet, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar. + + DBGPRINT(RT_DEBUG_TRACE, ("RTMPUpdateHTIE <== \n")); } /* @@ -787,29 +790,27 @@ VOID RTMPUpdateHTIE( Return: ======================================================================== */ -VOID RTMPAddWcidAttributeEntry( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssIdx, - IN UCHAR KeyIdx, - IN UCHAR CipherAlg, - IN MAC_TABLE_ENTRY *pEntry) +VOID RTMPAddWcidAttributeEntry(IN PRTMP_ADAPTER pAd, + IN UCHAR BssIdx, + IN UCHAR KeyIdx, + IN UCHAR CipherAlg, IN MAC_TABLE_ENTRY * pEntry) { - UINT32 WCIDAttri = 0; - USHORT offset; - UCHAR IVEIV = 0; - USHORT Wcid = 0; + UINT32 WCIDAttri = 0; + USHORT offset; + UCHAR IVEIV = 0; + USHORT Wcid = 0; { { - if (BssIdx > BSS0) - { - DBGPRINT(RT_DEBUG_ERROR, ("RTMPAddWcidAttributeEntry: The BSS-index(%d) is out of range for Infra link. \n", BssIdx)); + if (BssIdx > BSS0) { + DBGPRINT(RT_DEBUG_ERROR, + ("RTMPAddWcidAttributeEntry: The BSS-index(%d) is out of range for Infra link. \n", + BssIdx)); return; } - - // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists. - // 2. In Infra mode, the AID:1 MUST be wcid of infra STA. - // the AID:2~ assign to mesh link entry. + // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists. + // 2. In Infra mode, the AID:1 MUST be wcid of infra STA. + // the AID:2~ assign to mesh link entry. if (pEntry) Wcid = pEntry->Aid; else @@ -822,39 +823,38 @@ VOID RTMPAddWcidAttributeEntry( { if (pEntry && pEntry->ValidAsMesh) - WCIDAttri = (CipherAlg<<1) | PAIRWISEKEYTABLE; + WCIDAttri = (CipherAlg << 1) | PAIRWISEKEYTABLE; else - WCIDAttri = (CipherAlg<<1) | SHAREDKEYTABLE; + WCIDAttri = (CipherAlg << 1) | SHAREDKEYTABLE; } RTMP_IO_WRITE32(pAd, offset, WCIDAttri); - // Update IV/EIV table offset = MAC_IVEIV_TABLE_BASE + (Wcid * HW_IVEIV_ENTRY_SIZE); // WPA mode - if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) || (CipherAlg == CIPHER_AES)) - { + if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) + || (CipherAlg == CIPHER_AES)) { // Eiv bit on. keyid always is 0 for pairwise key - IVEIV = (KeyIdx <<6) | 0x20; - } - else - { + IVEIV = (KeyIdx << 6) | 0x20; + } else { // WEP KeyIdx is default tx key. IVEIV = (KeyIdx << 6); } // For key index and ext IV bit, so only need to update the position(offset+3). #ifdef RTMP_MAC_PCI - RTMP_IO_WRITE8(pAd, offset+3, IVEIV); + RTMP_IO_WRITE8(pAd, offset + 3, IVEIV); #endif // RTMP_MAC_PCI // #ifdef RTMP_MAC_USB - RTUSBMultiWrite_OneByte(pAd, offset+3, &IVEIV); + RTUSBMultiWrite_OneByte(pAd, offset + 3, &IVEIV); #endif // RTMP_MAC_USB // - DBGPRINT(RT_DEBUG_TRACE,("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",Wcid, KeyIdx, CipherName[CipherAlg])); - DBGPRINT(RT_DEBUG_TRACE,(" WCIDAttri = 0x%x \n", WCIDAttri)); + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n", + Wcid, KeyIdx, CipherName[CipherAlg])); + DBGPRINT(RT_DEBUG_TRACE, (" WCIDAttri = 0x%x \n", WCIDAttri)); } @@ -874,84 +874,82 @@ Arguments: */ PSTRING GetEncryptType(CHAR enc) { - if(enc == Ndis802_11WEPDisabled) - return "NONE"; - if(enc == Ndis802_11WEPEnabled) - return "WEP"; - if(enc == Ndis802_11Encryption2Enabled) - return "TKIP"; - if(enc == Ndis802_11Encryption3Enabled) - return "AES"; - if(enc == Ndis802_11Encryption4Enabled) - return "TKIPAES"; - else - return "UNKNOW"; + if (enc == Ndis802_11WEPDisabled) + return "NONE"; + if (enc == Ndis802_11WEPEnabled) + return "WEP"; + if (enc == Ndis802_11Encryption2Enabled) + return "TKIP"; + if (enc == Ndis802_11Encryption3Enabled) + return "AES"; + if (enc == Ndis802_11Encryption4Enabled) + return "TKIPAES"; + else + return "UNKNOW"; } PSTRING GetAuthMode(CHAR auth) { - if(auth == Ndis802_11AuthModeOpen) - return "OPEN"; - if(auth == Ndis802_11AuthModeShared) - return "SHARED"; - if(auth == Ndis802_11AuthModeAutoSwitch) - return "AUTOWEP"; - if(auth == Ndis802_11AuthModeWPA) - return "WPA"; - if(auth == Ndis802_11AuthModeWPAPSK) - return "WPAPSK"; - if(auth == Ndis802_11AuthModeWPANone) - return "WPANONE"; - if(auth == Ndis802_11AuthModeWPA2) - return "WPA2"; - if(auth == Ndis802_11AuthModeWPA2PSK) - return "WPA2PSK"; - if(auth == Ndis802_11AuthModeWPA1WPA2) - return "WPA1WPA2"; - if(auth == Ndis802_11AuthModeWPA1PSKWPA2PSK) - return "WPA1PSKWPA2PSK"; - - return "UNKNOW"; + if (auth == Ndis802_11AuthModeOpen) + return "OPEN"; + if (auth == Ndis802_11AuthModeShared) + return "SHARED"; + if (auth == Ndis802_11AuthModeAutoSwitch) + return "AUTOWEP"; + if (auth == Ndis802_11AuthModeWPA) + return "WPA"; + if (auth == Ndis802_11AuthModeWPAPSK) + return "WPAPSK"; + if (auth == Ndis802_11AuthModeWPANone) + return "WPANONE"; + if (auth == Ndis802_11AuthModeWPA2) + return "WPA2"; + if (auth == Ndis802_11AuthModeWPA2PSK) + return "WPA2PSK"; + if (auth == Ndis802_11AuthModeWPA1WPA2) + return "WPA1WPA2"; + if (auth == Ndis802_11AuthModeWPA1PSKWPA2PSK) + return "WPA1PSKWPA2PSK"; + + return "UNKNOW"; } -INT SetCommonHT( - IN PRTMP_ADAPTER pAd) +INT SetCommonHT(IN PRTMP_ADAPTER pAd) { - OID_SET_HT_PHYMODE SetHT; + OID_SET_HT_PHYMODE SetHT; if (pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED) return FALSE; SetHT.PhyMode = pAd->CommonCfg.PhyMode; - SetHT.TransmitNo = ((UCHAR)pAd->Antenna.field.TxPath); - SetHT.HtMode = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.HTMODE; - SetHT.ExtOffset = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.EXTCHA; + SetHT.TransmitNo = ((UCHAR) pAd->Antenna.field.TxPath); + SetHT.HtMode = (UCHAR) pAd->CommonCfg.RegTransmitSetting.field.HTMODE; + SetHT.ExtOffset = + (UCHAR) pAd->CommonCfg.RegTransmitSetting.field.EXTCHA; SetHT.MCS = MCS_AUTO; - SetHT.BW = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.BW; - SetHT.STBC = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.STBC; - SetHT.SHORTGI = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.ShortGI; + SetHT.BW = (UCHAR) pAd->CommonCfg.RegTransmitSetting.field.BW; + SetHT.STBC = (UCHAR) pAd->CommonCfg.RegTransmitSetting.field.STBC; + SetHT.SHORTGI = (UCHAR) pAd->CommonCfg.RegTransmitSetting.field.ShortGI; RTMPSetHT(pAd, &SetHT); return TRUE; } -PSTRING RTMPGetRalinkEncryModeStr( - IN USHORT encryMode) +PSTRING RTMPGetRalinkEncryModeStr(IN USHORT encryMode) { - switch(encryMode) - { - case Ndis802_11WEPDisabled: - return "NONE"; - case Ndis802_11WEPEnabled: - return "WEP"; - case Ndis802_11Encryption2Enabled: - return "TKIP"; - case Ndis802_11Encryption3Enabled: - return "AES"; - case Ndis802_11Encryption4Enabled: - return "TKIPAES"; - default: - return "UNKNOW"; + switch (encryMode) { + case Ndis802_11WEPDisabled: + return "NONE"; + case Ndis802_11WEPEnabled: + return "WEP"; + case Ndis802_11Encryption2Enabled: + return "TKIP"; + case Ndis802_11Encryption3Enabled: + return "AES"; + case Ndis802_11Encryption4Enabled: + return "TKIPAES"; + default: + return "UNKNOW"; } } diff --git a/drivers/staging/rt2860/common/cmm_mac_pci.c b/drivers/staging/rt2860/common/cmm_mac_pci.c index d910bfdbd2f3..c9209257a544 100644 --- a/drivers/staging/rt2860/common/cmm_mac_pci.c +++ b/drivers/staging/rt2860/common/cmm_mac_pci.c @@ -25,11 +25,9 @@ ************************************************************************* */ - #ifdef RTMP_MAC_PCI #include "../rt_config.h" - /* ======================================================================== @@ -50,115 +48,125 @@ ======================================================================== */ -NDIS_STATUS RTMPAllocTxRxRingMemory( - IN PRTMP_ADAPTER pAd) +NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) { - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - ULONG RingBasePaHigh; - ULONG RingBasePaLow; - PVOID RingBaseVa; - INT index, num; - PTXD_STRUC pTxD; - PRXD_STRUC pRxD; - ULONG ErrorValue = 0; - PRTMP_TX_RING pTxRing; - PRTMP_DMABUF pDmaBuf; - PNDIS_PACKET pPacket; -// PRTMP_REORDERBUF pReorderBuf; + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + ULONG RingBasePaHigh; + ULONG RingBasePaLow; + PVOID RingBaseVa; + INT index, num; + PTXD_STRUC pTxD; + PRXD_STRUC pRxD; + ULONG ErrorValue = 0; + PRTMP_TX_RING pTxRing; + PRTMP_DMABUF pDmaBuf; + PNDIS_PACKET pPacket; +// PRTMP_REORDERBUF pReorderBuf; DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPAllocTxRxRingMemory\n")); - do - { + do { // // Allocate all ring descriptors, include TxD, RxD, MgmtD. // Although each size is different, to prevent cacheline and alignment // issue, I intentional set them all to 64 bytes. // - for (num=0; numTxDescRing[num].AllocSize = TX_RING_SIZE * TXD_SIZE; - RTMP_AllocateTxDescMemory( - pAd, - num, - pAd->TxDescRing[num].AllocSize, - FALSE, - &pAd->TxDescRing[num].AllocVa, - &pAd->TxDescRing[num].AllocPa); - - if (pAd->TxDescRing[num].AllocVa == NULL) - { + pAd->TxDescRing[num].AllocSize = + TX_RING_SIZE * TXD_SIZE; + RTMP_AllocateTxDescMemory(pAd, num, + pAd->TxDescRing[num]. + AllocSize, FALSE, + &pAd->TxDescRing[num].AllocVa, + &pAd->TxDescRing[num]. + AllocPa); + + if (pAd->TxDescRing[num].AllocVa == NULL) { ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; DBGPRINT_ERR(("Failed to allocate a big buffer\n")); Status = NDIS_STATUS_RESOURCES; break; } - // Zero init this memory block - NdisZeroMemory(pAd->TxDescRing[num].AllocVa, pAd->TxDescRing[num].AllocSize); + NdisZeroMemory(pAd->TxDescRing[num].AllocVa, + pAd->TxDescRing[num].AllocSize); // Save PA & VA for further operation - RingBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->TxDescRing[num].AllocPa); - RingBasePaLow = RTMP_GetPhysicalAddressLow (pAd->TxDescRing[num].AllocPa); - RingBaseVa = pAd->TxDescRing[num].AllocVa; + RingBasePaHigh = + RTMP_GetPhysicalAddressHigh(pAd->TxDescRing[num]. + AllocPa); + RingBasePaLow = + RTMP_GetPhysicalAddressLow(pAd->TxDescRing[num]. + AllocPa); + RingBaseVa = pAd->TxDescRing[num].AllocVa; // // Allocate all 1st TXBuf's memory for this TxRing // - pAd->TxBufSpace[num].AllocSize = TX_RING_SIZE * TX_DMA_1ST_BUFFER_SIZE; - RTMP_AllocateFirstTxBuffer( - pAd, - num, - pAd->TxBufSpace[num].AllocSize, - FALSE, - &pAd->TxBufSpace[num].AllocVa, - &pAd->TxBufSpace[num].AllocPa); - - if (pAd->TxBufSpace[num].AllocVa == NULL) - { + pAd->TxBufSpace[num].AllocSize = + TX_RING_SIZE * TX_DMA_1ST_BUFFER_SIZE; + RTMP_AllocateFirstTxBuffer(pAd, num, + pAd->TxBufSpace[num]. + AllocSize, FALSE, + &pAd->TxBufSpace[num]. + AllocVa, + &pAd->TxBufSpace[num]. + AllocPa); + + if (pAd->TxBufSpace[num].AllocVa == NULL) { ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; DBGPRINT_ERR(("Failed to allocate a big buffer\n")); Status = NDIS_STATUS_RESOURCES; break; } - // Zero init this memory block - NdisZeroMemory(pAd->TxBufSpace[num].AllocVa, pAd->TxBufSpace[num].AllocSize); + NdisZeroMemory(pAd->TxBufSpace[num].AllocVa, + pAd->TxBufSpace[num].AllocSize); // Save PA & VA for further operation - BufBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->TxBufSpace[num].AllocPa); - BufBasePaLow = RTMP_GetPhysicalAddressLow (pAd->TxBufSpace[num].AllocPa); - BufBaseVa = pAd->TxBufSpace[num].AllocVa; + BufBasePaHigh = + RTMP_GetPhysicalAddressHigh(pAd->TxBufSpace[num]. + AllocPa); + BufBasePaLow = + RTMP_GetPhysicalAddressLow(pAd->TxBufSpace[num]. + AllocPa); + BufBaseVa = pAd->TxBufSpace[num].AllocVa; // // Initialize Tx Ring Descriptor and associated buffer memory // pTxRing = &pAd->TxRing[num]; - for (index = 0; index < TX_RING_SIZE; index++) - { + for (index = 0; index < TX_RING_SIZE; index++) { pTxRing->Cell[index].pNdisPacket = NULL; pTxRing->Cell[index].pNextNdisPacket = NULL; // Init Tx Ring Size, Va, Pa variables pTxRing->Cell[index].AllocSize = TXD_SIZE; pTxRing->Cell[index].AllocVa = RingBaseVa; - RTMP_SetPhysicalAddressHigh(pTxRing->Cell[index].AllocPa, RingBasePaHigh); - RTMP_SetPhysicalAddressLow (pTxRing->Cell[index].AllocPa, RingBasePaLow); + RTMP_SetPhysicalAddressHigh(pTxRing-> + Cell[index].AllocPa, + RingBasePaHigh); + RTMP_SetPhysicalAddressLow(pTxRing->Cell[index]. + AllocPa, + RingBasePaLow); // Setup Tx Buffer size & address. only 802.11 header will store in this space pDmaBuf = &pTxRing->Cell[index].DmaBuf; pDmaBuf->AllocSize = TX_DMA_1ST_BUFFER_SIZE; pDmaBuf->AllocVa = BufBaseVa; - RTMP_SetPhysicalAddressHigh(pDmaBuf->AllocPa, BufBasePaHigh); - RTMP_SetPhysicalAddressLow(pDmaBuf->AllocPa, BufBasePaLow); + RTMP_SetPhysicalAddressHigh(pDmaBuf->AllocPa, + BufBasePaHigh); + RTMP_SetPhysicalAddressLow(pDmaBuf->AllocPa, + BufBasePaLow); // link the pre-allocated TxBuf to TXD - pTxD = (PTXD_STRUC) pTxRing->Cell[index].AllocVa; + pTxD = + (PTXD_STRUC) pTxRing->Cell[index].AllocVa; pTxD->SDPtr0 = BufBasePaLow; // advance to next ring descriptor address pTxD->DMADONE = 1; @@ -167,9 +175,12 @@ NDIS_STATUS RTMPAllocTxRxRingMemory( // advance to next TxBuf address BufBasePaLow += TX_DMA_1ST_BUFFER_SIZE; - BufBaseVa = (PUCHAR) BufBaseVa + TX_DMA_1ST_BUFFER_SIZE; + BufBaseVa = + (PUCHAR) BufBaseVa + TX_DMA_1ST_BUFFER_SIZE; } - DBGPRINT(RT_DEBUG_TRACE, ("TxRing[%d]: total %d entry allocated\n", num, index)); + DBGPRINT(RT_DEBUG_TRACE, + ("TxRing[%d]: total %d entry allocated\n", num, + index)); } if (Status == NDIS_STATUS_RESOURCES) break; @@ -178,41 +189,42 @@ NDIS_STATUS RTMPAllocTxRxRingMemory( // Allocate MGMT ring descriptor's memory except Tx ring which allocated eariler // pAd->MgmtDescRing.AllocSize = MGMT_RING_SIZE * TXD_SIZE; - RTMP_AllocateMgmtDescMemory( - pAd, - pAd->MgmtDescRing.AllocSize, - FALSE, - &pAd->MgmtDescRing.AllocVa, - &pAd->MgmtDescRing.AllocPa); - - if (pAd->MgmtDescRing.AllocVa == NULL) - { + RTMP_AllocateMgmtDescMemory(pAd, + pAd->MgmtDescRing.AllocSize, + FALSE, + &pAd->MgmtDescRing.AllocVa, + &pAd->MgmtDescRing.AllocPa); + + if (pAd->MgmtDescRing.AllocVa == NULL) { ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; DBGPRINT_ERR(("Failed to allocate a big buffer\n")); Status = NDIS_STATUS_RESOURCES; break; } - // Zero init this memory block - NdisZeroMemory(pAd->MgmtDescRing.AllocVa, pAd->MgmtDescRing.AllocSize); + NdisZeroMemory(pAd->MgmtDescRing.AllocVa, + pAd->MgmtDescRing.AllocSize); // Save PA & VA for further operation - RingBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->MgmtDescRing.AllocPa); - RingBasePaLow = RTMP_GetPhysicalAddressLow (pAd->MgmtDescRing.AllocPa); - RingBaseVa = pAd->MgmtDescRing.AllocVa; + RingBasePaHigh = + RTMP_GetPhysicalAddressHigh(pAd->MgmtDescRing.AllocPa); + RingBasePaLow = + RTMP_GetPhysicalAddressLow(pAd->MgmtDescRing.AllocPa); + RingBaseVa = pAd->MgmtDescRing.AllocVa; // // Initialize MGMT Ring and associated buffer memory // - for (index = 0; index < MGMT_RING_SIZE; index++) - { + for (index = 0; index < MGMT_RING_SIZE; index++) { pAd->MgmtRing.Cell[index].pNdisPacket = NULL; pAd->MgmtRing.Cell[index].pNextNdisPacket = NULL; // Init MGMT Ring Size, Va, Pa variables pAd->MgmtRing.Cell[index].AllocSize = TXD_SIZE; pAd->MgmtRing.Cell[index].AllocVa = RingBaseVa; - RTMP_SetPhysicalAddressHigh(pAd->MgmtRing.Cell[index].AllocPa, RingBasePaHigh); - RTMP_SetPhysicalAddressLow (pAd->MgmtRing.Cell[index].AllocPa, RingBasePaLow); + RTMP_SetPhysicalAddressHigh(pAd->MgmtRing.Cell[index]. + AllocPa, RingBasePaHigh); + RTMP_SetPhysicalAddressLow(pAd->MgmtRing.Cell[index]. + AllocPa, RingBasePaLow); // Offset to next ring descriptor address RingBasePaLow += TXD_SIZE; @@ -224,49 +236,51 @@ NDIS_STATUS RTMPAllocTxRxRingMemory( // no pre-allocated buffer required in MgmtRing for scatter-gather case } - DBGPRINT(RT_DEBUG_TRACE, ("MGMT Ring: total %d entry allocated\n", index)); + DBGPRINT(RT_DEBUG_TRACE, + ("MGMT Ring: total %d entry allocated\n", index)); // // Allocate RX ring descriptor's memory except Tx ring which allocated eariler // pAd->RxDescRing.AllocSize = RX_RING_SIZE * RXD_SIZE; - RTMP_AllocateRxDescMemory( - pAd, - pAd->RxDescRing.AllocSize, - FALSE, - &pAd->RxDescRing.AllocVa, - &pAd->RxDescRing.AllocPa); - - if (pAd->RxDescRing.AllocVa == NULL) - { + RTMP_AllocateRxDescMemory(pAd, + pAd->RxDescRing.AllocSize, + FALSE, + &pAd->RxDescRing.AllocVa, + &pAd->RxDescRing.AllocPa); + + if (pAd->RxDescRing.AllocVa == NULL) { ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; DBGPRINT_ERR(("Failed to allocate a big buffer\n")); Status = NDIS_STATUS_RESOURCES; break; } - // Zero init this memory block - NdisZeroMemory(pAd->RxDescRing.AllocVa, pAd->RxDescRing.AllocSize); - + NdisZeroMemory(pAd->RxDescRing.AllocVa, + pAd->RxDescRing.AllocSize); DBGPRINT(RT_DEBUG_OFF, - ("RX DESC %p size = %ld\n", pAd->RxDescRing.AllocVa, pAd->RxDescRing.AllocSize)); + ("RX DESC %p size = %ld\n", pAd->RxDescRing.AllocVa, + pAd->RxDescRing.AllocSize)); // Save PA & VA for further operation - RingBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->RxDescRing.AllocPa); - RingBasePaLow = RTMP_GetPhysicalAddressLow (pAd->RxDescRing.AllocPa); - RingBaseVa = pAd->RxDescRing.AllocVa; + RingBasePaHigh = + RTMP_GetPhysicalAddressHigh(pAd->RxDescRing.AllocPa); + RingBasePaLow = + RTMP_GetPhysicalAddressLow(pAd->RxDescRing.AllocPa); + RingBaseVa = pAd->RxDescRing.AllocVa; // // Initialize Rx Ring and associated buffer memory // - for (index = 0; index < RX_RING_SIZE; index++) - { + for (index = 0; index < RX_RING_SIZE; index++) { // Init RX Ring Size, Va, Pa variables pAd->RxRing.Cell[index].AllocSize = RXD_SIZE; pAd->RxRing.Cell[index].AllocVa = RingBaseVa; - RTMP_SetPhysicalAddressHigh(pAd->RxRing.Cell[index].AllocPa, RingBasePaHigh); - RTMP_SetPhysicalAddressLow (pAd->RxRing.Cell[index].AllocPa, RingBasePaLow); + RTMP_SetPhysicalAddressHigh(pAd->RxRing.Cell[index]. + AllocPa, RingBasePaHigh); + RTMP_SetPhysicalAddressLow(pAd->RxRing.Cell[index]. + AllocPa, RingBasePaLow); //NdisZeroMemory(RingBaseVa, RXD_SIZE); @@ -277,61 +291,57 @@ NDIS_STATUS RTMPAllocTxRxRingMemory( // Setup Rx associated Buffer size & allocate share memory pDmaBuf = &pAd->RxRing.Cell[index].DmaBuf; pDmaBuf->AllocSize = RX_BUFFER_AGGRESIZE; - pPacket = RTMP_AllocateRxPacketBuffer( - pAd, - pDmaBuf->AllocSize, - FALSE, - &pDmaBuf->AllocVa, - &pDmaBuf->AllocPa); + pPacket = RTMP_AllocateRxPacketBuffer(pAd, + pDmaBuf-> + AllocSize, FALSE, + &pDmaBuf->AllocVa, + &pDmaBuf-> + AllocPa); /* keep allocated rx packet */ pAd->RxRing.Cell[index].pNdisPacket = pPacket; // Error handling - if (pDmaBuf->AllocVa == NULL) - { + if (pDmaBuf->AllocVa == NULL) { ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; DBGPRINT_ERR(("Failed to allocate RxRing's 1st buffer\n")); Status = NDIS_STATUS_RESOURCES; break; } - // Zero init this memory block NdisZeroMemory(pDmaBuf->AllocVa, pDmaBuf->AllocSize); // Write RxD buffer address & allocated buffer length pRxD = (PRXD_STRUC) pAd->RxRing.Cell[index].AllocVa; - pRxD->SDP0 = RTMP_GetPhysicalAddressLow(pDmaBuf->AllocPa); + pRxD->SDP0 = + RTMP_GetPhysicalAddressLow(pDmaBuf->AllocPa); pRxD->DDONE = 0; } - DBGPRINT(RT_DEBUG_TRACE, ("Rx Ring: total %d entry allocated\n", index)); - - } while (FALSE); + DBGPRINT(RT_DEBUG_TRACE, + ("Rx Ring: total %d entry allocated\n", index)); + } while (FALSE); NdisZeroMemory(&pAd->FragFrame, sizeof(FRAGMENT_FRAME)); - pAd->FragFrame.pFragPacket = RTMP_AllocateFragPacketBuffer(pAd, RX_BUFFER_NORMSIZE); + pAd->FragFrame.pFragPacket = + RTMP_AllocateFragPacketBuffer(pAd, RX_BUFFER_NORMSIZE); - if (pAd->FragFrame.pFragPacket == NULL) - { + if (pAd->FragFrame.pFragPacket == NULL) { Status = NDIS_STATUS_RESOURCES; } - if (Status != NDIS_STATUS_SUCCESS) - { + if (Status != NDIS_STATUS_SUCCESS) { // Log error inforamtion - NdisWriteErrorLogEntry( - pAd->AdapterHandle, - NDIS_ERROR_CODE_OUT_OF_RESOURCES, - 1, - ErrorValue); + NdisWriteErrorLogEntry(pAd->AdapterHandle, + NDIS_ERROR_CODE_OUT_OF_RESOURCES, + 1, ErrorValue); } - // Following code segment get from original func:NICInitTxRxRingAndBacklogQueue(), now should integrate it to here. { - DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitTxRxRingAndBacklogQueue\n")); + DBGPRINT(RT_DEBUG_TRACE, + ("--> NICInitTxRxRingAndBacklogQueue\n")); /* // Disable DMA. @@ -342,8 +352,7 @@ NDIS_STATUS RTMPAllocTxRxRingMemory( */ // Initialize all transmit related software queues - for(index = 0; index < NUM_OF_TX_RING; index++) - { + for (index = 0; index < NUM_OF_TX_RING; index++) { InitializeQueueHeader(&pAd->TxSwQueue[index]); // Init TX rings index pointer pAd->TxRing[index].TxSwFreeIdx = 0; @@ -356,23 +365,21 @@ NDIS_STATUS RTMPAllocTxRxRingMemory( pAd->RxRing.RxCpuIdx = RX_RING_SIZE - 1; //RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RX_CRX_IDX0); - // init MGMT ring index pointer pAd->MgmtRing.TxSwFreeIdx = 0; pAd->MgmtRing.TxCpuIdx = 0; pAd->PrivateInfo.TxRingFullCnt = 0; - DBGPRINT(RT_DEBUG_TRACE, ("<-- NICInitTxRxRingAndBacklogQueue\n")); + DBGPRINT(RT_DEBUG_TRACE, + ("<-- NICInitTxRxRingAndBacklogQueue\n")); } - DBGPRINT_S(Status, ("<-- RTMPAllocTxRxRingMemory, Status=%x\n", Status)); + DBGPRINT_S(Status, + ("<-- RTMPAllocTxRxRingMemory, Status=%x\n", Status)); return Status; } - - - /* ======================================================================== @@ -393,156 +400,160 @@ NDIS_STATUS RTMPAllocTxRxRingMemory( ======================================================================== */ -VOID RTMPRingCleanUp( - IN PRTMP_ADAPTER pAd, - IN UCHAR RingType) +VOID RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, IN UCHAR RingType) { - PTXD_STRUC pTxD; - PRXD_STRUC pRxD; - PQUEUE_ENTRY pEntry; - PNDIS_PACKET pPacket; - int i; - PRTMP_TX_RING pTxRing; - unsigned long IrqFlags; - //UINT32 RxSwReadIdx; - - - DBGPRINT(RT_DEBUG_TRACE,("RTMPRingCleanUp(RingIdx=%d, Pending-NDIS=%ld)\n", RingType, pAd->RalinkCounters.PendingNdisPacketCount)); - switch (RingType) - { - case QID_AC_BK: - case QID_AC_BE: - case QID_AC_VI: - case QID_AC_VO: + PTXD_STRUC pTxD; + PRXD_STRUC pRxD; + PQUEUE_ENTRY pEntry; + PNDIS_PACKET pPacket; + int i; + PRTMP_TX_RING pTxRing; + unsigned long IrqFlags; + //UINT32 RxSwReadIdx; - pTxRing = &pAd->TxRing[RingType]; + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPRingCleanUp(RingIdx=%d, Pending-NDIS=%ld)\n", RingType, + pAd->RalinkCounters.PendingNdisPacketCount)); + switch (RingType) { + case QID_AC_BK: + case QID_AC_BE: + case QID_AC_VI: + case QID_AC_VO: - RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); - // We have to clean all descriptors in case some error happened with reset - for (i=0; iCell[i].AllocVa; - - pPacket = (PNDIS_PACKET) pTxRing->Cell[i].pNdisPacket; - // release scatter-and-gather NDIS_PACKET - if (pPacket) - { - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - pTxRing->Cell[i].pNdisPacket = NULL; - } + pTxRing = &pAd->TxRing[RingType]; - pPacket = (PNDIS_PACKET) pTxRing->Cell[i].pNextNdisPacket; - // release scatter-and-gather NDIS_PACKET - if (pPacket) - { - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - pTxRing->Cell[i].pNextNdisPacket = NULL; - } + RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); + // We have to clean all descriptors in case some error happened with reset + for (i = 0; i < TX_RING_SIZE; i++) // We have to scan all TX ring + { + pTxD = (PTXD_STRUC) pTxRing->Cell[i].AllocVa; + + pPacket = (PNDIS_PACKET) pTxRing->Cell[i].pNdisPacket; + // release scatter-and-gather NDIS_PACKET + if (pPacket) { + RELEASE_NDIS_PACKET(pAd, pPacket, + NDIS_STATUS_FAILURE); + pTxRing->Cell[i].pNdisPacket = NULL; } - RTMP_IO_READ32(pAd, TX_DTX_IDX0 + RingType * 0x10, &pTxRing->TxDmaIdx); - pTxRing->TxSwFreeIdx = pTxRing->TxDmaIdx; - pTxRing->TxCpuIdx = pTxRing->TxDmaIdx; - RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + RingType * 0x10, pTxRing->TxCpuIdx); - - RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); - - RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); - while (pAd->TxSwQueue[RingType].Head != NULL) - { - pEntry = RemoveHeadQueue(&pAd->TxSwQueue[RingType]); - pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - DBGPRINT(RT_DEBUG_TRACE,("Release 1 NDIS packet from s/w backlog queue\n")); + pPacket = + (PNDIS_PACKET) pTxRing->Cell[i].pNextNdisPacket; + // release scatter-and-gather NDIS_PACKET + if (pPacket) { + RELEASE_NDIS_PACKET(pAd, pPacket, + NDIS_STATUS_FAILURE); + pTxRing->Cell[i].pNextNdisPacket = NULL; } - RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); - break; + } - case QID_MGMT: - // We have to clean all descriptors in case some error happened with reset - NdisAcquireSpinLock(&pAd->MgmtRingLock); + RTMP_IO_READ32(pAd, TX_DTX_IDX0 + RingType * 0x10, + &pTxRing->TxDmaIdx); + pTxRing->TxSwFreeIdx = pTxRing->TxDmaIdx; + pTxRing->TxCpuIdx = pTxRing->TxDmaIdx; + RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + RingType * 0x10, + pTxRing->TxCpuIdx); - for (i=0; iMgmtRing.Cell[i].AllocVa; - - pPacket = (PNDIS_PACKET) pAd->MgmtRing.Cell[i].pNdisPacket; - // rlease scatter-and-gather NDIS_PACKET - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - } - pAd->MgmtRing.Cell[i].pNdisPacket = NULL; - - pPacket = (PNDIS_PACKET) pAd->MgmtRing.Cell[i].pNextNdisPacket; - // release scatter-and-gather NDIS_PACKET - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - } - pAd->MgmtRing.Cell[i].pNextNdisPacket = NULL; + RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); + RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); + while (pAd->TxSwQueue[RingType].Head != NULL) { + pEntry = RemoveHeadQueue(&pAd->TxSwQueue[RingType]); + pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); + RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); + DBGPRINT(RT_DEBUG_TRACE, + ("Release 1 NDIS packet from s/w backlog queue\n")); + } + RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); + break; + + case QID_MGMT: + // We have to clean all descriptors in case some error happened with reset + NdisAcquireSpinLock(&pAd->MgmtRingLock); + + for (i = 0; i < MGMT_RING_SIZE; i++) { + pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[i].AllocVa; + + pPacket = + (PNDIS_PACKET) pAd->MgmtRing.Cell[i].pNdisPacket; + // rlease scatter-and-gather NDIS_PACKET + if (pPacket) { + PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, + pTxD->SDLen0, + PCI_DMA_TODEVICE); + RELEASE_NDIS_PACKET(pAd, pPacket, + NDIS_STATUS_FAILURE); + } + pAd->MgmtRing.Cell[i].pNdisPacket = NULL; + + pPacket = + (PNDIS_PACKET) pAd->MgmtRing.Cell[i]. + pNextNdisPacket; + // release scatter-and-gather NDIS_PACKET + if (pPacket) { + PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, + pTxD->SDLen1, + PCI_DMA_TODEVICE); + RELEASE_NDIS_PACKET(pAd, pPacket, + NDIS_STATUS_FAILURE); } + pAd->MgmtRing.Cell[i].pNextNdisPacket = NULL; - RTMP_IO_READ32(pAd, TX_MGMTDTX_IDX, &pAd->MgmtRing.TxDmaIdx); - pAd->MgmtRing.TxSwFreeIdx = pAd->MgmtRing.TxDmaIdx; - pAd->MgmtRing.TxCpuIdx = pAd->MgmtRing.TxDmaIdx; - RTMP_IO_WRITE32(pAd, TX_MGMTCTX_IDX, pAd->MgmtRing.TxCpuIdx); + } - NdisReleaseSpinLock(&pAd->MgmtRingLock); - pAd->RalinkCounters.MgmtRingFullCount = 0; - break; + RTMP_IO_READ32(pAd, TX_MGMTDTX_IDX, &pAd->MgmtRing.TxDmaIdx); + pAd->MgmtRing.TxSwFreeIdx = pAd->MgmtRing.TxDmaIdx; + pAd->MgmtRing.TxCpuIdx = pAd->MgmtRing.TxDmaIdx; + RTMP_IO_WRITE32(pAd, TX_MGMTCTX_IDX, pAd->MgmtRing.TxCpuIdx); - case QID_RX: - // We have to clean all descriptors in case some error happened with reset - NdisAcquireSpinLock(&pAd->RxRingLock); + NdisReleaseSpinLock(&pAd->MgmtRingLock); + pAd->RalinkCounters.MgmtRingFullCount = 0; + break; - for (i=0; iRxRing.Cell[i].AllocVa; - pRxD->DDONE = 0 ; - } + case QID_RX: + // We have to clean all descriptors in case some error happened with reset + NdisAcquireSpinLock(&pAd->RxRingLock); + + for (i = 0; i < RX_RING_SIZE; i++) { + pRxD = (PRXD_STRUC) pAd->RxRing.Cell[i].AllocVa; + pRxD->DDONE = 0; + } - RTMP_IO_READ32(pAd, RX_DRX_IDX, &pAd->RxRing.RxDmaIdx); - pAd->RxRing.RxSwReadIdx = pAd->RxRing.RxDmaIdx; - pAd->RxRing.RxCpuIdx = ((pAd->RxRing.RxDmaIdx == 0) ? (RX_RING_SIZE-1) : (pAd->RxRing.RxDmaIdx-1)); - RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RxCpuIdx); + RTMP_IO_READ32(pAd, RX_DRX_IDX, &pAd->RxRing.RxDmaIdx); + pAd->RxRing.RxSwReadIdx = pAd->RxRing.RxDmaIdx; + pAd->RxRing.RxCpuIdx = + ((pAd->RxRing.RxDmaIdx == + 0) ? (RX_RING_SIZE - 1) : (pAd->RxRing.RxDmaIdx - 1)); + RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RxCpuIdx); - NdisReleaseSpinLock(&pAd->RxRingLock); - break; + NdisReleaseSpinLock(&pAd->RxRingLock); + break; - default: - break; + default: + break; } } - -VOID RTMPFreeTxRxRingMemory( - IN PRTMP_ADAPTER pAd) +VOID RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) { - int index, num , j; + int index, num, j; PRTMP_TX_RING pTxRing; - PTXD_STRUC pTxD; - PNDIS_PACKET pPacket; - unsigned int IrqFlags; + PTXD_STRUC pTxD; + PNDIS_PACKET pPacket; + unsigned int IrqFlags; //POS_COOKIE pObj =(POS_COOKIE) pAd->OS_Cookie; DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPFreeTxRxRingMemory\n")); // Free TxSwQueue Packet - for (index=0; index irq_lock, IrqFlags); pQueue = &pAd->TxSwQueue[index]; - while (pQueue->Head) - { + while (pQueue->Head) { pEntry = RemoveHeadQueue(pQueue); pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); @@ -551,80 +562,92 @@ VOID RTMPFreeTxRxRingMemory( } // Free Tx Ring Packet - for (index=0;index< NUM_OF_TX_RING;index++) - { + for (index = 0; index < NUM_OF_TX_RING; index++) { pTxRing = &pAd->TxRing[index]; - for (j=0; j< TX_RING_SIZE; j++) - { + for (j = 0; j < TX_RING_SIZE; j++) { pTxD = (PTXD_STRUC) (pTxRing->Cell[j].AllocVa); pPacket = pTxRing->Cell[j].pNdisPacket; - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); + if (pPacket) { + PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, + pTxD->SDLen0, + PCI_DMA_TODEVICE); + RELEASE_NDIS_PACKET(pAd, pPacket, + NDIS_STATUS_SUCCESS); } //Always assign pNdisPacket as NULL after clear pTxRing->Cell[j].pNdisPacket = NULL; pPacket = pTxRing->Cell[j].pNextNdisPacket; - if (pPacket) - { - PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, PCI_DMA_TODEVICE); - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); + if (pPacket) { + PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, + pTxD->SDLen1, + PCI_DMA_TODEVICE); + RELEASE_NDIS_PACKET(pAd, pPacket, + NDIS_STATUS_SUCCESS); } //Always assign pNextNdisPacket as NULL after clear - pTxRing->Cell[pTxRing->TxSwFreeIdx].pNextNdisPacket = NULL; + pTxRing->Cell[pTxRing->TxSwFreeIdx].pNextNdisPacket = + NULL; } } - for (index = RX_RING_SIZE - 1 ; index >= 0; index--) - { - if ((pAd->RxRing.Cell[index].DmaBuf.AllocVa) && (pAd->RxRing.Cell[index].pNdisPacket)) - { - PCI_UNMAP_SINGLE(pAd, pAd->RxRing.Cell[index].DmaBuf.AllocPa, pAd->RxRing.Cell[index].DmaBuf.AllocSize, PCI_DMA_FROMDEVICE); - RELEASE_NDIS_PACKET(pAd, pAd->RxRing.Cell[index].pNdisPacket, NDIS_STATUS_SUCCESS); + for (index = RX_RING_SIZE - 1; index >= 0; index--) { + if ((pAd->RxRing.Cell[index].DmaBuf.AllocVa) + && (pAd->RxRing.Cell[index].pNdisPacket)) { + PCI_UNMAP_SINGLE(pAd, + pAd->RxRing.Cell[index].DmaBuf.AllocPa, + pAd->RxRing.Cell[index].DmaBuf. + AllocSize, PCI_DMA_FROMDEVICE); + RELEASE_NDIS_PACKET(pAd, + pAd->RxRing.Cell[index].pNdisPacket, + NDIS_STATUS_SUCCESS); } } NdisZeroMemory(pAd->RxRing.Cell, RX_RING_SIZE * sizeof(RTMP_DMACB)); - if (pAd->RxDescRing.AllocVa) - { - RTMP_FreeDescMemory(pAd, pAd->RxDescRing.AllocSize, pAd->RxDescRing.AllocVa, pAd->RxDescRing.AllocPa); - } - NdisZeroMemory(&pAd->RxDescRing, sizeof(RTMP_DMABUF)); + if (pAd->RxDescRing.AllocVa) { + RTMP_FreeDescMemory(pAd, pAd->RxDescRing.AllocSize, + pAd->RxDescRing.AllocVa, + pAd->RxDescRing.AllocPa); + } + NdisZeroMemory(&pAd->RxDescRing, sizeof(RTMP_DMABUF)); - if (pAd->MgmtDescRing.AllocVa) - { - RTMP_FreeDescMemory(pAd, pAd->MgmtDescRing.AllocSize, pAd->MgmtDescRing.AllocVa, pAd->MgmtDescRing.AllocPa); + if (pAd->MgmtDescRing.AllocVa) { + RTMP_FreeDescMemory(pAd, pAd->MgmtDescRing.AllocSize, + pAd->MgmtDescRing.AllocVa, + pAd->MgmtDescRing.AllocPa); } NdisZeroMemory(&pAd->MgmtDescRing, sizeof(RTMP_DMABUF)); - for (num = 0; num < NUM_OF_TX_RING; num++) - { - if (pAd->TxBufSpace[num].AllocVa) - { - RTMP_FreeFirstTxBuffer(pAd, pAd->TxBufSpace[num].AllocSize, FALSE, pAd->TxBufSpace[num].AllocVa, pAd->TxBufSpace[num].AllocPa); - } - NdisZeroMemory(&pAd->TxBufSpace[num], sizeof(RTMP_DMABUF)); + for (num = 0; num < NUM_OF_TX_RING; num++) { + if (pAd->TxBufSpace[num].AllocVa) { + RTMP_FreeFirstTxBuffer(pAd, + pAd->TxBufSpace[num].AllocSize, + FALSE, + pAd->TxBufSpace[num].AllocVa, + pAd->TxBufSpace[num].AllocPa); + } + NdisZeroMemory(&pAd->TxBufSpace[num], sizeof(RTMP_DMABUF)); - if (pAd->TxDescRing[num].AllocVa) - { - RTMP_FreeDescMemory(pAd, pAd->TxDescRing[num].AllocSize, pAd->TxDescRing[num].AllocVa, pAd->TxDescRing[num].AllocPa); - } - NdisZeroMemory(&pAd->TxDescRing[num], sizeof(RTMP_DMABUF)); + if (pAd->TxDescRing[num].AllocVa) { + RTMP_FreeDescMemory(pAd, pAd->TxDescRing[num].AllocSize, + pAd->TxDescRing[num].AllocVa, + pAd->TxDescRing[num].AllocPa); + } + NdisZeroMemory(&pAd->TxDescRing[num], sizeof(RTMP_DMABUF)); } if (pAd->FragFrame.pFragPacket) - RELEASE_NDIS_PACKET(pAd, pAd->FragFrame.pFragPacket, NDIS_STATUS_SUCCESS); + RELEASE_NDIS_PACKET(pAd, pAd->FragFrame.pFragPacket, + NDIS_STATUS_SUCCESS); DBGPRINT(RT_DEBUG_TRACE, ("<-- RTMPFreeTxRxRingMemory\n")); } - /*************************************************************************** * * register related procedures. @@ -644,19 +667,16 @@ Return Value: Note: ======================================================================== */ -VOID RT28XXDMADisable( - IN RTMP_ADAPTER *pAd) +VOID RT28XXDMADisable(IN RTMP_ADAPTER * pAd) { - WPDMA_GLO_CFG_STRUC GloCfg; - + WPDMA_GLO_CFG_STRUC GloCfg; RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); GloCfg.word &= 0xff0; - GloCfg.field.EnTXWriteBackDDONE =1; + GloCfg.field.EnTXWriteBackDDONE = 1; RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); } - /* ======================================================================== Routine Description: @@ -671,23 +691,22 @@ Return Value: Note: ======================================================================== */ -VOID RT28XXDMAEnable( - IN RTMP_ADAPTER *pAd) +VOID RT28XXDMAEnable(IN RTMP_ADAPTER * pAd) { - WPDMA_GLO_CFG_STRUC GloCfg; + WPDMA_GLO_CFG_STRUC GloCfg; int i = 0; RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x4); - do - { + do { RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); - if ((GloCfg.field.TxDMABusy == 0) && (GloCfg.field.RxDMABusy == 0)) + if ((GloCfg.field.TxDMABusy == 0) + && (GloCfg.field.RxDMABusy == 0)) break; DBGPRINT(RT_DEBUG_TRACE, ("==> DMABusy\n")); RTMPusecDelay(1000); i++; - }while ( i <200); + } while (i < 200); RTMPusecDelay(50); @@ -696,69 +715,63 @@ VOID RT28XXDMAEnable( GloCfg.field.EnableRxDMA = 1; GloCfg.field.EnableTxDMA = 1; - DBGPRINT(RT_DEBUG_TRACE, ("<== WRITE DMA offset 0x208 = 0x%x\n", GloCfg.word)); + DBGPRINT(RT_DEBUG_TRACE, + ("<== WRITE DMA offset 0x208 = 0x%x\n", GloCfg.word)); RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); } - -BOOLEAN AsicCheckCommanOk( - IN PRTMP_ADAPTER pAd, - IN UCHAR Command) +BOOLEAN AsicCheckCommanOk(IN PRTMP_ADAPTER pAd, IN UCHAR Command) { - UINT32 CmdStatus = 0, CID = 0, i; - UINT32 ThisCIDMask = 0; + UINT32 CmdStatus = 0, CID = 0, i; + UINT32 ThisCIDMask = 0; i = 0; - do - { + do { RTMP_IO_READ32(pAd, H2M_MAILBOX_CID, &CID); // Find where the command is. Because this is randomly specified by firmware. - if ((CID & CID0MASK) == Command) - { + if ((CID & CID0MASK) == Command) { ThisCIDMask = CID0MASK; break; - } - else if ((((CID & CID1MASK)>>8) & 0xff) == Command) - { + } else if ((((CID & CID1MASK) >> 8) & 0xff) == Command) { ThisCIDMask = CID1MASK; break; - } - else if ((((CID & CID2MASK)>>16) & 0xff) == Command) - { + } else if ((((CID & CID2MASK) >> 16) & 0xff) == Command) { ThisCIDMask = CID2MASK; break; - } - else if ((((CID & CID3MASK)>>24) & 0xff) == Command) - { + } else if ((((CID & CID3MASK) >> 24) & 0xff) == Command) { ThisCIDMask = CID3MASK; break; } RTMPusecDelay(100); i++; - }while (i < 200); + } while (i < 200); // Get CommandStatus Value RTMP_IO_READ32(pAd, H2M_MAILBOX_STATUS, &CmdStatus); // This command's status is at the same position as command. So AND command position's bitmask to read status. - if (i < 200) - { + if (i < 200) { // If Status is 1, the comamnd is success. - if (((CmdStatus & ThisCIDMask) == 0x1) || ((CmdStatus & ThisCIDMask) == 0x100) - || ((CmdStatus & ThisCIDMask) == 0x10000) || ((CmdStatus & ThisCIDMask) == 0x1000000)) - { - DBGPRINT(RT_DEBUG_TRACE, ("--> AsicCheckCommanOk CID = 0x%x, CmdStatus= 0x%x \n", CID, CmdStatus)); + if (((CmdStatus & ThisCIDMask) == 0x1) + || ((CmdStatus & ThisCIDMask) == 0x100) + || ((CmdStatus & ThisCIDMask) == 0x10000) + || ((CmdStatus & ThisCIDMask) == 0x1000000)) { + DBGPRINT(RT_DEBUG_TRACE, + ("--> AsicCheckCommanOk CID = 0x%x, CmdStatus= 0x%x \n", + CID, CmdStatus)); RTMP_IO_WRITE32(pAd, H2M_MAILBOX_STATUS, 0xffffffff); RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CID, 0xffffffff); return TRUE; } - DBGPRINT(RT_DEBUG_TRACE, ("--> AsicCheckCommanFail1 CID = 0x%x, CmdStatus= 0x%x \n", CID, CmdStatus)); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("--> AsicCheckCommanFail2 Timeout Command = %d, CmdStatus= 0x%x \n", Command, CmdStatus)); + DBGPRINT(RT_DEBUG_TRACE, + ("--> AsicCheckCommanFail1 CID = 0x%x, CmdStatus= 0x%x \n", + CID, CmdStatus)); + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("--> AsicCheckCommanFail2 Timeout Command = %d, CmdStatus= 0x%x \n", + Command, CmdStatus)); } // Clear Command and Status. RTMP_IO_WRITE32(pAd, H2M_MAILBOX_STATUS, 0xffffffff); @@ -767,7 +780,6 @@ BOOLEAN AsicCheckCommanOk( return FALSE; } - /* ======================================================================== Routine Description: @@ -782,58 +794,58 @@ Return Value: Note: ======================================================================== */ -VOID RT28xx_UpdateBeaconToAsic( - IN RTMP_ADAPTER *pAd, - IN INT apidx, - IN ULONG FrameLen, - IN ULONG UpdatePos) +VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, + IN INT apidx, + IN ULONG FrameLen, IN ULONG UpdatePos) { - ULONG CapInfoPos = 0; - UCHAR *ptr, *ptr_update, *ptr_capinfo; - UINT i; - BOOLEAN bBcnReq = FALSE; - UCHAR bcn_idx = 0; - + ULONG CapInfoPos = 0; + UCHAR *ptr, *ptr_update, *ptr_capinfo; + UINT i; + BOOLEAN bBcnReq = FALSE; + UCHAR bcn_idx = 0; { - DBGPRINT(RT_DEBUG_ERROR, ("%s() : No valid Interface be found.\n", __func__)); + DBGPRINT(RT_DEBUG_ERROR, + ("%s() : No valid Interface be found.\n", __func__)); return; } //if ((pAd->WdsTab.Mode == WDS_BRIDGE_MODE) - // || ((pAd->ApCfg.MBSSID[apidx].MSSIDDev == NULL) - // || !(pAd->ApCfg.MBSSID[apidx].MSSIDDev->flags & IFF_UP)) - // ) - if (bBcnReq == FALSE) - { + // || ((pAd->ApCfg.MBSSID[apidx].MSSIDDev == NULL) + // || !(pAd->ApCfg.MBSSID[apidx].MSSIDDev->flags & IFF_UP)) + // ) + if (bBcnReq == FALSE) { /* when the ra interface is down, do not send its beacon frame */ /* clear all zero */ - for(i=0; iBeaconOffset[bcn_idx] + i, 0x00); - } - else - { - ptr = (PUCHAR)&pAd->BeaconTxWI; - for (i=0; iBeaconOffset[bcn_idx] + i, + 0x00); + } else { + ptr = (PUCHAR) & pAd->BeaconTxWI; + for (i = 0; i < TXWI_SIZE; i += 4) // 16-byte TXWI field { - UINT32 longptr = *ptr + (*(ptr+1)<<8) + (*(ptr+2)<<16) + (*(ptr+3)<<24); - RTMP_IO_WRITE32(pAd, pAd->BeaconOffset[bcn_idx] + i, longptr); + UINT32 longptr = + *ptr + (*(ptr + 1) << 8) + (*(ptr + 2) << 16) + + (*(ptr + 3) << 24); + RTMP_IO_WRITE32(pAd, pAd->BeaconOffset[bcn_idx] + i, + longptr); ptr += 4; } // Update CapabilityInfo in Beacon - for (i = CapInfoPos; i < (CapInfoPos+2); i++) - { - RTMP_IO_WRITE8(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, *ptr_capinfo); - ptr_capinfo ++; + for (i = CapInfoPos; i < (CapInfoPos + 2); i++) { + RTMP_IO_WRITE8(pAd, + pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + + i, *ptr_capinfo); + ptr_capinfo++; } - if (FrameLen > UpdatePos) - { - for (i= UpdatePos; i< (FrameLen); i++) - { - RTMP_IO_WRITE8(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, *ptr_update); - ptr_update ++; + if (FrameLen > UpdatePos) { + for (i = UpdatePos; i < (FrameLen); i++) { + RTMP_IO_WRITE8(pAd, + pAd->BeaconOffset[bcn_idx] + + TXWI_SIZE + i, *ptr_update); + ptr_update++; } } @@ -841,119 +853,115 @@ VOID RT28xx_UpdateBeaconToAsic( } - -VOID RT28xxPciStaAsicForceWakeup( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bFromTx) +VOID RT28xxPciStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) { - AUTO_WAKEUP_STRUC AutoWakeupCfg; + AUTO_WAKEUP_STRUC AutoWakeupCfg; - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - return; + if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) + return; - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WAKEUP_NOW)) - { - DBGPRINT(RT_DEBUG_TRACE, ("waking up now!\n")); - return; - } + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WAKEUP_NOW)) { + DBGPRINT(RT_DEBUG_TRACE, ("waking up now!\n")); + return; + } - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_WAKEUP_NOW); + OPSTATUS_SET_FLAG(pAd, fOP_STATUS_WAKEUP_NOW); - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_GO_TO_SLEEP_NOW); + RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_GO_TO_SLEEP_NOW); - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) - &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - { - // Support PCIe Advance Power Save - if (bFromTx == TRUE - &&(pAd->Mlme.bPsPollTimerRunning == TRUE)) - { - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); - RTMPusecDelay(3000); - DBGPRINT(RT_DEBUG_TRACE, ("=======AsicForceWakeup===bFromTx\n")); - } + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) + && pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) { + // Support PCIe Advance Power Save + if (bFromTx == TRUE && (pAd->Mlme.bPsPollTimerRunning == TRUE)) { + pAd->Mlme.bPsPollTimerRunning = FALSE; + RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); + RTMPusecDelay(3000); + DBGPRINT(RT_DEBUG_TRACE, + ("=======AsicForceWakeup===bFromTx\n")); + } AutoWakeupCfg.word = 0; RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - if (RT28xxPciAsicRadioOn(pAd, DOT11POWERSAVE)) - { + if (RT28xxPciAsicRadioOn(pAd, DOT11POWERSAVE)) { #ifdef PCIE_PS_SUPPORT // add by johnli, RF power sequence setup, load RF normal operation-mode setup - if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) - { + if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) + && IS_VERSION_AFTER_F(pAd)) { RTMP_CHIP_OP *pChipOps = &pAd->chipOps; if (pChipOps->AsicReverseRfFromSleepMode) - pChipOps->AsicReverseRfFromSleepMode(pAd); - } - else + pChipOps-> + AsicReverseRfFromSleepMode(pAd); + } else #endif // PCIE_PS_SUPPORT // { - // end johnli + // end johnli // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. - if (INFRA_ON(pAd) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) - && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { + if (INFRA_ON(pAd) + && (pAd->CommonCfg.CentralChannel != + pAd->CommonCfg.Channel) + && (pAd->MlmeAux.HtCapability.HtCapInfo. + ChannelWidth == BW_40)) { // Must using 40MHz. - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - } - else - { + AsicSwitchChannel(pAd, + pAd->CommonCfg. + CentralChannel, + FALSE); + AsicLockChannel(pAd, + pAd->CommonCfg. + CentralChannel); + } else { // Must using 20MHz. - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); + AsicSwitchChannel(pAd, + pAd->CommonCfg. + Channel, FALSE); + AsicLockChannel(pAd, + pAd->CommonCfg.Channel); } } - } + } #ifdef PCIE_PS_SUPPORT // 3090 MCU Wakeup command needs more time to be stable. // Before stable, don't issue other MCU command to prevent from firmware error. - if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("<==RT28xxPciStaAsicForceWakeup::Release the MCU Lock(3090)\n")); + if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) + && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) { + DBGPRINT(RT_DEBUG_TRACE, + ("<==RT28xxPciStaAsicForceWakeup::Release the MCU Lock(3090)\n")); RTMP_SEM_LOCK(&pAd->McuCmdLock); pAd->brt30xxBanMcuCmd = FALSE; RTMP_SEM_UNLOCK(&pAd->McuCmdLock); - } + } #endif // PCIE_PS_SUPPORT // - } - else - { - // PCI, 2860-PCIe - DBGPRINT(RT_DEBUG_TRACE, ("<==RT28xxPciStaAsicForceWakeup::Original PCI Power Saving\n")); - AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02); - AutoWakeupCfg.word = 0; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - } - - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_WAKEUP_NOW); - DBGPRINT(RT_DEBUG_TRACE, ("<=======RT28xxPciStaAsicForceWakeup\n")); -} + } else { + // PCI, 2860-PCIe + DBGPRINT(RT_DEBUG_TRACE, + ("<==RT28xxPciStaAsicForceWakeup::Original PCI Power Saving\n")); + AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02); + AutoWakeupCfg.word = 0; + RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); + } + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_WAKEUP_NOW); + DBGPRINT(RT_DEBUG_TRACE, ("<=======RT28xxPciStaAsicForceWakeup\n")); +} -VOID RT28xxPciStaAsicSleepThenAutoWakeup( - IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp) +VOID RT28xxPciStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, + IN USHORT TbttNumToNextWakeUp) { BOOLEAN brc; - if (pAd->StaCfg.bRadio == FALSE) - { + if (pAd->StaCfg.bRadio == FALSE) { OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); return; } if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) - &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - { - ULONG Now = 0; - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WAKEUP_NOW)) - { + && pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) { + ULONG Now = 0; + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WAKEUP_NOW)) { DBGPRINT(RT_DEBUG_TRACE, ("waking up now!\n")); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); return; @@ -962,24 +970,31 @@ VOID RT28xxPciStaAsicSleepThenAutoWakeup( NdisGetSystemUpTime(&Now); // If last send NULL fram time is too close to this receiving beacon (within 8ms), don't go to sleep for this DTM. // Because Some AP can't queuing outgoing frames immediately. - if (((pAd->Mlme.LastSendNULLpsmTime + 8) >= Now) && (pAd->Mlme.LastSendNULLpsmTime <= Now)) - { - DBGPRINT(RT_DEBUG_TRACE, ("Now = %lu, LastSendNULLpsmTime=%lu : RxCountSinceLastNULL = %lu. \n", Now, pAd->Mlme.LastSendNULLpsmTime, pAd->RalinkCounters.RxCountSinceLastNULL)); + if (((pAd->Mlme.LastSendNULLpsmTime + 8) >= Now) + && (pAd->Mlme.LastSendNULLpsmTime <= Now)) { + DBGPRINT(RT_DEBUG_TRACE, + ("Now = %lu, LastSendNULLpsmTime=%lu : RxCountSinceLastNULL = %lu. \n", + Now, pAd->Mlme.LastSendNULLpsmTime, + pAd->RalinkCounters.RxCountSinceLastNULL)); return; - } - else if ((pAd->RalinkCounters.RxCountSinceLastNULL > 0) && ((pAd->Mlme.LastSendNULLpsmTime + pAd->CommonCfg.BeaconPeriod) >= Now)) - { - DBGPRINT(RT_DEBUG_TRACE, ("Now = %lu, LastSendNULLpsmTime=%lu: RxCountSinceLastNULL = %lu > 0 \n", Now, pAd->Mlme.LastSendNULLpsmTime, pAd->RalinkCounters.RxCountSinceLastNULL)); + } else if ((pAd->RalinkCounters.RxCountSinceLastNULL > 0) + && + ((pAd->Mlme.LastSendNULLpsmTime + + pAd->CommonCfg.BeaconPeriod) >= Now)) { + DBGPRINT(RT_DEBUG_TRACE, + ("Now = %lu, LastSendNULLpsmTime=%lu: RxCountSinceLastNULL = %lu > 0 \n", + Now, pAd->Mlme.LastSendNULLpsmTime, + pAd->RalinkCounters.RxCountSinceLastNULL)); return; } - brc = RT28xxPciAsicRadioOff(pAd, DOT11POWERSAVE, TbttNumToNextWakeUp); - if (brc==TRUE) + brc = + RT28xxPciAsicRadioOff(pAd, DOT11POWERSAVE, + TbttNumToNextWakeUp); + if (brc == TRUE) OPSTATUS_SET_FLAG(pAd, fOP_STATUS_DOZE); - } - else - { - AUTO_WAKEUP_STRUC AutoWakeupCfg; + } else { + AUTO_WAKEUP_STRUC AutoWakeupCfg; // we have decided to SLEEP, so at least do it for a BEACON period. if (TbttNumToNextWakeUp == 0) TbttNumToNextWakeUp = 1; @@ -992,87 +1007,83 @@ VOID RT28xxPciStaAsicSleepThenAutoWakeup( AutoWakeupCfg.field.EnableAutoWakeup = 1; AutoWakeupCfg.field.AutoLeadTime = 5; RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x00); // send POWER-SAVE command to MCU. Timeout 40us. + AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x00); // send POWER-SAVE command to MCU. Timeout 40us. OPSTATUS_SET_FLAG(pAd, fOP_STATUS_DOZE); - DBGPRINT(RT_DEBUG_TRACE, ("<-- %s, TbttNumToNextWakeUp=%d \n", __func__, TbttNumToNextWakeUp)); + DBGPRINT(RT_DEBUG_TRACE, + ("<-- %s, TbttNumToNextWakeUp=%d \n", __func__, + TbttNumToNextWakeUp)); } } -VOID PsPollWakeExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +VOID PsPollWakeExec(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; + RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; unsigned long flags; - DBGPRINT(RT_DEBUG_TRACE,("-->PsPollWakeExec \n")); + DBGPRINT(RT_DEBUG_TRACE, ("-->PsPollWakeExec \n")); RTMP_INT_LOCK(&pAd->irq_lock, flags); - if (pAd->Mlme.bPsPollTimerRunning) - { - RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); - } - pAd->Mlme.bPsPollTimerRunning = FALSE; + if (pAd->Mlme.bPsPollTimerRunning) { + RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); + } + pAd->Mlme.bPsPollTimerRunning = FALSE; RTMP_INT_UNLOCK(&pAd->irq_lock, flags); #ifdef PCIE_PS_SUPPORT // For rt30xx power solution 3, Use software timer to wake up in psm. So call // AsicForceWakeup here instead of handling twakeup interrupt. - if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - DBGPRINT(RT_DEBUG_TRACE,("<--PsPollWakeExec::3090 calls AsicForceWakeup(pAd, DOT11POWERSAVE) in advance \n")); + if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) + && IS_VERSION_AFTER_F(pAd)) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) { + DBGPRINT(RT_DEBUG_TRACE, + ("<--PsPollWakeExec::3090 calls AsicForceWakeup(pAd, DOT11POWERSAVE) in advance \n")); AsicForceWakeup(pAd, DOT11POWERSAVE); } #endif // PCIE_PS_SUPPORT // } -VOID RadioOnExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +VOID RadioOnExec(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; + RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; RTMP_CHIP_OP *pChipOps = &pAd->chipOps; - WPDMA_GLO_CFG_STRUC DmaCfg; - BOOLEAN Cancelled; + WPDMA_GLO_CFG_STRUC DmaCfg; + BOOLEAN Cancelled; - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - DBGPRINT(RT_DEBUG_TRACE,("-->RadioOnExec() return on fOP_STATUS_DOZE == TRUE; \n")); + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { + DBGPRINT(RT_DEBUG_TRACE, + ("-->RadioOnExec() return on fOP_STATUS_DOZE == TRUE; \n")); //KH Debug: Add the compile flag "RT2860 and condition #ifdef RTMP_PCI_SUPPORT if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) - &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); + && pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) + RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); #endif // RTMP_PCI_SUPPORT // return; } - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - { - DBGPRINT(RT_DEBUG_TRACE,("-->RadioOnExec() return on SCAN_IN_PROGRESS; \n")); + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) { + DBGPRINT(RT_DEBUG_TRACE, + ("-->RadioOnExec() return on SCAN_IN_PROGRESS; \n")); #ifdef RTMP_PCI_SUPPORT -if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) - &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) + && pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) + RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); #endif // RTMP_PCI_SUPPORT // return; } //KH Debug: need to check. I add the compile flag "CONFIG_STA_SUPPORT" to enclose the following codes. #ifdef RTMP_PCI_SUPPORT -if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) - &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - { - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) + && pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) { + pAd->Mlme.bPsPollTimerRunning = FALSE; + RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); } #endif // RTMP_PCI_SUPPORT // - if (pAd->StaCfg.bRadio == TRUE) - { + if (pAd->StaCfg.bRadio == TRUE) { pAd->bPCIclkOff = FALSE; RTMPRingCleanUp(pAd, QID_AC_BK); RTMPRingCleanUp(pAd, QID_AC_BE); @@ -1096,15 +1107,15 @@ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, DmaCfg.word); // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. - if (INFRA_ON(pAd) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) - && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { + if (INFRA_ON(pAd) + && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) + && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == + BW_40)) { // Must using 40MHz. - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); + AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, + FALSE); AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - } - else - { + } else { // Must using 20MHz. AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.Channel); @@ -1117,14 +1128,14 @@ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) #ifdef PCIE_PS_SUPPORT // 3090 MCU Wakeup command needs more time to be stable. // Before stable, don't issue other MCU command to prevent from firmware error. -if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - RTMP_SEM_LOCK(&pAd->McuCmdLock); - pAd->brt30xxBanMcuCmd = FALSE; - RTMP_SEM_UNLOCK(&pAd->McuCmdLock); - } + if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) + && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) { + RTMP_SEM_LOCK(&pAd->McuCmdLock); + pAd->brt30xxBanMcuCmd = FALSE; + RTMP_SEM_UNLOCK(&pAd->McuCmdLock); + } #endif // PCIE_PS_SUPPORT // // Clear Radio off flag @@ -1133,13 +1144,11 @@ if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(p // Set LED RTMPSetLED(pAd, LED_RADIO_ON); - if (pAd->StaCfg.Psm == PWR_ACTIVE) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, pAd->StaCfg.BBPR3); - } - } - else - { + if (pAd->StaCfg.Psm == PWR_ACTIVE) { + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, + pAd->StaCfg.BBPR3); + } + } else { RT28xxPciAsicRadioOff(pAd, GUIRADIO_OFF, 0); } } @@ -1155,23 +1164,19 @@ if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(p ========================================================================== */ -BOOLEAN RT28xxPciAsicRadioOn( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level) +BOOLEAN RT28xxPciAsicRadioOn(IN PRTMP_ADAPTER pAd, IN UCHAR Level) { - //WPDMA_GLO_CFG_STRUC DmaCfg; - BOOLEAN Cancelled; - //UINT32 MACValue; + //WPDMA_GLO_CFG_STRUC DmaCfg; + BOOLEAN Cancelled; + //UINT32 MACValue; - if (pAd->OpMode == OPMODE_AP && Level==DOT11POWERSAVE) + if (pAd->OpMode == OPMODE_AP && Level == DOT11POWERSAVE) return FALSE; - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - { - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { + if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) { + pAd->Mlme.bPsPollTimerRunning = FALSE; + RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); } if ((pAd->StaCfg.PSControl.field.EnableNewPS == TRUE && (Level == GUIRADIO_OFF || Level == GUI_IDLE_POWER_SAVE)) || @@ -1179,86 +1184,96 @@ BOOLEAN RT28xxPciAsicRadioOn( // Some chips don't need to delay 6ms, so copy RTMPPCIePowerLinkCtrlRestore // return condition here. /* - if (((pAd->MACVersion&0xffff0000) != 0x28600000) - && ((pAd->DeviceID == NIC2860_PCIe_DEVICE_ID) - ||(pAd->DeviceID == NIC2790_PCIe_DEVICE_ID))) - */ - { - DBGPRINT(RT_DEBUG_TRACE, ("RT28xxPciAsicRadioOn ()\n")); - // 1. Set PCI Link Control in Configuration Space. - RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); - RTMPusecDelay(6000); + if (((pAd->MACVersion&0xffff0000) != 0x28600000) + && ((pAd->DeviceID == NIC2860_PCIe_DEVICE_ID) + ||(pAd->DeviceID == NIC2790_PCIe_DEVICE_ID))) + */ + { + DBGPRINT(RT_DEBUG_TRACE, + ("RT28xxPciAsicRadioOn ()\n")); + // 1. Set PCI Link Control in Configuration Space. + RTMPPCIeLinkCtrlValueRestore(pAd, + RESTORE_WAKEUP); + RTMPusecDelay(6000); + } } } - } - #ifdef PCIE_PS_SUPPORT -if (!(((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)))) + if (! + (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) + && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)))) #endif // PCIE_PS_SUPPORT // { - pAd->bPCIclkOff = FALSE; - DBGPRINT(RT_DEBUG_TRACE, ("PSM :309xbPCIclkOff == %d\n", pAd->bPCIclkOff)); + pAd->bPCIclkOff = FALSE; + DBGPRINT(RT_DEBUG_TRACE, + ("PSM :309xbPCIclkOff == %d\n", pAd->bPCIclkOff)); } // 2. Send wake up command. AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x02); - pAd->bPCIclkOff = FALSE; + pAd->bPCIclkOff = FALSE; // 2-1. wait command ok. AsicCheckCommanOk(pAd, PowerWakeCID); RTMP_ASIC_INTERRUPT_ENABLE(pAd); RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); - if (Level == GUI_IDLE_POWER_SAVE) - { + if (Level == GUI_IDLE_POWER_SAVE) { #ifdef PCIE_PS_SUPPORT - // add by johnli, RF power sequence setup, load RF normal operation-mode setup - if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) - { - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; - - if (pChipOps->AsicReverseRfFromSleepMode) - pChipOps->AsicReverseRfFromSleepMode(pAd); - // 3090 MCU Wakeup command needs more time to be stable. - // Before stable, don't issue other MCU command to prevent from firmware error. - if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - RTMP_SEM_LOCK(&pAd->McuCmdLock); - pAd->brt30xxBanMcuCmd = FALSE; - RTMP_SEM_UNLOCK(&pAd->McuCmdLock); - } + // add by johnli, RF power sequence setup, load RF normal operation-mode setup + if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) { + RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + + if (pChipOps->AsicReverseRfFromSleepMode) + pChipOps->AsicReverseRfFromSleepMode(pAd); + // 3090 MCU Wakeup command needs more time to be stable. + // Before stable, don't issue other MCU command to prevent from firmware error. + if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) + && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == + 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == + TRUE)) { + RTMP_SEM_LOCK(&pAd->McuCmdLock); + pAd->brt30xxBanMcuCmd = FALSE; + RTMP_SEM_UNLOCK(&pAd->McuCmdLock); } - else + } else // end johnli #endif // PCIE_PS_SUPPORT // - { + { // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. - { - if (INFRA_ON(pAd) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) - && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { + { + if (INFRA_ON(pAd) + && (pAd->CommonCfg.CentralChannel != + pAd->CommonCfg.Channel) + && (pAd->MlmeAux.HtCapability.HtCapInfo. + ChannelWidth == BW_40)) { // Must using 40MHz. - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - } - else - { + AsicSwitchChannel(pAd, + pAd->CommonCfg. + CentralChannel, + FALSE); + AsicLockChannel(pAd, + pAd->CommonCfg. + CentralChannel); + } else { // Must using 20MHz. - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); + AsicSwitchChannel(pAd, + pAd->CommonCfg. + Channel, FALSE); + AsicLockChannel(pAd, + pAd->CommonCfg.Channel); } - } - } + + } } - return TRUE; + return TRUE; } - /* ========================================================================== Description: @@ -1271,126 +1286,123 @@ if (!(((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_ ========================================================================== */ -BOOLEAN RT28xxPciAsicRadioOff( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level, - IN USHORT TbttNumToNextWakeUp) +BOOLEAN RT28xxPciAsicRadioOff(IN PRTMP_ADAPTER pAd, + IN UCHAR Level, IN USHORT TbttNumToNextWakeUp) { - WPDMA_GLO_CFG_STRUC DmaCfg; - UCHAR i, tempBBP_R3 = 0; - BOOLEAN brc = FALSE, Cancelled; - UINT32 TbTTTime = 0; - UINT32 PsPollTime = 0/*, MACValue*/; - ULONG BeaconPeriodTime; - UINT32 RxDmaIdx, RxCpuIdx; - DBGPRINT(RT_DEBUG_TRACE, ("AsicRadioOff ===> Lv= %d, TxCpuIdx = %d, TxDmaIdx = %d. RxCpuIdx = %d, RxDmaIdx = %d.\n", Level,pAd->TxRing[0].TxCpuIdx, pAd->TxRing[0].TxDmaIdx, pAd->RxRing.RxCpuIdx, pAd->RxRing.RxDmaIdx)); - - if (pAd->OpMode == OPMODE_AP && Level==DOT11POWERSAVE) + WPDMA_GLO_CFG_STRUC DmaCfg; + UCHAR i, tempBBP_R3 = 0; + BOOLEAN brc = FALSE, Cancelled; + UINT32 TbTTTime = 0; + UINT32 PsPollTime = 0 /*, MACValue */ ; + ULONG BeaconPeriodTime; + UINT32 RxDmaIdx, RxCpuIdx; + DBGPRINT(RT_DEBUG_TRACE, + ("AsicRadioOff ===> Lv= %d, TxCpuIdx = %d, TxDmaIdx = %d. RxCpuIdx = %d, RxDmaIdx = %d.\n", + Level, pAd->TxRing[0].TxCpuIdx, pAd->TxRing[0].TxDmaIdx, + pAd->RxRing.RxCpuIdx, pAd->RxRing.RxDmaIdx)); + + if (pAd->OpMode == OPMODE_AP && Level == DOT11POWERSAVE) return FALSE; - // Check Rx DMA busy status, if more than half is occupied, give up this radio off. - RTMP_IO_READ32(pAd, RX_DRX_IDX , &RxDmaIdx); - RTMP_IO_READ32(pAd, RX_CRX_IDX , &RxCpuIdx); - if ((RxDmaIdx > RxCpuIdx) && ((RxDmaIdx - RxCpuIdx) > RX_RING_SIZE/3)) - { - DBGPRINT(RT_DEBUG_TRACE, ("AsicRadioOff ===> return1. RxDmaIdx = %d , RxCpuIdx = %d. \n", RxDmaIdx, RxCpuIdx)); + // Check Rx DMA busy status, if more than half is occupied, give up this radio off. + RTMP_IO_READ32(pAd, RX_DRX_IDX, &RxDmaIdx); + RTMP_IO_READ32(pAd, RX_CRX_IDX, &RxCpuIdx); + if ((RxDmaIdx > RxCpuIdx) && ((RxDmaIdx - RxCpuIdx) > RX_RING_SIZE / 3)) { + DBGPRINT(RT_DEBUG_TRACE, + ("AsicRadioOff ===> return1. RxDmaIdx = %d , RxCpuIdx = %d. \n", + RxDmaIdx, RxCpuIdx)); return FALSE; - } - else if ((RxCpuIdx >= RxDmaIdx) && ((RxCpuIdx - RxDmaIdx) < RX_RING_SIZE/3)) - { - DBGPRINT(RT_DEBUG_TRACE, ("AsicRadioOff ===> return2. RxCpuIdx = %d. RxDmaIdx = %d , \n", RxCpuIdx, RxDmaIdx)); + } else if ((RxCpuIdx >= RxDmaIdx) + && ((RxCpuIdx - RxDmaIdx) < RX_RING_SIZE / 3)) { + DBGPRINT(RT_DEBUG_TRACE, + ("AsicRadioOff ===> return2. RxCpuIdx = %d. RxDmaIdx = %d , \n", + RxCpuIdx, RxDmaIdx)); return FALSE; } - - // Once go into this function, disable tx because don't want too many packets in queue to prevent HW stops. + // Once go into this function, disable tx because don't want too many packets in queue to prevent HW stops. //pAd->bPCIclkOffDisableTx = TRUE; RTMP_SET_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) - && pAd->OpMode == OPMODE_STA - &&pAd->StaCfg.PSControl.field.EnableNewPS == TRUE - ) - { - RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); + && pAd->OpMode == OPMODE_STA + && pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) { + RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); + RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - if (Level == DOT11POWERSAVE) - { + if (Level == DOT11POWERSAVE) { RTMP_IO_READ32(pAd, TBTT_TIMER, &TbTTTime); TbTTTime &= 0x1ffff; // 00. check if need to do sleep in this DTIM period. If next beacon will arrive within 30ms , ...doesn't necessarily sleep. // TbTTTime uint = 64us, LEAD_TIME unit = 1024us, PsPollTime unit = 1ms - if (((64*TbTTTime) <((LEAD_TIME*1024) + 40000)) && (TbttNumToNextWakeUp == 0)) - { - DBGPRINT(RT_DEBUG_TRACE, ("TbTTTime = 0x%x , give up this sleep. \n", TbTTTime)); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); - //pAd->bPCIclkOffDisableTx = FALSE; - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); + if (((64 * TbTTTime) < ((LEAD_TIME * 1024) + 40000)) + && (TbttNumToNextWakeUp == 0)) { + DBGPRINT(RT_DEBUG_TRACE, + ("TbTTTime = 0x%x , give up this sleep. \n", + TbTTTime)); + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); + //pAd->bPCIclkOffDisableTx = FALSE; + RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); return FALSE; - } - else - { - PsPollTime = (64*TbTTTime- LEAD_TIME*1024)/1000; + } else { + PsPollTime = + (64 * TbTTTime - LEAD_TIME * 1024) / 1000; #ifdef PCIE_PS_SUPPORT - if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - PsPollTime -= 5; - } - else + if ((IS_RT3090(pAd) || IS_RT3572(pAd) + || IS_RT3390(pAd)) + && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field. + rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field. + EnableNewPS == TRUE)) { + PsPollTime -= 5; + } else #endif // PCIE_PS_SUPPORT // - PsPollTime -= 3; + PsPollTime -= 3; - BeaconPeriodTime = pAd->CommonCfg.BeaconPeriod*102/100; + BeaconPeriodTime = + pAd->CommonCfg.BeaconPeriod * 102 / 100; if (TbttNumToNextWakeUp > 0) - PsPollTime += ((TbttNumToNextWakeUp -1) * BeaconPeriodTime); + PsPollTime += + ((TbttNumToNextWakeUp - + 1) * BeaconPeriodTime); - pAd->Mlme.bPsPollTimerRunning = TRUE; - RTMPSetTimer(&pAd->Mlme.PsPollTimer, PsPollTime); + pAd->Mlme.bPsPollTimerRunning = TRUE; + RTMPSetTimer(&pAd->Mlme.PsPollTimer, + PsPollTime); } } - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("RT28xxPciAsicRadioOff::Level!=DOT11POWERSAVE \n")); + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("RT28xxPciAsicRadioOff::Level!=DOT11POWERSAVE \n")); } pAd->bPCIclkOffDisableTx = FALSE; - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); - // Set to 1R. - if (pAd->Antenna.field.RxPath > 1 && pAd->OpMode == OPMODE_STA) - { - tempBBP_R3 = (pAd->StaCfg.BBPR3 & 0xE7); + // Set to 1R. + if (pAd->Antenna.field.RxPath > 1 && pAd->OpMode == OPMODE_STA) { + tempBBP_R3 = (pAd->StaCfg.BBPR3 & 0xE7); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, tempBBP_R3); } - // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. - if ((INFRA_ON(pAd) || pAd->OpMode == OPMODE_AP) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) - && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { + if ((INFRA_ON(pAd) || pAd->OpMode == OPMODE_AP) + && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) + && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) { // Must using 40MHz. AsicTurnOffRFClk(pAd, pAd->CommonCfg.CentralChannel); - } - else - { + } else { // Must using 20MHz. AsicTurnOffRFClk(pAd, pAd->CommonCfg.Channel); } - if (Level != RTMP_HALT) - { + if (Level != RTMP_HALT) { // Change Interrupt bitmask. - // When PCI clock is off, don't want to service interrupt. - RTMP_IO_WRITE32(pAd, INT_MASK_CSR, AutoWakeupInt); - } - else - { + // When PCI clock is off, don't want to service interrupt. + RTMP_IO_WRITE32(pAd, INT_MASK_CSR, AutoWakeupInt); + } else { RTMP_ASIC_INTERRUPT_DISABLE(pAd); } - RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RxCpuIdx); // 2. Send Sleep command RTMP_IO_WRITE32(pAd, H2M_MAILBOX_STATUS, 0xffffffff); @@ -1403,62 +1415,58 @@ BOOLEAN RT28xxPciAsicRadioOff( // 3. After 0x30 command is ok, send radio off command. lowbyte = 0 for power safe. // If 0x30 command is not ok this time, we can ignore 0x35 command. It will make sure not cause firmware'r problem. - if ((Level == DOT11POWERSAVE) && (brc == TRUE)) - { + if ((Level == DOT11POWERSAVE) && (brc == TRUE)) { AsicSendCommandToMcu(pAd, 0x35, PowerRadioOffCID, 0, 0x00); // lowbyte = 0 means to do power safe, NOT turn off radio. // 3-1. Wait command success AsicCheckCommanOk(pAd, PowerRadioOffCID); - } - else if (brc == TRUE) - { + } else if (brc == TRUE) { AsicSendCommandToMcu(pAd, 0x35, PowerRadioOffCID, 1, 0x00); // lowbyte = 0 means to do power safe, NOT turn off radio. // 3-1. Wait command success AsicCheckCommanOk(pAd, PowerRadioOffCID); } - // 1. Wait DMA not busy i = 0; - do - { + do { RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &DmaCfg.word); - if ((DmaCfg.field.RxDMABusy == 0) && (DmaCfg.field.TxDMABusy == 0)) + if ((DmaCfg.field.RxDMABusy == 0) + && (DmaCfg.field.TxDMABusy == 0)) break; RTMPusecDelay(20); i++; - }while(i < 50); + } while (i < 50); /* - if (i >= 50) - { - pAd->CheckDmaBusyCount++; - DBGPRINT(RT_DEBUG_TRACE, ("DMA Rx keeps busy. return on AsicRadioOff () CheckDmaBusyCount = %d \n", pAd->CheckDmaBusyCount)); - } - else - { - pAd->CheckDmaBusyCount = 0; - } - */ + if (i >= 50) + { + pAd->CheckDmaBusyCount++; + DBGPRINT(RT_DEBUG_TRACE, ("DMA Rx keeps busy. return on AsicRadioOff () CheckDmaBusyCount = %d \n", pAd->CheckDmaBusyCount)); + } + else + { + pAd->CheckDmaBusyCount = 0; + } + */ //KH Debug:My original codes have the follwoing codes, but currecnt codes do not have it. // Disable for stability. If PCIE Link Control is modified for advance power save, re-covery this code segment. -RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, 0x1280); + RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, 0x1280); //OPSTATUS_SET_FLAG(pAd, fOP_STATUS_CLKSELECT_40MHZ); #ifdef PCIE_PS_SUPPORT -if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("RT28xxPciAsicRadioOff::3090 return to skip the following TbttNumToNextWakeUp setting for 279x\n")); - pAd->bPCIclkOff = TRUE; - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); - // For this case, doesn't need to below actions, so return here. - return brc; + if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) + && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) { + DBGPRINT(RT_DEBUG_TRACE, + ("RT28xxPciAsicRadioOff::3090 return to skip the following TbttNumToNextWakeUp setting for 279x\n")); + pAd->bPCIclkOff = TRUE; + RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); + // For this case, doesn't need to below actions, so return here. + return brc; } #endif // PCIE_PS_SUPPORT // - if (Level == DOT11POWERSAVE) - { - AUTO_WAKEUP_STRUC AutoWakeupCfg; + if (Level == DOT11POWERSAVE) { + AUTO_WAKEUP_STRUC AutoWakeupCfg; //RTMPSetTimer(&pAd->Mlme.PsPollTimer, 90); // we have decided to SLEEP, so at least do it for a BEACON period. @@ -1474,105 +1482,97 @@ if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(p AutoWakeupCfg.field.AutoLeadTime = LEAD_TIME; RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); } - // 4-1. If it's to disable our device. Need to restore PCI Configuration Space to its original value. - if (Level == RTMP_HALT && pAd->OpMode == OPMODE_STA) - { + if (Level == RTMP_HALT && pAd->OpMode == OPMODE_STA) { if ((brc == TRUE) && (i < 50)) RTMPPCIeLinkCtrlSetting(pAd, 1); } // 4. Set PCI configuration Space Link Comtrol fields. Only Radio Off needs to call this function - else if (pAd->OpMode == OPMODE_STA) - { + else if (pAd->OpMode == OPMODE_STA) { if ((brc == TRUE) && (i < 50)) RTMPPCIeLinkCtrlSetting(pAd, 3); } - //pAd->bPCIclkOffDisableTx = FALSE; RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); return TRUE; } - - - -VOID RT28xxPciMlmeRadioOn( - IN PRTMP_ADAPTER pAd) +VOID RT28xxPciMlmeRadioOn(IN PRTMP_ADAPTER pAd) { - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) + if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) return; - DBGPRINT(RT_DEBUG_TRACE,("%s===>\n", __func__)); + DBGPRINT(RT_DEBUG_TRACE, ("%s===>\n", __func__)); - if ((pAd->OpMode == OPMODE_AP) || - ((pAd->OpMode == OPMODE_STA) - && (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) - ||pAd->StaCfg.PSControl.field.EnableNewPS == FALSE - ))) - { - RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); + if ((pAd->OpMode == OPMODE_AP) || ((pAd->OpMode == OPMODE_STA) + && + (!OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_PCIE_DEVICE) + || pAd->StaCfg.PSControl.field. + EnableNewPS == FALSE))) { + RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); //NICResetFromError(pAd); - RTMPRingCleanUp(pAd, QID_AC_BK); - RTMPRingCleanUp(pAd, QID_AC_BE); - RTMPRingCleanUp(pAd, QID_AC_VI); - RTMPRingCleanUp(pAd, QID_AC_VO); - RTMPRingCleanUp(pAd, QID_MGMT); - RTMPRingCleanUp(pAd, QID_RX); + RTMPRingCleanUp(pAd, QID_AC_BK); + RTMPRingCleanUp(pAd, QID_AC_BE); + RTMPRingCleanUp(pAd, QID_AC_VI); + RTMPRingCleanUp(pAd, QID_AC_VO); + RTMPRingCleanUp(pAd, QID_MGMT); + RTMPRingCleanUp(pAd, QID_RX); - // Enable Tx/Rx - RTMPEnableRxTx(pAd); + // Enable Tx/Rx + RTMPEnableRxTx(pAd); - // Clear Radio off flag - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); + // Clear Radio off flag + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); - // Set LED - RTMPSetLED(pAd, LED_RADIO_ON); - } + // Set LED + RTMPSetLED(pAd, LED_RADIO_ON); + } - if ((pAd->OpMode == OPMODE_STA) && - (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - &&(pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - BOOLEAN Cancelled; + if ((pAd->OpMode == OPMODE_STA) && + (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) { + BOOLEAN Cancelled; - RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); + RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); - RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 40); - } + pAd->Mlme.bPsPollTimerRunning = FALSE; + RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); + RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); + RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 40); + } } - -VOID RT28xxPciMlmeRadioOFF( - IN PRTMP_ADAPTER pAd) +VOID RT28xxPciMlmeRadioOFF(IN PRTMP_ADAPTER pAd) { - BOOLEAN brc=TRUE; + BOOLEAN brc = TRUE; - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) - return; + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) + return; // Link down first if any association exists - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) - { - if (INFRA_ON(pAd) || ADHOC_ON(pAd)) - { + if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) { + if (INFRA_ON(pAd) || ADHOC_ON(pAd)) { MLME_DISASSOC_REQ_STRUCT DisReq; - MLME_QUEUE_ELEM *pMsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); + MLME_QUEUE_ELEM *pMsgElem = + (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), + MEM_ALLOC_FLAG); - if (pMsgElem) - { - COPY_MAC_ADDR(&DisReq.Addr, pAd->CommonCfg.Bssid); - DisReq.Reason = REASON_DISASSOC_STA_LEAVING; + if (pMsgElem) { + COPY_MAC_ADDR(&DisReq.Addr, + pAd->CommonCfg.Bssid); + DisReq.Reason = REASON_DISASSOC_STA_LEAVING; pMsgElem->Machine = ASSOC_STATE_MACHINE; pMsgElem->MsgType = MT2_MLME_DISASSOC_REQ; - pMsgElem->MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT); - NdisMoveMemory(pMsgElem->Msg, &DisReq, sizeof(MLME_DISASSOC_REQ_STRUCT)); + pMsgElem->MsgLen = + sizeof(MLME_DISASSOC_REQ_STRUCT); + NdisMoveMemory(pMsgElem->Msg, &DisReq, + sizeof + (MLME_DISASSOC_REQ_STRUCT)); MlmeDisassocReqAction(pAd, pMsgElem); kfree(pMsgElem); @@ -1582,57 +1582,58 @@ VOID RT28xxPciMlmeRadioOFF( } } - DBGPRINT(RT_DEBUG_TRACE,("%s===>\n", __func__)); + DBGPRINT(RT_DEBUG_TRACE, ("%s===>\n", __func__)); // Set Radio off flag RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - { - BOOLEAN Cancelled; - if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) { - RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &Cancelled); - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); - } + BOOLEAN Cancelled; + if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) { + if (RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) { + RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, + &Cancelled); + RTMP_CLEAR_FLAG(pAd, + fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); + } // If during power safe mode. - if (pAd->StaCfg.bRadio == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE,("-->MlmeRadioOff() return on bRadio == TRUE; \n")); + if (pAd->StaCfg.bRadio == TRUE) { + DBGPRINT(RT_DEBUG_TRACE, + ("-->MlmeRadioOff() return on bRadio == TRUE; \n")); return; } // Always radio on since the NIC needs to set the MCU command (LED_RADIO_OFF). if (IDLE_ON(pAd) && - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) + (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) { RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); } - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - BOOLEAN Cancelled; - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); - } + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { + BOOLEAN Cancelled; + pAd->Mlme.bPsPollTimerRunning = FALSE; + RTMPCancelTimer(&pAd->Mlme.PsPollTimer, + &Cancelled); + RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, + &Cancelled); + } } - - // Link down first if any association exists - if (INFRA_ON(pAd) || ADHOC_ON(pAd)) - LinkDown(pAd, FALSE); - RTMPusecDelay(10000); - //========================================== - // Clean up old bss table - BssTableInit(&pAd->ScanTab); - - /* - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); - return; - } - */ - } + // Link down first if any association exists + if (INFRA_ON(pAd) || ADHOC_ON(pAd)) + LinkDown(pAd, FALSE); + RTMPusecDelay(10000); + //========================================== + // Clean up old bss table + BssTableInit(&pAd->ScanTab); + + /* + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) + { + RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); + return; + } + */ + } // Set LED.Move to here for fixing LED bug. This flag must be called after LinkDown RTMPSetLED(pAd, LED_RADIO_OFF); @@ -1640,21 +1641,19 @@ VOID RT28xxPciMlmeRadioOFF( //KH Debug:All PCIe devices need to use timer to execute radio off function, or the PCIe&&EnableNewPS needs. //KH Ans:It is right, because only when the PCIe and EnableNewPs is true, we need to delay the RadioOffTimer //to avoid the deadlock with PCIe Power saving function. -if (pAd->OpMode == OPMODE_STA&& - OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)&& - pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - { - RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); - } -else -{ - brc=RT28xxPciAsicRadioOff(pAd, GUIRADIO_OFF, 0); + if (pAd->OpMode == OPMODE_STA && + OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) && + pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) { + RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); + } else { + brc = RT28xxPciAsicRadioOff(pAd, GUIRADIO_OFF, 0); - if (brc==FALSE) - { - DBGPRINT(RT_DEBUG_ERROR,("%s call RT28xxPciAsicRadioOff fail !!\n", __func__)); + if (brc == FALSE) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s call RT28xxPciAsicRadioOff fail !!\n", + __func__)); + } } -} /* */ } diff --git a/drivers/staging/rt2860/common/cmm_mac_usb.c b/drivers/staging/rt2860/common/cmm_mac_usb.c index ad8c60176472..e53745590997 100644 --- a/drivers/staging/rt2860/common/cmm_mac_usb.c +++ b/drivers/staging/rt2860/common/cmm_mac_usb.c @@ -27,10 +27,8 @@ #ifdef RTMP_MAC_USB - #include "../rt_config.h" - /* ======================================================================== Routine Description: @@ -50,50 +48,46 @@ Note: NDIS packet descriptor. ======================================================================== */ -NDIS_STATUS NICInitRecv( - IN PRTMP_ADAPTER pAd) +NDIS_STATUS NICInitRecv(IN PRTMP_ADAPTER pAd) { - UCHAR i; - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - + UCHAR i; + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitRecv\n")); pObj = pObj; //InterlockedExchange(&pAd->PendingRx, 0); pAd->PendingRx = 0; - pAd->NextRxBulkInReadIndex = 0; // Next Rx Read index - pAd->NextRxBulkInIndex = 0 ; //RX_RING_SIZE -1; // Rx Bulk pointer - pAd->NextRxBulkInPosition = 0; + pAd->NextRxBulkInReadIndex = 0; // Next Rx Read index + pAd->NextRxBulkInIndex = 0; //RX_RING_SIZE -1; // Rx Bulk pointer + pAd->NextRxBulkInPosition = 0; - for (i = 0; i < (RX_RING_SIZE); i++) - { - PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); + for (i = 0; i < (RX_RING_SIZE); i++) { + PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); //Allocate URB pRxContext->pUrb = RTUSB_ALLOC_URB(0); - if (pRxContext->pUrb == NULL) - { + if (pRxContext->pUrb == NULL) { Status = NDIS_STATUS_RESOURCES; goto out1; } - // Allocate transfer buffer - pRxContext->TransferBuffer = RTUSB_URB_ALLOC_BUFFER(pObj->pUsb_Dev, MAX_RXBULK_SIZE, &pRxContext->data_dma); - if (pRxContext->TransferBuffer == NULL) - { + pRxContext->TransferBuffer = + RTUSB_URB_ALLOC_BUFFER(pObj->pUsb_Dev, MAX_RXBULK_SIZE, + &pRxContext->data_dma); + if (pRxContext->TransferBuffer == NULL) { Status = NDIS_STATUS_RESOURCES; goto out1; } NdisZeroMemory(pRxContext->TransferBuffer, MAX_RXBULK_SIZE); - pRxContext->pAd = pAd; + pRxContext->pAd = pAd; pRxContext->pIrp = NULL; - pRxContext->InUse = FALSE; - pRxContext->IRPPending = FALSE; - pRxContext->Readable = FALSE; + pRxContext->InUse = FALSE; + pRxContext->IRPPending = FALSE; + pRxContext->Readable = FALSE; //pRxContext->ReorderInUse = FALSE; pRxContext->bRxHandling = FALSE; pRxContext->BulkInOffset = 0; @@ -103,19 +97,17 @@ NDIS_STATUS NICInitRecv( return Status; out1: - for (i = 0; i < (RX_RING_SIZE); i++) - { - PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); + for (i = 0; i < (RX_RING_SIZE); i++) { + PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); - if (NULL != pRxContext->TransferBuffer) - { + if (NULL != pRxContext->TransferBuffer) { RTUSB_URB_FREE_BUFFER(pObj->pUsb_Dev, MAX_RXBULK_SIZE, - pRxContext->TransferBuffer, pRxContext->data_dma); + pRxContext->TransferBuffer, + pRxContext->data_dma); pRxContext->TransferBuffer = NULL; } - if (NULL != pRxContext->pUrb) - { + if (NULL != pRxContext->pUrb) { RTUSB_UNLINK_URB(pRxContext->pUrb); RTUSB_FREE_URB(pRxContext->pUrb); pRxContext->pUrb = NULL; @@ -125,7 +117,6 @@ out1: return Status; } - /* ======================================================================== Routine Description: @@ -141,8 +132,7 @@ Return Value: Note: ======================================================================== */ -NDIS_STATUS NICInitTransmit( - IN PRTMP_ADAPTER pAd) +NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd) { #define LM_USB_ALLOC(pObj, Context, TB_Type, BufferSize, Status, msg1, err1, msg2, err2) \ Context->pUrb = RTUSB_ALLOC_URB(0); \ @@ -169,60 +159,59 @@ NDIS_STATUS NICInitTransmit( Context->data_dma); \ Context->TransferBuffer = NULL; } - UCHAR i, acidx; - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - PTX_CONTEXT pNullContext = &(pAd->NullContext); - PTX_CONTEXT pPsPollContext = &(pAd->PsPollContext); - PTX_CONTEXT pRTSContext = &(pAd->RTSContext); - PTX_CONTEXT pMLMEContext = NULL; -// PHT_TX_CONTEXT pHTTXContext = NULL; - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - PVOID RingBaseVa; -// RTMP_TX_RING *pTxRing; - RTMP_MGMT_RING *pMgmtRing; + UCHAR i, acidx; + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + PTX_CONTEXT pNullContext = &(pAd->NullContext); + PTX_CONTEXT pPsPollContext = &(pAd->PsPollContext); + PTX_CONTEXT pRTSContext = &(pAd->RTSContext); + PTX_CONTEXT pMLMEContext = NULL; +// PHT_TX_CONTEXT pHTTXContext = NULL; + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + PVOID RingBaseVa; +// RTMP_TX_RING *pTxRing; + RTMP_MGMT_RING *pMgmtRing; DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitTransmit\n")); pObj = pObj; // Init 4 set of Tx parameters - for(acidx = 0; acidx < NUM_OF_TX_RING; acidx++) - { + for (acidx = 0; acidx < NUM_OF_TX_RING; acidx++) { // Initialize all Transmit releated queues InitializeQueueHeader(&pAd->TxSwQueue[acidx]); // Next Local tx ring pointer waiting for buck out pAd->NextBulkOutIndex[acidx] = acidx; - pAd->BulkOutPending[acidx] = FALSE; // Buck Out control flag + pAd->BulkOutPending[acidx] = FALSE; // Buck Out control flag //pAd->DataBulkDoneIdx[acidx] = 0; } - //pAd->NextMLMEIndex = 0; - //pAd->PushMgmtIndex = 0; - //pAd->PopMgmtIndex = 0; + //pAd->NextMLMEIndex = 0; + //pAd->PushMgmtIndex = 0; + //pAd->PopMgmtIndex = 0; //InterlockedExchange(&pAd->MgmtQueueSize, 0); //InterlockedExchange(&pAd->TxCount, 0); - //pAd->PrioRingFirstIndex = 0; - //pAd->PrioRingTxCnt = 0; + //pAd->PrioRingFirstIndex = 0; + //pAd->PrioRingTxCnt = 0; - do - { + do { // // TX_RING_SIZE, 4 ACs // - for(acidx=0; acidx<4; acidx++) - { - PHT_TX_CONTEXT pHTTXContext = &(pAd->TxContext[acidx]); + for (acidx = 0; acidx < 4; acidx++) { + PHT_TX_CONTEXT pHTTXContext = &(pAd->TxContext[acidx]); NdisZeroMemory(pHTTXContext, sizeof(HT_TX_CONTEXT)); //Allocate URB - LM_USB_ALLOC(pObj, pHTTXContext, PHTTX_BUFFER, sizeof(HTTX_BUFFER), Status, - ("<-- ERROR in Alloc TX TxContext[%d] urb!! \n", acidx), - done, - ("<-- ERROR in Alloc TX TxContext[%d] HTTX_BUFFER !! \n", acidx), - out1); - - NdisZeroMemory(pHTTXContext->TransferBuffer->Aggregation, 4); + LM_USB_ALLOC(pObj, pHTTXContext, PHTTX_BUFFER, + sizeof(HTTX_BUFFER), Status, + ("<-- ERROR in Alloc TX TxContext[%d] urb!! \n", + acidx), done, + ("<-- ERROR in Alloc TX TxContext[%d] HTTX_BUFFER !! \n", + acidx), out1); + + NdisZeroMemory(pHTTXContext->TransferBuffer-> + Aggregation, 4); pHTTXContext->pAd = pAd; pHTTXContext->pIrp = NULL; pHTTXContext->IRPPending = FALSE; @@ -237,27 +226,27 @@ NDIS_STATUS NICInitTransmit( pAd->BulkOutPending[acidx] = FALSE; } - // // MGMT_RING_SIZE // // Allocate MGMT ring descriptor's memory - pAd->MgmtDescRing.AllocSize = MGMT_RING_SIZE * sizeof(TX_CONTEXT); - os_alloc_mem(pAd, (PUCHAR *)(&pAd->MgmtDescRing.AllocVa), pAd->MgmtDescRing.AllocSize); - if (pAd->MgmtDescRing.AllocVa == NULL) - { + pAd->MgmtDescRing.AllocSize = + MGMT_RING_SIZE * sizeof(TX_CONTEXT); + os_alloc_mem(pAd, (PUCHAR *) (&pAd->MgmtDescRing.AllocVa), + pAd->MgmtDescRing.AllocSize); + if (pAd->MgmtDescRing.AllocVa == NULL) { DBGPRINT_ERR(("Failed to allocate a big buffer for MgmtDescRing!\n")); Status = NDIS_STATUS_RESOURCES; goto out1; } - NdisZeroMemory(pAd->MgmtDescRing.AllocVa, pAd->MgmtDescRing.AllocSize); - RingBaseVa = pAd->MgmtDescRing.AllocVa; + NdisZeroMemory(pAd->MgmtDescRing.AllocVa, + pAd->MgmtDescRing.AllocSize); + RingBaseVa = pAd->MgmtDescRing.AllocVa; // Initialize MGMT Ring and associated buffer memory pMgmtRing = &pAd->MgmtRing; - for (i = 0; i < MGMT_RING_SIZE; i++) - { + for (i = 0; i < MGMT_RING_SIZE; i++) { // link the pre-allocated Mgmt buffer to MgmtRing.Cell pMgmtRing->Cell[i].AllocSize = sizeof(TX_CONTEXT); pMgmtRing->Cell[i].AllocVa = RingBaseVa; @@ -265,11 +254,13 @@ NDIS_STATUS NICInitTransmit( pMgmtRing->Cell[i].pNextNdisPacket = NULL; //Allocate URB for MLMEContext - pMLMEContext = (PTX_CONTEXT) pAd->MgmtRing.Cell[i].AllocVa; + pMLMEContext = + (PTX_CONTEXT) pAd->MgmtRing.Cell[i].AllocVa; pMLMEContext->pUrb = RTUSB_ALLOC_URB(0); - if (pMLMEContext->pUrb == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("<-- ERROR in Alloc TX MLMEContext[%d] urb!! \n", i)); + if (pMLMEContext->pUrb == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("<-- ERROR in Alloc TX MLMEContext[%d] urb!! \n", + i)); Status = NDIS_STATUS_RESOURCES; goto out2; } @@ -285,7 +276,8 @@ NDIS_STATUS NICInitTransmit( // Offset to next ring descriptor address RingBaseVa = (PUCHAR) RingBaseVa + sizeof(TX_CONTEXT); } - DBGPRINT(RT_DEBUG_TRACE, ("MGMT Ring: total %d entry allocated\n", i)); + DBGPRINT(RT_DEBUG_TRACE, + ("MGMT Ring: total %d entry allocated\n", i)); //pAd->MgmtRing.TxSwFreeIdx = (MGMT_RING_SIZE - 1); pAd->MgmtRing.TxSwFreeIdx = MGMT_RING_SIZE; @@ -295,19 +287,19 @@ NDIS_STATUS NICInitTransmit( // // BEACON_RING_SIZE // - for(i=0; iBeaconContext[i]); - + PTX_CONTEXT pBeaconContext = &(pAd->BeaconContext[i]); NdisZeroMemory(pBeaconContext, sizeof(TX_CONTEXT)); //Allocate URB - LM_USB_ALLOC(pObj, pBeaconContext, PTX_BUFFER, sizeof(TX_BUFFER), Status, - ("<-- ERROR in Alloc TX BeaconContext[%d] urb!! \n", i), - out2, - ("<-- ERROR in Alloc TX BeaconContext[%d] TX_BUFFER !! \n", i), - out3); + LM_USB_ALLOC(pObj, pBeaconContext, PTX_BUFFER, + sizeof(TX_BUFFER), Status, + ("<-- ERROR in Alloc TX BeaconContext[%d] urb!! \n", + i), out2, + ("<-- ERROR in Alloc TX BeaconContext[%d] TX_BUFFER !! \n", + i), out3); pBeaconContext->pAd = pAd; pBeaconContext->pIrp = NULL; @@ -321,11 +313,12 @@ NDIS_STATUS NICInitTransmit( NdisZeroMemory(pNullContext, sizeof(TX_CONTEXT)); //Allocate URB - LM_USB_ALLOC(pObj, pNullContext, PTX_BUFFER, sizeof(TX_BUFFER), Status, - ("<-- ERROR in Alloc TX NullContext urb!! \n"), - out3, - ("<-- ERROR in Alloc TX NullContext TX_BUFFER !! \n"), - out4); + LM_USB_ALLOC(pObj, pNullContext, PTX_BUFFER, sizeof(TX_BUFFER), + Status, + ("<-- ERROR in Alloc TX NullContext urb!! \n"), + out3, + ("<-- ERROR in Alloc TX NullContext TX_BUFFER !! \n"), + out4); pNullContext->pAd = pAd; pNullContext->pIrp = NULL; @@ -338,11 +331,12 @@ NDIS_STATUS NICInitTransmit( NdisZeroMemory(pRTSContext, sizeof(TX_CONTEXT)); //Allocate URB - LM_USB_ALLOC(pObj, pRTSContext, PTX_BUFFER, sizeof(TX_BUFFER), Status, - ("<-- ERROR in Alloc TX RTSContext urb!! \n"), - out4, - ("<-- ERROR in Alloc TX RTSContext TX_BUFFER !! \n"), - out5); + LM_USB_ALLOC(pObj, pRTSContext, PTX_BUFFER, sizeof(TX_BUFFER), + Status, + ("<-- ERROR in Alloc TX RTSContext urb!! \n"), + out4, + ("<-- ERROR in Alloc TX RTSContext TX_BUFFER !! \n"), + out5); pRTSContext->pAd = pAd; pRTSContext->pIrp = NULL; @@ -354,11 +348,12 @@ NDIS_STATUS NICInitTransmit( // //NdisZeroMemory(pPsPollContext, sizeof(TX_CONTEXT)); //Allocate URB - LM_USB_ALLOC(pObj, pPsPollContext, PTX_BUFFER, sizeof(TX_BUFFER), Status, - ("<-- ERROR in Alloc TX PsPollContext urb!! \n"), - out5, - ("<-- ERROR in Alloc TX PsPollContext TX_BUFFER !! \n"), - out6); + LM_USB_ALLOC(pObj, pPsPollContext, PTX_BUFFER, + sizeof(TX_BUFFER), Status, + ("<-- ERROR in Alloc TX PsPollContext urb!! \n"), + out5, + ("<-- ERROR in Alloc TX PsPollContext TX_BUFFER !! \n"), + out6); pPsPollContext->pAd = pAd; pPsPollContext->pIrp = NULL; @@ -367,8 +362,7 @@ NDIS_STATUS NICInitTransmit( pPsPollContext->bAggregatible = FALSE; pPsPollContext->LastOne = TRUE; - } while (FALSE); - + } while (FALSE); done: DBGPRINT(RT_DEBUG_TRACE, ("<-- NICInitTransmit(Status=%d)\n", Status)); @@ -386,30 +380,28 @@ out4: LM_URB_FREE(pObj, pNullContext, sizeof(TX_BUFFER)); out3: - for(i=0; iBeaconContext[i]); + for (i = 0; i < BEACON_RING_SIZE; i++) { + PTX_CONTEXT pBeaconContext = &(pAd->BeaconContext[i]); if (pBeaconContext) LM_URB_FREE(pObj, pBeaconContext, sizeof(TX_BUFFER)); } out2: - if (pAd->MgmtDescRing.AllocVa) - { + if (pAd->MgmtDescRing.AllocVa) { pMgmtRing = &pAd->MgmtRing; - for(i=0; iMgmtRing.Cell[i].AllocVa; + for (i = 0; i < MGMT_RING_SIZE; i++) { + pMLMEContext = + (PTX_CONTEXT) pAd->MgmtRing.Cell[i].AllocVa; if (pMLMEContext) - LM_URB_FREE(pObj, pMLMEContext, sizeof(TX_BUFFER)); + LM_URB_FREE(pObj, pMLMEContext, + sizeof(TX_BUFFER)); } os_free_mem(pAd, pAd->MgmtDescRing.AllocVa); pAd->MgmtDescRing.AllocVa = NULL; } out1: - for (acidx = 0; acidx < 4; acidx++) - { + for (acidx = 0; acidx < 4; acidx++) { PHT_TX_CONTEXT pTxContext = &(pAd->TxContext[acidx]); if (pTxContext) LM_URB_FREE(pObj, pTxContext, sizeof(HTTX_BUFFER)); @@ -420,7 +412,6 @@ out1: return Status; } - /* ======================================================================== Routine Description: @@ -437,26 +428,21 @@ Return Value: Note: ======================================================================== */ -NDIS_STATUS RTMPAllocTxRxRingMemory( - IN PRTMP_ADAPTER pAd) +NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) { -// COUNTER_802_11 pCounter = &pAd->WlanCounters; - NDIS_STATUS Status; - INT num; - +// COUNTER_802_11 pCounter = &pAd->WlanCounters; + NDIS_STATUS Status; + INT num; DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPAllocTxRxRingMemory\n")); - - do - { + do { // Init the CmdQ and CmdQLock NdisAllocateSpinLock(&pAd->CmdQLock); NdisAcquireSpinLock(&pAd->CmdQLock); RTUSBInitializeCmdQ(&pAd->CmdQ); NdisReleaseSpinLock(&pAd->CmdQLock); - NdisAllocateSpinLock(&pAd->MLMEBulkOutLock); //NdisAllocateSpinLock(&pAd->MLMEWaitQueueLock); NdisAllocateSpinLock(&pAd->BulkOutLock[0]); @@ -467,26 +453,24 @@ NDIS_STATUS RTMPAllocTxRxRingMemory( NdisAllocateSpinLock(&pAd->BulkOutLock[5]); NdisAllocateSpinLock(&pAd->BulkInLock); - for (num = 0; num < NUM_OF_TX_RING; num++) - { + for (num = 0; num < NUM_OF_TX_RING; num++) { NdisAllocateSpinLock(&pAd->TxContextQueueLock[num]); } +// NdisAllocateSpinLock(&pAd->MemLock); // Not used in RT28XX -// NdisAllocateSpinLock(&pAd->MemLock); // Not used in RT28XX +// NdisAllocateSpinLock(&pAd->MacTabLock); // init it in UserCfgInit() +// NdisAllocateSpinLock(&pAd->BATabLock); // init it in BATableInit() -// NdisAllocateSpinLock(&pAd->MacTabLock); // init it in UserCfgInit() -// NdisAllocateSpinLock(&pAd->BATabLock); // init it in BATableInit() - -// for(num=0; numBATable.BARecEntry[num].RxReRingLock); -// } +// for(num=0; numBATable.BARecEntry[num].RxReRingLock); +// } // // Init Mac Table // -// MacTableInitialize(pAd); +// MacTableInitialize(pAd); // // Init send data structures and related parameters @@ -507,18 +491,18 @@ NDIS_STATUS RTMPAllocTxRxRingMemory( } while (FALSE); NdisZeroMemory(&pAd->FragFrame, sizeof(FRAGMENT_FRAME)); - pAd->FragFrame.pFragPacket = RTMP_AllocateFragPacketBuffer(pAd, RX_BUFFER_NORMSIZE); + pAd->FragFrame.pFragPacket = + RTMP_AllocateFragPacketBuffer(pAd, RX_BUFFER_NORMSIZE); - if (pAd->FragFrame.pFragPacket == NULL) - { + if (pAd->FragFrame.pFragPacket == NULL) { Status = NDIS_STATUS_RESOURCES; } - DBGPRINT_S(Status, ("<-- RTMPAllocTxRxRingMemory, Status=%x\n", Status)); + DBGPRINT_S(Status, + ("<-- RTMPAllocTxRxRingMemory, Status=%x\n", Status)); return Status; } - /* ======================================================================== Routine Description: @@ -535,8 +519,7 @@ Return Value: Note: ======================================================================== */ -VOID RTMPFreeTxRxRingMemory( - IN PRTMP_ADAPTER pAd) +VOID RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) { #define LM_URB_FREE(pObj, Context, BufferSize) \ if (NULL != Context->pUrb) { \ @@ -549,23 +532,21 @@ VOID RTMPFreeTxRxRingMemory( Context->data_dma); \ Context->TransferBuffer = NULL; } - - UINT i, acidx; - PTX_CONTEXT pNullContext = &pAd->NullContext; - PTX_CONTEXT pPsPollContext = &pAd->PsPollContext; - PTX_CONTEXT pRTSContext = &pAd->RTSContext; -// PHT_TX_CONTEXT pHTTXContext; - //PRTMP_REORDERBUF pReorderBuf; - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; -// RTMP_TX_RING *pTxRing; + UINT i, acidx; + PTX_CONTEXT pNullContext = &pAd->NullContext; + PTX_CONTEXT pPsPollContext = &pAd->PsPollContext; + PTX_CONTEXT pRTSContext = &pAd->RTSContext; +// PHT_TX_CONTEXT pHTTXContext; + //PRTMP_REORDERBUF pReorderBuf; + POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; +// RTMP_TX_RING *pTxRing; DBGPRINT(RT_DEBUG_ERROR, ("---> RTMPFreeTxRxRingMemory\n")); pObj = pObj; // Free all resources for the RECEIVE buffer queue. - for(i=0; i<(RX_RING_SIZE); i++) - { - PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); + for (i = 0; i < (RX_RING_SIZE); i++) { + PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); if (pRxContext) LM_URB_FREE(pObj, pRxContext, MAX_RXBULK_SIZE); } @@ -579,32 +560,27 @@ VOID RTMPFreeTxRxRingMemory( // Free RTS frame resource LM_URB_FREE(pObj, pRTSContext, sizeof(TX_BUFFER)); - // Free beacon frame resource - for(i=0; iBeaconContext[i]); + for (i = 0; i < BEACON_RING_SIZE; i++) { + PTX_CONTEXT pBeaconContext = &(pAd->BeaconContext[i]); if (pBeaconContext) LM_URB_FREE(pObj, pBeaconContext, sizeof(TX_BUFFER)); } - // Free mgmt frame resource - for(i = 0; i < MGMT_RING_SIZE; i++) - { - PTX_CONTEXT pMLMEContext = (PTX_CONTEXT)pAd->MgmtRing.Cell[i].AllocVa; + for (i = 0; i < MGMT_RING_SIZE; i++) { + PTX_CONTEXT pMLMEContext = + (PTX_CONTEXT) pAd->MgmtRing.Cell[i].AllocVa; //LM_URB_FREE(pObj, pMLMEContext, sizeof(TX_BUFFER)); - if (NULL != pAd->MgmtRing.Cell[i].pNdisPacket) - { - RTMPFreeNdisPacket(pAd, pAd->MgmtRing.Cell[i].pNdisPacket); + if (NULL != pAd->MgmtRing.Cell[i].pNdisPacket) { + RTMPFreeNdisPacket(pAd, + pAd->MgmtRing.Cell[i].pNdisPacket); pAd->MgmtRing.Cell[i].pNdisPacket = NULL; pMLMEContext->TransferBuffer = NULL; } - if (pMLMEContext) - { - if (NULL != pMLMEContext->pUrb) - { + if (pMLMEContext) { + if (NULL != pMLMEContext->pUrb) { RTUSB_UNLINK_URB(pMLMEContext->pUrb); RTUSB_FREE_URB(pMLMEContext->pUrb); pMLMEContext->pUrb = NULL; @@ -614,20 +590,18 @@ VOID RTMPFreeTxRxRingMemory( if (pAd->MgmtDescRing.AllocVa) os_free_mem(pAd, pAd->MgmtDescRing.AllocVa); - // Free Tx frame resource - for (acidx = 0; acidx < 4; acidx++) - { + for (acidx = 0; acidx < 4; acidx++) { PHT_TX_CONTEXT pHTTXContext = &(pAd->TxContext[acidx]); - if (pHTTXContext) - LM_URB_FREE(pObj, pHTTXContext, sizeof(HTTX_BUFFER)); - } + if (pHTTXContext) + LM_URB_FREE(pObj, pHTTXContext, sizeof(HTTX_BUFFER)); + } if (pAd->FragFrame.pFragPacket) - RELEASE_NDIS_PACKET(pAd, pAd->FragFrame.pFragPacket, NDIS_STATUS_SUCCESS); + RELEASE_NDIS_PACKET(pAd, pAd->FragFrame.pFragPacket, + NDIS_STATUS_SUCCESS); - for(i=0; i<6; i++) - { + for (i = 0; i < 6; i++) { NdisFreeSpinLock(&pAd->BulkOutLock[i]); } @@ -638,17 +612,16 @@ VOID RTMPFreeTxRxRingMemory( // Clear all pending bulk-out request flags. RTUSB_CLEAR_BULK_FLAG(pAd, 0xffffffff); -// NdisFreeSpinLock(&pAd->MacTabLock); +// NdisFreeSpinLock(&pAd->MacTabLock); -// for(i=0; iBATable.BARecEntry[i].RxReRingLock); -// } +// for(i=0; iBATable.BARecEntry[i].RxReRingLock); +// } DBGPRINT(RT_DEBUG_ERROR, ("<--- RTMPFreeTxRxRingMemory\n")); } - /* ======================================================================== Routine Description: @@ -663,20 +636,17 @@ Return Value: Note: ======================================================================== */ -NDIS_STATUS RTUSBWriteHWMACAddress( - IN PRTMP_ADAPTER pAd) +NDIS_STATUS RTUSBWriteHWMACAddress(IN PRTMP_ADAPTER pAd) { - MAC_DW0_STRUC StaMacReg0; - MAC_DW1_STRUC StaMacReg1; - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - LARGE_INTEGER NOW; - + MAC_DW0_STRUC StaMacReg0; + MAC_DW1_STRUC StaMacReg1; + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + LARGE_INTEGER NOW; // initialize the random number generator RTMP_GetCurrentSystemTime(&NOW); - if (pAd->bLocalAdminMAC != TRUE) - { + if (pAd->bLocalAdminMAC != TRUE) { pAd->CurrentAddress[0] = pAd->PermanentAddress[0]; pAd->CurrentAddress[1] = pAd->PermanentAddress[1]; pAd->CurrentAddress[2] = pAd->PermanentAddress[2]; @@ -692,16 +662,17 @@ NDIS_STATUS RTUSBWriteHWMACAddress( StaMacReg1.field.Byte4 = pAd->CurrentAddress[4]; StaMacReg1.field.Byte5 = pAd->CurrentAddress[5]; StaMacReg1.field.U2MeMask = 0xff; - DBGPRINT_RAW(RT_DEBUG_TRACE, ("Local MAC = %02x:%02x:%02x:%02x:%02x:%02x\n", - pAd->CurrentAddress[0], pAd->CurrentAddress[1], pAd->CurrentAddress[2], - pAd->CurrentAddress[3], pAd->CurrentAddress[4], pAd->CurrentAddress[5])); + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("Local MAC = %02x:%02x:%02x:%02x:%02x:%02x\n", + pAd->CurrentAddress[0], pAd->CurrentAddress[1], + pAd->CurrentAddress[2], pAd->CurrentAddress[3], + pAd->CurrentAddress[4], pAd->CurrentAddress[5])); RTUSBWriteMACRegister(pAd, MAC_ADDR_DW0, StaMacReg0.word); RTUSBWriteMACRegister(pAd, MAC_ADDR_DW1, StaMacReg1.word); return Status; } - /* ======================================================================== Routine Description: @@ -716,13 +687,11 @@ Return Value: Note: ======================================================================== */ -VOID RT28XXDMADisable( - IN RTMP_ADAPTER *pAd) +VOID RT28XXDMADisable(IN RTMP_ADAPTER * pAd) { // no use } - /* ======================================================================== Routine Description: @@ -737,42 +706,40 @@ Return Value: Note: ======================================================================== */ -VOID RT28XXDMAEnable( - IN RTMP_ADAPTER *pAd) +VOID RT28XXDMAEnable(IN RTMP_ADAPTER * pAd) { - WPDMA_GLO_CFG_STRUC GloCfg; - USB_DMA_CFG_STRUC UsbCfg; - int i = 0; - + WPDMA_GLO_CFG_STRUC GloCfg; + USB_DMA_CFG_STRUC UsbCfg; + int i = 0; RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x4); - do - { + do { RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); - if ((GloCfg.field.TxDMABusy == 0) && (GloCfg.field.RxDMABusy == 0)) + if ((GloCfg.field.TxDMABusy == 0) + && (GloCfg.field.RxDMABusy == 0)) break; DBGPRINT(RT_DEBUG_TRACE, ("==> DMABusy\n")); RTMPusecDelay(1000); i++; - }while ( i <200); - + } while (i < 200); RTMPusecDelay(50); GloCfg.field.EnTXWriteBackDDONE = 1; GloCfg.field.EnableRxDMA = 1; GloCfg.field.EnableTxDMA = 1; - DBGPRINT(RT_DEBUG_TRACE, ("<== WRITE DMA offset 0x208 = 0x%x\n", GloCfg.word)); + DBGPRINT(RT_DEBUG_TRACE, + ("<== WRITE DMA offset 0x208 = 0x%x\n", GloCfg.word)); RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); UsbCfg.word = 0; UsbCfg.field.phyclear = 0; /* usb version is 1.1,do not use bulk in aggregation */ if (pAd->BulkInMaxPacketSize == 512) - UsbCfg.field.RxBulkAggEn = 1; + UsbCfg.field.RxBulkAggEn = 1; /* for last packet, PBF might use more than limited, so minus 2 to prevent from error */ - UsbCfg.field.RxBulkAggLmt = (MAX_RXBULK_SIZE /1024)-3; - UsbCfg.field.RxBulkAggTOut = 0x80; /* 2006-10-18 */ + UsbCfg.field.RxBulkAggLmt = (MAX_RXBULK_SIZE / 1024) - 3; + UsbCfg.field.RxBulkAggTOut = 0x80; /* 2006-10-18 */ UsbCfg.field.RxBulkEn = 1; UsbCfg.field.TxBulkEn = 1; @@ -800,101 +767,96 @@ Return Value: Note: ======================================================================== */ -VOID RT28xx_UpdateBeaconToAsic( - IN RTMP_ADAPTER *pAd, - IN INT apidx, - IN ULONG FrameLen, - IN ULONG UpdatePos) +VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, + IN INT apidx, + IN ULONG FrameLen, IN ULONG UpdatePos) { - PUCHAR pBeaconFrame = NULL; - UCHAR *ptr; - UINT i, padding; - BEACON_SYNC_STRUCT *pBeaconSync = pAd->CommonCfg.pBeaconSync; - UINT32 longValue; -// USHORT shortValue; - BOOLEAN bBcnReq = FALSE; - UCHAR bcn_idx = 0; - - - if (pBeaconFrame == NULL) - { - DBGPRINT(RT_DEBUG_ERROR,("pBeaconFrame is NULL!\n")); + PUCHAR pBeaconFrame = NULL; + UCHAR *ptr; + UINT i, padding; + BEACON_SYNC_STRUCT *pBeaconSync = pAd->CommonCfg.pBeaconSync; + UINT32 longValue; +// USHORT shortValue; + BOOLEAN bBcnReq = FALSE; + UCHAR bcn_idx = 0; + + if (pBeaconFrame == NULL) { + DBGPRINT(RT_DEBUG_ERROR, ("pBeaconFrame is NULL!\n")); return; } - if (pBeaconSync == NULL) - { - DBGPRINT(RT_DEBUG_ERROR,("pBeaconSync is NULL!\n")); + if (pBeaconSync == NULL) { + DBGPRINT(RT_DEBUG_ERROR, ("pBeaconSync is NULL!\n")); return; } - //if ((pAd->WdsTab.Mode == WDS_BRIDGE_MODE) || - // ((pAd->ApCfg.MBSSID[apidx].MSSIDDev == NULL) || !(pAd->ApCfg.MBSSID[apidx].MSSIDDev->flags & IFF_UP)) - // ) - if (bBcnReq == FALSE) - { + // ((pAd->ApCfg.MBSSID[apidx].MSSIDDev == NULL) || !(pAd->ApCfg.MBSSID[apidx].MSSIDDev->flags & IFF_UP)) + // ) + if (bBcnReq == FALSE) { /* when the ra interface is down, do not send its beacon frame */ /* clear all zero */ - for(i=0; iBeaconOffset[bcn_idx] + i, 0x00); + for (i = 0; i < TXWI_SIZE; i += 4) { + RTMP_IO_WRITE32(pAd, pAd->BeaconOffset[bcn_idx] + i, + 0x00); } - pBeaconSync->BeaconBitMap &= (~(BEACON_BITMAP_MASK & (1 << bcn_idx))); + pBeaconSync->BeaconBitMap &= + (~(BEACON_BITMAP_MASK & (1 << bcn_idx))); NdisZeroMemory(pBeaconSync->BeaconTxWI[bcn_idx], TXWI_SIZE); - } - else - { - ptr = (PUCHAR)&pAd->BeaconTxWI; - if (NdisEqualMemory(pBeaconSync->BeaconTxWI[bcn_idx], &pAd->BeaconTxWI, TXWI_SIZE) == FALSE) - { // If BeaconTxWI changed, we need to rewrite the TxWI for the Beacon frames. - pBeaconSync->BeaconBitMap &= (~(BEACON_BITMAP_MASK & (1 << bcn_idx))); - NdisMoveMemory(pBeaconSync->BeaconTxWI[bcn_idx], &pAd->BeaconTxWI, TXWI_SIZE); + } else { + ptr = (PUCHAR) & pAd->BeaconTxWI; + if (NdisEqualMemory(pBeaconSync->BeaconTxWI[bcn_idx], &pAd->BeaconTxWI, TXWI_SIZE) == FALSE) { // If BeaconTxWI changed, we need to rewrite the TxWI for the Beacon frames. + pBeaconSync->BeaconBitMap &= + (~(BEACON_BITMAP_MASK & (1 << bcn_idx))); + NdisMoveMemory(pBeaconSync->BeaconTxWI[bcn_idx], + &pAd->BeaconTxWI, TXWI_SIZE); } - if ((pBeaconSync->BeaconBitMap & (1 << bcn_idx)) != (1 << bcn_idx)) - { - for (i=0; iBeaconBitMap & (1 << bcn_idx)) != + (1 << bcn_idx)) { + for (i = 0; i < TXWI_SIZE; i += 4) // 16-byte TXWI field { - longValue = *ptr + (*(ptr+1)<<8) + (*(ptr+2)<<16) + (*(ptr+3)<<24); - RTMP_IO_WRITE32(pAd, pAd->BeaconOffset[bcn_idx] + i, longValue); + longValue = + *ptr + (*(ptr + 1) << 8) + + (*(ptr + 2) << 16) + (*(ptr + 3) << 24); + RTMP_IO_WRITE32(pAd, + pAd->BeaconOffset[bcn_idx] + i, + longValue); ptr += 4; } } ptr = pBeaconSync->BeaconBuf[bcn_idx]; padding = (FrameLen & 0x01); - NdisZeroMemory((PUCHAR)(pBeaconFrame + FrameLen), padding); + NdisZeroMemory((PUCHAR) (pBeaconFrame + FrameLen), padding); FrameLen += padding; - for (i = 0 ; i < FrameLen /*HW_BEACON_OFFSET*/; i += 2) - { - if (NdisEqualMemory(ptr, pBeaconFrame, 2) == FALSE) - { + for (i = 0; i < FrameLen /*HW_BEACON_OFFSET */ ; i += 2) { + if (NdisEqualMemory(ptr, pBeaconFrame, 2) == FALSE) { NdisMoveMemory(ptr, pBeaconFrame, 2); //shortValue = *ptr + (*(ptr+1)<<8); //RTMP_IO_WRITE8(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, shortValue); - RTUSBMultiWrite(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, ptr, 2); + RTUSBMultiWrite(pAd, + pAd->BeaconOffset[bcn_idx] + + TXWI_SIZE + i, ptr, 2); } - ptr +=2; + ptr += 2; pBeaconFrame += 2; } pBeaconSync->BeaconBitMap |= (1 << bcn_idx); // For AP interface, set the DtimBitOn so that we can send Bcast/Mcast frame out after this beacon frame. -} + } } - -VOID RTUSBBssBeaconStop( - IN RTMP_ADAPTER *pAd) +VOID RTUSBBssBeaconStop(IN RTMP_ADAPTER * pAd) { - BEACON_SYNC_STRUCT *pBeaconSync; + BEACON_SYNC_STRUCT *pBeaconSync; int i, offset; - BOOLEAN Cancelled = TRUE; + BOOLEAN Cancelled = TRUE; pBeaconSync = pAd->CommonCfg.pBeaconSync; - if (pBeaconSync && pBeaconSync->EnableBeacon) - { + if (pBeaconSync && pBeaconSync->EnableBeacon) { INT NumOfBcn; { @@ -903,13 +865,15 @@ VOID RTUSBBssBeaconStop( RTMPCancelTimer(&pAd->CommonCfg.BeaconUpdateTimer, &Cancelled); - for(i=0; iBeaconBuf[i], HW_BEACON_OFFSET); + for (i = 0; i < NumOfBcn; i++) { + NdisZeroMemory(pBeaconSync->BeaconBuf[i], + HW_BEACON_OFFSET); NdisZeroMemory(pBeaconSync->BeaconTxWI[i], TXWI_SIZE); - for (offset=0; offsetBeaconOffset[i] + offset, 0x00); + for (offset = 0; offset < HW_BEACON_OFFSET; offset += 4) + RTMP_IO_WRITE32(pAd, + pAd->BeaconOffset[i] + offset, + 0x00); pBeaconSync->CapabilityInfoLocationInBeacon[i] = 0; pBeaconSync->TimIELocationInBeacon[i] = 0; @@ -919,64 +883,66 @@ VOID RTUSBBssBeaconStop( } } - -VOID RTUSBBssBeaconStart( - IN RTMP_ADAPTER *pAd) +VOID RTUSBBssBeaconStart(IN RTMP_ADAPTER * pAd) { int apidx; - BEACON_SYNC_STRUCT *pBeaconSync; -// LARGE_INTEGER tsfTime, deltaTime; + BEACON_SYNC_STRUCT *pBeaconSync; +// LARGE_INTEGER tsfTime, deltaTime; pBeaconSync = pAd->CommonCfg.pBeaconSync; - if (pBeaconSync && pBeaconSync->EnableBeacon) - { + if (pBeaconSync && pBeaconSync->EnableBeacon) { INT NumOfBcn; { NumOfBcn = MAX_MESH_NUM; } - for(apidx=0; apidxBeaconBuf[apidx], HW_BEACON_OFFSET); - pBeaconSync->CapabilityInfoLocationInBeacon[apidx] = CapabilityInfoLocationInBeacon; - pBeaconSync->TimIELocationInBeacon[apidx] = TimIELocationInBeacon; - NdisZeroMemory(pBeaconSync->BeaconTxWI[apidx], TXWI_SIZE); + NdisZeroMemory(pBeaconSync->BeaconBuf[apidx], + HW_BEACON_OFFSET); + pBeaconSync->CapabilityInfoLocationInBeacon[apidx] = + CapabilityInfoLocationInBeacon; + pBeaconSync->TimIELocationInBeacon[apidx] = + TimIELocationInBeacon; + NdisZeroMemory(pBeaconSync->BeaconTxWI[apidx], + TXWI_SIZE); } pBeaconSync->BeaconBitMap = 0; pBeaconSync->DtimBitOn = 0; pAd->CommonCfg.BeaconUpdateTimer.Repeat = TRUE; pAd->CommonCfg.BeaconAdjust = 0; - pAd->CommonCfg.BeaconFactor = 0xffffffff / (pAd->CommonCfg.BeaconPeriod << 10); - pAd->CommonCfg.BeaconRemain = (0xffffffff % (pAd->CommonCfg.BeaconPeriod << 10)) + 1; - DBGPRINT(RT_DEBUG_TRACE, ("RTUSBBssBeaconStart:BeaconFactor=%d, BeaconRemain=%d!\n", - pAd->CommonCfg.BeaconFactor, pAd->CommonCfg.BeaconRemain)); - RTMPSetTimer(&pAd->CommonCfg.BeaconUpdateTimer, 10 /*pAd->CommonCfg.BeaconPeriod*/); + pAd->CommonCfg.BeaconFactor = + 0xffffffff / (pAd->CommonCfg.BeaconPeriod << 10); + pAd->CommonCfg.BeaconRemain = + (0xffffffff % (pAd->CommonCfg.BeaconPeriod << 10)) + 1; + DBGPRINT(RT_DEBUG_TRACE, + ("RTUSBBssBeaconStart:BeaconFactor=%d, BeaconRemain=%d!\n", + pAd->CommonCfg.BeaconFactor, + pAd->CommonCfg.BeaconRemain)); + RTMPSetTimer(&pAd->CommonCfg.BeaconUpdateTimer, + 10 /*pAd->CommonCfg.BeaconPeriod */ ); } } - -VOID RTUSBBssBeaconInit( - IN RTMP_ADAPTER *pAd) +VOID RTUSBBssBeaconInit(IN RTMP_ADAPTER * pAd) { - BEACON_SYNC_STRUCT *pBeaconSync; + BEACON_SYNC_STRUCT *pBeaconSync; int i; - os_alloc_mem(pAd, (PUCHAR *)(&pAd->CommonCfg.pBeaconSync), sizeof(BEACON_SYNC_STRUCT)); + os_alloc_mem(pAd, (PUCHAR *) (&pAd->CommonCfg.pBeaconSync), + sizeof(BEACON_SYNC_STRUCT)); //NdisAllocMemory(pAd->CommonCfg.pBeaconSync, sizeof(BEACON_SYNC_STRUCT), MEM_ALLOC_FLAG); - if (pAd->CommonCfg.pBeaconSync) - { + if (pAd->CommonCfg.pBeaconSync) { pBeaconSync = pAd->CommonCfg.pBeaconSync; NdisZeroMemory(pBeaconSync, sizeof(BEACON_SYNC_STRUCT)); - for(i=0; i < HW_BEACON_MAX_COUNT; i++) - { - NdisZeroMemory(pBeaconSync->BeaconBuf[i], HW_BEACON_OFFSET); + for (i = 0; i < HW_BEACON_MAX_COUNT; i++) { + NdisZeroMemory(pBeaconSync->BeaconBuf[i], + HW_BEACON_OFFSET); pBeaconSync->CapabilityInfoLocationInBeacon[i] = 0; pBeaconSync->TimIELocationInBeacon[i] = 0; NdisZeroMemory(pBeaconSync->BeaconTxWI[i], TXWI_SIZE); @@ -988,24 +954,21 @@ VOID RTUSBBssBeaconInit( } } - -VOID RTUSBBssBeaconExit( - IN RTMP_ADAPTER *pAd) +VOID RTUSBBssBeaconExit(IN RTMP_ADAPTER * pAd) { - BEACON_SYNC_STRUCT *pBeaconSync; - BOOLEAN Cancelled = TRUE; + BEACON_SYNC_STRUCT *pBeaconSync; + BOOLEAN Cancelled = TRUE; int i; - if (pAd->CommonCfg.pBeaconSync) - { + if (pAd->CommonCfg.pBeaconSync) { pBeaconSync = pAd->CommonCfg.pBeaconSync; pBeaconSync->EnableBeacon = FALSE; RTMPCancelTimer(&pAd->CommonCfg.BeaconUpdateTimer, &Cancelled); pBeaconSync->BeaconBitMap = 0; - for(i=0; iBeaconBuf[i], HW_BEACON_OFFSET); + for (i = 0; i < HW_BEACON_MAX_COUNT; i++) { + NdisZeroMemory(pBeaconSync->BeaconBuf[i], + HW_BEACON_OFFSET); pBeaconSync->CapabilityInfoLocationInBeacon[i] = 0; pBeaconSync->TimIELocationInBeacon[i] = 0; NdisZeroMemory(pBeaconSync->BeaconTxWI[i], TXWI_SIZE); @@ -1016,7 +979,6 @@ VOID RTUSBBssBeaconExit( } } - /* ======================================================================== Routine Description: @@ -1035,61 +997,52 @@ VOID RTUSBBssBeaconExit( ======================================================================== */ -VOID BeaconUpdateExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +VOID BeaconUpdateExec(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) { - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)FunctionContext; - LARGE_INTEGER tsfTime_a;//, tsfTime_b, deltaTime_exp, deltaTime_ab; - UINT32 delta, delta2MS, period2US, remain, remain_low, remain_high; -// BOOLEAN positive; + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) FunctionContext; + LARGE_INTEGER tsfTime_a; //, tsfTime_b, deltaTime_exp, deltaTime_ab; + UINT32 delta, delta2MS, period2US, remain, remain_low, remain_high; +// BOOLEAN positive; - if (pAd->CommonCfg.IsUpdateBeacon==TRUE) - { + if (pAd->CommonCfg.IsUpdateBeacon == TRUE) { ReSyncBeaconTime(pAd); - } RTMP_IO_READ32(pAd, TSF_TIMER_DW0, &tsfTime_a.u.LowPart); RTMP_IO_READ32(pAd, TSF_TIMER_DW1, &tsfTime_a.u.HighPart); - //positive=getDeltaTime(tsfTime_a, expectedTime, &deltaTime_exp); period2US = (pAd->CommonCfg.BeaconPeriod << 10); remain_high = pAd->CommonCfg.BeaconRemain * tsfTime_a.u.HighPart; remain_low = tsfTime_a.u.LowPart % (pAd->CommonCfg.BeaconPeriod << 10); - remain = (remain_high + remain_low)%(pAd->CommonCfg.BeaconPeriod << 10); + remain = + (remain_high + remain_low) % (pAd->CommonCfg.BeaconPeriod << 10); delta = (pAd->CommonCfg.BeaconPeriod << 10) - remain; - delta2MS = (delta>>10); - if (delta2MS > 150) - { + delta2MS = (delta >> 10); + if (delta2MS > 150) { pAd->CommonCfg.BeaconUpdateTimer.TimerValue = 100; - pAd->CommonCfg.IsUpdateBeacon=FALSE; - } - else - { + pAd->CommonCfg.IsUpdateBeacon = FALSE; + } else { pAd->CommonCfg.BeaconUpdateTimer.TimerValue = delta2MS + 10; - pAd->CommonCfg.IsUpdateBeacon=TRUE; + pAd->CommonCfg.IsUpdateBeacon = TRUE; } } - /******************************************************************** * * 2870 Radio on/off Related functions. * ********************************************************************/ -VOID RT28xxUsbMlmeRadioOn( - IN PRTMP_ADAPTER pAd) +VOID RT28xxUsbMlmeRadioOn(IN PRTMP_ADAPTER pAd) { RTMP_CHIP_OP *pChipOps = &pAd->chipOps; - DBGPRINT(RT_DEBUG_TRACE,("RT28xxUsbMlmeRadioOn()\n")); + DBGPRINT(RT_DEBUG_TRACE, ("RT28xxUsbMlmeRadioOn()\n")); if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) return; @@ -1109,20 +1062,18 @@ VOID RT28xxUsbMlmeRadioOn( // Clear Radio off flag RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - RTUSBBulkReceive(pAd); + RTUSBBulkReceive(pAd); // Set LED RTMPSetLED(pAd, LED_RADIO_ON); } - -VOID RT28xxUsbMlmeRadioOFF( - IN PRTMP_ADAPTER pAd) +VOID RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd) { - WPDMA_GLO_CFG_STRUC GloCfg; - UINT32 Value, i; + WPDMA_GLO_CFG_STRUC GloCfg; + UINT32 Value, i; - DBGPRINT(RT_DEBUG_TRACE,("RT28xxUsbMlmeRadioOFF()\n")); + DBGPRINT(RT_DEBUG_TRACE, ("RT28xxUsbMlmeRadioOFF()\n")); if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) return; @@ -1132,22 +1083,25 @@ VOID RT28xxUsbMlmeRadioOFF( RTMPZeroMemory(pAd->StaCfg.SavedPMK, (PMKID_NO * sizeof(BSSID_INFO))); // Link down first if any association exists - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) - { - if (INFRA_ON(pAd) || ADHOC_ON(pAd)) - { + if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) { + if (INFRA_ON(pAd) || ADHOC_ON(pAd)) { MLME_DISASSOC_REQ_STRUCT DisReq; - MLME_QUEUE_ELEM *pMsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); + MLME_QUEUE_ELEM *pMsgElem = + (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), + MEM_ALLOC_FLAG); - if (pMsgElem) - { - COPY_MAC_ADDR(&DisReq.Addr, pAd->CommonCfg.Bssid); - DisReq.Reason = REASON_DISASSOC_STA_LEAVING; + if (pMsgElem) { + COPY_MAC_ADDR(&DisReq.Addr, + pAd->CommonCfg.Bssid); + DisReq.Reason = REASON_DISASSOC_STA_LEAVING; pMsgElem->Machine = ASSOC_STATE_MACHINE; pMsgElem->MsgType = MT2_MLME_DISASSOC_REQ; - pMsgElem->MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT); - NdisMoveMemory(pMsgElem->Msg, &DisReq, sizeof(MLME_DISASSOC_REQ_STRUCT)); + pMsgElem->MsgLen = + sizeof(MLME_DISASSOC_REQ_STRUCT); + NdisMoveMemory(pMsgElem->Msg, &DisReq, + sizeof + (MLME_DISASSOC_REQ_STRUCT)); MlmeDisassocReqAction(pAd, pMsgElem); kfree(pMsgElem); @@ -1156,7 +1110,6 @@ VOID RT28xxUsbMlmeRadioOFF( } } } - // Set Radio off flag RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); @@ -1174,34 +1127,30 @@ VOID RT28xxUsbMlmeRadioOFF( // Set LED RTMPSetLED(pAd, LED_RADIO_OFF); - - if (pAd->CommonCfg.BBPCurrentBW == BW_40) - { + if (pAd->CommonCfg.BBPCurrentBW == BW_40) { // Must using 40MHz. AsicTurnOffRFClk(pAd, pAd->CommonCfg.CentralChannel); - } - else - { + } else { // Must using 20MHz. AsicTurnOffRFClk(pAd, pAd->CommonCfg.Channel); } // Disable Tx/Rx DMA - RTUSBReadMACRegister(pAd, WPDMA_GLO_CFG, &GloCfg.word); // disable DMA + RTUSBReadMACRegister(pAd, WPDMA_GLO_CFG, &GloCfg.word); // disable DMA GloCfg.field.EnableTxDMA = 0; GloCfg.field.EnableRxDMA = 0; - RTUSBWriteMACRegister(pAd, WPDMA_GLO_CFG, GloCfg.word); // abort all TX rings + RTUSBWriteMACRegister(pAd, WPDMA_GLO_CFG, GloCfg.word); // abort all TX rings // Waiting for DMA idle i = 0; - do - { + do { RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); - if ((GloCfg.field.TxDMABusy == 0) && (GloCfg.field.RxDMABusy == 0)) + if ((GloCfg.field.TxDMABusy == 0) + && (GloCfg.field.RxDMABusy == 0)) break; RTMPusecDelay(1000); - }while (i++ < 100); + } while (i++ < 100); // Disable MAC Tx/Rx RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); diff --git a/drivers/staging/rt2860/common/cmm_sanity.c b/drivers/staging/rt2860/common/cmm_sanity.c index 457b6d8a3ce2..92c44c7ab99f 100644 --- a/drivers/staging/rt2860/common/cmm_sanity.c +++ b/drivers/staging/rt2860/common/cmm_sanity.c @@ -36,17 +36,16 @@ */ #include "../rt_config.h" +extern UCHAR CISCO_OUI[]; -extern UCHAR CISCO_OUI[]; - -extern UCHAR WPA_OUI[]; -extern UCHAR RSN_OUI[]; -extern UCHAR WME_INFO_ELEM[]; -extern UCHAR WME_PARM_ELEM[]; -extern UCHAR Ccx2QosInfo[]; -extern UCHAR RALINK_OUI[]; -extern UCHAR BROADCOM_OUI[]; -extern UCHAR WPS_OUI[]; +extern UCHAR WPA_OUI[]; +extern UCHAR RSN_OUI[]; +extern UCHAR WME_INFO_ELEM[]; +extern UCHAR WME_PARM_ELEM[]; +extern UCHAR Ccx2QosInfo[]; +extern UCHAR RALINK_OUI[]; +extern UCHAR BROADCOM_OUI[]; +extern UCHAR WPS_OUI[]; /* ========================================================================== @@ -59,35 +58,32 @@ extern UCHAR WPS_OUI[]; ========================================================================== */ -BOOLEAN MlmeAddBAReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2) +BOOLEAN MlmeAddBAReqSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, IN ULONG MsgLen, OUT PUCHAR pAddr2) { - PMLME_ADDBA_REQ_STRUCT pInfo; + PMLME_ADDBA_REQ_STRUCT pInfo; - pInfo = (MLME_ADDBA_REQ_STRUCT *)Msg; + pInfo = (MLME_ADDBA_REQ_STRUCT *) Msg; - if ((MsgLen != sizeof(MLME_ADDBA_REQ_STRUCT))) - { - DBGPRINT(RT_DEBUG_TRACE, ("MlmeAddBAReqSanity fail - message lenght not correct.\n")); - return FALSE; - } + if ((MsgLen != sizeof(MLME_ADDBA_REQ_STRUCT))) { + DBGPRINT(RT_DEBUG_TRACE, + ("MlmeAddBAReqSanity fail - message lenght not correct.\n")); + return FALSE; + } - if ((pInfo->Wcid >= MAX_LEN_OF_MAC_TABLE)) - { - DBGPRINT(RT_DEBUG_TRACE, ("MlmeAddBAReqSanity fail - The peer Mac is not associated yet.\n")); - return FALSE; - } + if ((pInfo->Wcid >= MAX_LEN_OF_MAC_TABLE)) { + DBGPRINT(RT_DEBUG_TRACE, + ("MlmeAddBAReqSanity fail - The peer Mac is not associated yet.\n")); + return FALSE; + } - if ((pInfo->pAddr[0]&0x01) == 0x01) - { - DBGPRINT(RT_DEBUG_TRACE, ("MlmeAddBAReqSanity fail - broadcast address not support BA\n")); - return FALSE; - } + if ((pInfo->pAddr[0] & 0x01) == 0x01) { + DBGPRINT(RT_DEBUG_TRACE, + ("MlmeAddBAReqSanity fail - broadcast address not support BA\n")); + return FALSE; + } - return TRUE; + return TRUE; } /* @@ -101,131 +97,133 @@ BOOLEAN MlmeAddBAReqSanity( ========================================================================== */ -BOOLEAN MlmeDelBAReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen) +BOOLEAN MlmeDelBAReqSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULONG MsgLen) { MLME_DELBA_REQ_STRUCT *pInfo; - pInfo = (MLME_DELBA_REQ_STRUCT *)Msg; - - if ((MsgLen != sizeof(MLME_DELBA_REQ_STRUCT))) - { - DBGPRINT(RT_DEBUG_ERROR, ("MlmeDelBAReqSanity fail - message lenght not correct.\n")); - return FALSE; - } - - if ((pInfo->Wcid >= MAX_LEN_OF_MAC_TABLE)) - { - DBGPRINT(RT_DEBUG_ERROR, ("MlmeDelBAReqSanity fail - The peer Mac is not associated yet.\n")); - return FALSE; - } - - if ((pInfo->TID & 0xf0)) - { - DBGPRINT(RT_DEBUG_ERROR, ("MlmeDelBAReqSanity fail - The peer TID is incorrect.\n")); - return FALSE; - } - - if (NdisEqualMemory(pAd->MacTab.Content[pInfo->Wcid].Addr, pInfo->Addr, MAC_ADDR_LEN) == 0) - { - DBGPRINT(RT_DEBUG_ERROR, ("MlmeDelBAReqSanity fail - the peer addr dosen't exist.\n")); - return FALSE; - } - - return TRUE; + pInfo = (MLME_DELBA_REQ_STRUCT *) Msg; + + if ((MsgLen != sizeof(MLME_DELBA_REQ_STRUCT))) { + DBGPRINT(RT_DEBUG_ERROR, + ("MlmeDelBAReqSanity fail - message lenght not correct.\n")); + return FALSE; + } + + if ((pInfo->Wcid >= MAX_LEN_OF_MAC_TABLE)) { + DBGPRINT(RT_DEBUG_ERROR, + ("MlmeDelBAReqSanity fail - The peer Mac is not associated yet.\n")); + return FALSE; + } + + if ((pInfo->TID & 0xf0)) { + DBGPRINT(RT_DEBUG_ERROR, + ("MlmeDelBAReqSanity fail - The peer TID is incorrect.\n")); + return FALSE; + } + + if (NdisEqualMemory + (pAd->MacTab.Content[pInfo->Wcid].Addr, pInfo->Addr, + MAC_ADDR_LEN) == 0) { + DBGPRINT(RT_DEBUG_ERROR, + ("MlmeDelBAReqSanity fail - the peer addr dosen't exist.\n")); + return FALSE; + } + + return TRUE; } -BOOLEAN PeerAddBAReqActionSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2) +BOOLEAN PeerAddBAReqActionSanity(IN PRTMP_ADAPTER pAd, + IN VOID * pMsg, + IN ULONG MsgLen, OUT PUCHAR pAddr2) { - PFRAME_802_11 pFrame = (PFRAME_802_11)pMsg; + PFRAME_802_11 pFrame = (PFRAME_802_11) pMsg; PFRAME_ADDBA_REQ pAddFrame; - pAddFrame = (PFRAME_ADDBA_REQ)(pMsg); - if (MsgLen < (sizeof(FRAME_ADDBA_REQ))) - { - DBGPRINT(RT_DEBUG_ERROR,("PeerAddBAReqActionSanity: ADDBA Request frame length size = %ld incorrect\n", MsgLen)); + pAddFrame = (PFRAME_ADDBA_REQ) (pMsg); + if (MsgLen < (sizeof(FRAME_ADDBA_REQ))) { + DBGPRINT(RT_DEBUG_ERROR, + ("PeerAddBAReqActionSanity: ADDBA Request frame length size = %ld incorrect\n", + MsgLen)); return FALSE; } // we support immediate BA. - *(USHORT *)(&pAddFrame->BaParm) = cpu2le16(*(USHORT *)(&pAddFrame->BaParm)); + *(USHORT *) (&pAddFrame->BaParm) = + cpu2le16(*(USHORT *) (&pAddFrame->BaParm)); pAddFrame->TimeOutValue = cpu2le16(pAddFrame->TimeOutValue); pAddFrame->BaStartSeq.word = cpu2le16(pAddFrame->BaStartSeq.word); - if (pAddFrame->BaParm.BAPolicy != IMMED_BA) - { - DBGPRINT(RT_DEBUG_ERROR,("PeerAddBAReqActionSanity: ADDBA Request Ba Policy[%d] not support\n", pAddFrame->BaParm.BAPolicy)); - DBGPRINT(RT_DEBUG_ERROR,("ADDBA Request. tid=%x, Bufsize=%x, AMSDUSupported=%x \n", pAddFrame->BaParm.TID, pAddFrame->BaParm.BufSize, pAddFrame->BaParm.AMSDUSupported)); + if (pAddFrame->BaParm.BAPolicy != IMMED_BA) { + DBGPRINT(RT_DEBUG_ERROR, + ("PeerAddBAReqActionSanity: ADDBA Request Ba Policy[%d] not support\n", + pAddFrame->BaParm.BAPolicy)); + DBGPRINT(RT_DEBUG_ERROR, + ("ADDBA Request. tid=%x, Bufsize=%x, AMSDUSupported=%x \n", + pAddFrame->BaParm.TID, pAddFrame->BaParm.BufSize, + pAddFrame->BaParm.AMSDUSupported)); return FALSE; } - // we support immediate BA. - if (pAddFrame->BaParm.TID &0xfff0) - { - DBGPRINT(RT_DEBUG_ERROR,("PeerAddBAReqActionSanity: ADDBA Request incorrect TID = %d\n", pAddFrame->BaParm.TID)); + if (pAddFrame->BaParm.TID & 0xfff0) { + DBGPRINT(RT_DEBUG_ERROR, + ("PeerAddBAReqActionSanity: ADDBA Request incorrect TID = %d\n", + pAddFrame->BaParm.TID)); return FALSE; } COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); return TRUE; } -BOOLEAN PeerAddBARspActionSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen) +BOOLEAN PeerAddBARspActionSanity(IN PRTMP_ADAPTER pAd, + IN VOID * pMsg, IN ULONG MsgLen) { PFRAME_ADDBA_RSP pAddFrame; - pAddFrame = (PFRAME_ADDBA_RSP)(pMsg); - if (MsgLen < (sizeof(FRAME_ADDBA_RSP))) - { - DBGPRINT(RT_DEBUG_ERROR,("PeerAddBARspActionSanity: ADDBA Response frame length size = %ld incorrect\n", MsgLen)); + pAddFrame = (PFRAME_ADDBA_RSP) (pMsg); + if (MsgLen < (sizeof(FRAME_ADDBA_RSP))) { + DBGPRINT(RT_DEBUG_ERROR, + ("PeerAddBARspActionSanity: ADDBA Response frame length size = %ld incorrect\n", + MsgLen)); return FALSE; } // we support immediate BA. - *(USHORT *)(&pAddFrame->BaParm) = cpu2le16(*(USHORT *)(&pAddFrame->BaParm)); + *(USHORT *) (&pAddFrame->BaParm) = + cpu2le16(*(USHORT *) (&pAddFrame->BaParm)); pAddFrame->StatusCode = cpu2le16(pAddFrame->StatusCode); pAddFrame->TimeOutValue = cpu2le16(pAddFrame->TimeOutValue); - if (pAddFrame->BaParm.BAPolicy != IMMED_BA) - { - DBGPRINT(RT_DEBUG_ERROR,("PeerAddBAReqActionSanity: ADDBA Response Ba Policy[%d] not support\n", pAddFrame->BaParm.BAPolicy)); + if (pAddFrame->BaParm.BAPolicy != IMMED_BA) { + DBGPRINT(RT_DEBUG_ERROR, + ("PeerAddBAReqActionSanity: ADDBA Response Ba Policy[%d] not support\n", + pAddFrame->BaParm.BAPolicy)); return FALSE; } - // we support immediate BA. - if (pAddFrame->BaParm.TID &0xfff0) - { - DBGPRINT(RT_DEBUG_ERROR,("PeerAddBARspActionSanity: ADDBA Response incorrect TID = %d\n", pAddFrame->BaParm.TID)); + if (pAddFrame->BaParm.TID & 0xfff0) { + DBGPRINT(RT_DEBUG_ERROR, + ("PeerAddBARspActionSanity: ADDBA Response incorrect TID = %d\n", + pAddFrame->BaParm.TID)); return FALSE; } return TRUE; } -BOOLEAN PeerDelBAActionSanity( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN VOID *pMsg, - IN ULONG MsgLen ) +BOOLEAN PeerDelBAActionSanity(IN PRTMP_ADAPTER pAd, + IN UCHAR Wcid, IN VOID * pMsg, IN ULONG MsgLen) { //PFRAME_802_11 pFrame = (PFRAME_802_11)pMsg; - PFRAME_DELBA_REQ pDelFrame; + PFRAME_DELBA_REQ pDelFrame; if (MsgLen != (sizeof(FRAME_DELBA_REQ))) return FALSE; if (Wcid >= MAX_LEN_OF_MAC_TABLE) return FALSE; - pDelFrame = (PFRAME_DELBA_REQ)(pMsg); + pDelFrame = (PFRAME_DELBA_REQ) (pMsg); - *(USHORT *)(&pDelFrame->DelbaParm) = cpu2le16(*(USHORT *)(&pDelFrame->DelbaParm)); + *(USHORT *) (&pDelFrame->DelbaParm) = + cpu2le16(*(USHORT *) (&pDelFrame->DelbaParm)); pDelFrame->ReasonCode = cpu2le16(pDelFrame->ReasonCode); - if (pDelFrame->DelbaParm.TID &0xfff0) + if (pDelFrame->DelbaParm.TID & 0xfff0) return FALSE; return TRUE; @@ -242,493 +240,469 @@ BOOLEAN PeerDelBAActionSanity( ========================================================================== */ -BOOLEAN PeerBeaconAndProbeRspSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - IN UCHAR MsgChannel, - OUT PUCHAR pAddr2, - OUT PUCHAR pBssid, - OUT CHAR Ssid[], - OUT UCHAR *pSsidLen, - OUT UCHAR *pBssType, - OUT USHORT *pBeaconPeriod, - OUT UCHAR *pChannel, - OUT UCHAR *pNewChannel, - OUT LARGE_INTEGER *pTimestamp, - OUT CF_PARM *pCfParm, - OUT USHORT *pAtimWin, - OUT USHORT *pCapabilityInfo, - OUT UCHAR *pErp, - OUT UCHAR *pDtimCount, - OUT UCHAR *pDtimPeriod, - OUT UCHAR *pBcastFlag, - OUT UCHAR *pMessageToMe, - OUT UCHAR SupRate[], - OUT UCHAR *pSupRateLen, - OUT UCHAR ExtRate[], - OUT UCHAR *pExtRateLen, - OUT UCHAR *pCkipFlag, - OUT UCHAR *pAironetCellPowerLimit, - OUT PEDCA_PARM pEdcaParm, - OUT PQBSS_LOAD_PARM pQbssLoad, - OUT PQOS_CAPABILITY_PARM pQosCapability, - OUT ULONG *pRalinkIe, - OUT UCHAR *pHtCapabilityLen, - OUT UCHAR *pPreNHtCapabilityLen, - OUT HT_CAPABILITY_IE *pHtCapability, - OUT UCHAR *AddHtInfoLen, - OUT ADD_HT_INFO_IE *AddHtInfo, - OUT UCHAR *NewExtChannelOffset, // Ht extension channel offset(above or below) - OUT USHORT *LengthVIE, - OUT PNDIS_802_11_VARIABLE_IEs pVIE) +BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULONG MsgLen, IN UCHAR MsgChannel, OUT PUCHAR pAddr2, OUT PUCHAR pBssid, OUT CHAR Ssid[], OUT UCHAR * pSsidLen, OUT UCHAR * pBssType, OUT USHORT * pBeaconPeriod, OUT UCHAR * pChannel, OUT UCHAR * pNewChannel, OUT LARGE_INTEGER * pTimestamp, OUT CF_PARM * pCfParm, OUT USHORT * pAtimWin, OUT USHORT * pCapabilityInfo, OUT UCHAR * pErp, OUT UCHAR * pDtimCount, OUT UCHAR * pDtimPeriod, OUT UCHAR * pBcastFlag, OUT UCHAR * pMessageToMe, OUT UCHAR SupRate[], OUT UCHAR * pSupRateLen, OUT UCHAR ExtRate[], OUT UCHAR * pExtRateLen, OUT UCHAR * pCkipFlag, OUT UCHAR * pAironetCellPowerLimit, OUT PEDCA_PARM pEdcaParm, OUT PQBSS_LOAD_PARM pQbssLoad, OUT PQOS_CAPABILITY_PARM pQosCapability, OUT ULONG * pRalinkIe, OUT UCHAR * pHtCapabilityLen, OUT UCHAR * pPreNHtCapabilityLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT UCHAR * AddHtInfoLen, OUT ADD_HT_INFO_IE * AddHtInfo, OUT UCHAR * NewExtChannelOffset, // Ht extension channel offset(above or below) + OUT USHORT * LengthVIE, + OUT PNDIS_802_11_VARIABLE_IEs pVIE) { - UCHAR *Ptr; - UCHAR TimLen; - PFRAME_802_11 pFrame; - PEID_STRUCT pEid; - UCHAR SubType; - UCHAR Sanity; - //UCHAR ECWMin, ECWMax; - //MAC_CSR9_STRUC Csr9; - ULONG Length = 0; + UCHAR *Ptr; + UCHAR TimLen; + PFRAME_802_11 pFrame; + PEID_STRUCT pEid; + UCHAR SubType; + UCHAR Sanity; + //UCHAR ECWMin, ECWMax; + //MAC_CSR9_STRUC Csr9; + ULONG Length = 0; // For some 11a AP which didn't have DS_IE, we use two conditions to decide the channel - // 1. If the AP is 11n enabled, then check the control channel. - // 2. If the AP didn't have any info about channel, use the channel we received this frame as the channel. (May inaccuracy!!) - UCHAR CtrlChannel = 0; - - // Add for 3 necessary EID field check - Sanity = 0; - - *pAtimWin = 0; - *pErp = 0; - *pDtimCount = 0; - *pDtimPeriod = 0; - *pBcastFlag = 0; - *pMessageToMe = 0; - *pExtRateLen = 0; - *pCkipFlag = 0; // Default of CkipFlag is 0 - *pAironetCellPowerLimit = 0xFF; // Default of AironetCellPowerLimit is 0xFF - *LengthVIE = 0; // Set the length of VIE to init value 0 - *pHtCapabilityLen = 0; // Set the length of VIE to init value 0 + // 1. If the AP is 11n enabled, then check the control channel. + // 2. If the AP didn't have any info about channel, use the channel we received this frame as the channel. (May inaccuracy!!) + UCHAR CtrlChannel = 0; + + // Add for 3 necessary EID field check + Sanity = 0; + + *pAtimWin = 0; + *pErp = 0; + *pDtimCount = 0; + *pDtimPeriod = 0; + *pBcastFlag = 0; + *pMessageToMe = 0; + *pExtRateLen = 0; + *pCkipFlag = 0; // Default of CkipFlag is 0 + *pAironetCellPowerLimit = 0xFF; // Default of AironetCellPowerLimit is 0xFF + *LengthVIE = 0; // Set the length of VIE to init value 0 + *pHtCapabilityLen = 0; // Set the length of VIE to init value 0 if (pAd->OpMode == OPMODE_STA) - *pPreNHtCapabilityLen = 0; // Set the length of VIE to init value 0 - *AddHtInfoLen = 0; // Set the length of VIE to init value 0 - *pRalinkIe = 0; - *pNewChannel = 0; - *NewExtChannelOffset = 0xff; //Default 0xff means no such IE - pCfParm->bValid = FALSE; // default: no IE_CF found - pQbssLoad->bValid = FALSE; // default: no IE_QBSS_LOAD found - pEdcaParm->bValid = FALSE; // default: no IE_EDCA_PARAMETER found - pQosCapability->bValid = FALSE; // default: no IE_QOS_CAPABILITY found + *pPreNHtCapabilityLen = 0; // Set the length of VIE to init value 0 + *AddHtInfoLen = 0; // Set the length of VIE to init value 0 + *pRalinkIe = 0; + *pNewChannel = 0; + *NewExtChannelOffset = 0xff; //Default 0xff means no such IE + pCfParm->bValid = FALSE; // default: no IE_CF found + pQbssLoad->bValid = FALSE; // default: no IE_QBSS_LOAD found + pEdcaParm->bValid = FALSE; // default: no IE_EDCA_PARAMETER found + pQosCapability->bValid = FALSE; // default: no IE_QOS_CAPABILITY found + + pFrame = (PFRAME_802_11) Msg; + + // get subtype from header + SubType = (UCHAR) pFrame->Hdr.FC.SubType; + + // get Addr2 and BSSID from header + COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); + COPY_MAC_ADDR(pBssid, pFrame->Hdr.Addr3); - pFrame = (PFRAME_802_11)Msg; + Ptr = pFrame->Octet; + Length += LENGTH_802_11; - // get subtype from header - SubType = (UCHAR)pFrame->Hdr.FC.SubType; + // get timestamp from payload and advance the pointer + NdisMoveMemory(pTimestamp, Ptr, TIMESTAMP_LEN); - // get Addr2 and BSSID from header - COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); - COPY_MAC_ADDR(pBssid, pFrame->Hdr.Addr3); + pTimestamp->u.LowPart = cpu2le32(pTimestamp->u.LowPart); + pTimestamp->u.HighPart = cpu2le32(pTimestamp->u.HighPart); - Ptr = pFrame->Octet; - Length += LENGTH_802_11; + Ptr += TIMESTAMP_LEN; + Length += TIMESTAMP_LEN; - // get timestamp from payload and advance the pointer - NdisMoveMemory(pTimestamp, Ptr, TIMESTAMP_LEN); + // get beacon interval from payload and advance the pointer + NdisMoveMemory(pBeaconPeriod, Ptr, 2); + Ptr += 2; + Length += 2; - pTimestamp->u.LowPart = cpu2le32(pTimestamp->u.LowPart); - pTimestamp->u.HighPart = cpu2le32(pTimestamp->u.HighPart); + // get capability info from payload and advance the pointer + NdisMoveMemory(pCapabilityInfo, Ptr, 2); + Ptr += 2; + Length += 2; - Ptr += TIMESTAMP_LEN; - Length += TIMESTAMP_LEN; - - // get beacon interval from payload and advance the pointer - NdisMoveMemory(pBeaconPeriod, Ptr, 2); - Ptr += 2; - Length += 2; - - // get capability info from payload and advance the pointer - NdisMoveMemory(pCapabilityInfo, Ptr, 2); - Ptr += 2; - Length += 2; - - if (CAP_IS_ESS_ON(*pCapabilityInfo)) - *pBssType = BSS_INFRA; - else - *pBssType = BSS_ADHOC; - - pEid = (PEID_STRUCT) Ptr; - - // get variable fields from payload and advance the pointer - while ((Length + 2 + pEid->Len) <= MsgLen) - { - // - // Secure copy VIE to VarIE[MAX_VIE_LEN] didn't overflow. - // - if ((*LengthVIE + pEid->Len + 2) >= MAX_VIE_LEN) - { - DBGPRINT(RT_DEBUG_WARN, ("PeerBeaconAndProbeRspSanity - Variable IEs out of resource [len(=%d) > MAX_VIE_LEN(=%d)]\n", - (*LengthVIE + pEid->Len + 2), MAX_VIE_LEN)); - break; - } - - switch(pEid->Eid) - { - case IE_SSID: - // Already has one SSID EID in this beacon, ignore the second one - if (Sanity & 0x1) - break; - if(pEid->Len <= MAX_LEN_OF_SSID) - { - NdisMoveMemory(Ssid, pEid->Octet, pEid->Len); - *pSsidLen = pEid->Len; - Sanity |= 0x1; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAndProbeRspSanity - wrong IE_SSID (len=%d)\n",pEid->Len)); - return FALSE; - } - break; - - case IE_SUPP_RATES: - if(pEid->Len <= MAX_LEN_OF_SUPPORTED_RATES) - { - Sanity |= 0x2; - NdisMoveMemory(SupRate, pEid->Octet, pEid->Len); - *pSupRateLen = pEid->Len; - - // TODO: 2004-09-14 not a good design here, cause it exclude extra rates - // from ScanTab. We should report as is. And filter out unsupported - // rates in MlmeAux. - // Check against the supported rates - // RTMPCheckRates(pAd, SupRate, pSupRateLen); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAndProbeRspSanity - wrong IE_SUPP_RATES (len=%d)\n",pEid->Len)); - return FALSE; - } - break; - - case IE_HT_CAP: - if (pEid->Len >= SIZE_HT_CAP_IE) //Note: allow extension.!! + if (CAP_IS_ESS_ON(*pCapabilityInfo)) + *pBssType = BSS_INFRA; + else + *pBssType = BSS_ADHOC; + + pEid = (PEID_STRUCT) Ptr; + + // get variable fields from payload and advance the pointer + while ((Length + 2 + pEid->Len) <= MsgLen) { + // + // Secure copy VIE to VarIE[MAX_VIE_LEN] didn't overflow. + // + if ((*LengthVIE + pEid->Len + 2) >= MAX_VIE_LEN) { + DBGPRINT(RT_DEBUG_WARN, + ("PeerBeaconAndProbeRspSanity - Variable IEs out of resource [len(=%d) > MAX_VIE_LEN(=%d)]\n", + (*LengthVIE + pEid->Len + 2), MAX_VIE_LEN)); + break; + } + + switch (pEid->Eid) { + case IE_SSID: + // Already has one SSID EID in this beacon, ignore the second one + if (Sanity & 0x1) + break; + if (pEid->Len <= MAX_LEN_OF_SSID) { + NdisMoveMemory(Ssid, pEid->Octet, pEid->Len); + *pSsidLen = pEid->Len; + Sanity |= 0x1; + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("PeerBeaconAndProbeRspSanity - wrong IE_SSID (len=%d)\n", + pEid->Len)); + return FALSE; + } + break; + + case IE_SUPP_RATES: + if (pEid->Len <= MAX_LEN_OF_SUPPORTED_RATES) { + Sanity |= 0x2; + NdisMoveMemory(SupRate, pEid->Octet, pEid->Len); + *pSupRateLen = pEid->Len; + + // TODO: 2004-09-14 not a good design here, cause it exclude extra rates + // from ScanTab. We should report as is. And filter out unsupported + // rates in MlmeAux. + // Check against the supported rates + // RTMPCheckRates(pAd, SupRate, pSupRateLen); + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("PeerBeaconAndProbeRspSanity - wrong IE_SUPP_RATES (len=%d)\n", + pEid->Len)); + return FALSE; + } + break; + + case IE_HT_CAP: + if (pEid->Len >= SIZE_HT_CAP_IE) //Note: allow extension.!! { - NdisMoveMemory(pHtCapability, pEid->Octet, sizeof(HT_CAPABILITY_IE)); + NdisMoveMemory(pHtCapability, pEid->Octet, + sizeof(HT_CAPABILITY_IE)); *pHtCapabilityLen = SIZE_HT_CAP_IE; // Nnow we only support 26 bytes. - *(USHORT *)(&pHtCapability->HtCapInfo) = cpu2le16(*(USHORT *)(&pHtCapability->HtCapInfo)); - *(USHORT *)(&pHtCapability->ExtHtCapInfo) = cpu2le16(*(USHORT *)(&pHtCapability->ExtHtCapInfo)); + *(USHORT *) (&pHtCapability->HtCapInfo) = + cpu2le16(*(USHORT *) + (&pHtCapability->HtCapInfo)); + *(USHORT *) (&pHtCapability->ExtHtCapInfo) = + cpu2le16(*(USHORT *) + (&pHtCapability->ExtHtCapInfo)); { *pPreNHtCapabilityLen = 0; // Nnow we only support 26 bytes. Ptr = (PUCHAR) pVIE; - NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid, pEid->Len + 2); + NdisMoveMemory(Ptr + *LengthVIE, + &pEid->Eid, + pEid->Len + 2); *LengthVIE += (pEid->Len + 2); } - } - else - { - DBGPRINT(RT_DEBUG_WARN, ("PeerBeaconAndProbeRspSanity - wrong IE_HT_CAP. pEid->Len = %d\n", pEid->Len)); + } else { + DBGPRINT(RT_DEBUG_WARN, + ("PeerBeaconAndProbeRspSanity - wrong IE_HT_CAP. pEid->Len = %d\n", + pEid->Len)); } - break; - case IE_ADD_HT: - if (pEid->Len >= sizeof(ADD_HT_INFO_IE)) - { + break; + case IE_ADD_HT: + if (pEid->Len >= sizeof(ADD_HT_INFO_IE)) { // This IE allows extension, but we can ignore extra bytes beyond our knowledge , so only // copy first sizeof(ADD_HT_INFO_IE) - NdisMoveMemory(AddHtInfo, pEid->Octet, sizeof(ADD_HT_INFO_IE)); + NdisMoveMemory(AddHtInfo, pEid->Octet, + sizeof(ADD_HT_INFO_IE)); *AddHtInfoLen = SIZE_ADD_HT_INFO_IE; CtrlChannel = AddHtInfo->ControlChan; - *(USHORT *)(&AddHtInfo->AddHtInfo2) = cpu2le16(*(USHORT *)(&AddHtInfo->AddHtInfo2)); - *(USHORT *)(&AddHtInfo->AddHtInfo3) = cpu2le16(*(USHORT *)(&AddHtInfo->AddHtInfo3)); + *(USHORT *) (&AddHtInfo->AddHtInfo2) = + cpu2le16(*(USHORT *) + (&AddHtInfo->AddHtInfo2)); + *(USHORT *) (&AddHtInfo->AddHtInfo3) = + cpu2le16(*(USHORT *) + (&AddHtInfo->AddHtInfo3)); { - Ptr = (PUCHAR) pVIE; - NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid, pEid->Len + 2); - *LengthVIE += (pEid->Len + 2); + Ptr = (PUCHAR) pVIE; + NdisMoveMemory(Ptr + *LengthVIE, + &pEid->Eid, + pEid->Len + 2); + *LengthVIE += (pEid->Len + 2); } - } - else - { - DBGPRINT(RT_DEBUG_WARN, ("PeerBeaconAndProbeRspSanity - wrong IE_ADD_HT. \n")); + } else { + DBGPRINT(RT_DEBUG_WARN, + ("PeerBeaconAndProbeRspSanity - wrong IE_ADD_HT. \n")); } - break; - case IE_SECONDARY_CH_OFFSET: - if (pEid->Len == 1) - { + break; + case IE_SECONDARY_CH_OFFSET: + if (pEid->Len == 1) { *NewExtChannelOffset = pEid->Octet[0]; - } - else - { - DBGPRINT(RT_DEBUG_WARN, ("PeerBeaconAndProbeRspSanity - wrong IE_SECONDARY_CH_OFFSET. \n")); + } else { + DBGPRINT(RT_DEBUG_WARN, + ("PeerBeaconAndProbeRspSanity - wrong IE_SECONDARY_CH_OFFSET. \n")); } - break; - case IE_FH_PARM: - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAndProbeRspSanity(IE_FH_PARM) \n")); - break; + break; + case IE_FH_PARM: + DBGPRINT(RT_DEBUG_TRACE, + ("PeerBeaconAndProbeRspSanity(IE_FH_PARM) \n")); + break; - case IE_DS_PARM: - if(pEid->Len == 1) - { - *pChannel = *pEid->Octet; + case IE_DS_PARM: + if (pEid->Len == 1) { + *pChannel = *pEid->Octet; - { - if (ChannelSanity(pAd, *pChannel) == 0) - { + { + if (ChannelSanity(pAd, *pChannel) == 0) { - return FALSE; - } + return FALSE; } - - Sanity |= 0x4; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAndProbeRspSanity - wrong IE_DS_PARM (len=%d)\n",pEid->Len)); - return FALSE; - } - break; - - case IE_CF_PARM: - if(pEid->Len == 6) - { - pCfParm->bValid = TRUE; - pCfParm->CfpCount = pEid->Octet[0]; - pCfParm->CfpPeriod = pEid->Octet[1]; - pCfParm->CfpMaxDuration = pEid->Octet[2] + 256 * pEid->Octet[3]; - pCfParm->CfpDurRemaining = pEid->Octet[4] + 256 * pEid->Octet[5]; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAndProbeRspSanity - wrong IE_CF_PARM\n")); - return FALSE; - } - break; - - case IE_IBSS_PARM: - if(pEid->Len == 2) - { - NdisMoveMemory(pAtimWin, pEid->Octet, pEid->Len); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAndProbeRspSanity - wrong IE_IBSS_PARM\n")); - return FALSE; - } - break; - - case IE_TIM: - if(INFRA_ON(pAd) && SubType == SUBTYPE_BEACON) - { - GetTimBit((PCHAR)pEid, pAd->StaActive.Aid, &TimLen, pBcastFlag, pDtimCount, pDtimPeriod, pMessageToMe); - } - break; - case IE_CHANNEL_SWITCH_ANNOUNCEMENT: - if(pEid->Len == 3) - { - *pNewChannel = pEid->Octet[1]; //extract new channel number - } - break; - - // New for WPA - // CCX v2 has the same IE, we need to parse that too - // Wifi WMM use the same IE vale, need to parse that too - // case IE_WPA: - case IE_VENDOR_SPECIFIC: - // Check Broadcom/Atheros 802.11n OUI version, for HT Capability IE. - // This HT IE is before IEEE draft set HT IE value.2006-09-28 by Jan. - /*if (NdisEqualMemory(pEid->Octet, BROADCOM_OUI, 3) && (pEid->Len >= 4)) - { - if ((pEid->Octet[3] == OUI_BROADCOM_HT) && (pEid->Len >= 30)) - { - { - NdisMoveMemory(pHtCapability, &pEid->Octet[4], sizeof(HT_CAPABILITY_IE)); - *pHtCapabilityLen = SIZE_HT_CAP_IE; // Nnow we only support 26 bytes. } + + Sanity |= 0x4; + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("PeerBeaconAndProbeRspSanity - wrong IE_DS_PARM (len=%d)\n", + pEid->Len)); + return FALSE; } - if ((pEid->Octet[3] == OUI_BROADCOM_HT) && (pEid->Len >= 26)) - { - { - NdisMoveMemory(AddHtInfo, &pEid->Octet[4], sizeof(ADD_HT_INFO_IE)); - *AddHtInfoLen = SIZE_ADD_HT_INFO_IE; // Nnow we only support 26 bytes. + break; + + case IE_CF_PARM: + if (pEid->Len == 6) { + pCfParm->bValid = TRUE; + pCfParm->CfpCount = pEid->Octet[0]; + pCfParm->CfpPeriod = pEid->Octet[1]; + pCfParm->CfpMaxDuration = + pEid->Octet[2] + 256 * pEid->Octet[3]; + pCfParm->CfpDurRemaining = + pEid->Octet[4] + 256 * pEid->Octet[5]; + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("PeerBeaconAndProbeRspSanity - wrong IE_CF_PARM\n")); + return FALSE; + } + break; + + case IE_IBSS_PARM: + if (pEid->Len == 2) { + NdisMoveMemory(pAtimWin, pEid->Octet, + pEid->Len); + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("PeerBeaconAndProbeRspSanity - wrong IE_IBSS_PARM\n")); + return FALSE; + } + break; + + case IE_TIM: + if (INFRA_ON(pAd) && SubType == SUBTYPE_BEACON) { + GetTimBit((PCHAR) pEid, pAd->StaActive.Aid, + &TimLen, pBcastFlag, pDtimCount, + pDtimPeriod, pMessageToMe); + } + break; + case IE_CHANNEL_SWITCH_ANNOUNCEMENT: + if (pEid->Len == 3) { + *pNewChannel = pEid->Octet[1]; //extract new channel number + } + break; + + // New for WPA + // CCX v2 has the same IE, we need to parse that too + // Wifi WMM use the same IE vale, need to parse that too + // case IE_WPA: + case IE_VENDOR_SPECIFIC: + // Check Broadcom/Atheros 802.11n OUI version, for HT Capability IE. + // This HT IE is before IEEE draft set HT IE value.2006-09-28 by Jan. + /*if (NdisEqualMemory(pEid->Octet, BROADCOM_OUI, 3) && (pEid->Len >= 4)) + { + if ((pEid->Octet[3] == OUI_BROADCOM_HT) && (pEid->Len >= 30)) + { + { + NdisMoveMemory(pHtCapability, &pEid->Octet[4], sizeof(HT_CAPABILITY_IE)); + *pHtCapabilityLen = SIZE_HT_CAP_IE; // Nnow we only support 26 bytes. + } + } + if ((pEid->Octet[3] == OUI_BROADCOM_HT) && (pEid->Len >= 26)) + { + { + NdisMoveMemory(AddHtInfo, &pEid->Octet[4], sizeof(ADD_HT_INFO_IE)); + *AddHtInfoLen = SIZE_ADD_HT_INFO_IE; // Nnow we only support 26 bytes. + } + } + } + */ + // Check the OUI version, filter out non-standard usage + if (NdisEqualMemory(pEid->Octet, RALINK_OUI, 3) + && (pEid->Len == 7)) { + //*pRalinkIe = pEid->Octet[3]; + if (pEid->Octet[3] != 0) + *pRalinkIe = pEid->Octet[3]; + else + *pRalinkIe = 0xf0000000; // Set to non-zero value (can't set bit0-2) to represent this is Ralink Chip. So at linkup, we will set ralinkchip flag. + } + // This HT IE is before IEEE draft set HT IE value.2006-09-28 by Jan. + + // Other vendors had production before IE_HT_CAP value is assigned. To backward support those old-firmware AP, + // Check broadcom-defiend pre-802.11nD1.0 OUI for HT related IE, including HT Capatilities IE and HT Information IE + else if ((*pHtCapabilityLen == 0) + && NdisEqualMemory(pEid->Octet, PRE_N_HT_OUI, + 3) && (pEid->Len >= 4) + && (pAd->OpMode == OPMODE_STA)) { + if ((pEid->Octet[3] == OUI_PREN_HT_CAP) + && (pEid->Len >= 30) + && (*pHtCapabilityLen == 0)) { + NdisMoveMemory(pHtCapability, + &pEid->Octet[4], + sizeof + (HT_CAPABILITY_IE)); + *pPreNHtCapabilityLen = SIZE_HT_CAP_IE; + } + + if ((pEid->Octet[3] == OUI_PREN_ADD_HT) + && (pEid->Len >= 26)) { + NdisMoveMemory(AddHtInfo, + &pEid->Octet[4], + sizeof(ADD_HT_INFO_IE)); + *AddHtInfoLen = SIZE_ADD_HT_INFO_IE; + } + } else if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4)) { + // Copy to pVIE which will report to microsoft bssid list. + Ptr = (PUCHAR) pVIE; + NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid, + pEid->Len + 2); + *LengthVIE += (pEid->Len + 2); + } else + if (NdisEqualMemory(pEid->Octet, WME_PARM_ELEM, 6) + && (pEid->Len == 24)) { + PUCHAR ptr; + int i; + + // parsing EDCA parameters + pEdcaParm->bValid = TRUE; + pEdcaParm->bQAck = FALSE; // pEid->Octet[0] & 0x10; + pEdcaParm->bQueueRequest = FALSE; // pEid->Octet[0] & 0x20; + pEdcaParm->bTxopRequest = FALSE; // pEid->Octet[0] & 0x40; + pEdcaParm->EdcaUpdateCount = + pEid->Octet[6] & 0x0f; + pEdcaParm->bAPSDCapable = + (pEid->Octet[6] & 0x80) ? 1 : 0; + ptr = &pEid->Octet[8]; + for (i = 0; i < 4; i++) { + UCHAR aci = (*ptr & 0x60) >> 5; // b5~6 is AC INDEX + pEdcaParm->bACM[aci] = (((*ptr) & 0x10) == 0x10); // b5 is ACM + pEdcaParm->Aifsn[aci] = (*ptr) & 0x0f; // b0~3 is AIFSN + pEdcaParm->Cwmin[aci] = *(ptr + 1) & 0x0f; // b0~4 is Cwmin + pEdcaParm->Cwmax[aci] = *(ptr + 1) >> 4; // b5~8 is Cwmax + pEdcaParm->Txop[aci] = *(ptr + 2) + 256 * (*(ptr + 3)); // in unit of 32-us + ptr += 4; // point to next AC } + } else + if (NdisEqualMemory(pEid->Octet, WME_INFO_ELEM, 6) + && (pEid->Len == 7)) { + // parsing EDCA parameters + pEdcaParm->bValid = TRUE; + pEdcaParm->bQAck = FALSE; // pEid->Octet[0] & 0x10; + pEdcaParm->bQueueRequest = FALSE; // pEid->Octet[0] & 0x20; + pEdcaParm->bTxopRequest = FALSE; // pEid->Octet[0] & 0x40; + pEdcaParm->EdcaUpdateCount = + pEid->Octet[6] & 0x0f; + pEdcaParm->bAPSDCapable = + (pEid->Octet[6] & 0x80) ? 1 : 0; + + // use default EDCA parameter + pEdcaParm->bACM[QID_AC_BE] = 0; + pEdcaParm->Aifsn[QID_AC_BE] = 3; + pEdcaParm->Cwmin[QID_AC_BE] = CW_MIN_IN_BITS; + pEdcaParm->Cwmax[QID_AC_BE] = CW_MAX_IN_BITS; + pEdcaParm->Txop[QID_AC_BE] = 0; + + pEdcaParm->bACM[QID_AC_BK] = 0; + pEdcaParm->Aifsn[QID_AC_BK] = 7; + pEdcaParm->Cwmin[QID_AC_BK] = CW_MIN_IN_BITS; + pEdcaParm->Cwmax[QID_AC_BK] = CW_MAX_IN_BITS; + pEdcaParm->Txop[QID_AC_BK] = 0; + + pEdcaParm->bACM[QID_AC_VI] = 0; + pEdcaParm->Aifsn[QID_AC_VI] = 2; + pEdcaParm->Cwmin[QID_AC_VI] = + CW_MIN_IN_BITS - 1; + pEdcaParm->Cwmax[QID_AC_VI] = CW_MAX_IN_BITS; + pEdcaParm->Txop[QID_AC_VI] = 96; // AC_VI: 96*32us ~= 3ms + + pEdcaParm->bACM[QID_AC_VO] = 0; + pEdcaParm->Aifsn[QID_AC_VO] = 2; + pEdcaParm->Cwmin[QID_AC_VO] = + CW_MIN_IN_BITS - 2; + pEdcaParm->Cwmax[QID_AC_VO] = + CW_MAX_IN_BITS - 1; + pEdcaParm->Txop[QID_AC_VO] = 48; // AC_VO: 48*32us ~= 1.5ms + } + + break; + + case IE_EXT_SUPP_RATES: + if (pEid->Len <= MAX_LEN_OF_SUPPORTED_RATES) { + NdisMoveMemory(ExtRate, pEid->Octet, pEid->Len); + *pExtRateLen = pEid->Len; + + // TODO: 2004-09-14 not a good design here, cause it exclude extra rates + // from ScanTab. We should report as is. And filter out unsupported + // rates in MlmeAux. + // Check against the supported rates + // RTMPCheckRates(pAd, ExtRate, pExtRateLen); } - } - */ - // Check the OUI version, filter out non-standard usage - if (NdisEqualMemory(pEid->Octet, RALINK_OUI, 3) && (pEid->Len == 7)) - { - //*pRalinkIe = pEid->Octet[3]; - if (pEid->Octet[3] != 0) - *pRalinkIe = pEid->Octet[3]; - else - *pRalinkIe = 0xf0000000; // Set to non-zero value (can't set bit0-2) to represent this is Ralink Chip. So at linkup, we will set ralinkchip flag. - } - // This HT IE is before IEEE draft set HT IE value.2006-09-28 by Jan. - - // Other vendors had production before IE_HT_CAP value is assigned. To backward support those old-firmware AP, - // Check broadcom-defiend pre-802.11nD1.0 OUI for HT related IE, including HT Capatilities IE and HT Information IE - else if ((*pHtCapabilityLen == 0) && NdisEqualMemory(pEid->Octet, PRE_N_HT_OUI, 3) && (pEid->Len >= 4) && (pAd->OpMode == OPMODE_STA)) - { - if ((pEid->Octet[3] == OUI_PREN_HT_CAP) && (pEid->Len >= 30) && (*pHtCapabilityLen == 0)) - { - NdisMoveMemory(pHtCapability, &pEid->Octet[4], sizeof(HT_CAPABILITY_IE)); - *pPreNHtCapabilityLen = SIZE_HT_CAP_IE; - } - - if ((pEid->Octet[3] == OUI_PREN_ADD_HT) && (pEid->Len >= 26)) - { - NdisMoveMemory(AddHtInfo, &pEid->Octet[4], sizeof(ADD_HT_INFO_IE)); - *AddHtInfoLen = SIZE_ADD_HT_INFO_IE; - } - } - else if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4)) - { - // Copy to pVIE which will report to microsoft bssid list. - Ptr = (PUCHAR) pVIE; - NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid, pEid->Len + 2); - *LengthVIE += (pEid->Len + 2); - } - else if (NdisEqualMemory(pEid->Octet, WME_PARM_ELEM, 6) && (pEid->Len == 24)) - { - PUCHAR ptr; - int i; - - // parsing EDCA parameters - pEdcaParm->bValid = TRUE; - pEdcaParm->bQAck = FALSE; // pEid->Octet[0] & 0x10; - pEdcaParm->bQueueRequest = FALSE; // pEid->Octet[0] & 0x20; - pEdcaParm->bTxopRequest = FALSE; // pEid->Octet[0] & 0x40; - pEdcaParm->EdcaUpdateCount = pEid->Octet[6] & 0x0f; - pEdcaParm->bAPSDCapable = (pEid->Octet[6] & 0x80) ? 1 : 0; - ptr = &pEid->Octet[8]; - for (i=0; i<4; i++) - { - UCHAR aci = (*ptr & 0x60) >> 5; // b5~6 is AC INDEX - pEdcaParm->bACM[aci] = (((*ptr) & 0x10) == 0x10); // b5 is ACM - pEdcaParm->Aifsn[aci] = (*ptr) & 0x0f; // b0~3 is AIFSN - pEdcaParm->Cwmin[aci] = *(ptr+1) & 0x0f; // b0~4 is Cwmin - pEdcaParm->Cwmax[aci] = *(ptr+1) >> 4; // b5~8 is Cwmax - pEdcaParm->Txop[aci] = *(ptr+2) + 256 * (*(ptr+3)); // in unit of 32-us - ptr += 4; // point to next AC - } - } - else if (NdisEqualMemory(pEid->Octet, WME_INFO_ELEM, 6) && (pEid->Len == 7)) - { - // parsing EDCA parameters - pEdcaParm->bValid = TRUE; - pEdcaParm->bQAck = FALSE; // pEid->Octet[0] & 0x10; - pEdcaParm->bQueueRequest = FALSE; // pEid->Octet[0] & 0x20; - pEdcaParm->bTxopRequest = FALSE; // pEid->Octet[0] & 0x40; - pEdcaParm->EdcaUpdateCount = pEid->Octet[6] & 0x0f; - pEdcaParm->bAPSDCapable = (pEid->Octet[6] & 0x80) ? 1 : 0; - - // use default EDCA parameter - pEdcaParm->bACM[QID_AC_BE] = 0; - pEdcaParm->Aifsn[QID_AC_BE] = 3; - pEdcaParm->Cwmin[QID_AC_BE] = CW_MIN_IN_BITS; - pEdcaParm->Cwmax[QID_AC_BE] = CW_MAX_IN_BITS; - pEdcaParm->Txop[QID_AC_BE] = 0; - - pEdcaParm->bACM[QID_AC_BK] = 0; - pEdcaParm->Aifsn[QID_AC_BK] = 7; - pEdcaParm->Cwmin[QID_AC_BK] = CW_MIN_IN_BITS; - pEdcaParm->Cwmax[QID_AC_BK] = CW_MAX_IN_BITS; - pEdcaParm->Txop[QID_AC_BK] = 0; - - pEdcaParm->bACM[QID_AC_VI] = 0; - pEdcaParm->Aifsn[QID_AC_VI] = 2; - pEdcaParm->Cwmin[QID_AC_VI] = CW_MIN_IN_BITS-1; - pEdcaParm->Cwmax[QID_AC_VI] = CW_MAX_IN_BITS; - pEdcaParm->Txop[QID_AC_VI] = 96; // AC_VI: 96*32us ~= 3ms - - pEdcaParm->bACM[QID_AC_VO] = 0; - pEdcaParm->Aifsn[QID_AC_VO] = 2; - pEdcaParm->Cwmin[QID_AC_VO] = CW_MIN_IN_BITS-2; - pEdcaParm->Cwmax[QID_AC_VO] = CW_MAX_IN_BITS-1; - pEdcaParm->Txop[QID_AC_VO] = 48; // AC_VO: 48*32us ~= 1.5ms - } - - - break; - - case IE_EXT_SUPP_RATES: - if (pEid->Len <= MAX_LEN_OF_SUPPORTED_RATES) - { - NdisMoveMemory(ExtRate, pEid->Octet, pEid->Len); - *pExtRateLen = pEid->Len; - - // TODO: 2004-09-14 not a good design here, cause it exclude extra rates - // from ScanTab. We should report as is. And filter out unsupported - // rates in MlmeAux. - // Check against the supported rates - // RTMPCheckRates(pAd, ExtRate, pExtRateLen); - } - break; - - case IE_ERP: - if (pEid->Len == 1) - { - *pErp = (UCHAR)pEid->Octet[0]; - } - break; - - case IE_AIRONET_CKIP: - // 0. Check Aironet IE length, it must be larger or equal to 28 - // Cisco AP350 used length as 28 - // Cisco AP12XX used length as 30 - if (pEid->Len < (CKIP_NEGOTIATION_LENGTH - 2)) - break; - - // 1. Copy CKIP flag byte to buffer for process - *pCkipFlag = *(pEid->Octet + 8); - break; - - case IE_AP_TX_POWER: - // AP Control of Client Transmit Power - //0. Check Aironet IE length, it must be 6 - if (pEid->Len != 0x06) - break; - - // Get cell power limit in dBm - if (NdisEqualMemory(pEid->Octet, CISCO_OUI, 3) == 1) - *pAironetCellPowerLimit = *(pEid->Octet + 4); - break; - - // WPA2 & 802.11i RSN - case IE_RSN: - // There is no OUI for version anymore, check the group cipher OUI before copying - if (RTMPEqualMemory(pEid->Octet + 2, RSN_OUI, 3)) - { - // Copy to pVIE which will report to microsoft bssid list. - Ptr = (PUCHAR) pVIE; - NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid, pEid->Len + 2); - *LengthVIE += (pEid->Len + 2); - } - break; - - default: - break; - } - - Length = Length + 2 + pEid->Len; // Eid[1] + Len[1]+ content[Len] - pEid = (PEID_STRUCT)((UCHAR*)pEid + 2 + pEid->Len); - } - - // For some 11a AP. it did not have the channel EID, patch here + break; + + case IE_ERP: + if (pEid->Len == 1) { + *pErp = (UCHAR) pEid->Octet[0]; + } + break; + + case IE_AIRONET_CKIP: + // 0. Check Aironet IE length, it must be larger or equal to 28 + // Cisco AP350 used length as 28 + // Cisco AP12XX used length as 30 + if (pEid->Len < (CKIP_NEGOTIATION_LENGTH - 2)) + break; + + // 1. Copy CKIP flag byte to buffer for process + *pCkipFlag = *(pEid->Octet + 8); + break; + + case IE_AP_TX_POWER: + // AP Control of Client Transmit Power + //0. Check Aironet IE length, it must be 6 + if (pEid->Len != 0x06) + break; + + // Get cell power limit in dBm + if (NdisEqualMemory(pEid->Octet, CISCO_OUI, 3) == 1) + *pAironetCellPowerLimit = *(pEid->Octet + 4); + break; + + // WPA2 & 802.11i RSN + case IE_RSN: + // There is no OUI for version anymore, check the group cipher OUI before copying + if (RTMPEqualMemory(pEid->Octet + 2, RSN_OUI, 3)) { + // Copy to pVIE which will report to microsoft bssid list. + Ptr = (PUCHAR) pVIE; + NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid, + pEid->Len + 2); + *LengthVIE += (pEid->Len + 2); + } + break; + + default: + break; + } + + Length = Length + 2 + pEid->Len; // Eid[1] + Len[1]+ content[Len] + pEid = (PEID_STRUCT) ((UCHAR *) pEid + 2 + pEid->Len); + } + + // For some 11a AP. it did not have the channel EID, patch here { UCHAR LatchRfChannel = MsgChannel; - if ((pAd->LatchRfRegs.Channel > 14) && ((Sanity & 0x4) == 0)) - { + if ((pAd->LatchRfRegs.Channel > 14) && ((Sanity & 0x4) == 0)) { if (CtrlChannel != 0) *pChannel = CtrlChannel; else @@ -737,13 +711,12 @@ BOOLEAN PeerBeaconAndProbeRspSanity( } } - if (Sanity != 0x7) - { - DBGPRINT(RT_DEBUG_LOUD, ("PeerBeaconAndProbeRspSanity - missing field, Sanity=0x%02x\n", Sanity)); + if (Sanity != 0x7) { + DBGPRINT(RT_DEBUG_LOUD, + ("PeerBeaconAndProbeRspSanity - missing field, Sanity=0x%02x\n", + Sanity)); return FALSE; - } - else - { + } else { return TRUE; } @@ -757,49 +730,42 @@ BOOLEAN PeerBeaconAndProbeRspSanity( TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -BOOLEAN MlmeScanReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT UCHAR *pBssType, - OUT CHAR Ssid[], - OUT UCHAR *pSsidLen, - OUT UCHAR *pScanType) +BOOLEAN MlmeScanReqSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, + IN ULONG MsgLen, + OUT UCHAR * pBssType, + OUT CHAR Ssid[], + OUT UCHAR * pSsidLen, OUT UCHAR * pScanType) { MLME_SCAN_REQ_STRUCT *Info; - Info = (MLME_SCAN_REQ_STRUCT *)(Msg); + Info = (MLME_SCAN_REQ_STRUCT *) (Msg); *pBssType = Info->BssType; *pSsidLen = Info->SsidLen; NdisMoveMemory(Ssid, Info->Ssid, *pSsidLen); *pScanType = Info->ScanType; - if ((*pBssType == BSS_INFRA || *pBssType == BSS_ADHOC || *pBssType == BSS_ANY) - && (*pScanType == SCAN_ACTIVE || *pScanType == SCAN_PASSIVE - )) - { + if ((*pBssType == BSS_INFRA || *pBssType == BSS_ADHOC + || *pBssType == BSS_ANY) + && (*pScanType == SCAN_ACTIVE || *pScanType == SCAN_PASSIVE)) { return TRUE; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("MlmeScanReqSanity fail - wrong BssType or ScanType\n")); + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("MlmeScanReqSanity fail - wrong BssType or ScanType\n")); return FALSE; } } // IRQL = DISPATCH_LEVEL -UCHAR ChannelSanity( - IN PRTMP_ADAPTER pAd, - IN UCHAR channel) +UCHAR ChannelSanity(IN PRTMP_ADAPTER pAd, IN UCHAR channel) { - int i; - - for (i = 0; i < pAd->ChannelListNum; i ++) - { - if (channel == pAd->ChannelList[i].Channel) - return 1; - } - return 0; + int i; + + for (i = 0; i < pAd->ChannelListNum; i++) { + if (channel == pAd->ChannelList[i].Channel) + return 1; + } + return 0; } /* @@ -813,19 +779,17 @@ UCHAR ChannelSanity( ========================================================================== */ -BOOLEAN PeerDeauthSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *pReason) +BOOLEAN PeerDeauthSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, + IN ULONG MsgLen, + OUT PUCHAR pAddr2, OUT USHORT * pReason) { - PFRAME_802_11 pFrame = (PFRAME_802_11)Msg; + PFRAME_802_11 pFrame = (PFRAME_802_11) Msg; - COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); - NdisMoveMemory(pReason, &pFrame->Octet[0], 2); + COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); + NdisMoveMemory(pReason, &pFrame->Octet[0], 2); - return TRUE; + return TRUE; } /* @@ -839,57 +803,46 @@ BOOLEAN PeerDeauthSanity( ========================================================================== */ -BOOLEAN PeerAuthSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr, - OUT USHORT *pAlg, - OUT USHORT *pSeq, - OUT USHORT *pStatus, - CHAR *pChlgText) +BOOLEAN PeerAuthSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, + IN ULONG MsgLen, + OUT PUCHAR pAddr, + OUT USHORT * pAlg, + OUT USHORT * pSeq, + OUT USHORT * pStatus, CHAR * pChlgText) { - PFRAME_802_11 pFrame = (PFRAME_802_11)Msg; - - COPY_MAC_ADDR(pAddr, pFrame->Hdr.Addr2); - NdisMoveMemory(pAlg, &pFrame->Octet[0], 2); - NdisMoveMemory(pSeq, &pFrame->Octet[2], 2); - NdisMoveMemory(pStatus, &pFrame->Octet[4], 2); - - if (*pAlg == AUTH_MODE_OPEN) - { - if (*pSeq == 1 || *pSeq == 2) - { - return TRUE; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerAuthSanity fail - wrong Seg#\n")); - return FALSE; - } - } - else if (*pAlg == AUTH_MODE_KEY) - { - if (*pSeq == 1 || *pSeq == 4) - { - return TRUE; - } - else if (*pSeq == 2 || *pSeq == 3) - { - NdisMoveMemory(pChlgText, &pFrame->Octet[8], CIPHER_TEXT_LEN); - return TRUE; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerAuthSanity fail - wrong Seg#\n")); - return FALSE; - } - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerAuthSanity fail - wrong algorithm\n")); - return FALSE; - } + PFRAME_802_11 pFrame = (PFRAME_802_11) Msg; + + COPY_MAC_ADDR(pAddr, pFrame->Hdr.Addr2); + NdisMoveMemory(pAlg, &pFrame->Octet[0], 2); + NdisMoveMemory(pSeq, &pFrame->Octet[2], 2); + NdisMoveMemory(pStatus, &pFrame->Octet[4], 2); + + if (*pAlg == AUTH_MODE_OPEN) { + if (*pSeq == 1 || *pSeq == 2) { + return TRUE; + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("PeerAuthSanity fail - wrong Seg#\n")); + return FALSE; + } + } else if (*pAlg == AUTH_MODE_KEY) { + if (*pSeq == 1 || *pSeq == 4) { + return TRUE; + } else if (*pSeq == 2 || *pSeq == 3) { + NdisMoveMemory(pChlgText, &pFrame->Octet[8], + CIPHER_TEXT_LEN); + return TRUE; + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("PeerAuthSanity fail - wrong Seg#\n")); + return FALSE; + } + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("PeerAuthSanity fail - wrong algorithm\n")); + return FALSE; + } } /* @@ -900,32 +853,27 @@ BOOLEAN PeerAuthSanity( TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -BOOLEAN MlmeAuthReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr, - OUT ULONG *pTimeout, - OUT USHORT *pAlg) +BOOLEAN MlmeAuthReqSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, + IN ULONG MsgLen, + OUT PUCHAR pAddr, + OUT ULONG * pTimeout, OUT USHORT * pAlg) { - MLME_AUTH_REQ_STRUCT *pInfo; - - pInfo = (MLME_AUTH_REQ_STRUCT *)Msg; - COPY_MAC_ADDR(pAddr, pInfo->Addr); - *pTimeout = pInfo->Timeout; - *pAlg = pInfo->Alg; - - if (((*pAlg == AUTH_MODE_KEY) ||(*pAlg == AUTH_MODE_OPEN) - ) && - ((*pAddr & 0x01) == 0)) - { - return TRUE; - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("MlmeAuthReqSanity fail - wrong algorithm\n")); - return FALSE; - } + MLME_AUTH_REQ_STRUCT *pInfo; + + pInfo = (MLME_AUTH_REQ_STRUCT *) Msg; + COPY_MAC_ADDR(pAddr, pInfo->Addr); + *pTimeout = pInfo->Timeout; + *pAlg = pInfo->Alg; + + if (((*pAlg == AUTH_MODE_KEY) || (*pAlg == AUTH_MODE_OPEN) + ) && ((*pAddr & 0x01) == 0)) { + return TRUE; + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("MlmeAuthReqSanity fail - wrong algorithm\n")); + return FALSE; + } } /* @@ -939,24 +887,22 @@ BOOLEAN MlmeAuthReqSanity( ========================================================================== */ -BOOLEAN MlmeAssocReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pApAddr, - OUT USHORT *pCapabilityInfo, - OUT ULONG *pTimeout, - OUT USHORT *pListenIntv) +BOOLEAN MlmeAssocReqSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, + IN ULONG MsgLen, + OUT PUCHAR pApAddr, + OUT USHORT * pCapabilityInfo, + OUT ULONG * pTimeout, OUT USHORT * pListenIntv) { - MLME_ASSOC_REQ_STRUCT *pInfo; + MLME_ASSOC_REQ_STRUCT *pInfo; - pInfo = (MLME_ASSOC_REQ_STRUCT *)Msg; - *pTimeout = pInfo->Timeout; // timeout - COPY_MAC_ADDR(pApAddr, pInfo->Addr); // AP address - *pCapabilityInfo = pInfo->CapabilityInfo; // capability info - *pListenIntv = pInfo->ListenIntv; + pInfo = (MLME_ASSOC_REQ_STRUCT *) Msg; + *pTimeout = pInfo->Timeout; // timeout + COPY_MAC_ADDR(pApAddr, pInfo->Addr); // AP address + *pCapabilityInfo = pInfo->CapabilityInfo; // capability info + *pListenIntv = pInfo->ListenIntv; - return TRUE; + return TRUE; } /* @@ -970,19 +916,17 @@ BOOLEAN MlmeAssocReqSanity( ========================================================================== */ -BOOLEAN PeerDisassocSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *pReason) +BOOLEAN PeerDisassocSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, + IN ULONG MsgLen, + OUT PUCHAR pAddr2, OUT USHORT * pReason) { - PFRAME_802_11 pFrame = (PFRAME_802_11)Msg; + PFRAME_802_11 pFrame = (PFRAME_802_11) Msg; - COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); - NdisMoveMemory(pReason, &pFrame->Octet[0], 2); + COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); + NdisMoveMemory(pReason, &pFrame->Octet[0], 2); - return TRUE; + return TRUE; } /* @@ -1002,28 +946,23 @@ BOOLEAN PeerDisassocSanity( ======================================================================== */ -NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity( - IN PBSS_ENTRY pBss) +NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity(IN PBSS_ENTRY pBss) { - NDIS_802_11_NETWORK_TYPE NetWorkType; - UCHAR rate, i; + NDIS_802_11_NETWORK_TYPE NetWorkType; + UCHAR rate, i; NetWorkType = Ndis802_11DS; - if (pBss->Channel <= 14) - { + if (pBss->Channel <= 14) { // // First check support Rate. // - for (i = 0; i < pBss->SupRateLen; i++) - { - rate = pBss->SupRate[i] & 0x7f; // Mask out basic rate set bit - if ((rate == 2) || (rate == 4) || (rate == 11) || (rate == 22)) - { + for (i = 0; i < pBss->SupRateLen; i++) { + rate = pBss->SupRate[i] & 0x7f; // Mask out basic rate set bit + if ((rate == 2) || (rate == 4) || (rate == 11) + || (rate == 22)) { continue; - } - else - { + } else { // // Otherwise (even rate > 108) means Ndis802_11OFDM24 // @@ -1035,17 +974,13 @@ NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity( // // Second check Extend Rate. // - if (NetWorkType != Ndis802_11OFDM24) - { - for (i = 0; i < pBss->ExtRateLen; i++) - { - rate = pBss->SupRate[i] & 0x7f; // Mask out basic rate set bit - if ((rate == 2) || (rate == 4) || (rate == 11) || (rate == 22)) - { + if (NetWorkType != Ndis802_11OFDM24) { + for (i = 0; i < pBss->ExtRateLen; i++) { + rate = pBss->SupRate[i] & 0x7f; // Mask out basic rate set bit + if ((rate == 2) || (rate == 4) || (rate == 11) + || (rate == 22)) { continue; - } - else - { + } else { // // Otherwise (even rate > 108) means Ndis802_11OFDM24 // @@ -1054,19 +989,16 @@ NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity( } } } - } - else - { + } else { NetWorkType = Ndis802_11OFDM5; } - if (pBss->HtCapabilityLen != 0) - { - if (NetWorkType == Ndis802_11OFDM5) - NetWorkType = Ndis802_11OFDM5_N; - else - NetWorkType = Ndis802_11OFDM24_N; - } + if (pBss->HtCapabilityLen != 0) { + if (NetWorkType == Ndis802_11OFDM5) + NetWorkType = Ndis802_11OFDM5_N; + else + NetWorkType = Ndis802_11OFDM24_N; + } return NetWorkType; } @@ -1080,170 +1012,177 @@ NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity( FALSE otherwise ========================================================================== */ -BOOLEAN PeerWpaMessageSanity( - IN PRTMP_ADAPTER pAd, - IN PEAPOL_PACKET pMsg, - IN ULONG MsgLen, - IN UCHAR MsgType, - IN MAC_TABLE_ENTRY *pEntry) +BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, + IN PEAPOL_PACKET pMsg, + IN ULONG MsgLen, + IN UCHAR MsgType, IN MAC_TABLE_ENTRY * pEntry) { - UCHAR mic[LEN_KEY_DESC_MIC], digest[80], KEYDATA[MAX_LEN_OF_RSNIE]; - BOOLEAN bReplayDiff = FALSE; - BOOLEAN bWPA2 = FALSE; - KEY_INFO EapolKeyInfo; - UCHAR GroupKeyIndex = 0; - + UCHAR mic[LEN_KEY_DESC_MIC], digest[80], KEYDATA[MAX_LEN_OF_RSNIE]; + BOOLEAN bReplayDiff = FALSE; + BOOLEAN bWPA2 = FALSE; + KEY_INFO EapolKeyInfo; + UCHAR GroupKeyIndex = 0; NdisZeroMemory(mic, sizeof(mic)); NdisZeroMemory(digest, sizeof(digest)); NdisZeroMemory(KEYDATA, sizeof(KEYDATA)); - NdisZeroMemory((PUCHAR)&EapolKeyInfo, sizeof(EapolKeyInfo)); + NdisZeroMemory((PUCHAR) & EapolKeyInfo, sizeof(EapolKeyInfo)); - NdisMoveMemory((PUCHAR)&EapolKeyInfo, (PUCHAR)&pMsg->KeyDesc.KeyInfo, sizeof(KEY_INFO)); + NdisMoveMemory((PUCHAR) & EapolKeyInfo, + (PUCHAR) & pMsg->KeyDesc.KeyInfo, sizeof(KEY_INFO)); - *((USHORT *)&EapolKeyInfo) = cpu2le16(*((USHORT *)&EapolKeyInfo)); + *((USHORT *) & EapolKeyInfo) = cpu2le16(*((USHORT *) & EapolKeyInfo)); // Choose WPA2 or not - if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) || (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) + if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) + || (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) bWPA2 = TRUE; // 0. Check MsgType - if ((MsgType > EAPOL_GROUP_MSG_2) || (MsgType < EAPOL_PAIR_MSG_1)) - { - DBGPRINT(RT_DEBUG_ERROR, ("The message type is invalid(%d)! \n", MsgType)); + if ((MsgType > EAPOL_GROUP_MSG_2) || (MsgType < EAPOL_PAIR_MSG_1)) { + DBGPRINT(RT_DEBUG_ERROR, + ("The message type is invalid(%d)! \n", MsgType)); return FALSE; } - // 1. Replay counter check if (MsgType == EAPOL_PAIR_MSG_1 || MsgType == EAPOL_PAIR_MSG_3 || MsgType == EAPOL_GROUP_MSG_1) // For supplicant - { - // First validate replay counter, only accept message with larger replay counter. - // Let equal pass, some AP start with all zero replay counter - UCHAR ZeroReplay[LEN_KEY_DESC_REPLAY]; - - NdisZeroMemory(ZeroReplay, LEN_KEY_DESC_REPLAY); - if ((RTMPCompareMemory(pMsg->KeyDesc.ReplayCounter, pEntry->R_Counter, LEN_KEY_DESC_REPLAY) != 1) && - (RTMPCompareMemory(pMsg->KeyDesc.ReplayCounter, ZeroReplay, LEN_KEY_DESC_REPLAY) != 0)) { + // First validate replay counter, only accept message with larger replay counter. + // Let equal pass, some AP start with all zero replay counter + UCHAR ZeroReplay[LEN_KEY_DESC_REPLAY]; + + NdisZeroMemory(ZeroReplay, LEN_KEY_DESC_REPLAY); + if ((RTMPCompareMemory + (pMsg->KeyDesc.ReplayCounter, pEntry->R_Counter, + LEN_KEY_DESC_REPLAY) != 1) + && + (RTMPCompareMemory + (pMsg->KeyDesc.ReplayCounter, ZeroReplay, + LEN_KEY_DESC_REPLAY) != 0)) { bReplayDiff = TRUE; - } - } - else if (MsgType == EAPOL_PAIR_MSG_2 || MsgType == EAPOL_PAIR_MSG_4 || MsgType == EAPOL_GROUP_MSG_2) // For authenticator + } + } else if (MsgType == EAPOL_PAIR_MSG_2 || MsgType == EAPOL_PAIR_MSG_4 || MsgType == EAPOL_GROUP_MSG_2) // For authenticator { // check Replay Counter coresponds to MSG from authenticator, otherwise discard - if (!NdisEqualMemory(pMsg->KeyDesc.ReplayCounter, pEntry->R_Counter, LEN_KEY_DESC_REPLAY)) - { + if (!NdisEqualMemory + (pMsg->KeyDesc.ReplayCounter, pEntry->R_Counter, + LEN_KEY_DESC_REPLAY)) { bReplayDiff = TRUE; + } } - } - // Replay Counter different condition - if (bReplayDiff) - { + if (bReplayDiff) { // send wireless event - for replay counter different if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_REPLAY_COUNTER_DIFF_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); - - if (MsgType < EAPOL_GROUP_MSG_1) - { - DBGPRINT(RT_DEBUG_ERROR, ("Replay Counter Different in pairwise msg %d of 4-way handshake!\n", MsgType)); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("Replay Counter Different in group msg %d of 2-way handshake!\n", (MsgType - EAPOL_PAIR_MSG_4))); + RTMPSendWirelessEvent(pAd, + IW_REPLAY_COUNTER_DIFF_EVENT_FLAG, + pEntry->Addr, pEntry->apidx, 0); + + if (MsgType < EAPOL_GROUP_MSG_1) { + DBGPRINT(RT_DEBUG_ERROR, + ("Replay Counter Different in pairwise msg %d of 4-way handshake!\n", + MsgType)); + } else { + DBGPRINT(RT_DEBUG_ERROR, + ("Replay Counter Different in group msg %d of 2-way handshake!\n", + (MsgType - EAPOL_PAIR_MSG_4))); } - hex_dump("Receive replay counter ", pMsg->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - hex_dump("Current replay counter ", pEntry->R_Counter, LEN_KEY_DESC_REPLAY); - return FALSE; + hex_dump("Receive replay counter ", pMsg->KeyDesc.ReplayCounter, + LEN_KEY_DESC_REPLAY); + hex_dump("Current replay counter ", pEntry->R_Counter, + LEN_KEY_DESC_REPLAY); + return FALSE; } - // 2. Verify MIC except Pairwise Msg1 - if (MsgType != EAPOL_PAIR_MSG_1) - { - UCHAR rcvd_mic[LEN_KEY_DESC_MIC]; + if (MsgType != EAPOL_PAIR_MSG_1) { + UCHAR rcvd_mic[LEN_KEY_DESC_MIC]; // Record the received MIC for check later - NdisMoveMemory(rcvd_mic, pMsg->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); + NdisMoveMemory(rcvd_mic, pMsg->KeyDesc.KeyMic, + LEN_KEY_DESC_MIC); NdisZeroMemory(pMsg->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); - if (EapolKeyInfo.KeyDescVer == DESC_TYPE_TKIP) // TKIP - { - HMAC_MD5(pEntry->PTK, LEN_EAP_MICK, (PUCHAR)pMsg, MsgLen, mic, MD5_DIGEST_SIZE); - } - else if (EapolKeyInfo.KeyDescVer == DESC_TYPE_AES) // AES - { - HMAC_SHA1(pEntry->PTK, LEN_EAP_MICK, (PUCHAR)pMsg, MsgLen, digest, SHA1_DIGEST_SIZE); - NdisMoveMemory(mic, digest, LEN_KEY_DESC_MIC); - } - - if (!NdisEqualMemory(rcvd_mic, mic, LEN_KEY_DESC_MIC)) - { + if (EapolKeyInfo.KeyDescVer == DESC_TYPE_TKIP) // TKIP + { + HMAC_MD5(pEntry->PTK, LEN_EAP_MICK, (PUCHAR) pMsg, + MsgLen, mic, MD5_DIGEST_SIZE); + } else if (EapolKeyInfo.KeyDescVer == DESC_TYPE_AES) // AES + { + HMAC_SHA1(pEntry->PTK, LEN_EAP_MICK, (PUCHAR) pMsg, + MsgLen, digest, SHA1_DIGEST_SIZE); + NdisMoveMemory(mic, digest, LEN_KEY_DESC_MIC); + } + + if (!NdisEqualMemory(rcvd_mic, mic, LEN_KEY_DESC_MIC)) { // send wireless event - for MIC different if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_MIC_DIFF_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); - - if (MsgType < EAPOL_GROUP_MSG_1) - { - DBGPRINT(RT_DEBUG_ERROR, ("MIC Different in pairwise msg %d of 4-way handshake!\n", MsgType)); - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("MIC Different in group msg %d of 2-way handshake!\n", (MsgType - EAPOL_PAIR_MSG_4))); + RTMPSendWirelessEvent(pAd, + IW_MIC_DIFF_EVENT_FLAG, + pEntry->Addr, + pEntry->apidx, 0); + + if (MsgType < EAPOL_GROUP_MSG_1) { + DBGPRINT(RT_DEBUG_ERROR, + ("MIC Different in pairwise msg %d of 4-way handshake!\n", + MsgType)); + } else { + DBGPRINT(RT_DEBUG_ERROR, + ("MIC Different in group msg %d of 2-way handshake!\n", + (MsgType - EAPOL_PAIR_MSG_4))); } hex_dump("Received MIC", rcvd_mic, LEN_KEY_DESC_MIC); hex_dump("Desired MIC", mic, LEN_KEY_DESC_MIC); return FALSE; - } + } } - // 1. Decrypt the Key Data field if GTK is included. // 2. Extract the context of the Key Data field if it exist. // The field in pairwise_msg_2_WPA1(WPA2) & pairwise_msg_3_WPA1 is clear. // The field in group_msg_1_WPA1(WPA2) & pairwise_msg_3_WPA2 is encrypted. - if (CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen) > 0) - { + if (CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen) > 0) { // Decrypt this field - if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2) || (MsgType == EAPOL_GROUP_MSG_1)) - { - if( - (EapolKeyInfo.KeyDescVer == DESC_TYPE_AES)) - { + if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2) + || (MsgType == EAPOL_GROUP_MSG_1)) { + if ((EapolKeyInfo.KeyDescVer == DESC_TYPE_AES)) { // AES AES_GTK_KEY_UNWRAP(&pEntry->PTK[16], KEYDATA, - CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen), - pMsg->KeyDesc.KeyData); - } - else - { - INT i; - UCHAR Key[32]; + CONV_ARRARY_TO_UINT16(pMsg-> + KeyDesc. + KeyDataLen), + pMsg->KeyDesc.KeyData); + } else { + INT i; + UCHAR Key[32]; // Decrypt TKIP GTK // Construct 32 bytes RC4 Key NdisMoveMemory(Key, pMsg->KeyDesc.KeyIv, 16); NdisMoveMemory(&Key[16], &pEntry->PTK[16], 16); - ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, Key, 32); + ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, Key, + 32); //discard first 256 bytes - for(i = 0; i < 256; i++) - ARCFOUR_BYTE(&pAd->PrivateInfo.WEPCONTEXT); + for (i = 0; i < 256; i++) + ARCFOUR_BYTE(&pAd->PrivateInfo. + WEPCONTEXT); // Decrypt GTK. Becareful, there is no ICV to check the result is correct or not - ARCFOUR_DECRYPT(&pAd->PrivateInfo.WEPCONTEXT, KEYDATA, - pMsg->KeyDesc.KeyData, - CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen)); + ARCFOUR_DECRYPT(&pAd->PrivateInfo.WEPCONTEXT, + KEYDATA, pMsg->KeyDesc.KeyData, + CONV_ARRARY_TO_UINT16(pMsg-> + KeyDesc. + KeyDataLen)); } if (!bWPA2 && (MsgType == EAPOL_GROUP_MSG_1)) GroupKeyIndex = EapolKeyInfo.KeyIndex; - } - else if ((MsgType == EAPOL_PAIR_MSG_2) || (MsgType == EAPOL_PAIR_MSG_3 && !bWPA2)) - { - NdisMoveMemory(KEYDATA, pMsg->KeyDesc.KeyData, CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen)); - } - else - { + } else if ((MsgType == EAPOL_PAIR_MSG_2) + || (MsgType == EAPOL_PAIR_MSG_3 && !bWPA2)) { + NdisMoveMemory(KEYDATA, pMsg->KeyDesc.KeyData, + CONV_ARRARY_TO_UINT16(pMsg->KeyDesc. + KeyDataLen)); + } else { return TRUE; } @@ -1253,9 +1192,10 @@ BOOLEAN PeerWpaMessageSanity( // 2. verify KDE format for pairwise_msg_3_WPA2, group_msg_1_WPA2 // 3. update shared key for pairwise_msg_3_WPA2, group_msg_1_WPA1(WPA2) if (!RTMPParseEapolKeyData(pAd, KEYDATA, - CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen), - GroupKeyIndex, MsgType, bWPA2, pEntry)) - { + CONV_ARRARY_TO_UINT16(pMsg->KeyDesc. + KeyDataLen), + GroupKeyIndex, MsgType, bWPA2, + pEntry)) { return FALSE; } } diff --git a/drivers/staging/rt2860/common/cmm_sync.c b/drivers/staging/rt2860/common/cmm_sync.c index 9be4d50ab5d5..9934a1b712c6 100644 --- a/drivers/staging/rt2860/common/cmm_sync.c +++ b/drivers/staging/rt2860/common/cmm_sync.c @@ -37,46 +37,61 @@ #include "../rt_config.h" // 2.4 Ghz channel plan index in the TxPower arrays. -#define BG_BAND_REGION_0_START 0 // 1,2,3,4,5,6,7,8,9,10,11 +#define BG_BAND_REGION_0_START 0 // 1,2,3,4,5,6,7,8,9,10,11 #define BG_BAND_REGION_0_SIZE 11 -#define BG_BAND_REGION_1_START 0 // 1,2,3,4,5,6,7,8,9,10,11,12,13 +#define BG_BAND_REGION_1_START 0 // 1,2,3,4,5,6,7,8,9,10,11,12,13 #define BG_BAND_REGION_1_SIZE 13 -#define BG_BAND_REGION_2_START 9 // 10,11 +#define BG_BAND_REGION_2_START 9 // 10,11 #define BG_BAND_REGION_2_SIZE 2 -#define BG_BAND_REGION_3_START 9 // 10,11,12,13 +#define BG_BAND_REGION_3_START 9 // 10,11,12,13 #define BG_BAND_REGION_3_SIZE 4 -#define BG_BAND_REGION_4_START 13 // 14 +#define BG_BAND_REGION_4_START 13 // 14 #define BG_BAND_REGION_4_SIZE 1 -#define BG_BAND_REGION_5_START 0 // 1,2,3,4,5,6,7,8,9,10,11,12,13,14 +#define BG_BAND_REGION_5_START 0 // 1,2,3,4,5,6,7,8,9,10,11,12,13,14 #define BG_BAND_REGION_5_SIZE 14 -#define BG_BAND_REGION_6_START 2 // 3,4,5,6,7,8,9 +#define BG_BAND_REGION_6_START 2 // 3,4,5,6,7,8,9 #define BG_BAND_REGION_6_SIZE 7 -#define BG_BAND_REGION_7_START 4 // 5,6,7,8,9,10,11,12,13 +#define BG_BAND_REGION_7_START 4 // 5,6,7,8,9,10,11,12,13 #define BG_BAND_REGION_7_SIZE 9 -#define BG_BAND_REGION_31_START 0 // 1,2,3,4,5,6,7,8,9,10,11,12,13,14 +#define BG_BAND_REGION_31_START 0 // 1,2,3,4,5,6,7,8,9,10,11,12,13,14 #define BG_BAND_REGION_31_SIZE 14 // 5 Ghz channel plan index in the TxPower arrays. -UCHAR A_BAND_REGION_0_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165}; -UCHAR A_BAND_REGION_1_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}; -UCHAR A_BAND_REGION_2_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64}; -UCHAR A_BAND_REGION_3_CHANNEL_LIST[]={52, 56, 60, 64, 149, 153, 157, 161}; -UCHAR A_BAND_REGION_4_CHANNEL_LIST[]={149, 153, 157, 161, 165}; -UCHAR A_BAND_REGION_5_CHANNEL_LIST[]={149, 153, 157, 161}; -UCHAR A_BAND_REGION_6_CHANNEL_LIST[]={36, 40, 44, 48}; -UCHAR A_BAND_REGION_7_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173}; -UCHAR A_BAND_REGION_8_CHANNEL_LIST[]={52, 56, 60, 64}; -UCHAR A_BAND_REGION_9_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165}; -UCHAR A_BAND_REGION_10_CHANNEL_LIST[]={36, 40, 44, 48, 149, 153, 157, 161, 165}; -UCHAR A_BAND_REGION_11_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 149, 153, 157, 161}; -UCHAR A_BAND_REGION_12_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}; -UCHAR A_BAND_REGION_13_CHANNEL_LIST[]={52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161}; -UCHAR A_BAND_REGION_14_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 136, 140, 149, 153, 157, 161, 165}; -UCHAR A_BAND_REGION_15_CHANNEL_LIST[]={149, 153, 157, 161, 165, 169, 173}; - +UCHAR A_BAND_REGION_0_CHANNEL_LIST[] = + { 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165 }; +UCHAR A_BAND_REGION_1_CHANNEL_LIST[] = + { 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, +132, 136, 140 }; +UCHAR A_BAND_REGION_2_CHANNEL_LIST[] = { 36, 40, 44, 48, 52, 56, 60, 64 }; +UCHAR A_BAND_REGION_3_CHANNEL_LIST[] = { 52, 56, 60, 64, 149, 153, 157, 161 }; +UCHAR A_BAND_REGION_4_CHANNEL_LIST[] = { 149, 153, 157, 161, 165 }; +UCHAR A_BAND_REGION_5_CHANNEL_LIST[] = { 149, 153, 157, 161 }; +UCHAR A_BAND_REGION_6_CHANNEL_LIST[] = { 36, 40, 44, 48 }; +UCHAR A_BAND_REGION_7_CHANNEL_LIST[] = + { 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, +132, 136, 140, 149, 153, 157, 161, 165, 169, 173 }; +UCHAR A_BAND_REGION_8_CHANNEL_LIST[] = { 52, 56, 60, 64 }; +UCHAR A_BAND_REGION_9_CHANNEL_LIST[] = + { 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, +149, 153, 157, 161, 165 }; +UCHAR A_BAND_REGION_10_CHANNEL_LIST[] = + { 36, 40, 44, 48, 149, 153, 157, 161, 165 }; +UCHAR A_BAND_REGION_11_CHANNEL_LIST[] = + { 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 149, 153, +157, 161 }; +UCHAR A_BAND_REGION_12_CHANNEL_LIST[] = + { 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, +132, 136, 140 }; +UCHAR A_BAND_REGION_13_CHANNEL_LIST[] = + { 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, +149, 153, 157, 161 }; +UCHAR A_BAND_REGION_14_CHANNEL_LIST[] = + { 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 136, 140, 149, +153, 157, 161, 165 }; +UCHAR A_BAND_REGION_15_CHANNEL_LIST[] = { 149, 153, 157, 161, 165, 169, 173 }; //BaSizeArray follows the 802.11n definition as MaxRxFactor. 2^(13+factor) bytes. When factor =0, it's about Ba buffer size =8. -UCHAR BaSizeArray[4] = {8,16,32,64}; +UCHAR BaSizeArray[4] = { 8, 16, 32, 64 }; /* ========================================================================== @@ -90,170 +105,243 @@ UCHAR BaSizeArray[4] = {8,16,32,64}; ========================================================================== */ -VOID BuildChannelList( - IN PRTMP_ADAPTER pAd) +VOID BuildChannelList(IN PRTMP_ADAPTER pAd) { - UCHAR i, j, index=0, num=0; - PUCHAR pChannelList = NULL; + UCHAR i, j, index = 0, num = 0; + PUCHAR pChannelList = NULL; - NdisZeroMemory(pAd->ChannelList, MAX_NUM_OF_CHANNELS * sizeof(CHANNEL_TX_POWER)); + NdisZeroMemory(pAd->ChannelList, + MAX_NUM_OF_CHANNELS * sizeof(CHANNEL_TX_POWER)); // if not 11a-only mode, channel list starts from 2.4Ghz band if ((pAd->CommonCfg.PhyMode != PHY_11A) - && (pAd->CommonCfg.PhyMode != PHY_11AN_MIXED) && (pAd->CommonCfg.PhyMode != PHY_11N_5G) - ) - { - switch (pAd->CommonCfg.CountryRegion & 0x7f) - { - case REGION_0_BG_BAND: // 1 -11 - NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_0_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_0_SIZE); - index += BG_BAND_REGION_0_SIZE; - break; - case REGION_1_BG_BAND: // 1 - 13 - NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_1_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_1_SIZE); - index += BG_BAND_REGION_1_SIZE; - break; - case REGION_2_BG_BAND: // 10 - 11 - NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_2_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_2_SIZE); - index += BG_BAND_REGION_2_SIZE; - break; - case REGION_3_BG_BAND: // 10 - 13 - NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_3_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_3_SIZE); - index += BG_BAND_REGION_3_SIZE; - break; - case REGION_4_BG_BAND: // 14 - NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_4_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_4_SIZE); - index += BG_BAND_REGION_4_SIZE; - break; - case REGION_5_BG_BAND: // 1 - 14 - NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_5_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_5_SIZE); - index += BG_BAND_REGION_5_SIZE; - break; - case REGION_6_BG_BAND: // 3 - 9 - NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_6_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_6_SIZE); - index += BG_BAND_REGION_6_SIZE; - break; - case REGION_7_BG_BAND: // 5 - 13 - NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_7_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_7_SIZE); - index += BG_BAND_REGION_7_SIZE; - break; - case REGION_31_BG_BAND: // 1 - 14 - NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_31_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_31_SIZE); - index += BG_BAND_REGION_31_SIZE; - break; - default: // Error. should never happen - break; + && (pAd->CommonCfg.PhyMode != PHY_11AN_MIXED) + && (pAd->CommonCfg.PhyMode != PHY_11N_5G) + ) { + switch (pAd->CommonCfg.CountryRegion & 0x7f) { + case REGION_0_BG_BAND: // 1 -11 + NdisMoveMemory(&pAd->ChannelList[index], + &pAd->TxPower[BG_BAND_REGION_0_START], + sizeof(CHANNEL_TX_POWER) * + BG_BAND_REGION_0_SIZE); + index += BG_BAND_REGION_0_SIZE; + break; + case REGION_1_BG_BAND: // 1 - 13 + NdisMoveMemory(&pAd->ChannelList[index], + &pAd->TxPower[BG_BAND_REGION_1_START], + sizeof(CHANNEL_TX_POWER) * + BG_BAND_REGION_1_SIZE); + index += BG_BAND_REGION_1_SIZE; + break; + case REGION_2_BG_BAND: // 10 - 11 + NdisMoveMemory(&pAd->ChannelList[index], + &pAd->TxPower[BG_BAND_REGION_2_START], + sizeof(CHANNEL_TX_POWER) * + BG_BAND_REGION_2_SIZE); + index += BG_BAND_REGION_2_SIZE; + break; + case REGION_3_BG_BAND: // 10 - 13 + NdisMoveMemory(&pAd->ChannelList[index], + &pAd->TxPower[BG_BAND_REGION_3_START], + sizeof(CHANNEL_TX_POWER) * + BG_BAND_REGION_3_SIZE); + index += BG_BAND_REGION_3_SIZE; + break; + case REGION_4_BG_BAND: // 14 + NdisMoveMemory(&pAd->ChannelList[index], + &pAd->TxPower[BG_BAND_REGION_4_START], + sizeof(CHANNEL_TX_POWER) * + BG_BAND_REGION_4_SIZE); + index += BG_BAND_REGION_4_SIZE; + break; + case REGION_5_BG_BAND: // 1 - 14 + NdisMoveMemory(&pAd->ChannelList[index], + &pAd->TxPower[BG_BAND_REGION_5_START], + sizeof(CHANNEL_TX_POWER) * + BG_BAND_REGION_5_SIZE); + index += BG_BAND_REGION_5_SIZE; + break; + case REGION_6_BG_BAND: // 3 - 9 + NdisMoveMemory(&pAd->ChannelList[index], + &pAd->TxPower[BG_BAND_REGION_6_START], + sizeof(CHANNEL_TX_POWER) * + BG_BAND_REGION_6_SIZE); + index += BG_BAND_REGION_6_SIZE; + break; + case REGION_7_BG_BAND: // 5 - 13 + NdisMoveMemory(&pAd->ChannelList[index], + &pAd->TxPower[BG_BAND_REGION_7_START], + sizeof(CHANNEL_TX_POWER) * + BG_BAND_REGION_7_SIZE); + index += BG_BAND_REGION_7_SIZE; + break; + case REGION_31_BG_BAND: // 1 - 14 + NdisMoveMemory(&pAd->ChannelList[index], + &pAd->TxPower[BG_BAND_REGION_31_START], + sizeof(CHANNEL_TX_POWER) * + BG_BAND_REGION_31_SIZE); + index += BG_BAND_REGION_31_SIZE; + break; + default: // Error. should never happen + break; } - for (i=0; iChannelList[i].MaxTxPwr = 20; } - if ((pAd->CommonCfg.PhyMode == PHY_11A) || (pAd->CommonCfg.PhyMode == PHY_11ABG_MIXED) - || (pAd->CommonCfg.PhyMode == PHY_11ABGN_MIXED) || (pAd->CommonCfg.PhyMode == PHY_11AN_MIXED) - || (pAd->CommonCfg.PhyMode == PHY_11AGN_MIXED) || (pAd->CommonCfg.PhyMode == PHY_11N_5G) - ) - { - switch (pAd->CommonCfg.CountryRegionForABand & 0x7f) - { - case REGION_0_A_BAND: - num = sizeof(A_BAND_REGION_0_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_0_CHANNEL_LIST; - break; - case REGION_1_A_BAND: - num = sizeof(A_BAND_REGION_1_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_1_CHANNEL_LIST; - break; - case REGION_2_A_BAND: - num = sizeof(A_BAND_REGION_2_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_2_CHANNEL_LIST; - break; - case REGION_3_A_BAND: - num = sizeof(A_BAND_REGION_3_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_3_CHANNEL_LIST; - break; - case REGION_4_A_BAND: - num = sizeof(A_BAND_REGION_4_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_4_CHANNEL_LIST; - break; - case REGION_5_A_BAND: - num = sizeof(A_BAND_REGION_5_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_5_CHANNEL_LIST; - break; - case REGION_6_A_BAND: - num = sizeof(A_BAND_REGION_6_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_6_CHANNEL_LIST; - break; - case REGION_7_A_BAND: - num = sizeof(A_BAND_REGION_7_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_7_CHANNEL_LIST; - break; - case REGION_8_A_BAND: - num = sizeof(A_BAND_REGION_8_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_8_CHANNEL_LIST; - break; - case REGION_9_A_BAND: - num = sizeof(A_BAND_REGION_9_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_9_CHANNEL_LIST; - break; - - case REGION_10_A_BAND: - num = sizeof(A_BAND_REGION_10_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_10_CHANNEL_LIST; - break; - - case REGION_11_A_BAND: - num = sizeof(A_BAND_REGION_11_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_11_CHANNEL_LIST; - break; - case REGION_12_A_BAND: - num = sizeof(A_BAND_REGION_12_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_12_CHANNEL_LIST; - break; - case REGION_13_A_BAND: - num = sizeof(A_BAND_REGION_13_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_13_CHANNEL_LIST; - break; - case REGION_14_A_BAND: - num = sizeof(A_BAND_REGION_14_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_14_CHANNEL_LIST; - break; - case REGION_15_A_BAND: - num = sizeof(A_BAND_REGION_15_CHANNEL_LIST)/sizeof(UCHAR); - pChannelList = A_BAND_REGION_15_CHANNEL_LIST; - break; - default: // Error. should never happen - DBGPRINT(RT_DEBUG_WARN,("countryregion=%d not support", pAd->CommonCfg.CountryRegionForABand)); - break; + if ((pAd->CommonCfg.PhyMode == PHY_11A) + || (pAd->CommonCfg.PhyMode == PHY_11ABG_MIXED) + || (pAd->CommonCfg.PhyMode == PHY_11ABGN_MIXED) + || (pAd->CommonCfg.PhyMode == PHY_11AN_MIXED) + || (pAd->CommonCfg.PhyMode == PHY_11AGN_MIXED) + || (pAd->CommonCfg.PhyMode == PHY_11N_5G) + ) { + switch (pAd->CommonCfg.CountryRegionForABand & 0x7f) { + case REGION_0_A_BAND: + num = + sizeof(A_BAND_REGION_0_CHANNEL_LIST) / + sizeof(UCHAR); + pChannelList = A_BAND_REGION_0_CHANNEL_LIST; + break; + case REGION_1_A_BAND: + num = + sizeof(A_BAND_REGION_1_CHANNEL_LIST) / + sizeof(UCHAR); + pChannelList = A_BAND_REGION_1_CHANNEL_LIST; + break; + case REGION_2_A_BAND: + num = + sizeof(A_BAND_REGION_2_CHANNEL_LIST) / + sizeof(UCHAR); + pChannelList = A_BAND_REGION_2_CHANNEL_LIST; + break; + case REGION_3_A_BAND: + num = + sizeof(A_BAND_REGION_3_CHANNEL_LIST) / + sizeof(UCHAR); + pChannelList = A_BAND_REGION_3_CHANNEL_LIST; + break; + case REGION_4_A_BAND: + num = + sizeof(A_BAND_REGION_4_CHANNEL_LIST) / + sizeof(UCHAR); + pChannelList = A_BAND_REGION_4_CHANNEL_LIST; + break; + case REGION_5_A_BAND: + num = + sizeof(A_BAND_REGION_5_CHANNEL_LIST) / + sizeof(UCHAR); + pChannelList = A_BAND_REGION_5_CHANNEL_LIST; + break; + case REGION_6_A_BAND: + num = + sizeof(A_BAND_REGION_6_CHANNEL_LIST) / + sizeof(UCHAR); + pChannelList = A_BAND_REGION_6_CHANNEL_LIST; + break; + case REGION_7_A_BAND: + num = + sizeof(A_BAND_REGION_7_CHANNEL_LIST) / + sizeof(UCHAR); + pChannelList = A_BAND_REGION_7_CHANNEL_LIST; + break; + case REGION_8_A_BAND: + num = + sizeof(A_BAND_REGION_8_CHANNEL_LIST) / + sizeof(UCHAR); + pChannelList = A_BAND_REGION_8_CHANNEL_LIST; + break; + case REGION_9_A_BAND: + num = + sizeof(A_BAND_REGION_9_CHANNEL_LIST) / + sizeof(UCHAR); + pChannelList = A_BAND_REGION_9_CHANNEL_LIST; + break; + + case REGION_10_A_BAND: + num = + sizeof(A_BAND_REGION_10_CHANNEL_LIST) / + sizeof(UCHAR); + pChannelList = A_BAND_REGION_10_CHANNEL_LIST; + break; + + case REGION_11_A_BAND: + num = + sizeof(A_BAND_REGION_11_CHANNEL_LIST) / + sizeof(UCHAR); + pChannelList = A_BAND_REGION_11_CHANNEL_LIST; + break; + case REGION_12_A_BAND: + num = + sizeof(A_BAND_REGION_12_CHANNEL_LIST) / + sizeof(UCHAR); + pChannelList = A_BAND_REGION_12_CHANNEL_LIST; + break; + case REGION_13_A_BAND: + num = + sizeof(A_BAND_REGION_13_CHANNEL_LIST) / + sizeof(UCHAR); + pChannelList = A_BAND_REGION_13_CHANNEL_LIST; + break; + case REGION_14_A_BAND: + num = + sizeof(A_BAND_REGION_14_CHANNEL_LIST) / + sizeof(UCHAR); + pChannelList = A_BAND_REGION_14_CHANNEL_LIST; + break; + case REGION_15_A_BAND: + num = + sizeof(A_BAND_REGION_15_CHANNEL_LIST) / + sizeof(UCHAR); + pChannelList = A_BAND_REGION_15_CHANNEL_LIST; + break; + default: // Error. should never happen + DBGPRINT(RT_DEBUG_WARN, + ("countryregion=%d not support", + pAd->CommonCfg.CountryRegionForABand)); + break; } - if (num != 0) - { - UCHAR RadarCh[15]={52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}; - for (i=0; iTxPower[j].Channel) - NdisMoveMemory(&pAd->ChannelList[index+i], &pAd->TxPower[j], sizeof(CHANNEL_TX_POWER)); - } - for (j=0; j<15; j++) - { + if (num != 0) { + UCHAR RadarCh[15] = + { 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, + 128, 132, 136, 140 }; + for (i = 0; i < num; i++) { + for (j = 0; j < MAX_NUM_OF_CHANNELS; j++) { + if (pChannelList[i] == + pAd->TxPower[j].Channel) + NdisMoveMemory(&pAd-> + ChannelList[index + + i], + &pAd->TxPower[j], + sizeof + (CHANNEL_TX_POWER)); + } + for (j = 0; j < 15; j++) { if (pChannelList[i] == RadarCh[j]) - pAd->ChannelList[index+i].DfsReq = TRUE; + pAd->ChannelList[index + + i].DfsReq = + TRUE; } - pAd->ChannelList[index+i].MaxTxPwr = 20; + pAd->ChannelList[index + i].MaxTxPwr = 20; } index += num; } } pAd->ChannelListNum = index; - DBGPRINT(RT_DEBUG_TRACE,("country code=%d/%d, RFIC=%d, PHY mode=%d, support %d channels\n", - pAd->CommonCfg.CountryRegion, pAd->CommonCfg.CountryRegionForABand, pAd->RfIcType, pAd->CommonCfg.PhyMode, pAd->ChannelListNum)); + DBGPRINT(RT_DEBUG_TRACE, + ("country code=%d/%d, RFIC=%d, PHY mode=%d, support %d channels\n", + pAd->CommonCfg.CountryRegion, + pAd->CommonCfg.CountryRegionForABand, pAd->RfIcType, + pAd->CommonCfg.PhyMode, pAd->ChannelListNum)); #ifdef DBG - for (i=0;iChannelListNum;i++) - { - DBGPRINT_RAW(RT_DEBUG_TRACE,("BuildChannel # %d :: Pwr0 = %d, Pwr1 =%d, \n ", pAd->ChannelList[i].Channel, pAd->ChannelList[i].Power, pAd->ChannelList[i].Power2)); + for (i = 0; i < pAd->ChannelListNum; i++) { + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("BuildChannel # %d :: Pwr0 = %d, Pwr1 =%d, \n ", + pAd->ChannelList[i].Channel, + pAd->ChannelList[i].Power, + pAd->ChannelList[i].Power2)); } #endif } @@ -271,8 +359,7 @@ VOID BuildChannelList( ========================================================================== */ -UCHAR FirstChannel( - IN PRTMP_ADAPTER pAd) +UCHAR FirstChannel(IN PRTMP_ADAPTER pAd) { return pAd->ChannelList[0].Channel; } @@ -288,19 +375,16 @@ UCHAR FirstChannel( return 0 if no more next channel ========================================================================== */ -UCHAR NextChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR channel) +UCHAR NextChannel(IN PRTMP_ADAPTER pAd, IN UCHAR channel) { int i; UCHAR next_channel = 0; for (i = 0; i < (pAd->ChannelListNum - 1); i++) - if (channel == pAd->ChannelList[i].Channel) - { - next_channel = pAd->ChannelList[i+1].Channel; + if (channel == pAd->ChannelList[i].Channel) { + next_channel = pAd->ChannelList[i + 1].Channel; break; - } + } return next_channel; } @@ -324,16 +408,15 @@ UCHAR NextChannel( the minimum value or next lower value. ========================================================================== */ -VOID ChangeToCellPowerLimit( - IN PRTMP_ADAPTER pAd, - IN UCHAR AironetCellPowerLimit) +VOID ChangeToCellPowerLimit(IN PRTMP_ADAPTER pAd, + IN UCHAR AironetCellPowerLimit) { //valud 0xFF means that hasn't found power limit information //from the AP's Beacon/Probe response. if (AironetCellPowerLimit == 0xFF) return; - if (AironetCellPowerLimit < 6) //Used Lowest Power Percentage. + if (AironetCellPowerLimit < 6) //Used Lowest Power Percentage. pAd->CommonCfg.TxPowerPercentage = 6; else if (AironetCellPowerLimit < 9) pAd->CommonCfg.TxPowerPercentage = 10; @@ -344,45 +427,40 @@ VOID ChangeToCellPowerLimit( else if (AironetCellPowerLimit < 15) pAd->CommonCfg.TxPowerPercentage = 75; else - pAd->CommonCfg.TxPowerPercentage = 100; //else used maximum + pAd->CommonCfg.TxPowerPercentage = 100; //else used maximum if (pAd->CommonCfg.TxPowerPercentage > pAd->CommonCfg.TxPowerDefault) - pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault; + pAd->CommonCfg.TxPowerPercentage = + pAd->CommonCfg.TxPowerDefault; } -CHAR ConvertToRssi( - IN PRTMP_ADAPTER pAd, - IN CHAR Rssi, - IN UCHAR RssiNumber) +CHAR ConvertToRssi(IN PRTMP_ADAPTER pAd, IN CHAR Rssi, IN UCHAR RssiNumber) { - UCHAR RssiOffset, LNAGain; + UCHAR RssiOffset, LNAGain; // Rssi equals to zero should be an invalid value if (Rssi == 0) return -99; LNAGain = GET_LNA_GAIN(pAd); - if (pAd->LatchRfRegs.Channel > 14) - { - if (RssiNumber == 0) + if (pAd->LatchRfRegs.Channel > 14) { + if (RssiNumber == 0) RssiOffset = pAd->ARssiOffset0; else if (RssiNumber == 1) RssiOffset = pAd->ARssiOffset1; else RssiOffset = pAd->ARssiOffset2; - } - else - { - if (RssiNumber == 0) + } else { + if (RssiNumber == 0) RssiOffset = pAd->BGRssiOffset0; else if (RssiNumber == 1) RssiOffset = pAd->BGRssiOffset1; else RssiOffset = pAd->BGRssiOffset2; - } + } - return (-12 - RssiOffset - LNAGain - Rssi); + return (-12 - RssiOffset - LNAGain - Rssi); } /* @@ -391,44 +469,44 @@ CHAR ConvertToRssi( Scan next channel ========================================================================== */ -VOID ScanNextChannel( - IN PRTMP_ADAPTER pAd) +VOID ScanNextChannel(IN PRTMP_ADAPTER pAd) { - HEADER_802_11 Hdr80211; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - UCHAR SsidLen = 0, ScanType = pAd->MlmeAux.ScanType, BBPValue = 0; - USHORT Status; - PHEADER_802_11 pHdr80211; - UINT ScanTimeIn5gChannel = SHORT_CHANNEL_TIME; + HEADER_802_11 Hdr80211; + PUCHAR pOutBuffer = NULL; + NDIS_STATUS NStatus; + ULONG FrameLen = 0; + UCHAR SsidLen = 0, ScanType = pAd->MlmeAux.ScanType, BBPValue = 0; + USHORT Status; + PHEADER_802_11 pHdr80211; + UINT ScanTimeIn5gChannel = SHORT_CHANNEL_TIME; { - if (MONITOR_ON(pAd)) - return; + if (MONITOR_ON(pAd)) + return; } - - if (pAd->MlmeAux.Channel == 0) - { + if (pAd->MlmeAux.Channel == 0) { if ((pAd->CommonCfg.BBPCurrentBW == BW_40) - && (INFRA_ON(pAd) - || (pAd->OpMode == OPMODE_AP)) - ) - { - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); + && (INFRA_ON(pAd) + || (pAd->OpMode == OPMODE_AP)) + ) { + AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, + FALSE); AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); BBPValue &= (~0x18); BBPValue |= 0x10; RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - End of SCAN, restore to 40MHz channel %d, Total BSS[%02d]\n",pAd->CommonCfg.CentralChannel, pAd->ScanTab.BssNr)); - } - else - { + DBGPRINT(RT_DEBUG_TRACE, + ("SYNC - End of SCAN, restore to 40MHz channel %d, Total BSS[%02d]\n", + pAd->CommonCfg.CentralChannel, + pAd->ScanTab.BssNr)); + } else { AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.Channel); - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - End of SCAN, restore to channel %d, Total BSS[%02d]\n",pAd->CommonCfg.Channel, pAd->ScanTab.BssNr)); + DBGPRINT(RT_DEBUG_TRACE, + ("SYNC - End of SCAN, restore to channel %d, Total BSS[%02d]\n", + pAd->CommonCfg.Channel, pAd->ScanTab.BssNr)); } { @@ -437,20 +515,29 @@ VOID ScanNextChannel( // Send an NULL data with turned PSM bit on to current associated AP before SCAN progress. // Now, we need to send an NULL data with turned PSM bit off to AP, when scan progress done // - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) && (INFRA_ON(pAd))) - { - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); - if (NStatus == NDIS_STATUS_SUCCESS) - { + if (OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) + && (INFRA_ON(pAd))) { + NStatus = + MlmeAllocateMemory(pAd, + (PVOID) & pOutBuffer); + if (NStatus == NDIS_STATUS_SUCCESS) { pHdr80211 = (PHEADER_802_11) pOutBuffer; - MgtMacHeaderInit(pAd, pHdr80211, SUBTYPE_NULL_FUNC, 1, pAd->CommonCfg.Bssid, pAd->CommonCfg.Bssid); + MgtMacHeaderInit(pAd, pHdr80211, + SUBTYPE_NULL_FUNC, 1, + pAd->CommonCfg.Bssid, + pAd->CommonCfg.Bssid); pHdr80211->Duration = 0; pHdr80211->FC.Type = BTYPE_DATA; - pHdr80211->FC.PwrMgmt = (pAd->StaCfg.Psm == PWR_SAVE); + pHdr80211->FC.PwrMgmt = + (pAd->StaCfg.Psm == PWR_SAVE); // Send using priority queue - MiniportMMRequest(pAd, 0, pOutBuffer, sizeof(HEADER_802_11)); - DBGPRINT(RT_DEBUG_TRACE, ("MlmeScanReqAction -- Send PSM Data frame\n")); + MiniportMMRequest(pAd, 0, pOutBuffer, + sizeof + (HEADER_802_11)); + DBGPRINT(RT_DEBUG_TRACE, + ("MlmeScanReqAction -- Send PSM Data frame\n")); MlmeFreeMemory(pAd, pOutBuffer); RTMPusecDelay(5000); } @@ -458,25 +545,24 @@ VOID ScanNextChannel( pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; Status = MLME_SUCCESS; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_SCAN_CONF, 2, &Status); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_SCAN_CONF, + 2, &Status); } - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); } #ifdef RTMP_MAC_USB - else if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST) && (pAd->OpMode == OPMODE_STA)) - { + else if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST) + && (pAd->OpMode == OPMODE_STA)) { pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; MlmeCntlConfirm(pAd, MT2_SCAN_CONF, MLME_FAIL_NO_RESOURCE); } #endif // RTMP_MAC_USB // - else - { + else { { - // BBP and RF are not accessible in PS mode, we has to wake them up first - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - AsicForceWakeup(pAd, TRUE); + // BBP and RF are not accessible in PS mode, we has to wake them up first + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) + AsicForceWakeup(pAd, TRUE); // leave PSM during scanning. otherwise we may lost ProbeRsp & BEACON if (pAd->StaCfg.Psm == PWR_SAVE) @@ -487,10 +573,11 @@ VOID ScanNextChannel( AsicLockChannel(pAd, pAd->MlmeAux.Channel); { - if (pAd->MlmeAux.Channel > 14) - { - if ((pAd->CommonCfg.bIEEE80211H == 1) && RadarChannelCheck(pAd, pAd->MlmeAux.Channel)) - { + if (pAd->MlmeAux.Channel > 14) { + if ((pAd->CommonCfg.bIEEE80211H == 1) + && RadarChannelCheck(pAd, + pAd->MlmeAux. + Channel)) { ScanType = SCAN_PASSIVE; ScanTimeIn5gChannel = MIN_CHANNEL_TIME; } @@ -498,103 +585,108 @@ VOID ScanNextChannel( } //Global country domain(ch1-11:active scan, ch12-14 passive scan) - if ((pAd->MlmeAux.Channel <= 14) && (pAd->MlmeAux.Channel >= 12) && ((pAd->CommonCfg.CountryRegion & 0x7f) == REGION_31_BG_BAND)) - { + if ((pAd->MlmeAux.Channel <= 14) && (pAd->MlmeAux.Channel >= 12) + && ((pAd->CommonCfg.CountryRegion & 0x7f) == + REGION_31_BG_BAND)) { ScanType = SCAN_PASSIVE; } - // We need to shorten active scan time in order for WZC connect issue // Chnage the channel scan time for CISCO stuff based on its IAPP announcement if (ScanType == FAST_SCAN_ACTIVE) - RTMPSetTimer(&pAd->MlmeAux.ScanTimer, FAST_ACTIVE_SCAN_TIME); - else // must be SCAN_PASSIVE or SCAN_ACTIVE + RTMPSetTimer(&pAd->MlmeAux.ScanTimer, + FAST_ACTIVE_SCAN_TIME); + else // must be SCAN_PASSIVE or SCAN_ACTIVE { if ((pAd->CommonCfg.PhyMode == PHY_11ABG_MIXED) - || (pAd->CommonCfg.PhyMode == PHY_11ABGN_MIXED) || (pAd->CommonCfg.PhyMode == PHY_11AGN_MIXED) - ) - { + || (pAd->CommonCfg.PhyMode == PHY_11ABGN_MIXED) + || (pAd->CommonCfg.PhyMode == PHY_11AGN_MIXED) + ) { if (pAd->MlmeAux.Channel > 14) - RTMPSetTimer(&pAd->MlmeAux.ScanTimer, ScanTimeIn5gChannel); + RTMPSetTimer(&pAd->MlmeAux.ScanTimer, + ScanTimeIn5gChannel); else - RTMPSetTimer(&pAd->MlmeAux.ScanTimer, MIN_CHANNEL_TIME); - } - else - RTMPSetTimer(&pAd->MlmeAux.ScanTimer, MAX_CHANNEL_TIME); + RTMPSetTimer(&pAd->MlmeAux.ScanTimer, + MIN_CHANNEL_TIME); + } else + RTMPSetTimer(&pAd->MlmeAux.ScanTimer, + MAX_CHANNEL_TIME); } if ((ScanType == SCAN_ACTIVE) - || (ScanType == FAST_SCAN_ACTIVE) - ) - { - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - ScanNextChannel() allocate memory fail\n")); + || (ScanType == FAST_SCAN_ACTIVE) + ) { + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_TRACE, + ("SYNC - ScanNextChannel() allocate memory fail\n")); { - pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; + pAd->Mlme.SyncMachine.CurrState = + SYNC_IDLE; Status = MLME_FAIL_NO_RESOURCE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_SCAN_CONF, 2, &Status); + MlmeEnqueue(pAd, + MLME_CNTL_STATE_MACHINE, + MT2_SCAN_CONF, 2, &Status); } return; } - // There is no need to send broadcast probe request if active scan is in effect. - if ((ScanType == SCAN_ACTIVE) || (ScanType == FAST_SCAN_ACTIVE) - ) + if ((ScanType == SCAN_ACTIVE) + || (ScanType == FAST_SCAN_ACTIVE) + ) SsidLen = pAd->MlmeAux.SsidLen; else SsidLen = 0; - MgtMacHeaderInit(pAd, &Hdr80211, SUBTYPE_PROBE_REQ, 0, BROADCAST_ADDR, BROADCAST_ADDR); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &Hdr80211, - 1, &SsidIe, - 1, &SsidLen, - SsidLen, pAd->MlmeAux.Ssid, - 1, &SupRateIe, - 1, &pAd->CommonCfg.SupRateLen, - pAd->CommonCfg.SupRateLen, pAd->CommonCfg.SupRate, - END_OF_ARGS); - - if (pAd->CommonCfg.ExtRateLen) - { + MgtMacHeaderInit(pAd, &Hdr80211, SUBTYPE_PROBE_REQ, 0, + BROADCAST_ADDR, BROADCAST_ADDR); + MakeOutgoingFrame(pOutBuffer, &FrameLen, + sizeof(HEADER_802_11), &Hdr80211, 1, + &SsidIe, 1, &SsidLen, SsidLen, + pAd->MlmeAux.Ssid, 1, &SupRateIe, 1, + &pAd->CommonCfg.SupRateLen, + pAd->CommonCfg.SupRateLen, + pAd->CommonCfg.SupRate, END_OF_ARGS); + + if (pAd->CommonCfg.ExtRateLen) { ULONG Tmp; - MakeOutgoingFrame(pOutBuffer + FrameLen, &Tmp, - 1, &ExtRateIe, - 1, &pAd->CommonCfg.ExtRateLen, - pAd->CommonCfg.ExtRateLen, pAd->CommonCfg.ExtRate, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer + FrameLen, &Tmp, + 1, &ExtRateIe, + 1, &pAd->CommonCfg.ExtRateLen, + pAd->CommonCfg.ExtRateLen, + pAd->CommonCfg.ExtRate, + END_OF_ARGS); FrameLen += Tmp; } - if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) - { - ULONG Tmp; - UCHAR HtLen; - UCHAR BROADCOM[4] = {0x0, 0x90, 0x4c, 0x33}; - - if (pAd->bBroadComHT == TRUE) - { - HtLen = pAd->MlmeAux.HtCapabilityLen + 4; - - MakeOutgoingFrame(pOutBuffer + FrameLen, &Tmp, - 1, &WpaIe, - 1, &HtLen, - 4, &BROADCOM[0], - pAd->MlmeAux.HtCapabilityLen, &pAd->MlmeAux.HtCapability, - END_OF_ARGS); - } - else - { + if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) { + ULONG Tmp; + UCHAR HtLen; + UCHAR BROADCOM[4] = { 0x0, 0x90, 0x4c, 0x33 }; + + if (pAd->bBroadComHT == TRUE) { + HtLen = + pAd->MlmeAux.HtCapabilityLen + 4; + + MakeOutgoingFrame(pOutBuffer + FrameLen, + &Tmp, 1, &WpaIe, 1, + &HtLen, 4, + &BROADCOM[0], + pAd->MlmeAux. + HtCapabilityLen, + &pAd->MlmeAux. + HtCapability, + END_OF_ARGS); + } else { HtLen = pAd->MlmeAux.HtCapabilityLen; - MakeOutgoingFrame(pOutBuffer + FrameLen, &Tmp, - 1, &HtCapIe, - 1, &HtLen, - HtLen, &pAd->CommonCfg.HtCapability, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer + FrameLen, + &Tmp, 1, &HtCapIe, 1, + &HtLen, HtLen, + &pAd->CommonCfg. + HtCapability, + END_OF_ARGS); } FrameLen += Tmp; } @@ -602,20 +694,16 @@ VOID ScanNextChannel( MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); } - // For SCAN_CISCO_PASSIVE, do nothing and silently wait for beacon or other probe reponse pAd->Mlme.SyncMachine.CurrState = SCAN_LISTEN; } } -VOID MgtProbReqMacHeaderInit( - IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, - IN UCHAR SubType, - IN UCHAR ToDs, - IN PUCHAR pDA, - IN PUCHAR pBssid) +VOID MgtProbReqMacHeaderInit(IN PRTMP_ADAPTER pAd, + IN OUT PHEADER_802_11 pHdr80211, + IN UCHAR SubType, + IN UCHAR ToDs, IN PUCHAR pDA, IN PUCHAR pBssid) { NdisZeroMemory(pHdr80211, sizeof(HEADER_802_11)); @@ -628,5 +716,3 @@ VOID MgtProbReqMacHeaderInit( COPY_MAC_ADDR(pHdr80211->Addr2, pAd->CurrentAddress); COPY_MAC_ADDR(pHdr80211->Addr3, pBssid); } - - diff --git a/drivers/staging/rt2860/common/cmm_tkip.c b/drivers/staging/rt2860/common/cmm_tkip.c index 20423e16e0c0..b93c3fa73518 100644 --- a/drivers/staging/rt2860/common/cmm_tkip.c +++ b/drivers/staging/rt2860/common/cmm_tkip.c @@ -42,109 +42,101 @@ ( ((A) << (n)) | ( ((A)>>(32-(n))) & ( (1UL << (n)) - 1 ) ) ) #define ROR32( A, n ) ROL32( (A), 32-(n) ) -UINT Tkip_Sbox_Lower[256] = -{ - 0xA5,0x84,0x99,0x8D,0x0D,0xBD,0xB1,0x54, - 0x50,0x03,0xA9,0x7D,0x19,0x62,0xE6,0x9A, - 0x45,0x9D,0x40,0x87,0x15,0xEB,0xC9,0x0B, - 0xEC,0x67,0xFD,0xEA,0xBF,0xF7,0x96,0x5B, - 0xC2,0x1C,0xAE,0x6A,0x5A,0x41,0x02,0x4F, - 0x5C,0xF4,0x34,0x08,0x93,0x73,0x53,0x3F, - 0x0C,0x52,0x65,0x5E,0x28,0xA1,0x0F,0xB5, - 0x09,0x36,0x9B,0x3D,0x26,0x69,0xCD,0x9F, - 0x1B,0x9E,0x74,0x2E,0x2D,0xB2,0xEE,0xFB, - 0xF6,0x4D,0x61,0xCE,0x7B,0x3E,0x71,0x97, - 0xF5,0x68,0x00,0x2C,0x60,0x1F,0xC8,0xED, - 0xBE,0x46,0xD9,0x4B,0xDE,0xD4,0xE8,0x4A, - 0x6B,0x2A,0xE5,0x16,0xC5,0xD7,0x55,0x94, - 0xCF,0x10,0x06,0x81,0xF0,0x44,0xBA,0xE3, - 0xF3,0xFE,0xC0,0x8A,0xAD,0xBC,0x48,0x04, - 0xDF,0xC1,0x75,0x63,0x30,0x1A,0x0E,0x6D, - 0x4C,0x14,0x35,0x2F,0xE1,0xA2,0xCC,0x39, - 0x57,0xF2,0x82,0x47,0xAC,0xE7,0x2B,0x95, - 0xA0,0x98,0xD1,0x7F,0x66,0x7E,0xAB,0x83, - 0xCA,0x29,0xD3,0x3C,0x79,0xE2,0x1D,0x76, - 0x3B,0x56,0x4E,0x1E,0xDB,0x0A,0x6C,0xE4, - 0x5D,0x6E,0xEF,0xA6,0xA8,0xA4,0x37,0x8B, - 0x32,0x43,0x59,0xB7,0x8C,0x64,0xD2,0xE0, - 0xB4,0xFA,0x07,0x25,0xAF,0x8E,0xE9,0x18, - 0xD5,0x88,0x6F,0x72,0x24,0xF1,0xC7,0x51, - 0x23,0x7C,0x9C,0x21,0xDD,0xDC,0x86,0x85, - 0x90,0x42,0xC4,0xAA,0xD8,0x05,0x01,0x12, - 0xA3,0x5F,0xF9,0xD0,0x91,0x58,0x27,0xB9, - 0x38,0x13,0xB3,0x33,0xBB,0x70,0x89,0xA7, - 0xB6,0x22,0x92,0x20,0x49,0xFF,0x78,0x7A, - 0x8F,0xF8,0x80,0x17,0xDA,0x31,0xC6,0xB8, - 0xC3,0xB0,0x77,0x11,0xCB,0xFC,0xD6,0x3A +UINT Tkip_Sbox_Lower[256] = { + 0xA5, 0x84, 0x99, 0x8D, 0x0D, 0xBD, 0xB1, 0x54, + 0x50, 0x03, 0xA9, 0x7D, 0x19, 0x62, 0xE6, 0x9A, + 0x45, 0x9D, 0x40, 0x87, 0x15, 0xEB, 0xC9, 0x0B, + 0xEC, 0x67, 0xFD, 0xEA, 0xBF, 0xF7, 0x96, 0x5B, + 0xC2, 0x1C, 0xAE, 0x6A, 0x5A, 0x41, 0x02, 0x4F, + 0x5C, 0xF4, 0x34, 0x08, 0x93, 0x73, 0x53, 0x3F, + 0x0C, 0x52, 0x65, 0x5E, 0x28, 0xA1, 0x0F, 0xB5, + 0x09, 0x36, 0x9B, 0x3D, 0x26, 0x69, 0xCD, 0x9F, + 0x1B, 0x9E, 0x74, 0x2E, 0x2D, 0xB2, 0xEE, 0xFB, + 0xF6, 0x4D, 0x61, 0xCE, 0x7B, 0x3E, 0x71, 0x97, + 0xF5, 0x68, 0x00, 0x2C, 0x60, 0x1F, 0xC8, 0xED, + 0xBE, 0x46, 0xD9, 0x4B, 0xDE, 0xD4, 0xE8, 0x4A, + 0x6B, 0x2A, 0xE5, 0x16, 0xC5, 0xD7, 0x55, 0x94, + 0xCF, 0x10, 0x06, 0x81, 0xF0, 0x44, 0xBA, 0xE3, + 0xF3, 0xFE, 0xC0, 0x8A, 0xAD, 0xBC, 0x48, 0x04, + 0xDF, 0xC1, 0x75, 0x63, 0x30, 0x1A, 0x0E, 0x6D, + 0x4C, 0x14, 0x35, 0x2F, 0xE1, 0xA2, 0xCC, 0x39, + 0x57, 0xF2, 0x82, 0x47, 0xAC, 0xE7, 0x2B, 0x95, + 0xA0, 0x98, 0xD1, 0x7F, 0x66, 0x7E, 0xAB, 0x83, + 0xCA, 0x29, 0xD3, 0x3C, 0x79, 0xE2, 0x1D, 0x76, + 0x3B, 0x56, 0x4E, 0x1E, 0xDB, 0x0A, 0x6C, 0xE4, + 0x5D, 0x6E, 0xEF, 0xA6, 0xA8, 0xA4, 0x37, 0x8B, + 0x32, 0x43, 0x59, 0xB7, 0x8C, 0x64, 0xD2, 0xE0, + 0xB4, 0xFA, 0x07, 0x25, 0xAF, 0x8E, 0xE9, 0x18, + 0xD5, 0x88, 0x6F, 0x72, 0x24, 0xF1, 0xC7, 0x51, + 0x23, 0x7C, 0x9C, 0x21, 0xDD, 0xDC, 0x86, 0x85, + 0x90, 0x42, 0xC4, 0xAA, 0xD8, 0x05, 0x01, 0x12, + 0xA3, 0x5F, 0xF9, 0xD0, 0x91, 0x58, 0x27, 0xB9, + 0x38, 0x13, 0xB3, 0x33, 0xBB, 0x70, 0x89, 0xA7, + 0xB6, 0x22, 0x92, 0x20, 0x49, 0xFF, 0x78, 0x7A, + 0x8F, 0xF8, 0x80, 0x17, 0xDA, 0x31, 0xC6, 0xB8, + 0xC3, 0xB0, 0x77, 0x11, 0xCB, 0xFC, 0xD6, 0x3A }; -UINT Tkip_Sbox_Upper[256] = -{ - 0xC6,0xF8,0xEE,0xF6,0xFF,0xD6,0xDE,0x91, - 0x60,0x02,0xCE,0x56,0xE7,0xB5,0x4D,0xEC, - 0x8F,0x1F,0x89,0xFA,0xEF,0xB2,0x8E,0xFB, - 0x41,0xB3,0x5F,0x45,0x23,0x53,0xE4,0x9B, - 0x75,0xE1,0x3D,0x4C,0x6C,0x7E,0xF5,0x83, - 0x68,0x51,0xD1,0xF9,0xE2,0xAB,0x62,0x2A, - 0x08,0x95,0x46,0x9D,0x30,0x37,0x0A,0x2F, - 0x0E,0x24,0x1B,0xDF,0xCD,0x4E,0x7F,0xEA, - 0x12,0x1D,0x58,0x34,0x36,0xDC,0xB4,0x5B, - 0xA4,0x76,0xB7,0x7D,0x52,0xDD,0x5E,0x13, - 0xA6,0xB9,0x00,0xC1,0x40,0xE3,0x79,0xB6, - 0xD4,0x8D,0x67,0x72,0x94,0x98,0xB0,0x85, - 0xBB,0xC5,0x4F,0xED,0x86,0x9A,0x66,0x11, - 0x8A,0xE9,0x04,0xFE,0xA0,0x78,0x25,0x4B, - 0xA2,0x5D,0x80,0x05,0x3F,0x21,0x70,0xF1, - 0x63,0x77,0xAF,0x42,0x20,0xE5,0xFD,0xBF, - 0x81,0x18,0x26,0xC3,0xBE,0x35,0x88,0x2E, - 0x93,0x55,0xFC,0x7A,0xC8,0xBA,0x32,0xE6, - 0xC0,0x19,0x9E,0xA3,0x44,0x54,0x3B,0x0B, - 0x8C,0xC7,0x6B,0x28,0xA7,0xBC,0x16,0xAD, - 0xDB,0x64,0x74,0x14,0x92,0x0C,0x48,0xB8, - 0x9F,0xBD,0x43,0xC4,0x39,0x31,0xD3,0xF2, - 0xD5,0x8B,0x6E,0xDA,0x01,0xB1,0x9C,0x49, - 0xD8,0xAC,0xF3,0xCF,0xCA,0xF4,0x47,0x10, - 0x6F,0xF0,0x4A,0x5C,0x38,0x57,0x73,0x97, - 0xCB,0xA1,0xE8,0x3E,0x96,0x61,0x0D,0x0F, - 0xE0,0x7C,0x71,0xCC,0x90,0x06,0xF7,0x1C, - 0xC2,0x6A,0xAE,0x69,0x17,0x99,0x3A,0x27, - 0xD9,0xEB,0x2B,0x22,0xD2,0xA9,0x07,0x33, - 0x2D,0x3C,0x15,0xC9,0x87,0xAA,0x50,0xA5, - 0x03,0x59,0x09,0x1A,0x65,0xD7,0x84,0xD0, - 0x82,0x29,0x5A,0x1E,0x7B,0xA8,0x6D,0x2C +UINT Tkip_Sbox_Upper[256] = { + 0xC6, 0xF8, 0xEE, 0xF6, 0xFF, 0xD6, 0xDE, 0x91, + 0x60, 0x02, 0xCE, 0x56, 0xE7, 0xB5, 0x4D, 0xEC, + 0x8F, 0x1F, 0x89, 0xFA, 0xEF, 0xB2, 0x8E, 0xFB, + 0x41, 0xB3, 0x5F, 0x45, 0x23, 0x53, 0xE4, 0x9B, + 0x75, 0xE1, 0x3D, 0x4C, 0x6C, 0x7E, 0xF5, 0x83, + 0x68, 0x51, 0xD1, 0xF9, 0xE2, 0xAB, 0x62, 0x2A, + 0x08, 0x95, 0x46, 0x9D, 0x30, 0x37, 0x0A, 0x2F, + 0x0E, 0x24, 0x1B, 0xDF, 0xCD, 0x4E, 0x7F, 0xEA, + 0x12, 0x1D, 0x58, 0x34, 0x36, 0xDC, 0xB4, 0x5B, + 0xA4, 0x76, 0xB7, 0x7D, 0x52, 0xDD, 0x5E, 0x13, + 0xA6, 0xB9, 0x00, 0xC1, 0x40, 0xE3, 0x79, 0xB6, + 0xD4, 0x8D, 0x67, 0x72, 0x94, 0x98, 0xB0, 0x85, + 0xBB, 0xC5, 0x4F, 0xED, 0x86, 0x9A, 0x66, 0x11, + 0x8A, 0xE9, 0x04, 0xFE, 0xA0, 0x78, 0x25, 0x4B, + 0xA2, 0x5D, 0x80, 0x05, 0x3F, 0x21, 0x70, 0xF1, + 0x63, 0x77, 0xAF, 0x42, 0x20, 0xE5, 0xFD, 0xBF, + 0x81, 0x18, 0x26, 0xC3, 0xBE, 0x35, 0x88, 0x2E, + 0x93, 0x55, 0xFC, 0x7A, 0xC8, 0xBA, 0x32, 0xE6, + 0xC0, 0x19, 0x9E, 0xA3, 0x44, 0x54, 0x3B, 0x0B, + 0x8C, 0xC7, 0x6B, 0x28, 0xA7, 0xBC, 0x16, 0xAD, + 0xDB, 0x64, 0x74, 0x14, 0x92, 0x0C, 0x48, 0xB8, + 0x9F, 0xBD, 0x43, 0xC4, 0x39, 0x31, 0xD3, 0xF2, + 0xD5, 0x8B, 0x6E, 0xDA, 0x01, 0xB1, 0x9C, 0x49, + 0xD8, 0xAC, 0xF3, 0xCF, 0xCA, 0xF4, 0x47, 0x10, + 0x6F, 0xF0, 0x4A, 0x5C, 0x38, 0x57, 0x73, 0x97, + 0xCB, 0xA1, 0xE8, 0x3E, 0x96, 0x61, 0x0D, 0x0F, + 0xE0, 0x7C, 0x71, 0xCC, 0x90, 0x06, 0xF7, 0x1C, + 0xC2, 0x6A, 0xAE, 0x69, 0x17, 0x99, 0x3A, 0x27, + 0xD9, 0xEB, 0x2B, 0x22, 0xD2, 0xA9, 0x07, 0x33, + 0x2D, 0x3C, 0x15, 0xC9, 0x87, 0xAA, 0x50, 0xA5, + 0x03, 0x59, 0x09, 0x1A, 0x65, 0xD7, 0x84, 0xD0, + 0x82, 0x29, 0x5A, 0x1E, 0x7B, 0xA8, 0x6D, 0x2C }; // // Expanded IV for TKIP function. // -typedef struct PACKED _IV_CONTROL_ -{ - union PACKED - { - struct PACKED - { - UCHAR rc0; - UCHAR rc1; - UCHAR rc2; - - union PACKED - { - struct PACKED - { - UCHAR Rsvd:5; - UCHAR ExtIV:1; - UCHAR KeyID:2; - } field; - UCHAR Byte; - } CONTROL; - } field; - - ULONG word; - } IV16; - - ULONG IV32; -} TKIP_IV, *PTKIP_IV; - +typedef struct PACKED _IV_CONTROL_ { + union PACKED { + struct PACKED { + UCHAR rc0; + UCHAR rc1; + UCHAR rc2; + + union PACKED { + struct PACKED { + UCHAR Rsvd:5; + UCHAR ExtIV:1; + UCHAR KeyID:2; + } field; + UCHAR Byte; + } CONTROL; + } field; + + ULONG word; + } IV16; + + ULONG IV32; +} TKIP_IV, *PTKIP_IV; /* ======================================================================== @@ -162,14 +154,12 @@ typedef struct PACKED _IV_CONTROL_ ======================================================================== */ -ULONG RTMPTkipGetUInt32( - IN PUCHAR pMICKey) +ULONG RTMPTkipGetUInt32(IN PUCHAR pMICKey) { - ULONG res = 0; - INT i; + ULONG res = 0; + INT i; - for (i = 0; i < 4; i++) - { + for (i = 0; i < 4; i++) { res |= (*pMICKey++) << (8 * i); } @@ -195,14 +185,11 @@ ULONG RTMPTkipGetUInt32( ======================================================================== */ -VOID RTMPTkipPutUInt32( - IN OUT PUCHAR pDst, - IN ULONG val) +VOID RTMPTkipPutUInt32(IN OUT PUCHAR pDst, IN ULONG val) { INT i; - for(i = 0; i < 4; i++) - { + for (i = 0; i < 4; i++) { *pDst++ = (UCHAR) (val & 0xff); val >>= 8; } @@ -227,9 +214,7 @@ VOID RTMPTkipPutUInt32( ======================================================================== */ -VOID RTMPTkipSetMICKey( - IN PTKIP_KEY_INFO pTkip, - IN PUCHAR pMICKey) +VOID RTMPTkipSetMICKey(IN PTKIP_KEY_INFO pTkip, IN PUCHAR pMICKey) { // Set the key pTkip->K0 = RTMPTkipGetUInt32(pMICKey); @@ -260,24 +245,23 @@ VOID RTMPTkipSetMICKey( ======================================================================== */ -VOID RTMPTkipAppendByte( - IN PTKIP_KEY_INFO pTkip, - IN UCHAR uChar) +VOID RTMPTkipAppendByte(IN PTKIP_KEY_INFO pTkip, IN UCHAR uChar) { // Append the byte to our word-sized buffer - pTkip->M |= (uChar << (8* pTkip->nBytesInM)); + pTkip->M |= (uChar << (8 * pTkip->nBytesInM)); pTkip->nBytesInM++; // Process the word if it is full. - if( pTkip->nBytesInM >= 4 ) - { + if (pTkip->nBytesInM >= 4) { pTkip->L ^= pTkip->M; - pTkip->R ^= ROL32( pTkip->L, 17 ); + pTkip->R ^= ROL32(pTkip->L, 17); pTkip->L += pTkip->R; - pTkip->R ^= ((pTkip->L & 0xff00ff00) >> 8) | ((pTkip->L & 0x00ff00ff) << 8); + pTkip->R ^= + ((pTkip->L & 0xff00ff00) >> 8) | ((pTkip-> + L & 0x00ff00ff) << 8); pTkip->L += pTkip->R; - pTkip->R ^= ROL32( pTkip->L, 3 ); + pTkip->R ^= ROL32(pTkip->L, 3); pTkip->L += pTkip->R; - pTkip->R ^= ROR32( pTkip->L, 2 ); + pTkip->R ^= ROR32(pTkip->L, 2); pTkip->L += pTkip->R; // Clear the buffer pTkip->M = 0; @@ -305,14 +289,10 @@ VOID RTMPTkipAppendByte( ======================================================================== */ -VOID RTMPTkipAppend( - IN PTKIP_KEY_INFO pTkip, - IN PUCHAR pSrc, - IN UINT nBytes) +VOID RTMPTkipAppend(IN PTKIP_KEY_INFO pTkip, IN PUCHAR pSrc, IN UINT nBytes) { // This is simple - while(nBytes > 0) - { + while (nBytes > 0) { RTMPTkipAppendByte(pTkip, *pSrc++); nBytes--; } @@ -336,19 +316,17 @@ VOID RTMPTkipAppend( the MIC Value is store in pAd->PrivateInfo.MIC ======================================================================== */ -VOID RTMPTkipGetMIC( - IN PTKIP_KEY_INFO pTkip) +VOID RTMPTkipGetMIC(IN PTKIP_KEY_INFO pTkip) { // Append the minimum padding - RTMPTkipAppendByte(pTkip, 0x5a ); - RTMPTkipAppendByte(pTkip, 0 ); - RTMPTkipAppendByte(pTkip, 0 ); - RTMPTkipAppendByte(pTkip, 0 ); - RTMPTkipAppendByte(pTkip, 0 ); + RTMPTkipAppendByte(pTkip, 0x5a); + RTMPTkipAppendByte(pTkip, 0); + RTMPTkipAppendByte(pTkip, 0); + RTMPTkipAppendByte(pTkip, 0); + RTMPTkipAppendByte(pTkip, 0); // and then zeroes until the length is a multiple of 4 - while( pTkip->nBytesInM != 0 ) - { - RTMPTkipAppendByte(pTkip, 0 ); + while (pTkip->nBytesInM != 0) { + RTMPTkipAppendByte(pTkip, 0); } // The appendByte function has already computed the result. RTMPTkipPutUInt32(pTkip->MIC, pTkip->L); @@ -377,27 +355,24 @@ VOID RTMPTkipGetMIC( ======================================================================== */ -VOID RTMPInitTkipEngine( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKey, - IN UCHAR KeyId, - IN PUCHAR pTA, - IN PUCHAR pMICKey, - IN PUCHAR pTSC, - OUT PULONG pIV16, - OUT PULONG pIV32) +VOID RTMPInitTkipEngine(IN PRTMP_ADAPTER pAd, + IN PUCHAR pKey, + IN UCHAR KeyId, + IN PUCHAR pTA, + IN PUCHAR pMICKey, + IN PUCHAR pTSC, OUT PULONG pIV16, OUT PULONG pIV32) { - TKIP_IV tkipIv; + TKIP_IV tkipIv; // Prepare 8 bytes TKIP encapsulation for MPDU NdisZeroMemory(&tkipIv, sizeof(TKIP_IV)); tkipIv.IV16.field.rc0 = *(pTSC + 1); tkipIv.IV16.field.rc1 = (tkipIv.IV16.field.rc0 | 0x20) & 0x7f; tkipIv.IV16.field.rc2 = *pTSC; - tkipIv.IV16.field.CONTROL.field.ExtIV = 1; // 0: non-extended IV, 1: an extended IV + tkipIv.IV16.field.CONTROL.field.ExtIV = 1; // 0: non-extended IV, 1: an extended IV tkipIv.IV16.field.CONTROL.field.KeyID = KeyId; -// tkipIv.IV32 = *(PULONG)(pTSC + 2); - NdisMoveMemory(&tkipIv.IV32, (pTSC + 2), 4); // Copy IV +// tkipIv.IV32 = *(PULONG)(pTSC + 2); + NdisMoveMemory(&tkipIv.IV32, (pTSC + 2), 4); // Copy IV *pIV16 = tkipIv.IV16.word; *pIV32 = tkipIv.IV32; @@ -424,13 +399,10 @@ VOID RTMPInitTkipEngine( ======================================================================== */ -VOID RTMPInitMICEngine( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKey, - IN PUCHAR pDA, - IN PUCHAR pSA, - IN UCHAR UserPriority, - IN PUCHAR pMICKey) +VOID RTMPInitMICEngine(IN PRTMP_ADAPTER pAd, + IN PUCHAR pKey, + IN PUCHAR pDA, + IN PUCHAR pSA, IN UCHAR UserPriority, IN PUCHAR pMICKey) { ULONG Priority = UserPriority; @@ -441,7 +413,7 @@ VOID RTMPInitMICEngine( // SA RTMPTkipAppend(&pAd->PrivateInfo.Tx, pSA, MAC_ADDR_LEN); // Priority + 3 bytes of 0 - RTMPTkipAppend(&pAd->PrivateInfo.Tx, (PUCHAR)&Priority, 4); + RTMPTkipAppend(&pAd->PrivateInfo.Tx, (PUCHAR) & Priority, 4); } /* @@ -468,17 +440,15 @@ VOID RTMPInitMICEngine( ======================================================================== */ -BOOLEAN RTMPTkipCompareMICValue( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pSrc, - IN PUCHAR pDA, - IN PUCHAR pSA, - IN PUCHAR pMICKey, - IN UCHAR UserPriority, - IN UINT Len) +BOOLEAN RTMPTkipCompareMICValue(IN PRTMP_ADAPTER pAd, + IN PUCHAR pSrc, + IN PUCHAR pDA, + IN PUCHAR pSA, + IN PUCHAR pMICKey, + IN UCHAR UserPriority, IN UINT Len) { - UCHAR OldMic[8]; - ULONG Priority = UserPriority; + UCHAR OldMic[8]; + ULONG Priority = UserPriority; // Init MIC value calculation RTMPTkipSetMICKey(&pAd->PrivateInfo.Rx, pMICKey); @@ -487,7 +457,7 @@ BOOLEAN RTMPTkipCompareMICValue( // SA RTMPTkipAppend(&pAd->PrivateInfo.Rx, pSA, MAC_ADDR_LEN); // Priority + 3 bytes of 0 - RTMPTkipAppend(&pAd->PrivateInfo.Rx, (PUCHAR)&Priority, 4); + RTMPTkipAppend(&pAd->PrivateInfo.Rx, (PUCHAR) & Priority, 4); // Calculate MIC value from plain text data RTMPTkipAppend(&pAd->PrivateInfo.Rx, pSrc, Len); @@ -500,10 +470,8 @@ BOOLEAN RTMPTkipCompareMICValue( // Move MIC value from MSDU, this steps should move to data path. // Since the MIC value might cross MPDUs. - if(!NdisEqualMemory(pAd->PrivateInfo.Rx.MIC, OldMic, 8)) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("RTMPTkipCompareMICValue(): TKIP MIC Error !\n")); //MIC error. - + if (!NdisEqualMemory(pAd->PrivateInfo.Rx.MIC, OldMic, 8)) { + DBGPRINT_RAW(RT_DEBUG_ERROR, ("RTMPTkipCompareMICValue(): TKIP MIC Error !\n")); //MIC error. return (FALSE); } @@ -532,19 +500,17 @@ BOOLEAN RTMPTkipCompareMICValue( ======================================================================== */ -VOID RTMPCalculateMICValue( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN PUCHAR pEncap, - IN PCIPHER_KEY pKey, - IN UCHAR apidx) +VOID RTMPCalculateMICValue(IN PRTMP_ADAPTER pAd, + IN PNDIS_PACKET pPacket, + IN PUCHAR pEncap, + IN PCIPHER_KEY pKey, IN UCHAR apidx) { - PACKET_INFO PacketInfo; - PUCHAR pSrcBufVA; - UINT SrcBufLen; - PUCHAR pSrc; - UCHAR UserPriority; - UCHAR vlan_offset = 0; + PACKET_INFO PacketInfo; + PUCHAR pSrcBufVA; + UINT SrcBufLen; + PUCHAR pSrc; + UCHAR UserPriority; + UCHAR vlan_offset = 0; RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); @@ -556,41 +522,33 @@ VOID RTMPCalculateMICValue( vlan_offset = 4; { - RTMPInitMICEngine( - pAd, - pKey->Key, - pSrc, - pSrc + 6, - UserPriority, - pKey->TxMic); + RTMPInitMICEngine(pAd, + pKey->Key, + pSrc, pSrc + 6, UserPriority, pKey->TxMic); } - - if (pEncap != NULL) - { + if (pEncap != NULL) { // LLC encapsulation RTMPTkipAppend(&pAd->PrivateInfo.Tx, pEncap, 6); // Protocol Type - RTMPTkipAppend(&pAd->PrivateInfo.Tx, pSrc + 12 + vlan_offset, 2); + RTMPTkipAppend(&pAd->PrivateInfo.Tx, pSrc + 12 + vlan_offset, + 2); } SrcBufLen -= (14 + vlan_offset); pSrc += (14 + vlan_offset); - do - { - if (SrcBufLen > 0) - { + do { + if (SrcBufLen > 0) { RTMPTkipAppend(&pAd->PrivateInfo.Tx, pSrc, SrcBufLen); } - break; // No need handle next packet + break; // No need handle next packet - } while (TRUE); // End of copying payload + } while (TRUE); // End of copying payload // Compute the final MIC Value RTMPTkipGetMIC(&pAd->PrivateInfo.Tx); } - /************************************************************/ /* tkip_sbox() */ /* Returns a 16 bit value from a 64K entry table. The Table */ @@ -607,7 +565,8 @@ UINT tkip_sbox(UINT index) index_high = ((index >> 8) % 256); left = Tkip_Sbox_Lower[index_low] + (Tkip_Sbox_Upper[index_low] * 256); - right = Tkip_Sbox_Upper[index_high] + (Tkip_Sbox_Lower[index_high] * 256); + right = + Tkip_Sbox_Upper[index_high] + (Tkip_Sbox_Lower[index_high] * 256); return (left ^ right); } @@ -616,25 +575,18 @@ UINT rotr1(UINT a) { unsigned int b; - if ((a & 0x01) == 0x01) - { + if ((a & 0x01) == 0x01) { b = (a >> 1) | 0x8000; - } - else - { + } else { b = (a >> 1) & 0x7fff; } b = b % 65536; return b; } -VOID RTMPTkipMixKey( - UCHAR *key, - UCHAR *ta, - ULONG pnl, /* Least significant 16 bits of PN */ - ULONG pnh, /* Most significant 32 bits of PN */ - UCHAR *rc4key, - UINT *p1k) +VOID RTMPTkipMixKey(UCHAR * key, UCHAR * ta, ULONG pnl, /* Least significant 16 bits of PN */ + ULONG pnh, /* Most significant 32 bits of PN */ + UCHAR * rc4key, UINT * p1k) { UINT tsc0; @@ -651,26 +603,40 @@ VOID RTMPTkipMixKey( INT i; INT j; - tsc0 = (unsigned int)((pnh >> 16) % 65536); /* msb */ + tsc0 = (unsigned int)((pnh >> 16) % 65536); /* msb */ tsc1 = (unsigned int)(pnh % 65536); - tsc2 = (unsigned int)(pnl % 65536); /* lsb */ + tsc2 = (unsigned int)(pnl % 65536); /* lsb */ /* Phase 1, step 1 */ p1k[0] = tsc1; p1k[1] = tsc0; - p1k[2] = (UINT)(ta[0] + (ta[1]*256)); - p1k[3] = (UINT)(ta[2] + (ta[3]*256)); - p1k[4] = (UINT)(ta[4] + (ta[5]*256)); + p1k[2] = (UINT) (ta[0] + (ta[1] * 256)); + p1k[3] = (UINT) (ta[2] + (ta[3] * 256)); + p1k[4] = (UINT) (ta[4] + (ta[5] * 256)); /* Phase 1, step 2 */ - for (i=0; i<8; i++) - { - j = 2*(i & 1); - p1k[0] = (p1k[0] + tkip_sbox( (p1k[4] ^ ((256*key[1+j]) + key[j])) % 65536 )) % 65536; - p1k[1] = (p1k[1] + tkip_sbox( (p1k[0] ^ ((256*key[5+j]) + key[4+j])) % 65536 )) % 65536; - p1k[2] = (p1k[2] + tkip_sbox( (p1k[1] ^ ((256*key[9+j]) + key[8+j])) % 65536 )) % 65536; - p1k[3] = (p1k[3] + tkip_sbox( (p1k[2] ^ ((256*key[13+j]) + key[12+j])) % 65536 )) % 65536; - p1k[4] = (p1k[4] + tkip_sbox( (p1k[3] ^ (((256*key[1+j]) + key[j]))) % 65536 )) % 65536; + for (i = 0; i < 8; i++) { + j = 2 * (i & 1); + p1k[0] = + (p1k[0] + + tkip_sbox((p1k[4] ^ ((256 * key[1 + j]) + key[j])) % + 65536)) % 65536; + p1k[1] = + (p1k[1] + + tkip_sbox((p1k[0] ^ ((256 * key[5 + j]) + key[4 + j])) % + 65536)) % 65536; + p1k[2] = + (p1k[2] + + tkip_sbox((p1k[1] ^ ((256 * key[9 + j]) + key[8 + j])) % + 65536)) % 65536; + p1k[3] = + (p1k[3] + + tkip_sbox((p1k[2] ^ ((256 * key[13 + j]) + key[12 + j])) % + 65536)) % 65536; + p1k[4] = + (p1k[4] + + tkip_sbox((p1k[3] ^ (((256 * key[1 + j]) + key[j]))) % + 65536)) % 65536; p1k[4] = (p1k[4] + i) % 65536; } @@ -683,31 +649,31 @@ VOID RTMPTkipMixKey( ppk5 = (p1k[4] + tsc2) % 65536; /* Phase2, Step 2 */ - ppk0 = ppk0 + tkip_sbox( (ppk5 ^ ((256*key[1]) + key[0])) % 65536); - ppk1 = ppk1 + tkip_sbox( (ppk0 ^ ((256*key[3]) + key[2])) % 65536); - ppk2 = ppk2 + tkip_sbox( (ppk1 ^ ((256*key[5]) + key[4])) % 65536); - ppk3 = ppk3 + tkip_sbox( (ppk2 ^ ((256*key[7]) + key[6])) % 65536); - ppk4 = ppk4 + tkip_sbox( (ppk3 ^ ((256*key[9]) + key[8])) % 65536); - ppk5 = ppk5 + tkip_sbox( (ppk4 ^ ((256*key[11]) + key[10])) % 65536); - - ppk0 = ppk0 + rotr1(ppk5 ^ ((256*key[13]) + key[12])); - ppk1 = ppk1 + rotr1(ppk0 ^ ((256*key[15]) + key[14])); + ppk0 = ppk0 + tkip_sbox((ppk5 ^ ((256 * key[1]) + key[0])) % 65536); + ppk1 = ppk1 + tkip_sbox((ppk0 ^ ((256 * key[3]) + key[2])) % 65536); + ppk2 = ppk2 + tkip_sbox((ppk1 ^ ((256 * key[5]) + key[4])) % 65536); + ppk3 = ppk3 + tkip_sbox((ppk2 ^ ((256 * key[7]) + key[6])) % 65536); + ppk4 = ppk4 + tkip_sbox((ppk3 ^ ((256 * key[9]) + key[8])) % 65536); + ppk5 = ppk5 + tkip_sbox((ppk4 ^ ((256 * key[11]) + key[10])) % 65536); + + ppk0 = ppk0 + rotr1(ppk5 ^ ((256 * key[13]) + key[12])); + ppk1 = ppk1 + rotr1(ppk0 ^ ((256 * key[15]) + key[14])); ppk2 = ppk2 + rotr1(ppk1); ppk3 = ppk3 + rotr1(ppk2); ppk4 = ppk4 + rotr1(ppk3); ppk5 = ppk5 + rotr1(ppk4); /* Phase 2, Step 3 */ - /* Phase 2, Step 3 */ + /* Phase 2, Step 3 */ - tsc0 = (unsigned int)((pnh >> 16) % 65536); /* msb */ + tsc0 = (unsigned int)((pnh >> 16) % 65536); /* msb */ tsc1 = (unsigned int)(pnh % 65536); - tsc2 = (unsigned int)(pnl % 65536); /* lsb */ + tsc2 = (unsigned int)(pnl % 65536); /* lsb */ rc4key[0] = (tsc2 >> 8) % 256; rc4key[1] = (((tsc2 >> 8) % 256) | 0x20) & 0x7f; rc4key[2] = tsc2 % 256; - rc4key[3] = ((ppk5 ^ ((256*key[1]) + key[0])) >> 1) % 256; + rc4key[3] = ((ppk5 ^ ((256 * key[1]) + key[0])) >> 1) % 256; rc4key[4] = ppk0 % 256; rc4key[5] = (ppk0 >> 8) % 256; @@ -728,155 +694,140 @@ VOID RTMPTkipMixKey( rc4key[15] = (ppk5 >> 8) % 256; } - // // TRUE: Success! // FALSE: Decrypt Error! // -BOOLEAN RTMPSoftDecryptTKIP( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, - IN UCHAR UserPriority, - IN PCIPHER_KEY pWpaKey) +BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd, + IN PUCHAR pData, + IN ULONG DataByteCnt, + IN UCHAR UserPriority, IN PCIPHER_KEY pWpaKey) { - UCHAR KeyID; - UINT HeaderLen; - UCHAR fc0; - UCHAR fc1; - USHORT fc; - UINT frame_type; - UINT frame_subtype; - UINT from_ds; - UINT to_ds; - INT a4_exists; - INT qc_exists; - USHORT duration; - USHORT seq_control; - USHORT qos_control; - UCHAR TA[MAC_ADDR_LEN]; - UCHAR DA[MAC_ADDR_LEN]; - UCHAR SA[MAC_ADDR_LEN]; - UCHAR RC4Key[16]; - UINT p1k[5]; //for mix_key; - ULONG pnl;/* Least significant 16 bits of PN */ - ULONG pnh;/* Most significant 32 bits of PN */ - UINT num_blocks; - UINT payload_remainder; - ARCFOURCONTEXT ArcFourContext; - UINT crc32 = 0; - UINT trailfcs = 0; - UCHAR MIC[8]; - UCHAR TrailMIC[8]; - + UCHAR KeyID; + UINT HeaderLen; + UCHAR fc0; + UCHAR fc1; + USHORT fc; + UINT frame_type; + UINT frame_subtype; + UINT from_ds; + UINT to_ds; + INT a4_exists; + INT qc_exists; + USHORT duration; + USHORT seq_control; + USHORT qos_control; + UCHAR TA[MAC_ADDR_LEN]; + UCHAR DA[MAC_ADDR_LEN]; + UCHAR SA[MAC_ADDR_LEN]; + UCHAR RC4Key[16]; + UINT p1k[5]; //for mix_key; + ULONG pnl; /* Least significant 16 bits of PN */ + ULONG pnh; /* Most significant 32 bits of PN */ + UINT num_blocks; + UINT payload_remainder; + ARCFOURCONTEXT ArcFourContext; + UINT crc32 = 0; + UINT trailfcs = 0; + UCHAR MIC[8]; + UCHAR TrailMIC[8]; fc0 = *pData; fc1 = *(pData + 1); - fc = *((PUSHORT)pData); + fc = *((PUSHORT) pData); frame_type = ((fc0 >> 2) & 0x03); frame_subtype = ((fc0 >> 4) & 0x0f); - from_ds = (fc1 & 0x2) >> 1; - to_ds = (fc1 & 0x1); + from_ds = (fc1 & 0x2) >> 1; + to_ds = (fc1 & 0x1); - a4_exists = (from_ds & to_ds); - qc_exists = ((frame_subtype == 0x08) || /* Assumed QoS subtypes */ - (frame_subtype == 0x09) || /* Likely to change. */ - (frame_subtype == 0x0a) || - (frame_subtype == 0x0b) - ); + a4_exists = (from_ds & to_ds); + qc_exists = ((frame_subtype == 0x08) || /* Assumed QoS subtypes */ + (frame_subtype == 0x09) || /* Likely to change. */ + (frame_subtype == 0x0a) || (frame_subtype == 0x0b) + ); HeaderLen = 24; if (a4_exists) HeaderLen += 6; - KeyID = *((PUCHAR)(pData+ HeaderLen + 3)); + KeyID = *((PUCHAR) (pData + HeaderLen + 3)); KeyID = KeyID >> 6; - if (pWpaKey[KeyID].KeyLen == 0) - { - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSoftDecryptTKIP failed!(KeyID[%d] Length can not be 0)\n", KeyID)); + if (pWpaKey[KeyID].KeyLen == 0) { + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPSoftDecryptTKIP failed!(KeyID[%d] Length can not be 0)\n", + KeyID)); return FALSE; } - duration = *((PUSHORT)(pData+2)); + duration = *((PUSHORT) (pData + 2)); - seq_control = *((PUSHORT)(pData+22)); + seq_control = *((PUSHORT) (pData + 22)); - if (qc_exists) - { - if (a4_exists) - { - qos_control = *((PUSHORT)(pData+30)); - } - else - { - qos_control = *((PUSHORT)(pData+24)); + if (qc_exists) { + if (a4_exists) { + qos_control = *((PUSHORT) (pData + 30)); + } else { + qos_control = *((PUSHORT) (pData + 24)); } } - if (to_ds == 0 && from_ds == 1) - { - NdisMoveMemory(DA, pData+4, MAC_ADDR_LEN); - NdisMoveMemory(SA, pData+16, MAC_ADDR_LEN); - NdisMoveMemory(TA, pData+10, MAC_ADDR_LEN); //BSSID - } - else if (to_ds == 0 && from_ds == 0 ) - { - NdisMoveMemory(TA, pData+10, MAC_ADDR_LEN); - NdisMoveMemory(DA, pData+4, MAC_ADDR_LEN); - NdisMoveMemory(SA, pData+10, MAC_ADDR_LEN); - } - else if (to_ds == 1 && from_ds == 0) - { - NdisMoveMemory(SA, pData+10, MAC_ADDR_LEN); - NdisMoveMemory(TA, pData+10, MAC_ADDR_LEN); - NdisMoveMemory(DA, pData+16, MAC_ADDR_LEN); - } - else if (to_ds == 1 && from_ds == 1) - { - NdisMoveMemory(TA, pData+10, MAC_ADDR_LEN); - NdisMoveMemory(DA, pData+16, MAC_ADDR_LEN); - NdisMoveMemory(SA, pData+22, MAC_ADDR_LEN); + if (to_ds == 0 && from_ds == 1) { + NdisMoveMemory(DA, pData + 4, MAC_ADDR_LEN); + NdisMoveMemory(SA, pData + 16, MAC_ADDR_LEN); + NdisMoveMemory(TA, pData + 10, MAC_ADDR_LEN); //BSSID + } else if (to_ds == 0 && from_ds == 0) { + NdisMoveMemory(TA, pData + 10, MAC_ADDR_LEN); + NdisMoveMemory(DA, pData + 4, MAC_ADDR_LEN); + NdisMoveMemory(SA, pData + 10, MAC_ADDR_LEN); + } else if (to_ds == 1 && from_ds == 0) { + NdisMoveMemory(SA, pData + 10, MAC_ADDR_LEN); + NdisMoveMemory(TA, pData + 10, MAC_ADDR_LEN); + NdisMoveMemory(DA, pData + 16, MAC_ADDR_LEN); + } else if (to_ds == 1 && from_ds == 1) { + NdisMoveMemory(TA, pData + 10, MAC_ADDR_LEN); + NdisMoveMemory(DA, pData + 16, MAC_ADDR_LEN); + NdisMoveMemory(SA, pData + 22, MAC_ADDR_LEN); } num_blocks = (DataByteCnt - 16) / 16; payload_remainder = (DataByteCnt - 16) % 16; pnl = (*(pData + HeaderLen)) * 256 + *(pData + HeaderLen + 2); - pnh = *((PULONG)(pData + HeaderLen + 4)); + pnh = *((PULONG) (pData + HeaderLen + 4)); pnh = cpu2le32(pnh); RTMPTkipMixKey(pWpaKey[KeyID].Key, TA, pnl, pnh, RC4Key, p1k); ARCFOUR_INIT(&ArcFourContext, RC4Key, 16); - ARCFOUR_DECRYPT(&ArcFourContext, pData + HeaderLen, pData + HeaderLen + 8, DataByteCnt - HeaderLen - 8); + ARCFOUR_DECRYPT(&ArcFourContext, pData + HeaderLen, + pData + HeaderLen + 8, DataByteCnt - HeaderLen - 8); NdisMoveMemory(&trailfcs, pData + DataByteCnt - 8 - 4, 4); - crc32 = RTMP_CALC_FCS32(PPPINITFCS32, pData + HeaderLen, DataByteCnt - HeaderLen - 8 - 4); //Skip IV+EIV 8 bytes & Skip last 4 bytes(FCS). - crc32 ^= 0xffffffff; /* complement */ + crc32 = RTMP_CALC_FCS32(PPPINITFCS32, pData + HeaderLen, DataByteCnt - HeaderLen - 8 - 4); //Skip IV+EIV 8 bytes & Skip last 4 bytes(FCS). + crc32 ^= 0xffffffff; /* complement */ - if(crc32 != cpu2le32(trailfcs)) - { - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSoftDecryptTKIP, WEP Data ICV Error !\n")); //ICV error. + if (crc32 != cpu2le32(trailfcs)) { + DBGPRINT(RT_DEBUG_TRACE, ("RTMPSoftDecryptTKIP, WEP Data ICV Error !\n")); //ICV error. return (FALSE); } NdisMoveMemory(TrailMIC, pData + DataByteCnt - 8 - 8 - 4, 8); - RTMPInitMICEngine(pAd, pWpaKey[KeyID].Key, DA, SA, UserPriority, pWpaKey[KeyID].RxMic); - RTMPTkipAppend(&pAd->PrivateInfo.Tx, pData + HeaderLen, DataByteCnt - HeaderLen - 8 - 12); + RTMPInitMICEngine(pAd, pWpaKey[KeyID].Key, DA, SA, UserPriority, + pWpaKey[KeyID].RxMic); + RTMPTkipAppend(&pAd->PrivateInfo.Tx, pData + HeaderLen, + DataByteCnt - HeaderLen - 8 - 12); RTMPTkipGetMIC(&pAd->PrivateInfo.Tx); NdisMoveMemory(MIC, pAd->PrivateInfo.Tx.MIC, 8); - if (!NdisEqualMemory(MIC, TrailMIC, 8)) - { - DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptTKIP, WEP Data MIC Error !\n")); //MIC error. - //RTMPReportMicError(pAd, &pWpaKey[KeyID]); // marked by AlbertY @ 20060630 + if (!NdisEqualMemory(MIC, TrailMIC, 8)) { + DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptTKIP, WEP Data MIC Error !\n")); //MIC error. + //RTMPReportMicError(pAd, &pWpaKey[KeyID]); // marked by AlbertY @ 20060630 return (FALSE); } - //DBGPRINT(RT_DEBUG_TRACE, "RTMPSoftDecryptTKIP Decript done!!\n"); return TRUE; } diff --git a/drivers/staging/rt2860/common/cmm_wep.c b/drivers/staging/rt2860/common/cmm_wep.c index b13858d0a74a..4f407e94d736 100644 --- a/drivers/staging/rt2860/common/cmm_wep.c +++ b/drivers/staging/rt2860/common/cmm_wep.c @@ -37,8 +37,7 @@ #include "../rt_config.h" -UINT FCSTAB_32[256] = -{ +UINT FCSTAB_32[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, @@ -136,33 +135,31 @@ UCHAR WEPKEY[] = { ======================================================================== */ -VOID RTMPInitWepEngine( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKey, - IN UCHAR KeyId, - IN UCHAR KeyLen, - IN OUT PUCHAR pDest) +VOID RTMPInitWepEngine(IN PRTMP_ADAPTER pAd, + IN PUCHAR pKey, + IN UCHAR KeyId, IN UCHAR KeyLen, IN OUT PUCHAR pDest) { UINT i; - UCHAR WEPKEY[] = { + UCHAR WEPKEY[] = { //IV 0x00, 0x11, 0x22, //WEP KEY - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, + 0xAA, 0xBB, 0xCC }; - pAd->PrivateInfo.FCSCRC32 = PPPINITFCS32; //Init crc32. + pAd->PrivateInfo.FCSCRC32 = PPPINITFCS32; //Init crc32. - { + { NdisMoveMemory(WEPKEY + 3, pKey, KeyLen); - for(i = 0; i < 3; i++) - WEPKEY[i] = RandomByte(pAd); //Call mlme RandomByte() function. - ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, WEPKEY, KeyLen + 3); //INIT SBOX, KEYLEN+3(IV) + for (i = 0; i < 3; i++) + WEPKEY[i] = RandomByte(pAd); //Call mlme RandomByte() function. + ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, WEPKEY, KeyLen + 3); //INIT SBOX, KEYLEN+3(IV) - NdisMoveMemory(pDest, WEPKEY, 3); //Append Init Vector - } - *(pDest+3) = (KeyId << 6); //Append KEYID + NdisMoveMemory(pDest, WEPKEY, 3); //Append Init Vector + } + *(pDest + 3) = (KeyId << 6); //Append KEYID } @@ -187,17 +184,14 @@ VOID RTMPInitWepEngine( ======================================================================== */ -VOID RTMPEncryptData( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pSrc, - IN PUCHAR pDest, - IN UINT Len) +VOID RTMPEncryptData(IN PRTMP_ADAPTER pAd, + IN PUCHAR pSrc, IN PUCHAR pDest, IN UINT Len) { - pAd->PrivateInfo.FCSCRC32 = RTMP_CALC_FCS32(pAd->PrivateInfo.FCSCRC32, pSrc, Len); + pAd->PrivateInfo.FCSCRC32 = + RTMP_CALC_FCS32(pAd->PrivateInfo.FCSCRC32, pSrc, Len); ARCFOUR_ENCRYPT(&pAd->PrivateInfo.WEPCONTEXT, pDest, pSrc, Len); } - /* ======================================================================== @@ -217,40 +211,41 @@ VOID RTMPEncryptData( ======================================================================== */ -BOOLEAN RTMPSoftDecryptWEP( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, - IN PCIPHER_KEY pGroupKey) +BOOLEAN RTMPSoftDecryptWEP(IN PRTMP_ADAPTER pAd, + IN PUCHAR pData, + IN ULONG DataByteCnt, IN PCIPHER_KEY pGroupKey) { - UINT trailfcs; - UINT crc32; - UCHAR KeyIdx; - UCHAR WEPKEY[] = { + UINT trailfcs; + UINT crc32; + UCHAR KeyIdx; + UCHAR WEPKEY[] = { //IV 0x00, 0x11, 0x22, //WEP KEY - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, + 0xAA, 0xBB, 0xCC }; - UCHAR *pPayload = (UCHAR *)pData + LENGTH_802_11; - ULONG payload_len = DataByteCnt - LENGTH_802_11; + UCHAR *pPayload = (UCHAR *) pData + LENGTH_802_11; + ULONG payload_len = DataByteCnt - LENGTH_802_11; - NdisMoveMemory(WEPKEY, pPayload, 3); //Get WEP IV + NdisMoveMemory(WEPKEY, pPayload, 3); //Get WEP IV KeyIdx = (*(pPayload + 3) & 0xc0) >> 6; if (pGroupKey[KeyIdx].KeyLen == 0) return (FALSE); - NdisMoveMemory(WEPKEY + 3, pGroupKey[KeyIdx].Key, pGroupKey[KeyIdx].KeyLen); - ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, WEPKEY, pGroupKey[KeyIdx].KeyLen + 3); - ARCFOUR_DECRYPT(&pAd->PrivateInfo.WEPCONTEXT, pPayload, pPayload + 4, payload_len - 4); + NdisMoveMemory(WEPKEY + 3, pGroupKey[KeyIdx].Key, + pGroupKey[KeyIdx].KeyLen); + ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, WEPKEY, + pGroupKey[KeyIdx].KeyLen + 3); + ARCFOUR_DECRYPT(&pAd->PrivateInfo.WEPCONTEXT, pPayload, pPayload + 4, + payload_len - 4); NdisMoveMemory(&trailfcs, pPayload + payload_len - 8, 4); - crc32 = RTMP_CALC_FCS32(PPPINITFCS32, pPayload, payload_len - 8); //Skip last 4 bytes(FCS). - crc32 ^= 0xffffffff; /* complement */ + crc32 = RTMP_CALC_FCS32(PPPINITFCS32, pPayload, payload_len - 8); //Skip last 4 bytes(FCS). + crc32 ^= 0xffffffff; /* complement */ - if(crc32 != cpu2le32(trailfcs)) - { - DBGPRINT(RT_DEBUG_TRACE, ("! WEP Data CRC Error !\n")); //CRC error. + if (crc32 != cpu2le32(trailfcs)) { + DBGPRINT(RT_DEBUG_TRACE, ("! WEP Data CRC Error !\n")); //CRC error. return (FALSE); } return (TRUE); @@ -276,26 +271,22 @@ BOOLEAN RTMPSoftDecryptWEP( ======================================================================== */ -VOID ARCFOUR_INIT( - IN PARCFOURCONTEXT Ctx, - IN PUCHAR pKey, - IN UINT KeyLen) +VOID ARCFOUR_INIT(IN PARCFOURCONTEXT Ctx, IN PUCHAR pKey, IN UINT KeyLen) { - UCHAR t, u; - UINT keyindex; - UINT stateindex; - PUCHAR state; - UINT counter; + UCHAR t, u; + UINT keyindex; + UINT stateindex; + PUCHAR state; + UINT counter; state = Ctx->STATE; Ctx->X = 0; Ctx->Y = 0; for (counter = 0; counter < 256; counter++) - state[counter] = (UCHAR)counter; + state[counter] = (UCHAR) counter; keyindex = 0; stateindex = 0; - for (counter = 0; counter < 256; counter++) - { + for (counter = 0; counter < 256; counter++) { t = state[counter]; stateindex = (stateindex + pKey[keyindex] + t) & 0xff; u = state[stateindex]; @@ -322,25 +313,24 @@ VOID ARCFOUR_INIT( ======================================================================== */ -UCHAR ARCFOUR_BYTE( - IN PARCFOURCONTEXT Ctx) +UCHAR ARCFOUR_BYTE(IN PARCFOURCONTEXT Ctx) { - UINT x; - UINT y; - UCHAR sx, sy; - PUCHAR state; - - state = Ctx->STATE; - x = (Ctx->X + 1) & 0xff; - sx = state[x]; - y = (sx + Ctx->Y) & 0xff; - sy = state[y]; - Ctx->X = x; - Ctx->Y = y; - state[y] = sx; - state[x] = sy; - - return(state[(sx + sy) & 0xff]); + UINT x; + UINT y; + UCHAR sx, sy; + PUCHAR state; + + state = Ctx->STATE; + x = (Ctx->X + 1) & 0xff; + sx = state[x]; + y = (sx + Ctx->Y) & 0xff; + sy = state[y]; + Ctx->X = x; + Ctx->Y = y; + state[y] = sx; + state[x] = sy; + + return (state[(sx + sy) & 0xff]); } @@ -363,11 +353,8 @@ UCHAR ARCFOUR_BYTE( ======================================================================== */ -VOID ARCFOUR_DECRYPT( - IN PARCFOURCONTEXT Ctx, - IN PUCHAR pDest, - IN PUCHAR pSrc, - IN UINT Len) +VOID ARCFOUR_DECRYPT(IN PARCFOURCONTEXT Ctx, + IN PUCHAR pDest, IN PUCHAR pSrc, IN UINT Len) { UINT i; @@ -396,11 +383,8 @@ VOID ARCFOUR_DECRYPT( ======================================================================== */ -VOID ARCFOUR_ENCRYPT( - IN PARCFOURCONTEXT Ctx, - IN PUCHAR pDest, - IN PUCHAR pSrc, - IN UINT Len) +VOID ARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, + IN PUCHAR pDest, IN PUCHAR pSrc, IN UINT Len) { UINT i; @@ -420,26 +404,21 @@ VOID ARCFOUR_ENCRYPT( pSrc Pointer to the Source data Len Indicate the length of the Source dta - ======================================================================== */ -VOID WPAARCFOUR_ENCRYPT( - IN PARCFOURCONTEXT Ctx, - IN PUCHAR pDest, - IN PUCHAR pSrc, - IN UINT Len) +VOID WPAARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, + IN PUCHAR pDest, IN PUCHAR pSrc, IN UINT Len) { UINT i; - //discard first 256 bytes + //discard first 256 bytes for (i = 0; i < 256; i++) - ARCFOUR_BYTE(Ctx); + ARCFOUR_BYTE(Ctx); for (i = 0; i < Len; i++) pDest[i] = pSrc[i] ^ ARCFOUR_BYTE(Ctx); } - /* ======================================================================== @@ -460,18 +439,14 @@ VOID WPAARCFOUR_ENCRYPT( ======================================================================== */ -UINT RTMP_CALC_FCS32( - IN UINT Fcs, - IN PUCHAR Cp, - IN INT Len) +UINT RTMP_CALC_FCS32(IN UINT Fcs, IN PUCHAR Cp, IN INT Len) { while (Len--) - Fcs = (((Fcs) >> 8) ^ FCSTAB_32[((Fcs) ^ (*Cp++)) & 0xff]); + Fcs = (((Fcs) >> 8) ^ FCSTAB_32[((Fcs) ^ (*Cp++)) & 0xff]); return (Fcs); } - /* ======================================================================== @@ -488,12 +463,11 @@ UINT RTMP_CALC_FCS32( ======================================================================== */ -VOID RTMPSetICV( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDest) +VOID RTMPSetICV(IN PRTMP_ADAPTER pAd, IN PUCHAR pDest) { - pAd->PrivateInfo.FCSCRC32 ^= 0xffffffff; /* complement */ + pAd->PrivateInfo.FCSCRC32 ^= 0xffffffff; /* complement */ pAd->PrivateInfo.FCSCRC32 = cpu2le32(pAd->PrivateInfo.FCSCRC32); - ARCFOUR_ENCRYPT(&pAd->PrivateInfo.WEPCONTEXT, pDest, (PUCHAR) &pAd->PrivateInfo.FCSCRC32, 4); + ARCFOUR_ENCRYPT(&pAd->PrivateInfo.WEPCONTEXT, pDest, + (PUCHAR) & pAd->PrivateInfo.FCSCRC32, 4); } diff --git a/drivers/staging/rt2860/common/cmm_wpa.c b/drivers/staging/rt2860/common/cmm_wpa.c index 5af78b841183..4d070af7acfc 100644 --- a/drivers/staging/rt2860/common/cmm_wpa.c +++ b/drivers/staging/rt2860/common/cmm_wpa.c @@ -37,59 +37,47 @@ */ #include "../rt_config.h" // WPA OUI -UCHAR OUI_WPA_NONE_AKM[4] = {0x00, 0x50, 0xF2, 0x00}; -UCHAR OUI_WPA_VERSION[4] = {0x00, 0x50, 0xF2, 0x01}; -UCHAR OUI_WPA_WEP40[4] = {0x00, 0x50, 0xF2, 0x01}; -UCHAR OUI_WPA_TKIP[4] = {0x00, 0x50, 0xF2, 0x02}; -UCHAR OUI_WPA_CCMP[4] = {0x00, 0x50, 0xF2, 0x04}; -UCHAR OUI_WPA_WEP104[4] = {0x00, 0x50, 0xF2, 0x05}; -UCHAR OUI_WPA_8021X_AKM[4] = {0x00, 0x50, 0xF2, 0x01}; -UCHAR OUI_WPA_PSK_AKM[4] = {0x00, 0x50, 0xF2, 0x02}; +UCHAR OUI_WPA_NONE_AKM[4] = { 0x00, 0x50, 0xF2, 0x00 }; +UCHAR OUI_WPA_VERSION[4] = { 0x00, 0x50, 0xF2, 0x01 }; +UCHAR OUI_WPA_WEP40[4] = { 0x00, 0x50, 0xF2, 0x01 }; +UCHAR OUI_WPA_TKIP[4] = { 0x00, 0x50, 0xF2, 0x02 }; +UCHAR OUI_WPA_CCMP[4] = { 0x00, 0x50, 0xF2, 0x04 }; +UCHAR OUI_WPA_WEP104[4] = { 0x00, 0x50, 0xF2, 0x05 }; +UCHAR OUI_WPA_8021X_AKM[4] = { 0x00, 0x50, 0xF2, 0x01 }; +UCHAR OUI_WPA_PSK_AKM[4] = { 0x00, 0x50, 0xF2, 0x02 }; + // WPA2 OUI -UCHAR OUI_WPA2_WEP40[4] = {0x00, 0x0F, 0xAC, 0x01}; -UCHAR OUI_WPA2_TKIP[4] = {0x00, 0x0F, 0xAC, 0x02}; -UCHAR OUI_WPA2_CCMP[4] = {0x00, 0x0F, 0xAC, 0x04}; -UCHAR OUI_WPA2_8021X_AKM[4] = {0x00, 0x0F, 0xAC, 0x01}; -UCHAR OUI_WPA2_PSK_AKM[4] = {0x00, 0x0F, 0xAC, 0x02}; -UCHAR OUI_WPA2_WEP104[4] = {0x00, 0x0F, 0xAC, 0x05}; - - - -static VOID ConstructEapolKeyData( - IN PMAC_TABLE_ENTRY pEntry, - IN UCHAR GroupKeyWepStatus, - IN UCHAR keyDescVer, - IN UCHAR MsgType, - IN UCHAR DefaultKeyIdx, - IN UCHAR *GTK, - IN UCHAR *RSNIE, - IN UCHAR RSNIE_LEN, - OUT PEAPOL_PACKET pMsg); - -static VOID CalculateMIC( - IN UCHAR KeyDescVer, - IN UCHAR *PTK, - OUT PEAPOL_PACKET pMsg); - -static VOID WpaEAPPacketAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -static VOID WpaEAPOLASFAlertAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -static VOID WpaEAPOLLogoffAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -static VOID WpaEAPOLStartAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -static VOID WpaEAPOLKeyAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +UCHAR OUI_WPA2_WEP40[4] = { 0x00, 0x0F, 0xAC, 0x01 }; +UCHAR OUI_WPA2_TKIP[4] = { 0x00, 0x0F, 0xAC, 0x02 }; +UCHAR OUI_WPA2_CCMP[4] = { 0x00, 0x0F, 0xAC, 0x04 }; +UCHAR OUI_WPA2_8021X_AKM[4] = { 0x00, 0x0F, 0xAC, 0x01 }; +UCHAR OUI_WPA2_PSK_AKM[4] = { 0x00, 0x0F, 0xAC, 0x02 }; +UCHAR OUI_WPA2_WEP104[4] = { 0x00, 0x0F, 0xAC, 0x05 }; + +static VOID ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, + IN UCHAR GroupKeyWepStatus, + IN UCHAR keyDescVer, + IN UCHAR MsgType, + IN UCHAR DefaultKeyIdx, + IN UCHAR * GTK, + IN UCHAR * RSNIE, + IN UCHAR RSNIE_LEN, OUT PEAPOL_PACKET pMsg); + +static VOID CalculateMIC(IN UCHAR KeyDescVer, + IN UCHAR * PTK, OUT PEAPOL_PACKET pMsg); + +static VOID WpaEAPPacketAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +static VOID WpaEAPOLASFAlertAction(IN PRTMP_ADAPTER pAd, + IN MLME_QUEUE_ELEM * Elem); + +static VOID WpaEAPOLLogoffAction(IN PRTMP_ADAPTER pAd, + IN MLME_QUEUE_ELEM * Elem); + +static VOID WpaEAPOLStartAction(IN PRTMP_ADAPTER pAd, + IN MLME_QUEUE_ELEM * Elem); + +static VOID WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); /* ========================================================================== @@ -99,18 +87,23 @@ static VOID WpaEAPOLKeyAction( S - pointer to the association state machine ========================================================================== */ -VOID WpaStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - OUT STATE_MACHINE_FUNC Trans[]) +VOID WpaStateMachineInit(IN PRTMP_ADAPTER pAd, + IN STATE_MACHINE * S, OUT STATE_MACHINE_FUNC Trans[]) { - StateMachineInit(S, (STATE_MACHINE_FUNC *)Trans, MAX_WPA_PTK_STATE, MAX_WPA_MSG, (STATE_MACHINE_FUNC)Drop, WPA_PTK, WPA_MACHINE_BASE); - - StateMachineSetAction(S, WPA_PTK, MT2_EAPPacket, (STATE_MACHINE_FUNC)WpaEAPPacketAction); - StateMachineSetAction(S, WPA_PTK, MT2_EAPOLStart, (STATE_MACHINE_FUNC)WpaEAPOLStartAction); - StateMachineSetAction(S, WPA_PTK, MT2_EAPOLLogoff, (STATE_MACHINE_FUNC)WpaEAPOLLogoffAction); - StateMachineSetAction(S, WPA_PTK, MT2_EAPOLKey, (STATE_MACHINE_FUNC)WpaEAPOLKeyAction); - StateMachineSetAction(S, WPA_PTK, MT2_EAPOLASFAlert, (STATE_MACHINE_FUNC)WpaEAPOLASFAlertAction); + StateMachineInit(S, (STATE_MACHINE_FUNC *) Trans, MAX_WPA_PTK_STATE, + MAX_WPA_MSG, (STATE_MACHINE_FUNC) Drop, WPA_PTK, + WPA_MACHINE_BASE); + + StateMachineSetAction(S, WPA_PTK, MT2_EAPPacket, + (STATE_MACHINE_FUNC) WpaEAPPacketAction); + StateMachineSetAction(S, WPA_PTK, MT2_EAPOLStart, + (STATE_MACHINE_FUNC) WpaEAPOLStartAction); + StateMachineSetAction(S, WPA_PTK, MT2_EAPOLLogoff, + (STATE_MACHINE_FUNC) WpaEAPOLLogoffAction); + StateMachineSetAction(S, WPA_PTK, MT2_EAPOLKey, + (STATE_MACHINE_FUNC) WpaEAPOLKeyAction); + StateMachineSetAction(S, WPA_PTK, MT2_EAPOLASFAlert, + (STATE_MACHINE_FUNC) WpaEAPOLASFAlertAction); } /* @@ -122,21 +115,15 @@ VOID WpaStateMachineInit( Return: ========================================================================== */ -VOID WpaEAPPacketAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID WpaEAPPacketAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { } -VOID WpaEAPOLASFAlertAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID WpaEAPOLASFAlertAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { } -VOID WpaEAPOLLogoffAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID WpaEAPOLLogoffAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { } @@ -147,42 +134,44 @@ VOID WpaEAPOLLogoffAction( Return: ========================================================================== */ -VOID WpaEAPOLStartAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID WpaEAPOLStartAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - MAC_TABLE_ENTRY *pEntry; - PHEADER_802_11 pHeader; - - DBGPRINT(RT_DEBUG_TRACE, ("WpaEAPOLStartAction ===> \n")); - - pHeader = (PHEADER_802_11)Elem->Msg; - - //For normaol PSK, we enqueue an EAPOL-Start command to trigger the process. - if (Elem->MsgLen == 6) - pEntry = MacTableLookup(pAd, Elem->Msg); - else - { - pEntry = MacTableLookup(pAd, pHeader->Addr2); - } - - if (pEntry) - { - DBGPRINT(RT_DEBUG_TRACE, (" PortSecured(%d), WpaState(%d), AuthMode(%d), PMKID_CacheIdx(%d) \n", pEntry->PortSecured, pEntry->WpaState, pEntry->AuthMode, pEntry->PMKID_CacheIdx)); - - if ((pEntry->PortSecured == WPA_802_1X_PORT_NOT_SECURED) - && (pEntry->WpaState < AS_PTKSTART) - && ((pEntry->AuthMode == Ndis802_11AuthModeWPAPSK) || (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK) || ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) && (pEntry->PMKID_CacheIdx != ENTRY_NOT_FOUND)))) - { - pEntry->PrivacyFilter = Ndis802_11PrivFilter8021xWEP; - pEntry->WpaState = AS_INITPSK; - pEntry->PortSecured = WPA_802_1X_PORT_NOT_SECURED; - NdisZeroMemory(pEntry->R_Counter, sizeof(pEntry->R_Counter)); - pEntry->ReTryCounter = PEER_MSG1_RETRY_TIMER_CTR; - - WPAStart4WayHS(pAd, pEntry, PEER_MSG1_RETRY_EXEC_INTV); - } - } + MAC_TABLE_ENTRY *pEntry; + PHEADER_802_11 pHeader; + + DBGPRINT(RT_DEBUG_TRACE, ("WpaEAPOLStartAction ===> \n")); + + pHeader = (PHEADER_802_11) Elem->Msg; + + //For normaol PSK, we enqueue an EAPOL-Start command to trigger the process. + if (Elem->MsgLen == 6) + pEntry = MacTableLookup(pAd, Elem->Msg); + else { + pEntry = MacTableLookup(pAd, pHeader->Addr2); + } + + if (pEntry) { + DBGPRINT(RT_DEBUG_TRACE, + (" PortSecured(%d), WpaState(%d), AuthMode(%d), PMKID_CacheIdx(%d) \n", + pEntry->PortSecured, pEntry->WpaState, + pEntry->AuthMode, pEntry->PMKID_CacheIdx)); + + if ((pEntry->PortSecured == WPA_802_1X_PORT_NOT_SECURED) + && (pEntry->WpaState < AS_PTKSTART) + && ((pEntry->AuthMode == Ndis802_11AuthModeWPAPSK) + || (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK) + || ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) + && (pEntry->PMKID_CacheIdx != ENTRY_NOT_FOUND)))) { + pEntry->PrivacyFilter = Ndis802_11PrivFilter8021xWEP; + pEntry->WpaState = AS_INITPSK; + pEntry->PortSecured = WPA_802_1X_PORT_NOT_SECURED; + NdisZeroMemory(pEntry->R_Counter, + sizeof(pEntry->R_Counter)); + pEntry->ReTryCounter = PEER_MSG1_RETRY_TIMER_CTR; + + WPAStart4WayHS(pAd, pEntry, PEER_MSG1_RETRY_EXEC_INTV); + } + } } /* @@ -198,138 +187,154 @@ VOID WpaEAPOLStartAction( Return: ========================================================================== */ -VOID WpaEAPOLKeyAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - MAC_TABLE_ENTRY *pEntry; - PHEADER_802_11 pHeader; - PEAPOL_PACKET pEapol_packet; - KEY_INFO peerKeyInfo; + MAC_TABLE_ENTRY *pEntry; + PHEADER_802_11 pHeader; + PEAPOL_PACKET pEapol_packet; + KEY_INFO peerKeyInfo; - DBGPRINT(RT_DEBUG_TRACE, ("WpaEAPOLKeyAction ===>\n")); + DBGPRINT(RT_DEBUG_TRACE, ("WpaEAPOLKeyAction ===>\n")); - pHeader = (PHEADER_802_11)Elem->Msg; - pEapol_packet = (PEAPOL_PACKET)&Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; + pHeader = (PHEADER_802_11) Elem->Msg; + pEapol_packet = + (PEAPOL_PACKET) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; - NdisZeroMemory((PUCHAR)&peerKeyInfo, sizeof(peerKeyInfo)); - NdisMoveMemory((PUCHAR)&peerKeyInfo, (PUCHAR)&pEapol_packet->KeyDesc.KeyInfo, sizeof(KEY_INFO)); + NdisZeroMemory((PUCHAR) & peerKeyInfo, sizeof(peerKeyInfo)); + NdisMoveMemory((PUCHAR) & peerKeyInfo, + (PUCHAR) & pEapol_packet->KeyDesc.KeyInfo, + sizeof(KEY_INFO)); - hex_dump("Received Eapol frame", (unsigned char *)pEapol_packet, (Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H)); + hex_dump("Received Eapol frame", (unsigned char *)pEapol_packet, + (Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H)); - *((USHORT *)&peerKeyInfo) = cpu2le16(*((USHORT *)&peerKeyInfo)); + *((USHORT *) & peerKeyInfo) = cpu2le16(*((USHORT *) & peerKeyInfo)); - do - { - pEntry = MacTableLookup(pAd, pHeader->Addr2); + do { + pEntry = MacTableLookup(pAd, pHeader->Addr2); - if (!pEntry || ((!pEntry->ValidAsCLI) && (!pEntry->ValidAsApCli))) - break; + if (!pEntry + || ((!pEntry->ValidAsCLI) && (!pEntry->ValidAsApCli))) + break; if (pEntry->AuthMode < Ndis802_11AuthModeWPA) - break; - - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPoL-Key frame from STA %02X-%02X-%02X-%02X-%02X-%02X\n", PRINT_MAC(pEntry->Addr))); + break; - if (((pEapol_packet->ProVer != EAPOL_VER) && (pEapol_packet->ProVer != EAPOL_VER2)) || - ((pEapol_packet->KeyDesc.Type != WPA1_KEY_DESC) && (pEapol_packet->KeyDesc.Type != WPA2_KEY_DESC))) - { - DBGPRINT(RT_DEBUG_ERROR, ("Key descripter does not match with WPA rule\n")); - break; - } + DBGPRINT(RT_DEBUG_TRACE, + ("Receive EAPoL-Key frame from STA %02X-%02X-%02X-%02X-%02X-%02X\n", + PRINT_MAC(pEntry->Addr))); + if (((pEapol_packet->ProVer != EAPOL_VER) + && (pEapol_packet->ProVer != EAPOL_VER2)) + || ((pEapol_packet->KeyDesc.Type != WPA1_KEY_DESC) + && (pEapol_packet->KeyDesc.Type != WPA2_KEY_DESC))) { + DBGPRINT(RT_DEBUG_ERROR, + ("Key descripter does not match with WPA rule\n")); + break; + } // The value 1 shall be used for all EAPOL-Key frames to and from a STA when // neither the group nor pairwise ciphers are CCMP for Key Descriptor 1. - if ((pEntry->WepStatus == Ndis802_11Encryption2Enabled) && (peerKeyInfo.KeyDescVer != DESC_TYPE_TKIP)) - { - DBGPRINT(RT_DEBUG_ERROR, ("Key descripter version not match(TKIP) \n")); - break; - } + if ((pEntry->WepStatus == Ndis802_11Encryption2Enabled) + && (peerKeyInfo.KeyDescVer != DESC_TYPE_TKIP)) { + DBGPRINT(RT_DEBUG_ERROR, + ("Key descripter version not match(TKIP) \n")); + break; + } // The value 2 shall be used for all EAPOL-Key frames to and from a STA when // either the pairwise or the group cipher is AES-CCMP for Key Descriptor 2. - else if ((pEntry->WepStatus == Ndis802_11Encryption3Enabled) && (peerKeyInfo.KeyDescVer != DESC_TYPE_AES)) - { - DBGPRINT(RT_DEBUG_ERROR, ("Key descripter version not match(AES) \n")); - break; - } - + else if ((pEntry->WepStatus == Ndis802_11Encryption3Enabled) + && (peerKeyInfo.KeyDescVer != DESC_TYPE_AES)) { + DBGPRINT(RT_DEBUG_ERROR, + ("Key descripter version not match(AES) \n")); + break; + } // Check if this STA is in class 3 state and the WPA state is started - if ((pEntry->Sst == SST_ASSOC) && (pEntry->WpaState >= AS_INITPSK)) - { + if ((pEntry->Sst == SST_ASSOC) + && (pEntry->WpaState >= AS_INITPSK)) { // Check the Key Ack (bit 7) of the Key Information to determine the Authenticator // or not. // An EAPOL-Key frame that is sent by the Supplicant in response to an EAPOL- // Key frame from the Authenticator must not have the Ack bit set. - if (peerKeyInfo.KeyAck == 1) - { + if (peerKeyInfo.KeyAck == 1) { // The frame is snet by Authenticator. // So the Supplicant side shall handle this. - if ((peerKeyInfo.Secure == 0) && (peerKeyInfo.Request == 0) && - (peerKeyInfo.Error == 0) && (peerKeyInfo.KeyType == PAIRWISEKEY)) - { + if ((peerKeyInfo.Secure == 0) + && (peerKeyInfo.Request == 0) + && (peerKeyInfo.Error == 0) + && (peerKeyInfo.KeyType == PAIRWISEKEY)) { // Process 1. the message 1 of 4-way HS in WPA or WPA2 - // EAPOL-Key(0,0,1,0,P,0,0,ANonce,0,DataKD_M1) - // 2. the message 3 of 4-way HS in WPA - // EAPOL-Key(0,1,1,1,P,0,KeyRSC,ANonce,MIC,DataKD_M3) + // EAPOL-Key(0,0,1,0,P,0,0,ANonce,0,DataKD_M1) + // 2. the message 3 of 4-way HS in WPA + // EAPOL-Key(0,1,1,1,P,0,KeyRSC,ANonce,MIC,DataKD_M3) if (peerKeyInfo.KeyMic == 0) - PeerPairMsg1Action(pAd, pEntry, Elem); - else - PeerPairMsg3Action(pAd, pEntry, Elem); - } - else if ((peerKeyInfo.Secure == 1) && - (peerKeyInfo.KeyMic == 1) && - (peerKeyInfo.Request == 0) && - (peerKeyInfo.Error == 0)) - { + PeerPairMsg1Action(pAd, pEntry, + Elem); + else + PeerPairMsg3Action(pAd, pEntry, + Elem); + } else if ((peerKeyInfo.Secure == 1) + && (peerKeyInfo.KeyMic == 1) + && (peerKeyInfo.Request == 0) + && (peerKeyInfo.Error == 0)) { // Process 1. the message 3 of 4-way HS in WPA2 - // EAPOL-Key(1,1,1,1,P,0,KeyRSC,ANonce,MIC,DataKD_M3) - // 2. the message 1 of group KS in WPA or WPA2 - // EAPOL-Key(1,1,1,0,G,0,Key RSC,0, MIC,GTK[N]) + // EAPOL-Key(1,1,1,1,P,0,KeyRSC,ANonce,MIC,DataKD_M3) + // 2. the message 1 of group KS in WPA or WPA2 + // EAPOL-Key(1,1,1,0,G,0,Key RSC,0, MIC,GTK[N]) if (peerKeyInfo.KeyType == PAIRWISEKEY) - PeerPairMsg3Action(pAd, pEntry, Elem); + PeerPairMsg3Action(pAd, pEntry, + Elem); else - PeerGroupMsg1Action(pAd, pEntry, Elem); + PeerGroupMsg1Action(pAd, pEntry, + Elem); } - } - else - { + } else { // The frame is snet by Supplicant. // So the Authenticator side shall handle this. if ((peerKeyInfo.Request == 0) && - (peerKeyInfo.Error == 0) && - (peerKeyInfo.KeyMic == 1)) - { - if (peerKeyInfo.Secure == 0 && peerKeyInfo.KeyType == PAIRWISEKEY) - { + (peerKeyInfo.Error == 0) && + (peerKeyInfo.KeyMic == 1)) { + if (peerKeyInfo.Secure == 0 + && peerKeyInfo.KeyType == + PAIRWISEKEY) { // EAPOL-Key(0,1,0,0,P,0,0,SNonce,MIC,Data) // Process 1. message 2 of 4-way HS in WPA or WPA2 - // 2. message 4 of 4-way HS in WPA - if (CONV_ARRARY_TO_UINT16(pEapol_packet->KeyDesc.KeyDataLen) == 0) - { - PeerPairMsg4Action(pAd, pEntry, Elem); - } - else - { - PeerPairMsg2Action(pAd, pEntry, Elem); + // 2. message 4 of 4-way HS in WPA + if (CONV_ARRARY_TO_UINT16 + (pEapol_packet->KeyDesc. + KeyDataLen) == 0) { + PeerPairMsg4Action(pAd, + pEntry, + Elem); + } else { + PeerPairMsg2Action(pAd, + pEntry, + Elem); } - } - else if (peerKeyInfo.Secure == 1 && peerKeyInfo.KeyType == PAIRWISEKEY) - { + } else if (peerKeyInfo.Secure == 1 + && peerKeyInfo.KeyType == + PAIRWISEKEY) { // EAPOL-Key(1,1,0,0,P,0,0,0,MIC,0) // Process message 4 of 4-way HS in WPA2 - PeerPairMsg4Action(pAd, pEntry, Elem); - } - else if (peerKeyInfo.Secure == 1 && peerKeyInfo.KeyType == GROUPKEY) - { + PeerPairMsg4Action(pAd, pEntry, + Elem); + } else if (peerKeyInfo.Secure == 1 + && peerKeyInfo.KeyType == + GROUPKEY) { // EAPOL-Key(1,1,0,0,G,0,0,0,MIC,0) // Process message 2 of Group key HS in WPA or WPA2 - PeerGroupMsg2Action(pAd, pEntry, &Elem->Msg[LENGTH_802_11], (Elem->MsgLen - LENGTH_802_11)); + PeerGroupMsg2Action(pAd, pEntry, + &Elem-> + Msg + [LENGTH_802_11], + (Elem-> + MsgLen - + LENGTH_802_11)); } } } - } - }while(FALSE); + } + } while (FALSE); } /* @@ -352,66 +357,71 @@ VOID WpaEAPOLKeyAction( ======================================================================== */ -VOID RTMPToWirelessSta( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, - IN UINT DataLen, - IN BOOLEAN bClearFrame) +VOID RTMPToWirelessSta(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, + IN PUCHAR pHeader802_3, + IN UINT HdrLen, + IN PUCHAR pData, IN UINT DataLen, IN BOOLEAN bClearFrame) { - PNDIS_PACKET pPacket; - NDIS_STATUS Status; + PNDIS_PACKET pPacket; + NDIS_STATUS Status; if ((!pEntry) || ((!pEntry->ValidAsCLI) && (!pEntry->ValidAsApCli))) return; - do { + do { // build a NDIS packet - Status = RTMPAllocateNdisPacket(pAd, &pPacket, pHeader802_3, HdrLen, pData, DataLen); + Status = + RTMPAllocateNdisPacket(pAd, &pPacket, pHeader802_3, HdrLen, + pData, DataLen); if (Status != NDIS_STATUS_SUCCESS) - break; - + break; - if (bClearFrame) - RTMP_SET_PACKET_CLEAR_EAP_FRAME(pPacket, 1); - else - RTMP_SET_PACKET_CLEAR_EAP_FRAME(pPacket, 0); + if (bClearFrame) + RTMP_SET_PACKET_CLEAR_EAP_FRAME(pPacket, 1); + else + RTMP_SET_PACKET_CLEAR_EAP_FRAME(pPacket, 0); { RTMP_SET_PACKET_SOURCE(pPacket, PKTSRC_NDIS); RTMP_SET_PACKET_NET_DEVICE_MBSSID(pPacket, MAIN_MBSSID); // set a default value - if(pEntry->apidx != 0) - RTMP_SET_PACKET_NET_DEVICE_MBSSID(pPacket, pEntry->apidx); + if (pEntry->apidx != 0) + RTMP_SET_PACKET_NET_DEVICE_MBSSID(pPacket, + pEntry-> + apidx); - RTMP_SET_PACKET_WCID(pPacket, (UCHAR)pEntry->Aid); + RTMP_SET_PACKET_WCID(pPacket, (UCHAR) pEntry->Aid); RTMP_SET_PACKET_MOREDATA(pPacket, FALSE); } { - // send out the packet - Status = STASendPacket(pAd, pPacket); - if (Status == NDIS_STATUS_SUCCESS) - { - UCHAR Index; + // send out the packet + Status = STASendPacket(pAd, pPacket); + if (Status == NDIS_STATUS_SUCCESS) { + UCHAR Index; // Dequeue one frame from TxSwQueue0..3 queue and process it // There are three place calling dequeue for TX ring. // 1. Here, right after queueing the frame. // 2. At the end of TxRingTxDone service routine. // 3. Upon NDIS call RTMPSendPackets - if((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS))) - { - for(Index = 0; Index < 5; Index ++) - if(pAd->TxSwQueue[Index].Number > 0) - RTMPDeQueuePacket(pAd, FALSE, Index, MAX_TX_PROCESS); + if ((!RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) + && + (!RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS))) { + for (Index = 0; Index < 5; Index++) + if (pAd->TxSwQueue[Index]. + Number > 0) + RTMPDeQueuePacket(pAd, + FALSE, + Index, + MAX_TX_PROCESS); } } } - } while (FALSE); + } while (FALSE); } /* @@ -423,74 +433,69 @@ VOID RTMPToWirelessSta( ========================================================================== */ -VOID WPAStart4WayHS( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN ULONG TimeInterval) +VOID WPAStart4WayHS(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, IN ULONG TimeInterval) { - UCHAR Header802_3[14]; - EAPOL_PACKET EAPOLPKT; - PUINT8 pBssid = NULL; - UCHAR group_cipher = Ndis802_11WEPDisabled; + UCHAR Header802_3[14]; + EAPOL_PACKET EAPOLPKT; + PUINT8 pBssid = NULL; + UCHAR group_cipher = Ndis802_11WEPDisabled; - DBGPRINT(RT_DEBUG_TRACE, ("===> WPAStart4WayHS\n")); + DBGPRINT(RT_DEBUG_TRACE, ("===> WPAStart4WayHS\n")); - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_HALT_IN_PROGRESS)) + if (RTMP_TEST_FLAG + (pAd, + fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_HALT_IN_PROGRESS)) { - DBGPRINT(RT_DEBUG_ERROR, ("[ERROR]WPAStart4WayHS : The interface is closed...\n")); + DBGPRINT(RT_DEBUG_ERROR, + ("[ERROR]WPAStart4WayHS : The interface is closed...\n")); return; } - - if (pBssid == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("[ERROR]WPAStart4WayHS : No corresponding Authenticator.\n")); + if (pBssid == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("[ERROR]WPAStart4WayHS : No corresponding Authenticator.\n")); return; - } - + } // Check the status - if ((pEntry->WpaState > AS_PTKSTART) || (pEntry->WpaState < AS_INITPMK)) - { - DBGPRINT(RT_DEBUG_ERROR, ("[ERROR]WPAStart4WayHS : Not expect calling\n")); - return; - } - + if ((pEntry->WpaState > AS_PTKSTART) || (pEntry->WpaState < AS_INITPMK)) { + DBGPRINT(RT_DEBUG_ERROR, + ("[ERROR]WPAStart4WayHS : Not expect calling\n")); + return; + } // Increment replay counter by 1 ADD_ONE_To_64BIT_VAR(pEntry->R_Counter); // Randomly generate ANonce - GenRandom(pAd, (UCHAR *)pBssid, pEntry->ANonce); + GenRandom(pAd, (UCHAR *) pBssid, pEntry->ANonce); // Construct EAPoL message - Pairwise Msg 1 // EAPOL-Key(0,0,1,0,P,0,0,ANonce,0,DataKD_M1) NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); - ConstructEapolMsg(pEntry, - group_cipher, - EAPOL_PAIR_MSG_1, - 0, // Default key index - pEntry->ANonce, - NULL, // TxRSC - NULL, // GTK - NULL, // RSNIE - 0, // RSNIE length - &EAPOLPKT); - + ConstructEapolMsg(pEntry, group_cipher, EAPOL_PAIR_MSG_1, 0, // Default key index + pEntry->ANonce, NULL, // TxRSC + NULL, // GTK + NULL, // RSNIE + 0, // RSNIE length + &EAPOLPKT); // Make outgoing frame - MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pBssid, EAPOL); - RTMPToWirelessSta(pAd, pEntry, Header802_3, - LENGTH_802_3, (PUCHAR)&EAPOLPKT, - CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, - (pEntry->PortSecured == WPA_802_1X_PORT_SECURED) ? FALSE : TRUE); + MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pBssid, EAPOL); + RTMPToWirelessSta(pAd, pEntry, Header802_3, + LENGTH_802_3, (PUCHAR) & EAPOLPKT, + CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, + (pEntry->PortSecured == + WPA_802_1X_PORT_SECURED) ? FALSE : TRUE); // Trigger Retry Timer - RTMPModTimer(&pEntry->RetryTimer, TimeInterval); + RTMPModTimer(&pEntry->RetryTimer, TimeInterval); // Update State - pEntry->WpaState = AS_PTKSTART; + pEntry->WpaState = AS_PTKSTART; - DBGPRINT(RT_DEBUG_TRACE, ("<=== WPAStart4WayHS: send Msg1 of 4-way \n")); + DBGPRINT(RT_DEBUG_TRACE, + ("<=== WPAStart4WayHS: send Msg1 of 4-way \n")); } @@ -511,29 +516,29 @@ VOID WPAStart4WayHS( ======================================================================== */ -VOID PeerPairMsg1Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerPairMsg1Action(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem) { - UCHAR PTK[80]; - UCHAR Header802_3[14]; - PEAPOL_PACKET pMsg1; - UINT MsgLen; - EAPOL_PACKET EAPOLPKT; - PUINT8 pCurrentAddr = NULL; - PUINT8 pmk_ptr = NULL; - UCHAR group_cipher = Ndis802_11WEPDisabled; - PUINT8 rsnie_ptr = NULL; - UCHAR rsnie_len = 0; + UCHAR PTK[80]; + UCHAR Header802_3[14]; + PEAPOL_PACKET pMsg1; + UINT MsgLen; + EAPOL_PACKET EAPOLPKT; + PUINT8 pCurrentAddr = NULL; + PUINT8 pmk_ptr = NULL; + UCHAR group_cipher = Ndis802_11WEPDisabled; + PUINT8 rsnie_ptr = NULL; + UCHAR rsnie_len = 0; DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg1Action \n")); if ((!pEntry) || ((!pEntry->ValidAsCLI) && (!pEntry->ValidAsApCli))) return; - if (Elem->MsgLen < (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) - return; + if (Elem->MsgLen < + (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) + return; { pCurrentAddr = pAd->CurrentAddress; @@ -544,32 +549,32 @@ VOID PeerPairMsg1Action( } // Store the received frame - pMsg1 = (PEAPOL_PACKET) &Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; + pMsg1 = (PEAPOL_PACKET) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; // Sanity Check peer Pairwise message 1 - Replay Counter - if (PeerWpaMessageSanity(pAd, pMsg1, MsgLen, EAPOL_PAIR_MSG_1, pEntry) == FALSE) + if (PeerWpaMessageSanity(pAd, pMsg1, MsgLen, EAPOL_PAIR_MSG_1, pEntry) + == FALSE) return; // Store Replay counter, it will use to verify message 3 and construct message 2 - NdisMoveMemory(pEntry->R_Counter, pMsg1->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); + NdisMoveMemory(pEntry->R_Counter, pMsg1->KeyDesc.ReplayCounter, + LEN_KEY_DESC_REPLAY); // Store ANonce - NdisMoveMemory(pEntry->ANonce, pMsg1->KeyDesc.KeyNonce, LEN_KEY_DESC_NONCE); + NdisMoveMemory(pEntry->ANonce, pMsg1->KeyDesc.KeyNonce, + LEN_KEY_DESC_NONCE); // Generate random SNonce - GenRandom(pAd, (UCHAR *)pCurrentAddr, pEntry->SNonce); + GenRandom(pAd, (UCHAR *) pCurrentAddr, pEntry->SNonce); { - // Calculate PTK(ANonce, SNonce) - WpaDerivePTK(pAd, - pmk_ptr, - pEntry->ANonce, - pEntry->Addr, - pEntry->SNonce, - pCurrentAddr, - PTK, - LEN_PTK); + // Calculate PTK(ANonce, SNonce) + WpaDerivePTK(pAd, + pmk_ptr, + pEntry->ANonce, + pEntry->Addr, + pEntry->SNonce, pCurrentAddr, PTK, LEN_PTK); // Save key to PTK entry NdisMoveMemory(pEntry->PTK, PTK, LEN_PTK); @@ -581,28 +586,22 @@ VOID PeerPairMsg1Action( // Construct EAPoL message - Pairwise Msg 2 // EAPOL-Key(0,1,0,0,P,0,0,SNonce,MIC,DataKD_M2) NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); - ConstructEapolMsg(pEntry, - group_cipher, - EAPOL_PAIR_MSG_2, - 0, // DefaultKeyIdx - pEntry->SNonce, - NULL, // TxRsc - NULL, // GTK - (UCHAR *)rsnie_ptr, - rsnie_len, - &EAPOLPKT); + ConstructEapolMsg(pEntry, group_cipher, EAPOL_PAIR_MSG_2, 0, // DefaultKeyIdx + pEntry->SNonce, NULL, // TxRsc + NULL, // GTK + (UCHAR *) rsnie_ptr, rsnie_len, &EAPOLPKT); // Make outgoing frame MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pCurrentAddr, EAPOL); RTMPToWirelessSta(pAd, pEntry, - Header802_3, sizeof(Header802_3), (PUCHAR)&EAPOLPKT, - CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, TRUE); + Header802_3, sizeof(Header802_3), (PUCHAR) & EAPOLPKT, + CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, TRUE); - DBGPRINT(RT_DEBUG_TRACE, ("<=== PeerPairMsg1Action: send Msg2 of 4-way \n")); + DBGPRINT(RT_DEBUG_TRACE, + ("<=== PeerPairMsg1Action: send Msg2 of 4-way \n")); } - /* ========================================================================== Description: @@ -610,76 +609,70 @@ VOID PeerPairMsg1Action( Return: ========================================================================== */ -VOID PeerPairMsg2Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerPairMsg2Action(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem) { - UCHAR PTK[80]; - BOOLEAN Cancelled; - PHEADER_802_11 pHeader; - EAPOL_PACKET EAPOLPKT; - PEAPOL_PACKET pMsg2; - UINT MsgLen; - UCHAR Header802_3[LENGTH_802_3]; - UCHAR TxTsc[6]; - PUINT8 pBssid = NULL; - PUINT8 pmk_ptr = NULL; - PUINT8 gtk_ptr = NULL; - UCHAR default_key = 0; - UCHAR group_cipher = Ndis802_11WEPDisabled; - PUINT8 rsnie_ptr = NULL; - UCHAR rsnie_len = 0; - - DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg2Action \n")); - - if ((!pEntry) || (!pEntry->ValidAsCLI)) - return; - - if (Elem->MsgLen < (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) - return; - - // check Entry in valid State - if (pEntry->WpaState < AS_PTKSTART) - return; + UCHAR PTK[80]; + BOOLEAN Cancelled; + PHEADER_802_11 pHeader; + EAPOL_PACKET EAPOLPKT; + PEAPOL_PACKET pMsg2; + UINT MsgLen; + UCHAR Header802_3[LENGTH_802_3]; + UCHAR TxTsc[6]; + PUINT8 pBssid = NULL; + PUINT8 pmk_ptr = NULL; + PUINT8 gtk_ptr = NULL; + UCHAR default_key = 0; + UCHAR group_cipher = Ndis802_11WEPDisabled; + PUINT8 rsnie_ptr = NULL; + UCHAR rsnie_len = 0; + + DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg2Action \n")); + + if ((!pEntry) || (!pEntry->ValidAsCLI)) + return; + if (Elem->MsgLen < + (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) + return; + // check Entry in valid State + if (pEntry->WpaState < AS_PTKSTART) + return; - // pointer to 802.11 header - pHeader = (PHEADER_802_11)Elem->Msg; + // pointer to 802.11 header + pHeader = (PHEADER_802_11) Elem->Msg; // skip 802.11_header(24-byte) and LLC_header(8) - pMsg2 = (PEAPOL_PACKET)&Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; + pMsg2 = (PEAPOL_PACKET) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; // Store SNonce - NdisMoveMemory(pEntry->SNonce, pMsg2->KeyDesc.KeyNonce, LEN_KEY_DESC_NONCE); + NdisMoveMemory(pEntry->SNonce, pMsg2->KeyDesc.KeyNonce, + LEN_KEY_DESC_NONCE); { // Derive PTK - WpaDerivePTK(pAd, - (UCHAR *)pmk_ptr, - pEntry->ANonce, // ANONCE - (UCHAR *)pBssid, - pEntry->SNonce, // SNONCE - pEntry->Addr, - PTK, - LEN_PTK); - - NdisMoveMemory(pEntry->PTK, PTK, LEN_PTK); + WpaDerivePTK(pAd, (UCHAR *) pmk_ptr, pEntry->ANonce, // ANONCE + (UCHAR *) pBssid, pEntry->SNonce, // SNONCE + pEntry->Addr, PTK, LEN_PTK); + + NdisMoveMemory(pEntry->PTK, PTK, LEN_PTK); } // Sanity Check peer Pairwise message 2 - Replay Counter, MIC, RSNIE - if (PeerWpaMessageSanity(pAd, pMsg2, MsgLen, EAPOL_PAIR_MSG_2, pEntry) == FALSE) + if (PeerWpaMessageSanity(pAd, pMsg2, MsgLen, EAPOL_PAIR_MSG_2, pEntry) + == FALSE) return; - do - { - // delete retry timer + do { + // delete retry timer RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); // Change state - pEntry->WpaState = AS_PTKINIT_NEGOTIATING; + pEntry->WpaState = AS_PTKINIT_NEGOTIATING; // Increment replay counter by 1 ADD_ONE_To_64BIT_VAR(pEntry->R_Counter); @@ -687,31 +680,31 @@ VOID PeerPairMsg2Action( // Construct EAPoL message - Pairwise Msg 3 NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); ConstructEapolMsg(pEntry, - group_cipher, - EAPOL_PAIR_MSG_3, - default_key, - pEntry->ANonce, - TxTsc, - (UCHAR *)gtk_ptr, - (UCHAR *)rsnie_ptr, - rsnie_len, - &EAPOLPKT); - - // Make outgoing frame - MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pBssid, EAPOL); - RTMPToWirelessSta(pAd, pEntry, Header802_3, LENGTH_802_3, - (PUCHAR)&EAPOLPKT, - CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, - (pEntry->PortSecured == WPA_802_1X_PORT_SECURED) ? FALSE : TRUE); - - pEntry->ReTryCounter = PEER_MSG3_RETRY_TIMER_CTR; + group_cipher, + EAPOL_PAIR_MSG_3, + default_key, + pEntry->ANonce, + TxTsc, + (UCHAR *) gtk_ptr, + (UCHAR *) rsnie_ptr, rsnie_len, &EAPOLPKT); + + // Make outgoing frame + MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pBssid, EAPOL); + RTMPToWirelessSta(pAd, pEntry, Header802_3, LENGTH_802_3, + (PUCHAR) & EAPOLPKT, + CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, + (pEntry->PortSecured == + WPA_802_1X_PORT_SECURED) ? FALSE : TRUE); + + pEntry->ReTryCounter = PEER_MSG3_RETRY_TIMER_CTR; RTMPSetTimer(&pEntry->RetryTimer, PEER_MSG3_RETRY_EXEC_INTV); // Update State - pEntry->WpaState = AS_PTKINIT_NEGOTIATING; - }while(FALSE); + pEntry->WpaState = AS_PTKINIT_NEGOTIATING; + } while (FALSE); - DBGPRINT(RT_DEBUG_TRACE, ("<=== PeerPairMsg2Action: send Msg3 of 4-way \n")); + DBGPRINT(RT_DEBUG_TRACE, + ("<=== PeerPairMsg2Action: send Msg3 of 4-way \n")); } /* @@ -731,25 +724,25 @@ VOID PeerPairMsg2Action( ======================================================================== */ -VOID PeerPairMsg3Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem) { - PHEADER_802_11 pHeader; - UCHAR Header802_3[14]; - EAPOL_PACKET EAPOLPKT; - PEAPOL_PACKET pMsg3; - UINT MsgLen; - PUINT8 pCurrentAddr = NULL; - UCHAR group_cipher = Ndis802_11WEPDisabled; + PHEADER_802_11 pHeader; + UCHAR Header802_3[14]; + EAPOL_PACKET EAPOLPKT; + PEAPOL_PACKET pMsg3; + UINT MsgLen; + PUINT8 pCurrentAddr = NULL; + UCHAR group_cipher = Ndis802_11WEPDisabled; DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg3Action \n")); if ((!pEntry) || ((!pEntry->ValidAsCLI) && (!pEntry->ValidAsApCli))) return; - if (Elem->MsgLen < (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) + if (Elem->MsgLen < + (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) return; { @@ -759,35 +752,32 @@ VOID PeerPairMsg3Action( } // Record 802.11 header & the received EAPOL packet Msg3 - pHeader = (PHEADER_802_11) Elem->Msg; - pMsg3 = (PEAPOL_PACKET) &Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; + pHeader = (PHEADER_802_11) Elem->Msg; + pMsg3 = (PEAPOL_PACKET) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; // Sanity Check peer Pairwise message 3 - Replay Counter, MIC, RSNIE - if (PeerWpaMessageSanity(pAd, pMsg3, MsgLen, EAPOL_PAIR_MSG_3, pEntry) == FALSE) + if (PeerWpaMessageSanity(pAd, pMsg3, MsgLen, EAPOL_PAIR_MSG_3, pEntry) + == FALSE) return; // Save Replay counter, it will use construct message 4 - NdisMoveMemory(pEntry->R_Counter, pMsg3->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); + NdisMoveMemory(pEntry->R_Counter, pMsg3->KeyDesc.ReplayCounter, + LEN_KEY_DESC_REPLAY); // Double check ANonce - if (!NdisEqualMemory(pEntry->ANonce, pMsg3->KeyDesc.KeyNonce, LEN_KEY_DESC_NONCE)) - { + if (!NdisEqualMemory + (pEntry->ANonce, pMsg3->KeyDesc.KeyNonce, LEN_KEY_DESC_NONCE)) { return; } - // Construct EAPoL message - Pairwise Msg 4 NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); - ConstructEapolMsg(pEntry, - group_cipher, - EAPOL_PAIR_MSG_4, - 0, // group key index not used in message 4 - NULL, // Nonce not used in message 4 - NULL, // TxRSC not used in message 4 - NULL, // GTK not used in message 4 - NULL, // RSN IE not used in message 4 - 0, - &EAPOLPKT); + ConstructEapolMsg(pEntry, group_cipher, EAPOL_PAIR_MSG_4, 0, // group key index not used in message 4 + NULL, // Nonce not used in message 4 + NULL, // TxRSC not used in message 4 + NULL, // GTK not used in message 4 + NULL, // RSN IE not used in message 4 + 0, &EAPOLPKT); // Update WpaState pEntry->WpaState = AS_PTKINITDONE; @@ -803,9 +793,13 @@ VOID PeerPairMsg3Action( // Prepare pair-wise key information into shared key table NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); pSharedKey->KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pSharedKey->Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); - NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_RXMICK); - NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); + NdisMoveMemory(pSharedKey->Key, &pAd->StaCfg.PTK[32], + LEN_TKIP_EK); + NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.PTK[48], + LEN_TKIP_RXMICK); + NdisMoveMemory(pSharedKey->TxMic, + &pAd->StaCfg.PTK[48 + LEN_TKIP_RXMICK], + LEN_TKIP_TXMICK); // Decide its ChiperAlg if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) @@ -817,56 +811,56 @@ VOID PeerPairMsg3Action( // Update these related information to MAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[BSSID_WCID]; - NdisMoveMemory(pEntry->PairwiseKey.Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); - NdisMoveMemory(pEntry->PairwiseKey.RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_RXMICK); - NdisMoveMemory(pEntry->PairwiseKey.TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); + NdisMoveMemory(pEntry->PairwiseKey.Key, &pAd->StaCfg.PTK[32], + LEN_TKIP_EK); + NdisMoveMemory(pEntry->PairwiseKey.RxMic, &pAd->StaCfg.PTK[48], + LEN_TKIP_RXMICK); + NdisMoveMemory(pEntry->PairwiseKey.TxMic, + &pAd->StaCfg.PTK[48 + LEN_TKIP_RXMICK], + LEN_TKIP_TXMICK); pEntry->PairwiseKey.CipherAlg = pSharedKey->CipherAlg; // Update pairwise key information to ASIC Shared Key Table AsicAddSharedKeyEntry(pAd, - BSS0, - 0, - pSharedKey->CipherAlg, - pSharedKey->Key, - pSharedKey->TxMic, - pSharedKey->RxMic); + BSS0, + 0, + pSharedKey->CipherAlg, + pSharedKey->Key, + pSharedKey->TxMic, pSharedKey->RxMic); // Update ASIC WCID attribute table and IVEIV table RTMPAddWcidAttributeEntry(pAd, - BSS0, - 0, - pSharedKey->CipherAlg, - pEntry); + BSS0, + 0, pSharedKey->CipherAlg, pEntry); } // open 802.1x port control and privacy filter if (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK || - pEntry->AuthMode == Ndis802_11AuthModeWPA2) - { + pEntry->AuthMode == Ndis802_11AuthModeWPA2) { pEntry->PortSecured = WPA_802_1X_PORT_SECURED; pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; STA_PORT_SECURED(pAd); - // Indicate Connected for GUI - pAd->IndicateMediaState = NdisMediaStateConnected; - DBGPRINT(RT_DEBUG_TRACE, ("PeerPairMsg3Action: AuthMode(%s) PairwiseCipher(%s) GroupCipher(%s) \n", - GetAuthMode(pEntry->AuthMode), - GetEncryptType(pEntry->WepStatus), - GetEncryptType(group_cipher))); - } - else - { + // Indicate Connected for GUI + pAd->IndicateMediaState = NdisMediaStateConnected; + DBGPRINT(RT_DEBUG_TRACE, + ("PeerPairMsg3Action: AuthMode(%s) PairwiseCipher(%s) GroupCipher(%s) \n", + GetAuthMode(pEntry->AuthMode), + GetEncryptType(pEntry->WepStatus), + GetEncryptType(group_cipher))); + } else { } // Init 802.3 header and send out MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pCurrentAddr, EAPOL); RTMPToWirelessSta(pAd, pEntry, - Header802_3, sizeof(Header802_3), - (PUCHAR)&EAPOLPKT, - CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, TRUE); + Header802_3, sizeof(Header802_3), + (PUCHAR) & EAPOLPKT, + CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, TRUE); - DBGPRINT(RT_DEBUG_TRACE, ("<=== PeerPairMsg3Action: send Msg4 of 4-way \n")); + DBGPRINT(RT_DEBUG_TRACE, + ("<=== PeerPairMsg3Action: send Msg4 of 4-way \n")); } /* @@ -877,109 +871,114 @@ VOID PeerPairMsg3Action( Return: ========================================================================== */ -VOID PeerPairMsg4Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem) { - PEAPOL_PACKET pMsg4; - PHEADER_802_11 pHeader; - UINT MsgLen; - BOOLEAN Cancelled; - UCHAR group_cipher = Ndis802_11WEPDisabled; - - DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg4Action\n")); + PEAPOL_PACKET pMsg4; + PHEADER_802_11 pHeader; + UINT MsgLen; + BOOLEAN Cancelled; + UCHAR group_cipher = Ndis802_11WEPDisabled; - do - { - if ((!pEntry) || (!pEntry->ValidAsCLI)) - break; + DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg4Action\n")); - if (Elem->MsgLen < (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2 ) ) - break; + do { + if ((!pEntry) || (!pEntry->ValidAsCLI)) + break; - if (pEntry->WpaState < AS_PTKINIT_NEGOTIATING) - break; + if (Elem->MsgLen < + (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) + break; + if (pEntry->WpaState < AS_PTKINIT_NEGOTIATING) + break; - // pointer to 802.11 header - pHeader = (PHEADER_802_11)Elem->Msg; + // pointer to 802.11 header + pHeader = (PHEADER_802_11) Elem->Msg; // skip 802.11_header(24-byte) and LLC_header(8) - pMsg4 = (PEAPOL_PACKET)&Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; + pMsg4 = + (PEAPOL_PACKET) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; - // Sanity Check peer Pairwise message 4 - Replay Counter, MIC - if (PeerWpaMessageSanity(pAd, pMsg4, MsgLen, EAPOL_PAIR_MSG_4, pEntry) == FALSE) + // Sanity Check peer Pairwise message 4 - Replay Counter, MIC + if (PeerWpaMessageSanity + (pAd, pMsg4, MsgLen, EAPOL_PAIR_MSG_4, pEntry) == FALSE) break; - // 3. uses the MLME.SETKEYS.request to configure PTK into MAC - NdisZeroMemory(&pEntry->PairwiseKey, sizeof(CIPHER_KEY)); + // 3. uses the MLME.SETKEYS.request to configure PTK into MAC + NdisZeroMemory(&pEntry->PairwiseKey, sizeof(CIPHER_KEY)); // reset IVEIV in Asic AsicUpdateWCIDIVEIV(pAd, pEntry->Aid, 1, 0); - pEntry->PairwiseKey.KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pEntry->PairwiseKey.Key, &pEntry->PTK[32], LEN_TKIP_EK); - NdisMoveMemory(pEntry->PairwiseKey.RxMic, &pEntry->PTK[TKIP_AP_RXMICK_OFFSET], LEN_TKIP_RXMICK); - NdisMoveMemory(pEntry->PairwiseKey.TxMic, &pEntry->PTK[TKIP_AP_TXMICK_OFFSET], LEN_TKIP_TXMICK); + pEntry->PairwiseKey.KeyLen = LEN_TKIP_EK; + NdisMoveMemory(pEntry->PairwiseKey.Key, &pEntry->PTK[32], + LEN_TKIP_EK); + NdisMoveMemory(pEntry->PairwiseKey.RxMic, + &pEntry->PTK[TKIP_AP_RXMICK_OFFSET], + LEN_TKIP_RXMICK); + NdisMoveMemory(pEntry->PairwiseKey.TxMic, + &pEntry->PTK[TKIP_AP_TXMICK_OFFSET], + LEN_TKIP_TXMICK); // Set pairwise key to Asic - { - pEntry->PairwiseKey.CipherAlg = CIPHER_NONE; - if (pEntry->WepStatus == Ndis802_11Encryption2Enabled) - pEntry->PairwiseKey.CipherAlg = CIPHER_TKIP; - else if (pEntry->WepStatus == Ndis802_11Encryption3Enabled) - pEntry->PairwiseKey.CipherAlg = CIPHER_AES; + { + pEntry->PairwiseKey.CipherAlg = CIPHER_NONE; + if (pEntry->WepStatus == Ndis802_11Encryption2Enabled) + pEntry->PairwiseKey.CipherAlg = CIPHER_TKIP; + else if (pEntry->WepStatus == + Ndis802_11Encryption3Enabled) + pEntry->PairwiseKey.CipherAlg = CIPHER_AES; // Add Pair-wise key to Asic - AsicAddPairwiseKeyEntry( - pAd, - pEntry->Addr, - (UCHAR)pEntry->Aid, - &pEntry->PairwiseKey); + AsicAddPairwiseKeyEntry(pAd, + pEntry->Addr, + (UCHAR) pEntry->Aid, + &pEntry->PairwiseKey); // update WCID attribute table and IVEIV table for this entry - RTMPAddWcidAttributeEntry( - pAd, - pEntry->apidx, - 0, - pEntry->PairwiseKey.CipherAlg, - pEntry); - } - - // 4. upgrade state - pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; - pEntry->WpaState = AS_PTKINITDONE; - pEntry->PortSecured = WPA_802_1X_PORT_SECURED; + RTMPAddWcidAttributeEntry(pAd, + pEntry->apidx, + 0, + pEntry->PairwiseKey.CipherAlg, + pEntry); + } + // 4. upgrade state + pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; + pEntry->WpaState = AS_PTKINITDONE; + pEntry->PortSecured = WPA_802_1X_PORT_SECURED; if (pEntry->AuthMode == Ndis802_11AuthModeWPA2 || - pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK) - { + pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK) { pEntry->GTKState = REKEY_ESTABLISHED; RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); - // send wireless event - for set key done WPA2 if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_SET_KEY_DONE_WPA2_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); - - DBGPRINT(RT_DEBUG_OFF, ("AP SETKEYS DONE - WPA2, AuthMode(%d)=%s, WepStatus(%d)=%s, GroupWepStatus(%d)=%s\n\n", - pEntry->AuthMode, GetAuthMode(pEntry->AuthMode), - pEntry->WepStatus, GetEncryptType(pEntry->WepStatus), - group_cipher, - GetEncryptType(group_cipher))); + RTMPSendWirelessEvent(pAd, + IW_SET_KEY_DONE_WPA2_EVENT_FLAG, + pEntry->Addr, + pEntry->apidx, 0); + + DBGPRINT(RT_DEBUG_OFF, + ("AP SETKEYS DONE - WPA2, AuthMode(%d)=%s, WepStatus(%d)=%s, GroupWepStatus(%d)=%s\n\n", + pEntry->AuthMode, + GetAuthMode(pEntry->AuthMode), + pEntry->WepStatus, + GetEncryptType(pEntry->WepStatus), + group_cipher, GetEncryptType(group_cipher))); + } else { + // 5. init Group 2-way handshake if necessary. + WPAStart2WayGroupHS(pAd, pEntry); + + pEntry->ReTryCounter = GROUP_MSG1_RETRY_TIMER_CTR; + RTMPModTimer(&pEntry->RetryTimer, + PEER_MSG3_RETRY_EXEC_INTV); } - else - { - // 5. init Group 2-way handshake if necessary. - WPAStart2WayGroupHS(pAd, pEntry); - - pEntry->ReTryCounter = GROUP_MSG1_RETRY_TIMER_CTR; - RTMPModTimer(&pEntry->RetryTimer, PEER_MSG3_RETRY_EXEC_INTV); - } - }while(FALSE); + } while (FALSE); } @@ -991,57 +990,49 @@ VOID PeerPairMsg4Action( ========================================================================== */ -VOID WPAStart2WayGroupHS( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry) +VOID WPAStart2WayGroupHS(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) { - UCHAR Header802_3[14]; - UCHAR TxTsc[6]; - EAPOL_PACKET EAPOLPKT; - UCHAR group_cipher = Ndis802_11WEPDisabled; - UCHAR default_key = 0; - PUINT8 gnonce_ptr = NULL; - PUINT8 gtk_ptr = NULL; - PUINT8 pBssid = NULL; + UCHAR Header802_3[14]; + UCHAR TxTsc[6]; + EAPOL_PACKET EAPOLPKT; + UCHAR group_cipher = Ndis802_11WEPDisabled; + UCHAR default_key = 0; + PUINT8 gnonce_ptr = NULL; + PUINT8 gtk_ptr = NULL; + PUINT8 pBssid = NULL; DBGPRINT(RT_DEBUG_TRACE, ("===> WPAStart2WayGroupHS\n")); - if ((!pEntry) || (!pEntry->ValidAsCLI)) - return; - + if ((!pEntry) || (!pEntry->ValidAsCLI)) + return; - do - { - // Increment replay counter by 1 + do { + // Increment replay counter by 1 ADD_ONE_To_64BIT_VAR(pEntry->R_Counter); // Construct EAPoL message - Group Msg 1 NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); ConstructEapolMsg(pEntry, - group_cipher, - EAPOL_GROUP_MSG_1, - default_key, - (UCHAR *)gnonce_ptr, - TxTsc, - (UCHAR *)gtk_ptr, - NULL, - 0, - &EAPOLPKT); + group_cipher, + EAPOL_GROUP_MSG_1, + default_key, + (UCHAR *) gnonce_ptr, + TxTsc, (UCHAR *) gtk_ptr, NULL, 0, &EAPOLPKT); // Make outgoing frame - MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pBssid, EAPOL); - RTMPToWirelessSta(pAd, pEntry, - Header802_3, LENGTH_802_3, - (PUCHAR)&EAPOLPKT, - CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, FALSE); + MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pBssid, EAPOL); + RTMPToWirelessSta(pAd, pEntry, + Header802_3, LENGTH_802_3, + (PUCHAR) & EAPOLPKT, + CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, + FALSE); + } while (FALSE); + DBGPRINT(RT_DEBUG_TRACE, + ("<=== WPAStart2WayGroupHS : send out Group Message 1 \n")); - }while (FALSE); - - DBGPRINT(RT_DEBUG_TRACE, ("<=== WPAStart2WayGroupHS : send out Group Message 1 \n")); - - return; + return; } /* @@ -1061,24 +1052,22 @@ VOID WPAStart2WayGroupHS( ======================================================================== */ -VOID PeerGroupMsg1Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerGroupMsg1Action(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Header802_3[14]; - EAPOL_PACKET EAPOLPKT; - PEAPOL_PACKET pGroup; - UINT MsgLen; - BOOLEAN Cancelled; - UCHAR default_key = 0; - UCHAR group_cipher = Ndis802_11WEPDisabled; - PUINT8 pCurrentAddr = NULL; + UCHAR Header802_3[14]; + EAPOL_PACKET EAPOLPKT; + PEAPOL_PACKET pGroup; + UINT MsgLen; + BOOLEAN Cancelled; + UCHAR default_key = 0; + UCHAR group_cipher = Ndis802_11WEPDisabled; + PUINT8 pCurrentAddr = NULL; DBGPRINT(RT_DEBUG_TRACE, ("===> PeerGroupMsg1Action \n")); if ((!pEntry) || ((!pEntry->ValidAsCLI) && (!pEntry->ValidAsApCli))) - return; + return; { pCurrentAddr = pAd->CurrentAddress; @@ -1087,53 +1076,52 @@ VOID PeerGroupMsg1Action( } // Process Group Message 1 frame. skip 802.11 header(24) & LLC_SNAP header(8) - pGroup = (PEAPOL_PACKET) &Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; + pGroup = (PEAPOL_PACKET) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; // Sanity Check peer group message 1 - Replay Counter, MIC, RSNIE - if (PeerWpaMessageSanity(pAd, pGroup, MsgLen, EAPOL_GROUP_MSG_1, pEntry) == FALSE) + if (PeerWpaMessageSanity(pAd, pGroup, MsgLen, EAPOL_GROUP_MSG_1, pEntry) + == FALSE) return; // delete retry timer RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); // Save Replay counter, it will use to construct message 2 - NdisMoveMemory(pEntry->R_Counter, pGroup->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); + NdisMoveMemory(pEntry->R_Counter, pGroup->KeyDesc.ReplayCounter, + LEN_KEY_DESC_REPLAY); // Construct EAPoL message - Group Msg 2 NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); - ConstructEapolMsg(pEntry, - group_cipher, - EAPOL_GROUP_MSG_2, - default_key, - NULL, // Nonce not used - NULL, // TxRSC not used - NULL, // GTK not used - NULL, // RSN IE not used - 0, - &EAPOLPKT); - - // open 802.1x port control and privacy filter + ConstructEapolMsg(pEntry, group_cipher, EAPOL_GROUP_MSG_2, default_key, NULL, // Nonce not used + NULL, // TxRSC not used + NULL, // GTK not used + NULL, // RSN IE not used + 0, &EAPOLPKT); + + // open 802.1x port control and privacy filter pEntry->PortSecured = WPA_802_1X_PORT_SECURED; pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; STA_PORT_SECURED(pAd); - // Indicate Connected for GUI - pAd->IndicateMediaState = NdisMediaStateConnected; + // Indicate Connected for GUI + pAd->IndicateMediaState = NdisMediaStateConnected; - DBGPRINT(RT_DEBUG_TRACE, ("PeerGroupMsg1Action: AuthMode(%s) PairwiseCipher(%s) GroupCipher(%s) \n", - GetAuthMode(pEntry->AuthMode), - GetEncryptType(pEntry->WepStatus), - GetEncryptType(group_cipher))); + DBGPRINT(RT_DEBUG_TRACE, + ("PeerGroupMsg1Action: AuthMode(%s) PairwiseCipher(%s) GroupCipher(%s) \n", + GetAuthMode(pEntry->AuthMode), + GetEncryptType(pEntry->WepStatus), + GetEncryptType(group_cipher))); // init header and Fill Packet and send Msg 2 to authenticator MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pCurrentAddr, EAPOL); RTMPToWirelessSta(pAd, pEntry, - Header802_3, sizeof(Header802_3), - (PUCHAR)&EAPOLPKT, - CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, FALSE); + Header802_3, sizeof(Header802_3), + (PUCHAR) & EAPOLPKT, + CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, FALSE); - DBGPRINT(RT_DEBUG_TRACE, ("<=== PeerGroupMsg1Action: sned group message 2\n")); + DBGPRINT(RT_DEBUG_TRACE, + ("<=== PeerGroupMsg1Action: sned group message 2\n")); } /* @@ -1143,68 +1131,77 @@ VOID PeerGroupMsg1Action( Return: ========================================================================== */ -VOID PeerGroupMsg2Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN VOID *Msg, - IN UINT MsgLen) +VOID PeerGroupMsg2Action(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, + IN VOID * Msg, IN UINT MsgLen) { - UINT Len; - PUCHAR pData; - BOOLEAN Cancelled; - PEAPOL_PACKET pMsg2; - UCHAR group_cipher = Ndis802_11WEPDisabled; + UINT Len; + PUCHAR pData; + BOOLEAN Cancelled; + PEAPOL_PACKET pMsg2; + UCHAR group_cipher = Ndis802_11WEPDisabled; DBGPRINT(RT_DEBUG_TRACE, ("===> PeerGroupMsg2Action \n")); - do - { - if ((!pEntry) || (!pEntry->ValidAsCLI)) - break; - - if (MsgLen < (LENGTH_802_1_H + LENGTH_EAPOL_H + sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) - break; + do { + if ((!pEntry) || (!pEntry->ValidAsCLI)) + break; - if (pEntry->WpaState != AS_PTKINITDONE) - break; + if (MsgLen < + (LENGTH_802_1_H + LENGTH_EAPOL_H + sizeof(KEY_DESCRIPTER) - + MAX_LEN_OF_RSNIE - 2)) + break; + if (pEntry->WpaState != AS_PTKINITDONE) + break; - pData = (PUCHAR)Msg; + pData = (PUCHAR) Msg; pMsg2 = (PEAPOL_PACKET) (pData + LENGTH_802_1_H); - Len = MsgLen - LENGTH_802_1_H; + Len = MsgLen - LENGTH_802_1_H; // Sanity Check peer group message 2 - Replay Counter, MIC - if (PeerWpaMessageSanity(pAd, pMsg2, Len, EAPOL_GROUP_MSG_2, pEntry) == FALSE) - break; + if (PeerWpaMessageSanity + (pAd, pMsg2, Len, EAPOL_GROUP_MSG_2, pEntry) == FALSE) + break; - // 3. upgrade state + // 3. upgrade state RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); - pEntry->GTKState = REKEY_ESTABLISHED; + pEntry->GTKState = REKEY_ESTABLISHED; - if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) || (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) - { + if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) + || (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) { // send wireless event - for set key done WPA2 if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_SET_KEY_DONE_WPA2_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); - - DBGPRINT(RT_DEBUG_OFF, ("AP SETKEYS DONE - WPA2, AuthMode(%d)=%s, WepStatus(%d)=%s, GroupWepStatus(%d)=%s\n\n", - pEntry->AuthMode, GetAuthMode(pEntry->AuthMode), - pEntry->WepStatus, GetEncryptType(pEntry->WepStatus), - group_cipher, GetEncryptType(group_cipher))); - } - else - { + RTMPSendWirelessEvent(pAd, + IW_SET_KEY_DONE_WPA2_EVENT_FLAG, + pEntry->Addr, + pEntry->apidx, 0); + + DBGPRINT(RT_DEBUG_OFF, + ("AP SETKEYS DONE - WPA2, AuthMode(%d)=%s, WepStatus(%d)=%s, GroupWepStatus(%d)=%s\n\n", + pEntry->AuthMode, + GetAuthMode(pEntry->AuthMode), + pEntry->WepStatus, + GetEncryptType(pEntry->WepStatus), + group_cipher, GetEncryptType(group_cipher))); + } else { // send wireless event - for set key done WPA if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_SET_KEY_DONE_WPA1_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); - - DBGPRINT(RT_DEBUG_OFF, ("AP SETKEYS DONE - WPA1, AuthMode(%d)=%s, WepStatus(%d)=%s, GroupWepStatus(%d)=%s\n\n", - pEntry->AuthMode, GetAuthMode(pEntry->AuthMode), - pEntry->WepStatus, GetEncryptType(pEntry->WepStatus), - group_cipher, GetEncryptType(group_cipher))); + RTMPSendWirelessEvent(pAd, + IW_SET_KEY_DONE_WPA1_EVENT_FLAG, + pEntry->Addr, + pEntry->apidx, 0); + + DBGPRINT(RT_DEBUG_OFF, + ("AP SETKEYS DONE - WPA1, AuthMode(%d)=%s, WepStatus(%d)=%s, GroupWepStatus(%d)=%s\n\n", + pEntry->AuthMode, + GetAuthMode(pEntry->AuthMode), + pEntry->WepStatus, + GetEncryptType(pEntry->WepStatus), + group_cipher, GetEncryptType(group_cipher))); } - }while(FALSE); + } while (FALSE); } /* @@ -1229,29 +1226,26 @@ VOID PeerGroupMsg2Action( ======================================================================== */ -BOOLEAN WpaMsgTypeSubst( - IN UCHAR EAPType, - OUT INT *MsgType) +BOOLEAN WpaMsgTypeSubst(IN UCHAR EAPType, OUT INT * MsgType) { - switch (EAPType) - { - case EAPPacket: - *MsgType = MT2_EAPPacket; - break; - case EAPOLStart: - *MsgType = MT2_EAPOLStart; - break; - case EAPOLLogoff: - *MsgType = MT2_EAPOLLogoff; - break; - case EAPOLKey: - *MsgType = MT2_EAPOLKey; - break; - case EAPOLASFAlert: - *MsgType = MT2_EAPOLASFAlert; - break; - default: - return FALSE; + switch (EAPType) { + case EAPPacket: + *MsgType = MT2_EAPPacket; + break; + case EAPOLStart: + *MsgType = MT2_EAPOLStart; + break; + case EAPOLLogoff: + *MsgType = MT2_EAPOLLogoff; + break; + case EAPOLKey: + *MsgType = MT2_EAPOLKey; + break; + case EAPOLASFAlert: + *MsgType = MT2_EAPOLASFAlert; + break; + default: + return FALSE; } return TRUE; } @@ -1283,39 +1277,33 @@ BOOLEAN WpaMsgTypeSubst( ======================================================================== */ -VOID PRF( - IN UCHAR *key, - IN INT key_len, - IN UCHAR *prefix, - IN INT prefix_len, - IN UCHAR *data, - IN INT data_len, - OUT UCHAR *output, - IN INT len) +VOID PRF(IN UCHAR * key, + IN INT key_len, + IN UCHAR * prefix, + IN INT prefix_len, + IN UCHAR * data, IN INT data_len, OUT UCHAR * output, IN INT len) { - INT i; - UCHAR *input; - INT currentindex = 0; - INT total_len; + INT i; + UCHAR *input; + INT currentindex = 0; + INT total_len; // Allocate memory for input - os_alloc_mem(NULL, (PUCHAR *)&input, 1024); - - if (input == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("!!!PRF: no memory!!!\n")); - return; - } + os_alloc_mem(NULL, (PUCHAR *) & input, 1024); + if (input == NULL) { + DBGPRINT(RT_DEBUG_ERROR, ("!!!PRF: no memory!!!\n")); + return; + } // Generate concatenation input NdisMoveMemory(input, prefix, prefix_len); // Concatenate a single octet containing 0 - input[prefix_len] = 0; + input[prefix_len] = 0; // Concatenate specific data NdisMoveMemory(&input[prefix_len + 1], data, data_len); - total_len = prefix_len + 1 + data_len; + total_len = prefix_len + 1 + data_len; // Concatenate a single octet containing 0 // This octet shall be update later @@ -1324,15 +1312,15 @@ VOID PRF( // Iterate to calculate the result by hmac-sha-1 // Then concatenate to last result - for (i = 0; i < (len + 19) / 20; i++) - { - HMAC_SHA1(key, key_len, input, total_len, &output[currentindex], SHA1_DIGEST_SIZE); - currentindex += 20; + for (i = 0; i < (len + 19) / 20; i++) { + HMAC_SHA1(key, key_len, input, total_len, &output[currentindex], + SHA1_DIGEST_SIZE); + currentindex += 20; // update the last octet input[total_len - 1]++; } - os_free_mem(NULL, input); + os_free_mem(NULL, input); } /* @@ -1342,34 +1330,33 @@ VOID PRF( * Uc = PRF(P, Uc-1) */ -static void F(char *password, unsigned char *ssid, int ssidlength, int iterations, int count, unsigned char *output) +static void F(char *password, unsigned char *ssid, int ssidlength, + int iterations, int count, unsigned char *output) { - unsigned char digest[36], digest1[SHA1_DIGEST_SIZE]; - int i, j; - - /* U1 = PRF(P, S || int(i)) */ - memcpy(digest, ssid, ssidlength); - digest[ssidlength] = (unsigned char)((count>>24) & 0xff); - digest[ssidlength+1] = (unsigned char)((count>>16) & 0xff); - digest[ssidlength+2] = (unsigned char)((count>>8) & 0xff); - digest[ssidlength+3] = (unsigned char)(count & 0xff); - HMAC_SHA1((unsigned char*) password, (int) strlen(password), digest, ssidlength+4, digest1, SHA1_DIGEST_SIZE); // for WPA update - - /* output = U1 */ - memcpy(output, digest1, SHA1_DIGEST_SIZE); - - for (i = 1; i < iterations; i++) - { - /* Un = PRF(P, Un-1) */ - HMAC_SHA1((unsigned char*) password, (int) strlen(password), digest1, SHA1_DIGEST_SIZE, digest, SHA1_DIGEST_SIZE); // for WPA update - memcpy(digest1, digest, SHA1_DIGEST_SIZE); - - /* output = output xor Un */ - for (j = 0; j < SHA1_DIGEST_SIZE; j++) - { - output[j] ^= digest[j]; - } - } + unsigned char digest[36], digest1[SHA1_DIGEST_SIZE]; + int i, j; + + /* U1 = PRF(P, S || int(i)) */ + memcpy(digest, ssid, ssidlength); + digest[ssidlength] = (unsigned char)((count >> 24) & 0xff); + digest[ssidlength + 1] = (unsigned char)((count >> 16) & 0xff); + digest[ssidlength + 2] = (unsigned char)((count >> 8) & 0xff); + digest[ssidlength + 3] = (unsigned char)(count & 0xff); + HMAC_SHA1((unsigned char *)password, (int)strlen(password), digest, ssidlength + 4, digest1, SHA1_DIGEST_SIZE); // for WPA update + + /* output = U1 */ + memcpy(output, digest1, SHA1_DIGEST_SIZE); + + for (i = 1; i < iterations; i++) { + /* Un = PRF(P, Un-1) */ + HMAC_SHA1((unsigned char *)password, (int)strlen(password), digest1, SHA1_DIGEST_SIZE, digest, SHA1_DIGEST_SIZE); // for WPA update + memcpy(digest1, digest, SHA1_DIGEST_SIZE); + + /* output = output xor Un */ + for (j = 0; j < SHA1_DIGEST_SIZE; j++) { + output[j] ^= digest[j]; + } + } } /* @@ -1380,16 +1367,14 @@ static void F(char *password, unsigned char *ssid, int ssidlength, int iteration */ int PasswordHash(PSTRING password, PUCHAR ssid, INT ssidlength, PUCHAR output) { - if ((strlen(password) > 63) || (ssidlength > 32)) - return 0; + if ((strlen(password) > 63) || (ssidlength > 32)) + return 0; - F(password, ssid, ssidlength, 4096, 1, output); - F(password, ssid, ssidlength, 4096, 2, &output[SHA1_DIGEST_SIZE]); - return 1; + F(password, ssid, ssidlength, 4096, 1, output); + F(password, ssid, ssidlength, 4096, 2, &output[SHA1_DIGEST_SIZE]); + return 1; } - - /* ======================================================================== @@ -1414,21 +1399,20 @@ int PasswordHash(PSTRING password, PUCHAR ssid, INT ssidlength, PUCHAR output) ======================================================================== */ -VOID WpaDerivePTK( - IN PRTMP_ADAPTER pAd, - IN UCHAR *PMK, - IN UCHAR *ANonce, - IN UCHAR *AA, - IN UCHAR *SNonce, - IN UCHAR *SA, - OUT UCHAR *output, - IN UINT len) +VOID WpaDerivePTK(IN PRTMP_ADAPTER pAd, + IN UCHAR * PMK, + IN UCHAR * ANonce, + IN UCHAR * AA, + IN UCHAR * SNonce, + IN UCHAR * SA, OUT UCHAR * output, IN UINT len) { - UCHAR concatenation[76]; - UINT CurrPos = 0; - UCHAR temp[32]; - UCHAR Prefix[] = {'P', 'a', 'i', 'r', 'w', 'i', 's', 'e', ' ', 'k', 'e', 'y', ' ', - 'e', 'x', 'p', 'a', 'n', 's', 'i', 'o', 'n'}; + UCHAR concatenation[76]; + UINT CurrPos = 0; + UCHAR temp[32]; + UCHAR Prefix[] = + { 'P', 'a', 'i', 'r', 'w', 'i', 's', 'e', ' ', 'k', 'e', 'y', ' ', + 'e', 'x', 'p', 'a', 'n', 's', 'i', 'o', 'n' + }; // initiate the concatenation input NdisZeroMemory(temp, sizeof(temp)); @@ -1494,46 +1478,43 @@ VOID WpaDerivePTK( ======================================================================== */ -VOID GenRandom( - IN PRTMP_ADAPTER pAd, - IN UCHAR *macAddr, - OUT UCHAR *random) +VOID GenRandom(IN PRTMP_ADAPTER pAd, IN UCHAR * macAddr, OUT UCHAR * random) { - INT i, curr; - UCHAR local[80], KeyCounter[32]; - UCHAR result[80]; - ULONG CurrentTime; - UCHAR prefix[] = {'I', 'n', 'i', 't', ' ', 'C', 'o', 'u', 'n', 't', 'e', 'r'}; + INT i, curr; + UCHAR local[80], KeyCounter[32]; + UCHAR result[80]; + ULONG CurrentTime; + UCHAR prefix[] = + { 'I', 'n', 'i', 't', ' ', 'C', 'o', 'u', 'n', 't', 'e', 'r' }; // Zero the related information NdisZeroMemory(result, 80); NdisZeroMemory(local, 80); NdisZeroMemory(KeyCounter, 32); - for (i = 0; i < 32; i++) - { + for (i = 0; i < 32; i++) { // copy the local MAC address COPY_MAC_ADDR(local, macAddr); - curr = MAC_ADDR_LEN; + curr = MAC_ADDR_LEN; // concatenate the current time NdisGetSystemUpTime(&CurrentTime); - NdisMoveMemory(&local[curr], &CurrentTime, sizeof(CurrentTime)); - curr += sizeof(CurrentTime); + NdisMoveMemory(&local[curr], &CurrentTime, sizeof(CurrentTime)); + curr += sizeof(CurrentTime); // concatenate the last result - NdisMoveMemory(&local[curr], result, 32); - curr += 32; + NdisMoveMemory(&local[curr], result, 32); + curr += 32; // concatenate a variable - NdisMoveMemory(&local[curr], &i, 2); - curr += 2; + NdisMoveMemory(&local[curr], &i, 2); + curr += 2; // calculate the result - PRF(KeyCounter, 32, prefix,12, local, curr, result, 32); + PRF(KeyCounter, 32, prefix, 12, local, curr, result, 32); } - NdisMoveMemory(random, result, 32); + NdisMoveMemory(random, result, 32); } /* @@ -1556,170 +1537,169 @@ VOID GenRandom( ======================================================================== */ -static VOID RTMPMakeRsnIeCipher( - IN PRTMP_ADAPTER pAd, - IN UCHAR ElementID, - IN UINT WepStatus, - IN BOOLEAN bMixCipher, - IN UCHAR FlexibleCipher, - OUT PUCHAR pRsnIe, - OUT UCHAR *rsn_len) +static VOID RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, + IN UCHAR ElementID, + IN UINT WepStatus, + IN BOOLEAN bMixCipher, + IN UCHAR FlexibleCipher, + OUT PUCHAR pRsnIe, OUT UCHAR * rsn_len) { - UCHAR PairwiseCnt; + UCHAR PairwiseCnt; *rsn_len = 0; // decide WPA2 or WPA1 - if (ElementID == Wpa2Ie) - { - RSNIE2 *pRsnie_cipher = (RSNIE2*)pRsnIe; + if (ElementID == Wpa2Ie) { + RSNIE2 *pRsnie_cipher = (RSNIE2 *) pRsnIe; // Assign the verson as 1 pRsnie_cipher->version = 1; - switch (WepStatus) - { - // TKIP mode - case Ndis802_11Encryption2Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_TKIP, 4); - pRsnie_cipher->ucount = 1; - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_TKIP, 4); - *rsn_len = sizeof(RSNIE2); - break; + switch (WepStatus) { + // TKIP mode + case Ndis802_11Encryption2Enabled: + NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_TKIP, 4); + pRsnie_cipher->ucount = 1; + NdisMoveMemory(pRsnie_cipher->ucast[0].oui, + OUI_WPA2_TKIP, 4); + *rsn_len = sizeof(RSNIE2); + break; // AES mode - case Ndis802_11Encryption3Enabled: - if (bMixCipher) - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_TKIP, 4); - else - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_CCMP, 4); - pRsnie_cipher->ucount = 1; - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_CCMP, 4); - *rsn_len = sizeof(RSNIE2); - break; + case Ndis802_11Encryption3Enabled: + if (bMixCipher) + NdisMoveMemory(pRsnie_cipher->mcast, + OUI_WPA2_TKIP, 4); + else + NdisMoveMemory(pRsnie_cipher->mcast, + OUI_WPA2_CCMP, 4); + pRsnie_cipher->ucount = 1; + NdisMoveMemory(pRsnie_cipher->ucast[0].oui, + OUI_WPA2_CCMP, 4); + *rsn_len = sizeof(RSNIE2); + break; // TKIP-AES mix mode - case Ndis802_11Encryption4Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_TKIP, 4); - - PairwiseCnt = 1; - // Insert WPA2 TKIP as the first pairwise cipher - if (MIX_CIPHER_WPA2_TKIP_ON(FlexibleCipher)) - { - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_TKIP, 4); - // Insert WPA2 AES as the secondary pairwise cipher - if (MIX_CIPHER_WPA2_AES_ON(FlexibleCipher)) - { - NdisMoveMemory(pRsnie_cipher->ucast[0].oui + 4, OUI_WPA2_CCMP, 4); - PairwiseCnt = 2; - } - } - else - { - // Insert WPA2 AES as the first pairwise cipher - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_CCMP, 4); + case Ndis802_11Encryption4Enabled: + NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_TKIP, 4); + + PairwiseCnt = 1; + // Insert WPA2 TKIP as the first pairwise cipher + if (MIX_CIPHER_WPA2_TKIP_ON(FlexibleCipher)) { + NdisMoveMemory(pRsnie_cipher->ucast[0].oui, + OUI_WPA2_TKIP, 4); + // Insert WPA2 AES as the secondary pairwise cipher + if (MIX_CIPHER_WPA2_AES_ON(FlexibleCipher)) { + NdisMoveMemory(pRsnie_cipher->ucast[0]. + oui + 4, OUI_WPA2_CCMP, + 4); + PairwiseCnt = 2; } + } else { + // Insert WPA2 AES as the first pairwise cipher + NdisMoveMemory(pRsnie_cipher->ucast[0].oui, + OUI_WPA2_CCMP, 4); + } - pRsnie_cipher->ucount = PairwiseCnt; - *rsn_len = sizeof(RSNIE2) + (4 * (PairwiseCnt - 1)); - break; - } + pRsnie_cipher->ucount = PairwiseCnt; + *rsn_len = sizeof(RSNIE2) + (4 * (PairwiseCnt - 1)); + break; + } if ((pAd->OpMode == OPMODE_STA) && - (pAd->StaCfg.GroupCipher != Ndis802_11Encryption2Enabled) && - (pAd->StaCfg.GroupCipher != Ndis802_11Encryption3Enabled)) - { - UINT GroupCipher = pAd->StaCfg.GroupCipher; - switch(GroupCipher) - { - case Ndis802_11GroupWEP40Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_WEP40, 4); - break; - case Ndis802_11GroupWEP104Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_WEP104, 4); - break; + (pAd->StaCfg.GroupCipher != Ndis802_11Encryption2Enabled) && + (pAd->StaCfg.GroupCipher != Ndis802_11Encryption3Enabled)) { + UINT GroupCipher = pAd->StaCfg.GroupCipher; + switch (GroupCipher) { + case Ndis802_11GroupWEP40Enabled: + NdisMoveMemory(pRsnie_cipher->mcast, + OUI_WPA2_WEP40, 4); + break; + case Ndis802_11GroupWEP104Enabled: + NdisMoveMemory(pRsnie_cipher->mcast, + OUI_WPA2_WEP104, 4); + break; } } - // swap for big-endian platform pRsnie_cipher->version = cpu2le16(pRsnie_cipher->version); - pRsnie_cipher->ucount = cpu2le16(pRsnie_cipher->ucount); - } - else - { - RSNIE *pRsnie_cipher = (RSNIE*)pRsnIe; + pRsnie_cipher->ucount = cpu2le16(pRsnie_cipher->ucount); + } else { + RSNIE *pRsnie_cipher = (RSNIE *) pRsnIe; // Assign OUI and version NdisMoveMemory(pRsnie_cipher->oui, OUI_WPA_VERSION, 4); - pRsnie_cipher->version = 1; + pRsnie_cipher->version = 1; - switch (WepStatus) - { + switch (WepStatus) { // TKIP mode - case Ndis802_11Encryption2Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_TKIP, 4); - pRsnie_cipher->ucount = 1; - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_TKIP, 4); - *rsn_len = sizeof(RSNIE); - break; + case Ndis802_11Encryption2Enabled: + NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_TKIP, 4); + pRsnie_cipher->ucount = 1; + NdisMoveMemory(pRsnie_cipher->ucast[0].oui, + OUI_WPA_TKIP, 4); + *rsn_len = sizeof(RSNIE); + break; // AES mode - case Ndis802_11Encryption3Enabled: - if (bMixCipher) - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_TKIP, 4); - else - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_CCMP, 4); - pRsnie_cipher->ucount = 1; - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_CCMP, 4); - *rsn_len = sizeof(RSNIE); - break; + case Ndis802_11Encryption3Enabled: + if (bMixCipher) + NdisMoveMemory(pRsnie_cipher->mcast, + OUI_WPA_TKIP, 4); + else + NdisMoveMemory(pRsnie_cipher->mcast, + OUI_WPA_CCMP, 4); + pRsnie_cipher->ucount = 1; + NdisMoveMemory(pRsnie_cipher->ucast[0].oui, + OUI_WPA_CCMP, 4); + *rsn_len = sizeof(RSNIE); + break; // TKIP-AES mix mode - case Ndis802_11Encryption4Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_TKIP, 4); - - PairwiseCnt = 1; - // Insert WPA TKIP as the first pairwise cipher - if (MIX_CIPHER_WPA_TKIP_ON(FlexibleCipher)) - { - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_TKIP, 4); - // Insert WPA AES as the secondary pairwise cipher - if (MIX_CIPHER_WPA_AES_ON(FlexibleCipher)) - { - NdisMoveMemory(pRsnie_cipher->ucast[0].oui + 4, OUI_WPA_CCMP, 4); - PairwiseCnt = 2; - } - } - else - { - // Insert WPA AES as the first pairwise cipher - NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_CCMP, 4); + case Ndis802_11Encryption4Enabled: + NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_TKIP, 4); + + PairwiseCnt = 1; + // Insert WPA TKIP as the first pairwise cipher + if (MIX_CIPHER_WPA_TKIP_ON(FlexibleCipher)) { + NdisMoveMemory(pRsnie_cipher->ucast[0].oui, + OUI_WPA_TKIP, 4); + // Insert WPA AES as the secondary pairwise cipher + if (MIX_CIPHER_WPA_AES_ON(FlexibleCipher)) { + NdisMoveMemory(pRsnie_cipher->ucast[0]. + oui + 4, OUI_WPA_CCMP, + 4); + PairwiseCnt = 2; } + } else { + // Insert WPA AES as the first pairwise cipher + NdisMoveMemory(pRsnie_cipher->ucast[0].oui, + OUI_WPA_CCMP, 4); + } - pRsnie_cipher->ucount = PairwiseCnt; - *rsn_len = sizeof(RSNIE) + (4 * (PairwiseCnt - 1)); - break; - } + pRsnie_cipher->ucount = PairwiseCnt; + *rsn_len = sizeof(RSNIE) + (4 * (PairwiseCnt - 1)); + break; + } if ((pAd->OpMode == OPMODE_STA) && - (pAd->StaCfg.GroupCipher != Ndis802_11Encryption2Enabled) && - (pAd->StaCfg.GroupCipher != Ndis802_11Encryption3Enabled)) - { - UINT GroupCipher = pAd->StaCfg.GroupCipher; - switch(GroupCipher) - { - case Ndis802_11GroupWEP40Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_WEP40, 4); - break; - case Ndis802_11GroupWEP104Enabled: - NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_WEP104, 4); - break; + (pAd->StaCfg.GroupCipher != Ndis802_11Encryption2Enabled) && + (pAd->StaCfg.GroupCipher != Ndis802_11Encryption3Enabled)) { + UINT GroupCipher = pAd->StaCfg.GroupCipher; + switch (GroupCipher) { + case Ndis802_11GroupWEP40Enabled: + NdisMoveMemory(pRsnie_cipher->mcast, + OUI_WPA_WEP40, 4); + break; + case Ndis802_11GroupWEP104Enabled: + NdisMoveMemory(pRsnie_cipher->mcast, + OUI_WPA_WEP104, 4); + break; } } - // swap for big-endian platform pRsnie_cipher->version = cpu2le16(pRsnie_cipher->version); - pRsnie_cipher->ucount = cpu2le16(pRsnie_cipher->ucount); + pRsnie_cipher->ucount = cpu2le16(pRsnie_cipher->ucount); } } @@ -1742,61 +1722,59 @@ static VOID RTMPMakeRsnIeCipher( ======================================================================== */ -static VOID RTMPMakeRsnIeAKM( - IN PRTMP_ADAPTER pAd, - IN UCHAR ElementID, - IN UINT AuthMode, - IN UCHAR apidx, - OUT PUCHAR pRsnIe, - OUT UCHAR *rsn_len) +static VOID RTMPMakeRsnIeAKM(IN PRTMP_ADAPTER pAd, + IN UCHAR ElementID, + IN UINT AuthMode, + IN UCHAR apidx, + OUT PUCHAR pRsnIe, OUT UCHAR * rsn_len) { - RSNIE_AUTH *pRsnie_auth; - UCHAR AkmCnt = 1; // default as 1 + RSNIE_AUTH *pRsnie_auth; + UCHAR AkmCnt = 1; // default as 1 - pRsnie_auth = (RSNIE_AUTH*)(pRsnIe + (*rsn_len)); + pRsnie_auth = (RSNIE_AUTH *) (pRsnIe + (*rsn_len)); // decide WPA2 or WPA1 - if (ElementID == Wpa2Ie) - { + if (ElementID == Wpa2Ie) { - switch (AuthMode) - { - case Ndis802_11AuthModeWPA2: - case Ndis802_11AuthModeWPA1WPA2: - NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA2_8021X_AKM, 4); - break; - - case Ndis802_11AuthModeWPA2PSK: - case Ndis802_11AuthModeWPA1PSKWPA2PSK: - NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA2_PSK_AKM, 4); - break; - default: - AkmCnt = 0; - break; + switch (AuthMode) { + case Ndis802_11AuthModeWPA2: + case Ndis802_11AuthModeWPA1WPA2: + NdisMoveMemory(pRsnie_auth->auth[0].oui, + OUI_WPA2_8021X_AKM, 4); + break; - } - } - else - { - switch (AuthMode) - { - case Ndis802_11AuthModeWPA: - case Ndis802_11AuthModeWPA1WPA2: - NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA_8021X_AKM, 4); - break; - - case Ndis802_11AuthModeWPAPSK: - case Ndis802_11AuthModeWPA1PSKWPA2PSK: - NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA_PSK_AKM, 4); - break; - - case Ndis802_11AuthModeWPANone: - NdisMoveMemory(pRsnie_auth->auth[0].oui, OUI_WPA_NONE_AKM, 4); - break; - default: - AkmCnt = 0; - break; - } + case Ndis802_11AuthModeWPA2PSK: + case Ndis802_11AuthModeWPA1PSKWPA2PSK: + NdisMoveMemory(pRsnie_auth->auth[0].oui, + OUI_WPA2_PSK_AKM, 4); + break; + default: + AkmCnt = 0; + break; + + } + } else { + switch (AuthMode) { + case Ndis802_11AuthModeWPA: + case Ndis802_11AuthModeWPA1WPA2: + NdisMoveMemory(pRsnie_auth->auth[0].oui, + OUI_WPA_8021X_AKM, 4); + break; + + case Ndis802_11AuthModeWPAPSK: + case Ndis802_11AuthModeWPA1PSKWPA2PSK: + NdisMoveMemory(pRsnie_auth->auth[0].oui, + OUI_WPA_PSK_AKM, 4); + break; + + case Ndis802_11AuthModeWPANone: + NdisMoveMemory(pRsnie_auth->auth[0].oui, + OUI_WPA_NONE_AKM, 4); + break; + default: + AkmCnt = 0; + break; + } } pRsnie_auth->acount = AkmCnt; @@ -1825,21 +1803,18 @@ static VOID RTMPMakeRsnIeAKM( ======================================================================== */ -static VOID RTMPMakeRsnIeCap( - IN PRTMP_ADAPTER pAd, - IN UCHAR ElementID, - IN UCHAR apidx, - OUT PUCHAR pRsnIe, - OUT UCHAR *rsn_len) +static VOID RTMPMakeRsnIeCap(IN PRTMP_ADAPTER pAd, + IN UCHAR ElementID, + IN UCHAR apidx, + OUT PUCHAR pRsnIe, OUT UCHAR * rsn_len) { - RSN_CAPABILITIES *pRSN_Cap; + RSN_CAPABILITIES *pRSN_Cap; // it could be ignored in WPA1 mode if (ElementID == WpaIe) return; - pRSN_Cap = (RSN_CAPABILITIES*)(pRsnIe + (*rsn_len)); - + pRSN_Cap = (RSN_CAPABILITIES *) (pRsnIe + (*rsn_len)); pRSN_Cap->word = cpu2le16(pRSN_Cap->word); @@ -1847,7 +1822,6 @@ static VOID RTMPMakeRsnIeCap( } - /* ======================================================================== @@ -1866,42 +1840,37 @@ static VOID RTMPMakeRsnIeCap( ======================================================================== */ -VOID RTMPMakeRSNIE( - IN PRTMP_ADAPTER pAd, - IN UINT AuthMode, - IN UINT WepStatus, - IN UCHAR apidx) +VOID RTMPMakeRSNIE(IN PRTMP_ADAPTER pAd, + IN UINT AuthMode, IN UINT WepStatus, IN UCHAR apidx) { - PUCHAR pRsnIe = NULL; // primary RSNIE - UCHAR *rsnielen_cur_p = 0; // the length of the primary RSNIE - UCHAR *rsnielen_ex_cur_p = 0; // the length of the secondary RSNIE - UCHAR PrimaryRsnie; - BOOLEAN bMixCipher = FALSE; // indicate the pairwise and group cipher are different - UCHAR p_offset; - WPA_MIX_PAIR_CIPHER FlexibleCipher = WPA_TKIPAES_WPA2_TKIPAES; // it provide the more flexible cipher combination in WPA-WPA2 and TKIPAES mode + PUCHAR pRsnIe = NULL; // primary RSNIE + UCHAR *rsnielen_cur_p = 0; // the length of the primary RSNIE + UCHAR *rsnielen_ex_cur_p = 0; // the length of the secondary RSNIE + UCHAR PrimaryRsnie; + BOOLEAN bMixCipher = FALSE; // indicate the pairwise and group cipher are different + UCHAR p_offset; + WPA_MIX_PAIR_CIPHER FlexibleCipher = WPA_TKIPAES_WPA2_TKIPAES; // it provide the more flexible cipher combination in WPA-WPA2 and TKIPAES mode rsnielen_cur_p = NULL; rsnielen_ex_cur_p = NULL; { { - if (pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) - { + if (pAd->StaCfg.WpaSupplicantUP != + WPA_SUPPLICANT_DISABLE) { if (AuthMode < Ndis802_11AuthModeWPA) return; - } - else - { + } else { // Support WPAPSK or WPA2PSK in STA-Infra mode // Support WPANone in STA-Adhoc mode if ((AuthMode != Ndis802_11AuthModeWPAPSK) && - (AuthMode != Ndis802_11AuthModeWPA2PSK) && - (AuthMode != Ndis802_11AuthModeWPANone) - ) + (AuthMode != Ndis802_11AuthModeWPA2PSK) && + (AuthMode != Ndis802_11AuthModeWPANone) + ) return; } - DBGPRINT(RT_DEBUG_TRACE,("==> RTMPMakeRSNIE(STA)\n")); + DBGPRINT(RT_DEBUG_TRACE, ("==> RTMPMakeRSNIE(STA)\n")); // Zero RSNIE context pAd->StaCfg.RSNIE_Len = 0; @@ -1917,10 +1886,10 @@ VOID RTMPMakeRSNIE( // indicate primary RSNIE as WPA or WPA2 if ((AuthMode == Ndis802_11AuthModeWPA) || - (AuthMode == Ndis802_11AuthModeWPAPSK) || - (AuthMode == Ndis802_11AuthModeWPANone) || - (AuthMode == Ndis802_11AuthModeWPA1WPA2) || - (AuthMode == Ndis802_11AuthModeWPA1PSKWPA2PSK)) + (AuthMode == Ndis802_11AuthModeWPAPSK) || + (AuthMode == Ndis802_11AuthModeWPANone) || + (AuthMode == Ndis802_11AuthModeWPA1WPA2) || + (AuthMode == Ndis802_11AuthModeWPA1PSKWPA2PSK)) PrimaryRsnie = WpaIe; else PrimaryRsnie = Wpa2Ie; @@ -1928,10 +1897,12 @@ VOID RTMPMakeRSNIE( { // Build the primary RSNIE // 1. insert cipher suite - RTMPMakeRsnIeCipher(pAd, PrimaryRsnie, WepStatus, bMixCipher, FlexibleCipher, pRsnIe, &p_offset); + RTMPMakeRsnIeCipher(pAd, PrimaryRsnie, WepStatus, bMixCipher, + FlexibleCipher, pRsnIe, &p_offset); // 2. insert AKM - RTMPMakeRsnIeAKM(pAd, PrimaryRsnie, AuthMode, apidx, pRsnIe, &p_offset); + RTMPMakeRsnIeAKM(pAd, PrimaryRsnie, AuthMode, apidx, pRsnIe, + &p_offset); // 3. insert capability RTMPMakeRsnIeCap(pAd, PrimaryRsnie, apidx, pRsnIe, &p_offset); @@ -1942,7 +1913,6 @@ VOID RTMPMakeRSNIE( hex_dump("The primary RSNIE", pRsnIe, (*rsnielen_cur_p)); - } /* @@ -1962,66 +1932,68 @@ VOID RTMPMakeRSNIE( FALSE - otherwise ========================================================================== */ -BOOLEAN RTMPCheckWPAframe( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR pData, - IN ULONG DataByteCount, - IN UCHAR FromWhichBSSID) +BOOLEAN RTMPCheckWPAframe(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, + IN PUCHAR pData, + IN ULONG DataByteCount, IN UCHAR FromWhichBSSID) { - ULONG Body_len; + ULONG Body_len; BOOLEAN Cancelled; - - if(DataByteCount < (LENGTH_802_1_H + LENGTH_EAPOL_H)) - return FALSE; - + if (DataByteCount < (LENGTH_802_1_H + LENGTH_EAPOL_H)) + return FALSE; // Skip LLC header - if (NdisEqualMemory(SNAP_802_1H, pData, 6) || - // Cisco 1200 AP may send packet with SNAP_BRIDGE_TUNNEL - NdisEqualMemory(SNAP_BRIDGE_TUNNEL, pData, 6)) - { - pData += 6; - } + if (NdisEqualMemory(SNAP_802_1H, pData, 6) || + // Cisco 1200 AP may send packet with SNAP_BRIDGE_TUNNEL + NdisEqualMemory(SNAP_BRIDGE_TUNNEL, pData, 6)) { + pData += 6; + } // Skip 2-bytes EAPoL type - if (NdisEqualMemory(EAPOL, pData, 2)) - { - pData += 2; - } - else - return FALSE; - - switch (*(pData+1)) - { - case EAPPacket: - Body_len = (*(pData+2)<<8) | (*(pData+3)); - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAP-Packet frame, TYPE = 0, Length = %ld\n", Body_len)); - break; - case EAPOLStart: - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOL-Start frame, TYPE = 1 \n")); - if (pEntry->EnqueueEapolStartTimerRunning != EAPOL_START_DISABLE) - { - DBGPRINT(RT_DEBUG_TRACE, ("Cancel the EnqueueEapolStartTimerRunning \n")); - RTMPCancelTimer(&pEntry->EnqueueStartForPSKTimer, &Cancelled); - pEntry->EnqueueEapolStartTimerRunning = EAPOL_START_DISABLE; - } - break; - case EAPOLLogoff: - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOLLogoff frame, TYPE = 2 \n")); - break; - case EAPOLKey: - Body_len = (*(pData+2)<<8) | (*(pData+3)); - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOL-Key frame, TYPE = 3, Length = %ld\n", Body_len)); - break; - case EAPOLASFAlert: - DBGPRINT(RT_DEBUG_TRACE, ("Receive EAPOLASFAlert frame, TYPE = 4 \n")); - break; - default: - return FALSE; - - } - return TRUE; + if (NdisEqualMemory(EAPOL, pData, 2)) { + pData += 2; + } else + return FALSE; + + switch (*(pData + 1)) { + case EAPPacket: + Body_len = (*(pData + 2) << 8) | (*(pData + 3)); + DBGPRINT(RT_DEBUG_TRACE, + ("Receive EAP-Packet frame, TYPE = 0, Length = %ld\n", + Body_len)); + break; + case EAPOLStart: + DBGPRINT(RT_DEBUG_TRACE, + ("Receive EAPOL-Start frame, TYPE = 1 \n")); + if (pEntry->EnqueueEapolStartTimerRunning != + EAPOL_START_DISABLE) { + DBGPRINT(RT_DEBUG_TRACE, + ("Cancel the EnqueueEapolStartTimerRunning \n")); + RTMPCancelTimer(&pEntry->EnqueueStartForPSKTimer, + &Cancelled); + pEntry->EnqueueEapolStartTimerRunning = + EAPOL_START_DISABLE; + } + break; + case EAPOLLogoff: + DBGPRINT(RT_DEBUG_TRACE, + ("Receive EAPOLLogoff frame, TYPE = 2 \n")); + break; + case EAPOLKey: + Body_len = (*(pData + 2) << 8) | (*(pData + 3)); + DBGPRINT(RT_DEBUG_TRACE, + ("Receive EAPOL-Key frame, TYPE = 3, Length = %ld\n", + Body_len)); + break; + case EAPOLASFAlert: + DBGPRINT(RT_DEBUG_TRACE, + ("Receive EAPOLASFAlert frame, TYPE = 4 \n")); + break; + default: + return FALSE; + + } + return TRUE; } /* @@ -2044,23 +2016,22 @@ BOOLEAN RTMPCheckWPAframe( */ PSTRING GetEapolMsgType(CHAR msg) { - if(msg == EAPOL_PAIR_MSG_1) - return "Pairwise Message 1"; - else if(msg == EAPOL_PAIR_MSG_2) - return "Pairwise Message 2"; - else if(msg == EAPOL_PAIR_MSG_3) - return "Pairwise Message 3"; - else if(msg == EAPOL_PAIR_MSG_4) - return "Pairwise Message 4"; - else if(msg == EAPOL_GROUP_MSG_1) - return "Group Message 1"; - else if(msg == EAPOL_GROUP_MSG_2) - return "Group Message 2"; - else - return "Invalid Message"; + if (msg == EAPOL_PAIR_MSG_1) + return "Pairwise Message 1"; + else if (msg == EAPOL_PAIR_MSG_2) + return "Pairwise Message 2"; + else if (msg == EAPOL_PAIR_MSG_3) + return "Pairwise Message 3"; + else if (msg == EAPOL_PAIR_MSG_4) + return "Pairwise Message 4"; + else if (msg == EAPOL_GROUP_MSG_1) + return "Group Message 1"; + else if (msg == EAPOL_GROUP_MSG_2) + return "Group Message 2"; + else + return "Invalid Message"; } - /* ======================================================================== @@ -2071,64 +2042,62 @@ PSTRING GetEapolMsgType(CHAR msg) Return Value: - ======================================================================== */ -BOOLEAN RTMPCheckRSNIE( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN UCHAR DataLen, - IN MAC_TABLE_ENTRY *pEntry, - OUT UCHAR *Offset) +BOOLEAN RTMPCheckRSNIE(IN PRTMP_ADAPTER pAd, + IN PUCHAR pData, + IN UCHAR DataLen, + IN MAC_TABLE_ENTRY * pEntry, OUT UCHAR * Offset) { - PUCHAR pVIE; - UCHAR len; - PEID_STRUCT pEid; - BOOLEAN result = FALSE; + PUCHAR pVIE; + UCHAR len; + PEID_STRUCT pEid; + BOOLEAN result = FALSE; pVIE = pData; - len = DataLen; + len = DataLen; *Offset = 0; - while (len > sizeof(RSNIE2)) - { + while (len > sizeof(RSNIE2)) { pEid = (PEID_STRUCT) pVIE; // WPA RSN IE - if ((pEid->Eid == IE_WPA) && (NdisEqualMemory(pEid->Octet, WPA_OUI, 4))) - { - if ((pEntry->AuthMode == Ndis802_11AuthModeWPA || pEntry->AuthMode == Ndis802_11AuthModeWPAPSK) && - (NdisEqualMemory(pVIE, pEntry->RSN_IE, pEntry->RSNIE_Len)) && - (pEntry->RSNIE_Len == (pEid->Len + 2))) - { - result = TRUE; + if ((pEid->Eid == IE_WPA) + && (NdisEqualMemory(pEid->Octet, WPA_OUI, 4))) { + if ((pEntry->AuthMode == Ndis802_11AuthModeWPA + || pEntry->AuthMode == Ndis802_11AuthModeWPAPSK) + && + (NdisEqualMemory + (pVIE, pEntry->RSN_IE, pEntry->RSNIE_Len)) + && (pEntry->RSNIE_Len == (pEid->Len + 2))) { + result = TRUE; } *Offset += (pEid->Len + 2); } // WPA2 RSN IE - else if ((pEid->Eid == IE_RSN) && (NdisEqualMemory(pEid->Octet + 2, RSN_OUI, 3))) - { - if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2 || pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK) && - (pEid->Eid == pEntry->RSN_IE[0]) && - ((pEid->Len + 2) >= pEntry->RSNIE_Len) && - (NdisEqualMemory(pEid->Octet, &pEntry->RSN_IE[2], pEntry->RSNIE_Len - 2))) - { - - result = TRUE; + else if ((pEid->Eid == IE_RSN) + && (NdisEqualMemory(pEid->Octet + 2, RSN_OUI, 3))) { + if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2 + || pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK) + && (pEid->Eid == pEntry->RSN_IE[0]) + && ((pEid->Len + 2) >= pEntry->RSNIE_Len) + && + (NdisEqualMemory + (pEid->Octet, &pEntry->RSN_IE[2], + pEntry->RSNIE_Len - 2))) { + + result = TRUE; } *Offset += (pEid->Len + 2); - } - else - { + } else { break; } pVIE += (pEid->Len + 2); - len -= (pEid->Len + 2); + len -= (pEid->Len + 2); } - return result; } @@ -2149,107 +2118,109 @@ BOOLEAN RTMPCheckRSNIE( ======================================================================== */ -BOOLEAN RTMPParseEapolKeyData( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKeyData, - IN UCHAR KeyDataLen, - IN UCHAR GroupKeyIndex, - IN UCHAR MsgType, - IN BOOLEAN bWPA2, - IN MAC_TABLE_ENTRY *pEntry) +BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, + IN PUCHAR pKeyData, + IN UCHAR KeyDataLen, + IN UCHAR GroupKeyIndex, + IN UCHAR MsgType, + IN BOOLEAN bWPA2, IN MAC_TABLE_ENTRY * pEntry) { - PKDE_ENCAP pKDE = NULL; - PUCHAR pMyKeyData = pKeyData; - UCHAR KeyDataLength = KeyDataLen; - UCHAR GTKLEN = 0; - UCHAR DefaultIdx = 0; - UCHAR skip_offset; + PKDE_ENCAP pKDE = NULL; + PUCHAR pMyKeyData = pKeyData; + UCHAR KeyDataLength = KeyDataLen; + UCHAR GTKLEN = 0; + UCHAR DefaultIdx = 0; + UCHAR skip_offset; // Verify The RSN IE contained in pairewise_msg_2 && pairewise_msg_3 and skip it - if (MsgType == EAPOL_PAIR_MSG_2 || MsgType == EAPOL_PAIR_MSG_3) - { + if (MsgType == EAPOL_PAIR_MSG_2 || MsgType == EAPOL_PAIR_MSG_3) { // Check RSN IE whether it is WPA2/WPA2PSK - if (!RTMPCheckRSNIE(pAd, pKeyData, KeyDataLen, pEntry, &skip_offset)) - { + if (!RTMPCheckRSNIE + (pAd, pKeyData, KeyDataLen, pEntry, &skip_offset)) { // send wireless event - for RSN IE different if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_RSNIE_DIFF_EVENT_FLAG, pEntry->Addr, pEntry->apidx, 0); - - DBGPRINT(RT_DEBUG_ERROR, ("RSN_IE Different in msg %d of 4-way handshake!\n", MsgType)); + RTMPSendWirelessEvent(pAd, + IW_RSNIE_DIFF_EVENT_FLAG, + pEntry->Addr, + pEntry->apidx, 0); + + DBGPRINT(RT_DEBUG_ERROR, + ("RSN_IE Different in msg %d of 4-way handshake!\n", + MsgType)); hex_dump("Receive RSN_IE ", pKeyData, KeyDataLen); - hex_dump("Desired RSN_IE ", pEntry->RSN_IE, pEntry->RSNIE_Len); + hex_dump("Desired RSN_IE ", pEntry->RSN_IE, + pEntry->RSNIE_Len); return FALSE; - } - else - { - if (bWPA2 && MsgType == EAPOL_PAIR_MSG_3) - { + } else { + if (bWPA2 && MsgType == EAPOL_PAIR_MSG_3) { WpaShowAllsuite(pMyKeyData, skip_offset); // skip RSN IE pMyKeyData += skip_offset; KeyDataLength -= skip_offset; - DBGPRINT(RT_DEBUG_TRACE, ("RTMPParseEapolKeyData ==> WPA2/WPA2PSK RSN IE matched in Msg 3, Length(%d) \n", skip_offset)); - } - else + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPParseEapolKeyData ==> WPA2/WPA2PSK RSN IE matched in Msg 3, Length(%d) \n", + skip_offset)); + } else return TRUE; } } - DBGPRINT(RT_DEBUG_TRACE,("RTMPParseEapolKeyData ==> KeyDataLength %d without RSN_IE \n", KeyDataLength)); + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPParseEapolKeyData ==> KeyDataLength %d without RSN_IE \n", + KeyDataLength)); //hex_dump("remain data", pMyKeyData, KeyDataLength); - // Parse EKD format in pairwise_msg_3_WPA2 && group_msg_1_WPA2 - if (bWPA2 && (MsgType == EAPOL_PAIR_MSG_3 || MsgType == EAPOL_GROUP_MSG_1)) - { + if (bWPA2 + && (MsgType == EAPOL_PAIR_MSG_3 || MsgType == EAPOL_GROUP_MSG_1)) { if (KeyDataLength >= 8) // KDE format exclude GTK length - { - pKDE = (PKDE_ENCAP) pMyKeyData; - + { + pKDE = (PKDE_ENCAP) pMyKeyData; DefaultIdx = pKDE->GTKEncap.Kid; // Sanity check - KED length - if (KeyDataLength < (pKDE->Len + 2)) - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR: The len from KDE is too short \n")); - return FALSE; - } - + if (KeyDataLength < (pKDE->Len + 2)) { + DBGPRINT(RT_DEBUG_ERROR, + ("ERROR: The len from KDE is too short \n")); + return FALSE; + } // Get GTK length - refer to IEEE 802.11i-2004 p.82 - GTKLEN = pKDE->Len -6; - if (GTKLEN < LEN_AES_KEY) - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR: GTK Key length is too short (%d) \n", GTKLEN)); - return FALSE; + GTKLEN = pKDE->Len - 6; + if (GTKLEN < LEN_AES_KEY) { + DBGPRINT(RT_DEBUG_ERROR, + ("ERROR: GTK Key length is too short (%d) \n", + GTKLEN)); + return FALSE; } - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR: KDE format length is too short \n")); - return FALSE; - } + } else { + DBGPRINT(RT_DEBUG_ERROR, + ("ERROR: KDE format length is too short \n")); + return FALSE; + } - DBGPRINT(RT_DEBUG_TRACE, ("GTK in KDE format ,DefaultKeyID=%d, KeyLen=%d \n", DefaultIdx, GTKLEN)); + DBGPRINT(RT_DEBUG_TRACE, + ("GTK in KDE format ,DefaultKeyID=%d, KeyLen=%d \n", + DefaultIdx, GTKLEN)); // skip it pMyKeyData += 8; KeyDataLength -= 8; - } - else if (!bWPA2 && MsgType == EAPOL_GROUP_MSG_1) - { + } else if (!bWPA2 && MsgType == EAPOL_GROUP_MSG_1) { DefaultIdx = GroupKeyIndex; - DBGPRINT(RT_DEBUG_TRACE, ("GTK DefaultKeyID=%d \n", DefaultIdx)); + DBGPRINT(RT_DEBUG_TRACE, + ("GTK DefaultKeyID=%d \n", DefaultIdx)); } - // Sanity check - shared key index must be 1 ~ 3 - if (DefaultIdx < 1 || DefaultIdx > 3) - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR: GTK Key index(%d) is invalid in %s %s \n", DefaultIdx, ((bWPA2) ? "WPA2" : "WPA"), GetEapolMsgType(MsgType))); - return FALSE; + if (DefaultIdx < 1 || DefaultIdx > 3) { + DBGPRINT(RT_DEBUG_ERROR, + ("ERROR: GTK Key index(%d) is invalid in %s %s \n", + DefaultIdx, ((bWPA2) ? "WPA2" : "WPA"), + GetEapolMsgType(MsgType))); + return FALSE; } { @@ -2265,43 +2236,43 @@ BOOLEAN RTMPParseEapolKeyData( NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); pSharedKey->KeyLen = LEN_TKIP_EK; NdisMoveMemory(pSharedKey->Key, pAd->StaCfg.GTK, LEN_TKIP_EK); - NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.GTK[16], LEN_TKIP_RXMICK); - NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.GTK[24], LEN_TKIP_TXMICK); + NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.GTK[16], + LEN_TKIP_RXMICK); + NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.GTK[24], + LEN_TKIP_TXMICK); // Update Shared Key CipherAlg pSharedKey->CipherAlg = CIPHER_NONE; if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption2Enabled) pSharedKey->CipherAlg = CIPHER_TKIP; - else if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption3Enabled) + else if (pAd->StaCfg.GroupCipher == + Ndis802_11Encryption3Enabled) pSharedKey->CipherAlg = CIPHER_AES; else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP40Enabled) pSharedKey->CipherAlg = CIPHER_WEP64; - else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP104Enabled) + else if (pAd->StaCfg.GroupCipher == + Ndis802_11GroupWEP104Enabled) pSharedKey->CipherAlg = CIPHER_WEP128; - // Update group key information to ASIC Shared Key Table AsicAddSharedKeyEntry(pAd, - BSS0, - pAd->StaCfg.DefaultKeyId, - pSharedKey->CipherAlg, - pSharedKey->Key, - pSharedKey->TxMic, - pSharedKey->RxMic); + BSS0, + pAd->StaCfg.DefaultKeyId, + pSharedKey->CipherAlg, + pSharedKey->Key, + pSharedKey->TxMic, pSharedKey->RxMic); // Update ASIC WCID attribute table and IVEIV table RTMPAddWcidAttributeEntry(pAd, - BSS0, - pAd->StaCfg.DefaultKeyId, - pSharedKey->CipherAlg, - NULL); + BSS0, + pAd->StaCfg.DefaultKeyId, + pSharedKey->CipherAlg, NULL); } return TRUE; } - /* ======================================================================== @@ -2339,7 +2310,6 @@ BOOLEAN RTMPParseEapolKeyData( | Key Data | n octets +--------------------+ - Arguments: pAd Pointer to our adapter @@ -2350,29 +2320,27 @@ BOOLEAN RTMPParseEapolKeyData( ======================================================================== */ -VOID ConstructEapolMsg( - IN PMAC_TABLE_ENTRY pEntry, - IN UCHAR GroupKeyWepStatus, - IN UCHAR MsgType, - IN UCHAR DefaultKeyIdx, - IN UCHAR *KeyNonce, - IN UCHAR *TxRSC, - IN UCHAR *GTK, - IN UCHAR *RSNIE, - IN UCHAR RSNIE_Len, - OUT PEAPOL_PACKET pMsg) +VOID ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, + IN UCHAR GroupKeyWepStatus, + IN UCHAR MsgType, + IN UCHAR DefaultKeyIdx, + IN UCHAR * KeyNonce, + IN UCHAR * TxRSC, + IN UCHAR * GTK, + IN UCHAR * RSNIE, + IN UCHAR RSNIE_Len, OUT PEAPOL_PACKET pMsg) { - BOOLEAN bWPA2 = FALSE; - UCHAR KeyDescVer; + BOOLEAN bWPA2 = FALSE; + UCHAR KeyDescVer; // Choose WPA2 or not if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) || - (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) + (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) bWPA2 = TRUE; - // Init Packet and Fill header - pMsg->ProVer = EAPOL_VER; - pMsg->ProType = EAPOLKey; + // Init Packet and Fill header + pMsg->ProVer = EAPOL_VER; + pMsg->ProType = EAPOLKey; // Default 95 bytes, the EAPoL-Key descriptor exclude Key-data field SET_UINT16_TO_ARRARY(pMsg->Body_Len, LEN_EAPOL_KEY_MSG); @@ -2387,8 +2355,11 @@ VOID ConstructEapolMsg( { // Fill in Key information, refer to IEEE Std 802.11i-2004 page 78 // When either the pairwise or the group cipher is AES, the DESC_TYPE_AES(2) shall be used. - KeyDescVer = (((pEntry->WepStatus == Ndis802_11Encryption3Enabled) || - (GroupKeyWepStatus == Ndis802_11Encryption3Enabled)) ? (DESC_TYPE_AES) : (DESC_TYPE_TKIP)); + KeyDescVer = + (((pEntry->WepStatus == Ndis802_11Encryption3Enabled) + || (GroupKeyWepStatus == + Ndis802_11Encryption3Enabled)) ? (DESC_TYPE_AES) + : (DESC_TYPE_TKIP)); } pMsg->KeyDesc.KeyInfo.KeyDescVer = KeyDescVer; @@ -2396,7 +2367,7 @@ VOID ConstructEapolMsg( // Specify Key Type as Group(0) or Pairwise(1) if (MsgType >= EAPOL_GROUP_MSG_1) pMsg->KeyDesc.KeyInfo.KeyType = GROUPKEY; - else + else pMsg->KeyDesc.KeyInfo.KeyType = PAIRWISEKEY; // Specify Key Index, only group_msg1_WPA1 @@ -2406,89 +2377,92 @@ VOID ConstructEapolMsg( if (MsgType == EAPOL_PAIR_MSG_3) pMsg->KeyDesc.KeyInfo.Install = 1; - if ((MsgType == EAPOL_PAIR_MSG_1) || (MsgType == EAPOL_PAIR_MSG_3) || (MsgType == EAPOL_GROUP_MSG_1)) + if ((MsgType == EAPOL_PAIR_MSG_1) || (MsgType == EAPOL_PAIR_MSG_3) + || (MsgType == EAPOL_GROUP_MSG_1)) pMsg->KeyDesc.KeyInfo.KeyAck = 1; if (MsgType != EAPOL_PAIR_MSG_1) pMsg->KeyDesc.KeyInfo.KeyMic = 1; if ((bWPA2 && (MsgType >= EAPOL_PAIR_MSG_3)) || - (!bWPA2 && (MsgType >= EAPOL_GROUP_MSG_1))) - { - pMsg->KeyDesc.KeyInfo.Secure = 1; - } + (!bWPA2 && (MsgType >= EAPOL_GROUP_MSG_1))) { + pMsg->KeyDesc.KeyInfo.Secure = 1; + } if (bWPA2 && ((MsgType == EAPOL_PAIR_MSG_3) || - (MsgType == EAPOL_GROUP_MSG_1))) - { - pMsg->KeyDesc.KeyInfo.EKD_DL = 1; - } - + (MsgType == EAPOL_GROUP_MSG_1))) { + pMsg->KeyDesc.KeyInfo.EKD_DL = 1; + } // key Information element has done. - *(USHORT *)(&pMsg->KeyDesc.KeyInfo) = cpu2le16(*(USHORT *)(&pMsg->KeyDesc.KeyInfo)); + *(USHORT *) (&pMsg->KeyDesc.KeyInfo) = + cpu2le16(*(USHORT *) (&pMsg->KeyDesc.KeyInfo)); // Fill in Key Length - { - if (MsgType >= EAPOL_GROUP_MSG_1) - { - // the length of group key cipher - pMsg->KeyDesc.KeyLength[1] = ((GroupKeyWepStatus == Ndis802_11Encryption2Enabled) ? TKIP_GTK_LENGTH : LEN_AES_KEY); - } - else { + if (MsgType >= EAPOL_GROUP_MSG_1) { + // the length of group key cipher + pMsg->KeyDesc.KeyLength[1] = + ((GroupKeyWepStatus == + Ndis802_11Encryption2Enabled) ? TKIP_GTK_LENGTH : + LEN_AES_KEY); + } else { // the length of pairwise key cipher - pMsg->KeyDesc.KeyLength[1] = ((pEntry->WepStatus == Ndis802_11Encryption2Enabled) ? LEN_TKIP_KEY : LEN_AES_KEY); + pMsg->KeyDesc.KeyLength[1] = + ((pEntry->WepStatus == + Ndis802_11Encryption2Enabled) ? LEN_TKIP_KEY : + LEN_AES_KEY); } } // Fill in replay counter - NdisMoveMemory(pMsg->KeyDesc.ReplayCounter, pEntry->R_Counter, LEN_KEY_DESC_REPLAY); + NdisMoveMemory(pMsg->KeyDesc.ReplayCounter, pEntry->R_Counter, + LEN_KEY_DESC_REPLAY); // Fill Key Nonce field // ANonce : pairwise_msg1 & pairwise_msg3 // SNonce : pairwise_msg2 // GNonce : group_msg1_wpa1 - if ((MsgType <= EAPOL_PAIR_MSG_3) || ((!bWPA2 && (MsgType == EAPOL_GROUP_MSG_1)))) - NdisMoveMemory(pMsg->KeyDesc.KeyNonce, KeyNonce, LEN_KEY_DESC_NONCE); + if ((MsgType <= EAPOL_PAIR_MSG_3) + || ((!bWPA2 && (MsgType == EAPOL_GROUP_MSG_1)))) + NdisMoveMemory(pMsg->KeyDesc.KeyNonce, KeyNonce, + LEN_KEY_DESC_NONCE); // Fill key IV - WPA2 as 0, WPA1 as random - if (!bWPA2 && (MsgType == EAPOL_GROUP_MSG_1)) - { + if (!bWPA2 && (MsgType == EAPOL_GROUP_MSG_1)) { // Suggest IV be random number plus some number, - NdisMoveMemory(pMsg->KeyDesc.KeyIv, &KeyNonce[16], LEN_KEY_DESC_IV); - pMsg->KeyDesc.KeyIv[15] += 2; - } - - // Fill Key RSC field - // It contains the RSC for the GTK being installed. - if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2) || (MsgType == EAPOL_GROUP_MSG_1)) - { - NdisMoveMemory(pMsg->KeyDesc.KeyRsc, TxRSC, 6); - } - + NdisMoveMemory(pMsg->KeyDesc.KeyIv, &KeyNonce[16], + LEN_KEY_DESC_IV); + pMsg->KeyDesc.KeyIv[15] += 2; + } + // Fill Key RSC field + // It contains the RSC for the GTK being installed. + if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2) + || (MsgType == EAPOL_GROUP_MSG_1)) { + NdisMoveMemory(pMsg->KeyDesc.KeyRsc, TxRSC, 6); + } // Clear Key MIC field for MIC calculation later - NdisZeroMemory(pMsg->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); + NdisZeroMemory(pMsg->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); ConstructEapolKeyData(pEntry, - GroupKeyWepStatus, - KeyDescVer, - MsgType, - DefaultKeyIdx, - GTK, - RSNIE, - RSNIE_Len, - pMsg); + GroupKeyWepStatus, + KeyDescVer, + MsgType, + DefaultKeyIdx, GTK, RSNIE, RSNIE_Len, pMsg); // Calculate MIC and fill in KeyMic Field except Pairwise Msg 1. - if (MsgType != EAPOL_PAIR_MSG_1) - { + if (MsgType != EAPOL_PAIR_MSG_1) { CalculateMIC(KeyDescVer, pEntry->PTK, pMsg); - } - - DBGPRINT(RT_DEBUG_TRACE, ("===> ConstructEapolMsg for %s %s\n", ((bWPA2) ? "WPA2" : "WPA"), GetEapolMsgType(MsgType))); - DBGPRINT(RT_DEBUG_TRACE, (" Body length = %d \n", CONV_ARRARY_TO_UINT16(pMsg->Body_Len))); - DBGPRINT(RT_DEBUG_TRACE, (" Key length = %d \n", CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyLength))); + } + DBGPRINT(RT_DEBUG_TRACE, + ("===> ConstructEapolMsg for %s %s\n", + ((bWPA2) ? "WPA2" : "WPA"), GetEapolMsgType(MsgType))); + DBGPRINT(RT_DEBUG_TRACE, + (" Body length = %d \n", + CONV_ARRARY_TO_UINT16(pMsg->Body_Len))); + DBGPRINT(RT_DEBUG_TRACE, + (" Key length = %d \n", + CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyLength))); } @@ -2509,38 +2483,35 @@ VOID ConstructEapolMsg( ======================================================================== */ -VOID ConstructEapolKeyData( - IN PMAC_TABLE_ENTRY pEntry, - IN UCHAR GroupKeyWepStatus, - IN UCHAR keyDescVer, - IN UCHAR MsgType, - IN UCHAR DefaultKeyIdx, - IN UCHAR *GTK, - IN UCHAR *RSNIE, - IN UCHAR RSNIE_LEN, - OUT PEAPOL_PACKET pMsg) +VOID ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, + IN UCHAR GroupKeyWepStatus, + IN UCHAR keyDescVer, + IN UCHAR MsgType, + IN UCHAR DefaultKeyIdx, + IN UCHAR * GTK, + IN UCHAR * RSNIE, + IN UCHAR RSNIE_LEN, OUT PEAPOL_PACKET pMsg) { - UCHAR *mpool, *Key_Data, *Rc4GTK; - UCHAR ekey[(LEN_KEY_DESC_IV+LEN_EAP_EK)]; - ULONG data_offset; - BOOLEAN bWPA2Capable = FALSE; - PRTMP_ADAPTER pAd = pEntry->pAd; - BOOLEAN GTK_Included = FALSE; + UCHAR *mpool, *Key_Data, *Rc4GTK; + UCHAR ekey[(LEN_KEY_DESC_IV + LEN_EAP_EK)]; + ULONG data_offset; + BOOLEAN bWPA2Capable = FALSE; + PRTMP_ADAPTER pAd = pEntry->pAd; + BOOLEAN GTK_Included = FALSE; // Choose WPA2 or not if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) || - (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) + (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) bWPA2Capable = TRUE; if (MsgType == EAPOL_PAIR_MSG_1 || - MsgType == EAPOL_PAIR_MSG_4 || - MsgType == EAPOL_GROUP_MSG_2) + MsgType == EAPOL_PAIR_MSG_4 || MsgType == EAPOL_GROUP_MSG_2) return; // allocate memory pool - os_alloc_mem(NULL, (PUCHAR *)&mpool, 1500); + os_alloc_mem(NULL, (PUCHAR *) & mpool, 1500); - if (mpool == NULL) + if (mpool == NULL) return; /* Rc4GTK Len = 512 */ @@ -2553,80 +2524,68 @@ VOID ConstructEapolKeyData( data_offset = 0; // Encapsulate RSNIE in pairwise_msg2 & pairwise_msg3 - if (RSNIE_LEN && ((MsgType == EAPOL_PAIR_MSG_2) || (MsgType == EAPOL_PAIR_MSG_3))) - { - PUINT8 pmkid_ptr = NULL; - UINT8 pmkid_len = 0; - + if (RSNIE_LEN + && ((MsgType == EAPOL_PAIR_MSG_2) + || (MsgType == EAPOL_PAIR_MSG_3))) { + PUINT8 pmkid_ptr = NULL; + UINT8 pmkid_len = 0; RTMPInsertRSNIE(&Key_Data[data_offset], - &data_offset, - RSNIE, - RSNIE_LEN, - pmkid_ptr, - pmkid_len); + &data_offset, + RSNIE, RSNIE_LEN, pmkid_ptr, pmkid_len); } - // Encapsulate KDE format in pairwise_msg3_WPA2 & group_msg1_WPA2 - if (bWPA2Capable && ((MsgType == EAPOL_PAIR_MSG_3) || (MsgType == EAPOL_GROUP_MSG_1))) - { + if (bWPA2Capable + && ((MsgType == EAPOL_PAIR_MSG_3) + || (MsgType == EAPOL_GROUP_MSG_1))) { // Key Data Encapsulation (KDE) format - 802.11i-2004 Figure-43w and Table-20h - Key_Data[data_offset + 0] = 0xDD; + Key_Data[data_offset + 0] = 0xDD; - if (GroupKeyWepStatus == Ndis802_11Encryption3Enabled) - { - Key_Data[data_offset + 1] = 0x16;// 4+2+16(OUI+DataType+DataField) - } - else - { - Key_Data[data_offset + 1] = 0x26;// 4+2+32(OUI+DataType+DataField) + if (GroupKeyWepStatus == Ndis802_11Encryption3Enabled) { + Key_Data[data_offset + 1] = 0x16; // 4+2+16(OUI+DataType+DataField) + } else { + Key_Data[data_offset + 1] = 0x26; // 4+2+32(OUI+DataType+DataField) } - Key_Data[data_offset + 2] = 0x00; - Key_Data[data_offset + 3] = 0x0F; - Key_Data[data_offset + 4] = 0xAC; - Key_Data[data_offset + 5] = 0x01; + Key_Data[data_offset + 2] = 0x00; + Key_Data[data_offset + 3] = 0x0F; + Key_Data[data_offset + 4] = 0xAC; + Key_Data[data_offset + 5] = 0x01; // GTK KDE format - 802.11i-2004 Figure-43x - Key_Data[data_offset + 6] = (DefaultKeyIdx & 0x03); - Key_Data[data_offset + 7] = 0x00; // Reserved Byte + Key_Data[data_offset + 6] = (DefaultKeyIdx & 0x03); + Key_Data[data_offset + 7] = 0x00; // Reserved Byte data_offset += 8; } - // Encapsulate GTK // Only for pairwise_msg3_WPA2 and group_msg1 - if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2Capable) || (MsgType == EAPOL_GROUP_MSG_1)) - { + if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2Capable) + || (MsgType == EAPOL_GROUP_MSG_1)) { // Fill in GTK - if (GroupKeyWepStatus == Ndis802_11Encryption3Enabled) - { - NdisMoveMemory(&Key_Data[data_offset], GTK, LEN_AES_KEY); + if (GroupKeyWepStatus == Ndis802_11Encryption3Enabled) { + NdisMoveMemory(&Key_Data[data_offset], GTK, + LEN_AES_KEY); data_offset += LEN_AES_KEY; - } - else - { - NdisMoveMemory(&Key_Data[data_offset], GTK, TKIP_GTK_LENGTH); + } else { + NdisMoveMemory(&Key_Data[data_offset], GTK, + TKIP_GTK_LENGTH); data_offset += TKIP_GTK_LENGTH; } GTK_Included = TRUE; } - // This whole key-data field shall be encrypted if a GTK is included. // Encrypt the data material in key data field with KEK - if (GTK_Included) - { + if (GTK_Included) { //hex_dump("GTK_Included", Key_Data, data_offset); - if ( - (keyDescVer == DESC_TYPE_AES)) - { - UCHAR remainder = 0; - UCHAR pad_len = 0; + if ((keyDescVer == DESC_TYPE_AES)) { + UCHAR remainder = 0; + UCHAR pad_len = 0; // Key Descriptor Version 2 or 3: AES key wrap, defined in IETF RFC 3394, // shall be used to encrypt the Key Data field using the KEK field from @@ -2636,9 +2595,8 @@ VOID ConstructEapolKeyData( // shall be padded before encrypting if the key data length is less than 16 // octets or if it is not a multiple of 8. The padding consists of appending // a single octet 0xdd followed by zero or more 0x00 octets. - if ((remainder = data_offset & 0x07) != 0) - { - INT i; + if ((remainder = data_offset & 0x07) != 0) { + INT i; pad_len = (8 - remainder); Key_Data[data_offset] = 0xDD; @@ -2646,33 +2604,35 @@ VOID ConstructEapolKeyData( Key_Data[data_offset + i] = 0; data_offset += pad_len; - } + } - AES_GTK_KEY_WRAP(&pEntry->PTK[16], Key_Data, data_offset, Rc4GTK); - // AES wrap function will grow 8 bytes in length - data_offset += 8; - } - else - { - /* Key Descriptor Version 1: ARC4 is used to encrypt the Key Data field - using the KEK field from the derived PTK. */ + AES_GTK_KEY_WRAP(&pEntry->PTK[16], Key_Data, + data_offset, Rc4GTK); + // AES wrap function will grow 8 bytes in length + data_offset += 8; + } else { + /* Key Descriptor Version 1: ARC4 is used to encrypt the Key Data field + using the KEK field from the derived PTK. */ // PREPARE Encrypted "Key DATA" field. (Encrypt GTK with RC4, usinf PTK[16]->[31] as Key, IV-field as IV) // put TxTsc in Key RSC field - pAd->PrivateInfo.FCSCRC32 = PPPINITFCS32; //Init crc32. + pAd->PrivateInfo.FCSCRC32 = PPPINITFCS32; //Init crc32. // ekey is the contanetion of IV-field, and PTK[16]->PTK[31] - NdisMoveMemory(ekey, pMsg->KeyDesc.KeyIv, LEN_KEY_DESC_IV); - NdisMoveMemory(&ekey[LEN_KEY_DESC_IV], &pEntry->PTK[16], LEN_EAP_EK); - ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, ekey, sizeof(ekey)); //INIT SBOX, KEYLEN+3(IV) - pAd->PrivateInfo.FCSCRC32 = RTMP_CALC_FCS32(pAd->PrivateInfo.FCSCRC32, Key_Data, data_offset); - WPAARCFOUR_ENCRYPT(&pAd->PrivateInfo.WEPCONTEXT, Rc4GTK, Key_Data, data_offset); + NdisMoveMemory(ekey, pMsg->KeyDesc.KeyIv, + LEN_KEY_DESC_IV); + NdisMoveMemory(&ekey[LEN_KEY_DESC_IV], &pEntry->PTK[16], + LEN_EAP_EK); + ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, ekey, sizeof(ekey)); //INIT SBOX, KEYLEN+3(IV) + pAd->PrivateInfo.FCSCRC32 = + RTMP_CALC_FCS32(pAd->PrivateInfo.FCSCRC32, Key_Data, + data_offset); + WPAARCFOUR_ENCRYPT(&pAd->PrivateInfo.WEPCONTEXT, Rc4GTK, + Key_Data, data_offset); } NdisMoveMemory(pMsg->KeyDesc.KeyData, Rc4GTK, data_offset); - } - else - { + } else { NdisMoveMemory(pMsg->KeyDesc.KeyData, Key_Data, data_offset); } @@ -2700,41 +2660,36 @@ VOID ConstructEapolKeyData( ======================================================================== */ -static VOID CalculateMIC( - IN UCHAR KeyDescVer, - IN UCHAR *PTK, - OUT PEAPOL_PACKET pMsg) +static VOID CalculateMIC(IN UCHAR KeyDescVer, + IN UCHAR * PTK, OUT PEAPOL_PACKET pMsg) { - UCHAR *OutBuffer; - ULONG FrameLen = 0; - UCHAR mic[LEN_KEY_DESC_MIC]; - UCHAR digest[80]; + UCHAR *OutBuffer; + ULONG FrameLen = 0; + UCHAR mic[LEN_KEY_DESC_MIC]; + UCHAR digest[80]; // allocate memory for MIC calculation - os_alloc_mem(NULL, (PUCHAR *)&OutBuffer, 512); + os_alloc_mem(NULL, (PUCHAR *) & OutBuffer, 512); - if (OutBuffer == NULL) - { + if (OutBuffer == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("!!!CalculateMIC: no memory!!!\n")); return; - } - + } // make a frame for calculating MIC. - MakeOutgoingFrame(OutBuffer, &FrameLen, - CONV_ARRARY_TO_UINT16(pMsg->Body_Len) + 4, pMsg, - END_OF_ARGS); + MakeOutgoingFrame(OutBuffer, &FrameLen, + CONV_ARRARY_TO_UINT16(pMsg->Body_Len) + 4, pMsg, + END_OF_ARGS); NdisZeroMemory(mic, sizeof(mic)); // Calculate MIC - if (KeyDescVer == DESC_TYPE_AES) - { - HMAC_SHA1(PTK, LEN_EAP_MICK, OutBuffer, FrameLen, digest, SHA1_DIGEST_SIZE); + if (KeyDescVer == DESC_TYPE_AES) { + HMAC_SHA1(PTK, LEN_EAP_MICK, OutBuffer, FrameLen, digest, + SHA1_DIGEST_SIZE); NdisMoveMemory(mic, digest, LEN_KEY_DESC_MIC); - } - else - { - HMAC_MD5(PTK, LEN_EAP_MICK, OutBuffer, FrameLen, mic, MD5_DIGEST_SIZE); + } else { + HMAC_MD5(PTK, LEN_EAP_MICK, OutBuffer, FrameLen, mic, + MD5_DIGEST_SIZE); } // store the calculated MIC @@ -2759,66 +2714,58 @@ static VOID CalculateMIC( ======================================================================== */ -NDIS_STATUS RTMPSoftDecryptBroadCastData( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN NDIS_802_11_ENCRYPTION_STATUS GroupCipher, - IN PCIPHER_KEY pShard_key) +NDIS_STATUS RTMPSoftDecryptBroadCastData(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, + IN NDIS_802_11_ENCRYPTION_STATUS + GroupCipher, IN PCIPHER_KEY pShard_key) { - PRXWI_STRUC pRxWI = pRxBlk->pRxWI; - - + PRXWI_STRUC pRxWI = pRxBlk->pRxWI; // handle WEP decryption - if (GroupCipher == Ndis802_11Encryption1Enabled) - { - if (RTMPSoftDecryptWEP(pAd, pRxBlk->pData, pRxWI->MPDUtotalByteCount, pShard_key)) - { + if (GroupCipher == Ndis802_11Encryption1Enabled) { + if (RTMPSoftDecryptWEP + (pAd, pRxBlk->pData, pRxWI->MPDUtotalByteCount, + pShard_key)) { //Minus IV[4] & ICV[4] pRxWI->MPDUtotalByteCount -= 8; - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR : Software decrypt WEP data fails.\n")); + } else { + DBGPRINT(RT_DEBUG_ERROR, + ("ERROR : Software decrypt WEP data fails.\n")); // give up this frame return NDIS_STATUS_FAILURE; } } // handle TKIP decryption - else if (GroupCipher == Ndis802_11Encryption2Enabled) - { - if (RTMPSoftDecryptTKIP(pAd, pRxBlk->pData, pRxWI->MPDUtotalByteCount, 0, pShard_key)) - { + else if (GroupCipher == Ndis802_11Encryption2Enabled) { + if (RTMPSoftDecryptTKIP + (pAd, pRxBlk->pData, pRxWI->MPDUtotalByteCount, 0, + pShard_key)) { //Minus 8 bytes MIC, 8 bytes IV/EIV, 4 bytes ICV pRxWI->MPDUtotalByteCount -= 20; - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR : RTMPSoftDecryptTKIP Failed\n")); + } else { + DBGPRINT(RT_DEBUG_ERROR, + ("ERROR : RTMPSoftDecryptTKIP Failed\n")); // give up this frame return NDIS_STATUS_FAILURE; - } + } } // handle AES decryption - else if (GroupCipher == Ndis802_11Encryption3Enabled) - { - if (RTMPSoftDecryptAES(pAd, pRxBlk->pData, pRxWI->MPDUtotalByteCount , pShard_key)) - { + else if (GroupCipher == Ndis802_11Encryption3Enabled) { + if (RTMPSoftDecryptAES + (pAd, pRxBlk->pData, pRxWI->MPDUtotalByteCount, + pShard_key)) { //8 bytes MIC, 8 bytes IV/EIV (CCMP Header) pRxWI->MPDUtotalByteCount -= 16; - } - else - { - DBGPRINT(RT_DEBUG_ERROR, ("ERROR : RTMPSoftDecryptAES Failed\n")); + } else { + DBGPRINT(RT_DEBUG_ERROR, + ("ERROR : RTMPSoftDecryptAES Failed\n")); // give up this frame return NDIS_STATUS_FAILURE; } - } - else - { + } else { // give up this frame return NDIS_STATUS_FAILURE; } @@ -2827,118 +2774,95 @@ NDIS_STATUS RTMPSoftDecryptBroadCastData( } - -PUINT8 GetSuiteFromRSNIE( - IN PUINT8 rsnie, - IN UINT rsnie_len, - IN UINT8 type, - OUT UINT8 *count) +PUINT8 GetSuiteFromRSNIE(IN PUINT8 rsnie, + IN UINT rsnie_len, IN UINT8 type, OUT UINT8 * count) { PEID_STRUCT pEid; - INT len; - PUINT8 pBuf; - INT offset = 0; - PRSNIE_AUTH pAkm; - UINT16 acount; - BOOLEAN isWPA2 = FALSE; - - pEid = (PEID_STRUCT)rsnie; + INT len; + PUINT8 pBuf; + INT offset = 0; + PRSNIE_AUTH pAkm; + UINT16 acount; + BOOLEAN isWPA2 = FALSE; + + pEid = (PEID_STRUCT) rsnie; len = rsnie_len - 2; // exclude IE and length - pBuf = (PUINT8)&pEid->Octet[0]; - - + pBuf = (PUINT8) & pEid->Octet[0]; // set default value *count = 0; // Check length - if ((len <= 0) || (pEid->Len != len)) - { + if ((len <= 0) || (pEid->Len != len)) { DBGPRINT_ERR(("%s : The length is invalid\n", __func__)); return NULL; } - // Check WPA or WPA2 - if (pEid->Eid == IE_WPA) - { - PRSNIE pRsnie = (PRSNIE)pBuf; + if (pEid->Eid == IE_WPA) { + PRSNIE pRsnie = (PRSNIE) pBuf; UINT16 ucount; - if (len < sizeof(RSNIE)) - { - DBGPRINT_ERR(("%s : The length is too short for WPA\n", __func__)); + if (len < sizeof(RSNIE)) { + DBGPRINT_ERR(("%s : The length is too short for WPA\n", + __func__)); return NULL; } - // Get the count of pairwise cipher ucount = cpu2le16(pRsnie->ucount); - if (ucount > 2) - { - DBGPRINT_ERR(("%s : The count(%d) of pairwise cipher is invlaid\n", - __func__, ucount)); + if (ucount > 2) { + DBGPRINT_ERR(("%s : The count(%d) of pairwise cipher is invlaid\n", __func__, ucount)); return NULL; } - // Get the group cipher - if (type == GROUP_SUITE) - { + if (type == GROUP_SUITE) { *count = 1; return pRsnie->mcast; } // Get the pairwise cipher suite - else if (type == PAIRWISE_SUITE) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s : The count of pairwise cipher is %d\n", - __func__, ucount)); + else if (type == PAIRWISE_SUITE) { + DBGPRINT(RT_DEBUG_TRACE, + ("%s : The count of pairwise cipher is %d\n", + __func__, ucount)); *count = ucount; return pRsnie->ucast[0].oui; - } + } offset = sizeof(RSNIE) + (4 * (ucount - 1)); - } - else if (pEid->Eid == IE_RSN) - { - PRSNIE2 pRsnie = (PRSNIE2)pBuf; + } else if (pEid->Eid == IE_RSN) { + PRSNIE2 pRsnie = (PRSNIE2) pBuf; UINT16 ucount; isWPA2 = TRUE; - if (len < sizeof(RSNIE2)) - { - DBGPRINT_ERR(("%s : The length is too short for WPA2\n", __func__)); + if (len < sizeof(RSNIE2)) { + DBGPRINT_ERR(("%s : The length is too short for WPA2\n", + __func__)); return NULL; } - // Get the count of pairwise cipher ucount = cpu2le16(pRsnie->ucount); - if (ucount > 2) - { - DBGPRINT_ERR(("%s : The count(%d) of pairwise cipher is invlaid\n", - __func__, ucount)); + if (ucount > 2) { + DBGPRINT_ERR(("%s : The count(%d) of pairwise cipher is invlaid\n", __func__, ucount)); return NULL; } - // Get the group cipher - if (type == GROUP_SUITE) - { + if (type == GROUP_SUITE) { *count = 1; return pRsnie->mcast; } // Get the pairwise cipher suite - else if (type == PAIRWISE_SUITE) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s : The count of pairwise cipher is %d\n", - __func__, ucount)); + else if (type == PAIRWISE_SUITE) { + DBGPRINT(RT_DEBUG_TRACE, + ("%s : The count of pairwise cipher is %d\n", + __func__, ucount)); *count = ucount; return pRsnie->ucast[0].oui; } offset = sizeof(RSNIE2) + (4 * (ucount - 1)); - } - else - { + } else { DBGPRINT_ERR(("%s : Unknown IE (%d)\n", __func__, pEid->Eid)); return NULL; } @@ -2947,53 +2871,45 @@ PUINT8 GetSuiteFromRSNIE( pBuf += offset; len -= offset; - if (len < sizeof(RSNIE_AUTH)) - { - DBGPRINT_ERR(("%s : The length of RSNIE is too short\n", __func__)); + if (len < sizeof(RSNIE_AUTH)) { + DBGPRINT_ERR(("%s : The length of RSNIE is too short\n", + __func__)); return NULL; } - // pointer to AKM count - pAkm = (PRSNIE_AUTH)pBuf; + pAkm = (PRSNIE_AUTH) pBuf; // Get the count of pairwise cipher acount = cpu2le16(pAkm->acount); - if (acount > 2) - { + if (acount > 2) { DBGPRINT_ERR(("%s : The count(%d) of AKM is invlaid\n", - __func__, acount)); + __func__, acount)); return NULL; - } - + } // Get the AKM suite - if (type == AKM_SUITE) - { + if (type == AKM_SUITE) { DBGPRINT(RT_DEBUG_TRACE, ("%s : The count of AKM is %d\n", - __func__, acount)); + __func__, acount)); *count = acount; return pAkm->auth[0].oui; - } + } offset = sizeof(RSNIE_AUTH) + (4 * (acount - 1)); pBuf += offset; len -= offset; // The remaining length must larger than (RSN-Capability(2) + PMKID-Count(2) + PMKID(16~)) - if (len >= (sizeof(RSN_CAPABILITIES) + 2 + LEN_PMKID)) - { + if (len >= (sizeof(RSN_CAPABILITIES) + 2 + LEN_PMKID)) { // Skip RSN capability and PMKID-Count pBuf += (sizeof(RSN_CAPABILITIES) + 2); len -= (sizeof(RSN_CAPABILITIES) + 2); // Get PMKID - if (type == PMKID_LIST) - { + if (type == PMKID_LIST) { *count = 1; return pBuf; - } - } - else - { + } + } else { DBGPRINT_ERR(("%s : it can't get any more information beyond AKM \n", __func__)); return NULL; } @@ -3004,9 +2920,7 @@ PUINT8 GetSuiteFromRSNIE( } -VOID WpaShowAllsuite( - IN PUINT8 rsnie, - IN UINT rsnie_len) +VOID WpaShowAllsuite(IN PUINT8 rsnie, IN UINT rsnie_len) { PUINT8 pSuite = NULL; UINT8 count; @@ -3014,99 +2928,89 @@ VOID WpaShowAllsuite( hex_dump("RSNIE", rsnie, rsnie_len); // group cipher - if ((pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, GROUP_SUITE, &count)) != NULL) - { - hex_dump("group cipher", pSuite, 4*count); + if ((pSuite = + GetSuiteFromRSNIE(rsnie, rsnie_len, GROUP_SUITE, + &count)) != NULL) { + hex_dump("group cipher", pSuite, 4 * count); } - // pairwise cipher - if ((pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, PAIRWISE_SUITE, &count)) != NULL) - { - hex_dump("pairwise cipher", pSuite, 4*count); + if ((pSuite = + GetSuiteFromRSNIE(rsnie, rsnie_len, PAIRWISE_SUITE, + &count)) != NULL) { + hex_dump("pairwise cipher", pSuite, 4 * count); } - // AKM - if ((pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, AKM_SUITE, &count)) != NULL) - { - hex_dump("AKM suite", pSuite, 4*count); + if ((pSuite = + GetSuiteFromRSNIE(rsnie, rsnie_len, AKM_SUITE, &count)) != NULL) { + hex_dump("AKM suite", pSuite, 4 * count); } - // PMKID - if ((pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, PMKID_LIST, &count)) != NULL) - { + if ((pSuite = + GetSuiteFromRSNIE(rsnie, rsnie_len, PMKID_LIST, &count)) != NULL) { hex_dump("PMKID", pSuite, LEN_PMKID); } } -VOID RTMPInsertRSNIE( - IN PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN PUINT8 rsnie_ptr, - IN UINT8 rsnie_len, - IN PUINT8 pmkid_ptr, - IN UINT8 pmkid_len) +VOID RTMPInsertRSNIE(IN PUCHAR pFrameBuf, + OUT PULONG pFrameLen, + IN PUINT8 rsnie_ptr, + IN UINT8 rsnie_len, + IN PUINT8 pmkid_ptr, IN UINT8 pmkid_len) { - PUCHAR pTmpBuf; - ULONG TempLen = 0; - UINT8 extra_len = 0; - UINT16 pmk_count = 0; - UCHAR ie_num; - UINT8 total_len = 0; - UCHAR WPA2_OUI[3]={0x00,0x0F,0xAC}; + PUCHAR pTmpBuf; + ULONG TempLen = 0; + UINT8 extra_len = 0; + UINT16 pmk_count = 0; + UCHAR ie_num; + UINT8 total_len = 0; + UCHAR WPA2_OUI[3] = { 0x00, 0x0F, 0xAC }; pTmpBuf = pFrameBuf; /* PMKID-List Must larger than 0 and the multiple of 16. */ - if (pmkid_len > 0 && ((pmkid_len & 0x0f) == 0)) - { + if (pmkid_len > 0 && ((pmkid_len & 0x0f) == 0)) { extra_len = sizeof(UINT16) + pmkid_len; pmk_count = (pmkid_len >> 4); pmk_count = cpu2le16(pmk_count); - } - else - { - DBGPRINT(RT_DEBUG_WARN, ("%s : The length is PMKID-List is invalid (%d), so don't insert it.\n", - __func__, pmkid_len)); + } else { + DBGPRINT(RT_DEBUG_WARN, + ("%s : The length is PMKID-List is invalid (%d), so don't insert it.\n", + __func__, pmkid_len)); } - if (rsnie_len != 0) - { + if (rsnie_len != 0) { ie_num = IE_WPA; total_len = rsnie_len; - if (NdisEqualMemory(rsnie_ptr + 2, WPA2_OUI, sizeof(WPA2_OUI))) - { + if (NdisEqualMemory(rsnie_ptr + 2, WPA2_OUI, sizeof(WPA2_OUI))) { ie_num = IE_RSN; total_len += extra_len; - } + } /* construct RSNIE body */ - MakeOutgoingFrame(pTmpBuf, &TempLen, - 1, &ie_num, - 1, &total_len, - rsnie_len, rsnie_ptr, - END_OF_ARGS); + MakeOutgoingFrame(pTmpBuf, &TempLen, + 1, &ie_num, + 1, &total_len, + rsnie_len, rsnie_ptr, END_OF_ARGS); pTmpBuf += TempLen; *pFrameLen = *pFrameLen + TempLen; - if (ie_num == IE_RSN) - { + if (ie_num == IE_RSN) { /* Insert PMKID-List field */ - if (extra_len > 0) - { - MakeOutgoingFrame(pTmpBuf, &TempLen, - 2, &pmk_count, - pmkid_len, pmkid_ptr, - END_OF_ARGS); + if (extra_len > 0) { + MakeOutgoingFrame(pTmpBuf, &TempLen, + 2, &pmk_count, + pmkid_len, pmkid_ptr, + END_OF_ARGS); pTmpBuf += TempLen; *pFrameLen = *pFrameLen + TempLen; + } } } - } return; } diff --git a/drivers/staging/rt2860/common/crypt_hmac.c b/drivers/staging/rt2860/common/crypt_hmac.c index 02701a5e3280..a50326af265e 100644 --- a/drivers/staging/rt2860/common/crypt_hmac.c +++ b/drivers/staging/rt2860/common/crypt_hmac.c @@ -26,7 +26,6 @@ #include "../crypt_hmac.h" - #ifdef HMAC_SHA1_SUPPORT /* ======================================================================== @@ -47,66 +46,63 @@ Note: None ======================================================================== */ -VOID HMAC_SHA1 ( - IN const UINT8 Key[], - IN UINT KeyLen, - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 MAC[], - IN UINT MACLen) +VOID HMAC_SHA1(IN const UINT8 Key[], + IN UINT KeyLen, + IN const UINT8 Message[], + IN UINT MessageLen, OUT UINT8 MAC[], IN UINT MACLen) { - SHA1_CTX_STRUC sha_ctx1; - SHA1_CTX_STRUC sha_ctx2; - UINT8 K0[SHA1_BLOCK_SIZE]; - UINT8 Digest[SHA1_DIGEST_SIZE]; - UINT index; - - NdisZeroMemory(&sha_ctx1, sizeof(SHA1_CTX_STRUC)); - NdisZeroMemory(&sha_ctx2, sizeof(SHA1_CTX_STRUC)); - /* - * If the length of K = B(Block size): K0 = K. - * If the length of K > B: hash K to obtain an L byte string, - * then append (B-L) zeros to create a B-byte string K0 (i.e., K0 = H(K) || 00...00). - * If the length of K < B: append zeros to the end of K to create a B-byte string K0 - */ - NdisZeroMemory(K0, SHA1_BLOCK_SIZE); - if (KeyLen <= SHA1_BLOCK_SIZE) - NdisMoveMemory(K0, Key, KeyLen); - else - RT_SHA1(Key, KeyLen, K0); - /* End of if */ - - /* Exclusive-Or K0 with ipad */ - /* ipad: Inner pad; the byte x¡¦36¡¦ repeated B times. */ - for (index = 0; index < SHA1_BLOCK_SIZE; index++) - K0[index] ^= 0x36; - /* End of for */ - - RT_SHA1_Init(&sha_ctx1); - /* H(K0^ipad) */ - SHA1_Append(&sha_ctx1, K0, sizeof(K0)); - /* H((K0^ipad)||text) */ - SHA1_Append(&sha_ctx1, Message, MessageLen); - SHA1_End(&sha_ctx1, Digest); - - /* Exclusive-Or K0 with opad and remove ipad */ - /* opad: Outer pad; the byte x¡¦5c¡¦ repeated B times. */ - for (index = 0; index < SHA1_BLOCK_SIZE; index++) - K0[index] ^= 0x36^0x5c; - /* End of for */ - - RT_SHA1_Init(&sha_ctx2); - /* H(K0^opad) */ - SHA1_Append(&sha_ctx2, K0, sizeof(K0)); - /* H( (K0^opad) || H((K0^ipad)||text) ) */ - SHA1_Append(&sha_ctx2, Digest, SHA1_DIGEST_SIZE); - SHA1_End(&sha_ctx2, Digest); - - if (MACLen > SHA1_DIGEST_SIZE) - NdisMoveMemory(MAC, Digest, SHA1_DIGEST_SIZE); - else - NdisMoveMemory(MAC, Digest, MACLen); -} /* End of HMAC_SHA1 */ + SHA1_CTX_STRUC sha_ctx1; + SHA1_CTX_STRUC sha_ctx2; + UINT8 K0[SHA1_BLOCK_SIZE]; + UINT8 Digest[SHA1_DIGEST_SIZE]; + UINT index; + + NdisZeroMemory(&sha_ctx1, sizeof(SHA1_CTX_STRUC)); + NdisZeroMemory(&sha_ctx2, sizeof(SHA1_CTX_STRUC)); + /* + * If the length of K = B(Block size): K0 = K. + * If the length of K > B: hash K to obtain an L byte string, + * then append (B-L) zeros to create a B-byte string K0 (i.e., K0 = H(K) || 00...00). + * If the length of K < B: append zeros to the end of K to create a B-byte string K0 + */ + NdisZeroMemory(K0, SHA1_BLOCK_SIZE); + if (KeyLen <= SHA1_BLOCK_SIZE) + NdisMoveMemory(K0, Key, KeyLen); + else + RT_SHA1(Key, KeyLen, K0); + /* End of if */ + + /* Exclusive-Or K0 with ipad */ + /* ipad: Inner pad; the byte x¡¦36¡¦ repeated B times. */ + for (index = 0; index < SHA1_BLOCK_SIZE; index++) + K0[index] ^= 0x36; + /* End of for */ + + RT_SHA1_Init(&sha_ctx1); + /* H(K0^ipad) */ + SHA1_Append(&sha_ctx1, K0, sizeof(K0)); + /* H((K0^ipad)||text) */ + SHA1_Append(&sha_ctx1, Message, MessageLen); + SHA1_End(&sha_ctx1, Digest); + + /* Exclusive-Or K0 with opad and remove ipad */ + /* opad: Outer pad; the byte x¡¦5c¡¦ repeated B times. */ + for (index = 0; index < SHA1_BLOCK_SIZE; index++) + K0[index] ^= 0x36 ^ 0x5c; + /* End of for */ + + RT_SHA1_Init(&sha_ctx2); + /* H(K0^opad) */ + SHA1_Append(&sha_ctx2, K0, sizeof(K0)); + /* H( (K0^opad) || H((K0^ipad)||text) ) */ + SHA1_Append(&sha_ctx2, Digest, SHA1_DIGEST_SIZE); + SHA1_End(&sha_ctx2, Digest); + + if (MACLen > SHA1_DIGEST_SIZE) + NdisMoveMemory(MAC, Digest, SHA1_DIGEST_SIZE); + else + NdisMoveMemory(MAC, Digest, MACLen); +} /* End of HMAC_SHA1 */ #endif /* HMAC_SHA1_SUPPORT */ #ifdef HMAC_MD5_SUPPORT @@ -129,66 +125,63 @@ Note: None ======================================================================== */ -VOID HMAC_MD5( - IN const UINT8 Key[], - IN UINT KeyLen, - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 MAC[], - IN UINT MACLen) +VOID HMAC_MD5(IN const UINT8 Key[], + IN UINT KeyLen, + IN const UINT8 Message[], + IN UINT MessageLen, OUT UINT8 MAC[], IN UINT MACLen) { - MD5_CTX_STRUC md5_ctx1; - MD5_CTX_STRUC md5_ctx2; - UINT8 K0[MD5_BLOCK_SIZE]; - UINT8 Digest[MD5_DIGEST_SIZE]; - UINT index; - - NdisZeroMemory(&md5_ctx1, sizeof(MD5_CTX_STRUC)); - NdisZeroMemory(&md5_ctx2, sizeof(MD5_CTX_STRUC)); - /* - * If the length of K = B(Block size): K0 = K. - * If the length of K > B: hash K to obtain an L byte string, - * then append (B-L) zeros to create a B-byte string K0 (i.e., K0 = H(K) || 00...00). - * If the length of K < B: append zeros to the end of K to create a B-byte string K0 - */ - NdisZeroMemory(K0, MD5_BLOCK_SIZE); - if (KeyLen <= MD5_BLOCK_SIZE) { - NdisMoveMemory(K0, Key, KeyLen); - } else { - RT_MD5(Key, KeyLen, K0); - } - - /* Exclusive-Or K0 with ipad */ - /* ipad: Inner pad; the byte x¡¦36¡¦ repeated B times. */ - for (index = 0; index < MD5_BLOCK_SIZE; index++) - K0[index] ^= 0x36; - /* End of for */ - - MD5_Init(&md5_ctx1); - /* H(K0^ipad) */ - MD5_Append(&md5_ctx1, K0, sizeof(K0)); - /* H((K0^ipad)||text) */ - MD5_Append(&md5_ctx1, Message, MessageLen); - MD5_End(&md5_ctx1, Digest); - - /* Exclusive-Or K0 with opad and remove ipad */ - /* opad: Outer pad; the byte x¡¦5c¡¦ repeated B times. */ - for (index = 0; index < MD5_BLOCK_SIZE; index++) - K0[index] ^= 0x36^0x5c; - /* End of for */ - - MD5_Init(&md5_ctx2); - /* H(K0^opad) */ - MD5_Append(&md5_ctx2, K0, sizeof(K0)); - /* H( (K0^opad) || H((K0^ipad)||text) ) */ - MD5_Append(&md5_ctx2, Digest, MD5_DIGEST_SIZE); - MD5_End(&md5_ctx2, Digest); - - if (MACLen > MD5_DIGEST_SIZE) - NdisMoveMemory(MAC, Digest, MD5_DIGEST_SIZE); - else - NdisMoveMemory(MAC, Digest, MACLen); -} /* End of HMAC_SHA256 */ + MD5_CTX_STRUC md5_ctx1; + MD5_CTX_STRUC md5_ctx2; + UINT8 K0[MD5_BLOCK_SIZE]; + UINT8 Digest[MD5_DIGEST_SIZE]; + UINT index; + + NdisZeroMemory(&md5_ctx1, sizeof(MD5_CTX_STRUC)); + NdisZeroMemory(&md5_ctx2, sizeof(MD5_CTX_STRUC)); + /* + * If the length of K = B(Block size): K0 = K. + * If the length of K > B: hash K to obtain an L byte string, + * then append (B-L) zeros to create a B-byte string K0 (i.e., K0 = H(K) || 00...00). + * If the length of K < B: append zeros to the end of K to create a B-byte string K0 + */ + NdisZeroMemory(K0, MD5_BLOCK_SIZE); + if (KeyLen <= MD5_BLOCK_SIZE) { + NdisMoveMemory(K0, Key, KeyLen); + } else { + RT_MD5(Key, KeyLen, K0); + } + + /* Exclusive-Or K0 with ipad */ + /* ipad: Inner pad; the byte x¡¦36¡¦ repeated B times. */ + for (index = 0; index < MD5_BLOCK_SIZE; index++) + K0[index] ^= 0x36; + /* End of for */ + + MD5_Init(&md5_ctx1); + /* H(K0^ipad) */ + MD5_Append(&md5_ctx1, K0, sizeof(K0)); + /* H((K0^ipad)||text) */ + MD5_Append(&md5_ctx1, Message, MessageLen); + MD5_End(&md5_ctx1, Digest); + + /* Exclusive-Or K0 with opad and remove ipad */ + /* opad: Outer pad; the byte x¡¦5c¡¦ repeated B times. */ + for (index = 0; index < MD5_BLOCK_SIZE; index++) + K0[index] ^= 0x36 ^ 0x5c; + /* End of for */ + + MD5_Init(&md5_ctx2); + /* H(K0^opad) */ + MD5_Append(&md5_ctx2, K0, sizeof(K0)); + /* H( (K0^opad) || H((K0^ipad)||text) ) */ + MD5_Append(&md5_ctx2, Digest, MD5_DIGEST_SIZE); + MD5_End(&md5_ctx2, Digest); + + if (MACLen > MD5_DIGEST_SIZE) + NdisMoveMemory(MAC, Digest, MD5_DIGEST_SIZE); + else + NdisMoveMemory(MAC, Digest, MACLen); +} /* End of HMAC_SHA256 */ #endif /* HMAC_MD5_SUPPORT */ /* End of crypt_hmac.c */ diff --git a/drivers/staging/rt2860/common/crypt_md5.c b/drivers/staging/rt2860/common/crypt_md5.c index 7c9ecfa8e5a2..b3701f2bcc12 100644 --- a/drivers/staging/rt2860/common/crypt_md5.c +++ b/drivers/staging/rt2860/common/crypt_md5.c @@ -36,7 +36,7 @@ #define I(x, y, z) ((y) ^ ((x) | (~z))) #define ROTL(x,n,w) ((x << n) | (x >> (w - n))) -#define ROTL32(x,n) ROTL(x,n,32) /* 32 bits word */ +#define ROTL32(x,n) ROTL(x,n,32) /* 32 bits word */ #define ROUND1(a, b, c, d, x, s, ac) { \ (a) += F((b),(c),(d)) + (x) + (UINT32)(ac); \ @@ -59,11 +59,10 @@ (a) += (b); \ } static const UINT32 MD5_DefaultHashValue[4] = { - 0x67452301UL, 0xefcdab89UL, 0x98badcfeUL, 0x10325476UL + 0x67452301UL, 0xefcdab89UL, 0x98badcfeUL, 0x10325476UL }; #endif /* MD5_SUPPORT */ - #ifdef MD5_SUPPORT /* ======================================================================== @@ -80,16 +79,14 @@ Note: None ======================================================================== */ -VOID MD5_Init ( - IN MD5_CTX_STRUC *pMD5_CTX) +VOID MD5_Init(IN MD5_CTX_STRUC * pMD5_CTX) { - NdisMoveMemory(pMD5_CTX->HashValue, MD5_DefaultHashValue, - sizeof(MD5_DefaultHashValue)); - NdisZeroMemory(pMD5_CTX->Block, MD5_BLOCK_SIZE); - pMD5_CTX->BlockLen = 0; - pMD5_CTX->MessageLen = 0; -} /* End of MD5_Init */ - + NdisMoveMemory(pMD5_CTX->HashValue, MD5_DefaultHashValue, + sizeof(MD5_DefaultHashValue)); + NdisZeroMemory(pMD5_CTX->Block, MD5_BLOCK_SIZE); + pMD5_CTX->BlockLen = 0; + pMD5_CTX->MessageLen = 0; +} /* End of MD5_Init */ /* ======================================================================== @@ -106,124 +103,122 @@ Note: T[i] := floor(abs(sin(i + 1)) * (2 pow 32)), i is number of round ======================================================================== */ -VOID MD5_Hash ( - IN MD5_CTX_STRUC *pMD5_CTX) +VOID MD5_Hash(IN MD5_CTX_STRUC * pMD5_CTX) { - UINT32 X_i; - UINT32 X[16]; - UINT32 a,b,c,d; - - /* Prepare the message schedule, {X_i} */ - NdisMoveMemory(X, pMD5_CTX->Block, MD5_BLOCK_SIZE); - for (X_i = 0; X_i < 16; X_i++) - X[X_i] = cpu2le32(X[X_i]); /* Endian Swap */ - /* End of for */ - - /* MD5 hash computation */ - /* Initialize the working variables */ - a = pMD5_CTX->HashValue[0]; - b = pMD5_CTX->HashValue[1]; - c = pMD5_CTX->HashValue[2]; - d = pMD5_CTX->HashValue[3]; - - /* - * Round 1 - * Let [abcd k s i] denote the operation - * a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s) - */ - ROUND1(a, b, c, d, X[ 0], 7, 0xd76aa478); /* 1 */ - ROUND1(d, a, b, c, X[ 1], 12, 0xe8c7b756); /* 2 */ - ROUND1(c, d, a, b, X[ 2], 17, 0x242070db); /* 3 */ - ROUND1(b, c, d, a, X[ 3], 22, 0xc1bdceee); /* 4 */ - ROUND1(a, b, c, d, X[ 4], 7, 0xf57c0faf); /* 5 */ - ROUND1(d, a, b, c, X[ 5], 12, 0x4787c62a); /* 6 */ - ROUND1(c, d, a, b, X[ 6], 17, 0xa8304613); /* 7 */ - ROUND1(b, c, d, a, X[ 7], 22, 0xfd469501); /* 8 */ - ROUND1(a, b, c, d, X[ 8], 7, 0x698098d8); /* 9 */ - ROUND1(d, a, b, c, X[ 9], 12, 0x8b44f7af); /* 10 */ - ROUND1(c, d, a, b, X[10], 17, 0xffff5bb1); /* 11 */ - ROUND1(b, c, d, a, X[11], 22, 0x895cd7be); /* 12 */ - ROUND1(a, b, c, d, X[12], 7, 0x6b901122); /* 13 */ - ROUND1(d, a, b, c, X[13], 12, 0xfd987193); /* 14 */ - ROUND1(c, d, a, b, X[14], 17, 0xa679438e); /* 15 */ - ROUND1(b, c, d, a, X[15], 22, 0x49b40821); /* 16 */ - - /* - * Round 2 - * Let [abcd k s i] denote the operation - * a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s) - */ - ROUND2(a, b, c, d, X[ 1], 5, 0xf61e2562); /* 17 */ - ROUND2(d, a, b, c, X[ 6], 9, 0xc040b340); /* 18 */ - ROUND2(c, d, a, b, X[11], 14, 0x265e5a51); /* 19 */ - ROUND2(b, c, d, a, X[ 0], 20, 0xe9b6c7aa); /* 20 */ - ROUND2(a, b, c, d, X[ 5], 5, 0xd62f105d); /* 21 */ - ROUND2(d, a, b, c, X[10], 9, 0x2441453); /* 22 */ - ROUND2(c, d, a, b, X[15], 14, 0xd8a1e681); /* 23 */ - ROUND2(b, c, d, a, X[ 4], 20, 0xe7d3fbc8); /* 24 */ - ROUND2(a, b, c, d, X[ 9], 5, 0x21e1cde6); /* 25 */ - ROUND2(d, a, b, c, X[14], 9, 0xc33707d6); /* 26 */ - ROUND2(c, d, a, b, X[ 3], 14, 0xf4d50d87); /* 27 */ - ROUND2(b, c, d, a, X[ 8], 20, 0x455a14ed); /* 28 */ - ROUND2(a, b, c, d, X[13], 5, 0xa9e3e905); /* 29 */ - ROUND2(d, a, b, c, X[ 2], 9, 0xfcefa3f8); /* 30 */ - ROUND2(c, d, a, b, X[ 7], 14, 0x676f02d9); /* 31 */ - ROUND2(b, c, d, a, X[12], 20, 0x8d2a4c8a); /* 32 */ - - /* - * Round 3 - * Let [abcd k s t] denote the operation - * a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s) - */ - ROUND3(a, b, c, d, X[ 5], 4, 0xfffa3942); /* 33 */ - ROUND3(d, a, b, c, X[ 8], 11, 0x8771f681); /* 34 */ - ROUND3(c, d, a, b, X[11], 16, 0x6d9d6122); /* 35 */ - ROUND3(b, c, d, a, X[14], 23, 0xfde5380c); /* 36 */ - ROUND3(a, b, c, d, X[ 1], 4, 0xa4beea44); /* 37 */ - ROUND3(d, a, b, c, X[ 4], 11, 0x4bdecfa9); /* 38 */ - ROUND3(c, d, a, b, X[ 7], 16, 0xf6bb4b60); /* 39 */ - ROUND3(b, c, d, a, X[10], 23, 0xbebfbc70); /* 40 */ - ROUND3(a, b, c, d, X[13], 4, 0x289b7ec6); /* 41 */ - ROUND3(d, a, b, c, X[ 0], 11, 0xeaa127fa); /* 42 */ - ROUND3(c, d, a, b, X[ 3], 16, 0xd4ef3085); /* 43 */ - ROUND3(b, c, d, a, X[ 6], 23, 0x4881d05); /* 44 */ - ROUND3(a, b, c, d, X[ 9], 4, 0xd9d4d039); /* 45 */ - ROUND3(d, a, b, c, X[12], 11, 0xe6db99e5); /* 46 */ - ROUND3(c, d, a, b, X[15], 16, 0x1fa27cf8); /* 47 */ - ROUND3(b, c, d, a, X[ 2], 23, 0xc4ac5665); /* 48 */ - - /* - * Round 4 - * Let [abcd k s t] denote the operation - * a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s) - */ - ROUND4(a, b, c, d, X[ 0], 6, 0xf4292244); /* 49 */ - ROUND4(d, a, b, c, X[ 7], 10, 0x432aff97); /* 50 */ - ROUND4(c, d, a, b, X[14], 15, 0xab9423a7); /* 51 */ - ROUND4(b, c, d, a, X[ 5], 21, 0xfc93a039); /* 52 */ - ROUND4(a, b, c, d, X[12], 6, 0x655b59c3); /* 53 */ - ROUND4(d, a, b, c, X[ 3], 10, 0x8f0ccc92); /* 54 */ - ROUND4(c, d, a, b, X[10], 15, 0xffeff47d); /* 55 */ - ROUND4(b, c, d, a, X[ 1], 21, 0x85845dd1); /* 56 */ - ROUND4(a, b, c, d, X[ 8], 6, 0x6fa87e4f); /* 57 */ - ROUND4(d, a, b, c, X[15], 10, 0xfe2ce6e0); /* 58 */ - ROUND4(c, d, a, b, X[ 6], 15, 0xa3014314); /* 59 */ - ROUND4(b, c, d, a, X[13], 21, 0x4e0811a1); /* 60 */ - ROUND4(a, b, c, d, X[ 4], 6, 0xf7537e82); /* 61 */ - ROUND4(d, a, b, c, X[11], 10, 0xbd3af235); /* 62 */ - ROUND4(c, d, a, b, X[ 2], 15, 0x2ad7d2bb); /* 63 */ - ROUND4(b, c, d, a, X[ 9], 21, 0xeb86d391); /* 64 */ - - /* Compute the i^th intermediate hash value H^(i) */ - pMD5_CTX->HashValue[0] += a; - pMD5_CTX->HashValue[1] += b; - pMD5_CTX->HashValue[2] += c; - pMD5_CTX->HashValue[3] += d; - - NdisZeroMemory(pMD5_CTX->Block, MD5_BLOCK_SIZE); - pMD5_CTX->BlockLen = 0; -} /* End of MD5_Hash */ - + UINT32 X_i; + UINT32 X[16]; + UINT32 a, b, c, d; + + /* Prepare the message schedule, {X_i} */ + NdisMoveMemory(X, pMD5_CTX->Block, MD5_BLOCK_SIZE); + for (X_i = 0; X_i < 16; X_i++) + X[X_i] = cpu2le32(X[X_i]); /* Endian Swap */ + /* End of for */ + + /* MD5 hash computation */ + /* Initialize the working variables */ + a = pMD5_CTX->HashValue[0]; + b = pMD5_CTX->HashValue[1]; + c = pMD5_CTX->HashValue[2]; + d = pMD5_CTX->HashValue[3]; + + /* + * Round 1 + * Let [abcd k s i] denote the operation + * a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s) + */ + ROUND1(a, b, c, d, X[0], 7, 0xd76aa478); /* 1 */ + ROUND1(d, a, b, c, X[1], 12, 0xe8c7b756); /* 2 */ + ROUND1(c, d, a, b, X[2], 17, 0x242070db); /* 3 */ + ROUND1(b, c, d, a, X[3], 22, 0xc1bdceee); /* 4 */ + ROUND1(a, b, c, d, X[4], 7, 0xf57c0faf); /* 5 */ + ROUND1(d, a, b, c, X[5], 12, 0x4787c62a); /* 6 */ + ROUND1(c, d, a, b, X[6], 17, 0xa8304613); /* 7 */ + ROUND1(b, c, d, a, X[7], 22, 0xfd469501); /* 8 */ + ROUND1(a, b, c, d, X[8], 7, 0x698098d8); /* 9 */ + ROUND1(d, a, b, c, X[9], 12, 0x8b44f7af); /* 10 */ + ROUND1(c, d, a, b, X[10], 17, 0xffff5bb1); /* 11 */ + ROUND1(b, c, d, a, X[11], 22, 0x895cd7be); /* 12 */ + ROUND1(a, b, c, d, X[12], 7, 0x6b901122); /* 13 */ + ROUND1(d, a, b, c, X[13], 12, 0xfd987193); /* 14 */ + ROUND1(c, d, a, b, X[14], 17, 0xa679438e); /* 15 */ + ROUND1(b, c, d, a, X[15], 22, 0x49b40821); /* 16 */ + + /* + * Round 2 + * Let [abcd k s i] denote the operation + * a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s) + */ + ROUND2(a, b, c, d, X[1], 5, 0xf61e2562); /* 17 */ + ROUND2(d, a, b, c, X[6], 9, 0xc040b340); /* 18 */ + ROUND2(c, d, a, b, X[11], 14, 0x265e5a51); /* 19 */ + ROUND2(b, c, d, a, X[0], 20, 0xe9b6c7aa); /* 20 */ + ROUND2(a, b, c, d, X[5], 5, 0xd62f105d); /* 21 */ + ROUND2(d, a, b, c, X[10], 9, 0x2441453); /* 22 */ + ROUND2(c, d, a, b, X[15], 14, 0xd8a1e681); /* 23 */ + ROUND2(b, c, d, a, X[4], 20, 0xe7d3fbc8); /* 24 */ + ROUND2(a, b, c, d, X[9], 5, 0x21e1cde6); /* 25 */ + ROUND2(d, a, b, c, X[14], 9, 0xc33707d6); /* 26 */ + ROUND2(c, d, a, b, X[3], 14, 0xf4d50d87); /* 27 */ + ROUND2(b, c, d, a, X[8], 20, 0x455a14ed); /* 28 */ + ROUND2(a, b, c, d, X[13], 5, 0xa9e3e905); /* 29 */ + ROUND2(d, a, b, c, X[2], 9, 0xfcefa3f8); /* 30 */ + ROUND2(c, d, a, b, X[7], 14, 0x676f02d9); /* 31 */ + ROUND2(b, c, d, a, X[12], 20, 0x8d2a4c8a); /* 32 */ + + /* + * Round 3 + * Let [abcd k s t] denote the operation + * a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s) + */ + ROUND3(a, b, c, d, X[5], 4, 0xfffa3942); /* 33 */ + ROUND3(d, a, b, c, X[8], 11, 0x8771f681); /* 34 */ + ROUND3(c, d, a, b, X[11], 16, 0x6d9d6122); /* 35 */ + ROUND3(b, c, d, a, X[14], 23, 0xfde5380c); /* 36 */ + ROUND3(a, b, c, d, X[1], 4, 0xa4beea44); /* 37 */ + ROUND3(d, a, b, c, X[4], 11, 0x4bdecfa9); /* 38 */ + ROUND3(c, d, a, b, X[7], 16, 0xf6bb4b60); /* 39 */ + ROUND3(b, c, d, a, X[10], 23, 0xbebfbc70); /* 40 */ + ROUND3(a, b, c, d, X[13], 4, 0x289b7ec6); /* 41 */ + ROUND3(d, a, b, c, X[0], 11, 0xeaa127fa); /* 42 */ + ROUND3(c, d, a, b, X[3], 16, 0xd4ef3085); /* 43 */ + ROUND3(b, c, d, a, X[6], 23, 0x4881d05); /* 44 */ + ROUND3(a, b, c, d, X[9], 4, 0xd9d4d039); /* 45 */ + ROUND3(d, a, b, c, X[12], 11, 0xe6db99e5); /* 46 */ + ROUND3(c, d, a, b, X[15], 16, 0x1fa27cf8); /* 47 */ + ROUND3(b, c, d, a, X[2], 23, 0xc4ac5665); /* 48 */ + + /* + * Round 4 + * Let [abcd k s t] denote the operation + * a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s) + */ + ROUND4(a, b, c, d, X[0], 6, 0xf4292244); /* 49 */ + ROUND4(d, a, b, c, X[7], 10, 0x432aff97); /* 50 */ + ROUND4(c, d, a, b, X[14], 15, 0xab9423a7); /* 51 */ + ROUND4(b, c, d, a, X[5], 21, 0xfc93a039); /* 52 */ + ROUND4(a, b, c, d, X[12], 6, 0x655b59c3); /* 53 */ + ROUND4(d, a, b, c, X[3], 10, 0x8f0ccc92); /* 54 */ + ROUND4(c, d, a, b, X[10], 15, 0xffeff47d); /* 55 */ + ROUND4(b, c, d, a, X[1], 21, 0x85845dd1); /* 56 */ + ROUND4(a, b, c, d, X[8], 6, 0x6fa87e4f); /* 57 */ + ROUND4(d, a, b, c, X[15], 10, 0xfe2ce6e0); /* 58 */ + ROUND4(c, d, a, b, X[6], 15, 0xa3014314); /* 59 */ + ROUND4(b, c, d, a, X[13], 21, 0x4e0811a1); /* 60 */ + ROUND4(a, b, c, d, X[4], 6, 0xf7537e82); /* 61 */ + ROUND4(d, a, b, c, X[11], 10, 0xbd3af235); /* 62 */ + ROUND4(c, d, a, b, X[2], 15, 0x2ad7d2bb); /* 63 */ + ROUND4(b, c, d, a, X[9], 21, 0xeb86d391); /* 64 */ + + /* Compute the i^th intermediate hash value H^(i) */ + pMD5_CTX->HashValue[0] += a; + pMD5_CTX->HashValue[1] += b; + pMD5_CTX->HashValue[2] += c; + pMD5_CTX->HashValue[3] += d; + + NdisZeroMemory(pMD5_CTX->Block, MD5_BLOCK_SIZE); + pMD5_CTX->BlockLen = 0; +} /* End of MD5_Hash */ /* ======================================================================== @@ -243,34 +238,30 @@ Note: None ======================================================================== */ -VOID MD5_Append ( - IN MD5_CTX_STRUC *pMD5_CTX, - IN const UINT8 Message[], - IN UINT MessageLen) +VOID MD5_Append(IN MD5_CTX_STRUC * pMD5_CTX, + IN const UINT8 Message[], IN UINT MessageLen) { - UINT appendLen = 0; - UINT diffLen = 0; - - while (appendLen != MessageLen) { - diffLen = MessageLen - appendLen; - if ((pMD5_CTX->BlockLen + diffLen) < MD5_BLOCK_SIZE) { - NdisMoveMemory(pMD5_CTX->Block + pMD5_CTX->BlockLen, - Message + appendLen, diffLen); - pMD5_CTX->BlockLen += diffLen; - appendLen += diffLen; - } - else - { - NdisMoveMemory(pMD5_CTX->Block + pMD5_CTX->BlockLen, - Message + appendLen, MD5_BLOCK_SIZE - pMD5_CTX->BlockLen); - appendLen += (MD5_BLOCK_SIZE - pMD5_CTX->BlockLen); - pMD5_CTX->BlockLen = MD5_BLOCK_SIZE; - MD5_Hash(pMD5_CTX); - } /* End of if */ - } /* End of while */ - pMD5_CTX->MessageLen += MessageLen; -} /* End of MD5_Append */ - + UINT appendLen = 0; + UINT diffLen = 0; + + while (appendLen != MessageLen) { + diffLen = MessageLen - appendLen; + if ((pMD5_CTX->BlockLen + diffLen) < MD5_BLOCK_SIZE) { + NdisMoveMemory(pMD5_CTX->Block + pMD5_CTX->BlockLen, + Message + appendLen, diffLen); + pMD5_CTX->BlockLen += diffLen; + appendLen += diffLen; + } else { + NdisMoveMemory(pMD5_CTX->Block + pMD5_CTX->BlockLen, + Message + appendLen, + MD5_BLOCK_SIZE - pMD5_CTX->BlockLen); + appendLen += (MD5_BLOCK_SIZE - pMD5_CTX->BlockLen); + pMD5_CTX->BlockLen = MD5_BLOCK_SIZE; + MD5_Hash(pMD5_CTX); + } /* End of if */ + } /* End of while */ + pMD5_CTX->MessageLen += MessageLen; +} /* End of MD5_Append */ /* ======================================================================== @@ -289,34 +280,32 @@ Note: None ======================================================================== */ -VOID MD5_End ( - IN MD5_CTX_STRUC *pMD5_CTX, - OUT UINT8 DigestMessage[]) +VOID MD5_End(IN MD5_CTX_STRUC * pMD5_CTX, OUT UINT8 DigestMessage[]) { - UINT index; - UINT64 message_length_bits; - - /* append 1 bits to end of the message */ - NdisFillMemory(pMD5_CTX->Block + pMD5_CTX->BlockLen, 1, 0x80); - - /* 55 = 64 - 8 - 1: append 1 bit(1 byte) and message length (8 bytes) */ - if (pMD5_CTX->BlockLen > 55) - MD5_Hash(pMD5_CTX); - /* End of if */ - - /* Append the length of message in rightmost 64 bits */ - message_length_bits = pMD5_CTX->MessageLen*8; - message_length_bits = cpu2le64(message_length_bits); - NdisMoveMemory(&pMD5_CTX->Block[56], &message_length_bits, 8); - MD5_Hash(pMD5_CTX); - - /* Return message digest, transform the UINT32 hash value to bytes */ - for (index = 0; index < 4;index++) - pMD5_CTX->HashValue[index] = cpu2le32(pMD5_CTX->HashValue[index]); - /* End of for */ - NdisMoveMemory(DigestMessage, pMD5_CTX->HashValue, MD5_DIGEST_SIZE); -} /* End of MD5_End */ - + UINT index; + UINT64 message_length_bits; + + /* append 1 bits to end of the message */ + NdisFillMemory(pMD5_CTX->Block + pMD5_CTX->BlockLen, 1, 0x80); + + /* 55 = 64 - 8 - 1: append 1 bit(1 byte) and message length (8 bytes) */ + if (pMD5_CTX->BlockLen > 55) + MD5_Hash(pMD5_CTX); + /* End of if */ + + /* Append the length of message in rightmost 64 bits */ + message_length_bits = pMD5_CTX->MessageLen * 8; + message_length_bits = cpu2le64(message_length_bits); + NdisMoveMemory(&pMD5_CTX->Block[56], &message_length_bits, 8); + MD5_Hash(pMD5_CTX); + + /* Return message digest, transform the UINT32 hash value to bytes */ + for (index = 0; index < 4; index++) + pMD5_CTX->HashValue[index] = + cpu2le32(pMD5_CTX->HashValue[index]); + /* End of for */ + NdisMoveMemory(DigestMessage, pMD5_CTX->HashValue, MD5_DIGEST_SIZE); +} /* End of MD5_End */ /* ======================================================================== @@ -334,18 +323,16 @@ Note: None ======================================================================== */ -VOID RT_MD5 ( - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 DigestMessage[]) +VOID RT_MD5(IN const UINT8 Message[], + IN UINT MessageLen, OUT UINT8 DigestMessage[]) { - MD5_CTX_STRUC md5_ctx; + MD5_CTX_STRUC md5_ctx; - NdisZeroMemory(&md5_ctx, sizeof(MD5_CTX_STRUC)); - MD5_Init(&md5_ctx); - MD5_Append(&md5_ctx, Message, MessageLen); - MD5_End(&md5_ctx, DigestMessage); -} /* End of RT_MD5 */ + NdisZeroMemory(&md5_ctx, sizeof(MD5_CTX_STRUC)); + MD5_Init(&md5_ctx); + MD5_Append(&md5_ctx, Message, MessageLen); + MD5_End(&md5_ctx, DigestMessage); +} /* End of RT_MD5 */ #endif /* MD5_SUPPORT */ diff --git a/drivers/staging/rt2860/common/crypt_sha2.c b/drivers/staging/rt2860/common/crypt_sha2.c index d4b23966cb64..7b1bf8a3a7e1 100644 --- a/drivers/staging/rt2860/common/crypt_sha2.c +++ b/drivers/staging/rt2860/common/crypt_sha2.c @@ -27,11 +27,11 @@ #include "../crypt_sha2.h" /* Basic operations */ -#define SHR(x,n) (x >> n) /* SHR(x)^n, right shift n bits , x is w-bit word, 0 <= n <= w */ -#define ROTR(x,n,w) ((x >> n) | (x << (w - n))) /* ROTR(x)^n, circular right shift n bits , x is w-bit word, 0 <= n <= w */ -#define ROTL(x,n,w) ((x << n) | (x >> (w - n))) /* ROTL(x)^n, circular left shift n bits , x is w-bit word, 0 <= n <= w */ -#define ROTR32(x,n) ROTR(x,n,32) /* 32 bits word */ -#define ROTL32(x,n) ROTL(x,n,32) /* 32 bits word */ +#define SHR(x,n) (x >> n) /* SHR(x)^n, right shift n bits , x is w-bit word, 0 <= n <= w */ +#define ROTR(x,n,w) ((x >> n) | (x << (w - n))) /* ROTR(x)^n, circular right shift n bits , x is w-bit word, 0 <= n <= w */ +#define ROTL(x,n,w) ((x << n) | (x >> (w - n))) /* ROTL(x)^n, circular left shift n bits , x is w-bit word, 0 <= n <= w */ +#define ROTR32(x,n) ROTR(x,n,32) /* 32 bits word */ +#define ROTL32(x,n) ROTL(x,n,32) /* 32 bits word */ /* Basic functions */ #define Ch(x,y,z) ((x & y) ^ ((~x) & z)) @@ -42,10 +42,11 @@ /* SHA1 constants */ #define SHA1_MASK 0x0000000f static const UINT32 SHA1_K[4] = { - 0x5a827999UL, 0x6ed9eba1UL, 0x8f1bbcdcUL, 0xca62c1d6UL + 0x5a827999UL, 0x6ed9eba1UL, 0x8f1bbcdcUL, 0xca62c1d6UL }; + static const UINT32 SHA1_DefaultHashValue[5] = { - 0x67452301UL, 0xefcdab89UL, 0x98badcfeUL, 0x10325476UL, 0xc3d2e1f0UL + 0x67452301UL, 0xefcdab89UL, 0x98badcfeUL, 0x10325476UL, 0xc3d2e1f0UL }; /* @@ -63,16 +64,14 @@ Note: None ======================================================================== */ -VOID RT_SHA1_Init ( - IN SHA1_CTX_STRUC *pSHA_CTX) +VOID RT_SHA1_Init(IN SHA1_CTX_STRUC * pSHA_CTX) { - NdisMoveMemory(pSHA_CTX->HashValue, SHA1_DefaultHashValue, - sizeof(SHA1_DefaultHashValue)); - NdisZeroMemory(pSHA_CTX->Block, SHA1_BLOCK_SIZE); - pSHA_CTX->MessageLen = 0; - pSHA_CTX->BlockLen = 0; -} /* End of RT_SHA1_Init */ - + NdisMoveMemory(pSHA_CTX->HashValue, SHA1_DefaultHashValue, + sizeof(SHA1_DefaultHashValue)); + NdisZeroMemory(pSHA_CTX->Block, SHA1_BLOCK_SIZE); + pSHA_CTX->MessageLen = 0; + pSHA_CTX->BlockLen = 0; +} /* End of RT_SHA1_Init */ /* ======================================================================== @@ -89,67 +88,67 @@ Note: None ======================================================================== */ -VOID SHA1_Hash ( - IN SHA1_CTX_STRUC *pSHA_CTX) +VOID SHA1_Hash(IN SHA1_CTX_STRUC * pSHA_CTX) { - UINT32 W_i,t,s; - UINT32 W[16]; - UINT32 a,b,c,d,e,T,f_t = 0; - - /* Prepare the message schedule, {W_i}, 0 < t < 15 */ - NdisMoveMemory(W, pSHA_CTX->Block, SHA1_BLOCK_SIZE); - for (W_i = 0; W_i < 16; W_i++) - W[W_i] = cpu2be32(W[W_i]); /* Endian Swap */ - /* End of for */ - - /* SHA256 hash computation */ - /* Initialize the working variables */ - a = pSHA_CTX->HashValue[0]; - b = pSHA_CTX->HashValue[1]; - c = pSHA_CTX->HashValue[2]; - d = pSHA_CTX->HashValue[3]; - e = pSHA_CTX->HashValue[4]; - - /* 80 rounds */ - for (t = 0;t < 80;t++) { - s = t & SHA1_MASK; - if (t > 15) { /* Prepare the message schedule, {W_i}, 16 < t < 79 */ - W[s] = (W[(s+13) & SHA1_MASK]) ^ (W[(s+8) & SHA1_MASK]) ^ (W[(s+2) & SHA1_MASK]) ^ W[s]; - W[s] = ROTL32(W[s],1); - } /* End of if */ - switch (t / 20) { - case 0: - f_t = Ch(b,c,d); - break; - case 1: - f_t = Parity(b,c,d); - break; - case 2: - f_t = Maj(b,c,d); - break; - case 3: - f_t = Parity(b,c,d); - break; - } /* End of switch */ - T = ROTL32(a,5) + f_t + e + SHA1_K[t / 20] + W[s]; - e = d; - d = c; - c = ROTL32(b,30); - b = a; - a = T; - } /* End of for */ - - /* Compute the i^th intermediate hash value H^(i) */ - pSHA_CTX->HashValue[0] += a; - pSHA_CTX->HashValue[1] += b; - pSHA_CTX->HashValue[2] += c; - pSHA_CTX->HashValue[3] += d; - pSHA_CTX->HashValue[4] += e; - - NdisZeroMemory(pSHA_CTX->Block, SHA1_BLOCK_SIZE); - pSHA_CTX->BlockLen = 0; -} /* End of SHA1_Hash */ - + UINT32 W_i, t, s; + UINT32 W[16]; + UINT32 a, b, c, d, e, T, f_t = 0; + + /* Prepare the message schedule, {W_i}, 0 < t < 15 */ + NdisMoveMemory(W, pSHA_CTX->Block, SHA1_BLOCK_SIZE); + for (W_i = 0; W_i < 16; W_i++) + W[W_i] = cpu2be32(W[W_i]); /* Endian Swap */ + /* End of for */ + + /* SHA256 hash computation */ + /* Initialize the working variables */ + a = pSHA_CTX->HashValue[0]; + b = pSHA_CTX->HashValue[1]; + c = pSHA_CTX->HashValue[2]; + d = pSHA_CTX->HashValue[3]; + e = pSHA_CTX->HashValue[4]; + + /* 80 rounds */ + for (t = 0; t < 80; t++) { + s = t & SHA1_MASK; + if (t > 15) { /* Prepare the message schedule, {W_i}, 16 < t < 79 */ + W[s] = + (W[(s + 13) & SHA1_MASK]) ^ (W[(s + 8) & SHA1_MASK]) + ^ (W[(s + 2) & SHA1_MASK]) ^ W[s]; + W[s] = ROTL32(W[s], 1); + } /* End of if */ + switch (t / 20) { + case 0: + f_t = Ch(b, c, d); + break; + case 1: + f_t = Parity(b, c, d); + break; + case 2: + f_t = Maj(b, c, d); + break; + case 3: + f_t = Parity(b, c, d); + break; + } /* End of switch */ + T = ROTL32(a, 5) + f_t + e + SHA1_K[t / 20] + W[s]; + e = d; + d = c; + c = ROTL32(b, 30); + b = a; + a = T; + } /* End of for */ + + /* Compute the i^th intermediate hash value H^(i) */ + pSHA_CTX->HashValue[0] += a; + pSHA_CTX->HashValue[1] += b; + pSHA_CTX->HashValue[2] += c; + pSHA_CTX->HashValue[3] += d; + pSHA_CTX->HashValue[4] += e; + + NdisZeroMemory(pSHA_CTX->Block, SHA1_BLOCK_SIZE); + pSHA_CTX->BlockLen = 0; +} /* End of SHA1_Hash */ /* ======================================================================== @@ -169,34 +168,30 @@ Note: None ======================================================================== */ -VOID SHA1_Append ( - IN SHA1_CTX_STRUC *pSHA_CTX, - IN const UINT8 Message[], - IN UINT MessageLen) +VOID SHA1_Append(IN SHA1_CTX_STRUC * pSHA_CTX, + IN const UINT8 Message[], IN UINT MessageLen) { - UINT appendLen = 0; - UINT diffLen = 0; - - while (appendLen != MessageLen) { - diffLen = MessageLen - appendLen; - if ((pSHA_CTX->BlockLen + diffLen) < SHA1_BLOCK_SIZE) { - NdisMoveMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, - Message + appendLen, diffLen); - pSHA_CTX->BlockLen += diffLen; - appendLen += diffLen; - } - else - { - NdisMoveMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, - Message + appendLen, SHA1_BLOCK_SIZE - pSHA_CTX->BlockLen); - appendLen += (SHA1_BLOCK_SIZE - pSHA_CTX->BlockLen); - pSHA_CTX->BlockLen = SHA1_BLOCK_SIZE; - SHA1_Hash(pSHA_CTX); - } /* End of if */ - } /* End of while */ - pSHA_CTX->MessageLen += MessageLen; -} /* End of SHA1_Append */ - + UINT appendLen = 0; + UINT diffLen = 0; + + while (appendLen != MessageLen) { + diffLen = MessageLen - appendLen; + if ((pSHA_CTX->BlockLen + diffLen) < SHA1_BLOCK_SIZE) { + NdisMoveMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, + Message + appendLen, diffLen); + pSHA_CTX->BlockLen += diffLen; + appendLen += diffLen; + } else { + NdisMoveMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, + Message + appendLen, + SHA1_BLOCK_SIZE - pSHA_CTX->BlockLen); + appendLen += (SHA1_BLOCK_SIZE - pSHA_CTX->BlockLen); + pSHA_CTX->BlockLen = SHA1_BLOCK_SIZE; + SHA1_Hash(pSHA_CTX); + } /* End of if */ + } /* End of while */ + pSHA_CTX->MessageLen += MessageLen; +} /* End of SHA1_Append */ /* ======================================================================== @@ -215,34 +210,32 @@ Note: None ======================================================================== */ -VOID SHA1_End ( - IN SHA1_CTX_STRUC *pSHA_CTX, - OUT UINT8 DigestMessage[]) +VOID SHA1_End(IN SHA1_CTX_STRUC * pSHA_CTX, OUT UINT8 DigestMessage[]) { - UINT index; - UINT64 message_length_bits; - - /* Append bit 1 to end of the message */ - NdisFillMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, 1, 0x80); - - /* 55 = 64 - 8 - 1: append 1 bit(1 byte) and message length (8 bytes) */ - if (pSHA_CTX->BlockLen > 55) - SHA1_Hash(pSHA_CTX); - /* End of if */ - - /* Append the length of message in rightmost 64 bits */ - message_length_bits = pSHA_CTX->MessageLen*8; - message_length_bits = cpu2be64(message_length_bits); - NdisMoveMemory(&pSHA_CTX->Block[56], &message_length_bits, 8); - SHA1_Hash(pSHA_CTX); - - /* Return message digest, transform the UINT32 hash value to bytes */ - for (index = 0; index < 5;index++) - pSHA_CTX->HashValue[index] = cpu2be32(pSHA_CTX->HashValue[index]); - /* End of for */ - NdisMoveMemory(DigestMessage, pSHA_CTX->HashValue, SHA1_DIGEST_SIZE); -} /* End of SHA1_End */ - + UINT index; + UINT64 message_length_bits; + + /* Append bit 1 to end of the message */ + NdisFillMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, 1, 0x80); + + /* 55 = 64 - 8 - 1: append 1 bit(1 byte) and message length (8 bytes) */ + if (pSHA_CTX->BlockLen > 55) + SHA1_Hash(pSHA_CTX); + /* End of if */ + + /* Append the length of message in rightmost 64 bits */ + message_length_bits = pSHA_CTX->MessageLen * 8; + message_length_bits = cpu2be64(message_length_bits); + NdisMoveMemory(&pSHA_CTX->Block[56], &message_length_bits, 8); + SHA1_Hash(pSHA_CTX); + + /* Return message digest, transform the UINT32 hash value to bytes */ + for (index = 0; index < 5; index++) + pSHA_CTX->HashValue[index] = + cpu2be32(pSHA_CTX->HashValue[index]); + /* End of for */ + NdisMoveMemory(DigestMessage, pSHA_CTX->HashValue, SHA1_DIGEST_SIZE); +} /* End of SHA1_End */ /* ======================================================================== @@ -260,19 +253,17 @@ Note: None ======================================================================== */ -VOID RT_SHA1 ( - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 DigestMessage[]) +VOID RT_SHA1(IN const UINT8 Message[], + IN UINT MessageLen, OUT UINT8 DigestMessage[]) { - SHA1_CTX_STRUC sha_ctx; + SHA1_CTX_STRUC sha_ctx; - NdisZeroMemory(&sha_ctx, sizeof(SHA1_CTX_STRUC)); - RT_SHA1_Init(&sha_ctx); - SHA1_Append(&sha_ctx, Message, MessageLen); - SHA1_End(&sha_ctx, DigestMessage); -} /* End of RT_SHA1 */ + NdisZeroMemory(&sha_ctx, sizeof(SHA1_CTX_STRUC)); + RT_SHA1_Init(&sha_ctx); + SHA1_Append(&sha_ctx, Message, MessageLen); + SHA1_End(&sha_ctx, DigestMessage); +} /* End of RT_SHA1 */ #endif /* SHA1_SUPPORT */ /* End of crypt_sha2.c */ diff --git a/drivers/staging/rt2860/common/dfs.c b/drivers/staging/rt2860/common/dfs.c index 11b7c1932a2e..bfe742d9c693 100644 --- a/drivers/staging/rt2860/common/dfs.c +++ b/drivers/staging/rt2860/common/dfs.c @@ -52,17 +52,13 @@ ======================================================================== */ -BOOLEAN RadarChannelCheck( - IN PRTMP_ADAPTER pAd, - IN UCHAR Ch) +BOOLEAN RadarChannelCheck(IN PRTMP_ADAPTER pAd, IN UCHAR Ch) { - INT i; + INT i; BOOLEAN result = FALSE; - for (i=0; iChannelListNum; i++) - { - if (Ch == pAd->ChannelList[i].Channel) - { + for (i = 0; i < pAd->ChannelListNum; i++) { + if (Ch == pAd->ChannelList[i].Channel) { result = pAd->ChannelList[i].DfsReq; break; } diff --git a/drivers/staging/rt2860/common/ee_efuse.c b/drivers/staging/rt2860/common/ee_efuse.c index 4bff473ccf38..8e71addeb2f9 100644 --- a/drivers/staging/rt2860/common/ee_efuse.c +++ b/drivers/staging/rt2860/common/ee_efuse.c @@ -35,37 +35,30 @@ -------- ---------- ---------------------------------------------- */ - #include "../rt_config.h" - - #define EFUSE_USAGE_MAP_START 0x2d0 #define EFUSE_USAGE_MAP_END 0x2fc #define EFUSE_USAGE_MAP_SIZE 45 - - #define EFUSE_EEPROM_DEFULT_FILE "RT30xxEEPROM.bin" #define MAX_EEPROM_BIN_FILE_SIZE 1024 - - #define EFUSE_TAG 0x2fe -typedef union _EFUSE_CTRL_STRUC { - struct { - UINT32 EFSROM_AOUT:6; - UINT32 EFSROM_MODE:2; - UINT32 EFSROM_LDO_OFF_TIME:6; - UINT32 EFSROM_LDO_ON_TIME:2; - UINT32 EFSROM_AIN:10; - UINT32 RESERVED:4; - UINT32 EFSROM_KICK:1; - UINT32 SEL_EFUSE:1; - } field; - UINT32 word; -} EFUSE_CTRL_STRUC, *PEFUSE_CTRL_STRUC; +typedef union _EFUSE_CTRL_STRUC { + struct { + UINT32 EFSROM_AOUT:6; + UINT32 EFSROM_MODE:2; + UINT32 EFSROM_LDO_OFF_TIME:6; + UINT32 EFSROM_LDO_ON_TIME:2; + UINT32 EFSROM_AIN:10; + UINT32 RESERVED:4; + UINT32 EFSROM_KICK:1; + UINT32 SEL_EFUSE:1; + } field; + UINT32 word; +} EFUSE_CTRL_STRUC, *PEFUSE_CTRL_STRUC; /* ======================================================================== @@ -80,16 +73,13 @@ typedef union _EFUSE_CTRL_STRUC { ======================================================================== */ -UCHAR eFuseReadRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - OUT USHORT* pData) +UCHAR eFuseReadRegisters(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, IN USHORT Length, OUT USHORT * pData) { - EFUSE_CTRL_STRUC eFuseCtrlStruc; - int i; - USHORT efuseDataOffset; - UINT32 data; + EFUSE_CTRL_STRUC eFuseCtrlStruc; + int i; + USHORT efuseDataOffset; + UINT32 data; RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); @@ -108,12 +98,10 @@ UCHAR eFuseReadRegisters( //Step3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. i = 0; - while(i < 500) - { + while (i < 500) { //rtmp.HwMemoryReadDword(EFUSE_CTRL, (DWORD *) &eFuseCtrlStruc, 4); RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); - if(eFuseCtrlStruc.field.EFSROM_KICK == 0) - { + if (eFuseCtrlStruc.field.EFSROM_KICK == 0) { break; } RTMPusecDelay(2); @@ -121,28 +109,25 @@ UCHAR eFuseReadRegisters( } //if EFSROM_AOUT is not found in physical address, write 0xffff - if (eFuseCtrlStruc.field.EFSROM_AOUT == 0x3f) - { - for(i=0; i> (8*(Offset & 0x3)); + data = data >> (8 * (Offset & 0x3)); NdisMoveMemory(pData, &data, Length); } @@ -164,16 +149,14 @@ UCHAR eFuseReadRegisters( ======================================================================== */ -VOID eFusePhysicalReadRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - OUT USHORT* pData) +VOID eFusePhysicalReadRegisters(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN USHORT Length, OUT USHORT * pData) { - EFUSE_CTRL_STRUC eFuseCtrlStruc; - int i; - USHORT efuseDataOffset; - UINT32 data; + EFUSE_CTRL_STRUC eFuseCtrlStruc; + int i; + USHORT efuseDataOffset; + UINT32 data; RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); @@ -192,10 +175,9 @@ VOID eFusePhysicalReadRegisters( //Step3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. i = 0; - while(i < 500) - { + while (i < 500) { RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); - if(eFuseCtrlStruc.field.EFSROM_KICK == 0) + if (eFuseCtrlStruc.field.EFSROM_KICK == 0) break; RTMPusecDelay(2); i++; @@ -209,11 +191,11 @@ VOID eFusePhysicalReadRegisters( //594:B A 9 8 //598:7 6 5 4 //59C:3 2 1 0 - efuseDataOffset = EFUSE_DATA3 - (Offset & 0xC) ; + efuseDataOffset = EFUSE_DATA3 - (Offset & 0xC); RTMP_IO_READ32(pAd, efuseDataOffset, &data); - data = data >> (8*(Offset & 0x3)); + data = data >> (8 * (Offset & 0x3)); NdisMoveMemory(pData, &data, Length); @@ -232,24 +214,20 @@ VOID eFusePhysicalReadRegisters( ======================================================================== */ -static VOID eFuseReadPhysical( - IN PRTMP_ADAPTER pAd, - IN PUSHORT lpInBuffer, - IN ULONG nInBufferSize, - OUT PUSHORT lpOutBuffer, - IN ULONG nOutBufferSize -) +static VOID eFuseReadPhysical(IN PRTMP_ADAPTER pAd, + IN PUSHORT lpInBuffer, + IN ULONG nInBufferSize, + OUT PUSHORT lpOutBuffer, IN ULONG nOutBufferSize) { - USHORT* pInBuf = (USHORT*)lpInBuffer; - USHORT* pOutBuf = (USHORT*)lpOutBuffer; + USHORT *pInBuf = (USHORT *) lpInBuffer; + USHORT *pOutBuf = (USHORT *) lpOutBuffer; - USHORT Offset = pInBuf[0]; //addr - USHORT Length = pInBuf[1]; //length - int i; + USHORT Offset = pInBuf[0]; //addr + USHORT Length = pInBuf[1]; //length + int i; - for(i=0; ibUseEfuse) + USHORT LogicalAddress; + USHORT efusefreenum = 0; + if (!pAd->bUseEfuse) return FALSE; - for (i = EFUSE_USAGE_MAP_START; i <= EFUSE_USAGE_MAP_END; i+=2) - { + for (i = EFUSE_USAGE_MAP_START; i <= EFUSE_USAGE_MAP_END; i += 2) { eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); - if( (LogicalAddress & 0xff) == 0) - { - efusefreenum= (UCHAR) (EFUSE_USAGE_MAP_END-i+1); + if ((LogicalAddress & 0xff) == 0) { + efusefreenum = (UCHAR) (EFUSE_USAGE_MAP_END - i + 1); break; - } - else if(( (LogicalAddress >> 8) & 0xff) == 0) - { - efusefreenum = (UCHAR) (EFUSE_USAGE_MAP_END-i); + } else if (((LogicalAddress >> 8) & 0xff) == 0) { + efusefreenum = (UCHAR) (EFUSE_USAGE_MAP_END - i); break; } - if(i == EFUSE_USAGE_MAP_END) + if (i == EFUSE_USAGE_MAP_END) efusefreenum = 0; } - printk("efuseFreeNumber is %d\n",efusefreenum); + printk("efuseFreeNumber is %d\n", efusefreenum); return TRUE; } - -INT set_eFusedump_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) +INT set_eFusedump_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg) { -USHORT InBuf[3]; - INT i=0; - if(!pAd->bUseEfuse) + USHORT InBuf[3]; + INT i = 0; + if (!pAd->bUseEfuse) return FALSE; - for(i =0; iEFuseTag = (value & 0xff); } return 0; } -VOID eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, - PUINT EfuseFreeBlock) +VOID eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, PUINT EfuseFreeBlock) { USHORT i; - USHORT LogicalAddress; - if(!pAd->bUseEfuse) - { - DBGPRINT(RT_DEBUG_TRACE,("eFuseGetFreeBlockCount Only supports efuse Mode\n")); - return ; - } - for (i = EFUSE_USAGE_MAP_START; i <= EFUSE_USAGE_MAP_END; i+=2) - { + USHORT LogicalAddress; + if (!pAd->bUseEfuse) { + DBGPRINT(RT_DEBUG_TRACE, + ("eFuseGetFreeBlockCount Only supports efuse Mode\n")); + return; + } + for (i = EFUSE_USAGE_MAP_START; i <= EFUSE_USAGE_MAP_END; i += 2) { eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); - if( (LogicalAddress & 0xff) == 0) - { - *EfuseFreeBlock= (UCHAR) (EFUSE_USAGE_MAP_END-i+1); + if ((LogicalAddress & 0xff) == 0) { + *EfuseFreeBlock = (UCHAR) (EFUSE_USAGE_MAP_END - i + 1); break; - } - else if(( (LogicalAddress >> 8) & 0xff) == 0) - { - *EfuseFreeBlock = (UCHAR) (EFUSE_USAGE_MAP_END-i); + } else if (((LogicalAddress >> 8) & 0xff) == 0) { + *EfuseFreeBlock = (UCHAR) (EFUSE_USAGE_MAP_END - i); break; } - if(i == EFUSE_USAGE_MAP_END) + if (i == EFUSE_USAGE_MAP_END) *EfuseFreeBlock = 0; } - DBGPRINT(RT_DEBUG_TRACE,("eFuseGetFreeBlockCount is 0x%x\n",*EfuseFreeBlock)); + DBGPRINT(RT_DEBUG_TRACE, + ("eFuseGetFreeBlockCount is 0x%x\n", *EfuseFreeBlock)); } -INT eFuse_init( - IN PRTMP_ADAPTER pAd) +INT eFuse_init(IN PRTMP_ADAPTER pAd) { - UINT EfuseFreeBlock=0; - DBGPRINT(RT_DEBUG_ERROR, ("NVM is Efuse and its size =%x[%x-%x] \n",EFUSE_USAGE_MAP_SIZE,EFUSE_USAGE_MAP_START,EFUSE_USAGE_MAP_END)); + UINT EfuseFreeBlock = 0; + DBGPRINT(RT_DEBUG_ERROR, + ("NVM is Efuse and its size =%x[%x-%x] \n", + EFUSE_USAGE_MAP_SIZE, EFUSE_USAGE_MAP_START, + EFUSE_USAGE_MAP_END)); eFuseGetFreeBlockCount(pAd, &EfuseFreeBlock); return 0; diff --git a/drivers/staging/rt2860/common/ee_prom.c b/drivers/staging/rt2860/common/ee_prom.c index d600e9b829a0..b5be6f07ce75 100644 --- a/drivers/staging/rt2860/common/ee_prom.c +++ b/drivers/staging/rt2860/common/ee_prom.c @@ -35,25 +35,18 @@ -------- ---------- ---------------------------------------------- */ - #include "../rt_config.h" - - // IRQL = PASSIVE_LEVEL -static inline VOID RaiseClock( - IN PRTMP_ADAPTER pAd, - IN UINT32 *x) +static inline VOID RaiseClock(IN PRTMP_ADAPTER pAd, IN UINT32 * x) { *x = *x | EESK; RTMP_IO_WRITE32(pAd, E2PROM_CSR, *x); - RTMPusecDelay(1); // Max frequency = 1MHz in Spec. definition + RTMPusecDelay(1); // Max frequency = 1MHz in Spec. definition } // IRQL = PASSIVE_LEVEL -static inline VOID LowerClock( - IN PRTMP_ADAPTER pAd, - IN UINT32 *x) +static inline VOID LowerClock(IN PRTMP_ADAPTER pAd, IN UINT32 * x) { *x = *x & ~EESK; RTMP_IO_WRITE32(pAd, E2PROM_CSR, *x); @@ -61,67 +54,60 @@ static inline VOID LowerClock( } // IRQL = PASSIVE_LEVEL -static inline USHORT ShiftInBits( - IN PRTMP_ADAPTER pAd) +static inline USHORT ShiftInBits(IN PRTMP_ADAPTER pAd) { - UINT32 x,i; - USHORT data=0; + UINT32 x, i; + USHORT data = 0; RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - x &= ~( EEDO | EEDI); + x &= ~(EEDO | EEDI); - for(i=0; i<16; i++) - { + for (i = 0; i < 16; i++) { data = data << 1; RaiseClock(pAd, &x); RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - LowerClock(pAd, &x); //prevent read failed + LowerClock(pAd, &x); //prevent read failed x &= ~(EEDI); - if(x & EEDO) - data |= 1; + if (x & EEDO) + data |= 1; } return data; } - // IRQL = PASSIVE_LEVEL -static inline VOID ShiftOutBits( - IN PRTMP_ADAPTER pAd, - IN USHORT data, - IN USHORT count) +static inline VOID ShiftOutBits(IN PRTMP_ADAPTER pAd, + IN USHORT data, IN USHORT count) { - UINT32 x,mask; + UINT32 x, mask; mask = 0x01 << (count - 1); RTMP_IO_READ32(pAd, E2PROM_CSR, &x); x &= ~(EEDO | EEDI); - do - { - x &= ~EEDI; - if(data & mask) x |= EEDI; + do { + x &= ~EEDI; + if (data & mask) + x |= EEDI; - RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); + RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - RaiseClock(pAd, &x); - LowerClock(pAd, &x); + RaiseClock(pAd, &x); + LowerClock(pAd, &x); - mask = mask >> 1; - } while(mask); + mask = mask >> 1; + } while (mask); x &= ~EEDI; RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); } - // IRQL = PASSIVE_LEVEL -static inline VOID EEpromCleanup( - IN PRTMP_ADAPTER pAd) +static inline VOID EEpromCleanup(IN PRTMP_ADAPTER pAd) { UINT32 x; @@ -134,11 +120,9 @@ static inline VOID EEpromCleanup( LowerClock(pAd, &x); } - -static inline VOID EWEN( - IN PRTMP_ADAPTER pAd) +static inline VOID EWEN(IN PRTMP_ADAPTER pAd) { - UINT32 x; + UINT32 x; // reset bits and set EECS RTMP_IO_READ32(pAd, E2PROM_CSR, &x); @@ -157,11 +141,9 @@ static inline VOID EWEN( EEpromCleanup(pAd); } - -static inline VOID EWDS( - IN PRTMP_ADAPTER pAd) +static inline VOID EWDS(IN PRTMP_ADAPTER pAd) { - UINT32 x; + UINT32 x; // reset bits and set EECS RTMP_IO_READ32(pAd, E2PROM_CSR, &x); @@ -180,16 +162,12 @@ static inline VOID EWDS( EEpromCleanup(pAd); } - // IRQL = PASSIVE_LEVEL -int rtmp_ee_prom_read16( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - OUT USHORT *pValue) +int rtmp_ee_prom_read16(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, OUT USHORT * pValue) { - UINT32 x; - USHORT data; - + UINT32 x; + USHORT data; Offset /= 2; // reset bits and set EECS @@ -199,13 +177,11 @@ int rtmp_ee_prom_read16( RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); // patch can not access e-Fuse issue - if (!(IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) - { + if (!(IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) { // kick a pulse RaiseClock(pAd, &x); LowerClock(pAd, &x); } - // output the read_opcode and register number in that order ShiftOutBits(pAd, EEPROM_READ_OPCODE, 3); ShiftOutBits(pAd, Offset, pAd->EEPROMAddressNum); @@ -215,7 +191,6 @@ int rtmp_ee_prom_read16( EEpromCleanup(pAd); - *pValue = data; return NDIS_STATUS_SUCCESS; diff --git a/drivers/staging/rt2860/common/eeprom.c b/drivers/staging/rt2860/common/eeprom.c index 39276ca64c19..872b47c10b7f 100644 --- a/drivers/staging/rt2860/common/eeprom.c +++ b/drivers/staging/rt2860/common/eeprom.c @@ -36,62 +36,56 @@ */ #include "../rt_config.h" - -INT RtmpChipOpsEepromHook( - IN RTMP_ADAPTER *pAd, - IN INT infType) +INT RtmpChipOpsEepromHook(IN RTMP_ADAPTER * pAd, IN INT infType) { - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + RTMP_CHIP_OP *pChipOps = &pAd->chipOps; #ifdef RT30xx #ifdef RTMP_EFUSE_SUPPORT - UINT32 eFuseCtrl, MacCsr0; + UINT32 eFuseCtrl, MacCsr0; int index; index = 0; - do - { + do { RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0); pAd->MACVersion = MacCsr0; - if ((pAd->MACVersion != 0x00) && (pAd->MACVersion != 0xFFFFFFFF)) - break; + if ((pAd->MACVersion != 0x00) + && (pAd->MACVersion != 0xFFFFFFFF)) + break; RTMPusecDelay(10); } while (index++ < 100); - pAd->bUseEfuse=FALSE; + pAd->bUseEfuse = FALSE; RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrl); - pAd->bUseEfuse = ( (eFuseCtrl & 0x80000000) == 0x80000000) ? 1 : 0; - if(pAd->bUseEfuse) - { + pAd->bUseEfuse = ((eFuseCtrl & 0x80000000) == 0x80000000) ? 1 : 0; + if (pAd->bUseEfuse) { pChipOps->eeinit = eFuse_init; pChipOps->eeread = rtmp_ee_efuse_read16; - return 0 ; - } - else + return 0; + } else DBGPRINT(RT_DEBUG_TRACE, ("NVM is EEPROM\n")); #endif // RTMP_EFUSE_SUPPORT // #endif // RT30xx // - switch(infType) - { + switch (infType) { #ifdef RTMP_PCI_SUPPORT - case RTMP_DEV_INF_PCI: - pChipOps->eeinit = NULL; - pChipOps->eeread = rtmp_ee_prom_read16; - break; + case RTMP_DEV_INF_PCI: + pChipOps->eeinit = NULL; + pChipOps->eeread = rtmp_ee_prom_read16; + break; #endif // RTMP_PCI_SUPPORT // #ifdef RTMP_USB_SUPPORT - case RTMP_DEV_INF_USB: - pChipOps->eeinit = NULL; - pChipOps->eeread = RTUSBReadEEPROM16; - break; + case RTMP_DEV_INF_USB: + pChipOps->eeinit = NULL; + pChipOps->eeread = RTUSBReadEEPROM16; + break; #endif // RTMP_USB_SUPPORT // - default: - DBGPRINT(RT_DEBUG_ERROR, ("RtmpChipOpsEepromHook() failed!\n")); - break; - } + default: + DBGPRINT(RT_DEBUG_ERROR, ("RtmpChipOpsEepromHook() failed!\n")); + break; + } return 0; } diff --git a/drivers/staging/rt2860/common/mlme.c b/drivers/staging/rt2860/common/mlme.c index 9c250c2b3294..1d97b7303d3d 100644 --- a/drivers/staging/rt2860/common/mlme.c +++ b/drivers/staging/rt2860/common/mlme.c @@ -39,300 +39,309 @@ #include "../rt_config.h" #include -UCHAR CISCO_OUI[] = {0x00, 0x40, 0x96}; - -UCHAR WPA_OUI[] = {0x00, 0x50, 0xf2, 0x01}; -UCHAR RSN_OUI[] = {0x00, 0x0f, 0xac}; -UCHAR WME_INFO_ELEM[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01}; -UCHAR WME_PARM_ELEM[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01}; -UCHAR Ccx2QosInfo[] = {0x00, 0x40, 0x96, 0x04}; -UCHAR RALINK_OUI[] = {0x00, 0x0c, 0x43}; -UCHAR BROADCOM_OUI[] = {0x00, 0x90, 0x4c}; -UCHAR WPS_OUI[] = {0x00, 0x50, 0xf2, 0x04}; -UCHAR PRE_N_HT_OUI[] = {0x00, 0x90, 0x4c}; +UCHAR CISCO_OUI[] = { 0x00, 0x40, 0x96 }; + +UCHAR WPA_OUI[] = { 0x00, 0x50, 0xf2, 0x01 }; +UCHAR RSN_OUI[] = { 0x00, 0x0f, 0xac }; +UCHAR WME_INFO_ELEM[] = { 0x00, 0x50, 0xf2, 0x02, 0x00, 0x01 }; +UCHAR WME_PARM_ELEM[] = { 0x00, 0x50, 0xf2, 0x02, 0x01, 0x01 }; +UCHAR Ccx2QosInfo[] = { 0x00, 0x40, 0x96, 0x04 }; +UCHAR RALINK_OUI[] = { 0x00, 0x0c, 0x43 }; +UCHAR BROADCOM_OUI[] = { 0x00, 0x90, 0x4c }; +UCHAR WPS_OUI[] = { 0x00, 0x50, 0xf2, 0x04 }; +UCHAR PRE_N_HT_OUI[] = { 0x00, 0x90, 0x4c }; UCHAR RateSwitchTable[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x11, 0x00, 0, 0, 0, // Initial used item after association - 0x00, 0x00, 0, 40, 101, - 0x01, 0x00, 1, 40, 50, - 0x02, 0x00, 2, 35, 45, - 0x03, 0x00, 3, 20, 45, - 0x04, 0x21, 0, 30, 50, - 0x05, 0x21, 1, 20, 50, - 0x06, 0x21, 2, 20, 50, - 0x07, 0x21, 3, 15, 50, - 0x08, 0x21, 4, 15, 30, - 0x09, 0x21, 5, 10, 25, - 0x0a, 0x21, 6, 8, 25, - 0x0b, 0x21, 7, 8, 25, - 0x0c, 0x20, 12, 15, 30, - 0x0d, 0x20, 13, 8, 20, - 0x0e, 0x20, 14, 8, 20, - 0x0f, 0x20, 15, 8, 25, - 0x10, 0x22, 15, 8, 25, - 0x11, 0x00, 0, 0, 0, - 0x12, 0x00, 0, 0, 0, - 0x13, 0x00, 0, 0, 0, - 0x14, 0x00, 0, 0, 0, - 0x15, 0x00, 0, 0, 0, - 0x16, 0x00, 0, 0, 0, - 0x17, 0x00, 0, 0, 0, - 0x18, 0x00, 0, 0, 0, - 0x19, 0x00, 0, 0, 0, - 0x1a, 0x00, 0, 0, 0, - 0x1b, 0x00, 0, 0, 0, - 0x1c, 0x00, 0, 0, 0, - 0x1d, 0x00, 0, 0, 0, - 0x1e, 0x00, 0, 0, 0, - 0x1f, 0x00, 0, 0, 0, +// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) + 0x11, 0x00, 0, 0, 0, // Initial used item after association + 0x00, 0x00, 0, 40, 101, + 0x01, 0x00, 1, 40, 50, + 0x02, 0x00, 2, 35, 45, + 0x03, 0x00, 3, 20, 45, + 0x04, 0x21, 0, 30, 50, + 0x05, 0x21, 1, 20, 50, + 0x06, 0x21, 2, 20, 50, + 0x07, 0x21, 3, 15, 50, + 0x08, 0x21, 4, 15, 30, + 0x09, 0x21, 5, 10, 25, + 0x0a, 0x21, 6, 8, 25, + 0x0b, 0x21, 7, 8, 25, + 0x0c, 0x20, 12, 15, 30, + 0x0d, 0x20, 13, 8, 20, + 0x0e, 0x20, 14, 8, 20, + 0x0f, 0x20, 15, 8, 25, + 0x10, 0x22, 15, 8, 25, + 0x11, 0x00, 0, 0, 0, + 0x12, 0x00, 0, 0, 0, + 0x13, 0x00, 0, 0, 0, + 0x14, 0x00, 0, 0, 0, + 0x15, 0x00, 0, 0, 0, + 0x16, 0x00, 0, 0, 0, + 0x17, 0x00, 0, 0, 0, + 0x18, 0x00, 0, 0, 0, + 0x19, 0x00, 0, 0, 0, + 0x1a, 0x00, 0, 0, 0, + 0x1b, 0x00, 0, 0, 0, + 0x1c, 0x00, 0, 0, 0, + 0x1d, 0x00, 0, 0, 0, + 0x1e, 0x00, 0, 0, 0, + 0x1f, 0x00, 0, 0, 0, }; UCHAR RateSwitchTable11B[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x04, 0x03, 0, 0, 0, // Initial used item after association - 0x00, 0x00, 0, 40, 101, - 0x01, 0x00, 1, 40, 50, - 0x02, 0x00, 2, 35, 45, - 0x03, 0x00, 3, 20, 45, +// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) + 0x04, 0x03, 0, 0, 0, // Initial used item after association + 0x00, 0x00, 0, 40, 101, + 0x01, 0x00, 1, 40, 50, + 0x02, 0x00, 2, 35, 45, + 0x03, 0x00, 3, 20, 45, }; UCHAR RateSwitchTable11BG[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0a, 0x00, 0, 0, 0, // Initial used item after association - 0x00, 0x00, 0, 40, 101, - 0x01, 0x00, 1, 40, 50, - 0x02, 0x00, 2, 35, 45, - 0x03, 0x00, 3, 20, 45, - 0x04, 0x10, 2, 20, 35, - 0x05, 0x10, 3, 16, 35, - 0x06, 0x10, 4, 10, 25, - 0x07, 0x10, 5, 16, 25, - 0x08, 0x10, 6, 10, 25, - 0x09, 0x10, 7, 10, 13, +// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) + 0x0a, 0x00, 0, 0, 0, // Initial used item after association + 0x00, 0x00, 0, 40, 101, + 0x01, 0x00, 1, 40, 50, + 0x02, 0x00, 2, 35, 45, + 0x03, 0x00, 3, 20, 45, + 0x04, 0x10, 2, 20, 35, + 0x05, 0x10, 3, 16, 35, + 0x06, 0x10, 4, 10, 25, + 0x07, 0x10, 5, 16, 25, + 0x08, 0x10, 6, 10, 25, + 0x09, 0x10, 7, 10, 13, }; UCHAR RateSwitchTable11G[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x08, 0x00, 0, 0, 0, // Initial used item after association - 0x00, 0x10, 0, 20, 101, - 0x01, 0x10, 1, 20, 35, - 0x02, 0x10, 2, 20, 35, - 0x03, 0x10, 3, 16, 35, - 0x04, 0x10, 4, 10, 25, - 0x05, 0x10, 5, 16, 25, - 0x06, 0x10, 6, 10, 25, - 0x07, 0x10, 7, 10, 13, +// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) + 0x08, 0x00, 0, 0, 0, // Initial used item after association + 0x00, 0x10, 0, 20, 101, + 0x01, 0x10, 1, 20, 35, + 0x02, 0x10, 2, 20, 35, + 0x03, 0x10, 3, 16, 35, + 0x04, 0x10, 4, 10, 25, + 0x05, 0x10, 5, 16, 25, + 0x06, 0x10, 6, 10, 25, + 0x07, 0x10, 7, 10, 13, }; UCHAR RateSwitchTable11N1S[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0c, 0x0a, 0, 0, 0, // Initial used item after association - 0x00, 0x00, 0, 40, 101, - 0x01, 0x00, 1, 40, 50, - 0x02, 0x00, 2, 25, 45, - 0x03, 0x21, 0, 20, 35, - 0x04, 0x21, 1, 20, 35, - 0x05, 0x21, 2, 20, 35, - 0x06, 0x21, 3, 15, 35, - 0x07, 0x21, 4, 15, 30, - 0x08, 0x21, 5, 10, 25, - 0x09, 0x21, 6, 8, 14, - 0x0a, 0x21, 7, 8, 14, - 0x0b, 0x23, 7, 8, 14, +// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) + 0x0c, 0x0a, 0, 0, 0, // Initial used item after association + 0x00, 0x00, 0, 40, 101, + 0x01, 0x00, 1, 40, 50, + 0x02, 0x00, 2, 25, 45, + 0x03, 0x21, 0, 20, 35, + 0x04, 0x21, 1, 20, 35, + 0x05, 0x21, 2, 20, 35, + 0x06, 0x21, 3, 15, 35, + 0x07, 0x21, 4, 15, 30, + 0x08, 0x21, 5, 10, 25, + 0x09, 0x21, 6, 8, 14, + 0x0a, 0x21, 7, 8, 14, + 0x0b, 0x23, 7, 8, 14, }; UCHAR RateSwitchTable11N2S[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0e, 0x0c, 0, 0, 0, // Initial used item after association - 0x00, 0x00, 0, 40, 101, - 0x01, 0x00, 1, 40, 50, - 0x02, 0x00, 2, 25, 45, - 0x03, 0x21, 0, 20, 35, - 0x04, 0x21, 1, 20, 35, - 0x05, 0x21, 2, 20, 35, - 0x06, 0x21, 3, 15, 35, - 0x07, 0x21, 4, 15, 30, - 0x08, 0x20, 11, 15, 30, - 0x09, 0x20, 12, 15, 30, - 0x0a, 0x20, 13, 8, 20, - 0x0b, 0x20, 14, 8, 20, - 0x0c, 0x20, 15, 8, 25, - 0x0d, 0x22, 15, 8, 15, +// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) + 0x0e, 0x0c, 0, 0, 0, // Initial used item after association + 0x00, 0x00, 0, 40, 101, + 0x01, 0x00, 1, 40, 50, + 0x02, 0x00, 2, 25, 45, + 0x03, 0x21, 0, 20, 35, + 0x04, 0x21, 1, 20, 35, + 0x05, 0x21, 2, 20, 35, + 0x06, 0x21, 3, 15, 35, + 0x07, 0x21, 4, 15, 30, + 0x08, 0x20, 11, 15, 30, + 0x09, 0x20, 12, 15, 30, + 0x0a, 0x20, 13, 8, 20, + 0x0b, 0x20, 14, 8, 20, + 0x0c, 0x20, 15, 8, 25, + 0x0d, 0x22, 15, 8, 15, }; UCHAR RateSwitchTable11N3S[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0b, 0x00, 0, 0, 0, // 0x0a, 0x00, 0, 0, 0, // Initial used item after association - 0x00, 0x21, 0, 30, 101, - 0x01, 0x21, 1, 20, 50, - 0x02, 0x21, 2, 20, 50, - 0x03, 0x21, 3, 15, 50, - 0x04, 0x21, 4, 15, 30, - 0x05, 0x20, 11, 15, 30, // Required by System-Alan @ 20080812 - 0x06, 0x20, 12, 15, 30, // 0x05, 0x20, 12, 15, 30, - 0x07, 0x20, 13, 8, 20, // 0x06, 0x20, 13, 8, 20, - 0x08, 0x20, 14, 8, 20, // 0x07, 0x20, 14, 8, 20, - 0x09, 0x20, 15, 8, 25, // 0x08, 0x20, 15, 8, 25, - 0x0a, 0x22, 15, 8, 25, // 0x09, 0x22, 15, 8, 25, +// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) + 0x0b, 0x00, 0, 0, 0, // 0x0a, 0x00, 0, 0, 0, // Initial used item after association + 0x00, 0x21, 0, 30, 101, + 0x01, 0x21, 1, 20, 50, + 0x02, 0x21, 2, 20, 50, + 0x03, 0x21, 3, 15, 50, + 0x04, 0x21, 4, 15, 30, + 0x05, 0x20, 11, 15, 30, // Required by System-Alan @ 20080812 + 0x06, 0x20, 12, 15, 30, // 0x05, 0x20, 12, 15, 30, + 0x07, 0x20, 13, 8, 20, // 0x06, 0x20, 13, 8, 20, + 0x08, 0x20, 14, 8, 20, // 0x07, 0x20, 14, 8, 20, + 0x09, 0x20, 15, 8, 25, // 0x08, 0x20, 15, 8, 25, + 0x0a, 0x22, 15, 8, 25, // 0x09, 0x22, 15, 8, 25, }; UCHAR RateSwitchTable11N2SForABand[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0b, 0x09, 0, 0, 0, // Initial used item after association - 0x00, 0x21, 0, 30, 101, - 0x01, 0x21, 1, 20, 50, - 0x02, 0x21, 2, 20, 50, - 0x03, 0x21, 3, 15, 50, - 0x04, 0x21, 4, 15, 30, - 0x05, 0x21, 5, 15, 30, - 0x06, 0x20, 12, 15, 30, - 0x07, 0x20, 13, 8, 20, - 0x08, 0x20, 14, 8, 20, - 0x09, 0x20, 15, 8, 25, - 0x0a, 0x22, 15, 8, 25, +// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) + 0x0b, 0x09, 0, 0, 0, // Initial used item after association + 0x00, 0x21, 0, 30, 101, + 0x01, 0x21, 1, 20, 50, + 0x02, 0x21, 2, 20, 50, + 0x03, 0x21, 3, 15, 50, + 0x04, 0x21, 4, 15, 30, + 0x05, 0x21, 5, 15, 30, + 0x06, 0x20, 12, 15, 30, + 0x07, 0x20, 13, 8, 20, + 0x08, 0x20, 14, 8, 20, + 0x09, 0x20, 15, 8, 25, + 0x0a, 0x22, 15, 8, 25, }; -UCHAR RateSwitchTable11N3SForABand[] = { // 3*3 -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0b, 0x09, 0, 0, 0, // Initial used item after association - 0x00, 0x21, 0, 30, 101, - 0x01, 0x21, 1, 20, 50, - 0x02, 0x21, 2, 20, 50, - 0x03, 0x21, 3, 15, 50, - 0x04, 0x21, 4, 15, 30, - 0x05, 0x21, 5, 15, 30, - 0x06, 0x20, 12, 15, 30, - 0x07, 0x20, 13, 8, 20, - 0x08, 0x20, 14, 8, 20, - 0x09, 0x20, 15, 8, 25, - 0x0a, 0x22, 15, 8, 25, +UCHAR RateSwitchTable11N3SForABand[] = { // 3*3 +// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) + 0x0b, 0x09, 0, 0, 0, // Initial used item after association + 0x00, 0x21, 0, 30, 101, + 0x01, 0x21, 1, 20, 50, + 0x02, 0x21, 2, 20, 50, + 0x03, 0x21, 3, 15, 50, + 0x04, 0x21, 4, 15, 30, + 0x05, 0x21, 5, 15, 30, + 0x06, 0x20, 12, 15, 30, + 0x07, 0x20, 13, 8, 20, + 0x08, 0x20, 14, 8, 20, + 0x09, 0x20, 15, 8, 25, + 0x0a, 0x22, 15, 8, 25, }; UCHAR RateSwitchTable11BGN1S[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0c, 0x0a, 0, 0, 0, // Initial used item after association - 0x00, 0x00, 0, 40, 101, - 0x01, 0x00, 1, 40, 50, - 0x02, 0x00, 2, 25, 45, - 0x03, 0x21, 0, 20, 35, - 0x04, 0x21, 1, 20, 35, - 0x05, 0x21, 2, 20, 35, - 0x06, 0x21, 3, 15, 35, - 0x07, 0x21, 4, 15, 30, - 0x08, 0x21, 5, 10, 25, - 0x09, 0x21, 6, 8, 14, - 0x0a, 0x21, 7, 8, 14, - 0x0b, 0x23, 7, 8, 14, +// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) + 0x0c, 0x0a, 0, 0, 0, // Initial used item after association + 0x00, 0x00, 0, 40, 101, + 0x01, 0x00, 1, 40, 50, + 0x02, 0x00, 2, 25, 45, + 0x03, 0x21, 0, 20, 35, + 0x04, 0x21, 1, 20, 35, + 0x05, 0x21, 2, 20, 35, + 0x06, 0x21, 3, 15, 35, + 0x07, 0x21, 4, 15, 30, + 0x08, 0x21, 5, 10, 25, + 0x09, 0x21, 6, 8, 14, + 0x0a, 0x21, 7, 8, 14, + 0x0b, 0x23, 7, 8, 14, }; UCHAR RateSwitchTable11BGN2S[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0e, 0x0c, 0, 0, 0, // Initial used item after association - 0x00, 0x00, 0, 40, 101, - 0x01, 0x00, 1, 40, 50, - 0x02, 0x00, 2, 25, 45, - 0x03, 0x21, 0, 20, 35, - 0x04, 0x21, 1, 20, 35, - 0x05, 0x21, 2, 20, 35, - 0x06, 0x21, 3, 15, 35, - 0x07, 0x21, 4, 15, 30, - 0x08, 0x20, 11, 15, 30, - 0x09, 0x20, 12, 15, 30, - 0x0a, 0x20, 13, 8, 20, - 0x0b, 0x20, 14, 8, 20, - 0x0c, 0x20, 15, 8, 25, - 0x0d, 0x22, 15, 8, 15, +// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) + 0x0e, 0x0c, 0, 0, 0, // Initial used item after association + 0x00, 0x00, 0, 40, 101, + 0x01, 0x00, 1, 40, 50, + 0x02, 0x00, 2, 25, 45, + 0x03, 0x21, 0, 20, 35, + 0x04, 0x21, 1, 20, 35, + 0x05, 0x21, 2, 20, 35, + 0x06, 0x21, 3, 15, 35, + 0x07, 0x21, 4, 15, 30, + 0x08, 0x20, 11, 15, 30, + 0x09, 0x20, 12, 15, 30, + 0x0a, 0x20, 13, 8, 20, + 0x0b, 0x20, 14, 8, 20, + 0x0c, 0x20, 15, 8, 25, + 0x0d, 0x22, 15, 8, 15, }; -UCHAR RateSwitchTable11BGN3S[] = { // 3*3 -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0a, 0x00, 0, 0, 0, // Initial used item after association - 0x00, 0x21, 0, 30,101, //50 - 0x01, 0x21, 1, 20, 50, - 0x02, 0x21, 2, 20, 50, - 0x03, 0x21, 3, 20, 50, - 0x04, 0x21, 4, 15, 50, - 0x05, 0x20, 20, 15, 30, - 0x06, 0x20, 21, 8, 20, - 0x07, 0x20, 22, 8, 20, - 0x08, 0x20, 23, 8, 25, - 0x09, 0x22, 23, 8, 25, +UCHAR RateSwitchTable11BGN3S[] = { // 3*3 +// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) + 0x0a, 0x00, 0, 0, 0, // Initial used item after association + 0x00, 0x21, 0, 30, 101, //50 + 0x01, 0x21, 1, 20, 50, + 0x02, 0x21, 2, 20, 50, + 0x03, 0x21, 3, 20, 50, + 0x04, 0x21, 4, 15, 50, + 0x05, 0x20, 20, 15, 30, + 0x06, 0x20, 21, 8, 20, + 0x07, 0x20, 22, 8, 20, + 0x08, 0x20, 23, 8, 25, + 0x09, 0x22, 23, 8, 25, }; UCHAR RateSwitchTable11BGN2SForABand[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0b, 0x09, 0, 0, 0, // Initial used item after association - 0x00, 0x21, 0, 30,101, //50 - 0x01, 0x21, 1, 20, 50, - 0x02, 0x21, 2, 20, 50, - 0x03, 0x21, 3, 15, 50, - 0x04, 0x21, 4, 15, 30, - 0x05, 0x21, 5, 15, 30, - 0x06, 0x20, 12, 15, 30, - 0x07, 0x20, 13, 8, 20, - 0x08, 0x20, 14, 8, 20, - 0x09, 0x20, 15, 8, 25, - 0x0a, 0x22, 15, 8, 25, +// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) + 0x0b, 0x09, 0, 0, 0, // Initial used item after association + 0x00, 0x21, 0, 30, 101, //50 + 0x01, 0x21, 1, 20, 50, + 0x02, 0x21, 2, 20, 50, + 0x03, 0x21, 3, 15, 50, + 0x04, 0x21, 4, 15, 30, + 0x05, 0x21, 5, 15, 30, + 0x06, 0x20, 12, 15, 30, + 0x07, 0x20, 13, 8, 20, + 0x08, 0x20, 14, 8, 20, + 0x09, 0x20, 15, 8, 25, + 0x0a, 0x22, 15, 8, 25, }; -UCHAR RateSwitchTable11BGN3SForABand[] = { // 3*3 -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0c, 0x09, 0, 0, 0, // Initial used item after association - 0x00, 0x21, 0, 30,101, //50 - 0x01, 0x21, 1, 20, 50, - 0x02, 0x21, 2, 20, 50, - 0x03, 0x21, 3, 15, 50, - 0x04, 0x21, 4, 15, 30, - 0x05, 0x21, 5, 15, 30, - 0x06, 0x21, 12, 15, 30, - 0x07, 0x20, 20, 15, 30, - 0x08, 0x20, 21, 8, 20, - 0x09, 0x20, 22, 8, 20, - 0x0a, 0x20, 23, 8, 25, - 0x0b, 0x22, 23, 8, 25, +UCHAR RateSwitchTable11BGN3SForABand[] = { // 3*3 +// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) + 0x0c, 0x09, 0, 0, 0, // Initial used item after association + 0x00, 0x21, 0, 30, 101, //50 + 0x01, 0x21, 1, 20, 50, + 0x02, 0x21, 2, 20, 50, + 0x03, 0x21, 3, 15, 50, + 0x04, 0x21, 4, 15, 30, + 0x05, 0x21, 5, 15, 30, + 0x06, 0x21, 12, 15, 30, + 0x07, 0x20, 20, 15, 30, + 0x08, 0x20, 21, 8, 20, + 0x09, 0x20, 22, 8, 20, + 0x0a, 0x20, 23, 8, 25, + 0x0b, 0x22, 23, 8, 25, }; - -extern UCHAR OfdmRateToRxwiMCS[]; +extern UCHAR OfdmRateToRxwiMCS[]; // since RT61 has better RX sensibility, we have to limit TX ACK rate not to exceed our normal data TX rate. // otherwise the WLAN peer may not be able to receive the ACK thus downgrade its data TX rate -ULONG BasicRateMask[12] = {0xfffff001 /* 1-Mbps */, 0xfffff003 /* 2 Mbps */, 0xfffff007 /* 5.5 */, 0xfffff00f /* 11 */, - 0xfffff01f /* 6 */ , 0xfffff03f /* 9 */ , 0xfffff07f /* 12 */ , 0xfffff0ff /* 18 */, - 0xfffff1ff /* 24 */ , 0xfffff3ff /* 36 */ , 0xfffff7ff /* 48 */ , 0xffffffff /* 54 */}; +ULONG BasicRateMask[12] = + { 0xfffff001 /* 1-Mbps */ , 0xfffff003 /* 2 Mbps */ , 0xfffff007 /* 5.5 */ , +0xfffff00f /* 11 */ , + 0xfffff01f /* 6 */ , 0xfffff03f /* 9 */ , 0xfffff07f /* 12 */ , + 0xfffff0ff /* 18 */ , + 0xfffff1ff /* 24 */ , 0xfffff3ff /* 36 */ , 0xfffff7ff /* 48 */ , + 0xffffffff /* 54 */ +}; -UCHAR BROADCAST_ADDR[MAC_ADDR_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; -UCHAR ZERO_MAC_ADDR[MAC_ADDR_LEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +UCHAR BROADCAST_ADDR[MAC_ADDR_LEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; +UCHAR ZERO_MAC_ADDR[MAC_ADDR_LEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; // e.g. RssiSafeLevelForTxRate[RATE_36]" means if the current RSSI is greater than -// this value, then it's quaranteed capable of operating in 36 mbps TX rate in -// clean environment. -// TxRate: 1 2 5.5 11 6 9 12 18 24 36 48 54 72 100 -CHAR RssiSafeLevelForTxRate[] ={ -92, -91, -90, -87, -88, -86, -85, -83, -81, -78, -72, -71, -40, -40 }; - -UCHAR RateIdToMbps[] = { 1, 2, 5, 11, 6, 9, 12, 18, 24, 36, 48, 54, 72, 100}; -USHORT RateIdTo500Kbps[] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108, 144, 200}; - -UCHAR SsidIe = IE_SSID; -UCHAR SupRateIe = IE_SUPP_RATES; -UCHAR ExtRateIe = IE_EXT_SUPP_RATES; -UCHAR HtCapIe = IE_HT_CAP; -UCHAR AddHtInfoIe = IE_ADD_HT; -UCHAR NewExtChanIe = IE_SECONDARY_CH_OFFSET; -UCHAR ErpIe = IE_ERP; -UCHAR DsIe = IE_DS_PARM; -UCHAR TimIe = IE_TIM; -UCHAR WpaIe = IE_WPA; -UCHAR Wpa2Ie = IE_WPA2; -UCHAR IbssIe = IE_IBSS_PARM; - -extern UCHAR WPA_OUI[]; - -UCHAR SES_OUI[] = {0x00, 0x90, 0x4c}; - -UCHAR ZeroSsid[32] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; - +// this value, then it's quaranteed capable of operating in 36 mbps TX rate in +// clean environment. +// TxRate: 1 2 5.5 11 6 9 12 18 24 36 48 54 72 100 +CHAR RssiSafeLevelForTxRate[] = + { -92, -91, -90, -87, -88, -86, -85, -83, -81, -78, -72, -71, -40, -40 }; + +UCHAR RateIdToMbps[] = { 1, 2, 5, 11, 6, 9, 12, 18, 24, 36, 48, 54, 72, 100 }; +USHORT RateIdTo500Kbps[] = + { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108, 144, 200 }; + +UCHAR SsidIe = IE_SSID; +UCHAR SupRateIe = IE_SUPP_RATES; +UCHAR ExtRateIe = IE_EXT_SUPP_RATES; +UCHAR HtCapIe = IE_HT_CAP; +UCHAR AddHtInfoIe = IE_ADD_HT; +UCHAR NewExtChanIe = IE_SECONDARY_CH_OFFSET; +UCHAR ErpIe = IE_ERP; +UCHAR DsIe = IE_DS_PARM; +UCHAR TimIe = IE_TIM; +UCHAR WpaIe = IE_WPA; +UCHAR Wpa2Ie = IE_WPA2; +UCHAR IbssIe = IE_IBSS_PARM; + +extern UCHAR WPA_OUI[]; + +UCHAR SES_OUI[] = { 0x00, 0x90, 0x4c }; + +UCHAR ZeroSsid[32] = + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 +}; /* ========================================================================== @@ -347,17 +356,15 @@ UCHAR ZeroSsid[32] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 ========================================================================== */ -NDIS_STATUS MlmeInit( - IN PRTMP_ADAPTER pAd) +NDIS_STATUS MlmeInit(IN PRTMP_ADAPTER pAd) { NDIS_STATUS Status = NDIS_STATUS_SUCCESS; DBGPRINT(RT_DEBUG_TRACE, ("--> MLME Initialize\n")); - do - { + do { Status = MlmeQueueInit(&pAd->Mlme.Queue); - if(Status != NDIS_STATUS_SUCCESS) + if (Status != NDIS_STATUS_SUCCESS) break; pAd->Mlme.bRunning = FALSE; @@ -367,48 +374,60 @@ NDIS_STATUS MlmeInit( BssTableInit(&pAd->ScanTab); // init STA state machines - AssocStateMachineInit(pAd, &pAd->Mlme.AssocMachine, pAd->Mlme.AssocFunc); - AuthStateMachineInit(pAd, &pAd->Mlme.AuthMachine, pAd->Mlme.AuthFunc); - AuthRspStateMachineInit(pAd, &pAd->Mlme.AuthRspMachine, pAd->Mlme.AuthRspFunc); - SyncStateMachineInit(pAd, &pAd->Mlme.SyncMachine, pAd->Mlme.SyncFunc); - - - + AssocStateMachineInit(pAd, &pAd->Mlme.AssocMachine, + pAd->Mlme.AssocFunc); + AuthStateMachineInit(pAd, &pAd->Mlme.AuthMachine, + pAd->Mlme.AuthFunc); + AuthRspStateMachineInit(pAd, &pAd->Mlme.AuthRspMachine, + pAd->Mlme.AuthRspFunc); + SyncStateMachineInit(pAd, &pAd->Mlme.SyncMachine, + pAd->Mlme.SyncFunc); // Since we are using switch/case to implement it, the init is different from the above // state machine init MlmeCntlInit(pAd, &pAd->Mlme.CntlMachine, NULL); } + WpaStateMachineInit(pAd, &pAd->Mlme.WpaMachine, + pAd->Mlme.WpaFunc); - WpaStateMachineInit(pAd, &pAd->Mlme.WpaMachine, pAd->Mlme.WpaFunc); - - - ActionStateMachineInit(pAd, &pAd->Mlme.ActMachine, pAd->Mlme.ActFunc); + ActionStateMachineInit(pAd, &pAd->Mlme.ActMachine, + pAd->Mlme.ActFunc); // Init mlme periodic timer - RTMPInitTimer(pAd, &pAd->Mlme.PeriodicTimer, GET_TIMER_FUNCTION(MlmePeriodicExec), pAd, TRUE); + RTMPInitTimer(pAd, &pAd->Mlme.PeriodicTimer, + GET_TIMER_FUNCTION(MlmePeriodicExec), pAd, TRUE); // Set mlme periodic timer RTMPSetTimer(&pAd->Mlme.PeriodicTimer, MLME_TASK_EXEC_INTV); // software-based RX Antenna diversity - RTMPInitTimer(pAd, &pAd->Mlme.RxAntEvalTimer, GET_TIMER_FUNCTION(AsicRxAntEvalTimeout), pAd, FALSE); + RTMPInitTimer(pAd, &pAd->Mlme.RxAntEvalTimer, + GET_TIMER_FUNCTION(AsicRxAntEvalTimeout), pAd, + FALSE); { #ifdef RTMP_PCI_SUPPORT - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - // only PCIe cards need these two timers - RTMPInitTimer(pAd, &pAd->Mlme.PsPollTimer, GET_TIMER_FUNCTION(PsPollWakeExec), pAd, FALSE); - RTMPInitTimer(pAd, &pAd->Mlme.RadioOnOffTimer, GET_TIMER_FUNCTION(RadioOnExec), pAd, FALSE); - } + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { + // only PCIe cards need these two timers + RTMPInitTimer(pAd, &pAd->Mlme.PsPollTimer, + GET_TIMER_FUNCTION + (PsPollWakeExec), pAd, FALSE); + RTMPInitTimer(pAd, &pAd->Mlme.RadioOnOffTimer, + GET_TIMER_FUNCTION(RadioOnExec), + pAd, FALSE); + } #endif // RTMP_PCI_SUPPORT // - RTMPInitTimer(pAd, &pAd->Mlme.LinkDownTimer, GET_TIMER_FUNCTION(LinkDownExec), pAd, FALSE); + RTMPInitTimer(pAd, &pAd->Mlme.LinkDownTimer, + GET_TIMER_FUNCTION(LinkDownExec), pAd, + FALSE); #ifdef RTMP_MAC_USB - RTMPInitTimer(pAd, &pAd->Mlme.AutoWakeupTimer, GET_TIMER_FUNCTION(RtmpUsbStaAsicForceWakeupTimeout), pAd, FALSE); + RTMPInitTimer(pAd, &pAd->Mlme.AutoWakeupTimer, + GET_TIMER_FUNCTION + (RtmpUsbStaAsicForceWakeupTimeout), pAd, + FALSE); pAd->Mlme.AutoWakeupTimerRunning = FALSE; #endif // RTMP_MAC_USB // } @@ -434,43 +453,37 @@ NDIS_STATUS MlmeInit( ========================================================================== */ -VOID MlmeHandler( - IN PRTMP_ADAPTER pAd) +VOID MlmeHandler(IN PRTMP_ADAPTER pAd) { - MLME_QUEUE_ELEM *Elem = NULL; + MLME_QUEUE_ELEM *Elem = NULL; // Only accept MLME and Frame from peer side, no other (control/data) frame should // get into this state machine NdisAcquireSpinLock(&pAd->Mlme.TaskLock); - if(pAd->Mlme.bRunning) - { + if (pAd->Mlme.bRunning) { NdisReleaseSpinLock(&pAd->Mlme.TaskLock); return; - } - else - { + } else { pAd->Mlme.bRunning = TRUE; } NdisReleaseSpinLock(&pAd->Mlme.TaskLock); - while (!MlmeQueueEmpty(&pAd->Mlme.Queue)) - { + while (!MlmeQueueEmpty(&pAd->Mlme.Queue)) { if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_MLME_RESET_IN_PROGRESS) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) - { - DBGPRINT(RT_DEBUG_TRACE, ("Device Halted or Removed or MlmeRest, exit MlmeHandler! (queue num = %ld)\n", pAd->Mlme.Queue.Num)); + RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS) || + RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) { + DBGPRINT(RT_DEBUG_TRACE, + ("Device Halted or Removed or MlmeRest, exit MlmeHandler! (queue num = %ld)\n", + pAd->Mlme.Queue.Num)); break; } - //From message type, determine which state machine I should drive - if (MlmeDequeue(&pAd->Mlme.Queue, &Elem)) - { + if (MlmeDequeue(&pAd->Mlme.Queue, &Elem)) { #ifdef RTMP_MAC_USB - if (Elem->MsgType == MT2_RESET_CONF) - { - DBGPRINT_RAW(RT_DEBUG_TRACE, ("!!! reset MLME state machine !!!\n")); + if (Elem->MsgType == MT2_RESET_CONF) { + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("!!! reset MLME state machine !!!\n")); MlmeRestartStateMachine(pAd); Elem->Occupied = FALSE; Elem->MsgLen = 0; @@ -479,50 +492,63 @@ VOID MlmeHandler( #endif // RTMP_MAC_USB // // if dequeue success - switch (Elem->Machine) - { + switch (Elem->Machine) { // STA state machines - case ASSOC_STATE_MACHINE: - StateMachinePerformAction(pAd, &pAd->Mlme.AssocMachine, Elem); - break; - case AUTH_STATE_MACHINE: - StateMachinePerformAction(pAd, &pAd->Mlme.AuthMachine, Elem); - break; - case AUTH_RSP_STATE_MACHINE: - StateMachinePerformAction(pAd, &pAd->Mlme.AuthRspMachine, Elem); - break; - case SYNC_STATE_MACHINE: - StateMachinePerformAction(pAd, &pAd->Mlme.SyncMachine, Elem); - break; - case MLME_CNTL_STATE_MACHINE: - MlmeCntlMachinePerformAction(pAd, &pAd->Mlme.CntlMachine, Elem); - break; - case WPA_PSK_STATE_MACHINE: - StateMachinePerformAction(pAd, &pAd->Mlme.WpaPskMachine, Elem); - break; - - - - case ACTION_STATE_MACHINE: - StateMachinePerformAction(pAd, &pAd->Mlme.ActMachine, Elem); - break; + case ASSOC_STATE_MACHINE: + StateMachinePerformAction(pAd, + &pAd->Mlme. + AssocMachine, Elem); + break; + case AUTH_STATE_MACHINE: + StateMachinePerformAction(pAd, + &pAd->Mlme. + AuthMachine, Elem); + break; + case AUTH_RSP_STATE_MACHINE: + StateMachinePerformAction(pAd, + &pAd->Mlme. + AuthRspMachine, Elem); + break; + case SYNC_STATE_MACHINE: + StateMachinePerformAction(pAd, + &pAd->Mlme. + SyncMachine, Elem); + break; + case MLME_CNTL_STATE_MACHINE: + MlmeCntlMachinePerformAction(pAd, + &pAd->Mlme. + CntlMachine, Elem); + break; + case WPA_PSK_STATE_MACHINE: + StateMachinePerformAction(pAd, + &pAd->Mlme. + WpaPskMachine, Elem); + break; - case WPA_STATE_MACHINE: - StateMachinePerformAction(pAd, &pAd->Mlme.WpaMachine, Elem); - break; + case ACTION_STATE_MACHINE: + StateMachinePerformAction(pAd, + &pAd->Mlme.ActMachine, + Elem); + break; + case WPA_STATE_MACHINE: + StateMachinePerformAction(pAd, + &pAd->Mlme.WpaMachine, + Elem); + break; - default: - DBGPRINT(RT_DEBUG_TRACE, ("ERROR: Illegal machine %ld in MlmeHandler()\n", Elem->Machine)); - break; - } // end of switch + default: + DBGPRINT(RT_DEBUG_TRACE, + ("ERROR: Illegal machine %ld in MlmeHandler()\n", + Elem->Machine)); + break; + } // end of switch // free MLME element Elem->Occupied = FALSE; Elem->MsgLen = 0; - } - else { + } else { DBGPRINT_ERR(("MlmeHandler: MlmeQueue empty\n")); } } @@ -545,74 +571,67 @@ VOID MlmeHandler( ========================================================================== */ -VOID MlmeHalt( - IN PRTMP_ADAPTER pAd) +VOID MlmeHalt(IN PRTMP_ADAPTER pAd) { - BOOLEAN Cancelled; + BOOLEAN Cancelled; DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeHalt\n")); - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) - { + if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) { // disable BEACON generation and other BEACON related hardware timers AsicDisableSync(pAd); } { // Cancel pending timers - RTMPCancelTimer(&pAd->MlmeAux.AssocTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.ReassocTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.DisassocTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.AuthTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &Cancelled); - + RTMPCancelTimer(&pAd->MlmeAux.AssocTimer, &Cancelled); + RTMPCancelTimer(&pAd->MlmeAux.ReassocTimer, &Cancelled); + RTMPCancelTimer(&pAd->MlmeAux.DisassocTimer, &Cancelled); + RTMPCancelTimer(&pAd->MlmeAux.AuthTimer, &Cancelled); + RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &Cancelled); + RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &Cancelled); #ifdef RTMP_MAC_PCI - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) - &&(pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) { + RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); + RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); } #endif // RTMP_MAC_PCI // - RTMPCancelTimer(&pAd->Mlme.LinkDownTimer, &Cancelled); + RTMPCancelTimer(&pAd->Mlme.LinkDownTimer, &Cancelled); #ifdef RTMP_MAC_USB RTMPCancelTimer(&pAd->Mlme.AutoWakeupTimer, &Cancelled); #endif // RTMP_MAC_USB // } - RTMPCancelTimer(&pAd->Mlme.PeriodicTimer, &Cancelled); - RTMPCancelTimer(&pAd->Mlme.RxAntEvalTimer, &Cancelled); + RTMPCancelTimer(&pAd->Mlme.PeriodicTimer, &Cancelled); + RTMPCancelTimer(&pAd->Mlme.RxAntEvalTimer, &Cancelled); - - - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) - { + if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) { RTMP_CHIP_OP *pChipOps = &pAd->chipOps; // Set LED RTMPSetLED(pAd, LED_HALT); - RTMPSetSignalLED(pAd, -100); // Force signal strength Led to be turned off, firmware is not done it. + RTMPSetSignalLED(pAd, -100); // Force signal strength Led to be turned off, firmware is not done it. #ifdef RTMP_MAC_USB - { - LED_CFG_STRUC LedCfg; - RTMP_IO_READ32(pAd, LED_CFG, &LedCfg.word); - LedCfg.field.LedPolar = 0; - LedCfg.field.RLedMode = 0; - LedCfg.field.GLedMode = 0; - LedCfg.field.YLedMode = 0; - RTMP_IO_WRITE32(pAd, LED_CFG, LedCfg.word); - } + { + LED_CFG_STRUC LedCfg; + RTMP_IO_READ32(pAd, LED_CFG, &LedCfg.word); + LedCfg.field.LedPolar = 0; + LedCfg.field.RLedMode = 0; + LedCfg.field.GLedMode = 0; + LedCfg.field.YLedMode = 0; + RTMP_IO_WRITE32(pAd, LED_CFG, LedCfg.word); + } #endif // RTMP_MAC_USB // if (pChipOps->AsicHaltAction) pChipOps->AsicHaltAction(pAd); } - RTMPusecDelay(5000); // 5 msec to gurantee Ant Diversity timer canceled + RTMPusecDelay(5000); // 5 msec to gurantee Ant Diversity timer canceled MlmeQueueDestroy(&pAd->Mlme.Queue); NdisFreeSpinLock(&pAd->Mlme.TaskLock); @@ -620,10 +639,10 @@ VOID MlmeHalt( DBGPRINT(RT_DEBUG_TRACE, ("<== MlmeHalt\n")); } -VOID MlmeResetRalinkCounters( - IN PRTMP_ADAPTER pAd) +VOID MlmeResetRalinkCounters(IN PRTMP_ADAPTER pAd) { - pAd->RalinkCounters.LastOneSecRxOkDataCnt = pAd->RalinkCounters.OneSecRxOkDataCnt; + pAd->RalinkCounters.LastOneSecRxOkDataCnt = + pAd->RalinkCounters.OneSecRxOkDataCnt; // clear all OneSecxxx counters. pAd->RalinkCounters.OneSecBeaconSentCnt = 0; pAd->RalinkCounters.OneSecFalseCCACnt = 0; @@ -653,7 +672,6 @@ VOID MlmeResetRalinkCounters( return; } - /* ========================================================================== Description: @@ -670,26 +688,25 @@ VOID MlmeResetRalinkCounters( ========================================================================== */ -#define ADHOC_BEACON_LOST_TIME (8*OS_HZ) // 8 sec -VOID MlmePeriodicExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +#define ADHOC_BEACON_LOST_TIME (8*OS_HZ) // 8 sec +VOID MlmePeriodicExec(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) { - ULONG TxTotalCnt; - PRTMP_ADAPTER pAd = (RTMP_ADAPTER *)FunctionContext; + ULONG TxTotalCnt; + PRTMP_ADAPTER pAd = (RTMP_ADAPTER *) FunctionContext; #ifdef RTMP_MAC_PCI { - // If Hardware controlled Radio enabled, we have to check GPIO pin2 every 2 second. + // If Hardware controlled Radio enabled, we have to check GPIO pin2 every 2 second. // Move code to here, because following code will return when radio is off - if ((pAd->Mlme.PeriodicRound % (MLME_TASK_EXEC_MULTIPLE * 2) == 0) && (pAd->StaCfg.bHardwareRadio == TRUE) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) - /*&&(pAd->bPCIclkOff == FALSE)*/) - { - UINT32 data = 0; + if ((pAd->Mlme.PeriodicRound % (MLME_TASK_EXEC_MULTIPLE * 2) == + 0) && (pAd->StaCfg.bHardwareRadio == TRUE) + && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) + && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) + /*&&(pAd->bPCIclkOff == FALSE) */ + ) { + UINT32 data = 0; // Read GPIO pin2 as Hardware controlled radio state #ifndef RT3090 @@ -699,39 +716,34 @@ VOID MlmePeriodicExec( #ifdef RT3090 // Read GPIO pin2 as Hardware controlled radio state // We need to Read GPIO if HW said so no mater what advance power saving -if ((pAd->OpMode == OPMODE_STA) && (IDLE_ON(pAd)) - && (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF)) - && (pAd->StaCfg.PSControl.field.EnablePSinIdle == TRUE)) - { - // Want to make sure device goes to L0 state before reading register. - RTMPPCIeLinkCtrlValueRestore(pAd, 0); - RTMP_IO_FORCE_READ32(pAd, GPIO_CTRL_CFG, &data); - RTMPPCIeLinkCtrlSetting(pAd, 3); - } -else - RTMP_IO_FORCE_READ32(pAd, GPIO_CTRL_CFG, &data); + if ((pAd->OpMode == OPMODE_STA) && (IDLE_ON(pAd)) + && + (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF)) + && (pAd->StaCfg.PSControl.field.EnablePSinIdle == + TRUE)) { + // Want to make sure device goes to L0 state before reading register. + RTMPPCIeLinkCtrlValueRestore(pAd, 0); + RTMP_IO_FORCE_READ32(pAd, GPIO_CTRL_CFG, &data); + RTMPPCIeLinkCtrlSetting(pAd, 3); + } else + RTMP_IO_FORCE_READ32(pAd, GPIO_CTRL_CFG, &data); #endif // RT3090 // //KH(PCIE PS):Added based on Jane--> - if (data & 0x04) - { + if (data & 0x04) { pAd->StaCfg.bHwRadio = TRUE; - } - else - { + } else { pAd->StaCfg.bHwRadio = FALSE; } - if (pAd->StaCfg.bRadio != (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio)) - { - pAd->StaCfg.bRadio = (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio); - if (pAd->StaCfg.bRadio == TRUE) - { + if (pAd->StaCfg.bRadio != + (pAd->StaCfg.bHwRadio && pAd->StaCfg.bSwRadio)) { + pAd->StaCfg.bRadio = (pAd->StaCfg.bHwRadio + && pAd->StaCfg.bSwRadio); + if (pAd->StaCfg.bRadio == TRUE) { MlmeRadioOn(pAd); // Update extra information pAd->ExtraInfo = EXTRA_INFO_CLEAR; - } - else - { + } else { MlmeRadioOff(pAd); // Update extra information pAd->ExtraInfo = HW_RADIO_OFF; @@ -744,9 +756,9 @@ else // Do nothing if the driver is starting halt state. // This might happen when timer already been fired before cancel timer with mlmehalt if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_RADIO_OFF | - fRTMP_ADAPTER_RADIO_MEASUREMENT | - fRTMP_ADAPTER_RESET_IN_PROGRESS)))) + fRTMP_ADAPTER_RADIO_OFF | + fRTMP_ADAPTER_RADIO_MEASUREMENT | + fRTMP_ADAPTER_RESET_IN_PROGRESS)))) return; RTMP_MLME_PRE_SANITY_CHECK(pAd); @@ -756,30 +768,26 @@ else if (MONITOR_ON(pAd)) return; - if (pAd->Mlme.PeriodicRound & 0x1) - { + if (pAd->Mlme.PeriodicRound & 0x1) { // This is the fix for wifi 11n extension channel overlapping test case. for 2860D if (((pAd->MACVersion & 0xffff) == 0x0101) && - (STA_TGN_WIFI_ON(pAd)) && - (pAd->CommonCfg.IOTestParm.bToggle == FALSE)) - - { - RTMP_IO_WRITE32(pAd, TXOP_CTRL_CFG, 0x24Bf); - pAd->CommonCfg.IOTestParm.bToggle = TRUE; - } - else if ((STA_TGN_WIFI_ON(pAd)) && - ((pAd->MACVersion & 0xffff) == 0x0101)) - { - RTMP_IO_WRITE32(pAd, TXOP_CTRL_CFG, 0x243f); - pAd->CommonCfg.IOTestParm.bToggle = FALSE; - } + (STA_TGN_WIFI_ON(pAd)) && + (pAd->CommonCfg.IOTestParm.bToggle == FALSE)) + { + RTMP_IO_WRITE32(pAd, TXOP_CTRL_CFG, 0x24Bf); + pAd->CommonCfg.IOTestParm.bToggle = TRUE; + } else if ((STA_TGN_WIFI_ON(pAd)) && + ((pAd->MACVersion & 0xffff) == 0x0101)) { + RTMP_IO_WRITE32(pAd, TXOP_CTRL_CFG, 0x243f); + pAd->CommonCfg.IOTestParm.bToggle = FALSE; + } } } pAd->bUpdateBcnCntDone = FALSE; -// RECBATimerTimeout(SystemSpecific1,FunctionContext,SystemSpecific2,SystemSpecific3); - pAd->Mlme.PeriodicRound ++; +// RECBATimerTimeout(SystemSpecific1,FunctionContext,SystemSpecific2,SystemSpecific3); + pAd->Mlme.PeriodicRound++; #ifdef RTMP_MAC_USB // execute every 100ms, update the Tx FIFO Cnt for update Tx Rate. @@ -787,40 +795,37 @@ else #endif // RTMP_MAC_USB // // execute every 500ms - if ((pAd->Mlme.PeriodicRound % 5 == 0) && RTMPAutoRateSwitchCheck(pAd)/*(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED))*/) + if ((pAd->Mlme.PeriodicRound % 5 == 0) + && RTMPAutoRateSwitchCheck(pAd) + /*(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) */ ) { // perform dynamic tx rate switching based on past TX history { - if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) - ) - && (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE))) + if ((OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) + ) + && (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE))) MlmeDynamicTxRateSwitching(pAd); } } - // Normal 1 second Mlme PeriodicExec. - if (pAd->Mlme.PeriodicRound %MLME_TASK_EXEC_MULTIPLE == 0) - { - pAd->Mlme.OneSecPeriodicRound ++; - - - + if (pAd->Mlme.PeriodicRound % MLME_TASK_EXEC_MULTIPLE == 0) { + pAd->Mlme.OneSecPeriodicRound++; //ORIBATimerTimeout(pAd); // Media status changed, report to NDIS - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_MEDIA_STATE_CHANGE)) - { + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_MEDIA_STATE_CHANGE)) { RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_MEDIA_STATE_CHANGE); - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - pAd->IndicateMediaState = NdisMediaStateConnected; + if (OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) { + pAd->IndicateMediaState = + NdisMediaStateConnected; RTMP_IndicateMediaState(pAd); - } - else - { - pAd->IndicateMediaState = NdisMediaStateDisconnected; + } else { + pAd->IndicateMediaState = + NdisMediaStateDisconnected; RTMP_IndicateMediaState(pAd); } } @@ -835,42 +840,39 @@ else RTUSBWatchDog(pAd); #endif // RTMP_MAC_USB // - // Need statistics after read counter. So put after NICUpdateRawCounters + // Need statistics after read counter. So put after NICUpdateRawCounters ORIBATimerTimeout(pAd); // if MGMT RING is full more than twice within 1 second, we consider there's // a hardware problem stucking the TX path. In this case, try a hardware reset // to recover the system - // if (pAd->RalinkCounters.MgmtRingFullCount >= 2) - // RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HARDWARE_ERROR); - // else - // pAd->RalinkCounters.MgmtRingFullCount = 0; + // if (pAd->RalinkCounters.MgmtRingFullCount >= 2) + // RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HARDWARE_ERROR); + // else + // pAd->RalinkCounters.MgmtRingFullCount = 0; // The time period for checking antenna is according to traffic { - if (pAd->Mlme.bEnableAutoAntennaCheck) - { - TxTotalCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount + - pAd->RalinkCounters.OneSecTxRetryOkCount + - pAd->RalinkCounters.OneSecTxFailCount; - - // dynamic adjust antenna evaluation period according to the traffic - if (TxTotalCnt > 50) - { - if (pAd->Mlme.OneSecPeriodicRound % 10 == 0) - { - AsicEvaluateRxAnt(pAd); - } - } - else - { - if (pAd->Mlme.OneSecPeriodicRound % 3 == 0) - { - AsicEvaluateRxAnt(pAd); + if (pAd->Mlme.bEnableAutoAntennaCheck) { + TxTotalCnt = + pAd->RalinkCounters.OneSecTxNoRetryOkCount + + pAd->RalinkCounters.OneSecTxRetryOkCount + + pAd->RalinkCounters.OneSecTxFailCount; + + // dynamic adjust antenna evaluation period according to the traffic + if (TxTotalCnt > 50) { + if (pAd->Mlme.OneSecPeriodicRound % + 10 == 0) { + AsicEvaluateRxAnt(pAd); + } + } else { + if (pAd->Mlme.OneSecPeriodicRound % 3 == + 0) { + AsicEvaluateRxAnt(pAd); + } } } } - } STAMlmePeriodicExec(pAd); @@ -878,7 +880,8 @@ else { #ifdef RTMP_MAC_PCI - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST) && (pAd->bPCIclkOff == FALSE)) + if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST) + && (pAd->bPCIclkOff == FALSE)) #endif // RTMP_MAC_PCI // { // When Adhoc beacon is enabled and RTS/CTS is enabled, there is a chance that hardware MAC FSM will run into a deadlock @@ -888,16 +891,18 @@ else // 2. If in 0x10F4 the ((bit29==1) && (bit7==1)) OR ((bit29==1) && (bit5==1)), it means the deadlock has occurred. // 3. If the deadlock occurred, reset MAC/BBP by setting 0x1004 to 0x0001 for a while then setting it back to 0x000C again. - UINT32 MacReg = 0; + UINT32 MacReg = 0; RTMP_IO_READ32(pAd, 0x10F4, &MacReg); - if (((MacReg & 0x20000000) && (MacReg & 0x80)) || ((MacReg & 0x20000000) && (MacReg & 0x20))) - { + if (((MacReg & 0x20000000) && (MacReg & 0x80)) + || ((MacReg & 0x20000000) + && (MacReg & 0x20))) { RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x1); RTMPusecDelay(1); RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0xC); - DBGPRINT(RT_DEBUG_WARN,("Warning, MAC specific condition occurs \n")); + DBGPRINT(RT_DEBUG_WARN, + ("Warning, MAC specific condition occurs \n")); } } } @@ -905,11 +910,9 @@ else RTMP_MLME_HANDLER(pAd); } - pAd->bUpdateBcnCntDone = FALSE; } - /* ========================================================================== Validate SSID for connection try and rescan purpose @@ -918,94 +921,72 @@ else IRQL = DISPATCH_LEVEL ========================================================================== */ -BOOLEAN MlmeValidateSSID( - IN PUCHAR pSsid, - IN UCHAR SsidLen) +BOOLEAN MlmeValidateSSID(IN PUCHAR pSsid, IN UCHAR SsidLen) { - int index; + int index; if (SsidLen > MAX_LEN_OF_SSID) return (FALSE); // Check each character value - for (index = 0; index < SsidLen; index++) - { + for (index = 0; index < SsidLen; index++) { if (pSsid[index] < 0x20) return (FALSE); - } + } // All checked return (TRUE); } -VOID MlmeSelectTxRateTable( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR *ppTable, - IN PUCHAR pTableSize, - IN PUCHAR pInitTxRateIdx) +VOID MlmeSelectTxRateTable(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, + IN PUCHAR * ppTable, + IN PUCHAR pTableSize, IN PUCHAR pInitTxRateIdx) { - do - { + do { // decide the rate table for tuning - if (pAd->CommonCfg.TxRateTableSize > 0) - { + if (pAd->CommonCfg.TxRateTableSize > 0) { *ppTable = RateSwitchTable; *pTableSize = RateSwitchTable[0]; *pInitTxRateIdx = RateSwitchTable[1]; break; - } + } - if ((pAd->OpMode == OPMODE_STA) && ADHOC_ON(pAd)) - { - if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && - (pEntry->HTCapability.MCSSet[0] == 0xff) && - ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) - {// 11N 1S Adhoc + if ((pAd->OpMode == OPMODE_STA) && ADHOC_ON(pAd)) { + if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && (pEntry->HTCapability.MCSSet[0] == 0xff) && ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) { // 11N 1S Adhoc *ppTable = RateSwitchTable11N1S; *pTableSize = RateSwitchTable11N1S[0]; *pInitTxRateIdx = RateSwitchTable11N1S[1]; - } - else if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && - (pEntry->HTCapability.MCSSet[0] == 0xff) && - (pEntry->HTCapability.MCSSet[1] == 0xff) && - (pAd->Antenna.field.TxPath == 2)) - {// 11N 2S Adhoc - if (pAd->LatchRfRegs.Channel <= 14) - { + } else if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && (pEntry->HTCapability.MCSSet[0] == 0xff) && (pEntry->HTCapability.MCSSet[1] == 0xff) && (pAd->Antenna.field.TxPath == 2)) { // 11N 2S Adhoc + if (pAd->LatchRfRegs.Channel <= 14) { *ppTable = RateSwitchTable11N2S; *pTableSize = RateSwitchTable11N2S[0]; - *pInitTxRateIdx = RateSwitchTable11N2S[1]; - } - else - { + *pInitTxRateIdx = + RateSwitchTable11N2S[1]; + } else { *ppTable = RateSwitchTable11N2SForABand; - *pTableSize = RateSwitchTable11N2SForABand[0]; - *pInitTxRateIdx = RateSwitchTable11N2SForABand[1]; - } + *pTableSize = + RateSwitchTable11N2SForABand[0]; + *pInitTxRateIdx = + RateSwitchTable11N2SForABand[1]; + } - } - else - if ((pEntry->RateLen == 4) - && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0) - ) - { + } else if ((pEntry->RateLen == 4) + && (pEntry->HTCapability.MCSSet[0] == 0) + && (pEntry->HTCapability.MCSSet[1] == 0) + ) { *ppTable = RateSwitchTable11B; *pTableSize = RateSwitchTable11B[0]; *pInitTxRateIdx = RateSwitchTable11B[1]; - } - else if (pAd->LatchRfRegs.Channel <= 14) - { + } else if (pAd->LatchRfRegs.Channel <= 14) { *ppTable = RateSwitchTable11BG; *pTableSize = RateSwitchTable11BG[0]; *pInitTxRateIdx = RateSwitchTable11BG[1]; - } - else - { + } else { *ppTable = RateSwitchTable11G; *pTableSize = RateSwitchTable11G[0]; *pInitTxRateIdx = RateSwitchTable11G[1]; @@ -1013,99 +994,82 @@ VOID MlmeSelectTxRateTable( } break; } - //if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen == 12) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && - // ((pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) - if (((pEntry->RateLen == 12) || (pAd->OpMode == OPMODE_STA)) && (pEntry->HTCapability.MCSSet[0] == 0xff) && - ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->CommonCfg.TxStream == 1))) - {// 11BGN 1S AP + // ((pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) + if (((pEntry->RateLen == 12) || (pAd->OpMode == OPMODE_STA)) && (pEntry->HTCapability.MCSSet[0] == 0xff) && ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->CommonCfg.TxStream == 1))) { // 11BGN 1S AP *ppTable = RateSwitchTable11BGN1S; *pTableSize = RateSwitchTable11BGN1S[0]; *pInitTxRateIdx = RateSwitchTable11BGN1S[1]; break; - } - + } //else if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen == 12) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && - // (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0xff) && (pAd->Antenna.field.TxPath == 2)) - if (((pEntry->RateLen == 12) || (pAd->OpMode == OPMODE_STA)) && (pEntry->HTCapability.MCSSet[0] == 0xff) && - (pEntry->HTCapability.MCSSet[1] == 0xff) && (pAd->CommonCfg.TxStream == 2)) - {// 11BGN 2S AP - if (pAd->LatchRfRegs.Channel <= 14) - { + // (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0xff) && (pAd->Antenna.field.TxPath == 2)) + if (((pEntry->RateLen == 12) || (pAd->OpMode == OPMODE_STA)) && (pEntry->HTCapability.MCSSet[0] == 0xff) && (pEntry->HTCapability.MCSSet[1] == 0xff) && (pAd->CommonCfg.TxStream == 2)) { // 11BGN 2S AP + if (pAd->LatchRfRegs.Channel <= 14) { *ppTable = RateSwitchTable11BGN2S; *pTableSize = RateSwitchTable11BGN2S[0]; *pInitTxRateIdx = RateSwitchTable11BGN2S[1]; - } - else - { + } else { *ppTable = RateSwitchTable11BGN2SForABand; *pTableSize = RateSwitchTable11BGN2SForABand[0]; - *pInitTxRateIdx = RateSwitchTable11BGN2SForABand[1]; + *pInitTxRateIdx = + RateSwitchTable11BGN2SForABand[1]; } break; } - //else if ((pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && ((pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) - if ((pEntry->HTCapability.MCSSet[0] == 0xff) && ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->CommonCfg.TxStream == 1))) - {// 11N 1S AP + if ((pEntry->HTCapability.MCSSet[0] == 0xff) && ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->CommonCfg.TxStream == 1))) { // 11N 1S AP *ppTable = RateSwitchTable11N1S; *pTableSize = RateSwitchTable11N1S[0]; *pInitTxRateIdx = RateSwitchTable11N1S[1]; break; } - //else if ((pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0xff) && (pAd->Antenna.field.TxPath == 2)) - if ((pEntry->HTCapability.MCSSet[0] == 0xff) && (pEntry->HTCapability.MCSSet[1] == 0xff) && (pAd->CommonCfg.TxStream == 2)) - {// 11N 2S AP - if (pAd->LatchRfRegs.Channel <= 14) - { - *ppTable = RateSwitchTable11N2S; - *pTableSize = RateSwitchTable11N2S[0]; - *pInitTxRateIdx = RateSwitchTable11N2S[1]; - } - else - { + if ((pEntry->HTCapability.MCSSet[0] == 0xff) && (pEntry->HTCapability.MCSSet[1] == 0xff) && (pAd->CommonCfg.TxStream == 2)) { // 11N 2S AP + if (pAd->LatchRfRegs.Channel <= 14) { + *ppTable = RateSwitchTable11N2S; + *pTableSize = RateSwitchTable11N2S[0]; + *pInitTxRateIdx = RateSwitchTable11N2S[1]; + } else { *ppTable = RateSwitchTable11N2SForABand; *pTableSize = RateSwitchTable11N2SForABand[0]; - *pInitTxRateIdx = RateSwitchTable11N2SForABand[1]; + *pInitTxRateIdx = + RateSwitchTable11N2SForABand[1]; } break; } //else if ((pAd->StaActive.SupRateLen == 4) && (pAd->StaActive.ExtRateLen == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) - if ((pEntry->RateLen == 4 || pAd->CommonCfg.PhyMode==PHY_11B) - //Iverson mark for Adhoc b mode,sta will use rate 54 Mbps when connect with sta b/g/n mode - /* && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0)*/ - ) - {// B only AP + if ((pEntry->RateLen == 4 || pAd->CommonCfg.PhyMode == PHY_11B) + //Iverson mark for Adhoc b mode,sta will use rate 54 Mbps when connect with sta b/g/n mode + /* && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0) */ + ) { // B only AP *ppTable = RateSwitchTable11B; *pTableSize = RateSwitchTable11B[0]; *pInitTxRateIdx = RateSwitchTable11B[1]; break; } - //else if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen > 8) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) if ((pEntry->RateLen > 8) - && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0) - ) - {// B/G mixed AP + && (pEntry->HTCapability.MCSSet[0] == 0) + && (pEntry->HTCapability.MCSSet[1] == 0) + ) { // B/G mixed AP *ppTable = RateSwitchTable11BG; *pTableSize = RateSwitchTable11BG[0]; *pInitTxRateIdx = RateSwitchTable11BG[1]; break; } - //else if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen == 8) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) if ((pEntry->RateLen == 8) - && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0) - ) - {// G only AP + && (pEntry->HTCapability.MCSSet[0] == 0) + && (pEntry->HTCapability.MCSSet[1] == 0) + ) { // G only AP *ppTable = RateSwitchTable11G; *pTableSize = RateSwitchTable11G[0]; *pInitTxRateIdx = RateSwitchTable11G[1]; @@ -1115,356 +1079,390 @@ VOID MlmeSelectTxRateTable( { //else if ((pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) - if ((pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0)) - { // Legacy mode - if (pAd->CommonCfg.MaxTxRate <= RATE_11) - { + if ((pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0)) { // Legacy mode + if (pAd->CommonCfg.MaxTxRate <= RATE_11) { *ppTable = RateSwitchTable11B; *pTableSize = RateSwitchTable11B[0]; *pInitTxRateIdx = RateSwitchTable11B[1]; - } - else if ((pAd->CommonCfg.MaxTxRate > RATE_11) && (pAd->CommonCfg.MinTxRate > RATE_11)) - { + } else if ((pAd->CommonCfg.MaxTxRate > RATE_11) + && (pAd->CommonCfg.MinTxRate > + RATE_11)) { *ppTable = RateSwitchTable11G; *pTableSize = RateSwitchTable11G[0]; *pInitTxRateIdx = RateSwitchTable11G[1]; - } - else - { + } else { *ppTable = RateSwitchTable11BG; *pTableSize = RateSwitchTable11BG[0]; - *pInitTxRateIdx = RateSwitchTable11BG[1]; + *pInitTxRateIdx = + RateSwitchTable11BG[1]; } break; } - if (pAd->LatchRfRegs.Channel <= 14) - { - if (pAd->CommonCfg.TxStream == 1) - { + if (pAd->LatchRfRegs.Channel <= 14) { + if (pAd->CommonCfg.TxStream == 1) { *ppTable = RateSwitchTable11N1S; *pTableSize = RateSwitchTable11N1S[0]; - *pInitTxRateIdx = RateSwitchTable11N1S[1]; - DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode,default use 11N 1S AP \n")); - } - else - { + *pInitTxRateIdx = + RateSwitchTable11N1S[1]; + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("DRS: unkown mode,default use 11N 1S AP \n")); + } else { *ppTable = RateSwitchTable11N2S; *pTableSize = RateSwitchTable11N2S[0]; - *pInitTxRateIdx = RateSwitchTable11N2S[1]; - DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode,default use 11N 2S AP \n")); + *pInitTxRateIdx = + RateSwitchTable11N2S[1]; + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("DRS: unkown mode,default use 11N 2S AP \n")); } - } - else - { - if (pAd->CommonCfg.TxStream == 1) - { + } else { + if (pAd->CommonCfg.TxStream == 1) { *ppTable = RateSwitchTable11N1S; *pTableSize = RateSwitchTable11N1S[0]; - *pInitTxRateIdx = RateSwitchTable11N1S[1]; - DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode,default use 11N 1S AP \n")); - } - else - { + *pInitTxRateIdx = + RateSwitchTable11N1S[1]; + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("DRS: unkown mode,default use 11N 1S AP \n")); + } else { *ppTable = RateSwitchTable11N2SForABand; - *pTableSize = RateSwitchTable11N2SForABand[0]; - *pInitTxRateIdx = RateSwitchTable11N2SForABand[1]; - DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode,default use 11N 2S AP \n")); + *pTableSize = + RateSwitchTable11N2SForABand[0]; + *pInitTxRateIdx = + RateSwitchTable11N2SForABand[1]; + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("DRS: unkown mode,default use 11N 2S AP \n")); } } - DBGPRINT_RAW(RT_DEBUG_ERROR,("DRS: unkown mode (SupRateLen=%d, ExtRateLen=%d, MCSSet[0]=0x%x, MCSSet[1]=0x%x)\n", - pAd->StaActive.SupRateLen, pAd->StaActive.ExtRateLen, pAd->StaActive.SupportedPhyInfo.MCSSet[0], pAd->StaActive.SupportedPhyInfo.MCSSet[1])); + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("DRS: unkown mode (SupRateLen=%d, ExtRateLen=%d, MCSSet[0]=0x%x, MCSSet[1]=0x%x)\n", + pAd->StaActive.SupRateLen, + pAd->StaActive.ExtRateLen, + pAd->StaActive.SupportedPhyInfo.MCSSet[0], + pAd->StaActive.SupportedPhyInfo. + MCSSet[1])); } - } while(FALSE); + } while (FALSE); } - -VOID STAMlmePeriodicExec( - PRTMP_ADAPTER pAd) +VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) { - ULONG TxTotalCnt; - int i; + ULONG TxTotalCnt; + int i; /* - We return here in ATE mode, because the statistics - that ATE need are not collected via this routine. - */ + We return here in ATE mode, because the statistics + that ATE need are not collected via this routine. + */ #if defined(RT305x)||defined(RT3070) // request by Gary, if Rssi0 > -42, BBP 82 need to be changed from 0x62 to 0x42, , bbp 67 need to be changed from 0x20 to 0x18 - if (!pAd->CommonCfg.HighPowerPatchDisabled) - { + if (!pAd->CommonCfg.HighPowerPatchDisabled) { #ifdef RT3070 - if ( (IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) + if ((IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) #endif // RT3070 // - { - if ((pAd->StaCfg.RssiSample.AvgRssi0 != 0) && (pAd->StaCfg.RssiSample.AvgRssi0 > (pAd->BbpRssiToDbmDelta - 35))) - { - RT30xxWriteRFRegister(pAd, RF_R27, 0x20); - } - else - { - RT30xxWriteRFRegister(pAd, RF_R27, 0x23); - } - } + { + if ((pAd->StaCfg.RssiSample.AvgRssi0 != 0) + && (pAd->StaCfg.RssiSample.AvgRssi0 > + (pAd->BbpRssiToDbmDelta - 35))) { + RT30xxWriteRFRegister(pAd, RF_R27, 0x20); + } else { + RT30xxWriteRFRegister(pAd, RF_R27, 0x23); + } + } } #endif #ifdef PCIE_PS_SUPPORT // don't perform idle-power-save mechanism within 3 min after driver initialization. // This can make rebooter test more robust -if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - if ((pAd->OpMode == OPMODE_STA) && (IDLE_ON(pAd)) - && (pAd->Mlme.SyncMachine.CurrState == SYNC_IDLE) - && (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) - && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) - { - if (IS_RT3090(pAd)|| IS_RT3572(pAd) || IS_RT3390(pAd)) - { - if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s\n", __func__)); - RT28xxPciAsicRadioOff(pAd, GUI_IDLE_POWER_SAVE, 0); + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { + if ((pAd->OpMode == OPMODE_STA) && (IDLE_ON(pAd)) + && (pAd->Mlme.SyncMachine.CurrState == SYNC_IDLE) + && (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) + && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) { + if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) { + if (pAd->StaCfg.PSControl.field.EnableNewPS == + TRUE) { + DBGPRINT(RT_DEBUG_TRACE, + ("%s\n", __func__)); + RT28xxPciAsicRadioOff(pAd, + GUI_IDLE_POWER_SAVE, + 0); + } else { + AsicSendCommandToMcu(pAd, 0x30, + PowerSafeCID, 0xff, + 0x2); + // Wait command success + AsicCheckCommanOk(pAd, PowerSafeCID); + RTMP_SET_FLAG(pAd, + fRTMP_ADAPTER_IDLE_RADIO_OFF); + DBGPRINT(RT_DEBUG_TRACE, + ("PSM - rt30xx Issue Sleep command)\n")); } - else - { - AsicSendCommandToMcu(pAd, 0x30, PowerSafeCID, 0xff, 0x2); - // Wait command success - AsicCheckCommanOk(pAd, PowerSafeCID); - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); - DBGPRINT(RT_DEBUG_TRACE, ("PSM - rt30xx Issue Sleep command)\n")); + } else if (pAd->Mlme.OneSecPeriodicRound > 180) { + if (pAd->StaCfg.PSControl.field.EnableNewPS == + TRUE) { + DBGPRINT(RT_DEBUG_TRACE, + ("%s\n", __func__)); + RT28xxPciAsicRadioOff(pAd, + GUI_IDLE_POWER_SAVE, + 0); + } else { + AsicSendCommandToMcu(pAd, 0x30, + PowerSafeCID, 0xff, + 0x02); + // Wait command success + AsicCheckCommanOk(pAd, PowerSafeCID); + RTMP_SET_FLAG(pAd, + fRTMP_ADAPTER_IDLE_RADIO_OFF); + DBGPRINT(RT_DEBUG_TRACE, + ("PSM - rt28xx Issue Sleep command)\n")); } } - else if (pAd->Mlme.OneSecPeriodicRound > 180) - { - if (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s\n", __func__)); - RT28xxPciAsicRadioOff(pAd, GUI_IDLE_POWER_SAVE, 0); - } - else - { - AsicSendCommandToMcu(pAd, 0x30, PowerSafeCID, 0xff, 0x02); - // Wait command success - AsicCheckCommanOk(pAd, PowerSafeCID); - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); - DBGPRINT(RT_DEBUG_TRACE, ("PSM - rt28xx Issue Sleep command)\n")); - } - } - } - else - { - DBGPRINT(RT_DEBUG_TRACE,("STAMlmePeriodicExec MMCHK - CommonCfg.Ssid[%d]=%c%c%c%c... MlmeAux.Ssid[%d]=%c%c%c%c...\n", - pAd->CommonCfg.SsidLen, pAd->CommonCfg.Ssid[0], pAd->CommonCfg.Ssid[1], pAd->CommonCfg.Ssid[2], pAd->CommonCfg.Ssid[3], - pAd->MlmeAux.SsidLen, pAd->MlmeAux.Ssid[0], pAd->MlmeAux.Ssid[1], pAd->MlmeAux.Ssid[2], pAd->MlmeAux.Ssid[3])); + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("STAMlmePeriodicExec MMCHK - CommonCfg.Ssid[%d]=%c%c%c%c... MlmeAux.Ssid[%d]=%c%c%c%c...\n", + pAd->CommonCfg.SsidLen, + pAd->CommonCfg.Ssid[0], + pAd->CommonCfg.Ssid[1], + pAd->CommonCfg.Ssid[2], + pAd->CommonCfg.Ssid[3], pAd->MlmeAux.SsidLen, + pAd->MlmeAux.Ssid[0], pAd->MlmeAux.Ssid[1], + pAd->MlmeAux.Ssid[2], pAd->MlmeAux.Ssid[3])); } } #endif // PCIE_PS_SUPPORT // - if (pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_DISABLE) - { - // WPA MIC error should block association attempt for 60 seconds + if (pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_DISABLE) { + // WPA MIC error should block association attempt for 60 seconds if (pAd->StaCfg.bBlockAssoc && - RTMP_TIME_AFTER(pAd->Mlme.Now32, pAd->StaCfg.LastMicErrorTime + (60*OS_HZ))) - pAd->StaCfg.bBlockAssoc = FALSE; - } - - if ((pAd->PreMediaState != pAd->IndicateMediaState) && (pAd->CommonCfg.bWirelessEvent)) - { - if (pAd->IndicateMediaState == NdisMediaStateConnected) - { - RTMPSendWirelessEvent(pAd, IW_STA_LINKUP_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); + RTMP_TIME_AFTER(pAd->Mlme.Now32, + pAd->StaCfg.LastMicErrorTime + + (60 * OS_HZ))) + pAd->StaCfg.bBlockAssoc = FALSE; + } + + if ((pAd->PreMediaState != pAd->IndicateMediaState) + && (pAd->CommonCfg.bWirelessEvent)) { + if (pAd->IndicateMediaState == NdisMediaStateConnected) { + RTMPSendWirelessEvent(pAd, IW_STA_LINKUP_EVENT_FLAG, + pAd->MacTab.Content[BSSID_WCID]. + Addr, BSS0, 0); } pAd->PreMediaState = pAd->IndicateMediaState; } - - - - if (pAd->CommonCfg.PSPXlink && ADHOC_ON(pAd)) - { - } - else - { - AsicStaBbpTuning(pAd); + if (pAd->CommonCfg.PSPXlink && ADHOC_ON(pAd)) { + } else { + AsicStaBbpTuning(pAd); } TxTotalCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount + - pAd->RalinkCounters.OneSecTxRetryOkCount + - pAd->RalinkCounters.OneSecTxFailCount; + pAd->RalinkCounters.OneSecTxRetryOkCount + + pAd->RalinkCounters.OneSecTxFailCount; - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) { // update channel quality for Roaming and UI LinkQuality display MlmeCalculateChannelQuality(pAd, NULL, pAd->Mlme.Now32); } - // must be AFTER MlmeDynamicTxRateSwitching() because it needs to know if // Radio is currently in noisy environment if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - AsicAdjustTxPower(pAd); + AsicAdjustTxPower(pAd); - if (INFRA_ON(pAd)) - { + if (INFRA_ON(pAd)) { // Is PSM bit consistent with user power management policy? // This is the only place that will set PSM bit ON. if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - MlmeCheckPsmChange(pAd, pAd->Mlme.Now32); + MlmeCheckPsmChange(pAd, pAd->Mlme.Now32); pAd->RalinkCounters.LastOneSecTotalTxCount = TxTotalCnt; - if ((RTMP_TIME_AFTER(pAd->Mlme.Now32, pAd->StaCfg.LastBeaconRxTime + (1*OS_HZ))) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) && - (((TxTotalCnt + pAd->RalinkCounters.OneSecRxOkCnt) < 600))) - { + if ((RTMP_TIME_AFTER + (pAd->Mlme.Now32, + pAd->StaCfg.LastBeaconRxTime + (1 * OS_HZ))) + && + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) + && + (((TxTotalCnt + pAd->RalinkCounters.OneSecRxOkCnt) < + 600))) { RTMPSetAGCInitValue(pAd, BW_20); - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - No BEACON. restore R66 to the low bound(%d) \n", (0x2E + GET_LNA_GAIN(pAd)))); + DBGPRINT(RT_DEBUG_TRACE, + ("MMCHK - No BEACON. restore R66 to the low bound(%d) \n", + (0x2E + GET_LNA_GAIN(pAd)))); + } + //if ((pAd->RalinkCounters.OneSecTxNoRetryOkCount == 0) && + // (pAd->RalinkCounters.OneSecTxRetryOkCount == 0)) + { + if (pAd->CommonCfg.bAPSDCapable + && pAd->CommonCfg.APEdcaParm.bAPSDCapable) { + // When APSD is enabled, the period changes as 20 sec + if ((pAd->Mlme.OneSecPeriodicRound % 20) == 8) + RTMPSendNullFrame(pAd, + pAd->CommonCfg.TxRate, + TRUE); + } else { + // Send out a NULL frame every 10 sec to inform AP that STA is still alive (Avoid being age out) + if ((pAd->Mlme.OneSecPeriodicRound % 10) == 8) { + if (pAd->CommonCfg.bWmmCapable) + RTMPSendNullFrame(pAd, + pAd-> + CommonCfg. + TxRate, TRUE); + else + RTMPSendNullFrame(pAd, + pAd-> + CommonCfg. + TxRate, + FALSE); + } + } } - //if ((pAd->RalinkCounters.OneSecTxNoRetryOkCount == 0) && - // (pAd->RalinkCounters.OneSecTxRetryOkCount == 0)) - { - if (pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable) - { - // When APSD is enabled, the period changes as 20 sec - if ((pAd->Mlme.OneSecPeriodicRound % 20) == 8) - RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, TRUE); - } - else - { - // Send out a NULL frame every 10 sec to inform AP that STA is still alive (Avoid being age out) - if ((pAd->Mlme.OneSecPeriodicRound % 10) == 8) - { - if (pAd->CommonCfg.bWmmCapable) - RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, TRUE); - else - RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, FALSE); - } - } - } - - if (CQI_IS_DEAD(pAd->Mlme.ChannelQuality)) - { - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - No BEACON. Dead CQI. Auto Recovery attempt #%ld\n", pAd->RalinkCounters.BadCQIAutoRecoveryCount)); + if (CQI_IS_DEAD(pAd->Mlme.ChannelQuality)) { + DBGPRINT(RT_DEBUG_TRACE, + ("MMCHK - No BEACON. Dead CQI. Auto Recovery attempt #%ld\n", + pAd->RalinkCounters.BadCQIAutoRecoveryCount)); // Lost AP, send disconnect & link down event LinkDown(pAd, FALSE); - - RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0); + RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, + 0); // RTMPPatchMacBbpBug(pAd); MlmeAutoReconnectLastSSID(pAd); - } - else if (CQI_IS_BAD(pAd->Mlme.ChannelQuality)) - { - pAd->RalinkCounters.BadCQIAutoRecoveryCount ++; - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - Bad CQI. Auto Recovery attempt #%ld\n", pAd->RalinkCounters.BadCQIAutoRecoveryCount)); + } else if (CQI_IS_BAD(pAd->Mlme.ChannelQuality)) { + pAd->RalinkCounters.BadCQIAutoRecoveryCount++; + DBGPRINT(RT_DEBUG_TRACE, + ("MMCHK - Bad CQI. Auto Recovery attempt #%ld\n", + pAd->RalinkCounters.BadCQIAutoRecoveryCount)); MlmeAutoReconnectLastSSID(pAd); } - if (pAd->StaCfg.bAutoRoaming) - { - BOOLEAN rv = FALSE; - CHAR dBmToRoam = pAd->StaCfg.dBmToRoam; - CHAR MaxRssi = RTMPMaxRssi(pAd, - pAd->StaCfg.RssiSample.LastRssi0, - pAd->StaCfg.RssiSample.LastRssi1, - pAd->StaCfg.RssiSample.LastRssi2); + if (pAd->StaCfg.bAutoRoaming) { + BOOLEAN rv = FALSE; + CHAR dBmToRoam = pAd->StaCfg.dBmToRoam; + CHAR MaxRssi = RTMPMaxRssi(pAd, + pAd->StaCfg.RssiSample. + LastRssi0, + pAd->StaCfg.RssiSample. + LastRssi1, + pAd->StaCfg.RssiSample. + LastRssi2); // Scanning, ignore Roaming - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS) && - (pAd->Mlme.SyncMachine.CurrState == SYNC_IDLE) && - (MaxRssi <= dBmToRoam)) - { - DBGPRINT(RT_DEBUG_TRACE, ("Rssi=%d, dBmToRoam=%d\n", MaxRssi, (CHAR)dBmToRoam)); - + if (!RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS) + && (pAd->Mlme.SyncMachine.CurrState == SYNC_IDLE) + && (MaxRssi <= dBmToRoam)) { + DBGPRINT(RT_DEBUG_TRACE, + ("Rssi=%d, dBmToRoam=%d\n", MaxRssi, + (CHAR) dBmToRoam)); // Add auto seamless roaming if (rv == FALSE) rv = MlmeCheckForFastRoaming(pAd); - if (rv == FALSE) - { - if ((pAd->StaCfg.LastScanTime + 10 * OS_HZ) < pAd->Mlme.Now32) - { - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - Roaming, No eligable entry, try new scan!\n")); + if (rv == FALSE) { + if ((pAd->StaCfg.LastScanTime + + 10 * OS_HZ) < pAd->Mlme.Now32) { + DBGPRINT(RT_DEBUG_TRACE, + ("MMCHK - Roaming, No eligable entry, try new scan!\n")); pAd->StaCfg.ScanCnt = 2; - pAd->StaCfg.LastScanTime = pAd->Mlme.Now32; + pAd->StaCfg.LastScanTime = + pAd->Mlme.Now32; MlmeAutoScan(pAd); - } + } + } } } - } - } - else if (ADHOC_ON(pAd)) - { + } else if (ADHOC_ON(pAd)) { // If all peers leave, and this STA becomes the last one in this IBSS, then change MediaState // to DISCONNECTED. But still holding this IBSS (i.e. sending BEACON) so that other STAs can // join later. - if (RTMP_TIME_AFTER(pAd->Mlme.Now32, pAd->StaCfg.LastBeaconRxTime + ADHOC_BEACON_LOST_TIME) && - OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - MLME_START_REQ_STRUCT StartReq; - - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - excessive BEACON lost, last STA in this IBSS, MediaState=Disconnected\n")); + if (RTMP_TIME_AFTER + (pAd->Mlme.Now32, + pAd->StaCfg.LastBeaconRxTime + ADHOC_BEACON_LOST_TIME) + && OPSTATUS_TEST_FLAG(pAd, + fOP_STATUS_MEDIA_STATE_CONNECTED)) { + MLME_START_REQ_STRUCT StartReq; + + DBGPRINT(RT_DEBUG_TRACE, + ("MMCHK - excessive BEACON lost, last STA in this IBSS, MediaState=Disconnected\n")); LinkDown(pAd, FALSE); - StartParmFill(pAd, &StartReq, (CHAR *)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, sizeof(MLME_START_REQ_STRUCT), &StartReq); + StartParmFill(pAd, &StartReq, + (CHAR *) pAd->MlmeAux.Ssid, + pAd->MlmeAux.SsidLen); + MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, + sizeof(MLME_START_REQ_STRUCT), &StartReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_START; } - for (i = 1; i < MAX_LEN_OF_MAC_TABLE; i++) - { + for (i = 1; i < MAX_LEN_OF_MAC_TABLE; i++) { MAC_TABLE_ENTRY *pEntry = &pAd->MacTab.Content[i]; if (pEntry->ValidAsCLI == FALSE) continue; - if (RTMP_TIME_AFTER(pAd->Mlme.Now32, pEntry->LastBeaconRxTime + ADHOC_BEACON_LOST_TIME)) - MacTableDeleteEntry(pAd, pEntry->Aid, pEntry->Addr); + if (RTMP_TIME_AFTER + (pAd->Mlme.Now32, + pEntry->LastBeaconRxTime + ADHOC_BEACON_LOST_TIME)) + MacTableDeleteEntry(pAd, pEntry->Aid, + pEntry->Addr); } - } - else // no INFRA nor ADHOC connection + } else // no INFRA nor ADHOC connection { if (pAd->StaCfg.bScanReqIsFromWebUI && - RTMP_TIME_BEFORE(pAd->Mlme.Now32, pAd->StaCfg.LastScanTime + (30 * OS_HZ))) + RTMP_TIME_BEFORE(pAd->Mlme.Now32, + pAd->StaCfg.LastScanTime + (30 * OS_HZ))) goto SKIP_AUTO_SCAN_CONN; - else - pAd->StaCfg.bScanReqIsFromWebUI = FALSE; + else + pAd->StaCfg.bScanReqIsFromWebUI = FALSE; if ((pAd->StaCfg.bAutoReconnect == TRUE) - && RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_START_UP) - && (MlmeValidateSSID(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen) == TRUE)) - { - if ((pAd->ScanTab.BssNr==0) && (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE)) - { - MLME_SCAN_REQ_STRUCT ScanReq; - - if (RTMP_TIME_AFTER(pAd->Mlme.Now32, pAd->StaCfg.LastScanTime + (10 * OS_HZ))) - { - DBGPRINT(RT_DEBUG_TRACE, ("STAMlmePeriodicExec():CNTL - ScanTab.BssNr==0, start a new ACTIVE scan SSID[%s]\n", pAd->MlmeAux.AutoReconnectSsid)); - ScanParmFill(pAd, &ScanReq, (PSTRING) pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen, BSS_ANY, SCAN_ACTIVE); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; + && RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_START_UP) + && + (MlmeValidateSSID + (pAd->MlmeAux.AutoReconnectSsid, + pAd->MlmeAux.AutoReconnectSsidLen) == TRUE)) { + if ((pAd->ScanTab.BssNr == 0) + && (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE)) { + MLME_SCAN_REQ_STRUCT ScanReq; + + if (RTMP_TIME_AFTER + (pAd->Mlme.Now32, + pAd->StaCfg.LastScanTime + (10 * OS_HZ))) { + DBGPRINT(RT_DEBUG_TRACE, + ("STAMlmePeriodicExec():CNTL - ScanTab.BssNr==0, start a new ACTIVE scan SSID[%s]\n", + pAd->MlmeAux. + AutoReconnectSsid)); + ScanParmFill(pAd, &ScanReq, + (PSTRING) pAd->MlmeAux. + AutoReconnectSsid, + pAd->MlmeAux. + AutoReconnectSsidLen, + BSS_ANY, SCAN_ACTIVE); + MlmeEnqueue(pAd, SYNC_STATE_MACHINE, + MT2_MLME_SCAN_REQ, + sizeof + (MLME_SCAN_REQ_STRUCT), + &ScanReq); + pAd->Mlme.CntlMachine.CurrState = + CNTL_WAIT_OID_LIST_SCAN; // Reset Missed scan number - pAd->StaCfg.LastScanTime = pAd->Mlme.Now32; - } - else if (pAd->StaCfg.BssType == BSS_ADHOC) // Quit the forever scan when in a very clean room + pAd->StaCfg.LastScanTime = + pAd->Mlme.Now32; + } else if (pAd->StaCfg.BssType == BSS_ADHOC) // Quit the forever scan when in a very clean room MlmeAutoReconnectLastSSID(pAd); - } - else if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) - { - if ((pAd->Mlme.OneSecPeriodicRound % 7) == 0) - { + } else if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) { + if ((pAd->Mlme.OneSecPeriodicRound % 7) == 0) { MlmeAutoScan(pAd); - pAd->StaCfg.LastScanTime = pAd->Mlme.Now32; - } - else - { - MlmeAutoReconnectLastSSID(pAd); + pAd->StaCfg.LastScanTime = + pAd->Mlme.Now32; + } else { + MlmeAutoReconnectLastSSID(pAd); } } } @@ -1472,86 +1470,81 @@ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) SKIP_AUTO_SCAN_CONN: - if ((pAd->MacTab.Content[BSSID_WCID].TXBAbitmap !=0) && (pAd->MacTab.fAnyBASession == FALSE)) - { + if ((pAd->MacTab.Content[BSSID_WCID].TXBAbitmap != 0) + && (pAd->MacTab.fAnyBASession == FALSE)) { pAd->MacTab.fAnyBASession = TRUE; - AsicUpdateProtect(pAd, HT_FORCERTSCTS, ALLN_SETPROTECT, FALSE, FALSE); - } - else if ((pAd->MacTab.Content[BSSID_WCID].TXBAbitmap ==0) && (pAd->MacTab.fAnyBASession == TRUE)) - { + AsicUpdateProtect(pAd, HT_FORCERTSCTS, ALLN_SETPROTECT, FALSE, + FALSE); + } else if ((pAd->MacTab.Content[BSSID_WCID].TXBAbitmap == 0) + && (pAd->MacTab.fAnyBASession == TRUE)) { pAd->MacTab.fAnyBASession = FALSE; - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, FALSE, FALSE); + AsicUpdateProtect(pAd, + pAd->MlmeAux.AddHtInfo.AddHtInfo2. + OperaionMode, ALLN_SETPROTECT, FALSE, FALSE); } return; } // Link down report -VOID LinkDownExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +VOID LinkDownExec(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; + RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; - if (pAd != NULL) - { - MLME_DISASSOC_REQ_STRUCT DisassocReq; + if (pAd != NULL) { + MLME_DISASSOC_REQ_STRUCT DisassocReq; if ((pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED) && - (INFRA_ON(pAd))) - { - DBGPRINT(RT_DEBUG_TRACE, ("LinkDownExec(): disassociate with current AP...\n")); - DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_DISASSOC_STA_LEAVING); - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, - sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); + (INFRA_ON(pAd))) { + DBGPRINT(RT_DEBUG_TRACE, + ("LinkDownExec(): disassociate with current AP...\n")); + DisassocParmFill(pAd, &DisassocReq, + pAd->CommonCfg.Bssid, + REASON_DISASSOC_STA_LEAVING); + MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, + MT2_MLME_DISASSOC_REQ, + sizeof(MLME_DISASSOC_REQ_STRUCT), + &DisassocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; - pAd->IndicateMediaState = NdisMediaStateDisconnected; - RTMP_IndicateMediaState(pAd); - pAd->ExtraInfo = GENERAL_LINK_DOWN; + pAd->IndicateMediaState = NdisMediaStateDisconnected; + RTMP_IndicateMediaState(pAd); + pAd->ExtraInfo = GENERAL_LINK_DOWN; } } } // IRQL = DISPATCH_LEVEL -VOID MlmeAutoScan( - IN PRTMP_ADAPTER pAd) +VOID MlmeAutoScan(IN PRTMP_ADAPTER pAd) { // check CntlMachine.CurrState to avoid collision with NDIS SetOID request - if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) - { + if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) { DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - Driver auto scan\n")); MlmeEnqueue(pAd, - MLME_CNTL_STATE_MACHINE, - OID_802_11_BSSID_LIST_SCAN, - pAd->MlmeAux.AutoReconnectSsidLen, - pAd->MlmeAux.AutoReconnectSsid); + MLME_CNTL_STATE_MACHINE, + OID_802_11_BSSID_LIST_SCAN, + pAd->MlmeAux.AutoReconnectSsidLen, + pAd->MlmeAux.AutoReconnectSsid); RTMP_MLME_HANDLER(pAd); } } // IRQL = DISPATCH_LEVEL -VOID MlmeAutoReconnectLastSSID( - IN PRTMP_ADAPTER pAd) +VOID MlmeAutoReconnectLastSSID(IN PRTMP_ADAPTER pAd) { - if (pAd->StaCfg.bAutoConnectByBssid) - { - DBGPRINT(RT_DEBUG_TRACE, ("Driver auto reconnect to last OID_802_11_BSSID setting - %02X:%02X:%02X:%02X:%02X:%02X\n", - pAd->MlmeAux.Bssid[0], - pAd->MlmeAux.Bssid[1], - pAd->MlmeAux.Bssid[2], - pAd->MlmeAux.Bssid[3], - pAd->MlmeAux.Bssid[4], - pAd->MlmeAux.Bssid[5])); + if (pAd->StaCfg.bAutoConnectByBssid) { + DBGPRINT(RT_DEBUG_TRACE, + ("Driver auto reconnect to last OID_802_11_BSSID setting - %02X:%02X:%02X:%02X:%02X:%02X\n", + pAd->MlmeAux.Bssid[0], pAd->MlmeAux.Bssid[1], + pAd->MlmeAux.Bssid[2], pAd->MlmeAux.Bssid[3], + pAd->MlmeAux.Bssid[4], pAd->MlmeAux.Bssid[5])); pAd->MlmeAux.Channel = pAd->CommonCfg.Channel; MlmeEnqueue(pAd, - MLME_CNTL_STATE_MACHINE, - OID_802_11_BSSID, - MAC_ADDR_LEN, - pAd->MlmeAux.Bssid); + MLME_CNTL_STATE_MACHINE, + OID_802_11_BSSID, MAC_ADDR_LEN, pAd->MlmeAux.Bssid); pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; @@ -1559,23 +1552,24 @@ VOID MlmeAutoReconnectLastSSID( } // check CntlMachine.CurrState to avoid collision with NDIS SetOID request else if ((pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) && - (MlmeValidateSSID(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen) == TRUE)) - { + (MlmeValidateSSID + (pAd->MlmeAux.AutoReconnectSsid, + pAd->MlmeAux.AutoReconnectSsidLen) == TRUE)) { NDIS_802_11_SSID OidSsid; OidSsid.SsidLength = pAd->MlmeAux.AutoReconnectSsidLen; - NdisMoveMemory(OidSsid.Ssid, pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen); - - DBGPRINT(RT_DEBUG_TRACE, ("Driver auto reconnect to last OID_802_11_SSID setting - %s, len - %d\n", pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen)); - MlmeEnqueue(pAd, - MLME_CNTL_STATE_MACHINE, - OID_802_11_SSID, - sizeof(NDIS_802_11_SSID), - &OidSsid); + NdisMoveMemory(OidSsid.Ssid, pAd->MlmeAux.AutoReconnectSsid, + pAd->MlmeAux.AutoReconnectSsidLen); + + DBGPRINT(RT_DEBUG_TRACE, + ("Driver auto reconnect to last OID_802_11_SSID setting - %s, len - %d\n", + pAd->MlmeAux.AutoReconnectSsid, + pAd->MlmeAux.AutoReconnectSsidLen)); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, OID_802_11_SSID, + sizeof(NDIS_802_11_SSID), &OidSsid); RTMP_MLME_HANDLER(pAd); } } - /* ========================================================================== Description: @@ -1588,47 +1582,50 @@ VOID MlmeAutoReconnectLastSSID( Output: ========================================================================== */ -VOID MlmeCheckForRoaming( - IN PRTMP_ADAPTER pAd, - IN ULONG Now32) +VOID MlmeCheckForRoaming(IN PRTMP_ADAPTER pAd, IN ULONG Now32) { - USHORT i; - BSS_TABLE *pRoamTab = &pAd->MlmeAux.RoamTab; - BSS_ENTRY *pBss; + USHORT i; + BSS_TABLE *pRoamTab = &pAd->MlmeAux.RoamTab; + BSS_ENTRY *pBss; DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeCheckForRoaming\n")); // put all roaming candidates into RoamTab, and sort in RSSI order BssTableInit(pRoamTab); - for (i = 0; i < pAd->ScanTab.BssNr; i++) - { + for (i = 0; i < pAd->ScanTab.BssNr; i++) { pBss = &pAd->ScanTab.BssEntry[i]; - if ((pBss->LastBeaconRxTime + pAd->StaCfg.BeaconLostTime) < Now32) - continue; // AP disappear + if ((pBss->LastBeaconRxTime + pAd->StaCfg.BeaconLostTime) < + Now32) + continue; // AP disappear if (pBss->Rssi <= RSSI_THRESHOLD_FOR_ROAMING) - continue; // RSSI too weak. forget it. + continue; // RSSI too weak. forget it. if (MAC_ADDR_EQUAL(pBss->Bssid, pAd->CommonCfg.Bssid)) - continue; // skip current AP - if (pBss->Rssi < (pAd->StaCfg.RssiSample.LastRssi0 + RSSI_DELTA)) - continue; // only AP with stronger RSSI is eligible for roaming + continue; // skip current AP + if (pBss->Rssi < + (pAd->StaCfg.RssiSample.LastRssi0 + RSSI_DELTA)) + continue; // only AP with stronger RSSI is eligible for roaming // AP passing all above rules is put into roaming candidate table - NdisMoveMemory(&pRoamTab->BssEntry[pRoamTab->BssNr], pBss, sizeof(BSS_ENTRY)); + NdisMoveMemory(&pRoamTab->BssEntry[pRoamTab->BssNr], pBss, + sizeof(BSS_ENTRY)); pRoamTab->BssNr += 1; } - if (pRoamTab->BssNr > 0) - { + if (pRoamTab->BssNr > 0) { // check CntlMachine.CurrState to avoid collision with NDIS SetOID request - if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) - { - pAd->RalinkCounters.PoorCQIRoamingCount ++; - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - Roaming attempt #%ld\n", pAd->RalinkCounters.PoorCQIRoamingCount)); - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_MLME_ROAMING_REQ, 0, NULL); + if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) { + pAd->RalinkCounters.PoorCQIRoamingCount++; + DBGPRINT(RT_DEBUG_TRACE, + ("MMCHK - Roaming attempt #%ld\n", + pAd->RalinkCounters.PoorCQIRoamingCount)); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, + MT2_MLME_ROAMING_REQ, 0, NULL); RTMP_MLME_HANDLER(pAd); } } - DBGPRINT(RT_DEBUG_TRACE, ("<== MlmeCheckForRoaming(# of candidate= %d)\n",pRoamTab->BssNr)); + DBGPRINT(RT_DEBUG_TRACE, + ("<== MlmeCheckForRoaming(# of candidate= %d)\n", + pRoamTab->BssNr)); } /* @@ -1643,64 +1640,76 @@ VOID MlmeCheckForRoaming( Output: ========================================================================== */ -BOOLEAN MlmeCheckForFastRoaming( - IN PRTMP_ADAPTER pAd) +BOOLEAN MlmeCheckForFastRoaming(IN PRTMP_ADAPTER pAd) { - USHORT i; - BSS_TABLE *pRoamTab = &pAd->MlmeAux.RoamTab; - BSS_ENTRY *pBss; + USHORT i; + BSS_TABLE *pRoamTab = &pAd->MlmeAux.RoamTab; + BSS_ENTRY *pBss; DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeCheckForFastRoaming\n")); // put all roaming candidates into RoamTab, and sort in RSSI order BssTableInit(pRoamTab); - for (i = 0; i < pAd->ScanTab.BssNr; i++) - { + for (i = 0; i < pAd->ScanTab.BssNr; i++) { pBss = &pAd->ScanTab.BssEntry[i]; - if ((pBss->Rssi <= -50) && (pBss->Channel == pAd->CommonCfg.Channel)) - continue; // RSSI too weak. forget it. + if ((pBss->Rssi <= -50) + && (pBss->Channel == pAd->CommonCfg.Channel)) + continue; // RSSI too weak. forget it. if (MAC_ADDR_EQUAL(pBss->Bssid, pAd->CommonCfg.Bssid)) - continue; // skip current AP - if (!SSID_EQUAL(pBss->Ssid, pBss->SsidLen, pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen)) - continue; // skip different SSID - if (pBss->Rssi < (RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, pAd->StaCfg.RssiSample.LastRssi1, pAd->StaCfg.RssiSample.LastRssi2) + RSSI_DELTA)) - continue; // skip AP without better RSSI - - DBGPRINT(RT_DEBUG_TRACE, ("LastRssi0 = %d, pBss->Rssi = %d\n", RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, pAd->StaCfg.RssiSample.LastRssi1, pAd->StaCfg.RssiSample.LastRssi2), pBss->Rssi)); + continue; // skip current AP + if (!SSID_EQUAL + (pBss->Ssid, pBss->SsidLen, pAd->CommonCfg.Ssid, + pAd->CommonCfg.SsidLen)) + continue; // skip different SSID + if (pBss->Rssi < + (RTMPMaxRssi + (pAd, pAd->StaCfg.RssiSample.LastRssi0, + pAd->StaCfg.RssiSample.LastRssi1, + pAd->StaCfg.RssiSample.LastRssi2) + RSSI_DELTA)) + continue; // skip AP without better RSSI + + DBGPRINT(RT_DEBUG_TRACE, + ("LastRssi0 = %d, pBss->Rssi = %d\n", + RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, + pAd->StaCfg.RssiSample.LastRssi1, + pAd->StaCfg.RssiSample.LastRssi2), + pBss->Rssi)); // AP passing all above rules is put into roaming candidate table - NdisMoveMemory(&pRoamTab->BssEntry[pRoamTab->BssNr], pBss, sizeof(BSS_ENTRY)); + NdisMoveMemory(&pRoamTab->BssEntry[pRoamTab->BssNr], pBss, + sizeof(BSS_ENTRY)); pRoamTab->BssNr += 1; - } + } - DBGPRINT(RT_DEBUG_TRACE, ("<== MlmeCheckForFastRoaming (BssNr=%d)\n", pRoamTab->BssNr)); - if (pRoamTab->BssNr > 0) - { + DBGPRINT(RT_DEBUG_TRACE, + ("<== MlmeCheckForFastRoaming (BssNr=%d)\n", pRoamTab->BssNr)); + if (pRoamTab->BssNr > 0) { // check CntlMachine.CurrState to avoid collision with NDIS SetOID request - if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) - { - pAd->RalinkCounters.PoorCQIRoamingCount ++; - DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - Roaming attempt #%ld\n", pAd->RalinkCounters.PoorCQIRoamingCount)); - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_MLME_ROAMING_REQ, 0, NULL); + if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) { + pAd->RalinkCounters.PoorCQIRoamingCount++; + DBGPRINT(RT_DEBUG_TRACE, + ("MMCHK - Roaming attempt #%ld\n", + pAd->RalinkCounters.PoorCQIRoamingCount)); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, + MT2_MLME_ROAMING_REQ, 0, NULL); RTMP_MLME_HANDLER(pAd); return TRUE; - } - } + } + } return FALSE; } -VOID MlmeSetTxRate( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PRTMP_TX_RATE_SWITCH pTxRate) +VOID MlmeSetTxRate(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, IN PRTMP_TX_RATE_SWITCH pTxRate) { - UCHAR MaxMode = MODE_OFDM; + UCHAR MaxMode = MODE_OFDM; MaxMode = MODE_HTGREENFIELD; - if (pTxRate->STBC && (pAd->StaCfg.MaxHTPhyMode.field.STBC) && (pAd->Antenna.field.TxPath == 2)) + if (pTxRate->STBC && (pAd->StaCfg.MaxHTPhyMode.field.STBC) + && (pAd->Antenna.field.TxPath == 2)) pAd->StaCfg.HTPhyMode.field.STBC = STBC_USE; - else + else pAd->StaCfg.HTPhyMode.field.STBC = STBC_NONE; if (pTxRate->CurrMCS < MCS_AUTO) @@ -1709,86 +1718,109 @@ VOID MlmeSetTxRate( if (pAd->StaCfg.HTPhyMode.field.MCS > 7) pAd->StaCfg.HTPhyMode.field.STBC = STBC_NONE; - if (ADHOC_ON(pAd)) - { + if (ADHOC_ON(pAd)) { // If peer adhoc is b-only mode, we can't send 11g rate. pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; - pEntry->HTPhyMode.field.STBC = STBC_NONE; + pEntry->HTPhyMode.field.STBC = STBC_NONE; // // For Adhoc MODE_CCK, driver will use AdhocBOnlyJoined flag to roll back to B only if necessary // - pEntry->HTPhyMode.field.MODE = pTxRate->Mode; - pEntry->HTPhyMode.field.ShortGI = pAd->StaCfg.HTPhyMode.field.ShortGI; - pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; + pEntry->HTPhyMode.field.MODE = pTxRate->Mode; + pEntry->HTPhyMode.field.ShortGI = + pAd->StaCfg.HTPhyMode.field.ShortGI; + pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; // Patch speed error in status page pAd->StaCfg.HTPhyMode.field.MODE = pEntry->HTPhyMode.field.MODE; - } - else - { + } else { if (pTxRate->Mode <= MaxMode) - pAd->StaCfg.HTPhyMode.field.MODE = pTxRate->Mode; + pAd->StaCfg.HTPhyMode.field.MODE = pTxRate->Mode; - if (pTxRate->ShortGI && (pAd->StaCfg.MaxHTPhyMode.field.ShortGI)) + if (pTxRate->ShortGI + && (pAd->StaCfg.MaxHTPhyMode.field.ShortGI)) pAd->StaCfg.HTPhyMode.field.ShortGI = GI_400; else pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; // Reexam each bandwidth's SGI support. - if (pAd->StaCfg.HTPhyMode.field.ShortGI == GI_400) - { - if ((pEntry->HTPhyMode.field.BW == BW_20) && (!CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_SGI20_CAPABLE))) + if (pAd->StaCfg.HTPhyMode.field.ShortGI == GI_400) { + if ((pEntry->HTPhyMode.field.BW == BW_20) + && + (!CLIENT_STATUS_TEST_FLAG + (pEntry, fCLIENT_STATUS_SGI20_CAPABLE))) pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; - if ((pEntry->HTPhyMode.field.BW == BW_40) && (!CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_SGI40_CAPABLE))) + if ((pEntry->HTPhyMode.field.BW == BW_40) + && + (!CLIENT_STATUS_TEST_FLAG + (pEntry, fCLIENT_STATUS_SGI40_CAPABLE))) pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; } - - // Turn RTS/CTS rate to 6Mbps. - if ((pEntry->HTPhyMode.field.MCS == 0) && (pAd->StaCfg.HTPhyMode.field.MCS != 0)) - { - pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - if (pAd->MacTab.fAnyBASession) - { - AsicUpdateProtect(pAd, HT_FORCERTSCTS, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); - } - else - { - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); - } - } - else if ((pEntry->HTPhyMode.field.MCS == 8) && (pAd->StaCfg.HTPhyMode.field.MCS != 8)) - { - pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - if (pAd->MacTab.fAnyBASession) - { - AsicUpdateProtect(pAd, HT_FORCERTSCTS, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); - } - else - { - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); - } + // Turn RTS/CTS rate to 6Mbps. + if ((pEntry->HTPhyMode.field.MCS == 0) + && (pAd->StaCfg.HTPhyMode.field.MCS != 0)) { + pEntry->HTPhyMode.field.MCS = + pAd->StaCfg.HTPhyMode.field.MCS; + if (pAd->MacTab.fAnyBASession) { + AsicUpdateProtect(pAd, HT_FORCERTSCTS, + ALLN_SETPROTECT, TRUE, + (BOOLEAN) pAd->MlmeAux. + AddHtInfo.AddHtInfo2. + NonGfPresent); + } else { + AsicUpdateProtect(pAd, + pAd->MlmeAux.AddHtInfo. + AddHtInfo2.OperaionMode, + ALLN_SETPROTECT, TRUE, + (BOOLEAN) pAd->MlmeAux. + AddHtInfo.AddHtInfo2. + NonGfPresent); } - else if ((pEntry->HTPhyMode.field.MCS != 0) && (pAd->StaCfg.HTPhyMode.field.MCS == 0)) - { - AsicUpdateProtect(pAd, HT_RTSCTS_6M, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); - - } - else if ((pEntry->HTPhyMode.field.MCS != 8) && (pAd->StaCfg.HTPhyMode.field.MCS == 8)) - { - AsicUpdateProtect(pAd, HT_RTSCTS_6M, ALLN_SETPROTECT, TRUE, (BOOLEAN)pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent); + } else if ((pEntry->HTPhyMode.field.MCS == 8) + && (pAd->StaCfg.HTPhyMode.field.MCS != 8)) { + pEntry->HTPhyMode.field.MCS = + pAd->StaCfg.HTPhyMode.field.MCS; + if (pAd->MacTab.fAnyBASession) { + AsicUpdateProtect(pAd, HT_FORCERTSCTS, + ALLN_SETPROTECT, TRUE, + (BOOLEAN) pAd->MlmeAux. + AddHtInfo.AddHtInfo2. + NonGfPresent); + } else { + AsicUpdateProtect(pAd, + pAd->MlmeAux.AddHtInfo. + AddHtInfo2.OperaionMode, + ALLN_SETPROTECT, TRUE, + (BOOLEAN) pAd->MlmeAux. + AddHtInfo.AddHtInfo2. + NonGfPresent); } - - pEntry->HTPhyMode.field.STBC = pAd->StaCfg.HTPhyMode.field.STBC; - pEntry->HTPhyMode.field.ShortGI = pAd->StaCfg.HTPhyMode.field.ShortGI; - pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - pEntry->HTPhyMode.field.MODE = pAd->StaCfg.HTPhyMode.field.MODE; - if ((pAd->StaCfg.MaxHTPhyMode.field.MODE == MODE_HTGREENFIELD) && - pAd->WIFItestbed.bGreenField) - pEntry->HTPhyMode.field.MODE = MODE_HTGREENFIELD; + } else if ((pEntry->HTPhyMode.field.MCS != 0) + && (pAd->StaCfg.HTPhyMode.field.MCS == 0)) { + AsicUpdateProtect(pAd, HT_RTSCTS_6M, ALLN_SETPROTECT, + TRUE, + (BOOLEAN) pAd->MlmeAux.AddHtInfo. + AddHtInfo2.NonGfPresent); + + } else if ((pEntry->HTPhyMode.field.MCS != 8) + && (pAd->StaCfg.HTPhyMode.field.MCS == 8)) { + AsicUpdateProtect(pAd, HT_RTSCTS_6M, ALLN_SETPROTECT, + TRUE, + (BOOLEAN) pAd->MlmeAux.AddHtInfo. + AddHtInfo2.NonGfPresent); } - pAd->LastTxRate = (USHORT)(pEntry->HTPhyMode.word); + pEntry->HTPhyMode.field.STBC = pAd->StaCfg.HTPhyMode.field.STBC; + pEntry->HTPhyMode.field.ShortGI = + pAd->StaCfg.HTPhyMode.field.ShortGI; + pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; + pEntry->HTPhyMode.field.MODE = pAd->StaCfg.HTPhyMode.field.MODE; + if ((pAd->StaCfg.MaxHTPhyMode.field.MODE == MODE_HTGREENFIELD) + && pAd->WIFItestbed.bGreenField) + pEntry->HTPhyMode.field.MODE = MODE_HTGREENFIELD; + } + + pAd->LastTxRate = (USHORT) (pEntry->HTPhyMode.word); } /* @@ -1808,42 +1840,37 @@ VOID MlmeSetTxRate( call this routine every second ========================================================================== */ -VOID MlmeDynamicTxRateSwitching( - IN PRTMP_ADAPTER pAd) +VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) { - UCHAR UpRateIdx = 0, DownRateIdx = 0, CurrRateIdx; - ULONG i, AccuTxTotalCnt = 0, TxTotalCnt; - ULONG TxErrorRatio = 0; - BOOLEAN bTxRateChanged = FALSE, bUpgradeQuality = FALSE; - PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate = NULL; - PUCHAR pTable; - UCHAR TableSize = 0; - UCHAR InitTxRateIdx = 0, TrainUp, TrainDown; - CHAR Rssi, RssiOffset = 0; - TX_STA_CNT1_STRUC StaTx1; - TX_STA_CNT0_STRUC TxStaCnt0; - ULONG TxRetransmit = 0, TxSuccess = 0, TxFailCount = 0; - MAC_TABLE_ENTRY *pEntry; - RSSI_SAMPLE *pRssi = &pAd->StaCfg.RssiSample; - + UCHAR UpRateIdx = 0, DownRateIdx = 0, CurrRateIdx; + ULONG i, AccuTxTotalCnt = 0, TxTotalCnt; + ULONG TxErrorRatio = 0; + BOOLEAN bTxRateChanged = FALSE, bUpgradeQuality = FALSE; + PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate = NULL; + PUCHAR pTable; + UCHAR TableSize = 0; + UCHAR InitTxRateIdx = 0, TrainUp, TrainDown; + CHAR Rssi, RssiOffset = 0; + TX_STA_CNT1_STRUC StaTx1; + TX_STA_CNT0_STRUC TxStaCnt0; + ULONG TxRetransmit = 0, TxSuccess = 0, TxFailCount = 0; + MAC_TABLE_ENTRY *pEntry; + RSSI_SAMPLE *pRssi = &pAd->StaCfg.RssiSample; // // walk through MAC table, see if need to change AP's TX rate toward each entry // - for (i = 1; i < MAX_LEN_OF_MAC_TABLE; i++) - { + for (i = 1; i < MAX_LEN_OF_MAC_TABLE; i++) { pEntry = &pAd->MacTab.Content[i]; - // check if this entry need to switch rate automatically + // check if this entry need to switch rate automatically if (RTMPCheckEntryEnableAutoRateSwitch(pAd, pEntry) == FALSE) continue; - if ((pAd->MacTab.Size == 1) || (pEntry->ValidAsDls)) - { + if ((pAd->MacTab.Size == 1) || (pEntry->ValidAsDls)) { Rssi = RTMPMaxRssi(pAd, - pRssi->AvgRssi0, - pRssi->AvgRssi1, - pRssi->AvgRssi2); + pRssi->AvgRssi0, + pRssi->AvgRssi1, pRssi->AvgRssi2); // Update statistic counter RTMP_IO_READ32(pAd, TX_STA_CNT0, &TxStaCnt0.word); @@ -1854,55 +1881,63 @@ VOID MlmeDynamicTxRateSwitching( TxFailCount = TxStaCnt0.field.TxFailCount; TxTotalCnt = TxRetransmit + TxSuccess + TxFailCount; - pAd->RalinkCounters.OneSecTxRetryOkCount += StaTx1.field.TxRetransmit; - pAd->RalinkCounters.OneSecTxNoRetryOkCount += StaTx1.field.TxSuccess; - pAd->RalinkCounters.OneSecTxFailCount += TxStaCnt0.field.TxFailCount; - pAd->WlanCounters.TransmittedFragmentCount.u.LowPart += StaTx1.field.TxSuccess; - pAd->WlanCounters.RetryCount.u.LowPart += StaTx1.field.TxRetransmit; - pAd->WlanCounters.FailedCount.u.LowPart += TxStaCnt0.field.TxFailCount; + pAd->RalinkCounters.OneSecTxRetryOkCount += + StaTx1.field.TxRetransmit; + pAd->RalinkCounters.OneSecTxNoRetryOkCount += + StaTx1.field.TxSuccess; + pAd->RalinkCounters.OneSecTxFailCount += + TxStaCnt0.field.TxFailCount; + pAd->WlanCounters.TransmittedFragmentCount.u.LowPart += + StaTx1.field.TxSuccess; + pAd->WlanCounters.RetryCount.u.LowPart += + StaTx1.field.TxRetransmit; + pAd->WlanCounters.FailedCount.u.LowPart += + TxStaCnt0.field.TxFailCount; // if no traffic in the past 1-sec period, don't change TX rate, // but clear all bad history. because the bad history may affect the next // Chariot throughput test - AccuTxTotalCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount + - pAd->RalinkCounters.OneSecTxRetryOkCount + - pAd->RalinkCounters.OneSecTxFailCount; + AccuTxTotalCnt = + pAd->RalinkCounters.OneSecTxNoRetryOkCount + + pAd->RalinkCounters.OneSecTxRetryOkCount + + pAd->RalinkCounters.OneSecTxFailCount; if (TxTotalCnt) - TxErrorRatio = ((TxRetransmit + TxFailCount) * 100) / TxTotalCnt; - } - else - { + TxErrorRatio = + ((TxRetransmit + + TxFailCount) * 100) / TxTotalCnt; + } else { if (INFRA_ON(pAd) && (i == 1)) Rssi = RTMPMaxRssi(pAd, - pRssi->AvgRssi0, - pRssi->AvgRssi1, - pRssi->AvgRssi2); + pRssi->AvgRssi0, + pRssi->AvgRssi1, + pRssi->AvgRssi2); else Rssi = RTMPMaxRssi(pAd, - pEntry->RssiSample.AvgRssi0, - pEntry->RssiSample.AvgRssi1, - pEntry->RssiSample.AvgRssi2); + pEntry->RssiSample.AvgRssi0, + pEntry->RssiSample.AvgRssi1, + pEntry->RssiSample.AvgRssi2); TxTotalCnt = pEntry->OneSecTxNoRetryOkCount + - pEntry->OneSecTxRetryOkCount + - pEntry->OneSecTxFailCount; + pEntry->OneSecTxRetryOkCount + + pEntry->OneSecTxFailCount; if (TxTotalCnt) - TxErrorRatio = ((pEntry->OneSecTxRetryOkCount + pEntry->OneSecTxFailCount) * 100) / TxTotalCnt; - } + TxErrorRatio = + ((pEntry->OneSecTxRetryOkCount + + pEntry->OneSecTxFailCount) * 100) / + TxTotalCnt; + } - if (TxTotalCnt) - { + if (TxTotalCnt) { /* - Three AdHoc connections can not work normally if one AdHoc connection is disappeared from a heavy traffic environment generated by ping tool - We force to set LongRtyLimit and ShortRtyLimit to 0 to stop retransmitting packet, after a while, resoring original settings - */ - if (TxErrorRatio == 100) - { - TX_RTY_CFG_STRUC TxRtyCfg,TxRtyCfgtmp; - ULONG Index; - ULONG MACValue; + Three AdHoc connections can not work normally if one AdHoc connection is disappeared from a heavy traffic environment generated by ping tool + We force to set LongRtyLimit and ShortRtyLimit to 0 to stop retransmitting packet, after a while, resoring original settings + */ + if (TxErrorRatio == 100) { + TX_RTY_CFG_STRUC TxRtyCfg, TxRtyCfgtmp; + ULONG Index; + ULONG MACValue; RTMP_IO_READ32(pAd, TX_RTY_CFG, &TxRtyCfg.word); TxRtyCfgtmp.word = TxRtyCfg.word; @@ -1914,42 +1949,49 @@ VOID MlmeDynamicTxRateSwitching( Index = 0; MACValue = 0; - do - { - RTMP_IO_READ32(pAd, TXRXQ_PCNT, &MACValue); + do { + RTMP_IO_READ32(pAd, TXRXQ_PCNT, + &MACValue); if ((MACValue & 0xffffff) == 0) break; Index++; RTMPusecDelay(1000); - }while((Index < 330)&&(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS))); + } while ((Index < 330) + && + (!RTMP_TEST_FLAG + (pAd, + fRTMP_ADAPTER_HALT_IN_PROGRESS))); RTMP_IO_READ32(pAd, TX_RTY_CFG, &TxRtyCfg.word); - TxRtyCfg.field.LongRtyLimit = TxRtyCfgtmp.field.LongRtyLimit; - TxRtyCfg.field.ShortRtyLimit = TxRtyCfgtmp.field.ShortRtyLimit; + TxRtyCfg.field.LongRtyLimit = + TxRtyCfgtmp.field.LongRtyLimit; + TxRtyCfg.field.ShortRtyLimit = + TxRtyCfgtmp.field.ShortRtyLimit; RTMP_IO_WRITE32(pAd, TX_RTY_CFG, TxRtyCfg.word); + } } - } CurrRateIdx = pEntry->CurrTxRateIndex; - MlmeSelectTxRateTable(pAd, pEntry, &pTable, &TableSize, &InitTxRateIdx); + MlmeSelectTxRateTable(pAd, pEntry, &pTable, &TableSize, + &InitTxRateIdx); - if (CurrRateIdx >= TableSize) - { + if (CurrRateIdx >= TableSize) { CurrRateIdx = TableSize - 1; } - // When switch from Fixed rate -> auto rate, the REAL TX rate might be different from pAd->CommonCfg.TxRateIndex. // So need to sync here. - pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(CurrRateIdx+1)*5]; + pCurrTxRate = + (PRTMP_TX_RATE_SWITCH) & pTable[(CurrRateIdx + 1) * 5]; if ((pEntry->HTPhyMode.field.MCS != pCurrTxRate->CurrMCS) - //&& (pAd->StaCfg.bAutoTxRateSwitch == TRUE) - ) - { + //&& (pAd->StaCfg.bAutoTxRateSwitch == TRUE) + ) { // Need to sync Real Tx rate and our record. // Then return for next DRS. - pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(InitTxRateIdx+1)*5]; + pCurrTxRate = + (PRTMP_TX_RATE_SWITCH) & pTable[(InitTxRateIdx + 1) + * 5]; pEntry->CurrTxRateIndex = InitTxRateIdx; MlmeSetTxRate(pAd, pEntry, pCurrTxRate); @@ -1957,222 +1999,176 @@ VOID MlmeDynamicTxRateSwitching( RESET_ONE_SEC_TX_CNT(pEntry); continue; } - // decide the next upgrade rate and downgrade rate, if any - if ((CurrRateIdx > 0) && (CurrRateIdx < (TableSize - 1))) - { + if ((CurrRateIdx > 0) && (CurrRateIdx < (TableSize - 1))) { UpRateIdx = CurrRateIdx + 1; - DownRateIdx = CurrRateIdx -1; - } - else if (CurrRateIdx == 0) - { + DownRateIdx = CurrRateIdx - 1; + } else if (CurrRateIdx == 0) { UpRateIdx = CurrRateIdx + 1; DownRateIdx = CurrRateIdx; - } - else if (CurrRateIdx == (TableSize - 1)) - { + } else if (CurrRateIdx == (TableSize - 1)) { UpRateIdx = CurrRateIdx; DownRateIdx = CurrRateIdx - 1; - } - - pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(CurrRateIdx+1)*5]; + } - if ((Rssi > -65) && (pCurrTxRate->Mode >= MODE_HTMIX)) - { - TrainUp = (pCurrTxRate->TrainUp + (pCurrTxRate->TrainUp >> 1)); - TrainDown = (pCurrTxRate->TrainDown + (pCurrTxRate->TrainDown >> 1)); - } - else - { - TrainUp = pCurrTxRate->TrainUp; - TrainDown = pCurrTxRate->TrainDown; - } + pCurrTxRate = + (PRTMP_TX_RATE_SWITCH) & pTable[(CurrRateIdx + 1) * 5]; + + if ((Rssi > -65) && (pCurrTxRate->Mode >= MODE_HTMIX)) { + TrainUp = + (pCurrTxRate->TrainUp + + (pCurrTxRate->TrainUp >> 1)); + TrainDown = + (pCurrTxRate->TrainDown + + (pCurrTxRate->TrainDown >> 1)); + } else { + TrainUp = pCurrTxRate->TrainUp; + TrainDown = pCurrTxRate->TrainDown; + } //pAd->DrsCounters.LastTimeTxRateChangeAction = pAd->DrsCounters.LastSecTxRateChangeAction; // // Keep the last time TxRateChangeAction status. // - pEntry->LastTimeTxRateChangeAction = pEntry->LastSecTxRateChangeAction; - - + pEntry->LastTimeTxRateChangeAction = + pEntry->LastSecTxRateChangeAction; // // CASE 1. when TX samples are fewer than 15, then decide TX rate solely on RSSI // (criteria copied from RT2500 for Netopia case) // - if (TxTotalCnt <= 15) - { - CHAR idx = 0; - UCHAR TxRateIdx; - UCHAR MCS0 = 0, MCS1 = 0, MCS2 = 0, MCS3 = 0, MCS4 = 0, MCS5 =0, MCS6 = 0, MCS7 = 0; - UCHAR MCS12 = 0, MCS13 = 0, MCS14 = 0, MCS15 = 0; - UCHAR MCS20 = 0, MCS21 = 0, MCS22 = 0, MCS23 = 0; // 3*3 + if (TxTotalCnt <= 15) { + CHAR idx = 0; + UCHAR TxRateIdx; + UCHAR MCS0 = 0, MCS1 = 0, MCS2 = 0, MCS3 = 0, MCS4 = + 0, MCS5 = 0, MCS6 = 0, MCS7 = 0; + UCHAR MCS12 = 0, MCS13 = 0, MCS14 = 0, MCS15 = 0; + UCHAR MCS20 = 0, MCS21 = 0, MCS22 = 0, MCS23 = 0; // 3*3 // check the existence and index of each needed MCS - while (idx < pTable[0]) - { - pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(idx+1)*5]; + while (idx < pTable[0]) { + pCurrTxRate = + (PRTMP_TX_RATE_SWITCH) & pTable[(idx + 1) * + 5]; - if (pCurrTxRate->CurrMCS == MCS_0) - { + if (pCurrTxRate->CurrMCS == MCS_0) { MCS0 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_1) - { + } else if (pCurrTxRate->CurrMCS == MCS_1) { MCS1 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_2) - { + } else if (pCurrTxRate->CurrMCS == MCS_2) { MCS2 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_3) - { + } else if (pCurrTxRate->CurrMCS == MCS_3) { MCS3 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_4) - { + } else if (pCurrTxRate->CurrMCS == MCS_4) { MCS4 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_5) - { - MCS5 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_6) - { - MCS6 = idx; - } + } else if (pCurrTxRate->CurrMCS == MCS_5) { + MCS5 = idx; + } else if (pCurrTxRate->CurrMCS == MCS_6) { + MCS6 = idx; + } //else if (pCurrTxRate->CurrMCS == MCS_7) else if ((pCurrTxRate->CurrMCS == MCS_7) && (pCurrTxRate->ShortGI == GI_800)) // prevent the highest MCS using short GI when 1T and low throughput - { + { MCS7 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_12) - { + } else if (pCurrTxRate->CurrMCS == MCS_12) { MCS12 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_13) - { + } else if (pCurrTxRate->CurrMCS == MCS_13) { MCS13 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_14) - { + } else if (pCurrTxRate->CurrMCS == MCS_14) { MCS14 = idx; - } - //else if ((pCurrTxRate->CurrMCS == MCS_15)/* && (pCurrTxRate->ShortGI == GI_800)*/) //we hope to use ShortGI as initial rate + } + //else if ((pCurrTxRate->CurrMCS == MCS_15)/* && (pCurrTxRate->ShortGI == GI_800)*/) //we hope to use ShortGI as initial rate else if ((pCurrTxRate->CurrMCS == MCS_15) && (pCurrTxRate->ShortGI == GI_800)) //we hope to use ShortGI as initial rate, however Atheros's chip has bugs when short GI - { + { MCS15 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_20) // 3*3 + } else if (pCurrTxRate->CurrMCS == MCS_20) // 3*3 { MCS20 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_21) - { + } else if (pCurrTxRate->CurrMCS == MCS_21) { MCS21 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_22) - { + } else if (pCurrTxRate->CurrMCS == MCS_22) { MCS22 = idx; - } - else if (pCurrTxRate->CurrMCS == MCS_23) - { + } else if (pCurrTxRate->CurrMCS == MCS_23) { MCS23 = idx; } - idx ++; + idx++; } - if (pAd->LatchRfRegs.Channel <= 14) - { - if (pAd->NicConfig2.field.ExternalLNAForG) - { + if (pAd->LatchRfRegs.Channel <= 14) { + if (pAd->NicConfig2.field.ExternalLNAForG) { RssiOffset = 2; - } - else - { + } else { RssiOffset = 5; } - } - else - { - if (pAd->NicConfig2.field.ExternalLNAForA) - { + } else { + if (pAd->NicConfig2.field.ExternalLNAForA) { RssiOffset = 5; - } - else - { + } else { RssiOffset = 8; } } - /*if (MCS15)*/ - if ((pTable == RateSwitchTable11BGN3S) || - (pTable == RateSwitchTable11N3S) || - (pTable == RateSwitchTable)) - {// N mode with 3 stream // 3*3 + /*if (MCS15) */ + if ((pTable == RateSwitchTable11BGN3S) || (pTable == RateSwitchTable11N3S) || (pTable == RateSwitchTable)) { // N mode with 3 stream // 3*3 if (MCS23 && (Rssi >= -70)) TxRateIdx = MCS23; else if (MCS22 && (Rssi >= -72)) TxRateIdx = MCS22; - else if (MCS21 && (Rssi >= -76)) + else if (MCS21 && (Rssi >= -76)) TxRateIdx = MCS21; else if (MCS20 && (Rssi >= -78)) TxRateIdx = MCS20; - else if (MCS4 && (Rssi >= -82)) - TxRateIdx = MCS4; - else if (MCS3 && (Rssi >= -84)) - TxRateIdx = MCS3; - else if (MCS2 && (Rssi >= -86)) - TxRateIdx = MCS2; - else if (MCS1 && (Rssi >= -88)) - TxRateIdx = MCS1; - else - TxRateIdx = MCS0; - } -// else if ((pTable == RateSwitchTable11BGN2S) || (pTable == RateSwitchTable11BGN2SForABand) ||(pTable == RateSwitchTable11N2S) ||(pTable == RateSwitchTable11N2SForABand) || (pTable == RateSwitchTable)) - else if ((pTable == RateSwitchTable11BGN2S) || (pTable == RateSwitchTable11BGN2SForABand) ||(pTable == RateSwitchTable11N2S) ||(pTable == RateSwitchTable11N2SForABand)) // 3*3 - {// N mode with 2 stream - if (MCS15 && (Rssi >= (-70+RssiOffset))) + else if (MCS4 && (Rssi >= -82)) + TxRateIdx = MCS4; + else if (MCS3 && (Rssi >= -84)) + TxRateIdx = MCS3; + else if (MCS2 && (Rssi >= -86)) + TxRateIdx = MCS2; + else if (MCS1 && (Rssi >= -88)) + TxRateIdx = MCS1; + else + TxRateIdx = MCS0; + } +// else if ((pTable == RateSwitchTable11BGN2S) || (pTable == RateSwitchTable11BGN2SForABand) ||(pTable == RateSwitchTable11N2S) ||(pTable == RateSwitchTable11N2SForABand) || (pTable == RateSwitchTable)) + else if ((pTable == RateSwitchTable11BGN2S) || (pTable == RateSwitchTable11BGN2SForABand) || (pTable == RateSwitchTable11N2S) || (pTable == RateSwitchTable11N2SForABand)) // 3*3 + { // N mode with 2 stream + if (MCS15 && (Rssi >= (-70 + RssiOffset))) TxRateIdx = MCS15; - else if (MCS14 && (Rssi >= (-72+RssiOffset))) + else if (MCS14 && (Rssi >= (-72 + RssiOffset))) TxRateIdx = MCS14; - else if (MCS13 && (Rssi >= (-76+RssiOffset))) + else if (MCS13 && (Rssi >= (-76 + RssiOffset))) TxRateIdx = MCS13; - else if (MCS12 && (Rssi >= (-78+RssiOffset))) + else if (MCS12 && (Rssi >= (-78 + RssiOffset))) TxRateIdx = MCS12; - else if (MCS4 && (Rssi >= (-82+RssiOffset))) + else if (MCS4 && (Rssi >= (-82 + RssiOffset))) TxRateIdx = MCS4; - else if (MCS3 && (Rssi >= (-84+RssiOffset))) + else if (MCS3 && (Rssi >= (-84 + RssiOffset))) TxRateIdx = MCS3; - else if (MCS2 && (Rssi >= (-86+RssiOffset))) + else if (MCS2 && (Rssi >= (-86 + RssiOffset))) TxRateIdx = MCS2; - else if (MCS1 && (Rssi >= (-88+RssiOffset))) + else if (MCS1 && (Rssi >= (-88 + RssiOffset))) TxRateIdx = MCS1; else TxRateIdx = MCS0; - } - else if ((pTable == RateSwitchTable11BGN1S) || (pTable == RateSwitchTable11N1S)) - {// N mode with 1 stream - if (MCS7 && (Rssi > (-72+RssiOffset))) + } else if ((pTable == RateSwitchTable11BGN1S) || (pTable == RateSwitchTable11N1S)) { // N mode with 1 stream + if (MCS7 && (Rssi > (-72 + RssiOffset))) TxRateIdx = MCS7; - else if (MCS6 && (Rssi > (-74+RssiOffset))) + else if (MCS6 && (Rssi > (-74 + RssiOffset))) TxRateIdx = MCS6; - else if (MCS5 && (Rssi > (-77+RssiOffset))) + else if (MCS5 && (Rssi > (-77 + RssiOffset))) TxRateIdx = MCS5; - else if (MCS4 && (Rssi > (-79+RssiOffset))) + else if (MCS4 && (Rssi > (-79 + RssiOffset))) TxRateIdx = MCS4; - else if (MCS3 && (Rssi > (-81+RssiOffset))) + else if (MCS3 && (Rssi > (-81 + RssiOffset))) TxRateIdx = MCS3; - else if (MCS2 && (Rssi > (-83+RssiOffset))) + else if (MCS2 && (Rssi > (-83 + RssiOffset))) TxRateIdx = MCS2; - else if (MCS1 && (Rssi > (-86+RssiOffset))) + else if (MCS1 && (Rssi > (-86 + RssiOffset))) TxRateIdx = MCS1; else TxRateIdx = MCS0; - } - else - {// Legacy mode + } else { // Legacy mode if (MCS7 && (Rssi > -70)) TxRateIdx = MCS7; else if (MCS6 && (Rssi > -74)) @@ -2193,15 +2189,21 @@ VOID MlmeDynamicTxRateSwitching( TxRateIdx = MCS0; } - // if (TxRateIdx != pAd->CommonCfg.TxRateIndex) + // if (TxRateIdx != pAd->CommonCfg.TxRateIndex) { pEntry->CurrTxRateIndex = TxRateIdx; - pNextTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(pEntry->CurrTxRateIndex+1)*5]; + pNextTxRate = + (PRTMP_TX_RATE_SWITCH) & + pTable[(pEntry->CurrTxRateIndex + 1) * 5]; MlmeSetTxRate(pAd, pEntry, pNextTxRate); } - NdisZeroMemory(pEntry->TxQuality, sizeof(USHORT) * MAX_STEP_OF_TX_RATE_SWITCH); - NdisZeroMemory(pEntry->PER, sizeof(UCHAR) * MAX_STEP_OF_TX_RATE_SWITCH); + NdisZeroMemory(pEntry->TxQuality, + sizeof(USHORT) * + MAX_STEP_OF_TX_RATE_SWITCH); + NdisZeroMemory(pEntry->PER, + sizeof(UCHAR) * + MAX_STEP_OF_TX_RATE_SWITCH); pEntry->fLastSecAccordingRSSI = TRUE; // reset all OneSecTx counters RESET_ONE_SEC_TX_CNT(pEntry); @@ -2209,8 +2211,7 @@ VOID MlmeDynamicTxRateSwitching( continue; } - if (pEntry->fLastSecAccordingRSSI == TRUE) - { + if (pEntry->fLastSecAccordingRSSI == TRUE) { pEntry->fLastSecAccordingRSSI = FALSE; pEntry->LastSecTxRateChangeAction = 0; // reset all OneSecTx counters @@ -2219,91 +2220,93 @@ VOID MlmeDynamicTxRateSwitching( continue; } - do - { - BOOLEAN bTrainUpDown = FALSE; + do { + BOOLEAN bTrainUpDown = FALSE; - pEntry->CurrTxRateStableTime ++; + pEntry->CurrTxRateStableTime++; // downgrade TX quality if PER >= Rate-Down threshold - if (TxErrorRatio >= TrainDown) - { + if (TxErrorRatio >= TrainDown) { bTrainUpDown = TRUE; - pEntry->TxQuality[CurrRateIdx] = DRS_TX_QUALITY_WORST_BOUND; + pEntry->TxQuality[CurrRateIdx] = + DRS_TX_QUALITY_WORST_BOUND; } // upgrade TX quality if PER <= Rate-Up threshold - else if (TxErrorRatio <= TrainUp) - { + else if (TxErrorRatio <= TrainUp) { bTrainUpDown = TRUE; bUpgradeQuality = TRUE; if (pEntry->TxQuality[CurrRateIdx]) - pEntry->TxQuality[CurrRateIdx] --; // quality very good in CurrRate + pEntry->TxQuality[CurrRateIdx]--; // quality very good in CurrRate if (pEntry->TxRateUpPenalty) - pEntry->TxRateUpPenalty --; + pEntry->TxRateUpPenalty--; else if (pEntry->TxQuality[UpRateIdx]) - pEntry->TxQuality[UpRateIdx] --; // may improve next UP rate's quality + pEntry->TxQuality[UpRateIdx]--; // may improve next UP rate's quality } - pEntry->PER[CurrRateIdx] = (UCHAR)TxErrorRatio; + pEntry->PER[CurrRateIdx] = (UCHAR) TxErrorRatio; - if (bTrainUpDown) - { + if (bTrainUpDown) { // perform DRS - consider TxRate Down first, then rate up. - if ((CurrRateIdx != DownRateIdx) && (pEntry->TxQuality[CurrRateIdx] >= DRS_TX_QUALITY_WORST_BOUND)) - { + if ((CurrRateIdx != DownRateIdx) + && (pEntry->TxQuality[CurrRateIdx] >= + DRS_TX_QUALITY_WORST_BOUND)) { pEntry->CurrTxRateIndex = DownRateIdx; - } - else if ((CurrRateIdx != UpRateIdx) && (pEntry->TxQuality[UpRateIdx] <= 0)) - { + } else if ((CurrRateIdx != UpRateIdx) + && (pEntry->TxQuality[UpRateIdx] <= + 0)) { pEntry->CurrTxRateIndex = UpRateIdx; } } } while (FALSE); // if rate-up happen, clear all bad history of all TX rates - if (pEntry->CurrTxRateIndex > CurrRateIdx) - { + if (pEntry->CurrTxRateIndex > CurrRateIdx) { pEntry->CurrTxRateStableTime = 0; pEntry->TxRateUpPenalty = 0; - pEntry->LastSecTxRateChangeAction = 1; // rate UP - NdisZeroMemory(pEntry->TxQuality, sizeof(USHORT) * MAX_STEP_OF_TX_RATE_SWITCH); - NdisZeroMemory(pEntry->PER, sizeof(UCHAR) * MAX_STEP_OF_TX_RATE_SWITCH); + pEntry->LastSecTxRateChangeAction = 1; // rate UP + NdisZeroMemory(pEntry->TxQuality, + sizeof(USHORT) * + MAX_STEP_OF_TX_RATE_SWITCH); + NdisZeroMemory(pEntry->PER, + sizeof(UCHAR) * + MAX_STEP_OF_TX_RATE_SWITCH); // // For TxRate fast train up // - if (!pAd->StaCfg.StaQuickResponeForRateUpTimerRunning) - { - RTMPSetTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, 100); + if (!pAd->StaCfg.StaQuickResponeForRateUpTimerRunning) { + RTMPSetTimer(&pAd->StaCfg. + StaQuickResponeForRateUpTimer, + 100); - pAd->StaCfg.StaQuickResponeForRateUpTimerRunning = TRUE; + pAd->StaCfg. + StaQuickResponeForRateUpTimerRunning = TRUE; } bTxRateChanged = TRUE; } // if rate-down happen, only clear DownRate's bad history - else if (pEntry->CurrTxRateIndex < CurrRateIdx) - { + else if (pEntry->CurrTxRateIndex < CurrRateIdx) { pEntry->CurrTxRateStableTime = 0; - pEntry->TxRateUpPenalty = 0; // no penalty - pEntry->LastSecTxRateChangeAction = 2; // rate DOWN + pEntry->TxRateUpPenalty = 0; // no penalty + pEntry->LastSecTxRateChangeAction = 2; // rate DOWN pEntry->TxQuality[pEntry->CurrTxRateIndex] = 0; pEntry->PER[pEntry->CurrTxRateIndex] = 0; // // For TxRate fast train down // - if (!pAd->StaCfg.StaQuickResponeForRateUpTimerRunning) - { - RTMPSetTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, 100); + if (!pAd->StaCfg.StaQuickResponeForRateUpTimerRunning) { + RTMPSetTimer(&pAd->StaCfg. + StaQuickResponeForRateUpTimer, + 100); - pAd->StaCfg.StaQuickResponeForRateUpTimerRunning = TRUE; + pAd->StaCfg. + StaQuickResponeForRateUpTimerRunning = TRUE; } bTxRateChanged = TRUE; - } - else - { - pEntry->LastSecTxRateChangeAction = 0; // rate no change + } else { + pEntry->LastSecTxRateChangeAction = 0; // rate no change bTxRateChanged = FALSE; } @@ -2312,21 +2315,28 @@ VOID MlmeDynamicTxRateSwitching( UCHAR tmpTxRate; // to fix tcp ack issue - if (!bTxRateChanged && (pAd->RalinkCounters.OneSecReceivedByteCount > (pAd->RalinkCounters.OneSecTransmittedByteCount * 5))) - { + if (!bTxRateChanged + && (pAd->RalinkCounters.OneSecReceivedByteCount > + (pAd->RalinkCounters. + OneSecTransmittedByteCount * 5))) { tmpTxRate = DownRateIdx; - DBGPRINT_RAW(RT_DEBUG_TRACE,("DRS: Rx(%d) is 5 times larger than Tx(%d), use low rate (curr=%d, tmp=%d)\n", - pAd->RalinkCounters.OneSecReceivedByteCount, pAd->RalinkCounters.OneSecTransmittedByteCount, pEntry->CurrTxRateIndex, tmpTxRate)); - } - else - { + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("DRS: Rx(%d) is 5 times larger than Tx(%d), use low rate (curr=%d, tmp=%d)\n", + pAd->RalinkCounters. + OneSecReceivedByteCount, + pAd->RalinkCounters. + OneSecTransmittedByteCount, + pEntry->CurrTxRateIndex, + tmpTxRate)); + } else { tmpTxRate = pEntry->CurrTxRateIndex; } - pNextTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(tmpTxRate+1)*5]; + pNextTxRate = + (PRTMP_TX_RATE_SWITCH) & pTable[(tmpTxRate + 1) * + 5]; } - if (bTxRateChanged && pNextTxRate) - { + if (bTxRateChanged && pNextTxRate) { MlmeSetTxRate(pAd, pEntry, pNextTxRate); } // reset all OneSecTx counters @@ -2350,35 +2360,33 @@ VOID MlmeDynamicTxRateSwitching( ======================================================================== */ -VOID StaQuickResponeForRateUpExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +VOID StaQuickResponeForRateUpExec(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3) { - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)FunctionContext; - UCHAR UpRateIdx = 0, DownRateIdx = 0, CurrRateIdx = 0; - ULONG TxTotalCnt; - ULONG TxErrorRatio = 0; - BOOLEAN bTxRateChanged; //, bUpgradeQuality = FALSE; - PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate = NULL; - PUCHAR pTable; - UCHAR TableSize = 0; - UCHAR InitTxRateIdx = 0, TrainUp, TrainDown; - TX_STA_CNT1_STRUC StaTx1; - TX_STA_CNT0_STRUC TxStaCnt0; - CHAR Rssi, ratio; - ULONG TxRetransmit = 0, TxSuccess = 0, TxFailCount = 0; - MAC_TABLE_ENTRY *pEntry; - ULONG i; + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) FunctionContext; + UCHAR UpRateIdx = 0, DownRateIdx = 0, CurrRateIdx = 0; + ULONG TxTotalCnt; + ULONG TxErrorRatio = 0; + BOOLEAN bTxRateChanged; //, bUpgradeQuality = FALSE; + PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate = NULL; + PUCHAR pTable; + UCHAR TableSize = 0; + UCHAR InitTxRateIdx = 0, TrainUp, TrainDown; + TX_STA_CNT1_STRUC StaTx1; + TX_STA_CNT0_STRUC TxStaCnt0; + CHAR Rssi, ratio; + ULONG TxRetransmit = 0, TxSuccess = 0, TxFailCount = 0; + MAC_TABLE_ENTRY *pEntry; + ULONG i; pAd->StaCfg.StaQuickResponeForRateUpTimerRunning = FALSE; - // - // walk through MAC table, see if need to change AP's TX rate toward each entry - // - for (i = 1; i < MAX_LEN_OF_MAC_TABLE; i++) - { + // + // walk through MAC table, see if need to change AP's TX rate toward each entry + // + for (i = 1; i < MAX_LEN_OF_MAC_TABLE; i++) { pEntry = &pAd->MacTab.Content[i]; // check if this entry need to switch rate automatically @@ -2387,51 +2395,48 @@ VOID StaQuickResponeForRateUpExec( if (INFRA_ON(pAd) && (i == 1)) Rssi = RTMPMaxRssi(pAd, - pAd->StaCfg.RssiSample.AvgRssi0, - pAd->StaCfg.RssiSample.AvgRssi1, - pAd->StaCfg.RssiSample.AvgRssi2); + pAd->StaCfg.RssiSample.AvgRssi0, + pAd->StaCfg.RssiSample.AvgRssi1, + pAd->StaCfg.RssiSample.AvgRssi2); else Rssi = RTMPMaxRssi(pAd, - pEntry->RssiSample.AvgRssi0, - pEntry->RssiSample.AvgRssi1, - pEntry->RssiSample.AvgRssi2); + pEntry->RssiSample.AvgRssi0, + pEntry->RssiSample.AvgRssi1, + pEntry->RssiSample.AvgRssi2); CurrRateIdx = pAd->CommonCfg.TxRateIndex; - MlmeSelectTxRateTable(pAd, pEntry, &pTable, &TableSize, &InitTxRateIdx); + MlmeSelectTxRateTable(pAd, pEntry, &pTable, &TableSize, + &InitTxRateIdx); // decide the next upgrade rate and downgrade rate, if any - if ((CurrRateIdx > 0) && (CurrRateIdx < (TableSize - 1))) - { + if ((CurrRateIdx > 0) && (CurrRateIdx < (TableSize - 1))) { UpRateIdx = CurrRateIdx + 1; - DownRateIdx = CurrRateIdx -1; - } - else if (CurrRateIdx == 0) - { + DownRateIdx = CurrRateIdx - 1; + } else if (CurrRateIdx == 0) { UpRateIdx = CurrRateIdx + 1; DownRateIdx = CurrRateIdx; - } - else if (CurrRateIdx == (TableSize - 1)) - { + } else if (CurrRateIdx == (TableSize - 1)) { UpRateIdx = CurrRateIdx; DownRateIdx = CurrRateIdx - 1; } - pCurrTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(CurrRateIdx+1)*5]; - - if ((Rssi > -65) && (pCurrTxRate->Mode >= MODE_HTMIX)) - { - TrainUp = (pCurrTxRate->TrainUp + (pCurrTxRate->TrainUp >> 1)); - TrainDown = (pCurrTxRate->TrainDown + (pCurrTxRate->TrainDown >> 1)); - } - else - { - TrainUp = pCurrTxRate->TrainUp; - TrainDown = pCurrTxRate->TrainDown; + pCurrTxRate = + (PRTMP_TX_RATE_SWITCH) & pTable[(CurrRateIdx + 1) * 5]; + + if ((Rssi > -65) && (pCurrTxRate->Mode >= MODE_HTMIX)) { + TrainUp = + (pCurrTxRate->TrainUp + + (pCurrTxRate->TrainUp >> 1)); + TrainDown = + (pCurrTxRate->TrainDown + + (pCurrTxRate->TrainDown >> 1)); + } else { + TrainUp = pCurrTxRate->TrainUp; + TrainDown = pCurrTxRate->TrainDown; } - if (pAd->MacTab.Size == 1) - { + if (pAd->MacTab.Size == 1) { // Update statistic counter RTMP_IO_READ32(pAd, TX_STA_CNT0, &TxStaCnt0.word); RTMP_IO_READ32(pAd, TX_STA_CNT1, &StaTx1.word); @@ -2441,52 +2446,64 @@ VOID StaQuickResponeForRateUpExec( TxFailCount = TxStaCnt0.field.TxFailCount; TxTotalCnt = TxRetransmit + TxSuccess + TxFailCount; - pAd->RalinkCounters.OneSecTxRetryOkCount += StaTx1.field.TxRetransmit; - pAd->RalinkCounters.OneSecTxNoRetryOkCount += StaTx1.field.TxSuccess; - pAd->RalinkCounters.OneSecTxFailCount += TxStaCnt0.field.TxFailCount; - pAd->WlanCounters.TransmittedFragmentCount.u.LowPart += StaTx1.field.TxSuccess; - pAd->WlanCounters.RetryCount.u.LowPart += StaTx1.field.TxRetransmit; - pAd->WlanCounters.FailedCount.u.LowPart += TxStaCnt0.field.TxFailCount; + pAd->RalinkCounters.OneSecTxRetryOkCount += + StaTx1.field.TxRetransmit; + pAd->RalinkCounters.OneSecTxNoRetryOkCount += + StaTx1.field.TxSuccess; + pAd->RalinkCounters.OneSecTxFailCount += + TxStaCnt0.field.TxFailCount; + pAd->WlanCounters.TransmittedFragmentCount.u.LowPart += + StaTx1.field.TxSuccess; + pAd->WlanCounters.RetryCount.u.LowPart += + StaTx1.field.TxRetransmit; + pAd->WlanCounters.FailedCount.u.LowPart += + TxStaCnt0.field.TxFailCount; if (TxTotalCnt) - TxErrorRatio = ((TxRetransmit + TxFailCount) * 100) / TxTotalCnt; - } - else - { + TxErrorRatio = + ((TxRetransmit + + TxFailCount) * 100) / TxTotalCnt; + } else { TxTotalCnt = pEntry->OneSecTxNoRetryOkCount + - pEntry->OneSecTxRetryOkCount + - pEntry->OneSecTxFailCount; + pEntry->OneSecTxRetryOkCount + + pEntry->OneSecTxFailCount; if (TxTotalCnt) - TxErrorRatio = ((pEntry->OneSecTxRetryOkCount + pEntry->OneSecTxFailCount) * 100) / TxTotalCnt; + TxErrorRatio = + ((pEntry->OneSecTxRetryOkCount + + pEntry->OneSecTxFailCount) * 100) / + TxTotalCnt; } - // // CASE 1. when TX samples are fewer than 15, then decide TX rate solely on RSSI // (criteria copied from RT2500 for Netopia case) // - if (TxTotalCnt <= 12) - { - NdisZeroMemory(pAd->DrsCounters.TxQuality, sizeof(USHORT) * MAX_STEP_OF_TX_RATE_SWITCH); - NdisZeroMemory(pAd->DrsCounters.PER, sizeof(UCHAR) * MAX_STEP_OF_TX_RATE_SWITCH); - - if ((pAd->DrsCounters.LastSecTxRateChangeAction == 1) && (CurrRateIdx != DownRateIdx)) - { + if (TxTotalCnt <= 12) { + NdisZeroMemory(pAd->DrsCounters.TxQuality, + sizeof(USHORT) * + MAX_STEP_OF_TX_RATE_SWITCH); + NdisZeroMemory(pAd->DrsCounters.PER, + sizeof(UCHAR) * + MAX_STEP_OF_TX_RATE_SWITCH); + + if ((pAd->DrsCounters.LastSecTxRateChangeAction == 1) + && (CurrRateIdx != DownRateIdx)) { pAd->CommonCfg.TxRateIndex = DownRateIdx; - pAd->DrsCounters.TxQuality[CurrRateIdx] = DRS_TX_QUALITY_WORST_BOUND; - } - else if ((pAd->DrsCounters.LastSecTxRateChangeAction == 2) && (CurrRateIdx != UpRateIdx)) - { + pAd->DrsCounters.TxQuality[CurrRateIdx] = + DRS_TX_QUALITY_WORST_BOUND; + } else + if ((pAd->DrsCounters.LastSecTxRateChangeAction == + 2) && (CurrRateIdx != UpRateIdx)) { pAd->CommonCfg.TxRateIndex = UpRateIdx; } - DBGPRINT_RAW(RT_DEBUG_TRACE,("QuickDRS: TxTotalCnt <= 15, train back to original rate \n")); + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("QuickDRS: TxTotalCnt <= 15, train back to original rate \n")); return; } - do - { + do { ULONG OneSecTxNoRetryOKRationCount; if (pAd->DrsCounters.LastTimeTxRateChangeAction == 0) @@ -2495,65 +2512,72 @@ VOID StaQuickResponeForRateUpExec( ratio = 4; // downgrade TX quality if PER >= Rate-Down threshold - if (TxErrorRatio >= TrainDown) - { - pAd->DrsCounters.TxQuality[CurrRateIdx] = DRS_TX_QUALITY_WORST_BOUND; + if (TxErrorRatio >= TrainDown) { + pAd->DrsCounters.TxQuality[CurrRateIdx] = + DRS_TX_QUALITY_WORST_BOUND; } - pAd->DrsCounters.PER[CurrRateIdx] = (UCHAR)TxErrorRatio; + pAd->DrsCounters.PER[CurrRateIdx] = + (UCHAR) TxErrorRatio; OneSecTxNoRetryOKRationCount = (TxSuccess * ratio); // perform DRS - consider TxRate Down first, then rate up. - if ((pAd->DrsCounters.LastSecTxRateChangeAction == 1) && (CurrRateIdx != DownRateIdx)) - { - if ((pAd->DrsCounters.LastTxOkCount + 2) >= OneSecTxNoRetryOKRationCount) - { - pAd->CommonCfg.TxRateIndex = DownRateIdx; - pAd->DrsCounters.TxQuality[CurrRateIdx] = DRS_TX_QUALITY_WORST_BOUND; + if ((pAd->DrsCounters.LastSecTxRateChangeAction == 1) + && (CurrRateIdx != DownRateIdx)) { + if ((pAd->DrsCounters.LastTxOkCount + 2) >= + OneSecTxNoRetryOKRationCount) { + pAd->CommonCfg.TxRateIndex = + DownRateIdx; + pAd->DrsCounters. + TxQuality[CurrRateIdx] = + DRS_TX_QUALITY_WORST_BOUND; } - } - else if ((pAd->DrsCounters.LastSecTxRateChangeAction == 2) && (CurrRateIdx != UpRateIdx)) - { - if ((TxErrorRatio >= 50) || (TxErrorRatio >= TrainDown)) - { + } else + if ((pAd->DrsCounters.LastSecTxRateChangeAction == + 2) && (CurrRateIdx != UpRateIdx)) { + if ((TxErrorRatio >= 50) + || (TxErrorRatio >= TrainDown)) { - } - else if ((pAd->DrsCounters.LastTxOkCount + 2) >= OneSecTxNoRetryOKRationCount) - { + } else if ((pAd->DrsCounters.LastTxOkCount + 2) + >= OneSecTxNoRetryOKRationCount) { pAd->CommonCfg.TxRateIndex = UpRateIdx; } } - }while (FALSE); + } while (FALSE); // if rate-up happen, clear all bad history of all TX rates - if (pAd->CommonCfg.TxRateIndex > CurrRateIdx) - { + if (pAd->CommonCfg.TxRateIndex > CurrRateIdx) { pAd->DrsCounters.TxRateUpPenalty = 0; - NdisZeroMemory(pAd->DrsCounters.TxQuality, sizeof(USHORT) * MAX_STEP_OF_TX_RATE_SWITCH); - NdisZeroMemory(pAd->DrsCounters.PER, sizeof(UCHAR) * MAX_STEP_OF_TX_RATE_SWITCH); + NdisZeroMemory(pAd->DrsCounters.TxQuality, + sizeof(USHORT) * + MAX_STEP_OF_TX_RATE_SWITCH); + NdisZeroMemory(pAd->DrsCounters.PER, + sizeof(UCHAR) * + MAX_STEP_OF_TX_RATE_SWITCH); bTxRateChanged = TRUE; } // if rate-down happen, only clear DownRate's bad history - else if (pAd->CommonCfg.TxRateIndex < CurrRateIdx) - { - DBGPRINT_RAW(RT_DEBUG_TRACE,("QuickDRS: --TX rate from %d to %d \n", CurrRateIdx, pAd->CommonCfg.TxRateIndex)); - - pAd->DrsCounters.TxRateUpPenalty = 0; // no penalty - pAd->DrsCounters.TxQuality[pAd->CommonCfg.TxRateIndex] = 0; + else if (pAd->CommonCfg.TxRateIndex < CurrRateIdx) { + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("QuickDRS: --TX rate from %d to %d \n", + CurrRateIdx, pAd->CommonCfg.TxRateIndex)); + + pAd->DrsCounters.TxRateUpPenalty = 0; // no penalty + pAd->DrsCounters.TxQuality[pAd->CommonCfg.TxRateIndex] = + 0; pAd->DrsCounters.PER[pAd->CommonCfg.TxRateIndex] = 0; bTxRateChanged = TRUE; - } - else - { + } else { bTxRateChanged = FALSE; } - pNextTxRate = (PRTMP_TX_RATE_SWITCH) &pTable[(pAd->CommonCfg.TxRateIndex+1)*5]; - if (bTxRateChanged && pNextTxRate) - { + pNextTxRate = + (PRTMP_TX_RATE_SWITCH) & + pTable[(pAd->CommonCfg.TxRateIndex + 1) * 5]; + if (bTxRateChanged && pNextTxRate) { MlmeSetTxRate(pAd, pEntry, pNextTxRate); } } @@ -2578,11 +2602,9 @@ VOID StaQuickResponeForRateUpExec( ========================================================================== */ -VOID MlmeCheckPsmChange( - IN PRTMP_ADAPTER pAd, - IN ULONG Now32) +VOID MlmeCheckPsmChange(IN PRTMP_ADAPTER pAd, IN ULONG Now32) { - ULONG PowerMode; + ULONG PowerMode; // condition - // 1. Psm maybe ON only happen in INFRASTRUCTURE mode @@ -2590,43 +2612,40 @@ VOID MlmeCheckPsmChange( // 3. but current psm is not in PWR_SAVE // 4. CNTL state machine is not doing SCANning // 5. no TX SUCCESS event for the past 1-sec period - PowerMode = pAd->StaCfg.WindowsPowerMode; + PowerMode = pAd->StaCfg.WindowsPowerMode; if (INFRA_ON(pAd) && - (PowerMode != Ndis802_11PowerModeCAM) && - (pAd->StaCfg.Psm == PWR_ACTIVE) && -// (! RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE)&& - RTMP_TEST_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP) - /*&& - (pAd->RalinkCounters.OneSecTxNoRetryOkCount == 0) && - (pAd->RalinkCounters.OneSecTxRetryOkCount == 0)*/) - { - NdisGetSystemUpTime(&pAd->Mlme.LastSendNULLpsmTime); - pAd->RalinkCounters.RxCountSinceLastNULL = 0; + (PowerMode != Ndis802_11PowerModeCAM) && + (pAd->StaCfg.Psm == PWR_ACTIVE) && +// (! RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) + (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) && + RTMP_TEST_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP) + /*&& + (pAd->RalinkCounters.OneSecTxNoRetryOkCount == 0) && + (pAd->RalinkCounters.OneSecTxRetryOkCount == 0) */ + ) { + NdisGetSystemUpTime(&pAd->Mlme.LastSendNULLpsmTime); + pAd->RalinkCounters.RxCountSinceLastNULL = 0; RTMP_SET_PSM_BIT(pAd, PWR_SAVE); - if (!(pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable)) - { - RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, FALSE); - } - else - { - RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, TRUE); - } + if (! + (pAd->CommonCfg.bAPSDCapable + && pAd->CommonCfg.APEdcaParm.bAPSDCapable)) { + RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, FALSE); + } else { + RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, TRUE); } + } } // IRQL = PASSIVE_LEVEL // IRQL = DISPATCH_LEVEL -VOID MlmeSetPsmBit( - IN PRTMP_ADAPTER pAd, - IN USHORT psm) +VOID MlmeSetPsmBit(IN PRTMP_ADAPTER pAd, IN USHORT psm) { AUTO_RSP_CFG_STRUC csr4; pAd->StaCfg.Psm = psm; RTMP_IO_READ32(pAd, AUTO_RSP_CFG, &csr4.word); - csr4.field.AckCtsPsmBit = (psm == PWR_SAVE)? 1:0; + csr4.field.AckCtsPsmBit = (psm == PWR_SAVE) ? 1 : 0; RTMP_IO_WRITE32(pAd, AUTO_RSP_CFG, csr4.word); DBGPRINT(RT_DEBUG_TRACE, ("MlmeSetPsmBit = %d\n", psm)); @@ -2651,29 +2670,26 @@ VOID MlmeSetPsmBit( channel quality based on the most up-to-date information ========================================================================== */ -VOID MlmeCalculateChannelQuality( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pMacEntry, - IN ULONG Now32) +VOID MlmeCalculateChannelQuality(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pMacEntry, IN ULONG Now32) { ULONG TxOkCnt, TxCnt, TxPER, TxPRR; ULONG RxCnt, RxPER; UCHAR NorRssi; - CHAR MaxRssi; + CHAR MaxRssi; RSSI_SAMPLE *pRssiSample = NULL; UINT32 OneSecTxNoRetryOkCount = 0; UINT32 OneSecTxRetryOkCount = 0; UINT32 OneSecTxFailCount = 0; UINT32 OneSecRxOkCnt = 0; UINT32 OneSecRxFcsErrCnt = 0; - ULONG ChannelQuality = 0; // 0..100, Channel Quality Indication for Roaming + ULONG ChannelQuality = 0; // 0..100, Channel Quality Indication for Roaming ULONG BeaconLostTime = pAd->StaCfg.BeaconLostTime; - - if (pAd->OpMode == OPMODE_STA) - { + if (pAd->OpMode == OPMODE_STA) { pRssiSample = &pAd->StaCfg.RssiSample; - OneSecTxNoRetryOkCount = pAd->RalinkCounters.OneSecTxNoRetryOkCount; + OneSecTxNoRetryOkCount = + pAd->RalinkCounters.OneSecTxNoRetryOkCount; OneSecTxRetryOkCount = pAd->RalinkCounters.OneSecTxRetryOkCount; OneSecTxFailCount = pAd->RalinkCounters.OneSecTxFailCount; OneSecRxOkCnt = pAd->RalinkCounters.OneSecRxOkCnt; @@ -2681,21 +2697,17 @@ VOID MlmeCalculateChannelQuality( } MaxRssi = RTMPMaxRssi(pAd, pRssiSample->LastRssi0, - pRssiSample->LastRssi1, - pRssiSample->LastRssi2); + pRssiSample->LastRssi1, pRssiSample->LastRssi2); // // calculate TX packet error ratio and TX retry ratio - if too few TX samples, skip TX related statistics // TxOkCnt = OneSecTxNoRetryOkCount + OneSecTxRetryOkCount; TxCnt = TxOkCnt + OneSecTxFailCount; - if (TxCnt < 5) - { + if (TxCnt < 5) { TxPER = 0; TxPRR = 0; - } - else - { + } else { TxPER = (OneSecTxFailCount * 100) / TxCnt; TxPRR = ((TxCnt - OneSecTxNoRetryOkCount) * 100) / TxCnt; } @@ -2712,16 +2724,13 @@ VOID MlmeCalculateChannelQuality( // // decide ChannelQuality based on: 1)last BEACON received time, 2)last RSSI, 3)TxPER, and 4)RxPER // - if ((pAd->OpMode == OPMODE_STA) && - INFRA_ON(pAd) && - (OneSecTxNoRetryOkCount < 2) && // no heavy traffic - ((pAd->StaCfg.LastBeaconRxTime + BeaconLostTime) < Now32)) - { - DBGPRINT(RT_DEBUG_TRACE, ("BEACON lost > %ld msec with TxOkCnt=%ld -> CQI=0\n", BeaconLostTime, TxOkCnt)); + if ((pAd->OpMode == OPMODE_STA) && INFRA_ON(pAd) && (OneSecTxNoRetryOkCount < 2) && // no heavy traffic + ((pAd->StaCfg.LastBeaconRxTime + BeaconLostTime) < Now32)) { + DBGPRINT(RT_DEBUG_TRACE, + ("BEACON lost > %ld msec with TxOkCnt=%ld -> CQI=0\n", + BeaconLostTime, TxOkCnt)); ChannelQuality = 0; - } - else - { + } else { // Normalize Rssi if (MaxRssi > -40) NorRssi = 100; @@ -2730,24 +2739,20 @@ VOID MlmeCalculateChannelQuality( else NorRssi = (MaxRssi + 90) * 2; - // ChannelQuality = W1*RSSI + W2*TxPRR + W3*RxPER (RSSI 0..100), (TxPER 100..0), (RxPER 100..0) + // ChannelQuality = W1*RSSI + W2*TxPRR + W3*RxPER (RSSI 0..100), (TxPER 100..0), (RxPER 100..0) ChannelQuality = (RSSI_WEIGHTING * NorRssi + - TX_WEIGHTING * (100 - TxPRR) + - RX_WEIGHTING* (100 - RxPER)) / 100; + TX_WEIGHTING * (100 - TxPRR) + + RX_WEIGHTING * (100 - RxPER)) / 100; } - if (pAd->OpMode == OPMODE_STA) - pAd->Mlme.ChannelQuality = (ChannelQuality > 100) ? 100 : ChannelQuality; - + pAd->Mlme.ChannelQuality = + (ChannelQuality > 100) ? 100 : ChannelQuality; } - // IRQL = DISPATCH_LEVEL -VOID MlmeSetTxPreamble( - IN PRTMP_ADAPTER pAd, - IN USHORT TxPreamble) +VOID MlmeSetTxPreamble(IN PRTMP_ADAPTER pAd, IN USHORT TxPreamble) { AUTO_RSP_CFG_STRUC csr4; @@ -2758,16 +2763,15 @@ VOID MlmeSetTxPreamble( //TxPreamble = Rt802_11PreambleLong; RTMP_IO_READ32(pAd, AUTO_RSP_CFG, &csr4.word); - if (TxPreamble == Rt802_11PreambleLong) - { - DBGPRINT(RT_DEBUG_TRACE, ("MlmeSetTxPreamble (= LONG PREAMBLE)\n")); + if (TxPreamble == Rt802_11PreambleLong) { + DBGPRINT(RT_DEBUG_TRACE, + ("MlmeSetTxPreamble (= LONG PREAMBLE)\n")); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); csr4.field.AutoResponderPreamble = 0; - } - else - { + } else { // NOTE: 1Mbps should always use long preamble - DBGPRINT(RT_DEBUG_TRACE, ("MlmeSetTxPreamble (= SHORT PREAMBLE)\n")); + DBGPRINT(RT_DEBUG_TRACE, + ("MlmeSetTxPreamble (= SHORT PREAMBLE)\n")); OPSTATUS_SET_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); csr4.field.AutoResponderPreamble = 1; } @@ -2782,64 +2786,53 @@ VOID MlmeSetTxPreamble( ========================================================================== */ -VOID UpdateBasicRateBitmap( - IN PRTMP_ADAPTER pAdapter) +VOID UpdateBasicRateBitmap(IN PRTMP_ADAPTER pAdapter) { - INT i, j; - /* 1 2 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 */ - UCHAR rate[] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 }; - UCHAR *sup_p = pAdapter->CommonCfg.SupRate; - UCHAR *ext_p = pAdapter->CommonCfg.ExtRate; - ULONG bitmap = pAdapter->CommonCfg.BasicRateBitmap; - - - /* if A mode, always use fix BasicRateBitMap */ - //if (pAdapter->CommonCfg.Channel == PHY_11A) + INT i, j; + /* 1 2 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 */ + UCHAR rate[] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 }; + UCHAR *sup_p = pAdapter->CommonCfg.SupRate; + UCHAR *ext_p = pAdapter->CommonCfg.ExtRate; + ULONG bitmap = pAdapter->CommonCfg.BasicRateBitmap; + + /* if A mode, always use fix BasicRateBitMap */ + //if (pAdapter->CommonCfg.Channel == PHY_11A) if (pAdapter->CommonCfg.Channel > 14) - pAdapter->CommonCfg.BasicRateBitmap = 0x150; /* 6, 12, 24M */ - /* End of if */ - - if (pAdapter->CommonCfg.BasicRateBitmap > 4095) - { - /* (2 ^ MAX_LEN_OF_SUPPORTED_RATES) -1 */ - return; - } /* End of if */ - - for(i=0; iCommonCfg.BasicRateBitmap = 0x150; /* 6, 12, 24M */ + /* End of if */ + + if (pAdapter->CommonCfg.BasicRateBitmap > 4095) { + /* (2 ^ MAX_LEN_OF_SUPPORTED_RATES) -1 */ + return; + } + /* End of if */ + for (i = 0; i < MAX_LEN_OF_SUPPORTED_RATES; i++) { + sup_p[i] &= 0x7f; + ext_p[i] &= 0x7f; + } /* End of for */ + + for (i = 0; i < MAX_LEN_OF_SUPPORTED_RATES; i++) { + if (bitmap & (1 << i)) { + for (j = 0; j < MAX_LEN_OF_SUPPORTED_RATES; j++) { + if (sup_p[j] == rate[i]) + sup_p[j] |= 0x80; + /* End of if */ + } /* End of for */ + + for (j = 0; j < MAX_LEN_OF_SUPPORTED_RATES; j++) { + if (ext_p[j] == rate[i]) + ext_p[j] |= 0x80; + /* End of if */ + } /* End of for */ + } /* End of if */ + } /* End of for */ +} /* End of UpdateBasicRateBitmap */ // IRQL = PASSIVE_LEVEL // IRQL = DISPATCH_LEVEL // bLinkUp is to identify the inital link speed. // TRUE indicates the rate update at linkup, we should not try to set the rate at 54Mbps. -VOID MlmeUpdateTxRates( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bLinkUp, - IN UCHAR apidx) +VOID MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, IN UCHAR apidx) { int i, num; UCHAR Rate = RATE_6, MaxDesire = RATE_1, MaxSupport = RATE_1; @@ -2847,52 +2840,86 @@ VOID MlmeUpdateTxRates( ULONG BasicRateBitmap = 0; UCHAR CurrBasicRate = RATE_1; UCHAR *pSupRate, SupRateLen, *pExtRate, ExtRateLen; - PHTTRANSMIT_SETTING pHtPhy = NULL; - PHTTRANSMIT_SETTING pMaxHtPhy = NULL; - PHTTRANSMIT_SETTING pMinHtPhy = NULL; - BOOLEAN *auto_rate_cur_p; - UCHAR HtMcs = MCS_AUTO; + PHTTRANSMIT_SETTING pHtPhy = NULL; + PHTTRANSMIT_SETTING pMaxHtPhy = NULL; + PHTTRANSMIT_SETTING pMinHtPhy = NULL; + BOOLEAN *auto_rate_cur_p; + UCHAR HtMcs = MCS_AUTO; // find max desired rate UpdateBasicRateBitmap(pAd); num = 0; auto_rate_cur_p = NULL; - for (i=0; iCommonCfg.DesireRate[i] & 0x7f) - { - case 2: Rate = RATE_1; num++; break; - case 4: Rate = RATE_2; num++; break; - case 11: Rate = RATE_5_5; num++; break; - case 22: Rate = RATE_11; num++; break; - case 12: Rate = RATE_6; num++; break; - case 18: Rate = RATE_9; num++; break; - case 24: Rate = RATE_12; num++; break; - case 36: Rate = RATE_18; num++; break; - case 48: Rate = RATE_24; num++; break; - case 72: Rate = RATE_36; num++; break; - case 96: Rate = RATE_48; num++; break; - case 108: Rate = RATE_54; num++; break; + for (i = 0; i < MAX_LEN_OF_SUPPORTED_RATES; i++) { + switch (pAd->CommonCfg.DesireRate[i] & 0x7f) { + case 2: + Rate = RATE_1; + num++; + break; + case 4: + Rate = RATE_2; + num++; + break; + case 11: + Rate = RATE_5_5; + num++; + break; + case 22: + Rate = RATE_11; + num++; + break; + case 12: + Rate = RATE_6; + num++; + break; + case 18: + Rate = RATE_9; + num++; + break; + case 24: + Rate = RATE_12; + num++; + break; + case 36: + Rate = RATE_18; + num++; + break; + case 48: + Rate = RATE_24; + num++; + break; + case 72: + Rate = RATE_36; + num++; + break; + case 96: + Rate = RATE_48; + num++; + break; + case 108: + Rate = RATE_54; + num++; + break; //default: Rate = RATE_1; break; } - if (MaxDesire < Rate) MaxDesire = Rate; + if (MaxDesire < Rate) + MaxDesire = Rate; } //=========================================================================== //=========================================================================== { - pHtPhy = &pAd->StaCfg.HTPhyMode; - pMaxHtPhy = &pAd->StaCfg.MaxHTPhyMode; - pMinHtPhy = &pAd->StaCfg.MinHTPhyMode; + pHtPhy = &pAd->StaCfg.HTPhyMode; + pMaxHtPhy = &pAd->StaCfg.MaxHTPhyMode; + pMinHtPhy = &pAd->StaCfg.MinHTPhyMode; auto_rate_cur_p = &pAd->StaCfg.bAutoTxRateSwitch; - HtMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS; + HtMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS; if ((pAd->StaCfg.BssType == BSS_ADHOC) && - (pAd->CommonCfg.PhyMode == PHY_11B) && - (MaxDesire > RATE_11)) - { + (pAd->CommonCfg.PhyMode == PHY_11B) && + (MaxDesire > RATE_11)) { MaxDesire = RATE_11; } } @@ -2904,41 +2931,32 @@ VOID MlmeUpdateTxRates( // Auto rate switching is enabled only if more than one DESIRED RATES are // specified; otherwise disabled - if (num <= 1) - { + if (num <= 1) { //OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); - //pAd->CommonCfg.bAutoTxRateSwitch = FALSE; + //pAd->CommonCfg.bAutoTxRateSwitch = FALSE; *auto_rate_cur_p = FALSE; - } - else - { + } else { //OPSTATUS_SET_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); - //pAd->CommonCfg.bAutoTxRateSwitch = TRUE; + //pAd->CommonCfg.bAutoTxRateSwitch = TRUE; *auto_rate_cur_p = TRUE; } - if (HtMcs != MCS_AUTO) - { + if (HtMcs != MCS_AUTO) { //OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); - //pAd->CommonCfg.bAutoTxRateSwitch = FALSE; + //pAd->CommonCfg.bAutoTxRateSwitch = FALSE; *auto_rate_cur_p = FALSE; - } - else - { + } else { //OPSTATUS_SET_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); - //pAd->CommonCfg.bAutoTxRateSwitch = TRUE; + //pAd->CommonCfg.bAutoTxRateSwitch = TRUE; *auto_rate_cur_p = TRUE; } - if ((ADHOC_ON(pAd) || INFRA_ON(pAd)) && (pAd->OpMode == OPMODE_STA)) - { + if ((ADHOC_ON(pAd) || INFRA_ON(pAd)) && (pAd->OpMode == OPMODE_STA)) { pSupRate = &pAd->StaActive.SupRate[0]; pExtRate = &pAd->StaActive.ExtRate[0]; SupRateLen = pAd->StaActive.SupRateLen; ExtRateLen = pAd->StaActive.ExtRateLen; - } - else - { + } else { pSupRate = &pAd->CommonCfg.SupRate[0]; pExtRate = &pAd->CommonCfg.ExtRate[0]; SupRateLen = pAd->CommonCfg.SupRateLen; @@ -2946,67 +2964,162 @@ VOID MlmeUpdateTxRates( } // find max supported rate - for (i=0; i Rate) MinSupport = Rate; - } - - for (i=0; i Rate) MinSupport = Rate; - } - - RTMP_IO_WRITE32(pAd, LEGACY_BASIC_RATE, BasicRateBitmap); + for (i = 0; i < SupRateLen; i++) { + switch (pSupRate[i] & 0x7f) { + case 2: + Rate = RATE_1; + if (pSupRate[i] & 0x80) + BasicRateBitmap |= 0x0001; + break; + case 4: + Rate = RATE_2; + if (pSupRate[i] & 0x80) + BasicRateBitmap |= 0x0002; + break; + case 11: + Rate = RATE_5_5; + if (pSupRate[i] & 0x80) + BasicRateBitmap |= 0x0004; + break; + case 22: + Rate = RATE_11; + if (pSupRate[i] & 0x80) + BasicRateBitmap |= 0x0008; + break; + case 12: + Rate = RATE_6; /*if (pSupRate[i] & 0x80) */ + BasicRateBitmap |= 0x0010; + break; + case 18: + Rate = RATE_9; + if (pSupRate[i] & 0x80) + BasicRateBitmap |= 0x0020; + break; + case 24: + Rate = RATE_12; /*if (pSupRate[i] & 0x80) */ + BasicRateBitmap |= 0x0040; + break; + case 36: + Rate = RATE_18; + if (pSupRate[i] & 0x80) + BasicRateBitmap |= 0x0080; + break; + case 48: + Rate = RATE_24; /*if (pSupRate[i] & 0x80) */ + BasicRateBitmap |= 0x0100; + break; + case 72: + Rate = RATE_36; + if (pSupRate[i] & 0x80) + BasicRateBitmap |= 0x0200; + break; + case 96: + Rate = RATE_48; + if (pSupRate[i] & 0x80) + BasicRateBitmap |= 0x0400; + break; + case 108: + Rate = RATE_54; + if (pSupRate[i] & 0x80) + BasicRateBitmap |= 0x0800; + break; + default: + Rate = RATE_1; + break; + } + if (MaxSupport < Rate) + MaxSupport = Rate; + + if (MinSupport > Rate) + MinSupport = Rate; + } + + for (i = 0; i < ExtRateLen; i++) { + switch (pExtRate[i] & 0x7f) { + case 2: + Rate = RATE_1; + if (pExtRate[i] & 0x80) + BasicRateBitmap |= 0x0001; + break; + case 4: + Rate = RATE_2; + if (pExtRate[i] & 0x80) + BasicRateBitmap |= 0x0002; + break; + case 11: + Rate = RATE_5_5; + if (pExtRate[i] & 0x80) + BasicRateBitmap |= 0x0004; + break; + case 22: + Rate = RATE_11; + if (pExtRate[i] & 0x80) + BasicRateBitmap |= 0x0008; + break; + case 12: + Rate = RATE_6; /*if (pExtRate[i] & 0x80) */ + BasicRateBitmap |= 0x0010; + break; + case 18: + Rate = RATE_9; + if (pExtRate[i] & 0x80) + BasicRateBitmap |= 0x0020; + break; + case 24: + Rate = RATE_12; /*if (pExtRate[i] & 0x80) */ + BasicRateBitmap |= 0x0040; + break; + case 36: + Rate = RATE_18; + if (pExtRate[i] & 0x80) + BasicRateBitmap |= 0x0080; + break; + case 48: + Rate = RATE_24; /*if (pExtRate[i] & 0x80) */ + BasicRateBitmap |= 0x0100; + break; + case 72: + Rate = RATE_36; + if (pExtRate[i] & 0x80) + BasicRateBitmap |= 0x0200; + break; + case 96: + Rate = RATE_48; + if (pExtRate[i] & 0x80) + BasicRateBitmap |= 0x0400; + break; + case 108: + Rate = RATE_54; + if (pExtRate[i] & 0x80) + BasicRateBitmap |= 0x0800; + break; + default: + Rate = RATE_1; + break; + } + if (MaxSupport < Rate) + MaxSupport = Rate; + + if (MinSupport > Rate) + MinSupport = Rate; + } + + RTMP_IO_WRITE32(pAd, LEGACY_BASIC_RATE, BasicRateBitmap); // bug fix // pAd->CommonCfg.BasicRateBitmap = BasicRateBitmap; // calculate the exptected ACK rate for each TX rate. This info is used to caculate // the DURATION field of outgoing uniicast DATA/MGMT frame - for (i=0; iCommonCfg.ExpectedACKRate[i] = CurrBasicRate; } - DBGPRINT(RT_DEBUG_TRACE,("MlmeUpdateTxRates[MaxSupport = %d] = MaxDesire %d Mbps\n", RateIdToMbps[MaxSupport], RateIdToMbps[MaxDesire])); + DBGPRINT(RT_DEBUG_TRACE, + ("MlmeUpdateTxRates[MaxSupport = %d] = MaxDesire %d Mbps\n", + RateIdToMbps[MaxSupport], RateIdToMbps[MaxDesire])); // max tx rate = min {max desire rate, max supported rate} if (MaxSupport < MaxDesire) pAd->CommonCfg.MaxTxRate = MaxSupport; @@ -3017,13 +3130,12 @@ VOID MlmeUpdateTxRates( // 2003-07-31 john - 2500 doesn't have good sensitivity at high OFDM rates. to increase the success // ratio of initial DHCP packet exchange, TX rate starts from a lower rate depending // on average RSSI - // 1. RSSI >= -70db, start at 54 Mbps (short distance) - // 2. -70 > RSSI >= -75, start at 24 Mbps (mid distance) - // 3. -75 > RSSI, start at 11 Mbps (long distance) + // 1. RSSI >= -70db, start at 54 Mbps (short distance) + // 2. -70 > RSSI >= -75, start at 24 Mbps (mid distance) + // 3. -75 > RSSI, start at 11 Mbps (long distance) //if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)/* && - // OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)*/) - if (*auto_rate_cur_p) - { + // OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)*/) + if (*auto_rate_cur_p) { short dbm = 0; dbm = pAd->StaCfg.RssiSample.AvgRssi0 - pAd->BbpRssiToDbmDelta; @@ -3043,113 +3155,132 @@ VOID MlmeUpdateTxRates( pAd->CommonCfg.TxRate = pAd->CommonCfg.MaxTxRate; pAd->CommonCfg.TxRateIndex = 0; - } - else - { + } else { pAd->CommonCfg.TxRate = pAd->CommonCfg.MaxTxRate; - pHtPhy->field.MCS = (pAd->CommonCfg.MaxTxRate > 3) ? (pAd->CommonCfg.MaxTxRate - 4) : pAd->CommonCfg.MaxTxRate; - pHtPhy->field.MODE = (pAd->CommonCfg.MaxTxRate > 3) ? MODE_OFDM : MODE_CCK; - - pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.STBC = pHtPhy->field.STBC; - pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.ShortGI = pHtPhy->field.ShortGI; - pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MCS = pHtPhy->field.MCS; - pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE = pHtPhy->field.MODE; - } - - if (pAd->CommonCfg.TxRate <= RATE_11) - { + pHtPhy->field.MCS = + (pAd->CommonCfg.MaxTxRate > + 3) ? (pAd->CommonCfg.MaxTxRate - + 4) : pAd->CommonCfg.MaxTxRate; + pHtPhy->field.MODE = + (pAd->CommonCfg.MaxTxRate > 3) ? MODE_OFDM : MODE_CCK; + + pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.STBC = + pHtPhy->field.STBC; + pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.ShortGI = + pHtPhy->field.ShortGI; + pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MCS = + pHtPhy->field.MCS; + pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE = + pHtPhy->field.MODE; + } + + if (pAd->CommonCfg.TxRate <= RATE_11) { pMaxHtPhy->field.MODE = MODE_CCK; pMaxHtPhy->field.MCS = pAd->CommonCfg.TxRate; pMinHtPhy->field.MCS = pAd->CommonCfg.MinTxRate; - } - else - { + } else { pMaxHtPhy->field.MODE = MODE_OFDM; pMaxHtPhy->field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.TxRate]; - if (pAd->CommonCfg.MinTxRate >= RATE_6 && (pAd->CommonCfg.MinTxRate <= RATE_54)) - {pMinHtPhy->field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MinTxRate];} - else - {pMinHtPhy->field.MCS = pAd->CommonCfg.MinTxRate;} + if (pAd->CommonCfg.MinTxRate >= RATE_6 + && (pAd->CommonCfg.MinTxRate <= RATE_54)) { + pMinHtPhy->field.MCS = + OfdmRateToRxwiMCS[pAd->CommonCfg.MinTxRate]; + } else { + pMinHtPhy->field.MCS = pAd->CommonCfg.MinTxRate; + } } pHtPhy->word = (pMaxHtPhy->word); - if (bLinkUp && (pAd->OpMode == OPMODE_STA)) - { - pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word = pHtPhy->word; - pAd->MacTab.Content[BSSID_WCID].MaxHTPhyMode.word = pMaxHtPhy->word; - pAd->MacTab.Content[BSSID_WCID].MinHTPhyMode.word = pMinHtPhy->word; - } - else - { - switch (pAd->CommonCfg.PhyMode) - { - case PHY_11BG_MIXED: - case PHY_11B: - case PHY_11BGN_MIXED: - pAd->CommonCfg.MlmeRate = RATE_1; - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_CCK; - pAd->CommonCfg.MlmeTransmit.field.MCS = RATE_1; + if (bLinkUp && (pAd->OpMode == OPMODE_STA)) { + pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word = pHtPhy->word; + pAd->MacTab.Content[BSSID_WCID].MaxHTPhyMode.word = + pMaxHtPhy->word; + pAd->MacTab.Content[BSSID_WCID].MinHTPhyMode.word = + pMinHtPhy->word; + } else { + switch (pAd->CommonCfg.PhyMode) { + case PHY_11BG_MIXED: + case PHY_11B: + case PHY_11BGN_MIXED: + pAd->CommonCfg.MlmeRate = RATE_1; + pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_CCK; + pAd->CommonCfg.MlmeTransmit.field.MCS = RATE_1; -//#ifdef WIFI_TEST - pAd->CommonCfg.RtsRate = RATE_11; +//#ifdef WIFI_TEST + pAd->CommonCfg.RtsRate = RATE_11; //#else -// pAd->CommonCfg.RtsRate = RATE_1; +// pAd->CommonCfg.RtsRate = RATE_1; //#endif - break; - case PHY_11G: - case PHY_11A: - case PHY_11AGN_MIXED: - case PHY_11GN_MIXED: - case PHY_11N_2_4G: - case PHY_11AN_MIXED: - case PHY_11N_5G: + break; + case PHY_11G: + case PHY_11A: + case PHY_11AGN_MIXED: + case PHY_11GN_MIXED: + case PHY_11N_2_4G: + case PHY_11AN_MIXED: + case PHY_11N_5G: + pAd->CommonCfg.MlmeRate = RATE_6; + pAd->CommonCfg.RtsRate = RATE_6; + pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; + pAd->CommonCfg.MlmeTransmit.field.MCS = + OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; + break; + case PHY_11ABG_MIXED: + case PHY_11ABGN_MIXED: + if (pAd->CommonCfg.Channel <= 14) { + pAd->CommonCfg.MlmeRate = RATE_1; + pAd->CommonCfg.RtsRate = RATE_1; + pAd->CommonCfg.MlmeTransmit.field.MODE = + MODE_CCK; + pAd->CommonCfg.MlmeTransmit.field.MCS = RATE_1; + } else { pAd->CommonCfg.MlmeRate = RATE_6; pAd->CommonCfg.RtsRate = RATE_6; - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; - pAd->CommonCfg.MlmeTransmit.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; - break; - case PHY_11ABG_MIXED: - case PHY_11ABGN_MIXED: - if (pAd->CommonCfg.Channel <= 14) - { - pAd->CommonCfg.MlmeRate = RATE_1; - pAd->CommonCfg.RtsRate = RATE_1; - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_CCK; - pAd->CommonCfg.MlmeTransmit.field.MCS = RATE_1; - } - else - { - pAd->CommonCfg.MlmeRate = RATE_6; - pAd->CommonCfg.RtsRate = RATE_6; - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; - pAd->CommonCfg.MlmeTransmit.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; - } - break; - default: // error - pAd->CommonCfg.MlmeRate = RATE_6; - pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; - pAd->CommonCfg.MlmeTransmit.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; - pAd->CommonCfg.RtsRate = RATE_1; - break; + pAd->CommonCfg.MlmeTransmit.field.MODE = + MODE_OFDM; + pAd->CommonCfg.MlmeTransmit.field.MCS = + OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; + } + break; + default: // error + pAd->CommonCfg.MlmeRate = RATE_6; + pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; + pAd->CommonCfg.MlmeTransmit.field.MCS = + OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; + pAd->CommonCfg.RtsRate = RATE_1; + break; } // // Keep Basic Mlme Rate. // - pAd->MacTab.Content[MCAST_WCID].HTPhyMode.word = pAd->CommonCfg.MlmeTransmit.word; + pAd->MacTab.Content[MCAST_WCID].HTPhyMode.word = + pAd->CommonCfg.MlmeTransmit.word; if (pAd->CommonCfg.MlmeTransmit.field.MODE == MODE_OFDM) - pAd->MacTab.Content[MCAST_WCID].HTPhyMode.field.MCS = OfdmRateToRxwiMCS[RATE_24]; + pAd->MacTab.Content[MCAST_WCID].HTPhyMode.field.MCS = + OfdmRateToRxwiMCS[RATE_24]; else - pAd->MacTab.Content[MCAST_WCID].HTPhyMode.field.MCS = RATE_1; + pAd->MacTab.Content[MCAST_WCID].HTPhyMode.field.MCS = + RATE_1; pAd->CommonCfg.BasicMlmeRate = pAd->CommonCfg.MlmeRate; } - DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateTxRates (MaxDesire=%d, MaxSupport=%d, MaxTxRate=%d, MinRate=%d, Rate Switching =%d)\n", - RateIdToMbps[MaxDesire], RateIdToMbps[MaxSupport], RateIdToMbps[pAd->CommonCfg.MaxTxRate], RateIdToMbps[pAd->CommonCfg.MinTxRate], - /*OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)*/*auto_rate_cur_p)); - DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateTxRates (TxRate=%d, RtsRate=%d, BasicRateBitmap=0x%04lx)\n", - RateIdToMbps[pAd->CommonCfg.TxRate], RateIdToMbps[pAd->CommonCfg.RtsRate], BasicRateBitmap)); - DBGPRINT(RT_DEBUG_TRACE, ("MlmeUpdateTxRates (MlmeTransmit=0x%x, MinHTPhyMode=%x, MaxHTPhyMode=0x%x, HTPhyMode=0x%x)\n", - pAd->CommonCfg.MlmeTransmit.word, pAd->MacTab.Content[BSSID_WCID].MinHTPhyMode.word ,pAd->MacTab.Content[BSSID_WCID].MaxHTPhyMode.word ,pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word )); + DBGPRINT(RT_DEBUG_TRACE, + (" MlmeUpdateTxRates (MaxDesire=%d, MaxSupport=%d, MaxTxRate=%d, MinRate=%d, Rate Switching =%d)\n", + RateIdToMbps[MaxDesire], RateIdToMbps[MaxSupport], + RateIdToMbps[pAd->CommonCfg.MaxTxRate], + RateIdToMbps[pAd->CommonCfg.MinTxRate], + /*OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED) */ + *auto_rate_cur_p)); + DBGPRINT(RT_DEBUG_TRACE, + (" MlmeUpdateTxRates (TxRate=%d, RtsRate=%d, BasicRateBitmap=0x%04lx)\n", + RateIdToMbps[pAd->CommonCfg.TxRate], + RateIdToMbps[pAd->CommonCfg.RtsRate], BasicRateBitmap)); + DBGPRINT(RT_DEBUG_TRACE, + ("MlmeUpdateTxRates (MlmeTransmit=0x%x, MinHTPhyMode=%x, MaxHTPhyMode=0x%x, HTPhyMode=0x%x)\n", + pAd->CommonCfg.MlmeTransmit.word, + pAd->MacTab.Content[BSSID_WCID].MinHTPhyMode.word, + pAd->MacTab.Content[BSSID_WCID].MaxHTPhyMode.word, + pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word)); } /* @@ -3164,59 +3295,60 @@ VOID MlmeUpdateTxRates( ========================================================================== */ -VOID MlmeUpdateHtTxRates( - IN PRTMP_ADAPTER pAd, - IN UCHAR apidx) +VOID MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) { - UCHAR StbcMcs; //j, StbcMcs, bitmask; - CHAR i; // 3*3 - RT_HT_CAPABILITY *pRtHtCap = NULL; - RT_HT_PHY_INFO *pActiveHtPhy = NULL; - ULONG BasicMCS; + UCHAR StbcMcs; //j, StbcMcs, bitmask; + CHAR i; // 3*3 + RT_HT_CAPABILITY *pRtHtCap = NULL; + RT_HT_PHY_INFO *pActiveHtPhy = NULL; + ULONG BasicMCS; UCHAR j, bitmask; - PRT_HT_PHY_INFO pDesireHtPhy = NULL; - PHTTRANSMIT_SETTING pHtPhy = NULL; - PHTTRANSMIT_SETTING pMaxHtPhy = NULL; - PHTTRANSMIT_SETTING pMinHtPhy = NULL; - BOOLEAN *auto_rate_cur_p; + PRT_HT_PHY_INFO pDesireHtPhy = NULL; + PHTTRANSMIT_SETTING pHtPhy = NULL; + PHTTRANSMIT_SETTING pMaxHtPhy = NULL; + PHTTRANSMIT_SETTING pMinHtPhy = NULL; + BOOLEAN *auto_rate_cur_p; - DBGPRINT(RT_DEBUG_TRACE,("MlmeUpdateHtTxRates===> \n")); + DBGPRINT(RT_DEBUG_TRACE, ("MlmeUpdateHtTxRates===> \n")); auto_rate_cur_p = NULL; { - pDesireHtPhy = &pAd->StaCfg.DesiredHtPhyInfo; - pActiveHtPhy = &pAd->StaCfg.DesiredHtPhyInfo; - pHtPhy = &pAd->StaCfg.HTPhyMode; - pMaxHtPhy = &pAd->StaCfg.MaxHTPhyMode; - pMinHtPhy = &pAd->StaCfg.MinHTPhyMode; + pDesireHtPhy = &pAd->StaCfg.DesiredHtPhyInfo; + pActiveHtPhy = &pAd->StaCfg.DesiredHtPhyInfo; + pHtPhy = &pAd->StaCfg.HTPhyMode; + pMaxHtPhy = &pAd->StaCfg.MaxHTPhyMode; + pMinHtPhy = &pAd->StaCfg.MinHTPhyMode; auto_rate_cur_p = &pAd->StaCfg.bAutoTxRateSwitch; } - if ((ADHOC_ON(pAd) || INFRA_ON(pAd)) && (pAd->OpMode == OPMODE_STA)) - { + if ((ADHOC_ON(pAd) || INFRA_ON(pAd)) && (pAd->OpMode == OPMODE_STA)) { if (pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) return; pRtHtCap = &pAd->StaActive.SupportedHtPhy; pActiveHtPhy = &pAd->StaActive.SupportedPhyInfo; - StbcMcs = (UCHAR)pAd->MlmeAux.AddHtInfo.AddHtInfo3.StbcMcs; - BasicMCS =pAd->MlmeAux.AddHtInfo.MCSSet[0]+(pAd->MlmeAux.AddHtInfo.MCSSet[1]<<8)+(StbcMcs<<16); - if ((pAd->CommonCfg.DesiredHtPhy.TxSTBC) && (pRtHtCap->RxSTBC) && (pAd->Antenna.field.TxPath == 2)) + StbcMcs = (UCHAR) pAd->MlmeAux.AddHtInfo.AddHtInfo3.StbcMcs; + BasicMCS = + pAd->MlmeAux.AddHtInfo.MCSSet[0] + + (pAd->MlmeAux.AddHtInfo.MCSSet[1] << 8) + (StbcMcs << 16); + if ((pAd->CommonCfg.DesiredHtPhy.TxSTBC) && (pRtHtCap->RxSTBC) + && (pAd->Antenna.field.TxPath == 2)) pMaxHtPhy->field.STBC = STBC_USE; else pMaxHtPhy->field.STBC = STBC_NONE; - } - else - { + } else { if (pDesireHtPhy->bHtEnable == FALSE) return; pRtHtCap = &pAd->CommonCfg.DesiredHtPhy; - StbcMcs = (UCHAR)pAd->CommonCfg.AddHTInfo.AddHtInfo3.StbcMcs; - BasicMCS = pAd->CommonCfg.AddHTInfo.MCSSet[0]+(pAd->CommonCfg.AddHTInfo.MCSSet[1]<<8)+(StbcMcs<<16); - if ((pAd->CommonCfg.DesiredHtPhy.TxSTBC) && (pRtHtCap->RxSTBC) && (pAd->Antenna.field.TxPath == 2)) + StbcMcs = (UCHAR) pAd->CommonCfg.AddHTInfo.AddHtInfo3.StbcMcs; + BasicMCS = + pAd->CommonCfg.AddHTInfo.MCSSet[0] + + (pAd->CommonCfg.AddHTInfo.MCSSet[1] << 8) + (StbcMcs << 16); + if ((pAd->CommonCfg.DesiredHtPhy.TxSTBC) && (pRtHtCap->RxSTBC) + && (pAd->Antenna.field.TxPath == 2)) pMaxHtPhy->field.STBC = STBC_USE; else pMaxHtPhy->field.STBC = STBC_NONE; @@ -3228,33 +3360,37 @@ VOID MlmeUpdateHtTxRates( else pMaxHtPhy->field.MODE = MODE_HTMIX; - if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth) && (pRtHtCap->ChannelWidth)) + if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth) + && (pRtHtCap->ChannelWidth)) pMaxHtPhy->field.BW = BW_40; else pMaxHtPhy->field.BW = BW_20; - if (pMaxHtPhy->field.BW == BW_20) - pMaxHtPhy->field.ShortGI = (pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 & pRtHtCap->ShortGIfor20); + if (pMaxHtPhy->field.BW == BW_20) + pMaxHtPhy->field.ShortGI = + (pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 & pRtHtCap-> + ShortGIfor20); else - pMaxHtPhy->field.ShortGI = (pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 & pRtHtCap->ShortGIfor40); + pMaxHtPhy->field.ShortGI = + (pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 & pRtHtCap-> + ShortGIfor40); - if (pDesireHtPhy->MCSSet[4] != 0) - { + if (pDesireHtPhy->MCSSet[4] != 0) { pMaxHtPhy->field.MCS = 32; } - for (i=23; i>=0; i--) // 3*3 + for (i = 23; i >= 0; i--) // 3*3 { - j = i/8; - bitmask = (1<<(i-(j*8))); + j = i / 8; + bitmask = (1 << (i - (j * 8))); - if ((pActiveHtPhy->MCSSet[j] & bitmask) && (pDesireHtPhy->MCSSet[j] & bitmask)) - { + if ((pActiveHtPhy->MCSSet[j] & bitmask) + && (pDesireHtPhy->MCSSet[j] & bitmask)) { pMaxHtPhy->field.MCS = i; break; - } + } - if (i==0) + if (i == 0) break; } @@ -3264,30 +3400,29 @@ VOID MlmeUpdateHtTxRates( pMinHtPhy->field.STBC = 0; pMinHtPhy->field.ShortGI = 0; //If STA assigns fixed rate. update to fixed here. - if ( (pAd->OpMode == OPMODE_STA) && (pDesireHtPhy->MCSSet[0] != 0xff)) - { - if (pDesireHtPhy->MCSSet[4] != 0) - { + if ((pAd->OpMode == OPMODE_STA) && (pDesireHtPhy->MCSSet[0] != 0xff)) { + if (pDesireHtPhy->MCSSet[4] != 0) { pMaxHtPhy->field.MCS = 32; pMinHtPhy->field.MCS = 32; - DBGPRINT(RT_DEBUG_TRACE,("MlmeUpdateHtTxRates<=== Use Fixed MCS = %d\n",pMinHtPhy->field.MCS)); - } + DBGPRINT(RT_DEBUG_TRACE, + ("MlmeUpdateHtTxRates<=== Use Fixed MCS = %d\n", + pMinHtPhy->field.MCS)); + } - for (i=23; (CHAR)i >= 0; i--) // 3*3 - { - j = i/8; - bitmask = (1<<(i-(j*8))); - if ( (pDesireHtPhy->MCSSet[j] & bitmask) && (pActiveHtPhy->MCSSet[j] & bitmask)) + for (i = 23; (CHAR) i >= 0; i--) // 3*3 { + j = i / 8; + bitmask = (1 << (i - (j * 8))); + if ((pDesireHtPhy->MCSSet[j] & bitmask) + && (pActiveHtPhy->MCSSet[j] & bitmask)) { pMaxHtPhy->field.MCS = i; pMinHtPhy->field.MCS = i; break; - } - if (i==0) + } + if (i == 0) break; + } } - } - // Decide ht rate pHtPhy->field.STBC = pMaxHtPhy->field.STBC; @@ -3302,16 +3437,17 @@ VOID MlmeUpdateHtTxRates( else *auto_rate_cur_p = TRUE; - DBGPRINT(RT_DEBUG_TRACE, (" MlmeUpdateHtTxRates<---.AMsduSize = %d \n", pAd->CommonCfg.DesiredHtPhy.AmsduSize )); - DBGPRINT(RT_DEBUG_TRACE,("TX: MCS[0] = %x (choose %d), BW = %d, ShortGI = %d, MODE = %d, \n", pActiveHtPhy->MCSSet[0],pHtPhy->field.MCS, - pHtPhy->field.BW, pHtPhy->field.ShortGI, pHtPhy->field.MODE)); - DBGPRINT(RT_DEBUG_TRACE,("MlmeUpdateHtTxRates<=== \n")); + DBGPRINT(RT_DEBUG_TRACE, + (" MlmeUpdateHtTxRates<---.AMsduSize = %d \n", + pAd->CommonCfg.DesiredHtPhy.AmsduSize)); + DBGPRINT(RT_DEBUG_TRACE, + ("TX: MCS[0] = %x (choose %d), BW = %d, ShortGI = %d, MODE = %d, \n", + pActiveHtPhy->MCSSet[0], pHtPhy->field.MCS, pHtPhy->field.BW, + pHtPhy->field.ShortGI, pHtPhy->field.MODE)); + DBGPRINT(RT_DEBUG_TRACE, ("MlmeUpdateHtTxRates<=== \n")); } - -VOID BATableInit( - IN PRTMP_ADAPTER pAd, - IN BA_TABLE *Tab) +VOID BATableInit(IN PRTMP_ADAPTER pAd, IN BA_TABLE * Tab) { int i; @@ -3319,27 +3455,23 @@ VOID BATableInit( Tab->numAsRecipient = 0; Tab->numDoneOriginator = 0; NdisAllocateSpinLock(&pAd->BATabLock); - for (i = 0; i < MAX_LEN_OF_BA_REC_TABLE; i++) - { + for (i = 0; i < MAX_LEN_OF_BA_REC_TABLE; i++) { Tab->BARecEntry[i].REC_BA_Status = Recipient_NONE; NdisAllocateSpinLock(&(Tab->BARecEntry[i].RxReRingLock)); } - for (i = 0; i < MAX_LEN_OF_BA_ORI_TABLE; i++) - { + for (i = 0; i < MAX_LEN_OF_BA_ORI_TABLE; i++) { Tab->BAOriEntry[i].ORI_BA_Status = Originator_NONE; } } // IRQL = DISPATCH_LEVEL -VOID MlmeRadioOff( - IN PRTMP_ADAPTER pAd) +VOID MlmeRadioOff(IN PRTMP_ADAPTER pAd) { RTMP_MLME_RADIO_OFF(pAd); } // IRQL = DISPATCH_LEVEL -VOID MlmeRadioOn( - IN PRTMP_ADAPTER pAd) +VOID MlmeRadioOn(IN PRTMP_ADAPTER pAd) { RTMP_MLME_RADIO_ON(pAd); } @@ -3348,7 +3480,6 @@ VOID MlmeRadioOn( // bss_table.c // =========================================================================================== - /*! \brief initialize BSS table * \param p_tab pointer to the table * \return none @@ -3359,21 +3490,18 @@ VOID MlmeRadioOn( IRQL = DISPATCH_LEVEL */ -VOID BssTableInit( - IN BSS_TABLE *Tab) +VOID BssTableInit(IN BSS_TABLE * Tab) { int i; Tab->BssNr = 0; - Tab->BssOverlapNr = 0; - for (i = 0; i < MAX_LEN_OF_BSS_TABLE; i++) - { + Tab->BssOverlapNr = 0; + for (i = 0; i < MAX_LEN_OF_BSS_TABLE; i++) { NdisZeroMemory(&Tab->BssEntry[i], sizeof(BSS_ENTRY)); Tab->BssEntry[i].Rssi = -127; // initial the rssi as a minimum value } } - /*! \brief search the BSS table by SSID * \param p_tab pointer to the bss table * \param ssid SSID string @@ -3385,116 +3513,102 @@ VOID BssTableInit( IRQL = DISPATCH_LEVEL */ -ULONG BssTableSearch( - IN BSS_TABLE *Tab, - IN PUCHAR pBssid, - IN UCHAR Channel) +ULONG BssTableSearch(IN BSS_TABLE * Tab, IN PUCHAR pBssid, IN UCHAR Channel) { UCHAR i; - for (i = 0; i < Tab->BssNr; i++) - { + for (i = 0; i < Tab->BssNr; i++) { // // Some AP that support A/B/G mode that may used the same BSSID on 11A and 11B/G. // We should distinguish this case. // if ((((Tab->BssEntry[i].Channel <= 14) && (Channel <= 14)) || - ((Tab->BssEntry[i].Channel > 14) && (Channel > 14))) && - MAC_ADDR_EQUAL(Tab->BssEntry[i].Bssid, pBssid)) - { + ((Tab->BssEntry[i].Channel > 14) && (Channel > 14))) && + MAC_ADDR_EQUAL(Tab->BssEntry[i].Bssid, pBssid)) { return i; } } - return (ULONG)BSS_NOT_FOUND; + return (ULONG) BSS_NOT_FOUND; } -ULONG BssSsidTableSearch( - IN BSS_TABLE *Tab, - IN PUCHAR pBssid, - IN PUCHAR pSsid, - IN UCHAR SsidLen, - IN UCHAR Channel) +ULONG BssSsidTableSearch(IN BSS_TABLE * Tab, + IN PUCHAR pBssid, + IN PUCHAR pSsid, IN UCHAR SsidLen, IN UCHAR Channel) { UCHAR i; - for (i = 0; i < Tab->BssNr; i++) - { + for (i = 0; i < Tab->BssNr; i++) { // // Some AP that support A/B/G mode that may used the same BSSID on 11A and 11B/G. // We should distinguish this case. // if ((((Tab->BssEntry[i].Channel <= 14) && (Channel <= 14)) || - ((Tab->BssEntry[i].Channel > 14) && (Channel > 14))) && - MAC_ADDR_EQUAL(Tab->BssEntry[i].Bssid, pBssid) && - SSID_EQUAL(pSsid, SsidLen, Tab->BssEntry[i].Ssid, Tab->BssEntry[i].SsidLen)) - { + ((Tab->BssEntry[i].Channel > 14) && (Channel > 14))) && + MAC_ADDR_EQUAL(Tab->BssEntry[i].Bssid, pBssid) && + SSID_EQUAL(pSsid, SsidLen, Tab->BssEntry[i].Ssid, + Tab->BssEntry[i].SsidLen)) { return i; } } - return (ULONG)BSS_NOT_FOUND; + return (ULONG) BSS_NOT_FOUND; } -ULONG BssTableSearchWithSSID( - IN BSS_TABLE *Tab, - IN PUCHAR Bssid, - IN PUCHAR pSsid, - IN UCHAR SsidLen, - IN UCHAR Channel) +ULONG BssTableSearchWithSSID(IN BSS_TABLE * Tab, + IN PUCHAR Bssid, + IN PUCHAR pSsid, + IN UCHAR SsidLen, IN UCHAR Channel) { UCHAR i; - for (i = 0; i < Tab->BssNr; i++) - { + for (i = 0; i < Tab->BssNr; i++) { if ((((Tab->BssEntry[i].Channel <= 14) && (Channel <= 14)) || - ((Tab->BssEntry[i].Channel > 14) && (Channel > 14))) && - MAC_ADDR_EQUAL(&(Tab->BssEntry[i].Bssid), Bssid) && - (SSID_EQUAL(pSsid, SsidLen, Tab->BssEntry[i].Ssid, Tab->BssEntry[i].SsidLen) || - (NdisEqualMemory(pSsid, ZeroSsid, SsidLen)) || - (NdisEqualMemory(Tab->BssEntry[i].Ssid, ZeroSsid, Tab->BssEntry[i].SsidLen)))) - { + ((Tab->BssEntry[i].Channel > 14) && (Channel > 14))) && + MAC_ADDR_EQUAL(&(Tab->BssEntry[i].Bssid), Bssid) && + (SSID_EQUAL + (pSsid, SsidLen, Tab->BssEntry[i].Ssid, + Tab->BssEntry[i].SsidLen) + || (NdisEqualMemory(pSsid, ZeroSsid, SsidLen)) + || + (NdisEqualMemory + (Tab->BssEntry[i].Ssid, ZeroSsid, + Tab->BssEntry[i].SsidLen)))) { return i; } } - return (ULONG)BSS_NOT_FOUND; + return (ULONG) BSS_NOT_FOUND; } - -ULONG BssSsidTableSearchBySSID( - IN BSS_TABLE *Tab, - IN PUCHAR pSsid, - IN UCHAR SsidLen) +ULONG BssSsidTableSearchBySSID(IN BSS_TABLE * Tab, + IN PUCHAR pSsid, IN UCHAR SsidLen) { UCHAR i; - for (i = 0; i < Tab->BssNr; i++) - { - if (SSID_EQUAL(pSsid, SsidLen, Tab->BssEntry[i].Ssid, Tab->BssEntry[i].SsidLen)) - { + for (i = 0; i < Tab->BssNr; i++) { + if (SSID_EQUAL + (pSsid, SsidLen, Tab->BssEntry[i].Ssid, + Tab->BssEntry[i].SsidLen)) { return i; + } } - } - return (ULONG)BSS_NOT_FOUND; + return (ULONG) BSS_NOT_FOUND; } - // IRQL = DISPATCH_LEVEL -VOID BssTableDeleteEntry( - IN OUT BSS_TABLE *Tab, - IN PUCHAR pBssid, - IN UCHAR Channel) +VOID BssTableDeleteEntry(IN OUT BSS_TABLE * Tab, + IN PUCHAR pBssid, IN UCHAR Channel) { UCHAR i, j; - for (i = 0; i < Tab->BssNr; i++) - { + for (i = 0; i < Tab->BssNr; i++) { if ((Tab->BssEntry[i].Channel == Channel) && - (MAC_ADDR_EQUAL(Tab->BssEntry[i].Bssid, pBssid))) - { - for (j = i; j < Tab->BssNr - 1; j++) - { - NdisMoveMemory(&(Tab->BssEntry[j]), &(Tab->BssEntry[j + 1]), sizeof(BSS_ENTRY)); + (MAC_ADDR_EQUAL(Tab->BssEntry[i].Bssid, pBssid))) { + for (j = i; j < Tab->BssNr - 1; j++) { + NdisMoveMemory(&(Tab->BssEntry[j]), + &(Tab->BssEntry[j + 1]), + sizeof(BSS_ENTRY)); } - NdisZeroMemory(&(Tab->BssEntry[Tab->BssNr - 1]), sizeof(BSS_ENTRY)); + NdisZeroMemory(&(Tab->BssEntry[Tab->BssNr - 1]), + sizeof(BSS_ENTRY)); Tab->BssNr -= 1; return; } @@ -3510,21 +3624,20 @@ VOID BssTableDeleteEntry( // IRQL = DISPATCH_LEVEL ======================================================================== */ -VOID BATableDeleteORIEntry( - IN OUT PRTMP_ADAPTER pAd, - IN BA_ORI_ENTRY *pBAORIEntry) +VOID BATableDeleteORIEntry(IN OUT PRTMP_ADAPTER pAd, + IN BA_ORI_ENTRY * pBAORIEntry) { - if (pBAORIEntry->ORI_BA_Status != Originator_NONE) - { + if (pBAORIEntry->ORI_BA_Status != Originator_NONE) { NdisAcquireSpinLock(&pAd->BATabLock); - if (pBAORIEntry->ORI_BA_Status == Originator_Done) - { + if (pBAORIEntry->ORI_BA_Status == Originator_Done) { pAd->BATable.numAsOriginator -= 1; - DBGPRINT(RT_DEBUG_TRACE, ("BATableDeleteORIEntry numAsOriginator= %ld\n", pAd->BATable.numAsRecipient)); + DBGPRINT(RT_DEBUG_TRACE, + ("BATableDeleteORIEntry numAsOriginator= %ld\n", + pAd->BATable.numAsRecipient)); // Erase Bitmap flag. } - pAd->MacTab.Content[pBAORIEntry->Wcid].TXBAbitmap &= (~(1<<(pBAORIEntry->TID) )); // If STA mode, erase flag here + pAd->MacTab.Content[pBAORIEntry->Wcid].TXBAbitmap &= (~(1 << (pBAORIEntry->TID))); // If STA mode, erase flag here pAd->MacTab.Content[pBAORIEntry->Wcid].BAOriWcidArray[pBAORIEntry->TID] = 0; // If STA mode, erase flag here pBAORIEntry->ORI_BA_Status = Originator_NONE; pBAORIEntry->Token = 1; @@ -3542,69 +3655,45 @@ VOID BATableDeleteORIEntry( IRQL = DISPATCH_LEVEL */ -VOID BssEntrySet( - IN PRTMP_ADAPTER pAd, - OUT BSS_ENTRY *pBss, - IN PUCHAR pBssid, - IN CHAR Ssid[], - IN UCHAR SsidLen, - IN UCHAR BssType, - IN USHORT BeaconPeriod, - IN PCF_PARM pCfParm, - IN USHORT AtimWin, - IN USHORT CapabilityInfo, - IN UCHAR SupRate[], - IN UCHAR SupRateLen, - IN UCHAR ExtRate[], - IN UCHAR ExtRateLen, - IN HT_CAPABILITY_IE *pHtCapability, - IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE - IN UCHAR HtCapabilityLen, - IN UCHAR AddHtInfoLen, - IN UCHAR NewExtChanOffset, - IN UCHAR Channel, - IN CHAR Rssi, - IN LARGE_INTEGER TimeStamp, - IN UCHAR CkipFlag, - IN PEDCA_PARM pEdcaParm, - IN PQOS_CAPABILITY_PARM pQosCapability, - IN PQBSS_LOAD_PARM pQbssLoad, - IN USHORT LengthVIE, - IN PNDIS_802_11_VARIABLE_IEs pVIE) +VOID BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, IN PUCHAR pBssid, IN CHAR Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN USHORT BeaconPeriod, IN PCF_PARM pCfParm, IN USHORT AtimWin, IN USHORT CapabilityInfo, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, // AP might use this additional ht info IE + IN UCHAR HtCapabilityLen, + IN UCHAR AddHtInfoLen, + IN UCHAR NewExtChanOffset, + IN UCHAR Channel, + IN CHAR Rssi, + IN LARGE_INTEGER TimeStamp, + IN UCHAR CkipFlag, + IN PEDCA_PARM pEdcaParm, + IN PQOS_CAPABILITY_PARM pQosCapability, + IN PQBSS_LOAD_PARM pQbssLoad, + IN USHORT LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE) { COPY_MAC_ADDR(pBss->Bssid, pBssid); // Default Hidden SSID to be TRUE, it will be turned to FALSE after coping SSID pBss->Hidden = 1; - if (SsidLen > 0) - { + if (SsidLen > 0) { // For hidden SSID AP, it might send beacon with SSID len equal to 0 // Or send beacon /probe response with SSID len matching real SSID length, // but SSID is all zero. such as "00-00-00-00" with length 4. // We have to prevent this case overwrite correct table - if (NdisEqualMemory(Ssid, ZeroSsid, SsidLen) == 0) - { - NdisZeroMemory(pBss->Ssid, MAX_LEN_OF_SSID); + if (NdisEqualMemory(Ssid, ZeroSsid, SsidLen) == 0) { + NdisZeroMemory(pBss->Ssid, MAX_LEN_OF_SSID); NdisMoveMemory(pBss->Ssid, Ssid, SsidLen); pBss->SsidLen = SsidLen; pBss->Hidden = 0; } - } - else + } else pBss->SsidLen = 0; pBss->BssType = BssType; pBss->BeaconPeriod = BeaconPeriod; - if (BssType == BSS_INFRA) - { - if (pCfParm->bValid) - { + if (BssType == BSS_INFRA) { + if (pCfParm->bValid) { pBss->CfpCount = pCfParm->CfpCount; pBss->CfpPeriod = pCfParm->CfpPeriod; pBss->CfpMaxDuration = pCfParm->CfpMaxDuration; pBss->CfpDurRemaining = pCfParm->CfpDurRemaining; } - } - else - { + } else { pBss->AtimWin = AtimWin; } @@ -3616,7 +3705,8 @@ VOID BssEntrySet( if (SupRateLen <= MAX_LEN_OF_SUPPORTED_RATES) NdisMoveMemory(pBss->SupRate, SupRate, SupRateLen); else - NdisMoveMemory(pBss->SupRate, SupRate, MAX_LEN_OF_SUPPORTED_RATES); + NdisMoveMemory(pBss->SupRate, SupRate, + MAX_LEN_OF_SUPPORTED_RATES); pBss->SupRateLen = SupRateLen; ASSERT(ExtRateLen <= MAX_LEN_OF_SUPPORTED_RATES); NdisMoveMemory(pBss->ExtRate, ExtRate, ExtRateLen); @@ -3634,35 +3724,39 @@ VOID BssEntrySet( pBss->FixIEs.Capabilities = CapabilityInfo; // New for microsoft Variable IEs - if (LengthVIE != 0) - { + if (LengthVIE != 0) { pBss->VarIELen = LengthVIE; NdisMoveMemory(pBss->VarIEs, pVIE, pBss->VarIELen); - } - else - { + } else { pBss->VarIELen = 0; } pBss->AddHtInfoLen = 0; pBss->HtCapabilityLen = 0; - if (HtCapabilityLen> 0) - { + if (HtCapabilityLen > 0) { pBss->HtCapabilityLen = HtCapabilityLen; - NdisMoveMemory(&pBss->HtCapability, pHtCapability, HtCapabilityLen); - if (AddHtInfoLen > 0) - { + NdisMoveMemory(&pBss->HtCapability, pHtCapability, + HtCapabilityLen); + if (AddHtInfoLen > 0) { pBss->AddHtInfoLen = AddHtInfoLen; - NdisMoveMemory(&pBss->AddHtInfo, pAddHtInfo, AddHtInfoLen); - - if ((pAddHtInfo->ControlChan > 2)&& (pAddHtInfo->AddHtInfo.ExtChanOffset == EXTCHA_BELOW) && (pHtCapability->HtCapInfo.ChannelWidth == BW_40)) - { - pBss->CentralChannel = pAddHtInfo->ControlChan - 2; - } - else if ((pAddHtInfo->AddHtInfo.ExtChanOffset == EXTCHA_ABOVE) && (pHtCapability->HtCapInfo.ChannelWidth == BW_40)) - { - pBss->CentralChannel = pAddHtInfo->ControlChan + 2; - } + NdisMoveMemory(&pBss->AddHtInfo, pAddHtInfo, + AddHtInfoLen); + + if ((pAddHtInfo->ControlChan > 2) + && (pAddHtInfo->AddHtInfo.ExtChanOffset == + EXTCHA_BELOW) + && (pHtCapability->HtCapInfo.ChannelWidth == + BW_40)) { + pBss->CentralChannel = + pAddHtInfo->ControlChan - 2; + } else + if ((pAddHtInfo->AddHtInfo.ExtChanOffset == + EXTCHA_ABOVE) + && (pHtCapability->HtCapInfo.ChannelWidth == + BW_40)) { + pBss->CentralChannel = + pAddHtInfo->ControlChan + 2; + } } } @@ -3674,53 +3768,51 @@ VOID BssEntrySet( else pBss->EdcaParm.bValid = FALSE; if (pQosCapability) - NdisMoveMemory(&pBss->QosCapability, pQosCapability, sizeof(QOS_CAPABILITY_PARM)); + NdisMoveMemory(&pBss->QosCapability, pQosCapability, + sizeof(QOS_CAPABILITY_PARM)); else pBss->QosCapability.bValid = FALSE; if (pQbssLoad) - NdisMoveMemory(&pBss->QbssLoad, pQbssLoad, sizeof(QBSS_LOAD_PARM)); + NdisMoveMemory(&pBss->QbssLoad, pQbssLoad, + sizeof(QBSS_LOAD_PARM)); else pBss->QbssLoad.bValid = FALSE; { - PEID_STRUCT pEid; - USHORT Length = 0; - + PEID_STRUCT pEid; + USHORT Length = 0; NdisZeroMemory(&pBss->WpaIE.IE[0], MAX_CUSTOM_LEN); NdisZeroMemory(&pBss->RsnIE.IE[0], MAX_CUSTOM_LEN); pEid = (PEID_STRUCT) pVIE; - while ((Length + 2 + (USHORT)pEid->Len) <= LengthVIE) - { - switch(pEid->Eid) - { - case IE_WPA: - if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4)) - { - if ((pEid->Len + 2) > MAX_CUSTOM_LEN) - { - pBss->WpaIE.IELen = 0; - break; + while ((Length + 2 + (USHORT) pEid->Len) <= LengthVIE) { + switch (pEid->Eid) { + case IE_WPA: + if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4)) { + if ((pEid->Len + 2) > MAX_CUSTOM_LEN) { + pBss->WpaIE.IELen = 0; + break; } - pBss->WpaIE.IELen = pEid->Len + 2; - NdisMoveMemory(pBss->WpaIE.IE, pEid, pBss->WpaIE.IELen); + pBss->WpaIE.IELen = pEid->Len + 2; + NdisMoveMemory(pBss->WpaIE.IE, pEid, + pBss->WpaIE.IELen); } break; - case IE_RSN: - if (NdisEqualMemory(pEid->Octet + 2, RSN_OUI, 3)) - { - if ((pEid->Len + 2) > MAX_CUSTOM_LEN) - { - pBss->RsnIE.IELen = 0; - break; + case IE_RSN: + if (NdisEqualMemory + (pEid->Octet + 2, RSN_OUI, 3)) { + if ((pEid->Len + 2) > MAX_CUSTOM_LEN) { + pBss->RsnIE.IELen = 0; + break; } - pBss->RsnIE.IELen = pEid->Len + 2; - NdisMoveMemory(pBss->RsnIE.IE, pEid, pBss->RsnIE.IELen); + pBss->RsnIE.IELen = pEid->Len + 2; + NdisMoveMemory(pBss->RsnIE.IE, pEid, + pBss->RsnIE.IELen); } break; - } - Length = Length + 2 + (USHORT)pEid->Len; // Eid[1] + Len[1]+ content[Len] - pEid = (PEID_STRUCT)((UCHAR*)pEid + 2 + pEid->Len); + } + Length = Length + 2 + (USHORT) pEid->Len; // Eid[1] + Len[1]+ content[Len] + pEid = (PEID_STRUCT) ((UCHAR *) pEid + 2 + pEid->Len); } } } @@ -3748,191 +3840,209 @@ VOID BssEntrySet( IRQL = DISPATCH_LEVEL */ -ULONG BssTableSetEntry( - IN PRTMP_ADAPTER pAd, - OUT BSS_TABLE *Tab, - IN PUCHAR pBssid, - IN CHAR Ssid[], - IN UCHAR SsidLen, - IN UCHAR BssType, - IN USHORT BeaconPeriod, - IN CF_PARM *CfParm, - IN USHORT AtimWin, - IN USHORT CapabilityInfo, - IN UCHAR SupRate[], - IN UCHAR SupRateLen, - IN UCHAR ExtRate[], - IN UCHAR ExtRateLen, - IN HT_CAPABILITY_IE *pHtCapability, - IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE - IN UCHAR HtCapabilityLen, - IN UCHAR AddHtInfoLen, - IN UCHAR NewExtChanOffset, - IN UCHAR ChannelNo, - IN CHAR Rssi, - IN LARGE_INTEGER TimeStamp, - IN UCHAR CkipFlag, - IN PEDCA_PARM pEdcaParm, - IN PQOS_CAPABILITY_PARM pQosCapability, - IN PQBSS_LOAD_PARM pQbssLoad, - IN USHORT LengthVIE, - IN PNDIS_802_11_VARIABLE_IEs pVIE) +ULONG BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT BSS_TABLE * Tab, IN PUCHAR pBssid, IN CHAR Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN USHORT BeaconPeriod, IN CF_PARM * CfParm, IN USHORT AtimWin, IN USHORT CapabilityInfo, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, // AP might use this additional ht info IE + IN UCHAR HtCapabilityLen, + IN UCHAR AddHtInfoLen, + IN UCHAR NewExtChanOffset, + IN UCHAR ChannelNo, + IN CHAR Rssi, + IN LARGE_INTEGER TimeStamp, + IN UCHAR CkipFlag, + IN PEDCA_PARM pEdcaParm, + IN PQOS_CAPABILITY_PARM pQosCapability, + IN PQBSS_LOAD_PARM pQbssLoad, + IN USHORT LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE) { - ULONG Idx; + ULONG Idx; - Idx = BssTableSearchWithSSID(Tab, pBssid, (UCHAR *)Ssid, SsidLen, ChannelNo); - if (Idx == BSS_NOT_FOUND) - { - if (Tab->BssNr >= MAX_LEN_OF_BSS_TABLE) - { + Idx = + BssTableSearchWithSSID(Tab, pBssid, (UCHAR *) Ssid, SsidLen, + ChannelNo); + if (Idx == BSS_NOT_FOUND) { + if (Tab->BssNr >= MAX_LEN_OF_BSS_TABLE) { // // It may happen when BSS Table was full. // The desired AP will not be added into BSS Table // In this case, if we found the desired AP then overwrite BSS Table. // - if(!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, pBssid) || - SSID_EQUAL(pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, Ssid, SsidLen)) - { + if (!OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) { + if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, pBssid) + || SSID_EQUAL(pAd->MlmeAux.Ssid, + pAd->MlmeAux.SsidLen, Ssid, + SsidLen)) { Idx = Tab->BssOverlapNr; - BssEntrySet(pAd, &Tab->BssEntry[Idx], pBssid, Ssid, SsidLen, BssType, BeaconPeriod, CfParm, AtimWin, - CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen,pHtCapability, pAddHtInfo,HtCapabilityLen, AddHtInfoLen, - NewExtChanOffset, ChannelNo, Rssi, TimeStamp, CkipFlag, pEdcaParm, pQosCapability, pQbssLoad, LengthVIE, pVIE); - Tab->BssOverlapNr = (Tab->BssOverlapNr++) % MAX_LEN_OF_BSS_TABLE; + BssEntrySet(pAd, &Tab->BssEntry[Idx], + pBssid, Ssid, SsidLen, + BssType, BeaconPeriod, + CfParm, AtimWin, + CapabilityInfo, SupRate, + SupRateLen, ExtRate, + ExtRateLen, pHtCapability, + pAddHtInfo, HtCapabilityLen, + AddHtInfoLen, + NewExtChanOffset, ChannelNo, + Rssi, TimeStamp, CkipFlag, + pEdcaParm, pQosCapability, + pQbssLoad, LengthVIE, pVIE); + Tab->BssOverlapNr = + (Tab->BssOverlapNr++) % + MAX_LEN_OF_BSS_TABLE; } return Idx; - } - else - { - return BSS_NOT_FOUND; - } + } else { + return BSS_NOT_FOUND; + } } Idx = Tab->BssNr; - BssEntrySet(pAd, &Tab->BssEntry[Idx], pBssid, Ssid, SsidLen, BssType, BeaconPeriod, CfParm, AtimWin, - CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen,pHtCapability, pAddHtInfo,HtCapabilityLen, AddHtInfoLen, - NewExtChanOffset, ChannelNo, Rssi, TimeStamp, CkipFlag, pEdcaParm, pQosCapability, pQbssLoad, LengthVIE, pVIE); + BssEntrySet(pAd, &Tab->BssEntry[Idx], pBssid, Ssid, SsidLen, + BssType, BeaconPeriod, CfParm, AtimWin, + CapabilityInfo, SupRate, SupRateLen, ExtRate, + ExtRateLen, pHtCapability, pAddHtInfo, + HtCapabilityLen, AddHtInfoLen, NewExtChanOffset, + ChannelNo, Rssi, TimeStamp, CkipFlag, pEdcaParm, + pQosCapability, pQbssLoad, LengthVIE, pVIE); Tab->BssNr++; - } - else - { + } else { /* avoid Hidden SSID form beacon to overwirite correct SSID from probe response */ - if ((SSID_EQUAL(Ssid, SsidLen, Tab->BssEntry[Idx].Ssid, Tab->BssEntry[Idx].SsidLen)) || - (NdisEqualMemory(Tab->BssEntry[Idx].Ssid, ZeroSsid, Tab->BssEntry[Idx].SsidLen))) - { - BssEntrySet(pAd, &Tab->BssEntry[Idx], pBssid, Ssid, SsidLen, BssType, BeaconPeriod,CfParm, AtimWin, - CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen,pHtCapability, pAddHtInfo,HtCapabilityLen, AddHtInfoLen, - NewExtChanOffset, ChannelNo, Rssi, TimeStamp, CkipFlag, pEdcaParm, pQosCapability, pQbssLoad, LengthVIE, pVIE); + if ((SSID_EQUAL + (Ssid, SsidLen, Tab->BssEntry[Idx].Ssid, + Tab->BssEntry[Idx].SsidLen)) + || + (NdisEqualMemory + (Tab->BssEntry[Idx].Ssid, ZeroSsid, + Tab->BssEntry[Idx].SsidLen))) { + BssEntrySet(pAd, &Tab->BssEntry[Idx], pBssid, Ssid, + SsidLen, BssType, BeaconPeriod, CfParm, + AtimWin, CapabilityInfo, SupRate, + SupRateLen, ExtRate, ExtRateLen, + pHtCapability, pAddHtInfo, HtCapabilityLen, + AddHtInfoLen, NewExtChanOffset, ChannelNo, + Rssi, TimeStamp, CkipFlag, pEdcaParm, + pQosCapability, pQbssLoad, LengthVIE, pVIE); } } return Idx; } - // IRQL = DISPATCH_LEVEL -VOID BssTableSsidSort( - IN PRTMP_ADAPTER pAd, - OUT BSS_TABLE *OutTab, - IN CHAR Ssid[], - IN UCHAR SsidLen) +VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, + OUT BSS_TABLE * OutTab, IN CHAR Ssid[], IN UCHAR SsidLen) { INT i; BssTableInit(OutTab); - for (i = 0; i < pAd->ScanTab.BssNr; i++) - { + for (i = 0; i < pAd->ScanTab.BssNr; i++) { BSS_ENTRY *pInBss = &pAd->ScanTab.BssEntry[i]; - BOOLEAN bIsHiddenApIncluded = FALSE; + BOOLEAN bIsHiddenApIncluded = FALSE; if (((pAd->CommonCfg.bIEEE80211H == 1) && - (pAd->MlmeAux.Channel > 14) && - RadarChannelCheck(pAd, pInBss->Channel)) - ) -{ + (pAd->MlmeAux.Channel > 14) && + RadarChannelCheck(pAd, pInBss->Channel)) + ) { if (pInBss->Hidden) bIsHiddenApIncluded = TRUE; -} + } if ((pInBss->BssType == pAd->StaCfg.BssType) && - (SSID_EQUAL(Ssid, SsidLen, pInBss->Ssid, pInBss->SsidLen) || bIsHiddenApIncluded)) - { + (SSID_EQUAL(Ssid, SsidLen, pInBss->Ssid, pInBss->SsidLen) + || bIsHiddenApIncluded)) { BSS_ENTRY *pOutBss = &OutTab->BssEntry[OutTab->BssNr]; - - // 2.4G/5G N only mode if ((pInBss->HtCapabilityLen == 0) && - ((pAd->CommonCfg.PhyMode == PHY_11N_2_4G) || (pAd->CommonCfg.PhyMode == PHY_11N_5G))) - { - DBGPRINT(RT_DEBUG_TRACE,("STA is in N-only Mode, this AP don't have Ht capability in Beacon.\n")); + ((pAd->CommonCfg.PhyMode == PHY_11N_2_4G) + || (pAd->CommonCfg.PhyMode == PHY_11N_5G))) { + DBGPRINT(RT_DEBUG_TRACE, + ("STA is in N-only Mode, this AP don't have Ht capability in Beacon.\n")); continue; - } + } // New for WPA2 // Check the Authmode first - if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - { + if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) { // Check AuthMode and AuthModeAux for matching, in case AP support dual-mode - if ((pAd->StaCfg.AuthMode != pInBss->AuthMode) && (pAd->StaCfg.AuthMode != pInBss->AuthModeAux)) + if ((pAd->StaCfg.AuthMode != pInBss->AuthMode) + && (pAd->StaCfg.AuthMode != + pInBss->AuthModeAux)) // None matched continue; // Check cipher suite, AP must have more secured cipher than station setting - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) - { + if ((pAd->StaCfg.AuthMode == + Ndis802_11AuthModeWPA) + || (pAd->StaCfg.AuthMode == + Ndis802_11AuthModeWPAPSK)) { // If it's not mixed mode, we should only let BSS pass with the same encryption if (pInBss->WPA.bMixMode == FALSE) - if (pAd->StaCfg.WepStatus != pInBss->WPA.GroupCipher) + if (pAd->StaCfg.WepStatus != + pInBss->WPA.GroupCipher) continue; // check group cipher - if ((pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) && - (pInBss->WPA.GroupCipher != Ndis802_11GroupWEP40Enabled) && - (pInBss->WPA.GroupCipher != Ndis802_11GroupWEP104Enabled)) + if ((pAd->StaCfg.WepStatus < + pInBss->WPA.GroupCipher) + && (pInBss->WPA.GroupCipher != + Ndis802_11GroupWEP40Enabled) + && (pInBss->WPA.GroupCipher != + Ndis802_11GroupWEP104Enabled)) continue; // check pairwise cipher, skip if none matched // If profile set to AES, let it pass without question. // If profile set to TKIP, we must find one mateched - if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && - (pAd->StaCfg.WepStatus != pInBss->WPA.PairCipher) && - (pAd->StaCfg.WepStatus != pInBss->WPA.PairCipherAux)) + if ((pAd->StaCfg.WepStatus == + Ndis802_11Encryption2Enabled) + && (pAd->StaCfg.WepStatus != + pInBss->WPA.PairCipher) + && (pAd->StaCfg.WepStatus != + pInBss->WPA.PairCipherAux)) continue; - } - else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) - { + } else + if ((pAd->StaCfg.AuthMode == + Ndis802_11AuthModeWPA2) + || (pAd->StaCfg.AuthMode == + Ndis802_11AuthModeWPA2PSK)) { // If it's not mixed mode, we should only let BSS pass with the same encryption if (pInBss->WPA2.bMixMode == FALSE) - if (pAd->StaCfg.WepStatus != pInBss->WPA2.GroupCipher) + if (pAd->StaCfg.WepStatus != + pInBss->WPA2.GroupCipher) continue; // check group cipher - if ((pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) && - (pInBss->WPA2.GroupCipher != Ndis802_11GroupWEP40Enabled) && - (pInBss->WPA2.GroupCipher != Ndis802_11GroupWEP104Enabled)) + if ((pAd->StaCfg.WepStatus < + pInBss->WPA.GroupCipher) + && (pInBss->WPA2.GroupCipher != + Ndis802_11GroupWEP40Enabled) + && (pInBss->WPA2.GroupCipher != + Ndis802_11GroupWEP104Enabled)) continue; // check pairwise cipher, skip if none matched // If profile set to AES, let it pass without question. // If profile set to TKIP, we must find one mateched - if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && - (pAd->StaCfg.WepStatus != pInBss->WPA2.PairCipher) && - (pAd->StaCfg.WepStatus != pInBss->WPA2.PairCipherAux)) + if ((pAd->StaCfg.WepStatus == + Ndis802_11Encryption2Enabled) + && (pAd->StaCfg.WepStatus != + pInBss->WPA2.PairCipher) + && (pAd->StaCfg.WepStatus != + pInBss->WPA2.PairCipherAux)) continue; } } // Bss Type matched, SSID matched. // We will check wepstatus for qualification Bss - else if (pAd->StaCfg.WepStatus != pInBss->WepStatus) - { - DBGPRINT(RT_DEBUG_TRACE,("StaCfg.WepStatus=%d, while pInBss->WepStatus=%d\n", pAd->StaCfg.WepStatus, pInBss->WepStatus)); + else if (pAd->StaCfg.WepStatus != pInBss->WepStatus) { + DBGPRINT(RT_DEBUG_TRACE, + ("StaCfg.WepStatus=%d, while pInBss->WepStatus=%d\n", + pAd->StaCfg.WepStatus, + pInBss->WepStatus)); // // For the SESv2 case, we will not qualify WepStatus. - // + // if (!pInBss->bSES) continue; } - // Since the AP is using hidden SSID, and we are trying to connect to ANY // It definitely will fail. So, skip it. // CCX also require not even try to connect it!! @@ -3942,108 +4052,123 @@ VOID BssTableSsidSort( // If both station and AP use 40MHz, still need to check if the 40MHZ band's legality in my country region // If this 40MHz wideband is not allowed in my country list, use bandwidth 20MHZ instead, if ((pInBss->CentralChannel != pInBss->Channel) && - (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)) - { - if (RTMPCheckChannel(pAd, pInBss->CentralChannel, pInBss->Channel) == FALSE) - { - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; + (pAd->CommonCfg.RegTransmitSetting.field.BW == + BW_40)) { + if (RTMPCheckChannel + (pAd, pInBss->CentralChannel, + pInBss->Channel) == FALSE) { + pAd->CommonCfg.RegTransmitSetting.field. + BW = BW_20; SetCommonHT(pAd); - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40; - } - else - { - if (pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BAND_WIDTH_20) - { + pAd->CommonCfg.RegTransmitSetting.field. + BW = BW_40; + } else { + if (pAd->CommonCfg.DesiredHtPhy. + ChannelWidth == BAND_WIDTH_20) { SetCommonHT(pAd); } - } - } - + } + } // copy matching BSS from InTab to OutTab NdisMoveMemory(pOutBss, pInBss, sizeof(BSS_ENTRY)); OutTab->BssNr++; - } - else if ((pInBss->BssType == pAd->StaCfg.BssType) && (SsidLen == 0)) - { + } else if ((pInBss->BssType == pAd->StaCfg.BssType) + && (SsidLen == 0)) { BSS_ENTRY *pOutBss = &OutTab->BssEntry[OutTab->BssNr]; - // 2.4G/5G N only mode if ((pInBss->HtCapabilityLen == 0) && - ((pAd->CommonCfg.PhyMode == PHY_11N_2_4G) || (pAd->CommonCfg.PhyMode == PHY_11N_5G))) - { - DBGPRINT(RT_DEBUG_TRACE,("STA is in N-only Mode, this AP don't have Ht capability in Beacon.\n")); + ((pAd->CommonCfg.PhyMode == PHY_11N_2_4G) + || (pAd->CommonCfg.PhyMode == PHY_11N_5G))) { + DBGPRINT(RT_DEBUG_TRACE, + ("STA is in N-only Mode, this AP don't have Ht capability in Beacon.\n")); continue; } - // New for WPA2 // Check the Authmode first - if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - { + if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) { // Check AuthMode and AuthModeAux for matching, in case AP support dual-mode - if ((pAd->StaCfg.AuthMode != pInBss->AuthMode) && (pAd->StaCfg.AuthMode != pInBss->AuthModeAux)) + if ((pAd->StaCfg.AuthMode != pInBss->AuthMode) + && (pAd->StaCfg.AuthMode != + pInBss->AuthModeAux)) // None matched continue; // Check cipher suite, AP must have more secured cipher than station setting - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) - { + if ((pAd->StaCfg.AuthMode == + Ndis802_11AuthModeWPA) + || (pAd->StaCfg.AuthMode == + Ndis802_11AuthModeWPAPSK)) { // If it's not mixed mode, we should only let BSS pass with the same encryption if (pInBss->WPA.bMixMode == FALSE) - if (pAd->StaCfg.WepStatus != pInBss->WPA.GroupCipher) + if (pAd->StaCfg.WepStatus != + pInBss->WPA.GroupCipher) continue; // check group cipher - if (pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) + if (pAd->StaCfg.WepStatus < + pInBss->WPA.GroupCipher) continue; // check pairwise cipher, skip if none matched // If profile set to AES, let it pass without question. // If profile set to TKIP, we must find one mateched - if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && - (pAd->StaCfg.WepStatus != pInBss->WPA.PairCipher) && - (pAd->StaCfg.WepStatus != pInBss->WPA.PairCipherAux)) + if ((pAd->StaCfg.WepStatus == + Ndis802_11Encryption2Enabled) + && (pAd->StaCfg.WepStatus != + pInBss->WPA.PairCipher) + && (pAd->StaCfg.WepStatus != + pInBss->WPA.PairCipherAux)) continue; - } - else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) - { + } else + if ((pAd->StaCfg.AuthMode == + Ndis802_11AuthModeWPA2) + || (pAd->StaCfg.AuthMode == + Ndis802_11AuthModeWPA2PSK)) { // If it's not mixed mode, we should only let BSS pass with the same encryption if (pInBss->WPA2.bMixMode == FALSE) - if (pAd->StaCfg.WepStatus != pInBss->WPA2.GroupCipher) + if (pAd->StaCfg.WepStatus != + pInBss->WPA2.GroupCipher) continue; // check group cipher - if (pAd->StaCfg.WepStatus < pInBss->WPA2.GroupCipher) + if (pAd->StaCfg.WepStatus < + pInBss->WPA2.GroupCipher) continue; // check pairwise cipher, skip if none matched // If profile set to AES, let it pass without question. // If profile set to TKIP, we must find one mateched - if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && - (pAd->StaCfg.WepStatus != pInBss->WPA2.PairCipher) && - (pAd->StaCfg.WepStatus != pInBss->WPA2.PairCipherAux)) + if ((pAd->StaCfg.WepStatus == + Ndis802_11Encryption2Enabled) + && (pAd->StaCfg.WepStatus != + pInBss->WPA2.PairCipher) + && (pAd->StaCfg.WepStatus != + pInBss->WPA2.PairCipherAux)) continue; } } // Bss Type matched, SSID matched. // We will check wepstatus for qualification Bss else if (pAd->StaCfg.WepStatus != pInBss->WepStatus) - continue; + continue; // If both station and AP use 40MHz, still need to check if the 40MHZ band's legality in my country region // If this 40MHz wideband is not allowed in my country list, use bandwidth 20MHZ instead, if ((pInBss->CentralChannel != pInBss->Channel) && - (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)) - { - if (RTMPCheckChannel(pAd, pInBss->CentralChannel, pInBss->Channel) == FALSE) - { - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; + (pAd->CommonCfg.RegTransmitSetting.field.BW == + BW_40)) { + if (RTMPCheckChannel + (pAd, pInBss->CentralChannel, + pInBss->Channel) == FALSE) { + pAd->CommonCfg.RegTransmitSetting.field. + BW = BW_20; SetCommonHT(pAd); - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40; + pAd->CommonCfg.RegTransmitSetting.field. + BW = BW_40; } - } - + } // copy matching BSS from InTab to OutTab NdisMoveMemory(pOutBss, pInBss, sizeof(BSS_ENTRY)); @@ -4051,359 +4176,364 @@ VOID BssTableSsidSort( } if (OutTab->BssNr >= MAX_LEN_OF_BSS_TABLE) - break; - } + break; + } BssTableSortByRssi(OutTab); } - // IRQL = DISPATCH_LEVEL -VOID BssTableSortByRssi( - IN OUT BSS_TABLE *OutTab) +VOID BssTableSortByRssi(IN OUT BSS_TABLE * OutTab) { - INT i, j; + INT i, j; BSS_ENTRY TmpBss; - for (i = 0; i < OutTab->BssNr - 1; i++) - { - for (j = i+1; j < OutTab->BssNr; j++) - { - if (OutTab->BssEntry[j].Rssi > OutTab->BssEntry[i].Rssi) - { - NdisMoveMemory(&TmpBss, &OutTab->BssEntry[j], sizeof(BSS_ENTRY)); - NdisMoveMemory(&OutTab->BssEntry[j], &OutTab->BssEntry[i], sizeof(BSS_ENTRY)); - NdisMoveMemory(&OutTab->BssEntry[i], &TmpBss, sizeof(BSS_ENTRY)); - } - } - } + for (i = 0; i < OutTab->BssNr - 1; i++) { + for (j = i + 1; j < OutTab->BssNr; j++) { + if (OutTab->BssEntry[j].Rssi > OutTab->BssEntry[i].Rssi) { + NdisMoveMemory(&TmpBss, &OutTab->BssEntry[j], + sizeof(BSS_ENTRY)); + NdisMoveMemory(&OutTab->BssEntry[j], + &OutTab->BssEntry[i], + sizeof(BSS_ENTRY)); + NdisMoveMemory(&OutTab->BssEntry[i], &TmpBss, + sizeof(BSS_ENTRY)); + } + } + } } - -VOID BssCipherParse( - IN OUT PBSS_ENTRY pBss) +VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) { - PEID_STRUCT pEid; - PUCHAR pTmp; - PRSN_IE_HEADER_STRUCT pRsnHeader; - PCIPHER_SUITE_STRUCT pCipher; - PAKM_SUITE_STRUCT pAKM; - USHORT Count; - INT Length; - NDIS_802_11_ENCRYPTION_STATUS TmpCipher; + PEID_STRUCT pEid; + PUCHAR pTmp; + PRSN_IE_HEADER_STRUCT pRsnHeader; + PCIPHER_SUITE_STRUCT pCipher; + PAKM_SUITE_STRUCT pAKM; + USHORT Count; + INT Length; + NDIS_802_11_ENCRYPTION_STATUS TmpCipher; // // WepStatus will be reset later, if AP announce TKIP or AES on the beacon frame. // - if (pBss->Privacy) - { - pBss->WepStatus = Ndis802_11WEPEnabled; - } - else - { - pBss->WepStatus = Ndis802_11WEPDisabled; - } + if (pBss->Privacy) { + pBss->WepStatus = Ndis802_11WEPEnabled; + } else { + pBss->WepStatus = Ndis802_11WEPDisabled; + } // Set default to disable & open authentication before parsing variable IE - pBss->AuthMode = Ndis802_11AuthModeOpen; - pBss->AuthModeAux = Ndis802_11AuthModeOpen; + pBss->AuthMode = Ndis802_11AuthModeOpen; + pBss->AuthModeAux = Ndis802_11AuthModeOpen; // Init WPA setting - pBss->WPA.PairCipher = Ndis802_11WEPDisabled; + pBss->WPA.PairCipher = Ndis802_11WEPDisabled; pBss->WPA.PairCipherAux = Ndis802_11WEPDisabled; - pBss->WPA.GroupCipher = Ndis802_11WEPDisabled; + pBss->WPA.GroupCipher = Ndis802_11WEPDisabled; pBss->WPA.RsnCapability = 0; - pBss->WPA.bMixMode = FALSE; + pBss->WPA.bMixMode = FALSE; // Init WPA2 setting - pBss->WPA2.PairCipher = Ndis802_11WEPDisabled; + pBss->WPA2.PairCipher = Ndis802_11WEPDisabled; pBss->WPA2.PairCipherAux = Ndis802_11WEPDisabled; - pBss->WPA2.GroupCipher = Ndis802_11WEPDisabled; + pBss->WPA2.GroupCipher = Ndis802_11WEPDisabled; pBss->WPA2.RsnCapability = 0; - pBss->WPA2.bMixMode = FALSE; - + pBss->WPA2.bMixMode = FALSE; Length = (INT) pBss->VarIELen; - while (Length > 0) - { + while (Length > 0) { // Parse cipher suite base on WPA1 & WPA2, they should be parsed differently pTmp = ((PUCHAR) pBss->VarIEs) + pBss->VarIELen - Length; pEid = (PEID_STRUCT) pTmp; - switch (pEid->Eid) - { - case IE_WPA: - if (NdisEqualMemory(pEid->Octet, SES_OUI, 3) && (pEid->Len == 7)) - { - pBss->bSES = TRUE; + switch (pEid->Eid) { + case IE_WPA: + if (NdisEqualMemory(pEid->Octet, SES_OUI, 3) + && (pEid->Len == 7)) { + pBss->bSES = TRUE; + break; + } else if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4) != + 1) { + // if unsupported vendor specific IE + break; + } + // Skip OUI, version, and multicast suite + // This part should be improved in the future when AP supported multiple cipher suite. + // For now, it's OK since almost all APs have fixed cipher suite supported. + // pTmp = (PUCHAR) pEid->Octet; + pTmp += 11; + + // Cipher Suite Selectors from Spec P802.11i/D3.2 P26. + // Value Meaning + // 0 None + // 1 WEP-40 + // 2 Tkip + // 3 WRAP + // 4 AES + // 5 WEP-104 + // Parse group cipher + switch (*pTmp) { + case 1: + pBss->WPA.GroupCipher = + Ndis802_11GroupWEP40Enabled; + break; + case 5: + pBss->WPA.GroupCipher = + Ndis802_11GroupWEP104Enabled; + break; + case 2: + pBss->WPA.GroupCipher = + Ndis802_11Encryption2Enabled; + break; + case 4: + pBss->WPA.GroupCipher = + Ndis802_11Encryption3Enabled; + break; + default: + break; + } + // number of unicast suite + pTmp += 1; + + // skip all unicast cipher suites + //Count = *(PUSHORT) pTmp; + Count = (pTmp[1] << 8) + pTmp[0]; + pTmp += sizeof(USHORT); + + // Parsing all unicast cipher suite + while (Count > 0) { + // Skip OUI + pTmp += 3; + TmpCipher = Ndis802_11WEPDisabled; + switch (*pTmp) { + case 1: + case 5: // Although WEP is not allowed in WPA related auth mode, we parse it anyway + TmpCipher = + Ndis802_11Encryption1Enabled; break; - } - else if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4) != 1) - { - // if unsupported vendor specific IE + case 2: + TmpCipher = + Ndis802_11Encryption2Enabled; + break; + case 4: + TmpCipher = + Ndis802_11Encryption3Enabled; + break; + default: break; - } - // Skip OUI, version, and multicast suite - // This part should be improved in the future when AP supported multiple cipher suite. - // For now, it's OK since almost all APs have fixed cipher suite supported. - // pTmp = (PUCHAR) pEid->Octet; - pTmp += 11; - - // Cipher Suite Selectors from Spec P802.11i/D3.2 P26. - // Value Meaning - // 0 None - // 1 WEP-40 - // 2 Tkip - // 3 WRAP - // 4 AES - // 5 WEP-104 - // Parse group cipher - switch (*pTmp) - { - case 1: - pBss->WPA.GroupCipher = Ndis802_11GroupWEP40Enabled; - break; - case 5: - pBss->WPA.GroupCipher = Ndis802_11GroupWEP104Enabled; - break; - case 2: - pBss->WPA.GroupCipher = Ndis802_11Encryption2Enabled; - break; - case 4: - pBss->WPA.GroupCipher = Ndis802_11Encryption3Enabled; - break; - default: - break; } - // number of unicast suite - pTmp += 1; - - // skip all unicast cipher suites - //Count = *(PUSHORT) pTmp; - Count = (pTmp[1]<<8) + pTmp[0]; - pTmp += sizeof(USHORT); - - // Parsing all unicast cipher suite - while (Count > 0) - { - // Skip OUI - pTmp += 3; - TmpCipher = Ndis802_11WEPDisabled; - switch (*pTmp) - { - case 1: - case 5: // Although WEP is not allowed in WPA related auth mode, we parse it anyway - TmpCipher = Ndis802_11Encryption1Enabled; - break; - case 2: - TmpCipher = Ndis802_11Encryption2Enabled; - break; - case 4: - TmpCipher = Ndis802_11Encryption3Enabled; - break; - default: - break; - } - if (TmpCipher > pBss->WPA.PairCipher) - { - // Move the lower cipher suite to PairCipherAux - pBss->WPA.PairCipherAux = pBss->WPA.PairCipher; - pBss->WPA.PairCipher = TmpCipher; - } - else - { - pBss->WPA.PairCipherAux = TmpCipher; - } - pTmp++; - Count--; - } - - // 4. get AKM suite counts - //Count = *(PUSHORT) pTmp; - Count = (pTmp[1]<<8) + pTmp[0]; - pTmp += sizeof(USHORT); - pTmp += 3; + if (TmpCipher > pBss->WPA.PairCipher) { + // Move the lower cipher suite to PairCipherAux + pBss->WPA.PairCipherAux = + pBss->WPA.PairCipher; + pBss->WPA.PairCipher = TmpCipher; + } else { + pBss->WPA.PairCipherAux = TmpCipher; + } + pTmp++; + Count--; + } - switch (*pTmp) - { - case 1: - // Set AP support WPA-enterprise mode - if (pBss->AuthMode == Ndis802_11AuthModeOpen) - pBss->AuthMode = Ndis802_11AuthModeWPA; - else - pBss->AuthModeAux = Ndis802_11AuthModeWPA; - break; - case 2: - // Set AP support WPA-PSK mode - if (pBss->AuthMode == Ndis802_11AuthModeOpen) - pBss->AuthMode = Ndis802_11AuthModeWPAPSK; - else - pBss->AuthModeAux = Ndis802_11AuthModeWPAPSK; - break; - default: - break; - } - pTmp += 1; + // 4. get AKM suite counts + //Count = *(PUSHORT) pTmp; + Count = (pTmp[1] << 8) + pTmp[0]; + pTmp += sizeof(USHORT); + pTmp += 3; + + switch (*pTmp) { + case 1: + // Set AP support WPA-enterprise mode + if (pBss->AuthMode == Ndis802_11AuthModeOpen) + pBss->AuthMode = Ndis802_11AuthModeWPA; + else + pBss->AuthModeAux = + Ndis802_11AuthModeWPA; + break; + case 2: + // Set AP support WPA-PSK mode + if (pBss->AuthMode == Ndis802_11AuthModeOpen) + pBss->AuthMode = + Ndis802_11AuthModeWPAPSK; + else + pBss->AuthModeAux = + Ndis802_11AuthModeWPAPSK; + break; + default: + break; + } + pTmp += 1; + + // Fixed for WPA-None + if (pBss->BssType == BSS_ADHOC) { + pBss->AuthMode = Ndis802_11AuthModeWPANone; + pBss->AuthModeAux = Ndis802_11AuthModeWPANone; + pBss->WepStatus = pBss->WPA.GroupCipher; + // Patched bugs for old driver + if (pBss->WPA.PairCipherAux == + Ndis802_11WEPDisabled) + pBss->WPA.PairCipherAux = + pBss->WPA.GroupCipher; + } else + pBss->WepStatus = pBss->WPA.PairCipher; + + // Check the Pair & Group, if different, turn on mixed mode flag + if (pBss->WPA.GroupCipher != pBss->WPA.PairCipher) + pBss->WPA.bMixMode = TRUE; - // Fixed for WPA-None - if (pBss->BssType == BSS_ADHOC) - { - pBss->AuthMode = Ndis802_11AuthModeWPANone; - pBss->AuthModeAux = Ndis802_11AuthModeWPANone; - pBss->WepStatus = pBss->WPA.GroupCipher; - // Patched bugs for old driver - if (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled) - pBss->WPA.PairCipherAux = pBss->WPA.GroupCipher; - } - else - pBss->WepStatus = pBss->WPA.PairCipher; + break; - // Check the Pair & Group, if different, turn on mixed mode flag - if (pBss->WPA.GroupCipher != pBss->WPA.PairCipher) - pBss->WPA.bMixMode = TRUE; + case IE_RSN: + pRsnHeader = (PRSN_IE_HEADER_STRUCT) pTmp; + // 0. Version must be 1 + if (le2cpu16(pRsnHeader->Version) != 1) break; + pTmp += sizeof(RSN_IE_HEADER_STRUCT); - case IE_RSN: - pRsnHeader = (PRSN_IE_HEADER_STRUCT) pTmp; - - // 0. Version must be 1 - if (le2cpu16(pRsnHeader->Version) != 1) - break; - pTmp += sizeof(RSN_IE_HEADER_STRUCT); + // 1. Check group cipher + pCipher = (PCIPHER_SUITE_STRUCT) pTmp; + if (!RTMPEqualMemory(pTmp, RSN_OUI, 3)) + break; - // 1. Check group cipher + // Parse group cipher + switch (pCipher->Type) { + case 1: + pBss->WPA2.GroupCipher = + Ndis802_11GroupWEP40Enabled; + break; + case 5: + pBss->WPA2.GroupCipher = + Ndis802_11GroupWEP104Enabled; + break; + case 2: + pBss->WPA2.GroupCipher = + Ndis802_11Encryption2Enabled; + break; + case 4: + pBss->WPA2.GroupCipher = + Ndis802_11Encryption3Enabled; + break; + default: + break; + } + // set to correct offset for next parsing + pTmp += sizeof(CIPHER_SUITE_STRUCT); + + // 2. Get pairwise cipher counts + //Count = *(PUSHORT) pTmp; + Count = (pTmp[1] << 8) + pTmp[0]; + pTmp += sizeof(USHORT); + + // 3. Get pairwise cipher + // Parsing all unicast cipher suite + while (Count > 0) { + // Skip OUI pCipher = (PCIPHER_SUITE_STRUCT) pTmp; - if (!RTMPEqualMemory(pTmp, RSN_OUI, 3)) - break; - - // Parse group cipher - switch (pCipher->Type) - { - case 1: - pBss->WPA2.GroupCipher = Ndis802_11GroupWEP40Enabled; - break; - case 5: - pBss->WPA2.GroupCipher = Ndis802_11GroupWEP104Enabled; - break; - case 2: - pBss->WPA2.GroupCipher = Ndis802_11Encryption2Enabled; - break; - case 4: - pBss->WPA2.GroupCipher = Ndis802_11Encryption3Enabled; - break; - default: - break; + TmpCipher = Ndis802_11WEPDisabled; + switch (pCipher->Type) { + case 1: + case 5: // Although WEP is not allowed in WPA related auth mode, we parse it anyway + TmpCipher = + Ndis802_11Encryption1Enabled; + break; + case 2: + TmpCipher = + Ndis802_11Encryption2Enabled; + break; + case 4: + TmpCipher = + Ndis802_11Encryption3Enabled; + break; + default: + break; } - // set to correct offset for next parsing - pTmp += sizeof(CIPHER_SUITE_STRUCT); - - // 2. Get pairwise cipher counts - //Count = *(PUSHORT) pTmp; - Count = (pTmp[1]<<8) + pTmp[0]; - pTmp += sizeof(USHORT); - - // 3. Get pairwise cipher - // Parsing all unicast cipher suite - while (Count > 0) - { - // Skip OUI - pCipher = (PCIPHER_SUITE_STRUCT) pTmp; - TmpCipher = Ndis802_11WEPDisabled; - switch (pCipher->Type) - { - case 1: - case 5: // Although WEP is not allowed in WPA related auth mode, we parse it anyway - TmpCipher = Ndis802_11Encryption1Enabled; - break; - case 2: - TmpCipher = Ndis802_11Encryption2Enabled; - break; - case 4: - TmpCipher = Ndis802_11Encryption3Enabled; - break; - default: - break; - } - if (TmpCipher > pBss->WPA2.PairCipher) - { - // Move the lower cipher suite to PairCipherAux - pBss->WPA2.PairCipherAux = pBss->WPA2.PairCipher; - pBss->WPA2.PairCipher = TmpCipher; - } - else - { - pBss->WPA2.PairCipherAux = TmpCipher; - } - pTmp += sizeof(CIPHER_SUITE_STRUCT); - Count--; - } + if (TmpCipher > pBss->WPA2.PairCipher) { + // Move the lower cipher suite to PairCipherAux + pBss->WPA2.PairCipherAux = + pBss->WPA2.PairCipher; + pBss->WPA2.PairCipher = TmpCipher; + } else { + pBss->WPA2.PairCipherAux = TmpCipher; + } + pTmp += sizeof(CIPHER_SUITE_STRUCT); + Count--; + } - // 4. get AKM suite counts - //Count = *(PUSHORT) pTmp; - Count = (pTmp[1]<<8) + pTmp[0]; - pTmp += sizeof(USHORT); + // 4. get AKM suite counts + //Count = *(PUSHORT) pTmp; + Count = (pTmp[1] << 8) + pTmp[0]; + pTmp += sizeof(USHORT); - // 5. Get AKM ciphers - // Parsing all AKM ciphers - while (Count > 0) - { - pAKM = (PAKM_SUITE_STRUCT) pTmp; - if (!RTMPEqualMemory(pTmp, RSN_OUI, 3)) - break; + // 5. Get AKM ciphers + // Parsing all AKM ciphers + while (Count > 0) { + pAKM = (PAKM_SUITE_STRUCT) pTmp; + if (!RTMPEqualMemory(pTmp, RSN_OUI, 3)) + break; - switch (pAKM->Type) - { - case 1: - // Set AP support WPA-enterprise mode - if (pBss->AuthMode == Ndis802_11AuthModeOpen) - pBss->AuthMode = Ndis802_11AuthModeWPA2; - else - pBss->AuthModeAux = Ndis802_11AuthModeWPA2; - break; - case 2: - // Set AP support WPA-PSK mode - if (pBss->AuthMode == Ndis802_11AuthModeOpen) - pBss->AuthMode = Ndis802_11AuthModeWPA2PSK; - else - pBss->AuthModeAux = Ndis802_11AuthModeWPA2PSK; - break; - default: - if (pBss->AuthMode == Ndis802_11AuthModeOpen) - pBss->AuthMode = Ndis802_11AuthModeMax; - else - pBss->AuthModeAux = Ndis802_11AuthModeMax; - break; + switch (pAKM->Type) { + case 1: + // Set AP support WPA-enterprise mode + if (pBss->AuthMode == + Ndis802_11AuthModeOpen) + pBss->AuthMode = + Ndis802_11AuthModeWPA2; + else + pBss->AuthModeAux = + Ndis802_11AuthModeWPA2; + break; + case 2: + // Set AP support WPA-PSK mode + if (pBss->AuthMode == + Ndis802_11AuthModeOpen) + pBss->AuthMode = + Ndis802_11AuthModeWPA2PSK; + else + pBss->AuthModeAux = + Ndis802_11AuthModeWPA2PSK; + break; + default: + if (pBss->AuthMode == + Ndis802_11AuthModeOpen) + pBss->AuthMode = + Ndis802_11AuthModeMax; + else + pBss->AuthModeAux = + Ndis802_11AuthModeMax; + break; } - pTmp += (Count * sizeof(AKM_SUITE_STRUCT)); - Count--; + pTmp += (Count * sizeof(AKM_SUITE_STRUCT)); + Count--; } - // Fixed for WPA-None - if (pBss->BssType == BSS_ADHOC) - { - pBss->AuthMode = Ndis802_11AuthModeWPANone; - pBss->AuthModeAux = Ndis802_11AuthModeWPANone; - pBss->WPA.PairCipherAux = pBss->WPA2.PairCipherAux; - pBss->WPA.GroupCipher = pBss->WPA2.GroupCipher; - pBss->WepStatus = pBss->WPA.GroupCipher; - // Patched bugs for old driver - if (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled) - pBss->WPA.PairCipherAux = pBss->WPA.GroupCipher; - } - pBss->WepStatus = pBss->WPA2.PairCipher; + // Fixed for WPA-None + if (pBss->BssType == BSS_ADHOC) { + pBss->AuthMode = Ndis802_11AuthModeWPANone; + pBss->AuthModeAux = Ndis802_11AuthModeWPANone; + pBss->WPA.PairCipherAux = + pBss->WPA2.PairCipherAux; + pBss->WPA.GroupCipher = pBss->WPA2.GroupCipher; + pBss->WepStatus = pBss->WPA.GroupCipher; + // Patched bugs for old driver + if (pBss->WPA.PairCipherAux == + Ndis802_11WEPDisabled) + pBss->WPA.PairCipherAux = + pBss->WPA.GroupCipher; + } + pBss->WepStatus = pBss->WPA2.PairCipher; - // 6. Get RSN capability - //pBss->WPA2.RsnCapability = *(PUSHORT) pTmp; - pBss->WPA2.RsnCapability = (pTmp[1]<<8) + pTmp[0]; - pTmp += sizeof(USHORT); + // 6. Get RSN capability + //pBss->WPA2.RsnCapability = *(PUSHORT) pTmp; + pBss->WPA2.RsnCapability = (pTmp[1] << 8) + pTmp[0]; + pTmp += sizeof(USHORT); - // Check the Pair & Group, if different, turn on mixed mode flag - if (pBss->WPA2.GroupCipher != pBss->WPA2.PairCipher) - pBss->WPA2.bMixMode = TRUE; + // Check the Pair & Group, if different, turn on mixed mode flag + if (pBss->WPA2.GroupCipher != pBss->WPA2.PairCipher) + pBss->WPA2.bMixMode = TRUE; - break; - default: - break; + break; + default: + break; } Length -= (pEid->Len + 2); } @@ -4419,18 +4549,15 @@ VOID BssCipherParse( * \pre * \post */ -VOID MacAddrRandomBssid( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pAddr) +VOID MacAddrRandomBssid(IN PRTMP_ADAPTER pAd, OUT PUCHAR pAddr) { INT i; - for (i = 0; i < MAC_ADDR_LEN; i++) - { + for (i = 0; i < MAC_ADDR_LEN; i++) { pAddr[i] = RandomByte(pAd); } - pAddr[0] = (pAddr[0] & 0xfe) | 0x02; // the first 2 bits must be 01xxxxxxxx + pAddr[0] = (pAddr[0] & 0xfe) | 0x02; // the first 2 bits must be 01xxxxxxxx } /*! \brief init the management mac frame header @@ -4448,23 +4575,20 @@ VOID MacAddrRandomBssid( IRQL = DISPATCH_LEVEL */ -VOID MgtMacHeaderInit( - IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, - IN UCHAR SubType, - IN UCHAR ToDs, - IN PUCHAR pDA, - IN PUCHAR pBssid) +VOID MgtMacHeaderInit(IN PRTMP_ADAPTER pAd, + IN OUT PHEADER_802_11 pHdr80211, + IN UCHAR SubType, + IN UCHAR ToDs, IN PUCHAR pDA, IN PUCHAR pBssid) { NdisZeroMemory(pHdr80211, sizeof(HEADER_802_11)); pHdr80211->FC.Type = BTYPE_MGMT; pHdr80211->FC.SubType = SubType; -// if (SubType == SUBTYPE_ACK) // sample, no use, it will conflict with ACTION frame sub type -// pHdr80211->FC.Type = BTYPE_CNTL; +// if (SubType == SUBTYPE_ACK) // sample, no use, it will conflict with ACTION frame sub type +// pHdr80211->FC.Type = BTYPE_CNTL; pHdr80211->FC.ToDs = ToDs; COPY_MAC_ADDR(pHdr80211->Addr1, pDA); - COPY_MAC_ADDR(pHdr80211->Addr2, pAd->CurrentAddress); + COPY_MAC_ADDR(pHdr80211->Addr2, pAd->CurrentAddress); COPY_MAC_ADDR(pHdr80211->Addr3, pBssid); } @@ -4490,31 +4614,27 @@ VOID MgtMacHeaderInit( IRQL = DISPATCH_LEVEL ****************************************************************************/ -ULONG MakeOutgoingFrame( - OUT UCHAR *Buffer, - OUT ULONG *FrameLen, ...) +ULONG MakeOutgoingFrame(OUT UCHAR * Buffer, OUT ULONG * FrameLen, ...) { - UCHAR *p; - int leng; - ULONG TotLeng; + UCHAR *p; + int leng; + ULONG TotLeng; va_list Args; // calculates the total length TotLeng = 0; va_start(Args, FrameLen); - do - { + do { leng = va_arg(Args, int); - if (leng == END_OF_ARGS) - { + if (leng == END_OF_ARGS) { break; - } + } p = va_arg(Args, PVOID); NdisMoveMemory(&Buffer[TotLeng], p, leng); TotLeng = TotLeng + leng; - } while(TRUE); + } while (TRUE); - va_end(Args); /* clean up */ + va_end(Args); /* clean up */ *FrameLen = TotLeng; return TotLeng; } @@ -4533,19 +4653,17 @@ ULONG MakeOutgoingFrame( IRQL = PASSIVE_LEVEL */ -NDIS_STATUS MlmeQueueInit( - IN MLME_QUEUE *Queue) +NDIS_STATUS MlmeQueueInit(IN MLME_QUEUE * Queue) { INT i; NdisAllocateSpinLock(&Queue->Lock); - Queue->Num = 0; + Queue->Num = 0; Queue->Head = 0; Queue->Tail = 0; - for (i = 0; i < MAX_LEN_OF_MLME_QUEUE; i++) - { + for (i = 0; i < MAX_LEN_OF_MLME_QUEUE; i++) { Queue->Entry[i].Occupied = FALSE; Queue->Entry[i].MsgLen = 0; NdisZeroMemory(Queue->Entry[i].Msg, MGMT_DMA_BUFFER_SIZE); @@ -4569,52 +4687,47 @@ NDIS_STATUS MlmeQueueInit( IRQL = DISPATCH_LEVEL */ -BOOLEAN MlmeEnqueue( - IN PRTMP_ADAPTER pAd, - IN ULONG Machine, - IN ULONG MsgType, - IN ULONG MsgLen, - IN VOID *Msg) +BOOLEAN MlmeEnqueue(IN PRTMP_ADAPTER pAd, + IN ULONG Machine, + IN ULONG MsgType, IN ULONG MsgLen, IN VOID * Msg) { INT Tail; - MLME_QUEUE *Queue = (MLME_QUEUE *)&pAd->Mlme.Queue; + MLME_QUEUE *Queue = (MLME_QUEUE *) & pAd->Mlme.Queue; // Do nothing if the driver is starting halt state. // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + if (RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return FALSE; // First check the size, it MUST not exceed the mlme queue size - if (MsgLen > MGMT_DMA_BUFFER_SIZE) - { - DBGPRINT_ERR(("MlmeEnqueue: msg too large, size = %ld \n", MsgLen)); + if (MsgLen > MGMT_DMA_BUFFER_SIZE) { + DBGPRINT_ERR(("MlmeEnqueue: msg too large, size = %ld \n", + MsgLen)); return FALSE; } - if (MlmeQueueFull(Queue)) - { + if (MlmeQueueFull(Queue)) { return FALSE; - } + } NdisAcquireSpinLock(&(Queue->Lock)); Tail = Queue->Tail; Queue->Tail++; Queue->Num++; - if (Queue->Tail == MAX_LEN_OF_MLME_QUEUE) - { + if (Queue->Tail == MAX_LEN_OF_MLME_QUEUE) { Queue->Tail = 0; - } + } Queue->Entry[Tail].Wcid = RESERVED_WCID; Queue->Entry[Tail].Occupied = TRUE; Queue->Entry[Tail].Machine = Machine; Queue->Entry[Tail].MsgType = MsgType; - Queue->Entry[Tail].MsgLen = MsgLen; + Queue->Entry[Tail].MsgLen = MsgLen; - if (Msg != NULL) - { + if (Msg != NULL) { NdisMoveMemory(Queue->Entry[Tail].Msg, Msg, MsgLen); - } + } NdisReleaseSpinLock(&(Queue->Lock)); return TRUE; @@ -4634,77 +4747,68 @@ BOOLEAN MlmeEnqueue( IRQL = DISPATCH_LEVEL */ -BOOLEAN MlmeEnqueueForRecv( - IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN ULONG TimeStampHigh, - IN ULONG TimeStampLow, - IN UCHAR Rssi0, - IN UCHAR Rssi1, - IN UCHAR Rssi2, - IN ULONG MsgLen, - IN VOID *Msg, - IN UCHAR Signal) +BOOLEAN MlmeEnqueueForRecv(IN PRTMP_ADAPTER pAd, + IN ULONG Wcid, + IN ULONG TimeStampHigh, + IN ULONG TimeStampLow, + IN UCHAR Rssi0, + IN UCHAR Rssi1, + IN UCHAR Rssi2, + IN ULONG MsgLen, IN VOID * Msg, IN UCHAR Signal) { - INT Tail, Machine; - PFRAME_802_11 pFrame = (PFRAME_802_11)Msg; - INT MsgType; - MLME_QUEUE *Queue = (MLME_QUEUE *)&pAd->Mlme.Queue; - + INT Tail, Machine; + PFRAME_802_11 pFrame = (PFRAME_802_11) Msg; + INT MsgType; + MLME_QUEUE *Queue = (MLME_QUEUE *) & pAd->Mlme.Queue; // Do nothing if the driver is starting halt state. // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) - { + if (RTMP_TEST_FLAG + (pAd, + fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) { DBGPRINT_ERR(("MlmeEnqueueForRecv: fRTMP_ADAPTER_HALT_IN_PROGRESS\n")); return FALSE; } - // First check the size, it MUST not exceed the mlme queue size - if (MsgLen > MGMT_DMA_BUFFER_SIZE) - { + if (MsgLen > MGMT_DMA_BUFFER_SIZE) { DBGPRINT_ERR(("MlmeEnqueueForRecv: frame too large, size = %ld \n", MsgLen)); return FALSE; } - if (MlmeQueueFull(Queue)) - { + if (MlmeQueueFull(Queue)) { return FALSE; } - { - if (!MsgTypeSubst(pAd, pFrame, &Machine, &MsgType)) - { - DBGPRINT_ERR(("MlmeEnqueueForRecv: un-recongnized mgmt->subtype=%d\n",pFrame->Hdr.FC.SubType)); + { + if (!MsgTypeSubst(pAd, pFrame, &Machine, &MsgType)) { + DBGPRINT_ERR(("MlmeEnqueueForRecv: un-recongnized mgmt->subtype=%d\n", pFrame->Hdr.FC.SubType)); return FALSE; - } } + } // OK, we got all the informations, it is time to put things into queue NdisAcquireSpinLock(&(Queue->Lock)); Tail = Queue->Tail; Queue->Tail++; Queue->Num++; - if (Queue->Tail == MAX_LEN_OF_MLME_QUEUE) - { + if (Queue->Tail == MAX_LEN_OF_MLME_QUEUE) { Queue->Tail = 0; - } + } Queue->Entry[Tail].Occupied = TRUE; Queue->Entry[Tail].Machine = Machine; Queue->Entry[Tail].MsgType = MsgType; - Queue->Entry[Tail].MsgLen = MsgLen; + Queue->Entry[Tail].MsgLen = MsgLen; Queue->Entry[Tail].TimeStamp.u.LowPart = TimeStampLow; Queue->Entry[Tail].TimeStamp.u.HighPart = TimeStampHigh; Queue->Entry[Tail].Rssi0 = Rssi0; Queue->Entry[Tail].Rssi1 = Rssi1; Queue->Entry[Tail].Rssi2 = Rssi2; Queue->Entry[Tail].Signal = Signal; - Queue->Entry[Tail].Wcid = (UCHAR)Wcid; + Queue->Entry[Tail].Wcid = (UCHAR) Wcid; Queue->Entry[Tail].Channel = pAd->LatchRfRegs.Channel; - if (Msg != NULL) - { + if (Msg != NULL) { NdisMoveMemory(Queue->Entry[Tail].Msg, Msg, MsgLen); } @@ -4715,7 +4819,6 @@ BOOLEAN MlmeEnqueueForRecv( return TRUE; } - /*! \brief Dequeue a message from the MLME Queue * \param *Queue The MLME Queue * \param *Elem The message dequeued from MLME Queue @@ -4726,16 +4829,13 @@ BOOLEAN MlmeEnqueueForRecv( IRQL = DISPATCH_LEVEL */ -BOOLEAN MlmeDequeue( - IN MLME_QUEUE *Queue, - OUT MLME_QUEUE_ELEM **Elem) +BOOLEAN MlmeDequeue(IN MLME_QUEUE * Queue, OUT MLME_QUEUE_ELEM ** Elem) { NdisAcquireSpinLock(&(Queue->Lock)); *Elem = &(Queue->Entry[Queue->Head]); Queue->Num--; Queue->Head++; - if (Queue->Head == MAX_LEN_OF_MLME_QUEUE) - { + if (Queue->Head == MAX_LEN_OF_MLME_QUEUE) { Queue->Head = 0; } NdisReleaseSpinLock(&(Queue->Lock)); @@ -4743,55 +4843,48 @@ BOOLEAN MlmeDequeue( } // IRQL = DISPATCH_LEVEL -VOID MlmeRestartStateMachine( - IN PRTMP_ADAPTER pAd) +VOID MlmeRestartStateMachine(IN PRTMP_ADAPTER pAd) { #ifdef RTMP_MAC_PCI - MLME_QUEUE_ELEM *Elem = NULL; + MLME_QUEUE_ELEM *Elem = NULL; #endif // RTMP_MAC_PCI // - BOOLEAN Cancelled; + BOOLEAN Cancelled; DBGPRINT(RT_DEBUG_TRACE, ("MlmeRestartStateMachine \n")); #ifdef RTMP_MAC_PCI NdisAcquireSpinLock(&pAd->Mlme.TaskLock); - if(pAd->Mlme.bRunning) - { + if (pAd->Mlme.bRunning) { NdisReleaseSpinLock(&pAd->Mlme.TaskLock); return; - } - else - { + } else { pAd->Mlme.bRunning = TRUE; } NdisReleaseSpinLock(&pAd->Mlme.TaskLock); // Remove all Mlme queues elements - while (!MlmeQueueEmpty(&pAd->Mlme.Queue)) - { + while (!MlmeQueueEmpty(&pAd->Mlme.Queue)) { //From message type, determine which state machine I should drive - if (MlmeDequeue(&pAd->Mlme.Queue, &Elem)) - { + if (MlmeDequeue(&pAd->Mlme.Queue, &Elem)) { // free MLME element Elem->Occupied = FALSE; Elem->MsgLen = 0; - } - else { + } else { DBGPRINT_ERR(("MlmeRestartStateMachine: MlmeQueue empty\n")); - } + } } #endif // RTMP_MAC_PCI // { // Cancel all timer events // Be careful to cancel new added timer - RTMPCancelTimer(&pAd->MlmeAux.AssocTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.ReassocTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.DisassocTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.AuthTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &Cancelled); - RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &Cancelled); + RTMPCancelTimer(&pAd->MlmeAux.AssocTimer, &Cancelled); + RTMPCancelTimer(&pAd->MlmeAux.ReassocTimer, &Cancelled); + RTMPCancelTimer(&pAd->MlmeAux.DisassocTimer, &Cancelled); + RTMPCancelTimer(&pAd->MlmeAux.AuthTimer, &Cancelled); + RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &Cancelled); + RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &Cancelled); } @@ -4804,12 +4897,12 @@ VOID MlmeRestartStateMachine( { // Set all state machines back IDLE - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; + pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; + pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; + pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; pAd->Mlme.AuthRspMachine.CurrState = AUTH_RSP_IDLE; - pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; - pAd->Mlme.ActMachine.CurrState = ACT_IDLE; + pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; + pAd->Mlme.ActMachine.CurrState = ACT_IDLE; } #ifdef RTMP_MAC_PCI @@ -4829,8 +4922,7 @@ VOID MlmeRestartStateMachine( IRQL = DISPATCH_LEVEL */ -BOOLEAN MlmeQueueEmpty( - IN MLME_QUEUE *Queue) +BOOLEAN MlmeQueueEmpty(IN MLME_QUEUE * Queue) { BOOLEAN Ans; @@ -4851,13 +4943,13 @@ BOOLEAN MlmeQueueEmpty( IRQL = DISPATCH_LEVEL */ -BOOLEAN MlmeQueueFull( - IN MLME_QUEUE *Queue) +BOOLEAN MlmeQueueFull(IN MLME_QUEUE * Queue) { BOOLEAN Ans; NdisAcquireSpinLock(&(Queue->Lock)); - Ans = (Queue->Num == MAX_LEN_OF_MLME_QUEUE || Queue->Entry[Queue->Tail].Occupied); + Ans = (Queue->Num == MAX_LEN_OF_MLME_QUEUE + || Queue->Entry[Queue->Tail].Occupied); NdisReleaseSpinLock(&(Queue->Lock)); return Ans; @@ -4873,18 +4965,16 @@ BOOLEAN MlmeQueueFull( IRQL = PASSIVE_LEVEL */ -VOID MlmeQueueDestroy( - IN MLME_QUEUE *pQueue) +VOID MlmeQueueDestroy(IN MLME_QUEUE * pQueue) { NdisAcquireSpinLock(&(pQueue->Lock)); - pQueue->Num = 0; + pQueue->Num = 0; pQueue->Head = 0; pQueue->Tail = 0; NdisReleaseSpinLock(&(pQueue->Lock)); NdisFreeSpinLock(&(pQueue->Lock)); } - /*! \brief To substitute the message type if the message is coming from external * \param pFrame The frame received * \param *Machine The state machine @@ -4896,108 +4986,97 @@ VOID MlmeQueueDestroy( IRQL = DISPATCH_LEVEL */ -BOOLEAN MsgTypeSubst( - IN PRTMP_ADAPTER pAd, - IN PFRAME_802_11 pFrame, - OUT INT *Machine, - OUT INT *MsgType) +BOOLEAN MsgTypeSubst(IN PRTMP_ADAPTER pAd, + IN PFRAME_802_11 pFrame, + OUT INT * Machine, OUT INT * MsgType) { - USHORT Seq, Alg; - UCHAR EAPType; - PUCHAR pData; + USHORT Seq, Alg; + UCHAR EAPType; + PUCHAR pData; // Pointer to start of data frames including SNAP header pData = (PUCHAR) pFrame + LENGTH_802_11; // The only data type will pass to this function is EAPOL frame - if (pFrame->Hdr.FC.Type == BTYPE_DATA) - { + if (pFrame->Hdr.FC.Type == BTYPE_DATA) { { - *Machine = WPA_STATE_MACHINE; - EAPType = *((UCHAR*)pFrame + LENGTH_802_11 + LENGTH_802_1_H + 1); - return (WpaMsgTypeSubst(EAPType, (INT *) MsgType)); + *Machine = WPA_STATE_MACHINE; + EAPType = + *((UCHAR *) pFrame + LENGTH_802_11 + + LENGTH_802_1_H + 1); + return (WpaMsgTypeSubst(EAPType, (INT *) MsgType)); } } - switch (pFrame->Hdr.FC.SubType) - { - case SUBTYPE_ASSOC_REQ: - *Machine = ASSOC_STATE_MACHINE; - *MsgType = MT2_PEER_ASSOC_REQ; - break; - case SUBTYPE_ASSOC_RSP: - *Machine = ASSOC_STATE_MACHINE; - *MsgType = MT2_PEER_ASSOC_RSP; - break; - case SUBTYPE_REASSOC_REQ: - *Machine = ASSOC_STATE_MACHINE; - *MsgType = MT2_PEER_REASSOC_REQ; - break; - case SUBTYPE_REASSOC_RSP: - *Machine = ASSOC_STATE_MACHINE; - *MsgType = MT2_PEER_REASSOC_RSP; - break; - case SUBTYPE_PROBE_REQ: - *Machine = SYNC_STATE_MACHINE; - *MsgType = MT2_PEER_PROBE_REQ; - break; - case SUBTYPE_PROBE_RSP: - *Machine = SYNC_STATE_MACHINE; - *MsgType = MT2_PEER_PROBE_RSP; - break; - case SUBTYPE_BEACON: - *Machine = SYNC_STATE_MACHINE; - *MsgType = MT2_PEER_BEACON; - break; - case SUBTYPE_ATIM: - *Machine = SYNC_STATE_MACHINE; - *MsgType = MT2_PEER_ATIM; - break; - case SUBTYPE_DISASSOC: - *Machine = ASSOC_STATE_MACHINE; - *MsgType = MT2_PEER_DISASSOC_REQ; - break; - case SUBTYPE_AUTH: - // get the sequence number from payload 24 Mac Header + 2 bytes algorithm - NdisMoveMemory(&Seq, &pFrame->Octet[2], sizeof(USHORT)); - NdisMoveMemory(&Alg, &pFrame->Octet[0], sizeof(USHORT)); - if (Seq == 1 || Seq == 3) - { - *Machine = AUTH_RSP_STATE_MACHINE; - *MsgType = MT2_PEER_AUTH_ODD; - } - else if (Seq == 2 || Seq == 4) - { - if (Alg == AUTH_MODE_OPEN || Alg == AUTH_MODE_KEY) - { - *Machine = AUTH_STATE_MACHINE; - *MsgType = MT2_PEER_AUTH_EVEN; - } - } - else - { - return FALSE; - } - break; - case SUBTYPE_DEAUTH: + switch (pFrame->Hdr.FC.SubType) { + case SUBTYPE_ASSOC_REQ: + *Machine = ASSOC_STATE_MACHINE; + *MsgType = MT2_PEER_ASSOC_REQ; + break; + case SUBTYPE_ASSOC_RSP: + *Machine = ASSOC_STATE_MACHINE; + *MsgType = MT2_PEER_ASSOC_RSP; + break; + case SUBTYPE_REASSOC_REQ: + *Machine = ASSOC_STATE_MACHINE; + *MsgType = MT2_PEER_REASSOC_REQ; + break; + case SUBTYPE_REASSOC_RSP: + *Machine = ASSOC_STATE_MACHINE; + *MsgType = MT2_PEER_REASSOC_RSP; + break; + case SUBTYPE_PROBE_REQ: + *Machine = SYNC_STATE_MACHINE; + *MsgType = MT2_PEER_PROBE_REQ; + break; + case SUBTYPE_PROBE_RSP: + *Machine = SYNC_STATE_MACHINE; + *MsgType = MT2_PEER_PROBE_RSP; + break; + case SUBTYPE_BEACON: + *Machine = SYNC_STATE_MACHINE; + *MsgType = MT2_PEER_BEACON; + break; + case SUBTYPE_ATIM: + *Machine = SYNC_STATE_MACHINE; + *MsgType = MT2_PEER_ATIM; + break; + case SUBTYPE_DISASSOC: + *Machine = ASSOC_STATE_MACHINE; + *MsgType = MT2_PEER_DISASSOC_REQ; + break; + case SUBTYPE_AUTH: + // get the sequence number from payload 24 Mac Header + 2 bytes algorithm + NdisMoveMemory(&Seq, &pFrame->Octet[2], sizeof(USHORT)); + NdisMoveMemory(&Alg, &pFrame->Octet[0], sizeof(USHORT)); + if (Seq == 1 || Seq == 3) { *Machine = AUTH_RSP_STATE_MACHINE; - *MsgType = MT2_PEER_DEAUTH; - break; - case SUBTYPE_ACTION: - *Machine = ACTION_STATE_MACHINE; - // Sometimes Sta will return with category bytes with MSB = 1, if they receive catogory out of their support - if ((pFrame->Octet[0]&0x7F) > MAX_PEER_CATE_MSG) - { - *MsgType = MT2_ACT_INVALID; + *MsgType = MT2_PEER_AUTH_ODD; + } else if (Seq == 2 || Seq == 4) { + if (Alg == AUTH_MODE_OPEN || Alg == AUTH_MODE_KEY) { + *Machine = AUTH_STATE_MACHINE; + *MsgType = MT2_PEER_AUTH_EVEN; + } + } else { + return FALSE; } - else - { - *MsgType = (pFrame->Octet[0]&0x7F); + break; + case SUBTYPE_DEAUTH: + *Machine = AUTH_RSP_STATE_MACHINE; + *MsgType = MT2_PEER_DEAUTH; + break; + case SUBTYPE_ACTION: + *Machine = ACTION_STATE_MACHINE; + // Sometimes Sta will return with category bytes with MSB = 1, if they receive catogory out of their support + if ((pFrame->Octet[0] & 0x7F) > MAX_PEER_CATE_MSG) { + *MsgType = MT2_ACT_INVALID; + } else { + *MsgType = (pFrame->Octet[0] & 0x7F); } - break; - default: - return FALSE; - break; + break; + default: + return FALSE; + break; } return TRUE; @@ -5021,29 +5100,25 @@ BOOLEAN MsgTypeSubst( IRQL = PASSIVE_LEVEL */ -VOID StateMachineInit( - IN STATE_MACHINE *S, - IN STATE_MACHINE_FUNC Trans[], - IN ULONG StNr, - IN ULONG MsgNr, - IN STATE_MACHINE_FUNC DefFunc, - IN ULONG InitState, - IN ULONG Base) +VOID StateMachineInit(IN STATE_MACHINE * S, + IN STATE_MACHINE_FUNC Trans[], + IN ULONG StNr, + IN ULONG MsgNr, + IN STATE_MACHINE_FUNC DefFunc, + IN ULONG InitState, IN ULONG Base) { ULONG i, j; // set number of states and messages S->NrState = StNr; - S->NrMsg = MsgNr; - S->Base = Base; + S->NrMsg = MsgNr; + S->Base = Base; - S->TransFunc = Trans; + S->TransFunc = Trans; // init all state transition to default function - for (i = 0; i < StNr; i++) - { - for (j = 0; j < MsgNr; j++) - { + for (i = 0; i < StNr; i++) { + for (j = 0; j < MsgNr; j++) { S->TransFunc[i * MsgNr + j] = DefFunc; } } @@ -5063,18 +5138,15 @@ VOID StateMachineInit( IRQL = PASSIVE_LEVEL */ -VOID StateMachineSetAction( - IN STATE_MACHINE *S, - IN ULONG St, - IN ULONG Msg, - IN STATE_MACHINE_FUNC Func) +VOID StateMachineSetAction(IN STATE_MACHINE * S, + IN ULONG St, + IN ULONG Msg, IN STATE_MACHINE_FUNC Func) { ULONG MsgIdx; MsgIdx = Msg - S->Base; - if (St < S->NrState && MsgIdx < S->NrMsg) - { + if (St < S->NrState && MsgIdx < S->NrMsg) { // boundary checking before setting the action S->TransFunc[St * S->NrMsg + MsgIdx] = Func; } @@ -5089,12 +5161,11 @@ VOID StateMachineSetAction( IRQL = DISPATCH_LEVEL */ -VOID StateMachinePerformAction( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - IN MLME_QUEUE_ELEM *Elem) +VOID StateMachinePerformAction(IN PRTMP_ADAPTER pAd, + IN STATE_MACHINE * S, IN MLME_QUEUE_ELEM * Elem) { - (*(S->TransFunc[S->CurrState * S->NrMsg + Elem->MsgType - S->Base]))(pAd, Elem); + (*(S->TransFunc[S->CurrState * S->NrMsg + Elem->MsgType - S->Base])) + (pAd, Elem); } /* @@ -5105,9 +5176,7 @@ VOID StateMachinePerformAction( StateMachinePerformAction() ========================================================================== */ -VOID Drop( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID Drop(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { } @@ -5123,9 +5192,7 @@ VOID Drop( ========================================================================== */ -VOID LfsrInit( - IN PRTMP_ADAPTER pAd, - IN ULONG Seed) +VOID LfsrInit(IN PRTMP_ADAPTER pAd, IN ULONG Seed) { if (Seed == 0) pAd->Mlme.ShiftReg = 1; @@ -5138,8 +5205,7 @@ VOID LfsrInit( Description: ========================================================================== */ -UCHAR RandomByte( - IN PRTMP_ADAPTER pAd) +UCHAR RandomByte(IN PRTMP_ADAPTER pAd) { ULONG i; UCHAR R, Result; @@ -5147,17 +5213,15 @@ UCHAR RandomByte( R = 0; if (pAd->Mlme.ShiftReg == 0) - NdisGetSystemUpTime((ULONG *)&pAd->Mlme.ShiftReg); + NdisGetSystemUpTime((ULONG *) & pAd->Mlme.ShiftReg); - for (i = 0; i < 8; i++) - { - if (pAd->Mlme.ShiftReg & 0x00000001) - { - pAd->Mlme.ShiftReg = ((pAd->Mlme.ShiftReg ^ LFSR_MASK) >> 1) | 0x80000000; + for (i = 0; i < 8; i++) { + if (pAd->Mlme.ShiftReg & 0x00000001) { + pAd->Mlme.ShiftReg = + ((pAd->Mlme. + ShiftReg ^ LFSR_MASK) >> 1) | 0x80000000; Result = 1; - } - else - { + } else { pAd->Mlme.ShiftReg = pAd->Mlme.ShiftReg >> 1; Result = 0; } @@ -5167,7 +5231,6 @@ UCHAR RandomByte( return R; } - /* ======================================================================== @@ -5184,13 +5247,11 @@ UCHAR RandomByte( ======================================================================== */ -VOID RTMPCheckRates( - IN PRTMP_ADAPTER pAd, - IN OUT UCHAR SupRate[], - IN OUT UCHAR *SupRateLen) +VOID RTMPCheckRates(IN PRTMP_ADAPTER pAd, + IN OUT UCHAR SupRate[], IN OUT UCHAR * SupRateLen) { - UCHAR RateIdx, i, j; - UCHAR NewRate[12], NewRateLen; + UCHAR RateIdx, i, j; + UCHAR NewRate[12], NewRateLen; NewRateLen = 0; @@ -5209,43 +5270,37 @@ VOID RTMPCheckRates( NdisMoveMemory(SupRate, NewRate, NewRateLen); } -BOOLEAN RTMPCheckChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR CentralChannel, - IN UCHAR Channel) +BOOLEAN RTMPCheckChannel(IN PRTMP_ADAPTER pAd, + IN UCHAR CentralChannel, IN UCHAR Channel) { - UCHAR k; - UCHAR UpperChannel = 0, LowerChannel = 0; - UCHAR NoEffectChannelinList = 0; + UCHAR k; + UCHAR UpperChannel = 0, LowerChannel = 0; + UCHAR NoEffectChannelinList = 0; // Find upper and lower channel according to 40MHz current operation. - if (CentralChannel < Channel) - { + if (CentralChannel < Channel) { UpperChannel = Channel; if (CentralChannel > 2) LowerChannel = CentralChannel - 2; else return FALSE; - } - else if (CentralChannel > Channel) - { + } else if (CentralChannel > Channel) { UpperChannel = CentralChannel + 2; LowerChannel = Channel; } - for (k = 0;k < pAd->ChannelListNum;k++) - { - if (pAd->ChannelList[k].Channel == UpperChannel) - { - NoEffectChannelinList ++; + for (k = 0; k < pAd->ChannelListNum; k++) { + if (pAd->ChannelList[k].Channel == UpperChannel) { + NoEffectChannelinList++; } - if (pAd->ChannelList[k].Channel == LowerChannel) - { - NoEffectChannelinList ++; + if (pAd->ChannelList[k].Channel == LowerChannel) { + NoEffectChannelinList++; } } - DBGPRINT(RT_DEBUG_TRACE,("Total Channel in Channel List = [%d]\n", NoEffectChannelinList)); + DBGPRINT(RT_DEBUG_TRACE, + ("Total Channel in Channel List = [%d]\n", + NoEffectChannelinList)); if (NoEffectChannelinList == 2) return TRUE; else @@ -5268,88 +5323,114 @@ BOOLEAN RTMPCheckChannel( ======================================================================== */ -BOOLEAN RTMPCheckHt( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN HT_CAPABILITY_IE *pHtCapability, - IN ADD_HT_INFO_IE *pAddHtInfo) +BOOLEAN RTMPCheckHt(IN PRTMP_ADAPTER pAd, + IN UCHAR Wcid, + IN HT_CAPABILITY_IE * pHtCapability, + IN ADD_HT_INFO_IE * pAddHtInfo) { if (Wcid >= MAX_LEN_OF_MAC_TABLE) return FALSE; // If use AMSDU, set flag. if (pAd->CommonCfg.DesiredHtPhy.AmsduEnable) - CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], fCLIENT_STATUS_AMSDU_INUSED); + CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], + fCLIENT_STATUS_AMSDU_INUSED); // Save Peer Capability if (pHtCapability->HtCapInfo.ShortGIfor20) - CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], fCLIENT_STATUS_SGI20_CAPABLE); + CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], + fCLIENT_STATUS_SGI20_CAPABLE); if (pHtCapability->HtCapInfo.ShortGIfor40) - CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], fCLIENT_STATUS_SGI40_CAPABLE); + CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], + fCLIENT_STATUS_SGI40_CAPABLE); if (pHtCapability->HtCapInfo.TxSTBC) - CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], fCLIENT_STATUS_TxSTBC_CAPABLE); + CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], + fCLIENT_STATUS_TxSTBC_CAPABLE); if (pHtCapability->HtCapInfo.RxSTBC) - CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], fCLIENT_STATUS_RxSTBC_CAPABLE); - if (pAd->CommonCfg.bRdg && pHtCapability->ExtHtCapInfo.RDGSupport) - { - CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], fCLIENT_STATUS_RDG_CAPABLE); + CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], + fCLIENT_STATUS_RxSTBC_CAPABLE); + if (pAd->CommonCfg.bRdg && pHtCapability->ExtHtCapInfo.RDGSupport) { + CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], + fCLIENT_STATUS_RDG_CAPABLE); } - if (Wcid < MAX_LEN_OF_MAC_TABLE) - { - pAd->MacTab.Content[Wcid].MpduDensity = pHtCapability->HtCapParm.MpduDensity; + if (Wcid < MAX_LEN_OF_MAC_TABLE) { + pAd->MacTab.Content[Wcid].MpduDensity = + pHtCapability->HtCapParm.MpduDensity; } - // Will check ChannelWidth for MCSSet[4] below pAd->MlmeAux.HtCapability.MCSSet[4] = 0x1; - switch (pAd->CommonCfg.RxStream) - { - case 1: - pAd->MlmeAux.HtCapability.MCSSet[0] = 0xff; - pAd->MlmeAux.HtCapability.MCSSet[1] = 0x00; - pAd->MlmeAux.HtCapability.MCSSet[2] = 0x00; - pAd->MlmeAux.HtCapability.MCSSet[3] = 0x00; - break; - case 2: - pAd->MlmeAux.HtCapability.MCSSet[0] = 0xff; - pAd->MlmeAux.HtCapability.MCSSet[1] = 0xff; - pAd->MlmeAux.HtCapability.MCSSet[2] = 0x00; - pAd->MlmeAux.HtCapability.MCSSet[3] = 0x00; - break; - case 3: - pAd->MlmeAux.HtCapability.MCSSet[0] = 0xff; - pAd->MlmeAux.HtCapability.MCSSet[1] = 0xff; - pAd->MlmeAux.HtCapability.MCSSet[2] = 0xff; - pAd->MlmeAux.HtCapability.MCSSet[3] = 0x00; - break; - } - - pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth = pAddHtInfo->AddHtInfo.RecomWidth & pAd->CommonCfg.DesiredHtPhy.ChannelWidth; - - DBGPRINT(RT_DEBUG_TRACE, ("RTMPCheckHt:: HtCapInfo.ChannelWidth=%d, RecomWidth=%d, DesiredHtPhy.ChannelWidth=%d, BW40MAvailForA/G=%d/%d, PhyMode=%d \n", - pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth, pAddHtInfo->AddHtInfo.RecomWidth, pAd->CommonCfg.DesiredHtPhy.ChannelWidth, - pAd->NicConfig2.field.BW40MAvailForA, pAd->NicConfig2.field.BW40MAvailForG, pAd->CommonCfg.PhyMode)); - - pAd->MlmeAux.HtCapability.HtCapInfo.GF = pHtCapability->HtCapInfo.GF &pAd->CommonCfg.DesiredHtPhy.GF; + switch (pAd->CommonCfg.RxStream) { + case 1: + pAd->MlmeAux.HtCapability.MCSSet[0] = 0xff; + pAd->MlmeAux.HtCapability.MCSSet[1] = 0x00; + pAd->MlmeAux.HtCapability.MCSSet[2] = 0x00; + pAd->MlmeAux.HtCapability.MCSSet[3] = 0x00; + break; + case 2: + pAd->MlmeAux.HtCapability.MCSSet[0] = 0xff; + pAd->MlmeAux.HtCapability.MCSSet[1] = 0xff; + pAd->MlmeAux.HtCapability.MCSSet[2] = 0x00; + pAd->MlmeAux.HtCapability.MCSSet[3] = 0x00; + break; + case 3: + pAd->MlmeAux.HtCapability.MCSSet[0] = 0xff; + pAd->MlmeAux.HtCapability.MCSSet[1] = 0xff; + pAd->MlmeAux.HtCapability.MCSSet[2] = 0xff; + pAd->MlmeAux.HtCapability.MCSSet[3] = 0x00; + break; + } + + pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth = + pAddHtInfo->AddHtInfo.RecomWidth & pAd->CommonCfg.DesiredHtPhy. + ChannelWidth; + + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPCheckHt:: HtCapInfo.ChannelWidth=%d, RecomWidth=%d, DesiredHtPhy.ChannelWidth=%d, BW40MAvailForA/G=%d/%d, PhyMode=%d \n", + pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth, + pAddHtInfo->AddHtInfo.RecomWidth, + pAd->CommonCfg.DesiredHtPhy.ChannelWidth, + pAd->NicConfig2.field.BW40MAvailForA, + pAd->NicConfig2.field.BW40MAvailForG, + pAd->CommonCfg.PhyMode)); + + pAd->MlmeAux.HtCapability.HtCapInfo.GF = + pHtCapability->HtCapInfo.GF & pAd->CommonCfg.DesiredHtPhy.GF; // Send Assoc Req with my HT capability. - pAd->MlmeAux.HtCapability.HtCapInfo.AMsduSize = pAd->CommonCfg.DesiredHtPhy.AmsduSize; - pAd->MlmeAux.HtCapability.HtCapInfo.MimoPs = pAd->CommonCfg.DesiredHtPhy.MimoPs; - pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor20 = (pAd->CommonCfg.DesiredHtPhy.ShortGIfor20) & (pHtCapability->HtCapInfo.ShortGIfor20); - pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor40 = (pAd->CommonCfg.DesiredHtPhy.ShortGIfor40) & (pHtCapability->HtCapInfo.ShortGIfor40); - pAd->MlmeAux.HtCapability.HtCapInfo.TxSTBC = (pAd->CommonCfg.DesiredHtPhy.TxSTBC)&(pHtCapability->HtCapInfo.RxSTBC); - pAd->MlmeAux.HtCapability.HtCapInfo.RxSTBC = (pAd->CommonCfg.DesiredHtPhy.RxSTBC)&(pHtCapability->HtCapInfo.TxSTBC); - pAd->MlmeAux.HtCapability.HtCapParm.MaxRAmpduFactor = pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor; - pAd->MlmeAux.HtCapability.HtCapParm.MpduDensity = pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity; - pAd->MlmeAux.HtCapability.ExtHtCapInfo.PlusHTC = pHtCapability->ExtHtCapInfo.PlusHTC; - pAd->MacTab.Content[Wcid].HTCapability.ExtHtCapInfo.PlusHTC = pHtCapability->ExtHtCapInfo.PlusHTC; - if (pAd->CommonCfg.bRdg) - { - pAd->MlmeAux.HtCapability.ExtHtCapInfo.RDGSupport = pHtCapability->ExtHtCapInfo.RDGSupport; - pAd->MlmeAux.HtCapability.ExtHtCapInfo.PlusHTC = 1; - } - - if (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_20) - pAd->MlmeAux.HtCapability.MCSSet[4] = 0x0; // BW20 can't transmit MCS32 + pAd->MlmeAux.HtCapability.HtCapInfo.AMsduSize = + pAd->CommonCfg.DesiredHtPhy.AmsduSize; + pAd->MlmeAux.HtCapability.HtCapInfo.MimoPs = + pAd->CommonCfg.DesiredHtPhy.MimoPs; + pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor20 = + (pAd->CommonCfg.DesiredHtPhy.ShortGIfor20) & (pHtCapability-> + HtCapInfo. + ShortGIfor20); + pAd->MlmeAux.HtCapability.HtCapInfo.ShortGIfor40 = + (pAd->CommonCfg.DesiredHtPhy.ShortGIfor40) & (pHtCapability-> + HtCapInfo. + ShortGIfor40); + pAd->MlmeAux.HtCapability.HtCapInfo.TxSTBC = + (pAd->CommonCfg.DesiredHtPhy.TxSTBC) & (pHtCapability->HtCapInfo. + RxSTBC); + pAd->MlmeAux.HtCapability.HtCapInfo.RxSTBC = + (pAd->CommonCfg.DesiredHtPhy.RxSTBC) & (pHtCapability->HtCapInfo. + TxSTBC); + pAd->MlmeAux.HtCapability.HtCapParm.MaxRAmpduFactor = + pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor; + pAd->MlmeAux.HtCapability.HtCapParm.MpduDensity = + pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity; + pAd->MlmeAux.HtCapability.ExtHtCapInfo.PlusHTC = + pHtCapability->ExtHtCapInfo.PlusHTC; + pAd->MacTab.Content[Wcid].HTCapability.ExtHtCapInfo.PlusHTC = + pHtCapability->ExtHtCapInfo.PlusHTC; + if (pAd->CommonCfg.bRdg) { + pAd->MlmeAux.HtCapability.ExtHtCapInfo.RDGSupport = + pHtCapability->ExtHtCapInfo.RDGSupport; + pAd->MlmeAux.HtCapability.ExtHtCapInfo.PlusHTC = 1; + } + + if (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_20) + pAd->MlmeAux.HtCapability.MCSSet[4] = 0x0; // BW20 can't transmit MCS32 COPY_AP_HTSETTINGS_FROM_BEACON(pAd, pHtCapability); return TRUE; @@ -5371,65 +5452,60 @@ BOOLEAN RTMPCheckHt( ======================================================================== */ -VOID RTMPUpdateMlmeRate( - IN PRTMP_ADAPTER pAd) +VOID RTMPUpdateMlmeRate(IN PRTMP_ADAPTER pAd) { - UCHAR MinimumRate; - UCHAR ProperMlmeRate; //= RATE_54; - UCHAR i, j, RateIdx = 12; //1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 - BOOLEAN bMatch = FALSE; - - switch (pAd->CommonCfg.PhyMode) - { - case PHY_11B: + UCHAR MinimumRate; + UCHAR ProperMlmeRate; //= RATE_54; + UCHAR i, j, RateIdx = 12; //1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 + BOOLEAN bMatch = FALSE; + + switch (pAd->CommonCfg.PhyMode) { + case PHY_11B: + ProperMlmeRate = RATE_11; + MinimumRate = RATE_1; + break; + case PHY_11BG_MIXED: + case PHY_11ABGN_MIXED: + case PHY_11BGN_MIXED: + if ((pAd->MlmeAux.SupRateLen == 4) && + (pAd->MlmeAux.ExtRateLen == 0)) + // B only AP ProperMlmeRate = RATE_11; - MinimumRate = RATE_1; - break; - case PHY_11BG_MIXED: - case PHY_11ABGN_MIXED: - case PHY_11BGN_MIXED: - if ((pAd->MlmeAux.SupRateLen == 4) && - (pAd->MlmeAux.ExtRateLen == 0)) - // B only AP - ProperMlmeRate = RATE_11; - else - ProperMlmeRate = RATE_24; - - if (pAd->MlmeAux.Channel <= 14) - MinimumRate = RATE_1; - else - MinimumRate = RATE_6; - break; - case PHY_11A: - case PHY_11N_2_4G: // rt2860 need to check mlmerate for 802.11n - case PHY_11GN_MIXED: - case PHY_11AGN_MIXED: - case PHY_11AN_MIXED: - case PHY_11N_5G: + else ProperMlmeRate = RATE_24; + + if (pAd->MlmeAux.Channel <= 14) + MinimumRate = RATE_1; + else MinimumRate = RATE_6; - break; - case PHY_11ABG_MIXED: - ProperMlmeRate = RATE_24; - if (pAd->MlmeAux.Channel <= 14) - MinimumRate = RATE_1; - else - MinimumRate = RATE_6; - break; - default: // error - ProperMlmeRate = RATE_1; + break; + case PHY_11A: + case PHY_11N_2_4G: // rt2860 need to check mlmerate for 802.11n + case PHY_11GN_MIXED: + case PHY_11AGN_MIXED: + case PHY_11AN_MIXED: + case PHY_11N_5G: + ProperMlmeRate = RATE_24; + MinimumRate = RATE_6; + break; + case PHY_11ABG_MIXED: + ProperMlmeRate = RATE_24; + if (pAd->MlmeAux.Channel <= 14) MinimumRate = RATE_1; - break; - } - - for (i = 0; i < pAd->MlmeAux.SupRateLen; i++) - { - for (j = 0; j < RateIdx; j++) - { - if ((pAd->MlmeAux.SupRate[i] & 0x7f) == RateIdTo500Kbps[j]) - { - if (j == ProperMlmeRate) - { + else + MinimumRate = RATE_6; + break; + default: // error + ProperMlmeRate = RATE_1; + MinimumRate = RATE_1; + break; + } + + for (i = 0; i < pAd->MlmeAux.SupRateLen; i++) { + for (j = 0; j < RateIdx; j++) { + if ((pAd->MlmeAux.SupRate[i] & 0x7f) == + RateIdTo500Kbps[j]) { + if (j == ProperMlmeRate) { bMatch = TRUE; break; } @@ -5440,16 +5516,12 @@ VOID RTMPUpdateMlmeRate( break; } - if (bMatch == FALSE) - { - for (i = 0; i < pAd->MlmeAux.ExtRateLen; i++) - { - for (j = 0; j < RateIdx; j++) - { - if ((pAd->MlmeAux.ExtRate[i] & 0x7f) == RateIdTo500Kbps[j]) - { - if (j == ProperMlmeRate) - { + if (bMatch == FALSE) { + for (i = 0; i < pAd->MlmeAux.ExtRateLen; i++) { + for (j = 0; j < RateIdx; j++) { + if ((pAd->MlmeAux.ExtRate[i] & 0x7f) == + RateIdTo500Kbps[j]) { + if (j == ProperMlmeRate) { bMatch = TRUE; break; } @@ -5461,51 +5533,48 @@ VOID RTMPUpdateMlmeRate( } } - if (bMatch == FALSE) - { + if (bMatch == FALSE) { ProperMlmeRate = MinimumRate; } pAd->CommonCfg.MlmeRate = MinimumRate; pAd->CommonCfg.RtsRate = ProperMlmeRate; - if (pAd->CommonCfg.MlmeRate >= RATE_6) - { + if (pAd->CommonCfg.MlmeRate >= RATE_6) { pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; - pAd->CommonCfg.MlmeTransmit.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; - pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MODE = MODE_OFDM; - pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; - } - else - { + pAd->CommonCfg.MlmeTransmit.field.MCS = + OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; + pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MODE = + MODE_OFDM; + pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MCS = + OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; + } else { pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_CCK; pAd->CommonCfg.MlmeTransmit.field.MCS = pAd->CommonCfg.MlmeRate; - pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MODE = MODE_CCK; - pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MCS = pAd->CommonCfg.MlmeRate; + pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MODE = + MODE_CCK; + pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MCS = + pAd->CommonCfg.MlmeRate; } - DBGPRINT(RT_DEBUG_TRACE, ("RTMPUpdateMlmeRate ==> MlmeTransmit = 0x%x \n" , pAd->CommonCfg.MlmeTransmit.word)); + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPUpdateMlmeRate ==> MlmeTransmit = 0x%x \n", + pAd->CommonCfg.MlmeTransmit.word)); } -CHAR RTMPMaxRssi( - IN PRTMP_ADAPTER pAd, - IN CHAR Rssi0, - IN CHAR Rssi1, - IN CHAR Rssi2) +CHAR RTMPMaxRssi(IN PRTMP_ADAPTER pAd, + IN CHAR Rssi0, IN CHAR Rssi1, IN CHAR Rssi2) { - CHAR larger = -127; + CHAR larger = -127; - if ((pAd->Antenna.field.RxPath == 1) && (Rssi0 != 0)) - { + if ((pAd->Antenna.field.RxPath == 1) && (Rssi0 != 0)) { larger = Rssi0; } - if ((pAd->Antenna.field.RxPath >= 2) && (Rssi1 != 0)) - { + if ((pAd->Antenna.field.RxPath >= 2) && (Rssi1 != 0)) { larger = max(Rssi0, Rssi1); } - if ((pAd->Antenna.field.RxPath == 3) && (Rssi2 != 0)) - { + if ((pAd->Antenna.field.RxPath == 3) && (Rssi2 != 0)) { larger = max(larger, Rssi2); } @@ -5515,7 +5584,6 @@ CHAR RTMPMaxRssi( return larger; } - /* ======================================================================== Routine Description: @@ -5529,78 +5597,70 @@ CHAR RTMPMaxRssi( ======================================================================== */ -VOID AsicEvaluateRxAnt( - IN PRTMP_ADAPTER pAd) +VOID AsicEvaluateRxAnt(IN PRTMP_ADAPTER pAd) { - UCHAR BBPR3 = 0; + UCHAR BBPR3 = 0; if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_RADIO_OFF | - fRTMP_ADAPTER_NIC_NOT_EXIST | - fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS) || - OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_RADIO_OFF | + fRTMP_ADAPTER_NIC_NOT_EXIST | + fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS) || + OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) #ifdef RT30xx - || (pAd->EepromAccess) + || (pAd->EepromAccess) #endif // RT30xx // #ifdef RT3090 - || (pAd->bPCIclkOff == TRUE) + || (pAd->bPCIclkOff == TRUE) #endif // RT3090 // - ) - return; - + ) + return; { //if (pAd->StaCfg.Psm == PWR_SAVE) - // return; + // return; - { + { - if (pAd->StaCfg.Psm == PWR_SAVE) - return; + if (pAd->StaCfg.Psm == PWR_SAVE) + return; - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBPR3); - BBPR3 &= (~0x18); - if(pAd->Antenna.field.RxPath == 3) - { - BBPR3 |= (0x10); - } - else if(pAd->Antenna.field.RxPath == 2) - { - BBPR3 |= (0x8); - } - else if(pAd->Antenna.field.RxPath == 1) - { - BBPR3 |= (0x0); - } - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBPR3); + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBPR3); + BBPR3 &= (~0x18); + if (pAd->Antenna.field.RxPath == 3) { + BBPR3 |= (0x10); + } else if (pAd->Antenna.field.RxPath == 2) { + BBPR3 |= (0x8); + } else if (pAd->Antenna.field.RxPath == 1) { + BBPR3 |= (0x0); + } + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBPR3); #ifdef RTMP_MAC_PCI - pAd->StaCfg.BBPR3 = BBPR3; + pAd->StaCfg.BBPR3 = BBPR3; #endif // RTMP_MAC_PCI // - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) - ) - { - ULONG TxTotalCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount + - pAd->RalinkCounters.OneSecTxRetryOkCount + - pAd->RalinkCounters.OneSecTxFailCount; - - // dynamic adjust antenna evaluation period according to the traffic - if (TxTotalCnt > 50) - { - RTMPSetTimer(&pAd->Mlme.RxAntEvalTimer, 20); - pAd->Mlme.bLowThroughput = FALSE; - } - else - { - RTMPSetTimer(&pAd->Mlme.RxAntEvalTimer, 300); - pAd->Mlme.bLowThroughput = TRUE; - } - } + if (OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) + ) { + ULONG TxTotalCnt = + pAd->RalinkCounters.OneSecTxNoRetryOkCount + + pAd->RalinkCounters.OneSecTxRetryOkCount + + pAd->RalinkCounters.OneSecTxFailCount; + + // dynamic adjust antenna evaluation period according to the traffic + if (TxTotalCnt > 50) { + RTMPSetTimer(&pAd->Mlme.RxAntEvalTimer, + 20); + pAd->Mlme.bLowThroughput = FALSE; + } else { + RTMPSetTimer(&pAd->Mlme.RxAntEvalTimer, + 300); + pAd->Mlme.bLowThroughput = TRUE; + } + } } } - } /* @@ -5616,62 +5676,54 @@ VOID AsicEvaluateRxAnt( ======================================================================== */ -VOID AsicRxAntEvalTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +VOID AsicRxAntEvalTimeout(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; - UCHAR BBPR3 = 0; - CHAR larger = -127, rssi0, rssi1, rssi2; - - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_RADIO_OFF | - fRTMP_ADAPTER_NIC_NOT_EXIST) || - OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) + RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; + UCHAR BBPR3 = 0; + CHAR larger = -127, rssi0, rssi1, rssi2; + + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS | + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_RADIO_OFF | + fRTMP_ADAPTER_NIC_NOT_EXIST) || + OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) #ifdef RT30xx - || (pAd->EepromAccess) + || (pAd->EepromAccess) #endif // RT30xx // #ifdef RT3090 - || (pAd->bPCIclkOff == TRUE) + || (pAd->bPCIclkOff == TRUE) #endif // RT3090 // - ) + ) return; { //if (pAd->StaCfg.Psm == PWR_SAVE) - // return; + // return; { if (pAd->StaCfg.Psm == PWR_SAVE) return; // if the traffic is low, use average rssi as the criteria - if (pAd->Mlme.bLowThroughput == TRUE) - { + if (pAd->Mlme.bLowThroughput == TRUE) { rssi0 = pAd->StaCfg.RssiSample.LastRssi0; rssi1 = pAd->StaCfg.RssiSample.LastRssi1; rssi2 = pAd->StaCfg.RssiSample.LastRssi2; - } - else - { + } else { rssi0 = pAd->StaCfg.RssiSample.AvgRssi0; rssi1 = pAd->StaCfg.RssiSample.AvgRssi1; rssi2 = pAd->StaCfg.RssiSample.AvgRssi2; } - if(pAd->Antenna.field.RxPath == 3) - { + if (pAd->Antenna.field.RxPath == 3) { larger = max(rssi0, rssi1); if (larger > (rssi2 + 20)) pAd->Mlme.RealRxPath = 2; else pAd->Mlme.RealRxPath = 3; - } - else if(pAd->Antenna.field.RxPath == 2) - { + } else if (pAd->Antenna.field.RxPath == 2) { if (rssi0 > (rssi1 + 20)) pAd->Mlme.RealRxPath = 1; else @@ -5680,16 +5732,11 @@ VOID AsicRxAntEvalTimeout( RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBPR3); BBPR3 &= (~0x18); - if(pAd->Mlme.RealRxPath == 3) - { + if (pAd->Mlme.RealRxPath == 3) { BBPR3 |= (0x10); - } - else if(pAd->Mlme.RealRxPath == 2) - { + } else if (pAd->Mlme.RealRxPath == 2) { BBPR3 |= (0x8); - } - else if(pAd->Mlme.RealRxPath == 1) - { + } else if (pAd->Mlme.RealRxPath == 1) { BBPR3 |= (0x0); } RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBPR3); @@ -5699,17 +5746,13 @@ VOID AsicRxAntEvalTimeout( } } - } - -VOID APSDPeriodicExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +VOID APSDPeriodicExec(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; + RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) return; @@ -5744,11 +5787,9 @@ VOID APSDPeriodicExec( ======================================================================== */ -VOID RTMPSetPiggyBack( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bPiggyBack) +VOID RTMPSetPiggyBack(IN PRTMP_ADAPTER pAd, IN BOOLEAN bPiggyBack) { - TX_LINK_CFG_STRUC TxLinkCfg; + TX_LINK_CFG_STRUC TxLinkCfg; RTMP_IO_READ32(pAd, TX_LINK_CFG, &TxLinkCfg.word); @@ -5771,37 +5812,32 @@ VOID RTMPSetPiggyBack( ======================================================================== */ -BOOLEAN RTMPCheckEntryEnableAutoRateSwitch( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry) +BOOLEAN RTMPCheckEntryEnableAutoRateSwitch(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry) { - BOOLEAN result = TRUE; + BOOLEAN result = TRUE; { // only associated STA counts - if (pEntry && (pEntry->ValidAsCLI) && (pEntry->Sst == SST_ASSOC)) - { + if (pEntry && (pEntry->ValidAsCLI) + && (pEntry->Sst == SST_ASSOC)) { result = pAd->StaCfg.bAutoTxRateSwitch; - } - else + } else result = FALSE; } return result; } - -BOOLEAN RTMPAutoRateSwitchCheck( - IN PRTMP_ADAPTER pAd) +BOOLEAN RTMPAutoRateSwitchCheck(IN PRTMP_ADAPTER pAd) { { - if (pAd->StaCfg.bAutoTxRateSwitch) - return TRUE; + if (pAd->StaCfg.bAutoTxRateSwitch) + return TRUE; } return FALSE; } - /* ======================================================================== Routine Description: @@ -5817,14 +5853,14 @@ BOOLEAN RTMPAutoRateSwitchCheck( ======================================================================== */ -UCHAR RTMPStaFixedTxMode( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry) +UCHAR RTMPStaFixedTxMode(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry) { - UCHAR tx_mode = FIXED_TXMODE_HT; + UCHAR tx_mode = FIXED_TXMODE_HT; { - tx_mode = (UCHAR)pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode; + tx_mode = + (UCHAR) pAd->StaCfg.DesiredTransmitSetting.field. + FixedTxMode; } return tx_mode; @@ -5845,9 +5881,7 @@ UCHAR RTMPStaFixedTxMode( ======================================================================== */ -VOID RTMPUpdateLegacyTxSetting( - UCHAR fixed_tx_mode, - PMAC_TABLE_ENTRY pEntry) +VOID RTMPUpdateLegacyTxSetting(UCHAR fixed_tx_mode, PMAC_TABLE_ENTRY pEntry) { HTTRANSMIT_SETTING TransmitSetting; @@ -5859,26 +5893,24 @@ VOID RTMPUpdateLegacyTxSetting( TransmitSetting.field.MODE = pEntry->HTPhyMode.field.MODE; TransmitSetting.field.MCS = pEntry->HTPhyMode.field.MCS; - if (fixed_tx_mode == FIXED_TXMODE_CCK) - { + if (fixed_tx_mode == FIXED_TXMODE_CCK) { TransmitSetting.field.MODE = MODE_CCK; // CCK mode allow MCS 0~3 if (TransmitSetting.field.MCS > MCS_3) TransmitSetting.field.MCS = MCS_3; - } - else - { + } else { TransmitSetting.field.MODE = MODE_OFDM; // OFDM mode allow MCS 0~7 if (TransmitSetting.field.MCS > MCS_7) TransmitSetting.field.MCS = MCS_7; } - if (pEntry->HTPhyMode.field.MODE >= TransmitSetting.field.MODE) - { + if (pEntry->HTPhyMode.field.MODE >= TransmitSetting.field.MODE) { pEntry->HTPhyMode.word = TransmitSetting.word; - DBGPRINT(RT_DEBUG_TRACE, ("RTMPUpdateLegacyTxSetting : wcid-%d, MODE=%s, MCS=%d \n", - pEntry->Aid, GetPhyMode(pEntry->HTPhyMode.field.MODE), pEntry->HTPhyMode.field.MCS)); + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPUpdateLegacyTxSetting : wcid-%d, MODE=%s, MCS=%d \n", + pEntry->Aid, GetPhyMode(pEntry->HTPhyMode.field.MODE), + pEntry->HTPhyMode.field.MCS)); } } @@ -5892,11 +5924,10 @@ VOID RTMPUpdateLegacyTxSetting( ========================================================================== */ -VOID AsicStaBbpTuning( - IN PRTMP_ADAPTER pAd) +VOID AsicStaBbpTuning(IN PRTMP_ADAPTER pAd) { - UCHAR OrigR66Value = 0, R66;//, R66UpperBound = 0x30, R66LowerBound = 0x30; - CHAR Rssi; + UCHAR OrigR66Value = 0, R66; //, R66UpperBound = 0x30, R66LowerBound = 0x30; + CHAR Rssi; // 2860C did not support Fase CCA, therefore can't tune if (pAd->MACVersion == 0x28600100) @@ -5905,156 +5936,138 @@ VOID AsicStaBbpTuning( // // work as a STA // - if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) // no R66 tuning when SCANNING + if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) // no R66 tuning when SCANNING return; if ((pAd->OpMode == OPMODE_STA) - && (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) - ) - && !(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) + && (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) + ) + && !(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) #ifdef RTMP_MAC_PCI - && (pAd->bPCIclkOff == FALSE) + && (pAd->bPCIclkOff == FALSE) #endif // RTMP_MAC_PCI // - ) - { + ) { RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R66, &OrigR66Value); R66 = OrigR66Value; if (pAd->Antenna.field.RxPath > 1) - Rssi = (pAd->StaCfg.RssiSample.AvgRssi0 + pAd->StaCfg.RssiSample.AvgRssi1) >> 1; + Rssi = + (pAd->StaCfg.RssiSample.AvgRssi0 + + pAd->StaCfg.RssiSample.AvgRssi1) >> 1; else Rssi = pAd->StaCfg.RssiSample.AvgRssi0; - if (pAd->LatchRfRegs.Channel <= 14) - { //BG band + if (pAd->LatchRfRegs.Channel <= 14) { //BG band #ifdef RT30xx // RT3070 is a no LNA solution, it should have different control regarding to AGC gain control // Otherwise, it will have some throughput side effect when low RSSI - if (IS_RT3070(pAd)||IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) - { - if (Rssi > RSSI_FOR_MID_LOW_SENSIBILITY) - { - R66 = 0x1C + 2*GET_LNA_GAIN(pAd) + 0x20; - if (OrigR66Value != R66) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); - } - } - else - { - R66 = 0x1C + 2*GET_LNA_GAIN(pAd); - if (OrigR66Value != R66) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); + if (IS_RT3070(pAd) || IS_RT3090(pAd) || IS_RT3572(pAd) + || IS_RT3390(pAd)) { + if (Rssi > RSSI_FOR_MID_LOW_SENSIBILITY) { + R66 = + 0x1C + 2 * GET_LNA_GAIN(pAd) + 0x20; + if (OrigR66Value != R66) { + RTMP_BBP_IO_WRITE8_BY_REG_ID + (pAd, BBP_R66, R66); + } + } else { + R66 = 0x1C + 2 * GET_LNA_GAIN(pAd); + if (OrigR66Value != R66) { + RTMP_BBP_IO_WRITE8_BY_REG_ID + (pAd, BBP_R66, R66); + } } - } - } - else + } else #endif // RT30xx // { - if (Rssi > RSSI_FOR_MID_LOW_SENSIBILITY) - { + if (Rssi > RSSI_FOR_MID_LOW_SENSIBILITY) { R66 = (0x2E + GET_LNA_GAIN(pAd)) + 0x10; - if (OrigR66Value != R66) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); + if (OrigR66Value != R66) { + RTMP_BBP_IO_WRITE8_BY_REG_ID + (pAd, BBP_R66, R66); } - } - else - { + } else { R66 = 0x2E + GET_LNA_GAIN(pAd); - if (OrigR66Value != R66) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); + if (OrigR66Value != R66) { + RTMP_BBP_IO_WRITE8_BY_REG_ID + (pAd, BBP_R66, R66); } } } - } - else - { //A band - if (pAd->CommonCfg.BBPCurrentBW == BW_20) - { - if (Rssi > RSSI_FOR_MID_LOW_SENSIBILITY) - { - R66 = 0x32 + (GET_LNA_GAIN(pAd)*5)/3 + 0x10; - if (OrigR66Value != R66) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); + } else { //A band + if (pAd->CommonCfg.BBPCurrentBW == BW_20) { + if (Rssi > RSSI_FOR_MID_LOW_SENSIBILITY) { + R66 = + 0x32 + (GET_LNA_GAIN(pAd) * 5) / 3 + + 0x10; + if (OrigR66Value != R66) { + RTMP_BBP_IO_WRITE8_BY_REG_ID + (pAd, BBP_R66, R66); } - } - else - { - R66 = 0x32 + (GET_LNA_GAIN(pAd)*5)/3; - if (OrigR66Value != R66) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); + } else { + R66 = + 0x32 + (GET_LNA_GAIN(pAd) * 5) / 3; + if (OrigR66Value != R66) { + RTMP_BBP_IO_WRITE8_BY_REG_ID + (pAd, BBP_R66, R66); } } - } - else - { - if (Rssi > RSSI_FOR_MID_LOW_SENSIBILITY) - { - R66 = 0x3A + (GET_LNA_GAIN(pAd)*5)/3 + 0x10; - if (OrigR66Value != R66) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); + } else { + if (Rssi > RSSI_FOR_MID_LOW_SENSIBILITY) { + R66 = + 0x3A + (GET_LNA_GAIN(pAd) * 5) / 3 + + 0x10; + if (OrigR66Value != R66) { + RTMP_BBP_IO_WRITE8_BY_REG_ID + (pAd, BBP_R66, R66); } - } - else - { - R66 = 0x3A + (GET_LNA_GAIN(pAd)*5)/3; - if (OrigR66Value != R66) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); + } else { + R66 = + 0x3A + (GET_LNA_GAIN(pAd) * 5) / 3; + if (OrigR66Value != R66) { + RTMP_BBP_IO_WRITE8_BY_REG_ID + (pAd, BBP_R66, R66); } } } } - } } -VOID RTMPSetAGCInitValue( - IN PRTMP_ADAPTER pAd, - IN UCHAR BandWidth) +VOID RTMPSetAGCInitValue(IN PRTMP_ADAPTER pAd, IN UCHAR BandWidth) { - UCHAR R66 = 0x30; + UCHAR R66 = 0x30; - if (pAd->LatchRfRegs.Channel <= 14) - { // BG band + if (pAd->LatchRfRegs.Channel <= 14) { // BG band #ifdef RT30xx /* Gary was verified Amazon AP and find that RT307x has BBP_R66 invalid default value */ - if (IS_RT3070(pAd)||IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) - { - R66 = 0x1C + 2*GET_LNA_GAIN(pAd); + if (IS_RT3070(pAd) || IS_RT3090(pAd) || IS_RT3572(pAd) + || IS_RT3390(pAd)) { + R66 = 0x1C + 2 * GET_LNA_GAIN(pAd); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); - } - else + } else #endif // RT30xx // { - R66 = 0x2E + GET_LNA_GAIN(pAd); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); - } - } - else - { //A band - { - if (BandWidth == BW_20) - { - R66 = (UCHAR)(0x32 + (GET_LNA_GAIN(pAd)*5)/3); + R66 = 0x2E + GET_LNA_GAIN(pAd); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); } - else + } else { //A band { - R66 = (UCHAR)(0x3A + (GET_LNA_GAIN(pAd)*5)/3); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); + if (BandWidth == BW_20) { + R66 = + (UCHAR) (0x32 + + (GET_LNA_GAIN(pAd) * 5) / 3); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); + } else { + R66 = + (UCHAR) (0x3A + + (GET_LNA_GAIN(pAd) * 5) / 3); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); + } } } - } } - diff --git a/drivers/staging/rt2860/common/rt_channel.c b/drivers/staging/rt2860/common/rt_channel.c index 06b51a01289d..cc45a08d5fb6 100644 --- a/drivers/staging/rt2860/common/rt_channel.c +++ b/drivers/staging/rt2860/common/rt_channel.c @@ -26,951 +26,1411 @@ */ #include "../rt_config.h" - -CH_FREQ_MAP CH_HZ_ID_MAP[]= - { - {1, 2412}, - {2, 2417}, - {3, 2422}, - {4, 2427}, - {5, 2432}, - {6, 2437}, - {7, 2442}, - {8, 2447}, - {9, 2452}, - {10, 2457}, - {11, 2462}, - {12, 2467}, - {13, 2472}, - {14, 2484}, - - /* UNII */ - {36, 5180}, - {40, 5200}, - {44, 5220}, - {48, 5240}, - {52, 5260}, - {56, 5280}, - {60, 5300}, - {64, 5320}, - {149, 5745}, - {153, 5765}, - {157, 5785}, - {161, 5805}, - {165, 5825}, - {167, 5835}, - {169, 5845}, - {171, 5855}, - {173, 5865}, - - /* HiperLAN2 */ - {100, 5500}, - {104, 5520}, - {108, 5540}, - {112, 5560}, - {116, 5580}, - {120, 5600}, - {124, 5620}, - {128, 5640}, - {132, 5660}, - {136, 5680}, - {140, 5700}, - - /* Japan MMAC */ - {34, 5170}, - {38, 5190}, - {42, 5210}, - {46, 5230}, - - /* Japan */ - {184, 4920}, - {188, 4940}, - {192, 4960}, - {196, 4980}, - - {208, 5040}, /* Japan, means J08 */ - {212, 5060}, /* Japan, means J12 */ - {216, 5080}, /* Japan, means J16 */ +CH_FREQ_MAP CH_HZ_ID_MAP[] = { + {1, 2412} + , + {2, 2417} + , + {3, 2422} + , + {4, 2427} + , + {5, 2432} + , + {6, 2437} + , + {7, 2442} + , + {8, 2447} + , + {9, 2452} + , + {10, 2457} + , + {11, 2462} + , + {12, 2467} + , + {13, 2472} + , + {14, 2484} + , + + /* UNII */ + {36, 5180} + , + {40, 5200} + , + {44, 5220} + , + {48, 5240} + , + {52, 5260} + , + {56, 5280} + , + {60, 5300} + , + {64, 5320} + , + {149, 5745} + , + {153, 5765} + , + {157, 5785} + , + {161, 5805} + , + {165, 5825} + , + {167, 5835} + , + {169, 5845} + , + {171, 5855} + , + {173, 5865} + , + + /* HiperLAN2 */ + {100, 5500} + , + {104, 5520} + , + {108, 5540} + , + {112, 5560} + , + {116, 5580} + , + {120, 5600} + , + {124, 5620} + , + {128, 5640} + , + {132, 5660} + , + {136, 5680} + , + {140, 5700} + , + + /* Japan MMAC */ + {34, 5170} + , + {38, 5190} + , + {42, 5210} + , + {46, 5230} + , + + /* Japan */ + {184, 4920} + , + {188, 4940} + , + {192, 4960} + , + {196, 4980} + , + + {208, 5040} + , /* Japan, means J08 */ + {212, 5060} + , /* Japan, means J12 */ + {216, 5080} + , /* Japan, means J16 */ }; -INT CH_HZ_ID_MAP_NUM = (sizeof(CH_HZ_ID_MAP)/sizeof(CH_FREQ_MAP)); - -CH_REGION ChRegion[] = -{ - { // Antigua and Berbuda - "AG", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Argentina - "AR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Aruba - "AW", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Australia - "AU", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Austria - "AT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, TRUE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Bahamas - "BS", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Barbados - "BB", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Bermuda - "BM", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Brazil - "BR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 24, BOTH, FALSE}, // 5G, ch 100~140 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Belgium - "BE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 18, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 18, IDOR, FALSE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // Bulgaria - "BG", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, ODOR, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Canada - "CA", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Cayman IsLands - "KY", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Chile - "CL", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 20, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 20, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 5, 20, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // China - "CN", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Colombia - "CO", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Costa Rica - "CR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Cyprus - "CY", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Czech_Republic - "CZ", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // Denmark - "DK", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Dominican Republic - "DO", - CE, - { - { 1, 0, 20, BOTH, FALSE}, // 2.4 G, ch 0 - { 149, 4, 20, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Equador - "EC", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 100, 11, 27, BOTH, FALSE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // El Salvador - "SV", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 30, BOTH, TRUE}, // 5G, ch 52~64 - { 149, 4, 36, BOTH, TRUE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Finland - "FI", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // France - "FR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // Germany - "DE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Greece - "GR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, ODOR, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Guam - "GU", - CE, - { - { 1, 11, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, FALSE}, // 5G, ch 100~140 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Guatemala - "GT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Haiti - "HT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 17, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Honduras - "HN", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Hong Kong - "HK", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, FALSE}, // 5G, ch 52~64 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Hungary - "HU", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // Iceland - "IS", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // India - "IN", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 149, 4, 24, IDOR, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Indonesia - "ID", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Ireland - "IE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, ODOR, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Israel - "IL", - CE, - { - { 1, 3, 20, IDOR, FALSE}, // 2.4 G, ch 1~3 - { 4, 6, 20, BOTH, FALSE}, // 2.4 G, ch 4~9 - { 10, 4, 20, IDOR, FALSE}, // 2.4 G, ch 10~13 - { 0}, // end - } - }, - - { // Italy - "IT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, ODOR, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Japan - "JP", - JAP, - { - { 1, 14, 20, BOTH, FALSE}, // 2.4 G, ch 1~14 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 0}, // end - } - }, - - { // Jordan - "JO", - CE, - { - { 1, 13, 20, IDOR, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 149, 4, 23, IDOR, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Latvia - "LV", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Liechtenstein - "LI", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Lithuania - "LT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Luxemburg - "LU", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Malaysia - "MY", - CE, - { - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 5, 20, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Malta - "MT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Marocco - "MA", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 24, IDOR, FALSE}, // 5G, ch 36~48 - { 0}, // end - } - }, - - { // Mexico - "MX", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 5, 30, IDOR, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Netherlands - "NL", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // New Zealand - "NZ", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 24, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Norway - "NO", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 24, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 24, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Peru - "PE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Portugal - "PT", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Poland - "PL", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Romania - "RO", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Russia - "RU", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 149, 4, 20, IDOR, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Saudi Arabia - "SA", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 23, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Serbia_and_Montenegro - "CS", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 0}, // end - } - }, - - { // Singapore - "SG", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 149, 4, 20, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Slovakia - "SK", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Slovenia - "SI", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // South Africa - "ZA", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, FALSE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 149, 4, 30, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // South Korea - "KR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 20, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 20, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 8, 20, BOTH, FALSE}, // 5G, ch 100~128 - { 149, 4, 20, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Spain - "ES", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 17, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Sweden - "SE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Switzerland - "CH", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~13 - { 36, 4, 23, IDOR, TRUE}, // 5G, ch 36~48 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // Taiwan - "TW", - CE, - { - { 1, 11, 30, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 52, 4, 23, IDOR, FALSE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // Turkey - "TR", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 36, 4, 23, BOTH, FALSE}, // 5G, ch 36~48 - { 52, 4, 23, BOTH, FALSE}, // 5G, ch 52~64 - { 0}, // end - } - }, - - { // UK - "GB", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 36, 4, 23, IDOR, FALSE}, // 5G, ch 52~64 - { 52, 4, 23, IDOR, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 0}, // end - } - }, - - { // Ukraine - "UA", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 0}, // end - } - }, - - { // United_Arab_Emirates - "AE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 0}, // end - } - }, - - { // United_States - "US", - CE, - { - { 1, 11, 30, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 36, 4, 17, IDOR, FALSE}, // 5G, ch 52~64 - { 52, 4, 24, BOTH, TRUE}, // 5G, ch 52~64 - { 100, 11, 30, BOTH, TRUE}, // 5G, ch 100~140 - { 149, 5, 30, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, - - { // Venezuela - "VE", - CE, - { - { 1, 13, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 149, 4, 27, BOTH, FALSE}, // 5G, ch 149~161 - { 0}, // end - } - }, - - { // Default - "", - CE, - { - { 1, 11, 20, BOTH, FALSE}, // 2.4 G, ch 1~11 - { 36, 4, 20, BOTH, FALSE}, // 5G, ch 52~64 - { 52, 4, 20, BOTH, FALSE}, // 5G, ch 52~64 - { 100, 11, 20, BOTH, FALSE}, // 5G, ch 100~140 - { 149, 5, 20, BOTH, FALSE}, // 5G, ch 149~165 - { 0}, // end - } - }, +INT CH_HZ_ID_MAP_NUM = (sizeof(CH_HZ_ID_MAP) / sizeof(CH_FREQ_MAP)); + +CH_REGION ChRegion[] = { + { // Antigua and Berbuda + "AG", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, BOTH, FALSE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, FALSE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Argentina + "AR", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {52, 4, 24, BOTH, FALSE} + , // 5G, ch 52~64 + {149, 4, 30, BOTH, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Aruba + "AW", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, BOTH, FALSE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, FALSE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Australia + "AU", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 24, BOTH, FALSE} + , // 5G, ch 52~64 + {149, 5, 30, BOTH, FALSE} + , // 5G, ch 149~165 + {0} + , // end + } + } + , + + { // Austria + "AT", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, TRUE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Bahamas + "BS", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 24, BOTH, FALSE} + , // 5G, ch 52~64 + {149, 5, 30, BOTH, FALSE} + , // 5G, ch 149~165 + {0} + , // end + } + } + , + + { // Barbados + "BB", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 24, BOTH, FALSE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, FALSE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Bermuda + "BM", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 24, BOTH, FALSE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, FALSE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Brazil + "BR", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 24, BOTH, FALSE} + , // 5G, ch 52~64 + {100, 11, 24, BOTH, FALSE} + , // 5G, ch 100~140 + {149, 5, 30, BOTH, FALSE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Belgium + "BE", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 18, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 18, IDOR, FALSE} + , // 5G, ch 52~64 + {0} + , // end + } + } + , + + { // Bulgaria + "BG", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, ODOR, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Canada + "CA", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, BOTH, FALSE} + , // 5G, ch 52~64 + {149, 5, 30, BOTH, FALSE} + , // 5G, ch 149~165 + {0} + , // end + } + } + , + + { // Cayman IsLands + "KY", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 24, BOTH, FALSE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, FALSE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Chile + "CL", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 20, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 20, BOTH, FALSE} + , // 5G, ch 52~64 + {149, 5, 20, BOTH, FALSE} + , // 5G, ch 149~165 + {0} + , // end + } + } + , + + { // China + "CN", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {149, 4, 27, BOTH, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Colombia + "CO", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 17, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 24, BOTH, FALSE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, FALSE} + , // 5G, ch 100~140 + {149, 5, 30, BOTH, FALSE} + , // 5G, ch 149~165 + {0} + , // end + } + } + , + + { // Costa Rica + "CR", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 17, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 24, BOTH, FALSE} + , // 5G, ch 52~64 + {149, 4, 30, BOTH, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Cyprus + "CY", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 24, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Czech_Republic + "CZ", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {0} + , // end + } + } + , + + { // Denmark + "DK", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Dominican Republic + "DO", + CE, + { + {1, 0, 20, BOTH, FALSE} + , // 2.4 G, ch 0 + {149, 4, 20, BOTH, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Equador + "EC", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {100, 11, 27, BOTH, FALSE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // El Salvador + "SV", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 30, BOTH, TRUE} + , // 5G, ch 52~64 + {149, 4, 36, BOTH, TRUE} + , // 5G, ch 149~165 + {0} + , // end + } + } + , + + { // Finland + "FI", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // France + "FR", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {0} + , // end + } + } + , + + { // Germany + "DE", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Greece + "GR", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, ODOR, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Guam + "GU", + CE, + { + {1, 11, 20, BOTH, FALSE} + , // 2.4 G, ch 1~11 + {36, 4, 17, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 24, BOTH, FALSE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, FALSE} + , // 5G, ch 100~140 + {149, 5, 30, BOTH, FALSE} + , // 5G, ch 149~165 + {0} + , // end + } + } + , + + { // Guatemala + "GT", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 17, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 24, BOTH, FALSE} + , // 5G, ch 52~64 + {149, 4, 30, BOTH, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Haiti + "HT", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 17, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 24, BOTH, FALSE} + , // 5G, ch 52~64 + {149, 4, 30, BOTH, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Honduras + "HN", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {149, 4, 27, BOTH, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Hong Kong + "HK", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, FALSE} + , // 5G, ch 52~64 + {149, 4, 30, BOTH, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Hungary + "HU", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {0} + , // end + } + } + , + + { // Iceland + "IS", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // India + "IN", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {149, 4, 24, IDOR, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Indonesia + "ID", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {149, 4, 27, BOTH, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Ireland + "IE", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, ODOR, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Israel + "IL", + CE, + { + {1, 3, 20, IDOR, FALSE} + , // 2.4 G, ch 1~3 + {4, 6, 20, BOTH, FALSE} + , // 2.4 G, ch 4~9 + {10, 4, 20, IDOR, FALSE} + , // 2.4 G, ch 10~13 + {0} + , // end + } + } + , + + { // Italy + "IT", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, ODOR, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Japan + "JP", + JAP, + { + {1, 14, 20, BOTH, FALSE} + , // 2.4 G, ch 1~14 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {0} + , // end + } + } + , + + { // Jordan + "JO", + CE, + { + {1, 13, 20, IDOR, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {149, 4, 23, IDOR, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Latvia + "LV", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Liechtenstein + "LI", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Lithuania + "LT", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Luxemburg + "LU", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Malaysia + "MY", + CE, + { + {36, 4, 23, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, BOTH, FALSE} + , // 5G, ch 52~64 + {149, 5, 20, BOTH, FALSE} + , // 5G, ch 149~165 + {0} + , // end + } + } + , + + { // Malta + "MT", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Marocco + "MA", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 24, IDOR, FALSE} + , // 5G, ch 36~48 + {0} + , // end + } + } + , + + { // Mexico + "MX", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 24, BOTH, FALSE} + , // 5G, ch 52~64 + {149, 5, 30, IDOR, FALSE} + , // 5G, ch 149~165 + {0} + , // end + } + } + , + + { // Netherlands + "NL", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 24, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // New Zealand + "NZ", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 24, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 24, BOTH, FALSE} + , // 5G, ch 52~64 + {149, 4, 30, BOTH, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Norway + "NO", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 24, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 24, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Peru + "PE", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {149, 4, 27, BOTH, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Portugal + "PT", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Poland + "PL", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Romania + "RO", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Russia + "RU", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {149, 4, 20, IDOR, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Saudi Arabia + "SA", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, BOTH, FALSE} + , // 5G, ch 52~64 + {149, 4, 23, BOTH, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Serbia_and_Montenegro + "CS", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {0} + , // end + } + } + , + + { // Singapore + "SG", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, BOTH, FALSE} + , // 5G, ch 52~64 + {149, 4, 20, BOTH, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Slovakia + "SK", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Slovenia + "SI", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {0} + , // end + } + } + , + + { // South Africa + "ZA", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, FALSE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {149, 4, 30, BOTH, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // South Korea + "KR", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 20, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 20, BOTH, FALSE} + , // 5G, ch 52~64 + {100, 8, 20, BOTH, FALSE} + , // 5G, ch 100~128 + {149, 4, 20, BOTH, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Spain + "ES", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 17, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Sweden + "SE", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Switzerland + "CH", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~13 + {36, 4, 23, IDOR, TRUE} + , // 5G, ch 36~48 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {0} + , // end + } + } + , + + { // Taiwan + "TW", + CE, + { + {1, 11, 30, BOTH, FALSE} + , // 2.4 G, ch 1~11 + {52, 4, 23, IDOR, FALSE} + , // 5G, ch 52~64 + {0} + , // end + } + } + , + + { // Turkey + "TR", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~11 + {36, 4, 23, BOTH, FALSE} + , // 5G, ch 36~48 + {52, 4, 23, BOTH, FALSE} + , // 5G, ch 52~64 + {0} + , // end + } + } + , + + { // UK + "GB", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~11 + {36, 4, 23, IDOR, FALSE} + , // 5G, ch 52~64 + {52, 4, 23, IDOR, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {0} + , // end + } + } + , + + { // Ukraine + "UA", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~11 + {0} + , // end + } + } + , + + { // United_Arab_Emirates + "AE", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~11 + {0} + , // end + } + } + , + + { // United_States + "US", + CE, + { + {1, 11, 30, BOTH, FALSE} + , // 2.4 G, ch 1~11 + {36, 4, 17, IDOR, FALSE} + , // 5G, ch 52~64 + {52, 4, 24, BOTH, TRUE} + , // 5G, ch 52~64 + {100, 11, 30, BOTH, TRUE} + , // 5G, ch 100~140 + {149, 5, 30, BOTH, FALSE} + , // 5G, ch 149~165 + {0} + , // end + } + } + , + + { // Venezuela + "VE", + CE, + { + {1, 13, 20, BOTH, FALSE} + , // 2.4 G, ch 1~11 + {149, 4, 27, BOTH, FALSE} + , // 5G, ch 149~161 + {0} + , // end + } + } + , + + { // Default + "", + CE, + { + {1, 11, 20, BOTH, FALSE} + , // 2.4 G, ch 1~11 + {36, 4, 20, BOTH, FALSE} + , // 5G, ch 52~64 + {52, 4, 20, BOTH, FALSE} + , // 5G, ch 52~64 + {100, 11, 20, BOTH, FALSE} + , // 5G, ch 100~140 + {149, 5, 20, BOTH, FALSE} + , // 5G, ch 149~165 + {0} + , // end + } + } + , }; - -static PCH_REGION GetChRegion( - IN PUCHAR CntryCode) +static PCH_REGION GetChRegion(IN PUCHAR CntryCode) { INT loop = 0; PCH_REGION pChRegion = NULL; - while (strcmp((PSTRING) ChRegion[loop].CountReg, "") != 0) - { - if (strncmp((PSTRING) ChRegion[loop].CountReg, (PSTRING) CntryCode, 2) == 0) - { + while (strcmp((PSTRING) ChRegion[loop].CountReg, "") != 0) { + if (strncmp + ((PSTRING) ChRegion[loop].CountReg, (PSTRING) CntryCode, + 2) == 0) { pChRegion = &ChRegion[loop]; break; } @@ -982,54 +1442,49 @@ static PCH_REGION GetChRegion( return pChRegion; } -static VOID ChBandCheck( - IN UCHAR PhyMode, - OUT PUCHAR pChType) +static VOID ChBandCheck(IN UCHAR PhyMode, OUT PUCHAR pChType) { - switch(PhyMode) - { - case PHY_11A: - case PHY_11AN_MIXED: - *pChType = BAND_5G; - break; - case PHY_11ABG_MIXED: - case PHY_11AGN_MIXED: - case PHY_11ABGN_MIXED: - *pChType = BAND_BOTH; - break; - - default: - *pChType = BAND_24G; - break; + switch (PhyMode) { + case PHY_11A: + case PHY_11AN_MIXED: + *pChType = BAND_5G; + break; + case PHY_11ABG_MIXED: + case PHY_11AGN_MIXED: + case PHY_11ABGN_MIXED: + *pChType = BAND_BOTH; + break; + + default: + *pChType = BAND_24G; + break; } } -static UCHAR FillChList( - IN PRTMP_ADAPTER pAd, - IN PCH_DESP pChDesp, - IN UCHAR Offset, - IN UCHAR increment) +static UCHAR FillChList(IN PRTMP_ADAPTER pAd, + IN PCH_DESP pChDesp, + IN UCHAR Offset, IN UCHAR increment) { INT i, j, l; UCHAR channel; j = Offset; - for (i = 0; i < pChDesp->NumOfCh; i++) - { + for (i = 0; i < pChDesp->NumOfCh; i++) { channel = pChDesp->FirstChannel + i * increment; - for (l=0; lTxPower[l].Channel) - { - pAd->ChannelList[j].Power = pAd->TxPower[l].Power; - pAd->ChannelList[j].Power2 = pAd->TxPower[l].Power2; + for (l = 0; l < MAX_NUM_OF_CHANNELS; l++) { + if (channel == pAd->TxPower[l].Channel) { + pAd->ChannelList[j].Power = + pAd->TxPower[l].Power; + pAd->ChannelList[j].Power2 = + pAd->TxPower[l].Power2; break; } } if (l == MAX_NUM_OF_CHANNELS) continue; - pAd->ChannelList[j].Channel = pChDesp->FirstChannel + i * increment; + pAd->ChannelList[j].Channel = + pChDesp->FirstChannel + i * increment; pAd->ChannelList[j].MaxTxPwr = pChDesp->MaxTxPwr; pAd->ChannelList[j].DfsReq = pChDesp->DfsReq; j++; @@ -1039,11 +1494,8 @@ static UCHAR FillChList( return j; } - -static inline VOID CreateChList( - IN PRTMP_ADAPTER pAd, - IN PCH_REGION pChRegion, - IN UCHAR Geography) +static inline VOID CreateChList(IN PRTMP_ADAPTER pAd, + IN PCH_REGION pChRegion, IN UCHAR Geography) { INT i; UCHAR offset = 0; @@ -1056,38 +1508,31 @@ static inline VOID CreateChList( ChBandCheck(pAd->CommonCfg.PhyMode, &ChType); - for (i=0; i<10; i++) - { + for (i = 0; i < 10; i++) { pChDesp = &pChRegion->ChDesp[i]; if (pChDesp->FirstChannel == 0) break; - if (ChType == BAND_5G) - { + if (ChType == BAND_5G) { if (pChDesp->FirstChannel <= 14) continue; - } - else if (ChType == BAND_24G) - { + } else if (ChType == BAND_24G) { if (pChDesp->FirstChannel > 14) continue; } if ((pChDesp->Geography == BOTH) - || (pChDesp->Geography == Geography)) - { + || (pChDesp->Geography == Geography)) { if (pChDesp->FirstChannel > 14) - increment = 4; - else - increment = 1; + increment = 4; + else + increment = 1; offset = FillChList(pAd, pChDesp, offset, increment); - } + } } } - -VOID BuildChannelListEx( - IN PRTMP_ADAPTER pAd) +VOID BuildChannelListEx(IN PRTMP_ADAPTER pAd) { PCH_REGION pChReg; @@ -1095,11 +1540,8 @@ VOID BuildChannelListEx( CreateChList(pAd, pChReg, pAd->CommonCfg.Geography); } - -VOID BuildBeaconChList( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf, - OUT PULONG pBufLen) +VOID BuildBeaconChList(IN PRTMP_ADAPTER pAd, + OUT PUCHAR pBuf, OUT PULONG pBufLen) { INT i; ULONG TmpLen; @@ -1115,46 +1557,35 @@ VOID BuildBeaconChList( ChBandCheck(pAd->CommonCfg.PhyMode, &ChType); *pBufLen = 0; - for (i=0; i<10; i++) - { + for (i = 0; i < 10; i++) { pChDesp = &pChRegion->ChDesp[i]; if (pChDesp->FirstChannel == 0) break; - if (ChType == BAND_5G) - { + if (ChType == BAND_5G) { if (pChDesp->FirstChannel <= 14) continue; - } - else if (ChType == BAND_24G) - { + } else if (ChType == BAND_24G) { if (pChDesp->FirstChannel > 14) continue; } if ((pChDesp->Geography == BOTH) - || (pChDesp->Geography == pAd->CommonCfg.Geography)) - { - MakeOutgoingFrame(pBuf + *pBufLen, &TmpLen, - 1, &pChDesp->FirstChannel, - 1, &pChDesp->NumOfCh, - 1, &pChDesp->MaxTxPwr, - END_OF_ARGS); + || (pChDesp->Geography == pAd->CommonCfg.Geography)) { + MakeOutgoingFrame(pBuf + *pBufLen, &TmpLen, + 1, &pChDesp->FirstChannel, + 1, &pChDesp->NumOfCh, + 1, &pChDesp->MaxTxPwr, END_OF_ARGS); *pBufLen += TmpLen; } } } - -static BOOLEAN IsValidChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR channel) - +static BOOLEAN IsValidChannel(IN PRTMP_ADAPTER pAd, IN UCHAR channel) { INT i; - for (i = 0; i < pAd->ChannelListNum; i++) - { + for (i = 0; i < pAd->ChannelListNum; i++) { if (pAd->ChannelList[i].Channel == channel) break; } @@ -1165,10 +1596,7 @@ static BOOLEAN IsValidChannel( return TRUE; } - -static UCHAR GetExtCh( - IN UCHAR Channel, - IN UCHAR Direction) +static UCHAR GetExtCh(IN UCHAR Channel, IN UCHAR Direction) { CHAR ExtCh; @@ -1180,95 +1608,92 @@ static UCHAR GetExtCh( return ExtCh; } - -VOID N_ChannelCheck( - IN PRTMP_ADAPTER pAd) +VOID N_ChannelCheck(IN PRTMP_ADAPTER pAd) { //UCHAR ChannelNum = pAd->ChannelListNum; UCHAR Channel = pAd->CommonCfg.Channel; - if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)) - { - if (Channel > 14) - { - if ((Channel == 36) || (Channel == 44) || (Channel == 52) || (Channel == 60) || (Channel == 100) || (Channel == 108) || - (Channel == 116) || (Channel == 124) || (Channel == 132) || (Channel == 149) || (Channel == 157)) - { - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE; - } - else if ((Channel == 40) || (Channel == 48) || (Channel == 56) || (Channel == 64) || (Channel == 104) || (Channel == 112) || - (Channel == 120) || (Channel == 128) || (Channel == 136) || (Channel == 153) || (Channel == 161)) - { - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW; - } - else - { - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - } - } - else - { - do - { + if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) + && (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)) { + if (Channel > 14) { + if ((Channel == 36) || (Channel == 44) + || (Channel == 52) || (Channel == 60) + || (Channel == 100) || (Channel == 108) + || (Channel == 116) || (Channel == 124) + || (Channel == 132) || (Channel == 149) + || (Channel == 157)) { + pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = + EXTCHA_ABOVE; + } else if ((Channel == 40) || (Channel == 48) + || (Channel == 56) || (Channel == 64) + || (Channel == 104) || (Channel == 112) + || (Channel == 120) || (Channel == 128) + || (Channel == 136) || (Channel == 153) + || (Channel == 161)) { + pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = + EXTCHA_BELOW; + } else { + pAd->CommonCfg.RegTransmitSetting.field.BW = + BW_20; + } + } else { + do { UCHAR ExtCh; - UCHAR Dir = pAd->CommonCfg.RegTransmitSetting.field.EXTCHA; + UCHAR Dir = + pAd->CommonCfg.RegTransmitSetting.field. + EXTCHA; ExtCh = GetExtCh(Channel, Dir); if (IsValidChannel(pAd, ExtCh)) break; - Dir = (Dir == EXTCHA_ABOVE) ? EXTCHA_BELOW : EXTCHA_ABOVE; + Dir = + (Dir == + EXTCHA_ABOVE) ? EXTCHA_BELOW : + EXTCHA_ABOVE; ExtCh = GetExtCh(Channel, Dir); - if (IsValidChannel(pAd, ExtCh)) - { - pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = Dir; + if (IsValidChannel(pAd, ExtCh)) { + pAd->CommonCfg.RegTransmitSetting.field. + EXTCHA = Dir; break; } - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - } while(FALSE); + pAd->CommonCfg.RegTransmitSetting.field.BW = + BW_20; + } while (FALSE); - if (Channel == 14) - { - pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - //pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_NONE; // We didn't set the ExtCh as NONE due to it'll set in RTMPSetHT() + if (Channel == 14) { + pAd->CommonCfg.RegTransmitSetting.field.BW = + BW_20; + //pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_NONE; // We didn't set the ExtCh as NONE due to it'll set in RTMPSetHT() } } } - } - -VOID N_SetCenCh( - IN PRTMP_ADAPTER pAd) +VOID N_SetCenCh(IN PRTMP_ADAPTER pAd) { - if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40) - { - if (pAd->CommonCfg.RegTransmitSetting.field.EXTCHA == EXTCHA_ABOVE) - { - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel + 2; - } - else - { + if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40) { + if (pAd->CommonCfg.RegTransmitSetting.field.EXTCHA == + EXTCHA_ABOVE) { + pAd->CommonCfg.CentralChannel = + pAd->CommonCfg.Channel + 2; + } else { if (pAd->CommonCfg.Channel == 14) - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel - 1; + pAd->CommonCfg.CentralChannel = + pAd->CommonCfg.Channel - 1; else - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel - 2; + pAd->CommonCfg.CentralChannel = + pAd->CommonCfg.Channel - 2; } - } - else - { + } else { pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; } } - -UINT8 GetCuntryMaxTxPwr( - IN PRTMP_ADAPTER pAd, - IN UINT8 channel) +UINT8 GetCuntryMaxTxPwr(IN PRTMP_ADAPTER pAd, IN UINT8 channel) { int i; - for (i = 0; i < pAd->ChannelListNum; i++) - { + for (i = 0; i < pAd->ChannelListNum; i++) { if (pAd->ChannelList[i].Channel == channel) break; } diff --git a/drivers/staging/rt2860/common/rt_rf.c b/drivers/staging/rt2860/common/rt_rf.c index e9f9384b024a..b6e47a155b4a 100644 --- a/drivers/staging/rt2860/common/rt_rf.c +++ b/drivers/staging/rt2860/common/rt_rf.c @@ -35,10 +35,8 @@ -------- ---------- ---------------------------------------------- */ - #include "../rt_config.h" - #ifdef RTMP_RF_RW_SUPPORT /* ======================================================================== @@ -55,27 +53,26 @@ ======================================================================== */ -NDIS_STATUS RT30xxWriteRFRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR regID, - IN UCHAR value) +NDIS_STATUS RT30xxWriteRFRegister(IN PRTMP_ADAPTER pAd, + IN UCHAR regID, IN UCHAR value) { - RF_CSR_CFG_STRUC rfcsr; - UINT i = 0; + RF_CSR_CFG_STRUC rfcsr; + UINT i = 0; - do - { + do { RTMP_IO_READ32(pAd, RF_CSR_CFG, &rfcsr.word); if (!rfcsr.field.RF_CSR_KICK) break; i++; } - while ((i < RETRY_LIMIT) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); + while ((i < RETRY_LIMIT) + && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))); - if ((i == RETRY_LIMIT) || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) - { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("Retry count exhausted or device removed!!!\n")); + if ((i == RETRY_LIMIT) + || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) { + DBGPRINT_RAW(RT_DEBUG_ERROR, + ("Retry count exhausted or device removed!!!\n")); return STATUS_UNSUCCESSFUL; } @@ -89,7 +86,6 @@ NDIS_STATUS RT30xxWriteRFRegister( return NDIS_STATUS_SUCCESS; } - /* ======================================================================== @@ -105,20 +101,16 @@ NDIS_STATUS RT30xxWriteRFRegister( ======================================================================== */ -NDIS_STATUS RT30xxReadRFRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR regID, - IN PUCHAR pValue) +NDIS_STATUS RT30xxReadRFRegister(IN PRTMP_ADAPTER pAd, + IN UCHAR regID, IN PUCHAR pValue) { - RF_CSR_CFG_STRUC rfcsr; - UINT i=0, k=0; + RF_CSR_CFG_STRUC rfcsr; + UINT i = 0, k = 0; - for (i=0; ichipOps.AsicRfInit) pAd->chipOps.AsicRfInit(pAd); } - -VOID RtmpChipOpsRFHook( - IN RTMP_ADAPTER *pAd) +VOID RtmpChipOpsRFHook(IN RTMP_ADAPTER * pAd) { RTMP_CHIP_OP *pChipOps = &pAd->chipOps; @@ -172,27 +158,27 @@ VOID RtmpChipOpsRFHook( /* We depends on RfICType and MACVersion to assign the corresponding operation callbacks. */ #ifdef RT30xx - if (IS_RT30xx(pAd)) - { + if (IS_RT30xx(pAd)) { pChipOps->pRFRegTable = RT30xx_RFRegTable; pChipOps->AsicHaltAction = RT30xxHaltAction; #ifdef RT3070 - if((IS_RT3070(pAd) || IS_RT3071(pAd)) && (pAd->infType == RTMP_DEV_INF_USB)) - { + if ((IS_RT3070(pAd) || IS_RT3071(pAd)) + && (pAd->infType == RTMP_DEV_INF_USB)) { pChipOps->AsicRfInit = NICInitRT3070RFRegisters; - if (IS_RT3071(pAd)) - { - pChipOps->AsicRfTurnOff = RT30xxLoadRFSleepModeSetup; - pChipOps->AsicReverseRfFromSleepMode = RT30xxReverseRFSleepModeSetup; + if (IS_RT3071(pAd)) { + pChipOps->AsicRfTurnOff = + RT30xxLoadRFSleepModeSetup; + pChipOps->AsicReverseRfFromSleepMode = + RT30xxReverseRFSleepModeSetup; } } #endif // RT3070 // #ifdef RT3090 - if (IS_RT3090(pAd) && (pAd->infType == RTMP_DEV_INF_PCI)) - { + if (IS_RT3090(pAd) && (pAd->infType == RTMP_DEV_INF_PCI)) { pChipOps->AsicRfTurnOff = RT30xxLoadRFSleepModeSetup; pChipOps->AsicRfInit = NICInitRT3090RFRegisters; - pChipOps->AsicReverseRfFromSleepMode = RT30xxReverseRFSleepModeSetup; + pChipOps->AsicReverseRfFromSleepMode = + RT30xxReverseRFSleepModeSetup; } #endif // RT3090 // } diff --git a/drivers/staging/rt2860/common/rtmp_init.c b/drivers/staging/rt2860/common/rtmp_init.c index 1cc6e44e257e..c169641c5779 100644 --- a/drivers/staging/rt2860/common/rtmp_init.c +++ b/drivers/staging/rt2860/common/rtmp_init.c @@ -36,103 +36,103 @@ */ #include "../rt_config.h" -UCHAR BIT8[] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80}; -char* CipherName[] = {"none","wep64","wep128","TKIP","AES","CKIP64","CKIP128"}; +UCHAR BIT8[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; +char *CipherName[] = + { "none", "wep64", "wep128", "TKIP", "AES", "CKIP64", "CKIP128" }; // // BBP register initialization set // -REG_PAIR BBPRegTable[] = { - {BBP_R65, 0x2C}, // fix rssi issue - {BBP_R66, 0x38}, // Also set this default value to pAd->BbpTuning.R66CurrentValue at initial - {BBP_R69, 0x12}, - {BBP_R70, 0xa}, // BBP_R70 will change to 0x8 in ApStartUp and LinkUp for rt2860C, otherwise value is 0xa - {BBP_R73, 0x10}, - {BBP_R81, 0x37}, - {BBP_R82, 0x62}, - {BBP_R83, 0x6A}, - {BBP_R84, 0x99}, // 0x19 is for rt2860E and after. This is for extension channel overlapping IOT. 0x99 is for rt2860D and before - {BBP_R86, 0x00}, // middle range issue, Rory @2008-01-28 - {BBP_R91, 0x04}, // middle range issue, Rory @2008-01-28 - {BBP_R92, 0x00}, // middle range issue, Rory @2008-01-28 - {BBP_R103, 0x00}, // near range high-power issue, requested from Gary @2008-0528 - {BBP_R105, 0x05}, // 0x05 is for rt2860E to turn on FEQ control. It is safe for rt2860D and before, because Bit 7:2 are reserved in rt2860D and before. - {BBP_R106, 0x35}, // for ShortGI throughput +REG_PAIR BBPRegTable[] = { + {BBP_R65, 0x2C}, // fix rssi issue + {BBP_R66, 0x38}, // Also set this default value to pAd->BbpTuning.R66CurrentValue at initial + {BBP_R69, 0x12}, + {BBP_R70, 0xa}, // BBP_R70 will change to 0x8 in ApStartUp and LinkUp for rt2860C, otherwise value is 0xa + {BBP_R73, 0x10}, + {BBP_R81, 0x37}, + {BBP_R82, 0x62}, + {BBP_R83, 0x6A}, + {BBP_R84, 0x99}, // 0x19 is for rt2860E and after. This is for extension channel overlapping IOT. 0x99 is for rt2860D and before + {BBP_R86, 0x00}, // middle range issue, Rory @2008-01-28 + {BBP_R91, 0x04}, // middle range issue, Rory @2008-01-28 + {BBP_R92, 0x00}, // middle range issue, Rory @2008-01-28 + {BBP_R103, 0x00}, // near range high-power issue, requested from Gary @2008-0528 + {BBP_R105, 0x05}, // 0x05 is for rt2860E to turn on FEQ control. It is safe for rt2860D and before, because Bit 7:2 are reserved in rt2860D and before. + {BBP_R106, 0x35}, // for ShortGI throughput }; -#define NUM_BBP_REG_PARMS (sizeof(BBPRegTable) / sizeof(REG_PAIR)) +#define NUM_BBP_REG_PARMS (sizeof(BBPRegTable) / sizeof(REG_PAIR)) // // ASIC register initialization sets // -RTMP_REG_PAIR MACRegTable[] = { +RTMP_REG_PAIR MACRegTable[] = { #if defined(HW_BEACON_OFFSET) && (HW_BEACON_OFFSET == 0x200) - {BCN_OFFSET0, 0xf8f0e8e0}, /* 0x3800(e0), 0x3A00(e8), 0x3C00(f0), 0x3E00(f8), 512B for each beacon */ - {BCN_OFFSET1, 0x6f77d0c8}, /* 0x3200(c8), 0x3400(d0), 0x1DC0(77), 0x1BC0(6f), 512B for each beacon */ + {BCN_OFFSET0, 0xf8f0e8e0}, /* 0x3800(e0), 0x3A00(e8), 0x3C00(f0), 0x3E00(f8), 512B for each beacon */ + {BCN_OFFSET1, 0x6f77d0c8}, /* 0x3200(c8), 0x3400(d0), 0x1DC0(77), 0x1BC0(6f), 512B for each beacon */ #elif defined(HW_BEACON_OFFSET) && (HW_BEACON_OFFSET == 0x100) - {BCN_OFFSET0, 0xece8e4e0}, /* 0x3800, 0x3A00, 0x3C00, 0x3E00, 512B for each beacon */ - {BCN_OFFSET1, 0xfcf8f4f0}, /* 0x3800, 0x3A00, 0x3C00, 0x3E00, 512B for each beacon */ + {BCN_OFFSET0, 0xece8e4e0}, /* 0x3800, 0x3A00, 0x3C00, 0x3E00, 512B for each beacon */ + {BCN_OFFSET1, 0xfcf8f4f0}, /* 0x3800, 0x3A00, 0x3C00, 0x3E00, 512B for each beacon */ #else - #error You must re-calculate new value for BCN_OFFSET0 & BCN_OFFSET1 in MACRegTable[]!!! +#error You must re-calculate new value for BCN_OFFSET0 & BCN_OFFSET1 in MACRegTable[]!!! #endif // HW_BEACON_OFFSET // - {LEGACY_BASIC_RATE, 0x0000013f}, // Basic rate set bitmap - {HT_BASIC_RATE, 0x00008003}, // Basic HT rate set , 20M, MCS=3, MM. Format is the same as in TXWI. - {MAC_SYS_CTRL, 0x00}, // 0x1004, , default Disable RX - {RX_FILTR_CFG, 0x17f97}, //0x1400 , RX filter control, - {BKOFF_SLOT_CFG, 0x209}, // default set short slot time, CC_DELAY_TIME should be 2 - //{TX_SW_CFG0, 0x40a06}, // Gary,2006-08-23 - {TX_SW_CFG0, 0x0}, // Gary,2008-05-21 for CWC test - {TX_SW_CFG1, 0x80606}, // Gary,2006-08-23 - {TX_LINK_CFG, 0x1020}, // Gary,2006-08-23 - //{TX_TIMEOUT_CFG, 0x00182090}, // CCK has some problem. So increase timieout value. 2006-10-09// MArvek RT - {TX_TIMEOUT_CFG, 0x000a2090}, // CCK has some problem. So increase timieout value. 2006-10-09// MArvek RT , Modify for 2860E ,2007-08-01 - {MAX_LEN_CFG, MAX_AGGREGATION_SIZE | 0x00001000}, // 0x3018, MAX frame length. Max PSDU = 16kbytes. - {LED_CFG, 0x7f031e46}, // Gary, 2006-08-23 - - {PBF_MAX_PCNT, 0x1F3FBF9F}, //0x1F3f7f9f}, //Jan, 2006/04/20 - - {TX_RTY_CFG, 0x47d01f0f}, // Jan, 2006/11/16, Set TxWI->ACK =0 in Probe Rsp Modify for 2860E ,2007-08-03 - - {AUTO_RSP_CFG, 0x00000013}, // Initial Auto_Responder, because QA will turn off Auto-Responder - {CCK_PROT_CFG, 0x05740003 /*0x01740003*/}, // Initial Auto_Responder, because QA will turn off Auto-Responder. And RTS threshold is enabled. - {OFDM_PROT_CFG, 0x05740003 /*0x01740003*/}, // Initial Auto_Responder, because QA will turn off Auto-Responder. And RTS threshold is enabled. + {LEGACY_BASIC_RATE, 0x0000013f}, // Basic rate set bitmap + {HT_BASIC_RATE, 0x00008003}, // Basic HT rate set , 20M, MCS=3, MM. Format is the same as in TXWI. + {MAC_SYS_CTRL, 0x00}, // 0x1004, , default Disable RX + {RX_FILTR_CFG, 0x17f97}, //0x1400 , RX filter control, + {BKOFF_SLOT_CFG, 0x209}, // default set short slot time, CC_DELAY_TIME should be 2 + //{TX_SW_CFG0, 0x40a06}, // Gary,2006-08-23 + {TX_SW_CFG0, 0x0}, // Gary,2008-05-21 for CWC test + {TX_SW_CFG1, 0x80606}, // Gary,2006-08-23 + {TX_LINK_CFG, 0x1020}, // Gary,2006-08-23 + //{TX_TIMEOUT_CFG, 0x00182090}, // CCK has some problem. So increase timieout value. 2006-10-09// MArvek RT + {TX_TIMEOUT_CFG, 0x000a2090}, // CCK has some problem. So increase timieout value. 2006-10-09// MArvek RT , Modify for 2860E ,2007-08-01 + {MAX_LEN_CFG, MAX_AGGREGATION_SIZE | 0x00001000}, // 0x3018, MAX frame length. Max PSDU = 16kbytes. + {LED_CFG, 0x7f031e46}, // Gary, 2006-08-23 + + {PBF_MAX_PCNT, 0x1F3FBF9F}, //0x1F3f7f9f}, //Jan, 2006/04/20 + + {TX_RTY_CFG, 0x47d01f0f}, // Jan, 2006/11/16, Set TxWI->ACK =0 in Probe Rsp Modify for 2860E ,2007-08-03 + + {AUTO_RSP_CFG, 0x00000013}, // Initial Auto_Responder, because QA will turn off Auto-Responder + {CCK_PROT_CFG, 0x05740003 /*0x01740003 */ }, // Initial Auto_Responder, because QA will turn off Auto-Responder. And RTS threshold is enabled. + {OFDM_PROT_CFG, 0x05740003 /*0x01740003 */ }, // Initial Auto_Responder, because QA will turn off Auto-Responder. And RTS threshold is enabled. #ifdef RTMP_MAC_USB - {PBF_CFG, 0xf40006}, // Only enable Queue 2 - {MM40_PROT_CFG, 0x3F44084}, // Initial Auto_Responder, because QA will turn off Auto-Responder - {WPDMA_GLO_CFG, 0x00000030}, + {PBF_CFG, 0xf40006}, // Only enable Queue 2 + {MM40_PROT_CFG, 0x3F44084}, // Initial Auto_Responder, because QA will turn off Auto-Responder + {WPDMA_GLO_CFG, 0x00000030}, #endif // RTMP_MAC_USB // - {GF20_PROT_CFG, 0x01744004}, // set 19:18 --> Short NAV for MIMO PS - {GF40_PROT_CFG, 0x03F44084}, - {MM20_PROT_CFG, 0x01744004}, + {GF20_PROT_CFG, 0x01744004}, // set 19:18 --> Short NAV for MIMO PS + {GF40_PROT_CFG, 0x03F44084}, + {MM20_PROT_CFG, 0x01744004}, #ifdef RTMP_MAC_PCI - {MM40_PROT_CFG, 0x03F54084}, + {MM40_PROT_CFG, 0x03F54084}, #endif // RTMP_MAC_PCI // - {TXOP_CTRL_CFG, 0x0000583f, /*0x0000243f*/ /*0x000024bf*/}, //Extension channel backoff. - {TX_RTS_CFG, 0x00092b20}, - {EXP_ACK_TIME, 0x002400ca}, // default value + {TXOP_CTRL_CFG, 0x0000583f, /*0x0000243f *//*0x000024bf */ }, //Extension channel backoff. + {TX_RTS_CFG, 0x00092b20}, + {EXP_ACK_TIME, 0x002400ca}, // default value - {TXOP_HLDR_ET, 0x00000002}, + {TXOP_HLDR_ET, 0x00000002}, /* Jerry comments 2008/01/16: we use SIFS = 10us in CCK defaultly, but it seems that 10us - is too small for INTEL 2200bg card, so in MBSS mode, the delta time between beacon0 - and beacon1 is SIFS (10us), so if INTEL 2200bg card connects to BSS0, the ping - will always lost. So we change the SIFS of CCK from 10us to 16us. */ - {XIFS_TIME_CFG, 0x33a41010}, - {PWR_PIN_CFG, 0x00000003}, // patch for 2880-E + is too small for INTEL 2200bg card, so in MBSS mode, the delta time between beacon0 + and beacon1 is SIFS (10us), so if INTEL 2200bg card connects to BSS0, the ping + will always lost. So we change the SIFS of CCK from 10us to 16us. */ + {XIFS_TIME_CFG, 0x33a41010}, + {PWR_PIN_CFG, 0x00000003}, // patch for 2880-E }; -RTMP_REG_PAIR STAMACRegTable[] = { - {WMM_AIFSN_CFG, 0x00002273}, - {WMM_CWMIN_CFG, 0x00002344}, - {WMM_CWMAX_CFG, 0x000034aa}, +RTMP_REG_PAIR STAMACRegTable[] = { + {WMM_AIFSN_CFG, 0x00002273}, + {WMM_CWMIN_CFG, 0x00002344}, + {WMM_CWMAX_CFG, 0x000034aa}, }; #define NUM_MAC_REG_PARMS (sizeof(MACRegTable) / sizeof(RTMP_REG_PAIR)) #define NUM_STA_MAC_REG_PARMS (sizeof(STAMACRegTable) / sizeof(RTMP_REG_PAIR)) - /* ======================================================================== @@ -152,52 +152,48 @@ RTMP_REG_PAIR STAMACRegTable[] = { ======================================================================== */ -NDIS_STATUS RTMPAllocAdapterBlock( - IN PVOID handle, - OUT PRTMP_ADAPTER *ppAdapter) +NDIS_STATUS RTMPAllocAdapterBlock(IN PVOID handle, + OUT PRTMP_ADAPTER * ppAdapter) { - PRTMP_ADAPTER pAd; - NDIS_STATUS Status; - INT index; - UCHAR *pBeaconBuf = NULL; + PRTMP_ADAPTER pAd; + NDIS_STATUS Status; + INT index; + UCHAR *pBeaconBuf = NULL; DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPAllocAdapterBlock\n")); *ppAdapter = NULL; - do - { + do { // Allocate RTMP_ADAPTER memory block pBeaconBuf = kmalloc(MAX_BEACON_SIZE, MEM_ALLOC_FLAG); - if (pBeaconBuf == NULL) - { + if (pBeaconBuf == NULL) { Status = NDIS_STATUS_FAILURE; DBGPRINT_ERR(("Failed to allocate memory - BeaconBuf!\n")); break; } NdisZeroMemory(pBeaconBuf, MAX_BEACON_SIZE); - Status = AdapterBlockAllocateMemory(handle, (PVOID *)&pAd); - if (Status != NDIS_STATUS_SUCCESS) - { + Status = AdapterBlockAllocateMemory(handle, (PVOID *) & pAd); + if (Status != NDIS_STATUS_SUCCESS) { DBGPRINT_ERR(("Failed to allocate memory - ADAPTER\n")); break; } pAd->BeaconBuf = pBeaconBuf; - DBGPRINT(RT_DEBUG_OFF, ("\n\n=== pAd = %p, size = %d ===\n\n", pAd, (UINT32)sizeof(RTMP_ADAPTER))); - + DBGPRINT(RT_DEBUG_OFF, + ("\n\n=== pAd = %p, size = %d ===\n\n", pAd, + (UINT32) sizeof(RTMP_ADAPTER))); // Init spin locks NdisAllocateSpinLock(&pAd->MgmtRingLock); #ifdef RTMP_MAC_PCI NdisAllocateSpinLock(&pAd->RxRingLock); #ifdef RT3090 - NdisAllocateSpinLock(&pAd->McuCmdLock); + NdisAllocateSpinLock(&pAd->McuCmdLock); #endif // RT3090 // #endif // RTMP_MAC_PCI // - for (index =0 ; index < NUM_OF_TX_RING; index++) - { + for (index = 0; index < NUM_OF_TX_RING; index++) { NdisAllocateSpinLock(&pAd->TxSwQueueLock[index]); NdisAllocateSpinLock(&pAd->DeQueueLock[index]); pAd->DeQueueRunning[index] = FALSE; @@ -234,14 +230,13 @@ NDIS_STATUS RTMPAllocAdapterBlock( ======================================================================== */ -VOID RTMPReadTxPwrPerRate( - IN PRTMP_ADAPTER pAd) +VOID RTMPReadTxPwrPerRate(IN PRTMP_ADAPTER pAd) { - ULONG data, Adata, Gdata; - USHORT i, value, value2; - INT Apwrdelta, Gpwrdelta; - UCHAR t1,t2,t3,t4; - BOOLEAN bApwrdeltaMinus = TRUE, bGpwrdeltaMinus = TRUE; + ULONG data, Adata, Gdata; + USHORT i, value, value2; + INT Apwrdelta, Gpwrdelta; + UCHAR t1, t2, t3, t4; + BOOLEAN bApwrdeltaMinus = TRUE, bGpwrdeltaMinus = TRUE; // // Get power delta for 20MHz and 40MHz. @@ -251,178 +246,168 @@ VOID RTMPReadTxPwrPerRate( Apwrdelta = 0; Gpwrdelta = 0; - if ((value2 & 0xff) != 0xff) - { + if ((value2 & 0xff) != 0xff) { if ((value2 & 0x80)) - Gpwrdelta = (value2&0xf); + Gpwrdelta = (value2 & 0xf); if ((value2 & 0x40)) bGpwrdeltaMinus = FALSE; else bGpwrdeltaMinus = TRUE; } - if ((value2 & 0xff00) != 0xff00) - { + if ((value2 & 0xff00) != 0xff00) { if ((value2 & 0x8000)) - Apwrdelta = ((value2&0xf00)>>8); + Apwrdelta = ((value2 & 0xf00) >> 8); if ((value2 & 0x4000)) bApwrdeltaMinus = FALSE; else bApwrdeltaMinus = TRUE; } - DBGPRINT(RT_DEBUG_TRACE, ("Gpwrdelta = %x, Apwrdelta = %x .\n", Gpwrdelta, Apwrdelta)); + DBGPRINT(RT_DEBUG_TRACE, + ("Gpwrdelta = %x, Apwrdelta = %x .\n", Gpwrdelta, Apwrdelta)); // // Get Txpower per MCS for 20MHz in 2.4G. // - for (i=0; i<5; i++) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_TXPOWER_BYRATE_20MHZ_2_4G + i*4, value); + for (i = 0; i < 5; i++) { + RT28xx_EEPROM_READ16(pAd, + EEPROM_TXPOWER_BYRATE_20MHZ_2_4G + i * 4, + value); data = value; - if (bApwrdeltaMinus == FALSE) - { - t1 = (value&0xf)+(Apwrdelta); + if (bApwrdeltaMinus == FALSE) { + t1 = (value & 0xf) + (Apwrdelta); if (t1 > 0xf) t1 = 0xf; - t2 = ((value&0xf0)>>4)+(Apwrdelta); + t2 = ((value & 0xf0) >> 4) + (Apwrdelta); if (t2 > 0xf) t2 = 0xf; - t3 = ((value&0xf00)>>8)+(Apwrdelta); + t3 = ((value & 0xf00) >> 8) + (Apwrdelta); if (t3 > 0xf) t3 = 0xf; - t4 = ((value&0xf000)>>12)+(Apwrdelta); + t4 = ((value & 0xf000) >> 12) + (Apwrdelta); if (t4 > 0xf) t4 = 0xf; - } - else - { - if ((value&0xf) > Apwrdelta) - t1 = (value&0xf)-(Apwrdelta); + } else { + if ((value & 0xf) > Apwrdelta) + t1 = (value & 0xf) - (Apwrdelta); else t1 = 0; - if (((value&0xf0)>>4) > Apwrdelta) - t2 = ((value&0xf0)>>4)-(Apwrdelta); + if (((value & 0xf0) >> 4) > Apwrdelta) + t2 = ((value & 0xf0) >> 4) - (Apwrdelta); else t2 = 0; - if (((value&0xf00)>>8) > Apwrdelta) - t3 = ((value&0xf00)>>8)-(Apwrdelta); + if (((value & 0xf00) >> 8) > Apwrdelta) + t3 = ((value & 0xf00) >> 8) - (Apwrdelta); else t3 = 0; - if (((value&0xf000)>>12) > Apwrdelta) - t4 = ((value&0xf000)>>12)-(Apwrdelta); + if (((value & 0xf000) >> 12) > Apwrdelta) + t4 = ((value & 0xf000) >> 12) - (Apwrdelta); else t4 = 0; } - Adata = t1 + (t2<<4) + (t3<<8) + (t4<<12); - if (bGpwrdeltaMinus == FALSE) - { - t1 = (value&0xf)+(Gpwrdelta); + Adata = t1 + (t2 << 4) + (t3 << 8) + (t4 << 12); + if (bGpwrdeltaMinus == FALSE) { + t1 = (value & 0xf) + (Gpwrdelta); if (t1 > 0xf) t1 = 0xf; - t2 = ((value&0xf0)>>4)+(Gpwrdelta); + t2 = ((value & 0xf0) >> 4) + (Gpwrdelta); if (t2 > 0xf) t2 = 0xf; - t3 = ((value&0xf00)>>8)+(Gpwrdelta); + t3 = ((value & 0xf00) >> 8) + (Gpwrdelta); if (t3 > 0xf) t3 = 0xf; - t4 = ((value&0xf000)>>12)+(Gpwrdelta); + t4 = ((value & 0xf000) >> 12) + (Gpwrdelta); if (t4 > 0xf) t4 = 0xf; - } - else - { - if ((value&0xf) > Gpwrdelta) - t1 = (value&0xf)-(Gpwrdelta); + } else { + if ((value & 0xf) > Gpwrdelta) + t1 = (value & 0xf) - (Gpwrdelta); else t1 = 0; - if (((value&0xf0)>>4) > Gpwrdelta) - t2 = ((value&0xf0)>>4)-(Gpwrdelta); + if (((value & 0xf0) >> 4) > Gpwrdelta) + t2 = ((value & 0xf0) >> 4) - (Gpwrdelta); else t2 = 0; - if (((value&0xf00)>>8) > Gpwrdelta) - t3 = ((value&0xf00)>>8)-(Gpwrdelta); + if (((value & 0xf00) >> 8) > Gpwrdelta) + t3 = ((value & 0xf00) >> 8) - (Gpwrdelta); else t3 = 0; - if (((value&0xf000)>>12) > Gpwrdelta) - t4 = ((value&0xf000)>>12)-(Gpwrdelta); + if (((value & 0xf000) >> 12) > Gpwrdelta) + t4 = ((value & 0xf000) >> 12) - (Gpwrdelta); else t4 = 0; } - Gdata = t1 + (t2<<4) + (t3<<8) + (t4<<12); + Gdata = t1 + (t2 << 4) + (t3 << 8) + (t4 << 12); - RT28xx_EEPROM_READ16(pAd, EEPROM_TXPOWER_BYRATE_20MHZ_2_4G + i*4 + 2, value); - if (bApwrdeltaMinus == FALSE) - { - t1 = (value&0xf)+(Apwrdelta); + RT28xx_EEPROM_READ16(pAd, + EEPROM_TXPOWER_BYRATE_20MHZ_2_4G + i * 4 + + 2, value); + if (bApwrdeltaMinus == FALSE) { + t1 = (value & 0xf) + (Apwrdelta); if (t1 > 0xf) t1 = 0xf; - t2 = ((value&0xf0)>>4)+(Apwrdelta); + t2 = ((value & 0xf0) >> 4) + (Apwrdelta); if (t2 > 0xf) t2 = 0xf; - t3 = ((value&0xf00)>>8)+(Apwrdelta); + t3 = ((value & 0xf00) >> 8) + (Apwrdelta); if (t3 > 0xf) t3 = 0xf; - t4 = ((value&0xf000)>>12)+(Apwrdelta); + t4 = ((value & 0xf000) >> 12) + (Apwrdelta); if (t4 > 0xf) t4 = 0xf; - } - else - { - if ((value&0xf) > Apwrdelta) - t1 = (value&0xf)-(Apwrdelta); + } else { + if ((value & 0xf) > Apwrdelta) + t1 = (value & 0xf) - (Apwrdelta); else t1 = 0; - if (((value&0xf0)>>4) > Apwrdelta) - t2 = ((value&0xf0)>>4)-(Apwrdelta); + if (((value & 0xf0) >> 4) > Apwrdelta) + t2 = ((value & 0xf0) >> 4) - (Apwrdelta); else t2 = 0; - if (((value&0xf00)>>8) > Apwrdelta) - t3 = ((value&0xf00)>>8)-(Apwrdelta); + if (((value & 0xf00) >> 8) > Apwrdelta) + t3 = ((value & 0xf00) >> 8) - (Apwrdelta); else t3 = 0; - if (((value&0xf000)>>12) > Apwrdelta) - t4 = ((value&0xf000)>>12)-(Apwrdelta); + if (((value & 0xf000) >> 12) > Apwrdelta) + t4 = ((value & 0xf000) >> 12) - (Apwrdelta); else t4 = 0; } - Adata |= ((t1<<16) + (t2<<20) + (t3<<24) + (t4<<28)); - if (bGpwrdeltaMinus == FALSE) - { - t1 = (value&0xf)+(Gpwrdelta); + Adata |= ((t1 << 16) + (t2 << 20) + (t3 << 24) + (t4 << 28)); + if (bGpwrdeltaMinus == FALSE) { + t1 = (value & 0xf) + (Gpwrdelta); if (t1 > 0xf) t1 = 0xf; - t2 = ((value&0xf0)>>4)+(Gpwrdelta); + t2 = ((value & 0xf0) >> 4) + (Gpwrdelta); if (t2 > 0xf) t2 = 0xf; - t3 = ((value&0xf00)>>8)+(Gpwrdelta); + t3 = ((value & 0xf00) >> 8) + (Gpwrdelta); if (t3 > 0xf) t3 = 0xf; - t4 = ((value&0xf000)>>12)+(Gpwrdelta); + t4 = ((value & 0xf000) >> 12) + (Gpwrdelta); if (t4 > 0xf) t4 = 0xf; - } - else - { - if ((value&0xf) > Gpwrdelta) - t1 = (value&0xf)-(Gpwrdelta); + } else { + if ((value & 0xf) > Gpwrdelta) + t1 = (value & 0xf) - (Gpwrdelta); else t1 = 0; - if (((value&0xf0)>>4) > Gpwrdelta) - t2 = ((value&0xf0)>>4)-(Gpwrdelta); + if (((value & 0xf0) >> 4) > Gpwrdelta) + t2 = ((value & 0xf0) >> 4) - (Gpwrdelta); else t2 = 0; - if (((value&0xf00)>>8) > Gpwrdelta) - t3 = ((value&0xf00)>>8)-(Gpwrdelta); + if (((value & 0xf00) >> 8) > Gpwrdelta) + t3 = ((value & 0xf00) >> 8) - (Gpwrdelta); else t3 = 0; - if (((value&0xf000)>>12) > Gpwrdelta) - t4 = ((value&0xf000)>>12)-(Gpwrdelta); + if (((value & 0xf000) >> 12) > Gpwrdelta) + t4 = ((value & 0xf000) >> 12) - (Gpwrdelta); else t4 = 0; } - Gdata |= ((t1<<16) + (t2<<20) + (t3<<24) + (t4<<28)); - data |= (value<<16); + Gdata |= ((t1 << 16) + (t2 << 20) + (t3 << 24) + (t4 << 28)); + data |= (value << 16); /* For 20M/40M Power Delta issue */ pAd->Tx20MPwrCfgABand[i] = data; @@ -431,12 +416,13 @@ VOID RTMPReadTxPwrPerRate( pAd->Tx40MPwrCfgGBand[i] = Gdata; if (data != 0xffffffff) - RTMP_IO_WRITE32(pAd, TX_PWR_CFG_0 + i*4, data); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("20MHz BW, 2.4G band-%lx, Adata = %lx, Gdata = %lx \n", data, Adata, Gdata)); + RTMP_IO_WRITE32(pAd, TX_PWR_CFG_0 + i * 4, data); + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("20MHz BW, 2.4G band-%lx, Adata = %lx, Gdata = %lx \n", + data, Adata, Gdata)); } } - /* ======================================================================== @@ -455,12 +441,11 @@ VOID RTMPReadTxPwrPerRate( ======================================================================== */ -VOID RTMPReadChannelPwr( - IN PRTMP_ADAPTER pAd) +VOID RTMPReadChannelPwr(IN PRTMP_ADAPTER pAd) { - UCHAR i, choffset; - EEPROM_TX_PWR_STRUC Power; - EEPROM_TX_PWR_STRUC Power2; + UCHAR i, choffset; + EEPROM_TX_PWR_STRUC Power; + EEPROM_TX_PWR_STRUC Power2; // Read Tx power value for all channels // Value from 1 - 0x7f. Default value is 24. @@ -468,10 +453,11 @@ VOID RTMPReadChannelPwr( // : 5.5G 0xF9 (-7) ~ 0x0F (15) // 0. 11b/g, ch1 - ch 14 - for (i = 0; i < 7; i++) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_G_TX_PWR_OFFSET + i * 2, Power.word); - RT28xx_EEPROM_READ16(pAd, EEPROM_G_TX2_PWR_OFFSET + i * 2, Power2.word); + for (i = 0; i < 7; i++) { + RT28xx_EEPROM_READ16(pAd, EEPROM_G_TX_PWR_OFFSET + i * 2, + Power.word); + RT28xx_EEPROM_READ16(pAd, EEPROM_G_TX2_PWR_OFFSET + i * 2, + Power2.word); pAd->TxPower[i * 2].Channel = i * 2 + 1; pAd->TxPower[i * 2 + 1].Channel = i * 2 + 2; @@ -499,131 +485,146 @@ VOID RTMPReadChannelPwr( // 1. U-NII lower/middle band: 36, 38, 40; 44, 46, 48; 52, 54, 56; 60, 62, 64 (including central frequency in BW 40MHz) // 1.1 Fill up channel choffset = 14; - for (i = 0; i < 4; i++) - { - pAd->TxPower[3 * i + choffset + 0].Channel = 36 + i * 8 + 0; - pAd->TxPower[3 * i + choffset + 0].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 0].Power2 = DEFAULT_RF_TX_POWER; + for (i = 0; i < 4; i++) { + pAd->TxPower[3 * i + choffset + 0].Channel = 36 + i * 8 + 0; + pAd->TxPower[3 * i + choffset + 0].Power = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * i + choffset + 0].Power2 = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 1].Channel = 36 + i * 8 + 2; - pAd->TxPower[3 * i + choffset + 1].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 1].Power2 = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * i + choffset + 1].Channel = 36 + i * 8 + 2; + pAd->TxPower[3 * i + choffset + 1].Power = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * i + choffset + 1].Power2 = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 2].Channel = 36 + i * 8 + 4; - pAd->TxPower[3 * i + choffset + 2].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 2].Power2 = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * i + choffset + 2].Channel = 36 + i * 8 + 4; + pAd->TxPower[3 * i + choffset + 2].Power = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * i + choffset + 2].Power2 = DEFAULT_RF_TX_POWER; } // 1.2 Fill up power - for (i = 0; i < 6; i++) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_A_TX_PWR_OFFSET + i * 2, Power.word); - RT28xx_EEPROM_READ16(pAd, EEPROM_A_TX2_PWR_OFFSET + i * 2, Power2.word); + for (i = 0; i < 6; i++) { + RT28xx_EEPROM_READ16(pAd, EEPROM_A_TX_PWR_OFFSET + i * 2, + Power.word); + RT28xx_EEPROM_READ16(pAd, EEPROM_A_TX2_PWR_OFFSET + i * 2, + Power2.word); if ((Power.field.Byte0 < 16) && (Power.field.Byte0 >= -7)) - pAd->TxPower[i * 2 + choffset + 0].Power = Power.field.Byte0; + pAd->TxPower[i * 2 + choffset + 0].Power = + Power.field.Byte0; if ((Power.field.Byte1 < 16) && (Power.field.Byte1 >= -7)) - pAd->TxPower[i * 2 + choffset + 1].Power = Power.field.Byte1; + pAd->TxPower[i * 2 + choffset + 1].Power = + Power.field.Byte1; if ((Power2.field.Byte0 < 16) && (Power2.field.Byte0 >= -7)) - pAd->TxPower[i * 2 + choffset + 0].Power2 = Power2.field.Byte0; + pAd->TxPower[i * 2 + choffset + 0].Power2 = + Power2.field.Byte0; if ((Power2.field.Byte1 < 16) && (Power2.field.Byte1 >= -7)) - pAd->TxPower[i * 2 + choffset + 1].Power2 = Power2.field.Byte1; + pAd->TxPower[i * 2 + choffset + 1].Power2 = + Power2.field.Byte1; } // 2. HipperLAN 2 100, 102 ,104; 108, 110, 112; 116, 118, 120; 124, 126, 128; 132, 134, 136; 140 (including central frequency in BW 40MHz) // 2.1 Fill up channel choffset = 14 + 12; - for (i = 0; i < 5; i++) - { - pAd->TxPower[3 * i + choffset + 0].Channel = 100 + i * 8 + 0; - pAd->TxPower[3 * i + choffset + 0].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 0].Power2 = DEFAULT_RF_TX_POWER; + for (i = 0; i < 5; i++) { + pAd->TxPower[3 * i + choffset + 0].Channel = 100 + i * 8 + 0; + pAd->TxPower[3 * i + choffset + 0].Power = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * i + choffset + 0].Power2 = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 1].Channel = 100 + i * 8 + 2; - pAd->TxPower[3 * i + choffset + 1].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 1].Power2 = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * i + choffset + 1].Channel = 100 + i * 8 + 2; + pAd->TxPower[3 * i + choffset + 1].Power = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * i + choffset + 1].Power2 = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 2].Channel = 100 + i * 8 + 4; - pAd->TxPower[3 * i + choffset + 2].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 2].Power2 = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * i + choffset + 2].Channel = 100 + i * 8 + 4; + pAd->TxPower[3 * i + choffset + 2].Power = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * i + choffset + 2].Power2 = DEFAULT_RF_TX_POWER; } - pAd->TxPower[3 * 5 + choffset + 0].Channel = 140; - pAd->TxPower[3 * 5 + choffset + 0].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * 5 + choffset + 0].Power2 = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * 5 + choffset + 0].Channel = 140; + pAd->TxPower[3 * 5 + choffset + 0].Power = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * 5 + choffset + 0].Power2 = DEFAULT_RF_TX_POWER; // 2.2 Fill up power - for (i = 0; i < 8; i++) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_A_TX_PWR_OFFSET + (choffset - 14) + i * 2, Power.word); - RT28xx_EEPROM_READ16(pAd, EEPROM_A_TX2_PWR_OFFSET + (choffset - 14) + i * 2, Power2.word); + for (i = 0; i < 8; i++) { + RT28xx_EEPROM_READ16(pAd, + EEPROM_A_TX_PWR_OFFSET + (choffset - 14) + + i * 2, Power.word); + RT28xx_EEPROM_READ16(pAd, + EEPROM_A_TX2_PWR_OFFSET + (choffset - 14) + + i * 2, Power2.word); if ((Power.field.Byte0 < 16) && (Power.field.Byte0 >= -7)) - pAd->TxPower[i * 2 + choffset + 0].Power = Power.field.Byte0; + pAd->TxPower[i * 2 + choffset + 0].Power = + Power.field.Byte0; if ((Power.field.Byte1 < 16) && (Power.field.Byte1 >= -7)) - pAd->TxPower[i * 2 + choffset + 1].Power = Power.field.Byte1; + pAd->TxPower[i * 2 + choffset + 1].Power = + Power.field.Byte1; if ((Power2.field.Byte0 < 16) && (Power2.field.Byte0 >= -7)) - pAd->TxPower[i * 2 + choffset + 0].Power2 = Power2.field.Byte0; + pAd->TxPower[i * 2 + choffset + 0].Power2 = + Power2.field.Byte0; if ((Power2.field.Byte1 < 16) && (Power2.field.Byte1 >= -7)) - pAd->TxPower[i * 2 + choffset + 1].Power2 = Power2.field.Byte1; + pAd->TxPower[i * 2 + choffset + 1].Power2 = + Power2.field.Byte1; } // 3. U-NII upper band: 149, 151, 153; 157, 159, 161; 165, 167, 169; 171, 173 (including central frequency in BW 40MHz) // 3.1 Fill up channel choffset = 14 + 12 + 16; - /*for (i = 0; i < 2; i++)*/ - for (i = 0; i < 3; i++) - { - pAd->TxPower[3 * i + choffset + 0].Channel = 149 + i * 8 + 0; - pAd->TxPower[3 * i + choffset + 0].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 0].Power2 = DEFAULT_RF_TX_POWER; + /*for (i = 0; i < 2; i++) */ + for (i = 0; i < 3; i++) { + pAd->TxPower[3 * i + choffset + 0].Channel = 149 + i * 8 + 0; + pAd->TxPower[3 * i + choffset + 0].Power = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * i + choffset + 0].Power2 = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 1].Channel = 149 + i * 8 + 2; - pAd->TxPower[3 * i + choffset + 1].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 1].Power2 = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * i + choffset + 1].Channel = 149 + i * 8 + 2; + pAd->TxPower[3 * i + choffset + 1].Power = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * i + choffset + 1].Power2 = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 2].Channel = 149 + i * 8 + 4; - pAd->TxPower[3 * i + choffset + 2].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * i + choffset + 2].Power2 = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * i + choffset + 2].Channel = 149 + i * 8 + 4; + pAd->TxPower[3 * i + choffset + 2].Power = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * i + choffset + 2].Power2 = DEFAULT_RF_TX_POWER; } - pAd->TxPower[3 * 3 + choffset + 0].Channel = 171; - pAd->TxPower[3 * 3 + choffset + 0].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * 3 + choffset + 0].Power2 = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * 3 + choffset + 0].Channel = 171; + pAd->TxPower[3 * 3 + choffset + 0].Power = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * 3 + choffset + 0].Power2 = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * 3 + choffset + 1].Channel = 173; - pAd->TxPower[3 * 3 + choffset + 1].Power = DEFAULT_RF_TX_POWER; - pAd->TxPower[3 * 3 + choffset + 1].Power2 = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * 3 + choffset + 1].Channel = 173; + pAd->TxPower[3 * 3 + choffset + 1].Power = DEFAULT_RF_TX_POWER; + pAd->TxPower[3 * 3 + choffset + 1].Power2 = DEFAULT_RF_TX_POWER; // 3.2 Fill up power - /*for (i = 0; i < 4; i++)*/ - for (i = 0; i < 6; i++) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_A_TX_PWR_OFFSET + (choffset - 14) + i * 2, Power.word); - RT28xx_EEPROM_READ16(pAd, EEPROM_A_TX2_PWR_OFFSET + (choffset - 14) + i * 2, Power2.word); + /*for (i = 0; i < 4; i++) */ + for (i = 0; i < 6; i++) { + RT28xx_EEPROM_READ16(pAd, + EEPROM_A_TX_PWR_OFFSET + (choffset - 14) + + i * 2, Power.word); + RT28xx_EEPROM_READ16(pAd, + EEPROM_A_TX2_PWR_OFFSET + (choffset - 14) + + i * 2, Power2.word); if ((Power.field.Byte0 < 16) && (Power.field.Byte0 >= -7)) - pAd->TxPower[i * 2 + choffset + 0].Power = Power.field.Byte0; + pAd->TxPower[i * 2 + choffset + 0].Power = + Power.field.Byte0; if ((Power.field.Byte1 < 16) && (Power.field.Byte1 >= -7)) - pAd->TxPower[i * 2 + choffset + 1].Power = Power.field.Byte1; + pAd->TxPower[i * 2 + choffset + 1].Power = + Power.field.Byte1; if ((Power2.field.Byte0 < 16) && (Power2.field.Byte0 >= -7)) - pAd->TxPower[i * 2 + choffset + 0].Power2 = Power2.field.Byte0; + pAd->TxPower[i * 2 + choffset + 0].Power2 = + Power2.field.Byte0; if ((Power2.field.Byte1 < 16) && (Power2.field.Byte1 >= -7)) - pAd->TxPower[i * 2 + choffset + 1].Power2 = Power2.field.Byte1; + pAd->TxPower[i * 2 + choffset + 1].Power2 = + Power2.field.Byte1; } // 4. Print and Debug - /*choffset = 14 + 12 + 16 + 7;*/ + /*choffset = 14 + 12 + 16 + 7; */ choffset = 14 + 12 + 16 + 11; - } /* @@ -649,17 +650,14 @@ VOID RTMPReadChannelPwr( ======================================================================== */ -NDIS_STATUS NICReadRegParameters( - IN PRTMP_ADAPTER pAd, - IN NDIS_HANDLE WrapperConfigurationContext - ) +NDIS_STATUS NICReadRegParameters(IN PRTMP_ADAPTER pAd, + IN NDIS_HANDLE WrapperConfigurationContext) { - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; DBGPRINT_S(Status, ("<-- NICReadRegParameters, Status=%x\n", Status)); return Status; } - /* ======================================================================== @@ -678,17 +676,15 @@ NDIS_STATUS NICReadRegParameters( ======================================================================== */ -VOID NICReadEEPROMParameters( - IN PRTMP_ADAPTER pAd, - IN PUCHAR mac_addr) +VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) { - UINT32 data = 0; - USHORT i, value, value2; - UCHAR TmpPhy; - EEPROM_TX_PWR_STRUC Power; - EEPROM_VERSION_STRUC Version; - EEPROM_ANTENNA_STRUC Antenna; - EEPROM_NIC_CONFIG2_STRUC NicConfig2; + UINT32 data = 0; + USHORT i, value, value2; + UCHAR TmpPhy; + EEPROM_TX_PWR_STRUC Power; + EEPROM_VERSION_STRUC Version; + EEPROM_ANTENNA_STRUC Antenna; + EEPROM_NIC_CONFIG2_STRUC NicConfig2; DBGPRINT(RT_DEBUG_TRACE, ("--> NICReadEEPROMParameters\n")); @@ -699,70 +695,72 @@ VOID NICReadEEPROMParameters( RTMP_IO_READ32(pAd, E2PROM_CSR, &data); DBGPRINT(RT_DEBUG_TRACE, ("--> E2PROM_CSR = 0x%x\n", data)); - if((data & 0x30) == 0) - pAd->EEPROMAddressNum = 6; // 93C46 - else if((data & 0x30) == 0x10) - pAd->EEPROMAddressNum = 8; // 93C66 + if ((data & 0x30) == 0) + pAd->EEPROMAddressNum = 6; // 93C46 + else if ((data & 0x30) == 0x10) + pAd->EEPROMAddressNum = 8; // 93C66 else - pAd->EEPROMAddressNum = 8; // 93C86 - DBGPRINT(RT_DEBUG_TRACE, ("--> EEPROMAddressNum = %d\n", pAd->EEPROMAddressNum )); + pAd->EEPROMAddressNum = 8; // 93C86 + DBGPRINT(RT_DEBUG_TRACE, + ("--> EEPROMAddressNum = %d\n", pAd->EEPROMAddressNum)); // RT2860 MAC no longer auto load MAC address from E2PROM. Driver has to intialize // MAC address registers according to E2PROM setting if (mac_addr == NULL || - strlen((PSTRING) mac_addr) != 17 || - mac_addr[2] != ':' || mac_addr[5] != ':' || mac_addr[8] != ':' || - mac_addr[11] != ':' || mac_addr[14] != ':') - { - USHORT Addr01,Addr23,Addr45 ; + strlen((PSTRING) mac_addr) != 17 || + mac_addr[2] != ':' || mac_addr[5] != ':' || mac_addr[8] != ':' || + mac_addr[11] != ':' || mac_addr[14] != ':') { + USHORT Addr01, Addr23, Addr45; RT28xx_EEPROM_READ16(pAd, 0x04, Addr01); RT28xx_EEPROM_READ16(pAd, 0x06, Addr23); RT28xx_EEPROM_READ16(pAd, 0x08, Addr45); - pAd->PermanentAddress[0] = (UCHAR)(Addr01 & 0xff); - pAd->PermanentAddress[1] = (UCHAR)(Addr01 >> 8); - pAd->PermanentAddress[2] = (UCHAR)(Addr23 & 0xff); - pAd->PermanentAddress[3] = (UCHAR)(Addr23 >> 8); - pAd->PermanentAddress[4] = (UCHAR)(Addr45 & 0xff); - pAd->PermanentAddress[5] = (UCHAR)(Addr45 >> 8); + pAd->PermanentAddress[0] = (UCHAR) (Addr01 & 0xff); + pAd->PermanentAddress[1] = (UCHAR) (Addr01 >> 8); + pAd->PermanentAddress[2] = (UCHAR) (Addr23 & 0xff); + pAd->PermanentAddress[3] = (UCHAR) (Addr23 >> 8); + pAd->PermanentAddress[4] = (UCHAR) (Addr45 & 0xff); + pAd->PermanentAddress[5] = (UCHAR) (Addr45 >> 8); - DBGPRINT(RT_DEBUG_TRACE, ("Initialize MAC Address from E2PROM \n")); - } - else - { - INT j; - PSTRING macptr; + DBGPRINT(RT_DEBUG_TRACE, + ("Initialize MAC Address from E2PROM \n")); + } else { + INT j; + PSTRING macptr; macptr = (PSTRING) mac_addr; - for (j=0; jPermanentAddress[j], 1); - macptr=macptr+3; + macptr = macptr + 3; } - DBGPRINT(RT_DEBUG_TRACE, ("Initialize MAC Address from module parameter \n")); + DBGPRINT(RT_DEBUG_TRACE, + ("Initialize MAC Address from module parameter \n")); } - { //more conveninet to test mbssid, so ap's bssid &0xf1 if (pAd->PermanentAddress[0] == 0xff) - pAd->PermanentAddress[0] = RandomByte(pAd)&0xf8; + pAd->PermanentAddress[0] = RandomByte(pAd) & 0xf8; //if (pAd->PermanentAddress[5] == 0xff) - // pAd->PermanentAddress[5] = RandomByte(pAd)&0xf8; - - DBGPRINT_RAW(RT_DEBUG_TRACE,("E2PROM MAC: =%02x:%02x:%02x:%02x:%02x:%02x\n", - pAd->PermanentAddress[0], pAd->PermanentAddress[1], - pAd->PermanentAddress[2], pAd->PermanentAddress[3], - pAd->PermanentAddress[4], pAd->PermanentAddress[5])); - if (pAd->bLocalAdminMAC == FALSE) - { + // pAd->PermanentAddress[5] = RandomByte(pAd)&0xf8; + + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("E2PROM MAC: =%02x:%02x:%02x:%02x:%02x:%02x\n", + pAd->PermanentAddress[0], + pAd->PermanentAddress[1], + pAd->PermanentAddress[2], + pAd->PermanentAddress[3], + pAd->PermanentAddress[4], + pAd->PermanentAddress[5])); + if (pAd->bLocalAdminMAC == FALSE) { MAC_DW0_STRUC csr2; MAC_DW1_STRUC csr3; - COPY_MAC_ADDR(pAd->CurrentAddress, pAd->PermanentAddress); + COPY_MAC_ADDR(pAd->CurrentAddress, + pAd->PermanentAddress); csr2.field.Byte0 = pAd->CurrentAddress[0]; csr2.field.Byte1 = pAd->CurrentAddress[1]; csr2.field.Byte2 = pAd->CurrentAddress[2]; @@ -773,8 +771,9 @@ VOID NICReadEEPROMParameters( csr3.field.Byte5 = pAd->CurrentAddress[5]; csr3.field.U2MeMask = 0xff; RTMP_IO_WRITE32(pAd, MAC_ADDR_DW1, csr3.word); - DBGPRINT_RAW(RT_DEBUG_TRACE,("E2PROM MAC: =%02x:%02x:%02x:%02x:%02x:%02x\n", - PRINT_MAC(pAd->PermanentAddress))); + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("E2PROM MAC: =%02x:%02x:%02x:%02x:%02x:%02x\n", + PRINT_MAC(pAd->PermanentAddress))); } } @@ -785,31 +784,33 @@ VOID NICReadEEPROMParameters( // if E2PROM version mismatch with driver's expectation, then skip // all subsequent E2RPOM retieval and set a system error bit to notify GUI RT28xx_EEPROM_READ16(pAd, EEPROM_VERSION_OFFSET, Version.word); - pAd->EepromVersion = Version.field.Version + Version.field.FaeReleaseNumber * 256; - DBGPRINT(RT_DEBUG_TRACE, ("E2PROM: Version = %d, FAE release #%d\n", Version.field.Version, Version.field.FaeReleaseNumber)); - - if (Version.field.Version > VALID_EEPROM_VERSION) - { - DBGPRINT_ERR(("E2PROM: WRONG VERSION 0x%x, should be %d\n",Version.field.Version, VALID_EEPROM_VERSION)); + pAd->EepromVersion = + Version.field.Version + Version.field.FaeReleaseNumber * 256; + DBGPRINT(RT_DEBUG_TRACE, + ("E2PROM: Version = %d, FAE release #%d\n", + Version.field.Version, Version.field.FaeReleaseNumber)); + + if (Version.field.Version > VALID_EEPROM_VERSION) { + DBGPRINT_ERR(("E2PROM: WRONG VERSION 0x%x, should be %d\n", + Version.field.Version, VALID_EEPROM_VERSION)); /*pAd->SystemErrorBitmap |= 0x00000001; - // hard-code default value when no proper E2PROM installed - pAd->bAutoTxAgcA = FALSE; - pAd->bAutoTxAgcG = FALSE; + // hard-code default value when no proper E2PROM installed + pAd->bAutoTxAgcA = FALSE; + pAd->bAutoTxAgcG = FALSE; - // Default the channel power - for (i = 0; i < MAX_NUM_OF_CHANNELS; i++) - pAd->TxPower[i].Power = DEFAULT_RF_TX_POWER; + // Default the channel power + for (i = 0; i < MAX_NUM_OF_CHANNELS; i++) + pAd->TxPower[i].Power = DEFAULT_RF_TX_POWER; - // Default the channel power - for (i = 0; i < MAX_NUM_OF_11JCHANNELS; i++) - pAd->TxPower11J[i].Power = DEFAULT_RF_TX_POWER; + // Default the channel power + for (i = 0; i < MAX_NUM_OF_11JCHANNELS; i++) + pAd->TxPower11J[i].Power = DEFAULT_RF_TX_POWER; - for(i = 0; i < NUM_EEPROM_BBP_PARMS; i++) - pAd->EEPROMDefaultValue[i] = 0xffff; - return; */ + for(i = 0; i < NUM_EEPROM_BBP_PARMS; i++) + pAd->EEPROMDefaultValue[i] = 0xffff; + return; */ } - // Read BBP default value from EEPROM and store to array(EEPROMDefaultValue) in pAd RT28xx_EEPROM_READ16(pAd, EEPROM_NIC1_OFFSET, value); pAd->EEPROMDefaultValue[0] = value; @@ -820,10 +821,10 @@ VOID NICReadEEPROMParameters( RT28xx_EEPROM_READ16(pAd, 0x38, value); // Country Region pAd->EEPROMDefaultValue[2] = value; - for(i = 0; i < 8; i++) - { - RT28xx_EEPROM_READ16(pAd, EEPROM_BBP_BASE_OFFSET + i*2, value); - pAd->EEPROMDefaultValue[i+3] = value; + for (i = 0; i < 8; i++) { + RT28xx_EEPROM_READ16(pAd, EEPROM_BBP_BASE_OFFSET + i * 2, + value); + pAd->EEPROMDefaultValue[i + 3] = value; } // We have to parse NIC configuration 0 at here. @@ -831,61 +832,55 @@ VOID NICReadEEPROMParameters( // Therefore, we have to read TxAutoAgc control beforehand. // Read Tx AGC control bit Antenna.word = pAd->EEPROMDefaultValue[0]; - if (Antenna.word == 0xFFFF) - { + if (Antenna.word == 0xFFFF) { #ifdef RT30xx - if(IS_RT3090(pAd)|| IS_RT3390(pAd)) - { + if (IS_RT3090(pAd) || IS_RT3390(pAd)) { Antenna.word = 0; Antenna.field.RfIcType = RFIC_3020; Antenna.field.TxPath = 1; Antenna.field.RxPath = 1; - } - else + } else #endif // RT30xx // { - Antenna.word = 0; - Antenna.field.RfIcType = RFIC_2820; - Antenna.field.TxPath = 1; - Antenna.field.RxPath = 2; - DBGPRINT(RT_DEBUG_WARN, ("E2PROM error, hard code as 0x%04x\n", Antenna.word)); + Antenna.word = 0; + Antenna.field.RfIcType = RFIC_2820; + Antenna.field.TxPath = 1; + Antenna.field.RxPath = 2; + DBGPRINT(RT_DEBUG_WARN, + ("E2PROM error, hard code as 0x%04x\n", + Antenna.word)); } } - // Choose the desired Tx&Rx stream. - if ((pAd->CommonCfg.TxStream == 0) || (pAd->CommonCfg.TxStream > Antenna.field.TxPath)) + if ((pAd->CommonCfg.TxStream == 0) + || (pAd->CommonCfg.TxStream > Antenna.field.TxPath)) pAd->CommonCfg.TxStream = Antenna.field.TxPath; - if ((pAd->CommonCfg.RxStream == 0) || (pAd->CommonCfg.RxStream > Antenna.field.RxPath)) - { + if ((pAd->CommonCfg.RxStream == 0) + || (pAd->CommonCfg.RxStream > Antenna.field.RxPath)) { pAd->CommonCfg.RxStream = Antenna.field.RxPath; if ((pAd->MACVersion < RALINK_2883_VERSION) && - (pAd->CommonCfg.RxStream > 2)) - { + (pAd->CommonCfg.RxStream > 2)) { // only 2 Rx streams for RT2860 series pAd->CommonCfg.RxStream = 2; } } - // 3*3 // read value from EEPROM and set them to CSR174 ~ 177 in chain0 ~ chain2 // yet implement - for(i=0; i<3; i++) - { + for (i = 0; i < 3; i++) { } NicConfig2.word = pAd->EEPROMDefaultValue[1]; { - if ((NicConfig2.word & 0x00ff) == 0xff) - { + if ((NicConfig2.word & 0x00ff) == 0xff) { NicConfig2.word &= 0xff00; } - if ((NicConfig2.word >> 8) == 0xff) - { + if ((NicConfig2.word >> 8) == 0xff) { NicConfig2.word &= 0x00ff; } } @@ -895,7 +890,9 @@ VOID NICReadEEPROMParameters( else pAd->bAutoTxAgcA = pAd->bAutoTxAgcG = FALSE; - DBGPRINT_RAW(RT_DEBUG_TRACE, ("NICReadEEPROMParameters: RxPath = %d, TxPath = %d\n", Antenna.field.RxPath, Antenna.field.TxPath)); + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("NICReadEEPROMParameters: RxPath = %d, TxPath = %d\n", + Antenna.field.RxPath, Antenna.field.TxPath)); // Save the antenna for future use pAd->Antenna.word = Antenna.word; @@ -909,28 +906,25 @@ VOID NICReadEEPROMParameters( #endif // RTMP_RF_RW_SUPPORT // #ifdef RTMP_MAC_PCI - sprintf((PSTRING) pAd->nickname, "RT2860STA"); + sprintf((PSTRING) pAd->nickname, "RT2860STA"); #endif // RTMP_MAC_PCI // - // // Reset PhyMode if we don't support 802.11a // Only RFIC_2850 & RFIC_2750 support 802.11a // if ((Antenna.field.RfIcType != RFIC_2850) - && (Antenna.field.RfIcType != RFIC_2750) - && (Antenna.field.RfIcType != RFIC_3052)) - { + && (Antenna.field.RfIcType != RFIC_2750) + && (Antenna.field.RfIcType != RFIC_3052)) { if ((pAd->CommonCfg.PhyMode == PHY_11ABG_MIXED) || - (pAd->CommonCfg.PhyMode == PHY_11A)) + (pAd->CommonCfg.PhyMode == PHY_11A)) pAd->CommonCfg.PhyMode = PHY_11BG_MIXED; - else if ((pAd->CommonCfg.PhyMode == PHY_11ABGN_MIXED) || - (pAd->CommonCfg.PhyMode == PHY_11AN_MIXED) || - (pAd->CommonCfg.PhyMode == PHY_11AGN_MIXED) || - (pAd->CommonCfg.PhyMode == PHY_11N_5G)) + else if ((pAd->CommonCfg.PhyMode == PHY_11ABGN_MIXED) || + (pAd->CommonCfg.PhyMode == PHY_11AN_MIXED) || + (pAd->CommonCfg.PhyMode == PHY_11AGN_MIXED) || + (pAd->CommonCfg.PhyMode == PHY_11N_5G)) pAd->CommonCfg.PhyMode = PHY_11BGN_MIXED; } - // Read TSSI reference and TSSI boundary for temperature compensation. This is ugly // 0. 11b/g { @@ -945,7 +939,7 @@ VOID NICReadEEPROMParameters( pAd->TssiMinusBoundaryG[2] = Power.field.Byte0; pAd->TssiMinusBoundaryG[1] = Power.field.Byte1; RT28xx_EEPROM_READ16(pAd, 0x72, Power.word); - pAd->TssiRefG = Power.field.Byte0; /* reference value [0] */ + pAd->TssiRefG = Power.field.Byte0; /* reference value [0] */ pAd->TssiPlusBoundaryG[1] = Power.field.Byte1; RT28xx_EEPROM_READ16(pAd, 0x74, Power.word); pAd->TssiPlusBoundaryG[2] = Power.field.Byte0; @@ -955,17 +949,21 @@ VOID NICReadEEPROMParameters( pAd->TxAgcStepG = Power.field.Byte1; pAd->TxAgcCompensateG = 0; pAd->TssiMinusBoundaryG[0] = pAd->TssiRefG; - pAd->TssiPlusBoundaryG[0] = pAd->TssiRefG; + pAd->TssiPlusBoundaryG[0] = pAd->TssiRefG; // Disable TxAgc if the based value is not right if (pAd->TssiRefG == 0xff) pAd->bAutoTxAgcG = FALSE; - DBGPRINT(RT_DEBUG_TRACE,("E2PROM: G Tssi[-4 .. +4] = %d %d %d %d - %d -%d %d %d %d, step=%d, tuning=%d\n", - pAd->TssiMinusBoundaryG[4], pAd->TssiMinusBoundaryG[3], pAd->TssiMinusBoundaryG[2], pAd->TssiMinusBoundaryG[1], - pAd->TssiRefG, - pAd->TssiPlusBoundaryG[1], pAd->TssiPlusBoundaryG[2], pAd->TssiPlusBoundaryG[3], pAd->TssiPlusBoundaryG[4], - pAd->TxAgcStepG, pAd->bAutoTxAgcG)); + DBGPRINT(RT_DEBUG_TRACE, + ("E2PROM: G Tssi[-4 .. +4] = %d %d %d %d - %d -%d %d %d %d, step=%d, tuning=%d\n", + pAd->TssiMinusBoundaryG[4], + pAd->TssiMinusBoundaryG[3], + pAd->TssiMinusBoundaryG[2], + pAd->TssiMinusBoundaryG[1], pAd->TssiRefG, + pAd->TssiPlusBoundaryG[1], pAd->TssiPlusBoundaryG[2], + pAd->TssiPlusBoundaryG[3], pAd->TssiPlusBoundaryG[4], + pAd->TxAgcStepG, pAd->bAutoTxAgcG)); } // 1. 11a { @@ -976,7 +974,7 @@ VOID NICReadEEPROMParameters( pAd->TssiMinusBoundaryA[2] = Power.field.Byte0; pAd->TssiMinusBoundaryA[1] = Power.field.Byte1; RT28xx_EEPROM_READ16(pAd, 0xD8, Power.word); - pAd->TssiRefA = Power.field.Byte0; + pAd->TssiRefA = Power.field.Byte0; pAd->TssiPlusBoundaryA[1] = Power.field.Byte1; RT28xx_EEPROM_READ16(pAd, 0xDA, Power.word); pAd->TssiPlusBoundaryA[2] = Power.field.Byte0; @@ -986,17 +984,21 @@ VOID NICReadEEPROMParameters( pAd->TxAgcStepA = Power.field.Byte1; pAd->TxAgcCompensateA = 0; pAd->TssiMinusBoundaryA[0] = pAd->TssiRefA; - pAd->TssiPlusBoundaryA[0] = pAd->TssiRefA; + pAd->TssiPlusBoundaryA[0] = pAd->TssiRefA; // Disable TxAgc if the based value is not right if (pAd->TssiRefA == 0xff) pAd->bAutoTxAgcA = FALSE; - DBGPRINT(RT_DEBUG_TRACE,("E2PROM: A Tssi[-4 .. +4] = %d %d %d %d - %d -%d %d %d %d, step=%d, tuning=%d\n", - pAd->TssiMinusBoundaryA[4], pAd->TssiMinusBoundaryA[3], pAd->TssiMinusBoundaryA[2], pAd->TssiMinusBoundaryA[1], - pAd->TssiRefA, - pAd->TssiPlusBoundaryA[1], pAd->TssiPlusBoundaryA[2], pAd->TssiPlusBoundaryA[3], pAd->TssiPlusBoundaryA[4], - pAd->TxAgcStepA, pAd->bAutoTxAgcA)); + DBGPRINT(RT_DEBUG_TRACE, + ("E2PROM: A Tssi[-4 .. +4] = %d %d %d %d - %d -%d %d %d %d, step=%d, tuning=%d\n", + pAd->TssiMinusBoundaryA[4], + pAd->TssiMinusBoundaryA[3], + pAd->TssiMinusBoundaryA[2], + pAd->TssiMinusBoundaryA[1], pAd->TssiRefA, + pAd->TssiPlusBoundaryA[1], pAd->TssiPlusBoundaryA[2], + pAd->TssiPlusBoundaryA[3], pAd->TssiPlusBoundaryA[4], + pAd->TxAgcStepA, pAd->bAutoTxAgcA)); } pAd->BbpRssiToDbmDelta = 0x0; @@ -1006,14 +1008,15 @@ VOID NICReadEEPROMParameters( pAd->RfFreqOffset = (ULONG) (value & 0x00FF); else pAd->RfFreqOffset = 0; - DBGPRINT(RT_DEBUG_TRACE, ("E2PROM: RF FreqOffset=0x%lx \n", pAd->RfFreqOffset)); + DBGPRINT(RT_DEBUG_TRACE, + ("E2PROM: RF FreqOffset=0x%lx \n", pAd->RfFreqOffset)); //CountryRegion byte offset (38h) - value = pAd->EEPROMDefaultValue[2] >> 8; // 2.4G band + value = pAd->EEPROMDefaultValue[2] >> 8; // 2.4G band value2 = pAd->EEPROMDefaultValue[2] & 0x00FF; // 5G band - if ((value <= REGION_MAXIMUM_BG_BAND) && (value2 <= REGION_MAXIMUM_A_BAND)) - { + if ((value <= REGION_MAXIMUM_BG_BAND) + && (value2 <= REGION_MAXIMUM_A_BAND)) { pAd->CommonCfg.CountryRegion = ((UCHAR) value) | 0x80; pAd->CommonCfg.CountryRegionForABand = ((UCHAR) value2) | 0x80; TmpPhy = pAd->CommonCfg.PhyMode; @@ -1021,7 +1024,6 @@ VOID NICReadEEPROMParameters( RTMPSetPhyMode(pAd, TmpPhy); SetCommonHT(pAd); } - // // Get RSSI Offset on EEPROM 0x9Ah & 0x9Ch. // The valid value are (-10 ~ 10) @@ -1029,7 +1031,7 @@ VOID NICReadEEPROMParameters( RT28xx_EEPROM_READ16(pAd, EEPROM_RSSI_BG_OFFSET, value); pAd->BGRssiOffset0 = value & 0x00ff; pAd->BGRssiOffset1 = (value >> 8); - RT28xx_EEPROM_READ16(pAd, EEPROM_RSSI_BG_OFFSET+2, value); + RT28xx_EEPROM_READ16(pAd, EEPROM_RSSI_BG_OFFSET + 2, value); pAd->BGRssiOffset2 = value & 0x00ff; pAd->ALNAGain1 = (value >> 8); RT28xx_EEPROM_READ16(pAd, EEPROM_LNA_OFFSET, value); @@ -1051,13 +1053,13 @@ VOID NICReadEEPROMParameters( RT28xx_EEPROM_READ16(pAd, EEPROM_RSSI_A_OFFSET, value); pAd->ARssiOffset0 = value & 0x00ff; pAd->ARssiOffset1 = (value >> 8); - RT28xx_EEPROM_READ16(pAd, (EEPROM_RSSI_A_OFFSET+2), value); + RT28xx_EEPROM_READ16(pAd, (EEPROM_RSSI_A_OFFSET + 2), value); pAd->ARssiOffset2 = value & 0x00ff; pAd->ALNAGain2 = (value >> 8); - if (((UCHAR)pAd->ALNAGain1 == 0xFF) || (pAd->ALNAGain1 == 0x00)) + if (((UCHAR) pAd->ALNAGain1 == 0xFF) || (pAd->ALNAGain1 == 0x00)) pAd->ALNAGain1 = pAd->ALNAGain0; - if (((UCHAR)pAd->ALNAGain2 == 0xFF) || (pAd->ALNAGain2 == 0x00)) + if (((UCHAR) pAd->ALNAGain2 == 0xFF) || (pAd->ALNAGain2 == 0x00)) pAd->ALNAGain2 = pAd->ALNAGain0; // Validate 11a RSSI_0 offset. @@ -1079,15 +1081,13 @@ VOID NICReadEEPROMParameters( // Note: RT30xX default value is 0x00 and will program to RF_R17 only when this value is not zero. // RT359X default value is 0x02 // - if (IS_RT30xx(pAd) || IS_RT3572(pAd)) - { + if (IS_RT30xx(pAd) || IS_RT3572(pAd)) { RT28xx_EEPROM_READ16(pAd, EEPROM_TXMIXER_GAIN_2_4G, value); pAd->TxMixerGain24G = 0; value &= 0x00ff; - if (value != 0xff) - { + if (value != 0xff) { value &= 0x07; - pAd->TxMixerGain24G = (UCHAR)value; + pAd->TxMixerGain24G = (UCHAR) value; } } #endif // RT30xx // @@ -1096,7 +1096,7 @@ VOID NICReadEEPROMParameters( // Get LED Setting. // RT28xx_EEPROM_READ16(pAd, 0x3a, value); - pAd->LedCntl.word = (value>>8); + pAd->LedCntl.word = (value >> 8); RT28xx_EEPROM_READ16(pAd, EEPROM_LED1_OFFSET, value); pAd->Led1 = value; RT28xx_EEPROM_READ16(pAd, EEPROM_LED2_OFFSET, value); @@ -1133,40 +1133,35 @@ VOID NICReadEEPROMParameters( ======================================================================== */ -VOID NICInitAsicFromEEPROM( - IN PRTMP_ADAPTER pAd) +VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) { - UINT32 data = 0; - UCHAR BBPR1 = 0; - USHORT i; -// EEPROM_ANTENNA_STRUC Antenna; - EEPROM_NIC_CONFIG2_STRUC NicConfig2; - UCHAR BBPR3 = 0; + UINT32 data = 0; + UCHAR BBPR1 = 0; + USHORT i; +// EEPROM_ANTENNA_STRUC Antenna; + EEPROM_NIC_CONFIG2_STRUC NicConfig2; + UCHAR BBPR3 = 0; DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitAsicFromEEPROM\n")); - for(i = 3; i < NUM_EEPROM_BBP_PARMS; i++) - { + for (i = 3; i < NUM_EEPROM_BBP_PARMS; i++) { UCHAR BbpRegIdx, BbpValue; - if ((pAd->EEPROMDefaultValue[i] != 0xFFFF) && (pAd->EEPROMDefaultValue[i] != 0)) - { - BbpRegIdx = (UCHAR)(pAd->EEPROMDefaultValue[i] >> 8); - BbpValue = (UCHAR)(pAd->EEPROMDefaultValue[i] & 0xff); + if ((pAd->EEPROMDefaultValue[i] != 0xFFFF) + && (pAd->EEPROMDefaultValue[i] != 0)) { + BbpRegIdx = (UCHAR) (pAd->EEPROMDefaultValue[i] >> 8); + BbpValue = (UCHAR) (pAd->EEPROMDefaultValue[i] & 0xff); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BbpRegIdx, BbpValue); } } - NicConfig2.word = pAd->EEPROMDefaultValue[1]; { - if ((NicConfig2.word & 0x00ff) == 0xff) - { + if ((NicConfig2.word & 0x00ff) == 0xff) { NicConfig2.word &= 0xff00; } - if ((NicConfig2.word >> 8) == 0xff) - { + if ((NicConfig2.word >> 8) == 0xff) { NicConfig2.word &= 0x00ff; } } @@ -1183,8 +1178,7 @@ VOID NICInitAsicFromEEPROM( // // Send LED Setting to MCU. // - if (pAd->LedCntl.word == 0xFF) - { + if (pAd->LedCntl.word == 0xFF) { pAd->LedCntl.word = 0x01; pAd->Led1 = 0x5555; pAd->Led2 = 0x2221; @@ -1197,49 +1191,48 @@ VOID NICInitAsicFromEEPROM( #endif // RTMP_MAC_USB // } - AsicSendCommandToMcu(pAd, 0x52, 0xff, (UCHAR)pAd->Led1, (UCHAR)(pAd->Led1 >> 8)); - AsicSendCommandToMcu(pAd, 0x53, 0xff, (UCHAR)pAd->Led2, (UCHAR)(pAd->Led2 >> 8)); - AsicSendCommandToMcu(pAd, 0x54, 0xff, (UCHAR)pAd->Led3, (UCHAR)(pAd->Led3 >> 8)); + AsicSendCommandToMcu(pAd, 0x52, 0xff, (UCHAR) pAd->Led1, + (UCHAR) (pAd->Led1 >> 8)); + AsicSendCommandToMcu(pAd, 0x53, 0xff, (UCHAR) pAd->Led2, + (UCHAR) (pAd->Led2 >> 8)); + AsicSendCommandToMcu(pAd, 0x54, 0xff, (UCHAR) pAd->Led3, + (UCHAR) (pAd->Led3 >> 8)); AsicSendCommandToMcu(pAd, 0x51, 0xff, 0, pAd->LedCntl.field.Polarity); pAd->LedIndicatorStrength = 0xFF; - RTMPSetSignalLED(pAd, -100); // Force signal strength Led to be turned off, before link up + RTMPSetSignalLED(pAd, -100); // Force signal strength Led to be turned off, before link up { // Read Hardware controlled Radio state enable bit - if (NicConfig2.field.HardwareRadioControl == 1) - { + if (NicConfig2.field.HardwareRadioControl == 1) { pAd->StaCfg.bHardwareRadio = TRUE; // Read GPIO pin2 as Hardware controlled radio state RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &data); - if ((data & 0x04) == 0) - { + if ((data & 0x04) == 0) { pAd->StaCfg.bHwRadio = FALSE; pAd->StaCfg.bRadio = FALSE; -// RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x00001818); +// RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x00001818); RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); } - } - else + } else pAd->StaCfg.bHardwareRadio = FALSE; - if (pAd->StaCfg.bRadio == FALSE) - { + if (pAd->StaCfg.bRadio == FALSE) { RTMPSetLED(pAd, LED_RADIO_OFF); - } - else - { + } else { RTMPSetLED(pAd, LED_RADIO_ON); #ifdef RTMP_MAC_PCI #ifdef RT3090 - AsicSendCommandToMcu(pAd, 0x30, PowerRadioOffCID, 0xff, 0x02); + AsicSendCommandToMcu(pAd, 0x30, PowerRadioOffCID, 0xff, + 0x02); AsicCheckCommanOk(pAd, PowerRadioOffCID); #endif // RT3090 // #ifndef RT3090 AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02); #endif // RT3090 // - AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x00); + AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, + 0x00); // 2-1. wait command ok. AsicCheckCommanOk(pAd, PowerWakeCID); #endif // RTMP_MAC_PCI // @@ -1248,32 +1241,29 @@ VOID NICInitAsicFromEEPROM( #ifdef RTMP_MAC_PCI #ifdef RT30xx - if (IS_RT3090(pAd)|| IS_RT3572(pAd) || IS_RT3390(pAd)) - { - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; - if (pChipOps->AsicReverseRfFromSleepMode) - pChipOps->AsicReverseRfFromSleepMode(pAd); - } - // 3090 MCU Wakeup command needs more time to be stable. - // Before stable, don't issue other MCU command to prevent from firmware error. - - if ((IS_RT3090(pAd)|| IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { - DBGPRINT(RT_DEBUG_TRACE, - ("%s, release Mcu Lock\n", __func__)); - RTMP_SEM_LOCK(&pAd->McuCmdLock); - pAd->brt30xxBanMcuCmd = FALSE; - RTMP_SEM_UNLOCK(&pAd->McuCmdLock); - } + if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) { + RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + if (pChipOps->AsicReverseRfFromSleepMode) + pChipOps->AsicReverseRfFromSleepMode(pAd); + } + // 3090 MCU Wakeup command needs more time to be stable. + // Before stable, don't issue other MCU command to prevent from firmware error. + + if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) + && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) { + DBGPRINT(RT_DEBUG_TRACE, ("%s, release Mcu Lock\n", __func__)); + RTMP_SEM_LOCK(&pAd->McuCmdLock); + pAd->brt30xxBanMcuCmd = FALSE; + RTMP_SEM_UNLOCK(&pAd->McuCmdLock); + } #endif // RT30xx // #endif // RTMP_MAC_PCI // // Turn off patching for cardbus controller - if (NicConfig2.field.CardbusAcceleration == 1) - { -// pAd->bTest1 = TRUE; + if (NicConfig2.field.CardbusAcceleration == 1) { +// pAd->bTest1 = TRUE; } if (NicConfig2.field.DynamicTxAgcControl == 1) @@ -1288,16 +1278,11 @@ VOID NICInitAsicFromEEPROM( RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBPR3); BBPR3 &= (~0x18); - if(pAd->Antenna.field.RxPath == 3) - { + if (pAd->Antenna.field.RxPath == 3) { BBPR3 |= (0x10); - } - else if(pAd->Antenna.field.RxPath == 2) - { + } else if (pAd->Antenna.field.RxPath == 2) { BBPR3 |= (0x8); - } - else if(pAd->Antenna.field.RxPath == 1) - { + } else if (pAd->Antenna.field.RxPath == 1) { BBPR3 |= (0x0); } RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBPR3); @@ -1305,59 +1290,61 @@ VOID NICInitAsicFromEEPROM( { // Handle the difference when 1T RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &BBPR1); - if(pAd->Antenna.field.TxPath == 1) - { - BBPR1 &= (~0x18); + if (pAd->Antenna.field.TxPath == 1) { + BBPR1 &= (~0x18); } RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R1, BBPR1); - DBGPRINT(RT_DEBUG_TRACE, ("Use Hw Radio Control Pin=%d; if used Pin=%d;\n", - pAd->CommonCfg.bHardwareRadio, pAd->CommonCfg.bHardwareRadio)); + DBGPRINT(RT_DEBUG_TRACE, + ("Use Hw Radio Control Pin=%d; if used Pin=%d;\n", + pAd->CommonCfg.bHardwareRadio, + pAd->CommonCfg.bHardwareRadio)); } #ifdef RTMP_MAC_USB #ifdef RT30xx // update registers from EEPROM for RT3071 or later(3572/3592). - if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) - { + if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) { UCHAR RegIdx, RegValue; USHORT value; // after RT3071, write BBP from EEPROM 0xF0 to 0x102 - for (i = 0xF0; i <= 0x102; i = i+2) - { + for (i = 0xF0; i <= 0x102; i = i + 2) { value = 0xFFFF; RT28xx_EEPROM_READ16(pAd, i, value); - if ((value != 0xFFFF) && (value != 0)) - { - RegIdx = (UCHAR)(value >> 8); - RegValue = (UCHAR)(value & 0xff); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, RegIdx, RegValue); - DBGPRINT(RT_DEBUG_TRACE, ("Update BBP Registers from EEPROM(0x%0x), BBP(0x%x) = 0x%x\n", i, RegIdx, RegValue)); + if ((value != 0xFFFF) && (value != 0)) { + RegIdx = (UCHAR) (value >> 8); + RegValue = (UCHAR) (value & 0xff); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, RegIdx, + RegValue); + DBGPRINT(RT_DEBUG_TRACE, + ("Update BBP Registers from EEPROM(0x%0x), BBP(0x%x) = 0x%x\n", + i, RegIdx, RegValue)); } } // after RT3071, write RF from EEPROM 0x104 to 0x116 - for (i = 0x104; i <= 0x116; i = i+2) - { + for (i = 0x104; i <= 0x116; i = i + 2) { value = 0xFFFF; RT28xx_EEPROM_READ16(pAd, i, value); - if ((value != 0xFFFF) && (value != 0)) - { - RegIdx = (UCHAR)(value >> 8); - RegValue = (UCHAR)(value & 0xff); + if ((value != 0xFFFF) && (value != 0)) { + RegIdx = (UCHAR) (value >> 8); + RegValue = (UCHAR) (value & 0xff); RT30xxWriteRFRegister(pAd, RegIdx, RegValue); - DBGPRINT(RT_DEBUG_TRACE, ("Update RF Registers from EEPROM0x%x), BBP(0x%x) = 0x%x\n", i, RegIdx, RegValue)); + DBGPRINT(RT_DEBUG_TRACE, + ("Update RF Registers from EEPROM0x%x), BBP(0x%x) = 0x%x\n", + i, RegIdx, RegValue)); } } } #endif // RT30xx // #endif // RTMP_MAC_USB // - DBGPRINT(RT_DEBUG_TRACE, ("TxPath = %d, RxPath = %d, RFIC=%d, Polar+LED mode=%x\n", - pAd->Antenna.field.TxPath, pAd->Antenna.field.RxPath, - pAd->RfIcType, pAd->LedCntl.word)); + DBGPRINT(RT_DEBUG_TRACE, + ("TxPath = %d, RxPath = %d, RFIC=%d, Polar+LED mode=%x\n", + pAd->Antenna.field.TxPath, pAd->Antenna.field.RxPath, + pAd->RfIcType, pAd->LedCntl.word)); DBGPRINT(RT_DEBUG_TRACE, ("<-- NICInitAsicFromEEPROM\n")); } @@ -1379,37 +1366,36 @@ VOID NICInitAsicFromEEPROM( ======================================================================== */ -NDIS_STATUS NICInitializeAdapter( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bHardReset) +NDIS_STATUS NICInitializeAdapter(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) { - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - WPDMA_GLO_CFG_STRUC GloCfg; + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + WPDMA_GLO_CFG_STRUC GloCfg; #ifdef RTMP_MAC_PCI - UINT32 Value; - DELAY_INT_CFG_STRUC IntCfg; + UINT32 Value; + DELAY_INT_CFG_STRUC IntCfg; #endif // RTMP_MAC_PCI // -// INT_MASK_CSR_STRUC IntMask; - ULONG i =0, j=0; - AC_TXOP_CSR0_STRUC csr0; +// INT_MASK_CSR_STRUC IntMask; + ULONG i = 0, j = 0; + AC_TXOP_CSR0_STRUC csr0; DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitializeAdapter\n")); // 3. Set DMA global configuration except TX_DMA_EN and RX_DMA_EN bits: retry: i = 0; - do - { + do { RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); - if ((GloCfg.field.TxDMABusy == 0) && (GloCfg.field.RxDMABusy == 0)) + if ((GloCfg.field.TxDMABusy == 0) + && (GloCfg.field.RxDMABusy == 0)) break; RTMPusecDelay(1000); i++; - }while ( i<100); - DBGPRINT(RT_DEBUG_TRACE, ("<== DMA offset 0x208 = 0x%x\n", GloCfg.word)); + } while (i < 100); + DBGPRINT(RT_DEBUG_TRACE, + ("<== DMA offset 0x208 = 0x%x\n", GloCfg.word)); GloCfg.word &= 0xff0; - GloCfg.field.EnTXWriteBackDDONE =1; + GloCfg.field.EnTXWriteBackDDONE = 1; RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); // Record HW Beacon offset @@ -1435,35 +1421,36 @@ retry: #endif // RTMP_MAC_PCI // // Initialze ASIC for TX & Rx operation - if (NICInitializeAsic(pAd , bHardReset) != NDIS_STATUS_SUCCESS) - { - if (j++ == 0) - { + if (NICInitializeAsic(pAd, bHardReset) != NDIS_STATUS_SUCCESS) { + if (j++ == 0) { NICLoadFirmware(pAd); goto retry; } return NDIS_STATUS_FAILURE; } - #ifdef RTMP_MAC_PCI // Write AC_BK base address register - Value = RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_AC_BK].Cell[0].AllocPa); + Value = + RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_AC_BK].Cell[0].AllocPa); RTMP_IO_WRITE32(pAd, TX_BASE_PTR1, Value); DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR1 : 0x%x\n", Value)); // Write AC_BE base address register - Value = RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_AC_BE].Cell[0].AllocPa); + Value = + RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_AC_BE].Cell[0].AllocPa); RTMP_IO_WRITE32(pAd, TX_BASE_PTR0, Value); DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR0 : 0x%x\n", Value)); // Write AC_VI base address register - Value = RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_AC_VI].Cell[0].AllocPa); + Value = + RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_AC_VI].Cell[0].AllocPa); RTMP_IO_WRITE32(pAd, TX_BASE_PTR2, Value); DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR2 : 0x%x\n", Value)); // Write AC_VO base address register - Value = RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_AC_VO].Cell[0].AllocPa); + Value = + RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_AC_VO].Cell[0].AllocPa); RTMP_IO_WRITE32(pAd, TX_BASE_PTR3, Value); DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR3 : 0x%x\n", Value)); @@ -1479,23 +1466,23 @@ retry: // Init RX Ring index pointer pAd->RxRing.RxSwReadIdx = 0; - pAd->RxRing.RxCpuIdx = RX_RING_SIZE-1; + pAd->RxRing.RxCpuIdx = RX_RING_SIZE - 1; RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RxCpuIdx); // Init TX rings index pointer { - for (i=0; iTxRing[i].TxSwFreeIdx = 0; pAd->TxRing[i].TxCpuIdx = 0; - RTMP_IO_WRITE32(pAd, (TX_CTX_IDX0 + i * 0x10) , pAd->TxRing[i].TxCpuIdx); + RTMP_IO_WRITE32(pAd, (TX_CTX_IDX0 + i * 0x10), + pAd->TxRing[i].TxCpuIdx); } } // init MGMT ring index pointer pAd->MgmtRing.TxSwFreeIdx = 0; pAd->MgmtRing.TxCpuIdx = 0; - RTMP_IO_WRITE32(pAd, TX_MGMTCTX_IDX, pAd->MgmtRing.TxCpuIdx); + RTMP_IO_WRITE32(pAd, TX_MGMTCTX_IDX, pAd->MgmtRing.TxCpuIdx); // // set each Ring's SIZE into ASIC. Descriptor Size is fixed by design. @@ -1516,45 +1503,39 @@ retry: RTMP_IO_WRITE32(pAd, RX_MAX_CNT, Value); #endif // RTMP_MAC_PCI // - // WMM parameter csr0.word = 0; RTMP_IO_WRITE32(pAd, WMM_TXOP0_CFG, csr0.word); - if (pAd->CommonCfg.PhyMode == PHY_11B) - { + if (pAd->CommonCfg.PhyMode == PHY_11B) { csr0.field.Ac0Txop = 192; // AC_VI: 192*32us ~= 6ms csr0.field.Ac1Txop = 96; // AC_VO: 96*32us ~= 3ms - } - else - { + } else { csr0.field.Ac0Txop = 96; // AC_VI: 96*32us ~= 3ms csr0.field.Ac1Txop = 48; // AC_VO: 48*32us ~= 1.5ms } RTMP_IO_WRITE32(pAd, WMM_TXOP1_CFG, csr0.word); - #ifdef RTMP_MAC_PCI // 3. Set DMA global configuration except TX_DMA_EN and RX_DMA_EN bits: i = 0; - do - { + do { RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); - if ((GloCfg.field.TxDMABusy == 0) && (GloCfg.field.RxDMABusy == 0)) + if ((GloCfg.field.TxDMABusy == 0) + && (GloCfg.field.RxDMABusy == 0)) break; RTMPusecDelay(1000); i++; - }while ( i < 100); + } while (i < 100); GloCfg.word &= 0xff0; - GloCfg.field.EnTXWriteBackDDONE =1; + GloCfg.field.EnTXWriteBackDDONE = 1; RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); IntCfg.word = 0; RTMP_IO_WRITE32(pAd, DELAY_INT_CFG, IntCfg.word); #endif // RTMP_MAC_PCI // - // reset action // Load firmware // Status = NICLoadFirmware(pAd); @@ -1581,47 +1562,43 @@ retry: ======================================================================== */ -NDIS_STATUS NICInitializeAsic( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bHardReset) +NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) { - ULONG Index = 0; - UCHAR R0 = 0xff; - UINT32 MacCsr12 = 0, Counter = 0; + ULONG Index = 0; + UCHAR R0 = 0xff; + UINT32 MacCsr12 = 0, Counter = 0; #ifdef RTMP_MAC_USB - UINT32 MacCsr0 = 0; - NTSTATUS Status; - UCHAR Value = 0xff; + UINT32 MacCsr0 = 0; + NTSTATUS Status; + UCHAR Value = 0xff; #endif // RTMP_MAC_USB // #ifdef RT30xx - UCHAR bbpreg=0; - UCHAR RFValue=0; + UCHAR bbpreg = 0; + UCHAR RFValue = 0; #endif // RT30xx // - USHORT KeyIdx; - INT i,apidx; + USHORT KeyIdx; + INT i, apidx; DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitializeAsic\n")); #ifdef RTMP_MAC_PCI RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x3); // To fix driver disable/enable hang issue when radio off - if (bHardReset == TRUE) - { + if (bHardReset == TRUE) { RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x3); - } - else + } else RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x1); RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x0); // Initialize MAC register to default value - for (Index = 0; Index < NUM_MAC_REG_PARMS; Index++) - { - RTMP_IO_WRITE32(pAd, MACRegTable[Index].Register, MACRegTable[Index].Value); + for (Index = 0; Index < NUM_MAC_REG_PARMS; Index++) { + RTMP_IO_WRITE32(pAd, MACRegTable[Index].Register, + MACRegTable[Index].Value); } { - for (Index = 0; Index < NUM_STA_MAC_REG_PARMS; Index++) - { - RTMP_IO_WRITE32(pAd, STAMACRegTable[Index].Register, STAMACRegTable[Index].Value); + for (Index = 0; Index < NUM_STA_MAC_REG_PARMS; Index++) { + RTMP_IO_WRITE32(pAd, STAMACRegTable[Index].Register, + STAMACRegTable[Index].Value); } } #endif // RTMP_MAC_PCI // @@ -1633,8 +1610,7 @@ NDIS_STATUS NICInitializeAsic( //To avoid hang-on issue when interface up in kernel 2.4, //we use a local variable "MacCsr0" instead of using "pAd->MACVersion" directly. - do - { + do { RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0); if ((MacCsr0 != 0x00) && (MacCsr0 != 0xFFFFFFFF)) @@ -1644,7 +1620,8 @@ NDIS_STATUS NICInitializeAsic( } while (Index++ < 100); pAd->MACVersion = MacCsr0; - DBGPRINT(RT_DEBUG_TRACE, ("MAC_CSR0 [ Ver:Rev=0x%08x]\n", pAd->MACVersion)); + DBGPRINT(RT_DEBUG_TRACE, + ("MAC_CSR0 [ Ver:Rev=0x%08x]\n", pAd->MACVersion)); // turn on bit13 (set to zero) after rt2860D. This is to solve high-current issue. RTMP_IO_READ32(pAd, PBF_SYS_CTRL, &MacCsr12); MacCsr12 &= (~0x2000); @@ -1657,57 +1634,47 @@ NDIS_STATUS NICInitializeAsic( RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x0); // Initialize MAC register to default value - for(Index=0; IndexMACVersion & 0xffff) < 0x0211) - { - if (pAd->NicConfig2.field.DACTestBit == 1) - { + if ((pAd->MACVersion & 0xffff) < 0x0211) { + if (pAd->NicConfig2.field.DACTestBit == 1) { RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x2C); // To fix throughput drop drastically - } - else - { + } else { RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x0F); // To fix throughput drop drastically } - } - else - { + } else { RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x0); } - } - else if (IS_RT3070(pAd)) - { - if (((pAd->MACVersion & 0xffff) < 0x0201)) - { - RTMP_IO_WRITE32(pAd, TX_SW_CFG1, 0); + } else if (IS_RT3070(pAd)) { + if (((pAd->MACVersion & 0xffff) < 0x0201)) { + RTMP_IO_WRITE32(pAd, TX_SW_CFG1, 0); RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x2C); // To fix throughput drop drastically - } - else - { + } else { RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0); } } @@ -1717,18 +1684,18 @@ NDIS_STATUS NICInitializeAsic( // Before program BBP, we need to wait BBP/RF get wake up. // Index = 0; - do - { + do { RTMP_IO_READ32(pAd, MAC_STATUS_CFG, &MacCsr12); if ((MacCsr12 & 0x03) == 0) // if BB.RF is stable break; - DBGPRINT(RT_DEBUG_TRACE, ("Check MAC_STATUS_CFG = Busy = %x\n", MacCsr12)); + DBGPRINT(RT_DEBUG_TRACE, + ("Check MAC_STATUS_CFG = Busy = %x\n", MacCsr12)); RTMPusecDelay(1000); } while (Index++ < 100); - // The commands to firmware should be after these commands, these commands will init firmware + // The commands to firmware should be after these commands, these commands will init firmware // PCI and USB are not the same because PCI driver needs to wait for PCI bus ready RTMP_IO_WRITE32(pAd, H2M_BBP_AGENT, 0); // initialize BBP R/W access agent RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CSR, 0); @@ -1741,8 +1708,7 @@ NDIS_STATUS NICInitializeAsic( // Read BBP register, make sure BBP is up and running before write new data Index = 0; - do - { + do { RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R0, &R0); DBGPRINT(RT_DEBUG_TRACE, ("BBP version = %x\n", R0)); } while ((++Index < 20) && ((R0 == 0xff) || (R0 == 0x00))); @@ -1752,15 +1718,14 @@ NDIS_STATUS NICInitializeAsic( return NDIS_STATUS_FAILURE; // Initialize BBP register to default value - for (Index = 0; Index < NUM_BBP_REG_PARMS; Index++) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBPRegTable[Index].Register, BBPRegTable[Index].Value); + for (Index = 0; Index < NUM_BBP_REG_PARMS; Index++) { + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBPRegTable[Index].Register, + BBPRegTable[Index].Value); } #ifdef RTMP_MAC_PCI // TODO: shiang, check MACVersion, currently, rbus-based chip use this. - if (pAd->MACVersion == 0x28720200) - { + if (pAd->MACVersion == 0x28720200) { //UCHAR value; ULONG value2; @@ -1770,8 +1735,8 @@ NDIS_STATUS NICInitializeAsic( //Maximum PSDU length from 16K to 32K bytes RTMP_IO_READ32(pAd, MAX_LEN_CFG, &value2); - value2 &= ~(0x3<<12); - value2 |= (0x2<<12); + value2 &= ~(0x3 << 12); + value2 |= (0x2 << 12); RTMP_IO_WRITE32(pAd, MAX_LEN_CFG, value2); } #endif // RTMP_MAC_PCI // @@ -1779,53 +1744,45 @@ NDIS_STATUS NICInitializeAsic( // for rt2860E and after, init BBP_R84 with 0x19. This is for extension channel overlapping IOT. // RT3090 should not program BBP R84 to 0x19, otherwise TX will block. //3070/71/72,3090,3090A( are included in RT30xx),3572,3390 - if (((pAd->MACVersion & 0xffff) != 0x0101) && !(IS_RT30xx(pAd)|| IS_RT3572(pAd) || IS_RT3390(pAd))) + if (((pAd->MACVersion & 0xffff) != 0x0101) + && !(IS_RT30xx(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R84, 0x19); #ifdef RT30xx // add by johnli, RF power sequence setup - if (IS_RT30xx(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) - { //update for RT3070/71/72/90/91/92,3572,3390. + if (IS_RT30xx(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) { //update for RT3070/71/72/90/91/92,3572,3390. RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R79, 0x13); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R80, 0x05); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R81, 0x33); } - if (IS_RT3090(pAd)||IS_RT3390(pAd)) // RT309x, RT3071/72 + if (IS_RT3090(pAd) || IS_RT3390(pAd)) // RT309x, RT3071/72 { // enable DC filter - if ((pAd->MACVersion & 0xffff) >= 0x0211) - { + if ((pAd->MACVersion & 0xffff) >= 0x0211) { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R103, 0xc0); } - // improve power consumption RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R138, &bbpreg); - if (pAd->Antenna.field.TxPath == 1) - { + if (pAd->Antenna.field.TxPath == 1) { // turn off tx DAC_1 bbpreg = (bbpreg | 0x20); } - if (pAd->Antenna.field.RxPath == 1) - { + if (pAd->Antenna.field.RxPath == 1) { // turn off tx ADC_1 bbpreg &= (~0x2); } RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R138, bbpreg); // improve power consumption in RT3071 Ver.E - if ((pAd->MACVersion & 0xffff) >= 0x0211) - { + if ((pAd->MACVersion & 0xffff) >= 0x0211) { RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R31, &bbpreg); bbpreg &= (~0x3); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R31, bbpreg); } - } - else if (IS_RT3070(pAd)) - { - if ((pAd->MACVersion & 0xffff) >= 0x0201) - { + } else if (IS_RT3070(pAd)) { + if ((pAd->MACVersion & 0xffff) >= 0x0201) { // enable DC filter RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R103, 0xc0); @@ -1834,19 +1791,16 @@ NDIS_STATUS NICInitializeAsic( bbpreg &= (~0x3); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R31, bbpreg); } - // TX_LO1_en, RF R17 register Bit 3 to 0 RT30xxReadRFRegister(pAd, RF_R17, &RFValue); RFValue &= (~0x08); // to fix rx long range issue - if (pAd->NicConfig2.field.ExternalLNAForG == 0) - { + if (pAd->NicConfig2.field.ExternalLNAForG == 0) { RFValue |= 0x20; } // set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h - if (pAd->TxMixerGain24G >= 1) - { - RFValue &= (~0x7); // clean bit [2:0] + if (pAd->TxMixerGain24G >= 1) { + RFValue &= (~0x7); // clean bit [2:0] RFValue |= pAd->TxMixerGain24G; } RT30xxWriteRFRegister(pAd, RF_R17, RFValue); @@ -1854,13 +1808,12 @@ NDIS_STATUS NICInitializeAsic( // end johnli #endif // RT30xx // - if (pAd->MACVersion == 0x28600100) - { + if (pAd->MACVersion == 0x28600100) { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x16); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x12); - } + } - if (pAd->MACVersion >= RALINK_2880E_VERSION && pAd->MACVersion < RALINK_3070_VERSION) // 3*3 + if (pAd->MACVersion >= RALINK_2880E_VERSION && pAd->MACVersion < RALINK_3070_VERSION) // 3*3 { // enlarge MAX_LEN_CFG UINT32 csr; @@ -1869,25 +1822,25 @@ NDIS_STATUS NICInitializeAsic( csr |= 0x2000; RTMP_IO_WRITE32(pAd, MAX_LEN_CFG, csr); } - #ifdef RTMP_MAC_USB -{ - UCHAR MAC_Value[]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0,0}; - - //Initialize WCID table - Value = 0xff; - for(Index =0 ;Index < 254;Index++) { - RTUSBMultiWrite(pAd, (USHORT)(MAC_WCID_BASE + Index * 8), MAC_Value, 8); + UCHAR MAC_Value[] = + { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0 }; + + //Initialize WCID table + Value = 0xff; + for (Index = 0; Index < 254; Index++) { + RTUSBMultiWrite(pAd, + (USHORT) (MAC_WCID_BASE + Index * 8), + MAC_Value, 8); + } } -} #endif // RTMP_MAC_USB // // Add radio off control { - if (pAd->StaCfg.bRadio == FALSE) - { -// RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x00001818); + if (pAd->StaCfg.bRadio == FALSE) { +// RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x00001818); RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); DBGPRINT(RT_DEBUG_TRACE, ("Set Radio Off\n")); } @@ -1904,35 +1857,33 @@ NDIS_STATUS NICInitializeAsic( // ASIC will keep garbage value after boot // Clear all shared key table when initial // This routine can be ignored in radio-ON/OFF operation. - if (bHardReset) - { - for (KeyIdx = 0; KeyIdx < 4; KeyIdx++) - { - RTMP_IO_WRITE32(pAd, SHARED_KEY_MODE_BASE + 4*KeyIdx, 0); + if (bHardReset) { + for (KeyIdx = 0; KeyIdx < 4; KeyIdx++) { + RTMP_IO_WRITE32(pAd, SHARED_KEY_MODE_BASE + 4 * KeyIdx, + 0); } // Clear all pairwise key table when initial - for (KeyIdx = 0; KeyIdx < 256; KeyIdx++) - { - RTMP_IO_WRITE32(pAd, MAC_WCID_ATTRIBUTE_BASE + (KeyIdx * HW_WCID_ATTRI_SIZE), 1); + for (KeyIdx = 0; KeyIdx < 256; KeyIdx++) { + RTMP_IO_WRITE32(pAd, + MAC_WCID_ATTRIBUTE_BASE + + (KeyIdx * HW_WCID_ATTRI_SIZE), 1); } } - // assert HOST ready bit // RTMP_IO_WRITE32(pAd, MAC_CSR1, 0x0); // 2004-09-14 asked by Mark // RTMP_IO_WRITE32(pAd, MAC_CSR1, 0x4); // It isn't necessary to clear this space when not hard reset. - if (bHardReset == TRUE) - { + if (bHardReset == TRUE) { // clear all on-chip BEACON frame space - for (apidx = 0; apidx < HW_BEACON_MAX_COUNT; apidx++) - { - for (i = 0; i < HW_BEACON_OFFSET>>2; i+=4) - RTMP_IO_WRITE32(pAd, pAd->BeaconOffset[apidx] + i, 0x00); + for (apidx = 0; apidx < HW_BEACON_MAX_COUNT; apidx++) { + for (i = 0; i < HW_BEACON_OFFSET >> 2; i += 4) + RTMP_IO_WRITE32(pAd, + pAd->BeaconOffset[apidx] + i, + 0x00); } } - #ifdef RTMP_MAC_USB AsicDisableSync(pAd); // Clear raw counters @@ -1944,14 +1895,14 @@ NDIS_STATUS NICInitializeAsic( RTMP_IO_READ32(pAd, TX_STA_CNT2, &Counter); // Default PCI clock cycle per ms is different as default setting, which is based on PCI. RTMP_IO_READ32(pAd, USB_CYC_CFG, &Counter); - Counter&=0xffffff00; - Counter|=0x000001e; + Counter &= 0xffffff00; + Counter |= 0x000001e; RTMP_IO_WRITE32(pAd, USB_CYC_CFG, Counter); #endif // RTMP_MAC_USB // { // for rt2860E and after, init TXOP_CTRL_CFG with 0x583f. This is for extension channel overlapping IOT. - if ((pAd->MACVersion&0xffff) != 0x0101) + if ((pAd->MACVersion & 0xffff) != 0x0101) RTMP_IO_WRITE32(pAd, TXOP_CTRL_CFG, 0x583f); } @@ -1978,10 +1929,9 @@ NDIS_STATUS NICInitializeAsic( ======================================================================== */ -VOID NICIssueReset( - IN PRTMP_ADAPTER pAd) +VOID NICIssueReset(IN PRTMP_ADAPTER pAd) { - UINT32 Value = 0; + UINT32 Value = 0; DBGPRINT(RT_DEBUG_TRACE, ("--> NICIssueReset\n")); // Abort Tx, prevent ASIC from writing to Host memory @@ -1993,7 +1943,7 @@ VOID NICIssueReset( RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); // Issue reset and clear from reset state - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x03); // 2004-09-17 change from 0x01 + RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x03); // 2004-09-17 change from 0x01 RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x00); DBGPRINT(RT_DEBUG_TRACE, ("<-- NICIssueReset\n")); @@ -2015,132 +1965,115 @@ VOID NICIssueReset( ======================================================================== */ -BOOLEAN NICCheckForHang( - IN PRTMP_ADAPTER pAd) +BOOLEAN NICCheckForHang(IN PRTMP_ADAPTER pAd) { return (FALSE); } -VOID NICUpdateFifoStaCounters( - IN PRTMP_ADAPTER pAd) +VOID NICUpdateFifoStaCounters(IN PRTMP_ADAPTER pAd) { - TX_STA_FIFO_STRUC StaFifo; - MAC_TABLE_ENTRY *pEntry; - UCHAR i = 0; - UCHAR pid = 0, wcid = 0; - CHAR reTry; - UCHAR succMCS; - - do - { - RTMP_IO_READ32(pAd, TX_STA_FIFO, &StaFifo.word); + TX_STA_FIFO_STRUC StaFifo; + MAC_TABLE_ENTRY *pEntry; + UCHAR i = 0; + UCHAR pid = 0, wcid = 0; + CHAR reTry; + UCHAR succMCS; - if (StaFifo.field.bValid == 0) - break; + do { + RTMP_IO_READ32(pAd, TX_STA_FIFO, &StaFifo.word); - wcid = (UCHAR)StaFifo.field.wcid; + if (StaFifo.field.bValid == 0) + break; + wcid = (UCHAR) StaFifo.field.wcid; /* ignore NoACK and MGMT frame use 0xFF as WCID */ - if ((StaFifo.field.TxAckRequired == 0) || (wcid >= MAX_LEN_OF_MAC_TABLE)) - { - i++; - continue; - } - - /* PID store Tx MCS Rate */ - pid = (UCHAR)StaFifo.field.PidType; + if ((StaFifo.field.TxAckRequired == 0) + || (wcid >= MAX_LEN_OF_MAC_TABLE)) { + i++; + continue; + } - pEntry = &pAd->MacTab.Content[wcid]; + /* PID store Tx MCS Rate */ + pid = (UCHAR) StaFifo.field.PidType; - pEntry->DebugFIFOCount++; + pEntry = &pAd->MacTab.Content[wcid]; - if (StaFifo.field.TxBF) // 3*3 - pEntry->TxBFCount++; + pEntry->DebugFIFOCount++; - if (!StaFifo.field.TxSuccess) - { - pEntry->FIFOCount++; - pEntry->OneSecTxFailCount++; + if (StaFifo.field.TxBF) // 3*3 + pEntry->TxBFCount++; - if (pEntry->FIFOCount >= 1) - { - DBGPRINT(RT_DEBUG_TRACE, ("#")); - pEntry->NoBADataCountDown = 64; + if (!StaFifo.field.TxSuccess) { + pEntry->FIFOCount++; + pEntry->OneSecTxFailCount++; - if(pEntry->PsMode == PWR_ACTIVE) - { - int tid; - for (tid=0; tidAid, tid, FALSE, FALSE); - } + if (pEntry->FIFOCount >= 1) { + DBGPRINT(RT_DEBUG_TRACE, ("#")); + pEntry->NoBADataCountDown = 64; - // Update the continuous transmission counter except PS mode - pEntry->ContinueTxFailCnt++; - } - else - { - // Clear the FIFOCount when sta in Power Save mode. Basically we assume - // this tx error happened due to sta just go to sleep. - pEntry->FIFOCount = 0; - pEntry->ContinueTxFailCnt = 0; + if (pEntry->PsMode == PWR_ACTIVE) { + int tid; + for (tid = 0; tid < NUM_OF_TID; tid++) { + BAOriSessionTearDown(pAd, + pEntry-> + Aid, tid, + FALSE, + FALSE); } - //pEntry->FIFOCount = 0; + + // Update the continuous transmission counter except PS mode + pEntry->ContinueTxFailCnt++; + } else { + // Clear the FIFOCount when sta in Power Save mode. Basically we assume + // this tx error happened due to sta just go to sleep. + pEntry->FIFOCount = 0; + pEntry->ContinueTxFailCnt = 0; } - //pEntry->bSendBAR = TRUE; + //pEntry->FIFOCount = 0; } - else - { - if ((pEntry->PsMode != PWR_SAVE) && (pEntry->NoBADataCountDown > 0)) - { - pEntry->NoBADataCountDown--; - if (pEntry->NoBADataCountDown==0) - { - DBGPRINT(RT_DEBUG_TRACE, ("@\n")); - } + //pEntry->bSendBAR = TRUE; + } else { + if ((pEntry->PsMode != PWR_SAVE) + && (pEntry->NoBADataCountDown > 0)) { + pEntry->NoBADataCountDown--; + if (pEntry->NoBADataCountDown == 0) { + DBGPRINT(RT_DEBUG_TRACE, ("@\n")); } - - pEntry->FIFOCount = 0; - pEntry->OneSecTxNoRetryOkCount++; - // update NoDataIdleCount when sucessful send packet to STA. - pEntry->NoDataIdleCount = 0; - pEntry->ContinueTxFailCnt = 0; } - succMCS = StaFifo.field.SuccessRate & 0x7F; + pEntry->FIFOCount = 0; + pEntry->OneSecTxNoRetryOkCount++; + // update NoDataIdleCount when sucessful send packet to STA. + pEntry->NoDataIdleCount = 0; + pEntry->ContinueTxFailCnt = 0; + } - reTry = pid - succMCS; + succMCS = StaFifo.field.SuccessRate & 0x7F; - if (StaFifo.field.TxSuccess) - { - pEntry->TXMCSExpected[pid]++; - if (pid == succMCS) - { - pEntry->TXMCSSuccessful[pid]++; - } - else - { - pEntry->TXMCSAutoFallBack[pid][succMCS]++; - } - } - else - { - pEntry->TXMCSFailed[pid]++; + reTry = pid - succMCS; + + if (StaFifo.field.TxSuccess) { + pEntry->TXMCSExpected[pid]++; + if (pid == succMCS) { + pEntry->TXMCSSuccessful[pid]++; + } else { + pEntry->TXMCSAutoFallBack[pid][succMCS]++; } + } else { + pEntry->TXMCSFailed[pid]++; + } - if (reTry > 0) - { - if ((pid >= 12) && succMCS <=7) - { - reTry -= 4; - } - pEntry->OneSecTxRetryOkCount += reTry; + if (reTry > 0) { + if ((pid >= 12) && succMCS <= 7) { + reTry -= 4; } + pEntry->OneSecTxRetryOkCount += reTry; + } - i++; - // ASIC store 16 stack - } while ( i < (2*TX_RING_SIZE) ); + i++; + // ASIC store 16 stack + } while (i < (2 * TX_RING_SIZE)); } @@ -2161,29 +2094,27 @@ VOID NICUpdateFifoStaCounters( ======================================================================== */ -VOID NICUpdateRawCounters( - IN PRTMP_ADAPTER pAd) +VOID NICUpdateRawCounters(IN PRTMP_ADAPTER pAd) { - UINT32 OldValue;//, Value2; - //ULONG PageSum, OneSecTransmitCount; - //ULONG TxErrorRatio, Retry, Fail; - RX_STA_CNT0_STRUC RxStaCnt0; - RX_STA_CNT1_STRUC RxStaCnt1; - RX_STA_CNT2_STRUC RxStaCnt2; - TX_STA_CNT0_STRUC TxStaCnt0; - TX_STA_CNT1_STRUC StaTx1; - TX_STA_CNT2_STRUC StaTx2; - TX_AGG_CNT_STRUC TxAggCnt; - TX_AGG_CNT0_STRUC TxAggCnt0; - TX_AGG_CNT1_STRUC TxAggCnt1; - TX_AGG_CNT2_STRUC TxAggCnt2; - TX_AGG_CNT3_STRUC TxAggCnt3; - TX_AGG_CNT4_STRUC TxAggCnt4; - TX_AGG_CNT5_STRUC TxAggCnt5; - TX_AGG_CNT6_STRUC TxAggCnt6; - TX_AGG_CNT7_STRUC TxAggCnt7; - COUNTER_RALINK *pRalinkCounters; - + UINT32 OldValue; //, Value2; + //ULONG PageSum, OneSecTransmitCount; + //ULONG TxErrorRatio, Retry, Fail; + RX_STA_CNT0_STRUC RxStaCnt0; + RX_STA_CNT1_STRUC RxStaCnt1; + RX_STA_CNT2_STRUC RxStaCnt2; + TX_STA_CNT0_STRUC TxStaCnt0; + TX_STA_CNT1_STRUC StaTx1; + TX_STA_CNT2_STRUC StaTx2; + TX_AGG_CNT_STRUC TxAggCnt; + TX_AGG_CNT0_STRUC TxAggCnt0; + TX_AGG_CNT1_STRUC TxAggCnt1; + TX_AGG_CNT2_STRUC TxAggCnt2; + TX_AGG_CNT3_STRUC TxAggCnt3; + TX_AGG_CNT4_STRUC TxAggCnt4; + TX_AGG_CNT5_STRUC TxAggCnt5; + TX_AGG_CNT6_STRUC TxAggCnt6; + TX_AGG_CNT7_STRUC TxAggCnt7; + COUNTER_RALINK *pRalinkCounters; pRalinkCounters = &pAd->RalinkCounters; @@ -2192,15 +2123,16 @@ VOID NICUpdateRawCounters( { RTMP_IO_READ32(pAd, RX_STA_CNT1, &RxStaCnt1.word); - // Update RX PLCP error counter - pAd->PrivateInfo.PhyRxErrCnt += RxStaCnt1.field.PlcpErr; + // Update RX PLCP error counter + pAd->PrivateInfo.PhyRxErrCnt += RxStaCnt1.field.PlcpErr; // Update False CCA counter - pAd->RalinkCounters.OneSecFalseCCACnt += RxStaCnt1.field.FalseCca; + pAd->RalinkCounters.OneSecFalseCCACnt += + RxStaCnt1.field.FalseCca; } // Update FCS counters - OldValue= pAd->WlanCounters.FCSErrorCount.u.LowPart; - pAd->WlanCounters.FCSErrorCount.u.LowPart += (RxStaCnt0.field.CrcErr); // >> 7); + OldValue = pAd->WlanCounters.FCSErrorCount.u.LowPart; + pAd->WlanCounters.FCSErrorCount.u.LowPart += (RxStaCnt0.field.CrcErr); // >> 7); if (pAd->WlanCounters.FCSErrorCount.u.LowPart < OldValue) pAd->WlanCounters.FCSErrorCount.u.HighPart++; @@ -2213,19 +2145,17 @@ VOID NICUpdateRawCounters( // Update Duplicate Rcv check pRalinkCounters->DuplicateRcv += RxStaCnt2.field.RxDupliCount; - pAd->WlanCounters.FrameDuplicateCount.u.LowPart += RxStaCnt2.field.RxDupliCount; + pAd->WlanCounters.FrameDuplicateCount.u.LowPart += + RxStaCnt2.field.RxDupliCount; // Update RX Overflow counter pAd->Counters8023.RxNoBuffer += (RxStaCnt2.field.RxFifoOverflowCount); //pAd->RalinkCounters.RxCount = 0; #ifdef RTMP_MAC_USB - if (pRalinkCounters->RxCount != pAd->watchDogRxCnt) - { + if (pRalinkCounters->RxCount != pAd->watchDogRxCnt) { pAd->watchDogRxCnt = pRalinkCounters->RxCount; pAd->watchDogRxOverFlowCnt = 0; - } - else - { + } else { if (RxStaCnt2.field.RxFifoOverflowCount) pAd->watchDogRxOverFlowCnt++; else @@ -2233,25 +2163,29 @@ VOID NICUpdateRawCounters( } #endif // RTMP_MAC_USB // - //if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED) || - // (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED) && (pAd->MacTab.Size != 1))) - if (!pAd->bUpdateBcnCntDone) - { - // Update BEACON sent count - RTMP_IO_READ32(pAd, TX_STA_CNT0, &TxStaCnt0.word); - RTMP_IO_READ32(pAd, TX_STA_CNT1, &StaTx1.word); - RTMP_IO_READ32(pAd, TX_STA_CNT2, &StaTx2.word); - pRalinkCounters->OneSecBeaconSentCnt += TxStaCnt0.field.TxBeaconCount; - pRalinkCounters->OneSecTxRetryOkCount += StaTx1.field.TxRetransmit; - pRalinkCounters->OneSecTxNoRetryOkCount += StaTx1.field.TxSuccess; - pRalinkCounters->OneSecTxFailCount += TxStaCnt0.field.TxFailCount; - pAd->WlanCounters.TransmittedFragmentCount.u.LowPart += StaTx1.field.TxSuccess; - pAd->WlanCounters.RetryCount.u.LowPart += StaTx1.field.TxRetransmit; - pAd->WlanCounters.FailedCount.u.LowPart += TxStaCnt0.field.TxFailCount; + // (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED) && (pAd->MacTab.Size != 1))) + if (!pAd->bUpdateBcnCntDone) { + // Update BEACON sent count + RTMP_IO_READ32(pAd, TX_STA_CNT0, &TxStaCnt0.word); + RTMP_IO_READ32(pAd, TX_STA_CNT1, &StaTx1.word); + RTMP_IO_READ32(pAd, TX_STA_CNT2, &StaTx2.word); + pRalinkCounters->OneSecBeaconSentCnt += + TxStaCnt0.field.TxBeaconCount; + pRalinkCounters->OneSecTxRetryOkCount += + StaTx1.field.TxRetransmit; + pRalinkCounters->OneSecTxNoRetryOkCount += + StaTx1.field.TxSuccess; + pRalinkCounters->OneSecTxFailCount += + TxStaCnt0.field.TxFailCount; + pAd->WlanCounters.TransmittedFragmentCount.u.LowPart += + StaTx1.field.TxSuccess; + pAd->WlanCounters.RetryCount.u.LowPart += + StaTx1.field.TxRetransmit; + pAd->WlanCounters.FailedCount.u.LowPart += + TxStaCnt0.field.TxFailCount; } - //if (pAd->bStaFifoTest == TRUE) { RTMP_IO_READ32(pAd, TX_AGG_CNT, &TxAggCnt.word); @@ -2265,58 +2199,87 @@ VOID NICUpdateRawCounters( RTMP_IO_READ32(pAd, TX_AGG_CNT7, &TxAggCnt7.word); pRalinkCounters->TxAggCount += TxAggCnt.field.AggTxCount; pRalinkCounters->TxNonAggCount += TxAggCnt.field.NonAggTxCount; - pRalinkCounters->TxAgg1MPDUCount += TxAggCnt0.field.AggSize1Count; - pRalinkCounters->TxAgg2MPDUCount += TxAggCnt0.field.AggSize2Count; - - pRalinkCounters->TxAgg3MPDUCount += TxAggCnt1.field.AggSize3Count; - pRalinkCounters->TxAgg4MPDUCount += TxAggCnt1.field.AggSize4Count; - pRalinkCounters->TxAgg5MPDUCount += TxAggCnt2.field.AggSize5Count; - pRalinkCounters->TxAgg6MPDUCount += TxAggCnt2.field.AggSize6Count; - - pRalinkCounters->TxAgg7MPDUCount += TxAggCnt3.field.AggSize7Count; - pRalinkCounters->TxAgg8MPDUCount += TxAggCnt3.field.AggSize8Count; - pRalinkCounters->TxAgg9MPDUCount += TxAggCnt4.field.AggSize9Count; - pRalinkCounters->TxAgg10MPDUCount += TxAggCnt4.field.AggSize10Count; - - pRalinkCounters->TxAgg11MPDUCount += TxAggCnt5.field.AggSize11Count; - pRalinkCounters->TxAgg12MPDUCount += TxAggCnt5.field.AggSize12Count; - pRalinkCounters->TxAgg13MPDUCount += TxAggCnt6.field.AggSize13Count; - pRalinkCounters->TxAgg14MPDUCount += TxAggCnt6.field.AggSize14Count; - - pRalinkCounters->TxAgg15MPDUCount += TxAggCnt7.field.AggSize15Count; - pRalinkCounters->TxAgg16MPDUCount += TxAggCnt7.field.AggSize16Count; + pRalinkCounters->TxAgg1MPDUCount += + TxAggCnt0.field.AggSize1Count; + pRalinkCounters->TxAgg2MPDUCount += + TxAggCnt0.field.AggSize2Count; + + pRalinkCounters->TxAgg3MPDUCount += + TxAggCnt1.field.AggSize3Count; + pRalinkCounters->TxAgg4MPDUCount += + TxAggCnt1.field.AggSize4Count; + pRalinkCounters->TxAgg5MPDUCount += + TxAggCnt2.field.AggSize5Count; + pRalinkCounters->TxAgg6MPDUCount += + TxAggCnt2.field.AggSize6Count; + + pRalinkCounters->TxAgg7MPDUCount += + TxAggCnt3.field.AggSize7Count; + pRalinkCounters->TxAgg8MPDUCount += + TxAggCnt3.field.AggSize8Count; + pRalinkCounters->TxAgg9MPDUCount += + TxAggCnt4.field.AggSize9Count; + pRalinkCounters->TxAgg10MPDUCount += + TxAggCnt4.field.AggSize10Count; + + pRalinkCounters->TxAgg11MPDUCount += + TxAggCnt5.field.AggSize11Count; + pRalinkCounters->TxAgg12MPDUCount += + TxAggCnt5.field.AggSize12Count; + pRalinkCounters->TxAgg13MPDUCount += + TxAggCnt6.field.AggSize13Count; + pRalinkCounters->TxAgg14MPDUCount += + TxAggCnt6.field.AggSize14Count; + + pRalinkCounters->TxAgg15MPDUCount += + TxAggCnt7.field.AggSize15Count; + pRalinkCounters->TxAgg16MPDUCount += + TxAggCnt7.field.AggSize16Count; // Calculate the transmitted A-MPDU count - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += TxAggCnt0.field.AggSize1Count; - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt0.field.AggSize2Count / 2); - - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt1.field.AggSize3Count / 3); - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt1.field.AggSize4Count / 4); - - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt2.field.AggSize5Count / 5); - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt2.field.AggSize6Count / 6); - - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt3.field.AggSize7Count / 7); - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt3.field.AggSize8Count / 8); - - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt4.field.AggSize9Count / 9); - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt4.field.AggSize10Count / 10); - - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt5.field.AggSize11Count / 11); - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt5.field.AggSize12Count / 12); - - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt6.field.AggSize13Count / 13); - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt6.field.AggSize14Count / 14); - - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt7.field.AggSize15Count / 15); - pRalinkCounters->TransmittedAMPDUCount.u.LowPart += (TxAggCnt7.field.AggSize16Count / 16); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += + TxAggCnt0.field.AggSize1Count; + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += + (TxAggCnt0.field.AggSize2Count / 2); + + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += + (TxAggCnt1.field.AggSize3Count / 3); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += + (TxAggCnt1.field.AggSize4Count / 4); + + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += + (TxAggCnt2.field.AggSize5Count / 5); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += + (TxAggCnt2.field.AggSize6Count / 6); + + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += + (TxAggCnt3.field.AggSize7Count / 7); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += + (TxAggCnt3.field.AggSize8Count / 8); + + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += + (TxAggCnt4.field.AggSize9Count / 9); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += + (TxAggCnt4.field.AggSize10Count / 10); + + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += + (TxAggCnt5.field.AggSize11Count / 11); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += + (TxAggCnt5.field.AggSize12Count / 12); + + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += + (TxAggCnt6.field.AggSize13Count / 13); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += + (TxAggCnt6.field.AggSize14Count / 14); + + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += + (TxAggCnt7.field.AggSize15Count / 15); + pRalinkCounters->TransmittedAMPDUCount.u.LowPart += + (TxAggCnt7.field.AggSize16Count / 16); } - - } - /* ======================================================================== @@ -2336,8 +2299,7 @@ VOID NICUpdateRawCounters( ======================================================================== */ -VOID NICResetFromError( - IN PRTMP_ADAPTER pAd) +VOID NICResetFromError(IN PRTMP_ADAPTER pAd) { // Reset BBP (according to alex, reset ASIC will force reset BBP // Therefore, skip the reset BBP @@ -2355,18 +2317,15 @@ VOID NICResetFromError( AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); } - -NDIS_STATUS NICLoadFirmware( - IN PRTMP_ADAPTER pAd) +NDIS_STATUS NICLoadFirmware(IN PRTMP_ADAPTER pAd) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + NDIS_STATUS status = NDIS_STATUS_SUCCESS; if (pAd->chipOps.loadFirmware) status = pAd->chipOps.loadFirmware(pAd); return status; } - /* ======================================================================== @@ -2380,14 +2339,12 @@ NDIS_STATUS NICLoadFirmware( ======================================================================== */ -VOID NICEraseFirmware( - IN PRTMP_ADAPTER pAd) +VOID NICEraseFirmware(IN PRTMP_ADAPTER pAd) { if (pAd->chipOps.eraseFirmware) pAd->chipOps.eraseFirmware(pAd); -}/* End of NICEraseFirmware */ - +} /* End of NICEraseFirmware */ /* ======================================================================== @@ -2410,13 +2367,11 @@ VOID NICEraseFirmware( ======================================================================== */ -NDIS_STATUS NICLoadRateSwitchingParams( - IN PRTMP_ADAPTER pAd) +NDIS_STATUS NICLoadRateSwitchingParams(IN PRTMP_ADAPTER pAd) { return NDIS_STATUS_SUCCESS; } - /* ======================================================================== @@ -2438,20 +2393,16 @@ NDIS_STATUS NICLoadRateSwitchingParams( ======================================================================== */ -ULONG RTMPCompareMemory( - IN PVOID pSrc1, - IN PVOID pSrc2, - IN ULONG Length) +ULONG RTMPCompareMemory(IN PVOID pSrc1, IN PVOID pSrc2, IN ULONG Length) { - PUCHAR pMem1; - PUCHAR pMem2; - ULONG Index = 0; + PUCHAR pMem1; + PUCHAR pMem2; + ULONG Index = 0; pMem1 = (PUCHAR) pSrc1; pMem2 = (PUCHAR) pSrc2; - for (Index = 0; Index < Length; Index++) - { + for (Index = 0; Index < Length; Index++) { if (pMem1[Index] > pMem2[Index]) return (1); else if (pMem1[Index] < pMem2[Index]) @@ -2482,22 +2433,18 @@ ULONG RTMPCompareMemory( ======================================================================== */ -VOID RTMPZeroMemory( - IN PVOID pSrc, - IN ULONG Length) +VOID RTMPZeroMemory(IN PVOID pSrc, IN ULONG Length) { - PUCHAR pMem; - ULONG Index = 0; + PUCHAR pMem; + ULONG Index = 0; pMem = (PUCHAR) pSrc; - for (Index = 0; Index < Length; Index++) - { + for (Index = 0; Index < Length; Index++) { pMem[Index] = 0x00; } } - /* ======================================================================== @@ -2519,22 +2466,18 @@ VOID RTMPZeroMemory( ======================================================================== */ -VOID RTMPMoveMemory( - OUT PVOID pDest, - IN PVOID pSrc, - IN ULONG Length) +VOID RTMPMoveMemory(OUT PVOID pDest, IN PVOID pSrc, IN ULONG Length) { - PUCHAR pMem1; - PUCHAR pMem2; - UINT Index; + PUCHAR pMem1; + PUCHAR pMem2; + UINT Index; - ASSERT((Length==0) || (pDest && pSrc)); + ASSERT((Length == 0) || (pDest && pSrc)); pMem1 = (PUCHAR) pDest; pMem2 = (PUCHAR) pSrc; - for (Index = 0; Index < Length; Index++) - { + for (Index = 0; Index < Length; Index++) { pMem1[Index] = pMem2[Index]; } } @@ -2557,10 +2500,9 @@ VOID RTMPMoveMemory( ======================================================================== */ -VOID UserCfgInit( - IN PRTMP_ADAPTER pAd) +VOID UserCfgInit(IN PRTMP_ADAPTER pAd) { - UINT key_index, bss_index; + UINT key_index, bss_index; DBGPRINT(RT_DEBUG_TRACE, ("--> UserCfgInit\n")); @@ -2586,19 +2528,19 @@ VOID UserCfgInit( pAd->CommonCfg.MaxPktOneTxBulk = 2; pAd->CommonCfg.TxBulkFactor = 1; - pAd->CommonCfg.RxBulkFactor =1; + pAd->CommonCfg.RxBulkFactor = 1; - pAd->CommonCfg.TxPower = 100; //mW + pAd->CommonCfg.TxPower = 100; //mW - NdisZeroMemory(&pAd->CommonCfg.IOTestParm, sizeof(pAd->CommonCfg.IOTestParm)); + NdisZeroMemory(&pAd->CommonCfg.IOTestParm, + sizeof(pAd->CommonCfg.IOTestParm)); #endif // RTMP_MAC_USB // - for(key_index=0; key_indexSharedKey[bss_index][key_index].KeyLen = 0; - pAd->SharedKey[bss_index][key_index].CipherAlg = CIPHER_NONE; + pAd->SharedKey[bss_index][key_index].CipherAlg = + CIPHER_NONE; } } @@ -2612,12 +2554,12 @@ VOID UserCfgInit( pAd->LedIndicatorStrength = 0; pAd->RLnkCtrlOffset = 0; pAd->HostLnkCtrlOffset = 0; - pAd->StaCfg.PSControl.field.EnableNewPS=TRUE; + pAd->StaCfg.PSControl.field.EnableNewPS = TRUE; pAd->CheckDmaBusyCount = 0; #endif // RTMP_MAC_PCI // - pAd->bAutoTxAgcA = FALSE; // Default is OFF - pAd->bAutoTxAgcG = FALSE; // Default is OFF + pAd->bAutoTxAgcA = FALSE; // Default is OFF + pAd->bAutoTxAgcG = FALSE; // Default is OFF pAd->RfIcType = RFIC_2820; // Init timer for reset complete event @@ -2626,25 +2568,22 @@ VOID UserCfgInit( pAd->bForcePrintRX = FALSE; pAd->bStaFifoTest = FALSE; pAd->bProtectionTest = FALSE; - pAd->CommonCfg.Dsifs = 10; // in units of usec - pAd->CommonCfg.TxPower = 100; //mW - pAd->CommonCfg.TxPowerPercentage = 0xffffffff; // AUTO - pAd->CommonCfg.TxPowerDefault = 0xffffffff; // AUTO - pAd->CommonCfg.TxPreamble = Rt802_11PreambleAuto; // use Long preamble on TX by defaut + pAd->CommonCfg.Dsifs = 10; // in units of usec + pAd->CommonCfg.TxPower = 100; //mW + pAd->CommonCfg.TxPowerPercentage = 0xffffffff; // AUTO + pAd->CommonCfg.TxPowerDefault = 0xffffffff; // AUTO + pAd->CommonCfg.TxPreamble = Rt802_11PreambleAuto; // use Long preamble on TX by defaut pAd->CommonCfg.bUseZeroToDisableFragment = FALSE; pAd->CommonCfg.RtsThreshold = 2347; pAd->CommonCfg.FragmentThreshold = 2346; - pAd->CommonCfg.UseBGProtection = 0; // 0: AUTO - pAd->CommonCfg.bEnableTxBurst = TRUE; //0; - pAd->CommonCfg.PhyMode = 0xff; // unknown + pAd->CommonCfg.UseBGProtection = 0; // 0: AUTO + pAd->CommonCfg.bEnableTxBurst = TRUE; //0; + pAd->CommonCfg.PhyMode = 0xff; // unknown pAd->CommonCfg.BandState = UNKNOWN_BAND; pAd->CommonCfg.RadarDetect.CSPeriod = 10; pAd->CommonCfg.RadarDetect.CSCount = 0; pAd->CommonCfg.RadarDetect.RDMode = RD_NORMAL_MODE; - - - pAd->CommonCfg.RadarDetect.ChMovingTime = 65; pAd->CommonCfg.RadarDetect.LongPulseRadarTh = 3; pAd->CommonCfg.bAPSDCapable = FALSE; @@ -2657,18 +2596,22 @@ VOID UserCfgInit( NdisZeroMemory(&pAd->BeaconTxWI, sizeof(pAd->BeaconTxWI)); - NdisZeroMemory(&pAd->CommonCfg.HtCapability, sizeof(pAd->CommonCfg.HtCapability)); + NdisZeroMemory(&pAd->CommonCfg.HtCapability, + sizeof(pAd->CommonCfg.HtCapability)); pAd->HTCEnable = FALSE; pAd->bBroadComHT = FALSE; pAd->CommonCfg.bRdg = FALSE; - NdisZeroMemory(&pAd->CommonCfg.AddHTInfo, sizeof(pAd->CommonCfg.AddHTInfo)); + NdisZeroMemory(&pAd->CommonCfg.AddHTInfo, + sizeof(pAd->CommonCfg.AddHTInfo)); pAd->CommonCfg.BACapability.field.MMPSmode = MMPS_ENABLE; pAd->CommonCfg.BACapability.field.MpduDensity = 0; pAd->CommonCfg.BACapability.field.Policy = IMMED_BA; - pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64; //32; - pAd->CommonCfg.BACapability.field.TxBAWinLimit = 64; //32; - DBGPRINT(RT_DEBUG_TRACE, ("--> UserCfgInit. BACapability = 0x%x\n", pAd->CommonCfg.BACapability.word)); + pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64; //32; + pAd->CommonCfg.BACapability.field.TxBAWinLimit = 64; //32; + DBGPRINT(RT_DEBUG_TRACE, + ("--> UserCfgInit. BACapability = 0x%x\n", + pAd->CommonCfg.BACapability.word)); pAd->CommonCfg.BACapability.field.AutoBA = FALSE; BATableInit(pAd, &pAd->BATable); @@ -2677,16 +2620,15 @@ VOID UserCfgInit( pAd->CommonCfg.bHTProtect = 1; pAd->CommonCfg.bMIMOPSEnable = TRUE; //2008/11/05:KH add to support Antenna power-saving of AP<-- - pAd->CommonCfg.bGreenAPEnable=FALSE; + pAd->CommonCfg.bGreenAPEnable = FALSE; //2008/11/05:KH add to support Antenna power-saving of AP--> pAd->CommonCfg.bBADecline = FALSE; pAd->CommonCfg.bDisableReordering = FALSE; - if (pAd->MACVersion == 0x28720200) - { - pAd->CommonCfg.TxBASize = 13; //by Jerry recommend - }else{ - pAd->CommonCfg.TxBASize = 7; + if (pAd->MACVersion == 0x28720200) { + pAd->CommonCfg.TxBASize = 13; //by Jerry recommend + } else { + pAd->CommonCfg.TxBASize = 7; } pAd->CommonCfg.REGBACapability.word = pAd->CommonCfg.BACapability.word; @@ -2701,7 +2643,7 @@ VOID UserCfgInit( pAd->CommonCfg.MlmeTransmit.field.BW = BW_20; pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; - pAd->CommonCfg.BeaconPeriod = 100; // in mSec + pAd->CommonCfg.BeaconPeriod = 100; // in mSec // // part II. intialize STA specific configuration @@ -2724,18 +2666,19 @@ VOID UserCfgInit( pAd->StaCfg.PrivacyFilter = Ndis802_11PrivFilter8021xWEP; pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; pAd->StaCfg.LastMicErrorTime = 0; - pAd->StaCfg.MicErrCnt = 0; - pAd->StaCfg.bBlockAssoc = FALSE; - pAd->StaCfg.WpaState = SS_NOTUSE; + pAd->StaCfg.MicErrCnt = 0; + pAd->StaCfg.bBlockAssoc = FALSE; + pAd->StaCfg.WpaState = SS_NOTUSE; - pAd->CommonCfg.NdisRadioStateOff = FALSE; // New to support microsoft disable radio with OID command + pAd->CommonCfg.NdisRadioStateOff = FALSE; // New to support microsoft disable radio with OID command pAd->StaCfg.RssiTrigger = 0; NdisZeroMemory(&pAd->StaCfg.RssiSample, sizeof(RSSI_SAMPLE)); - pAd->StaCfg.RssiTriggerMode = RSSI_TRIGGERED_UPON_BELOW_THRESHOLD; + pAd->StaCfg.RssiTriggerMode = + RSSI_TRIGGERED_UPON_BELOW_THRESHOLD; pAd->StaCfg.AtimWin = 0; - pAd->StaCfg.DefaultListenCount = 3;//default listen count; - pAd->StaCfg.BssType = BSS_INFRA; // BSS_INFRA or BSS_ADHOC or BSS_MONITOR + pAd->StaCfg.DefaultListenCount = 3; //default listen count; + pAd->StaCfg.BssType = BSS_INFRA; // BSS_INFRA or BSS_ADHOC or BSS_MONITOR pAd->StaCfg.bScanReqIsFromWebUI = FALSE; OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_WAKEUP_NOW); @@ -2745,12 +2688,12 @@ VOID UserCfgInit( } #ifdef PCIE_PS_SUPPORT -pAd->brt30xxBanMcuCmd = FALSE; -pAd->b3090ESpecialChip = FALSE; + pAd->brt30xxBanMcuCmd = FALSE; + pAd->b3090ESpecialChip = FALSE; //KH Debug:the following must be removed -pAd->StaCfg.PSControl.field.rt30xxPowerMode=3; -pAd->StaCfg.PSControl.field.rt30xxForceASPMTest=0; -pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM=1; + pAd->StaCfg.PSControl.field.rt30xxPowerMode = 3; + pAd->StaCfg.PSControl.field.rt30xxForceASPMTest = 0; + pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM = 1; #endif // PCIE_PS_SUPPORT // // global variables mXXXX used in MAC protocol state machines @@ -2759,8 +2702,8 @@ pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM=1; OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_INFRA_ON); // PHY specification - pAd->CommonCfg.PhyMode = PHY_11BG_MIXED; // default PHY mode - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); // CCK use LONG preamble + pAd->CommonCfg.PhyMode = PHY_11BG_MIXED; // default PHY mode + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); // CCK use LONG preamble { // user desired power mode @@ -2768,17 +2711,19 @@ pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM=1; pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeCAM; pAd->StaCfg.bWindowsACCAMEnable = FALSE; - RTMPInitTimer(pAd, &pAd->StaCfg.StaQuickResponeForRateUpTimer, GET_TIMER_FUNCTION(StaQuickResponeForRateUpExec), pAd, FALSE); + RTMPInitTimer(pAd, &pAd->StaCfg.StaQuickResponeForRateUpTimer, + GET_TIMER_FUNCTION(StaQuickResponeForRateUpExec), + pAd, FALSE); pAd->StaCfg.StaQuickResponeForRateUpTimerRunning = FALSE; // Patch for Ndtest pAd->StaCfg.ScanCnt = 0; - pAd->StaCfg.bHwRadio = TRUE; // Default Hardware Radio status is On - pAd->StaCfg.bSwRadio = TRUE; // Default Software Radio status is On - pAd->StaCfg.bRadio = TRUE; // bHwRadio && bSwRadio - pAd->StaCfg.bHardwareRadio = FALSE; // Default is OFF - pAd->StaCfg.bShowHiddenSSID = FALSE; // Default no show + pAd->StaCfg.bHwRadio = TRUE; // Default Hardware Radio status is On + pAd->StaCfg.bSwRadio = TRUE; // Default Software Radio status is On + pAd->StaCfg.bRadio = TRUE; // bHwRadio && bSwRadio + pAd->StaCfg.bHardwareRadio = FALSE; // Default is OFF + pAd->StaCfg.bShowHiddenSSID = FALSE; // Default no show // Nitro mode control pAd->StaCfg.bAutoReconnect = TRUE; @@ -2789,14 +2734,16 @@ pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM=1; if (pAd->StaCfg.LastScanTime > 10 * OS_HZ) pAd->StaCfg.LastScanTime -= (10 * OS_HZ); - NdisZeroMemory(pAd->nickname, IW_ESSID_MAX_SIZE+1); + NdisZeroMemory(pAd->nickname, IW_ESSID_MAX_SIZE + 1); #ifdef RTMP_MAC_PCI sprintf((PSTRING) pAd->nickname, "RT2860STA"); #endif // RTMP_MAC_PCI // #ifdef RTMP_MAC_USB - sprintf((PSTRING) pAd->nickname, "RT2870STA"); + sprintf((PSTRING) pAd->nickname, "RT2870STA"); #endif // RTMP_MAC_USB // - RTMPInitTimer(pAd, &pAd->StaCfg.WpaDisassocAndBlockAssocTimer, GET_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc), pAd, FALSE); + RTMPInitTimer(pAd, &pAd->StaCfg.WpaDisassocAndBlockAssocTimer, + GET_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc), + pAd, FALSE); pAd->StaCfg.IEEE8021X = FALSE; pAd->StaCfg.IEEE8021x_required_keys = FALSE; pAd->StaCfg.WpaSupplicantUP = WPA_SUPPLICANT_DISABLE; @@ -2805,7 +2752,6 @@ pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM=1; NdisZeroMemory(pAd->StaCfg.ReplayCounter, 8); - pAd->StaCfg.bAutoConnectByBssid = FALSE; pAd->StaCfg.BeaconLostTime = BEACON_LOST_TIME; NdisZeroMemory(pAd->StaCfg.WpaPassPhrase, 64); @@ -2824,15 +2770,14 @@ pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM=1; // part III. AP configurations // - // // part IV. others // // dynamic BBP R66:sensibity tuning to overcome background noise - pAd->BbpTuning.bEnable = TRUE; + pAd->BbpTuning.bEnable = TRUE; pAd->BbpTuning.FalseCcaLowerThreshold = 100; pAd->BbpTuning.FalseCcaUpperThreshold = 512; - pAd->BbpTuning.R66Delta = 4; + pAd->BbpTuning.R66Delta = 4; pAd->Mlme.bEnableAutoAntennaCheck = TRUE; // @@ -2855,24 +2800,25 @@ pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM=1; //RTMPInitTimer(pAd, &pAd->RECBATimer, RECBATimerTimeout, pAd, TRUE); //RTMPSetTimer(&pAd->RECBATimer, REORDER_EXEC_INTV); - - pAd->CommonCfg.bWiFiTest = FALSE; #ifdef RTMP_MAC_PCI pAd->bPCIclkOff = FALSE; #endif // RTMP_MAC_PCI // -RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); + RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); DBGPRINT(RT_DEBUG_TRACE, ("<-- UserCfgInit\n")); } // IRQL = PASSIVE_LEVEL UCHAR BtoH(STRING ch) { - if (ch >= '0' && ch <= '9') return (ch - '0'); // Handle numerals - if (ch >= 'A' && ch <= 'F') return (ch - 'A' + 0xA); // Handle capitol hex digits - if (ch >= 'a' && ch <= 'f') return (ch - 'a' + 0xA); // Handle small hex digits - return(255); + if (ch >= '0' && ch <= '9') + return (ch - '0'); // Handle numerals + if (ch >= 'A' && ch <= 'F') + return (ch - 'A' + 0xA); // Handle capitol hex digits + if (ch >= 'a' && ch <= 'f') + return (ch - 'a' + 0xA); // Handle small hex digits + return (255); } // @@ -2900,19 +2846,16 @@ void AtoH(PSTRING src, PUCHAR dest, int destlen) srcptr = src; destTemp = (PUCHAR) dest; - while(destlen--) - { - *destTemp = BtoH(*srcptr++) << 4; // Put 1st ascii byte in upper nibble. - *destTemp += BtoH(*srcptr++); // Add 2nd ascii byte to above. + while (destlen--) { + *destTemp = BtoH(*srcptr++) << 4; // Put 1st ascii byte in upper nibble. + *destTemp += BtoH(*srcptr++); // Add 2nd ascii byte to above. destTemp++; } } - //+++Mark by shiang, not use now, need to remove after confirm //---Mark by shiang, not use now, need to remove after confirm - /* ======================================================================== @@ -2932,29 +2875,26 @@ void AtoH(PSTRING src, PUCHAR dest, int destlen) ======================================================================== */ -VOID RTMPInitTimer( - IN PRTMP_ADAPTER pAd, - IN PRALINK_TIMER_STRUCT pTimer, - IN PVOID pTimerFunc, - IN PVOID pData, - IN BOOLEAN Repeat) +VOID RTMPInitTimer(IN PRTMP_ADAPTER pAd, + IN PRALINK_TIMER_STRUCT pTimer, + IN PVOID pTimerFunc, IN PVOID pData, IN BOOLEAN Repeat) { // // Set Valid to TRUE for later used. // It will crash if we cancel a timer or set a timer // that we haven't initialize before. // - pTimer->Valid = TRUE; + pTimer->Valid = TRUE; pTimer->PeriodicType = Repeat; - pTimer->State = FALSE; + pTimer->State = FALSE; pTimer->cookie = (ULONG) pData; #ifdef RTMP_TIMER_TASK_SUPPORT pTimer->pAd = pAd; #endif // RTMP_TIMER_TASK_SUPPORT // - RTMP_OS_Init_Timer(pAd, &pTimer->TimerObj, pTimerFunc, (PVOID) pTimer); + RTMP_OS_Init_Timer(pAd, &pTimer->TimerObj, pTimerFunc, (PVOID) pTimer); } /* @@ -2975,32 +2915,23 @@ VOID RTMPInitTimer( ======================================================================== */ -VOID RTMPSetTimer( - IN PRALINK_TIMER_STRUCT pTimer, - IN ULONG Value) +VOID RTMPSetTimer(IN PRALINK_TIMER_STRUCT pTimer, IN ULONG Value) { - if (pTimer->Valid) - { + if (pTimer->Valid) { pTimer->TimerValue = Value; - pTimer->State = FALSE; - if (pTimer->PeriodicType == TRUE) - { + pTimer->State = FALSE; + if (pTimer->PeriodicType == TRUE) { pTimer->Repeat = TRUE; RTMP_SetPeriodicTimer(&pTimer->TimerObj, Value); - } - else - { + } else { pTimer->Repeat = FALSE; RTMP_OS_Add_Timer(&pTimer->TimerObj, Value); } - } - else - { + } else { DBGPRINT_ERR(("RTMPSetTimer failed, Timer hasn't been initialize!\n")); } } - /* ======================================================================== @@ -3019,28 +2950,20 @@ VOID RTMPSetTimer( ======================================================================== */ -VOID RTMPModTimer( - IN PRALINK_TIMER_STRUCT pTimer, - IN ULONG Value) +VOID RTMPModTimer(IN PRALINK_TIMER_STRUCT pTimer, IN ULONG Value) { - BOOLEAN Cancel; + BOOLEAN Cancel; - if (pTimer->Valid) - { + if (pTimer->Valid) { pTimer->TimerValue = Value; - pTimer->State = FALSE; - if (pTimer->PeriodicType == TRUE) - { + pTimer->State = FALSE; + if (pTimer->PeriodicType == TRUE) { RTMPCancelTimer(pTimer, &Cancel); RTMPSetTimer(pTimer, Value); - } - else - { + } else { RTMP_OS_Mod_Timer(&pTimer->TimerObj, Value); } - } - else - { + } else { DBGPRINT_ERR(("RTMPModTimer failed, Timer hasn't been initialize!\n")); } } @@ -3066,28 +2989,23 @@ VOID RTMPModTimer( ======================================================================== */ -VOID RTMPCancelTimer( - IN PRALINK_TIMER_STRUCT pTimer, - OUT BOOLEAN *pCancelled) +VOID RTMPCancelTimer(IN PRALINK_TIMER_STRUCT pTimer, OUT BOOLEAN * pCancelled) { - if (pTimer->Valid) - { + if (pTimer->Valid) { if (pTimer->State == FALSE) pTimer->Repeat = FALSE; - RTMP_OS_Del_Timer(&pTimer->TimerObj, pCancelled); + RTMP_OS_Del_Timer(&pTimer->TimerObj, pCancelled); if (*pCancelled == TRUE) pTimer->State = TRUE; #ifdef RTMP_TIMER_TASK_SUPPORT // We need to go-through the TimerQ to findout this timer handler and remove it if - // it's still waiting for execution. + // it's still waiting for execution. RtmpTimerQRemove(pTimer->pAd, pTimer); #endif // RTMP_TIMER_TASK_SUPPORT // - } - else - { + } else { DBGPRINT_ERR(("RTMPCancelTimer failed, Timer hasn't been initialize!\n")); } } @@ -3112,64 +3030,64 @@ VOID RTMPCancelTimer( ======================================================================== */ -VOID RTMPSetLED( - IN PRTMP_ADAPTER pAd, - IN UCHAR Status) +VOID RTMPSetLED(IN PRTMP_ADAPTER pAd, IN UCHAR Status) { - //ULONG data; - UCHAR HighByte = 0; - UCHAR LowByte; - - LowByte = pAd->LedCntl.field.LedMode&0x7f; - switch (Status) - { - case LED_LINK_DOWN: - HighByte = 0x20; - AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); - pAd->LedIndicatorStrength = 0; - break; - case LED_LINK_UP: - if (pAd->CommonCfg.Channel > 14) - HighByte = 0xa0; - else - HighByte = 0x60; - AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); - break; - case LED_RADIO_ON: - HighByte = 0x20; - AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); - break; - case LED_HALT: - LowByte = 0; // Driver sets MAC register and MAC controls LED - case LED_RADIO_OFF: - HighByte = 0; - AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); - break; - case LED_WPS: - HighByte = 0x10; - AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); - break; - case LED_ON_SITE_SURVEY: - HighByte = 0x08; - AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); - break; - case LED_POWER_UP: - HighByte = 0x04; - AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); - break; - default: - DBGPRINT(RT_DEBUG_WARN, ("RTMPSetLED::Unknown Status %d\n", Status)); - break; + //ULONG data; + UCHAR HighByte = 0; + UCHAR LowByte; + + LowByte = pAd->LedCntl.field.LedMode & 0x7f; + switch (Status) { + case LED_LINK_DOWN: + HighByte = 0x20; + AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); + pAd->LedIndicatorStrength = 0; + break; + case LED_LINK_UP: + if (pAd->CommonCfg.Channel > 14) + HighByte = 0xa0; + else + HighByte = 0x60; + AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); + break; + case LED_RADIO_ON: + HighByte = 0x20; + AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); + break; + case LED_HALT: + LowByte = 0; // Driver sets MAC register and MAC controls LED + case LED_RADIO_OFF: + HighByte = 0; + AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); + break; + case LED_WPS: + HighByte = 0x10; + AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); + break; + case LED_ON_SITE_SURVEY: + HighByte = 0x08; + AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); + break; + case LED_POWER_UP: + HighByte = 0x04; + AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); + break; + default: + DBGPRINT(RT_DEBUG_WARN, + ("RTMPSetLED::Unknown Status %d\n", Status)); + break; } - // + // // Keep LED status for LED SiteSurvey mode. // After SiteSurvey, we will set the LED mode to previous status. // if ((Status != LED_ON_SITE_SURVEY) && (Status != LED_POWER_UP)) pAd->LedStatus = Status; - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetLED::Mode=%d,HighByte=0x%02x,LowByte=0x%02x\n", pAd->LedCntl.field.LedMode, HighByte, LowByte)); + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPSetLED::Mode=%d,HighByte=0x%02x,LowByte=0x%02x\n", + pAd->LedCntl.field.LedMode, HighByte, LowByte)); } /* @@ -3199,35 +3117,32 @@ VOID RTMPSetLED( > -57 Excellent ======================================================================== */ -VOID RTMPSetSignalLED( - IN PRTMP_ADAPTER pAd, - IN NDIS_802_11_RSSI Dbm) +VOID RTMPSetSignalLED(IN PRTMP_ADAPTER pAd, IN NDIS_802_11_RSSI Dbm) { - UCHAR nLed = 0; - - if (pAd->LedCntl.field.LedMode == LED_MODE_SIGNAL_STREGTH) - { - if (Dbm <= -90) - nLed = 0; - else if (Dbm <= -81) - nLed = 1; - else if (Dbm <= -71) - nLed = 3; - else if (Dbm <= -67) - nLed = 7; - else if (Dbm <= -57) - nLed = 15; - else - nLed = 31; + UCHAR nLed = 0; + + if (pAd->LedCntl.field.LedMode == LED_MODE_SIGNAL_STREGTH) { + if (Dbm <= -90) + nLed = 0; + else if (Dbm <= -81) + nLed = 1; + else if (Dbm <= -71) + nLed = 3; + else if (Dbm <= -67) + nLed = 7; + else if (Dbm <= -57) + nLed = 15; + else + nLed = 31; - // - // Update Signal Stregth to firmware if changed. - // - if (pAd->LedIndicatorStrength != nLed) - { - AsicSendCommandToMcu(pAd, 0x51, 0xff, nLed, pAd->LedCntl.field.Polarity); - pAd->LedIndicatorStrength = nLed; - } + // + // Update Signal Stregth to firmware if changed. + // + if (pAd->LedIndicatorStrength != nLed) { + AsicSendCommandToMcu(pAd, 0x51, 0xff, nLed, + pAd->LedCntl.field.Polarity); + pAd->LedIndicatorStrength = nLed; + } } } @@ -3249,11 +3164,10 @@ VOID RTMPSetSignalLED( Before Enable RX, make sure you have enabled Interrupt. ======================================================================== */ -VOID RTMPEnableRxTx( - IN PRTMP_ADAPTER pAd) +VOID RTMPEnableRxTx(IN PRTMP_ADAPTER pAd) { -// WPDMA_GLO_CFG_STRUC GloCfg; -// ULONG i = 0; +// WPDMA_GLO_CFG_STRUC GloCfg; +// ULONG i = 0; UINT32 rx_filter_flag; DBGPRINT(RT_DEBUG_TRACE, ("==> RTMPEnableRxTx\n")); @@ -3262,19 +3176,15 @@ VOID RTMPEnableRxTx( RT28XXDMAEnable(pAd); // enable RX of MAC block - if (pAd->OpMode == OPMODE_AP) - { + if (pAd->OpMode == OPMODE_AP) { rx_filter_flag = APNORMAL; - - RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, rx_filter_flag); // enable RX of DMA block - } - else - { + RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, rx_filter_flag); // enable RX of DMA block + } else { if (pAd->CommonCfg.PSPXlink) rx_filter_flag = PSPXLINK; else - rx_filter_flag = STANORMAL; // Staion not drop control frame will fail WiFi Certification. + rx_filter_flag = STANORMAL; // Staion not drop control frame will fail WiFi Certification. RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, rx_filter_flag); } @@ -3282,43 +3192,37 @@ VOID RTMPEnableRxTx( DBGPRINT(RT_DEBUG_TRACE, ("<== RTMPEnableRxTx\n")); } - //+++Add by shiang, move from os/linux/rt_main_dev.c void CfgInitHook(PRTMP_ADAPTER pAd) { pAd->bBroadComHT = TRUE; } - -int rt28xx_init( - IN PRTMP_ADAPTER pAd, - IN PSTRING pDefaultMac, - IN PSTRING pHostName) +int rt28xx_init(IN PRTMP_ADAPTER pAd, + IN PSTRING pDefaultMac, IN PSTRING pHostName) { - UINT index; - UCHAR TmpPhy; - NDIS_STATUS Status; - UINT32 MacCsr0 = 0; - + UINT index; + UCHAR TmpPhy; + NDIS_STATUS Status; + UINT32 MacCsr0 = 0; #ifdef RTMP_MAC_PCI { - // If dirver doesn't wake up firmware here, - // NICLoadFirmware will hang forever when interface is up again. - // RT2860 PCI - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) && - OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - AUTO_WAKEUP_STRUC AutoWakeupCfg; + // If dirver doesn't wake up firmware here, + // NICLoadFirmware will hang forever when interface is up again. + // RT2860 PCI + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) && + OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { + AUTO_WAKEUP_STRUC AutoWakeupCfg; AsicForceWakeup(pAd, TRUE); - AutoWakeupCfg.word = 0; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); - } + AutoWakeupCfg.word = 0; + RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, + AutoWakeupCfg.word); + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); + } } #endif // RTMP_MAC_PCI // - // reset Adapter flags RTMP_CLEAR_FLAGS(pAd); @@ -3329,23 +3233,24 @@ int rt28xx_init( // Make sure MAC gets ready. index = 0; - do - { + do { RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0); pAd->MACVersion = MacCsr0; - if ((pAd->MACVersion != 0x00) && (pAd->MACVersion != 0xFFFFFFFF)) + if ((pAd->MACVersion != 0x00) + && (pAd->MACVersion != 0xFFFFFFFF)) break; RTMPusecDelay(10); } while (index++ < 100); - DBGPRINT(RT_DEBUG_TRACE, ("MAC_CSR0 [ Ver:Rev=0x%08x]\n", pAd->MACVersion)); + DBGPRINT(RT_DEBUG_TRACE, + ("MAC_CSR0 [ Ver:Rev=0x%08x]\n", pAd->MACVersion)); #ifdef RTMP_MAC_PCI #ifdef PCIE_PS_SUPPORT /*Iverson patch PCIE L1 issue to make sure that driver can be read,write ,BBP and RF register at pcie L.1 level */ - if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))&&OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { + if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) + && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { RTMP_IO_READ32(pAd, AUX_CTRL, &MacCsr0); MacCsr0 |= 0x402; RTMP_IO_WRITE32(pAd, AUX_CTRL, MacCsr0); @@ -3360,12 +3265,11 @@ int rt28xx_init( // Disable DMA RT28XXDMADisable(pAd); - // Load 8051 firmware Status = NICLoadFirmware(pAd); - if (Status != NDIS_STATUS_SUCCESS) - { - DBGPRINT_ERR(("NICLoadFirmware failed, Status[=0x%08x]\n", Status)); + if (Status != NDIS_STATUS_SUCCESS) { + DBGPRINT_ERR(("NICLoadFirmware failed, Status[=0x%08x]\n", + Status)); goto err1; } @@ -3374,16 +3278,15 @@ int rt28xx_init( // Disable interrupts here which is as soon as possible // This statement should never be true. We might consider to remove it later #ifdef RTMP_MAC_PCI - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) - { + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) { RTMP_ASIC_INTERRUPT_DISABLE(pAd); } #endif // RTMP_MAC_PCI // Status = RTMPAllocTxRxRingMemory(pAd); - if (Status != NDIS_STATUS_SUCCESS) - { - DBGPRINT_ERR(("RTMPAllocDMAMemory failed, Status[=0x%08x]\n", Status)); + if (Status != NDIS_STATUS_SUCCESS) { + DBGPRINT_ERR(("RTMPAllocDMAMemory failed, Status[=0x%08x]\n", + Status)); goto err1; } @@ -3397,12 +3300,10 @@ int rt28xx_init( goto err2; Status = MlmeInit(pAd); - if (Status != NDIS_STATUS_SUCCESS) - { + if (Status != NDIS_STATUS_SUCCESS) { DBGPRINT_ERR(("MlmeInit failed, Status[=0x%08x]\n", Status)); goto err2; } - // Initialize pAd->StaCfg, pAd->ApCfg, pAd->CommonCfg to manufacture default // UserCfgInit(pAd); @@ -3410,12 +3311,12 @@ int rt28xx_init( if (Status != NDIS_STATUS_SUCCESS) goto err3; -// COPY_MAC_ADDR(pAd->ApCfg.MBSSID[apidx].Bssid, netif->hwaddr); -// pAd->bForcePrintTX = TRUE; +// COPY_MAC_ADDR(pAd->ApCfg.MBSSID[apidx].Bssid, netif->hwaddr); +// pAd->bForcePrintTX = TRUE; CfgInitHook(pAd); - NdisAllocateSpinLock(&pAd->MacTabLock); + NdisAllocateSpinLock(&pAd->MacTabLock); MeasureReqTabInit(pAd); TpcReqTabInit(pAd); @@ -3424,11 +3325,11 @@ int rt28xx_init( // Init the hardware, we need to init asic before read registry, otherwise mac register will be reset // Status = NICInitializeAdapter(pAd, TRUE); - if (Status != NDIS_STATUS_SUCCESS) - { - DBGPRINT_ERR(("NICInitializeAdapter failed, Status[=0x%08x]\n", Status)); + if (Status != NDIS_STATUS_SUCCESS) { + DBGPRINT_ERR(("NICInitializeAdapter failed, Status[=0x%08x]\n", + Status)); if (Status != NDIS_STATUS_SUCCESS) - goto err3; + goto err3; } DBGPRINT(RT_DEBUG_OFF, ("1. Phy Mode = %d\n", pAd->CommonCfg.PhyMode)); @@ -3443,15 +3344,22 @@ int rt28xx_init( #endif // RTMP_MAC_USB // //Init Ba Capability parameters. -// RT28XX_BA_INIT(pAd); - pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity; - pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable; - pAd->CommonCfg.DesiredHtPhy.AmsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize; - pAd->CommonCfg.DesiredHtPhy.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode; +// RT28XX_BA_INIT(pAd); + pAd->CommonCfg.DesiredHtPhy.MpduDensity = + (UCHAR) pAd->CommonCfg.BACapability.field.MpduDensity; + pAd->CommonCfg.DesiredHtPhy.AmsduEnable = + (USHORT) pAd->CommonCfg.BACapability.field.AmsduEnable; + pAd->CommonCfg.DesiredHtPhy.AmsduSize = + (USHORT) pAd->CommonCfg.BACapability.field.AmsduSize; + pAd->CommonCfg.DesiredHtPhy.MimoPs = + (USHORT) pAd->CommonCfg.BACapability.field.MMPSmode; // UPdata to HT IE - pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode; - pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize; - pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity; + pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = + (USHORT) pAd->CommonCfg.BACapability.field.MMPSmode; + pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = + (USHORT) pAd->CommonCfg.BACapability.field.AmsduSize; + pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = + (UCHAR) pAd->CommonCfg.BACapability.field.MpduDensity; // after reading Registry, we now know if in AP mode or STA mode @@ -3463,11 +3371,11 @@ int rt28xx_init( DBGPRINT(RT_DEBUG_OFF, ("2. Phy Mode = %d\n", pAd->CommonCfg.PhyMode)); // We should read EEPROM for all cases. rt2860b - NICReadEEPROMParameters(pAd, (PUCHAR)pDefaultMac); + NICReadEEPROMParameters(pAd, (PUCHAR) pDefaultMac); DBGPRINT(RT_DEBUG_OFF, ("3. Phy Mode = %d\n", pAd->CommonCfg.PhyMode)); - NICInitAsicFromEEPROM(pAd); //rt2860b + NICInitAsicFromEEPROM(pAd); //rt2860b // Set PHY to appropriate mode TmpPhy = pAd->CommonCfg.PhyMode; @@ -3476,25 +3384,28 @@ int rt28xx_init( SetCommonHT(pAd); // No valid channels. - if (pAd->ChannelListNum == 0) - { - DBGPRINT(RT_DEBUG_ERROR, ("Wrong configuration. No valid channel found. Check \"ContryCode\" and \"ChannelGeography\" setting.\n")); + if (pAd->ChannelListNum == 0) { + DBGPRINT(RT_DEBUG_ERROR, + ("Wrong configuration. No valid channel found. Check \"ContryCode\" and \"ChannelGeography\" setting.\n")); goto err4; } - DBGPRINT(RT_DEBUG_OFF, ("MCS Set = %02x %02x %02x %02x %02x\n", pAd->CommonCfg.HtCapability.MCSSet[0], - pAd->CommonCfg.HtCapability.MCSSet[1], pAd->CommonCfg.HtCapability.MCSSet[2], - pAd->CommonCfg.HtCapability.MCSSet[3], pAd->CommonCfg.HtCapability.MCSSet[4])); + DBGPRINT(RT_DEBUG_OFF, + ("MCS Set = %02x %02x %02x %02x %02x\n", + pAd->CommonCfg.HtCapability.MCSSet[0], + pAd->CommonCfg.HtCapability.MCSSet[1], + pAd->CommonCfg.HtCapability.MCSSet[2], + pAd->CommonCfg.HtCapability.MCSSet[3], + pAd->CommonCfg.HtCapability.MCSSet[4])); #ifdef RTMP_RF_RW_SUPPORT //Init RT30xx RFRegisters after read RFIC type from EEPROM NICInitRFRegisters(pAd); #endif // RTMP_RF_RW_SUPPORT // -// APInitialize(pAd); - +// APInitialize(pAd); - // + // // Initialize RF register to default value // AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); @@ -3504,26 +3415,23 @@ int rt28xx_init( //2008/11/28:KH marked the following codes to patch Frequency offset bug //AsicSendCommandToMcu(pAd, 0x72, 0xFF, 0x00, 0x00); - if (pAd && (Status != NDIS_STATUS_SUCCESS)) - { + if (pAd && (Status != NDIS_STATUS_SUCCESS)) { // // Undo everything if it failed // - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { -// NdisMDeregisterInterrupt(&pAd->Interrupt); + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { +// NdisMDeregisterInterrupt(&pAd->Interrupt); RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE); } -// RTMPFreeAdapter(pAd); // we will free it in disconnect() - } - else if (pAd) - { +// RTMPFreeAdapter(pAd); // we will free it in disconnect() + } else if (pAd) { // Microsoft HCT require driver send a disconnect event after driver initialization. OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); -// pAd->IndicateMediaState = NdisMediaStateDisconnected; +// pAd->IndicateMediaState = NdisMediaStateDisconnected; RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_MEDIA_STATE_CHANGE); - DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_DISCONNECT Event B!\n")); + DBGPRINT(RT_DEBUG_TRACE, + ("NDIS_STATUS_MEDIA_DISCONNECT Event B!\n")); #ifdef RTMP_MAC_USB RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS); @@ -3533,14 +3441,12 @@ int rt28xx_init( // Support multiple BulkIn IRP, // the value on pAd->CommonCfg.NumOfBulkInIRP may be large than 1. // - for(index=0; indexCommonCfg.NumOfBulkInIRP; index++) - { + for (index = 0; index < pAd->CommonCfg.NumOfBulkInIRP; index++) { RTUSBBulkReceive(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("RTUSBBulkReceive!\n" )); + DBGPRINT(RT_DEBUG_TRACE, ("RTUSBBulkReceive!\n")); } #endif // RTMP_MAC_USB // - }// end of else - + } // end of else // Set up the Mac address RtmpOSNetDevAddrSet(pAd->net_dev, &pAd->CurrentAddress[0]); @@ -3549,7 +3455,6 @@ int rt28xx_init( return TRUE; - err4: err3: MlmeHalt(pAd); @@ -3557,7 +3462,7 @@ err2: RTMPFreeTxRxRingMemory(pAd); err1: - os_free_mem(pAd, pAd->mpdu_blk_pool.mem); // free BA pool + os_free_mem(pAd, pAd->mpdu_blk_pool.mem); // free BA pool // shall not set priv to NULL here because the priv didn't been free yet. //net_dev->ml_priv = 0; @@ -3568,14 +3473,12 @@ err0: DBGPRINT(RT_DEBUG_ERROR, ("!!! rt28xx Initialized fail !!!\n")); return FALSE; } -//---Add by shiang, move from os/linux/rt_main_dev.c +//---Add by shiang, move from os/linux/rt_main_dev.c -static INT RtmpChipOpsRegister( - IN RTMP_ADAPTER *pAd, - IN INT infType) +static INT RtmpChipOpsRegister(IN RTMP_ADAPTER * pAd, IN INT infType) { - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + RTMP_CHIP_OP *pChipOps = &pAd->chipOps; int status; memset(pChipOps, 0, sizeof(RTMP_CHIP_OP)); @@ -3584,74 +3487,64 @@ static INT RtmpChipOpsRegister( status = RtmpChipOpsEepromHook(pAd, infType); /* set mcu related hook functions */ - switch(infType) - { + switch (infType) { #ifdef RTMP_PCI_SUPPORT - case RTMP_DEV_INF_PCI: - pChipOps->loadFirmware = RtmpAsicLoadFirmware; - pChipOps->eraseFirmware = RtmpAsicEraseFirmware; - pChipOps->sendCommandToMcu = RtmpAsicSendCommandToMcu; - break; + case RTMP_DEV_INF_PCI: + pChipOps->loadFirmware = RtmpAsicLoadFirmware; + pChipOps->eraseFirmware = RtmpAsicEraseFirmware; + pChipOps->sendCommandToMcu = RtmpAsicSendCommandToMcu; + break; #endif // RTMP_PCI_SUPPORT // #ifdef RTMP_USB_SUPPORT - case RTMP_DEV_INF_USB: - pChipOps->loadFirmware = RtmpAsicLoadFirmware; - pChipOps->sendCommandToMcu = RtmpAsicSendCommandToMcu; - break; + case RTMP_DEV_INF_USB: + pChipOps->loadFirmware = RtmpAsicLoadFirmware; + pChipOps->sendCommandToMcu = RtmpAsicSendCommandToMcu; + break; #endif // RTMP_USB_SUPPORT // - default: - break; + default: + break; } return status; } - -INT RtmpRaDevCtrlInit( - IN RTMP_ADAPTER *pAd, - IN RTMP_INF_TYPE infType) +INT RtmpRaDevCtrlInit(IN RTMP_ADAPTER * pAd, IN RTMP_INF_TYPE infType) { - //VOID *handle; + //VOID *handle; // Assign the interface type. We need use it when do register/EEPROM access. pAd->infType = infType; - pAd->OpMode = OPMODE_STA; - DBGPRINT(RT_DEBUG_TRACE, ("STA Driver version-%s\n", STA_DRIVER_VERSION)); + DBGPRINT(RT_DEBUG_TRACE, + ("STA Driver version-%s\n", STA_DRIVER_VERSION)); #ifdef RTMP_MAC_USB init_MUTEX(&(pAd->UsbVendorReq_semaphore)); - os_alloc_mem(pAd, (PUCHAR *)&pAd->UsbVendorReqBuf, + os_alloc_mem(pAd, (PUCHAR *) & pAd->UsbVendorReqBuf, MAX_PARAM_BUFFER_SIZE - 1); - if (pAd->UsbVendorReqBuf == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("Allocate vendor request temp buffer failed!\n")); + if (pAd->UsbVendorReqBuf == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("Allocate vendor request temp buffer failed!\n")); return FALSE; } #endif // RTMP_MAC_USB // RtmpChipOpsRegister(pAd, infType); - return 0; } - -BOOLEAN RtmpRaDevCtrlExit(IN RTMP_ADAPTER *pAd) +BOOLEAN RtmpRaDevCtrlExit(IN RTMP_ADAPTER * pAd) { - RTMPFreeAdapter(pAd); return TRUE; } - // not yet support MBSS -PNET_DEV get_netdev_from_bssid( - IN PRTMP_ADAPTER pAd, - IN UCHAR FromWhichBSSID) +PNET_DEV get_netdev_from_bssid(IN PRTMP_ADAPTER pAd, IN UCHAR FromWhichBSSID) { PNET_DEV dev_p = NULL; @@ -3660,5 +3553,5 @@ PNET_DEV get_netdev_from_bssid( } ASSERT(dev_p); - return dev_p; /* return one of MBSS */ + return dev_p; /* return one of MBSS */ } diff --git a/drivers/staging/rt2860/common/rtmp_mcu.c b/drivers/staging/rt2860/common/rtmp_mcu.c index e5d19020ef7a..d962f02599ef 100644 --- a/drivers/staging/rt2860/common/rtmp_mcu.c +++ b/drivers/staging/rt2860/common/rtmp_mcu.c @@ -35,7 +35,6 @@ -------- ---------- ---------------------------------------------- */ - #include "../rt_config.h" #if defined(RT2860) || defined(RT3090) @@ -83,12 +82,11 @@ ======================================================================== */ -INT RtmpAsicEraseFirmware( - IN PRTMP_ADAPTER pAd) +INT RtmpAsicEraseFirmware(IN PRTMP_ADAPTER pAd) { ULONG i; - for(i=0; iMACVersion >> 16); + UINT32 Version = (pAd->MACVersion >> 16); #endif // New 8k byte firmware size for RT3071/RT3072 @@ -136,14 +133,13 @@ NDIS_STATUS RtmpAsicLoadFirmware( #endif // RTMP_MAC_PCI // #ifdef RTMP_MAC_USB /* the firmware image consists of two parts */ - if ((Version != 0x2860) && (Version != 0x2872) && (Version != 0x3070)) - { /* use the second part */ + if ((Version != 0x2860) && (Version != 0x2872) && (Version != 0x3070)) { /* use the second part */ //printk("KH:Use New Version,part2\n"); - pFirmwareImage = (PUCHAR)&FirmwareImage_3070[FIRMWAREIMAGEV1_LENGTH]; + pFirmwareImage = + (PUCHAR) & + FirmwareImage_3070[FIRMWAREIMAGEV1_LENGTH]; FileLength = FIRMWAREIMAGEV2_LENGTH; - } - else - { + } else { //printk("KH:Use New Version,part1\n"); if (Version == 0x3070) pFirmwareImage = FirmwareImage_3070; @@ -156,11 +152,9 @@ NDIS_STATUS RtmpAsicLoadFirmware( RTMP_WRITE_FIRMWARE(pAd, pFirmwareImage, FileLength); - /* check if MCU is ready */ Index = 0; - do - { + do { RTMP_IO_READ32(pAd, PBF_SYS_CTRL, &MacReg); if (MacReg & 0x80) @@ -169,138 +163,124 @@ NDIS_STATUS RtmpAsicLoadFirmware( RTMPusecDelay(1000); } while (Index++ < 1000); - if (Index > 1000) - { - DBGPRINT(RT_DEBUG_ERROR, ("NICLoadFirmware: MCU is not ready\n\n\n")); + if (Index > 1000) { + DBGPRINT(RT_DEBUG_ERROR, + ("NICLoadFirmware: MCU is not ready\n\n\n")); Status = NDIS_STATUS_FAILURE; } - DBGPRINT(RT_DEBUG_TRACE, ("<=== %s (status=%d)\n", __func__, Status)); + DBGPRINT(RT_DEBUG_TRACE, ("<=== %s (status=%d)\n", __func__, Status)); - return Status; + return Status; } - -INT RtmpAsicSendCommandToMcu( - IN PRTMP_ADAPTER pAd, - IN UCHAR Command, - IN UCHAR Token, - IN UCHAR Arg0, - IN UCHAR Arg1) +INT RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, + IN UCHAR Command, + IN UCHAR Token, IN UCHAR Arg0, IN UCHAR Arg1) { - HOST_CMD_CSR_STRUC H2MCmd; - H2M_MAILBOX_STRUC H2MMailbox; - ULONG i = 0; + HOST_CMD_CSR_STRUC H2MCmd; + H2M_MAILBOX_STRUC H2MMailbox; + ULONG i = 0; #ifdef PCIE_PS_SUPPORT // 3090F power solution 3 has hw limitation that needs to ban all mcu command // when firmware is in radio state. For other chip doesn't have this limitation. - if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) - { + if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) + && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)) { RTMP_SEM_LOCK(&pAd->McuCmdLock); if ((pAd->brt30xxBanMcuCmd == TRUE) - && (Command != WAKE_MCU_CMD) && (Command != RFOFF_MCU_CMD)) - { + && (Command != WAKE_MCU_CMD) && (Command != RFOFF_MCU_CMD)) { RTMP_SEM_UNLOCK(&pAd->McuCmdLock); - DBGPRINT(RT_DEBUG_TRACE, (" Ban Mcu Cmd %x in sleep mode\n", Command)); + DBGPRINT(RT_DEBUG_TRACE, + (" Ban Mcu Cmd %x in sleep mode\n", Command)); return FALSE; - } - else if ((Command == SLEEP_MCU_CMD) - ||(Command == RFOFF_MCU_CMD)) - { + } else if ((Command == SLEEP_MCU_CMD) + || (Command == RFOFF_MCU_CMD)) { pAd->brt30xxBanMcuCmd = TRUE; - } - else if (Command != WAKE_MCU_CMD) - { + } else if (Command != WAKE_MCU_CMD) { pAd->brt30xxBanMcuCmd = FALSE; } RTMP_SEM_UNLOCK(&pAd->McuCmdLock); } - if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - && (Command == WAKE_MCU_CMD)) - { - - do - { - RTMP_IO_FORCE_READ32(pAd, H2M_MAILBOX_CSR, &H2MMailbox.word); + if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) + && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) + && (Command == WAKE_MCU_CMD)) { + + do { + RTMP_IO_FORCE_READ32(pAd, H2M_MAILBOX_CSR, + &H2MMailbox.word); if (H2MMailbox.field.Owner == 0) break; RTMPusecDelay(2); - DBGPRINT(RT_DEBUG_INFO, ("AsicSendCommanToMcu::Mail box is busy\n")); - } while(i++ < 100); + DBGPRINT(RT_DEBUG_INFO, + ("AsicSendCommanToMcu::Mail box is busy\n")); + } while (i++ < 100); - if (i >= 100) - { + if (i >= 100) { DBGPRINT_ERR(("H2M_MAILBOX still hold by MCU. command fail\n")); return FALSE; } - H2MMailbox.field.Owner = 1; // pass ownership to MCU + H2MMailbox.field.Owner = 1; // pass ownership to MCU H2MMailbox.field.CmdToken = Token; H2MMailbox.field.HighByte = Arg1; - H2MMailbox.field.LowByte = Arg0; + H2MMailbox.field.LowByte = Arg0; RTMP_IO_FORCE_WRITE32(pAd, H2M_MAILBOX_CSR, H2MMailbox.word); - H2MCmd.word = 0; - H2MCmd.field.HostCommand = Command; + H2MCmd.word = 0; + H2MCmd.field.HostCommand = Command; RTMP_IO_FORCE_WRITE32(pAd, HOST_CMD_CSR, H2MCmd.word); - - } - else + } else #endif // PCIE_PS_SUPPORT // { - do - { - RTMP_IO_READ32(pAd, H2M_MAILBOX_CSR, &H2MMailbox.word); - if (H2MMailbox.field.Owner == 0) - break; + do { + RTMP_IO_READ32(pAd, H2M_MAILBOX_CSR, &H2MMailbox.word); + if (H2MMailbox.field.Owner == 0) + break; - RTMPusecDelay(2); - } while(i++ < 100); + RTMPusecDelay(2); + } while (i++ < 100); - if (i > 100) - { + if (i > 100) { #ifdef RTMP_MAC_PCI #endif // RTMP_MAC_PCI // - { - DBGPRINT_ERR(("H2M_MAILBOX still hold by MCU. command fail\n")); + { + DBGPRINT_ERR(("H2M_MAILBOX still hold by MCU. command fail\n")); + } + return FALSE; } - return FALSE; - } - #ifdef RTMP_MAC_PCI #endif // RTMP_MAC_PCI // - H2MMailbox.field.Owner = 1; // pass ownership to MCU - H2MMailbox.field.CmdToken = Token; - H2MMailbox.field.HighByte = Arg1; - H2MMailbox.field.LowByte = Arg0; - RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CSR, H2MMailbox.word); + H2MMailbox.field.Owner = 1; // pass ownership to MCU + H2MMailbox.field.CmdToken = Token; + H2MMailbox.field.HighByte = Arg1; + H2MMailbox.field.LowByte = Arg0; + RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CSR, H2MMailbox.word); - H2MCmd.word = 0; - H2MCmd.field.HostCommand = Command; - RTMP_IO_WRITE32(pAd, HOST_CMD_CSR, H2MCmd.word); + H2MCmd.word = 0; + H2MCmd.field.HostCommand = Command; + RTMP_IO_WRITE32(pAd, HOST_CMD_CSR, H2MCmd.word); - if (Command != 0x80) - { + if (Command != 0x80) { + } } -} #ifdef PCIE_PS_SUPPORT // 3090 MCU Wakeup command needs more time to be stable. // Before stable, don't issue other MCU command to prevent from firmware error. - if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) - && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) - && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) - && (Command == WAKE_MCU_CMD)) - { + if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) + && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) + && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) + && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) + && (Command == WAKE_MCU_CMD)) { RTMPusecDelay(2000); //Put this is after RF programming. //NdisAcquireSpinLock(&pAd->McuCmdLock); diff --git a/drivers/staging/rt2860/common/rtmp_timer.c b/drivers/staging/rt2860/common/rtmp_timer.c index fa77f5d26c73..9abfe631c124 100644 --- a/drivers/staging/rt2860/common/rtmp_timer.c +++ b/drivers/staging/rt2860/common/rtmp_timer.c @@ -40,7 +40,6 @@ #include "../rt_config.h" - BUILD_TIMER_FUNCTION(MlmePeriodicExec); //BUILD_TIMER_FUNCTION(MlmeRssiReportExec); BUILD_TIMER_FUNCTION(AsicRxAntEvalTimeout); @@ -68,30 +67,25 @@ BUILD_TIMER_FUNCTION(RtmpUsbStaAsicForceWakeupTimeout); #endif // RTMP_MAC_USB // #if defined(AP_LED) || defined(STA_LED) -extern void LedCtrlMain( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); +extern void LedCtrlMain(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); BUILD_TIMER_FUNCTION(LedCtrlMain); #endif - #ifdef RTMP_TIMER_TASK_SUPPORT -static void RtmpTimerQHandle(RTMP_ADAPTER *pAd) +static void RtmpTimerQHandle(RTMP_ADAPTER * pAd) { #ifndef KTHREAD_SUPPORT int status; #endif - RALINK_TIMER_STRUCT *pTimer; - RTMP_TIMER_TASK_ENTRY *pEntry; - unsigned long irqFlag; + RALINK_TIMER_STRUCT *pTimer; + RTMP_TIMER_TASK_ENTRY *pEntry; + unsigned long irqFlag; RTMP_OS_TASK *pTask; - pTask = &pAd->timerTask; - while(!pTask->task_killed) - { + while (!pTask->task_killed) { pTimer = NULL; #ifdef KTHREAD_SUPPORT @@ -104,12 +98,10 @@ static void RtmpTimerQHandle(RTMP_ADAPTER *pAd) break; // event happened. - while(pAd->TimerQ.pQHead) - { + while (pAd->TimerQ.pQHead) { RTMP_INT_LOCK(&pAd->TimerQLock, irqFlag); pEntry = pAd->TimerQ.pQHead; - if (pEntry) - { + if (pEntry) { pTimer = pEntry->pRaTimer; // update pQHead @@ -123,18 +115,21 @@ static void RtmpTimerQHandle(RTMP_ADAPTER *pAd) } RTMP_INT_UNLOCK(&pAd->TimerQLock, irqFlag); - if (pTimer) - { - if ((pTimer->handle != NULL) && (!pAd->PM_FlgSuspend)) - pTimer->handle(NULL, (PVOID) pTimer->cookie, NULL, pTimer); - if ((pTimer->Repeat) && (pTimer->State == FALSE)) - RTMP_OS_Add_Timer(&pTimer->TimerObj, pTimer->TimerValue); + if (pTimer) { + if ((pTimer->handle != NULL) + && (!pAd->PM_FlgSuspend)) + pTimer->handle(NULL, + (PVOID) pTimer->cookie, + NULL, pTimer); + if ((pTimer->Repeat) + && (pTimer->State == FALSE)) + RTMP_OS_Add_Timer(&pTimer->TimerObj, + pTimer->TimerValue); } } #ifndef KTHREAD_SUPPORT - if (status != 0) - { + if (status != 0) { pAd->TimerQ.status = RTMP_TASK_STAT_STOPED; RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); break; @@ -143,22 +138,19 @@ static void RtmpTimerQHandle(RTMP_ADAPTER *pAd) } } - -INT RtmpTimerQThread( - IN OUT PVOID Context) +INT RtmpTimerQThread(IN OUT PVOID Context) { - RTMP_OS_TASK *pTask; - PRTMP_ADAPTER pAd; - + RTMP_OS_TASK *pTask; + PRTMP_ADAPTER pAd; - pTask = (RTMP_OS_TASK *)Context; - pAd = (PRTMP_ADAPTER)pTask->priv; + pTask = (RTMP_OS_TASK *) Context; + pAd = (PRTMP_ADAPTER) pTask->priv; RtmpOSTaskCustomize(pTask); RtmpTimerQHandle(pAd); - DBGPRINT(RT_DEBUG_TRACE,( "<---%s\n",__func__)); + DBGPRINT(RT_DEBUG_TRACE, ("<---%s\n", __func__)); #ifndef KTHREAD_SUPPORT pTask->taskPID = THREAD_PID_INIT_VALUE; #endif @@ -182,20 +174,16 @@ INT RtmpTimerQThread( } - -RTMP_TIMER_TASK_ENTRY *RtmpTimerQInsert( - IN RTMP_ADAPTER *pAd, - IN RALINK_TIMER_STRUCT *pTimer) +RTMP_TIMER_TASK_ENTRY *RtmpTimerQInsert(IN RTMP_ADAPTER * pAd, + IN RALINK_TIMER_STRUCT * pTimer) { RTMP_TIMER_TASK_ENTRY *pQNode = NULL, *pQTail; unsigned long irqFlags; - RTMP_OS_TASK *pTask = &pAd->timerTask; + RTMP_OS_TASK *pTask = &pAd->timerTask; RTMP_INT_LOCK(&pAd->TimerQLock, irqFlags); - if (pAd->TimerQ.status & RTMP_TASK_CAN_DO_INSERT) - { - if(pAd->TimerQ.pQPollFreeList) - { + if (pAd->TimerQ.status & RTMP_TASK_CAN_DO_INSERT) { + if (pAd->TimerQ.pQPollFreeList) { pQNode = pAd->TimerQ.pQPollFreeList; pAd->TimerQ.pQPollFreeList = pQNode->pNext; @@ -212,8 +200,7 @@ RTMP_TIMER_TASK_ENTRY *RtmpTimerQInsert( } RTMP_INT_UNLOCK(&pAd->TimerQLock, irqFlags); - if (pQNode) - { + if (pQNode) { #ifdef KTHREAD_SUPPORT WAKE_UP(pTask); #else @@ -224,20 +211,15 @@ RTMP_TIMER_TASK_ENTRY *RtmpTimerQInsert( return pQNode; } - -BOOLEAN RtmpTimerQRemove( - IN RTMP_ADAPTER *pAd, - IN RALINK_TIMER_STRUCT *pTimer) +BOOLEAN RtmpTimerQRemove(IN RTMP_ADAPTER * pAd, IN RALINK_TIMER_STRUCT * pTimer) { RTMP_TIMER_TASK_ENTRY *pNode, *pPrev = NULL; unsigned long irqFlags; RTMP_INT_LOCK(&pAd->TimerQLock, irqFlags); - if (pAd->TimerQ.status >= RTMP_TASK_STAT_INITED) - { + if (pAd->TimerQ.status >= RTMP_TASK_STAT_INITED) { pNode = pAd->TimerQ.pQHead; - while (pNode) - { + while (pNode) { if (pNode->pRaTimer == pTimer) break; pPrev = pNode; @@ -245,8 +227,7 @@ BOOLEAN RtmpTimerQRemove( } // Now move it to freeList queue. - if (pNode) - { + if (pNode) { if (pNode == pAd->TimerQ.pQHead) pAd->TimerQ.pQHead = pNode->pNext; if (pNode == pAd->TimerQ.pQTail) @@ -264,15 +245,13 @@ BOOLEAN RtmpTimerQRemove( return TRUE; } - -void RtmpTimerQExit(RTMP_ADAPTER *pAd) +void RtmpTimerQExit(RTMP_ADAPTER * pAd) { RTMP_TIMER_TASK_ENTRY *pTimerQ; unsigned long irqFlags; RTMP_INT_LOCK(&pAd->TimerQLock, irqFlags); - while (pAd->TimerQ.pQHead) - { + while (pAd->TimerQ.pQHead) { pTimerQ = pAd->TimerQ.pQHead; pAd->TimerQ.pQHead = pTimerQ->pNext; // remove the timeQ @@ -288,10 +267,9 @@ void RtmpTimerQExit(RTMP_ADAPTER *pAd) } - -void RtmpTimerQInit(RTMP_ADAPTER *pAd) +void RtmpTimerQInit(RTMP_ADAPTER * pAd) { - int i; + int i; RTMP_TIMER_TASK_ENTRY *pQNode, *pEntry; unsigned long irqFlags; @@ -299,16 +277,17 @@ void RtmpTimerQInit(RTMP_ADAPTER *pAd) NdisZeroMemory(&pAd->TimerQ, sizeof(pAd->TimerQ)); - os_alloc_mem(pAd, &pAd->TimerQ.pTimerQPoll, sizeof(RTMP_TIMER_TASK_ENTRY) * TIMER_QUEUE_SIZE_MAX); - if (pAd->TimerQ.pTimerQPoll) - { + os_alloc_mem(pAd, &pAd->TimerQ.pTimerQPoll, + sizeof(RTMP_TIMER_TASK_ENTRY) * TIMER_QUEUE_SIZE_MAX); + if (pAd->TimerQ.pTimerQPoll) { pEntry = NULL; - pQNode = (RTMP_TIMER_TASK_ENTRY *)pAd->TimerQ.pTimerQPoll; - NdisZeroMemory(pAd->TimerQ.pTimerQPoll, sizeof(RTMP_TIMER_TASK_ENTRY) * TIMER_QUEUE_SIZE_MAX); + pQNode = (RTMP_TIMER_TASK_ENTRY *) pAd->TimerQ.pTimerQPoll; + NdisZeroMemory(pAd->TimerQ.pTimerQPoll, + sizeof(RTMP_TIMER_TASK_ENTRY) * + TIMER_QUEUE_SIZE_MAX); RTMP_INT_LOCK(&pAd->TimerQLock, irqFlags); - for (i = 0 ;i pNext = pEntry; pEntry = pQNode; pQNode++; diff --git a/drivers/staging/rt2860/common/spectrum.c b/drivers/staging/rt2860/common/spectrum.c index 7fd715ad39b1..9c2df55f8fa1 100644 --- a/drivers/staging/rt2860/common/spectrum.c +++ b/drivers/staging/rt2860/common/spectrum.c @@ -24,7 +24,6 @@ * * ************************************************************************* - Module Name: action.c @@ -40,94 +39,237 @@ #include "../rt_config.h" #include "action.h" - /* The regulatory information in the USA (US) */ -DOT11_REGULATORY_INFORMATION USARegulatoryInfo[] = -{ +DOT11_REGULATORY_INFORMATION USARegulatoryInfo[] = { /* "regulatory class" "number of channels" "Max Tx Pwr" "channel list" */ - {0, {0, 0, {0}}}, // Invlid entry - {1, {4, 16, {36, 40, 44, 48}}}, - {2, {4, 23, {52, 56, 60, 64}}}, - {3, {4, 29, {149, 153, 157, 161}}}, - {4, {11, 23, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}}, - {5, {5, 30, {149, 153, 157, 161, 165}}}, - {6, {10, 14, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}}, - {7, {10, 27, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}}, - {8, {5, 17, {11, 13, 15, 17, 19}}}, - {9, {5, 30, {11, 13, 15, 17, 19}}}, - {10, {2, 20, {21, 25}}}, - {11, {2, 33, {21, 25}}}, - {12, {11, 30, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}}} + {0, {0, 0, {0} + } + } + , // Invlid entry + {1, {4, 16, {36, 40, 44, 48} + } + } + , + {2, {4, 23, {52, 56, 60, 64} + } + } + , + {3, {4, 29, {149, 153, 157, 161} + } + } + , + {4, {11, 23, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140} + } + } + , + {5, {5, 30, {149, 153, 157, 161, 165} + } + } + , + {6, {10, 14, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} + } + } + , + {7, {10, 27, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} + } + } + , + {8, {5, 17, {11, 13, 15, 17, 19} + } + } + , + {9, {5, 30, {11, 13, 15, 17, 19} + } + } + , + {10, {2, 20, {21, 25} + } + } + , + {11, {2, 33, {21, 25} + } + } + , + {12, {11, 30, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} + } + } }; -#define USA_REGULATORY_INFO_SIZE (sizeof(USARegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION)) +#define USA_REGULATORY_INFO_SIZE (sizeof(USARegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION)) /* The regulatory information in Europe */ -DOT11_REGULATORY_INFORMATION EuropeRegulatoryInfo[] = -{ +DOT11_REGULATORY_INFORMATION EuropeRegulatoryInfo[] = { /* "regulatory class" "number of channels" "Max Tx Pwr" "channel list" */ - {0, {0, 0, {0}}}, // Invalid entry - {1, {4, 20, {36, 40, 44, 48}}}, - {2, {4, 20, {52, 56, 60, 64}}}, - {3, {11, 30, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}}, - {4, {13, 20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}} + {0, {0, 0, {0} + } + } + , // Invalid entry + {1, {4, 20, {36, 40, 44, 48} + } + } + , + {2, {4, 20, {52, 56, 60, 64} + } + } + , + {3, {11, 30, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140} + } + } + , + {4, {13, 20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13} + } + } }; -#define EU_REGULATORY_INFO_SIZE (sizeof(EuropeRegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION)) +#define EU_REGULATORY_INFO_SIZE (sizeof(EuropeRegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION)) /* The regulatory information in Japan */ -DOT11_REGULATORY_INFORMATION JapanRegulatoryInfo[] = -{ +DOT11_REGULATORY_INFORMATION JapanRegulatoryInfo[] = { /* "regulatory class" "number of channels" "Max Tx Pwr" "channel list" */ - {0, {0, 0, {0}}}, // Invalid entry - {1, {4, 22, {34, 38, 42, 46}}}, - {2, {3, 24, {8, 12, 16}}}, - {3, {3, 24, {8, 12, 16}}}, - {4, {3, 24, {8, 12, 16}}}, - {5, {3, 24, {8, 12, 16}}}, - {6, {3, 22, {8, 12, 16}}}, - {7, {4, 24, {184, 188, 192, 196}}}, - {8, {4, 24, {184, 188, 192, 196}}}, - {9, {4, 24, {184, 188, 192, 196}}}, - {10, {4, 24, {184, 188, 192, 196}}}, - {11, {4, 22, {184, 188, 192, 196}}}, - {12, {4, 24, {7, 8, 9, 11}}}, - {13, {4, 24, {7, 8, 9, 11}}}, - {14, {4, 24, {7, 8, 9, 11}}}, - {15, {4, 24, {7, 8, 9, 11}}}, - {16, {6, 24, {183, 184, 185, 187, 188, 189}}}, - {17, {6, 24, {183, 184, 185, 187, 188, 189}}}, - {18, {6, 24, {183, 184, 185, 187, 188, 189}}}, - {19, {6, 24, {183, 184, 185, 187, 188, 189}}}, - {20, {6, 17, {183, 184, 185, 187, 188, 189}}}, - {21, {6, 24, {6, 7, 8, 9, 10, 11}}}, - {22, {6, 24, {6, 7, 8, 9, 10, 11}}}, - {23, {6, 24, {6, 7, 8, 9, 10, 11}}}, - {24, {6, 24, {6, 7, 8, 9, 10, 11}}}, - {25, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}}}, - {26, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}}}, - {27, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}}}, - {28, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}}}, - {29, {8, 17, {182, 183, 184, 185, 186, 187, 188, 189}}}, - {30, {13, 23, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}}, - {31, {1, 23, {14}}}, - {32, {4, 22, {52, 56, 60, 64}}} + {0, {0, 0, {0} + } + } + , // Invalid entry + {1, {4, 22, {34, 38, 42, 46} + } + } + , + {2, {3, 24, {8, 12, 16} + } + } + , + {3, {3, 24, {8, 12, 16} + } + } + , + {4, {3, 24, {8, 12, 16} + } + } + , + {5, {3, 24, {8, 12, 16} + } + } + , + {6, {3, 22, {8, 12, 16} + } + } + , + {7, {4, 24, {184, 188, 192, 196} + } + } + , + {8, {4, 24, {184, 188, 192, 196} + } + } + , + {9, {4, 24, {184, 188, 192, 196} + } + } + , + {10, {4, 24, {184, 188, 192, 196} + } + } + , + {11, {4, 22, {184, 188, 192, 196} + } + } + , + {12, {4, 24, {7, 8, 9, 11} + } + } + , + {13, {4, 24, {7, 8, 9, 11} + } + } + , + {14, {4, 24, {7, 8, 9, 11} + } + } + , + {15, {4, 24, {7, 8, 9, 11} + } + } + , + {16, {6, 24, {183, 184, 185, 187, 188, 189} + } + } + , + {17, {6, 24, {183, 184, 185, 187, 188, 189} + } + } + , + {18, {6, 24, {183, 184, 185, 187, 188, 189} + } + } + , + {19, {6, 24, {183, 184, 185, 187, 188, 189} + } + } + , + {20, {6, 17, {183, 184, 185, 187, 188, 189} + } + } + , + {21, {6, 24, {6, 7, 8, 9, 10, 11} + } + } + , + {22, {6, 24, {6, 7, 8, 9, 10, 11} + } + } + , + {23, {6, 24, {6, 7, 8, 9, 10, 11} + } + } + , + {24, {6, 24, {6, 7, 8, 9, 10, 11} + } + } + , + {25, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189} + } + } + , + {26, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189} + } + } + , + {27, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189} + } + } + , + {28, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189} + } + } + , + {29, {8, 17, {182, 183, 184, 185, 186, 187, 188, 189} + } + } + , + {30, {13, 23, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13} + } + } + , + {31, {1, 23, {14} + } + } + , + {32, {4, 22, {52, 56, 60, 64} + } + } }; -#define JP_REGULATORY_INFO_SIZE (sizeof(JapanRegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION)) +#define JP_REGULATORY_INFO_SIZE (sizeof(JapanRegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION)) -CHAR RTMP_GetTxPwr( - IN PRTMP_ADAPTER pAd, - IN HTTRANSMIT_SETTING HTTxMode) -{ -typedef struct __TX_PWR_CFG +CHAR RTMP_GetTxPwr(IN PRTMP_ADAPTER pAd, IN HTTRANSMIT_SETTING HTTxMode) { - UINT8 Mode; - UINT8 MCS; - UINT16 req; - UINT8 shift; - UINT32 BitMask; -} TX_PWR_CFG; + typedef struct __TX_PWR_CFG { + UINT8 Mode; + UINT8 MCS; + UINT16 req; + UINT8 shift; + UINT32 BitMask; + } TX_PWR_CFG; UINT32 Value; INT Idx; @@ -137,7 +279,6 @@ typedef struct __TX_PWR_CFG CHAR DaltaPwr; ULONG TxPwr[5]; - TX_PWR_CFG TxPwrCfg[] = { {MODE_CCK, 0, 0, 4, 0x000000f0}, {MODE_CCK, 1, 0, 0, 0x0000000f}, @@ -152,7 +293,7 @@ typedef struct __TX_PWR_CFG {MODE_OFDM, 5, 1, 0, 0x0000000f}, {MODE_OFDM, 6, 1, 12, 0x0000f000}, {MODE_OFDM, 7, 1, 8, 0x00000f00} - ,{MODE_HTMIX, 0, 1, 20, 0x00f00000}, + , {MODE_HTMIX, 0, 1, 20, 0x00f00000}, {MODE_HTMIX, 1, 1, 16, 0x000f0000}, {MODE_HTMIX, 2, 1, 28, 0xf0000000}, {MODE_HTMIX, 3, 1, 24, 0x0f000000}, @@ -174,50 +315,40 @@ typedef struct __TX_PWR_CFG CurTxPwr = 19; /* check Tx Power setting from UI. */ - if (pAd->CommonCfg.TxPowerPercentage > 90) - ; - else if (pAd->CommonCfg.TxPowerPercentage > 60) /* reduce Pwr for 1 dB. */ + if (pAd->CommonCfg.TxPowerPercentage > 90) ; + else if (pAd->CommonCfg.TxPowerPercentage > 60) /* reduce Pwr for 1 dB. */ CurTxPwr -= 1; - else if (pAd->CommonCfg.TxPowerPercentage > 30) /* reduce Pwr for 3 dB. */ + else if (pAd->CommonCfg.TxPowerPercentage > 30) /* reduce Pwr for 3 dB. */ CurTxPwr -= 3; - else if (pAd->CommonCfg.TxPowerPercentage > 15) /* reduce Pwr for 6 dB. */ + else if (pAd->CommonCfg.TxPowerPercentage > 15) /* reduce Pwr for 6 dB. */ CurTxPwr -= 6; - else if (pAd->CommonCfg.TxPowerPercentage > 9) /* reduce Pwr for 9 dB. */ + else if (pAd->CommonCfg.TxPowerPercentage > 9) /* reduce Pwr for 9 dB. */ CurTxPwr -= 9; - else /* reduce Pwr for 12 dB. */ + else /* reduce Pwr for 12 dB. */ CurTxPwr -= 12; - if (pAd->CommonCfg.BBPCurrentBW == BW_40) - { - if (pAd->CommonCfg.CentralChannel > 14) - { + if (pAd->CommonCfg.BBPCurrentBW == BW_40) { + if (pAd->CommonCfg.CentralChannel > 14) { TxPwr[0] = pAd->Tx40MPwrCfgABand[0]; TxPwr[1] = pAd->Tx40MPwrCfgABand[1]; TxPwr[2] = pAd->Tx40MPwrCfgABand[2]; TxPwr[3] = pAd->Tx40MPwrCfgABand[3]; TxPwr[4] = pAd->Tx40MPwrCfgABand[4]; - } - else - { + } else { TxPwr[0] = pAd->Tx40MPwrCfgGBand[0]; TxPwr[1] = pAd->Tx40MPwrCfgGBand[1]; TxPwr[2] = pAd->Tx40MPwrCfgGBand[2]; TxPwr[3] = pAd->Tx40MPwrCfgGBand[3]; TxPwr[4] = pAd->Tx40MPwrCfgGBand[4]; } - } - else - { - if (pAd->CommonCfg.Channel > 14) - { + } else { + if (pAd->CommonCfg.Channel > 14) { TxPwr[0] = pAd->Tx20MPwrCfgABand[0]; TxPwr[1] = pAd->Tx20MPwrCfgABand[1]; TxPwr[2] = pAd->Tx20MPwrCfgABand[2]; TxPwr[3] = pAd->Tx20MPwrCfgABand[3]; TxPwr[4] = pAd->Tx20MPwrCfgABand[4]; - } - else - { + } else { TxPwr[0] = pAd->Tx20MPwrCfgGBand[0]; TxPwr[1] = pAd->Tx20MPwrCfgGBand[1]; TxPwr[2] = pAd->Tx20MPwrCfgGBand[2]; @@ -226,44 +357,36 @@ typedef struct __TX_PWR_CFG } } + switch (HTTxMode.field.MODE) { + case MODE_CCK: + case MODE_OFDM: + Value = TxPwr[1]; + TxPwrRef = (Value & 0x00000f00) >> 8; - switch(HTTxMode.field.MODE) - { - case MODE_CCK: - case MODE_OFDM: - Value = TxPwr[1]; - TxPwrRef = (Value & 0x00000f00) >> 8; + break; - break; - - case MODE_HTMIX: - case MODE_HTGREENFIELD: - if (pAd->CommonCfg.TxStream == 1) - { - Value = TxPwr[2]; - TxPwrRef = (Value & 0x00000f00) >> 8; - } - else if (pAd->CommonCfg.TxStream == 2) - { - Value = TxPwr[3]; - TxPwrRef = (Value & 0x00000f00) >> 8; - } - break; + case MODE_HTMIX: + case MODE_HTGREENFIELD: + if (pAd->CommonCfg.TxStream == 1) { + Value = TxPwr[2]; + TxPwrRef = (Value & 0x00000f00) >> 8; + } else if (pAd->CommonCfg.TxStream == 2) { + Value = TxPwr[3]; + TxPwrRef = (Value & 0x00000f00) >> 8; + } + break; } - PhyMode = - (HTTxMode.field.MODE == MODE_HTGREENFIELD) - ? MODE_HTMIX : - HTTxMode.field.MODE; + PhyMode = (HTTxMode.field.MODE == MODE_HTGREENFIELD) + ? MODE_HTMIX : HTTxMode.field.MODE; - for (Idx = 0; Idx < MAX_TXPWR_TAB_SIZE; Idx++) - { + for (Idx = 0; Idx < MAX_TXPWR_TAB_SIZE; Idx++) { if ((TxPwrCfg[Idx].Mode == PhyMode) - && (TxPwrCfg[Idx].MCS == HTTxMode.field.MCS)) - { + && (TxPwrCfg[Idx].MCS == HTTxMode.field.MCS)) { Value = TxPwr[TxPwrCfg[Idx].req]; - DaltaPwr = TxPwrRef - (CHAR)((Value & TxPwrCfg[Idx].BitMask) - >> TxPwrCfg[Idx].shift); + DaltaPwr = + TxPwrRef - (CHAR) ((Value & TxPwrCfg[Idx].BitMask) + >> TxPwrCfg[Idx].shift); CurTxPwr -= DaltaPwr; break; } @@ -272,23 +395,24 @@ typedef struct __TX_PWR_CFG return CurTxPwr; } - -VOID MeasureReqTabInit( - IN PRTMP_ADAPTER pAd) +VOID MeasureReqTabInit(IN PRTMP_ADAPTER pAd) { NdisAllocateSpinLock(&pAd->CommonCfg.MeasureReqTabLock); - pAd->CommonCfg.pMeasureReqTab = kmalloc(sizeof(MEASURE_REQ_TAB), GFP_ATOMIC); + pAd->CommonCfg.pMeasureReqTab = + kmalloc(sizeof(MEASURE_REQ_TAB), GFP_ATOMIC); if (pAd->CommonCfg.pMeasureReqTab) - NdisZeroMemory(pAd->CommonCfg.pMeasureReqTab, sizeof(MEASURE_REQ_TAB)); + NdisZeroMemory(pAd->CommonCfg.pMeasureReqTab, + sizeof(MEASURE_REQ_TAB)); else - DBGPRINT(RT_DEBUG_ERROR, ("%s Fail to alloc memory for pAd->CommonCfg.pMeasureReqTab.\n", __func__)); + DBGPRINT(RT_DEBUG_ERROR, + ("%s Fail to alloc memory for pAd->CommonCfg.pMeasureReqTab.\n", + __func__)); return; } -VOID MeasureReqTabExit( - IN PRTMP_ADAPTER pAd) +VOID MeasureReqTabExit(IN PRTMP_ADAPTER pAd) { NdisFreeSpinLock(&pAd->CommonCfg.MeasureReqTabLock); @@ -299,18 +423,16 @@ VOID MeasureReqTabExit( return; } -PMEASURE_REQ_ENTRY MeasureReqLookUp( - IN PRTMP_ADAPTER pAd, - IN UINT8 DialogToken) +PMEASURE_REQ_ENTRY MeasureReqLookUp(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) { UINT HashIdx; PMEASURE_REQ_TAB pTab = pAd->CommonCfg.pMeasureReqTab; PMEASURE_REQ_ENTRY pEntry = NULL; PMEASURE_REQ_ENTRY pPrevEntry = NULL; - if (pTab == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: pMeasureReqTab doesn't exist.\n", __func__)); + if (pTab == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s: pMeasureReqTab doesn't exist.\n", __func__)); return NULL; } @@ -319,12 +441,10 @@ PMEASURE_REQ_ENTRY MeasureReqLookUp( HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(DialogToken); pEntry = pTab->Hash[HashIdx]; - while (pEntry) - { + while (pEntry) { if (pEntry->DialogToken == DialogToken) break; - else - { + else { pPrevEntry = pEntry; pEntry = pEntry->pNext; } @@ -335,9 +455,7 @@ PMEASURE_REQ_ENTRY MeasureReqLookUp( return pEntry; } -PMEASURE_REQ_ENTRY MeasureReqInsert( - IN PRTMP_ADAPTER pAd, - IN UINT8 DialogToken) +PMEASURE_REQ_ENTRY MeasureReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) { INT i; ULONG HashIdx; @@ -345,40 +463,41 @@ PMEASURE_REQ_ENTRY MeasureReqInsert( PMEASURE_REQ_ENTRY pEntry = NULL, pCurrEntry; ULONG Now; - if(pTab == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: pMeasureReqTab doesn't exist.\n", __func__)); + if (pTab == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s: pMeasureReqTab doesn't exist.\n", __func__)); return NULL; } pEntry = MeasureReqLookUp(pAd, DialogToken); - if (pEntry == NULL) - { + if (pEntry == NULL) { RTMP_SEM_LOCK(&pAd->CommonCfg.MeasureReqTabLock); - for (i = 0; i < MAX_MEASURE_REQ_TAB_SIZE; i++) - { + for (i = 0; i < MAX_MEASURE_REQ_TAB_SIZE; i++) { NdisGetSystemUpTime(&Now); pEntry = &pTab->Content[i]; if ((pEntry->Valid == TRUE) - && RTMP_TIME_AFTER((unsigned long)Now, (unsigned long)(pEntry->lastTime + MQ_REQ_AGE_OUT))) + && RTMP_TIME_AFTER((unsigned long)Now, + (unsigned long)(pEntry-> + lastTime + + MQ_REQ_AGE_OUT))) { PMEASURE_REQ_ENTRY pPrevEntry = NULL; - ULONG HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(pEntry->DialogToken); - PMEASURE_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx]; + ULONG HashIdx = + MQ_DIALOGTOKEN_HASH_INDEX(pEntry-> + DialogToken); + PMEASURE_REQ_ENTRY pProbeEntry = + pTab->Hash[HashIdx]; // update Hash list - do - { - if (pProbeEntry == pEntry) - { - if (pPrevEntry == NULL) - { - pTab->Hash[HashIdx] = pEntry->pNext; - } - else - { - pPrevEntry->pNext = pEntry->pNext; + do { + if (pProbeEntry == pEntry) { + if (pPrevEntry == NULL) { + pTab->Hash[HashIdx] = + pEntry->pNext; + } else { + pPrevEntry->pNext = + pEntry->pNext; } break; } @@ -387,7 +506,8 @@ PMEASURE_REQ_ENTRY MeasureReqInsert( pProbeEntry = pProbeEntry->pNext; } while (pProbeEntry); - NdisZeroMemory(pEntry, sizeof(MEASURE_REQ_ENTRY)); + NdisZeroMemory(pEntry, + sizeof(MEASURE_REQ_ENTRY)); pTab->Size--; break; @@ -397,30 +517,24 @@ PMEASURE_REQ_ENTRY MeasureReqInsert( break; } - if (i < MAX_MEASURE_REQ_TAB_SIZE) - { + if (i < MAX_MEASURE_REQ_TAB_SIZE) { NdisGetSystemUpTime(&Now); pEntry->lastTime = Now; pEntry->Valid = TRUE; pEntry->DialogToken = DialogToken; pTab->Size++; - } - else - { + } else { pEntry = NULL; - DBGPRINT(RT_DEBUG_ERROR, ("%s: pMeasureReqTab tab full.\n", __func__)); + DBGPRINT(RT_DEBUG_ERROR, + ("%s: pMeasureReqTab tab full.\n", __func__)); } // add this Neighbor entry into HASH table - if (pEntry) - { + if (pEntry) { HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(DialogToken); - if (pTab->Hash[HashIdx] == NULL) - { + if (pTab->Hash[HashIdx] == NULL) { pTab->Hash[HashIdx] = pEntry; - } - else - { + } else { pCurrEntry = pTab->Hash[HashIdx]; while (pCurrEntry->pNext != NULL) pCurrEntry = pCurrEntry->pNext; @@ -434,45 +548,35 @@ PMEASURE_REQ_ENTRY MeasureReqInsert( return pEntry; } -VOID MeasureReqDelete( - IN PRTMP_ADAPTER pAd, - IN UINT8 DialogToken) +VOID MeasureReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) { PMEASURE_REQ_TAB pTab = pAd->CommonCfg.pMeasureReqTab; PMEASURE_REQ_ENTRY pEntry = NULL; - if(pTab == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: pMeasureReqTab doesn't exist.\n", __func__)); + if (pTab == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s: pMeasureReqTab doesn't exist.\n", __func__)); return; } - // if empty, return - if (pTab->Size == 0) - { + if (pTab->Size == 0) { DBGPRINT(RT_DEBUG_ERROR, ("pMeasureReqTab empty.\n")); return; } pEntry = MeasureReqLookUp(pAd, DialogToken); - if (pEntry != NULL) - { + if (pEntry != NULL) { PMEASURE_REQ_ENTRY pPrevEntry = NULL; ULONG HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(pEntry->DialogToken); PMEASURE_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx]; RTMP_SEM_LOCK(&pAd->CommonCfg.MeasureReqTabLock); // update Hash list - do - { - if (pProbeEntry == pEntry) - { - if (pPrevEntry == NULL) - { + do { + if (pProbeEntry == pEntry) { + if (pPrevEntry == NULL) { pTab->Hash[HashIdx] = pEntry->pNext; - } - else - { + } else { pPrevEntry->pNext = pEntry->pNext; } break; @@ -491,8 +595,7 @@ VOID MeasureReqDelete( return; } -VOID TpcReqTabInit( - IN PRTMP_ADAPTER pAd) +VOID TpcReqTabInit(IN PRTMP_ADAPTER pAd) { NdisAllocateSpinLock(&pAd->CommonCfg.TpcReqTabLock); @@ -500,13 +603,14 @@ VOID TpcReqTabInit( if (pAd->CommonCfg.pTpcReqTab) NdisZeroMemory(pAd->CommonCfg.pTpcReqTab, sizeof(TPC_REQ_TAB)); else - DBGPRINT(RT_DEBUG_ERROR, ("%s Fail to alloc memory for pAd->CommonCfg.pTpcReqTab.\n", __func__)); + DBGPRINT(RT_DEBUG_ERROR, + ("%s Fail to alloc memory for pAd->CommonCfg.pTpcReqTab.\n", + __func__)); return; } -VOID TpcReqTabExit( - IN PRTMP_ADAPTER pAd) +VOID TpcReqTabExit(IN PRTMP_ADAPTER pAd) { NdisFreeSpinLock(&pAd->CommonCfg.TpcReqTabLock); @@ -517,18 +621,16 @@ VOID TpcReqTabExit( return; } -static PTPC_REQ_ENTRY TpcReqLookUp( - IN PRTMP_ADAPTER pAd, - IN UINT8 DialogToken) +static PTPC_REQ_ENTRY TpcReqLookUp(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) { UINT HashIdx; PTPC_REQ_TAB pTab = pAd->CommonCfg.pTpcReqTab; PTPC_REQ_ENTRY pEntry = NULL; PTPC_REQ_ENTRY pPrevEntry = NULL; - if (pTab == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: pTpcReqTab doesn't exist.\n", __func__)); + if (pTab == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s: pTpcReqTab doesn't exist.\n", __func__)); return NULL; } @@ -537,12 +639,10 @@ static PTPC_REQ_ENTRY TpcReqLookUp( HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(DialogToken); pEntry = pTab->Hash[HashIdx]; - while (pEntry) - { + while (pEntry) { if (pEntry->DialogToken == DialogToken) break; - else - { + else { pPrevEntry = pEntry; pEntry = pEntry->pNext; } @@ -553,10 +653,7 @@ static PTPC_REQ_ENTRY TpcReqLookUp( return pEntry; } - -static PTPC_REQ_ENTRY TpcReqInsert( - IN PRTMP_ADAPTER pAd, - IN UINT8 DialogToken) +static PTPC_REQ_ENTRY TpcReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) { INT i; ULONG HashIdx; @@ -564,40 +661,41 @@ static PTPC_REQ_ENTRY TpcReqInsert( PTPC_REQ_ENTRY pEntry = NULL, pCurrEntry; ULONG Now; - if(pTab == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: pTpcReqTab doesn't exist.\n", __func__)); + if (pTab == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s: pTpcReqTab doesn't exist.\n", __func__)); return NULL; } pEntry = TpcReqLookUp(pAd, DialogToken); - if (pEntry == NULL) - { + if (pEntry == NULL) { RTMP_SEM_LOCK(&pAd->CommonCfg.TpcReqTabLock); - for (i = 0; i < MAX_TPC_REQ_TAB_SIZE; i++) - { + for (i = 0; i < MAX_TPC_REQ_TAB_SIZE; i++) { NdisGetSystemUpTime(&Now); pEntry = &pTab->Content[i]; if ((pEntry->Valid == TRUE) - && RTMP_TIME_AFTER((unsigned long)Now, (unsigned long)(pEntry->lastTime + TPC_REQ_AGE_OUT))) + && RTMP_TIME_AFTER((unsigned long)Now, + (unsigned long)(pEntry-> + lastTime + + TPC_REQ_AGE_OUT))) { PTPC_REQ_ENTRY pPrevEntry = NULL; - ULONG HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(pEntry->DialogToken); - PTPC_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx]; + ULONG HashIdx = + TPC_DIALOGTOKEN_HASH_INDEX(pEntry-> + DialogToken); + PTPC_REQ_ENTRY pProbeEntry = + pTab->Hash[HashIdx]; // update Hash list - do - { - if (pProbeEntry == pEntry) - { - if (pPrevEntry == NULL) - { - pTab->Hash[HashIdx] = pEntry->pNext; - } - else - { - pPrevEntry->pNext = pEntry->pNext; + do { + if (pProbeEntry == pEntry) { + if (pPrevEntry == NULL) { + pTab->Hash[HashIdx] = + pEntry->pNext; + } else { + pPrevEntry->pNext = + pEntry->pNext; } break; } @@ -616,30 +714,24 @@ static PTPC_REQ_ENTRY TpcReqInsert( break; } - if (i < MAX_TPC_REQ_TAB_SIZE) - { + if (i < MAX_TPC_REQ_TAB_SIZE) { NdisGetSystemUpTime(&Now); pEntry->lastTime = Now; pEntry->Valid = TRUE; pEntry->DialogToken = DialogToken; pTab->Size++; - } - else - { + } else { pEntry = NULL; - DBGPRINT(RT_DEBUG_ERROR, ("%s: pTpcReqTab tab full.\n", __func__)); + DBGPRINT(RT_DEBUG_ERROR, + ("%s: pTpcReqTab tab full.\n", __func__)); } // add this Neighbor entry into HASH table - if (pEntry) - { + if (pEntry) { HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(DialogToken); - if (pTab->Hash[HashIdx] == NULL) - { + if (pTab->Hash[HashIdx] == NULL) { pTab->Hash[HashIdx] = pEntry; - } - else - { + } else { pCurrEntry = pTab->Hash[HashIdx]; while (pCurrEntry->pNext != NULL) pCurrEntry = pCurrEntry->pNext; @@ -653,45 +745,35 @@ static PTPC_REQ_ENTRY TpcReqInsert( return pEntry; } -static VOID TpcReqDelete( - IN PRTMP_ADAPTER pAd, - IN UINT8 DialogToken) +static VOID TpcReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) { PTPC_REQ_TAB pTab = pAd->CommonCfg.pTpcReqTab; PTPC_REQ_ENTRY pEntry = NULL; - if(pTab == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: pTpcReqTab doesn't exist.\n", __func__)); + if (pTab == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s: pTpcReqTab doesn't exist.\n", __func__)); return; } - // if empty, return - if (pTab->Size == 0) - { + if (pTab->Size == 0) { DBGPRINT(RT_DEBUG_ERROR, ("pTpcReqTab empty.\n")); return; } pEntry = TpcReqLookUp(pAd, DialogToken); - if (pEntry != NULL) - { + if (pEntry != NULL) { PTPC_REQ_ENTRY pPrevEntry = NULL; ULONG HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(pEntry->DialogToken); PTPC_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx]; RTMP_SEM_LOCK(&pAd->CommonCfg.TpcReqTabLock); // update Hash list - do - { - if (pProbeEntry == pEntry) - { - if (pPrevEntry == NULL) - { + do { + if (pProbeEntry == pEntry) { + if (pPrevEntry == NULL) { pTab->Hash[HashIdx] = pEntry->pNext; - } - else - { + } else { pPrevEntry->pNext = pEntry->pNext; } break; @@ -720,8 +802,7 @@ static VOID TpcReqDelete( Return : Current Time Stamp. ========================================================================== */ -static UINT64 GetCurrentTimeStamp( - IN PRTMP_ADAPTER pAd) +static UINT64 GetCurrentTimeStamp(IN PRTMP_ADAPTER pAd) { // get current time stamp. return 0; @@ -737,11 +818,9 @@ static UINT64 GetCurrentTimeStamp( Return : Current Time Stamp. ========================================================================== */ -static UINT8 GetCurTxPwr( - IN PRTMP_ADAPTER pAd, - IN UINT8 Wcid) +static UINT8 GetCurTxPwr(IN PRTMP_ADAPTER pAd, IN UINT8 Wcid) { - return 16; /* 16 dBm */ + return 16; /* 16 dBm */ } /* @@ -754,12 +833,10 @@ static UINT8 GetCurTxPwr( Return : Current Time Stamp. ========================================================================== */ -VOID InsertChannelRepIE( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN PSTRING pCountry, - IN UINT8 RegulatoryClass) +VOID InsertChannelRepIE(IN PRTMP_ADAPTER pAd, + OUT PUCHAR pFrameBuf, + OUT PULONG pFrameLen, + IN PSTRING pCountry, IN UINT8 RegulatoryClass) { ULONG TempLen; UINT8 Len; @@ -767,43 +844,43 @@ VOID InsertChannelRepIE( PUCHAR pChListPtr = NULL; Len = 1; - if (strncmp(pCountry, "US", 2) == 0) - { - if (RegulatoryClass >= USA_REGULATORY_INFO_SIZE) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: USA Unknow Requlatory class (%d)\n", - __func__, RegulatoryClass)); + if (strncmp(pCountry, "US", 2) == 0) { + if (RegulatoryClass >= USA_REGULATORY_INFO_SIZE) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s: USA Unknow Requlatory class (%d)\n", + __func__, RegulatoryClass)); return; } - Len += USARegulatoryInfo[RegulatoryClass].ChannelSet.NumberOfChannels; - pChListPtr = USARegulatoryInfo[RegulatoryClass].ChannelSet.ChannelList; - } - else if (strncmp(pCountry, "JP", 2) == 0) - { - if (RegulatoryClass >= JP_REGULATORY_INFO_SIZE) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: JP Unknow Requlatory class (%d)\n", - __func__, RegulatoryClass)); + Len += + USARegulatoryInfo[RegulatoryClass].ChannelSet. + NumberOfChannels; + pChListPtr = + USARegulatoryInfo[RegulatoryClass].ChannelSet.ChannelList; + } else if (strncmp(pCountry, "JP", 2) == 0) { + if (RegulatoryClass >= JP_REGULATORY_INFO_SIZE) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s: JP Unknow Requlatory class (%d)\n", + __func__, RegulatoryClass)); return; } - Len += JapanRegulatoryInfo[RegulatoryClass].ChannelSet.NumberOfChannels; - pChListPtr = JapanRegulatoryInfo[RegulatoryClass].ChannelSet.ChannelList; - } - else - { + Len += + JapanRegulatoryInfo[RegulatoryClass].ChannelSet. + NumberOfChannels; + pChListPtr = + JapanRegulatoryInfo[RegulatoryClass].ChannelSet.ChannelList; + } else { DBGPRINT(RT_DEBUG_ERROR, ("%s: Unknow Country (%s)\n", - __func__, pCountry)); + __func__, pCountry)); return; } - MakeOutgoingFrame(pFrameBuf, &TempLen, - 1, &IEId, - 1, &Len, - 1, &RegulatoryClass, - Len -1, pChListPtr, - END_OF_ARGS); + MakeOutgoingFrame(pFrameBuf, &TempLen, + 1, &IEId, + 1, &Len, + 1, &RegulatoryClass, + Len - 1, pChListPtr, END_OF_ARGS); *pFrameLen = *pFrameLen + TempLen; @@ -823,16 +900,12 @@ VOID InsertChannelRepIE( Return : None. ========================================================================== */ -VOID InsertDialogToken( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 DialogToken) +VOID InsertDialogToken(IN PRTMP_ADAPTER pAd, + OUT PUCHAR pFrameBuf, + OUT PULONG pFrameLen, IN UINT8 DialogToken) { ULONG TempLen; - MakeOutgoingFrame(pFrameBuf, &TempLen, - 1, &DialogToken, - END_OF_ARGS); + MakeOutgoingFrame(pFrameBuf, &TempLen, 1, &DialogToken, END_OF_ARGS); *pFrameLen = *pFrameLen + TempLen; @@ -851,19 +924,15 @@ VOID InsertDialogToken( Return : None. ========================================================================== */ - static VOID InsertTpcReqIE( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen) +static VOID InsertTpcReqIE(IN PRTMP_ADAPTER pAd, + OUT PUCHAR pFrameBuf, OUT PULONG pFrameLen) { ULONG TempLen; ULONG Len = 0; UINT8 ElementID = IE_TPC_REQUEST; - MakeOutgoingFrame(pFrameBuf, &TempLen, - 1, &ElementID, - 1, &Len, - END_OF_ARGS); + MakeOutgoingFrame(pFrameBuf, &TempLen, + 1, &ElementID, 1, &Len, END_OF_ARGS); *pFrameLen = *pFrameLen + TempLen; @@ -884,12 +953,10 @@ VOID InsertDialogToken( Return : None. ========================================================================== */ -VOID InsertTpcReportIE( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 TxPwr, - IN UINT8 LinkMargin) +VOID InsertTpcReportIE(IN PRTMP_ADAPTER pAd, + OUT PUCHAR pFrameBuf, + OUT PULONG pFrameLen, + IN UINT8 TxPwr, IN UINT8 LinkMargin) { ULONG TempLen; ULONG Len = sizeof(TPC_REPORT_INFO); @@ -899,15 +966,12 @@ VOID InsertTpcReportIE( TpcReportIE.TxPwr = TxPwr; TpcReportIE.LinkMargin = LinkMargin; - MakeOutgoingFrame(pFrameBuf, &TempLen, - 1, &ElementID, - 1, &Len, - Len, &TpcReportIE, - END_OF_ARGS); + MakeOutgoingFrame(pFrameBuf, &TempLen, + 1, &ElementID, + 1, &Len, Len, &TpcReportIE, END_OF_ARGS); *pFrameLen = *pFrameLen + TempLen; - return; } @@ -926,13 +990,11 @@ VOID InsertTpcReportIE( Return : None. ========================================================================== */ -static VOID InsertChSwAnnIE( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 ChSwMode, - IN UINT8 NewChannel, - IN UINT8 ChSwCnt) +static VOID InsertChSwAnnIE(IN PRTMP_ADAPTER pAd, + OUT PUCHAR pFrameBuf, + OUT PULONG pFrameLen, + IN UINT8 ChSwMode, + IN UINT8 NewChannel, IN UINT8 ChSwCnt) { ULONG TempLen; ULONG Len = sizeof(CH_SW_ANN_INFO); @@ -943,15 +1005,11 @@ static VOID InsertChSwAnnIE( ChSwAnnIE.Channel = NewChannel; ChSwAnnIE.ChSwCnt = ChSwCnt; - MakeOutgoingFrame(pFrameBuf, &TempLen, - 1, &ElementID, - 1, &Len, - Len, &ChSwAnnIE, - END_OF_ARGS); + MakeOutgoingFrame(pFrameBuf, &TempLen, + 1, &ElementID, 1, &Len, Len, &ChSwAnnIE, END_OF_ARGS); *pFrameLen = *pFrameLen + TempLen; - return; } @@ -970,25 +1028,21 @@ static VOID InsertChSwAnnIE( 7. Measure Start time. 8. Measure Duration. - Return : None. ========================================================================== */ -static VOID InsertMeasureReqIE( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 Len, - IN PMEASURE_REQ_INFO pMeasureReqIE) +static VOID InsertMeasureReqIE(IN PRTMP_ADAPTER pAd, + OUT PUCHAR pFrameBuf, + OUT PULONG pFrameLen, + IN UINT8 Len, IN PMEASURE_REQ_INFO pMeasureReqIE) { ULONG TempLen; UINT8 ElementID = IE_MEASUREMENT_REQUEST; - MakeOutgoingFrame(pFrameBuf, &TempLen, - 1, &ElementID, - 1, &Len, - sizeof(MEASURE_REQ_INFO), pMeasureReqIE, - END_OF_ARGS); + MakeOutgoingFrame(pFrameBuf, &TempLen, + 1, &ElementID, + 1, &Len, + sizeof(MEASURE_REQ_INFO), pMeasureReqIE, END_OF_ARGS); *pFrameLen = *pFrameLen + TempLen; @@ -1012,13 +1066,11 @@ static VOID InsertMeasureReqIE( Return : None. ========================================================================== */ -static VOID InsertMeasureReportIE( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN PMEASURE_REPORT_INFO pMeasureReportIE, - IN UINT8 ReportLnfoLen, - IN PUINT8 pReportInfo) +static VOID InsertMeasureReportIE(IN PRTMP_ADAPTER pAd, + OUT PUCHAR pFrameBuf, + OUT PULONG pFrameLen, + IN PMEASURE_REPORT_INFO pMeasureReportIE, + IN UINT8 ReportLnfoLen, IN PUINT8 pReportInfo) { ULONG TempLen; ULONG Len; @@ -1026,19 +1078,15 @@ static VOID InsertMeasureReportIE( Len = sizeof(MEASURE_REPORT_INFO) + ReportLnfoLen; - MakeOutgoingFrame(pFrameBuf, &TempLen, - 1, &ElementID, - 1, &Len, - Len, pMeasureReportIE, - END_OF_ARGS); + MakeOutgoingFrame(pFrameBuf, &TempLen, + 1, &ElementID, + 1, &Len, Len, pMeasureReportIE, END_OF_ARGS); *pFrameLen = *pFrameLen + TempLen; - if ((ReportLnfoLen > 0) && (pReportInfo != NULL)) - { - MakeOutgoingFrame(pFrameBuf + *pFrameLen, &TempLen, - ReportLnfoLen, pReportInfo, - END_OF_ARGS); + if ((ReportLnfoLen > 0) && (pReportInfo != NULL)) { + MakeOutgoingFrame(pFrameBuf + *pFrameLen, &TempLen, + ReportLnfoLen, pReportInfo, END_OF_ARGS); *pFrameLen = *pFrameLen + TempLen; } @@ -1057,43 +1105,40 @@ static VOID InsertMeasureReportIE( Return : None. ========================================================================== */ -VOID MakeMeasurementReqFrame( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pOutBuffer, - OUT PULONG pFrameLen, - IN UINT8 TotalLen, - IN UINT8 Category, - IN UINT8 Action, - IN UINT8 MeasureToken, - IN UINT8 MeasureReqMode, - IN UINT8 MeasureReqType, - IN UINT8 NumOfRepetitions) +VOID MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd, + OUT PUCHAR pOutBuffer, + OUT PULONG pFrameLen, + IN UINT8 TotalLen, + IN UINT8 Category, + IN UINT8 Action, + IN UINT8 MeasureToken, + IN UINT8 MeasureReqMode, + IN UINT8 MeasureReqType, IN UINT8 NumOfRepetitions) { ULONG TempLen; MEASURE_REQ_INFO MeasureReqIE; - InsertActField(pAd, (pOutBuffer + *pFrameLen), pFrameLen, Category, Action); + InsertActField(pAd, (pOutBuffer + *pFrameLen), pFrameLen, Category, + Action); // fill Dialog Token - InsertDialogToken(pAd, (pOutBuffer + *pFrameLen), pFrameLen, MeasureToken); + InsertDialogToken(pAd, (pOutBuffer + *pFrameLen), pFrameLen, + MeasureToken); /* fill Number of repetitions. */ - if (Category == CATEGORY_RM) - { - MakeOutgoingFrame((pOutBuffer+*pFrameLen), &TempLen, - 2, &NumOfRepetitions, - END_OF_ARGS); + if (Category == CATEGORY_RM) { + MakeOutgoingFrame((pOutBuffer + *pFrameLen), &TempLen, + 2, &NumOfRepetitions, END_OF_ARGS); *pFrameLen += TempLen; } - // prepare Measurement IE. NdisZeroMemory(&MeasureReqIE, sizeof(MEASURE_REQ_INFO)); MeasureReqIE.Token = MeasureToken; MeasureReqIE.ReqMode.word = MeasureReqMode; MeasureReqIE.ReqType = MeasureReqType; - InsertMeasureReqIE(pAd, (pOutBuffer+*pFrameLen), pFrameLen, - TotalLen, &MeasureReqIE); + InsertMeasureReqIE(pAd, (pOutBuffer + *pFrameLen), pFrameLen, + TotalLen, &MeasureReqIE); return; } @@ -1110,15 +1155,13 @@ VOID MakeMeasurementReqFrame( Return : None. ========================================================================== */ -VOID EnqueueMeasurementRep( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UINT8 DialogToken, - IN UINT8 MeasureToken, - IN UINT8 MeasureReqMode, - IN UINT8 MeasureReqType, - IN UINT8 ReportInfoLen, - IN PUINT8 pReportInfo) +VOID EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd, + IN PUCHAR pDA, + IN UINT8 DialogToken, + IN UINT8 MeasureToken, + IN UINT8 MeasureReqMode, + IN UINT8 MeasureReqType, + IN UINT8 ReportInfoLen, IN PUINT8 pReportInfo) { PUCHAR pOutBuffer = NULL; NDIS_STATUS NStatus; @@ -1128,18 +1171,19 @@ VOID EnqueueMeasurementRep( // build action frame header. MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, - pAd->CurrentAddress); + pAd->CurrentAddress); - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__)); + NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_TRACE, + ("%s() allocate memory failed \n", __func__)); return; } - NdisMoveMemory(pOutBuffer, (PCHAR)&ActHdr, sizeof(HEADER_802_11)); + NdisMoveMemory(pOutBuffer, (PCHAR) & ActHdr, sizeof(HEADER_802_11)); FrameLen = sizeof(HEADER_802_11); - InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_MRP); + InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, + CATEGORY_SPECTRUM, SPEC_MRP); // fill Dialog Token InsertDialogToken(pAd, (pOutBuffer + FrameLen), &FrameLen, DialogToken); @@ -1149,7 +1193,8 @@ VOID EnqueueMeasurementRep( MeasureRepIE.Token = MeasureToken; MeasureRepIE.ReportMode = MeasureReqMode; MeasureRepIE.ReportType = MeasureReqType; - InsertMeasureReportIE(pAd, (pOutBuffer + FrameLen), &FrameLen, &MeasureRepIE, ReportInfoLen, pReportInfo); + InsertMeasureReportIE(pAd, (pOutBuffer + FrameLen), &FrameLen, + &MeasureRepIE, ReportInfoLen, pReportInfo); MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); @@ -1169,10 +1214,7 @@ VOID EnqueueMeasurementRep( Return : None. ========================================================================== */ -VOID EnqueueTPCReq( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UCHAR DialogToken) +VOID EnqueueTPCReq(IN PRTMP_ADAPTER pAd, IN PUCHAR pDA, IN UCHAR DialogToken) { PUCHAR pOutBuffer = NULL; NDIS_STATUS NStatus; @@ -1182,18 +1224,19 @@ VOID EnqueueTPCReq( // build action frame header. MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, - pAd->CurrentAddress); + pAd->CurrentAddress); - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__)); + NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_TRACE, + ("%s() allocate memory failed \n", __func__)); return; } - NdisMoveMemory(pOutBuffer, (PCHAR)&ActHdr, sizeof(HEADER_802_11)); + NdisMoveMemory(pOutBuffer, (PCHAR) & ActHdr, sizeof(HEADER_802_11)); FrameLen = sizeof(HEADER_802_11); - InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_TPCRQ); + InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, + CATEGORY_SPECTRUM, SPEC_TPCRQ); // fill Dialog Token InsertDialogToken(pAd, (pOutBuffer + FrameLen), &FrameLen, DialogToken); @@ -1219,12 +1262,9 @@ VOID EnqueueTPCReq( Return : None. ========================================================================== */ -VOID EnqueueTPCRep( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UINT8 DialogToken, - IN UINT8 TxPwr, - IN UINT8 LinkMargin) +VOID EnqueueTPCRep(IN PRTMP_ADAPTER pAd, + IN PUCHAR pDA, + IN UINT8 DialogToken, IN UINT8 TxPwr, IN UINT8 LinkMargin) { PUCHAR pOutBuffer = NULL; NDIS_STATUS NStatus; @@ -1234,24 +1274,26 @@ VOID EnqueueTPCRep( // build action frame header. MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, - pAd->CurrentAddress); + pAd->CurrentAddress); - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__)); + NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_TRACE, + ("%s() allocate memory failed \n", __func__)); return; } - NdisMoveMemory(pOutBuffer, (PCHAR)&ActHdr, sizeof(HEADER_802_11)); + NdisMoveMemory(pOutBuffer, (PCHAR) & ActHdr, sizeof(HEADER_802_11)); FrameLen = sizeof(HEADER_802_11); - InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_TPCRP); + InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, + CATEGORY_SPECTRUM, SPEC_TPCRP); // fill Dialog Token InsertDialogToken(pAd, (pOutBuffer + FrameLen), &FrameLen, DialogToken); // Insert TPC Request IE. - InsertTpcReportIE(pAd, (pOutBuffer + FrameLen), &FrameLen, TxPwr, LinkMargin); + InsertTpcReportIE(pAd, (pOutBuffer + FrameLen), &FrameLen, TxPwr, + LinkMargin); MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); @@ -1273,11 +1315,8 @@ VOID EnqueueTPCRep( Return : None. ========================================================================== */ -VOID EnqueueChSwAnn( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UINT8 ChSwMode, - IN UINT8 NewCh) +VOID EnqueueChSwAnn(IN PRTMP_ADAPTER pAd, + IN PUCHAR pDA, IN UINT8 ChSwMode, IN UINT8 NewCh) { PUCHAR pOutBuffer = NULL; NDIS_STATUS NStatus; @@ -1287,20 +1326,22 @@ VOID EnqueueChSwAnn( // build action frame header. MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, - pAd->CurrentAddress); + pAd->CurrentAddress); - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__)); + NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_TRACE, + ("%s() allocate memory failed \n", __func__)); return; } - NdisMoveMemory(pOutBuffer, (PCHAR)&ActHdr, sizeof(HEADER_802_11)); + NdisMoveMemory(pOutBuffer, (PCHAR) & ActHdr, sizeof(HEADER_802_11)); FrameLen = sizeof(HEADER_802_11); - InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_CHANNEL_SWITCH); + InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, + CATEGORY_SPECTRUM, SPEC_CHANNEL_SWITCH); - InsertChSwAnnIE(pAd, (pOutBuffer + FrameLen), &FrameLen, ChSwMode, NewCh, 0); + InsertChSwAnnIE(pAd, (pOutBuffer + FrameLen), &FrameLen, ChSwMode, + NewCh, 0); MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); @@ -1308,53 +1349,41 @@ VOID EnqueueChSwAnn( return; } -static BOOLEAN DfsRequirementCheck( - IN PRTMP_ADAPTER pAd, - IN UINT8 Channel) +static BOOLEAN DfsRequirementCheck(IN PRTMP_ADAPTER pAd, IN UINT8 Channel) { BOOLEAN Result = FALSE; INT i; - do - { + do { // check DFS procedure is running. // make sure DFS procedure won't start twice. - if (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) - { + if (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) { Result = FALSE; break; } - // check the new channel carried from Channel Switch Announcemnet is valid. - for (i=0; iChannelListNum; i++) - { + for (i = 0; i < pAd->ChannelListNum; i++) { if ((Channel == pAd->ChannelList[i].Channel) - &&(pAd->ChannelList[i].RemainingTimeForUse == 0)) - { + && (pAd->ChannelList[i].RemainingTimeForUse == 0)) { // found radar signal in the channel. the channel can't use at least for 30 minutes. - pAd->ChannelList[i].RemainingTimeForUse = 1800;//30 min = 1800 sec + pAd->ChannelList[i].RemainingTimeForUse = 1800; //30 min = 1800 sec Result = TRUE; break; } } - } while(FALSE); + } while (FALSE); return Result; } -VOID NotifyChSwAnnToPeerAPs( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pRA, - IN PUCHAR pTA, - IN UINT8 ChSwMode, - IN UINT8 Channel) +VOID NotifyChSwAnnToPeerAPs(IN PRTMP_ADAPTER pAd, + IN PUCHAR pRA, + IN PUCHAR pTA, IN UINT8 ChSwMode, IN UINT8 Channel) { } -static VOID StartDFSProcedure( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel, - IN UINT8 ChSwMode) +static VOID StartDFSProcedure(IN PRTMP_ADAPTER pAd, + IN UCHAR Channel, IN UINT8 ChSwMode) { // start DFS procedure pAd->CommonCfg.Channel = Channel; @@ -1375,7 +1404,6 @@ static VOID StartDFSProcedure( 2. message length. 3. Channel switch announcement infomation buffer. - Return : None. ========================================================================== */ @@ -1387,13 +1415,12 @@ static VOID StartDFSProcedure( +----+-----+-----------+------------+-----------+ 1 1 1 1 1 */ -static BOOLEAN PeerChSwAnnSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PCH_SW_ANN_INFO pChSwAnnInfo) +static BOOLEAN PeerChSwAnnSanity(IN PRTMP_ADAPTER pAd, + IN VOID * pMsg, + IN ULONG MsgLen, + OUT PCH_SW_ANN_INFO pChSwAnnInfo) { - PFRAME_802_11 Fr = (PFRAME_802_11)pMsg; + PFRAME_802_11 Fr = (PFRAME_802_11) pMsg; PUCHAR pFramePtr = Fr->Octet; BOOLEAN result = FALSE; PEID_STRUCT eid_ptr; @@ -1408,23 +1435,25 @@ static BOOLEAN PeerChSwAnnSanity( if (pChSwAnnInfo == NULL) return result; - eid_ptr = (PEID_STRUCT)pFramePtr; - while (((UCHAR*)eid_ptr + eid_ptr->Len + 1) < ((PUCHAR)pFramePtr + MsgLen)) - { - switch(eid_ptr->Eid) - { - case IE_CHANNEL_SWITCH_ANNOUNCEMENT: - NdisMoveMemory(&pChSwAnnInfo->ChSwMode, eid_ptr->Octet, 1); - NdisMoveMemory(&pChSwAnnInfo->Channel, eid_ptr->Octet + 1, 1); - NdisMoveMemory(&pChSwAnnInfo->ChSwCnt, eid_ptr->Octet + 2, 1); - - result = TRUE; - break; + eid_ptr = (PEID_STRUCT) pFramePtr; + while (((UCHAR *) eid_ptr + eid_ptr->Len + 1) < + ((PUCHAR) pFramePtr + MsgLen)) { + switch (eid_ptr->Eid) { + case IE_CHANNEL_SWITCH_ANNOUNCEMENT: + NdisMoveMemory(&pChSwAnnInfo->ChSwMode, eid_ptr->Octet, + 1); + NdisMoveMemory(&pChSwAnnInfo->Channel, + eid_ptr->Octet + 1, 1); + NdisMoveMemory(&pChSwAnnInfo->ChSwCnt, + eid_ptr->Octet + 2, 1); + + result = TRUE; + break; - default: - break; + default: + break; } - eid_ptr = (PEID_STRUCT)((UCHAR*)eid_ptr + 2 + eid_ptr->Len); + eid_ptr = (PEID_STRUCT) ((UCHAR *) eid_ptr + 2 + eid_ptr->Len); } return result; @@ -1443,15 +1472,14 @@ static BOOLEAN PeerChSwAnnSanity( Return : None. ========================================================================== */ -static BOOLEAN PeerMeasureReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PUINT8 pDialogToken, - OUT PMEASURE_REQ_INFO pMeasureReqInfo, - OUT PMEASURE_REQ pMeasureReq) +static BOOLEAN PeerMeasureReqSanity(IN PRTMP_ADAPTER pAd, + IN VOID * pMsg, + IN ULONG MsgLen, + OUT PUINT8 pDialogToken, + OUT PMEASURE_REQ_INFO pMeasureReqInfo, + OUT PMEASURE_REQ pMeasureReq) { - PFRAME_802_11 Fr = (PFRAME_802_11)pMsg; + PFRAME_802_11 Fr = (PFRAME_802_11) pMsg; PUCHAR pFramePtr = Fr->Octet; BOOLEAN result = FALSE; PEID_STRUCT eid_ptr; @@ -1473,29 +1501,32 @@ static BOOLEAN PeerMeasureReqSanity( pFramePtr += 1; MsgLen -= 1; - eid_ptr = (PEID_STRUCT)pFramePtr; - while (((UCHAR*)eid_ptr + eid_ptr->Len + 1) < ((PUCHAR)pFramePtr + MsgLen)) - { - switch(eid_ptr->Eid) - { - case IE_MEASUREMENT_REQUEST: - NdisMoveMemory(&pMeasureReqInfo->Token, eid_ptr->Octet, 1); - NdisMoveMemory(&pMeasureReqInfo->ReqMode.word, eid_ptr->Octet + 1, 1); - NdisMoveMemory(&pMeasureReqInfo->ReqType, eid_ptr->Octet + 2, 1); - ptr = (PUCHAR)(eid_ptr->Octet + 3); - NdisMoveMemory(&pMeasureReq->ChNum, ptr, 1); - NdisMoveMemory(&MeasureStartTime, ptr + 1, 8); - pMeasureReq->MeasureStartTime = SWAP64(MeasureStartTime); - NdisMoveMemory(&MeasureDuration, ptr + 9, 2); - pMeasureReq->MeasureDuration = SWAP16(MeasureDuration); - - result = TRUE; - break; + eid_ptr = (PEID_STRUCT) pFramePtr; + while (((UCHAR *) eid_ptr + eid_ptr->Len + 1) < + ((PUCHAR) pFramePtr + MsgLen)) { + switch (eid_ptr->Eid) { + case IE_MEASUREMENT_REQUEST: + NdisMoveMemory(&pMeasureReqInfo->Token, eid_ptr->Octet, + 1); + NdisMoveMemory(&pMeasureReqInfo->ReqMode.word, + eid_ptr->Octet + 1, 1); + NdisMoveMemory(&pMeasureReqInfo->ReqType, + eid_ptr->Octet + 2, 1); + ptr = (PUCHAR) (eid_ptr->Octet + 3); + NdisMoveMemory(&pMeasureReq->ChNum, ptr, 1); + NdisMoveMemory(&MeasureStartTime, ptr + 1, 8); + pMeasureReq->MeasureStartTime = + SWAP64(MeasureStartTime); + NdisMoveMemory(&MeasureDuration, ptr + 9, 2); + pMeasureReq->MeasureDuration = SWAP16(MeasureDuration); + + result = TRUE; + break; - default: - break; + default: + break; } - eid_ptr = (PEID_STRUCT)((UCHAR*)eid_ptr + 2 + eid_ptr->Len); + eid_ptr = (PEID_STRUCT) ((UCHAR *) eid_ptr + 2 + eid_ptr->Len); } return result; @@ -1535,15 +1566,15 @@ static BOOLEAN PeerMeasureReqSanity( +-----+---------------+---------------------+-------+------------+----------+ 0 1 2 3 4 5-7 */ -static BOOLEAN PeerMeasureReportSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PUINT8 pDialogToken, - OUT PMEASURE_REPORT_INFO pMeasureReportInfo, - OUT PUINT8 pReportBuf) +static BOOLEAN PeerMeasureReportSanity(IN PRTMP_ADAPTER pAd, + IN VOID * pMsg, + IN ULONG MsgLen, + OUT PUINT8 pDialogToken, + OUT PMEASURE_REPORT_INFO + pMeasureReportInfo, + OUT PUINT8 pReportBuf) { - PFRAME_802_11 Fr = (PFRAME_802_11)pMsg; + PFRAME_802_11 Fr = (PFRAME_802_11) pMsg; PUCHAR pFramePtr = Fr->Octet; BOOLEAN result = FALSE; PEID_STRUCT eid_ptr; @@ -1563,51 +1594,60 @@ static BOOLEAN PeerMeasureReportSanity( pFramePtr += 1; MsgLen -= 1; - eid_ptr = (PEID_STRUCT)pFramePtr; - while (((UCHAR*)eid_ptr + eid_ptr->Len + 1) < ((PUCHAR)pFramePtr + MsgLen)) - { - switch(eid_ptr->Eid) - { - case IE_MEASUREMENT_REPORT: - NdisMoveMemory(&pMeasureReportInfo->Token, eid_ptr->Octet, 1); - NdisMoveMemory(&pMeasureReportInfo->ReportMode, eid_ptr->Octet + 1, 1); - NdisMoveMemory(&pMeasureReportInfo->ReportType, eid_ptr->Octet + 2, 1); - if (pMeasureReportInfo->ReportType == RM_BASIC) - { - PMEASURE_BASIC_REPORT pReport = (PMEASURE_BASIC_REPORT)pReportBuf; - ptr = (PUCHAR)(eid_ptr->Octet + 3); - NdisMoveMemory(&pReport->ChNum, ptr, 1); - NdisMoveMemory(&pReport->MeasureStartTime, ptr + 1, 8); - NdisMoveMemory(&pReport->MeasureDuration, ptr + 9, 2); - NdisMoveMemory(&pReport->Map, ptr + 11, 1); - - } - else if (pMeasureReportInfo->ReportType == RM_CCA) - { - PMEASURE_CCA_REPORT pReport = (PMEASURE_CCA_REPORT)pReportBuf; - ptr = (PUCHAR)(eid_ptr->Octet + 3); - NdisMoveMemory(&pReport->ChNum, ptr, 1); - NdisMoveMemory(&pReport->MeasureStartTime, ptr + 1, 8); - NdisMoveMemory(&pReport->MeasureDuration, ptr + 9, 2); - NdisMoveMemory(&pReport->CCA_Busy_Fraction, ptr + 11, 1); - - } - else if (pMeasureReportInfo->ReportType == RM_RPI_HISTOGRAM) - { - PMEASURE_RPI_REPORT pReport = (PMEASURE_RPI_REPORT)pReportBuf; - ptr = (PUCHAR)(eid_ptr->Octet + 3); - NdisMoveMemory(&pReport->ChNum, ptr, 1); - NdisMoveMemory(&pReport->MeasureStartTime, ptr + 1, 8); - NdisMoveMemory(&pReport->MeasureDuration, ptr + 9, 2); - NdisMoveMemory(&pReport->RPI_Density, ptr + 11, 8); - } - result = TRUE; - break; + eid_ptr = (PEID_STRUCT) pFramePtr; + while (((UCHAR *) eid_ptr + eid_ptr->Len + 1) < + ((PUCHAR) pFramePtr + MsgLen)) { + switch (eid_ptr->Eid) { + case IE_MEASUREMENT_REPORT: + NdisMoveMemory(&pMeasureReportInfo->Token, + eid_ptr->Octet, 1); + NdisMoveMemory(&pMeasureReportInfo->ReportMode, + eid_ptr->Octet + 1, 1); + NdisMoveMemory(&pMeasureReportInfo->ReportType, + eid_ptr->Octet + 2, 1); + if (pMeasureReportInfo->ReportType == RM_BASIC) { + PMEASURE_BASIC_REPORT pReport = + (PMEASURE_BASIC_REPORT) pReportBuf; + ptr = (PUCHAR) (eid_ptr->Octet + 3); + NdisMoveMemory(&pReport->ChNum, ptr, 1); + NdisMoveMemory(&pReport->MeasureStartTime, + ptr + 1, 8); + NdisMoveMemory(&pReport->MeasureDuration, + ptr + 9, 2); + NdisMoveMemory(&pReport->Map, ptr + 11, 1); + + } else if (pMeasureReportInfo->ReportType == RM_CCA) { + PMEASURE_CCA_REPORT pReport = + (PMEASURE_CCA_REPORT) pReportBuf; + ptr = (PUCHAR) (eid_ptr->Octet + 3); + NdisMoveMemory(&pReport->ChNum, ptr, 1); + NdisMoveMemory(&pReport->MeasureStartTime, + ptr + 1, 8); + NdisMoveMemory(&pReport->MeasureDuration, + ptr + 9, 2); + NdisMoveMemory(&pReport->CCA_Busy_Fraction, + ptr + 11, 1); + + } else if (pMeasureReportInfo->ReportType == + RM_RPI_HISTOGRAM) { + PMEASURE_RPI_REPORT pReport = + (PMEASURE_RPI_REPORT) pReportBuf; + ptr = (PUCHAR) (eid_ptr->Octet + 3); + NdisMoveMemory(&pReport->ChNum, ptr, 1); + NdisMoveMemory(&pReport->MeasureStartTime, + ptr + 1, 8); + NdisMoveMemory(&pReport->MeasureDuration, + ptr + 9, 2); + NdisMoveMemory(&pReport->RPI_Density, ptr + 11, + 8); + } + result = TRUE; + break; - default: - break; + default: + break; } - eid_ptr = (PEID_STRUCT)((UCHAR*)eid_ptr + 2 + eid_ptr->Len); + eid_ptr = (PEID_STRUCT) ((UCHAR *) eid_ptr + 2 + eid_ptr->Len); } return result; @@ -1626,13 +1666,11 @@ static BOOLEAN PeerMeasureReportSanity( Return : None. ========================================================================== */ -static BOOLEAN PeerTpcReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PUINT8 pDialogToken) +static BOOLEAN PeerTpcReqSanity(IN PRTMP_ADAPTER pAd, + IN VOID * pMsg, + IN ULONG MsgLen, OUT PUINT8 pDialogToken) { - PFRAME_802_11 Fr = (PFRAME_802_11)pMsg; + PFRAME_802_11 Fr = (PFRAME_802_11) pMsg; PUCHAR pFramePtr = Fr->Octet; BOOLEAN result = FALSE; PEID_STRUCT eid_ptr; @@ -1650,19 +1688,18 @@ static BOOLEAN PeerTpcReqSanity( pFramePtr += 1; MsgLen -= 1; - eid_ptr = (PEID_STRUCT)pFramePtr; - while (((UCHAR*)eid_ptr + eid_ptr->Len + 1) < ((PUCHAR)pFramePtr + MsgLen)) - { - switch(eid_ptr->Eid) - { - case IE_TPC_REQUEST: - result = TRUE; - break; + eid_ptr = (PEID_STRUCT) pFramePtr; + while (((UCHAR *) eid_ptr + eid_ptr->Len + 1) < + ((PUCHAR) pFramePtr + MsgLen)) { + switch (eid_ptr->Eid) { + case IE_TPC_REQUEST: + result = TRUE; + break; - default: - break; + default: + break; } - eid_ptr = (PEID_STRUCT)((UCHAR*)eid_ptr + 2 + eid_ptr->Len); + eid_ptr = (PEID_STRUCT) ((UCHAR *) eid_ptr + 2 + eid_ptr->Len); } return result; @@ -1682,14 +1719,13 @@ static BOOLEAN PeerTpcReqSanity( Return : None. ========================================================================== */ -static BOOLEAN PeerTpcRepSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PUINT8 pDialogToken, - OUT PTPC_REPORT_INFO pTpcRepInfo) +static BOOLEAN PeerTpcRepSanity(IN PRTMP_ADAPTER pAd, + IN VOID * pMsg, + IN ULONG MsgLen, + OUT PUINT8 pDialogToken, + OUT PTPC_REPORT_INFO pTpcRepInfo) { - PFRAME_802_11 Fr = (PFRAME_802_11)pMsg; + PFRAME_802_11 Fr = (PFRAME_802_11) pMsg; PUCHAR pFramePtr = Fr->Octet; BOOLEAN result = FALSE; PEID_STRUCT eid_ptr; @@ -1707,21 +1743,21 @@ static BOOLEAN PeerTpcRepSanity( pFramePtr += 1; MsgLen -= 1; - eid_ptr = (PEID_STRUCT)pFramePtr; - while (((UCHAR*)eid_ptr + eid_ptr->Len + 1) < ((PUCHAR)pFramePtr + MsgLen)) - { - switch(eid_ptr->Eid) - { - case IE_TPC_REPORT: - NdisMoveMemory(&pTpcRepInfo->TxPwr, eid_ptr->Octet, 1); - NdisMoveMemory(&pTpcRepInfo->LinkMargin, eid_ptr->Octet + 1, 1); - result = TRUE; - break; - - default: - break; + eid_ptr = (PEID_STRUCT) pFramePtr; + while (((UCHAR *) eid_ptr + eid_ptr->Len + 1) < + ((PUCHAR) pFramePtr + MsgLen)) { + switch (eid_ptr->Eid) { + case IE_TPC_REPORT: + NdisMoveMemory(&pTpcRepInfo->TxPwr, eid_ptr->Octet, 1); + NdisMoveMemory(&pTpcRepInfo->LinkMargin, + eid_ptr->Octet + 1, 1); + result = TRUE; + break; + + default: + break; } - eid_ptr = (PEID_STRUCT)((UCHAR*)eid_ptr + 2 + eid_ptr->Len); + eid_ptr = (PEID_STRUCT) ((UCHAR *) eid_ptr + 2 + eid_ptr->Len); } return result; @@ -1738,64 +1774,69 @@ static BOOLEAN PeerTpcRepSanity( Return : None. ========================================================================== */ -static VOID PeerChSwAnnAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +static VOID PeerChSwAnnAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { CH_SW_ANN_INFO ChSwAnnInfo; - PFRAME_802_11 pFr = (PFRAME_802_11)Elem->Msg; + PFRAME_802_11 pFr = (PFRAME_802_11) Elem->Msg; UCHAR index = 0, Channel = 0, NewChannel = 0; ULONG Bssidx = 0; NdisZeroMemory(&ChSwAnnInfo, sizeof(CH_SW_ANN_INFO)); - if (! PeerChSwAnnSanity(pAd, Elem->Msg, Elem->MsgLen, &ChSwAnnInfo)) - { - DBGPRINT(RT_DEBUG_TRACE, ("Invalid Channel Switch Action Frame.\n")); + if (!PeerChSwAnnSanity(pAd, Elem->Msg, Elem->MsgLen, &ChSwAnnInfo)) { + DBGPRINT(RT_DEBUG_TRACE, + ("Invalid Channel Switch Action Frame.\n")); return; } - if (pAd->OpMode == OPMODE_STA) - { - Bssidx = BssTableSearch(&pAd->ScanTab, pFr->Hdr.Addr3, pAd->CommonCfg.Channel); - if (Bssidx == BSS_NOT_FOUND) - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerChSwAnnAction - Bssidx is not found\n")); + if (pAd->OpMode == OPMODE_STA) { + Bssidx = + BssTableSearch(&pAd->ScanTab, pFr->Hdr.Addr3, + pAd->CommonCfg.Channel); + if (Bssidx == BSS_NOT_FOUND) { + DBGPRINT(RT_DEBUG_TRACE, + ("PeerChSwAnnAction - Bssidx is not found\n")); return; } - DBGPRINT(RT_DEBUG_TRACE, ("\n****Bssidx is %d, Channel = %d\n", index, pAd->ScanTab.BssEntry[Bssidx].Channel)); - hex_dump("SSID",pAd->ScanTab.BssEntry[Bssidx].Bssid ,6); + DBGPRINT(RT_DEBUG_TRACE, + ("\n****Bssidx is %d, Channel = %d\n", index, + pAd->ScanTab.BssEntry[Bssidx].Channel)); + hex_dump("SSID", pAd->ScanTab.BssEntry[Bssidx].Bssid, 6); Channel = pAd->CommonCfg.Channel; NewChannel = ChSwAnnInfo.Channel; - if ((pAd->CommonCfg.bIEEE80211H == 1) && (NewChannel != 0) && (Channel != NewChannel)) - { + if ((pAd->CommonCfg.bIEEE80211H == 1) && (NewChannel != 0) + && (Channel != NewChannel)) { // Switching to channel 1 can prevent from rescanning the current channel immediately (by auto reconnection). // In addition, clear the MLME queue and the scan table to discard the RX packets and previous scanning results. AsicSwitchChannel(pAd, 1, FALSE); AsicLockChannel(pAd, 1); - LinkDown(pAd, FALSE); + LinkDown(pAd, FALSE); MlmeQueueInit(&pAd->Mlme.Queue); BssTableInit(&pAd->ScanTab); - RTMPusecDelay(1000000); // use delay to prevent STA do reassoc + RTMPusecDelay(1000000); // use delay to prevent STA do reassoc // channel sanity check - for (index = 0 ; index < pAd->ChannelListNum; index++) - { - if (pAd->ChannelList[index].Channel == NewChannel) - { - pAd->ScanTab.BssEntry[Bssidx].Channel = NewChannel; + for (index = 0; index < pAd->ChannelListNum; index++) { + if (pAd->ChannelList[index].Channel == + NewChannel) { + pAd->ScanTab.BssEntry[Bssidx].Channel = + NewChannel; pAd->CommonCfg.Channel = NewChannel; - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - DBGPRINT(RT_DEBUG_TRACE, ("&&&&&&&&&&&&&&&&PeerChSwAnnAction - STA receive channel switch announcement IE (New Channel =%d)\n", NewChannel)); + AsicSwitchChannel(pAd, + pAd->CommonCfg. + Channel, FALSE); + AsicLockChannel(pAd, + pAd->CommonCfg.Channel); + DBGPRINT(RT_DEBUG_TRACE, + ("&&&&&&&&&&&&&&&&PeerChSwAnnAction - STA receive channel switch announcement IE (New Channel =%d)\n", + NewChannel)); break; } } - if (index >= pAd->ChannelListNum) - { + if (index >= pAd->ChannelListNum) { DBGPRINT_ERR(("&&&&&&&&&&&&&&&&&&&&&&&&&&PeerChSwAnnAction(can not find New Channel=%d in ChannelList[%d]\n", pAd->CommonCfg.Channel, pAd->ChannelListNum)); } } @@ -1804,7 +1845,6 @@ static VOID PeerChSwAnnAction( return; } - /* ========================================================================== Description: @@ -1816,21 +1856,23 @@ static VOID PeerChSwAnnAction( Return : None. ========================================================================== */ -static VOID PeerMeasureReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +static VOID PeerMeasureReqAction(IN PRTMP_ADAPTER pAd, + IN MLME_QUEUE_ELEM * Elem) { - PFRAME_802_11 pFr = (PFRAME_802_11)Elem->Msg; + PFRAME_802_11 pFr = (PFRAME_802_11) Elem->Msg; UINT8 DialogToken; MEASURE_REQ_INFO MeasureReqInfo; - MEASURE_REQ MeasureReq; + MEASURE_REQ MeasureReq; MEASURE_REPORT_MODE ReportMode; - if(PeerMeasureReqSanity(pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &MeasureReqInfo, &MeasureReq)) - { + if (PeerMeasureReqSanity + (pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &MeasureReqInfo, + &MeasureReq)) { ReportMode.word = 0; ReportMode.field.Incapable = 1; - EnqueueMeasurementRep(pAd, pFr->Hdr.Addr2, DialogToken, MeasureReqInfo.Token, ReportMode.word, MeasureReqInfo.ReqType, 0, NULL); + EnqueueMeasurementRep(pAd, pFr->Hdr.Addr2, DialogToken, + MeasureReqInfo.Token, ReportMode.word, + MeasureReqInfo.ReqType, 0, NULL); } return; @@ -1847,54 +1889,65 @@ static VOID PeerMeasureReqAction( Return : None. ========================================================================== */ -static VOID PeerMeasureReportAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +static VOID PeerMeasureReportAction(IN PRTMP_ADAPTER pAd, + IN MLME_QUEUE_ELEM * Elem) { MEASURE_REPORT_INFO MeasureReportInfo; - PFRAME_802_11 pFr = (PFRAME_802_11)Elem->Msg; + PFRAME_802_11 pFr = (PFRAME_802_11) Elem->Msg; UINT8 DialogToken; PUINT8 pMeasureReportInfo; -// if (pAd->CommonCfg.bIEEE80211H != TRUE) -// return; +// if (pAd->CommonCfg.bIEEE80211H != TRUE) +// return; - if ((pMeasureReportInfo = kmalloc(sizeof(MEASURE_RPI_REPORT), GFP_ATOMIC)) == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s unable to alloc memory for measure report buffer (size=%zu).\n", __func__, sizeof(MEASURE_RPI_REPORT))); + if ((pMeasureReportInfo = + kmalloc(sizeof(MEASURE_RPI_REPORT), GFP_ATOMIC)) == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s unable to alloc memory for measure report buffer (size=%zu).\n", + __func__, sizeof(MEASURE_RPI_REPORT))); return; } NdisZeroMemory(&MeasureReportInfo, sizeof(MEASURE_REPORT_INFO)); NdisZeroMemory(pMeasureReportInfo, sizeof(MEASURE_RPI_REPORT)); - if (PeerMeasureReportSanity(pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &MeasureReportInfo, pMeasureReportInfo)) - { + if (PeerMeasureReportSanity + (pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &MeasureReportInfo, + pMeasureReportInfo)) { do { PMEASURE_REQ_ENTRY pEntry = NULL; // Not a autonomous measure report. // check the dialog token field. drop it if the dialog token doesn't match. if ((DialogToken != 0) - && ((pEntry = MeasureReqLookUp(pAd, DialogToken)) == NULL)) + && ((pEntry = MeasureReqLookUp(pAd, DialogToken)) == + NULL)) break; if (pEntry != NULL) MeasureReqDelete(pAd, pEntry->DialogToken); - if (MeasureReportInfo.ReportType == RM_BASIC) - { - PMEASURE_BASIC_REPORT pBasicReport = (PMEASURE_BASIC_REPORT)pMeasureReportInfo; + if (MeasureReportInfo.ReportType == RM_BASIC) { + PMEASURE_BASIC_REPORT pBasicReport = + (PMEASURE_BASIC_REPORT) pMeasureReportInfo; if ((pBasicReport->Map.field.Radar) - && (DfsRequirementCheck(pAd, pBasicReport->ChNum) == TRUE)) - { - NotifyChSwAnnToPeerAPs(pAd, pFr->Hdr.Addr1, pFr->Hdr.Addr2, 1, pBasicReport->ChNum); - StartDFSProcedure(pAd, pBasicReport->ChNum, 1); + && + (DfsRequirementCheck + (pAd, pBasicReport->ChNum) == TRUE)) { + NotifyChSwAnnToPeerAPs(pAd, + pFr->Hdr.Addr1, + pFr->Hdr.Addr2, + 1, + pBasicReport-> + ChNum); + StartDFSProcedure(pAd, + pBasicReport->ChNum, + 1); } } } while (FALSE); - } - else - DBGPRINT(RT_DEBUG_TRACE, ("Invalid Measurement Report Frame.\n")); + } else + DBGPRINT(RT_DEBUG_TRACE, + ("Invalid Measurement Report Frame.\n")); kfree(pMeasureReportInfo); @@ -1912,11 +1965,9 @@ static VOID PeerMeasureReportAction( Return : None. ========================================================================== */ -static VOID PeerTpcReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +static VOID PeerTpcReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - PFRAME_802_11 pFr = (PFRAME_802_11)Elem->Msg; + PFRAME_802_11 pFr = (PFRAME_802_11) Elem->Msg; PUCHAR pFramePtr = pFr->Octet; UINT8 DialogToken; UINT8 TxPwr = GetCurTxPwr(pAd, Elem->Wcid); @@ -1924,12 +1975,12 @@ static VOID PeerTpcReqAction( CHAR RealRssi; // link margin: Ratio of the received signal power to the minimum desired by the station (STA). The - // STA may incorporate rate information and channel conditions, including interference, into its computation - // of link margin. + // STA may incorporate rate information and channel conditions, including interference, into its computation + // of link margin. RealRssi = RTMPMaxRssi(pAd, ConvertToRssi(pAd, Elem->Rssi0, RSSI_0), - ConvertToRssi(pAd, Elem->Rssi1, RSSI_1), - ConvertToRssi(pAd, Elem->Rssi2, RSSI_2)); + ConvertToRssi(pAd, Elem->Rssi1, RSSI_1), + ConvertToRssi(pAd, Elem->Rssi2, RSSI_2)); // skip Category and action code. pFramePtr += 2; @@ -1939,7 +1990,8 @@ static VOID PeerTpcReqAction( LinkMargin = (RealRssi / MIN_RCV_PWR); if (PeerTpcReqSanity(pAd, Elem->Msg, Elem->MsgLen, &DialogToken)) - EnqueueTPCRep(pAd, pFr->Hdr.Addr2, DialogToken, TxPwr, LinkMargin); + EnqueueTPCRep(pAd, pFr->Hdr.Addr2, DialogToken, TxPwr, + LinkMargin); return; } @@ -1955,22 +2007,21 @@ static VOID PeerTpcReqAction( Return : None. ========================================================================== */ -static VOID PeerTpcRepAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +static VOID PeerTpcRepAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { UINT8 DialogToken; TPC_REPORT_INFO TpcRepInfo; PTPC_REQ_ENTRY pEntry = NULL; NdisZeroMemory(&TpcRepInfo, sizeof(TPC_REPORT_INFO)); - if (PeerTpcRepSanity(pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &TpcRepInfo)) - { - if ((pEntry = TpcReqLookUp(pAd, DialogToken)) != NULL) - { + if (PeerTpcRepSanity + (pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &TpcRepInfo)) { + if ((pEntry = TpcReqLookUp(pAd, DialogToken)) != NULL) { TpcReqDelete(pAd, pEntry->DialogToken); - DBGPRINT(RT_DEBUG_TRACE, ("%s: DialogToken=%x, TxPwr=%d, LinkMargin=%d\n", - __func__, DialogToken, TpcRepInfo.TxPwr, TpcRepInfo.LinkMargin)); + DBGPRINT(RT_DEBUG_TRACE, + ("%s: DialogToken=%x, TxPwr=%d, LinkMargin=%d\n", + __func__, DialogToken, TpcRepInfo.TxPwr, + TpcRepInfo.LinkMargin)); } } @@ -1989,41 +2040,37 @@ static VOID PeerTpcRepAction( Return : None. ========================================================================== */ -VOID PeerSpectrumAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerSpectrumAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Action = Elem->Msg[LENGTH_802_11+1]; + UCHAR Action = Elem->Msg[LENGTH_802_11 + 1]; if (pAd->CommonCfg.bIEEE80211H != TRUE) return; - switch(Action) - { - case SPEC_MRQ: - // current rt2860 unable do such measure specified in Measurement Request. - // reject all measurement request. - PeerMeasureReqAction(pAd, Elem); - break; + switch (Action) { + case SPEC_MRQ: + // current rt2860 unable do such measure specified in Measurement Request. + // reject all measurement request. + PeerMeasureReqAction(pAd, Elem); + break; - case SPEC_MRP: - PeerMeasureReportAction(pAd, Elem); - break; + case SPEC_MRP: + PeerMeasureReportAction(pAd, Elem); + break; - case SPEC_TPCRQ: - PeerTpcReqAction(pAd, Elem); - break; + case SPEC_TPCRQ: + PeerTpcReqAction(pAd, Elem); + break; - case SPEC_TPCRP: - PeerTpcRepAction(pAd, Elem); - break; + case SPEC_TPCRP: + PeerTpcRepAction(pAd, Elem); + break; - case SPEC_CHANNEL_SWITCH: + case SPEC_CHANNEL_SWITCH: - - PeerChSwAnnAction(pAd, Elem); - break; + PeerChSwAnnAction(pAd, Elem); + break; } return; @@ -2038,9 +2085,7 @@ VOID PeerSpectrumAction( Return : None. ========================================================================== */ -INT Set_MeasureReq_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) +INT Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg) { UINT Aid = 1; UINT ArgIdx; @@ -2059,42 +2104,43 @@ INT Set_MeasureReq_Proc( NDIS_STATUS NStatus; ULONG FrameLen; - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__)); + NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_TRACE, + ("%s() allocate memory failed \n", __func__)); goto END_OF_MEASURE_REQ; } ArgIdx = 1; - while ((thisChar = strsep((char **)&arg, "-")) != NULL) - { - switch(ArgIdx) - { - case 1: // Aid. - Aid = (UINT8) simple_strtol(thisChar, 0, 16); - break; + while ((thisChar = strsep((char **)&arg, "-")) != NULL) { + switch (ArgIdx) { + case 1: // Aid. + Aid = (UINT8) simple_strtol(thisChar, 0, 16); + break; - case 2: // Measurement Request Type. - MeasureReqType = simple_strtol(thisChar, 0, 16); - if (MeasureReqType > 3) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: unknow MeasureReqType(%d)\n", __func__, MeasureReqType)); - goto END_OF_MEASURE_REQ; - } - break; + case 2: // Measurement Request Type. + MeasureReqType = simple_strtol(thisChar, 0, 16); + if (MeasureReqType > 3) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s: unknow MeasureReqType(%d)\n", + __func__, MeasureReqType)); + goto END_OF_MEASURE_REQ; + } + break; - case 3: // Measurement channel. - MeasureCh = (UINT8) simple_strtol(thisChar, 0, 16); - break; + case 3: // Measurement channel. + MeasureCh = (UINT8) simple_strtol(thisChar, 0, 16); + break; } ArgIdx++; } - DBGPRINT(RT_DEBUG_TRACE, ("%s::Aid = %d, MeasureReqType=%d MeasureCh=%d\n", __func__, Aid, MeasureReqType, MeasureCh)); - if (!VALID_WCID(Aid)) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: unknow sta of Aid(%d)\n", __func__, Aid)); + DBGPRINT(RT_DEBUG_TRACE, + ("%s::Aid = %d, MeasureReqType=%d MeasureCh=%d\n", __func__, + Aid, MeasureReqType, MeasureCh)); + if (!VALID_WCID(Aid)) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s: unknow sta of Aid(%d)\n", __func__, Aid)); goto END_OF_MEASURE_REQ; } @@ -2104,18 +2150,18 @@ INT Set_MeasureReq_Proc( MeasureReqInsert(pAd, MeasureReqToken); // build action frame header. - MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pAd->MacTab.Content[Aid].Addr, - pAd->CurrentAddress); + MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, + pAd->MacTab.Content[Aid].Addr, pAd->CurrentAddress); - NdisMoveMemory(pOutBuffer, (PCHAR)&ActHdr, sizeof(HEADER_802_11)); + NdisMoveMemory(pOutBuffer, (PCHAR) & ActHdr, sizeof(HEADER_802_11)); FrameLen = sizeof(HEADER_802_11); TotalLen = sizeof(MEASURE_REQ_INFO) + sizeof(MEASURE_REQ); MakeMeasurementReqFrame(pAd, pOutBuffer, &FrameLen, - sizeof(MEASURE_REQ_INFO), CATEGORY_RM, RM_BASIC, - MeasureReqToken, MeasureReqMode.word, - MeasureReqType, 0); + sizeof(MEASURE_REQ_INFO), CATEGORY_RM, RM_BASIC, + MeasureReqToken, MeasureReqMode.word, + MeasureReqType, 0); MeasureReq.ChNum = MeasureCh; MeasureReq.MeasureStartTime = cpu2le64(MeasureStartTime); @@ -2123,13 +2169,13 @@ INT Set_MeasureReq_Proc( { ULONG TempLen; - MakeOutgoingFrame( pOutBuffer+FrameLen, &TempLen, - sizeof(MEASURE_REQ), &MeasureReq, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer + FrameLen, &TempLen, + sizeof(MEASURE_REQ), &MeasureReq, + END_OF_ARGS); FrameLen += TempLen; } - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, (UINT)FrameLen); + MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, (UINT) FrameLen); END_OF_MEASURE_REQ: MlmeFreeMemory(pAd, pOutBuffer); @@ -2137,9 +2183,7 @@ END_OF_MEASURE_REQ: return TRUE; } -INT Set_TpcReq_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg) +INT Set_TpcReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg) { UINT Aid; @@ -2148,9 +2192,9 @@ INT Set_TpcReq_Proc( Aid = (UINT) simple_strtol(arg, 0, 16); DBGPRINT(RT_DEBUG_TRACE, ("%s::Aid = %d\n", __func__, Aid)); - if (!VALID_WCID(Aid)) - { - DBGPRINT(RT_DEBUG_ERROR, ("%s: unknow sta of Aid(%d)\n", __func__, Aid)); + if (!VALID_WCID(Aid)) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s: unknow sta of Aid(%d)\n", __func__, Aid)); return TRUE; } @@ -2160,4 +2204,3 @@ INT Set_TpcReq_Proc( return TRUE; } - -- GitLab From 0f65bec15b2184dcf98dbdbf03187057de842eb5 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 11 Dec 2009 12:23:14 -0800 Subject: [PATCH 161/235] Staging: rt28x0: run sta/*.c files through Lindent Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/sta/assoc.c | 1579 ++++++++-------- drivers/staging/rt2860/sta/auth.c | 621 ++++--- drivers/staging/rt2860/sta/auth_rsp.c | 124 +- drivers/staging/rt2860/sta/connect.c | 2348 ++++++++++++------------ drivers/staging/rt2860/sta/rtmp_data.c | 2196 +++++++++++----------- drivers/staging/rt2860/sta/sanity.c | 489 +++-- drivers/staging/rt2860/sta/sync.c | 2094 ++++++++++++--------- drivers/staging/rt2860/sta/wpa.c | 272 ++- 8 files changed, 5085 insertions(+), 4638 deletions(-) diff --git a/drivers/staging/rt2860/sta/assoc.c b/drivers/staging/rt2860/sta/assoc.c index a67e213718d6..e9774164de2f 100644 --- a/drivers/staging/rt2860/sta/assoc.c +++ b/drivers/staging/rt2860/sta/assoc.c @@ -36,31 +36,31 @@ */ #include "../rt_config.h" -UCHAR CipherWpaTemplate[] = { - 0xdd, // WPA IE - 0x16, // Length - 0x00, 0x50, 0xf2, 0x01, // oui - 0x01, 0x00, // Version - 0x00, 0x50, 0xf2, 0x02, // Multicast - 0x01, 0x00, // Number of unicast - 0x00, 0x50, 0xf2, 0x02, // unicast - 0x01, 0x00, // number of authentication method - 0x00, 0x50, 0xf2, 0x01 // authentication - }; - -UCHAR CipherWpa2Template[] = { - 0x30, // RSN IE - 0x14, // Length - 0x01, 0x00, // Version - 0x00, 0x0f, 0xac, 0x02, // group cipher, TKIP - 0x01, 0x00, // number of pairwise - 0x00, 0x0f, 0xac, 0x02, // unicast - 0x01, 0x00, // number of authentication method - 0x00, 0x0f, 0xac, 0x02, // authentication - 0x00, 0x00, // RSN capability - }; - -UCHAR Ccx2IeInfo[] = { 0x00, 0x40, 0x96, 0x03, 0x02}; +UCHAR CipherWpaTemplate[] = { + 0xdd, // WPA IE + 0x16, // Length + 0x00, 0x50, 0xf2, 0x01, // oui + 0x01, 0x00, // Version + 0x00, 0x50, 0xf2, 0x02, // Multicast + 0x01, 0x00, // Number of unicast + 0x00, 0x50, 0xf2, 0x02, // unicast + 0x01, 0x00, // number of authentication method + 0x00, 0x50, 0xf2, 0x01 // authentication +}; + +UCHAR CipherWpa2Template[] = { + 0x30, // RSN IE + 0x14, // Length + 0x01, 0x00, // Version + 0x00, 0x0f, 0xac, 0x02, // group cipher, TKIP + 0x01, 0x00, // number of pairwise + 0x00, 0x0f, 0xac, 0x02, // unicast + 0x01, 0x00, // number of authentication method + 0x00, 0x0f, 0xac, 0x02, // authentication + 0x00, 0x00, // RSN capability +}; + +UCHAR Ccx2IeInfo[] = { 0x00, 0x40, 0x96, 0x03, 0x02 }; /* ========================================================================== @@ -73,55 +73,84 @@ UCHAR Ccx2IeInfo[] = { 0x00, 0x40, 0x96, 0x03, 0x02}; ========================================================================== */ -VOID AssocStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - OUT STATE_MACHINE_FUNC Trans[]) +VOID AssocStateMachineInit(IN PRTMP_ADAPTER pAd, + IN STATE_MACHINE * S, OUT STATE_MACHINE_FUNC Trans[]) { - StateMachineInit(S, Trans, MAX_ASSOC_STATE, MAX_ASSOC_MSG, (STATE_MACHINE_FUNC)Drop, ASSOC_IDLE, ASSOC_MACHINE_BASE); + StateMachineInit(S, Trans, MAX_ASSOC_STATE, MAX_ASSOC_MSG, + (STATE_MACHINE_FUNC) Drop, ASSOC_IDLE, + ASSOC_MACHINE_BASE); // first column - StateMachineSetAction(S, ASSOC_IDLE, MT2_MLME_ASSOC_REQ, (STATE_MACHINE_FUNC)MlmeAssocReqAction); - StateMachineSetAction(S, ASSOC_IDLE, MT2_MLME_REASSOC_REQ, (STATE_MACHINE_FUNC)MlmeReassocReqAction); - StateMachineSetAction(S, ASSOC_IDLE, MT2_MLME_DISASSOC_REQ, (STATE_MACHINE_FUNC)MlmeDisassocReqAction); - StateMachineSetAction(S, ASSOC_IDLE, MT2_PEER_DISASSOC_REQ, (STATE_MACHINE_FUNC)PeerDisassocAction); + StateMachineSetAction(S, ASSOC_IDLE, MT2_MLME_ASSOC_REQ, + (STATE_MACHINE_FUNC) MlmeAssocReqAction); + StateMachineSetAction(S, ASSOC_IDLE, MT2_MLME_REASSOC_REQ, + (STATE_MACHINE_FUNC) MlmeReassocReqAction); + StateMachineSetAction(S, ASSOC_IDLE, MT2_MLME_DISASSOC_REQ, + (STATE_MACHINE_FUNC) MlmeDisassocReqAction); + StateMachineSetAction(S, ASSOC_IDLE, MT2_PEER_DISASSOC_REQ, + (STATE_MACHINE_FUNC) PeerDisassocAction); // second column - StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_MLME_ASSOC_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenAssoc); - StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_MLME_REASSOC_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenReassoc); - StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_MLME_DISASSOC_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenDisassociate); - StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_PEER_DISASSOC_REQ, (STATE_MACHINE_FUNC)PeerDisassocAction); - StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_PEER_ASSOC_RSP, (STATE_MACHINE_FUNC)PeerAssocRspAction); + StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_MLME_ASSOC_REQ, + (STATE_MACHINE_FUNC) InvalidStateWhenAssoc); + StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_MLME_REASSOC_REQ, + (STATE_MACHINE_FUNC) InvalidStateWhenReassoc); + StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_MLME_DISASSOC_REQ, + (STATE_MACHINE_FUNC) + InvalidStateWhenDisassociate); + StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_PEER_DISASSOC_REQ, + (STATE_MACHINE_FUNC) PeerDisassocAction); + StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_PEER_ASSOC_RSP, + (STATE_MACHINE_FUNC) PeerAssocRspAction); // // Patch 3Com AP MOde:3CRWE454G72 // We send Assoc request frame to this AP, it always send Reassoc Rsp not Associate Rsp. // - StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_PEER_REASSOC_RSP, (STATE_MACHINE_FUNC)PeerAssocRspAction); - StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_ASSOC_TIMEOUT, (STATE_MACHINE_FUNC)AssocTimeoutAction); + StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_PEER_REASSOC_RSP, + (STATE_MACHINE_FUNC) PeerAssocRspAction); + StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_ASSOC_TIMEOUT, + (STATE_MACHINE_FUNC) AssocTimeoutAction); // third column - StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_MLME_ASSOC_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenAssoc); - StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_MLME_REASSOC_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenReassoc); - StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_MLME_DISASSOC_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenDisassociate); - StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_PEER_DISASSOC_REQ, (STATE_MACHINE_FUNC)PeerDisassocAction); - StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_PEER_REASSOC_RSP, (STATE_MACHINE_FUNC)PeerReassocRspAction); + StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_MLME_ASSOC_REQ, + (STATE_MACHINE_FUNC) InvalidStateWhenAssoc); + StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_MLME_REASSOC_REQ, + (STATE_MACHINE_FUNC) InvalidStateWhenReassoc); + StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_MLME_DISASSOC_REQ, + (STATE_MACHINE_FUNC) + InvalidStateWhenDisassociate); + StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_PEER_DISASSOC_REQ, + (STATE_MACHINE_FUNC) PeerDisassocAction); + StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_PEER_REASSOC_RSP, + (STATE_MACHINE_FUNC) PeerReassocRspAction); // // Patch, AP doesn't send Reassociate Rsp frame to Station. // - StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_PEER_ASSOC_RSP, (STATE_MACHINE_FUNC)PeerReassocRspAction); - StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_REASSOC_TIMEOUT, (STATE_MACHINE_FUNC)ReassocTimeoutAction); + StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_PEER_ASSOC_RSP, + (STATE_MACHINE_FUNC) PeerReassocRspAction); + StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_REASSOC_TIMEOUT, + (STATE_MACHINE_FUNC) ReassocTimeoutAction); // fourth column - StateMachineSetAction(S, DISASSOC_WAIT_RSP, MT2_MLME_ASSOC_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenAssoc); - StateMachineSetAction(S, DISASSOC_WAIT_RSP, MT2_MLME_REASSOC_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenReassoc); - StateMachineSetAction(S, DISASSOC_WAIT_RSP, MT2_MLME_DISASSOC_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenDisassociate); - StateMachineSetAction(S, DISASSOC_WAIT_RSP, MT2_PEER_DISASSOC_REQ, (STATE_MACHINE_FUNC)PeerDisassocAction); - StateMachineSetAction(S, DISASSOC_WAIT_RSP, MT2_DISASSOC_TIMEOUT, (STATE_MACHINE_FUNC)DisassocTimeoutAction); + StateMachineSetAction(S, DISASSOC_WAIT_RSP, MT2_MLME_ASSOC_REQ, + (STATE_MACHINE_FUNC) InvalidStateWhenAssoc); + StateMachineSetAction(S, DISASSOC_WAIT_RSP, MT2_MLME_REASSOC_REQ, + (STATE_MACHINE_FUNC) InvalidStateWhenReassoc); + StateMachineSetAction(S, DISASSOC_WAIT_RSP, MT2_MLME_DISASSOC_REQ, + (STATE_MACHINE_FUNC) + InvalidStateWhenDisassociate); + StateMachineSetAction(S, DISASSOC_WAIT_RSP, MT2_PEER_DISASSOC_REQ, + (STATE_MACHINE_FUNC) PeerDisassocAction); + StateMachineSetAction(S, DISASSOC_WAIT_RSP, MT2_DISASSOC_TIMEOUT, + (STATE_MACHINE_FUNC) DisassocTimeoutAction); // initialize the timer - RTMPInitTimer(pAd, &pAd->MlmeAux.AssocTimer, GET_TIMER_FUNCTION(AssocTimeout), pAd, FALSE); - RTMPInitTimer(pAd, &pAd->MlmeAux.ReassocTimer, GET_TIMER_FUNCTION(ReassocTimeout), pAd, FALSE); - RTMPInitTimer(pAd, &pAd->MlmeAux.DisassocTimer, GET_TIMER_FUNCTION(DisassocTimeout), pAd, FALSE); + RTMPInitTimer(pAd, &pAd->MlmeAux.AssocTimer, + GET_TIMER_FUNCTION(AssocTimeout), pAd, FALSE); + RTMPInitTimer(pAd, &pAd->MlmeAux.ReassocTimer, + GET_TIMER_FUNCTION(ReassocTimeout), pAd, FALSE); + RTMPInitTimer(pAd, &pAd->MlmeAux.DisassocTimer, + GET_TIMER_FUNCTION(DisassocTimeout), pAd, FALSE); } /* @@ -137,15 +166,15 @@ VOID AssocStateMachineInit( ========================================================================== */ VOID AssocTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; + RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; // Do nothing if the driver is starting halt state. // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + if (RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_ASSOC_TIMEOUT, 0, NULL); @@ -165,15 +194,15 @@ VOID AssocTimeout(IN PVOID SystemSpecific1, ========================================================================== */ VOID ReassocTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; + RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; // Do nothing if the driver is starting halt state. // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + if (RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_REASSOC_TIMEOUT, 0, NULL); @@ -193,15 +222,15 @@ VOID ReassocTimeout(IN PVOID SystemSpecific1, ========================================================================== */ VOID DisassocTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; + RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; // Do nothing if the driver is starting halt state. // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + if (RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_DISASSOC_TIMEOUT, 0, NULL); @@ -230,136 +259,145 @@ VOID DisassocTimeout(IN PVOID SystemSpecific1, ========================================================================== */ -VOID MlmeAssocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR ApAddr[6]; - HEADER_802_11 AssocHdr; - UCHAR WmeIe[9] = {IE_VENDOR_SPECIFIC, 0x07, 0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00}; - USHORT ListenIntv; - ULONG Timeout; - USHORT CapabilityInfo; - BOOLEAN TimerCancelled; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - ULONG tmp; - USHORT VarIesOffset; - USHORT Status; + UCHAR ApAddr[6]; + HEADER_802_11 AssocHdr; + UCHAR WmeIe[9] = + { IE_VENDOR_SPECIFIC, 0x07, 0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, + 0x00 }; + USHORT ListenIntv; + ULONG Timeout; + USHORT CapabilityInfo; + BOOLEAN TimerCancelled; + PUCHAR pOutBuffer = NULL; + NDIS_STATUS NStatus; + ULONG FrameLen = 0; + ULONG tmp; + USHORT VarIesOffset; + USHORT Status; // Block all authentication request durning WPA block period - if (pAd->StaCfg.bBlockAssoc == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - Block Assoc request durning WPA block period!\n")); + if (pAd->StaCfg.bBlockAssoc == TRUE) { + DBGPRINT(RT_DEBUG_TRACE, + ("ASSOC - Block Assoc request durning WPA block period!\n")); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; Status = MLME_STATE_MACHINE_REJECT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_ASSOC_CONF, 2, &Status); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_ASSOC_CONF, 2, + &Status); } // check sanity first - else if (MlmeAssocReqSanity(pAd, Elem->Msg, Elem->MsgLen, ApAddr, &CapabilityInfo, &Timeout, &ListenIntv)) - { + else if (MlmeAssocReqSanity + (pAd, Elem->Msg, Elem->MsgLen, ApAddr, &CapabilityInfo, + &Timeout, &ListenIntv)) { RTMPCancelTimer(&pAd->MlmeAux.AssocTimer, &TimerCancelled); COPY_MAC_ADDR(pAd->MlmeAux.Bssid, ApAddr); // Get an unused nonpaged memory NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE,("ASSOC - MlmeAssocReqAction() allocate memory failed \n")); + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_TRACE, + ("ASSOC - MlmeAssocReqAction() allocate memory failed \n")); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; Status = MLME_FAIL_NO_RESOURCE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_ASSOC_CONF, 2, &Status); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, + MT2_ASSOC_CONF, 2, &Status); return; } - // Add by James 03/06/27 - pAd->StaCfg.AssocInfo.Length = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); + pAd->StaCfg.AssocInfo.Length = + sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); // Association don't need to report MAC address pAd->StaCfg.AssocInfo.AvailableRequestFixedIEs = - NDIS_802_11_AI_REQFI_CAPABILITIES | NDIS_802_11_AI_REQFI_LISTENINTERVAL; - pAd->StaCfg.AssocInfo.RequestFixedIEs.Capabilities = CapabilityInfo; - pAd->StaCfg.AssocInfo.RequestFixedIEs.ListenInterval = ListenIntv; + NDIS_802_11_AI_REQFI_CAPABILITIES | + NDIS_802_11_AI_REQFI_LISTENINTERVAL; + pAd->StaCfg.AssocInfo.RequestFixedIEs.Capabilities = + CapabilityInfo; + pAd->StaCfg.AssocInfo.RequestFixedIEs.ListenInterval = + ListenIntv; // Only reassociate need this //COPY_MAC_ADDR(pAd->StaCfg.AssocInfo.RequestFixedIEs.CurrentAPAddress, ApAddr); - pAd->StaCfg.AssocInfo.OffsetRequestIEs = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); + pAd->StaCfg.AssocInfo.OffsetRequestIEs = + sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); - NdisZeroMemory(pAd->StaCfg.ReqVarIEs, MAX_VIE_LEN); + NdisZeroMemory(pAd->StaCfg.ReqVarIEs, MAX_VIE_LEN); // First add SSID VarIesOffset = 0; - NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &SsidIe, 1); + NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &SsidIe, + 1); VarIesOffset += 1; - NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &pAd->MlmeAux.SsidLen, 1); + NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, + &pAd->MlmeAux.SsidLen, 1); VarIesOffset += 1; - NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); + NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, + pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); VarIesOffset += pAd->MlmeAux.SsidLen; // Second add Supported rates - NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &SupRateIe, 1); + NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &SupRateIe, + 1); VarIesOffset += 1; - NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &pAd->MlmeAux.SupRateLen, 1); + NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, + &pAd->MlmeAux.SupRateLen, 1); VarIesOffset += 1; - NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, pAd->MlmeAux.SupRate, pAd->MlmeAux.SupRateLen); + NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, + pAd->MlmeAux.SupRate, pAd->MlmeAux.SupRateLen); VarIesOffset += pAd->MlmeAux.SupRateLen; // End Add by James - if ((pAd->CommonCfg.Channel > 14) && - (pAd->CommonCfg.bIEEE80211H == TRUE)) - CapabilityInfo |= 0x0100; + if ((pAd->CommonCfg.Channel > 14) && + (pAd->CommonCfg.bIEEE80211H == TRUE)) + CapabilityInfo |= 0x0100; DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - Send ASSOC request...\n")); - MgtMacHeaderInit(pAd, &AssocHdr, SUBTYPE_ASSOC_REQ, 0, ApAddr, ApAddr); + MgtMacHeaderInit(pAd, &AssocHdr, SUBTYPE_ASSOC_REQ, 0, ApAddr, + ApAddr); // Build basic frame first - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &AssocHdr, - 2, &CapabilityInfo, - 2, &ListenIntv, - 1, &SsidIe, - 1, &pAd->MlmeAux.SsidLen, - pAd->MlmeAux.SsidLen, pAd->MlmeAux.Ssid, - 1, &SupRateIe, - 1, &pAd->MlmeAux.SupRateLen, - pAd->MlmeAux.SupRateLen, pAd->MlmeAux.SupRate, - END_OF_ARGS); - - if (pAd->MlmeAux.ExtRateLen != 0) - { - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 1, &ExtRateIe, - 1, &pAd->MlmeAux.ExtRateLen, - pAd->MlmeAux.ExtRateLen, pAd->MlmeAux.ExtRate, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer, &FrameLen, + sizeof(HEADER_802_11), &AssocHdr, + 2, &CapabilityInfo, + 2, &ListenIntv, + 1, &SsidIe, + 1, &pAd->MlmeAux.SsidLen, + pAd->MlmeAux.SsidLen, pAd->MlmeAux.Ssid, + 1, &SupRateIe, + 1, &pAd->MlmeAux.SupRateLen, + pAd->MlmeAux.SupRateLen, pAd->MlmeAux.SupRate, + END_OF_ARGS); + + if (pAd->MlmeAux.ExtRateLen != 0) { + MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, + 1, &ExtRateIe, + 1, &pAd->MlmeAux.ExtRateLen, + pAd->MlmeAux.ExtRateLen, + pAd->MlmeAux.ExtRate, END_OF_ARGS); FrameLen += tmp; } - // HT - if ((pAd->MlmeAux.HtCapabilityLen > 0) && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) - { + if ((pAd->MlmeAux.HtCapabilityLen > 0) + && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) { ULONG TmpLen; UCHAR HtLen; - UCHAR BROADCOM[4] = {0x0, 0x90, 0x4c, 0x33}; - if (pAd->StaActive.SupportedPhyInfo.bPreNHt == TRUE) - { + UCHAR BROADCOM[4] = { 0x0, 0x90, 0x4c, 0x33 }; + if (pAd->StaActive.SupportedPhyInfo.bPreNHt == TRUE) { HtLen = SIZE_HT_CAP_IE + 4; - MakeOutgoingFrame(pOutBuffer + FrameLen, &TmpLen, - 1, &WpaIe, - 1, &HtLen, - 4, &BROADCOM[0], - pAd->MlmeAux.HtCapabilityLen, &pAd->MlmeAux.HtCapability, - END_OF_ARGS); - } - else - { - MakeOutgoingFrame(pOutBuffer + FrameLen, &TmpLen, - 1, &HtCapIe, - 1, &pAd->MlmeAux.HtCapabilityLen, - pAd->MlmeAux.HtCapabilityLen, &pAd->MlmeAux.HtCapability, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer + FrameLen, + &TmpLen, 1, &WpaIe, 1, &HtLen, + 4, &BROADCOM[0], + pAd->MlmeAux.HtCapabilityLen, + &pAd->MlmeAux.HtCapability, + END_OF_ARGS); + } else { + MakeOutgoingFrame(pOutBuffer + FrameLen, + &TmpLen, 1, &HtCapIe, 1, + &pAd->MlmeAux.HtCapabilityLen, + pAd->MlmeAux.HtCapabilityLen, + &pAd->MlmeAux.HtCapability, + END_OF_ARGS); } FrameLen += TmpLen; } - // add Ralink proprietary IE to inform AP this STA is going to use AGGREGATION or PIGGY-BACK+AGGREGATION // Case I: (Aggregation + Piggy-Back) // 1. user enable aggregation, AND @@ -368,63 +406,60 @@ VOID MlmeAssocReqAction( // Case II: (Aggregation) // 1. user enable aggregation, AND // 2. AP annouces it's AGGREGATION-capable in BEACON - if (pAd->CommonCfg.bAggregationCapable) - { - if ((pAd->CommonCfg.bPiggyBackCapable) && ((pAd->MlmeAux.APRalinkIe & 0x00000003) == 3)) - { + if (pAd->CommonCfg.bAggregationCapable) { + if ((pAd->CommonCfg.bPiggyBackCapable) + && ((pAd->MlmeAux.APRalinkIe & 0x00000003) == 3)) { ULONG TmpLen; - UCHAR RalinkIe[9] = {IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x03, 0x00, 0x00, 0x00}; - MakeOutgoingFrame(pOutBuffer+FrameLen, &TmpLen, - 9, RalinkIe, - END_OF_ARGS); + UCHAR RalinkIe[9] = + { IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, + 0x03, 0x00, 0x00, 0x00 }; + MakeOutgoingFrame(pOutBuffer + FrameLen, + &TmpLen, 9, RalinkIe, + END_OF_ARGS); FrameLen += TmpLen; - } - else if (pAd->MlmeAux.APRalinkIe & 0x00000001) - { + } else if (pAd->MlmeAux.APRalinkIe & 0x00000001) { ULONG TmpLen; - UCHAR RalinkIe[9] = {IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x01, 0x00, 0x00, 0x00}; - MakeOutgoingFrame(pOutBuffer+FrameLen, &TmpLen, - 9, RalinkIe, - END_OF_ARGS); + UCHAR RalinkIe[9] = + { IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, + 0x01, 0x00, 0x00, 0x00 }; + MakeOutgoingFrame(pOutBuffer + FrameLen, + &TmpLen, 9, RalinkIe, + END_OF_ARGS); FrameLen += TmpLen; } - } - else - { + } else { ULONG TmpLen; - UCHAR RalinkIe[9] = {IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x06, 0x00, 0x00, 0x00}; - MakeOutgoingFrame(pOutBuffer+FrameLen, &TmpLen, - 9, RalinkIe, - END_OF_ARGS); + UCHAR RalinkIe[9] = + { IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x06, + 0x00, 0x00, 0x00 }; + MakeOutgoingFrame(pOutBuffer + FrameLen, &TmpLen, 9, + RalinkIe, END_OF_ARGS); FrameLen += TmpLen; } - if (pAd->MlmeAux.APEdcaParm.bValid) - { - if (pAd->CommonCfg.bAPSDCapable && pAd->MlmeAux.APEdcaParm.bAPSDCapable) - { + if (pAd->MlmeAux.APEdcaParm.bValid) { + if (pAd->CommonCfg.bAPSDCapable + && pAd->MlmeAux.APEdcaParm.bAPSDCapable) { QBSS_STA_INFO_PARM QosInfo; - NdisZeroMemory(&QosInfo, sizeof(QBSS_STA_INFO_PARM)); + NdisZeroMemory(&QosInfo, + sizeof(QBSS_STA_INFO_PARM)); QosInfo.UAPSD_AC_BE = pAd->CommonCfg.bAPSDAC_BE; QosInfo.UAPSD_AC_BK = pAd->CommonCfg.bAPSDAC_BK; QosInfo.UAPSD_AC_VI = pAd->CommonCfg.bAPSDAC_VI; QosInfo.UAPSD_AC_VO = pAd->CommonCfg.bAPSDAC_VO; - QosInfo.MaxSPLength = pAd->CommonCfg.MaxSPLength; - WmeIe[8] |= *(PUCHAR)&QosInfo; - } - else - { - // The Parameter Set Count is set to ¡§0¡¨ in the association request frames - // WmeIe[8] |= (pAd->MlmeAux.APEdcaParm.EdcaUpdateCount & 0x0f); + QosInfo.MaxSPLength = + pAd->CommonCfg.MaxSPLength; + WmeIe[8] |= *(PUCHAR) & QosInfo; + } else { + // The Parameter Set Count is set to ¡§0¡¨ in the association request frames + // WmeIe[8] |= (pAd->MlmeAux.APEdcaParm.EdcaUpdateCount & 0x0f); } - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 9, &WmeIe[0], - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, + 9, &WmeIe[0], END_OF_ARGS); FrameLen += tmp; } - // // Let WPA(#221) Element ID on the end of this association frame. // Otherwise some AP will fail on parsing Element ID and set status fail on Assoc Rsp. @@ -432,94 +467,107 @@ VOID MlmeAssocReqAction( // This happens on AP (Model No:Linksys WRK54G) // if (((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) - ) - ) - { + (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) || + (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || + (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) + ) + ) { UCHAR RSNIe = IE_WPA; - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2)) - { + if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) + || (pAd->StaCfg.AuthMode == + Ndis802_11AuthModeWPA2)) { RSNIe = IE_WPA2; } - if ((pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_ENABLE) && - (pAd->StaCfg.bRSN_IE_FromWpaSupplicant == FALSE)) - RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, BSS0); + if ((pAd->StaCfg.WpaSupplicantUP != + WPA_SUPPLICANT_ENABLE) + && (pAd->StaCfg.bRSN_IE_FromWpaSupplicant == FALSE)) + RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, + pAd->StaCfg.WepStatus, BSS0); - // Check for WPA PMK cache list - if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) - { - INT idx; - BOOLEAN FoundPMK = FALSE; + // Check for WPA PMK cache list + if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) { + INT idx; + BOOLEAN FoundPMK = FALSE; // Search chched PMKID, append it if existed - for (idx = 0; idx < PMKID_NO; idx++) - { - if (NdisEqualMemory(ApAddr, &pAd->StaCfg.SavedPMK[idx].BSSID, 6)) - { + for (idx = 0; idx < PMKID_NO; idx++) { + if (NdisEqualMemory + (ApAddr, + &pAd->StaCfg.SavedPMK[idx].BSSID, + 6)) { FoundPMK = TRUE; break; } } - if (FoundPMK) - { + if (FoundPMK) { // Set PMK number - *(PUSHORT) &pAd->StaCfg.RSN_IE[pAd->StaCfg.RSNIE_Len] = 1; - NdisMoveMemory(&pAd->StaCfg.RSN_IE[pAd->StaCfg.RSNIE_Len + 2], &pAd->StaCfg.SavedPMK[idx].PMKID, 16); - pAd->StaCfg.RSNIE_Len += 18; + *(PUSHORT) & pAd->StaCfg.RSN_IE[pAd-> + StaCfg. + RSNIE_Len] + = 1; + NdisMoveMemory(&pAd->StaCfg. + RSN_IE[pAd->StaCfg. + RSNIE_Len + 2], + &pAd->StaCfg. + SavedPMK[idx].PMKID, 16); + pAd->StaCfg.RSNIE_Len += 18; } } - if ((pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) && - (pAd->StaCfg.bRSN_IE_FromWpaSupplicant == TRUE)) - { - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - pAd->StaCfg.RSNIE_Len, pAd->StaCfg.RSN_IE, - END_OF_ARGS); - } - else - { - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 1, &RSNIe, - 1, &pAd->StaCfg.RSNIE_Len, - pAd->StaCfg.RSNIE_Len, pAd->StaCfg.RSN_IE, - END_OF_ARGS); + if ((pAd->StaCfg.WpaSupplicantUP == + WPA_SUPPLICANT_ENABLE) + && (pAd->StaCfg.bRSN_IE_FromWpaSupplicant == + TRUE)) { + MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, + pAd->StaCfg.RSNIE_Len, + pAd->StaCfg.RSN_IE, + END_OF_ARGS); + } else { + MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, + 1, &RSNIe, + 1, &pAd->StaCfg.RSNIE_Len, + pAd->StaCfg.RSNIE_Len, + pAd->StaCfg.RSN_IE, + END_OF_ARGS); } FrameLen += tmp; - if ((pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_ENABLE) || - (pAd->StaCfg.bRSN_IE_FromWpaSupplicant == FALSE)) - { - // Append Variable IE - NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &RSNIe, 1); - VarIesOffset += 1; - NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &pAd->StaCfg.RSNIE_Len, 1); - VarIesOffset += 1; + if ((pAd->StaCfg.WpaSupplicantUP != + WPA_SUPPLICANT_ENABLE) + || (pAd->StaCfg.bRSN_IE_FromWpaSupplicant == + FALSE)) { + // Append Variable IE + NdisMoveMemory(pAd->StaCfg.ReqVarIEs + + VarIesOffset, &RSNIe, 1); + VarIesOffset += 1; + NdisMoveMemory(pAd->StaCfg.ReqVarIEs + + VarIesOffset, + &pAd->StaCfg.RSNIE_Len, 1); + VarIesOffset += 1; } - NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, pAd->StaCfg.RSN_IE, pAd->StaCfg.RSNIE_Len); + NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, + pAd->StaCfg.RSN_IE, + pAd->StaCfg.RSNIE_Len); VarIesOffset += pAd->StaCfg.RSNIE_Len; // Set Variable IEs Length pAd->StaCfg.ReqVarIELen = VarIesOffset; } - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); RTMPSetTimer(&pAd->MlmeAux.AssocTimer, Timeout); pAd->Mlme.AssocMachine.CurrState = ASSOC_WAIT_RSP; - } - else - { - DBGPRINT(RT_DEBUG_TRACE,("ASSOC - MlmeAssocReqAction() sanity check failed. BUG!!!!!! \n")); + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("ASSOC - MlmeAssocReqAction() sanity check failed. BUG!!!!!! \n")); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; Status = MLME_INVALID_FORMAT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_ASSOC_CONF, 2, &Status); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_ASSOC_CONF, 2, + &Status); } } @@ -541,121 +589,117 @@ VOID MlmeAssocReqAction( ========================================================================== */ -VOID MlmeReassocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR ApAddr[6]; - HEADER_802_11 ReassocHdr; - UCHAR WmeIe[9] = {IE_VENDOR_SPECIFIC, 0x07, 0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00}; - USHORT CapabilityInfo, ListenIntv; - ULONG Timeout; - ULONG FrameLen = 0; - BOOLEAN TimerCancelled; - NDIS_STATUS NStatus; - ULONG tmp; - PUCHAR pOutBuffer = NULL; - USHORT Status; + UCHAR ApAddr[6]; + HEADER_802_11 ReassocHdr; + UCHAR WmeIe[9] = + { IE_VENDOR_SPECIFIC, 0x07, 0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, + 0x00 }; + USHORT CapabilityInfo, ListenIntv; + ULONG Timeout; + ULONG FrameLen = 0; + BOOLEAN TimerCancelled; + NDIS_STATUS NStatus; + ULONG tmp; + PUCHAR pOutBuffer = NULL; + USHORT Status; // Block all authentication request durning WPA block period - if (pAd->StaCfg.bBlockAssoc == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - Block ReAssoc request durning WPA block period!\n")); + if (pAd->StaCfg.bBlockAssoc == TRUE) { + DBGPRINT(RT_DEBUG_TRACE, + ("ASSOC - Block ReAssoc request durning WPA block period!\n")); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; Status = MLME_STATE_MACHINE_REJECT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, &Status); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, + &Status); } // the parameters are the same as the association - else if(MlmeAssocReqSanity(pAd, Elem->Msg, Elem->MsgLen, ApAddr, &CapabilityInfo, &Timeout, &ListenIntv)) - { + else if (MlmeAssocReqSanity + (pAd, Elem->Msg, Elem->MsgLen, ApAddr, &CapabilityInfo, + &Timeout, &ListenIntv)) { RTMPCancelTimer(&pAd->MlmeAux.ReassocTimer, &TimerCancelled); - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE,("ASSOC - MlmeReassocReqAction() allocate memory failed \n")); + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_TRACE, + ("ASSOC - MlmeReassocReqAction() allocate memory failed \n")); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; Status = MLME_FAIL_NO_RESOURCE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, &Status); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, + MT2_REASSOC_CONF, 2, &Status); return; } COPY_MAC_ADDR(pAd->MlmeAux.Bssid, ApAddr); // make frame, use bssid as the AP address?? - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - Send RE-ASSOC request...\n")); - MgtMacHeaderInit(pAd, &ReassocHdr, SUBTYPE_REASSOC_REQ, 0, ApAddr, ApAddr); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &ReassocHdr, - 2, &CapabilityInfo, - 2, &ListenIntv, - MAC_ADDR_LEN, ApAddr, - 1, &SsidIe, - 1, &pAd->MlmeAux.SsidLen, - pAd->MlmeAux.SsidLen, pAd->MlmeAux.Ssid, - 1, &SupRateIe, - 1, &pAd->MlmeAux.SupRateLen, - pAd->MlmeAux.SupRateLen, pAd->MlmeAux.SupRate, - END_OF_ARGS); - - if (pAd->MlmeAux.ExtRateLen != 0) - { - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 1, &ExtRateIe, - 1, &pAd->MlmeAux.ExtRateLen, - pAd->MlmeAux.ExtRateLen, pAd->MlmeAux.ExtRate, - END_OF_ARGS); + DBGPRINT(RT_DEBUG_TRACE, + ("ASSOC - Send RE-ASSOC request...\n")); + MgtMacHeaderInit(pAd, &ReassocHdr, SUBTYPE_REASSOC_REQ, 0, + ApAddr, ApAddr); + MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(HEADER_802_11), + &ReassocHdr, 2, &CapabilityInfo, 2, + &ListenIntv, MAC_ADDR_LEN, ApAddr, 1, &SsidIe, + 1, &pAd->MlmeAux.SsidLen, + pAd->MlmeAux.SsidLen, pAd->MlmeAux.Ssid, 1, + &SupRateIe, 1, &pAd->MlmeAux.SupRateLen, + pAd->MlmeAux.SupRateLen, pAd->MlmeAux.SupRate, + END_OF_ARGS); + + if (pAd->MlmeAux.ExtRateLen != 0) { + MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, + 1, &ExtRateIe, + 1, &pAd->MlmeAux.ExtRateLen, + pAd->MlmeAux.ExtRateLen, + pAd->MlmeAux.ExtRate, END_OF_ARGS); FrameLen += tmp; } - if (pAd->MlmeAux.APEdcaParm.bValid) - { - if (pAd->CommonCfg.bAPSDCapable && pAd->MlmeAux.APEdcaParm.bAPSDCapable) - { + if (pAd->MlmeAux.APEdcaParm.bValid) { + if (pAd->CommonCfg.bAPSDCapable + && pAd->MlmeAux.APEdcaParm.bAPSDCapable) { QBSS_STA_INFO_PARM QosInfo; - NdisZeroMemory(&QosInfo, sizeof(QBSS_STA_INFO_PARM)); + NdisZeroMemory(&QosInfo, + sizeof(QBSS_STA_INFO_PARM)); QosInfo.UAPSD_AC_BE = pAd->CommonCfg.bAPSDAC_BE; QosInfo.UAPSD_AC_BK = pAd->CommonCfg.bAPSDAC_BK; QosInfo.UAPSD_AC_VI = pAd->CommonCfg.bAPSDAC_VI; QosInfo.UAPSD_AC_VO = pAd->CommonCfg.bAPSDAC_VO; - QosInfo.MaxSPLength = pAd->CommonCfg.MaxSPLength; - WmeIe[8] |= *(PUCHAR)&QosInfo; + QosInfo.MaxSPLength = + pAd->CommonCfg.MaxSPLength; + WmeIe[8] |= *(PUCHAR) & QosInfo; } - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 9, &WmeIe[0], - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, + 9, &WmeIe[0], END_OF_ARGS); FrameLen += tmp; } - // HT - if ((pAd->MlmeAux.HtCapabilityLen > 0) && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) - { + if ((pAd->MlmeAux.HtCapabilityLen > 0) + && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) { ULONG TmpLen; UCHAR HtLen; - UCHAR BROADCOM[4] = {0x0, 0x90, 0x4c, 0x33}; - if (pAd->StaActive.SupportedPhyInfo.bPreNHt == TRUE) - { + UCHAR BROADCOM[4] = { 0x0, 0x90, 0x4c, 0x33 }; + if (pAd->StaActive.SupportedPhyInfo.bPreNHt == TRUE) { HtLen = SIZE_HT_CAP_IE + 4; - MakeOutgoingFrame(pOutBuffer + FrameLen, &TmpLen, - 1, &WpaIe, - 1, &HtLen, - 4, &BROADCOM[0], - pAd->MlmeAux.HtCapabilityLen, &pAd->MlmeAux.HtCapability, - END_OF_ARGS); - } - else - { - MakeOutgoingFrame(pOutBuffer + FrameLen, &TmpLen, - 1, &HtCapIe, - 1, &pAd->MlmeAux.HtCapabilityLen, - pAd->MlmeAux.HtCapabilityLen, &pAd->MlmeAux.HtCapability, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer + FrameLen, + &TmpLen, 1, &WpaIe, 1, &HtLen, + 4, &BROADCOM[0], + pAd->MlmeAux.HtCapabilityLen, + &pAd->MlmeAux.HtCapability, + END_OF_ARGS); + } else { + MakeOutgoingFrame(pOutBuffer + FrameLen, + &TmpLen, 1, &HtCapIe, 1, + &pAd->MlmeAux.HtCapabilityLen, + pAd->MlmeAux.HtCapabilityLen, + &pAd->MlmeAux.HtCapability, + END_OF_ARGS); } FrameLen += TmpLen; } - // add Ralink proprietary IE to inform AP this STA is going to use AGGREGATION or PIGGY-BACK+AGGREGATION // Case I: (Aggregation + Piggy-Back) // 1. user enable aggregation, AND @@ -664,49 +708,49 @@ VOID MlmeReassocReqAction( // Case II: (Aggregation) // 1. user enable aggregation, AND // 2. AP annouces it's AGGREGATION-capable in BEACON - if (pAd->CommonCfg.bAggregationCapable) - { - if ((pAd->CommonCfg.bPiggyBackCapable) && ((pAd->MlmeAux.APRalinkIe & 0x00000003) == 3)) - { + if (pAd->CommonCfg.bAggregationCapable) { + if ((pAd->CommonCfg.bPiggyBackCapable) + && ((pAd->MlmeAux.APRalinkIe & 0x00000003) == 3)) { ULONG TmpLen; - UCHAR RalinkIe[9] = {IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x03, 0x00, 0x00, 0x00}; - MakeOutgoingFrame(pOutBuffer+FrameLen, &TmpLen, - 9, RalinkIe, - END_OF_ARGS); + UCHAR RalinkIe[9] = + { IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, + 0x03, 0x00, 0x00, 0x00 }; + MakeOutgoingFrame(pOutBuffer + FrameLen, + &TmpLen, 9, RalinkIe, + END_OF_ARGS); FrameLen += TmpLen; - } - else if (pAd->MlmeAux.APRalinkIe & 0x00000001) - { + } else if (pAd->MlmeAux.APRalinkIe & 0x00000001) { ULONG TmpLen; - UCHAR RalinkIe[9] = {IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x01, 0x00, 0x00, 0x00}; - MakeOutgoingFrame(pOutBuffer+FrameLen, &TmpLen, - 9, RalinkIe, - END_OF_ARGS); + UCHAR RalinkIe[9] = + { IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, + 0x01, 0x00, 0x00, 0x00 }; + MakeOutgoingFrame(pOutBuffer + FrameLen, + &TmpLen, 9, RalinkIe, + END_OF_ARGS); FrameLen += TmpLen; } - } - else - { + } else { ULONG TmpLen; - UCHAR RalinkIe[9] = {IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x04, 0x00, 0x00, 0x00}; - MakeOutgoingFrame(pOutBuffer+FrameLen, &TmpLen, - 9, RalinkIe, - END_OF_ARGS); + UCHAR RalinkIe[9] = + { IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x04, + 0x00, 0x00, 0x00 }; + MakeOutgoingFrame(pOutBuffer + FrameLen, &TmpLen, 9, + RalinkIe, END_OF_ARGS); FrameLen += TmpLen; } MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); - RTMPSetTimer(&pAd->MlmeAux.ReassocTimer, Timeout); /* in mSec */ + RTMPSetTimer(&pAd->MlmeAux.ReassocTimer, Timeout); /* in mSec */ pAd->Mlme.AssocMachine.CurrState = REASSOC_WAIT_RSP; - } - else - { - DBGPRINT(RT_DEBUG_TRACE,("ASSOC - MlmeReassocReqAction() sanity check failed. BUG!!!! \n")); + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("ASSOC - MlmeReassocReqAction() sanity check failed. BUG!!!! \n")); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; Status = MLME_INVALID_FORMAT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, &Status); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, + &Status); } } @@ -721,52 +765,50 @@ VOID MlmeReassocReqAction( ========================================================================== */ -VOID MlmeDisassocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID MlmeDisassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { PMLME_DISASSOC_REQ_STRUCT pDisassocReq; - HEADER_802_11 DisassocHdr; - PHEADER_802_11 pDisassocHdr; - PUCHAR pOutBuffer = NULL; - ULONG FrameLen = 0; - NDIS_STATUS NStatus; - BOOLEAN TimerCancelled; - ULONG Timeout = 500; - USHORT Status; - + HEADER_802_11 DisassocHdr; + PHEADER_802_11 pDisassocHdr; + PUCHAR pOutBuffer = NULL; + ULONG FrameLen = 0; + NDIS_STATUS NStatus; + BOOLEAN TimerCancelled; + ULONG Timeout = 500; + USHORT Status; // skip sanity check - pDisassocReq = (PMLME_DISASSOC_REQ_STRUCT)(Elem->Msg); + pDisassocReq = (PMLME_DISASSOC_REQ_STRUCT) (Elem->Msg); - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - MlmeDisassocReqAction() allocate memory failed\n")); + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_TRACE, + ("ASSOC - MlmeDisassocReqAction() allocate memory failed\n")); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; Status = MLME_FAIL_NO_RESOURCE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DISASSOC_CONF, 2, &Status); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DISASSOC_CONF, 2, + &Status); return; } - - RTMPCancelTimer(&pAd->MlmeAux.DisassocTimer, &TimerCancelled); - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - Send DISASSOC request[BSSID::%02x:%02x:%02x:%02x:%02x:%02x (Reason=%d)\n", - pDisassocReq->Addr[0], pDisassocReq->Addr[1], pDisassocReq->Addr[2], - pDisassocReq->Addr[3], pDisassocReq->Addr[4], pDisassocReq->Addr[5], pDisassocReq->Reason)); + DBGPRINT(RT_DEBUG_TRACE, + ("ASSOC - Send DISASSOC request[BSSID::%02x:%02x:%02x:%02x:%02x:%02x (Reason=%d)\n", + pDisassocReq->Addr[0], pDisassocReq->Addr[1], + pDisassocReq->Addr[2], pDisassocReq->Addr[3], + pDisassocReq->Addr[4], pDisassocReq->Addr[5], + pDisassocReq->Reason)); MgtMacHeaderInit(pAd, &DisassocHdr, SUBTYPE_DISASSOC, 0, pDisassocReq->Addr, pDisassocReq->Addr); // patch peap ttls switching issue - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11),&DisassocHdr, - 2, &pDisassocReq->Reason, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer, &FrameLen, + sizeof(HEADER_802_11), &DisassocHdr, + 2, &pDisassocReq->Reason, END_OF_ARGS); MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); // To patch Instance and Buffalo(N) AP // Driver has to send deauth to Instance AP, but Buffalo(N) needs to send disassoc to reset Authenticator's state machine // Therefore, we send both of them. - pDisassocHdr = (PHEADER_802_11)pOutBuffer; + pDisassocHdr = (PHEADER_802_11) pOutBuffer; pDisassocHdr->FC.SubType = SUBTYPE_DEAUTH; MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); @@ -775,10 +817,9 @@ VOID MlmeDisassocReqAction( pAd->StaCfg.DisassocReason = REASON_DISASSOC_STA_LEAVING; COPY_MAC_ADDR(pAd->StaCfg.DisassocSta, pDisassocReq->Addr); - RTMPSetTimer(&pAd->MlmeAux.DisassocTimer, Timeout); /* in mSec */ + RTMPSetTimer(&pAd->MlmeAux.DisassocTimer, Timeout); /* in mSec */ pAd->Mlme.AssocMachine.CurrState = DISASSOC_WAIT_RSP; - RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0); } @@ -794,71 +835,81 @@ VOID MlmeDisassocReqAction( ========================================================================== */ -VOID PeerAssocRspAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerAssocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT CapabilityInfo, Status, Aid; - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], SupRateLen; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRateLen; - UCHAR Addr2[MAC_ADDR_LEN]; - BOOLEAN TimerCancelled; - UCHAR CkipFlag; - EDCA_PARM EdcaParm; - HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE - UCHAR HtCapabilityLen = 0; - UCHAR AddHtInfoLen; - UCHAR NewExtChannelOffset = 0xff; - - if (PeerAssocRspSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &CapabilityInfo, &Status, &Aid, SupRate, &SupRateLen, ExtRate, &ExtRateLen, - &HtCapability,&AddHtInfo, &HtCapabilityLen,&AddHtInfoLen,&NewExtChannelOffset, &EdcaParm, &CkipFlag)) - { + USHORT CapabilityInfo, Status, Aid; + UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], SupRateLen; + UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRateLen; + UCHAR Addr2[MAC_ADDR_LEN]; + BOOLEAN TimerCancelled; + UCHAR CkipFlag; + EDCA_PARM EdcaParm; + HT_CAPABILITY_IE HtCapability; + ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE + UCHAR HtCapabilityLen = 0; + UCHAR AddHtInfoLen; + UCHAR NewExtChannelOffset = 0xff; + + if (PeerAssocRspSanity + (pAd, Elem->Msg, Elem->MsgLen, Addr2, &CapabilityInfo, &Status, + &Aid, SupRate, &SupRateLen, ExtRate, &ExtRateLen, &HtCapability, + &AddHtInfo, &HtCapabilityLen, &AddHtInfoLen, &NewExtChannelOffset, + &EdcaParm, &CkipFlag)) { // The frame is for me ? - if(MAC_ADDR_EQUAL(Addr2, pAd->MlmeAux.Bssid)) - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerAssocRspAction():ASSOC - receive ASSOC_RSP to me (status=%d)\n", Status)); - DBGPRINT(RT_DEBUG_TRACE, ("PeerAssocRspAction():MacTable [%d].AMsduSize = %d. ClientStatusFlags = 0x%lx \n",Elem->Wcid, pAd->MacTab.Content[BSSID_WCID].AMsduSize, pAd->MacTab.Content[BSSID_WCID].ClientStatusFlags)); - RTMPCancelTimer(&pAd->MlmeAux.AssocTimer, &TimerCancelled); - - - if(Status == MLME_SUCCESS) - { - UCHAR MaxSupportedRateIn500Kbps = 0; - UCHAR idx; + if (MAC_ADDR_EQUAL(Addr2, pAd->MlmeAux.Bssid)) { + DBGPRINT(RT_DEBUG_TRACE, + ("PeerAssocRspAction():ASSOC - receive ASSOC_RSP to me (status=%d)\n", + Status)); + DBGPRINT(RT_DEBUG_TRACE, + ("PeerAssocRspAction():MacTable [%d].AMsduSize = %d. ClientStatusFlags = 0x%lx \n", + Elem->Wcid, + pAd->MacTab.Content[BSSID_WCID].AMsduSize, + pAd->MacTab.Content[BSSID_WCID]. + ClientStatusFlags)); + RTMPCancelTimer(&pAd->MlmeAux.AssocTimer, + &TimerCancelled); + + if (Status == MLME_SUCCESS) { + UCHAR MaxSupportedRateIn500Kbps = 0; + UCHAR idx; // supported rates array may not be sorted. sort it and find the maximum rate - for (idx=0; idxMacTab.Content[BSSID_WCID], - MaxSupportedRateIn500Kbps, - &HtCapability, - HtCapabilityLen, - &AddHtInfo, - AddHtInfoLen, - CapabilityInfo); + &pAd->MacTab. + Content[BSSID_WCID], + MaxSupportedRateIn500Kbps, + &HtCapability, + HtCapabilityLen, &AddHtInfo, + AddHtInfoLen, + CapabilityInfo); } pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_ASSOC_CONF, 2, &Status); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, + MT2_ASSOC_CONF, 2, &Status); } - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - PeerAssocRspAction() sanity check fail\n")); + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("ASSOC - PeerAssocRspAction() sanity check fail\n")); } } @@ -873,55 +924,62 @@ VOID PeerAssocRspAction( ========================================================================== */ -VOID PeerReassocRspAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerReassocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT CapabilityInfo; - USHORT Status; - USHORT Aid; - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], SupRateLen; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRateLen; - UCHAR Addr2[MAC_ADDR_LEN]; - UCHAR CkipFlag; - BOOLEAN TimerCancelled; - EDCA_PARM EdcaParm; - HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE - UCHAR HtCapabilityLen; - UCHAR AddHtInfoLen; - UCHAR NewExtChannelOffset = 0xff; - - if(PeerAssocRspSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &CapabilityInfo, &Status, &Aid, SupRate, &SupRateLen, ExtRate, &ExtRateLen, - &HtCapability, &AddHtInfo, &HtCapabilityLen, &AddHtInfoLen,&NewExtChannelOffset, &EdcaParm, &CkipFlag)) - { - if(MAC_ADDR_EQUAL(Addr2, pAd->MlmeAux.Bssid)) // The frame is for me ? + USHORT CapabilityInfo; + USHORT Status; + USHORT Aid; + UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], SupRateLen; + UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRateLen; + UCHAR Addr2[MAC_ADDR_LEN]; + UCHAR CkipFlag; + BOOLEAN TimerCancelled; + EDCA_PARM EdcaParm; + HT_CAPABILITY_IE HtCapability; + ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE + UCHAR HtCapabilityLen; + UCHAR AddHtInfoLen; + UCHAR NewExtChannelOffset = 0xff; + + if (PeerAssocRspSanity + (pAd, Elem->Msg, Elem->MsgLen, Addr2, &CapabilityInfo, &Status, + &Aid, SupRate, &SupRateLen, ExtRate, &ExtRateLen, &HtCapability, + &AddHtInfo, &HtCapabilityLen, &AddHtInfoLen, &NewExtChannelOffset, + &EdcaParm, &CkipFlag)) { + if (MAC_ADDR_EQUAL(Addr2, pAd->MlmeAux.Bssid)) // The frame is for me ? { - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - receive REASSOC_RSP to me (status=%d)\n", Status)); - RTMPCancelTimer(&pAd->MlmeAux.ReassocTimer, &TimerCancelled); + DBGPRINT(RT_DEBUG_TRACE, + ("ASSOC - receive REASSOC_RSP to me (status=%d)\n", + Status)); + RTMPCancelTimer(&pAd->MlmeAux.ReassocTimer, + &TimerCancelled); - if(Status == MLME_SUCCESS) - { + if (Status == MLME_SUCCESS) { // go to procedure listed on page 376 - AssocPostProc(pAd, Addr2, CapabilityInfo, Aid, SupRate, SupRateLen, ExtRate, ExtRateLen, - &EdcaParm, &HtCapability, HtCapabilityLen, &AddHtInfo); - + AssocPostProc(pAd, Addr2, CapabilityInfo, Aid, + SupRate, SupRateLen, ExtRate, + ExtRateLen, &EdcaParm, + &HtCapability, HtCapabilityLen, + &AddHtInfo); - { - wext_notify_event_assoc(pAd); - RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, &pAd->MlmeAux.Bssid[0], NULL, 0); - } - - } + { + wext_notify_event_assoc(pAd); + RtmpOSWrielessEventSend(pAd, SIOCGIWAP, + -1, + &pAd->MlmeAux. + Bssid[0], NULL, + 0); + } - // CkipFlag is no use for reassociate - pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, &Status); } + // CkipFlag is no use for reassociate + pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, + MT2_REASSOC_CONF, 2, &Status); } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - PeerReassocRspAction() sanity check fail\n")); + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("ASSOC - PeerReassocRspAction() sanity check fail\n")); } } @@ -936,30 +994,18 @@ VOID PeerReassocRspAction( ========================================================================== */ -VOID AssocPostProc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr2, - IN USHORT CapabilityInfo, - IN USHORT Aid, - IN UCHAR SupRate[], - IN UCHAR SupRateLen, - IN UCHAR ExtRate[], - IN UCHAR ExtRateLen, - IN PEDCA_PARM pEdcaParm, - IN HT_CAPABILITY_IE *pHtCapability, - IN UCHAR HtCapabilityLen, - IN ADD_HT_INFO_IE *pAddHtInfo) // AP might use this additional ht info IE +VOID AssocPostProc(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr2, IN USHORT CapabilityInfo, IN USHORT Aid, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN PEDCA_PARM pEdcaParm, IN HT_CAPABILITY_IE * pHtCapability, IN UCHAR HtCapabilityLen, IN ADD_HT_INFO_IE * pAddHtInfo) // AP might use this additional ht info IE { ULONG Idx; pAd->MlmeAux.BssType = BSS_INFRA; COPY_MAC_ADDR(pAd->MlmeAux.Bssid, pAddr2); pAd->MlmeAux.Aid = Aid; - pAd->MlmeAux.CapabilityInfo = CapabilityInfo & SUPPORTED_CAPABILITY_INFO; + pAd->MlmeAux.CapabilityInfo = + CapabilityInfo & SUPPORTED_CAPABILITY_INFO; // Some HT AP might lost WMM IE. We add WMM ourselves. beacuase HT requires QoS on. - if ((HtCapabilityLen > 0) && (pEdcaParm->bValid == FALSE)) - { + if ((HtCapabilityLen > 0) && (pEdcaParm->bValid == FALSE)) { pEdcaParm->bValid = TRUE; pEdcaParm->Aifsn[0] = 3; pEdcaParm->Aifsn[1] = 7; @@ -976,10 +1022,10 @@ VOID AssocPostProc( pEdcaParm->Cwmax[2] = 4; pEdcaParm->Cwmax[3] = 3; - pEdcaParm->Txop[0] = 0; - pEdcaParm->Txop[1] = 0; - pEdcaParm->Txop[2] = 96; - pEdcaParm->Txop[3] = 48; + pEdcaParm->Txop[0] = 0; + pEdcaParm->Txop[1] = 0; + pEdcaParm->Txop[2] = 96; + pEdcaParm->Txop[3] = 48; } @@ -995,75 +1041,94 @@ VOID AssocPostProc( NdisMoveMemory(pAd->MlmeAux.ExtRate, ExtRate, ExtRateLen); RTMPCheckRates(pAd, pAd->MlmeAux.ExtRate, &pAd->MlmeAux.ExtRateLen); - if (HtCapabilityLen > 0) - { + if (HtCapabilityLen > 0) { RTMPCheckHt(pAd, BSSID_WCID, pHtCapability, pAddHtInfo); } - DBGPRINT(RT_DEBUG_TRACE, ("AssocPostProc===> AP.AMsduSize = %d. ClientStatusFlags = 0x%lx \n", pAd->MacTab.Content[BSSID_WCID].AMsduSize, pAd->MacTab.Content[BSSID_WCID].ClientStatusFlags)); + DBGPRINT(RT_DEBUG_TRACE, + ("AssocPostProc===> AP.AMsduSize = %d. ClientStatusFlags = 0x%lx \n", + pAd->MacTab.Content[BSSID_WCID].AMsduSize, + pAd->MacTab.Content[BSSID_WCID].ClientStatusFlags)); - DBGPRINT(RT_DEBUG_TRACE, ("AssocPostProc===> (Mmps=%d, AmsduSize=%d, )\n", - pAd->MacTab.Content[BSSID_WCID].MmpsMode, pAd->MacTab.Content[BSSID_WCID].AMsduSize)); + DBGPRINT(RT_DEBUG_TRACE, + ("AssocPostProc===> (Mmps=%d, AmsduSize=%d, )\n", + pAd->MacTab.Content[BSSID_WCID].MmpsMode, + pAd->MacTab.Content[BSSID_WCID].AMsduSize)); // Set New WPA information Idx = BssTableSearch(&pAd->ScanTab, pAddr2, pAd->MlmeAux.Channel); - if (Idx == BSS_NOT_FOUND) - { + if (Idx == BSS_NOT_FOUND) { DBGPRINT_ERR(("ASSOC - Can't find BSS after receiving Assoc response\n")); - } - else - { + } else { // Init variable pAd->MacTab.Content[BSSID_WCID].RSNIE_Len = 0; - NdisZeroMemory(pAd->MacTab.Content[BSSID_WCID].RSN_IE, MAX_LEN_OF_RSNIE); + NdisZeroMemory(pAd->MacTab.Content[BSSID_WCID].RSN_IE, + MAX_LEN_OF_RSNIE); // Store appropriate RSN_IE for WPA SM negotiation later - if ((pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) && (pAd->ScanTab.BssEntry[Idx].VarIELen != 0)) - { - PUCHAR pVIE; - USHORT len; - PEID_STRUCT pEid; + if ((pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) + && (pAd->ScanTab.BssEntry[Idx].VarIELen != 0)) { + PUCHAR pVIE; + USHORT len; + PEID_STRUCT pEid; pVIE = pAd->ScanTab.BssEntry[Idx].VarIEs; - len = pAd->ScanTab.BssEntry[Idx].VarIELen; + len = pAd->ScanTab.BssEntry[Idx].VarIELen; //KH need to check again // Don't allow to go to sleep mode if authmode is WPA-related. //This can make Authentication process more smoothly. RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); - while (len > 0) - { + while (len > 0) { pEid = (PEID_STRUCT) pVIE; // For WPA/WPAPSK - if ((pEid->Eid == IE_WPA) && (NdisEqualMemory(pEid->Octet, WPA_OUI, 4)) - && (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA || pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) - { - NdisMoveMemory(pAd->MacTab.Content[BSSID_WCID].RSN_IE, pVIE, (pEid->Len + 2)); - pAd->MacTab.Content[BSSID_WCID].RSNIE_Len = (pEid->Len + 2); - DBGPRINT(RT_DEBUG_TRACE, ("AssocPostProc===> Store RSN_IE for WPA SM negotiation \n")); + if ((pEid->Eid == IE_WPA) + && + (NdisEqualMemory(pEid->Octet, WPA_OUI, 4)) + && (pAd->StaCfg.AuthMode == + Ndis802_11AuthModeWPA + || pAd->StaCfg.AuthMode == + Ndis802_11AuthModeWPAPSK)) { + NdisMoveMemory(pAd->MacTab. + Content[BSSID_WCID]. + RSN_IE, pVIE, + (pEid->Len + 2)); + pAd->MacTab.Content[BSSID_WCID]. + RSNIE_Len = (pEid->Len + 2); + DBGPRINT(RT_DEBUG_TRACE, + ("AssocPostProc===> Store RSN_IE for WPA SM negotiation \n")); } // For WPA2/WPA2PSK - else if ((pEid->Eid == IE_RSN) && (NdisEqualMemory(pEid->Octet + 2, RSN_OUI, 3)) - && (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2 || pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - NdisMoveMemory(pAd->MacTab.Content[BSSID_WCID].RSN_IE, pVIE, (pEid->Len + 2)); - pAd->MacTab.Content[BSSID_WCID].RSNIE_Len = (pEid->Len + 2); - DBGPRINT(RT_DEBUG_TRACE, ("AssocPostProc===> Store RSN_IE for WPA2 SM negotiation \n")); + else if ((pEid->Eid == IE_RSN) + && + (NdisEqualMemory + (pEid->Octet + 2, RSN_OUI, 3)) + && (pAd->StaCfg.AuthMode == + Ndis802_11AuthModeWPA2 + || pAd->StaCfg.AuthMode == + Ndis802_11AuthModeWPA2PSK)) { + NdisMoveMemory(pAd->MacTab. + Content[BSSID_WCID]. + RSN_IE, pVIE, + (pEid->Len + 2)); + pAd->MacTab.Content[BSSID_WCID]. + RSNIE_Len = (pEid->Len + 2); + DBGPRINT(RT_DEBUG_TRACE, + ("AssocPostProc===> Store RSN_IE for WPA2 SM negotiation \n")); } pVIE += (pEid->Len + 2); - len -= (pEid->Len + 2); + len -= (pEid->Len + 2); } - } - if (pAd->MacTab.Content[BSSID_WCID].RSNIE_Len == 0) - { - DBGPRINT(RT_DEBUG_TRACE, ("AssocPostProc===> no RSN_IE \n")); - } - else - { - hex_dump("RSN_IE", pAd->MacTab.Content[BSSID_WCID].RSN_IE, pAd->MacTab.Content[BSSID_WCID].RSNIE_Len); + if (pAd->MacTab.Content[BSSID_WCID].RSNIE_Len == 0) { + DBGPRINT(RT_DEBUG_TRACE, + ("AssocPostProc===> no RSN_IE \n")); + } else { + hex_dump("RSN_IE", + pAd->MacTab.Content[BSSID_WCID].RSN_IE, + pAd->MacTab.Content[BSSID_WCID].RSNIE_Len); } } } @@ -1079,36 +1144,36 @@ VOID AssocPostProc( ========================================================================== */ -VOID PeerDisassocAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerDisassocAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Addr2[MAC_ADDR_LEN]; - USHORT Reason; + UCHAR Addr2[MAC_ADDR_LEN]; + USHORT Reason; DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - PeerDisassocAction()\n")); - if(PeerDisassocSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Reason)) - { - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - PeerDisassocAction() Reason = %d\n", Reason)); - if (INFRA_ON(pAd) && MAC_ADDR_EQUAL(pAd->CommonCfg.Bssid, Addr2)) - { - - if (pAd->CommonCfg.bWirelessEvent) - { - RTMPSendWirelessEvent(pAd, IW_DISASSOC_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); + if (PeerDisassocSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Reason)) { + DBGPRINT(RT_DEBUG_TRACE, + ("ASSOC - PeerDisassocAction() Reason = %d\n", + Reason)); + if (INFRA_ON(pAd) + && MAC_ADDR_EQUAL(pAd->CommonCfg.Bssid, Addr2)) { + + if (pAd->CommonCfg.bWirelessEvent) { + RTMPSendWirelessEvent(pAd, + IW_DISASSOC_EVENT_FLAG, + pAd->MacTab. + Content[BSSID_WCID].Addr, + BSS0, 0); } - LinkDown(pAd, TRUE); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; - - RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0); + RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, + 0); } - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - PeerDisassocAction() sanity check fail\n")); + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("ASSOC - PeerDisassocAction() sanity check fail\n")); } } @@ -1124,11 +1189,9 @@ VOID PeerDisassocAction( ========================================================================== */ -VOID AssocTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID AssocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Status; + USHORT Status; DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - AssocTimeoutAction\n")); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; Status = MLME_REJ_TIMEOUT; @@ -1144,11 +1207,9 @@ VOID AssocTimeoutAction( ========================================================================== */ -VOID ReassocTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID ReassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Status; + USHORT Status; DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - ReassocTimeoutAction\n")); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; Status = MLME_REJ_TIMEOUT; @@ -1164,51 +1225,49 @@ VOID ReassocTimeoutAction( ========================================================================== */ -VOID DisassocTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID DisassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Status; + USHORT Status; DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - DisassocTimeoutAction\n")); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; Status = MLME_SUCCESS; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DISASSOC_CONF, 2, &Status); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DISASSOC_CONF, 2, + &Status); } -VOID InvalidStateWhenAssoc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID InvalidStateWhenAssoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - InvalidStateWhenAssoc(state=%ld), reset ASSOC state machine\n", - pAd->Mlme.AssocMachine.CurrState)); + USHORT Status; + DBGPRINT(RT_DEBUG_TRACE, + ("ASSOC - InvalidStateWhenAssoc(state=%ld), reset ASSOC state machine\n", + pAd->Mlme.AssocMachine.CurrState)); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; Status = MLME_STATE_MACHINE_REJECT; MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_ASSOC_CONF, 2, &Status); } -VOID InvalidStateWhenReassoc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID InvalidStateWhenReassoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - InvalidStateWhenReassoc(state=%ld), reset ASSOC state machine\n", - pAd->Mlme.AssocMachine.CurrState)); + DBGPRINT(RT_DEBUG_TRACE, + ("ASSOC - InvalidStateWhenReassoc(state=%ld), reset ASSOC state machine\n", + pAd->Mlme.AssocMachine.CurrState)); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; Status = MLME_STATE_MACHINE_REJECT; MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, &Status); } -VOID InvalidStateWhenDisassociate( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID InvalidStateWhenDisassociate(IN PRTMP_ADAPTER pAd, + IN MLME_QUEUE_ELEM * Elem) { USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - InvalidStateWhenDisassoc(state=%ld), reset ASSOC state machine\n", - pAd->Mlme.AssocMachine.CurrState)); + DBGPRINT(RT_DEBUG_TRACE, + ("ASSOC - InvalidStateWhenDisassoc(state=%ld), reset ASSOC state machine\n", + pAd->Mlme.AssocMachine.CurrState)); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; Status = MLME_STATE_MACHINE_REJECT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DISASSOC_CONF, 2, &Status); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DISASSOC_CONF, 2, + &Status); } /* @@ -1224,33 +1283,31 @@ VOID InvalidStateWhenDisassociate( ========================================================================== */ -VOID Cls3errAction( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr) +VOID Cls3errAction(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr) { - HEADER_802_11 DisassocHdr; - PHEADER_802_11 pDisassocHdr; - PUCHAR pOutBuffer = NULL; - ULONG FrameLen = 0; - NDIS_STATUS NStatus; - USHORT Reason = REASON_CLS3ERR; - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + HEADER_802_11 DisassocHdr; + PHEADER_802_11 pDisassocHdr; + PUCHAR pOutBuffer = NULL; + ULONG FrameLen = 0; + NDIS_STATUS NStatus; + USHORT Reason = REASON_CLS3ERR; + + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory if (NStatus != NDIS_STATUS_SUCCESS) return; - DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - Class 3 Error, Send DISASSOC frame\n")); + DBGPRINT(RT_DEBUG_TRACE, + ("ASSOC - Class 3 Error, Send DISASSOC frame\n")); MgtMacHeaderInit(pAd, &DisassocHdr, SUBTYPE_DISASSOC, 0, pAddr, pAd->CommonCfg.Bssid); // patch peap ttls switching issue - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11),&DisassocHdr, - 2, &Reason, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer, &FrameLen, + sizeof(HEADER_802_11), &DisassocHdr, + 2, &Reason, END_OF_ARGS); MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); // To patch Instance and Buffalo(N) AP // Driver has to send deauth to Instance AP, but Buffalo(N) needs to send disassoc to reset Authenticator's state machine // Therefore, we send both of them. - pDisassocHdr = (PHEADER_802_11)pOutBuffer; + pDisassocHdr = (PHEADER_802_11) pOutBuffer; pDisassocHdr->FC.SubType = SUBTYPE_DEAUTH; MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); @@ -1260,206 +1317,248 @@ VOID Cls3errAction( COPY_MAC_ADDR(pAd->StaCfg.DisassocSta, pAddr); } - -int wext_notify_event_assoc( - IN RTMP_ADAPTER *pAd) +int wext_notify_event_assoc(IN RTMP_ADAPTER * pAd) { - char custom[IW_CUSTOM_MAX] = {0}; + char custom[IW_CUSTOM_MAX] = { 0 }; - if (pAd->StaCfg.ReqVarIELen <= IW_CUSTOM_MAX) - { - NdisMoveMemory(custom, pAd->StaCfg.ReqVarIEs, pAd->StaCfg.ReqVarIELen); - RtmpOSWrielessEventSend(pAd, IWEVASSOCREQIE, -1, NULL, custom, pAd->StaCfg.ReqVarIELen); - } - else - DBGPRINT(RT_DEBUG_TRACE, ("pAd->StaCfg.ReqVarIELen > MAX_CUSTOM_LEN\n")); + if (pAd->StaCfg.ReqVarIELen <= IW_CUSTOM_MAX) { + NdisMoveMemory(custom, pAd->StaCfg.ReqVarIEs, + pAd->StaCfg.ReqVarIELen); + RtmpOSWrielessEventSend(pAd, IWEVASSOCREQIE, -1, NULL, custom, + pAd->StaCfg.ReqVarIELen); + } else + DBGPRINT(RT_DEBUG_TRACE, + ("pAd->StaCfg.ReqVarIELen > MAX_CUSTOM_LEN\n")); return 0; } - -BOOLEAN StaAddMacTableEntry( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN UCHAR MaxSupportedRateIn500Kbps, - IN HT_CAPABILITY_IE *pHtCapability, - IN UCHAR HtCapabilityLen, - IN ADD_HT_INFO_IE *pAddHtInfo, - IN UCHAR AddHtInfoLen, - IN USHORT CapabilityInfo) +BOOLEAN StaAddMacTableEntry(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, + IN UCHAR MaxSupportedRateIn500Kbps, + IN HT_CAPABILITY_IE * pHtCapability, + IN UCHAR HtCapabilityLen, + IN ADD_HT_INFO_IE * pAddHtInfo, + IN UCHAR AddHtInfoLen, IN USHORT CapabilityInfo) { - UCHAR MaxSupportedRate = RATE_11; + UCHAR MaxSupportedRate = RATE_11; if (ADHOC_ON(pAd)) CLIENT_STATUS_CLEAR_FLAG(pEntry, fCLIENT_STATUS_WMM_CAPABLE); - switch (MaxSupportedRateIn500Kbps) - { - case 108: MaxSupportedRate = RATE_54; break; - case 96: MaxSupportedRate = RATE_48; break; - case 72: MaxSupportedRate = RATE_36; break; - case 48: MaxSupportedRate = RATE_24; break; - case 36: MaxSupportedRate = RATE_18; break; - case 24: MaxSupportedRate = RATE_12; break; - case 18: MaxSupportedRate = RATE_9; break; - case 12: MaxSupportedRate = RATE_6; break; - case 22: MaxSupportedRate = RATE_11; break; - case 11: MaxSupportedRate = RATE_5_5; break; - case 4: MaxSupportedRate = RATE_2; break; - case 2: MaxSupportedRate = RATE_1; break; - default: MaxSupportedRate = RATE_11; break; - } - - if ((pAd->CommonCfg.PhyMode == PHY_11G) && (MaxSupportedRate < RATE_FIRST_OFDM_RATE)) - return FALSE; + switch (MaxSupportedRateIn500Kbps) { + case 108: + MaxSupportedRate = RATE_54; + break; + case 96: + MaxSupportedRate = RATE_48; + break; + case 72: + MaxSupportedRate = RATE_36; + break; + case 48: + MaxSupportedRate = RATE_24; + break; + case 36: + MaxSupportedRate = RATE_18; + break; + case 24: + MaxSupportedRate = RATE_12; + break; + case 18: + MaxSupportedRate = RATE_9; + break; + case 12: + MaxSupportedRate = RATE_6; + break; + case 22: + MaxSupportedRate = RATE_11; + break; + case 11: + MaxSupportedRate = RATE_5_5; + break; + case 4: + MaxSupportedRate = RATE_2; + break; + case 2: + MaxSupportedRate = RATE_1; + break; + default: + MaxSupportedRate = RATE_11; + break; + } + + if ((pAd->CommonCfg.PhyMode == PHY_11G) + && (MaxSupportedRate < RATE_FIRST_OFDM_RATE)) + return FALSE; // 11n only - if (((pAd->CommonCfg.PhyMode == PHY_11N_2_4G) || (pAd->CommonCfg.PhyMode == PHY_11N_5G))&& (HtCapabilityLen == 0)) + if (((pAd->CommonCfg.PhyMode == PHY_11N_2_4G) + || (pAd->CommonCfg.PhyMode == PHY_11N_5G)) + && (HtCapabilityLen == 0)) return FALSE; if (!pEntry) - return FALSE; + return FALSE; NdisAcquireSpinLock(&pAd->MacTabLock); - if (pEntry) - { + if (pEntry) { pEntry->PortSecured = WPA_802_1X_PORT_SECURED; if ((MaxSupportedRate < RATE_FIRST_OFDM_RATE) || - (pAd->CommonCfg.PhyMode == PHY_11B)) - { + (pAd->CommonCfg.PhyMode == PHY_11B)) { pEntry->RateLen = 4; if (MaxSupportedRate >= RATE_FIRST_OFDM_RATE) MaxSupportedRate = RATE_11; - } - else + } else pEntry->RateLen = 12; pEntry->MaxHTPhyMode.word = 0; pEntry->MinHTPhyMode.word = 0; pEntry->HTPhyMode.word = 0; pEntry->MaxSupportedRate = MaxSupportedRate; - if (pEntry->MaxSupportedRate < RATE_FIRST_OFDM_RATE) - { + if (pEntry->MaxSupportedRate < RATE_FIRST_OFDM_RATE) { pEntry->MaxHTPhyMode.field.MODE = MODE_CCK; - pEntry->MaxHTPhyMode.field.MCS = pEntry->MaxSupportedRate; + pEntry->MaxHTPhyMode.field.MCS = + pEntry->MaxSupportedRate; pEntry->MinHTPhyMode.field.MODE = MODE_CCK; - pEntry->MinHTPhyMode.field.MCS = pEntry->MaxSupportedRate; + pEntry->MinHTPhyMode.field.MCS = + pEntry->MaxSupportedRate; pEntry->HTPhyMode.field.MODE = MODE_CCK; pEntry->HTPhyMode.field.MCS = pEntry->MaxSupportedRate; - } - else - { + } else { pEntry->MaxHTPhyMode.field.MODE = MODE_OFDM; - pEntry->MaxHTPhyMode.field.MCS = OfdmRateToRxwiMCS[pEntry->MaxSupportedRate]; + pEntry->MaxHTPhyMode.field.MCS = + OfdmRateToRxwiMCS[pEntry->MaxSupportedRate]; pEntry->MinHTPhyMode.field.MODE = MODE_OFDM; - pEntry->MinHTPhyMode.field.MCS = OfdmRateToRxwiMCS[pEntry->MaxSupportedRate]; + pEntry->MinHTPhyMode.field.MCS = + OfdmRateToRxwiMCS[pEntry->MaxSupportedRate]; pEntry->HTPhyMode.field.MODE = MODE_OFDM; - pEntry->HTPhyMode.field.MCS = OfdmRateToRxwiMCS[pEntry->MaxSupportedRate]; + pEntry->HTPhyMode.field.MCS = + OfdmRateToRxwiMCS[pEntry->MaxSupportedRate]; } pEntry->CapabilityInfo = CapabilityInfo; - CLIENT_STATUS_CLEAR_FLAG(pEntry, fCLIENT_STATUS_AGGREGATION_CAPABLE); - CLIENT_STATUS_CLEAR_FLAG(pEntry, fCLIENT_STATUS_PIGGYBACK_CAPABLE); + CLIENT_STATUS_CLEAR_FLAG(pEntry, + fCLIENT_STATUS_AGGREGATION_CAPABLE); + CLIENT_STATUS_CLEAR_FLAG(pEntry, + fCLIENT_STATUS_PIGGYBACK_CAPABLE); } NdisZeroMemory(&pEntry->HTCapability, sizeof(pEntry->HTCapability)); // If this Entry supports 802.11n, upgrade to HT rate. - if ((HtCapabilityLen != 0) && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) - { - UCHAR j, bitmask; //k,bitmask; - CHAR i; + if ((HtCapabilityLen != 0) + && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) { + UCHAR j, bitmask; //k,bitmask; + CHAR i; if (ADHOC_ON(pAd)) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_WMM_CAPABLE); - if ((pHtCapability->HtCapInfo.GF) && (pAd->CommonCfg.DesiredHtPhy.GF)) - { + CLIENT_STATUS_SET_FLAG(pEntry, + fCLIENT_STATUS_WMM_CAPABLE); + if ((pHtCapability->HtCapInfo.GF) + && (pAd->CommonCfg.DesiredHtPhy.GF)) { pEntry->MaxHTPhyMode.field.MODE = MODE_HTGREENFIELD; - } - else - { + } else { pEntry->MaxHTPhyMode.field.MODE = MODE_HTMIX; pAd->MacTab.fAnyStationNonGF = TRUE; pAd->CommonCfg.AddHTInfo.AddHtInfo2.NonGfPresent = 1; } if ((pHtCapability->HtCapInfo.ChannelWidth) && - (pAd->CommonCfg.DesiredHtPhy.ChannelWidth) && - ((pAd->StaCfg.BssType == BSS_INFRA) || ((pAd->StaCfg.BssType == BSS_ADHOC) && (pAddHtInfo->AddHtInfo.ExtChanOffset == pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset)))) - { - pEntry->MaxHTPhyMode.field.BW= BW_40; - pEntry->MaxHTPhyMode.field.ShortGI = ((pAd->CommonCfg.DesiredHtPhy.ShortGIfor40)&(pHtCapability->HtCapInfo.ShortGIfor40)); - } - else - { + (pAd->CommonCfg.DesiredHtPhy.ChannelWidth) && + ((pAd->StaCfg.BssType == BSS_INFRA) + || ((pAd->StaCfg.BssType == BSS_ADHOC) + && (pAddHtInfo->AddHtInfo.ExtChanOffset == + pAd->CommonCfg.AddHTInfo.AddHtInfo. + ExtChanOffset)))) { + pEntry->MaxHTPhyMode.field.BW = BW_40; + pEntry->MaxHTPhyMode.field.ShortGI = + ((pAd->CommonCfg.DesiredHtPhy. + ShortGIfor40) & (pHtCapability->HtCapInfo. + ShortGIfor40)); + } else { pEntry->MaxHTPhyMode.field.BW = BW_20; - pEntry->MaxHTPhyMode.field.ShortGI = ((pAd->CommonCfg.DesiredHtPhy.ShortGIfor20)&(pHtCapability->HtCapInfo.ShortGIfor20)); + pEntry->MaxHTPhyMode.field.ShortGI = + ((pAd->CommonCfg.DesiredHtPhy. + ShortGIfor20) & (pHtCapability->HtCapInfo. + ShortGIfor20)); pAd->MacTab.fAnyStation20Only = TRUE; } // 3*3 - if (pAd->MACVersion >= RALINK_2883_VERSION && pAd->MACVersion < RALINK_3070_VERSION) - pEntry->MaxHTPhyMode.field.TxBF = pAd->CommonCfg.RegTransmitSetting.field.TxBF; + if (pAd->MACVersion >= RALINK_2883_VERSION + && pAd->MACVersion < RALINK_3070_VERSION) + pEntry->MaxHTPhyMode.field.TxBF = + pAd->CommonCfg.RegTransmitSetting.field.TxBF; // find max fixed rate - for (i=23; i>=0; i--) // 3*3 + for (i = 23; i >= 0; i--) // 3*3 { - j = i/8; - bitmask = (1<<(i-(j*8))); - if ((pAd->StaCfg.DesiredHtPhyInfo.MCSSet[j] & bitmask) && (pHtCapability->MCSSet[j] & bitmask)) - { + j = i / 8; + bitmask = (1 << (i - (j * 8))); + if ((pAd->StaCfg.DesiredHtPhyInfo.MCSSet[j] & bitmask) + && (pHtCapability->MCSSet[j] & bitmask)) { pEntry->MaxHTPhyMode.field.MCS = i; break; } - if (i==0) + if (i == 0) break; } - - if (pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) - { - if (pAd->StaCfg.DesiredTransmitSetting.field.MCS == 32) - { + if (pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) { + if (pAd->StaCfg.DesiredTransmitSetting.field.MCS == 32) { // Fix MCS as HT Duplicated Mode pEntry->MaxHTPhyMode.field.BW = 1; pEntry->MaxHTPhyMode.field.MODE = MODE_HTMIX; pEntry->MaxHTPhyMode.field.STBC = 0; pEntry->MaxHTPhyMode.field.ShortGI = 0; pEntry->MaxHTPhyMode.field.MCS = 32; - } - else if (pEntry->MaxHTPhyMode.field.MCS > pAd->StaCfg.HTPhyMode.field.MCS) - { + } else if (pEntry->MaxHTPhyMode.field.MCS > + pAd->StaCfg.HTPhyMode.field.MCS) { // STA supports fixed MCS - pEntry->MaxHTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; + pEntry->MaxHTPhyMode.field.MCS = + pAd->StaCfg.HTPhyMode.field.MCS; } } - pEntry->MaxHTPhyMode.field.STBC = (pHtCapability->HtCapInfo.RxSTBC & (pAd->CommonCfg.DesiredHtPhy.TxSTBC)); + pEntry->MaxHTPhyMode.field.STBC = + (pHtCapability->HtCapInfo. + RxSTBC & (pAd->CommonCfg.DesiredHtPhy.TxSTBC)); pEntry->MpduDensity = pHtCapability->HtCapParm.MpduDensity; - pEntry->MaxRAmpduFactor = pHtCapability->HtCapParm.MaxRAmpduFactor; - pEntry->MmpsMode = (UCHAR)pHtCapability->HtCapInfo.MimoPs; - pEntry->AMsduSize = (UCHAR)pHtCapability->HtCapInfo.AMsduSize; + pEntry->MaxRAmpduFactor = + pHtCapability->HtCapParm.MaxRAmpduFactor; + pEntry->MmpsMode = (UCHAR) pHtCapability->HtCapInfo.MimoPs; + pEntry->AMsduSize = (UCHAR) pHtCapability->HtCapInfo.AMsduSize; pEntry->HTPhyMode.word = pEntry->MaxHTPhyMode.word; - if (pAd->CommonCfg.DesiredHtPhy.AmsduEnable && (pAd->CommonCfg.REGBACapability.field.AutoBA == FALSE)) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_AMSDU_INUSED); + if (pAd->CommonCfg.DesiredHtPhy.AmsduEnable + && (pAd->CommonCfg.REGBACapability.field.AutoBA == FALSE)) + CLIENT_STATUS_SET_FLAG(pEntry, + fCLIENT_STATUS_AMSDU_INUSED); if (pHtCapability->HtCapInfo.ShortGIfor20) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_SGI20_CAPABLE); + CLIENT_STATUS_SET_FLAG(pEntry, + fCLIENT_STATUS_SGI20_CAPABLE); if (pHtCapability->HtCapInfo.ShortGIfor40) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_SGI40_CAPABLE); + CLIENT_STATUS_SET_FLAG(pEntry, + fCLIENT_STATUS_SGI40_CAPABLE); if (pHtCapability->HtCapInfo.TxSTBC) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_TxSTBC_CAPABLE); + CLIENT_STATUS_SET_FLAG(pEntry, + fCLIENT_STATUS_TxSTBC_CAPABLE); if (pHtCapability->HtCapInfo.RxSTBC) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_RxSTBC_CAPABLE); + CLIENT_STATUS_SET_FLAG(pEntry, + fCLIENT_STATUS_RxSTBC_CAPABLE); if (pHtCapability->ExtHtCapInfo.PlusHTC) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_HTC_CAPABLE); - if (pAd->CommonCfg.bRdg && pHtCapability->ExtHtCapInfo.RDGSupport) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_RDG_CAPABLE); + CLIENT_STATUS_SET_FLAG(pEntry, + fCLIENT_STATUS_HTC_CAPABLE); + if (pAd->CommonCfg.bRdg + && pHtCapability->ExtHtCapInfo.RDGSupport) + CLIENT_STATUS_SET_FLAG(pEntry, + fCLIENT_STATUS_RDG_CAPABLE); if (pHtCapability->ExtHtCapInfo.MCSFeedback == 0x03) - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_MCSFEEDBACK_CAPABLE); - NdisMoveMemory(&pEntry->HTCapability, pHtCapability, HtCapabilityLen); - } - else - { + CLIENT_STATUS_SET_FLAG(pEntry, + fCLIENT_STATUS_MCSFEEDBACK_CAPABLE); + NdisMoveMemory(&pEntry->HTCapability, pHtCapability, + HtCapabilityLen); + } else { pAd->MacTab.fAnyStationIsLegacy = TRUE; } @@ -1467,22 +1566,22 @@ BOOLEAN StaAddMacTableEntry( pEntry->CurrTxRate = pEntry->MaxSupportedRate; // Set asic auto fall back - if (pAd->StaCfg.bAutoTxRateSwitch == TRUE) - { - PUCHAR pTable; - UCHAR TableSize = 0; + if (pAd->StaCfg.bAutoTxRateSwitch == TRUE) { + PUCHAR pTable; + UCHAR TableSize = 0; - MlmeSelectTxRateTable(pAd, pEntry, &pTable, &TableSize, &pEntry->CurrTxRateIndex); + MlmeSelectTxRateTable(pAd, pEntry, &pTable, &TableSize, + &pEntry->CurrTxRateIndex); pEntry->bAutoTxRateSwitch = TRUE; - } - else - { - pEntry->HTPhyMode.field.MODE = pAd->StaCfg.HTPhyMode.field.MODE; - pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; + } else { + pEntry->HTPhyMode.field.MODE = pAd->StaCfg.HTPhyMode.field.MODE; + pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; pEntry->bAutoTxRateSwitch = FALSE; // If the legacy mode is set, overwrite the transmit setting of this entry. - RTMPUpdateLegacyTxSetting((UCHAR)pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode, pEntry); + RTMPUpdateLegacyTxSetting((UCHAR) pAd->StaCfg. + DesiredTransmitSetting.field. + FixedTxMode, pEntry); } pEntry->PortSecured = WPA_802_1X_PORT_SECURED; @@ -1493,14 +1592,14 @@ BOOLEAN StaAddMacTableEntry( NdisReleaseSpinLock(&pAd->MacTabLock); - { - union iwreq_data wrqu; - wext_notify_event_assoc(pAd); + { + union iwreq_data wrqu; + wext_notify_event_assoc(pAd); - memset(wrqu.ap_addr.sa_data, 0, MAC_ADDR_LEN); - memcpy(wrqu.ap_addr.sa_data, pAd->MlmeAux.Bssid, MAC_ADDR_LEN); - wireless_send_event(pAd->net_dev, SIOCGIWAP, &wrqu, NULL); + memset(wrqu.ap_addr.sa_data, 0, MAC_ADDR_LEN); + memcpy(wrqu.ap_addr.sa_data, pAd->MlmeAux.Bssid, MAC_ADDR_LEN); + wireless_send_event(pAd->net_dev, SIOCGIWAP, &wrqu, NULL); - } + } return TRUE; } diff --git a/drivers/staging/rt2860/sta/auth.c b/drivers/staging/rt2860/sta/auth.c index 7fb0760dabcc..8b75b4676e1a 100644 --- a/drivers/staging/rt2860/sta/auth.c +++ b/drivers/staging/rt2860/sta/auth.c @@ -55,27 +55,35 @@ ========================================================================== */ -void AuthStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *Sm, - OUT STATE_MACHINE_FUNC Trans[]) +void AuthStateMachineInit(IN PRTMP_ADAPTER pAd, + IN STATE_MACHINE * Sm, OUT STATE_MACHINE_FUNC Trans[]) { - StateMachineInit(Sm, Trans, MAX_AUTH_STATE, MAX_AUTH_MSG, (STATE_MACHINE_FUNC)Drop, AUTH_REQ_IDLE, AUTH_MACHINE_BASE); - - // the first column - StateMachineSetAction(Sm, AUTH_REQ_IDLE, MT2_MLME_AUTH_REQ, (STATE_MACHINE_FUNC)MlmeAuthReqAction); - - // the second column - StateMachineSetAction(Sm, AUTH_WAIT_SEQ2, MT2_MLME_AUTH_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenAuth); - StateMachineSetAction(Sm, AUTH_WAIT_SEQ2, MT2_PEER_AUTH_EVEN, (STATE_MACHINE_FUNC)PeerAuthRspAtSeq2Action); - StateMachineSetAction(Sm, AUTH_WAIT_SEQ2, MT2_AUTH_TIMEOUT, (STATE_MACHINE_FUNC)AuthTimeoutAction); - - // the third column - StateMachineSetAction(Sm, AUTH_WAIT_SEQ4, MT2_MLME_AUTH_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenAuth); - StateMachineSetAction(Sm, AUTH_WAIT_SEQ4, MT2_PEER_AUTH_EVEN, (STATE_MACHINE_FUNC)PeerAuthRspAtSeq4Action); - StateMachineSetAction(Sm, AUTH_WAIT_SEQ4, MT2_AUTH_TIMEOUT, (STATE_MACHINE_FUNC)AuthTimeoutAction); - - RTMPInitTimer(pAd, &pAd->MlmeAux.AuthTimer, GET_TIMER_FUNCTION(AuthTimeout), pAd, FALSE); + StateMachineInit(Sm, Trans, MAX_AUTH_STATE, MAX_AUTH_MSG, + (STATE_MACHINE_FUNC) Drop, AUTH_REQ_IDLE, + AUTH_MACHINE_BASE); + + // the first column + StateMachineSetAction(Sm, AUTH_REQ_IDLE, MT2_MLME_AUTH_REQ, + (STATE_MACHINE_FUNC) MlmeAuthReqAction); + + // the second column + StateMachineSetAction(Sm, AUTH_WAIT_SEQ2, MT2_MLME_AUTH_REQ, + (STATE_MACHINE_FUNC) InvalidStateWhenAuth); + StateMachineSetAction(Sm, AUTH_WAIT_SEQ2, MT2_PEER_AUTH_EVEN, + (STATE_MACHINE_FUNC) PeerAuthRspAtSeq2Action); + StateMachineSetAction(Sm, AUTH_WAIT_SEQ2, MT2_AUTH_TIMEOUT, + (STATE_MACHINE_FUNC) AuthTimeoutAction); + + // the third column + StateMachineSetAction(Sm, AUTH_WAIT_SEQ4, MT2_MLME_AUTH_REQ, + (STATE_MACHINE_FUNC) InvalidStateWhenAuth); + StateMachineSetAction(Sm, AUTH_WAIT_SEQ4, MT2_PEER_AUTH_EVEN, + (STATE_MACHINE_FUNC) PeerAuthRspAtSeq4Action); + StateMachineSetAction(Sm, AUTH_WAIT_SEQ4, MT2_AUTH_TIMEOUT, + (STATE_MACHINE_FUNC) AuthTimeoutAction); + + RTMPInitTimer(pAd, &pAd->MlmeAux.AuthTimer, + GET_TIMER_FUNCTION(AuthTimeout), pAd, FALSE); } /* @@ -87,31 +95,28 @@ void AuthStateMachineInit( ========================================================================== */ -VOID AuthTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +VOID AuthTimeout(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; + RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; - DBGPRINT(RT_DEBUG_TRACE,("AUTH - AuthTimeout\n")); + DBGPRINT(RT_DEBUG_TRACE, ("AUTH - AuthTimeout\n")); // Do nothing if the driver is starting halt state. // This might happen when timer already been fired before cancel timer with mlmehalt - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) + if (RTMP_TEST_FLAG + (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; // send a de-auth to reset AP's state machine (Patch AP-Dir635) if (pAd->Mlme.AuthMachine.CurrState == AUTH_WAIT_SEQ2) Cls2errAction(pAd, pAd->MlmeAux.Bssid); - - MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_AUTH_TIMEOUT, 0, NULL); - RTMP_MLME_HANDLER(pAd); + MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_AUTH_TIMEOUT, 0, NULL); + RTMP_MLME_HANDLER(pAd); } - /* ========================================================================== Description: @@ -120,20 +125,19 @@ VOID AuthTimeout( ========================================================================== */ -VOID MlmeAuthReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID MlmeAuthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - if (AUTH_ReqSend(pAd, Elem, &pAd->MlmeAux.AuthTimer, "AUTH", 1, NULL, 0)) - pAd->Mlme.AuthMachine.CurrState = AUTH_WAIT_SEQ2; - else - { + if (AUTH_ReqSend + (pAd, Elem, &pAd->MlmeAux.AuthTimer, "AUTH", 1, NULL, 0)) + pAd->Mlme.AuthMachine.CurrState = AUTH_WAIT_SEQ2; + else { USHORT Status; - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - Status = MLME_INVALID_FORMAT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); - } + pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; + Status = MLME_INVALID_FORMAT; + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, + &Status); + } } /* @@ -144,101 +148,130 @@ VOID MlmeAuthReqAction( ========================================================================== */ -VOID PeerAuthRspAtSeq2Action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerAuthRspAtSeq2Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Addr2[MAC_ADDR_LEN]; - USHORT Seq, Status, RemoteStatus, Alg; - UCHAR ChlgText[CIPHER_TEXT_LEN]; - UCHAR CyperChlgText[CIPHER_TEXT_LEN + 8 + 8]; - UCHAR Element[2]; - HEADER_802_11 AuthHdr; - BOOLEAN TimerCancelled; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - USHORT Status2; - - if (PeerAuthSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Alg, &Seq, &Status, (PCHAR)ChlgText)) - { - if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, Addr2) && Seq == 2) - { - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Receive AUTH_RSP seq#2 to me (Alg=%d, Status=%d)\n", Alg, Status)); - RTMPCancelTimer(&pAd->MlmeAux.AuthTimer, &TimerCancelled); - - if (Status == MLME_SUCCESS) - { - // Authentication Mode "LEAP" has allow for CCX 1.X - if (pAd->MlmeAux.Alg == Ndis802_11AuthModeOpen) - { - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); - } - else - { - // 2. shared key, need to be challenged - Seq++; - RemoteStatus = MLME_SUCCESS; + UCHAR Addr2[MAC_ADDR_LEN]; + USHORT Seq, Status, RemoteStatus, Alg; + UCHAR ChlgText[CIPHER_TEXT_LEN]; + UCHAR CyperChlgText[CIPHER_TEXT_LEN + 8 + 8]; + UCHAR Element[2]; + HEADER_802_11 AuthHdr; + BOOLEAN TimerCancelled; + PUCHAR pOutBuffer = NULL; + NDIS_STATUS NStatus; + ULONG FrameLen = 0; + USHORT Status2; + + if (PeerAuthSanity + (pAd, Elem->Msg, Elem->MsgLen, Addr2, &Alg, &Seq, &Status, + (PCHAR) ChlgText)) { + if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, Addr2) && Seq == 2) { + DBGPRINT(RT_DEBUG_TRACE, + ("AUTH - Receive AUTH_RSP seq#2 to me (Alg=%d, Status=%d)\n", + Alg, Status)); + RTMPCancelTimer(&pAd->MlmeAux.AuthTimer, + &TimerCancelled); + + if (Status == MLME_SUCCESS) { + // Authentication Mode "LEAP" has allow for CCX 1.X + if (pAd->MlmeAux.Alg == Ndis802_11AuthModeOpen) { + pAd->Mlme.AuthMachine.CurrState = + AUTH_REQ_IDLE; + MlmeEnqueue(pAd, + MLME_CNTL_STATE_MACHINE, + MT2_AUTH_CONF, 2, &Status); + } else { + // 2. shared key, need to be challenged + Seq++; + RemoteStatus = MLME_SUCCESS; // Get an unused nonpaged memory - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - PeerAuthRspAtSeq2Action() allocate memory fail\n")); - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - Status2 = MLME_FAIL_NO_RESOURCE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status2); - return; - } - - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Send AUTH request seq#3...\n")); - MgtMacHeaderInit(pAd, &AuthHdr, SUBTYPE_AUTH, 0, Addr2, pAd->MlmeAux.Bssid); - AuthHdr.FC.Wep = 1; - // Encrypt challenge text & auth information - RTMPInitWepEngine( - pAd, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].Key, - pAd->StaCfg.DefaultKeyId, - pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].KeyLen, - CyperChlgText); - - Alg = cpu2le16(*(USHORT *)&Alg); - Seq = cpu2le16(*(USHORT *)&Seq); - RemoteStatus= cpu2le16(*(USHORT *)&RemoteStatus); - - RTMPEncryptData(pAd, (PUCHAR) &Alg, CyperChlgText + 4, 2); - RTMPEncryptData(pAd, (PUCHAR) &Seq, CyperChlgText + 6, 2); - RTMPEncryptData(pAd, (PUCHAR) &RemoteStatus, CyperChlgText + 8, 2); + NStatus = + MlmeAllocateMemory(pAd, + &pOutBuffer); + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_TRACE, + ("AUTH - PeerAuthRspAtSeq2Action() allocate memory fail\n")); + pAd->Mlme.AuthMachine. + CurrState = AUTH_REQ_IDLE; + Status2 = MLME_FAIL_NO_RESOURCE; + MlmeEnqueue(pAd, + MLME_CNTL_STATE_MACHINE, + MT2_AUTH_CONF, 2, + &Status2); + return; + } + + DBGPRINT(RT_DEBUG_TRACE, + ("AUTH - Send AUTH request seq#3...\n")); + MgtMacHeaderInit(pAd, &AuthHdr, + SUBTYPE_AUTH, 0, Addr2, + pAd->MlmeAux.Bssid); + AuthHdr.FC.Wep = 1; + // Encrypt challenge text & auth information + RTMPInitWepEngine(pAd, + pAd-> + SharedKey[BSS0][pAd-> + StaCfg. + DefaultKeyId]. + Key, + pAd->StaCfg. + DefaultKeyId, + pAd-> + SharedKey[BSS0][pAd-> + StaCfg. + DefaultKeyId]. + KeyLen, + CyperChlgText); + + Alg = cpu2le16(*(USHORT *) & Alg); + Seq = cpu2le16(*(USHORT *) & Seq); + RemoteStatus = + cpu2le16(*(USHORT *) & + RemoteStatus); + + RTMPEncryptData(pAd, (PUCHAR) & Alg, + CyperChlgText + 4, 2); + RTMPEncryptData(pAd, (PUCHAR) & Seq, + CyperChlgText + 6, 2); + RTMPEncryptData(pAd, + (PUCHAR) & RemoteStatus, + CyperChlgText + 8, 2); Element[0] = 16; Element[1] = 128; - RTMPEncryptData(pAd, Element, CyperChlgText + 10, 2); - RTMPEncryptData(pAd, ChlgText, CyperChlgText + 12, 128); + RTMPEncryptData(pAd, Element, + CyperChlgText + 10, 2); + RTMPEncryptData(pAd, ChlgText, + CyperChlgText + 12, + 128); RTMPSetICV(pAd, CyperChlgText + 140); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &AuthHdr, - CIPHER_TEXT_LEN + 16, CyperChlgText, - END_OF_ARGS); - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); - - RTMPSetTimer(&pAd->MlmeAux.AuthTimer, AUTH_TIMEOUT); - pAd->Mlme.AuthMachine.CurrState = AUTH_WAIT_SEQ4; - } - } - else - { - pAd->StaCfg.AuthFailReason = Status; - COPY_MAC_ADDR(pAd->StaCfg.AuthFailSta, Addr2); - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); - } - } - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - PeerAuthSanity() sanity check fail\n")); - } + MakeOutgoingFrame(pOutBuffer, &FrameLen, + sizeof(HEADER_802_11), + &AuthHdr, + CIPHER_TEXT_LEN + 16, + CyperChlgText, + END_OF_ARGS); + MiniportMMRequest(pAd, 0, pOutBuffer, + FrameLen); + MlmeFreeMemory(pAd, pOutBuffer); + + RTMPSetTimer(&pAd->MlmeAux.AuthTimer, + AUTH_TIMEOUT); + pAd->Mlme.AuthMachine.CurrState = + AUTH_WAIT_SEQ4; + } + } else { + pAd->StaCfg.AuthFailReason = Status; + COPY_MAC_ADDR(pAd->StaCfg.AuthFailSta, Addr2); + pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, + MT2_AUTH_CONF, 2, &Status); + } + } + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("AUTH - PeerAuthSanity() sanity check fail\n")); + } } /* @@ -249,36 +282,35 @@ VOID PeerAuthRspAtSeq2Action( ========================================================================== */ -VOID PeerAuthRspAtSeq4Action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerAuthRspAtSeq4Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Addr2[MAC_ADDR_LEN]; - USHORT Alg, Seq, Status; - CHAR ChlgText[CIPHER_TEXT_LEN]; - BOOLEAN TimerCancelled; - - if(PeerAuthSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Alg, &Seq, &Status, ChlgText)) - { - if(MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, Addr2) && Seq == 4) - { - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Receive AUTH_RSP seq#4 to me\n")); - RTMPCancelTimer(&pAd->MlmeAux.AuthTimer, &TimerCancelled); - - if (Status != MLME_SUCCESS) - { - pAd->StaCfg.AuthFailReason = Status; - COPY_MAC_ADDR(pAd->StaCfg.AuthFailSta, Addr2); - } - - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); - } - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - PeerAuthRspAtSeq4Action() sanity check fail\n")); - } + UCHAR Addr2[MAC_ADDR_LEN]; + USHORT Alg, Seq, Status; + CHAR ChlgText[CIPHER_TEXT_LEN]; + BOOLEAN TimerCancelled; + + if (PeerAuthSanity + (pAd, Elem->Msg, Elem->MsgLen, Addr2, &Alg, &Seq, &Status, + ChlgText)) { + if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, Addr2) && Seq == 4) { + DBGPRINT(RT_DEBUG_TRACE, + ("AUTH - Receive AUTH_RSP seq#4 to me\n")); + RTMPCancelTimer(&pAd->MlmeAux.AuthTimer, + &TimerCancelled); + + if (Status != MLME_SUCCESS) { + pAd->StaCfg.AuthFailReason = Status; + COPY_MAC_ADDR(pAd->StaCfg.AuthFailSta, Addr2); + } + + pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, + 2, &Status); + } + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("AUTH - PeerAuthRspAtSeq4Action() sanity check fail\n")); + } } /* @@ -289,47 +321,49 @@ VOID PeerAuthRspAtSeq4Action( ========================================================================== */ -VOID MlmeDeauthReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID MlmeDeauthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - MLME_DEAUTH_REQ_STRUCT *pInfo; - HEADER_802_11 DeauthHdr; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - USHORT Status; - - pInfo = (MLME_DEAUTH_REQ_STRUCT *)Elem->Msg; - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - MlmeDeauthReqAction() allocate memory fail\n")); - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - Status = MLME_FAIL_NO_RESOURCE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DEAUTH_CONF, 2, &Status); - return; - } - - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Send DE-AUTH request (Reason=%d)...\n", pInfo->Reason)); - MgtMacHeaderInit(pAd, &DeauthHdr, SUBTYPE_DEAUTH, 0, pInfo->Addr, pAd->MlmeAux.Bssid); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11),&DeauthHdr, - 2, &pInfo->Reason, - END_OF_ARGS); - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); + MLME_DEAUTH_REQ_STRUCT *pInfo; + HEADER_802_11 DeauthHdr; + PUCHAR pOutBuffer = NULL; + NDIS_STATUS NStatus; + ULONG FrameLen = 0; + USHORT Status; + + pInfo = (MLME_DEAUTH_REQ_STRUCT *) Elem->Msg; + + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_TRACE, + ("AUTH - MlmeDeauthReqAction() allocate memory fail\n")); + pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; + Status = MLME_FAIL_NO_RESOURCE; + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DEAUTH_CONF, 2, + &Status); + return; + } + + DBGPRINT(RT_DEBUG_TRACE, + ("AUTH - Send DE-AUTH request (Reason=%d)...\n", + pInfo->Reason)); + MgtMacHeaderInit(pAd, &DeauthHdr, SUBTYPE_DEAUTH, 0, pInfo->Addr, + pAd->MlmeAux.Bssid); + MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(HEADER_802_11), + &DeauthHdr, 2, &pInfo->Reason, END_OF_ARGS); + MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); - pAd->StaCfg.DeauthReason = pInfo->Reason; - COPY_MAC_ADDR(pAd->StaCfg.DeauthSta, pInfo->Addr); - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - Status = MLME_SUCCESS; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DEAUTH_CONF, 2, &Status); + pAd->StaCfg.DeauthReason = pInfo->Reason; + COPY_MAC_ADDR(pAd->StaCfg.DeauthSta, pInfo->Addr); + pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; + Status = MLME_SUCCESS; + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DEAUTH_CONF, 2, &Status); // send wireless event - for deauthentication if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_DEAUTH_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); + RTMPSendWirelessEvent(pAd, IW_DEAUTH_EVENT_FLAG, + pAd->MacTab.Content[BSSID_WCID].Addr, + BSS0, 0); } /* @@ -340,15 +374,13 @@ VOID MlmeDeauthReqAction( ========================================================================== */ -VOID AuthTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID AuthTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - AuthTimeoutAction\n")); - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - Status = MLME_REJ_TIMEOUT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); + USHORT Status; + DBGPRINT(RT_DEBUG_TRACE, ("AUTH - AuthTimeoutAction\n")); + pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; + Status = MLME_REJ_TIMEOUT; + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); } /* @@ -359,15 +391,15 @@ VOID AuthTimeoutAction( ========================================================================== */ -VOID InvalidStateWhenAuth( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID InvalidStateWhenAuth(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - InvalidStateWhenAuth (state=%ld), reset AUTH state machine\n", pAd->Mlme.AuthMachine.CurrState)); - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - Status = MLME_STATE_MACHINE_REJECT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); + USHORT Status; + DBGPRINT(RT_DEBUG_TRACE, + ("AUTH - InvalidStateWhenAuth (state=%ld), reset AUTH state machine\n", + pAd->Mlme.AuthMachine.CurrState)); + pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; + Status = MLME_STATE_MACHINE_REJECT; + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); } /* @@ -382,109 +414,104 @@ VOID InvalidStateWhenAuth( ========================================================================== */ -VOID Cls2errAction( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr) +VOID Cls2errAction(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr) { - HEADER_802_11 DeauthHdr; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - USHORT Reason = REASON_CLS2ERR; - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NStatus != NDIS_STATUS_SUCCESS) - return; - - DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Class 2 error, Send DEAUTH frame...\n")); - MgtMacHeaderInit(pAd, &DeauthHdr, SUBTYPE_DEAUTH, 0, pAddr, pAd->MlmeAux.Bssid); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11),&DeauthHdr, - 2, &Reason, - END_OF_ARGS); - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); + HEADER_802_11 DeauthHdr; + PUCHAR pOutBuffer = NULL; + NDIS_STATUS NStatus; + ULONG FrameLen = 0; + USHORT Reason = REASON_CLS2ERR; + + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + if (NStatus != NDIS_STATUS_SUCCESS) + return; + + DBGPRINT(RT_DEBUG_TRACE, + ("AUTH - Class 2 error, Send DEAUTH frame...\n")); + MgtMacHeaderInit(pAd, &DeauthHdr, SUBTYPE_DEAUTH, 0, pAddr, + pAd->MlmeAux.Bssid); + MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(HEADER_802_11), + &DeauthHdr, 2, &Reason, END_OF_ARGS); + MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); - pAd->StaCfg.DeauthReason = Reason; - COPY_MAC_ADDR(pAd->StaCfg.DeauthSta, pAddr); + pAd->StaCfg.DeauthReason = Reason; + COPY_MAC_ADDR(pAd->StaCfg.DeauthSta, pAddr); } -BOOLEAN AUTH_ReqSend( - IN PRTMP_ADAPTER pAd, - IN PMLME_QUEUE_ELEM pElem, - IN PRALINK_TIMER_STRUCT pAuthTimer, - IN PSTRING pSMName, - IN USHORT SeqNo, - IN PUCHAR pNewElement, - IN ULONG ElementLen) +BOOLEAN AUTH_ReqSend(IN PRTMP_ADAPTER pAd, + IN PMLME_QUEUE_ELEM pElem, + IN PRALINK_TIMER_STRUCT pAuthTimer, + IN PSTRING pSMName, + IN USHORT SeqNo, + IN PUCHAR pNewElement, IN ULONG ElementLen) { - USHORT Alg, Seq, Status; - UCHAR Addr[6]; - ULONG Timeout; - HEADER_802_11 AuthHdr; - BOOLEAN TimerCancelled; - NDIS_STATUS NStatus; - PUCHAR pOutBuffer = NULL; - ULONG FrameLen = 0, tmp = 0; + USHORT Alg, Seq, Status; + UCHAR Addr[6]; + ULONG Timeout; + HEADER_802_11 AuthHdr; + BOOLEAN TimerCancelled; + NDIS_STATUS NStatus; + PUCHAR pOutBuffer = NULL; + ULONG FrameLen = 0, tmp = 0; // Block all authentication request durning WPA block period - if (pAd->StaCfg.bBlockAssoc == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s - Block Auth request durning WPA block period!\n", pSMName)); - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - Status = MLME_STATE_MACHINE_REJECT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); - } - else if(MlmeAuthReqSanity(pAd, pElem->Msg, pElem->MsgLen, Addr, &Timeout, &Alg)) - { - /* reset timer */ + if (pAd->StaCfg.bBlockAssoc == TRUE) { + DBGPRINT(RT_DEBUG_TRACE, + ("%s - Block Auth request durning WPA block period!\n", + pSMName)); + pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; + Status = MLME_STATE_MACHINE_REJECT; + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, + &Status); + } else + if (MlmeAuthReqSanity + (pAd, pElem->Msg, pElem->MsgLen, Addr, &Timeout, &Alg)) { + /* reset timer */ RTMPCancelTimer(pAuthTimer, &TimerCancelled); - COPY_MAC_ADDR(pAd->MlmeAux.Bssid, Addr); - pAd->MlmeAux.Alg = Alg; - Seq = SeqNo; - Status = MLME_SUCCESS; - - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if(NStatus != NDIS_STATUS_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("%s - MlmeAuthReqAction(Alg:%d) allocate memory failed\n", pSMName, Alg)); - pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; - Status = MLME_FAIL_NO_RESOURCE; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); - return FALSE; - } - - DBGPRINT(RT_DEBUG_TRACE, ("%s - Send AUTH request seq#1 (Alg=%d)...\n", pSMName, Alg)); - MgtMacHeaderInit(pAd, &AuthHdr, SUBTYPE_AUTH, 0, Addr, pAd->MlmeAux.Bssid); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11),&AuthHdr, - 2, &Alg, - 2, &Seq, - 2, &Status, - END_OF_ARGS); - - if (pNewElement && ElementLen) - { - MakeOutgoingFrame(pOutBuffer+FrameLen, &tmp, - ElementLen, pNewElement, + COPY_MAC_ADDR(pAd->MlmeAux.Bssid, Addr); + pAd->MlmeAux.Alg = Alg; + Seq = SeqNo; + Status = MLME_SUCCESS; + + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + if (NStatus != NDIS_STATUS_SUCCESS) { + DBGPRINT(RT_DEBUG_TRACE, + ("%s - MlmeAuthReqAction(Alg:%d) allocate memory failed\n", + pSMName, Alg)); + pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; + Status = MLME_FAIL_NO_RESOURCE; + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, + 2, &Status); + return FALSE; + } + + DBGPRINT(RT_DEBUG_TRACE, + ("%s - Send AUTH request seq#1 (Alg=%d)...\n", pSMName, + Alg)); + MgtMacHeaderInit(pAd, &AuthHdr, SUBTYPE_AUTH, 0, Addr, + pAd->MlmeAux.Bssid); + MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(HEADER_802_11), + &AuthHdr, 2, &Alg, 2, &Seq, 2, &Status, END_OF_ARGS); + + if (pNewElement && ElementLen) { + MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, + ElementLen, pNewElement, END_OF_ARGS); FrameLen += tmp; } - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - MlmeFreeMemory(pAd, pOutBuffer); + MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); + MlmeFreeMemory(pAd, pOutBuffer); RTMPSetTimer(pAuthTimer, Timeout); return TRUE; - } - else - { - DBGPRINT_ERR(("%s - MlmeAuthReqAction() sanity check failed\n", pSMName)); + } else { + DBGPRINT_ERR(("%s - MlmeAuthReqAction() sanity check failed\n", + pSMName)); return FALSE; - } + } return TRUE; } - - diff --git a/drivers/staging/rt2860/sta/auth_rsp.c b/drivers/staging/rt2860/sta/auth_rsp.c index 9c2fde479afe..3f383c519bbe 100644 --- a/drivers/staging/rt2860/sta/auth_rsp.c +++ b/drivers/staging/rt2860/sta/auth_rsp.c @@ -47,18 +47,21 @@ ========================================================================== */ -VOID AuthRspStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN PSTATE_MACHINE Sm, - IN STATE_MACHINE_FUNC Trans[]) +VOID AuthRspStateMachineInit(IN PRTMP_ADAPTER pAd, + IN PSTATE_MACHINE Sm, + IN STATE_MACHINE_FUNC Trans[]) { - StateMachineInit(Sm, Trans, MAX_AUTH_RSP_STATE, MAX_AUTH_RSP_MSG, (STATE_MACHINE_FUNC)Drop, AUTH_RSP_IDLE, AUTH_RSP_MACHINE_BASE); + StateMachineInit(Sm, Trans, MAX_AUTH_RSP_STATE, MAX_AUTH_RSP_MSG, + (STATE_MACHINE_FUNC) Drop, AUTH_RSP_IDLE, + AUTH_RSP_MACHINE_BASE); - // column 1 - StateMachineSetAction(Sm, AUTH_RSP_IDLE, MT2_PEER_DEAUTH, (STATE_MACHINE_FUNC)PeerDeauthAction); + // column 1 + StateMachineSetAction(Sm, AUTH_RSP_IDLE, MT2_PEER_DEAUTH, + (STATE_MACHINE_FUNC) PeerDeauthAction); - // column 2 - StateMachineSetAction(Sm, AUTH_RSP_WAIT_CHAL, MT2_PEER_DEAUTH, (STATE_MACHINE_FUNC)PeerDeauthAction); + // column 2 + StateMachineSetAction(Sm, AUTH_RSP_WAIT_CHAL, MT2_PEER_DEAUTH, + (STATE_MACHINE_FUNC) PeerDeauthAction); } @@ -70,39 +73,32 @@ VOID AuthRspStateMachineInit( ========================================================================== */ -VOID PeerAuthSimpleRspGenAndSend( - IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHdr80211, - IN USHORT Alg, - IN USHORT Seq, - IN USHORT Reason, - IN USHORT Status) +VOID PeerAuthSimpleRspGenAndSend(IN PRTMP_ADAPTER pAd, + IN PHEADER_802_11 pHdr80211, + IN USHORT Alg, + IN USHORT Seq, + IN USHORT Reason, IN USHORT Status) { - HEADER_802_11 AuthHdr; - ULONG FrameLen = 0; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - - if (Reason != MLME_SUCCESS) - { - DBGPRINT(RT_DEBUG_TRACE, ("Peer AUTH fail...\n")); - return; - } - + HEADER_802_11 AuthHdr; + ULONG FrameLen = 0; + PUCHAR pOutBuffer = NULL; + NDIS_STATUS NStatus; + + if (Reason != MLME_SUCCESS) { + DBGPRINT(RT_DEBUG_TRACE, ("Peer AUTH fail...\n")); + return; + } //Get an unused nonpaged memory - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); - if (NStatus != NDIS_STATUS_SUCCESS) - return; - - DBGPRINT(RT_DEBUG_TRACE, ("Send AUTH response (seq#2)...\n")); - MgtMacHeaderInit(pAd, &AuthHdr, SUBTYPE_AUTH, 0, pHdr80211->Addr2, pAd->MlmeAux.Bssid); - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &AuthHdr, - 2, &Alg, - 2, &Seq, - 2, &Reason, - END_OF_ARGS); - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); + if (NStatus != NDIS_STATUS_SUCCESS) + return; + + DBGPRINT(RT_DEBUG_TRACE, ("Send AUTH response (seq#2)...\n")); + MgtMacHeaderInit(pAd, &AuthHdr, SUBTYPE_AUTH, 0, pHdr80211->Addr2, + pAd->MlmeAux.Bssid); + MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(HEADER_802_11), + &AuthHdr, 2, &Alg, 2, &Seq, 2, &Reason, END_OF_ARGS); + MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); } @@ -114,35 +110,33 @@ VOID PeerAuthSimpleRspGenAndSend( ========================================================================== */ -VOID PeerDeauthAction( - IN PRTMP_ADAPTER pAd, - IN PMLME_QUEUE_ELEM Elem) +VOID PeerDeauthAction(IN PRTMP_ADAPTER pAd, IN PMLME_QUEUE_ELEM Elem) { - UCHAR Addr2[MAC_ADDR_LEN]; - USHORT Reason; - - if (PeerDeauthSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Reason)) - { - if (INFRA_ON(pAd) - && MAC_ADDR_EQUAL(Addr2, pAd->CommonCfg.Bssid) - ) - { - DBGPRINT(RT_DEBUG_TRACE,("AUTH_RSP - receive DE-AUTH from our AP (Reason=%d)\n", Reason)); + UCHAR Addr2[MAC_ADDR_LEN]; + USHORT Reason; + if (PeerDeauthSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Reason)) { + if (INFRA_ON(pAd) + && MAC_ADDR_EQUAL(Addr2, pAd->CommonCfg.Bssid) + ) { + DBGPRINT(RT_DEBUG_TRACE, + ("AUTH_RSP - receive DE-AUTH from our AP (Reason=%d)\n", + Reason)); - RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0); - + RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, + 0); // send wireless event - for deauthentication if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_DEAUTH_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - - LinkDown(pAd, TRUE); - } - } - else - { - DBGPRINT(RT_DEBUG_TRACE,("AUTH_RSP - PeerDeauthAction() sanity check fail\n")); - } + RTMPSendWirelessEvent(pAd, IW_DEAUTH_EVENT_FLAG, + pAd->MacTab. + Content[BSSID_WCID].Addr, + BSS0, 0); + + LinkDown(pAd, TRUE); + } + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("AUTH_RSP - PeerDeauthAction() sanity check fail\n")); + } } - diff --git a/drivers/staging/rt2860/sta/connect.c b/drivers/staging/rt2860/sta/connect.c index 43edd8e1f284..dc8b2d54a9fe 100644 --- a/drivers/staging/rt2860/sta/connect.c +++ b/drivers/staging/rt2860/sta/connect.c @@ -36,27 +36,31 @@ */ #include "../rt_config.h" -UCHAR CipherSuiteWpaNoneTkip[] = { - 0x00, 0x50, 0xf2, 0x01, // oui - 0x01, 0x00, // Version - 0x00, 0x50, 0xf2, 0x02, // Multicast - 0x01, 0x00, // Number of unicast - 0x00, 0x50, 0xf2, 0x02, // unicast - 0x01, 0x00, // number of authentication method - 0x00, 0x50, 0xf2, 0x00 // authentication - }; -UCHAR CipherSuiteWpaNoneTkipLen = (sizeof(CipherSuiteWpaNoneTkip) / sizeof(UCHAR)); - -UCHAR CipherSuiteWpaNoneAes[] = { - 0x00, 0x50, 0xf2, 0x01, // oui - 0x01, 0x00, // Version - 0x00, 0x50, 0xf2, 0x04, // Multicast - 0x01, 0x00, // Number of unicast - 0x00, 0x50, 0xf2, 0x04, // unicast - 0x01, 0x00, // number of authentication method - 0x00, 0x50, 0xf2, 0x00 // authentication - }; -UCHAR CipherSuiteWpaNoneAesLen = (sizeof(CipherSuiteWpaNoneAes) / sizeof(UCHAR)); +UCHAR CipherSuiteWpaNoneTkip[] = { + 0x00, 0x50, 0xf2, 0x01, // oui + 0x01, 0x00, // Version + 0x00, 0x50, 0xf2, 0x02, // Multicast + 0x01, 0x00, // Number of unicast + 0x00, 0x50, 0xf2, 0x02, // unicast + 0x01, 0x00, // number of authentication method + 0x00, 0x50, 0xf2, 0x00 // authentication +}; + +UCHAR CipherSuiteWpaNoneTkipLen = + (sizeof(CipherSuiteWpaNoneTkip) / sizeof(UCHAR)); + +UCHAR CipherSuiteWpaNoneAes[] = { + 0x00, 0x50, 0xf2, 0x01, // oui + 0x01, 0x00, // Version + 0x00, 0x50, 0xf2, 0x04, // Multicast + 0x01, 0x00, // Number of unicast + 0x00, 0x50, 0xf2, 0x04, // unicast + 0x01, 0x00, // number of authentication method + 0x00, 0x50, 0xf2, 0x00 // authentication +}; + +UCHAR CipherSuiteWpaNoneAesLen = + (sizeof(CipherSuiteWpaNoneAes) / sizeof(UCHAR)); // The following MACRO is called after 1. starting an new IBSS, 2. succesfully JOIN an IBSS, // or 3. succesfully ASSOCIATE to a BSS, 4. successfully RE_ASSOCIATE to a BSS @@ -98,10 +102,8 @@ UCHAR CipherSuiteWpaNoneAesLen = (sizeof(CipherSuiteWpaNoneAes) / sizeof(UCHAR)) ========================================================================== */ -VOID MlmeCntlInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - OUT STATE_MACHINE_FUNC Trans[]) +VOID MlmeCntlInit(IN PRTMP_ADAPTER pAd, + IN STATE_MACHINE * S, OUT STATE_MACHINE_FUNC Trans[]) { // Control state machine differs from other state machines, the interface // follows the standard interface @@ -116,22 +118,20 @@ VOID MlmeCntlInit( ========================================================================== */ -VOID MlmeCntlMachinePerformAction( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - IN MLME_QUEUE_ELEM *Elem) +VOID MlmeCntlMachinePerformAction(IN PRTMP_ADAPTER pAd, + IN STATE_MACHINE * S, + IN MLME_QUEUE_ELEM * Elem) { - switch(pAd->Mlme.CntlMachine.CurrState) - { - case CNTL_IDLE: - CntlIdleProc(pAd, Elem); - break; - case CNTL_WAIT_DISASSOC: - CntlWaitDisassocProc(pAd, Elem); - break; - case CNTL_WAIT_JOIN: - CntlWaitJoinProc(pAd, Elem); - break; + switch (pAd->Mlme.CntlMachine.CurrState) { + case CNTL_IDLE: + CntlIdleProc(pAd, Elem); + break; + case CNTL_WAIT_DISASSOC: + CntlWaitDisassocProc(pAd, Elem); + break; + case CNTL_WAIT_JOIN: + CntlWaitJoinProc(pAd, Elem); + break; // CNTL_WAIT_REASSOC is the only state in CNTL machine that does // not triggered directly or indirectly by "RTMPSetInformation(OID_xxx)". @@ -139,89 +139,87 @@ VOID MlmeCntlMachinePerformAction( // rule. Which means NDIS may SET OID in the middle of ROAMing attempts. // Current approach is to block new SET request at RTMPSetInformation() // when CntlMachine.CurrState is not CNTL_IDLE - case CNTL_WAIT_REASSOC: - CntlWaitReassocProc(pAd, Elem); - break; - - case CNTL_WAIT_START: - CntlWaitStartProc(pAd, Elem); - break; - case CNTL_WAIT_AUTH: - CntlWaitAuthProc(pAd, Elem); - break; - case CNTL_WAIT_AUTH2: - CntlWaitAuthProc2(pAd, Elem); - break; - case CNTL_WAIT_ASSOC: - CntlWaitAssocProc(pAd, Elem); - break; + case CNTL_WAIT_REASSOC: + CntlWaitReassocProc(pAd, Elem); + break; + + case CNTL_WAIT_START: + CntlWaitStartProc(pAd, Elem); + break; + case CNTL_WAIT_AUTH: + CntlWaitAuthProc(pAd, Elem); + break; + case CNTL_WAIT_AUTH2: + CntlWaitAuthProc2(pAd, Elem); + break; + case CNTL_WAIT_ASSOC: + CntlWaitAssocProc(pAd, Elem); + break; + + case CNTL_WAIT_OID_LIST_SCAN: + if (Elem->MsgType == MT2_SCAN_CONF) { + // Resume TxRing after SCANING complete. We hope the out-of-service time + // won't be too long to let upper layer time-out the waiting frames + RTMPResumeMsduTransmission(pAd); - case CNTL_WAIT_OID_LIST_SCAN: - if(Elem->MsgType == MT2_SCAN_CONF) - { - // Resume TxRing after SCANING complete. We hope the out-of-service time - // won't be too long to let upper layer time-out the waiting frames - RTMPResumeMsduTransmission(pAd); - - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; + pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - // - // Set LED status to previous status. - // - if (pAd->bLedOnScanning) - { - pAd->bLedOnScanning = FALSE; - RTMPSetLED(pAd, pAd->LedStatus); - } + // + // Set LED status to previous status. + // + if (pAd->bLedOnScanning) { + pAd->bLedOnScanning = FALSE; + RTMPSetLED(pAd, pAd->LedStatus); } - break; + } + break; - case CNTL_WAIT_OID_DISASSOC: - if (Elem->MsgType == MT2_DISASSOC_CONF) - { - LinkDown(pAd, FALSE); - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - } - break; + case CNTL_WAIT_OID_DISASSOC: + if (Elem->MsgType == MT2_DISASSOC_CONF) { + LinkDown(pAd, FALSE); + pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; + } + break; #ifdef RTMP_MAC_USB // // This state is for that we want to connect to an AP but // it didn't find on BSS List table. So we need to scan the air first, // after that we can try to connect to the desired AP if available. // - case CNTL_WAIT_SCAN_FOR_CONNECT: - if(Elem->MsgType == MT2_SCAN_CONF) - { - // Resume TxRing after SCANING complete. We hope the out-of-service time - // won't be too long to let upper layer time-out the waiting frames - RTMPResumeMsduTransmission(pAd); + case CNTL_WAIT_SCAN_FOR_CONNECT: + if (Elem->MsgType == MT2_SCAN_CONF) { + // Resume TxRing after SCANING complete. We hope the out-of-service time + // won't be too long to let upper layer time-out the waiting frames + RTMPResumeMsduTransmission(pAd); #ifdef CCX_SUPPORT - if (pAd->StaCfg.CCXReqType != MSRN_TYPE_UNUSED) - { - // Cisco scan request is finished, prepare beacon report - MlmeEnqueue(pAd, AIRONET_STATE_MACHINE, MT2_AIRONET_SCAN_DONE, 0, NULL); - } + if (pAd->StaCfg.CCXReqType != MSRN_TYPE_UNUSED) { + // Cisco scan request is finished, prepare beacon report + MlmeEnqueue(pAd, AIRONET_STATE_MACHINE, + MT2_AIRONET_SCAN_DONE, 0, NULL); + } #endif // CCX_SUPPORT // - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; + pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - // - // Check if we can connect to. - // - BssTableSsidSort(pAd, &pAd->MlmeAux.SsidBssTab, (CHAR *) pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen); - if (pAd->MlmeAux.SsidBssTab.BssNr > 0) - { - MlmeAutoReconnectLastSSID(pAd); - } + // + // Check if we can connect to. + // + BssTableSsidSort(pAd, &pAd->MlmeAux.SsidBssTab, + (CHAR *) pAd->MlmeAux. + AutoReconnectSsid, + pAd->MlmeAux.AutoReconnectSsidLen); + if (pAd->MlmeAux.SsidBssTab.BssNr > 0) { + MlmeAutoReconnectLastSSID(pAd); } - break; + } + break; #endif // RTMP_MAC_USB // - default: - DBGPRINT_ERR(("!ERROR! CNTL - Illegal message type(=%ld)", Elem->MsgType)); - break; + default: + DBGPRINT_ERR(("!ERROR! CNTL - Illegal message type(=%ld)", + Elem->MsgType)); + break; } } - /* ========================================================================== Description: @@ -230,94 +228,95 @@ VOID MlmeCntlMachinePerformAction( ========================================================================== */ -VOID CntlIdleProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID CntlIdleProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - MLME_DISASSOC_REQ_STRUCT DisassocReq; + MLME_DISASSOC_REQ_STRUCT DisassocReq; if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) return; - switch(Elem->MsgType) - { - case OID_802_11_SSID: - CntlOidSsidProc(pAd, Elem); - break; + switch (Elem->MsgType) { + case OID_802_11_SSID: + CntlOidSsidProc(pAd, Elem); + break; - case OID_802_11_BSSID: - CntlOidRTBssidProc(pAd,Elem); - break; + case OID_802_11_BSSID: + CntlOidRTBssidProc(pAd, Elem); + break; - case OID_802_11_BSSID_LIST_SCAN: - CntlOidScanProc(pAd,Elem); - break; + case OID_802_11_BSSID_LIST_SCAN: + CntlOidScanProc(pAd, Elem); + break; - case OID_802_11_DISASSOCIATE: - DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_DISASSOC_STA_LEAVING); - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC; - - if (pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_ENABLE_WITH_WEB_UI) - { - // Set the AutoReconnectSsid to prevent it reconnect to old SSID - // Since calling this indicate user don't want to connect to that SSID anymore. - pAd->MlmeAux.AutoReconnectSsidLen= 32; - NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen); - } - break; + case OID_802_11_DISASSOCIATE: + DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, + REASON_DISASSOC_STA_LEAVING); + MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, + sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); + pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC; + + if (pAd->StaCfg.WpaSupplicantUP != + WPA_SUPPLICANT_ENABLE_WITH_WEB_UI) { + // Set the AutoReconnectSsid to prevent it reconnect to old SSID + // Since calling this indicate user don't want to connect to that SSID anymore. + pAd->MlmeAux.AutoReconnectSsidLen = 32; + NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, + pAd->MlmeAux.AutoReconnectSsidLen); + } + break; - case MT2_MLME_ROAMING_REQ: - CntlMlmeRoamingProc(pAd, Elem); - break; + case MT2_MLME_ROAMING_REQ: + CntlMlmeRoamingProc(pAd, Elem); + break; - case OID_802_11_MIC_FAILURE_REPORT_FRAME: - WpaMicFailureReportFrame(pAd, Elem); - break; + case OID_802_11_MIC_FAILURE_REPORT_FRAME: + WpaMicFailureReportFrame(pAd, Elem); + break; - default: - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Illegal message in CntlIdleProc(MsgType=%ld)\n",Elem->MsgType)); - break; + default: + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - Illegal message in CntlIdleProc(MsgType=%ld)\n", + Elem->MsgType)); + break; } } -VOID CntlOidScanProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID CntlOidScanProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - MLME_SCAN_REQ_STRUCT ScanReq; - ULONG BssIdx = BSS_NOT_FOUND; - BSS_ENTRY CurrBss; - - + MLME_SCAN_REQ_STRUCT ScanReq; + ULONG BssIdx = BSS_NOT_FOUND; + BSS_ENTRY CurrBss; // record current BSS if network is connected. // 2003-2-13 do not include current IBSS if this is the only STA in this IBSS. - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - BssIdx = BssSsidTableSearch(&pAd->ScanTab, pAd->CommonCfg.Bssid, (PUCHAR)pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen, pAd->CommonCfg.Channel); - if (BssIdx != BSS_NOT_FOUND) - { - NdisMoveMemory(&CurrBss, &pAd->ScanTab.BssEntry[BssIdx], sizeof(BSS_ENTRY)); + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) { + BssIdx = + BssSsidTableSearch(&pAd->ScanTab, pAd->CommonCfg.Bssid, + (PUCHAR) pAd->CommonCfg.Ssid, + pAd->CommonCfg.SsidLen, + pAd->CommonCfg.Channel); + if (BssIdx != BSS_NOT_FOUND) { + NdisMoveMemory(&CurrBss, &pAd->ScanTab.BssEntry[BssIdx], + sizeof(BSS_ENTRY)); } } - // clean up previous SCAN result, add current BSS back to table if any BssTableInit(&pAd->ScanTab); - if (BssIdx != BSS_NOT_FOUND) - { + if (BssIdx != BSS_NOT_FOUND) { // DDK Note: If the NIC is associated with a particular BSSID and SSID // that are not contained in the list of BSSIDs generated by this scan, the // BSSID description of the currently associated BSSID and SSID should be // appended to the list of BSSIDs in the NIC's database. // To ensure this, we append this BSS as the first entry in SCAN result - NdisMoveMemory(&pAd->ScanTab.BssEntry[0], &CurrBss, sizeof(BSS_ENTRY)); + NdisMoveMemory(&pAd->ScanTab.BssEntry[0], &CurrBss, + sizeof(BSS_ENTRY)); pAd->ScanTab.BssNr = 1; } - ScanParmFill(pAd, &ScanReq, (PSTRING) Elem->Msg, Elem->MsgLen, BSS_ANY, SCAN_ACTIVE); + ScanParmFill(pAd, &ScanReq, (PSTRING) Elem->Msg, Elem->MsgLen, BSS_ANY, + SCAN_ACTIVE); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, - sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); + sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; } @@ -330,19 +329,16 @@ VOID CntlOidScanProc( ========================================================================== */ -VOID CntlOidSsidProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM * Elem) +VOID CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - PNDIS_802_11_SSID pOidSsid = (NDIS_802_11_SSID *)Elem->Msg; - MLME_DISASSOC_REQ_STRUCT DisassocReq; - ULONG Now; - + PNDIS_802_11_SSID pOidSsid = (NDIS_802_11_SSID *) Elem->Msg; + MLME_DISASSOC_REQ_STRUCT DisassocReq; + ULONG Now; // Step 1. record the desired user settings to MlmeAux NdisZeroMemory(pAd->MlmeAux.Ssid, MAX_LEN_OF_SSID); NdisMoveMemory(pAd->MlmeAux.Ssid, pOidSsid->Ssid, pOidSsid->SsidLength); - pAd->MlmeAux.SsidLen = (UCHAR)pOidSsid->SsidLength; + pAd->MlmeAux.SsidLen = (UCHAR) pOidSsid->SsidLength; NdisZeroMemory(pAd->MlmeAux.Bssid, MAC_ADDR_LEN); pAd->MlmeAux.BssType = pAd->StaCfg.BssType; @@ -352,83 +348,97 @@ VOID CntlOidSsidProc( // Update Reconnect Ssid, that user desired to connect. // NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, MAX_LEN_OF_SSID); - NdisMoveMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); + NdisMoveMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.Ssid, + pAd->MlmeAux.SsidLen); pAd->MlmeAux.AutoReconnectSsidLen = pAd->MlmeAux.SsidLen; // step 2. find all matching BSS in the lastest SCAN result (inBssTab) // & log them into MlmeAux.SsidBssTab for later-on iteration. Sort by RSSI order - BssTableSsidSort(pAd, &pAd->MlmeAux.SsidBssTab, (PCHAR)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); + BssTableSsidSort(pAd, &pAd->MlmeAux.SsidBssTab, + (PCHAR) pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); - DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - %d BSS of %d BSS match the desire (%d)SSID - %s\n", - pAd->MlmeAux.SsidBssTab.BssNr, pAd->ScanTab.BssNr, pAd->MlmeAux.SsidLen, pAd->MlmeAux.Ssid)); + DBGPRINT(RT_DEBUG_TRACE, + ("CntlOidSsidProc():CNTL - %d BSS of %d BSS match the desire (%d)SSID - %s\n", + pAd->MlmeAux.SsidBssTab.BssNr, pAd->ScanTab.BssNr, + pAd->MlmeAux.SsidLen, pAd->MlmeAux.Ssid)); NdisGetSystemUpTime(&Now); if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) && - (pAd->CommonCfg.SsidLen == pAd->MlmeAux.SsidBssTab.BssEntry[0].SsidLen) && - NdisEqualMemory(pAd->CommonCfg.Ssid, pAd->MlmeAux.SsidBssTab.BssEntry[0].Ssid, pAd->CommonCfg.SsidLen) && - MAC_ADDR_EQUAL(pAd->CommonCfg.Bssid, pAd->MlmeAux.SsidBssTab.BssEntry[0].Bssid)) - { + (pAd->CommonCfg.SsidLen == + pAd->MlmeAux.SsidBssTab.BssEntry[0].SsidLen) + && NdisEqualMemory(pAd->CommonCfg.Ssid, + pAd->MlmeAux.SsidBssTab.BssEntry[0].Ssid, + pAd->CommonCfg.SsidLen) + && MAC_ADDR_EQUAL(pAd->CommonCfg.Bssid, + pAd->MlmeAux.SsidBssTab.BssEntry[0].Bssid)) { // Case 1. already connected with an AP who has the desired SSID // with highest RSSI // Add checking Mode "LEAP" for CCX 1.0 if (((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) - ) && - (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED)) - { + (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || + (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || + (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) + ) && + (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED)) { // case 1.1 For WPA, WPA-PSK, if the 1x port is not secured, we have to redo // connection process - DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - disassociate with current AP...\n")); - DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_DISASSOC_STA_LEAVING); - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, - sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); + DBGPRINT(RT_DEBUG_TRACE, + ("CntlOidSsidProc():CNTL - disassociate with current AP...\n")); + DisassocParmFill(pAd, &DisassocReq, + pAd->CommonCfg.Bssid, + REASON_DISASSOC_STA_LEAVING); + MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, + MT2_MLME_DISASSOC_REQ, + sizeof(MLME_DISASSOC_REQ_STRUCT), + &DisassocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; - } - else if (pAd->bConfigChanged == TRUE) - { + } else if (pAd->bConfigChanged == TRUE) { // case 1.2 Important Config has changed, we have to reconnect to the same AP - DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - disassociate with current AP Because config changed...\n")); - DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_DISASSOC_STA_LEAVING); - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, - sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); + DBGPRINT(RT_DEBUG_TRACE, + ("CntlOidSsidProc():CNTL - disassociate with current AP Because config changed...\n")); + DisassocParmFill(pAd, &DisassocReq, + pAd->CommonCfg.Bssid, + REASON_DISASSOC_STA_LEAVING); + MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, + MT2_MLME_DISASSOC_REQ, + sizeof(MLME_DISASSOC_REQ_STRUCT), + &DisassocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; - } - else - { + } else { // case 1.3. already connected to the SSID with highest RSSI. - DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - already with this BSSID. ignore this SET_SSID request\n")); + DBGPRINT(RT_DEBUG_TRACE, + ("CntlOidSsidProc():CNTL - already with this BSSID. ignore this SET_SSID request\n")); // // (HCT 12.1) 1c_wlan_mediaevents required // media connect events are indicated when associating with the same AP // - if (INFRA_ON(pAd)) - { + if (INFRA_ON(pAd)) { // // Since MediaState already is NdisMediaStateConnected // We just indicate the connect event again to meet the WHQL required. // - pAd->IndicateMediaState = NdisMediaStateConnected; + pAd->IndicateMediaState = + NdisMediaStateConnected; RTMP_IndicateMediaState(pAd); - pAd->ExtraInfo = GENERAL_LINK_UP; // Update extra information to link is up + pAd->ExtraInfo = GENERAL_LINK_UP; // Update extra information to link is up } pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, &pAd->MlmeAux.Bssid[0], NULL, 0); + RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, + &pAd->MlmeAux.Bssid[0], NULL, + 0); } - } - else if (INFRA_ON(pAd)) - { + } else if (INFRA_ON(pAd)) { // // For RT61 // [88888] OID_802_11_SSID should have returned NDTEST_WEP_AP2(Returned: ) // RT61 may lost SSID, and not connect to NDTEST_WEP_AP2 and will connect to NDTEST_WEP_AP2 by Autoreconnect // But media status is connected, so the SSID not report correctly. // - if (!SSID_EQUAL(pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen)) - { + if (!SSID_EQUAL + (pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen, + pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen)) { // // Different SSID means not Roaming case, so we let LinkDown() to Indicate a disconnect event. // @@ -440,49 +450,53 @@ VOID CntlOidSsidProc( // disassociate with the current associated AP, // then perform a new association with this new SSID, no matter the // new/old SSID are the same or not. - DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - disassociate with current AP...\n")); - DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_DISASSOC_STA_LEAVING); + DBGPRINT(RT_DEBUG_TRACE, + ("CntlOidSsidProc():CNTL - disassociate with current AP...\n")); + DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, + REASON_DISASSOC_STA_LEAVING); MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, - sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); + sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; - } - else - { - if (ADHOC_ON(pAd)) - { - DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - drop current ADHOC\n")); + } else { + if (ADHOC_ON(pAd)) { + DBGPRINT(RT_DEBUG_TRACE, + ("CntlOidSsidProc():CNTL - drop current ADHOC\n")); LinkDown(pAd, FALSE); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); + OPSTATUS_CLEAR_FLAG(pAd, + fOP_STATUS_MEDIA_STATE_CONNECTED); pAd->IndicateMediaState = NdisMediaStateDisconnected; RTMP_IndicateMediaState(pAd); - pAd->ExtraInfo = GENERAL_LINK_DOWN; - DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():NDIS_STATUS_MEDIA_DISCONNECT Event C!\n")); + pAd->ExtraInfo = GENERAL_LINK_DOWN; + DBGPRINT(RT_DEBUG_TRACE, + ("CntlOidSsidProc():NDIS_STATUS_MEDIA_DISCONNECT Event C!\n")); } if ((pAd->MlmeAux.SsidBssTab.BssNr == 0) && - (pAd->StaCfg.bAutoReconnect == TRUE) && - (pAd->MlmeAux.BssType == BSS_INFRA) && - (MlmeValidateSSID(pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen) == TRUE) - ) - { - MLME_SCAN_REQ_STRUCT ScanReq; - - DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - No matching BSS, start a new scan\n")); - ScanParmFill(pAd, &ScanReq, (PSTRING) pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, BSS_ANY, SCAN_ACTIVE); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; + (pAd->StaCfg.bAutoReconnect == TRUE) && + (pAd->MlmeAux.BssType == BSS_INFRA) && + (MlmeValidateSSID(pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen) + == TRUE) + ) { + MLME_SCAN_REQ_STRUCT ScanReq; + + DBGPRINT(RT_DEBUG_TRACE, + ("CntlOidSsidProc():CNTL - No matching BSS, start a new scan\n")); + ScanParmFill(pAd, &ScanReq, (PSTRING) pAd->MlmeAux.Ssid, + pAd->MlmeAux.SsidLen, BSS_ANY, + SCAN_ACTIVE); + MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, + sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); + pAd->Mlme.CntlMachine.CurrState = + CNTL_WAIT_OID_LIST_SCAN; // Reset Missed scan number pAd->StaCfg.LastScanTime = Now; - } - else - { + } else { pAd->MlmeAux.BssIdx = 0; IterateOnBssTab(pAd); } } } - /* ========================================================================== Description: @@ -491,14 +505,12 @@ VOID CntlOidSsidProc( ========================================================================== */ -VOID CntlOidRTBssidProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM * Elem) +VOID CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - ULONG BssIdx; - PUCHAR pOidBssid = (PUCHAR)Elem->Msg; - MLME_DISASSOC_REQ_STRUCT DisassocReq; - MLME_JOIN_REQ_STRUCT JoinReq; + ULONG BssIdx; + PUCHAR pOidBssid = (PUCHAR) Elem->Msg; + MLME_DISASSOC_REQ_STRUCT DisassocReq; + MLME_JOIN_REQ_STRUCT JoinReq; // record user desired settings COPY_MAC_ADDR(pAd->MlmeAux.Bssid, pOidBssid); @@ -506,110 +518,149 @@ VOID CntlOidRTBssidProc( // find the desired BSS in the latest SCAN result table BssIdx = BssTableSearch(&pAd->ScanTab, pOidBssid, pAd->MlmeAux.Channel); - if (BssIdx == BSS_NOT_FOUND) - { - MLME_SCAN_REQ_STRUCT ScanReq; + if (BssIdx == BSS_NOT_FOUND) { + MLME_SCAN_REQ_STRUCT ScanReq; - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - BSSID not found. reply NDIS_STATUS_NOT_ACCEPTED\n")); + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - BSSID not found. reply NDIS_STATUS_NOT_ACCEPTED\n")); //pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - BSSID not found. start a new scan\n")); - ScanParmFill(pAd, &ScanReq, (PSTRING) pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, BSS_ANY, SCAN_ACTIVE); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - BSSID not found. start a new scan\n")); + ScanParmFill(pAd, &ScanReq, (PSTRING) pAd->MlmeAux.Ssid, + pAd->MlmeAux.SsidLen, BSS_ANY, SCAN_ACTIVE); + MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, + sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; // Reset Missed scan number NdisGetSystemUpTime(&pAd->StaCfg.LastScanTime); return; } - // // Update Reconnect Ssid, that user desired to connect. // NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, MAX_LEN_OF_SSID); - pAd->MlmeAux.AutoReconnectSsidLen = pAd->ScanTab.BssEntry[BssIdx].SsidLen; - NdisMoveMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->ScanTab.BssEntry[BssIdx].Ssid, pAd->ScanTab.BssEntry[BssIdx].SsidLen); + pAd->MlmeAux.AutoReconnectSsidLen = + pAd->ScanTab.BssEntry[BssIdx].SsidLen; + NdisMoveMemory(pAd->MlmeAux.AutoReconnectSsid, + pAd->ScanTab.BssEntry[BssIdx].Ssid, + pAd->ScanTab.BssEntry[BssIdx].SsidLen); // copy the matched BSS entry from ScanTab to MlmeAux.SsidBssTab. Why? // Because we need this entry to become the JOIN target in later on SYNC state machine pAd->MlmeAux.BssIdx = 0; pAd->MlmeAux.SsidBssTab.BssNr = 1; - NdisMoveMemory(&pAd->MlmeAux.SsidBssTab.BssEntry[0], &pAd->ScanTab.BssEntry[BssIdx], sizeof(BSS_ENTRY)); + NdisMoveMemory(&pAd->MlmeAux.SsidBssTab.BssEntry[0], + &pAd->ScanTab.BssEntry[BssIdx], sizeof(BSS_ENTRY)); // Add SSID into MlmeAux for site surey joining hidden SSID pAd->MlmeAux.SsidLen = pAd->ScanTab.BssEntry[BssIdx].SsidLen; - NdisMoveMemory(pAd->MlmeAux.Ssid, pAd->ScanTab.BssEntry[BssIdx].Ssid, pAd->MlmeAux.SsidLen); + NdisMoveMemory(pAd->MlmeAux.Ssid, pAd->ScanTab.BssEntry[BssIdx].Ssid, + pAd->MlmeAux.SsidLen); { - if (INFRA_ON(pAd)) - { + if (INFRA_ON(pAd)) { // disassoc from current AP first - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - disassociate with current AP ...\n")); - DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_DISASSOC_STA_LEAVING); - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, - sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - disassociate with current AP ...\n")); + DisassocParmFill(pAd, &DisassocReq, + pAd->CommonCfg.Bssid, + REASON_DISASSOC_STA_LEAVING); + MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, + MT2_MLME_DISASSOC_REQ, + sizeof(MLME_DISASSOC_REQ_STRUCT), + &DisassocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; - } - else - { - if (ADHOC_ON(pAd)) - { - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - drop current ADHOC\n")); + } else { + if (ADHOC_ON(pAd)) { + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - drop current ADHOC\n")); LinkDown(pAd, FALSE); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); - pAd->IndicateMediaState = NdisMediaStateDisconnected; + OPSTATUS_CLEAR_FLAG(pAd, + fOP_STATUS_MEDIA_STATE_CONNECTED); + pAd->IndicateMediaState = + NdisMediaStateDisconnected; RTMP_IndicateMediaState(pAd); - pAd->ExtraInfo = GENERAL_LINK_DOWN; - DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_DISCONNECT Event C!\n")); + pAd->ExtraInfo = GENERAL_LINK_DOWN; + DBGPRINT(RT_DEBUG_TRACE, + ("NDIS_STATUS_MEDIA_DISCONNECT Event C!\n")); } - // Change the wepstatus to original wepstatus - pAd->StaCfg.WepStatus = pAd->StaCfg.OrigWepStatus; - pAd->StaCfg.PairCipher = pAd->StaCfg.OrigWepStatus; + pAd->StaCfg.WepStatus = pAd->StaCfg.OrigWepStatus; + pAd->StaCfg.PairCipher = pAd->StaCfg.OrigWepStatus; pAd->StaCfg.GroupCipher = pAd->StaCfg.OrigWepStatus; // Check cipher suite, AP must have more secured cipher than station setting // Set the Pairwise and Group cipher to match the intended AP setting // We can only connect to AP with less secured cipher setting - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) - { - pAd->StaCfg.GroupCipher = pAd->ScanTab.BssEntry[BssIdx].WPA.GroupCipher; - - if (pAd->StaCfg.WepStatus == pAd->ScanTab.BssEntry[BssIdx].WPA.PairCipher) - pAd->StaCfg.PairCipher = pAd->ScanTab.BssEntry[BssIdx].WPA.PairCipher; - else if (pAd->ScanTab.BssEntry[BssIdx].WPA.PairCipherAux != Ndis802_11WEPDisabled) - pAd->StaCfg.PairCipher = pAd->ScanTab.BssEntry[BssIdx].WPA.PairCipherAux; + if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) + || (pAd->StaCfg.AuthMode == + Ndis802_11AuthModeWPAPSK)) { + pAd->StaCfg.GroupCipher = + pAd->ScanTab.BssEntry[BssIdx].WPA. + GroupCipher; + + if (pAd->StaCfg.WepStatus == + pAd->ScanTab.BssEntry[BssIdx].WPA. + PairCipher) + pAd->StaCfg.PairCipher = + pAd->ScanTab.BssEntry[BssIdx].WPA. + PairCipher; + else if (pAd->ScanTab.BssEntry[BssIdx].WPA. + PairCipherAux != Ndis802_11WEPDisabled) + pAd->StaCfg.PairCipher = + pAd->ScanTab.BssEntry[BssIdx].WPA. + PairCipherAux; else // There is no PairCipher Aux, downgrade our capability to TKIP - pAd->StaCfg.PairCipher = Ndis802_11Encryption2Enabled; - } - else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - pAd->StaCfg.GroupCipher = pAd->ScanTab.BssEntry[BssIdx].WPA2.GroupCipher; - - if (pAd->StaCfg.WepStatus == pAd->ScanTab.BssEntry[BssIdx].WPA2.PairCipher) - pAd->StaCfg.PairCipher = pAd->ScanTab.BssEntry[BssIdx].WPA2.PairCipher; - else if (pAd->ScanTab.BssEntry[BssIdx].WPA2.PairCipherAux != Ndis802_11WEPDisabled) - pAd->StaCfg.PairCipher = pAd->ScanTab.BssEntry[BssIdx].WPA2.PairCipherAux; + pAd->StaCfg.PairCipher = + Ndis802_11Encryption2Enabled; + } else + if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) + || (pAd->StaCfg.AuthMode == + Ndis802_11AuthModeWPA2PSK)) { + pAd->StaCfg.GroupCipher = + pAd->ScanTab.BssEntry[BssIdx].WPA2. + GroupCipher; + + if (pAd->StaCfg.WepStatus == + pAd->ScanTab.BssEntry[BssIdx].WPA2. + PairCipher) + pAd->StaCfg.PairCipher = + pAd->ScanTab.BssEntry[BssIdx].WPA2. + PairCipher; + else if (pAd->ScanTab.BssEntry[BssIdx].WPA2. + PairCipherAux != Ndis802_11WEPDisabled) + pAd->StaCfg.PairCipher = + pAd->ScanTab.BssEntry[BssIdx].WPA2. + PairCipherAux; else // There is no PairCipher Aux, downgrade our capability to TKIP - pAd->StaCfg.PairCipher = Ndis802_11Encryption2Enabled; + pAd->StaCfg.PairCipher = + Ndis802_11Encryption2Enabled; // RSN capability - pAd->StaCfg.RsnCapability = pAd->ScanTab.BssEntry[BssIdx].WPA2.RsnCapability; + pAd->StaCfg.RsnCapability = + pAd->ScanTab.BssEntry[BssIdx].WPA2. + RsnCapability; } - // Set Mix cipher flag - pAd->StaCfg.bMixCipher = (pAd->StaCfg.PairCipher == pAd->StaCfg.GroupCipher) ? FALSE : TRUE; + pAd->StaCfg.bMixCipher = + (pAd->StaCfg.PairCipher == + pAd->StaCfg.GroupCipher) ? FALSE : TRUE; /*if (pAd->StaCfg.bMixCipher == TRUE) - { - // If mix cipher, re-build RSNIE - RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, 0); - }*/ + { + // If mix cipher, re-build RSNIE + RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, 0); + } */ // No active association, join the BSS immediately - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - joining %02x:%02x:%02x:%02x:%02x:%02x ...\n", - pOidBssid[0],pOidBssid[1],pOidBssid[2],pOidBssid[3],pOidBssid[4],pOidBssid[5])); + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - joining %02x:%02x:%02x:%02x:%02x:%02x ...\n", + pOidBssid[0], pOidBssid[1], pOidBssid[2], + pOidBssid[3], pOidBssid[4], pOidBssid[5])); JoinParmFill(pAd, &JoinReq, pAd->MlmeAux.BssIdx); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_JOIN_REQ, sizeof(MLME_JOIN_REQ_STRUCT), &JoinReq); + MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_JOIN_REQ, + sizeof(MLME_JOIN_REQ_STRUCT), &JoinReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_JOIN; } @@ -624,13 +675,11 @@ VOID CntlOidRTBssidProc( // or been corrupted by other "SET OID"? // // IRQL = DISPATCH_LEVEL -VOID CntlMlmeRoamingProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID CntlMlmeRoamingProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { UCHAR BBPValue = 0; - DBGPRINT(RT_DEBUG_TRACE,("CNTL - Roaming in MlmeAux.RoamTab...\n")); + DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Roaming in MlmeAux.RoamTab...\n")); { //Let BBP register at 20MHz to do (fast) roaming. @@ -638,16 +687,16 @@ VOID CntlMlmeRoamingProc( BBPValue &= (~0x18); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - NdisMoveMemory(&pAd->MlmeAux.SsidBssTab, &pAd->MlmeAux.RoamTab, sizeof(pAd->MlmeAux.RoamTab)); - pAd->MlmeAux.SsidBssTab.BssNr = pAd->MlmeAux.RoamTab.BssNr; + NdisMoveMemory(&pAd->MlmeAux.SsidBssTab, &pAd->MlmeAux.RoamTab, + sizeof(pAd->MlmeAux.RoamTab)); + pAd->MlmeAux.SsidBssTab.BssNr = pAd->MlmeAux.RoamTab.BssNr; - BssTableSortByRssi(&pAd->MlmeAux.SsidBssTab); - pAd->MlmeAux.BssIdx = 0; - IterateOnBssTab(pAd); + BssTableSortByRssi(&pAd->MlmeAux.SsidBssTab); + pAd->MlmeAux.BssIdx = 0; + IterateOnBssTab(pAd); } } - /* ========================================================================== Description: @@ -656,34 +705,35 @@ VOID CntlMlmeRoamingProc( ========================================================================== */ -VOID CntlWaitDisassocProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID CntlWaitDisassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - MLME_START_REQ_STRUCT StartReq; + MLME_START_REQ_STRUCT StartReq; - if (Elem->MsgType == MT2_DISASSOC_CONF) - { + if (Elem->MsgType == MT2_DISASSOC_CONF) { DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Dis-associate successful\n")); - if (pAd->CommonCfg.bWirelessEvent) - { - RTMPSendWirelessEvent(pAd, IW_DISASSOC_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); + if (pAd->CommonCfg.bWirelessEvent) { + RTMPSendWirelessEvent(pAd, IW_DISASSOC_EVENT_FLAG, + pAd->MacTab.Content[BSSID_WCID]. + Addr, BSS0, 0); } LinkDown(pAd, FALSE); // case 1. no matching BSS, and user wants ADHOC, so we just start a new one - if ((pAd->MlmeAux.SsidBssTab.BssNr==0) && (pAd->StaCfg.BssType == BSS_ADHOC)) - { - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - No matching BSS, start a new ADHOC (Ssid=%s)...\n",pAd->MlmeAux.Ssid)); - StartParmFill(pAd, &StartReq, (PCHAR)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, sizeof(MLME_START_REQ_STRUCT), &StartReq); + if ((pAd->MlmeAux.SsidBssTab.BssNr == 0) + && (pAd->StaCfg.BssType == BSS_ADHOC)) { + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - No matching BSS, start a new ADHOC (Ssid=%s)...\n", + pAd->MlmeAux.Ssid)); + StartParmFill(pAd, &StartReq, (PCHAR) pAd->MlmeAux.Ssid, + pAd->MlmeAux.SsidLen); + MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, + sizeof(MLME_START_REQ_STRUCT), &StartReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_START; } // case 2. try each matched BSS - else - { + else { pAd->MlmeAux.BssIdx = 0; IterateOnBssTab(pAd); @@ -699,66 +749,74 @@ VOID CntlWaitDisassocProc( ========================================================================== */ -VOID CntlWaitJoinProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID CntlWaitJoinProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Reason; - MLME_AUTH_REQ_STRUCT AuthReq; + USHORT Reason; + MLME_AUTH_REQ_STRUCT AuthReq; - if (Elem->MsgType == MT2_JOIN_CONF) - { + if (Elem->MsgType == MT2_JOIN_CONF) { NdisMoveMemory(&Reason, Elem->Msg, sizeof(USHORT)); - if (Reason == MLME_SUCCESS) - { + if (Reason == MLME_SUCCESS) { // 1. joined an IBSS, we are pretty much done here - if (pAd->MlmeAux.BssType == BSS_ADHOC) - { - // + if (pAd->MlmeAux.BssType == BSS_ADHOC) { + // // 5G bands rules of Japan: // Ad hoc must be disabled in W53(ch52,56,60,64) channels. // - if ( (pAd->CommonCfg.bIEEE80211H == 1) && - RadarChannelCheck(pAd, pAd->CommonCfg.Channel) - ) - { - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Channel=%d, Join adhoc on W53(52,56,60,64) Channels are not accepted\n", pAd->CommonCfg.Channel)); + if ((pAd->CommonCfg.bIEEE80211H == 1) && + RadarChannelCheck(pAd, + pAd->CommonCfg.Channel) + ) { + pAd->Mlme.CntlMachine.CurrState = + CNTL_IDLE; + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - Channel=%d, Join adhoc on W53(52,56,60,64) Channels are not accepted\n", + pAd->CommonCfg.Channel)); return; } LinkUp(pAd, BSS_ADHOC); pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - join the IBSS = %02x:%02x:%02x:%02x:%02x:%02x ...\n", - pAd->CommonCfg.Bssid[0],pAd->CommonCfg.Bssid[1],pAd->CommonCfg.Bssid[2], - pAd->CommonCfg.Bssid[3],pAd->CommonCfg.Bssid[4],pAd->CommonCfg.Bssid[5])); - - pAd->IndicateMediaState = NdisMediaStateConnected; - pAd->ExtraInfo = GENERAL_LINK_UP; + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - join the IBSS = %02x:%02x:%02x:%02x:%02x:%02x ...\n", + pAd->CommonCfg.Bssid[0], + pAd->CommonCfg.Bssid[1], + pAd->CommonCfg.Bssid[2], + pAd->CommonCfg.Bssid[3], + pAd->CommonCfg.Bssid[4], + pAd->CommonCfg.Bssid[5])); + + pAd->IndicateMediaState = + NdisMediaStateConnected; + pAd->ExtraInfo = GENERAL_LINK_UP; } // 2. joined a new INFRA network, start from authentication - else - { + else { { // either Ndis802_11AuthModeShared or Ndis802_11AuthModeAutoSwitch, try shared key first - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeShared) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeAutoSwitch)) - { - AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, AUTH_MODE_KEY); + if ((pAd->StaCfg.AuthMode == + Ndis802_11AuthModeShared) + || (pAd->StaCfg.AuthMode == + Ndis802_11AuthModeAutoSwitch)) { + AuthParmFill(pAd, &AuthReq, + pAd->MlmeAux.Bssid, + AUTH_MODE_KEY); + } else { + AuthParmFill(pAd, &AuthReq, + pAd->MlmeAux.Bssid, + AUTH_MODE_OPEN); } - else - { - AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, AUTH_MODE_OPEN); - } - MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_MLME_AUTH_REQ, - sizeof(MLME_AUTH_REQ_STRUCT), &AuthReq); + MlmeEnqueue(pAd, AUTH_STATE_MACHINE, + MT2_MLME_AUTH_REQ, + sizeof + (MLME_AUTH_REQ_STRUCT), + &AuthReq); } - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_AUTH; + pAd->Mlme.CntlMachine.CurrState = + CNTL_WAIT_AUTH; } - } - else - { + } else { // 3. failed, try next BSS pAd->MlmeAux.BssIdx++; IterateOnBssTab(pAd); @@ -766,7 +824,6 @@ VOID CntlWaitJoinProc( } } - /* ========================================================================== Description: @@ -775,73 +832,86 @@ VOID CntlWaitJoinProc( ========================================================================== */ -VOID CntlWaitStartProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID CntlWaitStartProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Result; + USHORT Result; - if (Elem->MsgType == MT2_START_CONF) - { + if (Elem->MsgType == MT2_START_CONF) { NdisMoveMemory(&Result, Elem->Msg, sizeof(USHORT)); - if (Result == MLME_SUCCESS) - { - // + if (Result == MLME_SUCCESS) { + // // 5G bands rules of Japan: // Ad hoc must be disabled in W53(ch52,56,60,64) channels. // - if ( (pAd->CommonCfg.bIEEE80211H == 1) && - RadarChannelCheck(pAd, pAd->CommonCfg.Channel) - ) - { + if ((pAd->CommonCfg.bIEEE80211H == 1) && + RadarChannelCheck(pAd, pAd->CommonCfg.Channel) + ) { pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Channel=%d, Start adhoc on W53(52,56,60,64) Channels are not accepted\n", pAd->CommonCfg.Channel)); + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - Channel=%d, Start adhoc on W53(52,56,60,64) Channels are not accepted\n", + pAd->CommonCfg.Channel)); return; } - NdisZeroMemory(&pAd->StaActive.SupportedPhyInfo.MCSSet[0], 16); - if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) - { + NdisZeroMemory(&pAd->StaActive.SupportedPhyInfo. + MCSSet[0], 16); + if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) { N_ChannelCheck(pAd); SetCommonHT(pAd); - NdisMoveMemory(&pAd->MlmeAux.AddHtInfo, &pAd->CommonCfg.AddHTInfo, sizeof(ADD_HT_INFO_IE)); - RTMPCheckHt(pAd, BSSID_WCID, &pAd->CommonCfg.HtCapability, &pAd->CommonCfg.AddHTInfo); - pAd->StaActive.SupportedPhyInfo.bHtEnable = TRUE; - NdisMoveMemory(&pAd->StaActive.SupportedPhyInfo.MCSSet[0], &pAd->CommonCfg.HtCapability.MCSSet[0], 16); - COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(pAd); - - if ((pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth == BW_40) && - (pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset == EXTCHA_ABOVE)) - { - pAd->MlmeAux.CentralChannel = pAd->CommonCfg.Channel + 2; + NdisMoveMemory(&pAd->MlmeAux.AddHtInfo, + &pAd->CommonCfg.AddHTInfo, + sizeof(ADD_HT_INFO_IE)); + RTMPCheckHt(pAd, BSSID_WCID, + &pAd->CommonCfg.HtCapability, + &pAd->CommonCfg.AddHTInfo); + pAd->StaActive.SupportedPhyInfo.bHtEnable = + TRUE; + NdisMoveMemory(&pAd->StaActive.SupportedPhyInfo. + MCSSet[0], + &pAd->CommonCfg.HtCapability. + MCSSet[0], 16); + COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG + (pAd); + + if ((pAd->CommonCfg.HtCapability.HtCapInfo. + ChannelWidth == BW_40) + && (pAd->CommonCfg.AddHTInfo.AddHtInfo. + ExtChanOffset == EXTCHA_ABOVE)) { + pAd->MlmeAux.CentralChannel = + pAd->CommonCfg.Channel + 2; + } else + if ((pAd->CommonCfg.HtCapability.HtCapInfo. + ChannelWidth == BW_40) + && (pAd->CommonCfg.AddHTInfo.AddHtInfo. + ExtChanOffset == EXTCHA_BELOW)) { + pAd->MlmeAux.CentralChannel = + pAd->CommonCfg.Channel - 2; } - else if ((pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth == BW_40) && - (pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset == EXTCHA_BELOW)) - { - pAd->MlmeAux.CentralChannel = pAd->CommonCfg.Channel - 2; - } - } - else - { - pAd->StaActive.SupportedPhyInfo.bHtEnable = FALSE; + } else { + pAd->StaActive.SupportedPhyInfo.bHtEnable = + FALSE; } LinkUp(pAd, BSS_ADHOC); pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; // Before send beacon, driver need do radar detection - if ((pAd->CommonCfg.Channel > 14 ) - && (pAd->CommonCfg.bIEEE80211H == 1) - && RadarChannelCheck(pAd, pAd->CommonCfg.Channel)) - { - pAd->CommonCfg.RadarDetect.RDMode = RD_SILENCE_MODE; + if ((pAd->CommonCfg.Channel > 14) + && (pAd->CommonCfg.bIEEE80211H == 1) + && RadarChannelCheck(pAd, pAd->CommonCfg.Channel)) { + pAd->CommonCfg.RadarDetect.RDMode = + RD_SILENCE_MODE; pAd->CommonCfg.RadarDetect.RDCount = 0; } - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - start a new IBSS = %02x:%02x:%02x:%02x:%02x:%02x ...\n", - pAd->CommonCfg.Bssid[0],pAd->CommonCfg.Bssid[1],pAd->CommonCfg.Bssid[2], - pAd->CommonCfg.Bssid[3],pAd->CommonCfg.Bssid[4],pAd->CommonCfg.Bssid[5])); - } - else - { - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Start IBSS fail. BUG!!!!!\n")); + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - start a new IBSS = %02x:%02x:%02x:%02x:%02x:%02x ...\n", + pAd->CommonCfg.Bssid[0], + pAd->CommonCfg.Bssid[1], + pAd->CommonCfg.Bssid[2], + pAd->CommonCfg.Bssid[3], + pAd->CommonCfg.Bssid[4], + pAd->CommonCfg.Bssid[5])); + } else { + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - Start IBSS fail. BUG!!!!!\n")); pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; } } @@ -855,50 +925,55 @@ VOID CntlWaitStartProc( ========================================================================== */ -VOID CntlWaitAuthProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID CntlWaitAuthProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Reason; - MLME_ASSOC_REQ_STRUCT AssocReq; - MLME_AUTH_REQ_STRUCT AuthReq; + USHORT Reason; + MLME_ASSOC_REQ_STRUCT AssocReq; + MLME_AUTH_REQ_STRUCT AuthReq; - if (Elem->MsgType == MT2_AUTH_CONF) - { + if (Elem->MsgType == MT2_AUTH_CONF) { NdisMoveMemory(&Reason, Elem->Msg, sizeof(USHORT)); - if (Reason == MLME_SUCCESS) - { + if (Reason == MLME_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH OK\n")); - AssocParmFill(pAd, &AssocReq, pAd->MlmeAux.Bssid, pAd->MlmeAux.CapabilityInfo, - ASSOC_TIMEOUT, pAd->StaCfg.DefaultListenCount); + AssocParmFill(pAd, &AssocReq, pAd->MlmeAux.Bssid, + pAd->MlmeAux.CapabilityInfo, + ASSOC_TIMEOUT, + pAd->StaCfg.DefaultListenCount); { - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_ASSOC_REQ, - sizeof(MLME_ASSOC_REQ_STRUCT), &AssocReq); + MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, + MT2_MLME_ASSOC_REQ, + sizeof(MLME_ASSOC_REQ_STRUCT), + &AssocReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_ASSOC; + pAd->Mlme.CntlMachine.CurrState = + CNTL_WAIT_ASSOC; } - } - else - { + } else { // This fail may because of the AP already keep us in its MAC table without // ageing-out. The previous authentication attempt must have let it remove us. // so try Authentication again may help. For D-Link DWL-900AP+ compatibility. - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH FAIL, try again...\n")); + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - AUTH FAIL, try again...\n")); { - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeShared) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeAutoSwitch)) - { + if ((pAd->StaCfg.AuthMode == + Ndis802_11AuthModeShared) + || (pAd->StaCfg.AuthMode == + Ndis802_11AuthModeAutoSwitch)) { // either Ndis802_11AuthModeShared or Ndis802_11AuthModeAutoSwitch, try shared key first - AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, AUTH_MODE_KEY); + AuthParmFill(pAd, &AuthReq, + pAd->MlmeAux.Bssid, + AUTH_MODE_KEY); + } else { + AuthParmFill(pAd, &AuthReq, + pAd->MlmeAux.Bssid, + AUTH_MODE_OPEN); } - else - { - AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, AUTH_MODE_OPEN); - } - MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_MLME_AUTH_REQ, - sizeof(MLME_AUTH_REQ_STRUCT), &AuthReq); + MlmeEnqueue(pAd, AUTH_STATE_MACHINE, + MT2_MLME_AUTH_REQ, + sizeof(MLME_AUTH_REQ_STRUCT), + &AuthReq); } pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_AUTH2; @@ -914,46 +989,49 @@ VOID CntlWaitAuthProc( ========================================================================== */ -VOID CntlWaitAuthProc2( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID CntlWaitAuthProc2(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Reason; - MLME_ASSOC_REQ_STRUCT AssocReq; - MLME_AUTH_REQ_STRUCT AuthReq; + USHORT Reason; + MLME_ASSOC_REQ_STRUCT AssocReq; + MLME_AUTH_REQ_STRUCT AuthReq; - if (Elem->MsgType == MT2_AUTH_CONF) - { + if (Elem->MsgType == MT2_AUTH_CONF) { NdisMoveMemory(&Reason, Elem->Msg, sizeof(USHORT)); - if (Reason == MLME_SUCCESS) - { + if (Reason == MLME_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH OK\n")); - AssocParmFill(pAd, &AssocReq, pAd->MlmeAux.Bssid, pAd->MlmeAux.CapabilityInfo, - ASSOC_TIMEOUT, pAd->StaCfg.DefaultListenCount); + AssocParmFill(pAd, &AssocReq, pAd->MlmeAux.Bssid, + pAd->MlmeAux.CapabilityInfo, + ASSOC_TIMEOUT, + pAd->StaCfg.DefaultListenCount); { - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_ASSOC_REQ, - sizeof(MLME_ASSOC_REQ_STRUCT), &AssocReq); + MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, + MT2_MLME_ASSOC_REQ, + sizeof(MLME_ASSOC_REQ_STRUCT), + &AssocReq); - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_ASSOC; - } - } - else - { - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeAutoSwitch) && - (pAd->MlmeAux.Alg == Ndis802_11AuthModeShared)) - { - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH FAIL, try OPEN system...\n")); - AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, Ndis802_11AuthModeOpen); - MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_MLME_AUTH_REQ, - sizeof(MLME_AUTH_REQ_STRUCT), &AuthReq); - - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_AUTH2; + pAd->Mlme.CntlMachine.CurrState = + CNTL_WAIT_ASSOC; } - else - { + } else { + if ((pAd->StaCfg.AuthMode == + Ndis802_11AuthModeAutoSwitch) + && (pAd->MlmeAux.Alg == Ndis802_11AuthModeShared)) { + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - AUTH FAIL, try OPEN system...\n")); + AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, + Ndis802_11AuthModeOpen); + MlmeEnqueue(pAd, AUTH_STATE_MACHINE, + MT2_MLME_AUTH_REQ, + sizeof(MLME_AUTH_REQ_STRUCT), + &AuthReq); + + pAd->Mlme.CntlMachine.CurrState = + CNTL_WAIT_AUTH2; + } else { // not success, try next BSS - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH FAIL, give up; try next BSS\n")); - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; //??????? + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - AUTH FAIL, give up; try next BSS\n")); + pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; //??????? pAd->MlmeAux.BssIdx++; IterateOnBssTab(pAd); } @@ -969,30 +1047,30 @@ VOID CntlWaitAuthProc2( ========================================================================== */ -VOID CntlWaitAssocProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID CntlWaitAssocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Reason; + USHORT Reason; - if (Elem->MsgType == MT2_ASSOC_CONF) - { + if (Elem->MsgType == MT2_ASSOC_CONF) { NdisMoveMemory(&Reason, Elem->Msg, sizeof(USHORT)); - if (Reason == MLME_SUCCESS) - { - if (pAd->CommonCfg.bWirelessEvent) - { - RTMPSendWirelessEvent(pAd, IW_ASSOC_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); + if (Reason == MLME_SUCCESS) { + if (pAd->CommonCfg.bWirelessEvent) { + RTMPSendWirelessEvent(pAd, IW_ASSOC_EVENT_FLAG, + pAd->MacTab. + Content[BSSID_WCID].Addr, + BSS0, 0); } LinkUp(pAd, BSS_INFRA); pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Association successful on BSS #%ld\n",pAd->MlmeAux.BssIdx)); - } - else - { + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - Association successful on BSS #%ld\n", + pAd->MlmeAux.BssIdx)); + } else { // not success, try next BSS - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Association fails on BSS #%ld\n",pAd->MlmeAux.BssIdx)); + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - Association fails on BSS #%ld\n", + pAd->MlmeAux.BssIdx)); pAd->MlmeAux.BssIdx++; IterateOnBssTab(pAd); } @@ -1007,21 +1085,19 @@ VOID CntlWaitAssocProc( ========================================================================== */ -VOID CntlWaitReassocProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID CntlWaitReassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Result; + USHORT Result; - if (Elem->MsgType == MT2_REASSOC_CONF) - { + if (Elem->MsgType == MT2_REASSOC_CONF) { NdisMoveMemory(&Result, Elem->Msg, sizeof(USHORT)); - if (Result == MLME_SUCCESS) - { + if (Result == MLME_SUCCESS) { // send wireless event - for association if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_ASSOC_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - + RTMPSendWirelessEvent(pAd, IW_ASSOC_EVENT_FLAG, + pAd->MacTab. + Content[BSSID_WCID].Addr, + BSS0, 0); // // NDIS requires a new Link UP indication but no Link Down for RE-ASSOC @@ -1029,23 +1105,23 @@ VOID CntlWaitReassocProc( LinkUp(pAd, BSS_INFRA); pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Re-assocition successful on BSS #%ld\n", pAd->MlmeAux.RoamIdx)); - } - else - { + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - Re-assocition successful on BSS #%ld\n", + pAd->MlmeAux.RoamIdx)); + } else { // reassoc failed, try to pick next BSS in the BSS Table - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Re-assocition fails on BSS #%ld\n", pAd->MlmeAux.RoamIdx)); + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - Re-assocition fails on BSS #%ld\n", + pAd->MlmeAux.RoamIdx)); { - pAd->MlmeAux.RoamIdx++; - IterateOnBssTab2(pAd); + pAd->MlmeAux.RoamIdx++; + IterateOnBssTab2(pAd); + } } } - } } - -VOID AdhocTurnOnQos( - IN PRTMP_ADAPTER pAd) +VOID AdhocTurnOnQos(IN PRTMP_ADAPTER pAd) { #define AC0_DEF_TXOP 0 #define AC1_DEF_TXOP 0 @@ -1053,8 +1129,7 @@ VOID AdhocTurnOnQos( #define AC3_DEF_TXOP 47 // Turn on QOs if use HT rate. - if (pAd->CommonCfg.APEdcaParm.bValid == FALSE) - { + if (pAd->CommonCfg.APEdcaParm.bValid == FALSE) { pAd->CommonCfg.APEdcaParm.bValid = TRUE; pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3; pAd->CommonCfg.APEdcaParm.Aifsn[1] = 7; @@ -1071,10 +1146,10 @@ VOID AdhocTurnOnQos( pAd->CommonCfg.APEdcaParm.Cwmax[2] = 4; pAd->CommonCfg.APEdcaParm.Cwmax[3] = 3; - pAd->CommonCfg.APEdcaParm.Txop[0] = 0; - pAd->CommonCfg.APEdcaParm.Txop[1] = 0; - pAd->CommonCfg.APEdcaParm.Txop[2] = AC2_DEF_TXOP; - pAd->CommonCfg.APEdcaParm.Txop[3] = AC3_DEF_TXOP; + pAd->CommonCfg.APEdcaParm.Txop[0] = 0; + pAd->CommonCfg.APEdcaParm.Txop[1] = 0; + pAd->CommonCfg.APEdcaParm.Txop[2] = AC2_DEF_TXOP; + pAd->CommonCfg.APEdcaParm.Txop[3] = AC3_DEF_TXOP; } AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm); } @@ -1087,27 +1162,23 @@ VOID AdhocTurnOnQos( ========================================================================== */ -VOID LinkUp( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssType) +VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) { - ULONG Now; - UINT32 Data; - BOOLEAN Cancelled; - UCHAR Value = 0, idx = 0, HashIdx = 0; + ULONG Now; + UINT32 Data; + BOOLEAN Cancelled; + UCHAR Value = 0, idx = 0, HashIdx = 0; MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry = NULL; // Init ChannelQuality to prevent DEAD_CQI at initial LinkUp pAd->Mlme.ChannelQuality = 50; pEntry = MacTableLookup(pAd, pAd->CommonCfg.Bssid); - if (pEntry) - { + if (pEntry) { MacTableDeleteEntry(pAd, pEntry->Aid, pEntry->Addr); pEntry = NULL; } - pEntry = &pAd->MacTab.Content[BSSID_WCID]; // @@ -1119,7 +1190,7 @@ VOID LinkUp( // To prevent DisassocTimeoutAction to call Link down after we link up, // cancel the DisassocTimer no matter what it start or not. // - RTMPCancelTimer(&pAd->MlmeAux.DisassocTimer, &Cancelled); + RTMPCancelTimer(&pAd->MlmeAux.DisassocTimer, &Cancelled); COPY_SETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(pAd); @@ -1129,39 +1200,30 @@ VOID LinkUp( // Before power save before link up function, We will force use 1R. // So after link up, check Rx antenna # again. RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); - if(pAd->Antenna.field.RxPath == 3) - { + if (pAd->Antenna.field.RxPath == 3) { Value |= (0x10); - } - else if(pAd->Antenna.field.RxPath == 2) - { + } else if (pAd->Antenna.field.RxPath == 2) { Value |= (0x8); - } - else if(pAd->Antenna.field.RxPath == 1) - { + } else if (pAd->Antenna.field.RxPath == 1) { Value |= (0x0); } RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); pAd->StaCfg.BBPR3 = Value; #endif // RTMP_MAC_PCI // - if (BssType == BSS_ADHOC) - { + if (BssType == BSS_ADHOC) { OPSTATUS_SET_FLAG(pAd, fOP_STATUS_ADHOC_ON); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_INFRA_ON); - if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) AdhocTurnOnQos(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("!!!Adhoc LINK UP !!! \n" )); - } - else - { + DBGPRINT(RT_DEBUG_TRACE, ("!!!Adhoc LINK UP !!! \n")); + } else { OPSTATUS_SET_FLAG(pAd, fOP_STATUS_INFRA_ON); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_ADHOC_ON); - DBGPRINT(RT_DEBUG_TRACE, ("!!!Infra LINK UP !!! \n" )); + DBGPRINT(RT_DEBUG_TRACE, ("!!!Infra LINK UP !!! \n")); } // 3*3 @@ -1172,8 +1234,8 @@ VOID LinkUp( RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value); // Change to AP channel - if ((pAd->CommonCfg.CentralChannel > pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { + if ((pAd->CommonCfg.CentralChannel > pAd->CommonCfg.Channel) + && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) { // Must using 40MHz. pAd->CommonCfg.BBPCurrentBW = BW_40; AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); @@ -1189,29 +1251,30 @@ VOID LinkUp( Value &= (~0x20); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); #ifdef RTMP_MAC_PCI - pAd->StaCfg.BBPR3 = Value; + pAd->StaCfg.BBPR3 = Value; #endif // RTMP_MAC_PCI // RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data); Data &= 0xfffffffe; RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Data); - if (pAd->MACVersion == 0x28600100) - { + if (pAd->MACVersion == 0x28600100) { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x1A); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x0A); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x16); - DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" )); + DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n")); } - DBGPRINT(RT_DEBUG_TRACE, ("!!!40MHz Lower LINK UP !!! Control Channel at Below. Central = %d \n", pAd->CommonCfg.CentralChannel )); - } - else if ((pAd->CommonCfg.CentralChannel < pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - // Must using 40MHz. + DBGPRINT(RT_DEBUG_TRACE, + ("!!!40MHz Lower LINK UP !!! Control Channel at Below. Central = %d \n", + pAd->CommonCfg.CentralChannel)); + } else if ((pAd->CommonCfg.CentralChannel < pAd->CommonCfg.Channel) + && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == + BW_40)) { + // Must using 40MHz. pAd->CommonCfg.BBPCurrentBW = BW_40; AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); + AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value); Value &= (~0x18); @@ -1223,25 +1286,24 @@ VOID LinkUp( RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Data); RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); - Value |= (0x20); + Value |= (0x20); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); #ifdef RTMP_MAC_PCI - pAd->StaCfg.BBPR3 = Value; + pAd->StaCfg.BBPR3 = Value; #endif // RTMP_MAC_PCI // - if (pAd->MACVersion == 0x28600100) - { + if (pAd->MACVersion == 0x28600100) { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x1A); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x0A); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x16); - DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" )); + DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n")); } - DBGPRINT(RT_DEBUG_TRACE, ("!!! 40MHz Upper LINK UP !!! Control Channel at UpperCentral = %d \n", pAd->CommonCfg.CentralChannel )); - } - else - { - pAd->CommonCfg.BBPCurrentBW = BW_20; + DBGPRINT(RT_DEBUG_TRACE, + ("!!! 40MHz Upper LINK UP !!! Control Channel at UpperCentral = %d \n", + pAd->CommonCfg.CentralChannel)); + } else { + pAd->CommonCfg.BBPCurrentBW = BW_20; pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.Channel); @@ -1258,80 +1320,82 @@ VOID LinkUp( Value &= (~0x20); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); #ifdef RTMP_MAC_PCI - pAd->StaCfg.BBPR3 = Value; + pAd->StaCfg.BBPR3 = Value; #endif // RTMP_MAC_PCI // - if (pAd->MACVersion == 0x28600100) - { + if (pAd->MACVersion == 0x28600100) { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x16); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x08); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x11); - DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n" )); + DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n")); } - DBGPRINT(RT_DEBUG_TRACE, ("!!! 20MHz LINK UP !!! \n" )); - } + DBGPRINT(RT_DEBUG_TRACE, ("!!! 20MHz LINK UP !!! \n")); + } RTMPSetAGCInitValue(pAd, pAd->CommonCfg.BBPCurrentBW); // // Save BBP_R66 value, it will be used in RTUSBResumeMsduTransmission // - RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R66, &pAd->BbpTuning.R66CurrentValue); + RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R66, + &pAd->BbpTuning.R66CurrentValue); - DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK UP !!! (BssType=%d, AID=%d, ssid=%s, Channel=%d, CentralChannel = %d)\n", - BssType, pAd->StaActive.Aid, pAd->CommonCfg.Ssid, pAd->CommonCfg.Channel, pAd->CommonCfg.CentralChannel)); + DBGPRINT(RT_DEBUG_TRACE, + ("!!! LINK UP !!! (BssType=%d, AID=%d, ssid=%s, Channel=%d, CentralChannel = %d)\n", + BssType, pAd->StaActive.Aid, pAd->CommonCfg.Ssid, + pAd->CommonCfg.Channel, pAd->CommonCfg.CentralChannel)); - DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK UP !!! (Density =%d, )\n", pAd->MacTab.Content[BSSID_WCID].MpduDensity)); + DBGPRINT(RT_DEBUG_TRACE, + ("!!! LINK UP !!! (Density =%d, )\n", + pAd->MacTab.Content[BSSID_WCID].MpduDensity)); - AsicSetBssid(pAd, pAd->CommonCfg.Bssid); + AsicSetBssid(pAd, pAd->CommonCfg.Bssid); AsicSetSlotTime(pAd, TRUE); AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm); // Call this for RTS protectionfor legacy rate, we will always enable RTS threshold, but normally it will not hit - AsicUpdateProtect(pAd, 0, (OFDMSETPROTECT | CCKSETPROTECT), TRUE, FALSE); + AsicUpdateProtect(pAd, 0, (OFDMSETPROTECT | CCKSETPROTECT), TRUE, + FALSE); - if ((pAd->StaActive.SupportedPhyInfo.bHtEnable == TRUE)) - { + if ((pAd->StaActive.SupportedPhyInfo.bHtEnable == TRUE)) { // Update HT protectionfor based on AP's operating mode. - if (pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent == 1) - { - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, FALSE, TRUE); - } - else - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, FALSE, FALSE); + if (pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent == 1) { + AsicUpdateProtect(pAd, + pAd->MlmeAux.AddHtInfo.AddHtInfo2. + OperaionMode, ALLN_SETPROTECT, FALSE, + TRUE); + } else + AsicUpdateProtect(pAd, + pAd->MlmeAux.AddHtInfo.AddHtInfo2. + OperaionMode, ALLN_SETPROTECT, FALSE, + FALSE); } NdisZeroMemory(&pAd->DrsCounters, sizeof(COUNTER_DRS)); NdisGetSystemUpTime(&Now); - pAd->StaCfg.LastBeaconRxTime = Now; // last RX timestamp + pAd->StaCfg.LastBeaconRxTime = Now; // last RX timestamp if ((pAd->CommonCfg.TxPreamble != Rt802_11PreambleLong) && - CAP_IS_SHORT_PREAMBLE_ON(pAd->StaActive.CapabilityInfo)) - { + CAP_IS_SHORT_PREAMBLE_ON(pAd->StaActive.CapabilityInfo)) { MlmeSetTxPreamble(pAd, Rt802_11PreambleShort); } OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); - if (pAd->CommonCfg.RadarDetect.RDMode == RD_SILENCE_MODE) - { + if (pAd->CommonCfg.RadarDetect.RDMode == RD_SILENCE_MODE) { } pAd->CommonCfg.RadarDetect.RDMode = RD_NORMAL_MODE; - if (BssType == BSS_ADHOC) - { + if (BssType == BSS_ADHOC) { MakeIbssBeacon(pAd); if ((pAd->CommonCfg.Channel > 14) - && (pAd->CommonCfg.bIEEE80211H == 1) - && RadarChannelCheck(pAd, pAd->CommonCfg.Channel)) - { - ; //Do nothing - } - else - { + && (pAd->CommonCfg.bIEEE80211H == 1) + && RadarChannelCheck(pAd, pAd->CommonCfg.Channel)) { + ; //Do nothing + } else { AsicEnableIbssSync(pAd); } @@ -1343,82 +1407,92 @@ VOID LinkUp( // If WEP is enabled, add key material and cipherAlg into Asic // Fill in Shared Key Table(offset: 0x6c00) and Shared Key Mode(offset: 0x7000) - if (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled) - { - PUCHAR Key; - UCHAR CipherAlg; + if (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled) { + PUCHAR Key; + UCHAR CipherAlg; - for (idx=0; idx < SHARE_KEY_NUM; idx++) - { + for (idx = 0; idx < SHARE_KEY_NUM; idx++) { CipherAlg = pAd->SharedKey[BSS0][idx].CipherAlg; - Key = pAd->SharedKey[BSS0][idx].Key; + Key = pAd->SharedKey[BSS0][idx].Key; - if (pAd->SharedKey[BSS0][idx].KeyLen > 0) - { + if (pAd->SharedKey[BSS0][idx].KeyLen > 0) { // Set key material and cipherAlg to Asic - AsicAddSharedKeyEntry(pAd, BSS0, idx, CipherAlg, Key, NULL, NULL); + AsicAddSharedKeyEntry(pAd, BSS0, idx, + CipherAlg, Key, + NULL, NULL); - if (idx == pAd->StaCfg.DefaultKeyId) - { + if (idx == pAd->StaCfg.DefaultKeyId) { // Update WCID attribute table and IVEIV table for this group key table - RTMPAddWcidAttributeEntry(pAd, BSS0, idx, CipherAlg, NULL); + RTMPAddWcidAttributeEntry(pAd, + BSS0, + idx, + CipherAlg, + NULL); } } - } } // If WPANone is enabled, add key material and cipherAlg into Asic // Fill in Shared Key Table(offset: 0x6c00) and Shared Key Mode(offset: 0x7000) - else if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) - { + else if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) { pAd->StaCfg.DefaultKeyId = 0; // always be zero - NdisZeroMemory(&pAd->SharedKey[BSS0][0], sizeof(CIPHER_KEY)); - pAd->SharedKey[BSS0][0].KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pAd->SharedKey[BSS0][0].Key, pAd->StaCfg.PMK, LEN_TKIP_EK); - - if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) - { - NdisMoveMemory(pAd->SharedKey[BSS0][0].RxMic, &pAd->StaCfg.PMK[16], LEN_TKIP_RXMICK); - NdisMoveMemory(pAd->SharedKey[BSS0][0].TxMic, &pAd->StaCfg.PMK[16], LEN_TKIP_TXMICK); - } - + NdisZeroMemory(&pAd->SharedKey[BSS0][0], + sizeof(CIPHER_KEY)); + pAd->SharedKey[BSS0][0].KeyLen = LEN_TKIP_EK; + NdisMoveMemory(pAd->SharedKey[BSS0][0].Key, + pAd->StaCfg.PMK, LEN_TKIP_EK); + + if (pAd->StaCfg.PairCipher == + Ndis802_11Encryption2Enabled) { + NdisMoveMemory(pAd->SharedKey[BSS0][0].RxMic, + &pAd->StaCfg.PMK[16], + LEN_TKIP_RXMICK); + NdisMoveMemory(pAd->SharedKey[BSS0][0].TxMic, + &pAd->StaCfg.PMK[16], + LEN_TKIP_TXMICK); + } // Decide its ChiperAlg - if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) + if (pAd->StaCfg.PairCipher == + Ndis802_11Encryption2Enabled) pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_TKIP; - else if (pAd->StaCfg.PairCipher == Ndis802_11Encryption3Enabled) + else if (pAd->StaCfg.PairCipher == + Ndis802_11Encryption3Enabled) pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_AES; - else - { - DBGPRINT(RT_DEBUG_TRACE, ("Unknow Cipher (=%d), set Cipher to AES\n", pAd->StaCfg.PairCipher)); + else { + DBGPRINT(RT_DEBUG_TRACE, + ("Unknow Cipher (=%d), set Cipher to AES\n", + pAd->StaCfg.PairCipher)); pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_AES; - } + } // Set key material and cipherAlg to Asic AsicAddSharedKeyEntry(pAd, - BSS0, - 0, - pAd->SharedKey[BSS0][0].CipherAlg, - pAd->SharedKey[BSS0][0].Key, - pAd->SharedKey[BSS0][0].TxMic, - pAd->SharedKey[BSS0][0].RxMic); - - // Update WCID attribute table and IVEIV table for this group key table - RTMPAddWcidAttributeEntry(pAd, BSS0, 0, pAd->SharedKey[BSS0][0].CipherAlg, NULL); + BSS0, + 0, + pAd->SharedKey[BSS0][0].CipherAlg, + pAd->SharedKey[BSS0][0].Key, + pAd->SharedKey[BSS0][0].TxMic, + pAd->SharedKey[BSS0][0].RxMic); + + // Update WCID attribute table and IVEIV table for this group key table + RTMPAddWcidAttributeEntry(pAd, BSS0, 0, + pAd->SharedKey[BSS0][0]. + CipherAlg, NULL); } - } - else // BSS_INFRA + } else // BSS_INFRA { // Check the new SSID with last SSID - while (Cancelled == TRUE) - { - if (pAd->CommonCfg.LastSsidLen == pAd->CommonCfg.SsidLen) - { - if (RTMPCompareMemory(pAd->CommonCfg.LastSsid, pAd->CommonCfg.Ssid, pAd->CommonCfg.LastSsidLen) == 0) - { + while (Cancelled == TRUE) { + if (pAd->CommonCfg.LastSsidLen == + pAd->CommonCfg.SsidLen) { + if (RTMPCompareMemory + (pAd->CommonCfg.LastSsid, + pAd->CommonCfg.Ssid, + pAd->CommonCfg.LastSsidLen) == 0) { // Link to the old one no linkdown is required. break; } @@ -1426,8 +1500,9 @@ VOID LinkUp( // Send link down event before set to link up pAd->IndicateMediaState = NdisMediaStateDisconnected; RTMP_IndicateMediaState(pAd); - pAd->ExtraInfo = GENERAL_LINK_DOWN; - DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_DISCONNECT Event AA!\n")); + pAd->ExtraInfo = GENERAL_LINK_DOWN; + DBGPRINT(RT_DEBUG_TRACE, + ("NDIS_STATUS_MEDIA_DISCONNECT Event AA!\n")); break; } @@ -1435,15 +1510,15 @@ VOID LinkUp( // On WPA mode, Remove All Keys if not connect to the last BSSID // Key will be set after 4-way handshake. // - if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) - { - ULONG IV; + if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) { + ULONG IV; // Remove all WPA keys RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); RTMPWPARemoveAllKeys(pAd); pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; - pAd->StaCfg.PrivacyFilter = Ndis802_11PrivFilter8021xWEP; + pAd->StaCfg.PrivacyFilter = + Ndis802_11PrivFilter8021xWEP; // Fixed connection failed with Range Maximizer - 515 AP (Marvell Chip) when security is WPAPSK/TKIP // If IV related values are too large in GroupMsg2, AP would ignore this message. @@ -1451,7 +1526,6 @@ VOID LinkUp( IV |= (pAd->StaCfg.DefaultKeyId << 30); AsicUpdateWCIDIVEIV(pAd, BSSID_WCID, IV, 0); } - // NOTE: // the decision of using "short slot time" or not may change dynamically due to // new STA association to the AP. so we have to decide that upon parsing BEACON, not here @@ -1463,84 +1537,85 @@ VOID LinkUp( ComposePsPoll(pAd); ComposeNullFrame(pAd); - AsicEnableBssSync(pAd); + AsicEnableBssSync(pAd); // Add BSSID to WCID search table AsicUpdateRxWCIDTable(pAd, BSSID_WCID, pAd->CommonCfg.Bssid); // If WEP is enabled, add paiewise and shared key - if (((pAd->StaCfg.WpaSupplicantUP)&& - (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled)&& - (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED)) || - ((pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_DISABLE)&& - (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled))) - { - PUCHAR Key; - UCHAR CipherAlg; - - for (idx=0; idx < SHARE_KEY_NUM; idx++) - { + if (((pAd->StaCfg.WpaSupplicantUP) && + (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled) && + (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED)) || + ((pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_DISABLE) && + (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled))) { + PUCHAR Key; + UCHAR CipherAlg; + + for (idx = 0; idx < SHARE_KEY_NUM; idx++) { CipherAlg = pAd->SharedKey[BSS0][idx].CipherAlg; - Key = pAd->SharedKey[BSS0][idx].Key; + Key = pAd->SharedKey[BSS0][idx].Key; - if (pAd->SharedKey[BSS0][idx].KeyLen > 0) - { + if (pAd->SharedKey[BSS0][idx].KeyLen > 0) { // Set key material and cipherAlg to Asic - AsicAddSharedKeyEntry(pAd, BSS0, idx, CipherAlg, Key, NULL, NULL); + AsicAddSharedKeyEntry(pAd, BSS0, idx, + CipherAlg, Key, + NULL, NULL); - if (idx == pAd->StaCfg.DefaultKeyId) - { + if (idx == pAd->StaCfg.DefaultKeyId) { // Assign group key info - RTMPAddWcidAttributeEntry(pAd, BSS0, idx, CipherAlg, NULL); + RTMPAddWcidAttributeEntry(pAd, + BSS0, + idx, + CipherAlg, + NULL); pEntry->Aid = BSSID_WCID; // Assign pairwise key info - RTMPAddWcidAttributeEntry(pAd, BSS0, idx, CipherAlg, pEntry); + RTMPAddWcidAttributeEntry(pAd, + BSS0, + idx, + CipherAlg, + pEntry); } } } } - // only INFRASTRUCTURE mode need to indicate connectivity immediately; ADHOC mode // should wait until at least 2 active nodes in this BSSID. OPSTATUS_SET_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); - // For GUI ++ - if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA) - { + // For GUI ++ + if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA) { pAd->IndicateMediaState = NdisMediaStateConnected; pAd->ExtraInfo = GENERAL_LINK_UP; RTMP_IndicateMediaState(pAd); - } - else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) + } else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || + (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) { - if (pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_DISABLE) - RTMPSetTimer(&pAd->Mlme.LinkDownTimer, LINK_DOWN_TIMEOUT); + if (pAd->StaCfg.WpaSupplicantUP == + WPA_SUPPLICANT_DISABLE) + RTMPSetTimer(&pAd->Mlme.LinkDownTimer, + LINK_DOWN_TIMEOUT); } - // -- + // -- // Add BSSID in my MAC Table. - NdisAcquireSpinLock(&pAd->MacTabLock); + NdisAcquireSpinLock(&pAd->MacTabLock); // add this MAC entry into HASH table - if (pEntry) - { + if (pEntry) { HashIdx = MAC_ADDR_HASH_INDEX(pAd->CommonCfg.Bssid); - if (pAd->MacTab.Hash[HashIdx] == NULL) - { + if (pAd->MacTab.Hash[HashIdx] == NULL) { pAd->MacTab.Hash[HashIdx] = pEntry; - } - else - { + } else { pCurrEntry = pAd->MacTab.Hash[HashIdx]; - while (pCurrEntry->pNext != NULL) - { + while (pCurrEntry->pNext != NULL) { pCurrEntry = pCurrEntry->pNext; } pCurrEntry->pNext = pEntry; } } - RTMPMoveMemory(pEntry->Addr, pAd->CommonCfg.Bssid, MAC_ADDR_LEN); + RTMPMoveMemory(pEntry->Addr, pAd->CommonCfg.Bssid, + MAC_ADDR_LEN); pEntry->Aid = BSSID_WCID; pEntry->pAd = pAd; pEntry->ValidAsCLI = TRUE; //Although this is bssid..still set ValidAsCl @@ -1549,130 +1624,132 @@ VOID LinkUp( pEntry->AuthState = SST_ASSOC; pEntry->AuthMode = pAd->StaCfg.AuthMode; pEntry->WepStatus = pAd->StaCfg.WepStatus; - if (pEntry->AuthMode < Ndis802_11AuthModeWPA) - { + if (pEntry->AuthMode < Ndis802_11AuthModeWPA) { pEntry->WpaState = AS_NOTUSE; pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; - } - else - { + } else { pEntry->WpaState = AS_PTKSTART; pEntry->PrivacyFilter = Ndis802_11PrivFilter8021xWEP; } - NdisReleaseSpinLock(&pAd->MacTabLock); + NdisReleaseSpinLock(&pAd->MacTabLock); - DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK UP !!! ClientStatusFlags=%lx)\n", - pAd->MacTab.Content[BSSID_WCID].ClientStatusFlags)); + DBGPRINT(RT_DEBUG_TRACE, + ("!!! LINK UP !!! ClientStatusFlags=%lx)\n", + pAd->MacTab.Content[BSSID_WCID].ClientStatusFlags)); MlmeUpdateTxRates(pAd, TRUE, BSS0); MlmeUpdateHtTxRates(pAd, BSS0); - DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK UP !! (StaActive.bHtEnable =%d, )\n", pAd->StaActive.SupportedPhyInfo.bHtEnable)); - - if (pAd->CommonCfg.bAggregationCapable) - { - if ((pAd->CommonCfg.bPiggyBackCapable) && (pAd->MlmeAux.APRalinkIe & 0x00000003) == 3) - { - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_PIGGYBACK_INUSED); - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_AGGREGATION_CAPABLE); - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_PIGGYBACK_CAPABLE); - RTMPSetPiggyBack(pAd, TRUE); - DBGPRINT(RT_DEBUG_TRACE, ("Turn on Piggy-Back\n")); - } - else if (pAd->MlmeAux.APRalinkIe & 0x00000001) - { - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_AGGREGATION_CAPABLE); - DBGPRINT(RT_DEBUG_TRACE, ("Ralink Aggregation\n")); + DBGPRINT(RT_DEBUG_TRACE, + ("!!! LINK UP !! (StaActive.bHtEnable =%d, )\n", + pAd->StaActive.SupportedPhyInfo.bHtEnable)); + + if (pAd->CommonCfg.bAggregationCapable) { + if ((pAd->CommonCfg.bPiggyBackCapable) + && (pAd->MlmeAux.APRalinkIe & 0x00000003) == 3) { + OPSTATUS_SET_FLAG(pAd, + fOP_STATUS_PIGGYBACK_INUSED); + OPSTATUS_SET_FLAG(pAd, + fOP_STATUS_AGGREGATION_INUSED); + CLIENT_STATUS_SET_FLAG(pEntry, + fCLIENT_STATUS_AGGREGATION_CAPABLE); + CLIENT_STATUS_SET_FLAG(pEntry, + fCLIENT_STATUS_PIGGYBACK_CAPABLE); + RTMPSetPiggyBack(pAd, TRUE); + DBGPRINT(RT_DEBUG_TRACE, + ("Turn on Piggy-Back\n")); + } else if (pAd->MlmeAux.APRalinkIe & 0x00000001) { + OPSTATUS_SET_FLAG(pAd, + fOP_STATUS_AGGREGATION_INUSED); + CLIENT_STATUS_SET_FLAG(pEntry, + fCLIENT_STATUS_AGGREGATION_CAPABLE); + DBGPRINT(RT_DEBUG_TRACE, + ("Ralink Aggregation\n")); } } - if (pAd->MlmeAux.APRalinkIe != 0x0) - { - if (CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_RDG_CAPABLE)) - { + if (pAd->MlmeAux.APRalinkIe != 0x0) { + if (CLIENT_STATUS_TEST_FLAG + (pEntry, fCLIENT_STATUS_RDG_CAPABLE)) { AsicEnableRDG(pAd); } OPSTATUS_SET_FLAG(pAd, fCLIENT_STATUS_RALINK_CHIPSET); - CLIENT_STATUS_SET_FLAG(pEntry, fCLIENT_STATUS_RALINK_CHIPSET); - } - else - { + CLIENT_STATUS_SET_FLAG(pEntry, + fCLIENT_STATUS_RALINK_CHIPSET); + } else { OPSTATUS_CLEAR_FLAG(pAd, fCLIENT_STATUS_RALINK_CHIPSET); - CLIENT_STATUS_CLEAR_FLAG(pEntry, fCLIENT_STATUS_RALINK_CHIPSET); + CLIENT_STATUS_CLEAR_FLAG(pEntry, + fCLIENT_STATUS_RALINK_CHIPSET); } } - DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_CONNECT Event B!.BACapability = %x. ClientStatusFlags = %lx\n", pAd->CommonCfg.BACapability.word, pAd->MacTab.Content[BSSID_WCID].ClientStatusFlags)); + DBGPRINT(RT_DEBUG_TRACE, + ("NDIS_STATUS_MEDIA_CONNECT Event B!.BACapability = %x. ClientStatusFlags = %lx\n", + pAd->CommonCfg.BACapability.word, + pAd->MacTab.Content[BSSID_WCID].ClientStatusFlags)); // Set LED RTMPSetLED(pAd, LED_LINK_UP); pAd->Mlme.PeriodicRound = 0; pAd->Mlme.OneSecPeriodicRound = 0; - pAd->bConfigChanged = FALSE; // Reset config flag - pAd->ExtraInfo = GENERAL_LINK_UP; // Update extra information to link is up + pAd->bConfigChanged = FALSE; // Reset config flag + pAd->ExtraInfo = GENERAL_LINK_UP; // Update extra information to link is up // Set asic auto fall back { - PUCHAR pTable; - UCHAR TableSize = 0; + PUCHAR pTable; + UCHAR TableSize = 0; - MlmeSelectTxRateTable(pAd, &pAd->MacTab.Content[BSSID_WCID], &pTable, &TableSize, &pAd->CommonCfg.TxRateIndex); + MlmeSelectTxRateTable(pAd, &pAd->MacTab.Content[BSSID_WCID], + &pTable, &TableSize, + &pAd->CommonCfg.TxRateIndex); AsicUpdateAutoFallBackTable(pAd, pTable); } NdisAcquireSpinLock(&pAd->MacTabLock); - pEntry->HTPhyMode.word = pAd->StaCfg.HTPhyMode.word; - pEntry->MaxHTPhyMode.word = pAd->StaCfg.HTPhyMode.word; - if (pAd->StaCfg.bAutoTxRateSwitch == FALSE) - { + pEntry->HTPhyMode.word = pAd->StaCfg.HTPhyMode.word; + pEntry->MaxHTPhyMode.word = pAd->StaCfg.HTPhyMode.word; + if (pAd->StaCfg.bAutoTxRateSwitch == FALSE) { pEntry->bAutoTxRateSwitch = FALSE; if (pEntry->HTPhyMode.field.MCS == 32) pEntry->HTPhyMode.field.ShortGI = GI_800; - if ((pEntry->HTPhyMode.field.MCS > MCS_7) || (pEntry->HTPhyMode.field.MCS == 32)) + if ((pEntry->HTPhyMode.field.MCS > MCS_7) + || (pEntry->HTPhyMode.field.MCS == 32)) pEntry->HTPhyMode.field.STBC = STBC_NONE; // If the legacy mode is set, overwrite the transmit setting of this entry. if (pEntry->HTPhyMode.field.MODE <= MODE_OFDM) - RTMPUpdateLegacyTxSetting((UCHAR)pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode, pEntry); - } - else + RTMPUpdateLegacyTxSetting((UCHAR) pAd->StaCfg. + DesiredTransmitSetting.field. + FixedTxMode, pEntry); + } else pEntry->bAutoTxRateSwitch = TRUE; NdisReleaseSpinLock(&pAd->MacTabLock); // Let Link Status Page display first initial rate. - pAd->LastTxRate = (USHORT)(pEntry->HTPhyMode.word); + pAd->LastTxRate = (USHORT) (pEntry->HTPhyMode.word); // Select DAC according to HT or Legacy - if (pAd->StaActive.SupportedPhyInfo.MCSSet[0] != 0x00) - { + if (pAd->StaActive.SupportedPhyInfo.MCSSet[0] != 0x00) { RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &Value); Value &= (~0x18); - if (pAd->Antenna.field.TxPath == 2) - { - Value |= 0x10; + if (pAd->Antenna.field.TxPath == 2) { + Value |= 0x10; } RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R1, Value); - } - else - { + } else { RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &Value); Value &= (~0x18); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R1, Value); } - if (pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) - { - } - else if (pEntry->MaxRAmpduFactor == 0) - { - // If HT AP doesn't support MaxRAmpduFactor = 1, we need to set max PSDU to 0. - // Because our Init value is 1 at MACRegTable. + if (pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) { + } else if (pEntry->MaxRAmpduFactor == 0) { + // If HT AP doesn't support MaxRAmpduFactor = 1, we need to set max PSDU to 0. + // Because our Init value is 1 at MACRegTable. RTMP_IO_WRITE32(pAd, MAX_LEN_CFG, 0x0fff); } - // Patch for Marvel AP to gain high throughput // Need to set as following, // 1. Set txop in register-EDCA_AC0_CFG as 0x60 @@ -1683,34 +1760,31 @@ VOID LinkUp( // Txop can only be modified when RDG is off, WMM is disable and TxBurst is enable // // if 1. Legacy AP WMM on, or 2. 11n AP, AMPDU disable. Force turn off burst no matter what bEnableTxBurst is. - if (!((pAd->CommonCfg.RxStream == 1)&&(pAd->CommonCfg.TxStream == 1)) && - (pAd->StaCfg.bForceTxBurst == FALSE) && - (((pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED)) - || ((pAd->StaActive.SupportedPhyInfo.bHtEnable == TRUE) && (pAd->CommonCfg.BACapability.field.Policy == BA_NOTUSE)))) - { + if (!((pAd->CommonCfg.RxStream == 1) && (pAd->CommonCfg.TxStream == 1)) + && (pAd->StaCfg.bForceTxBurst == FALSE) + && + (((pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) + && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED)) + || ((pAd->StaActive.SupportedPhyInfo.bHtEnable == TRUE) + && (pAd->CommonCfg.BACapability.field.Policy == BA_NOTUSE)))) { RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &Data); - Data &= 0xFFFFFF00; + Data &= 0xFFFFFF00; RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Data); RTMP_IO_WRITE32(pAd, PBF_MAX_PCNT, 0x1F3F7F9F); DBGPRINT(RT_DEBUG_TRACE, ("Txburst 1\n")); - } - else - if (pAd->CommonCfg.bEnableTxBurst) - { + } else if (pAd->CommonCfg.bEnableTxBurst) { RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &Data); - Data &= 0xFFFFFF00; - Data |= 0x60; + Data &= 0xFFFFFF00; + Data |= 0x60; RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Data); pAd->CommonCfg.IOTestParm.bNowAtherosBurstOn = TRUE; RTMP_IO_WRITE32(pAd, PBF_MAX_PCNT, 0x1F3FBF9F); DBGPRINT(RT_DEBUG_TRACE, ("Txburst 2\n")); - } - else - { + } else { RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &Data); - Data &= 0xFFFFFF00; + Data &= 0xFFFFFF00; RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Data); RTMP_IO_WRITE32(pAd, PBF_MAX_PCNT, 0x1F3F7F9F); @@ -1718,59 +1792,54 @@ VOID LinkUp( } // Re-check to turn on TX burst or not. - if ((pAd->CommonCfg.IOTestParm.bLastAtheros == TRUE) && ((STA_WEP_ON(pAd))||(STA_TKIP_ON(pAd)))) - { + if ((pAd->CommonCfg.IOTestParm.bLastAtheros == TRUE) + && ((STA_WEP_ON(pAd)) || (STA_TKIP_ON(pAd)))) { pAd->CommonCfg.IOTestParm.bNextDisableRxBA = TRUE; - if (pAd->CommonCfg.bEnableTxBurst) - { - UINT32 MACValue = 0; + if (pAd->CommonCfg.bEnableTxBurst) { + UINT32 MACValue = 0; // Force disable TXOP value in this case. The same action in MLMEUpdateProtect too. // I didn't change PBF_MAX_PCNT setting. RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &MACValue); - MACValue &= 0xFFFFFF00; + MACValue &= 0xFFFFFF00; RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, MACValue); pAd->CommonCfg.IOTestParm.bNowAtherosBurstOn = FALSE; } - } - else - { + } else { pAd->CommonCfg.IOTestParm.bNextDisableRxBA = FALSE; } pAd->CommonCfg.IOTestParm.bLastAtheros = FALSE; COPY_MAC_ADDR(pAd->CommonCfg.LastBssid, pAd->CommonCfg.Bssid); - DBGPRINT(RT_DEBUG_TRACE, ("!!!pAd->bNextDisableRxBA= %d \n", pAd->CommonCfg.IOTestParm.bNextDisableRxBA)); + DBGPRINT(RT_DEBUG_TRACE, + ("!!!pAd->bNextDisableRxBA= %d \n", + pAd->CommonCfg.IOTestParm.bNextDisableRxBA)); // BSSID add in one MAC entry too. Because in Tx, ASIC need to check Cipher and IV/EIV, BAbitmap // Pther information in MACTab.Content[BSSID_WCID] is not necessary for driver. // Note: As STA, The MACTab.Content[BSSID_WCID]. PairwiseKey and Shared Key for BSS0 are the same. - if (pAd->StaCfg.WepStatus <= Ndis802_11WEPDisabled) - { + if (pAd->StaCfg.WepStatus <= Ndis802_11WEPDisabled) { if (pAd->StaCfg.WpaSupplicantUP && - (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled) && - (pAd->StaCfg.IEEE8021X == TRUE)) - ; - else - { - pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - pAd->StaCfg.PrivacyFilter = Ndis802_11PrivFilterAcceptAll; - } + (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled) && + (pAd->StaCfg.IEEE8021X == TRUE)) ; + else { + pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + pAd->StaCfg.PrivacyFilter = + Ndis802_11PrivFilterAcceptAll; + } } NdisAcquireSpinLock(&pAd->MacTabLock); pEntry->PortSecured = pAd->StaCfg.PortSecured; NdisReleaseSpinLock(&pAd->MacTabLock); - // + // // Patch Atheros AP TX will breakdown issue. // AP Model: DLink DWL-8200AP // - if (INFRA_ON(pAd) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && STA_TKIP_ON(pAd)) - { + if (INFRA_ON(pAd) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) + && STA_TKIP_ON(pAd)) { RTMP_IO_WRITE32(pAd, RX_PARSER_CFG, 0x01); - } - else - { + } else { RTMP_IO_WRITE32(pAd, RX_PARSER_CFG, 0x00); } @@ -1804,11 +1873,9 @@ VOID LinkUp( ========================================================================== */ -VOID LinkDown( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN IsReqFromAP) +VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) { - UCHAR i, ByteValue = 0; + UCHAR i, ByteValue = 0; // Do nothing if monitor mode is on if (MONITOR_ON(pAd)) @@ -1816,45 +1883,43 @@ VOID LinkDown( RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_GO_TO_SLEEP_NOW); //Comment the codes, beasue the line 2291 call the same function. - //RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); + //RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); // Not allow go to sleep within linkdown function. RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); - if (pAd->CommonCfg.bWirelessEvent) - { - RTMPSendWirelessEvent(pAd, IW_STA_LINKDOWN_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); + if (pAd->CommonCfg.bWirelessEvent) { + RTMPSendWirelessEvent(pAd, IW_STA_LINKDOWN_EVENT_FLAG, + pAd->MacTab.Content[BSSID_WCID].Addr, + BSS0, 0); } DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK DOWN !!!\n")); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); #ifdef RTMP_MAC_PCI - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - BOOLEAN Cancelled; - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - } + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { + BOOLEAN Cancelled; + pAd->Mlme.bPsPollTimerRunning = FALSE; + RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); + } pAd->bPCIclkOff = FALSE; #endif // RTMP_MAC_PCI // - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) -|| RTMP_TEST_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND) - || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF)) - { - AUTO_WAKEUP_STRUC AutoWakeupCfg; + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) + || RTMP_TEST_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND) + || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF)) { + AUTO_WAKEUP_STRUC AutoWakeupCfg; AsicForceWakeup(pAd, TRUE); - AutoWakeupCfg.word = 0; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); - } - + AutoWakeupCfg.word = 0; + RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); + } #ifdef RTMP_MAC_PCI pAd->bPCIclkOff = FALSE; #endif // RTMP_MAC_PCI // - if (ADHOC_ON(pAd)) // Adhoc mode link down + if (ADHOC_ON(pAd)) // Adhoc mode link down { DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK DOWN 1!!!\n")); @@ -1862,11 +1927,12 @@ VOID LinkDown( OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); pAd->IndicateMediaState = NdisMediaStateDisconnected; RTMP_IndicateMediaState(pAd); - pAd->ExtraInfo = GENERAL_LINK_DOWN; - BssTableDeleteEntry(&pAd->ScanTab, pAd->CommonCfg.Bssid, pAd->CommonCfg.Channel); - DBGPRINT(RT_DEBUG_TRACE, ("!!! MacTab.Size=%d !!!\n", pAd->MacTab.Size)); - } - else // Infra structure mode + pAd->ExtraInfo = GENERAL_LINK_DOWN; + BssTableDeleteEntry(&pAd->ScanTab, pAd->CommonCfg.Bssid, + pAd->CommonCfg.Channel); + DBGPRINT(RT_DEBUG_TRACE, + ("!!! MacTab.Size=%d !!!\n", pAd->MacTab.Size)); + } else // Infra structure mode { DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK DOWN 2!!!\n")); @@ -1875,25 +1941,25 @@ VOID LinkDown( // Saved last SSID for linkup comparison pAd->CommonCfg.LastSsidLen = pAd->CommonCfg.SsidLen; - NdisMoveMemory(pAd->CommonCfg.LastSsid, pAd->CommonCfg.Ssid, pAd->CommonCfg.LastSsidLen); + NdisMoveMemory(pAd->CommonCfg.LastSsid, pAd->CommonCfg.Ssid, + pAd->CommonCfg.LastSsidLen); COPY_MAC_ADDR(pAd->CommonCfg.LastBssid, pAd->CommonCfg.Bssid); - if (pAd->MlmeAux.CurrReqIsFromNdis == TRUE) - { + if (pAd->MlmeAux.CurrReqIsFromNdis == TRUE) { pAd->IndicateMediaState = NdisMediaStateDisconnected; RTMP_IndicateMediaState(pAd); - pAd->ExtraInfo = GENERAL_LINK_DOWN; - DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_DISCONNECT Event A!\n")); + pAd->ExtraInfo = GENERAL_LINK_DOWN; + DBGPRINT(RT_DEBUG_TRACE, + ("NDIS_STATUS_MEDIA_DISCONNECT Event A!\n")); pAd->MlmeAux.CurrReqIsFromNdis = FALSE; - } - else - { - // + } else { + // // If disassociation request is from NDIS, then we don't need to delete BSSID from entry. // Otherwise lost beacon or receive De-Authentication from AP, // then we should delete BSSID from BssTable. // If we don't delete from entry, roaming will fail. // - BssTableDeleteEntry(&pAd->ScanTab, pAd->CommonCfg.Bssid, pAd->CommonCfg.Channel); + BssTableDeleteEntry(&pAd->ScanTab, pAd->CommonCfg.Bssid, + pAd->CommonCfg.Channel); } // restore back to - @@ -1902,31 +1968,28 @@ VOID LinkDown( // 3. short preamble OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_BG_PROTECTION_INUSED); - } - - for (i=1; iMacTab.Content[i].ValidAsCLI == TRUE) - MacTableDeleteEntry(pAd, pAd->MacTab.Content[i].Aid, pAd->MacTab.Content[i].Addr); + MacTableDeleteEntry(pAd, pAd->MacTab.Content[i].Aid, + pAd->MacTab.Content[i].Addr); } - AsicSetSlotTime(pAd, TRUE); //FALSE); + AsicSetSlotTime(pAd, TRUE); //FALSE); AsicSetEdcaParm(pAd, NULL); // Set LED RTMPSetLED(pAd, LED_LINK_DOWN); - pAd->LedIndicatorStrength = 0xF0; - RTMPSetSignalLED(pAd, -100); // Force signal strength Led to be turned off, firmware is not done it. + pAd->LedIndicatorStrength = 0xF0; + RTMPSetSignalLED(pAd, -100); // Force signal strength Led to be turned off, firmware is not done it. - AsicDisableSync(pAd); + AsicDisableSync(pAd); pAd->Mlme.PeriodicRound = 0; pAd->Mlme.OneSecPeriodicRound = 0; - if (pAd->StaCfg.BssType == BSS_INFRA) - { + if (pAd->StaCfg.BssType == BSS_INFRA) { // Remove StaCfg Information after link down NdisZeroMemory(pAd->CommonCfg.Bssid, MAC_ADDR_LEN); NdisZeroMemory(pAd->CommonCfg.Ssid, MAX_LEN_OF_SSID); @@ -1939,36 +2002,29 @@ VOID LinkDown( pAd->MlmeAux.NewExtChannelOffset = 0xff; // Reset WPA-PSK state. Only reset when supplicant enabled - if (pAd->StaCfg.WpaState != SS_NOTUSE) - { + if (pAd->StaCfg.WpaState != SS_NOTUSE) { pAd->StaCfg.WpaState = SS_START; // Clear Replay counter NdisZeroMemory(pAd->StaCfg.ReplayCounter, 8); } - // // if link down come from AP, we need to remove all WPA keys on WPA mode. // otherwise will cause 4-way handshaking failed, since the WPA key not empty. // - if ((IsReqFromAP) && (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA)) - { + if ((IsReqFromAP) && (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA)) { // Remove all WPA keys RTMPWPARemoveAllKeys(pAd); } - // 802.1x port control // Prevent clear PortSecured here with static WEP // NetworkManger set security policy first then set SSID to connect AP. if (pAd->StaCfg.WpaSupplicantUP && - (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled) && - (pAd->StaCfg.IEEE8021X == FALSE)) - { + (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled) && + (pAd->StaCfg.IEEE8021X == FALSE)) { pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; - } - else - { + } else { pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; pAd->StaCfg.PrivacyFilter = Ndis802_11PrivFilter8021xWEP; } @@ -1980,19 +2036,21 @@ VOID LinkDown( pAd->StaCfg.MicErrCnt = 0; - pAd->IndicateMediaState = NdisMediaStateDisconnected; + pAd->IndicateMediaState = NdisMediaStateDisconnected; // Update extra information to link is up pAd->ExtraInfo = GENERAL_LINK_DOWN; - pAd->StaActive.SupportedPhyInfo.bHtEnable = FALSE; + pAd->StaActive.SupportedPhyInfo.bHtEnable = FALSE; #ifdef RTMP_MAC_USB pAd->bUsbTxBulkAggre = FALSE; #endif // RTMP_MAC_USB // // Clean association information - NdisZeroMemory(&pAd->StaCfg.AssocInfo, sizeof(NDIS_802_11_ASSOCIATION_INFORMATION)); - pAd->StaCfg.AssocInfo.Length = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); + NdisZeroMemory(&pAd->StaCfg.AssocInfo, + sizeof(NDIS_802_11_ASSOCIATION_INFORMATION)); + pAd->StaCfg.AssocInfo.Length = + sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); pAd->StaCfg.ReqVarIELen = 0; pAd->StaCfg.ResVarIELen = 0; @@ -2013,30 +2071,29 @@ VOID LinkDown( // // After Link down, reset piggy-back setting in ASIC. Disable RDG. // - if (pAd->CommonCfg.BBPCurrentBW == BW_40) - { + if (pAd->CommonCfg.BBPCurrentBW == BW_40) { pAd->CommonCfg.BBPCurrentBW = BW_20; RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &ByteValue); ByteValue &= (~0x18); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, ByteValue); } - // Reset DAC RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &ByteValue); ByteValue &= (~0x18); - if (pAd->Antenna.field.TxPath == 2) - { + if (pAd->Antenna.field.TxPath == 2) { ByteValue |= 0x10; } RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R1, ByteValue); - RTMPSetPiggyBack(pAd,FALSE); + RTMPSetPiggyBack(pAd, FALSE); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_PIGGYBACK_INUSED); pAd->CommonCfg.BACapability.word = pAd->CommonCfg.REGBACapability.word; // Restore all settings in the following. - AsicUpdateProtect(pAd, 0, (ALLN_SETPROTECT|CCKSETPROTECT|OFDMSETPROTECT), TRUE, FALSE); + AsicUpdateProtect(pAd, 0, + (ALLN_SETPROTECT | CCKSETPROTECT | OFDMSETPROTECT), + TRUE, FALSE); AsicDisableRDG(pAd); pAd->CommonCfg.IOTestParm.bCurrentAtheros = FALSE; pAd->CommonCfg.IOTestParm.bNowAtherosBurstOn = FALSE; @@ -2050,9 +2107,8 @@ VOID LinkDown( RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0); #ifdef RT30xx - if ((IS_RT30xx(pAd) || IS_RT3090(pAd)||IS_RT3390(pAd)) - &&(pAd->Antenna.field.RxPath>1||pAd->Antenna.field.TxPath>1)) - { + if ((IS_RT30xx(pAd) || IS_RT3090(pAd) || IS_RT3390(pAd)) + && (pAd->Antenna.field.RxPath > 1 || pAd->Antenna.field.TxPath > 1)) { RTMP_ASIC_MMPS_DISABLE(pAd); } #endif // RT30xx // @@ -2066,78 +2122,104 @@ VOID LinkDown( ========================================================================== */ -VOID IterateOnBssTab( - IN PRTMP_ADAPTER pAd) +VOID IterateOnBssTab(IN PRTMP_ADAPTER pAd) { - MLME_START_REQ_STRUCT StartReq; - MLME_JOIN_REQ_STRUCT JoinReq; - ULONG BssIdx; + MLME_START_REQ_STRUCT StartReq; + MLME_JOIN_REQ_STRUCT JoinReq; + ULONG BssIdx; // Change the wepstatus to original wepstatus - pAd->StaCfg.WepStatus = pAd->StaCfg.OrigWepStatus; - pAd->StaCfg.PairCipher = pAd->StaCfg.OrigWepStatus; + pAd->StaCfg.WepStatus = pAd->StaCfg.OrigWepStatus; + pAd->StaCfg.PairCipher = pAd->StaCfg.OrigWepStatus; pAd->StaCfg.GroupCipher = pAd->StaCfg.OrigWepStatus; BssIdx = pAd->MlmeAux.BssIdx; - if (BssIdx < pAd->MlmeAux.SsidBssTab.BssNr) - { + if (BssIdx < pAd->MlmeAux.SsidBssTab.BssNr) { // Check cipher suite, AP must have more secured cipher than station setting // Set the Pairwise and Group cipher to match the intended AP setting // We can only connect to AP with less secured cipher setting - if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) - { - pAd->StaCfg.GroupCipher = pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA.GroupCipher; - - if (pAd->StaCfg.WepStatus == pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA.PairCipher) - pAd->StaCfg.PairCipher = pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA.PairCipher; - else if (pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA.PairCipherAux != Ndis802_11WEPDisabled) - pAd->StaCfg.PairCipher = pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA.PairCipherAux; + if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) + || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) { + pAd->StaCfg.GroupCipher = + pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA. + GroupCipher; + + if (pAd->StaCfg.WepStatus == + pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA. + PairCipher) + pAd->StaCfg.PairCipher = + pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx]. + WPA.PairCipher; + else if (pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA. + PairCipherAux != Ndis802_11WEPDisabled) + pAd->StaCfg.PairCipher = + pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx]. + WPA.PairCipherAux; else // There is no PairCipher Aux, downgrade our capability to TKIP - pAd->StaCfg.PairCipher = Ndis802_11Encryption2Enabled; - } - else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) - { - pAd->StaCfg.GroupCipher = pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA2.GroupCipher; - - if (pAd->StaCfg.WepStatus == pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA2.PairCipher) - pAd->StaCfg.PairCipher = pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA2.PairCipher; - else if (pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA2.PairCipherAux != Ndis802_11WEPDisabled) - pAd->StaCfg.PairCipher = pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA2.PairCipherAux; + pAd->StaCfg.PairCipher = + Ndis802_11Encryption2Enabled; + } else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) + || (pAd->StaCfg.AuthMode == + Ndis802_11AuthModeWPA2PSK)) { + pAd->StaCfg.GroupCipher = + pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA2. + GroupCipher; + + if (pAd->StaCfg.WepStatus == + pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA2. + PairCipher) + pAd->StaCfg.PairCipher = + pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx]. + WPA2.PairCipher; + else if (pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA2. + PairCipherAux != Ndis802_11WEPDisabled) + pAd->StaCfg.PairCipher = + pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx]. + WPA2.PairCipherAux; else // There is no PairCipher Aux, downgrade our capability to TKIP - pAd->StaCfg.PairCipher = Ndis802_11Encryption2Enabled; + pAd->StaCfg.PairCipher = + Ndis802_11Encryption2Enabled; // RSN capability - pAd->StaCfg.RsnCapability = pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA2.RsnCapability; + pAd->StaCfg.RsnCapability = + pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA2. + RsnCapability; } - // Set Mix cipher flag - pAd->StaCfg.bMixCipher = (pAd->StaCfg.PairCipher == pAd->StaCfg.GroupCipher) ? FALSE : TRUE; + pAd->StaCfg.bMixCipher = + (pAd->StaCfg.PairCipher == + pAd->StaCfg.GroupCipher) ? FALSE : TRUE; /*if (pAd->StaCfg.bMixCipher == TRUE) - { - // If mix cipher, re-build RSNIE - RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, 0); - }*/ - - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - iterate BSS %ld of %d\n", BssIdx, pAd->MlmeAux.SsidBssTab.BssNr)); + { + // If mix cipher, re-build RSNIE + RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, 0); + } */ + + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - iterate BSS %ld of %d\n", BssIdx, + pAd->MlmeAux.SsidBssTab.BssNr)); JoinParmFill(pAd, &JoinReq, BssIdx); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_JOIN_REQ, sizeof(MLME_JOIN_REQ_STRUCT), - &JoinReq); + MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_JOIN_REQ, + sizeof(MLME_JOIN_REQ_STRUCT), &JoinReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_JOIN; - } - else if (pAd->StaCfg.BssType == BSS_ADHOC) - { - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - All BSS fail; start a new ADHOC (Ssid=%s)...\n",pAd->MlmeAux.Ssid)); - StartParmFill(pAd, &StartReq, (PCHAR)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); - MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, sizeof(MLME_START_REQ_STRUCT), &StartReq); + } else if (pAd->StaCfg.BssType == BSS_ADHOC) { + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - All BSS fail; start a new ADHOC (Ssid=%s)...\n", + pAd->MlmeAux.Ssid)); + StartParmFill(pAd, &StartReq, (PCHAR) pAd->MlmeAux.Ssid, + pAd->MlmeAux.SsidLen); + MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, + sizeof(MLME_START_REQ_STRUCT), &StartReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_START; - } - else // no more BSS + } else // no more BSS { { - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - All roaming failed, restore to channel %d, Total BSS[%02d]\n",pAd->CommonCfg.Channel, pAd->ScanTab.BssNr)); + AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); + AsicLockChannel(pAd, pAd->CommonCfg.Channel); + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - All roaming failed, restore to channel %d, Total BSS[%02d]\n", + pAd->CommonCfg.Channel, pAd->ScanTab.BssNr)); } pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; @@ -2146,38 +2228,40 @@ VOID IterateOnBssTab( // for re-association only // IRQL = DISPATCH_LEVEL -VOID IterateOnBssTab2( - IN PRTMP_ADAPTER pAd) +VOID IterateOnBssTab2(IN PRTMP_ADAPTER pAd) { MLME_REASSOC_REQ_STRUCT ReassocReq; - ULONG BssIdx; - BSS_ENTRY *pBss; + ULONG BssIdx; + BSS_ENTRY *pBss; BssIdx = pAd->MlmeAux.RoamIdx; pBss = &pAd->MlmeAux.RoamTab.BssEntry[BssIdx]; - if (BssIdx < pAd->MlmeAux.RoamTab.BssNr) - { - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - iterate BSS %ld of %d\n", BssIdx, pAd->MlmeAux.RoamTab.BssNr)); + if (BssIdx < pAd->MlmeAux.RoamTab.BssNr) { + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - iterate BSS %ld of %d\n", BssIdx, + pAd->MlmeAux.RoamTab.BssNr)); AsicSwitchChannel(pAd, pBss->Channel, FALSE); AsicLockChannel(pAd, pBss->Channel); // reassociate message has the same structure as associate message - AssocParmFill(pAd, &ReassocReq, pBss->Bssid, pBss->CapabilityInfo, - ASSOC_TIMEOUT, pAd->StaCfg.DefaultListenCount); + AssocParmFill(pAd, &ReassocReq, pBss->Bssid, + pBss->CapabilityInfo, ASSOC_TIMEOUT, + pAd->StaCfg.DefaultListenCount); MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_REASSOC_REQ, - sizeof(MLME_REASSOC_REQ_STRUCT), &ReassocReq); + sizeof(MLME_REASSOC_REQ_STRUCT), &ReassocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_REASSOC; - } - else // no more BSS + } else // no more BSS { { - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - DBGPRINT(RT_DEBUG_TRACE, ("CNTL - All roaming failed, restore to channel %d, Total BSS[%02d]\n",pAd->CommonCfg.Channel, pAd->ScanTab.BssNr)); + AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); + AsicLockChannel(pAd, pAd->CommonCfg.Channel); + DBGPRINT(RT_DEBUG_TRACE, + ("CNTL - All roaming failed, restore to channel %d, Total BSS[%02d]\n", + pAd->CommonCfg.Channel, pAd->ScanTab.BssNr)); } pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; @@ -2192,10 +2276,8 @@ VOID IterateOnBssTab2( ========================================================================== */ -VOID JoinParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_JOIN_REQ_STRUCT *JoinReq, - IN ULONG BssIdx) +VOID JoinParmFill(IN PRTMP_ADAPTER pAd, + IN OUT MLME_JOIN_REQ_STRUCT * JoinReq, IN ULONG BssIdx) { JoinReq->BssIdx = BssIdx; } @@ -2208,15 +2290,12 @@ VOID JoinParmFill( ========================================================================== */ -VOID ScanParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_SCAN_REQ_STRUCT *ScanReq, - IN STRING Ssid[], - IN UCHAR SsidLen, - IN UCHAR BssType, - IN UCHAR ScanType) +VOID ScanParmFill(IN PRTMP_ADAPTER pAd, + IN OUT MLME_SCAN_REQ_STRUCT * ScanReq, + IN STRING Ssid[], + IN UCHAR SsidLen, IN UCHAR BssType, IN UCHAR ScanType) { - NdisZeroMemory(ScanReq->Ssid, MAX_LEN_OF_SSID); + NdisZeroMemory(ScanReq->Ssid, MAX_LEN_OF_SSID); ScanReq->SsidLen = SsidLen; NdisMoveMemory(ScanReq->Ssid, Ssid, SsidLen); ScanReq->BssType = BssType; @@ -2231,11 +2310,9 @@ VOID ScanParmFill( ========================================================================== */ -VOID StartParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_START_REQ_STRUCT *StartReq, - IN CHAR Ssid[], - IN UCHAR SsidLen) +VOID StartParmFill(IN PRTMP_ADAPTER pAd, + IN OUT MLME_START_REQ_STRUCT * StartReq, + IN CHAR Ssid[], IN UCHAR SsidLen) { ASSERT(SsidLen <= MAX_LEN_OF_SSID); NdisMoveMemory(StartReq->Ssid, Ssid, SsidLen); @@ -2250,11 +2327,9 @@ VOID StartParmFill( ========================================================================== */ -VOID AuthParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_AUTH_REQ_STRUCT *AuthReq, - IN PUCHAR pAddr, - IN USHORT Alg) +VOID AuthParmFill(IN PRTMP_ADAPTER pAd, + IN OUT MLME_AUTH_REQ_STRUCT * AuthReq, + IN PUCHAR pAddr, IN USHORT Alg) { COPY_MAC_ADDR(AuthReq->Addr, pAddr); AuthReq->Alg = Alg; @@ -2270,8 +2345,7 @@ VOID AuthParmFill( ========================================================================== */ #ifdef RTMP_MAC_PCI -VOID ComposePsPoll( - IN PRTMP_ADAPTER pAd) +VOID ComposePsPoll(IN PRTMP_ADAPTER pAd) { NdisZeroMemory(&pAd->PsPollFrame, sizeof(PSPOLL_FRAME)); pAd->PsPollFrame.FC.Type = BTYPE_CNTL; @@ -2282,8 +2356,7 @@ VOID ComposePsPoll( } // IRQL = DISPATCH_LEVEL -VOID ComposeNullFrame( - IN PRTMP_ADAPTER pAd) +VOID ComposeNullFrame(IN PRTMP_ADAPTER pAd) { NdisZeroMemory(&pAd->NullFrame, sizeof(HEADER_802_11)); pAd->NullFrame.FC.Type = BTYPE_DATA; @@ -2295,19 +2368,16 @@ VOID ComposeNullFrame( } #endif // RTMP_MAC_PCI // #ifdef RTMP_MAC_USB -VOID MlmeCntlConfirm( - IN PRTMP_ADAPTER pAd, - IN ULONG MsgType, - IN USHORT Msg) +VOID MlmeCntlConfirm(IN PRTMP_ADAPTER pAd, IN ULONG MsgType, IN USHORT Msg) { - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MsgType, sizeof(USHORT), &Msg); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MsgType, sizeof(USHORT), + &Msg); } -VOID ComposePsPoll( - IN PRTMP_ADAPTER pAd) +VOID ComposePsPoll(IN PRTMP_ADAPTER pAd) { - PTXINFO_STRUC pTxInfo; - PTXWI_STRUC pTxWI; + PTXINFO_STRUC pTxInfo; + PTXWI_STRUC pTxWI; DBGPRINT(RT_DEBUG_TRACE, ("ComposePsPoll\n")); NdisZeroMemory(&pAd->PsPollFrame, sizeof(PSPOLL_FRAME)); @@ -2319,23 +2389,34 @@ VOID ComposePsPoll( COPY_MAC_ADDR(pAd->PsPollFrame.Bssid, pAd->CommonCfg.Bssid); COPY_MAC_ADDR(pAd->PsPollFrame.Ta, pAd->CurrentAddress); - RTMPZeroMemory(&pAd->PsPollContext.TransferBuffer->field.WirelessPacket[0], 100); - pTxInfo = (PTXINFO_STRUC)&pAd->PsPollContext.TransferBuffer->field.WirelessPacket[0]; - RTMPWriteTxInfo(pAd, pTxInfo, (USHORT)(sizeof(PSPOLL_FRAME)+TXWI_SIZE), TRUE, EpToQueue[MGMTPIPEIDX], FALSE, FALSE); - pTxWI = (PTXWI_STRUC)&pAd->PsPollContext.TransferBuffer->field.WirelessPacket[TXINFO_SIZE]; - RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0, BSSID_WCID, (sizeof(PSPOLL_FRAME)), - 0, 0, (UCHAR)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); - RTMPMoveMemory(&pAd->PsPollContext.TransferBuffer->field.WirelessPacket[TXWI_SIZE+TXINFO_SIZE], &pAd->PsPollFrame, sizeof(PSPOLL_FRAME)); + RTMPZeroMemory(&pAd->PsPollContext.TransferBuffer->field. + WirelessPacket[0], 100); + pTxInfo = + (PTXINFO_STRUC) & pAd->PsPollContext.TransferBuffer->field. + WirelessPacket[0]; + RTMPWriteTxInfo(pAd, pTxInfo, + (USHORT) (sizeof(PSPOLL_FRAME) + TXWI_SIZE), TRUE, + EpToQueue[MGMTPIPEIDX], FALSE, FALSE); + pTxWI = + (PTXWI_STRUC) & pAd->PsPollContext.TransferBuffer->field. + WirelessPacket[TXINFO_SIZE]; + RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0, + BSSID_WCID, (sizeof(PSPOLL_FRAME)), 0, 0, + (UCHAR) pAd->CommonCfg.MlmeTransmit.field.MCS, + IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); + RTMPMoveMemory(&pAd->PsPollContext.TransferBuffer->field. + WirelessPacket[TXWI_SIZE + TXINFO_SIZE], + &pAd->PsPollFrame, sizeof(PSPOLL_FRAME)); // Append 4 extra zero bytes. - pAd->PsPollContext.BulkOutSize = TXINFO_SIZE + TXWI_SIZE + sizeof(PSPOLL_FRAME) + 4; + pAd->PsPollContext.BulkOutSize = + TXINFO_SIZE + TXWI_SIZE + sizeof(PSPOLL_FRAME) + 4; } // IRQL = DISPATCH_LEVEL -VOID ComposeNullFrame( - IN PRTMP_ADAPTER pAd) +VOID ComposeNullFrame(IN PRTMP_ADAPTER pAd) { - PTXINFO_STRUC pTxInfo; - PTXWI_STRUC pTxWI; + PTXINFO_STRUC pTxInfo; + PTXWI_STRUC pTxWI; NdisZeroMemory(&pAd->NullFrame, sizeof(HEADER_802_11)); pAd->NullFrame.FC.Type = BTYPE_DATA; @@ -2344,14 +2425,26 @@ VOID ComposeNullFrame( COPY_MAC_ADDR(pAd->NullFrame.Addr1, pAd->CommonCfg.Bssid); COPY_MAC_ADDR(pAd->NullFrame.Addr2, pAd->CurrentAddress); COPY_MAC_ADDR(pAd->NullFrame.Addr3, pAd->CommonCfg.Bssid); - RTMPZeroMemory(&pAd->NullContext.TransferBuffer->field.WirelessPacket[0], 100); - pTxInfo = (PTXINFO_STRUC)&pAd->NullContext.TransferBuffer->field.WirelessPacket[0]; - RTMPWriteTxInfo(pAd, pTxInfo, (USHORT)(sizeof(HEADER_802_11)+TXWI_SIZE), TRUE, EpToQueue[MGMTPIPEIDX], FALSE, FALSE); - pTxWI = (PTXWI_STRUC)&pAd->NullContext.TransferBuffer->field.WirelessPacket[TXINFO_SIZE]; - RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0, BSSID_WCID, (sizeof(HEADER_802_11)), - 0, 0, (UCHAR)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); - RTMPMoveMemory(&pAd->NullContext.TransferBuffer->field.WirelessPacket[TXWI_SIZE+TXINFO_SIZE], &pAd->NullFrame, sizeof(HEADER_802_11)); - pAd->NullContext.BulkOutSize = TXINFO_SIZE + TXWI_SIZE + sizeof(pAd->NullFrame) + 4; + RTMPZeroMemory(&pAd->NullContext.TransferBuffer->field. + WirelessPacket[0], 100); + pTxInfo = + (PTXINFO_STRUC) & pAd->NullContext.TransferBuffer->field. + WirelessPacket[0]; + RTMPWriteTxInfo(pAd, pTxInfo, + (USHORT) (sizeof(HEADER_802_11) + TXWI_SIZE), TRUE, + EpToQueue[MGMTPIPEIDX], FALSE, FALSE); + pTxWI = + (PTXWI_STRUC) & pAd->NullContext.TransferBuffer->field. + WirelessPacket[TXINFO_SIZE]; + RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0, + BSSID_WCID, (sizeof(HEADER_802_11)), 0, 0, + (UCHAR) pAd->CommonCfg.MlmeTransmit.field.MCS, + IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); + RTMPMoveMemory(&pAd->NullContext.TransferBuffer->field. + WirelessPacket[TXWI_SIZE + TXINFO_SIZE], &pAd->NullFrame, + sizeof(HEADER_802_11)); + pAd->NullContext.BulkOutSize = + TXINFO_SIZE + TXWI_SIZE + sizeof(pAd->NullFrame) + 4; } #endif // RTMP_MAC_USB // @@ -2365,45 +2458,42 @@ VOID ComposeNullFrame( ========================================================================== */ -ULONG MakeIbssBeacon( - IN PRTMP_ADAPTER pAd) +ULONG MakeIbssBeacon(IN PRTMP_ADAPTER pAd) { - UCHAR DsLen = 1, IbssLen = 2; - UCHAR LocalErpIe[3] = {IE_ERP, 1, 0x04}; + UCHAR DsLen = 1, IbssLen = 2; + UCHAR LocalErpIe[3] = { IE_ERP, 1, 0x04 }; HEADER_802_11 BcnHdr; - USHORT CapabilityInfo; + USHORT CapabilityInfo; LARGE_INTEGER FakeTimestamp; - ULONG FrameLen = 0; - PTXWI_STRUC pTxWI = &pAd->BeaconTxWI; - UCHAR *pBeaconFrame = pAd->BeaconBuf; - BOOLEAN Privacy; - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen = 0; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR ExtRateLen = 0; - UCHAR RSNIe = IE_WPA; - - if ((pAd->CommonCfg.PhyMode == PHY_11B) && (pAd->CommonCfg.Channel <= 14)) - { - SupRate[0] = 0x82; // 1 mbps - SupRate[1] = 0x84; // 2 mbps - SupRate[2] = 0x8b; // 5.5 mbps - SupRate[3] = 0x96; // 11 mbps + ULONG FrameLen = 0; + PTXWI_STRUC pTxWI = &pAd->BeaconTxWI; + UCHAR *pBeaconFrame = pAd->BeaconBuf; + BOOLEAN Privacy; + UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; + UCHAR SupRateLen = 0; + UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; + UCHAR ExtRateLen = 0; + UCHAR RSNIe = IE_WPA; + + if ((pAd->CommonCfg.PhyMode == PHY_11B) + && (pAd->CommonCfg.Channel <= 14)) { + SupRate[0] = 0x82; // 1 mbps + SupRate[1] = 0x84; // 2 mbps + SupRate[2] = 0x8b; // 5.5 mbps + SupRate[3] = 0x96; // 11 mbps SupRateLen = 4; ExtRateLen = 0; - } - else if (pAd->CommonCfg.Channel > 14) - { - SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate - SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps - SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate - SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps - SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate - SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps - SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps - SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps - SupRateLen = 8; - ExtRateLen = 0; + } else if (pAd->CommonCfg.Channel > 14) { + SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate + SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps + SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate + SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps + SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate + SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps + SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps + SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps + SupRateLen = 8; + ExtRateLen = 0; // // Also Update MlmeRate & RtsRate for G only & A only @@ -2411,27 +2501,28 @@ ULONG MakeIbssBeacon( pAd->CommonCfg.MlmeRate = RATE_6; pAd->CommonCfg.RtsRate = RATE_6; pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; - pAd->CommonCfg.MlmeTransmit.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; - pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MODE = MODE_OFDM; - pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; - } - else - { - SupRate[0] = 0x82; // 1 mbps - SupRate[1] = 0x84; // 2 mbps - SupRate[2] = 0x8b; // 5.5 mbps - SupRate[3] = 0x96; // 11 mbps + pAd->CommonCfg.MlmeTransmit.field.MCS = + OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; + pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MODE = + MODE_OFDM; + pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MCS = + OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; + } else { + SupRate[0] = 0x82; // 1 mbps + SupRate[1] = 0x84; // 2 mbps + SupRate[2] = 0x8b; // 5.5 mbps + SupRate[3] = 0x96; // 11 mbps SupRateLen = 4; - ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps, - ExtRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps - ExtRate[2] = 0x18; // 12 mbps, in units of 0.5 Mbps, - ExtRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps - ExtRate[4] = 0x30; // 24 mbps, in units of 0.5 Mbps, - ExtRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps - ExtRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps - ExtRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps - ExtRateLen = 8; + ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps, + ExtRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps + ExtRate[2] = 0x18; // 12 mbps, in units of 0.5 Mbps, + ExtRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps + ExtRate[4] = 0x30; // 24 mbps, in units of 0.5 Mbps, + ExtRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps + ExtRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps + ExtRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps + ExtRateLen = 8; } pAd->StaActive.SupRateLen = SupRateLen; @@ -2440,61 +2531,59 @@ ULONG MakeIbssBeacon( NdisMoveMemory(pAd->StaActive.ExtRate, ExtRate, ExtRateLen); // compose IBSS beacon frame - MgtMacHeaderInit(pAd, &BcnHdr, SUBTYPE_BEACON, 0, BROADCAST_ADDR, pAd->CommonCfg.Bssid); - Privacy = (pAd->StaCfg.WepStatus == Ndis802_11Encryption1Enabled) || - (pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) || - (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled); - CapabilityInfo = CAP_GENERATE(0, 1, Privacy, (pAd->CommonCfg.TxPreamble == Rt802_11PreambleShort), 0, 0); - - MakeOutgoingFrame(pBeaconFrame, &FrameLen, - sizeof(HEADER_802_11), &BcnHdr, - TIMESTAMP_LEN, &FakeTimestamp, - 2, &pAd->CommonCfg.BeaconPeriod, - 2, &CapabilityInfo, - 1, &SsidIe, - 1, &pAd->CommonCfg.SsidLen, - pAd->CommonCfg.SsidLen, pAd->CommonCfg.Ssid, - 1, &SupRateIe, - 1, &SupRateLen, - SupRateLen, SupRate, - 1, &DsIe, - 1, &DsLen, - 1, &pAd->CommonCfg.Channel, - 1, &IbssIe, - 1, &IbssLen, - 2, &pAd->StaActive.AtimWin, - END_OF_ARGS); + MgtMacHeaderInit(pAd, &BcnHdr, SUBTYPE_BEACON, 0, BROADCAST_ADDR, + pAd->CommonCfg.Bssid); + Privacy = (pAd->StaCfg.WepStatus == Ndis802_11Encryption1Enabled) + || (pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) + || (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled); + CapabilityInfo = + CAP_GENERATE(0, 1, Privacy, + (pAd->CommonCfg.TxPreamble == Rt802_11PreambleShort), + 0, 0); + + MakeOutgoingFrame(pBeaconFrame, &FrameLen, + sizeof(HEADER_802_11), &BcnHdr, + TIMESTAMP_LEN, &FakeTimestamp, + 2, &pAd->CommonCfg.BeaconPeriod, + 2, &CapabilityInfo, + 1, &SsidIe, + 1, &pAd->CommonCfg.SsidLen, + pAd->CommonCfg.SsidLen, pAd->CommonCfg.Ssid, + 1, &SupRateIe, + 1, &SupRateLen, + SupRateLen, SupRate, + 1, &DsIe, + 1, &DsLen, + 1, &pAd->CommonCfg.Channel, + 1, &IbssIe, + 1, &IbssLen, 2, &pAd->StaActive.AtimWin, END_OF_ARGS); // add ERP_IE and EXT_RAE IE of in 802.11g - if (ExtRateLen) - { - ULONG tmp; - - MakeOutgoingFrame(pBeaconFrame + FrameLen, &tmp, - 3, LocalErpIe, - 1, &ExtRateIe, - 1, &ExtRateLen, - ExtRateLen, ExtRate, - END_OF_ARGS); + if (ExtRateLen) { + ULONG tmp; + + MakeOutgoingFrame(pBeaconFrame + FrameLen, &tmp, + 3, LocalErpIe, + 1, &ExtRateIe, + 1, &ExtRateLen, + ExtRateLen, ExtRate, END_OF_ARGS); FrameLen += tmp; } - // If adhoc secruity is set for WPA-None, append the cipher suite IE - if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) - { + if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) { ULONG tmp; - RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, BSS0); - - MakeOutgoingFrame(pBeaconFrame + FrameLen, &tmp, - 1, &RSNIe, - 1, &pAd->StaCfg.RSNIE_Len, - pAd->StaCfg.RSNIE_Len, pAd->StaCfg.RSN_IE, - END_OF_ARGS); + RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, + BSS0); + + MakeOutgoingFrame(pBeaconFrame + FrameLen, &tmp, + 1, &RSNIe, + 1, &pAd->StaCfg.RSNIE_Len, + pAd->StaCfg.RSNIE_Len, pAd->StaCfg.RSN_IE, + END_OF_ARGS); FrameLen += tmp; } - if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) - { + if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) { ULONG TmpLen; UCHAR HtLen, HtLen1; @@ -2502,34 +2591,35 @@ ULONG MakeIbssBeacon( HtLen = sizeof(pAd->CommonCfg.HtCapability); HtLen1 = sizeof(pAd->CommonCfg.AddHTInfo); - MakeOutgoingFrame(pBeaconFrame+FrameLen, &TmpLen, - 1, &HtCapIe, - 1, &HtLen, - HtLen, &pAd->CommonCfg.HtCapability, - 1, &AddHtInfoIe, - 1, &HtLen1, - HtLen1, &pAd->CommonCfg.AddHTInfo, - END_OF_ARGS); + MakeOutgoingFrame(pBeaconFrame + FrameLen, &TmpLen, + 1, &HtCapIe, + 1, &HtLen, + HtLen, &pAd->CommonCfg.HtCapability, + 1, &AddHtInfoIe, + 1, &HtLen1, + HtLen1, &pAd->CommonCfg.AddHTInfo, + END_OF_ARGS); FrameLen += TmpLen; } - //beacon use reserved WCID 0xff - if (pAd->CommonCfg.Channel > 14) - { - RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, 0, 0xff, FrameLen, - PID_MGMT, PID_BEACON, RATE_1, IFS_HTTXOP, FALSE, &pAd->CommonCfg.MlmeTransmit); - } - else - { - // Set to use 1Mbps for Adhoc beacon. + if (pAd->CommonCfg.Channel > 14) { + RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, TRUE, FALSE, FALSE, + TRUE, 0, 0xff, FrameLen, PID_MGMT, PID_BEACON, + RATE_1, IFS_HTTXOP, FALSE, + &pAd->CommonCfg.MlmeTransmit); + } else { + // Set to use 1Mbps for Adhoc beacon. HTTRANSMIT_SETTING Transmit; - Transmit.word = 0; - RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, 0, 0xff, FrameLen, - PID_MGMT, PID_BEACON, RATE_1, IFS_HTTXOP, FALSE, &Transmit); - } + Transmit.word = 0; + RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, TRUE, FALSE, FALSE, + TRUE, 0, 0xff, FrameLen, PID_MGMT, PID_BEACON, + RATE_1, IFS_HTTXOP, FALSE, &Transmit); + } - DBGPRINT(RT_DEBUG_TRACE, ("MakeIbssBeacon (len=%ld), SupRateLen=%d, ExtRateLen=%d, Channel=%d, PhyMode=%d\n", - FrameLen, SupRateLen, ExtRateLen, pAd->CommonCfg.Channel, pAd->CommonCfg.PhyMode)); + DBGPRINT(RT_DEBUG_TRACE, + ("MakeIbssBeacon (len=%ld), SupRateLen=%d, ExtRateLen=%d, Channel=%d, PhyMode=%d\n", + FrameLen, SupRateLen, ExtRateLen, pAd->CommonCfg.Channel, + pAd->CommonCfg.PhyMode)); return FrameLen; } diff --git a/drivers/staging/rt2860/sta/rtmp_data.c b/drivers/staging/rt2860/sta/rtmp_data.c index 0ab3dce5d1ae..3a93ef699ce6 100644 --- a/drivers/staging/rt2860/sta/rtmp_data.c +++ b/drivers/staging/rt2860/sta/rtmp_data.c @@ -36,107 +36,164 @@ */ #include "../rt_config.h" - - -VOID STARxEAPOLFrameIndicate( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) +VOID STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, + IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) { - PRT28XX_RXD_STRUC pRxD = &(pRxBlk->RxD); - PRXWI_STRUC pRxWI = pRxBlk->pRxWI; - UCHAR *pTmpBuf; + PRT28XX_RXD_STRUC pRxD = &(pRxBlk->RxD); + PRXWI_STRUC pRxWI = pRxBlk->pRxWI; + UCHAR *pTmpBuf; - if (pAd->StaCfg.WpaSupplicantUP) - { + if (pAd->StaCfg.WpaSupplicantUP) { // All EAPoL frames have to pass to upper layer (ex. WPA_SUPPLICANT daemon) // TBD : process fragmented EAPol frames { // In 802.1x mode, if the received frame is EAP-SUCCESS packet, turn on the PortSecured variable - if ( pAd->StaCfg.IEEE8021X == TRUE && - (EAP_CODE_SUCCESS == WpaCheckEapCode(pAd, pRxBlk->pData, pRxBlk->DataSize, LENGTH_802_1_H))) - { - PUCHAR Key; - UCHAR CipherAlg; - int idx = 0; - - DBGPRINT_RAW(RT_DEBUG_TRACE, ("Receive EAP-SUCCESS Packet\n")); + if (pAd->StaCfg.IEEE8021X == TRUE && + (EAP_CODE_SUCCESS == + WpaCheckEapCode(pAd, pRxBlk->pData, + pRxBlk->DataSize, + LENGTH_802_1_H))) { + PUCHAR Key; + UCHAR CipherAlg; + int idx = 0; + + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("Receive EAP-SUCCESS Packet\n")); //pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; STA_PORT_SECURED(pAd); - if (pAd->StaCfg.IEEE8021x_required_keys == FALSE) - { - idx = pAd->StaCfg.DesireSharedKeyId; - CipherAlg = pAd->StaCfg.DesireSharedKey[idx].CipherAlg; - Key = pAd->StaCfg.DesireSharedKey[idx].Key; - - if (pAd->StaCfg.DesireSharedKey[idx].KeyLen > 0) - { + if (pAd->StaCfg.IEEE8021x_required_keys == + FALSE) { + idx = pAd->StaCfg.DesireSharedKeyId; + CipherAlg = + pAd->StaCfg.DesireSharedKey[idx]. + CipherAlg; + Key = + pAd->StaCfg.DesireSharedKey[idx]. + Key; + + if (pAd->StaCfg.DesireSharedKey[idx]. + KeyLen > 0) { #ifdef RTMP_MAC_PCI - MAC_TABLE_ENTRY *pEntry = &pAd->MacTab.Content[BSSID_WCID]; + MAC_TABLE_ENTRY *pEntry = + &pAd->MacTab. + Content[BSSID_WCID]; // Set key material and cipherAlg to Asic - AsicAddSharedKeyEntry(pAd, BSS0, idx, CipherAlg, Key, NULL, NULL); + AsicAddSharedKeyEntry(pAd, BSS0, + idx, + CipherAlg, + Key, NULL, + NULL); // Assign group key info - RTMPAddWcidAttributeEntry(pAd, BSS0, idx, CipherAlg, NULL); + RTMPAddWcidAttributeEntry(pAd, + BSS0, + idx, + CipherAlg, + NULL); // Assign pairwise key info - RTMPAddWcidAttributeEntry(pAd, BSS0, idx, CipherAlg, pEntry); - - pAd->IndicateMediaState = NdisMediaStateConnected; - pAd->ExtraInfo = GENERAL_LINK_UP; + RTMPAddWcidAttributeEntry(pAd, + BSS0, + idx, + CipherAlg, + pEntry); + + pAd->IndicateMediaState = + NdisMediaStateConnected; + pAd->ExtraInfo = + GENERAL_LINK_UP; #endif // RTMP_MAC_PCI // #ifdef RTMP_MAC_USB - union - { - char buf[sizeof(NDIS_802_11_WEP)+MAX_LEN_OF_KEY- 1]; + union { + char buf[sizeof + (NDIS_802_11_WEP) + + + MAX_LEN_OF_KEY + - 1]; NDIS_802_11_WEP keyinfo; - } WepKey; + } + WepKey; int len; - - NdisZeroMemory(&WepKey, sizeof(WepKey)); - len =pAd->StaCfg.DesireSharedKey[idx].KeyLen; - - NdisMoveMemory(WepKey.keyinfo.KeyMaterial, - pAd->StaCfg.DesireSharedKey[idx].Key, - pAd->StaCfg.DesireSharedKey[idx].KeyLen); - - WepKey.keyinfo.KeyIndex = 0x80000000 + idx; + NdisZeroMemory(&WepKey, + sizeof(WepKey)); + len = + pAd->StaCfg. + DesireSharedKey[idx].KeyLen; + + NdisMoveMemory(WepKey.keyinfo. + KeyMaterial, + pAd->StaCfg. + DesireSharedKey + [idx].Key, + pAd->StaCfg. + DesireSharedKey + [idx].KeyLen); + + WepKey.keyinfo.KeyIndex = + 0x80000000 + idx; WepKey.keyinfo.KeyLength = len; - pAd->SharedKey[BSS0][idx].KeyLen =(UCHAR) (len <= 5 ? 5 : 13); - - pAd->IndicateMediaState = NdisMediaStateConnected; - pAd->ExtraInfo = GENERAL_LINK_UP; + pAd->SharedKey[BSS0][idx]. + KeyLen = + (UCHAR) (len <= 5 ? 5 : 13); + + pAd->IndicateMediaState = + NdisMediaStateConnected; + pAd->ExtraInfo = + GENERAL_LINK_UP; // need to enqueue cmd to thread - RTUSBEnqueueCmdFromNdis(pAd, OID_802_11_ADD_WEP, TRUE, &WepKey, sizeof(WepKey.keyinfo) + len - 1); + RTUSBEnqueueCmdFromNdis(pAd, + OID_802_11_ADD_WEP, + TRUE, + &WepKey, + sizeof + (WepKey. + keyinfo) + + len - + 1); #endif // RTMP_MAC_USB // // For Preventing ShardKey Table is cleared by remove key procedure. - pAd->SharedKey[BSS0][idx].CipherAlg = CipherAlg; - pAd->SharedKey[BSS0][idx].KeyLen = pAd->StaCfg.DesireSharedKey[idx].KeyLen; - NdisMoveMemory(pAd->SharedKey[BSS0][idx].Key, - pAd->StaCfg.DesireSharedKey[idx].Key, - pAd->StaCfg.DesireSharedKey[idx].KeyLen); - } + pAd->SharedKey[BSS0][idx]. + CipherAlg = CipherAlg; + pAd->SharedKey[BSS0][idx]. + KeyLen = + pAd->StaCfg. + DesireSharedKey[idx].KeyLen; + NdisMoveMemory(pAd-> + SharedKey[BSS0] + [idx].Key, + pAd->StaCfg. + DesireSharedKey + [idx].Key, + pAd->StaCfg. + DesireSharedKey + [idx].KeyLen); + } } } Indicate_Legacy_Packet(pAd, pRxBlk, FromWhichBSSID); return; } - } - else - { + } else { // Special DATA frame that has to pass to MLME - // 1. Cisco Aironet frames for CCX2. We need pass it to MLME for special process - // 2. EAPOL handshaking frames when driver supplicant enabled, pass to MLME for special process + // 1. Cisco Aironet frames for CCX2. We need pass it to MLME for special process + // 2. EAPOL handshaking frames when driver supplicant enabled, pass to MLME for special process { pTmpBuf = pRxBlk->pData - LENGTH_802_11; NdisMoveMemory(pTmpBuf, pRxBlk->pHeader, LENGTH_802_11); - REPORT_MGMT_FRAME_TO_MLME(pAd, pRxWI->WirelessCliID, pTmpBuf, pRxBlk->DataSize + LENGTH_802_11, pRxWI->RSSI0, pRxWI->RSSI1, pRxWI->RSSI2, pRxD->PlcpSignal); - DBGPRINT_RAW(RT_DEBUG_TRACE, ("!!! report EAPOL/AIRONET DATA to MLME (len=%d) !!!\n", pRxBlk->DataSize)); + REPORT_MGMT_FRAME_TO_MLME(pAd, pRxWI->WirelessCliID, + pTmpBuf, + pRxBlk->DataSize + + LENGTH_802_11, pRxWI->RSSI0, + pRxWI->RSSI1, pRxWI->RSSI2, + pRxD->PlcpSignal); + DBGPRINT_RAW(RT_DEBUG_TRACE, + ("!!! report EAPOL/AIRONET DATA to MLME (len=%d) !!!\n", + pRxBlk->DataSize)); } } @@ -145,126 +202,114 @@ VOID STARxEAPOLFrameIndicate( } -VOID STARxDataFrameAnnounce( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID) +VOID STARxDataFrameAnnounce(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, + IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) { // non-EAP frame - if (!RTMPCheckWPAframe(pAd, pEntry, pRxBlk->pData, pRxBlk->DataSize, FromWhichBSSID)) - { + if (!RTMPCheckWPAframe + (pAd, pEntry, pRxBlk->pData, pRxBlk->DataSize, FromWhichBSSID)) { { // drop all non-EAP DATA frame before // this client's Port-Access-Control is secured - if (pRxBlk->pHeader->FC.Wep) - { + if (pRxBlk->pHeader->FC.Wep) { // unsupported cipher suite - if (pAd->StaCfg.WepStatus == Ndis802_11EncryptionDisabled) - { + if (pAd->StaCfg.WepStatus == + Ndis802_11EncryptionDisabled) { // release packet - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); + RELEASE_NDIS_PACKET(pAd, + pRxBlk->pRxPacket, + NDIS_STATUS_FAILURE); return; } - } - else - { + } else { // encryption in-use but receive a non-EAPOL clear text frame, drop it - if ((pAd->StaCfg.WepStatus != Ndis802_11EncryptionDisabled) && - (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED)) - { + if ((pAd->StaCfg.WepStatus != + Ndis802_11EncryptionDisabled) + && (pAd->StaCfg.PortSecured == + WPA_802_1X_PORT_NOT_SECURED)) { // release packet - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); + RELEASE_NDIS_PACKET(pAd, + pRxBlk->pRxPacket, + NDIS_STATUS_FAILURE); return; } } } RX_BLK_CLEAR_FLAG(pRxBlk, fRX_EAP); - if (!RX_BLK_TEST_FLAG(pRxBlk, fRX_ARALINK)) - { + if (!RX_BLK_TEST_FLAG(pRxBlk, fRX_ARALINK)) { // Normal legacy, AMPDU or AMSDU - CmmRxnonRalinkFrameIndicate(pAd, pRxBlk, FromWhichBSSID); + CmmRxnonRalinkFrameIndicate(pAd, pRxBlk, + FromWhichBSSID); - } - else - { + } else { // ARALINK - CmmRxRalinkFrameIndicate(pAd, pEntry, pRxBlk, FromWhichBSSID); + CmmRxRalinkFrameIndicate(pAd, pEntry, pRxBlk, + FromWhichBSSID); } - } - else - { + } else { RX_BLK_SET_FLAG(pRxBlk, fRX_EAP); - if (RX_BLK_TEST_FLAG(pRxBlk, fRX_AMPDU) && (pAd->CommonCfg.bDisableReordering == 0)) - { + if (RX_BLK_TEST_FLAG(pRxBlk, fRX_AMPDU) + && (pAd->CommonCfg.bDisableReordering == 0)) { Indicate_AMPDU_Packet(pAd, pRxBlk, FromWhichBSSID); - } - else - { + } else { // Determin the destination of the EAP frame // to WPA state machine or upper layer - STARxEAPOLFrameIndicate(pAd, pEntry, pRxBlk, FromWhichBSSID); + STARxEAPOLFrameIndicate(pAd, pEntry, pRxBlk, + FromWhichBSSID); } } } - // For TKIP frame, calculate the MIC value -BOOLEAN STACheckTkipMICValue( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN RX_BLK *pRxBlk) +BOOLEAN STACheckTkipMICValue(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, IN RX_BLK * pRxBlk) { - PHEADER_802_11 pHeader = pRxBlk->pHeader; - UCHAR *pData = pRxBlk->pData; - USHORT DataSize = pRxBlk->DataSize; - UCHAR UserPriority = pRxBlk->UserPriority; - PCIPHER_KEY pWpaKey; - UCHAR *pDA, *pSA; + PHEADER_802_11 pHeader = pRxBlk->pHeader; + UCHAR *pData = pRxBlk->pData; + USHORT DataSize = pRxBlk->DataSize; + UCHAR UserPriority = pRxBlk->UserPriority; + PCIPHER_KEY pWpaKey; + UCHAR *pDA, *pSA; pWpaKey = &pAd->SharedKey[BSS0][pRxBlk->pRxWI->KeyIndex]; pDA = pHeader->Addr1; - if (RX_BLK_TEST_FLAG(pRxBlk, fRX_INFRA)) - { + if (RX_BLK_TEST_FLAG(pRxBlk, fRX_INFRA)) { pSA = pHeader->Addr3; - } - else - { + } else { pSA = pHeader->Addr2; } if (RTMPTkipCompareMICValue(pAd, - pData, - pDA, - pSA, - pWpaKey->RxMic, - UserPriority, - DataSize) == FALSE) - { - DBGPRINT_RAW(RT_DEBUG_ERROR,("Rx MIC Value error 2\n")); - - if (pAd->StaCfg.WpaSupplicantUP) - { - WpaSendMicFailureToWpaSupplicant(pAd, (pWpaKey->Type == PAIRWISEKEY) ? TRUE : FALSE); - } - else - { + pData, + pDA, + pSA, + pWpaKey->RxMic, + UserPriority, DataSize) == FALSE) { + DBGPRINT_RAW(RT_DEBUG_ERROR, ("Rx MIC Value error 2\n")); + + if (pAd->StaCfg.WpaSupplicantUP) { + WpaSendMicFailureToWpaSupplicant(pAd, + (pWpaKey->Type == + PAIRWISEKEY) ? TRUE : + FALSE); + } else { RTMPReportMicError(pAd, pWpaKey); } // release packet - RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); + RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, + NDIS_STATUS_FAILURE); return FALSE; } return TRUE; } - // // All Rx routines use RX_BLK structure to hande rx events // It is very important to build pRxBlk attributes @@ -273,106 +318,112 @@ BOOLEAN STACheckTkipMICValue( // 3. set payload size including LLC to DataSize // 4. set some flags with RX_BLK_SET_FLAG() // -VOID STAHandleRxDataFrame( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk) +VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) { - PRT28XX_RXD_STRUC pRxD = &(pRxBlk->RxD); - PRXWI_STRUC pRxWI = pRxBlk->pRxWI; - PHEADER_802_11 pHeader = pRxBlk->pHeader; - PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; - BOOLEAN bFragment = FALSE; - MAC_TABLE_ENTRY *pEntry = NULL; - UCHAR FromWhichBSSID = BSS0; - UCHAR UserPriority = 0; + PRT28XX_RXD_STRUC pRxD = &(pRxBlk->RxD); + PRXWI_STRUC pRxWI = pRxBlk->pRxWI; + PHEADER_802_11 pHeader = pRxBlk->pHeader; + PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; + BOOLEAN bFragment = FALSE; + MAC_TABLE_ENTRY *pEntry = NULL; + UCHAR FromWhichBSSID = BSS0; + UCHAR UserPriority = 0; { // before LINK UP, all DATA frames are rejected - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { + if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) { // release packet - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); + RELEASE_NDIS_PACKET(pAd, pRxPacket, + NDIS_STATUS_FAILURE); return; } - // Drop not my BSS frames - if (pRxD->MyBss == 0) - { + if (pRxD->MyBss == 0) { { // release packet - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); + RELEASE_NDIS_PACKET(pAd, pRxPacket, + NDIS_STATUS_FAILURE); return; } } pAd->RalinkCounters.RxCountSinceLastNULL++; - if (pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable && (pHeader->FC.SubType & 0x08)) - { + if (pAd->CommonCfg.bAPSDCapable + && pAd->CommonCfg.APEdcaParm.bAPSDCapable + && (pHeader->FC.SubType & 0x08)) { UCHAR *pData; - DBGPRINT(RT_DEBUG_INFO,("bAPSDCapable\n")); + DBGPRINT(RT_DEBUG_INFO, ("bAPSDCapable\n")); // Qos bit 4 - pData = (PUCHAR)pHeader + LENGTH_802_11; - if ((*pData >> 4) & 0x01) - { - DBGPRINT(RT_DEBUG_INFO,("RxDone- Rcv EOSP frame, driver may fall into sleep\n")); + pData = (PUCHAR) pHeader + LENGTH_802_11; + if ((*pData >> 4) & 0x01) { + DBGPRINT(RT_DEBUG_INFO, + ("RxDone- Rcv EOSP frame, driver may fall into sleep\n")); pAd->CommonCfg.bInServicePeriod = FALSE; // Force driver to fall into sleep mode when rcv EOSP frame - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - USHORT TbttNumToNextWakeUp; - USHORT NextDtim = pAd->StaCfg.DtimPeriod; - ULONG Now; + if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { + USHORT TbttNumToNextWakeUp; + USHORT NextDtim = + pAd->StaCfg.DtimPeriod; + ULONG Now; NdisGetSystemUpTime(&Now); - NextDtim -= (USHORT)(Now - pAd->StaCfg.LastBeaconRxTime)/pAd->CommonCfg.BeaconPeriod; - - TbttNumToNextWakeUp = pAd->StaCfg.DefaultListenCount; - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM) && (TbttNumToNextWakeUp > NextDtim)) + NextDtim -= + (USHORT) (Now - + pAd->StaCfg. + LastBeaconRxTime) / + pAd->CommonCfg.BeaconPeriod; + + TbttNumToNextWakeUp = + pAd->StaCfg.DefaultListenCount; + if (OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_RECEIVE_DTIM) + && (TbttNumToNextWakeUp > NextDtim)) TbttNumToNextWakeUp = NextDtim; RTMP_SET_PSM_BIT(pAd, PWR_SAVE); // if WMM-APSD is failed, try to disable following line - AsicSleepThenAutoWakeup(pAd, TbttNumToNextWakeUp); + AsicSleepThenAutoWakeup(pAd, + TbttNumToNextWakeUp); } } - if ((pHeader->FC.MoreData) && (pAd->CommonCfg.bInServicePeriod)) - { - DBGPRINT(RT_DEBUG_TRACE,("Sending another trigger frame when More Data bit is set to 1\n")); + if ((pHeader->FC.MoreData) + && (pAd->CommonCfg.bInServicePeriod)) { + DBGPRINT(RT_DEBUG_TRACE, + ("Sending another trigger frame when More Data bit is set to 1\n")); } } - // Drop NULL, CF-ACK(no data), CF-POLL(no data), and CF-ACK+CF-POLL(no data) data frame - if ((pHeader->FC.SubType & 0x04)) // bit 2 : no DATA + if ((pHeader->FC.SubType & 0x04)) // bit 2 : no DATA { // release packet - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); + RELEASE_NDIS_PACKET(pAd, pRxPacket, + NDIS_STATUS_FAILURE); return; } + // Drop not my BSS frame (we can not only check the MyBss bit in RxD) - // Drop not my BSS frame (we can not only check the MyBss bit in RxD) - - if (INFRA_ON(pAd)) - { + if (INFRA_ON(pAd)) { // Infrastructure mode, check address 2 for BSSID - if (!RTMPEqualMemory(&pHeader->Addr2, &pAd->CommonCfg.Bssid, 6)) - { + if (!RTMPEqualMemory + (&pHeader->Addr2, &pAd->CommonCfg.Bssid, 6)) { // Receive frame not my BSSID - // release packet - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); + // release packet + RELEASE_NDIS_PACKET(pAd, pRxPacket, + NDIS_STATUS_FAILURE); return; } - } - else // Ad-Hoc mode or Not associated + } else // Ad-Hoc mode or Not associated { // Ad-Hoc mode, check address 3 for BSSID - if (!RTMPEqualMemory(&pHeader->Addr3, &pAd->CommonCfg.Bssid, 6)) - { + if (!RTMPEqualMemory + (&pHeader->Addr3, &pAd->CommonCfg.Bssid, 6)) { // Receive frame not my BSSID - // release packet - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); + // release packet + RELEASE_NDIS_PACKET(pAd, pRxPacket, + NDIS_STATUS_FAILURE); return; } } @@ -380,39 +431,35 @@ VOID STAHandleRxDataFrame( // // find pEntry // - if (pRxWI->WirelessCliID < MAX_LEN_OF_MAC_TABLE) - { + if (pRxWI->WirelessCliID < MAX_LEN_OF_MAC_TABLE) { pEntry = &pAd->MacTab.Content[pRxWI->WirelessCliID]; - } - else - { + } else { // 1. release packet if infra mode // 2. new a pEntry if ad-hoc mode - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); + RELEASE_NDIS_PACKET(pAd, pRxPacket, + NDIS_STATUS_FAILURE); return; } // infra or ad-hoc - if (INFRA_ON(pAd)) - { + if (INFRA_ON(pAd)) { RX_BLK_SET_FLAG(pRxBlk, fRX_INFRA); ASSERT(pRxWI->WirelessCliID == BSSID_WCID); } - // check Atheros Client - if ((pEntry->bIAmBadAtheros == FALSE) && (pRxD->AMPDU == 1) && (pHeader->FC.Retry )) - { + if ((pEntry->bIAmBadAtheros == FALSE) && (pRxD->AMPDU == 1) + && (pHeader->FC.Retry)) { pEntry->bIAmBadAtheros = TRUE; pAd->CommonCfg.IOTestParm.bCurrentAtheros = TRUE; pAd->CommonCfg.IOTestParm.bLastAtheros = TRUE; - if (!STA_AES_ON(pAd)) - { - AsicUpdateProtect(pAd, 8, ALLN_SETPROTECT, TRUE, FALSE); + if (!STA_AES_ON(pAd)) { + AsicUpdateProtect(pAd, 8, ALLN_SETPROTECT, TRUE, + FALSE); } } } - pRxBlk->pData = (UCHAR *)pHeader; + pRxBlk->pData = (UCHAR *) pHeader; // // update RxBlk->pData, DataSize @@ -426,48 +473,41 @@ VOID STAHandleRxDataFrame( } // 2. QOS - if (pHeader->FC.SubType & 0x08) - { + if (pHeader->FC.SubType & 0x08) { RX_BLK_SET_FLAG(pRxBlk, fRX_QOS); UserPriority = *(pRxBlk->pData) & 0x0f; // bit 7 in QoS Control field signals the HT A-MSDU format - if ((*pRxBlk->pData) & 0x80) - { + if ((*pRxBlk->pData) & 0x80) { RX_BLK_SET_FLAG(pRxBlk, fRX_AMSDU); } - // skip QOS contorl field pRxBlk->pData += 2; - pRxBlk->DataSize -=2; + pRxBlk->DataSize -= 2; } pRxBlk->UserPriority = UserPriority; /* check if need to resend PS Poll when received packet with MoreData = 1 */ - if ((pAd->StaCfg.Psm == PWR_SAVE) && (pHeader->FC.MoreData == 1)) - { + if ((pAd->StaCfg.Psm == PWR_SAVE) && (pHeader->FC.MoreData == 1)) { if ((((UserPriority == 0) || (UserPriority == 3)) && - pAd->CommonCfg.bAPSDAC_BE == 0) || - (((UserPriority == 1) || (UserPriority == 2)) && - pAd->CommonCfg.bAPSDAC_BK == 0) || - (((UserPriority == 4) || (UserPriority == 5)) && - pAd->CommonCfg.bAPSDAC_VI == 0) || - (((UserPriority == 6) || (UserPriority == 7)) && - pAd->CommonCfg.bAPSDAC_VO == 0)) - { + pAd->CommonCfg.bAPSDAC_BE == 0) || + (((UserPriority == 1) || (UserPriority == 2)) && + pAd->CommonCfg.bAPSDAC_BK == 0) || + (((UserPriority == 4) || (UserPriority == 5)) && + pAd->CommonCfg.bAPSDAC_VI == 0) || + (((UserPriority == 6) || (UserPriority == 7)) && + pAd->CommonCfg.bAPSDAC_VO == 0)) { /* non-UAPSD delivery-enabled AC */ RTMP_PS_POLL_ENQUEUE(pAd); } } - // 3. Order bit: A-Ralink or HTC+ - if (pHeader->FC.Order) - { + if (pHeader->FC.Order) { #ifdef AGGREGATION_SUPPORT - if ((pRxWI->PHYMODE <= MODE_OFDM) && (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED))) + if ((pRxWI->PHYMODE <= MODE_OFDM) + && (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED))) { RX_BLK_SET_FLAG(pRxBlk, fRX_ARALINK); - } - else + } else #endif // AGGREGATION_SUPPORT // { RX_BLK_SET_FLAG(pRxBlk, fRX_HTC); @@ -476,102 +516,93 @@ VOID STAHandleRxDataFrame( pRxBlk->DataSize -= 4; } } - // 4. skip HW padding - if (pRxD->L2PAD) - { + if (pRxD->L2PAD) { // just move pData pointer // because DataSize excluding HW padding RX_BLK_SET_FLAG(pRxBlk, fRX_PAD); pRxBlk->pData += 2; } - if (pRxD->BA) - { + if (pRxD->BA) { RX_BLK_SET_FLAG(pRxBlk, fRX_AMPDU); } - // // Case I Process Broadcast & Multicast data frame // - if (pRxD->Bcast || pRxD->Mcast) - { + if (pRxD->Bcast || pRxD->Mcast) { INC_COUNTER64(pAd->WlanCounters.MulticastReceivedFrameCount); // Drop Mcast/Bcast frame with fragment bit on - if (pHeader->FC.MoreFrag) - { + if (pHeader->FC.MoreFrag) { // release packet - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); + RELEASE_NDIS_PACKET(pAd, pRxPacket, + NDIS_STATUS_FAILURE); return; } - // Filter out Bcast frame which AP relayed for us - if (pHeader->FC.FrDs && MAC_ADDR_EQUAL(pHeader->Addr3, pAd->CurrentAddress)) - { + if (pHeader->FC.FrDs + && MAC_ADDR_EQUAL(pHeader->Addr3, pAd->CurrentAddress)) { // release packet - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); + RELEASE_NDIS_PACKET(pAd, pRxPacket, + NDIS_STATUS_FAILURE); return; } Indicate_Legacy_Packet(pAd, pRxBlk, FromWhichBSSID); return; - } - else if (pRxD->U2M) - { - pAd->LastRxRate = (USHORT)((pRxWI->MCS) + (pRxWI->BW <<7) + (pRxWI->ShortGI <<8)+ (pRxWI->PHYMODE <<14)) ; + } else if (pRxD->U2M) { + pAd->LastRxRate = + (USHORT) ((pRxWI->MCS) + (pRxWI->BW << 7) + + (pRxWI->ShortGI << 8) + (pRxWI->PHYMODE << 14)); - if (ADHOC_ON(pAd)) - { + if (ADHOC_ON(pAd)) { pEntry = MacTableLookup(pAd, pHeader->Addr2); if (pEntry) - Update_Rssi_Sample(pAd, &pEntry->RssiSample, pRxWI); + Update_Rssi_Sample(pAd, &pEntry->RssiSample, + pRxWI); } - Update_Rssi_Sample(pAd, &pAd->StaCfg.RssiSample, pRxWI); - pAd->StaCfg.LastSNR0 = (UCHAR)(pRxWI->SNR0); - pAd->StaCfg.LastSNR1 = (UCHAR)(pRxWI->SNR1); + pAd->StaCfg.LastSNR0 = (UCHAR) (pRxWI->SNR0); + pAd->StaCfg.LastSNR1 = (UCHAR) (pRxWI->SNR1); pAd->RalinkCounters.OneSecRxOkDataCnt++; + if (!((pHeader->Frag == 0) && (pHeader->FC.MoreFrag == 0))) { + // re-assemble the fragmented packets + // return complete frame (pRxPacket) or NULL + bFragment = TRUE; + pRxPacket = RTMPDeFragmentDataFrame(pAd, pRxBlk); + } - if (!((pHeader->Frag == 0) && (pHeader->FC.MoreFrag == 0))) - { - // re-assemble the fragmented packets - // return complete frame (pRxPacket) or NULL - bFragment = TRUE; - pRxPacket = RTMPDeFragmentDataFrame(pAd, pRxBlk); - } - - if (pRxPacket) - { + if (pRxPacket) { pEntry = &pAd->MacTab.Content[pRxWI->WirelessCliID]; - // process complete frame - if (bFragment && (pRxD->Decrypted) && (pEntry->WepStatus == Ndis802_11Encryption2Enabled)) - { + // process complete frame + if (bFragment && (pRxD->Decrypted) + && (pEntry->WepStatus == + Ndis802_11Encryption2Enabled)) { // Minus MIC length pRxBlk->DataSize -= 8; - // For TKIP frame, calculate the MIC value - if (STACheckTkipMICValue(pAd, pEntry, pRxBlk) == FALSE) - { - return; - } - } + // For TKIP frame, calculate the MIC value + if (STACheckTkipMICValue(pAd, pEntry, pRxBlk) == + FALSE) { + return; + } + } - STARxDataFrameAnnounce(pAd, pEntry, pRxBlk, FromWhichBSSID); + STARxDataFrameAnnounce(pAd, pEntry, pRxBlk, + FromWhichBSSID); + return; + } else { + // just return + // because RTMPDeFragmentDataFrame() will release rx packet, + // if packet is fragmented return; - } - else - { - // just return - // because RTMPDeFragmentDataFrame() will release rx packet, - // if packet is fragmented - return; - } + } } ASSERT(0); @@ -579,25 +610,20 @@ VOID STAHandleRxDataFrame( RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); } -VOID STAHandleRxMgmtFrame( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk) +VOID STAHandleRxMgmtFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) { - PRT28XX_RXD_STRUC pRxD = &(pRxBlk->RxD); - PRXWI_STRUC pRxWI = pRxBlk->pRxWI; - PHEADER_802_11 pHeader = pRxBlk->pHeader; - PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; - - do - { + PRT28XX_RXD_STRUC pRxD = &(pRxBlk->RxD); + PRXWI_STRUC pRxWI = pRxBlk->pRxWI; + PHEADER_802_11 pHeader = pRxBlk->pHeader; + PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; + do { /* check if need to resend PS Poll when received packet with MoreData = 1 */ - if ((pAd->StaCfg.Psm == PWR_SAVE) && (pHeader->FC.MoreData == 1)) - { + if ((pAd->StaCfg.Psm == PWR_SAVE) + && (pHeader->FC.MoreData == 1)) { /* for UAPSD, all management frames will be VO priority */ - if (pAd->CommonCfg.bAPSDAC_VO == 0) - { + if (pAd->CommonCfg.bAPSDAC_VO == 0) { /* non-UAPSD delivery-enabled AC */ RTMP_PS_POLL_ENQUEUE(pAd); } @@ -605,57 +631,54 @@ VOID STAHandleRxMgmtFrame( /* TODO: if MoreData == 0, station can go to sleep */ - // We should collect RSSI not only U2M data but also my beacon - if ((pHeader->FC.SubType == SUBTYPE_BEACON) && (MAC_ADDR_EQUAL(&pAd->CommonCfg.Bssid, &pHeader->Addr2)) - && (pAd->RxAnt.EvaluatePeriod == 0)) - { + if ((pHeader->FC.SubType == SUBTYPE_BEACON) + && (MAC_ADDR_EQUAL(&pAd->CommonCfg.Bssid, &pHeader->Addr2)) + && (pAd->RxAnt.EvaluatePeriod == 0)) { Update_Rssi_Sample(pAd, &pAd->StaCfg.RssiSample, pRxWI); - pAd->StaCfg.LastSNR0 = (UCHAR)(pRxWI->SNR0); - pAd->StaCfg.LastSNR1 = (UCHAR)(pRxWI->SNR1); + pAd->StaCfg.LastSNR0 = (UCHAR) (pRxWI->SNR0); + pAd->StaCfg.LastSNR1 = (UCHAR) (pRxWI->SNR1); } - // First check the size, it MUST not exceed the mlme queue size - if (pRxWI->MPDUtotalByteCount > MGMT_DMA_BUFFER_SIZE) - { + if (pRxWI->MPDUtotalByteCount > MGMT_DMA_BUFFER_SIZE) { DBGPRINT_ERR(("STAHandleRxMgmtFrame: frame too large, size = %d \n", pRxWI->MPDUtotalByteCount)); break; } - REPORT_MGMT_FRAME_TO_MLME(pAd, pRxWI->WirelessCliID, pHeader, pRxWI->MPDUtotalByteCount, - pRxWI->RSSI0, pRxWI->RSSI1, pRxWI->RSSI2, pRxD->PlcpSignal); + REPORT_MGMT_FRAME_TO_MLME(pAd, pRxWI->WirelessCliID, pHeader, + pRxWI->MPDUtotalByteCount, + pRxWI->RSSI0, pRxWI->RSSI1, + pRxWI->RSSI2, pRxD->PlcpSignal); } while (FALSE); RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_SUCCESS); } -VOID STAHandleRxControlFrame( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk) +VOID STAHandleRxControlFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) { - PRXWI_STRUC pRxWI = pRxBlk->pRxWI; - PHEADER_802_11 pHeader = pRxBlk->pHeader; - PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; - - switch (pHeader->FC.SubType) - { - case SUBTYPE_BLOCK_ACK_REQ: - { - CntlEnqueueForRecv(pAd, pRxWI->WirelessCliID, (pRxWI->MPDUtotalByteCount), (PFRAME_BA_REQ)pHeader); - } - break; - case SUBTYPE_BLOCK_ACK: - case SUBTYPE_ACK: - default: - break; + PRXWI_STRUC pRxWI = pRxBlk->pRxWI; + PHEADER_802_11 pHeader = pRxBlk->pHeader; + PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; + + switch (pHeader->FC.SubType) { + case SUBTYPE_BLOCK_ACK_REQ: + { + CntlEnqueueForRecv(pAd, pRxWI->WirelessCliID, + (pRxWI->MPDUtotalByteCount), + (PFRAME_BA_REQ) pHeader); + } + break; + case SUBTYPE_BLOCK_ACK: + case SUBTYPE_ACK: + default: + break; } RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); } - /* ======================================================================== @@ -675,45 +698,39 @@ VOID STAHandleRxControlFrame( Need to consider QOS DATA format when converting to 802.3 ======================================================================== */ -BOOLEAN STARxDoneInterruptHandle( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN argc) +BOOLEAN STARxDoneInterruptHandle(IN PRTMP_ADAPTER pAd, IN BOOLEAN argc) { - NDIS_STATUS Status; - UINT32 RxProcessed, RxPending; - BOOLEAN bReschedule = FALSE; - RT28XX_RXD_STRUC *pRxD; - UCHAR *pData; - PRXWI_STRUC pRxWI; - PNDIS_PACKET pRxPacket; - PHEADER_802_11 pHeader; - RX_BLK RxCell; + NDIS_STATUS Status; + UINT32 RxProcessed, RxPending; + BOOLEAN bReschedule = FALSE; + RT28XX_RXD_STRUC *pRxD; + UCHAR *pData; + PRXWI_STRUC pRxWI; + PNDIS_PACKET pRxPacket; + PHEADER_802_11 pHeader; + RX_BLK RxCell; RxProcessed = RxPending = 0; // process whole rx ring - while (1) - { + while (1) { if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF | - fRTMP_ADAPTER_RESET_IN_PROGRESS | - fRTMP_ADAPTER_HALT_IN_PROGRESS | - fRTMP_ADAPTER_NIC_NOT_EXIST) || - !RTMP_TEST_FLAG(pAd,fRTMP_ADAPTER_START_UP)) - { + fRTMP_ADAPTER_RESET_IN_PROGRESS | + fRTMP_ADAPTER_HALT_IN_PROGRESS | + fRTMP_ADAPTER_NIC_NOT_EXIST) || + !RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_START_UP)) { break; } - #ifdef RTMP_MAC_PCI - if (RxProcessed++ > MAX_RX_PROCESS_CNT) - { + if (RxProcessed++ > MAX_RX_PROCESS_CNT) { // need to reschedule rx handle bReschedule = TRUE; break; } #endif // RTMP_MAC_PCI // - RxProcessed ++; // test + RxProcessed++; // test // 1. allocate a new data packet into rx ring to replace received packet // then processing the received packet @@ -722,19 +739,19 @@ BOOLEAN STARxDoneInterruptHandle( // the rx packet must // a. be indicated to upper layer or // b. be released if it is discarded - pRxPacket = GetPacketFromRxRing(pAd, &(RxCell.RxD), &bReschedule, &RxPending); - if (pRxPacket == NULL) - { + pRxPacket = + GetPacketFromRxRing(pAd, &(RxCell.RxD), &bReschedule, + &RxPending); + if (pRxPacket == NULL) { // no more packet to process break; } - // get rx ring descriptor pRxD = &(RxCell.RxD); // get rx data buffer - pData = GET_OS_PKT_DATAPTR(pRxPacket); - pRxWI = (PRXWI_STRUC) pData; - pHeader = (PHEADER_802_11) (pData+RXWI_SIZE) ; + pData = GET_OS_PKT_DATAPTR(pRxPacket); + pRxWI = (PRXWI_STRUC) pData; + pHeader = (PHEADER_802_11) (pData + RXWI_SIZE); // build RxCell RxCell.pRxWI = pRxWI; @@ -745,18 +762,19 @@ BOOLEAN STARxDoneInterruptHandle( RxCell.Flags = 0; // Increase Total receive byte counter after real data received no mater any error or not - pAd->RalinkCounters.ReceivedByteCount += pRxWI->MPDUtotalByteCount; - pAd->RalinkCounters.OneSecReceivedByteCount += pRxWI->MPDUtotalByteCount; - pAd->RalinkCounters.RxCount ++; + pAd->RalinkCounters.ReceivedByteCount += + pRxWI->MPDUtotalByteCount; + pAd->RalinkCounters.OneSecReceivedByteCount += + pRxWI->MPDUtotalByteCount; + pAd->RalinkCounters.RxCount++; INC_COUNTER64(pAd->WlanCounters.ReceivedFragmentCount); if (pRxWI->MPDUtotalByteCount < 14) Status = NDIS_STATUS_FAILURE; - if (MONITOR_ON(pAd)) - { - send_monitor_packets(pAd, &RxCell); + if (MONITOR_ON(pAd)) { + send_monitor_packets(pAd, &RxCell); break; } @@ -766,40 +784,38 @@ BOOLEAN STARxDoneInterruptHandle( Status = RTMPCheckRxError(pAd, pHeader, pRxWI, pRxD); // Handle the received frame - if (Status == NDIS_STATUS_SUCCESS) - { - switch (pHeader->FC.Type) - { + if (Status == NDIS_STATUS_SUCCESS) { + switch (pHeader->FC.Type) { // CASE I, receive a DATA frame - case BTYPE_DATA: + case BTYPE_DATA: { // process DATA frame STAHandleRxDataFrame(pAd, &RxCell); } break; // CASE II, receive a MGMT frame - case BTYPE_MGMT: + case BTYPE_MGMT: { STAHandleRxMgmtFrame(pAd, &RxCell); } break; // CASE III. receive a CNTL frame - case BTYPE_CNTL: + case BTYPE_CNTL: { STAHandleRxControlFrame(pAd, &RxCell); } break; // discard other type - default: - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); - break; + default: + RELEASE_NDIS_PACKET(pAd, pRxPacket, + NDIS_STATUS_FAILURE); + break; } - } - else - { + } else { pAd->Counters8023.RxErrors++; // discard this frame - RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); + RELEASE_NDIS_PACKET(pAd, pRxPacket, + NDIS_STATUS_FAILURE); } } @@ -817,8 +833,7 @@ BOOLEAN STARxDoneInterruptHandle( ======================================================================== */ -VOID RTMPHandleTwakeupInterrupt( - IN PRTMP_ADAPTER pAd) +VOID RTMPHandleTwakeupInterrupt(IN PRTMP_ADAPTER pAd) { AsicForceWakeup(pAd, FALSE); } @@ -841,47 +856,39 @@ Note: You only can put OS-depened & STA related code in here. ======================================================================== */ -VOID STASendPackets( - IN NDIS_HANDLE MiniportAdapterContext, - IN PPNDIS_PACKET ppPacketArray, - IN UINT NumberOfPackets) +VOID STASendPackets(IN NDIS_HANDLE MiniportAdapterContext, + IN PPNDIS_PACKET ppPacketArray, IN UINT NumberOfPackets) { - UINT Index; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) MiniportAdapterContext; - PNDIS_PACKET pPacket; - BOOLEAN allowToSend = FALSE; - + UINT Index; + PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) MiniportAdapterContext; + PNDIS_PACKET pPacket; + BOOLEAN allowToSend = FALSE; - for (Index = 0; Index < NumberOfPackets; Index++) - { + for (Index = 0; Index < NumberOfPackets; Index++) { pPacket = ppPacketArray[Index]; - do - { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS) || - RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) - { + do { + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS) + || RTMP_TEST_FLAG(pAd, + fRTMP_ADAPTER_HALT_IN_PROGRESS) + || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) { // Drop send request since hardware is in reset state - break; - } - else if (!INFRA_ON(pAd) && !ADHOC_ON(pAd)) - { + break; + } else if (!INFRA_ON(pAd) && !ADHOC_ON(pAd)) { // Drop send request since there are no physical connection yet - break; - } - else - { + break; + } else { // Record that orignal packet source is from NDIS layer,so that // later on driver knows how to release this NDIS PACKET - RTMP_SET_PACKET_WCID(pPacket, 0); // this field is useless when in STA mode + RTMP_SET_PACKET_WCID(pPacket, 0); // this field is useless when in STA mode RTMP_SET_PACKET_SOURCE(pPacket, PKTSRC_NDIS); - NDIS_SET_PACKET_STATUS(pPacket, NDIS_STATUS_PENDING); + NDIS_SET_PACKET_STATUS(pPacket, + NDIS_STATUS_PENDING); pAd->RalinkCounters.PendingNdisPacketCount++; allowToSend = TRUE; } - } while(FALSE); + } while (FALSE); if (allowToSend == TRUE) STASendPacket(pAd, pPacket); @@ -894,7 +901,6 @@ VOID STASendPackets( } - /* ======================================================================== Routine Description: @@ -914,72 +920,64 @@ Note: You only can put OS-indepened & STA related code in here. ======================================================================== */ -NDIS_STATUS STASendPacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket) +NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) { - PACKET_INFO PacketInfo; - PUCHAR pSrcBufVA; - UINT SrcBufLen; - UINT AllowFragSize; - UCHAR NumberOfFrag; - UCHAR RTSRequired; - UCHAR QueIdx, UserPriority; + PACKET_INFO PacketInfo; + PUCHAR pSrcBufVA; + UINT SrcBufLen; + UINT AllowFragSize; + UCHAR NumberOfFrag; + UCHAR RTSRequired; + UCHAR QueIdx, UserPriority; MAC_TABLE_ENTRY *pEntry = NULL; - unsigned int IrqFlags; - UCHAR FlgIsIP = 0; - UCHAR Rate; + unsigned int IrqFlags; + UCHAR FlgIsIP = 0; + UCHAR Rate; // Prepare packet information structure for buffer descriptor // chained within a single NDIS packet. RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); - if (pSrcBufVA == NULL) - { - DBGPRINT(RT_DEBUG_ERROR,("STASendPacket --> pSrcBufVA == NULL !!!SrcBufLen=%x\n",SrcBufLen)); + if (pSrcBufVA == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("STASendPacket --> pSrcBufVA == NULL !!!SrcBufLen=%x\n", + SrcBufLen)); // Resourece is low, system did not allocate virtual address // return NDIS_STATUS_FAILURE directly to upper layer RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); return NDIS_STATUS_FAILURE; } - - if (SrcBufLen < 14) - { - DBGPRINT(RT_DEBUG_ERROR,("STASendPacket --> Ndis Packet buffer error !!!\n")); + if (SrcBufLen < 14) { + DBGPRINT(RT_DEBUG_ERROR, + ("STASendPacket --> Ndis Packet buffer error !!!\n")); RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); return (NDIS_STATUS_FAILURE); } - // In HT rate adhoc mode, A-MPDU is often used. So need to lookup BA Table and MAC Entry. // Note multicast packets in adhoc also use BSSID_WCID index. { - if(INFRA_ON(pAd)) - { - { - pEntry = &pAd->MacTab.Content[BSSID_WCID]; - RTMP_SET_PACKET_WCID(pPacket, BSSID_WCID); - Rate = pAd->CommonCfg.TxRate; - } - } - else if (ADHOC_ON(pAd)) - { - if (*pSrcBufVA & 0x01) + if (INFRA_ON(pAd)) { { + pEntry = &pAd->MacTab.Content[BSSID_WCID]; + RTMP_SET_PACKET_WCID(pPacket, BSSID_WCID); + Rate = pAd->CommonCfg.TxRate; + } + } else if (ADHOC_ON(pAd)) { + if (*pSrcBufVA & 0x01) { RTMP_SET_PACKET_WCID(pPacket, MCAST_WCID); pEntry = &pAd->MacTab.Content[MCAST_WCID]; - } - else - { + } else { pEntry = MacTableLookup(pAd, pSrcBufVA); } Rate = pAd->CommonCfg.TxRate; } } - if (!pEntry) - { - DBGPRINT(RT_DEBUG_ERROR,("STASendPacket->Cannot find pEntry(%2x:%2x:%2x:%2x:%2x:%2x) in MacTab!\n", PRINT_MAC(pSrcBufVA))); + if (!pEntry) { + DBGPRINT(RT_DEBUG_ERROR, + ("STASendPacket->Cannot find pEntry(%2x:%2x:%2x:%2x:%2x:%2x) in MacTab!\n", + PRINT_MAC(pSrcBufVA))); // Resourece is low, system did not allocate virtual address // return NDIS_STATUS_FAILURE directly to upper layer RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); @@ -987,44 +985,39 @@ NDIS_STATUS STASendPacket( } if (ADHOC_ON(pAd) - ) - { - RTMP_SET_PACKET_WCID(pPacket, (UCHAR)pEntry->Aid); + ) { + RTMP_SET_PACKET_WCID(pPacket, (UCHAR) pEntry->Aid); } - // // Check the Ethernet Frame type of this packet, and set the RTMP_SET_PACKET_SPECIFIC flags. - // Here we set the PACKET_SPECIFIC flags(LLC, VLAN, DHCP/ARP, EAPOL). + // Here we set the PACKET_SPECIFIC flags(LLC, VLAN, DHCP/ARP, EAPOL). RTMPCheckEtherType(pAd, pPacket); - - // // WPA 802.1x secured port control - drop all non-802.1x frame before port secured // if (((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) - || (pAd->StaCfg.IEEE8021X == TRUE) - ) - && ((pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED) || (pAd->StaCfg.MicErrCnt >= 2)) - && (RTMP_GET_PACKET_EAPOL(pPacket)== FALSE) - ) - { - DBGPRINT(RT_DEBUG_TRACE,("STASendPacket --> Drop packet before port secured !!!\n")); + (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || + (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || + (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) + || (pAd->StaCfg.IEEE8021X == TRUE) + ) + && ((pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED) + || (pAd->StaCfg.MicErrCnt >= 2)) + && (RTMP_GET_PACKET_EAPOL(pPacket) == FALSE) + ) { + DBGPRINT(RT_DEBUG_TRACE, + ("STASendPacket --> Drop packet before port secured !!!\n")); RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); return (NDIS_STATUS_FAILURE); } - // STEP 1. Decide number of fragments required to deliver this MSDU. - // The estimation here is not very accurate because difficult to - // take encryption overhead into consideration here. The result - // "NumberOfFrag" is then just used to pre-check if enough free - // TXD are available to hold this MSDU. - + // The estimation here is not very accurate because difficult to + // take encryption overhead into consideration here. The result + // "NumberOfFrag" is then just used to pre-check if enough free + // TXD are available to hold this MSDU. if (*pSrcBufVA & 0x01) // fragmentation not allowed on multicast & broadcast NumberOfFrag = 1; @@ -1032,10 +1025,10 @@ NDIS_STATUS STASendPacket( NumberOfFrag = 1; // Aggregation overwhelms fragmentation else if (CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_AMSDU_INUSED)) NumberOfFrag = 1; // Aggregation overwhelms fragmentation - else if ((pAd->StaCfg.HTPhyMode.field.MODE == MODE_HTMIX) || (pAd->StaCfg.HTPhyMode.field.MODE == MODE_HTGREENFIELD)) + else if ((pAd->StaCfg.HTPhyMode.field.MODE == MODE_HTMIX) + || (pAd->StaCfg.HTPhyMode.field.MODE == MODE_HTGREENFIELD)) NumberOfFrag = 1; // MIMO RATE overwhelms fragmentation - else - { + else { // The calculated "NumberOfFrag" is a rough estimation because of various // encryption/encapsulation overhead not taken into consideration. This number is just // used to make sure enough free TXD are available before fragmentation takes place. @@ -1045,11 +1038,15 @@ NDIS_STATUS STASendPacket( // resource, and the NDIS packet will be indicated NDIS_STATUS_FAILURE. This should // rarely happen and the penalty is just like a TX RETRY fail. Affordable. - AllowFragSize = (pAd->CommonCfg.FragmentThreshold) - LENGTH_802_11 - LENGTH_CRC; - NumberOfFrag = ((PacketInfo.TotalPacketLength - LENGTH_802_3 + LENGTH_802_1_H) / AllowFragSize) + 1; + AllowFragSize = + (pAd->CommonCfg.FragmentThreshold) - LENGTH_802_11 - + LENGTH_CRC; + NumberOfFrag = + ((PacketInfo.TotalPacketLength - LENGTH_802_3 + + LENGTH_802_1_H) / AllowFragSize) + 1; // To get accurate number of fragmentation, Minus 1 if the size just match to allowable fragment size - if (((PacketInfo.TotalPacketLength - LENGTH_802_3 + LENGTH_802_1_H) % AllowFragSize) == 0) - { + if (((PacketInfo.TotalPacketLength - LENGTH_802_3 + + LENGTH_802_1_H) % AllowFragSize) == 0) { NumberOfFrag--; } } @@ -1057,16 +1054,19 @@ NDIS_STATUS STASendPacket( // Save fragment number to Ndis packet reserved field RTMP_SET_PACKET_FRAGMENTS(pPacket, NumberOfFrag); - // STEP 2. Check the requirement of RTS: - // If multiple fragment required, RTS is required only for the first fragment - // if the fragment size large than RTS threshold + // If multiple fragment required, RTS is required only for the first fragment + // if the fragment size large than RTS threshold // For RT28xx, Let ASIC send RTS/CTS -// RTMP_SET_PACKET_RTS(pPacket, 0); +// RTMP_SET_PACKET_RTS(pPacket, 0); if (NumberOfFrag > 1) - RTSRequired = (pAd->CommonCfg.FragmentThreshold > pAd->CommonCfg.RtsThreshold) ? 1 : 0; + RTSRequired = + (pAd->CommonCfg.FragmentThreshold > + pAd->CommonCfg.RtsThreshold) ? 1 : 0; else - RTSRequired = (PacketInfo.TotalPacketLength > pAd->CommonCfg.RtsThreshold) ? 1 : 0; + RTSRequired = + (PacketInfo.TotalPacketLength > + pAd->CommonCfg.RtsThreshold) ? 1 : 0; // Save RTS requirement to Ndis packet reserved field RTMP_SET_PACKET_RTS(pPacket, RTSRequired); @@ -1076,32 +1076,33 @@ NDIS_STATUS STASendPacket( // STEP 3. Traffic classification. outcome = // UserPriority = 0; - QueIdx = QID_AC_BE; + QueIdx = QID_AC_BE; if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && - CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_WMM_CAPABLE)) - { + CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_WMM_CAPABLE)) { USHORT Protocol; - UCHAR LlcSnapLen = 0, Byte0, Byte1; - do - { + UCHAR LlcSnapLen = 0, Byte0, Byte1; + do { // get Ethernet protocol field - Protocol = (USHORT)((pSrcBufVA[12] << 8) + pSrcBufVA[13]); - if (Protocol <= 1500) - { + Protocol = + (USHORT) ((pSrcBufVA[12] << 8) + pSrcBufVA[13]); + if (Protocol <= 1500) { // get Ethernet protocol field from LLC/SNAP - if (Sniff2BytesFromNdisBuffer(PacketInfo.pFirstBuffer, LENGTH_802_3 + 6, &Byte0, &Byte1) != NDIS_STATUS_SUCCESS) + if (Sniff2BytesFromNdisBuffer + (PacketInfo.pFirstBuffer, LENGTH_802_3 + 6, + &Byte0, &Byte1) != NDIS_STATUS_SUCCESS) break; - Protocol = (USHORT)((Byte0 << 8) + Byte1); + Protocol = (USHORT) ((Byte0 << 8) + Byte1); LlcSnapLen = 8; } - // always AC_BE for non-IP packet if (Protocol != 0x0800) break; // get IP header - if (Sniff2BytesFromNdisBuffer(PacketInfo.pFirstBuffer, LENGTH_802_3 + LlcSnapLen, &Byte0, &Byte1) != NDIS_STATUS_SUCCESS) + if (Sniff2BytesFromNdisBuffer + (PacketInfo.pFirstBuffer, LENGTH_802_3 + LlcSnapLen, + &Byte0, &Byte1) != NDIS_STATUS_SUCCESS) break; // return AC_BE if packet is not IPv4 @@ -1115,61 +1116,56 @@ NDIS_STATUS STASendPacket( // TODO: have to check ACM bit. apply TSPEC if ACM is ON // TODO: downgrade UP & QueIdx before passing ACM /* - Under WMM ACM control, we dont need to check the bit; - Or when a TSPEC is built for VO but we will change to issue - BA session for BE here, so we will not use BA to send VO packets. - */ - if (pAd->CommonCfg.APEdcaParm.bACM[QueIdx]) - { + Under WMM ACM control, we dont need to check the bit; + Or when a TSPEC is built for VO but we will change to issue + BA session for BE here, so we will not use BA to send VO packets. + */ + if (pAd->CommonCfg.APEdcaParm.bACM[QueIdx]) { UserPriority = 0; - QueIdx = QID_AC_BE; + QueIdx = QID_AC_BE; } } while (FALSE); } RTMP_SET_PACKET_UP(pPacket, UserPriority); - - // Make sure SendTxWait queue resource won't be used by other threads RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); - if (pAd->TxSwQueue[QueIdx].Number >= MAX_PACKETS_IN_QUEUE) - { + if (pAd->TxSwQueue[QueIdx].Number >= MAX_PACKETS_IN_QUEUE) { RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); return NDIS_STATUS_FAILURE; - } - else - { - InsertTailQueueAc(pAd, pEntry, &pAd->TxSwQueue[QueIdx], PACKET_TO_QUEUE_ENTRY(pPacket)); + } else { + InsertTailQueueAc(pAd, pEntry, &pAd->TxSwQueue[QueIdx], + PACKET_TO_QUEUE_ENTRY(pPacket)); } RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); - if ((pAd->CommonCfg.BACapability.field.AutoBA == TRUE)&& - IS_HT_STA(pEntry)) - { - //PMAC_TABLE_ENTRY pMacEntry = &pAd->MacTab.Content[BSSID_WCID]; - if (((pEntry->TXBAbitmap & (1<BADeclineBitmap & (1<PortSecured == WPA_802_1X_PORT_SECURED) - // For IOT compatibility, if - // 1. It is Ralink chip or - // 2. It is OPEN or AES mode, - // then BA session can be bulit. - && ((pEntry->ValidAsCLI && pAd->MlmeAux.APRalinkIe != 0x0) || - (pEntry->WepStatus != Ndis802_11WEPEnabled && pEntry->WepStatus != Ndis802_11Encryption2Enabled)) - ) - { - BAOriSessionSetUp(pAd, pEntry, UserPriority, 0, 10, FALSE); + if ((pAd->CommonCfg.BACapability.field.AutoBA == TRUE) && + IS_HT_STA(pEntry)) { + //PMAC_TABLE_ENTRY pMacEntry = &pAd->MacTab.Content[BSSID_WCID]; + if (((pEntry->TXBAbitmap & (1 << UserPriority)) == 0) && + ((pEntry->BADeclineBitmap & (1 << UserPriority)) == 0) && + (pEntry->PortSecured == WPA_802_1X_PORT_SECURED) + // For IOT compatibility, if + // 1. It is Ralink chip or + // 2. It is OPEN or AES mode, + // then BA session can be bulit. + && ((pEntry->ValidAsCLI && pAd->MlmeAux.APRalinkIe != 0x0) + || (pEntry->WepStatus != Ndis802_11WEPEnabled + && pEntry->WepStatus != + Ndis802_11Encryption2Enabled)) + ) { + BAOriSessionSetUp(pAd, pEntry, UserPriority, 0, 10, + FALSE); } } - pAd->RalinkCounters.OneSecOsTxCount[QueIdx]++; // TODO: for debug only. to be removed + pAd->RalinkCounters.OneSecOsTxCount[QueIdx]++; // TODO: for debug only. to be removed return NDIS_STATUS_SUCCESS; } - /* ======================================================================== @@ -1193,45 +1189,52 @@ NDIS_STATUS STASendPacket( ======================================================================== */ #ifdef RTMP_MAC_PCI -NDIS_STATUS RTMPFreeTXDRequest( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN UCHAR NumberRequired, - IN PUCHAR FreeNumberIs) +NDIS_STATUS RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, + IN UCHAR NumberRequired, IN PUCHAR FreeNumberIs) { - ULONG FreeNumber = 0; - NDIS_STATUS Status = NDIS_STATUS_FAILURE; - - switch (QueIdx) - { - case QID_AC_BK: - case QID_AC_BE: - case QID_AC_VI: - case QID_AC_VO: - if (pAd->TxRing[QueIdx].TxSwFreeIdx > pAd->TxRing[QueIdx].TxCpuIdx) - FreeNumber = pAd->TxRing[QueIdx].TxSwFreeIdx - pAd->TxRing[QueIdx].TxCpuIdx - 1; - else - FreeNumber = pAd->TxRing[QueIdx].TxSwFreeIdx + TX_RING_SIZE - pAd->TxRing[QueIdx].TxCpuIdx - 1; - - if (FreeNumber >= NumberRequired) - Status = NDIS_STATUS_SUCCESS; - break; - - case QID_MGMT: - if (pAd->MgmtRing.TxSwFreeIdx > pAd->MgmtRing.TxCpuIdx) - FreeNumber = pAd->MgmtRing.TxSwFreeIdx - pAd->MgmtRing.TxCpuIdx - 1; - else - FreeNumber = pAd->MgmtRing.TxSwFreeIdx + MGMT_RING_SIZE - pAd->MgmtRing.TxCpuIdx - 1; - - if (FreeNumber >= NumberRequired) - Status = NDIS_STATUS_SUCCESS; - break; - - default: - DBGPRINT(RT_DEBUG_ERROR,("RTMPFreeTXDRequest::Invalid QueIdx(=%d)\n", QueIdx)); - break; + ULONG FreeNumber = 0; + NDIS_STATUS Status = NDIS_STATUS_FAILURE; + + switch (QueIdx) { + case QID_AC_BK: + case QID_AC_BE: + case QID_AC_VI: + case QID_AC_VO: + if (pAd->TxRing[QueIdx].TxSwFreeIdx > + pAd->TxRing[QueIdx].TxCpuIdx) + FreeNumber = + pAd->TxRing[QueIdx].TxSwFreeIdx - + pAd->TxRing[QueIdx].TxCpuIdx - 1; + else + FreeNumber = + pAd->TxRing[QueIdx].TxSwFreeIdx + TX_RING_SIZE - + pAd->TxRing[QueIdx].TxCpuIdx - 1; + + if (FreeNumber >= NumberRequired) + Status = NDIS_STATUS_SUCCESS; + break; + + case QID_MGMT: + if (pAd->MgmtRing.TxSwFreeIdx > pAd->MgmtRing.TxCpuIdx) + FreeNumber = + pAd->MgmtRing.TxSwFreeIdx - pAd->MgmtRing.TxCpuIdx - + 1; + else + FreeNumber = + pAd->MgmtRing.TxSwFreeIdx + MGMT_RING_SIZE - + pAd->MgmtRing.TxCpuIdx - 1; + + if (FreeNumber >= NumberRequired) + Status = NDIS_STATUS_SUCCESS; + break; + + default: + DBGPRINT(RT_DEBUG_ERROR, + ("RTMPFreeTXDRequest::Invalid QueIdx(=%d)\n", QueIdx)); + break; } - *FreeNumberIs = (UCHAR)FreeNumber; + *FreeNumberIs = (UCHAR) FreeNumber; return (Status); } @@ -1241,76 +1244,69 @@ NDIS_STATUS RTMPFreeTXDRequest( Actually, this function used to check if the TxHardware Queue still has frame need to send. If no frame need to send, go to sleep, else, still wake up. */ -NDIS_STATUS RTMPFreeTXDRequest( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN UCHAR NumberRequired, - IN PUCHAR FreeNumberIs) +NDIS_STATUS RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, + IN UCHAR NumberRequired, IN PUCHAR FreeNumberIs) { - //ULONG FreeNumber = 0; - NDIS_STATUS Status = NDIS_STATUS_FAILURE; - unsigned long IrqFlags; - HT_TX_CONTEXT *pHTTXContext; - - switch (QueIdx) - { - case QID_AC_BK: - case QID_AC_BE: - case QID_AC_VI: - case QID_AC_VO: - { - pHTTXContext = &pAd->TxContext[QueIdx]; - RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); - if ((pHTTXContext->CurWritePosition != pHTTXContext->ENextBulkOutPosition) || - (pHTTXContext->IRPPending == TRUE)) - { - Status = NDIS_STATUS_FAILURE; - } - else - { - Status = NDIS_STATUS_SUCCESS; - } - RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); - } - break; - case QID_MGMT: - if (pAd->MgmtRing.TxSwFreeIdx != MGMT_RING_SIZE) + //ULONG FreeNumber = 0; + NDIS_STATUS Status = NDIS_STATUS_FAILURE; + unsigned long IrqFlags; + HT_TX_CONTEXT *pHTTXContext; + + switch (QueIdx) { + case QID_AC_BK: + case QID_AC_BE: + case QID_AC_VI: + case QID_AC_VO: + { + pHTTXContext = &pAd->TxContext[QueIdx]; + RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[QueIdx], + IrqFlags); + if ((pHTTXContext->CurWritePosition != + pHTTXContext->ENextBulkOutPosition) + || (pHTTXContext->IRPPending == TRUE)) { Status = NDIS_STATUS_FAILURE; - else + } else { Status = NDIS_STATUS_SUCCESS; - break; - default: - DBGPRINT(RT_DEBUG_ERROR,("RTMPFreeTXDRequest::Invalid QueIdx(=%d)\n", QueIdx)); - break; + } + RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], + IrqFlags); + } + break; + case QID_MGMT: + if (pAd->MgmtRing.TxSwFreeIdx != MGMT_RING_SIZE) + Status = NDIS_STATUS_FAILURE; + else + Status = NDIS_STATUS_SUCCESS; + break; + default: + DBGPRINT(RT_DEBUG_ERROR, + ("RTMPFreeTXDRequest::Invalid QueIdx(=%d)\n", QueIdx)); + break; } return (Status); } #endif // RTMP_MAC_USB // -VOID RTMPSendDisassociationFrame( - IN PRTMP_ADAPTER pAd) +VOID RTMPSendDisassociationFrame(IN PRTMP_ADAPTER pAd) { } -VOID RTMPSendNullFrame( - IN PRTMP_ADAPTER pAd, - IN UCHAR TxRate, - IN BOOLEAN bQosNull) +VOID RTMPSendNullFrame(IN PRTMP_ADAPTER pAd, + IN UCHAR TxRate, IN BOOLEAN bQosNull) { - UCHAR NullFrame[48]; - ULONG Length; - PHEADER_802_11 pHeader_802_11; - - // WPA 802.1x secured port control - if (((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || - (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) - || (pAd->StaCfg.IEEE8021X == TRUE) - ) && - (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED)) - { + UCHAR NullFrame[48]; + ULONG Length; + PHEADER_802_11 pHeader_802_11; + + // WPA 802.1x secured port control + if (((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || + (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || + (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || + (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) + || (pAd->StaCfg.IEEE8021X == TRUE) + ) && (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED)) { return; } @@ -1326,28 +1322,26 @@ VOID RTMPSendNullFrame( COPY_MAC_ADDR(pHeader_802_11->Addr2, pAd->CurrentAddress); COPY_MAC_ADDR(pHeader_802_11->Addr3, pAd->CommonCfg.Bssid); - if (pAd->CommonCfg.bAPSDForcePowerSave) - { + if (pAd->CommonCfg.bAPSDForcePowerSave) { pHeader_802_11->FC.PwrMgmt = PWR_SAVE; + } else { + pHeader_802_11->FC.PwrMgmt = + (pAd->StaCfg.Psm == PWR_SAVE) ? 1 : 0; } - else - { - pHeader_802_11->FC.PwrMgmt = (pAd->StaCfg.Psm == PWR_SAVE) ? 1: 0; - } - pHeader_802_11->Duration = pAd->CommonCfg.Dsifs + RTMPCalcDuration(pAd, TxRate, 14); + pHeader_802_11->Duration = + pAd->CommonCfg.Dsifs + RTMPCalcDuration(pAd, TxRate, 14); pAd->Sequence++; pHeader_802_11->Sequence = pAd->Sequence; // Prepare QosNull function frame - if (bQosNull) - { + if (bQosNull) { pHeader_802_11->FC.SubType = SUBTYPE_QOS_NULL; // copy QOS control bytes - NullFrame[Length] = 0; - NullFrame[Length+1] = 0; - Length += 2;// if pad with 2 bytes for alignment, APSD will fail + NullFrame[Length] = 0; + NullFrame[Length + 1] = 0; + Length += 2; // if pad with 2 bytes for alignment, APSD will fail } HAL_KickOutNullFrameTx(pAd, 0, NullFrame, Length); @@ -1355,68 +1349,57 @@ VOID RTMPSendNullFrame( } // IRQL = DISPATCH_LEVEL -VOID RTMPSendRTSFrame( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN unsigned int NextMpduSize, - IN UCHAR TxRate, - IN UCHAR RTSRate, - IN USHORT AckDuration, - IN UCHAR QueIdx, - IN UCHAR FrameGap) +VOID RTMPSendRTSFrame(IN PRTMP_ADAPTER pAd, + IN PUCHAR pDA, + IN unsigned int NextMpduSize, + IN UCHAR TxRate, + IN UCHAR RTSRate, + IN USHORT AckDuration, IN UCHAR QueIdx, IN UCHAR FrameGap) { } - - // -------------------------------------------------------- // FIND ENCRYPT KEY AND DECIDE CIPHER ALGORITHM -// Find the WPA key, either Group or Pairwise Key -// LEAP + TKIP also use WPA key. +// Find the WPA key, either Group or Pairwise Key +// LEAP + TKIP also use WPA key. // -------------------------------------------------------- // Decide WEP bit and cipher suite to be used. Same cipher suite should be used for whole fragment burst // In Cisco CCX 2.0 Leap Authentication -// WepStatus is Ndis802_11Encryption1Enabled but the key will use PairwiseKey -// Instead of the SharedKey, SharedKey Length may be Zero. -VOID STAFindCipherAlgorithm( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk) +// WepStatus is Ndis802_11Encryption1Enabled but the key will use PairwiseKey +// Instead of the SharedKey, SharedKey Length may be Zero. +VOID STAFindCipherAlgorithm(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) { - NDIS_802_11_ENCRYPTION_STATUS Cipher; // To indicate cipher used for this packet - UCHAR CipherAlg = CIPHER_NONE; // cipher alogrithm - UCHAR KeyIdx = 0xff; - PUCHAR pSrcBufVA; - PCIPHER_KEY pKey = NULL; + NDIS_802_11_ENCRYPTION_STATUS Cipher; // To indicate cipher used for this packet + UCHAR CipherAlg = CIPHER_NONE; // cipher alogrithm + UCHAR KeyIdx = 0xff; + PUCHAR pSrcBufVA; + PCIPHER_KEY pKey = NULL; pSrcBufVA = GET_OS_PKT_DATAPTR(pTxBlk->pPacket); { - // Select Cipher - if ((*pSrcBufVA & 0x01) && (ADHOC_ON(pAd))) - Cipher = pAd->StaCfg.GroupCipher; // Cipher for Multicast or Broadcast - else - Cipher = pAd->StaCfg.PairCipher; // Cipher for Unicast + // Select Cipher + if ((*pSrcBufVA & 0x01) && (ADHOC_ON(pAd))) + Cipher = pAd->StaCfg.GroupCipher; // Cipher for Multicast or Broadcast + else + Cipher = pAd->StaCfg.PairCipher; // Cipher for Unicast - if (RTMP_GET_PACKET_EAPOL(pTxBlk->pPacket)) - { - ASSERT(pAd->SharedKey[BSS0][0].CipherAlg <= CIPHER_CKIP128); + if (RTMP_GET_PACKET_EAPOL(pTxBlk->pPacket)) { + ASSERT(pAd->SharedKey[BSS0][0].CipherAlg <= + CIPHER_CKIP128); // 4-way handshaking frame must be clear - if (!(TX_BLK_TEST_FLAG(pTxBlk, fTX_bClearEAPFrame)) && (pAd->SharedKey[BSS0][0].CipherAlg) && - (pAd->SharedKey[BSS0][0].KeyLen)) - { + if (!(TX_BLK_TEST_FLAG(pTxBlk, fTX_bClearEAPFrame)) + && (pAd->SharedKey[BSS0][0].CipherAlg) + && (pAd->SharedKey[BSS0][0].KeyLen)) { CipherAlg = pAd->SharedKey[BSS0][0].CipherAlg; KeyIdx = 0; } - } - else if (Cipher == Ndis802_11Encryption1Enabled) - { - KeyIdx = pAd->StaCfg.DefaultKeyId; - } - else if ((Cipher == Ndis802_11Encryption2Enabled) || - (Cipher == Ndis802_11Encryption3Enabled)) - { - if ((*pSrcBufVA & 0x01) && (ADHOC_ON(pAd))) // multicast + } else if (Cipher == Ndis802_11Encryption1Enabled) { + KeyIdx = pAd->StaCfg.DefaultKeyId; + } else if ((Cipher == Ndis802_11Encryption2Enabled) || + (Cipher == Ndis802_11Encryption3Enabled)) { + if ((*pSrcBufVA & 0x01) && (ADHOC_ON(pAd))) // multicast KeyIdx = pAd->StaCfg.DefaultKeyId; else if (pAd->SharedKey[BSS0][0].KeyLen) KeyIdx = 0; @@ -1426,15 +1409,16 @@ VOID STAFindCipherAlgorithm( if (KeyIdx == 0xff) CipherAlg = CIPHER_NONE; - else if ((Cipher == Ndis802_11EncryptionDisabled) || (pAd->SharedKey[BSS0][KeyIdx].KeyLen == 0)) + else if ((Cipher == Ndis802_11EncryptionDisabled) + || (pAd->SharedKey[BSS0][KeyIdx].KeyLen == 0)) CipherAlg = CIPHER_NONE; - else if ( pAd->StaCfg.WpaSupplicantUP && - (Cipher == Ndis802_11Encryption1Enabled) && - (pAd->StaCfg.IEEE8021X == TRUE) && - (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED)) - CipherAlg = CIPHER_NONE; - else - { + else if (pAd->StaCfg.WpaSupplicantUP && + (Cipher == Ndis802_11Encryption1Enabled) && + (pAd->StaCfg.IEEE8021X == TRUE) && + (pAd->StaCfg.PortSecured == + WPA_802_1X_PORT_NOT_SECURED)) + CipherAlg = CIPHER_NONE; + else { //Header_802_11.FC.Wep = 1; CipherAlg = pAd->SharedKey[BSS0][KeyIdx].CipherAlg; pKey = &pAd->SharedKey[BSS0][KeyIdx]; @@ -1445,12 +1429,9 @@ VOID STAFindCipherAlgorithm( pTxBlk->pKey = pKey; } - -VOID STABuildCommon802_11Header( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk) +VOID STABuildCommon802_11Header(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) { - HEADER_802_11 *pHeader_802_11; + HEADER_802_11 *pHeader_802_11; // // MAKE A COMMON 802.11 HEADER @@ -1459,33 +1440,36 @@ VOID STABuildCommon802_11Header( // normal wlan header size : 24 octets pTxBlk->MpduHeaderLen = sizeof(HEADER_802_11); - pHeader_802_11 = (HEADER_802_11 *) &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; + pHeader_802_11 = + (HEADER_802_11 *) & pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; NdisZeroMemory(pHeader_802_11, sizeof(HEADER_802_11)); pHeader_802_11->FC.FrDs = 0; pHeader_802_11->FC.Type = BTYPE_DATA; - pHeader_802_11->FC.SubType = ((TX_BLK_TEST_FLAG(pTxBlk, fTX_bWMM)) ? SUBTYPE_QDATA : SUBTYPE_DATA); - - if (pTxBlk->pMacEntry) - { - if (TX_BLK_TEST_FLAG(pTxBlk, fTX_bForceNonQoS)) - { - pHeader_802_11->Sequence = pTxBlk->pMacEntry->NonQosDataSeq; - pTxBlk->pMacEntry->NonQosDataSeq = (pTxBlk->pMacEntry->NonQosDataSeq+1) & MAXSEQ; - } - else - { + pHeader_802_11->FC.SubType = + ((TX_BLK_TEST_FLAG(pTxBlk, fTX_bWMM)) ? SUBTYPE_QDATA : + SUBTYPE_DATA); + + if (pTxBlk->pMacEntry) { + if (TX_BLK_TEST_FLAG(pTxBlk, fTX_bForceNonQoS)) { + pHeader_802_11->Sequence = + pTxBlk->pMacEntry->NonQosDataSeq; + pTxBlk->pMacEntry->NonQosDataSeq = + (pTxBlk->pMacEntry->NonQosDataSeq + 1) & MAXSEQ; + } else { { - pHeader_802_11->Sequence = pTxBlk->pMacEntry->TxSeq[pTxBlk->UserPriority]; - pTxBlk->pMacEntry->TxSeq[pTxBlk->UserPriority] = (pTxBlk->pMacEntry->TxSeq[pTxBlk->UserPriority]+1) & MAXSEQ; - } - } - } - else - { + pHeader_802_11->Sequence = + pTxBlk->pMacEntry->TxSeq[pTxBlk-> + UserPriority]; + pTxBlk->pMacEntry->TxSeq[pTxBlk->UserPriority] = + (pTxBlk->pMacEntry-> + TxSeq[pTxBlk->UserPriority] + 1) & MAXSEQ; + } + } + } else { pHeader_802_11->Sequence = pAd->Sequence; - pAd->Sequence = (pAd->Sequence+1) & MAXSEQ; // next sequence + pAd->Sequence = (pAd->Sequence + 1) & MAXSEQ; // next sequence } pHeader_802_11->Frag = 0; @@ -1493,20 +1477,23 @@ VOID STABuildCommon802_11Header( pHeader_802_11->FC.MoreData = TX_BLK_TEST_FLAG(pTxBlk, fTX_bMoreData); { - if (INFRA_ON(pAd)) - { + if (INFRA_ON(pAd)) { { - COPY_MAC_ADDR(pHeader_802_11->Addr1, pAd->CommonCfg.Bssid); - COPY_MAC_ADDR(pHeader_802_11->Addr2, pAd->CurrentAddress); - COPY_MAC_ADDR(pHeader_802_11->Addr3, pTxBlk->pSrcBufHeader); - pHeader_802_11->FC.ToDs = 1; - } - } - else if (ADHOC_ON(pAd)) - { - COPY_MAC_ADDR(pHeader_802_11->Addr1, pTxBlk->pSrcBufHeader); - COPY_MAC_ADDR(pHeader_802_11->Addr2, pAd->CurrentAddress); - COPY_MAC_ADDR(pHeader_802_11->Addr3, pAd->CommonCfg.Bssid); + COPY_MAC_ADDR(pHeader_802_11->Addr1, + pAd->CommonCfg.Bssid); + COPY_MAC_ADDR(pHeader_802_11->Addr2, + pAd->CurrentAddress); + COPY_MAC_ADDR(pHeader_802_11->Addr3, + pTxBlk->pSrcBufHeader); + pHeader_802_11->FC.ToDs = 1; + } + } else if (ADHOC_ON(pAd)) { + COPY_MAC_ADDR(pHeader_802_11->Addr1, + pTxBlk->pSrcBufHeader); + COPY_MAC_ADDR(pHeader_802_11->Addr2, + pAd->CurrentAddress); + COPY_MAC_ADDR(pHeader_802_11->Addr3, + pAd->CommonCfg.Bssid); pHeader_802_11->FC.ToDs = 0; } } @@ -1518,20 +1505,18 @@ VOID STABuildCommon802_11Header( // STEP 2. MAKE A COMMON 802.11 HEADER SHARED BY ENTIRE FRAGMENT BURST. Fill sequence later. // ----------------------------------------------------------------- if (pAd->CommonCfg.bAPSDForcePowerSave) - pHeader_802_11->FC.PwrMgmt = PWR_SAVE; + pHeader_802_11->FC.PwrMgmt = PWR_SAVE; else - pHeader_802_11->FC.PwrMgmt = (pAd->StaCfg.Psm == PWR_SAVE); + pHeader_802_11->FC.PwrMgmt = (pAd->StaCfg.Psm == PWR_SAVE); } -VOID STABuildCache802_11Header( - IN RTMP_ADAPTER *pAd, - IN TX_BLK *pTxBlk, - IN UCHAR *pHeader) +VOID STABuildCache802_11Header(IN RTMP_ADAPTER * pAd, + IN TX_BLK * pTxBlk, IN UCHAR * pHeader) { - MAC_TABLE_ENTRY *pMacEntry; - PHEADER_802_11 pHeader80211; + MAC_TABLE_ENTRY *pMacEntry; + PHEADER_802_11 pHeader80211; - pHeader80211 = (PHEADER_802_11)pHeader; + pHeader80211 = (PHEADER_802_11) pHeader; pMacEntry = pTxBlk->pMacEntry; // @@ -1546,7 +1531,8 @@ VOID STABuildCache802_11Header( // Sequence pHeader80211->Sequence = pMacEntry->TxSeq[pTxBlk->UserPriority]; - pMacEntry->TxSeq[pTxBlk->UserPriority] = (pMacEntry->TxSeq[pTxBlk->UserPriority]+1) & MAXSEQ; + pMacEntry->TxSeq[pTxBlk->UserPriority] = + (pMacEntry->TxSeq[pTxBlk->UserPriority] + 1) & MAXSEQ; { // Check if the frame can be sent through DLS direct link interface @@ -1554,34 +1540,34 @@ VOID STABuildCache802_11Header( // The addr3 of normal packet send from DS is Dest Mac address. if (ADHOC_ON(pAd)) - COPY_MAC_ADDR(pHeader80211->Addr3, pAd->CommonCfg.Bssid); + COPY_MAC_ADDR(pHeader80211->Addr3, + pAd->CommonCfg.Bssid); else - COPY_MAC_ADDR(pHeader80211->Addr3, pTxBlk->pSrcBufHeader); + COPY_MAC_ADDR(pHeader80211->Addr3, + pTxBlk->pSrcBufHeader); } // ----------------------------------------------------------------- // STEP 2. MAKE A COMMON 802.11 HEADER SHARED BY ENTIRE FRAGMENT BURST. Fill sequence later. // ----------------------------------------------------------------- if (pAd->CommonCfg.bAPSDForcePowerSave) - pHeader80211->FC.PwrMgmt = PWR_SAVE; + pHeader80211->FC.PwrMgmt = PWR_SAVE; else - pHeader80211->FC.PwrMgmt = (pAd->StaCfg.Psm == PWR_SAVE); + pHeader80211->FC.PwrMgmt = (pAd->StaCfg.Psm == PWR_SAVE); } -static inline PUCHAR STA_Build_ARalink_Frame_Header( - IN RTMP_ADAPTER *pAd, - IN TX_BLK *pTxBlk) +static inline PUCHAR STA_Build_ARalink_Frame_Header(IN RTMP_ADAPTER * pAd, + IN TX_BLK * pTxBlk) { - PUCHAR pHeaderBufPtr; - HEADER_802_11 *pHeader_802_11; - PNDIS_PACKET pNextPacket; - UINT32 nextBufLen; - PQUEUE_ENTRY pQEntry; + PUCHAR pHeaderBufPtr; + HEADER_802_11 *pHeader_802_11; + PNDIS_PACKET pNextPacket; + UINT32 nextBufLen; + PQUEUE_ENTRY pQEntry; STAFindCipherAlgorithm(pAd, pTxBlk); STABuildCommon802_11Header(pAd, pTxBlk); - pHeaderBufPtr = &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; pHeader_802_11 = (HEADER_802_11 *) pHeaderBufPtr; @@ -1591,22 +1577,20 @@ static inline PUCHAR STA_Build_ARalink_Frame_Header( // skip common header pHeaderBufPtr += pTxBlk->MpduHeaderLen; - if (TX_BLK_TEST_FLAG(pTxBlk, fTX_bWMM)) - { + if (TX_BLK_TEST_FLAG(pTxBlk, fTX_bWMM)) { // // build QOS Control bytes // *pHeaderBufPtr = (pTxBlk->UserPriority & 0x0F); - *(pHeaderBufPtr+1) = 0; - pHeaderBufPtr +=2; + *(pHeaderBufPtr + 1) = 0; + pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += 2; } - // padding at front of LLC header. LLC header should at 4-bytes aligment. - pTxBlk->HdrPadLen = (ULONG)pHeaderBufPtr; - pHeaderBufPtr = (PUCHAR)ROUND_UP(pHeaderBufPtr, 4); - pTxBlk->HdrPadLen = (ULONG)(pHeaderBufPtr - pTxBlk->HdrPadLen); + pTxBlk->HdrPadLen = (ULONG) pHeaderBufPtr; + pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); + pTxBlk->HdrPadLen = (ULONG) (pHeaderBufPtr - pTxBlk->HdrPadLen); // For RA Aggregation, // put the 2nd MSDU length(extra 2-byte field) after QOS_CONTROL in little endian format @@ -1616,8 +1600,8 @@ static inline PUCHAR STA_Build_ARalink_Frame_Header( if (RTMP_GET_PACKET_VLAN(pNextPacket)) nextBufLen -= LENGTH_802_1Q; - *pHeaderBufPtr = (UCHAR)nextBufLen & 0xff; - *(pHeaderBufPtr+1) = (UCHAR)(nextBufLen >> 8); + *pHeaderBufPtr = (UCHAR) nextBufLen & 0xff; + *(pHeaderBufPtr + 1) = (UCHAR) (nextBufLen >> 8); pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += 2; @@ -1626,13 +1610,11 @@ static inline PUCHAR STA_Build_ARalink_Frame_Header( } -static inline PUCHAR STA_Build_AMSDU_Frame_Header( - IN RTMP_ADAPTER *pAd, - IN TX_BLK *pTxBlk) +static inline PUCHAR STA_Build_AMSDU_Frame_Header(IN RTMP_ADAPTER * pAd, + IN TX_BLK * pTxBlk) { - PUCHAR pHeaderBufPtr;//, pSaveBufPtr; - HEADER_802_11 *pHeader_802_11; - + PUCHAR pHeaderBufPtr; //, pSaveBufPtr; + HEADER_802_11 *pHeader_802_11; STAFindCipherAlgorithm(pAd, pTxBlk); STABuildCommon802_11Header(pAd, pTxBlk); @@ -1653,8 +1635,8 @@ static inline PUCHAR STA_Build_AMSDU_Frame_Header( // *pHeaderBufPtr |= 0x80; - *(pHeaderBufPtr+1) = 0; - pHeaderBufPtr +=2; + *(pHeaderBufPtr + 1) = 0; + pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += 2; //pSaveBufPtr = pHeaderBufPtr; @@ -1665,57 +1647,56 @@ static inline PUCHAR STA_Build_AMSDU_Frame_Header( // // @@@ MpduHeaderLen excluding padding @@@ // - pTxBlk->HdrPadLen = (ULONG)pHeaderBufPtr; + pTxBlk->HdrPadLen = (ULONG) pHeaderBufPtr; pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); - pTxBlk->HdrPadLen = (ULONG)(pHeaderBufPtr - pTxBlk->HdrPadLen); + pTxBlk->HdrPadLen = (ULONG) (pHeaderBufPtr - pTxBlk->HdrPadLen); return pHeaderBufPtr; } - -VOID STA_AMPDU_Frame_Tx( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk) +VOID STA_AMPDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) { - HEADER_802_11 *pHeader_802_11; - PUCHAR pHeaderBufPtr; - USHORT FreeNumber; - MAC_TABLE_ENTRY *pMacEntry; - BOOLEAN bVLANPkt; - PQUEUE_ENTRY pQEntry; + HEADER_802_11 *pHeader_802_11; + PUCHAR pHeaderBufPtr; + USHORT FreeNumber; + MAC_TABLE_ENTRY *pMacEntry; + BOOLEAN bVLANPkt; + PQUEUE_ENTRY pQEntry; ASSERT(pTxBlk); - while(pTxBlk->TxPacketList.Head) - { + while (pTxBlk->TxPacketList.Head) { pQEntry = RemoveHeadQueue(&pTxBlk->TxPacketList); pTxBlk->pPacket = QUEUE_ENTRY_TO_PACKET(pQEntry); - if ( RTMP_FillTxBlkInfo(pAd, pTxBlk) != TRUE) - { - RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_FAILURE); + if (RTMP_FillTxBlkInfo(pAd, pTxBlk) != TRUE) { + RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, + NDIS_STATUS_FAILURE); continue; } - bVLANPkt = (RTMP_GET_PACKET_VLAN(pTxBlk->pPacket) ? TRUE : FALSE); + bVLANPkt = + (RTMP_GET_PACKET_VLAN(pTxBlk->pPacket) ? TRUE : FALSE); pMacEntry = pTxBlk->pMacEntry; - if (pMacEntry->isCached) - { + if (pMacEntry->isCached) { // NOTE: Please make sure the size of pMacEntry->CachedBuf[] is smaller than pTxBlk->HeaderBuf[]!!!! - NdisMoveMemory((PUCHAR)&pTxBlk->HeaderBuf[TXINFO_SIZE], (PUCHAR)&pMacEntry->CachedBuf[0], TXWI_SIZE + sizeof(HEADER_802_11)); - pHeaderBufPtr = (PUCHAR)(&pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]); + NdisMoveMemory((PUCHAR) & pTxBlk-> + HeaderBuf[TXINFO_SIZE], + (PUCHAR) & pMacEntry->CachedBuf[0], + TXWI_SIZE + sizeof(HEADER_802_11)); + pHeaderBufPtr = + (PUCHAR) (&pTxBlk-> + HeaderBuf[TXINFO_SIZE + TXWI_SIZE]); STABuildCache802_11Header(pAd, pTxBlk, pHeaderBufPtr); - } - else - { + } else { STAFindCipherAlgorithm(pAd, pTxBlk); STABuildCommon802_11Header(pAd, pTxBlk); - pHeaderBufPtr = &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; + pHeaderBufPtr = + &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; } - pHeader_802_11 = (HEADER_802_11 *) pHeaderBufPtr; // skip common header @@ -1725,87 +1706,101 @@ VOID STA_AMPDU_Frame_Tx( // build QOS Control bytes // *pHeaderBufPtr = (pTxBlk->UserPriority & 0x0F); - *(pHeaderBufPtr+1) = 0; - pHeaderBufPtr +=2; + *(pHeaderBufPtr + 1) = 0; + pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += 2; // // build HTC+ // HTC control filed following QoS field // - if ((pAd->CommonCfg.bRdg == TRUE) && CLIENT_STATUS_TEST_FLAG(pTxBlk->pMacEntry, fCLIENT_STATUS_RDG_CAPABLE)) - { - if (pMacEntry->isCached == FALSE) - { + if ((pAd->CommonCfg.bRdg == TRUE) + && CLIENT_STATUS_TEST_FLAG(pTxBlk->pMacEntry, + fCLIENT_STATUS_RDG_CAPABLE)) { + if (pMacEntry->isCached == FALSE) { // mark HTC bit pHeader_802_11->FC.Order = 1; NdisZeroMemory(pHeaderBufPtr, 4); - *(pHeaderBufPtr+3) |= 0x80; + *(pHeaderBufPtr + 3) |= 0x80; } pHeaderBufPtr += 4; pTxBlk->MpduHeaderLen += 4; } - //pTxBlk->MpduHeaderLen = pHeaderBufPtr - pTxBlk->HeaderBuf - TXWI_SIZE - TXINFO_SIZE; ASSERT(pTxBlk->MpduHeaderLen >= 24); // skip 802.3 header pTxBlk->pSrcBufData = pTxBlk->pSrcBufHeader + LENGTH_802_3; - pTxBlk->SrcBufLen -= LENGTH_802_3; + pTxBlk->SrcBufLen -= LENGTH_802_3; // skip vlan tag - if (bVLANPkt) - { - pTxBlk->pSrcBufData += LENGTH_802_1Q; - pTxBlk->SrcBufLen -= LENGTH_802_1Q; + if (bVLANPkt) { + pTxBlk->pSrcBufData += LENGTH_802_1Q; + pTxBlk->SrcBufLen -= LENGTH_802_1Q; } - // // padding at front of LLC header // LLC header should locate at 4-octets aligment // // @@@ MpduHeaderLen excluding padding @@@ // - pTxBlk->HdrPadLen = (ULONG)pHeaderBufPtr; + pTxBlk->HdrPadLen = (ULONG) pHeaderBufPtr; pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); - pTxBlk->HdrPadLen = (ULONG)(pHeaderBufPtr - pTxBlk->HdrPadLen); + pTxBlk->HdrPadLen = (ULONG) (pHeaderBufPtr - pTxBlk->HdrPadLen); { // // Insert LLC-SNAP encapsulation - 8 octets // - EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(pTxBlk->pSrcBufData-2, pTxBlk->pExtraLlcSnapEncap); - if (pTxBlk->pExtraLlcSnapEncap) - { - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pExtraLlcSnapEncap, 6); + EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(pTxBlk-> + pSrcBufData - 2, + pTxBlk-> + pExtraLlcSnapEncap); + if (pTxBlk->pExtraLlcSnapEncap) { + NdisMoveMemory(pHeaderBufPtr, + pTxBlk->pExtraLlcSnapEncap, 6); pHeaderBufPtr += 6; // get 2 octets (TypeofLen) - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufData-2, 2); + NdisMoveMemory(pHeaderBufPtr, + pTxBlk->pSrcBufData - 2, 2); pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += LENGTH_802_1_H; } } - if (pMacEntry->isCached) - { - RTMPWriteTxWI_Cache(pAd, (PTXWI_STRUC)(&pTxBlk->HeaderBuf[TXINFO_SIZE]), pTxBlk); - } - else - { - RTMPWriteTxWI_Data(pAd, (PTXWI_STRUC)(&pTxBlk->HeaderBuf[TXINFO_SIZE]), pTxBlk); - - NdisZeroMemory((PUCHAR)(&pMacEntry->CachedBuf[0]), sizeof(pMacEntry->CachedBuf)); - NdisMoveMemory((PUCHAR)(&pMacEntry->CachedBuf[0]), (PUCHAR)(&pTxBlk->HeaderBuf[TXINFO_SIZE]), (pHeaderBufPtr - (PUCHAR)(&pTxBlk->HeaderBuf[TXINFO_SIZE]))); + if (pMacEntry->isCached) { + RTMPWriteTxWI_Cache(pAd, + (PTXWI_STRUC) (&pTxBlk-> + HeaderBuf + [TXINFO_SIZE]), + pTxBlk); + } else { + RTMPWriteTxWI_Data(pAd, + (PTXWI_STRUC) (&pTxBlk-> + HeaderBuf + [TXINFO_SIZE]), + pTxBlk); + + NdisZeroMemory((PUCHAR) (&pMacEntry->CachedBuf[0]), + sizeof(pMacEntry->CachedBuf)); + NdisMoveMemory((PUCHAR) (&pMacEntry->CachedBuf[0]), + (PUCHAR) (&pTxBlk-> + HeaderBuf[TXINFO_SIZE]), + (pHeaderBufPtr - + (PUCHAR) (&pTxBlk-> + HeaderBuf[TXINFO_SIZE]))); pMacEntry->isCached = TRUE; } // calculate Transmitted AMPDU count and ByteCount { - pAd->RalinkCounters.TransmittedMPDUsInAMPDUCount.u.LowPart ++; - pAd->RalinkCounters.TransmittedOctetsInAMPDUCount.QuadPart += pTxBlk->SrcBufLen; + pAd->RalinkCounters.TransmittedMPDUsInAMPDUCount.u. + LowPart++; + pAd->RalinkCounters.TransmittedOctetsInAMPDUCount. + QuadPart += pTxBlk->SrcBufLen; } //FreeNumber = GET_TXRING_FREENO(pAd, QueIdx); @@ -1824,62 +1819,64 @@ VOID STA_AMPDU_Frame_Tx( } - -VOID STA_AMSDU_Frame_Tx( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk) +VOID STA_AMSDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) { - PUCHAR pHeaderBufPtr; - USHORT FreeNumber; - USHORT subFramePayloadLen = 0; // AMSDU Subframe length without AMSDU-Header / Padding. - USHORT totalMPDUSize=0; - UCHAR *subFrameHeader; - UCHAR padding = 0; - USHORT FirstTx = 0, LastTxIdx = 0; - BOOLEAN bVLANPkt; - int frameNum = 0; - PQUEUE_ENTRY pQEntry; - + PUCHAR pHeaderBufPtr; + USHORT FreeNumber; + USHORT subFramePayloadLen = 0; // AMSDU Subframe length without AMSDU-Header / Padding. + USHORT totalMPDUSize = 0; + UCHAR *subFrameHeader; + UCHAR padding = 0; + USHORT FirstTx = 0, LastTxIdx = 0; + BOOLEAN bVLANPkt; + int frameNum = 0; + PQUEUE_ENTRY pQEntry; ASSERT(pTxBlk); ASSERT((pTxBlk->TxPacketList.Number > 1)); - while(pTxBlk->TxPacketList.Head) - { + while (pTxBlk->TxPacketList.Head) { pQEntry = RemoveHeadQueue(&pTxBlk->TxPacketList); pTxBlk->pPacket = QUEUE_ENTRY_TO_PACKET(pQEntry); - if (RTMP_FillTxBlkInfo(pAd, pTxBlk) != TRUE) - { - RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_FAILURE); + if (RTMP_FillTxBlkInfo(pAd, pTxBlk) != TRUE) { + RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, + NDIS_STATUS_FAILURE); continue; } - bVLANPkt = (RTMP_GET_PACKET_VLAN(pTxBlk->pPacket) ? TRUE : FALSE); + bVLANPkt = + (RTMP_GET_PACKET_VLAN(pTxBlk->pPacket) ? TRUE : FALSE); // skip 802.3 header pTxBlk->pSrcBufData = pTxBlk->pSrcBufHeader + LENGTH_802_3; - pTxBlk->SrcBufLen -= LENGTH_802_3; + pTxBlk->SrcBufLen -= LENGTH_802_3; // skip vlan tag - if (bVLANPkt) - { - pTxBlk->pSrcBufData += LENGTH_802_1Q; - pTxBlk->SrcBufLen -= LENGTH_802_1Q; + if (bVLANPkt) { + pTxBlk->pSrcBufData += LENGTH_802_1Q; + pTxBlk->SrcBufLen -= LENGTH_802_1Q; } - if (frameNum == 0) - { - pHeaderBufPtr = STA_Build_AMSDU_Frame_Header(pAd, pTxBlk); + if (frameNum == 0) { + pHeaderBufPtr = + STA_Build_AMSDU_Frame_Header(pAd, pTxBlk); // NOTE: TxWI->MPDUtotalByteCount will be updated after final frame was handled. - RTMPWriteTxWI_Data(pAd, (PTXWI_STRUC)(&pTxBlk->HeaderBuf[TXINFO_SIZE]), pTxBlk); - } - else - { + RTMPWriteTxWI_Data(pAd, + (PTXWI_STRUC) (&pTxBlk-> + HeaderBuf + [TXINFO_SIZE]), + pTxBlk); + } else { pHeaderBufPtr = &pTxBlk->HeaderBuf[0]; - padding = ROUND_UP(LENGTH_AMSDU_SUBFRAMEHEAD + subFramePayloadLen, 4) - (LENGTH_AMSDU_SUBFRAMEHEAD + subFramePayloadLen); - NdisZeroMemory(pHeaderBufPtr, padding + LENGTH_AMSDU_SUBFRAMEHEAD); + padding = + ROUND_UP(LENGTH_AMSDU_SUBFRAMEHEAD + + subFramePayloadLen, + 4) - (LENGTH_AMSDU_SUBFRAMEHEAD + + subFramePayloadLen); + NdisZeroMemory(pHeaderBufPtr, + padding + LENGTH_AMSDU_SUBFRAMEHEAD); pHeaderBufPtr += padding; pTxBlk->MpduHeaderLen = padding; } @@ -1893,39 +1890,42 @@ VOID STA_AMSDU_Frame_Tx( NdisMoveMemory(subFrameHeader, pTxBlk->pSrcBufHeader, 12); - pHeaderBufPtr += LENGTH_AMSDU_SUBFRAMEHEAD; pTxBlk->MpduHeaderLen += LENGTH_AMSDU_SUBFRAMEHEAD; - // // Insert LLC-SNAP encapsulation - 8 octets // - EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(pTxBlk->pSrcBufData-2, pTxBlk->pExtraLlcSnapEncap); + EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(pTxBlk->pSrcBufData - 2, + pTxBlk->pExtraLlcSnapEncap); subFramePayloadLen = pTxBlk->SrcBufLen; - if (pTxBlk->pExtraLlcSnapEncap) - { - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pExtraLlcSnapEncap, 6); + if (pTxBlk->pExtraLlcSnapEncap) { + NdisMoveMemory(pHeaderBufPtr, + pTxBlk->pExtraLlcSnapEncap, 6); pHeaderBufPtr += 6; // get 2 octets (TypeofLen) - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufData-2, 2); + NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufData - 2, + 2); pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += LENGTH_802_1_H; subFramePayloadLen += LENGTH_802_1_H; } - // update subFrame Length field subFrameHeader[12] = (subFramePayloadLen & 0xFF00) >> 8; subFrameHeader[13] = subFramePayloadLen & 0xFF; totalMPDUSize += pTxBlk->MpduHeaderLen + pTxBlk->SrcBufLen; - if (frameNum ==0) - FirstTx = HAL_WriteMultiTxResource(pAd, pTxBlk, frameNum, &FreeNumber); + if (frameNum == 0) + FirstTx = + HAL_WriteMultiTxResource(pAd, pTxBlk, frameNum, + &FreeNumber); else - LastTxIdx = HAL_WriteMultiTxResource(pAd, pTxBlk, frameNum, &FreeNumber); + LastTxIdx = + HAL_WriteMultiTxResource(pAd, pTxBlk, frameNum, + &FreeNumber); frameNum++; @@ -1934,8 +1934,9 @@ VOID STA_AMSDU_Frame_Tx( // calculate Transmitted AMSDU Count and ByteCount { - pAd->RalinkCounters.TransmittedAMSDUCount.u.LowPart ++; - pAd->RalinkCounters.TransmittedOctetsInAMSDU.QuadPart += totalMPDUSize; + pAd->RalinkCounters.TransmittedAMSDUCount.u.LowPart++; + pAd->RalinkCounters.TransmittedOctetsInAMSDU.QuadPart += + totalMPDUSize; } } @@ -1950,29 +1951,24 @@ VOID STA_AMSDU_Frame_Tx( HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); } -VOID STA_Legacy_Frame_Tx( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk) +VOID STA_Legacy_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) { - HEADER_802_11 *pHeader_802_11; - PUCHAR pHeaderBufPtr; - USHORT FreeNumber; - BOOLEAN bVLANPkt; - PQUEUE_ENTRY pQEntry; + HEADER_802_11 *pHeader_802_11; + PUCHAR pHeaderBufPtr; + USHORT FreeNumber; + BOOLEAN bVLANPkt; + PQUEUE_ENTRY pQEntry; ASSERT(pTxBlk); - pQEntry = RemoveHeadQueue(&pTxBlk->TxPacketList); pTxBlk->pPacket = QUEUE_ENTRY_TO_PACKET(pQEntry); - if (RTMP_FillTxBlkInfo(pAd, pTxBlk) != TRUE) - { + if (RTMP_FillTxBlkInfo(pAd, pTxBlk) != TRUE) { RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_FAILURE); return; } - if (pTxBlk->TxFrameType == TX_MCAST_FRAME) - { + if (pTxBlk->TxFrameType == TX_MCAST_FRAME) { INC_COUNTER64(pAd->WlanCounters.MulticastTransmittedFrameCount); } @@ -1989,16 +1985,14 @@ VOID STA_Legacy_Frame_Tx( STAFindCipherAlgorithm(pAd, pTxBlk); STABuildCommon802_11Header(pAd, pTxBlk); - // skip 802.3 header pTxBlk->pSrcBufData = pTxBlk->pSrcBufHeader + LENGTH_802_3; - pTxBlk->SrcBufLen -= LENGTH_802_3; + pTxBlk->SrcBufLen -= LENGTH_802_3; // skip vlan tag - if (bVLANPkt) - { - pTxBlk->pSrcBufData += LENGTH_802_1Q; - pTxBlk->SrcBufLen -= LENGTH_802_1Q; + if (bVLANPkt) { + pTxBlk->pSrcBufData += LENGTH_802_1Q; + pTxBlk->SrcBufLen -= LENGTH_802_1Q; } pHeaderBufPtr = &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; @@ -2007,21 +2001,22 @@ VOID STA_Legacy_Frame_Tx( // skip common header pHeaderBufPtr += pTxBlk->MpduHeaderLen; - if (TX_BLK_TEST_FLAG(pTxBlk, fTX_bWMM)) - { + if (TX_BLK_TEST_FLAG(pTxBlk, fTX_bWMM)) { // // build QOS Control bytes // - *(pHeaderBufPtr) = ((pTxBlk->UserPriority & 0x0F) | (pAd->CommonCfg.AckPolicy[pTxBlk->QueIdx]<<5)); - *(pHeaderBufPtr+1) = 0; - pHeaderBufPtr +=2; + *(pHeaderBufPtr) = + ((pTxBlk->UserPriority & 0x0F) | (pAd->CommonCfg. + AckPolicy[pTxBlk-> + QueIdx] << 5)); + *(pHeaderBufPtr + 1) = 0; + pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += 2; } - // The remaining content of MPDU header should locate at 4-octets aligment - pTxBlk->HdrPadLen = (ULONG)pHeaderBufPtr; + pTxBlk->HdrPadLen = (ULONG) pHeaderBufPtr; pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); - pTxBlk->HdrPadLen = (ULONG)(pHeaderBufPtr - pTxBlk->HdrPadLen); + pTxBlk->HdrPadLen = (ULONG) (pHeaderBufPtr - pTxBlk->HdrPadLen); { @@ -2029,20 +2024,23 @@ VOID STA_Legacy_Frame_Tx( // Insert LLC-SNAP encapsulation - 8 octets // // - // if original Ethernet frame contains no LLC/SNAP, + // if original Ethernet frame contains no LLC/SNAP, // then an extra LLC/SNAP encap is required // - EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(pTxBlk->pSrcBufHeader, pTxBlk->pExtraLlcSnapEncap); - if (pTxBlk->pExtraLlcSnapEncap) - { + EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(pTxBlk->pSrcBufHeader, + pTxBlk->pExtraLlcSnapEncap); + if (pTxBlk->pExtraLlcSnapEncap) { UCHAR vlan_size; - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pExtraLlcSnapEncap, 6); + NdisMoveMemory(pHeaderBufPtr, + pTxBlk->pExtraLlcSnapEncap, 6); pHeaderBufPtr += 6; // skip vlan tag - vlan_size = (bVLANPkt) ? LENGTH_802_1Q : 0; + vlan_size = (bVLANPkt) ? LENGTH_802_1Q : 0; // get 2 octets (TypeofLen) - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufHeader+12+vlan_size, 2); + NdisMoveMemory(pHeaderBufPtr, + pTxBlk->pSrcBufHeader + 12 + vlan_size, + 2); pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += LENGTH_802_1_H; } @@ -2054,7 +2052,8 @@ VOID STA_Legacy_Frame_Tx( // use Wcid as Key Index // - RTMPWriteTxWI_Data(pAd, (PTXWI_STRUC)(&pTxBlk->HeaderBuf[TXINFO_SIZE]), pTxBlk); + RTMPWriteTxWI_Data(pAd, (PTXWI_STRUC) (&pTxBlk->HeaderBuf[TXINFO_SIZE]), + pTxBlk); //FreeNumber = GET_TXRING_FREENO(pAd, QueIdx); @@ -2070,87 +2069,88 @@ VOID STA_Legacy_Frame_Tx( HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); } - -VOID STA_ARalink_Frame_Tx( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk) +VOID STA_ARalink_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) { - PUCHAR pHeaderBufPtr; - USHORT FreeNumber; - USHORT totalMPDUSize=0; - USHORT FirstTx, LastTxIdx; - int frameNum = 0; - BOOLEAN bVLANPkt; - PQUEUE_ENTRY pQEntry; - + PUCHAR pHeaderBufPtr; + USHORT FreeNumber; + USHORT totalMPDUSize = 0; + USHORT FirstTx, LastTxIdx; + int frameNum = 0; + BOOLEAN bVLANPkt; + PQUEUE_ENTRY pQEntry; ASSERT(pTxBlk); - ASSERT((pTxBlk->TxPacketList.Number== 2)); + ASSERT((pTxBlk->TxPacketList.Number == 2)); - - FirstTx = LastTxIdx = 0; // Is it ok init they as 0? - while(pTxBlk->TxPacketList.Head) - { + FirstTx = LastTxIdx = 0; // Is it ok init they as 0? + while (pTxBlk->TxPacketList.Head) { pQEntry = RemoveHeadQueue(&pTxBlk->TxPacketList); pTxBlk->pPacket = QUEUE_ENTRY_TO_PACKET(pQEntry); - if (RTMP_FillTxBlkInfo(pAd, pTxBlk) != TRUE) - { - RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_FAILURE); + if (RTMP_FillTxBlkInfo(pAd, pTxBlk) != TRUE) { + RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, + NDIS_STATUS_FAILURE); continue; } - bVLANPkt = (RTMP_GET_PACKET_VLAN(pTxBlk->pPacket) ? TRUE : FALSE); + bVLANPkt = + (RTMP_GET_PACKET_VLAN(pTxBlk->pPacket) ? TRUE : FALSE); // skip 802.3 header pTxBlk->pSrcBufData = pTxBlk->pSrcBufHeader + LENGTH_802_3; - pTxBlk->SrcBufLen -= LENGTH_802_3; + pTxBlk->SrcBufLen -= LENGTH_802_3; // skip vlan tag - if (bVLANPkt) - { - pTxBlk->pSrcBufData += LENGTH_802_1Q; - pTxBlk->SrcBufLen -= LENGTH_802_1Q; + if (bVLANPkt) { + pTxBlk->pSrcBufData += LENGTH_802_1Q; + pTxBlk->SrcBufLen -= LENGTH_802_1Q; } - if (frameNum == 0) - { // For first frame, we need to create the 802.11 header + padding(optional) + RA-AGG-LEN + SNAP Header + if (frameNum == 0) { // For first frame, we need to create the 802.11 header + padding(optional) + RA-AGG-LEN + SNAP Header - pHeaderBufPtr = STA_Build_ARalink_Frame_Header(pAd, pTxBlk); + pHeaderBufPtr = + STA_Build_ARalink_Frame_Header(pAd, pTxBlk); // It's ok write the TxWI here, because the TxWI->MPDUtotalByteCount - // will be updated after final frame was handled. - RTMPWriteTxWI_Data(pAd, (PTXWI_STRUC)(&pTxBlk->HeaderBuf[TXINFO_SIZE]), pTxBlk); - + // will be updated after final frame was handled. + RTMPWriteTxWI_Data(pAd, + (PTXWI_STRUC) (&pTxBlk-> + HeaderBuf + [TXINFO_SIZE]), + pTxBlk); // // Insert LLC-SNAP encapsulation - 8 octets // - EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(pTxBlk->pSrcBufData-2, pTxBlk->pExtraLlcSnapEncap); - - if (pTxBlk->pExtraLlcSnapEncap) - { - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pExtraLlcSnapEncap, 6); + EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(pTxBlk-> + pSrcBufData - 2, + pTxBlk-> + pExtraLlcSnapEncap); + + if (pTxBlk->pExtraLlcSnapEncap) { + NdisMoveMemory(pHeaderBufPtr, + pTxBlk->pExtraLlcSnapEncap, 6); pHeaderBufPtr += 6; // get 2 octets (TypeofLen) - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufData-2, 2); + NdisMoveMemory(pHeaderBufPtr, + pTxBlk->pSrcBufData - 2, 2); pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += LENGTH_802_1_H; } - } - else - { // For second aggregated frame, we need create the 802.3 header to headerBuf, because PCI will copy it to SDPtr0. + } else { // For second aggregated frame, we need create the 802.3 header to headerBuf, because PCI will copy it to SDPtr0. pHeaderBufPtr = &pTxBlk->HeaderBuf[0]; pTxBlk->MpduHeaderLen = 0; // A-Ralink sub-sequent frame header is the same as 802.3 header. // DA(6)+SA(6)+FrameType(2) - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufHeader, 12); + NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufHeader, + 12); pHeaderBufPtr += 12; // get 2 octets (TypeofLen) - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufData-2, 2); + NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufData - 2, + 2); pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen = LENGTH_ARALINK_SUBFRAMEHEAD; } @@ -2158,10 +2158,14 @@ VOID STA_ARalink_Frame_Tx( totalMPDUSize += pTxBlk->MpduHeaderLen + pTxBlk->SrcBufLen; //FreeNumber = GET_TXRING_FREENO(pAd, QueIdx); - if (frameNum ==0) - FirstTx = HAL_WriteMultiTxResource(pAd, pTxBlk, frameNum, &FreeNumber); + if (frameNum == 0) + FirstTx = + HAL_WriteMultiTxResource(pAd, pTxBlk, frameNum, + &FreeNumber); else - LastTxIdx = HAL_WriteMultiTxResource(pAd, pTxBlk, frameNum, &FreeNumber); + LastTxIdx = + HAL_WriteMultiTxResource(pAd, pTxBlk, frameNum, + &FreeNumber); frameNum++; @@ -2182,31 +2186,26 @@ VOID STA_ARalink_Frame_Tx( } - -VOID STA_Fragment_Frame_Tx( - IN RTMP_ADAPTER *pAd, - IN TX_BLK *pTxBlk) +VOID STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) { - HEADER_802_11 *pHeader_802_11; - PUCHAR pHeaderBufPtr; - USHORT FreeNumber; - UCHAR fragNum = 0; - PACKET_INFO PacketInfo; - USHORT EncryptionOverhead = 0; - UINT32 FreeMpduSize, SrcRemainingBytes; - USHORT AckDuration; - UINT NextMpduSize; - BOOLEAN bVLANPkt; - PQUEUE_ENTRY pQEntry; - HTTRANSMIT_SETTING *pTransmit; - + HEADER_802_11 *pHeader_802_11; + PUCHAR pHeaderBufPtr; + USHORT FreeNumber; + UCHAR fragNum = 0; + PACKET_INFO PacketInfo; + USHORT EncryptionOverhead = 0; + UINT32 FreeMpduSize, SrcRemainingBytes; + USHORT AckDuration; + UINT NextMpduSize; + BOOLEAN bVLANPkt; + PQUEUE_ENTRY pQEntry; + HTTRANSMIT_SETTING *pTransmit; ASSERT(pTxBlk); pQEntry = RemoveHeadQueue(&pTxBlk->TxPacketList); pTxBlk->pPacket = QUEUE_ENTRY_TO_PACKET(pQEntry); - if (RTMP_FillTxBlkInfo(pAd, pTxBlk) != TRUE) - { + if (RTMP_FillTxBlkInfo(pAd, pTxBlk) != TRUE) { RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_FAILURE); return; } @@ -2217,104 +2216,100 @@ VOID STA_Fragment_Frame_Tx( STAFindCipherAlgorithm(pAd, pTxBlk); STABuildCommon802_11Header(pAd, pTxBlk); - if (pTxBlk->CipherAlg == CIPHER_TKIP) - { - pTxBlk->pPacket = duplicate_pkt_with_TKIP_MIC(pAd, pTxBlk->pPacket); + if (pTxBlk->CipherAlg == CIPHER_TKIP) { + pTxBlk->pPacket = + duplicate_pkt_with_TKIP_MIC(pAd, pTxBlk->pPacket); if (pTxBlk->pPacket == NULL) return; - RTMP_QueryPacketInfo(pTxBlk->pPacket, &PacketInfo, &pTxBlk->pSrcBufHeader, &pTxBlk->SrcBufLen); + RTMP_QueryPacketInfo(pTxBlk->pPacket, &PacketInfo, + &pTxBlk->pSrcBufHeader, + &pTxBlk->SrcBufLen); } - // skip 802.3 header pTxBlk->pSrcBufData = pTxBlk->pSrcBufHeader + LENGTH_802_3; - pTxBlk->SrcBufLen -= LENGTH_802_3; - + pTxBlk->SrcBufLen -= LENGTH_802_3; // skip vlan tag - if (bVLANPkt) - { - pTxBlk->pSrcBufData += LENGTH_802_1Q; - pTxBlk->SrcBufLen -= LENGTH_802_1Q; + if (bVLANPkt) { + pTxBlk->pSrcBufData += LENGTH_802_1Q; + pTxBlk->SrcBufLen -= LENGTH_802_1Q; } pHeaderBufPtr = &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; - pHeader_802_11 = (HEADER_802_11 *)pHeaderBufPtr; - + pHeader_802_11 = (HEADER_802_11 *) pHeaderBufPtr; // skip common header pHeaderBufPtr += pTxBlk->MpduHeaderLen; - if (TX_BLK_TEST_FLAG(pTxBlk, fTX_bWMM)) - { + if (TX_BLK_TEST_FLAG(pTxBlk, fTX_bWMM)) { // // build QOS Control bytes // *pHeaderBufPtr = (pTxBlk->UserPriority & 0x0F); - *(pHeaderBufPtr+1) = 0; - pHeaderBufPtr +=2; + *(pHeaderBufPtr + 1) = 0; + pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += 2; } - // // padding at front of LLC header // LLC header should locate at 4-octets aligment // - pTxBlk->HdrPadLen = (ULONG)pHeaderBufPtr; + pTxBlk->HdrPadLen = (ULONG) pHeaderBufPtr; pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); - pTxBlk->HdrPadLen = (ULONG)(pHeaderBufPtr - pTxBlk->HdrPadLen); - - + pTxBlk->HdrPadLen = (ULONG) (pHeaderBufPtr - pTxBlk->HdrPadLen); // // Insert LLC-SNAP encapsulation - 8 octets // // - // if original Ethernet frame contains no LLC/SNAP, + // if original Ethernet frame contains no LLC/SNAP, // then an extra LLC/SNAP encap is required // - EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(pTxBlk->pSrcBufHeader, pTxBlk->pExtraLlcSnapEncap); - if (pTxBlk->pExtraLlcSnapEncap) - { + EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(pTxBlk->pSrcBufHeader, + pTxBlk->pExtraLlcSnapEncap); + if (pTxBlk->pExtraLlcSnapEncap) { UCHAR vlan_size; NdisMoveMemory(pHeaderBufPtr, pTxBlk->pExtraLlcSnapEncap, 6); pHeaderBufPtr += 6; // skip vlan tag - vlan_size = (bVLANPkt) ? LENGTH_802_1Q : 0; + vlan_size = (bVLANPkt) ? LENGTH_802_1Q : 0; // get 2 octets (TypeofLen) - NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufHeader+12+vlan_size, 2); + NdisMoveMemory(pHeaderBufPtr, + pTxBlk->pSrcBufHeader + 12 + vlan_size, 2); pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += LENGTH_802_1_H; } - // If TKIP is used and fragmentation is required. Driver has to - // append TKIP MIC at tail of the scatter buffer - // MAC ASIC will only perform IV/EIV/ICV insertion but no TKIP MIC - if (pTxBlk->CipherAlg == CIPHER_TKIP) - { - RTMPCalculateMICValue(pAd, pTxBlk->pPacket, pTxBlk->pExtraLlcSnapEncap, pTxBlk->pKey, 0); + // append TKIP MIC at tail of the scatter buffer + // MAC ASIC will only perform IV/EIV/ICV insertion but no TKIP MIC + if (pTxBlk->CipherAlg == CIPHER_TKIP) { + RTMPCalculateMICValue(pAd, pTxBlk->pPacket, + pTxBlk->pExtraLlcSnapEncap, pTxBlk->pKey, + 0); // NOTE: DON'T refer the skb->len directly after following copy. Becasue the length is not adjust - // to correct lenght, refer to pTxBlk->SrcBufLen for the packet length in following progress. - NdisMoveMemory(pTxBlk->pSrcBufData + pTxBlk->SrcBufLen, &pAd->PrivateInfo.Tx.MIC[0], 8); + // to correct lenght, refer to pTxBlk->SrcBufLen for the packet length in following progress. + NdisMoveMemory(pTxBlk->pSrcBufData + pTxBlk->SrcBufLen, + &pAd->PrivateInfo.Tx.MIC[0], 8); //skb_put((RTPKT_TO_OSPKT(pTxBlk->pPacket))->tail, 8); pTxBlk->SrcBufLen += 8; pTxBlk->TotalFrameLen += 8; pTxBlk->CipherAlg = CIPHER_TKIP_NO_MIC; } - // // calcuate the overhead bytes that encryption algorithm may add. This // affects the calculate of "duration" field // - if ((pTxBlk->CipherAlg == CIPHER_WEP64) || (pTxBlk->CipherAlg == CIPHER_WEP128)) - EncryptionOverhead = 8; //WEP: IV[4] + ICV[4]; + if ((pTxBlk->CipherAlg == CIPHER_WEP64) + || (pTxBlk->CipherAlg == CIPHER_WEP128)) + EncryptionOverhead = 8; //WEP: IV[4] + ICV[4]; else if (pTxBlk->CipherAlg == CIPHER_TKIP_NO_MIC) - EncryptionOverhead = 12;//TKIP: IV[4] + EIV[4] + ICV[4], MIC will be added to TotalPacketLength + EncryptionOverhead = 12; //TKIP: IV[4] + EIV[4] + ICV[4], MIC will be added to TotalPacketLength else if (pTxBlk->CipherAlg == CIPHER_TKIP) - EncryptionOverhead = 20;//TKIP: IV[4] + EIV[4] + ICV[4] + MIC[8] + EncryptionOverhead = 20; //TKIP: IV[4] + EIV[4] + ICV[4] + MIC[8] else if (pTxBlk->CipherAlg == CIPHER_AES) EncryptionOverhead = 16; // AES: IV[4] + EIV[4] + MIC[8] else @@ -2331,7 +2326,11 @@ VOID STA_Fragment_Frame_Tx( // decide how much time an ACK/CTS frame will consume in the air if (pTxBlk->TxRate <= RATE_LAST_OFDM_RATE) - AckDuration = RTMPCalcDuration(pAd, pAd->CommonCfg.ExpectedACKRate[pTxBlk->TxRate], 14); + AckDuration = + RTMPCalcDuration(pAd, + pAd->CommonCfg.ExpectedACKRate[pTxBlk-> + TxRate], + 14); else AckDuration = RTMPCalcDuration(pAd, RATE_6_5, 14); @@ -2346,25 +2345,28 @@ VOID STA_Fragment_Frame_Tx( FreeMpduSize -= pTxBlk->MpduHeaderLen; - if (SrcRemainingBytes <= FreeMpduSize) - { // this is the last or only fragment + if (SrcRemainingBytes <= FreeMpduSize) { // this is the last or only fragment pTxBlk->SrcBufLen = SrcRemainingBytes; pHeader_802_11->FC.MoreFrag = 0; - pHeader_802_11->Duration = pAd->CommonCfg.Dsifs + AckDuration; + pHeader_802_11->Duration = + pAd->CommonCfg.Dsifs + AckDuration; // Indicate the lower layer that this's the last fragment. pTxBlk->TotalFragNum = fragNum; - } - else - { // more fragment is required + } else { // more fragment is required pTxBlk->SrcBufLen = FreeMpduSize; - NextMpduSize = min(((UINT)SrcRemainingBytes - pTxBlk->SrcBufLen), ((UINT)pAd->CommonCfg.FragmentThreshold)); + NextMpduSize = + min(((UINT) SrcRemainingBytes - pTxBlk->SrcBufLen), + ((UINT) pAd->CommonCfg.FragmentThreshold)); pHeader_802_11->FC.MoreFrag = 1; - pHeader_802_11->Duration = (3 * pAd->CommonCfg.Dsifs) + (2 * AckDuration) + RTMPCalcDuration(pAd, pTxBlk->TxRate, NextMpduSize + EncryptionOverhead); + pHeader_802_11->Duration = + (3 * pAd->CommonCfg.Dsifs) + (2 * AckDuration) + + RTMPCalcDuration(pAd, pTxBlk->TxRate, + NextMpduSize + EncryptionOverhead); } if (fragNum == 0) @@ -2372,7 +2374,10 @@ VOID STA_Fragment_Frame_Tx( else pTxBlk->FrameGap = IFS_SIFS; - RTMPWriteTxWI_Data(pAd, (PTXWI_STRUC)(&pTxBlk->HeaderBuf[TXINFO_SIZE]), pTxBlk); + RTMPWriteTxWI_Data(pAd, + (PTXWI_STRUC) (&pTxBlk-> + HeaderBuf[TXINFO_SIZE]), + pTxBlk); HAL_WriteFragTxResource(pAd, pTxBlk, fragNum, &FreeNumber); @@ -2389,18 +2394,17 @@ VOID STA_Fragment_Frame_Tx( SrcRemainingBytes -= pTxBlk->SrcBufLen; pTxBlk->pSrcBufData += pTxBlk->SrcBufLen; - pHeader_802_11->Frag++; // increase Frag # + pHeader_802_11->Frag++; // increase Frag # - }while(SrcRemainingBytes > 0); + } while (SrcRemainingBytes > 0); // // Kick out Tx // if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_DISABLE_TX)) - HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); + HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); } - #define RELEASE_FRAMES_OF_TXBLK(_pAd, _pTxBlk, _pQEntry, _Status) \ while(_pTxBlk->TxPacketList.Head) \ { \ @@ -2408,7 +2412,6 @@ VOID STA_Fragment_Frame_Tx( RELEASE_NDIS_PACKET(_pAd, QUEUE_ENTRY_TO_PACKET(_pQEntry), _Status); \ } - /* ======================================================================== @@ -2431,22 +2434,21 @@ VOID STA_Fragment_Frame_Tx( ======================================================================== */ -NDIS_STATUS STAHardTransmit( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR QueIdx) +NDIS_STATUS STAHardTransmit(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, IN UCHAR QueIdx) { - NDIS_PACKET *pPacket; - PQUEUE_ENTRY pQEntry; + NDIS_PACKET *pPacket; + PQUEUE_ENTRY pQEntry; // --------------------------------------------- // STEP 0. DO SANITY CHECK AND SOME EARLY PREPARATION. // --------------------------------------------- // ASSERT(pTxBlk->TxPacketList.Number); - if (pTxBlk->TxPacketList.Head == NULL) - { - DBGPRINT(RT_DEBUG_ERROR, ("pTxBlk->TotalFrameNum == %ld!\n", pTxBlk->TxPacketList.Number)); + if (pTxBlk->TxPacketList.Head == NULL) { + DBGPRINT(RT_DEBUG_ERROR, + ("pTxBlk->TotalFrameNum == %ld!\n", + pTxBlk->TxPacketList.Number)); return NDIS_STATUS_FAILURE; } @@ -2454,13 +2456,13 @@ NDIS_STATUS STAHardTransmit( // ------------------------------------------------------------------ // STEP 1. WAKE UP PHY - // outgoing frame always wakeup PHY to prevent frame lost and - // turn off PSM bit to improve performance + // outgoing frame always wakeup PHY to prevent frame lost and + // turn off PSM bit to improve performance // ------------------------------------------------------------------ // not to change PSM bit, just send this frame out? - if ((pAd->StaCfg.Psm == PWR_SAVE) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - DBGPRINT_RAW(RT_DEBUG_INFO, ("AsicForceWakeup At HardTx\n")); + if ((pAd->StaCfg.Psm == PWR_SAVE) + && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { + DBGPRINT_RAW(RT_DEBUG_INFO, ("AsicForceWakeup At HardTx\n")); #ifdef RTMP_MAC_PCI AsicForceWakeup(pAd, TRUE); #endif // RTMP_MAC_PCI // @@ -2468,85 +2470,81 @@ NDIS_STATUS STAHardTransmit( RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_FORCE_WAKE_UP, NULL, 0); #endif // RTMP_MAC_USB // } - // It should not change PSM bit, when APSD turn on. - if ((!(pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable) && (pAd->CommonCfg.bAPSDForcePowerSave == FALSE)) - || (RTMP_GET_PACKET_EAPOL(pTxBlk->pPacket)) - || (RTMP_GET_PACKET_WAI(pTxBlk->pPacket))) - { + if ((! + (pAd->CommonCfg.bAPSDCapable + && pAd->CommonCfg.APEdcaParm.bAPSDCapable) + && (pAd->CommonCfg.bAPSDForcePowerSave == FALSE)) + || (RTMP_GET_PACKET_EAPOL(pTxBlk->pPacket)) + || (RTMP_GET_PACKET_WAI(pTxBlk->pPacket))) { if ((pAd->StaCfg.Psm == PWR_SAVE) && - (pAd->StaCfg.WindowsPowerMode == Ndis802_11PowerModeFast_PSP)) + (pAd->StaCfg.WindowsPowerMode == + Ndis802_11PowerModeFast_PSP)) RTMP_SET_PSM_BIT(pAd, PWR_ACTIVE); } - switch (pTxBlk->TxFrameType) - { - case TX_AMPDU_FRAME: - STA_AMPDU_Frame_Tx(pAd, pTxBlk); - break; - case TX_AMSDU_FRAME: - STA_AMSDU_Frame_Tx(pAd, pTxBlk); - break; - case TX_LEGACY_FRAME: - STA_Legacy_Frame_Tx(pAd, pTxBlk); - break; - case TX_MCAST_FRAME: - STA_Legacy_Frame_Tx(pAd, pTxBlk); - break; - case TX_RALINK_FRAME: - STA_ARalink_Frame_Tx(pAd, pTxBlk); - break; - case TX_FRAG_FRAME: - STA_Fragment_Frame_Tx(pAd, pTxBlk); - break; - default: - { - // It should not happened! - DBGPRINT(RT_DEBUG_ERROR, ("Send a pacekt was not classified!! It should not happen!\n")); - while(pTxBlk->TxPacketList.Number) - { - pQEntry = RemoveHeadQueue(&pTxBlk->TxPacketList); - pPacket = QUEUE_ENTRY_TO_PACKET(pQEntry); - if (pPacket) - RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); - } + switch (pTxBlk->TxFrameType) { + case TX_AMPDU_FRAME: + STA_AMPDU_Frame_Tx(pAd, pTxBlk); + break; + case TX_AMSDU_FRAME: + STA_AMSDU_Frame_Tx(pAd, pTxBlk); + break; + case TX_LEGACY_FRAME: + STA_Legacy_Frame_Tx(pAd, pTxBlk); + break; + case TX_MCAST_FRAME: + STA_Legacy_Frame_Tx(pAd, pTxBlk); + break; + case TX_RALINK_FRAME: + STA_ARalink_Frame_Tx(pAd, pTxBlk); + break; + case TX_FRAG_FRAME: + STA_Fragment_Frame_Tx(pAd, pTxBlk); + break; + default: + { + // It should not happened! + DBGPRINT(RT_DEBUG_ERROR, + ("Send a pacekt was not classified!! It should not happen!\n")); + while (pTxBlk->TxPacketList.Number) { + pQEntry = + RemoveHeadQueue(&pTxBlk->TxPacketList); + pPacket = QUEUE_ENTRY_TO_PACKET(pQEntry); + if (pPacket) + RELEASE_NDIS_PACKET(pAd, pPacket, + NDIS_STATUS_FAILURE); } - break; + } + break; } return (NDIS_STATUS_SUCCESS); } -ULONG HashBytesPolynomial(UCHAR *value, unsigned int len) +ULONG HashBytesPolynomial(UCHAR * value, unsigned int len) { - unsigned char *word = value; - unsigned int ret = 0; - unsigned int i; - - for(i=0; i < len; i++) - { - int mod = i % 32; - ret ^=(unsigned int) (word[i]) << mod; - ret ^=(unsigned int) (word[i]) >> (32 - mod); - } - return ret; + unsigned char *word = value; + unsigned int ret = 0; + unsigned int i; + + for (i = 0; i < len; i++) { + int mod = i % 32; + ret ^= (unsigned int)(word[i]) << mod; + ret ^= (unsigned int)(word[i]) >> (32 - mod); + } + return ret; } -VOID Sta_Announce_or_Forward_802_3_Packet( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN UCHAR FromWhichBSSID) +VOID Sta_Announce_or_Forward_802_3_Packet(IN PRTMP_ADAPTER pAd, + IN PNDIS_PACKET pPacket, + IN UCHAR FromWhichBSSID) { - if (TRUE - ) - { + if (TRUE) { announce_802_3_packet(pAd, pPacket); - } - else - { + } else { // release packet RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); } } - diff --git a/drivers/staging/rt2860/sta/sanity.c b/drivers/staging/rt2860/sta/sanity.c index 292baa86196b..3986478bf281 100644 --- a/drivers/staging/rt2860/sta/sanity.c +++ b/drivers/staging/rt2860/sta/sanity.c @@ -36,15 +36,15 @@ */ #include "../rt_config.h" -extern UCHAR CISCO_OUI[]; +extern UCHAR CISCO_OUI[]; -extern UCHAR WPA_OUI[]; -extern UCHAR RSN_OUI[]; -extern UCHAR WME_INFO_ELEM[]; -extern UCHAR WME_PARM_ELEM[]; -extern UCHAR Ccx2QosInfo[]; -extern UCHAR RALINK_OUI[]; -extern UCHAR BROADCOM_OUI[]; +extern UCHAR WPA_OUI[]; +extern UCHAR RSN_OUI[]; +extern UCHAR WME_INFO_ELEM[]; +extern UCHAR WME_PARM_ELEM[]; +extern UCHAR Ccx2QosInfo[]; +extern UCHAR RALINK_OUI[]; +extern UCHAR BROADCOM_OUI[]; /* ========================================================================== @@ -54,27 +54,25 @@ extern UCHAR BROADCOM_OUI[]; TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -BOOLEAN MlmeStartReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT CHAR Ssid[], - OUT UCHAR *pSsidLen) +BOOLEAN MlmeStartReqSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, + IN ULONG MsgLen, + OUT CHAR Ssid[], OUT UCHAR * pSsidLen) { - MLME_START_REQ_STRUCT *Info; + MLME_START_REQ_STRUCT *Info; - Info = (MLME_START_REQ_STRUCT *)(Msg); + Info = (MLME_START_REQ_STRUCT *) (Msg); - if (Info->SsidLen > MAX_LEN_OF_SSID) - { - DBGPRINT(RT_DEBUG_TRACE, ("MlmeStartReqSanity fail - wrong SSID length\n")); - return FALSE; - } + if (Info->SsidLen > MAX_LEN_OF_SSID) { + DBGPRINT(RT_DEBUG_TRACE, + ("MlmeStartReqSanity fail - wrong SSID length\n")); + return FALSE; + } - *pSsidLen = Info->SsidLen; - NdisMoveMemory(Ssid, Info->Ssid, *pSsidLen); + *pSsidLen = Info->SsidLen; + NdisMoveMemory(Ssid, Info->Ssid, *pSsidLen); - return TRUE; + return TRUE; } /* @@ -88,171 +86,161 @@ BOOLEAN MlmeStartReqSanity( ========================================================================== */ -BOOLEAN PeerAssocRspSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *pCapabilityInfo, - OUT USHORT *pStatus, - OUT USHORT *pAid, - OUT UCHAR SupRate[], - OUT UCHAR *pSupRateLen, - OUT UCHAR ExtRate[], - OUT UCHAR *pExtRateLen, - OUT HT_CAPABILITY_IE *pHtCapability, - OUT ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE - OUT UCHAR *pHtCapabilityLen, - OUT UCHAR *pAddHtInfoLen, - OUT UCHAR *pNewExtChannelOffset, - OUT PEDCA_PARM pEdcaParm, - OUT UCHAR *pCkipFlag) +BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen, OUT PUCHAR pAddr2, OUT USHORT * pCapabilityInfo, OUT USHORT * pStatus, OUT USHORT * pAid, OUT UCHAR SupRate[], OUT UCHAR * pSupRateLen, OUT UCHAR ExtRate[], OUT UCHAR * pExtRateLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT ADD_HT_INFO_IE * pAddHtInfo, // AP might use this additional ht info IE + OUT UCHAR * pHtCapabilityLen, + OUT UCHAR * pAddHtInfoLen, + OUT UCHAR * pNewExtChannelOffset, + OUT PEDCA_PARM pEdcaParm, OUT UCHAR * pCkipFlag) { - CHAR IeType, *Ptr; - PFRAME_802_11 pFrame = (PFRAME_802_11)pMsg; - PEID_STRUCT pEid; - ULONG Length = 0; + CHAR IeType, *Ptr; + PFRAME_802_11 pFrame = (PFRAME_802_11) pMsg; + PEID_STRUCT pEid; + ULONG Length = 0; *pNewExtChannelOffset = 0xff; *pHtCapabilityLen = 0; *pAddHtInfoLen = 0; - COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); - Ptr = (PCHAR)pFrame->Octet; - Length += LENGTH_802_11; - - NdisMoveMemory(pCapabilityInfo, &pFrame->Octet[0], 2); - Length += 2; - NdisMoveMemory(pStatus, &pFrame->Octet[2], 2); - Length += 2; - *pCkipFlag = 0; - *pExtRateLen = 0; - pEdcaParm->bValid = FALSE; - - if (*pStatus != MLME_SUCCESS) - return TRUE; - - NdisMoveMemory(pAid, &pFrame->Octet[4], 2); - Length += 2; - - // Aid already swaped byte order in RTMPFrameEndianChange() for big endian platform - *pAid = (*pAid) & 0x3fff; // AID is low 14-bit - - // -- get supported rates from payload and advance the pointer - IeType = pFrame->Octet[6]; - *pSupRateLen = pFrame->Octet[7]; - if ((IeType != IE_SUPP_RATES) || (*pSupRateLen > MAX_LEN_OF_SUPPORTED_RATES)) - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerAssocRspSanity fail - wrong SupportedRates IE\n")); - return FALSE; - } - else - NdisMoveMemory(SupRate, &pFrame->Octet[8], *pSupRateLen); - - Length = Length + 2 + *pSupRateLen; - - // many AP implement proprietary IEs in non-standard order, we'd better - // tolerate mis-ordered IEs to get best compatibility - pEid = (PEID_STRUCT) &pFrame->Octet[8 + (*pSupRateLen)]; - - // get variable fields from payload and advance the pointer - while ((Length + 2 + pEid->Len) <= MsgLen) - { - switch (pEid->Eid) - { - case IE_EXT_SUPP_RATES: - if (pEid->Len <= MAX_LEN_OF_SUPPORTED_RATES) - { - NdisMoveMemory(ExtRate, pEid->Octet, pEid->Len); - *pExtRateLen = pEid->Len; - } - break; - - case IE_HT_CAP: - case IE_HT_CAP2: - if (pEid->Len >= SIZE_HT_CAP_IE) //Note: allow extension.!! + COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); + Ptr = (PCHAR) pFrame->Octet; + Length += LENGTH_802_11; + + NdisMoveMemory(pCapabilityInfo, &pFrame->Octet[0], 2); + Length += 2; + NdisMoveMemory(pStatus, &pFrame->Octet[2], 2); + Length += 2; + *pCkipFlag = 0; + *pExtRateLen = 0; + pEdcaParm->bValid = FALSE; + + if (*pStatus != MLME_SUCCESS) + return TRUE; + + NdisMoveMemory(pAid, &pFrame->Octet[4], 2); + Length += 2; + + // Aid already swaped byte order in RTMPFrameEndianChange() for big endian platform + *pAid = (*pAid) & 0x3fff; // AID is low 14-bit + + // -- get supported rates from payload and advance the pointer + IeType = pFrame->Octet[6]; + *pSupRateLen = pFrame->Octet[7]; + if ((IeType != IE_SUPP_RATES) + || (*pSupRateLen > MAX_LEN_OF_SUPPORTED_RATES)) { + DBGPRINT(RT_DEBUG_TRACE, + ("PeerAssocRspSanity fail - wrong SupportedRates IE\n")); + return FALSE; + } else + NdisMoveMemory(SupRate, &pFrame->Octet[8], *pSupRateLen); + + Length = Length + 2 + *pSupRateLen; + + // many AP implement proprietary IEs in non-standard order, we'd better + // tolerate mis-ordered IEs to get best compatibility + pEid = (PEID_STRUCT) & pFrame->Octet[8 + (*pSupRateLen)]; + + // get variable fields from payload and advance the pointer + while ((Length + 2 + pEid->Len) <= MsgLen) { + switch (pEid->Eid) { + case IE_EXT_SUPP_RATES: + if (pEid->Len <= MAX_LEN_OF_SUPPORTED_RATES) { + NdisMoveMemory(ExtRate, pEid->Octet, pEid->Len); + *pExtRateLen = pEid->Len; + } + break; + + case IE_HT_CAP: + case IE_HT_CAP2: + if (pEid->Len >= SIZE_HT_CAP_IE) //Note: allow extension.!! { - NdisMoveMemory(pHtCapability, pEid->Octet, SIZE_HT_CAP_IE); + NdisMoveMemory(pHtCapability, pEid->Octet, + SIZE_HT_CAP_IE); - *(USHORT *)(&pHtCapability->HtCapInfo) = cpu2le16(*(USHORT *)(&pHtCapability->HtCapInfo)); - *(USHORT *)(&pHtCapability->ExtHtCapInfo) = cpu2le16(*(USHORT *)(&pHtCapability->ExtHtCapInfo)); + *(USHORT *) (&pHtCapability->HtCapInfo) = + cpu2le16(*(USHORT *) + (&pHtCapability->HtCapInfo)); + *(USHORT *) (&pHtCapability->ExtHtCapInfo) = + cpu2le16(*(USHORT *) + (&pHtCapability->ExtHtCapInfo)); *pHtCapabilityLen = SIZE_HT_CAP_IE; - } - else - { - DBGPRINT(RT_DEBUG_WARN, ("PeerAssocRspSanity - wrong IE_HT_CAP. \n")); + } else { + DBGPRINT(RT_DEBUG_WARN, + ("PeerAssocRspSanity - wrong IE_HT_CAP. \n")); } - break; - case IE_ADD_HT: - case IE_ADD_HT2: - if (pEid->Len >= sizeof(ADD_HT_INFO_IE)) - { + break; + case IE_ADD_HT: + case IE_ADD_HT2: + if (pEid->Len >= sizeof(ADD_HT_INFO_IE)) { // This IE allows extension, but we can ignore extra bytes beyond our knowledge , so only // copy first sizeof(ADD_HT_INFO_IE) - NdisMoveMemory(pAddHtInfo, pEid->Octet, sizeof(ADD_HT_INFO_IE)); + NdisMoveMemory(pAddHtInfo, pEid->Octet, + sizeof(ADD_HT_INFO_IE)); - *(USHORT *)(&pAddHtInfo->AddHtInfo2) = cpu2le16(*(USHORT *)(&pAddHtInfo->AddHtInfo2)); - *(USHORT *)(&pAddHtInfo->AddHtInfo3) = cpu2le16(*(USHORT *)(&pAddHtInfo->AddHtInfo3)); + *(USHORT *) (&pAddHtInfo->AddHtInfo2) = + cpu2le16(*(USHORT *) + (&pAddHtInfo->AddHtInfo2)); + *(USHORT *) (&pAddHtInfo->AddHtInfo3) = + cpu2le16(*(USHORT *) + (&pAddHtInfo->AddHtInfo3)); *pAddHtInfoLen = SIZE_ADD_HT_INFO_IE; - } - else - { - DBGPRINT(RT_DEBUG_WARN, ("PeerAssocRspSanity - wrong IE_ADD_HT. \n")); + } else { + DBGPRINT(RT_DEBUG_WARN, + ("PeerAssocRspSanity - wrong IE_ADD_HT. \n")); } - break; - case IE_SECONDARY_CH_OFFSET: - if (pEid->Len == 1) - { + break; + case IE_SECONDARY_CH_OFFSET: + if (pEid->Len == 1) { *pNewExtChannelOffset = pEid->Octet[0]; + } else { + DBGPRINT(RT_DEBUG_WARN, + ("PeerAssocRspSanity - wrong IE_SECONDARY_CH_OFFSET. \n")); } - else - { - DBGPRINT(RT_DEBUG_WARN, ("PeerAssocRspSanity - wrong IE_SECONDARY_CH_OFFSET. \n")); + break; + + case IE_VENDOR_SPECIFIC: + // handle WME PARAMTER ELEMENT + if (NdisEqualMemory(pEid->Octet, WME_PARM_ELEM, 6) + && (pEid->Len == 24)) { + PUCHAR ptr; + int i; + + // parsing EDCA parameters + pEdcaParm->bValid = TRUE; + pEdcaParm->bQAck = FALSE; // pEid->Octet[0] & 0x10; + pEdcaParm->bQueueRequest = FALSE; // pEid->Octet[0] & 0x20; + pEdcaParm->bTxopRequest = FALSE; // pEid->Octet[0] & 0x40; + //pEdcaParm->bMoreDataAck = FALSE; // pEid->Octet[0] & 0x80; + pEdcaParm->EdcaUpdateCount = + pEid->Octet[6] & 0x0f; + pEdcaParm->bAPSDCapable = + (pEid->Octet[6] & 0x80) ? 1 : 0; + ptr = (PUCHAR) & pEid->Octet[8]; + for (i = 0; i < 4; i++) { + UCHAR aci = (*ptr & 0x60) >> 5; // b5~6 is AC INDEX + pEdcaParm->bACM[aci] = (((*ptr) & 0x10) == 0x10); // b5 is ACM + pEdcaParm->Aifsn[aci] = (*ptr) & 0x0f; // b0~3 is AIFSN + pEdcaParm->Cwmin[aci] = *(ptr + 1) & 0x0f; // b0~4 is Cwmin + pEdcaParm->Cwmax[aci] = *(ptr + 1) >> 4; // b5~8 is Cwmax + pEdcaParm->Txop[aci] = *(ptr + 2) + 256 * (*(ptr + 3)); // in unit of 32-us + ptr += 4; // point to next AC + } } - break; - - case IE_VENDOR_SPECIFIC: - // handle WME PARAMTER ELEMENT - if (NdisEqualMemory(pEid->Octet, WME_PARM_ELEM, 6) && (pEid->Len == 24)) - { - PUCHAR ptr; - int i; - - // parsing EDCA parameters - pEdcaParm->bValid = TRUE; - pEdcaParm->bQAck = FALSE; // pEid->Octet[0] & 0x10; - pEdcaParm->bQueueRequest = FALSE; // pEid->Octet[0] & 0x20; - pEdcaParm->bTxopRequest = FALSE; // pEid->Octet[0] & 0x40; - //pEdcaParm->bMoreDataAck = FALSE; // pEid->Octet[0] & 0x80; - pEdcaParm->EdcaUpdateCount = pEid->Octet[6] & 0x0f; - pEdcaParm->bAPSDCapable = (pEid->Octet[6] & 0x80) ? 1 : 0; - ptr = (PUCHAR)&pEid->Octet[8]; - for (i=0; i<4; i++) - { - UCHAR aci = (*ptr & 0x60) >> 5; // b5~6 is AC INDEX - pEdcaParm->bACM[aci] = (((*ptr) & 0x10) == 0x10); // b5 is ACM - pEdcaParm->Aifsn[aci] = (*ptr) & 0x0f; // b0~3 is AIFSN - pEdcaParm->Cwmin[aci] = *(ptr+1) & 0x0f; // b0~4 is Cwmin - pEdcaParm->Cwmax[aci] = *(ptr+1) >> 4; // b5~8 is Cwmax - pEdcaParm->Txop[aci] = *(ptr+2) + 256 * (*(ptr+3)); // in unit of 32-us - ptr += 4; // point to next AC - } - } - break; - default: - DBGPRINT(RT_DEBUG_TRACE, ("PeerAssocRspSanity - ignore unrecognized EID = %d\n", pEid->Eid)); - break; - } - - Length = Length + 2 + pEid->Len; - pEid = (PEID_STRUCT)((UCHAR*)pEid + 2 + pEid->Len); - } - - - return TRUE; + break; + default: + DBGPRINT(RT_DEBUG_TRACE, + ("PeerAssocRspSanity - ignore unrecognized EID = %d\n", + pEid->Eid)); + break; + } + + Length = Length + 2 + pEid->Len; + pEid = (PEID_STRUCT) ((UCHAR *) pEid + 2 + pEid->Len); + } + + return TRUE; } /* @@ -266,47 +254,46 @@ BOOLEAN PeerAssocRspSanity( ========================================================================== */ -BOOLEAN PeerProbeReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT CHAR Ssid[], - OUT UCHAR *pSsidLen) +BOOLEAN PeerProbeReqSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, + IN ULONG MsgLen, + OUT PUCHAR pAddr2, + OUT CHAR Ssid[], OUT UCHAR * pSsidLen) { - UCHAR Idx; - UCHAR RateLen; - CHAR IeType; - PFRAME_802_11 pFrame = (PFRAME_802_11)Msg; - - COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); - - if ((pFrame->Octet[0] != IE_SSID) || (pFrame->Octet[1] > MAX_LEN_OF_SSID)) - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerProbeReqSanity fail - wrong SSID IE(Type=%d,Len=%d)\n",pFrame->Octet[0],pFrame->Octet[1])); - return FALSE; - } - - *pSsidLen = pFrame->Octet[1]; - NdisMoveMemory(Ssid, &pFrame->Octet[2], *pSsidLen); - - Idx = *pSsidLen + 2; - - // -- get supported rates from payload and advance the pointer - IeType = pFrame->Octet[Idx]; - RateLen = pFrame->Octet[Idx + 1]; - if (IeType != IE_SUPP_RATES) - { - DBGPRINT(RT_DEBUG_TRACE, ("PeerProbeReqSanity fail - wrong SupportRates IE(Type=%d,Len=%d)\n",pFrame->Octet[Idx],pFrame->Octet[Idx+1])); - return FALSE; - } - else - { - if ((pAd->CommonCfg.PhyMode == PHY_11G) && (RateLen < 8)) - return (FALSE); - } - - return TRUE; + UCHAR Idx; + UCHAR RateLen; + CHAR IeType; + PFRAME_802_11 pFrame = (PFRAME_802_11) Msg; + + COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); + + if ((pFrame->Octet[0] != IE_SSID) + || (pFrame->Octet[1] > MAX_LEN_OF_SSID)) { + DBGPRINT(RT_DEBUG_TRACE, + ("PeerProbeReqSanity fail - wrong SSID IE(Type=%d,Len=%d)\n", + pFrame->Octet[0], pFrame->Octet[1])); + return FALSE; + } + + *pSsidLen = pFrame->Octet[1]; + NdisMoveMemory(Ssid, &pFrame->Octet[2], *pSsidLen); + + Idx = *pSsidLen + 2; + + // -- get supported rates from payload and advance the pointer + IeType = pFrame->Octet[Idx]; + RateLen = pFrame->Octet[Idx + 1]; + if (IeType != IE_SUPP_RATES) { + DBGPRINT(RT_DEBUG_TRACE, + ("PeerProbeReqSanity fail - wrong SupportRates IE(Type=%d,Len=%d)\n", + pFrame->Octet[Idx], pFrame->Octet[Idx + 1])); + return FALSE; + } else { + if ((pAd->CommonCfg.PhyMode == PHY_11G) && (RateLen < 8)) + return (FALSE); + } + + return TRUE; } /* @@ -317,62 +304,58 @@ BOOLEAN PeerProbeReqSanity( ========================================================================== */ -BOOLEAN GetTimBit( - IN CHAR *Ptr, - IN USHORT Aid, - OUT UCHAR *TimLen, - OUT UCHAR *BcastFlag, - OUT UCHAR *DtimCount, - OUT UCHAR *DtimPeriod, - OUT UCHAR *MessageToMe) +BOOLEAN GetTimBit(IN CHAR * Ptr, + IN USHORT Aid, + OUT UCHAR * TimLen, + OUT UCHAR * BcastFlag, + OUT UCHAR * DtimCount, + OUT UCHAR * DtimPeriod, OUT UCHAR * MessageToMe) { - UCHAR BitCntl, N1, N2, MyByte, MyBit; - CHAR *IdxPtr; + UCHAR BitCntl, N1, N2, MyByte, MyBit; + CHAR *IdxPtr; - IdxPtr = Ptr; + IdxPtr = Ptr; - IdxPtr ++; - *TimLen = *IdxPtr; + IdxPtr++; + *TimLen = *IdxPtr; - // get DTIM Count from TIM element - IdxPtr ++; - *DtimCount = *IdxPtr; + // get DTIM Count from TIM element + IdxPtr++; + *DtimCount = *IdxPtr; - // get DTIM Period from TIM element - IdxPtr++; - *DtimPeriod = *IdxPtr; + // get DTIM Period from TIM element + IdxPtr++; + *DtimPeriod = *IdxPtr; - // get Bitmap Control from TIM element - IdxPtr++; - BitCntl = *IdxPtr; + // get Bitmap Control from TIM element + IdxPtr++; + BitCntl = *IdxPtr; - if ((*DtimCount == 0) && (BitCntl & 0x01)) - *BcastFlag = TRUE; - else - *BcastFlag = FALSE; + if ((*DtimCount == 0) && (BitCntl & 0x01)) + *BcastFlag = TRUE; + else + *BcastFlag = FALSE; - // Parse Partial Virtual Bitmap from TIM element - N1 = BitCntl & 0xfe; // N1 is the first bitmap byte# - N2 = *TimLen - 4 + N1; // N2 is the last bitmap byte# + // Parse Partial Virtual Bitmap from TIM element + N1 = BitCntl & 0xfe; // N1 is the first bitmap byte# + N2 = *TimLen - 4 + N1; // N2 is the last bitmap byte# - if ((Aid < (N1 << 3)) || (Aid >= ((N2 + 1) << 3))) - *MessageToMe = FALSE; - else - { - MyByte = (Aid >> 3) - N1; // my byte position in the bitmap byte-stream - MyBit = Aid % 16 - ((MyByte & 0x01)? 8:0); + if ((Aid < (N1 << 3)) || (Aid >= ((N2 + 1) << 3))) + *MessageToMe = FALSE; + else { + MyByte = (Aid >> 3) - N1; // my byte position in the bitmap byte-stream + MyBit = Aid % 16 - ((MyByte & 0x01) ? 8 : 0); - IdxPtr += (MyByte + 1); + IdxPtr += (MyByte + 1); - //if (*IdxPtr) - // DBGPRINT(RT_DEBUG_WARN, ("TIM bitmap = 0x%02x\n", *IdxPtr)); + //if (*IdxPtr) + // DBGPRINT(RT_DEBUG_WARN, ("TIM bitmap = 0x%02x\n", *IdxPtr)); - if (*IdxPtr & (0x01 << MyBit)) - *MessageToMe = TRUE; - else - *MessageToMe = FALSE; - } + if (*IdxPtr & (0x01 << MyBit)) + *MessageToMe = TRUE; + else + *MessageToMe = FALSE; + } - return TRUE; + return TRUE; } - diff --git a/drivers/staging/rt2860/sta/sync.c b/drivers/staging/rt2860/sta/sync.c index dc71c1dabc7b..56bb797e61a3 100644 --- a/drivers/staging/rt2860/sta/sync.c +++ b/drivers/staging/rt2860/sta/sync.c @@ -37,7 +37,6 @@ */ #include "../rt_config.h" - #define ADHOC_ENTRY_BEACON_LOST_TIME (2*OS_HZ) // 2 sec /* @@ -51,38 +50,56 @@ ========================================================================== */ -VOID SyncStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *Sm, - OUT STATE_MACHINE_FUNC Trans[]) +VOID SyncStateMachineInit(IN PRTMP_ADAPTER pAd, + IN STATE_MACHINE * Sm, OUT STATE_MACHINE_FUNC Trans[]) { - StateMachineInit(Sm, Trans, MAX_SYNC_STATE, MAX_SYNC_MSG, (STATE_MACHINE_FUNC)Drop, SYNC_IDLE, SYNC_MACHINE_BASE); + StateMachineInit(Sm, Trans, MAX_SYNC_STATE, MAX_SYNC_MSG, + (STATE_MACHINE_FUNC) Drop, SYNC_IDLE, + SYNC_MACHINE_BASE); // column 1 - StateMachineSetAction(Sm, SYNC_IDLE, MT2_MLME_SCAN_REQ, (STATE_MACHINE_FUNC)MlmeScanReqAction); - StateMachineSetAction(Sm, SYNC_IDLE, MT2_MLME_JOIN_REQ, (STATE_MACHINE_FUNC)MlmeJoinReqAction); - StateMachineSetAction(Sm, SYNC_IDLE, MT2_MLME_START_REQ, (STATE_MACHINE_FUNC)MlmeStartReqAction); - StateMachineSetAction(Sm, SYNC_IDLE, MT2_PEER_BEACON, (STATE_MACHINE_FUNC)PeerBeacon); - StateMachineSetAction(Sm, SYNC_IDLE, MT2_PEER_PROBE_REQ, (STATE_MACHINE_FUNC)PeerProbeReqAction); + StateMachineSetAction(Sm, SYNC_IDLE, MT2_MLME_SCAN_REQ, + (STATE_MACHINE_FUNC) MlmeScanReqAction); + StateMachineSetAction(Sm, SYNC_IDLE, MT2_MLME_JOIN_REQ, + (STATE_MACHINE_FUNC) MlmeJoinReqAction); + StateMachineSetAction(Sm, SYNC_IDLE, MT2_MLME_START_REQ, + (STATE_MACHINE_FUNC) MlmeStartReqAction); + StateMachineSetAction(Sm, SYNC_IDLE, MT2_PEER_BEACON, + (STATE_MACHINE_FUNC) PeerBeacon); + StateMachineSetAction(Sm, SYNC_IDLE, MT2_PEER_PROBE_REQ, + (STATE_MACHINE_FUNC) PeerProbeReqAction); //column 2 - StateMachineSetAction(Sm, JOIN_WAIT_BEACON, MT2_MLME_SCAN_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenScan); - StateMachineSetAction(Sm, JOIN_WAIT_BEACON, MT2_MLME_JOIN_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenJoin); - StateMachineSetAction(Sm, JOIN_WAIT_BEACON, MT2_MLME_START_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenStart); - StateMachineSetAction(Sm, JOIN_WAIT_BEACON, MT2_PEER_BEACON, (STATE_MACHINE_FUNC)PeerBeaconAtJoinAction); - StateMachineSetAction(Sm, JOIN_WAIT_BEACON, MT2_BEACON_TIMEOUT, (STATE_MACHINE_FUNC)BeaconTimeoutAtJoinAction); + StateMachineSetAction(Sm, JOIN_WAIT_BEACON, MT2_MLME_SCAN_REQ, + (STATE_MACHINE_FUNC) InvalidStateWhenScan); + StateMachineSetAction(Sm, JOIN_WAIT_BEACON, MT2_MLME_JOIN_REQ, + (STATE_MACHINE_FUNC) InvalidStateWhenJoin); + StateMachineSetAction(Sm, JOIN_WAIT_BEACON, MT2_MLME_START_REQ, + (STATE_MACHINE_FUNC) InvalidStateWhenStart); + StateMachineSetAction(Sm, JOIN_WAIT_BEACON, MT2_PEER_BEACON, + (STATE_MACHINE_FUNC) PeerBeaconAtJoinAction); + StateMachineSetAction(Sm, JOIN_WAIT_BEACON, MT2_BEACON_TIMEOUT, + (STATE_MACHINE_FUNC) BeaconTimeoutAtJoinAction); // column 3 - StateMachineSetAction(Sm, SCAN_LISTEN, MT2_MLME_SCAN_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenScan); - StateMachineSetAction(Sm, SCAN_LISTEN, MT2_MLME_JOIN_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenJoin); - StateMachineSetAction(Sm, SCAN_LISTEN, MT2_MLME_START_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenStart); - StateMachineSetAction(Sm, SCAN_LISTEN, MT2_PEER_BEACON, (STATE_MACHINE_FUNC)PeerBeaconAtScanAction); - StateMachineSetAction(Sm, SCAN_LISTEN, MT2_PEER_PROBE_RSP, (STATE_MACHINE_FUNC)PeerBeaconAtScanAction); - StateMachineSetAction(Sm, SCAN_LISTEN, MT2_SCAN_TIMEOUT, (STATE_MACHINE_FUNC)ScanTimeoutAction); + StateMachineSetAction(Sm, SCAN_LISTEN, MT2_MLME_SCAN_REQ, + (STATE_MACHINE_FUNC) InvalidStateWhenScan); + StateMachineSetAction(Sm, SCAN_LISTEN, MT2_MLME_JOIN_REQ, + (STATE_MACHINE_FUNC) InvalidStateWhenJoin); + StateMachineSetAction(Sm, SCAN_LISTEN, MT2_MLME_START_REQ, + (STATE_MACHINE_FUNC) InvalidStateWhenStart); + StateMachineSetAction(Sm, SCAN_LISTEN, MT2_PEER_BEACON, + (STATE_MACHINE_FUNC) PeerBeaconAtScanAction); + StateMachineSetAction(Sm, SCAN_LISTEN, MT2_PEER_PROBE_RSP, + (STATE_MACHINE_FUNC) PeerBeaconAtScanAction); + StateMachineSetAction(Sm, SCAN_LISTEN, MT2_SCAN_TIMEOUT, + (STATE_MACHINE_FUNC) ScanTimeoutAction); // timer init - RTMPInitTimer(pAd, &pAd->MlmeAux.BeaconTimer, GET_TIMER_FUNCTION(BeaconTimeout), pAd, FALSE); - RTMPInitTimer(pAd, &pAd->MlmeAux.ScanTimer, GET_TIMER_FUNCTION(ScanTimeout), pAd, FALSE); + RTMPInitTimer(pAd, &pAd->MlmeAux.BeaconTimer, + GET_TIMER_FUNCTION(BeaconTimeout), pAd, FALSE); + RTMPInitTimer(pAd, &pAd->MlmeAux.ScanTimer, + GET_TIMER_FUNCTION(ScanTimeout), pAd, FALSE); } /* @@ -94,15 +111,13 @@ VOID SyncStateMachineInit( ========================================================================== */ -VOID BeaconTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +VOID BeaconTimeout(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; + RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; - DBGPRINT(RT_DEBUG_TRACE,("SYNC - BeaconTimeout\n")); + DBGPRINT(RT_DEBUG_TRACE, ("SYNC - BeaconTimeout\n")); // Do nothing if the driver is starting halt state. // This might happen when timer already been fired before cancel timer with mlmehalt @@ -110,16 +125,17 @@ VOID BeaconTimeout( return; if ((pAd->CommonCfg.BBPCurrentBW == BW_40) - ) - { - UCHAR BBPValue = 0; + ) { + UCHAR BBPValue = 0; AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); BBPValue &= (~0x18); BBPValue |= 0x10; RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - End of SCAN, restore to 40MHz channel %d, Total BSS[%02d]\n",pAd->CommonCfg.CentralChannel, pAd->ScanTab.BssNr)); + DBGPRINT(RT_DEBUG_TRACE, + ("SYNC - End of SCAN, restore to 40MHz channel %d, Total BSS[%02d]\n", + pAd->CommonCfg.CentralChannel, pAd->ScanTab.BssNr)); } MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_BEACON_TIMEOUT, 0, NULL); @@ -135,32 +151,28 @@ VOID BeaconTimeout( ========================================================================== */ -VOID ScanTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +VOID ScanTimeout(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; - + RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; // Do nothing if the driver is starting halt state. // This might happen when timer already been fired before cancel timer with mlmehalt if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) return; - if (MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_SCAN_TIMEOUT, 0, NULL)) - { - RTMP_MLME_HANDLER(pAd); -} - else - { + if (MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_SCAN_TIMEOUT, 0, NULL)) { + RTMP_MLME_HANDLER(pAd); + } else { // To prevent SyncMachine.CurrState is SCAN_LISTEN forever. pAd->MlmeAux.Channel = 0; ScanNextChannel(pAd); - if (pAd->CommonCfg.bWirelessEvent) - { - RTMPSendWirelessEvent(pAd, IW_SCAN_ENQUEUE_FAIL_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); + if (pAd->CommonCfg.bWirelessEvent) { + RTMPSendWirelessEvent(pAd, + IW_SCAN_ENQUEUE_FAIL_EVENT_FLAG, + pAd->MacTab.Content[BSSID_WCID]. + Addr, BSS0, 0); } } } @@ -171,83 +183,78 @@ VOID ScanTimeout( MLME SCAN req state machine procedure ========================================================================== */ -VOID MlmeScanReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID MlmeScanReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Ssid[MAX_LEN_OF_SSID], SsidLen, ScanType, BssType, BBPValue = 0; - BOOLEAN TimerCancelled; - ULONG Now; - USHORT Status; + UCHAR Ssid[MAX_LEN_OF_SSID], SsidLen, ScanType, BssType, BBPValue = 0; + BOOLEAN TimerCancelled; + ULONG Now; + USHORT Status; PHEADER_802_11 pHdr80211; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; + PUCHAR pOutBuffer = NULL; + NDIS_STATUS NStatus; // Check the total scan tries for one single OID command // If this is the CCX 2.0 Case, skip that! - if ( !RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_START_UP)) - { - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - MlmeScanReqAction before Startup\n")); + if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_START_UP)) { + DBGPRINT(RT_DEBUG_TRACE, + ("SYNC - MlmeScanReqAction before Startup\n")); return; } - // Increase the scan retry counters. pAd->StaCfg.ScanCnt++; #ifdef RTMP_MAC_PCI - if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) && - (IDLE_ON(pAd)) && - (pAd->StaCfg.bRadio == TRUE) && - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) - { - if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) - { - AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x02); + if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) && + (IDLE_ON(pAd)) && + (pAd->StaCfg.bRadio == TRUE) && + (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) { + if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) { + AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, + 0x02); AsicCheckCommanOk(pAd, PowerWakeCID); RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); - DBGPRINT(RT_DEBUG_TRACE, ("PSM - Issue Wake up command \n")); + DBGPRINT(RT_DEBUG_TRACE, + ("PSM - Issue Wake up command \n")); + } else { + RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); } - else - { - RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); - } } #endif // RTMP_MAC_PCI // // first check the parameter sanity if (MlmeScanReqSanity(pAd, - Elem->Msg, - Elem->MsgLen, - &BssType, - (PCHAR)Ssid, - &SsidLen, - &ScanType)) - { + Elem->Msg, + Elem->MsgLen, + &BssType, (PCHAR) Ssid, &SsidLen, &ScanType)) { // Check for channel load and noise hist request // Suspend MSDU only at scan request, not the last two mentioned - // Suspend MSDU transmission here - RTMPSuspendMsduTransmission(pAd); + // Suspend MSDU transmission here + RTMPSuspendMsduTransmission(pAd); // // To prevent data lost. // Send an NULL data with turned PSM bit on to current associated AP before SCAN progress. // And should send an NULL data with turned PSM bit off to AP, when scan progress done // - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) && (INFRA_ON(pAd))) - { - NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); - if (NStatus == NDIS_STATUS_SUCCESS) - { + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) + && (INFRA_ON(pAd))) { + NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); + if (NStatus == NDIS_STATUS_SUCCESS) { pHdr80211 = (PHEADER_802_11) pOutBuffer; - MgtMacHeaderInit(pAd, pHdr80211, SUBTYPE_NULL_FUNC, 1, pAd->CommonCfg.Bssid, pAd->CommonCfg.Bssid); + MgtMacHeaderInit(pAd, pHdr80211, + SUBTYPE_NULL_FUNC, 1, + pAd->CommonCfg.Bssid, + pAd->CommonCfg.Bssid); pHdr80211->Duration = 0; pHdr80211->FC.Type = BTYPE_DATA; pHdr80211->FC.PwrMgmt = PWR_SAVE; // Send using priority queue - MiniportMMRequest(pAd, 0, pOutBuffer, sizeof(HEADER_802_11)); - DBGPRINT(RT_DEBUG_TRACE, ("MlmeScanReqAction -- Send PSM Data frame for off channel RM\n")); + MiniportMMRequest(pAd, 0, pOutBuffer, + sizeof(HEADER_802_11)); + DBGPRINT(RT_DEBUG_TRACE, + ("MlmeScanReqAction -- Send PSM Data frame for off channel RM\n")); MlmeFreeMemory(pAd, pOutBuffer); RTMPusecDelay(5000); } @@ -263,7 +270,7 @@ VOID MlmeScanReqAction( pAd->MlmeAux.BssType = BssType; pAd->MlmeAux.ScanType = ScanType; pAd->MlmeAux.SsidLen = SsidLen; - NdisZeroMemory(pAd->MlmeAux.Ssid, MAX_LEN_OF_SSID); + NdisZeroMemory(pAd->MlmeAux.Ssid, MAX_LEN_OF_SSID); NdisMoveMemory(pAd->MlmeAux.Ssid, Ssid, SsidLen); // start from the first channel @@ -275,13 +282,12 @@ VOID MlmeScanReqAction( RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); DBGPRINT(RT_DEBUG_TRACE, ("SYNC - BBP R4 to 20MHz.l\n")); ScanNextChannel(pAd); - } - else - { + } else { DBGPRINT_ERR(("SYNC - MlmeScanReqAction() sanity check fail\n")); pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; Status = MLME_INVALID_FORMAT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_SCAN_CONF, 2, &Status); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_SCAN_CONF, 2, + &Status); } } @@ -291,33 +297,31 @@ VOID MlmeScanReqAction( MLME JOIN req state machine procedure ========================================================================== */ -VOID MlmeJoinReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID MlmeJoinReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR BBPValue = 0; - BSS_ENTRY *pBss; - BOOLEAN TimerCancelled; + UCHAR BBPValue = 0; + BSS_ENTRY *pBss; + BOOLEAN TimerCancelled; HEADER_802_11 Hdr80211; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - PUCHAR pOutBuffer = NULL; - PUCHAR pSupRate = NULL; - UCHAR SupRateLen; - PUCHAR pExtRate = NULL; - UCHAR ExtRateLen; - UCHAR ASupRate[] = {0x8C, 0x12, 0x98, 0x24, 0xb0, 0x48, 0x60, 0x6C}; - UCHAR ASupRateLen = sizeof(ASupRate)/sizeof(UCHAR); - MLME_JOIN_REQ_STRUCT *pInfo = (MLME_JOIN_REQ_STRUCT *)(Elem->Msg); - - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - MlmeJoinReqAction(BSS #%ld)\n", pInfo->BssIdx)); + NDIS_STATUS NStatus; + ULONG FrameLen = 0; + PUCHAR pOutBuffer = NULL; + PUCHAR pSupRate = NULL; + UCHAR SupRateLen; + PUCHAR pExtRate = NULL; + UCHAR ExtRateLen; + UCHAR ASupRate[] = { 0x8C, 0x12, 0x98, 0x24, 0xb0, 0x48, 0x60, 0x6C }; + UCHAR ASupRateLen = sizeof(ASupRate) / sizeof(UCHAR); + MLME_JOIN_REQ_STRUCT *pInfo = (MLME_JOIN_REQ_STRUCT *) (Elem->Msg); + + DBGPRINT(RT_DEBUG_TRACE, + ("SYNC - MlmeJoinReqAction(BSS #%ld)\n", pInfo->BssIdx)); #ifdef RTMP_MAC_PCI - if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) && - (IDLE_ON(pAd)) && - (pAd->StaCfg.bRadio == TRUE) && - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) - { + if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) && + (IDLE_ON(pAd)) && + (pAd->StaCfg.bRadio == TRUE) && + (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) { RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); } #endif // RTMP_MAC_PCI // @@ -332,8 +336,7 @@ VOID MlmeJoinReqAction( COPY_MAC_ADDR(pAd->MlmeAux.Bssid, pBss->Bssid); // If AP's SSID is not hidden, it is OK for updating ssid to MlmeAux again. - if (pBss->Hidden == 0) - { + if (pBss->Hidden == 0) { RTMPZeroMemory(pAd->MlmeAux.Ssid, MAX_LEN_OF_SSID); NdisMoveMemory(pAd->MlmeAux.Ssid, pBss->Ssid, pBss->SsidLen); pAd->MlmeAux.SsidLen = pBss->SsidLen; @@ -343,7 +346,6 @@ VOID MlmeJoinReqAction( pAd->MlmeAux.Channel = pBss->Channel; pAd->MlmeAux.CentralChannel = pBss->CentralChannel; - // Let BBP register at 20MHz to do scan RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); BBPValue &= (~0x18); @@ -356,35 +358,28 @@ VOID MlmeJoinReqAction( AsicLockChannel(pAd, pAd->MlmeAux.Channel); RTMPSetTimer(&pAd->MlmeAux.BeaconTimer, JOIN_TIMEOUT); - do - { + do { if (((pAd->CommonCfg.bIEEE80211H == 1) && - (pAd->MlmeAux.Channel > 14) && - RadarChannelCheck(pAd, pAd->MlmeAux.Channel)) - ) - { + (pAd->MlmeAux.Channel > 14) && + RadarChannelCheck(pAd, pAd->MlmeAux.Channel)) + ) { // // We can't send any Probe request frame to meet 802.11h. // if (pBss->Hidden == 0) break; } - // // send probe request // NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); - if (NStatus == NDIS_STATUS_SUCCESS) - { - if (pAd->MlmeAux.Channel <= 14) - { + if (NStatus == NDIS_STATUS_SUCCESS) { + if (pAd->MlmeAux.Channel <= 14) { pSupRate = pAd->CommonCfg.SupRate; SupRateLen = pAd->CommonCfg.SupRateLen; pExtRate = pAd->CommonCfg.ExtRate; ExtRateLen = pAd->CommonCfg.ExtRateLen; - } - else - { + } else { // // Overwrite Support Rate, CCK rate are not allowed // @@ -394,39 +389,44 @@ VOID MlmeJoinReqAction( } if (pAd->MlmeAux.BssType == BSS_INFRA) - MgtMacHeaderInit(pAd, &Hdr80211, SUBTYPE_PROBE_REQ, 0, pAd->MlmeAux.Bssid, pAd->MlmeAux.Bssid); + MgtMacHeaderInit(pAd, &Hdr80211, + SUBTYPE_PROBE_REQ, 0, + pAd->MlmeAux.Bssid, + pAd->MlmeAux.Bssid); else - MgtMacHeaderInit(pAd, &Hdr80211, SUBTYPE_PROBE_REQ, 0, BROADCAST_ADDR, BROADCAST_ADDR); - - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &Hdr80211, - 1, &SsidIe, - 1, &pAd->MlmeAux.SsidLen, - pAd->MlmeAux.SsidLen, pAd->MlmeAux.Ssid, - 1, &SupRateIe, - 1, &SupRateLen, - SupRateLen, pSupRate, - END_OF_ARGS); - - if (ExtRateLen) - { + MgtMacHeaderInit(pAd, &Hdr80211, + SUBTYPE_PROBE_REQ, 0, + BROADCAST_ADDR, + BROADCAST_ADDR); + + MakeOutgoingFrame(pOutBuffer, &FrameLen, + sizeof(HEADER_802_11), &Hdr80211, + 1, &SsidIe, + 1, &pAd->MlmeAux.SsidLen, + pAd->MlmeAux.SsidLen, + pAd->MlmeAux.Ssid, 1, &SupRateIe, 1, + &SupRateLen, SupRateLen, pSupRate, + END_OF_ARGS); + + if (ExtRateLen) { ULONG Tmp; - MakeOutgoingFrame(pOutBuffer + FrameLen, &Tmp, - 1, &ExtRateIe, - 1, &ExtRateLen, - ExtRateLen, pExtRate, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer + FrameLen, &Tmp, + 1, &ExtRateIe, + 1, &ExtRateLen, + ExtRateLen, pExtRate, + END_OF_ARGS); FrameLen += Tmp; } - MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); } - } while (FALSE); + } while (FALSE); - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - Switch to ch %d, Wait BEACON from %02x:%02x:%02x:%02x:%02x:%02x\n", - pBss->Channel, pBss->Bssid[0], pBss->Bssid[1], pBss->Bssid[2], pBss->Bssid[3], pBss->Bssid[4], pBss->Bssid[5])); + DBGPRINT(RT_DEBUG_TRACE, + ("SYNC - Switch to ch %d, Wait BEACON from %02x:%02x:%02x:%02x:%02x:%02x\n", + pBss->Channel, pBss->Bssid[0], pBss->Bssid[1], pBss->Bssid[2], + pBss->Bssid[3], pBss->Bssid[4], pBss->Bssid[5])); pAd->Mlme.SyncMachine.CurrState = JOIN_WAIT_BEACON; } @@ -437,28 +437,26 @@ VOID MlmeJoinReqAction( MLME START Request state machine procedure, starting an IBSS ========================================================================== */ -VOID MlmeStartReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID MlmeStartReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Ssid[MAX_LEN_OF_SSID], SsidLen; - BOOLEAN TimerCancelled; + UCHAR Ssid[MAX_LEN_OF_SSID], SsidLen; + BOOLEAN TimerCancelled; // New for WPA security suites - UCHAR VarIE[MAX_VIE_LEN]; // Total VIE length = MAX_VIE_LEN - -5 - NDIS_802_11_VARIABLE_IEs *pVIE = NULL; - LARGE_INTEGER TimeStamp; + UCHAR VarIE[MAX_VIE_LEN]; // Total VIE length = MAX_VIE_LEN - -5 + NDIS_802_11_VARIABLE_IEs *pVIE = NULL; + LARGE_INTEGER TimeStamp; BOOLEAN Privacy; USHORT Status; // Init Variable IE structure pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; pVIE->Length = 0; - TimeStamp.u.LowPart = 0; + TimeStamp.u.LowPart = 0; TimeStamp.u.HighPart = 0; - if (MlmeStartReqSanity(pAd, Elem->Msg, Elem->MsgLen, (PCHAR)Ssid, &SsidLen)) - { + if (MlmeStartReqSanity + (pAd, Elem->Msg, Elem->MsgLen, (PCHAR) Ssid, &SsidLen)) { // reset all the timers RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &TimerCancelled); RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &TimerCancelled); @@ -466,67 +464,83 @@ VOID MlmeStartReqAction( // // Start a new IBSS. All IBSS parameters are decided now.... // - DBGPRINT(RT_DEBUG_TRACE, ("MlmeStartReqAction - Start a new IBSS. All IBSS parameters are decided now.... \n")); - pAd->MlmeAux.BssType = BSS_ADHOC; + DBGPRINT(RT_DEBUG_TRACE, + ("MlmeStartReqAction - Start a new IBSS. All IBSS parameters are decided now.... \n")); + pAd->MlmeAux.BssType = BSS_ADHOC; NdisMoveMemory(pAd->MlmeAux.Ssid, Ssid, SsidLen); - pAd->MlmeAux.SsidLen = SsidLen; + pAd->MlmeAux.SsidLen = SsidLen; // generate a radom number as BSSID MacAddrRandomBssid(pAd, pAd->MlmeAux.Bssid); - DBGPRINT(RT_DEBUG_TRACE, ("MlmeStartReqAction - generate a radom number as BSSID \n")); - - Privacy = (pAd->StaCfg.WepStatus == Ndis802_11Encryption1Enabled) || - (pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) || - (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled); - pAd->MlmeAux.CapabilityInfo = CAP_GENERATE(0,1,Privacy, (pAd->CommonCfg.TxPreamble == Rt802_11PreambleShort), 1, 0); - pAd->MlmeAux.BeaconPeriod = pAd->CommonCfg.BeaconPeriod; - pAd->MlmeAux.AtimWin = pAd->StaCfg.AtimWin; - pAd->MlmeAux.Channel = pAd->CommonCfg.Channel; - - pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; - pAd->MlmeAux.CentralChannel = pAd->CommonCfg.CentralChannel; - - pAd->MlmeAux.SupRateLen= pAd->CommonCfg.SupRateLen; - NdisMoveMemory(pAd->MlmeAux.SupRate, pAd->CommonCfg.SupRate, MAX_LEN_OF_SUPPORTED_RATES); - RTMPCheckRates(pAd, pAd->MlmeAux.SupRate, &pAd->MlmeAux.SupRateLen); + DBGPRINT(RT_DEBUG_TRACE, + ("MlmeStartReqAction - generate a radom number as BSSID \n")); + + Privacy = + (pAd->StaCfg.WepStatus == Ndis802_11Encryption1Enabled) + || (pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) + || (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled); + pAd->MlmeAux.CapabilityInfo = + CAP_GENERATE(0, 1, Privacy, + (pAd->CommonCfg.TxPreamble == + Rt802_11PreambleShort), 1, 0); + pAd->MlmeAux.BeaconPeriod = pAd->CommonCfg.BeaconPeriod; + pAd->MlmeAux.AtimWin = pAd->StaCfg.AtimWin; + pAd->MlmeAux.Channel = pAd->CommonCfg.Channel; + + pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; + pAd->MlmeAux.CentralChannel = pAd->CommonCfg.CentralChannel; + + pAd->MlmeAux.SupRateLen = pAd->CommonCfg.SupRateLen; + NdisMoveMemory(pAd->MlmeAux.SupRate, pAd->CommonCfg.SupRate, + MAX_LEN_OF_SUPPORTED_RATES); + RTMPCheckRates(pAd, pAd->MlmeAux.SupRate, + &pAd->MlmeAux.SupRateLen); pAd->MlmeAux.ExtRateLen = pAd->CommonCfg.ExtRateLen; - NdisMoveMemory(pAd->MlmeAux.ExtRate, pAd->CommonCfg.ExtRate, MAX_LEN_OF_SUPPORTED_RATES); - RTMPCheckRates(pAd, pAd->MlmeAux.ExtRate, &pAd->MlmeAux.ExtRateLen); - - if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) - { - RTMPUpdateHTIE(&pAd->CommonCfg.DesiredHtPhy, &pAd->StaCfg.DesiredHtPhyInfo.MCSSet[0], &pAd->MlmeAux.HtCapability, &pAd->MlmeAux.AddHtInfo); + NdisMoveMemory(pAd->MlmeAux.ExtRate, pAd->CommonCfg.ExtRate, + MAX_LEN_OF_SUPPORTED_RATES); + RTMPCheckRates(pAd, pAd->MlmeAux.ExtRate, + &pAd->MlmeAux.ExtRateLen); + + if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) { + RTMPUpdateHTIE(&pAd->CommonCfg.DesiredHtPhy, + &pAd->StaCfg.DesiredHtPhyInfo.MCSSet[0], + &pAd->MlmeAux.HtCapability, + &pAd->MlmeAux.AddHtInfo); pAd->MlmeAux.HtCapabilityLen = sizeof(HT_CAPABILITY_IE); // Not turn pAd->StaActive.SupportedHtPhy.bHtEnable = TRUE here. - DBGPRINT(RT_DEBUG_TRACE, ("SYNC -pAd->StaActive.SupportedHtPhy.bHtEnable = TRUE\n")); - } - else - { + DBGPRINT(RT_DEBUG_TRACE, + ("SYNC -pAd->StaActive.SupportedHtPhy.bHtEnable = TRUE\n")); + } else { pAd->MlmeAux.HtCapabilityLen = 0; pAd->StaActive.SupportedPhyInfo.bHtEnable = FALSE; - NdisZeroMemory(&pAd->StaActive.SupportedPhyInfo.MCSSet[0], 16); + NdisZeroMemory(&pAd->StaActive.SupportedPhyInfo. + MCSSet[0], 16); } // temporarily not support QOS in IBSS NdisZeroMemory(&pAd->MlmeAux.APEdcaParm, sizeof(EDCA_PARM)); - NdisZeroMemory(&pAd->MlmeAux.APQbssLoad, sizeof(QBSS_LOAD_PARM)); - NdisZeroMemory(&pAd->MlmeAux.APQosCapability, sizeof(QOS_CAPABILITY_PARM)); + NdisZeroMemory(&pAd->MlmeAux.APQbssLoad, + sizeof(QBSS_LOAD_PARM)); + NdisZeroMemory(&pAd->MlmeAux.APQosCapability, + sizeof(QOS_CAPABILITY_PARM)); AsicSwitchChannel(pAd, pAd->MlmeAux.Channel, FALSE); AsicLockChannel(pAd, pAd->MlmeAux.Channel); - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - MlmeStartReqAction(ch= %d,sup rates= %d, ext rates=%d)\n", - pAd->MlmeAux.Channel, pAd->MlmeAux.SupRateLen, pAd->MlmeAux.ExtRateLen)); + DBGPRINT(RT_DEBUG_TRACE, + ("SYNC - MlmeStartReqAction(ch= %d,sup rates= %d, ext rates=%d)\n", + pAd->MlmeAux.Channel, pAd->MlmeAux.SupRateLen, + pAd->MlmeAux.ExtRateLen)); pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; Status = MLME_SUCCESS; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_START_CONF, 2, &Status); - } - else - { + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_START_CONF, 2, + &Status); + } else { DBGPRINT_ERR(("SYNC - MlmeStartReqAction() sanity check fail.\n")); pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; Status = MLME_INVALID_FORMAT; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_START_CONF, 2, &Status); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_START_CONF, 2, + &Status); } } @@ -536,35 +550,33 @@ VOID MlmeStartReqAction( peer sends beacon back when scanning ========================================================================== */ -VOID PeerBeaconAtScanAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerBeaconAtScanAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Bssid[MAC_ADDR_LEN], Addr2[MAC_ADDR_LEN]; - UCHAR Ssid[MAX_LEN_OF_SSID], BssType, Channel, NewChannel, - SsidLen, DtimCount, DtimPeriod, BcastFlag, MessageToMe; - CF_PARM CfParm; - USHORT BeaconPeriod, AtimWin, CapabilityInfo; - PFRAME_802_11 pFrame; - LARGE_INTEGER TimeStamp; - UCHAR Erp; - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen, ExtRateLen; - USHORT LenVIE; - UCHAR CkipFlag; - UCHAR AironetCellPowerLimit; - EDCA_PARM EdcaParm; - QBSS_LOAD_PARM QbssLoad; + UCHAR Bssid[MAC_ADDR_LEN], Addr2[MAC_ADDR_LEN]; + UCHAR Ssid[MAX_LEN_OF_SSID], BssType, Channel, NewChannel, + SsidLen, DtimCount, DtimPeriod, BcastFlag, MessageToMe; + CF_PARM CfParm; + USHORT BeaconPeriod, AtimWin, CapabilityInfo; + PFRAME_802_11 pFrame; + LARGE_INTEGER TimeStamp; + UCHAR Erp; + UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], + ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; + UCHAR SupRateLen, ExtRateLen; + USHORT LenVIE; + UCHAR CkipFlag; + UCHAR AironetCellPowerLimit; + EDCA_PARM EdcaParm; + QBSS_LOAD_PARM QbssLoad; QOS_CAPABILITY_PARM QosCapability; - ULONG RalinkIe; - UCHAR VarIE[MAX_VIE_LEN]; // Total VIE length = MAX_VIE_LEN - -5 - NDIS_802_11_VARIABLE_IEs *pVIE = NULL; - HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE - UCHAR HtCapabilityLen = 0, PreNHtCapabilityLen = 0; - UCHAR AddHtInfoLen; - UCHAR NewExtChannelOffset = 0xff; - + ULONG RalinkIe; + UCHAR VarIE[MAX_VIE_LEN]; // Total VIE length = MAX_VIE_LEN - -5 + NDIS_802_11_VARIABLE_IEs *pVIE = NULL; + HT_CAPABILITY_IE HtCapability; + ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE + UCHAR HtCapabilityLen = 0, PreNHtCapabilityLen = 0; + UCHAR AddHtInfoLen; + UCHAR NewExtChannelOffset = 0xff; // NdisFillMemory(Ssid, MAX_LEN_OF_SSID, 0x00); pFrame = (PFRAME_802_11) Elem->Msg; @@ -572,49 +584,46 @@ VOID PeerBeaconAtScanAction( pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; pVIE->Length = 0; - RTMPZeroMemory(&HtCapability, sizeof(HtCapability)); + RTMPZeroMemory(&HtCapability, sizeof(HtCapability)); RTMPZeroMemory(&AddHtInfo, sizeof(ADD_HT_INFO_IE)); if (PeerBeaconAndProbeRspSanity(pAd, - Elem->Msg, - Elem->MsgLen, - Elem->Channel, - Addr2, - Bssid, - (PCHAR)Ssid, - &SsidLen, - &BssType, - &BeaconPeriod, - &Channel, - &NewChannel, - &TimeStamp, - &CfParm, - &AtimWin, - &CapabilityInfo, - &Erp, - &DtimCount, - &DtimPeriod, - &BcastFlag, - &MessageToMe, - SupRate, - &SupRateLen, - ExtRate, - &ExtRateLen, - &CkipFlag, - &AironetCellPowerLimit, - &EdcaParm, - &QbssLoad, - &QosCapability, - &RalinkIe, - &HtCapabilityLen, - &PreNHtCapabilityLen, - &HtCapability, - &AddHtInfoLen, - &AddHtInfo, - &NewExtChannelOffset, - &LenVIE, - pVIE)) - { + Elem->Msg, + Elem->MsgLen, + Elem->Channel, + Addr2, + Bssid, + (PCHAR) Ssid, + &SsidLen, + &BssType, + &BeaconPeriod, + &Channel, + &NewChannel, + &TimeStamp, + &CfParm, + &AtimWin, + &CapabilityInfo, + &Erp, + &DtimCount, + &DtimPeriod, + &BcastFlag, + &MessageToMe, + SupRate, + &SupRateLen, + ExtRate, + &ExtRateLen, + &CkipFlag, + &AironetCellPowerLimit, + &EdcaParm, + &QbssLoad, + &QosCapability, + &RalinkIe, + &HtCapabilityLen, + &PreNHtCapabilityLen, + &HtCapability, + &AddHtInfoLen, + &AddHtInfo, + &NewExtChannelOffset, &LenVIE, pVIE)) { ULONG Idx; CHAR Rssi = 0; @@ -622,22 +631,32 @@ VOID PeerBeaconAtScanAction( if (Idx != BSS_NOT_FOUND) Rssi = pAd->ScanTab.BssEntry[Idx].Rssi; - Rssi = RTMPMaxRssi(pAd, ConvertToRssi(pAd, Elem->Rssi0, RSSI_0), ConvertToRssi(pAd, Elem->Rssi1, RSSI_1), ConvertToRssi(pAd, Elem->Rssi2, RSSI_2)); + Rssi = + RTMPMaxRssi(pAd, ConvertToRssi(pAd, Elem->Rssi0, RSSI_0), + ConvertToRssi(pAd, Elem->Rssi1, RSSI_1), + ConvertToRssi(pAd, Elem->Rssi2, RSSI_2)); if ((HtCapabilityLen > 0) || (PreNHtCapabilityLen > 0)) HtCapabilityLen = SIZE_HT_CAP_IE; - Idx = BssTableSetEntry(pAd, &pAd->ScanTab, Bssid, (PCHAR)Ssid, SsidLen, BssType, BeaconPeriod, - &CfParm, AtimWin, CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen, &HtCapability, - &AddHtInfo, HtCapabilityLen, AddHtInfoLen, NewExtChannelOffset, Channel, Rssi, TimeStamp, CkipFlag, - &EdcaParm, &QosCapability, &QbssLoad, LenVIE, pVIE); - - if (Idx != BSS_NOT_FOUND) - { - NdisMoveMemory(pAd->ScanTab.BssEntry[Idx].PTSF, &Elem->Msg[24], 4); - NdisMoveMemory(&pAd->ScanTab.BssEntry[Idx].TTSF[0], &Elem->TimeStamp.u.LowPart, 4); - NdisMoveMemory(&pAd->ScanTab.BssEntry[Idx].TTSF[4], &Elem->TimeStamp.u.LowPart, 4); - } + Idx = + BssTableSetEntry(pAd, &pAd->ScanTab, Bssid, (PCHAR) Ssid, + SsidLen, BssType, BeaconPeriod, &CfParm, + AtimWin, CapabilityInfo, SupRate, + SupRateLen, ExtRate, ExtRateLen, + &HtCapability, &AddHtInfo, HtCapabilityLen, + AddHtInfoLen, NewExtChannelOffset, Channel, + Rssi, TimeStamp, CkipFlag, &EdcaParm, + &QosCapability, &QbssLoad, LenVIE, pVIE); + + if (Idx != BSS_NOT_FOUND) { + NdisMoveMemory(pAd->ScanTab.BssEntry[Idx].PTSF, + &Elem->Msg[24], 4); + NdisMoveMemory(&pAd->ScanTab.BssEntry[Idx].TTSF[0], + &Elem->TimeStamp.u.LowPart, 4); + NdisMoveMemory(&pAd->ScanTab.BssEntry[Idx].TTSF[4], + &Elem->TimeStamp.u.LowPart, 4); + } } // sanity check fail, ignored @@ -649,88 +668,85 @@ VOID PeerBeaconAtScanAction( When waiting joining the (I)BSS, beacon received from external ========================================================================== */ -VOID PeerBeaconAtJoinAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Bssid[MAC_ADDR_LEN], Addr2[MAC_ADDR_LEN]; - UCHAR Ssid[MAX_LEN_OF_SSID], SsidLen, BssType, Channel, MessageToMe, - DtimCount, DtimPeriod, BcastFlag, NewChannel; + UCHAR Bssid[MAC_ADDR_LEN], Addr2[MAC_ADDR_LEN]; + UCHAR Ssid[MAX_LEN_OF_SSID], SsidLen, BssType, Channel, MessageToMe, + DtimCount, DtimPeriod, BcastFlag, NewChannel; LARGE_INTEGER TimeStamp; - USHORT BeaconPeriod, AtimWin, CapabilityInfo; - CF_PARM Cf; - BOOLEAN TimerCancelled; - UCHAR Erp; - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen, ExtRateLen; - UCHAR CkipFlag; - USHORT LenVIE; - UCHAR AironetCellPowerLimit; - EDCA_PARM EdcaParm; - QBSS_LOAD_PARM QbssLoad; + USHORT BeaconPeriod, AtimWin, CapabilityInfo; + CF_PARM Cf; + BOOLEAN TimerCancelled; + UCHAR Erp; + UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], + ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; + UCHAR SupRateLen, ExtRateLen; + UCHAR CkipFlag; + USHORT LenVIE; + UCHAR AironetCellPowerLimit; + EDCA_PARM EdcaParm; + QBSS_LOAD_PARM QbssLoad; QOS_CAPABILITY_PARM QosCapability; - USHORT Status; - UCHAR VarIE[MAX_VIE_LEN]; // Total VIE length = MAX_VIE_LEN - -5 - NDIS_802_11_VARIABLE_IEs *pVIE = NULL; - ULONG RalinkIe; - ULONG Idx; - HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE - UCHAR HtCapabilityLen = 0, PreNHtCapabilityLen = 0; - UCHAR AddHtInfoLen; - UCHAR NewExtChannelOffset = 0xff; - UCHAR CentralChannel; - BOOLEAN bAllowNrate = FALSE; + USHORT Status; + UCHAR VarIE[MAX_VIE_LEN]; // Total VIE length = MAX_VIE_LEN - -5 + NDIS_802_11_VARIABLE_IEs *pVIE = NULL; + ULONG RalinkIe; + ULONG Idx; + HT_CAPABILITY_IE HtCapability; + ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE + UCHAR HtCapabilityLen = 0, PreNHtCapabilityLen = 0; + UCHAR AddHtInfoLen; + UCHAR NewExtChannelOffset = 0xff; + UCHAR CentralChannel; + BOOLEAN bAllowNrate = FALSE; // Init Variable IE structure pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; pVIE->Length = 0; - RTMPZeroMemory(&HtCapability, sizeof(HtCapability)); + RTMPZeroMemory(&HtCapability, sizeof(HtCapability)); RTMPZeroMemory(&AddHtInfo, sizeof(ADD_HT_INFO_IE)); - if (PeerBeaconAndProbeRspSanity(pAd, - Elem->Msg, - Elem->MsgLen, - Elem->Channel, - Addr2, - Bssid, - (PCHAR)Ssid, - &SsidLen, - &BssType, - &BeaconPeriod, - &Channel, - &NewChannel, - &TimeStamp, - &Cf, - &AtimWin, - &CapabilityInfo, - &Erp, - &DtimCount, - &DtimPeriod, - &BcastFlag, - &MessageToMe, - SupRate, - &SupRateLen, - ExtRate, - &ExtRateLen, - &CkipFlag, - &AironetCellPowerLimit, - &EdcaParm, - &QbssLoad, - &QosCapability, - &RalinkIe, - &HtCapabilityLen, - &PreNHtCapabilityLen, - &HtCapability, - &AddHtInfoLen, - &AddHtInfo, - &NewExtChannelOffset, - &LenVIE, - pVIE)) - { + Elem->Msg, + Elem->MsgLen, + Elem->Channel, + Addr2, + Bssid, + (PCHAR) Ssid, + &SsidLen, + &BssType, + &BeaconPeriod, + &Channel, + &NewChannel, + &TimeStamp, + &Cf, + &AtimWin, + &CapabilityInfo, + &Erp, + &DtimCount, + &DtimPeriod, + &BcastFlag, + &MessageToMe, + SupRate, + &SupRateLen, + ExtRate, + &ExtRateLen, + &CkipFlag, + &AironetCellPowerLimit, + &EdcaParm, + &QbssLoad, + &QosCapability, + &RalinkIe, + &HtCapabilityLen, + &PreNHtCapabilityLen, + &HtCapability, + &AddHtInfoLen, + &AddHtInfo, + &NewExtChannelOffset, &LenVIE, pVIE)) { // Disqualify 11b only adhoc when we are in 11g only adhoc mode - if ((BssType == BSS_ADHOC) && (pAd->CommonCfg.PhyMode == PHY_11G) && ((SupRateLen+ExtRateLen)< 12)) + if ((BssType == BSS_ADHOC) + && (pAd->CommonCfg.PhyMode == PHY_11G) + && ((SupRateLen + ExtRateLen) < 12)) return; // BEACON from desired BSS/IBSS found. We should be able to decide most @@ -739,61 +755,120 @@ VOID PeerBeaconAtJoinAction( // Do we need to receover back all parameters belonging to previous BSS? // A. Should be not. There's no back-door recover to previous AP. It still need // a new JOIN-AUTH-ASSOC sequence. - if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, Bssid)) - { - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - receive desired BEACON at JoinWaitBeacon... Channel = %d\n", Channel)); - RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &TimerCancelled); + if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, Bssid)) { + DBGPRINT(RT_DEBUG_TRACE, + ("SYNC - receive desired BEACON at JoinWaitBeacon... Channel = %d\n", + Channel)); + RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, + &TimerCancelled); // Update RSSI to prevent No signal display when cards first initialized - pAd->StaCfg.RssiSample.LastRssi0 = ConvertToRssi(pAd, Elem->Rssi0, RSSI_0); - pAd->StaCfg.RssiSample.LastRssi1 = ConvertToRssi(pAd, Elem->Rssi1, RSSI_1); - pAd->StaCfg.RssiSample.LastRssi2 = ConvertToRssi(pAd, Elem->Rssi2, RSSI_2); - pAd->StaCfg.RssiSample.AvgRssi0 = pAd->StaCfg.RssiSample.LastRssi0; - pAd->StaCfg.RssiSample.AvgRssi0X8 = pAd->StaCfg.RssiSample.AvgRssi0 << 3; - pAd->StaCfg.RssiSample.AvgRssi1 = pAd->StaCfg.RssiSample.LastRssi1; - pAd->StaCfg.RssiSample.AvgRssi1X8 = pAd->StaCfg.RssiSample.AvgRssi1 << 3; - pAd->StaCfg.RssiSample.AvgRssi2 = pAd->StaCfg.RssiSample.LastRssi2; - pAd->StaCfg.RssiSample.AvgRssi2X8 = pAd->StaCfg.RssiSample.AvgRssi2 << 3; + pAd->StaCfg.RssiSample.LastRssi0 = + ConvertToRssi(pAd, Elem->Rssi0, RSSI_0); + pAd->StaCfg.RssiSample.LastRssi1 = + ConvertToRssi(pAd, Elem->Rssi1, RSSI_1); + pAd->StaCfg.RssiSample.LastRssi2 = + ConvertToRssi(pAd, Elem->Rssi2, RSSI_2); + pAd->StaCfg.RssiSample.AvgRssi0 = + pAd->StaCfg.RssiSample.LastRssi0; + pAd->StaCfg.RssiSample.AvgRssi0X8 = + pAd->StaCfg.RssiSample.AvgRssi0 << 3; + pAd->StaCfg.RssiSample.AvgRssi1 = + pAd->StaCfg.RssiSample.LastRssi1; + pAd->StaCfg.RssiSample.AvgRssi1X8 = + pAd->StaCfg.RssiSample.AvgRssi1 << 3; + pAd->StaCfg.RssiSample.AvgRssi2 = + pAd->StaCfg.RssiSample.LastRssi2; + pAd->StaCfg.RssiSample.AvgRssi2X8 = + pAd->StaCfg.RssiSample.AvgRssi2 << 3; // // We need to check if SSID only set to any, then we can record the current SSID. // Otherwise will cause hidden SSID association failed. // - if (pAd->MlmeAux.SsidLen == 0) - { - NdisMoveMemory(pAd->MlmeAux.Ssid, Ssid, SsidLen); + if (pAd->MlmeAux.SsidLen == 0) { + NdisMoveMemory(pAd->MlmeAux.Ssid, Ssid, + SsidLen); pAd->MlmeAux.SsidLen = SsidLen; - } - else - { - Idx = BssSsidTableSearch(&pAd->ScanTab, Bssid, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, Channel); - - if (Idx == BSS_NOT_FOUND) - { + } else { + Idx = + BssSsidTableSearch(&pAd->ScanTab, Bssid, + pAd->MlmeAux.Ssid, + pAd->MlmeAux.SsidLen, + Channel); + + if (Idx == BSS_NOT_FOUND) { CHAR Rssi = 0; - Rssi = RTMPMaxRssi(pAd, ConvertToRssi(pAd, Elem->Rssi0, RSSI_0), ConvertToRssi(pAd, Elem->Rssi1, RSSI_1), ConvertToRssi(pAd, Elem->Rssi2, RSSI_2)); - Idx = BssTableSetEntry(pAd, &pAd->ScanTab, Bssid, (CHAR *) Ssid, SsidLen, BssType, BeaconPeriod, - &Cf, AtimWin, CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen, &HtCapability, - &AddHtInfo, HtCapabilityLen, AddHtInfoLen, NewExtChannelOffset, Channel, Rssi, TimeStamp, CkipFlag, - &EdcaParm, &QosCapability, &QbssLoad, LenVIE, pVIE); - if (Idx != BSS_NOT_FOUND) - { - NdisMoveMemory(pAd->ScanTab.BssEntry[Idx].PTSF, &Elem->Msg[24], 4); - NdisMoveMemory(&pAd->ScanTab.BssEntry[Idx].TTSF[0], &Elem->TimeStamp.u.LowPart, 4); - NdisMoveMemory(&pAd->ScanTab.BssEntry[Idx].TTSF[4], &Elem->TimeStamp.u.LowPart, 4); - CapabilityInfo = pAd->ScanTab.BssEntry[Idx].CapabilityInfo; + Rssi = + RTMPMaxRssi(pAd, + ConvertToRssi(pAd, + Elem-> + Rssi0, + RSSI_0), + ConvertToRssi(pAd, + Elem-> + Rssi1, + RSSI_1), + ConvertToRssi(pAd, + Elem-> + Rssi2, + RSSI_2)); + Idx = + BssTableSetEntry(pAd, &pAd->ScanTab, + Bssid, + (CHAR *) Ssid, + SsidLen, BssType, + BeaconPeriod, &Cf, + AtimWin, + CapabilityInfo, + SupRate, + SupRateLen, + ExtRate, + ExtRateLen, + &HtCapability, + &AddHtInfo, + HtCapabilityLen, + AddHtInfoLen, + NewExtChannelOffset, + Channel, Rssi, + TimeStamp, + CkipFlag, + &EdcaParm, + &QosCapability, + &QbssLoad, LenVIE, + pVIE); + if (Idx != BSS_NOT_FOUND) { + NdisMoveMemory(pAd->ScanTab. + BssEntry[Idx]. + PTSF, + &Elem->Msg[24], + 4); + NdisMoveMemory(&pAd->ScanTab. + BssEntry[Idx]. + TTSF[0], + &Elem->TimeStamp. + u.LowPart, 4); + NdisMoveMemory(&pAd->ScanTab. + BssEntry[Idx]. + TTSF[4], + &Elem->TimeStamp. + u.LowPart, 4); + CapabilityInfo = + pAd->ScanTab.BssEntry[Idx]. + CapabilityInfo; } - } - else - { + } else { // // Multiple SSID case, used correct CapabilityInfo // - CapabilityInfo = pAd->ScanTab.BssEntry[Idx].CapabilityInfo; + CapabilityInfo = + pAd->ScanTab.BssEntry[Idx]. + CapabilityInfo; } } NdisMoveMemory(pAd->MlmeAux.Bssid, Bssid, MAC_ADDR_LEN); - pAd->MlmeAux.CapabilityInfo = CapabilityInfo & SUPPORTED_CAPABILITY_INFO; + pAd->MlmeAux.CapabilityInfo = + CapabilityInfo & SUPPORTED_CAPABILITY_INFO; pAd->MlmeAux.BssType = BssType; pAd->MlmeAux.BeaconPeriod = BeaconPeriod; pAd->MlmeAux.Channel = Channel; @@ -805,110 +880,152 @@ VOID PeerBeaconAtJoinAction( // Copy AP's supported rate to MlmeAux for creating assoication request // Also filter out not supported rate pAd->MlmeAux.SupRateLen = SupRateLen; - NdisMoveMemory(pAd->MlmeAux.SupRate, SupRate, SupRateLen); - RTMPCheckRates(pAd, pAd->MlmeAux.SupRate, &pAd->MlmeAux.SupRateLen); + NdisMoveMemory(pAd->MlmeAux.SupRate, SupRate, + SupRateLen); + RTMPCheckRates(pAd, pAd->MlmeAux.SupRate, + &pAd->MlmeAux.SupRateLen); pAd->MlmeAux.ExtRateLen = ExtRateLen; - NdisMoveMemory(pAd->MlmeAux.ExtRate, ExtRate, ExtRateLen); - RTMPCheckRates(pAd, pAd->MlmeAux.ExtRate, &pAd->MlmeAux.ExtRateLen); - - NdisZeroMemory(pAd->StaActive.SupportedPhyInfo.MCSSet, 16); - - - if (((pAd->StaCfg.WepStatus != Ndis802_11WEPEnabled) && (pAd->StaCfg.WepStatus != Ndis802_11Encryption2Enabled)) - || (pAd->CommonCfg.HT_DisallowTKIP == FALSE)) - { + NdisMoveMemory(pAd->MlmeAux.ExtRate, ExtRate, + ExtRateLen); + RTMPCheckRates(pAd, pAd->MlmeAux.ExtRate, + &pAd->MlmeAux.ExtRateLen); + + NdisZeroMemory(pAd->StaActive.SupportedPhyInfo.MCSSet, + 16); + + if (((pAd->StaCfg.WepStatus != Ndis802_11WEPEnabled) + && (pAd->StaCfg.WepStatus != + Ndis802_11Encryption2Enabled)) + || (pAd->CommonCfg.HT_DisallowTKIP == FALSE)) { bAllowNrate = TRUE; } pAd->MlmeAux.NewExtChannelOffset = NewExtChannelOffset; pAd->MlmeAux.HtCapabilityLen = HtCapabilityLen; - RTMPZeroMemory(&pAd->MlmeAux.HtCapability, SIZE_HT_CAP_IE); + RTMPZeroMemory(&pAd->MlmeAux.HtCapability, + SIZE_HT_CAP_IE); // filter out un-supported ht rates - if (((HtCapabilityLen > 0) || (PreNHtCapabilityLen > 0)) && - ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && (bAllowNrate))) - { - RTMPMoveMemory(&pAd->MlmeAux.AddHtInfo, &AddHtInfo, SIZE_ADD_HT_INFO_IE); + if (((HtCapabilityLen > 0) || (PreNHtCapabilityLen > 0)) + && ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) + && (bAllowNrate))) { + RTMPMoveMemory(&pAd->MlmeAux.AddHtInfo, + &AddHtInfo, SIZE_ADD_HT_INFO_IE); // StaActive.SupportedHtPhy.MCSSet stores Peer AP's 11n Rx capability - NdisMoveMemory(pAd->StaActive.SupportedPhyInfo.MCSSet, HtCapability.MCSSet, 16); - pAd->MlmeAux.NewExtChannelOffset = NewExtChannelOffset; + NdisMoveMemory(pAd->StaActive.SupportedPhyInfo. + MCSSet, HtCapability.MCSSet, 16); + pAd->MlmeAux.NewExtChannelOffset = + NewExtChannelOffset; pAd->MlmeAux.HtCapabilityLen = SIZE_HT_CAP_IE; - pAd->StaActive.SupportedPhyInfo.bHtEnable = TRUE; + pAd->StaActive.SupportedPhyInfo.bHtEnable = + TRUE; if (PreNHtCapabilityLen > 0) - pAd->StaActive.SupportedPhyInfo.bPreNHt = TRUE; - RTMPCheckHt(pAd, BSSID_WCID, &HtCapability, &AddHtInfo); + pAd->StaActive.SupportedPhyInfo. + bPreNHt = TRUE; + RTMPCheckHt(pAd, BSSID_WCID, &HtCapability, + &AddHtInfo); // Copy AP Parameter to StaActive. This is also in LinkUp. - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAtJoinAction! (MpduDensity=%d, MaxRAmpduFactor=%d, BW=%d)\n", - pAd->StaActive.SupportedHtPhy.MpduDensity, pAd->StaActive.SupportedHtPhy.MaxRAmpduFactor, HtCapability.HtCapInfo.ChannelWidth)); - - if (AddHtInfoLen > 0) - { + DBGPRINT(RT_DEBUG_TRACE, + ("PeerBeaconAtJoinAction! (MpduDensity=%d, MaxRAmpduFactor=%d, BW=%d)\n", + pAd->StaActive.SupportedHtPhy. + MpduDensity, + pAd->StaActive.SupportedHtPhy. + MaxRAmpduFactor, + HtCapability.HtCapInfo.ChannelWidth)); + + if (AddHtInfoLen > 0) { CentralChannel = AddHtInfo.ControlChan; - // Check again the Bandwidth capability of this AP. - if ((AddHtInfo.ControlChan > 2)&& (AddHtInfo.AddHtInfo.ExtChanOffset == EXTCHA_BELOW) && (HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - CentralChannel = AddHtInfo.ControlChan - 2; - } - else if ((AddHtInfo.AddHtInfo.ExtChanOffset == EXTCHA_ABOVE) && (HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - CentralChannel = AddHtInfo.ControlChan + 2; - } - + // Check again the Bandwidth capability of this AP. + if ((AddHtInfo.ControlChan > 2) + && (AddHtInfo.AddHtInfo. + ExtChanOffset == EXTCHA_BELOW) + && (HtCapability.HtCapInfo. + ChannelWidth == BW_40)) { + CentralChannel = + AddHtInfo.ControlChan - 2; + } else + if ((AddHtInfo.AddHtInfo. + ExtChanOffset == EXTCHA_ABOVE) + && (HtCapability.HtCapInfo. + ChannelWidth == BW_40)) { + CentralChannel = + AddHtInfo.ControlChan + 2; + } // Check Error . - if (pAd->MlmeAux.CentralChannel != CentralChannel) - DBGPRINT(RT_DEBUG_ERROR, ("PeerBeaconAtJoinAction HT===>Beacon Central Channel = %d, Control Channel = %d. Mlmeaux CentralChannel = %d\n", CentralChannel, AddHtInfo.ControlChan, pAd->MlmeAux.CentralChannel)); - - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAtJoinAction HT===>Central Channel = %d, Control Channel = %d, .\n", CentralChannel, AddHtInfo.ControlChan)); + if (pAd->MlmeAux.CentralChannel != + CentralChannel) + DBGPRINT(RT_DEBUG_ERROR, + ("PeerBeaconAtJoinAction HT===>Beacon Central Channel = %d, Control Channel = %d. Mlmeaux CentralChannel = %d\n", + CentralChannel, + AddHtInfo.ControlChan, + pAd->MlmeAux. + CentralChannel)); + + DBGPRINT(RT_DEBUG_TRACE, + ("PeerBeaconAtJoinAction HT===>Central Channel = %d, Control Channel = %d, .\n", + CentralChannel, + AddHtInfo.ControlChan)); } - } - else - { - // To prevent error, let legacy AP must have same CentralChannel and Channel. - if ((HtCapabilityLen == 0) && (PreNHtCapabilityLen == 0)) - pAd->MlmeAux.CentralChannel = pAd->MlmeAux.Channel; + } else { + // To prevent error, let legacy AP must have same CentralChannel and Channel. + if ((HtCapabilityLen == 0) + && (PreNHtCapabilityLen == 0)) + pAd->MlmeAux.CentralChannel = + pAd->MlmeAux.Channel; - pAd->StaActive.SupportedPhyInfo.bHtEnable = FALSE; + pAd->StaActive.SupportedPhyInfo.bHtEnable = + FALSE; pAd->MlmeAux.NewExtChannelOffset = 0xff; - RTMPZeroMemory(&pAd->MlmeAux.HtCapability, SIZE_HT_CAP_IE); + RTMPZeroMemory(&pAd->MlmeAux.HtCapability, + SIZE_HT_CAP_IE); pAd->MlmeAux.HtCapabilityLen = 0; - RTMPZeroMemory(&pAd->MlmeAux.AddHtInfo, SIZE_ADD_HT_INFO_IE); + RTMPZeroMemory(&pAd->MlmeAux.AddHtInfo, + SIZE_ADD_HT_INFO_IE); } RTMPUpdateMlmeRate(pAd); // copy QOS related information if ((pAd->CommonCfg.bWmmCapable) - || (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) - ) - { - NdisMoveMemory(&pAd->MlmeAux.APEdcaParm, &EdcaParm, sizeof(EDCA_PARM)); - NdisMoveMemory(&pAd->MlmeAux.APQbssLoad, &QbssLoad, sizeof(QBSS_LOAD_PARM)); - NdisMoveMemory(&pAd->MlmeAux.APQosCapability, &QosCapability, sizeof(QOS_CAPABILITY_PARM)); - } - else - { - NdisZeroMemory(&pAd->MlmeAux.APEdcaParm, sizeof(EDCA_PARM)); - NdisZeroMemory(&pAd->MlmeAux.APQbssLoad, sizeof(QBSS_LOAD_PARM)); - NdisZeroMemory(&pAd->MlmeAux.APQosCapability, sizeof(QOS_CAPABILITY_PARM)); + || (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) + ) { + NdisMoveMemory(&pAd->MlmeAux.APEdcaParm, + &EdcaParm, sizeof(EDCA_PARM)); + NdisMoveMemory(&pAd->MlmeAux.APQbssLoad, + &QbssLoad, + sizeof(QBSS_LOAD_PARM)); + NdisMoveMemory(&pAd->MlmeAux.APQosCapability, + &QosCapability, + sizeof(QOS_CAPABILITY_PARM)); + } else { + NdisZeroMemory(&pAd->MlmeAux.APEdcaParm, + sizeof(EDCA_PARM)); + NdisZeroMemory(&pAd->MlmeAux.APQbssLoad, + sizeof(QBSS_LOAD_PARM)); + NdisZeroMemory(&pAd->MlmeAux.APQosCapability, + sizeof(QOS_CAPABILITY_PARM)); } - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - after JOIN, SupRateLen=%d, ExtRateLen=%d\n", - pAd->MlmeAux.SupRateLen, pAd->MlmeAux.ExtRateLen)); + DBGPRINT(RT_DEBUG_TRACE, + ("SYNC - after JOIN, SupRateLen=%d, ExtRateLen=%d\n", + pAd->MlmeAux.SupRateLen, + pAd->MlmeAux.ExtRateLen)); - if (AironetCellPowerLimit != 0xFF) - { + if (AironetCellPowerLimit != 0xFF) { //We need to change our TxPower for CCX 2.0 AP Control of Client Transmit Power - ChangeToCellPowerLimit(pAd, AironetCellPowerLimit); - } - else //Used the default TX Power Percentage. - pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault; + ChangeToCellPowerLimit(pAd, + AironetCellPowerLimit); + } else //Used the default TX Power Percentage. + pAd->CommonCfg.TxPowerPercentage = + pAd->CommonCfg.TxPowerDefault; pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; Status = MLME_SUCCESS; - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_JOIN_CONF, 2, &Status); + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_JOIN_CONF, + 2, &Status); } // not to me BEACON, ignored } @@ -924,98 +1041,99 @@ VOID PeerBeaconAtJoinAction( ========================================================================== */ -VOID PeerBeacon( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Bssid[MAC_ADDR_LEN], Addr2[MAC_ADDR_LEN]; - CHAR Ssid[MAX_LEN_OF_SSID]; - CF_PARM CfParm; - UCHAR SsidLen, MessageToMe=0, BssType, Channel, NewChannel, index=0; - UCHAR DtimCount=0, DtimPeriod=0, BcastFlag=0; - USHORT CapabilityInfo, AtimWin, BeaconPeriod; + UCHAR Bssid[MAC_ADDR_LEN], Addr2[MAC_ADDR_LEN]; + CHAR Ssid[MAX_LEN_OF_SSID]; + CF_PARM CfParm; + UCHAR SsidLen, MessageToMe = 0, BssType, Channel, NewChannel, index = 0; + UCHAR DtimCount = 0, DtimPeriod = 0, BcastFlag = 0; + USHORT CapabilityInfo, AtimWin, BeaconPeriod; LARGE_INTEGER TimeStamp; - USHORT TbttNumToNextWakeUp; - UCHAR Erp; - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen, ExtRateLen; - UCHAR CkipFlag; - USHORT LenVIE; - UCHAR AironetCellPowerLimit; - EDCA_PARM EdcaParm; - QBSS_LOAD_PARM QbssLoad; + USHORT TbttNumToNextWakeUp; + UCHAR Erp; + UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], + ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; + UCHAR SupRateLen, ExtRateLen; + UCHAR CkipFlag; + USHORT LenVIE; + UCHAR AironetCellPowerLimit; + EDCA_PARM EdcaParm; + QBSS_LOAD_PARM QbssLoad; QOS_CAPABILITY_PARM QosCapability; - ULONG RalinkIe; + ULONG RalinkIe; // New for WPA security suites - UCHAR VarIE[MAX_VIE_LEN]; // Total VIE length = MAX_VIE_LEN - -5 - NDIS_802_11_VARIABLE_IEs *pVIE = NULL; - HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE - UCHAR HtCapabilityLen, PreNHtCapabilityLen; - UCHAR AddHtInfoLen; - UCHAR NewExtChannelOffset = 0xff; + UCHAR VarIE[MAX_VIE_LEN]; // Total VIE length = MAX_VIE_LEN - -5 + NDIS_802_11_VARIABLE_IEs *pVIE = NULL; + HT_CAPABILITY_IE HtCapability; + ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE + UCHAR HtCapabilityLen, PreNHtCapabilityLen; + UCHAR AddHtInfoLen; + UCHAR NewExtChannelOffset = 0xff; if (!(INFRA_ON(pAd) || ADHOC_ON(pAd) - )) + )) return; // Init Variable IE structure pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; pVIE->Length = 0; - RTMPZeroMemory(&HtCapability, sizeof(HtCapability)); + RTMPZeroMemory(&HtCapability, sizeof(HtCapability)); RTMPZeroMemory(&AddHtInfo, sizeof(ADD_HT_INFO_IE)); if (PeerBeaconAndProbeRspSanity(pAd, - Elem->Msg, - Elem->MsgLen, - Elem->Channel, - Addr2, - Bssid, - Ssid, - &SsidLen, - &BssType, - &BeaconPeriod, - &Channel, - &NewChannel, - &TimeStamp, - &CfParm, - &AtimWin, - &CapabilityInfo, - &Erp, - &DtimCount, - &DtimPeriod, - &BcastFlag, - &MessageToMe, - SupRate, - &SupRateLen, - ExtRate, - &ExtRateLen, - &CkipFlag, - &AironetCellPowerLimit, - &EdcaParm, - &QbssLoad, - &QosCapability, - &RalinkIe, - &HtCapabilityLen, - &PreNHtCapabilityLen, - &HtCapability, - &AddHtInfoLen, - &AddHtInfo, - &NewExtChannelOffset, - &LenVIE, - pVIE)) - { + Elem->Msg, + Elem->MsgLen, + Elem->Channel, + Addr2, + Bssid, + Ssid, + &SsidLen, + &BssType, + &BeaconPeriod, + &Channel, + &NewChannel, + &TimeStamp, + &CfParm, + &AtimWin, + &CapabilityInfo, + &Erp, + &DtimCount, + &DtimPeriod, + &BcastFlag, + &MessageToMe, + SupRate, + &SupRateLen, + ExtRate, + &ExtRateLen, + &CkipFlag, + &AironetCellPowerLimit, + &EdcaParm, + &QbssLoad, + &QosCapability, + &RalinkIe, + &HtCapabilityLen, + &PreNHtCapabilityLen, + &HtCapability, + &AddHtInfoLen, + &AddHtInfo, + &NewExtChannelOffset, &LenVIE, pVIE)) { BOOLEAN is_my_bssid, is_my_ssid; - ULONG Bssidx, Now; + ULONG Bssidx, Now; BSS_ENTRY *pBss; - CHAR RealRssi = RTMPMaxRssi(pAd, ConvertToRssi(pAd, Elem->Rssi0, RSSI_0), ConvertToRssi(pAd, Elem->Rssi1, RSSI_1), ConvertToRssi(pAd, Elem->Rssi2, RSSI_2)); - - is_my_bssid = MAC_ADDR_EQUAL(Bssid, pAd->CommonCfg.Bssid)? TRUE : FALSE; - is_my_ssid = SSID_EQUAL(Ssid, SsidLen, pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen)? TRUE:FALSE; + CHAR RealRssi = + RTMPMaxRssi(pAd, ConvertToRssi(pAd, Elem->Rssi0, RSSI_0), + ConvertToRssi(pAd, Elem->Rssi1, RSSI_1), + ConvertToRssi(pAd, Elem->Rssi2, RSSI_2)); + is_my_bssid = + MAC_ADDR_EQUAL(Bssid, pAd->CommonCfg.Bssid) ? TRUE : FALSE; + is_my_ssid = + SSID_EQUAL(Ssid, SsidLen, pAd->CommonCfg.Ssid, + pAd->CommonCfg.SsidLen) ? TRUE : FALSE; // ignore BEACON not for my SSID - if ((! is_my_ssid) && (! is_my_bssid)) + if ((!is_my_ssid) && (!is_my_bssid)) return; // It means STA waits disassoc completely from this AP, ignores this beacon. @@ -1033,177 +1151,194 @@ VOID PeerBeacon( // Housekeeping "SsidBssTab" table for later-on ROAMing usage. // Bssidx = BssTableSearch(&pAd->ScanTab, Bssid, Channel); - if (Bssidx == BSS_NOT_FOUND) - { + if (Bssidx == BSS_NOT_FOUND) { // discover new AP of this network, create BSS entry - Bssidx = BssTableSetEntry(pAd, &pAd->ScanTab, Bssid, Ssid, SsidLen, BssType, BeaconPeriod, - &CfParm, AtimWin, CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen, - &HtCapability, &AddHtInfo,HtCapabilityLen,AddHtInfoLen,NewExtChannelOffset, Channel, - RealRssi, TimeStamp, CkipFlag, &EdcaParm, &QosCapability, - &QbssLoad, LenVIE, pVIE); - if (Bssidx == BSS_NOT_FOUND) // return if BSS table full + Bssidx = + BssTableSetEntry(pAd, &pAd->ScanTab, Bssid, Ssid, + SsidLen, BssType, BeaconPeriod, + &CfParm, AtimWin, CapabilityInfo, + SupRate, SupRateLen, ExtRate, + ExtRateLen, &HtCapability, + &AddHtInfo, HtCapabilityLen, + AddHtInfoLen, NewExtChannelOffset, + Channel, RealRssi, TimeStamp, + CkipFlag, &EdcaParm, + &QosCapability, &QbssLoad, LenVIE, + pVIE); + if (Bssidx == BSS_NOT_FOUND) // return if BSS table full return; - NdisMoveMemory(pAd->ScanTab.BssEntry[Bssidx].PTSF, &Elem->Msg[24], 4); - NdisMoveMemory(&pAd->ScanTab.BssEntry[Bssidx].TTSF[0], &Elem->TimeStamp.u.LowPart, 4); - NdisMoveMemory(&pAd->ScanTab.BssEntry[Bssidx].TTSF[4], &Elem->TimeStamp.u.LowPart, 4); - - + NdisMoveMemory(pAd->ScanTab.BssEntry[Bssidx].PTSF, + &Elem->Msg[24], 4); + NdisMoveMemory(&pAd->ScanTab.BssEntry[Bssidx].TTSF[0], + &Elem->TimeStamp.u.LowPart, 4); + NdisMoveMemory(&pAd->ScanTab.BssEntry[Bssidx].TTSF[4], + &Elem->TimeStamp.u.LowPart, 4); } - if ((pAd->CommonCfg.bIEEE80211H == 1) && (NewChannel != 0) && (Channel != NewChannel)) - { + if ((pAd->CommonCfg.bIEEE80211H == 1) && (NewChannel != 0) + && (Channel != NewChannel)) { // Switching to channel 1 can prevent from rescanning the current channel immediately (by auto reconnection). // In addition, clear the MLME queue and the scan table to discard the RX packets and previous scanning results. AsicSwitchChannel(pAd, 1, FALSE); AsicLockChannel(pAd, 1); - LinkDown(pAd, FALSE); + LinkDown(pAd, FALSE); MlmeQueueInit(&pAd->Mlme.Queue); BssTableInit(&pAd->ScanTab); - RTMPusecDelay(1000000); // use delay to prevent STA do reassoc + RTMPusecDelay(1000000); // use delay to prevent STA do reassoc // channel sanity check - for (index = 0 ; index < pAd->ChannelListNum; index++) - { - if (pAd->ChannelList[index].Channel == NewChannel) - { - pAd->ScanTab.BssEntry[Bssidx].Channel = NewChannel; + for (index = 0; index < pAd->ChannelListNum; index++) { + if (pAd->ChannelList[index].Channel == + NewChannel) { + pAd->ScanTab.BssEntry[Bssidx].Channel = + NewChannel; pAd->CommonCfg.Channel = NewChannel; - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - DBGPRINT(RT_DEBUG_TRACE, ("PeerBeacon - STA receive channel switch announcement IE (New Channel =%d)\n", NewChannel)); + AsicSwitchChannel(pAd, + pAd->CommonCfg. + Channel, FALSE); + AsicLockChannel(pAd, + pAd->CommonCfg.Channel); + DBGPRINT(RT_DEBUG_TRACE, + ("PeerBeacon - STA receive channel switch announcement IE (New Channel =%d)\n", + NewChannel)); break; } } - if (index >= pAd->ChannelListNum) - { + if (index >= pAd->ChannelListNum) { DBGPRINT_ERR(("PeerBeacon(can not find New Channel=%d in ChannelList[%d]\n", pAd->CommonCfg.Channel, pAd->ChannelListNum)); } } - // if the ssid matched & bssid unmatched, we should select the bssid with large value. // This might happened when two STA start at the same time - if ((! is_my_bssid) && ADHOC_ON(pAd)) - { - INT i; + if ((!is_my_bssid) && ADHOC_ON(pAd)) { + INT i; // Add the safeguard against the mismatch of adhoc wep status - if (pAd->StaCfg.WepStatus != pAd->ScanTab.BssEntry[Bssidx].WepStatus) - { + if (pAd->StaCfg.WepStatus != + pAd->ScanTab.BssEntry[Bssidx].WepStatus) { return; } - // collapse into the ADHOC network which has bigger BSSID value. - for (i = 0; i < 6; i++) - { - if (Bssid[i] > pAd->CommonCfg.Bssid[i]) - { - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - merge to the IBSS with bigger BSSID=%02x:%02x:%02x:%02x:%02x:%02x\n", - Bssid[0], Bssid[1], Bssid[2], Bssid[3], Bssid[4], Bssid[5])); + for (i = 0; i < 6; i++) { + if (Bssid[i] > pAd->CommonCfg.Bssid[i]) { + DBGPRINT(RT_DEBUG_TRACE, + ("SYNC - merge to the IBSS with bigger BSSID=%02x:%02x:%02x:%02x:%02x:%02x\n", + Bssid[0], Bssid[1], Bssid[2], + Bssid[3], Bssid[4], + Bssid[5])); AsicDisableSync(pAd); - COPY_MAC_ADDR(pAd->CommonCfg.Bssid, Bssid); + COPY_MAC_ADDR(pAd->CommonCfg.Bssid, + Bssid); AsicSetBssid(pAd, pAd->CommonCfg.Bssid); - MakeIbssBeacon(pAd); // re-build BEACON frame - AsicEnableIbssSync(pAd); // copy BEACON frame to on-chip memory + MakeIbssBeacon(pAd); // re-build BEACON frame + AsicEnableIbssSync(pAd); // copy BEACON frame to on-chip memory is_my_bssid = TRUE; break; - } - else if (Bssid[i] < pAd->CommonCfg.Bssid[i]) + } else if (Bssid[i] < pAd->CommonCfg.Bssid[i]) break; } } - NdisGetSystemUpTime(&Now); pBss = &pAd->ScanTab.BssEntry[Bssidx]; - pBss->Rssi = RealRssi; // lastest RSSI - pBss->LastBeaconRxTime = Now; // last RX timestamp + pBss->Rssi = RealRssi; // lastest RSSI + pBss->LastBeaconRxTime = Now; // last RX timestamp // // BEACON from my BSSID - either IBSS or INFRA network // - if (is_my_bssid) - { - RXWI_STRUC RxWI; + if (is_my_bssid) { + RXWI_STRUC RxWI; pAd->StaCfg.DtimCount = DtimCount; pAd->StaCfg.DtimPeriod = DtimPeriod; pAd->StaCfg.LastBeaconRxTime = Now; - RxWI.RSSI0 = Elem->Rssi0; RxWI.RSSI1 = Elem->Rssi1; RxWI.RSSI2 = Elem->Rssi2; Update_Rssi_Sample(pAd, &pAd->StaCfg.RssiSample, &RxWI); - if (AironetCellPowerLimit != 0xFF) - { + if (AironetCellPowerLimit != 0xFF) { // // We get the Cisco (ccx) "TxPower Limit" required // Changed to appropriate TxPower Limit for Ciso Compatible Extensions // - ChangeToCellPowerLimit(pAd, AironetCellPowerLimit); - } - else - { + ChangeToCellPowerLimit(pAd, + AironetCellPowerLimit); + } else { // // AironetCellPowerLimit equal to 0xFF means the Cisco (ccx) "TxPower Limit" not exist. // Used the default TX Power Percentage, that set from UI. // - pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault; + pAd->CommonCfg.TxPowerPercentage = + pAd->CommonCfg.TxPowerDefault; } - if (ADHOC_ON(pAd) && (CAP_IS_IBSS_ON(CapabilityInfo))) - { - UCHAR MaxSupportedRateIn500Kbps = 0; - UCHAR idx; + if (ADHOC_ON(pAd) && (CAP_IS_IBSS_ON(CapabilityInfo))) { + UCHAR MaxSupportedRateIn500Kbps = 0; + UCHAR idx; MAC_TABLE_ENTRY *pEntry; // supported rates array may not be sorted. sort it and find the maximum rate - for (idx=0; idxWcid == RESERVED_WCID)) || - (pEntry && ((pEntry->LastBeaconRxTime + ADHOC_ENTRY_BEACON_LOST_TIME) < Now))) - { + if ((ADHOC_ON(pAd) + && (Elem->Wcid == RESERVED_WCID)) + || (pEntry + && + ((pEntry->LastBeaconRxTime + + ADHOC_ENTRY_BEACON_LOST_TIME) < + Now))) { if (pEntry == NULL) // Another adhoc joining, add to our MAC table. - pEntry = MacTableInsertEntry(pAd, Addr2, BSS0, FALSE); + pEntry = + MacTableInsertEntry(pAd, + Addr2, + BSS0, + FALSE); if (StaAddMacTableEntry(pAd, - pEntry, - MaxSupportedRateIn500Kbps, - &HtCapability, - HtCapabilityLen, - &AddHtInfo, - AddHtInfoLen, - CapabilityInfo) == FALSE) - { - DBGPRINT(RT_DEBUG_TRACE, ("ADHOC - Add Entry failed.\n")); + pEntry, + MaxSupportedRateIn500Kbps, + &HtCapability, + HtCapabilityLen, + &AddHtInfo, + AddHtInfoLen, + CapabilityInfo) + == FALSE) { + DBGPRINT(RT_DEBUG_TRACE, + ("ADHOC - Add Entry failed.\n")); return; } if (pEntry && - (Elem->Wcid == RESERVED_WCID)) - { + (Elem->Wcid == RESERVED_WCID)) { idx = pAd->StaCfg.DefaultKeyId; - RTMP_STA_SECURITY_INFO_ADD(pAd, BSS0, idx, pEntry); + RTMP_STA_SECURITY_INFO_ADD(pAd, + BSS0, + idx, + pEntry); } } @@ -1211,33 +1346,62 @@ VOID PeerBeacon( pEntry->LastBeaconRxTime = Now; // At least another peer in this IBSS, declare MediaState as CONNECTED - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) - { - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); + if (!OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) { + OPSTATUS_SET_FLAG(pAd, + fOP_STATUS_MEDIA_STATE_CONNECTED); - pAd->IndicateMediaState = NdisMediaStateConnected; + pAd->IndicateMediaState = + NdisMediaStateConnected; RTMP_IndicateMediaState(pAd); - pAd->ExtraInfo = GENERAL_LINK_UP; + pAd->ExtraInfo = GENERAL_LINK_UP; AsicSetBssid(pAd, pAd->CommonCfg.Bssid); // 2003/03/12 - john // Make sure this entry in "ScanTab" table, thus complies to Microsoft's policy that // "site survey" result should always include the current connected network. // - Bssidx = BssTableSearch(&pAd->ScanTab, Bssid, Channel); - if (Bssidx == BSS_NOT_FOUND) - { - Bssidx = BssTableSetEntry(pAd, &pAd->ScanTab, Bssid, Ssid, SsidLen, BssType, BeaconPeriod, - &CfParm, AtimWin, CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen, &HtCapability, - &AddHtInfo, HtCapabilityLen, AddHtInfoLen, NewExtChannelOffset, Channel, RealRssi, TimeStamp, 0, - &EdcaParm, &QosCapability, &QbssLoad, LenVIE, pVIE); + Bssidx = + BssTableSearch(&pAd->ScanTab, Bssid, + Channel); + if (Bssidx == BSS_NOT_FOUND) { + Bssidx = + BssTableSetEntry(pAd, + &pAd-> + ScanTab, + Bssid, + Ssid, + SsidLen, + BssType, + BeaconPeriod, + &CfParm, + AtimWin, + CapabilityInfo, + SupRate, + SupRateLen, + ExtRate, + ExtRateLen, + &HtCapability, + &AddHtInfo, + HtCapabilityLen, + AddHtInfoLen, + NewExtChannelOffset, + Channel, + RealRssi, + TimeStamp, + 0, + &EdcaParm, + &QosCapability, + &QbssLoad, + LenVIE, + pVIE); } - DBGPRINT(RT_DEBUG_TRACE, ("ADHOC fOP_STATUS_MEDIA_STATE_CONNECTED.\n")); + DBGPRINT(RT_DEBUG_TRACE, + ("ADHOC fOP_STATUS_MEDIA_STATE_CONNECTED.\n")); } } - if (INFRA_ON(pAd)) - { + if (INFRA_ON(pAd)) { BOOLEAN bUseShortSlot, bUseBGProtection; // decide to use/change to - @@ -1246,174 +1410,283 @@ VOID PeerBeacon( // 3. short preamble //bUseShortSlot = pAd->CommonCfg.bUseShortSlotTime && CAP_IS_SHORT_SLOT(CapabilityInfo); - bUseShortSlot = CAP_IS_SHORT_SLOT(CapabilityInfo); - if (bUseShortSlot != OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED)) + bUseShortSlot = + CAP_IS_SHORT_SLOT(CapabilityInfo); + if (bUseShortSlot != + OPSTATUS_TEST_FLAG(pAd, + fOP_STATUS_SHORT_SLOT_INUSED)) AsicSetSlotTime(pAd, bUseShortSlot); - bUseBGProtection = (pAd->CommonCfg.UseBGProtection == 1) || // always use - ((pAd->CommonCfg.UseBGProtection == 0) && ERP_IS_USE_PROTECTION(Erp)); + bUseBGProtection = (pAd->CommonCfg.UseBGProtection == 1) || // always use + ((pAd->CommonCfg.UseBGProtection == 0) + && ERP_IS_USE_PROTECTION(Erp)); - if (pAd->CommonCfg.Channel > 14) // always no BG protection in A-band. falsely happened when switching A/G band to a dual-band AP + if (pAd->CommonCfg.Channel > 14) // always no BG protection in A-band. falsely happened when switching A/G band to a dual-band AP bUseBGProtection = FALSE; - if (bUseBGProtection != OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_BG_PROTECTION_INUSED)) + if (bUseBGProtection != + OPSTATUS_TEST_FLAG(pAd, + fOP_STATUS_BG_PROTECTION_INUSED)) { - if (bUseBGProtection) - { - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_BG_PROTECTION_INUSED); - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, (OFDMSETPROTECT|CCKSETPROTECT|ALLN_SETPROTECT),FALSE,(pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent == 1)); - } - else - { - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_BG_PROTECTION_INUSED); - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, (OFDMSETPROTECT|CCKSETPROTECT|ALLN_SETPROTECT),TRUE,(pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent == 1)); + if (bUseBGProtection) { + OPSTATUS_SET_FLAG(pAd, + fOP_STATUS_BG_PROTECTION_INUSED); + AsicUpdateProtect(pAd, + pAd->MlmeAux. + AddHtInfo. + AddHtInfo2. + OperaionMode, + (OFDMSETPROTECT + | + CCKSETPROTECT + | + ALLN_SETPROTECT), + FALSE, + (pAd->MlmeAux. + AddHtInfo. + AddHtInfo2. + NonGfPresent + == 1)); + } else { + OPSTATUS_CLEAR_FLAG(pAd, + fOP_STATUS_BG_PROTECTION_INUSED); + AsicUpdateProtect(pAd, + pAd->MlmeAux. + AddHtInfo. + AddHtInfo2. + OperaionMode, + (OFDMSETPROTECT + | + CCKSETPROTECT + | + ALLN_SETPROTECT), + TRUE, + (pAd->MlmeAux. + AddHtInfo. + AddHtInfo2. + NonGfPresent + == 1)); } - DBGPRINT(RT_DEBUG_WARN, ("SYNC - AP changed B/G protection to %d\n", bUseBGProtection)); + DBGPRINT(RT_DEBUG_WARN, + ("SYNC - AP changed B/G protection to %d\n", + bUseBGProtection)); } - // check Ht protection mode. and adhere to the Non-GF device indication by AP. if ((AddHtInfoLen != 0) && - ((AddHtInfo.AddHtInfo2.OperaionMode != pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode) || - (AddHtInfo.AddHtInfo2.NonGfPresent != pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent))) - { - pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent = AddHtInfo.AddHtInfo2.NonGfPresent; - pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode = AddHtInfo.AddHtInfo2.OperaionMode; - if (pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent == 1) - { - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, FALSE, TRUE); - } - else - AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, FALSE, FALSE); - - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - AP changed N OperaionMode to %d\n", pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode)); + ((AddHtInfo.AddHtInfo2.OperaionMode != + pAd->MlmeAux.AddHtInfo.AddHtInfo2. + OperaionMode) + || (AddHtInfo.AddHtInfo2.NonGfPresent != + pAd->MlmeAux.AddHtInfo.AddHtInfo2. + NonGfPresent))) { + pAd->MlmeAux.AddHtInfo.AddHtInfo2. + NonGfPresent = + AddHtInfo.AddHtInfo2.NonGfPresent; + pAd->MlmeAux.AddHtInfo.AddHtInfo2. + OperaionMode = + AddHtInfo.AddHtInfo2.OperaionMode; + if (pAd->MlmeAux.AddHtInfo.AddHtInfo2. + NonGfPresent == 1) { + AsicUpdateProtect(pAd, + pAd->MlmeAux. + AddHtInfo. + AddHtInfo2. + OperaionMode, + ALLN_SETPROTECT, + FALSE, TRUE); + } else + AsicUpdateProtect(pAd, + pAd->MlmeAux. + AddHtInfo. + AddHtInfo2. + OperaionMode, + ALLN_SETPROTECT, + FALSE, FALSE); + + DBGPRINT(RT_DEBUG_TRACE, + ("SYNC - AP changed N OperaionMode to %d\n", + pAd->MlmeAux.AddHtInfo. + AddHtInfo2.OperaionMode)); } - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED) && - ERP_IS_USE_BARKER_PREAMBLE(Erp)) - { - MlmeSetTxPreamble(pAd, Rt802_11PreambleLong); - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - AP forced to use LONG preamble\n")); + if (OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED) + && ERP_IS_USE_BARKER_PREAMBLE(Erp)) { + MlmeSetTxPreamble(pAd, + Rt802_11PreambleLong); + DBGPRINT(RT_DEBUG_TRACE, + ("SYNC - AP forced to use LONG preamble\n")); } - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && - (EdcaParm.bValid == TRUE) && - (EdcaParm.EdcaUpdateCount != pAd->CommonCfg.APEdcaParm.EdcaUpdateCount)) - { - DBGPRINT(RT_DEBUG_TRACE, ("SYNC - AP change EDCA parameters(from %d to %d)\n", - pAd->CommonCfg.APEdcaParm.EdcaUpdateCount, - EdcaParm.EdcaUpdateCount)); + if (OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_WMM_INUSED) + && (EdcaParm.bValid == TRUE) + && (EdcaParm.EdcaUpdateCount != + pAd->CommonCfg.APEdcaParm. + EdcaUpdateCount)) { + DBGPRINT(RT_DEBUG_TRACE, + ("SYNC - AP change EDCA parameters(from %d to %d)\n", + pAd->CommonCfg.APEdcaParm. + EdcaUpdateCount, + EdcaParm.EdcaUpdateCount)); AsicSetEdcaParm(pAd, &EdcaParm); } - // copy QOS related information - NdisMoveMemory(&pAd->CommonCfg.APQbssLoad, &QbssLoad, sizeof(QBSS_LOAD_PARM)); - NdisMoveMemory(&pAd->CommonCfg.APQosCapability, &QosCapability, sizeof(QOS_CAPABILITY_PARM)); + NdisMoveMemory(&pAd->CommonCfg.APQbssLoad, + &QbssLoad, + sizeof(QBSS_LOAD_PARM)); + NdisMoveMemory(&pAd->CommonCfg.APQosCapability, + &QosCapability, + sizeof(QOS_CAPABILITY_PARM)); } - // only INFRASTRUCTURE mode support power-saving feature - if ((INFRA_ON(pAd) && (pAd->StaCfg.Psm == PWR_SAVE)) || (pAd->CommonCfg.bAPSDForcePowerSave)) - { + if ((INFRA_ON(pAd) && (pAd->StaCfg.Psm == PWR_SAVE)) + || (pAd->CommonCfg.bAPSDForcePowerSave)) { UCHAR FreeNumber; // 1. AP has backlogged unicast-to-me frame, stay AWAKE, send PSPOLL // 2. AP has backlogged broadcast/multicast frame and we want those frames, stay AWAKE // 3. we have outgoing frames in TxRing or MgmtRing, better stay AWAKE // 4. Psm change to PWR_SAVE, but AP not been informed yet, we better stay AWAKE // 5. otherwise, put PHY back to sleep to save battery. - if (MessageToMe) - { + if (MessageToMe) { #ifdef RTMP_MAC_PCI - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { + if (OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_PCIE_DEVICE)) { // Restore to correct BBP R3 value - if (pAd->Antenna.field.RxPath > 1) - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, pAd->StaCfg.BBPR3); + if (pAd->Antenna.field.RxPath > + 1) + RTMP_BBP_IO_WRITE8_BY_REG_ID + (pAd, BBP_R3, + pAd->StaCfg.BBPR3); // Turn clk to 80Mhz. } #endif // RTMP_MAC_PCI // - if (pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable && - pAd->CommonCfg.bAPSDAC_BE && pAd->CommonCfg.bAPSDAC_BK && pAd->CommonCfg.bAPSDAC_VI && pAd->CommonCfg.bAPSDAC_VO) - { - pAd->CommonCfg.bNeedSendTriggerFrame = TRUE; - } - else + if (pAd->CommonCfg.bAPSDCapable + && pAd->CommonCfg.APEdcaParm. + bAPSDCapable + && pAd->CommonCfg.bAPSDAC_BE + && pAd->CommonCfg.bAPSDAC_BK + && pAd->CommonCfg.bAPSDAC_VI + && pAd->CommonCfg.bAPSDAC_VO) { + pAd->CommonCfg. + bNeedSendTriggerFrame = + TRUE; + } else RTMP_PS_POLL_ENQUEUE(pAd); - } - else if (BcastFlag && (DtimCount == 0) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM)) + } else if (BcastFlag && (DtimCount == 0) + && OPSTATUS_TEST_FLAG(pAd, + fOP_STATUS_RECEIVE_DTIM)) { #ifdef RTMP_MAC_PCI - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - if (pAd->Antenna.field.RxPath > 1) - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, pAd->StaCfg.BBPR3); + if (OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_PCIE_DEVICE)) { + if (pAd->Antenna.field.RxPath > + 1) + RTMP_BBP_IO_WRITE8_BY_REG_ID + (pAd, BBP_R3, + pAd->StaCfg.BBPR3); } #endif // RTMP_MAC_PCI // - } - else if ((pAd->TxSwQueue[QID_AC_BK].Number != 0) || - (pAd->TxSwQueue[QID_AC_BE].Number != 0) || - (pAd->TxSwQueue[QID_AC_VI].Number != 0) || - (pAd->TxSwQueue[QID_AC_VO].Number != 0) || - (RTMPFreeTXDRequest(pAd, QID_AC_BK, TX_RING_SIZE - 1, &FreeNumber) != NDIS_STATUS_SUCCESS) || - (RTMPFreeTXDRequest(pAd, QID_AC_BE, TX_RING_SIZE - 1, &FreeNumber) != NDIS_STATUS_SUCCESS) || - (RTMPFreeTXDRequest(pAd, QID_AC_VI, TX_RING_SIZE - 1, &FreeNumber) != NDIS_STATUS_SUCCESS) || - (RTMPFreeTXDRequest(pAd, QID_AC_VO, TX_RING_SIZE - 1, &FreeNumber) != NDIS_STATUS_SUCCESS) || - (RTMPFreeTXDRequest(pAd, QID_MGMT, MGMT_RING_SIZE - 1, &FreeNumber) != NDIS_STATUS_SUCCESS)) - { + } else + if ((pAd->TxSwQueue[QID_AC_BK].Number != 0) + || (pAd->TxSwQueue[QID_AC_BE].Number != + 0) + || (pAd->TxSwQueue[QID_AC_VI].Number != + 0) + || (pAd->TxSwQueue[QID_AC_VO].Number != + 0) + || + (RTMPFreeTXDRequest + (pAd, QID_AC_BK, TX_RING_SIZE - 1, + &FreeNumber) != NDIS_STATUS_SUCCESS) + || + (RTMPFreeTXDRequest + (pAd, QID_AC_BE, TX_RING_SIZE - 1, + &FreeNumber) != NDIS_STATUS_SUCCESS) + || + (RTMPFreeTXDRequest + (pAd, QID_AC_VI, TX_RING_SIZE - 1, + &FreeNumber) != NDIS_STATUS_SUCCESS) + || + (RTMPFreeTXDRequest + (pAd, QID_AC_VO, TX_RING_SIZE - 1, + &FreeNumber) != NDIS_STATUS_SUCCESS) + || + (RTMPFreeTXDRequest + (pAd, QID_MGMT, MGMT_RING_SIZE - 1, + &FreeNumber) != + NDIS_STATUS_SUCCESS)) { // TODO: consider scheduled HCCA. might not be proper to use traditional DTIM-based power-saving scheme // can we cheat here (i.e. just check MGMT & AC_BE) for better performance? #ifdef RTMP_MAC_PCI - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) - { - if (pAd->Antenna.field.RxPath > 1) - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, pAd->StaCfg.BBPR3); + if (OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_PCIE_DEVICE)) { + if (pAd->Antenna.field.RxPath > + 1) + RTMP_BBP_IO_WRITE8_BY_REG_ID + (pAd, BBP_R3, + pAd->StaCfg.BBPR3); } #endif // RTMP_MAC_PCI // - } - else - { - if ((pAd->CommonCfg.bACMAPSDTr[QID_AC_VO]) || - (pAd->CommonCfg.bACMAPSDTr[QID_AC_VI]) || - (pAd->CommonCfg.bACMAPSDTr[QID_AC_BK]) || - (pAd->CommonCfg.bACMAPSDTr[QID_AC_BE])) - { + } else { + if ((pAd->CommonCfg. + bACMAPSDTr[QID_AC_VO]) + || (pAd->CommonCfg. + bACMAPSDTr[QID_AC_VI]) + || (pAd->CommonCfg. + bACMAPSDTr[QID_AC_BK]) + || (pAd->CommonCfg. + bACMAPSDTr[QID_AC_BE])) { /* - WMM Spec v1.0 3.6.2.4, - The WMM STA shall remain awake until it receives a - QoS Data or Null frame addressed to it, with the - EOSP subfield in QoS Control field set to 1. - - So we can not sleep here or we will suffer a case: - - PS Management Frame --> - Trigger frame --> - Beacon (TIM=0) (Beacon is closer to Trig frame) --> - Station goes to sleep --> - AP delivery queued UAPSD packets --> - Station can NOT receive the reply - - Maybe we need a timeout timer to avoid that we do - NOT receive the EOSP frame. - - We can not use More Data to check if SP is ended - due to MaxSPLength. - */ - } - else - { - USHORT NextDtim = DtimCount; - - if (NextDtim == 0) - NextDtim = DtimPeriod; - - TbttNumToNextWakeUp = pAd->StaCfg.DefaultListenCount; - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM) && (TbttNumToNextWakeUp > NextDtim)) - TbttNumToNextWakeUp = NextDtim; - - if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - // Set a flag to go to sleep . Then after parse this RxDoneInterrupt, will go to sleep mode. - pAd->ThisTbttNumToNextWakeUp = TbttNumToNextWakeUp; - AsicSleepThenAutoWakeup(pAd, pAd->ThisTbttNumToNextWakeUp); + WMM Spec v1.0 3.6.2.4, + The WMM STA shall remain awake until it receives a + QoS Data or Null frame addressed to it, with the + EOSP subfield in QoS Control field set to 1. + + So we can not sleep here or we will suffer a case: + + PS Management Frame --> + Trigger frame --> + Beacon (TIM=0) (Beacon is closer to Trig frame) --> + Station goes to sleep --> + AP delivery queued UAPSD packets --> + Station can NOT receive the reply + + Maybe we need a timeout timer to avoid that we do + NOT receive the EOSP frame. + + We can not use More Data to check if SP is ended + due to MaxSPLength. + */ + } else { + USHORT NextDtim = DtimCount; + + if (NextDtim == 0) + NextDtim = DtimPeriod; + + TbttNumToNextWakeUp = + pAd->StaCfg. + DefaultListenCount; + if (OPSTATUS_TEST_FLAG + (pAd, + fOP_STATUS_RECEIVE_DTIM) + && (TbttNumToNextWakeUp > + NextDtim)) + TbttNumToNextWakeUp = + NextDtim; + + if (!OPSTATUS_TEST_FLAG + (pAd, fOP_STATUS_DOZE)) { + // Set a flag to go to sleep . Then after parse this RxDoneInterrupt, will go to sleep mode. + pAd-> + ThisTbttNumToNextWakeUp + = + TbttNumToNextWakeUp; + AsicSleepThenAutoWakeup + (pAd, + pAd-> + ThisTbttNumToNextWakeUp); } } } @@ -1430,116 +1703,126 @@ VOID PeerBeacon( Receive PROBE REQ from remote peer when operating in IBSS mode ========================================================================== */ -VOID PeerProbeReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID PeerProbeReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Addr2[MAC_ADDR_LEN]; - CHAR Ssid[MAX_LEN_OF_SSID]; - UCHAR SsidLen; - UCHAR HtLen, AddHtLen, NewExtLen; + UCHAR Addr2[MAC_ADDR_LEN]; + CHAR Ssid[MAX_LEN_OF_SSID]; + UCHAR SsidLen; + UCHAR HtLen, AddHtLen, NewExtLen; HEADER_802_11 ProbeRspHdr; - NDIS_STATUS NStatus; - PUCHAR pOutBuffer = NULL; - ULONG FrameLen = 0; + NDIS_STATUS NStatus; + PUCHAR pOutBuffer = NULL; + ULONG FrameLen = 0; LARGE_INTEGER FakeTimestamp; - UCHAR DsLen = 1, IbssLen = 2; - UCHAR LocalErpIe[3] = {IE_ERP, 1, 0}; - BOOLEAN Privacy; - USHORT CapabilityInfo; - UCHAR RSNIe = IE_WPA; + UCHAR DsLen = 1, IbssLen = 2; + UCHAR LocalErpIe[3] = { IE_ERP, 1, 0 }; + BOOLEAN Privacy; + USHORT CapabilityInfo; + UCHAR RSNIe = IE_WPA; - if (! ADHOC_ON(pAd)) + if (!ADHOC_ON(pAd)) return; - if (PeerProbeReqSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, Ssid, &SsidLen)) - { - if ((SsidLen == 0) || SSID_EQUAL(Ssid, SsidLen, pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen)) - { + if (PeerProbeReqSanity + (pAd, Elem->Msg, Elem->MsgLen, Addr2, Ssid, &SsidLen)) { + if ((SsidLen == 0) + || SSID_EQUAL(Ssid, SsidLen, pAd->CommonCfg.Ssid, + pAd->CommonCfg.SsidLen)) { // allocate and send out ProbeRsp frame - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory if (NStatus != NDIS_STATUS_SUCCESS) return; //pAd->StaCfg.AtimWin = 0; // ?????? - Privacy = (pAd->StaCfg.WepStatus == Ndis802_11Encryption1Enabled) || - (pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) || - (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled); - CapabilityInfo = CAP_GENERATE(0, 1, Privacy, (pAd->CommonCfg.TxPreamble == Rt802_11PreambleShort), 0, 0); - - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &ProbeRspHdr, - TIMESTAMP_LEN, &FakeTimestamp, - 2, &pAd->CommonCfg.BeaconPeriod, - 2, &CapabilityInfo, - 1, &SsidIe, - 1, &pAd->CommonCfg.SsidLen, - pAd->CommonCfg.SsidLen, pAd->CommonCfg.Ssid, - 1, &SupRateIe, - 1, &pAd->StaActive.SupRateLen, - pAd->StaActive.SupRateLen, pAd->StaActive.SupRate, - 1, &DsIe, - 1, &DsLen, - 1, &pAd->CommonCfg.Channel, - 1, &IbssIe, - 1, &IbssLen, - 2, &pAd->StaActive.AtimWin, - END_OF_ARGS); - - if (pAd->StaActive.ExtRateLen) - { + Privacy = + (pAd->StaCfg.WepStatus == + Ndis802_11Encryption1Enabled) + || (pAd->StaCfg.WepStatus == + Ndis802_11Encryption2Enabled) + || (pAd->StaCfg.WepStatus == + Ndis802_11Encryption3Enabled); + CapabilityInfo = + CAP_GENERATE(0, 1, Privacy, + (pAd->CommonCfg.TxPreamble == + Rt802_11PreambleShort), 0, 0); + + MakeOutgoingFrame(pOutBuffer, &FrameLen, + sizeof(HEADER_802_11), &ProbeRspHdr, + TIMESTAMP_LEN, &FakeTimestamp, + 2, &pAd->CommonCfg.BeaconPeriod, + 2, &CapabilityInfo, + 1, &SsidIe, + 1, &pAd->CommonCfg.SsidLen, + pAd->CommonCfg.SsidLen, + pAd->CommonCfg.Ssid, 1, &SupRateIe, 1, + &pAd->StaActive.SupRateLen, + pAd->StaActive.SupRateLen, + pAd->StaActive.SupRate, 1, &DsIe, 1, + &DsLen, 1, &pAd->CommonCfg.Channel, 1, + &IbssIe, 1, &IbssLen, 2, + &pAd->StaActive.AtimWin, END_OF_ARGS); + + if (pAd->StaActive.ExtRateLen) { ULONG tmp; - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 3, LocalErpIe, - 1, &ExtRateIe, - 1, &pAd->StaActive.ExtRateLen, - pAd->StaActive.ExtRateLen, &pAd->StaActive.ExtRate, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, + 3, LocalErpIe, + 1, &ExtRateIe, + 1, &pAd->StaActive.ExtRateLen, + pAd->StaActive.ExtRateLen, + &pAd->StaActive.ExtRate, + END_OF_ARGS); FrameLen += tmp; } - // If adhoc secruity is set for WPA-None, append the cipher suite IE - if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) - { + if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) { ULONG tmp; - MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, - 1, &RSNIe, - 1, &pAd->StaCfg.RSNIE_Len, - pAd->StaCfg.RSNIE_Len, pAd->StaCfg.RSN_IE, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, + 1, &RSNIe, + 1, &pAd->StaCfg.RSNIE_Len, + pAd->StaCfg.RSNIE_Len, + pAd->StaCfg.RSN_IE, + END_OF_ARGS); FrameLen += tmp; } - if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) - { + if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) { ULONG TmpLen; - UCHAR BROADCOM[4] = {0x0, 0x90, 0x4c, 0x33}; + UCHAR BROADCOM[4] = { 0x0, 0x90, 0x4c, 0x33 }; HtLen = sizeof(pAd->CommonCfg.HtCapability); AddHtLen = sizeof(pAd->CommonCfg.AddHTInfo); NewExtLen = 1; //New extension channel offset IE is included in Beacon, Probe Rsp or channel Switch Announcement Frame - if (pAd->bBroadComHT == TRUE) - { - MakeOutgoingFrame(pOutBuffer + FrameLen, &TmpLen, - 1, &WpaIe, - 4, &BROADCOM[0], - pAd->MlmeAux.HtCapabilityLen, &pAd->MlmeAux.HtCapability, - END_OF_ARGS); - } - else - { - MakeOutgoingFrame(pOutBuffer + FrameLen, &TmpLen, - 1, &HtCapIe, - 1, &HtLen, - sizeof(HT_CAPABILITY_IE), &pAd->CommonCfg.HtCapability, - 1, &AddHtInfoIe, - 1, &AddHtLen, - sizeof(ADD_HT_INFO_IE), &pAd->CommonCfg.AddHTInfo, - 1, &NewExtChanIe, - 1, &NewExtLen, - sizeof(NEW_EXT_CHAN_IE), &pAd->CommonCfg.NewExtChanOffset, - END_OF_ARGS); + if (pAd->bBroadComHT == TRUE) { + MakeOutgoingFrame(pOutBuffer + FrameLen, + &TmpLen, 1, &WpaIe, 4, + &BROADCOM[0], + pAd->MlmeAux. + HtCapabilityLen, + &pAd->MlmeAux. + HtCapability, + END_OF_ARGS); + } else { + MakeOutgoingFrame(pOutBuffer + FrameLen, + &TmpLen, 1, &HtCapIe, + 1, &HtLen, + sizeof + (HT_CAPABILITY_IE), + &pAd->CommonCfg. + HtCapability, 1, + &AddHtInfoIe, 1, + &AddHtLen, + sizeof + (ADD_HT_INFO_IE), + &pAd->CommonCfg. + AddHTInfo, 1, + &NewExtChanIe, 1, + &NewExtLen, + sizeof + (NEW_EXT_CHAN_IE), + &pAd->CommonCfg. + NewExtChanOffset, + END_OF_ARGS); } FrameLen += TmpLen; } @@ -1550,9 +1833,7 @@ VOID PeerProbeReqAction( } } -VOID BeaconTimeoutAtJoinAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID BeaconTimeoutAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { USHORT Status; DBGPRINT(RT_DEBUG_TRACE, ("SYNC - BeaconTimeoutAtJoinAction\n")); @@ -1567,17 +1848,15 @@ VOID BeaconTimeoutAtJoinAction( Scan timeout procedure. basically add channel index by 1 and rescan ========================================================================== */ -VOID ScanTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID ScanTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { pAd->MlmeAux.Channel = NextChannel(pAd, pAd->MlmeAux.Channel); // Only one channel scanned for CISCO beacon request if ((pAd->MlmeAux.ScanType == SCAN_CISCO_ACTIVE) || - (pAd->MlmeAux.ScanType == SCAN_CISCO_PASSIVE) || - (pAd->MlmeAux.ScanType == SCAN_CISCO_NOISE) || - (pAd->MlmeAux.ScanType == SCAN_CISCO_CHANNEL_LOAD)) + (pAd->MlmeAux.ScanType == SCAN_CISCO_PASSIVE) || + (pAd->MlmeAux.ScanType == SCAN_CISCO_NOISE) || + (pAd->MlmeAux.ScanType == SCAN_CISCO_CHANNEL_LOAD)) pAd->MlmeAux.Channel = 0; // this routine will stop if pAd->MlmeAux.Channel == 0 @@ -1589,12 +1868,12 @@ VOID ScanTimeoutAction( Description: ========================================================================== */ -VOID InvalidStateWhenScan( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID InvalidStateWhenScan(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("AYNC - InvalidStateWhenScan(state=%ld). Reset SYNC machine\n", pAd->Mlme.SyncMachine.CurrState)); + DBGPRINT(RT_DEBUG_TRACE, + ("AYNC - InvalidStateWhenScan(state=%ld). Reset SYNC machine\n", + pAd->Mlme.SyncMachine.CurrState)); pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; Status = MLME_STATE_MACHINE_REJECT; MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_SCAN_CONF, 2, &Status); @@ -1605,12 +1884,12 @@ VOID InvalidStateWhenScan( Description: ========================================================================== */ -VOID InvalidStateWhenJoin( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID InvalidStateWhenJoin(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("InvalidStateWhenJoin(state=%ld). Reset SYNC machine\n", pAd->Mlme.SyncMachine.CurrState)); + DBGPRINT(RT_DEBUG_TRACE, + ("InvalidStateWhenJoin(state=%ld). Reset SYNC machine\n", + pAd->Mlme.SyncMachine.CurrState)); pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; Status = MLME_STATE_MACHINE_REJECT; MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_JOIN_CONF, 2, &Status); @@ -1621,12 +1900,12 @@ VOID InvalidStateWhenJoin( Description: ========================================================================== */ -VOID InvalidStateWhenStart( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID InvalidStateWhenStart(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { USHORT Status; - DBGPRINT(RT_DEBUG_TRACE, ("InvalidStateWhenStart(state=%ld). Reset SYNC machine\n", pAd->Mlme.SyncMachine.CurrState)); + DBGPRINT(RT_DEBUG_TRACE, + ("InvalidStateWhenStart(state=%ld). Reset SYNC machine\n", + pAd->Mlme.SyncMachine.CurrState)); pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; Status = MLME_STATE_MACHINE_REJECT; MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_START_CONF, 2, &Status); @@ -1640,56 +1919,51 @@ VOID InvalidStateWhenStart( ========================================================================== */ -VOID EnqueuePsPoll( - IN PRTMP_ADAPTER pAd) +VOID EnqueuePsPoll(IN PRTMP_ADAPTER pAd) { - if (pAd->StaCfg.WindowsPowerMode == Ndis802_11PowerModeLegacy_PSP) - pAd->PsPollFrame.FC.PwrMgmt = PWR_SAVE; - MiniportMMRequest(pAd, 0, (PUCHAR)&pAd->PsPollFrame, sizeof(PSPOLL_FRAME)); + pAd->PsPollFrame.FC.PwrMgmt = PWR_SAVE; + MiniportMMRequest(pAd, 0, (PUCHAR) & pAd->PsPollFrame, + sizeof(PSPOLL_FRAME)); } - /* ========================================================================== Description: ========================================================================== */ -VOID EnqueueProbeRequest( - IN PRTMP_ADAPTER pAd) +VOID EnqueueProbeRequest(IN PRTMP_ADAPTER pAd) { - NDIS_STATUS NState; - PUCHAR pOutBuffer; - ULONG FrameLen = 0; - HEADER_802_11 Hdr80211; + NDIS_STATUS NState; + PUCHAR pOutBuffer; + ULONG FrameLen = 0; + HEADER_802_11 Hdr80211; DBGPRINT(RT_DEBUG_TRACE, ("force out a ProbeRequest ...\n")); - NState = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory - if (NState == NDIS_STATUS_SUCCESS) - { - MgtMacHeaderInit(pAd, &Hdr80211, SUBTYPE_PROBE_REQ, 0, BROADCAST_ADDR, BROADCAST_ADDR); + NState = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + if (NState == NDIS_STATUS_SUCCESS) { + MgtMacHeaderInit(pAd, &Hdr80211, SUBTYPE_PROBE_REQ, 0, + BROADCAST_ADDR, BROADCAST_ADDR); // this ProbeRequest explicitly specify SSID to reduce unwanted ProbeResponse - MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &Hdr80211, - 1, &SsidIe, - 1, &pAd->CommonCfg.SsidLen, - pAd->CommonCfg.SsidLen, pAd->CommonCfg.Ssid, - 1, &SupRateIe, - 1, &pAd->StaActive.SupRateLen, - pAd->StaActive.SupRateLen, pAd->StaActive.SupRate, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer, &FrameLen, + sizeof(HEADER_802_11), &Hdr80211, + 1, &SsidIe, + 1, &pAd->CommonCfg.SsidLen, + pAd->CommonCfg.SsidLen, pAd->CommonCfg.Ssid, + 1, &SupRateIe, + 1, &pAd->StaActive.SupRateLen, + pAd->StaActive.SupRateLen, + pAd->StaActive.SupRate, END_OF_ARGS); MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); } } -BOOLEAN ScanRunning( - IN PRTMP_ADAPTER pAd) +BOOLEAN ScanRunning(IN PRTMP_ADAPTER pAd) { return (pAd->Mlme.SyncMachine.CurrState == SCAN_LISTEN) ? TRUE : FALSE; } - diff --git a/drivers/staging/rt2860/sta/wpa.c b/drivers/staging/rt2860/sta/wpa.c index c6c3f3bc418d..0a45643eedd9 100644 --- a/drivers/staging/rt2860/sta/wpa.c +++ b/drivers/staging/rt2860/sta/wpa.c @@ -37,7 +37,7 @@ */ #include "../rt_config.h" -void inc_byte_array(UCHAR *counter, int len); +void inc_byte_array(UCHAR * counter, int len); /* ======================================================================== @@ -58,33 +58,29 @@ void inc_byte_array(UCHAR *counter, int len); ======================================================================== */ -VOID RTMPReportMicError( - IN PRTMP_ADAPTER pAd, - IN PCIPHER_KEY pWpaKey) +VOID RTMPReportMicError(IN PRTMP_ADAPTER pAd, IN PCIPHER_KEY pWpaKey) { - ULONG Now; - UCHAR unicastKey = (pWpaKey->Type == PAIRWISE_KEY ? 1:0); + ULONG Now; + UCHAR unicastKey = (pWpaKey->Type == PAIRWISE_KEY ? 1 : 0); // Record Last MIC error time and count NdisGetSystemUpTime(&Now); - if (pAd->StaCfg.MicErrCnt == 0) - { + if (pAd->StaCfg.MicErrCnt == 0) { pAd->StaCfg.MicErrCnt++; pAd->StaCfg.LastMicErrorTime = Now; - NdisZeroMemory(pAd->StaCfg.ReplayCounter, 8); - } - else if (pAd->StaCfg.MicErrCnt == 1) - { - if ((pAd->StaCfg.LastMicErrorTime + (60 * OS_HZ)) < Now) - { + NdisZeroMemory(pAd->StaCfg.ReplayCounter, 8); + } else if (pAd->StaCfg.MicErrCnt == 1) { + if ((pAd->StaCfg.LastMicErrorTime + (60 * OS_HZ)) < Now) { // Update Last MIC error time, this did not violate two MIC errors within 60 seconds pAd->StaCfg.LastMicErrorTime = Now; - } - else - { + } else { if (pAd->CommonCfg.bWirelessEvent) - RTMPSendWirelessEvent(pAd, IW_COUNTER_MEASURES_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); + RTMPSendWirelessEvent(pAd, + IW_COUNTER_MEASURES_EVENT_FLAG, + pAd->MacTab. + Content[BSSID_WCID].Addr, + BSS0, 0); pAd->StaCfg.LastMicErrorTime = Now; // Violate MIC error counts, MIC countermeasures kicks in @@ -101,154 +97,139 @@ VOID RTMPReportMicError( // RTMPRingCleanUp(pAd, QID_AC_VO); // RTMPRingCleanUp(pAd, QID_HCCA); } - } - else - { + } else { // MIC error count >= 2 // This should not happen ; } - MlmeEnqueue(pAd, - MLME_CNTL_STATE_MACHINE, - OID_802_11_MIC_FAILURE_REPORT_FRAME, - 1, - &unicastKey); - - if (pAd->StaCfg.MicErrCnt == 2) - { - RTMPSetTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, 100); - } + MlmeEnqueue(pAd, + MLME_CNTL_STATE_MACHINE, + OID_802_11_MIC_FAILURE_REPORT_FRAME, 1, &unicastKey); + + if (pAd->StaCfg.MicErrCnt == 2) { + RTMPSetTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, 100); + } } #define LENGTH_EAP_H 4 // If the received frame is EAP-Packet ,find out its EAP-Code (Request(0x01), Response(0x02), Success(0x03), Failure(0x04)). -INT WpaCheckEapCode( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pFrame, - IN USHORT FrameLen, - IN USHORT OffSet) +INT WpaCheckEapCode(IN PRTMP_ADAPTER pAd, + IN PUCHAR pFrame, IN USHORT FrameLen, IN USHORT OffSet) { - PUCHAR pData; - INT result = 0; + PUCHAR pData; + INT result = 0; - if( FrameLen < OffSet + LENGTH_EAPOL_H + LENGTH_EAP_H ) + if (FrameLen < OffSet + LENGTH_EAPOL_H + LENGTH_EAP_H) return result; - pData = pFrame + OffSet; // skip offset bytes + pData = pFrame + OffSet; // skip offset bytes - if(*(pData+1) == EAPPacket) // 802.1x header - Packet Type + if (*(pData + 1) == EAPPacket) // 802.1x header - Packet Type { - result = *(pData+4); // EAP header - Code + result = *(pData + 4); // EAP header - Code } return result; } -VOID WpaSendMicFailureToWpaSupplicant( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bUnicast) +VOID WpaSendMicFailureToWpaSupplicant(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUnicast) { - char custom[IW_CUSTOM_MAX] = {0}; + char custom[IW_CUSTOM_MAX] = { 0 }; - sprintf(custom, "MLME-MICHAELMICFAILURE.indication"); - if(bUnicast) - sprintf(custom, "%s unicast", custom); + sprintf(custom, "MLME-MICHAELMICFAILURE.indication"); + if (bUnicast) + sprintf(custom, "%s unicast", custom); - RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, -1, NULL, (PUCHAR)custom, strlen(custom)); + RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, -1, NULL, (PUCHAR) custom, + strlen(custom)); - return; + return; } -VOID WpaMicFailureReportFrame( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem) +VOID WpaMicFailureReportFrame(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - PUCHAR pOutBuffer = NULL; - UCHAR Header802_3[14]; - ULONG FrameLen = 0; - EAPOL_PACKET Packet; - UCHAR Mic[16]; - BOOLEAN bUnicast; + PUCHAR pOutBuffer = NULL; + UCHAR Header802_3[14]; + ULONG FrameLen = 0; + EAPOL_PACKET Packet; + UCHAR Mic[16]; + BOOLEAN bUnicast; DBGPRINT(RT_DEBUG_TRACE, ("WpaMicFailureReportFrame ----->\n")); - bUnicast = (Elem->Msg[0] == 1 ? TRUE:FALSE); + bUnicast = (Elem->Msg[0] == 1 ? TRUE : FALSE); pAd->Sequence = ((pAd->Sequence) + 1) & (MAX_SEQ_NUMBER); // init 802.3 header and Fill Packet - MAKE_802_3_HEADER(Header802_3, pAd->CommonCfg.Bssid, pAd->CurrentAddress, EAPOL); + MAKE_802_3_HEADER(Header802_3, pAd->CommonCfg.Bssid, + pAd->CurrentAddress, EAPOL); NdisZeroMemory(&Packet, sizeof(Packet)); - Packet.ProVer = EAPOL_VER; - Packet.ProType = EAPOLKey; + Packet.ProVer = EAPOL_VER; + Packet.ProType = EAPOLKey; Packet.KeyDesc.Type = WPA1_KEY_DESC; - // Request field presented - Packet.KeyDesc.KeyInfo.Request = 1; + // Request field presented + Packet.KeyDesc.KeyInfo.Request = 1; - if(pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { + if (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) { Packet.KeyDesc.KeyInfo.KeyDescVer = 2; - } - else // TKIP + } else // TKIP { Packet.KeyDesc.KeyInfo.KeyDescVer = 1; } - Packet.KeyDesc.KeyInfo.KeyType = (bUnicast ? PAIRWISEKEY : GROUPKEY); + Packet.KeyDesc.KeyInfo.KeyType = (bUnicast ? PAIRWISEKEY : GROUPKEY); // KeyMic field presented - Packet.KeyDesc.KeyInfo.KeyMic = 1; + Packet.KeyDesc.KeyInfo.KeyMic = 1; - // Error field presented - Packet.KeyDesc.KeyInfo.Error = 1; + // Error field presented + Packet.KeyDesc.KeyInfo.Error = 1; // Update packet length after decide Key data payload SET_UINT16_TO_ARRARY(Packet.Body_Len, LEN_EAPOL_KEY_MSG) - - // Key Replay Count - NdisMoveMemory(Packet.KeyDesc.ReplayCounter, pAd->StaCfg.ReplayCounter, LEN_KEY_DESC_REPLAY); - inc_byte_array(pAd->StaCfg.ReplayCounter, 8); + // Key Replay Count + NdisMoveMemory(Packet.KeyDesc.ReplayCounter, + pAd->StaCfg.ReplayCounter, LEN_KEY_DESC_REPLAY); + inc_byte_array(pAd->StaCfg.ReplayCounter, 8); // Convert to little-endian format. - *((USHORT *)&Packet.KeyDesc.KeyInfo) = cpu2le16(*((USHORT *)&Packet.KeyDesc.KeyInfo)); - + *((USHORT *) & Packet.KeyDesc.KeyInfo) = + cpu2le16(*((USHORT *) & Packet.KeyDesc.KeyInfo)); - MlmeAllocateMemory(pAd, (PUCHAR *)&pOutBuffer); // allocate memory - if(pOutBuffer == NULL) - { + MlmeAllocateMemory(pAd, (PUCHAR *) & pOutBuffer); // allocate memory + if (pOutBuffer == NULL) { return; } - // Prepare EAPOL frame for MIC calculation // Be careful, only EAPOL frame is counted for MIC calculation - MakeOutgoingFrame(pOutBuffer, &FrameLen, - CONV_ARRARY_TO_UINT16(Packet.Body_Len) + 4, &Packet, - END_OF_ARGS); + MakeOutgoingFrame(pOutBuffer, &FrameLen, + CONV_ARRARY_TO_UINT16(Packet.Body_Len) + 4, &Packet, + END_OF_ARGS); // Prepare and Fill MIC value NdisZeroMemory(Mic, sizeof(Mic)); - if(pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) - { // AES - UCHAR digest[20] = {0}; - HMAC_SHA1(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, digest, SHA1_DIGEST_SIZE); + if (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) { // AES + UCHAR digest[20] = { 0 }; + HMAC_SHA1(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, + digest, SHA1_DIGEST_SIZE); NdisMoveMemory(Mic, digest, LEN_KEY_DESC_MIC); - } - else - { // TKIP - HMAC_MD5(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, Mic, MD5_DIGEST_SIZE); + } else { // TKIP + HMAC_MD5(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, + Mic, MD5_DIGEST_SIZE); } NdisMoveMemory(Packet.KeyDesc.KeyMic, Mic, LEN_KEY_DESC_MIC); // copy frame to Tx ring and send MIC failure report frame to authenticator RTMPToWirelessSta(pAd, &pAd->MacTab.Content[BSSID_WCID], - Header802_3, LENGTH_802_3, - (PUCHAR)&Packet, - CONV_ARRARY_TO_UINT16(Packet.Body_Len) + 4, FALSE); + Header802_3, LENGTH_802_3, + (PUCHAR) & Packet, + CONV_ARRARY_TO_UINT16(Packet.Body_Len) + 4, FALSE); - MlmeFreeMemory(pAd, (PUCHAR)pOutBuffer); + MlmeFreeMemory(pAd, (PUCHAR) pOutBuffer); DBGPRINT(RT_DEBUG_TRACE, ("WpaMicFailureReportFrame <-----\n")); } @@ -262,7 +243,7 @@ VOID WpaMicFailureReportFrame( * rolling over to more significant bytes if the byte was incremented from * 0xff to 0x00. */ -void inc_byte_array(UCHAR *counter, int len) +void inc_byte_array(UCHAR * counter, int len) { int pos = len - 1; while (pos >= 0) { @@ -273,26 +254,27 @@ void inc_byte_array(UCHAR *counter, int len) } } -VOID WpaDisassocApAndBlockAssoc( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +VOID WpaDisassocApAndBlockAssoc(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3) { - RTMP_ADAPTER *pAd = (PRTMP_ADAPTER)FunctionContext; - MLME_DISASSOC_REQ_STRUCT DisassocReq; + RTMP_ADAPTER *pAd = (PRTMP_ADAPTER) FunctionContext; + MLME_DISASSOC_REQ_STRUCT DisassocReq; // disassoc from current AP first - DBGPRINT(RT_DEBUG_TRACE, ("RTMPReportMicError - disassociate with current AP after sending second continuous EAPOL frame\n")); - DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_MIC_FAILURE); - MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); + DBGPRINT(RT_DEBUG_TRACE, + ("RTMPReportMicError - disassociate with current AP after sending second continuous EAPOL frame\n")); + DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, + REASON_MIC_FAILURE); + MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, + sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; pAd->StaCfg.bBlockAssoc = TRUE; } -VOID WpaStaPairwiseKeySetting( - IN PRTMP_ADAPTER pAd) +VOID WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd) { PCIPHER_KEY pSharedKey; PMAC_TABLE_ENTRY pEntry; @@ -307,9 +289,11 @@ VOID WpaStaPairwiseKeySetting( // Prepare pair-wise key information into shared key table NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); pSharedKey->KeyLen = LEN_TKIP_EK; - NdisMoveMemory(pSharedKey->Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); - NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_RXMICK); - NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); + NdisMoveMemory(pSharedKey->Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); + NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.PTK[48], + LEN_TKIP_RXMICK); + NdisMoveMemory(pSharedKey->TxMic, + &pAd->StaCfg.PTK[48 + LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); // Decide its ChiperAlg if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) @@ -320,37 +304,35 @@ VOID WpaStaPairwiseKeySetting( pSharedKey->CipherAlg = CIPHER_NONE; // Update these related information to MAC_TABLE_ENTRY - NdisMoveMemory(pEntry->PairwiseKey.Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); - NdisMoveMemory(pEntry->PairwiseKey.RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_RXMICK); - NdisMoveMemory(pEntry->PairwiseKey.TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); + NdisMoveMemory(pEntry->PairwiseKey.Key, &pAd->StaCfg.PTK[32], + LEN_TKIP_EK); + NdisMoveMemory(pEntry->PairwiseKey.RxMic, &pAd->StaCfg.PTK[48], + LEN_TKIP_RXMICK); + NdisMoveMemory(pEntry->PairwiseKey.TxMic, + &pAd->StaCfg.PTK[48 + LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); pEntry->PairwiseKey.CipherAlg = pSharedKey->CipherAlg; // Update pairwise key information to ASIC Shared Key Table AsicAddSharedKeyEntry(pAd, - BSS0, - 0, - pSharedKey->CipherAlg, - pSharedKey->Key, - pSharedKey->TxMic, - pSharedKey->RxMic); + BSS0, + 0, + pSharedKey->CipherAlg, + pSharedKey->Key, + pSharedKey->TxMic, pSharedKey->RxMic); // Update ASIC WCID attribute table and IVEIV table - RTMPAddWcidAttributeEntry(pAd, - BSS0, - 0, - pSharedKey->CipherAlg, - pEntry); + RTMPAddWcidAttributeEntry(pAd, BSS0, 0, pSharedKey->CipherAlg, pEntry); STA_PORT_SECURED(pAd); pAd->IndicateMediaState = NdisMediaStateConnected; - DBGPRINT(RT_DEBUG_TRACE, ("%s : AID(%d) port secured\n", __func__, pEntry->Aid)); + DBGPRINT(RT_DEBUG_TRACE, + ("%s : AID(%d) port secured\n", __func__, pEntry->Aid)); } -VOID WpaStaGroupKeySetting( - IN PRTMP_ADAPTER pAd) +VOID WpaStaGroupKeySetting(IN PRTMP_ADAPTER pAd) { - PCIPHER_KEY pSharedKey; + PCIPHER_KEY pSharedKey; pSharedKey = &pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId]; @@ -358,8 +340,10 @@ VOID WpaStaGroupKeySetting( NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); pSharedKey->KeyLen = LEN_TKIP_EK; NdisMoveMemory(pSharedKey->Key, pAd->StaCfg.GTK, LEN_TKIP_EK); - NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.GTK[16], LEN_TKIP_RXMICK); - NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.GTK[24], LEN_TKIP_TXMICK); + NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.GTK[16], + LEN_TKIP_RXMICK); + NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.GTK[24], + LEN_TKIP_TXMICK); // Update Shared Key CipherAlg pSharedKey->CipherAlg = CIPHER_NONE; @@ -374,18 +358,16 @@ VOID WpaStaGroupKeySetting( // Update group key information to ASIC Shared Key Table AsicAddSharedKeyEntry(pAd, - BSS0, - pAd->StaCfg.DefaultKeyId, - pSharedKey->CipherAlg, - pSharedKey->Key, - pSharedKey->TxMic, - pSharedKey->RxMic); + BSS0, + pAd->StaCfg.DefaultKeyId, + pSharedKey->CipherAlg, + pSharedKey->Key, + pSharedKey->TxMic, pSharedKey->RxMic); // Update ASIC WCID attribute table and IVEIV table RTMPAddWcidAttributeEntry(pAd, - BSS0, - pAd->StaCfg.DefaultKeyId, - pSharedKey->CipherAlg, - NULL); + BSS0, + pAd->StaCfg.DefaultKeyId, + pSharedKey->CipherAlg, NULL); } -- GitLab From 52b81c89e564cdde8f2b4ccd0e314f04f8f23ab9 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 11 Dec 2009 12:23:14 -0800 Subject: [PATCH 162/235] Staging: rt28x0: run *.h files through Lindent Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/ap.h | 42 +- drivers/staging/rt2860/chip/mac_pci.h | 149 +- drivers/staging/rt2860/chip/mac_usb.h | 252 +- drivers/staging/rt2860/chip/rt2860.h | 6 +- drivers/staging/rt2860/chip/rt2870.h | 3 +- drivers/staging/rt2860/chip/rt3070.h | 1 - drivers/staging/rt2860/chip/rt3090.h | 6 +- drivers/staging/rt2860/chip/rt30xx.h | 1 - drivers/staging/rt2860/chip/rtmp_mac.h | 1664 +++--- drivers/staging/rt2860/chip/rtmp_phy.h | 46 +- drivers/staging/rt2860/chlist.h | 39 +- drivers/staging/rt2860/common/action.h | 27 +- drivers/staging/rt2860/crypt_hmac.h | 22 +- drivers/staging/rt2860/crypt_md5.h | 34 +- drivers/staging/rt2860/crypt_sha2.h | 34 +- drivers/staging/rt2860/dfs.h | 4 +- drivers/staging/rt2860/eeprom.h | 25 +- drivers/staging/rt2860/iface/rtmp_pci.h | 3 - drivers/staging/rt2860/iface/rtmp_usb.h | 18 +- drivers/staging/rt2860/mlme.h | 1229 ++-- drivers/staging/rt2860/oid.h | 871 ++- drivers/staging/rt2860/rt_config.h | 3 +- drivers/staging/rt2860/rt_linux.h | 155 +- drivers/staging/rt2860/rtmp.h | 6889 ++++++++++------------- drivers/staging/rt2860/rtmp_chip.h | 164 +- drivers/staging/rt2860/rtmp_ckipmic.h | 43 +- drivers/staging/rt2860/rtmp_def.h | 358 +- drivers/staging/rt2860/rtmp_dot11.h | 106 +- drivers/staging/rt2860/rtmp_iface.h | 47 +- drivers/staging/rt2860/rtmp_mcu.h | 16 +- drivers/staging/rt2860/rtmp_os.h | 50 +- drivers/staging/rt2860/rtmp_timer.h | 63 +- drivers/staging/rt2860/rtmp_type.h | 123 +- drivers/staging/rt2860/rtusb_io.h | 52 +- drivers/staging/rt2860/spectrum.h | 176 +- drivers/staging/rt2860/spectrum_def.h | 79 +- drivers/staging/rt2860/wpa.h | 353 +- 37 files changed, 5734 insertions(+), 7419 deletions(-) diff --git a/drivers/staging/rt2860/ap.h b/drivers/staging/rt2860/ap.h index 6c58ce8ef951..97da74984e2e 100644 --- a/drivers/staging/rt2860/ap.h +++ b/drivers/staging/rt2860/ap.h @@ -41,40 +41,26 @@ #define __AP_H__ // ap_wpa.c -VOID WpaStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *Sm, - OUT STATE_MACHINE_FUNC Trans[]); +VOID WpaStateMachineInit(IN PRTMP_ADAPTER pAd, + IN STATE_MACHINE * Sm, OUT STATE_MACHINE_FUNC Trans[]); #ifdef RTMP_MAC_USB -VOID BeaconUpdateExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); +VOID BeaconUpdateExec(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); #endif // RTMP_MAC_USB // -VOID RTMPSetPiggyBack( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bPiggyBack); +VOID RTMPSetPiggyBack(IN PRTMP_ADAPTER pAd, IN BOOLEAN bPiggyBack); -VOID MacTableReset( - IN PRTMP_ADAPTER pAd); +VOID MacTableReset(IN PRTMP_ADAPTER pAd); -MAC_TABLE_ENTRY *MacTableInsertEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR apidx, - IN BOOLEAN CleanAll); +MAC_TABLE_ENTRY *MacTableInsertEntry(IN PRTMP_ADAPTER pAd, + IN PUCHAR pAddr, + IN UCHAR apidx, IN BOOLEAN CleanAll); -BOOLEAN MacTableDeleteEntry( - IN PRTMP_ADAPTER pAd, - IN USHORT wcid, - IN PUCHAR pAddr); +BOOLEAN MacTableDeleteEntry(IN PRTMP_ADAPTER pAd, + IN USHORT wcid, IN PUCHAR pAddr); -MAC_TABLE_ENTRY *MacTableLookup( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr); - -#endif // __AP_H__ +MAC_TABLE_ENTRY *MacTableLookup(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr); +#endif // __AP_H__ diff --git a/drivers/staging/rt2860/chip/mac_pci.h b/drivers/staging/rt2860/chip/mac_pci.h index 61b3f82315a1..b0aa0d37a61e 100644 --- a/drivers/staging/rt2860/chip/mac_pci.h +++ b/drivers/staging/rt2860/chip/mac_pci.h @@ -43,7 +43,6 @@ #include "../rtmp_iface.h" #include "../rtmp_dot11.h" - // // Device ID & Vendor ID related definitions, // NOTE: you should not add the new VendorID/DeviceID here unless you not sure it belongs to what chip. @@ -61,10 +60,6 @@ #define PCI_CLASS_BRIDGE_PCI 0x0604 #endif - - - - #define TXINFO_SIZE 0 #define RTMP_PKT_TAIL_PADDING 0 #define fRTMP_ADAPTER_NEED_STOP_TX 0 @@ -72,86 +67,83 @@ #define AUX_CTRL 0x10c // -// TX descriptor format, Tx ring, Mgmt Ring +// TX descriptor format, Tx ring, Mgmt Ring // -typedef struct PACKED _TXD_STRUC { - // Word 0 - UINT32 SDPtr0; - // Word 1 - UINT32 SDLen1:14; - UINT32 LastSec1:1; - UINT32 Burst:1; - UINT32 SDLen0:14; - UINT32 LastSec0:1; - UINT32 DMADONE:1; +typedef struct PACKED _TXD_STRUC { + // Word 0 + UINT32 SDPtr0; + // Word 1 + UINT32 SDLen1:14; + UINT32 LastSec1:1; + UINT32 Burst:1; + UINT32 SDLen0:14; + UINT32 LastSec0:1; + UINT32 DMADONE:1; //Word2 - UINT32 SDPtr1; + UINT32 SDPtr1; //Word3 - UINT32 rsv2:24; - UINT32 WIV:1; // Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition - UINT32 QSEL:2; // select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA - UINT32 rsv:2; - UINT32 TCO:1; // - UINT32 UCO:1; // - UINT32 ICO:1; // -} TXD_STRUC, *PTXD_STRUC; - + UINT32 rsv2:24; + UINT32 WIV:1; // Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition + UINT32 QSEL:2; // select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA + UINT32 rsv:2; + UINT32 TCO:1; // + UINT32 UCO:1; // + UINT32 ICO:1; // +} TXD_STRUC, *PTXD_STRUC; // // Rx descriptor format, Rx Ring // -typedef struct PACKED _RXD_STRUC{ - // Word 0 - UINT32 SDP0; - // Word 1 - UINT32 SDL1:14; - UINT32 Rsv:2; - UINT32 SDL0:14; - UINT32 LS0:1; - UINT32 DDONE:1; - // Word 2 - UINT32 SDP1; - // Word 3 - UINT32 BA:1; - UINT32 DATA:1; - UINT32 NULLDATA:1; - UINT32 FRAG:1; - UINT32 U2M:1; // 1: this RX frame is unicast to me - UINT32 Mcast:1; // 1: this is a multicast frame - UINT32 Bcast:1; // 1: this is a broadcast frame - UINT32 MyBss:1; // 1: this frame belongs to the same BSSID - UINT32 Crc:1; // 1: CRC error - UINT32 CipherErr:2; // 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid - UINT32 AMSDU:1; // rx with 802.3 header, not 802.11 header. - UINT32 HTC:1; - UINT32 RSSI:1; - UINT32 L2PAD:1; - UINT32 AMPDU:1; - UINT32 Decrypted:1; // this frame is being decrypted. - UINT32 PlcpSignal:1; // To be moved - UINT32 PlcpRssil:1;// To be moved - UINT32 Rsv1:13; -} RXD_STRUC, *PRXD_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC; +typedef struct PACKED _RXD_STRUC { + // Word 0 + UINT32 SDP0; + // Word 1 + UINT32 SDL1:14; + UINT32 Rsv:2; + UINT32 SDL0:14; + UINT32 LS0:1; + UINT32 DDONE:1; + // Word 2 + UINT32 SDP1; + // Word 3 + UINT32 BA:1; + UINT32 DATA:1; + UINT32 NULLDATA:1; + UINT32 FRAG:1; + UINT32 U2M:1; // 1: this RX frame is unicast to me + UINT32 Mcast:1; // 1: this is a multicast frame + UINT32 Bcast:1; // 1: this is a broadcast frame + UINT32 MyBss:1; // 1: this frame belongs to the same BSSID + UINT32 Crc:1; // 1: CRC error + UINT32 CipherErr:2; // 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid + UINT32 AMSDU:1; // rx with 802.3 header, not 802.11 header. + UINT32 HTC:1; + UINT32 RSSI:1; + UINT32 L2PAD:1; + UINT32 AMPDU:1; + UINT32 Decrypted:1; // this frame is being decrypted. + UINT32 PlcpSignal:1; // To be moved + UINT32 PlcpRssil:1; // To be moved + UINT32 Rsv1:13; +} RXD_STRUC, *PRXD_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC; typedef union _TX_ATTENUATION_CTRL_STRUC { - struct - { - ULONG RF_ISOLATION_ENABLE:1; - ULONG Reserve2:7; - ULONG PCIE_PHY_TX_ATTEN_VALUE:3; - ULONG PCIE_PHY_TX_ATTEN_EN:1; - ULONG Reserve1:20; + struct { + ULONG RF_ISOLATION_ENABLE:1; + ULONG Reserve2:7; + ULONG PCIE_PHY_TX_ATTEN_VALUE:3; + ULONG PCIE_PHY_TX_ATTEN_EN:1; + ULONG Reserve1:20; } field; - ULONG word; + ULONG word; } TX_ATTENUATION_CTRL_STRUC, *PTX_ATTENUATION_CTRL_STRUC; /* ----------------- EEPROM Related MACRO ----------------- */ // 8051 firmware image for RT2860 - base address = 0x4000 #define FIRMWARE_IMAGE_BASE 0x2000 -#define MAX_FIRMWARE_IMAGE_SIZE 0x2000 // 8kbyte - +#define MAX_FIRMWARE_IMAGE_SIZE 0x2000 // 8kbyte /* ----------------- Frimware Related MACRO ----------------- */ #define RTMP_WRITE_FIRMWARE(_pAd, _pFwImage, _FwLen) \ @@ -175,14 +167,12 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { RTMP_IO_WRITE32(_pAd, H2M_MAILBOX_CSR, 0); \ }while(0) - /* ----------------- TX Related MACRO ----------------- */ #define RTMP_START_DEQUEUE(pAd, QueIdx, irqFlags) do{}while(0) #define RTMP_STOP_DEQUEUE(pAd, QueIdx, irqFlags) do{}while(0) - #define RTMP_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, freeNum, pPacket) \ - ((freeNum) >= (ULONG)(pTxBlk->TotalFragNum + RTMP_GET_PACKET_FRAGMENTS(pPacket) + 3)) /* rough estimate we will use 3 more descriptor. */ + ((freeNum) >= (ULONG)(pTxBlk->TotalFragNum + RTMP_GET_PACKET_FRAGMENTS(pPacket) + 3)) /* rough estimate we will use 3 more descriptor. */ #define RTMP_RELEASE_DESC_RESOURCE(pAd, QueIdx) \ do{}while(0) @@ -190,12 +180,11 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { (((freeNum != (TX_RING_SIZE-1)) && (pAd->TxSwQueue[QueIdx].Number == 0)) || (freeNum<3)) //(((freeNum) != (TX_RING_SIZE-1)) && (pAd->TxSwQueue[QueIdx].Number == 1 /*0*/)) - #define HAL_KickOutMgmtTx(_pAd, _QueIdx, _pPacket, _pSrcBufVA, _SrcBufLen) \ RtmpPCIMgmtKickOut(_pAd, _QueIdx, _pPacket, _pSrcBufVA, _SrcBufLen) #define HAL_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) \ - /* RtmpPCI_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber)*/ + /* RtmpPCI_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) */ #define HAL_WriteTxResource(pAd, pTxBlk,bIsLast, pFreeNumber) \ RtmpPCI_WriteSingleTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) @@ -210,7 +199,7 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { RtmpPCI_FinalWriteTxResource(_pAd, _pTxBlk, _TotalMPDUSize, _FirstTxIdx) #define HAL_LastTxIdx(_pAd, _QueIdx,_LastTxIdx) \ - /*RtmpPCIDataLastTxIdx(_pAd, _QueIdx,_LastTxIdx)*/ + /*RtmpPCIDataLastTxIdx(_pAd, _QueIdx,_LastTxIdx) */ #define HAL_KickOutTx(_pAd, _pTxBlk, _QueIdx) \ RTMP_IO_WRITE32((_pAd), TX_CTX_IDX0+((_QueIdx)*0x10), (_pAd)->TxRing[(_QueIdx)].TxCpuIdx) @@ -225,17 +214,14 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { : \ (_pAd->TxRing[_QueIdx].TxSwFreeIdx + TX_RING_SIZE - _pAd->TxRing[_QueIdx].TxCpuIdx - 1); - #define GET_MGMTRING_FREENO(_pAd) \ (_pAd->MgmtRing.TxSwFreeIdx > _pAd->MgmtRing.TxCpuIdx) ? \ (_pAd->MgmtRing.TxSwFreeIdx - _pAd->MgmtRing.TxCpuIdx - 1) \ : \ (_pAd->MgmtRing.TxSwFreeIdx + MGMT_RING_SIZE - _pAd->MgmtRing.TxCpuIdx - 1); - /* ----------------- RX Related MACRO ----------------- */ - /* ----------------- ASIC Related MACRO ----------------- */ // reset MAC of a station entry to 0x000000000000 #define RTMP_STA_ENTRY_MAC_RESET(pAd, Wcid) \ @@ -272,7 +258,6 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { pAd->SharedKey[apidx][KeyID].CipherAlg, \ pEntry); } - // Insert the BA bitmap to ASIC for the Wcid entry #define RTMP_ADD_BA_SESSION_TO_ASIC(_pAd, _Aid, _TID) \ do{ \ @@ -283,9 +268,8 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { RTMP_IO_WRITE32((_pAd), _Offset, _Value);\ }while(0) - // Remove the BA bitmap from ASIC for the Wcid entry -// bitmap field starts at 0x10000 in ASIC WCID table +// bitmap field starts at 0x10000 in ASIC WCID table #define RTMP_DEL_BA_SESSION_FROM_ASIC(_pAd, _Wcid, _TID) \ do{ \ UINT32 _Value = 0, _Offset; \ @@ -295,7 +279,6 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { RTMP_IO_WRITE32((_pAd), _Offset, _Value); \ }while(0) - /* ----------------- Interface Related MACRO ----------------- */ // @@ -314,7 +297,6 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { RTMP_SET_FLAG((_pAd), fRTMP_ADAPTER_INTERRUPT_ACTIVE); \ }while(0) - #define RTMP_IRQ_INIT(pAd) \ { pAd->int_enable_reg = ((DELAYINTMASK) | \ (RxINT|TxDataInt|TxMgmtInt)) & ~(0x03); \ @@ -326,7 +308,6 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, 0xffffffff);\ RTMP_ASIC_INTERRUPT_ENABLE(pAd); } - /* ----------------- MLME Related MACRO ----------------- */ #define RTMP_MLME_HANDLER(pAd) MlmeHandler(pAd) @@ -344,7 +325,6 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { /* ----------------- Power Save Related MACRO ----------------- */ #define RTMP_PS_POLL_ENQUEUE(pAd) EnqueuePsPoll(pAd) - // For RTMPPCIePowerLinkCtrlRestore () function #define RESTORE_HALT 1 #define RESTORE_WAKEUP 2 @@ -358,7 +338,6 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { #define CID2MASK 0x00ff0000 #define CID3MASK 0xff000000 - #define RTMP_STA_FORCE_WAKEUP(pAd, bFromTx) \ RT28xxPciStaAsicForceWakeup(pAd, bFromTx); diff --git a/drivers/staging/rt2860/chip/mac_usb.h b/drivers/staging/rt2860/chip/mac_usb.h index 5a8588377425..8ce696974921 100644 --- a/drivers/staging/rt2860/chip/mac_usb.h +++ b/drivers/staging/rt2860/chip/mac_usb.h @@ -43,13 +43,12 @@ #include "../rtmp_iface.h" #include "../rtmp_dot11.h" - #define USB_CYC_CFG 0x02a4 #define BEACON_RING_SIZE 2 #define MGMTPIPEIDX 0 // EP6 is highest priority -#define RTMP_PKT_TAIL_PADDING 11 // 3(max 4 byte padding) + 4 (last packet padding) + 4 (MaxBulkOutsize align padding) +#define RTMP_PKT_TAIL_PADDING 11 // 3(max 4 byte padding) + 4 (last packet padding) + 4 (MaxBulkOutsize align padding) #define fRTMP_ADAPTER_NEED_STOP_TX \ (fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_HALT_IN_PROGRESS | \ @@ -62,157 +61,146 @@ #define RXINFO_SIZE 4 #define RT2870_RXDMALEN_FIELD_SIZE 4 -typedef struct PACKED _RXINFO_STRUC { - UINT32 BA:1; - UINT32 DATA:1; - UINT32 NULLDATA:1; - UINT32 FRAG:1; - UINT32 U2M:1; // 1: this RX frame is unicast to me - UINT32 Mcast:1; // 1: this is a multicast frame - UINT32 Bcast:1; // 1: this is a broadcast frame - UINT32 MyBss:1; // 1: this frame belongs to the same BSSID - UINT32 Crc:1; // 1: CRC error - UINT32 CipherErr:2; // 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid - UINT32 AMSDU:1; // rx with 802.3 header, not 802.11 header. - UINT32 HTC:1; - UINT32 RSSI:1; - UINT32 L2PAD:1; - UINT32 AMPDU:1; // To be moved - UINT32 Decrypted:1; - UINT32 PlcpRssil:1; - UINT32 CipherAlg:1; - UINT32 LastAMSDU:1; - UINT32 PlcpSignal:12; -} RXINFO_STRUC, *PRXINFO_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC; - +typedef struct PACKED _RXINFO_STRUC { + UINT32 BA:1; + UINT32 DATA:1; + UINT32 NULLDATA:1; + UINT32 FRAG:1; + UINT32 U2M:1; // 1: this RX frame is unicast to me + UINT32 Mcast:1; // 1: this is a multicast frame + UINT32 Bcast:1; // 1: this is a broadcast frame + UINT32 MyBss:1; // 1: this frame belongs to the same BSSID + UINT32 Crc:1; // 1: CRC error + UINT32 CipherErr:2; // 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid + UINT32 AMSDU:1; // rx with 802.3 header, not 802.11 header. + UINT32 HTC:1; + UINT32 RSSI:1; + UINT32 L2PAD:1; + UINT32 AMPDU:1; // To be moved + UINT32 Decrypted:1; + UINT32 PlcpRssil:1; + UINT32 CipherAlg:1; + UINT32 LastAMSDU:1; + UINT32 PlcpSignal:12; +} RXINFO_STRUC, *PRXINFO_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC; // // TXINFO // #define TXINFO_SIZE 4 -typedef struct _TXINFO_STRUC { - // Word 0 - UINT32 USBDMATxPktLen:16; //used ONLY in USB bulk Aggregation, Total byte counts of all sub-frame. - UINT32 rsv:8; - UINT32 WIV:1; // Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition - UINT32 QSEL:2; // select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA - UINT32 SwUseLastRound:1; // Software use. - UINT32 rsv2:2; // Software use. - UINT32 USBDMANextVLD:1; //used ONLY in USB bulk Aggregation, NextValid - UINT32 USBDMATxburst:1;//used ONLY in USB bulk Aggre. Force USB DMA transmit frame from current selected endpoint -} TXINFO_STRUC, *PTXINFO_STRUC; - +typedef struct _TXINFO_STRUC { + // Word 0 + UINT32 USBDMATxPktLen:16; //used ONLY in USB bulk Aggregation, Total byte counts of all sub-frame. + UINT32 rsv:8; + UINT32 WIV:1; // Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition + UINT32 QSEL:2; // select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA + UINT32 SwUseLastRound:1; // Software use. + UINT32 rsv2:2; // Software use. + UINT32 USBDMANextVLD:1; //used ONLY in USB bulk Aggregation, NextValid + UINT32 USBDMATxburst:1; //used ONLY in USB bulk Aggre. Force USB DMA transmit frame from current selected endpoint +} TXINFO_STRUC, *PTXINFO_STRUC; // // Management ring buffer format // -typedef struct _MGMT_STRUC { - BOOLEAN Valid; - PUCHAR pBuffer; - ULONG Length; -} MGMT_STRUC, *PMGMT_STRUC; - +typedef struct _MGMT_STRUC { + BOOLEAN Valid; + PUCHAR pBuffer; + ULONG Length; +} MGMT_STRUC, *PMGMT_STRUC; //////////////////////////////////////////////////////////////////////////// // The TX_BUFFER structure forms the transmitted USB packet to the device //////////////////////////////////////////////////////////////////////////// -typedef struct __TX_BUFFER{ - union{ - UCHAR WirelessPacket[TX_BUFFER_NORMSIZE]; - HEADER_802_11 NullFrame; - PSPOLL_FRAME PsPollPacket; - RTS_FRAME RTSFrame; - }field; - UCHAR Aggregation[4]; //Buffer for save Aggregation size. +typedef struct __TX_BUFFER { + union { + UCHAR WirelessPacket[TX_BUFFER_NORMSIZE]; + HEADER_802_11 NullFrame; + PSPOLL_FRAME PsPollPacket; + RTS_FRAME RTSFrame; + } field; + UCHAR Aggregation[4]; //Buffer for save Aggregation size. } TX_BUFFER, *PTX_BUFFER; -typedef struct __HTTX_BUFFER{ - union{ - UCHAR WirelessPacket[MAX_TXBULK_SIZE]; - HEADER_802_11 NullFrame; - PSPOLL_FRAME PsPollPacket; - RTS_FRAME RTSFrame; - }field; - UCHAR Aggregation[4]; //Buffer for save Aggregation size. +typedef struct __HTTX_BUFFER { + union { + UCHAR WirelessPacket[MAX_TXBULK_SIZE]; + HEADER_802_11 NullFrame; + PSPOLL_FRAME PsPollPacket; + RTS_FRAME RTSFrame; + } field; + UCHAR Aggregation[4]; //Buffer for save Aggregation size. } HTTX_BUFFER, *PHTTX_BUFFER; - // used to track driver-generated write irps -typedef struct _TX_CONTEXT -{ - PVOID pAd; //Initialized in MiniportInitialize - PURB pUrb; //Initialized in MiniportInitialize - PIRP pIrp; //used to cancel pending bulk out. - //Initialized in MiniportInitialize - PTX_BUFFER TransferBuffer; //Initialized in MiniportInitialize - ULONG BulkOutSize; - UCHAR BulkOutPipeId; - UCHAR SelfIdx; - BOOLEAN InUse; - BOOLEAN bWaitingBulkOut; // at least one packet is in this TxContext, ready for making IRP anytime. - BOOLEAN bFullForBulkOut; // all tx buffer are full , so waiting for tx bulkout. - BOOLEAN IRPPending; - BOOLEAN LastOne; - BOOLEAN bAggregatible; - UCHAR Header_802_3[LENGTH_802_3]; - UCHAR Rsv[2]; - ULONG DataOffset; - UINT TxRate; - dma_addr_t data_dma; // urb dma on linux - -} TX_CONTEXT, *PTX_CONTEXT, **PPTX_CONTEXT; - +typedef struct _TX_CONTEXT { + PVOID pAd; //Initialized in MiniportInitialize + PURB pUrb; //Initialized in MiniportInitialize + PIRP pIrp; //used to cancel pending bulk out. + //Initialized in MiniportInitialize + PTX_BUFFER TransferBuffer; //Initialized in MiniportInitialize + ULONG BulkOutSize; + UCHAR BulkOutPipeId; + UCHAR SelfIdx; + BOOLEAN InUse; + BOOLEAN bWaitingBulkOut; // at least one packet is in this TxContext, ready for making IRP anytime. + BOOLEAN bFullForBulkOut; // all tx buffer are full , so waiting for tx bulkout. + BOOLEAN IRPPending; + BOOLEAN LastOne; + BOOLEAN bAggregatible; + UCHAR Header_802_3[LENGTH_802_3]; + UCHAR Rsv[2]; + ULONG DataOffset; + UINT TxRate; + dma_addr_t data_dma; // urb dma on linux + +} TX_CONTEXT, *PTX_CONTEXT, **PPTX_CONTEXT; // used to track driver-generated write irps -typedef struct _HT_TX_CONTEXT -{ - PVOID pAd; //Initialized in MiniportInitialize - PURB pUrb; //Initialized in MiniportInitialize - PIRP pIrp; //used to cancel pending bulk out. - //Initialized in MiniportInitialize - PHTTX_BUFFER TransferBuffer; //Initialized in MiniportInitialize - ULONG BulkOutSize; // Indicate the total bulk-out size in bytes in one bulk-transmission - UCHAR BulkOutPipeId; - BOOLEAN IRPPending; - BOOLEAN LastOne; - BOOLEAN bCurWriting; - BOOLEAN bRingEmpty; - BOOLEAN bCopySavePad; - UCHAR SavedPad[8]; - UCHAR Header_802_3[LENGTH_802_3]; - ULONG CurWritePosition; // Indicate the buffer offset which packet will be inserted start from. - ULONG CurWriteRealPos; // Indicate the buffer offset which packet now are writing to. - ULONG NextBulkOutPosition; // Indicate the buffer start offset of a bulk-transmission - ULONG ENextBulkOutPosition; // Indicate the buffer end offset of a bulk-transmission - UINT TxRate; - dma_addr_t data_dma; // urb dma on linux -} HT_TX_CONTEXT, *PHT_TX_CONTEXT, **PPHT_TX_CONTEXT; - +typedef struct _HT_TX_CONTEXT { + PVOID pAd; //Initialized in MiniportInitialize + PURB pUrb; //Initialized in MiniportInitialize + PIRP pIrp; //used to cancel pending bulk out. + //Initialized in MiniportInitialize + PHTTX_BUFFER TransferBuffer; //Initialized in MiniportInitialize + ULONG BulkOutSize; // Indicate the total bulk-out size in bytes in one bulk-transmission + UCHAR BulkOutPipeId; + BOOLEAN IRPPending; + BOOLEAN LastOne; + BOOLEAN bCurWriting; + BOOLEAN bRingEmpty; + BOOLEAN bCopySavePad; + UCHAR SavedPad[8]; + UCHAR Header_802_3[LENGTH_802_3]; + ULONG CurWritePosition; // Indicate the buffer offset which packet will be inserted start from. + ULONG CurWriteRealPos; // Indicate the buffer offset which packet now are writing to. + ULONG NextBulkOutPosition; // Indicate the buffer start offset of a bulk-transmission + ULONG ENextBulkOutPosition; // Indicate the buffer end offset of a bulk-transmission + UINT TxRate; + dma_addr_t data_dma; // urb dma on linux +} HT_TX_CONTEXT, *PHT_TX_CONTEXT, **PPHT_TX_CONTEXT; // // Structure to keep track of receive packets and buffers to indicate // receive data to the protocol. // -typedef struct _RX_CONTEXT -{ - PUCHAR TransferBuffer; - PVOID pAd; - PIRP pIrp;//used to cancel pending bulk in. - PURB pUrb; +typedef struct _RX_CONTEXT { + PUCHAR TransferBuffer; + PVOID pAd; + PIRP pIrp; //used to cancel pending bulk in. + PURB pUrb; //These 2 Boolean shouldn't both be 1 at the same time. - ULONG BulkInOffset; // number of packets waiting for reordering . -// BOOLEAN ReorderInUse; // At least one packet in this buffer are in reordering buffer and wait for receive indication - BOOLEAN bRxHandling; // Notify this packet is being process now. - BOOLEAN InUse; // USB Hardware Occupied. Wait for USB HW to put packet. - BOOLEAN Readable; // Receive Complete back. OK for driver to indicate receiving packet. - BOOLEAN IRPPending; // TODO: To be removed - atomic_t IrpLock; - NDIS_SPIN_LOCK RxContextLock; - dma_addr_t data_dma; // urb dma on linux -} RX_CONTEXT, *PRX_CONTEXT; - - + ULONG BulkInOffset; // number of packets waiting for reordering . +// BOOLEAN ReorderInUse; // At least one packet in this buffer are in reordering buffer and wait for receive indication + BOOLEAN bRxHandling; // Notify this packet is being process now. + BOOLEAN InUse; // USB Hardware Occupied. Wait for USB HW to put packet. + BOOLEAN Readable; // Receive Complete back. OK for driver to indicate receiving packet. + BOOLEAN IRPPending; // TODO: To be removed + atomic_t IrpLock; + NDIS_SPIN_LOCK RxContextLock; + dma_addr_t data_dma; // urb dma on linux +} RX_CONTEXT, *PRX_CONTEXT; /****************************************************************************** @@ -221,13 +209,11 @@ typedef struct _RX_CONTEXT ******************************************************************************/ // 8051 firmware image for usb - use last-half base address = 0x3000 #define FIRMWARE_IMAGE_BASE 0x3000 -#define MAX_FIRMWARE_IMAGE_SIZE 0x1000 // 4kbyte +#define MAX_FIRMWARE_IMAGE_SIZE 0x1000 // 4kbyte #define RTMP_WRITE_FIRMWARE(_pAd, _pFwImage, _FwLen) \ RTUSBFirmwareWrite(_pAd, _pFwImage, _FwLen) - - /****************************************************************************** USB TX Related MACRO @@ -281,7 +267,7 @@ typedef struct _RX_CONTEXT RtmpUSB_FinalWriteTxResource(pAd, pTxBlk, totalMPDUSize, TxIdx) #define HAL_LastTxIdx(pAd, QueIdx,TxIdx) \ - /*RtmpUSBDataLastTxIdx(pAd, QueIdx,TxIdx)*/ + /*RtmpUSBDataLastTxIdx(pAd, QueIdx,TxIdx) */ #define HAL_KickOutTx(pAd, pTxBlk, QueIdx) \ RtmpUSBDataKickOut(pAd, pTxBlk, QueIdx) @@ -292,20 +278,17 @@ typedef struct _RX_CONTEXT #define HAL_KickOutNullFrameTx(_pAd, _QueIdx, _pNullFrame, _frameLen) \ RtmpUSBNullFrameKickOut(_pAd, _QueIdx, _pNullFrame, _frameLen) -#define GET_TXRING_FREENO(_pAd, _QueIdx) (_QueIdx) //(_pAd->TxRing[_QueIdx].TxSwFreeIdx) +#define GET_TXRING_FREENO(_pAd, _QueIdx) (_QueIdx) //(_pAd->TxRing[_QueIdx].TxSwFreeIdx) #define GET_MGMTRING_FREENO(_pAd) (_pAd->MgmtRing.TxSwFreeIdx) - /* ----------------- RX Related MACRO ----------------- */ - /* * Device Hardware Interface Related MACRO */ #define RTMP_IRQ_INIT(pAd) do{}while(0) #define RTMP_IRQ_ENABLE(pAd) do{}while(0) - /* * MLME Related MACRO */ @@ -330,7 +313,6 @@ typedef struct _RX_CONTEXT RTUSBMlmeUp(_pAd); \ } - /* * Power Save Related MACRO */ diff --git a/drivers/staging/rt2860/chip/rt2860.h b/drivers/staging/rt2860/chip/rt2860.h index 2989d09556bc..6b976b47ad8e 100644 --- a/drivers/staging/rt2860/chip/rt2860.h +++ b/drivers/staging/rt2860/chip/rt2860.h @@ -43,14 +43,12 @@ // #define NIC2860_PCI_DEVICE_ID 0x0601 #define NIC2860_PCIe_DEVICE_ID 0x0681 -#define NIC2760_PCI_DEVICE_ID 0x0701 // 1T/2R Cardbus ??? -#define NIC2790_PCIe_DEVICE_ID 0x0781 // 1T/2R miniCard - +#define NIC2760_PCI_DEVICE_ID 0x0701 // 1T/2R Cardbus ??? +#define NIC2790_PCIe_DEVICE_ID 0x0781 // 1T/2R miniCard #define VEN_AWT_PCIe_DEVICE_ID 0x1059 #define VEN_AWT_PCI_VENDOR_ID 0x1A3B #define EDIMAX_PCI_VENDOR_ID 0x1432 - #endif //__RT2860_H__ // diff --git a/drivers/staging/rt2860/chip/rt2870.h b/drivers/staging/rt2860/chip/rt2870.h index a9309253b20f..5115a3797e2c 100644 --- a/drivers/staging/rt2860/chip/rt2870.h +++ b/drivers/staging/rt2860/chip/rt2870.h @@ -40,8 +40,7 @@ #include "../rtmp_type.h" #include "mac_usb.h" - -//#define RTMP_CHIP_NAME "RT2870" +//#define RTMP_CHIP_NAME "RT2870" #endif // RT2870 // #endif //__RT2870_H__ // diff --git a/drivers/staging/rt2860/chip/rt3070.h b/drivers/staging/rt2860/chip/rt3070.h index 87df99ad929a..3781d9d9a927 100644 --- a/drivers/staging/rt2860/chip/rt3070.h +++ b/drivers/staging/rt2860/chip/rt3070.h @@ -39,7 +39,6 @@ #ifdef RT3070 - #ifndef RTMP_USB_SUPPORT #error "For RT3070, you should define the compile flag -DRTMP_USB_SUPPORT" #endif diff --git a/drivers/staging/rt2860/chip/rt3090.h b/drivers/staging/rt2860/chip/rt3090.h index c2249a471231..92481ccabf38 100644 --- a/drivers/staging/rt2860/chip/rt3090.h +++ b/drivers/staging/rt2860/chip/rt3090.h @@ -63,9 +63,9 @@ // // Device ID & Vendor ID, these values should match EEPROM value // -#define NIC3090_PCIe_DEVICE_ID 0x3090 // 1T/1R miniCard -#define NIC3091_PCIe_DEVICE_ID 0x3091 // 1T/2R miniCard -#define NIC3092_PCIe_DEVICE_ID 0x3092 // 2T/2R miniCard +#define NIC3090_PCIe_DEVICE_ID 0x3090 // 1T/1R miniCard +#define NIC3091_PCIe_DEVICE_ID 0x3091 // 1T/2R miniCard +#define NIC3092_PCIe_DEVICE_ID 0x3092 // 2T/2R miniCard #endif // RT3090 // diff --git a/drivers/staging/rt2860/chip/rt30xx.h b/drivers/staging/rt2860/chip/rt30xx.h index 70971a062607..e6aa1756b4f3 100644 --- a/drivers/staging/rt2860/chip/rt30xx.h +++ b/drivers/staging/rt2860/chip/rt30xx.h @@ -39,7 +39,6 @@ #ifdef RT30xx - extern REG_PAIR RT30xx_RFRegTable[]; extern UCHAR NUM_RF_REG_PARMS; diff --git a/drivers/staging/rt2860/chip/rtmp_mac.h b/drivers/staging/rt2860/chip/rtmp_mac.h index 3ddb0bf03c6f..06321c0deaf8 100644 --- a/drivers/staging/rt2860/chip/rtmp_mac.h +++ b/drivers/staging/rt2860/chip/rtmp_mac.h @@ -38,8 +38,6 @@ #ifndef __RTMP_MAC_H__ #define __RTMP_MAC_H__ - - // ================================================================================= // TX / RX ring descriptor format // ================================================================================= @@ -50,89 +48,85 @@ #define FIFO_HCCA 1 #define FIFO_EDCA 2 - // // TXD Wireless Information format for Tx ring and Mgmt Ring // //txop : for txop mode // 0:txop for the MPDU frame will be handles by ASIC by register // 1/2/3:the MPDU frame is send after PIFS/backoff/SIFS -typedef struct PACKED _TXWI_STRUC { - // Word 0 +typedef struct PACKED _TXWI_STRUC { + // Word 0 // ex: 00 03 00 40 means txop = 3, PHYMODE = 1 - UINT32 FRAG:1; // 1 to inform TKIP engine this is a fragment. - UINT32 MIMOps:1; // the remote peer is in dynamic MIMO-PS mode - UINT32 CFACK:1; - UINT32 TS:1; - - UINT32 AMPDU:1; - UINT32 MpduDensity:3; - UINT32 txop:2; //FOR "THIS" frame. 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs only when previous frame exchange is successful. - UINT32 rsv:6; - - UINT32 MCS:7; - UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz - UINT32 ShortGI:1; - UINT32 STBC:2; // 1: STBC support MCS =0-7, 2,3 : RESERVE - UINT32 Ifs:1; // -// UINT32 rsv2:2; //channel bandwidth 20MHz or 40 MHz - UINT32 rsv2:1; - UINT32 TxBF:1; // 3*3 - UINT32 PHYMODE:2; + UINT32 FRAG:1; // 1 to inform TKIP engine this is a fragment. + UINT32 MIMOps:1; // the remote peer is in dynamic MIMO-PS mode + UINT32 CFACK:1; + UINT32 TS:1; + + UINT32 AMPDU:1; + UINT32 MpduDensity:3; + UINT32 txop:2; //FOR "THIS" frame. 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs only when previous frame exchange is successful. + UINT32 rsv:6; + + UINT32 MCS:7; + UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz + UINT32 ShortGI:1; + UINT32 STBC:2; // 1: STBC support MCS =0-7, 2,3 : RESERVE + UINT32 Ifs:1; // +// UINT32 rsv2:2; //channel bandwidth 20MHz or 40 MHz + UINT32 rsv2:1; + UINT32 TxBF:1; // 3*3 + UINT32 PHYMODE:2; // Word1 // ex: 1c ff 38 00 means ACK=0, BAWinSize=7, MPDUtotalByteCount = 0x38 - UINT32 ACK:1; - UINT32 NSEQ:1; - UINT32 BAWinSize:6; - UINT32 WirelessCliID:8; - UINT32 MPDUtotalByteCount:12; - UINT32 PacketId:4; + UINT32 ACK:1; + UINT32 NSEQ:1; + UINT32 BAWinSize:6; + UINT32 WirelessCliID:8; + UINT32 MPDUtotalByteCount:12; + UINT32 PacketId:4; //Word2 - UINT32 IV; + UINT32 IV; //Word3 - UINT32 EIV; -} TXWI_STRUC, *PTXWI_STRUC; - + UINT32 EIV; +} TXWI_STRUC, *PTXWI_STRUC; // // RXWI wireless information format, in PBF. invisible in driver. // -typedef struct PACKED _RXWI_STRUC { - // Word 0 - UINT32 WirelessCliID:8; - UINT32 KeyIndex:2; - UINT32 BSSID:3; - UINT32 UDF:3; - UINT32 MPDUtotalByteCount:12; - UINT32 TID:4; - // Word 1 - UINT32 FRAG:4; - UINT32 SEQUENCE:12; - UINT32 MCS:7; - UINT32 BW:1; - UINT32 ShortGI:1; - UINT32 STBC:2; - UINT32 rsv:3; - UINT32 PHYMODE:2; // 1: this RX frame is unicast to me +typedef struct PACKED _RXWI_STRUC { + // Word 0 + UINT32 WirelessCliID:8; + UINT32 KeyIndex:2; + UINT32 BSSID:3; + UINT32 UDF:3; + UINT32 MPDUtotalByteCount:12; + UINT32 TID:4; + // Word 1 + UINT32 FRAG:4; + UINT32 SEQUENCE:12; + UINT32 MCS:7; + UINT32 BW:1; + UINT32 ShortGI:1; + UINT32 STBC:2; + UINT32 rsv:3; + UINT32 PHYMODE:2; // 1: this RX frame is unicast to me //Word2 - UINT32 RSSI0:8; - UINT32 RSSI1:8; - UINT32 RSSI2:8; - UINT32 rsv1:8; + UINT32 RSSI0:8; + UINT32 RSSI1:8; + UINT32 RSSI2:8; + UINT32 rsv1:8; //Word3 - UINT32 SNR0:8; - UINT32 SNR1:8; - UINT32 FOFFSET:8; // RT35xx - UINT32 rsv2:8; - /*UINT32 rsv2:16;*/ -} RXWI_STRUC, *PRXWI_STRUC; - + UINT32 SNR0:8; + UINT32 SNR1:8; + UINT32 FOFFSET:8; // RT35xx + UINT32 rsv2:8; + /*UINT32 rsv2:16; */ +} RXWI_STRUC, *PRXWI_STRUC; // ================================================================================= // Register format // ================================================================================= - // // SCH/DMA registers - base address 0x0200 // @@ -140,163 +134,161 @@ typedef struct PACKED _RXWI_STRUC { // #define DMA_CSR0 0x200 #define INT_SOURCE_CSR 0x200 -typedef union _INT_SOURCE_CSR_STRUC { - struct { - UINT32 RxDelayINT:1; - UINT32 TxDelayINT:1; - UINT32 RxDone:1; - UINT32 Ac0DmaDone:1;//4 - UINT32 Ac1DmaDone:1; - UINT32 Ac2DmaDone:1; - UINT32 Ac3DmaDone:1; - UINT32 HccaDmaDone:1; // bit7 - UINT32 MgmtDmaDone:1; - UINT32 MCUCommandINT:1;//bit 9 - UINT32 RxTxCoherent:1; - UINT32 TBTTInt:1; - UINT32 PreTBTT:1; - UINT32 TXFifoStatusInt:1;//FIFO Statistics is full, sw should read 0x171c - UINT32 AutoWakeup:1;//bit14 - UINT32 GPTimer:1; - UINT32 RxCoherent:1;//bit16 - UINT32 TxCoherent:1; - UINT32 :14; - } field; - UINT32 word; +typedef union _INT_SOURCE_CSR_STRUC { + struct { + UINT32 RxDelayINT:1; + UINT32 TxDelayINT:1; + UINT32 RxDone:1; + UINT32 Ac0DmaDone:1; //4 + UINT32 Ac1DmaDone:1; + UINT32 Ac2DmaDone:1; + UINT32 Ac3DmaDone:1; + UINT32 HccaDmaDone:1; // bit7 + UINT32 MgmtDmaDone:1; + UINT32 MCUCommandINT:1; //bit 9 + UINT32 RxTxCoherent:1; + UINT32 TBTTInt:1; + UINT32 PreTBTT:1; + UINT32 TXFifoStatusInt:1; //FIFO Statistics is full, sw should read 0x171c + UINT32 AutoWakeup:1; //bit14 + UINT32 GPTimer:1; + UINT32 RxCoherent:1; //bit16 + UINT32 TxCoherent:1; + UINT32:14; + } field; + UINT32 word; } INT_SOURCE_CSR_STRUC, *PINT_SOURCE_CSR_STRUC; // // INT_MASK_CSR: Interrupt MASK register. 1: the interrupt is mask OFF // #define INT_MASK_CSR 0x204 -typedef union _INT_MASK_CSR_STRUC { - struct { - UINT32 RXDelay_INT_MSK:1; - UINT32 TxDelay:1; - UINT32 RxDone:1; - UINT32 Ac0DmaDone:1; - UINT32 Ac1DmaDone:1; - UINT32 Ac2DmaDone:1; - UINT32 Ac3DmaDone:1; - UINT32 HccaDmaDone:1; - UINT32 MgmtDmaDone:1; - UINT32 MCUCommandINT:1; - UINT32 :20; - UINT32 RxCoherent:1; - UINT32 TxCoherent:1; - } field; - UINT32 word; +typedef union _INT_MASK_CSR_STRUC { + struct { + UINT32 RXDelay_INT_MSK:1; + UINT32 TxDelay:1; + UINT32 RxDone:1; + UINT32 Ac0DmaDone:1; + UINT32 Ac1DmaDone:1; + UINT32 Ac2DmaDone:1; + UINT32 Ac3DmaDone:1; + UINT32 HccaDmaDone:1; + UINT32 MgmtDmaDone:1; + UINT32 MCUCommandINT:1; + UINT32:20; + UINT32 RxCoherent:1; + UINT32 TxCoherent:1; + } field; + UINT32 word; } INT_MASK_CSR_STRUC, *PINT_MASK_CSR_STRUC; #define WPDMA_GLO_CFG 0x208 -typedef union _WPDMA_GLO_CFG_STRUC { - struct { - UINT32 EnableTxDMA:1; - UINT32 TxDMABusy:1; - UINT32 EnableRxDMA:1; - UINT32 RxDMABusy:1; - UINT32 WPDMABurstSIZE:2; - UINT32 EnTXWriteBackDDONE:1; - UINT32 BigEndian:1; - UINT32 RXHdrScater:8; - UINT32 HDR_SEG_LEN:16; - } field; - UINT32 word; +typedef union _WPDMA_GLO_CFG_STRUC { + struct { + UINT32 EnableTxDMA:1; + UINT32 TxDMABusy:1; + UINT32 EnableRxDMA:1; + UINT32 RxDMABusy:1; + UINT32 WPDMABurstSIZE:2; + UINT32 EnTXWriteBackDDONE:1; + UINT32 BigEndian:1; + UINT32 RXHdrScater:8; + UINT32 HDR_SEG_LEN:16; + } field; + UINT32 word; } WPDMA_GLO_CFG_STRUC, *PWPDMA_GLO_CFG_STRUC; #define WPDMA_RST_IDX 0x20c -typedef union _WPDMA_RST_IDX_STRUC { - struct { - UINT32 RST_DTX_IDX0:1; - UINT32 RST_DTX_IDX1:1; - UINT32 RST_DTX_IDX2:1; - UINT32 RST_DTX_IDX3:1; - UINT32 RST_DTX_IDX4:1; - UINT32 RST_DTX_IDX5:1; - UINT32 rsv:10; - UINT32 RST_DRX_IDX0:1; - UINT32 :15; - } field; - UINT32 word; +typedef union _WPDMA_RST_IDX_STRUC { + struct { + UINT32 RST_DTX_IDX0:1; + UINT32 RST_DTX_IDX1:1; + UINT32 RST_DTX_IDX2:1; + UINT32 RST_DTX_IDX3:1; + UINT32 RST_DTX_IDX4:1; + UINT32 RST_DTX_IDX5:1; + UINT32 rsv:10; + UINT32 RST_DRX_IDX0:1; + UINT32:15; + } field; + UINT32 word; } WPDMA_RST_IDX_STRUC, *PWPDMA_RST_IDX_STRUC; #define DELAY_INT_CFG 0x0210 -typedef union _DELAY_INT_CFG_STRUC { - struct { - UINT32 RXMAX_PTIME:8; - UINT32 RXMAX_PINT:7; - UINT32 RXDLY_INT_EN:1; - UINT32 TXMAX_PTIME:8; - UINT32 TXMAX_PINT:7; - UINT32 TXDLY_INT_EN:1; - } field; - UINT32 word; +typedef union _DELAY_INT_CFG_STRUC { + struct { + UINT32 RXMAX_PTIME:8; + UINT32 RXMAX_PINT:7; + UINT32 RXDLY_INT_EN:1; + UINT32 TXMAX_PTIME:8; + UINT32 TXMAX_PINT:7; + UINT32 TXDLY_INT_EN:1; + } field; + UINT32 word; } DELAY_INT_CFG_STRUC, *PDELAY_INT_CFG_STRUC; #define WMM_AIFSN_CFG 0x0214 -typedef union _AIFSN_CSR_STRUC { - struct { - UINT32 Aifsn0:4; // for AC_BE - UINT32 Aifsn1:4; // for AC_BK - UINT32 Aifsn2:4; // for AC_VI - UINT32 Aifsn3:4; // for AC_VO - UINT32 Rsv:16; - } field; - UINT32 word; -} AIFSN_CSR_STRUC, *PAIFSN_CSR_STRUC; +typedef union _AIFSN_CSR_STRUC { + struct { + UINT32 Aifsn0:4; // for AC_BE + UINT32 Aifsn1:4; // for AC_BK + UINT32 Aifsn2:4; // for AC_VI + UINT32 Aifsn3:4; // for AC_VO + UINT32 Rsv:16; + } field; + UINT32 word; +} AIFSN_CSR_STRUC, *PAIFSN_CSR_STRUC; // // CWMIN_CSR: CWmin for each EDCA AC // #define WMM_CWMIN_CFG 0x0218 -typedef union _CWMIN_CSR_STRUC { - struct { - UINT32 Cwmin0:4; // for AC_BE - UINT32 Cwmin1:4; // for AC_BK - UINT32 Cwmin2:4; // for AC_VI - UINT32 Cwmin3:4; // for AC_VO - UINT32 Rsv:16; - } field; - UINT32 word; -} CWMIN_CSR_STRUC, *PCWMIN_CSR_STRUC; +typedef union _CWMIN_CSR_STRUC { + struct { + UINT32 Cwmin0:4; // for AC_BE + UINT32 Cwmin1:4; // for AC_BK + UINT32 Cwmin2:4; // for AC_VI + UINT32 Cwmin3:4; // for AC_VO + UINT32 Rsv:16; + } field; + UINT32 word; +} CWMIN_CSR_STRUC, *PCWMIN_CSR_STRUC; // // CWMAX_CSR: CWmin for each EDCA AC // #define WMM_CWMAX_CFG 0x021c -typedef union _CWMAX_CSR_STRUC { - struct { - UINT32 Cwmax0:4; // for AC_BE - UINT32 Cwmax1:4; // for AC_BK - UINT32 Cwmax2:4; // for AC_VI - UINT32 Cwmax3:4; // for AC_VO - UINT32 Rsv:16; - } field; - UINT32 word; -} CWMAX_CSR_STRUC, *PCWMAX_CSR_STRUC; - +typedef union _CWMAX_CSR_STRUC { + struct { + UINT32 Cwmax0:4; // for AC_BE + UINT32 Cwmax1:4; // for AC_BK + UINT32 Cwmax2:4; // for AC_VI + UINT32 Cwmax3:4; // for AC_VO + UINT32 Rsv:16; + } field; + UINT32 word; +} CWMAX_CSR_STRUC, *PCWMAX_CSR_STRUC; // // AC_TXOP_CSR0: AC_BK/AC_BE TXOP register // #define WMM_TXOP0_CFG 0x0220 -typedef union _AC_TXOP_CSR0_STRUC { - struct { - USHORT Ac0Txop; // for AC_BK, in unit of 32us - USHORT Ac1Txop; // for AC_BE, in unit of 32us - } field; - UINT32 word; -} AC_TXOP_CSR0_STRUC, *PAC_TXOP_CSR0_STRUC; +typedef union _AC_TXOP_CSR0_STRUC { + struct { + USHORT Ac0Txop; // for AC_BK, in unit of 32us + USHORT Ac1Txop; // for AC_BE, in unit of 32us + } field; + UINT32 word; +} AC_TXOP_CSR0_STRUC, *PAC_TXOP_CSR0_STRUC; // // AC_TXOP_CSR1: AC_VO/AC_VI TXOP register // #define WMM_TXOP1_CFG 0x0224 -typedef union _AC_TXOP_CSR1_STRUC { - struct { - USHORT Ac2Txop; // for AC_VI, in unit of 32us - USHORT Ac3Txop; // for AC_VO, in unit of 32us - } field; - UINT32 word; -} AC_TXOP_CSR1_STRUC, *PAC_TXOP_CSR1_STRUC; - +typedef union _AC_TXOP_CSR1_STRUC { + struct { + USHORT Ac2Txop; // for AC_VI, in unit of 32us + USHORT Ac3Txop; // for AC_VO, in unit of 32us + } field; + UINT32 word; +} AC_TXOP_CSR1_STRUC, *PAC_TXOP_CSR1_STRUC; #define RINGREG_DIFF 0x10 #define GPIO_CTRL_CFG 0x0228 //MAC_CSR13 @@ -305,23 +297,23 @@ typedef union _AC_TXOP_CSR1_STRUC { #define TX_MAX_CNT0 0x0234 #define TX_CTX_IDX0 0x0238 #define TX_DTX_IDX0 0x023c -#define TX_BASE_PTR1 0x0240 //AC_BE base address +#define TX_BASE_PTR1 0x0240 //AC_BE base address #define TX_MAX_CNT1 0x0244 #define TX_CTX_IDX1 0x0248 #define TX_DTX_IDX1 0x024c -#define TX_BASE_PTR2 0x0250 //AC_VI base address +#define TX_BASE_PTR2 0x0250 //AC_VI base address #define TX_MAX_CNT2 0x0254 #define TX_CTX_IDX2 0x0258 #define TX_DTX_IDX2 0x025c -#define TX_BASE_PTR3 0x0260 //AC_VO base address +#define TX_BASE_PTR3 0x0260 //AC_VO base address #define TX_MAX_CNT3 0x0264 #define TX_CTX_IDX3 0x0268 #define TX_DTX_IDX3 0x026c -#define TX_BASE_PTR4 0x0270 //HCCA base address +#define TX_BASE_PTR4 0x0270 //HCCA base address #define TX_MAX_CNT4 0x0274 #define TX_CTX_IDX4 0x0278 #define TX_DTX_IDX4 0x027c -#define TX_BASE_PTR5 0x0280 //MGMT base address +#define TX_BASE_PTR5 0x0280 //MGMT base address #define TX_MAX_CNT5 0x0284 #define TX_CTX_IDX5 0x0288 #define TX_DTX_IDX5 0x028c @@ -333,26 +325,24 @@ typedef union _AC_TXOP_CSR1_STRUC { #define RX_CRX_IDX 0x0298 #define RX_DRX_IDX 0x029c - #define USB_DMA_CFG 0x02a0 -typedef union _USB_DMA_CFG_STRUC { - struct { - UINT32 RxBulkAggTOut:8; //Rx Bulk Aggregation TimeOut in unit of 33ns - UINT32 RxBulkAggLmt:8; //Rx Bulk Aggregation Limit in unit of 256 bytes - UINT32 phyclear:1; //phy watch dog enable. write 1 - UINT32 rsv:2; - UINT32 TxClear:1; //Clear USB DMA TX path - UINT32 TxopHalt:1; //Halt TXOP count down when TX buffer is full. - UINT32 RxBulkAggEn:1; //Enable Rx Bulk Aggregation - UINT32 RxBulkEn:1; //Enable USB DMA Rx - UINT32 TxBulkEn:1; //Enable USB DMA Tx - UINT32 EpoutValid:6; //OUT endpoint data valid - UINT32 RxBusy:1; //USB DMA RX FSM busy - UINT32 TxBusy:1; //USB DMA TX FSM busy - } field; - UINT32 word; -} USB_DMA_CFG_STRUC, *PUSB_DMA_CFG_STRUC; - +typedef union _USB_DMA_CFG_STRUC { + struct { + UINT32 RxBulkAggTOut:8; //Rx Bulk Aggregation TimeOut in unit of 33ns + UINT32 RxBulkAggLmt:8; //Rx Bulk Aggregation Limit in unit of 256 bytes + UINT32 phyclear:1; //phy watch dog enable. write 1 + UINT32 rsv:2; + UINT32 TxClear:1; //Clear USB DMA TX path + UINT32 TxopHalt:1; //Halt TXOP count down when TX buffer is full. + UINT32 RxBulkAggEn:1; //Enable Rx Bulk Aggregation + UINT32 RxBulkEn:1; //Enable USB DMA Rx + UINT32 TxBulkEn:1; //Enable USB DMA Tx + UINT32 EpoutValid:6; //OUT endpoint data valid + UINT32 RxBusy:1; //USB DMA RX FSM busy + UINT32 TxBusy:1; //USB DMA TX FSM busy + } field; + UINT32 word; +} USB_DMA_CFG_STRUC, *PUSB_DMA_CFG_STRUC; // // 3 PBF registers @@ -385,7 +375,6 @@ typedef union _USB_DMA_CFG_STRUC { #define LDO_CFG0 0x05d4 #define GPIO_SWITCH 0x05dc - // // 4 MAC registers // @@ -393,143 +382,143 @@ typedef union _USB_DMA_CFG_STRUC { // 4.1 MAC SYSTEM configuration registers (offset:0x1000) // #define MAC_CSR0 0x1000 -typedef union _ASIC_VER_ID_STRUC { - struct { - USHORT ASICRev; // reversion : 0 - USHORT ASICVer; // version : 2860 - } field; - UINT32 word; -} ASIC_VER_ID_STRUC, *PASIC_VER_ID_STRUC; -#define MAC_SYS_CTRL 0x1004 //MAC_CSR1 -#define MAC_ADDR_DW0 0x1008 // MAC ADDR DW0 -#define MAC_ADDR_DW1 0x100c // MAC ADDR DW1 +typedef union _ASIC_VER_ID_STRUC { + struct { + USHORT ASICRev; // reversion : 0 + USHORT ASICVer; // version : 2860 + } field; + UINT32 word; +} ASIC_VER_ID_STRUC, *PASIC_VER_ID_STRUC; +#define MAC_SYS_CTRL 0x1004 //MAC_CSR1 +#define MAC_ADDR_DW0 0x1008 // MAC ADDR DW0 +#define MAC_ADDR_DW1 0x100c // MAC ADDR DW1 // // MAC_CSR2: STA MAC register 0 // -typedef union _MAC_DW0_STRUC { - struct { - UCHAR Byte0; // MAC address byte 0 - UCHAR Byte1; // MAC address byte 1 - UCHAR Byte2; // MAC address byte 2 - UCHAR Byte3; // MAC address byte 3 - } field; - UINT32 word; -} MAC_DW0_STRUC, *PMAC_DW0_STRUC; +typedef union _MAC_DW0_STRUC { + struct { + UCHAR Byte0; // MAC address byte 0 + UCHAR Byte1; // MAC address byte 1 + UCHAR Byte2; // MAC address byte 2 + UCHAR Byte3; // MAC address byte 3 + } field; + UINT32 word; +} MAC_DW0_STRUC, *PMAC_DW0_STRUC; // // MAC_CSR3: STA MAC register 1 // -typedef union _MAC_DW1_STRUC { - struct { - UCHAR Byte4; // MAC address byte 4 - UCHAR Byte5; // MAC address byte 5 - UCHAR U2MeMask; - UCHAR Rsvd1; - } field; - UINT32 word; -} MAC_DW1_STRUC, *PMAC_DW1_STRUC; +typedef union _MAC_DW1_STRUC { + struct { + UCHAR Byte4; // MAC address byte 4 + UCHAR Byte5; // MAC address byte 5 + UCHAR U2MeMask; + UCHAR Rsvd1; + } field; + UINT32 word; +} MAC_DW1_STRUC, *PMAC_DW1_STRUC; -#define MAC_BSSID_DW0 0x1010 // MAC BSSID DW0 -#define MAC_BSSID_DW1 0x1014 // MAC BSSID DW1 +#define MAC_BSSID_DW0 0x1010 // MAC BSSID DW0 +#define MAC_BSSID_DW1 0x1014 // MAC BSSID DW1 // // MAC_CSR5: BSSID register 1 // -typedef union _MAC_CSR5_STRUC { - struct { - UCHAR Byte4; // BSSID byte 4 - UCHAR Byte5; // BSSID byte 5 - USHORT BssIdMask:2; // 0: one BSSID, 10: 4 BSSID, 01: 2 BSSID , 11: 8BSSID - USHORT MBssBcnNum:3; - USHORT Rsvd:11; - } field; - UINT32 word; -} MAC_CSR5_STRUC, *PMAC_CSR5_STRUC; +typedef union _MAC_CSR5_STRUC { + struct { + UCHAR Byte4; // BSSID byte 4 + UCHAR Byte5; // BSSID byte 5 + USHORT BssIdMask:2; // 0: one BSSID, 10: 4 BSSID, 01: 2 BSSID , 11: 8BSSID + USHORT MBssBcnNum:3; + USHORT Rsvd:11; + } field; + UINT32 word; +} MAC_CSR5_STRUC, *PMAC_CSR5_STRUC; -#define MAX_LEN_CFG 0x1018 // rt2860b max 16k bytes. bit12:13 Maximum PSDU length (power factor) 0:2^13, 1:2^14, 2:2^15, 3:2^16 -#define BBP_CSR_CFG 0x101c // +#define MAX_LEN_CFG 0x1018 // rt2860b max 16k bytes. bit12:13 Maximum PSDU length (power factor) 0:2^13, 1:2^14, 2:2^15, 3:2^16 +#define BBP_CSR_CFG 0x101c // // // BBP_CSR_CFG: BBP serial control register // -typedef union _BBP_CSR_CFG_STRUC { - struct { - UINT32 Value:8; // Register value to program into BBP - UINT32 RegNum:8; // Selected BBP register - UINT32 fRead:1; // 0: Write BBP, 1: Read BBP - UINT32 Busy:1; // 1: ASIC is busy execute BBP programming. - UINT32 BBP_PAR_DUR:1; // 0: 4 MAC clock cycles 1: 8 MAC clock cycles - UINT32 BBP_RW_MODE:1; // 0: use serial mode 1:parallel - UINT32 :12; - } field; - UINT32 word; -} BBP_CSR_CFG_STRUC, *PBBP_CSR_CFG_STRUC; +typedef union _BBP_CSR_CFG_STRUC { + struct { + UINT32 Value:8; // Register value to program into BBP + UINT32 RegNum:8; // Selected BBP register + UINT32 fRead:1; // 0: Write BBP, 1: Read BBP + UINT32 Busy:1; // 1: ASIC is busy execute BBP programming. + UINT32 BBP_PAR_DUR:1; // 0: 4 MAC clock cycles 1: 8 MAC clock cycles + UINT32 BBP_RW_MODE:1; // 0: use serial mode 1:parallel + UINT32:12; + } field; + UINT32 word; +} BBP_CSR_CFG_STRUC, *PBBP_CSR_CFG_STRUC; #define RF_CSR_CFG0 0x1020 // // RF_CSR_CFG: RF control register // -typedef union _RF_CSR_CFG0_STRUC { - struct { - UINT32 RegIdAndContent:24; // Register value to program into BBP - UINT32 bitwidth:5; // Selected BBP register - UINT32 StandbyMode:1; // 0: high when stand by 1: low when standby - UINT32 Sel:1; // 0:RF_LE0 activate 1:RF_LE1 activate - UINT32 Busy:1; // 0: idle 1: 8busy - } field; - UINT32 word; -} RF_CSR_CFG0_STRUC, *PRF_CSR_CFG0_STRUC; +typedef union _RF_CSR_CFG0_STRUC { + struct { + UINT32 RegIdAndContent:24; // Register value to program into BBP + UINT32 bitwidth:5; // Selected BBP register + UINT32 StandbyMode:1; // 0: high when stand by 1: low when standby + UINT32 Sel:1; // 0:RF_LE0 activate 1:RF_LE1 activate + UINT32 Busy:1; // 0: idle 1: 8busy + } field; + UINT32 word; +} RF_CSR_CFG0_STRUC, *PRF_CSR_CFG0_STRUC; #define RF_CSR_CFG1 0x1024 -typedef union _RF_CSR_CFG1_STRUC { - struct { - UINT32 RegIdAndContent:24; // Register value to program into BBP - UINT32 RFGap:5; // Gap between BB_CONTROL_RF and RF_LE. 0: 3 system clock cycle (37.5usec) 1: 5 system clock cycle (62.5usec) - UINT32 rsv:7; // 0: idle 1: 8busy - } field; - UINT32 word; -} RF_CSR_CFG1_STRUC, *PRF_CSR_CFG1_STRUC; -#define RF_CSR_CFG2 0x1028 // -typedef union _RF_CSR_CFG2_STRUC { - struct { - UINT32 RegIdAndContent:24; // Register value to program into BBP - UINT32 rsv:8; // 0: idle 1: 8busy - } field; - UINT32 word; -} RF_CSR_CFG2_STRUC, *PRF_CSR_CFG2_STRUC; -#define LED_CFG 0x102c // MAC_CSR14 -typedef union _LED_CFG_STRUC { - struct { - UINT32 OnPeriod:8; // blinking on period unit 1ms - UINT32 OffPeriod:8; // blinking off period unit 1ms - UINT32 SlowBlinkPeriod:6; // slow blinking period. unit:1ms - UINT32 rsv:2; - UINT32 RLedMode:2; // red Led Mode 0: off1: blinking upon TX2: periodic slow blinking3: always on - UINT32 GLedMode:2; // green Led Mode - UINT32 YLedMode:2; // yellow Led Mode - UINT32 LedPolar:1; // Led Polarity. 0: active low1: active high - UINT32 :1; - } field; - UINT32 word; -} LED_CFG_STRUC, *PLED_CFG_STRUC; +typedef union _RF_CSR_CFG1_STRUC { + struct { + UINT32 RegIdAndContent:24; // Register value to program into BBP + UINT32 RFGap:5; // Gap between BB_CONTROL_RF and RF_LE. 0: 3 system clock cycle (37.5usec) 1: 5 system clock cycle (62.5usec) + UINT32 rsv:7; // 0: idle 1: 8busy + } field; + UINT32 word; +} RF_CSR_CFG1_STRUC, *PRF_CSR_CFG1_STRUC; +#define RF_CSR_CFG2 0x1028 // +typedef union _RF_CSR_CFG2_STRUC { + struct { + UINT32 RegIdAndContent:24; // Register value to program into BBP + UINT32 rsv:8; // 0: idle 1: 8busy + } field; + UINT32 word; +} RF_CSR_CFG2_STRUC, *PRF_CSR_CFG2_STRUC; +#define LED_CFG 0x102c // MAC_CSR14 +typedef union _LED_CFG_STRUC { + struct { + UINT32 OnPeriod:8; // blinking on period unit 1ms + UINT32 OffPeriod:8; // blinking off period unit 1ms + UINT32 SlowBlinkPeriod:6; // slow blinking period. unit:1ms + UINT32 rsv:2; + UINT32 RLedMode:2; // red Led Mode 0: off1: blinking upon TX2: periodic slow blinking3: always on + UINT32 GLedMode:2; // green Led Mode + UINT32 YLedMode:2; // yellow Led Mode + UINT32 LedPolar:1; // Led Polarity. 0: active low1: active high + UINT32:1; + } field; + UINT32 word; +} LED_CFG_STRUC, *PLED_CFG_STRUC; // // 4.2 MAC TIMING configuration registers (offset:0x1100) // -#define XIFS_TIME_CFG 0x1100 // MAC_CSR8 MAC_CSR9 -typedef union _IFS_SLOT_CFG_STRUC { - struct { - UINT32 CckmSifsTime:8; // unit 1us. Applied after CCK RX/TX - UINT32 OfdmSifsTime:8; // unit 1us. Applied after OFDM RX/TX - UINT32 OfdmXifsTime:4; //OFDM SIFS. unit 1us. Applied after OFDM RX when MAC doesn't reference BBP signal BBRXEND - UINT32 EIFS:9; // unit 1us - UINT32 BBRxendEnable:1; // reference RXEND signal to begin XIFS defer - UINT32 rsv:2; - } field; - UINT32 word; -} IFS_SLOT_CFG_STRUC, *PIFS_SLOT_CFG_STRUC; - -#define BKOFF_SLOT_CFG 0x1104 // mac_csr9 last 8 bits -#define NAV_TIME_CFG 0x1108 // NAV (MAC_CSR15) -#define CH_TIME_CFG 0x110C // Count as channel busy -#define PBF_LIFE_TIMER 0x1110 //TX/RX MPDU timestamp timer (free run)Unit: 1us -#define BCN_TIME_CFG 0x1114 // TXRX_CSR9 +#define XIFS_TIME_CFG 0x1100 // MAC_CSR8 MAC_CSR9 +typedef union _IFS_SLOT_CFG_STRUC { + struct { + UINT32 CckmSifsTime:8; // unit 1us. Applied after CCK RX/TX + UINT32 OfdmSifsTime:8; // unit 1us. Applied after OFDM RX/TX + UINT32 OfdmXifsTime:4; //OFDM SIFS. unit 1us. Applied after OFDM RX when MAC doesn't reference BBP signal BBRXEND + UINT32 EIFS:9; // unit 1us + UINT32 BBRxendEnable:1; // reference RXEND signal to begin XIFS defer + UINT32 rsv:2; + } field; + UINT32 word; +} IFS_SLOT_CFG_STRUC, *PIFS_SLOT_CFG_STRUC; + +#define BKOFF_SLOT_CFG 0x1104 // mac_csr9 last 8 bits +#define NAV_TIME_CFG 0x1108 // NAV (MAC_CSR15) +#define CH_TIME_CFG 0x110C // Count as channel busy +#define PBF_LIFE_TIMER 0x1110 //TX/RX MPDU timestamp timer (free run)Unit: 1us +#define BCN_TIME_CFG 0x1114 // TXRX_CSR9 #define BCN_OFFSET0 0x042C #define BCN_OFFSET1 0x0430 @@ -537,62 +526,62 @@ typedef union _IFS_SLOT_CFG_STRUC { // // BCN_TIME_CFG : Synchronization control register // -typedef union _BCN_TIME_CFG_STRUC { - struct { - UINT32 BeaconInterval:16; // in unit of 1/16 TU - UINT32 bTsfTicking:1; // Enable TSF auto counting - UINT32 TsfSyncMode:2; // Enable TSF sync, 00: disable, 01: infra mode, 10: ad-hoc mode - UINT32 bTBTTEnable:1; - UINT32 bBeaconGen:1; // Enable beacon generator - UINT32 :3; - UINT32 TxTimestampCompensate:8; - } field; - UINT32 word; -} BCN_TIME_CFG_STRUC, *PBCN_TIME_CFG_STRUC; -#define TBTT_SYNC_CFG 0x1118 // txrx_csr10 -#define TSF_TIMER_DW0 0x111C // Local TSF timer lsb 32 bits. Read-only -#define TSF_TIMER_DW1 0x1120 // msb 32 bits. Read-only. -#define TBTT_TIMER 0x1124 // TImer remains till next TBTT. Read-only. TXRX_CSR14 -#define INT_TIMER_CFG 0x1128 // -#define INT_TIMER_EN 0x112c // GP-timer and pre-tbtt Int enable -#define CH_IDLE_STA 0x1130 // channel idle time -#define CH_BUSY_STA 0x1134 // channle busy time +typedef union _BCN_TIME_CFG_STRUC { + struct { + UINT32 BeaconInterval:16; // in unit of 1/16 TU + UINT32 bTsfTicking:1; // Enable TSF auto counting + UINT32 TsfSyncMode:2; // Enable TSF sync, 00: disable, 01: infra mode, 10: ad-hoc mode + UINT32 bTBTTEnable:1; + UINT32 bBeaconGen:1; // Enable beacon generator + UINT32:3; + UINT32 TxTimestampCompensate:8; + } field; + UINT32 word; +} BCN_TIME_CFG_STRUC, *PBCN_TIME_CFG_STRUC; +#define TBTT_SYNC_CFG 0x1118 // txrx_csr10 +#define TSF_TIMER_DW0 0x111C // Local TSF timer lsb 32 bits. Read-only +#define TSF_TIMER_DW1 0x1120 // msb 32 bits. Read-only. +#define TBTT_TIMER 0x1124 // TImer remains till next TBTT. Read-only. TXRX_CSR14 +#define INT_TIMER_CFG 0x1128 // +#define INT_TIMER_EN 0x112c // GP-timer and pre-tbtt Int enable +#define CH_IDLE_STA 0x1130 // channel idle time +#define CH_BUSY_STA 0x1134 // channle busy time // // 4.2 MAC POWER configuration registers (offset:0x1200) // -#define MAC_STATUS_CFG 0x1200 // old MAC_CSR12 -#define PWR_PIN_CFG 0x1204 // old MAC_CSR12 -#define AUTO_WAKEUP_CFG 0x1208 // old MAC_CSR10 +#define MAC_STATUS_CFG 0x1200 // old MAC_CSR12 +#define PWR_PIN_CFG 0x1204 // old MAC_CSR12 +#define AUTO_WAKEUP_CFG 0x1208 // old MAC_CSR10 // // AUTO_WAKEUP_CFG: Manual power control / status register // -typedef union _AUTO_WAKEUP_STRUC { - struct { - UINT32 AutoLeadTime:8; - UINT32 NumofSleepingTbtt:7; // ForceWake has high privilege than PutToSleep when both set - UINT32 EnableAutoWakeup:1; // 0:sleep, 1:awake - UINT32 :16; - } field; - UINT32 word; -} AUTO_WAKEUP_STRUC, *PAUTO_WAKEUP_STRUC; +typedef union _AUTO_WAKEUP_STRUC { + struct { + UINT32 AutoLeadTime:8; + UINT32 NumofSleepingTbtt:7; // ForceWake has high privilege than PutToSleep when both set + UINT32 EnableAutoWakeup:1; // 0:sleep, 1:awake + UINT32:16; + } field; + UINT32 word; +} AUTO_WAKEUP_STRUC, *PAUTO_WAKEUP_STRUC; // // 4.3 MAC TX configuration registers (offset:0x1300) // -#define EDCA_AC0_CFG 0x1300 //AC_TXOP_CSR0 0x3474 +#define EDCA_AC0_CFG 0x1300 //AC_TXOP_CSR0 0x3474 #define EDCA_AC1_CFG 0x1304 #define EDCA_AC2_CFG 0x1308 #define EDCA_AC3_CFG 0x130c -typedef union _EDCA_AC_CFG_STRUC { - struct { - UINT32 AcTxop:8; // in unit of 32us - UINT32 Aifsn:4; // # of slot time - UINT32 Cwmin:4; // - UINT32 Cwmax:4; //unit power of 2 - UINT32 :12; // - } field; - UINT32 word; -} EDCA_AC_CFG_STRUC, *PEDCA_AC_CFG_STRUC; +typedef union _EDCA_AC_CFG_STRUC { + struct { + UINT32 AcTxop:8; // in unit of 32us + UINT32 Aifsn:4; // # of slot time + UINT32 Cwmin:4; // + UINT32 Cwmax:4; //unit power of 2 + UINT32:12; // + } field; + UINT32 word; +} EDCA_AC_CFG_STRUC, *PEDCA_AC_CFG_STRUC; #define EDCA_TID_AC_MAP 0x1310 #define TX_PWR_CFG_0 0x1314 @@ -601,7 +590,7 @@ typedef union _EDCA_AC_CFG_STRUC { #define TX_PWR_CFG_3 0x1320 #define TX_PWR_CFG_4 0x1324 #define TX_PIN_CFG 0x1328 -#define TX_BAND_CFG 0x132c // 0x1 use upper 20MHz. 0 juse lower 20MHz +#define TX_BAND_CFG 0x132c // 0x1 use upper 20MHz. 0 juse lower 20MHz #define TX_SW_CFG0 0x1330 #define TX_SW_CFG1 0x1334 #define TX_SW_CFG2 0x1338 @@ -609,163 +598,162 @@ typedef union _EDCA_AC_CFG_STRUC { #define TXOP_CTRL_CFG 0x1340 #define TX_RTS_CFG 0x1344 -typedef union _TX_RTS_CFG_STRUC { - struct { - UINT32 AutoRtsRetryLimit:8; - UINT32 RtsThres:16; // unit:byte - UINT32 RtsFbkEn:1; // enable rts rate fallback - UINT32 rsv:7; // 1: HT non-STBC control frame enable - } field; - UINT32 word; -} TX_RTS_CFG_STRUC, *PTX_RTS_CFG_STRUC; +typedef union _TX_RTS_CFG_STRUC { + struct { + UINT32 AutoRtsRetryLimit:8; + UINT32 RtsThres:16; // unit:byte + UINT32 RtsFbkEn:1; // enable rts rate fallback + UINT32 rsv:7; // 1: HT non-STBC control frame enable + } field; + UINT32 word; +} TX_RTS_CFG_STRUC, *PTX_RTS_CFG_STRUC; #define TX_TIMEOUT_CFG 0x1348 -typedef union _TX_TIMEOUT_CFG_STRUC { - struct { - UINT32 rsv:4; - UINT32 MpduLifeTime:4; // expiration time = 2^(9+MPDU LIFE TIME) us - UINT32 RxAckTimeout:8; // unit:slot. Used for TX precedure - UINT32 TxopTimeout:8; //TXOP timeout value for TXOP truncation. It is recommended that (SLOT_TIME) > (TX_OP_TIMEOUT) > (RX_ACK_TIMEOUT) - UINT32 rsv2:8; // 1: HT non-STBC control frame enable - } field; - UINT32 word; -} TX_TIMEOUT_CFG_STRUC, *PTX_TIMEOUT_CFG_STRUC; +typedef union _TX_TIMEOUT_CFG_STRUC { + struct { + UINT32 rsv:4; + UINT32 MpduLifeTime:4; // expiration time = 2^(9+MPDU LIFE TIME) us + UINT32 RxAckTimeout:8; // unit:slot. Used for TX precedure + UINT32 TxopTimeout:8; //TXOP timeout value for TXOP truncation. It is recommended that (SLOT_TIME) > (TX_OP_TIMEOUT) > (RX_ACK_TIMEOUT) + UINT32 rsv2:8; // 1: HT non-STBC control frame enable + } field; + UINT32 word; +} TX_TIMEOUT_CFG_STRUC, *PTX_TIMEOUT_CFG_STRUC; #define TX_RTY_CFG 0x134c -typedef union PACKED _TX_RTY_CFG_STRUC { - struct { - UINT32 ShortRtyLimit:8; // short retry limit - UINT32 LongRtyLimit:8; //long retry limit - UINT32 LongRtyThre:12; // Long retry threshoold - UINT32 NonAggRtyMode:1; // Non-Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer - UINT32 AggRtyMode:1; // Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer - UINT32 TxautoFBEnable:1; // Tx retry PHY rate auto fallback enable - UINT32 rsv:1; // 1: HT non-STBC control frame enable - } field; - UINT32 word; -} TX_RTY_CFG_STRUC, *PTX_RTY_CFG_STRUC; +typedef union PACKED _TX_RTY_CFG_STRUC { + struct { + UINT32 ShortRtyLimit:8; // short retry limit + UINT32 LongRtyLimit:8; //long retry limit + UINT32 LongRtyThre:12; // Long retry threshoold + UINT32 NonAggRtyMode:1; // Non-Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer + UINT32 AggRtyMode:1; // Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer + UINT32 TxautoFBEnable:1; // Tx retry PHY rate auto fallback enable + UINT32 rsv:1; // 1: HT non-STBC control frame enable + } field; + UINT32 word; +} TX_RTY_CFG_STRUC, *PTX_RTY_CFG_STRUC; #define TX_LINK_CFG 0x1350 -typedef union PACKED _TX_LINK_CFG_STRUC { +typedef union PACKED _TX_LINK_CFG_STRUC { struct PACKED { - UINT32 RemoteMFBLifeTime:8; //remote MFB life time. unit : 32us - UINT32 MFBEnable:1; // TX apply remote MFB 1:enable - UINT32 RemoteUMFSEnable:1; // remote unsolicit MFB enable. 0: not apply remote remote unsolicit (MFS=7) - UINT32 TxMRQEn:1; // MCS request TX enable - UINT32 TxRDGEn:1; // RDG TX enable - UINT32 TxCFAckEn:1; // Piggyback CF-ACK enable - UINT32 rsv:3; // - UINT32 RemotMFB:8; // remote MCS feedback - UINT32 RemotMFS:8; //remote MCS feedback sequence number - } field; - UINT32 word; -} TX_LINK_CFG_STRUC, *PTX_LINK_CFG_STRUC; + UINT32 RemoteMFBLifeTime:8; //remote MFB life time. unit : 32us + UINT32 MFBEnable:1; // TX apply remote MFB 1:enable + UINT32 RemoteUMFSEnable:1; // remote unsolicit MFB enable. 0: not apply remote remote unsolicit (MFS=7) + UINT32 TxMRQEn:1; // MCS request TX enable + UINT32 TxRDGEn:1; // RDG TX enable + UINT32 TxCFAckEn:1; // Piggyback CF-ACK enable + UINT32 rsv:3; // + UINT32 RemotMFB:8; // remote MCS feedback + UINT32 RemotMFS:8; //remote MCS feedback sequence number + } field; + UINT32 word; +} TX_LINK_CFG_STRUC, *PTX_LINK_CFG_STRUC; #define HT_FBK_CFG0 0x1354 -typedef union PACKED _HT_FBK_CFG0_STRUC { - struct { - UINT32 HTMCS0FBK:4; - UINT32 HTMCS1FBK:4; - UINT32 HTMCS2FBK:4; - UINT32 HTMCS3FBK:4; - UINT32 HTMCS4FBK:4; - UINT32 HTMCS5FBK:4; - UINT32 HTMCS6FBK:4; - UINT32 HTMCS7FBK:4; - } field; - UINT32 word; -} HT_FBK_CFG0_STRUC, *PHT_FBK_CFG0_STRUC; +typedef union PACKED _HT_FBK_CFG0_STRUC { + struct { + UINT32 HTMCS0FBK:4; + UINT32 HTMCS1FBK:4; + UINT32 HTMCS2FBK:4; + UINT32 HTMCS3FBK:4; + UINT32 HTMCS4FBK:4; + UINT32 HTMCS5FBK:4; + UINT32 HTMCS6FBK:4; + UINT32 HTMCS7FBK:4; + } field; + UINT32 word; +} HT_FBK_CFG0_STRUC, *PHT_FBK_CFG0_STRUC; #define HT_FBK_CFG1 0x1358 -typedef union _HT_FBK_CFG1_STRUC { - struct { - UINT32 HTMCS8FBK:4; - UINT32 HTMCS9FBK:4; - UINT32 HTMCS10FBK:4; - UINT32 HTMCS11FBK:4; - UINT32 HTMCS12FBK:4; - UINT32 HTMCS13FBK:4; - UINT32 HTMCS14FBK:4; - UINT32 HTMCS15FBK:4; - } field; - UINT32 word; -} HT_FBK_CFG1_STRUC, *PHT_FBK_CFG1_STRUC; +typedef union _HT_FBK_CFG1_STRUC { + struct { + UINT32 HTMCS8FBK:4; + UINT32 HTMCS9FBK:4; + UINT32 HTMCS10FBK:4; + UINT32 HTMCS11FBK:4; + UINT32 HTMCS12FBK:4; + UINT32 HTMCS13FBK:4; + UINT32 HTMCS14FBK:4; + UINT32 HTMCS15FBK:4; + } field; + UINT32 word; +} HT_FBK_CFG1_STRUC, *PHT_FBK_CFG1_STRUC; #define LG_FBK_CFG0 0x135c -typedef union _LG_FBK_CFG0_STRUC { - struct { - UINT32 OFDMMCS0FBK:4; //initial value is 0 - UINT32 OFDMMCS1FBK:4; //initial value is 0 - UINT32 OFDMMCS2FBK:4; //initial value is 1 - UINT32 OFDMMCS3FBK:4; //initial value is 2 - UINT32 OFDMMCS4FBK:4; //initial value is 3 - UINT32 OFDMMCS5FBK:4; //initial value is 4 - UINT32 OFDMMCS6FBK:4; //initial value is 5 - UINT32 OFDMMCS7FBK:4; //initial value is 6 - } field; - UINT32 word; -} LG_FBK_CFG0_STRUC, *PLG_FBK_CFG0_STRUC; +typedef union _LG_FBK_CFG0_STRUC { + struct { + UINT32 OFDMMCS0FBK:4; //initial value is 0 + UINT32 OFDMMCS1FBK:4; //initial value is 0 + UINT32 OFDMMCS2FBK:4; //initial value is 1 + UINT32 OFDMMCS3FBK:4; //initial value is 2 + UINT32 OFDMMCS4FBK:4; //initial value is 3 + UINT32 OFDMMCS5FBK:4; //initial value is 4 + UINT32 OFDMMCS6FBK:4; //initial value is 5 + UINT32 OFDMMCS7FBK:4; //initial value is 6 + } field; + UINT32 word; +} LG_FBK_CFG0_STRUC, *PLG_FBK_CFG0_STRUC; #define LG_FBK_CFG1 0x1360 -typedef union _LG_FBK_CFG1_STRUC { - struct { - UINT32 CCKMCS0FBK:4; //initial value is 0 - UINT32 CCKMCS1FBK:4; //initial value is 0 - UINT32 CCKMCS2FBK:4; //initial value is 1 - UINT32 CCKMCS3FBK:4; //initial value is 2 - UINT32 rsv:16; - } field; - UINT32 word; -} LG_FBK_CFG1_STRUC, *PLG_FBK_CFG1_STRUC; - +typedef union _LG_FBK_CFG1_STRUC { + struct { + UINT32 CCKMCS0FBK:4; //initial value is 0 + UINT32 CCKMCS1FBK:4; //initial value is 0 + UINT32 CCKMCS2FBK:4; //initial value is 1 + UINT32 CCKMCS3FBK:4; //initial value is 2 + UINT32 rsv:16; + } field; + UINT32 word; +} LG_FBK_CFG1_STRUC, *PLG_FBK_CFG1_STRUC; //======================================================= //================ Protection Paramater================================ //======================================================= -#define CCK_PROT_CFG 0x1364 //CCK Protection +#define CCK_PROT_CFG 0x1364 //CCK Protection #define ASIC_SHORTNAV 1 #define ASIC_LONGNAV 2 #define ASIC_RTS 1 #define ASIC_CTS 2 -typedef union _PROT_CFG_STRUC { - struct { - UINT32 ProtectRate:16; //Protection control frame rate for CCK TX(RTS/CTS/CFEnd). - UINT32 ProtectCtrl:2; //Protection control frame type for CCK TX. 1:RTS/CTS, 2:CTS-to-self, 0:None, 3:rsv - UINT32 ProtectNav:2; //TXOP protection type for CCK TX. 0:None, 1:ShortNAVprotect, 2:LongNAVProtect, 3:rsv - UINT32 TxopAllowCck:1; //CCK TXOP allowance.0:disallow. - UINT32 TxopAllowOfdm:1; //CCK TXOP allowance.0:disallow. - UINT32 TxopAllowMM20:1; //CCK TXOP allowance. 0:disallow. - UINT32 TxopAllowMM40:1; //CCK TXOP allowance.0:disallow. - UINT32 TxopAllowGF20:1; //CCK TXOP allowance.0:disallow. - UINT32 TxopAllowGF40:1; //CCK TXOP allowance.0:disallow. - UINT32 RTSThEn:1; //RTS threshold enable on CCK TX - UINT32 rsv:5; - } field; - UINT32 word; -} PROT_CFG_STRUC, *PPROT_CFG_STRUC; - -#define OFDM_PROT_CFG 0x1368 //OFDM Protection -#define MM20_PROT_CFG 0x136C //MM20 Protection -#define MM40_PROT_CFG 0x1370 //MM40 Protection -#define GF20_PROT_CFG 0x1374 //GF20 Protection -#define GF40_PROT_CFG 0x1378 //GR40 Protection -#define EXP_CTS_TIME 0x137C // -#define EXP_ACK_TIME 0x1380 // +typedef union _PROT_CFG_STRUC { + struct { + UINT32 ProtectRate:16; //Protection control frame rate for CCK TX(RTS/CTS/CFEnd). + UINT32 ProtectCtrl:2; //Protection control frame type for CCK TX. 1:RTS/CTS, 2:CTS-to-self, 0:None, 3:rsv + UINT32 ProtectNav:2; //TXOP protection type for CCK TX. 0:None, 1:ShortNAVprotect, 2:LongNAVProtect, 3:rsv + UINT32 TxopAllowCck:1; //CCK TXOP allowance.0:disallow. + UINT32 TxopAllowOfdm:1; //CCK TXOP allowance.0:disallow. + UINT32 TxopAllowMM20:1; //CCK TXOP allowance. 0:disallow. + UINT32 TxopAllowMM40:1; //CCK TXOP allowance.0:disallow. + UINT32 TxopAllowGF20:1; //CCK TXOP allowance.0:disallow. + UINT32 TxopAllowGF40:1; //CCK TXOP allowance.0:disallow. + UINT32 RTSThEn:1; //RTS threshold enable on CCK TX + UINT32 rsv:5; + } field; + UINT32 word; +} PROT_CFG_STRUC, *PPROT_CFG_STRUC; + +#define OFDM_PROT_CFG 0x1368 //OFDM Protection +#define MM20_PROT_CFG 0x136C //MM20 Protection +#define MM40_PROT_CFG 0x1370 //MM40 Protection +#define GF20_PROT_CFG 0x1374 //GF20 Protection +#define GF40_PROT_CFG 0x1378 //GR40 Protection +#define EXP_CTS_TIME 0x137C // +#define EXP_ACK_TIME 0x1380 // // // 4.4 MAC RX configuration registers (offset:0x1400) // -#define RX_FILTR_CFG 0x1400 //TXRX_CSR0 -#define AUTO_RSP_CFG 0x1404 //TXRX_CSR4 +#define RX_FILTR_CFG 0x1400 //TXRX_CSR0 +#define AUTO_RSP_CFG 0x1404 //TXRX_CSR4 // // TXRX_CSR4: Auto-Responder/ // typedef union _AUTO_RSP_CFG_STRUC { - struct { - UINT32 AutoResponderEnable:1; - UINT32 BACAckPolicyEnable:1; // 0:long, 1:short preamble - UINT32 CTS40MMode:1; // Response CTS 40MHz duplicate mode - UINT32 CTS40MRef:1; // Response CTS 40MHz duplicate mode - UINT32 AutoResponderPreamble:1; // 0:long, 1:short preamble - UINT32 rsv:1; // Power bit value in conrtrol frame - UINT32 DualCTSEn:1; // Power bit value in conrtrol frame - UINT32 AckCtsPsmBit:1; // Power bit value in conrtrol frame - UINT32 :24; - } field; - UINT32 word; + struct { + UINT32 AutoResponderEnable:1; + UINT32 BACAckPolicyEnable:1; // 0:long, 1:short preamble + UINT32 CTS40MMode:1; // Response CTS 40MHz duplicate mode + UINT32 CTS40MRef:1; // Response CTS 40MHz duplicate mode + UINT32 AutoResponderPreamble:1; // 0:long, 1:short preamble + UINT32 rsv:1; // Power bit value in conrtrol frame + UINT32 DualCTSEn:1; // Power bit value in conrtrol frame + UINT32 AckCtsPsmBit:1; // Power bit value in conrtrol frame + UINT32:24; + } field; + UINT32 word; } AUTO_RSP_CFG_STRUC, *PAUTO_RSP_CFG_STRUC; #define LEGACY_BASIC_RATE 0x1408 // TXRX_CSR5 0x3054 @@ -777,9 +765,9 @@ typedef union _AUTO_RSP_CFG_STRUC { // // 4.5 MAC Security configuration (offset:0x1500) // -#define TX_SEC_CNT0 0x1500 // -#define RX_SEC_CNT0 0x1504 // -#define CCMP_FC_MUTE 0x1508 // +#define TX_SEC_CNT0 0x1500 // +#define RX_SEC_CNT0 0x1504 // +#define CCMP_FC_MUTE 0x1508 // // // 4.6 HCCA/PSMP (offset:0x1600) // @@ -792,179 +780,179 @@ typedef union _AUTO_RSP_CFG_STRUC { // // 4.7 MAC Statistis registers (offset:0x1700) // -#define RX_STA_CNT0 0x1700 // -#define RX_STA_CNT1 0x1704 // -#define RX_STA_CNT2 0x1708 // +#define RX_STA_CNT0 0x1700 // +#define RX_STA_CNT1 0x1704 // +#define RX_STA_CNT2 0x1708 // // // RX_STA_CNT0_STRUC: RX PLCP error count & RX CRC error count // -typedef union _RX_STA_CNT0_STRUC { - struct { - USHORT CrcErr; - USHORT PhyErr; - } field; - UINT32 word; -} RX_STA_CNT0_STRUC, *PRX_STA_CNT0_STRUC; +typedef union _RX_STA_CNT0_STRUC { + struct { + USHORT CrcErr; + USHORT PhyErr; + } field; + UINT32 word; +} RX_STA_CNT0_STRUC, *PRX_STA_CNT0_STRUC; // // RX_STA_CNT1_STRUC: RX False CCA count & RX LONG frame count // -typedef union _RX_STA_CNT1_STRUC { - struct { - USHORT FalseCca; - USHORT PlcpErr; - } field; - UINT32 word; -} RX_STA_CNT1_STRUC, *PRX_STA_CNT1_STRUC; +typedef union _RX_STA_CNT1_STRUC { + struct { + USHORT FalseCca; + USHORT PlcpErr; + } field; + UINT32 word; +} RX_STA_CNT1_STRUC, *PRX_STA_CNT1_STRUC; // // RX_STA_CNT2_STRUC: // -typedef union _RX_STA_CNT2_STRUC { - struct { - USHORT RxDupliCount; - USHORT RxFifoOverflowCount; - } field; - UINT32 word; -} RX_STA_CNT2_STRUC, *PRX_STA_CNT2_STRUC; -#define TX_STA_CNT0 0x170C // +typedef union _RX_STA_CNT2_STRUC { + struct { + USHORT RxDupliCount; + USHORT RxFifoOverflowCount; + } field; + UINT32 word; +} RX_STA_CNT2_STRUC, *PRX_STA_CNT2_STRUC; +#define TX_STA_CNT0 0x170C // // // STA_CSR3: TX Beacon count // -typedef union _TX_STA_CNT0_STRUC { - struct { - USHORT TxFailCount; - USHORT TxBeaconCount; - } field; - UINT32 word; -} TX_STA_CNT0_STRUC, *PTX_STA_CNT0_STRUC; -#define TX_STA_CNT1 0x1710 // +typedef union _TX_STA_CNT0_STRUC { + struct { + USHORT TxFailCount; + USHORT TxBeaconCount; + } field; + UINT32 word; +} TX_STA_CNT0_STRUC, *PTX_STA_CNT0_STRUC; +#define TX_STA_CNT1 0x1710 // // // TX_STA_CNT1: TX tx count // -typedef union _TX_STA_CNT1_STRUC { - struct { - USHORT TxSuccess; - USHORT TxRetransmit; - } field; - UINT32 word; -} TX_STA_CNT1_STRUC, *PTX_STA_CNT1_STRUC; -#define TX_STA_CNT2 0x1714 // +typedef union _TX_STA_CNT1_STRUC { + struct { + USHORT TxSuccess; + USHORT TxRetransmit; + } field; + UINT32 word; +} TX_STA_CNT1_STRUC, *PTX_STA_CNT1_STRUC; +#define TX_STA_CNT2 0x1714 // // // TX_STA_CNT2: TX tx count // -typedef union _TX_STA_CNT2_STRUC { - struct { - USHORT TxZeroLenCount; - USHORT TxUnderFlowCount; - } field; - UINT32 word; -} TX_STA_CNT2_STRUC, *PTX_STA_CNT2_STRUC; -#define TX_STA_FIFO 0x1718 // +typedef union _TX_STA_CNT2_STRUC { + struct { + USHORT TxZeroLenCount; + USHORT TxUnderFlowCount; + } field; + UINT32 word; +} TX_STA_CNT2_STRUC, *PTX_STA_CNT2_STRUC; +#define TX_STA_FIFO 0x1718 // // // TX_STA_FIFO_STRUC: TX Result for specific PID status fifo register // -typedef union PACKED _TX_STA_FIFO_STRUC { - struct { - UINT32 bValid:1; // 1:This register contains a valid TX result - UINT32 PidType:4; - UINT32 TxSuccess:1; // Tx No retry success - UINT32 TxAggre:1; // Tx Retry Success - UINT32 TxAckRequired:1; // Tx fail - UINT32 wcid:8; //wireless client index -// UINT32 SuccessRate:16; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16. - UINT32 SuccessRate:13; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16. - UINT32 TxBF:1; - UINT32 Reserve:2; - } field; - UINT32 word; -} TX_STA_FIFO_STRUC, *PTX_STA_FIFO_STRUC; +typedef union PACKED _TX_STA_FIFO_STRUC { + struct { + UINT32 bValid:1; // 1:This register contains a valid TX result + UINT32 PidType:4; + UINT32 TxSuccess:1; // Tx No retry success + UINT32 TxAggre:1; // Tx Retry Success + UINT32 TxAckRequired:1; // Tx fail + UINT32 wcid:8; //wireless client index +// UINT32 SuccessRate:16; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16. + UINT32 SuccessRate:13; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16. + UINT32 TxBF:1; + UINT32 Reserve:2; + } field; + UINT32 word; +} TX_STA_FIFO_STRUC, *PTX_STA_FIFO_STRUC; // Debug counter #define TX_AGG_CNT 0x171c -typedef union _TX_AGG_CNT_STRUC { - struct { - USHORT NonAggTxCount; - USHORT AggTxCount; - } field; - UINT32 word; -} TX_AGG_CNT_STRUC, *PTX_AGG_CNT_STRUC; +typedef union _TX_AGG_CNT_STRUC { + struct { + USHORT NonAggTxCount; + USHORT AggTxCount; + } field; + UINT32 word; +} TX_AGG_CNT_STRUC, *PTX_AGG_CNT_STRUC; // Debug counter #define TX_AGG_CNT0 0x1720 -typedef union _TX_AGG_CNT0_STRUC { - struct { - USHORT AggSize1Count; - USHORT AggSize2Count; - } field; - UINT32 word; -} TX_AGG_CNT0_STRUC, *PTX_AGG_CNT0_STRUC; +typedef union _TX_AGG_CNT0_STRUC { + struct { + USHORT AggSize1Count; + USHORT AggSize2Count; + } field; + UINT32 word; +} TX_AGG_CNT0_STRUC, *PTX_AGG_CNT0_STRUC; // Debug counter #define TX_AGG_CNT1 0x1724 -typedef union _TX_AGG_CNT1_STRUC { - struct { - USHORT AggSize3Count; - USHORT AggSize4Count; - } field; - UINT32 word; -} TX_AGG_CNT1_STRUC, *PTX_AGG_CNT1_STRUC; +typedef union _TX_AGG_CNT1_STRUC { + struct { + USHORT AggSize3Count; + USHORT AggSize4Count; + } field; + UINT32 word; +} TX_AGG_CNT1_STRUC, *PTX_AGG_CNT1_STRUC; #define TX_AGG_CNT2 0x1728 -typedef union _TX_AGG_CNT2_STRUC { - struct { - USHORT AggSize5Count; - USHORT AggSize6Count; - } field; - UINT32 word; -} TX_AGG_CNT2_STRUC, *PTX_AGG_CNT2_STRUC; +typedef union _TX_AGG_CNT2_STRUC { + struct { + USHORT AggSize5Count; + USHORT AggSize6Count; + } field; + UINT32 word; +} TX_AGG_CNT2_STRUC, *PTX_AGG_CNT2_STRUC; // Debug counter #define TX_AGG_CNT3 0x172c -typedef union _TX_AGG_CNT3_STRUC { - struct { - USHORT AggSize7Count; - USHORT AggSize8Count; - } field; - UINT32 word; -} TX_AGG_CNT3_STRUC, *PTX_AGG_CNT3_STRUC; +typedef union _TX_AGG_CNT3_STRUC { + struct { + USHORT AggSize7Count; + USHORT AggSize8Count; + } field; + UINT32 word; +} TX_AGG_CNT3_STRUC, *PTX_AGG_CNT3_STRUC; // Debug counter #define TX_AGG_CNT4 0x1730 -typedef union _TX_AGG_CNT4_STRUC { - struct { - USHORT AggSize9Count; - USHORT AggSize10Count; - } field; - UINT32 word; -} TX_AGG_CNT4_STRUC, *PTX_AGG_CNT4_STRUC; +typedef union _TX_AGG_CNT4_STRUC { + struct { + USHORT AggSize9Count; + USHORT AggSize10Count; + } field; + UINT32 word; +} TX_AGG_CNT4_STRUC, *PTX_AGG_CNT4_STRUC; #define TX_AGG_CNT5 0x1734 -typedef union _TX_AGG_CNT5_STRUC { - struct { - USHORT AggSize11Count; - USHORT AggSize12Count; - } field; - UINT32 word; -} TX_AGG_CNT5_STRUC, *PTX_AGG_CNT5_STRUC; +typedef union _TX_AGG_CNT5_STRUC { + struct { + USHORT AggSize11Count; + USHORT AggSize12Count; + } field; + UINT32 word; +} TX_AGG_CNT5_STRUC, *PTX_AGG_CNT5_STRUC; #define TX_AGG_CNT6 0x1738 -typedef union _TX_AGG_CNT6_STRUC { - struct { - USHORT AggSize13Count; - USHORT AggSize14Count; - } field; - UINT32 word; -} TX_AGG_CNT6_STRUC, *PTX_AGG_CNT6_STRUC; +typedef union _TX_AGG_CNT6_STRUC { + struct { + USHORT AggSize13Count; + USHORT AggSize14Count; + } field; + UINT32 word; +} TX_AGG_CNT6_STRUC, *PTX_AGG_CNT6_STRUC; #define TX_AGG_CNT7 0x173c -typedef union _TX_AGG_CNT7_STRUC { - struct { - USHORT AggSize15Count; - USHORT AggSize16Count; - } field; - UINT32 word; -} TX_AGG_CNT7_STRUC, *PTX_AGG_CNT7_STRUC; +typedef union _TX_AGG_CNT7_STRUC { + struct { + USHORT AggSize15Count; + USHORT AggSize16Count; + } field; + UINT32 word; +} TX_AGG_CNT7_STRUC, *PTX_AGG_CNT7_STRUC; #define MPDU_DENSITY_CNT 0x1740 -typedef union _MPDU_DEN_CNT_STRUC { - struct { - USHORT TXZeroDelCount; //TX zero length delimiter count - USHORT RXZeroDelCount; //RX zero length delimiter count - } field; - UINT32 word; -} MPDU_DEN_CNT_STRUC, *PMPDU_DEN_CNT_STRUC; +typedef union _MPDU_DEN_CNT_STRUC { + struct { + USHORT TXZeroDelCount; //TX zero length delimiter count + USHORT RXZeroDelCount; //RX zero length delimiter count + } field; + UINT32 word; +} MPDU_DEN_CNT_STRUC, *PMPDU_DEN_CNT_STRUC; // // TXRX control registers - base address 0x3000 // @@ -974,80 +962,77 @@ typedef union _MPDU_DEN_CNT_STRUC { // // Security key table memory, base address = 0x1000 // -#define MAC_WCID_BASE 0x1800 //8-bytes(use only 6-bytes) * 256 entry = +#define MAC_WCID_BASE 0x1800 //8-bytes(use only 6-bytes) * 256 entry = #define HW_WCID_ENTRY_SIZE 8 -#define PAIRWISE_KEY_TABLE_BASE 0x4000 // 32-byte * 256-entry = -byte +#define PAIRWISE_KEY_TABLE_BASE 0x4000 // 32-byte * 256-entry = -byte #define HW_KEY_ENTRY_SIZE 0x20 -#define PAIRWISE_IVEIV_TABLE_BASE 0x6000 // 8-byte * 256-entry = -byte -#define MAC_IVEIV_TABLE_BASE 0x6000 // 8-byte * 256-entry = -byte +#define PAIRWISE_IVEIV_TABLE_BASE 0x6000 // 8-byte * 256-entry = -byte +#define MAC_IVEIV_TABLE_BASE 0x6000 // 8-byte * 256-entry = -byte #define HW_IVEIV_ENTRY_SIZE 8 -#define MAC_WCID_ATTRIBUTE_BASE 0x6800 // 4-byte * 256-entry = -byte +#define MAC_WCID_ATTRIBUTE_BASE 0x6800 // 4-byte * 256-entry = -byte #define HW_WCID_ATTRI_SIZE 4 #define WCID_RESERVED 0x6bfc -#define SHARED_KEY_TABLE_BASE 0x6c00 // 32-byte * 16-entry = 512-byte -#define SHARED_KEY_MODE_BASE 0x7000 // 32-byte * 16-entry = 512-byte +#define SHARED_KEY_TABLE_BASE 0x6c00 // 32-byte * 16-entry = 512-byte +#define SHARED_KEY_MODE_BASE 0x7000 // 32-byte * 16-entry = 512-byte #define HW_SHARED_KEY_MODE_SIZE 4 #define SHAREDKEYTABLE 0 #define PAIRWISEKEYTABLE 1 - -typedef union _SHAREDKEY_MODE_STRUC { - struct { - UINT32 Bss0Key0CipherAlg:3; - UINT32 :1; - UINT32 Bss0Key1CipherAlg:3; - UINT32 :1; - UINT32 Bss0Key2CipherAlg:3; - UINT32 :1; - UINT32 Bss0Key3CipherAlg:3; - UINT32 :1; - UINT32 Bss1Key0CipherAlg:3; - UINT32 :1; - UINT32 Bss1Key1CipherAlg:3; - UINT32 :1; - UINT32 Bss1Key2CipherAlg:3; - UINT32 :1; - UINT32 Bss1Key3CipherAlg:3; - UINT32 :1; - } field; - UINT32 word; -} SHAREDKEY_MODE_STRUC, *PSHAREDKEY_MODE_STRUC; +typedef union _SHAREDKEY_MODE_STRUC { + struct { + UINT32 Bss0Key0CipherAlg:3; + UINT32:1; + UINT32 Bss0Key1CipherAlg:3; + UINT32:1; + UINT32 Bss0Key2CipherAlg:3; + UINT32:1; + UINT32 Bss0Key3CipherAlg:3; + UINT32:1; + UINT32 Bss1Key0CipherAlg:3; + UINT32:1; + UINT32 Bss1Key1CipherAlg:3; + UINT32:1; + UINT32 Bss1Key2CipherAlg:3; + UINT32:1; + UINT32 Bss1Key3CipherAlg:3; + UINT32:1; + } field; + UINT32 word; +} SHAREDKEY_MODE_STRUC, *PSHAREDKEY_MODE_STRUC; // 64-entry for pairwise key table -typedef struct _HW_WCID_ENTRY { // 8-byte per entry - UCHAR Address[6]; - UCHAR Rsv[2]; +typedef struct _HW_WCID_ENTRY { // 8-byte per entry + UCHAR Address[6]; + UCHAR Rsv[2]; } HW_WCID_ENTRY, PHW_WCID_ENTRY; - // ================================================================================= // WCID format // ================================================================================= -//7.1 WCID ENTRY format : 8bytes -typedef struct _WCID_ENTRY_STRUC { - UCHAR RXBABitmap7; // bit0 for TID8, bit7 for TID 15 - UCHAR RXBABitmap0; // bit0 for TID0, bit7 for TID 7 - UCHAR MAC[6]; // 0 for shared key table. 1 for pairwise key table -} WCID_ENTRY_STRUC, *PWCID_ENTRY_STRUC; - -//8.1.1 SECURITY KEY format : 8DW +//7.1 WCID ENTRY format : 8bytes +typedef struct _WCID_ENTRY_STRUC { + UCHAR RXBABitmap7; // bit0 for TID8, bit7 for TID 15 + UCHAR RXBABitmap0; // bit0 for TID0, bit7 for TID 7 + UCHAR MAC[6]; // 0 for shared key table. 1 for pairwise key table +} WCID_ENTRY_STRUC, *PWCID_ENTRY_STRUC; + +//8.1.1 SECURITY KEY format : 8DW // 32-byte per entry, total 16-entry for shared key table, 64-entry for pairwise key table -typedef struct _HW_KEY_ENTRY { // 32-byte per entry - UCHAR Key[16]; - UCHAR TxMic[8]; - UCHAR RxMic[8]; +typedef struct _HW_KEY_ENTRY { // 32-byte per entry + UCHAR Key[16]; + UCHAR TxMic[8]; + UCHAR RxMic[8]; } HW_KEY_ENTRY, *PHW_KEY_ENTRY; -//8.1.2 IV/EIV format : 2DW - -//8.1.3 RX attribute entry format : 1DW -typedef struct _MAC_ATTRIBUTE_STRUC { - UINT32 KeyTab:1; // 0 for shared key table. 1 for pairwise key table - UINT32 PairKeyMode:3; - UINT32 BSSIDIdx:3; //multipleBSS index for the WCID - UINT32 RXWIUDF:3; - UINT32 rsv:22; -} MAC_ATTRIBUTE_STRUC, *PMAC_ATTRIBUTE_STRUC; +//8.1.2 IV/EIV format : 2DW +//8.1.3 RX attribute entry format : 1DW +typedef struct _MAC_ATTRIBUTE_STRUC { + UINT32 KeyTab:1; // 0 for shared key table. 1 for pairwise key table + UINT32 PairKeyMode:3; + UINT32 BSSIDIdx:3; //multipleBSS index for the WCID + UINT32 RXWIUDF:3; + UINT32 rsv:22; +} MAC_ATTRIBUTE_STRUC, *PMAC_ATTRIBUTE_STRUC; // ================================================================================= // HOST-MCU communication data structure @@ -1056,192 +1041,181 @@ typedef struct _MAC_ATTRIBUTE_STRUC { // // H2M_MAILBOX_CSR: Host-to-MCU Mailbox // -typedef union _H2M_MAILBOX_STRUC { - struct { - UINT32 LowByte:8; - UINT32 HighByte:8; - UINT32 CmdToken:8; - UINT32 Owner:8; - } field; - UINT32 word; +typedef union _H2M_MAILBOX_STRUC { + struct { + UINT32 LowByte:8; + UINT32 HighByte:8; + UINT32 CmdToken:8; + UINT32 Owner:8; + } field; + UINT32 word; } H2M_MAILBOX_STRUC, *PH2M_MAILBOX_STRUC; // // M2H_CMD_DONE_CSR: MCU-to-Host command complete indication // typedef union _M2H_CMD_DONE_STRUC { - struct { - UINT32 CmdToken0; - UINT32 CmdToken1; - UINT32 CmdToken2; - UINT32 CmdToken3; - } field; - UINT32 word; + struct { + UINT32 CmdToken0; + UINT32 CmdToken1; + UINT32 CmdToken2; + UINT32 CmdToken3; + } field; + UINT32 word; } M2H_CMD_DONE_STRUC, *PM2H_CMD_DONE_STRUC; - //NAV_TIME_CFG :NAV -typedef union _NAV_TIME_CFG_STRUC { - struct { - UCHAR Sifs; // in unit of 1-us - UCHAR SlotTime; // in unit of 1-us - USHORT Eifs:9; // in unit of 1-us - USHORT ZeroSifs:1; // Applied zero SIFS timer after OFDM RX 0: disable - USHORT rsv:6; - } field; - UINT32 word; -} NAV_TIME_CFG_STRUC, *PNAV_TIME_CFG_STRUC; - +typedef union _NAV_TIME_CFG_STRUC { + struct { + UCHAR Sifs; // in unit of 1-us + UCHAR SlotTime; // in unit of 1-us + USHORT Eifs:9; // in unit of 1-us + USHORT ZeroSifs:1; // Applied zero SIFS timer after OFDM RX 0: disable + USHORT rsv:6; + } field; + UINT32 word; +} NAV_TIME_CFG_STRUC, *PNAV_TIME_CFG_STRUC; // // RX_FILTR_CFG: /RX configuration register // -typedef union _RX_FILTR_CFG_STRUC { - struct { - UINT32 DropCRCErr:1; // Drop CRC error - UINT32 DropPhyErr:1; // Drop physical error - UINT32 DropNotToMe:1; // Drop not to me unicast frame - UINT32 DropNotMyBSSID:1; // Drop fram ToDs bit is true - - UINT32 DropVerErr:1; // Drop version error frame - UINT32 DropMcast:1; // Drop multicast frames - UINT32 DropBcast:1; // Drop broadcast frames - UINT32 DropDuplicate:1; // Drop duplicate frame +typedef union _RX_FILTR_CFG_STRUC { + struct { + UINT32 DropCRCErr:1; // Drop CRC error + UINT32 DropPhyErr:1; // Drop physical error + UINT32 DropNotToMe:1; // Drop not to me unicast frame + UINT32 DropNotMyBSSID:1; // Drop fram ToDs bit is true - UINT32 DropCFEndAck:1; // Drop Ps-Poll - UINT32 DropCFEnd:1; // Drop Ps-Poll - UINT32 DropAck:1; // Drop Ps-Poll - UINT32 DropCts:1; // Drop Ps-Poll - - UINT32 DropRts:1; // Drop Ps-Poll - UINT32 DropPsPoll:1; // Drop Ps-Poll - UINT32 DropBA:1; // - UINT32 DropBAR:1; // - - UINT32 DropRsvCntlType:1; - UINT32 :15; - } field; - UINT32 word; -} RX_FILTR_CFG_STRUC, *PRX_FILTR_CFG_STRUC; + UINT32 DropVerErr:1; // Drop version error frame + UINT32 DropMcast:1; // Drop multicast frames + UINT32 DropBcast:1; // Drop broadcast frames + UINT32 DropDuplicate:1; // Drop duplicate frame + UINT32 DropCFEndAck:1; // Drop Ps-Poll + UINT32 DropCFEnd:1; // Drop Ps-Poll + UINT32 DropAck:1; // Drop Ps-Poll + UINT32 DropCts:1; // Drop Ps-Poll + UINT32 DropRts:1; // Drop Ps-Poll + UINT32 DropPsPoll:1; // Drop Ps-Poll + UINT32 DropBA:1; // + UINT32 DropBAR:1; // + UINT32 DropRsvCntlType:1; + UINT32:15; + } field; + UINT32 word; +} RX_FILTR_CFG_STRUC, *PRX_FILTR_CFG_STRUC; // // PHY_CSR4: RF serial control register // -typedef union _PHY_CSR4_STRUC { - struct { - UINT32 RFRegValue:24; // Register value (include register id) serial out to RF/IF chip. - UINT32 NumberOfBits:5; // Number of bits used in RFRegValue (I:20, RFMD:22) - UINT32 IFSelect:1; // 1: select IF to program, 0: select RF to program - UINT32 PLL_LD:1; // RF PLL_LD status - UINT32 Busy:1; // 1: ASIC is busy execute RF programming. - } field; - UINT32 word; -} PHY_CSR4_STRUC, *PPHY_CSR4_STRUC; - +typedef union _PHY_CSR4_STRUC { + struct { + UINT32 RFRegValue:24; // Register value (include register id) serial out to RF/IF chip. + UINT32 NumberOfBits:5; // Number of bits used in RFRegValue (I:20, RFMD:22) + UINT32 IFSelect:1; // 1: select IF to program, 0: select RF to program + UINT32 PLL_LD:1; // RF PLL_LD status + UINT32 Busy:1; // 1: ASIC is busy execute RF programming. + } field; + UINT32 word; +} PHY_CSR4_STRUC, *PPHY_CSR4_STRUC; // // SEC_CSR5: shared key table security mode register // -typedef union _SEC_CSR5_STRUC { - struct { - UINT32 Bss2Key0CipherAlg:3; - UINT32 :1; - UINT32 Bss2Key1CipherAlg:3; - UINT32 :1; - UINT32 Bss2Key2CipherAlg:3; - UINT32 :1; - UINT32 Bss2Key3CipherAlg:3; - UINT32 :1; - UINT32 Bss3Key0CipherAlg:3; - UINT32 :1; - UINT32 Bss3Key1CipherAlg:3; - UINT32 :1; - UINT32 Bss3Key2CipherAlg:3; - UINT32 :1; - UINT32 Bss3Key3CipherAlg:3; - UINT32 :1; - } field; - UINT32 word; -} SEC_CSR5_STRUC, *PSEC_CSR5_STRUC; - +typedef union _SEC_CSR5_STRUC { + struct { + UINT32 Bss2Key0CipherAlg:3; + UINT32:1; + UINT32 Bss2Key1CipherAlg:3; + UINT32:1; + UINT32 Bss2Key2CipherAlg:3; + UINT32:1; + UINT32 Bss2Key3CipherAlg:3; + UINT32:1; + UINT32 Bss3Key0CipherAlg:3; + UINT32:1; + UINT32 Bss3Key1CipherAlg:3; + UINT32:1; + UINT32 Bss3Key2CipherAlg:3; + UINT32:1; + UINT32 Bss3Key3CipherAlg:3; + UINT32:1; + } field; + UINT32 word; +} SEC_CSR5_STRUC, *PSEC_CSR5_STRUC; // // HOST_CMD_CSR: For HOST to interrupt embedded processor // -typedef union _HOST_CMD_CSR_STRUC { - struct { - UINT32 HostCommand:8; - UINT32 Rsv:24; - } field; - UINT32 word; -} HOST_CMD_CSR_STRUC, *PHOST_CMD_CSR_STRUC; - +typedef union _HOST_CMD_CSR_STRUC { + struct { + UINT32 HostCommand:8; + UINT32 Rsv:24; + } field; + UINT32 word; +} HOST_CMD_CSR_STRUC, *PHOST_CMD_CSR_STRUC; // // AIFSN_CSR: AIFSN for each EDCA AC // - - // // E2PROM_CSR: EEPROM control register // -typedef union _E2PROM_CSR_STRUC { - struct { - UINT32 Reload:1; // Reload EEPROM content, write one to reload, self-cleared. - UINT32 EepromSK:1; - UINT32 EepromCS:1; - UINT32 EepromDI:1; - UINT32 EepromDO:1; - UINT32 Type:1; // 1: 93C46, 0:93C66 - UINT32 LoadStatus:1; // 1:loading, 0:done - UINT32 Rsvd:25; - } field; - UINT32 word; -} E2PROM_CSR_STRUC, *PE2PROM_CSR_STRUC; +typedef union _E2PROM_CSR_STRUC { + struct { + UINT32 Reload:1; // Reload EEPROM content, write one to reload, self-cleared. + UINT32 EepromSK:1; + UINT32 EepromCS:1; + UINT32 EepromDI:1; + UINT32 EepromDO:1; + UINT32 Type:1; // 1: 93C46, 0:93C66 + UINT32 LoadStatus:1; // 1:loading, 0:done + UINT32 Rsvd:25; + } field; + UINT32 word; +} E2PROM_CSR_STRUC, *PE2PROM_CSR_STRUC; // // QOS_CSR0: TXOP holder address0 register // -typedef union _QOS_CSR0_STRUC { - struct { - UCHAR Byte0; // MAC address byte 0 - UCHAR Byte1; // MAC address byte 1 - UCHAR Byte2; // MAC address byte 2 - UCHAR Byte3; // MAC address byte 3 - } field; - UINT32 word; -} QOS_CSR0_STRUC, *PQOS_CSR0_STRUC; +typedef union _QOS_CSR0_STRUC { + struct { + UCHAR Byte0; // MAC address byte 0 + UCHAR Byte1; // MAC address byte 1 + UCHAR Byte2; // MAC address byte 2 + UCHAR Byte3; // MAC address byte 3 + } field; + UINT32 word; +} QOS_CSR0_STRUC, *PQOS_CSR0_STRUC; // // QOS_CSR1: TXOP holder address1 register // -typedef union _QOS_CSR1_STRUC { - struct { - UCHAR Byte4; // MAC address byte 4 - UCHAR Byte5; // MAC address byte 5 - UCHAR Rsvd0; - UCHAR Rsvd1; - } field; - UINT32 word; -} QOS_CSR1_STRUC, *PQOS_CSR1_STRUC; +typedef union _QOS_CSR1_STRUC { + struct { + UCHAR Byte4; // MAC address byte 4 + UCHAR Byte5; // MAC address byte 5 + UCHAR Rsvd0; + UCHAR Rsvd1; + } field; + UINT32 word; +} QOS_CSR1_STRUC, *PQOS_CSR1_STRUC; #define RF_CSR_CFG 0x500 -typedef union _RF_CSR_CFG_STRUC { - struct { - UINT RF_CSR_DATA:8; // DATA - UINT TESTCSR_RFACC_REGNUM:5; // RF register ID - UINT Rsvd2:3; // Reserved - UINT RF_CSR_WR:1; // 0: read 1: write - UINT RF_CSR_KICK:1; // kick RF register read/write - UINT Rsvd1:14; // Reserved - } field; - UINT word; -} RF_CSR_CFG_STRUC, *PRF_CSR_CFG_STRUC; - +typedef union _RF_CSR_CFG_STRUC { + struct { + UINT RF_CSR_DATA:8; // DATA + UINT TESTCSR_RFACC_REGNUM:5; // RF register ID + UINT Rsvd2:3; // Reserved + UINT RF_CSR_WR:1; // 0: read 1: write + UINT RF_CSR_KICK:1; // kick RF register read/write + UINT Rsvd1:14; // Reserved + } field; + UINT word; +} RF_CSR_CFG_STRUC, *PRF_CSR_CFG_STRUC; // // Other on-chip shared memory space, base = 0x2000 @@ -1258,17 +1232,17 @@ typedef union _RF_CSR_CFG_STRUC { // 2004-11-08 john - since NULL frame won't be that long (256 byte). We steal 16 tail bytes // to save debugging settings -#define HW_DEBUG_SETTING_BASE 0x77f0 // 0x77f0~0x77ff total 16 bytes -#define HW_DEBUG_SETTING_BASE2 0x7770 // 0x77f0~0x77ff total 16 bytes +#define HW_DEBUG_SETTING_BASE 0x77f0 // 0x77f0~0x77ff total 16 bytes +#define HW_DEBUG_SETTING_BASE2 0x7770 // 0x77f0~0x77ff total 16 bytes // In order to support maximum 8 MBSS and its maximum length is 512 for each beacon // Three section discontinue memory segments will be used. // 1. The original region for BCN 0~3 // 2. Extract memory from FCE table for BCN 4~5 // 3. Extract memory from Pair-wise key table for BCN 6~7 -// It occupied those memory of wcid 238~253 for BCN 6 -// and wcid 222~237 for BCN 7 -#define HW_BEACON_MAX_SIZE 0x1000 /* unit: byte */ +// It occupied those memory of wcid 238~253 for BCN 6 +// and wcid 222~237 for BCN 7 +#define HW_BEACON_MAX_SIZE 0x1000 /* unit: byte */ #define HW_BEACON_BASE0 0x7800 #define HW_BEACON_BASE1 0x7A00 #define HW_BEACON_BASE2 0x7C00 @@ -1290,11 +1264,11 @@ typedef union _RF_CSR_CFG_STRUC { #define H2M_INT_SRC 0x7024 #define H2M_BBP_AGENT 0x7028 #define M2H_CMD_DONE_CSR 0x000c -#define MCU_TXOP_ARRAY_BASE 0x000c // TODO: to be provided by Albert -#define MCU_TXOP_ENTRY_SIZE 32 // TODO: to be provided by Albert -#define MAX_NUM_OF_TXOP_ENTRY 16 // TODO: must be same with 8051 firmware -#define MCU_MBOX_VERSION 0x01 // TODO: to be confirmed by Albert -#define MCU_MBOX_VERSION_OFFSET 5 // TODO: to be provided by Albert +#define MCU_TXOP_ARRAY_BASE 0x000c // TODO: to be provided by Albert +#define MCU_TXOP_ENTRY_SIZE 32 // TODO: to be provided by Albert +#define MAX_NUM_OF_TXOP_ENTRY 16 // TODO: must be same with 8051 firmware +#define MCU_MBOX_VERSION 0x01 // TODO: to be confirmed by Albert +#define MCU_MBOX_VERSION_OFFSET 5 // TODO: to be provided by Albert // // Host DMA registers - base address 0x200 . TX0-3=EDCAQid0-3, TX4=HCCA, TX5=MGMT, @@ -1305,10 +1279,8 @@ typedef union _RF_CSR_CFG_STRUC { #define E2PROM_CSR 0x0004 #define IO_CNTL_CSR 0x77d0 - - // ================================================================ -// Tx / Rx / Mgmt ring descriptor definition +// Tx / Rx / Mgmt ring descriptor definition // ================================================================ // the following PID values are used to mark outgoing frame type in TXD->PID so that @@ -1321,8 +1293,8 @@ typedef union _RF_CSR_CFG_STRUC { #define PID_DATA_NO_ACK 0x08 #define PID_DATA_NOT_NORM_ACK 0x03 // value domain of pTxD->HostQId (4-bit: 0~15) -#define QID_AC_BK 1 // meet ACI definition in 802.11e -#define QID_AC_BE 0 // meet ACI definition in 802.11e +#define QID_AC_BK 1 // meet ACI definition in 802.11e +#define QID_AC_BE 0 // meet ACI definition in 802.11e #define QID_AC_VI 2 #define QID_AC_VO 3 #define QID_HCCA 4 diff --git a/drivers/staging/rt2860/chip/rtmp_phy.h b/drivers/staging/rt2860/chip/rtmp_phy.h index 36f438b82150..bbf920d818d8 100644 --- a/drivers/staging/rt2860/chip/rtmp_phy.h +++ b/drivers/staging/rt2860/chip/rtmp_phy.h @@ -38,7 +38,6 @@ #ifndef __RTMP_PHY_H__ #define __RTMP_PHY_H__ - /* RF sections */ @@ -75,31 +74,30 @@ #define RF_R30 30 #define RF_R31 31 - // value domain of pAd->RfIcType -#define RFIC_2820 1 // 2.4G 2T3R -#define RFIC_2850 2 // 2.4G/5G 2T3R -#define RFIC_2720 3 // 2.4G 1T2R -#define RFIC_2750 4 // 2.4G/5G 1T2R -#define RFIC_3020 5 // 2.4G 1T1R -#define RFIC_2020 6 // 2.4G B/G -#define RFIC_3021 7 // 2.4G 1T2R -#define RFIC_3022 8 // 2.4G 2T2R -#define RFIC_3052 9 // 2.4G/5G 2T2R +#define RFIC_2820 1 // 2.4G 2T3R +#define RFIC_2850 2 // 2.4G/5G 2T3R +#define RFIC_2720 3 // 2.4G 1T2R +#define RFIC_2750 4 // 2.4G/5G 1T2R +#define RFIC_3020 5 // 2.4G 1T1R +#define RFIC_2020 6 // 2.4G B/G +#define RFIC_3021 7 // 2.4G 1T2R +#define RFIC_3022 8 // 2.4G 2T2R +#define RFIC_3052 9 // 2.4G/5G 2T2R /* BBP sections */ -#define BBP_R0 0 // version -#define BBP_R1 1 // TSSI -#define BBP_R2 2 // TX configure +#define BBP_R0 0 // version +#define BBP_R1 1 // TSSI +#define BBP_R2 2 // TX configure #define BBP_R3 3 #define BBP_R4 4 #define BBP_R5 5 #define BBP_R6 6 -#define BBP_R14 14 // RX configure +#define BBP_R14 14 // RX configure #define BBP_R16 16 -#define BBP_R17 17 // RX sensibility +#define BBP_R17 17 // RX sensibility #define BBP_R18 18 #define BBP_R21 21 #define BBP_R22 22 @@ -108,12 +106,12 @@ #define BBP_R26 26 #define BBP_R27 27 #define BBP_R31 31 -#define BBP_R49 49 //TSSI +#define BBP_R49 49 //TSSI #define BBP_R50 50 #define BBP_R51 51 #define BBP_R52 52 #define BBP_R55 55 -#define BBP_R62 62 // Rx SQ0 Threshold HIGH +#define BBP_R62 62 // Rx SQ0 Threshold HIGH #define BBP_R63 63 #define BBP_R64 64 #define BBP_R65 65 @@ -121,7 +119,7 @@ #define BBP_R67 67 #define BBP_R68 68 #define BBP_R69 69 -#define BBP_R70 70 // Rx AGC SQ CCK Xcorr threshold +#define BBP_R70 70 // Rx AGC SQ CCK Xcorr threshold #define BBP_R73 73 #define BBP_R75 75 #define BBP_R77 77 @@ -135,7 +133,7 @@ #define BBP_R86 86 #define BBP_R91 91 #define BBP_R92 92 -#define BBP_R94 94 // Tx Gain Control +#define BBP_R94 94 // Tx Gain Control #define BBP_R103 103 #define BBP_R105 105 #define BBP_R106 106 @@ -151,16 +149,16 @@ #define BBP_R122 122 #define BBP_R123 123 #ifdef RT30xx -#define BBP_R138 138 // add by johnli, RF power sequence setup, ADC dynamic on/off control +#define BBP_R138 138 // add by johnli, RF power sequence setup, ADC dynamic on/off control #endif // RT30xx // -#define BBPR94_DEFAULT 0x06 // Add 1 value will gain 1db +#define BBPR94_DEFAULT 0x06 // Add 1 value will gain 1db // // BBP & RF are using indirect access. Before write any value into it. // We have to make sure there is no outstanding command pending via checking busy bit. // -#define MAX_BUSY_COUNT 100 // Number of retry before failing access BBP & RF indirect register +#define MAX_BUSY_COUNT 100 // Number of retry before failing access BBP & RF indirect register //#define PHY_TR_SWITCH_TIME 5 // usec @@ -416,7 +414,6 @@ } \ }while(0) - /* This marco used for the BBP write operation which didn't need via MCU. */ @@ -539,7 +536,6 @@ RTMP_IO_WRITE32(_pAd, 0x1210, _macData); \ }while(0) - #define RTMP_ASIC_MMPS_ENABLE(_pAd) \ do{ \ UINT32 _macData; \ diff --git a/drivers/staging/rt2860/chlist.h b/drivers/staging/rt2860/chlist.h index 9ce915415462..e3d55b429fbc 100644 --- a/drivers/staging/rt2860/chlist.h +++ b/drivers/staging/rt2860/chlist.h @@ -41,7 +41,6 @@ #include "rtmp_type.h" #include "rtmp_def.h" - #define ODOR 0 #define IDOR 1 #define BOTH 2 @@ -53,28 +52,27 @@ typedef struct _CH_DESP { UCHAR FirstChannel; UCHAR NumOfCh; - CHAR MaxTxPwr; // dBm - UCHAR Geography; // 0:out door, 1:in door, 2:both - BOOLEAN DfsReq; // Dfs require, 0: No, 1: yes. + CHAR MaxTxPwr; // dBm + UCHAR Geography; // 0:out door, 1:in door, 2:both + BOOLEAN DfsReq; // Dfs require, 0: No, 1: yes. } CH_DESP, *PCH_DESP; typedef struct _CH_REGION { UCHAR CountReg[3]; - UCHAR DfsType; // 0: CE, 1: FCC, 2: JAP, 3:JAP_W53, JAP_W56 + UCHAR DfsType; // 0: CE, 1: FCC, 2: JAP, 3:JAP_W53, JAP_W56 CH_DESP ChDesp[10]; } CH_REGION, *PCH_REGION; extern CH_REGION ChRegion[]; -typedef struct _CH_FREQ_MAP_{ - UINT16 channel; - UINT16 freqKHz; -}CH_FREQ_MAP; +typedef struct _CH_FREQ_MAP_ { + UINT16 channel; + UINT16 freqKHz; +} CH_FREQ_MAP; extern CH_FREQ_MAP CH_HZ_ID_MAP[]; extern int CH_HZ_ID_MAP_NUM; - #define MAP_CHANNEL_ID_TO_KHZ(_ch, _khz) \ do{ \ int _chIdx; \ @@ -105,24 +103,15 @@ extern int CH_HZ_ID_MAP_NUM; (_ch) = 1; \ }while(0) +VOID BuildChannelListEx(IN PRTMP_ADAPTER pAd); -VOID BuildChannelListEx( - IN PRTMP_ADAPTER pAd); +VOID BuildBeaconChList(IN PRTMP_ADAPTER pAd, + OUT PUCHAR pBuf, OUT PULONG pBufLen); -VOID BuildBeaconChList( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf, - OUT PULONG pBufLen); +VOID N_ChannelCheck(IN PRTMP_ADAPTER pAd); -VOID N_ChannelCheck( - IN PRTMP_ADAPTER pAd); +VOID N_SetCenCh(IN PRTMP_ADAPTER pAd); -VOID N_SetCenCh( - IN PRTMP_ADAPTER pAd); - -UINT8 GetCuntryMaxTxPwr( - IN PRTMP_ADAPTER pAd, - IN UINT8 channel); +UINT8 GetCuntryMaxTxPwr(IN PRTMP_ADAPTER pAd, IN UINT8 channel); #endif // __CHLIST_H__ - diff --git a/drivers/staging/rt2860/common/action.h b/drivers/staging/rt2860/common/action.h index cfc2a5f8d1aa..2484c2ebf51f 100644 --- a/drivers/staging/rt2860/common/action.h +++ b/drivers/staging/rt2860/common/action.h @@ -39,23 +39,18 @@ #ifndef __ACTION_H__ #define __ACTION_H__ -typedef struct PACKED __HT_INFO_OCTET -{ - UCHAR Request:1; - UCHAR Forty_MHz_Intolerant:1; - UCHAR STA_Channel_Width:1; - UCHAR Reserved:5; +typedef struct PACKED __HT_INFO_OCTET { + UCHAR Request:1; + UCHAR Forty_MHz_Intolerant:1; + UCHAR STA_Channel_Width:1; + UCHAR Reserved:5; } HT_INFORMATION_OCTET; - -typedef struct PACKED __FRAME_HT_INFO -{ - HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; - HT_INFORMATION_OCTET HT_Info; -} FRAME_HT_INFO, *PFRAME_HT_INFO; +typedef struct PACKED __FRAME_HT_INFO { + HEADER_802_11 Hdr; + UCHAR Category; + UCHAR Action; + HT_INFORMATION_OCTET HT_Info; +} FRAME_HT_INFO, *PFRAME_HT_INFO; #endif /* __ACTION_H__ */ - - diff --git a/drivers/staging/rt2860/crypt_hmac.h b/drivers/staging/rt2860/crypt_hmac.h index 717b8a26fd12..6211640001c6 100644 --- a/drivers/staging/rt2860/crypt_hmac.h +++ b/drivers/staging/rt2860/crypt_hmac.h @@ -48,24 +48,18 @@ #ifdef SHA1_SUPPORT #define HMAC_SHA1_SUPPORT -VOID HMAC_SHA1 ( - IN const UINT8 Key[], - IN UINT KeyLen, - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 MAC[], - IN UINT MACLen); +VOID HMAC_SHA1(IN const UINT8 Key[], + IN UINT KeyLen, + IN const UINT8 Message[], + IN UINT MessageLen, OUT UINT8 MAC[], IN UINT MACLen); #endif /* SHA1_SUPPORT */ #ifdef MD5_SUPPORT #define HMAC_MD5_SUPPORT -VOID HMAC_MD5 ( - IN const UINT8 Key[], - IN UINT KeyLen, - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 MAC[], - IN UINT MACLen); +VOID HMAC_MD5(IN const UINT8 Key[], + IN UINT KeyLen, + IN const UINT8 Message[], + IN UINT MessageLen, OUT UINT8 MAC[], IN UINT MACLen); #endif /* MD5_SUPPORT */ #endif /* __CRYPT_HMAC_H__ */ diff --git a/drivers/staging/rt2860/crypt_md5.h b/drivers/staging/rt2860/crypt_md5.h index 66ae42466cea..ecc67e47ef0c 100644 --- a/drivers/staging/rt2860/crypt_md5.h +++ b/drivers/staging/rt2860/crypt_md5.h @@ -51,30 +51,22 @@ #define MD5_SUPPORT #ifdef MD5_SUPPORT -#define MD5_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ -#define MD5_DIGEST_SIZE 16 /* 128 bits = 16 bytes */ +#define MD5_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ +#define MD5_DIGEST_SIZE 16 /* 128 bits = 16 bytes */ typedef struct { - UINT32 HashValue[4]; - UINT64 MessageLen; - UINT8 Block[MD5_BLOCK_SIZE]; - UINT BlockLen; + UINT32 HashValue[4]; + UINT64 MessageLen; + UINT8 Block[MD5_BLOCK_SIZE]; + UINT BlockLen; } MD5_CTX_STRUC, *PMD5_CTX_STRUC; -VOID MD5_Init ( - IN MD5_CTX_STRUC *pMD5_CTX); -VOID MD5_Hash ( - IN MD5_CTX_STRUC *pMD5_CTX); -VOID MD5_Append ( - IN MD5_CTX_STRUC *pMD5_CTX, - IN const UINT8 Message[], - IN UINT MessageLen); -VOID MD5_End ( - IN MD5_CTX_STRUC *pMD5_CTX, - OUT UINT8 DigestMessage[]); -VOID RT_MD5 ( - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 DigestMessage[]); +VOID MD5_Init(IN MD5_CTX_STRUC * pMD5_CTX); +VOID MD5_Hash(IN MD5_CTX_STRUC * pMD5_CTX); +VOID MD5_Append(IN MD5_CTX_STRUC * pMD5_CTX, + IN const UINT8 Message[], IN UINT MessageLen); +VOID MD5_End(IN MD5_CTX_STRUC * pMD5_CTX, OUT UINT8 DigestMessage[]); +VOID RT_MD5(IN const UINT8 Message[], + IN UINT MessageLen, OUT UINT8 DigestMessage[]); #endif /* MD5_SUPPORT */ #endif /* __CRYPT_MD5_H__ */ diff --git a/drivers/staging/rt2860/crypt_sha2.h b/drivers/staging/rt2860/crypt_sha2.h index 5b95965e4d14..33d999d70079 100644 --- a/drivers/staging/rt2860/crypt_sha2.h +++ b/drivers/staging/rt2860/crypt_sha2.h @@ -52,30 +52,22 @@ #define SHA1_SUPPORT #ifdef SHA1_SUPPORT -#define SHA1_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ -#define SHA1_DIGEST_SIZE 20 /* 160 bits = 20 bytes */ +#define SHA1_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ +#define SHA1_DIGEST_SIZE 20 /* 160 bits = 20 bytes */ typedef struct _SHA1_CTX_STRUC { - UINT32 HashValue[5]; /* 5 = (SHA1_DIGEST_SIZE / 32) */ - UINT64 MessageLen; /* total size */ - UINT8 Block[SHA1_BLOCK_SIZE]; - UINT BlockLen; + UINT32 HashValue[5]; /* 5 = (SHA1_DIGEST_SIZE / 32) */ + UINT64 MessageLen; /* total size */ + UINT8 Block[SHA1_BLOCK_SIZE]; + UINT BlockLen; } SHA1_CTX_STRUC, *PSHA1_CTX_STRUC; -VOID RT_SHA1_Init ( - IN SHA1_CTX_STRUC *pSHA_CTX); -VOID SHA1_Hash ( - IN SHA1_CTX_STRUC *pSHA_CTX); -VOID SHA1_Append ( - IN SHA1_CTX_STRUC *pSHA_CTX, - IN const UINT8 Message[], - IN UINT MessageLen); -VOID SHA1_End ( - IN SHA1_CTX_STRUC *pSHA_CTX, - OUT UINT8 DigestMessage[]); -VOID RT_SHA1 ( - IN const UINT8 Message[], - IN UINT MessageLen, - OUT UINT8 DigestMessage[]); +VOID RT_SHA1_Init(IN SHA1_CTX_STRUC * pSHA_CTX); +VOID SHA1_Hash(IN SHA1_CTX_STRUC * pSHA_CTX); +VOID SHA1_Append(IN SHA1_CTX_STRUC * pSHA_CTX, + IN const UINT8 Message[], IN UINT MessageLen); +VOID SHA1_End(IN SHA1_CTX_STRUC * pSHA_CTX, OUT UINT8 DigestMessage[]); +VOID RT_SHA1(IN const UINT8 Message[], + IN UINT MessageLen, OUT UINT8 DigestMessage[]); #endif /* SHA1_SUPPORT */ #endif /* __CRYPT_SHA2_H__ */ diff --git a/drivers/staging/rt2860/dfs.h b/drivers/staging/rt2860/dfs.h index 9ab445c736df..9e5e74d6783c 100644 --- a/drivers/staging/rt2860/dfs.h +++ b/drivers/staging/rt2860/dfs.h @@ -36,6 +36,4 @@ Fonchi 03-12-2007 created */ -BOOLEAN RadarChannelCheck( - IN PRTMP_ADAPTER pAd, - IN UCHAR Ch); +BOOLEAN RadarChannelCheck(IN PRTMP_ADAPTER pAd, IN UCHAR Ch); diff --git a/drivers/staging/rt2860/eeprom.h b/drivers/staging/rt2860/eeprom.h index 9979fef97b02..56aa58300c7b 100644 --- a/drivers/staging/rt2860/eeprom.h +++ b/drivers/staging/rt2860/eeprom.h @@ -24,7 +24,6 @@ * * ************************************************************************* - Module Name: eeprom.h @@ -38,41 +37,31 @@ #ifndef __EEPROM_H__ #define __EEPROM_H__ - - #ifdef RTMP_PCI_SUPPORT /************************************************************************* * Public function declarations for prom-based chipset ************************************************************************/ -int rtmp_ee_prom_read16( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - OUT USHORT *pValue); +int rtmp_ee_prom_read16(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, OUT USHORT * pValue); #endif // RTMP_PCI_SUPPORT // #ifdef RTMP_USB_SUPPORT /************************************************************************* * Public function declarations for usb-based prom chipset ************************************************************************/ -NTSTATUS RTUSBReadEEPROM16( - IN PRTMP_ADAPTER pAd, - IN USHORT offset, - OUT PUSHORT pData); +NTSTATUS RTUSBReadEEPROM16(IN PRTMP_ADAPTER pAd, + IN USHORT offset, OUT PUSHORT pData); #endif // RTMP_USB_SUPPORT // #ifdef RT30xx #ifdef RTMP_EFUSE_SUPPORT -int rtmp_ee_efuse_read16( - IN RTMP_ADAPTER *pAd, - IN USHORT Offset, - OUT USHORT *pValue); +int rtmp_ee_efuse_read16(IN RTMP_ADAPTER * pAd, + IN USHORT Offset, OUT USHORT * pValue); #endif // RTMP_EFUSE_SUPPORT // #endif // RT30xx // /************************************************************************* * Public function declarations for prom operation callback functions setting ************************************************************************/ -INT RtmpChipOpsEepromHook( - IN RTMP_ADAPTER *pAd, - IN INT infType); +INT RtmpChipOpsEepromHook(IN RTMP_ADAPTER * pAd, IN INT infType); #endif // __EEPROM_H__ // diff --git a/drivers/staging/rt2860/iface/rtmp_pci.h b/drivers/staging/rt2860/iface/rtmp_pci.h index 7d7efbd9e272..4f42158321ce 100644 --- a/drivers/staging/rt2860/iface/rtmp_pci.h +++ b/drivers/staging/rt2860/iface/rtmp_pci.h @@ -31,7 +31,6 @@ #define RT28XX_HANDLE_DEV_ASSIGN(handle, dev_p) \ ((POS_COOKIE)handle)->pci_dev = dev_p; - #ifdef LINUX // set driver data #define RT28XX_DRVDATA_SET(_a) pci_set_drvdata(_a, net_dev); @@ -64,7 +63,6 @@ pci_resource_len(dev_p, 0)); } \ if (net_dev->irq) pci_release_regions(dev_p); } - #define PCI_REG_READ_WORD(pci_dev, offset, Configuration) \ if (pci_read_config_word(pci_dev, offset, ®16) == 0) \ Configuration = le2cpu16(reg16); \ @@ -77,5 +75,4 @@ #endif // LINUX // - #endif // __RTMP_PCI_H__ // diff --git a/drivers/staging/rt2860/iface/rtmp_usb.h b/drivers/staging/rt2860/iface/rtmp_usb.h index 2e9165effb99..26591b000b08 100644 --- a/drivers/staging/rt2860/iface/rtmp_usb.h +++ b/drivers/staging/rt2860/iface/rtmp_usb.h @@ -28,28 +28,24 @@ #ifndef __RTMP_USB_H__ #define __RTMP_USB_H__ - #include "../rtusb_io.h" - #ifdef LINUX #include -typedef struct usb_device * PUSB_DEV; +typedef struct usb_device *PUSB_DEV; typedef struct urb *purbb_t; typedef struct usb_ctrlrequest devctrlrequest; #endif // LINUX // extern UCHAR EpToQueue[6]; - #define RXBULKAGGRE_ZISE 12 #define MAX_TXBULK_LIMIT (LOCAL_TXBUF_SIZE*(BULKAGGRE_ZISE-1)) #define MAX_TXBULK_SIZE (LOCAL_TXBUF_SIZE*BULKAGGRE_ZISE) #define MAX_RXBULK_SIZE (LOCAL_TXBUF_SIZE*RXBULKAGGRE_ZISE) #define MAX_MLME_HANDLER_MEMORY 20 - // Flags for Bulkflags control for bulk out data // #define fRTUSB_BULK_OUT_DATA_NULL 0x00000001 @@ -69,7 +65,6 @@ extern UCHAR EpToQueue[6]; // TODO:move to ./ate/include/iface/ate_usb.h - #define FREE_HTTX_RING(_pCookie, _pipeId, _txContext) \ { \ if ((_txContext)->ENextBulkOutPosition == (_txContext)->CurWritePosition) \ @@ -79,8 +74,6 @@ extern UCHAR EpToQueue[6]; /*NdisInterlockedDecrement(&(_p)->TxCount); */\ } - - /****************************************************************************** USB Bulk operation related definitions @@ -100,7 +93,7 @@ extern UCHAR EpToQueue[6]; // unlink urb #define RTUSB_UNLINK_URB(pUrb) usb_kill_urb(pUrb) -extern void dump_urb(struct urb* purb); +extern void dump_urb(struct urb *purb); #define InterlockedIncrement atomic_inc #define NdisInterlockedIncrement atomic_inc @@ -110,12 +103,8 @@ extern void dump_urb(struct urb* purb); #endif // LINUX // - - #define NT_SUCCESS(status) (((status) >=0) ? (TRUE):(FALSE)) - - #define USBD_TRANSFER_DIRECTION_OUT 0 #define USBD_TRANSFER_DIRECTION_IN 0 #define USBD_SHORT_TRANSFER_OK 0 @@ -131,7 +120,6 @@ extern void dump_urb(struct urb* purb); #define CONTROL_TIMEOUT_JIFFIES ( (100 * OS_HZ) / 1000) #define UNLINK_TIMEOUT_MS 3 - VOID RTUSBBulkOutDataPacketComplete(purbb_t purb, struct pt_regs *pt_regs); VOID RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs *pt_regs); VOID RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs); @@ -139,7 +127,6 @@ VOID RTUSBBulkOutRTSFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs); VOID RTUSBBulkOutPsPollComplete(purbb_t pUrb, struct pt_regs *pt_regs); VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs); - #ifdef KTHREAD_SUPPORT #define RTUSBMlmeUp(pAd) \ do{ \ @@ -196,5 +183,4 @@ VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs); #define RTMP_IRQ_REQUEST(net_dev) do{}while(0) #define RTMP_IRQ_RELEASE(net_dev) do{}while(0) - #endif // __RTMP_USB_H__ // diff --git a/drivers/staging/rt2860/mlme.h b/drivers/staging/rt2860/mlme.h index f609ea5660a1..cb3cc9bbc1f4 100644 --- a/drivers/staging/rt2860/mlme.h +++ b/drivers/staging/rt2860/mlme.h @@ -41,18 +41,16 @@ #include "rtmp_dot11.h" - - // maximum supported capability information - // ESS, IBSS, Privacy, Short Preamble, Spectrum mgmt, Short Slot #define SUPPORTED_CAPABILITY_INFO 0x0533 #define END_OF_ARGS -1 #define LFSR_MASK 0x80000057 -#define MLME_TASK_EXEC_INTV 100/*200*/ // +#define MLME_TASK_EXEC_INTV 100/*200*/ // #define LEAD_TIME 5 -#define MLME_TASK_EXEC_MULTIPLE 10 /*5*/ // MLME_TASK_EXEC_MULTIPLE * MLME_TASK_EXEC_INTV = 1 sec -#define REORDER_EXEC_INTV 100 // 0.1 sec +#define MLME_TASK_EXEC_MULTIPLE 10 /*5*/ // MLME_TASK_EXEC_MULTIPLE * MLME_TASK_EXEC_INTV = 1 sec +#define REORDER_EXEC_INTV 100 // 0.1 sec // The definition of Radar detection duration region #define CE 0 @@ -62,34 +60,32 @@ #define JAP_W56 4 #define MAX_RD_REGION 5 -#define BEACON_LOST_TIME 4 * OS_HZ // 2048 msec = 2 sec - -#define DLS_TIMEOUT 1200 // unit: msec -#define AUTH_TIMEOUT 300 // unit: msec -#define ASSOC_TIMEOUT 300 // unit: msec -#define JOIN_TIMEOUT 2000 // unit: msec -#define SHORT_CHANNEL_TIME 90 // unit: msec -#define MIN_CHANNEL_TIME 110 // unit: msec, for dual band scan -#define MAX_CHANNEL_TIME 140 // unit: msec, for single band scan -#define FAST_ACTIVE_SCAN_TIME 30 // Active scan waiting for probe response time -#define CW_MIN_IN_BITS 4 // actual CwMin = 2^CW_MIN_IN_BITS - 1 -#define LINK_DOWN_TIMEOUT 20000 // unit: msec -#define AUTO_WAKEUP_TIMEOUT 70 //unit: msec +#define BEACON_LOST_TIME 4 * OS_HZ // 2048 msec = 2 sec +#define DLS_TIMEOUT 1200 // unit: msec +#define AUTH_TIMEOUT 300 // unit: msec +#define ASSOC_TIMEOUT 300 // unit: msec +#define JOIN_TIMEOUT 2000 // unit: msec +#define SHORT_CHANNEL_TIME 90 // unit: msec +#define MIN_CHANNEL_TIME 110 // unit: msec, for dual band scan +#define MAX_CHANNEL_TIME 140 // unit: msec, for single band scan +#define FAST_ACTIVE_SCAN_TIME 30 // Active scan waiting for probe response time +#define CW_MIN_IN_BITS 4 // actual CwMin = 2^CW_MIN_IN_BITS - 1 +#define LINK_DOWN_TIMEOUT 20000 // unit: msec +#define AUTO_WAKEUP_TIMEOUT 70 //unit: msec -#define CW_MAX_IN_BITS 10 // actual CwMax = 2^CW_MAX_IN_BITS - 1 - +#define CW_MAX_IN_BITS 10 // actual CwMax = 2^CW_MAX_IN_BITS - 1 // Note: RSSI_TO_DBM_OFFSET has been changed to variable for new RF (2004-0720). // SHould not refer to this constant anymore //#define RSSI_TO_DBM_OFFSET 120 // for RT2530 RSSI-115 = dBm -#define RSSI_FOR_MID_TX_POWER -55 // -55 db is considered mid-distance -#define RSSI_FOR_LOW_TX_POWER -45 // -45 db is considered very short distance and - // eligible to use a lower TX power +#define RSSI_FOR_MID_TX_POWER -55 // -55 db is considered mid-distance +#define RSSI_FOR_LOW_TX_POWER -45 // -45 db is considered very short distance and + // eligible to use a lower TX power #define RSSI_FOR_LOWEST_TX_POWER -30 //#define MID_TX_POWER_DELTA 0 // 0 db from full TX power upon mid-distance to AP -#define LOW_TX_POWER_DELTA 6 // -3 db from full TX power upon very short distance. 1 grade is 0.5 db -#define LOWEST_TX_POWER_DELTA 16 // -8 db from full TX power upon shortest distance. 1 grade is 0.5 db +#define LOW_TX_POWER_DELTA 6 // -3 db from full TX power upon very short distance. 1 grade is 0.5 db +#define LOWEST_TX_POWER_DELTA 16 // -8 db from full TX power upon shortest distance. 1 grade is 0.5 db #define RSSI_TRIGGERED_UPON_BELOW_THRESHOLD 0 #define RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD 1 @@ -99,7 +95,7 @@ // Channel Quality Indication #define CQI_IS_GOOD(cqi) ((cqi) >= 50) //#define CQI_IS_FAIR(cqi) (((cqi) >= 20) && ((cqi) < 50)) -#define CQI_IS_POOR(cqi) (cqi < 50) //(((cqi) >= 5) && ((cqi) < 20)) +#define CQI_IS_POOR(cqi) (cqi < 50) //(((cqi) >= 5) && ((cqi) < 20)) #define CQI_IS_BAD(cqi) (cqi < 5) #define CQI_IS_DEAD(cqi) (cqi == 0) @@ -110,15 +106,15 @@ #define BSS_NOT_FOUND 0xFFFFFFFF -#define MAX_LEN_OF_MLME_QUEUE 40 //10 +#define MAX_LEN_OF_MLME_QUEUE 40 //10 -#define SCAN_PASSIVE 18 // scan with no probe request, only wait beacon and probe response -#define SCAN_ACTIVE 19 // scan with probe request, and wait beacon and probe response -#define SCAN_CISCO_PASSIVE 20 // Single channel passive scan -#define SCAN_CISCO_ACTIVE 21 // Single channel active scan -#define SCAN_CISCO_NOISE 22 // Single channel passive scan for noise histogram collection -#define SCAN_CISCO_CHANNEL_LOAD 23 // Single channel passive scan for channel load collection -#define FAST_SCAN_ACTIVE 24 // scan with probe request, and wait beacon and probe response +#define SCAN_PASSIVE 18 // scan with no probe request, only wait beacon and probe response +#define SCAN_ACTIVE 19 // scan with probe request, and wait beacon and probe response +#define SCAN_CISCO_PASSIVE 20 // Single channel passive scan +#define SCAN_CISCO_ACTIVE 21 // Single channel active scan +#define SCAN_CISCO_NOISE 22 // Single channel passive scan for noise histogram collection +#define SCAN_CISCO_CHANNEL_LOAD 23 // Single channel passive scan for channel load collection +#define FAST_SCAN_ACTIVE 24 // scan with probe request, and wait beacon and probe response #define MAC_ADDR_IS_GROUP(Addr) (((Addr[0]) & 0x01)) #define MAC_ADDR_HASH(Addr) (Addr[0] ^ Addr[1] ^ Addr[2] ^ Addr[3] ^ Addr[4] ^ Addr[5]) @@ -141,21 +137,21 @@ #define CAP_IS_SHORT_PREAMBLE_ON(x) (((x) & 0x0020) != 0) #define CAP_IS_PBCC_ON(x) (((x) & 0x0040) != 0) #define CAP_IS_AGILITY_ON(x) (((x) & 0x0080) != 0) -#define CAP_IS_SPECTRUM_MGMT(x) (((x) & 0x0100) != 0) // 802.11e d9 -#define CAP_IS_QOS(x) (((x) & 0x0200) != 0) // 802.11e d9 +#define CAP_IS_SPECTRUM_MGMT(x) (((x) & 0x0100) != 0) // 802.11e d9 +#define CAP_IS_QOS(x) (((x) & 0x0200) != 0) // 802.11e d9 #define CAP_IS_SHORT_SLOT(x) (((x) & 0x0400) != 0) -#define CAP_IS_APSD(x) (((x) & 0x0800) != 0) // 802.11e d9 -#define CAP_IS_IMMED_BA(x) (((x) & 0x1000) != 0) // 802.11e d9 +#define CAP_IS_APSD(x) (((x) & 0x0800) != 0) // 802.11e d9 +#define CAP_IS_IMMED_BA(x) (((x) & 0x1000) != 0) // 802.11e d9 #define CAP_IS_DSSS_OFDM(x) (((x) & 0x2000) != 0) -#define CAP_IS_DELAY_BA(x) (((x) & 0x4000) != 0) // 802.11e d9 +#define CAP_IS_DELAY_BA(x) (((x) & 0x4000) != 0) // 802.11e d9 #define CAP_GENERATE(ess,ibss,priv,s_pre,s_slot,spectrum) (((ess) ? 0x0001 : 0x0000) | ((ibss) ? 0x0002 : 0x0000) | ((priv) ? 0x0010 : 0x0000) | ((s_pre) ? 0x0020 : 0x0000) | ((s_slot) ? 0x0400 : 0x0000) | ((spectrum) ? 0x0100 : 0x0000)) -#define ERP_IS_NON_ERP_PRESENT(x) (((x) & 0x01) != 0) // 802.11g -#define ERP_IS_USE_PROTECTION(x) (((x) & 0x02) != 0) // 802.11g -#define ERP_IS_USE_BARKER_PREAMBLE(x) (((x) & 0x04) != 0) // 802.11g +#define ERP_IS_NON_ERP_PRESENT(x) (((x) & 0x01) != 0) // 802.11g +#define ERP_IS_USE_PROTECTION(x) (((x) & 0x02) != 0) // 802.11g +#define ERP_IS_USE_BARKER_PREAMBLE(x) (((x) & 0x04) != 0) // 802.11g -#define DRS_TX_QUALITY_WORST_BOUND 8// 3 // just test by gary +#define DRS_TX_QUALITY_WORST_BOUND 8 // 3 // just test by gary #define DRS_PENALTY 8 #define BA_NOTUSE 2 @@ -192,500 +188,485 @@ if (((__pEntry)) != NULL) \ // // HT Capability INFO field in HT Cap IE . typedef struct PACKED { - USHORT AdvCoding:1; - USHORT ChannelWidth:1; - USHORT MimoPs:2;//momi power safe - USHORT GF:1; //green field - USHORT ShortGIfor20:1; - USHORT ShortGIfor40:1; //for40MHz - USHORT TxSTBC:1; - USHORT RxSTBC:2; - USHORT DelayedBA:1; //rt2860c not support - USHORT AMsduSize:1; // only support as zero - USHORT CCKmodein40:1; - USHORT PSMP:1; - USHORT Forty_Mhz_Intolerant:1; - USHORT LSIGTxopProSup:1; + USHORT AdvCoding:1; + USHORT ChannelWidth:1; + USHORT MimoPs:2; //momi power safe + USHORT GF:1; //green field + USHORT ShortGIfor20:1; + USHORT ShortGIfor40:1; //for40MHz + USHORT TxSTBC:1; + USHORT RxSTBC:2; + USHORT DelayedBA:1; //rt2860c not support + USHORT AMsduSize:1; // only support as zero + USHORT CCKmodein40:1; + USHORT PSMP:1; + USHORT Forty_Mhz_Intolerant:1; + USHORT LSIGTxopProSup:1; } HT_CAP_INFO, *PHT_CAP_INFO; // HT Capability INFO field in HT Cap IE . typedef struct PACKED { - UCHAR MaxRAmpduFactor:2; - UCHAR MpduDensity:3; - UCHAR rsv:3;//momi power safe + UCHAR MaxRAmpduFactor:2; + UCHAR MpduDensity:3; + UCHAR rsv:3; //momi power safe } HT_CAP_PARM, *PHT_CAP_PARM; // HT Capability INFO field in HT Cap IE . typedef struct PACKED { - UCHAR MCSSet[10]; - UCHAR SupRate[2]; // unit : 1Mbps - UCHAR TxMCSSetDefined:1; - UCHAR TxRxNotEqual:1; - UCHAR TxStream:2; - UCHAR MpduDensity:1; - UCHAR rsv:3; - UCHAR rsv3[3]; + UCHAR MCSSet[10]; + UCHAR SupRate[2]; // unit : 1Mbps + UCHAR TxMCSSetDefined:1; + UCHAR TxRxNotEqual:1; + UCHAR TxStream:2; + UCHAR MpduDensity:1; + UCHAR rsv:3; + UCHAR rsv3[3]; } HT_MCS_SET, *PHT_MCS_SET; // HT Capability INFO field in HT Cap IE . typedef struct PACKED { - USHORT Pco:1; - USHORT TranTime:2; - USHORT rsv:5;//momi power safe - USHORT MCSFeedback:2; //0:no MCS feedback, 2:unsolicited MCS feedback, 3:Full MCS feedback, 1:rsv. - USHORT PlusHTC:1; //+HTC control field support - USHORT RDGSupport:1; //reverse Direction Grant support - USHORT rsv2:4; + USHORT Pco:1; + USHORT TranTime:2; + USHORT rsv:5; //momi power safe + USHORT MCSFeedback:2; //0:no MCS feedback, 2:unsolicited MCS feedback, 3:Full MCS feedback, 1:rsv. + USHORT PlusHTC:1; //+HTC control field support + USHORT RDGSupport:1; //reverse Direction Grant support + USHORT rsv2:4; } EXT_HT_CAP_INFO, *PEXT_HT_CAP_INFO; // HT Beamforming field in HT Cap IE . -typedef struct PACKED _HT_BF_CAP{ - ULONG TxBFRecCapable:1; - ULONG RxSoundCapable:1; - ULONG TxSoundCapable:1; - ULONG RxNDPCapable:1; - ULONG TxNDPCapable:1; - ULONG ImpTxBFCapable:1; - ULONG Calibration:2; - ULONG ExpCSICapable:1; - ULONG ExpNoComSteerCapable:1; - ULONG ExpComSteerCapable:1; - ULONG ExpCSIFbk:2; - ULONG ExpNoComBF:2; - ULONG ExpComBF:2; - ULONG MinGrouping:2; - ULONG CSIBFAntSup:2; - ULONG NoComSteerBFAntSup:2; - ULONG ComSteerBFAntSup:2; - ULONG CSIRowBFSup:2; - ULONG ChanEstimation:2; - ULONG rsv:3; +typedef struct PACKED _HT_BF_CAP { + ULONG TxBFRecCapable:1; + ULONG RxSoundCapable:1; + ULONG TxSoundCapable:1; + ULONG RxNDPCapable:1; + ULONG TxNDPCapable:1; + ULONG ImpTxBFCapable:1; + ULONG Calibration:2; + ULONG ExpCSICapable:1; + ULONG ExpNoComSteerCapable:1; + ULONG ExpComSteerCapable:1; + ULONG ExpCSIFbk:2; + ULONG ExpNoComBF:2; + ULONG ExpComBF:2; + ULONG MinGrouping:2; + ULONG CSIBFAntSup:2; + ULONG NoComSteerBFAntSup:2; + ULONG ComSteerBFAntSup:2; + ULONG CSIRowBFSup:2; + ULONG ChanEstimation:2; + ULONG rsv:3; } HT_BF_CAP, *PHT_BF_CAP; // HT antenna selection field in HT Cap IE . -typedef struct PACKED _HT_AS_CAP{ - UCHAR AntSelect:1; - UCHAR ExpCSIFbkTxASEL:1; - UCHAR AntIndFbkTxASEL:1; - UCHAR ExpCSIFbk:1; - UCHAR AntIndFbk:1; - UCHAR RxASel:1; - UCHAR TxSoundPPDU:1; - UCHAR rsv:1; +typedef struct PACKED _HT_AS_CAP { + UCHAR AntSelect:1; + UCHAR ExpCSIFbkTxASEL:1; + UCHAR AntIndFbkTxASEL:1; + UCHAR ExpCSIFbk:1; + UCHAR AntIndFbk:1; + UCHAR RxASel:1; + UCHAR TxSoundPPDU:1; + UCHAR rsv:1; } HT_AS_CAP, *PHT_AS_CAP; // Draft 1.0 set IE length 26, but is extensible.. #define SIZE_HT_CAP_IE 26 // The structure for HT Capability IE. -typedef struct PACKED _HT_CAPABILITY_IE{ - HT_CAP_INFO HtCapInfo; - HT_CAP_PARM HtCapParm; -// HT_MCS_SET HtMCSSet; - UCHAR MCSSet[16]; - EXT_HT_CAP_INFO ExtHtCapInfo; - HT_BF_CAP TxBFCap; // beamforming cap. rt2860c not support beamforming. - HT_AS_CAP ASCap; //antenna selection. +typedef struct PACKED _HT_CAPABILITY_IE { + HT_CAP_INFO HtCapInfo; + HT_CAP_PARM HtCapParm; +// HT_MCS_SET HtMCSSet; + UCHAR MCSSet[16]; + EXT_HT_CAP_INFO ExtHtCapInfo; + HT_BF_CAP TxBFCap; // beamforming cap. rt2860c not support beamforming. + HT_AS_CAP ASCap; //antenna selection. } HT_CAPABILITY_IE, *PHT_CAPABILITY_IE; - // 802.11n draft3 related structure definitions. // 7.3.2.60 #define dot11OBSSScanPassiveDwell 20 // in TU. min amount of time that the STA continously scans each channel when performing an active OBSS scan. #define dot11OBSSScanActiveDwell 10 // in TU.min amount of time that the STA continously scans each channel when performing an passive OBSS scan. -#define dot11BSSWidthTriggerScanInterval 300 // in sec. max interval between scan operations to be performed to detect BSS channel width trigger events. +#define dot11BSSWidthTriggerScanInterval 300 // in sec. max interval between scan operations to be performed to detect BSS channel width trigger events. #define dot11OBSSScanPassiveTotalPerChannel 200 // in TU. min total amount of time that the STA scans each channel when performing a passive OBSS scan. #define dot11OBSSScanActiveTotalPerChannel 20 //in TU. min total amount of time that the STA scans each channel when performing a active OBSS scan #define dot11BSSWidthChannelTransactionDelayFactor 5 // min ratio between the delay time in performing a switch from 20MHz BSS to 20/40 BSS operation and the maximum - // interval between overlapping BSS scan operations. + // interval between overlapping BSS scan operations. #define dot11BSSScanActivityThreshold 25 // in %%, max total time that a STA may be active on the medium during a period of - // (dot11BSSWidthChannelTransactionDelayFactor * dot11BSSWidthTriggerScanInterval) seconds without - // being obligated to perform OBSS Scan operations. default is 25(== 0.25%) - -typedef struct PACKED _OVERLAP_BSS_SCAN_IE{ - USHORT ScanPassiveDwell; - USHORT ScanActiveDwell; - USHORT TriggerScanInt; // Trigger scan interval - USHORT PassiveTalPerChannel; // passive total per channel - USHORT ActiveTalPerChannel; // active total per channel - USHORT DelayFactor; // BSS width channel transition delay factor - USHORT ScanActThre; // Scan Activity threshold -}OVERLAP_BSS_SCAN_IE, *POVERLAP_BSS_SCAN_IE; - + // (dot11BSSWidthChannelTransactionDelayFactor * dot11BSSWidthTriggerScanInterval) seconds without + // being obligated to perform OBSS Scan operations. default is 25(== 0.25%) + +typedef struct PACKED _OVERLAP_BSS_SCAN_IE { + USHORT ScanPassiveDwell; + USHORT ScanActiveDwell; + USHORT TriggerScanInt; // Trigger scan interval + USHORT PassiveTalPerChannel; // passive total per channel + USHORT ActiveTalPerChannel; // active total per channel + USHORT DelayFactor; // BSS width channel transition delay factor + USHORT ScanActThre; // Scan Activity threshold +} OVERLAP_BSS_SCAN_IE, *POVERLAP_BSS_SCAN_IE; // 7.3.2.56. 20/40 Coexistence element used in Element ID = 72 = IE_2040_BSS_COEXIST -typedef union PACKED _BSS_2040_COEXIST_IE{ - struct PACKED { - UCHAR InfoReq:1; - UCHAR Intolerant40:1; // Inter-BSS. set 1 when prohibits a receiving BSS from operating as a 20/40 Mhz BSS. - UCHAR BSS20WidthReq:1; // Intra-BSS set 1 when prohibits a receiving AP from operating its BSS as a 20/40MHz BSS. - UCHAR rsv:5; - } field; - UCHAR word; +typedef union PACKED _BSS_2040_COEXIST_IE { + struct PACKED { + UCHAR InfoReq:1; + UCHAR Intolerant40:1; // Inter-BSS. set 1 when prohibits a receiving BSS from operating as a 20/40 Mhz BSS. + UCHAR BSS20WidthReq:1; // Intra-BSS set 1 when prohibits a receiving AP from operating its BSS as a 20/40MHz BSS. + UCHAR rsv:5; + } field; + UCHAR word; } BSS_2040_COEXIST_IE, *PBSS_2040_COEXIST_IE; - -typedef struct _TRIGGER_EVENTA{ - BOOLEAN bValid; - UCHAR BSSID[6]; - UCHAR RegClass; // Regulatory Class - USHORT Channel; - ULONG CDCounter; // Maintain a seperate count down counter for each Event A. +typedef struct _TRIGGER_EVENTA { + BOOLEAN bValid; + UCHAR BSSID[6]; + UCHAR RegClass; // Regulatory Class + USHORT Channel; + ULONG CDCounter; // Maintain a seperate count down counter for each Event A. } TRIGGER_EVENTA, *PTRIGGER_EVENTA; // 20/40 trigger event table // If one Event A delete or created, or if Event B is detected or not detected, STA should send 2040BSSCoexistence to AP. #define MAX_TRIGGER_EVENT 64 -typedef struct _TRIGGER_EVENT_TAB{ - UCHAR EventANo; - TRIGGER_EVENTA EventA[MAX_TRIGGER_EVENT]; - ULONG EventBCountDown; // Count down counter for Event B. +typedef struct _TRIGGER_EVENT_TAB { + UCHAR EventANo; + TRIGGER_EVENTA EventA[MAX_TRIGGER_EVENT]; + ULONG EventBCountDown; // Count down counter for Event B. } TRIGGER_EVENT_TAB, *PTRIGGER_EVENT_TAB; // 7.3.27 20/40 Bss Coexistence Mgmt capability used in extended capabilities information IE( ID = 127 = IE_EXT_CAPABILITY). -// This is the first octet and was defined in 802.11n D3.03 and 802.11yD9.0 -typedef struct PACKED _EXT_CAP_INFO_ELEMENT{ - UCHAR BssCoexistMgmtSupport:1; - UCHAR rsv:1; - UCHAR ExtendChannelSwitch:1; - UCHAR rsv2:5; -}EXT_CAP_INFO_ELEMENT, *PEXT_CAP_INFO_ELEMENT; - +// This is the first octet and was defined in 802.11n D3.03 and 802.11yD9.0 +typedef struct PACKED _EXT_CAP_INFO_ELEMENT { + UCHAR BssCoexistMgmtSupport:1; + UCHAR rsv:1; + UCHAR ExtendChannelSwitch:1; + UCHAR rsv2:5; +} EXT_CAP_INFO_ELEMENT, *PEXT_CAP_INFO_ELEMENT; // 802.11n 7.3.2.61 -typedef struct PACKED _BSS_2040_COEXIST_ELEMENT{ - UCHAR ElementID; // ID = IE_2040_BSS_COEXIST = 72 - UCHAR Len; - BSS_2040_COEXIST_IE BssCoexistIe; -}BSS_2040_COEXIST_ELEMENT, *PBSS_2040_COEXIST_ELEMENT; - +typedef struct PACKED _BSS_2040_COEXIST_ELEMENT { + UCHAR ElementID; // ID = IE_2040_BSS_COEXIST = 72 + UCHAR Len; + BSS_2040_COEXIST_IE BssCoexistIe; +} BSS_2040_COEXIST_ELEMENT, *PBSS_2040_COEXIST_ELEMENT; //802.11n 7.3.2.59 -typedef struct PACKED _BSS_2040_INTOLERANT_CH_REPORT{ - UCHAR ElementID; // ID = IE_2040_BSS_INTOLERANT_REPORT = 73 - UCHAR Len; - UCHAR RegulatoryClass; - UCHAR ChList[0]; -}BSS_2040_INTOLERANT_CH_REPORT, *PBSS_2040_INTOLERANT_CH_REPORT; - +typedef struct PACKED _BSS_2040_INTOLERANT_CH_REPORT { + UCHAR ElementID; // ID = IE_2040_BSS_INTOLERANT_REPORT = 73 + UCHAR Len; + UCHAR RegulatoryClass; + UCHAR ChList[0]; +} BSS_2040_INTOLERANT_CH_REPORT, *PBSS_2040_INTOLERANT_CH_REPORT; // The structure for channel switch annoucement IE. This is in 802.11n D3.03 -typedef struct PACKED _CHA_SWITCH_ANNOUNCE_IE{ - UCHAR SwitchMode; //channel switch mode - UCHAR NewChannel; // - UCHAR SwitchCount; // +typedef struct PACKED _CHA_SWITCH_ANNOUNCE_IE { + UCHAR SwitchMode; //channel switch mode + UCHAR NewChannel; // + UCHAR SwitchCount; // } CHA_SWITCH_ANNOUNCE_IE, *PCHA_SWITCH_ANNOUNCE_IE; - // The structure for channel switch annoucement IE. This is in 802.11n D3.03 -typedef struct PACKED _SEC_CHA_OFFSET_IE{ - UCHAR SecondaryChannelOffset; // 1: Secondary above, 3: Secondary below, 0: no Secondary +typedef struct PACKED _SEC_CHA_OFFSET_IE { + UCHAR SecondaryChannelOffset; // 1: Secondary above, 3: Secondary below, 0: no Secondary } SEC_CHA_OFFSET_IE, *PSEC_CHA_OFFSET_IE; - // This structure is extracted from struct RT_HT_CAPABILITY typedef struct { - BOOLEAN bHtEnable; // If we should use ht rate. - BOOLEAN bPreNHt; // If we should use ht rate. + BOOLEAN bHtEnable; // If we should use ht rate. + BOOLEAN bPreNHt; // If we should use ht rate. //Substract from HT Capability IE - UCHAR MCSSet[16]; + UCHAR MCSSet[16]; } RT_HT_PHY_INFO, *PRT_HT_PHY_INFO; //This structure substracts ralink supports from all 802.11n-related features. //Features not listed here but contained in 802.11n spec are not supported in rt2860. typedef struct { - USHORT ChannelWidth:1; - USHORT MimoPs:2;//mimo power safe MMPS_ - USHORT GF:1; //green field - USHORT ShortGIfor20:1; - USHORT ShortGIfor40:1; //for40MHz - USHORT TxSTBC:1; - USHORT RxSTBC:2; // 2 bits - USHORT AmsduEnable:1; // Enable to transmit A-MSDU. Suggest disable. We should use A-MPDU to gain best benifit of 802.11n - USHORT AmsduSize:1; // Max receiving A-MSDU size - USHORT rsv:5; + USHORT ChannelWidth:1; + USHORT MimoPs:2; //mimo power safe MMPS_ + USHORT GF:1; //green field + USHORT ShortGIfor20:1; + USHORT ShortGIfor40:1; //for40MHz + USHORT TxSTBC:1; + USHORT RxSTBC:2; // 2 bits + USHORT AmsduEnable:1; // Enable to transmit A-MSDU. Suggest disable. We should use A-MPDU to gain best benifit of 802.11n + USHORT AmsduSize:1; // Max receiving A-MSDU size + USHORT rsv:5; //Substract from Addiont HT INFO IE - UCHAR MaxRAmpduFactor:2; - UCHAR MpduDensity:3; - UCHAR ExtChanOffset:2; // Please not the difference with following UCHAR NewExtChannelOffset; from 802.11n - UCHAR RecomWidth:1; + UCHAR MaxRAmpduFactor:2; + UCHAR MpduDensity:3; + UCHAR ExtChanOffset:2; // Please not the difference with following UCHAR NewExtChannelOffset; from 802.11n + UCHAR RecomWidth:1; - USHORT OperaionMode:2; - USHORT NonGfPresent:1; - USHORT rsv3:1; - USHORT OBSS_NonHTExist:1; - USHORT rsv2:11; + USHORT OperaionMode:2; + USHORT NonGfPresent:1; + USHORT rsv3:1; + USHORT OBSS_NonHTExist:1; + USHORT rsv2:11; // New Extension Channel Offset IE - UCHAR NewExtChannelOffset; + UCHAR NewExtChannelOffset; // Extension Capability IE = 127 - UCHAR BSSCoexist2040; + UCHAR BSSCoexist2040; } RT_HT_CAPABILITY, *PRT_HT_CAPABILITY; // field in Addtional HT Information IE . typedef struct PACKED { - UCHAR ExtChanOffset:2; - UCHAR RecomWidth:1; - UCHAR RifsMode:1; - UCHAR S_PSMPSup:1; //Indicate support for scheduled PSMP - UCHAR SerInterGranu:3; //service interval granularity + UCHAR ExtChanOffset:2; + UCHAR RecomWidth:1; + UCHAR RifsMode:1; + UCHAR S_PSMPSup:1; //Indicate support for scheduled PSMP + UCHAR SerInterGranu:3; //service interval granularity } ADD_HTINFO, *PADD_HTINFO; -typedef struct PACKED{ - USHORT OperaionMode:2; - USHORT NonGfPresent:1; - USHORT rsv:1; - USHORT OBSS_NonHTExist:1; - USHORT rsv2:11; +typedef struct PACKED { + USHORT OperaionMode:2; + USHORT NonGfPresent:1; + USHORT rsv:1; + USHORT OBSS_NonHTExist:1; + USHORT rsv2:11; } ADD_HTINFO2, *PADD_HTINFO2; - // TODO: Need sync with spec about the definition of StbcMcs. In Draft 3.03, it's reserved. -typedef struct PACKED{ - USHORT StbcMcs:6; - USHORT DualBeacon:1; - USHORT DualCTSProtect:1; - USHORT STBCBeacon:1; - USHORT LsigTxopProt:1; // L-SIG TXOP protection full support - USHORT PcoActive:1; - USHORT PcoPhase:1; - USHORT rsv:4; +typedef struct PACKED { + USHORT StbcMcs:6; + USHORT DualBeacon:1; + USHORT DualCTSProtect:1; + USHORT STBCBeacon:1; + USHORT LsigTxopProt:1; // L-SIG TXOP protection full support + USHORT PcoActive:1; + USHORT PcoPhase:1; + USHORT rsv:4; } ADD_HTINFO3, *PADD_HTINFO3; #define SIZE_ADD_HT_INFO_IE 22 -typedef struct PACKED{ - UCHAR ControlChan; - ADD_HTINFO AddHtInfo; - ADD_HTINFO2 AddHtInfo2; - ADD_HTINFO3 AddHtInfo3; - UCHAR MCSSet[16]; // Basic MCS set +typedef struct PACKED { + UCHAR ControlChan; + ADD_HTINFO AddHtInfo; + ADD_HTINFO2 AddHtInfo2; + ADD_HTINFO3 AddHtInfo3; + UCHAR MCSSet[16]; // Basic MCS set } ADD_HT_INFO_IE, *PADD_HT_INFO_IE; -typedef struct PACKED{ - UCHAR NewExtChanOffset; +typedef struct PACKED { + UCHAR NewExtChanOffset; } NEW_EXT_CHAN_IE, *PNEW_EXT_CHAN_IE; typedef struct PACKED _FRAME_802_11 { - HEADER_802_11 Hdr; - UCHAR Octet[1]; -} FRAME_802_11, *PFRAME_802_11; + HEADER_802_11 Hdr; + UCHAR Octet[1]; +} FRAME_802_11, *PFRAME_802_11; // QoSNull embedding of management action. When HT Control MA field set to 1. typedef struct PACKED _MA_BODY { - UCHAR Category; - UCHAR Action; - UCHAR Octet[1]; -} MA_BODY, *PMA_BODY; - -typedef struct PACKED _HEADER_802_3 { - UCHAR DAAddr1[MAC_ADDR_LEN]; - UCHAR SAAddr2[MAC_ADDR_LEN]; - UCHAR Octet[2]; -} HEADER_802_3, *PHEADER_802_3; + UCHAR Category; + UCHAR Action; + UCHAR Octet[1]; +} MA_BODY, *PMA_BODY; + +typedef struct PACKED _HEADER_802_3 { + UCHAR DAAddr1[MAC_ADDR_LEN]; + UCHAR SAAddr2[MAC_ADDR_LEN]; + UCHAR Octet[2]; +} HEADER_802_3, *PHEADER_802_3; ////Block ACK related format -// 2-byte BA Parameter field in DELBA frames to terminate an already set up bA -typedef struct PACKED{ - USHORT Rsv:11; // always set to 0 - USHORT Initiator:1; // 1: originator 0:recipient - USHORT TID:4; // value of TC os TS +// 2-byte BA Parameter field in DELBA frames to terminate an already set up bA +typedef struct PACKED { + USHORT Rsv:11; // always set to 0 + USHORT Initiator:1; // 1: originator 0:recipient + USHORT TID:4; // value of TC os TS } DELBA_PARM, *PDELBA_PARM; // 2-byte BA Parameter Set field in ADDBA frames to signal parm for setting up a BA typedef struct PACKED { - USHORT AMSDUSupported:1; // 0: not permitted 1: permitted - USHORT BAPolicy:1; // 1: immediately BA 0:delayed BA - USHORT TID:4; // value of TC os TS - USHORT BufSize:10; // number of buffe of size 2304 octetsr + USHORT AMSDUSupported:1; // 0: not permitted 1: permitted + USHORT BAPolicy:1; // 1: immediately BA 0:delayed BA + USHORT TID:4; // value of TC os TS + USHORT BufSize:10; // number of buffe of size 2304 octetsr } BA_PARM, *PBA_PARM; // 2-byte BA Starting Seq CONTROL field typedef union PACKED { - struct PACKED { - USHORT FragNum:4; // always set to 0 - USHORT StartSeq:12; // sequence number of the 1st MSDU for which this BAR is sent - } field; - USHORT word; + struct PACKED { + USHORT FragNum:4; // always set to 0 + USHORT StartSeq:12; // sequence number of the 1st MSDU for which this BAR is sent + } field; + USHORT word; } BASEQ_CONTROL, *PBASEQ_CONTROL; //BAControl and BARControl are the same // 2-byte BA CONTROL field in BA frame typedef struct PACKED { - USHORT ACKPolicy:1; // only related to N-Delayed BA. But not support in RT2860b. 0:NormalACK 1:No ACK - USHORT MTID:1; //EWC V1.24 - USHORT Compressed:1; - USHORT Rsv:9; - USHORT TID:4; + USHORT ACKPolicy:1; // only related to N-Delayed BA. But not support in RT2860b. 0:NormalACK 1:No ACK + USHORT MTID:1; //EWC V1.24 + USHORT Compressed:1; + USHORT Rsv:9; + USHORT TID:4; } BA_CONTROL, *PBA_CONTROL; // 2-byte BAR CONTROL field in BAR frame typedef struct PACKED { - USHORT ACKPolicy:1; // 0:normal ack, 1:no ack. - USHORT MTID:1; //if this bit1, use FRAME_MTBA_REQ, if 0, use FRAME_BA_REQ - USHORT Compressed:1; - USHORT Rsv1:9; - USHORT TID:4; + USHORT ACKPolicy:1; // 0:normal ack, 1:no ack. + USHORT MTID:1; //if this bit1, use FRAME_MTBA_REQ, if 0, use FRAME_BA_REQ + USHORT Compressed:1; + USHORT Rsv1:9; + USHORT TID:4; } BAR_CONTROL, *PBAR_CONTROL; // BARControl in MTBAR frame typedef struct PACKED { - USHORT ACKPolicy:1; - USHORT MTID:1; - USHORT Compressed:1; - USHORT Rsv1:9; - USHORT NumTID:4; + USHORT ACKPolicy:1; + USHORT MTID:1; + USHORT Compressed:1; + USHORT Rsv1:9; + USHORT NumTID:4; } MTBAR_CONTROL, *PMTBAR_CONTROL; typedef struct PACKED { - USHORT Rsv1:12; - USHORT TID:4; + USHORT Rsv1:12; + USHORT TID:4; } PER_TID_INFO, *PPER_TID_INFO; typedef struct { - PER_TID_INFO PerTID; - BASEQ_CONTROL BAStartingSeq; + PER_TID_INFO PerTID; + BASEQ_CONTROL BAStartingSeq; } EACH_TID, *PEACH_TID; - // BAREQ AND MTBAREQ have the same subtype BAR, 802.11n BAR use compressed bitmap. typedef struct PACKED _FRAME_BA_REQ { - FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; - BAR_CONTROL BARControl; - BASEQ_CONTROL BAStartingSeq; -} FRAME_BA_REQ, *PFRAME_BA_REQ; + FRAME_CONTROL FC; + USHORT Duration; + UCHAR Addr1[MAC_ADDR_LEN]; + UCHAR Addr2[MAC_ADDR_LEN]; + BAR_CONTROL BARControl; + BASEQ_CONTROL BAStartingSeq; +} FRAME_BA_REQ, *PFRAME_BA_REQ; typedef struct PACKED _FRAME_MTBA_REQ { - FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; - MTBAR_CONTROL MTBARControl; - PER_TID_INFO PerTIDInfo; - BASEQ_CONTROL BAStartingSeq; -} FRAME_MTBA_REQ, *PFRAME_MTBA_REQ; + FRAME_CONTROL FC; + USHORT Duration; + UCHAR Addr1[MAC_ADDR_LEN]; + UCHAR Addr2[MAC_ADDR_LEN]; + MTBAR_CONTROL MTBARControl; + PER_TID_INFO PerTIDInfo; + BASEQ_CONTROL BAStartingSeq; +} FRAME_MTBA_REQ, *PFRAME_MTBA_REQ; // Compressed format is mandantory in HT STA typedef struct PACKED _FRAME_MTBA { - FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; - BA_CONTROL BAControl; - BASEQ_CONTROL BAStartingSeq; - UCHAR BitMap[8]; -} FRAME_MTBA, *PFRAME_MTBA; + FRAME_CONTROL FC; + USHORT Duration; + UCHAR Addr1[MAC_ADDR_LEN]; + UCHAR Addr2[MAC_ADDR_LEN]; + BA_CONTROL BAControl; + BASEQ_CONTROL BAStartingSeq; + UCHAR BitMap[8]; +} FRAME_MTBA, *PFRAME_MTBA; typedef struct PACKED _FRAME_PSMP_ACTION { - HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; - UCHAR Psmp; // 7.3.1.25 -} FRAME_PSMP_ACTION, *PFRAME_PSMP_ACTION; + HEADER_802_11 Hdr; + UCHAR Category; + UCHAR Action; + UCHAR Psmp; // 7.3.1.25 +} FRAME_PSMP_ACTION, *PFRAME_PSMP_ACTION; typedef struct PACKED _FRAME_ACTION_HDR { - HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; -} FRAME_ACTION_HDR, *PFRAME_ACTION_HDR; + HEADER_802_11 Hdr; + UCHAR Category; + UCHAR Action; +} FRAME_ACTION_HDR, *PFRAME_ACTION_HDR; //Action Frame //Action Frame Category:Spectrum, Action:Channel Switch. 7.3.2.20 typedef struct PACKED _CHAN_SWITCH_ANNOUNCE { - UCHAR ElementID; // ID = IE_CHANNEL_SWITCH_ANNOUNCEMENT = 37 - UCHAR Len; - CHA_SWITCH_ANNOUNCE_IE CSAnnounceIe; -} CHAN_SWITCH_ANNOUNCE, *PCHAN_SWITCH_ANNOUNCE; - + UCHAR ElementID; // ID = IE_CHANNEL_SWITCH_ANNOUNCEMENT = 37 + UCHAR Len; + CHA_SWITCH_ANNOUNCE_IE CSAnnounceIe; +} CHAN_SWITCH_ANNOUNCE, *PCHAN_SWITCH_ANNOUNCE; //802.11n : 7.3.2.20a typedef struct PACKED _SECOND_CHAN_OFFSET { - UCHAR ElementID; // ID = IE_SECONDARY_CH_OFFSET = 62 - UCHAR Len; - SEC_CHA_OFFSET_IE SecChOffsetIe; -} SECOND_CHAN_OFFSET, *PSECOND_CHAN_OFFSET; - + UCHAR ElementID; // ID = IE_SECONDARY_CH_OFFSET = 62 + UCHAR Len; + SEC_CHA_OFFSET_IE SecChOffsetIe; +} SECOND_CHAN_OFFSET, *PSECOND_CHAN_OFFSET; typedef struct PACKED _FRAME_SPETRUM_CS { - HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; - CHAN_SWITCH_ANNOUNCE CSAnnounce; - SECOND_CHAN_OFFSET SecondChannel; -} FRAME_SPETRUM_CS, *PFRAME_SPETRUM_CS; - + HEADER_802_11 Hdr; + UCHAR Category; + UCHAR Action; + CHAN_SWITCH_ANNOUNCE CSAnnounce; + SECOND_CHAN_OFFSET SecondChannel; +} FRAME_SPETRUM_CS, *PFRAME_SPETRUM_CS; typedef struct PACKED _FRAME_ADDBA_REQ { - HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; - UCHAR Token; // 1 - BA_PARM BaParm; // 2 - 10 - USHORT TimeOutValue; // 0 - 0 - BASEQ_CONTROL BaStartSeq; // 0-0 -} FRAME_ADDBA_REQ, *PFRAME_ADDBA_REQ; + HEADER_802_11 Hdr; + UCHAR Category; + UCHAR Action; + UCHAR Token; // 1 + BA_PARM BaParm; // 2 - 10 + USHORT TimeOutValue; // 0 - 0 + BASEQ_CONTROL BaStartSeq; // 0-0 +} FRAME_ADDBA_REQ, *PFRAME_ADDBA_REQ; typedef struct PACKED _FRAME_ADDBA_RSP { - HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; - UCHAR Token; - USHORT StatusCode; - BA_PARM BaParm; //0 - 2 - USHORT TimeOutValue; -} FRAME_ADDBA_RSP, *PFRAME_ADDBA_RSP; + HEADER_802_11 Hdr; + UCHAR Category; + UCHAR Action; + UCHAR Token; + USHORT StatusCode; + BA_PARM BaParm; //0 - 2 + USHORT TimeOutValue; +} FRAME_ADDBA_RSP, *PFRAME_ADDBA_RSP; typedef struct PACKED _FRAME_DELBA_REQ { - HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; - DELBA_PARM DelbaParm; - USHORT ReasonCode; -} FRAME_DELBA_REQ, *PFRAME_DELBA_REQ; - + HEADER_802_11 Hdr; + UCHAR Category; + UCHAR Action; + DELBA_PARM DelbaParm; + USHORT ReasonCode; +} FRAME_DELBA_REQ, *PFRAME_DELBA_REQ; //7.2.1.7 typedef struct PACKED _FRAME_BAR { - FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; - BAR_CONTROL BarControl; - BASEQ_CONTROL StartingSeq; -} FRAME_BAR, *PFRAME_BAR; + FRAME_CONTROL FC; + USHORT Duration; + UCHAR Addr1[MAC_ADDR_LEN]; + UCHAR Addr2[MAC_ADDR_LEN]; + BAR_CONTROL BarControl; + BASEQ_CONTROL StartingSeq; +} FRAME_BAR, *PFRAME_BAR; //7.2.1.7 typedef struct PACKED _FRAME_BA { - FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; - BAR_CONTROL BarControl; - BASEQ_CONTROL StartingSeq; - UCHAR bitmask[8]; -} FRAME_BA, *PFRAME_BA; - + FRAME_CONTROL FC; + USHORT Duration; + UCHAR Addr1[MAC_ADDR_LEN]; + UCHAR Addr2[MAC_ADDR_LEN]; + BAR_CONTROL BarControl; + BASEQ_CONTROL StartingSeq; + UCHAR bitmask[8]; +} FRAME_BA, *PFRAME_BA; // Radio Measuement Request Frame Format typedef struct PACKED _FRAME_RM_REQ_ACTION { - HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; - UCHAR Token; - USHORT Repetition; - UCHAR data[0]; -} FRAME_RM_REQ_ACTION, *PFRAME_RM_REQ_ACTION; + HEADER_802_11 Hdr; + UCHAR Category; + UCHAR Action; + UCHAR Token; + USHORT Repetition; + UCHAR data[0]; +} FRAME_RM_REQ_ACTION, *PFRAME_RM_REQ_ACTION; typedef struct PACKED { - UCHAR ID; - UCHAR Length; - UCHAR ChannelSwitchMode; - UCHAR NewRegClass; - UCHAR NewChannelNum; - UCHAR ChannelSwitchCount; -} HT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE, *PHT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE; - + UCHAR ID; + UCHAR Length; + UCHAR ChannelSwitchMode; + UCHAR NewRegClass; + UCHAR NewChannelNum; + UCHAR ChannelSwitchCount; +} HT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE, + *PHT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE; // // _Limit must be the 2**n - 1 @@ -701,183 +682,181 @@ typedef struct PACKED { // Contention-free parameter (without ID and Length) // typedef struct PACKED { - BOOLEAN bValid; // 1: variable contains valid value - UCHAR CfpCount; - UCHAR CfpPeriod; - USHORT CfpMaxDuration; - USHORT CfpDurRemaining; + BOOLEAN bValid; // 1: variable contains valid value + UCHAR CfpCount; + UCHAR CfpPeriod; + USHORT CfpMaxDuration; + USHORT CfpDurRemaining; } CF_PARM, *PCF_PARM; -typedef struct _CIPHER_SUITE { - NDIS_802_11_ENCRYPTION_STATUS PairCipher; // Unicast cipher 1, this one has more secured cipher suite - NDIS_802_11_ENCRYPTION_STATUS PairCipherAux; // Unicast cipher 2 if AP announce two unicast cipher suite - NDIS_802_11_ENCRYPTION_STATUS GroupCipher; // Group cipher - USHORT RsnCapability; // RSN capability from beacon - BOOLEAN bMixMode; // Indicate Pair & Group cipher might be different -} CIPHER_SUITE, *PCIPHER_SUITE; +typedef struct _CIPHER_SUITE { + NDIS_802_11_ENCRYPTION_STATUS PairCipher; // Unicast cipher 1, this one has more secured cipher suite + NDIS_802_11_ENCRYPTION_STATUS PairCipherAux; // Unicast cipher 2 if AP announce two unicast cipher suite + NDIS_802_11_ENCRYPTION_STATUS GroupCipher; // Group cipher + USHORT RsnCapability; // RSN capability from beacon + BOOLEAN bMixMode; // Indicate Pair & Group cipher might be different +} CIPHER_SUITE, *PCIPHER_SUITE; // EDCA configuration from AP's BEACON/ProbeRsp typedef struct { - BOOLEAN bValid; // 1: variable contains valid value - BOOLEAN bAdd; // 1: variable contains valid value - BOOLEAN bQAck; - BOOLEAN bQueueRequest; - BOOLEAN bTxopRequest; - BOOLEAN bAPSDCapable; + BOOLEAN bValid; // 1: variable contains valid value + BOOLEAN bAdd; // 1: variable contains valid value + BOOLEAN bQAck; + BOOLEAN bQueueRequest; + BOOLEAN bTxopRequest; + BOOLEAN bAPSDCapable; // BOOLEAN bMoreDataAck; - UCHAR EdcaUpdateCount; - UCHAR Aifsn[4]; // 0:AC_BK, 1:AC_BE, 2:AC_VI, 3:AC_VO - UCHAR Cwmin[4]; - UCHAR Cwmax[4]; - USHORT Txop[4]; // in unit of 32-us - BOOLEAN bACM[4]; // 1: Admission Control of AC_BK is mandattory + UCHAR EdcaUpdateCount; + UCHAR Aifsn[4]; // 0:AC_BK, 1:AC_BE, 2:AC_VI, 3:AC_VO + UCHAR Cwmin[4]; + UCHAR Cwmax[4]; + USHORT Txop[4]; // in unit of 32-us + BOOLEAN bACM[4]; // 1: Admission Control of AC_BK is mandattory } EDCA_PARM, *PEDCA_PARM; // QBSS LOAD information from QAP's BEACON/ProbeRsp typedef struct { - BOOLEAN bValid; // 1: variable contains valid value - USHORT StaNum; - UCHAR ChannelUtilization; - USHORT RemainingAdmissionControl; // in unit of 32-us + BOOLEAN bValid; // 1: variable contains valid value + USHORT StaNum; + UCHAR ChannelUtilization; + USHORT RemainingAdmissionControl; // in unit of 32-us } QBSS_LOAD_PARM, *PQBSS_LOAD_PARM; // QBSS Info field in QSTA's assoc req typedef struct PACKED { - UCHAR UAPSD_AC_VO:1; - UCHAR UAPSD_AC_VI:1; - UCHAR UAPSD_AC_BK:1; - UCHAR UAPSD_AC_BE:1; - UCHAR Rsv1:1; - UCHAR MaxSPLength:2; - UCHAR Rsv2:1; + UCHAR UAPSD_AC_VO:1; + UCHAR UAPSD_AC_VI:1; + UCHAR UAPSD_AC_BK:1; + UCHAR UAPSD_AC_BE:1; + UCHAR Rsv1:1; + UCHAR MaxSPLength:2; + UCHAR Rsv2:1; } QBSS_STA_INFO_PARM, *PQBSS_STA_INFO_PARM; // QBSS Info field in QAP's Beacon/ProbeRsp typedef struct PACKED { - UCHAR ParamSetCount:4; - UCHAR Rsv:3; - UCHAR UAPSD:1; + UCHAR ParamSetCount:4; + UCHAR Rsv:3; + UCHAR UAPSD:1; } QBSS_AP_INFO_PARM, *PQBSS_AP_INFO_PARM; // QOS Capability reported in QAP's BEACON/ProbeRsp // QOS Capability sent out in QSTA's AssociateReq/ReAssociateReq typedef struct { - BOOLEAN bValid; // 1: variable contains valid value - BOOLEAN bQAck; - BOOLEAN bQueueRequest; - BOOLEAN bTxopRequest; + BOOLEAN bValid; // 1: variable contains valid value + BOOLEAN bQAck; + BOOLEAN bQueueRequest; + BOOLEAN bTxopRequest; // BOOLEAN bMoreDataAck; - UCHAR EdcaUpdateCount; + UCHAR EdcaUpdateCount; } QOS_CAPABILITY_PARM, *PQOS_CAPABILITY_PARM; typedef struct { - UCHAR IELen; - UCHAR IE[MAX_CUSTOM_LEN]; + UCHAR IELen; + UCHAR IE[MAX_CUSTOM_LEN]; } WPA_IE_; typedef struct { - UCHAR Bssid[MAC_ADDR_LEN]; - UCHAR Channel; - UCHAR CentralChannel; //Store the wide-band central channel for 40MHz. .used in 40MHz AP. Or this is the same as Channel. - UCHAR BssType; - USHORT AtimWin; - USHORT BeaconPeriod; - - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR ExtRateLen; + UCHAR Bssid[MAC_ADDR_LEN]; + UCHAR Channel; + UCHAR CentralChannel; //Store the wide-band central channel for 40MHz. .used in 40MHz AP. Or this is the same as Channel. + UCHAR BssType; + USHORT AtimWin; + USHORT BeaconPeriod; + + UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; + UCHAR SupRateLen; + UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; + UCHAR ExtRateLen; HT_CAPABILITY_IE HtCapability; - UCHAR HtCapabilityLen; + UCHAR HtCapabilityLen; ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE - UCHAR AddHtInfoLen; - UCHAR NewExtChanOffset; - CHAR Rssi; - UCHAR Privacy; // Indicate security function ON/OFF. Don't mess up with auth mode. - UCHAR Hidden; + UCHAR AddHtInfoLen; + UCHAR NewExtChanOffset; + CHAR Rssi; + UCHAR Privacy; // Indicate security function ON/OFF. Don't mess up with auth mode. + UCHAR Hidden; - USHORT DtimPeriod; - USHORT CapabilityInfo; + USHORT DtimPeriod; + USHORT CapabilityInfo; - USHORT CfpCount; - USHORT CfpPeriod; - USHORT CfpMaxDuration; - USHORT CfpDurRemaining; - UCHAR SsidLen; - CHAR Ssid[MAX_LEN_OF_SSID]; + USHORT CfpCount; + USHORT CfpPeriod; + USHORT CfpMaxDuration; + USHORT CfpDurRemaining; + UCHAR SsidLen; + CHAR Ssid[MAX_LEN_OF_SSID]; - ULONG LastBeaconRxTime; // OS's timestamp + ULONG LastBeaconRxTime; // OS's timestamp - BOOLEAN bSES; + BOOLEAN bSES; // New for WPA2 - CIPHER_SUITE WPA; // AP announced WPA cipher suite - CIPHER_SUITE WPA2; // AP announced WPA2 cipher suite + CIPHER_SUITE WPA; // AP announced WPA cipher suite + CIPHER_SUITE WPA2; // AP announced WPA2 cipher suite // New for microsoft WPA support - NDIS_802_11_FIXED_IEs FixIEs; - NDIS_802_11_AUTHENTICATION_MODE AuthModeAux; // Addition mode for WPA2 / WPA capable AP - NDIS_802_11_AUTHENTICATION_MODE AuthMode; - NDIS_802_11_WEP_STATUS WepStatus; // Unicast Encryption Algorithm extract from VAR_IE - USHORT VarIELen; // Length of next VIE include EID & Length - UCHAR VarIEs[MAX_VIE_LEN]; + NDIS_802_11_FIXED_IEs FixIEs; + NDIS_802_11_AUTHENTICATION_MODE AuthModeAux; // Addition mode for WPA2 / WPA capable AP + NDIS_802_11_AUTHENTICATION_MODE AuthMode; + NDIS_802_11_WEP_STATUS WepStatus; // Unicast Encryption Algorithm extract from VAR_IE + USHORT VarIELen; // Length of next VIE include EID & Length + UCHAR VarIEs[MAX_VIE_LEN]; // CCX Ckip information - UCHAR CkipFlag; + UCHAR CkipFlag; // CCX 2 TSF - UCHAR PTSF[4]; // Parent TSF - UCHAR TTSF[8]; // Target TSF + UCHAR PTSF[4]; // Parent TSF + UCHAR TTSF[8]; // Target TSF - // 802.11e d9, and WMM - EDCA_PARM EdcaParm; + // 802.11e d9, and WMM + EDCA_PARM EdcaParm; QOS_CAPABILITY_PARM QosCapability; - QBSS_LOAD_PARM QbssLoad; - WPA_IE_ WpaIE; - WPA_IE_ RsnIE; + QBSS_LOAD_PARM QbssLoad; + WPA_IE_ WpaIE; + WPA_IE_ RsnIE; } BSS_ENTRY, *PBSS_ENTRY; typedef struct { - UCHAR BssNr; - UCHAR BssOverlapNr; - BSS_ENTRY BssEntry[MAX_LEN_OF_BSS_TABLE]; + UCHAR BssNr; + UCHAR BssOverlapNr; + BSS_ENTRY BssEntry[MAX_LEN_OF_BSS_TABLE]; } BSS_TABLE, *PBSS_TABLE; - typedef struct _MLME_QUEUE_ELEM { - ULONG Machine; - ULONG MsgType; - ULONG MsgLen; - UCHAR Msg[MGMT_DMA_BUFFER_SIZE]; - LARGE_INTEGER TimeStamp; - UCHAR Rssi0; - UCHAR Rssi1; - UCHAR Rssi2; - UCHAR Signal; - UCHAR Channel; - UCHAR Wcid; - BOOLEAN Occupied; + ULONG Machine; + ULONG MsgType; + ULONG MsgLen; + UCHAR Msg[MGMT_DMA_BUFFER_SIZE]; + LARGE_INTEGER TimeStamp; + UCHAR Rssi0; + UCHAR Rssi1; + UCHAR Rssi2; + UCHAR Signal; + UCHAR Channel; + UCHAR Wcid; + BOOLEAN Occupied; } MLME_QUEUE_ELEM, *PMLME_QUEUE_ELEM; typedef struct _MLME_QUEUE { - ULONG Num; - ULONG Head; - ULONG Tail; - NDIS_SPIN_LOCK Lock; - MLME_QUEUE_ELEM Entry[MAX_LEN_OF_MLME_QUEUE]; + ULONG Num; + ULONG Head; + ULONG Tail; + NDIS_SPIN_LOCK Lock; + MLME_QUEUE_ELEM Entry[MAX_LEN_OF_MLME_QUEUE]; } MLME_QUEUE, *PMLME_QUEUE; -typedef VOID (*STATE_MACHINE_FUNC)(VOID *Adaptor, MLME_QUEUE_ELEM *Elem); +typedef VOID(*STATE_MACHINE_FUNC) (VOID * Adaptor, MLME_QUEUE_ELEM * Elem); typedef struct _STATE_MACHINE { - ULONG Base; - ULONG NrState; - ULONG NrMsg; - ULONG CurrState; - STATE_MACHINE_FUNC *TransFunc; + ULONG Base; + ULONG NrState; + ULONG NrMsg; + ULONG CurrState; + STATE_MACHINE_FUNC *TransFunc; } STATE_MACHINE, *PSTATE_MACHINE; - // MLME AUX data structure that hold temporarliy settings during a connection attempt. // Once this attemp succeeds, all settings will be copy to pAd->StaActive. // A connection attempt (user set OID, roaming, CCX fast roaming,..) consists of @@ -885,191 +864,189 @@ typedef struct _STATE_MACHINE { // separate this under-trial settings away from pAd->StaActive so that once // this new attempt failed, driver can auto-recover back to the active settings. typedef struct _MLME_AUX { - UCHAR BssType; - UCHAR Ssid[MAX_LEN_OF_SSID]; - UCHAR SsidLen; - UCHAR Bssid[MAC_ADDR_LEN]; - UCHAR AutoReconnectSsid[MAX_LEN_OF_SSID]; - UCHAR AutoReconnectSsidLen; - USHORT Alg; - UCHAR ScanType; - UCHAR Channel; - UCHAR CentralChannel; - USHORT Aid; - USHORT CapabilityInfo; - USHORT BeaconPeriod; - USHORT CfpMaxDuration; - USHORT CfpPeriod; - USHORT AtimWin; + UCHAR BssType; + UCHAR Ssid[MAX_LEN_OF_SSID]; + UCHAR SsidLen; + UCHAR Bssid[MAC_ADDR_LEN]; + UCHAR AutoReconnectSsid[MAX_LEN_OF_SSID]; + UCHAR AutoReconnectSsidLen; + USHORT Alg; + UCHAR ScanType; + UCHAR Channel; + UCHAR CentralChannel; + USHORT Aid; + USHORT CapabilityInfo; + USHORT BeaconPeriod; + USHORT CfpMaxDuration; + USHORT CfpPeriod; + USHORT AtimWin; // Copy supported rate from desired AP's beacon. We are trying to match // AP's supported and extended rate settings. - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen; - UCHAR ExtRateLen; - HT_CAPABILITY_IE HtCapability; - UCHAR HtCapabilityLen; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE - UCHAR NewExtChannelOffset; - //RT_HT_CAPABILITY SupportedHtPhy; - - // new for QOS - QOS_CAPABILITY_PARM APQosCapability; // QOS capability of the current associated AP - EDCA_PARM APEdcaParm; // EDCA parameters of the current associated AP - QBSS_LOAD_PARM APQbssLoad; // QBSS load of the current associated AP - - // new to keep Ralink specific feature - ULONG APRalinkIe; - - BSS_TABLE SsidBssTab; // AP list for the same SSID - BSS_TABLE RoamTab; // AP list eligible for roaming - ULONG BssIdx; - ULONG RoamIdx; - - BOOLEAN CurrReqIsFromNdis; - - RALINK_TIMER_STRUCT BeaconTimer, ScanTimer; - RALINK_TIMER_STRUCT AuthTimer; - RALINK_TIMER_STRUCT AssocTimer, ReassocTimer, DisassocTimer; + UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; + UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; + UCHAR SupRateLen; + UCHAR ExtRateLen; + HT_CAPABILITY_IE HtCapability; + UCHAR HtCapabilityLen; + ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE + UCHAR NewExtChannelOffset; + //RT_HT_CAPABILITY SupportedHtPhy; + + // new for QOS + QOS_CAPABILITY_PARM APQosCapability; // QOS capability of the current associated AP + EDCA_PARM APEdcaParm; // EDCA parameters of the current associated AP + QBSS_LOAD_PARM APQbssLoad; // QBSS load of the current associated AP + + // new to keep Ralink specific feature + ULONG APRalinkIe; + + BSS_TABLE SsidBssTab; // AP list for the same SSID + BSS_TABLE RoamTab; // AP list eligible for roaming + ULONG BssIdx; + ULONG RoamIdx; + + BOOLEAN CurrReqIsFromNdis; + + RALINK_TIMER_STRUCT BeaconTimer, ScanTimer; + RALINK_TIMER_STRUCT AuthTimer; + RALINK_TIMER_STRUCT AssocTimer, ReassocTimer, DisassocTimer; } MLME_AUX, *PMLME_AUX; -typedef struct _MLME_ADDBA_REQ_STRUCT{ - UCHAR Wcid; // - UCHAR pAddr[MAC_ADDR_LEN]; - UCHAR BaBufSize; - USHORT TimeOutValue; - UCHAR TID; - UCHAR Token; - USHORT BaStartSeq; +typedef struct _MLME_ADDBA_REQ_STRUCT { + UCHAR Wcid; // + UCHAR pAddr[MAC_ADDR_LEN]; + UCHAR BaBufSize; + USHORT TimeOutValue; + UCHAR TID; + UCHAR Token; + USHORT BaStartSeq; } MLME_ADDBA_REQ_STRUCT, *PMLME_ADDBA_REQ_STRUCT; - -typedef struct _MLME_DELBA_REQ_STRUCT{ - UCHAR Wcid; // - UCHAR Addr[MAC_ADDR_LEN]; - UCHAR TID; - UCHAR Initiator; +typedef struct _MLME_DELBA_REQ_STRUCT { + UCHAR Wcid; // + UCHAR Addr[MAC_ADDR_LEN]; + UCHAR TID; + UCHAR Initiator; } MLME_DELBA_REQ_STRUCT, *PMLME_DELBA_REQ_STRUCT; // assoc struct is equal to reassoc -typedef struct _MLME_ASSOC_REQ_STRUCT{ - UCHAR Addr[MAC_ADDR_LEN]; - USHORT CapabilityInfo; - USHORT ListenIntv; - ULONG Timeout; -} MLME_ASSOC_REQ_STRUCT, *PMLME_ASSOC_REQ_STRUCT, MLME_REASSOC_REQ_STRUCT, *PMLME_REASSOC_REQ_STRUCT; - -typedef struct _MLME_DISASSOC_REQ_STRUCT{ - UCHAR Addr[MAC_ADDR_LEN]; - USHORT Reason; +typedef struct _MLME_ASSOC_REQ_STRUCT { + UCHAR Addr[MAC_ADDR_LEN]; + USHORT CapabilityInfo; + USHORT ListenIntv; + ULONG Timeout; +} MLME_ASSOC_REQ_STRUCT, *PMLME_ASSOC_REQ_STRUCT, MLME_REASSOC_REQ_STRUCT, + *PMLME_REASSOC_REQ_STRUCT; + +typedef struct _MLME_DISASSOC_REQ_STRUCT { + UCHAR Addr[MAC_ADDR_LEN]; + USHORT Reason; } MLME_DISASSOC_REQ_STRUCT, *PMLME_DISASSOC_REQ_STRUCT; typedef struct _MLME_AUTH_REQ_STRUCT { - UCHAR Addr[MAC_ADDR_LEN]; - USHORT Alg; - ULONG Timeout; + UCHAR Addr[MAC_ADDR_LEN]; + USHORT Alg; + ULONG Timeout; } MLME_AUTH_REQ_STRUCT, *PMLME_AUTH_REQ_STRUCT; typedef struct _MLME_DEAUTH_REQ_STRUCT { - UCHAR Addr[MAC_ADDR_LEN]; - USHORT Reason; + UCHAR Addr[MAC_ADDR_LEN]; + USHORT Reason; } MLME_DEAUTH_REQ_STRUCT, *PMLME_DEAUTH_REQ_STRUCT; typedef struct { - ULONG BssIdx; + ULONG BssIdx; } MLME_JOIN_REQ_STRUCT; typedef struct _MLME_SCAN_REQ_STRUCT { - UCHAR Bssid[MAC_ADDR_LEN]; - UCHAR BssType; - UCHAR ScanType; - UCHAR SsidLen; - CHAR Ssid[MAX_LEN_OF_SSID]; + UCHAR Bssid[MAC_ADDR_LEN]; + UCHAR BssType; + UCHAR ScanType; + UCHAR SsidLen; + CHAR Ssid[MAX_LEN_OF_SSID]; } MLME_SCAN_REQ_STRUCT, *PMLME_SCAN_REQ_STRUCT; typedef struct _MLME_START_REQ_STRUCT { - CHAR Ssid[MAX_LEN_OF_SSID]; - UCHAR SsidLen; + CHAR Ssid[MAX_LEN_OF_SSID]; + UCHAR SsidLen; } MLME_START_REQ_STRUCT, *PMLME_START_REQ_STRUCT; typedef struct PACKED { - UCHAR Eid; - UCHAR Len; - UCHAR Octet[1]; -} EID_STRUCT,*PEID_STRUCT, BEACON_EID_STRUCT, *PBEACON_EID_STRUCT; - -typedef struct PACKED _RTMP_TX_RATE_SWITCH -{ - UCHAR ItemNo; - UCHAR STBC:1; - UCHAR ShortGI:1; - UCHAR BW:1; - UCHAR Rsv1:1; - UCHAR Mode:2; - UCHAR Rsv2:2; - UCHAR CurrMCS; - UCHAR TrainUp; - UCHAR TrainDown; + UCHAR Eid; + UCHAR Len; + UCHAR Octet[1]; +} EID_STRUCT, *PEID_STRUCT, BEACON_EID_STRUCT, *PBEACON_EID_STRUCT; + +typedef struct PACKED _RTMP_TX_RATE_SWITCH { + UCHAR ItemNo; + UCHAR STBC:1; + UCHAR ShortGI:1; + UCHAR BW:1; + UCHAR Rsv1:1; + UCHAR Mode:2; + UCHAR Rsv2:2; + UCHAR CurrMCS; + UCHAR TrainUp; + UCHAR TrainDown; } RRTMP_TX_RATE_SWITCH, *PRTMP_TX_RATE_SWITCH; // ========================== AP mlme.h =============================== -#define TBTT_PRELOAD_TIME 384 // usec. LomgPreamble + 24-byte at 1Mbps +#define TBTT_PRELOAD_TIME 384 // usec. LomgPreamble + 24-byte at 1Mbps #define DEFAULT_DTIM_PERIOD 1 -#define MAC_TABLE_AGEOUT_TIME 300 // unit: sec -#define MAC_TABLE_ASSOC_TIMEOUT 5 // unit: sec +#define MAC_TABLE_AGEOUT_TIME 300 // unit: sec +#define MAC_TABLE_ASSOC_TIMEOUT 5 // unit: sec #define MAC_TABLE_FULL(Tab) ((Tab).size == MAX_LEN_OF_MAC_TABLE) // AP shall drop the sta if contine Tx fail count reach it. -#define MAC_ENTRY_LIFE_CHECK_CNT 20 // packet cnt. +#define MAC_ENTRY_LIFE_CHECK_CNT 20 // packet cnt. // Value domain of pMacEntry->Sst typedef enum _Sst { - SST_NOT_AUTH, // 0: equivalent to IEEE 802.11/1999 state 1 - SST_AUTH, // 1: equivalent to IEEE 802.11/1999 state 2 - SST_ASSOC // 2: equivalent to IEEE 802.11/1999 state 3 + SST_NOT_AUTH, // 0: equivalent to IEEE 802.11/1999 state 1 + SST_AUTH, // 1: equivalent to IEEE 802.11/1999 state 2 + SST_ASSOC // 2: equivalent to IEEE 802.11/1999 state 3 } SST; // value domain of pMacEntry->AuthState typedef enum _AuthState { - AS_NOT_AUTH, - AS_AUTH_OPEN, // STA has been authenticated using OPEN SYSTEM - AS_AUTH_KEY, // STA has been authenticated using SHARED KEY - AS_AUTHENTICATING // STA is waiting for AUTH seq#3 using SHARED KEY + AS_NOT_AUTH, + AS_AUTH_OPEN, // STA has been authenticated using OPEN SYSTEM + AS_AUTH_KEY, // STA has been authenticated using SHARED KEY + AS_AUTHENTICATING // STA is waiting for AUTH seq#3 using SHARED KEY } AUTH_STATE; //for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114 typedef enum _ApWpaState { - AS_NOTUSE, // 0 - AS_DISCONNECT, // 1 - AS_DISCONNECTED, // 2 - AS_INITIALIZE, // 3 - AS_AUTHENTICATION, // 4 - AS_AUTHENTICATION2, // 5 - AS_INITPMK, // 6 - AS_INITPSK, // 7 - AS_PTKSTART, // 8 - AS_PTKINIT_NEGOTIATING, // 9 - AS_PTKINITDONE, // 10 - AS_UPDATEKEYS, // 11 - AS_INTEGRITY_FAILURE, // 12 - AS_KEYUPDATE, // 13 + AS_NOTUSE, // 0 + AS_DISCONNECT, // 1 + AS_DISCONNECTED, // 2 + AS_INITIALIZE, // 3 + AS_AUTHENTICATION, // 4 + AS_AUTHENTICATION2, // 5 + AS_INITPMK, // 6 + AS_INITPSK, // 7 + AS_PTKSTART, // 8 + AS_PTKINIT_NEGOTIATING, // 9 + AS_PTKINITDONE, // 10 + AS_UPDATEKEYS, // 11 + AS_INTEGRITY_FAILURE, // 12 + AS_KEYUPDATE, // 13 } AP_WPA_STATE; // for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114 typedef enum _GTKState { - REKEY_NEGOTIATING, - REKEY_ESTABLISHED, - KEYERROR, + REKEY_NEGOTIATING, + REKEY_ESTABLISHED, + KEYERROR, } GTK_STATE; // for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114 typedef enum _WpaGTKState { - SETKEYS, - SETKEYS_DONE, + SETKEYS, + SETKEYS_DONE, } WPA_GTK_STATE; // ====================== end of AP mlme.h ============================ - -#endif // MLME_H__ +#endif // MLME_H__ diff --git a/drivers/staging/rt2860/oid.h b/drivers/staging/rt2860/oid.h index f3fb5ff74061..54fac1c135b8 100644 --- a/drivers/staging/rt2860/oid.h +++ b/drivers/staging/rt2860/oid.h @@ -48,12 +48,12 @@ // // IEEE 802.11 Structures and definitions // -#define MAX_TX_POWER_LEVEL 100 /* mW */ -#define MAX_RSSI_TRIGGER -10 /* dBm */ -#define MIN_RSSI_TRIGGER -200 /* dBm */ -#define MAX_FRAG_THRESHOLD 2346 /* byte count */ -#define MIN_FRAG_THRESHOLD 256 /* byte count */ -#define MAX_RTS_THRESHOLD 2347 /* byte count */ +#define MAX_TX_POWER_LEVEL 100 /* mW */ +#define MAX_RSSI_TRIGGER -10 /* dBm */ +#define MIN_RSSI_TRIGGER -200 /* dBm */ +#define MAX_FRAG_THRESHOLD 2346 /* byte count */ +#define MIN_FRAG_THRESHOLD 256 /* byte count */ +#define MAX_RTS_THRESHOLD 2347 /* byte count */ // new types for Media Specific Indications // Extension channel offset @@ -78,15 +78,14 @@ #define NDIS_802_11_LENGTH_RATES 8 #define NDIS_802_11_LENGTH_RATES_EX 16 #define MAC_ADDR_LENGTH 6 -//#define MAX_NUM_OF_CHS 49 // 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL terminationc -#define MAX_NUM_OF_CHS 54 // 14 channels @2.4G + 12@UNII(lower/middle) + 16@HiperLAN2 + 11@UNII(upper) + 0 @Japan + 1 as NULL termination -#define MAX_NUMBER_OF_EVENT 10 // entry # in EVENT table -#define MAX_NUMBER_OF_MAC 32 // if MAX_MBSSID_NUM is 8, this value can't be larger than 211 +//#define MAX_NUM_OF_CHS 49 // 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL terminationc +#define MAX_NUM_OF_CHS 54 // 14 channels @2.4G + 12@UNII(lower/middle) + 16@HiperLAN2 + 11@UNII(upper) + 0 @Japan + 1 as NULL termination +#define MAX_NUMBER_OF_EVENT 10 // entry # in EVENT table +#define MAX_NUMBER_OF_MAC 32 // if MAX_MBSSID_NUM is 8, this value can't be larger than 211 #define MAX_NUMBER_OF_ACL 64 -#define MAX_LENGTH_OF_SUPPORT_RATES 12 // 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 +#define MAX_LENGTH_OF_SUPPORT_RATES 12 // 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 #define MAX_NUMBER_OF_DLS_ENTRY 4 - #define RT_QUERY_SIGNAL_CONTEXT 0x0402 #define RT_SET_IAPP_PID 0x0404 #define RT_SET_APD_PID 0x0405 @@ -129,19 +128,17 @@ #define RT_OID_DRIVER_DEVICE_NAME 0x0645 #define RT_OID_QUERY_MULTIPLE_CARD_SUPPORT 0x0647 -typedef enum _NDIS_802_11_STATUS_TYPE -{ - Ndis802_11StatusType_Authentication, - Ndis802_11StatusType_MediaStreamMode, - Ndis802_11StatusType_PMKID_CandidateList, - Ndis802_11StatusTypeMax // not a real type, defined as an upper bound +typedef enum _NDIS_802_11_STATUS_TYPE { + Ndis802_11StatusType_Authentication, + Ndis802_11StatusType_MediaStreamMode, + Ndis802_11StatusType_PMKID_CandidateList, + Ndis802_11StatusTypeMax // not a real type, defined as an upper bound } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE; -typedef UCHAR NDIS_802_11_MAC_ADDRESS[6]; +typedef UCHAR NDIS_802_11_MAC_ADDRESS[6]; -typedef struct _NDIS_802_11_STATUS_INDICATION -{ - NDIS_802_11_STATUS_TYPE StatusType; +typedef struct _NDIS_802_11_STATUS_INDICATION { + NDIS_802_11_STATUS_TYPE StatusType; } NDIS_802_11_STATUS_INDICATION, *PNDIS_802_11_STATUS_INDICATION; // mask for authentication/integrity fields @@ -152,313 +149,283 @@ typedef struct _NDIS_802_11_STATUS_INDICATION #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E -typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST -{ - ULONG Length; // Length of structure - NDIS_802_11_MAC_ADDRESS Bssid; - ULONG Flags; +typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST { + ULONG Length; // Length of structure + NDIS_802_11_MAC_ADDRESS Bssid; + ULONG Flags; } NDIS_802_11_AUTHENTICATION_REQUEST, *PNDIS_802_11_AUTHENTICATION_REQUEST; //Added new types for PMKID Candidate lists. typedef struct _PMKID_CANDIDATE { - NDIS_802_11_MAC_ADDRESS BSSID; - ULONG Flags; + NDIS_802_11_MAC_ADDRESS BSSID; + ULONG Flags; } PMKID_CANDIDATE, *PPMKID_CANDIDATE; -typedef struct _NDIS_802_11_PMKID_CANDIDATE_LIST -{ - ULONG Version; // Version of the structure - ULONG NumCandidates; // No. of pmkid candidates - PMKID_CANDIDATE CandidateList[1]; +typedef struct _NDIS_802_11_PMKID_CANDIDATE_LIST { + ULONG Version; // Version of the structure + ULONG NumCandidates; // No. of pmkid candidates + PMKID_CANDIDATE CandidateList[1]; } NDIS_802_11_PMKID_CANDIDATE_LIST, *PNDIS_802_11_PMKID_CANDIDATE_LIST; //Flags for PMKID Candidate list structure #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01 // Added new types for OFDM 5G and 2.4G -typedef enum _NDIS_802_11_NETWORK_TYPE -{ - Ndis802_11FH, - Ndis802_11DS, - Ndis802_11OFDM5, - Ndis802_11OFDM24, - Ndis802_11Automode, - Ndis802_11OFDM5_N, - Ndis802_11OFDM24_N, - Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound +typedef enum _NDIS_802_11_NETWORK_TYPE { + Ndis802_11FH, + Ndis802_11DS, + Ndis802_11OFDM5, + Ndis802_11OFDM24, + Ndis802_11Automode, + Ndis802_11OFDM5_N, + Ndis802_11OFDM24_N, + Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound } NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE; -typedef struct _NDIS_802_11_NETWORK_TYPE_LIST -{ - UINT NumberOfItems; // in list below, at least 1 - NDIS_802_11_NETWORK_TYPE NetworkType [1]; +typedef struct _NDIS_802_11_NETWORK_TYPE_LIST { + UINT NumberOfItems; // in list below, at least 1 + NDIS_802_11_NETWORK_TYPE NetworkType[1]; } NDIS_802_11_NETWORK_TYPE_LIST, *PNDIS_802_11_NETWORK_TYPE_LIST; -typedef enum _NDIS_802_11_POWER_MODE -{ - Ndis802_11PowerModeCAM, - Ndis802_11PowerModeMAX_PSP, - Ndis802_11PowerModeFast_PSP, - Ndis802_11PowerModeLegacy_PSP, - Ndis802_11PowerModeMax // not a real mode, defined as an upper bound +typedef enum _NDIS_802_11_POWER_MODE { + Ndis802_11PowerModeCAM, + Ndis802_11PowerModeMAX_PSP, + Ndis802_11PowerModeFast_PSP, + Ndis802_11PowerModeLegacy_PSP, + Ndis802_11PowerModeMax // not a real mode, defined as an upper bound } NDIS_802_11_POWER_MODE, *PNDIS_802_11_POWER_MODE; -typedef ULONG NDIS_802_11_TX_POWER_LEVEL; // in milliwatts +typedef ULONG NDIS_802_11_TX_POWER_LEVEL; // in milliwatts // // Received Signal Strength Indication // -typedef LONG NDIS_802_11_RSSI; // in dBm - -typedef struct _NDIS_802_11_CONFIGURATION_FH -{ - ULONG Length; // Length of structure - ULONG HopPattern; // As defined by 802.11, MSB set - ULONG HopSet; // to one if non-802.11 - ULONG DwellTime; // units are Kusec +typedef LONG NDIS_802_11_RSSI; // in dBm + +typedef struct _NDIS_802_11_CONFIGURATION_FH { + ULONG Length; // Length of structure + ULONG HopPattern; // As defined by 802.11, MSB set + ULONG HopSet; // to one if non-802.11 + ULONG DwellTime; // units are Kusec } NDIS_802_11_CONFIGURATION_FH, *PNDIS_802_11_CONFIGURATION_FH; -typedef struct _NDIS_802_11_CONFIGURATION -{ - ULONG Length; // Length of structure - ULONG BeaconPeriod; // units are Kusec - ULONG ATIMWindow; // units are Kusec - ULONG DSConfig; // Frequency, units are kHz - NDIS_802_11_CONFIGURATION_FH FHConfig; +typedef struct _NDIS_802_11_CONFIGURATION { + ULONG Length; // Length of structure + ULONG BeaconPeriod; // units are Kusec + ULONG ATIMWindow; // units are Kusec + ULONG DSConfig; // Frequency, units are kHz + NDIS_802_11_CONFIGURATION_FH FHConfig; } NDIS_802_11_CONFIGURATION, *PNDIS_802_11_CONFIGURATION; -typedef struct _NDIS_802_11_STATISTICS -{ - ULONG Length; // Length of structure - LARGE_INTEGER TransmittedFragmentCount; - LARGE_INTEGER MulticastTransmittedFrameCount; - LARGE_INTEGER FailedCount; - LARGE_INTEGER RetryCount; - LARGE_INTEGER MultipleRetryCount; - LARGE_INTEGER RTSSuccessCount; - LARGE_INTEGER RTSFailureCount; - LARGE_INTEGER ACKFailureCount; - LARGE_INTEGER FrameDuplicateCount; - LARGE_INTEGER ReceivedFragmentCount; - LARGE_INTEGER MulticastReceivedFrameCount; - LARGE_INTEGER FCSErrorCount; - LARGE_INTEGER TKIPLocalMICFailures; - LARGE_INTEGER TKIPRemoteMICErrors; - LARGE_INTEGER TKIPICVErrors; - LARGE_INTEGER TKIPCounterMeasuresInvoked; - LARGE_INTEGER TKIPReplays; - LARGE_INTEGER CCMPFormatErrors; - LARGE_INTEGER CCMPReplays; - LARGE_INTEGER CCMPDecryptErrors; - LARGE_INTEGER FourWayHandshakeFailures; +typedef struct _NDIS_802_11_STATISTICS { + ULONG Length; // Length of structure + LARGE_INTEGER TransmittedFragmentCount; + LARGE_INTEGER MulticastTransmittedFrameCount; + LARGE_INTEGER FailedCount; + LARGE_INTEGER RetryCount; + LARGE_INTEGER MultipleRetryCount; + LARGE_INTEGER RTSSuccessCount; + LARGE_INTEGER RTSFailureCount; + LARGE_INTEGER ACKFailureCount; + LARGE_INTEGER FrameDuplicateCount; + LARGE_INTEGER ReceivedFragmentCount; + LARGE_INTEGER MulticastReceivedFrameCount; + LARGE_INTEGER FCSErrorCount; + LARGE_INTEGER TKIPLocalMICFailures; + LARGE_INTEGER TKIPRemoteMICErrors; + LARGE_INTEGER TKIPICVErrors; + LARGE_INTEGER TKIPCounterMeasuresInvoked; + LARGE_INTEGER TKIPReplays; + LARGE_INTEGER CCMPFormatErrors; + LARGE_INTEGER CCMPReplays; + LARGE_INTEGER CCMPDecryptErrors; + LARGE_INTEGER FourWayHandshakeFailures; } NDIS_802_11_STATISTICS, *PNDIS_802_11_STATISTICS; -typedef ULONG NDIS_802_11_KEY_INDEX; -typedef ULONGLONG NDIS_802_11_KEY_RSC; +typedef ULONG NDIS_802_11_KEY_INDEX; +typedef ULONGLONG NDIS_802_11_KEY_RSC; -#define MAX_RADIUS_SRV_NUM 2 // 802.1x failover number +#define MAX_RADIUS_SRV_NUM 2 // 802.1x failover number typedef struct PACKED _RADIUS_SRV_INFO { - UINT32 radius_ip; - UINT32 radius_port; - UCHAR radius_key[64]; - UCHAR radius_key_len; + UINT32 radius_ip; + UINT32 radius_port; + UCHAR radius_key[64]; + UCHAR radius_key_len; } RADIUS_SRV_INFO, *PRADIUS_SRV_INFO; -typedef struct PACKED _RADIUS_KEY_INFO -{ - UCHAR radius_srv_num; - RADIUS_SRV_INFO radius_srv_info[MAX_RADIUS_SRV_NUM]; - UCHAR ieee8021xWEP; // dynamic WEP - UCHAR key_index; - UCHAR key_length; // length of key in bytes - UCHAR key_material[13]; +typedef struct PACKED _RADIUS_KEY_INFO { + UCHAR radius_srv_num; + RADIUS_SRV_INFO radius_srv_info[MAX_RADIUS_SRV_NUM]; + UCHAR ieee8021xWEP; // dynamic WEP + UCHAR key_index; + UCHAR key_length; // length of key in bytes + UCHAR key_material[13]; } RADIUS_KEY_INFO, *PRADIUS_KEY_INFO; // It's used by 802.1x daemon to require relative configuration -typedef struct PACKED _RADIUS_CONF -{ - UINT32 Length; // Length of this structure - UCHAR mbss_num; // indicate multiple BSS number - UINT32 own_ip_addr; - UINT32 retry_interval; - UINT32 session_timeout_interval; - UCHAR EAPifname[8][IFNAMSIZ]; - UCHAR EAPifname_len[8]; - UCHAR PreAuthifname[8][IFNAMSIZ]; - UCHAR PreAuthifname_len[8]; - RADIUS_KEY_INFO RadiusInfo[8]; +typedef struct PACKED _RADIUS_CONF { + UINT32 Length; // Length of this structure + UCHAR mbss_num; // indicate multiple BSS number + UINT32 own_ip_addr; + UINT32 retry_interval; + UINT32 session_timeout_interval; + UCHAR EAPifname[8][IFNAMSIZ]; + UCHAR EAPifname_len[8]; + UCHAR PreAuthifname[8][IFNAMSIZ]; + UCHAR PreAuthifname_len[8]; + RADIUS_KEY_INFO RadiusInfo[8]; } RADIUS_CONF, *PRADIUS_CONF; - - // Key mapping keys require a BSSID -typedef struct _NDIS_802_11_KEY -{ - UINT Length; // Length of this structure - UINT KeyIndex; - UINT KeyLength; // length of key in bytes - NDIS_802_11_MAC_ADDRESS BSSID; - NDIS_802_11_KEY_RSC KeyRSC; - UCHAR KeyMaterial[1]; // variable length depending on above field +typedef struct _NDIS_802_11_KEY { + UINT Length; // Length of this structure + UINT KeyIndex; + UINT KeyLength; // length of key in bytes + NDIS_802_11_MAC_ADDRESS BSSID; + NDIS_802_11_KEY_RSC KeyRSC; + UCHAR KeyMaterial[1]; // variable length depending on above field } NDIS_802_11_KEY, *PNDIS_802_11_KEY; -typedef struct _NDIS_802_11_PASSPHRASE -{ - UINT KeyLength; // length of key in bytes - NDIS_802_11_MAC_ADDRESS BSSID; - UCHAR KeyMaterial[1]; // variable length depending on above field +typedef struct _NDIS_802_11_PASSPHRASE { + UINT KeyLength; // length of key in bytes + NDIS_802_11_MAC_ADDRESS BSSID; + UCHAR KeyMaterial[1]; // variable length depending on above field } NDIS_802_11_PASSPHRASE, *PNDIS_802_11_PASSPHRASE; -typedef struct _NDIS_802_11_REMOVE_KEY -{ - UINT Length; // Length of this structure - UINT KeyIndex; - NDIS_802_11_MAC_ADDRESS BSSID; +typedef struct _NDIS_802_11_REMOVE_KEY { + UINT Length; // Length of this structure + UINT KeyIndex; + NDIS_802_11_MAC_ADDRESS BSSID; } NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY; -typedef struct _NDIS_802_11_WEP -{ - UINT Length; // Length of this structure - UINT KeyIndex; // 0 is the per-client key, 1-N are the - // global keys - UINT KeyLength; // length of key in bytes - UCHAR KeyMaterial[1];// variable length depending on above field +typedef struct _NDIS_802_11_WEP { + UINT Length; // Length of this structure + UINT KeyIndex; // 0 is the per-client key, 1-N are the + // global keys + UINT KeyLength; // length of key in bytes + UCHAR KeyMaterial[1]; // variable length depending on above field } NDIS_802_11_WEP, *PNDIS_802_11_WEP; - -typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE -{ - Ndis802_11IBSS, - Ndis802_11Infrastructure, - Ndis802_11AutoUnknown, - Ndis802_11Monitor, - Ndis802_11InfrastructureMax // Not a real value, defined as upper bound +typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE { + Ndis802_11IBSS, + Ndis802_11Infrastructure, + Ndis802_11AutoUnknown, + Ndis802_11Monitor, + Ndis802_11InfrastructureMax // Not a real value, defined as upper bound } NDIS_802_11_NETWORK_INFRASTRUCTURE, *PNDIS_802_11_NETWORK_INFRASTRUCTURE; // Add new authentication modes -typedef enum _NDIS_802_11_AUTHENTICATION_MODE -{ - Ndis802_11AuthModeOpen, - Ndis802_11AuthModeShared, - Ndis802_11AuthModeAutoSwitch, - Ndis802_11AuthModeWPA, - Ndis802_11AuthModeWPAPSK, - Ndis802_11AuthModeWPANone, - Ndis802_11AuthModeWPA2, - Ndis802_11AuthModeWPA2PSK, - Ndis802_11AuthModeWPA1WPA2, +typedef enum _NDIS_802_11_AUTHENTICATION_MODE { + Ndis802_11AuthModeOpen, + Ndis802_11AuthModeShared, + Ndis802_11AuthModeAutoSwitch, + Ndis802_11AuthModeWPA, + Ndis802_11AuthModeWPAPSK, + Ndis802_11AuthModeWPANone, + Ndis802_11AuthModeWPA2, + Ndis802_11AuthModeWPA2PSK, + Ndis802_11AuthModeWPA1WPA2, Ndis802_11AuthModeWPA1PSKWPA2PSK, - Ndis802_11AuthModeMax // Not a real mode, defined as upper bound + Ndis802_11AuthModeMax // Not a real mode, defined as upper bound } NDIS_802_11_AUTHENTICATION_MODE, *PNDIS_802_11_AUTHENTICATION_MODE; -typedef UCHAR NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; // Set of 8 data rates -typedef UCHAR NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; // Set of 16 data rates +typedef UCHAR NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; // Set of 8 data rates +typedef UCHAR NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; // Set of 16 data rates -typedef struct PACKED _NDIS_802_11_SSID -{ - UINT SsidLength; // length of SSID field below, in bytes; - // this can be zero. - UCHAR Ssid[NDIS_802_11_LENGTH_SSID]; // SSID information field +typedef struct PACKED _NDIS_802_11_SSID { + UINT SsidLength; // length of SSID field below, in bytes; + // this can be zero. + UCHAR Ssid[NDIS_802_11_LENGTH_SSID]; // SSID information field } NDIS_802_11_SSID, *PNDIS_802_11_SSID; - -typedef struct PACKED _NDIS_WLAN_BSSID -{ - ULONG Length; // Length of this structure - NDIS_802_11_MAC_ADDRESS MacAddress; // BSSID - UCHAR Reserved[2]; - NDIS_802_11_SSID Ssid; // SSID - ULONG Privacy; // WEP encryption requirement - NDIS_802_11_RSSI Rssi; // receive signal strength in dBm - NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; - NDIS_802_11_CONFIGURATION Configuration; - NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; - NDIS_802_11_RATES SupportedRates; +typedef struct PACKED _NDIS_WLAN_BSSID { + ULONG Length; // Length of this structure + NDIS_802_11_MAC_ADDRESS MacAddress; // BSSID + UCHAR Reserved[2]; + NDIS_802_11_SSID Ssid; // SSID + ULONG Privacy; // WEP encryption requirement + NDIS_802_11_RSSI Rssi; // receive signal strength in dBm + NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; + NDIS_802_11_CONFIGURATION Configuration; + NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; + NDIS_802_11_RATES SupportedRates; } NDIS_WLAN_BSSID, *PNDIS_WLAN_BSSID; -typedef struct PACKED _NDIS_802_11_BSSID_LIST -{ - UINT NumberOfItems; // in list below, at least 1 - NDIS_WLAN_BSSID Bssid[1]; +typedef struct PACKED _NDIS_802_11_BSSID_LIST { + UINT NumberOfItems; // in list below, at least 1 + NDIS_WLAN_BSSID Bssid[1]; } NDIS_802_11_BSSID_LIST, *PNDIS_802_11_BSSID_LIST; // Added Capabilities, IELength and IEs for each BSSID -typedef struct PACKED _NDIS_WLAN_BSSID_EX -{ - ULONG Length; // Length of this structure - NDIS_802_11_MAC_ADDRESS MacAddress; // BSSID - UCHAR Reserved[2]; - NDIS_802_11_SSID Ssid; // SSID - UINT Privacy; // WEP encryption requirement - NDIS_802_11_RSSI Rssi; // receive signal - // strength in dBm - NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; - NDIS_802_11_CONFIGURATION Configuration; - NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; - NDIS_802_11_RATES_EX SupportedRates; - ULONG IELength; - UCHAR IEs[1]; +typedef struct PACKED _NDIS_WLAN_BSSID_EX { + ULONG Length; // Length of this structure + NDIS_802_11_MAC_ADDRESS MacAddress; // BSSID + UCHAR Reserved[2]; + NDIS_802_11_SSID Ssid; // SSID + UINT Privacy; // WEP encryption requirement + NDIS_802_11_RSSI Rssi; // receive signal + // strength in dBm + NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; + NDIS_802_11_CONFIGURATION Configuration; + NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; + NDIS_802_11_RATES_EX SupportedRates; + ULONG IELength; + UCHAR IEs[1]; } NDIS_WLAN_BSSID_EX, *PNDIS_WLAN_BSSID_EX; -typedef struct PACKED _NDIS_802_11_BSSID_LIST_EX -{ - UINT NumberOfItems; // in list below, at least 1 - NDIS_WLAN_BSSID_EX Bssid[1]; +typedef struct PACKED _NDIS_802_11_BSSID_LIST_EX { + UINT NumberOfItems; // in list below, at least 1 + NDIS_WLAN_BSSID_EX Bssid[1]; } NDIS_802_11_BSSID_LIST_EX, *PNDIS_802_11_BSSID_LIST_EX; -typedef struct PACKED _NDIS_802_11_FIXED_IEs -{ - UCHAR Timestamp[8]; - USHORT BeaconInterval; - USHORT Capabilities; +typedef struct PACKED _NDIS_802_11_FIXED_IEs { + UCHAR Timestamp[8]; + USHORT BeaconInterval; + USHORT Capabilities; } NDIS_802_11_FIXED_IEs, *PNDIS_802_11_FIXED_IEs; -typedef struct _NDIS_802_11_VARIABLE_IEs -{ - UCHAR ElementID; - UCHAR Length; // Number of bytes in data field - UCHAR data[1]; +typedef struct _NDIS_802_11_VARIABLE_IEs { + UCHAR ElementID; + UCHAR Length; // Number of bytes in data field + UCHAR data[1]; } NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs; -typedef ULONG NDIS_802_11_FRAGMENTATION_THRESHOLD; +typedef ULONG NDIS_802_11_FRAGMENTATION_THRESHOLD; -typedef ULONG NDIS_802_11_RTS_THRESHOLD; +typedef ULONG NDIS_802_11_RTS_THRESHOLD; -typedef ULONG NDIS_802_11_ANTENNA; +typedef ULONG NDIS_802_11_ANTENNA; -typedef enum _NDIS_802_11_PRIVACY_FILTER -{ - Ndis802_11PrivFilterAcceptAll, - Ndis802_11PrivFilter8021xWEP +typedef enum _NDIS_802_11_PRIVACY_FILTER { + Ndis802_11PrivFilterAcceptAll, + Ndis802_11PrivFilter8021xWEP } NDIS_802_11_PRIVACY_FILTER, *PNDIS_802_11_PRIVACY_FILTER; // Added new encryption types // Also aliased typedef to new name -typedef enum _NDIS_802_11_WEP_STATUS -{ - Ndis802_11WEPEnabled, - Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled, - Ndis802_11WEPDisabled, - Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled, - Ndis802_11WEPKeyAbsent, - Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent, - Ndis802_11WEPNotSupported, - Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported, - Ndis802_11Encryption2Enabled, - Ndis802_11Encryption2KeyAbsent, - Ndis802_11Encryption3Enabled, - Ndis802_11Encryption3KeyAbsent, - Ndis802_11Encryption4Enabled, // TKIP or AES mix - Ndis802_11Encryption4KeyAbsent, - Ndis802_11GroupWEP40Enabled, +typedef enum _NDIS_802_11_WEP_STATUS { + Ndis802_11WEPEnabled, + Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled, + Ndis802_11WEPDisabled, + Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled, + Ndis802_11WEPKeyAbsent, + Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent, + Ndis802_11WEPNotSupported, + Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported, + Ndis802_11Encryption2Enabled, + Ndis802_11Encryption2KeyAbsent, + Ndis802_11Encryption3Enabled, + Ndis802_11Encryption3KeyAbsent, + Ndis802_11Encryption4Enabled, // TKIP or AES mix + Ndis802_11Encryption4KeyAbsent, + Ndis802_11GroupWEP40Enabled, Ndis802_11GroupWEP104Enabled, } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS, - NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS; + NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS; -typedef enum _NDIS_802_11_RELOAD_DEFAULTS -{ - Ndis802_11ReloadWEPKeys +typedef enum _NDIS_802_11_RELOAD_DEFAULTS { + Ndis802_11ReloadWEPKeys } NDIS_802_11_RELOAD_DEFAULTS, *PNDIS_802_11_RELOAD_DEFAULTS; #define NDIS_802_11_AI_REQFI_CAPABILITIES 1 @@ -469,122 +436,110 @@ typedef enum _NDIS_802_11_RELOAD_DEFAULTS #define NDIS_802_11_AI_RESFI_STATUSCODE 2 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4 -typedef struct _NDIS_802_11_AI_REQFI -{ - USHORT Capabilities; - USHORT ListenInterval; - NDIS_802_11_MAC_ADDRESS CurrentAPAddress; +typedef struct _NDIS_802_11_AI_REQFI { + USHORT Capabilities; + USHORT ListenInterval; + NDIS_802_11_MAC_ADDRESS CurrentAPAddress; } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI; -typedef struct _NDIS_802_11_AI_RESFI -{ - USHORT Capabilities; - USHORT StatusCode; - USHORT AssociationId; +typedef struct _NDIS_802_11_AI_RESFI { + USHORT Capabilities; + USHORT StatusCode; + USHORT AssociationId; } NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI; -typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION -{ - ULONG Length; - USHORT AvailableRequestFixedIEs; - NDIS_802_11_AI_REQFI RequestFixedIEs; - ULONG RequestIELength; - ULONG OffsetRequestIEs; - USHORT AvailableResponseFixedIEs; - NDIS_802_11_AI_RESFI ResponseFixedIEs; - ULONG ResponseIELength; - ULONG OffsetResponseIEs; +typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION { + ULONG Length; + USHORT AvailableRequestFixedIEs; + NDIS_802_11_AI_REQFI RequestFixedIEs; + ULONG RequestIELength; + ULONG OffsetRequestIEs; + USHORT AvailableResponseFixedIEs; + NDIS_802_11_AI_RESFI ResponseFixedIEs; + ULONG ResponseIELength; + ULONG OffsetResponseIEs; } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION; -typedef struct _NDIS_802_11_AUTHENTICATION_EVENT -{ - NDIS_802_11_STATUS_INDICATION Status; - NDIS_802_11_AUTHENTICATION_REQUEST Request[1]; +typedef struct _NDIS_802_11_AUTHENTICATION_EVENT { + NDIS_802_11_STATUS_INDICATION Status; + NDIS_802_11_AUTHENTICATION_REQUEST Request[1]; } NDIS_802_11_AUTHENTICATION_EVENT, *PNDIS_802_11_AUTHENTICATION_EVENT; // 802.11 Media stream constraints, associated with OID_802_11_MEDIA_STREAM_MODE -typedef enum _NDIS_802_11_MEDIA_STREAM_MODE -{ - Ndis802_11MediaStreamOff, - Ndis802_11MediaStreamOn, +typedef enum _NDIS_802_11_MEDIA_STREAM_MODE { + Ndis802_11MediaStreamOff, + Ndis802_11MediaStreamOn, } NDIS_802_11_MEDIA_STREAM_MODE, *PNDIS_802_11_MEDIA_STREAM_MODE; // PMKID Structures -typedef UCHAR NDIS_802_11_PMKID_VALUE[16]; +typedef UCHAR NDIS_802_11_PMKID_VALUE[16]; -typedef struct _BSSID_INFO -{ - NDIS_802_11_MAC_ADDRESS BSSID; - NDIS_802_11_PMKID_VALUE PMKID; +typedef struct _BSSID_INFO { + NDIS_802_11_MAC_ADDRESS BSSID; + NDIS_802_11_PMKID_VALUE PMKID; } BSSID_INFO, *PBSSID_INFO; -typedef struct _NDIS_802_11_PMKID -{ - UINT Length; - UINT BSSIDInfoCount; - BSSID_INFO BSSIDInfo[1]; +typedef struct _NDIS_802_11_PMKID { + UINT Length; + UINT BSSIDInfoCount; + BSSID_INFO BSSIDInfo[1]; } NDIS_802_11_PMKID, *PNDIS_802_11_PMKID; -typedef struct _NDIS_802_11_AUTHENTICATION_ENCRYPTION -{ - NDIS_802_11_AUTHENTICATION_MODE AuthModeSupported; - NDIS_802_11_ENCRYPTION_STATUS EncryptStatusSupported; -} NDIS_802_11_AUTHENTICATION_ENCRYPTION, *PNDIS_802_11_AUTHENTICATION_ENCRYPTION; - -typedef struct _NDIS_802_11_CAPABILITY -{ - ULONG Length; - ULONG Version; - ULONG NoOfPMKIDs; - ULONG NoOfAuthEncryptPairsSupported; - NDIS_802_11_AUTHENTICATION_ENCRYPTION AuthenticationEncryptionSupported[1]; +typedef struct _NDIS_802_11_AUTHENTICATION_ENCRYPTION { + NDIS_802_11_AUTHENTICATION_MODE AuthModeSupported; + NDIS_802_11_ENCRYPTION_STATUS EncryptStatusSupported; +} NDIS_802_11_AUTHENTICATION_ENCRYPTION, + *PNDIS_802_11_AUTHENTICATION_ENCRYPTION; + +typedef struct _NDIS_802_11_CAPABILITY { + ULONG Length; + ULONG Version; + ULONG NoOfPMKIDs; + ULONG NoOfAuthEncryptPairsSupported; + NDIS_802_11_AUTHENTICATION_ENCRYPTION + AuthenticationEncryptionSupported[1]; } NDIS_802_11_CAPABILITY, *PNDIS_802_11_CAPABILITY; -#define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x01) // Sync. with AP for wsc upnp daemon +#define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x01) // Sync. with AP for wsc upnp daemon #define RTPRIV_IOCTL_SET (SIOCIWFIRSTPRIV + 0x02) #define RTPRIV_IOCTL_STATISTICS (SIOCIWFIRSTPRIV + 0x09) #define RTPRIV_IOCTL_ADD_PMKID_CACHE (SIOCIWFIRSTPRIV + 0x0A) #define RTPRIV_IOCTL_RADIUS_DATA (SIOCIWFIRSTPRIV + 0x0C) #define RTPRIV_IOCTL_GSITESURVEY (SIOCIWFIRSTPRIV + 0x0D) -#define RT_PRIV_IOCTL_EXT (SIOCIWFIRSTPRIV + 0x0E) // Sync. with RT61 (for wpa_supplicant) +#define RT_PRIV_IOCTL_EXT (SIOCIWFIRSTPRIV + 0x0E) // Sync. with RT61 (for wpa_supplicant) #define RTPRIV_IOCTL_GET_MAC_TABLE (SIOCIWFIRSTPRIV + 0x0F) #define RTPRIV_IOCTL_SHOW (SIOCIWFIRSTPRIV + 0x11) enum { - SHOW_CONN_STATUS = 4, - SHOW_DRVIER_VERION = 5, - SHOW_BA_INFO = 6, + SHOW_CONN_STATUS = 4, + SHOW_DRVIER_VERION = 5, + SHOW_BA_INFO = 6, SHOW_DESC_INFO = 7, #ifdef RTMP_MAC_USB SHOW_RXBULK_INFO = 8, SHOW_TXBULK_INFO = 9, #endif // RTMP_MAC_USB // - RAIO_OFF = 10, - RAIO_ON = 11, + RAIO_OFF = 10, + RAIO_ON = 11, SHOW_CFG_VALUE = 20, SHOW_ADHOC_ENTRY_INFO = 21, }; - - - - - #define OID_802_11_BUILD_CHANNEL_EX 0x0714 #define OID_802_11_GET_CH_LIST 0x0715 #define OID_802_11_GET_COUNTRY_CODE 0x0716 #define OID_802_11_GET_CHANNEL_GEOGRAPHY 0x0717 -#define RT_OID_WSC_SET_PASSPHRASE 0x0740 // passphrase for wpa(2)-psk +#define RT_OID_WSC_SET_PASSPHRASE 0x0740 // passphrase for wpa(2)-psk #define RT_OID_WSC_DRIVER_AUTO_CONNECT 0x0741 #define RT_OID_WSC_QUERY_DEFAULT_PROFILE 0x0742 #define RT_OID_WSC_SET_CONN_BY_PROFILE_INDEX 0x0743 #define RT_OID_WSC_SET_ACTION 0x0744 #define RT_OID_WSC_SET_SSID 0x0745 #define RT_OID_WSC_SET_PIN_CODE 0x0746 -#define RT_OID_WSC_SET_MODE 0x0747 // PIN or PBC -#define RT_OID_WSC_SET_CONF_MODE 0x0748 // Enrollee or Registrar +#define RT_OID_WSC_SET_MODE 0x0747 // PIN or PBC +#define RT_OID_WSC_SET_CONF_MODE 0x0748 // Enrollee or Registrar #define RT_OID_WSC_SET_PROFILE 0x0749 #define RT_OID_WSC_CONFIG_STATUS 0x074F #define RT_OID_802_11_WSC_QUERY_PROFILE 0x0750 @@ -604,24 +559,24 @@ enum { #define OID_MH_802_1X_SUPPORTED 0xFFEDC100 // MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!! -typedef union _HTTRANSMIT_SETTING { - struct { - USHORT MCS:7; // MCS - USHORT BW:1; //channel bandwidth 20MHz or 40 MHz - USHORT ShortGI:1; - USHORT STBC:2; //SPACE -// USHORT rsv:3; - USHORT rsv:2; - USHORT TxBF:1; - USHORT MODE:2; // Use definition MODE_xxx. - } field; - USHORT word; - } HTTRANSMIT_SETTING, *PHTTRANSMIT_SETTING; +typedef union _HTTRANSMIT_SETTING { + struct { + USHORT MCS:7; // MCS + USHORT BW:1; //channel bandwidth 20MHz or 40 MHz + USHORT ShortGI:1; + USHORT STBC:2; //SPACE +// USHORT rsv:3; + USHORT rsv:2; + USHORT TxBF:1; + USHORT MODE:2; // Use definition MODE_xxx. + } field; + USHORT word; +} HTTRANSMIT_SETTING, *PHTTRANSMIT_SETTING; typedef enum _RT_802_11_PREAMBLE { - Rt802_11PreambleLong, - Rt802_11PreambleShort, - Rt802_11PreambleAuto + Rt802_11PreambleLong, + Rt802_11PreambleShort, + Rt802_11PreambleAuto } RT_802_11_PREAMBLE, *PRT_802_11_PREAMBLE; typedef enum _RT_802_11_PHY_MODE { @@ -631,200 +586,194 @@ typedef enum _RT_802_11_PHY_MODE { PHY_11ABG_MIXED, PHY_11G, PHY_11ABGN_MIXED, // both band 5 - PHY_11N_2_4G, // 11n-only with 2.4G band 6 - PHY_11GN_MIXED, // 2.4G band 7 - PHY_11AN_MIXED, // 5G band 8 + PHY_11N_2_4G, // 11n-only with 2.4G band 6 + PHY_11GN_MIXED, // 2.4G band 7 + PHY_11AN_MIXED, // 5G band 8 PHY_11BGN_MIXED, // if check 802.11b. 9 PHY_11AGN_MIXED, // if check 802.11b. 10 - PHY_11N_5G, // 11n-only with 5G band 11 + PHY_11N_5G, // 11n-only with 5G band 11 } RT_802_11_PHY_MODE; // put all proprietery for-query objects here to reduce # of Query_OID typedef struct _RT_802_11_LINK_STATUS { - ULONG CurrTxRate; // in units of 0.5Mbps - ULONG ChannelQuality; // 0..100 % - ULONG TxByteCount; // both ok and fail - ULONG RxByteCount; // both ok and fail - ULONG CentralChannel; // 40MHz central channel number + ULONG CurrTxRate; // in units of 0.5Mbps + ULONG ChannelQuality; // 0..100 % + ULONG TxByteCount; // both ok and fail + ULONG RxByteCount; // both ok and fail + ULONG CentralChannel; // 40MHz central channel number } RT_802_11_LINK_STATUS, *PRT_802_11_LINK_STATUS; typedef struct _RT_802_11_EVENT_LOG { - LARGE_INTEGER SystemTime; // timestammp via NdisGetCurrentSystemTime() - UCHAR Addr[MAC_ADDR_LENGTH]; - USHORT Event; // EVENT_xxx + LARGE_INTEGER SystemTime; // timestammp via NdisGetCurrentSystemTime() + UCHAR Addr[MAC_ADDR_LENGTH]; + USHORT Event; // EVENT_xxx } RT_802_11_EVENT_LOG, *PRT_802_11_EVENT_LOG; typedef struct _RT_802_11_EVENT_TABLE { - ULONG Num; - ULONG Rsv; // to align Log[] at LARGE_INEGER boundary - RT_802_11_EVENT_LOG Log[MAX_NUMBER_OF_EVENT]; + ULONG Num; + ULONG Rsv; // to align Log[] at LARGE_INEGER boundary + RT_802_11_EVENT_LOG Log[MAX_NUMBER_OF_EVENT]; } RT_802_11_EVENT_TABLE, PRT_802_11_EVENT_TABLE; // MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!! -typedef union _MACHTTRANSMIT_SETTING { - struct { - USHORT MCS:7; // MCS - USHORT BW:1; //channel bandwidth 20MHz or 40 MHz - USHORT ShortGI:1; - USHORT STBC:2; //SPACE - USHORT rsv:3; - USHORT MODE:2; // Use definition MODE_xxx. - } field; - USHORT word; - } MACHTTRANSMIT_SETTING, *PMACHTTRANSMIT_SETTING; +typedef union _MACHTTRANSMIT_SETTING { + struct { + USHORT MCS:7; // MCS + USHORT BW:1; //channel bandwidth 20MHz or 40 MHz + USHORT ShortGI:1; + USHORT STBC:2; //SPACE + USHORT rsv:3; + USHORT MODE:2; // Use definition MODE_xxx. + } field; + USHORT word; +} MACHTTRANSMIT_SETTING, *PMACHTTRANSMIT_SETTING; typedef struct _RT_802_11_MAC_ENTRY { - UCHAR Addr[MAC_ADDR_LENGTH]; - UCHAR Aid; - UCHAR Psm; // 0:PWR_ACTIVE, 1:PWR_SAVE - UCHAR MimoPs; // 0:MMPS_STATIC, 1:MMPS_DYNAMIC, 3:MMPS_Enabled - CHAR AvgRssi0; - CHAR AvgRssi1; - CHAR AvgRssi2; - UINT32 ConnectedTime; - MACHTTRANSMIT_SETTING TxRate; + UCHAR Addr[MAC_ADDR_LENGTH]; + UCHAR Aid; + UCHAR Psm; // 0:PWR_ACTIVE, 1:PWR_SAVE + UCHAR MimoPs; // 0:MMPS_STATIC, 1:MMPS_DYNAMIC, 3:MMPS_Enabled + CHAR AvgRssi0; + CHAR AvgRssi1; + CHAR AvgRssi2; + UINT32 ConnectedTime; + MACHTTRANSMIT_SETTING TxRate; } RT_802_11_MAC_ENTRY, *PRT_802_11_MAC_ENTRY; typedef struct _RT_802_11_MAC_TABLE { - ULONG Num; - RT_802_11_MAC_ENTRY Entry[MAX_NUMBER_OF_MAC]; + ULONG Num; + RT_802_11_MAC_ENTRY Entry[MAX_NUMBER_OF_MAC]; } RT_802_11_MAC_TABLE, *PRT_802_11_MAC_TABLE; // structure for query/set hardware register - MAC, BBP, RF register typedef struct _RT_802_11_HARDWARE_REGISTER { - ULONG HardwareType; // 0:MAC, 1:BBP, 2:RF register, 3:EEPROM - ULONG Offset; // Q/S register offset addr - ULONG Data; // R/W data buffer + ULONG HardwareType; // 0:MAC, 1:BBP, 2:RF register, 3:EEPROM + ULONG Offset; // Q/S register offset addr + ULONG Data; // R/W data buffer } RT_802_11_HARDWARE_REGISTER, *PRT_802_11_HARDWARE_REGISTER; typedef struct _RT_802_11_AP_CONFIG { - ULONG EnableTxBurst; // 0-disable, 1-enable - ULONG EnableTurboRate; // 0-disable, 1-enable 72/100mbps turbo rate - ULONG IsolateInterStaTraffic; // 0-disable, 1-enable isolation - ULONG HideSsid; // 0-disable, 1-enable hiding - ULONG UseBGProtection; // 0-AUTO, 1-always ON, 2-always OFF - ULONG UseShortSlotTime; // 0-no use, 1-use 9-us short slot time - ULONG Rsv1; // must be 0 - ULONG SystemErrorBitmap; // ignore upon SET, return system error upon QUERY + ULONG EnableTxBurst; // 0-disable, 1-enable + ULONG EnableTurboRate; // 0-disable, 1-enable 72/100mbps turbo rate + ULONG IsolateInterStaTraffic; // 0-disable, 1-enable isolation + ULONG HideSsid; // 0-disable, 1-enable hiding + ULONG UseBGProtection; // 0-AUTO, 1-always ON, 2-always OFF + ULONG UseShortSlotTime; // 0-no use, 1-use 9-us short slot time + ULONG Rsv1; // must be 0 + ULONG SystemErrorBitmap; // ignore upon SET, return system error upon QUERY } RT_802_11_AP_CONFIG, *PRT_802_11_AP_CONFIG; // structure to query/set STA_CONFIG typedef struct _RT_802_11_STA_CONFIG { - ULONG EnableTxBurst; // 0-disable, 1-enable - ULONG EnableTurboRate; // 0-disable, 1-enable 72/100mbps turbo rate - ULONG UseBGProtection; // 0-AUTO, 1-always ON, 2-always OFF - ULONG UseShortSlotTime; // 0-no use, 1-use 9-us short slot time when applicable - ULONG AdhocMode; // 0-11b rates only (WIFI spec), 1 - b/g mixed, 2 - g only - ULONG HwRadioStatus; // 0-OFF, 1-ON, default is 1, Read-Only - ULONG Rsv1; // must be 0 - ULONG SystemErrorBitmap; // ignore upon SET, return system error upon QUERY + ULONG EnableTxBurst; // 0-disable, 1-enable + ULONG EnableTurboRate; // 0-disable, 1-enable 72/100mbps turbo rate + ULONG UseBGProtection; // 0-AUTO, 1-always ON, 2-always OFF + ULONG UseShortSlotTime; // 0-no use, 1-use 9-us short slot time when applicable + ULONG AdhocMode; // 0-11b rates only (WIFI spec), 1 - b/g mixed, 2 - g only + ULONG HwRadioStatus; // 0-OFF, 1-ON, default is 1, Read-Only + ULONG Rsv1; // must be 0 + ULONG SystemErrorBitmap; // ignore upon SET, return system error upon QUERY } RT_802_11_STA_CONFIG, *PRT_802_11_STA_CONFIG; // // For OID Query or Set about BA structure // -typedef struct _OID_BACAP_STRUC { - UCHAR RxBAWinLimit; - UCHAR TxBAWinLimit; - UCHAR Policy; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid - UCHAR MpduDensity; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid - UCHAR AmsduEnable; //Enable AMSDU transmisstion - UCHAR AmsduSize; // 0:3839, 1:7935 bytes. UINT MSDUSizeToBytes[] = { 3839, 7935}; - UCHAR MMPSmode; // MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable - BOOLEAN AutoBA; // Auto BA will automatically +typedef struct _OID_BACAP_STRUC { + UCHAR RxBAWinLimit; + UCHAR TxBAWinLimit; + UCHAR Policy; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid + UCHAR MpduDensity; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid + UCHAR AmsduEnable; //Enable AMSDU transmisstion + UCHAR AmsduSize; // 0:3839, 1:7935 bytes. UINT MSDUSizeToBytes[] = { 3839, 7935}; + UCHAR MMPSmode; // MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable + BOOLEAN AutoBA; // Auto BA will automatically } OID_BACAP_STRUC, *POID_BACAP_STRUC; typedef struct _RT_802_11_ACL_ENTRY { - UCHAR Addr[MAC_ADDR_LENGTH]; - USHORT Rsv; + UCHAR Addr[MAC_ADDR_LENGTH]; + USHORT Rsv; } RT_802_11_ACL_ENTRY, *PRT_802_11_ACL_ENTRY; typedef struct PACKED _RT_802_11_ACL { - ULONG Policy; // 0-disable, 1-positive list, 2-negative list - ULONG Num; - RT_802_11_ACL_ENTRY Entry[MAX_NUMBER_OF_ACL]; + ULONG Policy; // 0-disable, 1-positive list, 2-negative list + ULONG Num; + RT_802_11_ACL_ENTRY Entry[MAX_NUMBER_OF_ACL]; } RT_802_11_ACL, *PRT_802_11_ACL; typedef struct _RT_802_11_WDS { - ULONG Num; - NDIS_802_11_MAC_ADDRESS Entry[24/*MAX_NUM_OF_WDS_LINK*/]; - ULONG KeyLength; - UCHAR KeyMaterial[32]; + ULONG Num; + NDIS_802_11_MAC_ADDRESS Entry[24 /*MAX_NUM_OF_WDS_LINK */ ]; + ULONG KeyLength; + UCHAR KeyMaterial[32]; } RT_802_11_WDS, *PRT_802_11_WDS; typedef struct _RT_802_11_TX_RATES_ { - UCHAR SupRateLen; - UCHAR SupRate[MAX_LENGTH_OF_SUPPORT_RATES]; - UCHAR ExtRateLen; - UCHAR ExtRate[MAX_LENGTH_OF_SUPPORT_RATES]; + UCHAR SupRateLen; + UCHAR SupRate[MAX_LENGTH_OF_SUPPORT_RATES]; + UCHAR ExtRateLen; + UCHAR ExtRate[MAX_LENGTH_OF_SUPPORT_RATES]; } RT_802_11_TX_RATES, *PRT_802_11_TX_RATES; - // Definition of extra information code -#define GENERAL_LINK_UP 0x0 // Link is Up -#define GENERAL_LINK_DOWN 0x1 // Link is Down -#define HW_RADIO_OFF 0x2 // Hardware radio off -#define SW_RADIO_OFF 0x3 // Software radio off -#define AUTH_FAIL 0x4 // Open authentication fail -#define AUTH_FAIL_KEYS 0x5 // Shared authentication fail -#define ASSOC_FAIL 0x6 // Association failed -#define EAP_MIC_FAILURE 0x7 // Deauthencation because MIC failure -#define EAP_4WAY_TIMEOUT 0x8 // Deauthencation on 4-way handshake timeout -#define EAP_GROUP_KEY_TIMEOUT 0x9 // Deauthencation on group key handshake timeout -#define EAP_SUCCESS 0xa // EAP succeed -#define DETECT_RADAR_SIGNAL 0xb // Radar signal occur in current channel -#define EXTRA_INFO_MAX 0xb // Indicate Last OID +#define GENERAL_LINK_UP 0x0 // Link is Up +#define GENERAL_LINK_DOWN 0x1 // Link is Down +#define HW_RADIO_OFF 0x2 // Hardware radio off +#define SW_RADIO_OFF 0x3 // Software radio off +#define AUTH_FAIL 0x4 // Open authentication fail +#define AUTH_FAIL_KEYS 0x5 // Shared authentication fail +#define ASSOC_FAIL 0x6 // Association failed +#define EAP_MIC_FAILURE 0x7 // Deauthencation because MIC failure +#define EAP_4WAY_TIMEOUT 0x8 // Deauthencation on 4-way handshake timeout +#define EAP_GROUP_KEY_TIMEOUT 0x9 // Deauthencation on group key handshake timeout +#define EAP_SUCCESS 0xa // EAP succeed +#define DETECT_RADAR_SIGNAL 0xb // Radar signal occur in current channel +#define EXTRA_INFO_MAX 0xb // Indicate Last OID #define EXTRA_INFO_CLEAR 0xffffffff // This is OID setting structure. So only GF or MM as Mode. This is valid when our wirelss mode has 802.11n in use. typedef struct { - RT_802_11_PHY_MODE PhyMode; // - UCHAR TransmitNo; - UCHAR HtMode; //HTMODE_GF or HTMODE_MM - UCHAR ExtOffset; //extension channel above or below - UCHAR MCS; - UCHAR BW; - UCHAR STBC; - UCHAR SHORTGI; - UCHAR rsv; + RT_802_11_PHY_MODE PhyMode; // + UCHAR TransmitNo; + UCHAR HtMode; //HTMODE_GF or HTMODE_MM + UCHAR ExtOffset; //extension channel above or below + UCHAR MCS; + UCHAR BW; + UCHAR STBC; + UCHAR SHORTGI; + UCHAR rsv; } OID_SET_HT_PHYMODE, *POID_SET_HT_PHYMODE; #define MAX_CUSTOM_LEN 128 -typedef enum _RT_802_11_D_CLIENT_MODE -{ - Rt802_11_D_None, - Rt802_11_D_Flexible, - Rt802_11_D_Strict, +typedef enum _RT_802_11_D_CLIENT_MODE { + Rt802_11_D_None, + Rt802_11_D_Flexible, + Rt802_11_D_Strict, } RT_802_11_D_CLIENT_MODE, *PRT_802_11_D_CLIENT_MODE; -typedef struct _RT_CHANNEL_LIST_INFO -{ - UCHAR ChannelList[MAX_NUM_OF_CHS]; // list all supported channels for site survey - UCHAR ChannelListNum; // number of channel in ChannelList[] +typedef struct _RT_CHANNEL_LIST_INFO { + UCHAR ChannelList[MAX_NUM_OF_CHS]; // list all supported channels for site survey + UCHAR ChannelListNum; // number of channel in ChannelList[] } RT_CHANNEL_LIST_INFO, *PRT_CHANNEL_LIST_INFO; // WSC configured credential -typedef struct _WSC_CREDENTIAL -{ - NDIS_802_11_SSID SSID; // mandatory - USHORT AuthType; // mandatory, 1: open, 2: wpa-psk, 4: shared, 8:wpa, 0x10: wpa2, 0x20: wpa2-psk - USHORT EncrType; // mandatory, 1: none, 2: wep, 4: tkip, 8: aes - UCHAR Key[64]; // mandatory, Maximum 64 byte - USHORT KeyLength; - UCHAR MacAddr[6]; // mandatory, AP MAC address - UCHAR KeyIndex; // optional, default is 1 - UCHAR Rsvd[3]; // Make alignment -} WSC_CREDENTIAL, *PWSC_CREDENTIAL; +typedef struct _WSC_CREDENTIAL { + NDIS_802_11_SSID SSID; // mandatory + USHORT AuthType; // mandatory, 1: open, 2: wpa-psk, 4: shared, 8:wpa, 0x10: wpa2, 0x20: wpa2-psk + USHORT EncrType; // mandatory, 1: none, 2: wep, 4: tkip, 8: aes + UCHAR Key[64]; // mandatory, Maximum 64 byte + USHORT KeyLength; + UCHAR MacAddr[6]; // mandatory, AP MAC address + UCHAR KeyIndex; // optional, default is 1 + UCHAR Rsvd[3]; // Make alignment +} WSC_CREDENTIAL, *PWSC_CREDENTIAL; // WSC configured profiles -typedef struct _WSC_PROFILE -{ - UINT ProfileCnt; - UINT ApplyProfileIdx; // add by johnli, fix WPS test plan 5.1.1 - WSC_CREDENTIAL Profile[8]; // Support up to 8 profiles -} WSC_PROFILE, *PWSC_PROFILE; +typedef struct _WSC_PROFILE { + UINT ProfileCnt; + UINT ApplyProfileIdx; // add by johnli, fix WPS test plan 5.1.1 + WSC_CREDENTIAL Profile[8]; // Support up to 8 profiles +} WSC_PROFILE, *PWSC_PROFILE; #endif // _OID_H_ - diff --git a/drivers/staging/rt2860/rt_config.h b/drivers/staging/rt2860/rt_config.h index 9e684ae1f4bb..8fa3f118c925 100644 --- a/drivers/staging/rt2860/rt_config.h +++ b/drivers/staging/rt2860/rt_config.h @@ -68,5 +68,4 @@ #include "igmp_snoop.h" #endif // IGMP_SNOOP_SUPPORT // -#endif // __RT_CONFIG_H__ - +#endif // __RT_CONFIG_H__ diff --git a/drivers/staging/rt2860/rt_linux.h b/drivers/staging/rt2860/rt_linux.h index d16bcf3bbd39..478c8d0d6e9d 100644 --- a/drivers/staging/rt2860/rt_linux.h +++ b/drivers/staging/rt2860/rt_linux.h @@ -79,7 +79,6 @@ * Profile related sections ***********************************************************************************/ - #ifdef RTMP_MAC_PCI #define STA_PROFILE_PATH "/etc/Wireless/RT2860STA/RT2860STA.dat" #define STA_DRIVER_VERSION "2.1.0.0" @@ -90,8 +89,7 @@ // RT3070 version: 2.1.1.0 #endif // RTMP_MAC_USB // -extern const struct iw_handler_def rt28xx_iw_handler_def; - +extern const struct iw_handler_def rt28xx_iw_handler_def; /*********************************************************************************** * Compiler related definitions @@ -103,23 +101,23 @@ extern const struct iw_handler_def rt28xx_iw_handler_def; #define INOUT #define NDIS_STATUS INT - /*********************************************************************************** * OS Specific definitions and data structures ***********************************************************************************/ -typedef struct pci_dev * PPCI_DEV; -typedef struct net_device * PNET_DEV; -typedef void * PNDIS_PACKET; -typedef char NDIS_PACKET; -typedef PNDIS_PACKET * PPNDIS_PACKET; -typedef dma_addr_t NDIS_PHYSICAL_ADDRESS; -typedef dma_addr_t * PNDIS_PHYSICAL_ADDRESS; -typedef void * NDIS_HANDLE; -typedef char * PNDIS_BUFFER; -typedef struct pid * RTMP_OS_PID; -typedef struct semaphore RTMP_OS_SEM; - -typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_dev); +typedef struct pci_dev *PPCI_DEV; +typedef struct net_device *PNET_DEV; +typedef void *PNDIS_PACKET; +typedef char NDIS_PACKET; +typedef PNDIS_PACKET *PPNDIS_PACKET; +typedef dma_addr_t NDIS_PHYSICAL_ADDRESS; +typedef dma_addr_t *PNDIS_PHYSICAL_ADDRESS; +typedef void *NDIS_HANDLE; +typedef char *PNDIS_BUFFER; +typedef struct pid *RTMP_OS_PID; +typedef struct semaphore RTMP_OS_SEM; + +typedef int (*HARD_START_XMIT_FUNC) (struct sk_buff * skb, + struct net_device * net_dev); #ifdef RTMP_MAC_PCI #ifndef PCI_DEVICE @@ -142,11 +140,8 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_ #define RTMP_DEC_REF(_A) 0 #define RTMP_GET_REF(_A) 0 - // This function will be called when query /proc -struct iw_statistics *rt28xx_get_wireless_stats( - IN struct net_device *net_dev); - +struct iw_statistics *rt28xx_get_wireless_stats(IN struct net_device *net_dev); /*********************************************************************************** * Network related constant definitions @@ -178,18 +173,16 @@ struct iw_statistics *rt28xx_get_wireless_stats( #define STATS_INC_RX_DROPPED(_pAd, _dev) #define STATS_INC_TX_DROPPED(_pAd, _dev) - /*********************************************************************************** * Ralink Specific network related constant definitions ***********************************************************************************/ -#define MIN_NET_DEVICE_FOR_AID 0x00 //0x00~0x3f -#define MIN_NET_DEVICE_FOR_MBSSID 0x00 //0x00,0x10,0x20,0x30 -#define MIN_NET_DEVICE_FOR_WDS 0x10 //0x40,0x50,0x60,0x70 +#define MIN_NET_DEVICE_FOR_AID 0x00 //0x00~0x3f +#define MIN_NET_DEVICE_FOR_MBSSID 0x00 //0x00,0x10,0x20,0x30 +#define MIN_NET_DEVICE_FOR_WDS 0x10 //0x40,0x50,0x60,0x70 #define MIN_NET_DEVICE_FOR_APCLI 0x20 #define MIN_NET_DEVICE_FOR_MESH 0x30 #define MIN_NET_DEVICE_FOR_DLS 0x40 -#define NET_DEVICE_REAL_IDX_MASK 0x0f // for each operation mode, we maximum support 15 entities. - +#define NET_DEVICE_REAL_IDX_MASK 0x0f // for each operation mode, we maximum support 15 entities. #define NDIS_PACKET_TYPE_DIRECTED 0 #define NDIS_PACKET_TYPE_MULTICAST 1 @@ -197,36 +190,32 @@ struct iw_statistics *rt28xx_get_wireless_stats( #define NDIS_PACKET_TYPE_ALL_MULTICAST 3 #define NDIS_PACKET_TYPE_PROMISCUOUS 4 - /*********************************************************************************** * OS signaling related constant definitions ***********************************************************************************/ - /*********************************************************************************** * OS file operation related data structure definitions ***********************************************************************************/ -typedef struct file* RTMP_OS_FD; +typedef struct file *RTMP_OS_FD; -typedef struct _RTMP_OS_FS_INFO_ -{ - int fsuid; - int fsgid; - mm_segment_t fs; -}RTMP_OS_FS_INFO; +typedef struct _RTMP_OS_FS_INFO_ { + int fsuid; + int fsgid; + mm_segment_t fs; +} RTMP_OS_FS_INFO; #define IS_FILE_OPEN_ERR(_fd) IS_ERR((_fd)) - /*********************************************************************************** * OS semaphore related data structure and definitions ***********************************************************************************/ -struct os_lock { - spinlock_t lock; - unsigned long flags; +struct os_lock { + spinlock_t lock; + unsigned long flags; }; -typedef spinlock_t NDIS_SPIN_LOCK; +typedef spinlock_t NDIS_SPIN_LOCK; // // spin_lock enhanced for Nested spin lock @@ -239,7 +228,6 @@ typedef spinlock_t NDIS_SPIN_LOCK; #define NdisFreeSpinLock(lock) \ do{}while(0) - #define RTMP_SEM_LOCK(__lock) \ { \ spin_lock_bh((spinlock_t *)(__lock)); \ @@ -250,7 +238,6 @@ typedef spinlock_t NDIS_SPIN_LOCK; spin_unlock_bh((spinlock_t *)(__lock)); \ } - // sample, use semaphore lock to replace IRQ lock, 2007/11/15 #define RTMP_IRQ_LOCK(__lock, __irqflags) \ { \ @@ -343,7 +330,7 @@ do { \ /*********************************************************************************** * OS Memory Access related data structure and definitions ***********************************************************************************/ -#define MEM_ALLOC_FLAG (GFP_ATOMIC) //(GFP_DMA | GFP_ATOMIC) +#define MEM_ALLOC_FLAG (GFP_ATOMIC) //(GFP_DMA | GFP_ATOMIC) #define NdisMoveMemory(Destination, Source, Length) memmove(Destination, Source, Length) #define NdisCopyMemory(Destination, Source, Length) memcpy(Destination, Source, Length) @@ -358,32 +345,29 @@ do { \ #define COPY_MAC_ADDR(Addr1, Addr2) memcpy((Addr1), (Addr2), MAC_ADDR_LEN) - /*********************************************************************************** * OS task related data structure and definitions ***********************************************************************************/ #define RTMP_OS_MGMT_TASK_FLAGS CLONE_VM -typedef struct pid * THREAD_PID; +typedef struct pid *THREAD_PID; #define THREAD_PID_INIT_VALUE NULL #define GET_PID(_v) find_get_pid((_v)) #define GET_PID_NUMBER(_v) pid_nr((_v)) #define CHECK_PID_LEGALITY(_pid) if (pid_nr((_pid)) > 0) #define KILL_THREAD_PID(_A, _B, _C) kill_pid((_A), (_B), (_C)) -typedef struct tasklet_struct RTMP_NET_TASK_STRUCT; -typedef struct tasklet_struct *PRTMP_NET_TASK_STRUCT; - +typedef struct tasklet_struct RTMP_NET_TASK_STRUCT; +typedef struct tasklet_struct *PRTMP_NET_TASK_STRUCT; /*********************************************************************************** * Timer related definitions and data structures. **********************************************************************************/ #define OS_HZ HZ -typedef struct timer_list NDIS_MINIPORT_TIMER; -typedef struct timer_list RTMP_OS_TIMER; -typedef void (*TIMER_FUNCTION)(unsigned long); - +typedef struct timer_list NDIS_MINIPORT_TIMER; +typedef struct timer_list RTMP_OS_TIMER; +typedef void (*TIMER_FUNCTION) (unsigned long); #define OS_WAIT(_time) \ { int _i; \ @@ -406,26 +390,25 @@ typedef void (*TIMER_FUNCTION)(unsigned long); #define ONE_TICK 1 -static inline void NdisGetSystemUpTime(ULONG *time) +static inline void NdisGetSystemUpTime(ULONG * time) { *time = jiffies; } - /*********************************************************************************** * OS specific cookie data structure binding to RTMP_ADAPTER ***********************************************************************************/ struct os_cookie { #ifdef RTMP_MAC_PCI - struct pci_dev *pci_dev; - struct pci_dev *parent_pci_dev; - USHORT DeviceID; - dma_addr_t pAd_pa; -#endif // RTMP_MAC_PCI // + struct pci_dev *pci_dev; + struct pci_dev *parent_pci_dev; + USHORT DeviceID; + dma_addr_t pAd_pa; +#endif // RTMP_MAC_PCI // #ifdef RTMP_MAC_USB - struct usb_device *pUsb_Dev; -#endif // RTMP_MAC_USB // + struct usb_device *pUsb_Dev; +#endif // RTMP_MAC_USB // RTMP_NET_TASK_STRUCT rx_done_task; RTMP_NET_TASK_STRUCT mgmt_dma_done_task; @@ -436,21 +419,19 @@ struct os_cookie { RTMP_NET_TASK_STRUCT tbtt_task; #ifdef RTMP_MAC_PCI RTMP_NET_TASK_STRUCT fifo_statistic_full_task; -#endif // RTMP_MAC_PCI // +#endif // RTMP_MAC_PCI // #ifdef RTMP_MAC_USB RTMP_NET_TASK_STRUCT null_frame_complete_task; RTMP_NET_TASK_STRUCT rts_frame_complete_task; RTMP_NET_TASK_STRUCT pspoll_frame_complete_task; -#endif // RTMP_MAC_USB // +#endif // RTMP_MAC_USB // - unsigned long apd_pid; //802.1x daemon pid - INT ioctl_if_type; - INT ioctl_if; + unsigned long apd_pid; //802.1x daemon pid + INT ioctl_if_type; + INT ioctl_if; }; -typedef struct os_cookie * POS_COOKIE; - - +typedef struct os_cookie *POS_COOKIE; /*********************************************************************************** * OS debugging and printing related definitions and data structure @@ -459,7 +440,7 @@ typedef struct os_cookie * POS_COOKIE; addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] #ifdef DBG -extern ULONG RTDebugLevel; +extern ULONG RTDebugLevel; #define DBGPRINT_RAW(Level, Fmt) \ do{ \ @@ -471,7 +452,6 @@ do{ \ #define DBGPRINT(Level, Fmt) DBGPRINT_RAW(Level, Fmt) - #define DBGPRINT_ERR(Fmt) \ { \ printk("ERROR!!! "); \ @@ -483,7 +463,6 @@ do{ \ printk Fmt; \ } - #else #define DBGPRINT(Level, Fmt) #define DBGPRINT_RAW(Level, Fmt) @@ -495,18 +474,18 @@ do{ \ void hex_dump(char *str, unsigned char *pSrcBufVA, unsigned int SrcBufLen); - /********************************************************************************************************* The following code are not revised, temporary put it here. *********************************************************************************************************/ - /*********************************************************************************** * Device DMA Access related definitions and data structures. **********************************************************************************/ #ifdef RTMP_MAC_PCI -dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, int sd_idx, int direction); -void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int direction); +dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, + int sd_idx, int direction); +void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, + int direction); #define PCI_MAP_SINGLE(_handle, _ptr, _size, _sd_idx, _dir) \ linux_pci_map_single(_handle, _ptr, _size, _sd_idx, _dir) @@ -562,8 +541,6 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int #define NdisMIndicateStatus(_w, _x, _y, _z) - - /*********************************************************************************** * Device Register I/O Access related definitions and data structures. **********************************************************************************/ @@ -729,7 +706,6 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int #define GET_OS_PKT_NEXT(_pkt) \ (RTPKT_TO_OSPKT(_pkt)->next) - #define OS_PKT_CLONED(_pkt) skb_cloned(RTPKT_TO_OSPKT(_pkt)) #define OS_NTOHS(_Val) \ @@ -783,9 +759,8 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int #define RTMP_SET_PACKET_MOREDATA(_p, _morebit) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+7] = _morebit) #define RTMP_GET_PACKET_MOREDATA(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+7]) - // -// Sepcific Pakcet Type definition +// Sepcific Pakcet Type definition // #define RTMP_PACKET_SPECIFIC_CB_OFFSET 11 @@ -863,13 +838,10 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int #define RTMP_GET_PACKET_IPV4(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_IPV4) - // If this flag is set, it indicates that this EAPoL frame MUST be clear. #define RTMP_SET_PACKET_CLEAR_EAP_FRAME(_p, _flg) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+12] = _flg) #define RTMP_GET_PACKET_CLEAR_EAP_FRAME(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+12]) - - /* use bit3 of cb[CB_OFF+16] */ #define RTMP_SET_PACKET_5VT(_p, _flg) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+22] = _flg) @@ -877,12 +849,10 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int /* Max skb->cb = 48B = [CB_OFF+38] */ - - /*********************************************************************************** * Other function prototypes definitions ***********************************************************************************/ -void RTMP_GetCurrentSystemTime(LARGE_INTEGER *time); +void RTMP_GetCurrentSystemTime(LARGE_INTEGER * time); int rt28xx_packet_xmit(struct sk_buff *skb); #ifdef RTMP_MAC_PCI @@ -892,13 +862,10 @@ int rt28xx_packet_xmit(struct sk_buff *skb); IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance); #endif // RTMP_MAC_PCI // -INT rt28xx_sta_ioctl( - IN PNET_DEV net_dev, - IN OUT struct ifreq *rq, - IN INT cmd); +INT rt28xx_sta_ioctl(IN PNET_DEV net_dev, IN OUT struct ifreq *rq, IN INT cmd); -extern int ra_mtd_write(int num, loff_t to, size_t len, const u_char *buf); -extern int ra_mtd_read(int num, loff_t from, size_t len, u_char *buf); +extern int ra_mtd_write(int num, loff_t to, size_t len, const u_char * buf); +extern int ra_mtd_read(int num, loff_t from, size_t len, u_char * buf); #define GET_PAD_FROM_NET_DEV(_pAd, _net_dev) (_pAd) = (PRTMP_ADAPTER)(_net_dev)->ml_priv; diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h index 2ca1ca68b818..f6b8f622af22 100644 --- a/drivers/staging/rt2860/rtmp.h +++ b/drivers/staging/rt2860/rtmp.h @@ -44,17 +44,14 @@ #include "rtmp_dot11.h" #include "rtmp_chip.h" - -typedef struct _RTMP_ADAPTER RTMP_ADAPTER; -typedef struct _RTMP_ADAPTER *PRTMP_ADAPTER; +typedef struct _RTMP_ADAPTER RTMP_ADAPTER; +typedef struct _RTMP_ADAPTER *PRTMP_ADAPTER; typedef struct _RTMP_CHIP_OP_ RTMP_CHIP_OP; +//#define DBG 1 -//#define DBG 1 - -//#define DBG_DIAGNOSE 1 - +//#define DBG_DIAGNOSE 1 //+++Add by shiang for merge MiniportMMRequest() and MiniportDataMMRequest() into one function #define MAX_DATAMM_RETRY 3 @@ -63,17 +60,17 @@ typedef struct _RTMP_CHIP_OP_ RTMP_CHIP_OP; #define MAXSEQ (0xFFF) -extern unsigned char SNAP_AIRONET[]; -extern unsigned char CISCO_OUI[]; -extern UCHAR BaSizeArray[4]; +extern unsigned char SNAP_AIRONET[]; +extern unsigned char CISCO_OUI[]; +extern UCHAR BaSizeArray[4]; extern UCHAR BROADCAST_ADDR[MAC_ADDR_LEN]; extern UCHAR ZERO_MAC_ADDR[MAC_ADDR_LEN]; extern ULONG BIT32[32]; extern UCHAR BIT8[8]; -extern char* CipherName[]; -extern char* MCSToMbps[]; -extern UCHAR RxwiMCSToOfdmRate[12]; +extern char *CipherName[]; +extern char *MCSToMbps[]; +extern UCHAR RxwiMCSToOfdmRate[12]; extern UCHAR SNAP_802_1H[6]; extern UCHAR SNAP_BRIDGE_TUNNEL[6]; extern UCHAR SNAP_AIRONET[8]; @@ -82,9 +79,9 @@ extern UCHAR EAPOL_LLC_SNAP[8]; extern UCHAR EAPOL[2]; extern UCHAR IPX[2]; extern UCHAR APPLE_TALK[2]; -extern UCHAR RateIdToPlcpSignal[12]; // see IEEE802.11a-1999 p.14 -extern UCHAR OfdmRateToRxwiMCS[]; -extern UCHAR OfdmSignalToRateId[16] ; +extern UCHAR RateIdToPlcpSignal[12]; // see IEEE802.11a-1999 p.14 +extern UCHAR OfdmRateToRxwiMCS[]; +extern UCHAR OfdmSignalToRateId[16]; extern UCHAR default_cwmin[4]; extern UCHAR default_cwmax[4]; extern UCHAR default_sta_aifsn[4]; @@ -92,92 +89,88 @@ extern UCHAR MapUserPriorityToAccessCategory[8]; extern USHORT RateUpPER[]; extern USHORT RateDownPER[]; -extern UCHAR Phy11BNextRateDownward[]; -extern UCHAR Phy11BNextRateUpward[]; -extern UCHAR Phy11BGNextRateDownward[]; -extern UCHAR Phy11BGNextRateUpward[]; -extern UCHAR Phy11ANextRateDownward[]; -extern UCHAR Phy11ANextRateUpward[]; -extern CHAR RssiSafeLevelForTxRate[]; -extern UCHAR RateIdToMbps[]; +extern UCHAR Phy11BNextRateDownward[]; +extern UCHAR Phy11BNextRateUpward[]; +extern UCHAR Phy11BGNextRateDownward[]; +extern UCHAR Phy11BGNextRateUpward[]; +extern UCHAR Phy11ANextRateDownward[]; +extern UCHAR Phy11ANextRateUpward[]; +extern CHAR RssiSafeLevelForTxRate[]; +extern UCHAR RateIdToMbps[]; extern USHORT RateIdTo500Kbps[]; -extern UCHAR CipherSuiteWpaNoneTkip[]; -extern UCHAR CipherSuiteWpaNoneTkipLen; - -extern UCHAR CipherSuiteWpaNoneAes[]; -extern UCHAR CipherSuiteWpaNoneAesLen; - -extern UCHAR SsidIe; -extern UCHAR SupRateIe; -extern UCHAR ExtRateIe; - -extern UCHAR HtCapIe; -extern UCHAR AddHtInfoIe; -extern UCHAR NewExtChanIe; - -extern UCHAR ErpIe; -extern UCHAR DsIe; -extern UCHAR TimIe; -extern UCHAR WpaIe; -extern UCHAR Wpa2Ie; -extern UCHAR IbssIe; -extern UCHAR Ccx2Ie; -extern UCHAR WapiIe; - -extern UCHAR WPA_OUI[]; -extern UCHAR RSN_OUI[]; -extern UCHAR WAPI_OUI[]; -extern UCHAR WME_INFO_ELEM[]; -extern UCHAR WME_PARM_ELEM[]; -extern UCHAR Ccx2QosInfo[]; -extern UCHAR Ccx2IeInfo[]; -extern UCHAR RALINK_OUI[]; -extern UCHAR PowerConstraintIE[]; - - -extern UCHAR RateSwitchTable[]; -extern UCHAR RateSwitchTable11B[]; -extern UCHAR RateSwitchTable11G[]; -extern UCHAR RateSwitchTable11BG[]; - -extern UCHAR RateSwitchTable11BGN1S[]; -extern UCHAR RateSwitchTable11BGN2S[]; -extern UCHAR RateSwitchTable11BGN2SForABand[]; -extern UCHAR RateSwitchTable11N1S[]; -extern UCHAR RateSwitchTable11N2S[]; -extern UCHAR RateSwitchTable11N2SForABand[]; - -extern UCHAR PRE_N_HT_OUI[]; - - - - -typedef struct _RSSI_SAMPLE { - CHAR LastRssi0; // last received RSSI - CHAR LastRssi1; // last received RSSI - CHAR LastRssi2; // last received RSSI - CHAR AvgRssi0; - CHAR AvgRssi1; - CHAR AvgRssi2; - SHORT AvgRssi0X8; - SHORT AvgRssi1X8; - SHORT AvgRssi2X8; +extern UCHAR CipherSuiteWpaNoneTkip[]; +extern UCHAR CipherSuiteWpaNoneTkipLen; + +extern UCHAR CipherSuiteWpaNoneAes[]; +extern UCHAR CipherSuiteWpaNoneAesLen; + +extern UCHAR SsidIe; +extern UCHAR SupRateIe; +extern UCHAR ExtRateIe; + +extern UCHAR HtCapIe; +extern UCHAR AddHtInfoIe; +extern UCHAR NewExtChanIe; + +extern UCHAR ErpIe; +extern UCHAR DsIe; +extern UCHAR TimIe; +extern UCHAR WpaIe; +extern UCHAR Wpa2Ie; +extern UCHAR IbssIe; +extern UCHAR Ccx2Ie; +extern UCHAR WapiIe; + +extern UCHAR WPA_OUI[]; +extern UCHAR RSN_OUI[]; +extern UCHAR WAPI_OUI[]; +extern UCHAR WME_INFO_ELEM[]; +extern UCHAR WME_PARM_ELEM[]; +extern UCHAR Ccx2QosInfo[]; +extern UCHAR Ccx2IeInfo[]; +extern UCHAR RALINK_OUI[]; +extern UCHAR PowerConstraintIE[]; + +extern UCHAR RateSwitchTable[]; +extern UCHAR RateSwitchTable11B[]; +extern UCHAR RateSwitchTable11G[]; +extern UCHAR RateSwitchTable11BG[]; + +extern UCHAR RateSwitchTable11BGN1S[]; +extern UCHAR RateSwitchTable11BGN2S[]; +extern UCHAR RateSwitchTable11BGN2SForABand[]; +extern UCHAR RateSwitchTable11N1S[]; +extern UCHAR RateSwitchTable11N2S[]; +extern UCHAR RateSwitchTable11N2SForABand[]; + +extern UCHAR PRE_N_HT_OUI[]; + +typedef struct _RSSI_SAMPLE { + CHAR LastRssi0; // last received RSSI + CHAR LastRssi1; // last received RSSI + CHAR LastRssi2; // last received RSSI + CHAR AvgRssi0; + CHAR AvgRssi1; + CHAR AvgRssi2; + SHORT AvgRssi0X8; + SHORT AvgRssi1X8; + SHORT AvgRssi2X8; } RSSI_SAMPLE; // // Queue structure and macros // -typedef struct _QUEUE_ENTRY { - struct _QUEUE_ENTRY *Next; -} QUEUE_ENTRY, *PQUEUE_ENTRY; +typedef struct _QUEUE_ENTRY { + struct _QUEUE_ENTRY *Next; +} QUEUE_ENTRY, *PQUEUE_ENTRY; // Queue structure -typedef struct _QUEUE_HEADER { - PQUEUE_ENTRY Head; - PQUEUE_ENTRY Tail; - ULONG Number; -} QUEUE_HEADER, *PQUEUE_HEADER; +typedef struct _QUEUE_HEADER { + PQUEUE_ENTRY Head; + PQUEUE_ENTRY Tail; + ULONG Number; +} QUEUE_HEADER, *PQUEUE_HEADER; #define InitializeQueueHeader(QueueHeader) \ { \ @@ -231,8 +224,6 @@ typedef struct _QUEUE_HEADER { (QueueHeader)->Number++; \ } - - // // Macros for flag and ref count operations // @@ -270,13 +261,11 @@ typedef struct _QUEUE_HEADER { #define CKIP_KP_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x10) && ((_p)->StaCfg.bCkipCmicOn == TRUE)) #define CKIP_CMIC_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x08) && ((_p)->StaCfg.bCkipCmicOn == TRUE)) - #define INC_RING_INDEX(_idx, _RingSize) \ { \ (_idx) = (_idx+1) % (_RingSize); \ } - // StaActive.SupportedHtPhy.MCSSet is copied from AP beacon. Don't need to update here. #define COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(_pAd) \ { \ @@ -315,7 +304,6 @@ typedef struct _QUEUE_HEADER { // ULONG Value) // - // // Common fragment list structure - Identical to the scatter gather frag list structure // @@ -324,16 +312,15 @@ typedef struct _QUEUE_HEADER { #define NIC_MAX_PHYS_BUF_COUNT 8 typedef struct _RTMP_SCATTER_GATHER_ELEMENT { - PVOID Address; - ULONG Length; - PULONG Reserved; + PVOID Address; + ULONG Length; + PULONG Reserved; } RTMP_SCATTER_GATHER_ELEMENT, *PRTMP_SCATTER_GATHER_ELEMENT; - typedef struct _RTMP_SCATTER_GATHER_LIST { - ULONG NumberOfElements; - PULONG Reserved; - RTMP_SCATTER_GATHER_ELEMENT Elements[NIC_MAX_PHYS_BUF_COUNT]; + ULONG NumberOfElements; + PULONG Reserved; + RTMP_SCATTER_GATHER_ELEMENT Elements[NIC_MAX_PHYS_BUF_COUNT]; } RTMP_SCATTER_GATHER_LIST, *PRTMP_SCATTER_GATHER_LIST; // @@ -396,7 +383,6 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { } \ } - #define MAKE_802_3_HEADER(_p, _pMac1, _pMac2, _pType) \ { \ NdisMoveMemory(_p, _pMac1, MAC_ADDR_LEN); \ @@ -444,7 +430,6 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { } \ } - // Enqueue this frame to MLME engine // We need to enqueue the whole frame because MLME need to pass data type // information from 802.11 header @@ -487,20 +472,16 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { STA_EXTRA_SETTING(_pAd); \ } - - // // Data buffer for DMA operation, the buffer must be contiguous physical memory // Both DMA to / from CPU use the same structure. // -typedef struct _RTMP_DMABUF -{ - ULONG AllocSize; - PVOID AllocVa; // TxBuf virtual address - NDIS_PHYSICAL_ADDRESS AllocPa; // TxBuf physical address +typedef struct _RTMP_DMABUF { + ULONG AllocSize; + PVOID AllocVa; // TxBuf virtual address + NDIS_PHYSICAL_ADDRESS AllocPa; // TxBuf physical address } RTMP_DMABUF, *PRTMP_DMABUF; - // // Control block (Descriptor) for all ring descriptor DMA operation, buffer must be // contiguous physical memory. NDIS_PACKET stored the binding Rx packet descriptor @@ -509,206 +490,195 @@ typedef struct _RTMP_DMABUF // to describe the packet buffer. For Tx, NDIS_PACKET stored the tx packet descriptor // which driver should ACK upper layer when the tx is physically done or failed. // -typedef struct _RTMP_DMACB -{ - ULONG AllocSize; // Control block size - PVOID AllocVa; // Control block virtual address - NDIS_PHYSICAL_ADDRESS AllocPa; // Control block physical address +typedef struct _RTMP_DMACB { + ULONG AllocSize; // Control block size + PVOID AllocVa; // Control block virtual address + NDIS_PHYSICAL_ADDRESS AllocPa; // Control block physical address PNDIS_PACKET pNdisPacket; PNDIS_PACKET pNextNdisPacket; - RTMP_DMABUF DmaBuf; // Associated DMA buffer structure + RTMP_DMABUF DmaBuf; // Associated DMA buffer structure } RTMP_DMACB, *PRTMP_DMACB; - -typedef struct _RTMP_TX_RING -{ - RTMP_DMACB Cell[TX_RING_SIZE]; - UINT32 TxCpuIdx; - UINT32 TxDmaIdx; - UINT32 TxSwFreeIdx; // software next free tx index +typedef struct _RTMP_TX_RING { + RTMP_DMACB Cell[TX_RING_SIZE]; + UINT32 TxCpuIdx; + UINT32 TxDmaIdx; + UINT32 TxSwFreeIdx; // software next free tx index } RTMP_TX_RING, *PRTMP_TX_RING; -typedef struct _RTMP_RX_RING -{ - RTMP_DMACB Cell[RX_RING_SIZE]; - UINT32 RxCpuIdx; - UINT32 RxDmaIdx; - INT32 RxSwReadIdx; // software next read index +typedef struct _RTMP_RX_RING { + RTMP_DMACB Cell[RX_RING_SIZE]; + UINT32 RxCpuIdx; + UINT32 RxDmaIdx; + INT32 RxSwReadIdx; // software next read index } RTMP_RX_RING, *PRTMP_RX_RING; -typedef struct _RTMP_MGMT_RING -{ - RTMP_DMACB Cell[MGMT_RING_SIZE]; - UINT32 TxCpuIdx; - UINT32 TxDmaIdx; - UINT32 TxSwFreeIdx; // software next free tx index +typedef struct _RTMP_MGMT_RING { + RTMP_DMACB Cell[MGMT_RING_SIZE]; + UINT32 TxCpuIdx; + UINT32 TxDmaIdx; + UINT32 TxSwFreeIdx; // software next free tx index } RTMP_MGMT_RING, *PRTMP_MGMT_RING; // // Statistic counter structure // -typedef struct _COUNTER_802_3 -{ +typedef struct _COUNTER_802_3 { // General Stats - ULONG GoodTransmits; - ULONG GoodReceives; - ULONG TxErrors; - ULONG RxErrors; - ULONG RxNoBuffer; + ULONG GoodTransmits; + ULONG GoodReceives; + ULONG TxErrors; + ULONG RxErrors; + ULONG RxNoBuffer; // Ethernet Stats - ULONG RcvAlignmentErrors; - ULONG OneCollision; - ULONG MoreCollisions; + ULONG RcvAlignmentErrors; + ULONG OneCollision; + ULONG MoreCollisions; } COUNTER_802_3, *PCOUNTER_802_3; typedef struct _COUNTER_802_11 { - ULONG Length; - LARGE_INTEGER LastTransmittedFragmentCount; - LARGE_INTEGER TransmittedFragmentCount; - LARGE_INTEGER MulticastTransmittedFrameCount; - LARGE_INTEGER FailedCount; - LARGE_INTEGER RetryCount; - LARGE_INTEGER MultipleRetryCount; - LARGE_INTEGER RTSSuccessCount; - LARGE_INTEGER RTSFailureCount; - LARGE_INTEGER ACKFailureCount; - LARGE_INTEGER FrameDuplicateCount; - LARGE_INTEGER ReceivedFragmentCount; - LARGE_INTEGER MulticastReceivedFrameCount; - LARGE_INTEGER FCSErrorCount; + ULONG Length; + LARGE_INTEGER LastTransmittedFragmentCount; + LARGE_INTEGER TransmittedFragmentCount; + LARGE_INTEGER MulticastTransmittedFrameCount; + LARGE_INTEGER FailedCount; + LARGE_INTEGER RetryCount; + LARGE_INTEGER MultipleRetryCount; + LARGE_INTEGER RTSSuccessCount; + LARGE_INTEGER RTSFailureCount; + LARGE_INTEGER ACKFailureCount; + LARGE_INTEGER FrameDuplicateCount; + LARGE_INTEGER ReceivedFragmentCount; + LARGE_INTEGER MulticastReceivedFrameCount; + LARGE_INTEGER FCSErrorCount; } COUNTER_802_11, *PCOUNTER_802_11; typedef struct _COUNTER_RALINK { - ULONG TransmittedByteCount; // both successful and failure, used to calculate TX throughput - ULONG ReceivedByteCount; // both CRC okay and CRC error, used to calculate RX throughput - ULONG BeenDisassociatedCount; - ULONG BadCQIAutoRecoveryCount; - ULONG PoorCQIRoamingCount; - ULONG MgmtRingFullCount; - ULONG RxCountSinceLastNULL; - ULONG RxCount; - ULONG RxRingErrCount; - ULONG KickTxCount; - ULONG TxRingErrCount; - LARGE_INTEGER RealFcsErrCount; - ULONG PendingNdisPacketCount; - - ULONG OneSecOsTxCount[NUM_OF_TX_RING]; - ULONG OneSecDmaDoneCount[NUM_OF_TX_RING]; - UINT32 OneSecTxDoneCount; - ULONG OneSecRxCount; - UINT32 OneSecTxAggregationCount; - UINT32 OneSecRxAggregationCount; - UINT32 OneSecReceivedByteCount; - UINT32 OneSecFrameDuplicateCount; - - UINT32 OneSecTransmittedByteCount; // both successful and failure, used to calculate TX throughput - UINT32 OneSecTxNoRetryOkCount; - UINT32 OneSecTxRetryOkCount; - UINT32 OneSecTxFailCount; - UINT32 OneSecFalseCCACnt; // CCA error count, for debug purpose, might move to global counter - UINT32 OneSecRxOkCnt; // RX without error - UINT32 OneSecRxOkDataCnt; // unicast-to-me DATA frame count - UINT32 OneSecRxFcsErrCnt; // CRC error - UINT32 OneSecBeaconSentCnt; - UINT32 LastOneSecTotalTxCount; // OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount - UINT32 LastOneSecRxOkDataCnt; // OneSecRxOkDataCnt - ULONG DuplicateRcv; - ULONG TxAggCount; - ULONG TxNonAggCount; - ULONG TxAgg1MPDUCount; - ULONG TxAgg2MPDUCount; - ULONG TxAgg3MPDUCount; - ULONG TxAgg4MPDUCount; - ULONG TxAgg5MPDUCount; - ULONG TxAgg6MPDUCount; - ULONG TxAgg7MPDUCount; - ULONG TxAgg8MPDUCount; - ULONG TxAgg9MPDUCount; - ULONG TxAgg10MPDUCount; - ULONG TxAgg11MPDUCount; - ULONG TxAgg12MPDUCount; - ULONG TxAgg13MPDUCount; - ULONG TxAgg14MPDUCount; - ULONG TxAgg15MPDUCount; - ULONG TxAgg16MPDUCount; - - LARGE_INTEGER TransmittedOctetsInAMSDU; - LARGE_INTEGER TransmittedAMSDUCount; - LARGE_INTEGER ReceivedOctesInAMSDUCount; - LARGE_INTEGER ReceivedAMSDUCount; - LARGE_INTEGER TransmittedAMPDUCount; - LARGE_INTEGER TransmittedMPDUsInAMPDUCount; - LARGE_INTEGER TransmittedOctetsInAMPDUCount; - LARGE_INTEGER MPDUInReceivedAMPDUCount; + ULONG TransmittedByteCount; // both successful and failure, used to calculate TX throughput + ULONG ReceivedByteCount; // both CRC okay and CRC error, used to calculate RX throughput + ULONG BeenDisassociatedCount; + ULONG BadCQIAutoRecoveryCount; + ULONG PoorCQIRoamingCount; + ULONG MgmtRingFullCount; + ULONG RxCountSinceLastNULL; + ULONG RxCount; + ULONG RxRingErrCount; + ULONG KickTxCount; + ULONG TxRingErrCount; + LARGE_INTEGER RealFcsErrCount; + ULONG PendingNdisPacketCount; + + ULONG OneSecOsTxCount[NUM_OF_TX_RING]; + ULONG OneSecDmaDoneCount[NUM_OF_TX_RING]; + UINT32 OneSecTxDoneCount; + ULONG OneSecRxCount; + UINT32 OneSecTxAggregationCount; + UINT32 OneSecRxAggregationCount; + UINT32 OneSecReceivedByteCount; + UINT32 OneSecFrameDuplicateCount; + + UINT32 OneSecTransmittedByteCount; // both successful and failure, used to calculate TX throughput + UINT32 OneSecTxNoRetryOkCount; + UINT32 OneSecTxRetryOkCount; + UINT32 OneSecTxFailCount; + UINT32 OneSecFalseCCACnt; // CCA error count, for debug purpose, might move to global counter + UINT32 OneSecRxOkCnt; // RX without error + UINT32 OneSecRxOkDataCnt; // unicast-to-me DATA frame count + UINT32 OneSecRxFcsErrCnt; // CRC error + UINT32 OneSecBeaconSentCnt; + UINT32 LastOneSecTotalTxCount; // OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount + UINT32 LastOneSecRxOkDataCnt; // OneSecRxOkDataCnt + ULONG DuplicateRcv; + ULONG TxAggCount; + ULONG TxNonAggCount; + ULONG TxAgg1MPDUCount; + ULONG TxAgg2MPDUCount; + ULONG TxAgg3MPDUCount; + ULONG TxAgg4MPDUCount; + ULONG TxAgg5MPDUCount; + ULONG TxAgg6MPDUCount; + ULONG TxAgg7MPDUCount; + ULONG TxAgg8MPDUCount; + ULONG TxAgg9MPDUCount; + ULONG TxAgg10MPDUCount; + ULONG TxAgg11MPDUCount; + ULONG TxAgg12MPDUCount; + ULONG TxAgg13MPDUCount; + ULONG TxAgg14MPDUCount; + ULONG TxAgg15MPDUCount; + ULONG TxAgg16MPDUCount; + + LARGE_INTEGER TransmittedOctetsInAMSDU; + LARGE_INTEGER TransmittedAMSDUCount; + LARGE_INTEGER ReceivedOctesInAMSDUCount; + LARGE_INTEGER ReceivedAMSDUCount; + LARGE_INTEGER TransmittedAMPDUCount; + LARGE_INTEGER TransmittedMPDUsInAMPDUCount; + LARGE_INTEGER TransmittedOctetsInAMPDUCount; + LARGE_INTEGER MPDUInReceivedAMPDUCount; } COUNTER_RALINK, *PCOUNTER_RALINK; - typedef struct _COUNTER_DRS { // to record the each TX rate's quality. 0 is best, the bigger the worse. - USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH]; - UCHAR PER[MAX_STEP_OF_TX_RATE_SWITCH]; - UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition - ULONG CurrTxRateStableTime; // # of second in current TX rate - BOOLEAN fNoisyEnvironment; - BOOLEAN fLastSecAccordingRSSI; - UCHAR LastSecTxRateChangeAction; // 0: no change, 1:rate UP, 2:rate down - UCHAR LastTimeTxRateChangeAction; //Keep last time value of LastSecTxRateChangeAction - ULONG LastTxOkCount; + USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH]; + UCHAR PER[MAX_STEP_OF_TX_RATE_SWITCH]; + UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition + ULONG CurrTxRateStableTime; // # of second in current TX rate + BOOLEAN fNoisyEnvironment; + BOOLEAN fLastSecAccordingRSSI; + UCHAR LastSecTxRateChangeAction; // 0: no change, 1:rate UP, 2:rate down + UCHAR LastTimeTxRateChangeAction; //Keep last time value of LastSecTxRateChangeAction + ULONG LastTxOkCount; } COUNTER_DRS, *PCOUNTER_DRS; - - - /*************************************************************************** * security key related data structure **************************************************************************/ typedef struct _CIPHER_KEY { - UCHAR Key[16]; // right now we implement 4 keys, 128 bits max - UCHAR RxMic[8]; // make alignment - UCHAR TxMic[8]; - UCHAR TxTsc[6]; // 48bit TSC value - UCHAR RxTsc[6]; // 48bit TSC value - UCHAR CipherAlg; // 0-none, 1:WEP64, 2:WEP128, 3:TKIP, 4:AES, 5:CKIP64, 6:CKIP128 - UCHAR KeyLen; - UCHAR BssId[6]; - // Key length for each key, 0: entry is invalid - UCHAR Type; // Indicate Pairwise/Group when reporting MIC error + UCHAR Key[16]; // right now we implement 4 keys, 128 bits max + UCHAR RxMic[8]; // make alignment + UCHAR TxMic[8]; + UCHAR TxTsc[6]; // 48bit TSC value + UCHAR RxTsc[6]; // 48bit TSC value + UCHAR CipherAlg; // 0-none, 1:WEP64, 2:WEP128, 3:TKIP, 4:AES, 5:CKIP64, 6:CKIP128 + UCHAR KeyLen; + UCHAR BssId[6]; + // Key length for each key, 0: entry is invalid + UCHAR Type; // Indicate Pairwise/Group when reporting MIC error } CIPHER_KEY, *PCIPHER_KEY; - // structure to define WPA Group Key Rekey Interval typedef struct PACKED _RT_802_11_WPA_REKEY { - ULONG ReKeyMethod; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based - ULONG ReKeyInterval; // time-based: seconds, packet-based: kilo-packets -} RT_WPA_REKEY,*PRT_WPA_REKEY, RT_802_11_WPA_REKEY, *PRT_802_11_WPA_REKEY; + ULONG ReKeyMethod; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based + ULONG ReKeyInterval; // time-based: seconds, packet-based: kilo-packets +} RT_WPA_REKEY, *PRT_WPA_REKEY, RT_802_11_WPA_REKEY, *PRT_802_11_WPA_REKEY; #ifdef RTMP_MAC_USB /*************************************************************************** * RTUSB I/O related data structure **************************************************************************/ -typedef struct _RT_SET_ASIC_WCID { - ULONG WCID; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based - ULONG SetTid; // time-based: seconds, packet-based: kilo-packets - ULONG DeleteTid; // time-based: seconds, packet-based: kilo-packets +typedef struct _RT_SET_ASIC_WCID { + ULONG WCID; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based + ULONG SetTid; // time-based: seconds, packet-based: kilo-packets + ULONG DeleteTid; // time-based: seconds, packet-based: kilo-packets UCHAR Addr[MAC_ADDR_LEN]; // avoid in interrupt when write key -} RT_SET_ASIC_WCID,*PRT_SET_ASIC_WCID; +} RT_SET_ASIC_WCID, *PRT_SET_ASIC_WCID; -typedef struct _RT_SET_ASIC_WCID_ATTRI { - ULONG WCID; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based - ULONG Cipher; // ASIC Cipher definition - UCHAR Addr[ETH_LENGTH_OF_ADDRESS]; -} RT_SET_ASIC_WCID_ATTRI,*PRT_SET_ASIC_WCID_ATTRI; +typedef struct _RT_SET_ASIC_WCID_ATTRI { + ULONG WCID; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based + ULONG Cipher; // ASIC Cipher definition + UCHAR Addr[ETH_LENGTH_OF_ADDRESS]; +} RT_SET_ASIC_WCID_ATTRI, *PRT_SET_ASIC_WCID_ATTRI; // for USB interface, avoid in interrupt when write key -typedef struct RT_ADD_PAIRWISE_KEY_ENTRY { - UCHAR MacAddr[6]; - USHORT MacTabMatchWCID; // ASIC - CIPHER_KEY CipherKey; -} RT_ADD_PAIRWISE_KEY_ENTRY,*PRT_ADD_PAIRWISE_KEY_ENTRY; +typedef struct RT_ADD_PAIRWISE_KEY_ENTRY { + UCHAR MacAddr[6]; + USHORT MacTabMatchWCID; // ASIC + CIPHER_KEY CipherKey; +} RT_ADD_PAIRWISE_KEY_ENTRY, *PRT_ADD_PAIRWISE_KEY_ENTRY; // Cipher suite type for mixed mode group cipher, P802.11i-2004 typedef enum _RT_802_11_CIPHER_SUITE_TYPE { @@ -722,176 +692,168 @@ typedef enum _RT_802_11_CIPHER_SUITE_TYPE { #endif // RTMP_MAC_USB // typedef struct { - UCHAR Addr[MAC_ADDR_LEN]; - UCHAR ErrorCode[2]; //00 01-Invalid authentication type - //00 02-Authentication timeout - //00 03-Challenge from AP failed - //00 04-Challenge to AP failed - BOOLEAN Reported; + UCHAR Addr[MAC_ADDR_LEN]; + UCHAR ErrorCode[2]; //00 01-Invalid authentication type + //00 02-Authentication timeout + //00 03-Challenge from AP failed + //00 04-Challenge to AP failed + BOOLEAN Reported; } ROGUEAP_ENTRY, *PROGUEAP_ENTRY; typedef struct { - UCHAR RogueApNr; - ROGUEAP_ENTRY RogueApEntry[MAX_LEN_OF_BSS_TABLE]; + UCHAR RogueApNr; + ROGUEAP_ENTRY RogueApEntry[MAX_LEN_OF_BSS_TABLE]; } ROGUEAP_TABLE, *PROGUEAP_TABLE; // // Cisco IAPP format // -typedef struct _CISCO_IAPP_CONTENT_ -{ - USHORT Length; //IAPP Length - UCHAR MessageType; //IAPP type - UCHAR FunctionCode; //IAPP function type - UCHAR DestinaionMAC[MAC_ADDR_LEN]; - UCHAR SourceMAC[MAC_ADDR_LEN]; - USHORT Tag; //Tag(element IE) - Adjacent AP report - USHORT TagLength; //Length of element not including 4 byte header - UCHAR OUI[4]; //0x00, 0x40, 0x96, 0x00 - UCHAR PreviousAP[MAC_ADDR_LEN]; //MAC Address of access point - USHORT Channel; - USHORT SsidLen; - UCHAR Ssid[MAX_LEN_OF_SSID]; - USHORT Seconds; //Seconds that the client has been disassociated. +typedef struct _CISCO_IAPP_CONTENT_ { + USHORT Length; //IAPP Length + UCHAR MessageType; //IAPP type + UCHAR FunctionCode; //IAPP function type + UCHAR DestinaionMAC[MAC_ADDR_LEN]; + UCHAR SourceMAC[MAC_ADDR_LEN]; + USHORT Tag; //Tag(element IE) - Adjacent AP report + USHORT TagLength; //Length of element not including 4 byte header + UCHAR OUI[4]; //0x00, 0x40, 0x96, 0x00 + UCHAR PreviousAP[MAC_ADDR_LEN]; //MAC Address of access point + USHORT Channel; + USHORT SsidLen; + UCHAR Ssid[MAX_LEN_OF_SSID]; + USHORT Seconds; //Seconds that the client has been disassociated. } CISCO_IAPP_CONTENT, *PCISCO_IAPP_CONTENT; - /* * Fragment Frame structure */ -typedef struct _FRAGMENT_FRAME { - PNDIS_PACKET pFragPacket; - ULONG RxSize; - USHORT Sequence; - USHORT LastFrag; - ULONG Flags; // Some extra frame information. bit 0: LLC presented +typedef struct _FRAGMENT_FRAME { + PNDIS_PACKET pFragPacket; + ULONG RxSize; + USHORT Sequence; + USHORT LastFrag; + ULONG Flags; // Some extra frame information. bit 0: LLC presented } FRAGMENT_FRAME, *PFRAGMENT_FRAME; - // // Packet information for NdisQueryPacket // -typedef struct _PACKET_INFO { - UINT PhysicalBufferCount; // Physical breaks of buffer descripor chained - UINT BufferCount ; // Number of Buffer descriptor chained - UINT TotalPacketLength ; // Self explained - PNDIS_BUFFER pFirstBuffer; // Pointer to first buffer descriptor +typedef struct _PACKET_INFO { + UINT PhysicalBufferCount; // Physical breaks of buffer descripor chained + UINT BufferCount; // Number of Buffer descriptor chained + UINT TotalPacketLength; // Self explained + PNDIS_BUFFER pFirstBuffer; // Pointer to first buffer descriptor } PACKET_INFO, *PPACKET_INFO; - // // Arcfour Structure Added by PaulWu // -typedef struct _ARCFOUR -{ - UINT X; - UINT Y; - UCHAR STATE[256]; +typedef struct _ARCFOUR { + UINT X; + UINT Y; + UCHAR STATE[256]; } ARCFOURCONTEXT, *PARCFOURCONTEXT; - // // Tkip Key structure which RC4 key & MIC calculation // -typedef struct _TKIP_KEY_INFO { - UINT nBytesInM; // # bytes in M for MICKEY - ULONG IV16; - ULONG IV32; - ULONG K0; // for MICKEY Low - ULONG K1; // for MICKEY Hig - ULONG L; // Current state for MICKEY - ULONG R; // Current state for MICKEY - ULONG M; // Message accumulator for MICKEY - UCHAR RC4KEY[16]; - UCHAR MIC[8]; +typedef struct _TKIP_KEY_INFO { + UINT nBytesInM; // # bytes in M for MICKEY + ULONG IV16; + ULONG IV32; + ULONG K0; // for MICKEY Low + ULONG K1; // for MICKEY Hig + ULONG L; // Current state for MICKEY + ULONG R; // Current state for MICKEY + ULONG M; // Message accumulator for MICKEY + UCHAR RC4KEY[16]; + UCHAR MIC[8]; } TKIP_KEY_INFO, *PTKIP_KEY_INFO; // // Private / Misc data, counters for driver internal use // -typedef struct __PRIVATE_STRUC { - UINT SystemResetCnt; // System reset counter - UINT TxRingFullCnt; // Tx ring full occurrance number - UINT PhyRxErrCnt; // PHY Rx error count, for debug purpose, might move to global counter +typedef struct __PRIVATE_STRUC { + UINT SystemResetCnt; // System reset counter + UINT TxRingFullCnt; // Tx ring full occurrance number + UINT PhyRxErrCnt; // PHY Rx error count, for debug purpose, might move to global counter // Variables for WEP encryption / decryption in rtmp_wep.c - UINT FCSCRC32; - ARCFOURCONTEXT WEPCONTEXT; + UINT FCSCRC32; + ARCFOURCONTEXT WEPCONTEXT; // Tkip stuff - TKIP_KEY_INFO Tx; - TKIP_KEY_INFO Rx; + TKIP_KEY_INFO Tx; + TKIP_KEY_INFO Rx; } PRIVATE_STRUC, *PPRIVATE_STRUC; - /*************************************************************************** * Channel and BBP related data structures **************************************************************************/ // structure to tune BBP R66 (BBP TUNING) typedef struct _BBP_R66_TUNING { - BOOLEAN bEnable; - USHORT FalseCcaLowerThreshold; // default 100 - USHORT FalseCcaUpperThreshold; // default 512 - UCHAR R66Delta; - UCHAR R66CurrentValue; - BOOLEAN R66LowerUpperSelect; //Before LinkUp, Used LowerBound or UpperBound as R66 value. + BOOLEAN bEnable; + USHORT FalseCcaLowerThreshold; // default 100 + USHORT FalseCcaUpperThreshold; // default 512 + UCHAR R66Delta; + UCHAR R66CurrentValue; + BOOLEAN R66LowerUpperSelect; //Before LinkUp, Used LowerBound or UpperBound as R66 value. } BBP_R66_TUNING, *PBBP_R66_TUNING; // structure to store channel TX power typedef struct _CHANNEL_TX_POWER { - USHORT RemainingTimeForUse; //unit: sec - UCHAR Channel; - CHAR Power; - CHAR Power2; - UCHAR MaxTxPwr; - UCHAR DfsReq; + USHORT RemainingTimeForUse; //unit: sec + UCHAR Channel; + CHAR Power; + CHAR Power2; + UCHAR MaxTxPwr; + UCHAR DfsReq; } CHANNEL_TX_POWER, *PCHANNEL_TX_POWER; // structure to store 802.11j channel TX power typedef struct _CHANNEL_11J_TX_POWER { - UCHAR Channel; - UCHAR BW; // BW_10 or BW_20 - CHAR Power; - CHAR Power2; - USHORT RemainingTimeForUse; //unit: sec + UCHAR Channel; + UCHAR BW; // BW_10 or BW_20 + CHAR Power; + CHAR Power2; + USHORT RemainingTimeForUse; //unit: sec } CHANNEL_11J_TX_POWER, *PCHANNEL_11J_TX_POWER; typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT { - UCHAR EvaluatePeriod; // 0:not evalute status, 1: evaluate status, 2: switching status - UCHAR EvaluateStableCnt; - UCHAR Pair1PrimaryRxAnt; // 0:Ant-E1, 1:Ant-E2 - UCHAR Pair1SecondaryRxAnt; // 0:Ant-E1, 1:Ant-E2 - UCHAR Pair2PrimaryRxAnt; // 0:Ant-E3, 1:Ant-E4 - UCHAR Pair2SecondaryRxAnt; // 0:Ant-E3, 1:Ant-E4 - SHORT Pair1AvgRssi[2]; // AvgRssi[0]:E1, AvgRssi[1]:E2 - SHORT Pair2AvgRssi[2]; // AvgRssi[0]:E3, AvgRssi[1]:E4 - SHORT Pair1LastAvgRssi; // - SHORT Pair2LastAvgRssi; // - ULONG RcvPktNumWhenEvaluate; - BOOLEAN FirstPktArrivedWhenEvaluate; - RALINK_TIMER_STRUCT RxAntDiversityTimer; + UCHAR EvaluatePeriod; // 0:not evalute status, 1: evaluate status, 2: switching status + UCHAR EvaluateStableCnt; + UCHAR Pair1PrimaryRxAnt; // 0:Ant-E1, 1:Ant-E2 + UCHAR Pair1SecondaryRxAnt; // 0:Ant-E1, 1:Ant-E2 + UCHAR Pair2PrimaryRxAnt; // 0:Ant-E3, 1:Ant-E4 + UCHAR Pair2SecondaryRxAnt; // 0:Ant-E3, 1:Ant-E4 + SHORT Pair1AvgRssi[2]; // AvgRssi[0]:E1, AvgRssi[1]:E2 + SHORT Pair2AvgRssi[2]; // AvgRssi[0]:E3, AvgRssi[1]:E4 + SHORT Pair1LastAvgRssi; // + SHORT Pair2LastAvgRssi; // + ULONG RcvPktNumWhenEvaluate; + BOOLEAN FirstPktArrivedWhenEvaluate; + RALINK_TIMER_STRUCT RxAntDiversityTimer; } SOFT_RX_ANT_DIVERSITY, *PSOFT_RX_ANT_DIVERSITY; - /*************************************************************************** * structure for radar detection and channel switch **************************************************************************/ typedef struct _RADAR_DETECT_STRUCT { - //BOOLEAN IEEE80211H; // 0: disable, 1: enable IEEE802.11h - UCHAR CSCount; //Channel switch counter - UCHAR CSPeriod; //Channel switch period (beacon count) - UCHAR RDCount; //Radar detection counter - UCHAR RDMode; //Radar Detection mode - UCHAR RDDurRegion; //Radar detection duration region - UCHAR BBPR16; - UCHAR BBPR17; - UCHAR BBPR18; - UCHAR BBPR21; - UCHAR BBPR22; - UCHAR BBPR64; - ULONG InServiceMonitorCount; // unit: sec - UINT8 DfsSessionTime; - BOOLEAN bFastDfs; - UINT8 ChMovingTime; - UINT8 LongPulseRadarTh; + //BOOLEAN IEEE80211H; // 0: disable, 1: enable IEEE802.11h + UCHAR CSCount; //Channel switch counter + UCHAR CSPeriod; //Channel switch period (beacon count) + UCHAR RDCount; //Radar detection counter + UCHAR RDMode; //Radar Detection mode + UCHAR RDDurRegion; //Radar detection duration region + UCHAR BBPR16; + UCHAR BBPR17; + UCHAR BBPR18; + UCHAR BBPR21; + UCHAR BBPR22; + UCHAR BBPR64; + ULONG InServiceMonitorCount; // unit: sec + UINT8 DfsSessionTime; + BOOLEAN bFastDfs; + UINT8 ChMovingTime; + UINT8 LongPulseRadarTh; } RADAR_DETECT_STRUCT, *PRADAR_DETECT_STRUCT; typedef enum _ABGBAND_STATE_ { @@ -902,17 +864,17 @@ typedef enum _ABGBAND_STATE_ { #ifdef RTMP_MAC_PCI // Power save method control -typedef union _PS_CONTROL { - struct { - ULONG EnablePSinIdle:1; // Enable radio off when not connect to AP. radio on only when sitesurvey, - ULONG EnableNewPS:1; // Enable new Chip power save fucntion . New method can only be applied in chip version after 2872. and PCIe. - ULONG rt30xxPowerMode:2; // Power Level Mode for rt30xx chip - ULONG rt30xxFollowHostASPM:1; // Card Follows Host's setting for rt30xx chip. - ULONG rt30xxForceASPMTest:1; // Force enable L1 for rt30xx chip. This has higher priority than rt30xxFollowHostASPM Mode. - ULONG rsv:26; // Radio Measurement Enable - } field; - ULONG word; -} PS_CONTROL, *PPS_CONTROL; +typedef union _PS_CONTROL { + struct { + ULONG EnablePSinIdle:1; // Enable radio off when not connect to AP. radio on only when sitesurvey, + ULONG EnableNewPS:1; // Enable new Chip power save fucntion . New method can only be applied in chip version after 2872. and PCIe. + ULONG rt30xxPowerMode:2; // Power Level Mode for rt30xx chip + ULONG rt30xxFollowHostASPM:1; // Card Follows Host's setting for rt30xx chip. + ULONG rt30xxForceASPMTest:1; // Force enable L1 for rt30xx chip. This has higher priority than rt30xxFollowHostASPM Mode. + ULONG rsv:26; // Radio Measurement Enable + } field; + ULONG word; +} PS_CONTROL, *PPS_CONTROL; #endif // RTMP_MAC_PCI // /*************************************************************************** @@ -920,208 +882,193 @@ typedef union _PS_CONTROL { **************************************************************************/ typedef struct _MLME_STRUCT { // STA state machines - STATE_MACHINE CntlMachine; - STATE_MACHINE AssocMachine; - STATE_MACHINE AuthMachine; - STATE_MACHINE AuthRspMachine; - STATE_MACHINE SyncMachine; - STATE_MACHINE WpaPskMachine; - STATE_MACHINE LeapMachine; - STATE_MACHINE_FUNC AssocFunc[ASSOC_FUNC_SIZE]; - STATE_MACHINE_FUNC AuthFunc[AUTH_FUNC_SIZE]; - STATE_MACHINE_FUNC AuthRspFunc[AUTH_RSP_FUNC_SIZE]; - STATE_MACHINE_FUNC SyncFunc[SYNC_FUNC_SIZE]; - STATE_MACHINE_FUNC ActFunc[ACT_FUNC_SIZE]; + STATE_MACHINE CntlMachine; + STATE_MACHINE AssocMachine; + STATE_MACHINE AuthMachine; + STATE_MACHINE AuthRspMachine; + STATE_MACHINE SyncMachine; + STATE_MACHINE WpaPskMachine; + STATE_MACHINE LeapMachine; + STATE_MACHINE_FUNC AssocFunc[ASSOC_FUNC_SIZE]; + STATE_MACHINE_FUNC AuthFunc[AUTH_FUNC_SIZE]; + STATE_MACHINE_FUNC AuthRspFunc[AUTH_RSP_FUNC_SIZE]; + STATE_MACHINE_FUNC SyncFunc[SYNC_FUNC_SIZE]; + STATE_MACHINE_FUNC ActFunc[ACT_FUNC_SIZE]; // Action - STATE_MACHINE ActMachine; - - - + STATE_MACHINE ActMachine; // common WPA state machine - STATE_MACHINE WpaMachine; - STATE_MACHINE_FUNC WpaFunc[WPA_FUNC_SIZE]; - - + STATE_MACHINE WpaMachine; + STATE_MACHINE_FUNC WpaFunc[WPA_FUNC_SIZE]; - ULONG ChannelQuality; // 0..100, Channel Quality Indication for Roaming - ULONG Now32; // latch the value of NdisGetSystemUpTime() - ULONG LastSendNULLpsmTime; + ULONG ChannelQuality; // 0..100, Channel Quality Indication for Roaming + ULONG Now32; // latch the value of NdisGetSystemUpTime() + ULONG LastSendNULLpsmTime; - BOOLEAN bRunning; - NDIS_SPIN_LOCK TaskLock; - MLME_QUEUE Queue; + BOOLEAN bRunning; + NDIS_SPIN_LOCK TaskLock; + MLME_QUEUE Queue; - UINT ShiftReg; + UINT ShiftReg; - RALINK_TIMER_STRUCT PeriodicTimer; - RALINK_TIMER_STRUCT APSDPeriodicTimer; - RALINK_TIMER_STRUCT LinkDownTimer; - RALINK_TIMER_STRUCT LinkUpTimer; + RALINK_TIMER_STRUCT PeriodicTimer; + RALINK_TIMER_STRUCT APSDPeriodicTimer; + RALINK_TIMER_STRUCT LinkDownTimer; + RALINK_TIMER_STRUCT LinkUpTimer; #ifdef RTMP_MAC_PCI - UCHAR bPsPollTimerRunning; - RALINK_TIMER_STRUCT PsPollTimer; - RALINK_TIMER_STRUCT RadioOnOffTimer; -#endif // RTMP_MAC_PCI // - ULONG PeriodicRound; - ULONG OneSecPeriodicRound; - - UCHAR RealRxPath; - BOOLEAN bLowThroughput; - BOOLEAN bEnableAutoAntennaCheck; - RALINK_TIMER_STRUCT RxAntEvalTimer; + UCHAR bPsPollTimerRunning; + RALINK_TIMER_STRUCT PsPollTimer; + RALINK_TIMER_STRUCT RadioOnOffTimer; +#endif // RTMP_MAC_PCI // + ULONG PeriodicRound; + ULONG OneSecPeriodicRound; + + UCHAR RealRxPath; + BOOLEAN bLowThroughput; + BOOLEAN bEnableAutoAntennaCheck; + RALINK_TIMER_STRUCT RxAntEvalTimer; #ifdef RT30xx UCHAR CaliBW40RfR24; UCHAR CaliBW20RfR24; -#endif // RT30xx // +#endif // RT30xx // #ifdef RTMP_MAC_USB - RALINK_TIMER_STRUCT AutoWakeupTimer; - BOOLEAN AutoWakeupTimerRunning; -#endif // RTMP_MAC_USB // + RALINK_TIMER_STRUCT AutoWakeupTimer; + BOOLEAN AutoWakeupTimerRunning; +#endif // RTMP_MAC_USB // } MLME_STRUCT, *PMLME_STRUCT; - /*************************************************************************** * 802.11 N related data structures **************************************************************************/ -struct reordering_mpdu -{ - struct reordering_mpdu *next; - PNDIS_PACKET pPacket; /* coverted to 802.3 frame */ - int Sequence; /* sequence number of MPDU */ - BOOLEAN bAMSDU; +struct reordering_mpdu { + struct reordering_mpdu *next; + PNDIS_PACKET pPacket; /* coverted to 802.3 frame */ + int Sequence; /* sequence number of MPDU */ + BOOLEAN bAMSDU; }; -struct reordering_list -{ +struct reordering_list { struct reordering_mpdu *next; - int qlen; + int qlen; }; -struct reordering_mpdu_pool -{ - PVOID mem; - NDIS_SPIN_LOCK lock; - struct reordering_list freelist; +struct reordering_mpdu_pool { + PVOID mem; + NDIS_SPIN_LOCK lock; + struct reordering_list freelist; }; -typedef enum _REC_BLOCKACK_STATUS -{ - Recipient_NONE=0, +typedef enum _REC_BLOCKACK_STATUS { + Recipient_NONE = 0, Recipient_USED, Recipient_HandleRes, - Recipient_Accept + Recipient_Accept } REC_BLOCKACK_STATUS, *PREC_BLOCKACK_STATUS; -typedef enum _ORI_BLOCKACK_STATUS -{ - Originator_NONE=0, +typedef enum _ORI_BLOCKACK_STATUS { + Originator_NONE = 0, Originator_USED, - Originator_WaitRes, - Originator_Done + Originator_WaitRes, + Originator_Done } ORI_BLOCKACK_STATUS, *PORI_BLOCKACK_STATUS; -typedef struct _BA_ORI_ENTRY{ - UCHAR Wcid; - UCHAR TID; - UCHAR BAWinSize; - UCHAR Token; +typedef struct _BA_ORI_ENTRY { + UCHAR Wcid; + UCHAR TID; + UCHAR BAWinSize; + UCHAR Token; // Sequence is to fill every outgoing QoS DATA frame's sequence field in 802.11 header. - USHORT Sequence; - USHORT TimeOutValue; - ORI_BLOCKACK_STATUS ORI_BA_Status; + USHORT Sequence; + USHORT TimeOutValue; + ORI_BLOCKACK_STATUS ORI_BA_Status; RALINK_TIMER_STRUCT ORIBATimer; - PVOID pAdapter; + PVOID pAdapter; } BA_ORI_ENTRY, *PBA_ORI_ENTRY; typedef struct _BA_REC_ENTRY { - UCHAR Wcid; - UCHAR TID; - UCHAR BAWinSize; // 7.3.1.14. each buffer is capable of holding a max AMSDU or MSDU. - //UCHAR NumOfRxPkt; + UCHAR Wcid; + UCHAR TID; + UCHAR BAWinSize; // 7.3.1.14. each buffer is capable of holding a max AMSDU or MSDU. + //UCHAR NumOfRxPkt; //UCHAR Curindidx; // the head in the RX reordering buffer - USHORT LastIndSeq; -// USHORT LastIndSeqAtTimer; - USHORT TimeOutValue; + USHORT LastIndSeq; +// USHORT LastIndSeqAtTimer; + USHORT TimeOutValue; RALINK_TIMER_STRUCT RECBATimer; - ULONG LastIndSeqAtTimer; - ULONG nDropPacket; - ULONG rcvSeq; - REC_BLOCKACK_STATUS REC_BA_Status; -// UCHAR RxBufIdxUsed; + ULONG LastIndSeqAtTimer; + ULONG nDropPacket; + ULONG rcvSeq; + REC_BLOCKACK_STATUS REC_BA_Status; +// UCHAR RxBufIdxUsed; // corresponding virtual address for RX reordering packet storage. //RTMP_REORDERDMABUF MAP_RXBuf[MAX_RX_REORDERBUF]; - NDIS_SPIN_LOCK RxReRingLock; // Rx Ring spinlock -// struct _BA_REC_ENTRY *pNext; - PVOID pAdapter; - struct reordering_list list; + NDIS_SPIN_LOCK RxReRingLock; // Rx Ring spinlock +// struct _BA_REC_ENTRY *pNext; + PVOID pAdapter; + struct reordering_list list; } BA_REC_ENTRY, *PBA_REC_ENTRY; - typedef struct { - ULONG numAsRecipient; // I am recipient of numAsRecipient clients. These client are in the BARecEntry[] - ULONG numAsOriginator; // I am originator of numAsOriginator clients. These clients are in the BAOriEntry[] - ULONG numDoneOriginator; // count Done Originator sessions - BA_ORI_ENTRY BAOriEntry[MAX_LEN_OF_BA_ORI_TABLE]; - BA_REC_ENTRY BARecEntry[MAX_LEN_OF_BA_REC_TABLE]; + ULONG numAsRecipient; // I am recipient of numAsRecipient clients. These client are in the BARecEntry[] + ULONG numAsOriginator; // I am originator of numAsOriginator clients. These clients are in the BAOriEntry[] + ULONG numDoneOriginator; // count Done Originator sessions + BA_ORI_ENTRY BAOriEntry[MAX_LEN_OF_BA_ORI_TABLE]; + BA_REC_ENTRY BARecEntry[MAX_LEN_OF_BA_REC_TABLE]; } BA_TABLE, *PBA_TABLE; //For QureyBATableOID use; -typedef struct PACKED _OID_BA_REC_ENTRY{ - UCHAR MACAddr[MAC_ADDR_LEN]; - UCHAR BaBitmap; // if (BaBitmap&(1<MaxHTPhyMode.field.MODE >= MODE_HTMIX) @@ -1131,78 +1078,75 @@ typedef struct { #define PEER_IS_HT_RATE(_pMacEntry) \ (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX) - - //This structure is for all 802.11n card InterOptibilityTest action. Reset all Num every n second. (Details see MLMEPeriodic) -typedef struct _IOT_STRUC { - UCHAR Threshold[2]; - UCHAR ReorderTimeOutNum[MAX_LEN_OF_BA_REC_TABLE]; // compare with threshold[0] - UCHAR RefreshNum[MAX_LEN_OF_BA_REC_TABLE]; // compare with threshold[1] - ULONG OneSecInWindowCount; - ULONG OneSecFrameDuplicateCount; - ULONG OneSecOutWindowCount; - UCHAR DelOriAct; - UCHAR DelRecAct; - UCHAR RTSShortProt; - UCHAR RTSLongProt; - BOOLEAN bRTSLongProtOn; - BOOLEAN bLastAtheros; - BOOLEAN bCurrentAtheros; - BOOLEAN bNowAtherosBurstOn; - BOOLEAN bNextDisableRxBA; - BOOLEAN bToggle; +typedef struct _IOT_STRUC { + UCHAR Threshold[2]; + UCHAR ReorderTimeOutNum[MAX_LEN_OF_BA_REC_TABLE]; // compare with threshold[0] + UCHAR RefreshNum[MAX_LEN_OF_BA_REC_TABLE]; // compare with threshold[1] + ULONG OneSecInWindowCount; + ULONG OneSecFrameDuplicateCount; + ULONG OneSecOutWindowCount; + UCHAR DelOriAct; + UCHAR DelRecAct; + UCHAR RTSShortProt; + UCHAR RTSLongProt; + BOOLEAN bRTSLongProtOn; + BOOLEAN bLastAtheros; + BOOLEAN bCurrentAtheros; + BOOLEAN bNowAtherosBurstOn; + BOOLEAN bNextDisableRxBA; + BOOLEAN bToggle; } IOT_STRUC, *PIOT_STRUC; // This is the registry setting for 802.11n transmit setting. Used in advanced page. typedef union _REG_TRANSMIT_SETTING { - struct { - //UINT32 PhyMode:4; - //UINT32 MCS:7; // MCS - UINT32 rsv0:10; - UINT32 TxBF:1; - UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz - UINT32 ShortGI:1; - UINT32 STBC:1; //SPACE - UINT32 TRANSNO:2; - UINT32 HTMODE:1; - UINT32 EXTCHA:2; - UINT32 rsv:13; - } field; - UINT32 word; + struct { + //UINT32 PhyMode:4; + //UINT32 MCS:7; // MCS + UINT32 rsv0:10; + UINT32 TxBF:1; + UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz + UINT32 ShortGI:1; + UINT32 STBC:1; //SPACE + UINT32 TRANSNO:2; + UINT32 HTMODE:1; + UINT32 EXTCHA:2; + UINT32 rsv:13; + } field; + UINT32 word; } REG_TRANSMIT_SETTING, *PREG_TRANSMIT_SETTING; -typedef union _DESIRED_TRANSMIT_SETTING { - struct { - USHORT MCS:7; // MCS - USHORT PhyMode:4; - USHORT FixedTxMode:2; // If MCS isn't AUTO, fix rate in CCK, OFDM or HT mode. - USHORT rsv:3; - } field; - USHORT word; - } DESIRED_TRANSMIT_SETTING, *PDESIRED_TRANSMIT_SETTING; +typedef union _DESIRED_TRANSMIT_SETTING { + struct { + USHORT MCS:7; // MCS + USHORT PhyMode:4; + USHORT FixedTxMode:2; // If MCS isn't AUTO, fix rate in CCK, OFDM or HT mode. + USHORT rsv:3; + } field; + USHORT word; +} DESIRED_TRANSMIT_SETTING, *PDESIRED_TRANSMIT_SETTING; #ifdef RTMP_MAC_USB /*************************************************************************** * USB-based chip Beacon related data structures **************************************************************************/ #define BEACON_BITMAP_MASK 0xff -typedef struct _BEACON_SYNC_STRUCT_ -{ - UCHAR BeaconBuf[HW_BEACON_MAX_COUNT][HW_BEACON_OFFSET]; - UCHAR BeaconTxWI[HW_BEACON_MAX_COUNT][TXWI_SIZE]; - ULONG TimIELocationInBeacon[HW_BEACON_MAX_COUNT]; - ULONG CapabilityInfoLocationInBeacon[HW_BEACON_MAX_COUNT]; - BOOLEAN EnableBeacon; // trigger to enable beacon transmission. - UCHAR BeaconBitMap; // NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change. - UCHAR DtimBitOn; // NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change. -}BEACON_SYNC_STRUCT; +typedef struct _BEACON_SYNC_STRUCT_ { + UCHAR BeaconBuf[HW_BEACON_MAX_COUNT][HW_BEACON_OFFSET]; + UCHAR BeaconTxWI[HW_BEACON_MAX_COUNT][TXWI_SIZE]; + ULONG TimIELocationInBeacon[HW_BEACON_MAX_COUNT]; + ULONG CapabilityInfoLocationInBeacon[HW_BEACON_MAX_COUNT]; + BOOLEAN EnableBeacon; // trigger to enable beacon transmission. + UCHAR BeaconBitMap; // NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change. + UCHAR DtimBitOn; // NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change. +} BEACON_SYNC_STRUCT; #endif // RTMP_MAC_USB // /*************************************************************************** * Multiple SSID related data structures **************************************************************************/ -#define WLAN_MAX_NUM_OF_TIM ((MAX_LEN_OF_MAC_TABLE >> 3) + 1) /* /8 + 1 */ -#define WLAN_CT_TIM_BCMC_OFFSET 0 /* unit: 32B */ +#define WLAN_MAX_NUM_OF_TIM ((MAX_LEN_OF_MAC_TABLE >> 3) + 1) /* /8 + 1 */ +#define WLAN_CT_TIM_BCMC_OFFSET 0 /* unit: 32B */ /* clear bcmc TIM bit */ #define WLAN_MR_TIM_BCMC_CLEAR(apidx) \ @@ -1224,183 +1168,181 @@ typedef struct _BEACON_SYNC_STRUCT_ UCHAR bit_offset = wcid & 0x7; \ ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] |= BIT8[bit_offset]; } - // configuration common to OPMODE_AP as well as OPMODE_STA typedef struct _COMMON_CONFIG { - BOOLEAN bCountryFlag; - UCHAR CountryCode[3]; - UCHAR Geography; - UCHAR CountryRegion; // Enum of country region, 0:FCC, 1:IC, 2:ETSI, 3:SPAIN, 4:France, 5:MKK, 6:MKK1, 7:Israel - UCHAR CountryRegionForABand; // Enum of country region for A band - UCHAR PhyMode; // PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED - USHORT Dsifs; // in units of usec - ULONG PacketFilter; // Packet filter for receiving - UINT8 RegulatoryClass; - - CHAR Ssid[MAX_LEN_OF_SSID]; // NOT NULL-terminated - UCHAR SsidLen; // the actual ssid length in used - UCHAR LastSsidLen; // the actual ssid length in used - CHAR LastSsid[MAX_LEN_OF_SSID]; // NOT NULL-terminated - UCHAR LastBssid[MAC_ADDR_LEN]; - - UCHAR Bssid[MAC_ADDR_LEN]; - USHORT BeaconPeriod; - UCHAR Channel; - UCHAR CentralChannel; // Central Channel when using 40MHz is indicating. not real channel. - - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR ExtRateLen; - UCHAR DesireRate[MAX_LEN_OF_SUPPORTED_RATES]; // OID_802_11_DESIRED_RATES - UCHAR MaxDesiredRate; - UCHAR ExpectedACKRate[MAX_LEN_OF_SUPPORTED_RATES]; - - ULONG BasicRateBitmap; // backup basic ratebitmap - - BOOLEAN bAPSDCapable; - BOOLEAN bInServicePeriod; - BOOLEAN bAPSDAC_BE; - BOOLEAN bAPSDAC_BK; - BOOLEAN bAPSDAC_VI; - BOOLEAN bAPSDAC_VO; + BOOLEAN bCountryFlag; + UCHAR CountryCode[3]; + UCHAR Geography; + UCHAR CountryRegion; // Enum of country region, 0:FCC, 1:IC, 2:ETSI, 3:SPAIN, 4:France, 5:MKK, 6:MKK1, 7:Israel + UCHAR CountryRegionForABand; // Enum of country region for A band + UCHAR PhyMode; // PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED + USHORT Dsifs; // in units of usec + ULONG PacketFilter; // Packet filter for receiving + UINT8 RegulatoryClass; + + CHAR Ssid[MAX_LEN_OF_SSID]; // NOT NULL-terminated + UCHAR SsidLen; // the actual ssid length in used + UCHAR LastSsidLen; // the actual ssid length in used + CHAR LastSsid[MAX_LEN_OF_SSID]; // NOT NULL-terminated + UCHAR LastBssid[MAC_ADDR_LEN]; + + UCHAR Bssid[MAC_ADDR_LEN]; + USHORT BeaconPeriod; + UCHAR Channel; + UCHAR CentralChannel; // Central Channel when using 40MHz is indicating. not real channel. + + UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; + UCHAR SupRateLen; + UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; + UCHAR ExtRateLen; + UCHAR DesireRate[MAX_LEN_OF_SUPPORTED_RATES]; // OID_802_11_DESIRED_RATES + UCHAR MaxDesiredRate; + UCHAR ExpectedACKRate[MAX_LEN_OF_SUPPORTED_RATES]; + + ULONG BasicRateBitmap; // backup basic ratebitmap + + BOOLEAN bAPSDCapable; + BOOLEAN bInServicePeriod; + BOOLEAN bAPSDAC_BE; + BOOLEAN bAPSDAC_BK; + BOOLEAN bAPSDAC_VI; + BOOLEAN bAPSDAC_VO; /* because TSPEC can modify the APSD flag, we need to keep the APSD flag - requested in association stage from the station; - we need to recover the APSD flag after the TSPEC is deleted. */ - BOOLEAN bACMAPSDBackup[4]; /* for delivery-enabled & trigger-enabled both */ - BOOLEAN bACMAPSDTr[4]; /* no use */ - - BOOLEAN bNeedSendTriggerFrame; - BOOLEAN bAPSDForcePowerSave; // Force power save mode, should only use in APSD-STAUT - ULONG TriggerTimerCount; - UCHAR MaxSPLength; - UCHAR BBPCurrentBW; // BW_10, BW_20, BW_40 + requested in association stage from the station; + we need to recover the APSD flag after the TSPEC is deleted. */ + BOOLEAN bACMAPSDBackup[4]; /* for delivery-enabled & trigger-enabled both */ + BOOLEAN bACMAPSDTr[4]; /* no use */ + + BOOLEAN bNeedSendTriggerFrame; + BOOLEAN bAPSDForcePowerSave; // Force power save mode, should only use in APSD-STAUT + ULONG TriggerTimerCount; + UCHAR MaxSPLength; + UCHAR BBPCurrentBW; // BW_10, BW_20, BW_40 // move to MULTISSID_STRUCT for MBSS - //HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI. - REG_TRANSMIT_SETTING RegTransmitSetting; //registry transmit setting. this is for reading registry setting only. not useful. + //HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI. + REG_TRANSMIT_SETTING RegTransmitSetting; //registry transmit setting. this is for reading registry setting only. not useful. //UCHAR FixedTxMode; // Fixed Tx Mode (CCK, OFDM), for HT fixed tx mode (GF, MIX) , refer to RegTransmitSetting.field.HTMode - UCHAR TxRate; // Same value to fill in TXD. TxRate is 6-bit - UCHAR MaxTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11 - UCHAR TxRateIndex; // Tx rate index in RateSwitchTable - UCHAR TxRateTableSize; // Valid Tx rate table size in RateSwitchTable - //BOOLEAN bAutoTxRateSwitch; - UCHAR MinTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11 - UCHAR RtsRate; // RATE_xxx - HTTRANSMIT_SETTING MlmeTransmit; // MGMT frame PHY rate setting when operatin at Ht rate. - UCHAR MlmeRate; // RATE_xxx, used to send MLME frames - UCHAR BasicMlmeRate; // Default Rate for sending MLME frames - - USHORT RtsThreshold; // in unit of BYTE - USHORT FragmentThreshold; // in unit of BYTE - - UCHAR TxPower; // in unit of mW - ULONG TxPowerPercentage; // 0~100 % - ULONG TxPowerDefault; // keep for TxPowerPercentage - UINT8 PwrConstraint; - - BACAP_STRUC BACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 - BACAP_STRUC REGBACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 - - IOT_STRUC IOTestParm; // 802.11n InterOpbility Test Parameter; - ULONG TxPreamble; // Rt802_11PreambleLong, Rt802_11PreambleShort, Rt802_11PreambleAuto - BOOLEAN bUseZeroToDisableFragment; // Microsoft use 0 as disable - ULONG UseBGProtection; // 0: auto, 1: always use, 2: always not use - BOOLEAN bUseShortSlotTime; // 0: disable, 1 - use short slot (9us) - BOOLEAN bEnableTxBurst; // 1: enble TX PACKET BURST (when BA is established or AP is not a legacy WMM AP), 0: disable TX PACKET BURST - BOOLEAN bAggregationCapable; // 1: enable TX aggregation when the peer supports it - BOOLEAN bPiggyBackCapable; // 1: enable TX piggy-back according MAC's version - BOOLEAN bIEEE80211H; // 1: enable IEEE802.11h spec. - ULONG DisableOLBCDetect; // 0: enable OLBC detect; 1 disable OLBC detect - - BOOLEAN bRdg; - - BOOLEAN bWmmCapable; // 0:disable WMM, 1:enable WMM - QOS_CAPABILITY_PARM APQosCapability; // QOS capability of the current associated AP - EDCA_PARM APEdcaParm; // EDCA parameters of the current associated AP - QBSS_LOAD_PARM APQbssLoad; // QBSS load of the current associated AP - UCHAR AckPolicy[4]; // ACK policy of the specified AC. see ACK_xxx - BOOLEAN bDLSCapable; // 0:disable DLS, 1:enable DLS + UCHAR TxRate; // Same value to fill in TXD. TxRate is 6-bit + UCHAR MaxTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11 + UCHAR TxRateIndex; // Tx rate index in RateSwitchTable + UCHAR TxRateTableSize; // Valid Tx rate table size in RateSwitchTable + //BOOLEAN bAutoTxRateSwitch; + UCHAR MinTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11 + UCHAR RtsRate; // RATE_xxx + HTTRANSMIT_SETTING MlmeTransmit; // MGMT frame PHY rate setting when operatin at Ht rate. + UCHAR MlmeRate; // RATE_xxx, used to send MLME frames + UCHAR BasicMlmeRate; // Default Rate for sending MLME frames + + USHORT RtsThreshold; // in unit of BYTE + USHORT FragmentThreshold; // in unit of BYTE + + UCHAR TxPower; // in unit of mW + ULONG TxPowerPercentage; // 0~100 % + ULONG TxPowerDefault; // keep for TxPowerPercentage + UINT8 PwrConstraint; + + BACAP_STRUC BACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 + BACAP_STRUC REGBACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 + + IOT_STRUC IOTestParm; // 802.11n InterOpbility Test Parameter; + ULONG TxPreamble; // Rt802_11PreambleLong, Rt802_11PreambleShort, Rt802_11PreambleAuto + BOOLEAN bUseZeroToDisableFragment; // Microsoft use 0 as disable + ULONG UseBGProtection; // 0: auto, 1: always use, 2: always not use + BOOLEAN bUseShortSlotTime; // 0: disable, 1 - use short slot (9us) + BOOLEAN bEnableTxBurst; // 1: enble TX PACKET BURST (when BA is established or AP is not a legacy WMM AP), 0: disable TX PACKET BURST + BOOLEAN bAggregationCapable; // 1: enable TX aggregation when the peer supports it + BOOLEAN bPiggyBackCapable; // 1: enable TX piggy-back according MAC's version + BOOLEAN bIEEE80211H; // 1: enable IEEE802.11h spec. + ULONG DisableOLBCDetect; // 0: enable OLBC detect; 1 disable OLBC detect + + BOOLEAN bRdg; + + BOOLEAN bWmmCapable; // 0:disable WMM, 1:enable WMM + QOS_CAPABILITY_PARM APQosCapability; // QOS capability of the current associated AP + EDCA_PARM APEdcaParm; // EDCA parameters of the current associated AP + QBSS_LOAD_PARM APQbssLoad; // QBSS load of the current associated AP + UCHAR AckPolicy[4]; // ACK policy of the specified AC. see ACK_xxx + BOOLEAN bDLSCapable; // 0:disable DLS, 1:enable DLS // a bitmap of BOOLEAN flags. each bit represent an operation status of a particular // BOOLEAN control, either ON or OFF. These flags should always be accessed via // OPSTATUS_TEST_FLAG(), OPSTATUS_SET_FLAG(), OP_STATUS_CLEAR_FLAG() macros. // see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition - ULONG OpStatusFlags; + ULONG OpStatusFlags; - BOOLEAN NdisRadioStateOff; //For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff. - ABGBAND_STATE BandState; // For setting BBP used on B/G or A mode. + BOOLEAN NdisRadioStateOff; //For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff. + ABGBAND_STATE BandState; // For setting BBP used on B/G or A mode. // IEEE802.11H--DFS. - RADAR_DETECT_STRUCT RadarDetect; + RADAR_DETECT_STRUCT RadarDetect; // HT - UCHAR BASize; // USer desired BAWindowSize. Should not exceed our max capability - //RT_HT_CAPABILITY SupportedHtPhy; - RT_HT_CAPABILITY DesiredHtPhy; - HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHTInfo; // Useful as AP. + UCHAR BASize; // USer desired BAWindowSize. Should not exceed our max capability + //RT_HT_CAPABILITY SupportedHtPhy; + RT_HT_CAPABILITY DesiredHtPhy; + HT_CAPABILITY_IE HtCapability; + ADD_HT_INFO_IE AddHTInfo; // Useful as AP. //This IE is used with channel switch announcement element when changing to a new 40MHz. //This IE is included in channel switch ammouncement frames 7.4.1.5, beacons, probe Rsp. - NEW_EXT_CHAN_IE NewExtChanOffset; //7.3.2.20A, 1 if extension channel is above the control channel, 3 if below, 0 if not present + NEW_EXT_CHAN_IE NewExtChanOffset; //7.3.2.20A, 1 if extension channel is above the control channel, 3 if below, 0 if not present - BOOLEAN bHTProtect; - BOOLEAN bMIMOPSEnable; - BOOLEAN bBADecline; + BOOLEAN bHTProtect; + BOOLEAN bMIMOPSEnable; + BOOLEAN bBADecline; //2008/11/05: KH add to support Antenna power-saving of AP<-- - BOOLEAN bGreenAPEnable; + BOOLEAN bGreenAPEnable; //2008/11/05: KH add to support Antenna power-saving of AP--> - BOOLEAN bDisableReordering; - BOOLEAN bForty_Mhz_Intolerant; - BOOLEAN bExtChannelSwitchAnnouncement; - BOOLEAN bRcvBSSWidthTriggerEvents; - ULONG LastRcvBSSWidthTriggerEventsTime; + BOOLEAN bDisableReordering; + BOOLEAN bForty_Mhz_Intolerant; + BOOLEAN bExtChannelSwitchAnnouncement; + BOOLEAN bRcvBSSWidthTriggerEvents; + ULONG LastRcvBSSWidthTriggerEventsTime; - UCHAR TxBASize; + UCHAR TxBASize; // Enable wireless event - BOOLEAN bWirelessEvent; - BOOLEAN bWiFiTest; // Enable this parameter for WiFi test + BOOLEAN bWirelessEvent; + BOOLEAN bWiFiTest; // Enable this parameter for WiFi test // Tx & Rx Stream number selection - UCHAR TxStream; - UCHAR RxStream; + UCHAR TxStream; + UCHAR RxStream; - BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled + BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled #ifdef RTMP_MAC_USB - BOOLEAN bMultipleIRP; // Multiple Bulk IN flag - UCHAR NumOfBulkInIRP; // if bMultipleIRP == TRUE, NumOfBulkInIRP will be 4 otherwise be 1 - RT_HT_CAPABILITY SupportedHtPhy; - ULONG MaxPktOneTxBulk; - UCHAR TxBulkFactor; - UCHAR RxBulkFactor; - - BOOLEAN IsUpdateBeacon; - BEACON_SYNC_STRUCT *pBeaconSync; - RALINK_TIMER_STRUCT BeaconUpdateTimer; - UINT32 BeaconAdjust; - UINT32 BeaconFactor; - UINT32 BeaconRemain; -#endif // RTMP_MAC_USB // + BOOLEAN bMultipleIRP; // Multiple Bulk IN flag + UCHAR NumOfBulkInIRP; // if bMultipleIRP == TRUE, NumOfBulkInIRP will be 4 otherwise be 1 + RT_HT_CAPABILITY SupportedHtPhy; + ULONG MaxPktOneTxBulk; + UCHAR TxBulkFactor; + UCHAR RxBulkFactor; + + BOOLEAN IsUpdateBeacon; + BEACON_SYNC_STRUCT *pBeaconSync; + RALINK_TIMER_STRUCT BeaconUpdateTimer; + UINT32 BeaconAdjust; + UINT32 BeaconFactor; + UINT32 BeaconRemain; +#endif // RTMP_MAC_USB // - NDIS_SPIN_LOCK MeasureReqTabLock; - PMEASURE_REQ_TAB pMeasureReqTab; + NDIS_SPIN_LOCK MeasureReqTabLock; + PMEASURE_REQ_TAB pMeasureReqTab; - NDIS_SPIN_LOCK TpcReqTabLock; - PTPC_REQ_TAB pTpcReqTab; + NDIS_SPIN_LOCK TpcReqTabLock; + PTPC_REQ_TAB pTpcReqTab; - BOOLEAN PSPXlink; // 0: Disable. 1: Enable + BOOLEAN PSPXlink; // 0: Disable. 1: Enable #if defined(RT305x)||defined(RT30xx) // request by Gary, for High Power issue - UCHAR HighPowerPatchDisabled; + UCHAR HighPowerPatchDisabled; #endif - BOOLEAN HT_DisallowTKIP; /* Restrict the encryption type in 11n HT mode */ + BOOLEAN HT_DisallowTKIP; /* Restrict the encryption type in 11n HT mode */ } COMMON_CONFIG, *PCOMMON_CONFIG; - /* Modified by Wu Xi-Kun 4/21/2006 */ // STA configuration and status typedef struct _STA_ADMIN_CONFIG { @@ -1410,165 +1352,161 @@ typedef struct _STA_ADMIN_CONFIG { // settings in ACTIVE BSS after negotiation/compromize with the BSS holder (either // AP or IBSS holder). // Once initialized, user configuration can only be changed via OID_xxx - UCHAR BssType; // BSS_INFRA or BSS_ADHOC - USHORT AtimWin; // used when starting a new IBSS + UCHAR BssType; // BSS_INFRA or BSS_ADHOC + USHORT AtimWin; // used when starting a new IBSS // GROUP 2 - // User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe // the user intended configuration, and should be always applied to the final // settings in ACTIVE BSS without compromising with the BSS holder. // Once initialized, user configuration can only be changed via OID_xxx - UCHAR RssiTrigger; - UCHAR RssiTriggerMode; // RSSI_TRIGGERED_UPON_BELOW_THRESHOLD or RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD - USHORT DefaultListenCount; // default listen count; - ULONG WindowsPowerMode; // Power mode for AC power - ULONG WindowsBatteryPowerMode; // Power mode for battery if exists - BOOLEAN bWindowsACCAMEnable; // Enable CAM power mode when AC on - BOOLEAN bAutoReconnect; // Set to TRUE when setting OID_802_11_SSID with no matching BSSID - ULONG WindowsPowerProfile; // Windows power profile, for NDIS5.1 PnP + UCHAR RssiTrigger; + UCHAR RssiTriggerMode; // RSSI_TRIGGERED_UPON_BELOW_THRESHOLD or RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD + USHORT DefaultListenCount; // default listen count; + ULONG WindowsPowerMode; // Power mode for AC power + ULONG WindowsBatteryPowerMode; // Power mode for battery if exists + BOOLEAN bWindowsACCAMEnable; // Enable CAM power mode when AC on + BOOLEAN bAutoReconnect; // Set to TRUE when setting OID_802_11_SSID with no matching BSSID + ULONG WindowsPowerProfile; // Windows power profile, for NDIS5.1 PnP // MIB:ieee802dot11.dot11smt(1).dot11StationConfigTable(1) - USHORT Psm; // power management mode (PWR_ACTIVE|PWR_SAVE) - USHORT DisassocReason; - UCHAR DisassocSta[MAC_ADDR_LEN]; - USHORT DeauthReason; - UCHAR DeauthSta[MAC_ADDR_LEN]; - USHORT AuthFailReason; - UCHAR AuthFailSta[MAC_ADDR_LEN]; - - NDIS_802_11_PRIVACY_FILTER PrivacyFilter; // PrivacyFilter enum for 802.1X - NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined - NDIS_802_11_WEP_STATUS WepStatus; - NDIS_802_11_WEP_STATUS OrigWepStatus; // Original wep status set from OID + USHORT Psm; // power management mode (PWR_ACTIVE|PWR_SAVE) + USHORT DisassocReason; + UCHAR DisassocSta[MAC_ADDR_LEN]; + USHORT DeauthReason; + UCHAR DeauthSta[MAC_ADDR_LEN]; + USHORT AuthFailReason; + UCHAR AuthFailSta[MAC_ADDR_LEN]; + + NDIS_802_11_PRIVACY_FILTER PrivacyFilter; // PrivacyFilter enum for 802.1X + NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined + NDIS_802_11_WEP_STATUS WepStatus; + NDIS_802_11_WEP_STATUS OrigWepStatus; // Original wep status set from OID // Add to support different cipher suite for WPA2/WPA mode - NDIS_802_11_ENCRYPTION_STATUS GroupCipher; // Multicast cipher suite - NDIS_802_11_ENCRYPTION_STATUS PairCipher; // Unicast cipher suite - BOOLEAN bMixCipher; // Indicate current Pair & Group use different cipher suites - USHORT RsnCapability; + NDIS_802_11_ENCRYPTION_STATUS GroupCipher; // Multicast cipher suite + NDIS_802_11_ENCRYPTION_STATUS PairCipher; // Unicast cipher suite + BOOLEAN bMixCipher; // Indicate current Pair & Group use different cipher suites + USHORT RsnCapability; - NDIS_802_11_WEP_STATUS GroupKeyWepStatus; + NDIS_802_11_WEP_STATUS GroupKeyWepStatus; - UCHAR WpaPassPhrase[64]; // WPA PSK pass phrase - UINT WpaPassPhraseLen; // the length of WPA PSK pass phrase - UCHAR PMK[32]; // WPA PSK mode PMK - UCHAR PTK[64]; // WPA PSK mode PTK - UCHAR GTK[32]; // GTK from authenticator - BSSID_INFO SavedPMK[PMKID_NO]; - UINT SavedPMKNum; // Saved PMKID number - - UCHAR DefaultKeyId; + UCHAR WpaPassPhrase[64]; // WPA PSK pass phrase + UINT WpaPassPhraseLen; // the length of WPA PSK pass phrase + UCHAR PMK[32]; // WPA PSK mode PMK + UCHAR PTK[64]; // WPA PSK mode PTK + UCHAR GTK[32]; // GTK from authenticator + BSSID_INFO SavedPMK[PMKID_NO]; + UINT SavedPMKNum; // Saved PMKID number + UCHAR DefaultKeyId; // WPA 802.1x port control, WPA_802_1X_PORT_SECURED, WPA_802_1X_PORT_NOT_SECURED - UCHAR PortSecured; + UCHAR PortSecured; // For WPA countermeasures - ULONG LastMicErrorTime; // record last MIC error time - ULONG MicErrCnt; // Should be 0, 1, 2, then reset to zero (after disassoiciation). - BOOLEAN bBlockAssoc; // Block associate attempt for 60 seconds after counter measure occurred. + ULONG LastMicErrorTime; // record last MIC error time + ULONG MicErrCnt; // Should be 0, 1, 2, then reset to zero (after disassoiciation). + BOOLEAN bBlockAssoc; // Block associate attempt for 60 seconds after counter measure occurred. // For WPA-PSK supplicant state - WPA_STATE WpaState; // Default is SS_NOTUSE and handled by microsoft 802.1x - UCHAR ReplayCounter[8]; - UCHAR ANonce[32]; // ANonce for WPA-PSK from aurhenticator - UCHAR SNonce[32]; // SNonce for WPA-PSK + WPA_STATE WpaState; // Default is SS_NOTUSE and handled by microsoft 802.1x + UCHAR ReplayCounter[8]; + UCHAR ANonce[32]; // ANonce for WPA-PSK from aurhenticator + UCHAR SNonce[32]; // SNonce for WPA-PSK - UCHAR LastSNR0; // last received BEACON's SNR - UCHAR LastSNR1; // last received BEACON's SNR for 2nd antenna + UCHAR LastSNR0; // last received BEACON's SNR + UCHAR LastSNR1; // last received BEACON's SNR for 2nd antenna RSSI_SAMPLE RssiSample; - ULONG NumOfAvgRssiSample; + ULONG NumOfAvgRssiSample; - ULONG LastBeaconRxTime; // OS's timestamp of the last BEACON RX time - ULONG Last11bBeaconRxTime; // OS's timestamp of the last 11B BEACON RX time - ULONG Last11gBeaconRxTime; // OS's timestamp of the last 11G BEACON RX time - ULONG Last20NBeaconRxTime; // OS's timestamp of the last 20MHz N BEACON RX time + ULONG LastBeaconRxTime; // OS's timestamp of the last BEACON RX time + ULONG Last11bBeaconRxTime; // OS's timestamp of the last 11B BEACON RX time + ULONG Last11gBeaconRxTime; // OS's timestamp of the last 11G BEACON RX time + ULONG Last20NBeaconRxTime; // OS's timestamp of the last 20MHz N BEACON RX time - ULONG LastScanTime; // Record last scan time for issue BSSID_SCAN_LIST - ULONG ScanCnt; // Scan counts since most recent SSID, BSSID, SCAN OID request - BOOLEAN bSwRadio; // Software controlled Radio On/Off, TRUE: On - BOOLEAN bHwRadio; // Hardware controlled Radio On/Off, TRUE: On - BOOLEAN bRadio; // Radio state, And of Sw & Hw radio state - BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled - BOOLEAN bShowHiddenSSID; // Show all known SSID in SSID list get operation + ULONG LastScanTime; // Record last scan time for issue BSSID_SCAN_LIST + ULONG ScanCnt; // Scan counts since most recent SSID, BSSID, SCAN OID request + BOOLEAN bSwRadio; // Software controlled Radio On/Off, TRUE: On + BOOLEAN bHwRadio; // Hardware controlled Radio On/Off, TRUE: On + BOOLEAN bRadio; // Radio state, And of Sw & Hw radio state + BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled + BOOLEAN bShowHiddenSSID; // Show all known SSID in SSID list get operation // New for WPA, windows want us to keep association information and // Fixed IEs from last association response - NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo; - USHORT ReqVarIELen; // Length of next VIE include EID & Length - UCHAR ReqVarIEs[MAX_VIE_LEN]; // The content saved here should be little-endian format. - USHORT ResVarIELen; // Length of next VIE include EID & Length - UCHAR ResVarIEs[MAX_VIE_LEN]; - - UCHAR RSNIE_Len; - UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; // The content saved here should be little-endian format. - - ULONG CLBusyBytes; // Save the total bytes received durning channel load scan time - USHORT RPIDensity[8]; // Array for RPI density collection - - UCHAR RMReqCnt; // Number of measurement request saved. - UCHAR CurrentRMReqIdx; // Number of measurement request saved. - BOOLEAN ParallelReq; // Parallel measurement, only one request performed, - // It must be the same channel with maximum duration - USHORT ParallelDuration; // Maximum duration for parallel measurement - UCHAR ParallelChannel; // Only one channel with parallel measurement - USHORT IAPPToken; // IAPP dialog token + NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo; + USHORT ReqVarIELen; // Length of next VIE include EID & Length + UCHAR ReqVarIEs[MAX_VIE_LEN]; // The content saved here should be little-endian format. + USHORT ResVarIELen; // Length of next VIE include EID & Length + UCHAR ResVarIEs[MAX_VIE_LEN]; + + UCHAR RSNIE_Len; + UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; // The content saved here should be little-endian format. + + ULONG CLBusyBytes; // Save the total bytes received durning channel load scan time + USHORT RPIDensity[8]; // Array for RPI density collection + + UCHAR RMReqCnt; // Number of measurement request saved. + UCHAR CurrentRMReqIdx; // Number of measurement request saved. + BOOLEAN ParallelReq; // Parallel measurement, only one request performed, + // It must be the same channel with maximum duration + USHORT ParallelDuration; // Maximum duration for parallel measurement + UCHAR ParallelChannel; // Only one channel with parallel measurement + USHORT IAPPToken; // IAPP dialog token // Hack for channel load and noise histogram parameters - UCHAR NHFactor; // Parameter for Noise histogram - UCHAR CLFactor; // Parameter for channel load + UCHAR NHFactor; // Parameter for Noise histogram + UCHAR CLFactor; // Parameter for channel load - RALINK_TIMER_STRUCT StaQuickResponeForRateUpTimer; - BOOLEAN StaQuickResponeForRateUpTimerRunning; + RALINK_TIMER_STRUCT StaQuickResponeForRateUpTimer; + BOOLEAN StaQuickResponeForRateUpTimerRunning; - UCHAR DtimCount; // 0.. DtimPeriod-1 - UCHAR DtimPeriod; // default = 3 + UCHAR DtimCount; // 0.. DtimPeriod-1 + UCHAR DtimPeriod; // default = 3 //////////////////////////////////////////////////////////////////////////////////////// // This is only for WHQL test. - BOOLEAN WhqlTest; + BOOLEAN WhqlTest; //////////////////////////////////////////////////////////////////////////////////////// - RALINK_TIMER_STRUCT WpaDisassocAndBlockAssocTimer; - // Fast Roaming - BOOLEAN bAutoRoaming; // 0:disable auto roaming by RSSI, 1:enable auto roaming by RSSI - CHAR dBmToRoam; // the condition to roam when receiving Rssi less than this value. It's negative value. + RALINK_TIMER_STRUCT WpaDisassocAndBlockAssocTimer; + // Fast Roaming + BOOLEAN bAutoRoaming; // 0:disable auto roaming by RSSI, 1:enable auto roaming by RSSI + CHAR dBmToRoam; // the condition to roam when receiving Rssi less than this value. It's negative value. - BOOLEAN IEEE8021X; - BOOLEAN IEEE8021x_required_keys; - CIPHER_KEY DesireSharedKey[4]; // Record user desired WEP keys - UCHAR DesireSharedKeyId; + BOOLEAN IEEE8021X; + BOOLEAN IEEE8021x_required_keys; + CIPHER_KEY DesireSharedKey[4]; // Record user desired WEP keys + UCHAR DesireSharedKeyId; - // 0: driver ignores wpa_supplicant - // 1: wpa_supplicant initiates scanning and AP selection - // 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters - UCHAR WpaSupplicantUP; - UCHAR WpaSupplicantScanCount; - BOOLEAN bRSN_IE_FromWpaSupplicant; + // 0: driver ignores wpa_supplicant + // 1: wpa_supplicant initiates scanning and AP selection + // 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters + UCHAR WpaSupplicantUP; + UCHAR WpaSupplicantScanCount; + BOOLEAN bRSN_IE_FromWpaSupplicant; - CHAR dev_name[16]; - USHORT OriDevType; + CHAR dev_name[16]; + USHORT OriDevType; - BOOLEAN bTGnWifiTest; - BOOLEAN bScanReqIsFromWebUI; + BOOLEAN bTGnWifiTest; + BOOLEAN bScanReqIsFromWebUI; - HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI. - DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; - RT_HT_PHY_INFO DesiredHtPhyInfo; - BOOLEAN bAutoTxRateSwitch; + HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode; // For transmit phy setting in TXWI. + DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; + RT_HT_PHY_INFO DesiredHtPhyInfo; + BOOLEAN bAutoTxRateSwitch; #ifdef RTMP_MAC_PCI - UCHAR BBPR3; + UCHAR BBPR3; // PS Control has 2 meanings for advanced power save function. // 1. EnablePSinIdle : When no connection, always radio off except need to do site survey. // 2. EnableNewPS : will save more current in sleep or radio off mode. - PS_CONTROL PSControl; -#endif // RTMP_MAC_PCI // - - + PS_CONTROL PSControl; +#endif // RTMP_MAC_PCI // - - BOOLEAN bAutoConnectByBssid; - ULONG BeaconLostTime; // seconds - BOOLEAN bForceTxBurst; // 1: force enble TX PACKET BURST, 0: disable + BOOLEAN bAutoConnectByBssid; + ULONG BeaconLostTime; // seconds + BOOLEAN bForceTxBurst; // 1: force enble TX PACKET BURST, 0: disable } STA_ADMIN_CONFIG, *PSTA_ADMIN_CONFIG; // This data structure keep the current active BSS/IBSS's configuration that this STA @@ -1578,680 +1516,637 @@ typedef struct _STA_ADMIN_CONFIG { // Normally, after SCAN or failed roaming attempts, we need to recover back to // the current active settings. typedef struct _STA_ACTIVE_CONFIG { - USHORT Aid; - USHORT AtimWin; // in kusec; IBSS parameter set element - USHORT CapabilityInfo; - USHORT CfpMaxDuration; - USHORT CfpPeriod; + USHORT Aid; + USHORT AtimWin; // in kusec; IBSS parameter set element + USHORT CapabilityInfo; + USHORT CfpMaxDuration; + USHORT CfpPeriod; // Copy supported rate from desired AP's beacon. We are trying to match // AP's supported and extended rate settings. - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen; - UCHAR ExtRateLen; + UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; + UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; + UCHAR SupRateLen; + UCHAR ExtRateLen; // Copy supported ht from desired AP's beacon. We are trying to match - RT_HT_PHY_INFO SupportedPhyInfo; - RT_HT_CAPABILITY SupportedHtPhy; + RT_HT_PHY_INFO SupportedPhyInfo; + RT_HT_CAPABILITY SupportedHtPhy; } STA_ACTIVE_CONFIG, *PSTA_ACTIVE_CONFIG; - - - - - typedef struct _MAC_TABLE_ENTRY { //Choose 1 from ValidAsWDS and ValidAsCLI to validize. - BOOLEAN ValidAsCLI; // Sta mode, set this TRUE after Linkup,too. - BOOLEAN ValidAsWDS; // This is WDS Entry. only for AP mode. - BOOLEAN ValidAsApCli; //This is a AP-Client entry, only for AP mode which enable AP-Client functions. - BOOLEAN ValidAsMesh; - BOOLEAN ValidAsDls; // This is DLS Entry. only for STA mode. - BOOLEAN isCached; - BOOLEAN bIAmBadAtheros; // Flag if this is Atheros chip that has IOT problem. We need to turn on RTS/CTS protection. - - UCHAR EnqueueEapolStartTimerRunning; // Enqueue EAPoL-Start for triggering EAP SM + BOOLEAN ValidAsCLI; // Sta mode, set this TRUE after Linkup,too. + BOOLEAN ValidAsWDS; // This is WDS Entry. only for AP mode. + BOOLEAN ValidAsApCli; //This is a AP-Client entry, only for AP mode which enable AP-Client functions. + BOOLEAN ValidAsMesh; + BOOLEAN ValidAsDls; // This is DLS Entry. only for STA mode. + BOOLEAN isCached; + BOOLEAN bIAmBadAtheros; // Flag if this is Atheros chip that has IOT problem. We need to turn on RTS/CTS protection. + + UCHAR EnqueueEapolStartTimerRunning; // Enqueue EAPoL-Start for triggering EAP SM //jan for wpa // record which entry revoke MIC Failure , if it leaves the BSS itself, AP won't update aMICFailTime MIB - UCHAR CMTimerRunning; - UCHAR apidx; // MBSS number - UCHAR RSNIE_Len; - UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; - UCHAR ANonce[LEN_KEY_DESC_NONCE]; - UCHAR SNonce[LEN_KEY_DESC_NONCE]; - UCHAR R_Counter[LEN_KEY_DESC_REPLAY]; - UCHAR PTK[64]; - UCHAR ReTryCounter; - RALINK_TIMER_STRUCT RetryTimer; - RALINK_TIMER_STRUCT EnqueueStartForPSKTimer; // A timer which enqueue EAPoL-Start for triggering PSK SM - NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined - NDIS_802_11_WEP_STATUS WepStatus; - NDIS_802_11_WEP_STATUS GroupKeyWepStatus; - AP_WPA_STATE WpaState; - GTK_STATE GTKState; - USHORT PortSecured; - NDIS_802_11_PRIVACY_FILTER PrivacyFilter; // PrivacyFilter enum for 802.1X - CIPHER_KEY PairwiseKey; - PVOID pAd; - INT PMKID_CacheIdx; - UCHAR PMKID[LEN_PMKID]; - - - UCHAR Addr[MAC_ADDR_LEN]; - UCHAR PsMode; - SST Sst; - AUTH_STATE AuthState; // for SHARED KEY authentication state machine used only - BOOLEAN IsReassocSta; // Indicate whether this is a reassociation procedure - USHORT Aid; - USHORT CapabilityInfo; - UCHAR LastRssi; - ULONG NoDataIdleCount; - UINT16 StationKeepAliveCount; // unit: second - ULONG PsQIdleCount; - QUEUE_HEADER PsQueue; - - UINT32 StaConnectTime; // the live time of this station since associated with AP - - BOOLEAN bSendBAR; - USHORT NoBADataCountDown; - - UINT32 CachedBuf[16]; // UINT (4 bytes) for alignment - UINT TxBFCount; // 3*3 - UINT FIFOCount; - UINT DebugFIFOCount; - UINT DebugTxCount; - BOOLEAN bDlsInit; - + UCHAR CMTimerRunning; + UCHAR apidx; // MBSS number + UCHAR RSNIE_Len; + UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; + UCHAR ANonce[LEN_KEY_DESC_NONCE]; + UCHAR SNonce[LEN_KEY_DESC_NONCE]; + UCHAR R_Counter[LEN_KEY_DESC_REPLAY]; + UCHAR PTK[64]; + UCHAR ReTryCounter; + RALINK_TIMER_STRUCT RetryTimer; + RALINK_TIMER_STRUCT EnqueueStartForPSKTimer; // A timer which enqueue EAPoL-Start for triggering PSK SM + NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined + NDIS_802_11_WEP_STATUS WepStatus; + NDIS_802_11_WEP_STATUS GroupKeyWepStatus; + AP_WPA_STATE WpaState; + GTK_STATE GTKState; + USHORT PortSecured; + NDIS_802_11_PRIVACY_FILTER PrivacyFilter; // PrivacyFilter enum for 802.1X + CIPHER_KEY PairwiseKey; + PVOID pAd; + INT PMKID_CacheIdx; + UCHAR PMKID[LEN_PMKID]; + + UCHAR Addr[MAC_ADDR_LEN]; + UCHAR PsMode; + SST Sst; + AUTH_STATE AuthState; // for SHARED KEY authentication state machine used only + BOOLEAN IsReassocSta; // Indicate whether this is a reassociation procedure + USHORT Aid; + USHORT CapabilityInfo; + UCHAR LastRssi; + ULONG NoDataIdleCount; + UINT16 StationKeepAliveCount; // unit: second + ULONG PsQIdleCount; + QUEUE_HEADER PsQueue; + + UINT32 StaConnectTime; // the live time of this station since associated with AP + + BOOLEAN bSendBAR; + USHORT NoBADataCountDown; + + UINT32 CachedBuf[16]; // UINT (4 bytes) for alignment + UINT TxBFCount; // 3*3 + UINT FIFOCount; + UINT DebugFIFOCount; + UINT DebugTxCount; + BOOLEAN bDlsInit; //==================================================== //WDS entry needs these // if ValidAsWDS==TRUE, MatchWDSTabIdx is the index in WdsTab.MacTab - UINT MatchWDSTabIdx; - UCHAR MaxSupportedRate; - UCHAR CurrTxRate; - UCHAR CurrTxRateIndex; + UINT MatchWDSTabIdx; + UCHAR MaxSupportedRate; + UCHAR CurrTxRate; + UCHAR CurrTxRateIndex; // to record the each TX rate's quality. 0 is best, the bigger the worse. - USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH]; -// USHORT OneSecTxOkCount; - UINT32 OneSecTxNoRetryOkCount; - UINT32 OneSecTxRetryOkCount; - UINT32 OneSecTxFailCount; - UINT32 ContinueTxFailCnt; - UINT32 CurrTxRateStableTime; // # of second in current TX rate - UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition + USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH]; +// USHORT OneSecTxOkCount; + UINT32 OneSecTxNoRetryOkCount; + UINT32 OneSecTxRetryOkCount; + UINT32 OneSecTxFailCount; + UINT32 ContinueTxFailCnt; + UINT32 CurrTxRateStableTime; // # of second in current TX rate + UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition //==================================================== - BOOLEAN fNoisyEnvironment; - BOOLEAN fLastSecAccordingRSSI; - UCHAR LastSecTxRateChangeAction; // 0: no change, 1:rate UP, 2:rate down - CHAR LastTimeTxRateChangeAction; //Keep last time value of LastSecTxRateChangeAction - ULONG LastTxOkCount; - UCHAR PER[MAX_STEP_OF_TX_RATE_SWITCH]; + BOOLEAN fNoisyEnvironment; + BOOLEAN fLastSecAccordingRSSI; + UCHAR LastSecTxRateChangeAction; // 0: no change, 1:rate UP, 2:rate down + CHAR LastTimeTxRateChangeAction; //Keep last time value of LastSecTxRateChangeAction + ULONG LastTxOkCount; + UCHAR PER[MAX_STEP_OF_TX_RATE_SWITCH]; // a bitmap of BOOLEAN flags. each bit represent an operation status of a particular // BOOLEAN control, either ON or OFF. These flags should always be accessed via // CLIENT_STATUS_TEST_FLAG(), CLIENT_STATUS_SET_FLAG(), CLIENT_STATUS_CLEAR_FLAG() macros. // see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition. fCLIENT_STATUS_AMSDU_INUSED - ULONG ClientStatusFlags; + ULONG ClientStatusFlags; - HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI. + HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode; // For transmit phy setting in TXWI. // HT EWC MIMO-N used parameters - USHORT RXBAbitmap; // fill to on-chip RXWI_BA_BITMASK in 8.1.3RX attribute entry format - USHORT TXBAbitmap; // This bitmap as originator, only keep in software used to mark AMPDU bit in TXWI - USHORT TXAutoBAbitmap; - USHORT BADeclineBitmap; - USHORT BARecWcidArray[NUM_OF_TID]; // The mapping wcid of recipient session. if RXBAbitmap bit is masked - USHORT BAOriWcidArray[NUM_OF_TID]; // The mapping wcid of originator session. if TXBAbitmap bit is masked - USHORT BAOriSequence[NUM_OF_TID]; // The mapping wcid of originator session. if TXBAbitmap bit is masked + USHORT RXBAbitmap; // fill to on-chip RXWI_BA_BITMASK in 8.1.3RX attribute entry format + USHORT TXBAbitmap; // This bitmap as originator, only keep in software used to mark AMPDU bit in TXWI + USHORT TXAutoBAbitmap; + USHORT BADeclineBitmap; + USHORT BARecWcidArray[NUM_OF_TID]; // The mapping wcid of recipient session. if RXBAbitmap bit is masked + USHORT BAOriWcidArray[NUM_OF_TID]; // The mapping wcid of originator session. if TXBAbitmap bit is masked + USHORT BAOriSequence[NUM_OF_TID]; // The mapping wcid of originator session. if TXBAbitmap bit is masked // 802.11n features. - UCHAR MpduDensity; - UCHAR MaxRAmpduFactor; - UCHAR AMsduSize; - UCHAR MmpsMode; // MIMO power save more. + UCHAR MpduDensity; + UCHAR MaxRAmpduFactor; + UCHAR AMsduSize; + UCHAR MmpsMode; // MIMO power save more. - HT_CAPABILITY_IE HTCapability; + HT_CAPABILITY_IE HTCapability; - BOOLEAN bAutoTxRateSwitch; + BOOLEAN bAutoTxRateSwitch; - UCHAR RateLen; + UCHAR RateLen; struct _MAC_TABLE_ENTRY *pNext; - USHORT TxSeq[NUM_OF_TID]; - USHORT NonQosDataSeq; + USHORT TxSeq[NUM_OF_TID]; + USHORT NonQosDataSeq; - RSSI_SAMPLE RssiSample; + RSSI_SAMPLE RssiSample; - UINT32 TXMCSExpected[16]; - UINT32 TXMCSSuccessful[16]; - UINT32 TXMCSFailed[16]; - UINT32 TXMCSAutoFallBack[16][16]; + UINT32 TXMCSExpected[16]; + UINT32 TXMCSSuccessful[16]; + UINT32 TXMCSFailed[16]; + UINT32 TXMCSAutoFallBack[16][16]; - ULONG LastBeaconRxTime; + ULONG LastBeaconRxTime; ULONG AssocDeadLine; } MAC_TABLE_ENTRY, *PMAC_TABLE_ENTRY; typedef struct _MAC_TABLE { - USHORT Size; + USHORT Size; MAC_TABLE_ENTRY *Hash[HASH_TABLE_SIZE]; MAC_TABLE_ENTRY Content[MAX_LEN_OF_MAC_TABLE]; - QUEUE_HEADER McastPsQueue; - ULONG PsQIdleCount; - BOOLEAN fAnyStationInPsm; - BOOLEAN fAnyStationBadAtheros; // Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip. - BOOLEAN fAnyTxOPForceDisable; // Check if it is necessary to disable BE TxOP - BOOLEAN fAllStationAsRalink; // Check if all stations are ralink-chipset - BOOLEAN fAnyStationIsLegacy; // Check if I use legacy rate to transmit to my BSS Station/ - BOOLEAN fAnyStationNonGF; // Check if any Station can't support GF. - BOOLEAN fAnyStation20Only; // Check if any Station can't support GF. - BOOLEAN fAnyStationMIMOPSDynamic; // Check if any Station is MIMO Dynamic - BOOLEAN fAnyBASession; // Check if there is BA session. Force turn on RTS/CTS + QUEUE_HEADER McastPsQueue; + ULONG PsQIdleCount; + BOOLEAN fAnyStationInPsm; + BOOLEAN fAnyStationBadAtheros; // Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip. + BOOLEAN fAnyTxOPForceDisable; // Check if it is necessary to disable BE TxOP + BOOLEAN fAllStationAsRalink; // Check if all stations are ralink-chipset + BOOLEAN fAnyStationIsLegacy; // Check if I use legacy rate to transmit to my BSS Station/ + BOOLEAN fAnyStationNonGF; // Check if any Station can't support GF. + BOOLEAN fAnyStation20Only; // Check if any Station can't support GF. + BOOLEAN fAnyStationMIMOPSDynamic; // Check if any Station is MIMO Dynamic + BOOLEAN fAnyBASession; // Check if there is BA session. Force turn on RTS/CTS //2008/10/28: KH add to support Antenna power-saving of AP<-- //2008/10/28: KH add to support Antenna power-saving of AP--> } MAC_TABLE, *PMAC_TABLE; - - - - - -struct wificonf -{ - BOOLEAN bShortGI; +struct wificonf { + BOOLEAN bShortGI; BOOLEAN bGreenField; }; +typedef struct _RTMP_DEV_INFO_ { + UCHAR chipName[16]; + RTMP_INF_TYPE infType; +} RTMP_DEV_INFO; -typedef struct _RTMP_DEV_INFO_ -{ - UCHAR chipName[16]; - RTMP_INF_TYPE infType; -}RTMP_DEV_INFO; - - - - -struct _RTMP_CHIP_OP_ -{ +struct _RTMP_CHIP_OP_ { /* Calibration access related callback functions */ - int (*eeinit)(RTMP_ADAPTER *pAd); /* int (*eeinit)(RTMP_ADAPTER *pAd); */ - int (*eeread)(RTMP_ADAPTER *pAd, USHORT offset, PUSHORT pValue); /* int (*eeread)(RTMP_ADAPTER *pAd, int offset, PUSHORT pValue); */ + int (*eeinit) (RTMP_ADAPTER * pAd); /* int (*eeinit)(RTMP_ADAPTER *pAd); */ + int (*eeread) (RTMP_ADAPTER * pAd, USHORT offset, PUSHORT pValue); /* int (*eeread)(RTMP_ADAPTER *pAd, int offset, PUSHORT pValue); */ /* MCU related callback functions */ - int (*loadFirmware)(RTMP_ADAPTER *pAd); /* int (*loadFirmware)(RTMP_ADAPTER *pAd); */ - int (*eraseFirmware)(RTMP_ADAPTER *pAd); /* int (*eraseFirmware)(RTMP_ADAPTER *pAd); */ - int (*sendCommandToMcu)(RTMP_ADAPTER *pAd, UCHAR cmd, UCHAR token, UCHAR arg0, UCHAR arg1);; /* int (*sendCommandToMcu)(RTMP_ADAPTER *pAd, UCHAR cmd, UCHAR token, UCHAR arg0, UCHAR arg1); */ + int (*loadFirmware) (RTMP_ADAPTER * pAd); /* int (*loadFirmware)(RTMP_ADAPTER *pAd); */ + int (*eraseFirmware) (RTMP_ADAPTER * pAd); /* int (*eraseFirmware)(RTMP_ADAPTER *pAd); */ + int (*sendCommandToMcu) (RTMP_ADAPTER * pAd, UCHAR cmd, UCHAR token, UCHAR arg0, UCHAR arg1);; /* int (*sendCommandToMcu)(RTMP_ADAPTER *pAd, UCHAR cmd, UCHAR token, UCHAR arg0, UCHAR arg1); */ /* RF access related callback functions */ REG_PAIR *pRFRegTable; - void (*AsicRfInit)(RTMP_ADAPTER *pAd); - void (*AsicRfTurnOn)(RTMP_ADAPTER *pAd); - void (*AsicRfTurnOff)(RTMP_ADAPTER *pAd); - void (*AsicReverseRfFromSleepMode)(RTMP_ADAPTER *pAd); - void (*AsicHaltAction)(RTMP_ADAPTER *pAd); + void (*AsicRfInit) (RTMP_ADAPTER * pAd); + void (*AsicRfTurnOn) (RTMP_ADAPTER * pAd); + void (*AsicRfTurnOff) (RTMP_ADAPTER * pAd); + void (*AsicReverseRfFromSleepMode) (RTMP_ADAPTER * pAd); + void (*AsicHaltAction) (RTMP_ADAPTER * pAd); }; - // // The miniport adapter structure // -struct _RTMP_ADAPTER -{ - PVOID OS_Cookie; // save specific structure relative to OS - PNET_DEV net_dev; - ULONG VirtualIfCnt; +struct _RTMP_ADAPTER { + PVOID OS_Cookie; // save specific structure relative to OS + PNET_DEV net_dev; + ULONG VirtualIfCnt; - RTMP_CHIP_OP chipOps; - USHORT ThisTbttNumToNextWakeUp; + RTMP_CHIP_OP chipOps; + USHORT ThisTbttNumToNextWakeUp; #ifdef RTMP_MAC_PCI /*****************************************************************************************/ /* PCI related parameters */ /*****************************************************************************************/ - PUCHAR CSRBaseAddress; // PCI MMIO Base Address, all access will use - unsigned int irq_num; - - USHORT LnkCtrlBitMask; - USHORT RLnkCtrlConfiguration; - USHORT RLnkCtrlOffset; - USHORT HostLnkCtrlConfiguration; - USHORT HostLnkCtrlOffset; - USHORT PCIePowerSaveLevel; - ULONG Rt3xxHostLinkCtrl; // USed for 3090F chip - ULONG Rt3xxRalinkLinkCtrl; // USed for 3090F chip - USHORT DeviceID; // Read from PCI config - ULONG AccessBBPFailCount; - BOOLEAN bPCIclkOff; // flag that indicate if the PICE power status in Configuration SPace.. - BOOLEAN bPCIclkOffDisableTx; // - - BOOLEAN brt30xxBanMcuCmd; //when = 0xff means all commands are ok to set . - BOOLEAN b3090ESpecialChip; //3090E special chip that write EEPROM 0x24=0x9280. - ULONG CheckDmaBusyCount; // Check Interrupt Status Register Count. - - UINT int_enable_reg; - UINT int_disable_mask; - UINT int_pending; - - - RTMP_DMABUF TxBufSpace[NUM_OF_TX_RING]; // Shared memory of all 1st pre-allocated TxBuf associated with each TXD - RTMP_DMABUF RxDescRing; // Shared memory for RX descriptors - RTMP_DMABUF TxDescRing[NUM_OF_TX_RING]; // Shared memory for Tx descriptors - RTMP_TX_RING TxRing[NUM_OF_TX_RING]; // AC0~4 + HCCA -#endif // RTMP_MAC_PCI // - - - NDIS_SPIN_LOCK irq_lock; - UCHAR irq_disabled; + PUCHAR CSRBaseAddress; // PCI MMIO Base Address, all access will use + unsigned int irq_num; + + USHORT LnkCtrlBitMask; + USHORT RLnkCtrlConfiguration; + USHORT RLnkCtrlOffset; + USHORT HostLnkCtrlConfiguration; + USHORT HostLnkCtrlOffset; + USHORT PCIePowerSaveLevel; + ULONG Rt3xxHostLinkCtrl; // USed for 3090F chip + ULONG Rt3xxRalinkLinkCtrl; // USed for 3090F chip + USHORT DeviceID; // Read from PCI config + ULONG AccessBBPFailCount; + BOOLEAN bPCIclkOff; // flag that indicate if the PICE power status in Configuration SPace.. + BOOLEAN bPCIclkOffDisableTx; // + + BOOLEAN brt30xxBanMcuCmd; //when = 0xff means all commands are ok to set . + BOOLEAN b3090ESpecialChip; //3090E special chip that write EEPROM 0x24=0x9280. + ULONG CheckDmaBusyCount; // Check Interrupt Status Register Count. + + UINT int_enable_reg; + UINT int_disable_mask; + UINT int_pending; + + RTMP_DMABUF TxBufSpace[NUM_OF_TX_RING]; // Shared memory of all 1st pre-allocated TxBuf associated with each TXD + RTMP_DMABUF RxDescRing; // Shared memory for RX descriptors + RTMP_DMABUF TxDescRing[NUM_OF_TX_RING]; // Shared memory for Tx descriptors + RTMP_TX_RING TxRing[NUM_OF_TX_RING]; // AC0~4 + HCCA +#endif // RTMP_MAC_PCI // + + NDIS_SPIN_LOCK irq_lock; + UCHAR irq_disabled; #ifdef RTMP_MAC_USB /*****************************************************************************************/ /* USB related parameters */ /*****************************************************************************************/ - struct usb_config_descriptor *config; - UINT BulkInEpAddr; // bulk-in endpoint address - UINT BulkOutEpAddr[6]; // bulk-out endpoint address + struct usb_config_descriptor *config; + UINT BulkInEpAddr; // bulk-in endpoint address + UINT BulkOutEpAddr[6]; // bulk-out endpoint address - UINT NumberOfPipes; - USHORT BulkOutMaxPacketSize; - USHORT BulkInMaxPacketSize; + UINT NumberOfPipes; + USHORT BulkOutMaxPacketSize; + USHORT BulkInMaxPacketSize; //======Control Flags - LONG PendingIoCount; - ULONG BulkFlags; - BOOLEAN bUsbTxBulkAggre; // Flags for bulk out data priority + LONG PendingIoCount; + ULONG BulkFlags; + BOOLEAN bUsbTxBulkAggre; // Flags for bulk out data priority //======Cmd Thread - CmdQ CmdQ; - NDIS_SPIN_LOCK CmdQLock; // CmdQLock spinlock - RTMP_OS_TASK cmdQTask; + CmdQ CmdQ; + NDIS_SPIN_LOCK CmdQLock; // CmdQLock spinlock + RTMP_OS_TASK cmdQTask; //======Semaphores (event) - RTMP_OS_SEM UsbVendorReq_semaphore; - PVOID UsbVendorReqBuf; - wait_queue_head_t *wait; -#endif // RTMP_MAC_USB // + RTMP_OS_SEM UsbVendorReq_semaphore; + PVOID UsbVendorReqBuf; + wait_queue_head_t *wait; +#endif // RTMP_MAC_USB // /*****************************************************************************************/ /* RBUS related parameters */ /*****************************************************************************************/ - /*****************************************************************************************/ /* Both PCI/USB related parameters */ /*****************************************************************************************/ - //RTMP_DEV_INFO chipInfo; - RTMP_INF_TYPE infType; + //RTMP_DEV_INFO chipInfo; + RTMP_INF_TYPE infType; /*****************************************************************************************/ /* Driver Mgmt related parameters */ /*****************************************************************************************/ - RTMP_OS_TASK mlmeTask; + RTMP_OS_TASK mlmeTask; #ifdef RTMP_TIMER_TASK_SUPPORT // If you want use timer task to handle the timer related jobs, enable this. - RTMP_TIMER_TASK_QUEUE TimerQ; - NDIS_SPIN_LOCK TimerQLock; - RTMP_OS_TASK timerTask; -#endif // RTMP_TIMER_TASK_SUPPORT // - + RTMP_TIMER_TASK_QUEUE TimerQ; + NDIS_SPIN_LOCK TimerQLock; + RTMP_OS_TASK timerTask; +#endif // RTMP_TIMER_TASK_SUPPORT // /*****************************************************************************************/ /* Tx related parameters */ /*****************************************************************************************/ - BOOLEAN DeQueueRunning[NUM_OF_TX_RING]; // for ensuring RTUSBDeQueuePacket get call once - NDIS_SPIN_LOCK DeQueueLock[NUM_OF_TX_RING]; + BOOLEAN DeQueueRunning[NUM_OF_TX_RING]; // for ensuring RTUSBDeQueuePacket get call once + NDIS_SPIN_LOCK DeQueueLock[NUM_OF_TX_RING]; #ifdef RTMP_MAC_USB // Data related context and AC specified, 4 AC supported - NDIS_SPIN_LOCK BulkOutLock[6]; // BulkOut spinlock for 4 ACs - NDIS_SPIN_LOCK MLMEBulkOutLock; // MLME BulkOut lock + NDIS_SPIN_LOCK BulkOutLock[6]; // BulkOut spinlock for 4 ACs + NDIS_SPIN_LOCK MLMEBulkOutLock; // MLME BulkOut lock - HT_TX_CONTEXT TxContext[NUM_OF_TX_RING]; - NDIS_SPIN_LOCK TxContextQueueLock[NUM_OF_TX_RING]; // TxContextQueue spinlock + HT_TX_CONTEXT TxContext[NUM_OF_TX_RING]; + NDIS_SPIN_LOCK TxContextQueueLock[NUM_OF_TX_RING]; // TxContextQueue spinlock // 4 sets of Bulk Out index and pending flag - UCHAR NextBulkOutIndex[4]; // only used for 4 EDCA bulkout pipe + UCHAR NextBulkOutIndex[4]; // only used for 4 EDCA bulkout pipe - BOOLEAN BulkOutPending[6]; // used for total 6 bulkout pipe - UCHAR bulkResetPipeid; - BOOLEAN MgmtBulkPending; - ULONG bulkResetReq[6]; -#endif // RTMP_MAC_USB // + BOOLEAN BulkOutPending[6]; // used for total 6 bulkout pipe + UCHAR bulkResetPipeid; + BOOLEAN MgmtBulkPending; + ULONG bulkResetReq[6]; +#endif // RTMP_MAC_USB // // resource for software backlog queues - QUEUE_HEADER TxSwQueue[NUM_OF_TX_RING]; // 4 AC + 1 HCCA - NDIS_SPIN_LOCK TxSwQueueLock[NUM_OF_TX_RING]; // TxSwQueue spinlock - - RTMP_DMABUF MgmtDescRing; // Shared memory for MGMT descriptors - RTMP_MGMT_RING MgmtRing; - NDIS_SPIN_LOCK MgmtRingLock; // Prio Ring spinlock + QUEUE_HEADER TxSwQueue[NUM_OF_TX_RING]; // 4 AC + 1 HCCA + NDIS_SPIN_LOCK TxSwQueueLock[NUM_OF_TX_RING]; // TxSwQueue spinlock + RTMP_DMABUF MgmtDescRing; // Shared memory for MGMT descriptors + RTMP_MGMT_RING MgmtRing; + NDIS_SPIN_LOCK MgmtRingLock; // Prio Ring spinlock /*****************************************************************************************/ /* Rx related parameters */ /*****************************************************************************************/ #ifdef RTMP_MAC_PCI - RTMP_RX_RING RxRing; - NDIS_SPIN_LOCK RxRingLock; // Rx Ring spinlock + RTMP_RX_RING RxRing; + NDIS_SPIN_LOCK RxRingLock; // Rx Ring spinlock #ifdef RT3090 - NDIS_SPIN_LOCK McuCmdLock; //MCU Command Queue spinlock -#endif // RT3090 // -#endif // RTMP_MAC_PCI // + NDIS_SPIN_LOCK McuCmdLock; //MCU Command Queue spinlock +#endif // RT3090 // +#endif // RTMP_MAC_PCI // #ifdef RTMP_MAC_USB - RX_CONTEXT RxContext[RX_RING_SIZE]; // 1 for redundant multiple IRP bulk in. - NDIS_SPIN_LOCK BulkInLock; // BulkIn spinlock for 4 ACs - UCHAR PendingRx; // The Maximum pending Rx value should be RX_RING_SIZE. - UCHAR NextRxBulkInIndex; // Indicate the current RxContext Index which hold by Host controller. - UCHAR NextRxBulkInReadIndex; // Indicate the current RxContext Index which driver can read & process it. - ULONG NextRxBulkInPosition; // Want to contatenate 2 URB buffer while 1st is bulkin failed URB. This Position is 1st URB TransferLength. - ULONG TransferBufferLength; // current length of the packet buffer - ULONG ReadPosition; // current read position in a packet buffer -#endif // RTMP_MAC_USB // + RX_CONTEXT RxContext[RX_RING_SIZE]; // 1 for redundant multiple IRP bulk in. + NDIS_SPIN_LOCK BulkInLock; // BulkIn spinlock for 4 ACs + UCHAR PendingRx; // The Maximum pending Rx value should be RX_RING_SIZE. + UCHAR NextRxBulkInIndex; // Indicate the current RxContext Index which hold by Host controller. + UCHAR NextRxBulkInReadIndex; // Indicate the current RxContext Index which driver can read & process it. + ULONG NextRxBulkInPosition; // Want to contatenate 2 URB buffer while 1st is bulkin failed URB. This Position is 1st URB TransferLength. + ULONG TransferBufferLength; // current length of the packet buffer + ULONG ReadPosition; // current read position in a packet buffer +#endif // RTMP_MAC_USB // /*****************************************************************************************/ /* ASIC related parameters */ /*****************************************************************************************/ - UINT32 MACVersion; // MAC version. Record rt2860C(0x28600100) or rt2860D (0x28600101).. + UINT32 MACVersion; // MAC version. Record rt2860C(0x28600100) or rt2860D (0x28600101).. // --------------------------- // E2PROM // --------------------------- - ULONG EepromVersion; // byte 0: version, byte 1: revision, byte 2~3: unused - ULONG FirmwareVersion; // byte 0: Minor version, byte 1: Major version, otherwise unused. - USHORT EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS]; - UCHAR EEPROMAddressNum; // 93c46=6 93c66=8 - BOOLEAN EepromAccess; - UCHAR EFuseTag; - + ULONG EepromVersion; // byte 0: version, byte 1: revision, byte 2~3: unused + ULONG FirmwareVersion; // byte 0: Minor version, byte 1: Major version, otherwise unused. + USHORT EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS]; + UCHAR EEPROMAddressNum; // 93c46=6 93c66=8 + BOOLEAN EepromAccess; + UCHAR EFuseTag; // --------------------------- // BBP Control // --------------------------- - UCHAR BbpWriteLatch[140]; // record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID - CHAR BbpRssiToDbmDelta; // change from UCHAR to CHAR for high power - BBP_R66_TUNING BbpTuning; + UCHAR BbpWriteLatch[140]; // record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID + CHAR BbpRssiToDbmDelta; // change from UCHAR to CHAR for high power + BBP_R66_TUNING BbpTuning; // ---------------------------- // RFIC control // ---------------------------- - UCHAR RfIcType; // RFIC_xxx - ULONG RfFreqOffset; // Frequency offset for channel switching - RTMP_RF_REGS LatchRfRegs; // latch th latest RF programming value since RF IC doesn't support READ + UCHAR RfIcType; // RFIC_xxx + ULONG RfFreqOffset; // Frequency offset for channel switching + RTMP_RF_REGS LatchRfRegs; // latch th latest RF programming value since RF IC doesn't support READ - EEPROM_ANTENNA_STRUC Antenna; // Since ANtenna definition is different for a & g. We need to save it for future reference. - EEPROM_NIC_CONFIG2_STRUC NicConfig2; + EEPROM_ANTENNA_STRUC Antenna; // Since ANtenna definition is different for a & g. We need to save it for future reference. + EEPROM_NIC_CONFIG2_STRUC NicConfig2; // This soft Rx Antenna Diversity mechanism is used only when user set // RX Antenna = DIVERSITY ON - SOFT_RX_ANT_DIVERSITY RxAnt; - - UCHAR RFProgSeq; - CHANNEL_TX_POWER TxPower[MAX_NUM_OF_CHANNELS]; // Store Tx power value for all channels. - CHANNEL_TX_POWER ChannelList[MAX_NUM_OF_CHANNELS]; // list all supported channels for site survey - CHANNEL_11J_TX_POWER TxPower11J[MAX_NUM_OF_11JCHANNELS]; // 802.11j channel and bw - CHANNEL_11J_TX_POWER ChannelList11J[MAX_NUM_OF_11JCHANNELS]; // list all supported channels for site survey - - UCHAR ChannelListNum; // number of channel in ChannelList[] - UCHAR Bbp94; - BOOLEAN BbpForCCK; - ULONG Tx20MPwrCfgABand[5]; - ULONG Tx20MPwrCfgGBand[5]; - ULONG Tx40MPwrCfgABand[5]; - ULONG Tx40MPwrCfgGBand[5]; - - BOOLEAN bAutoTxAgcA; // Enable driver auto Tx Agc control - UCHAR TssiRefA; // Store Tssi reference value as 25 temperature. - UCHAR TssiPlusBoundaryA[5]; // Tssi boundary for increase Tx power to compensate. - UCHAR TssiMinusBoundaryA[5]; // Tssi boundary for decrease Tx power to compensate. - UCHAR TxAgcStepA; // Store Tx TSSI delta increment / decrement value - CHAR TxAgcCompensateA; // Store the compensation (TxAgcStep * (idx-1)) - - BOOLEAN bAutoTxAgcG; // Enable driver auto Tx Agc control - UCHAR TssiRefG; // Store Tssi reference value as 25 temperature. - UCHAR TssiPlusBoundaryG[5]; // Tssi boundary for increase Tx power to compensate. - UCHAR TssiMinusBoundaryG[5]; // Tssi boundary for decrease Tx power to compensate. - UCHAR TxAgcStepG; // Store Tx TSSI delta increment / decrement value - CHAR TxAgcCompensateG; // Store the compensation (TxAgcStep * (idx-1)) - - CHAR BGRssiOffset0; // Store B/G RSSI#0 Offset value on EEPROM 0x46h - CHAR BGRssiOffset1; // Store B/G RSSI#1 Offset value - CHAR BGRssiOffset2; // Store B/G RSSI#2 Offset value - - CHAR ARssiOffset0; // Store A RSSI#0 Offset value on EEPROM 0x4Ah - CHAR ARssiOffset1; // Store A RSSI#1 Offset value - CHAR ARssiOffset2; // Store A RSSI#2 Offset value - - CHAR BLNAGain; // Store B/G external LNA#0 value on EEPROM 0x44h - CHAR ALNAGain0; // Store A external LNA#0 value for ch36~64 - CHAR ALNAGain1; // Store A external LNA#1 value for ch100~128 - CHAR ALNAGain2; // Store A external LNA#2 value for ch132~165 + SOFT_RX_ANT_DIVERSITY RxAnt; + + UCHAR RFProgSeq; + CHANNEL_TX_POWER TxPower[MAX_NUM_OF_CHANNELS]; // Store Tx power value for all channels. + CHANNEL_TX_POWER ChannelList[MAX_NUM_OF_CHANNELS]; // list all supported channels for site survey + CHANNEL_11J_TX_POWER TxPower11J[MAX_NUM_OF_11JCHANNELS]; // 802.11j channel and bw + CHANNEL_11J_TX_POWER ChannelList11J[MAX_NUM_OF_11JCHANNELS]; // list all supported channels for site survey + + UCHAR ChannelListNum; // number of channel in ChannelList[] + UCHAR Bbp94; + BOOLEAN BbpForCCK; + ULONG Tx20MPwrCfgABand[5]; + ULONG Tx20MPwrCfgGBand[5]; + ULONG Tx40MPwrCfgABand[5]; + ULONG Tx40MPwrCfgGBand[5]; + + BOOLEAN bAutoTxAgcA; // Enable driver auto Tx Agc control + UCHAR TssiRefA; // Store Tssi reference value as 25 temperature. + UCHAR TssiPlusBoundaryA[5]; // Tssi boundary for increase Tx power to compensate. + UCHAR TssiMinusBoundaryA[5]; // Tssi boundary for decrease Tx power to compensate. + UCHAR TxAgcStepA; // Store Tx TSSI delta increment / decrement value + CHAR TxAgcCompensateA; // Store the compensation (TxAgcStep * (idx-1)) + + BOOLEAN bAutoTxAgcG; // Enable driver auto Tx Agc control + UCHAR TssiRefG; // Store Tssi reference value as 25 temperature. + UCHAR TssiPlusBoundaryG[5]; // Tssi boundary for increase Tx power to compensate. + UCHAR TssiMinusBoundaryG[5]; // Tssi boundary for decrease Tx power to compensate. + UCHAR TxAgcStepG; // Store Tx TSSI delta increment / decrement value + CHAR TxAgcCompensateG; // Store the compensation (TxAgcStep * (idx-1)) + + CHAR BGRssiOffset0; // Store B/G RSSI#0 Offset value on EEPROM 0x46h + CHAR BGRssiOffset1; // Store B/G RSSI#1 Offset value + CHAR BGRssiOffset2; // Store B/G RSSI#2 Offset value + + CHAR ARssiOffset0; // Store A RSSI#0 Offset value on EEPROM 0x4Ah + CHAR ARssiOffset1; // Store A RSSI#1 Offset value + CHAR ARssiOffset2; // Store A RSSI#2 Offset value + + CHAR BLNAGain; // Store B/G external LNA#0 value on EEPROM 0x44h + CHAR ALNAGain0; // Store A external LNA#0 value for ch36~64 + CHAR ALNAGain1; // Store A external LNA#1 value for ch100~128 + CHAR ALNAGain2; // Store A external LNA#2 value for ch132~165 #ifdef RT30xx // for 3572 - UCHAR Bbp25; - UCHAR Bbp26; + UCHAR Bbp25; + UCHAR Bbp26; - UCHAR TxMixerGain24G; // Tx mixer gain value from EEPROM to improve Tx EVM / Tx DAC, 2.4G - UCHAR TxMixerGain5G; -#endif // RT30xx // + UCHAR TxMixerGain24G; // Tx mixer gain value from EEPROM to improve Tx EVM / Tx DAC, 2.4G + UCHAR TxMixerGain5G; +#endif // RT30xx // // ---------------------------- // LED control // ---------------------------- - MCU_LEDCS_STRUC LedCntl; - USHORT Led1; // read from EEPROM 0x3c - USHORT Led2; // EEPROM 0x3e - USHORT Led3; // EEPROM 0x40 - UCHAR LedIndicatorStrength; - UCHAR RssiSingalstrengthOffet; - BOOLEAN bLedOnScanning; - UCHAR LedStatus; + MCU_LEDCS_STRUC LedCntl; + USHORT Led1; // read from EEPROM 0x3c + USHORT Led2; // EEPROM 0x3e + USHORT Led3; // EEPROM 0x40 + UCHAR LedIndicatorStrength; + UCHAR RssiSingalstrengthOffet; + BOOLEAN bLedOnScanning; + UCHAR LedStatus; /*****************************************************************************************/ /* 802.11 related parameters */ /*****************************************************************************************/ // outgoing BEACON frame buffer and corresponding TXD - TXWI_STRUC BeaconTxWI; - PUCHAR BeaconBuf; - USHORT BeaconOffset[HW_BEACON_MAX_COUNT]; + TXWI_STRUC BeaconTxWI; + PUCHAR BeaconBuf; + USHORT BeaconOffset[HW_BEACON_MAX_COUNT]; // pre-build PS-POLL and NULL frame upon link up. for efficiency purpose. - PSPOLL_FRAME PsPollFrame; - HEADER_802_11 NullFrame; + PSPOLL_FRAME PsPollFrame; + HEADER_802_11 NullFrame; #ifdef RTMP_MAC_USB - TX_CONTEXT BeaconContext[BEACON_RING_SIZE]; - TX_CONTEXT NullContext; - TX_CONTEXT PsPollContext; - TX_CONTEXT RTSContext; -#endif // RTMP_MAC_USB // + TX_CONTEXT BeaconContext[BEACON_RING_SIZE]; + TX_CONTEXT NullContext; + TX_CONTEXT PsPollContext; + TX_CONTEXT RTSContext; +#endif // RTMP_MAC_USB // //=========AP=========== - //=======STA=========== // ----------------------------------------------- // STA specific configuration & operation status // used only when pAd->OpMode == OPMODE_STA // ----------------------------------------------- - STA_ADMIN_CONFIG StaCfg; // user desired settings - STA_ACTIVE_CONFIG StaActive; // valid only when ADHOC_ON(pAd) || INFRA_ON(pAd) - CHAR nickname[IW_ESSID_MAX_SIZE+1]; // nickname, only used in the iwconfig i/f - NDIS_MEDIA_STATE PreMediaState; + STA_ADMIN_CONFIG StaCfg; // user desired settings + STA_ACTIVE_CONFIG StaActive; // valid only when ADHOC_ON(pAd) || INFRA_ON(pAd) + CHAR nickname[IW_ESSID_MAX_SIZE + 1]; // nickname, only used in the iwconfig i/f + NDIS_MEDIA_STATE PreMediaState; //=======Common=========== // OP mode: either AP or STA - UCHAR OpMode; // OPMODE_STA, OPMODE_AP - - NDIS_MEDIA_STATE IndicateMediaState; // Base on Indication state, default is NdisMediaStateDisConnected + UCHAR OpMode; // OPMODE_STA, OPMODE_AP + NDIS_MEDIA_STATE IndicateMediaState; // Base on Indication state, default is NdisMediaStateDisConnected /* MAT related parameters */ // configuration: read from Registry & E2PROM - BOOLEAN bLocalAdminMAC; // Use user changed MAC - UCHAR PermanentAddress[MAC_ADDR_LEN]; // Factory default MAC address - UCHAR CurrentAddress[MAC_ADDR_LEN]; // User changed MAC address + BOOLEAN bLocalAdminMAC; // Use user changed MAC + UCHAR PermanentAddress[MAC_ADDR_LEN]; // Factory default MAC address + UCHAR CurrentAddress[MAC_ADDR_LEN]; // User changed MAC address // ------------------------------------------------------ // common configuration to both OPMODE_STA and OPMODE_AP // ------------------------------------------------------ - COMMON_CONFIG CommonCfg; - MLME_STRUCT Mlme; + COMMON_CONFIG CommonCfg; + MLME_STRUCT Mlme; // AP needs those vaiables for site survey feature. - MLME_AUX MlmeAux; // temporary settings used during MLME state machine - BSS_TABLE ScanTab; // store the latest SCAN result + MLME_AUX MlmeAux; // temporary settings used during MLME state machine + BSS_TABLE ScanTab; // store the latest SCAN result //About MacTab, the sta driver will use #0 and #1 for multicast and AP. - MAC_TABLE MacTab; // ASIC on-chip WCID entry table. At TX, ASIC always use key according to this on-chip table. - NDIS_SPIN_LOCK MacTabLock; + MAC_TABLE MacTab; // ASIC on-chip WCID entry table. At TX, ASIC always use key according to this on-chip table. + NDIS_SPIN_LOCK MacTabLock; - BA_TABLE BATable; + BA_TABLE BATable; - NDIS_SPIN_LOCK BATabLock; + NDIS_SPIN_LOCK BATabLock; RALINK_TIMER_STRUCT RECBATimer; // encryption/decryption KEY tables - CIPHER_KEY SharedKey[MAX_MBSSID_NUM][4]; // STA always use SharedKey[BSS0][0..3] + CIPHER_KEY SharedKey[MAX_MBSSID_NUM][4]; // STA always use SharedKey[BSS0][0..3] - // RX re-assembly buffer for fragmentation - FRAGMENT_FRAME FragFrame; // Frame storage for fragment frame + // RX re-assembly buffer for fragmentation + FRAGMENT_FRAME FragFrame; // Frame storage for fragment frame // various Counters - COUNTER_802_3 Counters8023; // 802.3 counters - COUNTER_802_11 WlanCounters; // 802.11 MIB counters - COUNTER_RALINK RalinkCounters; // Ralink propriety counters - COUNTER_DRS DrsCounters; // counters for Dynamic TX Rate Switching - PRIVATE_STRUC PrivateInfo; // Private information & counters + COUNTER_802_3 Counters8023; // 802.3 counters + COUNTER_802_11 WlanCounters; // 802.11 MIB counters + COUNTER_RALINK RalinkCounters; // Ralink propriety counters + COUNTER_DRS DrsCounters; // counters for Dynamic TX Rate Switching + PRIVATE_STRUC PrivateInfo; // Private information & counters // flags, see fRTMP_ADAPTER_xxx flags - ULONG Flags; // Represent current device status - ULONG PSFlags; // Power Save operation flag. + ULONG Flags; // Represent current device status + ULONG PSFlags; // Power Save operation flag. // current TX sequence # - USHORT Sequence; + USHORT Sequence; // Control disconnect / connect event generation //+++Didn't used anymore - ULONG LinkDownTime; + ULONG LinkDownTime; //--- - ULONG LastRxRate; - ULONG LastTxRate; + ULONG LastRxRate; + ULONG LastTxRate; //+++Used only for Station - BOOLEAN bConfigChanged; // Config Change flag for the same SSID setting + BOOLEAN bConfigChanged; // Config Change flag for the same SSID setting //--- - ULONG ExtraInfo; // Extra information for displaying status - ULONG SystemErrorBitmap; // b0: E2PROM version error + ULONG ExtraInfo; // Extra information for displaying status + ULONG SystemErrorBitmap; // b0: E2PROM version error //+++Didn't used anymore - ULONG MacIcVersion; // MAC/BBP serial interface issue solved after ver.D + ULONG MacIcVersion; // MAC/BBP serial interface issue solved after ver.D //--- // --------------------------- // System event log // --------------------------- - RT_802_11_EVENT_TABLE EventTab; - + RT_802_11_EVENT_TABLE EventTab; - BOOLEAN HTCEnable; + BOOLEAN HTCEnable; /*****************************************************************************************/ /* Statistic related parameters */ /*****************************************************************************************/ #ifdef RTMP_MAC_USB - ULONG BulkOutDataOneSecCount; - ULONG BulkInDataOneSecCount; - ULONG BulkLastOneSecCount; // BulkOutDataOneSecCount + BulkInDataOneSecCount - ULONG watchDogRxCnt; - ULONG watchDogRxOverFlowCnt; - ULONG watchDogTxPendingCnt[NUM_OF_TX_RING]; - INT TransferedLength[NUM_OF_TX_RING]; -#endif // RTMP_MAC_USB // - - BOOLEAN bUpdateBcnCntDone; - ULONG watchDogMacDeadlock; // prevent MAC/BBP into deadlock condition + ULONG BulkOutDataOneSecCount; + ULONG BulkInDataOneSecCount; + ULONG BulkLastOneSecCount; // BulkOutDataOneSecCount + BulkInDataOneSecCount + ULONG watchDogRxCnt; + ULONG watchDogRxOverFlowCnt; + ULONG watchDogTxPendingCnt[NUM_OF_TX_RING]; + INT TransferedLength[NUM_OF_TX_RING]; +#endif // RTMP_MAC_USB // + + BOOLEAN bUpdateBcnCntDone; + ULONG watchDogMacDeadlock; // prevent MAC/BBP into deadlock condition // ---------------------------- // DEBUG paramerts // ---------------------------- - //ULONG DebugSetting[4]; - BOOLEAN bBanAllBaSetup; - BOOLEAN bPromiscuous; + //ULONG DebugSetting[4]; + BOOLEAN bBanAllBaSetup; + BOOLEAN bPromiscuous; // ---------------------------- // rt2860c emulation-use Parameters // ---------------------------- - //ULONG rtsaccu[30]; - //ULONG ctsaccu[30]; - //ULONG cfendaccu[30]; - //ULONG bacontent[16]; - //ULONG rxint[RX_RING_SIZE+1]; - //UCHAR rcvba[60]; - BOOLEAN bLinkAdapt; - BOOLEAN bForcePrintTX; - BOOLEAN bForcePrintRX; - //BOOLEAN bDisablescanning; //defined in RT2870 USB - BOOLEAN bStaFifoTest; - BOOLEAN bProtectionTest; - BOOLEAN bBroadComHT; + //ULONG rtsaccu[30]; + //ULONG ctsaccu[30]; + //ULONG cfendaccu[30]; + //ULONG bacontent[16]; + //ULONG rxint[RX_RING_SIZE+1]; + //UCHAR rcvba[60]; + BOOLEAN bLinkAdapt; + BOOLEAN bForcePrintTX; + BOOLEAN bForcePrintRX; + //BOOLEAN bDisablescanning; //defined in RT2870 USB + BOOLEAN bStaFifoTest; + BOOLEAN bProtectionTest; + BOOLEAN bBroadComHT; //+++Following add from RT2870 USB. - ULONG BulkOutReq; - ULONG BulkOutComplete; - ULONG BulkOutCompleteOther; - ULONG BulkOutCompleteCancel; // seems not use now? - ULONG BulkInReq; - ULONG BulkInComplete; - ULONG BulkInCompleteFail; + ULONG BulkOutReq; + ULONG BulkOutComplete; + ULONG BulkOutCompleteOther; + ULONG BulkOutCompleteCancel; // seems not use now? + ULONG BulkInReq; + ULONG BulkInComplete; + ULONG BulkInCompleteFail; //--- - struct wificonf WIFItestbed; + struct wificonf WIFItestbed; struct reordering_mpdu_pool mpdu_blk_pool; - ULONG OneSecondnonBEpackets; // record non BE packets per second + ULONG OneSecondnonBEpackets; // record non BE packets per second #ifdef LINUX - struct iw_statistics iw_stats; - - struct net_device_stats stats; -#endif // LINUX // - + struct iw_statistics iw_stats; + struct net_device_stats stats; +#endif // LINUX // - - - ULONG TbttTickCount; + ULONG TbttTickCount; #ifdef PCI_MSI_SUPPORT - BOOLEAN HaveMsi; -#endif // PCI_MSI_SUPPORT // + BOOLEAN HaveMsi; +#endif // PCI_MSI_SUPPORT // - - UCHAR is_on; + UCHAR is_on; #define TIME_BASE (1000000/OS_HZ) #define TIME_ONE_SECOND (1000000/TIME_BASE) - UCHAR flg_be_adjust; - ULONG be_adjust_last_time; - + UCHAR flg_be_adjust; + ULONG be_adjust_last_time; - - - - - - UINT8 FlgCtsEnabled; - UINT8 PM_FlgSuspend; + UINT8 FlgCtsEnabled; + UINT8 PM_FlgSuspend; #ifdef RT30xx #ifdef RTMP_EFUSE_SUPPORT - BOOLEAN bUseEfuse; - UCHAR EEPROMImage[1024]; -#endif // RTMP_EFUSE_SUPPORT // -#endif // RT30xx // + BOOLEAN bUseEfuse; + UCHAR EEPROMImage[1024]; +#endif // RTMP_EFUSE_SUPPORT // +#endif // RT30xx // }; - - #define DELAYINTMASK 0x0003fffb #define INTMASK 0x0003fffb #define IndMask 0x0003fffc @@ -2262,34 +2157,30 @@ struct _RTMP_ADAPTER #define RxCoherent 0x00010000 // rx coherent #define McuCommand 0x00000200 // mcu #define PreTBTTInt 0x00001000 // Pre-TBTT interrupt -#define TBTTInt 0x00000800 // TBTT interrupt -#define GPTimeOutInt 0x00008000 // GPtimeout interrupt -#define AutoWakeupInt 0x00004000 // AutoWakeupInt interrupt +#define TBTTInt 0x00000800 // TBTT interrupt +#define GPTimeOutInt 0x00008000 // GPtimeout interrupt +#define AutoWakeupInt 0x00004000 // AutoWakeupInt interrupt #define FifoStaFullInt 0x00002000 // fifo statistics full interrupt - /*************************************************************************** * Rx Path software control block related data structures **************************************************************************/ -typedef struct _RX_BLK_ -{ -// RXD_STRUC RxD; // sample - RT28XX_RXD_STRUC RxD; - PRXWI_STRUC pRxWI; - PHEADER_802_11 pHeader; - PNDIS_PACKET pRxPacket; - UCHAR *pData; - USHORT DataSize; - USHORT Flags; - UCHAR UserPriority; // for calculate TKIP MIC using +typedef struct _RX_BLK_ { +// RXD_STRUC RxD; // sample + RT28XX_RXD_STRUC RxD; + PRXWI_STRUC pRxWI; + PHEADER_802_11 pHeader; + PNDIS_PACKET pRxPacket; + UCHAR *pData; + USHORT DataSize; + USHORT Flags; + UCHAR UserPriority; // for calculate TKIP MIC using } RX_BLK; - #define RX_BLK_SET_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags |= _flag) #define RX_BLK_TEST_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags & _flag) #define RX_BLK_CLEAR_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags &= ~(_flag)) - #define fRX_WDS 0x0001 #define fRX_AMSDU 0x0002 #define fRX_ARALINK 0x0004 @@ -2308,7 +2199,6 @@ typedef struct _RX_BLK_ #define LENGTH_ARALINK_SUBFRAMEHEAD 14 #define LENGTH_ARALINK_HEADER_FIELD 2 - /*************************************************************************** * Tx Path software control block related data structures **************************************************************************/ @@ -2320,50 +2210,45 @@ typedef struct _RX_BLK_ #define TX_RALINK_FRAME 0x10 #define TX_FRAG_FRAME 0x20 +// Currently the sizeof(TX_BLK) is 148 bytes. +typedef struct _TX_BLK_ { + UCHAR QueIdx; + UCHAR TxFrameType; // Indicate the Transmission type of the all frames in one batch + UCHAR TotalFrameNum; // Total frame number want to send-out in one batch + USHORT TotalFragNum; // Total frame fragments required in one batch + USHORT TotalFrameLen; // Total length of all frames want to send-out in one batch -// Currently the sizeof(TX_BLK) is 148 bytes. -typedef struct _TX_BLK_ -{ - UCHAR QueIdx; - UCHAR TxFrameType; // Indicate the Transmission type of the all frames in one batch - UCHAR TotalFrameNum; // Total frame number want to send-out in one batch - USHORT TotalFragNum; // Total frame fragments required in one batch - USHORT TotalFrameLen; // Total length of all frames want to send-out in one batch - - QUEUE_HEADER TxPacketList; - MAC_TABLE_ENTRY *pMacEntry; // NULL: packet with 802.11 RA field is multicast/broadcast address - HTTRANSMIT_SETTING *pTransmit; + QUEUE_HEADER TxPacketList; + MAC_TABLE_ENTRY *pMacEntry; // NULL: packet with 802.11 RA field is multicast/broadcast address + HTTRANSMIT_SETTING *pTransmit; // Following structure used for the characteristics of a specific packet. - PNDIS_PACKET pPacket; - PUCHAR pSrcBufHeader; // Reference to the head of sk_buff->data - PUCHAR pSrcBufData; // Reference to the sk_buff->data, will changed depends on hanlding progresss - UINT SrcBufLen; // Length of packet payload which not including Layer 2 header - PUCHAR pExtraLlcSnapEncap; // NULL means no extra LLC/SNAP is required - UCHAR HeaderBuf[128]; // TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP + PNDIS_PACKET pPacket; + PUCHAR pSrcBufHeader; // Reference to the head of sk_buff->data + PUCHAR pSrcBufData; // Reference to the sk_buff->data, will changed depends on hanlding progresss + UINT SrcBufLen; // Length of packet payload which not including Layer 2 header + PUCHAR pExtraLlcSnapEncap; // NULL means no extra LLC/SNAP is required + UCHAR HeaderBuf[128]; // TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP //RT2870 2.1.0.0 uses only 80 bytes //RT3070 2.1.1.0 uses only 96 bytes //RT3090 2.1.0.0 uses only 96 bytes - UCHAR MpduHeaderLen; // 802.11 header length NOT including the padding - UCHAR HdrPadLen; // recording Header Padding Length; - UCHAR apidx; // The interface associated to this packet - UCHAR Wcid; // The MAC entry associated to this packet - UCHAR UserPriority; // priority class of packet - UCHAR FrameGap; // what kind of IFS this packet use - UCHAR MpduReqNum; // number of fragments of this frame - UCHAR TxRate; // TODO: Obsoleted? Should change to MCS? - UCHAR CipherAlg; // cipher alogrithm - PCIPHER_KEY pKey; - - - - USHORT Flags; //See following definitions for detail. + UCHAR MpduHeaderLen; // 802.11 header length NOT including the padding + UCHAR HdrPadLen; // recording Header Padding Length; + UCHAR apidx; // The interface associated to this packet + UCHAR Wcid; // The MAC entry associated to this packet + UCHAR UserPriority; // priority class of packet + UCHAR FrameGap; // what kind of IFS this packet use + UCHAR MpduReqNum; // number of fragments of this frame + UCHAR TxRate; // TODO: Obsoleted? Should change to MCS? + UCHAR CipherAlg; // cipher alogrithm + PCIPHER_KEY pKey; + + USHORT Flags; //See following definitions for detail. //YOU SHOULD NOT TOUCH IT! Following parameters are used for hardware-depended layer. - ULONG Priv; // Hardware specific value saved in here. + ULONG Priv; // Hardware specific value saved in here. } TX_BLK, *PTX_BLK; - #define fTX_bRtsRequired 0x0001 // Indicate if need send RTS frame for protection. Not used in RT2860/RT2870. #define fTX_bAckRequired 0x0002 // the packet need ack response #define fTX_bPiggyBack 0x0004 // Legacy device use Piggback or not @@ -2378,18 +2263,12 @@ typedef struct _TX_BLK_ #define TX_BLK_TEST_FLAG(_pTxBlk, _flag) (((_pTxBlk->Flags & _flag) == _flag) ? 1 : 0) #define TX_BLK_CLEAR_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags &= ~(_flag)) - - - - - /*************************************************************************** * Other static inline function definitions **************************************************************************/ -static inline VOID ConvertMulticastIP2MAC( - IN PUCHAR pIpAddr, - IN PUCHAR *ppMacAddr, - IN UINT16 ProtoType) +static inline VOID ConvertMulticastIP2MAC(IN PUCHAR pIpAddr, + IN PUCHAR * ppMacAddr, + IN UINT16 ProtoType) { if (pIpAddr == NULL) return; @@ -2397,569 +2276,348 @@ static inline VOID ConvertMulticastIP2MAC( if (ppMacAddr == NULL || *ppMacAddr == NULL) return; - switch (ProtoType) - { - case ETH_P_IPV6: -// memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS); - *(*ppMacAddr) = 0x33; - *(*ppMacAddr + 1) = 0x33; - *(*ppMacAddr + 2) = pIpAddr[12]; - *(*ppMacAddr + 3) = pIpAddr[13]; - *(*ppMacAddr + 4) = pIpAddr[14]; - *(*ppMacAddr + 5) = pIpAddr[15]; - break; - - case ETH_P_IP: - default: -// memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS); - *(*ppMacAddr) = 0x01; - *(*ppMacAddr + 1) = 0x00; - *(*ppMacAddr + 2) = 0x5e; - *(*ppMacAddr + 3) = pIpAddr[1] & 0x7f; - *(*ppMacAddr + 4) = pIpAddr[2]; - *(*ppMacAddr + 5) = pIpAddr[3]; - break; + switch (ProtoType) { + case ETH_P_IPV6: +// memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS); + *(*ppMacAddr) = 0x33; + *(*ppMacAddr + 1) = 0x33; + *(*ppMacAddr + 2) = pIpAddr[12]; + *(*ppMacAddr + 3) = pIpAddr[13]; + *(*ppMacAddr + 4) = pIpAddr[14]; + *(*ppMacAddr + 5) = pIpAddr[15]; + break; + + case ETH_P_IP: + default: +// memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS); + *(*ppMacAddr) = 0x01; + *(*ppMacAddr + 1) = 0x00; + *(*ppMacAddr + 2) = 0x5e; + *(*ppMacAddr + 3) = pIpAddr[1] & 0x7f; + *(*ppMacAddr + 4) = pIpAddr[2]; + *(*ppMacAddr + 5) = pIpAddr[3]; + break; } return; } - char *GetPhyMode(int Mode); -char* GetBW(int BW); +char *GetBW(int BW); // // Private routines in rtmp_init.c // -NDIS_STATUS RTMPAllocAdapterBlock( - IN PVOID handle, - OUT PRTMP_ADAPTER *ppAdapter); +NDIS_STATUS RTMPAllocAdapterBlock(IN PVOID handle, + OUT PRTMP_ADAPTER * ppAdapter); -NDIS_STATUS RTMPAllocTxRxRingMemory( - IN PRTMP_ADAPTER pAd); +NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd); -VOID RTMPFreeAdapter( - IN PRTMP_ADAPTER pAd); +VOID RTMPFreeAdapter(IN PRTMP_ADAPTER pAd); -NDIS_STATUS NICReadRegParameters( - IN PRTMP_ADAPTER pAd, - IN NDIS_HANDLE WrapperConfigurationContext); +NDIS_STATUS NICReadRegParameters(IN PRTMP_ADAPTER pAd, + IN NDIS_HANDLE WrapperConfigurationContext); #ifdef RTMP_RF_RW_SUPPORT -VOID NICInitRFRegisters( - IN PRTMP_ADAPTER pAd); +VOID NICInitRFRegisters(IN PRTMP_ADAPTER pAd); -VOID RtmpChipOpsRFHook( - IN RTMP_ADAPTER *pAd); +VOID RtmpChipOpsRFHook(IN RTMP_ADAPTER * pAd); -NDIS_STATUS RT30xxWriteRFRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR regID, - IN UCHAR value); +NDIS_STATUS RT30xxWriteRFRegister(IN PRTMP_ADAPTER pAd, + IN UCHAR regID, IN UCHAR value); -NDIS_STATUS RT30xxReadRFRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR regID, - IN PUCHAR pValue); +NDIS_STATUS RT30xxReadRFRegister(IN PRTMP_ADAPTER pAd, + IN UCHAR regID, IN PUCHAR pValue); #endif // RTMP_RF_RW_SUPPORT // -VOID NICReadEEPROMParameters( - IN PRTMP_ADAPTER pAd, - IN PUCHAR mac_addr); +VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr); -VOID NICInitAsicFromEEPROM( - IN PRTMP_ADAPTER pAd); +VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd); +NDIS_STATUS NICInitializeAdapter(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset); -NDIS_STATUS NICInitializeAdapter( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bHardReset); +NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset); -NDIS_STATUS NICInitializeAsic( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bHardReset); +VOID NICIssueReset(IN PRTMP_ADAPTER pAd); -VOID NICIssueReset( - IN PRTMP_ADAPTER pAd); +VOID RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, IN UCHAR RingType); -VOID RTMPRingCleanUp( - IN PRTMP_ADAPTER pAd, - IN UCHAR RingType); +VOID UserCfgInit(IN PRTMP_ADAPTER pAd); -VOID UserCfgInit( - IN PRTMP_ADAPTER pAd); +VOID NICResetFromError(IN PRTMP_ADAPTER pAd); -VOID NICResetFromError( - IN PRTMP_ADAPTER pAd); +NDIS_STATUS NICLoadFirmware(IN PRTMP_ADAPTER pAd); -NDIS_STATUS NICLoadFirmware( - IN PRTMP_ADAPTER pAd); +VOID NICEraseFirmware(IN PRTMP_ADAPTER pAd); -VOID NICEraseFirmware( - IN PRTMP_ADAPTER pAd); +NDIS_STATUS NICLoadRateSwitchingParams(IN PRTMP_ADAPTER pAd); -NDIS_STATUS NICLoadRateSwitchingParams( - IN PRTMP_ADAPTER pAd); +BOOLEAN NICCheckForHang(IN PRTMP_ADAPTER pAd); -BOOLEAN NICCheckForHang( - IN PRTMP_ADAPTER pAd); +VOID NICUpdateFifoStaCounters(IN PRTMP_ADAPTER pAd); -VOID NICUpdateFifoStaCounters( - IN PRTMP_ADAPTER pAd); +VOID NICUpdateRawCounters(IN PRTMP_ADAPTER pAd); -VOID NICUpdateRawCounters( - IN PRTMP_ADAPTER pAd); +VOID RTMPZeroMemory(IN PVOID pSrc, IN ULONG Length); -VOID RTMPZeroMemory( - IN PVOID pSrc, - IN ULONG Length); +ULONG RTMPCompareMemory(IN PVOID pSrc1, IN PVOID pSrc2, IN ULONG Length); -ULONG RTMPCompareMemory( - IN PVOID pSrc1, - IN PVOID pSrc2, - IN ULONG Length); +VOID RTMPMoveMemory(OUT PVOID pDest, IN PVOID pSrc, IN ULONG Length); -VOID RTMPMoveMemory( - OUT PVOID pDest, - IN PVOID pSrc, - IN ULONG Length); +VOID AtoH(PSTRING src, PUCHAR dest, int destlen); -VOID AtoH( - PSTRING src, - PUCHAR dest, - int destlen); +UCHAR BtoH(char ch); -UCHAR BtoH( - char ch); +VOID RTMPPatchMacBbpBug(IN PRTMP_ADAPTER pAd); -VOID RTMPPatchMacBbpBug( - IN PRTMP_ADAPTER pAd); +VOID RTMPInitTimer(IN PRTMP_ADAPTER pAd, + IN PRALINK_TIMER_STRUCT pTimer, + IN PVOID pTimerFunc, IN PVOID pData, IN BOOLEAN Repeat); -VOID RTMPInitTimer( - IN PRTMP_ADAPTER pAd, - IN PRALINK_TIMER_STRUCT pTimer, - IN PVOID pTimerFunc, - IN PVOID pData, - IN BOOLEAN Repeat); +VOID RTMPSetTimer(IN PRALINK_TIMER_STRUCT pTimer, IN ULONG Value); -VOID RTMPSetTimer( - IN PRALINK_TIMER_STRUCT pTimer, - IN ULONG Value); +VOID RTMPModTimer(IN PRALINK_TIMER_STRUCT pTimer, IN ULONG Value); +VOID RTMPCancelTimer(IN PRALINK_TIMER_STRUCT pTimer, OUT BOOLEAN * pCancelled); -VOID RTMPModTimer( - IN PRALINK_TIMER_STRUCT pTimer, - IN ULONG Value); +VOID RTMPSetLED(IN PRTMP_ADAPTER pAd, IN UCHAR Status); -VOID RTMPCancelTimer( - IN PRALINK_TIMER_STRUCT pTimer, - OUT BOOLEAN *pCancelled); +VOID RTMPSetSignalLED(IN PRTMP_ADAPTER pAd, IN NDIS_802_11_RSSI Dbm); -VOID RTMPSetLED( - IN PRTMP_ADAPTER pAd, - IN UCHAR Status); - -VOID RTMPSetSignalLED( - IN PRTMP_ADAPTER pAd, - IN NDIS_802_11_RSSI Dbm); - -VOID RTMPEnableRxTx( - IN PRTMP_ADAPTER pAd); +VOID RTMPEnableRxTx(IN PRTMP_ADAPTER pAd); // // prototype in action.c // -VOID ActionStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - OUT STATE_MACHINE_FUNC Trans[]); - -VOID MlmeADDBAAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MlmeDELBAAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MlmeDLSAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MlmeInvalidAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MlmeQOSAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerAddBAReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerAddBARspAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerDelBAAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerBAAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID SendPSMPAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR Psmp); - -VOID PeerRMAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerPublicAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerHTAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerQOSAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID RECBATimerTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID ORIBATimerTimeout( - IN PRTMP_ADAPTER pAd); - -VOID SendRefreshBAR( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry); - - -VOID ActHeaderInit( - IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, - IN PUCHAR Addr1, - IN PUCHAR Addr2, - IN PUCHAR Addr3); - -VOID BarHeaderInit( - IN PRTMP_ADAPTER pAd, - IN OUT PFRAME_BAR pCntlBar, - IN PUCHAR pDA, - IN PUCHAR pSA); - -VOID InsertActField( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 Category, - IN UINT8 ActCode); - -BOOLEAN CntlEnqueueForRecv( - IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN ULONG MsgLen, - IN PFRAME_BA_REQ pMsg); +VOID ActionStateMachineInit(IN PRTMP_ADAPTER pAd, + IN STATE_MACHINE * S, + OUT STATE_MACHINE_FUNC Trans[]); + +VOID MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID MlmeDLSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID MlmeInvalidAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID MlmeQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID PeerAddBARspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID PeerDelBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID PeerBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID SendPSMPAction(IN PRTMP_ADAPTER pAd, IN UCHAR Wcid, IN UCHAR Psmp); + +VOID PeerRMAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID PeerPublicAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID PeerQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID RECBATimerTimeout(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); + +VOID ORIBATimerTimeout(IN PRTMP_ADAPTER pAd); + +VOID SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry); + +VOID ActHeaderInit(IN PRTMP_ADAPTER pAd, + IN OUT PHEADER_802_11 pHdr80211, + IN PUCHAR Addr1, IN PUCHAR Addr2, IN PUCHAR Addr3); + +VOID BarHeaderInit(IN PRTMP_ADAPTER pAd, + IN OUT PFRAME_BAR pCntlBar, IN PUCHAR pDA, IN PUCHAR pSA); + +VOID InsertActField(IN PRTMP_ADAPTER pAd, + OUT PUCHAR pFrameBuf, + OUT PULONG pFrameLen, IN UINT8 Category, IN UINT8 ActCode); + +BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd, + IN ULONG Wcid, + IN ULONG MsgLen, IN PFRAME_BA_REQ pMsg); // // Private routines in rtmp_data.c // -BOOLEAN RTMPHandleRxDoneInterrupt( - IN PRTMP_ADAPTER pAd); - -BOOLEAN RTMPHandleTxRingDmaDoneInterrupt( - IN PRTMP_ADAPTER pAd, - IN INT_SOURCE_CSR_STRUC TxRingBitmap); - -VOID RTMPHandleMgmtRingDmaDoneInterrupt( - IN PRTMP_ADAPTER pAd); - -VOID RTMPHandleTBTTInterrupt( - IN PRTMP_ADAPTER pAd); - -VOID RTMPHandlePreTBTTInterrupt( - IN PRTMP_ADAPTER pAd); - -void RTMPHandleTwakeupInterrupt( - IN PRTMP_ADAPTER pAd); - -VOID RTMPHandleRxCoherentInterrupt( - IN PRTMP_ADAPTER pAd); - -BOOLEAN TxFrameIsAggregatible( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pPrevAddr1, - IN PUCHAR p8023hdr); - -BOOLEAN PeerIsAggreOn( - IN PRTMP_ADAPTER pAd, - IN ULONG TxRate, - IN PMAC_TABLE_ENTRY pMacEntry); - - -NDIS_STATUS Sniff2BytesFromNdisBuffer( - IN PNDIS_BUFFER pFirstBuffer, - IN UCHAR DesiredOffset, - OUT PUCHAR pByte0, - OUT PUCHAR pByte1); - -NDIS_STATUS STASendPacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket); - -VOID STASendPackets( - IN NDIS_HANDLE MiniportAdapterContext, - IN PPNDIS_PACKET ppPacketArray, - IN UINT NumberOfPackets); - -VOID RTMPDeQueuePacket( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bIntContext, - IN UCHAR QueIdx, - IN UCHAR Max_Tx_Packets); - -NDIS_STATUS RTMPHardTransmit( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN UCHAR QueIdx, - OUT PULONG pFreeTXDLeft); - -NDIS_STATUS STAHardTransmit( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR QueIdx); - -VOID STARxEAPOLFrameIndicate( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID); - -NDIS_STATUS RTMPFreeTXDRequest( - IN PRTMP_ADAPTER pAd, - IN UCHAR RingType, - IN UCHAR NumberRequired, - IN PUCHAR FreeNumberIs); - -NDIS_STATUS MlmeHardTransmit( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket); - -NDIS_STATUS MlmeHardTransmitMgmtRing( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket); +BOOLEAN RTMPHandleRxDoneInterrupt(IN PRTMP_ADAPTER pAd); + +BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd, + IN INT_SOURCE_CSR_STRUC TxRingBitmap); + +VOID RTMPHandleMgmtRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd); + +VOID RTMPHandleTBTTInterrupt(IN PRTMP_ADAPTER pAd); + +VOID RTMPHandlePreTBTTInterrupt(IN PRTMP_ADAPTER pAd); + +void RTMPHandleTwakeupInterrupt(IN PRTMP_ADAPTER pAd); + +VOID RTMPHandleRxCoherentInterrupt(IN PRTMP_ADAPTER pAd); + +BOOLEAN TxFrameIsAggregatible(IN PRTMP_ADAPTER pAd, + IN PUCHAR pPrevAddr1, IN PUCHAR p8023hdr); + +BOOLEAN PeerIsAggreOn(IN PRTMP_ADAPTER pAd, + IN ULONG TxRate, IN PMAC_TABLE_ENTRY pMacEntry); + +NDIS_STATUS Sniff2BytesFromNdisBuffer(IN PNDIS_BUFFER pFirstBuffer, + IN UCHAR DesiredOffset, + OUT PUCHAR pByte0, OUT PUCHAR pByte1); + +NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); + +VOID STASendPackets(IN NDIS_HANDLE MiniportAdapterContext, + IN PPNDIS_PACKET ppPacketArray, IN UINT NumberOfPackets); + +VOID RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, + IN BOOLEAN bIntContext, + IN UCHAR QueIdx, IN UCHAR Max_Tx_Packets); + +NDIS_STATUS RTMPHardTransmit(IN PRTMP_ADAPTER pAd, + IN PNDIS_PACKET pPacket, + IN UCHAR QueIdx, OUT PULONG pFreeTXDLeft); + +NDIS_STATUS STAHardTransmit(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, IN UCHAR QueIdx); + +VOID STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, + IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); + +NDIS_STATUS RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, + IN UCHAR RingType, + IN UCHAR NumberRequired, IN PUCHAR FreeNumberIs); + +NDIS_STATUS MlmeHardTransmit(IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, IN PNDIS_PACKET pPacket); + +NDIS_STATUS MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, IN PNDIS_PACKET pPacket); #ifdef RTMP_MAC_PCI -NDIS_STATUS MlmeHardTransmitTxRing( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket); - -NDIS_STATUS MlmeDataHardTransmit( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket); - -VOID RTMPWriteTxDescriptor( - IN PRTMP_ADAPTER pAd, - IN PTXD_STRUC pTxD, - IN BOOLEAN bWIV, - IN UCHAR QSEL); +NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, IN PNDIS_PACKET pPacket); + +NDIS_STATUS MlmeDataHardTransmit(IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, IN PNDIS_PACKET pPacket); + +VOID RTMPWriteTxDescriptor(IN PRTMP_ADAPTER pAd, + IN PTXD_STRUC pTxD, IN BOOLEAN bWIV, IN UCHAR QSEL); #endif // RTMP_MAC_PCI // -USHORT RTMPCalcDuration( - IN PRTMP_ADAPTER pAd, - IN UCHAR Rate, - IN ULONG Size); - -VOID RTMPWriteTxWI( - IN PRTMP_ADAPTER pAd, - IN PTXWI_STRUC pTxWI, - IN BOOLEAN FRAG, - IN BOOLEAN CFACK, - IN BOOLEAN InsTimestamp, - IN BOOLEAN AMPDU, - IN BOOLEAN Ack, - IN BOOLEAN NSeq, // HW new a sequence. - IN UCHAR BASize, - IN UCHAR WCID, - IN ULONG Length, - IN UCHAR PID, - IN UCHAR TID, - IN UCHAR TxRate, - IN UCHAR Txopmode, - IN BOOLEAN CfAck, - IN HTTRANSMIT_SETTING *pTransmit); - - -VOID RTMPWriteTxWI_Data( - IN PRTMP_ADAPTER pAd, - IN OUT PTXWI_STRUC pTxWI, - IN TX_BLK *pTxBlk); - - -VOID RTMPWriteTxWI_Cache( - IN PRTMP_ADAPTER pAd, - IN OUT PTXWI_STRUC pTxWI, - IN TX_BLK *pTxBlk); - -VOID RTMPSuspendMsduTransmission( - IN PRTMP_ADAPTER pAd); - -VOID RTMPResumeMsduTransmission( - IN PRTMP_ADAPTER pAd); - -NDIS_STATUS MiniportMMRequest( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN PUCHAR pData, - IN UINT Length); +USHORT RTMPCalcDuration(IN PRTMP_ADAPTER pAd, IN UCHAR Rate, IN ULONG Size); -//+++mark by shiang, now this function merge to MiniportMMRequest() -//---mark by shiang, now this function merge to MiniportMMRequest() +VOID RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pTxWI, IN BOOLEAN FRAG, IN BOOLEAN CFACK, IN BOOLEAN InsTimestamp, IN BOOLEAN AMPDU, IN BOOLEAN Ack, IN BOOLEAN NSeq, // HW new a sequence. + IN UCHAR BASize, + IN UCHAR WCID, + IN ULONG Length, + IN UCHAR PID, + IN UCHAR TID, + IN UCHAR TxRate, + IN UCHAR Txopmode, + IN BOOLEAN CfAck, IN HTTRANSMIT_SETTING * pTransmit); -VOID RTMPSendNullFrame( - IN PRTMP_ADAPTER pAd, - IN UCHAR TxRate, - IN BOOLEAN bQosNull); +VOID RTMPWriteTxWI_Data(IN PRTMP_ADAPTER pAd, + IN OUT PTXWI_STRUC pTxWI, IN TX_BLK * pTxBlk); -VOID RTMPSendDisassociationFrame( - IN PRTMP_ADAPTER pAd); +VOID RTMPWriteTxWI_Cache(IN PRTMP_ADAPTER pAd, + IN OUT PTXWI_STRUC pTxWI, IN TX_BLK * pTxBlk); -VOID RTMPSendRTSFrame( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN unsigned int NextMpduSize, - IN UCHAR TxRate, - IN UCHAR RTSRate, - IN USHORT AckDuration, - IN UCHAR QueIdx, - IN UCHAR FrameGap); +VOID RTMPSuspendMsduTransmission(IN PRTMP_ADAPTER pAd); -PQUEUE_HEADER RTMPCheckTxSwQueue( - IN PRTMP_ADAPTER pAd, - OUT UCHAR *QueIdx); +VOID RTMPResumeMsduTransmission(IN PRTMP_ADAPTER pAd); + +NDIS_STATUS MiniportMMRequest(IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, IN PUCHAR pData, IN UINT Length); + +//+++mark by shiang, now this function merge to MiniportMMRequest() +//---mark by shiang, now this function merge to MiniportMMRequest() -VOID RTMPReportMicError( - IN PRTMP_ADAPTER pAd, - IN PCIPHER_KEY pWpaKey); +VOID RTMPSendNullFrame(IN PRTMP_ADAPTER pAd, + IN UCHAR TxRate, IN BOOLEAN bQosNull); -VOID WpaMicFailureReportFrame( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID RTMPSendDisassociationFrame(IN PRTMP_ADAPTER pAd); -VOID WpaDisassocApAndBlockAssoc( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); +VOID RTMPSendRTSFrame(IN PRTMP_ADAPTER pAd, + IN PUCHAR pDA, + IN unsigned int NextMpduSize, + IN UCHAR TxRate, + IN UCHAR RTSRate, + IN USHORT AckDuration, + IN UCHAR QueIdx, IN UCHAR FrameGap); -VOID WpaStaPairwiseKeySetting( - IN PRTMP_ADAPTER pAd); +PQUEUE_HEADER RTMPCheckTxSwQueue(IN PRTMP_ADAPTER pAd, OUT UCHAR * QueIdx); -VOID WpaStaGroupKeySetting( - IN PRTMP_ADAPTER pAd); +VOID RTMPReportMicError(IN PRTMP_ADAPTER pAd, IN PCIPHER_KEY pWpaKey); -NDIS_STATUS RTMPCloneNdisPacket( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN pInsAMSDUHdr, - IN PNDIS_PACKET pInPacket, - OUT PNDIS_PACKET *ppOutPacket); +VOID WpaMicFailureReportFrame(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -NDIS_STATUS RTMPAllocateNdisPacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET *pPacket, - IN PUCHAR pHeader, - IN UINT HeaderLen, - IN PUCHAR pData, - IN UINT DataLen); +VOID WpaDisassocApAndBlockAssoc(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3); -VOID RTMPFreeNdisPacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket); +VOID WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd); -BOOLEAN RTMPFreeTXDUponTxDmaDone( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx); +VOID WpaStaGroupKeySetting(IN PRTMP_ADAPTER pAd); -BOOLEAN RTMPCheckDHCPFrame( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket); +NDIS_STATUS RTMPCloneNdisPacket(IN PRTMP_ADAPTER pAd, + IN BOOLEAN pInsAMSDUHdr, + IN PNDIS_PACKET pInPacket, + OUT PNDIS_PACKET * ppOutPacket); +NDIS_STATUS RTMPAllocateNdisPacket(IN PRTMP_ADAPTER pAd, + IN PNDIS_PACKET * pPacket, + IN PUCHAR pHeader, + IN UINT HeaderLen, + IN PUCHAR pData, IN UINT DataLen); -BOOLEAN RTMPCheckEtherType( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket); +VOID RTMPFreeNdisPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); +BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx); + +BOOLEAN RTMPCheckDHCPFrame(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); + +BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); // // Private routines in rtmp_wep.c // -VOID RTMPInitWepEngine( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKey, - IN UCHAR KeyId, - IN UCHAR KeyLen, - IN PUCHAR pDest); - -VOID RTMPEncryptData( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pSrc, - IN PUCHAR pDest, - IN UINT Len); - -BOOLEAN RTMPSoftDecryptWEP( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, - IN PCIPHER_KEY pGroupKey); - -VOID RTMPSetICV( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDest); - -VOID ARCFOUR_INIT( - IN PARCFOURCONTEXT Ctx, - IN PUCHAR pKey, - IN UINT KeyLen); - -UCHAR ARCFOUR_BYTE( - IN PARCFOURCONTEXT Ctx); - -VOID ARCFOUR_DECRYPT( - IN PARCFOURCONTEXT Ctx, - IN PUCHAR pDest, - IN PUCHAR pSrc, - IN UINT Len); - -VOID ARCFOUR_ENCRYPT( - IN PARCFOURCONTEXT Ctx, - IN PUCHAR pDest, - IN PUCHAR pSrc, - IN UINT Len); - -VOID WPAARCFOUR_ENCRYPT( - IN PARCFOURCONTEXT Ctx, - IN PUCHAR pDest, - IN PUCHAR pSrc, - IN UINT Len); - -UINT RTMP_CALC_FCS32( - IN UINT Fcs, - IN PUCHAR Cp, - IN INT Len); +VOID RTMPInitWepEngine(IN PRTMP_ADAPTER pAd, + IN PUCHAR pKey, + IN UCHAR KeyId, IN UCHAR KeyLen, IN PUCHAR pDest); + +VOID RTMPEncryptData(IN PRTMP_ADAPTER pAd, + IN PUCHAR pSrc, IN PUCHAR pDest, IN UINT Len); + +BOOLEAN RTMPSoftDecryptWEP(IN PRTMP_ADAPTER pAd, + IN PUCHAR pData, + IN ULONG DataByteCnt, IN PCIPHER_KEY pGroupKey); + +VOID RTMPSetICV(IN PRTMP_ADAPTER pAd, IN PUCHAR pDest); + +VOID ARCFOUR_INIT(IN PARCFOURCONTEXT Ctx, IN PUCHAR pKey, IN UINT KeyLen); + +UCHAR ARCFOUR_BYTE(IN PARCFOURCONTEXT Ctx); + +VOID ARCFOUR_DECRYPT(IN PARCFOURCONTEXT Ctx, + IN PUCHAR pDest, IN PUCHAR pSrc, IN UINT Len); + +VOID ARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, + IN PUCHAR pDest, IN PUCHAR pSrc, IN UINT Len); + +VOID WPAARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, + IN PUCHAR pDest, IN PUCHAR pSrc, IN UINT Len); + +UINT RTMP_CALC_FCS32(IN UINT Fcs, IN PUCHAR Cp, IN INT Len); // // MLME routines @@ -2967,515 +2625,312 @@ UINT RTMP_CALC_FCS32( // Asic/RF/BBP related functions -VOID AsicAdjustTxPower( - IN PRTMP_ADAPTER pAd); - -VOID AsicUpdateProtect( - IN PRTMP_ADAPTER pAd, - IN USHORT OperaionMode, - IN UCHAR SetMask, - IN BOOLEAN bDisableBGProtect, - IN BOOLEAN bNonGFExist); - -VOID AsicSwitchChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel, - IN BOOLEAN bScan); - -VOID AsicLockChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel) ; - -VOID AsicRfTuningExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID AsicResetBBPAgent( - IN PRTMP_ADAPTER pAd); - -VOID AsicSleepThenAutoWakeup( - IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp); - -VOID AsicForceSleep( - IN PRTMP_ADAPTER pAd); - -VOID AsicForceWakeup( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bFromTx); - -VOID AsicSetBssid( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pBssid); - -VOID AsicSetMcastWC( - IN PRTMP_ADAPTER pAd); - -VOID AsicDelWcidTab( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid); - -VOID AsicEnableRDG( - IN PRTMP_ADAPTER pAd); - -VOID AsicDisableRDG( - IN PRTMP_ADAPTER pAd); - -VOID AsicDisableSync( - IN PRTMP_ADAPTER pAd); - -VOID AsicEnableBssSync( - IN PRTMP_ADAPTER pAd); - -VOID AsicEnableIbssSync( - IN PRTMP_ADAPTER pAd); - -VOID AsicSetEdcaParm( - IN PRTMP_ADAPTER pAd, - IN PEDCA_PARM pEdcaParm); - -VOID AsicSetSlotTime( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bUseShortSlotTime); - -VOID AsicAddSharedKeyEntry( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssIndex, - IN UCHAR KeyIdx, - IN UCHAR CipherAlg, - IN PUCHAR pKey, - IN PUCHAR pTxMic, - IN PUCHAR pRxMic); - -VOID AsicRemoveSharedKeyEntry( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssIndex, - IN UCHAR KeyIdx); - -VOID AsicUpdateWCIDAttribute( - IN PRTMP_ADAPTER pAd, - IN USHORT WCID, - IN UCHAR BssIndex, - IN UCHAR CipherAlg, - IN BOOLEAN bUsePairewiseKeyTable); - -VOID AsicUpdateWCIDIVEIV( - IN PRTMP_ADAPTER pAd, - IN USHORT WCID, - IN ULONG uIV, - IN ULONG uEIV); - -VOID AsicUpdateRxWCIDTable( - IN PRTMP_ADAPTER pAd, - IN USHORT WCID, - IN PUCHAR pAddr); - -VOID AsicAddKeyEntry( - IN PRTMP_ADAPTER pAd, - IN USHORT WCID, - IN UCHAR BssIndex, - IN UCHAR KeyIdx, - IN PCIPHER_KEY pCipherKey, - IN BOOLEAN bUsePairewiseKeyTable, - IN BOOLEAN bTxKey); - -VOID AsicAddPairwiseKeyEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR WCID, - IN CIPHER_KEY *pCipherKey); - -VOID AsicRemovePairwiseKeyEntry( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssIdx, - IN UCHAR Wcid); - -BOOLEAN AsicSendCommandToMcu( - IN PRTMP_ADAPTER pAd, - IN UCHAR Command, - IN UCHAR Token, - IN UCHAR Arg0, - IN UCHAR Arg1); +VOID AsicAdjustTxPower(IN PRTMP_ADAPTER pAd); + +VOID AsicUpdateProtect(IN PRTMP_ADAPTER pAd, + IN USHORT OperaionMode, + IN UCHAR SetMask, + IN BOOLEAN bDisableBGProtect, IN BOOLEAN bNonGFExist); + +VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, + IN UCHAR Channel, IN BOOLEAN bScan); + +VOID AsicLockChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel); + +VOID AsicRfTuningExec(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); + +VOID AsicResetBBPAgent(IN PRTMP_ADAPTER pAd); + +VOID AsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, + IN USHORT TbttNumToNextWakeUp); + +VOID AsicForceSleep(IN PRTMP_ADAPTER pAd); + +VOID AsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx); + +VOID AsicSetBssid(IN PRTMP_ADAPTER pAd, IN PUCHAR pBssid); + +VOID AsicSetMcastWC(IN PRTMP_ADAPTER pAd); + +VOID AsicDelWcidTab(IN PRTMP_ADAPTER pAd, IN UCHAR Wcid); +VOID AsicEnableRDG(IN PRTMP_ADAPTER pAd); + +VOID AsicDisableRDG(IN PRTMP_ADAPTER pAd); + +VOID AsicDisableSync(IN PRTMP_ADAPTER pAd); + +VOID AsicEnableBssSync(IN PRTMP_ADAPTER pAd); + +VOID AsicEnableIbssSync(IN PRTMP_ADAPTER pAd); + +VOID AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm); + +VOID AsicSetSlotTime(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUseShortSlotTime); + +VOID AsicAddSharedKeyEntry(IN PRTMP_ADAPTER pAd, + IN UCHAR BssIndex, + IN UCHAR KeyIdx, + IN UCHAR CipherAlg, + IN PUCHAR pKey, IN PUCHAR pTxMic, IN PUCHAR pRxMic); + +VOID AsicRemoveSharedKeyEntry(IN PRTMP_ADAPTER pAd, + IN UCHAR BssIndex, IN UCHAR KeyIdx); + +VOID AsicUpdateWCIDAttribute(IN PRTMP_ADAPTER pAd, + IN USHORT WCID, + IN UCHAR BssIndex, + IN UCHAR CipherAlg, + IN BOOLEAN bUsePairewiseKeyTable); + +VOID AsicUpdateWCIDIVEIV(IN PRTMP_ADAPTER pAd, + IN USHORT WCID, IN ULONG uIV, IN ULONG uEIV); + +VOID AsicUpdateRxWCIDTable(IN PRTMP_ADAPTER pAd, + IN USHORT WCID, IN PUCHAR pAddr); + +VOID AsicAddKeyEntry(IN PRTMP_ADAPTER pAd, + IN USHORT WCID, + IN UCHAR BssIndex, + IN UCHAR KeyIdx, + IN PCIPHER_KEY pCipherKey, + IN BOOLEAN bUsePairewiseKeyTable, IN BOOLEAN bTxKey); + +VOID AsicAddPairwiseKeyEntry(IN PRTMP_ADAPTER pAd, + IN PUCHAR pAddr, + IN UCHAR WCID, IN CIPHER_KEY * pCipherKey); + +VOID AsicRemovePairwiseKeyEntry(IN PRTMP_ADAPTER pAd, + IN UCHAR BssIdx, IN UCHAR Wcid); + +BOOLEAN AsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, + IN UCHAR Command, + IN UCHAR Token, IN UCHAR Arg0, IN UCHAR Arg1); #ifdef RTMP_MAC_PCI -BOOLEAN AsicCheckCommanOk( - IN PRTMP_ADAPTER pAd, - IN UCHAR Command); +BOOLEAN AsicCheckCommanOk(IN PRTMP_ADAPTER pAd, IN UCHAR Command); #endif // RTMP_MAC_PCI // -VOID MacAddrRandomBssid( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pAddr); - -VOID MgtMacHeaderInit( - IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, - IN UCHAR SubType, - IN UCHAR ToDs, - IN PUCHAR pDA, - IN PUCHAR pBssid); - -VOID MlmeRadioOff( - IN PRTMP_ADAPTER pAd); - -VOID MlmeRadioOn( - IN PRTMP_ADAPTER pAd); - - -VOID BssTableInit( - IN BSS_TABLE *Tab); - -VOID BATableInit( - IN PRTMP_ADAPTER pAd, - IN BA_TABLE *Tab); - -ULONG BssTableSearch( - IN BSS_TABLE *Tab, - IN PUCHAR pBssid, - IN UCHAR Channel); - -ULONG BssSsidTableSearch( - IN BSS_TABLE *Tab, - IN PUCHAR pBssid, - IN PUCHAR pSsid, - IN UCHAR SsidLen, - IN UCHAR Channel); - -ULONG BssTableSearchWithSSID( - IN BSS_TABLE *Tab, - IN PUCHAR Bssid, - IN PUCHAR pSsid, - IN UCHAR SsidLen, - IN UCHAR Channel); - -ULONG BssSsidTableSearchBySSID( - IN BSS_TABLE *Tab, - IN PUCHAR pSsid, - IN UCHAR SsidLen); - -VOID BssTableDeleteEntry( - IN OUT PBSS_TABLE pTab, - IN PUCHAR pBssid, - IN UCHAR Channel); - -VOID BATableDeleteORIEntry( - IN OUT PRTMP_ADAPTER pAd, - IN BA_ORI_ENTRY *pBAORIEntry); - -VOID BssEntrySet( - IN PRTMP_ADAPTER pAd, - OUT PBSS_ENTRY pBss, - IN PUCHAR pBssid, - IN CHAR Ssid[], - IN UCHAR SsidLen, - IN UCHAR BssType, - IN USHORT BeaconPeriod, - IN PCF_PARM CfParm, - IN USHORT AtimWin, - IN USHORT CapabilityInfo, - IN UCHAR SupRate[], - IN UCHAR SupRateLen, - IN UCHAR ExtRate[], - IN UCHAR ExtRateLen, - IN HT_CAPABILITY_IE *pHtCapability, - IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE - IN UCHAR HtCapabilityLen, - IN UCHAR AddHtInfoLen, - IN UCHAR NewExtChanOffset, - IN UCHAR Channel, - IN CHAR Rssi, - IN LARGE_INTEGER TimeStamp, - IN UCHAR CkipFlag, - IN PEDCA_PARM pEdcaParm, - IN PQOS_CAPABILITY_PARM pQosCapability, - IN PQBSS_LOAD_PARM pQbssLoad, - IN USHORT LengthVIE, - IN PNDIS_802_11_VARIABLE_IEs pVIE); - -ULONG BssTableSetEntry( - IN PRTMP_ADAPTER pAd, - OUT PBSS_TABLE pTab, - IN PUCHAR pBssid, - IN CHAR Ssid[], - IN UCHAR SsidLen, - IN UCHAR BssType, - IN USHORT BeaconPeriod, - IN CF_PARM *CfParm, - IN USHORT AtimWin, - IN USHORT CapabilityInfo, - IN UCHAR SupRate[], - IN UCHAR SupRateLen, - IN UCHAR ExtRate[], - IN UCHAR ExtRateLen, - IN HT_CAPABILITY_IE *pHtCapability, - IN ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE - IN UCHAR HtCapabilityLen, - IN UCHAR AddHtInfoLen, - IN UCHAR NewExtChanOffset, - IN UCHAR Channel, - IN CHAR Rssi, - IN LARGE_INTEGER TimeStamp, - IN UCHAR CkipFlag, - IN PEDCA_PARM pEdcaParm, - IN PQOS_CAPABILITY_PARM pQosCapability, - IN PQBSS_LOAD_PARM pQbssLoad, - IN USHORT LengthVIE, - IN PNDIS_802_11_VARIABLE_IEs pVIE); - -VOID BATableInsertEntry( - IN PRTMP_ADAPTER pAd, - IN USHORT Aid, - IN USHORT TimeOutValue, - IN USHORT StartingSeq, - IN UCHAR TID, - IN UCHAR BAWinSize, - IN UCHAR OriginatorStatus, - IN BOOLEAN IsRecipient); - -VOID BssTableSsidSort( - IN PRTMP_ADAPTER pAd, - OUT BSS_TABLE *OutTab, - IN CHAR Ssid[], - IN UCHAR SsidLen); - -VOID BssTableSortByRssi( - IN OUT BSS_TABLE *OutTab); - -VOID BssCipherParse( - IN OUT PBSS_ENTRY pBss); - -NDIS_STATUS MlmeQueueInit( - IN MLME_QUEUE *Queue); - -VOID MlmeQueueDestroy( - IN MLME_QUEUE *Queue); - -BOOLEAN MlmeEnqueue( - IN PRTMP_ADAPTER pAd, - IN ULONG Machine, - IN ULONG MsgType, - IN ULONG MsgLen, - IN VOID *Msg); - -BOOLEAN MlmeEnqueueForRecv( - IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN ULONG TimeStampHigh, - IN ULONG TimeStampLow, - IN UCHAR Rssi0, - IN UCHAR Rssi1, - IN UCHAR Rssi2, - IN ULONG MsgLen, - IN PVOID Msg, - IN UCHAR Signal); - - -BOOLEAN MlmeDequeue( - IN MLME_QUEUE *Queue, - OUT MLME_QUEUE_ELEM **Elem); - -VOID MlmeRestartStateMachine( - IN PRTMP_ADAPTER pAd); - -BOOLEAN MlmeQueueEmpty( - IN MLME_QUEUE *Queue); - -BOOLEAN MlmeQueueFull( - IN MLME_QUEUE *Queue); - -BOOLEAN MsgTypeSubst( - IN PRTMP_ADAPTER pAd, - IN PFRAME_802_11 pFrame, - OUT INT *Machine, - OUT INT *MsgType); - -VOID StateMachineInit( - IN STATE_MACHINE *Sm, - IN STATE_MACHINE_FUNC Trans[], - IN ULONG StNr, - IN ULONG MsgNr, - IN STATE_MACHINE_FUNC DefFunc, - IN ULONG InitState, - IN ULONG Base); - -VOID StateMachineSetAction( - IN STATE_MACHINE *S, - IN ULONG St, - ULONG Msg, - IN STATE_MACHINE_FUNC F); - -VOID StateMachinePerformAction( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - IN MLME_QUEUE_ELEM *Elem); - -VOID Drop( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID AssocStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *Sm, - OUT STATE_MACHINE_FUNC Trans[]); - -VOID ReassocTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID AssocTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID DisassocTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); +VOID MacAddrRandomBssid(IN PRTMP_ADAPTER pAd, OUT PUCHAR pAddr); + +VOID MgtMacHeaderInit(IN PRTMP_ADAPTER pAd, + IN OUT PHEADER_802_11 pHdr80211, + IN UCHAR SubType, + IN UCHAR ToDs, IN PUCHAR pDA, IN PUCHAR pBssid); + +VOID MlmeRadioOff(IN PRTMP_ADAPTER pAd); + +VOID MlmeRadioOn(IN PRTMP_ADAPTER pAd); + +VOID BssTableInit(IN BSS_TABLE * Tab); + +VOID BATableInit(IN PRTMP_ADAPTER pAd, IN BA_TABLE * Tab); + +ULONG BssTableSearch(IN BSS_TABLE * Tab, IN PUCHAR pBssid, IN UCHAR Channel); + +ULONG BssSsidTableSearch(IN BSS_TABLE * Tab, + IN PUCHAR pBssid, + IN PUCHAR pSsid, IN UCHAR SsidLen, IN UCHAR Channel); + +ULONG BssTableSearchWithSSID(IN BSS_TABLE * Tab, + IN PUCHAR Bssid, + IN PUCHAR pSsid, + IN UCHAR SsidLen, IN UCHAR Channel); + +ULONG BssSsidTableSearchBySSID(IN BSS_TABLE * Tab, + IN PUCHAR pSsid, IN UCHAR SsidLen); + +VOID BssTableDeleteEntry(IN OUT PBSS_TABLE pTab, + IN PUCHAR pBssid, IN UCHAR Channel); + +VOID BATableDeleteORIEntry(IN OUT PRTMP_ADAPTER pAd, + IN BA_ORI_ENTRY * pBAORIEntry); + +VOID BssEntrySet(IN PRTMP_ADAPTER pAd, OUT PBSS_ENTRY pBss, IN PUCHAR pBssid, IN CHAR Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN USHORT BeaconPeriod, IN PCF_PARM CfParm, IN USHORT AtimWin, IN USHORT CapabilityInfo, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, // AP might use this additional ht info IE + IN UCHAR HtCapabilityLen, + IN UCHAR AddHtInfoLen, + IN UCHAR NewExtChanOffset, + IN UCHAR Channel, + IN CHAR Rssi, + IN LARGE_INTEGER TimeStamp, + IN UCHAR CkipFlag, + IN PEDCA_PARM pEdcaParm, + IN PQOS_CAPABILITY_PARM pQosCapability, + IN PQBSS_LOAD_PARM pQbssLoad, + IN USHORT LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE); + +ULONG BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT PBSS_TABLE pTab, IN PUCHAR pBssid, IN CHAR Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN USHORT BeaconPeriod, IN CF_PARM * CfParm, IN USHORT AtimWin, IN USHORT CapabilityInfo, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, // AP might use this additional ht info IE + IN UCHAR HtCapabilityLen, + IN UCHAR AddHtInfoLen, + IN UCHAR NewExtChanOffset, + IN UCHAR Channel, + IN CHAR Rssi, + IN LARGE_INTEGER TimeStamp, + IN UCHAR CkipFlag, + IN PEDCA_PARM pEdcaParm, + IN PQOS_CAPABILITY_PARM pQosCapability, + IN PQBSS_LOAD_PARM pQbssLoad, + IN USHORT LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE); + +VOID BATableInsertEntry(IN PRTMP_ADAPTER pAd, + IN USHORT Aid, + IN USHORT TimeOutValue, + IN USHORT StartingSeq, + IN UCHAR TID, + IN UCHAR BAWinSize, + IN UCHAR OriginatorStatus, IN BOOLEAN IsRecipient); + +VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, + OUT BSS_TABLE * OutTab, IN CHAR Ssid[], IN UCHAR SsidLen); + +VOID BssTableSortByRssi(IN OUT BSS_TABLE * OutTab); + +VOID BssCipherParse(IN OUT PBSS_ENTRY pBss); + +NDIS_STATUS MlmeQueueInit(IN MLME_QUEUE * Queue); + +VOID MlmeQueueDestroy(IN MLME_QUEUE * Queue); + +BOOLEAN MlmeEnqueue(IN PRTMP_ADAPTER pAd, + IN ULONG Machine, + IN ULONG MsgType, IN ULONG MsgLen, IN VOID * Msg); + +BOOLEAN MlmeEnqueueForRecv(IN PRTMP_ADAPTER pAd, + IN ULONG Wcid, + IN ULONG TimeStampHigh, + IN ULONG TimeStampLow, + IN UCHAR Rssi0, + IN UCHAR Rssi1, + IN UCHAR Rssi2, + IN ULONG MsgLen, IN PVOID Msg, IN UCHAR Signal); + +BOOLEAN MlmeDequeue(IN MLME_QUEUE * Queue, OUT MLME_QUEUE_ELEM ** Elem); + +VOID MlmeRestartStateMachine(IN PRTMP_ADAPTER pAd); + +BOOLEAN MlmeQueueEmpty(IN MLME_QUEUE * Queue); + +BOOLEAN MlmeQueueFull(IN MLME_QUEUE * Queue); + +BOOLEAN MsgTypeSubst(IN PRTMP_ADAPTER pAd, + IN PFRAME_802_11 pFrame, + OUT INT * Machine, OUT INT * MsgType); + +VOID StateMachineInit(IN STATE_MACHINE * Sm, + IN STATE_MACHINE_FUNC Trans[], + IN ULONG StNr, + IN ULONG MsgNr, + IN STATE_MACHINE_FUNC DefFunc, + IN ULONG InitState, IN ULONG Base); + +VOID StateMachineSetAction(IN STATE_MACHINE * S, + IN ULONG St, ULONG Msg, IN STATE_MACHINE_FUNC F); + +VOID StateMachinePerformAction(IN PRTMP_ADAPTER pAd, + IN STATE_MACHINE * S, IN MLME_QUEUE_ELEM * Elem); + +VOID Drop(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID AssocStateMachineInit(IN PRTMP_ADAPTER pAd, + IN STATE_MACHINE * Sm, + OUT STATE_MACHINE_FUNC Trans[]); + +VOID ReassocTimeout(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); + +VOID AssocTimeout(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); + +VOID DisassocTimeout(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); //---------------------------------------------- -VOID MlmeAssocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID MlmeReassocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID MlmeDisassocReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID MlmeDisassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerAssocRspAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID PeerAssocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerReassocRspAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID PeerReassocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerDisassocAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID PeerDisassocAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID DisassocTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID DisassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID AssocTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID AssocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID ReassocTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID ReassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID Cls3errAction( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr); +VOID Cls3errAction(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr); -VOID InvalidStateWhenAssoc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID InvalidStateWhenAssoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID InvalidStateWhenReassoc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID InvalidStateWhenReassoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID InvalidStateWhenDisassociate( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID InvalidStateWhenDisassociate(IN PRTMP_ADAPTER pAd, + IN MLME_QUEUE_ELEM * Elem); #ifdef RTMP_MAC_USB -VOID MlmeCntlConfirm( - IN PRTMP_ADAPTER pAd, - IN ULONG MsgType, - IN USHORT Msg); +VOID MlmeCntlConfirm(IN PRTMP_ADAPTER pAd, IN ULONG MsgType, IN USHORT Msg); #endif // RTMP_MAC_USB // -VOID ComposePsPoll( - IN PRTMP_ADAPTER pAd); - -VOID ComposeNullFrame( - IN PRTMP_ADAPTER pAd); - -VOID AssocPostProc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr2, - IN USHORT CapabilityInfo, - IN USHORT Aid, - IN UCHAR SupRate[], - IN UCHAR SupRateLen, - IN UCHAR ExtRate[], - IN UCHAR ExtRateLen, - IN PEDCA_PARM pEdcaParm, - IN HT_CAPABILITY_IE *pHtCapability, - IN UCHAR HtCapabilityLen, - IN ADD_HT_INFO_IE *pAddHtInfo); - -VOID AuthStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN PSTATE_MACHINE sm, - OUT STATE_MACHINE_FUNC Trans[]); - -VOID AuthTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID MlmeAuthReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerAuthRspAtSeq2Action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerAuthRspAtSeq4Action( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID AuthTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID Cls2errAction( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr); - -VOID MlmeDeauthReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID InvalidStateWhenAuth( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID ComposePsPoll(IN PRTMP_ADAPTER pAd); + +VOID ComposeNullFrame(IN PRTMP_ADAPTER pAd); + +VOID AssocPostProc(IN PRTMP_ADAPTER pAd, + IN PUCHAR pAddr2, + IN USHORT CapabilityInfo, + IN USHORT Aid, + IN UCHAR SupRate[], + IN UCHAR SupRateLen, + IN UCHAR ExtRate[], + IN UCHAR ExtRateLen, + IN PEDCA_PARM pEdcaParm, + IN HT_CAPABILITY_IE * pHtCapability, + IN UCHAR HtCapabilityLen, IN ADD_HT_INFO_IE * pAddHtInfo); + +VOID AuthStateMachineInit(IN PRTMP_ADAPTER pAd, + IN PSTATE_MACHINE sm, OUT STATE_MACHINE_FUNC Trans[]); + +VOID AuthTimeout(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); + +VOID MlmeAuthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID PeerAuthRspAtSeq2Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID PeerAuthRspAtSeq4Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID AuthTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID Cls2errAction(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr); + +VOID MlmeDeauthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID InvalidStateWhenAuth(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); //============================================= -VOID AuthRspStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN PSTATE_MACHINE Sm, - IN STATE_MACHINE_FUNC Trans[]); +VOID AuthRspStateMachineInit(IN PRTMP_ADAPTER pAd, + IN PSTATE_MACHINE Sm, + IN STATE_MACHINE_FUNC Trans[]); -VOID PeerDeauthAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID PeerDeauthAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerAuthSimpleRspGenAndSend( - IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHdr80211, - IN USHORT Alg, - IN USHORT Seq, - IN USHORT Reason, - IN USHORT Status); +VOID PeerAuthSimpleRspGenAndSend(IN PRTMP_ADAPTER pAd, + IN PHEADER_802_11 pHdr80211, + IN USHORT Alg, + IN USHORT Seq, + IN USHORT Reason, IN USHORT Status); // // Private routines in dls.c @@ -3483,1185 +2938,778 @@ VOID PeerAuthSimpleRspGenAndSend( //======================================== -VOID SyncStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *Sm, - OUT STATE_MACHINE_FUNC Trans[]); +VOID SyncStateMachineInit(IN PRTMP_ADAPTER pAd, + IN STATE_MACHINE * Sm, + OUT STATE_MACHINE_FUNC Trans[]); -VOID BeaconTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); +VOID BeaconTimeout(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); -VOID ScanTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); +VOID ScanTimeout(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); -VOID InvalidStateWhenScan( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID InvalidStateWhenScan(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID InvalidStateWhenJoin( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID InvalidStateWhenJoin(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID InvalidStateWhenStart( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID InvalidStateWhenStart(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID EnqueueProbeRequest( - IN PRTMP_ADAPTER pAd); +VOID EnqueueProbeRequest(IN PRTMP_ADAPTER pAd); -BOOLEAN ScanRunning( - IN PRTMP_ADAPTER pAd); +BOOLEAN ScanRunning(IN PRTMP_ADAPTER pAd); //========================================= -VOID MlmeCntlInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - OUT STATE_MACHINE_FUNC Trans[]); - -VOID MlmeCntlMachinePerformAction( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *S, - IN MLME_QUEUE_ELEM *Elem); - -VOID CntlIdleProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID CntlOidScanProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID CntlOidSsidProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM * Elem); - -VOID CntlOidRTBssidProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM * Elem); - -VOID CntlMlmeRoamingProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM * Elem); - -VOID CntlWaitDisassocProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID CntlWaitJoinProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID CntlWaitReassocProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID CntlWaitStartProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID CntlWaitAuthProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID CntlWaitAuthProc2( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID CntlWaitAssocProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID LinkUp( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssType); - -VOID LinkDown( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN IsReqFromAP); - -VOID IterateOnBssTab( - IN PRTMP_ADAPTER pAd); - -VOID IterateOnBssTab2( - IN PRTMP_ADAPTER pAd);; - -VOID JoinParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_JOIN_REQ_STRUCT *JoinReq, - IN ULONG BssIdx); - -VOID AssocParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_ASSOC_REQ_STRUCT *AssocReq, - IN PUCHAR pAddr, - IN USHORT CapabilityInfo, - IN ULONG Timeout, - IN USHORT ListenIntv); - -VOID ScanParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_SCAN_REQ_STRUCT *ScanReq, - IN STRING Ssid[], - IN UCHAR SsidLen, - IN UCHAR BssType, - IN UCHAR ScanType); - -VOID DisassocParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_DISASSOC_REQ_STRUCT *DisassocReq, - IN PUCHAR pAddr, - IN USHORT Reason); - -VOID StartParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_START_REQ_STRUCT *StartReq, - IN CHAR Ssid[], - IN UCHAR SsidLen); - -VOID AuthParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_AUTH_REQ_STRUCT *AuthReq, - IN PUCHAR pAddr, - IN USHORT Alg); - -VOID EnqueuePsPoll( - IN PRTMP_ADAPTER pAd); - -VOID EnqueueBeaconFrame( - IN PRTMP_ADAPTER pAd); - -VOID MlmeJoinReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MlmeScanReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MlmeStartReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID ScanTimeoutAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID BeaconTimeoutAtJoinAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerBeaconAtScanAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerBeaconAtJoinAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerBeacon( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerProbeReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID ScanNextChannel( - IN PRTMP_ADAPTER pAd); - -ULONG MakeIbssBeacon( - IN PRTMP_ADAPTER pAd); - -BOOLEAN MlmeScanReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT UCHAR *BssType, - OUT CHAR ssid[], - OUT UCHAR *SsidLen, - OUT UCHAR *ScanType); - -BOOLEAN PeerBeaconAndProbeRspSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - IN UCHAR MsgChannel, - OUT PUCHAR pAddr2, - OUT PUCHAR pBssid, - OUT CHAR Ssid[], - OUT UCHAR *pSsidLen, - OUT UCHAR *pBssType, - OUT USHORT *pBeaconPeriod, - OUT UCHAR *pChannel, - OUT UCHAR *pNewChannel, - OUT LARGE_INTEGER *pTimestamp, - OUT CF_PARM *pCfParm, - OUT USHORT *pAtimWin, - OUT USHORT *pCapabilityInfo, - OUT UCHAR *pErp, - OUT UCHAR *pDtimCount, - OUT UCHAR *pDtimPeriod, - OUT UCHAR *pBcastFlag, - OUT UCHAR *pMessageToMe, - OUT UCHAR SupRate[], - OUT UCHAR *pSupRateLen, - OUT UCHAR ExtRate[], - OUT UCHAR *pExtRateLen, - OUT UCHAR *pCkipFlag, - OUT UCHAR *pAironetCellPowerLimit, - OUT PEDCA_PARM pEdcaParm, - OUT PQBSS_LOAD_PARM pQbssLoad, - OUT PQOS_CAPABILITY_PARM pQosCapability, - OUT ULONG *pRalinkIe, - OUT UCHAR *pHtCapabilityLen, - OUT UCHAR *pPreNHtCapabilityLen, - OUT HT_CAPABILITY_IE *pHtCapability, - OUT UCHAR *AddHtInfoLen, - OUT ADD_HT_INFO_IE *AddHtInfo, - OUT UCHAR *NewExtChannel, - OUT USHORT *LengthVIE, - OUT PNDIS_802_11_VARIABLE_IEs pVIE); - -BOOLEAN PeerAddBAReqActionSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2); - -BOOLEAN PeerAddBARspActionSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen); - -BOOLEAN PeerDelBAActionSanity( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN VOID *pMsg, - IN ULONG MsgLen); - -BOOLEAN MlmeAssocReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pApAddr, - OUT USHORT *CapabilityInfo, - OUT ULONG *Timeout, - OUT USHORT *ListenIntv); - -BOOLEAN MlmeAuthReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr, - OUT ULONG *Timeout, - OUT USHORT *Alg); - -BOOLEAN MlmeStartReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT CHAR Ssid[], - OUT UCHAR *Ssidlen); - -BOOLEAN PeerAuthSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr, - OUT USHORT *Alg, - OUT USHORT *Seq, - OUT USHORT *Status, - OUT CHAR ChlgText[]); - -BOOLEAN PeerAssocRspSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *pMsg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *pCapabilityInfo, - OUT USHORT *pStatus, - OUT USHORT *pAid, - OUT UCHAR SupRate[], - OUT UCHAR *pSupRateLen, - OUT UCHAR ExtRate[], - OUT UCHAR *pExtRateLen, - OUT HT_CAPABILITY_IE *pHtCapability, - OUT ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE - OUT UCHAR *pHtCapabilityLen, - OUT UCHAR *pAddHtInfoLen, - OUT UCHAR *pNewExtChannelOffset, - OUT PEDCA_PARM pEdcaParm, - OUT UCHAR *pCkipFlag); - -BOOLEAN PeerDisassocSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *Reason); - -BOOLEAN PeerWpaMessageSanity( - IN PRTMP_ADAPTER pAd, - IN PEAPOL_PACKET pMsg, - IN ULONG MsgLen, - IN UCHAR MsgType, - IN MAC_TABLE_ENTRY *pEntry); - -BOOLEAN PeerDeauthSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT USHORT *Reason); - -BOOLEAN PeerProbeReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT CHAR Ssid[], - OUT UCHAR *pSsidLen); - -BOOLEAN GetTimBit( - IN CHAR *Ptr, - IN USHORT Aid, - OUT UCHAR *TimLen, - OUT UCHAR *BcastFlag, - OUT UCHAR *DtimCount, - OUT UCHAR *DtimPeriod, - OUT UCHAR *MessageToMe); - -UCHAR ChannelSanity( - IN PRTMP_ADAPTER pAd, - IN UCHAR channel); - -NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity( - IN PBSS_ENTRY pBss); - -BOOLEAN MlmeDelBAReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen); - -BOOLEAN MlmeAddBAReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2); - -ULONG MakeOutgoingFrame( - OUT UCHAR *Buffer, - OUT ULONG *Length, ...); - -VOID LfsrInit( - IN PRTMP_ADAPTER pAd, - IN ULONG Seed); - -UCHAR RandomByte( - IN PRTMP_ADAPTER pAd); - -VOID AsicUpdateAutoFallBackTable( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pTxRate); - -VOID MlmePeriodicExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID LinkDownExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID STAMlmePeriodicExec( - PRTMP_ADAPTER pAd); - -VOID MlmeAutoScan( - IN PRTMP_ADAPTER pAd); - -VOID MlmeAutoReconnectLastSSID( - IN PRTMP_ADAPTER pAd); - -BOOLEAN MlmeValidateSSID( - IN PUCHAR pSsid, - IN UCHAR SsidLen); - -VOID MlmeCheckForRoaming( - IN PRTMP_ADAPTER pAd, - IN ULONG Now32); - -BOOLEAN MlmeCheckForFastRoaming( - IN PRTMP_ADAPTER pAd); - -VOID MlmeDynamicTxRateSwitching( - IN PRTMP_ADAPTER pAd); - -VOID MlmeSetTxRate( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PRTMP_TX_RATE_SWITCH pTxRate); - -VOID MlmeSelectTxRateTable( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR *ppTable, - IN PUCHAR pTableSize, - IN PUCHAR pInitTxRateIdx); - -VOID MlmeCalculateChannelQuality( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pMacEntry, - IN ULONG Now); - -VOID MlmeCheckPsmChange( - IN PRTMP_ADAPTER pAd, - IN ULONG Now32); - -VOID MlmeSetPsmBit( - IN PRTMP_ADAPTER pAd, - IN USHORT psm); - -VOID MlmeSetTxPreamble( - IN PRTMP_ADAPTER pAd, - IN USHORT TxPreamble); - -VOID UpdateBasicRateBitmap( - IN PRTMP_ADAPTER pAd); - -VOID MlmeUpdateTxRates( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bLinkUp, - IN UCHAR apidx); - -VOID MlmeUpdateHtTxRates( - IN PRTMP_ADAPTER pAd, - IN UCHAR apidx); - -VOID RTMPCheckRates( - IN PRTMP_ADAPTER pAd, - IN OUT UCHAR SupRate[], - IN OUT UCHAR *SupRateLen); - -BOOLEAN RTMPCheckChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR CentralChannel, - IN UCHAR Channel); - -BOOLEAN RTMPCheckHt( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN OUT HT_CAPABILITY_IE *pHtCapability, - IN OUT ADD_HT_INFO_IE *pAddHtInfo); - -VOID StaQuickResponeForRateUpExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID RTMPUpdateMlmeRate( - IN PRTMP_ADAPTER pAd); - -CHAR RTMPMaxRssi( - IN PRTMP_ADAPTER pAd, - IN CHAR Rssi0, - IN CHAR Rssi1, - IN CHAR Rssi2); +VOID MlmeCntlInit(IN PRTMP_ADAPTER pAd, + IN STATE_MACHINE * S, OUT STATE_MACHINE_FUNC Trans[]); + +VOID MlmeCntlMachinePerformAction(IN PRTMP_ADAPTER pAd, + IN STATE_MACHINE * S, + IN MLME_QUEUE_ELEM * Elem); + +VOID CntlIdleProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID CntlOidScanProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID CntlMlmeRoamingProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID CntlWaitDisassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID CntlWaitJoinProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID CntlWaitReassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID CntlWaitStartProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID CntlWaitAuthProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID CntlWaitAuthProc2(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID CntlWaitAssocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType); + +VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP); + +VOID IterateOnBssTab(IN PRTMP_ADAPTER pAd); + +VOID IterateOnBssTab2(IN PRTMP_ADAPTER pAd);; + +VOID JoinParmFill(IN PRTMP_ADAPTER pAd, + IN OUT MLME_JOIN_REQ_STRUCT * JoinReq, IN ULONG BssIdx); + +VOID AssocParmFill(IN PRTMP_ADAPTER pAd, + IN OUT MLME_ASSOC_REQ_STRUCT * AssocReq, + IN PUCHAR pAddr, + IN USHORT CapabilityInfo, + IN ULONG Timeout, IN USHORT ListenIntv); + +VOID ScanParmFill(IN PRTMP_ADAPTER pAd, + IN OUT MLME_SCAN_REQ_STRUCT * ScanReq, + IN STRING Ssid[], + IN UCHAR SsidLen, IN UCHAR BssType, IN UCHAR ScanType); + +VOID DisassocParmFill(IN PRTMP_ADAPTER pAd, + IN OUT MLME_DISASSOC_REQ_STRUCT * DisassocReq, + IN PUCHAR pAddr, IN USHORT Reason); + +VOID StartParmFill(IN PRTMP_ADAPTER pAd, + IN OUT MLME_START_REQ_STRUCT * StartReq, + IN CHAR Ssid[], IN UCHAR SsidLen); + +VOID AuthParmFill(IN PRTMP_ADAPTER pAd, + IN OUT MLME_AUTH_REQ_STRUCT * AuthReq, + IN PUCHAR pAddr, IN USHORT Alg); + +VOID EnqueuePsPoll(IN PRTMP_ADAPTER pAd); + +VOID EnqueueBeaconFrame(IN PRTMP_ADAPTER pAd); + +VOID MlmeJoinReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID MlmeScanReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID MlmeStartReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID ScanTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID BeaconTimeoutAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID PeerBeaconAtScanAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID PeerProbeReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +VOID ScanNextChannel(IN PRTMP_ADAPTER pAd); + +ULONG MakeIbssBeacon(IN PRTMP_ADAPTER pAd); + +BOOLEAN MlmeScanReqSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, + IN ULONG MsgLen, + OUT UCHAR * BssType, + OUT CHAR ssid[], + OUT UCHAR * SsidLen, OUT UCHAR * ScanType); + +BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, + IN ULONG MsgLen, + IN UCHAR MsgChannel, + OUT PUCHAR pAddr2, + OUT PUCHAR pBssid, + OUT CHAR Ssid[], + OUT UCHAR * pSsidLen, + OUT UCHAR * pBssType, + OUT USHORT * pBeaconPeriod, + OUT UCHAR * pChannel, + OUT UCHAR * pNewChannel, + OUT LARGE_INTEGER * pTimestamp, + OUT CF_PARM * pCfParm, + OUT USHORT * pAtimWin, + OUT USHORT * pCapabilityInfo, + OUT UCHAR * pErp, + OUT UCHAR * pDtimCount, + OUT UCHAR * pDtimPeriod, + OUT UCHAR * pBcastFlag, + OUT UCHAR * pMessageToMe, + OUT UCHAR SupRate[], + OUT UCHAR * pSupRateLen, + OUT UCHAR ExtRate[], + OUT UCHAR * pExtRateLen, + OUT UCHAR * pCkipFlag, + OUT UCHAR * pAironetCellPowerLimit, + OUT PEDCA_PARM pEdcaParm, + OUT PQBSS_LOAD_PARM pQbssLoad, + OUT PQOS_CAPABILITY_PARM pQosCapability, + OUT ULONG * pRalinkIe, + OUT UCHAR * pHtCapabilityLen, + OUT UCHAR * pPreNHtCapabilityLen, + OUT HT_CAPABILITY_IE * pHtCapability, + OUT UCHAR * AddHtInfoLen, + OUT ADD_HT_INFO_IE * AddHtInfo, + OUT UCHAR * NewExtChannel, + OUT USHORT * LengthVIE, + OUT PNDIS_802_11_VARIABLE_IEs pVIE); + +BOOLEAN PeerAddBAReqActionSanity(IN PRTMP_ADAPTER pAd, + IN VOID * pMsg, + IN ULONG MsgLen, OUT PUCHAR pAddr2); + +BOOLEAN PeerAddBARspActionSanity(IN PRTMP_ADAPTER pAd, + IN VOID * pMsg, IN ULONG MsgLen); + +BOOLEAN PeerDelBAActionSanity(IN PRTMP_ADAPTER pAd, + IN UCHAR Wcid, IN VOID * pMsg, IN ULONG MsgLen); + +BOOLEAN MlmeAssocReqSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, + IN ULONG MsgLen, + OUT PUCHAR pApAddr, + OUT USHORT * CapabilityInfo, + OUT ULONG * Timeout, OUT USHORT * ListenIntv); + +BOOLEAN MlmeAuthReqSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, + IN ULONG MsgLen, + OUT PUCHAR pAddr, + OUT ULONG * Timeout, OUT USHORT * Alg); + +BOOLEAN MlmeStartReqSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, + IN ULONG MsgLen, + OUT CHAR Ssid[], OUT UCHAR * Ssidlen); + +BOOLEAN PeerAuthSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, + IN ULONG MsgLen, + OUT PUCHAR pAddr, + OUT USHORT * Alg, + OUT USHORT * Seq, + OUT USHORT * Status, OUT CHAR ChlgText[]); + +BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen, OUT PUCHAR pAddr2, OUT USHORT * pCapabilityInfo, OUT USHORT * pStatus, OUT USHORT * pAid, OUT UCHAR SupRate[], OUT UCHAR * pSupRateLen, OUT UCHAR ExtRate[], OUT UCHAR * pExtRateLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT ADD_HT_INFO_IE * pAddHtInfo, // AP might use this additional ht info IE + OUT UCHAR * pHtCapabilityLen, + OUT UCHAR * pAddHtInfoLen, + OUT UCHAR * pNewExtChannelOffset, + OUT PEDCA_PARM pEdcaParm, OUT UCHAR * pCkipFlag); + +BOOLEAN PeerDisassocSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, + IN ULONG MsgLen, + OUT PUCHAR pAddr2, OUT USHORT * Reason); + +BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, + IN PEAPOL_PACKET pMsg, + IN ULONG MsgLen, + IN UCHAR MsgType, IN MAC_TABLE_ENTRY * pEntry); + +BOOLEAN PeerDeauthSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, + IN ULONG MsgLen, + OUT PUCHAR pAddr2, OUT USHORT * Reason); + +BOOLEAN PeerProbeReqSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, + IN ULONG MsgLen, + OUT PUCHAR pAddr2, + OUT CHAR Ssid[], OUT UCHAR * pSsidLen); + +BOOLEAN GetTimBit(IN CHAR * Ptr, + IN USHORT Aid, + OUT UCHAR * TimLen, + OUT UCHAR * BcastFlag, + OUT UCHAR * DtimCount, + OUT UCHAR * DtimPeriod, OUT UCHAR * MessageToMe); + +UCHAR ChannelSanity(IN PRTMP_ADAPTER pAd, IN UCHAR channel); + +NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity(IN PBSS_ENTRY pBss); + +BOOLEAN MlmeDelBAReqSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, IN ULONG MsgLen); + +BOOLEAN MlmeAddBAReqSanity(IN PRTMP_ADAPTER pAd, + IN VOID * Msg, IN ULONG MsgLen, OUT PUCHAR pAddr2); + +ULONG MakeOutgoingFrame(OUT UCHAR * Buffer, OUT ULONG * Length, ...); + +VOID LfsrInit(IN PRTMP_ADAPTER pAd, IN ULONG Seed); + +UCHAR RandomByte(IN PRTMP_ADAPTER pAd); + +VOID AsicUpdateAutoFallBackTable(IN PRTMP_ADAPTER pAd, IN PUCHAR pTxRate); + +VOID MlmePeriodicExec(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); + +VOID LinkDownExec(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); + +VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd); + +VOID MlmeAutoScan(IN PRTMP_ADAPTER pAd); + +VOID MlmeAutoReconnectLastSSID(IN PRTMP_ADAPTER pAd); + +BOOLEAN MlmeValidateSSID(IN PUCHAR pSsid, IN UCHAR SsidLen); + +VOID MlmeCheckForRoaming(IN PRTMP_ADAPTER pAd, IN ULONG Now32); + +BOOLEAN MlmeCheckForFastRoaming(IN PRTMP_ADAPTER pAd); + +VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd); + +VOID MlmeSetTxRate(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, IN PRTMP_TX_RATE_SWITCH pTxRate); + +VOID MlmeSelectTxRateTable(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, + IN PUCHAR * ppTable, + IN PUCHAR pTableSize, IN PUCHAR pInitTxRateIdx); + +VOID MlmeCalculateChannelQuality(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pMacEntry, IN ULONG Now); + +VOID MlmeCheckPsmChange(IN PRTMP_ADAPTER pAd, IN ULONG Now32); + +VOID MlmeSetPsmBit(IN PRTMP_ADAPTER pAd, IN USHORT psm); + +VOID MlmeSetTxPreamble(IN PRTMP_ADAPTER pAd, IN USHORT TxPreamble); + +VOID UpdateBasicRateBitmap(IN PRTMP_ADAPTER pAd); + +VOID MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, + IN BOOLEAN bLinkUp, IN UCHAR apidx); + +VOID MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, IN UCHAR apidx); + +VOID RTMPCheckRates(IN PRTMP_ADAPTER pAd, + IN OUT UCHAR SupRate[], IN OUT UCHAR * SupRateLen); + +BOOLEAN RTMPCheckChannel(IN PRTMP_ADAPTER pAd, + IN UCHAR CentralChannel, IN UCHAR Channel); + +BOOLEAN RTMPCheckHt(IN PRTMP_ADAPTER pAd, + IN UCHAR Wcid, + IN OUT HT_CAPABILITY_IE * pHtCapability, + IN OUT ADD_HT_INFO_IE * pAddHtInfo); + +VOID StaQuickResponeForRateUpExec(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3); + +VOID RTMPUpdateMlmeRate(IN PRTMP_ADAPTER pAd); + +CHAR RTMPMaxRssi(IN PRTMP_ADAPTER pAd, + IN CHAR Rssi0, IN CHAR Rssi1, IN CHAR Rssi2); #ifdef RT30xx -VOID AsicSetRxAnt( - IN PRTMP_ADAPTER pAd, - IN UCHAR Ant); +VOID AsicSetRxAnt(IN PRTMP_ADAPTER pAd, IN UCHAR Ant); -VOID RTMPFilterCalibration( - IN PRTMP_ADAPTER pAd); +VOID RTMPFilterCalibration(IN PRTMP_ADAPTER pAd); #ifdef RTMP_EFUSE_SUPPORT //2008/09/11:KH add to support efuse<-- -INT set_eFuseGetFreeBlockCount_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); +INT set_eFuseGetFreeBlockCount_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg); -INT set_eFusedump_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); +INT set_eFusedump_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg); -VOID eFusePhysicalReadRegisters( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, - OUT USHORT* pData); +VOID eFusePhysicalReadRegisters(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN USHORT Length, OUT USHORT * pData); -int RtmpEfuseSupportCheck( - IN RTMP_ADAPTER *pAd); +int RtmpEfuseSupportCheck(IN RTMP_ADAPTER * pAd); -VOID eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, - PUINT EfuseFreeBlock); +VOID eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, PUINT EfuseFreeBlock); -INT eFuse_init( - IN PRTMP_ADAPTER pAd); +INT eFuse_init(IN PRTMP_ADAPTER pAd); //2008/09/11:KH add to support efuse--> #endif // RTMP_EFUSE_SUPPORT // // add by johnli, RF power sequence setup -VOID RT30xxLoadRFNormalModeSetup( - IN PRTMP_ADAPTER pAd); +VOID RT30xxLoadRFNormalModeSetup(IN PRTMP_ADAPTER pAd); -VOID RT30xxLoadRFSleepModeSetup( - IN PRTMP_ADAPTER pAd); +VOID RT30xxLoadRFSleepModeSetup(IN PRTMP_ADAPTER pAd); -VOID RT30xxReverseRFSleepModeSetup( - IN PRTMP_ADAPTER pAd); +VOID RT30xxReverseRFSleepModeSetup(IN PRTMP_ADAPTER pAd); // end johnli #ifdef RT3070 -VOID NICInitRT3070RFRegisters( - IN RTMP_ADAPTER *pAd); +VOID NICInitRT3070RFRegisters(IN RTMP_ADAPTER * pAd); #endif // RT3070 // #ifdef RT3090 -VOID NICInitRT3090RFRegisters( - IN RTMP_ADAPTER *pAd); +VOID NICInitRT3090RFRegisters(IN RTMP_ADAPTER * pAd); #endif // RT3090 // -VOID RT30xxHaltAction( - IN PRTMP_ADAPTER pAd); +VOID RT30xxHaltAction(IN PRTMP_ADAPTER pAd); -VOID RT30xxSetRxAnt( - IN PRTMP_ADAPTER pAd, - IN UCHAR Ant); +VOID RT30xxSetRxAnt(IN PRTMP_ADAPTER pAd, IN UCHAR Ant); #endif // RT30xx // -VOID AsicEvaluateRxAnt( - IN PRTMP_ADAPTER pAd); +VOID AsicEvaluateRxAnt(IN PRTMP_ADAPTER pAd); -VOID AsicRxAntEvalTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); +VOID AsicRxAntEvalTimeout(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); -VOID APSDPeriodicExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); +VOID APSDPeriodicExec(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); -BOOLEAN RTMPCheckEntryEnableAutoRateSwitch( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry); +BOOLEAN RTMPCheckEntryEnableAutoRateSwitch(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry); -UCHAR RTMPStaFixedTxMode( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry); +UCHAR RTMPStaFixedTxMode(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry); -VOID RTMPUpdateLegacyTxSetting( - UCHAR fixed_tx_mode, - PMAC_TABLE_ENTRY pEntry); +VOID RTMPUpdateLegacyTxSetting(UCHAR fixed_tx_mode, PMAC_TABLE_ENTRY pEntry); -BOOLEAN RTMPAutoRateSwitchCheck( - IN PRTMP_ADAPTER pAd); +BOOLEAN RTMPAutoRateSwitchCheck(IN PRTMP_ADAPTER pAd); -NDIS_STATUS MlmeInit( - IN PRTMP_ADAPTER pAd); +NDIS_STATUS MlmeInit(IN PRTMP_ADAPTER pAd); -VOID MlmeHandler( - IN PRTMP_ADAPTER pAd); +VOID MlmeHandler(IN PRTMP_ADAPTER pAd); -VOID MlmeHalt( - IN PRTMP_ADAPTER pAd); +VOID MlmeHalt(IN PRTMP_ADAPTER pAd); -VOID MlmeResetRalinkCounters( - IN PRTMP_ADAPTER pAd); +VOID MlmeResetRalinkCounters(IN PRTMP_ADAPTER pAd); -VOID BuildChannelList( - IN PRTMP_ADAPTER pAd); +VOID BuildChannelList(IN PRTMP_ADAPTER pAd); -UCHAR FirstChannel( - IN PRTMP_ADAPTER pAd); +UCHAR FirstChannel(IN PRTMP_ADAPTER pAd); -UCHAR NextChannel( - IN PRTMP_ADAPTER pAd, - IN UCHAR channel); +UCHAR NextChannel(IN PRTMP_ADAPTER pAd, IN UCHAR channel); -VOID ChangeToCellPowerLimit( - IN PRTMP_ADAPTER pAd, - IN UCHAR AironetCellPowerLimit); +VOID ChangeToCellPowerLimit(IN PRTMP_ADAPTER pAd, + IN UCHAR AironetCellPowerLimit); // // Prototypes of function definition in rtmp_tkip.c // -VOID RTMPInitTkipEngine( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pTKey, - IN UCHAR KeyId, - IN PUCHAR pTA, - IN PUCHAR pMICKey, - IN PUCHAR pTSC, - OUT PULONG pIV16, - OUT PULONG pIV32); - -VOID RTMPInitMICEngine( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKey, - IN PUCHAR pDA, - IN PUCHAR pSA, - IN UCHAR UserPriority, - IN PUCHAR pMICKey); - -BOOLEAN RTMPTkipCompareMICValue( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pSrc, - IN PUCHAR pDA, - IN PUCHAR pSA, - IN PUCHAR pMICKey, - IN UCHAR UserPriority, - IN UINT Len); - -VOID RTMPCalculateMICValue( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN PUCHAR pEncap, - IN PCIPHER_KEY pKey, - IN UCHAR apidx); - -VOID RTMPTkipAppendByte( - IN PTKIP_KEY_INFO pTkip, - IN UCHAR uChar); - -VOID RTMPTkipAppend( - IN PTKIP_KEY_INFO pTkip, - IN PUCHAR pSrc, - IN UINT nBytes); - -VOID RTMPTkipGetMIC( - IN PTKIP_KEY_INFO pTkip); - -BOOLEAN RTMPSoftDecryptTKIP( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, - IN UCHAR UserPriority, - IN PCIPHER_KEY pWpaKey); - -BOOLEAN RTMPSoftDecryptAES( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, - IN PCIPHER_KEY pWpaKey); +VOID RTMPInitTkipEngine(IN PRTMP_ADAPTER pAd, + IN PUCHAR pTKey, + IN UCHAR KeyId, + IN PUCHAR pTA, + IN PUCHAR pMICKey, + IN PUCHAR pTSC, OUT PULONG pIV16, OUT PULONG pIV32); + +VOID RTMPInitMICEngine(IN PRTMP_ADAPTER pAd, + IN PUCHAR pKey, + IN PUCHAR pDA, + IN PUCHAR pSA, IN UCHAR UserPriority, IN PUCHAR pMICKey); + +BOOLEAN RTMPTkipCompareMICValue(IN PRTMP_ADAPTER pAd, + IN PUCHAR pSrc, + IN PUCHAR pDA, + IN PUCHAR pSA, + IN PUCHAR pMICKey, + IN UCHAR UserPriority, IN UINT Len); + +VOID RTMPCalculateMICValue(IN PRTMP_ADAPTER pAd, + IN PNDIS_PACKET pPacket, + IN PUCHAR pEncap, + IN PCIPHER_KEY pKey, IN UCHAR apidx); + +VOID RTMPTkipAppendByte(IN PTKIP_KEY_INFO pTkip, IN UCHAR uChar); + +VOID RTMPTkipAppend(IN PTKIP_KEY_INFO pTkip, IN PUCHAR pSrc, IN UINT nBytes); + +VOID RTMPTkipGetMIC(IN PTKIP_KEY_INFO pTkip); +BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd, + IN PUCHAR pData, + IN ULONG DataByteCnt, + IN UCHAR UserPriority, IN PCIPHER_KEY pWpaKey); +BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, + IN PUCHAR pData, + IN ULONG DataByteCnt, IN PCIPHER_KEY pWpaKey); // // Prototypes of function definition in cmm_info.c // -INT RT_CfgSetCountryRegion( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg, - IN INT band); +INT RT_CfgSetCountryRegion(IN PRTMP_ADAPTER pAd, IN PSTRING arg, IN INT band); -INT RT_CfgSetWirelessMode( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); +INT RT_CfgSetWirelessMode(IN PRTMP_ADAPTER pAd, IN PSTRING arg); -INT RT_CfgSetShortSlot( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT RT_CfgSetWepKey( - IN PRTMP_ADAPTER pAd, - IN PSTRING keyString, - IN CIPHER_KEY *pSharedKey, - IN INT keyIdx); - -INT RT_CfgSetWPAPSKKey( - IN RTMP_ADAPTER *pAd, - IN PSTRING keyString, - IN UCHAR *pHashStr, - IN INT hashStrLen, - OUT PUCHAR pPMKBuf); +INT RT_CfgSetShortSlot(IN PRTMP_ADAPTER pAd, IN PSTRING arg); +INT RT_CfgSetWepKey(IN PRTMP_ADAPTER pAd, + IN PSTRING keyString, + IN CIPHER_KEY * pSharedKey, IN INT keyIdx); +INT RT_CfgSetWPAPSKKey(IN RTMP_ADAPTER * pAd, + IN PSTRING keyString, + IN UCHAR * pHashStr, + IN INT hashStrLen, OUT PUCHAR pPMKBuf); // // Prototypes of function definition in cmm_info.c // -VOID RTMPWPARemoveAllKeys( - IN PRTMP_ADAPTER pAd); - -VOID RTMPSetPhyMode( - IN PRTMP_ADAPTER pAd, - IN ULONG phymode); - -VOID RTMPUpdateHTIE( - IN RT_HT_CAPABILITY *pRtHt, - IN UCHAR *pMcsSet, - OUT HT_CAPABILITY_IE *pHtCapability, - OUT ADD_HT_INFO_IE *pAddHtInfo); - -VOID RTMPAddWcidAttributeEntry( - IN PRTMP_ADAPTER pAd, - IN UCHAR BssIdx, - IN UCHAR KeyIdx, - IN UCHAR CipherAlg, - IN MAC_TABLE_ENTRY *pEntry); - -PSTRING GetEncryptType( - CHAR enc); - -PSTRING GetAuthMode( - CHAR auth); - -VOID RTMPSetHT( - IN PRTMP_ADAPTER pAd, - IN OID_SET_HT_PHYMODE *pHTPhyMode); - -VOID RTMPSetIndividualHT( - IN PRTMP_ADAPTER pAd, - IN UCHAR apidx); - -VOID RTMPSendWirelessEvent( - IN PRTMP_ADAPTER pAd, - IN USHORT Event_flag, - IN PUCHAR pAddr, - IN UCHAR BssIdx, - IN CHAR Rssi); - -CHAR ConvertToRssi( - IN PRTMP_ADAPTER pAd, - IN CHAR Rssi, - IN UCHAR RssiNumber); +VOID RTMPWPARemoveAllKeys(IN PRTMP_ADAPTER pAd); + +VOID RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, IN ULONG phymode); + +VOID RTMPUpdateHTIE(IN RT_HT_CAPABILITY * pRtHt, + IN UCHAR * pMcsSet, + OUT HT_CAPABILITY_IE * pHtCapability, + OUT ADD_HT_INFO_IE * pAddHtInfo); + +VOID RTMPAddWcidAttributeEntry(IN PRTMP_ADAPTER pAd, + IN UCHAR BssIdx, + IN UCHAR KeyIdx, + IN UCHAR CipherAlg, IN MAC_TABLE_ENTRY * pEntry); + +PSTRING GetEncryptType(CHAR enc); + +PSTRING GetAuthMode(CHAR auth); + +VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode); + +VOID RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, IN UCHAR apidx); + +VOID RTMPSendWirelessEvent(IN PRTMP_ADAPTER pAd, + IN USHORT Event_flag, + IN PUCHAR pAddr, IN UCHAR BssIdx, IN CHAR Rssi); + +CHAR ConvertToRssi(IN PRTMP_ADAPTER pAd, IN CHAR Rssi, IN UCHAR RssiNumber); /*=================================== Function prototype in cmm_wpa.c =================================== */ -VOID RTMPToWirelessSta( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, - IN UINT DataLen, - IN BOOLEAN bClearFrame); - -VOID WpaDerivePTK( - IN PRTMP_ADAPTER pAd, - IN UCHAR *PMK, - IN UCHAR *ANonce, - IN UCHAR *AA, - IN UCHAR *SNonce, - IN UCHAR *SA, - OUT UCHAR *output, - IN UINT len); - -VOID GenRandom( - IN PRTMP_ADAPTER pAd, - IN UCHAR *macAddr, - OUT UCHAR *random); - -BOOLEAN RTMPCheckWPAframe( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR pData, - IN ULONG DataByteCount, - IN UCHAR FromWhichBSSID); - -VOID AES_GTK_KEY_UNWRAP( - IN UCHAR *key, - OUT UCHAR *plaintext, - IN UINT32 c_len, - IN UCHAR *ciphertext); - -BOOLEAN RTMPParseEapolKeyData( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pKeyData, - IN UCHAR KeyDataLen, - IN UCHAR GroupKeyIndex, - IN UCHAR MsgType, - IN BOOLEAN bWPA2, - IN MAC_TABLE_ENTRY *pEntry); - -VOID ConstructEapolMsg( - IN PMAC_TABLE_ENTRY pEntry, - IN UCHAR GroupKeyWepStatus, - IN UCHAR MsgType, - IN UCHAR DefaultKeyIdx, - IN UCHAR *KeyNonce, - IN UCHAR *TxRSC, - IN UCHAR *GTK, - IN UCHAR *RSNIE, - IN UCHAR RSNIE_Len, - OUT PEAPOL_PACKET pMsg); - -NDIS_STATUS RTMPSoftDecryptBroadCastData( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN NDIS_802_11_ENCRYPTION_STATUS GroupCipher, - IN PCIPHER_KEY pShard_key); - -VOID RTMPMakeRSNIE( - IN PRTMP_ADAPTER pAd, - IN UINT AuthMode, - IN UINT WepStatus, - IN UCHAR apidx); +VOID RTMPToWirelessSta(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, + IN PUCHAR pHeader802_3, + IN UINT HdrLen, + IN PUCHAR pData, + IN UINT DataLen, IN BOOLEAN bClearFrame); + +VOID WpaDerivePTK(IN PRTMP_ADAPTER pAd, + IN UCHAR * PMK, + IN UCHAR * ANonce, + IN UCHAR * AA, + IN UCHAR * SNonce, + IN UCHAR * SA, OUT UCHAR * output, IN UINT len); + +VOID GenRandom(IN PRTMP_ADAPTER pAd, IN UCHAR * macAddr, OUT UCHAR * random); + +BOOLEAN RTMPCheckWPAframe(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, + IN PUCHAR pData, + IN ULONG DataByteCount, IN UCHAR FromWhichBSSID); + +VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key, + OUT UCHAR * plaintext, + IN UINT32 c_len, IN UCHAR * ciphertext); + +BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, + IN PUCHAR pKeyData, + IN UCHAR KeyDataLen, + IN UCHAR GroupKeyIndex, + IN UCHAR MsgType, + IN BOOLEAN bWPA2, IN MAC_TABLE_ENTRY * pEntry); + +VOID ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, + IN UCHAR GroupKeyWepStatus, + IN UCHAR MsgType, + IN UCHAR DefaultKeyIdx, + IN UCHAR * KeyNonce, + IN UCHAR * TxRSC, + IN UCHAR * GTK, + IN UCHAR * RSNIE, + IN UCHAR RSNIE_Len, OUT PEAPOL_PACKET pMsg); + +NDIS_STATUS RTMPSoftDecryptBroadCastData(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, + IN NDIS_802_11_ENCRYPTION_STATUS + GroupCipher, + IN PCIPHER_KEY pShard_key); + +VOID RTMPMakeRSNIE(IN PRTMP_ADAPTER pAd, + IN UINT AuthMode, IN UINT WepStatus, IN UCHAR apidx); // // function prototype in ap_wpa.c // -VOID RTMPGetTxTscFromAsic( - IN PRTMP_ADAPTER pAd, - IN UCHAR apidx, - OUT PUCHAR pTxTsc); - -VOID APInstallPairwiseKey( - PRTMP_ADAPTER pAd, - PMAC_TABLE_ENTRY pEntry); - -UINT APValidateRSNIE( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR pRsnIe, - IN UCHAR rsnie_len); - -VOID HandleCounterMeasure( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry); - -VOID WPAStart4WayHS( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN ULONG TimeInterval); - -VOID WPAStart2WayGroupHS( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry); - -VOID PeerPairMsg1Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerPairMsg2Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerPairMsg3Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerPairMsg4Action( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerGroupMsg1Action( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerGroupMsg2Action( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN VOID *Msg, - IN UINT MsgLen); - -VOID WpaDeriveGTK( - IN UCHAR *PMK, - IN UCHAR *GNonce, - IN UCHAR *AA, - OUT UCHAR *output, - IN UINT len); - -VOID AES_GTK_KEY_WRAP( - IN UCHAR *key, - IN UCHAR *plaintext, - IN UINT32 p_len, - OUT UCHAR *ciphertext); +VOID RTMPGetTxTscFromAsic(IN PRTMP_ADAPTER pAd, + IN UCHAR apidx, OUT PUCHAR pTxTsc); -//typedef void (*TIMER_FUNCTION)(unsigned long); +VOID APInstallPairwiseKey(PRTMP_ADAPTER pAd, PMAC_TABLE_ENTRY pEntry); + +UINT APValidateRSNIE(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, + IN PUCHAR pRsnIe, IN UCHAR rsnie_len); + +VOID HandleCounterMeasure(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry); + +VOID WPAStart4WayHS(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, IN ULONG TimeInterval); +VOID WPAStart2WayGroupHS(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry); + +VOID PeerPairMsg1Action(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem); + +VOID PeerPairMsg2Action(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem); + +VOID PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem); + +VOID PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem); + +VOID PeerGroupMsg1Action(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, IN MLME_QUEUE_ELEM * Elem); + +VOID PeerGroupMsg2Action(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, + IN VOID * Msg, IN UINT MsgLen); + +VOID WpaDeriveGTK(IN UCHAR * PMK, + IN UCHAR * GNonce, + IN UCHAR * AA, OUT UCHAR * output, IN UINT len); + +VOID AES_GTK_KEY_WRAP(IN UCHAR * key, + IN UCHAR * plaintext, + IN UINT32 p_len, OUT UCHAR * ciphertext); + +//typedef void (*TIMER_FUNCTION)(unsigned long); /* timeout -- ms */ -VOID RTMP_SetPeriodicTimer( - IN NDIS_MINIPORT_TIMER *pTimer, - IN unsigned long timeout); - -VOID RTMP_OS_Init_Timer( - IN PRTMP_ADAPTER pAd, - IN NDIS_MINIPORT_TIMER *pTimer, - IN TIMER_FUNCTION function, - IN PVOID data); - -VOID RTMP_OS_Add_Timer( - IN NDIS_MINIPORT_TIMER *pTimer, - IN unsigned long timeout); - -VOID RTMP_OS_Mod_Timer( - IN NDIS_MINIPORT_TIMER *pTimer, - IN unsigned long timeout); - - -VOID RTMP_OS_Del_Timer( - IN NDIS_MINIPORT_TIMER *pTimer, - OUT BOOLEAN *pCancelled); - - -VOID RTMP_OS_Release_Packet( - IN PRTMP_ADAPTER pAd, - IN PQUEUE_ENTRY pEntry); - -VOID RTMPusecDelay( - IN ULONG usec); - -NDIS_STATUS os_alloc_mem( - IN RTMP_ADAPTER *pAd, - OUT UCHAR **mem, - IN ULONG size); - -NDIS_STATUS os_free_mem( - IN PRTMP_ADAPTER pAd, - IN PVOID mem); - - -void RTMP_AllocateSharedMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); - -VOID RTMPFreeTxRxRingMemory( - IN PRTMP_ADAPTER pAd); - -NDIS_STATUS AdapterBlockAllocateMemory( - IN PVOID handle, - OUT PVOID *ppAd); - -void RTMP_AllocateTxDescMemory( - IN PRTMP_ADAPTER pAd, - IN UINT Index, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); - -void RTMP_AllocateFirstTxBuffer( - IN PRTMP_ADAPTER pAd, - IN UINT Index, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); - -void RTMP_FreeFirstTxBuffer( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - IN PVOID VirtualAddress, - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); - -void RTMP_AllocateMgmtDescMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); - -void RTMP_AllocateRxDescMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); - -void RTMP_FreeDescMemory( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN PVOID VirtualAddress, - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); - -PNDIS_PACKET RtmpOSNetPktAlloc( - IN RTMP_ADAPTER *pAd, - IN int size); - -PNDIS_PACKET RTMP_AllocateRxPacketBuffer( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); - -PNDIS_PACKET RTMP_AllocateTxPacketBuffer( - IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN BOOLEAN Cached, - OUT PVOID *VirtualAddress); - -PNDIS_PACKET RTMP_AllocateFragPacketBuffer( - IN PRTMP_ADAPTER pAd, - IN ULONG Length); - -void RTMP_QueryPacketInfo( - IN PNDIS_PACKET pPacket, - OUT PACKET_INFO *pPacketInfo, - OUT PUCHAR *pSrcBufVA, - OUT UINT *pSrcBufLen); - -void RTMP_QueryNextPacketInfo( - IN PNDIS_PACKET *ppPacket, - OUT PACKET_INFO *pPacketInfo, - OUT PUCHAR *pSrcBufVA, - OUT UINT *pSrcBufLen); - - -BOOLEAN RTMP_FillTxBlkInfo( - IN RTMP_ADAPTER *pAd, - IN TX_BLK *pTxBlk); +VOID RTMP_SetPeriodicTimer(IN NDIS_MINIPORT_TIMER * pTimer, + IN unsigned long timeout); +VOID RTMP_OS_Init_Timer(IN PRTMP_ADAPTER pAd, + IN NDIS_MINIPORT_TIMER * pTimer, + IN TIMER_FUNCTION function, IN PVOID data); -PRTMP_SCATTER_GATHER_LIST -rt_get_sg_list_from_packet(PNDIS_PACKET pPacket, RTMP_SCATTER_GATHER_LIST *sg); +VOID RTMP_OS_Add_Timer(IN NDIS_MINIPORT_TIMER * pTimer, + IN unsigned long timeout); +VOID RTMP_OS_Mod_Timer(IN NDIS_MINIPORT_TIMER * pTimer, + IN unsigned long timeout); - void announce_802_3_packet( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket); +VOID RTMP_OS_Del_Timer(IN NDIS_MINIPORT_TIMER * pTimer, + OUT BOOLEAN * pCancelled); +VOID RTMP_OS_Release_Packet(IN PRTMP_ADAPTER pAd, IN PQUEUE_ENTRY pEntry); -UINT BA_Reorder_AMSDU_Annnounce( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket); +VOID RTMPusecDelay(IN ULONG usec); -PNET_DEV get_netdev_from_bssid( - IN PRTMP_ADAPTER pAd, - IN UCHAR FromWhichBSSID); +NDIS_STATUS os_alloc_mem(IN RTMP_ADAPTER * pAd, + OUT UCHAR ** mem, IN ULONG size); +NDIS_STATUS os_free_mem(IN PRTMP_ADAPTER pAd, IN PVOID mem); -PNDIS_PACKET duplicate_pkt( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, - IN ULONG DataSize, - IN UCHAR FromWhichBSSID); +void RTMP_AllocateSharedMemory(IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID * VirtualAddress, + OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); +VOID RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd); -PNDIS_PACKET duplicate_pkt_with_TKIP_MIC( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pOldPkt); +NDIS_STATUS AdapterBlockAllocateMemory(IN PVOID handle, OUT PVOID * ppAd); -void ba_flush_reordering_timeout_mpdus( - IN PRTMP_ADAPTER pAd, - IN PBA_REC_ENTRY pBAEntry, - IN ULONG Now32); +void RTMP_AllocateTxDescMemory(IN PRTMP_ADAPTER pAd, + IN UINT Index, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID * VirtualAddress, + OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); +void RTMP_AllocateFirstTxBuffer(IN PRTMP_ADAPTER pAd, + IN UINT Index, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID * VirtualAddress, + OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); -VOID BAOriSessionSetUp( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN UCHAR TID, - IN USHORT TimeOut, - IN ULONG DelayTime, - IN BOOLEAN isForced); +void RTMP_FreeFirstTxBuffer(IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN BOOLEAN Cached, + IN PVOID VirtualAddress, + IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); -VOID BASessionTearDownALL( - IN OUT PRTMP_ADAPTER pAd, - IN UCHAR Wcid); +void RTMP_AllocateMgmtDescMemory(IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID * VirtualAddress, + OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); -BOOLEAN OS_Need_Clone_Packet(void); +void RTMP_AllocateRxDescMemory(IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID * VirtualAddress, + OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); + +void RTMP_FreeDescMemory(IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN PVOID VirtualAddress, + IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); + +PNDIS_PACKET RtmpOSNetPktAlloc(IN RTMP_ADAPTER * pAd, IN int size); + +PNDIS_PACKET RTMP_AllocateRxPacketBuffer(IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID * VirtualAddress, + OUT PNDIS_PHYSICAL_ADDRESS + PhysicalAddress); +PNDIS_PACKET RTMP_AllocateTxPacketBuffer(IN PRTMP_ADAPTER pAd, + IN ULONG Length, + IN BOOLEAN Cached, + OUT PVOID * VirtualAddress); -VOID build_tx_packet( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN PUCHAR pFrame, - IN ULONG FrameLen); +PNDIS_PACKET RTMP_AllocateFragPacketBuffer(IN PRTMP_ADAPTER pAd, + IN ULONG Length); + +void RTMP_QueryPacketInfo(IN PNDIS_PACKET pPacket, + OUT PACKET_INFO * pPacketInfo, + OUT PUCHAR * pSrcBufVA, OUT UINT * pSrcBufLen); + +void RTMP_QueryNextPacketInfo(IN PNDIS_PACKET * ppPacket, + OUT PACKET_INFO * pPacketInfo, + OUT PUCHAR * pSrcBufVA, OUT UINT * pSrcBufLen); + +BOOLEAN RTMP_FillTxBlkInfo(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk); + +PRTMP_SCATTER_GATHER_LIST +rt_get_sg_list_from_packet(PNDIS_PACKET pPacket, RTMP_SCATTER_GATHER_LIST * sg); + +void announce_802_3_packet(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); + +UINT BA_Reorder_AMSDU_Annnounce(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); + +PNET_DEV get_netdev_from_bssid(IN PRTMP_ADAPTER pAd, IN UCHAR FromWhichBSSID); + +PNDIS_PACKET duplicate_pkt(IN PRTMP_ADAPTER pAd, + IN PUCHAR pHeader802_3, + IN UINT HdrLen, + IN PUCHAR pData, + IN ULONG DataSize, IN UCHAR FromWhichBSSID); + +PNDIS_PACKET duplicate_pkt_with_TKIP_MIC(IN PRTMP_ADAPTER pAd, + IN PNDIS_PACKET pOldPkt); + +void ba_flush_reordering_timeout_mpdus(IN PRTMP_ADAPTER pAd, + IN PBA_REC_ENTRY pBAEntry, + IN ULONG Now32); + +VOID BAOriSessionSetUp(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, + IN UCHAR TID, + IN USHORT TimeOut, + IN ULONG DelayTime, IN BOOLEAN isForced); + +VOID BASessionTearDownALL(IN OUT PRTMP_ADAPTER pAd, IN UCHAR Wcid); + +BOOLEAN OS_Need_Clone_Packet(void); +VOID build_tx_packet(IN PRTMP_ADAPTER pAd, + IN PNDIS_PACKET pPacket, + IN PUCHAR pFrame, IN ULONG FrameLen); -VOID BAOriSessionTearDown( - IN OUT PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR TID, - IN BOOLEAN bPassive, - IN BOOLEAN bForceSend); +VOID BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd, + IN UCHAR Wcid, + IN UCHAR TID, + IN BOOLEAN bPassive, IN BOOLEAN bForceSend); -VOID BARecSessionTearDown( - IN OUT PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR TID, - IN BOOLEAN bPassive); +VOID BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd, + IN UCHAR Wcid, IN UCHAR TID, IN BOOLEAN bPassive); BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num); void ba_reordering_resource_release(PRTMP_ADAPTER pAd); -PSTRING rstrtok( - IN PSTRING s, - IN const PSTRING ct); +PSTRING rstrtok(IN PSTRING s, IN const PSTRING ct); ////////// common ioctl functions ////////// -INT SetCommonHT( - IN PRTMP_ADAPTER pAd); +INT SetCommonHT(IN PRTMP_ADAPTER pAd); -INT WpaCheckEapCode( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pFrame, - IN USHORT FrameLen, - IN USHORT OffSet); +INT WpaCheckEapCode(IN PRTMP_ADAPTER pAd, + IN PUCHAR pFrame, IN USHORT FrameLen, IN USHORT OffSet); -VOID WpaSendMicFailureToWpaSupplicant( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bUnicast); +VOID WpaSendMicFailureToWpaSupplicant(IN PRTMP_ADAPTER pAd, + IN BOOLEAN bUnicast); -int wext_notify_event_assoc( - IN RTMP_ADAPTER *pAd); +int wext_notify_event_assoc(IN RTMP_ADAPTER * pAd); -BOOLEAN STARxDoneInterruptHandle( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN argc); +BOOLEAN STARxDoneInterruptHandle(IN PRTMP_ADAPTER pAd, IN BOOLEAN argc); // AMPDU packet indication -VOID Indicate_AMPDU_Packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID); +VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); // AMSDU packet indication -VOID Indicate_AMSDU_Packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID); +VOID Indicate_AMSDU_Packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); // Normal legacy Rx packet indication -VOID Indicate_Legacy_Packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID); - -VOID Indicate_EAPOL_Packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID); - -void update_os_packet_info( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID); - -void wlan_802_11_to_802_3_packet( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN PUCHAR pHeader802_3, - IN UCHAR FromWhichBSSID); +VOID Indicate_Legacy_Packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); + +VOID Indicate_EAPOL_Packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); + +void update_os_packet_info(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); + +void wlan_802_11_to_802_3_packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, + IN PUCHAR pHeader802_3, + IN UCHAR FromWhichBSSID); // remove LLC and get 802_3 Header #define RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(_pRxBlk, _pHeader802_3) \ @@ -4694,138 +3742,122 @@ void wlan_802_11_to_802_3_packet( _pRxBlk->DataSize, _pRemovedLLCSNAP); \ } -VOID Sta_Announce_or_Forward_802_3_Packet( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN UCHAR FromWhichBSSID); +VOID Sta_Announce_or_Forward_802_3_Packet(IN PRTMP_ADAPTER pAd, + IN PNDIS_PACKET pPacket, + IN UCHAR FromWhichBSSID); #define ANNOUNCE_OR_FORWARD_802_3_PACKET(_pAd, _pPacket, _FromWhichBSS)\ Sta_Announce_or_Forward_802_3_Packet(_pAd, _pPacket, _FromWhichBSS); //announce_802_3_packet(_pAd, _pPacket); -PNDIS_PACKET DuplicatePacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN UCHAR FromWhichBSSID); +PNDIS_PACKET DuplicatePacket(IN PRTMP_ADAPTER pAd, + IN PNDIS_PACKET pPacket, IN UCHAR FromWhichBSSID); + +PNDIS_PACKET ClonePacket(IN PRTMP_ADAPTER pAd, + IN PNDIS_PACKET pPacket, + IN PUCHAR pData, IN ULONG DataSize); +// Normal, AMPDU or AMSDU +VOID CmmRxnonRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); -PNDIS_PACKET ClonePacket( - IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, - IN PUCHAR pData, - IN ULONG DataSize); +VOID CmmRxRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, + IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); +VOID Update_Rssi_Sample(IN PRTMP_ADAPTER pAd, + IN RSSI_SAMPLE * pRssi, IN PRXWI_STRUC pRxWI); -// Normal, AMPDU or AMSDU -VOID CmmRxnonRalinkFrameIndicate( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID); - -VOID CmmRxRalinkFrameIndicate( - IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY *pEntry, - IN RX_BLK *pRxBlk, - IN UCHAR FromWhichBSSID); - -VOID Update_Rssi_Sample( - IN PRTMP_ADAPTER pAd, - IN RSSI_SAMPLE *pRssi, - IN PRXWI_STRUC pRxWI); - -PNDIS_PACKET GetPacketFromRxRing( - IN PRTMP_ADAPTER pAd, - OUT PRT28XX_RXD_STRUC pSaveRxD, - OUT BOOLEAN *pbReschedule, - IN OUT UINT32 *pRxPending); - -PNDIS_PACKET RTMPDeFragmentDataFrame( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk); +PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, + OUT PRT28XX_RXD_STRUC pSaveRxD, + OUT BOOLEAN * pbReschedule, + IN OUT UINT32 * pRxPending); + +PNDIS_PACKET RTMPDeFragmentDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk); enum { - DIDmsg_lnxind_wlansniffrm = 0x00000044, - DIDmsg_lnxind_wlansniffrm_hosttime = 0x00010044, - DIDmsg_lnxind_wlansniffrm_mactime = 0x00020044, - DIDmsg_lnxind_wlansniffrm_channel = 0x00030044, - DIDmsg_lnxind_wlansniffrm_rssi = 0x00040044, - DIDmsg_lnxind_wlansniffrm_sq = 0x00050044, - DIDmsg_lnxind_wlansniffrm_signal = 0x00060044, - DIDmsg_lnxind_wlansniffrm_noise = 0x00070044, - DIDmsg_lnxind_wlansniffrm_rate = 0x00080044, - DIDmsg_lnxind_wlansniffrm_istx = 0x00090044, - DIDmsg_lnxind_wlansniffrm_frmlen = 0x000A0044 + DIDmsg_lnxind_wlansniffrm = 0x00000044, + DIDmsg_lnxind_wlansniffrm_hosttime = 0x00010044, + DIDmsg_lnxind_wlansniffrm_mactime = 0x00020044, + DIDmsg_lnxind_wlansniffrm_channel = 0x00030044, + DIDmsg_lnxind_wlansniffrm_rssi = 0x00040044, + DIDmsg_lnxind_wlansniffrm_sq = 0x00050044, + DIDmsg_lnxind_wlansniffrm_signal = 0x00060044, + DIDmsg_lnxind_wlansniffrm_noise = 0x00070044, + DIDmsg_lnxind_wlansniffrm_rate = 0x00080044, + DIDmsg_lnxind_wlansniffrm_istx = 0x00090044, + DIDmsg_lnxind_wlansniffrm_frmlen = 0x000A0044 }; enum { - P80211ENUM_msgitem_status_no_value = 0x00 + P80211ENUM_msgitem_status_no_value = 0x00 }; enum { - P80211ENUM_truth_false = 0x00, - P80211ENUM_truth_true = 0x01 + P80211ENUM_truth_false = 0x00, + P80211ENUM_truth_true = 0x01 }; /* Definition from madwifi */ typedef struct { - UINT32 did; - UINT16 status; - UINT16 len; - UINT32 data; + UINT32 did; + UINT16 status; + UINT16 len; + UINT32 data; } p80211item_uint32_t; typedef struct { - UINT32 msgcode; - UINT32 msglen; + UINT32 msgcode; + UINT32 msglen; #define WLAN_DEVNAMELEN_MAX 16 - UINT8 devname[WLAN_DEVNAMELEN_MAX]; - p80211item_uint32_t hosttime; - p80211item_uint32_t mactime; - p80211item_uint32_t channel; - p80211item_uint32_t rssi; - p80211item_uint32_t sq; - p80211item_uint32_t signal; - p80211item_uint32_t noise; - p80211item_uint32_t rate; - p80211item_uint32_t istx; - p80211item_uint32_t frmlen; + UINT8 devname[WLAN_DEVNAMELEN_MAX]; + p80211item_uint32_t hosttime; + p80211item_uint32_t mactime; + p80211item_uint32_t channel; + p80211item_uint32_t rssi; + p80211item_uint32_t sq; + p80211item_uint32_t signal; + p80211item_uint32_t noise; + p80211item_uint32_t rate; + p80211item_uint32_t istx; + p80211item_uint32_t frmlen; } wlan_ng_prism2_header; /* The radio capture header precedes the 802.11 header. */ typedef struct PACKED _ieee80211_radiotap_header { - UINT8 it_version; /* Version 0. Only increases + UINT8 it_version; /* Version 0. Only increases * for drastic changes, * introduction of compatible * new fields does not count. */ - UINT8 it_pad; - UINT16 it_len; /* length of the whole + UINT8 it_pad; + UINT16 it_len; /* length of the whole * header in bytes, including * it_version, it_pad, * it_len, and data fields. */ - UINT32 it_present; /* A bitmap telling which - * fields are present. Set bit 31 - * (0x80000000) to extend the - * bitmap by another 32 bits. - * Additional extensions are made - * by setting bit 31. - */ -}ieee80211_radiotap_header ; + UINT32 it_present; /* A bitmap telling which + * fields are present. Set bit 31 + * (0x80000000) to extend the + * bitmap by another 32 bits. + * Additional extensions are made + * by setting bit 31. + */ +} ieee80211_radiotap_header; enum ieee80211_radiotap_type { - IEEE80211_RADIOTAP_TSFT = 0, - IEEE80211_RADIOTAP_FLAGS = 1, - IEEE80211_RADIOTAP_RATE = 2, - IEEE80211_RADIOTAP_CHANNEL = 3, - IEEE80211_RADIOTAP_FHSS = 4, - IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5, - IEEE80211_RADIOTAP_DBM_ANTNOISE = 6, - IEEE80211_RADIOTAP_LOCK_QUALITY = 7, - IEEE80211_RADIOTAP_TX_ATTENUATION = 8, - IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9, - IEEE80211_RADIOTAP_DBM_TX_POWER = 10, - IEEE80211_RADIOTAP_ANTENNA = 11, - IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, - IEEE80211_RADIOTAP_DB_ANTNOISE = 13 + IEEE80211_RADIOTAP_TSFT = 0, + IEEE80211_RADIOTAP_FLAGS = 1, + IEEE80211_RADIOTAP_RATE = 2, + IEEE80211_RADIOTAP_CHANNEL = 3, + IEEE80211_RADIOTAP_FHSS = 4, + IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5, + IEEE80211_RADIOTAP_DBM_ANTNOISE = 6, + IEEE80211_RADIOTAP_LOCK_QUALITY = 7, + IEEE80211_RADIOTAP_TX_ATTENUATION = 8, + IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9, + IEEE80211_RADIOTAP_DBM_TX_POWER = 10, + IEEE80211_RADIOTAP_ANTENNA = 11, + IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, + IEEE80211_RADIOTAP_DB_ANTNOISE = 13 }; #define WLAN_RADIOTAP_PRESENT ( \ @@ -4842,623 +3874,411 @@ typedef struct _wlan_radiotap_header { } wlan_radiotap_header; /* Definition from madwifi */ -void send_monitor_packets( - IN PRTMP_ADAPTER pAd, - IN RX_BLK *pRxBlk); +void send_monitor_packets(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk); +VOID RTMPSetDesiredRates(IN PRTMP_ADAPTER pAdapter, IN LONG Rates); -VOID RTMPSetDesiredRates( - IN PRTMP_ADAPTER pAdapter, - IN LONG Rates); +INT Set_FixedTxMode_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg); -INT Set_FixedTxMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); +BOOLEAN RT28XXChipsetCheck(IN void *_dev_p); -BOOLEAN RT28XXChipsetCheck( - IN void *_dev_p); +VOID RT28XXDMADisable(IN RTMP_ADAPTER * pAd); +VOID RT28XXDMAEnable(IN RTMP_ADAPTER * pAd); -VOID RT28XXDMADisable( - IN RTMP_ADAPTER *pAd); +VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, + IN INT apidx, + IN ULONG BeaconLen, IN ULONG UpdatePos); -VOID RT28XXDMAEnable( - IN RTMP_ADAPTER *pAd); +int rt28xx_init(IN PRTMP_ADAPTER pAd, + IN PSTRING pDefaultMac, IN PSTRING pHostName); -VOID RT28xx_UpdateBeaconToAsic( - IN RTMP_ADAPTER * pAd, - IN INT apidx, - IN ULONG BeaconLen, - IN ULONG UpdatePos); +NDIS_STATUS RtmpNetTaskInit(IN RTMP_ADAPTER * pAd); -int rt28xx_init( - IN PRTMP_ADAPTER pAd, - IN PSTRING pDefaultMac, - IN PSTRING pHostName); +VOID RtmpNetTaskExit(IN PRTMP_ADAPTER pAd); -NDIS_STATUS RtmpNetTaskInit( - IN RTMP_ADAPTER *pAd); +NDIS_STATUS RtmpMgmtTaskInit(IN RTMP_ADAPTER * pAd); -VOID RtmpNetTaskExit( - IN PRTMP_ADAPTER pAd); - -NDIS_STATUS RtmpMgmtTaskInit( - IN RTMP_ADAPTER *pAd); - -VOID RtmpMgmtTaskExit( - IN RTMP_ADAPTER *pAd); +VOID RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd); void tbtt_tasklet(unsigned long data); +PNET_DEV RtmpPhyNetDevInit(IN RTMP_ADAPTER * pAd, + IN RTMP_OS_NETDEV_OP_HOOK * pNetHook); -PNET_DEV RtmpPhyNetDevInit( - IN RTMP_ADAPTER *pAd, - IN RTMP_OS_NETDEV_OP_HOOK *pNetHook); - -BOOLEAN RtmpPhyNetDevExit( - IN RTMP_ADAPTER *pAd, - IN PNET_DEV net_dev); - -INT RtmpRaDevCtrlInit( - IN RTMP_ADAPTER *pAd, - IN RTMP_INF_TYPE infType); +BOOLEAN RtmpPhyNetDevExit(IN RTMP_ADAPTER * pAd, IN PNET_DEV net_dev); -BOOLEAN RtmpRaDevCtrlExit( - IN RTMP_ADAPTER *pAd); +INT RtmpRaDevCtrlInit(IN RTMP_ADAPTER * pAd, IN RTMP_INF_TYPE infType); +BOOLEAN RtmpRaDevCtrlExit(IN RTMP_ADAPTER * pAd); #ifdef RTMP_MAC_PCI // // Function Prototype in cmm_data_pci.c // -USHORT RtmpPCI_WriteTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN BOOLEAN bIsLast, - OUT USHORT *FreeNumber); - -USHORT RtmpPCI_WriteSingleTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN BOOLEAN bIsLast, - OUT USHORT *FreeNumber); - -USHORT RtmpPCI_WriteMultiTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR frameNum, - OUT USHORT *FreeNumber); - -USHORT RtmpPCI_WriteFragTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR fragNum, - OUT USHORT *FreeNumber); - -USHORT RtmpPCI_WriteSubTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN BOOLEAN bIsLast, - OUT USHORT *FreeNumber); - -VOID RtmpPCI_FinalWriteTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN USHORT totalMPDUSize, - IN USHORT FirstTxIdx); - -VOID RtmpPCIDataLastTxIdx( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN USHORT LastTxIdx); - -VOID RtmpPCIDataKickOut( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR QueIdx); - - -int RtmpPCIMgmtKickOut( - IN RTMP_ADAPTER *pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket, - IN PUCHAR pSrcBufVA, - IN UINT SrcBufLen); - - -NDIS_STATUS RTMPCheckRxError( - IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHeader, - IN PRXWI_STRUC pRxWI, - IN PRT28XX_RXD_STRUC pRxD); - -BOOLEAN RT28xxPciAsicRadioOff( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level, - IN USHORT TbttNumToNextWakeUp); - -BOOLEAN RT28xxPciAsicRadioOn( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level); - -VOID RTMPInitPCIeLinkCtrlValue( - IN PRTMP_ADAPTER pAd); - -VOID RTMPFindHostPCIDev( - IN PRTMP_ADAPTER pAd); - -VOID RTMPPCIeLinkCtrlValueRestore( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level); - -VOID RTMPPCIeLinkCtrlSetting( - IN PRTMP_ADAPTER pAd, - IN USHORT Max); - -VOID RTMPrt3xSetPCIePowerLinkCtrl( - IN PRTMP_ADAPTER pAd); - -VOID PsPollWakeExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID RadioOnExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID RT28xxPciStaAsicForceWakeup( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bFromTx); - -VOID RT28xxPciStaAsicSleepThenAutoWakeup( - IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp); - - -VOID RT28xxPciMlmeRadioOn( - IN PRTMP_ADAPTER pAd); - -VOID RT28xxPciMlmeRadioOFF( - IN PRTMP_ADAPTER pAd); +USHORT RtmpPCI_WriteTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN BOOLEAN bIsLast, OUT USHORT * FreeNumber); + +USHORT RtmpPCI_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN BOOLEAN bIsLast, + OUT USHORT * FreeNumber); + +USHORT RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN UCHAR frameNum, OUT USHORT * FreeNumber); + +USHORT RtmpPCI_WriteFragTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN UCHAR fragNum, OUT USHORT * FreeNumber); + +USHORT RtmpPCI_WriteSubTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN BOOLEAN bIsLast, OUT USHORT * FreeNumber); + +VOID RtmpPCI_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN USHORT totalMPDUSize, + IN USHORT FirstTxIdx); + +VOID RtmpPCIDataLastTxIdx(IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, IN USHORT LastTxIdx); + +VOID RtmpPCIDataKickOut(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, IN UCHAR QueIdx); + +int RtmpPCIMgmtKickOut(IN RTMP_ADAPTER * pAd, + IN UCHAR QueIdx, + IN PNDIS_PACKET pPacket, + IN PUCHAR pSrcBufVA, IN UINT SrcBufLen); + +NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd, + IN PHEADER_802_11 pHeader, + IN PRXWI_STRUC pRxWI, IN PRT28XX_RXD_STRUC pRxD); + +BOOLEAN RT28xxPciAsicRadioOff(IN PRTMP_ADAPTER pAd, + IN UCHAR Level, IN USHORT TbttNumToNextWakeUp); + +BOOLEAN RT28xxPciAsicRadioOn(IN PRTMP_ADAPTER pAd, IN UCHAR Level); + +VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd); + +VOID RTMPFindHostPCIDev(IN PRTMP_ADAPTER pAd); + +VOID RTMPPCIeLinkCtrlValueRestore(IN PRTMP_ADAPTER pAd, IN UCHAR Level); + +VOID RTMPPCIeLinkCtrlSetting(IN PRTMP_ADAPTER pAd, IN USHORT Max); + +VOID RTMPrt3xSetPCIePowerLinkCtrl(IN PRTMP_ADAPTER pAd); + +VOID PsPollWakeExec(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); + +VOID RadioOnExec(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); + +VOID RT28xxPciStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx); + +VOID RT28xxPciStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, + IN USHORT TbttNumToNextWakeUp); + +VOID RT28xxPciMlmeRadioOn(IN PRTMP_ADAPTER pAd); + +VOID RT28xxPciMlmeRadioOFF(IN PRTMP_ADAPTER pAd); #endif // RTMP_MAC_PCI // #ifdef RTMP_MAC_USB // // Function Prototype in rtusb_bulk.c // -VOID RTUSBInitTxDesc( - IN PRTMP_ADAPTER pAd, - IN PTX_CONTEXT pTxContext, - IN UCHAR BulkOutPipeId, - IN usb_complete_t Func); +VOID RTUSBInitTxDesc(IN PRTMP_ADAPTER pAd, + IN PTX_CONTEXT pTxContext, + IN UCHAR BulkOutPipeId, IN usb_complete_t Func); -VOID RTUSBInitHTTxDesc( - IN PRTMP_ADAPTER pAd, - IN PHT_TX_CONTEXT pTxContext, - IN UCHAR BulkOutPipeId, - IN ULONG BulkOutSize, - IN usb_complete_t Func); +VOID RTUSBInitHTTxDesc(IN PRTMP_ADAPTER pAd, + IN PHT_TX_CONTEXT pTxContext, + IN UCHAR BulkOutPipeId, + IN ULONG BulkOutSize, IN usb_complete_t Func); -VOID RTUSBInitRxDesc( - IN PRTMP_ADAPTER pAd, - IN PRX_CONTEXT pRxContext); +VOID RTUSBInitRxDesc(IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext); -VOID RTUSBCleanUpDataBulkOutQueue( - IN PRTMP_ADAPTER pAd); +VOID RTUSBCleanUpDataBulkOutQueue(IN PRTMP_ADAPTER pAd); -VOID RTUSBCancelPendingBulkOutIRP( - IN PRTMP_ADAPTER pAd); +VOID RTUSBCancelPendingBulkOutIRP(IN PRTMP_ADAPTER pAd); -VOID RTUSBBulkOutDataPacket( - IN PRTMP_ADAPTER pAd, - IN UCHAR BulkOutPipeId, - IN UCHAR Index); +VOID RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, + IN UCHAR BulkOutPipeId, IN UCHAR Index); -VOID RTUSBBulkOutNullFrame( - IN PRTMP_ADAPTER pAd); +VOID RTUSBBulkOutNullFrame(IN PRTMP_ADAPTER pAd); -VOID RTUSBBulkOutRTSFrame( - IN PRTMP_ADAPTER pAd); +VOID RTUSBBulkOutRTSFrame(IN PRTMP_ADAPTER pAd); -VOID RTUSBCancelPendingBulkInIRP( - IN PRTMP_ADAPTER pAd); +VOID RTUSBCancelPendingBulkInIRP(IN PRTMP_ADAPTER pAd); -VOID RTUSBCancelPendingIRPs( - IN PRTMP_ADAPTER pAd); +VOID RTUSBCancelPendingIRPs(IN PRTMP_ADAPTER pAd); -VOID RTUSBBulkOutMLMEPacket( - IN PRTMP_ADAPTER pAd, - IN UCHAR Index); +VOID RTUSBBulkOutMLMEPacket(IN PRTMP_ADAPTER pAd, IN UCHAR Index); -VOID RTUSBBulkOutPsPoll( - IN PRTMP_ADAPTER pAd); +VOID RTUSBBulkOutPsPoll(IN PRTMP_ADAPTER pAd); -VOID RTUSBCleanUpMLMEBulkOutQueue( - IN PRTMP_ADAPTER pAd); +VOID RTUSBCleanUpMLMEBulkOutQueue(IN PRTMP_ADAPTER pAd); -VOID RTUSBKickBulkOut( - IN PRTMP_ADAPTER pAd); +VOID RTUSBKickBulkOut(IN PRTMP_ADAPTER pAd); -VOID RTUSBBulkReceive( - IN PRTMP_ADAPTER pAd); +VOID RTUSBBulkReceive(IN PRTMP_ADAPTER pAd); -VOID DoBulkIn( - IN RTMP_ADAPTER *pAd); +VOID DoBulkIn(IN RTMP_ADAPTER * pAd); -VOID RTUSBInitRxDesc( - IN PRTMP_ADAPTER pAd, - IN PRX_CONTEXT pRxContext); +VOID RTUSBInitRxDesc(IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext); -VOID RTUSBBulkRxHandle( - IN unsigned long data); +VOID RTUSBBulkRxHandle(IN unsigned long data); // // Function Prototype in rtusb_io.c // -NTSTATUS RTUSBMultiRead( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - OUT PUCHAR pData, - IN USHORT length); - -NTSTATUS RTUSBMultiWrite( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN PUCHAR pData, - IN USHORT length); - -NTSTATUS RTUSBMultiWrite_OneByte( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN PUCHAR pData); - -NTSTATUS RTUSBReadBBPRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR Id, - IN PUCHAR pValue); - -NTSTATUS RTUSBWriteBBPRegister( - IN PRTMP_ADAPTER pAd, - IN UCHAR Id, - IN UCHAR Value); - -NTSTATUS RTUSBWriteRFRegister( - IN PRTMP_ADAPTER pAd, - IN UINT32 Value); - -NTSTATUS RTUSB_VendorRequest( - IN PRTMP_ADAPTER pAd, - IN UINT32 TransferFlags, - IN UCHAR ReservedBits, - IN UCHAR Request, - IN USHORT Value, - IN USHORT Index, - IN PVOID TransferBuffer, - IN UINT32 TransferBufferLength); - -NTSTATUS RTUSBReadEEPROM( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - OUT PUCHAR pData, - IN USHORT length); - -NTSTATUS RTUSBWriteEEPROM( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN PUCHAR pData, - IN USHORT length); - -VOID RTUSBPutToSleep( - IN PRTMP_ADAPTER pAd); - -NTSTATUS RTUSBWakeUp( - IN PRTMP_ADAPTER pAd); - -VOID RTUSBInitializeCmdQ( - IN PCmdQ cmdq); - -NDIS_STATUS RTUSBEnqueueCmdFromNdis( - IN PRTMP_ADAPTER pAd, - IN NDIS_OID Oid, - IN BOOLEAN SetInformation, - IN PVOID pInformationBuffer, - IN UINT32 InformationBufferLength); - -NDIS_STATUS RTUSBEnqueueInternalCmd( - IN PRTMP_ADAPTER pAd, - IN NDIS_OID Oid, - IN PVOID pInformationBuffer, - IN UINT32 InformationBufferLength); - -VOID RTUSBDequeueCmd( - IN PCmdQ cmdq, - OUT PCmdQElmt *pcmdqelmt); - -INT RTUSBCmdThread( - IN OUT PVOID Context); - -VOID RTUSBBssBeaconExit( - IN RTMP_ADAPTER *pAd); - -VOID RTUSBBssBeaconStop( - IN RTMP_ADAPTER *pAd); - -VOID RTUSBBssBeaconStart( - IN RTMP_ADAPTER * pAd); - -VOID RTUSBBssBeaconInit( - IN RTMP_ADAPTER *pAd); - -VOID RTUSBWatchDog( - IN RTMP_ADAPTER *pAd); - -NTSTATUS RTUSBWriteMACRegister( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN UINT32 Value); - -NTSTATUS RTUSBReadMACRegister( - IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - OUT PUINT32 pValue); - -NTSTATUS RTUSBSingleWrite( - IN RTMP_ADAPTER *pAd, - IN USHORT Offset, - IN USHORT Value); - -NTSTATUS RTUSBFirmwareWrite( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pFwImage, - IN ULONG FwLen); - -NTSTATUS RTUSBVenderReset( - IN PRTMP_ADAPTER pAd); - -NDIS_STATUS RTUSBSetHardWareRegister( - IN PRTMP_ADAPTER pAdapter, - IN PVOID pBuf); - -NDIS_STATUS RTUSBQueryHardWareRegister( - IN PRTMP_ADAPTER pAdapter, - IN PVOID pBuf); - -VOID CMDHandler( - IN PRTMP_ADAPTER pAd); - -NDIS_STATUS RTUSBWriteHWMACAddress( - IN PRTMP_ADAPTER pAdapter); - -VOID MacTableInitialize( - IN PRTMP_ADAPTER pAd); - -VOID MlmeSetPsm( - IN PRTMP_ADAPTER pAd, - IN USHORT psm); +NTSTATUS RTUSBMultiRead(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, OUT PUCHAR pData, IN USHORT length); + +NTSTATUS RTUSBMultiWrite(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, IN PUCHAR pData, IN USHORT length); + +NTSTATUS RTUSBMultiWrite_OneByte(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, IN PUCHAR pData); + +NTSTATUS RTUSBReadBBPRegister(IN PRTMP_ADAPTER pAd, + IN UCHAR Id, IN PUCHAR pValue); + +NTSTATUS RTUSBWriteBBPRegister(IN PRTMP_ADAPTER pAd, + IN UCHAR Id, IN UCHAR Value); + +NTSTATUS RTUSBWriteRFRegister(IN PRTMP_ADAPTER pAd, IN UINT32 Value); + +NTSTATUS RTUSB_VendorRequest(IN PRTMP_ADAPTER pAd, + IN UINT32 TransferFlags, + IN UCHAR ReservedBits, + IN UCHAR Request, + IN USHORT Value, + IN USHORT Index, + IN PVOID TransferBuffer, + IN UINT32 TransferBufferLength); + +NTSTATUS RTUSBReadEEPROM(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, OUT PUCHAR pData, IN USHORT length); + +NTSTATUS RTUSBWriteEEPROM(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, IN PUCHAR pData, IN USHORT length); + +VOID RTUSBPutToSleep(IN PRTMP_ADAPTER pAd); + +NTSTATUS RTUSBWakeUp(IN PRTMP_ADAPTER pAd); + +VOID RTUSBInitializeCmdQ(IN PCmdQ cmdq); + +NDIS_STATUS RTUSBEnqueueCmdFromNdis(IN PRTMP_ADAPTER pAd, + IN NDIS_OID Oid, + IN BOOLEAN SetInformation, + IN PVOID pInformationBuffer, + IN UINT32 InformationBufferLength); + +NDIS_STATUS RTUSBEnqueueInternalCmd(IN PRTMP_ADAPTER pAd, + IN NDIS_OID Oid, + IN PVOID pInformationBuffer, + IN UINT32 InformationBufferLength); + +VOID RTUSBDequeueCmd(IN PCmdQ cmdq, OUT PCmdQElmt * pcmdqelmt); + +INT RTUSBCmdThread(IN OUT PVOID Context); + +VOID RTUSBBssBeaconExit(IN RTMP_ADAPTER * pAd); + +VOID RTUSBBssBeaconStop(IN RTMP_ADAPTER * pAd); + +VOID RTUSBBssBeaconStart(IN RTMP_ADAPTER * pAd); + +VOID RTUSBBssBeaconInit(IN RTMP_ADAPTER * pAd); + +VOID RTUSBWatchDog(IN RTMP_ADAPTER * pAd); + +NTSTATUS RTUSBWriteMACRegister(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, IN UINT32 Value); + +NTSTATUS RTUSBReadMACRegister(IN PRTMP_ADAPTER pAd, + IN USHORT Offset, OUT PUINT32 pValue); + +NTSTATUS RTUSBSingleWrite(IN RTMP_ADAPTER * pAd, + IN USHORT Offset, IN USHORT Value); + +NTSTATUS RTUSBFirmwareWrite(IN PRTMP_ADAPTER pAd, + IN PUCHAR pFwImage, IN ULONG FwLen); + +NTSTATUS RTUSBVenderReset(IN PRTMP_ADAPTER pAd); + +NDIS_STATUS RTUSBSetHardWareRegister(IN PRTMP_ADAPTER pAdapter, IN PVOID pBuf); -NDIS_STATUS RTMPWPAAddKeyProc( - IN PRTMP_ADAPTER pAd, - IN PVOID pBuf); +NDIS_STATUS RTUSBQueryHardWareRegister(IN PRTMP_ADAPTER pAdapter, + IN PVOID pBuf); -VOID AsicRxAntEvalAction( - IN PRTMP_ADAPTER pAd); - -void append_pkt( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, - IN ULONG DataSize, - OUT PNDIS_PACKET *ppPacket); +VOID CMDHandler(IN PRTMP_ADAPTER pAd); -UINT deaggregate_AMSDU_announce( - IN PRTMP_ADAPTER pAd, - PNDIS_PACKET pPacket, - IN PUCHAR pData, - IN ULONG DataSize); +NDIS_STATUS RTUSBWriteHWMACAddress(IN PRTMP_ADAPTER pAdapter); -NDIS_STATUS RTMPCheckRxError( - IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHeader, - IN PRXWI_STRUC pRxWI, - IN PRT28XX_RXD_STRUC pRxINFO); +VOID MacTableInitialize(IN PRTMP_ADAPTER pAd); -VOID RTUSBMlmeHardTransmit( - IN PRTMP_ADAPTER pAd, - IN PMGMT_STRUC pMgmt); +VOID MlmeSetPsm(IN PRTMP_ADAPTER pAd, IN USHORT psm); -INT MlmeThread( - IN PVOID Context); +NDIS_STATUS RTMPWPAAddKeyProc(IN PRTMP_ADAPTER pAd, IN PVOID pBuf); + +VOID AsicRxAntEvalAction(IN PRTMP_ADAPTER pAd); + +void append_pkt(IN PRTMP_ADAPTER pAd, + IN PUCHAR pHeader802_3, + IN UINT HdrLen, + IN PUCHAR pData, + IN ULONG DataSize, OUT PNDIS_PACKET * ppPacket); + +UINT deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, + PNDIS_PACKET pPacket, + IN PUCHAR pData, IN ULONG DataSize); + +NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd, + IN PHEADER_802_11 pHeader, + IN PRXWI_STRUC pRxWI, + IN PRT28XX_RXD_STRUC pRxINFO); + +VOID RTUSBMlmeHardTransmit(IN PRTMP_ADAPTER pAd, IN PMGMT_STRUC pMgmt); + +INT MlmeThread(IN PVOID Context); // // Function Prototype in rtusb_data.c // -NDIS_STATUS RTUSBFreeDescriptorRequest( - IN PRTMP_ADAPTER pAd, - IN UCHAR BulkOutPipeId, - IN UINT32 NumberRequired); - - -BOOLEAN RTUSBNeedQueueBackForAgg( - IN RTMP_ADAPTER *pAd, - IN UCHAR BulkOutPipeId); +NDIS_STATUS RTUSBFreeDescriptorRequest(IN PRTMP_ADAPTER pAd, + IN UCHAR BulkOutPipeId, + IN UINT32 NumberRequired); +BOOLEAN RTUSBNeedQueueBackForAgg(IN RTMP_ADAPTER * pAd, IN UCHAR BulkOutPipeId); -VOID RTMPWriteTxInfo( - IN PRTMP_ADAPTER pAd, - IN PTXINFO_STRUC pTxInfo, - IN USHORT USBDMApktLen, - IN BOOLEAN bWiv, - IN UCHAR QueueSel, - IN UCHAR NextValid, - IN UCHAR TxBurst); +VOID RTMPWriteTxInfo(IN PRTMP_ADAPTER pAd, + IN PTXINFO_STRUC pTxInfo, + IN USHORT USBDMApktLen, + IN BOOLEAN bWiv, + IN UCHAR QueueSel, IN UCHAR NextValid, IN UCHAR TxBurst); // // Function Prototype in cmm_data_usb.c // -USHORT RtmpUSB_WriteSubTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN BOOLEAN bIsLast, - OUT USHORT *FreeNumber); - -USHORT RtmpUSB_WriteSingleTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN BOOLEAN bIsLast, - OUT USHORT *FreeNumber); - -USHORT RtmpUSB_WriteFragTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR fragNum, - OUT USHORT *FreeNumber); - -USHORT RtmpUSB_WriteMultiTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR frameNum, - OUT USHORT *FreeNumber); - -VOID RtmpUSB_FinalWriteTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN USHORT totalMPDUSize, - IN USHORT TxIdx); - -VOID RtmpUSBDataLastTxIdx( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN USHORT TxIdx); - -VOID RtmpUSBDataKickOut( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR QueIdx); - - -int RtmpUSBMgmtKickOut( - IN RTMP_ADAPTER *pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket, - IN PUCHAR pSrcBufVA, - IN UINT SrcBufLen); - -VOID RtmpUSBNullFrameKickOut( - IN RTMP_ADAPTER *pAd, - IN UCHAR QueIdx, - IN UCHAR *pNullFrame, - IN UINT32 frameLen); - -VOID RtmpUsbStaAsicForceWakeupTimeout( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -VOID RT28xxUsbStaAsicForceWakeup( - IN PRTMP_ADAPTER pAd, - IN BOOLEAN bFromTx); - -VOID RT28xxUsbStaAsicSleepThenAutoWakeup( - IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp); - -VOID RT28xxUsbMlmeRadioOn( - IN PRTMP_ADAPTER pAd); - -VOID RT28xxUsbMlmeRadioOFF( - IN PRTMP_ADAPTER pAd); -#endif // RTMP_MAC_USB // +USHORT RtmpUSB_WriteSubTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN BOOLEAN bIsLast, OUT USHORT * FreeNumber); + +USHORT RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN BOOLEAN bIsLast, + OUT USHORT * FreeNumber); + +USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN UCHAR fragNum, OUT USHORT * FreeNumber); + +USHORT RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN UCHAR frameNum, OUT USHORT * FreeNumber); + +VOID RtmpUSB_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, + IN USHORT totalMPDUSize, IN USHORT TxIdx); + +VOID RtmpUSBDataLastTxIdx(IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, IN USHORT TxIdx); + +VOID RtmpUSBDataKickOut(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, IN UCHAR QueIdx); -VOID AsicTurnOffRFClk( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel); +int RtmpUSBMgmtKickOut(IN RTMP_ADAPTER * pAd, + IN UCHAR QueIdx, + IN PNDIS_PACKET pPacket, + IN PUCHAR pSrcBufVA, IN UINT SrcBufLen); -VOID AsicTurnOnRFClk( - IN PRTMP_ADAPTER pAd, - IN UCHAR Channel); +VOID RtmpUSBNullFrameKickOut(IN RTMP_ADAPTER * pAd, + IN UCHAR QueIdx, + IN UCHAR * pNullFrame, IN UINT32 frameLen); +VOID RtmpUsbStaAsicForceWakeupTimeout(IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3); +VOID RT28xxUsbStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx); + +VOID RT28xxUsbStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, + IN USHORT TbttNumToNextWakeUp); + +VOID RT28xxUsbMlmeRadioOn(IN PRTMP_ADAPTER pAd); + +VOID RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd); +#endif // RTMP_MAC_USB // + +VOID AsicTurnOffRFClk(IN PRTMP_ADAPTER pAd, IN UCHAR Channel); + +VOID AsicTurnOnRFClk(IN PRTMP_ADAPTER pAd, IN UCHAR Channel); #ifdef RTMP_TIMER_TASK_SUPPORT -INT RtmpTimerQThread( - IN OUT PVOID Context); +INT RtmpTimerQThread(IN OUT PVOID Context); -RTMP_TIMER_TASK_ENTRY *RtmpTimerQInsert( - IN RTMP_ADAPTER *pAd, - IN RALINK_TIMER_STRUCT *pTimer); +RTMP_TIMER_TASK_ENTRY *RtmpTimerQInsert(IN RTMP_ADAPTER * pAd, + IN RALINK_TIMER_STRUCT * pTimer); -BOOLEAN RtmpTimerQRemove( - IN RTMP_ADAPTER *pAd, - IN RALINK_TIMER_STRUCT *pTimer); +BOOLEAN RtmpTimerQRemove(IN RTMP_ADAPTER * pAd, + IN RALINK_TIMER_STRUCT * pTimer); -void RtmpTimerQExit( - IN RTMP_ADAPTER *pAd); +void RtmpTimerQExit(IN RTMP_ADAPTER * pAd); -void RtmpTimerQInit( - IN RTMP_ADAPTER *pAd); +void RtmpTimerQInit(IN RTMP_ADAPTER * pAd); #endif // RTMP_TIMER_TASK_SUPPORT // -VOID AsicStaBbpTuning( - IN PRTMP_ADAPTER pAd); +VOID AsicStaBbpTuning(IN PRTMP_ADAPTER pAd); -BOOLEAN StaAddMacTableEntry( - IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, - IN UCHAR MaxSupportedRateIn500Kbps, - IN HT_CAPABILITY_IE *pHtCapability, - IN UCHAR HtCapabilityLen, - IN ADD_HT_INFO_IE *pAddHtInfo, - IN UCHAR AddHtInfoLen, - IN USHORT CapabilityInfo); +BOOLEAN StaAddMacTableEntry(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, + IN UCHAR MaxSupportedRateIn500Kbps, + IN HT_CAPABILITY_IE * pHtCapability, + IN UCHAR HtCapabilityLen, + IN ADD_HT_INFO_IE * pAddHtInfo, + IN UCHAR AddHtInfoLen, IN USHORT CapabilityInfo); +BOOLEAN AUTH_ReqSend(IN PRTMP_ADAPTER pAd, + IN PMLME_QUEUE_ELEM pElem, + IN PRALINK_TIMER_STRUCT pAuthTimer, + IN PSTRING pSMName, + IN USHORT SeqNo, + IN PUCHAR pNewElement, IN ULONG ElementLen); -BOOLEAN AUTH_ReqSend( - IN PRTMP_ADAPTER pAd, - IN PMLME_QUEUE_ELEM pElem, - IN PRALINK_TIMER_STRUCT pAuthTimer, - IN PSTRING pSMName, - IN USHORT SeqNo, - IN PUCHAR pNewElement, - IN ULONG ElementLen); +void RTMP_IndicateMediaState(IN PRTMP_ADAPTER pAd); -void RTMP_IndicateMediaState( - IN PRTMP_ADAPTER pAd); +VOID ReSyncBeaconTime(IN PRTMP_ADAPTER pAd); -VOID ReSyncBeaconTime( - IN PRTMP_ADAPTER pAd); - -VOID RTMPSetAGCInitValue( - IN PRTMP_ADAPTER pAd, - IN UCHAR BandWidth); +VOID RTMPSetAGCInitValue(IN PRTMP_ADAPTER pAd, IN UCHAR BandWidth); int rt28xx_close(IN PNET_DEV dev); int rt28xx_open(IN PNET_DEV dev); - #define VIRTUAL_IF_INC(__pAd) ((__pAd)->VirtualIfCnt++) #define VIRTUAL_IF_DEC(__pAd) ((__pAd)->VirtualIfCnt--) #define VIRTUAL_IF_NUM(__pAd) ((__pAd)->VirtualIfCnt) - #ifdef LINUX __inline INT VIRTUAL_IF_UP(PRTMP_ADAPTER pAd) { - if (VIRTUAL_IF_NUM(pAd) == 0) - { - if (rt28xx_open(pAd->net_dev) != 0) - { - DBGPRINT(RT_DEBUG_TRACE, ("rt28xx_open return fail!\n")); + if (VIRTUAL_IF_NUM(pAd) == 0) { + if (rt28xx_open(pAd->net_dev) != 0) { + DBGPRINT(RT_DEBUG_TRACE, + ("rt28xx_open return fail!\n")); return -1; - } - } - else - { + } + } else { } VIRTUAL_IF_INC(pAd); return 0; @@ -5473,101 +4293,64 @@ __inline VOID VIRTUAL_IF_DOWN(PRTMP_ADAPTER pAd) } #endif // LINUX // - /* OS Related funciton prototype definitions. TODO: Maybe we need to move these function prototypes to other proper place. */ -int RtmpOSWrielessEventSend( - IN RTMP_ADAPTER *pAd, - IN UINT32 eventType, - IN INT flags, - IN PUCHAR pSrcMac, - IN PUCHAR pData, - IN UINT32 dataLen); +int RtmpOSWrielessEventSend(IN RTMP_ADAPTER * pAd, + IN UINT32 eventType, + IN INT flags, + IN PUCHAR pSrcMac, + IN PUCHAR pData, IN UINT32 dataLen); -int RtmpOSNetDevAddrSet( - IN PNET_DEV pNetDev, - IN PUCHAR pMacAddr); +int RtmpOSNetDevAddrSet(IN PNET_DEV pNetDev, IN PUCHAR pMacAddr); -int RtmpOSNetDevAttach( - IN PNET_DEV pNetDev, - IN RTMP_OS_NETDEV_OP_HOOK *pDevOpHook); +int RtmpOSNetDevAttach(IN PNET_DEV pNetDev, + IN RTMP_OS_NETDEV_OP_HOOK * pDevOpHook); -void RtmpOSNetDevClose( - IN PNET_DEV pNetDev); +void RtmpOSNetDevClose(IN PNET_DEV pNetDev); -void RtmpOSNetDevDetach( - IN PNET_DEV pNetDev); +void RtmpOSNetDevDetach(IN PNET_DEV pNetDev); -INT RtmpOSNetDevAlloc( - IN PNET_DEV *pNewNetDev, - IN UINT32 privDataSize); +INT RtmpOSNetDevAlloc(IN PNET_DEV * pNewNetDev, IN UINT32 privDataSize); -void RtmpOSNetDevFree( - IN PNET_DEV pNetDev); +void RtmpOSNetDevFree(IN PNET_DEV pNetDev); -PNET_DEV RtmpOSNetDevGetByName( - IN PNET_DEV pNetDev, - IN PSTRING pDevName); +PNET_DEV RtmpOSNetDevGetByName(IN PNET_DEV pNetDev, IN PSTRING pDevName); -void RtmpOSNetDeviceRefPut( - IN PNET_DEV pNetDev); +void RtmpOSNetDeviceRefPut(IN PNET_DEV pNetDev); -PNET_DEV RtmpOSNetDevCreate( - IN RTMP_ADAPTER *pAd, - IN INT devType, - IN INT devNum, - IN INT privMemSize, - IN PSTRING pNamePrefix); +PNET_DEV RtmpOSNetDevCreate(IN RTMP_ADAPTER * pAd, + IN INT devType, + IN INT devNum, + IN INT privMemSize, IN PSTRING pNamePrefix); /* Task operation related function prototypes */ -void RtmpOSTaskCustomize( - IN RTMP_OS_TASK *pTask); - -INT RtmpOSTaskNotifyToExit( - IN RTMP_OS_TASK *pTask); +void RtmpOSTaskCustomize(IN RTMP_OS_TASK * pTask); -NDIS_STATUS RtmpOSTaskKill( - IN RTMP_OS_TASK *pTask); +INT RtmpOSTaskNotifyToExit(IN RTMP_OS_TASK * pTask); -NDIS_STATUS RtmpOSTaskInit( - IN RTMP_OS_TASK *pTask, - PSTRING pTaskName, - VOID *pPriv); +NDIS_STATUS RtmpOSTaskKill(IN RTMP_OS_TASK * pTask); -NDIS_STATUS RtmpOSTaskAttach( - IN RTMP_OS_TASK *pTask, - IN int (*fn)(void *), - IN void *arg); +NDIS_STATUS RtmpOSTaskInit(IN RTMP_OS_TASK * pTask, + PSTRING pTaskName, VOID * pPriv); +NDIS_STATUS RtmpOSTaskAttach(IN RTMP_OS_TASK * pTask, + IN int (*fn) (void *), IN void *arg); /* File operation related function prototypes */ -RTMP_OS_FD RtmpOSFileOpen( - IN char *pPath, - IN int flag, - IN int mode); - -int RtmpOSFileClose( - IN RTMP_OS_FD osfd); +RTMP_OS_FD RtmpOSFileOpen(IN char *pPath, IN int flag, IN int mode); -void RtmpOSFileSeek( - IN RTMP_OS_FD osfd, - IN int offset); +int RtmpOSFileClose(IN RTMP_OS_FD osfd); -int RtmpOSFileRead( - IN RTMP_OS_FD osfd, - IN char *pDataPtr, - IN int readLen); +void RtmpOSFileSeek(IN RTMP_OS_FD osfd, IN int offset); -int RtmpOSFileWrite( - IN RTMP_OS_FD osfd, - IN char *pDataPtr, - IN int writeLen); +int RtmpOSFileRead(IN RTMP_OS_FD osfd, IN char *pDataPtr, IN int readLen); -#endif // __RTMP_H__ +int RtmpOSFileWrite(IN RTMP_OS_FD osfd, IN char *pDataPtr, IN int writeLen); +#endif // __RTMP_H__ diff --git a/drivers/staging/rt2860/rtmp_chip.h b/drivers/staging/rt2860/rtmp_chip.h index 1098a8547d9d..7fa73e65b29c 100644 --- a/drivers/staging/rt2860/rtmp_chip.h +++ b/drivers/staging/rt2860/rtmp_chip.h @@ -73,7 +73,7 @@ #define IS_RT2070(_pAd) (((_pAd)->RfIcType == RFIC_2020) || ((_pAd)->EFuseTag == 0x27)) #define IS_RT30xx(_pAd) (((_pAd)->MACVersion & 0xfff00000) == 0x30700000||IS_RT3090A(_pAd)) -//#define IS_RT305X(_pAd) ((_pAd)->MACVersion == 0x28720200) +//#define IS_RT305X(_pAd) ((_pAd)->MACVersion == 0x28720200) /* RT3572, 3592, 3562, 3062 share the same MAC version */ #define IS_RT3572(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x35720000) @@ -103,15 +103,12 @@ #define RETRY_LIMIT 10 - - // ------------------------------------------------------ -// BBP & RF definition +// BBP & RF definition // ------------------------------------------------------ #define BUSY 1 #define IDLE 0 - //------------------------------------------------------------------------- // EEPROM definition //------------------------------------------------------------------------- @@ -126,11 +123,11 @@ #define EEPROM_EWDS_OPCODE 0x10 #define EEPROM_EWEN_OPCODE 0x13 -#define NUM_EEPROM_BBP_PARMS 19 // Include NIC Config 0, 1, CR, TX ALC step, BBPs +#define NUM_EEPROM_BBP_PARMS 19 // Include NIC Config 0, 1, CR, TX ALC step, BBPs #define NUM_EEPROM_TX_G_PARMS 7 -#define EEPROM_NIC1_OFFSET 0x34 // The address is from NIC config 0, not BBP register ID -#define EEPROM_NIC2_OFFSET 0x36 // The address is from NIC config 0, not BBP register ID -#define EEPROM_BBP_BASE_OFFSET 0xf0 // The address is from NIC config 0, not BBP register ID +#define EEPROM_NIC1_OFFSET 0x34 // The address is from NIC config 0, not BBP register ID +#define EEPROM_NIC2_OFFSET 0x36 // The address is from NIC config 0, not BBP register ID +#define EEPROM_BBP_BASE_OFFSET 0xf0 // The address is from NIC config 0, not BBP register ID #define EEPROM_G_TX_PWR_OFFSET 0x52 #define EEPROM_G_TX2_PWR_OFFSET 0x60 #define EEPROM_LED1_OFFSET 0x3c @@ -150,24 +147,22 @@ #define EEPROM_A_TX2_PWR_OFFSET 0xa6 //#define EEPROM_Japan_TX_PWR_OFFSET 0x90 // 802.11j //#define EEPROM_Japan_TX2_PWR_OFFSET 0xbe -//#define EEPROM_TSSI_REF_OFFSET 0x54 -//#define EEPROM_TSSI_DELTA_OFFSET 0x24 +//#define EEPROM_TSSI_REF_OFFSET 0x54 +//#define EEPROM_TSSI_DELTA_OFFSET 0x24 //#define EEPROM_CCK_TX_PWR_OFFSET 0x62 -//#define EEPROM_CALIBRATE_OFFSET 0x7c +//#define EEPROM_CALIBRATE_OFFSET 0x7c #define EEPROM_VERSION_OFFSET 0x02 #define EEPROM_FREQ_OFFSET 0x3a #define EEPROM_TXPOWER_BYRATE 0xde // 20MHZ power. #define EEPROM_TXPOWER_DELTA 0x50 // 20MHZ AND 40 MHZ use different power. This is delta in 40MHZ. #define VALID_EEPROM_VERSION 1 - /* * EEPROM operation related marcos */ #define RT28xx_EEPROM_READ16(_pAd, _offset, _value) \ (_pAd)->chipOps.eeread((RTMP_ADAPTER *)(_pAd), (USHORT)(_offset), (PUSHORT)&(_value)) - // ------------------------------------------------------------------- // E2PROM data layout // ------------------------------------------------------------------- @@ -175,90 +170,89 @@ // // MCU_LEDCS: MCU LED Control Setting. // -typedef union _MCU_LEDCS_STRUC { - struct { - UCHAR LedMode:7; - UCHAR Polarity:1; +typedef union _MCU_LEDCS_STRUC { + struct { + UCHAR LedMode:7; + UCHAR Polarity:1; } field; - UCHAR word; + UCHAR word; } MCU_LEDCS_STRUC, *PMCU_LEDCS_STRUC; - // // EEPROM antenna select format // -typedef union _EEPROM_ANTENNA_STRUC { - struct { - USHORT RxPath:4; // 1: 1R, 2: 2R, 3: 3R - USHORT TxPath:4; // 1: 1T, 2: 2T - USHORT RfIcType:4; // see E2PROM document - USHORT Rsv:4; - } field; - USHORT word; -} EEPROM_ANTENNA_STRUC, *PEEPROM_ANTENNA_STRUC; +typedef union _EEPROM_ANTENNA_STRUC { + struct { + USHORT RxPath:4; // 1: 1R, 2: 2R, 3: 3R + USHORT TxPath:4; // 1: 1T, 2: 2T + USHORT RfIcType:4; // see E2PROM document + USHORT Rsv:4; + } field; + USHORT word; +} EEPROM_ANTENNA_STRUC, *PEEPROM_ANTENNA_STRUC; -typedef union _EEPROM_NIC_CINFIG2_STRUC { +typedef union _EEPROM_NIC_CINFIG2_STRUC { struct { - USHORT HardwareRadioControl:1; // 1:enable, 0:disable - USHORT DynamicTxAgcControl:1; // - USHORT ExternalLNAForG:1; // - USHORT ExternalLNAForA:1; // external LNA enable for 2.4G - USHORT CardbusAcceleration:1; // !!! NOTE: 0 - enable, 1 - disable - USHORT BW40MSidebandForG:1; - USHORT BW40MSidebandForA:1; - USHORT EnableWPSPBC:1; // WPS PBC Control bit - USHORT BW40MAvailForG:1; // 0:enable, 1:disable - USHORT BW40MAvailForA:1; // 0:enable, 1:disable - USHORT Rsv1:1; // must be 0 - USHORT AntDiversity:1; // Antenna diversity - USHORT Rsv2:3; // must be 0 - USHORT DACTestBit:1; // control if driver should patch the DAC issue - } field; - USHORT word; -} EEPROM_NIC_CONFIG2_STRUC, *PEEPROM_NIC_CONFIG2_STRUC; + USHORT HardwareRadioControl:1; // 1:enable, 0:disable + USHORT DynamicTxAgcControl:1; // + USHORT ExternalLNAForG:1; // + USHORT ExternalLNAForA:1; // external LNA enable for 2.4G + USHORT CardbusAcceleration:1; // !!! NOTE: 0 - enable, 1 - disable + USHORT BW40MSidebandForG:1; + USHORT BW40MSidebandForA:1; + USHORT EnableWPSPBC:1; // WPS PBC Control bit + USHORT BW40MAvailForG:1; // 0:enable, 1:disable + USHORT BW40MAvailForA:1; // 0:enable, 1:disable + USHORT Rsv1:1; // must be 0 + USHORT AntDiversity:1; // Antenna diversity + USHORT Rsv2:3; // must be 0 + USHORT DACTestBit:1; // control if driver should patch the DAC issue + } field; + USHORT word; +} EEPROM_NIC_CONFIG2_STRUC, *PEEPROM_NIC_CONFIG2_STRUC; // // TX_PWR Value valid range 0xFA(-6) ~ 0x24(36) // -typedef union _EEPROM_TX_PWR_STRUC { - struct { - CHAR Byte0; // Low Byte - CHAR Byte1; // High Byte - } field; - USHORT word; -} EEPROM_TX_PWR_STRUC, *PEEPROM_TX_PWR_STRUC; +typedef union _EEPROM_TX_PWR_STRUC { + struct { + CHAR Byte0; // Low Byte + CHAR Byte1; // High Byte + } field; + USHORT word; +} EEPROM_TX_PWR_STRUC, *PEEPROM_TX_PWR_STRUC; -typedef union _EEPROM_VERSION_STRUC { - struct { - UCHAR FaeReleaseNumber; // Low Byte - UCHAR Version; // High Byte - } field; - USHORT word; -} EEPROM_VERSION_STRUC, *PEEPROM_VERSION_STRUC; +typedef union _EEPROM_VERSION_STRUC { + struct { + UCHAR FaeReleaseNumber; // Low Byte + UCHAR Version; // High Byte + } field; + USHORT word; +} EEPROM_VERSION_STRUC, *PEEPROM_VERSION_STRUC; -typedef union _EEPROM_LED_STRUC { - struct { - USHORT PolarityRDY_G:1; // Polarity RDY_G setting. - USHORT PolarityRDY_A:1; // Polarity RDY_A setting. - USHORT PolarityACT:1; // Polarity ACT setting. - USHORT PolarityGPIO_0:1; // Polarity GPIO#0 setting. - USHORT PolarityGPIO_1:1; // Polarity GPIO#1 setting. - USHORT PolarityGPIO_2:1; // Polarity GPIO#2 setting. - USHORT PolarityGPIO_3:1; // Polarity GPIO#3 setting. - USHORT PolarityGPIO_4:1; // Polarity GPIO#4 setting. - USHORT LedMode:5; // Led mode. - USHORT Rsvd:3; // Reserved - } field; - USHORT word; -} EEPROM_LED_STRUC, *PEEPROM_LED_STRUC; +typedef union _EEPROM_LED_STRUC { + struct { + USHORT PolarityRDY_G:1; // Polarity RDY_G setting. + USHORT PolarityRDY_A:1; // Polarity RDY_A setting. + USHORT PolarityACT:1; // Polarity ACT setting. + USHORT PolarityGPIO_0:1; // Polarity GPIO#0 setting. + USHORT PolarityGPIO_1:1; // Polarity GPIO#1 setting. + USHORT PolarityGPIO_2:1; // Polarity GPIO#2 setting. + USHORT PolarityGPIO_3:1; // Polarity GPIO#3 setting. + USHORT PolarityGPIO_4:1; // Polarity GPIO#4 setting. + USHORT LedMode:5; // Led mode. + USHORT Rsvd:3; // Reserved + } field; + USHORT word; +} EEPROM_LED_STRUC, *PEEPROM_LED_STRUC; -typedef union _EEPROM_TXPOWER_DELTA_STRUC { - struct { - UCHAR DeltaValue:6; // Tx Power dalta value (MAX=4) - UCHAR Type:1; // 1: plus the delta value, 0: minus the delta value - UCHAR TxPowerEnable:1;// Enable - } field; - UCHAR value; -} EEPROM_TXPOWER_DELTA_STRUC, *PEEPROM_TXPOWER_DELTA_STRUC; +typedef union _EEPROM_TXPOWER_DELTA_STRUC { + struct { + UCHAR DeltaValue:6; // Tx Power dalta value (MAX=4) + UCHAR Type:1; // 1: plus the delta value, 0: minus the delta value + UCHAR TxPowerEnable:1; // Enable + } field; + UCHAR value; +} EEPROM_TXPOWER_DELTA_STRUC, *PEEPROM_TXPOWER_DELTA_STRUC; -#endif // __RTMP_CHIP_H__ // +#endif // __RTMP_CHIP_H__ // diff --git a/drivers/staging/rt2860/rtmp_ckipmic.h b/drivers/staging/rt2860/rtmp_ckipmic.h index 39955b914de7..ad35dca27dcc 100644 --- a/drivers/staging/rt2860/rtmp_ckipmic.h +++ b/drivers/staging/rt2860/rtmp_ckipmic.h @@ -37,42 +37,27 @@ #ifndef __RTMP_CKIPMIC_H__ #define __RTMP_CKIPMIC_H__ -typedef struct _MIC_CONTEXT { +typedef struct _MIC_CONTEXT { /* --- MMH context */ - UCHAR CK[16]; /* the key */ - UCHAR coefficient[16]; /* current aes counter mode coefficients */ - ULONGLONG accum; /* accumulated mic, reduced to u32 in final() */ - UINT position; /* current position (byte offset) in message */ - UCHAR part[4]; /* for conversion of message to u32 for mmh */ -} MIC_CONTEXT, *PMIC_CONTEXT; + UCHAR CK[16]; /* the key */ + UCHAR coefficient[16]; /* current aes counter mode coefficients */ + ULONGLONG accum; /* accumulated mic, reduced to u32 in final() */ + UINT position; /* current position (byte offset) in message */ + UCHAR part[4]; /* for conversion of message to u32 for mmh */ +} MIC_CONTEXT, *PMIC_CONTEXT; -VOID xor_128( - IN PUCHAR a, - IN PUCHAR b, - OUT PUCHAR out); +VOID xor_128(IN PUCHAR a, IN PUCHAR b, OUT PUCHAR out); -UCHAR RTMPCkipSbox( - IN UCHAR a); +UCHAR RTMPCkipSbox(IN UCHAR a); -VOID xor_32( - IN PUCHAR a, - IN PUCHAR b, - OUT PUCHAR out); +VOID xor_32(IN PUCHAR a, IN PUCHAR b, OUT PUCHAR out); -VOID next_key( - IN PUCHAR key, - IN INT round); +VOID next_key(IN PUCHAR key, IN INT round); -VOID byte_sub( - IN PUCHAR in, - OUT PUCHAR out); +VOID byte_sub(IN PUCHAR in, OUT PUCHAR out); -VOID shift_row( - IN PUCHAR in, - OUT PUCHAR out); +VOID shift_row(IN PUCHAR in, OUT PUCHAR out); -VOID mix_column( - IN PUCHAR in, - OUT PUCHAR out); +VOID mix_column(IN PUCHAR in, OUT PUCHAR out); #endif //__RTMP_CKIPMIC_H__ diff --git a/drivers/staging/rt2860/rtmp_def.h b/drivers/staging/rt2860/rtmp_def.h index 816ae6294449..31b52d6ba1df 100644 --- a/drivers/staging/rt2860/rtmp_def.h +++ b/drivers/staging/rt2860/rtmp_def.h @@ -55,9 +55,9 @@ #define NIC_DBG_STRING ("**RT28xx**") #ifdef RTMP_MAC_USB -#define TX_RING_SIZE 8 // 1 +#define TX_RING_SIZE 8 // 1 #define PRIO_RING_SIZE 8 -#define MGMT_RING_SIZE 32 // PRIO_RING_SIZE +#define MGMT_RING_SIZE 32 // PRIO_RING_SIZE #define RX_RING_SIZE 8 #define MAX_TX_PROCESS 4 #define LOCAL_TXBUF_SIZE 2048 @@ -76,29 +76,29 @@ // #ifdef RTMP_MAC_PCI -#define TX_RING_SIZE 64 //64 +#define TX_RING_SIZE 64 //64 #define MGMT_RING_SIZE 128 -#define RX_RING_SIZE 128 //64 -#define MAX_TX_PROCESS TX_RING_SIZE //8 +#define RX_RING_SIZE 128 //64 +#define MAX_TX_PROCESS TX_RING_SIZE //8 #define MAX_DMA_DONE_PROCESS TX_RING_SIZE -#define MAX_TX_DONE_PROCESS TX_RING_SIZE //8 +#define MAX_TX_DONE_PROCESS TX_RING_SIZE //8 #define LOCAL_TXBUF_SIZE 2 #endif // RTMP_MAC_PCI // -#define MAX_RX_PROCESS 128 //64 //32 +#define MAX_RX_PROCESS 128 //64 //32 #define NUM_OF_LOCAL_TXBUF 2 #define TXD_SIZE 16 #define TXWI_SIZE 16 #define RXD_SIZE 16 #define RXWI_SIZE 16 // TXINFO_SIZE + TXWI_SIZE + 802.11 Header Size + AMSDU sub frame header -#define TX_DMA_1ST_BUFFER_SIZE 96 // only the 1st physical buffer is pre-allocated -#define MGMT_DMA_BUFFER_SIZE 1536 //2048 -#define RX_BUFFER_AGGRESIZE 3840 //3904 //3968 //4096 //2048 //4096 -#define RX_BUFFER_NORMSIZE 3840 //3904 //3968 //4096 //2048 //4096 +#define TX_DMA_1ST_BUFFER_SIZE 96 // only the 1st physical buffer is pre-allocated +#define MGMT_DMA_BUFFER_SIZE 1536 //2048 +#define RX_BUFFER_AGGRESIZE 3840 //3904 //3968 //4096 //2048 //4096 +#define RX_BUFFER_NORMSIZE 3840 //3904 //3968 //4096 //2048 //4096 #define TX_BUFFER_NORMSIZE RX_BUFFER_NORMSIZE -#define MAX_FRAME_SIZE 2346 // Maximum 802.11 frame size -#define MAX_AGGREGATION_SIZE 3840 //3904 //3968 //4096 +#define MAX_FRAME_SIZE 2346 // Maximum 802.11 frame size +#define MAX_AGGREGATION_SIZE 3840 //3904 //3968 //4096 #define MAX_NUM_OF_TUPLE_CACHE 2 #define MAX_MCAST_LIST_SIZE 32 #define MAX_LEN_OF_VENDOR_DESC 64 @@ -107,7 +107,6 @@ #define MAX_RX_PROCESS_CNT (RX_RING_SIZE) - /* WMM Note: If memory of your system is not much, please reduce the definition; or when you do WMM test, the queue for low priority AC will be full, i.e. @@ -127,12 +126,11 @@ clConfig.clNum = RX_RING_SIZE * 4; */ // TODO: For VxWorks the size is 256. Shall we cahnge the value as 256 for all OS????? -#define MAX_PACKETS_IN_QUEUE (512) //(512) // to pass WMM A5-WPAPSK +#define MAX_PACKETS_IN_QUEUE (512) //(512) // to pass WMM A5-WPAPSK #define MAX_PACKETS_IN_MCAST_PS_QUEUE 32 #define MAX_PACKETS_IN_PS_QUEUE 128 //32 -#define WMM_NUM_OF_AC 4 /* AC0, AC1, AC2, and AC3 */ - +#define WMM_NUM_OF_AC 4 /* AC0, AC1, AC2, and AC3 */ #ifdef RTMP_EFUSE_SUPPORT //2008/09/11:KH add to support efuse<-- @@ -189,8 +187,8 @@ #define fOP_STATUS_MEDIA_STATE_CONNECTED 0x00000080 #define fOP_STATUS_WMM_INUSED 0x00000100 #define fOP_STATUS_AGGREGATION_INUSED 0x00000200 -#define fOP_STATUS_DOZE 0x00000400 // debug purpose -#define fOP_STATUS_PIGGYBACK_INUSED 0x00000800 // piggy-back, and aggregation +#define fOP_STATUS_DOZE 0x00000400 // debug purpose +#define fOP_STATUS_PIGGYBACK_INUSED 0x00000800 // piggy-back, and aggregation #define fOP_STATUS_APSD_INUSED 0x00001000 #define fOP_STATUS_TX_AMSDU_INUSED 0x00002000 #define fOP_STATUS_MAX_RETRY_ENABLED 0x00004000 @@ -229,9 +227,9 @@ // // AP's client table operation status flags // -#define fCLIENT_STATUS_WMM_CAPABLE 0x00000001 // CLIENT can parse QOS DATA frame -#define fCLIENT_STATUS_AGGREGATION_CAPABLE 0x00000002 // CLIENT can receive Ralink's proprietary TX aggregation frame -#define fCLIENT_STATUS_PIGGYBACK_CAPABLE 0x00000004 // CLIENT support piggy-back +#define fCLIENT_STATUS_WMM_CAPABLE 0x00000001 // CLIENT can parse QOS DATA frame +#define fCLIENT_STATUS_AGGREGATION_CAPABLE 0x00000002 // CLIENT can receive Ralink's proprietary TX aggregation frame +#define fCLIENT_STATUS_PIGGYBACK_CAPABLE 0x00000004 // CLIENT support piggy-back #define fCLIENT_STATUS_AMSDU_INUSED 0x00000008 #define fCLIENT_STATUS_SGI20_CAPABLE 0x00000010 #define fCLIENT_STATUS_SGI40_CAPABLE 0x00000020 @@ -240,7 +238,7 @@ #define fCLIENT_STATUS_HTC_CAPABLE 0x00000100 #define fCLIENT_STATUS_RDG_CAPABLE 0x00000200 #define fCLIENT_STATUS_MCSFEEDBACK_CAPABLE 0x00000400 -#define fCLIENT_STATUS_APSD_CAPABLE 0x00000800 /* UAPSD STATION */ +#define fCLIENT_STATUS_APSD_CAPABLE 0x00000800 /* UAPSD STATION */ #define fCLIENT_STATUS_RALINK_CHIPSET 0x00100000 // @@ -303,10 +301,9 @@ #define ERRLOG_NO_INTERRUPT_RESOURCE 0x00000604L #define ERRLOG_NO_MEMORY_RESOURCE 0x00000605L - // WDS definition #define MAX_WDS_ENTRY 4 -#define WDS_PAIRWISE_KEY_OFFSET 60 // WDS links uses pairwise key#60 ~ 63 in ASIC pairwise key table +#define WDS_PAIRWISE_KEY_OFFSET 60 // WDS links uses pairwise key#60 ~ 63 in ASIC pairwise key table #define WDS_DISABLE_MODE 0 #define WDS_RESTRICT_MODE 1 @@ -314,7 +311,6 @@ #define WDS_REPEATER_MODE 3 #define WDS_LAZY_MODE 4 - #define MAX_MESH_NUM 0 #define MAX_APCLI_NUM 0 @@ -336,12 +332,11 @@ #define MAIN_MBSSID 0 #define FIRST_MBSSID 1 - #define MAX_BEACON_SIZE 512 // If the MAX_MBSSID_NUM is larger than 6, // it shall reserve some WCID space(wcid 222~253) for beacon frames. -// - these wcid 238~253 are reserved for beacon#6(ra6). -// - these wcid 222~237 are reserved for beacon#7(ra7). +// - these wcid 238~253 are reserved for beacon#6(ra6). +// - these wcid 222~237 are reserved for beacon#7(ra7). #if defined(MAX_MBSSID_NUM) && (MAX_MBSSID_NUM == 8) #define HW_RESERVED_WCID 222 #elif defined(MAX_MBSSID_NUM) && (MAX_MBSSID_NUM == 7) @@ -368,7 +363,6 @@ #define IsGroupKeyWCID(__wcid) (((__wcid) < LAST_SPECIFIC_WCID) && ((__wcid) >= (LAST_SPECIFIC_WCID - (MAX_MBSSID_NUM)))) - // definition to support multiple BSSID #define BSS0 0 #define BSS1 1 @@ -379,20 +373,19 @@ #define BSS6 6 #define BSS7 7 - //============================================================ // Length definitions #define PEER_KEY_NO 2 #define MAC_ADDR_LEN 6 #define TIMESTAMP_LEN 8 -#define MAX_LEN_OF_SUPPORTED_RATES MAX_LENGTH_OF_SUPPORT_RATES // 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 -#define MAX_LEN_OF_KEY 32 // 32 octets == 256 bits, Redefine for WPA -#define MAX_NUM_OF_CHANNELS MAX_NUM_OF_CHS // 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL termination -#define MAX_NUM_OF_11JCHANNELS 20 // 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL termination +#define MAX_LEN_OF_SUPPORTED_RATES MAX_LENGTH_OF_SUPPORT_RATES // 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 +#define MAX_LEN_OF_KEY 32 // 32 octets == 256 bits, Redefine for WPA +#define MAX_NUM_OF_CHANNELS MAX_NUM_OF_CHS // 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL termination +#define MAX_NUM_OF_11JCHANNELS 20 // 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL termination #define MAX_LEN_OF_SSID 32 #define CIPHER_TEXT_LEN 128 #define HASH_TABLE_SIZE 256 -#define MAX_VIE_LEN 1024 // New for WPA cipher suite variable IE sizes. +#define MAX_VIE_LEN 1024 // New for WPA cipher suite variable IE sizes. #define MAX_SUPPORT_MCS 32 #define MAX_NUM_OF_BBP_LATCH 140 @@ -413,7 +406,7 @@ #define MAX_NUM_OF_ACL_LIST MAX_NUMBER_OF_ACL -#define MAX_LEN_OF_MAC_TABLE MAX_NUMBER_OF_MAC // if MAX_MBSSID_NUM is 8, this value can't be larger than 211 +#define MAX_LEN_OF_MAC_TABLE MAX_NUMBER_OF_MAC // if MAX_MBSSID_NUM is 8, this value can't be larger than 211 #if MAX_LEN_OF_MAC_TABLE>MAX_AVAILABLE_CLIENT_WCID #error MAX_LEN_OF_MAC_TABLE can not be larger than MAX_AVAILABLE_CLIENT_WCID!!!! @@ -426,37 +419,36 @@ #define NUM_OF_TID 8 #define MAX_AID_BA 4 -#define MAX_LEN_OF_BA_REC_TABLE ((NUM_OF_TID * MAX_LEN_OF_MAC_TABLE)/2)// (NUM_OF_TID*MAX_AID_BA + 32) //Block ACK recipient -#define MAX_LEN_OF_BA_ORI_TABLE ((NUM_OF_TID * MAX_LEN_OF_MAC_TABLE)/2)// (NUM_OF_TID*MAX_AID_BA + 32) // Block ACK originator +#define MAX_LEN_OF_BA_REC_TABLE ((NUM_OF_TID * MAX_LEN_OF_MAC_TABLE)/2) // (NUM_OF_TID*MAX_AID_BA + 32) //Block ACK recipient +#define MAX_LEN_OF_BA_ORI_TABLE ((NUM_OF_TID * MAX_LEN_OF_MAC_TABLE)/2) // (NUM_OF_TID*MAX_AID_BA + 32) // Block ACK originator #define MAX_LEN_OF_BSS_TABLE 64 #define MAX_REORDERING_MPDU_NUM 512 // key related definitions #define SHARE_KEY_NUM 4 -#define MAX_LEN_OF_SHARE_KEY 16 // byte count -#define MAX_LEN_OF_PEER_KEY 16 // byte count -#define PAIRWISE_KEY_NUM 64 // in MAC ASIC pairwise key table +#define MAX_LEN_OF_SHARE_KEY 16 // byte count +#define MAX_LEN_OF_PEER_KEY 16 // byte count +#define PAIRWISE_KEY_NUM 64 // in MAC ASIC pairwise key table #define GROUP_KEY_NUM 4 #define PMK_LEN 32 -#define WDS_PAIRWISE_KEY_OFFSET 60 // WDS links uses pairwise key#60 ~ 63 in ASIC pairwise key table -#define PMKID_NO 4 // Number of PMKID saved supported +#define WDS_PAIRWISE_KEY_OFFSET 60 // WDS links uses pairwise key#60 ~ 63 in ASIC pairwise key table +#define PMKID_NO 4 // Number of PMKID saved supported #define MAX_LEN_OF_MLME_BUFFER 2048 // power status related definitions #define PWR_ACTIVE 0 #define PWR_SAVE 1 -#define PWR_MMPS 2 //MIMO power save +#define PWR_MMPS 2 //MIMO power save // Auth and Assoc mode related definitions #define AUTH_MODE_OPEN 0x00 #define AUTH_MODE_KEY 0x01 // BSS Type definitions -#define BSS_ADHOC 0 // = Ndis802_11IBSS -#define BSS_INFRA 1 // = Ndis802_11Infrastructure -#define BSS_ANY 2 // = Ndis802_11AutoUnknown -#define BSS_MONITOR 3 // = Ndis802_11Monitor - +#define BSS_ADHOC 0 // = Ndis802_11IBSS +#define BSS_INFRA 1 // = Ndis802_11Infrastructure +#define BSS_ANY 2 // = Ndis802_11AutoUnknown +#define BSS_MONITOR 3 // = Ndis802_11Monitor // Reason code definitions #define REASON_RESERVED 0 @@ -533,65 +525,63 @@ #define IE_CF_PARM 4 #define IE_TIM 5 #define IE_IBSS_PARM 6 -#define IE_COUNTRY 7 // 802.11d -#define IE_802_11D_REQUEST 10 // 802.11d -#define IE_QBSS_LOAD 11 // 802.11e d9 -#define IE_EDCA_PARAMETER 12 // 802.11e d9 -#define IE_TSPEC 13 // 802.11e d9 -#define IE_TCLAS 14 // 802.11e d9 -#define IE_SCHEDULE 15 // 802.11e d9 +#define IE_COUNTRY 7 // 802.11d +#define IE_802_11D_REQUEST 10 // 802.11d +#define IE_QBSS_LOAD 11 // 802.11e d9 +#define IE_EDCA_PARAMETER 12 // 802.11e d9 +#define IE_TSPEC 13 // 802.11e d9 +#define IE_TCLAS 14 // 802.11e d9 +#define IE_SCHEDULE 15 // 802.11e d9 #define IE_CHALLENGE_TEXT 16 -#define IE_POWER_CONSTRAINT 32 // 802.11h d3.3 -#define IE_POWER_CAPABILITY 33 // 802.11h d3.3 -#define IE_TPC_REQUEST 34 // 802.11h d3.3 -#define IE_TPC_REPORT 35 // 802.11h d3.3 -#define IE_SUPP_CHANNELS 36 // 802.11h d3.3 -#define IE_CHANNEL_SWITCH_ANNOUNCEMENT 37 // 802.11h d3.3 -#define IE_MEASUREMENT_REQUEST 38 // 802.11h d3.3 -#define IE_MEASUREMENT_REPORT 39 // 802.11h d3.3 -#define IE_QUIET 40 // 802.11h d3.3 -#define IE_IBSS_DFS 41 // 802.11h d3.3 -#define IE_ERP 42 // 802.11g -#define IE_TS_DELAY 43 // 802.11e d9 -#define IE_TCLAS_PROCESSING 44 // 802.11e d9 -#define IE_QOS_CAPABILITY 46 // 802.11e d6 -#define IE_HT_CAP 45 // 802.11n d1. HT CAPABILITY. ELEMENT ID TBD -#define IE_AP_CHANNEL_REPORT 51 // 802.11k d6 -#define IE_HT_CAP2 52 // 802.11n d1. HT CAPABILITY. ELEMENT ID TBD -#define IE_RSN 48 // 802.11i d3.0 -#define IE_WPA2 48 // WPA2 -#define IE_EXT_SUPP_RATES 50 // 802.11g -#define IE_SUPP_REG_CLASS 59 // 802.11y. Supported regulatory classes. +#define IE_POWER_CONSTRAINT 32 // 802.11h d3.3 +#define IE_POWER_CAPABILITY 33 // 802.11h d3.3 +#define IE_TPC_REQUEST 34 // 802.11h d3.3 +#define IE_TPC_REPORT 35 // 802.11h d3.3 +#define IE_SUPP_CHANNELS 36 // 802.11h d3.3 +#define IE_CHANNEL_SWITCH_ANNOUNCEMENT 37 // 802.11h d3.3 +#define IE_MEASUREMENT_REQUEST 38 // 802.11h d3.3 +#define IE_MEASUREMENT_REPORT 39 // 802.11h d3.3 +#define IE_QUIET 40 // 802.11h d3.3 +#define IE_IBSS_DFS 41 // 802.11h d3.3 +#define IE_ERP 42 // 802.11g +#define IE_TS_DELAY 43 // 802.11e d9 +#define IE_TCLAS_PROCESSING 44 // 802.11e d9 +#define IE_QOS_CAPABILITY 46 // 802.11e d6 +#define IE_HT_CAP 45 // 802.11n d1. HT CAPABILITY. ELEMENT ID TBD +#define IE_AP_CHANNEL_REPORT 51 // 802.11k d6 +#define IE_HT_CAP2 52 // 802.11n d1. HT CAPABILITY. ELEMENT ID TBD +#define IE_RSN 48 // 802.11i d3.0 +#define IE_WPA2 48 // WPA2 +#define IE_EXT_SUPP_RATES 50 // 802.11g +#define IE_SUPP_REG_CLASS 59 // 802.11y. Supported regulatory classes. #define IE_EXT_CHANNEL_SWITCH_ANNOUNCEMENT 60 // 802.11n -#define IE_ADD_HT 61 // 802.11n d1. ADDITIONAL HT CAPABILITY. ELEMENT ID TBD -#define IE_ADD_HT2 53 // 802.11n d1. ADDITIONAL HT CAPABILITY. ELEMENT ID TBD - +#define IE_ADD_HT 61 // 802.11n d1. ADDITIONAL HT CAPABILITY. ELEMENT ID TBD +#define IE_ADD_HT2 53 // 802.11n d1. ADDITIONAL HT CAPABILITY. ELEMENT ID TBD // For 802.11n D3.03 //#define IE_NEW_EXT_CHA_OFFSET 62 // 802.11n d1. New extension channel offset elemet -#define IE_SECONDARY_CH_OFFSET 62 // 802.11n D3.03 Secondary Channel Offset element -#define IE_WAPI 68 // WAPI information element -#define IE_2040_BSS_COEXIST 72 // 802.11n D3.0.3 -#define IE_2040_BSS_INTOLERANT_REPORT 73 // 802.11n D3.03 -#define IE_OVERLAPBSS_SCAN_PARM 74 // 802.11n D3.03 -#define IE_EXT_CAPABILITY 127 // 802.11n D3.03 - +#define IE_SECONDARY_CH_OFFSET 62 // 802.11n D3.03 Secondary Channel Offset element +#define IE_WAPI 68 // WAPI information element +#define IE_2040_BSS_COEXIST 72 // 802.11n D3.0.3 +#define IE_2040_BSS_INTOLERANT_REPORT 73 // 802.11n D3.03 +#define IE_OVERLAPBSS_SCAN_PARM 74 // 802.11n D3.03 +#define IE_EXT_CAPABILITY 127 // 802.11n D3.03 -#define IE_WPA 221 // WPA -#define IE_VENDOR_SPECIFIC 221 // Wifi WMM (WME) +#define IE_WPA 221 // WPA +#define IE_VENDOR_SPECIFIC 221 // Wifi WMM (WME) -#define OUI_BROADCOM_HT 51 // -#define OUI_BROADCOM_HTADD 52 // -#define OUI_PREN_HT_CAP 51 // -#define OUI_PREN_ADD_HT 52 // +#define OUI_BROADCOM_HT 51 // +#define OUI_BROADCOM_HTADD 52 // +#define OUI_PREN_HT_CAP 51 // +#define OUI_PREN_ADD_HT 52 // // CCX information -#define IE_AIRONET_CKIP 133 // CCX1.0 ID 85H for CKIP -#define IE_AP_TX_POWER 150 // CCX 2.0 for AP transmit power -#define IE_MEASUREMENT_CAPABILITY 221 // CCX 2.0 +#define IE_AIRONET_CKIP 133 // CCX1.0 ID 85H for CKIP +#define IE_AP_TX_POWER 150 // CCX 2.0 for AP transmit power +#define IE_MEASUREMENT_CAPABILITY 221 // CCX 2.0 #define IE_CCX_V2 221 -#define IE_AIRONET_IPADDRESS 149 // CCX ID 95H for IP Address -#define IE_AIRONET_CCKMREASSOC 156 // CCX ID 9CH for CCKM Reassociation Request element +#define IE_AIRONET_IPADDRESS 149 // CCX ID 95H for IP Address +#define IE_AIRONET_CCKMREASSOC 156 // CCX ID 9CH for CCKM Reassociation Request element #define CKIP_NEGOTIATION_LENGTH 30 #define AIRONET_IPADDRESS_LENGTH 10 #define AIRONET_CCKMREASSOC_LENGTH 24 @@ -619,11 +609,8 @@ #define WSC_STATE_MACHINE 17 #define WSC_UPNP_STATE_MACHINE 18 - #define WPA_STATE_MACHINE 23 - - // // STA's CONTROL/CONNECT state machine: states, events, total function # // @@ -700,10 +687,9 @@ #define MT2_PEER_PUBLIC_CATE 4 #define MT2_PEER_RM_CATE 5 /* "FT_CATEGORY_BSS_TRANSITION equal to 6" is defined file of "dot11r_ft.h" */ -#define MT2_PEER_HT_CATE 7 // 7.4.7 +#define MT2_PEER_HT_CATE 7 // 7.4.7 #define MAX_PEER_CATE_MSG 7 - #define MT2_MLME_ADD_BA_CATE 8 #define MT2_MLME_ORI_DELBA_CATE 9 #define MT2_MLME_REC_DELBA_CATE 10 @@ -721,7 +707,6 @@ #define CATEGORY_RM 5 #define CATEGORY_HT 7 - // DLS Action frame definition #define ACTION_DLS_REQUEST 0 #define ACTION_DLS_RESPONSE 1 @@ -734,7 +719,6 @@ #define SPEC_TPCRP 3 #define SPEC_CHANNEL_SWITCH 4 - //BA Action field value #define ADDBA_REQ 0 #define ADDBA_RESP 1 @@ -748,10 +732,9 @@ #define ACTION_EXT_CH_SWITCH_ANNOUNCE 4 // 11y D9.0 #define ACTION_DSE_MEASUREMENT_REQ 5 // 11y D9.0 #define ACTION_DSE_MEASUREMENT_REPORT 6 // 11y D9.0 -#define ACTION_MEASUREMENT_PILOT_ACTION 7 // 11y D9.0 +#define ACTION_MEASUREMENT_PILOT_ACTION 7 // 11y D9.0 #define ACTION_DSE_POWER_CONSTRAINT 8 // 11y D9.0 - //HT Action field value #define NOTIFY_BW_ACTION 0 #define SMPS_ACTION 1 @@ -798,7 +781,7 @@ // // STA's SYNC state machine: states, events, total function # // -#define SYNC_IDLE 0 // merge NO_BSS,IBSS_IDLE,IBSS_ACTIVE and BSS in to 1 state +#define SYNC_IDLE 0 // merge NO_BSS,IBSS_IDLE,IBSS_ACTIVE and BSS in to 1 state #define JOIN_WAIT_BEACON 1 #define SCAN_LISTEN 2 #define MAX_SYNC_STATE 3 @@ -907,8 +890,6 @@ #define WPA_FUNC_SIZE (MAX_WPA_PTK_STATE * MAX_WPA_MSG) - - // ============================================================================= // value domain of 802.11 header FC.Tyte, which is b3..b2 of the 1st-byte of MAC header @@ -961,10 +942,10 @@ #define SUBTYPE_QOS_CFACK_CFPOLL 15 // ACK policy of QOS Control field bit 6:5 -#define NORMAL_ACK 0x00 // b6:5 = 00 -#define NO_ACK 0x20 // b6:5 = 01 -#define NO_EXPLICIT_ACK 0x40 // b6:5 = 10 -#define BLOCK_ACK 0x60 // b6:5 = 11 +#define NORMAL_ACK 0x00 // b6:5 = 00 +#define NO_ACK 0x20 // b6:5 = 01 +#define NO_EXPLICIT_ACK 0x40 // b6:5 = 10 +#define BLOCK_ACK 0x60 // b6:5 = 11 // // rtmp_data.c use these definition @@ -982,7 +963,7 @@ #define LENGTH_CRC 4 #define MAX_SEQ_NUMBER 0x0fff #define LENGTH_802_3_NO_TYPE 12 -#define LENGTH_802_1Q 4 /* VLAN related */ +#define LENGTH_802_1Q 4 /* VLAN related */ // STA_CSR4.field.TxResult #define TX_RESULT_SUCCESS 0 @@ -999,23 +980,23 @@ #define MODE_HTGREENFIELD 3 // MCS for CCK. BW.SGI.STBC are reserved -#define MCS_LONGP_RATE_1 0 // long preamble CCK 1Mbps +#define MCS_LONGP_RATE_1 0 // long preamble CCK 1Mbps #define MCS_LONGP_RATE_2 1 // long preamble CCK 1Mbps #define MCS_LONGP_RATE_5_5 2 #define MCS_LONGP_RATE_11 3 -#define MCS_SHORTP_RATE_1 4 // long preamble CCK 1Mbps. short is forbidden in 1Mbps +#define MCS_SHORTP_RATE_1 4 // long preamble CCK 1Mbps. short is forbidden in 1Mbps #define MCS_SHORTP_RATE_2 5 // short preamble CCK 2Mbps #define MCS_SHORTP_RATE_5_5 6 #define MCS_SHORTP_RATE_11 7 // To send duplicate legacy OFDM. set BW=BW_40. SGI.STBC are reserved -#define MCS_RATE_6 0 // legacy OFDM -#define MCS_RATE_9 1 // OFDM -#define MCS_RATE_12 2 // OFDM -#define MCS_RATE_18 3 // OFDM -#define MCS_RATE_24 4 // OFDM -#define MCS_RATE_36 5 // OFDM -#define MCS_RATE_48 6 // OFDM -#define MCS_RATE_54 7 // OFDM +#define MCS_RATE_6 0 // legacy OFDM +#define MCS_RATE_9 1 // OFDM +#define MCS_RATE_12 2 // OFDM +#define MCS_RATE_18 3 // OFDM +#define MCS_RATE_24 4 // OFDM +#define MCS_RATE_36 5 // OFDM +#define MCS_RATE_48 6 // OFDM +#define MCS_RATE_54 7 // OFDM // HT #define MCS_0 0 // 1S #define MCS_1 1 @@ -1070,7 +1051,7 @@ #define RXSTBC_TWO 2 // rx support of 1 and 2 spatial stream #define RXSTBC_THR 3 // rx support of 1~3 spatial stream // MCS FEEDBACK -#define MCSFBK_NONE 0 // not support mcs feedback / +#define MCSFBK_NONE 0 // not support mcs feedback / #define MCSFBK_RSV 1 // reserved #define MCSFBK_UNSOLICIT 2 // only support unsolict mcs feedback #define MCSFBK_MRQ 3 // response to both MRQ and unsolict mcs feedback @@ -1081,7 +1062,6 @@ #define MMPS_RSV 2 #define MMPS_ENABLE 3 - // A-MSDU size #define AMSDU_0 0 #define AMSDU_1 1 @@ -1094,28 +1074,28 @@ #define RATE_2 1 #define RATE_5_5 2 #define RATE_11 3 -#define RATE_6 4 // OFDM -#define RATE_9 5 // OFDM -#define RATE_12 6 // OFDM -#define RATE_18 7 // OFDM -#define RATE_24 8 // OFDM -#define RATE_36 9 // OFDM -#define RATE_48 10 // OFDM -#define RATE_54 11 // OFDM +#define RATE_6 4 // OFDM +#define RATE_9 5 // OFDM +#define RATE_12 6 // OFDM +#define RATE_18 7 // OFDM +#define RATE_24 8 // OFDM +#define RATE_36 9 // OFDM +#define RATE_48 10 // OFDM +#define RATE_54 11 // OFDM #define RATE_FIRST_OFDM_RATE RATE_6 #define RATE_LAST_OFDM_RATE RATE_54 -#define RATE_6_5 12 // HT mix -#define RATE_13 13 // HT mix -#define RATE_19_5 14 // HT mix -#define RATE_26 15 // HT mix -#define RATE_39 16 // HT mix -#define RATE_52 17 // HT mix -#define RATE_58_5 18 // HT mix -#define RATE_65 19 // HT mix -#define RATE_78 20 // HT mix -#define RATE_104 21 // HT mix -#define RATE_117 22 // HT mix -#define RATE_130 23 // HT mix +#define RATE_6_5 12 // HT mix +#define RATE_13 13 // HT mix +#define RATE_19_5 14 // HT mix +#define RATE_26 15 // HT mix +#define RATE_39 16 // HT mix +#define RATE_52 17 // HT mix +#define RATE_58_5 18 // HT mix +#define RATE_65 19 // HT mix +#define RATE_78 20 // HT mix +#define RATE_104 21 // HT mix +#define RATE_117 22 // HT mix +#define RATE_130 23 // HT mix //#define RATE_AUTO_SWITCH 255 // for StaCfg.FixedTxRate only #define HTRATE_0 12 #define RATE_FIRST_MM_RATE HTRATE_0 @@ -1134,34 +1114,34 @@ // Country Region definition #define REGION_MINIMUM_BG_BAND 0 -#define REGION_0_BG_BAND 0 // 1-11 -#define REGION_1_BG_BAND 1 // 1-13 -#define REGION_2_BG_BAND 2 // 10-11 -#define REGION_3_BG_BAND 3 // 10-13 -#define REGION_4_BG_BAND 4 // 14 -#define REGION_5_BG_BAND 5 // 1-14 -#define REGION_6_BG_BAND 6 // 3-9 -#define REGION_7_BG_BAND 7 // 5-13 -#define REGION_31_BG_BAND 31 // 5-13 +#define REGION_0_BG_BAND 0 // 1-11 +#define REGION_1_BG_BAND 1 // 1-13 +#define REGION_2_BG_BAND 2 // 10-11 +#define REGION_3_BG_BAND 3 // 10-13 +#define REGION_4_BG_BAND 4 // 14 +#define REGION_5_BG_BAND 5 // 1-14 +#define REGION_6_BG_BAND 6 // 3-9 +#define REGION_7_BG_BAND 7 // 5-13 +#define REGION_31_BG_BAND 31 // 5-13 #define REGION_MAXIMUM_BG_BAND 7 #define REGION_MINIMUM_A_BAND 0 -#define REGION_0_A_BAND 0 // 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165 -#define REGION_1_A_BAND 1 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 -#define REGION_2_A_BAND 2 // 36, 40, 44, 48, 52, 56, 60, 64 -#define REGION_3_A_BAND 3 // 52, 56, 60, 64, 149, 153, 157, 161 -#define REGION_4_A_BAND 4 // 149, 153, 157, 161, 165 -#define REGION_5_A_BAND 5 // 149, 153, 157, 161 -#define REGION_6_A_BAND 6 // 36, 40, 44, 48 -#define REGION_7_A_BAND 7 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173 -#define REGION_8_A_BAND 8 // 52, 56, 60, 64 -#define REGION_9_A_BAND 9 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165 -#define REGION_10_A_BAND 10 // 36, 40, 44, 48, 149, 153, 157, 161, 165 -#define REGION_11_A_BAND 11 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 149, 153, 157, 161 -#define REGION_12_A_BAND 12 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 -#define REGION_13_A_BAND 13 // 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161 -#define REGION_14_A_BAND 14 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 136, 140, 149, 153, 157, 161, 165 -#define REGION_15_A_BAND 15 // 149, 153, 157, 161, 165, 169, 173 +#define REGION_0_A_BAND 0 // 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165 +#define REGION_1_A_BAND 1 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 +#define REGION_2_A_BAND 2 // 36, 40, 44, 48, 52, 56, 60, 64 +#define REGION_3_A_BAND 3 // 52, 56, 60, 64, 149, 153, 157, 161 +#define REGION_4_A_BAND 4 // 149, 153, 157, 161, 165 +#define REGION_5_A_BAND 5 // 149, 153, 157, 161 +#define REGION_6_A_BAND 6 // 36, 40, 44, 48 +#define REGION_7_A_BAND 7 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173 +#define REGION_8_A_BAND 8 // 52, 56, 60, 64 +#define REGION_9_A_BAND 9 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165 +#define REGION_10_A_BAND 10 // 36, 40, 44, 48, 149, 153, 157, 161, 165 +#define REGION_11_A_BAND 11 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 149, 153, 157, 161 +#define REGION_12_A_BAND 12 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 +#define REGION_13_A_BAND 13 // 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161 +#define REGION_14_A_BAND 14 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 136, 140, 149, 153, 157, 161, 165 +#define REGION_15_A_BAND 15 // 149, 153, 157, 161, 165, 169, 173 #define REGION_MAXIMUM_A_BAND 15 // pTxD->CipherAlg @@ -1172,10 +1152,9 @@ #define CIPHER_AES 4 #define CIPHER_CKIP64 5 #define CIPHER_CKIP128 6 -#define CIPHER_TKIP_NO_MIC 7 // MIC appended by driver: not a valid value in hardware key table +#define CIPHER_TKIP_NO_MIC 7 // MIC appended by driver: not a valid value in hardware key table #define CIPHER_SMS4 8 - // LED Status. #define LED_LINK_DOWN 0 #define LED_LINK_UP 1 @@ -1189,11 +1168,11 @@ // value domain of pAd->LedCntl.LedMode and E2PROM #define LED_MODE_DEFAULT 0 #define LED_MODE_TWO_LED 1 -//#define LED_MODE_SIGNAL_STREGTH 8 // EEPROM define =8 -#define LED_MODE_SIGNAL_STREGTH 0x40 // EEPROM define = 64 +//#define LED_MODE_SIGNAL_STREGTH 8 // EEPROM define =8 +#define LED_MODE_SIGNAL_STREGTH 0x40 // EEPROM define = 64 // RC4 init value, used fro WEP & TKIP -#define PPPINITFCS32 0xffffffff /* Initial FCS value */ +#define PPPINITFCS32 0xffffffff /* Initial FCS value */ // value domain of pAd->StaCfg.PortSecured. 802.1X controlled port definition #define WPA_802_1X_PORT_SECURED 1 @@ -1205,7 +1184,6 @@ //definition of DRS #define MAX_STEP_OF_TX_RATE_SWITCH 32 - // pre-allocated free NDIS PACKET/BUFFER poll for internal usage #define MAX_NUM_OF_FREE_NDIS_PACKET 128 @@ -1223,7 +1201,7 @@ #define DEFAULT_RF_TX_POWER 5 #define MAX_INI_BUFFER_SIZE 4096 -#define MAX_PARAM_BUFFER_SIZE (2048) // enough for ACL (18*64) +#define MAX_PARAM_BUFFER_SIZE (2048) // enough for ACL (18*64) //18 : the length of Mac address acceptable format "01:02:03:04:05:06;") //64 : MAX_NUM_OF_ACL_LIST // definition of pAd->OpMode @@ -1233,10 +1211,10 @@ // ========================= AP rtmp_def.h =========================== // value domain for pAd->EventTab.Log[].Event -#define EVENT_RESET_ACCESS_POINT 0 // Log = "hh:mm:ss Restart Access Point" -#define EVENT_ASSOCIATED 1 // Log = "hh:mm:ss STA 00:01:02:03:04:05 associated" -#define EVENT_DISASSOCIATED 2 // Log = "hh:mm:ss STA 00:01:02:03:04:05 left this BSS" -#define EVENT_AGED_OUT 3 // Log = "hh:mm:ss STA 00:01:02:03:04:05 was aged-out and removed from this BSS" +#define EVENT_RESET_ACCESS_POINT 0 // Log = "hh:mm:ss Restart Access Point" +#define EVENT_ASSOCIATED 1 // Log = "hh:mm:ss STA 00:01:02:03:04:05 associated" +#define EVENT_DISASSOCIATED 2 // Log = "hh:mm:ss STA 00:01:02:03:04:05 left this BSS" +#define EVENT_AGED_OUT 3 // Log = "hh:mm:ss STA 00:01:02:03:04:05 was aged-out and removed from this BSS" #define EVENT_COUNTER_M 4 #define EVENT_INVALID_PSK 5 #define EVENT_MAX_EVENT_TYPE 6 @@ -1262,7 +1240,6 @@ // MBSSID definition #define ENTRY_NOT_FOUND 0xFF - /* After Linux 2.6.9, * VLAN module use Private (from user) interface flags (netdevice->priv_flags). * #define IFF_802_1Q_VLAN 0x1 -- 802.1Q VLAN device. in if.h @@ -1282,13 +1259,10 @@ #define INF_APCLI_DEV_NAME "apcli" #define INF_MESH_DEV_NAME "mesh" - // WEP Key TYPE #define WEP_HEXADECIMAL_TYPE 0 #define WEP_ASCII_TYPE 1 - - // WIRELESS EVENTS definition /* Max number of char in custom event, refer to wireless_tools.28/wireless.20.h */ #define IW_CUSTOM_MAX_LEN 255 /* In bytes */ @@ -1375,7 +1349,6 @@ #define GUI_IDLE_POWER_SAVE 3 // -- - // definition for WpaSupport flag #define WPA_SUPPLICANT_DISABLE 0 #define WPA_SUPPLICANT_ENABLE 1 @@ -1418,10 +1391,8 @@ #define cpu2be16(x) SWAP16((x)) #define be2cpu16(x) SWAP16((x)) - #define ABS(_x, _y) ((_x) > (_y)) ? ((_x) -(_y)) : ((_y) -(_x)) - #define A2Dec(_X, _p) \ { \ UCHAR *p; \ @@ -1435,7 +1406,6 @@ } \ } - #define A2Hex(_X, _p) \ do{ \ char *__p; \ @@ -1453,6 +1423,4 @@ do{ \ } \ }while(0) -#endif // __RTMP_DEF_H__ - - +#endif // __RTMP_DEF_H__ diff --git a/drivers/staging/rt2860/rtmp_dot11.h b/drivers/staging/rt2860/rtmp_dot11.h index f6887a83ea2c..051840f8822e 100644 --- a/drivers/staging/rt2860/rtmp_dot11.h +++ b/drivers/staging/rt2860/rtmp_dot11.h @@ -30,73 +30,71 @@ #include "rtmp_type.h" - // 4-byte HTC field. maybe included in any frame except non-QOS data frame. The Order bit must set 1. typedef struct PACKED { - UINT32 MA:1; //management action payload exist in (QoS Null+HTC) - UINT32 TRQ:1; //sounding request - UINT32 MRQ:1; //MCS feedback. Request for a MCS feedback - UINT32 MRSorASI:3; // MRQ Sequence identifier. unchanged during entire procedure. 0x000-0x110. - UINT32 MFS:3; //SET to the received value of MRS. 0x111 for unsolicited MFB. - UINT32 MFBorASC:7; //Link adaptation feedback containing recommended MCS. 0x7f for no feedback or not available - UINT32 CalPos:2; // calibration position - UINT32 CalSeq:2; //calibration sequence - UINT32 FBKReq:2; //feedback request - UINT32 CSISTEERING:2; //CSI/ STEERING - UINT32 ZLFAnnouce:1; // ZLF announcement - UINT32 rsv:5; //calibration sequence - UINT32 ACConstraint:1; //feedback request - UINT32 RDG:1; //RDG / More PPDU + UINT32 MA:1; //management action payload exist in (QoS Null+HTC) + UINT32 TRQ:1; //sounding request + UINT32 MRQ:1; //MCS feedback. Request for a MCS feedback + UINT32 MRSorASI:3; // MRQ Sequence identifier. unchanged during entire procedure. 0x000-0x110. + UINT32 MFS:3; //SET to the received value of MRS. 0x111 for unsolicited MFB. + UINT32 MFBorASC:7; //Link adaptation feedback containing recommended MCS. 0x7f for no feedback or not available + UINT32 CalPos:2; // calibration position + UINT32 CalSeq:2; //calibration sequence + UINT32 FBKReq:2; //feedback request + UINT32 CSISTEERING:2; //CSI/ STEERING + UINT32 ZLFAnnouce:1; // ZLF announcement + UINT32 rsv:5; //calibration sequence + UINT32 ACConstraint:1; //feedback request + UINT32 RDG:1; //RDG / More PPDU } HT_CONTROL, *PHT_CONTROL; // 2-byte QOS CONTROL field typedef struct PACKED { - USHORT TID:4; - USHORT EOSP:1; - USHORT AckPolicy:2; //0: normal ACK 1:No ACK 2:scheduled under MTBA/PSMP 3: BA - USHORT AMsduPresent:1; - USHORT Txop_QueueSize:8; + USHORT TID:4; + USHORT EOSP:1; + USHORT AckPolicy:2; //0: normal ACK 1:No ACK 2:scheduled under MTBA/PSMP 3: BA + USHORT AMsduPresent:1; + USHORT Txop_QueueSize:8; } QOS_CONTROL, *PQOS_CONTROL; - // 2-byte Frame control field -typedef struct PACKED { - USHORT Ver:2; // Protocol version - USHORT Type:2; // MSDU type - USHORT SubType:4; // MSDU subtype - USHORT ToDs:1; // To DS indication - USHORT FrDs:1; // From DS indication - USHORT MoreFrag:1; // More fragment bit - USHORT Retry:1; // Retry status bit - USHORT PwrMgmt:1; // Power management bit - USHORT MoreData:1; // More data bit - USHORT Wep:1; // Wep data - USHORT Order:1; // Strict order expected +typedef struct PACKED { + USHORT Ver:2; // Protocol version + USHORT Type:2; // MSDU type + USHORT SubType:4; // MSDU subtype + USHORT ToDs:1; // To DS indication + USHORT FrDs:1; // From DS indication + USHORT MoreFrag:1; // More fragment bit + USHORT Retry:1; // Retry status bit + USHORT PwrMgmt:1; // Power management bit + USHORT MoreData:1; // More data bit + USHORT Wep:1; // Wep data + USHORT Order:1; // Strict order expected } FRAME_CONTROL, *PFRAME_CONTROL; -typedef struct PACKED _HEADER_802_11 { - FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; - UCHAR Addr3[MAC_ADDR_LEN]; - USHORT Frag:4; - USHORT Sequence:12; - UCHAR Octet[0]; -} HEADER_802_11, *PHEADER_802_11; +typedef struct PACKED _HEADER_802_11 { + FRAME_CONTROL FC; + USHORT Duration; + UCHAR Addr1[MAC_ADDR_LEN]; + UCHAR Addr2[MAC_ADDR_LEN]; + UCHAR Addr3[MAC_ADDR_LEN]; + USHORT Frag:4; + USHORT Sequence:12; + UCHAR Octet[0]; +} HEADER_802_11, *PHEADER_802_11; typedef struct PACKED _PSPOLL_FRAME { - FRAME_CONTROL FC; - USHORT Aid; - UCHAR Bssid[MAC_ADDR_LEN]; - UCHAR Ta[MAC_ADDR_LEN]; -} PSPOLL_FRAME, *PPSPOLL_FRAME; + FRAME_CONTROL FC; + USHORT Aid; + UCHAR Bssid[MAC_ADDR_LEN]; + UCHAR Ta[MAC_ADDR_LEN]; +} PSPOLL_FRAME, *PPSPOLL_FRAME; -typedef struct PACKED _RTS_FRAME { - FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; -}RTS_FRAME, *PRTS_FRAME; +typedef struct PACKED _RTS_FRAME { + FRAME_CONTROL FC; + USHORT Duration; + UCHAR Addr1[MAC_ADDR_LEN]; + UCHAR Addr2[MAC_ADDR_LEN]; +} RTS_FRAME, *PRTS_FRAME; #endif // __DOT11_BASE_H__ // diff --git a/drivers/staging/rt2860/rtmp_iface.h b/drivers/staging/rt2860/rtmp_iface.h index c24ece5b7244..eee17d468442 100644 --- a/drivers/staging/rt2860/rtmp_iface.h +++ b/drivers/staging/rt2860/rtmp_iface.h @@ -37,7 +37,6 @@ #ifndef __RTMP_IFACE_H__ #define __RTMP_IFACE_H__ - #ifdef RTMP_PCI_SUPPORT #include "iface/rtmp_pci.h" #endif // RTMP_PCI_SUPPORT // @@ -45,40 +44,32 @@ #include "iface/rtmp_usb.h" #endif // RTMP_USB_SUPPORT // -typedef struct _INF_PCI_CONFIG_ -{ - unsigned long CSRBaseAddress; // PCI MMIO Base Address, all access will use - unsigned int irq_num; -}INF_PCI_CONFIG; - - -typedef struct _INF_USB_CONFIG_ -{ - UINT8 BulkInEpAddr; // bulk-in endpoint address - UINT8 BulkOutEpAddr[6]; // bulk-out endpoint address -}INF_USB_CONFIG; +typedef struct _INF_PCI_CONFIG_ { + unsigned long CSRBaseAddress; // PCI MMIO Base Address, all access will use + unsigned int irq_num; +} INF_PCI_CONFIG; +typedef struct _INF_USB_CONFIG_ { + UINT8 BulkInEpAddr; // bulk-in endpoint address + UINT8 BulkOutEpAddr[6]; // bulk-out endpoint address +} INF_USB_CONFIG; -typedef struct _INF_RBUS_CONFIG_ -{ - unsigned long csr_addr; - unsigned int irq; -}INF_RBUS_CONFIG; +typedef struct _INF_RBUS_CONFIG_ { + unsigned long csr_addr; + unsigned int irq; +} INF_RBUS_CONFIG; - -typedef enum _RTMP_INF_TYPE_ -{ +typedef enum _RTMP_INF_TYPE_ { RTMP_DEV_INF_UNKNOWN = 0, RTMP_DEV_INF_PCI = 1, RTMP_DEV_INF_USB = 2, RTMP_DEV_INF_RBUS = 4, -}RTMP_INF_TYPE; - +} RTMP_INF_TYPE; -typedef union _RTMP_INF_CONFIG_{ - struct _INF_PCI_CONFIG_ pciConfig; - struct _INF_USB_CONFIG_ usbConfig; - struct _INF_RBUS_CONFIG_ rbusConfig; -}RTMP_INF_CONFIG; +typedef union _RTMP_INF_CONFIG_ { + struct _INF_PCI_CONFIG_ pciConfig; + struct _INF_USB_CONFIG_ usbConfig; + struct _INF_RBUS_CONFIG_ rbusConfig; +} RTMP_INF_CONFIG; #endif // __RTMP_IFACE_H__ // diff --git a/drivers/staging/rt2860/rtmp_mcu.h b/drivers/staging/rt2860/rtmp_mcu.h index e1b2fee9e105..98dea1bb5788 100644 --- a/drivers/staging/rt2860/rtmp_mcu.h +++ b/drivers/staging/rt2860/rtmp_mcu.h @@ -38,18 +38,12 @@ #ifndef __RTMP_MCU_H__ #define __RTMP_MCU_H__ +INT RtmpAsicEraseFirmware(IN PRTMP_ADAPTER pAd); -INT RtmpAsicEraseFirmware( - IN PRTMP_ADAPTER pAd); +NDIS_STATUS RtmpAsicLoadFirmware(IN PRTMP_ADAPTER pAd); -NDIS_STATUS RtmpAsicLoadFirmware( - IN PRTMP_ADAPTER pAd); - -INT RtmpAsicSendCommandToMcu( - IN PRTMP_ADAPTER pAd, - IN UCHAR Command, - IN UCHAR Token, - IN UCHAR Arg0, - IN UCHAR Arg1); +INT RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, + IN UCHAR Command, + IN UCHAR Token, IN UCHAR Arg0, IN UCHAR Arg1); #endif // __RTMP_MCU_H__ // diff --git a/drivers/staging/rt2860/rtmp_os.h b/drivers/staging/rt2860/rtmp_os.h index 350621d59d1b..82b60fc6c260 100644 --- a/drivers/staging/rt2860/rtmp_os.h +++ b/drivers/staging/rt2860/rtmp_os.h @@ -34,7 +34,6 @@ --------- ---------- ---------------------------------------------- */ - #ifndef __RTMP_OS_H__ #define __RTMP_OS_H__ @@ -42,8 +41,6 @@ #include "rt_linux.h" #endif // LINUX // - - /* This data structure mainly strip some callback function defined in "struct net_device" in kernel source "include/linux/netdevice.h". @@ -51,46 +48,41 @@ The definition of this data structure may various depends on different OS. Use it carefully. */ -typedef struct _RTMP_OS_NETDEV_OP_HOOK_ -{ +typedef struct _RTMP_OS_NETDEV_OP_HOOK_ { const struct net_device_ops *netdev_ops; - void *priv; - int priv_flags; + void *priv; + int priv_flags; unsigned char devAddr[6]; - unsigned char devName[16]; - unsigned char needProtcted; -}RTMP_OS_NETDEV_OP_HOOK, *PRTMP_OS_NETDEV_OP_HOOK; + unsigned char devName[16]; + unsigned char needProtcted; +} RTMP_OS_NETDEV_OP_HOOK, *PRTMP_OS_NETDEV_OP_HOOK; - -typedef enum _RTMP_TASK_STATUS_ -{ +typedef enum _RTMP_TASK_STATUS_ { RTMP_TASK_STAT_UNKNOWN = 0, RTMP_TASK_STAT_INITED = 1, RTMP_TASK_STAT_RUNNING = 2, RTMP_TASK_STAT_STOPED = 4, -}RTMP_TASK_STATUS; +} RTMP_TASK_STATUS; #define RTMP_TASK_CAN_DO_INSERT (RTMP_TASK_STAT_INITED |RTMP_TASK_STAT_RUNNING) #define RTMP_OS_TASK_NAME_LEN 16 -typedef struct _RTMP_OS_TASK_ -{ - char taskName[RTMP_OS_TASK_NAME_LEN]; - void *priv; - //unsigned long taskFlags; - RTMP_TASK_STATUS taskStatus; +typedef struct _RTMP_OS_TASK_ { + char taskName[RTMP_OS_TASK_NAME_LEN]; + void *priv; + //unsigned long taskFlags; + RTMP_TASK_STATUS taskStatus; #ifndef KTHREAD_SUPPORT - RTMP_OS_SEM taskSema; - RTMP_OS_PID taskPID; - struct completion taskComplete; + RTMP_OS_SEM taskSema; + RTMP_OS_PID taskPID; + struct completion taskComplete; #endif - unsigned char task_killed; + unsigned char task_killed; #ifdef KTHREAD_SUPPORT - struct task_struct *kthread_task; - wait_queue_head_t kthread_q; - BOOLEAN kthread_running; + struct task_struct *kthread_task; + wait_queue_head_t kthread_q; + BOOLEAN kthread_running; #endif -}RTMP_OS_TASK; - +} RTMP_OS_TASK; int RtmpOSIRQRequest(IN PNET_DEV pNetDev); int RtmpOSIRQRelease(IN PNET_DEV pNetDev); diff --git a/drivers/staging/rt2860/rtmp_timer.h b/drivers/staging/rt2860/rtmp_timer.h index 5f6e3ce368a0..9f771979710b 100644 --- a/drivers/staging/rt2860/rtmp_timer.h +++ b/drivers/staging/rt2860/rtmp_timer.h @@ -43,59 +43,52 @@ #include "rtmp_os.h" - #define DECLARE_TIMER_FUNCTION(_func) \ void rtmp_timer_##_func(unsigned long data) #define GET_TIMER_FUNCTION(_func) \ rtmp_timer_##_func - /* ----------------- Timer Related MARCO ---------------*/ // In some os or chipset, we have a lot of timer functions and will read/write register, // it's not allowed in Linux USB sub-system to do it ( because of sleep issue when // submit to ctrl pipe). So we need a wrapper function to take care it. #ifdef RTMP_TIMER_TASK_SUPPORT -typedef VOID (*RTMP_TIMER_TASK_HANDLE)( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); +typedef VOID(*RTMP_TIMER_TASK_HANDLE) (IN PVOID SystemSpecific1, + IN PVOID FunctionContext, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3); #endif // RTMP_TIMER_TASK_SUPPORT // -typedef struct _RALINK_TIMER_STRUCT { - RTMP_OS_TIMER TimerObj; // Ndis Timer object - BOOLEAN Valid; // Set to True when call RTMPInitTimer - BOOLEAN State; // True if timer cancelled - BOOLEAN PeriodicType; // True if timer is periodic timer - BOOLEAN Repeat; // True if periodic timer - ULONG TimerValue; // Timer value in milliseconds - ULONG cookie; // os specific object +typedef struct _RALINK_TIMER_STRUCT { + RTMP_OS_TIMER TimerObj; // Ndis Timer object + BOOLEAN Valid; // Set to True when call RTMPInitTimer + BOOLEAN State; // True if timer cancelled + BOOLEAN PeriodicType; // True if timer is periodic timer + BOOLEAN Repeat; // True if periodic timer + ULONG TimerValue; // Timer value in milliseconds + ULONG cookie; // os specific object #ifdef RTMP_TIMER_TASK_SUPPORT - RTMP_TIMER_TASK_HANDLE handle; - void *pAd; -#endif // RTMP_TIMER_TASK_SUPPORT // -}RALINK_TIMER_STRUCT, *PRALINK_TIMER_STRUCT; - + RTMP_TIMER_TASK_HANDLE handle; + void *pAd; +#endif // RTMP_TIMER_TASK_SUPPORT // +} RALINK_TIMER_STRUCT, *PRALINK_TIMER_STRUCT; #ifdef RTMP_TIMER_TASK_SUPPORT -typedef struct _RTMP_TIMER_TASK_ENTRY_ -{ - RALINK_TIMER_STRUCT *pRaTimer; - struct _RTMP_TIMER_TASK_ENTRY_ *pNext; -}RTMP_TIMER_TASK_ENTRY; - +typedef struct _RTMP_TIMER_TASK_ENTRY_ { + RALINK_TIMER_STRUCT *pRaTimer; + struct _RTMP_TIMER_TASK_ENTRY_ *pNext; +} RTMP_TIMER_TASK_ENTRY; #define TIMER_QUEUE_SIZE_MAX 128 -typedef struct _RTMP_TIMER_TASK_QUEUE_ -{ - unsigned int status; - unsigned char *pTimerQPoll; - RTMP_TIMER_TASK_ENTRY *pQPollFreeList; - RTMP_TIMER_TASK_ENTRY *pQHead; - RTMP_TIMER_TASK_ENTRY *pQTail; -}RTMP_TIMER_TASK_QUEUE; +typedef struct _RTMP_TIMER_TASK_QUEUE_ { + unsigned int status; + unsigned char *pTimerQPoll; + RTMP_TIMER_TASK_ENTRY *pQPollFreeList; + RTMP_TIMER_TASK_ENTRY *pQHead; + RTMP_TIMER_TASK_ENTRY *pQTail; +} RTMP_TIMER_TASK_QUEUE; #define BUILD_TIMER_FUNCTION(_func) \ void rtmp_timer_##_func(unsigned long data) \ @@ -122,7 +115,6 @@ void rtmp_timer_##_func(unsigned long data) \ } #endif // RTMP_TIMER_TASK_SUPPORT // - DECLARE_TIMER_FUNCTION(MlmePeriodicExec); DECLARE_TIMER_FUNCTION(MlmeRssiReportExec); DECLARE_TIMER_FUNCTION(AsicRxAntEvalTimeout); @@ -152,5 +144,4 @@ DECLARE_TIMER_FUNCTION(RtmpUsbStaAsicForceWakeupTimeout); DECLARE_TIMER_FUNCTION(LedCtrlMain); #endif - #endif // __RTMP_TIMER_H__ // diff --git a/drivers/staging/rt2860/rtmp_type.h b/drivers/staging/rt2860/rtmp_type.h index f99cd2b4c48e..4900f9fd444c 100644 --- a/drivers/staging/rt2860/rtmp_type.h +++ b/drivers/staging/rt2860/rtmp_type.h @@ -38,110 +38,101 @@ #ifndef __RTMP_TYPE_H__ #define __RTMP_TYPE_H__ - #define PACKED __attribute__ ((packed)) #ifdef LINUX // Put platform dependent declaration here // For example, linux type definition -typedef unsigned char UINT8; -typedef unsigned short UINT16; -typedef unsigned int UINT32; -typedef unsigned long long UINT64; -typedef int INT32; -typedef long long INT64; +typedef unsigned char UINT8; +typedef unsigned short UINT16; +typedef unsigned int UINT32; +typedef unsigned long long UINT64; +typedef int INT32; +typedef long long INT64; #endif // LINUX // -typedef unsigned char * PUINT8; -typedef unsigned short * PUINT16; -typedef unsigned int * PUINT32; -typedef unsigned long long * PUINT64; -typedef int * PINT32; -typedef long long * PINT64; +typedef unsigned char *PUINT8; +typedef unsigned short *PUINT16; +typedef unsigned int *PUINT32; +typedef unsigned long long *PUINT64; +typedef int *PINT32; +typedef long long *PINT64; // modified for fixing compile warning on Sigma 8634 platform -typedef char STRING; -typedef signed char CHAR; - -typedef signed short SHORT; -typedef signed int INT; -typedef signed long LONG; -typedef signed long long LONGLONG; +typedef char STRING; +typedef signed char CHAR; +typedef signed short SHORT; +typedef signed int INT; +typedef signed long LONG; +typedef signed long long LONGLONG; #ifdef LINUX -typedef unsigned char UCHAR; -typedef unsigned short USHORT; -typedef unsigned int UINT; -typedef unsigned long ULONG; +typedef unsigned char UCHAR; +typedef unsigned short USHORT; +typedef unsigned int UINT; +typedef unsigned long ULONG; #endif // LINUX // -typedef unsigned long long ULONGLONG; +typedef unsigned long long ULONGLONG; -typedef unsigned char BOOLEAN; +typedef unsigned char BOOLEAN; #ifdef LINUX -typedef void VOID; +typedef void VOID; #endif // LINUX // -typedef char * PSTRING; -typedef VOID * PVOID; -typedef CHAR * PCHAR; -typedef UCHAR * PUCHAR; -typedef USHORT * PUSHORT; -typedef LONG * PLONG; -typedef ULONG * PULONG; -typedef UINT * PUINT; +typedef char *PSTRING; +typedef VOID *PVOID; +typedef CHAR *PCHAR; +typedef UCHAR *PUCHAR; +typedef USHORT *PUSHORT; +typedef LONG *PLONG; +typedef ULONG *PULONG; +typedef UINT *PUINT; -typedef unsigned int NDIS_MEDIA_STATE; +typedef unsigned int NDIS_MEDIA_STATE; typedef union _LARGE_INTEGER { - struct { - UINT LowPart; - INT32 HighPart; - } u; - INT64 QuadPart; + struct { + UINT LowPart; + INT32 HighPart; + } u; + INT64 QuadPart; } LARGE_INTEGER; - // // Register set pair for initialzation register set definition // -typedef struct _RTMP_REG_PAIR -{ - ULONG Register; - ULONG Value; +typedef struct _RTMP_REG_PAIR { + ULONG Register; + ULONG Value; } RTMP_REG_PAIR, *PRTMP_REG_PAIR; -typedef struct _REG_PAIR -{ - UCHAR Register; - UCHAR Value; +typedef struct _REG_PAIR { + UCHAR Register; + UCHAR Value; } REG_PAIR, *PREG_PAIR; // // Register set pair for initialzation register set definition // -typedef struct _RTMP_RF_REGS -{ - UCHAR Channel; - ULONG R1; - ULONG R2; - ULONG R3; - ULONG R4; +typedef struct _RTMP_RF_REGS { + UCHAR Channel; + ULONG R1; + ULONG R2; + ULONG R3; + ULONG R4; } RTMP_RF_REGS, *PRTMP_RF_REGS; typedef struct _FREQUENCY_ITEM { - UCHAR Channel; - UCHAR N; - UCHAR R; - UCHAR K; + UCHAR Channel; + UCHAR N; + UCHAR R; + UCHAR K; } FREQUENCY_ITEM, *PFREQUENCY_ITEM; - -typedef int NTSTATUS; - +typedef int NTSTATUS; #define STATUS_SUCCESS 0x00 #define STATUS_UNSUCCESSFUL 0x01 -#endif // __RTMP_TYPE_H__ // - +#endif // __RTMP_TYPE_H__ // diff --git a/drivers/staging/rt2860/rtusb_io.h b/drivers/staging/rt2860/rtusb_io.h index 055e4efac2f8..6217dd2430f8 100644 --- a/drivers/staging/rt2860/rtusb_io.h +++ b/drivers/staging/rt2860/rtusb_io.h @@ -25,7 +25,6 @@ ************************************************************************* */ - #ifndef __RTUSB_IO_H__ #define __RTUSB_IO_H__ @@ -60,8 +59,8 @@ #define CMDTHREAD_SET_ASIC_WCID 0x0D730226 // cmd #define CMDTHREAD_SET_ASIC_WCID_CIPHER 0x0D730227 // cmd #define CMDTHREAD_QKERIODIC_EXECUT 0x0D73023D // cmd -#define RT_CMD_SET_KEY_TABLE 0x0D730228 // cmd -#define RT_CMD_SET_RX_WCID_TABLE 0x0D730229 // cmd +#define RT_CMD_SET_KEY_TABLE 0x0D730228 // cmd +#define RT_CMD_SET_RX_WCID_TABLE 0x0D730229 // cmd #define CMDTHREAD_SET_CLIENT_MAC_ENTRY 0x0D73023E // cmd #define CMDTHREAD_SET_GROUP_KEY 0x0D73023F // cmd #define CMDTHREAD_SET_PAIRWISE_KEY 0x0D730240 // cmd @@ -75,34 +74,31 @@ #define CMDTHREAD_UPDATE_PROTECT 0x0D790103 // cmd // end johnli - //CMDTHREAD_MULTI_READ_MAC //CMDTHREAD_MULTI_WRITE_MAC //CMDTHREAD_VENDOR_EEPROM_READ //CMDTHREAD_VENDOR_EEPROM_WRITE -typedef struct _CMDHandler_TLV { - USHORT Offset; - USHORT Length; - UCHAR DataFirst; -} CMDHandler_TLV, *PCMDHandler_TLV; - - -typedef struct _CmdQElmt { - UINT command; - PVOID buffer; - ULONG bufferlength; - BOOLEAN CmdFromNdis; - BOOLEAN SetOperation; - struct _CmdQElmt *next; -} CmdQElmt, *PCmdQElmt; - -typedef struct _CmdQ { - UINT size; - CmdQElmt *head; - CmdQElmt *tail; - UINT32 CmdQState; -}CmdQ, *PCmdQ; - +typedef struct _CMDHandler_TLV { + USHORT Offset; + USHORT Length; + UCHAR DataFirst; +} CMDHandler_TLV, *PCMDHandler_TLV; + +typedef struct _CmdQElmt { + UINT command; + PVOID buffer; + ULONG bufferlength; + BOOLEAN CmdFromNdis; + BOOLEAN SetOperation; + struct _CmdQElmt *next; +} CmdQElmt, *PCmdQElmt; + +typedef struct _CmdQ { + UINT size; + CmdQElmt *head; + CmdQElmt *tail; + UINT32 CmdQState; +} CmdQ, *PCmdQ; #define EnqueueCmd(cmdq, cmdqelmt) \ { \ @@ -115,7 +111,6 @@ typedef struct _CmdQ { cmdq->size++; \ } - /****************************************************************************** USB Cmd to ASIC Related MACRO @@ -185,5 +180,4 @@ typedef struct _CmdQ { RTUSBEnqueueInternalCmd((_pAd), CMDTHREAD_SET_ASIC_WCID, &SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); \ }while(0) - #endif // __RTUSB_IO_H__ // diff --git a/drivers/staging/rt2860/spectrum.h b/drivers/staging/rt2860/spectrum.h index b9fc67603385..64154e9fb6fe 100644 --- a/drivers/staging/rt2860/spectrum.h +++ b/drivers/staging/rt2860/spectrum.h @@ -31,10 +31,7 @@ #include "rtmp_type.h" #include "spectrum_def.h" - -CHAR RTMP_GetTxPwr( - IN PRTMP_ADAPTER pAd, - IN HTTRANSMIT_SETTING HTTxMode); +CHAR RTMP_GetTxPwr(IN PRTMP_ADAPTER pAd, IN HTTRANSMIT_SETTING HTTxMode); /* ========================================================================== @@ -48,17 +45,16 @@ CHAR RTMP_GetTxPwr( Return : None. ========================================================================== */ -VOID MakeMeasurementReqFrame( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pOutBuffer, - OUT PULONG pFrameLen, - IN UINT8 TotalLen, - IN UINT8 Category, - IN UINT8 Action, - IN UINT8 MeasureToken, - IN UINT8 MeasureReqMode, - IN UINT8 MeasureReqType, - IN UINT8 NumOfRepetitions); +VOID MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd, + OUT PUCHAR pOutBuffer, + OUT PULONG pFrameLen, + IN UINT8 TotalLen, + IN UINT8 Category, + IN UINT8 Action, + IN UINT8 MeasureToken, + IN UINT8 MeasureReqMode, + IN UINT8 MeasureReqType, + IN UINT8 NumOfRepetitions); /* ========================================================================== @@ -72,15 +68,13 @@ VOID MakeMeasurementReqFrame( Return : None. ========================================================================== */ -VOID EnqueueMeasurementRep( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UINT8 DialogToken, - IN UINT8 MeasureToken, - IN UINT8 MeasureReqMode, - IN UINT8 MeasureReqType, - IN UINT8 ReportInfoLen, - IN PUINT8 pReportInfo); +VOID EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd, + IN PUCHAR pDA, + IN UINT8 DialogToken, + IN UINT8 MeasureToken, + IN UINT8 MeasureReqMode, + IN UINT8 MeasureReqType, + IN UINT8 ReportInfoLen, IN PUINT8 pReportInfo); /* ========================================================================== @@ -94,10 +88,7 @@ VOID EnqueueMeasurementRep( Return : None. ========================================================================== */ -VOID EnqueueTPCReq( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UCHAR DialogToken); +VOID EnqueueTPCReq(IN PRTMP_ADAPTER pAd, IN PUCHAR pDA, IN UCHAR DialogToken); /* ========================================================================== @@ -111,12 +102,9 @@ VOID EnqueueTPCReq( Return : None. ========================================================================== */ -VOID EnqueueTPCRep( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UINT8 DialogToken, - IN UINT8 TxPwr, - IN UINT8 LinkMargin); +VOID EnqueueTPCRep(IN PRTMP_ADAPTER pAd, + IN PUCHAR pDA, + IN UINT8 DialogToken, IN UINT8 TxPwr, IN UINT8 LinkMargin); /* ========================================================================== @@ -132,11 +120,8 @@ VOID EnqueueTPCRep( Return : None. ========================================================================== */ -VOID EnqueueChSwAnn( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UINT8 ChSwMode, - IN UINT8 NewCh); +VOID EnqueueChSwAnn(IN PRTMP_ADAPTER pAd, + IN PUCHAR pDA, IN UINT8 ChSwMode, IN UINT8 NewCh); /* ========================================================================== @@ -150,9 +135,7 @@ VOID EnqueueChSwAnn( Return : None. ========================================================================== */ -VOID PeerSpectrumAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); +VOID PeerSpectrumAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); /* ========================================================================== @@ -163,73 +146,44 @@ VOID PeerSpectrumAction( Return : None. ========================================================================== */ -INT Set_MeasureReq_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_TpcReq_Proc( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - -INT Set_PwrConstraint( - IN PRTMP_ADAPTER pAd, - IN PSTRING arg); - - -VOID MeasureReqTabInit( - IN PRTMP_ADAPTER pAd); - -VOID MeasureReqTabExit( - IN PRTMP_ADAPTER pAd); - -PMEASURE_REQ_ENTRY MeasureReqLookUp( - IN PRTMP_ADAPTER pAd, - IN UINT8 DialogToken); - -PMEASURE_REQ_ENTRY MeasureReqInsert( - IN PRTMP_ADAPTER pAd, - IN UINT8 DialogToken); - -VOID MeasureReqDelete( - IN PRTMP_ADAPTER pAd, - IN UINT8 DialogToken); - -VOID InsertChannelRepIE( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN PSTRING pCountry, - IN UINT8 RegulatoryClass); - -VOID InsertTpcReportIE( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 TxPwr, - IN UINT8 LinkMargin); - -VOID InsertDialogToken( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 DialogToken); - -VOID TpcReqTabInit( - IN PRTMP_ADAPTER pAd); - -VOID TpcReqTabExit( - IN PRTMP_ADAPTER pAd); - -VOID NotifyChSwAnnToPeerAPs( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pRA, - IN PUCHAR pTA, - IN UINT8 ChSwMode, - IN UINT8 Channel); - -VOID RguClass_BuildBcnChList( - IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf, - OUT PULONG pBufLen); -#endif // __SPECTRUM_H__ // +INT Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg); + +INT Set_TpcReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg); + +INT Set_PwrConstraint(IN PRTMP_ADAPTER pAd, IN PSTRING arg); + +VOID MeasureReqTabInit(IN PRTMP_ADAPTER pAd); + +VOID MeasureReqTabExit(IN PRTMP_ADAPTER pAd); + +PMEASURE_REQ_ENTRY MeasureReqLookUp(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken); + +PMEASURE_REQ_ENTRY MeasureReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken); +VOID MeasureReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken); + +VOID InsertChannelRepIE(IN PRTMP_ADAPTER pAd, + OUT PUCHAR pFrameBuf, + OUT PULONG pFrameLen, + IN PSTRING pCountry, IN UINT8 RegulatoryClass); + +VOID InsertTpcReportIE(IN PRTMP_ADAPTER pAd, + OUT PUCHAR pFrameBuf, + OUT PULONG pFrameLen, + IN UINT8 TxPwr, IN UINT8 LinkMargin); + +VOID InsertDialogToken(IN PRTMP_ADAPTER pAd, + OUT PUCHAR pFrameBuf, + OUT PULONG pFrameLen, IN UINT8 DialogToken); + +VOID TpcReqTabInit(IN PRTMP_ADAPTER pAd); + +VOID TpcReqTabExit(IN PRTMP_ADAPTER pAd); + +VOID NotifyChSwAnnToPeerAPs(IN PRTMP_ADAPTER pAd, + IN PUCHAR pRA, + IN PUCHAR pTA, IN UINT8 ChSwMode, IN UINT8 Channel); + +VOID RguClass_BuildBcnChList(IN PRTMP_ADAPTER pAd, + OUT PUCHAR pBuf, OUT PULONG pBufLen); +#endif // __SPECTRUM_H__ // diff --git a/drivers/staging/rt2860/spectrum_def.h b/drivers/staging/rt2860/spectrum_def.h index ae67014a4703..4ebe5f50cc2f 100644 --- a/drivers/staging/rt2860/spectrum_def.h +++ b/drivers/staging/rt2860/spectrum_def.h @@ -39,69 +39,59 @@ #ifndef __SPECTRUM_DEF_H__ #define __SPECTRUM_DEF_H__ - #define MAX_MEASURE_REQ_TAB_SIZE 32 #define MAX_HASH_MEASURE_REQ_TAB_SIZE MAX_MEASURE_REQ_TAB_SIZE #define MAX_TPC_REQ_TAB_SIZE 32 #define MAX_HASH_TPC_REQ_TAB_SIZE MAX_TPC_REQ_TAB_SIZE -#define MIN_RCV_PWR 100 /* Negative value ((dBm) */ +#define MIN_RCV_PWR 100 /* Negative value ((dBm) */ -#define TPC_REQ_AGE_OUT 500 /* ms */ -#define MQ_REQ_AGE_OUT 500 /* ms */ +#define TPC_REQ_AGE_OUT 500 /* ms */ +#define MQ_REQ_AGE_OUT 500 /* ms */ #define TPC_DIALOGTOKEN_HASH_INDEX(_DialogToken) ((_DialogToken) % MAX_HASH_TPC_REQ_TAB_SIZE) #define MQ_DIALOGTOKEN_HASH_INDEX(_DialogToken) ((_DialogToken) % MAX_MEASURE_REQ_TAB_SIZE) -typedef struct _MEASURE_REQ_ENTRY -{ +typedef struct _MEASURE_REQ_ENTRY { struct _MEASURE_REQ_ENTRY *pNext; ULONG lastTime; - BOOLEAN Valid; + BOOLEAN Valid; UINT8 DialogToken; UINT8 MeasureDialogToken[3]; // 0:basic measure, 1: CCA measure, 2: RPI_Histogram measure. } MEASURE_REQ_ENTRY, *PMEASURE_REQ_ENTRY; -typedef struct _MEASURE_REQ_TAB -{ +typedef struct _MEASURE_REQ_TAB { UCHAR Size; PMEASURE_REQ_ENTRY Hash[MAX_HASH_MEASURE_REQ_TAB_SIZE]; MEASURE_REQ_ENTRY Content[MAX_MEASURE_REQ_TAB_SIZE]; } MEASURE_REQ_TAB, *PMEASURE_REQ_TAB; -typedef struct _TPC_REQ_ENTRY -{ +typedef struct _TPC_REQ_ENTRY { struct _TPC_REQ_ENTRY *pNext; ULONG lastTime; BOOLEAN Valid; UINT8 DialogToken; } TPC_REQ_ENTRY, *PTPC_REQ_ENTRY; -typedef struct _TPC_REQ_TAB -{ +typedef struct _TPC_REQ_TAB { UCHAR Size; PTPC_REQ_ENTRY Hash[MAX_HASH_TPC_REQ_TAB_SIZE]; TPC_REQ_ENTRY Content[MAX_TPC_REQ_TAB_SIZE]; } TPC_REQ_TAB, *PTPC_REQ_TAB; - /* The regulatory information */ -typedef struct _DOT11_CHANNEL_SET -{ +typedef struct _DOT11_CHANNEL_SET { UCHAR NumberOfChannels; UINT8 MaxTxPwr; UCHAR ChannelList[16]; } DOT11_CHANNEL_SET, *PDOT11_CHANNEL_SET; -typedef struct _DOT11_REGULATORY_INFORMATION -{ +typedef struct _DOT11_REGULATORY_INFORMATION { UCHAR RegulatoryClass; DOT11_CHANNEL_SET ChannelSet; } DOT11_REGULATORY_INFORMATION, *PDOT11_REGULATORY_INFORMATION; - - #define RM_TPC_REQ 0 #define RM_MEASURE_REQ 1 @@ -111,53 +101,44 @@ typedef struct _DOT11_REGULATORY_INFORMATION #define RM_CH_LOAD 3 #define RM_NOISE_HISTOGRAM 4 - -typedef struct PACKED _TPC_REPORT_INFO -{ +typedef struct PACKED _TPC_REPORT_INFO { UINT8 TxPwr; UINT8 LinkMargin; } TPC_REPORT_INFO, *PTPC_REPORT_INFO; -typedef struct PACKED _CH_SW_ANN_INFO -{ +typedef struct PACKED _CH_SW_ANN_INFO { UINT8 ChSwMode; UINT8 Channel; UINT8 ChSwCnt; } CH_SW_ANN_INFO, *PCH_SW_ANN_INFO; -typedef union PACKED _MEASURE_REQ_MODE -{ - struct PACKED - { +typedef union PACKED _MEASURE_REQ_MODE { + struct PACKED { UINT8 Parallel:1; UINT8 Enable:1; UINT8 Request:1; UINT8 Report:1; UINT8 DurationMandatory:1; - UINT8 :3; + UINT8:3; } field; UINT8 word; } MEASURE_REQ_MODE, *PMEASURE_REQ_MODE; -typedef struct PACKED _MEASURE_REQ -{ +typedef struct PACKED _MEASURE_REQ { UINT8 ChNum; UINT64 MeasureStartTime; UINT16 MeasureDuration; } MEASURE_REQ, *PMEASURE_REQ; -typedef struct PACKED _MEASURE_REQ_INFO -{ +typedef struct PACKED _MEASURE_REQ_INFO { UINT8 Token; MEASURE_REQ_MODE ReqMode; UINT8 ReqType; UINT8 Oct[0]; } MEASURE_REQ_INFO, *PMEASURE_REQ_INFO; -typedef union PACKED _MEASURE_BASIC_REPORT_MAP -{ - struct PACKED - { +typedef union PACKED _MEASURE_BASIC_REPORT_MAP { + struct PACKED { UINT8 BSS:1; UINT8 OfdmPreamble:1; @@ -169,34 +150,29 @@ typedef union PACKED _MEASURE_BASIC_REPORT_MAP UINT8 word; } MEASURE_BASIC_REPORT_MAP, *PMEASURE_BASIC_REPORT_MAP; -typedef struct PACKED _MEASURE_BASIC_REPORT -{ +typedef struct PACKED _MEASURE_BASIC_REPORT { UINT8 ChNum; UINT64 MeasureStartTime; UINT16 MeasureDuration; MEASURE_BASIC_REPORT_MAP Map; } MEASURE_BASIC_REPORT, *PMEASURE_BASIC_REPORT; -typedef struct PACKED _MEASURE_CCA_REPORT -{ +typedef struct PACKED _MEASURE_CCA_REPORT { UINT8 ChNum; UINT64 MeasureStartTime; UINT16 MeasureDuration; UINT8 CCA_Busy_Fraction; } MEASURE_CCA_REPORT, *PMEASURE_CCA_REPORT; -typedef struct PACKED _MEASURE_RPI_REPORT -{ +typedef struct PACKED _MEASURE_RPI_REPORT { UINT8 ChNum; UINT64 MeasureStartTime; UINT16 MeasureDuration; UINT8 RPI_Density[8]; } MEASURE_RPI_REPORT, *PMEASURE_RPI_REPORT; -typedef union PACKED _MEASURE_REPORT_MODE -{ - struct PACKED - { +typedef union PACKED _MEASURE_REPORT_MODE { + struct PACKED { UINT8 Late:1; UINT8 Incapable:1; UINT8 Refused:1; @@ -205,16 +181,14 @@ typedef union PACKED _MEASURE_REPORT_MODE UINT8 word; } MEASURE_REPORT_MODE, *PMEASURE_REPORT_MODE; -typedef struct PACKED _MEASURE_REPORT_INFO -{ +typedef struct PACKED _MEASURE_REPORT_INFO { UINT8 Token; UINT8 ReportMode; UINT8 ReportType; UINT8 Octect[0]; } MEASURE_REPORT_INFO, *PMEASURE_REPORT_INFO; -typedef struct PACKED _QUIET_INFO -{ +typedef struct PACKED _QUIET_INFO { UINT8 QuietCnt; UINT8 QuietPeriod; UINT16 QuietDuration; @@ -222,4 +196,3 @@ typedef struct PACKED _QUIET_INFO } QUIET_INFO, *PQUIET_INFO; #endif // __SPECTRUM_DEF_H__ // - diff --git a/drivers/staging/rt2860/wpa.h b/drivers/staging/rt2860/wpa.h index 27e5aab82855..fb5843cd2628 100644 --- a/drivers/staging/rt2860/wpa.h +++ b/drivers/staging/rt2860/wpa.h @@ -126,12 +126,12 @@ //#ifdef CONFIG_AP_SUPPORT // WPA mechanism retry timer interval -#define PEER_MSG1_RETRY_EXEC_INTV 1000 // 1 sec -#define PEER_MSG3_RETRY_EXEC_INTV 3000 // 3 sec -#define GROUP_KEY_UPDATE_EXEC_INTV 1000 // 1 sec -#define PEER_GROUP_KEY_UPDATE_INIV 2000 // 2 sec +#define PEER_MSG1_RETRY_EXEC_INTV 1000 // 1 sec +#define PEER_MSG3_RETRY_EXEC_INTV 3000 // 3 sec +#define GROUP_KEY_UPDATE_EXEC_INTV 1000 // 1 sec +#define PEER_GROUP_KEY_UPDATE_INIV 2000 // 2 sec -#define ENQUEUE_EAPOL_START_TIMER 200 // 200 ms +#define ENQUEUE_EAPOL_START_TIMER 200 // 200 ms // group rekey interval #define TIME_REKEY 0 @@ -147,7 +147,6 @@ #define AKM_SUITE 2 #define PMKID_LIST 3 - #define EAPOL_START_DISABLE 0 #define EAPOL_START_PSK 1 #define EAPOL_START_1X 2 @@ -181,7 +180,6 @@ #define CONV_ARRARY_TO_UINT16(_V) ((_V[0]<<8) | (_V[1])) - #define ADD_ONE_To_64BIT_VAR(_V) \ { \ UCHAR cnt = LEN_KEY_DESC_REPLAY; \ @@ -197,224 +195,199 @@ #define IS_WPA_CAPABILITY(a) (((a) >= Ndis802_11AuthModeWPA) && ((a) <= Ndis802_11AuthModeWPA1PSKWPA2PSK)) // EAPOL Key Information definition within Key descriptor format -typedef struct PACKED _KEY_INFO -{ - UCHAR KeyMic:1; - UCHAR Secure:1; - UCHAR Error:1; - UCHAR Request:1; - UCHAR EKD_DL:1; // EKD for AP; DL for STA - UCHAR Rsvd:3; - UCHAR KeyDescVer:3; - UCHAR KeyType:1; - UCHAR KeyIndex:2; - UCHAR Install:1; - UCHAR KeyAck:1; -} KEY_INFO, *PKEY_INFO; +typedef struct PACKED _KEY_INFO { + UCHAR KeyMic:1; + UCHAR Secure:1; + UCHAR Error:1; + UCHAR Request:1; + UCHAR EKD_DL:1; // EKD for AP; DL for STA + UCHAR Rsvd:3; + UCHAR KeyDescVer:3; + UCHAR KeyType:1; + UCHAR KeyIndex:2; + UCHAR Install:1; + UCHAR KeyAck:1; +} KEY_INFO, *PKEY_INFO; // EAPOL Key descriptor format -typedef struct PACKED _KEY_DESCRIPTER -{ - UCHAR Type; - KEY_INFO KeyInfo; - UCHAR KeyLength[2]; - UCHAR ReplayCounter[LEN_KEY_DESC_REPLAY]; - UCHAR KeyNonce[LEN_KEY_DESC_NONCE]; - UCHAR KeyIv[LEN_KEY_DESC_IV]; - UCHAR KeyRsc[LEN_KEY_DESC_RSC]; - UCHAR KeyId[LEN_KEY_DESC_ID]; - UCHAR KeyMic[LEN_KEY_DESC_MIC]; - UCHAR KeyDataLen[2]; - UCHAR KeyData[MAX_LEN_OF_RSNIE]; -} KEY_DESCRIPTER, *PKEY_DESCRIPTER; - -typedef struct PACKED _EAPOL_PACKET -{ - UCHAR ProVer; - UCHAR ProType; - UCHAR Body_Len[2]; - KEY_DESCRIPTER KeyDesc; -} EAPOL_PACKET, *PEAPOL_PACKET; +typedef struct PACKED _KEY_DESCRIPTER { + UCHAR Type; + KEY_INFO KeyInfo; + UCHAR KeyLength[2]; + UCHAR ReplayCounter[LEN_KEY_DESC_REPLAY]; + UCHAR KeyNonce[LEN_KEY_DESC_NONCE]; + UCHAR KeyIv[LEN_KEY_DESC_IV]; + UCHAR KeyRsc[LEN_KEY_DESC_RSC]; + UCHAR KeyId[LEN_KEY_DESC_ID]; + UCHAR KeyMic[LEN_KEY_DESC_MIC]; + UCHAR KeyDataLen[2]; + UCHAR KeyData[MAX_LEN_OF_RSNIE]; +} KEY_DESCRIPTER, *PKEY_DESCRIPTER; + +typedef struct PACKED _EAPOL_PACKET { + UCHAR ProVer; + UCHAR ProType; + UCHAR Body_Len[2]; + KEY_DESCRIPTER KeyDesc; +} EAPOL_PACKET, *PEAPOL_PACKET; //802.11i D10 page 83 -typedef struct PACKED _GTK_ENCAP -{ - UCHAR Kid:2; - UCHAR tx:1; - UCHAR rsv:5; - UCHAR rsv1; - UCHAR GTK[TKIP_GTK_LENGTH]; -} GTK_ENCAP, *PGTK_ENCAP; - -typedef struct PACKED _KDE_ENCAP -{ - UCHAR Type; - UCHAR Len; - UCHAR OUI[3]; - UCHAR DataType; - GTK_ENCAP GTKEncap; -} KDE_ENCAP, *PKDE_ENCAP; +typedef struct PACKED _GTK_ENCAP { + UCHAR Kid:2; + UCHAR tx:1; + UCHAR rsv:5; + UCHAR rsv1; + UCHAR GTK[TKIP_GTK_LENGTH]; +} GTK_ENCAP, *PGTK_ENCAP; + +typedef struct PACKED _KDE_ENCAP { + UCHAR Type; + UCHAR Len; + UCHAR OUI[3]; + UCHAR DataType; + GTK_ENCAP GTKEncap; +} KDE_ENCAP, *PKDE_ENCAP; // For WPA1 typedef struct PACKED _RSNIE { - UCHAR oui[4]; - USHORT version; - UCHAR mcast[4]; - USHORT ucount; - struct PACKED { - UCHAR oui[4]; - }ucast[1]; + UCHAR oui[4]; + USHORT version; + UCHAR mcast[4]; + USHORT ucount; + struct PACKED { + UCHAR oui[4]; + } ucast[1]; } RSNIE, *PRSNIE; // For WPA2 typedef struct PACKED _RSNIE2 { - USHORT version; - UCHAR mcast[4]; - USHORT ucount; - struct PACKED { - UCHAR oui[4]; - }ucast[1]; + USHORT version; + UCHAR mcast[4]; + USHORT ucount; + struct PACKED { + UCHAR oui[4]; + } ucast[1]; } RSNIE2, *PRSNIE2; // AKM Suite typedef struct PACKED _RSNIE_AUTH { - USHORT acount; - struct PACKED { - UCHAR oui[4]; - }auth[1]; -} RSNIE_AUTH,*PRSNIE_AUTH; - -typedef union PACKED _RSN_CAPABILITIES { - struct PACKED { - USHORT PreAuth:1; - USHORT No_Pairwise:1; - USHORT PTKSA_R_Counter:2; - USHORT GTKSA_R_Counter:2; - USHORT Rsvd:10; - } field; - USHORT word; -} RSN_CAPABILITIES, *PRSN_CAPABILITIES; + USHORT acount; + struct PACKED { + UCHAR oui[4]; + } auth[1]; +} RSNIE_AUTH, *PRSNIE_AUTH; + +typedef union PACKED _RSN_CAPABILITIES { + struct PACKED { + USHORT PreAuth:1; + USHORT No_Pairwise:1; + USHORT PTKSA_R_Counter:2; + USHORT GTKSA_R_Counter:2; + USHORT Rsvd:10; + } field; + USHORT word; +} RSN_CAPABILITIES, *PRSN_CAPABILITIES; typedef struct PACKED _EAP_HDR { - UCHAR ProVer; - UCHAR ProType; - UCHAR Body_Len[2]; - UCHAR code; - UCHAR identifier; - UCHAR length[2]; // including code and identifier, followed by length-2 octets of data + UCHAR ProVer; + UCHAR ProType; + UCHAR Body_Len[2]; + UCHAR code; + UCHAR identifier; + UCHAR length[2]; // including code and identifier, followed by length-2 octets of data } EAP_HDR, *PEAP_HDR; // For supplicant state machine states. 802.11i Draft 4.1, p. 97 // We simplified it -typedef enum _WpaState -{ - SS_NOTUSE, // 0 - SS_START, // 1 - SS_WAIT_MSG_3, // 2 - SS_WAIT_GROUP, // 3 - SS_FINISH, // 4 - SS_KEYUPDATE, // 5 -} WPA_STATE; +typedef enum _WpaState { + SS_NOTUSE, // 0 + SS_START, // 1 + SS_WAIT_MSG_3, // 2 + SS_WAIT_GROUP, // 3 + SS_FINISH, // 4 + SS_KEYUPDATE, // 5 +} WPA_STATE; // -// The definition of the cipher combination +// The definition of the cipher combination // -// bit3 bit2 bit1 bit0 -// +------------+------------+ -// | WPA | WPA2 | -// +------+-----+------+-----+ -// | TKIP | AES | TKIP | AES | -// | 0 | 1 | 1 | 0 | -> 0x06 -// | 0 | 1 | 1 | 1 | -> 0x07 -// | 1 | 0 | 0 | 1 | -> 0x09 -// | 1 | 0 | 1 | 1 | -> 0x0B -// | 1 | 1 | 0 | 1 | -> 0x0D -// | 1 | 1 | 1 | 0 | -> 0x0E -// | 1 | 1 | 1 | 1 | -> 0x0F -// +------+-----+------+-----+ +// bit3 bit2 bit1 bit0 +// +------------+------------+ +// | WPA | WPA2 | +// +------+-----+------+-----+ +// | TKIP | AES | TKIP | AES | +// | 0 | 1 | 1 | 0 | -> 0x06 +// | 0 | 1 | 1 | 1 | -> 0x07 +// | 1 | 0 | 0 | 1 | -> 0x09 +// | 1 | 0 | 1 | 1 | -> 0x0B +// | 1 | 1 | 0 | 1 | -> 0x0D +// | 1 | 1 | 1 | 0 | -> 0x0E +// | 1 | 1 | 1 | 1 | -> 0x0F +// +------+-----+------+-----+ // -typedef enum _WpaMixPairCipher -{ - MIX_CIPHER_NOTUSE = 0x00, - WPA_NONE_WPA2_TKIPAES = 0x03, // WPA2-TKIPAES - WPA_AES_WPA2_TKIP = 0x06, - WPA_AES_WPA2_TKIPAES = 0x07, - WPA_TKIP_WPA2_AES = 0x09, - WPA_TKIP_WPA2_TKIPAES = 0x0B, - WPA_TKIPAES_WPA2_NONE = 0x0C, // WPA-TKIPAES - WPA_TKIPAES_WPA2_AES = 0x0D, - WPA_TKIPAES_WPA2_TKIP = 0x0E, - WPA_TKIPAES_WPA2_TKIPAES = 0x0F, -} WPA_MIX_PAIR_CIPHER; - -typedef struct PACKED _RSN_IE_HEADER_STRUCT { - UCHAR Eid; - UCHAR Length; - USHORT Version; // Little endian format -} RSN_IE_HEADER_STRUCT, *PRSN_IE_HEADER_STRUCT; +typedef enum _WpaMixPairCipher { + MIX_CIPHER_NOTUSE = 0x00, + WPA_NONE_WPA2_TKIPAES = 0x03, // WPA2-TKIPAES + WPA_AES_WPA2_TKIP = 0x06, + WPA_AES_WPA2_TKIPAES = 0x07, + WPA_TKIP_WPA2_AES = 0x09, + WPA_TKIP_WPA2_TKIPAES = 0x0B, + WPA_TKIPAES_WPA2_NONE = 0x0C, // WPA-TKIPAES + WPA_TKIPAES_WPA2_AES = 0x0D, + WPA_TKIPAES_WPA2_TKIP = 0x0E, + WPA_TKIPAES_WPA2_TKIPAES = 0x0F, +} WPA_MIX_PAIR_CIPHER; + +typedef struct PACKED _RSN_IE_HEADER_STRUCT { + UCHAR Eid; + UCHAR Length; + USHORT Version; // Little endian format +} RSN_IE_HEADER_STRUCT, *PRSN_IE_HEADER_STRUCT; // Cipher suite selector types -typedef struct PACKED _CIPHER_SUITE_STRUCT { - UCHAR Oui[3]; - UCHAR Type; -} CIPHER_SUITE_STRUCT, *PCIPHER_SUITE_STRUCT; +typedef struct PACKED _CIPHER_SUITE_STRUCT { + UCHAR Oui[3]; + UCHAR Type; +} CIPHER_SUITE_STRUCT, *PCIPHER_SUITE_STRUCT; // Authentication and Key Management suite selector -typedef struct PACKED _AKM_SUITE_STRUCT { - UCHAR Oui[3]; - UCHAR Type; -} AKM_SUITE_STRUCT, *PAKM_SUITE_STRUCT; +typedef struct PACKED _AKM_SUITE_STRUCT { + UCHAR Oui[3]; + UCHAR Type; +} AKM_SUITE_STRUCT, *PAKM_SUITE_STRUCT; // RSN capability -typedef struct PACKED _RSN_CAPABILITY { - USHORT Rsv:10; - USHORT GTKSAReplayCnt:2; - USHORT PTKSAReplayCnt:2; - USHORT NoPairwise:1; - USHORT PreAuth:1; -} RSN_CAPABILITY, *PRSN_CAPABILITY; - +typedef struct PACKED _RSN_CAPABILITY { + USHORT Rsv:10; + USHORT GTKSAReplayCnt:2; + USHORT PTKSAReplayCnt:2; + USHORT NoPairwise:1; + USHORT PreAuth:1; +} RSN_CAPABILITY, *PRSN_CAPABILITY; /*======================================== The prototype is defined in cmm_wpa.c ========================================*/ -BOOLEAN WpaMsgTypeSubst( - IN UCHAR EAPType, - OUT INT *MsgType); - -VOID PRF( - IN UCHAR *key, - IN INT key_len, - IN UCHAR *prefix, - IN INT prefix_len, - IN UCHAR *data, - IN INT data_len, - OUT UCHAR *output, - IN INT len); - -int PasswordHash( - char *password, - unsigned char *ssid, - int ssidlength, - unsigned char *output); - -PUINT8 GetSuiteFromRSNIE( - IN PUINT8 rsnie, - IN UINT rsnie_len, - IN UINT8 type, - OUT UINT8 *count); - -VOID WpaShowAllsuite( - IN PUINT8 rsnie, - IN UINT rsnie_len); - -VOID RTMPInsertRSNIE( - IN PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN PUINT8 rsnie_ptr, - IN UINT8 rsnie_len, - IN PUINT8 pmkid_ptr, - IN UINT8 pmkid_len); +BOOLEAN WpaMsgTypeSubst(IN UCHAR EAPType, OUT INT * MsgType); + +VOID PRF(IN UCHAR * key, + IN INT key_len, + IN UCHAR * prefix, + IN INT prefix_len, + IN UCHAR * data, IN INT data_len, OUT UCHAR * output, IN INT len); + +int PasswordHash(char *password, + unsigned char *ssid, int ssidlength, unsigned char *output); + +PUINT8 GetSuiteFromRSNIE(IN PUINT8 rsnie, + IN UINT rsnie_len, IN UINT8 type, OUT UINT8 * count); + +VOID WpaShowAllsuite(IN PUINT8 rsnie, IN UINT rsnie_len); +VOID RTMPInsertRSNIE(IN PUCHAR pFrameBuf, + OUT PULONG pFrameLen, + IN PUINT8 rsnie_ptr, + IN UINT8 rsnie_len, + IN PUINT8 pmkid_ptr, IN UINT8 pmkid_len); #endif -- GitLab From 9f548a2a3dd8feca99f7301df474f983c1e815f3 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 11 Dec 2009 12:23:14 -0800 Subject: [PATCH 163/235] Staging: rt28x0: fix comments in *.c files Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/chips/rt3070.c | 68 ++-- drivers/staging/rt2860/chips/rt3090.c | 34 +- drivers/staging/rt2860/chips/rt30xx.c | 146 ++++---- drivers/staging/rt2860/pci_main_dev.c | 290 ++++++++-------- drivers/staging/rt2860/rt_linux.c | 110 +++--- drivers/staging/rt2860/rt_main_dev.c | 168 +++++----- drivers/staging/rt2860/rt_pci_rbus.c | 166 +++++----- drivers/staging/rt2860/rt_usb.c | 106 +++--- drivers/staging/rt2860/sta_ioctl.c | 368 ++++++++++----------- drivers/staging/rt2860/usb_main_dev.c | 76 ++--- drivers/staging/rt2870/common/rtusb_bulk.c | 170 +++++----- drivers/staging/rt2870/common/rtusb_data.c | 10 +- drivers/staging/rt2870/common/rtusb_io.c | 162 ++++----- 13 files changed, 937 insertions(+), 937 deletions(-) diff --git a/drivers/staging/rt2860/chips/rt3070.c b/drivers/staging/rt2860/chips/rt3070.c index eb3b214add26..4a6208765b62 100644 --- a/drivers/staging/rt2860/chips/rt3070.c +++ b/drivers/staging/rt2860/chips/rt3070.c @@ -41,18 +41,18 @@ #ifndef RTMP_RF_RW_SUPPORT #error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" -#endif // RTMP_RF_RW_SUPPORT // +#endif /* RTMP_RF_RW_SUPPORT // */ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd) { INT i; UCHAR RFValue; - // Driver must read EEPROM to get RfIcType before initial RF registers - // Initialize RF register to default value + /* Driver must read EEPROM to get RfIcType before initial RF registers */ + /* Initialize RF register to default value */ if (IS_RT3070(pAd) || IS_RT3071(pAd)) { - // Init RF calibration - // Driver should toggle RF R30 bit7 before init RF registers + /* Init RF calibration */ + /* Driver should toggle RF R30 bit7 before init RF registers */ UINT32 RfReg = 0; UINT32 data; @@ -63,38 +63,38 @@ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd) RfReg &= 0x7F; RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR) RfReg); - // Initialize RF register to default value + /* Initialize RF register to default value */ for (i = 0; i < NUM_RF_REG_PARMS; i++) { RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value); } - // add by johnli + /* add by johnli */ if (IS_RT3070(pAd)) { - // - // The DAC issue(LDO_CFG0) has been fixed in RT3070(F). - // The voltage raising patch is no longer needed for RT3070(F) - // + /* */ + /* The DAC issue(LDO_CFG0) has been fixed in RT3070(F). */ + /* The voltage raising patch is no longer needed for RT3070(F) */ + /* */ if ((pAd->MACVersion & 0xffff) < 0x0201) { - // Update MAC 0x05D4 from 01xxxxxx to 0Dxxxxxx (voltage 1.2V to 1.35V) for RT3070 to improve yield rate + /* Update MAC 0x05D4 from 01xxxxxx to 0Dxxxxxx (voltage 1.2V to 1.35V) for RT3070 to improve yield rate */ RTUSBReadMACRegister(pAd, LDO_CFG0, &data); data = ((data & 0xF0FFFFFF) | 0x0D000000); RTUSBWriteMACRegister(pAd, LDO_CFG0, data); } } else if (IS_RT3071(pAd)) { - // Driver should set RF R6 bit6 on before init RF registers + /* Driver should set RF R6 bit6 on before init RF registers */ RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR) & RfReg); RfReg |= 0x40; RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR) RfReg); - // init R31 + /* init R31 */ RT30xxWriteRFRegister(pAd, RF_R31, 0x14); - // RT3071 version E has fixed this issue + /* RT3071 version E has fixed this issue */ if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211)) { - // patch tx EVM issue temporarily + /* patch tx EVM issue temporarily */ RTUSBReadMACRegister(pAd, LDO_CFG0, &data); data = ((data & 0xE0FFFFFF) | 0x0D000000); RTUSBWriteMACRegister(pAd, LDO_CFG0, data); @@ -104,35 +104,35 @@ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd) RTMP_IO_WRITE32(pAd, LDO_CFG0, data); } - // patch LNA_PE_G1 failed issue + /* patch LNA_PE_G1 failed issue */ RTUSBReadMACRegister(pAd, GPIO_SWITCH, &data); data &= ~(0x20); RTUSBWriteMACRegister(pAd, GPIO_SWITCH, data); } - //For RF filter Calibration + /*For RF filter Calibration */ RTMPFilterCalibration(pAd); - // Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration() - // - // TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F). - // Raising RF voltage is no longer needed for RT3070(F) - // + /* Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration() */ + /* */ + /* TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F). */ + /* Raising RF voltage is no longer needed for RT3070(F) */ + /* */ if ((IS_RT3070(pAd)) && ((pAd->MACVersion & 0xffff) < 0x0201)) { RT30xxWriteRFRegister(pAd, RF_R27, 0x3); } else if ((IS_RT3071(pAd)) && ((pAd->MACVersion & 0xffff) < 0x0211)) { RT30xxWriteRFRegister(pAd, RF_R27, 0x3); } - // set led open drain enable + /* set led open drain enable */ RTUSBReadMACRegister(pAd, OPT_14, &data); data |= 0x01; RTUSBWriteMACRegister(pAd, OPT_14, data); - // move from RT30xxLoadRFNormalModeSetup because it's needed for both RT3070 and RT3071 - // TX_LO1_en, RF R17 register Bit 3 to 0 + /* move from RT30xxLoadRFNormalModeSetup because it's needed for both RT3070 and RT3071 */ + /* TX_LO1_en, RF R17 register Bit 3 to 0 */ RT30xxReadRFRegister(pAd, RF_R17, &RFValue); RFValue &= (~0x08); - // to fix rx long range issue + /* to fix rx long range issue */ if (pAd->NicConfig2.field.ExternalLNAForG == 0) { if ((IS_RT3071(pAd) && ((pAd->MACVersion & 0xffff) >= 0x0211)) @@ -140,22 +140,22 @@ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd) RFValue |= 0x20; } } - // set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h + /* set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h */ if (pAd->TxMixerGain24G >= 1) { - RFValue &= (~0x7); // clean bit [2:0] + RFValue &= (~0x7); /* clean bit [2:0] */ RFValue |= pAd->TxMixerGain24G; } RT30xxWriteRFRegister(pAd, RF_R17, RFValue); if (IS_RT3071(pAd)) { - // add by johnli, RF power sequence setup, load RF normal operation-mode setup + /* add by johnli, RF power sequence setup, load RF normal operation-mode setup */ RT30xxLoadRFNormalModeSetup(pAd); } else if (IS_RT3070(pAd)) { /* add by johnli, reset RF_R27 when interface down & up to fix throughput problem */ - // LDORF_VC, RF R27 register Bit 2 to 0 + /* LDORF_VC, RF R27 register Bit 2 to 0 */ RT30xxReadRFRegister(pAd, RF_R27, &RFValue); - // TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F). - // Raising RF voltage is no longer needed for RT3070(F) + /* TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F). */ + /* Raising RF voltage is no longer needed for RT3070(F) */ if ((pAd->MACVersion & 0xffff) < 0x0201) RFValue = (RFValue & (~0x77)) | 0x3; else @@ -166,4 +166,4 @@ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd) } } -#endif // RT3070 // +#endif /* RT3070 // */ diff --git a/drivers/staging/rt2860/chips/rt3090.c b/drivers/staging/rt2860/chips/rt3090.c index 143529422f89..cedacfb08791 100644 --- a/drivers/staging/rt2860/chips/rt3090.c +++ b/drivers/staging/rt2860/chips/rt3090.c @@ -41,16 +41,16 @@ #ifndef RTMP_RF_RW_SUPPORT #error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" -#endif // RTMP_RF_RW_SUPPORT // +#endif /* RTMP_RF_RW_SUPPORT // */ VOID NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd) { INT i; - // Driver must read EEPROM to get RfIcType before initial RF registers - // Initialize RF register to default value + /* Driver must read EEPROM to get RfIcType before initial RF registers */ + /* Initialize RF register to default value */ if (IS_RT3090(pAd)) { - // Init RF calibration - // Driver should toggle RF R30 bit7 before init RF registers + /* Init RF calibration */ + /* Driver should toggle RF R30 bit7 before init RF registers */ UINT32 RfReg = 0, data; RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR) & RfReg); @@ -60,14 +60,14 @@ VOID NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd) RfReg &= 0x7F; RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR) RfReg); - // init R24, R31 + /* init R24, R31 */ RT30xxWriteRFRegister(pAd, RF_R24, 0x0F); RT30xxWriteRFRegister(pAd, RF_R31, 0x0F); - // RT309x version E has fixed this issue + /* RT309x version E has fixed this issue */ if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211)) { - // patch tx EVM issue temporarily + /* patch tx EVM issue temporarily */ RTMP_IO_READ32(pAd, LDO_CFG0, &data); data = ((data & 0xE0FFFFFF) | 0x0D000000); RTMP_IO_WRITE32(pAd, LDO_CFG0, data); @@ -77,43 +77,43 @@ VOID NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd) RTMP_IO_WRITE32(pAd, LDO_CFG0, data); } - // patch LNA_PE_G1 failed issue + /* patch LNA_PE_G1 failed issue */ RTMP_IO_READ32(pAd, GPIO_SWITCH, &data); data &= ~(0x20); RTMP_IO_WRITE32(pAd, GPIO_SWITCH, data); - // Initialize RF register to default value + /* Initialize RF register to default value */ for (i = 0; i < NUM_RF_REG_PARMS; i++) { RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value); } - // Driver should set RF R6 bit6 on before calibration + /* Driver should set RF R6 bit6 on before calibration */ RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR) & RfReg); RfReg |= 0x40; RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR) RfReg); - //For RF filter Calibration + /*For RF filter Calibration */ RTMPFilterCalibration(pAd); - // Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration() + /* Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration() */ if ((pAd->MACVersion & 0xffff) < 0x0211) RT30xxWriteRFRegister(pAd, RF_R27, 0x3); - // set led open drain enable + /* set led open drain enable */ RTMP_IO_READ32(pAd, OPT_14, &data); data |= 0x01; RTMP_IO_WRITE32(pAd, OPT_14, data); - // set default antenna as main + /* set default antenna as main */ if (pAd->RfIcType == RFIC_3020) AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); - // add by johnli, RF power sequence setup, load RF normal operation-mode setup + /* add by johnli, RF power sequence setup, load RF normal operation-mode setup */ RT30xxLoadRFNormalModeSetup(pAd); } } -#endif // RT3090 // +#endif /* RT3090 // */ diff --git a/drivers/staging/rt2860/chips/rt30xx.c b/drivers/staging/rt2860/chips/rt30xx.c index 940f731a61c4..b03d94d851b5 100644 --- a/drivers/staging/rt2860/chips/rt30xx.c +++ b/drivers/staging/rt2860/chips/rt30xx.c @@ -39,13 +39,13 @@ #ifndef RTMP_RF_RW_SUPPORT #error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" -#endif // RTMP_RF_RW_SUPPORT // +#endif /* RTMP_RF_RW_SUPPORT // */ #include "../rt_config.h" -// -// RF register initialization set -// +/* */ +/* RF register initialization set */ +/* */ REG_PAIR RT30xx_RFRegTable[] = { {RF_R04, 0x40} , @@ -89,12 +89,12 @@ REG_PAIR RT30xx_RFRegTable[] = { UCHAR NUM_RF_REG_PARMS = (sizeof(RT30xx_RFRegTable) / sizeof(REG_PAIR)); -// Antenna divesity use GPIO3 and EESK pin for control -// Antenna and EEPROM access are both using EESK pin, -// Therefor we should avoid accessing EESK at the same time -// Then restore antenna after EEPROM access -// The original name of this function is AsicSetRxAnt(), now change to -//VOID AsicSetRxAnt( +/* Antenna divesity use GPIO3 and EESK pin for control */ +/* Antenna and EEPROM access are both using EESK pin, */ +/* Therefor we should avoid accessing EESK at the same time */ +/* Then restore antenna after EEPROM access */ +/* The original name of this function is AsicSetRxAnt(), now change to */ +/*VOID AsicSetRxAnt( */ VOID RT30xxSetRxAnt(IN PRTMP_ADAPTER pAd, IN UCHAR Ant) { UINT32 Value; @@ -109,16 +109,16 @@ VOID RT30xxSetRxAnt(IN PRTMP_ADAPTER pAd, IN UCHAR Ant) (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) { return; } - // the antenna selection is through firmware and MAC register(GPIO3) + /* the antenna selection is through firmware and MAC register(GPIO3) */ if (Ant == 0) { - // Main antenna + /* Main antenna */ #ifdef RTMP_MAC_PCI RTMP_IO_READ32(pAd, E2PROM_CSR, &x); x |= (EESK); RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); #else AsicSendCommandToMcu(pAd, 0x73, 0xFF, 0x1, 0x0); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value); Value &= ~(0x0808); @@ -126,14 +126,14 @@ VOID RT30xxSetRxAnt(IN PRTMP_ADAPTER pAd, IN UCHAR Ant) DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to main antenna\n")); } else { - // Aux antenna + /* Aux antenna */ #ifdef RTMP_MAC_PCI RTMP_IO_READ32(pAd, E2PROM_CSR, &x); x &= ~(EESK); RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); #else AsicSendCommandToMcu(pAd, 0x73, 0xFF, 0x0, 0x0); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value); Value &= ~(0x0808); Value |= 0x08; @@ -165,14 +165,14 @@ VOID RTMPFilterCalibration(IN PRTMP_ADAPTER pAd) UINT loop = 0, count = 0, loopcnt = 0, ReTry = 0; UCHAR RF_R24_Value = 0; - // Give bbp filter initial value + /* Give bbp filter initial value */ pAd->Mlme.CaliBW20RfR24 = 0x1F; - pAd->Mlme.CaliBW40RfR24 = 0x2F; //Bit[5] must be 1 for BW 40 + pAd->Mlme.CaliBW40RfR24 = 0x2F; /*Bit[5] must be 1 for BW 40 */ do { - if (loop == 1) //BandWidth = 40 MHz + if (loop == 1) /*BandWidth = 40 MHz */ { - // Write 0x27 to RF_R24 to program filter + /* Write 0x27 to RF_R24 to program filter */ RF_R24_Value = 0x27; RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) @@ -180,19 +180,19 @@ VOID RTMPFilterCalibration(IN PRTMP_ADAPTER pAd) else FilterTarget = 0x19; - // when calibrate BW40, BBP mask must set to BW40. + /* when calibrate BW40, BBP mask must set to BW40. */ RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); BBPValue &= (~0x18); BBPValue |= (0x10); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); - // set to BW40 + /* set to BW40 */ RT30xxReadRFRegister(pAd, RF_R31, &value); value |= 0x20; RT30xxWriteRFRegister(pAd, RF_R31, value); - } else //BandWidth = 20 MHz + } else /*BandWidth = 20 MHz */ { - // Write 0x07 to RF_R24 to program filter + /* Write 0x07 to RF_R24 to program filter */ RF_R24_Value = 0x07; RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) @@ -200,39 +200,39 @@ VOID RTMPFilterCalibration(IN PRTMP_ADAPTER pAd) else FilterTarget = 0x16; - // set to BW20 + /* set to BW20 */ RT30xxReadRFRegister(pAd, RF_R31, &value); value &= (~0x20); RT30xxWriteRFRegister(pAd, RF_R31, value); } - // Write 0x01 to RF_R22 to enable baseband loopback mode + /* Write 0x01 to RF_R22 to enable baseband loopback mode */ RT30xxReadRFRegister(pAd, RF_R22, &value); value |= 0x01; RT30xxWriteRFRegister(pAd, RF_R22, value); - // Write 0x00 to BBP_R24 to set power & frequency of passband test tone + /* Write 0x00 to BBP_R24 to set power & frequency of passband test tone */ RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0); do { - // Write 0x90 to BBP_R25 to transmit test tone + /* Write 0x90 to BBP_R25 to transmit test tone */ RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90); RTMPusecDelay(1000); - // Read BBP_R55[6:0] for received power, set R55x = BBP_R55[6:0] + /* Read BBP_R55[6:0] for received power, set R55x = BBP_R55[6:0] */ RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value); R55x = value & 0xFF; } while ((ReTry++ < 100) && (R55x == 0)); - // Write 0x06 to BBP_R24 to set power & frequency of stopband test tone + /* Write 0x06 to BBP_R24 to set power & frequency of stopband test tone */ RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0x06); while (TRUE) { - // Write 0x90 to BBP_R25 to transmit test tone + /* Write 0x90 to BBP_R25 to transmit test tone */ RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90); - //We need to wait for calibration + /*We need to wait for calibration */ RTMPusecDelay(1000); RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value); value &= 0xFF; @@ -245,27 +245,27 @@ VOID RTMPFilterCalibration(IN PRTMP_ADAPTER pAd) break; } - // prevent infinite loop cause driver hang. + /* prevent infinite loop cause driver hang. */ if (loopcnt++ > 100) { DBGPRINT(RT_DEBUG_ERROR, ("RTMPFilterCalibration - can't find a valid value, loopcnt=%d stop calibrating", loopcnt)); break; } - // Write RF_R24 to program filter + /* Write RF_R24 to program filter */ RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); } if (count > 0) { RF_R24_Value = RF_R24_Value - ((count) ? (1) : (0)); } - // Store for future usage + /* Store for future usage */ if (loopcnt < 100) { if (loop++ == 0) { - //BandWidth = 20 MHz + /*BandWidth = 20 MHz */ pAd->Mlme.CaliBW20RfR24 = (UCHAR) RF_R24_Value; } else { - //BandWidth = 40 MHz + /*BandWidth = 40 MHz */ pAd->Mlme.CaliBW40RfR24 = (UCHAR) RF_R24_Value; break; } @@ -274,20 +274,20 @@ VOID RTMPFilterCalibration(IN PRTMP_ADAPTER pAd) RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value); - // reset count + /* reset count */ count = 0; } while (TRUE); - // - // Set back to initial state - // + /* */ + /* Set back to initial state */ + /* */ RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0); RT30xxReadRFRegister(pAd, RF_R22, &value); value &= ~(0x01); RT30xxWriteRFRegister(pAd, RF_R22, value); - // set BBP back to BW20 + /* set BBP back to BW20 */ RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); BBPValue &= (~0x18); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); @@ -297,7 +297,7 @@ VOID RTMPFilterCalibration(IN PRTMP_ADAPTER pAd) pAd->Mlme.CaliBW20RfR24, pAd->Mlme.CaliBW40RfR24)); } -// add by johnli, RF power sequence setup +/* add by johnli, RF power sequence setup */ /* ========================================================================== Description: @@ -310,12 +310,12 @@ VOID RT30xxLoadRFNormalModeSetup(IN PRTMP_ADAPTER pAd) { UCHAR RFValue; - // RX0_PD & TX0_PD, RF R1 register Bit 2 & Bit 3 to 0 and RF_BLOCK_en,RX1_PD & TX1_PD, Bit0, Bit 4 & Bit5 to 1 + /* RX0_PD & TX0_PD, RF R1 register Bit 2 & Bit 3 to 0 and RF_BLOCK_en,RX1_PD & TX1_PD, Bit0, Bit 4 & Bit5 to 1 */ RT30xxReadRFRegister(pAd, RF_R01, &RFValue); RFValue = (RFValue & (~0x0C)) | 0x31; RT30xxWriteRFRegister(pAd, RF_R01, RFValue); - // TX_LO2_en, RF R15 register Bit 3 to 0 + /* TX_LO2_en, RF R15 register Bit 3 to 0 */ RT30xxReadRFRegister(pAd, RF_R15, &RFValue); RFValue &= (~0x08); RT30xxWriteRFRegister(pAd, RF_R15, RFValue); @@ -338,22 +338,22 @@ VOID RT30xxLoadRFNormalModeSetup(IN PRTMP_ADAPTER pAd) RT30xxWriteRFRegister(pAd, RF_R17, RFValue); */ - // RX_LO1_en, RF R20 register Bit 3 to 0 + /* RX_LO1_en, RF R20 register Bit 3 to 0 */ RT30xxReadRFRegister(pAd, RF_R20, &RFValue); RFValue &= (~0x08); RT30xxWriteRFRegister(pAd, RF_R20, RFValue); - // RX_LO2_en, RF R21 register Bit 3 to 0 + /* RX_LO2_en, RF R21 register Bit 3 to 0 */ RT30xxReadRFRegister(pAd, RF_R21, &RFValue); RFValue &= (~0x08); RT30xxWriteRFRegister(pAd, RF_R21, RFValue); /* add by johnli, reset RF_R27 when interface down & up to fix throughput problem */ - // LDORF_VC, RF R27 register Bit 2 to 0 + /* LDORF_VC, RF R27 register Bit 2 to 0 */ RT30xxReadRFRegister(pAd, RF_R27, &RFValue); - // TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F). - // Raising RF voltage is no longer needed for RT3070(F) - if (IS_RT3090(pAd)) // RT309x and RT3071/72 + /* TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F). */ + /* Raising RF voltage is no longer needed for RT3070(F) */ + if (IS_RT3090(pAd)) /* RT309x and RT3071/72 */ { if ((pAd->MACVersion & 0xffff) < 0x0211) RFValue = (RFValue & (~0x77)) | 0x3; @@ -379,35 +379,35 @@ VOID RT30xxLoadRFSleepModeSetup(IN PRTMP_ADAPTER pAd) #ifdef RTMP_MAC_USB if (!IS_RT3572(pAd)) -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ { - // RF_BLOCK_en. RF R1 register Bit 0 to 0 + /* RF_BLOCK_en. RF R1 register Bit 0 to 0 */ RT30xxReadRFRegister(pAd, RF_R01, &RFValue); RFValue &= (~0x01); RT30xxWriteRFRegister(pAd, RF_R01, RFValue); - // VCO_IC, RF R7 register Bit 4 & Bit 5 to 0 + /* VCO_IC, RF R7 register Bit 4 & Bit 5 to 0 */ RT30xxReadRFRegister(pAd, RF_R07, &RFValue); RFValue &= (~0x30); RT30xxWriteRFRegister(pAd, RF_R07, RFValue); - // Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 0 + /* Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 0 */ RT30xxReadRFRegister(pAd, RF_R09, &RFValue); RFValue &= (~0x0E); RT30xxWriteRFRegister(pAd, RF_R09, RFValue); - // RX_CTB_en, RF R21 register Bit 7 to 0 + /* RX_CTB_en, RF R21 register Bit 7 to 0 */ RT30xxReadRFRegister(pAd, RF_R21, &RFValue); RFValue &= (~0x80); RT30xxWriteRFRegister(pAd, RF_R21, RFValue); } - if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72 + if (IS_RT3090(pAd) || /* IS_RT3090 including RT309x and RT3071/72 */ IS_RT3572(pAd) || (IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) { #ifdef RTMP_MAC_USB if (!IS_RT3572(pAd)) -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ { RT30xxReadRFRegister(pAd, RF_R27, &RFValue); RFValue |= 0x77; @@ -435,36 +435,36 @@ VOID RT30xxReverseRFSleepModeSetup(IN PRTMP_ADAPTER pAd) #ifdef RTMP_MAC_USB if (!IS_RT3572(pAd)) -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ { - // RF_BLOCK_en, RF R1 register Bit 0 to 1 + /* RF_BLOCK_en, RF R1 register Bit 0 to 1 */ RT30xxReadRFRegister(pAd, RF_R01, &RFValue); RFValue |= 0x01; RT30xxWriteRFRegister(pAd, RF_R01, RFValue); - // VCO_IC, RF R7 register Bit 4 & Bit 5 to 1 + /* VCO_IC, RF R7 register Bit 4 & Bit 5 to 1 */ RT30xxReadRFRegister(pAd, RF_R07, &RFValue); RFValue |= 0x30; RT30xxWriteRFRegister(pAd, RF_R07, RFValue); - // Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 1 + /* Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 1 */ RT30xxReadRFRegister(pAd, RF_R09, &RFValue); RFValue |= 0x0E; RT30xxWriteRFRegister(pAd, RF_R09, RFValue); - // RX_CTB_en, RF R21 register Bit 7 to 1 + /* RX_CTB_en, RF R21 register Bit 7 to 1 */ RT30xxReadRFRegister(pAd, RF_R21, &RFValue); RFValue |= 0x80; RT30xxWriteRFRegister(pAd, RF_R21, RFValue); } - if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72 + if (IS_RT3090(pAd) || /* IS_RT3090 including RT309x and RT3071/72 */ IS_RT3572(pAd) || IS_RT3390(pAd) || (IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) { #ifdef RTMP_MAC_USB if (!IS_RT3572(pAd)) -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ { RT30xxReadRFRegister(pAd, RF_R27, &RFValue); if ((pAd->MACVersion & 0xffff) < 0x0211) @@ -473,10 +473,10 @@ VOID RT30xxReverseRFSleepModeSetup(IN PRTMP_ADAPTER pAd) RFValue = (RFValue & (~0x77)); RT30xxWriteRFRegister(pAd, RF_R27, RFValue); } - // RT3071 version E has fixed this issue + /* RT3071 version E has fixed this issue */ if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211)) { - // patch tx EVM issue temporarily + /* patch tx EVM issue temporarily */ RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue); MACValue = ((MACValue & 0xE0FFFFFF) | 0x0D000000); RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue); @@ -491,22 +491,22 @@ VOID RT30xxReverseRFSleepModeSetup(IN PRTMP_ADAPTER pAd) RT30xxWriteRFRegister(pAd, RF_R08, 0x80); } -// end johnli +/* end johnli */ VOID RT30xxHaltAction(IN PRTMP_ADAPTER pAd) { UINT32 TxPinCfg = 0x00050F0F; - // - // Turn off LNA_PE or TRSW_POL - // + /* */ + /* Turn off LNA_PE or TRSW_POL */ + /* */ if (IS_RT3070(pAd) || IS_RT3071(pAd) || IS_RT3572(pAd)) { if ((IS_RT3071(pAd) || IS_RT3572(pAd)) #ifdef RTMP_EFUSE_SUPPORT && (pAd->bUseEfuse) -#endif // RTMP_EFUSE_SUPPORT // +#endif /* RTMP_EFUSE_SUPPORT // */ ) { - TxPinCfg &= 0xFFFBF0F0; // bit18 off + TxPinCfg &= 0xFFFBF0F0; /* bit18 off */ } else { TxPinCfg &= 0xFFFFF0F0; } @@ -515,4 +515,4 @@ VOID RT30xxHaltAction(IN PRTMP_ADAPTER pAd) } } -#endif // RT30xx // +#endif /* RT30xx // */ diff --git a/drivers/staging/rt2860/pci_main_dev.c b/drivers/staging/rt2860/pci_main_dev.c index 2a22e458ae00..76c71f1882f3 100644 --- a/drivers/staging/rt2860/pci_main_dev.c +++ b/drivers/staging/rt2860/pci_main_dev.c @@ -38,17 +38,17 @@ #include "rt_config.h" #include -// Following information will be show when you run 'modinfo' -// *** If you have a solution for the bug in current version of driver, please mail to me. -// Otherwise post to forum in ralinktech's web site(www.ralinktech.com) and let all users help you. *** +/* Following information will be show when you run 'modinfo' */ +/* *** If you have a solution for the bug in current version of driver, please mail to me. */ +/* Otherwise post to forum in ralinktech's web site(www.ralinktech.com) and let all users help you. *** */ MODULE_AUTHOR("Jett Chen "); MODULE_DESCRIPTION("RT2860/RT3090 Wireless Lan Linux Driver"); MODULE_LICENSE("GPL"); MODULE_ALIAS("rt3090sta"); -// -// Function declarations -// +/* */ +/* Function declarations */ +/* */ extern int rt28xx_close(IN struct net_device *net_dev); extern int rt28xx_open(struct net_device *net_dev); @@ -64,14 +64,14 @@ static VOID RTMPInitPCIeDevice(IN struct pci_dev *pci_dev, #ifdef CONFIG_PM static int rt2860_suspend(struct pci_dev *pci_dev, pm_message_t state); static int rt2860_resume(struct pci_dev *pci_dev); -#endif // CONFIG_PM // +#endif /* CONFIG_PM // */ -// -// Ralink PCI device table, include all supported chipsets -// +/* */ +/* Ralink PCI device table, include all supported chipsets */ +/* */ static struct pci_device_id rt2860_pci_tbl[] __devinitdata = { #ifdef RT2860 - {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2860_PCI_DEVICE_ID)}, //RT28602.4G + {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2860_PCI_DEVICE_ID)}, /*RT28602.4G */ {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2860_PCIe_DEVICE_ID)}, {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2760_PCI_DEVICE_ID)}, {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC2790_PCIe_DEVICE_ID)}, @@ -88,13 +88,13 @@ static struct pci_device_id rt2860_pci_tbl[] __devinitdata = { {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3090_PCIe_DEVICE_ID)}, {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3091_PCIe_DEVICE_ID)}, {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3092_PCIe_DEVICE_ID)}, -#endif // RT3090 // +#endif /* RT3090 // */ #ifdef RT3390 {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3390_PCIe_DEVICE_ID)}, {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3391_PCIe_DEVICE_ID)}, {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3392_PCIe_DEVICE_ID)}, -#endif // RT3390 // - {0,} // terminate list +#endif /* RT3390 // */ + {0,} /* terminate list */ }; MODULE_DEVICE_TABLE(pci, rt2860_pci_tbl); @@ -102,9 +102,9 @@ MODULE_DEVICE_TABLE(pci, rt2860_pci_tbl); MODULE_VERSION(STA_DRIVER_VERSION); #endif -// -// Our PCI driver structure -// +/* */ +/* Our PCI driver structure */ +/* */ static struct pci_driver rt2860_driver = { name: "rt2860", id_table:rt2860_pci_tbl, @@ -125,8 +125,8 @@ resume:rt2860_resume, VOID RT2860RejectPendingPackets(IN PRTMP_ADAPTER pAd) { - // clear PS packets - // clear TxSw packets + /* clear PS packets */ + /* clear TxSw packets */ } static int rt2860_suspend(struct pci_dev *pci_dev, pm_message_t state) @@ -146,33 +146,33 @@ static int rt2860_suspend(struct pci_dev *pci_dev, pm_message_t state) /* and 1 suspend/resume function for 1 module, not for each interface */ /* so Linux will call suspend/resume function once */ if (VIRTUAL_IF_NUM(pAd) > 0) { - // avoid users do suspend after interface is down + /* avoid users do suspend after interface is down */ - // stop interface + /* stop interface */ netif_carrier_off(net_dev); netif_stop_queue(net_dev); - // mark device as removed from system and therefore no longer available + /* mark device as removed from system and therefore no longer available */ netif_device_detach(net_dev); - // mark halt flag + /* mark halt flag */ RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - // take down the device + /* take down the device */ rt28xx_close((PNET_DEV) net_dev); RT_MOD_DEC_USE_COUNT(); } } - // reference to http://vovo2000.com/type-lab/linux/kernel-api/linux-kernel-api.html - // enable device to generate PME# when suspended - // pci_choose_state(): Choose the power state of a PCI device to be suspended + /* reference to http://vovo2000.com/type-lab/linux/kernel-api/linux-kernel-api.html */ + /* enable device to generate PME# when suspended */ + /* pci_choose_state(): Choose the power state of a PCI device to be suspended */ retval = pci_enable_wake(pci_dev, pci_choose_state(pci_dev, state), 1); - // save the PCI configuration space of a device before suspending + /* save the PCI configuration space of a device before suspending */ pci_save_state(pci_dev); - // disable PCI device after use + /* disable PCI device after use */ pci_disable_device(pci_dev); retval = pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)); @@ -187,22 +187,22 @@ static int rt2860_resume(struct pci_dev *pci_dev) PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) NULL; INT32 retval; - // set the power state of a PCI device - // PCI has 4 power states, DO (normal) ~ D3(less power) - // in include/linux/pci.h, you can find that - // #define PCI_D0 ((pci_power_t __force) 0) - // #define PCI_D1 ((pci_power_t __force) 1) - // #define PCI_D2 ((pci_power_t __force) 2) - // #define PCI_D3hot ((pci_power_t __force) 3) - // #define PCI_D3cold ((pci_power_t __force) 4) - // #define PCI_UNKNOWN ((pci_power_t __force) 5) - // #define PCI_POWER_ERROR ((pci_power_t __force) -1) + /* set the power state of a PCI device */ + /* PCI has 4 power states, DO (normal) ~ D3(less power) */ + /* in include/linux/pci.h, you can find that */ + /* #define PCI_D0 ((pci_power_t __force) 0) */ + /* #define PCI_D1 ((pci_power_t __force) 1) */ + /* #define PCI_D2 ((pci_power_t __force) 2) */ + /* #define PCI_D3hot ((pci_power_t __force) 3) */ + /* #define PCI_D3cold ((pci_power_t __force) 4) */ + /* #define PCI_UNKNOWN ((pci_power_t __force) 5) */ + /* #define PCI_POWER_ERROR ((pci_power_t __force) -1) */ retval = pci_set_power_state(pci_dev, PCI_D0); - // restore the saved state of a PCI device + /* restore the saved state of a PCI device */ pci_restore_state(pci_dev); - // initialize device before it's used by a driver + /* initialize device before it's used by a driver */ if (pci_enable_device(pci_dev)) { printk("pci enable fail!\n"); return 0; @@ -220,16 +220,16 @@ static int rt2860_resume(struct pci_dev *pci_dev) /* and 1 suspend/resume function for 1 module, not for each interface */ /* so Linux will call suspend/resume function once */ if (VIRTUAL_IF_NUM(pAd) > 0) { - // mark device as attached from system and restart if needed + /* mark device as attached from system and restart if needed */ netif_device_attach(net_dev); if (rt28xx_open((PNET_DEV) net_dev) != 0) { - // open fail + /* open fail */ DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_resume()\n")); return 0; } - // increase MODULE use count + /* increase MODULE use count */ RT_MOD_INC_USE_COUNT(); RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); @@ -244,16 +244,16 @@ static int rt2860_resume(struct pci_dev *pci_dev) DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_resume()\n")); return 0; } -#endif // CONFIG_PM // +#endif /* CONFIG_PM // */ static INT __init rt2860_init_module(VOID) { return pci_register_driver(&rt2860_driver); } -// -// Driver module unload function -// +/* */ +/* Driver module unload function */ +/* */ static VOID __exit rt2860_cleanup_module(VOID) { pci_unregister_driver(&rt2860_driver); @@ -262,9 +262,9 @@ static VOID __exit rt2860_cleanup_module(VOID) module_init(rt2860_init_module); module_exit(rt2860_cleanup_module); -// -// PCI device probe & initialization function -// +/* */ +/* PCI device probe & initialization function */ +/* */ static INT __devinit rt2860_probe(IN struct pci_dev *pci_dev, IN const struct pci_device_id *pci_id) { @@ -278,8 +278,8 @@ static INT __devinit rt2860_probe(IN struct pci_dev *pci_dev, DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_probe\n")); -//PCIDevInit============================================== - // wake up and enable device +/*PCIDevInit============================================== */ + /* wake up and enable device */ if ((rv = pci_enable_device(pci_dev)) != 0) { DBGPRINT(RT_DEBUG_ERROR, ("Enable PCI device failed, errno=%d!\n", rv)); @@ -293,7 +293,7 @@ static INT __devinit rt2860_probe(IN struct pci_dev *pci_dev, ("Request PCI resource failed, errno=%d!\n", rv)); goto err_out; } - // map physical address to virtual address for accessing register + /* map physical address to virtual address for accessing register */ csr_addr = (unsigned long)ioremap(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); @@ -310,11 +310,11 @@ static INT __devinit rt2860_probe(IN struct pci_dev *pci_dev, (ULONG) csr_addr, pci_dev->irq)); } - // Set DMA master + /* Set DMA master */ pci_set_master(pci_dev); -//RtmpDevInit============================================== - // Allocate RTMP_ADAPTER adapter structure +/*RtmpDevInit============================================== */ + /* Allocate RTMP_ADAPTER adapter structure */ handle = kmalloc(sizeof(struct os_cookie), GFP_KERNEL); if (handle == NULL) { DBGPRINT(RT_DEBUG_ERROR, @@ -325,25 +325,25 @@ static INT __devinit rt2860_probe(IN struct pci_dev *pci_dev, ((POS_COOKIE) handle)->pci_dev = pci_dev; - rv = RTMPAllocAdapterBlock(handle, &pAd); //shiang: we may need the pci_dev for allocate structure of "RTMP_ADAPTER" + rv = RTMPAllocAdapterBlock(handle, &pAd); /*shiang: we may need the pci_dev for allocate structure of "RTMP_ADAPTER" */ if (rv != NDIS_STATUS_SUCCESS) goto err_out_iounmap; - // Here are the RTMP_ADAPTER structure with pci-bus specific parameters. + /* Here are the RTMP_ADAPTER structure with pci-bus specific parameters. */ pAd->CSRBaseAddress = (PUCHAR) csr_addr; DBGPRINT(RT_DEBUG_ERROR, ("pAd->CSRBaseAddress =0x%lx, csr_addr=0x%lx!\n", (ULONG) pAd->CSRBaseAddress, csr_addr)); RtmpRaDevCtrlInit(pAd, RTMP_DEV_INF_PCI); -//NetDevInit============================================== +/*NetDevInit============================================== */ net_dev = RtmpPhyNetDevInit(pAd, &netDevHook); if (net_dev == NULL) goto err_out_free_radev; - // Here are the net_device structure with pci-bus specific parameters. - net_dev->irq = pci_dev->irq; // Interrupt IRQ number - net_dev->base_addr = csr_addr; // Save CSR virtual address and irq to device structure - pci_set_drvdata(pci_dev, net_dev); // Set driver data + /* Here are the net_device structure with pci-bus specific parameters. */ + net_dev->irq = pci_dev->irq; /* Interrupt IRQ number */ + net_dev->base_addr = csr_addr; /* Save CSR virtual address and irq to device structure */ + pci_set_drvdata(pci_dev, net_dev); /* Set driver data */ /* for supporting Network Manager */ /* Set the sysfs physical device reference for the network logical device @@ -351,8 +351,8 @@ static INT __devinit rt2860_probe(IN struct pci_dev *pci_dev, */ SET_NETDEV_DEV(net_dev, &(pci_dev->dev)); -//All done, it's time to register the net device to linux kernel. - // Register this device +/*All done, it's time to register the net device to linux kernel. */ + /* Register this device */ rv = RtmpOSNetDevAttach(net_dev, &netDevHook); if (rv) goto err_out_free_netdev; @@ -362,7 +362,7 @@ static INT __devinit rt2860_probe(IN struct pci_dev *pci_dev, DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_probe\n")); - return 0; // probe ok + return 0; /* probe ok */ /* --------------------------- ERROR HANDLE --------------------------- */ err_out_free_netdev: @@ -393,39 +393,39 @@ static VOID __devexit rt2860_remove_one(IN struct pci_dev *pci_dev) { PNET_DEV net_dev = pci_get_drvdata(pci_dev); RTMP_ADAPTER *pAd = NULL; - ULONG csr_addr = net_dev->base_addr; // pAd->CSRBaseAddress; + ULONG csr_addr = net_dev->base_addr; /* pAd->CSRBaseAddress; */ GET_PAD_FROM_NET_DEV(pAd, net_dev); DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_remove_one\n")); if (pAd != NULL) { - // Unregister/Free all allocated net_device. + /* Unregister/Free all allocated net_device. */ RtmpPhyNetDevExit(pAd, net_dev); - // Unmap CSR base address + /* Unmap CSR base address */ iounmap((char *)(csr_addr)); - // release memory region + /* release memory region */ release_mem_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); - // Free RTMP_ADAPTER related structures. + /* Free RTMP_ADAPTER related structures. */ RtmpRaDevCtrlExit(pAd); } else { - // Unregister network device + /* Unregister network device */ RtmpOSNetDevDetach(net_dev); - // Unmap CSR base address + /* Unmap CSR base address */ iounmap((char *)(net_dev->base_addr)); - // release memory region + /* release memory region */ release_mem_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); } - // Free the root net_device + /* Free the root net_device */ RtmpOSNetDevFree(net_dev); } @@ -475,7 +475,7 @@ static VOID RTMPInitPCIeDevice(IN struct pci_dev *pci_dev, IN PRTMP_ADAPTER pAd) (device_id == NIC3090_PCIe_DEVICE_ID) || (device_id == NIC3091_PCIe_DEVICE_ID) || (device_id == NIC3092_PCIe_DEVICE_ID) || -#endif // RT3090 // +#endif /* RT3090 // */ 0) { UINT32 MacCsr0 = 0, Index = 0; do { @@ -487,8 +487,8 @@ static VOID RTMPInitPCIeDevice(IN struct pci_dev *pci_dev, IN PRTMP_ADAPTER pAd) RTMPusecDelay(10); } while (Index++ < 100); - // Support advanced power save after 2892/2790. - // MAC version at offset 0x1000 is 0x2872XXXX/0x2870XXXX(PCIe, USB, SDIO). + /* Support advanced power save after 2892/2790. */ + /* MAC version at offset 0x1000 is 0x2872XXXX/0x2870XXXX(PCIe, USB, SDIO). */ if ((MacCsr0 & 0xffff0000) != 0x28600000) { OPSTATUS_SET_FLAG(pAd, fOP_STATUS_PCIE_DEVICE); } @@ -509,7 +509,7 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) return; DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __func__)); - // Init EEPROM, and save settings + /* Init EEPROM, and save settings */ if (!(IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) { RT28xx_EEPROM_READ16(pAd, 0x22, PCIePowerSaveLevel); pAd->PCIePowerSaveLevel = PCIePowerSaveLevel & 0xff; @@ -541,16 +541,16 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) PCIePowerSaveLevel &= 0xff; PCIePowerSaveLevel = PCIePowerSaveLevel >> 6; switch (PCIePowerSaveLevel) { - case 0: // Only support L0 + case 0: /* Only support L0 */ pAd->LnkCtrlBitMask = 0; break; - case 1: // Only enable L0s + case 1: /* Only enable L0s */ pAd->LnkCtrlBitMask = 1; break; - case 2: // enable L1, L0s + case 2: /* enable L1, L0s */ pAd->LnkCtrlBitMask = 3; break; - case 3: // sync with host clk and enable L1, L0s + case 3: /* sync with host clk and enable L1, L0s */ pAd->LnkCtrlBitMask = 0x103; break; } @@ -580,7 +580,7 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) } else if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) { UCHAR LinkCtrlSetting = 0; - // Check 3090E special setting chip. + /* Check 3090E special setting chip. */ RT28xx_EEPROM_READ16(pAd, 0x24, data2); if ((data2 == 0x9280) && ((pAd->MACVersion & 0xffff) == 0x0211)) { pAd->b3090ESpecialChip = TRUE; @@ -588,37 +588,37 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) } RTMP_IO_READ32(pAd, AUX_CTRL, &MacValue); - //enable WAKE_PCIE function, which forces to enable PCIE clock when mpu interrupt asserting. - //Force PCIE 125MHz CLK to toggle + /*enable WAKE_PCIE function, which forces to enable PCIE clock when mpu interrupt asserting. */ + /*Force PCIE 125MHz CLK to toggle */ MacValue |= 0x402; RTMP_IO_WRITE32(pAd, AUX_CTRL, MacValue); DBGPRINT_RAW(RT_DEBUG_ERROR, (" AUX_CTRL = 0x%32x\n", MacValue)); - // for RT30xx F and after, PCIe infterface, and for power solution 3 + /* for RT30xx F and after, PCIe infterface, and for power solution 3 */ if ((IS_VERSION_AFTER_F(pAd)) && (pAd->StaCfg.PSControl.field.rt30xxPowerMode >= 2) && (pAd->StaCfg.PSControl.field.rt30xxPowerMode <= 3)) { RTMP_IO_READ32(pAd, AUX_CTRL, &MacValue); DBGPRINT_RAW(RT_DEBUG_ERROR, (" Read AUX_CTRL = 0x%x\n", MacValue)); - // turn on bit 12. - //enable 32KHz clock mode for power saving + /* turn on bit 12. */ + /*enable 32KHz clock mode for power saving */ MacValue |= 0x1000; if (MacValue != 0xffffffff) { RTMP_IO_WRITE32(pAd, AUX_CTRL, MacValue); DBGPRINT_RAW(RT_DEBUG_ERROR, (" Write AUX_CTRL = 0x%x\n", MacValue)); - // 1. if use PCIePowerSetting is 2 or 3, need to program OSC_CTRL to 0x3ff11. + /* 1. if use PCIePowerSetting is 2 or 3, need to program OSC_CTRL to 0x3ff11. */ MacValue = 0x3ff11; RTMP_IO_WRITE32(pAd, OSC_CTRL, MacValue); DBGPRINT_RAW(RT_DEBUG_ERROR, (" OSC_CTRL = 0x%x\n", MacValue)); - // 2. Write PCI register Clk ref bit + /* 2. Write PCI register Clk ref bit */ RTMPrt3xSetPCIePowerLinkCtrl(pAd); } else { - // Error read Aux_Ctrl value. Force to use solution 1 + /* Error read Aux_Ctrl value. Force to use solution 1 */ DBGPRINT(RT_DEBUG_ERROR, (" Error Value in AUX_CTRL = 0x%x\n", MacValue)); @@ -627,20 +627,20 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) (" Force to use power solution1 \n")); } } - // 1. read setting from inf file. + /* 1. read setting from inf file. */ PCIePowerSaveLevel = (USHORT) pAd->StaCfg.PSControl.field.rt30xxPowerMode; DBGPRINT(RT_DEBUG_ERROR, ("====> rt30xx Read PowerLevelMode = 0x%x.\n", PCIePowerSaveLevel)); - // 2. Check EnableNewPS. + /* 2. Check EnableNewPS. */ if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) PCIePowerSaveLevel = 1; if (IS_VERSION_BEFORE_F(pAd) && (pAd->b3090ESpecialChip == FALSE)) { - // Chip Version E only allow 1, So force set 1. + /* Chip Version E only allow 1, So force set 1. */ PCIePowerSaveLevel &= 0x1; pAd->PCIePowerSaveLevel = (USHORT) PCIePowerSaveLevel; DBGPRINT(RT_DEBUG_TRACE, @@ -650,7 +650,7 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) AsicSendCommandToMcu(pAd, 0x83, 0xff, (UCHAR) PCIePowerSaveLevel, 0x00); } else { - // Chip Version F and after only allow 1 or 2 or 3. This might be modified after new chip version come out. + /* Chip Version F and after only allow 1 or 2 or 3. This might be modified after new chip version come out. */ if (! ((PCIePowerSaveLevel == 1) || (PCIePowerSaveLevel == 3))) @@ -659,8 +659,8 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) ("====> rt30xx F Write 0x83 Command = 0x%x.\n", PCIePowerSaveLevel)); pAd->PCIePowerSaveLevel = (USHORT) PCIePowerSaveLevel; - // for 3090F , we need to add high-byte arg for 0x83 command to indicate the link control setting in - // PCI Configuration Space. Because firmware can't read PCI Configuration Space + /* for 3090F , we need to add high-byte arg for 0x83 command to indicate the link control setting in */ + /* PCI Configuration Space. Because firmware can't read PCI Configuration Space */ if ((pAd->Rt3xxRalinkLinkCtrl & 0x2) && (pAd->Rt3xxHostLinkCtrl & 0x2)) { LinkCtrlSetting = 1; @@ -673,11 +673,11 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) LinkCtrlSetting); } } - // Find Ralink PCIe Device's Express Capability Offset + /* Find Ralink PCIe Device's Express Capability Offset */ pos = pci_find_capability(pObj->pci_dev, PCI_CAP_ID_EXP); if (pos != 0) { - // Ralink PCIe Device's Link Control Register Offset + /* Ralink PCIe Device's Link Control Register Offset */ pAd->RLnkCtrlOffset = pos + PCI_EXP_LNKCTL; pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, ®16); @@ -698,7 +698,7 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) ("Write (Ralink PCIe Link Control Register) offset 0x%x = 0x%x\n", pos + PCI_EXP_LNKCTL, Configuration)); } -#endif // RT2860 // +#endif /* RT2860 // */ RTMPFindHostPCIDev(pAd); if (pObj->parent_pci_dev) { @@ -711,14 +711,14 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) bFindIntel = TRUE; RTMP_SET_PSFLAG(pAd, fRTMP_PS_TOGGLE_L1); } - // Find PCI-to-PCI Bridge Express Capability Offset + /* Find PCI-to-PCI Bridge Express Capability Offset */ pos = pci_find_capability(pObj->parent_pci_dev, PCI_CAP_ID_EXP); if (pos != 0) { BOOLEAN bChange = FALSE; - // PCI-to-PCI Bridge Link Control Register Offset + /* PCI-to-PCI Bridge Link Control Register Offset */ pAd->HostLnkCtrlOffset = pos + PCI_EXP_LNKCTL; pci_read_config_word(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, @@ -739,7 +739,7 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) case NIC2790_PCIe_DEVICE_ID: bChange = TRUE; break; -#endif // RT2860 // +#endif /* RT2860 // */ #ifdef RT3090 case NIC3090_PCIe_DEVICE_ID: case NIC3091_PCIe_DEVICE_ID: @@ -747,7 +747,7 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) if (bFindIntel == FALSE) bChange = TRUE; break; -#endif // RT3090 // +#endif /* RT3090 // */ default: break; } @@ -782,14 +782,14 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) if (bFindIntel == FALSE) { DBGPRINT(RT_DEBUG_TRACE, ("Doesn't find Intel PCI host controller. \n")); - // Doesn't switch L0, L1, So set PCIePowerSaveLevel to 0xff + /* Doesn't switch L0, L1, So set PCIePowerSaveLevel to 0xff */ pAd->PCIePowerSaveLevel = 0xff; if ((pAd->RLnkCtrlOffset != 0) #ifdef RT3090 && ((pObj->DeviceID == NIC3090_PCIe_DEVICE_ID) || (pObj->DeviceID == NIC3091_PCIe_DEVICE_ID) || (pObj->DeviceID == NIC3092_PCIe_DEVICE_ID)) -#endif // RT3090 // +#endif /* RT3090 // */ ) { pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, ®16); @@ -871,20 +871,20 @@ VOID RTMPPCIeLinkCtrlValueRestore(IN PRTMP_ADAPTER pAd, IN UCHAR Level) if (!((pObj->DeviceID == NIC2860_PCIe_DEVICE_ID) || (pObj->DeviceID == NIC2790_PCIe_DEVICE_ID))) return; -#endif // RT2860 // - // Check PSControl Configuration +#endif /* RT2860 // */ + /* Check PSControl Configuration */ if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) return; - //3090 will not execute the following codes. - // Check interface : If not PCIe interface, return. + /*3090 will not execute the following codes. */ + /* Check interface : If not PCIe interface, return. */ #ifdef RT3090 if ((pObj->DeviceID == NIC3090_PCIe_DEVICE_ID) || (pObj->DeviceID == NIC3091_PCIe_DEVICE_ID) || (pObj->DeviceID == NIC3092_PCIe_DEVICE_ID)) return; -#endif // RT3090 // +#endif /* RT3090 // */ DBGPRINT(RT_DEBUG_TRACE, ("%s.===>\n", __func__)); PCIePowerSaveLevel = pAd->PCIePowerSaveLevel; @@ -898,7 +898,7 @@ VOID RTMPPCIeLinkCtrlValueRestore(IN PRTMP_ADAPTER pAd, IN UCHAR Level) Configuration); if ((Configuration != 0) && (Configuration != 0xFFFF)) { Configuration &= 0xfefc; - // If call from interface down, restore to orginial setting. + /* If call from interface down, restore to orginial setting. */ if (Level == RESTORE_CLOSE) { Configuration |= pAd->HostLnkCtrlConfiguration; } else @@ -920,7 +920,7 @@ VOID RTMPPCIeLinkCtrlValueRestore(IN PRTMP_ADAPTER pAd, IN UCHAR Level) Configuration); if ((Configuration != 0) && (Configuration != 0xFFFF)) { Configuration &= 0xfefc; - // If call from interface down, restore to orginial setting. + /* If call from interface down, restore to orginial setting. */ if (Level == RESTORE_CLOSE) Configuration |= pAd->RLnkCtrlConfiguration; else @@ -965,20 +965,20 @@ VOID RTMPPCIeLinkCtrlSetting(IN PRTMP_ADAPTER pAd, IN USHORT Max) if (!((pObj->DeviceID == NIC2860_PCIe_DEVICE_ID) || (pObj->DeviceID == NIC2790_PCIe_DEVICE_ID))) return; -#endif // RT2860 // - // Check PSControl Configuration +#endif /* RT2860 // */ + /* Check PSControl Configuration */ if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) return; - // Check interface : If not PCIe interface, return. - //Block 3090 to enter the following function + /* Check interface : If not PCIe interface, return. */ + /*Block 3090 to enter the following function */ #ifdef RT3090 if ((pObj->DeviceID == NIC3090_PCIe_DEVICE_ID) || (pObj->DeviceID == NIC3091_PCIe_DEVICE_ID) || (pObj->DeviceID == NIC3092_PCIe_DEVICE_ID)) return; -#endif // RT3090 // +#endif /* RT3090 // */ if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP)) { DBGPRINT(RT_DEBUG_INFO, ("RTMPPCIePowerLinkCtrl return on fRTMP_PS_CAN_GO_SLEEP flag\n")); @@ -993,27 +993,27 @@ VOID RTMPPCIeLinkCtrlSetting(IN PRTMP_ADAPTER pAd, IN USHORT Max) } PCIePowerSaveLevel = PCIePowerSaveLevel >> 6; - // Skip non-exist deice right away + /* Skip non-exist deice right away */ if (pObj->parent_pci_dev && (pAd->HostLnkCtrlOffset != 0)) { PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, Configuration); switch (PCIePowerSaveLevel) { case 0: - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 00 + /* Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 00 */ Configuration &= 0xfefc; break; case 1: - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 01 + /* Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 01 */ Configuration &= 0xfefc; Configuration |= 0x1; break; case 2: - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 + /* Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 */ Configuration &= 0xfefc; Configuration |= 0x3; break; case 3: - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 and bit 8 of LinkControl of 2892 to 1 + /* Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 and bit 8 of LinkControl of 2892 to 1 */ Configuration &= 0xfefc; Configuration |= 0x103; break; @@ -1026,7 +1026,7 @@ VOID RTMPPCIeLinkCtrlSetting(IN PRTMP_ADAPTER pAd, IN USHORT Max) } if (pObj->pci_dev && (pAd->RLnkCtrlOffset != 0)) { - // first 2892 chip not allow to frequently set mode 3. will cause hang problem. + /* first 2892 chip not allow to frequently set mode 3. will cause hang problem. */ if (PCIePowerSaveLevel > Max) PCIePowerSaveLevel = Max; @@ -1034,25 +1034,25 @@ VOID RTMPPCIeLinkCtrlSetting(IN PRTMP_ADAPTER pAd, IN USHORT Max) Configuration); switch (PCIePowerSaveLevel) { case 0: - // No PCI power safe - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 00 . + /* No PCI power safe */ + /* Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 00 . */ Configuration &= 0xfefc; break; case 1: - // L0 - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 01 . + /* L0 */ + /* Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 01 . */ Configuration &= 0xfefc; Configuration |= 0x1; break; case 2: - // L0 and L1 - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 + /* L0 and L1 */ + /* Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 */ Configuration &= 0xfefc; Configuration |= 0x3; break; case 3: - // L0 , L1 and clock management. - // Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 and bit 8 of LinkControl of 2892 to 1 + /* L0 , L1 and clock management. */ + /* Set b0 and b1 of LinkControl (both 2892 and PCIe bridge) to 11 and bit 8 of LinkControl of 2892 to 1 */ Configuration &= 0xfefc; Configuration |= 0x103; pAd->bPCIclkOff = TRUE; @@ -1091,35 +1091,35 @@ VOID RTMPrt3xSetPCIePowerLinkCtrl(IN PRTMP_ADAPTER pAd) ("RTMPrt3xSetPCIePowerLinkCtrl.===> %lx\n", pAd->StaCfg.PSControl.word)); - // Check PSControl Configuration + /* Check PSControl Configuration */ if (pAd->StaCfg.PSControl.field.EnableNewPS == FALSE) return; RTMPFindHostPCIDev(pAd); if (pObj->parent_pci_dev) { - // Find PCI-to-PCI Bridge Express Capability Offset + /* Find PCI-to-PCI Bridge Express Capability Offset */ pos = pci_find_capability(pObj->parent_pci_dev, PCI_CAP_ID_EXP); if (pos != 0) { pAd->HostLnkCtrlOffset = pos + PCI_EXP_LNKCTL; } - // If configurared to turn on L1. + /* If configurared to turn on L1. */ HostConfiguration = 0; if (pAd->StaCfg.PSControl.field.rt30xxForceASPMTest == 1) { DBGPRINT(RT_DEBUG_TRACE, ("Enter,PSM : Force ASPM \n")); - // Skip non-exist deice right away + /* Skip non-exist deice right away */ if ((pAd->HostLnkCtrlOffset != 0)) { PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, HostConfiguration); - // Prepare Configuration to write to Host + /* Prepare Configuration to write to Host */ HostConfiguration |= 0x3; PCI_REG_WIRTE_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, HostConfiguration); pAd->Rt3xxHostLinkCtrl = HostConfiguration; - // Because in rt30xxForceASPMTest Mode, Force turn on L0s, L1. - // Fix HostConfiguration bit0:1 = 0x3 for later use. + /* Because in rt30xxForceASPMTest Mode, Force turn on L0s, L1. */ + /* Fix HostConfiguration bit0:1 = 0x3 for later use. */ HostConfiguration = 0x3; DBGPRINT(RT_DEBUG_TRACE, ("PSM : Force ASPM : " @@ -1129,7 +1129,7 @@ VOID RTMPrt3xSetPCIePowerLinkCtrl(IN PRTMP_ADAPTER pAd) } else if (pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM == 1) { - // Skip non-exist deice right away + /* Skip non-exist deice right away */ if ((pAd->HostLnkCtrlOffset != 0)) { PCI_REG_READ_WORD(pObj->parent_pci_dev, pAd->HostLnkCtrlOffset, @@ -1143,12 +1143,12 @@ VOID RTMPrt3xSetPCIePowerLinkCtrl(IN PRTMP_ADAPTER pAd) } } } - // Prepare to write Ralink setting. - // Find Ralink PCIe Device's Express Capability Offset + /* Prepare to write Ralink setting. */ + /* Find Ralink PCIe Device's Express Capability Offset */ pos = pci_find_capability(pObj->pci_dev, PCI_CAP_ID_EXP); if (pos != 0) { - // Ralink PCIe Device's Link Control Register Offset + /* Ralink PCIe Device's Link Control Register Offset */ pAd->RLnkCtrlOffset = pos + PCI_EXP_LNKCTL; pci_read_config_word(pObj->pci_dev, pAd->RLnkCtrlOffset, ®16); diff --git a/drivers/staging/rt2860/rt_linux.c b/drivers/staging/rt2860/rt_linux.c index fd577e08082e..8413998b91e1 100644 --- a/drivers/staging/rt2860/rt_linux.c +++ b/drivers/staging/rt2860/rt_linux.c @@ -30,9 +30,9 @@ ULONG RTDebugLevel = RT_DEBUG_ERROR; -// for wireless system event message +/* for wireless system event message */ char const *pWirelessSysEventText[IW_SYS_EVENT_TYPE_NUM] = { - // system status event + /* system status event */ "had associated successfully", /* IW_ASSOC_EVENT_FLAG */ "had disassociated", /* IW_DISASSOC_EVENT_FLAG */ "had deauthenticated", /* IW_DEAUTH_EVENT_FLAG */ @@ -54,7 +54,7 @@ char const *pWirelessSysEventText[IW_SYS_EVENT_TYPE_NUM] = { "scan terminate!! Busy!! Enqueue fail!!" /* IW_SCAN_ENQUEUE_FAIL_EVENT_FLAG */ }; -// for wireless IDS_spoof_attack event message +/* for wireless IDS_spoof_attack event message */ char const *pWirelessSpoofEventText[IW_SPOOF_EVENT_TYPE_NUM] = { "detected conflict SSID", /* IW_CONFLICT_SSID_EVENT_FLAG */ "detected spoofed association response", /* IW_SPOOF_ASSOC_RESP_EVENT_FLAG */ @@ -68,7 +68,7 @@ char const *pWirelessSpoofEventText[IW_SPOOF_EVENT_TYPE_NUM] = { "detected replay attack" /* IW_REPLAY_ATTACK_EVENT_FLAG */ }; -// for wireless IDS_flooding_attack event message +/* for wireless IDS_flooding_attack event message */ char const *pWirelessFloodEventText[IW_FLOOD_EVENT_TYPE_NUM] = { "detected authentication flooding", /* IW_FLOOD_AUTH_EVENT_FLAG */ "detected association request flooding", /* IW_FLOOD_ASSOC_REQ_EVENT_FLAG */ @@ -129,10 +129,10 @@ VOID RTMP_OS_Del_Timer(IN NDIS_MINIPORT_TIMER * pTimer, VOID RTMP_OS_Release_Packet(IN PRTMP_ADAPTER pAd, IN PQUEUE_ENTRY pEntry) { - //RTMPFreeNdisPacket(pAd, (struct sk_buff *)pEntry); + /*RTMPFreeNdisPacket(pAd, (struct sk_buff *)pEntry); */ } -// Unify all delay routine by using udelay +/* Unify all delay routine by using udelay */ VOID RTMPusecDelay(IN ULONG usec) { ULONG i; @@ -149,7 +149,7 @@ void RTMP_GetCurrentSystemTime(LARGE_INTEGER * time) time->u.LowPart = jiffies; } -// pAd MUST allow to be NULL +/* pAd MUST allow to be NULL */ NDIS_STATUS os_alloc_mem(IN RTMP_ADAPTER * pAd, OUT UCHAR ** mem, IN ULONG size) { *mem = (PUCHAR) kmalloc(size, GFP_ATOMIC); @@ -159,7 +159,7 @@ NDIS_STATUS os_alloc_mem(IN RTMP_ADAPTER * pAd, OUT UCHAR ** mem, IN ULONG size) return (NDIS_STATUS_FAILURE); } -// pAd MUST allow to be NULL +/* pAd MUST allow to be NULL */ NDIS_STATUS os_free_mem(IN PRTMP_ADAPTER pAd, IN PVOID mem) { @@ -249,8 +249,8 @@ VOID RTMPFreeAdapter(IN PRTMP_ADAPTER pAd) NdisFreeSpinLock(&pAd->RxRingLock); #ifdef RT3090 NdisFreeSpinLock(&pAd->McuCmdLock); -#endif // RT3090 // -#endif // RTMP_MAC_PCI // +#endif /* RT3090 // */ +#endif /* RTMP_MAC_PCI // */ for (index = 0; index < NUM_OF_TX_RING; index++) { NdisFreeSpinLock(&pAd->TxSwQueueLock[index]); @@ -260,7 +260,7 @@ VOID RTMPFreeAdapter(IN PRTMP_ADAPTER pAd) NdisFreeSpinLock(&pAd->irq_lock); - vfree(pAd); // pci_free_consistent(os_cookie->pci_dev,sizeof(RTMP_ADAPTER),pAd,os_cookie->pAd_pa); + vfree(pAd); /* pci_free_consistent(os_cookie->pci_dev,sizeof(RTMP_ADAPTER),pAd,os_cookie->pAd_pa); */ if (os_cookie) kfree(os_cookie); } @@ -303,7 +303,7 @@ NDIS_STATUS RTMPCloneNdisPacket(IN PRTMP_ADAPTER pAd, ASSERT(pInPacket); ASSERT(ppOutPacket); - // 1. Allocate a packet + /* 1. Allocate a packet */ pkt = dev_alloc_skb(2048); if (pkt == NULL) { @@ -322,7 +322,7 @@ NDIS_STATUS RTMPCloneNdisPacket(IN PRTMP_ADAPTER pAd, return NDIS_STATUS_SUCCESS; } -// the allocated NDIS PACKET must be freed via RTMPFreeNdisPacket() +/* the allocated NDIS PACKET must be freed via RTMPFreeNdisPacket() */ NDIS_STATUS RTMPAllocateNdisPacket(IN PRTMP_ADAPTER pAd, OUT PNDIS_PACKET * ppPacket, IN PUCHAR pHeader, @@ -333,7 +333,7 @@ NDIS_STATUS RTMPAllocateNdisPacket(IN PRTMP_ADAPTER pAd, ASSERT(pData); ASSERT(DataLen); - // 1. Allocate a packet + /* 1. Allocate a packet */ pPacket = (PNDIS_PACKET *) dev_alloc_skb(HeaderLen + DataLen + RTMP_PKT_TAIL_PADDING); @@ -344,18 +344,18 @@ NDIS_STATUS RTMPAllocateNdisPacket(IN PRTMP_ADAPTER pAd, #endif return NDIS_STATUS_FAILURE; } - // 2. clone the frame content + /* 2. clone the frame content */ if (HeaderLen > 0) NdisMoveMemory(GET_OS_PKT_DATAPTR(pPacket), pHeader, HeaderLen); if (DataLen > 0) NdisMoveMemory(GET_OS_PKT_DATAPTR(pPacket) + HeaderLen, pData, DataLen); - // 3. update length of packet + /* 3. update length of packet */ skb_put(GET_OS_PKT_TYPE(pPacket), HeaderLen + DataLen); RTMP_SET_PACKET_SOURCE(pPacket, PKTSRC_NDIS); -// printk("%s : pPacket = %p, len = %d\n", __func__, pPacket, GET_OS_PKT_LEN(pPacket)); +/* printk("%s : pPacket = %p, len = %d\n", __func__, pPacket, GET_OS_PKT_LEN(pPacket)); */ *ppPacket = pPacket; return NDIS_STATUS_SUCCESS; } @@ -372,9 +372,9 @@ VOID RTMPFreeNdisPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) dev_kfree_skb_any(RTPKT_TO_OSPKT(pPacket)); } -// IRQL = DISPATCH_LEVEL -// NOTE: we do have an assumption here, that Byte0 and Byte1 always reasid at the same -// scatter gather buffer +/* IRQL = DISPATCH_LEVEL */ +/* NOTE: we do have an assumption here, that Byte0 and Byte1 always reasid at the same */ +/* scatter gather buffer */ NDIS_STATUS Sniff2BytesFromNdisBuffer(IN PNDIS_BUFFER pFirstBuffer, IN UCHAR DesiredOffset, OUT PUCHAR pByte0, OUT PUCHAR pByte1) @@ -481,7 +481,7 @@ PNDIS_PACKET duplicate_pkt_with_TKIP_MIC(IN PRTMP_ADAPTER pAd, skb = RTPKT_TO_OSPKT(pPacket); if (skb_tailroom(skb) < TKIP_TX_MIC_SIZE) { - // alloc a new skb and copy the packet + /* alloc a new skb and copy the packet */ newskb = skb_copy_expand(skb, skb_headroom(skb), TKIP_TX_MIC_SIZE, GFP_ATOMIC); @@ -507,11 +507,11 @@ PNDIS_PACKET ClonePacket(IN PRTMP_ADAPTER pAd, ASSERT(pPacket); pRxPkt = RTPKT_TO_OSPKT(pPacket); - // clone the packet + /* clone the packet */ pClonedPkt = skb_clone(pRxPkt, MEM_ALLOC_FLAG); if (pClonedPkt) { - // set the correct dataptr and data len + /* set the correct dataptr and data len */ pClonedPkt->dev = pRxPkt->dev; pClonedPkt->data = pData; pClonedPkt->len = DataSize; @@ -521,9 +521,9 @@ PNDIS_PACKET ClonePacket(IN PRTMP_ADAPTER pAd, return pClonedPkt; } -// -// change OS packet DataPtr and DataLen -// +/* */ +/* change OS packet DataPtr and DataLen */ +/* */ void update_os_packet_info(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) { @@ -555,10 +555,10 @@ void wlan_802_11_to_802_3_packet(IN PRTMP_ADAPTER pAd, pOSPkt->len = pRxBlk->DataSize; pOSPkt->tail = pOSPkt->data + pOSPkt->len; - // - // copy 802.3 header - // - // + /* */ + /* copy 802.3 header */ + /* */ + /* */ NdisMoveMemory(skb_push(pOSPkt, LENGTH_802_3), pHeader802_3, LENGTH_802_3); @@ -633,7 +633,7 @@ VOID RTMPSendWirelessEvent(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr, IN UCHAR BssIdx, IN CHAR Rssi) { - //union iwreq_data wrqu; + /*union iwreq_data wrqu; */ PSTRING pBuf = NULL, pBufPtr = NULL; USHORT event, type, BufLen; UCHAR event_table_len = 0; @@ -668,9 +668,9 @@ VOID RTMPSendWirelessEvent(IN PRTMP_ADAPTER pAd, event)); return; } - //Allocate memory and copy the msg. + /*Allocate memory and copy the msg. */ if ((pBuf = kmalloc(IW_CUSTOM_MAX_LEN, GFP_ATOMIC)) != NULL) { - //Prepare the payload + /*Prepare the payload */ memset(pBuf, 0, IW_CUSTOM_MAX_LEN); pBufPtr = pBuf; @@ -706,7 +706,7 @@ VOID RTMPSendWirelessEvent(IN PRTMP_ADAPTER pAd, RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, Event_flag, NULL, (PUCHAR) pBuf, BufLen); - //DBGPRINT(RT_DEBUG_TRACE, ("%s : %s\n", __func__, pBuf)); + /*DBGPRINT(RT_DEBUG_TRACE, ("%s : %s\n", __func__, pBuf)); */ kfree(pBuf); } else @@ -723,7 +723,7 @@ void send_monitor_packets(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) USHORT header_len = 0; UCHAR temp_header[40] = { 0 }; - u_int32_t ralinkrate[256] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108, 109, 110, 111, 112, 13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78, 104, 156, 208, 234, 260, 27, 54, 81, 108, 162, 216, 243, 270, // Last 38 + u_int32_t ralinkrate[256] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108, 109, 110, 111, 112, 13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78, 104, 156, 208, 234, 260, 27, 54, 81, 108, 162, 216, 243, 270, /* Last 38 */ 54, 108, 162, 216, 324, 432, 486, 540, 14, 29, 43, 57, 87, 115, 130, 144, 29, 59, 87, 115, 173, 230, 260, 288, 30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 480, 540, @@ -761,39 +761,39 @@ void send_monitor_packets(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) else header_len = LENGTH_802_11; - // QOS + /* QOS */ if (pRxBlk->pHeader->FC.SubType & 0x08) { header_len += 2; - // Data skip QOS contorl field + /* Data skip QOS contorl field */ pRxBlk->DataSize -= 2; } - // Order bit: A-Ralink or HTC+ + /* Order bit: A-Ralink or HTC+ */ if (pRxBlk->pHeader->FC.Order) { header_len += 4; - // Data skip HTC contorl field + /* Data skip HTC contorl field */ pRxBlk->DataSize -= 4; } - // Copy Header + /* Copy Header */ if (header_len <= 40) NdisMoveMemory(temp_header, pRxBlk->pData, header_len); - // skip HW padding + /* skip HW padding */ if (pRxBlk->RxD.L2PAD) pRxBlk->pData += (header_len + 2); else pRxBlk->pData += header_len; - } //end if + } /*end if */ if (pRxBlk->DataSize < pOSPkt->len) { skb_trim(pOSPkt, pRxBlk->DataSize); } else { skb_put(pOSPkt, (pRxBlk->DataSize - pOSPkt->len)); - } //end if + } /*end if */ if ((pRxBlk->pData - pOSPkt->data) > 0) { skb_put(pOSPkt, (pRxBlk->pData - pOSPkt->data)); skb_pull(pOSPkt, (pRxBlk->pData - pOSPkt->data)); - } //end if + } /*end if */ if (skb_headroom(pOSPkt) < (sizeof(wlan_ng_prism2_header) + header_len)) { if (pskb_expand_head @@ -803,8 +803,8 @@ void send_monitor_packets(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) ("%s : Reallocate header size of sk_buff fail!\n", __func__)); goto err_free_sk_buff; - } //end if - } //end if + } /*end if */ + } /*end if */ if (header_len > 0) NdisMoveMemory(skb_push(pOSPkt, header_len), temp_header, @@ -856,7 +856,7 @@ void send_monitor_packets(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) ph->signal.did = DIDmsg_lnxind_wlansniffrm_signal; ph->signal.status = 0; ph->signal.len = 4; - ph->signal.data = 0; //rssi + noise; + ph->signal.data = 0; /*rssi + noise; */ ph->noise.did = DIDmsg_lnxind_wlansniffrm_noise; ph->noise.status = 0; @@ -948,7 +948,7 @@ int RtmpOSIRQRelease(IN PNET_DEV pNetDev) free_irq(pObj->pci_dev->irq, (net_dev)); RTMP_MSI_DISABLE(pAd); } -#endif // RTMP_PCI_SUPPORT // +#endif /* RTMP_PCI_SUPPORT // */ return 0; } @@ -985,7 +985,7 @@ void RtmpOSFileSeek(RTMP_OS_FD osfd, int offset) int RtmpOSFileRead(RTMP_OS_FD osfd, char *pDataPtr, int readLen) { - // The object must have a read method + /* The object must have a read method */ if (osfd->f_op && osfd->f_op->read) { return osfd->f_op->read(osfd, pDataPtr, readLen, &osfd->f_pos); } else { @@ -1090,7 +1090,7 @@ NDIS_STATUS RtmpOSTaskAttach(IN RTMP_OS_TASK * pTask, } else { pTask->taskPID = GET_PID(pid_number); - // Wait for the thread to start + /* Wait for the thread to start */ wait_for_completion(&pTask->taskComplete); status = NDIS_STATUS_SUCCESS; } @@ -1172,7 +1172,7 @@ int RtmpOSNetDevAddrSet(IN PNET_DEV pNetDev, IN PUCHAR pMacAddr) net_dev = pNetDev; GET_PAD_FROM_NET_DEV(pAd, net_dev); - // work-around for the SuSE due to it has it's own interface name management system. + /* work-around for the SuSE due to it has it's own interface name management system. */ { NdisZeroMemory(pAd->StaCfg.dev_name, 16); NdisMoveMemory(pAd->StaCfg.dev_name, net_dev->name, @@ -1245,7 +1245,7 @@ void RtmpOSNetDevFree(PNET_DEV pNetDev) INT RtmpOSNetDevAlloc(IN PNET_DEV * new_dev_p, IN UINT32 privDataSize) { - // assign it as null first. + /* assign it as null first. */ *new_dev_p = NULL; DBGPRINT(RT_DEBUG_TRACE, @@ -1281,7 +1281,7 @@ void RtmpOSNetDeviceRefPut(PNET_DEV pNetDev) INT RtmpOSNetDevDestory(IN RTMP_ADAPTER * pAd, IN PNET_DEV pNetDev) { - // TODO: Need to fix this + /* TODO: Need to fix this */ printk("WARNING: This function(%s) not implement yet!!!\n", __func__); return 0; } @@ -1297,7 +1297,7 @@ int RtmpOSNetDevAttach(IN PNET_DEV pNetDev, int ret, rtnl_locked = FALSE; DBGPRINT(RT_DEBUG_TRACE, ("RtmpOSNetDevAttach()--->\n")); - // If we need hook some callback function to the net device structrue, now do it. + /* If we need hook some callback function to the net device structrue, now do it. */ if (pDevOpHook) { PRTMP_ADAPTER pAd = NULL; @@ -1312,7 +1312,7 @@ int RtmpOSNetDevAttach(IN PNET_DEV pNetDev, pNetDev->wireless_handlers = &rt28xx_iw_handler_def; } - // copy the net device mac address to the net_device structure. + /* copy the net device mac address to the net_device structure. */ NdisMoveMemory(pNetDev->dev_addr, &pDevOpHook->devAddr[0], MAC_ADDR_LEN); diff --git a/drivers/staging/rt2860/rt_main_dev.c b/drivers/staging/rt2860/rt_main_dev.c index 8f65e469b512..84be9d0cfb98 100644 --- a/drivers/staging/rt2860/rt_main_dev.c +++ b/drivers/staging/rt2860/rt_main_dev.c @@ -41,8 +41,8 @@ /* Private Variables Used */ /*---------------------------------------------------------------------*/ -PSTRING mac = ""; // default 00:00:00:00:00:00 -PSTRING hostname = ""; // default CMPC +PSTRING mac = ""; /* default 00:00:00:00:00:00 */ +PSTRING hostname = ""; /* default CMPC */ module_param(mac, charp, 0); MODULE_PARM_DESC(mac, "rt28xx: wireless mac addr"); @@ -50,11 +50,11 @@ MODULE_PARM_DESC(mac, "rt28xx: wireless mac addr"); /* Prototypes of Functions Used */ /*---------------------------------------------------------------------*/ -// public function prototype +/* public function prototype */ int rt28xx_close(IN struct net_device *net_dev); int rt28xx_open(struct net_device *net_dev); -// private function prototype +/* private function prototype */ static INT rt28xx_send_packets(IN struct sk_buff *skb_p, IN struct net_device *net_dev); @@ -87,9 +87,9 @@ int MainVirtualIF_close(IN struct net_device *net_dev) GET_PAD_FROM_NET_DEV(pAd, net_dev); - // Sanity check for pAd + /* Sanity check for pAd */ if (pAd == NULL) - return 0; // close ok + return 0; /* close ok */ netif_carrier_off(pAd->net_dev); netif_stop_queue(pAd->net_dev); @@ -117,7 +117,7 @@ int MainVirtualIF_close(IN struct net_device *net_dev) sizeof (MLME_DISASSOC_REQ_STRUCT)); - // Prevent to connect AP again in STAMlmePeriodicExec + /* Prevent to connect AP again in STAMlmePeriodicExec */ pAd->MlmeAux.AutoReconnectSsidLen = 32; NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux. @@ -142,7 +142,7 @@ int MainVirtualIF_close(IN struct net_device *net_dev) RT_MOD_DEC_USE_COUNT(); - return 0; // close ok + return 0; /* close ok */ } /* @@ -171,14 +171,14 @@ int MainVirtualIF_open(IN struct net_device *net_dev) GET_PAD_FROM_NET_DEV(pAd, net_dev); - // Sanity check for pAd + /* Sanity check for pAd */ if (pAd == NULL) - return 0; // close ok + return 0; /* close ok */ if (VIRTUAL_IF_UP(pAd) != 0) return -1; - // increase MODULE use count + /* increase MODULE use count */ RT_MOD_INC_USE_COUNT(); netif_start_queue(net_dev); @@ -218,35 +218,35 @@ int rt28xx_close(IN PNET_DEV dev) #ifdef RTMP_MAC_USB DECLARE_WAIT_QUEUE_HEAD(unlink_wakeup); DECLARE_WAITQUEUE(wait, current); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ GET_PAD_FROM_NET_DEV(pAd, net_dev); DBGPRINT(RT_DEBUG_TRACE, ("===> rt28xx_close\n")); Cancelled = FALSE; - // Sanity check for pAd + /* Sanity check for pAd */ if (pAd == NULL) - return 0; // close ok + return 0; /* close ok */ { #ifdef RTMP_MAC_PCI RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_CLOSE); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ - // If dirver doesn't wake up firmware here, - // NICLoadFirmware will hang forever when interface is up again. + /* If dirver doesn't wake up firmware here, */ + /* NICLoadFirmware will hang forever when interface is up again. */ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { AsicForceWakeup(pAd, TRUE); } #ifdef RTMP_MAC_USB RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ MlmeRadioOff(pAd); #ifdef RTMP_MAC_PCI pAd->bPCIclkOff = FALSE; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ } RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); @@ -261,13 +261,13 @@ int rt28xx_close(IN PNET_DEV dev) } #ifdef RTMP_MAC_USB - // ensure there are no more active urbs. + /* ensure there are no more active urbs. */ add_wait_queue(&unlink_wakeup, &wait); pAd->wait = &unlink_wakeup; - // maybe wait for deletions to finish. + /* maybe wait for deletions to finish. */ i = 0; - //while((i < 25) && atomic_read(&pAd->PendingRx) > 0) + /*while((i < 25) && atomic_read(&pAd->PendingRx) > 0) */ while (i < 25) { unsigned long IrqFlags; @@ -278,17 +278,17 @@ int rt28xx_close(IN PNET_DEV dev) } RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); - msleep(UNLINK_TIMEOUT_MS); //Time in millisecond + msleep(UNLINK_TIMEOUT_MS); /*Time in millisecond */ i++; } pAd->wait = NULL; remove_wait_queue(&unlink_wakeup, &wait); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ - // Stop Mlme state machine + /* Stop Mlme state machine */ MlmeHalt(pAd); - // Close net tasklets + /* Close net tasklets */ RtmpNetTaskExit(pAd); { @@ -298,25 +298,25 @@ int rt28xx_close(IN PNET_DEV dev) MeasureReqTabExit(pAd); TpcReqTabExit(pAd); - // Close kernel threads + /* Close kernel threads */ RtmpMgmtTaskExit(pAd); #ifdef RTMP_MAC_PCI { BOOLEAN brc; - // ULONG Value; + /* ULONG Value; */ if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) { RTMP_ASIC_INTERRUPT_DISABLE(pAd); } - // Receive packets to clear DMA index after disable interrupt. - //RTMPHandleRxDoneInterrupt(pAd); - // put to radio off to save power when driver unload. After radiooff, can't write /read register. So need to finish all - // register access before Radio off. + /* Receive packets to clear DMA index after disable interrupt. */ + /*RTMPHandleRxDoneInterrupt(pAd); */ + /* put to radio off to save power when driver unload. After radiooff, can't write /read register. So need to finish all */ + /* register access before Radio off. */ brc = RT28xxPciAsicRadioOff(pAd, RTMP_HALT, 0); -//In solution 3 of 3090F, the bPCIclkOff will be set to TRUE after calling RT28xxPciAsicRadioOff +/*In solution 3 of 3090F, the bPCIclkOff will be set to TRUE after calling RT28xxPciAsicRadioOff */ pAd->bPCIclkOff = FALSE; if (brc == FALSE) { @@ -335,22 +335,22 @@ int rt28xx_close(IN PNET_DEV dev) // Disable Rx, register value supposed will remain after reset NICIssueReset(pAd); */ -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ - // Free IRQ + /* Free IRQ */ if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { #ifdef RTMP_MAC_PCI - // Deregister interrupt function + /* Deregister interrupt function */ RtmpOSIRQRelease(net_dev); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE); } - // Free Ring or USB buffers + /* Free Ring or USB buffers */ RTMPFreeTxRxRingMemory(pAd); RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); - // Free BA reorder resource + /* Free BA reorder resource */ ba_reordering_resource_release(pAd); RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_START_UP); @@ -360,7 +360,7 @@ int rt28xx_close(IN PNET_DEV dev) } DBGPRINT(RT_DEBUG_TRACE, ("<=== rt28xx_close\n")); - return 0; // close ok + return 0; /* close ok */ } /* End of rt28xx_close */ /* @@ -383,11 +383,11 @@ int rt28xx_open(IN PNET_DEV dev) struct net_device *net_dev = (struct net_device *)dev; PRTMP_ADAPTER pAd = NULL; int retval = 0; - //POS_COOKIE pObj; + /*POS_COOKIE pObj; */ GET_PAD_FROM_NET_DEV(pAd, net_dev); - // Sanity check for pAd + /* Sanity check for pAd */ if (pAd == NULL) { /* if 1st open fail, pAd will be free; So the net_dev->ml_priv will be NULL in 2rd open */ @@ -399,52 +399,52 @@ int rt28xx_open(IN PNET_DEV dev) net_dev->wireless_handlers = (struct iw_handler_def *)&rt28xx_iw_handler_def; } - // Request interrupt service routine for PCI device - // register the interrupt routine with the os + /* Request interrupt service routine for PCI device */ + /* register the interrupt routine with the os */ RtmpOSIRQRequest(net_dev); - // Init IRQ parameters stored in pAd + /* Init IRQ parameters stored in pAd */ RTMP_IRQ_INIT(pAd); - // Chip & other init + /* Chip & other init */ if (rt28xx_init(pAd, mac, hostname) == FALSE) goto err; - // Enable Interrupt + /* Enable Interrupt */ RTMP_IRQ_ENABLE(pAd); - // Now Enable RxTx + /* Now Enable RxTx */ RTMPEnableRxTx(pAd); RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_START_UP); { UINT32 reg = 0; - RTMP_IO_READ32(pAd, 0x1300, ®); // clear garbage interrupts + RTMP_IO_READ32(pAd, 0x1300, ®); /* clear garbage interrupts */ printk("0x1300 = %08x\n", reg); } { -// u32 reg; -// UINT8 byte; -// u16 tmp; +/* u32 reg; */ +/* UINT8 byte; */ +/* u16 tmp; */ -// RTMP_IO_READ32(pAd, XIFS_TIME_CFG, ®); +/* RTMP_IO_READ32(pAd, XIFS_TIME_CFG, ®); */ -// tmp = 0x0805; -// reg = (reg & 0xffff0000) | tmp; -// RTMP_IO_WRITE32(pAd, XIFS_TIME_CFG, reg); +/* tmp = 0x0805; */ +/* reg = (reg & 0xffff0000) | tmp; */ +/* RTMP_IO_WRITE32(pAd, XIFS_TIME_CFG, reg); */ } #ifdef RTMP_MAC_PCI RTMPInitPCIeLinkCtrlValue(pAd); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ return (retval); err: -//+++Add by shiang, move from rt28xx_init() to here. +/*+++Add by shiang, move from rt28xx_init() to here. */ RtmpOSIRQRelease(net_dev); -//---Add by shiang, move from rt28xx_init() to here. +/*---Add by shiang, move from rt28xx_init() to here. */ return (-1); } /* End of rt28xx_open */ @@ -463,7 +463,7 @@ PNET_DEV RtmpPhyNetDevInit(IN RTMP_ADAPTER * pAd, IN RTMP_OS_NETDEV_OP_HOOK * pNetDevHook) { struct net_device *net_dev = NULL; -// NDIS_STATUS Status; +/* NDIS_STATUS Status; */ net_dev = RtmpOSNetDevCreate(pAd, INT_MAIN, 0, sizeof(PRTMP_ADAPTER), @@ -518,16 +518,16 @@ int rt28xx_packet_xmit(struct sk_buff *skb) /* RT2870STA does this in RTMPSendPackets() */ { - // Drop send request since we are in monitor mode + /* Drop send request since we are in monitor mode */ if (MONITOR_ON(pAd)) { RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); goto done; } } - // EapolStart size is 18 + /* EapolStart size is 18 */ if (skb->len < 14) { - //printk("bad packet size: %d\n", pkt->len); + /*printk("bad packet size: %d\n", pkt->len); */ hex_dump("bad packet", skb->data, skb->len); RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); goto done; @@ -577,7 +577,7 @@ static int rt28xx_send_packets(IN struct sk_buff *skb_p, return rt28xx_packet_xmit(skb_p); } -// This function will be called when query /proc +/* This function will be called when query /proc */ struct iw_statistics *rt28xx_get_wireless_stats(IN struct net_device *net_dev) { PRTMP_ADAPTER pAd = NULL; @@ -586,9 +586,9 @@ struct iw_statistics *rt28xx_get_wireless_stats(IN struct net_device *net_dev) DBGPRINT(RT_DEBUG_TRACE, ("rt28xx_get_wireless_stats --->\n")); - pAd->iw_stats.status = 0; // Status - device dependent for now + pAd->iw_stats.status = 0; /* Status - device dependent for now */ - // link quality + /* link quality */ if (pAd->OpMode == OPMODE_STA) pAd->iw_stats.qual.qual = ((pAd->Mlme.ChannelQuality * 12) / 10 + 10); @@ -603,16 +603,16 @@ struct iw_statistics *rt28xx_get_wireless_stats(IN struct net_device *net_dev) pAd->StaCfg.RssiSample.LastRssi2); } - pAd->iw_stats.qual.noise = pAd->BbpWriteLatch[66]; // noise level (dBm) + pAd->iw_stats.qual.noise = pAd->BbpWriteLatch[66]; /* noise level (dBm) */ pAd->iw_stats.qual.noise += 256 - 143; - pAd->iw_stats.qual.updated = 1; // Flags to know if updated + pAd->iw_stats.qual.updated = 1; /* Flags to know if updated */ #ifdef IW_QUAL_DBM - pAd->iw_stats.qual.updated |= IW_QUAL_DBM; // Level + Noise are dBm -#endif // IW_QUAL_DBM // + pAd->iw_stats.qual.updated |= IW_QUAL_DBM; /* Level + Noise are dBm */ +#endif /* IW_QUAL_DBM // */ - pAd->iw_stats.discard.nwid = 0; // Rx : Wrong nwid/essid - pAd->iw_stats.miss.beacon = 0; // Missed beacons/superframe + pAd->iw_stats.discard.nwid = 0; /* Rx : Wrong nwid/essid */ + pAd->iw_stats.miss.beacon = 0; /* Missed beacons/superframe */ DBGPRINT(RT_DEBUG_TRACE, ("<--- rt28xx_get_wireless_stats\n")); return &pAd->iw_stats; @@ -620,7 +620,7 @@ struct iw_statistics *rt28xx_get_wireless_stats(IN struct net_device *net_dev) void tbtt_tasklet(unsigned long data) { -//#define MAX_TX_IN_TBTT (16) +/*#define MAX_TX_IN_TBTT (16) */ } @@ -664,24 +664,24 @@ static struct net_device_stats *RT28xx_get_ether_stats(IN struct net_device pAd->stats.rx_dropped = 0; pAd->stats.tx_dropped = 0; - pAd->stats.multicast = pAd->WlanCounters.MulticastReceivedFrameCount.QuadPart; // multicast packets received - pAd->stats.collisions = pAd->Counters8023.OneCollision + pAd->Counters8023.MoreCollisions; // Collision packets + pAd->stats.multicast = pAd->WlanCounters.MulticastReceivedFrameCount.QuadPart; /* multicast packets received */ + pAd->stats.collisions = pAd->Counters8023.OneCollision + pAd->Counters8023.MoreCollisions; /* Collision packets */ pAd->stats.rx_length_errors = 0; - pAd->stats.rx_over_errors = pAd->Counters8023.RxNoBuffer; // receiver ring buff overflow - pAd->stats.rx_crc_errors = 0; //pAd->WlanCounters.FCSErrorCount; // recved pkt with crc error - pAd->stats.rx_frame_errors = pAd->Counters8023.RcvAlignmentErrors; // recv'd frame alignment error - pAd->stats.rx_fifo_errors = pAd->Counters8023.RxNoBuffer; // recv'r fifo overrun - pAd->stats.rx_missed_errors = 0; // receiver missed packet + pAd->stats.rx_over_errors = pAd->Counters8023.RxNoBuffer; /* receiver ring buff overflow */ + pAd->stats.rx_crc_errors = 0; /*pAd->WlanCounters.FCSErrorCount; // recved pkt with crc error */ + pAd->stats.rx_frame_errors = pAd->Counters8023.RcvAlignmentErrors; /* recv'd frame alignment error */ + pAd->stats.rx_fifo_errors = pAd->Counters8023.RxNoBuffer; /* recv'r fifo overrun */ + pAd->stats.rx_missed_errors = 0; /* receiver missed packet */ - // detailed tx_errors + /* detailed tx_errors */ pAd->stats.tx_aborted_errors = 0; pAd->stats.tx_carrier_errors = 0; pAd->stats.tx_fifo_errors = 0; pAd->stats.tx_heartbeat_errors = 0; pAd->stats.tx_window_errors = 0; - // for cslip etc + /* for cslip etc */ pAd->stats.rx_compressed = 0; pAd->stats.tx_compressed = 0; @@ -693,7 +693,7 @@ static struct net_device_stats *RT28xx_get_ether_stats(IN struct net_device BOOLEAN RtmpPhyNetDevExit(IN RTMP_ADAPTER * pAd, IN PNET_DEV net_dev) { - // Unregister network device + /* Unregister network device */ if (net_dev != NULL) { printk ("RtmpOSNetDevDetach(): RtmpOSNetDeviceDetach(), dev->name=%s!\n", @@ -724,7 +724,7 @@ Note: NDIS_STATUS AdapterBlockAllocateMemory(IN PVOID handle, OUT PVOID * ppAd) { - *ppAd = (PVOID) vmalloc(sizeof(RTMP_ADAPTER)); //pci_alloc_consistent(pci_dev, sizeof(RTMP_ADAPTER), phy_addr); + *ppAd = (PVOID) vmalloc(sizeof(RTMP_ADAPTER)); /*pci_alloc_consistent(pci_dev, sizeof(RTMP_ADAPTER), phy_addr); */ if (*ppAd) { NdisZeroMemory(*ppAd, sizeof(RTMP_ADAPTER)); diff --git a/drivers/staging/rt2860/rt_pci_rbus.c b/drivers/staging/rt2860/rt_pci_rbus.c index 8ae0e3eb50ef..0f75c3f765c7 100644 --- a/drivers/staging/rt2860/rt_pci_rbus.c +++ b/drivers/staging/rt2860/rt_pci_rbus.c @@ -51,23 +51,23 @@ static void fifo_statistic_full_tasklet(unsigned long data); /*---------------------------------------------------------------------*/ /* Symbol & Macro Definitions */ /*---------------------------------------------------------------------*/ -#define RT2860_INT_RX_DLY (1<<0) // bit 0 -#define RT2860_INT_TX_DLY (1<<1) // bit 1 -#define RT2860_INT_RX_DONE (1<<2) // bit 2 -#define RT2860_INT_AC0_DMA_DONE (1<<3) // bit 3 -#define RT2860_INT_AC1_DMA_DONE (1<<4) // bit 4 -#define RT2860_INT_AC2_DMA_DONE (1<<5) // bit 5 -#define RT2860_INT_AC3_DMA_DONE (1<<6) // bit 6 -#define RT2860_INT_HCCA_DMA_DONE (1<<7) // bit 7 -#define RT2860_INT_MGMT_DONE (1<<8) // bit 8 +#define RT2860_INT_RX_DLY (1<<0) /* bit 0 */ +#define RT2860_INT_TX_DLY (1<<1) /* bit 1 */ +#define RT2860_INT_RX_DONE (1<<2) /* bit 2 */ +#define RT2860_INT_AC0_DMA_DONE (1<<3) /* bit 3 */ +#define RT2860_INT_AC1_DMA_DONE (1<<4) /* bit 4 */ +#define RT2860_INT_AC2_DMA_DONE (1<<5) /* bit 5 */ +#define RT2860_INT_AC3_DMA_DONE (1<<6) /* bit 6 */ +#define RT2860_INT_HCCA_DMA_DONE (1<<7) /* bit 7 */ +#define RT2860_INT_MGMT_DONE (1<<8) /* bit 8 */ #define INT_RX RT2860_INT_RX_DONE -#define INT_AC0_DLY (RT2860_INT_AC0_DMA_DONE) //| RT2860_INT_TX_DLY) -#define INT_AC1_DLY (RT2860_INT_AC1_DMA_DONE) //| RT2860_INT_TX_DLY) -#define INT_AC2_DLY (RT2860_INT_AC2_DMA_DONE) //| RT2860_INT_TX_DLY) -#define INT_AC3_DLY (RT2860_INT_AC3_DMA_DONE) //| RT2860_INT_TX_DLY) -#define INT_HCCA_DLY (RT2860_INT_HCCA_DMA_DONE) //| RT2860_INT_TX_DLY) +#define INT_AC0_DLY (RT2860_INT_AC0_DMA_DONE) /*| RT2860_INT_TX_DLY) */ +#define INT_AC1_DLY (RT2860_INT_AC1_DMA_DONE) /*| RT2860_INT_TX_DLY) */ +#define INT_AC2_DLY (RT2860_INT_AC2_DMA_DONE) /*| RT2860_INT_TX_DLY) */ +#define INT_AC3_DLY (RT2860_INT_AC3_DMA_DONE) /*| RT2860_INT_TX_DLY) */ +#define INT_HCCA_DLY (RT2860_INT_HCCA_DMA_DONE) /*| RT2860_INT_TX_DLY) */ #define INT_MGMT_DLY RT2860_INT_MGMT_DONE /*************************************************************************** @@ -76,7 +76,7 @@ static void fifo_statistic_full_tasklet(unsigned long data); * Mainly for Hardware TxDesc/RxDesc/MgmtDesc, DMA Memory for TxData/RxData, etc., * **************************************************************************/ -// Function for TxDesc Memory allocation. +/* Function for TxDesc Memory allocation. */ void RTMP_AllocateTxDescMemory(IN PRTMP_ADAPTER pAd, IN UINT Index, IN ULONG Length, @@ -92,7 +92,7 @@ void RTMP_AllocateTxDescMemory(IN PRTMP_ADAPTER pAd, } -// Function for MgmtDesc Memory allocation. +/* Function for MgmtDesc Memory allocation. */ void RTMP_AllocateMgmtDescMemory(IN PRTMP_ADAPTER pAd, IN ULONG Length, IN BOOLEAN Cached, @@ -107,7 +107,7 @@ void RTMP_AllocateMgmtDescMemory(IN PRTMP_ADAPTER pAd, } -// Function for RxDesc Memory allocation. +/* Function for RxDesc Memory allocation. */ void RTMP_AllocateRxDescMemory(IN PRTMP_ADAPTER pAd, IN ULONG Length, IN BOOLEAN Cached, @@ -122,7 +122,7 @@ void RTMP_AllocateRxDescMemory(IN PRTMP_ADAPTER pAd, } -// Function for free allocated Desc Memory. +/* Function for free allocated Desc Memory. */ void RTMP_FreeDescMemory(IN PRTMP_ADAPTER pAd, IN ULONG Length, IN PVOID VirtualAddress, @@ -134,7 +134,7 @@ void RTMP_FreeDescMemory(IN PRTMP_ADAPTER pAd, PhysicalAddress); } -// Function for TxData DMA Memory allocation. +/* Function for TxData DMA Memory allocation. */ void RTMP_AllocateFirstTxBuffer(IN PRTMP_ADAPTER pAd, IN UINT Index, IN ULONG Length, @@ -305,12 +305,12 @@ static inline void rt2860_int_enable(PRTMP_ADAPTER pAd, unsigned int mode) pAd->int_disable_mask &= ~(mode); regValue = pAd->int_enable_reg & ~(pAd->int_disable_mask); - //if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) + /*if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) */ { - RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); // 1:enable + RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); /* 1:enable */ } - //else - // DBGPRINT(RT_DEBUG_TRACE, ("fOP_STATUS_DOZE !\n")); + /*else */ + /* DBGPRINT(RT_DEBUG_TRACE, ("fOP_STATUS_DOZE !\n")); */ if (regValue != 0) RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE); @@ -322,7 +322,7 @@ static inline void rt2860_int_disable(PRTMP_ADAPTER pAd, unsigned int mode) pAd->int_disable_mask |= mode; regValue = pAd->int_enable_reg & ~(pAd->int_disable_mask); - RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); // 0: disable + RTMP_IO_WRITE32(pAd, INT_MASK_CSR, regValue); /* 0: disable */ if (regValue == 0) { RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE); @@ -341,23 +341,23 @@ static void mgmt_dma_done_tasklet(unsigned long data) INT_SOURCE_CSR_STRUC IntSource; POS_COOKIE pObj; - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt + /* Do nothing if the driver is starting halt state. */ + /* This might happen when timer already been fired before cancel timer with mlmehalt */ if (RTMP_TEST_FLAG (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; pObj = (POS_COOKIE) pAd->OS_Cookie; -// printk("mgmt_dma_done_process\n"); +/* printk("mgmt_dma_done_process\n"); */ IntSource.word = 0; IntSource.field.MgmtDmaDone = 1; pAd->int_pending &= ~INT_MGMT_DLY; RTMPHandleMgmtRingDmaDoneInterrupt(pAd); - // if you use RTMP_SEM_LOCK, sometimes kernel will hang up, no any - // bug report output + /* if you use RTMP_SEM_LOCK, sometimes kernel will hang up, no any */ + /* bug report output */ RTMP_INT_LOCK(&pAd->irq_lock, flags); /* * double check to avoid lose of interrupts @@ -380,8 +380,8 @@ static void rx_done_tasklet(unsigned long data) BOOLEAN bReschedule = 0; POS_COOKIE pObj; - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt + /* Do nothing if the driver is starting halt state. */ + /* This might happen when timer already been fired before cancel timer with mlmehalt */ if (RTMP_TEST_FLAG (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; @@ -413,8 +413,8 @@ void fifo_statistic_full_tasklet(unsigned long data) PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; POS_COOKIE pObj; - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt + /* Do nothing if the driver is starting halt state. */ + /* This might happen when timer already been fired before cancel timer with mlmehalt */ if (RTMP_TEST_FLAG (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; @@ -449,15 +449,15 @@ static void ac3_dma_done_tasklet(unsigned long data) POS_COOKIE pObj; BOOLEAN bReschedule = 0; - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt + /* Do nothing if the driver is starting halt state. */ + /* This might happen when timer already been fired before cancel timer with mlmehalt */ if (RTMP_TEST_FLAG (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; pObj = (POS_COOKIE) pAd->OS_Cookie; -// printk("ac0_dma_done_process\n"); +/* printk("ac0_dma_done_process\n"); */ IntSource.word = 0; IntSource.field.Ac3DmaDone = 1; pAd->int_pending &= ~INT_AC3_DLY; @@ -487,8 +487,8 @@ static void ac2_dma_done_tasklet(unsigned long data) POS_COOKIE pObj; BOOLEAN bReschedule = 0; - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt + /* Do nothing if the driver is starting halt state. */ + /* This might happen when timer already been fired before cancel timer with mlmehalt */ if (RTMP_TEST_FLAG (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; @@ -525,15 +525,15 @@ static void ac1_dma_done_tasklet(unsigned long data) POS_COOKIE pObj; BOOLEAN bReschedule = 0; - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt + /* Do nothing if the driver is starting halt state. */ + /* This might happen when timer already been fired before cancel timer with mlmehalt */ if (RTMP_TEST_FLAG (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; pObj = (POS_COOKIE) pAd->OS_Cookie; -// printk("ac0_dma_done_process\n"); +/* printk("ac0_dma_done_process\n"); */ IntSource.word = 0; IntSource.field.Ac1DmaDone = 1; pAd->int_pending &= ~INT_AC1_DLY; @@ -563,20 +563,20 @@ static void ac0_dma_done_tasklet(unsigned long data) POS_COOKIE pObj; BOOLEAN bReschedule = 0; - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt + /* Do nothing if the driver is starting halt state. */ + /* This might happen when timer already been fired before cancel timer with mlmehalt */ if (RTMP_TEST_FLAG (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; pObj = (POS_COOKIE) pAd->OS_Cookie; -// printk("ac0_dma_done_process\n"); +/* printk("ac0_dma_done_process\n"); */ IntSource.word = 0; IntSource.field.Ac0DmaDone = 1; pAd->int_pending &= ~INT_AC0_DLY; -// RTMPHandleMgmtRingDmaDoneInterrupt(pAd); +/* RTMPHandleMgmtRingDmaDoneInterrupt(pAd); */ bReschedule = RTMPHandleTxRingDmaDoneInterrupt(pAd, IntSource); RTMP_INT_LOCK(&pAd->irq_lock, flags); @@ -617,52 +617,52 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, IntSource.word); Or kernel will panic after ifconfig ra0 down sometimes */ - // - // Inital the Interrupt source. - // + /* */ + /* Inital the Interrupt source. */ + /* */ IntSource.word = 0x00000000L; -// McuIntSource.word = 0x00000000L; - - // - // Get the interrupt sources & saved to local variable - // - //RTMP_IO_READ32(pAd, where, &McuIntSource.word); - //RTMP_IO_WRITE32(pAd, , McuIntSource.word); - - // - // Flag fOP_STATUS_DOZE On, means ASIC put to sleep, elase means ASICK WakeUp - // And at the same time, clock maybe turned off that say there is no DMA service. - // when ASIC get to sleep. - // To prevent system hang on power saving. - // We need to check it before handle the INT_SOURCE_CSR, ASIC must be wake up. - // - // RT2661 => when ASIC is sleeping, MAC register cannot be read and written. - // RT2860 => when ASIC is sleeping, MAC register can be read and written. -// if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) +/* McuIntSource.word = 0x00000000L; */ + + /* */ + /* Get the interrupt sources & saved to local variable */ + /* */ + /*RTMP_IO_READ32(pAd, where, &McuIntSource.word); */ + /*RTMP_IO_WRITE32(pAd, , McuIntSource.word); */ + + /* */ + /* Flag fOP_STATUS_DOZE On, means ASIC put to sleep, elase means ASICK WakeUp */ + /* And at the same time, clock maybe turned off that say there is no DMA service. */ + /* when ASIC get to sleep. */ + /* To prevent system hang on power saving. */ + /* We need to check it before handle the INT_SOURCE_CSR, ASIC must be wake up. */ + /* */ + /* RT2661 => when ASIC is sleeping, MAC register cannot be read and written. */ + /* RT2860 => when ASIC is sleeping, MAC register can be read and written. */ +/* if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) */ { RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IntSource.word); - RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, IntSource.word); // write 1 to clear + RTMP_IO_WRITE32(pAd, INT_SOURCE_CSR, IntSource.word); /* write 1 to clear */ } -// else -// DBGPRINT(RT_DEBUG_TRACE, (">>>fOP_STATUS_DOZE<<<\n")); +/* else */ +/* DBGPRINT(RT_DEBUG_TRACE, (">>>fOP_STATUS_DOZE<<<\n")); */ -// RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IsrAfterClear); -// RTMP_IO_READ32(pAd, MCU_INT_SOURCE_CSR, &McuIsrAfterClear); -// DBGPRINT(RT_DEBUG_INFO, ("====> RTMPHandleInterrupt(ISR=%08x,Mcu ISR=%08x, After clear ISR=%08x, MCU ISR=%08x)\n", -// IntSource.word, McuIntSource.word, IsrAfterClear, McuIsrAfterClear)); +/* RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IsrAfterClear); */ +/* RTMP_IO_READ32(pAd, MCU_INT_SOURCE_CSR, &McuIsrAfterClear); */ +/* DBGPRINT(RT_DEBUG_INFO, ("====> RTMPHandleInterrupt(ISR=%08x,Mcu ISR=%08x, After clear ISR=%08x, MCU ISR=%08x)\n", */ +/* IntSource.word, McuIntSource.word, IsrAfterClear, McuIsrAfterClear)); */ - // Do nothing if Reset in progress + /* Do nothing if Reset in progress */ if (RTMP_TEST_FLAG (pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_HALT_IN_PROGRESS))) { return IRQ_HANDLED; } - // - // Handle interrupt, walk through all bits - // Should start from highest priority interrupt - // The priority can be adjust by altering processing if statement - // + /* */ + /* Handle interrupt, walk through all bits */ + /* Should start from highest priority interrupt */ + /* The priority can be adjust by altering processing if statement */ + /* */ #ifdef DBG @@ -670,11 +670,11 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) pAd->bPCIclkOff = FALSE; - // If required spinlock, each interrupt service routine has to acquire - // and release itself. - // + /* If required spinlock, each interrupt service routine has to acquire */ + /* and release itself. */ + /* */ - // Do nothing if NIC doesn't exist + /* Do nothing if NIC doesn't exist */ if (IntSource.word == 0xffffffff) { RTMP_SET_FLAG(pAd, (fRTMP_ADAPTER_NIC_NOT_EXIST | diff --git a/drivers/staging/rt2860/rt_usb.c b/drivers/staging/rt2860/rt_usb.c index 30fc4bb750ff..e4668dcc4108 100644 --- a/drivers/staging/rt2860/rt_usb.c +++ b/drivers/staging/rt2860/rt_usb.c @@ -138,15 +138,15 @@ VOID RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd) INT ret; RTMP_OS_TASK *pTask; - // Sleep 50 milliseconds so pending io might finish normally + /* Sleep 50 milliseconds so pending io might finish normally */ RTMPusecDelay(50000); - // We want to wait until all pending receives and sends to the - // device object. We cancel any - // irps. Wait until sends and receives have stopped. + /* We want to wait until all pending receives and sends to the */ + /* device object. We cancel any */ + /* irps. Wait until sends and receives have stopped. */ RTUSBCancelPendingIRPs(pAd); - // We need clear timerQ related structure before exits of the timer thread. + /* We need clear timerQ related structure before exits of the timer thread. */ RtmpTimerQExit(pAd); /* Terminate Mlme Thread */ @@ -172,7 +172,7 @@ VOID RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd) pAd->CmdQ.CmdQState = RTMP_TASK_STAT_STOPED; NdisReleaseSpinLock(&pAd->CmdQLock); mb(); - //RTUSBCMDUp(pAd); + /*RTUSBCMDUp(pAd); */ ret = RtmpOSTaskKill(pTask); if (ret == NDIS_STATUS_FAILURE) { DBGPRINT(RT_DEBUG_ERROR, ("%s: kill task(%s) failed!\n", @@ -211,12 +211,12 @@ static void rtusb_dataout_complete(unsigned long data) pObj = (POS_COOKIE) pAd->OS_Cookie; Status = pUrb->status; - // Store BulkOut PipeId + /* Store BulkOut PipeId */ BulkOutPipeId = pHTTXContext->BulkOutPipeId; pAd->BulkOutDataOneSecCount++; - //DBGPRINT(RT_DEBUG_LOUD, ("Done-B(%d):I=0x%lx, CWPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", BulkOutPipeId, in_interrupt(), pHTTXContext->CurWritePosition, - // pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad)); + /*DBGPRINT(RT_DEBUG_LOUD, ("Done-B(%d):I=0x%lx, CWPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", BulkOutPipeId, in_interrupt(), pHTTXContext->CurWritePosition, */ + /* pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad)); */ RTMP_IRQ_LOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); pAd->BulkOutPending[BulkOutPipeId] = FALSE; @@ -229,11 +229,11 @@ static void rtusb_dataout_complete(unsigned long data) RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); pAd->Counters8023.GoodTransmits++; - //RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); + /*RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); */ FREE_HTTX_RING(pAd, BulkOutPipeId, pHTTXContext); - //RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); + /*RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); */ - } else // STATUS_OTHER + } else /* STATUS_OTHER */ { PUCHAR pBuf; @@ -264,15 +264,15 @@ static void rtusb_dataout_complete(unsigned long data) ("\t>>BulkOut Header:%x %x %x %x %x %x %x %x\n", pBuf[0], pBuf[1], pBuf[2], pBuf[3], pBuf[4], pBuf[5], pBuf[6], pBuf[7])); - //DBGPRINT_RAW(RT_DEBUG_ERROR, (">>BulkOutCompleteCancel=0x%x, BulkOutCompleteOther=0x%x\n", pAd->BulkOutCompleteCancel, pAd->BulkOutCompleteOther)); + /*DBGPRINT_RAW(RT_DEBUG_ERROR, (">>BulkOutCompleteCancel=0x%x, BulkOutCompleteOther=0x%x\n", pAd->BulkOutCompleteCancel, pAd->BulkOutCompleteOther)); */ } - // - // bInUse = TRUE, means some process are filling TX data, after that must turn on bWaitingBulkOut - // bWaitingBulkOut = TRUE, means the TX data are waiting for bulk out. - // - //RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); + /* */ + /* bInUse = TRUE, means some process are filling TX data, after that must turn on bWaitingBulkOut */ + /* bWaitingBulkOut = TRUE, means the TX data are waiting for bulk out. */ + /* */ + /*RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); */ if ((pHTTXContext->ENextBulkOutPosition != pHTTXContext->CurWritePosition) && (pHTTXContext->ENextBulkOutPosition != @@ -280,15 +280,15 @@ static void rtusb_dataout_complete(unsigned long data) && !RTUSB_TEST_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_FRAG << BulkOutPipeId))) { - // Indicate There is data avaliable + /* Indicate There is data avaliable */ RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId)); } - //RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); + /*RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); */ - // Always call Bulk routine, even reset bulk. - // The protection of rest bulk should be in BulkOut routine + /* Always call Bulk routine, even reset bulk. */ + /* The protection of rest bulk should be in BulkOut routine */ RTUSBKickBulkOut(pAd); } @@ -305,7 +305,7 @@ static void rtusb_null_frame_done_tasklet(unsigned long data) pAd = pNullContext->pAd; Status = pUrb->status; - // Reset Null frame context flags + /* Reset Null frame context flags */ RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], irqFlag); pNullContext->IRPPending = FALSE; pNullContext->InUse = FALSE; @@ -316,7 +316,7 @@ static void rtusb_null_frame_done_tasklet(unsigned long data) RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); - } else // STATUS_OTHER + } else /* STATUS_OTHER */ { if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && @@ -336,8 +336,8 @@ static void rtusb_null_frame_done_tasklet(unsigned long data) } } - // Always call Bulk routine, even reset bulk. - // The protectioon of rest bulk should be in BulkOut routine + /* Always call Bulk routine, even reset bulk. */ + /* The protectioon of rest bulk should be in BulkOut routine */ RTUSBKickBulkOut(pAd); } @@ -354,7 +354,7 @@ static void rtusb_rts_frame_done_tasklet(unsigned long data) pAd = pRTSContext->pAd; Status = pUrb->status; - // Reset RTS frame context flags + /* Reset RTS frame context flags */ RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], irqFlag); pRTSContext->IRPPending = FALSE; pRTSContext->InUse = FALSE; @@ -362,7 +362,7 @@ static void rtusb_rts_frame_done_tasklet(unsigned long data) if (Status == USB_ST_NOERROR) { RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], irqFlag); RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); - } else // STATUS_OTHER + } else /* STATUS_OTHER */ { if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && @@ -385,8 +385,8 @@ static void rtusb_rts_frame_done_tasklet(unsigned long data) pAd->BulkOutPending[pRTSContext->BulkOutPipeId] = FALSE; RTMP_SEM_UNLOCK(&pAd->BulkOutLock[pRTSContext->BulkOutPipeId]); - // Always call Bulk routine, even reset bulk. - // The protectioon of rest bulk should be in BulkOut routine + /* Always call Bulk routine, even reset bulk. */ + /* The protectioon of rest bulk should be in BulkOut routine */ RTUSBKickBulkOut(pAd); } @@ -403,14 +403,14 @@ static void rtusb_pspoll_frame_done_tasklet(unsigned long data) pAd = pPsPollContext->pAd; Status = pUrb->status; - // Reset PsPoll context flags + /* Reset PsPoll context flags */ pPsPollContext->IRPPending = FALSE; pPsPollContext->InUse = FALSE; pAd->watchDogTxPendingCnt[0] = 0; if (Status == USB_ST_NOERROR) { RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); - } else // STATUS_OTHER + } else /* STATUS_OTHER */ { if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && @@ -430,8 +430,8 @@ static void rtusb_pspoll_frame_done_tasklet(unsigned long data) pAd->BulkOutPending[0] = FALSE; RTMP_SEM_UNLOCK(&pAd->BulkOutLock[0]); - // Always call Bulk routine, even reset bulk. - // The protectioon of rest bulk should be in BulkOut routine + /* Always call Bulk routine, even reset bulk. */ + /* The protectioon of rest bulk should be in BulkOut routine */ RTUSBKickBulkOut(pAd); } @@ -467,26 +467,26 @@ static void rx_done_tasklet(unsigned long data) pRxContext->InUse = FALSE; pRxContext->IRPPending = FALSE; pRxContext->BulkInOffset += pUrb->actual_length; - //NdisInterlockedDecrement(&pAd->PendingRx); + /*NdisInterlockedDecrement(&pAd->PendingRx); */ pAd->PendingRx--; if (Status == USB_ST_NOERROR) { pAd->BulkInComplete++; pAd->NextRxBulkInPosition = 0; - if (pRxContext->BulkInOffset) // As jan's comment, it may bulk-in success but size is zero. + if (pRxContext->BulkInOffset) /* As jan's comment, it may bulk-in success but size is zero. */ { pRxContext->Readable = TRUE; INC_RING_INDEX(pAd->NextRxBulkInIndex, RX_RING_SIZE); } RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); - } else // STATUS_OTHER + } else /* STATUS_OTHER */ { pAd->BulkInCompleteFail++; - // Still read this packet although it may comtain wrong bytes. + /* Still read this packet although it may comtain wrong bytes. */ pRxContext->Readable = FALSE; RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); - // Parsing all packets. because after reset, the index will reset to all zero. + /* Parsing all packets. because after reset, the index will reset to all zero. */ if ((!RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_BULKIN_RESET | fRTMP_ADAPTER_HALT_IN_PROGRESS | @@ -533,7 +533,7 @@ static void rtusb_mgmt_dma_done_tasklet(unsigned long data) RTMP_IRQ_LOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags); if (Status != USB_ST_NOERROR) { - //Bulk-Out fail status handle + /*Bulk-Out fail status handle */ if ((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && @@ -541,7 +541,7 @@ static void rtusb_mgmt_dma_done_tasklet(unsigned long data) DBGPRINT_RAW(RT_DEBUG_ERROR, ("Bulk Out MLME Failed, Status=%d!\n", Status)); - // TODO: How to handle about the MLMEBulkOut failed issue. Need to resend the mgmt pkt? + /* TODO: How to handle about the MLMEBulkOut failed issue. Need to resend the mgmt pkt? */ RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); pAd->bulkResetPipeid = (MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG); @@ -552,7 +552,7 @@ static void rtusb_mgmt_dma_done_tasklet(unsigned long data) RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags); RTMP_IRQ_LOCK(&pAd->MLMEBulkOutLock, IrqFlags); - // Reset MLME context flags + /* Reset MLME context flags */ pMLMEContext->IRPPending = FALSE; pMLMEContext->InUse = FALSE; pMLMEContext->bWaitingBulkOut = FALSE; @@ -561,27 +561,27 @@ static void rtusb_mgmt_dma_done_tasklet(unsigned long data) pPacket = pAd->MgmtRing.Cell[index].pNdisPacket; pAd->MgmtRing.Cell[index].pNdisPacket = NULL; - // Increase MgmtRing Index + /* Increase MgmtRing Index */ INC_RING_INDEX(pAd->MgmtRing.TxDmaIdx, MGMT_RING_SIZE); pAd->MgmtRing.TxSwFreeIdx++; RTMP_IRQ_UNLOCK(&pAd->MLMEBulkOutLock, IrqFlags); - // No-matter success or fail, we free the mgmt packet. + /* No-matter success or fail, we free the mgmt packet. */ if (pPacket) RTMPFreeNdisPacket(pAd, pPacket); if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)))) { - // do nothing and return directly. + /* do nothing and return directly. */ } else { - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET) && ((pAd->bulkResetPipeid & BULKOUT_MGMT_RESET_FLAG) == BULKOUT_MGMT_RESET_FLAG)) { // For Mgmt Bulk-Out failed, ignore it now. + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET) && ((pAd->bulkResetPipeid & BULKOUT_MGMT_RESET_FLAG) == BULKOUT_MGMT_RESET_FLAG)) { /* For Mgmt Bulk-Out failed, ignore it now. */ RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, NULL, 0); } else { - // Always call Bulk routine, even reset bulk. - // The protectioon of rest bulk should be in BulkOut routine + /* Always call Bulk routine, even reset bulk. */ + /* The protectioon of rest bulk should be in BulkOut routine */ if (pAd->MgmtRing.TxSwFreeIdx < MGMT_RING_SIZE /* pMLMEContext->bWaitingBulkOut == TRUE */ ) { @@ -609,7 +609,7 @@ static void rtusb_ac3_dma_done_tasklet(unsigned long data) if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)))) { - // do nothing and return directly. + /* do nothing and return directly. */ } else { if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) { RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, @@ -649,7 +649,7 @@ static void rtusb_ac2_dma_done_tasklet(unsigned long data) if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)))) { - // do nothing and return directly. + /* do nothing and return directly. */ } else { if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) { RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, @@ -689,7 +689,7 @@ static void rtusb_ac1_dma_done_tasklet(unsigned long data) if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)))) { - // do nothing and return directly. + /* do nothing and return directly. */ } else { if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) { RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, @@ -729,7 +729,7 @@ static void rtusb_ac0_dma_done_tasklet(unsigned long data) if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)))) { - // do nothing and return directly. + /* do nothing and return directly. */ } else { if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET)) { RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_RESET_BULK_OUT, @@ -757,7 +757,7 @@ NDIS_STATUS RtmpNetTaskInit(IN RTMP_ADAPTER * pAd) { POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - // Create receive tasklet + /* Create receive tasklet */ tasklet_init(&pObj->rx_done_task, rx_done_tasklet, (ULONG) pAd); tasklet_init(&pObj->mgmt_dma_done_task, rtusb_mgmt_dma_done_tasklet, (unsigned long)pAd); diff --git a/drivers/staging/rt2860/sta_ioctl.c b/drivers/staging/rt2860/sta_ioctl.c index dc1f60010ec9..d92a41e9b551 100644 --- a/drivers/staging/rt2860/sta_ioctl.c +++ b/drivers/staging/rt2860/sta_ioctl.c @@ -61,15 +61,15 @@ typedef struct PACKED _RT_VERSION_INFO { UINT DriverBuildDay; } RT_VERSION_INFO, *PRT_VERSION_INFO; -static __s32 ralinkrate[] = { 2, 4, 11, 22, // CCK - 12, 18, 24, 36, 48, 72, 96, 108, // OFDM - 13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78, 104, 156, 208, 234, 260, // 20MHz, 800ns GI, MCS: 0 ~ 15 - 39, 78, 117, 156, 234, 312, 351, 390, // 20MHz, 800ns GI, MCS: 16 ~ 23 - 27, 54, 81, 108, 162, 216, 243, 270, 54, 108, 162, 216, 324, 432, 486, 540, // 40MHz, 800ns GI, MCS: 0 ~ 15 - 81, 162, 243, 324, 486, 648, 729, 810, // 40MHz, 800ns GI, MCS: 16 ~ 23 - 14, 29, 43, 57, 87, 115, 130, 144, 29, 59, 87, 115, 173, 230, 260, 288, // 20MHz, 400ns GI, MCS: 0 ~ 15 - 43, 87, 130, 173, 260, 317, 390, 433, // 20MHz, 400ns GI, MCS: 16 ~ 23 - 30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 480, 540, 600, // 40MHz, 400ns GI, MCS: 0 ~ 15 +static __s32 ralinkrate[] = { 2, 4, 11, 22, /* CCK */ + 12, 18, 24, 36, 48, 72, 96, 108, /* OFDM */ + 13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78, 104, 156, 208, 234, 260, /* 20MHz, 800ns GI, MCS: 0 ~ 15 */ + 39, 78, 117, 156, 234, 312, 351, 390, /* 20MHz, 800ns GI, MCS: 16 ~ 23 */ + 27, 54, 81, 108, 162, 216, 243, 270, 54, 108, 162, 216, 324, 432, 486, 540, /* 40MHz, 800ns GI, MCS: 0 ~ 15 */ + 81, 162, 243, 324, 486, 648, 729, 810, /* 40MHz, 800ns GI, MCS: 16 ~ 23 */ + 14, 29, 43, 57, 87, 115, 130, 144, 29, 59, 87, 115, 173, 230, 260, 288, /* 20MHz, 400ns GI, MCS: 0 ~ 15 */ + 43, 87, 130, 173, 260, 317, 390, 433, /* 20MHz, 400ns GI, MCS: 16 ~ 23 */ + 30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 480, 540, 600, /* 40MHz, 400ns GI, MCS: 0 ~ 15 */ 90, 180, 270, 360, 540, 720, 810, 900 }; @@ -93,7 +93,7 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) pKey->KeyLength); goto end; } - // Update PTK + /* Update PTK */ NdisZeroMemory(&pAd->SharedKey[BSS0][0], sizeof(CIPHER_KEY)); pAd->SharedKey[BSS0][0].KeyLen = LEN_TKIP_EK; @@ -119,7 +119,7 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) LEN_TKIP_RXMICK); } - // Decide its ChiperAlg + /* Decide its ChiperAlg */ if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_TKIP; @@ -129,7 +129,7 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) else pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_NONE; - // Update these related information to MAC_TABLE_ENTRY + /* Update these related information to MAC_TABLE_ENTRY */ pEntry = &pAd->MacTab.Content[BSSID_WCID]; NdisMoveMemory(pEntry->PairwiseKey.Key, pAd->SharedKey[BSS0][0].Key, @@ -143,7 +143,7 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) pEntry->PairwiseKey.CipherAlg = pAd->SharedKey[BSS0][0].CipherAlg; - // Update pairwise key information to ASIC Shared Key Table + /* Update pairwise key information to ASIC Shared Key Table */ AsicAddSharedKeyEntry(pAd, BSS0, 0, @@ -152,7 +152,7 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) pAd->SharedKey[BSS0][0].TxMic, pAd->SharedKey[BSS0][0].RxMic); - // Update ASIC WCID attribute table and IVEIV table + /* Update ASIC WCID attribute table and IVEIV table */ RTMPAddWcidAttributeEntry(pAd, BSS0, 0, @@ -160,16 +160,16 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) CipherAlg, pEntry); if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA2) { - // set 802.1x port control - //pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + /* set 802.1x port control */ + /*pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; */ STA_PORT_SECURED(pAd); - // Indicate Connected for GUI + /* Indicate Connected for GUI */ pAd->IndicateMediaState = NdisMediaStateConnected; } } else { - // Update GTK + /* Update GTK */ pAd->StaCfg.DefaultKeyId = (pKey->KeyIndex & 0xFF); NdisZeroMemory(&pAd-> SharedKey[BSS0][pAd->StaCfg. @@ -213,7 +213,7 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) LEN_TKIP_RXMICK); } - // Update Shared Key CipherAlg + /* Update Shared Key CipherAlg */ pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId]. CipherAlg = CIPHER_NONE; if (pAd->StaCfg.GroupCipher == @@ -225,7 +225,7 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId]. CipherAlg = CIPHER_AES; - // Update group key information to ASIC Shared Key Table + /* Update group key information to ASIC Shared Key Table */ AsicAddSharedKeyEntry(pAd, BSS0, pAd->StaCfg.DefaultKeyId, @@ -242,7 +242,7 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) DefaultKeyId]. RxMic); - // Update ASIC WCID attribute table and IVEIV table + /* Update ASIC WCID attribute table and IVEIV table */ RTMPAddWcidAttributeEntry(pAd, BSS0, pAd->StaCfg.DefaultKeyId, @@ -251,14 +251,14 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) DefaultKeyId]. CipherAlg, NULL); - // set 802.1x port control - //pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + /* set 802.1x port control */ + /*pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; */ STA_PORT_SECURED(pAd); - // Indicate Connected for GUI + /* Indicate Connected for GUI */ pAd->IndicateMediaState = NdisMediaStateConnected; } - } else // dynamic WEP from wpa_supplicant + } else /* dynamic WEP from wpa_supplicant */ { UCHAR CipherAlg; PUCHAR Key; @@ -269,7 +269,7 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) KeyIdx = pKey->KeyIndex & 0x0fffffff; if (KeyIdx < 4) { - // it is a default shared key, for Pairwise key setting + /* it is a default shared key, for Pairwise key setting */ if (pKey->KeyIndex & 0x80000000) { pEntry = MacTableLookup(pAd, pKey->BSSID); @@ -277,14 +277,14 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) DBGPRINT(RT_DEBUG_TRACE, ("RTMPAddKey: Set Pair-wise Key\n")); - // set key material and key length + /* set key material and key length */ pEntry->PairwiseKey.KeyLen = (UCHAR) pKey->KeyLength; NdisMoveMemory(pEntry->PairwiseKey.Key, &pKey->KeyMaterial, pKey->KeyLength); - // set Cipher type + /* set Cipher type */ if (pKey->KeyLength == 5) pEntry->PairwiseKey.CipherAlg = CIPHER_WEP64; @@ -292,7 +292,7 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) pEntry->PairwiseKey.CipherAlg = CIPHER_WEP128; - // Add Pair-wise key to Asic + /* Add Pair-wise key to Asic */ AsicAddPairwiseKeyEntry(pAd, pEntry->Addr, (UCHAR) pEntry-> @@ -300,8 +300,8 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) &pEntry-> PairwiseKey); - // update WCID attribute table and IVEIV table for this entry - RTMPAddWcidAttributeEntry(pAd, BSS0, KeyIdx, // The value may be not zero + /* update WCID attribute table and IVEIV table for this entry */ + RTMPAddWcidAttributeEntry(pAd, BSS0, KeyIdx, /* The value may be not zero */ pEntry-> PairwiseKey. CipherAlg, @@ -309,17 +309,17 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) } } else { - // Default key for tx (shared key) + /* Default key for tx (shared key) */ pAd->StaCfg.DefaultKeyId = (UCHAR) KeyIdx; - // set key material and key length + /* set key material and key length */ pAd->SharedKey[BSS0][KeyIdx].KeyLen = (UCHAR) pKey->KeyLength; NdisMoveMemory(pAd->SharedKey[BSS0][KeyIdx].Key, &pKey->KeyMaterial, pKey->KeyLength); - // Set Ciper type + /* Set Ciper type */ if (pKey->KeyLength == 5) pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_WEP64; @@ -331,12 +331,12 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) pAd->SharedKey[BSS0][KeyIdx].CipherAlg; Key = pAd->SharedKey[BSS0][KeyIdx].Key; - // Set Group key material to Asic + /* Set Group key material to Asic */ AsicAddSharedKeyEntry(pAd, BSS0, KeyIdx, CipherAlg, Key, NULL, NULL); - // Update WCID attribute table and IVEIV table for this group key table + /* Update WCID attribute table and IVEIV table for this group key table */ RTMPAddWcidAttributeEntry(pAd, BSS0, KeyIdx, CipherAlg, NULL); @@ -364,8 +364,8 @@ rt_ioctl_giwname(struct net_device *dev, struct iw_request_info *info, char *name, char *extra) { strncpy(name, "Ralink STA", IFNAMSIZ); - // RT2870 2.1.0.0 uses "RT2870 Wireless" - // RT3090 2.1.0.0 uses "RT2860 Wireless" + /* RT2870 2.1.0.0 uses "RT2870 Wireless" */ + /* RT3090 2.1.0.0 uses "RT2860 Wireless" */ return 0; } @@ -378,7 +378,7 @@ int rt_ioctl_siwfreq(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); return -ENETDOWN; @@ -388,9 +388,9 @@ int rt_ioctl_siwfreq(struct net_device *dev, return -EINVAL; if ((freq->e == 0) && (freq->m <= 1000)) - chan = freq->m; // Setting by channel number + chan = freq->m; /* Setting by channel number */ else - MAP_KHZ_TO_CHANNEL_ID((freq->m / 100), chan); // Setting by frequency - search the table , like 2.412G, 2.422G, + MAP_KHZ_TO_CHANNEL_ID((freq->m / 100), chan); /* Setting by frequency - search the table , like 2.412G, 2.422G, */ if (ChannelSanity(pAdapter, chan) == TRUE) { pAdapter->CommonCfg.Channel = chan; @@ -430,7 +430,7 @@ int rt_ioctl_siwmode(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); return -ENETDOWN; @@ -453,7 +453,7 @@ int rt_ioctl_siwmode(struct net_device *dev, return -EINVAL; } - // Reset Ralink supplicant to not use, it will be set to start when UI set PMK key + /* Reset Ralink supplicant to not use, it will be set to start when UI set PMK key */ pAdapter->StaCfg.WpaState = SS_NOTUSE; return 0; @@ -486,7 +486,7 @@ int rt_ioctl_siwsens(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); return -ENETDOWN; @@ -591,7 +591,7 @@ int rt_ioctl_siwap(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); return -ENETDOWN; @@ -602,10 +602,10 @@ int rt_ioctl_siwap(struct net_device *dev, DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); } - // tell CNTL state machine to call NdisMSetInformationComplete() after completing - // this request, because this request is initiated by NDIS. + /* tell CNTL state machine to call NdisMSetInformationComplete() after completing */ + /* this request, because this request is initiated by NDIS. */ pAdapter->MlmeAux.CurrReqIsFromNdis = FALSE; - // Prevent to connect AP again in STAMlmePeriodicExec + /* Prevent to connect AP again in STAMlmePeriodicExec */ pAdapter->MlmeAux.AutoReconnectSsidLen = 32; memset(Bssid, 0, MAC_ADDR_LEN); @@ -634,7 +634,7 @@ int rt_ioctl_giwap(struct net_device *dev, ap_addr->sa_family = ARPHRD_ETHER; memcpy(ap_addr->sa_data, &pAdapter->CommonCfg.Bssid, ETH_ALEN); } - // Add for RT2870 + /* Add for RT2870 */ else if (pAdapter->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) { ap_addr->sa_family = ARPHRD_ETHER; memcpy(ap_addr->sa_data, &pAdapter->MlmeAux.Bssid, ETH_ALEN); @@ -667,12 +667,12 @@ static void set_quality(PRTMP_ADAPTER pAdapter, { __u8 ChannelQuality; - // Normalize Rssi + /* Normalize Rssi */ if (rssi >= -50) ChannelQuality = 100; - else if (rssi >= -80) // between -50 ~ -80dbm + else if (rssi >= -80) /* between -50 ~ -80dbm */ ChannelQuality = (__u8) (24 + ((rssi + 80) * 26) / 10); - else if (rssi >= -90) // between -80 ~ -90dbm + else if (rssi >= -90) /* between -80 ~ -90dbm */ ChannelQuality = (__u8) ((rssi + 90) * 26) / 10; else ChannelQuality = 0; @@ -680,7 +680,7 @@ static void set_quality(PRTMP_ADAPTER pAdapter, iq->qual = (__u8) ChannelQuality; iq->level = (__u8) (rssi); - iq->noise = (pAdapter->BbpWriteLatch[66] > pAdapter->BbpTuning.FalseCcaUpperThreshold) ? ((__u8) pAdapter->BbpTuning.FalseCcaUpperThreshold) : ((__u8) pAdapter->BbpWriteLatch[66]); // noise level (dBm) + iq->noise = (pAdapter->BbpWriteLatch[66] > pAdapter->BbpTuning.FalseCcaUpperThreshold) ? ((__u8) pAdapter->BbpTuning.FalseCcaUpperThreshold) : ((__u8) pAdapter->BbpWriteLatch[66]); /* noise level (dBm) */ iq->noise += 256 - 143; iq->updated = pAdapter->iw_stats.qual.updated; } @@ -697,12 +697,12 @@ int rt_ioctl_iwaplist(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); data->length = 0; return 0; - //return -ENETDOWN; + /*return -ENETDOWN; */ } for (i = 0; i < IW_MAX_AP; i++) { @@ -733,7 +733,7 @@ int rt_ioctl_siwscan(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); return -ENETDOWN; @@ -781,10 +781,10 @@ int rt_ioctl_siwscan(struct net_device *dev, DBGPRINT(RT_DEBUG_TRACE, ("!!! MLME busy, reset MLME state machine !!!\n")); } - // tell CNTL state machine to call NdisMSetInformationComplete() after completing - // this request, because this request is initiated by NDIS. + /* tell CNTL state machine to call NdisMSetInformationComplete() after completing */ + /* this request, because this request is initiated by NDIS. */ pAdapter->MlmeAux.CurrReqIsFromNdis = FALSE; - // Reset allowed scan retries + /* Reset allowed scan retries */ pAdapter->StaCfg.ScanCnt = 0; pAdapter->StaCfg.LastScanTime = Now; @@ -837,8 +837,8 @@ int rt_ioctl_giwscan(struct net_device *dev, if (current_ev >= end_buf) { return -E2BIG; } - //MAC address - //================================ + /*MAC address */ + /*================================ */ memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWAP; iwe.u.ap_addr.sa_family = ARPHRD_ETHER; @@ -935,8 +935,8 @@ int rt_ioctl_giwscan(struct net_device *dev, if (current_ev == previous_ev) return -E2BIG; - //ESSID - //================================ + /*ESSID */ + /*================================ */ memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWESSID; iwe.u.data.length = pAdapter->ScanTab.BssEntry[i].SsidLen; @@ -950,8 +950,8 @@ int rt_ioctl_giwscan(struct net_device *dev, if (current_ev == previous_ev) return -E2BIG; - //Network Type - //================================ + /*Network Type */ + /*================================ */ memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWMODE; if (pAdapter->ScanTab.BssEntry[i].BssType == Ndis802_11IBSS) { @@ -971,8 +971,8 @@ int rt_ioctl_giwscan(struct net_device *dev, if (current_ev == previous_ev) return -E2BIG; - //Channel and Frequency - //================================ + /*Channel and Frequency */ + /*================================ */ memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWFREQ; if (INFRA_ON(pAdapter) || ADHOC_ON(pAdapter)) @@ -989,8 +989,8 @@ int rt_ioctl_giwscan(struct net_device *dev, if (current_ev == previous_ev) return -E2BIG; - //Add quality statistics - //================================ + /*Add quality statistics */ + /*================================ */ memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVQUAL; iwe.u.qual.level = 0; @@ -1003,8 +1003,8 @@ int rt_ioctl_giwscan(struct net_device *dev, if (current_ev == previous_ev) return -E2BIG; - //Encyption key - //================================ + /*Encyption key */ + /*================================ */ memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWENCODE; if (CAP_IS_PRIVACY_ON @@ -1024,8 +1024,8 @@ int rt_ioctl_giwscan(struct net_device *dev, if (current_ev == previous_ev) return -E2BIG; - //Bit Rate - //================================ + /*Bit Rate */ + /*================================ */ if (pAdapter->ScanTab.BssEntry[i].SupRateLen) { UCHAR tmpRate = pAdapter->ScanTab.BssEntry[i].SupRate[pAdapter-> @@ -1083,7 +1083,7 @@ int rt_ioctl_giwscan(struct net_device *dev, else return -E2BIG; } - //WPA IE + /*WPA IE */ if (pAdapter->ScanTab.BssEntry[i].WpaIE.IELen > 0) { memset(&iwe, 0, sizeof(iwe)); memset(&custom[0], 0, MAX_CUSTOM_LEN); @@ -1099,7 +1099,7 @@ int rt_ioctl_giwscan(struct net_device *dev, if (current_ev == previous_ev) return -E2BIG; } - //WPA2 IE + /*WPA2 IE */ if (pAdapter->ScanTab.BssEntry[i].RsnIE.IELen > 0) { memset(&iwe, 0, sizeof(iwe)); memset(&custom[0], 0, MAX_CUSTOM_LEN); @@ -1133,7 +1133,7 @@ int rt_ioctl_siwessid(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); return -ENETDOWN; @@ -1142,7 +1142,7 @@ int rt_ioctl_siwessid(struct net_device *dev, if (data->flags) { PSTRING pSsidString = NULL; - // Includes null character. + /* Includes null character. */ if (data->length > (IW_ESSID_MAX_SIZE + 1)) return -E2BIG; @@ -1155,7 +1155,7 @@ int rt_ioctl_siwessid(struct net_device *dev, } else return -ENOMEM; } else { - // ANY ssid + /* ANY ssid */ if (Set_SSID_Proc(pAdapter, "") == FALSE) return -EINVAL; } @@ -1183,14 +1183,14 @@ int rt_ioctl_giwessid(struct net_device *dev, pAdapter->CommonCfg.SsidLen); } #ifdef RTMP_MAC_USB - // Add for RT2870 + /* Add for RT2870 */ else if (pAdapter->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) { data->length = pAdapter->CommonCfg.SsidLen; memcpy(essid, pAdapter->CommonCfg.Ssid, pAdapter->CommonCfg.SsidLen); } -#endif // RTMP_MAC_USB // - else { //the ANY ssid was specified +#endif /* RTMP_MAC_USB // */ + else { /*the ANY ssid was specified */ data->length = 0; DBGPRINT(RT_DEBUG_TRACE, ("MediaState is not connected, ess\n")); @@ -1208,7 +1208,7 @@ int rt_ioctl_siwnickn(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); return -ENETDOWN; @@ -1249,7 +1249,7 @@ int rt_ioctl_siwrts(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); return -ENETDOWN; @@ -1278,7 +1278,7 @@ int rt_ioctl_giwrts(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); return -ENETDOWN; @@ -1300,7 +1300,7 @@ int rt_ioctl_siwfrag(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); return -ENETDOWN; @@ -1328,7 +1328,7 @@ int rt_ioctl_giwfrag(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); return -ENETDOWN; @@ -1351,7 +1351,7 @@ int rt_ioctl_siwencode(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); return -ENETDOWN; @@ -1366,7 +1366,7 @@ int rt_ioctl_siwencode(struct net_device *dev, goto done; } else if (erq->flags & IW_ENCODE_RESTRICTED || erq->flags & IW_ENCODE_OPEN) { - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + /*pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; */ STA_PORT_SECURED(pAdapter); pAdapter->StaCfg.PairCipher = Ndis802_11WEPEnabled; pAdapter->StaCfg.GroupCipher = Ndis802_11WEPEnabled; @@ -1390,7 +1390,7 @@ int rt_ioctl_siwencode(struct net_device *dev, ("==>rt_ioctl_siwencode::Wrong keyIdx=%d! Using default key instead (%d)\n", keyIdx, pAdapter->StaCfg.DefaultKeyId)); - //Using default key + /*Using default key */ keyIdx = pAdapter->StaCfg.DefaultKeyId; } else pAdapter->StaCfg.DefaultKeyId = keyIdx; @@ -1455,7 +1455,7 @@ rt_ioctl_giwencode(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); return -ENETDOWN; @@ -1469,14 +1469,14 @@ rt_ioctl_giwencode(struct net_device *dev, erq->length = 0; erq->flags = IW_ENCODE_DISABLED; } else if ((kid > 0) && (kid <= 4)) { - // copy wep key + /* copy wep key */ erq->flags = kid; /* NB: base 1 */ if (erq->length > pAdapter->SharedKey[BSS0][kid - 1].KeyLen) erq->length = pAdapter->SharedKey[BSS0][kid - 1].KeyLen; memcpy(key, pAdapter->SharedKey[BSS0][kid - 1].Key, erq->length); - //if ((kid == pAdapter->PortCfg.DefaultKeyId)) - //erq->flags |= IW_ENCODE_ENABLED; /* XXX */ + /*if ((kid == pAdapter->PortCfg.DefaultKeyId)) */ + /*erq->flags |= IW_ENCODE_ENABLED; */ /* XXX */ if (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeShared) erq->flags |= IW_ENCODE_RESTRICTED; /* XXX */ else @@ -1493,7 +1493,7 @@ rt_ioctl_giwencode(struct net_device *dev, memcpy(key, pAdapter->SharedKey[BSS0][pAdapter->StaCfg.DefaultKeyId]. Key, erq->length); - // copy default key ID + /* copy default key ID */ if (pAdapter->StaCfg.AuthMode == Ndis802_11AuthModeShared) erq->flags |= IW_ENCODE_RESTRICTED; /* XXX */ else @@ -1595,7 +1595,7 @@ int rt_ioctl_siwmlme(struct net_device *dev, pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; } break; -#endif // IW_MLME_DEAUTH // +#endif /* IW_MLME_DEAUTH // */ #ifdef IW_MLME_DISASSOC case IW_MLME_DISASSOC: DBGPRINT(RT_DEBUG_TRACE, @@ -1612,7 +1612,7 @@ int rt_ioctl_siwmlme(struct net_device *dev, pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC; MlmeDisassocReqAction(pAd, &MsgElem); break; -#endif // IW_MLME_DISASSOC // +#endif /* IW_MLME_DISASSOC // */ default: DBGPRINT(RT_DEBUG_TRACE, ("====> %s - Unknow Command\n", __func__)); @@ -1631,7 +1631,7 @@ int rt_ioctl_siwauth(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); return -ENETDOWN; @@ -1712,10 +1712,10 @@ int rt_ioctl_siwauth(struct net_device *dev, Ndis802_11AuthModeWPA2; pAdapter->StaCfg.IEEE8021X = FALSE; } else - // WEP 1x + /* WEP 1x */ pAdapter->StaCfg.IEEE8021X = TRUE; } else if (param->value == 0) { - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + /*pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; */ STA_PORT_SECURED(pAdapter); } DBGPRINT(RT_DEBUG_TRACE, @@ -1742,7 +1742,7 @@ int rt_ioctl_siwauth(struct net_device *dev, pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; else { - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + /*pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; */ STA_PORT_SECURED(pAdapter); } DBGPRINT(RT_DEBUG_TRACE, @@ -1781,7 +1781,7 @@ int rt_ioctl_giwauth(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); return -ENETDOWN; @@ -1831,7 +1831,7 @@ void fnSetCipherKey(IN PRTMP_ADAPTER pAdapter, LEN_TKIP_RXMICK); pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = CipherAlg; - // Update group key information to ASIC Shared Key Table + /* Update group key information to ASIC Shared Key Table */ AsicAddSharedKeyEntry(pAdapter, BSS0, keyIdx, @@ -1841,14 +1841,14 @@ void fnSetCipherKey(IN PRTMP_ADAPTER pAdapter, pAdapter->SharedKey[BSS0][keyIdx].RxMic); if (bGTK) - // Update ASIC WCID attribute table and IVEIV table + /* Update ASIC WCID attribute table and IVEIV table */ RTMPAddWcidAttributeEntry(pAdapter, BSS0, keyIdx, pAdapter->SharedKey[BSS0][keyIdx]. CipherAlg, NULL); else - // Update ASIC WCID attribute table and IVEIV table + /* Update ASIC WCID attribute table and IVEIV table */ RTMPAddWcidAttributeEntry(pAdapter, BSS0, keyIdx, @@ -1869,7 +1869,7 @@ int rt_ioctl_siwencodeext(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAdapter, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); return -ENETDOWN; @@ -1877,7 +1877,7 @@ int rt_ioctl_siwencodeext(struct net_device *dev, if (encoding->flags & IW_ENCODE_DISABLED) { keyIdx = (encoding->flags & IW_ENCODE_INDEX) - 1; - // set BSSID wcid entry of the Pair-wise Key table as no-security mode + /* set BSSID wcid entry of the Pair-wise Key table as no-security mode */ AsicRemovePairwiseKeyEntry(pAdapter, BSS0, BSSID_WCID); pAdapter->SharedKey[BSS0][keyIdx].KeyLen = 0; pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = CIPHER_NONE; @@ -1888,7 +1888,7 @@ int rt_ioctl_siwencodeext(struct net_device *dev, ("%s::Remove all keys!(encoding->flags = %x)\n", __func__, encoding->flags)); } else { - // Get Key Index and convet to our own defined key index + /* Get Key Index and convet to our own defined key index */ keyIdx = (encoding->flags & IW_ENCODE_INDEX) - 1; if ((keyIdx < 0) || (keyIdx >= NR_WEP_KEYS)) return -EINVAL; @@ -1930,7 +1930,7 @@ int rt_ioctl_siwencodeext(struct net_device *dev, Ndis802_11GroupWEP40Enabled || pAdapter->StaCfg.GroupCipher == Ndis802_11GroupWEP104Enabled) { - // Set Group key material to Asic + /* Set Group key material to Asic */ AsicAddSharedKeyEntry(pAdapter, BSS0, keyIdx, pAdapter-> SharedKey[BSS0][keyIdx]. @@ -1939,7 +1939,7 @@ int rt_ioctl_siwencodeext(struct net_device *dev, SharedKey[BSS0][keyIdx]. Key, NULL, NULL); - // Update WCID attribute table and IVEIV table for this group key table + /* Update WCID attribute table and IVEIV table for this group key table */ RTMPAddWcidAttributeEntry(pAdapter, BSS0, keyIdx, pAdapter-> @@ -1949,7 +1949,7 @@ int rt_ioctl_siwencodeext(struct net_device *dev, STA_PORT_SECURED(pAdapter); - // Indicate Connected for GUI + /* Indicate Connected for GUI */ pAdapter->IndicateMediaState = NdisMediaStateConnected; } @@ -1964,7 +1964,7 @@ int rt_ioctl_siwencodeext(struct net_device *dev, CIPHER_TKIP, FALSE, ext); if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA2) { - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + /*pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; */ STA_PORT_SECURED(pAdapter); pAdapter->IndicateMediaState = NdisMediaStateConnected; @@ -1975,8 +1975,8 @@ int rt_ioctl_siwencodeext(struct net_device *dev, fnSetCipherKey(pAdapter, keyIdx, CIPHER_TKIP, TRUE, ext); - // set 802.1x port control - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + /* set 802.1x port control */ + /*pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; */ STA_PORT_SECURED(pAdapter); pAdapter->IndicateMediaState = NdisMediaStateConnected; @@ -1990,7 +1990,7 @@ int rt_ioctl_siwencodeext(struct net_device *dev, FALSE, ext); if (pAdapter->StaCfg.AuthMode >= Ndis802_11AuthModeWPA2) - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + /*pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; */ STA_PORT_SECURED(pAdapter); pAdapter->IndicateMediaState = NdisMediaStateConnected; @@ -1998,8 +1998,8 @@ int rt_ioctl_siwencodeext(struct net_device *dev, fnSetCipherKey(pAdapter, keyIdx, CIPHER_AES, TRUE, ext); - // set 802.1x port control - //pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + /* set 802.1x port control */ + /*pAdapter->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; */ STA_PORT_SECURED(pAdapter); pAdapter->IndicateMediaState = NdisMediaStateConnected; @@ -2142,7 +2142,7 @@ int rt_ioctl_giwgenie(struct net_device *dev, } else { UCHAR RSNIe = IE_WPA; - if (wrqu->data.length < (pAd->StaCfg.RSNIE_Len + 2)) // ID, Len + if (wrqu->data.length < (pAd->StaCfg.RSNIE_Len + 2)) /* ID, Len */ return -E2BIG; wrqu->data.length = pAd->StaCfg.RSNIE_Len + 2; @@ -2183,7 +2183,7 @@ int rt_ioctl_siwpmksa(struct net_device *dev, case IW_PMKSA_REMOVE: for (CachedIdx = 0; CachedIdx < pAd->StaCfg.SavedPMKNum; CachedIdx++) { - // compare the BSSID + /* compare the BSSID */ if (NdisEqualMemory (pPmksa->bssid.sa_data, pAd->StaCfg.SavedPMK[CachedIdx].BSSID, @@ -2219,7 +2219,7 @@ int rt_ioctl_siwpmksa(struct net_device *dev, case IW_PMKSA_ADD: for (CachedIdx = 0; CachedIdx < pAd->StaCfg.SavedPMKNum; CachedIdx++) { - // compare the BSSID + /* compare the BSSID */ if (NdisEqualMemory (pPmksa->bssid.sa_data, pAd->StaCfg.SavedPMK[CachedIdx].BSSID, @@ -2227,7 +2227,7 @@ int rt_ioctl_siwpmksa(struct net_device *dev, break; } - // Found, replace it + /* Found, replace it */ if (CachedIdx < PMKID_NO) { DBGPRINT(RT_DEBUG_OFF, ("Update PMKID, idx = %d\n", CachedIdx)); @@ -2238,9 +2238,9 @@ int rt_ioctl_siwpmksa(struct net_device *dev, PMKID[0], pPmksa->pmkid, 16); pAd->StaCfg.SavedPMKNum++; } - // Not found, replace the last one + /* Not found, replace the last one */ else { - // Randomly replace one + /* Randomly replace one */ CachedIdx = (pPmksa->bssid.sa_data[5] % PMKID_NO); DBGPRINT(RT_DEBUG_OFF, ("Update PMKID, idx = %d\n", CachedIdx)); @@ -2272,7 +2272,7 @@ int rt_ioctl_siwrate(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAd, dev); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("rt_ioctl_siwrate::Network is down!\n")); @@ -2285,7 +2285,7 @@ int rt_ioctl_siwrate(struct net_device *dev, rate = X, fixed = 1 => (fixed rate X) */ if (rate == -1) { - //Auto Rate + /*Auto Rate */ pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; pAd->StaCfg.bAutoTxRateSwitch = TRUE; if ((pAd->CommonCfg.PhyMode <= PHY_11G) || @@ -2311,7 +2311,7 @@ int rt_ioctl_siwrate(struct net_device *dev, pAd->StaCfg.DesiredTransmitSetting.field. MCS)); } else { - // TODO: rate = X, fixed = 0 => (rates <= X) + /* TODO: rate = X, fixed = 0 => (rates <= X) */ return -EOPNOTSUPP; } } @@ -2342,7 +2342,7 @@ int rt_ioctl_giwrate(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAd, dev); rate_count = sizeof(ralinkrate) / sizeof(__s32); - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); return -ENETDOWN; @@ -2359,7 +2359,7 @@ int rt_ioctl_giwrate(struct net_device *dev, pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word; if (ht_setting.field.MODE >= MODE_HTMIX) { -// rate_index = 12 + ((UCHAR)ht_setting.field.BW *16) + ((UCHAR)ht_setting.field.ShortGI *32) + ((UCHAR)ht_setting.field.MCS); +/* rate_index = 12 + ((UCHAR)ht_setting.field.BW *16) + ((UCHAR)ht_setting.field.ShortGI *32) + ((UCHAR)ht_setting.field.MCS); */ rate_index = 12 + ((UCHAR) ht_setting.field.BW * 24) + ((UCHAR) ht_setting.field.ShortGI * 48) + @@ -2460,7 +2460,7 @@ INT rt28xx_sta_ioctl(IN struct net_device *net_dev, pObj = (POS_COOKIE) pAd->OS_Cookie; - //check if the interface is down + /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { { DBGPRINT(RT_DEBUG_TRACE, ("INFO::Network is down!\n")); @@ -2468,7 +2468,7 @@ INT rt28xx_sta_ioctl(IN struct net_device *net_dev, } } - { // determine this ioctl command is comming from which interface. + { /* determine this ioctl command is comming from which interface. */ pObj->ioctl_if_type = INT_MAIN; pObj->ioctl_if = MAIN_MBSSID; } @@ -2484,41 +2484,41 @@ INT rt28xx_sta_ioctl(IN struct net_device *net_dev, rt_ioctl_giwname(net_dev, NULL, name, NULL); break; } - case SIOCGIWESSID: //Get ESSID + case SIOCGIWESSID: /*Get ESSID */ { struct iw_point *essid = &wrq->u.essid; rt_ioctl_giwessid(net_dev, NULL, essid, essid->pointer); break; } - case SIOCSIWESSID: //Set ESSID + case SIOCSIWESSID: /*Set ESSID */ { struct iw_point *essid = &wrq->u.essid; rt_ioctl_siwessid(net_dev, NULL, essid, essid->pointer); break; } - case SIOCSIWNWID: // set network id (the cell) - case SIOCGIWNWID: // get network id + case SIOCSIWNWID: /* set network id (the cell) */ + case SIOCGIWNWID: /* get network id */ Status = -EOPNOTSUPP; break; - case SIOCSIWFREQ: //set channel/frequency (Hz) + case SIOCSIWFREQ: /*set channel/frequency (Hz) */ { struct iw_freq *freq = &wrq->u.freq; rt_ioctl_siwfreq(net_dev, NULL, freq, NULL); break; } - case SIOCGIWFREQ: // get channel/frequency (Hz) + case SIOCGIWFREQ: /* get channel/frequency (Hz) */ { struct iw_freq *freq = &wrq->u.freq; rt_ioctl_giwfreq(net_dev, NULL, freq, NULL); break; } - case SIOCSIWNICKN: //set node name/nickname + case SIOCSIWNICKN: /*set node name/nickname */ { - //struct iw_point *data=&wrq->u.data; - //rt_ioctl_siwnickn(net_dev, NULL, data, NULL); + /*struct iw_point *data=&wrq->u.data; */ + /*rt_ioctl_siwnickn(net_dev, NULL, data, NULL); */ break; } - case SIOCGIWNICKN: //get node name/nickname + case SIOCGIWNICKN: /*get node name/nickname */ { struct iw_point *erq = NULL; erq = &wrq->u.data; @@ -2528,37 +2528,37 @@ INT rt28xx_sta_ioctl(IN struct net_device *net_dev, erq->length); break; } - case SIOCGIWRATE: //get default bit rate (bps) + case SIOCGIWRATE: /*get default bit rate (bps) */ rt_ioctl_giwrate(net_dev, NULL, &wrq->u, NULL); break; - case SIOCSIWRATE: //set default bit rate (bps) + case SIOCSIWRATE: /*set default bit rate (bps) */ rt_ioctl_siwrate(net_dev, NULL, &wrq->u, NULL); break; - case SIOCGIWRTS: // get RTS/CTS threshold (bytes) + case SIOCGIWRTS: /* get RTS/CTS threshold (bytes) */ { struct iw_param *rts = &wrq->u.rts; rt_ioctl_giwrts(net_dev, NULL, rts, NULL); break; } - case SIOCSIWRTS: //set RTS/CTS threshold (bytes) + case SIOCSIWRTS: /*set RTS/CTS threshold (bytes) */ { struct iw_param *rts = &wrq->u.rts; rt_ioctl_siwrts(net_dev, NULL, rts, NULL); break; } - case SIOCGIWFRAG: //get fragmentation thr (bytes) + case SIOCGIWFRAG: /*get fragmentation thr (bytes) */ { struct iw_param *frag = &wrq->u.frag; rt_ioctl_giwfrag(net_dev, NULL, frag, NULL); break; } - case SIOCSIWFRAG: //set fragmentation thr (bytes) + case SIOCSIWFRAG: /*set fragmentation thr (bytes) */ { struct iw_param *frag = &wrq->u.frag; rt_ioctl_siwfrag(net_dev, NULL, frag, NULL); break; } - case SIOCGIWENCODE: //get encoding token & mode + case SIOCGIWENCODE: /*get encoding token & mode */ { struct iw_point *erq = &wrq->u.encoding; if (erq) @@ -2566,7 +2566,7 @@ INT rt28xx_sta_ioctl(IN struct net_device *net_dev, erq->pointer); break; } - case SIOCSIWENCODE: //set encoding token & mode + case SIOCSIWENCODE: /*set encoding token & mode */ { struct iw_point *erq = &wrq->u.encoding; if (erq) @@ -2574,41 +2574,41 @@ INT rt28xx_sta_ioctl(IN struct net_device *net_dev, erq->pointer); break; } - case SIOCGIWAP: //get access point MAC addresses + case SIOCGIWAP: /*get access point MAC addresses */ { struct sockaddr *ap_addr = &wrq->u.ap_addr; rt_ioctl_giwap(net_dev, NULL, ap_addr, ap_addr->sa_data); break; } - case SIOCSIWAP: //set access point MAC addresses + case SIOCSIWAP: /*set access point MAC addresses */ { struct sockaddr *ap_addr = &wrq->u.ap_addr; rt_ioctl_siwap(net_dev, NULL, ap_addr, ap_addr->sa_data); break; } - case SIOCGIWMODE: //get operation mode + case SIOCGIWMODE: /*get operation mode */ { __u32 *mode = &wrq->u.mode; rt_ioctl_giwmode(net_dev, NULL, mode, NULL); break; } - case SIOCSIWMODE: //set operation mode + case SIOCSIWMODE: /*set operation mode */ { __u32 *mode = &wrq->u.mode; rt_ioctl_siwmode(net_dev, NULL, mode, NULL); break; } - case SIOCGIWSENS: //get sensitivity (dBm) - case SIOCSIWSENS: //set sensitivity (dBm) - case SIOCGIWPOWER: //get Power Management settings - case SIOCSIWPOWER: //set Power Management settings - case SIOCGIWTXPOW: //get transmit power (dBm) - case SIOCSIWTXPOW: //set transmit power (dBm) - case SIOCGIWRANGE: //Get range of parameters - case SIOCGIWRETRY: //get retry limits and lifetime - case SIOCSIWRETRY: //set retry limits and lifetime + case SIOCGIWSENS: /*get sensitivity (dBm) */ + case SIOCSIWSENS: /*set sensitivity (dBm) */ + case SIOCGIWPOWER: /*get Power Management settings */ + case SIOCSIWPOWER: /*set Power Management settings */ + case SIOCGIWTXPOW: /*get transmit power (dBm) */ + case SIOCSIWTXPOW: /*set transmit power (dBm) */ + case SIOCGIWRANGE: /*Get range of parameters */ + case SIOCGIWRETRY: /*get retry limits and lifetime */ + case SIOCSIWRETRY: /*set retry limits and lifetime */ case RT_PRIV_IOCTL: case RT_PRIV_IOCTL_EXT: case RTPRIV_IOCTL_SET: @@ -2625,7 +2625,7 @@ INT rt28xx_sta_ioctl(IN struct net_device *net_dev, break; } - if (StateMachineTouched) // Upper layer sent a MLME-related operations + if (StateMachineTouched) /* Upper layer sent a MLME-related operations */ RTMP_MLME_HANDLER(pAd); return Status; @@ -2650,7 +2650,7 @@ INT Set_SSID_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) if (strlen(arg) != 0) { NdisMoveMemory(Ssid.Ssid, arg, strlen(arg)); Ssid.SsidLength = strlen(arg); - } else //ANY ssid + } else /*ANY ssid */ { Ssid.SsidLength = 0; memcpy(Ssid.Ssid, "", 0); @@ -2704,7 +2704,7 @@ INT Set_SSID_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) } else success = FALSE; - if (StateMachineTouched) // Upper layer sent a MLME-related operations + if (StateMachineTouched) /* Upper layer sent a MLME-related operations */ RTMP_MLME_HANDLER(pAdapter); return success; @@ -2724,7 +2724,7 @@ INT Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) if (strcmp(arg, "Adhoc") == 0) { if (pAdapter->StaCfg.BssType != BSS_ADHOC) { - // Config has changed + /* Config has changed */ pAdapter->bConfigChanged = TRUE; if (MONITOR_ON(pAdapter)) { RTMP_IO_WRITE32(pAdapter, RX_FILTR_CFG, @@ -2738,9 +2738,9 @@ INT Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) LinkDown(pAdapter, FALSE); } if (INFRA_ON(pAdapter)) { - //BOOLEAN Cancelled; - // Set the AutoReconnectSsid to prevent it reconnect to old SSID - // Since calling this indicate user don't want to connect to that SSID anymore. + /*BOOLEAN Cancelled; */ + /* Set the AutoReconnectSsid to prevent it reconnect to old SSID */ + /* Since calling this indicate user don't want to connect to that SSID anymore. */ pAdapter->MlmeAux.AutoReconnectSsidLen = 32; NdisZeroMemory(pAdapter->MlmeAux. AutoReconnectSsid, @@ -2759,7 +2759,7 @@ INT Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) ("===>Set_NetworkType_Proc::(AD-HOC)\n")); } else if (strcmp(arg, "Infra") == 0) { if (pAdapter->StaCfg.BssType != BSS_INFRA) { - // Config has changed + /* Config has changed */ pAdapter->bConfigChanged = TRUE; if (MONITOR_ON(pAdapter)) { RTMP_IO_WRITE32(pAdapter, RX_FILTR_CFG, @@ -2773,8 +2773,8 @@ INT Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) LinkDown(pAdapter, FALSE); } if (ADHOC_ON(pAdapter)) { - // Set the AutoReconnectSsid to prevent it reconnect to old SSID - // Since calling this indicate user don't want to connect to that SSID anymore. + /* Set the AutoReconnectSsid to prevent it reconnect to old SSID */ + /* Since calling this indicate user don't want to connect to that SSID anymore. */ pAdapter->MlmeAux.AutoReconnectSsidLen = 32; NdisZeroMemory(pAdapter->MlmeAux. AutoReconnectSsid, @@ -2794,9 +2794,9 @@ INT Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) OPSTATUS_CLEAR_FLAG(pAdapter, fOP_STATUS_INFRA_ON); OPSTATUS_CLEAR_FLAG(pAdapter, fOP_STATUS_ADHOC_ON); OPSTATUS_SET_FLAG(pAdapter, fOP_STATUS_MEDIA_STATE_CONNECTED); - // disable all periodic state machine + /* disable all periodic state machine */ pAdapter->StaCfg.bAutoReconnect = FALSE; - // reset all mlme state machine + /* reset all mlme state machine */ RTMP_MLME_RESET_STATE_MACHINE(pAdapter); DBGPRINT(RT_DEBUG_TRACE, ("fOP_STATUS_MEDIA_STATE_CONNECTED \n")); @@ -2812,7 +2812,7 @@ INT Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) pAdapter->CommonCfg.RegTransmitSetting.field.BW == BW_40 && pAdapter->CommonCfg.RegTransmitSetting.field.EXTCHA == EXTCHA_ABOVE) { - // 40MHz ,control channel at lower + /* 40MHz ,control channel at lower */ RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R4, &bbpValue); bbpValue &= (~0x18); @@ -2820,7 +2820,7 @@ INT Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) RTMP_BBP_IO_WRITE8_BY_REG_ID(pAdapter, BBP_R4, bbpValue); pAdapter->CommonCfg.BBPCurrentBW = BW_40; - // RX : control channel at lower + /* RX : control channel at lower */ RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R3, &bbpValue); bbpValue &= (~0x20); @@ -2846,7 +2846,7 @@ INT Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) BW_40 && pAdapter->CommonCfg.RegTransmitSetting.field. EXTCHA == EXTCHA_BELOW) { - // 40MHz ,control channel at upper + /* 40MHz ,control channel at upper */ RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R4, &bbpValue); bbpValue &= (~0x18); @@ -2875,7 +2875,7 @@ INT Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) pAdapter->CommonCfg.Channel, pAdapter->CommonCfg.CentralChannel)); } else { - // 20MHz + /* 20MHz */ RTMP_BBP_IO_READ8_BY_REG_ID(pAdapter, BBP_R4, &bbpValue); bbpValue &= (~0x18); @@ -2889,13 +2889,13 @@ INT Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) ("BW_20, Channel(%d)\n", pAdapter->CommonCfg.Channel)); } - // Enable Rx with promiscuous reception + /* Enable Rx with promiscuous reception */ RTMP_IO_WRITE32(pAdapter, RX_FILTR_CFG, 0x3); - // ASIC supporsts sniffer function with replacing RSSI with timestamp. - //RTMP_IO_READ32(pAdapter, MAC_SYS_CTRL, &Value); - //Value |= (0x80); - //RTMP_IO_WRITE32(pAdapter, MAC_SYS_CTRL, Value); - // disable sync + /* ASIC supporsts sniffer function with replacing RSSI with timestamp. */ + /*RTMP_IO_READ32(pAdapter, MAC_SYS_CTRL, &Value); */ + /*Value |= (0x80); */ + /*RTMP_IO_WRITE32(pAdapter, MAC_SYS_CTRL, Value); */ + /* disable sync */ RTMP_IO_READ32(pAdapter, BCN_TIME_CFG, &csr.word); csr.field.bBeaconGen = 0; csr.field.bTBTTEnable = 0; @@ -2903,11 +2903,11 @@ INT Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) RTMP_IO_WRITE32(pAdapter, BCN_TIME_CFG, csr.word); pAdapter->StaCfg.BssType = BSS_MONITOR; - pAdapter->net_dev->type = ARPHRD_IEEE80211_PRISM; //ARPHRD_IEEE80211; // IEEE80211 + pAdapter->net_dev->type = ARPHRD_IEEE80211_PRISM; /*ARPHRD_IEEE80211; // IEEE80211 */ DBGPRINT(RT_DEBUG_TRACE, ("===>Set_NetworkType_Proc::(MONITOR)\n")); } - // Reset Ralink supplicant to not use, it will be set to start when UI set PMK key + /* Reset Ralink supplicant to not use, it will be set to start when UI set PMK key */ pAdapter->StaCfg.WpaState = SS_NOTUSE; DBGPRINT(RT_DEBUG_TRACE, diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c index ebc22616d1ed..74529d11602c 100644 --- a/drivers/staging/rt2860/usb_main_dev.c +++ b/drivers/staging/rt2860/usb_main_dev.c @@ -26,9 +26,9 @@ #include "rt_config.h" -// Following information will be show when you run 'modinfo' -// *** If you have a solution for the bug in current version of driver, please mail to me. -// Otherwise post to forum in ralinktech's web site(www.ralinktech.com) and let all users help you. *** +/* Following information will be show when you run 'modinfo' */ +/* *** If you have a solution for the bug in current version of driver, please mail to me. */ +/* Otherwise post to forum in ralinktech's web site(www.ralinktech.com) and let all users help you. *** */ MODULE_AUTHOR("Paul Lin "); MODULE_DESCRIPTION("RT2870/RT3070 Wireless Lan Linux Driver"); MODULE_LICENSE("GPL"); @@ -101,7 +101,7 @@ struct usb_device_id rtusb_usb_id[] = { {USB_DEVICE(0x1737, 0x0071)}, /* Linksys WUSB600N */ {USB_DEVICE(0x0411, 0x00e8)}, /* Buffalo WLI-UC-G300N */ {USB_DEVICE(0x050d, 0x815c)}, /* Belkin F5D8053 */ -#endif // RT2870 // +#endif /* RT2870 // */ #ifdef RT3070 {USB_DEVICE(0x148F, 0x3070)}, /* Ralink 3070 */ {USB_DEVICE(0x148F, 0x3071)}, /* Ralink 3071 */ @@ -134,7 +134,7 @@ struct usb_device_id rtusb_usb_id[] = { {USB_DEVICE(0x5A57, 0x0283)}, /* Zinwell 3072 */ {USB_DEVICE(0x04BB, 0x0945)}, /* I-O DATA 3072 */ {USB_DEVICE(0x203D, 0x1480)}, /* Encore 3070 */ -#endif // RT3070 // +#endif /* RT3070 // */ {USB_DEVICE(0x0DF6, 0x003F)}, /* Sitecom WL-608 */ {USB_DEVICE(0x1737, 0x0077)}, /* Linksys WUSB54GC-EU v3 */ {USB_DEVICE(0x2001, 0x3C09)}, /* D-Link */ @@ -207,14 +207,14 @@ BOOLEAN RT28XXChipsetCheck(IN void *_dev_p) /**************************************************************************/ /**************************************************************************/ -//tested for kernel 2.6series +/*tested for kernel 2.6series */ /**************************************************************************/ /**************************************************************************/ #ifdef CONFIG_PM static int rt2870_suspend(struct usb_interface *intf, pm_message_t state); static int rt2870_resume(struct usb_interface *intf); -#endif // CONFIG_PM // +#endif /* CONFIG_PM // */ static int rtusb_probe(struct usb_interface *intf, const struct usb_device_id *id); @@ -264,8 +264,8 @@ static BOOLEAN USBDevConfigInit(IN struct usb_device *dev, ((iface_desc->endpoint[i].desc. bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT)) { - // there are 6 bulk out EP. EP6 highest priority. - // EP1-4 is EDCA. EP5 is HCCA. + /* there are 6 bulk out EP. EP6 highest priority. */ + /* EP1-4 is EDCA. EP5 is HCCA. */ pAd->BulkOutEpAddr[BulkOutIdx++] = iface_desc->endpoint[i].desc.bEndpointAddress; pAd->BulkOutMaxPacketSize = @@ -340,8 +340,8 @@ resume:rt2870_resume, VOID RT2870RejectPendingPackets(IN PRTMP_ADAPTER pAd) { - // clear PS packets - // clear TxSw packets + /* clear PS packets */ + /* clear TxSw packets */ } static int rt2870_suspend(struct usb_interface *intf, pm_message_t state) @@ -379,16 +379,16 @@ static int rt2870_resume(struct usb_interface *intf) DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2870_resume()\n")); return 0; } -#endif // CONFIG_PM // +#endif /* CONFIG_PM // */ -// Init driver module +/* Init driver module */ INT __init rtusb_init(void) { printk("rtusb init --->\n"); return usb_register(&rtusb_driver); } -// Deinit driver module +/* Deinit driver module */ VOID __exit rtusb_exit(void) { usb_deregister(&rtusb_driver); @@ -442,7 +442,7 @@ INT MlmeThread(IN void *Context) #endif /* lock the device pointers , need to check if required */ - //down(&(pAd->usbdev_semaphore)); + /*down(&(pAd->usbdev_semaphore)); */ if (!pAd->PM_FlgSuspend) MlmeHandler(pAd); @@ -521,7 +521,7 @@ INT RTUSBCmdThread(IN void *Context) CMDHandler(pAd); } - if (pAd && !pAd->PM_FlgSuspend) { // Clear the CmdQElements. + if (pAd && !pAd->PM_FlgSuspend) { /* Clear the CmdQElements. */ CmdQElmt *pCmdQElmt = NULL; NdisAcquireSpinLock(&pAd->CmdQLock); @@ -633,10 +633,10 @@ VOID RTUSBWatchDog(IN RTMP_ADAPTER * pAd) fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_BULKOUT_RESET))) ) { - // FIXME: Following code just support single bulk out. If you wanna support multiple bulk out. Modify it! + /* FIXME: Following code just support single bulk out. If you wanna support multiple bulk out. Modify it! */ pHTTXContext = (PHT_TX_CONTEXT) (&pAd->TxContext[idx]); - if (pHTTXContext->IRPPending) { // Check TxContext. + if (pHTTXContext->IRPPending) { /* Check TxContext. */ pUrb = pHTTXContext->pUrb; actual_length = pUrb->actual_length; @@ -647,7 +647,7 @@ VOID RTUSBWatchDog(IN RTMP_ADAPTER * pAd) PTX_CONTEXT pMLMEContext, pNULLContext, pPsPollContext; - //Check MgmtContext. + /*Check MgmtContext. */ pMLMEContext = (PTX_CONTEXT) (pAd->MgmtRing. Cell[pAd->MgmtRing. @@ -688,7 +688,7 @@ VOID RTUSBWatchDog(IN RTMP_ADAPTER * pAd) && pAd->TransferedLength[idx] < transfer_buffer_length && actual_length != 0 -// && TxRxQ_Pcnt==0 +/* && TxRxQ_Pcnt==0 */ && pAd->watchDogTxPendingCnt[idx] > 3) || isDataPacket == FALSE @@ -699,10 +699,10 @@ VOID RTUSBWatchDog(IN RTMP_ADAPTER * pAd) idx)); DBGPRINT(RT_DEBUG_TRACE, ("Unlink the pending URB!\n")); - // unlink it now + /* unlink it now */ RTUSB_UNLINK_URB(pUrb); - // Sleep 200 microseconds to give cancellation time to work - //RTMPusecDelay(200); + /* Sleep 200 microseconds to give cancellation time to work */ + /*RTMPusecDelay(200); */ needDumpSeq = TRUE; } } else { @@ -721,7 +721,7 @@ VOID RTUSBWatchDog(IN RTMP_ADAPTER * pAd) } } - // For Sigma debug, dump the ba_reordering sequence. + /* For Sigma debug, dump the ba_reordering sequence. */ if ((needDumpSeq == TRUE) && (pAd->CommonCfg.bDisableReordering == 0)) { USHORT Idx; PBA_REC_ENTRY pBAEntry = NULL; @@ -780,22 +780,22 @@ static void rt2870_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd) } RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST); - // for debug, wait to show some messages to /proc system + /* for debug, wait to show some messages to /proc system */ udelay(1); RtmpPhyNetDevExit(pAd, pAd->net_dev); - // FIXME: Shall we need following delay and flush the schedule?? + /* FIXME: Shall we need following delay and flush the schedule?? */ udelay(1); flush_scheduled_work(); udelay(1); - // free the root net_device + /* free the root net_device */ RtmpOSNetDevFree(pAd->net_dev); RtmpRaDevCtrlExit(pAd); - // release a use of the usb device structure + /* release a use of the usb device structure */ usb_put_dev(dev); udelay(1); @@ -815,12 +815,12 @@ static int __devinit rt2870_probe(IN struct usb_interface *intf, DBGPRINT(RT_DEBUG_TRACE, ("===>rt2870_probe()!\n")); - // Check chipset vendor/product ID - //if (RT28XXChipsetCheck(_dev_p) == FALSE) - // goto err_out; + /* Check chipset vendor/product ID */ + /*if (RT28XXChipsetCheck(_dev_p) == FALSE) */ + /* goto err_out; */ -//RtmpDevInit============================================= - // Allocate RTMP_ADAPTER adapter structure +/*RtmpDevInit============================================= */ + /* Allocate RTMP_ADAPTER adapter structure */ handle = kmalloc(sizeof(struct os_cookie), GFP_KERNEL); if (handle == NULL) { printk @@ -834,18 +834,18 @@ static int __devinit rt2870_probe(IN struct usb_interface *intf, kfree(handle); goto err_out; } -//USBDevInit============================================== +/*USBDevInit============================================== */ if (USBDevConfigInit(usb_dev, intf, pAd) == FALSE) goto err_out_free_radev; RtmpRaDevCtrlInit(pAd, RTMP_DEV_INF_USB); -//NetDevInit============================================== +/*NetDevInit============================================== */ net_dev = RtmpPhyNetDevInit(pAd, &netDevHook); if (net_dev == NULL) goto err_out_free_radev; - // Here are the net_device structure with usb specific parameters. + /* Here are the net_device structure with usb specific parameters. */ /* for supporting Network Manager. * Set the sysfs physical device reference for the network logical device if set prior to registration will * cause a symlink during initialization. @@ -854,8 +854,8 @@ static int __devinit rt2870_probe(IN struct usb_interface *intf, pAd->StaCfg.OriDevType = net_dev->type; -//All done, it's time to register the net device to linux kernel. - // Register this device +/*All done, it's time to register the net device to linux kernel. */ + /* Register this device */ status = RtmpOSNetDevAttach(net_dev, &netDevHook); if (status != 0) goto err_out_free_netdev; diff --git a/drivers/staging/rt2870/common/rtusb_bulk.c b/drivers/staging/rt2870/common/rtusb_bulk.c index 269dedc7c066..a45f64810dce 100644 --- a/drivers/staging/rt2870/common/rtusb_bulk.c +++ b/drivers/staging/rt2870/common/rtusb_bulk.c @@ -40,11 +40,11 @@ #ifdef RTMP_MAC_USB #include "../rt_config.h" -// Match total 6 bulkout endpoint to corresponding queue. +/* Match total 6 bulkout endpoint to corresponding queue. */ UCHAR EpToQueue[6] = { FIFO_EDCA, FIFO_EDCA, FIFO_EDCA, FIFO_EDCA, FIFO_EDCA, FIFO_MGMT }; -//static BOOLEAN SingleBulkOut = FALSE; +/*static BOOLEAN SingleBulkOut = FALSE; */ void RTUSB_FILL_BULK_URB(struct urb *pUrb, struct usb_device *pUsb_Dev, @@ -69,7 +69,7 @@ VOID RTUSBInitTxDesc(IN PRTMP_ADAPTER pAd, pUrb = pTxContext->pUrb; ASSERT(pUrb); - // Store BulkOut PipeId + /* Store BulkOut PipeId */ pTxContext->BulkOutPipeId = BulkOutPipeId; if (pTxContext->bAggregatible) { @@ -79,7 +79,7 @@ VOID RTUSBInitTxDesc(IN PRTMP_ADAPTER pAd, (PUCHAR) pTxContext->TransferBuffer->field.WirelessPacket; } - //Initialize a tx bulk urb + /*Initialize a tx bulk urb */ RTUSB_FILL_BULK_URB(pUrb, pObj->pUsb_Dev, usb_sndbulkpipe(pObj->pUsb_Dev, @@ -108,14 +108,14 @@ VOID RTUSBInitHTTxDesc(IN PRTMP_ADAPTER pAd, pUrb = pTxContext->pUrb; ASSERT(pUrb); - // Store BulkOut PipeId + /* Store BulkOut PipeId */ pTxContext->BulkOutPipeId = BulkOutPipeId; pSrc = &pTxContext->TransferBuffer->field.WirelessPacket[pTxContext-> NextBulkOutPosition]; - //Initialize a tx bulk urb + /*Initialize a tx bulk urb */ RTUSB_FILL_BULK_URB(pUrb, pObj->pUsb_Dev, usb_sndbulkpipe(pObj->pUsb_Dev, @@ -142,7 +142,7 @@ VOID RTUSBInitRxDesc(IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext) else RX_bulk_size = MAX_RXBULK_SIZE; - //Initialize a rx bulk urb + /*Initialize a rx bulk urb */ RTUSB_FILL_BULK_URB(pUrb, pObj->pUsb_Dev, usb_rcvbulkpipe(pObj->pUsb_Dev, pAd->BulkInEpAddr), @@ -223,7 +223,7 @@ VOID RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, BULK_OUT_LOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); pAd->BulkOutPending[BulkOutPipeId] = FALSE; - // Clear Data flag + /* Clear Data flag */ RTUSB_CLEAR_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_FRAG << BulkOutPipeId)); @@ -234,15 +234,15 @@ VOID RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, BULK_OUT_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); return; } - // Clear Data flag + /* Clear Data flag */ RTUSB_CLEAR_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_FRAG << BulkOutPipeId)); RTUSB_CLEAR_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId)); - //DBGPRINT(RT_DEBUG_TRACE,("BulkOut-B:I=0x%lx, CWPos=%ld, CWRPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", in_interrupt(), - // pHTTXContext->CurWritePosition, pHTTXContext->CurWriteRealPos, pHTTXContext->NextBulkOutPosition, - // pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad)); + /*DBGPRINT(RT_DEBUG_TRACE,("BulkOut-B:I=0x%lx, CWPos=%ld, CWRPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", in_interrupt(), */ + /* pHTTXContext->CurWritePosition, pHTTXContext->CurWriteRealPos, pHTTXContext->NextBulkOutPosition, */ + /* pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad)); */ pHTTXContext->NextBulkOutPosition = pHTTXContext->ENextBulkOutPosition; ThisBulkSize = 0; TmpBulkEndPos = pHTTXContext->NextBulkOutPosition; @@ -282,12 +282,12 @@ VOID RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, ("RTUSBBulkOutDataPacket AMPDU = %d.\n", pTxWI->AMPDU)); - // add by Iverson, limit BulkOut size to 4k to pass WMM b mode 2T1R test items - //if ((ThisBulkSize != 0) && (pTxWI->AMPDU == 0)) + /* add by Iverson, limit BulkOut size to 4k to pass WMM b mode 2T1R test items */ + /*if ((ThisBulkSize != 0) && (pTxWI->AMPDU == 0)) */ if ((ThisBulkSize != 0) && (pTxWI->PHYMODE == MODE_CCK)) { if (((ThisBulkSize & 0xffff8000) != 0) || ((ThisBulkSize & 0x1000) == 0x1000)) { - // Limit BulkOut size to about 4k bytes. + /* Limit BulkOut size to about 4k bytes. */ pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos; break; @@ -297,21 +297,21 @@ VOID RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, 0)) /*|| ( (ThisBulkSize != 0) && (pTxWI->AMPDU == 0)) */ ) { - // For USB 1.1 or peer which didn't support AMPDU, limit the BulkOut size. - // For performence in b/g mode, now just check for USB 1.1 and didn't care about the APMDU or not! 2008/06/04. + /* For USB 1.1 or peer which didn't support AMPDU, limit the BulkOut size. */ + /* For performence in b/g mode, now just check for USB 1.1 and didn't care about the APMDU or not! 2008/06/04. */ pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos; break; } } - // end Iverson + /* end Iverson */ else { - if (((ThisBulkSize & 0xffff8000) != 0) || ((ThisBulkSize & 0x6000) == 0x6000)) { // Limit BulkOut size to about 24k bytes. + if (((ThisBulkSize & 0xffff8000) != 0) || ((ThisBulkSize & 0x6000) == 0x6000)) { /* Limit BulkOut size to about 24k bytes. */ pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos; break; - } else if (((pAd->BulkOutMaxPacketSize < 512) && ((ThisBulkSize & 0xfffff800) != 0)) /*|| ( (ThisBulkSize != 0) && (pTxWI->AMPDU == 0)) */ ) { // For USB 1.1 or peer which didn't support AMPDU, limit the BulkOut size. - // For performence in b/g mode, now just check for USB 1.1 and didn't care about the APMDU or not! 2008/06/04. + } else if (((pAd->BulkOutMaxPacketSize < 512) && ((ThisBulkSize & 0xfffff800) != 0)) /*|| ( (ThisBulkSize != 0) && (pTxWI->AMPDU == 0)) */ ) { /* For USB 1.1 or peer which didn't support AMPDU, limit the BulkOut size. */ + /* For performence in b/g mode, now just check for USB 1.1 and didn't care about the APMDU or not! 2008/06/04. */ pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos; break; @@ -368,10 +368,10 @@ VOID RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, pAd->BulkOutPending[BulkOutPipeId] = FALSE; BULK_OUT_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); - //DBGPRINT(RT_DEBUG_LOUD,("Out:pTxInfo->USBDMATxPktLen=%d!\n", pTxInfo->USBDMATxPktLen)); + /*DBGPRINT(RT_DEBUG_LOUD,("Out:pTxInfo->USBDMATxPktLen=%d!\n", pTxInfo->USBDMATxPktLen)); */ return; } - // Increase Total transmit byte counter + /* Increase Total transmit byte counter */ pAd->RalinkCounters.OneSecTransmittedByteCount += pTxWI->MPDUtotalByteCount; pAd->RalinkCounters.TransmittedByteCount += @@ -379,7 +379,7 @@ VOID RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, pLastTxInfo = pTxInfo; - // Make sure we use EDCA QUEUE. + /* Make sure we use EDCA QUEUE. */ pTxInfo->QSEL = FIFO_EDCA; ThisBulkSize += (pTxInfo->USBDMATxPktLen + 4); TmpBulkEndPos += (pTxInfo->USBDMATxPktLen + 4); @@ -400,7 +400,7 @@ VOID RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, } while (TRUE); - // adjust the pTxInfo->USBDMANextVLD value of last pTxInfo. + /* adjust the pTxInfo->USBDMANextVLD value of last pTxInfo. */ if (pLastTxInfo) { pLastTxInfo->USBDMANextVLD = 0; } @@ -446,7 +446,7 @@ VOID RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, pBuf[0], pBuf[1], pBuf[2], pBuf[3], pBuf[4], pBuf[5], pBuf[6], pBuf[7])); } - //DBGPRINT(RT_DEBUG_LOUD,("ENPos==CWPos=%ld, CWRPos=%ld, bCSPad=%d!\n", pHTTXContext->CurWritePosition, pHTTXContext->CurWriteRealPos, pHTTXContext->bCopySavePad)); + /*DBGPRINT(RT_DEBUG_LOUD,("ENPos==CWPos=%ld, CWRPos=%ld, bCSPad=%d!\n", pHTTXContext->CurWritePosition, pHTTXContext->CurWriteRealPos, pHTTXContext->bCopySavePad)); */ } if (pAd->bForcePrintTX == TRUE) @@ -456,9 +456,9 @@ VOID RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad)); - //DBGPRINT(RT_DEBUG_LOUD,("BulkOut-A:Size=%ld, CWPos=%ld, CWRPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d, bLRound=%d!\n", ThisBulkSize, pHTTXContext->CurWritePosition, pHTTXContext->CurWriteRealPos, pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad, bTxQLastRound)); + /*DBGPRINT(RT_DEBUG_LOUD,("BulkOut-A:Size=%ld, CWPos=%ld, CWRPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d, bLRound=%d!\n", ThisBulkSize, pHTTXContext->CurWritePosition, pHTTXContext->CurWriteRealPos, pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad, bTxQLastRound)); */ - // USB DMA engine requires to pad extra 4 bytes. This pad doesn't count into real bulkoutsize. + /* USB DMA engine requires to pad extra 4 bytes. This pad doesn't count into real bulkoutsize. */ pAppendant = &pWirelessPkt[TmpBulkEndPos]; NdisZeroMemory(pAppendant, 8); ThisBulkSize += 4; @@ -470,7 +470,7 @@ VOID RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, pAd->watchDogTxPendingCnt[BulkOutPipeId] = 1; BULK_OUT_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags2); - // Init Tx context descriptor + /* Init Tx context descriptor */ RTUSBInitHTTxDesc(pAd, pHTTXContext, BulkOutPipeId, ThisBulkSize, (usb_complete_t) RTUSBBulkOutDataPacketComplete); @@ -506,7 +506,7 @@ VOID RTUSBBulkOutDataPacketComplete(purbb_t pUrb, struct pt_regs * pt_regs) pAd = pHTTXContext->pAd; pObj = (POS_COOKIE) pAd->OS_Cookie; - // Store BulkOut PipeId + /* Store BulkOut PipeId */ BulkOutPipeId = pHTTXContext->BulkOutPipeId; pAd->BulkOutDataOneSecCount++; @@ -562,13 +562,13 @@ VOID RTUSBBulkOutNullFrame(IN PRTMP_ADAPTER pAd) pNullContext->IRPPending = TRUE; RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], IrqFlags); - // Increase Total transmit byte counter + /* Increase Total transmit byte counter */ pAd->RalinkCounters.TransmittedByteCount += pNullContext->BulkOutSize; - // Clear Null frame bulk flag + /* Clear Null frame bulk flag */ RTUSB_CLEAR_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NULL); - // Init Tx context descriptor + /* Init Tx context descriptor */ RTUSBInitTxDesc(pAd, pNullContext, 0, (usb_complete_t) RTUSBBulkOutNullFrameComplete); @@ -588,7 +588,7 @@ VOID RTUSBBulkOutNullFrame(IN PRTMP_ADAPTER pAd) } -// NULL frame use BulkOutPipeId = 0 +/* NULL frame use BulkOutPipeId = 0 */ VOID RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs * pt_regs) { PRTMP_ADAPTER pAd; @@ -633,7 +633,7 @@ VOID RTUSBBulkOutMLMEPacket(IN PRTMP_ADAPTER pAd, IN UCHAR Index) (pMLMEContext->InUse == FALSE) || (pMLMEContext->bWaitingBulkOut == FALSE)) { - // Clear MLME bulk flag + /* Clear MLME bulk flag */ RTUSB_CLEAR_BULK_FLAG(pAd, fRTUSB_BULK_OUT_MLME); return; @@ -652,17 +652,17 @@ VOID RTUSBBulkOutMLMEPacket(IN PRTMP_ADAPTER pAd, IN UCHAR Index) pMLMEContext->bWaitingBulkOut = FALSE; RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags); - // Increase Total transmit byte counter + /* Increase Total transmit byte counter */ pAd->RalinkCounters.TransmittedByteCount += pMLMEContext->BulkOutSize; - // Clear MLME bulk flag + /* Clear MLME bulk flag */ RTUSB_CLEAR_BULK_FLAG(pAd, fRTUSB_BULK_OUT_MLME); - // Init Tx context descriptor + /* Init Tx context descriptor */ RTUSBInitTxDesc(pAd, pMLMEContext, MGMTPIPEIDX, (usb_complete_t) RTUSBBulkOutMLMEPacketComplete); - //For mgmt urb buffer, because we use sk_buff, so we need to notify the USB controller do dma mapping. + /*For mgmt urb buffer, because we use sk_buff, so we need to notify the USB controller do dma mapping. */ pUrb->transfer_dma = 0; pUrb->transfer_flags &= (~URB_NO_TRANSFER_DMA_MAP); @@ -680,8 +680,8 @@ VOID RTUSBBulkOutMLMEPacket(IN PRTMP_ADAPTER pAd, IN UCHAR Index) return; } - //DBGPRINT_RAW(RT_DEBUG_INFO, ("<---RTUSBBulkOutMLMEPacket \n")); -// printk("<---RTUSBBulkOutMLMEPacket,Cpu=%d!, Dma=%d, SwIdx=%d!\n", pAd->MgmtRing.TxCpuIdx, pAd->MgmtRing.TxDmaIdx, pAd->MgmtRing.TxSwFreeIdx); + /*DBGPRINT_RAW(RT_DEBUG_INFO, ("<---RTUSBBulkOutMLMEPacket \n")); */ +/* printk("<---RTUSBBulkOutMLMEPacket,Cpu=%d!, Dma=%d, SwIdx=%d!\n", pAd->MgmtRing.TxCpuIdx, pAd->MgmtRing.TxDmaIdx, pAd->MgmtRing.TxSwFreeIdx); */ } VOID RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs * pt_regs) @@ -692,7 +692,7 @@ VOID RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs * pt_regs) POS_COOKIE pObj; int index; - //DBGPRINT_RAW(RT_DEBUG_INFO, ("--->RTUSBBulkOutMLMEPacketComplete\n")); + /*DBGPRINT_RAW(RT_DEBUG_INFO, ("--->RTUSBBulkOutMLMEPacketComplete\n")); */ pMLMEContext = (PTX_CONTEXT) pUrb->context; pAd = pMLMEContext->pAd; pObj = (POS_COOKIE) pAd->OS_Cookie; @@ -734,10 +734,10 @@ VOID RTUSBBulkOutPsPoll(IN PRTMP_ADAPTER pAd) pPsPollContext->IRPPending = TRUE; RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], IrqFlags); - // Clear PS-Poll bulk flag + /* Clear PS-Poll bulk flag */ RTUSB_CLEAR_BULK_FLAG(pAd, fRTUSB_BULK_OUT_PSPOLL); - // Init Tx context descriptor + /* Init Tx context descriptor */ RTUSBInitTxDesc(pAd, pPsPollContext, MGMTPIPEIDX, (usb_complete_t) RTUSBBulkOutPsPollComplete); @@ -757,7 +757,7 @@ VOID RTUSBBulkOutPsPoll(IN PRTMP_ADAPTER pAd) } -// PS-Poll frame use BulkOutPipeId = 0 +/* PS-Poll frame use BulkOutPipeId = 0 */ VOID RTUSBBulkOutPsPollComplete(purbb_t pUrb, struct pt_regs * pt_regs) { PRTMP_ADAPTER pAd; @@ -794,12 +794,12 @@ VOID DoBulkIn(IN RTMP_ADAPTER * pAd) pAd->BulkInReq++; RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); - // Init Rx context descriptor + /* Init Rx context descriptor */ NdisZeroMemory(pRxContext->TransferBuffer, pRxContext->BulkInOffset); RTUSBInitRxDesc(pAd, pRxContext); pUrb = pRxContext->pUrb; - if ((ret = RTUSB_SUBMIT_URB(pUrb)) != 0) { // fail + if ((ret = RTUSB_SUBMIT_URB(pUrb)) != 0) { /* fail */ RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags); pRxContext->InUse = FALSE; @@ -809,9 +809,9 @@ VOID DoBulkIn(IN RTMP_ADAPTER * pAd) RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); DBGPRINT(RT_DEBUG_ERROR, ("RTUSBBulkReceive: Submit Rx URB failed %d\n", ret)); - } else { // success + } else { /* success */ ASSERT((pRxContext->InUse == pRxContext->IRPPending)); - //printk("BIDone, Pend=%d,BIIdx=%d,BIRIdx=%d!\n", pAd->PendingRx, pAd->NextRxBulkInIndex, pAd->NextRxBulkInReadIndex); + /*printk("BIDone, Pend=%d,BIIdx=%d,BIRIdx=%d!\n", pAd->PendingRx, pAd->NextRxBulkInIndex, pAd->NextRxBulkInReadIndex); */ } } @@ -864,10 +864,10 @@ VOID RTUSBBulkReceive(IN PRTMP_ADAPTER pAd) pRxContext->bRxHandling = TRUE; RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); - // read RxContext, Since not + /* read RxContext, Since not */ STARxDoneInterruptHandle(pAd, TRUE); - // Finish to handle this bulkIn buffer. + /* Finish to handle this bulkIn buffer. */ RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags); pRxContext->BulkInOffset = 0; pRxContext->Readable = FALSE; @@ -914,9 +914,9 @@ VOID RTUSBBulkReceive(IN PRTMP_ADAPTER pAd) */ VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs) { - // use a receive tasklet to handle received packets; - // or sometimes hardware IRQ will be disabled here, so we can not - // use spin_lock_bh()/spin_unlock_bh() after IRQ is disabled. :< + /* use a receive tasklet to handle received packets; */ + /* or sometimes hardware IRQ will be disabled here, so we can not */ + /* use spin_lock_bh()/spin_unlock_bh() after IRQ is disabled. :< */ PRX_CONTEXT pRxContext; PRTMP_ADAPTER pAd; POS_COOKIE pObj; @@ -945,19 +945,19 @@ VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs) */ VOID RTUSBKickBulkOut(IN PRTMP_ADAPTER pAd) { - // BulkIn Reset will reset whole USB PHY. So we need to make sure fRTMP_ADAPTER_BULKIN_RESET not flaged. + /* BulkIn Reset will reset whole USB PHY. So we need to make sure fRTMP_ADAPTER_BULKIN_RESET not flaged. */ if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NEED_STOP_TX) ) { - // 2. PS-Poll frame is next + /* 2. PS-Poll frame is next */ if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_PSPOLL)) { RTUSBBulkOutPsPoll(pAd); } - // 5. Mlme frame is next + /* 5. Mlme frame is next */ else if ((RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_MLME)) || (pAd->MgmtRing.TxSwFreeIdx < MGMT_RING_SIZE)) { RTUSBBulkOutMLMEPacket(pAd, pAd->MgmtRing.TxDmaIdx); } - // 6. Data frame normal is next + /* 6. Data frame normal is next */ if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL)) { if (((!RTMP_TEST_FLAG (pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) @@ -1006,14 +1006,14 @@ VOID RTUSBKickBulkOut(IN PRTMP_ADAPTER pAd) NextBulkOutIndex[3]); } } - // 7. Null frame is the last + /* 7. Null frame is the last */ else if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NULL)) { if (!RTMP_TEST_FLAG (pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) { RTUSBBulkOutNullFrame(pAd); } } - // 8. No data avaliable + /* 8. No data avaliable */ else { } @@ -1116,8 +1116,8 @@ VOID RTUSBCancelPendingBulkInIRP(IN PRTMP_ADAPTER pAd) RTUSB_UNLINK_URB(pRxContext->pUrb); pRxContext->IRPPending = FALSE; pRxContext->InUse = FALSE; - //NdisInterlockedDecrement(&pAd->PendingRx); - //pAd->PendingRx--; + /*NdisInterlockedDecrement(&pAd->PendingRx); */ + /*pAd->PendingRx--; */ } } DBGPRINT_RAW(RT_DEBUG_TRACE, ("<---RTUSBCancelPendingBulkInIRP\n")); @@ -1145,65 +1145,65 @@ VOID RTUSBCancelPendingBulkOutIRP(IN PRTMP_ADAPTER pAd) PTX_CONTEXT pPsPollContext; PTX_CONTEXT pRTSContext; UINT i, Idx; -// unsigned int IrqFlags; -// NDIS_SPIN_LOCK *pLock; -// BOOLEAN *pPending; +/* unsigned int IrqFlags; */ +/* NDIS_SPIN_LOCK *pLock; */ +/* BOOLEAN *pPending; */ -// pLock = &pAd->BulkOutLock[MGMTPIPEIDX]; -// pPending = &pAd->BulkOutPending[MGMTPIPEIDX]; +/* pLock = &pAd->BulkOutLock[MGMTPIPEIDX]; */ +/* pPending = &pAd->BulkOutPending[MGMTPIPEIDX]; */ for (Idx = 0; Idx < 4; Idx++) { pHTTXContext = &(pAd->TxContext[Idx]); if (pHTTXContext->IRPPending == TRUE) { - // Get the USB_CONTEXT and cancel it's IRP; the completion routine will itself - // remove it from the HeadPendingSendList and NULL out HeadPendingSendList - // when the last IRP on the list has been cancelled; that's how we exit this loop - // + /* Get the USB_CONTEXT and cancel it's IRP; the completion routine will itself */ + /* remove it from the HeadPendingSendList and NULL out HeadPendingSendList */ + /* when the last IRP on the list has been cancelled; that's how we exit this loop */ + /* */ RTUSB_UNLINK_URB(pHTTXContext->pUrb); - // Sleep 200 microseconds to give cancellation time to work + /* Sleep 200 microseconds to give cancellation time to work */ RTMPusecDelay(200); } pAd->BulkOutPending[Idx] = FALSE; } - //RTMP_IRQ_LOCK(pLock, IrqFlags); + /*RTMP_IRQ_LOCK(pLock, IrqFlags); */ for (i = 0; i < MGMT_RING_SIZE; i++) { pMLMEContext = (PTX_CONTEXT) pAd->MgmtRing.Cell[i].AllocVa; if (pMLMEContext && (pMLMEContext->IRPPending == TRUE)) { - // Get the USB_CONTEXT and cancel it's IRP; the completion routine will itself - // remove it from the HeadPendingSendList and NULL out HeadPendingSendList - // when the last IRP on the list has been cancelled; that's how we exit this loop - // + /* Get the USB_CONTEXT and cancel it's IRP; the completion routine will itself */ + /* remove it from the HeadPendingSendList and NULL out HeadPendingSendList */ + /* when the last IRP on the list has been cancelled; that's how we exit this loop */ + /* */ RTUSB_UNLINK_URB(pMLMEContext->pUrb); pMLMEContext->IRPPending = FALSE; - // Sleep 200 microsecs to give cancellation time to work + /* Sleep 200 microsecs to give cancellation time to work */ RTMPusecDelay(200); } } pAd->BulkOutPending[MGMTPIPEIDX] = FALSE; - //RTMP_IRQ_UNLOCK(pLock, IrqFlags); + /*RTMP_IRQ_UNLOCK(pLock, IrqFlags); */ for (i = 0; i < BEACON_RING_SIZE; i++) { pBeaconContext = &(pAd->BeaconContext[i]); if (pBeaconContext->IRPPending == TRUE) { - // Get the USB_CONTEXT and cancel it's IRP; the completion routine will itself - // remove it from the HeadPendingSendList and NULL out HeadPendingSendList - // when the last IRP on the list has been cancelled; that's how we exit this loop - // + /* Get the USB_CONTEXT and cancel it's IRP; the completion routine will itself */ + /* remove it from the HeadPendingSendList and NULL out HeadPendingSendList */ + /* when the last IRP on the list has been cancelled; that's how we exit this loop */ + /* */ RTUSB_UNLINK_URB(pBeaconContext->pUrb); - // Sleep 200 microsecs to give cancellation time to work + /* Sleep 200 microsecs to give cancellation time to work */ RTMPusecDelay(200); } } @@ -1227,4 +1227,4 @@ VOID RTUSBCancelPendingBulkOutIRP(IN PRTMP_ADAPTER pAd) } } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ diff --git a/drivers/staging/rt2870/common/rtusb_data.c b/drivers/staging/rt2870/common/rtusb_data.c index d662f7fe6b6b..e6b0afc817f1 100644 --- a/drivers/staging/rt2870/common/rtusb_data.c +++ b/drivers/staging/rt2870/common/rtusb_data.c @@ -41,7 +41,7 @@ #include "../rt_config.h" -extern UCHAR Phy11BGNextRateUpward[]; // defined in mlme.c +extern UCHAR Phy11BGNextRateUpward[]; /* defined in mlme.c */ extern UCHAR EpToQueue[]; VOID REPORT_AMSDU_FRAMES_TO_LLC(IN PRTMP_ADAPTER pAd, @@ -89,8 +89,8 @@ NDIS_STATUS RTUSBFreeDescriptorRequest(IN PRTMP_ADAPTER pAd, IN UCHAR BulkOutPipeId, IN UINT32 NumberRequired) { -// UCHAR FreeNumber = 0; -// UINT Index; +/* UCHAR FreeNumber = 0; */ +/* UINT Index; */ NDIS_STATUS Status = NDIS_STATUS_FAILURE; unsigned long IrqFlags; HT_TX_CONTEXT *pHTTXContext; @@ -251,7 +251,7 @@ VOID RTMPWriteTxInfo(IN PRTMP_ADAPTER pAd, if (QueueSel != FIFO_EDCA) DBGPRINT(RT_DEBUG_TRACE, ("====> QueueSel != FIFO_EDCA<============\n")); - pTxInfo->USBDMANextVLD = FALSE; //NextValid; // Need to check with Jan about this. + pTxInfo->USBDMANextVLD = FALSE; /*NextValid; // Need to check with Jan about this. */ pTxInfo->USBDMATxburst = TxBurst; pTxInfo->WIV = bWiv; pTxInfo->SwUseLastRound = 0; @@ -259,4 +259,4 @@ VOID RTMPWriteTxInfo(IN PRTMP_ADAPTER pAd, pTxInfo->rsv2 = 0; } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ diff --git a/drivers/staging/rt2870/common/rtusb_io.c b/drivers/staging/rt2870/common/rtusb_io.c index 9a32bc859c6b..dd2e0d051934 100644 --- a/drivers/staging/rt2870/common/rtusb_io.c +++ b/drivers/staging/rt2870/common/rtusb_io.c @@ -88,7 +88,7 @@ NTSTATUS RTUSBFirmwareWrite(IN PRTMP_ADAPTER pAd, { UINT32 MacReg; NTSTATUS Status; -// ULONG i; +/* ULONG i; */ USHORT writeLen; Status = RTUSBReadMACRegister(pAd, MAC_CSR0, &MacReg); @@ -100,11 +100,11 @@ NTSTATUS RTUSBFirmwareWrite(IN PRTMP_ADAPTER pAd, Status = RTUSBWriteMACRegister(pAd, 0x701c, 0xffffffff); Status = RTUSBFirmwareRun(pAd); - //2008/11/28:KH add to fix the dead rf frequency offset bug<-- + /*2008/11/28:KH add to fix the dead rf frequency offset bug<-- */ RTMPusecDelay(10000); RTUSBWriteMACRegister(pAd, H2M_MAILBOX_CSR, 0); - AsicSendCommandToMcu(pAd, 0x72, 0x00, 0x00, 0x00); //reset rf by MCU supported by new firmware - //2008/11/28:KH add to fix the dead rf frequency offset bug--> + AsicSendCommandToMcu(pAd, 0x72, 0x00, 0x00, 0x00); /*reset rf by MCU supported by new firmware */ + /*2008/11/28:KH add to fix the dead rf frequency offset bug--> */ return Status; } @@ -171,7 +171,7 @@ NTSTATUS RTUSBMultiWrite_OneByte(IN PRTMP_ADAPTER pAd, { NTSTATUS Status; - // TODO: In 2870, use this funciton carefully cause it's not stable. + /* TODO: In 2870, use this funciton carefully cause it's not stable. */ Status = RTUSB_VendorRequest(pAd, USBD_TRANSFER_DIRECTION_OUT, DEVICE_VENDOR_REQUEST_OUT, @@ -304,7 +304,7 @@ NTSTATUS RTUSBReadBBPRegister(IN PRTMP_ADAPTER pAd, UINT i = 0; NTSTATUS status; - // Verify the busy condition + /* Verify the busy condition */ do { status = RTUSBReadMACRegister(pAd, BBP_CSR_CFG, &BbpCsr.word); if (status >= 0) { @@ -320,16 +320,16 @@ NTSTATUS RTUSBReadBBPRegister(IN PRTMP_ADAPTER pAd, if ((i == RETRY_LIMIT) || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) { - // - // Read failed then Return Default value. - // + /* */ + /* Read failed then Return Default value. */ + /* */ *pValue = pAd->BbpWriteLatch[Id]; DBGPRINT_RAW(RT_DEBUG_ERROR, ("Retry count exhausted or device removed!!!\n")); return STATUS_UNSUCCESSFUL; } - // Prepare for write material + /* Prepare for write material */ BbpCsr.word = 0; BbpCsr.field.fRead = 1; BbpCsr.field.Busy = 1; @@ -337,7 +337,7 @@ NTSTATUS RTUSBReadBBPRegister(IN PRTMP_ADAPTER pAd, RTUSBWriteMACRegister(pAd, BBP_CSR_CFG, BbpCsr.word); i = 0; - // Verify the busy condition + /* Verify the busy condition */ do { status = RTUSBReadMACRegister(pAd, BBP_CSR_CFG, &BbpCsr.word); if (status >= 0) { @@ -355,9 +355,9 @@ NTSTATUS RTUSBReadBBPRegister(IN PRTMP_ADAPTER pAd, if ((i == RETRY_LIMIT) || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) { - // - // Read failed then Return Default value. - // + /* */ + /* Read failed then Return Default value. */ + /* */ *pValue = pAd->BbpWriteLatch[Id]; DBGPRINT_RAW(RT_DEBUG_ERROR, @@ -389,7 +389,7 @@ NTSTATUS RTUSBWriteBBPRegister(IN PRTMP_ADAPTER pAd, BBP_CSR_CFG_STRUC BbpCsr; UINT i = 0; NTSTATUS status; - // Verify the busy condition + /* Verify the busy condition */ do { status = RTUSBReadMACRegister(pAd, BBP_CSR_CFG, &BbpCsr.word); if (status >= 0) { @@ -410,7 +410,7 @@ NTSTATUS RTUSBWriteBBPRegister(IN PRTMP_ADAPTER pAd, ("Retry count exhausted or device removed!!!\n")); return STATUS_UNSUCCESSFUL; } - // Prepare for write material + /* Prepare for write material */ BbpCsr.word = 0; BbpCsr.field.fRead = 0; BbpCsr.field.Value = Value; @@ -561,11 +561,11 @@ VOID RTUSBPutToSleep(IN PRTMP_ADAPTER pAd) { UINT32 value; - // Timeout 0x40 x 50us + /* Timeout 0x40 x 50us */ value = (SLEEPCID << 16) + (OWNERMCU << 24) + (0x40 << 8) + 1; RTUSBWriteMACRegister(pAd, 0x7010, value); RTUSBWriteMACRegister(pAd, 0x404, 0x30); - //RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); + /*RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); */ DBGPRINT_RAW(RT_DEBUG_ERROR, ("Sleep Mailbox testvalue %x\n", value)); } @@ -959,7 +959,7 @@ NTSTATUS RTUSB_ResetDevice(IN PRTMP_ADAPTER pAd) NTSTATUS Status = TRUE; DBGPRINT_RAW(RT_DEBUG_TRACE, ("--->USB_ResetDevice\n")); - //RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS); + /*RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS); */ return Status; } @@ -968,9 +968,9 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) PCmdQElmt cmdqelmt; PUCHAR pData; NDIS_STATUS NdisStatus = NDIS_STATUS_SUCCESS; -// ULONG Now = 0; +/* ULONG Now = 0; */ NTSTATUS ntStatus; -// unsigned long IrqFlags; +/* unsigned long IrqFlags; */ while (pAd && pAd->CmdQ.size > 0) { NdisStatus = NDIS_STATUS_SUCCESS; @@ -993,7 +993,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) UINT32 data; { - // Read GPIO pin2 as Hardware controlled radio state + /* Read GPIO pin2 as Hardware controlled radio state */ RTUSBReadMACRegister(pAd, GPIO_CTRL_CFG, @@ -1023,7 +1023,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) MlmeRadioOn (pAd); - // Update extra information + /* Update extra information */ pAd->ExtraInfo = EXTRA_INFO_CLEAR; } else { @@ -1033,7 +1033,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) MlmeRadioOff (pAd); - // Update extra information + /* Update extra information */ pAd->ExtraInfo = HW_RADIO_OFF; } @@ -1056,15 +1056,15 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) UCHAR Index; int ret = 0; PHT_TX_CONTEXT pHTTXContext; -// RTMP_TX_RING *pTxRing; +/* RTMP_TX_RING *pTxRing; */ unsigned long IrqFlags; DBGPRINT_RAW(RT_DEBUG_TRACE, ("CmdThread : CMDTHREAD_RESET_BULK_OUT(ResetPipeid=0x%0x)===>\n", pAd->bulkResetPipeid)); - // All transfers must be aborted or cancelled before attempting to reset the pipe. - //RTUSBCancelPendingBulkOutIRP(pAd); - // Wait 10ms to let previous packet that are already in HW FIFO to clear. by MAXLEE 12-25-2007 + /* All transfers must be aborted or cancelled before attempting to reset the pipe. */ + /*RTUSBCancelPendingBulkOutIRP(pAd); */ + /* Wait 10ms to let previous packet that are already in HW FIFO to clear. by MAXLEE 12-25-2007 */ Index = 0; do { RTUSBReadMACRegister(pAd, @@ -1079,12 +1079,12 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) MACValue = 0; RTUSBReadMACRegister(pAd, USB_DMA_CFG, &MACValue); - // To prevent Read Register error, we 2nd check the validity. + /* To prevent Read Register error, we 2nd check the validity. */ if ((MACValue & 0xc00000) == 0) RTUSBReadMACRegister(pAd, USB_DMA_CFG, &MACValue); - // To prevent Read Register error, we 3rd check the validity. + /* To prevent Read Register error, we 3rd check the validity. */ if ((MACValue & 0xc00000) == 0) RTUSBReadMACRegister(pAd, USB_DMA_CFG, @@ -1093,7 +1093,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) RTUSBWriteMACRegister(pAd, USB_DMA_CFG, MACValue); - // Wait 1ms to prevent next URB to bulkout before HW reset. by MAXLEE 12-25-2007 + /* Wait 1ms to prevent next URB to bulkout before HW reset. by MAXLEE 12-25-2007 */ RTMPusecDelay(1000); MACValue &= (~0x80000); @@ -1102,8 +1102,8 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) DBGPRINT_RAW(RT_DEBUG_TRACE, ("\tSet 0x2a0 bit19. Clear USB DMA TX path\n")); - // Wait 5ms to prevent next URB to bulkout before HW reset. by MAXLEE 12-25-2007 - //RTMPusecDelay(5000); + /* Wait 5ms to prevent next URB to bulkout before HW reset. by MAXLEE 12-25-2007 */ + /*RTMPusecDelay(5000); */ if ((pAd-> bulkResetPipeid & @@ -1127,7 +1127,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) &(pAd-> TxContext[pAd-> bulkResetPipeid]); - //NdisAcquireSpinLock(&pAd->BulkOutLock[pAd->bulkResetPipeid]); + /*NdisAcquireSpinLock(&pAd->BulkOutLock[pAd->bulkResetPipeid]); */ RTMP_INT_LOCK(&pAd-> BulkOutLock[pAd-> bulkResetPipeid], @@ -1148,11 +1148,11 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) bulkResetPipeid] = 1; - // no matter what, clean the flag + /* no matter what, clean the flag */ RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); - //NdisReleaseSpinLock(&pAd->BulkOutLock[pAd->bulkResetPipeid]); + /*NdisReleaseSpinLock(&pAd->BulkOutLock[pAd->bulkResetPipeid]); */ RTMP_INT_UNLOCK(&pAd-> BulkOutLock [pAd-> @@ -1259,8 +1259,8 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) } } } else { - //NdisReleaseSpinLock(&pAd->BulkOutLock[pAd->bulkResetPipeid]); - //RTMP_INT_UNLOCK(&pAd->BulkOutLock[pAd->bulkResetPipeid], IrqFlags); + /*NdisReleaseSpinLock(&pAd->BulkOutLock[pAd->bulkResetPipeid]); */ + /*RTMP_INT_UNLOCK(&pAd->BulkOutLock[pAd->bulkResetPipeid], IrqFlags); */ DBGPRINT_RAW (RT_DEBUG_ERROR, @@ -1338,7 +1338,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) ("\tTX Occupied by %d!\n", pendingContext)); } - // no matter what, clean the flag + /* no matter what, clean the flag */ RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET); @@ -1358,7 +1358,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); - //RTUSBKickBulkOut(pAd); + /*RTUSBKickBulkOut(pAd); */ } } @@ -1403,12 +1403,12 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) DBGPRINT_RAW(RT_DEBUG_TRACE, ("CmdThread : CMDTHREAD_RESET_BULK_IN === >\n")); - // All transfers must be aborted or cancelled before attempting to reset the pipe. + /* All transfers must be aborted or cancelled before attempting to reset the pipe. */ { UINT32 MACValue; { - //while ((atomic_read(&pAd->PendingRx) > 0) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) + /*while ((atomic_read(&pAd->PendingRx) > 0) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) */ if ((pAd->PendingRx > 0) && (!RTMP_TEST_FLAG @@ -1425,7 +1425,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) } } - // Wait 10ms before reading register. + /* Wait 10ms before reading register. */ RTMPusecDelay(10000); ntStatus = RTUSBReadMACRegister(pAd, MAC_CSR0, @@ -1505,7 +1505,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) i < pAd->CommonCfg. NumOfBulkInIRP; i++) { - //RTUSBBulkReceive(pAd); + /*RTUSBBulkReceive(pAd); */ PRX_CONTEXT pRxContext; PURB pUrb; int ret = 0; @@ -1541,11 +1541,11 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) BulkInLock, IrqFlags); - // Init Rx context descriptor + /* Init Rx context descriptor */ RTUSBInitRxDesc(pAd, pRxContext); pUrb = pRxContext->pUrb; - if ((ret = RTUSB_SUBMIT_URB(pUrb)) != 0) { // fail + if ((ret = RTUSB_SUBMIT_URB(pUrb)) != 0) { /* fail */ RTMP_IRQ_LOCK (&pAd-> @@ -1571,9 +1571,9 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) ret, pUrb-> status)); - } else { // success - //DBGPRINT(RT_DEBUG_TRACE, ("BIDone, Pend=%d,BIIdx=%d,BIRIdx=%d!\n", - // pAd->PendingRx, pAd->NextRxBulkInIndex, pAd->NextRxBulkInReadIndex)); + } else { /* success */ + /*DBGPRINT(RT_DEBUG_TRACE, ("BIDone, Pend=%d,BIIdx=%d,BIRIdx=%d!\n", */ + /* pAd->PendingRx, pAd->NextRxBulkInIndex, pAd->NextRxBulkInReadIndex)); */ DBGPRINT_RAW (RT_DEBUG_TRACE, ("CMDTHREAD_RESET_BULK_IN: Submit Rx URB Done, status=%d!\n", @@ -1584,7 +1584,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) } } else { - // Card must be removed + /* Card must be removed */ if (NT_SUCCESS(ntStatus) != TRUE) { RTMP_SET_FLAG(pAd, @@ -1643,7 +1643,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) MACValue)); RTUSBWriteMACRegister(pAd, offset, MACValue); - // Read bitmask + /* Read bitmask */ RTUSBReadMACRegister(pAd, offset + 4, &MACRValue); if (SetAsicWcid.DeleteTid != 0xffffffff) @@ -1693,7 +1693,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) ("Cmd : CMDTHREAD_SET_ASIC_WCID_CIPHER : WCID = %ld, Cipher = %lx.\n", SetAsicWcidAttri.WCID, SetAsicWcidAttri.Cipher)); - // Read bitmask + /* Read bitmask */ RTUSBReadMACRegister(pAd, offset, &MACRValue); MACRValue = 0; @@ -1725,10 +1725,10 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) ("2-offset = %x , MACValue= %x,\n", offset, MACRValue)); - // - // Update cipher algorithm. WSTA always use BSS0 - // - // for adhoc mode only ,because wep status slow than add key, when use zero config + /* */ + /* Update cipher algorithm. WSTA always use BSS0 */ + /* */ + /* for adhoc mode only ,because wep status slow than add key, when use zero config */ if (pAd->StaCfg.BssType == BSS_ADHOC) { offset = MAC_WCID_ATTRIBUTE_BASE; @@ -1745,7 +1745,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) offset, MACRValue); - //Update group key cipher,,because wep status slow than add key, when use zero config + /*Update group key cipher,,because wep status slow than add key, when use zero config */ RTUSBReadMACRegister(pAd, SHARED_KEY_MODE_BASE + @@ -1770,8 +1770,8 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) } break; -//Benson modified for USB interface, avoid in interrupt when write key, 20080724 --> - case RT_CMD_SET_KEY_TABLE: //General call for AsicAddPairwiseKeyEntry() +/*Benson modified for USB interface, avoid in interrupt when write key, 20080724 --> */ + case RT_CMD_SET_KEY_TABLE: /*General call for AsicAddPairwiseKeyEntry() */ { RT_ADD_PAIRWISE_KEY_ENTRY KeyInfo; KeyInfo = @@ -1786,7 +1786,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) } break; - case RT_CMD_SET_RX_WCID_TABLE: //General call for RTMPAddWcidAttributeEntry() + case RT_CMD_SET_RX_WCID_TABLE: /*General call for RTMPAddWcidAttributeEntry() */ { PMAC_TABLE_ENTRY pEntry; UCHAR KeyIdx = 0; @@ -1802,7 +1802,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) pEntry); } break; -//Benson modified for USB interface, avoid in interrupt when write key, 20080724 <-- +/*Benson modified for USB interface, avoid in interrupt when write key, 20080724 <-- */ case CMDTHREAD_SET_CLIENT_MAC_ENTRY: { @@ -1865,17 +1865,17 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) DefaultKeyId]. CipherAlg, FALSE); } else { - // - // Other case, disable engine. - // Don't worry WPA key, we will add WPA Key after 4-Way handshaking. - // + /* */ + /* Other case, disable engine. */ + /* Don't worry WPA key, we will add WPA Key after 4-Way handshaking. */ + /* */ USHORT offset; offset = MAC_WCID_ATTRIBUTE_BASE + (pEntry->Aid * HW_WCID_ATTRI_SIZE); - // RX_PKEY_MODE:0 for no security; RX_KEY_TAB:0 for shared key table; BSS_IDX:0 + /* RX_PKEY_MODE:0 for no security; RX_KEY_TAB:0 for shared key table; BSS_IDX:0 */ RTUSBWriteMACRegister (pAd, offset, 0); } @@ -1894,7 +1894,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) } break; -// add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet +/* add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet */ case CMDTHREAD_UPDATE_PROTECT: { AsicUpdateProtect(pAd, 0, @@ -1902,7 +1902,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) TRUE, 0); } break; -// end johnli +/* end johnli */ case OID_802_11_ADD_WEP: { @@ -1916,7 +1916,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) pWepKey = (PNDIS_802_11_WEP) pData; KeyIdx = pWepKey->KeyIndex & 0x0fffffff; - // it is a shared key + /* it is a shared key */ if ((KeyIdx >= 4) || ((pWepKey->KeyLength != 5) && (pWepKey->KeyLength != @@ -1944,10 +1944,10 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) 5) ? CIPHER_WEP64 : CIPHER_WEP128; - // - // Change the WEP cipher to CKIP cipher if CKIP KP on. - // Funk UI or Meetinghouse UI will add ckip key from this path. - // + /* */ + /* Change the WEP cipher to CKIP cipher if CKIP KP on. */ + /* Funk UI or Meetinghouse UI will add ckip key from this path. */ + /* */ if (pAd->OpMode == OPMODE_STA) { pAd->MacTab. @@ -1968,7 +1968,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) CipherAlg = CipherAlg; if (pWepKey-> KeyIndex & 0x80000000) { - // Default key for tx (shared key) + /* Default key for tx (shared key) */ UCHAR IVEIV[8]; UINT32 WCIDAttri, Value; USHORT offset, offset2; @@ -1977,8 +1977,8 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) pAd->StaCfg. DefaultKeyId = (UCHAR) KeyIdx; - // Add BSSID to WCTable. because this is Tx wep key. - // WCID Attribute UDF:3, BSSIdx:3, Alg:3, Keytable:1=PAIRWISE KEY, BSSIdx is 0 + /* Add BSSID to WCTable. because this is Tx wep key. */ + /* WCID Attribute UDF:3, BSSIdx:3, Alg:3, Keytable:1=PAIRWISE KEY, BSSIdx is 0 */ WCIDAttri = (CipherAlg << 1) | SHAREDKEYTABLE; @@ -1991,9 +1991,9 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) RTUSBWriteMACRegister (pAd, offset, WCIDAttri); - // 1. IV/EIV - // Specify key index to find shared key. - IVEIV[3] = (UCHAR) (KeyIdx << 6); //WEP Eiv bit off. groupkey index is not 0 + /* 1. IV/EIV */ + /* Specify key index to find shared key. */ + IVEIV[3] = (UCHAR) (KeyIdx << 6); /*WEP Eiv bit off. groupkey index is not 0 */ offset = PAIRWISE_IVEIV_TABLE_BASE + @@ -2030,7 +2030,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) i += 4; } - // 2. WCID Attribute UDF:3, BSSIdx:3, Alg:3, Keytable:use share key, BSSIdx is 0 + /* 2. WCID Attribute UDF:3, BSSIdx:3, Alg:3, Keytable:use share key, BSSIdx is 0 */ WCIDAttri = (pAd-> SharedKey[BSS0] @@ -2109,4 +2109,4 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) } /* end of while */ } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ -- GitLab From ec278fa259e48c89b206ccd9e1bee06277077263 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 11 Dec 2009 12:23:15 -0800 Subject: [PATCH 164/235] Staging: rt28x0: fix comments in common/*.c files Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/common/action.c | 68 +- drivers/staging/rt2860/common/ba_action.c | 340 ++--- drivers/staging/rt2860/common/cmm_aes.c | 66 +- drivers/staging/rt2860/common/cmm_asic.c | 700 +++++------ drivers/staging/rt2860/common/cmm_cfg.c | 20 +- drivers/staging/rt2860/common/cmm_data.c | 581 +++++---- drivers/staging/rt2860/common/cmm_data_pci.c | 302 ++--- drivers/staging/rt2860/common/cmm_data_usb.c | 270 ++-- drivers/staging/rt2860/common/cmm_info.c | 314 ++--- drivers/staging/rt2860/common/cmm_mac_pci.c | 378 +++--- drivers/staging/rt2860/common/cmm_mac_usb.c | 252 ++-- drivers/staging/rt2860/common/cmm_sanity.c | 278 ++--- drivers/staging/rt2860/common/cmm_sync.c | 90 +- drivers/staging/rt2860/common/cmm_tkip.c | 96 +- drivers/staging/rt2860/common/cmm_wep.c | 26 +- drivers/staging/rt2860/common/cmm_wpa.c | 608 ++++----- drivers/staging/rt2860/common/ee_efuse.c | 68 +- drivers/staging/rt2860/common/ee_prom.c | 38 +- drivers/staging/rt2860/common/eeprom.c | 8 +- drivers/staging/rt2860/common/mlme.c | 1169 +++++++++--------- drivers/staging/rt2860/common/rt_channel.c | 828 ++++++------- drivers/staging/rt2860/common/rt_rf.c | 8 +- drivers/staging/rt2860/common/rtmp_init.c | 1032 ++++++++-------- drivers/staging/rt2860/common/rtmp_mcu.c | 52 +- drivers/staging/rt2860/common/rtmp_timer.c | 22 +- drivers/staging/rt2860/common/spectrum.c | 124 +- 26 files changed, 3866 insertions(+), 3872 deletions(-) diff --git a/drivers/staging/rt2860/common/action.c b/drivers/staging/rt2860/common/action.c index f6efdb6671b3..f69681d65fcf 100644 --- a/drivers/staging/rt2860/common/action.c +++ b/drivers/staging/rt2860/common/action.c @@ -113,13 +113,13 @@ VOID MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) NdisZeroMemory(&Frame, sizeof(FRAME_ADDBA_REQ)); if (MlmeAddBAReqSanity(pAd, Elem->Msg, Elem->MsgLen, Addr)) { - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("BA - MlmeADDBAAction() allocate memory failed \n")); return; } - // 1. find entry + /* 1. find entry */ Idx = pAd->MacTab.Content[pInfo->Wcid].BAOriWcidArray[pInfo->TID]; if (Idx == 0) { @@ -200,27 +200,27 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) FRAME_BAR FrameBar; pInfo = (MLME_DELBA_REQ_STRUCT *) Elem->Msg; - // must send back DELBA + /* must send back DELBA */ NdisZeroMemory(&Frame, sizeof(FRAME_DELBA_REQ)); DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeDELBAAction(), Initiator(%d) \n", pInfo->Initiator)); if (MlmeDelBAReqSanity(pAd, Elem->Msg, Elem->MsgLen)) { - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_ERROR, ("BA - MlmeDELBAAction() allocate memory failed 1. \n")); return; } - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { MlmeFreeMemory(pAd, pOutBuffer); DBGPRINT(RT_DEBUG_ERROR, ("BA - MlmeDELBAAction() allocate memory failed 2. \n")); return; } - // SEND BAR (Send BAR to refresh peer reordering buffer.) + /* SEND BAR (Send BAR to refresh peer reordering buffer.) */ Idx = pAd->MacTab.Content[pInfo->Wcid].BAOriWcidArray[pInfo->TID]; @@ -228,12 +228,12 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->MacTab.Content[pInfo->Wcid].Addr, pAd->CurrentAddress); - FrameBar.StartingSeq.field.FragNum = 0; // make sure sequence not clear in DEL funciton. - FrameBar.StartingSeq.field.StartSeq = pAd->MacTab.Content[pInfo->Wcid].TxSeq[pInfo->TID]; // make sure sequence not clear in DEL funciton. - FrameBar.BarControl.TID = pInfo->TID; // make sure sequence not clear in DEL funciton. - FrameBar.BarControl.ACKPolicy = IMMED_BA; // make sure sequence not clear in DEL funciton. - FrameBar.BarControl.Compressed = 1; // make sure sequence not clear in DEL funciton. - FrameBar.BarControl.MTID = 0; // make sure sequence not clear in DEL funciton. + FrameBar.StartingSeq.field.FragNum = 0; /* make sure sequence not clear in DEL funciton. */ + FrameBar.StartingSeq.field.StartSeq = pAd->MacTab.Content[pInfo->Wcid].TxSeq[pInfo->TID]; /* make sure sequence not clear in DEL funciton. */ + FrameBar.BarControl.TID = pInfo->TID; /* make sure sequence not clear in DEL funciton. */ + FrameBar.BarControl.ACKPolicy = IMMED_BA; /* make sure sequence not clear in DEL funciton. */ + FrameBar.BarControl.Compressed = 1; /* make sure sequence not clear in DEL funciton. */ + FrameBar.BarControl.MTID = 0; /* make sure sequence not clear in DEL funciton. */ MakeOutgoingFrame(pOutBuffer2, &FrameLen, sizeof(FRAME_BAR), &FrameBar, END_OF_ARGS); @@ -242,7 +242,7 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) DBGPRINT(RT_DEBUG_TRACE, ("BA - MlmeDELBAAction() . Send BAR to refresh peer reordering buffer \n")); - // SEND DELBA FRAME + /* SEND DELBA FRAME */ FrameLen = 0; { @@ -263,7 +263,7 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Frame.Action = DELBA; Frame.DelbaParm.Initiator = pInfo->Initiator; Frame.DelbaParm.TID = pInfo->TID; - Frame.ReasonCode = 39; // Time Out + Frame.ReasonCode = 39; /* Time Out */ *(USHORT *) (&Frame.DelbaParm) = cpu2le16(*(USHORT *) (&Frame.DelbaParm)); Frame.ReasonCode = cpu2le16(Frame.ReasonCode); @@ -288,8 +288,8 @@ VOID MlmeDLSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) VOID MlmeInvalidAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - //PUCHAR pOutBuffer = NULL; - //Return the receiving frame except the MSB of category filed set to 1. 7.3.1.11 + /*PUCHAR pOutBuffer = NULL; */ + /*Return the receiving frame except the MSB of category filed set to 1. 7.3.1.11 */ } VOID PeerQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) @@ -347,20 +347,20 @@ static VOID respond_ht_information_exchange_action(IN PRTMP_ADAPTER pAd, FRAME_HT_INFO HTINFOframe, *pFrame; UCHAR *pAddr; - // 2. Always send back ADDBA Response - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + /* 2. Always send back ADDBA Response */ + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("ACTION - respond_ht_information_exchange_action() allocate memory failed \n")); return; } - // get RA + /* get RA */ pFrame = (FRAME_HT_INFO *) & Elem->Msg[0]; pAddr = pFrame->Hdr.Addr2; NdisZeroMemory(&HTINFOframe, sizeof(FRAME_HT_INFO)); - // 2-1. Prepare ADDBA Response frame. + /* 2-1. Prepare ADDBA Response frame. */ { if (ADHOC_ON(pAd)) ActHeaderInit(pAd, &HTINFOframe.Hdr, pAddr, @@ -400,21 +400,21 @@ VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ("ACTION - HT Notify Channel bandwidth action----> \n")); if (pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) { - // Note, this is to patch DIR-1353 AP. When the AP set to Wep, it will use legacy mode. But AP still keeps - // sending BW_Notify Action frame, and cause us to linkup and linkdown. - // In legacy mode, don't need to parse HT action frame. + /* Note, this is to patch DIR-1353 AP. When the AP set to Wep, it will use legacy mode. But AP still keeps */ + /* sending BW_Notify Action frame, and cause us to linkup and linkdown. */ + /* In legacy mode, don't need to parse HT action frame. */ DBGPRINT(RT_DEBUG_TRACE, ("ACTION -Ignore HT Notify Channel BW when link as legacy mode. BW = %d---> \n", Elem->Msg[LENGTH_802_11 + 2])); break; } - if (Elem->Msg[LENGTH_802_11 + 2] == 0) // 7.4.8.2. if value is 1, keep the same as supported channel bandwidth. + if (Elem->Msg[LENGTH_802_11 + 2] == 0) /* 7.4.8.2. if value is 1, keep the same as supported channel bandwidth. */ pAd->MacTab.Content[Elem->Wcid].HTPhyMode.field.BW = 0; break; case SMPS_ACTION: - // 7.3.1.25 + /* 7.3.1.25 */ DBGPRINT(RT_DEBUG_TRACE, ("ACTION - SMPS action----> \n")); if (((Elem->Msg[LENGTH_802_11 + 2] & 0x1) == 0)) { pAd->MacTab.Content[Elem->Wcid].MmpsMode = MMPS_ENABLE; @@ -427,7 +427,7 @@ VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) DBGPRINT(RT_DEBUG_TRACE, ("Aid(%d) MIMO PS = %d\n", Elem->Wcid, pAd->MacTab.Content[Elem->Wcid].MmpsMode)); - // rt2860c : add something for smps change. + /* rt2860c : add something for smps change. */ break; case SETPCO_ACTION: @@ -441,7 +441,7 @@ VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pHT_info = (HT_INFORMATION_OCTET *) & Elem->Msg[LENGTH_802_11 + 2]; - // 7.4.8.10 + /* 7.4.8.10 */ DBGPRINT(RT_DEBUG_TRACE, ("ACTION - HT Information Exchange action----> \n")); if (pHT_info->Request) { @@ -512,7 +512,7 @@ VOID SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) ASSERT(pBAEntry->Wcid < MAX_LEN_OF_MAC_TABLE); - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_ERROR, ("BA - MlmeADDBAAction() allocate memory failed \n")); @@ -524,17 +524,17 @@ VOID SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) BarHeaderInit(pAd, &FrameBar, pEntry->Addr, pAd->CurrentAddress); - FrameBar.StartingSeq.field.FragNum = 0; // make sure sequence not clear in DEL function. - FrameBar.StartingSeq.field.StartSeq = Sequence; // make sure sequence not clear in DEL funciton. - FrameBar.BarControl.TID = TID; // make sure sequence not clear in DEL funciton. + FrameBar.StartingSeq.field.FragNum = 0; /* make sure sequence not clear in DEL function. */ + FrameBar.StartingSeq.field.StartSeq = Sequence; /* make sure sequence not clear in DEL funciton. */ + FrameBar.BarControl.TID = TID; /* make sure sequence not clear in DEL funciton. */ MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(FRAME_BAR), &FrameBar, END_OF_ARGS); - //if (!(CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_RALINK_CHIPSET))) - if (1) // Now we always send BAR. + /*if (!(CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_RALINK_CHIPSET))) */ + if (1) /* Now we always send BAR. */ { - //MiniportMMRequestUnlock(pAd, 0, pOutBuffer, FrameLen); + /*MiniportMMRequestUnlock(pAd, 0, pOutBuffer, FrameLen); */ MiniportMMRequest(pAd, (MGMT_USE_QUEUE_FLAG | MapUserPriorityToAccessCategory diff --git a/drivers/staging/rt2860/common/ba_action.c b/drivers/staging/rt2860/common/ba_action.c index dedbe52e0906..97cb40a28260 100644 --- a/drivers/staging/rt2860/common/ba_action.c +++ b/drivers/staging/rt2860/common/ba_action.c @@ -27,14 +27,14 @@ #include "../rt_config.h" -#define BA_ORI_INIT_SEQ (pEntry->TxSeq[TID]) //1 // inital sequence number of BA session +#define BA_ORI_INIT_SEQ (pEntry->TxSeq[TID]) /*1 // inital sequence number of BA session */ #define ORI_SESSION_MAX_RETRY 8 -#define ORI_BA_SESSION_TIMEOUT (2000) // ms -#define REC_BA_SESSION_IDLE_TIMEOUT (1000) // ms +#define ORI_BA_SESSION_TIMEOUT (2000) /* ms */ +#define REC_BA_SESSION_IDLE_TIMEOUT (1000) /* ms */ -#define REORDERING_PACKET_TIMEOUT ((100 * OS_HZ)/1000) // system ticks -- 100 ms -#define MAX_REORDERING_PACKET_TIMEOUT ((3000 * OS_HZ)/1000) // system ticks -- 100 ms +#define REORDERING_PACKET_TIMEOUT ((100 * OS_HZ)/1000) /* system ticks -- 100 ms */ +#define MAX_REORDERING_PACKET_TIMEOUT ((3000 * OS_HZ)/1000) /* system ticks -- 100 ms */ #define RESET_RCV_SEQ (0xFFFF) @@ -66,20 +66,20 @@ VOID BA_MaxWinSizeReasign(IN PRTMP_ADAPTER pAd, { UCHAR MaxSize; - if (pAd->MACVersion >= RALINK_2883_VERSION) // 3*3 + if (pAd->MACVersion >= RALINK_2883_VERSION) /* 3*3 */ { if (pAd->MACVersion >= RALINK_3070_VERSION) { if (pEntryPeer->WepStatus != Ndis802_11EncryptionDisabled) - MaxSize = 7; // for non-open mode + MaxSize = 7; /* for non-open mode */ else MaxSize = 13; } else MaxSize = 31; - } else if (pAd->MACVersion >= RALINK_2880E_VERSION) // 2880 e + } else if (pAd->MACVersion >= RALINK_2880E_VERSION) /* 2880 e */ { if (pEntryPeer->WepStatus != Ndis802_11EncryptionDisabled) - MaxSize = 7; // for non-open mode + MaxSize = 7; /* for non-open mode */ else MaxSize = 13; } else @@ -108,9 +108,9 @@ void Announce_Reordering_Packet(IN PRTMP_ADAPTER pAd, ASSERT(0); BA_Reorder_AMSDU_Annnounce(pAd, pPacket); } else { - // - // pass this 802.3 packet to upper layer or forward this packet to WM directly - // + /* */ + /* pass this 802.3 packet to upper layer or forward this packet to WM directly */ + /* */ ANNOUNCE_OR_FORWARD_802_3_PACKET(pAd, pPacket, RTMP_GET_PACKET_IF(pPacket)); @@ -275,7 +275,7 @@ BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num) return (TRUE); } -//static int blk_count=0; // sample take off, no use +/*static int blk_count=0; // sample take off, no use */ static struct reordering_mpdu *ba_mpdu_blk_alloc(PRTMP_ADAPTER pAd) { @@ -284,7 +284,7 @@ static struct reordering_mpdu *ba_mpdu_blk_alloc(PRTMP_ADAPTER pAd) NdisAcquireSpinLock(&pAd->mpdu_blk_pool.lock); mpdu_blk = ba_dequeue(&pAd->mpdu_blk_pool.freelist); if (mpdu_blk) { -// blk_count++; +/* blk_count++; */ /* reset mpdu_blk */ NdisZeroMemory(mpdu_blk, sizeof(struct reordering_mpdu)); } @@ -298,7 +298,7 @@ static void ba_mpdu_blk_free(PRTMP_ADAPTER pAd, ASSERT(mpdu_blk); NdisAcquireSpinLock(&pAd->mpdu_blk_pool.lock); -// blk_count--; +/* blk_count--; */ ba_enqueue(&pAd->mpdu_blk_pool.freelist, mpdu_blk); NdisReleaseSpinLock(&pAd->mpdu_blk_pool.lock); } @@ -380,17 +380,17 @@ static void ba_refresh_reordering_mpdus(IN PRTMP_ADAPTER pAd, NdisReleaseSpinLock(&pBAEntry->RxReRingLock); } -//static +/*static */ void ba_flush_reordering_timeout_mpdus(IN PRTMP_ADAPTER pAd, IN PBA_REC_ENTRY pBAEntry, IN ULONG Now32) { USHORT Sequence; -// if ((RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+REORDERING_PACKET_TIMEOUT)) && -// (pBAEntry->list.qlen > ((pBAEntry->BAWinSize*7)/8))) //|| -// (RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+(10*REORDERING_PACKET_TIMEOUT))) && -// (pBAEntry->list.qlen > (pBAEntry->BAWinSize/8))) +/* if ((RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+REORDERING_PACKET_TIMEOUT)) && */ +/* (pBAEntry->list.qlen > ((pBAEntry->BAWinSize*7)/8))) //|| */ +/* (RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+(10*REORDERING_PACKET_TIMEOUT))) && */ +/* (pBAEntry->list.qlen > (pBAEntry->BAWinSize/8))) */ if (RTMP_TIME_AFTER ((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer + @@ -413,16 +413,16 @@ void ba_flush_reordering_timeout_mpdus(IN PRTMP_ADAPTER pAd, (REORDERING_PACKET_TIMEOUT))) && (pBAEntry->list.qlen > 0) ) { - // - // force LastIndSeq to shift to LastIndSeq+1 - // + /* */ + /* force LastIndSeq to shift to LastIndSeq+1 */ + /* */ Sequence = (pBAEntry->LastIndSeq + 1) & MAXSEQ; ba_indicate_reordering_mpdus_le_seq(pAd, pBAEntry, Sequence); pBAEntry->LastIndSeqAtTimer = Now32; pBAEntry->LastIndSeq = Sequence; - // - // indicate in-order mpdus - // + /* */ + /* indicate in-order mpdus */ + /* */ Sequence = ba_indicate_reordering_mpdus_in_order(pAd, pBAEntry, Sequence); @@ -446,7 +446,7 @@ VOID BAOriSessionSetUp(IN PRTMP_ADAPTER pAd, IN USHORT TimeOut, IN ULONG DelayTime, IN BOOLEAN isForced) { - //MLME_ADDBA_REQ_STRUCT AddbaReq; + /*MLME_ADDBA_REQ_STRUCT AddbaReq; */ BA_ORI_ENTRY *pBAEntry = NULL; USHORT Idx; BOOLEAN Cancelled; @@ -455,20 +455,20 @@ VOID BAOriSessionSetUp(IN PRTMP_ADAPTER pAd, && (isForced == FALSE)) return; - // if this entry is limited to use legacy tx mode, it doesn't generate BA. + /* if this entry is limited to use legacy tx mode, it doesn't generate BA. */ if (RTMPStaFixedTxMode(pAd, pEntry) != FIXED_TXMODE_HT) return; if ((pEntry->BADeclineBitmap & (1 << TID)) && (isForced == FALSE)) { - // try again after 3 secs + /* try again after 3 secs */ DelayTime = 3000; -// DBGPRINT(RT_DEBUG_TRACE, ("DeCline BA from Peer\n")); -// return; +/* DBGPRINT(RT_DEBUG_TRACE, ("DeCline BA from Peer\n")); */ +/* return; */ } Idx = pEntry->BAOriWcidArray[TID]; if (Idx == 0) { - // allocate a BA session + /* allocate a BA session */ pBAEntry = BATableAllocOriEntry(pAd, &Idx); if (pBAEntry == NULL) { DBGPRINT(RT_DEBUG_TRACE, @@ -485,12 +485,12 @@ VOID BAOriSessionSetUp(IN PRTMP_ADAPTER pAd, pEntry->BAOriWcidArray[TID] = Idx; - // Initialize BA session + /* Initialize BA session */ pBAEntry->ORI_BA_Status = Originator_WaitRes; pBAEntry->Wcid = pEntry->Aid; pBAEntry->BAWinSize = pAd->CommonCfg.BACapability.field.RxBAWinLimit; pBAEntry->Sequence = BA_ORI_INIT_SEQ; - pBAEntry->Token = 1; // (2008-01-21) Jan Lee recommends it - this token can't be 0 + pBAEntry->Token = 1; /* (2008-01-21) Jan Lee recommends it - this token can't be 0 */ pBAEntry->TID = TID; pBAEntry->TimeOutValue = TimeOut; pBAEntry->pAdapter = pAd; @@ -502,7 +502,7 @@ VOID BAOriSessionSetUp(IN PRTMP_ADAPTER pAd, } else RTMPCancelTimer(&pBAEntry->ORIBATimer, &Cancelled); - // set timer to send ADDBA request + /* set timer to send ADDBA request */ RTMPSetTimer(&pBAEntry->ORIBATimer, DelayTime); } @@ -522,7 +522,7 @@ VOID BAOriSessionAdd(IN PRTMP_ADAPTER pAd, Idx = pEntry->BAOriWcidArray[TID]; pBAEntry = &pAd->BATable.BAOriEntry[Idx]; - // Start fill in parameters. + /* Start fill in parameters. */ if ((Idx != 0) && (pBAEntry->TID == TID) && (pBAEntry->ORI_BA_Status == Originator_WaitRes)) { pBAEntry->BAWinSize = @@ -533,21 +533,21 @@ VOID BAOriSessionAdd(IN PRTMP_ADAPTER pAd, pBAEntry->ORI_BA_Status = Originator_Done; pAd->BATable.numDoneOriginator++; - // reset sequence number + /* reset sequence number */ pBAEntry->Sequence = BA_ORI_INIT_SEQ; - // Set Bitmap flag. + /* Set Bitmap flag. */ pEntry->TXBAbitmap |= (1 << TID); RTMPCancelTimer(&pBAEntry->ORIBATimer, &Cancelled); - pBAEntry->ORIBATimer.TimerValue = 0; //pFrame->TimeOutValue; + pBAEntry->ORIBATimer.TimerValue = 0; /*pFrame->TimeOutValue; */ DBGPRINT(RT_DEBUG_TRACE, ("%s : TXBAbitmap = %x, BAWinSize = %d, TimeOut = %ld\n", __func__, pEntry->TXBAbitmap, pBAEntry->BAWinSize, pBAEntry->ORIBATimer.TimerValue)); - // SEND BAR ; - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2); //Get an unused nonpaged memory + /* SEND BAR ; */ + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("BA - BAOriSessionAdd() allocate memory failed \n")); @@ -558,16 +558,16 @@ VOID BAOriSessionAdd(IN PRTMP_ADAPTER pAd, pAd->MacTab.Content[pBAEntry->Wcid].Addr, pAd->CurrentAddress); - FrameBar.StartingSeq.field.FragNum = 0; // make sure sequence not clear in DEL function. - FrameBar.StartingSeq.field.StartSeq = pBAEntry->Sequence; // make sure sequence not clear in DEL funciton. - FrameBar.BarControl.TID = pBAEntry->TID; // make sure sequence not clear in DEL funciton. + FrameBar.StartingSeq.field.FragNum = 0; /* make sure sequence not clear in DEL function. */ + FrameBar.StartingSeq.field.StartSeq = pBAEntry->Sequence; /* make sure sequence not clear in DEL funciton. */ + FrameBar.BarControl.TID = pBAEntry->TID; /* make sure sequence not clear in DEL funciton. */ MakeOutgoingFrame(pOutBuffer2, &FrameLen, sizeof(FRAME_BAR), &FrameBar, END_OF_ARGS); MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer2, FrameLen); MlmeFreeMemory(pAd, pOutBuffer2); if (pBAEntry->ORIBATimer.TimerValue) - RTMPSetTimer(&pBAEntry->ORIBATimer, pBAEntry->ORIBATimer.TimerValue); // in mSec + RTMPSetTimer(&pBAEntry->ORIBATimer, pBAEntry->ORIBATimer.TimerValue); /* in mSec */ } } @@ -580,19 +580,19 @@ BOOLEAN BARecSessionAdd(IN PRTMP_ADAPTER pAd, USHORT Idx; UCHAR TID; UCHAR BAWinSize; - //UINT32 Value; - //UINT offset; + /*UINT32 Value; */ + /*UINT offset; */ ASSERT(pEntry); - // find TID + /* find TID */ TID = pFrame->BaParm.TID; BAWinSize = min(((UCHAR) pFrame->BaParm.BufSize), (UCHAR) pAd->CommonCfg.BACapability.field.RxBAWinLimit); - // Intel patch + /* Intel patch */ if (BAWinSize == 0) { BAWinSize = 64; } @@ -603,7 +603,7 @@ BOOLEAN BARecSessionAdd(IN PRTMP_ADAPTER pAd, pBAEntry = BATableAllocRecEntry(pAd, &Idx); } else { pBAEntry = &pAd->BATable.BARecEntry[Idx]; - // flush all pending reordering mpdus + /* flush all pending reordering mpdus */ ba_refresh_reordering_mpdus(pAd, pBAEntry); } @@ -612,7 +612,7 @@ BOOLEAN BARecSessionAdd(IN PRTMP_ADAPTER pAd, pAd->BATable.numAsRecipient, Idx, pFrame->BaParm.BufSize, BAWinSize)); - // Start fill in parameters. + /* Start fill in parameters. */ if (pBAEntry != NULL) { ASSERT(pBAEntry->list.qlen == 0); @@ -622,8 +622,8 @@ BOOLEAN BARecSessionAdd(IN PRTMP_ADAPTER pAd, pBAEntry->TID = TID; pBAEntry->TimeOutValue = pFrame->TimeOutValue; pBAEntry->REC_BA_Status = Recipient_Accept; - // initial sequence number - pBAEntry->LastIndSeq = RESET_RCV_SEQ; //pFrame->BaStartSeq.field.StartSeq; + /* initial sequence number */ + pBAEntry->LastIndSeq = RESET_RCV_SEQ; /*pFrame->BaStartSeq.field.StartSeq; */ DBGPRINT(RT_DEBUG_OFF, ("Start Seq = %08x\n", @@ -638,13 +638,13 @@ BOOLEAN BARecSessionAdd(IN PRTMP_ADAPTER pAd, TRUE); } - // Set Bitmap flag. + /* Set Bitmap flag. */ pEntry->RXBAbitmap |= (1 << TID); pEntry->BARecWcidArray[TID] = Idx; pEntry->BADeclineBitmap &= ~(1 << TID); - // Set BA session mask in WCID table. + /* Set BA session mask in WCID table. */ RTMP_ADD_BA_SESSION_TO_ASIC(pAd, pEntry->Aid, TID); DBGPRINT(RT_DEBUG_TRACE, @@ -673,11 +673,11 @@ BA_REC_ENTRY *BATableAllocRecEntry(IN PRTMP_ADAPTER pAd, OUT USHORT * Idx) MAX_BARECI_SESSION)); goto done; } - // reserve idx 0 to identify BAWcidArray[TID] as empty + /* reserve idx 0 to identify BAWcidArray[TID] as empty */ for (i = 1; i < MAX_LEN_OF_BA_REC_TABLE; i++) { pBAEntry = &pAd->BATable.BARecEntry[i]; if ((pBAEntry->REC_BA_Status == Recipient_NONE)) { - // get one + /* get one */ pAd->BATable.numAsRecipient++; pBAEntry->REC_BA_Status = Recipient_USED; *Idx = i; @@ -700,11 +700,11 @@ BA_ORI_ENTRY *BATableAllocOriEntry(IN PRTMP_ADAPTER pAd, OUT USHORT * Idx) if (pAd->BATable.numAsOriginator >= (MAX_LEN_OF_BA_ORI_TABLE)) { goto done; } - // reserve idx 0 to identify BAWcidArray[TID] as empty + /* reserve idx 0 to identify BAWcidArray[TID] as empty */ for (i = 1; i < MAX_LEN_OF_BA_ORI_TABLE; i++) { pBAEntry = &pAd->BATable.BAOriEntry[i]; if ((pBAEntry->ORI_BA_Status == Originator_NONE)) { - // get one + /* get one */ pAd->BATable.numAsOriginator++; pBAEntry->ORI_BA_Status = Originator_USED; pBAEntry->pAdapter = pAd; @@ -739,7 +739,7 @@ VOID BATableFreeOriEntry(IN PRTMP_ADAPTER pAd, IN ULONG Idx) DBGPRINT(RT_DEBUG_TRACE, ("BATableFreeOriEntry numAsOriginator= %ld\n", pAd->BATable.numAsRecipient)); - // Erase Bitmap flag. + /* Erase Bitmap flag. */ } ASSERT(pAd->BATable.numAsOriginator != 0); @@ -789,13 +789,13 @@ VOID BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd, if (Wcid >= MAX_LEN_OF_MAC_TABLE) { return; } - // - // Locate corresponding BA Originator Entry in BA Table with the (pAddr,TID). - // + /* */ + /* Locate corresponding BA Originator Entry in BA Table with the (pAddr,TID). */ + /* */ Idx = pAd->MacTab.Content[Wcid].BAOriWcidArray[TID]; if ((Idx == 0) || (Idx >= MAX_LEN_OF_BA_ORI_TABLE)) { if (bForceSend == TRUE) { - // force send specified TID DelBA + /* force send specified TID DelBA */ MLME_DELBA_REQ_STRUCT DelbaReq; MLME_QUEUE_ELEM *Elem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), @@ -831,9 +831,9 @@ VOID BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd, DBGPRINT(RT_DEBUG_TRACE, ("\t===>Idx = %ld, Wcid=%d.TID=%d, ORI_BA_Status = %d \n", Idx, Wcid, TID, pBAEntry->ORI_BA_Status)); - // - // Prepare DelBA action frame and send to the peer. - // + /* */ + /* Prepare DelBA action frame and send to the peer. */ + /* */ if ((bPassive == FALSE) && (TID == pBAEntry->TID) && (pBAEntry->ORI_BA_Status == Originator_Done)) { MLME_DELBA_REQ_STRUCT DelbaReq; @@ -863,7 +863,7 @@ VOID BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd, BATableFreeOriEntry(pAd, Idx); if (bPassive) { - //BAOriSessionSetUp(pAd, &pAd->MacTab.Content[Wcid], TID, 0, 10000, TRUE); + /*BAOriSessionSetUp(pAd, &pAd->MacTab.Content[Wcid], TID, 0, 10000, TRUE); */ } } @@ -876,9 +876,9 @@ VOID BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd, if (Wcid >= MAX_LEN_OF_MAC_TABLE) { return; } - // - // Locate corresponding BA Originator Entry in BA Table with the (pAddr,TID). - // + /* */ + /* Locate corresponding BA Originator Entry in BA Table with the (pAddr,TID). */ + /* */ Idx = pAd->MacTab.Content[Wcid].BARecWcidArray[TID]; if (Idx == 0) return; @@ -890,21 +890,21 @@ VOID BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd, DBGPRINT(RT_DEBUG_TRACE, ("\t===>Idx = %ld, Wcid=%d.TID=%d, REC_BA_Status = %d \n", Idx, Wcid, TID, pBAEntry->REC_BA_Status)); - // - // Prepare DelBA action frame and send to the peer. - // + /* */ + /* Prepare DelBA action frame and send to the peer. */ + /* */ if ((TID == pBAEntry->TID) && (pBAEntry->REC_BA_Status == Recipient_Accept)) { MLME_DELBA_REQ_STRUCT DelbaReq; BOOLEAN Cancelled; - //ULONG offset; - //UINT32 VALUE; + /*ULONG offset; */ + /*UINT32 VALUE; */ RTMPCancelTimer(&pBAEntry->RECBATimer, &Cancelled); - // - // 1. Send DELBA Action Frame - // + /* */ + /* 1. Send DELBA Action Frame */ + /* */ if (bPassive == FALSE) { MLME_QUEUE_ELEM *Elem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), @@ -931,18 +931,18 @@ VOID BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd, } } - // - // 2. Free resource of BA session - // - // flush all pending reordering mpdus + /* */ + /* 2. Free resource of BA session */ + /* */ + /* flush all pending reordering mpdus */ ba_refresh_reordering_mpdus(pAd, pBAEntry); NdisAcquireSpinLock(&pAd->BATabLock); - // Erase Bitmap flag. + /* Erase Bitmap flag. */ pBAEntry->LastIndSeq = RESET_RCV_SEQ; pBAEntry->BAWinSize = 0; - // Erase Bitmap flag at software mactable + /* Erase Bitmap flag at software mactable */ pAd->MacTab.Content[Wcid].RXBAbitmap &= (~(1 << (pBAEntry->TID))); pAd->MacTab.Content[Wcid].BARecWcidArray[TID] = 0; @@ -995,7 +995,7 @@ VOID BAOriSessionSetupTimeout(IN PVOID SystemSpecific1, pAd = pBAEntry->pAdapter; { - // Do nothing if monitor mode is on + /* Do nothing if monitor mode is on */ if (MONITOR_ON(pAd)) return; } @@ -1062,7 +1062,7 @@ VOID BARecSessionIdleTimeout(IN PVOID SystemSpecific1, (unsigned long)(pBAEntry->LastIndSeqAtTimer + REC_BA_SESSION_IDLE_TIMEOUT))) { pAd = pBAEntry->pAdapter; - // flush all pending reordering mpdus + /* flush all pending reordering mpdus */ ba_refresh_reordering_mpdus(pAd, pBAEntry); DBGPRINT(RT_DEBUG_OFF, ("%ld: REC BA session Timeout\n", Now32)); @@ -1072,15 +1072,15 @@ VOID BARecSessionIdleTimeout(IN PVOID SystemSpecific1, VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - // 7.4.4.1 - //ULONG Idx; + /* 7.4.4.1 */ + /*ULONG Idx; */ UCHAR Status = 1; UCHAR pAddr[6]; FRAME_ADDBA_RSP ADDframe; PUCHAR pOutBuffer = NULL; NDIS_STATUS NStatus; PFRAME_ADDBA_REQ pAddreqFrame = NULL; - //UCHAR BufSize; + /*UCHAR BufSize; */ ULONG FrameLen; PULONG ptemp; PMAC_TABLE_ENTRY pMacEntry; @@ -1088,16 +1088,16 @@ VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) DBGPRINT(RT_DEBUG_TRACE, ("%s ==> (Wcid = %d)\n", __func__, Elem->Wcid)); - //hex_dump("AddBAReq", Elem->Msg, Elem->MsgLen); + /*hex_dump("AddBAReq", Elem->Msg, Elem->MsgLen); */ - //ADDBA Request from unknown peer, ignore this. + /*ADDBA Request from unknown peer, ignore this. */ if (Elem->Wcid >= MAX_LEN_OF_MAC_TABLE) return; pMacEntry = &pAd->MacTab.Content[Elem->Wcid]; DBGPRINT(RT_DEBUG_TRACE, ("BA - PeerAddBAReqAction----> \n")); ptemp = (PULONG) Elem->Msg; - //DBGPRINT_RAW(RT_DEBUG_EMU, ("%08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x\n", *(ptemp), *(ptemp+1), *(ptemp+2), *(ptemp+3), *(ptemp+4), *(ptemp+5), *(ptemp+6), *(ptemp+7), *(ptemp+8))); + /*DBGPRINT_RAW(RT_DEBUG_EMU, ("%08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x\n", *(ptemp), *(ptemp+1), *(ptemp+2), *(ptemp+3), *(ptemp+4), *(ptemp+5), *(ptemp+6), *(ptemp+7), *(ptemp+8))); */ if (PeerAddBAReqActionSanity(pAd, Elem->Msg, Elem->MsgLen, pAddr)) { @@ -1111,9 +1111,9 @@ VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAddreqFrame)) Status = 0; else - Status = 38; // more parameters have invalid values + Status = 38; /* more parameters have invalid values */ } else { - Status = 37; // the request has been declined. + Status = 37; /* the request has been declined. */ } } @@ -1121,8 +1121,8 @@ VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ASSERT(pAd->MacTab.Content[Elem->Wcid].Sst == SST_ASSOC); pAddreqFrame = (PFRAME_ADDBA_REQ) (&Elem->Msg[0]); - // 2. Always send back ADDBA Response - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + /* 2. Always send back ADDBA Response */ + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("ACTION - PeerBAAction() allocate memory failed \n")); @@ -1131,7 +1131,7 @@ VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) NdisZeroMemory(&ADDframe, sizeof(FRAME_ADDBA_RSP)); - // 2-1. Prepare ADDBA Response frame. + /* 2-1. Prepare ADDBA Response frame. */ { if (ADHOC_ON(pAd)) ActHeaderInit(pAd, &ADDframe.Hdr, pAddr, @@ -1145,7 +1145,7 @@ VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ADDframe.Category = CATEGORY_BA; ADDframe.Action = ADDBA_RESP; ADDframe.Token = pAddreqFrame->Token; - // What is the Status code?? need to check. + /* What is the Status code?? need to check. */ ADDframe.StatusCode = Status; ADDframe.BaParm.BAPolicy = IMMED_BA; ADDframe.BaParm.AMSDUSupported = 0; @@ -1156,7 +1156,7 @@ VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if (ADDframe.BaParm.BufSize == 0) { ADDframe.BaParm.BufSize = 64; } - ADDframe.TimeOutValue = 0; //pAddreqFrame->TimeOutValue; + ADDframe.TimeOutValue = 0; /*pAddreqFrame->TimeOutValue; */ *(USHORT *) (&ADDframe.BaParm) = cpu2le16(*(USHORT *) (&ADDframe.BaParm)); @@ -1175,18 +1175,18 @@ VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) VOID PeerAddBARspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - //UCHAR Idx, i; - //PUCHAR pOutBuffer = NULL; + /*UCHAR Idx, i; */ + /*PUCHAR pOutBuffer = NULL; */ PFRAME_ADDBA_RSP pFrame = NULL; - //PBA_ORI_ENTRY pBAEntry; + /*PBA_ORI_ENTRY pBAEntry; */ - //ADDBA Response from unknown peer, ignore this. + /*ADDBA Response from unknown peer, ignore this. */ if (Elem->Wcid >= MAX_LEN_OF_MAC_TABLE) return; DBGPRINT(RT_DEBUG_TRACE, ("%s ==> Wcid(%d)\n", __func__, Elem->Wcid)); - //hex_dump("PeerAddBARspAction()", Elem->Msg, Elem->MsgLen); + /*hex_dump("PeerAddBARspAction()", Elem->Msg, Elem->MsgLen); */ if (PeerAddBARspActionSanity(pAd, Elem->Msg, Elem->MsgLen)) { pFrame = (PFRAME_ADDBA_RSP) (&Elem->Msg[0]); @@ -1195,17 +1195,17 @@ VOID PeerAddBARspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ("\t\t StatusCode = %d\n", pFrame->StatusCode)); switch (pFrame->StatusCode) { case 0: - // I want a BAsession with this peer as an originator. + /* I want a BAsession with this peer as an originator. */ BAOriSessionAdd(pAd, &pAd->MacTab.Content[Elem->Wcid], pFrame); break; default: - // check status == USED ??? + /* check status == USED ??? */ BAOriSessionTearDown(pAd, Elem->Wcid, pFrame->BaParm.TID, TRUE, FALSE); break; } - // Rcv Decline StatusCode + /* Rcv Decline StatusCode */ if ((pFrame->StatusCode == 37) || ((pAd->OpMode == OPMODE_STA) && STA_TGN_WIFI_ON(pAd) && (pFrame->StatusCode != 0)) @@ -1218,12 +1218,12 @@ VOID PeerAddBARspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) VOID PeerDelBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - //UCHAR Idx; - //PUCHAR pOutBuffer = NULL; + /*UCHAR Idx; */ + /*PUCHAR pOutBuffer = NULL; */ PFRAME_DELBA_REQ pDelFrame = NULL; DBGPRINT(RT_DEBUG_TRACE, ("%s ==>\n", __func__)); - //DELBA Request from unknown peer, ignore this. + /*DELBA Request from unknown peer, ignore this. */ if (PeerDelBAActionSanity(pAd, Elem->Wcid, Elem->Msg, Elem->MsgLen)) { pDelFrame = (PFRAME_DELBA_REQ) (&Elem->Msg[0]); if (pDelFrame->DelbaParm.Initiator == ORIGINATOR) { @@ -1235,7 +1235,7 @@ VOID PeerDelBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) DBGPRINT(RT_DEBUG_TRACE, ("BA - PeerDelBAAction----> RECIPIENT, Reason = %d\n", pDelFrame->ReasonCode)); - //hex_dump("DelBA Frame", pDelFrame, Elem->MsgLen); + /*hex_dump("DelBA Frame", pDelFrame, Elem->MsgLen); */ BAOriSessionTearDown(pAd, Elem->Wcid, pDelFrame->DelbaParm.TID, TRUE, FALSE); @@ -1248,26 +1248,26 @@ BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd, IN ULONG MsgLen, IN PFRAME_BA_REQ pMsg) { PFRAME_BA_REQ pFrame = pMsg; - //PRTMP_REORDERBUF pBuffer; - //PRTMP_REORDERBUF pDmaBuf; + /*PRTMP_REORDERBUF pBuffer; */ + /*PRTMP_REORDERBUF pDmaBuf; */ PBA_REC_ENTRY pBAEntry; - //BOOLEAN Result; + /*BOOLEAN Result; */ ULONG Idx; - //UCHAR NumRxPkt; - UCHAR TID; //, i; + /*UCHAR NumRxPkt; */ + UCHAR TID; /*, i; */ TID = (UCHAR) pFrame->BARControl.TID; DBGPRINT(RT_DEBUG_TRACE, ("%s(): BAR-Wcid(%ld), Tid (%d)\n", __func__, Wcid, TID)); - //hex_dump("BAR", (PCHAR) pFrame, MsgLen); - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt + /*hex_dump("BAR", (PCHAR) pFrame, MsgLen); */ + /* Do nothing if the driver is starting halt state. */ + /* This might happen when timer already been fired before cancel timer with mlmehalt */ if (RTMP_TEST_FLAG (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return FALSE; - // First check the size, it MUST not exceed the mlme queue size + /* First check the size, it MUST not exceed the mlme queue size */ if (MsgLen > MGMT_DMA_BUFFER_SIZE) { DBGPRINT_ERR(("CntlEnqueueForRecv: frame too large, size = %ld \n", MsgLen)); return FALSE; @@ -1280,7 +1280,7 @@ BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd, } if ((Wcid < MAX_LEN_OF_MAC_TABLE) && (TID < 8)) { - // if this receiving packet is from SA that is in our OriEntry. Since WCID <9 has direct mapping. no need search. + /* if this receiving packet is from SA that is in our OriEntry. Since WCID <9 has direct mapping. no need search. */ Idx = pAd->MacTab.Content[Wcid].BARecWcidArray[TID]; pBAEntry = &pAd->BATable.BARecEntry[Idx]; } else { @@ -1294,7 +1294,7 @@ BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd, if (SEQ_SMALLER (pBAEntry->LastIndSeq, pFrame->BAStartingSeq.field.StartSeq, MAXSEQ)) { - //DBGPRINT(RT_DEBUG_TRACE, ("BAR Seq = %x, LastIndSeq = %x\n", pFrame->BAStartingSeq.field.StartSeq, pBAEntry->LastIndSeq)); + /*DBGPRINT(RT_DEBUG_TRACE, ("BAR Seq = %x, LastIndSeq = %x\n", pFrame->BAStartingSeq.field.StartSeq, pBAEntry->LastIndSeq)); */ ba_indicate_reordering_mpdus_le_seq(pAd, pBAEntry, pFrame->BAStartingSeq.field. StartSeq); @@ -1302,7 +1302,7 @@ BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd, (pFrame->BAStartingSeq.field.StartSeq == 0) ? MAXSEQ : (pFrame->BAStartingSeq.field.StartSeq - 1); } - //ba_refresh_reordering_mpdus(pAd, pBAEntry); + /*ba_refresh_reordering_mpdus(pAd, pBAEntry); */ return TRUE; } @@ -1313,11 +1313,11 @@ VOID SendPSMPAction(IN PRTMP_ADAPTER pAd, IN UCHAR Wcid, IN UCHAR Psmp) { PUCHAR pOutBuffer = NULL; NDIS_STATUS NStatus; - //ULONG Idx; + /*ULONG Idx; */ FRAME_PSMP_ACTION Frame; ULONG FrameLen; - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_ERROR, ("BA - MlmeADDBAAction() allocate memory failed \n")); @@ -1337,7 +1337,7 @@ VOID SendPSMPAction(IN PRTMP_ADAPTER pAd, IN UCHAR Wcid, IN UCHAR Psmp) || pAd->Antenna.field.TxPath > 1)) { RTMP_ASIC_MMPS_DISABLE(pAd); } -#endif // RT30xx // +#endif /* RT30xx // */ Frame.Psmp = 0; break; case MMPS_DYNAMIC: @@ -1350,7 +1350,7 @@ VOID SendPSMPAction(IN PRTMP_ADAPTER pAd, IN UCHAR Wcid, IN UCHAR Psmp) || pAd->Antenna.field.TxPath > 1)) { RTMP_ASIC_MMPS_ENABLE(pAd); } -#endif // RT30xx // +#endif /* RT30xx // */ Frame.Psmp = 1; break; } @@ -1372,7 +1372,7 @@ typedef struct PACKED { UCHAR BSSID[MAC_ADDR_LEN]; UCHAR ReportingCondition; UCHAR Threshold; - UCHAR SSIDIE[2]; // 2 byte + UCHAR SSIDIE[2]; /* 2 byte */ } BEACON_REQUEST; typedef struct PACKED { @@ -1391,10 +1391,10 @@ void convert_reordering_packet_to_preAMSDU_or_802_3_packet(IN PRTMP_ADAPTER pAd, PNDIS_PACKET pRxPkt; UCHAR Header802_3[LENGTH_802_3]; - // 1. get 802.3 Header - // 2. remove LLC - // a. pointer pRxBlk->pData to payload - // b. modify pRxBlk->DataSize + /* 1. get 802.3 Header */ + /* 2. remove LLC */ + /* a. pointer pRxBlk->pData to payload */ + /* b. modify pRxBlk->DataSize */ RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(pRxBlk, Header802_3); @@ -1406,9 +1406,9 @@ void convert_reordering_packet_to_preAMSDU_or_802_3_packet(IN PRTMP_ADAPTER pAd, SET_OS_PKT_LEN(pRxPkt, pRxBlk->DataSize); SET_OS_PKT_DATATAIL(pRxPkt, pRxBlk->pData, pRxBlk->DataSize); - // - // copy 802.3 header, if necessary - // + /* */ + /* copy 802.3 header, if necessary */ + /* */ if (!RX_BLK_TEST_FLAG(pRxBlk, fRX_AMSDU)) { { #ifdef LINUX @@ -1446,7 +1446,7 @@ static VOID ba_enqueue_reordering_packet(IN PRTMP_ADAPTER pAd, mpdu_blk = ba_mpdu_blk_alloc(pAd); if ((mpdu_blk != NULL) && (!RX_BLK_TEST_FLAG(pRxBlk, fRX_EAP))) { - // Write RxD buffer address & allocated buffer length + /* Write RxD buffer address & allocated buffer length */ NdisAcquireSpinLock(&pBAEntry->RxReRingLock); mpdu_blk->Sequence = Sequence; @@ -1459,18 +1459,18 @@ static VOID ba_enqueue_reordering_packet(IN PRTMP_ADAPTER pAd, STATS_INC_RX_PACKETS(pAd, FromWhichBSSID); - // - // it is necessary for reordering packet to record - // which BSS it come from - // + /* */ + /* it is necessary for reordering packet to record */ + /* which BSS it come from */ + /* */ RTMP_SET_PACKET_IF(pRxBlk->pRxPacket, FromWhichBSSID); mpdu_blk->pPacket = pRxBlk->pRxPacket; if (ba_reordering_mpdu_insertsorted(&pBAEntry->list, mpdu_blk) == FALSE) { - // had been already within reordering list - // don't indicate + /* had been already within reordering list */ + /* don't indicate */ RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_SUCCESS); ba_mpdu_blk_free(pAd, mpdu_blk); @@ -1489,7 +1489,7 @@ static VOID ba_enqueue_reordering_packet(IN PRTMP_ADAPTER pAd, * and receving mpdu to upper layer * make tcp/ip to take care reordering mechanism */ - //ba_refresh_reordering_mpdus(pAd, pBAEntry); + /*ba_refresh_reordering_mpdus(pAd, pBAEntry); */ ba_indicate_reordering_mpdus_le_seq(pAd, pBAEntry, Sequence); pBAEntry->LastIndSeq = Sequence; @@ -1527,7 +1527,7 @@ VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd, if (!RX_BLK_TEST_FLAG(pRxBlk, fRX_AMSDU) && (pRxBlk->DataSize > MAX_RX_PKT_LEN)) { - // release packet + /* release packet */ RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); return; @@ -1542,9 +1542,9 @@ VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd, } pBAEntry = &pAd->BATable.BARecEntry[Idx]; } else { - // impossible !!! + /* impossible !!! */ ASSERT(0); - // release packet + /* release packet */ RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); return; @@ -1552,7 +1552,7 @@ VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd, ASSERT(pBAEntry); - // update last rx time + /* update last rx time */ NdisGetSystemUpTime(&Now32); pBAEntry->rcvSeq = Sequence; @@ -1560,23 +1560,23 @@ VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd, ba_flush_reordering_timeout_mpdus(pAd, pBAEntry, Now32); pBAEntry->LastIndSeqAtTimer = Now32; - // - // Reset Last Indicate Sequence - // + /* */ + /* Reset Last Indicate Sequence */ + /* */ if (pBAEntry->LastIndSeq == RESET_RCV_SEQ) { ASSERT((pBAEntry->list.qlen == 0) && (pBAEntry->list.next == NULL)); - // reset rcv sequence of BA session + /* reset rcv sequence of BA session */ pBAEntry->LastIndSeq = Sequence; pBAEntry->LastIndSeqAtTimer = Now32; INDICATE_LEGACY_OR_AMSDU(pAd, pRxBlk, FromWhichBSSID); return; } - // - // I. Check if in order. - // + /* */ + /* I. Check if in order. */ + /* */ if (SEQ_STEPONE(Sequence, pBAEntry->LastIndSeq, MAXSEQ)) { USHORT LastIndSeq; @@ -1590,29 +1590,29 @@ VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd, } pBAEntry->LastIndSeqAtTimer = Now32; } - // - // II. Drop Duplicated Packet - // + /* */ + /* II. Drop Duplicated Packet */ + /* */ else if (Sequence == pBAEntry->LastIndSeq) { - // drop and release packet + /* drop and release packet */ pBAEntry->nDropPacket++; RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); } - // - // III. Drop Old Received Packet - // + /* */ + /* III. Drop Old Received Packet */ + /* */ else if (SEQ_SMALLER(Sequence, pBAEntry->LastIndSeq, MAXSEQ)) { - // drop and release packet + /* drop and release packet */ pBAEntry->nDropPacket++; RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); } - // - // IV. Receive Sequence within Window Size - // + /* */ + /* IV. Receive Sequence within Window Size */ + /* */ else if (SEQ_SMALLER (Sequence, (((pBAEntry->LastIndSeq + pBAEntry->BAWinSize + 1)) & MAXSEQ), @@ -1620,9 +1620,9 @@ VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd, ba_enqueue_reordering_packet(pAd, pBAEntry, pRxBlk, FromWhichBSSID); } - // - // V. Receive seq surpasses Win(lastseq + nMSDU). So refresh all reorder buffer - // + /* */ + /* V. Receive seq surpasses Win(lastseq + nMSDU). So refresh all reorder buffer */ + /* */ else { LONG WinStartSeq, TmpSeq; @@ -1632,7 +1632,7 @@ VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd, } WinStartSeq = (TmpSeq + 1) & MAXSEQ; ba_indicate_reordering_mpdus_le_seq(pAd, pBAEntry, WinStartSeq); - pBAEntry->LastIndSeq = WinStartSeq; //TmpSeq; + pBAEntry->LastIndSeq = WinStartSeq; /*TmpSeq; */ pBAEntry->LastIndSeqAtTimer = Now32; diff --git a/drivers/staging/rt2860/common/cmm_aes.c b/drivers/staging/rt2860/common/cmm_aes.c index a3758b0b8a29..030678caf348 100644 --- a/drivers/staging/rt2860/common/cmm_aes.c +++ b/drivers/staging/rt2860/common/cmm_aes.c @@ -277,7 +277,7 @@ void construct_mic_header2(unsigned char *mic_header2, mic_header2[4] = mpdu[20]; mic_header2[5] = mpdu[21]; - // In Sequence Control field, mute sequence numer bits (12-bit) + /* In Sequence Control field, mute sequence numer bits (12-bit) */ mic_header2[6] = mpdu[22] & 0x0f; /* SC */ mic_header2[7] = 0x00; /* mpdu[23]; */ @@ -403,7 +403,7 @@ void construct_ctr_preload(unsigned char *ctr_preload, for (i = 8; i < 14; i++) ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */ #endif - ctr_preload[14] = (unsigned char)(c / 256); // Ctr + ctr_preload[14] = (unsigned char)(c / 256); /* Ctr */ ctr_preload[15] = (unsigned char)(c % 256); } @@ -477,12 +477,12 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, PN[4] = *(pData + HeaderLen + 6); PN[5] = *(pData + HeaderLen + 7); - payload_len = DataByteCnt - HeaderLen - 8 - 8; // 8 bytes for CCMP header , 8 bytes for MIC + payload_len = DataByteCnt - HeaderLen - 8 - 8; /* 8 bytes for CCMP header , 8 bytes for MIC */ payload_remainder = (payload_len) % 16; num_blocks = (payload_len) / 16; - // Find start of payload - payload_index = HeaderLen + 8; //IV+EIV + /* Find start of payload */ + payload_index = HeaderLen + 8; /*IV+EIV */ for (i = 0; i < num_blocks; i++) { construct_ctr_preload(ctr_preload, @@ -495,10 +495,10 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, payload_index += 16; } - // - // If there is a short final block, then pad it - // encrypt it and copy the unpadded part back - // + /* */ + /* If there is a short final block, then pad it */ + /* encrypt it and copy the unpadded part back */ + /* */ if (payload_remainder > 0) { construct_ctr_preload(ctr_preload, a4_exists, @@ -515,9 +515,9 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, payload_remainder); payload_index += payload_remainder; } - // - // Descrypt the MIC - // + /* */ + /* Descrypt the MIC */ + /* */ construct_ctr_preload(ctr_preload, a4_exists, qc_exists, pData, PN, 0); NdisZeroMemory(padded_buffer, 16); NdisMoveMemory(padded_buffer, pData + payload_index, 8); @@ -528,15 +528,15 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, NdisMoveMemory(TrailMIC, chain_buffer, 8); - // - // Calculate MIC - // + /* */ + /* Calculate MIC */ + /* */ - //Force the protected frame bit on + /*Force the protected frame bit on */ *(pData + 1) = *(pData + 1) | 0x40; - // Find start of payload - // Because the CCMP header has been removed + /* Find start of payload */ + /* Because the CCMP header has been removed */ payload_index = HeaderLen; construct_mic_iv(mic_iv, qc_exists, a4_exists, pData, payload_len, PN); @@ -551,14 +551,14 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, bitwise_xor(aes_out, mic_header2, chain_buffer); aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); - // iterate through each 16 byte payload block + /* iterate through each 16 byte payload block */ for (i = 0; i < num_blocks; i++) { bitwise_xor(aes_out, pData + payload_index, chain_buffer); payload_index += 16; aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); } - // Add on the final payload block if it needs padding + /* Add on the final payload block if it needs padding */ if (payload_remainder > 0) { NdisZeroMemory(padded_buffer, 16); NdisMoveMemory(padded_buffer, pData + payload_index, @@ -567,13 +567,13 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, bitwise_xor(aes_out, padded_buffer, chain_buffer); aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); } - // aes_out contains padded mic, discard most significant - // 8 bytes to generate 64 bit MIC + /* aes_out contains padded mic, discard most significant */ + /* 8 bytes to generate 64 bit MIC */ for (i = 0; i < 8; i++) MIC[i] = aes_out[i]; if (!NdisEqualMemory(MIC, TrailMIC, 8)) { - DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptAES, MIC Error !\n")); //MIC error. + DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptAES, MIC Error !\n")); /*MIC error. */ return FALSE; } @@ -1208,27 +1208,27 @@ VOID AES_GTK_KEY_WRAP(IN UCHAR * key, { UCHAR A[8], BIN[16], BOUT[16]; UCHAR R[512]; - INT num_blocks = p_len / 8; // unit:64bits + INT num_blocks = p_len / 8; /* unit:64bits */ INT i, j; aes_context aesctx; UCHAR xor; rt_aes_set_key(&aesctx, key, 128); - // Init IA + /* Init IA */ for (i = 0; i < 8; i++) A[i] = 0xa6; - //Input plaintext + /*Input plaintext */ for (i = 0; i < num_blocks; i++) { for (j = 0; j < 8; j++) R[8 * (i + 1) + j] = plaintext[8 * i + j]; } - // Key Mix + /* Key Mix */ for (j = 0; j < 6; j++) { for (i = 1; i <= num_blocks; i++) { - //phase 1 + /*phase 1 */ NdisMoveMemory(BIN, A, 8); NdisMoveMemory(&BIN[8], &R[8 * i], 8); rt_aes_encrypt(&aesctx, BIN, BOUT); @@ -1240,7 +1240,7 @@ VOID AES_GTK_KEY_WRAP(IN UCHAR * key, } } - // Output ciphertext + /* Output ciphertext */ NdisMoveMemory(ciphertext, A, 8); for (i = 1; i <= num_blocks; i++) { @@ -1273,7 +1273,7 @@ VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key, INT i, j; aes_context aesctx; UCHAR *R; - INT num_blocks = c_len / 8; // unit:64bits + INT num_blocks = c_len / 8; /* unit:64bits */ os_alloc_mem(NULL, (PUCHAR *) & R, 512); @@ -1283,9 +1283,9 @@ VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key, return; } /* End of if */ - // Initialize + /* Initialize */ NdisMoveMemory(A, ciphertext, 8); - //Input plaintext + /*Input plaintext */ for (i = 0; i < (c_len - 8); i++) { R[i] = ciphertext[i + 8]; } @@ -1304,7 +1304,7 @@ VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key, } } - // OUTPUT + /* OUTPUT */ for (i = 0; i < c_len; i++) { plaintext[i] = R[i]; } diff --git a/drivers/staging/rt2860/common/cmm_asic.c b/drivers/staging/rt2860/common/cmm_asic.c index 7205b36281e4..468aba574f46 100644 --- a/drivers/staging/rt2860/common/cmm_asic.c +++ b/drivers/staging/rt2860/common/cmm_asic.c @@ -37,9 +37,9 @@ #include "../rt_config.h" -// Reset the RFIC setting to new series +/* Reset the RFIC setting to new series */ RTMP_RF_REGS RF2850RegTable[] = { -// ch R1 R2 R3(TX0~4=0) R4 +/* ch R1 R2 R3(TX0~4=0) R4 */ {1, 0x98402ecc, 0x984c0786, 0x9816b455, 0x9800510b} , {2, 0x98402ecc, 0x984c0786, 0x98168a55, 0x9800519f} @@ -69,7 +69,7 @@ RTMP_RF_REGS RF2850RegTable[] = { {14, 0x98402ecc, 0x984c07a2, 0x98168a55, 0x98005193} , - // 802.11 UNI / HyperLan 2 + /* 802.11 UNI / HyperLan 2 */ {36, 0x98402ecc, 0x984c099a, 0x98158a55, 0x980ed1a3} , {38, 0x98402ecc, 0x984c099e, 0x98158a55, 0x980ed193} @@ -93,15 +93,15 @@ RTMP_RF_REGS RF2850RegTable[] = { {62, 0x98402ec8, 0x984c0692, 0x98158a55, 0x980ed193} , {64, 0x98402ec8, 0x984c0692, 0x98158a55, 0x980ed1a3} - , // Plugfest#4, Day4, change RFR3 left4th 9->5. + , /* Plugfest#4, Day4, change RFR3 left4th 9->5. */ - // 802.11 HyperLan 2 + /* 802.11 HyperLan 2 */ {100, 0x98402ec8, 0x984c06b2, 0x98178a55, 0x980ed783} , - // 2008.04.30 modified - // The system team has AN to improve the EVM value - // for channel 102 to 108 for the RT2850/RT2750 dual band solution. + /* 2008.04.30 modified */ + /* The system team has AN to improve the EVM value */ + /* for channel 102 to 108 for the RT2850/RT2750 dual band solution. */ {102, 0x98402ec8, 0x985c06b2, 0x98578a55, 0x980ed793} , {104, 0x98402ec8, 0x985c06b2, 0x98578a55, 0x980ed1a3} @@ -122,7 +122,7 @@ RTMP_RF_REGS RF2850RegTable[] = { {124, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed193} , {126, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed15b} - , // 0x980ed1bb->0x980ed15b required by Rory 20070927 + , /* 0x980ed1bb->0x980ed15b required by Rory 20070927 */ {128, 0x98402ec4, 0x984c0382, 0x98178a55, 0x980ed1a3} , {132, 0x98402ec4, 0x984c0386, 0x98178a55, 0x980ed18b} @@ -134,7 +134,7 @@ RTMP_RF_REGS RF2850RegTable[] = { {140, 0x98402ec4, 0x984c038a, 0x98178a55, 0x980ed183} , - // 802.11 UNII + /* 802.11 UNII */ {149, 0x98402ec4, 0x984c038a, 0x98178a55, 0x980ed1a7} , {151, 0x98402ec4, 0x984c038e, 0x98178a55, 0x980ed187} @@ -158,7 +158,7 @@ RTMP_RF_REGS RF2850RegTable[] = { {173, 0x98402ec4, 0x984c03d6, 0x98179855, 0x9815530f} , - // Japan + /* Japan */ {184, 0x95002ccc, 0x9500491e, 0x9509be55, 0x950c0a0b} , {188, 0x95002ccc, 0x95004922, 0x9509be55, 0x950c0a13} @@ -174,18 +174,18 @@ RTMP_RF_REGS RF2850RegTable[] = { {216, 0x95002ccc, 0x95004982, 0x9509be55, 0x950c0a23} , - // still lack of MMAC(Japan) ch 34,38,42,46 + /* still lack of MMAC(Japan) ch 34,38,42,46 */ }; UCHAR NUM_OF_2850_CHNL = (sizeof(RF2850RegTable) / sizeof(RTMP_RF_REGS)); FREQUENCY_ITEM FreqItems3020[] = { /**************************************************/ - // ISM : 2.4 to 2.483 GHz // + /* ISM : 2.4 to 2.483 GHz // */ /**************************************************/ - // 11g + /* 11g */ /**************************************************/ - //-CH---N-------R---K----------- + /*-CH---N-------R---K----------- */ {1, 241, 2, 2} , {2, 241, 2, 7} @@ -227,7 +227,7 @@ VOID AsicUpdateAutoFallBackTable(IN PRTMP_ADAPTER pAd, IN PUCHAR pRateTable) LG_FBK_CFG1_STRUC LgCfg1; PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate; - // set to initial value + /* set to initial value */ HtCfg0.word = 0x65432100; HtCfg1.word = 0xedcba988; LgCfg0.word = 0xedcba988; @@ -237,9 +237,9 @@ VOID AsicUpdateAutoFallBackTable(IN PRTMP_ADAPTER pAd, IN PUCHAR pRateTable) for (i = 1; i < *((PUCHAR) pRateTable); i++) { pCurrTxRate = (PRTMP_TX_RATE_SWITCH) pRateTable + 1 + i; switch (pCurrTxRate->Mode) { - case 0: //CCK + case 0: /*CCK */ break; - case 1: //OFDM + case 1: /*OFDM */ { switch (pCurrTxRate->CurrMCS) { case 0: @@ -309,8 +309,8 @@ VOID AsicUpdateAutoFallBackTable(IN PRTMP_ADAPTER pAd, IN PUCHAR pRateTable) } } break; - case 2: //HT-MIX - case 3: //HT-GF + case 2: /*HT-MIX */ + case 3: /*HT-GF */ { if ((pNextTxRate->Mode >= MODE_HTMIX) && (pCurrTxRate->CurrMCS != @@ -433,16 +433,16 @@ VOID AsicUpdateProtect(IN PRTMP_ADAPTER pAd, } if (pAd->BATable.numDoneOriginator) { - // - // enable the RTS/CTS to avoid channel collision - // + /* */ + /* enable the RTS/CTS to avoid channel collision */ + /* */ SetMask = ALLN_SETPROTECT; OperationMode = 8; } - // Config ASIC RTS threshold register + /* Config ASIC RTS threshold register */ RTMP_IO_READ32(pAd, TX_RTS_CFG, &MacReg); MacReg &= 0xFF0000FF; - // If the user want disable RtsThreshold and enable Amsdu/Ralink-Aggregation, set the RtsThreshold as 4096 + /* If the user want disable RtsThreshold and enable Amsdu/Ralink-Aggregation, set the RtsThreshold as 4096 */ if (((pAd->CommonCfg.BACapability.field.AmsduEnable) || (pAd->CommonCfg.bAggregationCapable == TRUE)) && pAd->CommonCfg.RtsThreshold == MAX_RTS_THRESHOLD) { @@ -453,7 +453,7 @@ VOID AsicUpdateProtect(IN PRTMP_ADAPTER pAd, RTMP_IO_WRITE32(pAd, TX_RTS_CFG, MacReg); - // Initial common protection settings + /* Initial common protection settings */ RTMPZeroMemory(Protect, sizeof(Protect)); ProtCfg4.word = 0; ProtCfg.word = 0; @@ -466,72 +466,72 @@ VOID AsicUpdateProtect(IN PRTMP_ADAPTER pAd, ProtCfg.field.RTSThEn = 1; ProtCfg.field.ProtectNav = ASIC_SHORTNAV; - // update PHY mode and rate + /* update PHY mode and rate */ if (pAd->CommonCfg.Channel > 14) ProtCfg.field.ProtectRate = 0x4000; ProtCfg.field.ProtectRate |= pAd->CommonCfg.RtsRate; - // Handle legacy(B/G) protection + /* Handle legacy(B/G) protection */ if (bDisableBGProtect) { - //ProtCfg.field.ProtectRate = pAd->CommonCfg.RtsRate; + /*ProtCfg.field.ProtectRate = pAd->CommonCfg.RtsRate; */ ProtCfg.field.ProtectCtrl = 0; Protect[0] = ProtCfg.word; Protect[1] = ProtCfg.word; pAd->FlgCtsEnabled = 0; /* CTS-self is not used */ } else { - //ProtCfg.field.ProtectRate = pAd->CommonCfg.RtsRate; - ProtCfg.field.ProtectCtrl = 0; // CCK do not need to be protected + /*ProtCfg.field.ProtectRate = pAd->CommonCfg.RtsRate; */ + ProtCfg.field.ProtectCtrl = 0; /* CCK do not need to be protected */ Protect[0] = ProtCfg.word; - ProtCfg.field.ProtectCtrl = ASIC_CTS; // OFDM needs using CCK to protect + ProtCfg.field.ProtectCtrl = ASIC_CTS; /* OFDM needs using CCK to protect */ Protect[1] = ProtCfg.word; pAd->FlgCtsEnabled = 1; /* CTS-self is used */ } - // Decide HT frame protection. + /* Decide HT frame protection. */ if ((SetMask & ALLN_SETPROTECT) != 0) { switch (OperationMode) { case 0x0: - // NO PROTECT - // 1.All STAs in the BSS are 20/40 MHz HT - // 2. in ai 20/40MHz BSS - // 3. all STAs are 20MHz in a 20MHz BSS - // Pure HT. no protection. - - // MM20_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 010111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4004 (OFDM 24M) + /* NO PROTECT */ + /* 1.All STAs in the BSS are 20/40 MHz HT */ + /* 2. in ai 20/40MHz BSS */ + /* 3. all STAs are 20MHz in a 20MHz BSS */ + /* Pure HT. no protection. */ + + /* MM20_PROT_CFG */ + /* Reserved (31:27) */ + /* PROT_TXOP(25:20) -- 010111 */ + /* PROT_NAV(19:18) -- 01 (Short NAV protection) */ + /* PROT_CTRL(17:16) -- 00 (None) */ + /* PROT_RATE(15:0) -- 0x4004 (OFDM 24M) */ Protect[2] = 0x01744004; - // MM40_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 111111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4084 (duplicate OFDM 24M) + /* MM40_PROT_CFG */ + /* Reserved (31:27) */ + /* PROT_TXOP(25:20) -- 111111 */ + /* PROT_NAV(19:18) -- 01 (Short NAV protection) */ + /* PROT_CTRL(17:16) -- 00 (None) */ + /* PROT_RATE(15:0) -- 0x4084 (duplicate OFDM 24M) */ Protect[3] = 0x03f44084; - // CF20_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 010111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4004 (OFDM 24M) + /* CF20_PROT_CFG */ + /* Reserved (31:27) */ + /* PROT_TXOP(25:20) -- 010111 */ + /* PROT_NAV(19:18) -- 01 (Short NAV protection) */ + /* PROT_CTRL(17:16) -- 00 (None) */ + /* PROT_RATE(15:0) -- 0x4004 (OFDM 24M) */ Protect[4] = 0x01744004; - // CF40_PROT_CFG - // Reserved (31:27) - // PROT_TXOP(25:20) -- 111111 - // PROT_NAV(19:18) -- 01 (Short NAV protection) - // PROT_CTRL(17:16) -- 00 (None) - // PROT_RATE(15:0) -- 0x4084 (duplicate OFDM 24M) + /* CF40_PROT_CFG */ + /* Reserved (31:27) */ + /* PROT_TXOP(25:20) -- 111111 */ + /* PROT_NAV(19:18) -- 01 (Short NAV protection) */ + /* PROT_CTRL(17:16) -- 00 (None) */ + /* PROT_RATE(15:0) -- 0x4084 (duplicate OFDM 24M) */ Protect[5] = 0x03f44084; if (bNonGFExist) { - // PROT_NAV(19:18) -- 01 (Short NAV protectiion) - // PROT_CTRL(17:16) -- 01 (RTS/CTS) + /* PROT_NAV(19:18) -- 01 (Short NAV protectiion) */ + /* PROT_CTRL(17:16) -- 01 (RTS/CTS) */ Protect[4] = 0x01754004; Protect[5] = 0x03f54084; } @@ -539,16 +539,16 @@ VOID AsicUpdateProtect(IN PRTMP_ADAPTER pAd, break; case 1: - // This is "HT non-member protection mode." - // If there may be non-HT STAs my BSS - ProtCfg.word = 0x01744004; // PROT_CTRL(17:16) : 0 (None) - ProtCfg4.word = 0x03f44084; // duplicaet legacy 24M. BW set 1. + /* This is "HT non-member protection mode." */ + /* If there may be non-HT STAs my BSS */ + ProtCfg.word = 0x01744004; /* PROT_CTRL(17:16) : 0 (None) */ + ProtCfg4.word = 0x03f44084; /* duplicaet legacy 24M. BW set 1. */ if (OPSTATUS_TEST_FLAG (pAd, fOP_STATUS_BG_PROTECTION_INUSED)) { - ProtCfg.word = 0x01740003; //ERP use Protection bit is set, use protection rate at Clause 18.. - ProtCfg4.word = 0x03f40003; // Don't duplicate RTS/CTS in CCK mode. 0x03f40083; + ProtCfg.word = 0x01740003; /*ERP use Protection bit is set, use protection rate at Clause 18.. */ + ProtCfg4.word = 0x03f40003; /* Don't duplicate RTS/CTS in CCK mode. 0x03f40083; */ } - //Assign Protection method for 20&40 MHz packets + /*Assign Protection method for 20&40 MHz packets */ ProtCfg.field.ProtectCtrl = ASIC_RTS; ProtCfg.field.ProtectNav = ASIC_SHORTNAV; ProtCfg4.field.ProtectCtrl = ASIC_RTS; @@ -561,11 +561,11 @@ VOID AsicUpdateProtect(IN PRTMP_ADAPTER pAd, break; case 2: - // If only HT STAs are in BSS. at least one is 20MHz. Only protect 40MHz packets - ProtCfg.word = 0x01744004; // PROT_CTRL(17:16) : 0 (None) - ProtCfg4.word = 0x03f44084; // duplicaet legacy 24M. BW set 1. + /* If only HT STAs are in BSS. at least one is 20MHz. Only protect 40MHz packets */ + ProtCfg.word = 0x01744004; /* PROT_CTRL(17:16) : 0 (None) */ + ProtCfg4.word = 0x03f44084; /* duplicaet legacy 24M. BW set 1. */ - //Assign Protection method for 40MHz packets + /*Assign Protection method for 40MHz packets */ ProtCfg4.field.ProtectCtrl = ASIC_RTS; ProtCfg4.field.ProtectNav = ASIC_SHORTNAV; Protect[2] = ProtCfg.word; @@ -581,17 +581,17 @@ VOID AsicUpdateProtect(IN PRTMP_ADAPTER pAd, break; case 3: - // HT mixed mode. PROTECT ALL! - // Assign Rate - ProtCfg.word = 0x01744004; //duplicaet legacy 24M. BW set 1. + /* HT mixed mode. PROTECT ALL! */ + /* Assign Rate */ + ProtCfg.word = 0x01744004; /*duplicaet legacy 24M. BW set 1. */ ProtCfg4.word = 0x03f44084; - // both 20MHz and 40MHz are protected. Whether use RTS or CTS-to-self depends on the + /* both 20MHz and 40MHz are protected. Whether use RTS or CTS-to-self depends on the */ if (OPSTATUS_TEST_FLAG (pAd, fOP_STATUS_BG_PROTECTION_INUSED)) { - ProtCfg.word = 0x01740003; //ERP use Protection bit is set, use protection rate at Clause 18.. - ProtCfg4.word = 0x03f40003; // Don't duplicate RTS/CTS in CCK mode. 0x03f40083 + ProtCfg.word = 0x01740003; /*ERP use Protection bit is set, use protection rate at Clause 18.. */ + ProtCfg4.word = 0x03f40003; /* Don't duplicate RTS/CTS in CCK mode. 0x03f40083 */ } - //Assign Protection method for 20&40 MHz packets + /*Assign Protection method for 20&40 MHz packets */ ProtCfg.field.ProtectCtrl = ASIC_RTS; ProtCfg.field.ProtectNav = ASIC_SHORTNAV; ProtCfg4.field.ProtectCtrl = ASIC_RTS; @@ -604,7 +604,7 @@ VOID AsicUpdateProtect(IN PRTMP_ADAPTER pAd, break; case 8: - // Special on for Atheros problem n chip. + /* Special on for Atheros problem n chip. */ Protect[2] = 0x01754004; Protect[3] = 0x03f54084; Protect[4] = 0x01754004; @@ -634,17 +634,17 @@ VOID AsicUpdateProtect(IN PRTMP_ADAPTER pAd, VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) { ULONG R2 = 0, R3 = DEFAULT_RF_TX_POWER, R4 = 0; - CHAR TxPwer = 0, TxPwer2 = DEFAULT_RF_TX_POWER; //Bbp94 = BBPR94_DEFAULT, TxPwer2 = DEFAULT_RF_TX_POWER; + CHAR TxPwer = 0, TxPwer2 = DEFAULT_RF_TX_POWER; /*Bbp94 = BBPR94_DEFAULT, TxPwer2 = DEFAULT_RF_TX_POWER; */ UCHAR index; - UINT32 Value = 0; //BbpReg, Value; + UINT32 Value = 0; /*BbpReg, Value; */ RTMP_RF_REGS *RFRegTable; UCHAR RFValue; RFValue = 0; - // Search Tx power value - // We can't use ChannelList to search channel, since some central channl's txpowr doesn't list - // in ChannelList, so use TxPower array instead. - // + /* Search Tx power value */ + /* We can't use ChannelList to search channel, since some central channl's txpowr doesn't list */ + /* in ChannelList, so use TxPower array instead. */ + /* */ for (index = 0; index < MAX_NUM_OF_CHANNELS; index++) { if (Channel == pAd->TxPower[index].Channel) { TxPwer = pAd->TxPower[index].Power; @@ -659,7 +659,7 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) Channel)); } #ifdef RT30xx - // The RF programming sequence is difference between 3xxx and 2xxx + /* The RF programming sequence is difference between 3xxx and 2xxx */ if ((IS_RT3070(pAd) || IS_RT3090(pAd) || IS_RT3390(pAd)) && ((pAd->RfIcType == RFIC_3020) || (pAd->RfIcType == RFIC_2020) || (pAd->RfIcType == RFIC_3021) @@ -668,7 +668,7 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) for (index = 0; index < NUM_OF_3020_CHNL; index++) { if (Channel == FreqItems3020[index].Channel) { - // Programming channel parameters + /* Programming channel parameters */ RT30xxWriteRFRegister(pAd, RF_R02, FreqItems3020[index].N); RT30xxWriteRFRegister(pAd, RF_R03, @@ -678,21 +678,21 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) (RFValue & 0xFC) | FreqItems3020[index].R; RT30xxWriteRFRegister(pAd, RF_R06, RFValue); - // Set Tx0 Power + /* Set Tx0 Power */ RT30xxReadRFRegister(pAd, RF_R12, &RFValue); RFValue = (RFValue & 0xE0) | TxPwer; RT30xxWriteRFRegister(pAd, RF_R12, RFValue); - // Set Tx1 Power + /* Set Tx1 Power */ RT30xxReadRFRegister(pAd, RF_R13, &RFValue); RFValue = (RFValue & 0xE0) | TxPwer2; RT30xxWriteRFRegister(pAd, RF_R13, RFValue); - // Tx/Rx Stream setting + /* Tx/Rx Stream setting */ RT30xxReadRFRegister(pAd, RF_R01, &RFValue); - //if (IS_RT3090(pAd)) - // RFValue |= 0x01; // Enable RF block. - RFValue &= 0x03; //clear bit[7~2] + /*if (IS_RT3090(pAd)) */ + /* RFValue |= 0x01; // Enable RF block. */ + RFValue &= 0x03; /*clear bit[7~2] */ if (pAd->Antenna.field.TxPath == 1) RFValue |= 0xA0; else if (pAd->Antenna.field.TxPath == 2) @@ -703,28 +703,28 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) RFValue |= 0x40; RT30xxWriteRFRegister(pAd, RF_R01, RFValue); - // Set RF offset + /* Set RF offset */ RT30xxReadRFRegister(pAd, RF_R23, &RFValue); RFValue = (RFValue & 0x80) | pAd->RfFreqOffset; RT30xxWriteRFRegister(pAd, RF_R23, RFValue); - // Set BW + /* Set BW */ if (!bScan && (pAd->CommonCfg.BBPCurrentBW == BW_40)) { RFValue = pAd->Mlme.CaliBW40RfR24; - //DISABLE_11N_CHECK(pAd); + /*DISABLE_11N_CHECK(pAd); */ } else { RFValue = pAd->Mlme.CaliBW20RfR24; } RT30xxWriteRFRegister(pAd, RF_R24, RFValue); RT30xxWriteRFRegister(pAd, RF_R31, RFValue); - // Enable RF tuning + /* Enable RF tuning */ RT30xxReadRFRegister(pAd, RF_R07, &RFValue); RFValue = RFValue | 0x1; RT30xxWriteRFRegister(pAd, RF_R07, RFValue); - // latch channel for future usage. + /* latch channel for future usage. */ pAd->LatchRfRegs.Channel = Channel; DBGPRINT(RT_DEBUG_TRACE, @@ -739,7 +739,7 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) } } } else -#endif // RT30xx // +#endif /* RT30xx // */ { RFRegTable = RF2850RegTable; switch (pAd->RfIcType) { @@ -752,26 +752,26 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) if (Channel == RFRegTable[index].Channel) { R2 = RFRegTable[index].R2; if (pAd->Antenna.field.TxPath == 1) { - R2 |= 0x4000; // If TXpath is 1, bit 14 = 1; + R2 |= 0x4000; /* If TXpath is 1, bit 14 = 1; */ } if (pAd->Antenna.field.RxPath == 2) { - R2 |= 0x40; // write 1 to off Rxpath. + R2 |= 0x40; /* write 1 to off Rxpath. */ } else if (pAd->Antenna.field.RxPath == 1) { - R2 |= 0x20040; // write 1 to off RxPath + R2 |= 0x20040; /* write 1 to off RxPath */ } if (Channel > 14) { - // initialize R3, R4 + /* initialize R3, R4 */ R3 = (RFRegTable[index]. R3 & 0xffffc1ff); R4 = (RFRegTable[index]. R4 & (~0x001f87c0)) | (pAd->RfFreqOffset << 15); - // 5G band power range: 0xF9~0X0F, TX0 Reg3 bit9/TX1 Reg4 bit6="0" means the TX power reduce 7dB - // R3 + /* 5G band power range: 0xF9~0X0F, TX0 Reg3 bit9/TX1 Reg4 bit6="0" means the TX power reduce 7dB */ + /* R3 */ if ((TxPwer >= -7) && (TxPwer < 0)) { TxPwer = (7 + TxPwer); @@ -794,7 +794,7 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) 9); } - // R4 + /* R4 */ if ((TxPwer2 >= -7) && (TxPwer2 < 0)) { TxPwer2 = (7 + TxPwer2); @@ -817,17 +817,17 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) 6); } } else { - R3 = (RFRegTable[index].R3 & 0xffffc1ff) | (TxPwer << 9); // set TX power0 - R4 = (RFRegTable[index].R4 & (~0x001f87c0)) | (pAd->RfFreqOffset << 15) | (TxPwer2 << 6); // Set freq Offset & TxPwr1 + R3 = (RFRegTable[index].R3 & 0xffffc1ff) | (TxPwer << 9); /* set TX power0 */ + R4 = (RFRegTable[index].R4 & (~0x001f87c0)) | (pAd->RfFreqOffset << 15) | (TxPwer2 << 6); /* Set freq Offset & TxPwr1 */ } - // Based on BBP current mode before changing RF channel. + /* Based on BBP current mode before changing RF channel. */ if (!bScan && (pAd->CommonCfg.BBPCurrentBW == BW_40)) { R4 |= 0x200000; } - // Update variables + /* Update variables */ pAd->LatchRfRegs.Channel = Channel; pAd->LatchRfRegs.R1 = RFRegTable[index].R1; @@ -835,7 +835,7 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) pAd->LatchRfRegs.R3 = R3; pAd->LatchRfRegs.R4 = R4; - // Set RF value 1's set R3[bit2] = [0] + /* Set RF value 1's set R3[bit2] = [0] */ RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R1); RTMP_RF_IO_WRITE32(pAd, @@ -848,7 +848,7 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) RTMPusecDelay(200); - // Set RF value 2's set R3[bit2] = [1] + /* Set RF value 2's set R3[bit2] = [1] */ RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R1); RTMP_RF_IO_WRITE32(pAd, @@ -861,7 +861,7 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) RTMPusecDelay(200); - // Set RF value 3's set R3[bit2] = [0] + /* Set RF value 3's set R3[bit2] = [0] */ RTMP_RF_IO_WRITE32(pAd, pAd->LatchRfRegs.R1); RTMP_RF_IO_WRITE32(pAd, @@ -889,9 +889,9 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) pAd->LatchRfRegs.R3, pAd->LatchRfRegs.R4)); } - // Change BBP setting during siwtch from a->g, g->a + /* Change BBP setting during siwtch from a->g, g->a */ if (Channel <= 14) { - ULONG TxPinCfg = 0x00050F0A; //Gary 2007/08/09 0x050A0A + ULONG TxPinCfg = 0x00050F0A; /*Gary 2007/08/09 0x050A0A */ RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R62, (0x37 - GET_LNA_GAIN(pAd))); @@ -899,10 +899,10 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) (0x37 - GET_LNA_GAIN(pAd))); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R64, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R86, 0); //(0x44 - GET_LNA_GAIN(pAd))); // According the Rory's suggestion to solve the middle range issue. - //RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0x62); + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R86, 0); /*(0x44 - GET_LNA_GAIN(pAd))); // According the Rory's suggestion to solve the middle range issue. */ + /*RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0x62); */ - // Rx High power VGA offset for LNA select + /* Rx High power VGA offset for LNA select */ if (pAd->NicConfig2.field.ExternalLNAForG) { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0x62); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x46); @@ -911,13 +911,13 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x50); } - // 5G band selection PIN, bit1 and bit2 are complement + /* 5G band selection PIN, bit1 and bit2 are complement */ RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value); Value &= (~0x6); Value |= (0x04); RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); - // Turn off unused PA or LNA when only 1T or 1R + /* Turn off unused PA or LNA when only 1T or 1R */ if (pAd->Antenna.field.TxPath == 1) { TxPinCfg &= 0xFFFFFFF3; } @@ -928,7 +928,7 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg); #if defined(RT3090) || defined(RT3390) - // PCIe PHY Transmit attenuation adjustment + /* PCIe PHY Transmit attenuation adjustment */ if (IS_RT3090A(pAd) || IS_RT3390(pAd)) { TX_ATTENUATION_CTRL_STRUC TxAttenuationCtrl = { .word = 0}; @@ -936,14 +936,14 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) RTMP_IO_READ32(pAd, PCIE_PHY_TX_ATTENUATION_CTRL, &TxAttenuationCtrl.word); - if (Channel == 14) // Channel #14 + if (Channel == 14) /* Channel #14 */ { - TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_EN = 1; // Enable PCIe PHY Tx attenuation - TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_VALUE = 4; // 9/16 full drive level - } else // Channel #1~#13 + TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_EN = 1; /* Enable PCIe PHY Tx attenuation */ + TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_VALUE = 4; /* 9/16 full drive level */ + } else /* Channel #1~#13 */ { - TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_EN = 0; // Disable PCIe PHY Tx attenuation - TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_VALUE = 0; // n/a + TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_EN = 0; /* Disable PCIe PHY Tx attenuation */ + TxAttenuationCtrl.field.PCIE_PHY_TX_ATTEN_VALUE = 0; /* n/a */ } RTMP_IO_WRITE32(pAd, PCIE_PHY_TX_ATTENUATION_CTRL, @@ -951,7 +951,7 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) } #endif } else { - ULONG TxPinCfg = 0x00050F05; //Gary 2007/8/9 0x050505 + ULONG TxPinCfg = 0x00050F05; /*Gary 2007/8/9 0x050505 */ RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R62, (0x37 - GET_LNA_GAIN(pAd))); @@ -959,23 +959,23 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) (0x37 - GET_LNA_GAIN(pAd))); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R64, (0x37 - GET_LNA_GAIN(pAd))); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R86, 0); //(0x44 - GET_LNA_GAIN(pAd))); // According the Rory's suggestion to solve the middle range issue. + RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R86, 0); /*(0x44 - GET_LNA_GAIN(pAd))); // According the Rory's suggestion to solve the middle range issue. */ RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R82, 0xF2); - // Rx High power VGA offset for LNA select + /* Rx High power VGA offset for LNA select */ if (pAd->NicConfig2.field.ExternalLNAForA) { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x46); } else { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R75, 0x50); } - // 5G band selection PIN, bit1 and bit2 are complement + /* 5G band selection PIN, bit1 and bit2 are complement */ RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value); Value &= (~0x6); Value |= (0x02); RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); - // Turn off unused PA or LNA when only 1T or 1R + /* Turn off unused PA or LNA when only 1T or 1R */ if (pAd->Antenna.field.TxPath == 1) { TxPinCfg &= 0xFFFFFFF3; } @@ -987,18 +987,18 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) } - // R66 should be set according to Channel and use 20MHz when scanning - //RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, (0x2E + GET_LNA_GAIN(pAd))); + /* R66 should be set according to Channel and use 20MHz when scanning */ + /*RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, (0x2E + GET_LNA_GAIN(pAd))); */ if (bScan) RTMPSetAGCInitValue(pAd, BW_20); else RTMPSetAGCInitValue(pAd, pAd->CommonCfg.BBPCurrentBW); - // - // On 11A, We should delay and wait RF/BBP to be stable - // and the appropriate time should be 1000 micro seconds - // 2005/06/05 - On 11G, We also need this delay time. Otherwise it's difficult to pass the WHQL. - // + /* */ + /* On 11A, We should delay and wait RF/BBP to be stable */ + /* and the appropriate time should be 1000 micro seconds */ + /* 2005/06/05 - On 11G, We also need this delay time. Otherwise it's difficult to pass the WHQL. */ + /* */ RTMPusecDelay(1000); } @@ -1006,7 +1006,7 @@ VOID AsicResetBBPAgent(IN PRTMP_ADAPTER pAd) { BBP_CSR_CFG_STRUC BbpCsr; DBGPRINT(RT_DEBUG_ERROR, ("Reset BBP Agent busy bit.!! \n")); - // Still need to find why BBP agent keeps busy, but in fact, hardware still function ok. Now clear busy first. + /* Still need to find why BBP agent keeps busy, but in fact, hardware still function ok. Now clear busy first. */ RTMP_IO_READ32(pAd, H2M_BBP_AGENT, &BbpCsr.word); BbpCsr.field.Busy = 0; RTMP_IO_WRITE32(pAd, H2M_BBP_AGENT, BbpCsr.word); @@ -1067,7 +1067,7 @@ VOID AsicAdjustTxPower(IN PRTMP_ADAPTER pAd) if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) || #ifdef RTMP_MAC_PCI (pAd->bPCIclkOff == TRUE) || -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF) || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) return; @@ -1107,7 +1107,7 @@ VOID AsicAdjustTxPower(IN PRTMP_ADAPTER pAd) } } - // TX power compensation for temperature variation based on TSSI. try every 4 second + /* TX power compensation for temperature variation based on TSSI. try every 4 second */ if (pAd->Mlme.OneSecPeriodicRound % 4 == 0) { if (pAd->CommonCfg.Channel <= 14) { /* bg channel */ @@ -1145,30 +1145,30 @@ VOID AsicAdjustTxPower(IN PRTMP_ADAPTER pAd) /* if value is 0xa5, tx power will be -= TxAgcStep*(2-1) */ if (BbpR49 > pTssiMinusBoundary[1]) { - // Reading is larger than the reference value - // check for how large we need to decrease the Tx power + /* Reading is larger than the reference value */ + /* check for how large we need to decrease the Tx power */ for (idx = 1; idx < 5; idx++) { - if (BbpR49 <= pTssiMinusBoundary[idx]) // Found the range + if (BbpR49 <= pTssiMinusBoundary[idx]) /* Found the range */ break; } - // The index is the step we should decrease, idx = 0 means there is nothing to compensate -// if (R3 > (ULONG) (TxAgcStep * (idx-1))) + /* The index is the step we should decrease, idx = 0 means there is nothing to compensate */ +/* if (R3 > (ULONG) (TxAgcStep * (idx-1))) */ *pTxAgcCompensate = -(TxAgcStep * (idx - 1)); -// else -// *pTxAgcCompensate = -((UCHAR)R3); +/* else */ +/* *pTxAgcCompensate = -((UCHAR)R3); */ DeltaPwr += (*pTxAgcCompensate); DBGPRINT(RT_DEBUG_TRACE, ("-- Tx Power, BBP R1=%x, TssiRef=%x, TxAgcStep=%x, step = -%d\n", BbpR49, TssiRef, TxAgcStep, idx - 1)); } else if (BbpR49 < pTssiPlusBoundary[1]) { - // Reading is smaller than the reference value - // check for how large we need to increase the Tx power + /* Reading is smaller than the reference value */ + /* check for how large we need to increase the Tx power */ for (idx = 1; idx < 5; idx++) { - if (BbpR49 >= pTssiPlusBoundary[idx]) // Found the range + if (BbpR49 >= pTssiPlusBoundary[idx]) /* Found the range */ break; } - // The index is the step we should increase, idx = 0 means there is nothing to compensate + /* The index is the step we should increase, idx = 0 means there is nothing to compensate */ *pTxAgcCompensate = TxAgcStep * (idx - 1); DeltaPwr += (*pTxAgcCompensate); DBGPRINT(RT_DEBUG_TRACE, @@ -1198,34 +1198,34 @@ VOID AsicAdjustTxPower(IN PRTMP_ADAPTER pAd) BbpR1 &= 0xFC; /* calculate delta power based on the percentage specified from UI */ - // E2PROM setting is calibrated for maximum TX power (i.e. 100%) - // We lower TX power here according to the percentage specified from UI - if (pAd->CommonCfg.TxPowerPercentage == 0xffffffff) // AUTO TX POWER control + /* E2PROM setting is calibrated for maximum TX power (i.e. 100%) */ + /* We lower TX power here according to the percentage specified from UI */ + if (pAd->CommonCfg.TxPowerPercentage == 0xffffffff) /* AUTO TX POWER control */ { { - // to patch high power issue with some APs, like Belkin N1. + /* to patch high power issue with some APs, like Belkin N1. */ if (Rssi > -35) { - BbpR1 |= 0x02; // DeltaPwr -= 12; + BbpR1 |= 0x02; /* DeltaPwr -= 12; */ } else if (Rssi > -40) { - BbpR1 |= 0x01; // DeltaPwr -= 6; + BbpR1 |= 0x01; /* DeltaPwr -= 6; */ } else; } - } else if (pAd->CommonCfg.TxPowerPercentage > 90) // 91 ~ 100% & AUTO, treat as 100% in terms of mW + } else if (pAd->CommonCfg.TxPowerPercentage > 90) /* 91 ~ 100% & AUTO, treat as 100% in terms of mW */ ; - else if (pAd->CommonCfg.TxPowerPercentage > 60) // 61 ~ 90%, treat as 75% in terms of mW // DeltaPwr -= 1; + else if (pAd->CommonCfg.TxPowerPercentage > 60) /* 61 ~ 90%, treat as 75% in terms of mW // DeltaPwr -= 1; */ { DeltaPwr -= 1; - } else if (pAd->CommonCfg.TxPowerPercentage > 30) // 31 ~ 60%, treat as 50% in terms of mW // DeltaPwr -= 3; + } else if (pAd->CommonCfg.TxPowerPercentage > 30) /* 31 ~ 60%, treat as 50% in terms of mW // DeltaPwr -= 3; */ { DeltaPwr -= 3; - } else if (pAd->CommonCfg.TxPowerPercentage > 15) // 16 ~ 30%, treat as 25% in terms of mW // DeltaPwr -= 6; + } else if (pAd->CommonCfg.TxPowerPercentage > 15) /* 16 ~ 30%, treat as 25% in terms of mW // DeltaPwr -= 6; */ { BbpR1 |= 0x01; - } else if (pAd->CommonCfg.TxPowerPercentage > 9) // 10 ~ 15%, treat as 12.5% in terms of mW // DeltaPwr -= 9; + } else if (pAd->CommonCfg.TxPowerPercentage > 9) /* 10 ~ 15%, treat as 12.5% in terms of mW // DeltaPwr -= 9; */ { BbpR1 |= 0x01; DeltaPwr -= 3; - } else // 0 ~ 9 %, treat as MIN(~3%) in terms of mW // DeltaPwr -= 12; + } else /* 0 ~ 9 %, treat as MIN(~3%) in terms of mW // DeltaPwr -= 12; */ { BbpR1 |= 0x02; } @@ -1334,7 +1334,7 @@ VOID AsicSetBssid(IN PRTMP_ADAPTER pAd, IN PUCHAR pBssid) RTMP_IO_WRITE32(pAd, MAC_BSSID_DW0, Addr4); Addr4 = 0; - // always one BSSID in STA mode + /* always one BSSID in STA mode */ Addr4 = (ULONG) (pBssid[4]) | (ULONG) (pBssid[5] << 8); RTMP_IO_WRITE32(pAd, MAC_BSSID_DW1, Addr4); @@ -1346,7 +1346,7 @@ VOID AsicSetMcastWC(IN PRTMP_ADAPTER pAd) USHORT offset; pEntry->Sst = SST_ASSOC; - pEntry->Aid = MCAST_WCID; // Softap supports 1 BSSID and use WCID=0 as multicast Wcid index + pEntry->Aid = MCAST_WCID; /* Softap supports 1 BSSID and use WCID=0 as multicast Wcid index */ pEntry->PsMode = PWR_ACTIVE; pEntry->CurrTxRate = pAd->CommonCfg.MlmeRate; offset = MAC_WCID_BASE + BSS0Mcast_WCID * HW_WCID_ENTRY_SIZE; @@ -1394,7 +1394,7 @@ VOID AsicEnableRDG(IN PRTMP_ADAPTER pAd) Data |= 0x80; RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Data); - //OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); + /*OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); */ } /* @@ -1417,15 +1417,15 @@ VOID AsicDisableRDG(IN PRTMP_ADAPTER pAd) RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &Data); Data &= 0xFFFFFF00; - //Data |= 0x20; + /*Data |= 0x20; */ #ifndef WIFI_TEST - //if ( pAd->CommonCfg.bEnableTxBurst ) - // Data |= 0x60; // for performance issue not set the TXOP to 0 + /*if ( pAd->CommonCfg.bEnableTxBurst ) */ + /* Data |= 0x60; // for performance issue not set the TXOP to 0 */ #endif if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_DYNAMIC_BE_TXOP_ACTIVE) && (pAd->MacTab.fAnyStationMIMOPSDynamic == FALSE) ) { - // For CWC test, change txop from 0x30 to 0x20 in TxBurst mode + /* For CWC test, change txop from 0x30 to 0x20 in TxBurst mode */ if (pAd->CommonCfg.bEnableTxBurst) Data |= 0x20; } @@ -1447,9 +1447,9 @@ VOID AsicDisableSync(IN PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_TRACE, ("--->Disable TSF synchronization\n")); - // 2003-12-20 disable TSF and TBTT while NIC in power-saving have side effect - // that NIC will never wakes up because TSF stops and no more - // TBTT interrupts + /* 2003-12-20 disable TSF and TBTT while NIC in power-saving have side effect */ + /* that NIC will never wakes up because TSF stops and no more */ + /* TBTT interrupts */ pAd->TbttTickCount = 0; RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr.word); csr.field.bBeaconGen = 0; @@ -1475,12 +1475,12 @@ VOID AsicEnableBssSync(IN PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_TRACE, ("--->AsicEnableBssSync(INFRA mode)\n")); RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr.word); -// RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, 0x00000000); +/* RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, 0x00000000); */ { - csr.field.BeaconInterval = pAd->CommonCfg.BeaconPeriod << 4; // ASIC register in units of 1/16 TU + csr.field.BeaconInterval = pAd->CommonCfg.BeaconPeriod << 4; /* ASIC register in units of 1/16 TU */ csr.field.bTsfTicking = 1; - csr.field.TsfSyncMode = 1; // sync TSF in INFRASTRUCTURE mode - csr.field.bBeaconGen = 0; // do NOT generate BEACON + csr.field.TsfSyncMode = 1; /* sync TSF in INFRASTRUCTURE mode */ + csr.field.bBeaconGen = 0; /* do NOT generate BEACON */ csr.field.bTBTTEnable = 1; } RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr.word); @@ -1515,9 +1515,9 @@ VOID AsicEnableIbssSync(IN PRTMP_ADAPTER pAd) RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr9.word); #ifdef RTMP_MAC_PCI - // move BEACON TXD and frame content to on-chip memory + /* move BEACON TXD and frame content to on-chip memory */ ptr = (PUCHAR) & pAd->BeaconTxWI; - for (i = 0; i < TXWI_SIZE; i += 4) // 16-byte TXWI field + for (i = 0; i < TXWI_SIZE; i += 4) /* 16-byte TXWI field */ { UINT32 longptr = *ptr + (*(ptr + 1) << 8) + (*(ptr + 2) << 16) + @@ -1526,7 +1526,7 @@ VOID AsicEnableIbssSync(IN PRTMP_ADAPTER pAd) ptr += 4; } - // start right after the 16-byte TXWI field + /* start right after the 16-byte TXWI field */ ptr = pAd->BeaconBuf; for (i = 0; i < pAd->BeaconTxWI.MPDUtotalByteCount; i += 4) { UINT32 longptr = @@ -1535,38 +1535,38 @@ VOID AsicEnableIbssSync(IN PRTMP_ADAPTER pAd) RTMP_IO_WRITE32(pAd, HW_BEACON_BASE0 + TXWI_SIZE + i, longptr); ptr += 4; } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB - // move BEACON TXD and frame content to on-chip memory + /* move BEACON TXD and frame content to on-chip memory */ ptr = (PUCHAR) & pAd->BeaconTxWI; - for (i = 0; i < TXWI_SIZE; i += 2) // 16-byte TXWI field + for (i = 0; i < TXWI_SIZE; i += 2) /* 16-byte TXWI field */ { - //UINT32 longptr = *ptr + (*(ptr+1)<<8) + (*(ptr+2)<<16) + (*(ptr+3)<<24); - //RTMP_IO_WRITE32(pAd, HW_BEACON_BASE0 + i, longptr); + /*UINT32 longptr = *ptr + (*(ptr+1)<<8) + (*(ptr+2)<<16) + (*(ptr+3)<<24); */ + /*RTMP_IO_WRITE32(pAd, HW_BEACON_BASE0 + i, longptr); */ RTUSBMultiWrite(pAd, HW_BEACON_BASE0 + i, ptr, 2); ptr += 2; } - // start right after the 16-byte TXWI field + /* start right after the 16-byte TXWI field */ ptr = pAd->BeaconBuf; for (i = 0; i < pAd->BeaconTxWI.MPDUtotalByteCount; i += 2) { - //UINT32 longptr = *ptr + (*(ptr+1)<<8) + (*(ptr+2)<<16) + (*(ptr+3)<<24); - //RTMP_IO_WRITE32(pAd, HW_BEACON_BASE0 + TXWI_SIZE + i, longptr); + /*UINT32 longptr = *ptr + (*(ptr+1)<<8) + (*(ptr+2)<<16) + (*(ptr+3)<<24); */ + /*RTMP_IO_WRITE32(pAd, HW_BEACON_BASE0 + TXWI_SIZE + i, longptr); */ RTUSBMultiWrite(pAd, HW_BEACON_BASE0 + TXWI_SIZE + i, ptr, 2); ptr += 2; } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ - // - // For Wi-Fi faily generated beacons between participating stations. - // Set TBTT phase adaptive adjustment step to 8us (default 16us) - // don't change settings 2006-5- by Jerry - //RTMP_IO_WRITE32(pAd, TBTT_SYNC_CFG, 0x00001010); + /* */ + /* For Wi-Fi faily generated beacons between participating stations. */ + /* Set TBTT phase adaptive adjustment step to 8us (default 16us) */ + /* don't change settings 2006-5- by Jerry */ + /*RTMP_IO_WRITE32(pAd, TBTT_SYNC_CFG, 0x00001010); */ - // start sending BEACON - csr9.field.BeaconInterval = pAd->CommonCfg.BeaconPeriod << 4; // ASIC register in units of 1/16 TU + /* start sending BEACON */ + csr9.field.BeaconInterval = pAd->CommonCfg.BeaconPeriod << 4; /* ASIC register in units of 1/16 TU */ csr9.field.bTsfTicking = 1; - csr9.field.TsfSyncMode = 2; // sync TSF in IBSS mode + csr9.field.TsfSyncMode = 2; /* sync TSF in IBSS mode */ csr9.field.bTBTTEnable = 1; csr9.field.bBeaconGen = 1; RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr9.word); @@ -1606,35 +1606,35 @@ VOID AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm) fCLIENT_STATUS_WMM_CAPABLE); } - //======================================================== - // MAC Register has a copy . - //======================================================== -//#ifndef WIFI_TEST + /*======================================================== */ + /* MAC Register has a copy . */ + /*======================================================== */ +/*#ifndef WIFI_TEST */ if (pAd->CommonCfg.bEnableTxBurst) { - // For CWC test, change txop from 0x30 to 0x20 in TxBurst mode - Ac0Cfg.field.AcTxop = 0x20; // Suggest by John for TxBurst in HT Mode + /* For CWC test, change txop from 0x30 to 0x20 in TxBurst mode */ + Ac0Cfg.field.AcTxop = 0x20; /* Suggest by John for TxBurst in HT Mode */ } else - Ac0Cfg.field.AcTxop = 0; // QID_AC_BE -//#else -// Ac0Cfg.field.AcTxop = 0; // QID_AC_BE -//#endif + Ac0Cfg.field.AcTxop = 0; /* QID_AC_BE */ +/*#else */ +/* Ac0Cfg.field.AcTxop = 0; // QID_AC_BE */ +/*#endif */ Ac0Cfg.field.Cwmin = CW_MIN_IN_BITS; Ac0Cfg.field.Cwmax = CW_MAX_IN_BITS; Ac0Cfg.field.Aifsn = 2; RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Ac0Cfg.word); - Ac1Cfg.field.AcTxop = 0; // QID_AC_BK + Ac1Cfg.field.AcTxop = 0; /* QID_AC_BK */ Ac1Cfg.field.Cwmin = CW_MIN_IN_BITS; Ac1Cfg.field.Cwmax = CW_MAX_IN_BITS; Ac1Cfg.field.Aifsn = 2; RTMP_IO_WRITE32(pAd, EDCA_AC1_CFG, Ac1Cfg.word); if (pAd->CommonCfg.PhyMode == PHY_11B) { - Ac2Cfg.field.AcTxop = 192; // AC_VI: 192*32us ~= 6ms - Ac3Cfg.field.AcTxop = 96; // AC_VO: 96*32us ~= 3ms + Ac2Cfg.field.AcTxop = 192; /* AC_VI: 192*32us ~= 6ms */ + Ac3Cfg.field.AcTxop = 96; /* AC_VO: 96*32us ~= 3ms */ } else { - Ac2Cfg.field.AcTxop = 96; // AC_VI: 96*32us ~= 3ms - Ac3Cfg.field.AcTxop = 48; // AC_VO: 48*32us ~= 1.5ms + Ac2Cfg.field.AcTxop = 96; /* AC_VI: 96*32us ~= 3ms */ + Ac3Cfg.field.AcTxop = 48; /* AC_VO: 48*32us ~= 1.5ms */ } Ac2Cfg.field.Cwmin = CW_MIN_IN_BITS; Ac2Cfg.field.Cwmax = CW_MAX_IN_BITS; @@ -1645,18 +1645,18 @@ VOID AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm) Ac3Cfg.field.Aifsn = 2; RTMP_IO_WRITE32(pAd, EDCA_AC3_CFG, Ac3Cfg.word); - //======================================================== - // DMA Register has a copy too. - //======================================================== - csr0.field.Ac0Txop = 0; // QID_AC_BE - csr0.field.Ac1Txop = 0; // QID_AC_BK + /*======================================================== */ + /* DMA Register has a copy too. */ + /*======================================================== */ + csr0.field.Ac0Txop = 0; /* QID_AC_BE */ + csr0.field.Ac1Txop = 0; /* QID_AC_BK */ RTMP_IO_WRITE32(pAd, WMM_TXOP0_CFG, csr0.word); if (pAd->CommonCfg.PhyMode == PHY_11B) { - csr1.field.Ac2Txop = 192; // AC_VI: 192*32us ~= 6ms - csr1.field.Ac3Txop = 96; // AC_VO: 96*32us ~= 3ms + csr1.field.Ac2Txop = 192; /* AC_VI: 192*32us ~= 6ms */ + csr1.field.Ac3Txop = 96; /* AC_VO: 96*32us ~= 3ms */ } else { - csr1.field.Ac2Txop = 96; // AC_VI: 96*32us ~= 3ms - csr1.field.Ac3Txop = 48; // AC_VO: 48*32us ~= 1.5ms + csr1.field.Ac2Txop = 96; /* AC_VI: 96*32us ~= 3ms */ + csr1.field.Ac3Txop = 48; /* AC_VO: 48*32us ~= 1.5ms */ } RTMP_IO_WRITE32(pAd, WMM_TXOP1_CFG, csr1.word); @@ -1679,24 +1679,24 @@ VOID AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm) NdisZeroMemory(&pAd->CommonCfg.APEdcaParm, sizeof(EDCA_PARM)); } else { OPSTATUS_SET_FLAG(pAd, fOP_STATUS_WMM_INUSED); - //======================================================== - // MAC Register has a copy. - //======================================================== - // - // Modify Cwmin/Cwmax/Txop on queue[QID_AC_VI], Recommend by Jerry 2005/07/27 - // To degrade our VIDO Queue's throughput for WiFi WMM S3T07 Issue. - // - //pEdcaParm->Txop[QID_AC_VI] = pEdcaParm->Txop[QID_AC_VI] * 7 / 10; // rt2860c need this + /*======================================================== */ + /* MAC Register has a copy. */ + /*======================================================== */ + /* */ + /* Modify Cwmin/Cwmax/Txop on queue[QID_AC_VI], Recommend by Jerry 2005/07/27 */ + /* To degrade our VIDO Queue's throughput for WiFi WMM S3T07 Issue. */ + /* */ + /*pEdcaParm->Txop[QID_AC_VI] = pEdcaParm->Txop[QID_AC_VI] * 7 / 10; // rt2860c need this */ Ac0Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BE]; Ac0Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_BE]; Ac0Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_BE]; - Ac0Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BE]; //+1; + Ac0Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BE]; /*+1; */ Ac1Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_BK]; - Ac1Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_BK]; //+2; + Ac1Cfg.field.Cwmin = pEdcaParm->Cwmin[QID_AC_BK]; /*+2; */ Ac1Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_BK]; - Ac1Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BK]; //+1; + Ac1Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_BK]; /*+1; */ Ac2Cfg.field.AcTxop = (pEdcaParm->Txop[QID_AC_VI] * 6) / 10; if (pAd->Antenna.field.TxPath == 1) { @@ -1709,16 +1709,16 @@ VOID AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm) Ac2Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_VI] + 1; #ifdef RTMP_MAC_USB Ac2Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_VI] + 3; -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ { - // Tuning for Wi-Fi WMM S06 + /* Tuning for Wi-Fi WMM S06 */ if (pAd->CommonCfg.bWiFiTest && pEdcaParm->Aifsn[QID_AC_VI] == 10) Ac2Cfg.field.Aifsn -= 1; - // Tuning for TGn Wi-Fi 5.2.32 - // STA TestBed changes in this item: conexant legacy sta ==> broadcom 11n sta + /* Tuning for TGn Wi-Fi 5.2.32 */ + /* STA TestBed changes in this item: conexant legacy sta ==> broadcom 11n sta */ if (STA_TGN_WIFI_ON(pAd) && pEdcaParm->Aifsn[QID_AC_VI] == 10) { Ac0Cfg.field.Aifsn = 3; @@ -1727,10 +1727,10 @@ VOID AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm) #ifdef RT30xx if (pAd->RfIcType == RFIC_3020 || pAd->RfIcType == RFIC_2020) { - // Tuning for WiFi WMM S3-T07: connexant legacy sta ==> broadcom 11n sta. + /* Tuning for WiFi WMM S3-T07: connexant legacy sta ==> broadcom 11n sta. */ Ac2Cfg.field.Aifsn = 5; } -#endif // RT30xx // +#endif /* RT30xx // */ } Ac3Cfg.field.AcTxop = pEdcaParm->Txop[QID_AC_VO]; @@ -1738,7 +1738,7 @@ VOID AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm) Ac3Cfg.field.Cwmax = pEdcaParm->Cwmax[QID_AC_VO]; Ac3Cfg.field.Aifsn = pEdcaParm->Aifsn[QID_AC_VO]; -//#ifdef WIFI_TEST +/*#ifdef WIFI_TEST */ if (pAd->CommonCfg.bWiFiTest) { if (Ac3Cfg.field.AcTxop == 102) { Ac0Cfg.field.AcTxop = @@ -1753,16 +1753,16 @@ VOID AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm) pEdcaParm->Txop[QID_AC_VI]; } /* End of if */ } -//#endif // WIFI_TEST // +/*#endif // WIFI_TEST // */ RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, Ac0Cfg.word); RTMP_IO_WRITE32(pAd, EDCA_AC1_CFG, Ac1Cfg.word); RTMP_IO_WRITE32(pAd, EDCA_AC2_CFG, Ac2Cfg.word); RTMP_IO_WRITE32(pAd, EDCA_AC3_CFG, Ac3Cfg.word); - //======================================================== - // DMA Register has a copy too. - //======================================================== + /*======================================================== */ + /* DMA Register has a copy too. */ + /*======================================================== */ csr0.field.Ac0Txop = Ac0Cfg.field.AcTxop; csr0.field.Ac1Txop = Ac1Cfg.field.AcTxop; RTMP_IO_WRITE32(pAd, WMM_TXOP0_CFG, csr0.word); @@ -1775,7 +1775,7 @@ VOID AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm) CwminCsr.field.Cwmin0 = pEdcaParm->Cwmin[QID_AC_BE]; CwminCsr.field.Cwmin1 = pEdcaParm->Cwmin[QID_AC_BK]; CwminCsr.field.Cwmin2 = pEdcaParm->Cwmin[QID_AC_VI]; - CwminCsr.field.Cwmin3 = pEdcaParm->Cwmin[QID_AC_VO] - 1; //for TGn wifi test + CwminCsr.field.Cwmin3 = pEdcaParm->Cwmin[QID_AC_VO] - 1; /*for TGn wifi test */ RTMP_IO_WRITE32(pAd, WMM_CWMIN_CFG, CwminCsr.word); CwmaxCsr.word = 0; @@ -1786,18 +1786,18 @@ VOID AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm) RTMP_IO_WRITE32(pAd, WMM_CWMAX_CFG, CwmaxCsr.word); AifsnCsr.word = 0; - AifsnCsr.field.Aifsn0 = Ac0Cfg.field.Aifsn; //pEdcaParm->Aifsn[QID_AC_BE]; - AifsnCsr.field.Aifsn1 = Ac1Cfg.field.Aifsn; //pEdcaParm->Aifsn[QID_AC_BK]; - AifsnCsr.field.Aifsn2 = Ac2Cfg.field.Aifsn; //pEdcaParm->Aifsn[QID_AC_VI]; + AifsnCsr.field.Aifsn0 = Ac0Cfg.field.Aifsn; /*pEdcaParm->Aifsn[QID_AC_BE]; */ + AifsnCsr.field.Aifsn1 = Ac1Cfg.field.Aifsn; /*pEdcaParm->Aifsn[QID_AC_BK]; */ + AifsnCsr.field.Aifsn2 = Ac2Cfg.field.Aifsn; /*pEdcaParm->Aifsn[QID_AC_VI]; */ { - // Tuning for Wi-Fi WMM S06 + /* Tuning for Wi-Fi WMM S06 */ if (pAd->CommonCfg.bWiFiTest && pEdcaParm->Aifsn[QID_AC_VI] == 10) AifsnCsr.field.Aifsn2 = Ac2Cfg.field.Aifsn - 4; - // Tuning for TGn Wi-Fi 5.2.32 - // STA TestBed changes in this item: connexant legacy sta ==> broadcom 11n sta + /* Tuning for TGn Wi-Fi 5.2.32 */ + /* STA TestBed changes in this item: connexant legacy sta ==> broadcom 11n sta */ if (STA_TGN_WIFI_ON(pAd) && pEdcaParm->Aifsn[QID_AC_VI] == 10) { AifsnCsr.field.Aifsn0 = 3; @@ -1811,14 +1811,14 @@ VOID AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm) } { - AifsnCsr.field.Aifsn3 = Ac3Cfg.field.Aifsn - 1; //pEdcaParm->Aifsn[QID_AC_VO]; //for TGn wifi test + AifsnCsr.field.Aifsn3 = Ac3Cfg.field.Aifsn - 1; /*pEdcaParm->Aifsn[QID_AC_VO]; //for TGn wifi test */ #ifdef RT30xx - // TODO: Shiang, this modification also suitable for RT3052/RT3050 ??? + /* TODO: Shiang, this modification also suitable for RT3052/RT3050 ??? */ if (pAd->RfIcType == RFIC_3020 || pAd->RfIcType == RFIC_2020) { - AifsnCsr.field.Aifsn2 = 0x2; //pEdcaParm->Aifsn[QID_AC_VI]; //for WiFi WMM S4-T04. + AifsnCsr.field.Aifsn2 = 0x2; /*pEdcaParm->Aifsn[QID_AC_VI]; //for WiFi WMM S4-T04. */ } -#endif // RT30xx // +#endif /* RT30xx // */ } RTMP_IO_WRITE32(pAd, WMM_AIFSN_CFG, AifsnCsr.word); @@ -1885,26 +1885,26 @@ VOID AsicSetSlotTime(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUseShortSlotTime) SlotTime = (bUseShortSlotTime) ? 9 : 20; { - // force using short SLOT time for FAE to demo performance when TxBurst is ON + /* force using short SLOT time for FAE to demo performance when TxBurst is ON */ if (((pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) && (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED))) || ((pAd->StaActive.SupportedPhyInfo.bHtEnable == TRUE) && (pAd->CommonCfg.BACapability.field.Policy == BA_NOTUSE)) ) { - // In this case, we will think it is doing Wi-Fi test - // And we will not set to short slot when bEnableTxBurst is TRUE. + /* In this case, we will think it is doing Wi-Fi test */ + /* And we will not set to short slot when bEnableTxBurst is TRUE. */ } else if (pAd->CommonCfg.bEnableTxBurst) { OPSTATUS_SET_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED); SlotTime = 9; } } - // - // For some reasons, always set it to short slot time. - // - // ToDo: Should consider capability with 11B - // + /* */ + /* For some reasons, always set it to short slot time. */ + /* */ + /* ToDo: Should consider capability with 11B */ + /* */ { if (pAd->StaCfg.BssType == BSS_ADHOC) { OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_SLOT_INUSED); @@ -1936,16 +1936,16 @@ VOID AsicAddSharedKeyEntry(IN PRTMP_ADAPTER pAd, IN UCHAR CipherAlg, IN PUCHAR pKey, IN PUCHAR pTxMic, IN PUCHAR pRxMic) { - ULONG offset; //, csr0; + ULONG offset; /*, csr0; */ SHAREDKEY_MODE_STRUC csr1; #ifdef RTMP_MAC_PCI INT i; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ DBGPRINT(RT_DEBUG_TRACE, ("AsicAddSharedKeyEntry BssIndex=%d, KeyIdx=%d\n", BssIndex, KeyIdx)); -//============================================================================================ +/*============================================================================================ */ DBGPRINT(RT_DEBUG_TRACE, ("AsicAddSharedKeyEntry: %s key #%d\n", CipherName[CipherAlg], @@ -1968,10 +1968,10 @@ VOID AsicAddSharedKeyEntry(IN PRTMP_ADAPTER pAd, pTxMic[0], pTxMic[1], pTxMic[2], pTxMic[3], pTxMic[4], pTxMic[5], pTxMic[6], pTxMic[7])); } -//============================================================================================ - // - // fill key material - key + TX MIC + RX MIC - // +/*============================================================================================ */ + /* */ + /* fill key material - key + TX MIC + RX MIC */ + /* */ #ifdef RTMP_MAC_PCI offset = SHARED_KEY_TABLE_BASE + (4 * BssIndex + KeyIdx) * HW_KEY_ENTRY_SIZE; @@ -1992,7 +1992,7 @@ VOID AsicAddSharedKeyEntry(IN PRTMP_ADAPTER pAd, RTMP_IO_WRITE8(pAd, offset + i, pRxMic[i]); } } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB { offset = @@ -2010,11 +2010,11 @@ VOID AsicAddSharedKeyEntry(IN PRTMP_ADAPTER pAd, RTUSBMultiWrite(pAd, offset, pRxMic, 8); } } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ - // - // Update cipher algorithm. WSTA always use BSS0 - // + /* */ + /* Update cipher algorithm. WSTA always use BSS0 */ + /* */ RTMP_IO_READ32(pAd, SHARED_KEY_MODE_BASE + 4 * (BssIndex / 2), &csr1.word); DBGPRINT(RT_DEBUG_TRACE, @@ -2047,11 +2047,11 @@ VOID AsicAddSharedKeyEntry(IN PRTMP_ADAPTER pAd, } -// IRQL = DISPATCH_LEVEL +/* IRQL = DISPATCH_LEVEL */ VOID AsicRemoveSharedKeyEntry(IN PRTMP_ADAPTER pAd, IN UCHAR BssIndex, IN UCHAR KeyIdx) { - //ULONG SecCsr0; + /*ULONG SecCsr0; */ SHAREDKEY_MODE_STRUC csr1; DBGPRINT(RT_DEBUG_TRACE, @@ -2096,10 +2096,10 @@ VOID AsicUpdateWCIDAttribute(IN PRTMP_ADAPTER pAd, { ULONG WCIDAttri = 0, offset; - // - // Update WCID attribute. - // Only TxKey could update WCID attribute. - // + /* */ + /* Update WCID attribute. */ + /* Only TxKey could update WCID attribute. */ + /* */ offset = MAC_WCID_ATTRIBUTE_BASE + (WCID * HW_WCID_ATTRI_SIZE); WCIDAttri = (BssIndex << 4) | (CipherAlg << 1) | (bUsePairewiseKeyTable); @@ -2171,10 +2171,10 @@ VOID AsicAddKeyEntry(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUsePairewiseKeyTable, IN BOOLEAN bTxKey) { ULONG offset; -// ULONG WCIDAttri = 0; +/* ULONG WCIDAttri = 0; */ UCHAR IV4 = 0; PUCHAR pKey = pCipherKey->Key; -// ULONG KeyLen = pCipherKey->KeyLen; +/* ULONG KeyLen = pCipherKey->KeyLen; */ PUCHAR pTxMic = pCipherKey->TxMic; PUCHAR pRxMic = pCipherKey->RxMic; PUCHAR pTxtsc = pCipherKey->TxTsc; @@ -2182,14 +2182,14 @@ VOID AsicAddKeyEntry(IN PRTMP_ADAPTER pAd, SHAREDKEY_MODE_STRUC csr1; #ifdef RTMP_MAC_PCI UCHAR i; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ -// ASSERT(KeyLen <= MAX_LEN_OF_PEER_KEY); +/* ASSERT(KeyLen <= MAX_LEN_OF_PEER_KEY); */ DBGPRINT(RT_DEBUG_TRACE, ("==> AsicAddKeyEntry\n")); - // - // 1.) decide key table offset - // + /* */ + /* 1.) decide key table offset */ + /* */ if (bUsePairewiseKeyTable) offset = PAIRWISE_KEY_TABLE_BASE + (WCID * HW_KEY_ENTRY_SIZE); else @@ -2197,19 +2197,19 @@ VOID AsicAddKeyEntry(IN PRTMP_ADAPTER pAd, SHARED_KEY_TABLE_BASE + (4 * BssIndex + KeyIdx) * HW_KEY_ENTRY_SIZE; - // - // 2.) Set Key to Asic - // - //for (i = 0; i < KeyLen; i++) + /* */ + /* 2.) Set Key to Asic */ + /* */ + /*for (i = 0; i < KeyLen; i++) */ #ifdef RTMP_MAC_PCI for (i = 0; i < MAX_LEN_OF_PEER_KEY; i++) { RTMP_IO_WRITE8(pAd, offset + i, pKey[i]); } offset += MAX_LEN_OF_PEER_KEY; - // - // 3.) Set MIC key if available - // + /* */ + /* 3.) Set MIC key if available */ + /* */ if (pTxMic) { for (i = 0; i < 8; i++) { RTMP_IO_WRITE8(pAd, offset + i, pTxMic[i]); @@ -2222,14 +2222,14 @@ VOID AsicAddKeyEntry(IN PRTMP_ADAPTER pAd, RTMP_IO_WRITE8(pAd, offset + i, pRxMic[i]); } } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB RTUSBMultiWrite(pAd, offset, pKey, MAX_LEN_OF_PEER_KEY); offset += MAX_LEN_OF_PEER_KEY; - // - // 3.) Set MIC key if available - // + /* */ + /* 3.) Set MIC key if available */ + /* */ if (pTxMic) { RTUSBMultiWrite(pAd, offset, pTxMic, 8); } @@ -2238,18 +2238,18 @@ VOID AsicAddKeyEntry(IN PRTMP_ADAPTER pAd, if (pRxMic) { RTUSBMultiWrite(pAd, offset, pRxMic, 8); } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ - // - // 4.) Modify IV/EIV if needs - // This will force Asic to use this key ID by setting IV. - // + /* */ + /* 4.) Modify IV/EIV if needs */ + /* This will force Asic to use this key ID by setting IV. */ + /* */ if (bTxKey) { #ifdef RTMP_MAC_PCI offset = MAC_IVEIV_TABLE_BASE + (WCID * HW_IVEIV_ENTRY_SIZE); - // - // Write IV - // + /* */ + /* Write IV */ + /* */ RTMP_IO_WRITE8(pAd, offset, pTxtsc[1]); RTMP_IO_WRITE8(pAd, offset + 1, ((pTxtsc[1] | 0x20) & 0x7f)); RTMP_IO_WRITE8(pAd, offset + 2, pTxtsc[0]); @@ -2258,50 +2258,50 @@ VOID AsicAddKeyEntry(IN PRTMP_ADAPTER pAd, if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) || (CipherAlg == CIPHER_AES)) - IV4 |= 0x20; // turn on extension bit means EIV existence + IV4 |= 0x20; /* turn on extension bit means EIV existence */ RTMP_IO_WRITE8(pAd, offset + 3, IV4); - // - // Write EIV - // + /* */ + /* Write EIV */ + /* */ offset += 4; for (i = 0; i < 4; i++) { RTMP_IO_WRITE8(pAd, offset + i, pTxtsc[i + 2]); } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB UINT32 tmpVal; - // - // Write IV - // + /* */ + /* Write IV */ + /* */ IV4 = (KeyIdx << 6); if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) || (CipherAlg == CIPHER_AES)) - IV4 |= 0x20; // turn on extension bit means EIV existence + IV4 |= 0x20; /* turn on extension bit means EIV existence */ tmpVal = pTxtsc[1] + (((pTxtsc[1] | 0x20) & 0x7f) << 8) + (pTxtsc[0] << 16) + (IV4 << 24); RTMP_IO_WRITE32(pAd, offset, tmpVal); - // - // Write EIV - // + /* */ + /* Write EIV */ + /* */ offset += 4; RTMP_IO_WRITE32(pAd, offset, *(PUINT32) & pCipherKey->TxTsc[2]); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ AsicUpdateWCIDAttribute(pAd, WCID, BssIndex, CipherAlg, bUsePairewiseKeyTable); } if (!bUsePairewiseKeyTable) { - // - // Only update the shared key security mode - // + /* */ + /* Only update the shared key security mode */ + /* */ RTMP_IO_READ32(pAd, SHARED_KEY_MODE_BASE + 4 * (BssIndex / 2), &csr1.word); if ((BssIndex % 2) == 0) { @@ -2350,18 +2350,18 @@ VOID AsicAddPairwiseKeyEntry(IN PRTMP_ADAPTER pAd, PUCHAR pRxMic = pCipherKey->RxMic; #ifdef DBG UCHAR CipherAlg = pCipherKey->CipherAlg; -#endif // DBG // +#endif /* DBG // */ - // EKEY + /* EKEY */ offset = PAIRWISE_KEY_TABLE_BASE + (WCID * HW_KEY_ENTRY_SIZE); #ifdef RTMP_MAC_PCI for (i = 0; i < MAX_LEN_OF_PEER_KEY; i++) { RTMP_IO_WRITE8(pAd, offset + i, pKey[i]); } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB RTUSBMultiWrite(pAd, offset, &pCipherKey->Key[0], MAX_LEN_OF_PEER_KEY); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ for (i = 0; i < MAX_LEN_OF_PEER_KEY; i += 4) { UINT32 Value; RTMP_IO_READ32(pAd, offset + i, &Value); @@ -2369,16 +2369,16 @@ VOID AsicAddPairwiseKeyEntry(IN PRTMP_ADAPTER pAd, offset += MAX_LEN_OF_PEER_KEY; - // MIC KEY + /* MIC KEY */ if (pTxMic) { #ifdef RTMP_MAC_PCI for (i = 0; i < 8; i++) { RTMP_IO_WRITE8(pAd, offset + i, pTxMic[i]); } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB RTUSBMultiWrite(pAd, offset, &pCipherKey->TxMic[0], 8); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ } offset += 8; if (pRxMic) { @@ -2386,10 +2386,10 @@ VOID AsicAddPairwiseKeyEntry(IN PRTMP_ADAPTER pAd, for (i = 0; i < 8; i++) { RTMP_IO_WRITE8(pAd, offset + i, pRxMic[i]); } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB RTUSBMultiWrite(pAd, offset, &pCipherKey->RxMic[0], 8); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ } DBGPRINT(RT_DEBUG_TRACE, @@ -2428,7 +2428,7 @@ VOID AsicRemovePairwiseKeyEntry(IN PRTMP_ADAPTER pAd, ULONG WCIDAttri; USHORT offset; - // re-set the entry's WCID attribute as OPEN-NONE. + /* re-set the entry's WCID attribute as OPEN-NONE. */ offset = MAC_WCID_ATTRIBUTE_BASE + (Wcid * HW_WCID_ATTRI_SIZE); WCIDAttri = (BssIdx << 4) | PAIRWISEKEYTABLE; RTMP_IO_WRITE32(pAd, offset, WCIDAttri); @@ -2450,7 +2450,7 @@ VOID AsicSetRxAnt(IN PRTMP_ADAPTER pAd, IN UCHAR Ant) #ifdef RT30xx /* RT3572 ATE need not to do this. */ RT30xxSetRxAnt(pAd, Ant); -#endif // RT30xx // +#endif /* RT30xx // */ } VOID AsicTurnOffRFClk(IN PRTMP_ADAPTER pAd, IN UCHAR Channel) @@ -2458,7 +2458,7 @@ VOID AsicTurnOffRFClk(IN PRTMP_ADAPTER pAd, IN UCHAR Channel) if (pAd->chipOps.AsicRfTurnOff) { pAd->chipOps.AsicRfTurnOff(pAd); } else { - // RF R2 bit 18 = 0 + /* RF R2 bit 18 = 0 */ UINT32 R1 = 0, R2 = 0, R3 = 0; UCHAR index; RTMP_RF_REGS *RFRegTable; @@ -2480,9 +2480,9 @@ VOID AsicTurnOffRFClk(IN PRTMP_ADAPTER pAd, IN UCHAR Channel) RTMP_RF_IO_WRITE32(pAd, R1); RTMP_RF_IO_WRITE32(pAd, R2); - // Program R1b13 to 1, R3/b18,19 to 0, R2b18 to 0. - // Set RF R2 bit18=0, R3 bit[18:19]=0 - //if (pAd->StaCfg.bRadio == FALSE) + /* Program R1b13 to 1, R3/b18,19 to 0, R2b18 to 0. */ + /* Set RF R2 bit18=0, R3 bit[18:19]=0 */ + /*if (pAd->StaCfg.bRadio == FALSE) */ if (1) { RTMP_RF_IO_WRITE32(pAd, R3); @@ -2509,17 +2509,17 @@ VOID AsicTurnOffRFClk(IN PRTMP_ADAPTER pAd, IN UCHAR Channel) VOID AsicTurnOnRFClk(IN PRTMP_ADAPTER pAd, IN UCHAR Channel) { - // RF R2 bit 18 = 0 + /* RF R2 bit 18 = 0 */ UINT32 R1 = 0, R2 = 0, R3 = 0; UCHAR index; RTMP_RF_REGS *RFRegTable; #ifdef PCIE_PS_SUPPORT - // The RF programming sequence is difference between 3xxx and 2xxx + /* The RF programming sequence is difference between 3xxx and 2xxx */ if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) { return; } -#endif // PCIE_PS_SUPPORT // +#endif /* PCIE_PS_SUPPORT // */ RFRegTable = RF2850RegTable; @@ -2541,13 +2541,13 @@ VOID AsicTurnOnRFClk(IN PRTMP_ADAPTER pAd, IN UCHAR Channel) R2 = RFRegTable[index].R2; if (pAd->Antenna.field.TxPath == 1) { - R2 |= 0x4000; // If TXpath is 1, bit 14 = 1; + R2 |= 0x4000; /* If TXpath is 1, bit 14 = 1; */ } if (pAd->Antenna.field.RxPath == 2) { - R2 |= 0x40; // write 1 to off Rxpath. + R2 |= 0x40; /* write 1 to off Rxpath. */ } else if (pAd->Antenna.field.RxPath == 1) { - R2 |= 0x20040; // write 1 to off RxPath + R2 |= 0x20040; /* write 1 to off RxPath */ } RTMP_RF_IO_WRITE32(pAd, R2); diff --git a/drivers/staging/rt2860/common/cmm_cfg.c b/drivers/staging/rt2860/common/cmm_cfg.c index 9f337176b80c..7dbcb2300a28 100644 --- a/drivers/staging/rt2860/common/cmm_cfg.c +++ b/drivers/staging/rt2860/common/cmm_cfg.c @@ -95,8 +95,8 @@ INT RT_CfgSetCountryRegion(IN PRTMP_ADAPTER pAd, IN PSTRING arg, IN INT band) regionMax = REGION_MAXIMUM_A_BAND; } - // TODO: Is it neccesay for following check??? - // Country can be set only when EEPROM not programmed + /* TODO: Is it neccesay for following check??? */ + /* Country can be set only when EEPROM not programmed */ if (*pCountryRegion & 0x80) { DBGPRINT(RT_DEBUG_ERROR, ("CfgSetCountryRegion():CountryRegion in eeprom was programmed\n")); @@ -154,7 +154,7 @@ INT RT_CfgSetShortSlot(IN PRTMP_ADAPTER pAd, IN PSTRING arg) else if (ShortSlot == 0) pAd->CommonCfg.bUseShortSlotTime = FALSE; else - return FALSE; //Invalid argument + return FALSE; /*Invalid argument */ return TRUE; } @@ -176,29 +176,29 @@ INT RT_CfgSetWepKey(IN PRTMP_ADAPTER pAd, UCHAR CipherAlg = CIPHER_NONE; BOOLEAN bKeyIsHex = FALSE; - // TODO: Shall we do memset for the original key info?? + /* TODO: Shall we do memset for the original key info?? */ memset(pSharedKey, 0, sizeof(CIPHER_KEY)); KeyLen = strlen(keyString); switch (KeyLen) { - case 5: //wep 40 Ascii type - case 13: //wep 104 Ascii type + case 5: /*wep 40 Ascii type */ + case 13: /*wep 104 Ascii type */ bKeyIsHex = FALSE; pSharedKey->KeyLen = KeyLen; NdisMoveMemory(pSharedKey->Key, keyString, KeyLen); break; - case 10: //wep 40 Hex type - case 26: //wep 104 Hex type + case 10: /*wep 40 Hex type */ + case 26: /*wep 104 Hex type */ for (i = 0; i < KeyLen; i++) { if (!isxdigit(*(keyString + i))) - return FALSE; //Not Hex value; + return FALSE; /*Not Hex value; */ } bKeyIsHex = TRUE; pSharedKey->KeyLen = KeyLen / 2; AtoH(keyString, pSharedKey->Key, pSharedKey->KeyLen); break; - default: //Invalid argument + default: /*Invalid argument */ DBGPRINT(RT_DEBUG_TRACE, ("RT_CfgSetWepKey(keyIdx=%d):Invalid argument (arg=%s)\n", keyIdx, keyString)); diff --git a/drivers/staging/rt2860/common/cmm_data.c b/drivers/staging/rt2860/common/cmm_data.c index 033a4ead7d15..81766db533ec 100644 --- a/drivers/staging/rt2860/common/cmm_data.c +++ b/drivers/staging/rt2860/common/cmm_data.c @@ -30,7 +30,7 @@ UCHAR SNAP_802_1H[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; UCHAR SNAP_BRIDGE_TUNNEL[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; -// Add Cisco Aironet SNAP heade for CCX2 support +/* Add Cisco Aironet SNAP heade for CCX2 support */ UCHAR SNAP_AIRONET[] = { 0xaa, 0xaa, 0x03, 0x00, 0x40, 0x96, 0x00, 0x00 }; UCHAR CKIP_LLC_SNAP[] = { 0xaa, 0xaa, 0x03, 0x00, 0x40, 0x96, 0x00, 0x02 }; UCHAR EAPOL_LLC_SNAP[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8e }; @@ -41,28 +41,28 @@ UCHAR IPX[] = { 0x81, 0x37 }; UCHAR APPLE_TALK[] = { 0x80, 0xf3 }; UCHAR RateIdToPlcpSignal[12] = { - 0, /* RATE_1 */ 1, /* RATE_2 */ 2, /* RATE_5_5 */ 3, /* RATE_11 */// see BBP spec - 11, /* RATE_6 */ 15, /* RATE_9 */ 10, /* RATE_12 */ 14, /* RATE_18 */// see IEEE802.11a-1999 p.14 + 0, /* RATE_1 */ 1, /* RATE_2 */ 2, /* RATE_5_5 */ 3, /* RATE_11 *//* see BBP spec */ + 11, /* RATE_6 */ 15, /* RATE_9 */ 10, /* RATE_12 */ 14, /* RATE_18 *//* see IEEE802.11a-1999 p.14 */ 9, /* RATE_24 */ 13, /* RATE_36 */ 8, /* RATE_48 */ 12 /* RATE_54 */ -}; // see IEEE802.11a-1999 p.14 +}; /* see IEEE802.11a-1999 p.14 */ UCHAR OfdmSignalToRateId[16] = { - RATE_54, RATE_54, RATE_54, RATE_54, // OFDM PLCP Signal = 0, 1, 2, 3 respectively - RATE_54, RATE_54, RATE_54, RATE_54, // OFDM PLCP Signal = 4, 5, 6, 7 respectively - RATE_48, RATE_24, RATE_12, RATE_6, // OFDM PLCP Signal = 8, 9, 10, 11 respectively - RATE_54, RATE_36, RATE_18, RATE_9, // OFDM PLCP Signal = 12, 13, 14, 15 respectively + RATE_54, RATE_54, RATE_54, RATE_54, /* OFDM PLCP Signal = 0, 1, 2, 3 respectively */ + RATE_54, RATE_54, RATE_54, RATE_54, /* OFDM PLCP Signal = 4, 5, 6, 7 respectively */ + RATE_48, RATE_24, RATE_12, RATE_6, /* OFDM PLCP Signal = 8, 9, 10, 11 respectively */ + RATE_54, RATE_36, RATE_18, RATE_9, /* OFDM PLCP Signal = 12, 13, 14, 15 respectively */ }; UCHAR OfdmRateToRxwiMCS[12] = { 0, 0, 0, 0, - 0, 1, 2, 3, // OFDM rate 6,9,12,18 = rxwi mcs 0,1,2,3 - 4, 5, 6, 7, // OFDM rate 24,36,48,54 = rxwi mcs 4,5,6,7 + 0, 1, 2, 3, /* OFDM rate 6,9,12,18 = rxwi mcs 0,1,2,3 */ + 4, 5, 6, 7, /* OFDM rate 24,36,48,54 = rxwi mcs 4,5,6,7 */ }; UCHAR RxwiMCSToOfdmRate[12] = { RATE_6, RATE_9, RATE_12, RATE_18, - RATE_24, RATE_36, RATE_48, RATE_54, // OFDM rate 6,9,12,18 = rxwi mcs 0,1,2,3 - 4, 5, 6, 7, // OFDM rate 24,36,48,54 = rxwi mcs 4,5,6,7 + RATE_24, RATE_36, RATE_48, RATE_54, /* OFDM rate 6,9,12,18 = rxwi mcs 0,1,2,3 */ + 4, 5, 6, 7, /* OFDM rate 24,36,48,54 = rxwi mcs 4,5,6,7 */ }; char *MCSToMbps[] = @@ -73,7 +73,7 @@ char *MCSToMbps[] = UCHAR default_cwmin[] = { CW_MIN_IN_BITS, CW_MIN_IN_BITS, CW_MIN_IN_BITS - 1, CW_MIN_IN_BITS - 2 }; -//UCHAR default_cwmax[]={CW_MAX_IN_BITS, CW_MAX_IN_BITS, CW_MIN_IN_BITS, CW_MIN_IN_BITS-1}; +/*UCHAR default_cwmax[]={CW_MAX_IN_BITS, CW_MAX_IN_BITS, CW_MIN_IN_BITS, CW_MIN_IN_BITS-1}; */ UCHAR default_sta_aifsn[] = { 3, 7, 2, 2 }; UCHAR MapUserPriorityToAccessCategory[8] = @@ -110,11 +110,11 @@ NDIS_STATUS MiniportMMRequest(IN PRTMP_ADAPTER pAd, PNDIS_PACKET pPacket; NDIS_STATUS Status = NDIS_STATUS_SUCCESS; ULONG FreeNum; - UCHAR rtmpHwHdr[TXINFO_SIZE + TXWI_SIZE]; //RTMP_HW_HDR_LEN]; + UCHAR rtmpHwHdr[TXINFO_SIZE + TXWI_SIZE]; /*RTMP_HW_HDR_LEN]; */ #ifdef RTMP_MAC_PCI unsigned long IrqFlags = 0; UCHAR IrqState; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ BOOLEAN bUseDataQ = FALSE; int retryCnt = 0; @@ -125,7 +125,7 @@ NDIS_STATUS MiniportMMRequest(IN PRTMP_ADAPTER pAd, QueIdx &= (~MGMT_USE_QUEUE_FLAG); } #ifdef RTMP_MAC_PCI - // 2860C use Tx Ring + /* 2860C use Tx Ring */ IrqState = pAd->irq_disabled; if (pAd->MACVersion == 0x28600100) { QueIdx = (bUseDataQ == TRUE ? QueIdx : 3); @@ -133,10 +133,10 @@ NDIS_STATUS MiniportMMRequest(IN PRTMP_ADAPTER pAd, } if (bUseDataQ && (!IrqState)) RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ do { - // Reset is in progress, stop immediately + /* Reset is in progress, stop immediately */ if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS) || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | @@ -145,22 +145,22 @@ NDIS_STATUS MiniportMMRequest(IN PRTMP_ADAPTER pAd, Status = NDIS_STATUS_FAILURE; break; } - // Check Free priority queue - // Since we use PBF Queue2 for management frame. Its corresponding DMA ring should be using TxRing. + /* Check Free priority queue */ + /* Since we use PBF Queue2 for management frame. Its corresponding DMA ring should be using TxRing. */ #ifdef RTMP_MAC_PCI if (bUseDataQ) { retryCnt = MAX_DATAMM_RETRY; - // free Tx(QueIdx) resources + /* free Tx(QueIdx) resources */ RTMPFreeTXDUponTxDmaDone(pAd, QueIdx); FreeNum = GET_TXRING_FREENO(pAd, QueIdx); } else -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ { FreeNum = GET_MGMTRING_FREENO(pAd); } if ((FreeNum > 0)) { - // We need to reserve space for rtmp hardware header. i.e., TxWI for RT2860 and TxInfo+TxWI for RT2870 + /* We need to reserve space for rtmp hardware header. i.e., TxWI for RT2860 and TxInfo+TxWI for RT2870 */ NdisZeroMemory(&rtmpHwHdr, (TXINFO_SIZE + TXWI_SIZE)); Status = RTMPAllocateNdisPacket(pAd, &pPacket, @@ -172,8 +172,8 @@ NDIS_STATUS MiniportMMRequest(IN PRTMP_ADAPTER pAd, ("MiniportMMRequest (error:: can't allocate NDIS PACKET)\n")); break; } - //pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_CCK; - //pAd->CommonCfg.MlmeRate = RATE_2; + /*pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_CCK; */ + /*pAd->CommonCfg.MlmeRate = RATE_2; */ #ifdef RTMP_MAC_PCI if (bUseDataQ) { @@ -181,7 +181,7 @@ NDIS_STATUS MiniportMMRequest(IN PRTMP_ADAPTER pAd, MlmeDataHardTransmit(pAd, QueIdx, pPacket); retryCnt--; } else -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ Status = MlmeHardTransmit(pAd, QueIdx, pPacket); if (Status == NDIS_STATUS_SUCCESS) retryCnt = 0; @@ -202,7 +202,7 @@ NDIS_STATUS MiniportMMRequest(IN PRTMP_ADAPTER pAd, MgmtRingFullCount)); } } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ DBGPRINT(RT_DEBUG_ERROR, ("Qidx(%d), not enough space in MgmtRing, MgmtRingFullCount=%ld!\n", QueIdx, @@ -213,7 +213,7 @@ NDIS_STATUS MiniportMMRequest(IN PRTMP_ADAPTER pAd, #ifdef RTMP_MAC_PCI if (bUseDataQ && (!IrqState)) RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ return Status; } @@ -265,7 +265,7 @@ NDIS_STATUS MlmeHardTransmit(IN PRTMP_ADAPTER pAd, if (pAd->MACVersion == 0x28600100) return MlmeHardTransmitTxRing(pAd, QueIdx, pPacket); else -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ return MlmeHardTransmitMgmtRing(pAd, QueIdx, pPacket); } @@ -285,22 +285,22 @@ NDIS_STATUS MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); - // Make sure MGMT ring resource won't be used by other threads + /* Make sure MGMT ring resource won't be used by other threads */ RTMP_SEM_LOCK(&pAd->MgmtRingLock); if (pSrcBufVA == NULL) { - // The buffer shouldn't be NULL + /* The buffer shouldn't be NULL */ RTMP_SEM_UNLOCK(&pAd->MgmtRingLock); return NDIS_STATUS_FAILURE; } { - // outgoing frame always wakeup PHY to prevent frame lost + /* outgoing frame always wakeup PHY to prevent frame lost */ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) AsicForceWakeup(pAd, TRUE); } pFirstTxWI = (PTXWI_STRUC) (pSrcBufVA + TXINFO_SIZE); - pHeader_802_11 = (PHEADER_802_11) (pSrcBufVA + TXINFO_SIZE + TXWI_SIZE); //TXWI_SIZE); + pHeader_802_11 = (PHEADER_802_11) (pSrcBufVA + TXINFO_SIZE + TXWI_SIZE); /*TXWI_SIZE); */ if (pHeader_802_11->Addr1[0] & 0x01) { MlmeRate = pAd->CommonCfg.BasicMlmeRate; @@ -308,8 +308,8 @@ NDIS_STATUS MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, MlmeRate = pAd->CommonCfg.MlmeRate; } - // Verify Mlme rate for a / g bands. - if ((pAd->LatchRfRegs.Channel > 14) && (MlmeRate < RATE_6)) // 11A band + /* Verify Mlme rate for a / g bands. */ + if ((pAd->LatchRfRegs.Channel > 14) && (MlmeRate < RATE_6)) /* 11A band */ MlmeRate = RATE_6; if ((pHeader_802_11->FC.Type == BTYPE_DATA) && @@ -318,7 +318,7 @@ NDIS_STATUS MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, } { - // Fixed W52 with Activity scan issue in ABG_MIXED and ABGN_MIXED mode. + /* Fixed W52 with Activity scan issue in ABG_MIXED and ABGN_MIXED mode. */ if (pAd->CommonCfg.PhyMode == PHY_11ABG_MIXED || pAd->CommonCfg.PhyMode == PHY_11ABGN_MIXED) { if (pAd->LatchRfRegs.Channel > 14) @@ -328,17 +328,17 @@ NDIS_STATUS MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, } } - // - // Should not be hard code to set PwrMgmt to 0 (PWR_ACTIVE) - // Snice it's been set to 0 while on MgtMacHeaderInit - // By the way this will cause frame to be send on PWR_SAVE failed. - // - pHeader_802_11->FC.PwrMgmt = PWR_ACTIVE; // (pAd->StaCfg.Psm == PWR_SAVE); - - // - // In WMM-UAPSD, mlme frame should be set psm as power saving but probe request frame - // Data-Null packets alse pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD -// if ((pHeader_802_11->FC.Type != BTYPE_DATA) && (pHeader_802_11->FC.Type != BTYPE_CNTL)) + /* */ + /* Should not be hard code to set PwrMgmt to 0 (PWR_ACTIVE) */ + /* Snice it's been set to 0 while on MgtMacHeaderInit */ + /* By the way this will cause frame to be send on PWR_SAVE failed. */ + /* */ + pHeader_802_11->FC.PwrMgmt = PWR_ACTIVE; /* (pAd->StaCfg.Psm == PWR_SAVE); */ + + /* */ + /* In WMM-UAPSD, mlme frame should be set psm as power saving but probe request frame */ + /* Data-Null packets alse pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD */ +/* if ((pHeader_802_11->FC.Type != BTYPE_DATA) && (pHeader_802_11->FC.Type != BTYPE_CNTL)) */ { if ((pHeader_802_11->FC.SubType == SUBTYPE_ACTION) || ((pHeader_802_11->FC.Type == BTYPE_DATA) && @@ -353,20 +353,20 @@ NDIS_STATUS MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, } bInsertTimestamp = FALSE; - if (pHeader_802_11->FC.Type == BTYPE_CNTL) // must be PS-POLL + if (pHeader_802_11->FC.Type == BTYPE_CNTL) /* must be PS-POLL */ { - //Set PM bit in ps-poll, to fix WLK 1.2 PowerSaveMode_ext failure issue. + /*Set PM bit in ps-poll, to fix WLK 1.2 PowerSaveMode_ext failure issue. */ if ((pAd->OpMode == OPMODE_STA) && (pHeader_802_11->FC.SubType == SUBTYPE_PS_POLL)) { pHeader_802_11->FC.PwrMgmt = PWR_SAVE; } bAckRequired = FALSE; - } else // BTYPE_MGMT or BTYPE_DATA(must be NULL frame) + } else /* BTYPE_MGMT or BTYPE_DATA(must be NULL frame) */ { - //pAd->Sequence++; - //pHeader_802_11->Sequence = pAd->Sequence; + /*pAd->Sequence++; */ + /*pHeader_802_11->Sequence = pAd->Sequence; */ - if (pHeader_802_11->Addr1[0] & 0x01) // MULTICAST, BROADCAST + if (pHeader_802_11->Addr1[0] & 0x01) /* MULTICAST, BROADCAST */ { bAckRequired = FALSE; pHeader_802_11->Duration = 0; @@ -377,12 +377,12 @@ NDIS_STATUS MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, if ((pHeader_802_11->FC.SubType == SUBTYPE_PROBE_RSP) && (pHeader_802_11->FC.Type == BTYPE_MGMT)) { bInsertTimestamp = TRUE; - bAckRequired = FALSE; // Disable ACK to prevent retry 0x1f for Probe Response + bAckRequired = FALSE; /* Disable ACK to prevent retry 0x1f for Probe Response */ } else if ((pHeader_802_11->FC.SubType == SUBTYPE_PROBE_REQ) && (pHeader_802_11->FC.Type == BTYPE_MGMT)) { - bAckRequired = FALSE; // Disable ACK to prevent retry 0x1f for Probe Request + bAckRequired = FALSE; /* Disable ACK to prevent retry 0x1f for Probe Request */ } } } @@ -391,30 +391,30 @@ NDIS_STATUS MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, if (pAd->Sequence > 0xfff) pAd->Sequence = 0; - // Before radar detection done, mgmt frame can not be sent but probe req - // Because we need to use probe req to trigger driver to send probe req in passive scan + /* Before radar detection done, mgmt frame can not be sent but probe req */ + /* Because we need to use probe req to trigger driver to send probe req in passive scan */ if ((pHeader_802_11->FC.SubType != SUBTYPE_PROBE_REQ) && (pAd->CommonCfg.bIEEE80211H == 1) && (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE)) { DBGPRINT(RT_DEBUG_ERROR, ("MlmeHardTransmit --> radar detect not in normal mode !!!\n")); -// if (!IrqState) +/* if (!IrqState) */ RTMP_SEM_UNLOCK(&pAd->MgmtRingLock); return (NDIS_STATUS_FAILURE); } - // - // fill scatter-and-gather buffer list into TXD. Internally created NDIS PACKET - // should always has only one physical buffer, and the whole frame size equals - // to the first scatter buffer size - // + /* */ + /* fill scatter-and-gather buffer list into TXD. Internally created NDIS PACKET */ + /* should always has only one physical buffer, and the whole frame size equals */ + /* to the first scatter buffer size */ + /* */ - // Initialize TX Descriptor - // For inter-frame gap, the number is for this frame and next frame - // For MLME rate, we will fix as 2Mb to match other vendor's implement -// pAd->CommonCfg.MlmeTransmit.field.MODE = 1; + /* Initialize TX Descriptor */ + /* For inter-frame gap, the number is for this frame and next frame */ + /* For MLME rate, we will fix as 2Mb to match other vendor's implement */ +/* pAd->CommonCfg.MlmeTransmit.field.MODE = 1; */ -// management frame doesn't need encryption. so use RESERVED_WCID no matter u are sending to specific wcid or not. +/* management frame doesn't need encryption. so use RESERVED_WCID no matter u are sending to specific wcid or not. */ PID = PID_MGMT; if (pMacEntry == NULL) { @@ -434,11 +434,11 @@ NDIS_STATUS MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, IFS_BACKOFF, FALSE, &pMacEntry->MaxHTPhyMode); } - // Now do hardware-depened kick out. + /* Now do hardware-depened kick out. */ HAL_KickOutMgmtTx(pAd, QueIdx, pPacket, pSrcBufVA, SrcBufLen); - // Make sure to release MGMT ring resource -// if (!IrqState) + /* Make sure to release MGMT ring resource */ +/* if (!IrqState) */ RTMP_SEM_UNLOCK(&pAd->MgmtRingLock); return NDIS_STATUS_SUCCESS; } @@ -514,17 +514,17 @@ static UCHAR TxPktClassification(IN RTMP_ADAPTER * pAd, IN PNDIS_PACKET pPacket) BOOLEAN bHTRate = FALSE; Wcid = RTMP_GET_PACKET_WCID(pPacket); - if (Wcid == MCAST_WCID) { // Handle for RA is Broadcast/Multicast Address. + if (Wcid == MCAST_WCID) { /* Handle for RA is Broadcast/Multicast Address. */ return TX_MCAST_FRAME; } - // Handle for unicast packets + /* Handle for unicast packets */ pMacEntry = &pAd->MacTab.Content[Wcid]; - if (RTMP_GET_PACKET_LOWRATE(pPacket)) { // It's a specific packet need to force low rate, i.e., bDHCPFrame, bEAPOLFrame, bWAIFrame + if (RTMP_GET_PACKET_LOWRATE(pPacket)) { /* It's a specific packet need to force low rate, i.e., bDHCPFrame, bEAPOLFrame, bWAIFrame */ TxFrameType = TX_LEGACY_FRAME; - } else if (IS_HT_RATE(pMacEntry)) { // it's a 11n capable packet + } else if (IS_HT_RATE(pMacEntry)) { /* it's a 11n capable packet */ - // Depends on HTPhyMode to check if the peer support the HTRate transmission. - // Currently didn't support A-MSDU embedded in A-MPDU + /* Depends on HTPhyMode to check if the peer support the HTRate transmission. */ + /* Currently didn't support A-MSDU embedded in A-MPDU */ bHTRate = TRUE; if (RTMP_GET_PACKET_MOREDATA(pPacket) || (pMacEntry->PsMode == PWR_SAVE)) @@ -538,15 +538,15 @@ static UCHAR TxPktClassification(IN RTMP_ADAPTER * pAd, IN PNDIS_PACKET pPacket) return TX_AMSDU_FRAME; else TxFrameType = TX_LEGACY_FRAME; - } else { // it's a legacy b/g packet. - if ((CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_AGGREGATION_CAPABLE) && pAd->CommonCfg.bAggregationCapable) && (RTMP_GET_PACKET_TXRATE(pPacket) >= RATE_6) && (!(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_WMM_CAPABLE)))) { // if peer support Ralink Aggregation, we use it. + } else { /* it's a legacy b/g packet. */ + if ((CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_AGGREGATION_CAPABLE) && pAd->CommonCfg.bAggregationCapable) && (RTMP_GET_PACKET_TXRATE(pPacket) >= RATE_6) && (!(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_WMM_CAPABLE)))) { /* if peer support Ralink Aggregation, we use it. */ TxFrameType = TX_RALINK_FRAME; } else { TxFrameType = TX_LEGACY_FRAME; } } - // Currently, our fragment only support when a unicast packet send as NOT-ARALINK, NOT-AMSDU and NOT-AMPDU. + /* Currently, our fragment only support when a unicast packet send as NOT-ARALINK, NOT-AMSDU and NOT-AMPDU. */ if ((RTMP_GET_PACKET_FRAGMENTS(pPacket) > 1) && (TxFrameType == TX_LEGACY_FRAME)) TxFrameType = TX_FRAG_FRAME; @@ -567,14 +567,14 @@ BOOLEAN RTMP_FillTxBlkInfo(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) pTxBlk->Wcid = RTMP_GET_PACKET_WCID(pPacket); pTxBlk->apidx = RTMP_GET_PACKET_IF(pPacket); pTxBlk->UserPriority = RTMP_GET_PACKET_UP(pPacket); - pTxBlk->FrameGap = IFS_HTTXOP; // ASIC determine Frame Gap + pTxBlk->FrameGap = IFS_HTTXOP; /* ASIC determine Frame Gap */ if (RTMP_GET_PACKET_CLEAR_EAP_FRAME(pTxBlk->pPacket)) TX_BLK_SET_FLAG(pTxBlk, fTX_bClearEAPFrame); else TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bClearEAPFrame); - // Default to clear this flag + /* Default to clear this flag */ TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bForceNonQoS); if (pTxBlk->Wcid == MCAST_WCID) { @@ -584,8 +584,8 @@ BOOLEAN RTMP_FillTxBlkInfo(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) &pAd->MacTab.Content[MCAST_WCID].HTPhyMode; } - TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bAckRequired); // AckRequired = FALSE, when broadcast packet in Adhoc mode. - //TX_BLK_SET_FLAG(pTxBlk, fTX_bForceLowRate); + TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bAckRequired); /* AckRequired = FALSE, when broadcast packet in Adhoc mode. */ + /*TX_BLK_SET_FLAG(pTxBlk, fTX_bForceLowRate); */ TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bAllowFrag); TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bWMM); if (RTMP_GET_PACKET_MOREDATA(pPacket)) { @@ -598,7 +598,7 @@ BOOLEAN RTMP_FillTxBlkInfo(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) pMacEntry = pTxBlk->pMacEntry; - // For all unicast packets, need Ack unless the Ack Policy is not set as NORMAL_ACK. + /* For all unicast packets, need Ack unless the Ack Policy is not set as NORMAL_ACK. */ if (pAd->CommonCfg.AckPolicy[pTxBlk->QueIdx] != NORMAL_ACK) TX_BLK_CLEAR_FLAG(pTxBlk, fTX_bAckRequired); else @@ -614,24 +614,24 @@ BOOLEAN RTMP_FillTxBlkInfo(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) { { - // If support WMM, enable it. + /* If support WMM, enable it. */ if (OPSTATUS_TEST_FLAG (pAd, fOP_STATUS_WMM_INUSED) && CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_WMM_CAPABLE)) TX_BLK_SET_FLAG(pTxBlk, fTX_bWMM); -// if (pAd->StaCfg.bAutoTxRateSwitch) -// TX_BLK_SET_FLAG(pTxBlk, fTX_AutoRateSwitch); +/* if (pAd->StaCfg.bAutoTxRateSwitch) */ +/* TX_BLK_SET_FLAG(pTxBlk, fTX_AutoRateSwitch); */ } } if (pTxBlk->TxFrameType == TX_LEGACY_FRAME) { - if ((RTMP_GET_PACKET_LOWRATE(pPacket)) || ((pAd->OpMode == OPMODE_AP) && (pMacEntry->MaxHTPhyMode.field.MODE == MODE_CCK) && (pMacEntry->MaxHTPhyMode.field.MCS == RATE_1))) { // Specific packet, i.e., bDHCPFrame, bEAPOLFrame, bWAIFrame, need force low rate. + if ((RTMP_GET_PACKET_LOWRATE(pPacket)) || ((pAd->OpMode == OPMODE_AP) && (pMacEntry->MaxHTPhyMode.field.MODE == MODE_CCK) && (pMacEntry->MaxHTPhyMode.field.MCS == RATE_1))) { /* Specific packet, i.e., bDHCPFrame, bEAPOLFrame, bWAIFrame, need force low rate. */ pTxBlk->pTransmit = &pAd->MacTab.Content[MCAST_WCID].HTPhyMode; - // Modify the WMM bit for ICV issue. If we have a packet with EOSP field need to set as 1, how to handle it??? + /* Modify the WMM bit for ICV issue. If we have a packet with EOSP field need to set as 1, how to handle it??? */ if (IS_HT_STA(pTxBlk->pMacEntry) && (CLIENT_STATUS_TEST_FLAG (pMacEntry, fCLIENT_STATUS_RALINK_CHIPSET)) @@ -645,7 +645,7 @@ BOOLEAN RTMP_FillTxBlkInfo(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) } } - if ((IS_HT_RATE(pMacEntry) == FALSE) && (CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_PIGGYBACK_CAPABLE))) { // Currently piggy-back only support when peer is operate in b/g mode. + if ((IS_HT_RATE(pMacEntry) == FALSE) && (CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_PIGGYBACK_CAPABLE))) { /* Currently piggy-back only support when peer is operate in b/g mode. */ TX_BLK_SET_FLAG(pTxBlk, fTX_bPiggyBack); } @@ -666,7 +666,7 @@ BOOLEAN CanDoAggregateTransmit(IN RTMP_ADAPTER * pAd, IN NDIS_PACKET * pPacket, IN TX_BLK * pTxBlk) { - //DBGPRINT(RT_DEBUG_TRACE, ("Check if can do aggregation! TxFrameType=%d!\n", pTxBlk->TxFrameType)); + /*DBGPRINT(RT_DEBUG_TRACE, ("Check if can do aggregation! TxFrameType=%d!\n", pTxBlk->TxFrameType)); */ if (RTMP_GET_PACKET_WCID(pPacket) == MCAST_WCID) return FALSE; @@ -675,15 +675,15 @@ BOOLEAN CanDoAggregateTransmit(IN RTMP_ADAPTER * pAd, RTMP_GET_PACKET_EAPOL(pPacket) || RTMP_GET_PACKET_WAI(pPacket)) return FALSE; - if ((pTxBlk->TxFrameType == TX_AMSDU_FRAME) && ((pTxBlk->TotalFrameLen + GET_OS_PKT_LEN(pPacket)) > (RX_BUFFER_AGGRESIZE - 100))) { // For AMSDU, allow the packets with total length < max-amsdu size + if ((pTxBlk->TxFrameType == TX_AMSDU_FRAME) && ((pTxBlk->TotalFrameLen + GET_OS_PKT_LEN(pPacket)) > (RX_BUFFER_AGGRESIZE - 100))) { /* For AMSDU, allow the packets with total length < max-amsdu size */ return FALSE; } - if ((pTxBlk->TxFrameType == TX_RALINK_FRAME) && (pTxBlk->TxPacketList.Number == 2)) { // For RALINK-Aggregation, allow two frames in one batch. + if ((pTxBlk->TxFrameType == TX_RALINK_FRAME) && (pTxBlk->TxPacketList.Number == 2)) { /* For RALINK-Aggregation, allow two frames in one batch. */ return FALSE; } - if ((INFRA_ON(pAd)) && (pAd->OpMode == OPMODE_STA)) // must be unicast to AP + if ((INFRA_ON(pAd)) && (pAd->OpMode == OPMODE_STA)) /* must be unicast to AP */ return TRUE; else return FALSE; @@ -729,7 +729,7 @@ VOID RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, IN UCHAR QI if (QIdx == NUM_OF_TX_RING) { sQIdx = 0; - eQIdx = 3; // 4 ACs, start from 0. + eQIdx = 3; /* 4 ACs, start from 0. */ } else { sQIdx = eQIdx = QIdx; } @@ -764,14 +764,14 @@ VOID RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, IN UCHAR QI FreeNumber[QueIdx] = GET_TXRING_FREENO(pAd, QueIdx); if (FreeNumber[QueIdx] <= 5) { - // free Tx(QueIdx) resources + /* free Tx(QueIdx) resources */ RTMPFreeTXDUponTxDmaDone(pAd, QueIdx); FreeNumber[QueIdx] = GET_TXRING_FREENO(pAd, QueIdx); } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ - // probe the Queue Head + /* probe the Queue Head */ pQueue = &pAd->TxSwQueue[QueIdx]; if ((pEntry = pQueue->Head) == NULL) { DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, @@ -781,12 +781,12 @@ VOID RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, IN UCHAR QI pTxBlk = &TxBlk; NdisZeroMemory((PUCHAR) pTxBlk, sizeof(TX_BLK)); - //InitializeQueueHeader(&pTxBlk->TxPacketList); // Didn't need it because we already memzero it. + /*InitializeQueueHeader(&pTxBlk->TxPacketList); // Didn't need it because we already memzero it. */ pTxBlk->QueIdx = QueIdx; pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); - // Early check to make sure we have enoguh Tx Resource. + /* Early check to make sure we have enoguh Tx Resource. */ hasTxDesc = RTMP_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, FreeNumber[QueIdx], @@ -803,7 +803,7 @@ VOID RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, IN UCHAR QI pTxBlk->TxFrameType = TxPktClassification(pAd, pPacket); pEntry = RemoveHeadQueue(pQueue); pTxBlk->TotalFrameNum++; - pTxBlk->TotalFragNum += RTMP_GET_PACKET_FRAGMENTS(pPacket); // The real fragment number maybe vary + pTxBlk->TotalFragNum += RTMP_GET_PACKET_FRAGMENTS(pPacket); /* The real fragment number maybe vary */ pTxBlk->TotalFrameLen += GET_OS_PKT_LEN(pPacket); pTxBlk->pPacket = pPacket; InsertTailQueue(&pTxBlk->TxPacketList, @@ -811,7 +811,7 @@ VOID RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, IN UCHAR QI if (pTxBlk->TxFrameType == TX_RALINK_FRAME || pTxBlk->TxFrameType == TX_AMSDU_FRAME) { - // Enhance SW Aggregation Mechanism + /* Enhance SW Aggregation Mechanism */ if (NEED_QUEUE_BACK_FOR_AGG (pAd, QueIdx, FreeNumber[QueIdx], pTxBlk->TxFrameType)) { @@ -827,7 +827,7 @@ VOID RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, IN UCHAR QI if ((pEntry = pQueue->Head) == NULL) break; - // For TX_AMSDU_FRAME/TX_RALINK_FRAME, Need to check if next pakcet can do aggregation. + /* For TX_AMSDU_FRAME/TX_RALINK_FRAME, Need to check if next pakcet can do aggregation. */ pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); FreeNumber[QueIdx] = GET_TXRING_FREENO(pAd, QueIdx); @@ -843,12 +843,12 @@ VOID RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, IN UCHAR QI (pAd, pPacket, pTxBlk) == FALSE)) break; - //Remove the packet from the TxSwQueue and insert into pTxBlk + /*Remove the packet from the TxSwQueue and insert into pTxBlk */ pEntry = RemoveHeadQueue(pQueue); ASSERT(pEntry); pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); pTxBlk->TotalFrameNum++; - pTxBlk->TotalFragNum += RTMP_GET_PACKET_FRAGMENTS(pPacket); // The real fragment number maybe vary + pTxBlk->TotalFragNum += RTMP_GET_PACKET_FRAGMENTS(pPacket); /* The real fragment number maybe vary */ pTxBlk->TotalFrameLen += GET_OS_PKT_LEN(pPacket); InsertTailQueue(&pTxBlk->TxPacketList, @@ -861,18 +861,18 @@ VOID RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, IN UCHAR QI } #ifdef RTMP_MAC_USB DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, IrqFlags); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ Count += pTxBlk->TxPacketList.Number; - // Do HardTransmit now. + /* Do HardTransmit now. */ Status = STAHardTransmit(pAd, pTxBlk, QueIdx); #ifdef RTMP_MAC_PCI DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext, IrqFlags); - // static rate also need NICUpdateFifoStaCounters() function. - //if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) + /* static rate also need NICUpdateFifoStaCounters() function. */ + /*if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) */ NICUpdateFifoStaCounters(pAd); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ } @@ -881,7 +881,7 @@ VOID RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, IN UCHAR QI #ifdef RTMP_MAC_USB if (!hasTxDesc) RTUSBKickBulkOut(pAd); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ } } @@ -912,28 +912,28 @@ USHORT RTMPCalcDuration(IN PRTMP_ADAPTER pAd, IN UCHAR Rate, IN ULONG Size) { ULONG Duration = 0; - if (Rate < RATE_FIRST_OFDM_RATE) // CCK + if (Rate < RATE_FIRST_OFDM_RATE) /* CCK */ { if ((Rate > RATE_1) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED)) - Duration = 96; // 72+24 preamble+plcp + Duration = 96; /* 72+24 preamble+plcp */ else - Duration = 192; // 144+48 preamble+plcp + Duration = 192; /* 144+48 preamble+plcp */ Duration += (USHORT) ((Size << 4) / RateIdTo500Kbps[Rate]); if ((Size << 4) % RateIdTo500Kbps[Rate]) Duration++; - } else if (Rate <= RATE_LAST_OFDM_RATE) // OFDM rates + } else if (Rate <= RATE_LAST_OFDM_RATE) /* OFDM rates */ { - Duration = 20 + 6; // 16+4 preamble+plcp + Signal Extension + Duration = 20 + 6; /* 16+4 preamble+plcp + Signal Extension */ Duration += 4 * (USHORT) ((11 + Size * 4) / RateIdTo500Kbps[Rate]); if ((11 + Size * 4) % RateIdTo500Kbps[Rate]) Duration += 4; - } else //mimo rate + } else /*mimo rate */ { - Duration = 20 + 6; // 16+4 preamble+plcp + Signal Extension + Duration = 20 + 6; /* 16+4 preamble+plcp + Signal Extension */ } return (USHORT) Duration; @@ -968,7 +968,7 @@ USHORT RTMPCalcDuration(IN PRTMP_ADAPTER pAd, IN UCHAR Rate, IN ULONG Size) ======================================================================== */ -VOID RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pOutTxWI, IN BOOLEAN FRAG, IN BOOLEAN CFACK, IN BOOLEAN InsTimestamp, IN BOOLEAN AMPDU, IN BOOLEAN Ack, IN BOOLEAN NSeq, // HW new a sequence. +VOID RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pOutTxWI, IN BOOLEAN FRAG, IN BOOLEAN CFACK, IN BOOLEAN InsTimestamp, IN BOOLEAN AMPDU, IN BOOLEAN Ack, IN BOOLEAN NSeq, /* HW new a sequence. */ IN UCHAR BASize, IN UCHAR WCID, IN ULONG Length, @@ -985,10 +985,10 @@ VOID RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pOutTxWI, IN BOOLEAN FRA if (WCID < MAX_LEN_OF_MAC_TABLE) pMac = &pAd->MacTab.Content[WCID]; - // - // Always use Long preamble before verifiation short preamble functionality works well. - // Todo: remove the following line if short preamble functionality works - // + /* */ + /* Always use Long preamble before verifiation short preamble functionality works well. */ + /* Todo: remove the following line if short preamble functionality works */ + /* */ OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); NdisZeroMemory(&TxWI, TXWI_SIZE); pTxWI = &TxWI; @@ -1002,7 +1002,7 @@ VOID RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pOutTxWI, IN BOOLEAN FRA pTxWI->txop = Txopmode; pTxWI->NSEQ = NSeq; - // John tune the performace with Intel Client in 20 MHz performance + /* John tune the performace with Intel Client in 20 MHz performance */ BASize = pAd->CommonCfg.TxBASize; if (pAd->MACVersion == 0x28720200) { if (BASize > 13) @@ -1019,7 +1019,7 @@ VOID RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pOutTxWI, IN BOOLEAN FRA pTxWI->MPDUtotalByteCount = Length; pTxWI->PacketId = PID; - // If CCK or OFDM, BW must be 20 + /* If CCK or OFDM, BW must be 20 */ pTxWI->BW = (pTransmit->field.MODE <= MODE_OFDM) ? (BW_20) : (pTransmit->field.BW); @@ -1032,10 +1032,10 @@ VOID RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pOutTxWI, IN BOOLEAN FRA if (pAd->CommonCfg.bMIMOPSEnable) { if ((pMac->MmpsMode == MMPS_DYNAMIC) && (pTransmit->field.MCS > 7)) { - // Dynamic MIMO Power Save Mode + /* Dynamic MIMO Power Save Mode */ pTxWI->MIMOps = 1; } else if (pMac->MmpsMode == MMPS_STATIC) { - // Static MIMO Power Save Mode + /* Static MIMO Power Save Mode */ if (pTransmit->field.MODE >= MODE_HTMIX && pTransmit->field.MCS > 7) { pTxWI->MCS = 7; @@ -1043,7 +1043,7 @@ VOID RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pOutTxWI, IN BOOLEAN FRA } } } - //pTxWI->MIMOps = (pMac->PsMode == PWR_MMPS)? 1:0; + /*pTxWI->MIMOps = (pMac->PsMode == PWR_MMPS)? 1:0; */ if (pMac->bIAmBadAtheros && (pMac->WepStatus != Ndis802_11WEPDisabled)) { pTxWI->MpduDensity = 7; @@ -1068,10 +1068,10 @@ VOID RTMPWriteTxWI_Data(IN PRTMP_ADAPTER pAd, pTransmit = pTxBlk->pTransmit; pMacEntry = pTxBlk->pMacEntry; - // - // Always use Long preamble before verifiation short preamble functionality works well. - // Todo: remove the following line if short preamble functionality works - // + /* */ + /* Always use Long preamble before verifiation short preamble functionality works well. */ + /* Todo: remove the following line if short preamble functionality works */ + /* */ OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); NdisZeroMemory(pTxWI, TXWI_SIZE); @@ -1084,16 +1084,16 @@ VOID RTMPWriteTxWI_Data(IN PRTMP_ADAPTER pAd, pTxWI->MPDUtotalByteCount = pTxBlk->MpduHeaderLen + pTxBlk->SrcBufLen; pTxWI->CFACK = TX_BLK_TEST_FLAG(pTxBlk, fTX_bPiggyBack); - // If CCK or OFDM, BW must be 20 + /* If CCK or OFDM, BW must be 20 */ pTxWI->BW = (pTransmit->field.MODE <= MODE_OFDM) ? (BW_20) : (pTransmit->field.BW); pTxWI->AMPDU = ((pTxBlk->TxFrameType == TX_AMPDU_FRAME) ? TRUE : FALSE); - // John tune the performace with Intel Client in 20 MHz performance + /* John tune the performace with Intel Client in 20 MHz performance */ BASize = pAd->CommonCfg.TxBASize; if ((pTxBlk->TxFrameType == TX_AMPDU_FRAME) && (pMacEntry)) { - UCHAR RABAOriIdx = 0; //The RA's BA Originator table index. + UCHAR RABAOriIdx = 0; /*The RA's BA Originator table index. */ RABAOriIdx = pTxBlk->pMacEntry->BAOriWcidArray[pTxBlk->UserPriority]; @@ -1111,10 +1111,10 @@ VOID RTMPWriteTxWI_Data(IN PRTMP_ADAPTER pAd, if (pMacEntry) { if ((pMacEntry->MmpsMode == MMPS_DYNAMIC) && (pTransmit->field.MCS > 7)) { - // Dynamic MIMO Power Save Mode + /* Dynamic MIMO Power Save Mode */ pTxWI->MIMOps = 1; } else if (pMacEntry->MmpsMode == MMPS_STATIC) { - // Static MIMO Power Save Mode + /* Static MIMO Power Save Mode */ if (pTransmit->field.MODE >= MODE_HTMIX && pTransmit->field.MCS > 7) { pTxWI->MCS = 7; @@ -1130,7 +1130,7 @@ VOID RTMPWriteTxWI_Data(IN PRTMP_ADAPTER pAd, } } - // for rate adapation + /* for rate adapation */ pTxWI->PacketId = pTxWI->MCS; } @@ -1140,19 +1140,19 @@ VOID RTMPWriteTxWI_Cache(IN PRTMP_ADAPTER pAd, PHTTRANSMIT_SETTING /*pTxHTPhyMode, */ pTransmit; PMAC_TABLE_ENTRY pMacEntry; - // - // update TXWI - // + /* */ + /* update TXWI */ + /* */ pMacEntry = pTxBlk->pMacEntry; pTransmit = pTxBlk->pTransmit; - //if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) - //if (RTMPCheckEntryEnableAutoRateSwitch(pAd, pMacEntry)) - //if (TX_BLK_TEST_FLAG(pTxBlk, fTX_AutoRateSwitch)) + /*if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) */ + /*if (RTMPCheckEntryEnableAutoRateSwitch(pAd, pMacEntry)) */ + /*if (TX_BLK_TEST_FLAG(pTxBlk, fTX_AutoRateSwitch)) */ if (pMacEntry->bAutoTxRateSwitch) { pTxWI->txop = IFS_HTTXOP; - // If CCK or OFDM, BW must be 20 + /* If CCK or OFDM, BW must be 20 */ pTxWI->BW = (pTransmit->field.MODE <= MODE_OFDM) ? (BW_20) : (pTransmit->field.BW); @@ -1162,7 +1162,7 @@ VOID RTMPWriteTxWI_Cache(IN PRTMP_ADAPTER pAd, pTxWI->MCS = pTransmit->field.MCS; pTxWI->PHYMODE = pTransmit->field.MODE; - // set PID for TxRateSwitching + /* set PID for TxRateSwitching */ pTxWI->PacketId = pTransmit->field.MCS; } @@ -1170,13 +1170,13 @@ VOID RTMPWriteTxWI_Cache(IN PRTMP_ADAPTER pAd, pTxWI->MIMOps = 0; if (pAd->CommonCfg.bMIMOPSEnable) { - // MIMO Power Save Mode + /* MIMO Power Save Mode */ if ((pMacEntry->MmpsMode == MMPS_DYNAMIC) && (pTransmit->field.MCS > 7)) { - // Dynamic MIMO Power Save Mode + /* Dynamic MIMO Power Save Mode */ pTxWI->MIMOps = 1; } else if (pMacEntry->MmpsMode == MMPS_STATIC) { - // Static MIMO Power Save Mode + /* Static MIMO Power Save Mode */ if ((pTransmit->field.MODE >= MODE_HTMIX) && (pTransmit->field.MCS > 7)) { pTxWI->MCS = 7; @@ -1189,26 +1189,26 @@ VOID RTMPWriteTxWI_Cache(IN PRTMP_ADAPTER pAd, } -// should be called only when - -// 1. MEADIA_CONNECTED -// 2. AGGREGATION_IN_USED -// 3. Fragmentation not in used -// 4. either no previous frame (pPrevAddr1=NULL) .OR. previoud frame is aggregatible +/* should be called only when - */ +/* 1. MEADIA_CONNECTED */ +/* 2. AGGREGATION_IN_USED */ +/* 3. Fragmentation not in used */ +/* 4. either no previous frame (pPrevAddr1=NULL) .OR. previoud frame is aggregatible */ BOOLEAN TxFrameIsAggregatible(IN PRTMP_ADAPTER pAd, IN PUCHAR pPrevAddr1, IN PUCHAR p8023hdr) { - // can't aggregate EAPOL (802.1x) frame + /* can't aggregate EAPOL (802.1x) frame */ if ((p8023hdr[12] == 0x88) && (p8023hdr[13] == 0x8e)) return FALSE; - // can't aggregate multicast/broadcast frame + /* can't aggregate multicast/broadcast frame */ if (p8023hdr[0] & 0x01) return FALSE; - if (INFRA_ON(pAd)) // must be unicast to AP + if (INFRA_ON(pAd)) /* must be unicast to AP */ return TRUE; - else if ((pPrevAddr1 == NULL) || MAC_ADDR_EQUAL(pPrevAddr1, p8023hdr)) // unicast to same STA + else if ((pPrevAddr1 == NULL) || MAC_ADDR_EQUAL(pPrevAddr1, p8023hdr)) /* unicast to same STA */ return TRUE; else return FALSE; @@ -1241,10 +1241,10 @@ BOOLEAN PeerIsAggreOn(IN PRTMP_ADAPTER pAd, return TRUE; } #ifdef AGGREGATION_SUPPORT - if (TxRate >= RATE_6 && pAd->CommonCfg.bAggregationCapable && (!(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_WMM_CAPABLE)))) { // legacy Ralink Aggregation support + if (TxRate >= RATE_6 && pAd->CommonCfg.bAggregationCapable && (!(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && CLIENT_STATUS_TEST_FLAG(pMacEntry, fCLIENT_STATUS_WMM_CAPABLE)))) { /* legacy Ralink Aggregation support */ return TRUE; } -#endif // AGGREGATION_SUPPORT // +#endif /* AGGREGATION_SUPPORT // */ } return FALSE; @@ -1273,9 +1273,9 @@ PQUEUE_HEADER RTMPCheckTxSwQueue(IN PRTMP_ADAPTER pAd, OUT PUCHAR pQueIdx) { ULONG Number; - // 2004-11-15 to be removed. test aggregation only -// if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED)) && (*pNumber < 2)) -// return NULL; + /* 2004-11-15 to be removed. test aggregation only */ +/* if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED)) && (*pNumber < 2)) */ +/* return NULL; */ Number = pAd->TxSwQueue[QID_AC_BK].Number + pAd->TxSwQueue[QID_AC_BE].Number @@ -1295,7 +1295,7 @@ PQUEUE_HEADER RTMPCheckTxSwQueue(IN PRTMP_ADAPTER pAd, OUT PUCHAR pQueIdx) *pQueIdx = QID_AC_BK; return (&pAd->TxSwQueue[QID_AC_BK]); } - // No packet pending in Tx Sw queue + /* No packet pending in Tx Sw queue */ *pQueIdx = QID_AC_BK; return (NULL); @@ -1321,19 +1321,19 @@ VOID RTMPSuspendMsduTransmission(IN PRTMP_ADAPTER pAd) { DBGPRINT(RT_DEBUG_TRACE, ("SCANNING, suspend MSDU transmission ...\n")); - // - // Before BSS_SCAN_IN_PROGRESS, we need to keep Current R66 value and - // use Lowbound as R66 value on ScanNextChannel(...) - // + /* */ + /* Before BSS_SCAN_IN_PROGRESS, we need to keep Current R66 value and */ + /* use Lowbound as R66 value on ScanNextChannel(...) */ + /* */ RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R66, &pAd->BbpTuning.R66CurrentValue); - // set BBP_R66 to 0x30/0x40 when scanning (AsicSwitchChannel will set R66 according to channel when scanning) - //RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, (0x26 + GET_LNA_GAIN(pAd))); + /* set BBP_R66 to 0x30/0x40 when scanning (AsicSwitchChannel will set R66 according to channel when scanning) */ + /*RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, (0x26 + GET_LNA_GAIN(pAd))); */ RTMPSetAGCInitValue(pAd, BW_20); RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); - //RTMP_IO_WRITE32(pAd, TX_CNTL_CSR, 0x000f0000); // abort all TX rings + /*RTMP_IO_WRITE32(pAd, TX_CNTL_CSR, 0x000f0000); // abort all TX rings */ } /* @@ -1356,12 +1356,12 @@ VOID RTMPSuspendMsduTransmission(IN PRTMP_ADAPTER pAd) */ VOID RTMPResumeMsduTransmission(IN PRTMP_ADAPTER pAd) { -// UCHAR IrqState; +/* UCHAR IrqState; */ DBGPRINT(RT_DEBUG_TRACE, ("SCAN done, resume MSDU transmission ...\n")); - // After finish BSS_SCAN_IN_PROGRESS, we need to restore Current R66 value - // R66 should not be 0 + /* After finish BSS_SCAN_IN_PROGRESS, we need to restore Current R66 value */ + /* R66 should not be 0 */ if (pAd->BbpTuning.R66CurrentValue == 0) { pAd->BbpTuning.R66CurrentValue = 0x38; DBGPRINT_ERR(("RTMPResumeMsduTransmission, R66CurrentValue=0...\n")); @@ -1371,11 +1371,11 @@ VOID RTMPResumeMsduTransmission(IN PRTMP_ADAPTER pAd) pAd->BbpTuning.R66CurrentValue); RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); -// sample, for IRQ LOCK to SEM LOCK -// IrqState = pAd->irq_disabled; -// if (IrqState) -// RTMPDeQueuePacket(pAd, TRUE, NUM_OF_TX_RING, MAX_TX_PROCESS); -// else +/* sample, for IRQ LOCK to SEM LOCK */ +/* IrqState = pAd->irq_disabled; */ +/* if (IrqState) */ +/* RTMPDeQueuePacket(pAd, TRUE, NUM_OF_TX_RING, MAX_TX_PROCESS); */ +/* else */ RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); } @@ -1398,9 +1398,9 @@ UINT deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, nMSDU++; - //hex_dump("subheader", pData, 64); + /*hex_dump("subheader", pData, 64); */ pAMSDUsubheader = (PHEADER_802_3) pData; - //pData += LENGTH_802_3; + /*pData += LENGTH_802_3; */ PayloadSize = pAMSDUsubheader->Octet[1] + (pAMSDUsubheader->Octet[0] << 8); @@ -1409,13 +1409,13 @@ UINT deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, if ((DataSize < SubFrameSize) || (PayloadSize > 1518)) { break; } - //DBGPRINT(RT_DEBUG_TRACE,("%d subframe: Size = %d\n", nMSDU, PayloadSize)); + /*DBGPRINT(RT_DEBUG_TRACE,("%d subframe: Size = %d\n", nMSDU, PayloadSize)); */ pPayload = pData + LENGTH_802_3; pDA = pData; pSA = pData + MAC_ADDR_LEN; - // convert to 802.3 header + /* convert to 802.3 header */ CONVERT_TO_802_3(Header802_3, pDA, pSA, pPayload, PayloadSize, pRemovedLLCSNAP); @@ -1431,7 +1431,7 @@ UINT deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, Elem->MsgLen = LENGTH_802_11 + LENGTH_802_1_H + PayloadSize; - //WpaEAPOLKeyAction(pAd, Elem); + /*WpaEAPOLKeyAction(pAd, Elem); */ REPORT_MGMT_FRAME_TO_MLME(pAd, BSSID_WCID, Elem->Msg, Elem->MsgLen, 0, 0, 0, @@ -1456,8 +1456,8 @@ UINT deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, (pPacket)); } - // A-MSDU has padding to multiple of 4 including subframe header. - // align SubFrameSize up to multiple of 4 + /* A-MSDU has padding to multiple of 4 including subframe header. */ + /* align SubFrameSize up to multiple of 4 */ SubFrameSize = (SubFrameSize + 3) & (~0x3); if (SubFrameSize > 1528 || SubFrameSize < 32) { @@ -1468,12 +1468,12 @@ UINT deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, pData += SubFrameSize; DataSize -= SubFrameSize; } else { - // end of A-MSDU + /* end of A-MSDU */ DataSize = 0; } } - // finally release original rx packet + /* finally release original rx packet */ RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); return nMSDU; @@ -1528,10 +1528,10 @@ MAC_TABLE_ENTRY *MacTableInsertEntry(IN PRTMP_ADAPTER pAd, UCHAR HashIdx; int i, FirstWcid; MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry; -// USHORT offset; -// ULONG addr; +/* USHORT offset; */ +/* ULONG addr; */ - // if FULL, return + /* if FULL, return */ if (pAd->MacTab.Size >= MAX_LEN_OF_MAC_TABLE) return NULL; @@ -1540,11 +1540,11 @@ MAC_TABLE_ENTRY *MacTableInsertEntry(IN PRTMP_ADAPTER pAd, if (pAd->StaCfg.BssType == BSS_INFRA) FirstWcid = 2; - // allocate one MAC entry + /* allocate one MAC entry */ NdisAcquireSpinLock(&pAd->MacTabLock); - for (i = FirstWcid; i < MAX_LEN_OF_MAC_TABLE; i++) // skip entry#0 so that "entry index == AID" for fast lookup + for (i = FirstWcid; i < MAX_LEN_OF_MAC_TABLE; i++) /* skip entry#0 so that "entry index == AID" for fast lookup */ { - // pick up the first available vacancy + /* pick up the first available vacancy */ if ((pAd->MacTab.Content[i].ValidAsCLI == FALSE) && (pAd->MacTab.Content[i].ValidAsWDS == FALSE) && (pAd->MacTab.Content[i].ValidAsApCli == FALSE) && @@ -1602,7 +1602,7 @@ MAC_TABLE_ENTRY *MacTableInsertEntry(IN PRTMP_ADAPTER pAd, pEntry-> apidx, (UCHAR) i); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ } } @@ -1615,7 +1615,7 @@ MAC_TABLE_ENTRY *MacTableInsertEntry(IN PRTMP_ADAPTER pAd, COPY_MAC_ADDR(pEntry->Addr, pAddr); pEntry->Sst = SST_NOT_AUTH; pEntry->AuthState = AS_NOT_AUTH; - pEntry->Aid = (USHORT) i; //0; + pEntry->Aid = (USHORT) i; /*0; */ pEntry->CapabilityInfo = 0; pEntry->PsMode = PWR_ACTIVE; pEntry->PsQIdleCount = 0; @@ -1625,7 +1625,7 @@ MAC_TABLE_ENTRY *MacTableInsertEntry(IN PRTMP_ADAPTER pAd, InitializeQueueHeader(&pEntry->PsQueue); pAd->MacTab.Size++; - // Add this entry into ASIC RX WCID search table + /* Add this entry into ASIC RX WCID search table */ RTMP_STA_ENTRY_ADD(pAd, pEntry); DBGPRINT(RT_DEBUG_TRACE, @@ -1635,7 +1635,7 @@ MAC_TABLE_ENTRY *MacTableInsertEntry(IN PRTMP_ADAPTER pAd, } } - // add this MAC entry into HASH table + /* add this MAC entry into HASH table */ if (pEntry) { HashIdx = MAC_ADDR_HASH_INDEX(pAddr); if (pAd->MacTab.Hash[HashIdx] == NULL) { @@ -1664,8 +1664,8 @@ BOOLEAN MacTableDeleteEntry(IN PRTMP_ADAPTER pAd, USHORT HashIdx; MAC_TABLE_ENTRY *pEntry, *pPrevEntry, *pProbeEntry; BOOLEAN Cancelled; - //USHORT offset; // unused variable - //UCHAR j; // unused variable + /*USHORT offset; // unused variable */ + /*UCHAR j; // unused variable */ if (wcid >= MAX_LEN_OF_MAC_TABLE) return FALSE; @@ -1673,7 +1673,7 @@ BOOLEAN MacTableDeleteEntry(IN PRTMP_ADAPTER pAd, NdisAcquireSpinLock(&pAd->MacTabLock); HashIdx = MAC_ADDR_HASH_INDEX(pAddr); - //pEntry = pAd->MacTab.Hash[HashIdx]; + /*pEntry = pAd->MacTab.Hash[HashIdx]; */ pEntry = &pAd->MacTab.Content[wcid]; if (pEntry @@ -1681,17 +1681,17 @@ BOOLEAN MacTableDeleteEntry(IN PRTMP_ADAPTER pAd, || pEntry->ValidAsMesh)) { if (MAC_ADDR_EQUAL(pEntry->Addr, pAddr)) { - // Delete this entry from ASIC on-chip WCID Table + /* Delete this entry from ASIC on-chip WCID Table */ RTMP_STA_ENTRY_MAC_RESET(pAd, wcid); - // free resources of BA + /* free resources of BA */ BASessionTearDownALL(pAd, pEntry->Aid); pPrevEntry = NULL; pProbeEntry = pAd->MacTab.Hash[HashIdx]; ASSERT(pProbeEntry); - // update Hash list + /* update Hash list */ do { if (pProbeEntry == pEntry) { if (pPrevEntry == NULL) { @@ -1708,7 +1708,7 @@ BOOLEAN MacTableDeleteEntry(IN PRTMP_ADAPTER pAd, pProbeEntry = pProbeEntry->pNext; } while (pProbeEntry); - // not found !!! + /* not found !!! */ ASSERT(pProbeEntry != NULL); RTMP_STA_ENTRY_KEY_DEL(pAd, BSS0, wcid); @@ -1736,11 +1736,10 @@ BOOLEAN MacTableDeleteEntry(IN PRTMP_ADAPTER pAd, NdisReleaseSpinLock(&pAd->MacTabLock); - //Reset operating mode when no Sta. + /*Reset operating mode when no Sta. */ if (pAd->MacTab.Size == 0) { pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode = 0; - //AsicUpdateProtect(pAd, 0 /*pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode*/, (ALLN_SETPROTECT), TRUE, 0 /*pAd->MacTab.fAnyStationNonGF*/); - RTMP_UPDATE_PROTECT(pAd); // edit by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet + RTMP_UPDATE_PROTECT(pAd); /* edit by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet */ } return TRUE; @@ -1758,15 +1757,15 @@ VOID MacTableReset(IN PRTMP_ADAPTER pAd) int i; DBGPRINT(RT_DEBUG_TRACE, ("MacTableReset\n")); - //NdisAcquireSpinLock(&pAd->MacTabLock); + /*NdisAcquireSpinLock(&pAd->MacTabLock); */ for (i = 1; i < MAX_LEN_OF_MAC_TABLE; i++) { #ifdef RTMP_MAC_PCI RTMP_STA_ENTRY_MAC_RESET(pAd, i); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ if (pAd->MacTab.Content[i].ValidAsCLI == TRUE) { - // free resources of BA + /* free resources of BA */ BASessionTearDownALL(pAd, i); pAd->MacTab.Content[i].ValidAsCLI = FALSE; @@ -1774,9 +1773,9 @@ VOID MacTableReset(IN PRTMP_ADAPTER pAd) #ifdef RTMP_MAC_USB NdisZeroMemory(pAd->MacTab.Content[i].Addr, 6); RTMP_STA_ENTRY_MAC_RESET(pAd, i); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ - //AsicDelWcidTab(pAd, i); + /*AsicDelWcidTab(pAd, i); */ } } @@ -1798,8 +1797,8 @@ VOID AssocParmFill(IN PRTMP_ADAPTER pAd, IN ULONG Timeout, IN USHORT ListenIntv) { COPY_MAC_ADDR(AssocReq->Addr, pAddr); - // Add mask to support 802.11b mode only - AssocReq->CapabilityInfo = CapabilityInfo & SUPPORTED_CAPABILITY_INFO; // not cf-pollable, not cf-poll-request + /* Add mask to support 802.11b mode only */ + AssocReq->CapabilityInfo = CapabilityInfo & SUPPORTED_CAPABILITY_INFO; /* not cf-pollable, not cf-poll-request */ AssocReq->Timeout = Timeout; AssocReq->ListenIntv = ListenIntv; } @@ -1874,9 +1873,9 @@ BOOLEAN RTMPCheckDHCPFrame(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) pSrc = (PUCHAR) pVirtualAddress; Protocol = *(pSrc + 12) * 256 + *(pSrc + 13); - // - // Check DHCP & BOOTP protocol - // + /* */ + /* Check DHCP & BOOTP protocol */ + /* */ while (NumberOfBytesRead <= PacketInfo.TotalPacketLength) { if ((NumberOfBytesRead >= 35) && (ReadFirstParm == TRUE)) { CurrentOffset = @@ -1889,19 +1888,19 @@ BOOLEAN RTMPCheckDHCPFrame(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) CurrentOffset = 37 - (NumberOfBytesRead - NdisBufferLength); ByteOffset38 = *(pSrc + CurrentOffset); - //End of Read + /*End of Read */ break; } return FALSE; } - // Check for DHCP & BOOTP protocol + /* Check for DHCP & BOOTP protocol */ if ((ByteOffset36 != 0x44) || (ByteOffset38 != 0x43)) { - // - // 2054 (hex 0806) for ARP datagrams - // if this packet is not ARP datagrams, then do nothing - // ARP datagrams will also be duplicate at 1mb broadcast frames - // + /* */ + /* 2054 (hex 0806) for ARP datagrams */ + /* if this packet is not ARP datagrams, then do nothing */ + /* ARP datagrams will also be duplicate at 1mb broadcast frames */ + /* */ if (Protocol != 0x0806) return FALSE; } @@ -1925,12 +1924,12 @@ BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) RTMP_SET_PACKET_SPECIFIC(pPacket, 0); - // get Ethernet protocol field + /* get Ethernet protocol field */ TypeLen = (pSrcBuf[12] << 8) | pSrcBuf[13]; - pSrcBuf += LENGTH_802_3; // Skip the Ethernet Header. + pSrcBuf += LENGTH_802_3; /* Skip the Ethernet Header. */ - if (TypeLen <= 1500) { // 802.3, 802.3 LLC + if (TypeLen <= 1500) { /* 802.3, 802.3 LLC */ /* DestMAC(6) + SrcMAC(6) + Lenght(2) + DSAP(1) + SSAP(1) + Control(1) + @@ -1943,12 +1942,12 @@ BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) &Byte0, &Byte1); RTMP_SET_PACKET_LLCSNAP(pPacket, 1); TypeLen = (USHORT) ((Byte0 << 8) + Byte1); - pSrcBuf += 8; // Skip this LLC/SNAP header + pSrcBuf += 8; /* Skip this LLC/SNAP header */ } else { - //It just has 3-byte LLC header, maybe a legacy ether type frame. we didn't handle it. + /*It just has 3-byte LLC header, maybe a legacy ether type frame. we didn't handle it. */ } } - // If it's a VLAN packet, get the real Type/Length field. + /* If it's a VLAN packet, get the real Type/Length field. */ if (TypeLen == 0x8100) { /* 0x8100 means VLAN packets */ @@ -1966,17 +1965,17 @@ BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) &Byte1); TypeLen = (USHORT) ((Byte0 << 8) + Byte1); - pSrcBuf += 4; // Skip the VLAN Header. + pSrcBuf += 4; /* Skip the VLAN Header. */ } switch (TypeLen) { case 0x0800: { ASSERT((pktLen > 34)); - if (*(pSrcBuf + 9) == 0x11) { // udp packet - ASSERT((pktLen > 34)); // 14 for ethernet header, 20 for IP header + if (*(pSrcBuf + 9) == 0x11) { /* udp packet */ + ASSERT((pktLen > 34)); /* 14 for ethernet header, 20 for IP header */ - pSrcBuf += 20; // Skip the IP header + pSrcBuf += 20; /* Skip the IP header */ srcPort = OS_NTOHS(get_unaligned ((PUINT16) (pSrcBuf))); @@ -1984,7 +1983,7 @@ BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) OS_NTOHS(get_unaligned ((PUINT16) (pSrcBuf + 2))); - if ((srcPort == 0x44 && dstPort == 0x43) || (srcPort == 0x43 && dstPort == 0x44)) { //It's a BOOTP/DHCP packet + if ((srcPort == 0x44 && dstPort == 0x43) || (srcPort == 0x43 && dstPort == 0x44)) { /*It's a BOOTP/DHCP packet */ RTMP_SET_PACKET_DHCP(pPacket, 1); } } @@ -1992,13 +1991,13 @@ BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) break; case 0x0806: { - //ARP Packet. + /*ARP Packet. */ RTMP_SET_PACKET_DHCP(pPacket, 1); } break; case 0x888e: { - // EAPOL Packet. + /* EAPOL Packet. */ RTMP_SET_PACKET_EAPOL(pPacket, 1); } break; @@ -2040,22 +2039,22 @@ VOID Update_Rssi_Sample(IN PRTMP_ADAPTER pAd, } } -// Normal legacy Rx packet indication +/* Normal legacy Rx packet indication */ VOID Indicate_Legacy_Packet(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) { PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; UCHAR Header802_3[LENGTH_802_3]; - // 1. get 802.3 Header - // 2. remove LLC - // a. pointer pRxBlk->pData to payload - // b. modify pRxBlk->DataSize + /* 1. get 802.3 Header */ + /* 2. remove LLC */ + /* a. pointer pRxBlk->pData to payload */ + /* b. modify pRxBlk->DataSize */ RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(pRxBlk, Header802_3); if (pRxBlk->DataSize > MAX_RX_PKT_LEN) { - // release packet + /* release packet */ RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); return; } @@ -2070,13 +2069,13 @@ VOID Indicate_Legacy_Packet(IN PRTMP_ADAPTER pAd, UCHAR TID = pRxBlk->pRxWI->TID; USHORT Idx; -#define REORDERING_PACKET_TIMEOUT ((100 * OS_HZ)/1000) // system ticks -- 100 ms +#define REORDERING_PACKET_TIMEOUT ((100 * OS_HZ)/1000) /* system ticks -- 100 ms */ if (Wcid < MAX_LEN_OF_MAC_TABLE) { Idx = pAd->MacTab.Content[Wcid].BARecWcidArray[TID]; if (Idx != 0) { pBAEntry = &pAd->BATable.BARecEntry[Idx]; - // update last rx time + /* update last rx time */ NdisGetSystemUpTime(&Now32); if ((pBAEntry->list.qlen > 0) && RTMP_TIME_AFTER((unsigned long)Now32, @@ -2101,17 +2100,17 @@ VOID Indicate_Legacy_Packet(IN PRTMP_ADAPTER pAd, } } } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ wlan_802_11_to_802_3_packet(pAd, pRxBlk, Header802_3, FromWhichBSSID); - // - // pass this 802.3 packet to upper layer or forward this packet to WM directly - // + /* */ + /* pass this 802.3 packet to upper layer or forward this packet to WM directly */ + /* */ ANNOUNCE_OR_FORWARD_802_3_PACKET(pAd, pRxPacket, FromWhichBSSID); } -// Normal, AMPDU or AMSDU +/* Normal, AMPDU or AMSDU */ VOID CmmRxnonRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) { @@ -2120,7 +2119,7 @@ VOID CmmRxnonRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, Indicate_AMPDU_Packet(pAd, pRxBlk, FromWhichBSSID); } else { if (RX_BLK_TEST_FLAG(pRxBlk, fRX_AMSDU)) { - // handle A-MSDU + /* handle A-MSDU */ Indicate_AMSDU_Packet(pAd, pRxBlk, FromWhichBSSID); } else { Indicate_Legacy_Packet(pAd, pRxBlk, FromWhichBSSID); @@ -2145,18 +2144,18 @@ VOID CmmRxRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, pRxBlk->pData += 2; pRxBlk->DataSize -= 2; } else { - // release packet + /* release packet */ RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); return; } - // get 802.3 Header and remove LLC + /* get 802.3 Header and remove LLC */ RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(pRxBlk, Header802_3); ASSERT(pRxBlk->pRxPacket); - // Ralink Aggregation frame + /* Ralink Aggregation frame */ pAd->RalinkCounters.OneSecRxAggregationCount++; Payload1Size = pRxBlk->DataSize - Msdu2Size; Payload2Size = Msdu2Size - LENGTH_802_3; @@ -2168,12 +2167,12 @@ VOID CmmRxRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, Payload2Size, FromWhichBSSID); if (!pPacket2) { - // release packet + /* release packet */ RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); return; } - // update payload size of 1st packet + /* update payload size of 1st packet */ pRxBlk->DataSize = Payload1Size; wlan_802_11_to_802_3_packet(pAd, pRxBlk, Header802_3, FromWhichBSSID); @@ -2208,10 +2207,10 @@ PNDIS_PACKET RTMPDeFragmentDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) HeaderRoom = pData - (UCHAR *) pHeader; - // Re-assemble the fragmented packets - if (pHeader->Frag == 0) // Frag. Number is 0 : First frag or only one pkt + /* Re-assemble the fragmented packets */ + if (pHeader->Frag == 0) /* Frag. Number is 0 : First frag or only one pkt */ { - // the first pkt of fragment, record it. + /* the first pkt of fragment, record it. */ if (pHeader->FC.MoreFrag) { ASSERT(pAd->FragFrame.pFragPacket); pFragBuffer = @@ -2220,67 +2219,67 @@ PNDIS_PACKET RTMPDeFragmentDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) NdisMoveMemory(pFragBuffer, pHeader, pAd->FragFrame.RxSize); pAd->FragFrame.Sequence = pHeader->Sequence; - pAd->FragFrame.LastFrag = pHeader->Frag; // Should be 0 + pAd->FragFrame.LastFrag = pHeader->Frag; /* Should be 0 */ ASSERT(pAd->FragFrame.LastFrag == 0); - goto done; // end of processing this frame + goto done; /* end of processing this frame */ } - } else //Middle & End of fragment + } else /*Middle & End of fragment */ { if ((pHeader->Sequence != pAd->FragFrame.Sequence) || (pHeader->Frag != (pAd->FragFrame.LastFrag + 1))) { - // Fragment is not the same sequence or out of fragment number order - // Reset Fragment control blk + /* Fragment is not the same sequence or out of fragment number order */ + /* Reset Fragment control blk */ RESET_FRAGFRAME(pAd->FragFrame); DBGPRINT(RT_DEBUG_ERROR, ("Fragment is not the same sequence or out of fragment number order.\n")); - goto done; // give up this frame + goto done; /* give up this frame */ } else if ((pAd->FragFrame.RxSize + DataSize) > MAX_FRAME_SIZE) { - // Fragment frame is too large, it exeeds the maximum frame size. - // Reset Fragment control blk + /* Fragment frame is too large, it exeeds the maximum frame size. */ + /* Reset Fragment control blk */ RESET_FRAGFRAME(pAd->FragFrame); DBGPRINT(RT_DEBUG_ERROR, ("Fragment frame is too large, it exeeds the maximum frame size.\n")); - goto done; // give up this frame + goto done; /* give up this frame */ } - // - // Broadcom AP(BCM94704AGR) will send out LLC in fragment's packet, LLC only can accpet at first fragment. - // In this case, we will dropt it. - // + /* */ + /* Broadcom AP(BCM94704AGR) will send out LLC in fragment's packet, LLC only can accpet at first fragment. */ + /* In this case, we will dropt it. */ + /* */ if (NdisEqualMemory(pData, SNAP_802_1H, sizeof(SNAP_802_1H))) { DBGPRINT(RT_DEBUG_ERROR, ("Find another LLC at Middle or End fragment(SN=%d, Frag=%d)\n", pHeader->Sequence, pHeader->Frag)); - goto done; // give up this frame + goto done; /* give up this frame */ } pFragBuffer = GET_OS_PKT_DATAPTR(pAd->FragFrame.pFragPacket); - // concatenate this fragment into the re-assembly buffer + /* concatenate this fragment into the re-assembly buffer */ NdisMoveMemory((pFragBuffer + pAd->FragFrame.RxSize), pData, DataSize); pAd->FragFrame.RxSize += DataSize; - pAd->FragFrame.LastFrag = pHeader->Frag; // Update fragment number + pAd->FragFrame.LastFrag = pHeader->Frag; /* Update fragment number */ - // Last fragment + /* Last fragment */ if (pHeader->FC.MoreFrag == FALSE) { bReassDone = TRUE; } } done: - // always release rx fragmented packet + /* always release rx fragmented packet */ RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); - // return defragmented packet if packet is reassembled completely - // otherwise return NULL + /* return defragmented packet if packet is reassembled completely */ + /* otherwise return NULL */ if (bReassDone) { PNDIS_PACKET pNewFragPacket; - // allocate a new packet buffer for fragment + /* allocate a new packet buffer for fragment */ pNewFragPacket = RTMP_AllocateFragPacketBuffer(pAd, RX_BUFFER_NORMSIZE); if (pNewFragPacket) { - // update RxBlk + /* update RxBlk */ pRetPacket = pAd->FragFrame.pFragPacket; pAd->FragFrame.pFragPacket = pNewFragPacket; pRxBlk->pHeader = @@ -2322,14 +2321,14 @@ VOID Indicate_EAPOL_Packet(IN PRTMP_ADAPTER pAd, if (pEntry == NULL) { DBGPRINT(RT_DEBUG_WARN, ("Indicate_EAPOL_Packet: drop and release the invalid packet.\n")); - // release packet + /* release packet */ RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); return; } } -#define BCN_TBTT_OFFSET 64 //defer 64 us +#define BCN_TBTT_OFFSET 64 /*defer 64 us */ VOID ReSyncBeaconTime(IN PRTMP_ADAPTER pAd) { @@ -2339,21 +2338,21 @@ VOID ReSyncBeaconTime(IN PRTMP_ADAPTER pAd) pAd->TbttTickCount++; - // - // The updated BeaconInterval Value will affect Beacon Interval after two TBTT - // beacasue the original BeaconInterval had been loaded into next TBTT_TIMER - // + /* */ + /* The updated BeaconInterval Value will affect Beacon Interval after two TBTT */ + /* beacasue the original BeaconInterval had been loaded into next TBTT_TIMER */ + /* */ if (Offset == (BCN_TBTT_OFFSET - 2)) { BCN_TIME_CFG_STRUC csr; RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr.word); - csr.field.BeaconInterval = (pAd->CommonCfg.BeaconPeriod << 4) - 1; // ASIC register in units of 1/16 TU = 64us + csr.field.BeaconInterval = (pAd->CommonCfg.BeaconPeriod << 4) - 1; /* ASIC register in units of 1/16 TU = 64us */ RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr.word); } else { if (Offset == (BCN_TBTT_OFFSET - 1)) { BCN_TIME_CFG_STRUC csr; RTMP_IO_READ32(pAd, BCN_TIME_CFG, &csr.word); - csr.field.BeaconInterval = (pAd->CommonCfg.BeaconPeriod) << 4; // ASIC register in units of 1/16 TU + csr.field.BeaconInterval = (pAd->CommonCfg.BeaconPeriod) << 4; /* ASIC register in units of 1/16 TU */ RTMP_IO_WRITE32(pAd, BCN_TIME_CFG, csr.word); } } diff --git a/drivers/staging/rt2860/common/cmm_data_pci.c b/drivers/staging/rt2860/common/cmm_data_pci.c index f98f1a887201..157ebc6dd2bf 100644 --- a/drivers/staging/rt2860/common/cmm_data_pci.c +++ b/drivers/staging/rt2860/common/cmm_data_pci.c @@ -44,23 +44,23 @@ USHORT RtmpPCI_WriteTxResource(IN PRTMP_ADAPTER pAd, PRTMP_TX_RING pTxRing; USHORT hwHeaderLen; - // - // get Tx Ring Resource - // + /* */ + /* get Tx Ring Resource */ + /* */ pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); - // copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer + /* copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer */ if (pTxBlk->TxFrameType == TX_AMSDU_FRAME) { - //hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD; + /*hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD; */ hwHeaderLen = pTxBlk->MpduHeaderLen - LENGTH_AMSDU_SUBFRAMEHEAD + pTxBlk->HdrPadLen + LENGTH_AMSDU_SUBFRAMEHEAD; } else { - //hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); + /*hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); */ hwHeaderLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; } NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, @@ -69,15 +69,15 @@ USHORT RtmpPCI_WriteTxResource(IN PRTMP_ADAPTER pAd, pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket; pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; - // - // build Tx Descriptor - // + /* */ + /* build Tx Descriptor */ + /* */ pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; NdisZeroMemory(pTxD, TXD_SIZE); pTxD->SDPtr0 = BufBasePaLow; - pTxD->SDLen0 = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; // include padding + pTxD->SDLen0 = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; /* include padding */ pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE); pTxD->SDLen1 = pTxBlk->SrcBufLen; pTxD->LastSec0 = 0; @@ -86,9 +86,9 @@ USHORT RtmpPCI_WriteTxResource(IN PRTMP_ADAPTER pAd, RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); RetTxIdx = TxIdx; - // - // Update Tx index - // + /* */ + /* Update Tx index */ + /* */ INC_RING_INDEX(TxIdx, TX_RING_SIZE); pTxRing->TxCpuIdx = TxIdx; @@ -110,17 +110,17 @@ USHORT RtmpPCI_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, PRTMP_TX_RING pTxRing; USHORT hwHeaderLen; - // - // get Tx Ring Resource - // + /* */ + /* get Tx Ring Resource */ + /* */ pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); - // copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer - //hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); + /* copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer */ + /*hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); */ hwHeaderLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, @@ -129,14 +129,14 @@ USHORT RtmpPCI_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket; pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; - // - // build Tx Descriptor - // + /* */ + /* build Tx Descriptor */ + /* */ pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; NdisZeroMemory(pTxD, TXD_SIZE); pTxD->SDPtr0 = BufBasePaLow; - pTxD->SDLen0 = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; // include padding + pTxD->SDLen0 = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; /* include padding */ pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE);; pTxD->SDLen1 = pTxBlk->SrcBufLen; pTxD->LastSec0 = 0; @@ -145,9 +145,9 @@ USHORT RtmpPCI_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); RetTxIdx = TxIdx; - // - // Update Tx index - // + /* */ + /* Update Tx index */ + /* */ INC_RING_INDEX(TxIdx, TX_RING_SIZE); pTxRing->TxCpuIdx = TxIdx; @@ -171,9 +171,9 @@ USHORT RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, bIsLast = ((frameNum == (pTxBlk->TotalFrameNum - 1)) ? 1 : 0); - // - // get Tx Ring Resource - // + /* */ + /* get Tx Ring Resource */ + /* */ pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; @@ -181,20 +181,20 @@ USHORT RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); if (frameNum == 0) { - // copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer + /* copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer */ if (pTxBlk->TxFrameType == TX_AMSDU_FRAME) - //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD; + /*hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD; */ hwHdrLen = pTxBlk->MpduHeaderLen - LENGTH_AMSDU_SUBFRAMEHEAD + pTxBlk->HdrPadLen + LENGTH_AMSDU_SUBFRAMEHEAD; else if (pTxBlk->TxFrameType == TX_RALINK_FRAME) - //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_ARALINK_HEADER_FIELD, 4)+LENGTH_ARALINK_HEADER_FIELD; + /*hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_ARALINK_HEADER_FIELD, 4)+LENGTH_ARALINK_HEADER_FIELD; */ hwHdrLen = pTxBlk->MpduHeaderLen - LENGTH_ARALINK_HEADER_FIELD + pTxBlk->HdrPadLen + LENGTH_ARALINK_HEADER_FIELD; else - //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); + /*hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); */ hwHdrLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; firstDMALen = TXINFO_SIZE + TXWI_SIZE + hwHdrLen; @@ -207,14 +207,14 @@ USHORT RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket; pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; - // - // build Tx Descriptor - // + /* */ + /* build Tx Descriptor */ + /* */ pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; NdisZeroMemory(pTxD, TXD_SIZE); pTxD->SDPtr0 = BufBasePaLow; - pTxD->SDLen0 = firstDMALen; // include padding + pTxD->SDLen0 = firstDMALen; /* include padding */ pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE);; pTxD->SDLen1 = pTxBlk->SrcBufLen; pTxD->LastSec0 = 0; @@ -223,9 +223,9 @@ USHORT RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); RetTxIdx = TxIdx; - // - // Update Tx index - // + /* */ + /* Update Tx index */ + /* */ INC_RING_INDEX(TxIdx, TX_RING_SIZE); pTxRing->TxCpuIdx = TxIdx; @@ -243,9 +243,9 @@ VOID RtmpPCI_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, PTXWI_STRUC pTxWI; PRTMP_TX_RING pTxRing; - // - // get Tx Ring Resource - // + /* */ + /* get Tx Ring Resource */ + /* */ pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; pTxWI = (PTXWI_STRUC) pTxRing->Cell[FirstTxIdx].DmaBuf.AllocVa; pTxWI->MPDUtotalByteCount = totalMPDUSize; @@ -258,14 +258,14 @@ VOID RtmpPCIDataLastTxIdx(IN PRTMP_ADAPTER pAd, PTXD_STRUC pTxD; PRTMP_TX_RING pTxRing; - // - // get Tx Ring Resource - // + /* */ + /* get Tx Ring Resource */ + /* */ pTxRing = &pAd->TxRing[QueIdx]; - // - // build Tx Descriptor - // + /* */ + /* build Tx Descriptor */ + /* */ pTxD = (PTXD_STRUC) pTxRing->Cell[LastTxIdx].AllocVa; pTxD->LastSec1 = 1; @@ -284,27 +284,27 @@ USHORT RtmpPCI_WriteFragTxResource(IN PRTMP_ADAPTER pAd, USHORT hwHeaderLen; UINT32 firstDMALen; - // - // Get Tx Ring Resource - // + /* */ + /* Get Tx Ring Resource */ + /* */ pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); - // - // Copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer - // - //hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); + /* */ + /* Copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer */ + /* */ + /*hwHeaderLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); */ hwHeaderLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; firstDMALen = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, firstDMALen); - // - // Build Tx Descriptor - // + /* */ + /* Build Tx Descriptor */ + /* */ pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; NdisZeroMemory(pTxD, TXD_SIZE); @@ -314,7 +314,7 @@ USHORT RtmpPCI_WriteFragTxResource(IN PRTMP_ADAPTER pAd, } pTxD->SDPtr0 = BufBasePaLow; - pTxD->SDLen0 = firstDMALen; // include padding + pTxD->SDLen0 = firstDMALen; /* include padding */ pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE); pTxD->SDLen1 = pTxBlk->SrcBufLen; pTxD->LastSec0 = 0; @@ -325,9 +325,9 @@ USHORT RtmpPCI_WriteFragTxResource(IN PRTMP_ADAPTER pAd, RetTxIdx = TxIdx; pTxBlk->Priv += pTxBlk->SrcBufLen; - // - // Update Tx index - // + /* */ + /* Update Tx index */ + /* */ INC_RING_INDEX(TxIdx, TX_RING_SIZE); pTxRing->TxCpuIdx = TxIdx; @@ -363,7 +363,7 @@ int RtmpPCIMgmtKickOut(IN RTMP_ADAPTER * pAd, PCI_MAP_SINGLE(pAd, pSrcBufVA, SrcBufLen, 0, PCI_DMA_TODEVICE); pTxD->SDLen0 = SrcBufLen; -//================================================================== +/*================================================================== */ /* DBGPRINT_RAW(RT_DEBUG_TRACE, ("MLMEHardTransmit\n")); for (i = 0; i < (TXWI_SIZE+24); i++) { @@ -375,12 +375,12 @@ int RtmpPCIMgmtKickOut(IN RTMP_ADAPTER * pAd, DBGPRINT_RAW(RT_DEBUG_TRACE, ("\n ")); } DBGPRINT_RAW(RT_DEBUG_TRACE, ("\n "));*/ -//======================================================================= +/*======================================================================= */ pAd->RalinkCounters.KickTxCount++; pAd->RalinkCounters.OneSecTxDoneCount++; - // Increase TX_CTX_IDX, but write to register later. + /* Increase TX_CTX_IDX, but write to register later. */ INC_RING_INDEX(pAd->MgmtRing.TxCpuIdx, MGMT_RING_SIZE); RTMP_IO_WRITE32(pAd, TX_MGMTCTX_IDX, pAd->MgmtRing.TxCpuIdx); @@ -412,9 +412,9 @@ NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd, PCIPHER_KEY pWpaKey; INT dBm; - // Phy errors & CRC errors + /* Phy errors & CRC errors */ if ( /*(pRxD->PhyErr) || */ (pRxD->Crc)) { - // Check RSSI for Noise Hist statistic collection. + /* Check RSSI for Noise Hist statistic collection. */ dBm = (INT) (pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta; if (dBm <= -87) pAd->StaCfg.RPIDensity[0] += 1; @@ -435,21 +435,21 @@ NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd, return (NDIS_STATUS_FAILURE); } - // Add Rx size to channel load counter, we should ignore error counts + /* Add Rx size to channel load counter, we should ignore error counts */ pAd->StaCfg.CLBusyBytes += (pRxD->SDL0 + 14); - // Drop ToDs promiscous frame, it is opened due to CCX 2 channel load statistics + /* Drop ToDs promiscous frame, it is opened due to CCX 2 channel load statistics */ if (pHeader != NULL) { if (pHeader->FC.ToDs) { return (NDIS_STATUS_FAILURE); } } - // Drop not U2M frames, cant's drop here because we will drop beacon in this case - // I am kind of doubting the U2M bit operation - // if (pRxD->U2M == 0) - // return(NDIS_STATUS_FAILURE); + /* Drop not U2M frames, cant's drop here because we will drop beacon in this case */ + /* I am kind of doubting the U2M bit operation */ + /* if (pRxD->U2M == 0) */ + /* return(NDIS_STATUS_FAILURE); */ - // drop decyption fail frame + /* drop decyption fail frame */ if (pRxD->CipherErr) { if (pRxD->CipherErr == 2) { DBGPRINT_RAW(RT_DEBUG_TRACE, @@ -471,12 +471,12 @@ NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd, pRxD->CipherErr, pRxD->SDL0, pRxD->Mcast | pRxD->Bcast, pRxD->MyBss, pRxWI->WirelessCliID, -// CipherName[pRxD->CipherAlg], +/* CipherName[pRxD->CipherAlg], */ pRxWI->KeyIndex)); - // - // MIC Error - // + /* */ + /* MIC Error */ + /* */ if (pRxD->CipherErr == 2) { pWpaKey = &pAd->SharedKey[BSS0][pRxWI->KeyIndex]; if (pAd->StaCfg.WpaSupplicantUP) @@ -523,7 +523,7 @@ BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx) PNDIS_PACKET pPacket; UCHAR FREE = 0; TXD_STRUC TxD, *pOriTxD; - //ULONG IrqFlags; + /*ULONG IrqFlags; */ BOOLEAN bReschedule = FALSE; ASSERT(QueIdx < NUM_OF_TX_RING); @@ -532,10 +532,10 @@ BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx) RTMP_IO_READ32(pAd, TX_DTX_IDX0 + QueIdx * RINGREG_DIFF, &pTxRing->TxDmaIdx); while (pTxRing->TxSwFreeIdx != pTxRing->TxDmaIdx) { -// RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); +/* RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); */ - // static rate also need NICUpdateFifoStaCounters() function. - //if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) + /* static rate also need NICUpdateFifoStaCounters() function. */ + /*if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) */ NICUpdateFifoStaCounters(pAd); /* Note : If (pAd->ate.bQATxStart == TRUE), we will never reach here. */ @@ -558,7 +558,7 @@ BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx) RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); } - //Always assign pNdisPacket as NULL after clear + /*Always assign pNdisPacket as NULL after clear */ pTxRing->Cell[pTxRing->TxSwFreeIdx].pNdisPacket = NULL; pPacket = @@ -572,7 +572,7 @@ BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx) RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); } - //Always assign pNextNdisPacket as NULL after clear + /*Always assign pNextNdisPacket as NULL after clear */ pTxRing->Cell[pTxRing->TxSwFreeIdx].pNextNdisPacket = NULL; } @@ -586,7 +586,7 @@ BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx) &pTxRing->TxDmaIdx); NdisMoveMemory(pOriTxD, pTxD, sizeof(TXD_STRUC)); -// RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); +/* RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); */ } return bReschedule; @@ -612,12 +612,12 @@ BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx) BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd, IN INT_SOURCE_CSR_STRUC TxRingBitmap) { -// UCHAR Count = 0; +/* UCHAR Count = 0; */ unsigned long IrqFlags; BOOLEAN bReschedule = FALSE; - // Make sure Tx ring resource won't be used by other threads - //NdisAcquireSpinLock(&pAd->TxRingLock); + /* Make sure Tx ring resource won't be used by other threads */ + /*NdisAcquireSpinLock(&pAd->TxRingLock); */ RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); @@ -633,11 +633,11 @@ BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd, if (TxRingBitmap.field.Ac1DmaDone) bReschedule |= RTMPFreeTXDUponTxDmaDone(pAd, QID_AC_BK); - // Make sure to release Tx ring resource - //NdisReleaseSpinLock(&pAd->TxRingLock); + /* Make sure to release Tx ring resource */ + /*NdisReleaseSpinLock(&pAd->TxRingLock); */ RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); - // Dequeue outgoing frames from TxSwQueue[] and process it + /* Dequeue outgoing frames from TxSwQueue[] and process it */ RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); return bReschedule; @@ -665,7 +665,7 @@ VOID RTMPHandleMgmtRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd) { PTXD_STRUC pTxD; PNDIS_PACKET pPacket; -// int i; +/* int i; */ UCHAR FREE = 0; PRTMP_MGMT_RING pMgmtRing = &pAd->MgmtRing; @@ -789,15 +789,15 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, RTMP_SEM_LOCK(&pAd->RxRingLock); if (*pRxPending == 0) { - // Get how may packets had been received + /* Get how may packets had been received */ RTMP_IO_READ32(pAd, RX_DRX_IDX, &pAd->RxRing.RxDmaIdx); if (pAd->RxRing.RxSwReadIdx == pAd->RxRing.RxDmaIdx) { - // no more rx packets + /* no more rx packets */ bReschedule = FALSE; goto done; } - // get rx pending count + /* get rx pending count */ if (pAd->RxRing.RxDmaIdx > pAd->RxRing.RxSwReadIdx) *pRxPending = pAd->RxRing.RxDmaIdx - pAd->RxRing.RxSwReadIdx; @@ -810,17 +810,17 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, pRxCell = &pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx]; - // Point to Rx indexed rx ring descriptor + /* Point to Rx indexed rx ring descriptor */ pRxD = (PRXD_STRUC) pRxCell->AllocVa; if (pRxD->DDONE == 0) { *pRxPending = 0; - // DMAIndx had done but DDONE bit not ready + /* DMAIndx had done but DDONE bit not ready */ bReschedule = TRUE; goto done; } - // return rx descriptor + /* return rx descriptor */ NdisMoveMemory(pSaveRxD, pRxD, RXD_SIZE); pNewPacket = @@ -828,7 +828,7 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, &AllocVa, &AllocPa); if (pNewPacket) { - // unmap the rx buffer + /* unmap the rx buffer */ PCI_UNMAP_SINGLE(pAd, pRxCell->DmaBuf.AllocPa, pRxCell->DmaBuf.AllocSize, PCI_DMA_FROMDEVICE); pRxPacket = pRxCell->pNdisPacket; @@ -840,17 +840,17 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, /* update SDP0 to new buffer of rx packet */ pRxD->SDP0 = AllocPa; } else { - //DBGPRINT(RT_DEBUG_TRACE,("No Rx Buffer\n")); + /*DBGPRINT(RT_DEBUG_TRACE,("No Rx Buffer\n")); */ pRxPacket = NULL; bReschedule = TRUE; } pRxD->DDONE = 0; - // had handled one rx packet + /* had handled one rx packet */ *pRxPending = *pRxPending - 1; - // update rx descriptor and kick rx + /* update rx descriptor and kick rx */ INC_RING_INDEX(pAd->RxRing.RxSwReadIdx, RX_RING_SIZE); pAd->RxRing.RxCpuIdx = @@ -874,28 +874,28 @@ NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, PHEADER_802_11 pHeader_802_11; BOOLEAN bAckRequired, bInsertTimestamp; ULONG SrcBufPA; - //UCHAR TxBufIdx; + /*UCHAR TxBufIdx; */ UCHAR MlmeRate; ULONG SwIdx = pAd->TxRing[QueIdx].TxCpuIdx; PTXWI_STRUC pFirstTxWI; - //ULONG i; - //HTTRANSMIT_SETTING MlmeTransmit; //Rate for this MGMT frame. + /*ULONG i; */ + /*HTTRANSMIT_SETTING MlmeTransmit; //Rate for this MGMT frame. */ ULONG FreeNum; MAC_TABLE_ENTRY *pMacEntry = NULL; RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); if (pSrcBufVA == NULL) { - // The buffer shouldn't be NULL + /* The buffer shouldn't be NULL */ return NDIS_STATUS_FAILURE; } - // Make sure MGMT ring resource won't be used by other threads - //NdisAcquireSpinLock(&pAd->TxRingLock); + /* Make sure MGMT ring resource won't be used by other threads */ + /*NdisAcquireSpinLock(&pAd->TxRingLock); */ FreeNum = GET_TXRING_FREENO(pAd, QueIdx); if (FreeNum == 0) { - //NdisReleaseSpinLock(&pAd->TxRingLock); + /*NdisReleaseSpinLock(&pAd->TxRingLock); */ return NDIS_STATUS_FAILURE; } @@ -905,13 +905,13 @@ NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, if (pAd->TxRing[QueIdx].Cell[SwIdx].pNdisPacket) { DBGPRINT(RT_DEBUG_OFF, ("MlmeHardTransmit Error\n")); - //NdisReleaseSpinLock(&pAd->TxRingLock); + /*NdisReleaseSpinLock(&pAd->TxRingLock); */ return NDIS_STATUS_FAILURE; } { - // outgoing frame always wakeup PHY to prevent frame lost - // if (pAd->StaCfg.Psm == PWR_SAVE) + /* outgoing frame always wakeup PHY to prevent frame lost */ + /* if (pAd->StaCfg.Psm == PWR_SAVE) */ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) AsicForceWakeup(pAd, TRUE); } @@ -928,18 +928,18 @@ NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, (pHeader_802_11->FC.SubType == SUBTYPE_QOS_NULL)) { pMacEntry = MacTableLookup(pAd, pHeader_802_11->Addr1); } - // Verify Mlme rate for a / g bands. - if ((pAd->LatchRfRegs.Channel > 14) && (MlmeRate < RATE_6)) // 11A band + /* Verify Mlme rate for a / g bands. */ + if ((pAd->LatchRfRegs.Channel > 14) && (MlmeRate < RATE_6)) /* 11A band */ MlmeRate = RATE_6; - // - // Should not be hard code to set PwrMgmt to 0 (PWR_ACTIVE) - // Snice it's been set to 0 while on MgtMacHeaderInit - // By the way this will cause frame to be send on PWR_SAVE failed. - // - // - // In WMM-UAPSD, mlme frame should be set psm as power saving but probe request frame - // Data-Null packets alse pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD + /* */ + /* Should not be hard code to set PwrMgmt to 0 (PWR_ACTIVE) */ + /* Snice it's been set to 0 while on MgtMacHeaderInit */ + /* By the way this will cause frame to be send on PWR_SAVE failed. */ + /* */ + /* */ + /* In WMM-UAPSD, mlme frame should be set psm as power saving but probe request frame */ + /* Data-Null packets alse pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD */ if (pHeader_802_11->FC.Type != BTYPE_DATA) { if ((pHeader_802_11->FC.SubType == SUBTYPE_PROBE_REQ) || !(pAd->CommonCfg.bAPSDCapable @@ -952,12 +952,12 @@ NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, } bInsertTimestamp = FALSE; - if (pHeader_802_11->FC.Type == BTYPE_CNTL) // must be PS-POLL + if (pHeader_802_11->FC.Type == BTYPE_CNTL) /* must be PS-POLL */ { bAckRequired = FALSE; - } else // BTYPE_MGMT or BTYPE_DATA(must be NULL frame) + } else /* BTYPE_MGMT or BTYPE_DATA(must be NULL frame) */ { - if (pHeader_802_11->Addr1[0] & 0x01) // MULTICAST, BROADCAST + if (pHeader_802_11->Addr1[0] & 0x01) /* MULTICAST, BROADCAST */ { bAckRequired = FALSE; pHeader_802_11->Duration = 0; @@ -973,29 +973,29 @@ NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, pHeader_802_11->Sequence = pAd->Sequence++; if (pAd->Sequence > 0xfff) pAd->Sequence = 0; - // Before radar detection done, mgmt frame can not be sent but probe req - // Because we need to use probe req to trigger driver to send probe req in passive scan + /* Before radar detection done, mgmt frame can not be sent but probe req */ + /* Because we need to use probe req to trigger driver to send probe req in passive scan */ if ((pHeader_802_11->FC.SubType != SUBTYPE_PROBE_REQ) && (pAd->CommonCfg.bIEEE80211H == 1) && (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE)) { DBGPRINT(RT_DEBUG_ERROR, ("MlmeHardTransmit --> radar detect not in normal mode !!!\n")); - //NdisReleaseSpinLock(&pAd->TxRingLock); + /*NdisReleaseSpinLock(&pAd->TxRingLock); */ return (NDIS_STATUS_FAILURE); } - // - // fill scatter-and-gather buffer list into TXD. Internally created NDIS PACKET - // should always has only one ohysical buffer, and the whole frame size equals - // to the first scatter buffer size - // - - // Initialize TX Descriptor - // For inter-frame gap, the number is for this frame and next frame - // For MLME rate, we will fix as 2Mb to match other vendor's implement -// pAd->CommonCfg.MlmeTransmit.field.MODE = 1; - -// management frame doesn't need encryption. so use RESERVED_WCID no matter u are sending to specific wcid or not. - // Only beacon use Nseq=TRUE. So here we use Nseq=FALSE. + /* */ + /* fill scatter-and-gather buffer list into TXD. Internally created NDIS PACKET */ + /* should always has only one ohysical buffer, and the whole frame size equals */ + /* to the first scatter buffer size */ + /* */ + + /* Initialize TX Descriptor */ + /* For inter-frame gap, the number is for this frame and next frame */ + /* For MLME rate, we will fix as 2Mb to match other vendor's implement */ +/* pAd->CommonCfg.MlmeTransmit.field.MODE = 1; */ + +/* management frame doesn't need encryption. so use RESERVED_WCID no matter u are sending to specific wcid or not. */ + /* Only beacon use Nseq=TRUE. So here we use Nseq=FALSE. */ if (pMacEntry == NULL) { RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, bInsertTimestamp, FALSE, bAckRequired, FALSE, 0, RESERVED_WCID, @@ -1013,7 +1013,7 @@ NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, pAd->TxRing[QueIdx].Cell[SwIdx].pNdisPacket = pPacket; pAd->TxRing[QueIdx].Cell[SwIdx].pNextNdisPacket = NULL; -// pFirstTxWI->MPDUtotalByteCount = SrcBufLen - TXWI_SIZE; +/* pFirstTxWI->MPDUtotalByteCount = SrcBufLen - TXWI_SIZE; */ SrcBufPA = PCI_MAP_SINGLE(pAd, pSrcBufVA, SrcBufLen, 0, PCI_DMA_TODEVICE); @@ -1028,14 +1028,14 @@ NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, pAd->RalinkCounters.KickTxCount++; pAd->RalinkCounters.OneSecTxDoneCount++; - // Increase TX_CTX_IDX, but write to register later. + /* Increase TX_CTX_IDX, but write to register later. */ INC_RING_INDEX(pAd->TxRing[QueIdx].TxCpuIdx, TX_RING_SIZE); RTMP_IO_WRITE32(pAd, TX_CTX_IDX0 + QueIdx * 0x10, pAd->TxRing[QueIdx].TxCpuIdx); - // Make sure to release MGMT ring resource -// NdisReleaseSpinLock(&pAd->TxRingLock); + /* Make sure to release MGMT ring resource */ +/* NdisReleaseSpinLock(&pAd->TxRingLock); */ return NDIS_STATUS_SUCCESS; } @@ -1082,15 +1082,15 @@ VOID RTMPWriteTxDescriptor(IN PRTMP_ADAPTER pAd, IN PTXD_STRUC pTxD, IN BOOLEAN bWIV, IN UCHAR QueueSEL) { - // - // Always use Long preamble before verifiation short preamble functionality works well. - // Todo: remove the following line if short preamble functionality works - // + /* */ + /* Always use Long preamble before verifiation short preamble functionality works well. */ + /* Todo: remove the following line if short preamble functionality works */ + /* */ OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); pTxD->WIV = (bWIV) ? 1 : 0; pTxD->QSEL = (QueueSEL); - //RT2860c?? fixed using EDCA queue for test... We doubt Queue1 has problem. 2006-09-26 Jan - //pTxD->QSEL= FIFO_EDCA; + /*RT2860c?? fixed using EDCA queue for test... We doubt Queue1 has problem. 2006-09-26 Jan */ + /*pTxD->QSEL= FIFO_EDCA; */ pTxD->DMADONE = 0; } diff --git a/drivers/staging/rt2860/common/cmm_data_usb.c b/drivers/staging/rt2860/common/cmm_data_usb.c index fbcb3a37214b..da79fc03d762 100644 --- a/drivers/staging/rt2860/common/cmm_data_usb.c +++ b/drivers/staging/rt2860/common/cmm_data_usb.c @@ -73,7 +73,7 @@ USHORT RtmpUSB_WriteSubTxResource(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIsLast, OUT USHORT * FreeNumber) { - // Dummy function. Should be removed in the future. + /* Dummy function. Should be removed in the future. */ return 0; } @@ -83,7 +83,7 @@ USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, IN UCHAR fragNum, OUT USHORT * FreeNumber) { HT_TX_CONTEXT *pHTTXContext; - USHORT hwHdrLen; // The hwHdrLen consist of 802.11 header length plus the header padding length. + USHORT hwHdrLen; /* The hwHdrLen consist of 802.11 header length plus the header padding length. */ UINT32 fillOffset; TXINFO_STRUC *pTxInfo; TXWI_STRUC *pTxWI; @@ -94,9 +94,9 @@ USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, UINT32 USBDMApktLen = 0, DMAHdrLen, padding; BOOLEAN TxQLastRound = FALSE; - // - // get Tx Ring Resource & Dma Buffer address - // + /* */ + /* get Tx Ring Resource & Dma Buffer address */ + /* */ QueIdx = pTxBlk->QueIdx; pHTTXContext = &pAd->TxContext[QueIdx]; @@ -106,12 +106,12 @@ USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, fillOffset = pHTTXContext->CurWritePosition; if (fragNum == 0) { - // Check if we have enough space for this bulk-out batch. + /* Check if we have enough space for this bulk-out batch. */ Status = RtmpUSBCanDoWrite(pAd, QueIdx, pHTTXContext); if (Status == NDIS_STATUS_SUCCESS) { pHTTXContext->bCurWriting = TRUE; - // Reserve space for 8 bytes padding. + /* Reserve space for 8 bytes padding. */ if ((pHTTXContext->ENextBulkOutPosition == pHTTXContext->CurWritePosition)) { pHTTXContext->ENextBulkOutPosition += 8; @@ -130,7 +130,7 @@ USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, return (Status); } } else { - // For sub-sequent frames of this bulk-out batch. Just copy it to our bulk-out buffer. + /* For sub-sequent frames of this bulk-out batch. Just copy it to our bulk-out buffer. */ Status = ((pHTTXContext->bCurWriting == TRUE) ? NDIS_STATUS_SUCCESS : NDIS_STATUS_FAILURE); @@ -153,19 +153,19 @@ USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, pWirelessPacket = &pHTTXContext->TransferBuffer->field.WirelessPacket[fillOffset]; - // copy TXWI + WLAN Header + LLC into DMA Header Buffer - //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); + /* copy TXWI + WLAN Header + LLC into DMA Header Buffer */ + /*hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); */ hwHdrLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; - // Build our URB for USBD + /* Build our URB for USBD */ DMAHdrLen = TXWI_SIZE + hwHdrLen; USBDMApktLen = DMAHdrLen + pTxBlk->SrcBufLen; - padding = (4 - (USBDMApktLen % 4)) & 0x03; // round up to 4 byte alignment + padding = (4 - (USBDMApktLen % 4)) & 0x03; /* round up to 4 byte alignment */ USBDMApktLen += padding; pTxBlk->Priv += (TXINFO_SIZE + USBDMApktLen); - // For TxInfo, the length of USBDMApktLen = TXWI_SIZE + 802.11 header + payload + /* For TxInfo, the length of USBDMApktLen = TXWI_SIZE + 802.11 header + payload */ RTMPWriteTxInfo(pAd, pTxInfo, (USHORT) (USBDMApktLen), FALSE, FIFO_EDCA, FALSE /*NextValid */ , FALSE); @@ -189,25 +189,25 @@ USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, NdisMoveMemory(pWirelessPacket, pTxBlk->pSrcBufData, pTxBlk->SrcBufLen); - // Zero the last padding. + /* Zero the last padding. */ pWirelessPacket += pTxBlk->SrcBufLen; NdisZeroMemory(pWirelessPacket, padding + 8); if (fragNum == pTxBlk->TotalFragNum) { RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); - // Update the pHTTXContext->CurWritePosition. 3906 used to prevent the NextBulkOut is a A-RALINK/A-MSDU Frame. + /* Update the pHTTXContext->CurWritePosition. 3906 used to prevent the NextBulkOut is a A-RALINK/A-MSDU Frame. */ pHTTXContext->CurWritePosition += pTxBlk->Priv; if (TxQLastRound == TRUE) pHTTXContext->CurWritePosition = 8; pHTTXContext->CurWriteRealPos = pHTTXContext->CurWritePosition; - // Finally, set bCurWriting as FALSE + /* Finally, set bCurWriting as FALSE */ pHTTXContext->bCurWriting = FALSE; RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); - // succeed and release the skb buffer + /* succeed and release the skb buffer */ RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_SUCCESS); } @@ -232,19 +232,19 @@ USHORT RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, UINT32 USBDMApktLen = 0, DMAHdrLen, padding; BOOLEAN bTxQLastRound = FALSE; - // For USB, didn't need PCI_MAP_SINGLE() - //SrcBufPA = PCI_MAP_SINGLE(pAd, (char *) pTxBlk->pSrcBufData, pTxBlk->SrcBufLen, PCI_DMA_TODEVICE); + /* For USB, didn't need PCI_MAP_SINGLE() */ + /*SrcBufPA = PCI_MAP_SINGLE(pAd, (char *) pTxBlk->pSrcBufData, pTxBlk->SrcBufLen, PCI_DMA_TODEVICE); */ - // - // get Tx Ring Resource & Dma Buffer address - // + /* */ + /* get Tx Ring Resource & Dma Buffer address */ + /* */ QueIdx = pTxBlk->QueIdx; RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); pHTTXContext = &pAd->TxContext[QueIdx]; fillOffset = pHTTXContext->CurWritePosition; - // Check ring full. + /* Check ring full. */ Status = RtmpUSBCanDoWrite(pAd, QueIdx, pHTTXContext); if (Status == NDIS_STATUS_SUCCESS) { pHTTXContext->bCurWriting = TRUE; @@ -252,7 +252,7 @@ USHORT RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, pTxInfo = (PTXINFO_STRUC) (&pTxBlk->HeaderBuf[0]); pTxWI = (PTXWI_STRUC) (&pTxBlk->HeaderBuf[TXINFO_SIZE]); - // Reserve space for 8 bytes padding. + /* Reserve space for 8 bytes padding. */ if ((pHTTXContext->ENextBulkOutPosition == pHTTXContext->CurWritePosition)) { pHTTXContext->ENextBulkOutPosition += 8; @@ -265,19 +265,19 @@ USHORT RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, &pHTTXContext->TransferBuffer->field. WirelessPacket[fillOffset]; - // copy TXWI + WLAN Header + LLC into DMA Header Buffer - //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); + /* copy TXWI + WLAN Header + LLC into DMA Header Buffer */ + /*hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); */ hwHdrLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; - // Build our URB for USBD + /* Build our URB for USBD */ DMAHdrLen = TXWI_SIZE + hwHdrLen; USBDMApktLen = DMAHdrLen + pTxBlk->SrcBufLen; - padding = (4 - (USBDMApktLen % 4)) & 0x03; // round up to 4 byte alignment + padding = (4 - (USBDMApktLen % 4)) & 0x03; /* round up to 4 byte alignment */ USBDMApktLen += padding; pTxBlk->Priv = (TXINFO_SIZE + USBDMApktLen); - // For TxInfo, the length of USBDMApktLen = TXWI_SIZE + 802.11 header + payload + /* For TxInfo, the length of USBDMApktLen = TXWI_SIZE + 802.11 header + payload */ RTMPWriteTxInfo(pAd, pTxInfo, (USHORT) (USBDMApktLen), FALSE, FIFO_EDCA, FALSE /*NextValid */ , FALSE); @@ -290,16 +290,16 @@ USHORT RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, TXINFO_SIZE + TXWI_SIZE + hwHdrLen); pWirelessPacket += (TXINFO_SIZE + TXWI_SIZE + hwHdrLen); - // We unlock it here to prevent the first 8 bytes maybe over-writed issue. - // 1. First we got CurWritePosition but the first 8 bytes still not write to the pTxcontext. - // 2. An interrupt break our routine and handle bulk-out complete. - // 3. In the bulk-out compllete, it need to do another bulk-out, - // if the ENextBulkOutPosition is just the same as CurWritePosition, it will save the first 8 bytes from CurWritePosition, - // but the payload still not copyed. the pTxContext->SavedPad[] will save as allzero. and set the bCopyPad = TRUE. - // 4. Interrupt complete. - // 5. Our interrupted routine go back and fill the first 8 bytes to pTxContext. - // 6. Next time when do bulk-out, it found the bCopyPad==TRUE and will copy the SavedPad[] to pTxContext->NextBulkOutPosition. - // and the packet will wrong. + /* We unlock it here to prevent the first 8 bytes maybe over-writed issue. */ + /* 1. First we got CurWritePosition but the first 8 bytes still not write to the pTxcontext. */ + /* 2. An interrupt break our routine and handle bulk-out complete. */ + /* 3. In the bulk-out compllete, it need to do another bulk-out, */ + /* if the ENextBulkOutPosition is just the same as CurWritePosition, it will save the first 8 bytes from CurWritePosition, */ + /* but the payload still not copyed. the pTxContext->SavedPad[] will save as allzero. and set the bCopyPad = TRUE. */ + /* 4. Interrupt complete. */ + /* 5. Our interrupted routine go back and fill the first 8 bytes to pTxContext. */ + /* 6. Next time when do bulk-out, it found the bCopyPad==TRUE and will copy the SavedPad[] to pTxContext->NextBulkOutPosition. */ + /* and the packet will wrong. */ pHTTXContext->CurWriteRealPos += (TXINFO_SIZE + TXWI_SIZE + hwHdrLen); RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); @@ -321,7 +321,7 @@ USHORT RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); - // succeed and release the skb buffer + /* succeed and release the skb buffer */ RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_SUCCESS); return (Status); @@ -333,7 +333,7 @@ USHORT RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, IN UCHAR frameNum, OUT USHORT * FreeNumber) { HT_TX_CONTEXT *pHTTXContext; - USHORT hwHdrLen; // The hwHdrLen consist of 802.11 header length plus the header padding length. + USHORT hwHdrLen; /* The hwHdrLen consist of 802.11 header length plus the header padding length. */ UINT32 fillOffset; TXINFO_STRUC *pTxInfo; TXWI_STRUC *pTxWI; @@ -341,18 +341,18 @@ USHORT RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, UCHAR QueIdx; NDIS_STATUS Status; unsigned long IrqFlags; - //UINT32 USBDMApktLen = 0, DMAHdrLen, padding; + /*UINT32 USBDMApktLen = 0, DMAHdrLen, padding; */ - // - // get Tx Ring Resource & Dma Buffer address - // + /* */ + /* get Tx Ring Resource & Dma Buffer address */ + /* */ QueIdx = pTxBlk->QueIdx; pHTTXContext = &pAd->TxContext[QueIdx]; RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); if (frameNum == 0) { - // Check if we have enough space for this bulk-out batch. + /* Check if we have enough space for this bulk-out batch. */ Status = RtmpUSBCanDoWrite(pAd, QueIdx, pHTTXContext); if (Status == NDIS_STATUS_SUCCESS) { pHTTXContext->bCurWriting = TRUE; @@ -360,7 +360,7 @@ USHORT RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, pTxInfo = (PTXINFO_STRUC) (&pTxBlk->HeaderBuf[0]); pTxWI = (PTXWI_STRUC) (&pTxBlk->HeaderBuf[TXINFO_SIZE]); - // Reserve space for 8 bytes padding. + /* Reserve space for 8 bytes padding. */ if ((pHTTXContext->ENextBulkOutPosition == pHTTXContext->CurWritePosition)) { @@ -375,43 +375,43 @@ USHORT RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, &pHTTXContext->TransferBuffer->field. WirelessPacket[fillOffset]; - // - // Copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer - // + /* */ + /* Copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer */ + /* */ if (pTxBlk->TxFrameType == TX_AMSDU_FRAME) - //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD; + /*hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD; */ hwHdrLen = pTxBlk->MpduHeaderLen - LENGTH_AMSDU_SUBFRAMEHEAD + pTxBlk->HdrPadLen + LENGTH_AMSDU_SUBFRAMEHEAD; else if (pTxBlk->TxFrameType == TX_RALINK_FRAME) - //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_ARALINK_HEADER_FIELD, 4)+LENGTH_ARALINK_HEADER_FIELD; + /*hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_ARALINK_HEADER_FIELD, 4)+LENGTH_ARALINK_HEADER_FIELD; */ hwHdrLen = pTxBlk->MpduHeaderLen - LENGTH_ARALINK_HEADER_FIELD + pTxBlk->HdrPadLen + LENGTH_ARALINK_HEADER_FIELD; else - //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); + /*hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); */ hwHdrLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; - // Update the pTxBlk->Priv. + /* Update the pTxBlk->Priv. */ pTxBlk->Priv = TXINFO_SIZE + TXWI_SIZE + hwHdrLen; - // pTxInfo->USBDMApktLen now just a temp value and will to correct latter. + /* pTxInfo->USBDMApktLen now just a temp value and will to correct latter. */ RTMPWriteTxInfo(pAd, pTxInfo, (USHORT) (pTxBlk->Priv), FALSE, FIFO_EDCA, FALSE /*NextValid */ , FALSE); - // Copy it. + /* Copy it. */ NdisMoveMemory(pWirelessPacket, pTxBlk->HeaderBuf, pTxBlk->Priv); pHTTXContext->CurWriteRealPos += pTxBlk->Priv; pWirelessPacket += pTxBlk->Priv; } - } else { // For sub-sequent frames of this bulk-out batch. Just copy it to our bulk-out buffer. + } else { /* For sub-sequent frames of this bulk-out batch. Just copy it to our bulk-out buffer. */ Status = ((pHTTXContext->bCurWriting == @@ -423,28 +423,28 @@ USHORT RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, &pHTTXContext->TransferBuffer->field. WirelessPacket[fillOffset]; - //hwHdrLen = pTxBlk->MpduHeaderLen; + /*hwHdrLen = pTxBlk->MpduHeaderLen; */ NdisMoveMemory(pWirelessPacket, pTxBlk->HeaderBuf, pTxBlk->MpduHeaderLen); pWirelessPacket += (pTxBlk->MpduHeaderLen); pTxBlk->Priv += pTxBlk->MpduHeaderLen; - } else { // It should not happened now unless we are going to shutdown. + } else { /* It should not happened now unless we are going to shutdown. */ DBGPRINT(RT_DEBUG_ERROR, ("WriteMultiTxResource():bCurWriting is FALSE when handle sub-sequent frames.\n")); Status = NDIS_STATUS_FAILURE; } } - // We unlock it here to prevent the first 8 bytes maybe over-write issue. - // 1. First we got CurWritePosition but the first 8 bytes still not write to the pTxContext. - // 2. An interrupt break our routine and handle bulk-out complete. - // 3. In the bulk-out compllete, it need to do another bulk-out, - // if the ENextBulkOutPosition is just the same as CurWritePosition, it will save the first 8 bytes from CurWritePosition, - // but the payload still not copyed. the pTxContext->SavedPad[] will save as allzero. and set the bCopyPad = TRUE. - // 4. Interrupt complete. - // 5. Our interrupted routine go back and fill the first 8 bytes to pTxContext. - // 6. Next time when do bulk-out, it found the bCopyPad==TRUE and will copy the SavedPad[] to pTxContext->NextBulkOutPosition. - // and the packet will wrong. + /* We unlock it here to prevent the first 8 bytes maybe over-write issue. */ + /* 1. First we got CurWritePosition but the first 8 bytes still not write to the pTxContext. */ + /* 2. An interrupt break our routine and handle bulk-out complete. */ + /* 3. In the bulk-out compllete, it need to do another bulk-out, */ + /* if the ENextBulkOutPosition is just the same as CurWritePosition, it will save the first 8 bytes from CurWritePosition, */ + /* but the payload still not copyed. the pTxContext->SavedPad[] will save as allzero. and set the bCopyPad = TRUE. */ + /* 4. Interrupt complete. */ + /* 5. Our interrupted routine go back and fill the first 8 bytes to pTxContext. */ + /* 6. Next time when do bulk-out, it found the bCopyPad==TRUE and will copy the SavedPad[] to pTxContext->NextBulkOutPosition. */ + /* and the packet will wrong. */ RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags); if (Status != NDIS_STATUS_SUCCESS) { @@ -454,13 +454,13 @@ USHORT RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, pHTTXContext->NextBulkOutPosition)); goto done; } - // Copy the frame content into DMA buffer and update the pTxBlk->Priv + /* Copy the frame content into DMA buffer and update the pTxBlk->Priv */ NdisMoveMemory(pWirelessPacket, pTxBlk->pSrcBufData, pTxBlk->SrcBufLen); pWirelessPacket += pTxBlk->SrcBufLen; pTxBlk->Priv += pTxBlk->SrcBufLen; done: - // Release the skb buffer here + /* Release the skb buffer here */ RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket, NDIS_STATUS_SUCCESS); return (Status); @@ -498,47 +498,47 @@ VOID RtmpUSB_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, (PUCHAR) (&pHTTXContext->TransferBuffer->field. WirelessPacket[fillOffset]); - // - // Update TxInfo->USBDMApktLen , - // the length = TXWI_SIZE + 802.11_hdr + 802.11_hdr_pad + payload_of_all_batch_frames + Bulk-Out-padding - // + /* */ + /* Update TxInfo->USBDMApktLen , */ + /* the length = TXWI_SIZE + 802.11_hdr + 802.11_hdr_pad + payload_of_all_batch_frames + Bulk-Out-padding */ + /* */ pTxInfo = (PTXINFO_STRUC) (pWirelessPacket); - // Calculate the bulk-out padding + /* Calculate the bulk-out padding */ USBDMApktLen = pTxBlk->Priv - TXINFO_SIZE; - padding = (4 - (USBDMApktLen % 4)) & 0x03; // round up to 4 byte alignment + padding = (4 - (USBDMApktLen % 4)) & 0x03; /* round up to 4 byte alignment */ USBDMApktLen += padding; pTxInfo->USBDMATxPktLen = USBDMApktLen; - // - // Update TXWI->MPDUtotalByteCount , - // the length = 802.11 header + payload_of_all_batch_frames + /* */ + /* Update TXWI->MPDUtotalByteCount , */ + /* the length = 802.11 header + payload_of_all_batch_frames */ pTxWI = (PTXWI_STRUC) (pWirelessPacket + TXINFO_SIZE); pTxWI->MPDUtotalByteCount = totalMPDUSize; - // - // Update the pHTTXContext->CurWritePosition - // + /* */ + /* Update the pHTTXContext->CurWritePosition */ + /* */ pHTTXContext->CurWritePosition += (TXINFO_SIZE + USBDMApktLen); - if ((pHTTXContext->CurWritePosition + 3906) > MAX_TXBULK_LIMIT) { // Add 3906 for prevent the NextBulkOut packet size is a A-RALINK/A-MSDU Frame. + if ((pHTTXContext->CurWritePosition + 3906) > MAX_TXBULK_LIMIT) { /* Add 3906 for prevent the NextBulkOut packet size is a A-RALINK/A-MSDU Frame. */ pHTTXContext->CurWritePosition = 8; pTxInfo->SwUseLastRound = 1; } pHTTXContext->CurWriteRealPos = pHTTXContext->CurWritePosition; - // - // Zero the last padding. - // + /* */ + /* Zero the last padding. */ + /* */ pWirelessPacket = (&pHTTXContext->TransferBuffer->field. WirelessPacket[fillOffset + pTxBlk->Priv]); NdisZeroMemory(pWirelessPacket, padding + 8); - // Finally, set bCurWriting as FALSE + /* Finally, set bCurWriting as FALSE */ pHTTXContext->bCurWriting = FALSE; - } else { // It should not happened now unless we are going to shutdown. + } else { /* It should not happened now unless we are going to shutdown. */ DBGPRINT(RT_DEBUG_ERROR, ("FinalWriteTxResource():bCurWriting is FALSE when handle last frames.\n")); } @@ -550,7 +550,7 @@ VOID RtmpUSB_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, VOID RtmpUSBDataLastTxIdx(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx, IN USHORT TxIdx) { - // DO nothing for USB. + /* DO nothing for USB. */ } /* @@ -589,22 +589,22 @@ int RtmpUSBMgmtKickOut(IN RTMP_ADAPTER * pAd, pTxInfo = (PTXINFO_STRUC) (pSrcBufVA); - // Build our URB for USBD + /* Build our URB for USBD */ BulkOutSize = SrcBufLen; BulkOutSize = (BulkOutSize + 3) & (~3); RTMPWriteTxInfo(pAd, pTxInfo, (USHORT) (BulkOutSize - TXINFO_SIZE), TRUE, EpToQueue[MGMTPIPEIDX], FALSE, FALSE); - BulkOutSize += 4; // Always add 4 extra bytes at every packet. + BulkOutSize += 4; /* Always add 4 extra bytes at every packet. */ - // If BulkOutSize is multiple of BulkOutMaxPacketSize, add extra 4 bytes again. + /* If BulkOutSize is multiple of BulkOutMaxPacketSize, add extra 4 bytes again. */ if ((BulkOutSize % pAd->BulkOutMaxPacketSize) == 0) BulkOutSize += 4; padLen = BulkOutSize - SrcBufLen; ASSERT((padLen <= RTMP_PKT_TAIL_PADDING)); - // Now memzero all extra padding bytes. + /* Now memzero all extra padding bytes. */ pDest = (PUCHAR) (pSrcBufVA + SrcBufLen); skb_put(GET_OS_PKT_TYPE(pPacket), padLen); NdisZeroMemory(pDest, padLen); @@ -615,28 +615,28 @@ int RtmpUSBMgmtKickOut(IN RTMP_ADAPTER * pAd, pMLMEContext->TransferBuffer = (PTX_BUFFER) (GET_OS_PKT_DATAPTR(pPacket)); - // Length in TxInfo should be 8 less than bulkout size. + /* Length in TxInfo should be 8 less than bulkout size. */ pMLMEContext->BulkOutSize = BulkOutSize; pMLMEContext->InUse = TRUE; pMLMEContext->bWaitingBulkOut = TRUE; - //for debug - //hex_dump("RtmpUSBMgmtKickOut", &pMLMEContext->TransferBuffer->field.WirelessPacket[0], (pMLMEContext->BulkOutSize > 16 ? 16 : pMLMEContext->BulkOutSize)); + /*for debug */ + /*hex_dump("RtmpUSBMgmtKickOut", &pMLMEContext->TransferBuffer->field.WirelessPacket[0], (pMLMEContext->BulkOutSize > 16 ? 16 : pMLMEContext->BulkOutSize)); */ - //pAd->RalinkCounters.KickTxCount++; - //pAd->RalinkCounters.OneSecTxDoneCount++; + /*pAd->RalinkCounters.KickTxCount++; */ + /*pAd->RalinkCounters.OneSecTxDoneCount++; */ - //if (pAd->MgmtRing.TxSwFreeIdx == MGMT_RING_SIZE) - // needKickOut = TRUE; + /*if (pAd->MgmtRing.TxSwFreeIdx == MGMT_RING_SIZE) */ + /* needKickOut = TRUE; */ - // Decrease the TxSwFreeIdx and Increase the TX_CTX_IDX + /* Decrease the TxSwFreeIdx and Increase the TX_CTX_IDX */ pAd->MgmtRing.TxSwFreeIdx--; INC_RING_INDEX(pAd->MgmtRing.TxCpuIdx, MGMT_RING_SIZE); RTMP_IRQ_UNLOCK(&pAd->MLMEBulkOutLock, IrqFlags); RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_MLME); - //if (needKickOut) + /*if (needKickOut) */ RTUSBKickBulkOut(pAd); return 0; @@ -654,7 +654,7 @@ VOID RtmpUSBNullFrameKickOut(IN RTMP_ADAPTER * pAd, pNullContext = &(pAd->NullContext); - // Set the in use bit + /* Set the in use bit */ pNullContext->InUse = TRUE; pWirelessPkt = (PUCHAR) & pNullContext->TransferBuffer->field. @@ -677,14 +677,14 @@ VOID RtmpUSBNullFrameKickOut(IN RTMP_ADAPTER * pAd, pAd->NullContext.BulkOutSize = TXINFO_SIZE + TXWI_SIZE + sizeof(pAd->NullFrame) + 4; - // Fill out frame length information for global Bulk out arbitor - //pNullContext->BulkOutSize = TransferBufferLength; + /* Fill out frame length information for global Bulk out arbitor */ + /*pNullContext->BulkOutSize = TransferBufferLength; */ DBGPRINT(RT_DEBUG_TRACE, ("SYNC - send NULL Frame @%d Mbps...\n", RateIdToMbps[pAd->CommonCfg.TxRate])); RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NULL); - // Kick bulk out + /* Kick bulk out */ RTUSBKickBulkOut(pAd); } @@ -731,7 +731,7 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, } pData = &pRxContext->TransferBuffer[pAd->ReadPosition]; /* 4KB */ - // The RXDMA field is 4 bytes, now just use the first 2 bytes. The Length including the (RXWI + MSDU + Padding) + /* The RXDMA field is 4 bytes, now just use the first 2 bytes. The Length including the (RXWI + MSDU + Padding) */ ThisFrameLen = *pData + (*(pData + 1) << 8); if (ThisFrameLen == 0) { DBGPRINT(RT_DEBUG_TRACE, @@ -748,7 +748,7 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, goto label_null; } - if ((ThisFrameLen + 8) > RxBufferLength) // 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC)) + if ((ThisFrameLen + 8) > RxBufferLength) /* 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC)) */ { DBGPRINT(RT_DEBUG_TRACE, ("BIRIdx(%d):FrameLen(0x%lx) outranges. BulkInLen=0x%lx, remaining RxBufLen=0x%lx, ReadPos=0x%lx\n", @@ -756,10 +756,10 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, pRxContext->BulkInOffset, RxBufferLength, pAd->ReadPosition)); - // error frame. finish this loop + /* error frame. finish this loop */ goto label_null; } - // skip USB frame length field + /* skip USB frame length field */ pData += RT2870_RXDMALEN_FIELD_SIZE; pRxWI = (PRXWI_STRUC) pData; if (pRxWI->MPDUtotalByteCount > ThisFrameLen) { @@ -769,7 +769,7 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, ThisFrameLen)); goto label_null; } - // allocate a rx packet + /* allocate a rx packet */ pSkb = dev_alloc_skb(ThisFrameLen); if (pSkb == NULL) { DBGPRINT(RT_DEBUG_ERROR, @@ -777,16 +777,16 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, __FUNCTION__)); goto label_null; } - // copy the rx packet + /* copy the rx packet */ memcpy(skb_put(pSkb, ThisFrameLen), pData, ThisFrameLen); RTPKT_TO_OSPKT(pSkb)->dev = get_netdev_from_bssid(pAd, BSS0); RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pSkb), PKTSRC_NDIS); - // copy RxD + /* copy RxD */ *pSaveRxD = *(PRXINFO_STRUC) (pData + ThisFrameLen); - // update next packet read position. - pAd->ReadPosition += (ThisFrameLen + RT2870_RXDMALEN_FIELD_SIZE + RXINFO_SIZE); // 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC)) + /* update next packet read position. */ + pAd->ReadPosition += (ThisFrameLen + RT2870_RXDMALEN_FIELD_SIZE + RXINFO_SIZE); /* 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC)) */ return pSkb; @@ -824,9 +824,9 @@ NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd, if (pRxINFO == NULL) return (NDIS_STATUS_FAILURE); - // Phy errors & CRC errors + /* Phy errors & CRC errors */ if (pRxINFO->Crc) { - // Check RSSI for Noise Hist statistic collection. + /* Check RSSI for Noise Hist statistic collection. */ dBm = (INT) (pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta; if (dBm <= -87) pAd->StaCfg.RPIDensity[0] += 1; @@ -847,25 +847,25 @@ NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd, return (NDIS_STATUS_FAILURE); } - // Add Rx size to channel load counter, we should ignore error counts + /* Add Rx size to channel load counter, we should ignore error counts */ pAd->StaCfg.CLBusyBytes += (pRxWI->MPDUtotalByteCount + 14); - // Drop ToDs promiscous frame, it is opened due to CCX 2 channel load statistics + /* Drop ToDs promiscous frame, it is opened due to CCX 2 channel load statistics */ if (pHeader->FC.ToDs) { DBGPRINT_RAW(RT_DEBUG_ERROR, ("Err;FC.ToDs\n")); return NDIS_STATUS_FAILURE; } - // Paul 04-03 for OFDM Rx length issue + /* Paul 04-03 for OFDM Rx length issue */ if (pRxWI->MPDUtotalByteCount > MAX_AGGREGATION_SIZE) { DBGPRINT_RAW(RT_DEBUG_ERROR, ("received packet too long\n")); return NDIS_STATUS_FAILURE; } - // Drop not U2M frames, cant's drop here because we will drop beacon in this case - // I am kind of doubting the U2M bit operation - // if (pRxD->U2M == 0) - // return(NDIS_STATUS_FAILURE); + /* Drop not U2M frames, cant's drop here because we will drop beacon in this case */ + /* I am kind of doubting the U2M bit operation */ + /* if (pRxD->U2M == 0) */ + /* return(NDIS_STATUS_FAILURE); */ - // drop decyption fail frame + /* drop decyption fail frame */ if (pRxINFO->Decrypted && pRxINFO->CipherErr) { if (((pRxINFO->CipherErr & 1) == 1) @@ -879,9 +879,9 @@ NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd, RTMPSendWirelessEvent(pAd, IW_MIC_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID]. Addr, BSS0, 0); - // - // MIC Error - // + /* */ + /* MIC Error */ + /* */ if ((pRxINFO->CipherErr == 2) && pRxINFO->MyBss) { pWpaKey = &pAd->SharedKey[BSS0][pRxWI->KeyIndex]; RTMPReportMicError(pAd, pWpaKey); @@ -892,9 +892,9 @@ NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd, (pAd->SharedKey[BSS0][pRxWI->KeyIndex].CipherAlg == CIPHER_AES) && (pHeader->Sequence == pAd->FragFrame.Sequence)) { - // - // Acceptable since the First FragFrame no CipherErr problem. - // + /* */ + /* Acceptable since the First FragFrame no CipherErr problem. */ + /* */ return (NDIS_STATUS_SUCCESS); } @@ -935,17 +935,17 @@ VOID RT28xxUsbStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, IN USHORT TbttNumToNextWakeUp) { - // we have decided to SLEEP, so at least do it for a BEACON period. + /* we have decided to SLEEP, so at least do it for a BEACON period. */ if (TbttNumToNextWakeUp == 0) TbttNumToNextWakeUp = 1; RTMPSetTimer(&pAd->Mlme.AutoWakeupTimer, AUTO_WAKEUP_TIMEOUT); pAd->Mlme.AutoWakeupTimerRunning = TRUE; - AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02); // send POWER-SAVE command to MCU. Timeout 40us. + AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02); /* send POWER-SAVE command to MCU. Timeout 40us. */ OPSTATUS_SET_FLAG(pAd, fOP_STATUS_DOZE); } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ diff --git a/drivers/staging/rt2860/common/cmm_info.c b/drivers/staging/rt2860/common/cmm_info.c index be01b07c543e..610eb75dd157 100644 --- a/drivers/staging/rt2860/common/cmm_info.c +++ b/drivers/staging/rt2860/common/cmm_info.c @@ -53,144 +53,144 @@ VOID RTMPSetDesiredRates(IN PRTMP_ADAPTER pAdapter, IN LONG Rates) memset(&aryRates, 0x00, sizeof(NDIS_802_11_RATES)); switch (pAdapter->CommonCfg.PhyMode) { - case PHY_11A: // A only + case PHY_11A: /* A only */ switch (Rates) { - case 6000000: //6M - aryRates[0] = 0x0c; // 6M + case 6000000: /*6M */ + aryRates[0] = 0x0c; /* 6M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0; break; - case 9000000: //9M - aryRates[0] = 0x12; // 9M + case 9000000: /*9M */ + aryRates[0] = 0x12; /* 9M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1; break; - case 12000000: //12M - aryRates[0] = 0x18; // 12M + case 12000000: /*12M */ + aryRates[0] = 0x18; /* 12M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2; break; - case 18000000: //18M - aryRates[0] = 0x24; // 18M + case 18000000: /*18M */ + aryRates[0] = 0x24; /* 18M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3; break; - case 24000000: //24M - aryRates[0] = 0x30; // 24M + case 24000000: /*24M */ + aryRates[0] = 0x30; /* 24M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4; break; - case 36000000: //36M - aryRates[0] = 0x48; // 36M + case 36000000: /*36M */ + aryRates[0] = 0x48; /* 36M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5; break; - case 48000000: //48M - aryRates[0] = 0x60; // 48M + case 48000000: /*48M */ + aryRates[0] = 0x60; /* 48M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6; break; - case 54000000: //54M - aryRates[0] = 0x6c; // 54M + case 54000000: /*54M */ + aryRates[0] = 0x6c; /* 54M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7; break; - case -1: //Auto + case -1: /*Auto */ default: - aryRates[0] = 0x6c; // 54Mbps - aryRates[1] = 0x60; // 48Mbps - aryRates[2] = 0x48; // 36Mbps - aryRates[3] = 0x30; // 24Mbps - aryRates[4] = 0x24; // 18M - aryRates[5] = 0x18; // 12M - aryRates[6] = 0x12; // 9M - aryRates[7] = 0x0c; // 6M + aryRates[0] = 0x6c; /* 54Mbps */ + aryRates[1] = 0x60; /* 48Mbps */ + aryRates[2] = 0x48; /* 36Mbps */ + aryRates[3] = 0x30; /* 24Mbps */ + aryRates[4] = 0x24; /* 18M */ + aryRates[5] = 0x18; /* 12M */ + aryRates[6] = 0x12; /* 9M */ + aryRates[7] = 0x0c; /* 6M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; break; } break; - case PHY_11BG_MIXED: // B/G Mixed - case PHY_11B: // B only - case PHY_11ABG_MIXED: // A/B/G Mixed + case PHY_11BG_MIXED: /* B/G Mixed */ + case PHY_11B: /* B only */ + case PHY_11ABG_MIXED: /* A/B/G Mixed */ default: switch (Rates) { - case 1000000: //1M + case 1000000: /*1M */ aryRates[0] = 0x02; pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0; break; - case 2000000: //2M + case 2000000: /*2M */ aryRates[0] = 0x04; pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1; break; - case 5000000: //5.5M - aryRates[0] = 0x0b; // 5.5M + case 5000000: /*5.5M */ + aryRates[0] = 0x0b; /* 5.5M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2; break; - case 11000000: //11M - aryRates[0] = 0x16; // 11M + case 11000000: /*11M */ + aryRates[0] = 0x16; /* 11M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3; break; - case 6000000: //6M - aryRates[0] = 0x0c; // 6M + case 6000000: /*6M */ + aryRates[0] = 0x0c; /* 6M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0; break; - case 9000000: //9M - aryRates[0] = 0x12; // 9M + case 9000000: /*9M */ + aryRates[0] = 0x12; /* 9M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1; break; - case 12000000: //12M - aryRates[0] = 0x18; // 12M + case 12000000: /*12M */ + aryRates[0] = 0x18; /* 12M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2; break; - case 18000000: //18M - aryRates[0] = 0x24; // 18M + case 18000000: /*18M */ + aryRates[0] = 0x24; /* 18M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3; break; - case 24000000: //24M - aryRates[0] = 0x30; // 24M + case 24000000: /*24M */ + aryRates[0] = 0x30; /* 24M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4; break; - case 36000000: //36M - aryRates[0] = 0x48; // 36M + case 36000000: /*36M */ + aryRates[0] = 0x48; /* 36M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5; break; - case 48000000: //48M - aryRates[0] = 0x60; // 48M + case 48000000: /*48M */ + aryRates[0] = 0x60; /* 48M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6; break; - case 54000000: //54M - aryRates[0] = 0x6c; // 54M + case 54000000: /*54M */ + aryRates[0] = 0x6c; /* 54M */ pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7; break; - case -1: //Auto + case -1: /*Auto */ default: - if (pAdapter->CommonCfg.PhyMode == PHY_11B) { //B Only - aryRates[0] = 0x16; // 11Mbps - aryRates[1] = 0x0b; // 5.5Mbps - aryRates[2] = 0x04; // 2Mbps - aryRates[3] = 0x02; // 1Mbps - } else { //(B/G) Mixed or (A/B/G) Mixed - aryRates[0] = 0x6c; // 54Mbps - aryRates[1] = 0x60; // 48Mbps - aryRates[2] = 0x48; // 36Mbps - aryRates[3] = 0x30; // 24Mbps - aryRates[4] = 0x16; // 11Mbps - aryRates[5] = 0x0b; // 5.5Mbps - aryRates[6] = 0x04; // 2Mbps - aryRates[7] = 0x02; // 1Mbps + if (pAdapter->CommonCfg.PhyMode == PHY_11B) { /*B Only */ + aryRates[0] = 0x16; /* 11Mbps */ + aryRates[1] = 0x0b; /* 5.5Mbps */ + aryRates[2] = 0x04; /* 2Mbps */ + aryRates[3] = 0x02; /* 1Mbps */ + } else { /*(B/G) Mixed or (A/B/G) Mixed */ + aryRates[0] = 0x6c; /* 54Mbps */ + aryRates[1] = 0x60; /* 48Mbps */ + aryRates[2] = 0x48; /* 36Mbps */ + aryRates[3] = 0x30; /* 24Mbps */ + aryRates[4] = 0x16; /* 11Mbps */ + aryRates[5] = 0x0b; /* 5.5Mbps */ + aryRates[6] = 0x04; /* 2Mbps */ + aryRates[7] = 0x02; /* 1Mbps */ } pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO; @@ -213,7 +213,7 @@ VOID RTMPSetDesiredRates(IN PRTMP_ADAPTER pAdapter, IN LONG Rates) pAdapter->CommonCfg.DesireRate[5], pAdapter->CommonCfg.DesireRate[6], pAdapter->CommonCfg.DesireRate[7])); - // Changing DesiredRate may affect the MAX TX rate we used to TX frames out + /* Changing DesiredRate may affect the MAX TX rate we used to TX frames out */ MlmeUpdateTxRates(pAdapter, FALSE, 0); } @@ -244,20 +244,20 @@ VOID RTMPWPARemoveAllKeys(IN PRTMP_ADAPTER pAd) ("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus)); RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); - // For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after - // Link up. And it will be replaced if user changed it. + /* For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after */ + /* Link up. And it will be replaced if user changed it. */ if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA) return; - // For WPA-None, there is no need to remove it, since WinXP won't set it again after - // Link up. And it will be replaced if user changed it. + /* For WPA-None, there is no need to remove it, since WinXP won't set it again after */ + /* Link up. And it will be replaced if user changed it. */ if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) return; - // set BSSID wcid entry of the Pair-wise Key table as no-security mode + /* set BSSID wcid entry of the Pair-wise Key table as no-security mode */ AsicRemovePairwiseKeyEntry(pAd, BSS0, BSSID_WCID); - // set all shared key mode as no-security. + /* set all shared key mode as no-security. */ for (i = 0; i < SHARE_KEY_NUM; i++) { DBGPRINT(RT_DEBUG_TRACE, ("remove %s key #%d\n", @@ -310,9 +310,9 @@ VOID RTMPWPARemoveAllKeys(IN PRTMP_ADAPTER pAd) VOID RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, IN ULONG phymode) { INT i; - // the selected phymode must be supported by the RF IC encoded in E2PROM + /* the selected phymode must be supported by the RF IC encoded in E2PROM */ - // if no change, do nothing + /* if no change, do nothing */ /* bug fix if (pAd->CommonCfg.PhyMode == phymode) return; @@ -325,7 +325,7 @@ VOID RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, IN ULONG phymode) BuildChannelList(pAd); - // sanity check user setting + /* sanity check user setting */ for (i = 0; i < pAd->ChannelListNum; i++) { if (pAd->CommonCfg.Channel == pAd->ChannelList[i].Channel) break; @@ -343,17 +343,17 @@ VOID RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, IN ULONG phymode) NdisZeroMemory(pAd->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES); switch (phymode) { case PHY_11B: - pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate + pAd->CommonCfg.SupRate[0] = 0x82; /* 1 mbps, in units of 0.5 Mbps, basic rate */ + pAd->CommonCfg.SupRate[1] = 0x84; /* 2 mbps, in units of 0.5 Mbps, basic rate */ + pAd->CommonCfg.SupRate[2] = 0x8B; /* 5.5 mbps, in units of 0.5 Mbps, basic rate */ + pAd->CommonCfg.SupRate[3] = 0x96; /* 11 mbps, in units of 0.5 Mbps, basic rate */ pAd->CommonCfg.SupRateLen = 4; pAd->CommonCfg.ExtRateLen = 0; - pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps - //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use + pAd->CommonCfg.DesireRate[0] = 2; /* 1 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[1] = 4; /* 2 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[2] = 11; /* 5.5 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[3] = 22; /* 11 mbps, in units of 0.5 Mbps */ + /*pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use */ break; case PHY_11G: @@ -363,57 +363,57 @@ VOID RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, IN ULONG phymode) case PHY_11ABGN_MIXED: case PHY_11BGN_MIXED: case PHY_11GN_MIXED: - pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[4] = 0x12; // 9 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[5] = 0x24; // 18 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[6] = 0x48; // 36 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRate[0] = 0x82; /* 1 mbps, in units of 0.5 Mbps, basic rate */ + pAd->CommonCfg.SupRate[1] = 0x84; /* 2 mbps, in units of 0.5 Mbps, basic rate */ + pAd->CommonCfg.SupRate[2] = 0x8B; /* 5.5 mbps, in units of 0.5 Mbps, basic rate */ + pAd->CommonCfg.SupRate[3] = 0x96; /* 11 mbps, in units of 0.5 Mbps, basic rate */ + pAd->CommonCfg.SupRate[4] = 0x12; /* 9 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.SupRate[5] = 0x24; /* 18 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.SupRate[6] = 0x48; /* 36 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.SupRate[7] = 0x6c; /* 54 mbps, in units of 0.5 Mbps */ pAd->CommonCfg.SupRateLen = 8; - pAd->CommonCfg.ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps - pAd->CommonCfg.ExtRate[1] = 0x18; // 12 mbps, in units of 0.5 Mbps - pAd->CommonCfg.ExtRate[2] = 0x30; // 24 mbps, in units of 0.5 Mbps - pAd->CommonCfg.ExtRate[3] = 0x60; // 48 mbps, in units of 0.5 Mbps + pAd->CommonCfg.ExtRate[0] = 0x0C; /* 6 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.ExtRate[1] = 0x18; /* 12 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.ExtRate[2] = 0x30; /* 24 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.ExtRate[3] = 0x60; /* 48 mbps, in units of 0.5 Mbps */ pAd->CommonCfg.ExtRateLen = 4; - pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[4] = 12; // 6 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[5] = 18; // 9 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[6] = 24; // 12 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[7] = 36; // 18 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[8] = 48; // 24 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[9] = 72; // 36 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[10] = 96; // 48 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[11] = 108; // 54 mbps, in units of 0.5 Mbps + pAd->CommonCfg.DesireRate[0] = 2; /* 1 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[1] = 4; /* 2 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[2] = 11; /* 5.5 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[3] = 22; /* 11 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[4] = 12; /* 6 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[5] = 18; /* 9 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[6] = 24; /* 12 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[7] = 36; /* 18 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[8] = 48; /* 24 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[9] = 72; /* 36 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[10] = 96; /* 48 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[11] = 108; /* 54 mbps, in units of 0.5 Mbps */ break; case PHY_11A: case PHY_11AN_MIXED: case PHY_11AGN_MIXED: case PHY_11N_5G: - pAd->CommonCfg.SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate - pAd->CommonCfg.SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps - pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps + pAd->CommonCfg.SupRate[0] = 0x8C; /* 6 mbps, in units of 0.5 Mbps, basic rate */ + pAd->CommonCfg.SupRate[1] = 0x12; /* 9 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.SupRate[2] = 0x98; /* 12 mbps, in units of 0.5 Mbps, basic rate */ + pAd->CommonCfg.SupRate[3] = 0x24; /* 18 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.SupRate[4] = 0xb0; /* 24 mbps, in units of 0.5 Mbps, basic rate */ + pAd->CommonCfg.SupRate[5] = 0x48; /* 36 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.SupRate[6] = 0x60; /* 48 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.SupRate[7] = 0x6c; /* 54 mbps, in units of 0.5 Mbps */ pAd->CommonCfg.SupRateLen = 8; pAd->CommonCfg.ExtRateLen = 0; - pAd->CommonCfg.DesireRate[0] = 12; // 6 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[1] = 18; // 9 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[2] = 24; // 12 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[3] = 36; // 18 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[4] = 48; // 24 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[5] = 72; // 36 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[6] = 96; // 48 mbps, in units of 0.5 Mbps - pAd->CommonCfg.DesireRate[7] = 108; // 54 mbps, in units of 0.5 Mbps - //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use + pAd->CommonCfg.DesireRate[0] = 12; /* 6 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[1] = 18; /* 9 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[2] = 24; /* 12 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[3] = 36; /* 18 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[4] = 48; /* 24 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[5] = 72; /* 36 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[6] = 96; /* 48 mbps, in units of 0.5 Mbps */ + pAd->CommonCfg.DesireRate[7] = 108; /* 54 mbps, in units of 0.5 Mbps */ + /*pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use */ break; default: @@ -437,7 +437,7 @@ VOID RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, IN ULONG phymode) */ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode) { - //ULONG *pmcs; + /*ULONG *pmcs; */ UINT32 Value = 0; UCHAR BBPValue = 0; UCHAR BBP3Value = 0; @@ -448,7 +448,7 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode) pHTPhyMode->HtMode, pHTPhyMode->ExtOffset, pHTPhyMode->MCS, pHTPhyMode->BW, pHTPhyMode->STBC, pHTPhyMode->SHORTGI)); - // Don't zero supportedHyPhy structure. + /* Don't zero supportedHyPhy structure. */ RTMPZeroMemory(&pAd->CommonCfg.HtCapability, sizeof(pAd->CommonCfg.HtCapability)); RTMPZeroMemory(&pAd->CommonCfg.AddHTInfo, @@ -473,7 +473,7 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode) ("RTMPSetHT : RxBAWinLimit = %d\n", pAd->CommonCfg.BACapability.field.RxBAWinLimit)); - // Mimo power save, A-MSDU size, + /* Mimo power save, A-MSDU size, */ pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT) pAd->CommonCfg.BACapability.field.AmsduEnable; pAd->CommonCfg.DesiredHtPhy.AmsduSize = @@ -503,7 +503,7 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode) } else pAd->CommonCfg.DesiredHtPhy.GF = 0; - // Decide Rx MCSSet + /* Decide Rx MCSSet */ switch (RxStream) { case 1: pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff; @@ -515,7 +515,7 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode) pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff; break; - case 3: // 3*3 + case 3: /* 3*3 */ pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff; pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff; pAd->CommonCfg.HtCapability.MCSSet[2] = 0xff; @@ -529,7 +529,7 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode) } if (pHTPhyMode->BW == BW_40) { - pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; // MCS 32 + pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; /* MCS 32 */ pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 1; if (pAd->CommonCfg.Channel <= 14) pAd->CommonCfg.HtCapability.HtCapInfo.CCKmodein40 = 1; @@ -539,7 +539,7 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode) pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = (pHTPhyMode->ExtOffset == EXTCHA_BELOW) ? (EXTCHA_BELOW) : EXTCHA_ABOVE; - // Set Regsiter for extension channel position. + /* Set Regsiter for extension channel position. */ RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value); RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBP3Value); if ((pHTPhyMode->ExtOffset == EXTCHA_BELOW)) { @@ -551,8 +551,8 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode) BBP3Value &= (~0x20); RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value); } - // Turn on BBP 40MHz mode now only as AP . - // Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection. + /* Turn on BBP 40MHz mode now only as AP . */ + /* Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection. */ if ((pAd->OpMode == OPMODE_AP) || INFRA_ON(pAd) || ADHOC_ON(pAd) ) { RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); @@ -569,7 +569,7 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode) pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 0; pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = EXTCHA_NONE; pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; - // Turn on BBP 20MHz mode by request here. + /* Turn on BBP 20MHz mode by request here. */ { RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); BBPValue &= (~0x18); @@ -600,12 +600,12 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode) pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 0; } - // We support link adaptation for unsolicit MCS feedback, set to 2. - pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; //MCSFBK_UNSOLICIT; + /* We support link adaptation for unsolicit MCS feedback, set to 2. */ + pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; /*MCSFBK_UNSOLICIT; */ pAd->CommonCfg.AddHTInfo.ControlChan = pAd->CommonCfg.Channel; - // 1, the extension channel above the control channel. + /* 1, the extension channel above the control channel. */ - // EDCA parameters used for AP's own transmission + /* EDCA parameters used for AP's own transmission */ if (pAd->CommonCfg.APEdcaParm.bValid == FALSE) { pAd->CommonCfg.APEdcaParm.bValid = TRUE; pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3; @@ -659,7 +659,7 @@ VOID RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) pDesired_ht_phy = &pAd->StaCfg.DesiredHtPhyInfo; DesiredMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS; - //pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE; + /*pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE; */ break; } } while (FALSE); @@ -673,7 +673,7 @@ VOID RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs)); - // Check the validity of MCS + /* Check the validity of MCS */ if ((TxStream == 1) && ((DesiredMcs >= MCS_8) && (DesiredMcs <= MCS_15))) { DBGPRINT(RT_DEBUG_WARN, @@ -691,7 +691,7 @@ VOID RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) pDesired_ht_phy->bHtEnable = TRUE; - // Decide desired Tx MCS + /* Decide desired Tx MCS */ switch (TxStream) { case 1: if (DesiredMcs == MCS_AUTO) { @@ -717,7 +717,7 @@ VOID RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) } break; - case 3: // 3*3 + case 3: /* 3*3 */ if (DesiredMcs == MCS_AUTO) { /* MCS0 ~ MCS23, 3 bytes */ pDesired_ht_phy->MCSSet[0] = 0xff; @@ -738,7 +738,7 @@ VOID RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) if (DesiredMcs == MCS_AUTO || DesiredMcs == MCS_32) pDesired_ht_phy->MCSSet[4] = 0x1; } - // update HT Rate setting + /* update HT Rate setting */ if (pAd->OpMode == OPMODE_STA) MlmeUpdateHtTxRates(pAd, BSS0); else @@ -778,7 +778,7 @@ VOID RTMPUpdateHTIE(IN RT_HT_CAPABILITY * pRtHt, pAddHtInfo->AddHtInfo.RecomWidth = pRtHt->RecomWidth; pAddHtInfo->AddHtInfo2.OperaionMode = pRtHt->OperaionMode; pAddHtInfo->AddHtInfo2.NonGfPresent = pRtHt->NonGfPresent; - RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet */ pMcsSet, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar. + RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet */ pMcsSet, 4); /* rt2860 only support MCS max=32, no need to copy all 16 uchar. */ DBGPRINT(RT_DEBUG_TRACE, ("RTMPUpdateHTIE <== \n")); } @@ -808,9 +808,9 @@ VOID RTMPAddWcidAttributeEntry(IN PRTMP_ADAPTER pAd, BssIdx)); return; } - // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists. - // 2. In Infra mode, the AID:1 MUST be wcid of infra STA. - // the AID:2~ assign to mesh link entry. + /* 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists. */ + /* 2. In Infra mode, the AID:1 MUST be wcid of infra STA. */ + /* the AID:2~ assign to mesh link entry. */ if (pEntry) Wcid = pEntry->Aid; else @@ -818,7 +818,7 @@ VOID RTMPAddWcidAttributeEntry(IN PRTMP_ADAPTER pAd, } } - // Update WCID attribute table + /* Update WCID attribute table */ offset = MAC_WCID_ATTRIBUTE_BASE + (Wcid * HW_WCID_ATTRI_SIZE); { @@ -830,26 +830,26 @@ VOID RTMPAddWcidAttributeEntry(IN PRTMP_ADAPTER pAd, RTMP_IO_WRITE32(pAd, offset, WCIDAttri); - // Update IV/EIV table + /* Update IV/EIV table */ offset = MAC_IVEIV_TABLE_BASE + (Wcid * HW_IVEIV_ENTRY_SIZE); - // WPA mode + /* WPA mode */ if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) || (CipherAlg == CIPHER_AES)) { - // Eiv bit on. keyid always is 0 for pairwise key + /* Eiv bit on. keyid always is 0 for pairwise key */ IVEIV = (KeyIdx << 6) | 0x20; } else { - // WEP KeyIdx is default tx key. + /* WEP KeyIdx is default tx key. */ IVEIV = (KeyIdx << 6); } - // For key index and ext IV bit, so only need to update the position(offset+3). + /* For key index and ext IV bit, so only need to update the position(offset+3). */ #ifdef RTMP_MAC_PCI RTMP_IO_WRITE8(pAd, offset + 3, IVEIV); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB RTUSBMultiWrite_OneByte(pAd, offset + 3, &IVEIV); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ DBGPRINT(RT_DEBUG_TRACE, ("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n", diff --git a/drivers/staging/rt2860/common/cmm_mac_pci.c b/drivers/staging/rt2860/common/cmm_mac_pci.c index c9209257a544..3b6f577a2919 100644 --- a/drivers/staging/rt2860/common/cmm_mac_pci.c +++ b/drivers/staging/rt2860/common/cmm_mac_pci.c @@ -61,23 +61,23 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) PRTMP_TX_RING pTxRing; PRTMP_DMABUF pDmaBuf; PNDIS_PACKET pPacket; -// PRTMP_REORDERBUF pReorderBuf; +/* PRTMP_REORDERBUF pReorderBuf; */ DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPAllocTxRxRingMemory\n")); do { - // - // Allocate all ring descriptors, include TxD, RxD, MgmtD. - // Although each size is different, to prevent cacheline and alignment - // issue, I intentional set them all to 64 bytes. - // + /* */ + /* Allocate all ring descriptors, include TxD, RxD, MgmtD. */ + /* Although each size is different, to prevent cacheline and alignment */ + /* issue, I intentional set them all to 64 bytes. */ + /* */ for (num = 0; num < NUM_OF_TX_RING; num++) { ULONG BufBasePaHigh; ULONG BufBasePaLow; PVOID BufBaseVa; - // - // Allocate Tx ring descriptor's memory (5 TX rings = 4 ACs + 1 HCCA) - // + /* */ + /* Allocate Tx ring descriptor's memory (5 TX rings = 4 ACs + 1 HCCA) */ + /* */ pAd->TxDescRing[num].AllocSize = TX_RING_SIZE * TXD_SIZE; RTMP_AllocateTxDescMemory(pAd, num, @@ -93,11 +93,11 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) Status = NDIS_STATUS_RESOURCES; break; } - // Zero init this memory block + /* Zero init this memory block */ NdisZeroMemory(pAd->TxDescRing[num].AllocVa, pAd->TxDescRing[num].AllocSize); - // Save PA & VA for further operation + /* Save PA & VA for further operation */ RingBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->TxDescRing[num]. AllocPa); @@ -106,9 +106,9 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) AllocPa); RingBaseVa = pAd->TxDescRing[num].AllocVa; - // - // Allocate all 1st TXBuf's memory for this TxRing - // + /* */ + /* Allocate all 1st TXBuf's memory for this TxRing */ + /* */ pAd->TxBufSpace[num].AllocSize = TX_RING_SIZE * TX_DMA_1ST_BUFFER_SIZE; RTMP_AllocateFirstTxBuffer(pAd, num, @@ -125,11 +125,11 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) Status = NDIS_STATUS_RESOURCES; break; } - // Zero init this memory block + /* Zero init this memory block */ NdisZeroMemory(pAd->TxBufSpace[num].AllocVa, pAd->TxBufSpace[num].AllocSize); - // Save PA & VA for further operation + /* Save PA & VA for further operation */ BufBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->TxBufSpace[num]. AllocPa); @@ -138,14 +138,14 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) AllocPa); BufBaseVa = pAd->TxBufSpace[num].AllocVa; - // - // Initialize Tx Ring Descriptor and associated buffer memory - // + /* */ + /* Initialize Tx Ring Descriptor and associated buffer memory */ + /* */ pTxRing = &pAd->TxRing[num]; for (index = 0; index < TX_RING_SIZE; index++) { pTxRing->Cell[index].pNdisPacket = NULL; pTxRing->Cell[index].pNextNdisPacket = NULL; - // Init Tx Ring Size, Va, Pa variables + /* Init Tx Ring Size, Va, Pa variables */ pTxRing->Cell[index].AllocSize = TXD_SIZE; pTxRing->Cell[index].AllocVa = RingBaseVa; RTMP_SetPhysicalAddressHigh(pTxRing-> @@ -155,7 +155,7 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) AllocPa, RingBasePaLow); - // Setup Tx Buffer size & address. only 802.11 header will store in this space + /* Setup Tx Buffer size & address. only 802.11 header will store in this space */ pDmaBuf = &pTxRing->Cell[index].DmaBuf; pDmaBuf->AllocSize = TX_DMA_1ST_BUFFER_SIZE; pDmaBuf->AllocVa = BufBaseVa; @@ -164,16 +164,16 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) RTMP_SetPhysicalAddressLow(pDmaBuf->AllocPa, BufBasePaLow); - // link the pre-allocated TxBuf to TXD + /* link the pre-allocated TxBuf to TXD */ pTxD = (PTXD_STRUC) pTxRing->Cell[index].AllocVa; pTxD->SDPtr0 = BufBasePaLow; - // advance to next ring descriptor address + /* advance to next ring descriptor address */ pTxD->DMADONE = 1; RingBasePaLow += TXD_SIZE; RingBaseVa = (PUCHAR) RingBaseVa + TXD_SIZE; - // advance to next TxBuf address + /* advance to next TxBuf address */ BufBasePaLow += TX_DMA_1ST_BUFFER_SIZE; BufBaseVa = (PUCHAR) BufBaseVa + TX_DMA_1ST_BUFFER_SIZE; @@ -185,9 +185,9 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) if (Status == NDIS_STATUS_RESOURCES) break; - // - // Allocate MGMT ring descriptor's memory except Tx ring which allocated eariler - // + /* */ + /* Allocate MGMT ring descriptor's memory except Tx ring which allocated eariler */ + /* */ pAd->MgmtDescRing.AllocSize = MGMT_RING_SIZE * TXD_SIZE; RTMP_AllocateMgmtDescMemory(pAd, pAd->MgmtDescRing.AllocSize, @@ -201,24 +201,24 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) Status = NDIS_STATUS_RESOURCES; break; } - // Zero init this memory block + /* Zero init this memory block */ NdisZeroMemory(pAd->MgmtDescRing.AllocVa, pAd->MgmtDescRing.AllocSize); - // Save PA & VA for further operation + /* Save PA & VA for further operation */ RingBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->MgmtDescRing.AllocPa); RingBasePaLow = RTMP_GetPhysicalAddressLow(pAd->MgmtDescRing.AllocPa); RingBaseVa = pAd->MgmtDescRing.AllocVa; - // - // Initialize MGMT Ring and associated buffer memory - // + /* */ + /* Initialize MGMT Ring and associated buffer memory */ + /* */ for (index = 0; index < MGMT_RING_SIZE; index++) { pAd->MgmtRing.Cell[index].pNdisPacket = NULL; pAd->MgmtRing.Cell[index].pNextNdisPacket = NULL; - // Init MGMT Ring Size, Va, Pa variables + /* Init MGMT Ring Size, Va, Pa variables */ pAd->MgmtRing.Cell[index].AllocSize = TXD_SIZE; pAd->MgmtRing.Cell[index].AllocVa = RingBaseVa; RTMP_SetPhysicalAddressHigh(pAd->MgmtRing.Cell[index]. @@ -226,22 +226,22 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) RTMP_SetPhysicalAddressLow(pAd->MgmtRing.Cell[index]. AllocPa, RingBasePaLow); - // Offset to next ring descriptor address + /* Offset to next ring descriptor address */ RingBasePaLow += TXD_SIZE; RingBaseVa = (PUCHAR) RingBaseVa + TXD_SIZE; - // link the pre-allocated TxBuf to TXD + /* link the pre-allocated TxBuf to TXD */ pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[index].AllocVa; pTxD->DMADONE = 1; - // no pre-allocated buffer required in MgmtRing for scatter-gather case + /* no pre-allocated buffer required in MgmtRing for scatter-gather case */ } DBGPRINT(RT_DEBUG_TRACE, ("MGMT Ring: total %d entry allocated\n", index)); - // - // Allocate RX ring descriptor's memory except Tx ring which allocated eariler - // + /* */ + /* Allocate RX ring descriptor's memory except Tx ring which allocated eariler */ + /* */ pAd->RxDescRing.AllocSize = RX_RING_SIZE * RXD_SIZE; RTMP_AllocateRxDescMemory(pAd, pAd->RxDescRing.AllocSize, @@ -255,7 +255,7 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) Status = NDIS_STATUS_RESOURCES; break; } - // Zero init this memory block + /* Zero init this memory block */ NdisZeroMemory(pAd->RxDescRing.AllocVa, pAd->RxDescRing.AllocSize); @@ -263,18 +263,18 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) ("RX DESC %p size = %ld\n", pAd->RxDescRing.AllocVa, pAd->RxDescRing.AllocSize)); - // Save PA & VA for further operation + /* Save PA & VA for further operation */ RingBasePaHigh = RTMP_GetPhysicalAddressHigh(pAd->RxDescRing.AllocPa); RingBasePaLow = RTMP_GetPhysicalAddressLow(pAd->RxDescRing.AllocPa); RingBaseVa = pAd->RxDescRing.AllocVa; - // - // Initialize Rx Ring and associated buffer memory - // + /* */ + /* Initialize Rx Ring and associated buffer memory */ + /* */ for (index = 0; index < RX_RING_SIZE; index++) { - // Init RX Ring Size, Va, Pa variables + /* Init RX Ring Size, Va, Pa variables */ pAd->RxRing.Cell[index].AllocSize = RXD_SIZE; pAd->RxRing.Cell[index].AllocVa = RingBaseVa; RTMP_SetPhysicalAddressHigh(pAd->RxRing.Cell[index]. @@ -282,13 +282,13 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) RTMP_SetPhysicalAddressLow(pAd->RxRing.Cell[index]. AllocPa, RingBasePaLow); - //NdisZeroMemory(RingBaseVa, RXD_SIZE); + /*NdisZeroMemory(RingBaseVa, RXD_SIZE); */ - // Offset to next ring descriptor address + /* Offset to next ring descriptor address */ RingBasePaLow += RXD_SIZE; RingBaseVa = (PUCHAR) RingBaseVa + RXD_SIZE; - // Setup Rx associated Buffer size & allocate share memory + /* Setup Rx associated Buffer size & allocate share memory */ pDmaBuf = &pAd->RxRing.Cell[index].DmaBuf; pDmaBuf->AllocSize = RX_BUFFER_AGGRESIZE; pPacket = RTMP_AllocateRxPacketBuffer(pAd, @@ -301,17 +301,17 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) /* keep allocated rx packet */ pAd->RxRing.Cell[index].pNdisPacket = pPacket; - // Error handling + /* Error handling */ if (pDmaBuf->AllocVa == NULL) { ErrorValue = ERRLOG_OUT_OF_SHARED_MEMORY; DBGPRINT_ERR(("Failed to allocate RxRing's 1st buffer\n")); Status = NDIS_STATUS_RESOURCES; break; } - // Zero init this memory block + /* Zero init this memory block */ NdisZeroMemory(pDmaBuf->AllocVa, pDmaBuf->AllocSize); - // Write RxD buffer address & allocated buffer length + /* Write RxD buffer address & allocated buffer length */ pRxD = (PRXD_STRUC) pAd->RxRing.Cell[index].AllocVa; pRxD->SDP0 = RTMP_GetPhysicalAddressLow(pDmaBuf->AllocPa); @@ -333,12 +333,12 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) } if (Status != NDIS_STATUS_SUCCESS) { - // Log error inforamtion + /* Log error inforamtion */ NdisWriteErrorLogEntry(pAd->AdapterHandle, NDIS_ERROR_CODE_OUT_OF_RESOURCES, 1, ErrorValue); } - // Following code segment get from original func:NICInitTxRxRingAndBacklogQueue(), now should integrate it to here. + /* Following code segment get from original func:NICInitTxRxRingAndBacklogQueue(), now should integrate it to here. */ { DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitTxRxRingAndBacklogQueue\n")); @@ -351,21 +351,21 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); */ - // Initialize all transmit related software queues + /* Initialize all transmit related software queues */ for (index = 0; index < NUM_OF_TX_RING; index++) { InitializeQueueHeader(&pAd->TxSwQueue[index]); - // Init TX rings index pointer + /* Init TX rings index pointer */ pAd->TxRing[index].TxSwFreeIdx = 0; pAd->TxRing[index].TxCpuIdx = 0; - //RTMP_IO_WRITE32(pAd, (TX_CTX_IDX0 + i * 0x10) , pAd->TxRing[i].TX_CTX_IDX); + /*RTMP_IO_WRITE32(pAd, (TX_CTX_IDX0 + i * 0x10) , pAd->TxRing[i].TX_CTX_IDX); */ } - // Init RX Ring index pointer + /* Init RX Ring index pointer */ pAd->RxRing.RxSwReadIdx = 0; pAd->RxRing.RxCpuIdx = RX_RING_SIZE - 1; - //RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RX_CRX_IDX0); + /*RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RX_CRX_IDX0); */ - // init MGMT ring index pointer + /* init MGMT ring index pointer */ pAd->MgmtRing.TxSwFreeIdx = 0; pAd->MgmtRing.TxCpuIdx = 0; @@ -409,7 +409,7 @@ VOID RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, IN UCHAR RingType) int i; PRTMP_TX_RING pTxRing; unsigned long IrqFlags; - //UINT32 RxSwReadIdx; + /*UINT32 RxSwReadIdx; */ DBGPRINT(RT_DEBUG_TRACE, ("RTMPRingCleanUp(RingIdx=%d, Pending-NDIS=%ld)\n", RingType, @@ -423,13 +423,13 @@ VOID RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, IN UCHAR RingType) pTxRing = &pAd->TxRing[RingType]; RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); - // We have to clean all descriptors in case some error happened with reset - for (i = 0; i < TX_RING_SIZE; i++) // We have to scan all TX ring + /* We have to clean all descriptors in case some error happened with reset */ + for (i = 0; i < TX_RING_SIZE; i++) /* We have to scan all TX ring */ { pTxD = (PTXD_STRUC) pTxRing->Cell[i].AllocVa; pPacket = (PNDIS_PACKET) pTxRing->Cell[i].pNdisPacket; - // release scatter-and-gather NDIS_PACKET + /* release scatter-and-gather NDIS_PACKET */ if (pPacket) { RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); @@ -438,7 +438,7 @@ VOID RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, IN UCHAR RingType) pPacket = (PNDIS_PACKET) pTxRing->Cell[i].pNextNdisPacket; - // release scatter-and-gather NDIS_PACKET + /* release scatter-and-gather NDIS_PACKET */ if (pPacket) { RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); @@ -467,7 +467,7 @@ VOID RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, IN UCHAR RingType) break; case QID_MGMT: - // We have to clean all descriptors in case some error happened with reset + /* We have to clean all descriptors in case some error happened with reset */ NdisAcquireSpinLock(&pAd->MgmtRingLock); for (i = 0; i < MGMT_RING_SIZE; i++) { @@ -475,7 +475,7 @@ VOID RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, IN UCHAR RingType) pPacket = (PNDIS_PACKET) pAd->MgmtRing.Cell[i].pNdisPacket; - // rlease scatter-and-gather NDIS_PACKET + /* rlease scatter-and-gather NDIS_PACKET */ if (pPacket) { PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, @@ -488,7 +488,7 @@ VOID RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, IN UCHAR RingType) pPacket = (PNDIS_PACKET) pAd->MgmtRing.Cell[i]. pNextNdisPacket; - // release scatter-and-gather NDIS_PACKET + /* release scatter-and-gather NDIS_PACKET */ if (pPacket) { PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, @@ -510,7 +510,7 @@ VOID RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, IN UCHAR RingType) break; case QID_RX: - // We have to clean all descriptors in case some error happened with reset + /* We have to clean all descriptors in case some error happened with reset */ NdisAcquireSpinLock(&pAd->RxRingLock); for (i = 0; i < RX_RING_SIZE; i++) { @@ -541,11 +541,11 @@ VOID RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) PNDIS_PACKET pPacket; unsigned int IrqFlags; - //POS_COOKIE pObj =(POS_COOKIE) pAd->OS_Cookie; + /*POS_COOKIE pObj =(POS_COOKIE) pAd->OS_Cookie; */ DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPFreeTxRxRingMemory\n")); - // Free TxSwQueue Packet + /* Free TxSwQueue Packet */ for (index = 0; index < NUM_OF_TX_RING; index++) { PQUEUE_ENTRY pEntry; PNDIS_PACKET pPacket; @@ -561,7 +561,7 @@ VOID RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); } - // Free Tx Ring Packet + /* Free Tx Ring Packet */ for (index = 0; index < NUM_OF_TX_RING; index++) { pTxRing = &pAd->TxRing[index]; @@ -576,7 +576,7 @@ VOID RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); } - //Always assign pNdisPacket as NULL after clear + /*Always assign pNdisPacket as NULL after clear */ pTxRing->Cell[j].pNdisPacket = NULL; pPacket = pTxRing->Cell[j].pNextNdisPacket; @@ -588,7 +588,7 @@ VOID RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_SUCCESS); } - //Always assign pNextNdisPacket as NULL after clear + /*Always assign pNextNdisPacket as NULL after clear */ pTxRing->Cell[pTxRing->TxSwFreeIdx].pNextNdisPacket = NULL; @@ -729,7 +729,7 @@ BOOLEAN AsicCheckCommanOk(IN PRTMP_ADAPTER pAd, IN UCHAR Command) i = 0; do { RTMP_IO_READ32(pAd, H2M_MAILBOX_CID, &CID); - // Find where the command is. Because this is randomly specified by firmware. + /* Find where the command is. Because this is randomly specified by firmware. */ if ((CID & CID0MASK) == Command) { ThisCIDMask = CID0MASK; break; @@ -748,12 +748,12 @@ BOOLEAN AsicCheckCommanOk(IN PRTMP_ADAPTER pAd, IN UCHAR Command) i++; } while (i < 200); - // Get CommandStatus Value + /* Get CommandStatus Value */ RTMP_IO_READ32(pAd, H2M_MAILBOX_STATUS, &CmdStatus); - // This command's status is at the same position as command. So AND command position's bitmask to read status. + /* This command's status is at the same position as command. So AND command position's bitmask to read status. */ if (i < 200) { - // If Status is 1, the comamnd is success. + /* If Status is 1, the comamnd is success. */ if (((CmdStatus & ThisCIDMask) == 0x1) || ((CmdStatus & ThisCIDMask) == 0x100) || ((CmdStatus & ThisCIDMask) == 0x10000) @@ -773,7 +773,7 @@ BOOLEAN AsicCheckCommanOk(IN PRTMP_ADAPTER pAd, IN UCHAR Command) ("--> AsicCheckCommanFail2 Timeout Command = %d, CmdStatus= 0x%x \n", Command, CmdStatus)); } - // Clear Command and Status. + /* Clear Command and Status. */ RTMP_IO_WRITE32(pAd, H2M_MAILBOX_STATUS, 0xffffffff); RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CID, 0xffffffff); @@ -810,10 +810,10 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, return; } - //if ((pAd->WdsTab.Mode == WDS_BRIDGE_MODE) - // || ((pAd->ApCfg.MBSSID[apidx].MSSIDDev == NULL) - // || !(pAd->ApCfg.MBSSID[apidx].MSSIDDev->flags & IFF_UP)) - // ) + /*if ((pAd->WdsTab.Mode == WDS_BRIDGE_MODE) */ + /* || ((pAd->ApCfg.MBSSID[apidx].MSSIDDev == NULL) */ + /* || !(pAd->ApCfg.MBSSID[apidx].MSSIDDev->flags & IFF_UP)) */ + /* ) */ if (bBcnReq == FALSE) { /* when the ra interface is down, do not send its beacon frame */ /* clear all zero */ @@ -822,7 +822,7 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, 0x00); } else { ptr = (PUCHAR) & pAd->BeaconTxWI; - for (i = 0; i < TXWI_SIZE; i += 4) // 16-byte TXWI field + for (i = 0; i < TXWI_SIZE; i += 4) /* 16-byte TXWI field */ { UINT32 longptr = *ptr + (*(ptr + 1) << 8) + (*(ptr + 2) << 16) + @@ -832,7 +832,7 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, ptr += 4; } - // Update CapabilityInfo in Beacon + /* Update CapabilityInfo in Beacon */ for (i = CapInfoPos; i < (CapInfoPos + 2); i++) { RTMP_IO_WRITE8(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + @@ -871,7 +871,7 @@ VOID RT28xxPciStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) && pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) { - // Support PCIe Advance Power Save + /* Support PCIe Advance Power Save */ if (bFromTx == TRUE && (pAd->Mlme.bPsPollTimerRunning == TRUE)) { pAd->Mlme.bPsPollTimerRunning = FALSE; RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); @@ -885,7 +885,7 @@ VOID RT28xxPciStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) if (RT28xxPciAsicRadioOn(pAd, DOT11POWERSAVE)) { #ifdef PCIE_PS_SUPPORT - // add by johnli, RF power sequence setup, load RF normal operation-mode setup + /* add by johnli, RF power sequence setup, load RF normal operation-mode setup */ if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) { RTMP_CHIP_OP *pChipOps = &pAd->chipOps; @@ -894,16 +894,16 @@ VOID RT28xxPciStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) pChipOps-> AsicReverseRfFromSleepMode(pAd); } else -#endif // PCIE_PS_SUPPORT // +#endif /* PCIE_PS_SUPPORT // */ { - // end johnli - // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. + /* end johnli */ + /* In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. */ if (INFRA_ON(pAd) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo. ChannelWidth == BW_40)) { - // Must using 40MHz. + /* Must using 40MHz. */ AsicSwitchChannel(pAd, pAd->CommonCfg. CentralChannel, @@ -912,7 +912,7 @@ VOID RT28xxPciStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) pAd->CommonCfg. CentralChannel); } else { - // Must using 20MHz. + /* Must using 20MHz. */ AsicSwitchChannel(pAd, pAd->CommonCfg. Channel, FALSE); @@ -922,8 +922,8 @@ VOID RT28xxPciStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) } } #ifdef PCIE_PS_SUPPORT - // 3090 MCU Wakeup command needs more time to be stable. - // Before stable, don't issue other MCU command to prevent from firmware error. + /* 3090 MCU Wakeup command needs more time to be stable. */ + /* Before stable, don't issue other MCU command to prevent from firmware error. */ if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) @@ -934,9 +934,9 @@ VOID RT28xxPciStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) pAd->brt30xxBanMcuCmd = FALSE; RTMP_SEM_UNLOCK(&pAd->McuCmdLock); } -#endif // PCIE_PS_SUPPORT // +#endif /* PCIE_PS_SUPPORT // */ } else { - // PCI, 2860-PCIe + /* PCI, 2860-PCIe */ DBGPRINT(RT_DEBUG_TRACE, ("<==RT28xxPciStaAsicForceWakeup::Original PCI Power Saving\n")); AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02); @@ -968,8 +968,8 @@ VOID RT28xxPciStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, } NdisGetSystemUpTime(&Now); - // If last send NULL fram time is too close to this receiving beacon (within 8ms), don't go to sleep for this DTM. - // Because Some AP can't queuing outgoing frames immediately. + /* If last send NULL fram time is too close to this receiving beacon (within 8ms), don't go to sleep for this DTM. */ + /* Because Some AP can't queuing outgoing frames immediately. */ if (((pAd->Mlme.LastSendNULLpsmTime + 8) >= Now) && (pAd->Mlme.LastSendNULLpsmTime <= Now)) { DBGPRINT(RT_DEBUG_TRACE, @@ -995,11 +995,11 @@ VOID RT28xxPciStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, OPSTATUS_SET_FLAG(pAd, fOP_STATUS_DOZE); } else { AUTO_WAKEUP_STRUC AutoWakeupCfg; - // we have decided to SLEEP, so at least do it for a BEACON period. + /* we have decided to SLEEP, so at least do it for a BEACON period. */ if (TbttNumToNextWakeUp == 0) TbttNumToNextWakeUp = 1; - //RTMP_IO_WRITE32(pAd, INT_MASK_CSR, AutoWakeupInt); + /*RTMP_IO_WRITE32(pAd, INT_MASK_CSR, AutoWakeupInt); */ AutoWakeupCfg.word = 0; RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); @@ -1007,7 +1007,7 @@ VOID RT28xxPciStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, AutoWakeupCfg.field.EnableAutoWakeup = 1; AutoWakeupCfg.field.AutoLeadTime = 5; RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x00); // send POWER-SAVE command to MCU. Timeout 40us. + AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x00); /* send POWER-SAVE command to MCU. Timeout 40us. */ OPSTATUS_SET_FLAG(pAd, fOP_STATUS_DOZE); DBGPRINT(RT_DEBUG_TRACE, ("<-- %s, TbttNumToNextWakeUp=%d \n", __func__, @@ -1031,8 +1031,8 @@ VOID PsPollWakeExec(IN PVOID SystemSpecific1, pAd->Mlme.bPsPollTimerRunning = FALSE; RTMP_INT_UNLOCK(&pAd->irq_lock, flags); #ifdef PCIE_PS_SUPPORT - // For rt30xx power solution 3, Use software timer to wake up in psm. So call - // AsicForceWakeup here instead of handling twakeup interrupt. + /* For rt30xx power solution 3, Use software timer to wake up in psm. So call */ + /* AsicForceWakeup here instead of handling twakeup interrupt. */ if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) @@ -1041,7 +1041,7 @@ VOID PsPollWakeExec(IN PVOID SystemSpecific1, ("<--PsPollWakeExec::3090 calls AsicForceWakeup(pAd, DOT11POWERSAVE) in advance \n")); AsicForceWakeup(pAd, DOT11POWERSAVE); } -#endif // PCIE_PS_SUPPORT // +#endif /* PCIE_PS_SUPPORT // */ } VOID RadioOnExec(IN PVOID SystemSpecific1, @@ -1056,12 +1056,12 @@ VOID RadioOnExec(IN PVOID SystemSpecific1, if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { DBGPRINT(RT_DEBUG_TRACE, ("-->RadioOnExec() return on fOP_STATUS_DOZE == TRUE; \n")); -//KH Debug: Add the compile flag "RT2860 and condition +/*KH Debug: Add the compile flag "RT2860 and condition */ #ifdef RTMP_PCI_SUPPORT if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) && pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); -#endif // RTMP_PCI_SUPPORT // +#endif /* RTMP_PCI_SUPPORT // */ return; } @@ -1072,17 +1072,17 @@ VOID RadioOnExec(IN PVOID SystemSpecific1, if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) && pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); -#endif // RTMP_PCI_SUPPORT // +#endif /* RTMP_PCI_SUPPORT // */ return; } -//KH Debug: need to check. I add the compile flag "CONFIG_STA_SUPPORT" to enclose the following codes. +/*KH Debug: need to check. I add the compile flag "CONFIG_STA_SUPPORT" to enclose the following codes. */ #ifdef RTMP_PCI_SUPPORT if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) && pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) { pAd->Mlme.bPsPollTimerRunning = FALSE; RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); } -#endif // RTMP_PCI_SUPPORT // +#endif /* RTMP_PCI_SUPPORT // */ if (pAd->StaCfg.bRadio == TRUE) { pAd->bPCIclkOff = FALSE; RTMPRingCleanUp(pAd, QID_AC_BK); @@ -1092,42 +1092,42 @@ VOID RadioOnExec(IN PVOID SystemSpecific1, RTMPRingCleanUp(pAd, QID_MGMT); RTMPRingCleanUp(pAd, QID_RX); - // 2. Send wake up command. + /* 2. Send wake up command. */ AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x02); - // 2-1. wait command ok. + /* 2-1. wait command ok. */ AsicCheckCommanOk(pAd, PowerWakeCID); - // When PCI clock is off, don't want to service interrupt. So when back to clock on, enable interrupt. - //RTMP_IO_WRITE32(pAd, INT_MASK_CSR, (DELAYINTMASK|RxINT)); + /* When PCI clock is off, don't want to service interrupt. So when back to clock on, enable interrupt. */ + /*RTMP_IO_WRITE32(pAd, INT_MASK_CSR, (DELAYINTMASK|RxINT)); */ RTMP_ASIC_INTERRUPT_ENABLE(pAd); - // 3. Enable Tx DMA. + /* 3. Enable Tx DMA. */ RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &DmaCfg.word); DmaCfg.field.EnableTxDMA = 1; RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, DmaCfg.word); - // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. + /* In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. */ if (INFRA_ON(pAd) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) { - // Must using 40MHz. + /* Must using 40MHz. */ AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); } else { - // Must using 20MHz. + /* Must using 20MHz. */ AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.Channel); } -//KH Debug:The following codes should be enclosed by RT3090 compile flag +/*KH Debug:The following codes should be enclosed by RT3090 compile flag */ if (pChipOps->AsicReverseRfFromSleepMode) pChipOps->AsicReverseRfFromSleepMode(pAd); #ifdef PCIE_PS_SUPPORT -// 3090 MCU Wakeup command needs more time to be stable. -// Before stable, don't issue other MCU command to prevent from firmware error. +/* 3090 MCU Wakeup command needs more time to be stable. */ +/* Before stable, don't issue other MCU command to prevent from firmware error. */ if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) @@ -1136,12 +1136,12 @@ VOID RadioOnExec(IN PVOID SystemSpecific1, pAd->brt30xxBanMcuCmd = FALSE; RTMP_SEM_UNLOCK(&pAd->McuCmdLock); } -#endif // PCIE_PS_SUPPORT // +#endif /* PCIE_PS_SUPPORT // */ - // Clear Radio off flag + /* Clear Radio off flag */ RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - // Set LED + /* Set LED */ RTMPSetLED(pAd, LED_RADIO_ON); if (pAd->StaCfg.Psm == PWR_ACTIVE) { @@ -1166,9 +1166,9 @@ VOID RadioOnExec(IN PVOID SystemSpecific1, */ BOOLEAN RT28xxPciAsicRadioOn(IN PRTMP_ADAPTER pAd, IN UCHAR Level) { - //WPDMA_GLO_CFG_STRUC DmaCfg; + /*WPDMA_GLO_CFG_STRUC DmaCfg; */ BOOLEAN Cancelled; - //UINT32 MACValue; + /*UINT32 MACValue; */ if (pAd->OpMode == OPMODE_AP && Level == DOT11POWERSAVE) return FALSE; @@ -1181,8 +1181,8 @@ BOOLEAN RT28xxPciAsicRadioOn(IN PRTMP_ADAPTER pAd, IN UCHAR Level) if ((pAd->StaCfg.PSControl.field.EnableNewPS == TRUE && (Level == GUIRADIO_OFF || Level == GUI_IDLE_POWER_SAVE)) || RTMP_TEST_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND)) { - // Some chips don't need to delay 6ms, so copy RTMPPCIePowerLinkCtrlRestore - // return condition here. + /* Some chips don't need to delay 6ms, so copy RTMPPCIePowerLinkCtrlRestore */ + /* return condition here. */ /* if (((pAd->MACVersion&0xffff0000) != 0x28600000) && ((pAd->DeviceID == NIC2860_PCIe_DEVICE_ID) @@ -1191,7 +1191,7 @@ BOOLEAN RT28xxPciAsicRadioOn(IN PRTMP_ADAPTER pAd, IN UCHAR Level) { DBGPRINT(RT_DEBUG_TRACE, ("RT28xxPciAsicRadioOn ()\n")); - // 1. Set PCI Link Control in Configuration Space. + /* 1. Set PCI Link Control in Configuration Space. */ RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); RTMPusecDelay(6000); @@ -1204,16 +1204,16 @@ BOOLEAN RT28xxPciAsicRadioOn(IN PRTMP_ADAPTER pAd, IN UCHAR Level) && IS_VERSION_AFTER_F(pAd) && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE)))) -#endif // PCIE_PS_SUPPORT // +#endif /* PCIE_PS_SUPPORT // */ { pAd->bPCIclkOff = FALSE; DBGPRINT(RT_DEBUG_TRACE, ("PSM :309xbPCIclkOff == %d\n", pAd->bPCIclkOff)); } - // 2. Send wake up command. + /* 2. Send wake up command. */ AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x02); pAd->bPCIclkOff = FALSE; - // 2-1. wait command ok. + /* 2-1. wait command ok. */ AsicCheckCommanOk(pAd, PowerWakeCID); RTMP_ASIC_INTERRUPT_ENABLE(pAd); @@ -1221,14 +1221,14 @@ BOOLEAN RT28xxPciAsicRadioOn(IN PRTMP_ADAPTER pAd, IN UCHAR Level) if (Level == GUI_IDLE_POWER_SAVE) { #ifdef PCIE_PS_SUPPORT - // add by johnli, RF power sequence setup, load RF normal operation-mode setup + /* add by johnli, RF power sequence setup, load RF normal operation-mode setup */ if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) { RTMP_CHIP_OP *pChipOps = &pAd->chipOps; if (pChipOps->AsicReverseRfFromSleepMode) pChipOps->AsicReverseRfFromSleepMode(pAd); - // 3090 MCU Wakeup command needs more time to be stable. - // Before stable, don't issue other MCU command to prevent from firmware error. + /* 3090 MCU Wakeup command needs more time to be stable. */ + /* Before stable, don't issue other MCU command to prevent from firmware error. */ if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == @@ -1240,17 +1240,17 @@ BOOLEAN RT28xxPciAsicRadioOn(IN PRTMP_ADAPTER pAd, IN UCHAR Level) RTMP_SEM_UNLOCK(&pAd->McuCmdLock); } } else - // end johnli -#endif // PCIE_PS_SUPPORT // + /* end johnli */ +#endif /* PCIE_PS_SUPPORT // */ { - // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. + /* In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. */ { if (INFRA_ON(pAd) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo. ChannelWidth == BW_40)) { - // Must using 40MHz. + /* Must using 40MHz. */ AsicSwitchChannel(pAd, pAd->CommonCfg. CentralChannel, @@ -1259,7 +1259,7 @@ BOOLEAN RT28xxPciAsicRadioOn(IN PRTMP_ADAPTER pAd, IN UCHAR Level) pAd->CommonCfg. CentralChannel); } else { - // Must using 20MHz. + /* Must using 20MHz. */ AsicSwitchChannel(pAd, pAd->CommonCfg. Channel, FALSE); @@ -1304,7 +1304,7 @@ BOOLEAN RT28xxPciAsicRadioOff(IN PRTMP_ADAPTER pAd, if (pAd->OpMode == OPMODE_AP && Level == DOT11POWERSAVE) return FALSE; - // Check Rx DMA busy status, if more than half is occupied, give up this radio off. + /* Check Rx DMA busy status, if more than half is occupied, give up this radio off. */ RTMP_IO_READ32(pAd, RX_DRX_IDX, &RxDmaIdx); RTMP_IO_READ32(pAd, RX_CRX_IDX, &RxCpuIdx); if ((RxDmaIdx > RxCpuIdx) && ((RxDmaIdx - RxCpuIdx) > RX_RING_SIZE / 3)) { @@ -1319,8 +1319,8 @@ BOOLEAN RT28xxPciAsicRadioOff(IN PRTMP_ADAPTER pAd, RxCpuIdx, RxDmaIdx)); return FALSE; } - // Once go into this function, disable tx because don't want too many packets in queue to prevent HW stops. - //pAd->bPCIclkOffDisableTx = TRUE; + /* Once go into this function, disable tx because don't want too many packets in queue to prevent HW stops. */ + /*pAd->bPCIclkOffDisableTx = TRUE; */ RTMP_SET_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) && pAd->OpMode == OPMODE_STA @@ -1331,15 +1331,15 @@ BOOLEAN RT28xxPciAsicRadioOff(IN PRTMP_ADAPTER pAd, if (Level == DOT11POWERSAVE) { RTMP_IO_READ32(pAd, TBTT_TIMER, &TbTTTime); TbTTTime &= 0x1ffff; - // 00. check if need to do sleep in this DTIM period. If next beacon will arrive within 30ms , ...doesn't necessarily sleep. - // TbTTTime uint = 64us, LEAD_TIME unit = 1024us, PsPollTime unit = 1ms + /* 00. check if need to do sleep in this DTIM period. If next beacon will arrive within 30ms , ...doesn't necessarily sleep. */ + /* TbTTTime uint = 64us, LEAD_TIME unit = 1024us, PsPollTime unit = 1ms */ if (((64 * TbTTTime) < ((LEAD_TIME * 1024) + 40000)) && (TbttNumToNextWakeUp == 0)) { DBGPRINT(RT_DEBUG_TRACE, ("TbTTTime = 0x%x , give up this sleep. \n", TbTTTime)); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); - //pAd->bPCIclkOffDisableTx = FALSE; + /*pAd->bPCIclkOffDisableTx = FALSE; */ RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); return FALSE; } else { @@ -1355,7 +1355,7 @@ BOOLEAN RT28xxPciAsicRadioOff(IN PRTMP_ADAPTER pAd, EnableNewPS == TRUE)) { PsPollTime -= 5; } else -#endif // PCIE_PS_SUPPORT // +#endif /* PCIE_PS_SUPPORT // */ PsPollTime -= 3; BeaconPeriodTime = @@ -1379,52 +1379,52 @@ BOOLEAN RT28xxPciAsicRadioOff(IN PRTMP_ADAPTER pAd, RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); - // Set to 1R. + /* Set to 1R. */ if (pAd->Antenna.field.RxPath > 1 && pAd->OpMode == OPMODE_STA) { tempBBP_R3 = (pAd->StaCfg.BBPR3 & 0xE7); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, tempBBP_R3); } - // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. + /* In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. */ if ((INFRA_ON(pAd) || pAd->OpMode == OPMODE_AP) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) { - // Must using 40MHz. + /* Must using 40MHz. */ AsicTurnOffRFClk(pAd, pAd->CommonCfg.CentralChannel); } else { - // Must using 20MHz. + /* Must using 20MHz. */ AsicTurnOffRFClk(pAd, pAd->CommonCfg.Channel); } if (Level != RTMP_HALT) { - // Change Interrupt bitmask. - // When PCI clock is off, don't want to service interrupt. + /* Change Interrupt bitmask. */ + /* When PCI clock is off, don't want to service interrupt. */ RTMP_IO_WRITE32(pAd, INT_MASK_CSR, AutoWakeupInt); } else { RTMP_ASIC_INTERRUPT_DISABLE(pAd); } RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RxCpuIdx); - // 2. Send Sleep command + /* 2. Send Sleep command */ RTMP_IO_WRITE32(pAd, H2M_MAILBOX_STATUS, 0xffffffff); RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CID, 0xffffffff); - // send POWER-SAVE command to MCU. high-byte = 1 save power as much as possible. high byte = 0 save less power + /* send POWER-SAVE command to MCU. high-byte = 1 save power as much as possible. high byte = 0 save less power */ AsicSendCommandToMcu(pAd, 0x30, PowerSafeCID, 0xff, 0x1); - // 2-1. Wait command success - // Status = 1 : success, Status = 2, already sleep, Status = 3, Maybe MAC is busy so can't finish this task. + /* 2-1. Wait command success */ + /* Status = 1 : success, Status = 2, already sleep, Status = 3, Maybe MAC is busy so can't finish this task. */ brc = AsicCheckCommanOk(pAd, PowerSafeCID); - // 3. After 0x30 command is ok, send radio off command. lowbyte = 0 for power safe. - // If 0x30 command is not ok this time, we can ignore 0x35 command. It will make sure not cause firmware'r problem. + /* 3. After 0x30 command is ok, send radio off command. lowbyte = 0 for power safe. */ + /* If 0x30 command is not ok this time, we can ignore 0x35 command. It will make sure not cause firmware'r problem. */ if ((Level == DOT11POWERSAVE) && (brc == TRUE)) { - AsicSendCommandToMcu(pAd, 0x35, PowerRadioOffCID, 0, 0x00); // lowbyte = 0 means to do power safe, NOT turn off radio. - // 3-1. Wait command success + AsicSendCommandToMcu(pAd, 0x35, PowerRadioOffCID, 0, 0x00); /* lowbyte = 0 means to do power safe, NOT turn off radio. */ + /* 3-1. Wait command success */ AsicCheckCommanOk(pAd, PowerRadioOffCID); } else if (brc == TRUE) { - AsicSendCommandToMcu(pAd, 0x35, PowerRadioOffCID, 1, 0x00); // lowbyte = 0 means to do power safe, NOT turn off radio. - // 3-1. Wait command success + AsicSendCommandToMcu(pAd, 0x35, PowerRadioOffCID, 1, 0x00); /* lowbyte = 0 means to do power safe, NOT turn off radio. */ + /* 3-1. Wait command success */ AsicCheckCommanOk(pAd, PowerRadioOffCID); } - // 1. Wait DMA not busy + /* 1. Wait DMA not busy */ i = 0; do { RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &DmaCfg.word); @@ -1446,10 +1446,10 @@ BOOLEAN RT28xxPciAsicRadioOff(IN PRTMP_ADAPTER pAd, pAd->CheckDmaBusyCount = 0; } */ -//KH Debug:My original codes have the follwoing codes, but currecnt codes do not have it. -// Disable for stability. If PCIE Link Control is modified for advance power save, re-covery this code segment. +/*KH Debug:My original codes have the follwoing codes, but currecnt codes do not have it. */ +/* Disable for stability. If PCIE Link Control is modified for advance power save, re-covery this code segment. */ RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, 0x1280); -//OPSTATUS_SET_FLAG(pAd, fOP_STATUS_CLKSELECT_40MHZ); +/*OPSTATUS_SET_FLAG(pAd, fOP_STATUS_CLKSELECT_40MHZ); */ #ifdef PCIE_PS_SUPPORT if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) @@ -1460,39 +1460,39 @@ BOOLEAN RT28xxPciAsicRadioOff(IN PRTMP_ADAPTER pAd, ("RT28xxPciAsicRadioOff::3090 return to skip the following TbttNumToNextWakeUp setting for 279x\n")); pAd->bPCIclkOff = TRUE; RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); - // For this case, doesn't need to below actions, so return here. + /* For this case, doesn't need to below actions, so return here. */ return brc; } -#endif // PCIE_PS_SUPPORT // +#endif /* PCIE_PS_SUPPORT // */ if (Level == DOT11POWERSAVE) { AUTO_WAKEUP_STRUC AutoWakeupCfg; - //RTMPSetTimer(&pAd->Mlme.PsPollTimer, 90); + /*RTMPSetTimer(&pAd->Mlme.PsPollTimer, 90); */ - // we have decided to SLEEP, so at least do it for a BEACON period. + /* we have decided to SLEEP, so at least do it for a BEACON period. */ if (TbttNumToNextWakeUp == 0) TbttNumToNextWakeUp = 1; AutoWakeupCfg.word = 0; RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - // 1. Set auto wake up timer. + /* 1. Set auto wake up timer. */ AutoWakeupCfg.field.NumofSleepingTbtt = TbttNumToNextWakeUp - 1; AutoWakeupCfg.field.EnableAutoWakeup = 1; AutoWakeupCfg.field.AutoLeadTime = LEAD_TIME; RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); } - // 4-1. If it's to disable our device. Need to restore PCI Configuration Space to its original value. + /* 4-1. If it's to disable our device. Need to restore PCI Configuration Space to its original value. */ if (Level == RTMP_HALT && pAd->OpMode == OPMODE_STA) { if ((brc == TRUE) && (i < 50)) RTMPPCIeLinkCtrlSetting(pAd, 1); } - // 4. Set PCI configuration Space Link Comtrol fields. Only Radio Off needs to call this function + /* 4. Set PCI configuration Space Link Comtrol fields. Only Radio Off needs to call this function */ else if (pAd->OpMode == OPMODE_STA) { if ((brc == TRUE) && (i < 50)) RTMPPCIeLinkCtrlSetting(pAd, 3); } - //pAd->bPCIclkOffDisableTx = FALSE; + /*pAd->bPCIclkOffDisableTx = FALSE; */ RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); return TRUE; } @@ -1511,7 +1511,7 @@ VOID RT28xxPciMlmeRadioOn(IN PRTMP_ADAPTER pAd) || pAd->StaCfg.PSControl.field. EnableNewPS == FALSE))) { RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); - //NICResetFromError(pAd); + /*NICResetFromError(pAd); */ RTMPRingCleanUp(pAd, QID_AC_BK); RTMPRingCleanUp(pAd, QID_AC_BE); @@ -1520,15 +1520,15 @@ VOID RT28xxPciMlmeRadioOn(IN PRTMP_ADAPTER pAd) RTMPRingCleanUp(pAd, QID_MGMT); RTMPRingCleanUp(pAd, QID_RX); - // Enable Tx/Rx + /* Enable Tx/Rx */ RTMPEnableRxTx(pAd); - // Clear Radio off flag + /* Clear Radio off flag */ RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); - // Set LED + /* Set LED */ RTMPSetLED(pAd, LED_RADIO_ON); } @@ -1553,7 +1553,7 @@ VOID RT28xxPciMlmeRadioOFF(IN PRTMP_ADAPTER pAd) if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) return; - // Link down first if any association exists + /* Link down first if any association exists */ if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) { if (INFRA_ON(pAd) || ADHOC_ON(pAd)) { MLME_DISASSOC_REQ_STRUCT DisReq; @@ -1584,7 +1584,7 @@ VOID RT28xxPciMlmeRadioOFF(IN PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_TRACE, ("%s===>\n", __func__)); - // Set Radio off flag + /* Set Radio off flag */ RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); { @@ -1597,13 +1597,13 @@ VOID RT28xxPciMlmeRadioOFF(IN PRTMP_ADAPTER pAd) RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); } - // If during power safe mode. + /* If during power safe mode. */ if (pAd->StaCfg.bRadio == TRUE) { DBGPRINT(RT_DEBUG_TRACE, ("-->MlmeRadioOff() return on bRadio == TRUE; \n")); return; } - // Always radio on since the NIC needs to set the MCU command (LED_RADIO_OFF). + /* Always radio on since the NIC needs to set the MCU command (LED_RADIO_OFF). */ if (IDLE_ON(pAd) && (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) { @@ -1618,12 +1618,12 @@ VOID RT28xxPciMlmeRadioOFF(IN PRTMP_ADAPTER pAd) &Cancelled); } } - // Link down first if any association exists + /* Link down first if any association exists */ if (INFRA_ON(pAd) || ADHOC_ON(pAd)) LinkDown(pAd, FALSE); RTMPusecDelay(10000); - //========================================== - // Clean up old bss table + /*========================================== */ + /* Clean up old bss table */ BssTableInit(&pAd->ScanTab); /* @@ -1635,12 +1635,12 @@ VOID RT28xxPciMlmeRadioOFF(IN PRTMP_ADAPTER pAd) */ } - // Set LED.Move to here for fixing LED bug. This flag must be called after LinkDown + /* Set LED.Move to here for fixing LED bug. This flag must be called after LinkDown */ RTMPSetLED(pAd, LED_RADIO_OFF); -//KH Debug:All PCIe devices need to use timer to execute radio off function, or the PCIe&&EnableNewPS needs. -//KH Ans:It is right, because only when the PCIe and EnableNewPs is true, we need to delay the RadioOffTimer -//to avoid the deadlock with PCIe Power saving function. +/*KH Debug:All PCIe devices need to use timer to execute radio off function, or the PCIe&&EnableNewPS needs. */ +/*KH Ans:It is right, because only when the PCIe and EnableNewPs is true, we need to delay the RadioOffTimer */ +/*to avoid the deadlock with PCIe Power saving function. */ if (pAd->OpMode == OPMODE_STA && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) && pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) { @@ -1658,4 +1658,4 @@ VOID RT28xxPciMlmeRadioOFF(IN PRTMP_ADAPTER pAd) */ } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ diff --git a/drivers/staging/rt2860/common/cmm_mac_usb.c b/drivers/staging/rt2860/common/cmm_mac_usb.c index e53745590997..70e47db7cd51 100644 --- a/drivers/staging/rt2860/common/cmm_mac_usb.c +++ b/drivers/staging/rt2860/common/cmm_mac_usb.c @@ -57,22 +57,22 @@ NDIS_STATUS NICInitRecv(IN PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitRecv\n")); pObj = pObj; - //InterlockedExchange(&pAd->PendingRx, 0); + /*InterlockedExchange(&pAd->PendingRx, 0); */ pAd->PendingRx = 0; - pAd->NextRxBulkInReadIndex = 0; // Next Rx Read index - pAd->NextRxBulkInIndex = 0; //RX_RING_SIZE -1; // Rx Bulk pointer + pAd->NextRxBulkInReadIndex = 0; /* Next Rx Read index */ + pAd->NextRxBulkInIndex = 0; /*RX_RING_SIZE -1; // Rx Bulk pointer */ pAd->NextRxBulkInPosition = 0; for (i = 0; i < (RX_RING_SIZE); i++) { PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); - //Allocate URB + /*Allocate URB */ pRxContext->pUrb = RTUSB_ALLOC_URB(0); if (pRxContext->pUrb == NULL) { Status = NDIS_STATUS_RESOURCES; goto out1; } - // Allocate transfer buffer + /* Allocate transfer buffer */ pRxContext->TransferBuffer = RTUSB_URB_ALLOC_BUFFER(pObj->pUsb_Dev, MAX_RXBULK_SIZE, &pRxContext->data_dma); @@ -88,7 +88,7 @@ NDIS_STATUS NICInitRecv(IN PRTMP_ADAPTER pAd) pRxContext->InUse = FALSE; pRxContext->IRPPending = FALSE; pRxContext->Readable = FALSE; - //pRxContext->ReorderInUse = FALSE; + /*pRxContext->ReorderInUse = FALSE; */ pRxContext->bRxHandling = FALSE; pRxContext->BulkInOffset = 0; } @@ -165,44 +165,44 @@ NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd) PTX_CONTEXT pPsPollContext = &(pAd->PsPollContext); PTX_CONTEXT pRTSContext = &(pAd->RTSContext); PTX_CONTEXT pMLMEContext = NULL; -// PHT_TX_CONTEXT pHTTXContext = NULL; +/* PHT_TX_CONTEXT pHTTXContext = NULL; */ POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; PVOID RingBaseVa; -// RTMP_TX_RING *pTxRing; +/* RTMP_TX_RING *pTxRing; */ RTMP_MGMT_RING *pMgmtRing; DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitTransmit\n")); pObj = pObj; - // Init 4 set of Tx parameters + /* Init 4 set of Tx parameters */ for (acidx = 0; acidx < NUM_OF_TX_RING; acidx++) { - // Initialize all Transmit releated queues + /* Initialize all Transmit releated queues */ InitializeQueueHeader(&pAd->TxSwQueue[acidx]); - // Next Local tx ring pointer waiting for buck out + /* Next Local tx ring pointer waiting for buck out */ pAd->NextBulkOutIndex[acidx] = acidx; - pAd->BulkOutPending[acidx] = FALSE; // Buck Out control flag - //pAd->DataBulkDoneIdx[acidx] = 0; + pAd->BulkOutPending[acidx] = FALSE; /* Buck Out control flag */ + /*pAd->DataBulkDoneIdx[acidx] = 0; */ } - //pAd->NextMLMEIndex = 0; - //pAd->PushMgmtIndex = 0; - //pAd->PopMgmtIndex = 0; - //InterlockedExchange(&pAd->MgmtQueueSize, 0); - //InterlockedExchange(&pAd->TxCount, 0); + /*pAd->NextMLMEIndex = 0; */ + /*pAd->PushMgmtIndex = 0; */ + /*pAd->PopMgmtIndex = 0; */ + /*InterlockedExchange(&pAd->MgmtQueueSize, 0); */ + /*InterlockedExchange(&pAd->TxCount, 0); */ - //pAd->PrioRingFirstIndex = 0; - //pAd->PrioRingTxCnt = 0; + /*pAd->PrioRingFirstIndex = 0; */ + /*pAd->PrioRingTxCnt = 0; */ do { - // - // TX_RING_SIZE, 4 ACs - // + /* */ + /* TX_RING_SIZE, 4 ACs */ + /* */ for (acidx = 0; acidx < 4; acidx++) { PHT_TX_CONTEXT pHTTXContext = &(pAd->TxContext[acidx]); NdisZeroMemory(pHTTXContext, sizeof(HT_TX_CONTEXT)); - //Allocate URB + /*Allocate URB */ LM_USB_ALLOC(pObj, pHTTXContext, PHTTX_BUFFER, sizeof(HTTX_BUFFER), Status, ("<-- ERROR in Alloc TX TxContext[%d] urb!! \n", @@ -226,11 +226,11 @@ NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd) pAd->BulkOutPending[acidx] = FALSE; } - // - // MGMT_RING_SIZE - // + /* */ + /* MGMT_RING_SIZE */ + /* */ - // Allocate MGMT ring descriptor's memory + /* Allocate MGMT ring descriptor's memory */ pAd->MgmtDescRing.AllocSize = MGMT_RING_SIZE * sizeof(TX_CONTEXT); os_alloc_mem(pAd, (PUCHAR *) (&pAd->MgmtDescRing.AllocVa), @@ -244,16 +244,16 @@ NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd) pAd->MgmtDescRing.AllocSize); RingBaseVa = pAd->MgmtDescRing.AllocVa; - // Initialize MGMT Ring and associated buffer memory + /* Initialize MGMT Ring and associated buffer memory */ pMgmtRing = &pAd->MgmtRing; for (i = 0; i < MGMT_RING_SIZE; i++) { - // link the pre-allocated Mgmt buffer to MgmtRing.Cell + /* link the pre-allocated Mgmt buffer to MgmtRing.Cell */ pMgmtRing->Cell[i].AllocSize = sizeof(TX_CONTEXT); pMgmtRing->Cell[i].AllocVa = RingBaseVa; pMgmtRing->Cell[i].pNdisPacket = NULL; pMgmtRing->Cell[i].pNextNdisPacket = NULL; - //Allocate URB for MLMEContext + /*Allocate URB for MLMEContext */ pMLMEContext = (PTX_CONTEXT) pAd->MgmtRing.Cell[i].AllocVa; pMLMEContext->pUrb = RTUSB_ALLOC_URB(0); @@ -273,27 +273,27 @@ NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd) pMLMEContext->BulkOutSize = 0; pMLMEContext->SelfIdx = i; - // Offset to next ring descriptor address + /* Offset to next ring descriptor address */ RingBaseVa = (PUCHAR) RingBaseVa + sizeof(TX_CONTEXT); } DBGPRINT(RT_DEBUG_TRACE, ("MGMT Ring: total %d entry allocated\n", i)); - //pAd->MgmtRing.TxSwFreeIdx = (MGMT_RING_SIZE - 1); + /*pAd->MgmtRing.TxSwFreeIdx = (MGMT_RING_SIZE - 1); */ pAd->MgmtRing.TxSwFreeIdx = MGMT_RING_SIZE; pAd->MgmtRing.TxCpuIdx = 0; pAd->MgmtRing.TxDmaIdx = 0; - // - // BEACON_RING_SIZE - // - for (i = 0; i < BEACON_RING_SIZE; i++) // 2 + /* */ + /* BEACON_RING_SIZE */ + /* */ + for (i = 0; i < BEACON_RING_SIZE; i++) /* 2 */ { PTX_CONTEXT pBeaconContext = &(pAd->BeaconContext[i]); NdisZeroMemory(pBeaconContext, sizeof(TX_CONTEXT)); - //Allocate URB + /*Allocate URB */ LM_USB_ALLOC(pObj, pBeaconContext, PTX_BUFFER, sizeof(TX_BUFFER), Status, ("<-- ERROR in Alloc TX BeaconContext[%d] urb!! \n", @@ -307,12 +307,12 @@ NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd) pBeaconContext->IRPPending = FALSE; } - // - // NullContext - // + /* */ + /* NullContext */ + /* */ NdisZeroMemory(pNullContext, sizeof(TX_CONTEXT)); - //Allocate URB + /*Allocate URB */ LM_USB_ALLOC(pObj, pNullContext, PTX_BUFFER, sizeof(TX_BUFFER), Status, ("<-- ERROR in Alloc TX NullContext urb!! \n"), @@ -325,12 +325,12 @@ NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd) pNullContext->InUse = FALSE; pNullContext->IRPPending = FALSE; - // - // RTSContext - // + /* */ + /* RTSContext */ + /* */ NdisZeroMemory(pRTSContext, sizeof(TX_CONTEXT)); - //Allocate URB + /*Allocate URB */ LM_USB_ALLOC(pObj, pRTSContext, PTX_BUFFER, sizeof(TX_BUFFER), Status, ("<-- ERROR in Alloc TX RTSContext urb!! \n"), @@ -343,11 +343,11 @@ NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd) pRTSContext->InUse = FALSE; pRTSContext->IRPPending = FALSE; - // - // PsPollContext - // - //NdisZeroMemory(pPsPollContext, sizeof(TX_CONTEXT)); - //Allocate URB + /* */ + /* PsPollContext */ + /* */ + /*NdisZeroMemory(pPsPollContext, sizeof(TX_CONTEXT)); */ + /*Allocate URB */ LM_USB_ALLOC(pObj, pPsPollContext, PTX_BUFFER, sizeof(TX_BUFFER), Status, ("<-- ERROR in Alloc TX PsPollContext urb!! \n"), @@ -407,7 +407,7 @@ out1: LM_URB_FREE(pObj, pTxContext, sizeof(HTTX_BUFFER)); } - // Here we didn't have any pre-allocated memory need to free. + /* Here we didn't have any pre-allocated memory need to free. */ return Status; } @@ -430,21 +430,21 @@ Note: */ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) { -// COUNTER_802_11 pCounter = &pAd->WlanCounters; +/* COUNTER_802_11 pCounter = &pAd->WlanCounters; */ NDIS_STATUS Status; INT num; DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPAllocTxRxRingMemory\n")); do { - // Init the CmdQ and CmdQLock + /* Init the CmdQ and CmdQLock */ NdisAllocateSpinLock(&pAd->CmdQLock); NdisAcquireSpinLock(&pAd->CmdQLock); RTUSBInitializeCmdQ(&pAd->CmdQ); NdisReleaseSpinLock(&pAd->CmdQLock); NdisAllocateSpinLock(&pAd->MLMEBulkOutLock); - //NdisAllocateSpinLock(&pAd->MLMEWaitQueueLock); + /*NdisAllocateSpinLock(&pAd->MLMEWaitQueueLock); */ NdisAllocateSpinLock(&pAd->BulkOutLock[0]); NdisAllocateSpinLock(&pAd->BulkOutLock[1]); NdisAllocateSpinLock(&pAd->BulkOutLock[2]); @@ -457,31 +457,31 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) NdisAllocateSpinLock(&pAd->TxContextQueueLock[num]); } -// NdisAllocateSpinLock(&pAd->MemLock); // Not used in RT28XX +/* NdisAllocateSpinLock(&pAd->MemLock); // Not used in RT28XX */ -// NdisAllocateSpinLock(&pAd->MacTabLock); // init it in UserCfgInit() -// NdisAllocateSpinLock(&pAd->BATabLock); // init it in BATableInit() +/* NdisAllocateSpinLock(&pAd->MacTabLock); // init it in UserCfgInit() */ +/* NdisAllocateSpinLock(&pAd->BATabLock); // init it in BATableInit() */ -// for(num=0; numBATable.BARecEntry[num].RxReRingLock); -// } +/* for(num=0; numBATable.BARecEntry[num].RxReRingLock); */ +/* } */ - // - // Init Mac Table - // -// MacTableInitialize(pAd); + /* */ + /* Init Mac Table */ + /* */ +/* MacTableInitialize(pAd); */ - // - // Init send data structures and related parameters - // + /* */ + /* Init send data structures and related parameters */ + /* */ Status = NICInitTransmit(pAd); if (Status != NDIS_STATUS_SUCCESS) break; - // - // Init receive data structures and related parameters - // + /* */ + /* Init receive data structures and related parameters */ + /* */ Status = NICInitRecv(pAd); if (Status != NDIS_STATUS_SUCCESS) break; @@ -536,42 +536,42 @@ VOID RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) PTX_CONTEXT pNullContext = &pAd->NullContext; PTX_CONTEXT pPsPollContext = &pAd->PsPollContext; PTX_CONTEXT pRTSContext = &pAd->RTSContext; -// PHT_TX_CONTEXT pHTTXContext; - //PRTMP_REORDERBUF pReorderBuf; +/* PHT_TX_CONTEXT pHTTXContext; */ + /*PRTMP_REORDERBUF pReorderBuf; */ POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; -// RTMP_TX_RING *pTxRing; +/* RTMP_TX_RING *pTxRing; */ DBGPRINT(RT_DEBUG_ERROR, ("---> RTMPFreeTxRxRingMemory\n")); pObj = pObj; - // Free all resources for the RECEIVE buffer queue. + /* Free all resources for the RECEIVE buffer queue. */ for (i = 0; i < (RX_RING_SIZE); i++) { PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); if (pRxContext) LM_URB_FREE(pObj, pRxContext, MAX_RXBULK_SIZE); } - // Free PsPoll frame resource + /* Free PsPoll frame resource */ LM_URB_FREE(pObj, pPsPollContext, sizeof(TX_BUFFER)); - // Free NULL frame resource + /* Free NULL frame resource */ LM_URB_FREE(pObj, pNullContext, sizeof(TX_BUFFER)); - // Free RTS frame resource + /* Free RTS frame resource */ LM_URB_FREE(pObj, pRTSContext, sizeof(TX_BUFFER)); - // Free beacon frame resource + /* Free beacon frame resource */ for (i = 0; i < BEACON_RING_SIZE; i++) { PTX_CONTEXT pBeaconContext = &(pAd->BeaconContext[i]); if (pBeaconContext) LM_URB_FREE(pObj, pBeaconContext, sizeof(TX_BUFFER)); } - // Free mgmt frame resource + /* Free mgmt frame resource */ for (i = 0; i < MGMT_RING_SIZE; i++) { PTX_CONTEXT pMLMEContext = (PTX_CONTEXT) pAd->MgmtRing.Cell[i].AllocVa; - //LM_URB_FREE(pObj, pMLMEContext, sizeof(TX_BUFFER)); + /*LM_URB_FREE(pObj, pMLMEContext, sizeof(TX_BUFFER)); */ if (NULL != pAd->MgmtRing.Cell[i].pNdisPacket) { RTMPFreeNdisPacket(pAd, pAd->MgmtRing.Cell[i].pNdisPacket); @@ -590,7 +590,7 @@ VOID RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) if (pAd->MgmtDescRing.AllocVa) os_free_mem(pAd, pAd->MgmtDescRing.AllocVa); - // Free Tx frame resource + /* Free Tx frame resource */ for (acidx = 0; acidx < 4; acidx++) { PHT_TX_CONTEXT pHTTXContext = &(pAd->TxContext[acidx]); if (pHTTXContext) @@ -609,15 +609,15 @@ VOID RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) NdisFreeSpinLock(&pAd->MLMEBulkOutLock); NdisFreeSpinLock(&pAd->CmdQLock); - // Clear all pending bulk-out request flags. + /* Clear all pending bulk-out request flags. */ RTUSB_CLEAR_BULK_FLAG(pAd, 0xffffffff); -// NdisFreeSpinLock(&pAd->MacTabLock); +/* NdisFreeSpinLock(&pAd->MacTabLock); */ -// for(i=0; iBATable.BARecEntry[i].RxReRingLock); -// } +/* for(i=0; iBATable.BARecEntry[i].RxReRingLock); */ +/* } */ DBGPRINT(RT_DEBUG_ERROR, ("<--- RTMPFreeTxRxRingMemory\n")); } @@ -643,7 +643,7 @@ NDIS_STATUS RTUSBWriteHWMACAddress(IN PRTMP_ADAPTER pAd) NDIS_STATUS Status = NDIS_STATUS_SUCCESS; LARGE_INTEGER NOW; - // initialize the random number generator + /* initialize the random number generator */ RTMP_GetCurrentSystemTime(&NOW); if (pAd->bLocalAdminMAC != TRUE) { @@ -654,7 +654,7 @@ NDIS_STATUS RTUSBWriteHWMACAddress(IN PRTMP_ADAPTER pAd) pAd->CurrentAddress[4] = pAd->PermanentAddress[4]; pAd->CurrentAddress[5] = pAd->PermanentAddress[5]; } - // Write New MAC address to MAC_CSR2 & MAC_CSR3 & let ASIC know our new MAC + /* Write New MAC address to MAC_CSR2 & MAC_CSR3 & let ASIC know our new MAC */ StaMacReg0.field.Byte0 = pAd->CurrentAddress[0]; StaMacReg0.field.Byte1 = pAd->CurrentAddress[1]; StaMacReg0.field.Byte2 = pAd->CurrentAddress[2]; @@ -689,7 +689,7 @@ Note: */ VOID RT28XXDMADisable(IN RTMP_ADAPTER * pAd) { - // no use + /* no use */ } /* @@ -776,7 +776,7 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, UINT i, padding; BEACON_SYNC_STRUCT *pBeaconSync = pAd->CommonCfg.pBeaconSync; UINT32 longValue; -// USHORT shortValue; +/* USHORT shortValue; */ BOOLEAN bBcnReq = FALSE; UCHAR bcn_idx = 0; @@ -789,9 +789,9 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, DBGPRINT(RT_DEBUG_ERROR, ("pBeaconSync is NULL!\n")); return; } - //if ((pAd->WdsTab.Mode == WDS_BRIDGE_MODE) || - // ((pAd->ApCfg.MBSSID[apidx].MSSIDDev == NULL) || !(pAd->ApCfg.MBSSID[apidx].MSSIDDev->flags & IFF_UP)) - // ) + /*if ((pAd->WdsTab.Mode == WDS_BRIDGE_MODE) || */ + /* ((pAd->ApCfg.MBSSID[apidx].MSSIDDev == NULL) || !(pAd->ApCfg.MBSSID[apidx].MSSIDDev->flags & IFF_UP)) */ + /* ) */ if (bBcnReq == FALSE) { /* when the ra interface is down, do not send its beacon frame */ /* clear all zero */ @@ -804,7 +804,7 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, NdisZeroMemory(pBeaconSync->BeaconTxWI[bcn_idx], TXWI_SIZE); } else { ptr = (PUCHAR) & pAd->BeaconTxWI; - if (NdisEqualMemory(pBeaconSync->BeaconTxWI[bcn_idx], &pAd->BeaconTxWI, TXWI_SIZE) == FALSE) { // If BeaconTxWI changed, we need to rewrite the TxWI for the Beacon frames. + if (NdisEqualMemory(pBeaconSync->BeaconTxWI[bcn_idx], &pAd->BeaconTxWI, TXWI_SIZE) == FALSE) { /* If BeaconTxWI changed, we need to rewrite the TxWI for the Beacon frames. */ pBeaconSync->BeaconBitMap &= (~(BEACON_BITMAP_MASK & (1 << bcn_idx))); NdisMoveMemory(pBeaconSync->BeaconTxWI[bcn_idx], @@ -813,7 +813,7 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, if ((pBeaconSync->BeaconBitMap & (1 << bcn_idx)) != (1 << bcn_idx)) { - for (i = 0; i < TXWI_SIZE; i += 4) // 16-byte TXWI field + for (i = 0; i < TXWI_SIZE; i += 4) /* 16-byte TXWI field */ { longValue = *ptr + (*(ptr + 1) << 8) + @@ -832,8 +832,8 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, for (i = 0; i < FrameLen /*HW_BEACON_OFFSET */ ; i += 2) { if (NdisEqualMemory(ptr, pBeaconFrame, 2) == FALSE) { NdisMoveMemory(ptr, pBeaconFrame, 2); - //shortValue = *ptr + (*(ptr+1)<<8); - //RTMP_IO_WRITE8(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, shortValue); + /*shortValue = *ptr + (*(ptr+1)<<8); */ + /*RTMP_IO_WRITE8(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, shortValue); */ RTUSBMultiWrite(pAd, pAd->BeaconOffset[bcn_idx] + TXWI_SIZE + i, ptr, 2); @@ -844,7 +844,7 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, pBeaconSync->BeaconBitMap |= (1 << bcn_idx); - // For AP interface, set the DtimBitOn so that we can send Bcast/Mcast frame out after this beacon frame. + /* For AP interface, set the DtimBitOn so that we can send Bcast/Mcast frame out after this beacon frame. */ } } @@ -887,7 +887,7 @@ VOID RTUSBBssBeaconStart(IN RTMP_ADAPTER * pAd) { int apidx; BEACON_SYNC_STRUCT *pBeaconSync; -// LARGE_INTEGER tsfTime, deltaTime; +/* LARGE_INTEGER tsfTime, deltaTime; */ pBeaconSync = pAd->CommonCfg.pBeaconSync; if (pBeaconSync && pBeaconSync->EnableBeacon) { @@ -936,7 +936,7 @@ VOID RTUSBBssBeaconInit(IN RTMP_ADAPTER * pAd) os_alloc_mem(pAd, (PUCHAR *) (&pAd->CommonCfg.pBeaconSync), sizeof(BEACON_SYNC_STRUCT)); - //NdisAllocMemory(pAd->CommonCfg.pBeaconSync, sizeof(BEACON_SYNC_STRUCT), MEM_ALLOC_FLAG); + /*NdisAllocMemory(pAd->CommonCfg.pBeaconSync, sizeof(BEACON_SYNC_STRUCT), MEM_ALLOC_FLAG); */ if (pAd->CommonCfg.pBeaconSync) { pBeaconSync = pAd->CommonCfg.pBeaconSync; NdisZeroMemory(pBeaconSync, sizeof(BEACON_SYNC_STRUCT)); @@ -949,7 +949,7 @@ VOID RTUSBBssBeaconInit(IN RTMP_ADAPTER * pAd) } pBeaconSync->BeaconBitMap = 0; - //RTMPInitTimer(pAd, &pAd->CommonCfg.BeaconUpdateTimer, GET_TIMER_FUNCTION(BeaconUpdateExec), pAd, TRUE); + /*RTMPInitTimer(pAd, &pAd->CommonCfg.BeaconUpdateTimer, GET_TIMER_FUNCTION(BeaconUpdateExec), pAd, TRUE); */ pBeaconSync->EnableBeacon = TRUE; } } @@ -1002,9 +1002,9 @@ VOID BeaconUpdateExec(IN PVOID SystemSpecific1, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) { PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) FunctionContext; - LARGE_INTEGER tsfTime_a; //, tsfTime_b, deltaTime_exp, deltaTime_ab; + LARGE_INTEGER tsfTime_a; /*, tsfTime_b, deltaTime_exp, deltaTime_ab; */ UINT32 delta, delta2MS, period2US, remain, remain_low, remain_high; -// BOOLEAN positive; +/* BOOLEAN positive; */ if (pAd->CommonCfg.IsUpdateBeacon == TRUE) { ReSyncBeaconTime(pAd); @@ -1014,7 +1014,7 @@ VOID BeaconUpdateExec(IN PVOID SystemSpecific1, RTMP_IO_READ32(pAd, TSF_TIMER_DW0, &tsfTime_a.u.LowPart); RTMP_IO_READ32(pAd, TSF_TIMER_DW1, &tsfTime_a.u.HighPart); - //positive=getDeltaTime(tsfTime_a, expectedTime, &deltaTime_exp); + /*positive=getDeltaTime(tsfTime_a, expectedTime, &deltaTime_exp); */ period2US = (pAd->CommonCfg.BeaconPeriod << 10); remain_high = pAd->CommonCfg.BeaconRemain * tsfTime_a.u.HighPart; remain_low = tsfTime_a.u.LowPart % (pAd->CommonCfg.BeaconPeriod << 10); @@ -1051,20 +1051,20 @@ VOID RT28xxUsbMlmeRadioOn(IN PRTMP_ADAPTER pAd) AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02); RTMPusecDelay(10000); } - //NICResetFromError(pAd); + /*NICResetFromError(pAd); */ - // Enable Tx/Rx + /* Enable Tx/Rx */ RTMPEnableRxTx(pAd); if (pChipOps->AsicReverseRfFromSleepMode) pChipOps->AsicReverseRfFromSleepMode(pAd); - // Clear Radio off flag + /* Clear Radio off flag */ RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); RTUSBBulkReceive(pAd); - // Set LED + /* Set LED */ RTMPSetLED(pAd, LED_RADIO_ON); } @@ -1078,11 +1078,11 @@ VOID RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd) if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) return; - // Clear PMKID cache. + /* Clear PMKID cache. */ pAd->StaCfg.SavedPMKNum = 0; RTMPZeroMemory(pAd->StaCfg.SavedPMK, (PMKID_NO * sizeof(BSSID_INFO))); - // Link down first if any association exists + /* Link down first if any association exists */ if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) { if (INFRA_ON(pAd) || ADHOC_ON(pAd)) { MLME_DISASSOC_REQ_STRUCT DisReq; @@ -1110,38 +1110,38 @@ VOID RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd) } } } - // Set Radio off flag + /* Set Radio off flag */ RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); { - // Link down first if any association exists + /* Link down first if any association exists */ if (INFRA_ON(pAd) || ADHOC_ON(pAd)) LinkDown(pAd, FALSE); RTMPusecDelay(10000); - //========================================== - // Clean up old bss table + /*========================================== */ + /* Clean up old bss table */ BssTableInit(&pAd->ScanTab); } - // Set LED + /* Set LED */ RTMPSetLED(pAd, LED_RADIO_OFF); if (pAd->CommonCfg.BBPCurrentBW == BW_40) { - // Must using 40MHz. + /* Must using 40MHz. */ AsicTurnOffRFClk(pAd, pAd->CommonCfg.CentralChannel); } else { - // Must using 20MHz. + /* Must using 20MHz. */ AsicTurnOffRFClk(pAd, pAd->CommonCfg.Channel); } - // Disable Tx/Rx DMA - RTUSBReadMACRegister(pAd, WPDMA_GLO_CFG, &GloCfg.word); // disable DMA + /* Disable Tx/Rx DMA */ + RTUSBReadMACRegister(pAd, WPDMA_GLO_CFG, &GloCfg.word); /* disable DMA */ GloCfg.field.EnableTxDMA = 0; GloCfg.field.EnableRxDMA = 0; - RTUSBWriteMACRegister(pAd, WPDMA_GLO_CFG, GloCfg.word); // abort all TX rings + RTUSBWriteMACRegister(pAd, WPDMA_GLO_CFG, GloCfg.word); /* abort all TX rings */ - // Waiting for DMA idle + /* Waiting for DMA idle */ i = 0; do { RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); @@ -1152,7 +1152,7 @@ VOID RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd) RTMPusecDelay(1000); } while (i++ < 100); - // Disable MAC Tx/Rx + /* Disable MAC Tx/Rx */ RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); Value &= (0xfffffff3); RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); @@ -1162,4 +1162,4 @@ VOID RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd) } } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ diff --git a/drivers/staging/rt2860/common/cmm_sanity.c b/drivers/staging/rt2860/common/cmm_sanity.c index 92c44c7ab99f..bd1202532aa0 100644 --- a/drivers/staging/rt2860/common/cmm_sanity.c +++ b/drivers/staging/rt2860/common/cmm_sanity.c @@ -144,7 +144,7 @@ BOOLEAN PeerAddBAReqActionSanity(IN PRTMP_ADAPTER pAd, MsgLen)); return FALSE; } - // we support immediate BA. + /* we support immediate BA. */ *(USHORT *) (&pAddFrame->BaParm) = cpu2le16(*(USHORT *) (&pAddFrame->BaParm)); pAddFrame->TimeOutValue = cpu2le16(pAddFrame->TimeOutValue); @@ -160,7 +160,7 @@ BOOLEAN PeerAddBAReqActionSanity(IN PRTMP_ADAPTER pAd, pAddFrame->BaParm.AMSDUSupported)); return FALSE; } - // we support immediate BA. + /* we support immediate BA. */ if (pAddFrame->BaParm.TID & 0xfff0) { DBGPRINT(RT_DEBUG_ERROR, ("PeerAddBAReqActionSanity: ADDBA Request incorrect TID = %d\n", @@ -183,7 +183,7 @@ BOOLEAN PeerAddBARspActionSanity(IN PRTMP_ADAPTER pAd, MsgLen)); return FALSE; } - // we support immediate BA. + /* we support immediate BA. */ *(USHORT *) (&pAddFrame->BaParm) = cpu2le16(*(USHORT *) (&pAddFrame->BaParm)); pAddFrame->StatusCode = cpu2le16(pAddFrame->StatusCode); @@ -195,7 +195,7 @@ BOOLEAN PeerAddBARspActionSanity(IN PRTMP_ADAPTER pAd, pAddFrame->BaParm.BAPolicy)); return FALSE; } - // we support immediate BA. + /* we support immediate BA. */ if (pAddFrame->BaParm.TID & 0xfff0) { DBGPRINT(RT_DEBUG_ERROR, ("PeerAddBARspActionSanity: ADDBA Response incorrect TID = %d\n", @@ -209,7 +209,7 @@ BOOLEAN PeerAddBARspActionSanity(IN PRTMP_ADAPTER pAd, BOOLEAN PeerDelBAActionSanity(IN PRTMP_ADAPTER pAd, IN UCHAR Wcid, IN VOID * pMsg, IN ULONG MsgLen) { - //PFRAME_802_11 pFrame = (PFRAME_802_11)pMsg; + /*PFRAME_802_11 pFrame = (PFRAME_802_11)pMsg; */ PFRAME_DELBA_REQ pDelFrame; if (MsgLen != (sizeof(FRAME_DELBA_REQ))) return FALSE; @@ -240,7 +240,7 @@ BOOLEAN PeerDelBAActionSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ -BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULONG MsgLen, IN UCHAR MsgChannel, OUT PUCHAR pAddr2, OUT PUCHAR pBssid, OUT CHAR Ssid[], OUT UCHAR * pSsidLen, OUT UCHAR * pBssType, OUT USHORT * pBeaconPeriod, OUT UCHAR * pChannel, OUT UCHAR * pNewChannel, OUT LARGE_INTEGER * pTimestamp, OUT CF_PARM * pCfParm, OUT USHORT * pAtimWin, OUT USHORT * pCapabilityInfo, OUT UCHAR * pErp, OUT UCHAR * pDtimCount, OUT UCHAR * pDtimPeriod, OUT UCHAR * pBcastFlag, OUT UCHAR * pMessageToMe, OUT UCHAR SupRate[], OUT UCHAR * pSupRateLen, OUT UCHAR ExtRate[], OUT UCHAR * pExtRateLen, OUT UCHAR * pCkipFlag, OUT UCHAR * pAironetCellPowerLimit, OUT PEDCA_PARM pEdcaParm, OUT PQBSS_LOAD_PARM pQbssLoad, OUT PQOS_CAPABILITY_PARM pQosCapability, OUT ULONG * pRalinkIe, OUT UCHAR * pHtCapabilityLen, OUT UCHAR * pPreNHtCapabilityLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT UCHAR * AddHtInfoLen, OUT ADD_HT_INFO_IE * AddHtInfo, OUT UCHAR * NewExtChannelOffset, // Ht extension channel offset(above or below) +BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULONG MsgLen, IN UCHAR MsgChannel, OUT PUCHAR pAddr2, OUT PUCHAR pBssid, OUT CHAR Ssid[], OUT UCHAR * pSsidLen, OUT UCHAR * pBssType, OUT USHORT * pBeaconPeriod, OUT UCHAR * pChannel, OUT UCHAR * pNewChannel, OUT LARGE_INTEGER * pTimestamp, OUT CF_PARM * pCfParm, OUT USHORT * pAtimWin, OUT USHORT * pCapabilityInfo, OUT UCHAR * pErp, OUT UCHAR * pDtimCount, OUT UCHAR * pDtimPeriod, OUT UCHAR * pBcastFlag, OUT UCHAR * pMessageToMe, OUT UCHAR SupRate[], OUT UCHAR * pSupRateLen, OUT UCHAR ExtRate[], OUT UCHAR * pExtRateLen, OUT UCHAR * pCkipFlag, OUT UCHAR * pAironetCellPowerLimit, OUT PEDCA_PARM pEdcaParm, OUT PQBSS_LOAD_PARM pQbssLoad, OUT PQOS_CAPABILITY_PARM pQosCapability, OUT ULONG * pRalinkIe, OUT UCHAR * pHtCapabilityLen, OUT UCHAR * pPreNHtCapabilityLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT UCHAR * AddHtInfoLen, OUT ADD_HT_INFO_IE * AddHtInfo, OUT UCHAR * NewExtChannelOffset, /* Ht extension channel offset(above or below) */ OUT USHORT * LengthVIE, OUT PNDIS_802_11_VARIABLE_IEs pVIE) { @@ -250,16 +250,16 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON PEID_STRUCT pEid; UCHAR SubType; UCHAR Sanity; - //UCHAR ECWMin, ECWMax; - //MAC_CSR9_STRUC Csr9; + /*UCHAR ECWMin, ECWMax; */ + /*MAC_CSR9_STRUC Csr9; */ ULONG Length = 0; - // For some 11a AP which didn't have DS_IE, we use two conditions to decide the channel - // 1. If the AP is 11n enabled, then check the control channel. - // 2. If the AP didn't have any info about channel, use the channel we received this frame as the channel. (May inaccuracy!!) + /* For some 11a AP which didn't have DS_IE, we use two conditions to decide the channel */ + /* 1. If the AP is 11n enabled, then check the control channel. */ + /* 2. If the AP didn't have any info about channel, use the channel we received this frame as the channel. (May inaccuracy!!) */ UCHAR CtrlChannel = 0; - // Add for 3 necessary EID field check + /* Add for 3 necessary EID field check */ Sanity = 0; *pAtimWin = 0; @@ -269,34 +269,34 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON *pBcastFlag = 0; *pMessageToMe = 0; *pExtRateLen = 0; - *pCkipFlag = 0; // Default of CkipFlag is 0 - *pAironetCellPowerLimit = 0xFF; // Default of AironetCellPowerLimit is 0xFF - *LengthVIE = 0; // Set the length of VIE to init value 0 - *pHtCapabilityLen = 0; // Set the length of VIE to init value 0 + *pCkipFlag = 0; /* Default of CkipFlag is 0 */ + *pAironetCellPowerLimit = 0xFF; /* Default of AironetCellPowerLimit is 0xFF */ + *LengthVIE = 0; /* Set the length of VIE to init value 0 */ + *pHtCapabilityLen = 0; /* Set the length of VIE to init value 0 */ if (pAd->OpMode == OPMODE_STA) - *pPreNHtCapabilityLen = 0; // Set the length of VIE to init value 0 - *AddHtInfoLen = 0; // Set the length of VIE to init value 0 + *pPreNHtCapabilityLen = 0; /* Set the length of VIE to init value 0 */ + *AddHtInfoLen = 0; /* Set the length of VIE to init value 0 */ *pRalinkIe = 0; *pNewChannel = 0; - *NewExtChannelOffset = 0xff; //Default 0xff means no such IE - pCfParm->bValid = FALSE; // default: no IE_CF found - pQbssLoad->bValid = FALSE; // default: no IE_QBSS_LOAD found - pEdcaParm->bValid = FALSE; // default: no IE_EDCA_PARAMETER found - pQosCapability->bValid = FALSE; // default: no IE_QOS_CAPABILITY found + *NewExtChannelOffset = 0xff; /*Default 0xff means no such IE */ + pCfParm->bValid = FALSE; /* default: no IE_CF found */ + pQbssLoad->bValid = FALSE; /* default: no IE_QBSS_LOAD found */ + pEdcaParm->bValid = FALSE; /* default: no IE_EDCA_PARAMETER found */ + pQosCapability->bValid = FALSE; /* default: no IE_QOS_CAPABILITY found */ pFrame = (PFRAME_802_11) Msg; - // get subtype from header + /* get subtype from header */ SubType = (UCHAR) pFrame->Hdr.FC.SubType; - // get Addr2 and BSSID from header + /* get Addr2 and BSSID from header */ COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); COPY_MAC_ADDR(pBssid, pFrame->Hdr.Addr3); Ptr = pFrame->Octet; Length += LENGTH_802_11; - // get timestamp from payload and advance the pointer + /* get timestamp from payload and advance the pointer */ NdisMoveMemory(pTimestamp, Ptr, TIMESTAMP_LEN); pTimestamp->u.LowPart = cpu2le32(pTimestamp->u.LowPart); @@ -305,12 +305,12 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON Ptr += TIMESTAMP_LEN; Length += TIMESTAMP_LEN; - // get beacon interval from payload and advance the pointer + /* get beacon interval from payload and advance the pointer */ NdisMoveMemory(pBeaconPeriod, Ptr, 2); Ptr += 2; Length += 2; - // get capability info from payload and advance the pointer + /* get capability info from payload and advance the pointer */ NdisMoveMemory(pCapabilityInfo, Ptr, 2); Ptr += 2; Length += 2; @@ -322,11 +322,11 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON pEid = (PEID_STRUCT) Ptr; - // get variable fields from payload and advance the pointer + /* get variable fields from payload and advance the pointer */ while ((Length + 2 + pEid->Len) <= MsgLen) { - // - // Secure copy VIE to VarIE[MAX_VIE_LEN] didn't overflow. - // + /* */ + /* Secure copy VIE to VarIE[MAX_VIE_LEN] didn't overflow. */ + /* */ if ((*LengthVIE + pEid->Len + 2) >= MAX_VIE_LEN) { DBGPRINT(RT_DEBUG_WARN, ("PeerBeaconAndProbeRspSanity - Variable IEs out of resource [len(=%d) > MAX_VIE_LEN(=%d)]\n", @@ -336,7 +336,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON switch (pEid->Eid) { case IE_SSID: - // Already has one SSID EID in this beacon, ignore the second one + /* Already has one SSID EID in this beacon, ignore the second one */ if (Sanity & 0x1) break; if (pEid->Len <= MAX_LEN_OF_SSID) { @@ -357,11 +357,11 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON NdisMoveMemory(SupRate, pEid->Octet, pEid->Len); *pSupRateLen = pEid->Len; - // TODO: 2004-09-14 not a good design here, cause it exclude extra rates - // from ScanTab. We should report as is. And filter out unsupported - // rates in MlmeAux. - // Check against the supported rates - // RTMPCheckRates(pAd, SupRate, pSupRateLen); + /* TODO: 2004-09-14 not a good design here, cause it exclude extra rates */ + /* from ScanTab. We should report as is. And filter out unsupported */ + /* rates in MlmeAux. */ + /* Check against the supported rates */ + /* RTMPCheckRates(pAd, SupRate, pSupRateLen); */ } else { DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAndProbeRspSanity - wrong IE_SUPP_RATES (len=%d)\n", @@ -371,11 +371,11 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON break; case IE_HT_CAP: - if (pEid->Len >= SIZE_HT_CAP_IE) //Note: allow extension.!! + if (pEid->Len >= SIZE_HT_CAP_IE) /*Note: allow extension.!! */ { NdisMoveMemory(pHtCapability, pEid->Octet, sizeof(HT_CAPABILITY_IE)); - *pHtCapabilityLen = SIZE_HT_CAP_IE; // Nnow we only support 26 bytes. + *pHtCapabilityLen = SIZE_HT_CAP_IE; /* Nnow we only support 26 bytes. */ *(USHORT *) (&pHtCapability->HtCapInfo) = cpu2le16(*(USHORT *) @@ -385,7 +385,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON (&pHtCapability->ExtHtCapInfo)); { - *pPreNHtCapabilityLen = 0; // Nnow we only support 26 bytes. + *pPreNHtCapabilityLen = 0; /* Nnow we only support 26 bytes. */ Ptr = (PUCHAR) pVIE; NdisMoveMemory(Ptr + *LengthVIE, @@ -402,8 +402,8 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON break; case IE_ADD_HT: if (pEid->Len >= sizeof(ADD_HT_INFO_IE)) { - // This IE allows extension, but we can ignore extra bytes beyond our knowledge , so only - // copy first sizeof(ADD_HT_INFO_IE) + /* This IE allows extension, but we can ignore extra bytes beyond our knowledge , so only */ + /* copy first sizeof(ADD_HT_INFO_IE) */ NdisMoveMemory(AddHtInfo, pEid->Octet, sizeof(ADD_HT_INFO_IE)); *AddHtInfoLen = SIZE_ADD_HT_INFO_IE; @@ -500,17 +500,17 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON break; case IE_CHANNEL_SWITCH_ANNOUNCEMENT: if (pEid->Len == 3) { - *pNewChannel = pEid->Octet[1]; //extract new channel number + *pNewChannel = pEid->Octet[1]; /*extract new channel number */ } break; - // New for WPA - // CCX v2 has the same IE, we need to parse that too - // Wifi WMM use the same IE vale, need to parse that too - // case IE_WPA: + /* New for WPA */ + /* CCX v2 has the same IE, we need to parse that too */ + /* Wifi WMM use the same IE vale, need to parse that too */ + /* case IE_WPA: */ case IE_VENDOR_SPECIFIC: - // Check Broadcom/Atheros 802.11n OUI version, for HT Capability IE. - // This HT IE is before IEEE draft set HT IE value.2006-09-28 by Jan. + /* Check Broadcom/Atheros 802.11n OUI version, for HT Capability IE. */ + /* This HT IE is before IEEE draft set HT IE value.2006-09-28 by Jan. */ /*if (NdisEqualMemory(pEid->Octet, BROADCOM_OUI, 3) && (pEid->Len >= 4)) { if ((pEid->Octet[3] == OUI_BROADCOM_HT) && (pEid->Len >= 30)) @@ -529,19 +529,19 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON } } */ - // Check the OUI version, filter out non-standard usage + /* Check the OUI version, filter out non-standard usage */ if (NdisEqualMemory(pEid->Octet, RALINK_OUI, 3) && (pEid->Len == 7)) { - //*pRalinkIe = pEid->Octet[3]; + /**pRalinkIe = pEid->Octet[3]; */ if (pEid->Octet[3] != 0) *pRalinkIe = pEid->Octet[3]; else - *pRalinkIe = 0xf0000000; // Set to non-zero value (can't set bit0-2) to represent this is Ralink Chip. So at linkup, we will set ralinkchip flag. + *pRalinkIe = 0xf0000000; /* Set to non-zero value (can't set bit0-2) to represent this is Ralink Chip. So at linkup, we will set ralinkchip flag. */ } - // This HT IE is before IEEE draft set HT IE value.2006-09-28 by Jan. + /* This HT IE is before IEEE draft set HT IE value.2006-09-28 by Jan. */ - // Other vendors had production before IE_HT_CAP value is assigned. To backward support those old-firmware AP, - // Check broadcom-defiend pre-802.11nD1.0 OUI for HT related IE, including HT Capatilities IE and HT Information IE + /* Other vendors had production before IE_HT_CAP value is assigned. To backward support those old-firmware AP, */ + /* Check broadcom-defiend pre-802.11nD1.0 OUI for HT related IE, including HT Capatilities IE and HT Information IE */ else if ((*pHtCapabilityLen == 0) && NdisEqualMemory(pEid->Octet, PRE_N_HT_OUI, 3) && (pEid->Len >= 4) @@ -564,7 +564,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON *AddHtInfoLen = SIZE_ADD_HT_INFO_IE; } } else if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4)) { - // Copy to pVIE which will report to microsoft bssid list. + /* Copy to pVIE which will report to microsoft bssid list. */ Ptr = (PUCHAR) pVIE; NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid, pEid->Len + 2); @@ -575,39 +575,39 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON PUCHAR ptr; int i; - // parsing EDCA parameters + /* parsing EDCA parameters */ pEdcaParm->bValid = TRUE; - pEdcaParm->bQAck = FALSE; // pEid->Octet[0] & 0x10; - pEdcaParm->bQueueRequest = FALSE; // pEid->Octet[0] & 0x20; - pEdcaParm->bTxopRequest = FALSE; // pEid->Octet[0] & 0x40; + pEdcaParm->bQAck = FALSE; /* pEid->Octet[0] & 0x10; */ + pEdcaParm->bQueueRequest = FALSE; /* pEid->Octet[0] & 0x20; */ + pEdcaParm->bTxopRequest = FALSE; /* pEid->Octet[0] & 0x40; */ pEdcaParm->EdcaUpdateCount = pEid->Octet[6] & 0x0f; pEdcaParm->bAPSDCapable = (pEid->Octet[6] & 0x80) ? 1 : 0; ptr = &pEid->Octet[8]; for (i = 0; i < 4; i++) { - UCHAR aci = (*ptr & 0x60) >> 5; // b5~6 is AC INDEX - pEdcaParm->bACM[aci] = (((*ptr) & 0x10) == 0x10); // b5 is ACM - pEdcaParm->Aifsn[aci] = (*ptr) & 0x0f; // b0~3 is AIFSN - pEdcaParm->Cwmin[aci] = *(ptr + 1) & 0x0f; // b0~4 is Cwmin - pEdcaParm->Cwmax[aci] = *(ptr + 1) >> 4; // b5~8 is Cwmax - pEdcaParm->Txop[aci] = *(ptr + 2) + 256 * (*(ptr + 3)); // in unit of 32-us - ptr += 4; // point to next AC + UCHAR aci = (*ptr & 0x60) >> 5; /* b5~6 is AC INDEX */ + pEdcaParm->bACM[aci] = (((*ptr) & 0x10) == 0x10); /* b5 is ACM */ + pEdcaParm->Aifsn[aci] = (*ptr) & 0x0f; /* b0~3 is AIFSN */ + pEdcaParm->Cwmin[aci] = *(ptr + 1) & 0x0f; /* b0~4 is Cwmin */ + pEdcaParm->Cwmax[aci] = *(ptr + 1) >> 4; /* b5~8 is Cwmax */ + pEdcaParm->Txop[aci] = *(ptr + 2) + 256 * (*(ptr + 3)); /* in unit of 32-us */ + ptr += 4; /* point to next AC */ } } else if (NdisEqualMemory(pEid->Octet, WME_INFO_ELEM, 6) && (pEid->Len == 7)) { - // parsing EDCA parameters + /* parsing EDCA parameters */ pEdcaParm->bValid = TRUE; - pEdcaParm->bQAck = FALSE; // pEid->Octet[0] & 0x10; - pEdcaParm->bQueueRequest = FALSE; // pEid->Octet[0] & 0x20; - pEdcaParm->bTxopRequest = FALSE; // pEid->Octet[0] & 0x40; + pEdcaParm->bQAck = FALSE; /* pEid->Octet[0] & 0x10; */ + pEdcaParm->bQueueRequest = FALSE; /* pEid->Octet[0] & 0x20; */ + pEdcaParm->bTxopRequest = FALSE; /* pEid->Octet[0] & 0x40; */ pEdcaParm->EdcaUpdateCount = pEid->Octet[6] & 0x0f; pEdcaParm->bAPSDCapable = (pEid->Octet[6] & 0x80) ? 1 : 0; - // use default EDCA parameter + /* use default EDCA parameter */ pEdcaParm->bACM[QID_AC_BE] = 0; pEdcaParm->Aifsn[QID_AC_BE] = 3; pEdcaParm->Cwmin[QID_AC_BE] = CW_MIN_IN_BITS; @@ -625,7 +625,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON pEdcaParm->Cwmin[QID_AC_VI] = CW_MIN_IN_BITS - 1; pEdcaParm->Cwmax[QID_AC_VI] = CW_MAX_IN_BITS; - pEdcaParm->Txop[QID_AC_VI] = 96; // AC_VI: 96*32us ~= 3ms + pEdcaParm->Txop[QID_AC_VI] = 96; /* AC_VI: 96*32us ~= 3ms */ pEdcaParm->bACM[QID_AC_VO] = 0; pEdcaParm->Aifsn[QID_AC_VO] = 2; @@ -633,7 +633,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON CW_MIN_IN_BITS - 2; pEdcaParm->Cwmax[QID_AC_VO] = CW_MAX_IN_BITS - 1; - pEdcaParm->Txop[QID_AC_VO] = 48; // AC_VO: 48*32us ~= 1.5ms + pEdcaParm->Txop[QID_AC_VO] = 48; /* AC_VO: 48*32us ~= 1.5ms */ } break; @@ -643,11 +643,11 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON NdisMoveMemory(ExtRate, pEid->Octet, pEid->Len); *pExtRateLen = pEid->Len; - // TODO: 2004-09-14 not a good design here, cause it exclude extra rates - // from ScanTab. We should report as is. And filter out unsupported - // rates in MlmeAux. - // Check against the supported rates - // RTMPCheckRates(pAd, ExtRate, pExtRateLen); + /* TODO: 2004-09-14 not a good design here, cause it exclude extra rates */ + /* from ScanTab. We should report as is. And filter out unsupported */ + /* rates in MlmeAux. */ + /* Check against the supported rates */ + /* RTMPCheckRates(pAd, ExtRate, pExtRateLen); */ } break; @@ -658,32 +658,32 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON break; case IE_AIRONET_CKIP: - // 0. Check Aironet IE length, it must be larger or equal to 28 - // Cisco AP350 used length as 28 - // Cisco AP12XX used length as 30 + /* 0. Check Aironet IE length, it must be larger or equal to 28 */ + /* Cisco AP350 used length as 28 */ + /* Cisco AP12XX used length as 30 */ if (pEid->Len < (CKIP_NEGOTIATION_LENGTH - 2)) break; - // 1. Copy CKIP flag byte to buffer for process + /* 1. Copy CKIP flag byte to buffer for process */ *pCkipFlag = *(pEid->Octet + 8); break; case IE_AP_TX_POWER: - // AP Control of Client Transmit Power - //0. Check Aironet IE length, it must be 6 + /* AP Control of Client Transmit Power */ + /*0. Check Aironet IE length, it must be 6 */ if (pEid->Len != 0x06) break; - // Get cell power limit in dBm + /* Get cell power limit in dBm */ if (NdisEqualMemory(pEid->Octet, CISCO_OUI, 3) == 1) *pAironetCellPowerLimit = *(pEid->Octet + 4); break; - // WPA2 & 802.11i RSN + /* WPA2 & 802.11i RSN */ case IE_RSN: - // There is no OUI for version anymore, check the group cipher OUI before copying + /* There is no OUI for version anymore, check the group cipher OUI before copying */ if (RTMPEqualMemory(pEid->Octet + 2, RSN_OUI, 3)) { - // Copy to pVIE which will report to microsoft bssid list. + /* Copy to pVIE which will report to microsoft bssid list. */ Ptr = (PUCHAR) pVIE; NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid, pEid->Len + 2); @@ -695,11 +695,11 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON break; } - Length = Length + 2 + pEid->Len; // Eid[1] + Len[1]+ content[Len] + Length = Length + 2 + pEid->Len; /* Eid[1] + Len[1]+ content[Len] */ pEid = (PEID_STRUCT) ((UCHAR *) pEid + 2 + pEid->Len); } - // For some 11a AP. it did not have the channel EID, patch here + /* For some 11a AP. it did not have the channel EID, patch here */ { UCHAR LatchRfChannel = MsgChannel; if ((pAd->LatchRfRegs.Channel > 14) && ((Sanity & 0x4) == 0)) { @@ -756,7 +756,7 @@ BOOLEAN MlmeScanReqSanity(IN PRTMP_ADAPTER pAd, } } -// IRQL = DISPATCH_LEVEL +/* IRQL = DISPATCH_LEVEL */ UCHAR ChannelSanity(IN PRTMP_ADAPTER pAd, IN UCHAR channel) { int i; @@ -897,9 +897,9 @@ BOOLEAN MlmeAssocReqSanity(IN PRTMP_ADAPTER pAd, MLME_ASSOC_REQ_STRUCT *pInfo; pInfo = (MLME_ASSOC_REQ_STRUCT *) Msg; - *pTimeout = pInfo->Timeout; // timeout - COPY_MAC_ADDR(pApAddr, pInfo->Addr); // AP address - *pCapabilityInfo = pInfo->CapabilityInfo; // capability info + *pTimeout = pInfo->Timeout; /* timeout */ + COPY_MAC_ADDR(pApAddr, pInfo->Addr); /* AP address */ + *pCapabilityInfo = pInfo->CapabilityInfo; /* capability info */ *pListenIntv = pInfo->ListenIntv; return TRUE; @@ -954,36 +954,36 @@ NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity(IN PBSS_ENTRY pBss) NetWorkType = Ndis802_11DS; if (pBss->Channel <= 14) { - // - // First check support Rate. - // + /* */ + /* First check support Rate. */ + /* */ for (i = 0; i < pBss->SupRateLen; i++) { - rate = pBss->SupRate[i] & 0x7f; // Mask out basic rate set bit + rate = pBss->SupRate[i] & 0x7f; /* Mask out basic rate set bit */ if ((rate == 2) || (rate == 4) || (rate == 11) || (rate == 22)) { continue; } else { - // - // Otherwise (even rate > 108) means Ndis802_11OFDM24 - // + /* */ + /* Otherwise (even rate > 108) means Ndis802_11OFDM24 */ + /* */ NetWorkType = Ndis802_11OFDM24; break; } } - // - // Second check Extend Rate. - // + /* */ + /* Second check Extend Rate. */ + /* */ if (NetWorkType != Ndis802_11OFDM24) { for (i = 0; i < pBss->ExtRateLen; i++) { - rate = pBss->SupRate[i] & 0x7f; // Mask out basic rate set bit + rate = pBss->SupRate[i] & 0x7f; /* Mask out basic rate set bit */ if ((rate == 2) || (rate == 4) || (rate == 11) || (rate == 22)) { continue; } else { - // - // Otherwise (even rate > 108) means Ndis802_11OFDM24 - // + /* */ + /* Otherwise (even rate > 108) means Ndis802_11OFDM24 */ + /* */ NetWorkType = Ndis802_11OFDM24; break; } @@ -1033,22 +1033,22 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, *((USHORT *) & EapolKeyInfo) = cpu2le16(*((USHORT *) & EapolKeyInfo)); - // Choose WPA2 or not + /* Choose WPA2 or not */ if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) || (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) bWPA2 = TRUE; - // 0. Check MsgType + /* 0. Check MsgType */ if ((MsgType > EAPOL_GROUP_MSG_2) || (MsgType < EAPOL_PAIR_MSG_1)) { DBGPRINT(RT_DEBUG_ERROR, ("The message type is invalid(%d)! \n", MsgType)); return FALSE; } - // 1. Replay counter check - if (MsgType == EAPOL_PAIR_MSG_1 || MsgType == EAPOL_PAIR_MSG_3 || MsgType == EAPOL_GROUP_MSG_1) // For supplicant + /* 1. Replay counter check */ + if (MsgType == EAPOL_PAIR_MSG_1 || MsgType == EAPOL_PAIR_MSG_3 || MsgType == EAPOL_GROUP_MSG_1) /* For supplicant */ { - // First validate replay counter, only accept message with larger replay counter. - // Let equal pass, some AP start with all zero replay counter + /* First validate replay counter, only accept message with larger replay counter. */ + /* Let equal pass, some AP start with all zero replay counter */ UCHAR ZeroReplay[LEN_KEY_DESC_REPLAY]; NdisZeroMemory(ZeroReplay, LEN_KEY_DESC_REPLAY); @@ -1061,18 +1061,18 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, LEN_KEY_DESC_REPLAY) != 0)) { bReplayDiff = TRUE; } - } else if (MsgType == EAPOL_PAIR_MSG_2 || MsgType == EAPOL_PAIR_MSG_4 || MsgType == EAPOL_GROUP_MSG_2) // For authenticator + } else if (MsgType == EAPOL_PAIR_MSG_2 || MsgType == EAPOL_PAIR_MSG_4 || MsgType == EAPOL_GROUP_MSG_2) /* For authenticator */ { - // check Replay Counter coresponds to MSG from authenticator, otherwise discard + /* check Replay Counter coresponds to MSG from authenticator, otherwise discard */ if (!NdisEqualMemory (pMsg->KeyDesc.ReplayCounter, pEntry->R_Counter, LEN_KEY_DESC_REPLAY)) { bReplayDiff = TRUE; } } - // Replay Counter different condition + /* Replay Counter different condition */ if (bReplayDiff) { - // send wireless event - for replay counter different + /* send wireless event - for replay counter different */ if (pAd->CommonCfg.bWirelessEvent) RTMPSendWirelessEvent(pAd, IW_REPLAY_COUNTER_DIFF_EVENT_FLAG, @@ -1094,20 +1094,20 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, LEN_KEY_DESC_REPLAY); return FALSE; } - // 2. Verify MIC except Pairwise Msg1 + /* 2. Verify MIC except Pairwise Msg1 */ if (MsgType != EAPOL_PAIR_MSG_1) { UCHAR rcvd_mic[LEN_KEY_DESC_MIC]; - // Record the received MIC for check later + /* Record the received MIC for check later */ NdisMoveMemory(rcvd_mic, pMsg->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); NdisZeroMemory(pMsg->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); - if (EapolKeyInfo.KeyDescVer == DESC_TYPE_TKIP) // TKIP + if (EapolKeyInfo.KeyDescVer == DESC_TYPE_TKIP) /* TKIP */ { HMAC_MD5(pEntry->PTK, LEN_EAP_MICK, (PUCHAR) pMsg, MsgLen, mic, MD5_DIGEST_SIZE); - } else if (EapolKeyInfo.KeyDescVer == DESC_TYPE_AES) // AES + } else if (EapolKeyInfo.KeyDescVer == DESC_TYPE_AES) /* AES */ { HMAC_SHA1(pEntry->PTK, LEN_EAP_MICK, (PUCHAR) pMsg, MsgLen, digest, SHA1_DIGEST_SIZE); @@ -1115,7 +1115,7 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, } if (!NdisEqualMemory(rcvd_mic, mic, LEN_KEY_DESC_MIC)) { - // send wireless event - for MIC different + /* send wireless event - for MIC different */ if (pAd->CommonCfg.bWirelessEvent) RTMPSendWirelessEvent(pAd, IW_MIC_DIFF_EVENT_FLAG, @@ -1138,16 +1138,16 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, return FALSE; } } - // 1. Decrypt the Key Data field if GTK is included. - // 2. Extract the context of the Key Data field if it exist. - // The field in pairwise_msg_2_WPA1(WPA2) & pairwise_msg_3_WPA1 is clear. - // The field in group_msg_1_WPA1(WPA2) & pairwise_msg_3_WPA2 is encrypted. + /* 1. Decrypt the Key Data field if GTK is included. */ + /* 2. Extract the context of the Key Data field if it exist. */ + /* The field in pairwise_msg_2_WPA1(WPA2) & pairwise_msg_3_WPA1 is clear. */ + /* The field in group_msg_1_WPA1(WPA2) & pairwise_msg_3_WPA2 is encrypted. */ if (CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen) > 0) { - // Decrypt this field + /* Decrypt this field */ if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2) || (MsgType == EAPOL_GROUP_MSG_1)) { if ((EapolKeyInfo.KeyDescVer == DESC_TYPE_AES)) { - // AES + /* AES */ AES_GTK_KEY_UNWRAP(&pEntry->PTK[16], KEYDATA, CONV_ARRARY_TO_UINT16(pMsg-> KeyDesc. @@ -1156,17 +1156,17 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, } else { INT i; UCHAR Key[32]; - // Decrypt TKIP GTK - // Construct 32 bytes RC4 Key + /* Decrypt TKIP GTK */ + /* Construct 32 bytes RC4 Key */ NdisMoveMemory(Key, pMsg->KeyDesc.KeyIv, 16); NdisMoveMemory(&Key[16], &pEntry->PTK[16], 16); ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, Key, 32); - //discard first 256 bytes + /*discard first 256 bytes */ for (i = 0; i < 256; i++) ARCFOUR_BYTE(&pAd->PrivateInfo. WEPCONTEXT); - // Decrypt GTK. Becareful, there is no ICV to check the result is correct or not + /* Decrypt GTK. Becareful, there is no ICV to check the result is correct or not */ ARCFOUR_DECRYPT(&pAd->PrivateInfo.WEPCONTEXT, KEYDATA, pMsg->KeyDesc.KeyData, CONV_ARRARY_TO_UINT16(pMsg-> @@ -1187,10 +1187,10 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, return TRUE; } - // Parse Key Data field to - // 1. verify RSN IE for pairwise_msg_2_WPA1(WPA2) ,pairwise_msg_3_WPA1(WPA2) - // 2. verify KDE format for pairwise_msg_3_WPA2, group_msg_1_WPA2 - // 3. update shared key for pairwise_msg_3_WPA2, group_msg_1_WPA1(WPA2) + /* Parse Key Data field to */ + /* 1. verify RSN IE for pairwise_msg_2_WPA1(WPA2) ,pairwise_msg_3_WPA1(WPA2) */ + /* 2. verify KDE format for pairwise_msg_3_WPA2, group_msg_1_WPA2 */ + /* 3. update shared key for pairwise_msg_3_WPA2, group_msg_1_WPA1(WPA2) */ if (!RTMPParseEapolKeyData(pAd, KEYDATA, CONV_ARRARY_TO_UINT16(pMsg->KeyDesc. KeyDataLen), diff --git a/drivers/staging/rt2860/common/cmm_sync.c b/drivers/staging/rt2860/common/cmm_sync.c index 9934a1b712c6..c29e087a41d2 100644 --- a/drivers/staging/rt2860/common/cmm_sync.c +++ b/drivers/staging/rt2860/common/cmm_sync.c @@ -36,27 +36,27 @@ */ #include "../rt_config.h" -// 2.4 Ghz channel plan index in the TxPower arrays. -#define BG_BAND_REGION_0_START 0 // 1,2,3,4,5,6,7,8,9,10,11 +/* 2.4 Ghz channel plan index in the TxPower arrays. */ +#define BG_BAND_REGION_0_START 0 /* 1,2,3,4,5,6,7,8,9,10,11 */ #define BG_BAND_REGION_0_SIZE 11 -#define BG_BAND_REGION_1_START 0 // 1,2,3,4,5,6,7,8,9,10,11,12,13 +#define BG_BAND_REGION_1_START 0 /* 1,2,3,4,5,6,7,8,9,10,11,12,13 */ #define BG_BAND_REGION_1_SIZE 13 -#define BG_BAND_REGION_2_START 9 // 10,11 +#define BG_BAND_REGION_2_START 9 /* 10,11 */ #define BG_BAND_REGION_2_SIZE 2 -#define BG_BAND_REGION_3_START 9 // 10,11,12,13 +#define BG_BAND_REGION_3_START 9 /* 10,11,12,13 */ #define BG_BAND_REGION_3_SIZE 4 -#define BG_BAND_REGION_4_START 13 // 14 +#define BG_BAND_REGION_4_START 13 /* 14 */ #define BG_BAND_REGION_4_SIZE 1 -#define BG_BAND_REGION_5_START 0 // 1,2,3,4,5,6,7,8,9,10,11,12,13,14 +#define BG_BAND_REGION_5_START 0 /* 1,2,3,4,5,6,7,8,9,10,11,12,13,14 */ #define BG_BAND_REGION_5_SIZE 14 -#define BG_BAND_REGION_6_START 2 // 3,4,5,6,7,8,9 +#define BG_BAND_REGION_6_START 2 /* 3,4,5,6,7,8,9 */ #define BG_BAND_REGION_6_SIZE 7 -#define BG_BAND_REGION_7_START 4 // 5,6,7,8,9,10,11,12,13 +#define BG_BAND_REGION_7_START 4 /* 5,6,7,8,9,10,11,12,13 */ #define BG_BAND_REGION_7_SIZE 9 -#define BG_BAND_REGION_31_START 0 // 1,2,3,4,5,6,7,8,9,10,11,12,13,14 +#define BG_BAND_REGION_31_START 0 /* 1,2,3,4,5,6,7,8,9,10,11,12,13,14 */ #define BG_BAND_REGION_31_SIZE 14 -// 5 Ghz channel plan index in the TxPower arrays. +/* 5 Ghz channel plan index in the TxPower arrays. */ UCHAR A_BAND_REGION_0_CHANNEL_LIST[] = { 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165 }; UCHAR A_BAND_REGION_1_CHANNEL_LIST[] = @@ -90,7 +90,7 @@ UCHAR A_BAND_REGION_14_CHANNEL_LIST[] = 153, 157, 161, 165 }; UCHAR A_BAND_REGION_15_CHANNEL_LIST[] = { 149, 153, 157, 161, 165, 169, 173 }; -//BaSizeArray follows the 802.11n definition as MaxRxFactor. 2^(13+factor) bytes. When factor =0, it's about Ba buffer size =8. +/*BaSizeArray follows the 802.11n definition as MaxRxFactor. 2^(13+factor) bytes. When factor =0, it's about Ba buffer size =8. */ UCHAR BaSizeArray[4] = { 8, 16, 32, 64 }; /* @@ -113,76 +113,76 @@ VOID BuildChannelList(IN PRTMP_ADAPTER pAd) NdisZeroMemory(pAd->ChannelList, MAX_NUM_OF_CHANNELS * sizeof(CHANNEL_TX_POWER)); - // if not 11a-only mode, channel list starts from 2.4Ghz band + /* if not 11a-only mode, channel list starts from 2.4Ghz band */ if ((pAd->CommonCfg.PhyMode != PHY_11A) && (pAd->CommonCfg.PhyMode != PHY_11AN_MIXED) && (pAd->CommonCfg.PhyMode != PHY_11N_5G) ) { switch (pAd->CommonCfg.CountryRegion & 0x7f) { - case REGION_0_BG_BAND: // 1 -11 + case REGION_0_BG_BAND: /* 1 -11 */ NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_0_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_0_SIZE); index += BG_BAND_REGION_0_SIZE; break; - case REGION_1_BG_BAND: // 1 - 13 + case REGION_1_BG_BAND: /* 1 - 13 */ NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_1_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_1_SIZE); index += BG_BAND_REGION_1_SIZE; break; - case REGION_2_BG_BAND: // 10 - 11 + case REGION_2_BG_BAND: /* 10 - 11 */ NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_2_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_2_SIZE); index += BG_BAND_REGION_2_SIZE; break; - case REGION_3_BG_BAND: // 10 - 13 + case REGION_3_BG_BAND: /* 10 - 13 */ NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_3_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_3_SIZE); index += BG_BAND_REGION_3_SIZE; break; - case REGION_4_BG_BAND: // 14 + case REGION_4_BG_BAND: /* 14 */ NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_4_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_4_SIZE); index += BG_BAND_REGION_4_SIZE; break; - case REGION_5_BG_BAND: // 1 - 14 + case REGION_5_BG_BAND: /* 1 - 14 */ NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_5_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_5_SIZE); index += BG_BAND_REGION_5_SIZE; break; - case REGION_6_BG_BAND: // 3 - 9 + case REGION_6_BG_BAND: /* 3 - 9 */ NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_6_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_6_SIZE); index += BG_BAND_REGION_6_SIZE; break; - case REGION_7_BG_BAND: // 5 - 13 + case REGION_7_BG_BAND: /* 5 - 13 */ NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_7_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_7_SIZE); index += BG_BAND_REGION_7_SIZE; break; - case REGION_31_BG_BAND: // 1 - 14 + case REGION_31_BG_BAND: /* 1 - 14 */ NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_31_START], sizeof(CHANNEL_TX_POWER) * BG_BAND_REGION_31_SIZE); index += BG_BAND_REGION_31_SIZE; break; - default: // Error. should never happen + default: /* Error. should never happen */ break; } for (i = 0; i < index; i++) @@ -295,7 +295,7 @@ VOID BuildChannelList(IN PRTMP_ADAPTER pAd) sizeof(UCHAR); pChannelList = A_BAND_REGION_15_CHANNEL_LIST; break; - default: // Error. should never happen + default: /* Error. should never happen */ DBGPRINT(RT_DEBUG_WARN, ("countryregion=%d not support", pAd->CommonCfg.CountryRegionForABand)); @@ -411,12 +411,12 @@ UCHAR NextChannel(IN PRTMP_ADAPTER pAd, IN UCHAR channel) VOID ChangeToCellPowerLimit(IN PRTMP_ADAPTER pAd, IN UCHAR AironetCellPowerLimit) { - //valud 0xFF means that hasn't found power limit information - //from the AP's Beacon/Probe response. + /*valud 0xFF means that hasn't found power limit information */ + /*from the AP's Beacon/Probe response. */ if (AironetCellPowerLimit == 0xFF) return; - if (AironetCellPowerLimit < 6) //Used Lowest Power Percentage. + if (AironetCellPowerLimit < 6) /*Used Lowest Power Percentage. */ pAd->CommonCfg.TxPowerPercentage = 6; else if (AironetCellPowerLimit < 9) pAd->CommonCfg.TxPowerPercentage = 10; @@ -427,7 +427,7 @@ VOID ChangeToCellPowerLimit(IN PRTMP_ADAPTER pAd, else if (AironetCellPowerLimit < 15) pAd->CommonCfg.TxPowerPercentage = 75; else - pAd->CommonCfg.TxPowerPercentage = 100; //else used maximum + pAd->CommonCfg.TxPowerPercentage = 100; /*else used maximum */ if (pAd->CommonCfg.TxPowerPercentage > pAd->CommonCfg.TxPowerDefault) pAd->CommonCfg.TxPowerPercentage = @@ -439,7 +439,7 @@ CHAR ConvertToRssi(IN PRTMP_ADAPTER pAd, IN CHAR Rssi, IN UCHAR RssiNumber) { UCHAR RssiOffset, LNAGain; - // Rssi equals to zero should be an invalid value + /* Rssi equals to zero should be an invalid value */ if (Rssi == 0) return -99; @@ -510,11 +510,11 @@ VOID ScanNextChannel(IN PRTMP_ADAPTER pAd) } { - // - // To prevent data lost. - // Send an NULL data with turned PSM bit on to current associated AP before SCAN progress. - // Now, we need to send an NULL data with turned PSM bit off to AP, when scan progress done - // + /* */ + /* To prevent data lost. */ + /* Send an NULL data with turned PSM bit on to current associated AP before SCAN progress. */ + /* Now, we need to send an NULL data with turned PSM bit off to AP, when scan progress done */ + /* */ if (OPSTATUS_TEST_FLAG (pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) && (INFRA_ON(pAd))) { @@ -532,7 +532,7 @@ VOID ScanNextChannel(IN PRTMP_ADAPTER pAd) pHdr80211->FC.PwrMgmt = (pAd->StaCfg.Psm == PWR_SAVE); - // Send using priority queue + /* Send using priority queue */ MiniportMMRequest(pAd, 0, pOutBuffer, sizeof (HEADER_802_11)); @@ -557,14 +557,14 @@ VOID ScanNextChannel(IN PRTMP_ADAPTER pAd) pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; MlmeCntlConfirm(pAd, MT2_SCAN_CONF, MLME_FAIL_NO_RESOURCE); } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ else { { - // BBP and RF are not accessible in PS mode, we has to wake them up first + /* BBP and RF are not accessible in PS mode, we has to wake them up first */ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) AsicForceWakeup(pAd, TRUE); - // leave PSM during scanning. otherwise we may lost ProbeRsp & BEACON + /* leave PSM during scanning. otherwise we may lost ProbeRsp & BEACON */ if (pAd->StaCfg.Psm == PWR_SAVE) RTMP_SET_PSM_BIT(pAd, PWR_ACTIVE); } @@ -584,18 +584,18 @@ VOID ScanNextChannel(IN PRTMP_ADAPTER pAd) } } - //Global country domain(ch1-11:active scan, ch12-14 passive scan) + /*Global country domain(ch1-11:active scan, ch12-14 passive scan) */ if ((pAd->MlmeAux.Channel <= 14) && (pAd->MlmeAux.Channel >= 12) && ((pAd->CommonCfg.CountryRegion & 0x7f) == REGION_31_BG_BAND)) { ScanType = SCAN_PASSIVE; } - // We need to shorten active scan time in order for WZC connect issue - // Chnage the channel scan time for CISCO stuff based on its IAPP announcement + /* We need to shorten active scan time in order for WZC connect issue */ + /* Chnage the channel scan time for CISCO stuff based on its IAPP announcement */ if (ScanType == FAST_SCAN_ACTIVE) RTMPSetTimer(&pAd->MlmeAux.ScanTimer, FAST_ACTIVE_SCAN_TIME); - else // must be SCAN_PASSIVE or SCAN_ACTIVE + else /* must be SCAN_PASSIVE or SCAN_ACTIVE */ { if ((pAd->CommonCfg.PhyMode == PHY_11ABG_MIXED) || (pAd->CommonCfg.PhyMode == PHY_11ABGN_MIXED) @@ -615,7 +615,7 @@ VOID ScanNextChannel(IN PRTMP_ADAPTER pAd) if ((ScanType == SCAN_ACTIVE) || (ScanType == FAST_SCAN_ACTIVE) ) { - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("SYNC - ScanNextChannel() allocate memory fail\n")); @@ -631,7 +631,7 @@ VOID ScanNextChannel(IN PRTMP_ADAPTER pAd) return; } - // There is no need to send broadcast probe request if active scan is in effect. + /* There is no need to send broadcast probe request if active scan is in effect. */ if ((ScanType == SCAN_ACTIVE) || (ScanType == FAST_SCAN_ACTIVE) ) @@ -694,7 +694,7 @@ VOID ScanNextChannel(IN PRTMP_ADAPTER pAd) MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); } - // For SCAN_CISCO_PASSIVE, do nothing and silently wait for beacon or other probe reponse + /* For SCAN_CISCO_PASSIVE, do nothing and silently wait for beacon or other probe reponse */ pAd->Mlme.SyncMachine.CurrState = SCAN_LISTEN; } diff --git a/drivers/staging/rt2860/common/cmm_tkip.c b/drivers/staging/rt2860/common/cmm_tkip.c index b93c3fa73518..97f0543a7a1f 100644 --- a/drivers/staging/rt2860/common/cmm_tkip.c +++ b/drivers/staging/rt2860/common/cmm_tkip.c @@ -37,7 +37,7 @@ #include "../rt_config.h" -// Rotation functions on 32 bit values +/* Rotation functions on 32 bit values */ #define ROL32( A, n ) \ ( ((A) << (n)) | ( ((A)>>(32-(n))) & ( (1UL << (n)) - 1 ) ) ) #define ROR32( A, n ) ROL32( (A), 32-(n) ) @@ -112,9 +112,9 @@ UINT Tkip_Sbox_Upper[256] = { 0x82, 0x29, 0x5A, 0x1E, 0x7B, 0xA8, 0x6D, 0x2C }; -// -// Expanded IV for TKIP function. -// +/* */ +/* Expanded IV for TKIP function. */ +/* */ typedef struct PACKED _IV_CONTROL_ { union PACKED { struct PACKED { @@ -216,10 +216,10 @@ VOID RTMPTkipPutUInt32(IN OUT PUCHAR pDst, IN ULONG val) */ VOID RTMPTkipSetMICKey(IN PTKIP_KEY_INFO pTkip, IN PUCHAR pMICKey) { - // Set the key + /* Set the key */ pTkip->K0 = RTMPTkipGetUInt32(pMICKey); pTkip->K1 = RTMPTkipGetUInt32(pMICKey + 4); - // and reset the message + /* and reset the message */ pTkip->L = pTkip->K0; pTkip->R = pTkip->K1; pTkip->nBytesInM = 0; @@ -247,10 +247,10 @@ VOID RTMPTkipSetMICKey(IN PTKIP_KEY_INFO pTkip, IN PUCHAR pMICKey) */ VOID RTMPTkipAppendByte(IN PTKIP_KEY_INFO pTkip, IN UCHAR uChar) { - // Append the byte to our word-sized buffer + /* Append the byte to our word-sized buffer */ pTkip->M |= (uChar << (8 * pTkip->nBytesInM)); pTkip->nBytesInM++; - // Process the word if it is full. + /* Process the word if it is full. */ if (pTkip->nBytesInM >= 4) { pTkip->L ^= pTkip->M; pTkip->R ^= ROL32(pTkip->L, 17); @@ -263,7 +263,7 @@ VOID RTMPTkipAppendByte(IN PTKIP_KEY_INFO pTkip, IN UCHAR uChar) pTkip->L += pTkip->R; pTkip->R ^= ROR32(pTkip->L, 2); pTkip->L += pTkip->R; - // Clear the buffer + /* Clear the buffer */ pTkip->M = 0; pTkip->nBytesInM = 0; } @@ -291,7 +291,7 @@ VOID RTMPTkipAppendByte(IN PTKIP_KEY_INFO pTkip, IN UCHAR uChar) */ VOID RTMPTkipAppend(IN PTKIP_KEY_INFO pTkip, IN PUCHAR pSrc, IN UINT nBytes) { - // This is simple + /* This is simple */ while (nBytes > 0) { RTMPTkipAppendByte(pTkip, *pSrc++); nBytes--; @@ -318,17 +318,17 @@ VOID RTMPTkipAppend(IN PTKIP_KEY_INFO pTkip, IN PUCHAR pSrc, IN UINT nBytes) */ VOID RTMPTkipGetMIC(IN PTKIP_KEY_INFO pTkip) { - // Append the minimum padding + /* Append the minimum padding */ RTMPTkipAppendByte(pTkip, 0x5a); RTMPTkipAppendByte(pTkip, 0); RTMPTkipAppendByte(pTkip, 0); RTMPTkipAppendByte(pTkip, 0); RTMPTkipAppendByte(pTkip, 0); - // and then zeroes until the length is a multiple of 4 + /* and then zeroes until the length is a multiple of 4 */ while (pTkip->nBytesInM != 0) { RTMPTkipAppendByte(pTkip, 0); } - // The appendByte function has already computed the result. + /* The appendByte function has already computed the result. */ RTMPTkipPutUInt32(pTkip->MIC, pTkip->L); RTMPTkipPutUInt32(pTkip->MIC + 4, pTkip->R); } @@ -364,15 +364,15 @@ VOID RTMPInitTkipEngine(IN PRTMP_ADAPTER pAd, { TKIP_IV tkipIv; - // Prepare 8 bytes TKIP encapsulation for MPDU + /* Prepare 8 bytes TKIP encapsulation for MPDU */ NdisZeroMemory(&tkipIv, sizeof(TKIP_IV)); tkipIv.IV16.field.rc0 = *(pTSC + 1); tkipIv.IV16.field.rc1 = (tkipIv.IV16.field.rc0 | 0x20) & 0x7f; tkipIv.IV16.field.rc2 = *pTSC; - tkipIv.IV16.field.CONTROL.field.ExtIV = 1; // 0: non-extended IV, 1: an extended IV + tkipIv.IV16.field.CONTROL.field.ExtIV = 1; /* 0: non-extended IV, 1: an extended IV */ tkipIv.IV16.field.CONTROL.field.KeyID = KeyId; -// tkipIv.IV32 = *(PULONG)(pTSC + 2); - NdisMoveMemory(&tkipIv.IV32, (pTSC + 2), 4); // Copy IV +/* tkipIv.IV32 = *(PULONG)(pTSC + 2); */ + NdisMoveMemory(&tkipIv.IV32, (pTSC + 2), 4); /* Copy IV */ *pIV16 = tkipIv.IV16.word; *pIV32 = tkipIv.IV32; @@ -406,13 +406,13 @@ VOID RTMPInitMICEngine(IN PRTMP_ADAPTER pAd, { ULONG Priority = UserPriority; - // Init MIC value calculation + /* Init MIC value calculation */ RTMPTkipSetMICKey(&pAd->PrivateInfo.Tx, pMICKey); - // DA + /* DA */ RTMPTkipAppend(&pAd->PrivateInfo.Tx, pDA, MAC_ADDR_LEN); - // SA + /* SA */ RTMPTkipAppend(&pAd->PrivateInfo.Tx, pSA, MAC_ADDR_LEN); - // Priority + 3 bytes of 0 + /* Priority + 3 bytes of 0 */ RTMPTkipAppend(&pAd->PrivateInfo.Tx, (PUCHAR) & Priority, 4); } @@ -450,28 +450,28 @@ BOOLEAN RTMPTkipCompareMICValue(IN PRTMP_ADAPTER pAd, UCHAR OldMic[8]; ULONG Priority = UserPriority; - // Init MIC value calculation + /* Init MIC value calculation */ RTMPTkipSetMICKey(&pAd->PrivateInfo.Rx, pMICKey); - // DA + /* DA */ RTMPTkipAppend(&pAd->PrivateInfo.Rx, pDA, MAC_ADDR_LEN); - // SA + /* SA */ RTMPTkipAppend(&pAd->PrivateInfo.Rx, pSA, MAC_ADDR_LEN); - // Priority + 3 bytes of 0 + /* Priority + 3 bytes of 0 */ RTMPTkipAppend(&pAd->PrivateInfo.Rx, (PUCHAR) & Priority, 4); - // Calculate MIC value from plain text data + /* Calculate MIC value from plain text data */ RTMPTkipAppend(&pAd->PrivateInfo.Rx, pSrc, Len); - // Get MIC valude from received frame + /* Get MIC valude from received frame */ NdisMoveMemory(OldMic, pSrc + Len, 8); - // Get MIC value from decrypted plain data + /* Get MIC value from decrypted plain data */ RTMPTkipGetMIC(&pAd->PrivateInfo.Rx); - // Move MIC value from MSDU, this steps should move to data path. - // Since the MIC value might cross MPDUs. + /* Move MIC value from MSDU, this steps should move to data path. */ + /* Since the MIC value might cross MPDUs. */ if (!NdisEqualMemory(pAd->PrivateInfo.Rx.MIC, OldMic, 8)) { - DBGPRINT_RAW(RT_DEBUG_ERROR, ("RTMPTkipCompareMICValue(): TKIP MIC Error !\n")); //MIC error. + DBGPRINT_RAW(RT_DEBUG_ERROR, ("RTMPTkipCompareMICValue(): TKIP MIC Error !\n")); /*MIC error. */ return (FALSE); } @@ -517,7 +517,7 @@ VOID RTMPCalculateMICValue(IN PRTMP_ADAPTER pAd, UserPriority = RTMP_GET_PACKET_UP(pPacket); pSrc = pSrcBufVA; - // determine if this is a vlan packet + /* determine if this is a vlan packet */ if (((*(pSrc + 12) << 8) + *(pSrc + 13)) == 0x8100) vlan_offset = 4; @@ -528,9 +528,9 @@ VOID RTMPCalculateMICValue(IN PRTMP_ADAPTER pAd, } if (pEncap != NULL) { - // LLC encapsulation + /* LLC encapsulation */ RTMPTkipAppend(&pAd->PrivateInfo.Tx, pEncap, 6); - // Protocol Type + /* Protocol Type */ RTMPTkipAppend(&pAd->PrivateInfo.Tx, pSrc + 12 + vlan_offset, 2); } @@ -541,11 +541,11 @@ VOID RTMPCalculateMICValue(IN PRTMP_ADAPTER pAd, RTMPTkipAppend(&pAd->PrivateInfo.Tx, pSrc, SrcBufLen); } - break; // No need handle next packet + break; /* No need handle next packet */ - } while (TRUE); // End of copying payload + } while (TRUE); /* End of copying payload */ - // Compute the final MIC Value + /* Compute the final MIC Value */ RTMPTkipGetMIC(&pAd->PrivateInfo.Tx); } @@ -694,10 +694,10 @@ VOID RTMPTkipMixKey(UCHAR * key, UCHAR * ta, ULONG pnl, /* Least significant 16 rc4key[15] = (ppk5 >> 8) % 256; } -// -// TRUE: Success! -// FALSE: Decrypt Error! -// +/* */ +/* TRUE: Success! */ +/* FALSE: Decrypt Error! */ +/* */ BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd, IN PUCHAR pData, IN ULONG DataByteCnt, @@ -721,7 +721,7 @@ BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd, UCHAR DA[MAC_ADDR_LEN]; UCHAR SA[MAC_ADDR_LEN]; UCHAR RC4Key[16]; - UINT p1k[5]; //for mix_key; + UINT p1k[5]; /*for mix_key; */ ULONG pnl; /* Least significant 16 bits of PN */ ULONG pnh; /* Most significant 32 bits of PN */ UINT num_blocks; @@ -778,7 +778,7 @@ BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd, if (to_ds == 0 && from_ds == 1) { NdisMoveMemory(DA, pData + 4, MAC_ADDR_LEN); NdisMoveMemory(SA, pData + 16, MAC_ADDR_LEN); - NdisMoveMemory(TA, pData + 10, MAC_ADDR_LEN); //BSSID + NdisMoveMemory(TA, pData + 10, MAC_ADDR_LEN); /*BSSID */ } else if (to_ds == 0 && from_ds == 0) { NdisMoveMemory(TA, pData + 10, MAC_ADDR_LEN); NdisMoveMemory(DA, pData + 4, MAC_ADDR_LEN); @@ -806,11 +806,11 @@ BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd, ARCFOUR_DECRYPT(&ArcFourContext, pData + HeaderLen, pData + HeaderLen + 8, DataByteCnt - HeaderLen - 8); NdisMoveMemory(&trailfcs, pData + DataByteCnt - 8 - 4, 4); - crc32 = RTMP_CALC_FCS32(PPPINITFCS32, pData + HeaderLen, DataByteCnt - HeaderLen - 8 - 4); //Skip IV+EIV 8 bytes & Skip last 4 bytes(FCS). + crc32 = RTMP_CALC_FCS32(PPPINITFCS32, pData + HeaderLen, DataByteCnt - HeaderLen - 8 - 4); /*Skip IV+EIV 8 bytes & Skip last 4 bytes(FCS). */ crc32 ^= 0xffffffff; /* complement */ if (crc32 != cpu2le32(trailfcs)) { - DBGPRINT(RT_DEBUG_TRACE, ("RTMPSoftDecryptTKIP, WEP Data ICV Error !\n")); //ICV error. + DBGPRINT(RT_DEBUG_TRACE, ("RTMPSoftDecryptTKIP, WEP Data ICV Error !\n")); /*ICV error. */ return (FALSE); } @@ -824,10 +824,10 @@ BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd, NdisMoveMemory(MIC, pAd->PrivateInfo.Tx.MIC, 8); if (!NdisEqualMemory(MIC, TrailMIC, 8)) { - DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptTKIP, WEP Data MIC Error !\n")); //MIC error. - //RTMPReportMicError(pAd, &pWpaKey[KeyID]); // marked by AlbertY @ 20060630 + DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptTKIP, WEP Data MIC Error !\n")); /*MIC error. */ + /*RTMPReportMicError(pAd, &pWpaKey[KeyID]); // marked by AlbertY @ 20060630 */ return (FALSE); } - //DBGPRINT(RT_DEBUG_TRACE, "RTMPSoftDecryptTKIP Decript done!!\n"); + /*DBGPRINT(RT_DEBUG_TRACE, "RTMPSoftDecryptTKIP Decript done!!\n"); */ return TRUE; } diff --git a/drivers/staging/rt2860/common/cmm_wep.c b/drivers/staging/rt2860/common/cmm_wep.c index 4f407e94d736..db40139d1fb8 100644 --- a/drivers/staging/rt2860/common/cmm_wep.c +++ b/drivers/staging/rt2860/common/cmm_wep.c @@ -141,25 +141,25 @@ VOID RTMPInitWepEngine(IN PRTMP_ADAPTER pAd, { UINT i; UCHAR WEPKEY[] = { - //IV + /*IV */ 0x00, 0x11, 0x22, - //WEP KEY + /*WEP KEY */ 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC }; - pAd->PrivateInfo.FCSCRC32 = PPPINITFCS32; //Init crc32. + pAd->PrivateInfo.FCSCRC32 = PPPINITFCS32; /*Init crc32. */ { NdisMoveMemory(WEPKEY + 3, pKey, KeyLen); for (i = 0; i < 3; i++) - WEPKEY[i] = RandomByte(pAd); //Call mlme RandomByte() function. - ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, WEPKEY, KeyLen + 3); //INIT SBOX, KEYLEN+3(IV) + WEPKEY[i] = RandomByte(pAd); /*Call mlme RandomByte() function. */ + ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, WEPKEY, KeyLen + 3); /*INIT SBOX, KEYLEN+3(IV) */ - NdisMoveMemory(pDest, WEPKEY, 3); //Append Init Vector + NdisMoveMemory(pDest, WEPKEY, 3); /*Append Init Vector */ } - *(pDest + 3) = (KeyId << 6); //Append KEYID + *(pDest + 3) = (KeyId << 6); /*Append KEYID */ } @@ -219,16 +219,16 @@ BOOLEAN RTMPSoftDecryptWEP(IN PRTMP_ADAPTER pAd, UINT crc32; UCHAR KeyIdx; UCHAR WEPKEY[] = { - //IV + /*IV */ 0x00, 0x11, 0x22, - //WEP KEY + /*WEP KEY */ 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC }; UCHAR *pPayload = (UCHAR *) pData + LENGTH_802_11; ULONG payload_len = DataByteCnt - LENGTH_802_11; - NdisMoveMemory(WEPKEY, pPayload, 3); //Get WEP IV + NdisMoveMemory(WEPKEY, pPayload, 3); /*Get WEP IV */ KeyIdx = (*(pPayload + 3) & 0xc0) >> 6; if (pGroupKey[KeyIdx].KeyLen == 0) @@ -241,11 +241,11 @@ BOOLEAN RTMPSoftDecryptWEP(IN PRTMP_ADAPTER pAd, ARCFOUR_DECRYPT(&pAd->PrivateInfo.WEPCONTEXT, pPayload, pPayload + 4, payload_len - 4); NdisMoveMemory(&trailfcs, pPayload + payload_len - 8, 4); - crc32 = RTMP_CALC_FCS32(PPPINITFCS32, pPayload, payload_len - 8); //Skip last 4 bytes(FCS). + crc32 = RTMP_CALC_FCS32(PPPINITFCS32, pPayload, payload_len - 8); /*Skip last 4 bytes(FCS). */ crc32 ^= 0xffffffff; /* complement */ if (crc32 != cpu2le32(trailfcs)) { - DBGPRINT(RT_DEBUG_TRACE, ("! WEP Data CRC Error !\n")); //CRC error. + DBGPRINT(RT_DEBUG_TRACE, ("! WEP Data CRC Error !\n")); /*CRC error. */ return (FALSE); } return (TRUE); @@ -411,7 +411,7 @@ VOID WPAARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, IN PUCHAR pDest, IN PUCHAR pSrc, IN UINT Len) { UINT i; - //discard first 256 bytes + /*discard first 256 bytes */ for (i = 0; i < 256; i++) ARCFOUR_BYTE(Ctx); diff --git a/drivers/staging/rt2860/common/cmm_wpa.c b/drivers/staging/rt2860/common/cmm_wpa.c index 4d070af7acfc..6940d778985d 100644 --- a/drivers/staging/rt2860/common/cmm_wpa.c +++ b/drivers/staging/rt2860/common/cmm_wpa.c @@ -36,7 +36,7 @@ Paul Lin 03-11-28 Modify for supplicant */ #include "../rt_config.h" -// WPA OUI +/* WPA OUI */ UCHAR OUI_WPA_NONE_AKM[4] = { 0x00, 0x50, 0xF2, 0x00 }; UCHAR OUI_WPA_VERSION[4] = { 0x00, 0x50, 0xF2, 0x01 }; UCHAR OUI_WPA_WEP40[4] = { 0x00, 0x50, 0xF2, 0x01 }; @@ -46,7 +46,7 @@ UCHAR OUI_WPA_WEP104[4] = { 0x00, 0x50, 0xF2, 0x05 }; UCHAR OUI_WPA_8021X_AKM[4] = { 0x00, 0x50, 0xF2, 0x01 }; UCHAR OUI_WPA_PSK_AKM[4] = { 0x00, 0x50, 0xF2, 0x02 }; -// WPA2 OUI +/* WPA2 OUI */ UCHAR OUI_WPA2_WEP40[4] = { 0x00, 0x0F, 0xAC, 0x01 }; UCHAR OUI_WPA2_TKIP[4] = { 0x00, 0x0F, 0xAC, 0x02 }; UCHAR OUI_WPA2_CCMP[4] = { 0x00, 0x0F, 0xAC, 0x04 }; @@ -143,7 +143,7 @@ VOID WpaEAPOLStartAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pHeader = (PHEADER_802_11) Elem->Msg; - //For normaol PSK, we enqueue an EAPOL-Start command to trigger the process. + /*For normaol PSK, we enqueue an EAPOL-Start command to trigger the process. */ if (Elem->MsgLen == 6) pEntry = MacTableLookup(pAd, Elem->Msg); else { @@ -232,41 +232,41 @@ VOID WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ("Key descripter does not match with WPA rule\n")); break; } - // The value 1 shall be used for all EAPOL-Key frames to and from a STA when - // neither the group nor pairwise ciphers are CCMP for Key Descriptor 1. + /* The value 1 shall be used for all EAPOL-Key frames to and from a STA when */ + /* neither the group nor pairwise ciphers are CCMP for Key Descriptor 1. */ if ((pEntry->WepStatus == Ndis802_11Encryption2Enabled) && (peerKeyInfo.KeyDescVer != DESC_TYPE_TKIP)) { DBGPRINT(RT_DEBUG_ERROR, ("Key descripter version not match(TKIP) \n")); break; } - // The value 2 shall be used for all EAPOL-Key frames to and from a STA when - // either the pairwise or the group cipher is AES-CCMP for Key Descriptor 2. + /* The value 2 shall be used for all EAPOL-Key frames to and from a STA when */ + /* either the pairwise or the group cipher is AES-CCMP for Key Descriptor 2. */ else if ((pEntry->WepStatus == Ndis802_11Encryption3Enabled) && (peerKeyInfo.KeyDescVer != DESC_TYPE_AES)) { DBGPRINT(RT_DEBUG_ERROR, ("Key descripter version not match(AES) \n")); break; } - // Check if this STA is in class 3 state and the WPA state is started + /* Check if this STA is in class 3 state and the WPA state is started */ if ((pEntry->Sst == SST_ASSOC) && (pEntry->WpaState >= AS_INITPSK)) { - // Check the Key Ack (bit 7) of the Key Information to determine the Authenticator - // or not. - // An EAPOL-Key frame that is sent by the Supplicant in response to an EAPOL- - // Key frame from the Authenticator must not have the Ack bit set. + /* Check the Key Ack (bit 7) of the Key Information to determine the Authenticator */ + /* or not. */ + /* An EAPOL-Key frame that is sent by the Supplicant in response to an EAPOL- */ + /* Key frame from the Authenticator must not have the Ack bit set. */ if (peerKeyInfo.KeyAck == 1) { - // The frame is snet by Authenticator. - // So the Supplicant side shall handle this. + /* The frame is snet by Authenticator. */ + /* So the Supplicant side shall handle this. */ if ((peerKeyInfo.Secure == 0) && (peerKeyInfo.Request == 0) && (peerKeyInfo.Error == 0) && (peerKeyInfo.KeyType == PAIRWISEKEY)) { - // Process 1. the message 1 of 4-way HS in WPA or WPA2 - // EAPOL-Key(0,0,1,0,P,0,0,ANonce,0,DataKD_M1) - // 2. the message 3 of 4-way HS in WPA - // EAPOL-Key(0,1,1,1,P,0,KeyRSC,ANonce,MIC,DataKD_M3) + /* Process 1. the message 1 of 4-way HS in WPA or WPA2 */ + /* EAPOL-Key(0,0,1,0,P,0,0,ANonce,0,DataKD_M1) */ + /* 2. the message 3 of 4-way HS in WPA */ + /* EAPOL-Key(0,1,1,1,P,0,KeyRSC,ANonce,MIC,DataKD_M3) */ if (peerKeyInfo.KeyMic == 0) PeerPairMsg1Action(pAd, pEntry, Elem); @@ -277,10 +277,10 @@ VOID WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) && (peerKeyInfo.KeyMic == 1) && (peerKeyInfo.Request == 0) && (peerKeyInfo.Error == 0)) { - // Process 1. the message 3 of 4-way HS in WPA2 - // EAPOL-Key(1,1,1,1,P,0,KeyRSC,ANonce,MIC,DataKD_M3) - // 2. the message 1 of group KS in WPA or WPA2 - // EAPOL-Key(1,1,1,0,G,0,Key RSC,0, MIC,GTK[N]) + /* Process 1. the message 3 of 4-way HS in WPA2 */ + /* EAPOL-Key(1,1,1,1,P,0,KeyRSC,ANonce,MIC,DataKD_M3) */ + /* 2. the message 1 of group KS in WPA or WPA2 */ + /* EAPOL-Key(1,1,1,0,G,0,Key RSC,0, MIC,GTK[N]) */ if (peerKeyInfo.KeyType == PAIRWISEKEY) PeerPairMsg3Action(pAd, pEntry, Elem); @@ -289,17 +289,17 @@ VOID WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Elem); } } else { - // The frame is snet by Supplicant. - // So the Authenticator side shall handle this. + /* The frame is snet by Supplicant. */ + /* So the Authenticator side shall handle this. */ if ((peerKeyInfo.Request == 0) && (peerKeyInfo.Error == 0) && (peerKeyInfo.KeyMic == 1)) { if (peerKeyInfo.Secure == 0 && peerKeyInfo.KeyType == PAIRWISEKEY) { - // EAPOL-Key(0,1,0,0,P,0,0,SNonce,MIC,Data) - // Process 1. message 2 of 4-way HS in WPA or WPA2 - // 2. message 4 of 4-way HS in WPA + /* EAPOL-Key(0,1,0,0,P,0,0,SNonce,MIC,Data) */ + /* Process 1. message 2 of 4-way HS in WPA or WPA2 */ + /* 2. message 4 of 4-way HS in WPA */ if (CONV_ARRARY_TO_UINT16 (pEapol_packet->KeyDesc. KeyDataLen) == 0) { @@ -314,15 +314,15 @@ VOID WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } else if (peerKeyInfo.Secure == 1 && peerKeyInfo.KeyType == PAIRWISEKEY) { - // EAPOL-Key(1,1,0,0,P,0,0,0,MIC,0) - // Process message 4 of 4-way HS in WPA2 + /* EAPOL-Key(1,1,0,0,P,0,0,0,MIC,0) */ + /* Process message 4 of 4-way HS in WPA2 */ PeerPairMsg4Action(pAd, pEntry, Elem); } else if (peerKeyInfo.Secure == 1 && peerKeyInfo.KeyType == GROUPKEY) { - // EAPOL-Key(1,1,0,0,G,0,0,0,MIC,0) - // Process message 2 of Group key HS in WPA or WPA2 + /* EAPOL-Key(1,1,0,0,G,0,0,0,MIC,0) */ + /* Process message 2 of Group key HS in WPA or WPA2 */ PeerGroupMsg2Action(pAd, pEntry, &Elem-> Msg @@ -370,7 +370,7 @@ VOID RTMPToWirelessSta(IN PRTMP_ADAPTER pAd, return; do { - // build a NDIS packet + /* build a NDIS packet */ Status = RTMPAllocateNdisPacket(pAd, &pPacket, pHeader802_3, HdrLen, pData, DataLen); @@ -384,7 +384,7 @@ VOID RTMPToWirelessSta(IN PRTMP_ADAPTER pAd, { RTMP_SET_PACKET_SOURCE(pPacket, PKTSRC_NDIS); - RTMP_SET_PACKET_NET_DEVICE_MBSSID(pPacket, MAIN_MBSSID); // set a default value + RTMP_SET_PACKET_NET_DEVICE_MBSSID(pPacket, MAIN_MBSSID); /* set a default value */ if (pEntry->apidx != 0) RTMP_SET_PACKET_NET_DEVICE_MBSSID(pPacket, pEntry-> @@ -395,16 +395,16 @@ VOID RTMPToWirelessSta(IN PRTMP_ADAPTER pAd, } { - // send out the packet + /* send out the packet */ Status = STASendPacket(pAd, pPacket); if (Status == NDIS_STATUS_SUCCESS) { UCHAR Index; - // Dequeue one frame from TxSwQueue0..3 queue and process it - // There are three place calling dequeue for TX ring. - // 1. Here, right after queueing the frame. - // 2. At the end of TxRingTxDone service routine. - // 3. Upon NDIS call RTMPSendPackets + /* Dequeue one frame from TxSwQueue0..3 queue and process it */ + /* There are three place calling dequeue for TX ring. */ + /* 1. Here, right after queueing the frame. */ + /* 2. At the end of TxRingTxDone service routine. */ + /* 3. Upon NDIS call RTMPSendPackets */ if ((!RTMP_TEST_FLAG (pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) && @@ -457,30 +457,30 @@ VOID WPAStart4WayHS(IN PRTMP_ADAPTER pAd, ("[ERROR]WPAStart4WayHS : No corresponding Authenticator.\n")); return; } - // Check the status + /* Check the status */ if ((pEntry->WpaState > AS_PTKSTART) || (pEntry->WpaState < AS_INITPMK)) { DBGPRINT(RT_DEBUG_ERROR, ("[ERROR]WPAStart4WayHS : Not expect calling\n")); return; } - // Increment replay counter by 1 + /* Increment replay counter by 1 */ ADD_ONE_To_64BIT_VAR(pEntry->R_Counter); - // Randomly generate ANonce + /* Randomly generate ANonce */ GenRandom(pAd, (UCHAR *) pBssid, pEntry->ANonce); - // Construct EAPoL message - Pairwise Msg 1 - // EAPOL-Key(0,0,1,0,P,0,0,ANonce,0,DataKD_M1) + /* Construct EAPoL message - Pairwise Msg 1 */ + /* EAPOL-Key(0,0,1,0,P,0,0,ANonce,0,DataKD_M1) */ NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); - ConstructEapolMsg(pEntry, group_cipher, EAPOL_PAIR_MSG_1, 0, // Default key index - pEntry->ANonce, NULL, // TxRSC - NULL, // GTK - NULL, // RSNIE - 0, // RSNIE length + ConstructEapolMsg(pEntry, group_cipher, EAPOL_PAIR_MSG_1, 0, /* Default key index */ + pEntry->ANonce, NULL, /* TxRSC */ + NULL, /* GTK */ + NULL, /* RSNIE */ + 0, /* RSNIE length */ &EAPOLPKT); - // Make outgoing frame + /* Make outgoing frame */ MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pBssid, EAPOL); RTMPToWirelessSta(pAd, pEntry, Header802_3, LENGTH_802_3, (PUCHAR) & EAPOLPKT, @@ -488,10 +488,10 @@ VOID WPAStart4WayHS(IN PRTMP_ADAPTER pAd, (pEntry->PortSecured == WPA_802_1X_PORT_SECURED) ? FALSE : TRUE); - // Trigger Retry Timer + /* Trigger Retry Timer */ RTMPModTimer(&pEntry->RetryTimer, TimeInterval); - // Update State + /* Update State */ pEntry->WpaState = AS_PTKSTART; DBGPRINT(RT_DEBUG_TRACE, @@ -548,50 +548,50 @@ VOID PeerPairMsg1Action(IN PRTMP_ADAPTER pAd, rsnie_len = pAd->StaCfg.RSNIE_Len; } - // Store the received frame + /* Store the received frame */ pMsg1 = (PEAPOL_PACKET) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; - // Sanity Check peer Pairwise message 1 - Replay Counter + /* Sanity Check peer Pairwise message 1 - Replay Counter */ if (PeerWpaMessageSanity(pAd, pMsg1, MsgLen, EAPOL_PAIR_MSG_1, pEntry) == FALSE) return; - // Store Replay counter, it will use to verify message 3 and construct message 2 + /* Store Replay counter, it will use to verify message 3 and construct message 2 */ NdisMoveMemory(pEntry->R_Counter, pMsg1->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - // Store ANonce + /* Store ANonce */ NdisMoveMemory(pEntry->ANonce, pMsg1->KeyDesc.KeyNonce, LEN_KEY_DESC_NONCE); - // Generate random SNonce + /* Generate random SNonce */ GenRandom(pAd, (UCHAR *) pCurrentAddr, pEntry->SNonce); { - // Calculate PTK(ANonce, SNonce) + /* Calculate PTK(ANonce, SNonce) */ WpaDerivePTK(pAd, pmk_ptr, pEntry->ANonce, pEntry->Addr, pEntry->SNonce, pCurrentAddr, PTK, LEN_PTK); - // Save key to PTK entry + /* Save key to PTK entry */ NdisMoveMemory(pEntry->PTK, PTK, LEN_PTK); } - // Update WpaState + /* Update WpaState */ pEntry->WpaState = AS_PTKINIT_NEGOTIATING; - // Construct EAPoL message - Pairwise Msg 2 - // EAPOL-Key(0,1,0,0,P,0,0,SNonce,MIC,DataKD_M2) + /* Construct EAPoL message - Pairwise Msg 2 */ + /* EAPOL-Key(0,1,0,0,P,0,0,SNonce,MIC,DataKD_M2) */ NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); - ConstructEapolMsg(pEntry, group_cipher, EAPOL_PAIR_MSG_2, 0, // DefaultKeyIdx - pEntry->SNonce, NULL, // TxRsc - NULL, // GTK + ConstructEapolMsg(pEntry, group_cipher, EAPOL_PAIR_MSG_2, 0, /* DefaultKeyIdx */ + pEntry->SNonce, NULL, /* TxRsc */ + NULL, /* GTK */ (UCHAR *) rsnie_ptr, rsnie_len, &EAPOLPKT); - // Make outgoing frame + /* Make outgoing frame */ MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pCurrentAddr, EAPOL); RTMPToWirelessSta(pAd, pEntry, @@ -638,46 +638,46 @@ VOID PeerPairMsg2Action(IN PRTMP_ADAPTER pAd, sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) return; - // check Entry in valid State + /* check Entry in valid State */ if (pEntry->WpaState < AS_PTKSTART) return; - // pointer to 802.11 header + /* pointer to 802.11 header */ pHeader = (PHEADER_802_11) Elem->Msg; - // skip 802.11_header(24-byte) and LLC_header(8) + /* skip 802.11_header(24-byte) and LLC_header(8) */ pMsg2 = (PEAPOL_PACKET) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; - // Store SNonce + /* Store SNonce */ NdisMoveMemory(pEntry->SNonce, pMsg2->KeyDesc.KeyNonce, LEN_KEY_DESC_NONCE); { - // Derive PTK - WpaDerivePTK(pAd, (UCHAR *) pmk_ptr, pEntry->ANonce, // ANONCE - (UCHAR *) pBssid, pEntry->SNonce, // SNONCE + /* Derive PTK */ + WpaDerivePTK(pAd, (UCHAR *) pmk_ptr, pEntry->ANonce, /* ANONCE */ + (UCHAR *) pBssid, pEntry->SNonce, /* SNONCE */ pEntry->Addr, PTK, LEN_PTK); NdisMoveMemory(pEntry->PTK, PTK, LEN_PTK); } - // Sanity Check peer Pairwise message 2 - Replay Counter, MIC, RSNIE + /* Sanity Check peer Pairwise message 2 - Replay Counter, MIC, RSNIE */ if (PeerWpaMessageSanity(pAd, pMsg2, MsgLen, EAPOL_PAIR_MSG_2, pEntry) == FALSE) return; do { - // delete retry timer + /* delete retry timer */ RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); - // Change state + /* Change state */ pEntry->WpaState = AS_PTKINIT_NEGOTIATING; - // Increment replay counter by 1 + /* Increment replay counter by 1 */ ADD_ONE_To_64BIT_VAR(pEntry->R_Counter); - // Construct EAPoL message - Pairwise Msg 3 + /* Construct EAPoL message - Pairwise Msg 3 */ NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); ConstructEapolMsg(pEntry, group_cipher, @@ -688,7 +688,7 @@ VOID PeerPairMsg2Action(IN PRTMP_ADAPTER pAd, (UCHAR *) gtk_ptr, (UCHAR *) rsnie_ptr, rsnie_len, &EAPOLPKT); - // Make outgoing frame + /* Make outgoing frame */ MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pBssid, EAPOL); RTMPToWirelessSta(pAd, pEntry, Header802_3, LENGTH_802_3, (PUCHAR) & EAPOLPKT, @@ -699,7 +699,7 @@ VOID PeerPairMsg2Action(IN PRTMP_ADAPTER pAd, pEntry->ReTryCounter = PEER_MSG3_RETRY_TIMER_CTR; RTMPSetTimer(&pEntry->RetryTimer, PEER_MSG3_RETRY_EXEC_INTV); - // Update State + /* Update State */ pEntry->WpaState = AS_PTKINIT_NEGOTIATING; } while (FALSE); @@ -751,38 +751,38 @@ VOID PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, } - // Record 802.11 header & the received EAPOL packet Msg3 + /* Record 802.11 header & the received EAPOL packet Msg3 */ pHeader = (PHEADER_802_11) Elem->Msg; pMsg3 = (PEAPOL_PACKET) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; - // Sanity Check peer Pairwise message 3 - Replay Counter, MIC, RSNIE + /* Sanity Check peer Pairwise message 3 - Replay Counter, MIC, RSNIE */ if (PeerWpaMessageSanity(pAd, pMsg3, MsgLen, EAPOL_PAIR_MSG_3, pEntry) == FALSE) return; - // Save Replay counter, it will use construct message 4 + /* Save Replay counter, it will use construct message 4 */ NdisMoveMemory(pEntry->R_Counter, pMsg3->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - // Double check ANonce + /* Double check ANonce */ if (!NdisEqualMemory (pEntry->ANonce, pMsg3->KeyDesc.KeyNonce, LEN_KEY_DESC_NONCE)) { return; } - // Construct EAPoL message - Pairwise Msg 4 + /* Construct EAPoL message - Pairwise Msg 4 */ NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); - ConstructEapolMsg(pEntry, group_cipher, EAPOL_PAIR_MSG_4, 0, // group key index not used in message 4 - NULL, // Nonce not used in message 4 - NULL, // TxRSC not used in message 4 - NULL, // GTK not used in message 4 - NULL, // RSN IE not used in message 4 + ConstructEapolMsg(pEntry, group_cipher, EAPOL_PAIR_MSG_4, 0, /* group key index not used in message 4 */ + NULL, /* Nonce not used in message 4 */ + NULL, /* TxRSC not used in message 4 */ + NULL, /* GTK not used in message 4 */ + NULL, /* RSN IE not used in message 4 */ 0, &EAPOLPKT); - // Update WpaState + /* Update WpaState */ pEntry->WpaState = AS_PTKINITDONE; - // Update pairwise key + /* Update pairwise key */ { PCIPHER_KEY pSharedKey; @@ -790,7 +790,7 @@ VOID PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, NdisMoveMemory(pAd->StaCfg.PTK, pEntry->PTK, LEN_PTK); - // Prepare pair-wise key information into shared key table + /* Prepare pair-wise key information into shared key table */ NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); pSharedKey->KeyLen = LEN_TKIP_EK; NdisMoveMemory(pSharedKey->Key, &pAd->StaCfg.PTK[32], @@ -801,7 +801,7 @@ VOID PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, &pAd->StaCfg.PTK[48 + LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); - // Decide its ChiperAlg + /* Decide its ChiperAlg */ if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) pSharedKey->CipherAlg = CIPHER_TKIP; else if (pAd->StaCfg.PairCipher == Ndis802_11Encryption3Enabled) @@ -809,7 +809,7 @@ VOID PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, else pSharedKey->CipherAlg = CIPHER_NONE; - // Update these related information to MAC_TABLE_ENTRY + /* Update these related information to MAC_TABLE_ENTRY */ pEntry = &pAd->MacTab.Content[BSSID_WCID]; NdisMoveMemory(pEntry->PairwiseKey.Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); @@ -820,7 +820,7 @@ VOID PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, LEN_TKIP_TXMICK); pEntry->PairwiseKey.CipherAlg = pSharedKey->CipherAlg; - // Update pairwise key information to ASIC Shared Key Table + /* Update pairwise key information to ASIC Shared Key Table */ AsicAddSharedKeyEntry(pAd, BSS0, 0, @@ -828,21 +828,21 @@ VOID PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, pSharedKey->Key, pSharedKey->TxMic, pSharedKey->RxMic); - // Update ASIC WCID attribute table and IVEIV table + /* Update ASIC WCID attribute table and IVEIV table */ RTMPAddWcidAttributeEntry(pAd, BSS0, 0, pSharedKey->CipherAlg, pEntry); } - // open 802.1x port control and privacy filter + /* open 802.1x port control and privacy filter */ if (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK || pEntry->AuthMode == Ndis802_11AuthModeWPA2) { pEntry->PortSecured = WPA_802_1X_PORT_SECURED; pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; STA_PORT_SECURED(pAd); - // Indicate Connected for GUI + /* Indicate Connected for GUI */ pAd->IndicateMediaState = NdisMediaStateConnected; DBGPRINT(RT_DEBUG_TRACE, ("PeerPairMsg3Action: AuthMode(%s) PairwiseCipher(%s) GroupCipher(%s) \n", @@ -852,7 +852,7 @@ VOID PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, } else { } - // Init 802.3 header and send out + /* Init 802.3 header and send out */ MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pCurrentAddr, EAPOL); RTMPToWirelessSta(pAd, pEntry, Header802_3, sizeof(Header802_3), @@ -894,23 +894,23 @@ VOID PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, if (pEntry->WpaState < AS_PTKINIT_NEGOTIATING) break; - // pointer to 802.11 header + /* pointer to 802.11 header */ pHeader = (PHEADER_802_11) Elem->Msg; - // skip 802.11_header(24-byte) and LLC_header(8) + /* skip 802.11_header(24-byte) and LLC_header(8) */ pMsg4 = (PEAPOL_PACKET) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; - // Sanity Check peer Pairwise message 4 - Replay Counter, MIC + /* Sanity Check peer Pairwise message 4 - Replay Counter, MIC */ if (PeerWpaMessageSanity (pAd, pMsg4, MsgLen, EAPOL_PAIR_MSG_4, pEntry) == FALSE) break; - // 3. uses the MLME.SETKEYS.request to configure PTK into MAC + /* 3. uses the MLME.SETKEYS.request to configure PTK into MAC */ NdisZeroMemory(&pEntry->PairwiseKey, sizeof(CIPHER_KEY)); - // reset IVEIV in Asic + /* reset IVEIV in Asic */ AsicUpdateWCIDIVEIV(pAd, pEntry->Aid, 1, 0); pEntry->PairwiseKey.KeyLen = LEN_TKIP_EK; @@ -923,7 +923,7 @@ VOID PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, &pEntry->PTK[TKIP_AP_TXMICK_OFFSET], LEN_TKIP_TXMICK); - // Set pairwise key to Asic + /* Set pairwise key to Asic */ { pEntry->PairwiseKey.CipherAlg = CIPHER_NONE; if (pEntry->WepStatus == Ndis802_11Encryption2Enabled) @@ -932,13 +932,13 @@ VOID PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, Ndis802_11Encryption3Enabled) pEntry->PairwiseKey.CipherAlg = CIPHER_AES; - // Add Pair-wise key to Asic + /* Add Pair-wise key to Asic */ AsicAddPairwiseKeyEntry(pAd, pEntry->Addr, (UCHAR) pEntry->Aid, &pEntry->PairwiseKey); - // update WCID attribute table and IVEIV table for this entry + /* update WCID attribute table and IVEIV table for this entry */ RTMPAddWcidAttributeEntry(pAd, pEntry->apidx, 0, @@ -946,7 +946,7 @@ VOID PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, pEntry); } - // 4. upgrade state + /* 4. upgrade state */ pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; pEntry->WpaState = AS_PTKINITDONE; pEntry->PortSecured = WPA_802_1X_PORT_SECURED; @@ -956,7 +956,7 @@ VOID PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, pEntry->GTKState = REKEY_ESTABLISHED; RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); - // send wireless event - for set key done WPA2 + /* send wireless event - for set key done WPA2 */ if (pAd->CommonCfg.bWirelessEvent) RTMPSendWirelessEvent(pAd, IW_SET_KEY_DONE_WPA2_EVENT_FLAG, @@ -971,7 +971,7 @@ VOID PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, GetEncryptType(pEntry->WepStatus), group_cipher, GetEncryptType(group_cipher))); } else { - // 5. init Group 2-way handshake if necessary. + /* 5. init Group 2-way handshake if necessary. */ WPAStart2WayGroupHS(pAd, pEntry); pEntry->ReTryCounter = GROUP_MSG1_RETRY_TIMER_CTR; @@ -1007,10 +1007,10 @@ VOID WPAStart2WayGroupHS(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) return; do { - // Increment replay counter by 1 + /* Increment replay counter by 1 */ ADD_ONE_To_64BIT_VAR(pEntry->R_Counter); - // Construct EAPoL message - Group Msg 1 + /* Construct EAPoL message - Group Msg 1 */ NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); ConstructEapolMsg(pEntry, group_cipher, @@ -1019,7 +1019,7 @@ VOID WPAStart2WayGroupHS(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) (UCHAR *) gnonce_ptr, TxTsc, (UCHAR *) gtk_ptr, NULL, 0, &EAPOLPKT); - // Make outgoing frame + /* Make outgoing frame */ MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pBssid, EAPOL); RTMPToWirelessSta(pAd, pEntry, Header802_3, LENGTH_802_3, @@ -1075,36 +1075,36 @@ VOID PeerGroupMsg1Action(IN PRTMP_ADAPTER pAd, default_key = pAd->StaCfg.DefaultKeyId; } - // Process Group Message 1 frame. skip 802.11 header(24) & LLC_SNAP header(8) + /* Process Group Message 1 frame. skip 802.11 header(24) & LLC_SNAP header(8) */ pGroup = (PEAPOL_PACKET) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; - // Sanity Check peer group message 1 - Replay Counter, MIC, RSNIE + /* Sanity Check peer group message 1 - Replay Counter, MIC, RSNIE */ if (PeerWpaMessageSanity(pAd, pGroup, MsgLen, EAPOL_GROUP_MSG_1, pEntry) == FALSE) return; - // delete retry timer + /* delete retry timer */ RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); - // Save Replay counter, it will use to construct message 2 + /* Save Replay counter, it will use to construct message 2 */ NdisMoveMemory(pEntry->R_Counter, pGroup->KeyDesc.ReplayCounter, LEN_KEY_DESC_REPLAY); - // Construct EAPoL message - Group Msg 2 + /* Construct EAPoL message - Group Msg 2 */ NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); - ConstructEapolMsg(pEntry, group_cipher, EAPOL_GROUP_MSG_2, default_key, NULL, // Nonce not used - NULL, // TxRSC not used - NULL, // GTK not used - NULL, // RSN IE not used + ConstructEapolMsg(pEntry, group_cipher, EAPOL_GROUP_MSG_2, default_key, NULL, /* Nonce not used */ + NULL, /* TxRSC not used */ + NULL, /* GTK not used */ + NULL, /* RSN IE not used */ 0, &EAPOLPKT); - // open 802.1x port control and privacy filter + /* open 802.1x port control and privacy filter */ pEntry->PortSecured = WPA_802_1X_PORT_SECURED; pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; STA_PORT_SECURED(pAd); - // Indicate Connected for GUI + /* Indicate Connected for GUI */ pAd->IndicateMediaState = NdisMediaStateConnected; DBGPRINT(RT_DEBUG_TRACE, @@ -1113,7 +1113,7 @@ VOID PeerGroupMsg1Action(IN PRTMP_ADAPTER pAd, GetEncryptType(pEntry->WepStatus), GetEncryptType(group_cipher))); - // init header and Fill Packet and send Msg 2 to authenticator + /* init header and Fill Packet and send Msg 2 to authenticator */ MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pCurrentAddr, EAPOL); RTMPToWirelessSta(pAd, pEntry, Header802_3, sizeof(Header802_3), @@ -1159,19 +1159,19 @@ VOID PeerGroupMsg2Action(IN PRTMP_ADAPTER pAd, pMsg2 = (PEAPOL_PACKET) (pData + LENGTH_802_1_H); Len = MsgLen - LENGTH_802_1_H; - // Sanity Check peer group message 2 - Replay Counter, MIC + /* Sanity Check peer group message 2 - Replay Counter, MIC */ if (PeerWpaMessageSanity (pAd, pMsg2, Len, EAPOL_GROUP_MSG_2, pEntry) == FALSE) break; - // 3. upgrade state + /* 3. upgrade state */ RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); pEntry->GTKState = REKEY_ESTABLISHED; if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) || (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) { - // send wireless event - for set key done WPA2 + /* send wireless event - for set key done WPA2 */ if (pAd->CommonCfg.bWirelessEvent) RTMPSendWirelessEvent(pAd, IW_SET_KEY_DONE_WPA2_EVENT_FLAG, @@ -1186,7 +1186,7 @@ VOID PeerGroupMsg2Action(IN PRTMP_ADAPTER pAd, GetEncryptType(pEntry->WepStatus), group_cipher, GetEncryptType(group_cipher))); } else { - // send wireless event - for set key done WPA + /* send wireless event - for set key done WPA */ if (pAd->CommonCfg.bWirelessEvent) RTMPSendWirelessEvent(pAd, IW_SET_KEY_DONE_WPA1_EVENT_FLAG, @@ -1288,36 +1288,36 @@ VOID PRF(IN UCHAR * key, INT currentindex = 0; INT total_len; - // Allocate memory for input + /* Allocate memory for input */ os_alloc_mem(NULL, (PUCHAR *) & input, 1024); if (input == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("!!!PRF: no memory!!!\n")); return; } - // Generate concatenation input + /* Generate concatenation input */ NdisMoveMemory(input, prefix, prefix_len); - // Concatenate a single octet containing 0 + /* Concatenate a single octet containing 0 */ input[prefix_len] = 0; - // Concatenate specific data + /* Concatenate specific data */ NdisMoveMemory(&input[prefix_len + 1], data, data_len); total_len = prefix_len + 1 + data_len; - // Concatenate a single octet containing 0 - // This octet shall be update later + /* Concatenate a single octet containing 0 */ + /* This octet shall be update later */ input[total_len] = 0; total_len++; - // Iterate to calculate the result by hmac-sha-1 - // Then concatenate to last result + /* Iterate to calculate the result by hmac-sha-1 */ + /* Then concatenate to last result */ for (i = 0; i < (len + 19) / 20; i++) { HMAC_SHA1(key, key_len, input, total_len, &output[currentindex], SHA1_DIGEST_SIZE); currentindex += 20; - // update the last octet + /* update the last octet */ input[total_len - 1]++; } os_free_mem(NULL, input); @@ -1342,14 +1342,14 @@ static void F(char *password, unsigned char *ssid, int ssidlength, digest[ssidlength + 1] = (unsigned char)((count >> 16) & 0xff); digest[ssidlength + 2] = (unsigned char)((count >> 8) & 0xff); digest[ssidlength + 3] = (unsigned char)(count & 0xff); - HMAC_SHA1((unsigned char *)password, (int)strlen(password), digest, ssidlength + 4, digest1, SHA1_DIGEST_SIZE); // for WPA update + HMAC_SHA1((unsigned char *)password, (int)strlen(password), digest, ssidlength + 4, digest1, SHA1_DIGEST_SIZE); /* for WPA update */ /* output = U1 */ memcpy(output, digest1, SHA1_DIGEST_SIZE); for (i = 1; i < iterations; i++) { /* Un = PRF(P, Un-1) */ - HMAC_SHA1((unsigned char *)password, (int)strlen(password), digest1, SHA1_DIGEST_SIZE, digest, SHA1_DIGEST_SIZE); // for WPA update + HMAC_SHA1((unsigned char *)password, (int)strlen(password), digest1, SHA1_DIGEST_SIZE, digest, SHA1_DIGEST_SIZE); /* for WPA update */ memcpy(digest1, digest, SHA1_DIGEST_SIZE); /* output = output xor Un */ @@ -1414,40 +1414,40 @@ VOID WpaDerivePTK(IN PRTMP_ADAPTER pAd, 'e', 'x', 'p', 'a', 'n', 's', 'i', 'o', 'n' }; - // initiate the concatenation input + /* initiate the concatenation input */ NdisZeroMemory(temp, sizeof(temp)); NdisZeroMemory(concatenation, 76); - // Get smaller address + /* Get smaller address */ if (RTMPCompareMemory(SA, AA, 6) == 1) NdisMoveMemory(concatenation, AA, 6); else NdisMoveMemory(concatenation, SA, 6); CurrPos += 6; - // Get larger address + /* Get larger address */ if (RTMPCompareMemory(SA, AA, 6) == 1) NdisMoveMemory(&concatenation[CurrPos], SA, 6); else NdisMoveMemory(&concatenation[CurrPos], AA, 6); - // store the larger mac address for backward compatible of - // ralink proprietary STA-key issue + /* store the larger mac address for backward compatible of */ + /* ralink proprietary STA-key issue */ NdisMoveMemory(temp, &concatenation[CurrPos], MAC_ADDR_LEN); CurrPos += 6; - // Get smaller Nonce + /* Get smaller Nonce */ if (RTMPCompareMemory(ANonce, SNonce, 32) == 0) - NdisMoveMemory(&concatenation[CurrPos], temp, 32); // patch for ralink proprietary STA-key issue + NdisMoveMemory(&concatenation[CurrPos], temp, 32); /* patch for ralink proprietary STA-key issue */ else if (RTMPCompareMemory(ANonce, SNonce, 32) == 1) NdisMoveMemory(&concatenation[CurrPos], SNonce, 32); else NdisMoveMemory(&concatenation[CurrPos], ANonce, 32); CurrPos += 32; - // Get larger Nonce + /* Get larger Nonce */ if (RTMPCompareMemory(ANonce, SNonce, 32) == 0) - NdisMoveMemory(&concatenation[CurrPos], temp, 32); // patch for ralink proprietary STA-key issue + NdisMoveMemory(&concatenation[CurrPos], temp, 32); /* patch for ralink proprietary STA-key issue */ else if (RTMPCompareMemory(ANonce, SNonce, 32) == 1) NdisMoveMemory(&concatenation[CurrPos], ANonce, 32); else @@ -1456,7 +1456,7 @@ VOID WpaDerivePTK(IN PRTMP_ADAPTER pAd, hex_dump("concatenation=", concatenation, 76); - // Use PRF to generate PTK + /* Use PRF to generate PTK */ PRF(PMK, LEN_MASTER_KEY, Prefix, 22, concatenation, 76, output, len); } @@ -1487,30 +1487,30 @@ VOID GenRandom(IN PRTMP_ADAPTER pAd, IN UCHAR * macAddr, OUT UCHAR * random) UCHAR prefix[] = { 'I', 'n', 'i', 't', ' ', 'C', 'o', 'u', 'n', 't', 'e', 'r' }; - // Zero the related information + /* Zero the related information */ NdisZeroMemory(result, 80); NdisZeroMemory(local, 80); NdisZeroMemory(KeyCounter, 32); for (i = 0; i < 32; i++) { - // copy the local MAC address + /* copy the local MAC address */ COPY_MAC_ADDR(local, macAddr); curr = MAC_ADDR_LEN; - // concatenate the current time + /* concatenate the current time */ NdisGetSystemUpTime(&CurrentTime); NdisMoveMemory(&local[curr], &CurrentTime, sizeof(CurrentTime)); curr += sizeof(CurrentTime); - // concatenate the last result + /* concatenate the last result */ NdisMoveMemory(&local[curr], result, 32); curr += 32; - // concatenate a variable + /* concatenate a variable */ NdisMoveMemory(&local[curr], &i, 2); curr += 2; - // calculate the result + /* calculate the result */ PRF(KeyCounter, 32, prefix, 12, local, curr, result, 32); } @@ -1548,15 +1548,15 @@ static VOID RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, *rsn_len = 0; - // decide WPA2 or WPA1 + /* decide WPA2 or WPA1 */ if (ElementID == Wpa2Ie) { RSNIE2 *pRsnie_cipher = (RSNIE2 *) pRsnIe; - // Assign the verson as 1 + /* Assign the verson as 1 */ pRsnie_cipher->version = 1; switch (WepStatus) { - // TKIP mode + /* TKIP mode */ case Ndis802_11Encryption2Enabled: NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_TKIP, 4); pRsnie_cipher->ucount = 1; @@ -1565,7 +1565,7 @@ static VOID RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, *rsn_len = sizeof(RSNIE2); break; - // AES mode + /* AES mode */ case Ndis802_11Encryption3Enabled: if (bMixCipher) NdisMoveMemory(pRsnie_cipher->mcast, @@ -1579,16 +1579,16 @@ static VOID RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, *rsn_len = sizeof(RSNIE2); break; - // TKIP-AES mix mode + /* TKIP-AES mix mode */ case Ndis802_11Encryption4Enabled: NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA2_TKIP, 4); PairwiseCnt = 1; - // Insert WPA2 TKIP as the first pairwise cipher + /* Insert WPA2 TKIP as the first pairwise cipher */ if (MIX_CIPHER_WPA2_TKIP_ON(FlexibleCipher)) { NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_TKIP, 4); - // Insert WPA2 AES as the secondary pairwise cipher + /* Insert WPA2 AES as the secondary pairwise cipher */ if (MIX_CIPHER_WPA2_AES_ON(FlexibleCipher)) { NdisMoveMemory(pRsnie_cipher->ucast[0]. oui + 4, OUI_WPA2_CCMP, @@ -1596,7 +1596,7 @@ static VOID RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, PairwiseCnt = 2; } } else { - // Insert WPA2 AES as the first pairwise cipher + /* Insert WPA2 AES as the first pairwise cipher */ NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_CCMP, 4); } @@ -1621,18 +1621,18 @@ static VOID RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, break; } } - // swap for big-endian platform + /* swap for big-endian platform */ pRsnie_cipher->version = cpu2le16(pRsnie_cipher->version); pRsnie_cipher->ucount = cpu2le16(pRsnie_cipher->ucount); } else { RSNIE *pRsnie_cipher = (RSNIE *) pRsnIe; - // Assign OUI and version + /* Assign OUI and version */ NdisMoveMemory(pRsnie_cipher->oui, OUI_WPA_VERSION, 4); pRsnie_cipher->version = 1; switch (WepStatus) { - // TKIP mode + /* TKIP mode */ case Ndis802_11Encryption2Enabled: NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_TKIP, 4); pRsnie_cipher->ucount = 1; @@ -1641,7 +1641,7 @@ static VOID RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, *rsn_len = sizeof(RSNIE); break; - // AES mode + /* AES mode */ case Ndis802_11Encryption3Enabled: if (bMixCipher) NdisMoveMemory(pRsnie_cipher->mcast, @@ -1655,16 +1655,16 @@ static VOID RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, *rsn_len = sizeof(RSNIE); break; - // TKIP-AES mix mode + /* TKIP-AES mix mode */ case Ndis802_11Encryption4Enabled: NdisMoveMemory(pRsnie_cipher->mcast, OUI_WPA_TKIP, 4); PairwiseCnt = 1; - // Insert WPA TKIP as the first pairwise cipher + /* Insert WPA TKIP as the first pairwise cipher */ if (MIX_CIPHER_WPA_TKIP_ON(FlexibleCipher)) { NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_TKIP, 4); - // Insert WPA AES as the secondary pairwise cipher + /* Insert WPA AES as the secondary pairwise cipher */ if (MIX_CIPHER_WPA_AES_ON(FlexibleCipher)) { NdisMoveMemory(pRsnie_cipher->ucast[0]. oui + 4, OUI_WPA_CCMP, @@ -1672,7 +1672,7 @@ static VOID RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, PairwiseCnt = 2; } } else { - // Insert WPA AES as the first pairwise cipher + /* Insert WPA AES as the first pairwise cipher */ NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_CCMP, 4); } @@ -1697,7 +1697,7 @@ static VOID RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, break; } } - // swap for big-endian platform + /* swap for big-endian platform */ pRsnie_cipher->version = cpu2le16(pRsnie_cipher->version); pRsnie_cipher->ucount = cpu2le16(pRsnie_cipher->ucount); } @@ -1729,11 +1729,11 @@ static VOID RTMPMakeRsnIeAKM(IN PRTMP_ADAPTER pAd, OUT PUCHAR pRsnIe, OUT UCHAR * rsn_len) { RSNIE_AUTH *pRsnie_auth; - UCHAR AkmCnt = 1; // default as 1 + UCHAR AkmCnt = 1; /* default as 1 */ pRsnie_auth = (RSNIE_AUTH *) (pRsnIe + (*rsn_len)); - // decide WPA2 or WPA1 + /* decide WPA2 or WPA1 */ if (ElementID == Wpa2Ie) { switch (AuthMode) { @@ -1780,7 +1780,7 @@ static VOID RTMPMakeRsnIeAKM(IN PRTMP_ADAPTER pAd, pRsnie_auth->acount = AkmCnt; pRsnie_auth->acount = cpu2le16(pRsnie_auth->acount); - // update current RSNIE length + /* update current RSNIE length */ (*rsn_len) += (sizeof(RSNIE_AUTH) + (4 * (AkmCnt - 1))); } @@ -1810,7 +1810,7 @@ static VOID RTMPMakeRsnIeCap(IN PRTMP_ADAPTER pAd, { RSN_CAPABILITIES *pRSN_Cap; - // it could be ignored in WPA1 mode + /* it could be ignored in WPA1 mode */ if (ElementID == WpaIe) return; @@ -1818,7 +1818,7 @@ static VOID RTMPMakeRsnIeCap(IN PRTMP_ADAPTER pAd, pRSN_Cap->word = cpu2le16(pRSN_Cap->word); - (*rsn_len) += sizeof(RSN_CAPABILITIES); // update current RSNIE length + (*rsn_len) += sizeof(RSN_CAPABILITIES); /* update current RSNIE length */ } @@ -1843,13 +1843,13 @@ static VOID RTMPMakeRsnIeCap(IN PRTMP_ADAPTER pAd, VOID RTMPMakeRSNIE(IN PRTMP_ADAPTER pAd, IN UINT AuthMode, IN UINT WepStatus, IN UCHAR apidx) { - PUCHAR pRsnIe = NULL; // primary RSNIE - UCHAR *rsnielen_cur_p = 0; // the length of the primary RSNIE - UCHAR *rsnielen_ex_cur_p = 0; // the length of the secondary RSNIE + PUCHAR pRsnIe = NULL; /* primary RSNIE */ + UCHAR *rsnielen_cur_p = 0; /* the length of the primary RSNIE */ + UCHAR *rsnielen_ex_cur_p = 0; /* the length of the secondary RSNIE */ UCHAR PrimaryRsnie; - BOOLEAN bMixCipher = FALSE; // indicate the pairwise and group cipher are different + BOOLEAN bMixCipher = FALSE; /* indicate the pairwise and group cipher are different */ UCHAR p_offset; - WPA_MIX_PAIR_CIPHER FlexibleCipher = WPA_TKIPAES_WPA2_TKIPAES; // it provide the more flexible cipher combination in WPA-WPA2 and TKIPAES mode + WPA_MIX_PAIR_CIPHER FlexibleCipher = WPA_TKIPAES_WPA2_TKIPAES; /* it provide the more flexible cipher combination in WPA-WPA2 and TKIPAES mode */ rsnielen_cur_p = NULL; rsnielen_ex_cur_p = NULL; @@ -1861,8 +1861,8 @@ VOID RTMPMakeRSNIE(IN PRTMP_ADAPTER pAd, if (AuthMode < Ndis802_11AuthModeWPA) return; } else { - // Support WPAPSK or WPA2PSK in STA-Infra mode - // Support WPANone in STA-Adhoc mode + /* Support WPAPSK or WPA2PSK in STA-Infra mode */ + /* Support WPANone in STA-Adhoc mode */ if ((AuthMode != Ndis802_11AuthModeWPAPSK) && (AuthMode != Ndis802_11AuthModeWPA2PSK) && (AuthMode != Ndis802_11AuthModeWPANone) @@ -1872,11 +1872,11 @@ VOID RTMPMakeRSNIE(IN PRTMP_ADAPTER pAd, DBGPRINT(RT_DEBUG_TRACE, ("==> RTMPMakeRSNIE(STA)\n")); - // Zero RSNIE context + /* Zero RSNIE context */ pAd->StaCfg.RSNIE_Len = 0; NdisZeroMemory(pAd->StaCfg.RSN_IE, MAX_LEN_OF_RSNIE); - // Pointer to RSNIE + /* Pointer to RSNIE */ rsnielen_cur_p = &pAd->StaCfg.RSNIE_Len; pRsnIe = pAd->StaCfg.RSN_IE; @@ -1884,7 +1884,7 @@ VOID RTMPMakeRSNIE(IN PRTMP_ADAPTER pAd, } } - // indicate primary RSNIE as WPA or WPA2 + /* indicate primary RSNIE as WPA or WPA2 */ if ((AuthMode == Ndis802_11AuthModeWPA) || (AuthMode == Ndis802_11AuthModeWPAPSK) || (AuthMode == Ndis802_11AuthModeWPANone) || @@ -1895,20 +1895,20 @@ VOID RTMPMakeRSNIE(IN PRTMP_ADAPTER pAd, PrimaryRsnie = Wpa2Ie; { - // Build the primary RSNIE - // 1. insert cipher suite + /* Build the primary RSNIE */ + /* 1. insert cipher suite */ RTMPMakeRsnIeCipher(pAd, PrimaryRsnie, WepStatus, bMixCipher, FlexibleCipher, pRsnIe, &p_offset); - // 2. insert AKM + /* 2. insert AKM */ RTMPMakeRsnIeAKM(pAd, PrimaryRsnie, AuthMode, apidx, pRsnIe, &p_offset); - // 3. insert capability + /* 3. insert capability */ RTMPMakeRsnIeCap(pAd, PrimaryRsnie, apidx, pRsnIe, &p_offset); } - // 4. update the RSNIE length + /* 4. update the RSNIE length */ *rsnielen_cur_p = p_offset; hex_dump("The primary RSNIE", pRsnIe, (*rsnielen_cur_p)); @@ -1943,13 +1943,13 @@ BOOLEAN RTMPCheckWPAframe(IN PRTMP_ADAPTER pAd, if (DataByteCount < (LENGTH_802_1_H + LENGTH_EAPOL_H)) return FALSE; - // Skip LLC header + /* Skip LLC header */ if (NdisEqualMemory(SNAP_802_1H, pData, 6) || - // Cisco 1200 AP may send packet with SNAP_BRIDGE_TUNNEL + /* Cisco 1200 AP may send packet with SNAP_BRIDGE_TUNNEL */ NdisEqualMemory(SNAP_BRIDGE_TUNNEL, pData, 6)) { pData += 6; } - // Skip 2-bytes EAPoL type + /* Skip 2-bytes EAPoL type */ if (NdisEqualMemory(EAPOL, pData, 2)) { pData += 2; } else @@ -2060,7 +2060,7 @@ BOOLEAN RTMPCheckRSNIE(IN PRTMP_ADAPTER pAd, while (len > sizeof(RSNIE2)) { pEid = (PEID_STRUCT) pVIE; - // WPA RSN IE + /* WPA RSN IE */ if ((pEid->Eid == IE_WPA) && (NdisEqualMemory(pEid->Octet, WPA_OUI, 4))) { if ((pEntry->AuthMode == Ndis802_11AuthModeWPA @@ -2074,7 +2074,7 @@ BOOLEAN RTMPCheckRSNIE(IN PRTMP_ADAPTER pAd, *Offset += (pEid->Len + 2); } - // WPA2 RSN IE + /* WPA2 RSN IE */ else if ((pEid->Eid == IE_RSN) && (NdisEqualMemory(pEid->Octet + 2, RSN_OUI, 3))) { if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2 @@ -2132,12 +2132,12 @@ BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, UCHAR DefaultIdx = 0; UCHAR skip_offset; - // Verify The RSN IE contained in pairewise_msg_2 && pairewise_msg_3 and skip it + /* Verify The RSN IE contained in pairewise_msg_2 && pairewise_msg_3 and skip it */ if (MsgType == EAPOL_PAIR_MSG_2 || MsgType == EAPOL_PAIR_MSG_3) { - // Check RSN IE whether it is WPA2/WPA2PSK + /* Check RSN IE whether it is WPA2/WPA2PSK */ if (!RTMPCheckRSNIE (pAd, pKeyData, KeyDataLen, pEntry, &skip_offset)) { - // send wireless event - for RSN IE different + /* send wireless event - for RSN IE different */ if (pAd->CommonCfg.bWirelessEvent) RTMPSendWirelessEvent(pAd, IW_RSNIE_DIFF_EVENT_FLAG, @@ -2156,7 +2156,7 @@ BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, if (bWPA2 && MsgType == EAPOL_PAIR_MSG_3) { WpaShowAllsuite(pMyKeyData, skip_offset); - // skip RSN IE + /* skip RSN IE */ pMyKeyData += skip_offset; KeyDataLength -= skip_offset; DBGPRINT(RT_DEBUG_TRACE, @@ -2170,24 +2170,24 @@ BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, DBGPRINT(RT_DEBUG_TRACE, ("RTMPParseEapolKeyData ==> KeyDataLength %d without RSN_IE \n", KeyDataLength)); - //hex_dump("remain data", pMyKeyData, KeyDataLength); + /*hex_dump("remain data", pMyKeyData, KeyDataLength); */ - // Parse EKD format in pairwise_msg_3_WPA2 && group_msg_1_WPA2 + /* Parse EKD format in pairwise_msg_3_WPA2 && group_msg_1_WPA2 */ if (bWPA2 && (MsgType == EAPOL_PAIR_MSG_3 || MsgType == EAPOL_GROUP_MSG_1)) { - if (KeyDataLength >= 8) // KDE format exclude GTK length + if (KeyDataLength >= 8) /* KDE format exclude GTK length */ { pKDE = (PKDE_ENCAP) pMyKeyData; DefaultIdx = pKDE->GTKEncap.Kid; - // Sanity check - KED length + /* Sanity check - KED length */ if (KeyDataLength < (pKDE->Len + 2)) { DBGPRINT(RT_DEBUG_ERROR, ("ERROR: The len from KDE is too short \n")); return FALSE; } - // Get GTK length - refer to IEEE 802.11i-2004 p.82 + /* Get GTK length - refer to IEEE 802.11i-2004 p.82 */ GTKLEN = pKDE->Len - 6; if (GTKLEN < LEN_AES_KEY) { DBGPRINT(RT_DEBUG_ERROR, @@ -2205,7 +2205,7 @@ BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, DBGPRINT(RT_DEBUG_TRACE, ("GTK in KDE format ,DefaultKeyID=%d, KeyLen=%d \n", DefaultIdx, GTKLEN)); - // skip it + /* skip it */ pMyKeyData += 8; KeyDataLength -= 8; @@ -2214,7 +2214,7 @@ BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, DBGPRINT(RT_DEBUG_TRACE, ("GTK DefaultKeyID=%d \n", DefaultIdx)); } - // Sanity check - shared key index must be 1 ~ 3 + /* Sanity check - shared key index must be 1 ~ 3 */ if (DefaultIdx < 1 || DefaultIdx > 3) { DBGPRINT(RT_DEBUG_ERROR, ("ERROR: GTK Key index(%d) is invalid in %s %s \n", @@ -2226,13 +2226,13 @@ BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, { PCIPHER_KEY pSharedKey; - // set key material, TxMic and RxMic + /* set key material, TxMic and RxMic */ NdisMoveMemory(pAd->StaCfg.GTK, pMyKeyData, 32); pAd->StaCfg.DefaultKeyId = DefaultIdx; pSharedKey = &pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId]; - // Prepare pair-wise key information into shared key table + /* Prepare pair-wise key information into shared key table */ NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); pSharedKey->KeyLen = LEN_TKIP_EK; NdisMoveMemory(pSharedKey->Key, pAd->StaCfg.GTK, LEN_TKIP_EK); @@ -2241,7 +2241,7 @@ BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.GTK[24], LEN_TKIP_TXMICK); - // Update Shared Key CipherAlg + /* Update Shared Key CipherAlg */ pSharedKey->CipherAlg = CIPHER_NONE; if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption2Enabled) pSharedKey->CipherAlg = CIPHER_TKIP; @@ -2254,7 +2254,7 @@ BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, Ndis802_11GroupWEP104Enabled) pSharedKey->CipherAlg = CIPHER_WEP128; - // Update group key information to ASIC Shared Key Table + /* Update group key information to ASIC Shared Key Table */ AsicAddSharedKeyEntry(pAd, BSS0, pAd->StaCfg.DefaultKeyId, @@ -2262,7 +2262,7 @@ BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, pSharedKey->Key, pSharedKey->TxMic, pSharedKey->RxMic); - // Update ASIC WCID attribute table and IVEIV table + /* Update ASIC WCID attribute table and IVEIV table */ RTMPAddWcidAttributeEntry(pAd, BSS0, pAd->StaCfg.DefaultKeyId, @@ -2333,28 +2333,28 @@ VOID ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, BOOLEAN bWPA2 = FALSE; UCHAR KeyDescVer; - // Choose WPA2 or not + /* Choose WPA2 or not */ if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) || (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) bWPA2 = TRUE; - // Init Packet and Fill header + /* Init Packet and Fill header */ pMsg->ProVer = EAPOL_VER; pMsg->ProType = EAPOLKey; - // Default 95 bytes, the EAPoL-Key descriptor exclude Key-data field + /* Default 95 bytes, the EAPoL-Key descriptor exclude Key-data field */ SET_UINT16_TO_ARRARY(pMsg->Body_Len, LEN_EAPOL_KEY_MSG); - // Fill in EAPoL descriptor + /* Fill in EAPoL descriptor */ if (bWPA2) pMsg->KeyDesc.Type = WPA2_KEY_DESC; else pMsg->KeyDesc.Type = WPA1_KEY_DESC; - // Key Descriptor Version (bits 0-2) specifies the key descriptor version type + /* Key Descriptor Version (bits 0-2) specifies the key descriptor version type */ { - // Fill in Key information, refer to IEEE Std 802.11i-2004 page 78 - // When either the pairwise or the group cipher is AES, the DESC_TYPE_AES(2) shall be used. + /* Fill in Key information, refer to IEEE Std 802.11i-2004 page 78 */ + /* When either the pairwise or the group cipher is AES, the DESC_TYPE_AES(2) shall be used. */ KeyDescVer = (((pEntry->WepStatus == Ndis802_11Encryption3Enabled) || (GroupKeyWepStatus == @@ -2364,13 +2364,13 @@ VOID ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, pMsg->KeyDesc.KeyInfo.KeyDescVer = KeyDescVer; - // Specify Key Type as Group(0) or Pairwise(1) + /* Specify Key Type as Group(0) or Pairwise(1) */ if (MsgType >= EAPOL_GROUP_MSG_1) pMsg->KeyDesc.KeyInfo.KeyType = GROUPKEY; else pMsg->KeyDesc.KeyInfo.KeyType = PAIRWISEKEY; - // Specify Key Index, only group_msg1_WPA1 + /* Specify Key Index, only group_msg1_WPA1 */ if (!bWPA2 && (MsgType >= EAPOL_GROUP_MSG_1)) pMsg->KeyDesc.KeyInfo.KeyIndex = DefaultKeyIdx; @@ -2393,20 +2393,20 @@ VOID ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, (MsgType == EAPOL_GROUP_MSG_1))) { pMsg->KeyDesc.KeyInfo.EKD_DL = 1; } - // key Information element has done. + /* key Information element has done. */ *(USHORT *) (&pMsg->KeyDesc.KeyInfo) = cpu2le16(*(USHORT *) (&pMsg->KeyDesc.KeyInfo)); - // Fill in Key Length + /* Fill in Key Length */ { if (MsgType >= EAPOL_GROUP_MSG_1) { - // the length of group key cipher + /* the length of group key cipher */ pMsg->KeyDesc.KeyLength[1] = ((GroupKeyWepStatus == Ndis802_11Encryption2Enabled) ? TKIP_GTK_LENGTH : LEN_AES_KEY); } else { - // the length of pairwise key cipher + /* the length of pairwise key cipher */ pMsg->KeyDesc.KeyLength[1] = ((pEntry->WepStatus == Ndis802_11Encryption2Enabled) ? LEN_TKIP_KEY : @@ -2414,33 +2414,33 @@ VOID ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, } } - // Fill in replay counter + /* Fill in replay counter */ NdisMoveMemory(pMsg->KeyDesc.ReplayCounter, pEntry->R_Counter, LEN_KEY_DESC_REPLAY); - // Fill Key Nonce field - // ANonce : pairwise_msg1 & pairwise_msg3 - // SNonce : pairwise_msg2 - // GNonce : group_msg1_wpa1 + /* Fill Key Nonce field */ + /* ANonce : pairwise_msg1 & pairwise_msg3 */ + /* SNonce : pairwise_msg2 */ + /* GNonce : group_msg1_wpa1 */ if ((MsgType <= EAPOL_PAIR_MSG_3) || ((!bWPA2 && (MsgType == EAPOL_GROUP_MSG_1)))) NdisMoveMemory(pMsg->KeyDesc.KeyNonce, KeyNonce, LEN_KEY_DESC_NONCE); - // Fill key IV - WPA2 as 0, WPA1 as random + /* Fill key IV - WPA2 as 0, WPA1 as random */ if (!bWPA2 && (MsgType == EAPOL_GROUP_MSG_1)) { - // Suggest IV be random number plus some number, + /* Suggest IV be random number plus some number, */ NdisMoveMemory(pMsg->KeyDesc.KeyIv, &KeyNonce[16], LEN_KEY_DESC_IV); pMsg->KeyDesc.KeyIv[15] += 2; } - // Fill Key RSC field - // It contains the RSC for the GTK being installed. + /* Fill Key RSC field */ + /* It contains the RSC for the GTK being installed. */ if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2) || (MsgType == EAPOL_GROUP_MSG_1)) { NdisMoveMemory(pMsg->KeyDesc.KeyRsc, TxRSC, 6); } - // Clear Key MIC field for MIC calculation later + /* Clear Key MIC field for MIC calculation later */ NdisZeroMemory(pMsg->KeyDesc.KeyMic, LEN_KEY_DESC_MIC); ConstructEapolKeyData(pEntry, @@ -2449,7 +2449,7 @@ VOID ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, MsgType, DefaultKeyIdx, GTK, RSNIE, RSNIE_Len, pMsg); - // Calculate MIC and fill in KeyMic Field except Pairwise Msg 1. + /* Calculate MIC and fill in KeyMic Field except Pairwise Msg 1. */ if (MsgType != EAPOL_PAIR_MSG_1) { CalculateMIC(KeyDescVer, pEntry->PTK, pMsg); } @@ -2499,7 +2499,7 @@ VOID ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, PRTMP_ADAPTER pAd = pEntry->pAd; BOOLEAN GTK_Included = FALSE; - // Choose WPA2 or not + /* Choose WPA2 or not */ if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) || (pEntry->AuthMode == Ndis802_11AuthModeWPA2PSK)) bWPA2Capable = TRUE; @@ -2508,7 +2508,7 @@ VOID ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, MsgType == EAPOL_PAIR_MSG_4 || MsgType == EAPOL_GROUP_MSG_2) return; - // allocate memory pool + /* allocate memory pool */ os_alloc_mem(NULL, (PUCHAR *) & mpool, 1500); if (mpool == NULL) @@ -2523,7 +2523,7 @@ VOID ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, SET_UINT16_TO_ARRARY(pMsg->KeyDesc.KeyDataLen, 0); data_offset = 0; - // Encapsulate RSNIE in pairwise_msg2 & pairwise_msg3 + /* Encapsulate RSNIE in pairwise_msg2 & pairwise_msg3 */ if (RSNIE_LEN && ((MsgType == EAPOL_PAIR_MSG_2) || (MsgType == EAPOL_PAIR_MSG_3))) { @@ -2535,17 +2535,17 @@ VOID ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, RSNIE, RSNIE_LEN, pmkid_ptr, pmkid_len); } - // Encapsulate KDE format in pairwise_msg3_WPA2 & group_msg1_WPA2 + /* Encapsulate KDE format in pairwise_msg3_WPA2 & group_msg1_WPA2 */ if (bWPA2Capable && ((MsgType == EAPOL_PAIR_MSG_3) || (MsgType == EAPOL_GROUP_MSG_1))) { - // Key Data Encapsulation (KDE) format - 802.11i-2004 Figure-43w and Table-20h + /* Key Data Encapsulation (KDE) format - 802.11i-2004 Figure-43w and Table-20h */ Key_Data[data_offset + 0] = 0xDD; if (GroupKeyWepStatus == Ndis802_11Encryption3Enabled) { - Key_Data[data_offset + 1] = 0x16; // 4+2+16(OUI+DataType+DataField) + Key_Data[data_offset + 1] = 0x16; /* 4+2+16(OUI+DataType+DataField) */ } else { - Key_Data[data_offset + 1] = 0x26; // 4+2+32(OUI+DataType+DataField) + Key_Data[data_offset + 1] = 0x26; /* 4+2+32(OUI+DataType+DataField) */ } Key_Data[data_offset + 2] = 0x00; @@ -2553,18 +2553,18 @@ VOID ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, Key_Data[data_offset + 4] = 0xAC; Key_Data[data_offset + 5] = 0x01; - // GTK KDE format - 802.11i-2004 Figure-43x + /* GTK KDE format - 802.11i-2004 Figure-43x */ Key_Data[data_offset + 6] = (DefaultKeyIdx & 0x03); - Key_Data[data_offset + 7] = 0x00; // Reserved Byte + Key_Data[data_offset + 7] = 0x00; /* Reserved Byte */ data_offset += 8; } - // Encapsulate GTK - // Only for pairwise_msg3_WPA2 and group_msg1 + /* Encapsulate GTK */ + /* Only for pairwise_msg3_WPA2 and group_msg1 */ if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2Capable) || (MsgType == EAPOL_GROUP_MSG_1)) { - // Fill in GTK + /* Fill in GTK */ if (GroupKeyWepStatus == Ndis802_11Encryption3Enabled) { NdisMoveMemory(&Key_Data[data_offset], GTK, LEN_AES_KEY); @@ -2578,23 +2578,23 @@ VOID ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, GTK_Included = TRUE; } - // This whole key-data field shall be encrypted if a GTK is included. - // Encrypt the data material in key data field with KEK + /* This whole key-data field shall be encrypted if a GTK is included. */ + /* Encrypt the data material in key data field with KEK */ if (GTK_Included) { - //hex_dump("GTK_Included", Key_Data, data_offset); + /*hex_dump("GTK_Included", Key_Data, data_offset); */ if ((keyDescVer == DESC_TYPE_AES)) { UCHAR remainder = 0; UCHAR pad_len = 0; - // Key Descriptor Version 2 or 3: AES key wrap, defined in IETF RFC 3394, - // shall be used to encrypt the Key Data field using the KEK field from - // the derived PTK. + /* Key Descriptor Version 2 or 3: AES key wrap, defined in IETF RFC 3394, */ + /* shall be used to encrypt the Key Data field using the KEK field from */ + /* the derived PTK. */ - // If the Key Data field uses the NIST AES key wrap, then the Key Data field - // shall be padded before encrypting if the key data length is less than 16 - // octets or if it is not a multiple of 8. The padding consists of appending - // a single octet 0xdd followed by zero or more 0x00 octets. + /* If the Key Data field uses the NIST AES key wrap, then the Key Data field */ + /* shall be padded before encrypting if the key data length is less than 16 */ + /* octets or if it is not a multiple of 8. The padding consists of appending */ + /* a single octet 0xdd followed by zero or more 0x00 octets. */ if ((remainder = data_offset & 0x07) != 0) { INT i; @@ -2608,22 +2608,22 @@ VOID ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, AES_GTK_KEY_WRAP(&pEntry->PTK[16], Key_Data, data_offset, Rc4GTK); - // AES wrap function will grow 8 bytes in length + /* AES wrap function will grow 8 bytes in length */ data_offset += 8; } else { /* Key Descriptor Version 1: ARC4 is used to encrypt the Key Data field using the KEK field from the derived PTK. */ - // PREPARE Encrypted "Key DATA" field. (Encrypt GTK with RC4, usinf PTK[16]->[31] as Key, IV-field as IV) - // put TxTsc in Key RSC field - pAd->PrivateInfo.FCSCRC32 = PPPINITFCS32; //Init crc32. + /* PREPARE Encrypted "Key DATA" field. (Encrypt GTK with RC4, usinf PTK[16]->[31] as Key, IV-field as IV) */ + /* put TxTsc in Key RSC field */ + pAd->PrivateInfo.FCSCRC32 = PPPINITFCS32; /*Init crc32. */ - // ekey is the contanetion of IV-field, and PTK[16]->PTK[31] + /* ekey is the contanetion of IV-field, and PTK[16]->PTK[31] */ NdisMoveMemory(ekey, pMsg->KeyDesc.KeyIv, LEN_KEY_DESC_IV); NdisMoveMemory(&ekey[LEN_KEY_DESC_IV], &pEntry->PTK[16], LEN_EAP_EK); - ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, ekey, sizeof(ekey)); //INIT SBOX, KEYLEN+3(IV) + ARCFOUR_INIT(&pAd->PrivateInfo.WEPCONTEXT, ekey, sizeof(ekey)); /*INIT SBOX, KEYLEN+3(IV) */ pAd->PrivateInfo.FCSCRC32 = RTMP_CALC_FCS32(pAd->PrivateInfo.FCSCRC32, Key_Data, data_offset); @@ -2636,7 +2636,7 @@ VOID ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, NdisMoveMemory(pMsg->KeyDesc.KeyData, Key_Data, data_offset); } - // Update key data length field and total body length + /* Update key data length field and total body length */ SET_UINT16_TO_ARRARY(pMsg->KeyDesc.KeyDataLen, data_offset); INC_UINT16_TO_ARRARY(pMsg->Body_Len, data_offset); @@ -2668,21 +2668,21 @@ static VOID CalculateMIC(IN UCHAR KeyDescVer, UCHAR mic[LEN_KEY_DESC_MIC]; UCHAR digest[80]; - // allocate memory for MIC calculation + /* allocate memory for MIC calculation */ os_alloc_mem(NULL, (PUCHAR *) & OutBuffer, 512); if (OutBuffer == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("!!!CalculateMIC: no memory!!!\n")); return; } - // make a frame for calculating MIC. + /* make a frame for calculating MIC. */ MakeOutgoingFrame(OutBuffer, &FrameLen, CONV_ARRARY_TO_UINT16(pMsg->Body_Len) + 4, pMsg, END_OF_ARGS); NdisZeroMemory(mic, sizeof(mic)); - // Calculate MIC + /* Calculate MIC */ if (KeyDescVer == DESC_TYPE_AES) { HMAC_SHA1(PTK, LEN_EAP_MICK, OutBuffer, FrameLen, digest, SHA1_DIGEST_SIZE); @@ -2692,7 +2692,7 @@ static VOID CalculateMIC(IN UCHAR KeyDescVer, MD5_DIGEST_SIZE); } - // store the calculated MIC + /* store the calculated MIC */ NdisMoveMemory(pMsg->KeyDesc.KeyMic, mic, LEN_KEY_DESC_MIC); os_free_mem(NULL, OutBuffer); @@ -2721,52 +2721,52 @@ NDIS_STATUS RTMPSoftDecryptBroadCastData(IN PRTMP_ADAPTER pAd, { PRXWI_STRUC pRxWI = pRxBlk->pRxWI; - // handle WEP decryption + /* handle WEP decryption */ if (GroupCipher == Ndis802_11Encryption1Enabled) { if (RTMPSoftDecryptWEP (pAd, pRxBlk->pData, pRxWI->MPDUtotalByteCount, pShard_key)) { - //Minus IV[4] & ICV[4] + /*Minus IV[4] & ICV[4] */ pRxWI->MPDUtotalByteCount -= 8; } else { DBGPRINT(RT_DEBUG_ERROR, ("ERROR : Software decrypt WEP data fails.\n")); - // give up this frame + /* give up this frame */ return NDIS_STATUS_FAILURE; } } - // handle TKIP decryption + /* handle TKIP decryption */ else if (GroupCipher == Ndis802_11Encryption2Enabled) { if (RTMPSoftDecryptTKIP (pAd, pRxBlk->pData, pRxWI->MPDUtotalByteCount, 0, pShard_key)) { - //Minus 8 bytes MIC, 8 bytes IV/EIV, 4 bytes ICV + /*Minus 8 bytes MIC, 8 bytes IV/EIV, 4 bytes ICV */ pRxWI->MPDUtotalByteCount -= 20; } else { DBGPRINT(RT_DEBUG_ERROR, ("ERROR : RTMPSoftDecryptTKIP Failed\n")); - // give up this frame + /* give up this frame */ return NDIS_STATUS_FAILURE; } } - // handle AES decryption + /* handle AES decryption */ else if (GroupCipher == Ndis802_11Encryption3Enabled) { if (RTMPSoftDecryptAES (pAd, pRxBlk->pData, pRxWI->MPDUtotalByteCount, pShard_key)) { - //8 bytes MIC, 8 bytes IV/EIV (CCMP Header) + /*8 bytes MIC, 8 bytes IV/EIV (CCMP Header) */ pRxWI->MPDUtotalByteCount -= 16; } else { DBGPRINT(RT_DEBUG_ERROR, ("ERROR : RTMPSoftDecryptAES Failed\n")); - // give up this frame + /* give up this frame */ return NDIS_STATUS_FAILURE; } } else { - // give up this frame + /* give up this frame */ return NDIS_STATUS_FAILURE; } @@ -2786,18 +2786,18 @@ PUINT8 GetSuiteFromRSNIE(IN PUINT8 rsnie, BOOLEAN isWPA2 = FALSE; pEid = (PEID_STRUCT) rsnie; - len = rsnie_len - 2; // exclude IE and length + len = rsnie_len - 2; /* exclude IE and length */ pBuf = (PUINT8) & pEid->Octet[0]; - // set default value + /* set default value */ *count = 0; - // Check length + /* Check length */ if ((len <= 0) || (pEid->Len != len)) { DBGPRINT_ERR(("%s : The length is invalid\n", __func__)); return NULL; } - // Check WPA or WPA2 + /* Check WPA or WPA2 */ if (pEid->Eid == IE_WPA) { PRSNIE pRsnie = (PRSNIE) pBuf; UINT16 ucount; @@ -2807,18 +2807,18 @@ PUINT8 GetSuiteFromRSNIE(IN PUINT8 rsnie, __func__)); return NULL; } - // Get the count of pairwise cipher + /* Get the count of pairwise cipher */ ucount = cpu2le16(pRsnie->ucount); if (ucount > 2) { DBGPRINT_ERR(("%s : The count(%d) of pairwise cipher is invlaid\n", __func__, ucount)); return NULL; } - // Get the group cipher + /* Get the group cipher */ if (type == GROUP_SUITE) { *count = 1; return pRsnie->mcast; } - // Get the pairwise cipher suite + /* Get the pairwise cipher suite */ else if (type == PAIRWISE_SUITE) { DBGPRINT(RT_DEBUG_TRACE, ("%s : The count of pairwise cipher is %d\n", @@ -2840,18 +2840,18 @@ PUINT8 GetSuiteFromRSNIE(IN PUINT8 rsnie, __func__)); return NULL; } - // Get the count of pairwise cipher + /* Get the count of pairwise cipher */ ucount = cpu2le16(pRsnie->ucount); if (ucount > 2) { DBGPRINT_ERR(("%s : The count(%d) of pairwise cipher is invlaid\n", __func__, ucount)); return NULL; } - // Get the group cipher + /* Get the group cipher */ if (type == GROUP_SUITE) { *count = 1; return pRsnie->mcast; } - // Get the pairwise cipher suite + /* Get the pairwise cipher suite */ else if (type == PAIRWISE_SUITE) { DBGPRINT(RT_DEBUG_TRACE, ("%s : The count of pairwise cipher is %d\n", @@ -2867,7 +2867,7 @@ PUINT8 GetSuiteFromRSNIE(IN PUINT8 rsnie, return NULL; } - // skip group cipher and pairwise cipher suite + /* skip group cipher and pairwise cipher suite */ pBuf += offset; len -= offset; @@ -2876,17 +2876,17 @@ PUINT8 GetSuiteFromRSNIE(IN PUINT8 rsnie, __func__)); return NULL; } - // pointer to AKM count + /* pointer to AKM count */ pAkm = (PRSNIE_AUTH) pBuf; - // Get the count of pairwise cipher + /* Get the count of pairwise cipher */ acount = cpu2le16(pAkm->acount); if (acount > 2) { DBGPRINT_ERR(("%s : The count(%d) of AKM is invlaid\n", __func__, acount)); return NULL; } - // Get the AKM suite + /* Get the AKM suite */ if (type == AKM_SUITE) { DBGPRINT(RT_DEBUG_TRACE, ("%s : The count of AKM is %d\n", __func__, acount)); @@ -2898,13 +2898,13 @@ PUINT8 GetSuiteFromRSNIE(IN PUINT8 rsnie, pBuf += offset; len -= offset; - // The remaining length must larger than (RSN-Capability(2) + PMKID-Count(2) + PMKID(16~)) + /* The remaining length must larger than (RSN-Capability(2) + PMKID-Count(2) + PMKID(16~)) */ if (len >= (sizeof(RSN_CAPABILITIES) + 2 + LEN_PMKID)) { - // Skip RSN capability and PMKID-Count + /* Skip RSN capability and PMKID-Count */ pBuf += (sizeof(RSN_CAPABILITIES) + 2); len -= (sizeof(RSN_CAPABILITIES) + 2); - // Get PMKID + /* Get PMKID */ if (type == PMKID_LIST) { *count = 1; return pBuf; @@ -2915,7 +2915,7 @@ PUINT8 GetSuiteFromRSNIE(IN PUINT8 rsnie, } *count = 0; - //DBGPRINT_ERR(("%s : The type(%d) doesn't support \n", __func__, type)); + /*DBGPRINT_ERR(("%s : The type(%d) doesn't support \n", __func__, type)); */ return NULL; } @@ -2927,24 +2927,24 @@ VOID WpaShowAllsuite(IN PUINT8 rsnie, IN UINT rsnie_len) hex_dump("RSNIE", rsnie, rsnie_len); - // group cipher + /* group cipher */ if ((pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, GROUP_SUITE, &count)) != NULL) { hex_dump("group cipher", pSuite, 4 * count); } - // pairwise cipher + /* pairwise cipher */ if ((pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, PAIRWISE_SUITE, &count)) != NULL) { hex_dump("pairwise cipher", pSuite, 4 * count); } - // AKM + /* AKM */ if ((pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, AKM_SUITE, &count)) != NULL) { hex_dump("AKM suite", pSuite, 4 * count); } - // PMKID + /* PMKID */ if ((pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, PMKID_LIST, &count)) != NULL) { hex_dump("PMKID", pSuite, LEN_PMKID); diff --git a/drivers/staging/rt2860/common/ee_efuse.c b/drivers/staging/rt2860/common/ee_efuse.c index 8e71addeb2f9..8e49cd713d13 100644 --- a/drivers/staging/rt2860/common/ee_efuse.c +++ b/drivers/staging/rt2860/common/ee_efuse.c @@ -83,23 +83,23 @@ UCHAR eFuseReadRegisters(IN PRTMP_ADAPTER pAd, RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); - //Step0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. - //Use the eeprom logical address and covert to address to block number + /*Step0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. */ + /*Use the eeprom logical address and covert to address to block number */ eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0; - //Step1. Write EFSROM_MODE (0x580, bit7:bit6) to 0. + /*Step1. Write EFSROM_MODE (0x580, bit7:bit6) to 0. */ eFuseCtrlStruc.field.EFSROM_MODE = 0; - //Step2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure. + /*Step2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure. */ eFuseCtrlStruc.field.EFSROM_KICK = 1; NdisMoveMemory(&data, &eFuseCtrlStruc, 4); RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); - //Step3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. + /*Step3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. */ i = 0; while (i < 500) { - //rtmp.HwMemoryReadDword(EFUSE_CTRL, (DWORD *) &eFuseCtrlStruc, 4); + /*rtmp.HwMemoryReadDword(EFUSE_CTRL, (DWORD *) &eFuseCtrlStruc, 4); */ RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); if (eFuseCtrlStruc.field.EFSROM_KICK == 0) { break; @@ -108,25 +108,25 @@ UCHAR eFuseReadRegisters(IN PRTMP_ADAPTER pAd, i++; } - //if EFSROM_AOUT is not found in physical address, write 0xffff + /*if EFSROM_AOUT is not found in physical address, write 0xffff */ if (eFuseCtrlStruc.field.EFSROM_AOUT == 0x3f) { for (i = 0; i < Length / 2; i++) *(pData + 2 * i) = 0xffff; } else { - //Step4. Read 16-byte of data from EFUSE_DATA0-3 (0x590-0x59C) + /*Step4. Read 16-byte of data from EFUSE_DATA0-3 (0x590-0x59C) */ efuseDataOffset = EFUSE_DATA3 - (Offset & 0xC); - //data hold 4 bytes data. - //In RTMP_IO_READ32 will automatically execute 32-bytes swapping + /*data hold 4 bytes data. */ + /*In RTMP_IO_READ32 will automatically execute 32-bytes swapping */ RTMP_IO_READ32(pAd, efuseDataOffset, &data); - //Decide the upper 2 bytes or the bottom 2 bytes. - // Little-endian S | S Big-endian - // addr 3 2 1 0 | 0 1 2 3 - // Ori-V D C B A | A B C D - //After swapping - // D C B A | D C B A - //Return 2-bytes - //The return byte statrs from S. Therefore, the little-endian will return BA, the Big-endian will return DC. - //For returning the bottom 2 bytes, the Big-endian should shift right 2-bytes. + /*Decide the upper 2 bytes or the bottom 2 bytes. */ + /* Little-endian S | S Big-endian */ + /* addr 3 2 1 0 | 0 1 2 3 */ + /* Ori-V D C B A | A B C D */ + /*After swapping */ + /* D C B A | D C B A */ + /*Return 2-bytes */ + /*The return byte statrs from S. Therefore, the little-endian will return BA, the Big-endian will return DC. */ + /*For returning the bottom 2 bytes, the Big-endian should shift right 2-bytes. */ data = data >> (8 * (Offset & 0x3)); NdisMoveMemory(pData, &data, Length); @@ -160,20 +160,20 @@ VOID eFusePhysicalReadRegisters(IN PRTMP_ADAPTER pAd, RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); - //Step0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. + /*Step0. Write 10-bit of address to EFSROM_AIN (0x580, bit25:bit16). The address must be 16-byte alignment. */ eFuseCtrlStruc.field.EFSROM_AIN = Offset & 0xfff0; - //Step1. Write EFSROM_MODE (0x580, bit7:bit6) to 1. - //Read in physical view + /*Step1. Write EFSROM_MODE (0x580, bit7:bit6) to 1. */ + /*Read in physical view */ eFuseCtrlStruc.field.EFSROM_MODE = 1; - //Step2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure. + /*Step2. Write EFSROM_KICK (0x580, bit30) to 1 to kick-off physical read procedure. */ eFuseCtrlStruc.field.EFSROM_KICK = 1; NdisMoveMemory(&data, &eFuseCtrlStruc, 4); RTMP_IO_WRITE32(pAd, EFUSE_CTRL, data); - //Step3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. + /*Step3. Polling EFSROM_KICK(0x580, bit30) until it become 0 again. */ i = 0; while (i < 500) { RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); @@ -183,14 +183,14 @@ VOID eFusePhysicalReadRegisters(IN PRTMP_ADAPTER pAd, i++; } - //Step4. Read 16-byte of data from EFUSE_DATA0-3 (0x59C-0x590) - //Because the size of each EFUSE_DATA is 4 Bytes, the size of address of each is 2 bits. - //The previous 2 bits is the EFUSE_DATA number, the last 2 bits is used to decide which bytes - //Decide which EFUSE_DATA to read - //590:F E D C - //594:B A 9 8 - //598:7 6 5 4 - //59C:3 2 1 0 + /*Step4. Read 16-byte of data from EFUSE_DATA0-3 (0x59C-0x590) */ + /*Because the size of each EFUSE_DATA is 4 Bytes, the size of address of each is 2 bits. */ + /*The previous 2 bits is the EFUSE_DATA number, the last 2 bits is used to decide which bytes */ + /*Decide which EFUSE_DATA to read */ + /*590:F E D C */ + /*594:B A 9 8 */ + /*598:7 6 5 4 */ + /*59C:3 2 1 0 */ efuseDataOffset = EFUSE_DATA3 - (Offset & 0xC); RTMP_IO_READ32(pAd, efuseDataOffset, &data); @@ -222,8 +222,8 @@ static VOID eFuseReadPhysical(IN PRTMP_ADAPTER pAd, USHORT *pInBuf = (USHORT *) lpInBuffer; USHORT *pOutBuf = (USHORT *) lpOutBuffer; - USHORT Offset = pInBuf[0]; //addr - USHORT Length = pInBuf[1]; //length + USHORT Offset = pInBuf[0]; /*addr */ + USHORT Length = pInBuf[1]; /*length */ int i; for (i = 0; i < Length; i += 2) { diff --git a/drivers/staging/rt2860/common/ee_prom.c b/drivers/staging/rt2860/common/ee_prom.c index b5be6f07ce75..fa3f2311f3c5 100644 --- a/drivers/staging/rt2860/common/ee_prom.c +++ b/drivers/staging/rt2860/common/ee_prom.c @@ -37,15 +37,15 @@ #include "../rt_config.h" -// IRQL = PASSIVE_LEVEL +/* IRQL = PASSIVE_LEVEL */ static inline VOID RaiseClock(IN PRTMP_ADAPTER pAd, IN UINT32 * x) { *x = *x | EESK; RTMP_IO_WRITE32(pAd, E2PROM_CSR, *x); - RTMPusecDelay(1); // Max frequency = 1MHz in Spec. definition + RTMPusecDelay(1); /* Max frequency = 1MHz in Spec. definition */ } -// IRQL = PASSIVE_LEVEL +/* IRQL = PASSIVE_LEVEL */ static inline VOID LowerClock(IN PRTMP_ADAPTER pAd, IN UINT32 * x) { *x = *x & ~EESK; @@ -53,7 +53,7 @@ static inline VOID LowerClock(IN PRTMP_ADAPTER pAd, IN UINT32 * x) RTMPusecDelay(1); } -// IRQL = PASSIVE_LEVEL +/* IRQL = PASSIVE_LEVEL */ static inline USHORT ShiftInBits(IN PRTMP_ADAPTER pAd) { UINT32 x, i; @@ -68,7 +68,7 @@ static inline USHORT ShiftInBits(IN PRTMP_ADAPTER pAd) RaiseClock(pAd, &x); RTMP_IO_READ32(pAd, E2PROM_CSR, &x); - LowerClock(pAd, &x); //prevent read failed + LowerClock(pAd, &x); /*prevent read failed */ x &= ~(EEDI); if (x & EEDO) @@ -78,7 +78,7 @@ static inline USHORT ShiftInBits(IN PRTMP_ADAPTER pAd) return data; } -// IRQL = PASSIVE_LEVEL +/* IRQL = PASSIVE_LEVEL */ static inline VOID ShiftOutBits(IN PRTMP_ADAPTER pAd, IN USHORT data, IN USHORT count) { @@ -106,7 +106,7 @@ static inline VOID ShiftOutBits(IN PRTMP_ADAPTER pAd, RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); } -// IRQL = PASSIVE_LEVEL +/* IRQL = PASSIVE_LEVEL */ static inline VOID EEpromCleanup(IN PRTMP_ADAPTER pAd) { UINT32 x; @@ -124,17 +124,17 @@ static inline VOID EWEN(IN PRTMP_ADAPTER pAd) { UINT32 x; - // reset bits and set EECS + /* reset bits and set EECS */ RTMP_IO_READ32(pAd, E2PROM_CSR, &x); x &= ~(EEDI | EEDO | EESK); x |= EECS; RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - // kick a pulse + /* kick a pulse */ RaiseClock(pAd, &x); LowerClock(pAd, &x); - // output the read_opcode and six pulse in that order + /* output the read_opcode and six pulse in that order */ ShiftOutBits(pAd, EEPROM_EWEN_OPCODE, 5); ShiftOutBits(pAd, 0, 6); @@ -145,24 +145,24 @@ static inline VOID EWDS(IN PRTMP_ADAPTER pAd) { UINT32 x; - // reset bits and set EECS + /* reset bits and set EECS */ RTMP_IO_READ32(pAd, E2PROM_CSR, &x); x &= ~(EEDI | EEDO | EESK); x |= EECS; RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - // kick a pulse + /* kick a pulse */ RaiseClock(pAd, &x); LowerClock(pAd, &x); - // output the read_opcode and six pulse in that order + /* output the read_opcode and six pulse in that order */ ShiftOutBits(pAd, EEPROM_EWDS_OPCODE, 5); ShiftOutBits(pAd, 0, 6); EEpromCleanup(pAd); } -// IRQL = PASSIVE_LEVEL +/* IRQL = PASSIVE_LEVEL */ int rtmp_ee_prom_read16(IN PRTMP_ADAPTER pAd, IN USHORT Offset, OUT USHORT * pValue) { @@ -170,23 +170,23 @@ int rtmp_ee_prom_read16(IN PRTMP_ADAPTER pAd, USHORT data; Offset /= 2; - // reset bits and set EECS + /* reset bits and set EECS */ RTMP_IO_READ32(pAd, E2PROM_CSR, &x); x &= ~(EEDI | EEDO | EESK); x |= EECS; RTMP_IO_WRITE32(pAd, E2PROM_CSR, x); - // patch can not access e-Fuse issue + /* patch can not access e-Fuse issue */ if (!(IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) { - // kick a pulse + /* kick a pulse */ RaiseClock(pAd, &x); LowerClock(pAd, &x); } - // output the read_opcode and register number in that order + /* output the read_opcode and register number in that order */ ShiftOutBits(pAd, EEPROM_READ_OPCODE, 3); ShiftOutBits(pAd, Offset, pAd->EEPROMAddressNum); - // Now read the data (16 bits) in from the selected EEPROM word + /* Now read the data (16 bits) in from the selected EEPROM word */ data = ShiftInBits(pAd); EEpromCleanup(pAd); diff --git a/drivers/staging/rt2860/common/eeprom.c b/drivers/staging/rt2860/common/eeprom.c index 872b47c10b7f..202d313b6553 100644 --- a/drivers/staging/rt2860/common/eeprom.c +++ b/drivers/staging/rt2860/common/eeprom.c @@ -65,8 +65,8 @@ INT RtmpChipOpsEepromHook(IN RTMP_ADAPTER * pAd, IN INT infType) return 0; } else DBGPRINT(RT_DEBUG_TRACE, ("NVM is EEPROM\n")); -#endif // RTMP_EFUSE_SUPPORT // -#endif // RT30xx // +#endif /* RTMP_EFUSE_SUPPORT // */ +#endif /* RT30xx // */ switch (infType) { #ifdef RTMP_PCI_SUPPORT @@ -74,13 +74,13 @@ INT RtmpChipOpsEepromHook(IN RTMP_ADAPTER * pAd, IN INT infType) pChipOps->eeinit = NULL; pChipOps->eeread = rtmp_ee_prom_read16; break; -#endif // RTMP_PCI_SUPPORT // +#endif /* RTMP_PCI_SUPPORT // */ #ifdef RTMP_USB_SUPPORT case RTMP_DEV_INF_USB: pChipOps->eeinit = NULL; pChipOps->eeread = RTUSBReadEEPROM16; break; -#endif // RTMP_USB_SUPPORT // +#endif /* RTMP_USB_SUPPORT // */ default: DBGPRINT(RT_DEBUG_ERROR, ("RtmpChipOpsEepromHook() failed!\n")); diff --git a/drivers/staging/rt2860/common/mlme.c b/drivers/staging/rt2860/common/mlme.c index 1d97b7303d3d..e047b89f88c3 100644 --- a/drivers/staging/rt2860/common/mlme.c +++ b/drivers/staging/rt2860/common/mlme.c @@ -52,8 +52,8 @@ UCHAR WPS_OUI[] = { 0x00, 0x50, 0xf2, 0x04 }; UCHAR PRE_N_HT_OUI[] = { 0x00, 0x90, 0x4c }; UCHAR RateSwitchTable[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x11, 0x00, 0, 0, 0, // Initial used item after association +/* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ + 0x11, 0x00, 0, 0, 0, /* Initial used item after association */ 0x00, 0x00, 0, 40, 101, 0x01, 0x00, 1, 40, 50, 0x02, 0x00, 2, 35, 45, @@ -89,8 +89,8 @@ UCHAR RateSwitchTable[] = { }; UCHAR RateSwitchTable11B[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x04, 0x03, 0, 0, 0, // Initial used item after association +/* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ + 0x04, 0x03, 0, 0, 0, /* Initial used item after association */ 0x00, 0x00, 0, 40, 101, 0x01, 0x00, 1, 40, 50, 0x02, 0x00, 2, 35, 45, @@ -98,8 +98,8 @@ UCHAR RateSwitchTable11B[] = { }; UCHAR RateSwitchTable11BG[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0a, 0x00, 0, 0, 0, // Initial used item after association +/* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ + 0x0a, 0x00, 0, 0, 0, /* Initial used item after association */ 0x00, 0x00, 0, 40, 101, 0x01, 0x00, 1, 40, 50, 0x02, 0x00, 2, 35, 45, @@ -113,8 +113,8 @@ UCHAR RateSwitchTable11BG[] = { }; UCHAR RateSwitchTable11G[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x08, 0x00, 0, 0, 0, // Initial used item after association +/* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ + 0x08, 0x00, 0, 0, 0, /* Initial used item after association */ 0x00, 0x10, 0, 20, 101, 0x01, 0x10, 1, 20, 35, 0x02, 0x10, 2, 20, 35, @@ -126,8 +126,8 @@ UCHAR RateSwitchTable11G[] = { }; UCHAR RateSwitchTable11N1S[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0c, 0x0a, 0, 0, 0, // Initial used item after association +/* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ + 0x0c, 0x0a, 0, 0, 0, /* Initial used item after association */ 0x00, 0x00, 0, 40, 101, 0x01, 0x00, 1, 40, 50, 0x02, 0x00, 2, 25, 45, @@ -143,8 +143,8 @@ UCHAR RateSwitchTable11N1S[] = { }; UCHAR RateSwitchTable11N2S[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0e, 0x0c, 0, 0, 0, // Initial used item after association +/* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ + 0x0e, 0x0c, 0, 0, 0, /* Initial used item after association */ 0x00, 0x00, 0, 40, 101, 0x01, 0x00, 1, 40, 50, 0x02, 0x00, 2, 25, 45, @@ -162,24 +162,24 @@ UCHAR RateSwitchTable11N2S[] = { }; UCHAR RateSwitchTable11N3S[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0b, 0x00, 0, 0, 0, // 0x0a, 0x00, 0, 0, 0, // Initial used item after association +/* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ + 0x0b, 0x00, 0, 0, 0, /* 0x0a, 0x00, 0, 0, 0, // Initial used item after association */ 0x00, 0x21, 0, 30, 101, 0x01, 0x21, 1, 20, 50, 0x02, 0x21, 2, 20, 50, 0x03, 0x21, 3, 15, 50, 0x04, 0x21, 4, 15, 30, - 0x05, 0x20, 11, 15, 30, // Required by System-Alan @ 20080812 - 0x06, 0x20, 12, 15, 30, // 0x05, 0x20, 12, 15, 30, - 0x07, 0x20, 13, 8, 20, // 0x06, 0x20, 13, 8, 20, - 0x08, 0x20, 14, 8, 20, // 0x07, 0x20, 14, 8, 20, - 0x09, 0x20, 15, 8, 25, // 0x08, 0x20, 15, 8, 25, - 0x0a, 0x22, 15, 8, 25, // 0x09, 0x22, 15, 8, 25, + 0x05, 0x20, 11, 15, 30, /* Required by System-Alan @ 20080812 */ + 0x06, 0x20, 12, 15, 30, /* 0x05, 0x20, 12, 15, 30, */ + 0x07, 0x20, 13, 8, 20, /* 0x06, 0x20, 13, 8, 20, */ + 0x08, 0x20, 14, 8, 20, /* 0x07, 0x20, 14, 8, 20, */ + 0x09, 0x20, 15, 8, 25, /* 0x08, 0x20, 15, 8, 25, */ + 0x0a, 0x22, 15, 8, 25, /* 0x09, 0x22, 15, 8, 25, */ }; UCHAR RateSwitchTable11N2SForABand[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0b, 0x09, 0, 0, 0, // Initial used item after association +/* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ + 0x0b, 0x09, 0, 0, 0, /* Initial used item after association */ 0x00, 0x21, 0, 30, 101, 0x01, 0x21, 1, 20, 50, 0x02, 0x21, 2, 20, 50, @@ -193,9 +193,9 @@ UCHAR RateSwitchTable11N2SForABand[] = { 0x0a, 0x22, 15, 8, 25, }; -UCHAR RateSwitchTable11N3SForABand[] = { // 3*3 -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0b, 0x09, 0, 0, 0, // Initial used item after association +UCHAR RateSwitchTable11N3SForABand[] = { /* 3*3 */ +/* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ + 0x0b, 0x09, 0, 0, 0, /* Initial used item after association */ 0x00, 0x21, 0, 30, 101, 0x01, 0x21, 1, 20, 50, 0x02, 0x21, 2, 20, 50, @@ -210,8 +210,8 @@ UCHAR RateSwitchTable11N3SForABand[] = { // 3*3 }; UCHAR RateSwitchTable11BGN1S[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0c, 0x0a, 0, 0, 0, // Initial used item after association +/* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ + 0x0c, 0x0a, 0, 0, 0, /* Initial used item after association */ 0x00, 0x00, 0, 40, 101, 0x01, 0x00, 1, 40, 50, 0x02, 0x00, 2, 25, 45, @@ -227,8 +227,8 @@ UCHAR RateSwitchTable11BGN1S[] = { }; UCHAR RateSwitchTable11BGN2S[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0e, 0x0c, 0, 0, 0, // Initial used item after association +/* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ + 0x0e, 0x0c, 0, 0, 0, /* Initial used item after association */ 0x00, 0x00, 0, 40, 101, 0x01, 0x00, 1, 40, 50, 0x02, 0x00, 2, 25, 45, @@ -245,10 +245,10 @@ UCHAR RateSwitchTable11BGN2S[] = { 0x0d, 0x22, 15, 8, 15, }; -UCHAR RateSwitchTable11BGN3S[] = { // 3*3 -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0a, 0x00, 0, 0, 0, // Initial used item after association - 0x00, 0x21, 0, 30, 101, //50 +UCHAR RateSwitchTable11BGN3S[] = { /* 3*3 */ +/* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ + 0x0a, 0x00, 0, 0, 0, /* Initial used item after association */ + 0x00, 0x21, 0, 30, 101, /*50 */ 0x01, 0x21, 1, 20, 50, 0x02, 0x21, 2, 20, 50, 0x03, 0x21, 3, 20, 50, @@ -261,9 +261,9 @@ UCHAR RateSwitchTable11BGN3S[] = { // 3*3 }; UCHAR RateSwitchTable11BGN2SForABand[] = { -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0b, 0x09, 0, 0, 0, // Initial used item after association - 0x00, 0x21, 0, 30, 101, //50 +/* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ + 0x0b, 0x09, 0, 0, 0, /* Initial used item after association */ + 0x00, 0x21, 0, 30, 101, /*50 */ 0x01, 0x21, 1, 20, 50, 0x02, 0x21, 2, 20, 50, 0x03, 0x21, 3, 15, 50, @@ -276,10 +276,10 @@ UCHAR RateSwitchTable11BGN2SForABand[] = { 0x0a, 0x22, 15, 8, 25, }; -UCHAR RateSwitchTable11BGN3SForABand[] = { // 3*3 -// Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) - 0x0c, 0x09, 0, 0, 0, // Initial used item after association - 0x00, 0x21, 0, 30, 101, //50 +UCHAR RateSwitchTable11BGN3SForABand[] = { /* 3*3 */ +/* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ + 0x0c, 0x09, 0, 0, 0, /* Initial used item after association */ + 0x00, 0x21, 0, 30, 101, /*50 */ 0x01, 0x21, 1, 20, 50, 0x02, 0x21, 2, 20, 50, 0x03, 0x21, 3, 15, 50, @@ -294,8 +294,8 @@ UCHAR RateSwitchTable11BGN3SForABand[] = { // 3*3 }; extern UCHAR OfdmRateToRxwiMCS[]; -// since RT61 has better RX sensibility, we have to limit TX ACK rate not to exceed our normal data TX rate. -// otherwise the WLAN peer may not be able to receive the ACK thus downgrade its data TX rate +/* since RT61 has better RX sensibility, we have to limit TX ACK rate not to exceed our normal data TX rate. */ +/* otherwise the WLAN peer may not be able to receive the ACK thus downgrade its data TX rate */ ULONG BasicRateMask[12] = { 0xfffff001 /* 1-Mbps */ , 0xfffff003 /* 2 Mbps */ , 0xfffff007 /* 5.5 */ , 0xfffff00f /* 11 */ , @@ -308,10 +308,10 @@ ULONG BasicRateMask[12] = UCHAR BROADCAST_ADDR[MAC_ADDR_LEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; UCHAR ZERO_MAC_ADDR[MAC_ADDR_LEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -// e.g. RssiSafeLevelForTxRate[RATE_36]" means if the current RSSI is greater than -// this value, then it's quaranteed capable of operating in 36 mbps TX rate in -// clean environment. -// TxRate: 1 2 5.5 11 6 9 12 18 24 36 48 54 72 100 +/* e.g. RssiSafeLevelForTxRate[RATE_36]" means if the current RSSI is greater than */ +/* this value, then it's quaranteed capable of operating in 36 mbps TX rate in */ +/* clean environment. */ +/* TxRate: 1 2 5.5 11 6 9 12 18 24 36 48 54 72 100 */ CHAR RssiSafeLevelForTxRate[] = { -92, -91, -90, -87, -88, -86, -85, -83, -81, -78, -72, -71, -40, -40 }; @@ -373,7 +373,7 @@ NDIS_STATUS MlmeInit(IN PRTMP_ADAPTER pAd) { BssTableInit(&pAd->ScanTab); - // init STA state machines + /* init STA state machines */ AssocStateMachineInit(pAd, &pAd->Mlme.AssocMachine, pAd->Mlme.AssocFunc); AuthStateMachineInit(pAd, &pAd->Mlme.AuthMachine, @@ -383,8 +383,8 @@ NDIS_STATUS MlmeInit(IN PRTMP_ADAPTER pAd) SyncStateMachineInit(pAd, &pAd->Mlme.SyncMachine, pAd->Mlme.SyncFunc); - // Since we are using switch/case to implement it, the init is different from the above - // state machine init + /* Since we are using switch/case to implement it, the init is different from the above */ + /* state machine init */ MlmeCntlInit(pAd, &pAd->Mlme.CntlMachine, NULL); } @@ -394,14 +394,14 @@ NDIS_STATUS MlmeInit(IN PRTMP_ADAPTER pAd) ActionStateMachineInit(pAd, &pAd->Mlme.ActMachine, pAd->Mlme.ActFunc); - // Init mlme periodic timer + /* Init mlme periodic timer */ RTMPInitTimer(pAd, &pAd->Mlme.PeriodicTimer, GET_TIMER_FUNCTION(MlmePeriodicExec), pAd, TRUE); - // Set mlme periodic timer + /* Set mlme periodic timer */ RTMPSetTimer(&pAd->Mlme.PeriodicTimer, MLME_TASK_EXEC_INTV); - // software-based RX Antenna diversity + /* software-based RX Antenna diversity */ RTMPInitTimer(pAd, &pAd->Mlme.RxAntEvalTimer, GET_TIMER_FUNCTION(AsicRxAntEvalTimeout), pAd, FALSE); @@ -409,7 +409,7 @@ NDIS_STATUS MlmeInit(IN PRTMP_ADAPTER pAd) { #ifdef RTMP_PCI_SUPPORT if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { - // only PCIe cards need these two timers + /* only PCIe cards need these two timers */ RTMPInitTimer(pAd, &pAd->Mlme.PsPollTimer, GET_TIMER_FUNCTION (PsPollWakeExec), pAd, FALSE); @@ -417,7 +417,7 @@ NDIS_STATUS MlmeInit(IN PRTMP_ADAPTER pAd) GET_TIMER_FUNCTION(RadioOnExec), pAd, FALSE); } -#endif // RTMP_PCI_SUPPORT // +#endif /* RTMP_PCI_SUPPORT // */ RTMPInitTimer(pAd, &pAd->Mlme.LinkDownTimer, GET_TIMER_FUNCTION(LinkDownExec), pAd, @@ -429,7 +429,7 @@ NDIS_STATUS MlmeInit(IN PRTMP_ADAPTER pAd) (RtmpUsbStaAsicForceWakeupTimeout), pAd, FALSE); pAd->Mlme.AutoWakeupTimerRunning = FALSE; -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ } } while (FALSE); @@ -457,8 +457,8 @@ VOID MlmeHandler(IN PRTMP_ADAPTER pAd) { MLME_QUEUE_ELEM *Elem = NULL; - // Only accept MLME and Frame from peer side, no other (control/data) frame should - // get into this state machine + /* Only accept MLME and Frame from peer side, no other (control/data) frame should */ + /* get into this state machine */ NdisAcquireSpinLock(&pAd->Mlme.TaskLock); if (pAd->Mlme.bRunning) { @@ -478,7 +478,7 @@ VOID MlmeHandler(IN PRTMP_ADAPTER pAd) pAd->Mlme.Queue.Num)); break; } - //From message type, determine which state machine I should drive + /*From message type, determine which state machine I should drive */ if (MlmeDequeue(&pAd->Mlme.Queue, &Elem)) { #ifdef RTMP_MAC_USB if (Elem->MsgType == MT2_RESET_CONF) { @@ -489,11 +489,11 @@ VOID MlmeHandler(IN PRTMP_ADAPTER pAd) Elem->MsgLen = 0; continue; } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ - // if dequeue success + /* if dequeue success */ switch (Elem->Machine) { - // STA state machines + /* STA state machines */ case ASSOC_STATE_MACHINE: StateMachinePerformAction(pAd, &pAd->Mlme. @@ -542,9 +542,9 @@ VOID MlmeHandler(IN PRTMP_ADAPTER pAd) ("ERROR: Illegal machine %ld in MlmeHandler()\n", Elem->Machine)); break; - } // end of switch + } /* end of switch */ - // free MLME element + /* free MLME element */ Elem->Occupied = FALSE; Elem->MsgLen = 0; @@ -578,12 +578,12 @@ VOID MlmeHalt(IN PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeHalt\n")); if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) { - // disable BEACON generation and other BEACON related hardware timers + /* disable BEACON generation and other BEACON related hardware timers */ AsicDisableSync(pAd); } { - // Cancel pending timers + /* Cancel pending timers */ RTMPCancelTimer(&pAd->MlmeAux.AssocTimer, &Cancelled); RTMPCancelTimer(&pAd->MlmeAux.ReassocTimer, &Cancelled); RTMPCancelTimer(&pAd->MlmeAux.DisassocTimer, &Cancelled); @@ -597,13 +597,13 @@ VOID MlmeHalt(IN PRTMP_ADAPTER pAd) RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ RTMPCancelTimer(&pAd->Mlme.LinkDownTimer, &Cancelled); #ifdef RTMP_MAC_USB RTMPCancelTimer(&pAd->Mlme.AutoWakeupTimer, &Cancelled); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ } RTMPCancelTimer(&pAd->Mlme.PeriodicTimer, &Cancelled); @@ -612,9 +612,9 @@ VOID MlmeHalt(IN PRTMP_ADAPTER pAd) if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) { RTMP_CHIP_OP *pChipOps = &pAd->chipOps; - // Set LED + /* Set LED */ RTMPSetLED(pAd, LED_HALT); - RTMPSetSignalLED(pAd, -100); // Force signal strength Led to be turned off, firmware is not done it. + RTMPSetSignalLED(pAd, -100); /* Force signal strength Led to be turned off, firmware is not done it. */ #ifdef RTMP_MAC_USB { LED_CFG_STRUC LedCfg; @@ -625,13 +625,13 @@ VOID MlmeHalt(IN PRTMP_ADAPTER pAd) LedCfg.field.YLedMode = 0; RTMP_IO_WRITE32(pAd, LED_CFG, LedCfg.word); } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ if (pChipOps->AsicHaltAction) pChipOps->AsicHaltAction(pAd); } - RTMPusecDelay(5000); // 5 msec to gurantee Ant Diversity timer canceled + RTMPusecDelay(5000); /* 5 msec to gurantee Ant Diversity timer canceled */ MlmeQueueDestroy(&pAd->Mlme.Queue); NdisFreeSpinLock(&pAd->Mlme.TaskLock); @@ -643,7 +643,7 @@ VOID MlmeResetRalinkCounters(IN PRTMP_ADAPTER pAd) { pAd->RalinkCounters.LastOneSecRxOkDataCnt = pAd->RalinkCounters.OneSecRxOkDataCnt; - // clear all OneSecxxx counters. + /* clear all OneSecxxx counters. */ pAd->RalinkCounters.OneSecBeaconSentCnt = 0; pAd->RalinkCounters.OneSecFalseCCACnt = 0; pAd->RalinkCounters.OneSecRxFcsErrCnt = 0; @@ -655,7 +655,7 @@ VOID MlmeResetRalinkCounters(IN PRTMP_ADAPTER pAd) pAd->RalinkCounters.OneSecReceivedByteCount = 0; pAd->RalinkCounters.OneSecTransmittedByteCount = 0; - // TODO: for debug only. to be removed + /* TODO: for debug only. to be removed */ pAd->RalinkCounters.OneSecOsTxCount[QID_AC_BE] = 0; pAd->RalinkCounters.OneSecOsTxCount[QID_AC_BK] = 0; pAd->RalinkCounters.OneSecOsTxCount[QID_AC_VI] = 0; @@ -688,7 +688,7 @@ VOID MlmeResetRalinkCounters(IN PRTMP_ADAPTER pAd) ========================================================================== */ -#define ADHOC_BEACON_LOST_TIME (8*OS_HZ) // 8 sec +#define ADHOC_BEACON_LOST_TIME (8*OS_HZ) /* 8 sec */ VOID MlmePeriodicExec(IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) @@ -698,8 +698,8 @@ VOID MlmePeriodicExec(IN PVOID SystemSpecific1, #ifdef RTMP_MAC_PCI { - // If Hardware controlled Radio enabled, we have to check GPIO pin2 every 2 second. - // Move code to here, because following code will return when radio is off + /* If Hardware controlled Radio enabled, we have to check GPIO pin2 every 2 second. */ + /* Move code to here, because following code will return when radio is off */ if ((pAd->Mlme.PeriodicRound % (MLME_TASK_EXEC_MULTIPLE * 2) == 0) && (pAd->StaCfg.bHardwareRadio == TRUE) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) @@ -708,27 +708,27 @@ VOID MlmePeriodicExec(IN PVOID SystemSpecific1, ) { UINT32 data = 0; - // Read GPIO pin2 as Hardware controlled radio state + /* Read GPIO pin2 as Hardware controlled radio state */ #ifndef RT3090 RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &data); -#endif // RT3090 // -//KH(PCIE PS):Added based on Jane<-- +#endif /* RT3090 // */ +/*KH(PCIE PS):Added based on Jane<-- */ #ifdef RT3090 -// Read GPIO pin2 as Hardware controlled radio state -// We need to Read GPIO if HW said so no mater what advance power saving +/* Read GPIO pin2 as Hardware controlled radio state */ +/* We need to Read GPIO if HW said so no mater what advance power saving */ if ((pAd->OpMode == OPMODE_STA) && (IDLE_ON(pAd)) && (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF)) && (pAd->StaCfg.PSControl.field.EnablePSinIdle == TRUE)) { - // Want to make sure device goes to L0 state before reading register. + /* Want to make sure device goes to L0 state before reading register. */ RTMPPCIeLinkCtrlValueRestore(pAd, 0); RTMP_IO_FORCE_READ32(pAd, GPIO_CTRL_CFG, &data); RTMPPCIeLinkCtrlSetting(pAd, 3); } else RTMP_IO_FORCE_READ32(pAd, GPIO_CTRL_CFG, &data); -#endif // RT3090 // -//KH(PCIE PS):Added based on Jane--> +#endif /* RT3090 // */ +/*KH(PCIE PS):Added based on Jane--> */ if (data & 0x04) { pAd->StaCfg.bHwRadio = TRUE; @@ -741,20 +741,20 @@ VOID MlmePeriodicExec(IN PVOID SystemSpecific1, && pAd->StaCfg.bSwRadio); if (pAd->StaCfg.bRadio == TRUE) { MlmeRadioOn(pAd); - // Update extra information + /* Update extra information */ pAd->ExtraInfo = EXTRA_INFO_CLEAR; } else { MlmeRadioOff(pAd); - // Update extra information + /* Update extra information */ pAd->ExtraInfo = HW_RADIO_OFF; } } } } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt + /* Do nothing if the driver is starting halt state. */ + /* This might happen when timer already been fired before cancel timer with mlmehalt */ if ((RTMP_TEST_FLAG(pAd, (fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_RADIO_OFF | fRTMP_ADAPTER_RADIO_MEASUREMENT | @@ -764,12 +764,12 @@ VOID MlmePeriodicExec(IN PVOID SystemSpecific1, RTMP_MLME_PRE_SANITY_CHECK(pAd); { - // Do nothing if monitor mode is on + /* Do nothing if monitor mode is on */ if (MONITOR_ON(pAd)) return; if (pAd->Mlme.PeriodicRound & 0x1) { - // This is the fix for wifi 11n extension channel overlapping test case. for 2860D + /* This is the fix for wifi 11n extension channel overlapping test case. for 2860D */ if (((pAd->MACVersion & 0xffff) == 0x0101) && (STA_TGN_WIFI_ON(pAd)) && (pAd->CommonCfg.IOTestParm.bToggle == FALSE)) @@ -786,20 +786,20 @@ VOID MlmePeriodicExec(IN PVOID SystemSpecific1, pAd->bUpdateBcnCntDone = FALSE; -// RECBATimerTimeout(SystemSpecific1,FunctionContext,SystemSpecific2,SystemSpecific3); +/* RECBATimerTimeout(SystemSpecific1,FunctionContext,SystemSpecific2,SystemSpecific3); */ pAd->Mlme.PeriodicRound++; #ifdef RTMP_MAC_USB - // execute every 100ms, update the Tx FIFO Cnt for update Tx Rate. + /* execute every 100ms, update the Tx FIFO Cnt for update Tx Rate. */ NICUpdateFifoStaCounters(pAd); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ - // execute every 500ms + /* execute every 500ms */ if ((pAd->Mlme.PeriodicRound % 5 == 0) && RTMPAutoRateSwitchCheck(pAd) /*(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)) */ ) { - // perform dynamic tx rate switching based on past TX history + /* perform dynamic tx rate switching based on past TX history */ { if ((OPSTATUS_TEST_FLAG (pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) @@ -808,13 +808,13 @@ VOID MlmePeriodicExec(IN PVOID SystemSpecific1, MlmeDynamicTxRateSwitching(pAd); } } - // Normal 1 second Mlme PeriodicExec. + /* Normal 1 second Mlme PeriodicExec. */ if (pAd->Mlme.PeriodicRound % MLME_TASK_EXEC_MULTIPLE == 0) { pAd->Mlme.OneSecPeriodicRound++; - //ORIBATimerTimeout(pAd); + /*ORIBATimerTimeout(pAd); */ - // Media status changed, report to NDIS + /* Media status changed, report to NDIS */ if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_MEDIA_STATE_CHANGE)) { RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_MEDIA_STATE_CHANGE); if (OPSTATUS_TEST_FLAG @@ -832,26 +832,26 @@ VOID MlmePeriodicExec(IN PVOID SystemSpecific1, NdisGetSystemUpTime(&pAd->Mlme.Now32); - // add the most up-to-date h/w raw counters into software variable, so that - // the dynamic tuning mechanism below are based on most up-to-date information + /* add the most up-to-date h/w raw counters into software variable, so that */ + /* the dynamic tuning mechanism below are based on most up-to-date information */ NICUpdateRawCounters(pAd); #ifdef RTMP_MAC_USB RTUSBWatchDog(pAd); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ - // Need statistics after read counter. So put after NICUpdateRawCounters + /* Need statistics after read counter. So put after NICUpdateRawCounters */ ORIBATimerTimeout(pAd); - // if MGMT RING is full more than twice within 1 second, we consider there's - // a hardware problem stucking the TX path. In this case, try a hardware reset - // to recover the system - // if (pAd->RalinkCounters.MgmtRingFullCount >= 2) - // RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HARDWARE_ERROR); - // else - // pAd->RalinkCounters.MgmtRingFullCount = 0; + /* if MGMT RING is full more than twice within 1 second, we consider there's */ + /* a hardware problem stucking the TX path. In this case, try a hardware reset */ + /* to recover the system */ + /* if (pAd->RalinkCounters.MgmtRingFullCount >= 2) */ + /* RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HARDWARE_ERROR); */ + /* else */ + /* pAd->RalinkCounters.MgmtRingFullCount = 0; */ - // The time period for checking antenna is according to traffic + /* The time period for checking antenna is according to traffic */ { if (pAd->Mlme.bEnableAutoAntennaCheck) { TxTotalCnt = @@ -859,7 +859,7 @@ VOID MlmePeriodicExec(IN PVOID SystemSpecific1, pAd->RalinkCounters.OneSecTxRetryOkCount + pAd->RalinkCounters.OneSecTxFailCount; - // dynamic adjust antenna evaluation period according to the traffic + /* dynamic adjust antenna evaluation period according to the traffic */ if (TxTotalCnt > 50) { if (pAd->Mlme.OneSecPeriodicRound % 10 == 0) { @@ -882,14 +882,14 @@ VOID MlmePeriodicExec(IN PVOID SystemSpecific1, #ifdef RTMP_MAC_PCI if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST) && (pAd->bPCIclkOff == FALSE)) -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ { - // When Adhoc beacon is enabled and RTS/CTS is enabled, there is a chance that hardware MAC FSM will run into a deadlock - // and sending CTS-to-self over and over. - // Software Patch Solution: - // 1. Polling debug state register 0x10F4 every one second. - // 2. If in 0x10F4 the ((bit29==1) && (bit7==1)) OR ((bit29==1) && (bit5==1)), it means the deadlock has occurred. - // 3. If the deadlock occurred, reset MAC/BBP by setting 0x1004 to 0x0001 for a while then setting it back to 0x000C again. + /* When Adhoc beacon is enabled and RTS/CTS is enabled, there is a chance that hardware MAC FSM will run into a deadlock */ + /* and sending CTS-to-self over and over. */ + /* Software Patch Solution: */ + /* 1. Polling debug state register 0x10F4 every one second. */ + /* 2. If in 0x10F4 the ((bit29==1) && (bit7==1)) OR ((bit29==1) && (bit5==1)), it means the deadlock has occurred. */ + /* 3. If the deadlock occurred, reset MAC/BBP by setting 0x1004 to 0x0001 for a while then setting it back to 0x000C again. */ UINT32 MacReg = 0; @@ -928,13 +928,13 @@ BOOLEAN MlmeValidateSSID(IN PUCHAR pSsid, IN UCHAR SsidLen) if (SsidLen > MAX_LEN_OF_SSID) return (FALSE); - // Check each character value + /* Check each character value */ for (index = 0; index < SsidLen; index++) { if (pSsid[index] < 0x20) return (FALSE); } - // All checked + /* All checked */ return (TRUE); } @@ -944,7 +944,7 @@ VOID MlmeSelectTxRateTable(IN PRTMP_ADAPTER pAd, IN PUCHAR pTableSize, IN PUCHAR pInitTxRateIdx) { do { - // decide the rate table for tuning + /* decide the rate table for tuning */ if (pAd->CommonCfg.TxRateTableSize > 0) { *ppTable = RateSwitchTable; *pTableSize = RateSwitchTable[0]; @@ -954,12 +954,12 @@ VOID MlmeSelectTxRateTable(IN PRTMP_ADAPTER pAd, } if ((pAd->OpMode == OPMODE_STA) && ADHOC_ON(pAd)) { - if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && (pEntry->HTCapability.MCSSet[0] == 0xff) && ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) { // 11N 1S Adhoc + if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && (pEntry->HTCapability.MCSSet[0] == 0xff) && ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) { /* 11N 1S Adhoc */ *ppTable = RateSwitchTable11N1S; *pTableSize = RateSwitchTable11N1S[0]; *pInitTxRateIdx = RateSwitchTable11N1S[1]; - } else if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && (pEntry->HTCapability.MCSSet[0] == 0xff) && (pEntry->HTCapability.MCSSet[1] == 0xff) && (pAd->Antenna.field.TxPath == 2)) { // 11N 2S Adhoc + } else if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && (pEntry->HTCapability.MCSSet[0] == 0xff) && (pEntry->HTCapability.MCSSet[1] == 0xff) && (pAd->Antenna.field.TxPath == 2)) { /* 11N 2S Adhoc */ if (pAd->LatchRfRegs.Channel <= 14) { *ppTable = RateSwitchTable11N2S; *pTableSize = RateSwitchTable11N2S[0]; @@ -994,18 +994,18 @@ VOID MlmeSelectTxRateTable(IN PRTMP_ADAPTER pAd, } break; } - //if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen == 12) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && - // ((pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) - if (((pEntry->RateLen == 12) || (pAd->OpMode == OPMODE_STA)) && (pEntry->HTCapability.MCSSet[0] == 0xff) && ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->CommonCfg.TxStream == 1))) { // 11BGN 1S AP + /*if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen == 12) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && */ + /* ((pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) */ + if (((pEntry->RateLen == 12) || (pAd->OpMode == OPMODE_STA)) && (pEntry->HTCapability.MCSSet[0] == 0xff) && ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->CommonCfg.TxStream == 1))) { /* 11BGN 1S AP */ *ppTable = RateSwitchTable11BGN1S; *pTableSize = RateSwitchTable11BGN1S[0]; *pInitTxRateIdx = RateSwitchTable11BGN1S[1]; break; } - //else if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen == 12) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && - // (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0xff) && (pAd->Antenna.field.TxPath == 2)) - if (((pEntry->RateLen == 12) || (pAd->OpMode == OPMODE_STA)) && (pEntry->HTCapability.MCSSet[0] == 0xff) && (pEntry->HTCapability.MCSSet[1] == 0xff) && (pAd->CommonCfg.TxStream == 2)) { // 11BGN 2S AP + /*else if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen == 12) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && */ + /* (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0xff) && (pAd->Antenna.field.TxPath == 2)) */ + if (((pEntry->RateLen == 12) || (pAd->OpMode == OPMODE_STA)) && (pEntry->HTCapability.MCSSet[0] == 0xff) && (pEntry->HTCapability.MCSSet[1] == 0xff) && (pAd->CommonCfg.TxStream == 2)) { /* 11BGN 2S AP */ if (pAd->LatchRfRegs.Channel <= 14) { *ppTable = RateSwitchTable11BGN2S; *pTableSize = RateSwitchTable11BGN2S[0]; @@ -1020,16 +1020,16 @@ VOID MlmeSelectTxRateTable(IN PRTMP_ADAPTER pAd, } break; } - //else if ((pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && ((pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) - if ((pEntry->HTCapability.MCSSet[0] == 0xff) && ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->CommonCfg.TxStream == 1))) { // 11N 1S AP + /*else if ((pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && ((pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0x00) || (pAd->Antenna.field.TxPath == 1))) */ + if ((pEntry->HTCapability.MCSSet[0] == 0xff) && ((pEntry->HTCapability.MCSSet[1] == 0x00) || (pAd->CommonCfg.TxStream == 1))) { /* 11N 1S AP */ *ppTable = RateSwitchTable11N1S; *pTableSize = RateSwitchTable11N1S[0]; *pInitTxRateIdx = RateSwitchTable11N1S[1]; break; } - //else if ((pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0xff) && (pAd->Antenna.field.TxPath == 2)) - if ((pEntry->HTCapability.MCSSet[0] == 0xff) && (pEntry->HTCapability.MCSSet[1] == 0xff) && (pAd->CommonCfg.TxStream == 2)) { // 11N 2S AP + /*else if ((pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0xff) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0xff) && (pAd->Antenna.field.TxPath == 2)) */ + if ((pEntry->HTCapability.MCSSet[0] == 0xff) && (pEntry->HTCapability.MCSSet[1] == 0xff) && (pAd->CommonCfg.TxStream == 2)) { /* 11N 2S AP */ if (pAd->LatchRfRegs.Channel <= 14) { *ppTable = RateSwitchTable11N2S; *pTableSize = RateSwitchTable11N2S[0]; @@ -1043,33 +1043,33 @@ VOID MlmeSelectTxRateTable(IN PRTMP_ADAPTER pAd, break; } - //else if ((pAd->StaActive.SupRateLen == 4) && (pAd->StaActive.ExtRateLen == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) + /*else if ((pAd->StaActive.SupRateLen == 4) && (pAd->StaActive.ExtRateLen == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) */ if ((pEntry->RateLen == 4 || pAd->CommonCfg.PhyMode == PHY_11B) - //Iverson mark for Adhoc b mode,sta will use rate 54 Mbps when connect with sta b/g/n mode + /*Iverson mark for Adhoc b mode,sta will use rate 54 Mbps when connect with sta b/g/n mode */ /* && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0) */ - ) { // B only AP + ) { /* B only AP */ *ppTable = RateSwitchTable11B; *pTableSize = RateSwitchTable11B[0]; *pInitTxRateIdx = RateSwitchTable11B[1]; break; } - //else if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen > 8) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) + /*else if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen > 8) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) */ if ((pEntry->RateLen > 8) && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0) - ) { // B/G mixed AP + ) { /* B/G mixed AP */ *ppTable = RateSwitchTable11BG; *pTableSize = RateSwitchTable11BG[0]; *pInitTxRateIdx = RateSwitchTable11BG[1]; break; } - //else if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen == 8) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) + /*else if ((pAd->StaActive.SupRateLen + pAd->StaActive.ExtRateLen == 8) && (pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) */ if ((pEntry->RateLen == 8) && (pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0) - ) { // G only AP + ) { /* G only AP */ *ppTable = RateSwitchTable11G; *pTableSize = RateSwitchTable11G[0]; *pInitTxRateIdx = RateSwitchTable11G[1]; @@ -1078,8 +1078,8 @@ VOID MlmeSelectTxRateTable(IN PRTMP_ADAPTER pAd, } { - //else if ((pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) - if ((pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0)) { // Legacy mode + /*else if ((pAd->StaActive.SupportedPhyInfo.MCSSet[0] == 0) && (pAd->StaActive.SupportedPhyInfo.MCSSet[1] == 0)) */ + if ((pEntry->HTCapability.MCSSet[0] == 0) && (pEntry->HTCapability.MCSSet[1] == 0)) { /* Legacy mode */ if (pAd->CommonCfg.MaxTxRate <= RATE_11) { *ppTable = RateSwitchTable11B; *pTableSize = RateSwitchTable11B[0]; @@ -1154,11 +1154,11 @@ VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) that ATE need are not collected via this routine. */ #if defined(RT305x)||defined(RT3070) - // request by Gary, if Rssi0 > -42, BBP 82 need to be changed from 0x62 to 0x42, , bbp 67 need to be changed from 0x20 to 0x18 + /* request by Gary, if Rssi0 > -42, BBP 82 need to be changed from 0x62 to 0x42, , bbp 67 need to be changed from 0x20 to 0x18 */ if (!pAd->CommonCfg.HighPowerPatchDisabled) { #ifdef RT3070 if ((IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201))) -#endif // RT3070 // +#endif /* RT3070 // */ { if ((pAd->StaCfg.RssiSample.AvgRssi0 != 0) && (pAd->StaCfg.RssiSample.AvgRssi0 > @@ -1171,8 +1171,8 @@ VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) } #endif #ifdef PCIE_PS_SUPPORT -// don't perform idle-power-save mechanism within 3 min after driver initialization. -// This can make rebooter test more robust +/* don't perform idle-power-save mechanism within 3 min after driver initialization. */ +/* This can make rebooter test more robust */ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { if ((pAd->OpMode == OPMODE_STA) && (IDLE_ON(pAd)) && (pAd->Mlme.SyncMachine.CurrState == SYNC_IDLE) @@ -1190,7 +1190,7 @@ VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) AsicSendCommandToMcu(pAd, 0x30, PowerSafeCID, 0xff, 0x2); - // Wait command success + /* Wait command success */ AsicCheckCommanOk(pAd, PowerSafeCID); RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); @@ -1209,7 +1209,7 @@ VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) AsicSendCommandToMcu(pAd, 0x30, PowerSafeCID, 0xff, 0x02); - // Wait command success + /* Wait command success */ AsicCheckCommanOk(pAd, PowerSafeCID); RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); @@ -1229,10 +1229,10 @@ VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) pAd->MlmeAux.Ssid[2], pAd->MlmeAux.Ssid[3])); } } -#endif // PCIE_PS_SUPPORT // +#endif /* PCIE_PS_SUPPORT // */ if (pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_DISABLE) { - // WPA MIC error should block association attempt for 60 seconds + /* WPA MIC error should block association attempt for 60 seconds */ if (pAd->StaCfg.bBlockAssoc && RTMP_TIME_AFTER(pAd->Mlme.Now32, pAd->StaCfg.LastMicErrorTime + @@ -1260,18 +1260,18 @@ VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) pAd->RalinkCounters.OneSecTxFailCount; if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) { - // update channel quality for Roaming and UI LinkQuality display + /* update channel quality for Roaming and UI LinkQuality display */ MlmeCalculateChannelQuality(pAd, NULL, pAd->Mlme.Now32); } - // must be AFTER MlmeDynamicTxRateSwitching() because it needs to know if - // Radio is currently in noisy environment + /* must be AFTER MlmeDynamicTxRateSwitching() because it needs to know if */ + /* Radio is currently in noisy environment */ if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) AsicAdjustTxPower(pAd); if (INFRA_ON(pAd)) { - // Is PSM bit consistent with user power management policy? - // This is the only place that will set PSM bit ON. + /* Is PSM bit consistent with user power management policy? */ + /* This is the only place that will set PSM bit ON. */ if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) MlmeCheckPsmChange(pAd, pAd->Mlme.Now32); @@ -1290,18 +1290,18 @@ VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) ("MMCHK - No BEACON. restore R66 to the low bound(%d) \n", (0x2E + GET_LNA_GAIN(pAd)))); } - //if ((pAd->RalinkCounters.OneSecTxNoRetryOkCount == 0) && - // (pAd->RalinkCounters.OneSecTxRetryOkCount == 0)) + /*if ((pAd->RalinkCounters.OneSecTxNoRetryOkCount == 0) && */ + /* (pAd->RalinkCounters.OneSecTxRetryOkCount == 0)) */ { if (pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable) { - // When APSD is enabled, the period changes as 20 sec + /* When APSD is enabled, the period changes as 20 sec */ if ((pAd->Mlme.OneSecPeriodicRound % 20) == 8) RTMPSendNullFrame(pAd, pAd->CommonCfg.TxRate, TRUE); } else { - // Send out a NULL frame every 10 sec to inform AP that STA is still alive (Avoid being age out) + /* Send out a NULL frame every 10 sec to inform AP that STA is still alive (Avoid being age out) */ if ((pAd->Mlme.OneSecPeriodicRound % 10) == 8) { if (pAd->CommonCfg.bWmmCapable) RTMPSendNullFrame(pAd, @@ -1323,13 +1323,13 @@ VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) ("MMCHK - No BEACON. Dead CQI. Auto Recovery attempt #%ld\n", pAd->RalinkCounters.BadCQIAutoRecoveryCount)); - // Lost AP, send disconnect & link down event + /* Lost AP, send disconnect & link down event */ LinkDown(pAd, FALSE); RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0); - // RTMPPatchMacBbpBug(pAd); + /* RTMPPatchMacBbpBug(pAd); */ MlmeAutoReconnectLastSSID(pAd); } else if (CQI_IS_BAD(pAd->Mlme.ChannelQuality)) { pAd->RalinkCounters.BadCQIAutoRecoveryCount++; @@ -1350,7 +1350,7 @@ VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) pAd->StaCfg.RssiSample. LastRssi2); - // Scanning, ignore Roaming + /* Scanning, ignore Roaming */ if (!RTMP_TEST_FLAG (pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS) && (pAd->Mlme.SyncMachine.CurrState == SYNC_IDLE) @@ -1359,7 +1359,7 @@ VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) ("Rssi=%d, dBmToRoam=%d\n", MaxRssi, (CHAR) dBmToRoam)); - // Add auto seamless roaming + /* Add auto seamless roaming */ if (rv == FALSE) rv = MlmeCheckForFastRoaming(pAd); @@ -1377,9 +1377,9 @@ VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) } } } else if (ADHOC_ON(pAd)) { - // If all peers leave, and this STA becomes the last one in this IBSS, then change MediaState - // to DISCONNECTED. But still holding this IBSS (i.e. sending BEACON) so that other STAs can - // join later. + /* If all peers leave, and this STA becomes the last one in this IBSS, then change MediaState */ + /* to DISCONNECTED. But still holding this IBSS (i.e. sending BEACON) so that other STAs can */ + /* join later. */ if (RTMP_TIME_AFTER (pAd->Mlme.Now32, pAd->StaCfg.LastBeaconRxTime + ADHOC_BEACON_LOST_TIME) @@ -1411,7 +1411,7 @@ VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) MacTableDeleteEntry(pAd, pEntry->Aid, pEntry->Addr); } - } else // no INFRA nor ADHOC connection + } else /* no INFRA nor ADHOC connection */ { if (pAd->StaCfg.bScanReqIsFromWebUI && @@ -1451,10 +1451,10 @@ VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) &ScanReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; - // Reset Missed scan number + /* Reset Missed scan number */ pAd->StaCfg.LastScanTime = pAd->Mlme.Now32; - } else if (pAd->StaCfg.BssType == BSS_ADHOC) // Quit the forever scan when in a very clean room + } else if (pAd->StaCfg.BssType == BSS_ADHOC) /* Quit the forever scan when in a very clean room */ MlmeAutoReconnectLastSSID(pAd); } else if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) { if ((pAd->Mlme.OneSecPeriodicRound % 7) == 0) { @@ -1486,7 +1486,7 @@ SKIP_AUTO_SCAN_CONN: return; } -// Link down report +/* Link down report */ VOID LinkDownExec(IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) @@ -1516,10 +1516,10 @@ VOID LinkDownExec(IN PVOID SystemSpecific1, } } -// IRQL = DISPATCH_LEVEL +/* IRQL = DISPATCH_LEVEL */ VOID MlmeAutoScan(IN PRTMP_ADAPTER pAd) { - // check CntlMachine.CurrState to avoid collision with NDIS SetOID request + /* check CntlMachine.CurrState to avoid collision with NDIS SetOID request */ if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) { DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - Driver auto scan\n")); MlmeEnqueue(pAd, @@ -1531,7 +1531,7 @@ VOID MlmeAutoScan(IN PRTMP_ADAPTER pAd) } } -// IRQL = DISPATCH_LEVEL +/* IRQL = DISPATCH_LEVEL */ VOID MlmeAutoReconnectLastSSID(IN PRTMP_ADAPTER pAd) { if (pAd->StaCfg.bAutoConnectByBssid) { @@ -1550,7 +1550,7 @@ VOID MlmeAutoReconnectLastSSID(IN PRTMP_ADAPTER pAd) RTMP_MLME_HANDLER(pAd); } - // check CntlMachine.CurrState to avoid collision with NDIS SetOID request + /* check CntlMachine.CurrState to avoid collision with NDIS SetOID request */ else if ((pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) && (MlmeValidateSSID (pAd->MlmeAux.AutoReconnectSsid, @@ -1589,30 +1589,30 @@ VOID MlmeCheckForRoaming(IN PRTMP_ADAPTER pAd, IN ULONG Now32) BSS_ENTRY *pBss; DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeCheckForRoaming\n")); - // put all roaming candidates into RoamTab, and sort in RSSI order + /* put all roaming candidates into RoamTab, and sort in RSSI order */ BssTableInit(pRoamTab); for (i = 0; i < pAd->ScanTab.BssNr; i++) { pBss = &pAd->ScanTab.BssEntry[i]; if ((pBss->LastBeaconRxTime + pAd->StaCfg.BeaconLostTime) < Now32) - continue; // AP disappear + continue; /* AP disappear */ if (pBss->Rssi <= RSSI_THRESHOLD_FOR_ROAMING) - continue; // RSSI too weak. forget it. + continue; /* RSSI too weak. forget it. */ if (MAC_ADDR_EQUAL(pBss->Bssid, pAd->CommonCfg.Bssid)) - continue; // skip current AP + continue; /* skip current AP */ if (pBss->Rssi < (pAd->StaCfg.RssiSample.LastRssi0 + RSSI_DELTA)) - continue; // only AP with stronger RSSI is eligible for roaming + continue; /* only AP with stronger RSSI is eligible for roaming */ - // AP passing all above rules is put into roaming candidate table + /* AP passing all above rules is put into roaming candidate table */ NdisMoveMemory(&pRoamTab->BssEntry[pRoamTab->BssNr], pBss, sizeof(BSS_ENTRY)); pRoamTab->BssNr += 1; } if (pRoamTab->BssNr > 0) { - // check CntlMachine.CurrState to avoid collision with NDIS SetOID request + /* check CntlMachine.CurrState to avoid collision with NDIS SetOID request */ if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) { pAd->RalinkCounters.PoorCQIRoamingCount++; DBGPRINT(RT_DEBUG_TRACE, @@ -1647,26 +1647,26 @@ BOOLEAN MlmeCheckForFastRoaming(IN PRTMP_ADAPTER pAd) BSS_ENTRY *pBss; DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeCheckForFastRoaming\n")); - // put all roaming candidates into RoamTab, and sort in RSSI order + /* put all roaming candidates into RoamTab, and sort in RSSI order */ BssTableInit(pRoamTab); for (i = 0; i < pAd->ScanTab.BssNr; i++) { pBss = &pAd->ScanTab.BssEntry[i]; if ((pBss->Rssi <= -50) && (pBss->Channel == pAd->CommonCfg.Channel)) - continue; // RSSI too weak. forget it. + continue; /* RSSI too weak. forget it. */ if (MAC_ADDR_EQUAL(pBss->Bssid, pAd->CommonCfg.Bssid)) - continue; // skip current AP + continue; /* skip current AP */ if (!SSID_EQUAL (pBss->Ssid, pBss->SsidLen, pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen)) - continue; // skip different SSID + continue; /* skip different SSID */ if (pBss->Rssi < (RTMPMaxRssi (pAd, pAd->StaCfg.RssiSample.LastRssi0, pAd->StaCfg.RssiSample.LastRssi1, pAd->StaCfg.RssiSample.LastRssi2) + RSSI_DELTA)) - continue; // skip AP without better RSSI + continue; /* skip AP without better RSSI */ DBGPRINT(RT_DEBUG_TRACE, ("LastRssi0 = %d, pBss->Rssi = %d\n", @@ -1674,7 +1674,7 @@ BOOLEAN MlmeCheckForFastRoaming(IN PRTMP_ADAPTER pAd) pAd->StaCfg.RssiSample.LastRssi1, pAd->StaCfg.RssiSample.LastRssi2), pBss->Rssi)); - // AP passing all above rules is put into roaming candidate table + /* AP passing all above rules is put into roaming candidate table */ NdisMoveMemory(&pRoamTab->BssEntry[pRoamTab->BssNr], pBss, sizeof(BSS_ENTRY)); pRoamTab->BssNr += 1; @@ -1683,7 +1683,7 @@ BOOLEAN MlmeCheckForFastRoaming(IN PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_TRACE, ("<== MlmeCheckForFastRoaming (BssNr=%d)\n", pRoamTab->BssNr)); if (pRoamTab->BssNr > 0) { - // check CntlMachine.CurrState to avoid collision with NDIS SetOID request + /* check CntlMachine.CurrState to avoid collision with NDIS SetOID request */ if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) { pAd->RalinkCounters.PoorCQIRoamingCount++; DBGPRINT(RT_DEBUG_TRACE, @@ -1719,19 +1719,19 @@ VOID MlmeSetTxRate(IN PRTMP_ADAPTER pAd, pAd->StaCfg.HTPhyMode.field.STBC = STBC_NONE; if (ADHOC_ON(pAd)) { - // If peer adhoc is b-only mode, we can't send 11g rate. + /* If peer adhoc is b-only mode, we can't send 11g rate. */ pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; pEntry->HTPhyMode.field.STBC = STBC_NONE; - // - // For Adhoc MODE_CCK, driver will use AdhocBOnlyJoined flag to roll back to B only if necessary - // + /* */ + /* For Adhoc MODE_CCK, driver will use AdhocBOnlyJoined flag to roll back to B only if necessary */ + /* */ pEntry->HTPhyMode.field.MODE = pTxRate->Mode; pEntry->HTPhyMode.field.ShortGI = pAd->StaCfg.HTPhyMode.field.ShortGI; pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; - // Patch speed error in status page + /* Patch speed error in status page */ pAd->StaCfg.HTPhyMode.field.MODE = pEntry->HTPhyMode.field.MODE; } else { if (pTxRate->Mode <= MaxMode) @@ -1743,7 +1743,7 @@ VOID MlmeSetTxRate(IN PRTMP_ADAPTER pAd, else pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; - // Reexam each bandwidth's SGI support. + /* Reexam each bandwidth's SGI support. */ if (pAd->StaCfg.HTPhyMode.field.ShortGI == GI_400) { if ((pEntry->HTPhyMode.field.BW == BW_20) && @@ -1756,7 +1756,7 @@ VOID MlmeSetTxRate(IN PRTMP_ADAPTER pAd, (pEntry, fCLIENT_STATUS_SGI40_CAPABLE))) pAd->StaCfg.HTPhyMode.field.ShortGI = GI_800; } - // Turn RTS/CTS rate to 6Mbps. + /* Turn RTS/CTS rate to 6Mbps. */ if ((pEntry->HTPhyMode.field.MCS == 0) && (pAd->StaCfg.HTPhyMode.field.MCS != 0)) { pEntry->HTPhyMode.field.MCS = @@ -1857,13 +1857,13 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) MAC_TABLE_ENTRY *pEntry; RSSI_SAMPLE *pRssi = &pAd->StaCfg.RssiSample; - // - // walk through MAC table, see if need to change AP's TX rate toward each entry - // + /* */ + /* walk through MAC table, see if need to change AP's TX rate toward each entry */ + /* */ for (i = 1; i < MAX_LEN_OF_MAC_TABLE; i++) { pEntry = &pAd->MacTab.Content[i]; - // check if this entry need to switch rate automatically + /* check if this entry need to switch rate automatically */ if (RTMPCheckEntryEnableAutoRateSwitch(pAd, pEntry) == FALSE) continue; @@ -1872,7 +1872,7 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) pRssi->AvgRssi0, pRssi->AvgRssi1, pRssi->AvgRssi2); - // Update statistic counter + /* Update statistic counter */ RTMP_IO_READ32(pAd, TX_STA_CNT0, &TxStaCnt0.word); RTMP_IO_READ32(pAd, TX_STA_CNT1, &StaTx1.word); pAd->bUpdateBcnCntDone = TRUE; @@ -1894,9 +1894,9 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) pAd->WlanCounters.FailedCount.u.LowPart += TxStaCnt0.field.TxFailCount; - // if no traffic in the past 1-sec period, don't change TX rate, - // but clear all bad history. because the bad history may affect the next - // Chariot throughput test + /* if no traffic in the past 1-sec period, don't change TX rate, */ + /* but clear all bad history. because the bad history may affect the next */ + /* Chariot throughput test */ AccuTxTotalCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount + pAd->RalinkCounters.OneSecTxRetryOkCount + @@ -1979,27 +1979,27 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) if (CurrRateIdx >= TableSize) { CurrRateIdx = TableSize - 1; } - // When switch from Fixed rate -> auto rate, the REAL TX rate might be different from pAd->CommonCfg.TxRateIndex. - // So need to sync here. + /* When switch from Fixed rate -> auto rate, the REAL TX rate might be different from pAd->CommonCfg.TxRateIndex. */ + /* So need to sync here. */ pCurrTxRate = (PRTMP_TX_RATE_SWITCH) & pTable[(CurrRateIdx + 1) * 5]; if ((pEntry->HTPhyMode.field.MCS != pCurrTxRate->CurrMCS) - //&& (pAd->StaCfg.bAutoTxRateSwitch == TRUE) + /*&& (pAd->StaCfg.bAutoTxRateSwitch == TRUE) */ ) { - // Need to sync Real Tx rate and our record. - // Then return for next DRS. + /* Need to sync Real Tx rate and our record. */ + /* Then return for next DRS. */ pCurrTxRate = (PRTMP_TX_RATE_SWITCH) & pTable[(InitTxRateIdx + 1) * 5]; pEntry->CurrTxRateIndex = InitTxRateIdx; MlmeSetTxRate(pAd, pEntry, pCurrTxRate); - // reset all OneSecTx counters + /* reset all OneSecTx counters */ RESET_ONE_SEC_TX_CNT(pEntry); continue; } - // decide the next upgrade rate and downgrade rate, if any + /* decide the next upgrade rate and downgrade rate, if any */ if ((CurrRateIdx > 0) && (CurrRateIdx < (TableSize - 1))) { UpRateIdx = CurrRateIdx + 1; DownRateIdx = CurrRateIdx - 1; @@ -2026,27 +2026,27 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) TrainDown = pCurrTxRate->TrainDown; } - //pAd->DrsCounters.LastTimeTxRateChangeAction = pAd->DrsCounters.LastSecTxRateChangeAction; + /*pAd->DrsCounters.LastTimeTxRateChangeAction = pAd->DrsCounters.LastSecTxRateChangeAction; */ - // - // Keep the last time TxRateChangeAction status. - // + /* */ + /* Keep the last time TxRateChangeAction status. */ + /* */ pEntry->LastTimeTxRateChangeAction = pEntry->LastSecTxRateChangeAction; - // - // CASE 1. when TX samples are fewer than 15, then decide TX rate solely on RSSI - // (criteria copied from RT2500 for Netopia case) - // + /* */ + /* CASE 1. when TX samples are fewer than 15, then decide TX rate solely on RSSI */ + /* (criteria copied from RT2500 for Netopia case) */ + /* */ if (TxTotalCnt <= 15) { CHAR idx = 0; UCHAR TxRateIdx; UCHAR MCS0 = 0, MCS1 = 0, MCS2 = 0, MCS3 = 0, MCS4 = 0, MCS5 = 0, MCS6 = 0, MCS7 = 0; UCHAR MCS12 = 0, MCS13 = 0, MCS14 = 0, MCS15 = 0; - UCHAR MCS20 = 0, MCS21 = 0, MCS22 = 0, MCS23 = 0; // 3*3 + UCHAR MCS20 = 0, MCS21 = 0, MCS22 = 0, MCS23 = 0; /* 3*3 */ - // check the existence and index of each needed MCS + /* check the existence and index of each needed MCS */ while (idx < pTable[0]) { pCurrTxRate = (PRTMP_TX_RATE_SWITCH) & pTable[(idx + 1) * @@ -2067,8 +2067,8 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) } else if (pCurrTxRate->CurrMCS == MCS_6) { MCS6 = idx; } - //else if (pCurrTxRate->CurrMCS == MCS_7) - else if ((pCurrTxRate->CurrMCS == MCS_7) && (pCurrTxRate->ShortGI == GI_800)) // prevent the highest MCS using short GI when 1T and low throughput + /*else if (pCurrTxRate->CurrMCS == MCS_7) */ + else if ((pCurrTxRate->CurrMCS == MCS_7) && (pCurrTxRate->ShortGI == GI_800)) /* prevent the highest MCS using short GI when 1T and low throughput */ { MCS7 = idx; } else if (pCurrTxRate->CurrMCS == MCS_12) { @@ -2078,11 +2078,10 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) } else if (pCurrTxRate->CurrMCS == MCS_14) { MCS14 = idx; } - //else if ((pCurrTxRate->CurrMCS == MCS_15)/* && (pCurrTxRate->ShortGI == GI_800)*/) //we hope to use ShortGI as initial rate - else if ((pCurrTxRate->CurrMCS == MCS_15) && (pCurrTxRate->ShortGI == GI_800)) //we hope to use ShortGI as initial rate, however Atheros's chip has bugs when short GI + else if ((pCurrTxRate->CurrMCS == MCS_15) && (pCurrTxRate->ShortGI == GI_800)) /*we hope to use ShortGI as initial rate, however Atheros's chip has bugs when short GI */ { MCS15 = idx; - } else if (pCurrTxRate->CurrMCS == MCS_20) // 3*3 + } else if (pCurrTxRate->CurrMCS == MCS_20) /* 3*3 */ { MCS20 = idx; } else if (pCurrTxRate->CurrMCS == MCS_21) { @@ -2110,7 +2109,7 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) } /*if (MCS15) */ - if ((pTable == RateSwitchTable11BGN3S) || (pTable == RateSwitchTable11N3S) || (pTable == RateSwitchTable)) { // N mode with 3 stream // 3*3 + if ((pTable == RateSwitchTable11BGN3S) || (pTable == RateSwitchTable11N3S) || (pTable == RateSwitchTable)) { /* N mode with 3 stream // 3*3 */ if (MCS23 && (Rssi >= -70)) TxRateIdx = MCS23; else if (MCS22 && (Rssi >= -72)) @@ -2130,9 +2129,9 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) else TxRateIdx = MCS0; } -// else if ((pTable == RateSwitchTable11BGN2S) || (pTable == RateSwitchTable11BGN2SForABand) ||(pTable == RateSwitchTable11N2S) ||(pTable == RateSwitchTable11N2SForABand) || (pTable == RateSwitchTable)) - else if ((pTable == RateSwitchTable11BGN2S) || (pTable == RateSwitchTable11BGN2SForABand) || (pTable == RateSwitchTable11N2S) || (pTable == RateSwitchTable11N2SForABand)) // 3*3 - { // N mode with 2 stream +/* else if ((pTable == RateSwitchTable11BGN2S) || (pTable == RateSwitchTable11BGN2SForABand) ||(pTable == RateSwitchTable11N2S) ||(pTable == RateSwitchTable11N2SForABand) || (pTable == RateSwitchTable)) */ + else if ((pTable == RateSwitchTable11BGN2S) || (pTable == RateSwitchTable11BGN2SForABand) || (pTable == RateSwitchTable11N2S) || (pTable == RateSwitchTable11N2SForABand)) /* 3*3 */ + { /* N mode with 2 stream */ if (MCS15 && (Rssi >= (-70 + RssiOffset))) TxRateIdx = MCS15; else if (MCS14 && (Rssi >= (-72 + RssiOffset))) @@ -2151,7 +2150,7 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) TxRateIdx = MCS1; else TxRateIdx = MCS0; - } else if ((pTable == RateSwitchTable11BGN1S) || (pTable == RateSwitchTable11N1S)) { // N mode with 1 stream + } else if ((pTable == RateSwitchTable11BGN1S) || (pTable == RateSwitchTable11N1S)) { /* N mode with 1 stream */ if (MCS7 && (Rssi > (-72 + RssiOffset))) TxRateIdx = MCS7; else if (MCS6 && (Rssi > (-74 + RssiOffset))) @@ -2168,7 +2167,7 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) TxRateIdx = MCS1; else TxRateIdx = MCS0; - } else { // Legacy mode + } else { /* Legacy mode */ if (MCS7 && (Rssi > -70)) TxRateIdx = MCS7; else if (MCS6 && (Rssi > -74)) @@ -2177,7 +2176,7 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) TxRateIdx = MCS5; else if (MCS4 && (Rssi > -82)) TxRateIdx = MCS4; - else if (MCS4 == 0) // for B-only mode + else if (MCS4 == 0) /* for B-only mode */ TxRateIdx = MCS3; else if (MCS3 && (Rssi > -85)) TxRateIdx = MCS3; @@ -2189,7 +2188,7 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) TxRateIdx = MCS0; } - // if (TxRateIdx != pAd->CommonCfg.TxRateIndex) + /* if (TxRateIdx != pAd->CommonCfg.TxRateIndex) */ { pEntry->CurrTxRateIndex = TxRateIdx; pNextTxRate = @@ -2205,7 +2204,7 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) sizeof(UCHAR) * MAX_STEP_OF_TX_RATE_SWITCH); pEntry->fLastSecAccordingRSSI = TRUE; - // reset all OneSecTx counters + /* reset all OneSecTx counters */ RESET_ONE_SEC_TX_CNT(pEntry); continue; @@ -2214,7 +2213,7 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) if (pEntry->fLastSecAccordingRSSI == TRUE) { pEntry->fLastSecAccordingRSSI = FALSE; pEntry->LastSecTxRateChangeAction = 0; - // reset all OneSecTx counters + /* reset all OneSecTx counters */ RESET_ONE_SEC_TX_CNT(pEntry); continue; @@ -2225,29 +2224,29 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) pEntry->CurrTxRateStableTime++; - // downgrade TX quality if PER >= Rate-Down threshold + /* downgrade TX quality if PER >= Rate-Down threshold */ if (TxErrorRatio >= TrainDown) { bTrainUpDown = TRUE; pEntry->TxQuality[CurrRateIdx] = DRS_TX_QUALITY_WORST_BOUND; } - // upgrade TX quality if PER <= Rate-Up threshold + /* upgrade TX quality if PER <= Rate-Up threshold */ else if (TxErrorRatio <= TrainUp) { bTrainUpDown = TRUE; bUpgradeQuality = TRUE; if (pEntry->TxQuality[CurrRateIdx]) - pEntry->TxQuality[CurrRateIdx]--; // quality very good in CurrRate + pEntry->TxQuality[CurrRateIdx]--; /* quality very good in CurrRate */ if (pEntry->TxRateUpPenalty) pEntry->TxRateUpPenalty--; else if (pEntry->TxQuality[UpRateIdx]) - pEntry->TxQuality[UpRateIdx]--; // may improve next UP rate's quality + pEntry->TxQuality[UpRateIdx]--; /* may improve next UP rate's quality */ } pEntry->PER[CurrRateIdx] = (UCHAR) TxErrorRatio; if (bTrainUpDown) { - // perform DRS - consider TxRate Down first, then rate up. + /* perform DRS - consider TxRate Down first, then rate up. */ if ((CurrRateIdx != DownRateIdx) && (pEntry->TxQuality[CurrRateIdx] >= DRS_TX_QUALITY_WORST_BOUND)) { @@ -2260,11 +2259,11 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) } } while (FALSE); - // if rate-up happen, clear all bad history of all TX rates + /* if rate-up happen, clear all bad history of all TX rates */ if (pEntry->CurrTxRateIndex > CurrRateIdx) { pEntry->CurrTxRateStableTime = 0; pEntry->TxRateUpPenalty = 0; - pEntry->LastSecTxRateChangeAction = 1; // rate UP + pEntry->LastSecTxRateChangeAction = 1; /* rate UP */ NdisZeroMemory(pEntry->TxQuality, sizeof(USHORT) * MAX_STEP_OF_TX_RATE_SWITCH); @@ -2272,9 +2271,9 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) sizeof(UCHAR) * MAX_STEP_OF_TX_RATE_SWITCH); - // - // For TxRate fast train up - // + /* */ + /* For TxRate fast train up */ + /* */ if (!pAd->StaCfg.StaQuickResponeForRateUpTimerRunning) { RTMPSetTimer(&pAd->StaCfg. StaQuickResponeForRateUpTimer, @@ -2285,17 +2284,17 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) } bTxRateChanged = TRUE; } - // if rate-down happen, only clear DownRate's bad history + /* if rate-down happen, only clear DownRate's bad history */ else if (pEntry->CurrTxRateIndex < CurrRateIdx) { pEntry->CurrTxRateStableTime = 0; - pEntry->TxRateUpPenalty = 0; // no penalty - pEntry->LastSecTxRateChangeAction = 2; // rate DOWN + pEntry->TxRateUpPenalty = 0; /* no penalty */ + pEntry->LastSecTxRateChangeAction = 2; /* rate DOWN */ pEntry->TxQuality[pEntry->CurrTxRateIndex] = 0; pEntry->PER[pEntry->CurrTxRateIndex] = 0; - // - // For TxRate fast train down - // + /* */ + /* For TxRate fast train down */ + /* */ if (!pAd->StaCfg.StaQuickResponeForRateUpTimerRunning) { RTMPSetTimer(&pAd->StaCfg. StaQuickResponeForRateUpTimer, @@ -2306,7 +2305,7 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) } bTxRateChanged = TRUE; } else { - pEntry->LastSecTxRateChangeAction = 0; // rate no change + pEntry->LastSecTxRateChangeAction = 0; /* rate no change */ bTxRateChanged = FALSE; } @@ -2314,7 +2313,7 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) { UCHAR tmpTxRate; - // to fix tcp ack issue + /* to fix tcp ack issue */ if (!bTxRateChanged && (pAd->RalinkCounters.OneSecReceivedByteCount > (pAd->RalinkCounters. @@ -2339,7 +2338,7 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) if (bTxRateChanged && pNextTxRate) { MlmeSetTxRate(pAd, pEntry, pNextTxRate); } - // reset all OneSecTx counters + /* reset all OneSecTx counters */ RESET_ONE_SEC_TX_CNT(pEntry); } } @@ -2369,7 +2368,7 @@ VOID StaQuickResponeForRateUpExec(IN PVOID SystemSpecific1, UCHAR UpRateIdx = 0, DownRateIdx = 0, CurrRateIdx = 0; ULONG TxTotalCnt; ULONG TxErrorRatio = 0; - BOOLEAN bTxRateChanged; //, bUpgradeQuality = FALSE; + BOOLEAN bTxRateChanged; /*, bUpgradeQuality = FALSE; */ PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate = NULL; PUCHAR pTable; UCHAR TableSize = 0; @@ -2383,13 +2382,13 @@ VOID StaQuickResponeForRateUpExec(IN PVOID SystemSpecific1, pAd->StaCfg.StaQuickResponeForRateUpTimerRunning = FALSE; - // - // walk through MAC table, see if need to change AP's TX rate toward each entry - // + /* */ + /* walk through MAC table, see if need to change AP's TX rate toward each entry */ + /* */ for (i = 1; i < MAX_LEN_OF_MAC_TABLE; i++) { pEntry = &pAd->MacTab.Content[i]; - // check if this entry need to switch rate automatically + /* check if this entry need to switch rate automatically */ if (RTMPCheckEntryEnableAutoRateSwitch(pAd, pEntry) == FALSE) continue; @@ -2409,7 +2408,7 @@ VOID StaQuickResponeForRateUpExec(IN PVOID SystemSpecific1, MlmeSelectTxRateTable(pAd, pEntry, &pTable, &TableSize, &InitTxRateIdx); - // decide the next upgrade rate and downgrade rate, if any + /* decide the next upgrade rate and downgrade rate, if any */ if ((CurrRateIdx > 0) && (CurrRateIdx < (TableSize - 1))) { UpRateIdx = CurrRateIdx + 1; DownRateIdx = CurrRateIdx - 1; @@ -2437,7 +2436,7 @@ VOID StaQuickResponeForRateUpExec(IN PVOID SystemSpecific1, } if (pAd->MacTab.Size == 1) { - // Update statistic counter + /* Update statistic counter */ RTMP_IO_READ32(pAd, TX_STA_CNT0, &TxStaCnt0.word); RTMP_IO_READ32(pAd, TX_STA_CNT1, &StaTx1.word); @@ -2475,10 +2474,10 @@ VOID StaQuickResponeForRateUpExec(IN PVOID SystemSpecific1, TxTotalCnt; } - // - // CASE 1. when TX samples are fewer than 15, then decide TX rate solely on RSSI - // (criteria copied from RT2500 for Netopia case) - // + /* */ + /* CASE 1. when TX samples are fewer than 15, then decide TX rate solely on RSSI */ + /* (criteria copied from RT2500 for Netopia case) */ + /* */ if (TxTotalCnt <= 12) { NdisZeroMemory(pAd->DrsCounters.TxQuality, sizeof(USHORT) * @@ -2511,7 +2510,7 @@ VOID StaQuickResponeForRateUpExec(IN PVOID SystemSpecific1, else ratio = 4; - // downgrade TX quality if PER >= Rate-Down threshold + /* downgrade TX quality if PER >= Rate-Down threshold */ if (TxErrorRatio >= TrainDown) { pAd->DrsCounters.TxQuality[CurrRateIdx] = DRS_TX_QUALITY_WORST_BOUND; @@ -2522,7 +2521,7 @@ VOID StaQuickResponeForRateUpExec(IN PVOID SystemSpecific1, OneSecTxNoRetryOKRationCount = (TxSuccess * ratio); - // perform DRS - consider TxRate Down first, then rate up. + /* perform DRS - consider TxRate Down first, then rate up. */ if ((pAd->DrsCounters.LastSecTxRateChangeAction == 1) && (CurrRateIdx != DownRateIdx)) { if ((pAd->DrsCounters.LastTxOkCount + 2) >= @@ -2548,7 +2547,7 @@ VOID StaQuickResponeForRateUpExec(IN PVOID SystemSpecific1, } } while (FALSE); - // if rate-up happen, clear all bad history of all TX rates + /* if rate-up happen, clear all bad history of all TX rates */ if (pAd->CommonCfg.TxRateIndex > CurrRateIdx) { pAd->DrsCounters.TxRateUpPenalty = 0; NdisZeroMemory(pAd->DrsCounters.TxQuality, @@ -2559,13 +2558,13 @@ VOID StaQuickResponeForRateUpExec(IN PVOID SystemSpecific1, MAX_STEP_OF_TX_RATE_SWITCH); bTxRateChanged = TRUE; } - // if rate-down happen, only clear DownRate's bad history + /* if rate-down happen, only clear DownRate's bad history */ else if (pAd->CommonCfg.TxRateIndex < CurrRateIdx) { DBGPRINT_RAW(RT_DEBUG_TRACE, ("QuickDRS: --TX rate from %d to %d \n", CurrRateIdx, pAd->CommonCfg.TxRateIndex)); - pAd->DrsCounters.TxRateUpPenalty = 0; // no penalty + pAd->DrsCounters.TxRateUpPenalty = 0; /* no penalty */ pAd->DrsCounters.TxQuality[pAd->CommonCfg.TxRateIndex] = 0; pAd->DrsCounters.PER[pAd->CommonCfg.TxRateIndex] = 0; @@ -2606,18 +2605,18 @@ VOID MlmeCheckPsmChange(IN PRTMP_ADAPTER pAd, IN ULONG Now32) { ULONG PowerMode; - // condition - - // 1. Psm maybe ON only happen in INFRASTRUCTURE mode - // 2. user wants either MAX_PSP or FAST_PSP - // 3. but current psm is not in PWR_SAVE - // 4. CNTL state machine is not doing SCANning - // 5. no TX SUCCESS event for the past 1-sec period + /* condition - */ + /* 1. Psm maybe ON only happen in INFRASTRUCTURE mode */ + /* 2. user wants either MAX_PSP or FAST_PSP */ + /* 3. but current psm is not in PWR_SAVE */ + /* 4. CNTL state machine is not doing SCANning */ + /* 5. no TX SUCCESS event for the past 1-sec period */ PowerMode = pAd->StaCfg.WindowsPowerMode; if (INFRA_ON(pAd) && (PowerMode != Ndis802_11PowerModeCAM) && (pAd->StaCfg.Psm == PWR_ACTIVE) && -// (! RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) +/* (! RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) */ (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) && RTMP_TEST_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP) /*&& @@ -2637,8 +2636,8 @@ VOID MlmeCheckPsmChange(IN PRTMP_ADAPTER pAd, IN ULONG Now32) } } -// IRQL = PASSIVE_LEVEL -// IRQL = DISPATCH_LEVEL +/* IRQL = PASSIVE_LEVEL */ +/* IRQL = DISPATCH_LEVEL */ VOID MlmeSetPsmBit(IN PRTMP_ADAPTER pAd, IN USHORT psm) { AUTO_RSP_CFG_STRUC csr4; @@ -2683,7 +2682,7 @@ VOID MlmeCalculateChannelQuality(IN PRTMP_ADAPTER pAd, UINT32 OneSecTxFailCount = 0; UINT32 OneSecRxOkCnt = 0; UINT32 OneSecRxFcsErrCnt = 0; - ULONG ChannelQuality = 0; // 0..100, Channel Quality Indication for Roaming + ULONG ChannelQuality = 0; /* 0..100, Channel Quality Indication for Roaming */ ULONG BeaconLostTime = pAd->StaCfg.BeaconLostTime; if (pAd->OpMode == OPMODE_STA) { @@ -2699,9 +2698,9 @@ VOID MlmeCalculateChannelQuality(IN PRTMP_ADAPTER pAd, MaxRssi = RTMPMaxRssi(pAd, pRssiSample->LastRssi0, pRssiSample->LastRssi1, pRssiSample->LastRssi2); - // - // calculate TX packet error ratio and TX retry ratio - if too few TX samples, skip TX related statistics - // + /* */ + /* calculate TX packet error ratio and TX retry ratio - if too few TX samples, skip TX related statistics */ + /* */ TxOkCnt = OneSecTxNoRetryOkCount + OneSecTxRetryOkCount; TxCnt = TxOkCnt + OneSecTxFailCount; if (TxCnt < 5) { @@ -2712,26 +2711,26 @@ VOID MlmeCalculateChannelQuality(IN PRTMP_ADAPTER pAd, TxPRR = ((TxCnt - OneSecTxNoRetryOkCount) * 100) / TxCnt; } - // - // calculate RX PER - don't take RxPER into consideration if too few sample - // + /* */ + /* calculate RX PER - don't take RxPER into consideration if too few sample */ + /* */ RxCnt = OneSecRxOkCnt + OneSecRxFcsErrCnt; if (RxCnt < 5) RxPER = 0; else RxPER = (OneSecRxFcsErrCnt * 100) / RxCnt; - // - // decide ChannelQuality based on: 1)last BEACON received time, 2)last RSSI, 3)TxPER, and 4)RxPER - // - if ((pAd->OpMode == OPMODE_STA) && INFRA_ON(pAd) && (OneSecTxNoRetryOkCount < 2) && // no heavy traffic + /* */ + /* decide ChannelQuality based on: 1)last BEACON received time, 2)last RSSI, 3)TxPER, and 4)RxPER */ + /* */ + if ((pAd->OpMode == OPMODE_STA) && INFRA_ON(pAd) && (OneSecTxNoRetryOkCount < 2) && /* no heavy traffic */ ((pAd->StaCfg.LastBeaconRxTime + BeaconLostTime) < Now32)) { DBGPRINT(RT_DEBUG_TRACE, ("BEACON lost > %ld msec with TxOkCnt=%ld -> CQI=0\n", BeaconLostTime, TxOkCnt)); ChannelQuality = 0; } else { - // Normalize Rssi + /* Normalize Rssi */ if (MaxRssi > -40) NorRssi = 100; else if (MaxRssi < -90) @@ -2739,7 +2738,7 @@ VOID MlmeCalculateChannelQuality(IN PRTMP_ADAPTER pAd, else NorRssi = (MaxRssi + 90) * 2; - // ChannelQuality = W1*RSSI + W2*TxPRR + W3*RxPER (RSSI 0..100), (TxPER 100..0), (RxPER 100..0) + /* ChannelQuality = W1*RSSI + W2*TxPRR + W3*RxPER (RSSI 0..100), (TxPER 100..0), (RxPER 100..0) */ ChannelQuality = (RSSI_WEIGHTING * NorRssi + TX_WEIGHTING * (100 - TxPRR) + RX_WEIGHTING * (100 - RxPER)) / 100; @@ -2751,16 +2750,16 @@ VOID MlmeCalculateChannelQuality(IN PRTMP_ADAPTER pAd, } -// IRQL = DISPATCH_LEVEL +/* IRQL = DISPATCH_LEVEL */ VOID MlmeSetTxPreamble(IN PRTMP_ADAPTER pAd, IN USHORT TxPreamble) { AUTO_RSP_CFG_STRUC csr4; - // - // Always use Long preamble before verifiation short preamble functionality works well. - // Todo: remove the following line if short preamble functionality works - // - //TxPreamble = Rt802_11PreambleLong; + /* */ + /* Always use Long preamble before verifiation short preamble functionality works well. */ + /* Todo: remove the following line if short preamble functionality works */ + /* */ + /*TxPreamble = Rt802_11PreambleLong; */ RTMP_IO_READ32(pAd, AUTO_RSP_CFG, &csr4.word); if (TxPreamble == Rt802_11PreambleLong) { @@ -2769,7 +2768,7 @@ VOID MlmeSetTxPreamble(IN PRTMP_ADAPTER pAd, IN USHORT TxPreamble) OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); csr4.field.AutoResponderPreamble = 0; } else { - // NOTE: 1Mbps should always use long preamble + /* NOTE: 1Mbps should always use long preamble */ DBGPRINT(RT_DEBUG_TRACE, ("MlmeSetTxPreamble (= SHORT PREAMBLE)\n")); OPSTATUS_SET_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); @@ -2796,7 +2795,7 @@ VOID UpdateBasicRateBitmap(IN PRTMP_ADAPTER pAdapter) ULONG bitmap = pAdapter->CommonCfg.BasicRateBitmap; /* if A mode, always use fix BasicRateBitMap */ - //if (pAdapter->CommonCfg.Channel == PHY_11A) + /*if (pAdapter->CommonCfg.Channel == PHY_11A) */ if (pAdapter->CommonCfg.Channel > 14) pAdapter->CommonCfg.BasicRateBitmap = 0x150; /* 6, 12, 24M */ /* End of if */ @@ -2828,10 +2827,10 @@ VOID UpdateBasicRateBitmap(IN PRTMP_ADAPTER pAdapter) } /* End of for */ } /* End of UpdateBasicRateBitmap */ -// IRQL = PASSIVE_LEVEL -// IRQL = DISPATCH_LEVEL -// bLinkUp is to identify the inital link speed. -// TRUE indicates the rate update at linkup, we should not try to set the rate at 54Mbps. +/* IRQL = PASSIVE_LEVEL */ +/* IRQL = DISPATCH_LEVEL */ +/* bLinkUp is to identify the inital link speed. */ +/* TRUE indicates the rate update at linkup, we should not try to set the rate at 54Mbps. */ VOID MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, IN UCHAR apidx) { int i, num; @@ -2846,7 +2845,7 @@ VOID MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, IN UCHAR apidx) BOOLEAN *auto_rate_cur_p; UCHAR HtMcs = MCS_AUTO; - // find max desired rate + /* find max desired rate */ UpdateBasicRateBitmap(pAd); num = 0; @@ -2901,14 +2900,14 @@ VOID MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, IN UCHAR apidx) Rate = RATE_54; num++; break; - //default: Rate = RATE_1; break; + /*default: Rate = RATE_1; break; */ } if (MaxDesire < Rate) MaxDesire = Rate; } -//=========================================================================== -//=========================================================================== +/*=========================================================================== */ +/*=========================================================================== */ { pHtPhy = &pAd->StaCfg.HTPhyMode; pMaxHtPhy = &pAd->StaCfg.MaxHTPhyMode; @@ -2929,25 +2928,25 @@ VOID MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, IN UCHAR apidx) pMaxHtPhy->word = 0; pHtPhy->word = 0; - // Auto rate switching is enabled only if more than one DESIRED RATES are - // specified; otherwise disabled + /* Auto rate switching is enabled only if more than one DESIRED RATES are */ + /* specified; otherwise disabled */ if (num <= 1) { - //OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); - //pAd->CommonCfg.bAutoTxRateSwitch = FALSE; + /*OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); */ + /*pAd->CommonCfg.bAutoTxRateSwitch = FALSE; */ *auto_rate_cur_p = FALSE; } else { - //OPSTATUS_SET_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); - //pAd->CommonCfg.bAutoTxRateSwitch = TRUE; + /*OPSTATUS_SET_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); */ + /*pAd->CommonCfg.bAutoTxRateSwitch = TRUE; */ *auto_rate_cur_p = TRUE; } if (HtMcs != MCS_AUTO) { - //OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); - //pAd->CommonCfg.bAutoTxRateSwitch = FALSE; + /*OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); */ + /*pAd->CommonCfg.bAutoTxRateSwitch = FALSE; */ *auto_rate_cur_p = FALSE; } else { - //OPSTATUS_SET_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); - //pAd->CommonCfg.bAutoTxRateSwitch = TRUE; + /*OPSTATUS_SET_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED); */ + /*pAd->CommonCfg.bAutoTxRateSwitch = TRUE; */ *auto_rate_cur_p = TRUE; } @@ -2963,7 +2962,7 @@ VOID MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, IN UCHAR apidx) ExtRateLen = pAd->CommonCfg.ExtRateLen; } - // find max supported rate + /* find max supported rate */ for (i = 0; i < SupRateLen; i++) { switch (pSupRate[i] & 0x7f) { case 2: @@ -3106,11 +3105,11 @@ VOID MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, IN UCHAR apidx) RTMP_IO_WRITE32(pAd, LEGACY_BASIC_RATE, BasicRateBitmap); - // bug fix - // pAd->CommonCfg.BasicRateBitmap = BasicRateBitmap; + /* bug fix */ + /* pAd->CommonCfg.BasicRateBitmap = BasicRateBitmap; */ - // calculate the exptected ACK rate for each TX rate. This info is used to caculate - // the DURATION field of outgoing uniicast DATA/MGMT frame + /* calculate the exptected ACK rate for each TX rate. This info is used to caculate */ + /* the DURATION field of outgoing uniicast DATA/MGMT frame */ for (i = 0; i < MAX_LEN_OF_SUPPORTED_RATES; i++) { if (BasicRateBitmap & (0x01 << i)) CurrBasicRate = (UCHAR) i; @@ -3120,21 +3119,19 @@ VOID MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, IN UCHAR apidx) DBGPRINT(RT_DEBUG_TRACE, ("MlmeUpdateTxRates[MaxSupport = %d] = MaxDesire %d Mbps\n", RateIdToMbps[MaxSupport], RateIdToMbps[MaxDesire])); - // max tx rate = min {max desire rate, max supported rate} + /* max tx rate = min {max desire rate, max supported rate} */ if (MaxSupport < MaxDesire) pAd->CommonCfg.MaxTxRate = MaxSupport; else pAd->CommonCfg.MaxTxRate = MaxDesire; pAd->CommonCfg.MinTxRate = MinSupport; - // 2003-07-31 john - 2500 doesn't have good sensitivity at high OFDM rates. to increase the success - // ratio of initial DHCP packet exchange, TX rate starts from a lower rate depending - // on average RSSI - // 1. RSSI >= -70db, start at 54 Mbps (short distance) - // 2. -70 > RSSI >= -75, start at 24 Mbps (mid distance) - // 3. -75 > RSSI, start at 11 Mbps (long distance) - //if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED)/* && - // OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)*/) + /* 2003-07-31 john - 2500 doesn't have good sensitivity at high OFDM rates. to increase the success */ + /* ratio of initial DHCP packet exchange, TX rate starts from a lower rate depending */ + /* on average RSSI */ + /* 1. RSSI >= -70db, start at 54 Mbps (short distance) */ + /* 2. -70 > RSSI >= -75, start at 24 Mbps (mid distance) */ + /* 3. -75 > RSSI, start at 11 Mbps (long distance) */ if (*auto_rate_cur_p) { short dbm = 0; @@ -3150,7 +3147,7 @@ VOID MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, IN UCHAR apidx) else if (dbm < -70) pAd->CommonCfg.TxRate = RATE_24; - // should never exceed MaxTxRate (consider 11B-only mode) + /* should never exceed MaxTxRate (consider 11B-only mode) */ if (pAd->CommonCfg.TxRate > pAd->CommonCfg.MaxTxRate) pAd->CommonCfg.TxRate = pAd->CommonCfg.MaxTxRate; @@ -3206,11 +3203,11 @@ VOID MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, IN UCHAR apidx) pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_CCK; pAd->CommonCfg.MlmeTransmit.field.MCS = RATE_1; -//#ifdef WIFI_TEST +/*#ifdef WIFI_TEST */ pAd->CommonCfg.RtsRate = RATE_11; -//#else -// pAd->CommonCfg.RtsRate = RATE_1; -//#endif +/*#else */ +/* pAd->CommonCfg.RtsRate = RATE_1; */ +/*#endif */ break; case PHY_11G: case PHY_11A: @@ -3242,7 +3239,7 @@ VOID MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, IN UCHAR apidx) OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; } break; - default: // error + default: /* error */ pAd->CommonCfg.MlmeRate = RATE_6; pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; pAd->CommonCfg.MlmeTransmit.field.MCS = @@ -3250,9 +3247,9 @@ VOID MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, IN UCHAR apidx) pAd->CommonCfg.RtsRate = RATE_1; break; } - // - // Keep Basic Mlme Rate. - // + /* */ + /* Keep Basic Mlme Rate. */ + /* */ pAd->MacTab.Content[MCAST_WCID].HTPhyMode.word = pAd->CommonCfg.MlmeTransmit.word; if (pAd->CommonCfg.MlmeTransmit.field.MODE == MODE_OFDM) @@ -3297,8 +3294,8 @@ VOID MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, IN UCHAR apidx) */ VOID MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) { - UCHAR StbcMcs; //j, StbcMcs, bitmask; - CHAR i; // 3*3 + UCHAR StbcMcs; /*j, StbcMcs, bitmask; */ + CHAR i; /* 3*3 */ RT_HT_CAPABILITY *pRtHtCap = NULL; RT_HT_PHY_INFO *pActiveHtPhy = NULL; ULONG BasicMCS; @@ -3354,7 +3351,7 @@ VOID MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) pMaxHtPhy->field.STBC = STBC_NONE; } - // Decide MAX ht rate. + /* Decide MAX ht rate. */ if ((pRtHtCap->GF) && (pAd->CommonCfg.DesiredHtPhy.GF)) pMaxHtPhy->field.MODE = MODE_HTGREENFIELD; else @@ -3379,7 +3376,7 @@ VOID MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) pMaxHtPhy->field.MCS = 32; } - for (i = 23; i >= 0; i--) // 3*3 + for (i = 23; i >= 0; i--) /* 3*3 */ { j = i / 8; bitmask = (1 << (i - (j * 8))); @@ -3394,12 +3391,12 @@ VOID MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) break; } - // Copy MIN ht rate. rt2860??? + /* Copy MIN ht rate. rt2860??? */ pMinHtPhy->field.BW = BW_20; pMinHtPhy->field.MCS = 0; pMinHtPhy->field.STBC = 0; pMinHtPhy->field.ShortGI = 0; - //If STA assigns fixed rate. update to fixed here. + /*If STA assigns fixed rate. update to fixed here. */ if ((pAd->OpMode == OPMODE_STA) && (pDesireHtPhy->MCSSet[0] != 0xff)) { if (pDesireHtPhy->MCSSet[4] != 0) { pMaxHtPhy->field.MCS = 32; @@ -3409,7 +3406,7 @@ VOID MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) pMinHtPhy->field.MCS)); } - for (i = 23; (CHAR) i >= 0; i--) // 3*3 + for (i = 23; (CHAR) i >= 0; i--) /* 3*3 */ { j = i / 8; bitmask = (1 << (i - (j * 8))); @@ -3424,14 +3421,14 @@ VOID MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) } } - // Decide ht rate + /* Decide ht rate */ pHtPhy->field.STBC = pMaxHtPhy->field.STBC; pHtPhy->field.BW = pMaxHtPhy->field.BW; pHtPhy->field.MODE = pMaxHtPhy->field.MODE; pHtPhy->field.MCS = pMaxHtPhy->field.MCS; pHtPhy->field.ShortGI = pMaxHtPhy->field.ShortGI; - // use default now. rt2860 + /* use default now. rt2860 */ if (pDesireHtPhy->MCSSet[0] != 0xff) *auto_rate_cur_p = FALSE; else @@ -3464,21 +3461,21 @@ VOID BATableInit(IN PRTMP_ADAPTER pAd, IN BA_TABLE * Tab) } } -// IRQL = DISPATCH_LEVEL +/* IRQL = DISPATCH_LEVEL */ VOID MlmeRadioOff(IN PRTMP_ADAPTER pAd) { RTMP_MLME_RADIO_OFF(pAd); } -// IRQL = DISPATCH_LEVEL +/* IRQL = DISPATCH_LEVEL */ VOID MlmeRadioOn(IN PRTMP_ADAPTER pAd) { RTMP_MLME_RADIO_ON(pAd); } -// =========================================================================================== -// bss_table.c -// =========================================================================================== +/* =========================================================================================== */ +/* bss_table.c */ +/* =========================================================================================== */ /*! \brief initialize BSS table * \param p_tab pointer to the table @@ -3498,7 +3495,7 @@ VOID BssTableInit(IN BSS_TABLE * Tab) Tab->BssOverlapNr = 0; for (i = 0; i < MAX_LEN_OF_BSS_TABLE; i++) { NdisZeroMemory(&Tab->BssEntry[i], sizeof(BSS_ENTRY)); - Tab->BssEntry[i].Rssi = -127; // initial the rssi as a minimum value + Tab->BssEntry[i].Rssi = -127; /* initial the rssi as a minimum value */ } } @@ -3518,10 +3515,10 @@ ULONG BssTableSearch(IN BSS_TABLE * Tab, IN PUCHAR pBssid, IN UCHAR Channel) UCHAR i; for (i = 0; i < Tab->BssNr; i++) { - // - // Some AP that support A/B/G mode that may used the same BSSID on 11A and 11B/G. - // We should distinguish this case. - // + /* */ + /* Some AP that support A/B/G mode that may used the same BSSID on 11A and 11B/G. */ + /* We should distinguish this case. */ + /* */ if ((((Tab->BssEntry[i].Channel <= 14) && (Channel <= 14)) || ((Tab->BssEntry[i].Channel > 14) && (Channel > 14))) && MAC_ADDR_EQUAL(Tab->BssEntry[i].Bssid, pBssid)) { @@ -3538,10 +3535,10 @@ ULONG BssSsidTableSearch(IN BSS_TABLE * Tab, UCHAR i; for (i = 0; i < Tab->BssNr; i++) { - // - // Some AP that support A/B/G mode that may used the same BSSID on 11A and 11B/G. - // We should distinguish this case. - // + /* */ + /* Some AP that support A/B/G mode that may used the same BSSID on 11A and 11B/G. */ + /* We should distinguish this case. */ + /* */ if ((((Tab->BssEntry[i].Channel <= 14) && (Channel <= 14)) || ((Tab->BssEntry[i].Channel > 14) && (Channel > 14))) && MAC_ADDR_EQUAL(Tab->BssEntry[i].Bssid, pBssid) && @@ -3593,7 +3590,7 @@ ULONG BssSsidTableSearchBySSID(IN BSS_TABLE * Tab, return (ULONG) BSS_NOT_FOUND; } -// IRQL = DISPATCH_LEVEL +/* IRQL = DISPATCH_LEVEL */ VOID BssTableDeleteEntry(IN OUT BSS_TABLE * Tab, IN PUCHAR pBssid, IN UCHAR Channel) { @@ -3635,13 +3632,13 @@ VOID BATableDeleteORIEntry(IN OUT PRTMP_ADAPTER pAd, DBGPRINT(RT_DEBUG_TRACE, ("BATableDeleteORIEntry numAsOriginator= %ld\n", pAd->BATable.numAsRecipient)); - // Erase Bitmap flag. + /* Erase Bitmap flag. */ } - pAd->MacTab.Content[pBAORIEntry->Wcid].TXBAbitmap &= (~(1 << (pBAORIEntry->TID))); // If STA mode, erase flag here - pAd->MacTab.Content[pBAORIEntry->Wcid].BAOriWcidArray[pBAORIEntry->TID] = 0; // If STA mode, erase flag here + pAd->MacTab.Content[pBAORIEntry->Wcid].TXBAbitmap &= (~(1 << (pBAORIEntry->TID))); /* If STA mode, erase flag here */ + pAd->MacTab.Content[pBAORIEntry->Wcid].BAOriWcidArray[pBAORIEntry->TID] = 0; /* If STA mode, erase flag here */ pBAORIEntry->ORI_BA_Status = Originator_NONE; pBAORIEntry->Token = 1; - // Not clear Sequence here. + /* Not clear Sequence here. */ NdisReleaseSpinLock(&pAd->BATabLock); } } @@ -3655,7 +3652,7 @@ VOID BATableDeleteORIEntry(IN OUT PRTMP_ADAPTER pAd, IRQL = DISPATCH_LEVEL */ -VOID BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, IN PUCHAR pBssid, IN CHAR Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN USHORT BeaconPeriod, IN PCF_PARM pCfParm, IN USHORT AtimWin, IN USHORT CapabilityInfo, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, // AP might use this additional ht info IE +VOID BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, IN PUCHAR pBssid, IN CHAR Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN USHORT BeaconPeriod, IN PCF_PARM pCfParm, IN USHORT AtimWin, IN USHORT CapabilityInfo, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ IN UCHAR HtCapabilityLen, IN UCHAR AddHtInfoLen, IN UCHAR NewExtChanOffset, @@ -3669,13 +3666,13 @@ VOID BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, IN PUCHAR pBssid, I IN USHORT LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE) { COPY_MAC_ADDR(pBss->Bssid, pBssid); - // Default Hidden SSID to be TRUE, it will be turned to FALSE after coping SSID + /* Default Hidden SSID to be TRUE, it will be turned to FALSE after coping SSID */ pBss->Hidden = 1; if (SsidLen > 0) { - // For hidden SSID AP, it might send beacon with SSID len equal to 0 - // Or send beacon /probe response with SSID len matching real SSID length, - // but SSID is all zero. such as "00-00-00-00" with length 4. - // We have to prevent this case overwrite correct table + /* For hidden SSID AP, it might send beacon with SSID len equal to 0 */ + /* Or send beacon /probe response with SSID len matching real SSID length, */ + /* but SSID is all zero. such as "00-00-00-00" with length 4. */ + /* We have to prevent this case overwrite correct table */ if (NdisEqualMemory(Ssid, ZeroSsid, SsidLen) == 0) { NdisZeroMemory(pBss->Ssid, MAX_LEN_OF_SSID); NdisMoveMemory(pBss->Ssid, Ssid, SsidLen); @@ -3698,8 +3695,8 @@ VOID BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, IN PUCHAR pBssid, I } pBss->CapabilityInfo = CapabilityInfo; - // The privacy bit indicate security is ON, it maight be WEP, TKIP or AES - // Combine with AuthMode, they will decide the connection methods. + /* The privacy bit indicate security is ON, it maight be WEP, TKIP or AES */ + /* Combine with AuthMode, they will decide the connection methods. */ pBss->Privacy = CAP_IS_PRIVACY_ON(pBss->CapabilityInfo); ASSERT(SupRateLen <= MAX_LEN_OF_SUPPORTED_RATES); if (SupRateLen <= MAX_LEN_OF_SUPPORTED_RATES) @@ -3715,15 +3712,15 @@ VOID BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, IN PUCHAR pBssid, I pBss->Channel = Channel; pBss->CentralChannel = Channel; pBss->Rssi = Rssi; - // Update CkipFlag. if not exists, the value is 0x0 + /* Update CkipFlag. if not exists, the value is 0x0 */ pBss->CkipFlag = CkipFlag; - // New for microsoft Fixed IEs + /* New for microsoft Fixed IEs */ NdisMoveMemory(pBss->FixIEs.Timestamp, &TimeStamp, 8); pBss->FixIEs.BeaconInterval = BeaconPeriod; pBss->FixIEs.Capabilities = CapabilityInfo; - // New for microsoft Variable IEs + /* New for microsoft Variable IEs */ if (LengthVIE != 0) { pBss->VarIELen = LengthVIE; NdisMoveMemory(pBss->VarIEs, pVIE, pBss->VarIELen); @@ -3762,7 +3759,7 @@ VOID BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, IN PUCHAR pBssid, I BssCipherParse(pBss); - // new for QOS + /* new for QOS */ if (pEdcaParm) NdisMoveMemory(&pBss->EdcaParm, pEdcaParm, sizeof(EDCA_PARM)); else @@ -3811,7 +3808,7 @@ VOID BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, IN PUCHAR pBssid, I } break; } - Length = Length + 2 + (USHORT) pEid->Len; // Eid[1] + Len[1]+ content[Len] + Length = Length + 2 + (USHORT) pEid->Len; /* Eid[1] + Len[1]+ content[Len] */ pEid = (PEID_STRUCT) ((UCHAR *) pEid + 2 + pEid->Len); } } @@ -3840,7 +3837,7 @@ VOID BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, IN PUCHAR pBssid, I IRQL = DISPATCH_LEVEL */ -ULONG BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT BSS_TABLE * Tab, IN PUCHAR pBssid, IN CHAR Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN USHORT BeaconPeriod, IN CF_PARM * CfParm, IN USHORT AtimWin, IN USHORT CapabilityInfo, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, // AP might use this additional ht info IE +ULONG BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT BSS_TABLE * Tab, IN PUCHAR pBssid, IN CHAR Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN USHORT BeaconPeriod, IN CF_PARM * CfParm, IN USHORT AtimWin, IN USHORT CapabilityInfo, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ IN UCHAR HtCapabilityLen, IN UCHAR AddHtInfoLen, IN UCHAR NewExtChanOffset, @@ -3860,11 +3857,11 @@ ULONG BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT BSS_TABLE * Tab, IN PUCHAR pBss ChannelNo); if (Idx == BSS_NOT_FOUND) { if (Tab->BssNr >= MAX_LEN_OF_BSS_TABLE) { - // - // It may happen when BSS Table was full. - // The desired AP will not be added into BSS Table - // In this case, if we found the desired AP then overwrite BSS Table. - // + /* */ + /* It may happen when BSS Table was full. */ + /* The desired AP will not be added into BSS Table */ + /* In this case, if we found the desired AP then overwrite BSS Table. */ + /* */ if (!OPSTATUS_TEST_FLAG (pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) { if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, pBssid) @@ -3926,7 +3923,7 @@ ULONG BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT BSS_TABLE * Tab, IN PUCHAR pBss return Idx; } -// IRQL = DISPATCH_LEVEL +/* IRQL = DISPATCH_LEVEL */ VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, OUT BSS_TABLE * OutTab, IN CHAR Ssid[], IN UCHAR SsidLen) { @@ -3950,7 +3947,7 @@ VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, || bIsHiddenApIncluded)) { BSS_ENTRY *pOutBss = &OutTab->BssEntry[OutTab->BssNr]; - // 2.4G/5G N only mode + /* 2.4G/5G N only mode */ if ((pInBss->HtCapabilityLen == 0) && ((pAd->CommonCfg.PhyMode == PHY_11N_2_4G) || (pAd->CommonCfg.PhyMode == PHY_11N_5G))) { @@ -3958,28 +3955,28 @@ VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, ("STA is in N-only Mode, this AP don't have Ht capability in Beacon.\n")); continue; } - // New for WPA2 - // Check the Authmode first + /* New for WPA2 */ + /* Check the Authmode first */ if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) { - // Check AuthMode and AuthModeAux for matching, in case AP support dual-mode + /* Check AuthMode and AuthModeAux for matching, in case AP support dual-mode */ if ((pAd->StaCfg.AuthMode != pInBss->AuthMode) && (pAd->StaCfg.AuthMode != pInBss->AuthModeAux)) - // None matched + /* None matched */ continue; - // Check cipher suite, AP must have more secured cipher than station setting + /* Check cipher suite, AP must have more secured cipher than station setting */ if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) { - // If it's not mixed mode, we should only let BSS pass with the same encryption + /* If it's not mixed mode, we should only let BSS pass with the same encryption */ if (pInBss->WPA.bMixMode == FALSE) if (pAd->StaCfg.WepStatus != pInBss->WPA.GroupCipher) continue; - // check group cipher + /* check group cipher */ if ((pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) && (pInBss->WPA.GroupCipher != @@ -3988,9 +3985,9 @@ VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, Ndis802_11GroupWEP104Enabled)) continue; - // check pairwise cipher, skip if none matched - // If profile set to AES, let it pass without question. - // If profile set to TKIP, we must find one mateched + /* check pairwise cipher, skip if none matched */ + /* If profile set to AES, let it pass without question. */ + /* If profile set to TKIP, we must find one mateched */ if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && (pAd->StaCfg.WepStatus != @@ -4003,13 +4000,13 @@ VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, Ndis802_11AuthModeWPA2) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) { - // If it's not mixed mode, we should only let BSS pass with the same encryption + /* If it's not mixed mode, we should only let BSS pass with the same encryption */ if (pInBss->WPA2.bMixMode == FALSE) if (pAd->StaCfg.WepStatus != pInBss->WPA2.GroupCipher) continue; - // check group cipher + /* check group cipher */ if ((pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) && (pInBss->WPA2.GroupCipher != @@ -4018,9 +4015,9 @@ VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, Ndis802_11GroupWEP104Enabled)) continue; - // check pairwise cipher, skip if none matched - // If profile set to AES, let it pass without question. - // If profile set to TKIP, we must find one mateched + /* check pairwise cipher, skip if none matched */ + /* If profile set to AES, let it pass without question. */ + /* If profile set to TKIP, we must find one mateched */ if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && (pAd->StaCfg.WepStatus != @@ -4030,27 +4027,27 @@ VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, continue; } } - // Bss Type matched, SSID matched. - // We will check wepstatus for qualification Bss + /* Bss Type matched, SSID matched. */ + /* We will check wepstatus for qualification Bss */ else if (pAd->StaCfg.WepStatus != pInBss->WepStatus) { DBGPRINT(RT_DEBUG_TRACE, ("StaCfg.WepStatus=%d, while pInBss->WepStatus=%d\n", pAd->StaCfg.WepStatus, pInBss->WepStatus)); - // - // For the SESv2 case, we will not qualify WepStatus. - // + /* */ + /* For the SESv2 case, we will not qualify WepStatus. */ + /* */ if (!pInBss->bSES) continue; } - // Since the AP is using hidden SSID, and we are trying to connect to ANY - // It definitely will fail. So, skip it. - // CCX also require not even try to connect it!! + /* Since the AP is using hidden SSID, and we are trying to connect to ANY */ + /* It definitely will fail. So, skip it. */ + /* CCX also require not even try to connect it!! */ if (SsidLen == 0) continue; - // If both station and AP use 40MHz, still need to check if the 40MHZ band's legality in my country region - // If this 40MHz wideband is not allowed in my country list, use bandwidth 20MHZ instead, + /* If both station and AP use 40MHz, still need to check if the 40MHZ band's legality in my country region */ + /* If this 40MHz wideband is not allowed in my country list, use bandwidth 20MHZ instead, */ if ((pInBss->CentralChannel != pInBss->Channel) && (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)) { @@ -4069,7 +4066,7 @@ VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, } } } - // copy matching BSS from InTab to OutTab + /* copy matching BSS from InTab to OutTab */ NdisMoveMemory(pOutBss, pInBss, sizeof(BSS_ENTRY)); OutTab->BssNr++; @@ -4077,7 +4074,7 @@ VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, && (SsidLen == 0)) { BSS_ENTRY *pOutBss = &OutTab->BssEntry[OutTab->BssNr]; - // 2.4G/5G N only mode + /* 2.4G/5G N only mode */ if ((pInBss->HtCapabilityLen == 0) && ((pAd->CommonCfg.PhyMode == PHY_11N_2_4G) || (pAd->CommonCfg.PhyMode == PHY_11N_5G))) { @@ -4085,35 +4082,35 @@ VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, ("STA is in N-only Mode, this AP don't have Ht capability in Beacon.\n")); continue; } - // New for WPA2 - // Check the Authmode first + /* New for WPA2 */ + /* Check the Authmode first */ if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) { - // Check AuthMode and AuthModeAux for matching, in case AP support dual-mode + /* Check AuthMode and AuthModeAux for matching, in case AP support dual-mode */ if ((pAd->StaCfg.AuthMode != pInBss->AuthMode) && (pAd->StaCfg.AuthMode != pInBss->AuthModeAux)) - // None matched + /* None matched */ continue; - // Check cipher suite, AP must have more secured cipher than station setting + /* Check cipher suite, AP must have more secured cipher than station setting */ if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) { - // If it's not mixed mode, we should only let BSS pass with the same encryption + /* If it's not mixed mode, we should only let BSS pass with the same encryption */ if (pInBss->WPA.bMixMode == FALSE) if (pAd->StaCfg.WepStatus != pInBss->WPA.GroupCipher) continue; - // check group cipher + /* check group cipher */ if (pAd->StaCfg.WepStatus < pInBss->WPA.GroupCipher) continue; - // check pairwise cipher, skip if none matched - // If profile set to AES, let it pass without question. - // If profile set to TKIP, we must find one mateched + /* check pairwise cipher, skip if none matched */ + /* If profile set to AES, let it pass without question. */ + /* If profile set to TKIP, we must find one mateched */ if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && (pAd->StaCfg.WepStatus != @@ -4126,20 +4123,20 @@ VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, Ndis802_11AuthModeWPA2) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK)) { - // If it's not mixed mode, we should only let BSS pass with the same encryption + /* If it's not mixed mode, we should only let BSS pass with the same encryption */ if (pInBss->WPA2.bMixMode == FALSE) if (pAd->StaCfg.WepStatus != pInBss->WPA2.GroupCipher) continue; - // check group cipher + /* check group cipher */ if (pAd->StaCfg.WepStatus < pInBss->WPA2.GroupCipher) continue; - // check pairwise cipher, skip if none matched - // If profile set to AES, let it pass without question. - // If profile set to TKIP, we must find one mateched + /* check pairwise cipher, skip if none matched */ + /* If profile set to AES, let it pass without question. */ + /* If profile set to TKIP, we must find one mateched */ if ((pAd->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) && (pAd->StaCfg.WepStatus != @@ -4149,13 +4146,13 @@ VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, continue; } } - // Bss Type matched, SSID matched. - // We will check wepstatus for qualification Bss + /* Bss Type matched, SSID matched. */ + /* We will check wepstatus for qualification Bss */ else if (pAd->StaCfg.WepStatus != pInBss->WepStatus) continue; - // If both station and AP use 40MHz, still need to check if the 40MHZ band's legality in my country region - // If this 40MHz wideband is not allowed in my country list, use bandwidth 20MHZ instead, + /* If both station and AP use 40MHz, still need to check if the 40MHZ band's legality in my country region */ + /* If this 40MHz wideband is not allowed in my country list, use bandwidth 20MHZ instead, */ if ((pInBss->CentralChannel != pInBss->Channel) && (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)) { @@ -4169,7 +4166,7 @@ VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, BW = BW_40; } } - // copy matching BSS from InTab to OutTab + /* copy matching BSS from InTab to OutTab */ NdisMoveMemory(pOutBss, pInBss, sizeof(BSS_ENTRY)); OutTab->BssNr++; @@ -4182,7 +4179,7 @@ VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, BssTableSortByRssi(OutTab); } -// IRQL = DISPATCH_LEVEL +/* IRQL = DISPATCH_LEVEL */ VOID BssTableSortByRssi(IN OUT BSS_TABLE * OutTab) { INT i, j; @@ -4214,26 +4211,26 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) INT Length; NDIS_802_11_ENCRYPTION_STATUS TmpCipher; - // - // WepStatus will be reset later, if AP announce TKIP or AES on the beacon frame. - // + /* */ + /* WepStatus will be reset later, if AP announce TKIP or AES on the beacon frame. */ + /* */ if (pBss->Privacy) { pBss->WepStatus = Ndis802_11WEPEnabled; } else { pBss->WepStatus = Ndis802_11WEPDisabled; } - // Set default to disable & open authentication before parsing variable IE + /* Set default to disable & open authentication before parsing variable IE */ pBss->AuthMode = Ndis802_11AuthModeOpen; pBss->AuthModeAux = Ndis802_11AuthModeOpen; - // Init WPA setting + /* Init WPA setting */ pBss->WPA.PairCipher = Ndis802_11WEPDisabled; pBss->WPA.PairCipherAux = Ndis802_11WEPDisabled; pBss->WPA.GroupCipher = Ndis802_11WEPDisabled; pBss->WPA.RsnCapability = 0; pBss->WPA.bMixMode = FALSE; - // Init WPA2 setting + /* Init WPA2 setting */ pBss->WPA2.PairCipher = Ndis802_11WEPDisabled; pBss->WPA2.PairCipherAux = Ndis802_11WEPDisabled; pBss->WPA2.GroupCipher = Ndis802_11WEPDisabled; @@ -4243,7 +4240,7 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) Length = (INT) pBss->VarIELen; while (Length > 0) { - // Parse cipher suite base on WPA1 & WPA2, they should be parsed differently + /* Parse cipher suite base on WPA1 & WPA2, they should be parsed differently */ pTmp = ((PUCHAR) pBss->VarIEs) + pBss->VarIELen - Length; pEid = (PEID_STRUCT) pTmp; switch (pEid->Eid) { @@ -4254,24 +4251,24 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) break; } else if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4) != 1) { - // if unsupported vendor specific IE + /* if unsupported vendor specific IE */ break; } - // Skip OUI, version, and multicast suite - // This part should be improved in the future when AP supported multiple cipher suite. - // For now, it's OK since almost all APs have fixed cipher suite supported. - // pTmp = (PUCHAR) pEid->Octet; + /* Skip OUI, version, and multicast suite */ + /* This part should be improved in the future when AP supported multiple cipher suite. */ + /* For now, it's OK since almost all APs have fixed cipher suite supported. */ + /* pTmp = (PUCHAR) pEid->Octet; */ pTmp += 11; - // Cipher Suite Selectors from Spec P802.11i/D3.2 P26. - // Value Meaning - // 0 None - // 1 WEP-40 - // 2 Tkip - // 3 WRAP - // 4 AES - // 5 WEP-104 - // Parse group cipher + /* Cipher Suite Selectors from Spec P802.11i/D3.2 P26. */ + /* Value Meaning */ + /* 0 None */ + /* 1 WEP-40 */ + /* 2 Tkip */ + /* 3 WRAP */ + /* 4 AES */ + /* 5 WEP-104 */ + /* Parse group cipher */ switch (*pTmp) { case 1: pBss->WPA.GroupCipher = @@ -4292,22 +4289,22 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) default: break; } - // number of unicast suite + /* number of unicast suite */ pTmp += 1; - // skip all unicast cipher suites - //Count = *(PUSHORT) pTmp; + /* skip all unicast cipher suites */ + /*Count = *(PUSHORT) pTmp; */ Count = (pTmp[1] << 8) + pTmp[0]; pTmp += sizeof(USHORT); - // Parsing all unicast cipher suite + /* Parsing all unicast cipher suite */ while (Count > 0) { - // Skip OUI + /* Skip OUI */ pTmp += 3; TmpCipher = Ndis802_11WEPDisabled; switch (*pTmp) { case 1: - case 5: // Although WEP is not allowed in WPA related auth mode, we parse it anyway + case 5: /* Although WEP is not allowed in WPA related auth mode, we parse it anyway */ TmpCipher = Ndis802_11Encryption1Enabled; break; @@ -4323,7 +4320,7 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) break; } if (TmpCipher > pBss->WPA.PairCipher) { - // Move the lower cipher suite to PairCipherAux + /* Move the lower cipher suite to PairCipherAux */ pBss->WPA.PairCipherAux = pBss->WPA.PairCipher; pBss->WPA.PairCipher = TmpCipher; @@ -4334,15 +4331,15 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) Count--; } - // 4. get AKM suite counts - //Count = *(PUSHORT) pTmp; + /* 4. get AKM suite counts */ + /*Count = *(PUSHORT) pTmp; */ Count = (pTmp[1] << 8) + pTmp[0]; pTmp += sizeof(USHORT); pTmp += 3; switch (*pTmp) { case 1: - // Set AP support WPA-enterprise mode + /* Set AP support WPA-enterprise mode */ if (pBss->AuthMode == Ndis802_11AuthModeOpen) pBss->AuthMode = Ndis802_11AuthModeWPA; else @@ -4350,7 +4347,7 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) Ndis802_11AuthModeWPA; break; case 2: - // Set AP support WPA-PSK mode + /* Set AP support WPA-PSK mode */ if (pBss->AuthMode == Ndis802_11AuthModeOpen) pBss->AuthMode = Ndis802_11AuthModeWPAPSK; @@ -4363,12 +4360,12 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) } pTmp += 1; - // Fixed for WPA-None + /* Fixed for WPA-None */ if (pBss->BssType == BSS_ADHOC) { pBss->AuthMode = Ndis802_11AuthModeWPANone; pBss->AuthModeAux = Ndis802_11AuthModeWPANone; pBss->WepStatus = pBss->WPA.GroupCipher; - // Patched bugs for old driver + /* Patched bugs for old driver */ if (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled) pBss->WPA.PairCipherAux = @@ -4376,7 +4373,7 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) } else pBss->WepStatus = pBss->WPA.PairCipher; - // Check the Pair & Group, if different, turn on mixed mode flag + /* Check the Pair & Group, if different, turn on mixed mode flag */ if (pBss->WPA.GroupCipher != pBss->WPA.PairCipher) pBss->WPA.bMixMode = TRUE; @@ -4385,17 +4382,17 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) case IE_RSN: pRsnHeader = (PRSN_IE_HEADER_STRUCT) pTmp; - // 0. Version must be 1 + /* 0. Version must be 1 */ if (le2cpu16(pRsnHeader->Version) != 1) break; pTmp += sizeof(RSN_IE_HEADER_STRUCT); - // 1. Check group cipher + /* 1. Check group cipher */ pCipher = (PCIPHER_SUITE_STRUCT) pTmp; if (!RTMPEqualMemory(pTmp, RSN_OUI, 3)) break; - // Parse group cipher + /* Parse group cipher */ switch (pCipher->Type) { case 1: pBss->WPA2.GroupCipher = @@ -4416,23 +4413,23 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) default: break; } - // set to correct offset for next parsing + /* set to correct offset for next parsing */ pTmp += sizeof(CIPHER_SUITE_STRUCT); - // 2. Get pairwise cipher counts - //Count = *(PUSHORT) pTmp; + /* 2. Get pairwise cipher counts */ + /*Count = *(PUSHORT) pTmp; */ Count = (pTmp[1] << 8) + pTmp[0]; pTmp += sizeof(USHORT); - // 3. Get pairwise cipher - // Parsing all unicast cipher suite + /* 3. Get pairwise cipher */ + /* Parsing all unicast cipher suite */ while (Count > 0) { - // Skip OUI + /* Skip OUI */ pCipher = (PCIPHER_SUITE_STRUCT) pTmp; TmpCipher = Ndis802_11WEPDisabled; switch (pCipher->Type) { case 1: - case 5: // Although WEP is not allowed in WPA related auth mode, we parse it anyway + case 5: /* Although WEP is not allowed in WPA related auth mode, we parse it anyway */ TmpCipher = Ndis802_11Encryption1Enabled; break; @@ -4448,7 +4445,7 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) break; } if (TmpCipher > pBss->WPA2.PairCipher) { - // Move the lower cipher suite to PairCipherAux + /* Move the lower cipher suite to PairCipherAux */ pBss->WPA2.PairCipherAux = pBss->WPA2.PairCipher; pBss->WPA2.PairCipher = TmpCipher; @@ -4459,13 +4456,13 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) Count--; } - // 4. get AKM suite counts - //Count = *(PUSHORT) pTmp; + /* 4. get AKM suite counts */ + /*Count = *(PUSHORT) pTmp; */ Count = (pTmp[1] << 8) + pTmp[0]; pTmp += sizeof(USHORT); - // 5. Get AKM ciphers - // Parsing all AKM ciphers + /* 5. Get AKM ciphers */ + /* Parsing all AKM ciphers */ while (Count > 0) { pAKM = (PAKM_SUITE_STRUCT) pTmp; if (!RTMPEqualMemory(pTmp, RSN_OUI, 3)) @@ -4473,7 +4470,7 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) switch (pAKM->Type) { case 1: - // Set AP support WPA-enterprise mode + /* Set AP support WPA-enterprise mode */ if (pBss->AuthMode == Ndis802_11AuthModeOpen) pBss->AuthMode = @@ -4483,7 +4480,7 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) Ndis802_11AuthModeWPA2; break; case 2: - // Set AP support WPA-PSK mode + /* Set AP support WPA-PSK mode */ if (pBss->AuthMode == Ndis802_11AuthModeOpen) pBss->AuthMode = @@ -4506,7 +4503,7 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) Count--; } - // Fixed for WPA-None + /* Fixed for WPA-None */ if (pBss->BssType == BSS_ADHOC) { pBss->AuthMode = Ndis802_11AuthModeWPANone; pBss->AuthModeAux = Ndis802_11AuthModeWPANone; @@ -4514,7 +4511,7 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) pBss->WPA2.PairCipherAux; pBss->WPA.GroupCipher = pBss->WPA2.GroupCipher; pBss->WepStatus = pBss->WPA.GroupCipher; - // Patched bugs for old driver + /* Patched bugs for old driver */ if (pBss->WPA.PairCipherAux == Ndis802_11WEPDisabled) pBss->WPA.PairCipherAux = @@ -4522,12 +4519,12 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) } pBss->WepStatus = pBss->WPA2.PairCipher; - // 6. Get RSN capability - //pBss->WPA2.RsnCapability = *(PUSHORT) pTmp; + /* 6. Get RSN capability */ + /*pBss->WPA2.RsnCapability = *(PUSHORT) pTmp; */ pBss->WPA2.RsnCapability = (pTmp[1] << 8) + pTmp[0]; pTmp += sizeof(USHORT); - // Check the Pair & Group, if different, turn on mixed mode flag + /* Check the Pair & Group, if different, turn on mixed mode flag */ if (pBss->WPA2.GroupCipher != pBss->WPA2.PairCipher) pBss->WPA2.bMixMode = TRUE; @@ -4539,9 +4536,9 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) } } -// =========================================================================================== -// mac_table.c -// =========================================================================================== +/* =========================================================================================== */ +/* mac_table.c */ +/* =========================================================================================== */ /*! \brief generates a random mac address value for IBSS BSSID * \param Addr the bssid location @@ -4557,7 +4554,7 @@ VOID MacAddrRandomBssid(IN PRTMP_ADAPTER pAd, OUT PUCHAR pAddr) pAddr[i] = RandomByte(pAd); } - pAddr[0] = (pAddr[0] & 0xfe) | 0x02; // the first 2 bits must be 01xxxxxxxx + pAddr[0] = (pAddr[0] & 0xfe) | 0x02; /* the first 2 bits must be 01xxxxxxxx */ } /*! \brief init the management mac frame header @@ -4584,17 +4581,17 @@ VOID MgtMacHeaderInit(IN PRTMP_ADAPTER pAd, pHdr80211->FC.Type = BTYPE_MGMT; pHdr80211->FC.SubType = SubType; -// if (SubType == SUBTYPE_ACK) // sample, no use, it will conflict with ACTION frame sub type -// pHdr80211->FC.Type = BTYPE_CNTL; +/* if (SubType == SUBTYPE_ACK) // sample, no use, it will conflict with ACTION frame sub type */ +/* pHdr80211->FC.Type = BTYPE_CNTL; */ pHdr80211->FC.ToDs = ToDs; COPY_MAC_ADDR(pHdr80211->Addr1, pDA); COPY_MAC_ADDR(pHdr80211->Addr2, pAd->CurrentAddress); COPY_MAC_ADDR(pHdr80211->Addr3, pBssid); } -// =========================================================================================== -// mem_mgmt.c -// =========================================================================================== +/* =========================================================================================== */ +/* mem_mgmt.c */ +/* =========================================================================================== */ /*!*************************************************************************** * This routine build an outgoing frame, and fill all information specified @@ -4621,7 +4618,7 @@ ULONG MakeOutgoingFrame(OUT UCHAR * Buffer, OUT ULONG * FrameLen, ...) ULONG TotLeng; va_list Args; - // calculates the total length + /* calculates the total length */ TotLeng = 0; va_start(Args, FrameLen); do { @@ -4639,9 +4636,9 @@ ULONG MakeOutgoingFrame(OUT UCHAR * Buffer, OUT ULONG * FrameLen, ...) return TotLeng; } -// =========================================================================================== -// mlme_queue.c -// =========================================================================================== +/* =========================================================================================== */ +/* mlme_queue.c */ +/* =========================================================================================== */ /*! \brief Initialize The MLME Queue, used by MLME Functions * \param *Queue The MLME Queue @@ -4694,13 +4691,13 @@ BOOLEAN MlmeEnqueue(IN PRTMP_ADAPTER pAd, INT Tail; MLME_QUEUE *Queue = (MLME_QUEUE *) & pAd->Mlme.Queue; - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt + /* Do nothing if the driver is starting halt state. */ + /* This might happen when timer already been fired before cancel timer with mlmehalt */ if (RTMP_TEST_FLAG (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return FALSE; - // First check the size, it MUST not exceed the mlme queue size + /* First check the size, it MUST not exceed the mlme queue size */ if (MsgLen > MGMT_DMA_BUFFER_SIZE) { DBGPRINT_ERR(("MlmeEnqueue: msg too large, size = %ld \n", MsgLen)); @@ -4761,15 +4758,15 @@ BOOLEAN MlmeEnqueueForRecv(IN PRTMP_ADAPTER pAd, INT MsgType; MLME_QUEUE *Queue = (MLME_QUEUE *) & pAd->Mlme.Queue; - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt + /* Do nothing if the driver is starting halt state. */ + /* This might happen when timer already been fired before cancel timer with mlmehalt */ if (RTMP_TEST_FLAG (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) { DBGPRINT_ERR(("MlmeEnqueueForRecv: fRTMP_ADAPTER_HALT_IN_PROGRESS\n")); return FALSE; } - // First check the size, it MUST not exceed the mlme queue size + /* First check the size, it MUST not exceed the mlme queue size */ if (MsgLen > MGMT_DMA_BUFFER_SIZE) { DBGPRINT_ERR(("MlmeEnqueueForRecv: frame too large, size = %ld \n", MsgLen)); return FALSE; @@ -4786,7 +4783,7 @@ BOOLEAN MlmeEnqueueForRecv(IN PRTMP_ADAPTER pAd, } } - // OK, we got all the informations, it is time to put things into queue + /* OK, we got all the informations, it is time to put things into queue */ NdisAcquireSpinLock(&(Queue->Lock)); Tail = Queue->Tail; Queue->Tail++; @@ -4842,12 +4839,12 @@ BOOLEAN MlmeDequeue(IN MLME_QUEUE * Queue, OUT MLME_QUEUE_ELEM ** Elem) return TRUE; } -// IRQL = DISPATCH_LEVEL +/* IRQL = DISPATCH_LEVEL */ VOID MlmeRestartStateMachine(IN PRTMP_ADAPTER pAd) { #ifdef RTMP_MAC_PCI MLME_QUEUE_ELEM *Elem = NULL; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ BOOLEAN Cancelled; DBGPRINT(RT_DEBUG_TRACE, ("MlmeRestartStateMachine \n")); @@ -4862,11 +4859,11 @@ VOID MlmeRestartStateMachine(IN PRTMP_ADAPTER pAd) } NdisReleaseSpinLock(&pAd->Mlme.TaskLock); - // Remove all Mlme queues elements + /* Remove all Mlme queues elements */ while (!MlmeQueueEmpty(&pAd->Mlme.Queue)) { - //From message type, determine which state machine I should drive + /*From message type, determine which state machine I should drive */ if (MlmeDequeue(&pAd->Mlme.Queue, &Elem)) { - // free MLME element + /* free MLME element */ Elem->Occupied = FALSE; Elem->MsgLen = 0; @@ -4874,11 +4871,11 @@ VOID MlmeRestartStateMachine(IN PRTMP_ADAPTER pAd) DBGPRINT_ERR(("MlmeRestartStateMachine: MlmeQueue empty\n")); } } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ { - // Cancel all timer events - // Be careful to cancel new added timer + /* Cancel all timer events */ + /* Be careful to cancel new added timer */ RTMPCancelTimer(&pAd->MlmeAux.AssocTimer, &Cancelled); RTMPCancelTimer(&pAd->MlmeAux.ReassocTimer, &Cancelled); RTMPCancelTimer(&pAd->MlmeAux.DisassocTimer, &Cancelled); @@ -4888,15 +4885,15 @@ VOID MlmeRestartStateMachine(IN PRTMP_ADAPTER pAd) } - // Change back to original channel in case of doing scan + /* Change back to original channel in case of doing scan */ AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.Channel); - // Resume MSDU which is turned off durning scan + /* Resume MSDU which is turned off durning scan */ RTMPResumeMsduTransmission(pAd); { - // Set all state machines back IDLE + /* Set all state machines back IDLE */ pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; @@ -4906,11 +4903,11 @@ VOID MlmeRestartStateMachine(IN PRTMP_ADAPTER pAd) } #ifdef RTMP_MAC_PCI - // Remove running state + /* Remove running state */ NdisAcquireSpinLock(&pAd->Mlme.TaskLock); pAd->Mlme.bRunning = FALSE; NdisReleaseSpinLock(&pAd->Mlme.TaskLock); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ } /*! \brief test if the MLME Queue is empty @@ -4994,10 +4991,10 @@ BOOLEAN MsgTypeSubst(IN PRTMP_ADAPTER pAd, UCHAR EAPType; PUCHAR pData; - // Pointer to start of data frames including SNAP header + /* Pointer to start of data frames including SNAP header */ pData = (PUCHAR) pFrame + LENGTH_802_11; - // The only data type will pass to this function is EAPOL frame + /* The only data type will pass to this function is EAPOL frame */ if (pFrame->Hdr.FC.Type == BTYPE_DATA) { { *Machine = WPA_STATE_MACHINE; @@ -5046,7 +5043,7 @@ BOOLEAN MsgTypeSubst(IN PRTMP_ADAPTER pAd, *MsgType = MT2_PEER_DISASSOC_REQ; break; case SUBTYPE_AUTH: - // get the sequence number from payload 24 Mac Header + 2 bytes algorithm + /* get the sequence number from payload 24 Mac Header + 2 bytes algorithm */ NdisMoveMemory(&Seq, &pFrame->Octet[2], sizeof(USHORT)); NdisMoveMemory(&Alg, &pFrame->Octet[0], sizeof(USHORT)); if (Seq == 1 || Seq == 3) { @@ -5067,7 +5064,7 @@ BOOLEAN MsgTypeSubst(IN PRTMP_ADAPTER pAd, break; case SUBTYPE_ACTION: *Machine = ACTION_STATE_MACHINE; - // Sometimes Sta will return with category bytes with MSB = 1, if they receive catogory out of their support + /* Sometimes Sta will return with category bytes with MSB = 1, if they receive catogory out of their support */ if ((pFrame->Octet[0] & 0x7F) > MAX_PEER_CATE_MSG) { *MsgType = MT2_ACT_INVALID; } else { @@ -5082,9 +5079,9 @@ BOOLEAN MsgTypeSubst(IN PRTMP_ADAPTER pAd, return TRUE; } -// =========================================================================================== -// state_machine.c -// =========================================================================================== +/* =========================================================================================== */ +/* state_machine.c */ +/* =========================================================================================== */ /*! \brief Initialize the state machine. * \param *S pointer to the state machine @@ -5109,21 +5106,21 @@ VOID StateMachineInit(IN STATE_MACHINE * S, { ULONG i, j; - // set number of states and messages + /* set number of states and messages */ S->NrState = StNr; S->NrMsg = MsgNr; S->Base = Base; S->TransFunc = Trans; - // init all state transition to default function + /* init all state transition to default function */ for (i = 0; i < StNr; i++) { for (j = 0; j < MsgNr; j++) { S->TransFunc[i * MsgNr + j] = DefFunc; } } - // set the starting state + /* set the starting state */ S->CurrState = InitState; } @@ -5147,7 +5144,7 @@ VOID StateMachineSetAction(IN STATE_MACHINE * S, MsgIdx = Msg - S->Base; if (St < S->NrState && MsgIdx < S->NrMsg) { - // boundary checking before setting the action + /* boundary checking before setting the action */ S->TransFunc[St * S->NrMsg + MsgIdx] = Func; } } @@ -5180,9 +5177,9 @@ VOID Drop(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { } -// =========================================================================================== -// lfsr.c -// =========================================================================================== +/* =========================================================================================== */ +/* lfsr.c */ +/* =========================================================================================== */ /* ========================================================================== @@ -5260,7 +5257,7 @@ VOID RTMPCheckRates(IN PRTMP_ADAPTER pAd, else RateIdx = 12; - // Check for support rates exclude basic rate bit + /* Check for support rates exclude basic rate bit */ for (i = 0; i < *SupRateLen; i++) for (j = 0; j < RateIdx; j++) if ((SupRate[i] & 0x7f) == RateIdTo500Kbps[j]) @@ -5277,7 +5274,7 @@ BOOLEAN RTMPCheckChannel(IN PRTMP_ADAPTER pAd, UCHAR UpperChannel = 0, LowerChannel = 0; UCHAR NoEffectChannelinList = 0; - // Find upper and lower channel according to 40MHz current operation. + /* Find upper and lower channel according to 40MHz current operation. */ if (CentralChannel < Channel) { UpperChannel = Channel; if (CentralChannel > 2) @@ -5331,11 +5328,11 @@ BOOLEAN RTMPCheckHt(IN PRTMP_ADAPTER pAd, if (Wcid >= MAX_LEN_OF_MAC_TABLE) return FALSE; - // If use AMSDU, set flag. + /* If use AMSDU, set flag. */ if (pAd->CommonCfg.DesiredHtPhy.AmsduEnable) CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], fCLIENT_STATUS_AMSDU_INUSED); - // Save Peer Capability + /* Save Peer Capability */ if (pHtCapability->HtCapInfo.ShortGIfor20) CLIENT_STATUS_SET_FLAG(&pAd->MacTab.Content[Wcid], fCLIENT_STATUS_SGI20_CAPABLE); @@ -5357,7 +5354,7 @@ BOOLEAN RTMPCheckHt(IN PRTMP_ADAPTER pAd, pAd->MacTab.Content[Wcid].MpduDensity = pHtCapability->HtCapParm.MpduDensity; } - // Will check ChannelWidth for MCSSet[4] below + /* Will check ChannelWidth for MCSSet[4] below */ pAd->MlmeAux.HtCapability.MCSSet[4] = 0x1; switch (pAd->CommonCfg.RxStream) { case 1: @@ -5396,7 +5393,7 @@ BOOLEAN RTMPCheckHt(IN PRTMP_ADAPTER pAd, pAd->MlmeAux.HtCapability.HtCapInfo.GF = pHtCapability->HtCapInfo.GF & pAd->CommonCfg.DesiredHtPhy.GF; - // Send Assoc Req with my HT capability. + /* Send Assoc Req with my HT capability. */ pAd->MlmeAux.HtCapability.HtCapInfo.AMsduSize = pAd->CommonCfg.DesiredHtPhy.AmsduSize; pAd->MlmeAux.HtCapability.HtCapInfo.MimoPs = @@ -5430,7 +5427,7 @@ BOOLEAN RTMPCheckHt(IN PRTMP_ADAPTER pAd, } if (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_20) - pAd->MlmeAux.HtCapability.MCSSet[4] = 0x0; // BW20 can't transmit MCS32 + pAd->MlmeAux.HtCapability.MCSSet[4] = 0x0; /* BW20 can't transmit MCS32 */ COPY_AP_HTSETTINGS_FROM_BEACON(pAd, pHtCapability); return TRUE; @@ -5455,8 +5452,8 @@ BOOLEAN RTMPCheckHt(IN PRTMP_ADAPTER pAd, VOID RTMPUpdateMlmeRate(IN PRTMP_ADAPTER pAd) { UCHAR MinimumRate; - UCHAR ProperMlmeRate; //= RATE_54; - UCHAR i, j, RateIdx = 12; //1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 + UCHAR ProperMlmeRate; /*= RATE_54; */ + UCHAR i, j, RateIdx = 12; /*1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 */ BOOLEAN bMatch = FALSE; switch (pAd->CommonCfg.PhyMode) { @@ -5469,7 +5466,7 @@ VOID RTMPUpdateMlmeRate(IN PRTMP_ADAPTER pAd) case PHY_11BGN_MIXED: if ((pAd->MlmeAux.SupRateLen == 4) && (pAd->MlmeAux.ExtRateLen == 0)) - // B only AP + /* B only AP */ ProperMlmeRate = RATE_11; else ProperMlmeRate = RATE_24; @@ -5480,7 +5477,7 @@ VOID RTMPUpdateMlmeRate(IN PRTMP_ADAPTER pAd) MinimumRate = RATE_6; break; case PHY_11A: - case PHY_11N_2_4G: // rt2860 need to check mlmerate for 802.11n + case PHY_11N_2_4G: /* rt2860 need to check mlmerate for 802.11n */ case PHY_11GN_MIXED: case PHY_11AGN_MIXED: case PHY_11AN_MIXED: @@ -5495,7 +5492,7 @@ VOID RTMPUpdateMlmeRate(IN PRTMP_ADAPTER pAd) else MinimumRate = RATE_6; break; - default: // error + default: /* error */ ProperMlmeRate = RATE_1; MinimumRate = RATE_1; break; @@ -5609,16 +5606,16 @@ VOID AsicEvaluateRxAnt(IN PRTMP_ADAPTER pAd) OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) #ifdef RT30xx || (pAd->EepromAccess) -#endif // RT30xx // +#endif /* RT30xx // */ #ifdef RT3090 || (pAd->bPCIclkOff == TRUE) -#endif // RT3090 // +#endif /* RT3090 // */ ) return; { - //if (pAd->StaCfg.Psm == PWR_SAVE) - // return; + /*if (pAd->StaCfg.Psm == PWR_SAVE) */ + /* return; */ { @@ -5637,7 +5634,7 @@ VOID AsicEvaluateRxAnt(IN PRTMP_ADAPTER pAd) RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBPR3); #ifdef RTMP_MAC_PCI pAd->StaCfg.BBPR3 = BBPR3; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ if (OPSTATUS_TEST_FLAG (pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) ) { @@ -5646,7 +5643,7 @@ VOID AsicEvaluateRxAnt(IN PRTMP_ADAPTER pAd) pAd->RalinkCounters.OneSecTxRetryOkCount + pAd->RalinkCounters.OneSecTxFailCount; - // dynamic adjust antenna evaluation period according to the traffic + /* dynamic adjust antenna evaluation period according to the traffic */ if (TxTotalCnt > 50) { RTMPSetTimer(&pAd->Mlme.RxAntEvalTimer, 20); @@ -5691,21 +5688,21 @@ VOID AsicRxAntEvalTimeout(IN PVOID SystemSpecific1, OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) #ifdef RT30xx || (pAd->EepromAccess) -#endif // RT30xx // +#endif /* RT30xx // */ #ifdef RT3090 || (pAd->bPCIclkOff == TRUE) -#endif // RT3090 // +#endif /* RT3090 // */ ) return; { - //if (pAd->StaCfg.Psm == PWR_SAVE) - // return; + /*if (pAd->StaCfg.Psm == PWR_SAVE) */ + /* return; */ { if (pAd->StaCfg.Psm == PWR_SAVE) return; - // if the traffic is low, use average rssi as the criteria + /* if the traffic is low, use average rssi as the criteria */ if (pAd->Mlme.bLowThroughput == TRUE) { rssi0 = pAd->StaCfg.RssiSample.LastRssi0; rssi1 = pAd->StaCfg.RssiSample.LastRssi1; @@ -5742,7 +5739,7 @@ VOID AsicRxAntEvalTimeout(IN PVOID SystemSpecific1, RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBPR3); #ifdef RTMP_MAC_PCI pAd->StaCfg.BBPR3 = BBPR3; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ } } @@ -5759,7 +5756,7 @@ VOID APSDPeriodicExec(IN PVOID SystemSpecific1, pAd->CommonCfg.TriggerTimerCount++; -// Driver should not send trigger frame, it should be send by application layer +/* Driver should not send trigger frame, it should be send by application layer */ /* if (pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable && (pAd->CommonCfg.bNeedSendTriggerFrame || @@ -5818,7 +5815,7 @@ BOOLEAN RTMPCheckEntryEnableAutoRateSwitch(IN PRTMP_ADAPTER pAd, BOOLEAN result = TRUE; { - // only associated STA counts + /* only associated STA counts */ if (pEntry && (pEntry->ValidAsCLI) && (pEntry->Sst == SST_ASSOC)) { result = pAd->StaCfg.bAutoTxRateSwitch; @@ -5895,12 +5892,12 @@ VOID RTMPUpdateLegacyTxSetting(UCHAR fixed_tx_mode, PMAC_TABLE_ENTRY pEntry) if (fixed_tx_mode == FIXED_TXMODE_CCK) { TransmitSetting.field.MODE = MODE_CCK; - // CCK mode allow MCS 0~3 + /* CCK mode allow MCS 0~3 */ if (TransmitSetting.field.MCS > MCS_3) TransmitSetting.field.MCS = MCS_3; } else { TransmitSetting.field.MODE = MODE_OFDM; - // OFDM mode allow MCS 0~7 + /* OFDM mode allow MCS 0~7 */ if (TransmitSetting.field.MCS > MCS_7) TransmitSetting.field.MCS = MCS_7; } @@ -5926,17 +5923,17 @@ VOID RTMPUpdateLegacyTxSetting(UCHAR fixed_tx_mode, PMAC_TABLE_ENTRY pEntry) */ VOID AsicStaBbpTuning(IN PRTMP_ADAPTER pAd) { - UCHAR OrigR66Value = 0, R66; //, R66UpperBound = 0x30, R66LowerBound = 0x30; + UCHAR OrigR66Value = 0, R66; /*, R66UpperBound = 0x30, R66LowerBound = 0x30; */ CHAR Rssi; - // 2860C did not support Fase CCA, therefore can't tune + /* 2860C did not support Fase CCA, therefore can't tune */ if (pAd->MACVersion == 0x28600100) return; - // - // work as a STA - // - if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) // no R66 tuning when SCANNING + /* */ + /* work as a STA */ + /* */ + if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE) /* no R66 tuning when SCANNING */ return; if ((pAd->OpMode == OPMODE_STA) @@ -5945,7 +5942,7 @@ VOID AsicStaBbpTuning(IN PRTMP_ADAPTER pAd) && !(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) #ifdef RTMP_MAC_PCI && (pAd->bPCIclkOff == FALSE) -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ ) { RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R66, &OrigR66Value); R66 = OrigR66Value; @@ -5957,10 +5954,10 @@ VOID AsicStaBbpTuning(IN PRTMP_ADAPTER pAd) else Rssi = pAd->StaCfg.RssiSample.AvgRssi0; - if (pAd->LatchRfRegs.Channel <= 14) { //BG band + if (pAd->LatchRfRegs.Channel <= 14) { /*BG band */ #ifdef RT30xx - // RT3070 is a no LNA solution, it should have different control regarding to AGC gain control - // Otherwise, it will have some throughput side effect when low RSSI + /* RT3070 is a no LNA solution, it should have different control regarding to AGC gain control */ + /* Otherwise, it will have some throughput side effect when low RSSI */ if (IS_RT3070(pAd) || IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) { @@ -5979,7 +5976,7 @@ VOID AsicStaBbpTuning(IN PRTMP_ADAPTER pAd) } } } else -#endif // RT30xx // +#endif /* RT30xx // */ { if (Rssi > RSSI_FOR_MID_LOW_SENSIBILITY) { R66 = (0x2E + GET_LNA_GAIN(pAd)) + 0x10; @@ -5995,7 +5992,7 @@ VOID AsicStaBbpTuning(IN PRTMP_ADAPTER pAd) } } } - } else { //A band + } else { /*A band */ if (pAd->CommonCfg.BBPCurrentBW == BW_20) { if (Rssi > RSSI_FOR_MID_LOW_SENSIBILITY) { R66 = @@ -6040,7 +6037,7 @@ VOID RTMPSetAGCInitValue(IN PRTMP_ADAPTER pAd, IN UCHAR BandWidth) { UCHAR R66 = 0x30; - if (pAd->LatchRfRegs.Channel <= 14) { // BG band + if (pAd->LatchRfRegs.Channel <= 14) { /* BG band */ #ifdef RT30xx /* Gary was verified Amazon AP and find that RT307x has BBP_R66 invalid default value */ @@ -6049,12 +6046,12 @@ VOID RTMPSetAGCInitValue(IN PRTMP_ADAPTER pAd, IN UCHAR BandWidth) R66 = 0x1C + 2 * GET_LNA_GAIN(pAd); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); } else -#endif // RT30xx // +#endif /* RT30xx // */ { R66 = 0x2E + GET_LNA_GAIN(pAd); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); } - } else { //A band + } else { /*A band */ { if (BandWidth == BW_20) { R66 = diff --git a/drivers/staging/rt2860/common/rt_channel.c b/drivers/staging/rt2860/common/rt_channel.c index cc45a08d5fb6..0af7e6b0a4c0 100644 --- a/drivers/staging/rt2860/common/rt_channel.c +++ b/drivers/staging/rt2860/common/rt_channel.c @@ -147,1276 +147,1276 @@ CH_FREQ_MAP CH_HZ_ID_MAP[] = { INT CH_HZ_ID_MAP_NUM = (sizeof(CH_HZ_ID_MAP) / sizeof(CH_FREQ_MAP)); CH_REGION ChRegion[] = { - { // Antigua and Berbuda + { /* Antigua and Berbuda */ "AG", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, FALSE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Argentina + { /* Argentina */ "AR", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {52, 4, 24, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {149, 4, 30, BOTH, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Aruba + { /* Aruba */ "AW", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, FALSE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Australia + { /* Australia */ "AU", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 24, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {149, 5, 30, BOTH, FALSE} - , // 5G, ch 149~165 + , /* 5G, ch 149~165 */ {0} - , // end + , /* end */ } } , - { // Austria + { /* Austria */ "AT", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, TRUE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Bahamas + { /* Bahamas */ "BS", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 24, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {149, 5, 30, BOTH, FALSE} - , // 5G, ch 149~165 + , /* 5G, ch 149~165 */ {0} - , // end + , /* end */ } } , - { // Barbados + { /* Barbados */ "BB", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 24, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, FALSE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Bermuda + { /* Bermuda */ "BM", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 24, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, FALSE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Brazil + { /* Brazil */ "BR", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 24, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 24, BOTH, FALSE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {149, 5, 30, BOTH, FALSE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Belgium + { /* Belgium */ "BE", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 18, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 18, IDOR, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {0} - , // end + , /* end */ } } , - { // Bulgaria + { /* Bulgaria */ "BG", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, ODOR, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Canada + { /* Canada */ "CA", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {149, 5, 30, BOTH, FALSE} - , // 5G, ch 149~165 + , /* 5G, ch 149~165 */ {0} - , // end + , /* end */ } } , - { // Cayman IsLands + { /* Cayman IsLands */ "KY", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 24, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, FALSE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Chile + { /* Chile */ "CL", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 20, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 20, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {149, 5, 20, BOTH, FALSE} - , // 5G, ch 149~165 + , /* 5G, ch 149~165 */ {0} - , // end + , /* end */ } } , - { // China + { /* China */ "CN", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {149, 4, 27, BOTH, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Colombia + { /* Colombia */ "CO", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 17, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 24, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, FALSE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {149, 5, 30, BOTH, FALSE} - , // 5G, ch 149~165 + , /* 5G, ch 149~165 */ {0} - , // end + , /* end */ } } , - { // Costa Rica + { /* Costa Rica */ "CR", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 17, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 24, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {149, 4, 30, BOTH, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Cyprus + { /* Cyprus */ "CY", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 24, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Czech_Republic + { /* Czech_Republic */ "CZ", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {0} - , // end + , /* end */ } } , - { // Denmark + { /* Denmark */ "DK", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Dominican Republic + { /* Dominican Republic */ "DO", CE, { {1, 0, 20, BOTH, FALSE} - , // 2.4 G, ch 0 + , /* 2.4 G, ch 0 */ {149, 4, 20, BOTH, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Equador + { /* Equador */ "EC", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {100, 11, 27, BOTH, FALSE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // El Salvador + { /* El Salvador */ "SV", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 30, BOTH, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {149, 4, 36, BOTH, TRUE} - , // 5G, ch 149~165 + , /* 5G, ch 149~165 */ {0} - , // end + , /* end */ } } , - { // Finland + { /* Finland */ "FI", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // France + { /* France */ "FR", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {0} - , // end + , /* end */ } } , - { // Germany + { /* Germany */ "DE", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Greece + { /* Greece */ "GR", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, ODOR, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Guam + { /* Guam */ "GU", CE, { {1, 11, 20, BOTH, FALSE} - , // 2.4 G, ch 1~11 + , /* 2.4 G, ch 1~11 */ {36, 4, 17, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 24, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, FALSE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {149, 5, 30, BOTH, FALSE} - , // 5G, ch 149~165 + , /* 5G, ch 149~165 */ {0} - , // end + , /* end */ } } , - { // Guatemala + { /* Guatemala */ "GT", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 17, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 24, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {149, 4, 30, BOTH, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Haiti + { /* Haiti */ "HT", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 17, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 24, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {149, 4, 30, BOTH, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Honduras + { /* Honduras */ "HN", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {149, 4, 27, BOTH, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Hong Kong + { /* Hong Kong */ "HK", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {149, 4, 30, BOTH, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Hungary + { /* Hungary */ "HU", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {0} - , // end + , /* end */ } } , - { // Iceland + { /* Iceland */ "IS", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // India + { /* India */ "IN", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {149, 4, 24, IDOR, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Indonesia + { /* Indonesia */ "ID", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {149, 4, 27, BOTH, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Ireland + { /* Ireland */ "IE", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, ODOR, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Israel + { /* Israel */ "IL", CE, { {1, 3, 20, IDOR, FALSE} - , // 2.4 G, ch 1~3 + , /* 2.4 G, ch 1~3 */ {4, 6, 20, BOTH, FALSE} - , // 2.4 G, ch 4~9 + , /* 2.4 G, ch 4~9 */ {10, 4, 20, IDOR, FALSE} - , // 2.4 G, ch 10~13 + , /* 2.4 G, ch 10~13 */ {0} - , // end + , /* end */ } } , - { // Italy + { /* Italy */ "IT", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, ODOR, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Japan + { /* Japan */ "JP", JAP, { {1, 14, 20, BOTH, FALSE} - , // 2.4 G, ch 1~14 + , /* 2.4 G, ch 1~14 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {0} - , // end + , /* end */ } } , - { // Jordan + { /* Jordan */ "JO", CE, { {1, 13, 20, IDOR, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {149, 4, 23, IDOR, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Latvia + { /* Latvia */ "LV", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Liechtenstein + { /* Liechtenstein */ "LI", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Lithuania + { /* Lithuania */ "LT", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Luxemburg + { /* Luxemburg */ "LU", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Malaysia + { /* Malaysia */ "MY", CE, { {36, 4, 23, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {149, 5, 20, BOTH, FALSE} - , // 5G, ch 149~165 + , /* 5G, ch 149~165 */ {0} - , // end + , /* end */ } } , - { // Malta + { /* Malta */ "MT", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Marocco + { /* Marocco */ "MA", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 24, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {0} - , // end + , /* end */ } } , - { // Mexico + { /* Mexico */ "MX", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 24, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {149, 5, 30, IDOR, FALSE} - , // 5G, ch 149~165 + , /* 5G, ch 149~165 */ {0} - , // end + , /* end */ } } , - { // Netherlands + { /* Netherlands */ "NL", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 24, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // New Zealand + { /* New Zealand */ "NZ", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 24, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 24, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {149, 4, 30, BOTH, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Norway + { /* Norway */ "NO", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 24, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 24, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Peru + { /* Peru */ "PE", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {149, 4, 27, BOTH, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Portugal + { /* Portugal */ "PT", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Poland + { /* Poland */ "PL", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Romania + { /* Romania */ "RO", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Russia + { /* Russia */ "RU", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {149, 4, 20, IDOR, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Saudi Arabia + { /* Saudi Arabia */ "SA", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {149, 4, 23, BOTH, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Serbia_and_Montenegro + { /* Serbia_and_Montenegro */ "CS", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {0} - , // end + , /* end */ } } , - { // Singapore + { /* Singapore */ "SG", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {149, 4, 20, BOTH, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Slovakia + { /* Slovakia */ "SK", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Slovenia + { /* Slovenia */ "SI", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {0} - , // end + , /* end */ } } , - { // South Africa + { /* South Africa */ "ZA", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {149, 4, 30, BOTH, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // South Korea + { /* South Korea */ "KR", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 20, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 20, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 8, 20, BOTH, FALSE} - , // 5G, ch 100~128 + , /* 5G, ch 100~128 */ {149, 4, 20, BOTH, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Spain + { /* Spain */ "ES", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 17, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Sweden + { /* Sweden */ "SE", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Switzerland + { /* Switzerland */ "CH", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~13 + , /* 2.4 G, ch 1~13 */ {36, 4, 23, IDOR, TRUE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {0} - , // end + , /* end */ } } , - { // Taiwan + { /* Taiwan */ "TW", CE, { {1, 11, 30, BOTH, FALSE} - , // 2.4 G, ch 1~11 + , /* 2.4 G, ch 1~11 */ {52, 4, 23, IDOR, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {0} - , // end + , /* end */ } } , - { // Turkey + { /* Turkey */ "TR", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~11 + , /* 2.4 G, ch 1~11 */ {36, 4, 23, BOTH, FALSE} - , // 5G, ch 36~48 + , /* 5G, ch 36~48 */ {52, 4, 23, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {0} - , // end + , /* end */ } } , - { // UK + { /* UK */ "GB", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~11 + , /* 2.4 G, ch 1~11 */ {36, 4, 23, IDOR, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {52, 4, 23, IDOR, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {0} - , // end + , /* end */ } } , - { // Ukraine + { /* Ukraine */ "UA", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~11 + , /* 2.4 G, ch 1~11 */ {0} - , // end + , /* end */ } } , - { // United_Arab_Emirates + { /* United_Arab_Emirates */ "AE", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~11 + , /* 2.4 G, ch 1~11 */ {0} - , // end + , /* end */ } } , - { // United_States + { /* United_States */ "US", CE, { {1, 11, 30, BOTH, FALSE} - , // 2.4 G, ch 1~11 + , /* 2.4 G, ch 1~11 */ {36, 4, 17, IDOR, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {52, 4, 24, BOTH, TRUE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 30, BOTH, TRUE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {149, 5, 30, BOTH, FALSE} - , // 5G, ch 149~165 + , /* 5G, ch 149~165 */ {0} - , // end + , /* end */ } } , - { // Venezuela + { /* Venezuela */ "VE", CE, { {1, 13, 20, BOTH, FALSE} - , // 2.4 G, ch 1~11 + , /* 2.4 G, ch 1~11 */ {149, 4, 27, BOTH, FALSE} - , // 5G, ch 149~161 + , /* 5G, ch 149~161 */ {0} - , // end + , /* end */ } } , - { // Default + { /* Default */ "", CE, { {1, 11, 20, BOTH, FALSE} - , // 2.4 G, ch 1~11 + , /* 2.4 G, ch 1~11 */ {36, 4, 20, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {52, 4, 20, BOTH, FALSE} - , // 5G, ch 52~64 + , /* 5G, ch 52~64 */ {100, 11, 20, BOTH, FALSE} - , // 5G, ch 100~140 + , /* 5G, ch 100~140 */ {149, 5, 20, BOTH, FALSE} - , // 5G, ch 149~165 + , /* 5G, ch 149~165 */ {0} - , // end + , /* end */ } } , @@ -1610,7 +1610,7 @@ static UCHAR GetExtCh(IN UCHAR Channel, IN UCHAR Direction) VOID N_ChannelCheck(IN PRTMP_ADAPTER pAd) { - //UCHAR ChannelNum = pAd->ChannelListNum; + /*UCHAR ChannelNum = pAd->ChannelListNum; */ UCHAR Channel = pAd->CommonCfg.Channel; if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) @@ -1663,7 +1663,7 @@ VOID N_ChannelCheck(IN PRTMP_ADAPTER pAd) if (Channel == 14) { pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20; - //pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_NONE; // We didn't set the ExtCh as NONE due to it'll set in RTMPSetHT() + /*pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_NONE; // We didn't set the ExtCh as NONE due to it'll set in RTMPSetHT() */ } } } diff --git a/drivers/staging/rt2860/common/rt_rf.c b/drivers/staging/rt2860/common/rt_rf.c index b6e47a155b4a..8b5be1766fba 100644 --- a/drivers/staging/rt2860/common/rt_rf.c +++ b/drivers/staging/rt2860/common/rt_rf.c @@ -172,7 +172,7 @@ VOID RtmpChipOpsRFHook(IN RTMP_ADAPTER * pAd) RT30xxReverseRFSleepModeSetup; } } -#endif // RT3070 // +#endif /* RT3070 // */ #ifdef RT3090 if (IS_RT3090(pAd) && (pAd->infType == RTMP_DEV_INF_PCI)) { pChipOps->AsicRfTurnOff = RT30xxLoadRFSleepModeSetup; @@ -180,9 +180,9 @@ VOID RtmpChipOpsRFHook(IN RTMP_ADAPTER * pAd) pChipOps->AsicReverseRfFromSleepMode = RT30xxReverseRFSleepModeSetup; } -#endif // RT3090 // +#endif /* RT3090 // */ } -#endif // RT30xx // +#endif /* RT30xx // */ } -#endif // RTMP_RF_RW_SUPPORT // +#endif /* RTMP_RF_RW_SUPPORT // */ diff --git a/drivers/staging/rt2860/common/rtmp_init.c b/drivers/staging/rt2860/common/rtmp_init.c index c169641c5779..0a958704e5a4 100644 --- a/drivers/staging/rt2860/common/rtmp_init.c +++ b/drivers/staging/rt2860/common/rtmp_init.c @@ -40,32 +40,32 @@ UCHAR BIT8[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; char *CipherName[] = { "none", "wep64", "wep128", "TKIP", "AES", "CKIP64", "CKIP128" }; -// -// BBP register initialization set -// +/* */ +/* BBP register initialization set */ +/* */ REG_PAIR BBPRegTable[] = { - {BBP_R65, 0x2C}, // fix rssi issue - {BBP_R66, 0x38}, // Also set this default value to pAd->BbpTuning.R66CurrentValue at initial + {BBP_R65, 0x2C}, /* fix rssi issue */ + {BBP_R66, 0x38}, /* Also set this default value to pAd->BbpTuning.R66CurrentValue at initial */ {BBP_R69, 0x12}, - {BBP_R70, 0xa}, // BBP_R70 will change to 0x8 in ApStartUp and LinkUp for rt2860C, otherwise value is 0xa + {BBP_R70, 0xa}, /* BBP_R70 will change to 0x8 in ApStartUp and LinkUp for rt2860C, otherwise value is 0xa */ {BBP_R73, 0x10}, {BBP_R81, 0x37}, {BBP_R82, 0x62}, {BBP_R83, 0x6A}, - {BBP_R84, 0x99}, // 0x19 is for rt2860E and after. This is for extension channel overlapping IOT. 0x99 is for rt2860D and before - {BBP_R86, 0x00}, // middle range issue, Rory @2008-01-28 - {BBP_R91, 0x04}, // middle range issue, Rory @2008-01-28 - {BBP_R92, 0x00}, // middle range issue, Rory @2008-01-28 - {BBP_R103, 0x00}, // near range high-power issue, requested from Gary @2008-0528 - {BBP_R105, 0x05}, // 0x05 is for rt2860E to turn on FEQ control. It is safe for rt2860D and before, because Bit 7:2 are reserved in rt2860D and before. - {BBP_R106, 0x35}, // for ShortGI throughput + {BBP_R84, 0x99}, /* 0x19 is for rt2860E and after. This is for extension channel overlapping IOT. 0x99 is for rt2860D and before */ + {BBP_R86, 0x00}, /* middle range issue, Rory @2008-01-28 */ + {BBP_R91, 0x04}, /* middle range issue, Rory @2008-01-28 */ + {BBP_R92, 0x00}, /* middle range issue, Rory @2008-01-28 */ + {BBP_R103, 0x00}, /* near range high-power issue, requested from Gary @2008-0528 */ + {BBP_R105, 0x05}, /* 0x05 is for rt2860E to turn on FEQ control. It is safe for rt2860D and before, because Bit 7:2 are reserved in rt2860D and before. */ + {BBP_R106, 0x35}, /* for ShortGI throughput */ }; #define NUM_BBP_REG_PARMS (sizeof(BBPRegTable) / sizeof(REG_PAIR)) -// -// ASIC register initialization sets -// +/* */ +/* ASIC register initialization sets */ +/* */ RTMP_REG_PAIR MACRegTable[] = { #if defined(HW_BEACON_OFFSET) && (HW_BEACON_OFFSET == 0x200) @@ -76,43 +76,43 @@ RTMP_REG_PAIR MACRegTable[] = { {BCN_OFFSET1, 0xfcf8f4f0}, /* 0x3800, 0x3A00, 0x3C00, 0x3E00, 512B for each beacon */ #else #error You must re-calculate new value for BCN_OFFSET0 & BCN_OFFSET1 in MACRegTable[]!!! -#endif // HW_BEACON_OFFSET // - - {LEGACY_BASIC_RATE, 0x0000013f}, // Basic rate set bitmap - {HT_BASIC_RATE, 0x00008003}, // Basic HT rate set , 20M, MCS=3, MM. Format is the same as in TXWI. - {MAC_SYS_CTRL, 0x00}, // 0x1004, , default Disable RX - {RX_FILTR_CFG, 0x17f97}, //0x1400 , RX filter control, - {BKOFF_SLOT_CFG, 0x209}, // default set short slot time, CC_DELAY_TIME should be 2 - //{TX_SW_CFG0, 0x40a06}, // Gary,2006-08-23 - {TX_SW_CFG0, 0x0}, // Gary,2008-05-21 for CWC test - {TX_SW_CFG1, 0x80606}, // Gary,2006-08-23 - {TX_LINK_CFG, 0x1020}, // Gary,2006-08-23 - //{TX_TIMEOUT_CFG, 0x00182090}, // CCK has some problem. So increase timieout value. 2006-10-09// MArvek RT - {TX_TIMEOUT_CFG, 0x000a2090}, // CCK has some problem. So increase timieout value. 2006-10-09// MArvek RT , Modify for 2860E ,2007-08-01 - {MAX_LEN_CFG, MAX_AGGREGATION_SIZE | 0x00001000}, // 0x3018, MAX frame length. Max PSDU = 16kbytes. - {LED_CFG, 0x7f031e46}, // Gary, 2006-08-23 - - {PBF_MAX_PCNT, 0x1F3FBF9F}, //0x1F3f7f9f}, //Jan, 2006/04/20 - - {TX_RTY_CFG, 0x47d01f0f}, // Jan, 2006/11/16, Set TxWI->ACK =0 in Probe Rsp Modify for 2860E ,2007-08-03 - - {AUTO_RSP_CFG, 0x00000013}, // Initial Auto_Responder, because QA will turn off Auto-Responder - {CCK_PROT_CFG, 0x05740003 /*0x01740003 */ }, // Initial Auto_Responder, because QA will turn off Auto-Responder. And RTS threshold is enabled. - {OFDM_PROT_CFG, 0x05740003 /*0x01740003 */ }, // Initial Auto_Responder, because QA will turn off Auto-Responder. And RTS threshold is enabled. +#endif /* HW_BEACON_OFFSET // */ + + {LEGACY_BASIC_RATE, 0x0000013f}, /* Basic rate set bitmap */ + {HT_BASIC_RATE, 0x00008003}, /* Basic HT rate set , 20M, MCS=3, MM. Format is the same as in TXWI. */ + {MAC_SYS_CTRL, 0x00}, /* 0x1004, , default Disable RX */ + {RX_FILTR_CFG, 0x17f97}, /*0x1400 , RX filter control, */ + {BKOFF_SLOT_CFG, 0x209}, /* default set short slot time, CC_DELAY_TIME should be 2 */ + /*{TX_SW_CFG0, 0x40a06}, // Gary,2006-08-23 */ + {TX_SW_CFG0, 0x0}, /* Gary,2008-05-21 for CWC test */ + {TX_SW_CFG1, 0x80606}, /* Gary,2006-08-23 */ + {TX_LINK_CFG, 0x1020}, /* Gary,2006-08-23 */ + /*{TX_TIMEOUT_CFG, 0x00182090}, // CCK has some problem. So increase timieout value. 2006-10-09// MArvek RT */ + {TX_TIMEOUT_CFG, 0x000a2090}, /* CCK has some problem. So increase timieout value. 2006-10-09// MArvek RT , Modify for 2860E ,2007-08-01 */ + {MAX_LEN_CFG, MAX_AGGREGATION_SIZE | 0x00001000}, /* 0x3018, MAX frame length. Max PSDU = 16kbytes. */ + {LED_CFG, 0x7f031e46}, /* Gary, 2006-08-23 */ + + {PBF_MAX_PCNT, 0x1F3FBF9F}, /*0x1F3f7f9f}, //Jan, 2006/04/20 */ + + {TX_RTY_CFG, 0x47d01f0f}, /* Jan, 2006/11/16, Set TxWI->ACK =0 in Probe Rsp Modify for 2860E ,2007-08-03 */ + + {AUTO_RSP_CFG, 0x00000013}, /* Initial Auto_Responder, because QA will turn off Auto-Responder */ + {CCK_PROT_CFG, 0x05740003 /*0x01740003 */ }, /* Initial Auto_Responder, because QA will turn off Auto-Responder. And RTS threshold is enabled. */ + {OFDM_PROT_CFG, 0x05740003 /*0x01740003 */ }, /* Initial Auto_Responder, because QA will turn off Auto-Responder. And RTS threshold is enabled. */ #ifdef RTMP_MAC_USB - {PBF_CFG, 0xf40006}, // Only enable Queue 2 - {MM40_PROT_CFG, 0x3F44084}, // Initial Auto_Responder, because QA will turn off Auto-Responder + {PBF_CFG, 0xf40006}, /* Only enable Queue 2 */ + {MM40_PROT_CFG, 0x3F44084}, /* Initial Auto_Responder, because QA will turn off Auto-Responder */ {WPDMA_GLO_CFG, 0x00000030}, -#endif // RTMP_MAC_USB // - {GF20_PROT_CFG, 0x01744004}, // set 19:18 --> Short NAV for MIMO PS +#endif /* RTMP_MAC_USB // */ + {GF20_PROT_CFG, 0x01744004}, /* set 19:18 --> Short NAV for MIMO PS */ {GF40_PROT_CFG, 0x03F44084}, {MM20_PROT_CFG, 0x01744004}, #ifdef RTMP_MAC_PCI {MM40_PROT_CFG, 0x03F54084}, -#endif // RTMP_MAC_PCI // - {TXOP_CTRL_CFG, 0x0000583f, /*0x0000243f *//*0x000024bf */ }, //Extension channel backoff. +#endif /* RTMP_MAC_PCI // */ + {TXOP_CTRL_CFG, 0x0000583f, /*0x0000243f *//*0x000024bf */ }, /*Extension channel backoff. */ {TX_RTS_CFG, 0x00092b20}, - {EXP_ACK_TIME, 0x002400ca}, // default value + {EXP_ACK_TIME, 0x002400ca}, /* default value */ {TXOP_HLDR_ET, 0x00000002}, @@ -121,7 +121,7 @@ RTMP_REG_PAIR MACRegTable[] = { and beacon1 is SIFS (10us), so if INTEL 2200bg card connects to BSS0, the ping will always lost. So we change the SIFS of CCK from 10us to 16us. */ {XIFS_TIME_CFG, 0x33a41010}, - {PWR_PIN_CFG, 0x00000003}, // patch for 2880-E + {PWR_PIN_CFG, 0x00000003}, /* patch for 2880-E */ }; RTMP_REG_PAIR STAMACRegTable[] = { @@ -165,7 +165,7 @@ NDIS_STATUS RTMPAllocAdapterBlock(IN PVOID handle, *ppAdapter = NULL; do { - // Allocate RTMP_ADAPTER memory block + /* Allocate RTMP_ADAPTER memory block */ pBeaconBuf = kmalloc(MAX_BEACON_SIZE, MEM_ALLOC_FLAG); if (pBeaconBuf == NULL) { Status = NDIS_STATUS_FAILURE; @@ -184,14 +184,14 @@ NDIS_STATUS RTMPAllocAdapterBlock(IN PVOID handle, ("\n\n=== pAd = %p, size = %d ===\n\n", pAd, (UINT32) sizeof(RTMP_ADAPTER))); - // Init spin locks + /* Init spin locks */ NdisAllocateSpinLock(&pAd->MgmtRingLock); #ifdef RTMP_MAC_PCI NdisAllocateSpinLock(&pAd->RxRingLock); #ifdef RT3090 NdisAllocateSpinLock(&pAd->McuCmdLock); -#endif // RT3090 // -#endif // RTMP_MAC_PCI // +#endif /* RT3090 // */ +#endif /* RTMP_MAC_PCI // */ for (index = 0; index < NUM_OF_TX_RING; index++) { NdisAllocateSpinLock(&pAd->TxSwQueueLock[index]); @@ -238,9 +238,9 @@ VOID RTMPReadTxPwrPerRate(IN PRTMP_ADAPTER pAd) UCHAR t1, t2, t3, t4; BOOLEAN bApwrdeltaMinus = TRUE, bGpwrdeltaMinus = TRUE; - // - // Get power delta for 20MHz and 40MHz. - // + /* */ + /* Get power delta for 20MHz and 40MHz. */ + /* */ DBGPRINT(RT_DEBUG_TRACE, ("Txpower per Rate\n")); RT28xx_EEPROM_READ16(pAd, EEPROM_TXPOWER_DELTA, value2); Apwrdelta = 0; @@ -267,9 +267,9 @@ VOID RTMPReadTxPwrPerRate(IN PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_TRACE, ("Gpwrdelta = %x, Apwrdelta = %x .\n", Gpwrdelta, Apwrdelta)); - // - // Get Txpower per MCS for 20MHz in 2.4G. - // + /* */ + /* Get Txpower per MCS for 20MHz in 2.4G. */ + /* */ for (i = 0; i < 5; i++) { RT28xx_EEPROM_READ16(pAd, EEPROM_TXPOWER_BYRATE_20MHZ_2_4G + i * 4, @@ -447,12 +447,12 @@ VOID RTMPReadChannelPwr(IN PRTMP_ADAPTER pAd) EEPROM_TX_PWR_STRUC Power; EEPROM_TX_PWR_STRUC Power2; - // Read Tx power value for all channels - // Value from 1 - 0x7f. Default value is 24. - // Power value : 2.4G 0x00 (0) ~ 0x1F (31) - // : 5.5G 0xF9 (-7) ~ 0x0F (15) + /* Read Tx power value for all channels */ + /* Value from 1 - 0x7f. Default value is 24. */ + /* Power value : 2.4G 0x00 (0) ~ 0x1F (31) */ + /* : 5.5G 0xF9 (-7) ~ 0x0F (15) */ - // 0. 11b/g, ch1 - ch 14 + /* 0. 11b/g, ch1 - ch 14 */ for (i = 0; i < 7; i++) { RT28xx_EEPROM_READ16(pAd, EEPROM_G_TX_PWR_OFFSET + i * 2, Power.word); @@ -482,8 +482,8 @@ VOID RTMPReadChannelPwr(IN PRTMP_ADAPTER pAd) pAd->TxPower[i * 2 + 1].Power2 = Power2.field.Byte1; } - // 1. U-NII lower/middle band: 36, 38, 40; 44, 46, 48; 52, 54, 56; 60, 62, 64 (including central frequency in BW 40MHz) - // 1.1 Fill up channel + /* 1. U-NII lower/middle band: 36, 38, 40; 44, 46, 48; 52, 54, 56; 60, 62, 64 (including central frequency in BW 40MHz) */ + /* 1.1 Fill up channel */ choffset = 14; for (i = 0; i < 4; i++) { pAd->TxPower[3 * i + choffset + 0].Channel = 36 + i * 8 + 0; @@ -499,7 +499,7 @@ VOID RTMPReadChannelPwr(IN PRTMP_ADAPTER pAd) pAd->TxPower[3 * i + choffset + 2].Power2 = DEFAULT_RF_TX_POWER; } - // 1.2 Fill up power + /* 1.2 Fill up power */ for (i = 0; i < 6; i++) { RT28xx_EEPROM_READ16(pAd, EEPROM_A_TX_PWR_OFFSET + i * 2, Power.word); @@ -523,8 +523,8 @@ VOID RTMPReadChannelPwr(IN PRTMP_ADAPTER pAd) Power2.field.Byte1; } - // 2. HipperLAN 2 100, 102 ,104; 108, 110, 112; 116, 118, 120; 124, 126, 128; 132, 134, 136; 140 (including central frequency in BW 40MHz) - // 2.1 Fill up channel + /* 2. HipperLAN 2 100, 102 ,104; 108, 110, 112; 116, 118, 120; 124, 126, 128; 132, 134, 136; 140 (including central frequency in BW 40MHz) */ + /* 2.1 Fill up channel */ choffset = 14 + 12; for (i = 0; i < 5; i++) { pAd->TxPower[3 * i + choffset + 0].Channel = 100 + i * 8 + 0; @@ -543,7 +543,7 @@ VOID RTMPReadChannelPwr(IN PRTMP_ADAPTER pAd) pAd->TxPower[3 * 5 + choffset + 0].Power = DEFAULT_RF_TX_POWER; pAd->TxPower[3 * 5 + choffset + 0].Power2 = DEFAULT_RF_TX_POWER; - // 2.2 Fill up power + /* 2.2 Fill up power */ for (i = 0; i < 8; i++) { RT28xx_EEPROM_READ16(pAd, EEPROM_A_TX_PWR_OFFSET + (choffset - 14) + @@ -569,8 +569,8 @@ VOID RTMPReadChannelPwr(IN PRTMP_ADAPTER pAd) Power2.field.Byte1; } - // 3. U-NII upper band: 149, 151, 153; 157, 159, 161; 165, 167, 169; 171, 173 (including central frequency in BW 40MHz) - // 3.1 Fill up channel + /* 3. U-NII upper band: 149, 151, 153; 157, 159, 161; 165, 167, 169; 171, 173 (including central frequency in BW 40MHz) */ + /* 3.1 Fill up channel */ choffset = 14 + 12 + 16; /*for (i = 0; i < 2; i++) */ for (i = 0; i < 3; i++) { @@ -594,7 +594,7 @@ VOID RTMPReadChannelPwr(IN PRTMP_ADAPTER pAd) pAd->TxPower[3 * 3 + choffset + 1].Power = DEFAULT_RF_TX_POWER; pAd->TxPower[3 * 3 + choffset + 1].Power2 = DEFAULT_RF_TX_POWER; - // 3.2 Fill up power + /* 3.2 Fill up power */ /*for (i = 0; i < 4; i++) */ for (i = 0; i < 6; i++) { RT28xx_EEPROM_READ16(pAd, @@ -621,7 +621,7 @@ VOID RTMPReadChannelPwr(IN PRTMP_ADAPTER pAd) Power2.field.Byte1; } - // 4. Print and Debug + /* 4. Print and Debug */ /*choffset = 14 + 12 + 16 + 7; */ choffset = 14 + 12 + 16 + 11; @@ -691,21 +691,21 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) if (pAd->chipOps.eeinit) pAd->chipOps.eeinit(pAd); - // Init EEPROM Address Number, before access EEPROM; if 93c46, EEPROMAddressNum=6, else if 93c66, EEPROMAddressNum=8 + /* Init EEPROM Address Number, before access EEPROM; if 93c46, EEPROMAddressNum=6, else if 93c66, EEPROMAddressNum=8 */ RTMP_IO_READ32(pAd, E2PROM_CSR, &data); DBGPRINT(RT_DEBUG_TRACE, ("--> E2PROM_CSR = 0x%x\n", data)); if ((data & 0x30) == 0) - pAd->EEPROMAddressNum = 6; // 93C46 + pAd->EEPROMAddressNum = 6; /* 93C46 */ else if ((data & 0x30) == 0x10) - pAd->EEPROMAddressNum = 8; // 93C66 + pAd->EEPROMAddressNum = 8; /* 93C66 */ else - pAd->EEPROMAddressNum = 8; // 93C86 + pAd->EEPROMAddressNum = 8; /* 93C86 */ DBGPRINT(RT_DEBUG_TRACE, ("--> EEPROMAddressNum = %d\n", pAd->EEPROMAddressNum)); - // RT2860 MAC no longer auto load MAC address from E2PROM. Driver has to intialize - // MAC address registers according to E2PROM setting + /* RT2860 MAC no longer auto load MAC address from E2PROM. Driver has to intialize */ + /* MAC address registers according to E2PROM setting */ if (mac_addr == NULL || strlen((PSTRING) mac_addr) != 17 || mac_addr[2] != ':' || mac_addr[5] != ':' || mac_addr[8] != ':' || @@ -741,12 +741,12 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) } { - //more conveninet to test mbssid, so ap's bssid &0xf1 + /*more conveninet to test mbssid, so ap's bssid &0xf1 */ if (pAd->PermanentAddress[0] == 0xff) pAd->PermanentAddress[0] = RandomByte(pAd) & 0xf8; - //if (pAd->PermanentAddress[5] == 0xff) - // pAd->PermanentAddress[5] = RandomByte(pAd)&0xf8; + /*if (pAd->PermanentAddress[5] == 0xff) */ + /* pAd->PermanentAddress[5] = RandomByte(pAd)&0xf8; */ DBGPRINT_RAW(RT_DEBUG_TRACE, ("E2PROM MAC: =%02x:%02x:%02x:%02x:%02x:%02x\n", @@ -777,12 +777,12 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) } } - // if not return early. cause fail at emulation. - // Init the channel number for TX channel power + /* if not return early. cause fail at emulation. */ + /* Init the channel number for TX channel power */ RTMPReadChannelPwr(pAd); - // if E2PROM version mismatch with driver's expectation, then skip - // all subsequent E2RPOM retieval and set a system error bit to notify GUI + /* if E2PROM version mismatch with driver's expectation, then skip */ + /* all subsequent E2RPOM retieval and set a system error bit to notify GUI */ RT28xx_EEPROM_READ16(pAd, EEPROM_VERSION_OFFSET, Version.word); pAd->EepromVersion = Version.field.Version + Version.field.FaeReleaseNumber * 256; @@ -811,14 +811,14 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) pAd->EEPROMDefaultValue[i] = 0xffff; return; */ } - // Read BBP default value from EEPROM and store to array(EEPROMDefaultValue) in pAd + /* Read BBP default value from EEPROM and store to array(EEPROMDefaultValue) in pAd */ RT28xx_EEPROM_READ16(pAd, EEPROM_NIC1_OFFSET, value); pAd->EEPROMDefaultValue[0] = value; RT28xx_EEPROM_READ16(pAd, EEPROM_NIC2_OFFSET, value); pAd->EEPROMDefaultValue[1] = value; - RT28xx_EEPROM_READ16(pAd, 0x38, value); // Country Region + RT28xx_EEPROM_READ16(pAd, 0x38, value); /* Country Region */ pAd->EEPROMDefaultValue[2] = value; for (i = 0; i < 8; i++) { @@ -827,10 +827,10 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) pAd->EEPROMDefaultValue[i + 3] = value; } - // We have to parse NIC configuration 0 at here. - // If TSSI did not have preloaded value, it should reset the TxAutoAgc to false - // Therefore, we have to read TxAutoAgc control beforehand. - // Read Tx AGC control bit + /* We have to parse NIC configuration 0 at here. */ + /* If TSSI did not have preloaded value, it should reset the TxAutoAgc to false */ + /* Therefore, we have to read TxAutoAgc control beforehand. */ + /* Read Tx AGC control bit */ Antenna.word = pAd->EEPROMDefaultValue[0]; if (Antenna.word == 0xFFFF) { #ifdef RT30xx @@ -840,7 +840,7 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) Antenna.field.TxPath = 1; Antenna.field.RxPath = 1; } else -#endif // RT30xx // +#endif /* RT30xx // */ { Antenna.word = 0; @@ -852,7 +852,7 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) Antenna.word)); } } - // Choose the desired Tx&Rx stream. + /* Choose the desired Tx&Rx stream. */ if ((pAd->CommonCfg.TxStream == 0) || (pAd->CommonCfg.TxStream > Antenna.field.TxPath)) pAd->CommonCfg.TxStream = Antenna.field.TxPath; @@ -863,13 +863,13 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) if ((pAd->MACVersion < RALINK_2883_VERSION) && (pAd->CommonCfg.RxStream > 2)) { - // only 2 Rx streams for RT2860 series + /* only 2 Rx streams for RT2860 series */ pAd->CommonCfg.RxStream = 2; } } - // 3*3 - // read value from EEPROM and set them to CSR174 ~ 177 in chain0 ~ chain2 - // yet implement + /* 3*3 */ + /* read value from EEPROM and set them to CSR174 ~ 177 in chain0 ~ chain2 */ + /* yet implement */ for (i = 0; i < 3; i++) { } @@ -894,25 +894,25 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) ("NICReadEEPROMParameters: RxPath = %d, TxPath = %d\n", Antenna.field.RxPath, Antenna.field.TxPath)); - // Save the antenna for future use + /* Save the antenna for future use */ pAd->Antenna.word = Antenna.word; - // Set the RfICType here, then we can initialize RFIC related operation callbacks + /* Set the RfICType here, then we can initialize RFIC related operation callbacks */ pAd->Mlme.RealRxPath = (UCHAR) Antenna.field.RxPath; pAd->RfIcType = (UCHAR) Antenna.field.RfIcType; #ifdef RTMP_RF_RW_SUPPORT RtmpChipOpsRFHook(pAd); -#endif // RTMP_RF_RW_SUPPORT // +#endif /* RTMP_RF_RW_SUPPORT // */ #ifdef RTMP_MAC_PCI sprintf((PSTRING) pAd->nickname, "RT2860STA"); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ - // - // Reset PhyMode if we don't support 802.11a - // Only RFIC_2850 & RFIC_2750 support 802.11a - // + /* */ + /* Reset PhyMode if we don't support 802.11a */ + /* Only RFIC_2850 & RFIC_2750 support 802.11a */ + /* */ if ((Antenna.field.RfIcType != RFIC_2850) && (Antenna.field.RfIcType != RFIC_2750) && (Antenna.field.RfIcType != RFIC_3052)) { @@ -925,8 +925,8 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) (pAd->CommonCfg.PhyMode == PHY_11N_5G)) pAd->CommonCfg.PhyMode = PHY_11BGN_MIXED; } - // Read TSSI reference and TSSI boundary for temperature compensation. This is ugly - // 0. 11b/g + /* Read TSSI reference and TSSI boundary for temperature compensation. This is ugly */ + /* 0. 11b/g */ { /* these are tempature reference value (0x00 ~ 0xFE) ex: 0x00 0x15 0x25 0x45 0x88 0xA0 0xB5 0xD0 0xF0 @@ -951,7 +951,7 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) pAd->TssiMinusBoundaryG[0] = pAd->TssiRefG; pAd->TssiPlusBoundaryG[0] = pAd->TssiRefG; - // Disable TxAgc if the based value is not right + /* Disable TxAgc if the based value is not right */ if (pAd->TssiRefG == 0xff) pAd->bAutoTxAgcG = FALSE; @@ -965,7 +965,7 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) pAd->TssiPlusBoundaryG[3], pAd->TssiPlusBoundaryG[4], pAd->TxAgcStepG, pAd->bAutoTxAgcG)); } - // 1. 11a + /* 1. 11a */ { RT28xx_EEPROM_READ16(pAd, 0xD4, Power.word); pAd->TssiMinusBoundaryA[4] = Power.field.Byte0; @@ -986,7 +986,7 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) pAd->TssiMinusBoundaryA[0] = pAd->TssiRefA; pAd->TssiPlusBoundaryA[0] = pAd->TssiRefA; - // Disable TxAgc if the based value is not right + /* Disable TxAgc if the based value is not right */ if (pAd->TssiRefA == 0xff) pAd->bAutoTxAgcA = FALSE; @@ -1002,7 +1002,7 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) } pAd->BbpRssiToDbmDelta = 0x0; - // Read frequency offset setting for RF + /* Read frequency offset setting for RF */ RT28xx_EEPROM_READ16(pAd, EEPROM_FREQ_OFFSET, value); if ((value & 0x00FF) != 0x00FF) pAd->RfFreqOffset = (ULONG) (value & 0x00FF); @@ -1011,9 +1011,9 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) DBGPRINT(RT_DEBUG_TRACE, ("E2PROM: RF FreqOffset=0x%lx \n", pAd->RfFreqOffset)); - //CountryRegion byte offset (38h) - value = pAd->EEPROMDefaultValue[2] >> 8; // 2.4G band - value2 = pAd->EEPROMDefaultValue[2] & 0x00FF; // 5G band + /*CountryRegion byte offset (38h) */ + value = pAd->EEPROMDefaultValue[2] >> 8; /* 2.4G band */ + value2 = pAd->EEPROMDefaultValue[2] & 0x00FF; /* 5G band */ if ((value <= REGION_MAXIMUM_BG_BAND) && (value2 <= REGION_MAXIMUM_A_BAND)) { @@ -1024,10 +1024,10 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) RTMPSetPhyMode(pAd, TmpPhy); SetCommonHT(pAd); } - // - // Get RSSI Offset on EEPROM 0x9Ah & 0x9Ch. - // The valid value are (-10 ~ 10) - // + /* */ + /* Get RSSI Offset on EEPROM 0x9Ah & 0x9Ch. */ + /* The valid value are (-10 ~ 10) */ + /* */ RT28xx_EEPROM_READ16(pAd, EEPROM_RSSI_BG_OFFSET, value); pAd->BGRssiOffset0 = value & 0x00ff; pAd->BGRssiOffset1 = (value >> 8); @@ -1038,15 +1038,15 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) pAd->BLNAGain = value & 0x00ff; pAd->ALNAGain0 = (value >> 8); - // Validate 11b/g RSSI_0 offset. + /* Validate 11b/g RSSI_0 offset. */ if ((pAd->BGRssiOffset0 < -10) || (pAd->BGRssiOffset0 > 10)) pAd->BGRssiOffset0 = 0; - // Validate 11b/g RSSI_1 offset. + /* Validate 11b/g RSSI_1 offset. */ if ((pAd->BGRssiOffset1 < -10) || (pAd->BGRssiOffset1 > 10)) pAd->BGRssiOffset1 = 0; - // Validate 11b/g RSSI_2 offset. + /* Validate 11b/g RSSI_2 offset. */ if ((pAd->BGRssiOffset2 < -10) || (pAd->BGRssiOffset2 > 10)) pAd->BGRssiOffset2 = 0; @@ -1062,25 +1062,25 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) if (((UCHAR) pAd->ALNAGain2 == 0xFF) || (pAd->ALNAGain2 == 0x00)) pAd->ALNAGain2 = pAd->ALNAGain0; - // Validate 11a RSSI_0 offset. + /* Validate 11a RSSI_0 offset. */ if ((pAd->ARssiOffset0 < -10) || (pAd->ARssiOffset0 > 10)) pAd->ARssiOffset0 = 0; - // Validate 11a RSSI_1 offset. + /* Validate 11a RSSI_1 offset. */ if ((pAd->ARssiOffset1 < -10) || (pAd->ARssiOffset1 > 10)) pAd->ARssiOffset1 = 0; - //Validate 11a RSSI_2 offset. + /*Validate 11a RSSI_2 offset. */ if ((pAd->ARssiOffset2 < -10) || (pAd->ARssiOffset2 > 10)) pAd->ARssiOffset2 = 0; #ifdef RT30xx - // - // Get TX mixer gain setting - // 0xff are invalid value - // Note: RT30xX default value is 0x00 and will program to RF_R17 only when this value is not zero. - // RT359X default value is 0x02 - // + /* */ + /* Get TX mixer gain setting */ + /* 0xff are invalid value */ + /* Note: RT30xX default value is 0x00 and will program to RF_R17 only when this value is not zero. */ + /* RT359X default value is 0x02 */ + /* */ if (IS_RT30xx(pAd) || IS_RT3572(pAd)) { RT28xx_EEPROM_READ16(pAd, EEPROM_TXMIXER_GAIN_2_4G, value); pAd->TxMixerGain24G = 0; @@ -1090,11 +1090,11 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) pAd->TxMixerGain24G = (UCHAR) value; } } -#endif // RT30xx // +#endif /* RT30xx // */ - // - // Get LED Setting. - // + /* */ + /* Get LED Setting. */ + /* */ RT28xx_EEPROM_READ16(pAd, 0x3a, value); pAd->LedCntl.word = (value >> 8); RT28xx_EEPROM_READ16(pAd, EEPROM_LED1_OFFSET, value); @@ -1109,8 +1109,8 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) #ifdef RT30xx #ifdef RTMP_EFUSE_SUPPORT RtmpEfuseSupportCheck(pAd); -#endif // RTMP_EFUSE_SUPPORT // -#endif // RT30xx // +#endif /* RTMP_EFUSE_SUPPORT // */ +#endif /* RT30xx // */ DBGPRINT(RT_DEBUG_TRACE, ("<-- NICReadEEPROMParameters\n")); } @@ -1138,7 +1138,7 @@ VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) UINT32 data = 0; UCHAR BBPR1 = 0; USHORT i; -// EEPROM_ANTENNA_STRUC Antenna; +/* EEPROM_ANTENNA_STRUC Antenna; */ EEPROM_NIC_CONFIG2_STRUC NicConfig2; UCHAR BBPR3 = 0; @@ -1166,18 +1166,18 @@ VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) } } - // Save the antenna for future use + /* Save the antenna for future use */ pAd->NicConfig2.word = NicConfig2.word; #ifdef RT30xx - // set default antenna as main + /* set default antenna as main */ if (pAd->RfIcType == RFIC_3020) AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); -#endif // RT30xx // +#endif /* RT30xx // */ - // - // Send LED Setting to MCU. - // + /* */ + /* Send LED Setting to MCU. */ + /* */ if (pAd->LedCntl.word == 0xFF) { pAd->LedCntl.word = 0x01; pAd->Led1 = 0x5555; @@ -1185,10 +1185,10 @@ VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) #ifdef RTMP_MAC_PCI pAd->Led3 = 0xA9F8; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB pAd->Led3 = 0x5627; -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ } AsicSendCommandToMcu(pAd, 0x52, 0xff, (UCHAR) pAd->Led1, @@ -1200,19 +1200,19 @@ VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) AsicSendCommandToMcu(pAd, 0x51, 0xff, 0, pAd->LedCntl.field.Polarity); pAd->LedIndicatorStrength = 0xFF; - RTMPSetSignalLED(pAd, -100); // Force signal strength Led to be turned off, before link up + RTMPSetSignalLED(pAd, -100); /* Force signal strength Led to be turned off, before link up */ { - // Read Hardware controlled Radio state enable bit + /* Read Hardware controlled Radio state enable bit */ if (NicConfig2.field.HardwareRadioControl == 1) { pAd->StaCfg.bHardwareRadio = TRUE; - // Read GPIO pin2 as Hardware controlled radio state + /* Read GPIO pin2 as Hardware controlled radio state */ RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &data); if ((data & 0x04) == 0) { pAd->StaCfg.bHwRadio = FALSE; pAd->StaCfg.bRadio = FALSE; -// RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x00001818); +/* RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x00001818); */ RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); } } else @@ -1227,15 +1227,15 @@ VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) AsicSendCommandToMcu(pAd, 0x30, PowerRadioOffCID, 0xff, 0x02); AsicCheckCommanOk(pAd, PowerRadioOffCID); -#endif // RT3090 // +#endif /* RT3090 // */ #ifndef RT3090 AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02); -#endif // RT3090 // +#endif /* RT3090 // */ AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x00); - // 2-1. wait command ok. + /* 2-1. wait command ok. */ AsicCheckCommanOk(pAd, PowerWakeCID); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ } } @@ -1246,8 +1246,8 @@ VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) if (pChipOps->AsicReverseRfFromSleepMode) pChipOps->AsicReverseRfFromSleepMode(pAd); } - // 3090 MCU Wakeup command needs more time to be stable. - // Before stable, don't issue other MCU command to prevent from firmware error. + /* 3090 MCU Wakeup command needs more time to be stable. */ + /* Before stable, don't issue other MCU command to prevent from firmware error. */ if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd) @@ -1258,22 +1258,22 @@ VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) pAd->brt30xxBanMcuCmd = FALSE; RTMP_SEM_UNLOCK(&pAd->McuCmdLock); } -#endif // RT30xx // -#endif // RTMP_MAC_PCI // +#endif /* RT30xx // */ +#endif /* RTMP_MAC_PCI // */ - // Turn off patching for cardbus controller + /* Turn off patching for cardbus controller */ if (NicConfig2.field.CardbusAcceleration == 1) { -// pAd->bTest1 = TRUE; +/* pAd->bTest1 = TRUE; */ } if (NicConfig2.field.DynamicTxAgcControl == 1) pAd->bAutoTxAgcA = pAd->bAutoTxAgcG = TRUE; else pAd->bAutoTxAgcA = pAd->bAutoTxAgcG = FALSE; - // - // Since BBP has been progamed, to make sure BBP setting will be - // upate inside of AsicAntennaSelect, so reset to UNKNOWN_BAND!! - // + /* */ + /* Since BBP has been progamed, to make sure BBP setting will be */ + /* upate inside of AsicAntennaSelect, so reset to UNKNOWN_BAND!! */ + /* */ pAd->CommonCfg.BandState = UNKNOWN_BAND; RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBPR3); @@ -1288,7 +1288,7 @@ VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBPR3); { - // Handle the difference when 1T + /* Handle the difference when 1T */ RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &BBPR1); if (pAd->Antenna.field.TxPath == 1) { BBPR1 &= (~0x18); @@ -1303,13 +1303,13 @@ VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) #ifdef RTMP_MAC_USB #ifdef RT30xx - // update registers from EEPROM for RT3071 or later(3572/3592). + /* update registers from EEPROM for RT3071 or later(3572/3592). */ if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) { UCHAR RegIdx, RegValue; USHORT value; - // after RT3071, write BBP from EEPROM 0xF0 to 0x102 + /* after RT3071, write BBP from EEPROM 0xF0 to 0x102 */ for (i = 0xF0; i <= 0x102; i = i + 2) { value = 0xFFFF; RT28xx_EEPROM_READ16(pAd, i, value); @@ -1324,7 +1324,7 @@ VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) } } - // after RT3071, write RF from EEPROM 0x104 to 0x116 + /* after RT3071, write RF from EEPROM 0x104 to 0x116 */ for (i = 0x104; i <= 0x116; i = i + 2) { value = 0xFFFF; RT28xx_EEPROM_READ16(pAd, i, value); @@ -1338,8 +1338,8 @@ VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) } } } -#endif // RT30xx // -#endif // RTMP_MAC_USB // +#endif /* RT30xx // */ +#endif /* RTMP_MAC_USB // */ DBGPRINT(RT_DEBUG_TRACE, ("TxPath = %d, RxPath = %d, RFIC=%d, Polar+LED mode=%x\n", @@ -1373,14 +1373,14 @@ NDIS_STATUS NICInitializeAdapter(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) #ifdef RTMP_MAC_PCI UINT32 Value; DELAY_INT_CFG_STRUC IntCfg; -#endif // RTMP_MAC_PCI // -// INT_MASK_CSR_STRUC IntMask; +#endif /* RTMP_MAC_PCI // */ +/* INT_MASK_CSR_STRUC IntMask; */ ULONG i = 0, j = 0; AC_TXOP_CSR0_STRUC csr0; DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitializeAdapter\n")); - // 3. Set DMA global configuration except TX_DMA_EN and RX_DMA_EN bits: + /* 3. Set DMA global configuration except TX_DMA_EN and RX_DMA_EN bits: */ retry: i = 0; do { @@ -1398,7 +1398,7 @@ retry: GloCfg.field.EnTXWriteBackDDONE = 1; RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); - // Record HW Beacon offset + /* Record HW Beacon offset */ pAd->BeaconOffset[0] = HW_BEACON_BASE0; pAd->BeaconOffset[1] = HW_BEACON_BASE1; pAd->BeaconOffset[2] = HW_BEACON_BASE2; @@ -1408,19 +1408,19 @@ retry: pAd->BeaconOffset[6] = HW_BEACON_BASE6; pAd->BeaconOffset[7] = HW_BEACON_BASE7; - // - // write all shared Ring's base address into ASIC - // + /* */ + /* write all shared Ring's base address into ASIC */ + /* */ - // asic simulation sequence put this ahead before loading firmware. - // pbf hardware reset + /* asic simulation sequence put this ahead before loading firmware. */ + /* pbf hardware reset */ #ifdef RTMP_MAC_PCI - RTMP_IO_WRITE32(pAd, WPDMA_RST_IDX, 0x1003f); // 0x10000 for reset rx, 0x3f resets all 6 tx rings. + RTMP_IO_WRITE32(pAd, WPDMA_RST_IDX, 0x1003f); /* 0x10000 for reset rx, 0x3f resets all 6 tx rings. */ RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, 0xe1f); RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, 0xe00); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ - // Initialze ASIC for TX & Rx operation + /* Initialze ASIC for TX & Rx operation */ if (NICInitializeAsic(pAd, bHardReset) != NDIS_STATUS_SUCCESS) { if (j++ == 0) { NICLoadFirmware(pAd); @@ -1430,46 +1430,46 @@ retry: } #ifdef RTMP_MAC_PCI - // Write AC_BK base address register + /* Write AC_BK base address register */ Value = RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_AC_BK].Cell[0].AllocPa); RTMP_IO_WRITE32(pAd, TX_BASE_PTR1, Value); DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR1 : 0x%x\n", Value)); - // Write AC_BE base address register + /* Write AC_BE base address register */ Value = RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_AC_BE].Cell[0].AllocPa); RTMP_IO_WRITE32(pAd, TX_BASE_PTR0, Value); DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR0 : 0x%x\n", Value)); - // Write AC_VI base address register + /* Write AC_VI base address register */ Value = RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_AC_VI].Cell[0].AllocPa); RTMP_IO_WRITE32(pAd, TX_BASE_PTR2, Value); DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR2 : 0x%x\n", Value)); - // Write AC_VO base address register + /* Write AC_VO base address register */ Value = RTMP_GetPhysicalAddressLow(pAd->TxRing[QID_AC_VO].Cell[0].AllocPa); RTMP_IO_WRITE32(pAd, TX_BASE_PTR3, Value); DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR3 : 0x%x\n", Value)); - // Write MGMT_BASE_CSR register + /* Write MGMT_BASE_CSR register */ Value = RTMP_GetPhysicalAddressLow(pAd->MgmtRing.Cell[0].AllocPa); RTMP_IO_WRITE32(pAd, TX_BASE_PTR5, Value); DBGPRINT(RT_DEBUG_TRACE, ("--> TX_BASE_PTR5 : 0x%x\n", Value)); - // Write RX_BASE_CSR register + /* Write RX_BASE_CSR register */ Value = RTMP_GetPhysicalAddressLow(pAd->RxRing.Cell[0].AllocPa); RTMP_IO_WRITE32(pAd, RX_BASE_PTR, Value); DBGPRINT(RT_DEBUG_TRACE, ("--> RX_BASE_PTR : 0x%x\n", Value)); - // Init RX Ring index pointer + /* Init RX Ring index pointer */ pAd->RxRing.RxSwReadIdx = 0; pAd->RxRing.RxCpuIdx = RX_RING_SIZE - 1; RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RxCpuIdx); - // Init TX rings index pointer + /* Init TX rings index pointer */ { for (i = 0; i < NUM_OF_TX_RING; i++) { pAd->TxRing[i].TxSwFreeIdx = 0; @@ -1479,16 +1479,16 @@ retry: } } - // init MGMT ring index pointer + /* init MGMT ring index pointer */ pAd->MgmtRing.TxSwFreeIdx = 0; pAd->MgmtRing.TxCpuIdx = 0; RTMP_IO_WRITE32(pAd, TX_MGMTCTX_IDX, pAd->MgmtRing.TxCpuIdx); - // - // set each Ring's SIZE into ASIC. Descriptor Size is fixed by design. - // + /* */ + /* set each Ring's SIZE into ASIC. Descriptor Size is fixed by design. */ + /* */ - // Write TX_RING_CSR0 register + /* Write TX_RING_CSR0 register */ Value = TX_RING_SIZE; RTMP_IO_WRITE32(pAd, TX_MAX_CNT0, Value); RTMP_IO_WRITE32(pAd, TX_MAX_CNT1, Value); @@ -1498,25 +1498,25 @@ retry: Value = MGMT_RING_SIZE; RTMP_IO_WRITE32(pAd, TX_MGMTMAX_CNT, Value); - // Write RX_RING_CSR register + /* Write RX_RING_CSR register */ Value = RX_RING_SIZE; RTMP_IO_WRITE32(pAd, RX_MAX_CNT, Value); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ - // WMM parameter + /* WMM parameter */ csr0.word = 0; RTMP_IO_WRITE32(pAd, WMM_TXOP0_CFG, csr0.word); if (pAd->CommonCfg.PhyMode == PHY_11B) { - csr0.field.Ac0Txop = 192; // AC_VI: 192*32us ~= 6ms - csr0.field.Ac1Txop = 96; // AC_VO: 96*32us ~= 3ms + csr0.field.Ac0Txop = 192; /* AC_VI: 192*32us ~= 6ms */ + csr0.field.Ac1Txop = 96; /* AC_VO: 96*32us ~= 3ms */ } else { - csr0.field.Ac0Txop = 96; // AC_VI: 96*32us ~= 3ms - csr0.field.Ac1Txop = 48; // AC_VO: 48*32us ~= 1.5ms + csr0.field.Ac0Txop = 96; /* AC_VI: 96*32us ~= 3ms */ + csr0.field.Ac1Txop = 48; /* AC_VO: 48*32us ~= 1.5ms */ } RTMP_IO_WRITE32(pAd, WMM_TXOP1_CFG, csr0.word); #ifdef RTMP_MAC_PCI - // 3. Set DMA global configuration except TX_DMA_EN and RX_DMA_EN bits: + /* 3. Set DMA global configuration except TX_DMA_EN and RX_DMA_EN bits: */ i = 0; do { RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); @@ -1534,11 +1534,11 @@ retry: IntCfg.word = 0; RTMP_IO_WRITE32(pAd, DELAY_INT_CFG, IntCfg.word); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ - // reset action - // Load firmware - // Status = NICLoadFirmware(pAd); + /* reset action */ + /* Load firmware */ + /* Status = NICLoadFirmware(pAd); */ DBGPRINT(RT_DEBUG_TRACE, ("<-- NICInitializeAdapter\n")); return Status; @@ -1571,25 +1571,25 @@ NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) UINT32 MacCsr0 = 0; NTSTATUS Status; UCHAR Value = 0xff; -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ #ifdef RT30xx UCHAR bbpreg = 0; UCHAR RFValue = 0; -#endif // RT30xx // +#endif /* RT30xx // */ USHORT KeyIdx; INT i, apidx; DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitializeAsic\n")); #ifdef RTMP_MAC_PCI - RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x3); // To fix driver disable/enable hang issue when radio off + RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x3); /* To fix driver disable/enable hang issue when radio off */ if (bHardReset == TRUE) { RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x3); } else RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x1); RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x0); - // Initialize MAC register to default value + /* Initialize MAC register to default value */ for (Index = 0; Index < NUM_MAC_REG_PARMS; Index++) { RTMP_IO_WRITE32(pAd, MACRegTable[Index].Register, MACRegTable[Index].Value); @@ -1601,15 +1601,15 @@ NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) STAMACRegTable[Index].Value); } } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB - // - // Make sure MAC gets ready after NICLoadFirmware(). - // + /* */ + /* Make sure MAC gets ready after NICLoadFirmware(). */ + /* */ Index = 0; - //To avoid hang-on issue when interface up in kernel 2.4, - //we use a local variable "MacCsr0" instead of using "pAd->MACVersion" directly. + /*To avoid hang-on issue when interface up in kernel 2.4, */ + /*we use a local variable "MacCsr0" instead of using "pAd->MACVersion" directly. */ do { RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0); @@ -1622,7 +1622,7 @@ NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) pAd->MACVersion = MacCsr0; DBGPRINT(RT_DEBUG_TRACE, ("MAC_CSR0 [ Ver:Rev=0x%08x]\n", pAd->MACVersion)); - // turn on bit13 (set to zero) after rt2860D. This is to solve high-current issue. + /* turn on bit13 (set to zero) after rt2860D. This is to solve high-current issue. */ RTMP_IO_READ32(pAd, PBF_SYS_CTRL, &MacCsr12); MacCsr12 &= (~0x2000); RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, MacCsr12); @@ -1633,7 +1633,7 @@ NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x0); - // Initialize MAC register to default value + /* Initialize MAC register to default value */ for (Index = 0; Index < NUM_MAC_REG_PARMS; Index++) { #ifdef RT30xx if ((MACRegTable[Index].Register == TX_SW_CFG0) @@ -1641,7 +1641,7 @@ NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) || IS_RT3090(pAd) || IS_RT3390(pAd))) { MACRegTable[Index].Value = 0x00000400; } -#endif // RT30xx // +#endif /* RT30xx // */ RTMP_IO_WRITE32(pAd, (USHORT) MACRegTable[Index].Register, MACRegTable[Index].Value); } @@ -1653,19 +1653,19 @@ NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) STAMACRegTable[Index].Value); } } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ #ifdef RT30xx - // Initialize RT3070 serial MAC registers which is different from RT2870 serial + /* Initialize RT3070 serial MAC registers which is different from RT2870 serial */ if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) { RTMP_IO_WRITE32(pAd, TX_SW_CFG1, 0); - // RT3071 version E has fixed this issue + /* RT3071 version E has fixed this issue */ if ((pAd->MACVersion & 0xffff) < 0x0211) { if (pAd->NicConfig2.field.DACTestBit == 1) { - RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x2C); // To fix throughput drop drastically + RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x2C); /* To fix throughput drop drastically */ } else { - RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x0F); // To fix throughput drop drastically + RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x0F); /* To fix throughput drop drastically */ } } else { RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x0); @@ -1673,21 +1673,21 @@ NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) } else if (IS_RT3070(pAd)) { if (((pAd->MACVersion & 0xffff) < 0x0201)) { RTMP_IO_WRITE32(pAd, TX_SW_CFG1, 0); - RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x2C); // To fix throughput drop drastically + RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x2C); /* To fix throughput drop drastically */ } else { RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0); } } -#endif // RT30xx // +#endif /* RT30xx // */ - // - // Before program BBP, we need to wait BBP/RF get wake up. - // + /* */ + /* Before program BBP, we need to wait BBP/RF get wake up. */ + /* */ Index = 0; do { RTMP_IO_READ32(pAd, MAC_STATUS_CFG, &MacCsr12); - if ((MacCsr12 & 0x03) == 0) // if BB.RF is stable + if ((MacCsr12 & 0x03) == 0) /* if BB.RF is stable */ break; DBGPRINT(RT_DEBUG_TRACE, @@ -1695,87 +1695,87 @@ NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) RTMPusecDelay(1000); } while (Index++ < 100); - // The commands to firmware should be after these commands, these commands will init firmware - // PCI and USB are not the same because PCI driver needs to wait for PCI bus ready - RTMP_IO_WRITE32(pAd, H2M_BBP_AGENT, 0); // initialize BBP R/W access agent + /* The commands to firmware should be after these commands, these commands will init firmware */ + /* PCI and USB are not the same because PCI driver needs to wait for PCI bus ready */ + RTMP_IO_WRITE32(pAd, H2M_BBP_AGENT, 0); /* initialize BBP R/W access agent */ RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CSR, 0); #ifdef RT3090 - //2008/11/28:KH add to fix the dead rf frequency offset bug<-- + /*2008/11/28:KH add to fix the dead rf frequency offset bug<-- */ AsicSendCommandToMcu(pAd, 0x72, 0, 0, 0); - //2008/11/28:KH add to fix the dead rf frequency offset bug--> -#endif // RT3090 // + /*2008/11/28:KH add to fix the dead rf frequency offset bug--> */ +#endif /* RT3090 // */ RTMPusecDelay(1000); - // Read BBP register, make sure BBP is up and running before write new data + /* Read BBP register, make sure BBP is up and running before write new data */ Index = 0; do { RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R0, &R0); DBGPRINT(RT_DEBUG_TRACE, ("BBP version = %x\n", R0)); } while ((++Index < 20) && ((R0 == 0xff) || (R0 == 0x00))); - //ASSERT(Index < 20); //this will cause BSOD on Check-build driver + /*ASSERT(Index < 20); //this will cause BSOD on Check-build driver */ if ((R0 == 0xff) || (R0 == 0x00)) return NDIS_STATUS_FAILURE; - // Initialize BBP register to default value + /* Initialize BBP register to default value */ for (Index = 0; Index < NUM_BBP_REG_PARMS; Index++) { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBPRegTable[Index].Register, BBPRegTable[Index].Value); } #ifdef RTMP_MAC_PCI - // TODO: shiang, check MACVersion, currently, rbus-based chip use this. + /* TODO: shiang, check MACVersion, currently, rbus-based chip use this. */ if (pAd->MACVersion == 0x28720200) { - //UCHAR value; + /*UCHAR value; */ ULONG value2; - //disable MLD by Bruce 20080704 - //BBP_IO_READ8_BY_REG_ID(pAd, BBP_R105, &value); - //BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R105, value | 4); + /*disable MLD by Bruce 20080704 */ + /*BBP_IO_READ8_BY_REG_ID(pAd, BBP_R105, &value); */ + /*BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R105, value | 4); */ - //Maximum PSDU length from 16K to 32K bytes + /*Maximum PSDU length from 16K to 32K bytes */ RTMP_IO_READ32(pAd, MAX_LEN_CFG, &value2); value2 &= ~(0x3 << 12); value2 |= (0x2 << 12); RTMP_IO_WRITE32(pAd, MAX_LEN_CFG, value2); } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ - // for rt2860E and after, init BBP_R84 with 0x19. This is for extension channel overlapping IOT. - // RT3090 should not program BBP R84 to 0x19, otherwise TX will block. - //3070/71/72,3090,3090A( are included in RT30xx),3572,3390 + /* for rt2860E and after, init BBP_R84 with 0x19. This is for extension channel overlapping IOT. */ + /* RT3090 should not program BBP R84 to 0x19, otherwise TX will block. */ + /*3070/71/72,3090,3090A( are included in RT30xx),3572,3390 */ if (((pAd->MACVersion & 0xffff) != 0x0101) && !(IS_RT30xx(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R84, 0x19); #ifdef RT30xx -// add by johnli, RF power sequence setup - if (IS_RT30xx(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) { //update for RT3070/71/72/90/91/92,3572,3390. +/* add by johnli, RF power sequence setup */ + if (IS_RT30xx(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) { /*update for RT3070/71/72/90/91/92,3572,3390. */ RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R79, 0x13); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R80, 0x05); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R81, 0x33); } - if (IS_RT3090(pAd) || IS_RT3390(pAd)) // RT309x, RT3071/72 + if (IS_RT3090(pAd) || IS_RT3390(pAd)) /* RT309x, RT3071/72 */ { - // enable DC filter + /* enable DC filter */ if ((pAd->MACVersion & 0xffff) >= 0x0211) { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R103, 0xc0); } - // improve power consumption + /* improve power consumption */ RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R138, &bbpreg); if (pAd->Antenna.field.TxPath == 1) { - // turn off tx DAC_1 + /* turn off tx DAC_1 */ bbpreg = (bbpreg | 0x20); } if (pAd->Antenna.field.RxPath == 1) { - // turn off tx ADC_1 + /* turn off tx ADC_1 */ bbpreg &= (~0x2); } RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R138, bbpreg); - // improve power consumption in RT3071 Ver.E + /* improve power consumption in RT3071 Ver.E */ if ((pAd->MACVersion & 0xffff) >= 0x0211) { RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R31, &bbpreg); bbpreg &= (~0x3); @@ -1783,39 +1783,39 @@ NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) } } else if (IS_RT3070(pAd)) { if ((pAd->MACVersion & 0xffff) >= 0x0201) { - // enable DC filter + /* enable DC filter */ RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R103, 0xc0); - // improve power consumption in RT3070 Ver.F + /* improve power consumption in RT3070 Ver.F */ RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R31, &bbpreg); bbpreg &= (~0x3); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R31, bbpreg); } - // TX_LO1_en, RF R17 register Bit 3 to 0 + /* TX_LO1_en, RF R17 register Bit 3 to 0 */ RT30xxReadRFRegister(pAd, RF_R17, &RFValue); RFValue &= (~0x08); - // to fix rx long range issue + /* to fix rx long range issue */ if (pAd->NicConfig2.field.ExternalLNAForG == 0) { RFValue |= 0x20; } - // set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h + /* set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h */ if (pAd->TxMixerGain24G >= 1) { - RFValue &= (~0x7); // clean bit [2:0] + RFValue &= (~0x7); /* clean bit [2:0] */ RFValue |= pAd->TxMixerGain24G; } RT30xxWriteRFRegister(pAd, RF_R17, RFValue); } -// end johnli -#endif // RT30xx // +/* end johnli */ +#endif /* RT30xx // */ if (pAd->MACVersion == 0x28600100) { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x16); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x12); } - if (pAd->MACVersion >= RALINK_2880E_VERSION && pAd->MACVersion < RALINK_3070_VERSION) // 3*3 + if (pAd->MACVersion >= RALINK_2880E_VERSION && pAd->MACVersion < RALINK_3070_VERSION) /* 3*3 */ { - // enlarge MAX_LEN_CFG + /* enlarge MAX_LEN_CFG */ UINT32 csr; RTMP_IO_READ32(pAd, MAX_LEN_CFG, &csr); csr &= 0xFFF; @@ -1827,7 +1827,7 @@ NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) UCHAR MAC_Value[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0 }; - //Initialize WCID table + /*Initialize WCID table */ Value = 0xff; for (Index = 0; Index < 254; Index++) { RTUSBMultiWrite(pAd, @@ -1835,18 +1835,18 @@ NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) MAC_Value, 8); } } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ - // Add radio off control + /* Add radio off control */ { if (pAd->StaCfg.bRadio == FALSE) { -// RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x00001818); +/* RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x00001818); */ RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); DBGPRINT(RT_DEBUG_TRACE, ("Set Radio Off\n")); } } - // Clear raw counters + /* Clear raw counters */ RTMP_IO_READ32(pAd, RX_STA_CNT0, &Counter); RTMP_IO_READ32(pAd, RX_STA_CNT1, &Counter); RTMP_IO_READ32(pAd, RX_STA_CNT2, &Counter); @@ -1854,29 +1854,29 @@ NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) RTMP_IO_READ32(pAd, TX_STA_CNT1, &Counter); RTMP_IO_READ32(pAd, TX_STA_CNT2, &Counter); - // ASIC will keep garbage value after boot - // Clear all shared key table when initial - // This routine can be ignored in radio-ON/OFF operation. + /* ASIC will keep garbage value after boot */ + /* Clear all shared key table when initial */ + /* This routine can be ignored in radio-ON/OFF operation. */ if (bHardReset) { for (KeyIdx = 0; KeyIdx < 4; KeyIdx++) { RTMP_IO_WRITE32(pAd, SHARED_KEY_MODE_BASE + 4 * KeyIdx, 0); } - // Clear all pairwise key table when initial + /* Clear all pairwise key table when initial */ for (KeyIdx = 0; KeyIdx < 256; KeyIdx++) { RTMP_IO_WRITE32(pAd, MAC_WCID_ATTRIBUTE_BASE + (KeyIdx * HW_WCID_ATTRI_SIZE), 1); } } - // assert HOST ready bit -// RTMP_IO_WRITE32(pAd, MAC_CSR1, 0x0); // 2004-09-14 asked by Mark -// RTMP_IO_WRITE32(pAd, MAC_CSR1, 0x4); + /* assert HOST ready bit */ +/* RTMP_IO_WRITE32(pAd, MAC_CSR1, 0x0); // 2004-09-14 asked by Mark */ +/* RTMP_IO_WRITE32(pAd, MAC_CSR1, 0x4); */ - // It isn't necessary to clear this space when not hard reset. + /* It isn't necessary to clear this space when not hard reset. */ if (bHardReset == TRUE) { - // clear all on-chip BEACON frame space + /* clear all on-chip BEACON frame space */ for (apidx = 0; apidx < HW_BEACON_MAX_COUNT; apidx++) { for (i = 0; i < HW_BEACON_OFFSET >> 2; i += 4) RTMP_IO_WRITE32(pAd, @@ -1886,22 +1886,22 @@ NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) } #ifdef RTMP_MAC_USB AsicDisableSync(pAd); - // Clear raw counters + /* Clear raw counters */ RTMP_IO_READ32(pAd, RX_STA_CNT0, &Counter); RTMP_IO_READ32(pAd, RX_STA_CNT1, &Counter); RTMP_IO_READ32(pAd, RX_STA_CNT2, &Counter); RTMP_IO_READ32(pAd, TX_STA_CNT0, &Counter); RTMP_IO_READ32(pAd, TX_STA_CNT1, &Counter); RTMP_IO_READ32(pAd, TX_STA_CNT2, &Counter); - // Default PCI clock cycle per ms is different as default setting, which is based on PCI. + /* Default PCI clock cycle per ms is different as default setting, which is based on PCI. */ RTMP_IO_READ32(pAd, USB_CYC_CFG, &Counter); Counter &= 0xffffff00; Counter |= 0x000001e; RTMP_IO_WRITE32(pAd, USB_CYC_CFG, Counter); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ { - // for rt2860E and after, init TXOP_CTRL_CFG with 0x583f. This is for extension channel overlapping IOT. + /* for rt2860E and after, init TXOP_CTRL_CFG with 0x583f. This is for extension channel overlapping IOT. */ if ((pAd->MACVersion & 0xffff) != 0x0101) RTMP_IO_WRITE32(pAd, TXOP_CTRL_CFG, 0x583f); } @@ -1934,16 +1934,16 @@ VOID NICIssueReset(IN PRTMP_ADAPTER pAd) UINT32 Value = 0; DBGPRINT(RT_DEBUG_TRACE, ("--> NICIssueReset\n")); - // Abort Tx, prevent ASIC from writing to Host memory - //RTMP_IO_WRITE32(pAd, TX_CNTL_CSR, 0x001f0000); + /* Abort Tx, prevent ASIC from writing to Host memory */ + /*RTMP_IO_WRITE32(pAd, TX_CNTL_CSR, 0x001f0000); */ - // Disable Rx, register value supposed will remain after reset + /* Disable Rx, register value supposed will remain after reset */ RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value); Value &= (0xfffffff3); RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value); - // Issue reset and clear from reset state - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x03); // 2004-09-17 change from 0x01 + /* Issue reset and clear from reset state */ + RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x03); /* 2004-09-17 change from 0x01 */ RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x00); DBGPRINT(RT_DEBUG_TRACE, ("<-- NICIssueReset\n")); @@ -2001,7 +2001,7 @@ VOID NICUpdateFifoStaCounters(IN PRTMP_ADAPTER pAd) pEntry->DebugFIFOCount++; - if (StaFifo.field.TxBF) // 3*3 + if (StaFifo.field.TxBF) /* 3*3 */ pEntry->TxBFCount++; if (!StaFifo.field.TxSuccess) { @@ -2022,17 +2022,17 @@ VOID NICUpdateFifoStaCounters(IN PRTMP_ADAPTER pAd) FALSE); } - // Update the continuous transmission counter except PS mode + /* Update the continuous transmission counter except PS mode */ pEntry->ContinueTxFailCnt++; } else { - // Clear the FIFOCount when sta in Power Save mode. Basically we assume - // this tx error happened due to sta just go to sleep. + /* Clear the FIFOCount when sta in Power Save mode. Basically we assume */ + /* this tx error happened due to sta just go to sleep. */ pEntry->FIFOCount = 0; pEntry->ContinueTxFailCnt = 0; } - //pEntry->FIFOCount = 0; + /*pEntry->FIFOCount = 0; */ } - //pEntry->bSendBAR = TRUE; + /*pEntry->bSendBAR = TRUE; */ } else { if ((pEntry->PsMode != PWR_SAVE) && (pEntry->NoBADataCountDown > 0)) { @@ -2044,7 +2044,7 @@ VOID NICUpdateFifoStaCounters(IN PRTMP_ADAPTER pAd) pEntry->FIFOCount = 0; pEntry->OneSecTxNoRetryOkCount++; - // update NoDataIdleCount when sucessful send packet to STA. + /* update NoDataIdleCount when sucessful send packet to STA. */ pEntry->NoDataIdleCount = 0; pEntry->ContinueTxFailCnt = 0; } @@ -2072,7 +2072,7 @@ VOID NICUpdateFifoStaCounters(IN PRTMP_ADAPTER pAd) } i++; - // ASIC store 16 stack + /* ASIC store 16 stack */ } while (i < (2 * TX_RING_SIZE)); } @@ -2096,9 +2096,9 @@ VOID NICUpdateFifoStaCounters(IN PRTMP_ADAPTER pAd) */ VOID NICUpdateRawCounters(IN PRTMP_ADAPTER pAd) { - UINT32 OldValue; //, Value2; - //ULONG PageSum, OneSecTransmitCount; - //ULONG TxErrorRatio, Retry, Fail; + UINT32 OldValue; /*, Value2; */ + /*ULONG PageSum, OneSecTransmitCount; */ + /*ULONG TxErrorRatio, Retry, Fail; */ RX_STA_CNT0_STRUC RxStaCnt0; RX_STA_CNT1_STRUC RxStaCnt1; RX_STA_CNT2_STRUC RxStaCnt2; @@ -2123,34 +2123,34 @@ VOID NICUpdateRawCounters(IN PRTMP_ADAPTER pAd) { RTMP_IO_READ32(pAd, RX_STA_CNT1, &RxStaCnt1.word); - // Update RX PLCP error counter + /* Update RX PLCP error counter */ pAd->PrivateInfo.PhyRxErrCnt += RxStaCnt1.field.PlcpErr; - // Update False CCA counter + /* Update False CCA counter */ pAd->RalinkCounters.OneSecFalseCCACnt += RxStaCnt1.field.FalseCca; } - // Update FCS counters + /* Update FCS counters */ OldValue = pAd->WlanCounters.FCSErrorCount.u.LowPart; - pAd->WlanCounters.FCSErrorCount.u.LowPart += (RxStaCnt0.field.CrcErr); // >> 7); + pAd->WlanCounters.FCSErrorCount.u.LowPart += (RxStaCnt0.field.CrcErr); /* >> 7); */ if (pAd->WlanCounters.FCSErrorCount.u.LowPart < OldValue) pAd->WlanCounters.FCSErrorCount.u.HighPart++; - // Add FCS error count to private counters + /* Add FCS error count to private counters */ pRalinkCounters->OneSecRxFcsErrCnt += RxStaCnt0.field.CrcErr; OldValue = pRalinkCounters->RealFcsErrCount.u.LowPart; pRalinkCounters->RealFcsErrCount.u.LowPart += RxStaCnt0.field.CrcErr; if (pRalinkCounters->RealFcsErrCount.u.LowPart < OldValue) pRalinkCounters->RealFcsErrCount.u.HighPart++; - // Update Duplicate Rcv check + /* Update Duplicate Rcv check */ pRalinkCounters->DuplicateRcv += RxStaCnt2.field.RxDupliCount; pAd->WlanCounters.FrameDuplicateCount.u.LowPart += RxStaCnt2.field.RxDupliCount; - // Update RX Overflow counter + /* Update RX Overflow counter */ pAd->Counters8023.RxNoBuffer += (RxStaCnt2.field.RxFifoOverflowCount); - //pAd->RalinkCounters.RxCount = 0; + /*pAd->RalinkCounters.RxCount = 0; */ #ifdef RTMP_MAC_USB if (pRalinkCounters->RxCount != pAd->watchDogRxCnt) { pAd->watchDogRxCnt = pRalinkCounters->RxCount; @@ -2161,12 +2161,12 @@ VOID NICUpdateRawCounters(IN PRTMP_ADAPTER pAd) else pAd->watchDogRxOverFlowCnt = 0; } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ - //if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED) || - // (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED) && (pAd->MacTab.Size != 1))) + /*if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED) || */ + /* (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_TX_RATE_SWITCH_ENABLED) && (pAd->MacTab.Size != 1))) */ if (!pAd->bUpdateBcnCntDone) { - // Update BEACON sent count + /* Update BEACON sent count */ RTMP_IO_READ32(pAd, TX_STA_CNT0, &TxStaCnt0.word); RTMP_IO_READ32(pAd, TX_STA_CNT1, &StaTx1.word); RTMP_IO_READ32(pAd, TX_STA_CNT2, &StaTx2.word); @@ -2186,7 +2186,7 @@ VOID NICUpdateRawCounters(IN PRTMP_ADAPTER pAd) TxStaCnt0.field.TxFailCount; } - //if (pAd->bStaFifoTest == TRUE) + /*if (pAd->bStaFifoTest == TRUE) */ { RTMP_IO_READ32(pAd, TX_AGG_CNT, &TxAggCnt.word); RTMP_IO_READ32(pAd, TX_AGG_CNT0, &TxAggCnt0.word); @@ -2236,7 +2236,7 @@ VOID NICUpdateRawCounters(IN PRTMP_ADAPTER pAd) pRalinkCounters->TxAgg16MPDUCount += TxAggCnt7.field.AggSize16Count; - // Calculate the transmitted A-MPDU count + /* Calculate the transmitted A-MPDU count */ pRalinkCounters->TransmittedAMPDUCount.u.LowPart += TxAggCnt0.field.AggSize1Count; pRalinkCounters->TransmittedAMPDUCount.u.LowPart += @@ -2301,18 +2301,18 @@ VOID NICUpdateRawCounters(IN PRTMP_ADAPTER pAd) */ VOID NICResetFromError(IN PRTMP_ADAPTER pAd) { - // Reset BBP (according to alex, reset ASIC will force reset BBP - // Therefore, skip the reset BBP - // RTMP_IO_WRITE32(pAd, MAC_CSR1, 0x2); + /* Reset BBP (according to alex, reset ASIC will force reset BBP */ + /* Therefore, skip the reset BBP */ + /* RTMP_IO_WRITE32(pAd, MAC_CSR1, 0x2); */ RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x1); - // Remove ASIC from reset state + /* Remove ASIC from reset state */ RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0x0); NICInitializeAdapter(pAd, FALSE); NICInitAsicFromEEPROM(pAd); - // Switch to current channel, since during reset process, the connection should remains on. + /* Switch to current channel, since during reset process, the connection should remains on. */ AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); } @@ -2409,7 +2409,7 @@ ULONG RTMPCompareMemory(IN PVOID pSrc1, IN PVOID pSrc2, IN ULONG Length) return (2); } - // Equal + /* Equal */ return (0); } @@ -2506,9 +2506,9 @@ VOID UserCfgInit(IN PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_TRACE, ("--> UserCfgInit\n")); - // - // part I. intialize common configuration - // + /* */ + /* part I. intialize common configuration */ + /* */ #ifdef RTMP_MAC_USB pAd->BulkOutReq = 0; @@ -2519,22 +2519,22 @@ VOID UserCfgInit(IN PRTMP_ADAPTER pAd) pAd->BulkInComplete = 0; pAd->BulkInCompleteFail = 0; - //pAd->QuickTimerP = 100; - //pAd->TurnAggrBulkInCount = 0; + /*pAd->QuickTimerP = 100; */ + /*pAd->TurnAggrBulkInCount = 0; */ pAd->bUsbTxBulkAggre = 0; - // init as unsed value to ensure driver will set to MCU once. + /* init as unsed value to ensure driver will set to MCU once. */ pAd->LedIndicatorStrength = 0xFF; pAd->CommonCfg.MaxPktOneTxBulk = 2; pAd->CommonCfg.TxBulkFactor = 1; pAd->CommonCfg.RxBulkFactor = 1; - pAd->CommonCfg.TxPower = 100; //mW + pAd->CommonCfg.TxPower = 100; /*mW */ NdisZeroMemory(&pAd->CommonCfg.IOTestParm, sizeof(pAd->CommonCfg.IOTestParm)); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ for (key_index = 0; key_index < SHARE_KEY_NUM; key_index++) { for (bss_index = 0; bss_index < MAX_MBSSID_NUM; bss_index++) { @@ -2556,29 +2556,29 @@ VOID UserCfgInit(IN PRTMP_ADAPTER pAd) pAd->HostLnkCtrlOffset = 0; pAd->StaCfg.PSControl.field.EnableNewPS = TRUE; pAd->CheckDmaBusyCount = 0; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ - pAd->bAutoTxAgcA = FALSE; // Default is OFF - pAd->bAutoTxAgcG = FALSE; // Default is OFF + pAd->bAutoTxAgcA = FALSE; /* Default is OFF */ + pAd->bAutoTxAgcG = FALSE; /* Default is OFF */ pAd->RfIcType = RFIC_2820; - // Init timer for reset complete event + /* Init timer for reset complete event */ pAd->CommonCfg.CentralChannel = 1; pAd->bForcePrintTX = FALSE; pAd->bForcePrintRX = FALSE; pAd->bStaFifoTest = FALSE; pAd->bProtectionTest = FALSE; - pAd->CommonCfg.Dsifs = 10; // in units of usec - pAd->CommonCfg.TxPower = 100; //mW - pAd->CommonCfg.TxPowerPercentage = 0xffffffff; // AUTO - pAd->CommonCfg.TxPowerDefault = 0xffffffff; // AUTO - pAd->CommonCfg.TxPreamble = Rt802_11PreambleAuto; // use Long preamble on TX by defaut + pAd->CommonCfg.Dsifs = 10; /* in units of usec */ + pAd->CommonCfg.TxPower = 100; /*mW */ + pAd->CommonCfg.TxPowerPercentage = 0xffffffff; /* AUTO */ + pAd->CommonCfg.TxPowerDefault = 0xffffffff; /* AUTO */ + pAd->CommonCfg.TxPreamble = Rt802_11PreambleAuto; /* use Long preamble on TX by defaut */ pAd->CommonCfg.bUseZeroToDisableFragment = FALSE; pAd->CommonCfg.RtsThreshold = 2347; pAd->CommonCfg.FragmentThreshold = 2346; - pAd->CommonCfg.UseBGProtection = 0; // 0: AUTO - pAd->CommonCfg.bEnableTxBurst = TRUE; //0; - pAd->CommonCfg.PhyMode = 0xff; // unknown + pAd->CommonCfg.UseBGProtection = 0; /* 0: AUTO */ + pAd->CommonCfg.bEnableTxBurst = TRUE; /*0; */ + pAd->CommonCfg.PhyMode = 0xff; /* unknown */ pAd->CommonCfg.BandState = UNKNOWN_BAND; pAd->CommonCfg.RadarDetect.CSPeriod = 10; pAd->CommonCfg.RadarDetect.CSCount = 0; @@ -2607,8 +2607,8 @@ VOID UserCfgInit(IN PRTMP_ADAPTER pAd) pAd->CommonCfg.BACapability.field.MMPSmode = MMPS_ENABLE; pAd->CommonCfg.BACapability.field.MpduDensity = 0; pAd->CommonCfg.BACapability.field.Policy = IMMED_BA; - pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64; //32; - pAd->CommonCfg.BACapability.field.TxBAWinLimit = 64; //32; + pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64; /*32; */ + pAd->CommonCfg.BACapability.field.TxBAWinLimit = 64; /*32; */ DBGPRINT(RT_DEBUG_TRACE, ("--> UserCfgInit. BACapability = 0x%x\n", pAd->CommonCfg.BACapability.word)); @@ -2619,35 +2619,35 @@ VOID UserCfgInit(IN PRTMP_ADAPTER pAd) pAd->CommonCfg.bExtChannelSwitchAnnouncement = 1; pAd->CommonCfg.bHTProtect = 1; pAd->CommonCfg.bMIMOPSEnable = TRUE; - //2008/11/05:KH add to support Antenna power-saving of AP<-- + /*2008/11/05:KH add to support Antenna power-saving of AP<-- */ pAd->CommonCfg.bGreenAPEnable = FALSE; - //2008/11/05:KH add to support Antenna power-saving of AP--> + /*2008/11/05:KH add to support Antenna power-saving of AP--> */ pAd->CommonCfg.bBADecline = FALSE; pAd->CommonCfg.bDisableReordering = FALSE; if (pAd->MACVersion == 0x28720200) { - pAd->CommonCfg.TxBASize = 13; //by Jerry recommend + pAd->CommonCfg.TxBASize = 13; /*by Jerry recommend */ } else { pAd->CommonCfg.TxBASize = 7; } pAd->CommonCfg.REGBACapability.word = pAd->CommonCfg.BACapability.word; - //pAd->CommonCfg.HTPhyMode.field.BW = BW_20; - //pAd->CommonCfg.HTPhyMode.field.MCS = MCS_AUTO; - //pAd->CommonCfg.HTPhyMode.field.ShortGI = GI_800; - //pAd->CommonCfg.HTPhyMode.field.STBC = STBC_NONE; + /*pAd->CommonCfg.HTPhyMode.field.BW = BW_20; */ + /*pAd->CommonCfg.HTPhyMode.field.MCS = MCS_AUTO; */ + /*pAd->CommonCfg.HTPhyMode.field.ShortGI = GI_800; */ + /*pAd->CommonCfg.HTPhyMode.field.STBC = STBC_NONE; */ pAd->CommonCfg.TxRate = RATE_6; pAd->CommonCfg.MlmeTransmit.field.MCS = MCS_RATE_6; pAd->CommonCfg.MlmeTransmit.field.BW = BW_20; pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; - pAd->CommonCfg.BeaconPeriod = 100; // in mSec + pAd->CommonCfg.BeaconPeriod = 100; /* in mSec */ - // - // part II. intialize STA specific configuration - // + /* */ + /* part II. intialize STA specific configuration */ + /* */ { RX_FILTER_SET_FLAG(pAd, fRX_FILTER_ACCEPT_DIRECT); RX_FILTER_CLEAR_FLAG(pAd, fRX_FILTER_ACCEPT_MULTICAST); @@ -2662,7 +2662,7 @@ VOID UserCfgInit(IN PRTMP_ADAPTER pAd) pAd->StaCfg.bMixCipher = FALSE; pAd->StaCfg.DefaultKeyId = 0; - // 802.1x port control + /* 802.1x port control */ pAd->StaCfg.PrivacyFilter = Ndis802_11PrivFilter8021xWEP; pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; pAd->StaCfg.LastMicErrorTime = 0; @@ -2670,15 +2670,15 @@ VOID UserCfgInit(IN PRTMP_ADAPTER pAd) pAd->StaCfg.bBlockAssoc = FALSE; pAd->StaCfg.WpaState = SS_NOTUSE; - pAd->CommonCfg.NdisRadioStateOff = FALSE; // New to support microsoft disable radio with OID command + pAd->CommonCfg.NdisRadioStateOff = FALSE; /* New to support microsoft disable radio with OID command */ pAd->StaCfg.RssiTrigger = 0; NdisZeroMemory(&pAd->StaCfg.RssiSample, sizeof(RSSI_SAMPLE)); pAd->StaCfg.RssiTriggerMode = RSSI_TRIGGERED_UPON_BELOW_THRESHOLD; pAd->StaCfg.AtimWin = 0; - pAd->StaCfg.DefaultListenCount = 3; //default listen count; - pAd->StaCfg.BssType = BSS_INFRA; // BSS_INFRA or BSS_ADHOC or BSS_MONITOR + pAd->StaCfg.DefaultListenCount = 3; /*default listen count; */ + pAd->StaCfg.BssType = BSS_INFRA; /* BSS_INFRA or BSS_ADHOC or BSS_MONITOR */ pAd->StaCfg.bScanReqIsFromWebUI = FALSE; OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_WAKEUP_NOW); @@ -2690,23 +2690,23 @@ VOID UserCfgInit(IN PRTMP_ADAPTER pAd) #ifdef PCIE_PS_SUPPORT pAd->brt30xxBanMcuCmd = FALSE; pAd->b3090ESpecialChip = FALSE; -//KH Debug:the following must be removed +/*KH Debug:the following must be removed */ pAd->StaCfg.PSControl.field.rt30xxPowerMode = 3; pAd->StaCfg.PSControl.field.rt30xxForceASPMTest = 0; pAd->StaCfg.PSControl.field.rt30xxFollowHostASPM = 1; -#endif // PCIE_PS_SUPPORT // +#endif /* PCIE_PS_SUPPORT // */ - // global variables mXXXX used in MAC protocol state machines + /* global variables mXXXX used in MAC protocol state machines */ OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_ADHOC_ON); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_INFRA_ON); - // PHY specification - pAd->CommonCfg.PhyMode = PHY_11BG_MIXED; // default PHY mode - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); // CCK use LONG preamble + /* PHY specification */ + pAd->CommonCfg.PhyMode = PHY_11BG_MIXED; /* default PHY mode */ + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); /* CCK use LONG preamble */ { - // user desired power mode + /* user desired power mode */ pAd->StaCfg.WindowsPowerMode = Ndis802_11PowerModeCAM; pAd->StaCfg.WindowsBatteryPowerMode = Ndis802_11PowerModeCAM; pAd->StaCfg.bWindowsACCAMEnable = FALSE; @@ -2716,20 +2716,20 @@ VOID UserCfgInit(IN PRTMP_ADAPTER pAd) pAd, FALSE); pAd->StaCfg.StaQuickResponeForRateUpTimerRunning = FALSE; - // Patch for Ndtest + /* Patch for Ndtest */ pAd->StaCfg.ScanCnt = 0; - pAd->StaCfg.bHwRadio = TRUE; // Default Hardware Radio status is On - pAd->StaCfg.bSwRadio = TRUE; // Default Software Radio status is On - pAd->StaCfg.bRadio = TRUE; // bHwRadio && bSwRadio - pAd->StaCfg.bHardwareRadio = FALSE; // Default is OFF - pAd->StaCfg.bShowHiddenSSID = FALSE; // Default no show + pAd->StaCfg.bHwRadio = TRUE; /* Default Hardware Radio status is On */ + pAd->StaCfg.bSwRadio = TRUE; /* Default Software Radio status is On */ + pAd->StaCfg.bRadio = TRUE; /* bHwRadio && bSwRadio */ + pAd->StaCfg.bHardwareRadio = FALSE; /* Default is OFF */ + pAd->StaCfg.bShowHiddenSSID = FALSE; /* Default no show */ - // Nitro mode control + /* Nitro mode control */ pAd->StaCfg.bAutoReconnect = TRUE; - // Save the init time as last scan time, the system should do scan after 2 seconds. - // This patch is for driver wake up from standby mode, system will do scan right away. + /* Save the init time as last scan time, the system should do scan after 2 seconds. */ + /* This patch is for driver wake up from standby mode, system will do scan right away. */ NdisGetSystemUpTime(&pAd->StaCfg.LastScanTime); if (pAd->StaCfg.LastScanTime > 10 * OS_HZ) pAd->StaCfg.LastScanTime -= (10 * OS_HZ); @@ -2737,10 +2737,10 @@ VOID UserCfgInit(IN PRTMP_ADAPTER pAd) NdisZeroMemory(pAd->nickname, IW_ESSID_MAX_SIZE + 1); #ifdef RTMP_MAC_PCI sprintf((PSTRING) pAd->nickname, "RT2860STA"); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB sprintf((PSTRING) pAd->nickname, "RT2870STA"); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ RTMPInitTimer(pAd, &pAd->StaCfg.WpaDisassocAndBlockAssocTimer, GET_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc), pAd, FALSE); @@ -2760,83 +2760,83 @@ VOID UserCfgInit(IN PRTMP_ADAPTER pAd) pAd->StaCfg.bForceTxBurst = FALSE; } - // Default for extra information is not valid + /* Default for extra information is not valid */ pAd->ExtraInfo = EXTRA_INFO_CLEAR; - // Default Config change flag + /* Default Config change flag */ pAd->bConfigChanged = FALSE; - // - // part III. AP configurations - // + /* */ + /* part III. AP configurations */ + /* */ - // - // part IV. others - // - // dynamic BBP R66:sensibity tuning to overcome background noise + /* */ + /* part IV. others */ + /* */ + /* dynamic BBP R66:sensibity tuning to overcome background noise */ pAd->BbpTuning.bEnable = TRUE; pAd->BbpTuning.FalseCcaLowerThreshold = 100; pAd->BbpTuning.FalseCcaUpperThreshold = 512; pAd->BbpTuning.R66Delta = 4; pAd->Mlme.bEnableAutoAntennaCheck = TRUE; - // - // Also initial R66CurrentValue, RTUSBResumeMsduTransmission might use this value. - // if not initial this value, the default value will be 0. - // + /* */ + /* Also initial R66CurrentValue, RTUSBResumeMsduTransmission might use this value. */ + /* if not initial this value, the default value will be 0. */ + /* */ pAd->BbpTuning.R66CurrentValue = 0x38; pAd->Bbp94 = BBPR94_DEFAULT; pAd->BbpForCCK = FALSE; - // Default is FALSE for test bit 1 - //pAd->bTest1 = FALSE; + /* Default is FALSE for test bit 1 */ + /*pAd->bTest1 = FALSE; */ - // initialize MAC table and allocate spin lock + /* initialize MAC table and allocate spin lock */ NdisZeroMemory(&pAd->MacTab, sizeof(MAC_TABLE)); InitializeQueueHeader(&pAd->MacTab.McastPsQueue); NdisAllocateSpinLock(&pAd->MacTabLock); - //RTMPInitTimer(pAd, &pAd->RECBATimer, RECBATimerTimeout, pAd, TRUE); - //RTMPSetTimer(&pAd->RECBATimer, REORDER_EXEC_INTV); + /*RTMPInitTimer(pAd, &pAd->RECBATimer, RECBATimerTimeout, pAd, TRUE); */ + /*RTMPSetTimer(&pAd->RECBATimer, REORDER_EXEC_INTV); */ pAd->CommonCfg.bWiFiTest = FALSE; #ifdef RTMP_MAC_PCI pAd->bPCIclkOff = FALSE; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); DBGPRINT(RT_DEBUG_TRACE, ("<-- UserCfgInit\n")); } -// IRQL = PASSIVE_LEVEL +/* IRQL = PASSIVE_LEVEL */ UCHAR BtoH(STRING ch) { if (ch >= '0' && ch <= '9') - return (ch - '0'); // Handle numerals + return (ch - '0'); /* Handle numerals */ if (ch >= 'A' && ch <= 'F') - return (ch - 'A' + 0xA); // Handle capitol hex digits + return (ch - 'A' + 0xA); /* Handle capitol hex digits */ if (ch >= 'a' && ch <= 'f') - return (ch - 'a' + 0xA); // Handle small hex digits + return (ch - 'a' + 0xA); /* Handle small hex digits */ return (255); } -// -// FUNCTION: AtoH(char *, UCHAR *, int) -// -// PURPOSE: Converts ascii string to network order hex -// -// PARAMETERS: -// src - pointer to input ascii string -// dest - pointer to output hex -// destlen - size of dest -// -// COMMENTS: -// -// 2 ascii bytes make a hex byte so must put 1st ascii byte of pair -// into upper nibble and 2nd ascii byte of pair into lower nibble. -// -// IRQL = PASSIVE_LEVEL +/* */ +/* FUNCTION: AtoH(char *, UCHAR *, int) */ +/* */ +/* PURPOSE: Converts ascii string to network order hex */ +/* */ +/* PARAMETERS: */ +/* src - pointer to input ascii string */ +/* dest - pointer to output hex */ +/* destlen - size of dest */ +/* */ +/* COMMENTS: */ +/* */ +/* 2 ascii bytes make a hex byte so must put 1st ascii byte of pair */ +/* into upper nibble and 2nd ascii byte of pair into lower nibble. */ +/* */ +/* IRQL = PASSIVE_LEVEL */ void AtoH(PSTRING src, PUCHAR dest, int destlen) { @@ -2847,14 +2847,14 @@ void AtoH(PSTRING src, PUCHAR dest, int destlen) destTemp = (PUCHAR) dest; while (destlen--) { - *destTemp = BtoH(*srcptr++) << 4; // Put 1st ascii byte in upper nibble. - *destTemp += BtoH(*srcptr++); // Add 2nd ascii byte to above. + *destTemp = BtoH(*srcptr++) << 4; /* Put 1st ascii byte in upper nibble. */ + *destTemp += BtoH(*srcptr++); /* Add 2nd ascii byte to above. */ destTemp++; } } -//+++Mark by shiang, not use now, need to remove after confirm -//---Mark by shiang, not use now, need to remove after confirm +/*+++Mark by shiang, not use now, need to remove after confirm */ +/*---Mark by shiang, not use now, need to remove after confirm */ /* ======================================================================== @@ -2879,11 +2879,11 @@ VOID RTMPInitTimer(IN PRTMP_ADAPTER pAd, IN PRALINK_TIMER_STRUCT pTimer, IN PVOID pTimerFunc, IN PVOID pData, IN BOOLEAN Repeat) { - // - // Set Valid to TRUE for later used. - // It will crash if we cancel a timer or set a timer - // that we haven't initialize before. - // + /* */ + /* Set Valid to TRUE for later used. */ + /* It will crash if we cancel a timer or set a timer */ + /* that we haven't initialize before. */ + /* */ pTimer->Valid = TRUE; pTimer->PeriodicType = Repeat; @@ -2892,7 +2892,7 @@ VOID RTMPInitTimer(IN PRTMP_ADAPTER pAd, #ifdef RTMP_TIMER_TASK_SUPPORT pTimer->pAd = pAd; -#endif // RTMP_TIMER_TASK_SUPPORT // +#endif /* RTMP_TIMER_TASK_SUPPORT // */ RTMP_OS_Init_Timer(pAd, &pTimer->TimerObj, pTimerFunc, (PVOID) pTimer); } @@ -3001,10 +3001,10 @@ VOID RTMPCancelTimer(IN PRALINK_TIMER_STRUCT pTimer, OUT BOOLEAN * pCancelled) pTimer->State = TRUE; #ifdef RTMP_TIMER_TASK_SUPPORT - // We need to go-through the TimerQ to findout this timer handler and remove it if - // it's still waiting for execution. + /* We need to go-through the TimerQ to findout this timer handler and remove it if */ + /* it's still waiting for execution. */ RtmpTimerQRemove(pTimer->pAd, pTimer); -#endif // RTMP_TIMER_TASK_SUPPORT // +#endif /* RTMP_TIMER_TASK_SUPPORT // */ } else { DBGPRINT_ERR(("RTMPCancelTimer failed, Timer hasn't been initialize!\n")); } @@ -3032,7 +3032,7 @@ VOID RTMPCancelTimer(IN PRALINK_TIMER_STRUCT pTimer, OUT BOOLEAN * pCancelled) */ VOID RTMPSetLED(IN PRTMP_ADAPTER pAd, IN UCHAR Status) { - //ULONG data; + /*ULONG data; */ UCHAR HighByte = 0; UCHAR LowByte; @@ -3055,7 +3055,7 @@ VOID RTMPSetLED(IN PRTMP_ADAPTER pAd, IN UCHAR Status) AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); break; case LED_HALT: - LowByte = 0; // Driver sets MAC register and MAC controls LED + LowByte = 0; /* Driver sets MAC register and MAC controls LED */ case LED_RADIO_OFF: HighByte = 0; AsicSendCommandToMcu(pAd, 0x50, 0xff, LowByte, HighByte); @@ -3078,10 +3078,10 @@ VOID RTMPSetLED(IN PRTMP_ADAPTER pAd, IN UCHAR Status) break; } - // - // Keep LED status for LED SiteSurvey mode. - // After SiteSurvey, we will set the LED mode to previous status. - // + /* */ + /* Keep LED status for LED SiteSurvey mode. */ + /* After SiteSurvey, we will set the LED mode to previous status. */ + /* */ if ((Status != LED_ON_SITE_SURVEY) && (Status != LED_POWER_UP)) pAd->LedStatus = Status; @@ -3135,9 +3135,9 @@ VOID RTMPSetSignalLED(IN PRTMP_ADAPTER pAd, IN NDIS_802_11_RSSI Dbm) else nLed = 31; - // - // Update Signal Stregth to firmware if changed. - // + /* */ + /* Update Signal Stregth to firmware if changed. */ + /* */ if (pAd->LedIndicatorStrength != nLed) { AsicSendCommandToMcu(pAd, 0x51, 0xff, nLed, pAd->LedCntl.field.Polarity); @@ -3166,25 +3166,25 @@ VOID RTMPSetSignalLED(IN PRTMP_ADAPTER pAd, IN NDIS_802_11_RSSI Dbm) */ VOID RTMPEnableRxTx(IN PRTMP_ADAPTER pAd) { -// WPDMA_GLO_CFG_STRUC GloCfg; -// ULONG i = 0; +/* WPDMA_GLO_CFG_STRUC GloCfg; */ +/* ULONG i = 0; */ UINT32 rx_filter_flag; DBGPRINT(RT_DEBUG_TRACE, ("==> RTMPEnableRxTx\n")); - // Enable Rx DMA. + /* Enable Rx DMA. */ RT28XXDMAEnable(pAd); - // enable RX of MAC block + /* enable RX of MAC block */ if (pAd->OpMode == OPMODE_AP) { rx_filter_flag = APNORMAL; - RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, rx_filter_flag); // enable RX of DMA block + RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, rx_filter_flag); /* enable RX of DMA block */ } else { if (pAd->CommonCfg.PSPXlink) rx_filter_flag = PSPXLINK; else - rx_filter_flag = STANORMAL; // Staion not drop control frame will fail WiFi Certification. + rx_filter_flag = STANORMAL; /* Staion not drop control frame will fail WiFi Certification. */ RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, rx_filter_flag); } @@ -3192,7 +3192,7 @@ VOID RTMPEnableRxTx(IN PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_TRACE, ("<== RTMPEnableRxTx\n")); } -//+++Add by shiang, move from os/linux/rt_main_dev.c +/*+++Add by shiang, move from os/linux/rt_main_dev.c */ void CfgInitHook(PRTMP_ADAPTER pAd) { pAd->bBroadComHT = TRUE; @@ -3208,9 +3208,9 @@ int rt28xx_init(IN PRTMP_ADAPTER pAd, #ifdef RTMP_MAC_PCI { - // If dirver doesn't wake up firmware here, - // NICLoadFirmware will hang forever when interface is up again. - // RT2860 PCI + /* If dirver doesn't wake up firmware here, */ + /* NICLoadFirmware will hang forever when interface is up again. */ + /* RT2860 PCI */ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) { AUTO_WAKEUP_STRUC AutoWakeupCfg; @@ -3221,17 +3221,17 @@ int rt28xx_init(IN PRTMP_ADAPTER pAd, OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); } } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ - // reset Adapter flags + /* reset Adapter flags */ RTMP_CLEAR_FLAGS(pAd); - // Init BssTab & ChannelInfo tabbles for auto channel select. + /* Init BssTab & ChannelInfo tabbles for auto channel select. */ - // Allocate BA Reordering memory + /* Allocate BA Reordering memory */ ba_reordering_resource_init(pAd, MAX_REORDERING_MPDU_NUM); - // Make sure MAC gets ready. + /* Make sure MAC gets ready. */ index = 0; do { RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0); @@ -3256,16 +3256,16 @@ int rt28xx_init(IN PRTMP_ADAPTER pAd, RTMP_IO_WRITE32(pAd, AUX_CTRL, MacCsr0); DBGPRINT(RT_DEBUG_TRACE, ("AUX_CTRL = 0x%x\n", MacCsr0)); } -#endif // PCIE_PS_SUPPORT // +#endif /* PCIE_PS_SUPPORT // */ - // To fix driver disable/enable hang issue when radio off + /* To fix driver disable/enable hang issue when radio off */ RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0x2); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ - // Disable DMA + /* Disable DMA */ RT28XXDMADisable(pAd); - // Load 8051 firmware + /* Load 8051 firmware */ Status = NICLoadFirmware(pAd); if (Status != NDIS_STATUS_SUCCESS) { DBGPRINT_ERR(("NICLoadFirmware failed, Status[=0x%08x]\n", @@ -3275,13 +3275,13 @@ int rt28xx_init(IN PRTMP_ADAPTER pAd, NICLoadRateSwitchingParams(pAd); - // Disable interrupts here which is as soon as possible - // This statement should never be true. We might consider to remove it later + /* Disable interrupts here which is as soon as possible */ + /* This statement should never be true. We might consider to remove it later */ #ifdef RTMP_MAC_PCI if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) { RTMP_ASIC_INTERRUPT_DISABLE(pAd); } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ Status = RTMPAllocTxRxRingMemory(pAd); if (Status != NDIS_STATUS_SUCCESS) { @@ -3292,8 +3292,8 @@ int rt28xx_init(IN PRTMP_ADAPTER pAd, RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE); - // initialize MLME - // + /* initialize MLME */ + /* */ Status = RtmpMgmtTaskInit(pAd); if (Status != NDIS_STATUS_SUCCESS) @@ -3304,15 +3304,15 @@ int rt28xx_init(IN PRTMP_ADAPTER pAd, DBGPRINT_ERR(("MlmeInit failed, Status[=0x%08x]\n", Status)); goto err2; } - // Initialize pAd->StaCfg, pAd->ApCfg, pAd->CommonCfg to manufacture default - // + /* Initialize pAd->StaCfg, pAd->ApCfg, pAd->CommonCfg to manufacture default */ + /* */ UserCfgInit(pAd); Status = RtmpNetTaskInit(pAd); if (Status != NDIS_STATUS_SUCCESS) goto err3; -// COPY_MAC_ADDR(pAd->ApCfg.MBSSID[apidx].Bssid, netif->hwaddr); -// pAd->bForcePrintTX = TRUE; +/* COPY_MAC_ADDR(pAd->ApCfg.MBSSID[apidx].Bssid, netif->hwaddr); */ +/* pAd->bForcePrintTX = TRUE; */ CfgInitHook(pAd); @@ -3321,9 +3321,9 @@ int rt28xx_init(IN PRTMP_ADAPTER pAd, MeasureReqTabInit(pAd); TpcReqTabInit(pAd); - // - // Init the hardware, we need to init asic before read registry, otherwise mac register will be reset - // + /* */ + /* Init the hardware, we need to init asic before read registry, otherwise mac register will be reset */ + /* */ Status = NICInitializeAdapter(pAd, TRUE); if (Status != NDIS_STATUS_SUCCESS) { DBGPRINT_ERR(("NICInitializeAdapter failed, Status[=0x%08x]\n", @@ -3341,10 +3341,10 @@ int rt28xx_init(IN PRTMP_ADAPTER pAd, pAd->CommonCfg.NumOfBulkInIRP = RX_RING_SIZE; else pAd->CommonCfg.NumOfBulkInIRP = 1; -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ - //Init Ba Capability parameters. -// RT28XX_BA_INIT(pAd); + /*Init Ba Capability parameters. */ +/* RT28XX_BA_INIT(pAd); */ pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR) pAd->CommonCfg.BACapability.field.MpduDensity; pAd->CommonCfg.DesiredHtPhy.AmsduEnable = @@ -3353,7 +3353,7 @@ int rt28xx_init(IN PRTMP_ADAPTER pAd, (USHORT) pAd->CommonCfg.BACapability.field.AmsduSize; pAd->CommonCfg.DesiredHtPhy.MimoPs = (USHORT) pAd->CommonCfg.BACapability.field.MMPSmode; - // UPdata to HT IE + /* UPdata to HT IE */ pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT) pAd->CommonCfg.BACapability.field.MMPSmode; pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = @@ -3361,29 +3361,29 @@ int rt28xx_init(IN PRTMP_ADAPTER pAd, pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR) pAd->CommonCfg.BACapability.field.MpduDensity; - // after reading Registry, we now know if in AP mode or STA mode + /* after reading Registry, we now know if in AP mode or STA mode */ - // Load 8051 firmware; crash when FW image not existent - // Status = NICLoadFirmware(pAd); - // if (Status != NDIS_STATUS_SUCCESS) - // break; + /* Load 8051 firmware; crash when FW image not existent */ + /* Status = NICLoadFirmware(pAd); */ + /* if (Status != NDIS_STATUS_SUCCESS) */ + /* break; */ DBGPRINT(RT_DEBUG_OFF, ("2. Phy Mode = %d\n", pAd->CommonCfg.PhyMode)); - // We should read EEPROM for all cases. rt2860b + /* We should read EEPROM for all cases. rt2860b */ NICReadEEPROMParameters(pAd, (PUCHAR) pDefaultMac); DBGPRINT(RT_DEBUG_OFF, ("3. Phy Mode = %d\n", pAd->CommonCfg.PhyMode)); - NICInitAsicFromEEPROM(pAd); //rt2860b + NICInitAsicFromEEPROM(pAd); /*rt2860b */ - // Set PHY to appropriate mode + /* Set PHY to appropriate mode */ TmpPhy = pAd->CommonCfg.PhyMode; pAd->CommonCfg.PhyMode = 0xff; RTMPSetPhyMode(pAd, TmpPhy); SetCommonHT(pAd); - // No valid channels. + /* No valid channels. */ if (pAd->ChannelListNum == 0) { DBGPRINT(RT_DEBUG_ERROR, ("Wrong configuration. No valid channel found. Check \"ContryCode\" and \"ChannelGeography\" setting.\n")); @@ -3399,35 +3399,35 @@ int rt28xx_init(IN PRTMP_ADAPTER pAd, pAd->CommonCfg.HtCapability.MCSSet[4])); #ifdef RTMP_RF_RW_SUPPORT - //Init RT30xx RFRegisters after read RFIC type from EEPROM + /*Init RT30xx RFRegisters after read RFIC type from EEPROM */ NICInitRFRegisters(pAd); -#endif // RTMP_RF_RW_SUPPORT // +#endif /* RTMP_RF_RW_SUPPORT // */ -// APInitialize(pAd); +/* APInitialize(pAd); */ - // - // Initialize RF register to default value - // + /* */ + /* Initialize RF register to default value */ + /* */ AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.Channel); - // 8051 firmware require the signal during booting time. - //2008/11/28:KH marked the following codes to patch Frequency offset bug - //AsicSendCommandToMcu(pAd, 0x72, 0xFF, 0x00, 0x00); + /* 8051 firmware require the signal during booting time. */ + /*2008/11/28:KH marked the following codes to patch Frequency offset bug */ + /*AsicSendCommandToMcu(pAd, 0x72, 0xFF, 0x00, 0x00); */ if (pAd && (Status != NDIS_STATUS_SUCCESS)) { - // - // Undo everything if it failed - // + /* */ + /* Undo everything if it failed */ + /* */ if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { -// NdisMDeregisterInterrupt(&pAd->Interrupt); +/* NdisMDeregisterInterrupt(&pAd->Interrupt); */ RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE); } -// RTMPFreeAdapter(pAd); // we will free it in disconnect() +/* RTMPFreeAdapter(pAd); // we will free it in disconnect() */ } else if (pAd) { - // Microsoft HCT require driver send a disconnect event after driver initialization. + /* Microsoft HCT require driver send a disconnect event after driver initialization. */ OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); -// pAd->IndicateMediaState = NdisMediaStateDisconnected; +/* pAd->IndicateMediaState = NdisMediaStateDisconnected; */ RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_MEDIA_STATE_CHANGE); DBGPRINT(RT_DEBUG_TRACE, @@ -3437,18 +3437,18 @@ int rt28xx_init(IN PRTMP_ADAPTER pAd, RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS); RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS); - // - // Support multiple BulkIn IRP, - // the value on pAd->CommonCfg.NumOfBulkInIRP may be large than 1. - // + /* */ + /* Support multiple BulkIn IRP, */ + /* the value on pAd->CommonCfg.NumOfBulkInIRP may be large than 1. */ + /* */ for (index = 0; index < pAd->CommonCfg.NumOfBulkInIRP; index++) { RTUSBBulkReceive(pAd); DBGPRINT(RT_DEBUG_TRACE, ("RTUSBBulkReceive!\n")); } -#endif // RTMP_MAC_USB // - } // end of else +#endif /* RTMP_MAC_USB // */ + } /* end of else */ - // Set up the Mac address + /* Set up the Mac address */ RtmpOSNetDevAddrSet(pAd->net_dev, &pAd->CurrentAddress[0]); DBGPRINT_S(Status, ("<==== rt28xx_init, Status=%x\n", Status)); @@ -3462,19 +3462,19 @@ err2: RTMPFreeTxRxRingMemory(pAd); err1: - os_free_mem(pAd, pAd->mpdu_blk_pool.mem); // free BA pool + os_free_mem(pAd, pAd->mpdu_blk_pool.mem); /* free BA pool */ - // shall not set priv to NULL here because the priv didn't been free yet. - //net_dev->ml_priv = 0; + /* shall not set priv to NULL here because the priv didn't been free yet. */ + /*net_dev->ml_priv = 0; */ #ifdef ST err0: -#endif // ST // +#endif /* ST // */ DBGPRINT(RT_DEBUG_ERROR, ("!!! rt28xx Initialized fail !!!\n")); return FALSE; } -//---Add by shiang, move from os/linux/rt_main_dev.c +/*---Add by shiang, move from os/linux/rt_main_dev.c */ static INT RtmpChipOpsRegister(IN RTMP_ADAPTER * pAd, IN INT infType) { @@ -3494,13 +3494,13 @@ static INT RtmpChipOpsRegister(IN RTMP_ADAPTER * pAd, IN INT infType) pChipOps->eraseFirmware = RtmpAsicEraseFirmware; pChipOps->sendCommandToMcu = RtmpAsicSendCommandToMcu; break; -#endif // RTMP_PCI_SUPPORT // +#endif /* RTMP_PCI_SUPPORT // */ #ifdef RTMP_USB_SUPPORT case RTMP_DEV_INF_USB: pChipOps->loadFirmware = RtmpAsicLoadFirmware; pChipOps->sendCommandToMcu = RtmpAsicSendCommandToMcu; break; -#endif // RTMP_USB_SUPPORT // +#endif /* RTMP_USB_SUPPORT // */ default: break; } @@ -3510,9 +3510,9 @@ static INT RtmpChipOpsRegister(IN RTMP_ADAPTER * pAd, IN INT infType) INT RtmpRaDevCtrlInit(IN RTMP_ADAPTER * pAd, IN RTMP_INF_TYPE infType) { - //VOID *handle; + /*VOID *handle; */ - // Assign the interface type. We need use it when do register/EEPROM access. + /* Assign the interface type. We need use it when do register/EEPROM access. */ pAd->infType = infType; pAd->OpMode = OPMODE_STA; @@ -3528,7 +3528,7 @@ INT RtmpRaDevCtrlInit(IN RTMP_ADAPTER * pAd, IN RTMP_INF_TYPE infType) ("Allocate vendor request temp buffer failed!\n")); return FALSE; } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ RtmpChipOpsRegister(pAd, infType); @@ -3543,7 +3543,7 @@ BOOLEAN RtmpRaDevCtrlExit(IN RTMP_ADAPTER * pAd) return TRUE; } -// not yet support MBSS +/* not yet support MBSS */ PNET_DEV get_netdev_from_bssid(IN PRTMP_ADAPTER pAd, IN UCHAR FromWhichBSSID) { PNET_DEV dev_p = NULL; diff --git a/drivers/staging/rt2860/common/rtmp_mcu.c b/drivers/staging/rt2860/common/rtmp_mcu.c index d962f02599ef..09d46f779db9 100644 --- a/drivers/staging/rt2860/common/rtmp_mcu.c +++ b/drivers/staging/rt2860/common/rtmp_mcu.c @@ -48,16 +48,14 @@ #include -//#define BIN_IN_FILE /* use *.bin firmware */ - #ifdef RTMP_MAC_USB -// -// RT2870 Firmware Spec only used 1 oct for version expression -// +/* */ +/* RT2870 Firmware Spec only used 1 oct for version expression */ +/* */ #define FIRMWARE_MINOR_VERSION 7 -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ -// New 8k byte firmware size for RT3071/RT3072 +/* New 8k byte firmware size for RT3071/RT3072 */ #define FIRMWAREIMAGE_MAX_LENGTH 0x2000 #define FIRMWAREIMAGE_LENGTH (sizeof (FirmwareImage) / sizeof(UCHAR)) #define FIRMWARE_MAJOR_VERSION 0 @@ -67,7 +65,7 @@ #ifdef RTMP_MAC_PCI #define FIRMWARE_MINOR_VERSION 2 -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ /* ======================================================================== @@ -120,7 +118,7 @@ NDIS_STATUS RtmpAsicLoadFirmware(IN PRTMP_ADAPTER pAd) UINT32 Version = (pAd->MACVersion >> 16); #endif - // New 8k byte firmware size for RT3071/RT3072 + /* New 8k byte firmware size for RT3071/RT3072 */ { #ifdef RTMP_MAC_PCI if (IS_RT3090(pAd) || IS_RT3390(pAd)) { @@ -130,24 +128,24 @@ NDIS_STATUS RtmpAsicLoadFirmware(IN PRTMP_ADAPTER pAd) pFirmwareImage = FirmwareImage_2860; FileLength = FIRMWAREIMAGE_MAX_LENGTH; } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB /* the firmware image consists of two parts */ if ((Version != 0x2860) && (Version != 0x2872) && (Version != 0x3070)) { /* use the second part */ - //printk("KH:Use New Version,part2\n"); + /*printk("KH:Use New Version,part2\n"); */ pFirmwareImage = (PUCHAR) & FirmwareImage_3070[FIRMWAREIMAGEV1_LENGTH]; FileLength = FIRMWAREIMAGEV2_LENGTH; } else { - //printk("KH:Use New Version,part1\n"); + /*printk("KH:Use New Version,part1\n"); */ if (Version == 0x3070) pFirmwareImage = FirmwareImage_3070; else pFirmwareImage = FirmwareImage_2870; FileLength = FIRMWAREIMAGEV1_LENGTH; } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ } RTMP_WRITE_FIRMWARE(pAd, pFirmwareImage, FileLength); @@ -183,8 +181,8 @@ INT RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, ULONG i = 0; #ifdef PCIE_PS_SUPPORT - // 3090F power solution 3 has hw limitation that needs to ban all mcu command - // when firmware is in radio state. For other chip doesn't have this limitation. + /* 3090F power solution 3 has hw limitation that needs to ban all mcu command */ + /* when firmware is in radio state. For other chip doesn't have this limitation. */ if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) @@ -228,7 +226,7 @@ INT RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, return FALSE; } - H2MMailbox.field.Owner = 1; // pass ownership to MCU + H2MMailbox.field.Owner = 1; /* pass ownership to MCU */ H2MMailbox.field.CmdToken = Token; H2MMailbox.field.HighByte = Arg1; H2MMailbox.field.LowByte = Arg0; @@ -239,7 +237,7 @@ INT RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, RTMP_IO_FORCE_WRITE32(pAd, HOST_CMD_CSR, H2MCmd.word); } else -#endif // PCIE_PS_SUPPORT // +#endif /* PCIE_PS_SUPPORT // */ { do { RTMP_IO_READ32(pAd, H2M_MAILBOX_CSR, &H2MMailbox.word); @@ -251,16 +249,16 @@ INT RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, if (i > 100) { #ifdef RTMP_MAC_PCI -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ { DBGPRINT_ERR(("H2M_MAILBOX still hold by MCU. command fail\n")); } return FALSE; } #ifdef RTMP_MAC_PCI -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ - H2MMailbox.field.Owner = 1; // pass ownership to MCU + H2MMailbox.field.Owner = 1; /* pass ownership to MCU */ H2MMailbox.field.CmdToken = Token; H2MMailbox.field.HighByte = Arg1; H2MMailbox.field.LowByte = Arg0; @@ -274,20 +272,20 @@ INT RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, } } #ifdef PCIE_PS_SUPPORT - // 3090 MCU Wakeup command needs more time to be stable. - // Before stable, don't issue other MCU command to prevent from firmware error. + /* 3090 MCU Wakeup command needs more time to be stable. */ + /* Before stable, don't issue other MCU command to prevent from firmware error. */ if (((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) && IS_VERSION_AFTER_F(pAd) && (pAd->StaCfg.PSControl.field.rt30xxPowerMode == 3) && (pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) && (Command == WAKE_MCU_CMD)) { RTMPusecDelay(2000); - //Put this is after RF programming. - //NdisAcquireSpinLock(&pAd->McuCmdLock); - //pAd->brt30xxBanMcuCmd = FALSE; - //NdisReleaseSpinLock(&pAd->McuCmdLock); + /*Put this is after RF programming. */ + /*NdisAcquireSpinLock(&pAd->McuCmdLock); */ + /*pAd->brt30xxBanMcuCmd = FALSE; */ + /*NdisReleaseSpinLock(&pAd->McuCmdLock); */ } -#endif // PCIE_PS_SUPPORT // +#endif /* PCIE_PS_SUPPORT // */ return TRUE; } diff --git a/drivers/staging/rt2860/common/rtmp_timer.c b/drivers/staging/rt2860/common/rtmp_timer.c index 9abfe631c124..d29e6e8775e8 100644 --- a/drivers/staging/rt2860/common/rtmp_timer.c +++ b/drivers/staging/rt2860/common/rtmp_timer.c @@ -41,13 +41,13 @@ #include "../rt_config.h" BUILD_TIMER_FUNCTION(MlmePeriodicExec); -//BUILD_TIMER_FUNCTION(MlmeRssiReportExec); +/*BUILD_TIMER_FUNCTION(MlmeRssiReportExec); */ BUILD_TIMER_FUNCTION(AsicRxAntEvalTimeout); BUILD_TIMER_FUNCTION(APSDPeriodicExec); BUILD_TIMER_FUNCTION(AsicRfTuningExec); #ifdef RTMP_MAC_USB BUILD_TIMER_FUNCTION(BeaconUpdateExec); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ BUILD_TIMER_FUNCTION(BeaconTimeout); BUILD_TIMER_FUNCTION(ScanTimeout); @@ -61,10 +61,10 @@ BUILD_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc); #ifdef RTMP_MAC_PCI BUILD_TIMER_FUNCTION(PsPollWakeExec); BUILD_TIMER_FUNCTION(RadioOnExec); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB BUILD_TIMER_FUNCTION(RtmpUsbStaAsicForceWakeupTimeout); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ #if defined(AP_LED) || defined(STA_LED) extern void LedCtrlMain(IN PVOID SystemSpecific1, @@ -97,19 +97,19 @@ static void RtmpTimerQHandle(RTMP_ADAPTER * pAd) if (pAd->TimerQ.status == RTMP_TASK_STAT_STOPED) break; - // event happened. + /* event happened. */ while (pAd->TimerQ.pQHead) { RTMP_INT_LOCK(&pAd->TimerQLock, irqFlag); pEntry = pAd->TimerQ.pQHead; if (pEntry) { pTimer = pEntry->pRaTimer; - // update pQHead + /* update pQHead */ pAd->TimerQ.pQHead = pEntry->pNext; if (pEntry == pAd->TimerQ.pQTail) pAd->TimerQ.pQTail = NULL; - // return this queue entry to timerQFreeList. + /* return this queue entry to timerQFreeList. */ pEntry->pNext = pAd->TimerQ.pQPollFreeList; pAd->TimerQ.pQPollFreeList = pEntry; } @@ -226,7 +226,7 @@ BOOLEAN RtmpTimerQRemove(IN RTMP_ADAPTER * pAd, IN RALINK_TIMER_STRUCT * pTimer) pNode = pNode->pNext; } - // Now move it to freeList queue. + /* Now move it to freeList queue. */ if (pNode) { if (pNode == pAd->TimerQ.pQHead) pAd->TimerQ.pQHead = pNode->pNext; @@ -235,7 +235,7 @@ BOOLEAN RtmpTimerQRemove(IN RTMP_ADAPTER * pAd, IN RALINK_TIMER_STRUCT * pTimer) if (pPrev != NULL) pPrev->pNext = pNode->pNext; - // return this queue entry to timerQFreeList. + /* return this queue entry to timerQFreeList. */ pNode->pNext = pAd->TimerQ.pQPollFreeList; pAd->TimerQ.pQPollFreeList = pNode; } @@ -254,7 +254,7 @@ void RtmpTimerQExit(RTMP_ADAPTER * pAd) while (pAd->TimerQ.pQHead) { pTimerQ = pAd->TimerQ.pQHead; pAd->TimerQ.pQHead = pTimerQ->pNext; - // remove the timeQ + /* remove the timeQ */ } pAd->TimerQ.pQPollFreeList = NULL; os_free_mem(pAd, pAd->TimerQ.pTimerQPoll); @@ -299,4 +299,4 @@ void RtmpTimerQInit(RTMP_ADAPTER * pAd) RTMP_INT_UNLOCK(&pAd->TimerQLock, irqFlags); } } -#endif // RTMP_TIMER_TASK_SUPPORT // +#endif /* RTMP_TIMER_TASK_SUPPORT // */ diff --git a/drivers/staging/rt2860/common/spectrum.c b/drivers/staging/rt2860/common/spectrum.c index 9c2df55f8fa1..2cc73de092d0 100644 --- a/drivers/staging/rt2860/common/spectrum.c +++ b/drivers/staging/rt2860/common/spectrum.c @@ -45,7 +45,7 @@ DOT11_REGULATORY_INFORMATION USARegulatoryInfo[] = { {0, {0, 0, {0} } } - , // Invlid entry + , /* Invlid entry */ {1, {4, 16, {36, 40, 44, 48} } } @@ -103,7 +103,7 @@ DOT11_REGULATORY_INFORMATION EuropeRegulatoryInfo[] = { {0, {0, 0, {0} } } - , // Invalid entry + , /* Invalid entry */ {1, {4, 20, {36, 40, 44, 48} } } @@ -129,7 +129,7 @@ DOT11_REGULATORY_INFORMATION JapanRegulatoryInfo[] = { {0, {0, 0, {0} } } - , // Invalid entry + , /* Invalid entry */ {1, {4, 22, {34, 38, 42, 46} } } @@ -489,7 +489,7 @@ PMEASURE_REQ_ENTRY MeasureReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) PMEASURE_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx]; - // update Hash list + /* update Hash list */ do { if (pProbeEntry == pEntry) { if (pPrevEntry == NULL) { @@ -529,7 +529,7 @@ PMEASURE_REQ_ENTRY MeasureReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) ("%s: pMeasureReqTab tab full.\n", __func__)); } - // add this Neighbor entry into HASH table + /* add this Neighbor entry into HASH table */ if (pEntry) { HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(DialogToken); if (pTab->Hash[HashIdx] == NULL) { @@ -558,7 +558,7 @@ VOID MeasureReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) ("%s: pMeasureReqTab doesn't exist.\n", __func__)); return; } - // if empty, return + /* if empty, return */ if (pTab->Size == 0) { DBGPRINT(RT_DEBUG_ERROR, ("pMeasureReqTab empty.\n")); return; @@ -571,7 +571,7 @@ VOID MeasureReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) PMEASURE_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx]; RTMP_SEM_LOCK(&pAd->CommonCfg.MeasureReqTabLock); - // update Hash list + /* update Hash list */ do { if (pProbeEntry == pEntry) { if (pPrevEntry == NULL) { @@ -687,7 +687,7 @@ static PTPC_REQ_ENTRY TpcReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) PTPC_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx]; - // update Hash list + /* update Hash list */ do { if (pProbeEntry == pEntry) { if (pPrevEntry == NULL) { @@ -726,7 +726,7 @@ static PTPC_REQ_ENTRY TpcReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) ("%s: pTpcReqTab tab full.\n", __func__)); } - // add this Neighbor entry into HASH table + /* add this Neighbor entry into HASH table */ if (pEntry) { HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(DialogToken); if (pTab->Hash[HashIdx] == NULL) { @@ -755,7 +755,7 @@ static VOID TpcReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) ("%s: pTpcReqTab doesn't exist.\n", __func__)); return; } - // if empty, return + /* if empty, return */ if (pTab->Size == 0) { DBGPRINT(RT_DEBUG_ERROR, ("pTpcReqTab empty.\n")); return; @@ -768,7 +768,7 @@ static VOID TpcReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) PTPC_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx]; RTMP_SEM_LOCK(&pAd->CommonCfg.TpcReqTabLock); - // update Hash list + /* update Hash list */ do { if (pProbeEntry == pEntry) { if (pPrevEntry == NULL) { @@ -804,7 +804,7 @@ static VOID TpcReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) */ static UINT64 GetCurrentTimeStamp(IN PRTMP_ADAPTER pAd) { - // get current time stamp. + /* get current time stamp. */ return 0; } @@ -1121,7 +1121,7 @@ VOID MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd, InsertActField(pAd, (pOutBuffer + *pFrameLen), pFrameLen, Category, Action); - // fill Dialog Token + /* fill Dialog Token */ InsertDialogToken(pAd, (pOutBuffer + *pFrameLen), pFrameLen, MeasureToken); @@ -1132,7 +1132,7 @@ VOID MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd, *pFrameLen += TempLen; } - // prepare Measurement IE. + /* prepare Measurement IE. */ NdisZeroMemory(&MeasureReqIE, sizeof(MEASURE_REQ_INFO)); MeasureReqIE.Token = MeasureToken; MeasureReqIE.ReqMode.word = MeasureReqMode; @@ -1169,11 +1169,11 @@ VOID EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd, HEADER_802_11 ActHdr; MEASURE_REPORT_INFO MeasureRepIE; - // build action frame header. + /* build action frame header. */ MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, pAd->CurrentAddress); - NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__)); @@ -1185,10 +1185,10 @@ VOID EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd, InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_MRP); - // fill Dialog Token + /* fill Dialog Token */ InsertDialogToken(pAd, (pOutBuffer + FrameLen), &FrameLen, DialogToken); - // prepare Measurement IE. + /* prepare Measurement IE. */ NdisZeroMemory(&MeasureRepIE, sizeof(MEASURE_REPORT_INFO)); MeasureRepIE.Token = MeasureToken; MeasureRepIE.ReportMode = MeasureReqMode; @@ -1222,11 +1222,11 @@ VOID EnqueueTPCReq(IN PRTMP_ADAPTER pAd, IN PUCHAR pDA, IN UCHAR DialogToken) HEADER_802_11 ActHdr; - // build action frame header. + /* build action frame header. */ MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, pAd->CurrentAddress); - NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__)); @@ -1238,10 +1238,10 @@ VOID EnqueueTPCReq(IN PRTMP_ADAPTER pAd, IN PUCHAR pDA, IN UCHAR DialogToken) InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_TPCRQ); - // fill Dialog Token + /* fill Dialog Token */ InsertDialogToken(pAd, (pOutBuffer + FrameLen), &FrameLen, DialogToken); - // Insert TPC Request IE. + /* Insert TPC Request IE. */ InsertTpcReqIE(pAd, (pOutBuffer + FrameLen), &FrameLen); MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); @@ -1272,11 +1272,11 @@ VOID EnqueueTPCRep(IN PRTMP_ADAPTER pAd, HEADER_802_11 ActHdr; - // build action frame header. + /* build action frame header. */ MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, pAd->CurrentAddress); - NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__)); @@ -1288,10 +1288,10 @@ VOID EnqueueTPCRep(IN PRTMP_ADAPTER pAd, InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_TPCRP); - // fill Dialog Token + /* fill Dialog Token */ InsertDialogToken(pAd, (pOutBuffer + FrameLen), &FrameLen, DialogToken); - // Insert TPC Request IE. + /* Insert TPC Request IE. */ InsertTpcReportIE(pAd, (pOutBuffer + FrameLen), &FrameLen, TxPwr, LinkMargin); @@ -1324,11 +1324,11 @@ VOID EnqueueChSwAnn(IN PRTMP_ADAPTER pAd, HEADER_802_11 ActHdr; - // build action frame header. + /* build action frame header. */ MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, pAd->CurrentAddress); - NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__)); @@ -1355,18 +1355,18 @@ static BOOLEAN DfsRequirementCheck(IN PRTMP_ADAPTER pAd, IN UINT8 Channel) INT i; do { - // check DFS procedure is running. - // make sure DFS procedure won't start twice. + /* check DFS procedure is running. */ + /* make sure DFS procedure won't start twice. */ if (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) { Result = FALSE; break; } - // check the new channel carried from Channel Switch Announcemnet is valid. + /* check the new channel carried from Channel Switch Announcemnet is valid. */ for (i = 0; i < pAd->ChannelListNum; i++) { if ((Channel == pAd->ChannelList[i].Channel) && (pAd->ChannelList[i].RemainingTimeForUse == 0)) { - // found radar signal in the channel. the channel can't use at least for 30 minutes. - pAd->ChannelList[i].RemainingTimeForUse = 1800; //30 min = 1800 sec + /* found radar signal in the channel. the channel can't use at least for 30 minutes. */ + pAd->ChannelList[i].RemainingTimeForUse = 1800; /*30 min = 1800 sec */ Result = TRUE; break; } @@ -1385,7 +1385,7 @@ VOID NotifyChSwAnnToPeerAPs(IN PRTMP_ADAPTER pAd, static VOID StartDFSProcedure(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN UINT8 ChSwMode) { - // start DFS procedure + /* start DFS procedure */ pAd->CommonCfg.Channel = Channel; N_ChannelCheck(pAd); @@ -1425,10 +1425,10 @@ static BOOLEAN PeerChSwAnnSanity(IN PRTMP_ADAPTER pAd, BOOLEAN result = FALSE; PEID_STRUCT eid_ptr; - // skip 802.11 header. + /* skip 802.11 header. */ MsgLen -= sizeof(HEADER_802_11); - // skip category and action code. + /* skip category and action code. */ pFramePtr += 2; MsgLen -= 2; @@ -1487,10 +1487,10 @@ static BOOLEAN PeerMeasureReqSanity(IN PRTMP_ADAPTER pAd, UINT64 MeasureStartTime; UINT16 MeasureDuration; - // skip 802.11 header. + /* skip 802.11 header. */ MsgLen -= sizeof(HEADER_802_11); - // skip category and action code. + /* skip category and action code. */ pFramePtr += 2; MsgLen -= 2; @@ -1580,10 +1580,10 @@ static BOOLEAN PeerMeasureReportSanity(IN PRTMP_ADAPTER pAd, PEID_STRUCT eid_ptr; PUCHAR ptr; - // skip 802.11 header. + /* skip 802.11 header. */ MsgLen -= sizeof(HEADER_802_11); - // skip category and action code. + /* skip category and action code. */ pFramePtr += 2; MsgLen -= 2; @@ -1677,7 +1677,7 @@ static BOOLEAN PeerTpcReqSanity(IN PRTMP_ADAPTER pAd, MsgLen -= sizeof(HEADER_802_11); - // skip category and action code. + /* skip category and action code. */ pFramePtr += 2; MsgLen -= 2; @@ -1732,7 +1732,7 @@ static BOOLEAN PeerTpcRepSanity(IN PRTMP_ADAPTER pAd, MsgLen -= sizeof(HEADER_802_11); - // skip category and action code. + /* skip category and action code. */ pFramePtr += 2; MsgLen -= 2; @@ -1808,16 +1808,16 @@ static VOID PeerChSwAnnAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if ((pAd->CommonCfg.bIEEE80211H == 1) && (NewChannel != 0) && (Channel != NewChannel)) { - // Switching to channel 1 can prevent from rescanning the current channel immediately (by auto reconnection). - // In addition, clear the MLME queue and the scan table to discard the RX packets and previous scanning results. + /* Switching to channel 1 can prevent from rescanning the current channel immediately (by auto reconnection). */ + /* In addition, clear the MLME queue and the scan table to discard the RX packets and previous scanning results. */ AsicSwitchChannel(pAd, 1, FALSE); AsicLockChannel(pAd, 1); LinkDown(pAd, FALSE); MlmeQueueInit(&pAd->Mlme.Queue); BssTableInit(&pAd->ScanTab); - RTMPusecDelay(1000000); // use delay to prevent STA do reassoc + RTMPusecDelay(1000000); /* use delay to prevent STA do reassoc */ - // channel sanity check + /* channel sanity check */ for (index = 0; index < pAd->ChannelListNum; index++) { if (pAd->ChannelList[index].Channel == NewChannel) { @@ -1897,8 +1897,8 @@ static VOID PeerMeasureReportAction(IN PRTMP_ADAPTER pAd, UINT8 DialogToken; PUINT8 pMeasureReportInfo; -// if (pAd->CommonCfg.bIEEE80211H != TRUE) -// return; +/* if (pAd->CommonCfg.bIEEE80211H != TRUE) */ +/* return; */ if ((pMeasureReportInfo = kmalloc(sizeof(MEASURE_RPI_REPORT), GFP_ATOMIC)) == NULL) { @@ -1916,8 +1916,8 @@ static VOID PeerMeasureReportAction(IN PRTMP_ADAPTER pAd, do { PMEASURE_REQ_ENTRY pEntry = NULL; - // Not a autonomous measure report. - // check the dialog token field. drop it if the dialog token doesn't match. + /* Not a autonomous measure report. */ + /* check the dialog token field. drop it if the dialog token doesn't match. */ if ((DialogToken != 0) && ((pEntry = MeasureReqLookUp(pAd, DialogToken)) == NULL)) @@ -1974,18 +1974,18 @@ static VOID PeerTpcReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) UINT8 LinkMargin = 0; CHAR RealRssi; - // link margin: Ratio of the received signal power to the minimum desired by the station (STA). The - // STA may incorporate rate information and channel conditions, including interference, into its computation - // of link margin. + /* link margin: Ratio of the received signal power to the minimum desired by the station (STA). The */ + /* STA may incorporate rate information and channel conditions, including interference, into its computation */ + /* of link margin. */ RealRssi = RTMPMaxRssi(pAd, ConvertToRssi(pAd, Elem->Rssi0, RSSI_0), ConvertToRssi(pAd, Elem->Rssi1, RSSI_1), ConvertToRssi(pAd, Elem->Rssi2, RSSI_2)); - // skip Category and action code. + /* skip Category and action code. */ pFramePtr += 2; - // Dialog token. + /* Dialog token. */ NdisMoveMemory(&DialogToken, pFramePtr, 1); LinkMargin = (RealRssi / MIN_RCV_PWR); @@ -2050,8 +2050,8 @@ VOID PeerSpectrumAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) switch (Action) { case SPEC_MRQ: - // current rt2860 unable do such measure specified in Measurement Request. - // reject all measurement request. + /* current rt2860 unable do such measure specified in Measurement Request. */ + /* reject all measurement request. */ PeerMeasureReqAction(pAd, Elem); break; @@ -2104,7 +2104,7 @@ INT Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg) NDIS_STATUS NStatus; ULONG FrameLen; - NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__)); @@ -2114,11 +2114,11 @@ INT Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg) ArgIdx = 1; while ((thisChar = strsep((char **)&arg, "-")) != NULL) { switch (ArgIdx) { - case 1: // Aid. + case 1: /* Aid. */ Aid = (UINT8) simple_strtol(thisChar, 0, 16); break; - case 2: // Measurement Request Type. + case 2: /* Measurement Request Type. */ MeasureReqType = simple_strtol(thisChar, 0, 16); if (MeasureReqType > 3) { DBGPRINT(RT_DEBUG_ERROR, @@ -2128,7 +2128,7 @@ INT Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg) } break; - case 3: // Measurement channel. + case 3: /* Measurement channel. */ MeasureCh = (UINT8) simple_strtol(thisChar, 0, 16); break; } @@ -2149,7 +2149,7 @@ INT Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg) MeasureReqInsert(pAd, MeasureReqToken); - // build action frame header. + /* build action frame header. */ MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pAd->MacTab.Content[Aid].Addr, pAd->CurrentAddress); -- GitLab From 8281958ba7c8f4cb8695113a221e1f508f4feea6 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 11 Dec 2009 12:23:15 -0800 Subject: [PATCH 165/235] Staging: rt28x0: fix comments in sta/*.c files Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/sta/assoc.c | 246 ++++---- drivers/staging/rt2860/sta/auth.c | 30 +- drivers/staging/rt2860/sta/auth_rsp.c | 8 +- drivers/staging/rt2860/sta/connect.c | 694 +++++++++++----------- drivers/staging/rt2860/sta/rtmp_data.c | 786 ++++++++++++------------- drivers/staging/rt2860/sta/sanity.c | 66 +-- drivers/staging/rt2860/sta/sync.c | 336 +++++------ drivers/staging/rt2860/sta/wpa.c | 92 +-- 8 files changed, 1129 insertions(+), 1129 deletions(-) diff --git a/drivers/staging/rt2860/sta/assoc.c b/drivers/staging/rt2860/sta/assoc.c index e9774164de2f..c5a17381fc78 100644 --- a/drivers/staging/rt2860/sta/assoc.c +++ b/drivers/staging/rt2860/sta/assoc.c @@ -37,27 +37,27 @@ #include "../rt_config.h" UCHAR CipherWpaTemplate[] = { - 0xdd, // WPA IE - 0x16, // Length - 0x00, 0x50, 0xf2, 0x01, // oui - 0x01, 0x00, // Version - 0x00, 0x50, 0xf2, 0x02, // Multicast - 0x01, 0x00, // Number of unicast - 0x00, 0x50, 0xf2, 0x02, // unicast - 0x01, 0x00, // number of authentication method - 0x00, 0x50, 0xf2, 0x01 // authentication + 0xdd, /* WPA IE */ + 0x16, /* Length */ + 0x00, 0x50, 0xf2, 0x01, /* oui */ + 0x01, 0x00, /* Version */ + 0x00, 0x50, 0xf2, 0x02, /* Multicast */ + 0x01, 0x00, /* Number of unicast */ + 0x00, 0x50, 0xf2, 0x02, /* unicast */ + 0x01, 0x00, /* number of authentication method */ + 0x00, 0x50, 0xf2, 0x01 /* authentication */ }; UCHAR CipherWpa2Template[] = { - 0x30, // RSN IE - 0x14, // Length - 0x01, 0x00, // Version - 0x00, 0x0f, 0xac, 0x02, // group cipher, TKIP - 0x01, 0x00, // number of pairwise - 0x00, 0x0f, 0xac, 0x02, // unicast - 0x01, 0x00, // number of authentication method - 0x00, 0x0f, 0xac, 0x02, // authentication - 0x00, 0x00, // RSN capability + 0x30, /* RSN IE */ + 0x14, /* Length */ + 0x01, 0x00, /* Version */ + 0x00, 0x0f, 0xac, 0x02, /* group cipher, TKIP */ + 0x01, 0x00, /* number of pairwise */ + 0x00, 0x0f, 0xac, 0x02, /* unicast */ + 0x01, 0x00, /* number of authentication method */ + 0x00, 0x0f, 0xac, 0x02, /* authentication */ + 0x00, 0x00, /* RSN capability */ }; UCHAR Ccx2IeInfo[] = { 0x00, 0x40, 0x96, 0x03, 0x02 }; @@ -80,7 +80,7 @@ VOID AssocStateMachineInit(IN PRTMP_ADAPTER pAd, (STATE_MACHINE_FUNC) Drop, ASSOC_IDLE, ASSOC_MACHINE_BASE); - // first column + /* first column */ StateMachineSetAction(S, ASSOC_IDLE, MT2_MLME_ASSOC_REQ, (STATE_MACHINE_FUNC) MlmeAssocReqAction); StateMachineSetAction(S, ASSOC_IDLE, MT2_MLME_REASSOC_REQ, @@ -90,7 +90,7 @@ VOID AssocStateMachineInit(IN PRTMP_ADAPTER pAd, StateMachineSetAction(S, ASSOC_IDLE, MT2_PEER_DISASSOC_REQ, (STATE_MACHINE_FUNC) PeerDisassocAction); - // second column + /* second column */ StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_MLME_ASSOC_REQ, (STATE_MACHINE_FUNC) InvalidStateWhenAssoc); StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_MLME_REASSOC_REQ, @@ -102,16 +102,16 @@ VOID AssocStateMachineInit(IN PRTMP_ADAPTER pAd, (STATE_MACHINE_FUNC) PeerDisassocAction); StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_PEER_ASSOC_RSP, (STATE_MACHINE_FUNC) PeerAssocRspAction); - // - // Patch 3Com AP MOde:3CRWE454G72 - // We send Assoc request frame to this AP, it always send Reassoc Rsp not Associate Rsp. - // + /* */ + /* Patch 3Com AP MOde:3CRWE454G72 */ + /* We send Assoc request frame to this AP, it always send Reassoc Rsp not Associate Rsp. */ + /* */ StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_PEER_REASSOC_RSP, (STATE_MACHINE_FUNC) PeerAssocRspAction); StateMachineSetAction(S, ASSOC_WAIT_RSP, MT2_ASSOC_TIMEOUT, (STATE_MACHINE_FUNC) AssocTimeoutAction); - // third column + /* third column */ StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_MLME_ASSOC_REQ, (STATE_MACHINE_FUNC) InvalidStateWhenAssoc); StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_MLME_REASSOC_REQ, @@ -123,15 +123,15 @@ VOID AssocStateMachineInit(IN PRTMP_ADAPTER pAd, (STATE_MACHINE_FUNC) PeerDisassocAction); StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_PEER_REASSOC_RSP, (STATE_MACHINE_FUNC) PeerReassocRspAction); - // - // Patch, AP doesn't send Reassociate Rsp frame to Station. - // + /* */ + /* Patch, AP doesn't send Reassociate Rsp frame to Station. */ + /* */ StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_PEER_ASSOC_RSP, (STATE_MACHINE_FUNC) PeerReassocRspAction); StateMachineSetAction(S, REASSOC_WAIT_RSP, MT2_REASSOC_TIMEOUT, (STATE_MACHINE_FUNC) ReassocTimeoutAction); - // fourth column + /* fourth column */ StateMachineSetAction(S, DISASSOC_WAIT_RSP, MT2_MLME_ASSOC_REQ, (STATE_MACHINE_FUNC) InvalidStateWhenAssoc); StateMachineSetAction(S, DISASSOC_WAIT_RSP, MT2_MLME_REASSOC_REQ, @@ -144,7 +144,7 @@ VOID AssocStateMachineInit(IN PRTMP_ADAPTER pAd, StateMachineSetAction(S, DISASSOC_WAIT_RSP, MT2_DISASSOC_TIMEOUT, (STATE_MACHINE_FUNC) DisassocTimeoutAction); - // initialize the timer + /* initialize the timer */ RTMPInitTimer(pAd, &pAd->MlmeAux.AssocTimer, GET_TIMER_FUNCTION(AssocTimeout), pAd, FALSE); RTMPInitTimer(pAd, &pAd->MlmeAux.ReassocTimer, @@ -171,8 +171,8 @@ VOID AssocTimeout(IN PVOID SystemSpecific1, { RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt + /* Do nothing if the driver is starting halt state. */ + /* This might happen when timer already been fired before cancel timer with mlmehalt */ if (RTMP_TEST_FLAG (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; @@ -199,8 +199,8 @@ VOID ReassocTimeout(IN PVOID SystemSpecific1, { RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt + /* Do nothing if the driver is starting halt state. */ + /* This might happen when timer already been fired before cancel timer with mlmehalt */ if (RTMP_TEST_FLAG (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; @@ -227,8 +227,8 @@ VOID DisassocTimeout(IN PVOID SystemSpecific1, { RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt + /* Do nothing if the driver is starting halt state. */ + /* This might happen when timer already been fired before cancel timer with mlmehalt */ if (RTMP_TEST_FLAG (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; @@ -277,7 +277,7 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) USHORT VarIesOffset; USHORT Status; - // Block all authentication request durning WPA block period + /* Block all authentication request durning WPA block period */ if (pAd->StaCfg.bBlockAssoc == TRUE) { DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - Block Assoc request durning WPA block period!\n")); @@ -286,14 +286,14 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_ASSOC_CONF, 2, &Status); } - // check sanity first + /* check sanity first */ else if (MlmeAssocReqSanity (pAd, Elem->Msg, Elem->MsgLen, ApAddr, &CapabilityInfo, &Timeout, &ListenIntv)) { RTMPCancelTimer(&pAd->MlmeAux.AssocTimer, &TimerCancelled); COPY_MAC_ADDR(pAd->MlmeAux.Bssid, ApAddr); - // Get an unused nonpaged memory + /* Get an unused nonpaged memory */ NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, @@ -304,10 +304,10 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MT2_ASSOC_CONF, 2, &Status); return; } - // Add by James 03/06/27 + /* Add by James 03/06/27 */ pAd->StaCfg.AssocInfo.Length = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); - // Association don't need to report MAC address + /* Association don't need to report MAC address */ pAd->StaCfg.AssocInfo.AvailableRequestFixedIEs = NDIS_802_11_AI_REQFI_CAPABILITIES | NDIS_802_11_AI_REQFI_LISTENINTERVAL; @@ -315,13 +315,13 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) CapabilityInfo; pAd->StaCfg.AssocInfo.RequestFixedIEs.ListenInterval = ListenIntv; - // Only reassociate need this - //COPY_MAC_ADDR(pAd->StaCfg.AssocInfo.RequestFixedIEs.CurrentAPAddress, ApAddr); + /* Only reassociate need this */ + /*COPY_MAC_ADDR(pAd->StaCfg.AssocInfo.RequestFixedIEs.CurrentAPAddress, ApAddr); */ pAd->StaCfg.AssocInfo.OffsetRequestIEs = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); NdisZeroMemory(pAd->StaCfg.ReqVarIEs, MAX_VIE_LEN); - // First add SSID + /* First add SSID */ VarIesOffset = 0; NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &SsidIe, 1); @@ -333,7 +333,7 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); VarIesOffset += pAd->MlmeAux.SsidLen; - // Second add Supported rates + /* Second add Supported rates */ NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &SupRateIe, 1); VarIesOffset += 1; @@ -343,7 +343,7 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, pAd->MlmeAux.SupRate, pAd->MlmeAux.SupRateLen); VarIesOffset += pAd->MlmeAux.SupRateLen; - // End Add by James + /* End Add by James */ if ((pAd->CommonCfg.Channel > 14) && (pAd->CommonCfg.bIEEE80211H == TRUE)) @@ -353,7 +353,7 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MgtMacHeaderInit(pAd, &AssocHdr, SUBTYPE_ASSOC_REQ, 0, ApAddr, ApAddr); - // Build basic frame first + /* Build basic frame first */ MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(HEADER_802_11), &AssocHdr, 2, &CapabilityInfo, @@ -374,7 +374,7 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->MlmeAux.ExtRate, END_OF_ARGS); FrameLen += tmp; } - // HT + /* HT */ if ((pAd->MlmeAux.HtCapabilityLen > 0) && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) { ULONG TmpLen; @@ -398,14 +398,14 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } FrameLen += TmpLen; } - // add Ralink proprietary IE to inform AP this STA is going to use AGGREGATION or PIGGY-BACK+AGGREGATION - // Case I: (Aggregation + Piggy-Back) - // 1. user enable aggregation, AND - // 2. Mac support piggy-back - // 3. AP annouces it's PIGGY-BACK+AGGREGATION-capable in BEACON - // Case II: (Aggregation) - // 1. user enable aggregation, AND - // 2. AP annouces it's AGGREGATION-capable in BEACON + /* add Ralink proprietary IE to inform AP this STA is going to use AGGREGATION or PIGGY-BACK+AGGREGATION */ + /* Case I: (Aggregation + Piggy-Back) */ + /* 1. user enable aggregation, AND */ + /* 2. Mac support piggy-back */ + /* 3. AP annouces it's PIGGY-BACK+AGGREGATION-capable in BEACON */ + /* Case II: (Aggregation) */ + /* 1. user enable aggregation, AND */ + /* 2. AP annouces it's AGGREGATION-capable in BEACON */ if (pAd->CommonCfg.bAggregationCapable) { if ((pAd->CommonCfg.bPiggyBackCapable) && ((pAd->MlmeAux.APRalinkIe & 0x00000003) == 3)) { @@ -452,20 +452,20 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->CommonCfg.MaxSPLength; WmeIe[8] |= *(PUCHAR) & QosInfo; } else { - // The Parameter Set Count is set to ¡§0¡¨ in the association request frames - // WmeIe[8] |= (pAd->MlmeAux.APEdcaParm.EdcaUpdateCount & 0x0f); + /* The Parameter Set Count is set to ¡§0¡¨ in the association request frames */ + /* WmeIe[8] |= (pAd->MlmeAux.APEdcaParm.EdcaUpdateCount & 0x0f); */ } MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, 9, &WmeIe[0], END_OF_ARGS); FrameLen += tmp; } - // - // Let WPA(#221) Element ID on the end of this association frame. - // Otherwise some AP will fail on parsing Element ID and set status fail on Assoc Rsp. - // For example: Put Vendor Specific IE on the front of WPA IE. - // This happens on AP (Model No:Linksys WRK54G) - // + /* */ + /* Let WPA(#221) Element ID on the end of this association frame. */ + /* Otherwise some AP will fail on parsing Element ID and set status fail on Assoc Rsp. */ + /* For example: Put Vendor Specific IE on the front of WPA IE. */ + /* This happens on AP (Model No:Linksys WRK54G) */ + /* */ if (((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || @@ -486,11 +486,11 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, BSS0); - // Check for WPA PMK cache list + /* Check for WPA PMK cache list */ if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) { INT idx; BOOLEAN FoundPMK = FALSE; - // Search chched PMKID, append it if existed + /* Search chched PMKID, append it if existed */ for (idx = 0; idx < PMKID_NO; idx++) { if (NdisEqualMemory (ApAddr, @@ -501,7 +501,7 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } if (FoundPMK) { - // Set PMK number + /* Set PMK number */ *(PUSHORT) & pAd->StaCfg.RSN_IE[pAd-> StaCfg. RSNIE_Len] @@ -538,7 +538,7 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) WPA_SUPPLICANT_ENABLE) || (pAd->StaCfg.bRSN_IE_FromWpaSupplicant == FALSE)) { - // Append Variable IE + /* Append Variable IE */ NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &RSNIe, 1); VarIesOffset += 1; @@ -552,7 +552,7 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->StaCfg.RSNIE_Len); VarIesOffset += pAd->StaCfg.RSNIE_Len; - // Set Variable IEs Length + /* Set Variable IEs Length */ pAd->StaCfg.ReqVarIELen = VarIesOffset; } @@ -605,7 +605,7 @@ VOID MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) PUCHAR pOutBuffer = NULL; USHORT Status; - // Block all authentication request durning WPA block period + /* Block all authentication request durning WPA block period */ if (pAd->StaCfg.bBlockAssoc == TRUE) { DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - Block ReAssoc request durning WPA block period!\n")); @@ -614,13 +614,13 @@ VOID MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, &Status); } - // the parameters are the same as the association + /* the parameters are the same as the association */ else if (MlmeAssocReqSanity (pAd, Elem->Msg, Elem->MsgLen, ApAddr, &CapabilityInfo, &Timeout, &ListenIntv)) { RTMPCancelTimer(&pAd->MlmeAux.ReassocTimer, &TimerCancelled); - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - MlmeReassocReqAction() allocate memory failed \n")); @@ -633,7 +633,7 @@ VOID MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) COPY_MAC_ADDR(pAd->MlmeAux.Bssid, ApAddr); - // make frame, use bssid as the AP address?? + /* make frame, use bssid as the AP address?? */ DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - Send RE-ASSOC request...\n")); MgtMacHeaderInit(pAd, &ReassocHdr, SUBTYPE_REASSOC_REQ, 0, @@ -676,7 +676,7 @@ VOID MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) 9, &WmeIe[0], END_OF_ARGS); FrameLen += tmp; } - // HT + /* HT */ if ((pAd->MlmeAux.HtCapabilityLen > 0) && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) { ULONG TmpLen; @@ -700,14 +700,14 @@ VOID MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } FrameLen += TmpLen; } - // add Ralink proprietary IE to inform AP this STA is going to use AGGREGATION or PIGGY-BACK+AGGREGATION - // Case I: (Aggregation + Piggy-Back) - // 1. user enable aggregation, AND - // 2. Mac support piggy-back - // 3. AP annouces it's PIGGY-BACK+AGGREGATION-capable in BEACON - // Case II: (Aggregation) - // 1. user enable aggregation, AND - // 2. AP annouces it's AGGREGATION-capable in BEACON + /* add Ralink proprietary IE to inform AP this STA is going to use AGGREGATION or PIGGY-BACK+AGGREGATION */ + /* Case I: (Aggregation + Piggy-Back) */ + /* 1. user enable aggregation, AND */ + /* 2. Mac support piggy-back */ + /* 3. AP annouces it's PIGGY-BACK+AGGREGATION-capable in BEACON */ + /* Case II: (Aggregation) */ + /* 1. user enable aggregation, AND */ + /* 2. AP annouces it's AGGREGATION-capable in BEACON */ if (pAd->CommonCfg.bAggregationCapable) { if ((pAd->CommonCfg.bPiggyBackCapable) && ((pAd->MlmeAux.APRalinkIe & 0x00000003) == 3)) { @@ -777,10 +777,10 @@ VOID MlmeDisassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ULONG Timeout = 500; USHORT Status; - // skip sanity check + /* skip sanity check */ pDisassocReq = (PMLME_DISASSOC_REQ_STRUCT) (Elem->Msg); - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - MlmeDisassocReqAction() allocate memory failed\n")); @@ -799,15 +799,15 @@ VOID MlmeDisassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pDisassocReq->Addr[2], pDisassocReq->Addr[3], pDisassocReq->Addr[4], pDisassocReq->Addr[5], pDisassocReq->Reason)); - MgtMacHeaderInit(pAd, &DisassocHdr, SUBTYPE_DISASSOC, 0, pDisassocReq->Addr, pDisassocReq->Addr); // patch peap ttls switching issue + MgtMacHeaderInit(pAd, &DisassocHdr, SUBTYPE_DISASSOC, 0, pDisassocReq->Addr, pDisassocReq->Addr); /* patch peap ttls switching issue */ MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(HEADER_802_11), &DisassocHdr, 2, &pDisassocReq->Reason, END_OF_ARGS); MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - // To patch Instance and Buffalo(N) AP - // Driver has to send deauth to Instance AP, but Buffalo(N) needs to send disassoc to reset Authenticator's state machine - // Therefore, we send both of them. + /* To patch Instance and Buffalo(N) AP */ + /* Driver has to send deauth to Instance AP, but Buffalo(N) needs to send disassoc to reset Authenticator's state machine */ + /* Therefore, we send both of them. */ pDisassocHdr = (PHEADER_802_11) pOutBuffer; pDisassocHdr->FC.SubType = SUBTYPE_DEAUTH; MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); @@ -845,7 +845,7 @@ VOID PeerAssocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) UCHAR CkipFlag; EDCA_PARM EdcaParm; HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE + ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ UCHAR HtCapabilityLen = 0; UCHAR AddHtInfoLen; UCHAR NewExtChannelOffset = 0xff; @@ -855,7 +855,7 @@ VOID PeerAssocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) &Aid, SupRate, &SupRateLen, ExtRate, &ExtRateLen, &HtCapability, &AddHtInfo, &HtCapabilityLen, &AddHtInfoLen, &NewExtChannelOffset, &EdcaParm, &CkipFlag)) { - // The frame is for me ? + /* The frame is for me ? */ if (MAC_ADDR_EQUAL(Addr2, pAd->MlmeAux.Bssid)) { DBGPRINT(RT_DEBUG_TRACE, ("PeerAssocRspAction():ASSOC - receive ASSOC_RSP to me (status=%d)\n", @@ -873,7 +873,7 @@ VOID PeerAssocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) UCHAR MaxSupportedRateIn500Kbps = 0; UCHAR idx; - // supported rates array may not be sorted. sort it and find the maximum rate + /* supported rates array may not be sorted. sort it and find the maximum rate */ for (idx = 0; idx < SupRateLen; idx++) { if (MaxSupportedRateIn500Kbps < (SupRate[idx] & 0x7f)) @@ -887,7 +887,7 @@ VOID PeerAssocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MaxSupportedRateIn500Kbps = ExtRate[idx] & 0x7f; } - // go to procedure listed on page 376 + /* go to procedure listed on page 376 */ AssocPostProc(pAd, Addr2, CapabilityInfo, Aid, SupRate, SupRateLen, ExtRate, ExtRateLen, &EdcaParm, @@ -936,7 +936,7 @@ VOID PeerReassocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) BOOLEAN TimerCancelled; EDCA_PARM EdcaParm; HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE + ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ UCHAR HtCapabilityLen; UCHAR AddHtInfoLen; UCHAR NewExtChannelOffset = 0xff; @@ -946,7 +946,7 @@ VOID PeerReassocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) &Aid, SupRate, &SupRateLen, ExtRate, &ExtRateLen, &HtCapability, &AddHtInfo, &HtCapabilityLen, &AddHtInfoLen, &NewExtChannelOffset, &EdcaParm, &CkipFlag)) { - if (MAC_ADDR_EQUAL(Addr2, pAd->MlmeAux.Bssid)) // The frame is for me ? + if (MAC_ADDR_EQUAL(Addr2, pAd->MlmeAux.Bssid)) /* The frame is for me ? */ { DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - receive REASSOC_RSP to me (status=%d)\n", @@ -955,7 +955,7 @@ VOID PeerReassocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) &TimerCancelled); if (Status == MLME_SUCCESS) { - // go to procedure listed on page 376 + /* go to procedure listed on page 376 */ AssocPostProc(pAd, Addr2, CapabilityInfo, Aid, SupRate, SupRateLen, ExtRate, ExtRateLen, &EdcaParm, @@ -972,7 +972,7 @@ VOID PeerReassocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } - // CkipFlag is no use for reassociate + /* CkipFlag is no use for reassociate */ pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, &Status); @@ -994,7 +994,7 @@ VOID PeerReassocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID AssocPostProc(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr2, IN USHORT CapabilityInfo, IN USHORT Aid, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN PEDCA_PARM pEdcaParm, IN HT_CAPABILITY_IE * pHtCapability, IN UCHAR HtCapabilityLen, IN ADD_HT_INFO_IE * pAddHtInfo) // AP might use this additional ht info IE +VOID AssocPostProc(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr2, IN USHORT CapabilityInfo, IN USHORT Aid, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN PEDCA_PARM pEdcaParm, IN HT_CAPABILITY_IE * pHtCapability, IN UCHAR HtCapabilityLen, IN ADD_HT_INFO_IE * pAddHtInfo) /* AP might use this additional ht info IE */ { ULONG Idx; @@ -1004,7 +1004,7 @@ VOID AssocPostProc(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr2, IN USHORT CapabilityI pAd->MlmeAux.CapabilityInfo = CapabilityInfo & SUPPORTED_CAPABILITY_INFO; - // Some HT AP might lost WMM IE. We add WMM ourselves. beacuase HT requires QoS on. + /* Some HT AP might lost WMM IE. We add WMM ourselves. beacuase HT requires QoS on. */ if ((HtCapabilityLen > 0) && (pEdcaParm->bValid == FALSE)) { pEdcaParm->bValid = TRUE; pEdcaParm->Aifsn[0] = 3; @@ -1031,12 +1031,12 @@ VOID AssocPostProc(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr2, IN USHORT CapabilityI NdisMoveMemory(&pAd->MlmeAux.APEdcaParm, pEdcaParm, sizeof(EDCA_PARM)); - // filter out un-supported rates + /* filter out un-supported rates */ pAd->MlmeAux.SupRateLen = SupRateLen; NdisMoveMemory(pAd->MlmeAux.SupRate, SupRate, SupRateLen); RTMPCheckRates(pAd, pAd->MlmeAux.SupRate, &pAd->MlmeAux.SupRateLen); - // filter out un-supported rates + /* filter out un-supported rates */ pAd->MlmeAux.ExtRateLen = ExtRateLen; NdisMoveMemory(pAd->MlmeAux.ExtRate, ExtRate, ExtRateLen); RTMPCheckRates(pAd, pAd->MlmeAux.ExtRate, &pAd->MlmeAux.ExtRateLen); @@ -1054,17 +1054,17 @@ VOID AssocPostProc(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr2, IN USHORT CapabilityI pAd->MacTab.Content[BSSID_WCID].MmpsMode, pAd->MacTab.Content[BSSID_WCID].AMsduSize)); - // Set New WPA information + /* Set New WPA information */ Idx = BssTableSearch(&pAd->ScanTab, pAddr2, pAd->MlmeAux.Channel); if (Idx == BSS_NOT_FOUND) { DBGPRINT_ERR(("ASSOC - Can't find BSS after receiving Assoc response\n")); } else { - // Init variable + /* Init variable */ pAd->MacTab.Content[BSSID_WCID].RSNIE_Len = 0; NdisZeroMemory(pAd->MacTab.Content[BSSID_WCID].RSN_IE, MAX_LEN_OF_RSNIE); - // Store appropriate RSN_IE for WPA SM negotiation later + /* Store appropriate RSN_IE for WPA SM negotiation later */ if ((pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) && (pAd->ScanTab.BssEntry[Idx].VarIELen != 0)) { PUCHAR pVIE; @@ -1073,14 +1073,14 @@ VOID AssocPostProc(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr2, IN USHORT CapabilityI pVIE = pAd->ScanTab.BssEntry[Idx].VarIEs; len = pAd->ScanTab.BssEntry[Idx].VarIELen; - //KH need to check again - // Don't allow to go to sleep mode if authmode is WPA-related. - //This can make Authentication process more smoothly. + /*KH need to check again */ + /* Don't allow to go to sleep mode if authmode is WPA-related. */ + /*This can make Authentication process more smoothly. */ RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); while (len > 0) { pEid = (PEID_STRUCT) pVIE; - // For WPA/WPAPSK + /* For WPA/WPAPSK */ if ((pEid->Eid == IE_WPA) && (NdisEqualMemory(pEid->Octet, WPA_OUI, 4)) @@ -1097,7 +1097,7 @@ VOID AssocPostProc(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr2, IN USHORT CapabilityI DBGPRINT(RT_DEBUG_TRACE, ("AssocPostProc===> Store RSN_IE for WPA SM negotiation \n")); } - // For WPA2/WPA2PSK + /* For WPA2/WPA2PSK */ else if ((pEid->Eid == IE_RSN) && (NdisEqualMemory @@ -1292,21 +1292,21 @@ VOID Cls3errAction(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr) NDIS_STATUS NStatus; USHORT Reason = REASON_CLS3ERR; - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) return; DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - Class 3 Error, Send DISASSOC frame\n")); - MgtMacHeaderInit(pAd, &DisassocHdr, SUBTYPE_DISASSOC, 0, pAddr, pAd->CommonCfg.Bssid); // patch peap ttls switching issue + MgtMacHeaderInit(pAd, &DisassocHdr, SUBTYPE_DISASSOC, 0, pAddr, pAd->CommonCfg.Bssid); /* patch peap ttls switching issue */ MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(HEADER_802_11), &DisassocHdr, 2, &Reason, END_OF_ARGS); MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); - // To patch Instance and Buffalo(N) AP - // Driver has to send deauth to Instance AP, but Buffalo(N) needs to send disassoc to reset Authenticator's state machine - // Therefore, we send both of them. + /* To patch Instance and Buffalo(N) AP */ + /* Driver has to send deauth to Instance AP, but Buffalo(N) needs to send disassoc to reset Authenticator's state machine */ + /* Therefore, we send both of them. */ pDisassocHdr = (PHEADER_802_11) pOutBuffer; pDisassocHdr->FC.SubType = SUBTYPE_DEAUTH; MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); @@ -1393,7 +1393,7 @@ BOOLEAN StaAddMacTableEntry(IN PRTMP_ADAPTER pAd, && (MaxSupportedRate < RATE_FIRST_OFDM_RATE)) return FALSE; - // 11n only + /* 11n only */ if (((pAd->CommonCfg.PhyMode == PHY_11N_2_4G) || (pAd->CommonCfg.PhyMode == PHY_11N_5G)) && (HtCapabilityLen == 0)) @@ -1445,10 +1445,10 @@ BOOLEAN StaAddMacTableEntry(IN PRTMP_ADAPTER pAd, } NdisZeroMemory(&pEntry->HTCapability, sizeof(pEntry->HTCapability)); - // If this Entry supports 802.11n, upgrade to HT rate. + /* If this Entry supports 802.11n, upgrade to HT rate. */ if ((HtCapabilityLen != 0) && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) { - UCHAR j, bitmask; //k,bitmask; + UCHAR j, bitmask; /*k,bitmask; */ CHAR i; if (ADHOC_ON(pAd)) @@ -1484,14 +1484,14 @@ BOOLEAN StaAddMacTableEntry(IN PRTMP_ADAPTER pAd, pAd->MacTab.fAnyStation20Only = TRUE; } - // 3*3 + /* 3*3 */ if (pAd->MACVersion >= RALINK_2883_VERSION && pAd->MACVersion < RALINK_3070_VERSION) pEntry->MaxHTPhyMode.field.TxBF = pAd->CommonCfg.RegTransmitSetting.field.TxBF; - // find max fixed rate - for (i = 23; i >= 0; i--) // 3*3 + /* find max fixed rate */ + for (i = 23; i >= 0; i--) /* 3*3 */ { j = i / 8; bitmask = (1 << (i - (j * 8))); @@ -1506,7 +1506,7 @@ BOOLEAN StaAddMacTableEntry(IN PRTMP_ADAPTER pAd, if (pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) { if (pAd->StaCfg.DesiredTransmitSetting.field.MCS == 32) { - // Fix MCS as HT Duplicated Mode + /* Fix MCS as HT Duplicated Mode */ pEntry->MaxHTPhyMode.field.BW = 1; pEntry->MaxHTPhyMode.field.MODE = MODE_HTMIX; pEntry->MaxHTPhyMode.field.STBC = 0; @@ -1514,7 +1514,7 @@ BOOLEAN StaAddMacTableEntry(IN PRTMP_ADAPTER pAd, pEntry->MaxHTPhyMode.field.MCS = 32; } else if (pEntry->MaxHTPhyMode.field.MCS > pAd->StaCfg.HTPhyMode.field.MCS) { - // STA supports fixed MCS + /* STA supports fixed MCS */ pEntry->MaxHTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; } @@ -1565,7 +1565,7 @@ BOOLEAN StaAddMacTableEntry(IN PRTMP_ADAPTER pAd, pEntry->HTPhyMode.word = pEntry->MaxHTPhyMode.word; pEntry->CurrTxRate = pEntry->MaxSupportedRate; - // Set asic auto fall back + /* Set asic auto fall back */ if (pAd->StaCfg.bAutoTxRateSwitch == TRUE) { PUCHAR pTable; UCHAR TableSize = 0; @@ -1578,7 +1578,7 @@ BOOLEAN StaAddMacTableEntry(IN PRTMP_ADAPTER pAd, pEntry->HTPhyMode.field.MCS = pAd->StaCfg.HTPhyMode.field.MCS; pEntry->bAutoTxRateSwitch = FALSE; - // If the legacy mode is set, overwrite the transmit setting of this entry. + /* If the legacy mode is set, overwrite the transmit setting of this entry. */ RTMPUpdateLegacyTxSetting((UCHAR) pAd->StaCfg. DesiredTransmitSetting.field. FixedTxMode, pEntry); diff --git a/drivers/staging/rt2860/sta/auth.c b/drivers/staging/rt2860/sta/auth.c index 8b75b4676e1a..a69b6a7f03e2 100644 --- a/drivers/staging/rt2860/sta/auth.c +++ b/drivers/staging/rt2860/sta/auth.c @@ -62,11 +62,11 @@ void AuthStateMachineInit(IN PRTMP_ADAPTER pAd, (STATE_MACHINE_FUNC) Drop, AUTH_REQ_IDLE, AUTH_MACHINE_BASE); - // the first column + /* the first column */ StateMachineSetAction(Sm, AUTH_REQ_IDLE, MT2_MLME_AUTH_REQ, (STATE_MACHINE_FUNC) MlmeAuthReqAction); - // the second column + /* the second column */ StateMachineSetAction(Sm, AUTH_WAIT_SEQ2, MT2_MLME_AUTH_REQ, (STATE_MACHINE_FUNC) InvalidStateWhenAuth); StateMachineSetAction(Sm, AUTH_WAIT_SEQ2, MT2_PEER_AUTH_EVEN, @@ -74,7 +74,7 @@ void AuthStateMachineInit(IN PRTMP_ADAPTER pAd, StateMachineSetAction(Sm, AUTH_WAIT_SEQ2, MT2_AUTH_TIMEOUT, (STATE_MACHINE_FUNC) AuthTimeoutAction); - // the third column + /* the third column */ StateMachineSetAction(Sm, AUTH_WAIT_SEQ4, MT2_MLME_AUTH_REQ, (STATE_MACHINE_FUNC) InvalidStateWhenAuth); StateMachineSetAction(Sm, AUTH_WAIT_SEQ4, MT2_PEER_AUTH_EVEN, @@ -103,13 +103,13 @@ VOID AuthTimeout(IN PVOID SystemSpecific1, DBGPRINT(RT_DEBUG_TRACE, ("AUTH - AuthTimeout\n")); - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt + /* Do nothing if the driver is starting halt state. */ + /* This might happen when timer already been fired before cancel timer with mlmehalt */ if (RTMP_TEST_FLAG (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; - // send a de-auth to reset AP's state machine (Patch AP-Dir635) + /* send a de-auth to reset AP's state machine (Patch AP-Dir635) */ if (pAd->Mlme.AuthMachine.CurrState == AUTH_WAIT_SEQ2) Cls2errAction(pAd, pAd->MlmeAux.Bssid); @@ -173,7 +173,7 @@ VOID PeerAuthRspAtSeq2Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) &TimerCancelled); if (Status == MLME_SUCCESS) { - // Authentication Mode "LEAP" has allow for CCX 1.X + /* Authentication Mode "LEAP" has allow for CCX 1.X */ if (pAd->MlmeAux.Alg == Ndis802_11AuthModeOpen) { pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; @@ -181,11 +181,11 @@ VOID PeerAuthRspAtSeq2Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status); } else { - // 2. shared key, need to be challenged + /* 2. shared key, need to be challenged */ Seq++; RemoteStatus = MLME_SUCCESS; - // Get an unused nonpaged memory + /* Get an unused nonpaged memory */ NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); @@ -208,7 +208,7 @@ VOID PeerAuthRspAtSeq2Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) SUBTYPE_AUTH, 0, Addr2, pAd->MlmeAux.Bssid); AuthHdr.FC.Wep = 1; - // Encrypt challenge text & auth information + /* Encrypt challenge text & auth information */ RTMPInitWepEngine(pAd, pAd-> SharedKey[BSS0][pAd-> @@ -332,7 +332,7 @@ VOID MlmeDeauthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pInfo = (MLME_DEAUTH_REQ_STRUCT *) Elem->Msg; - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("AUTH - MlmeDeauthReqAction() allocate memory fail\n")); @@ -359,7 +359,7 @@ VOID MlmeDeauthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Status = MLME_SUCCESS; MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DEAUTH_CONF, 2, &Status); - // send wireless event - for deauthentication + /* send wireless event - for deauthentication */ if (pAd->CommonCfg.bWirelessEvent) RTMPSendWirelessEvent(pAd, IW_DEAUTH_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, @@ -422,7 +422,7 @@ VOID Cls2errAction(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr) ULONG FrameLen = 0; USHORT Reason = REASON_CLS2ERR; - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) return; @@ -455,7 +455,7 @@ BOOLEAN AUTH_ReqSend(IN PRTMP_ADAPTER pAd, PUCHAR pOutBuffer = NULL; ULONG FrameLen = 0, tmp = 0; - // Block all authentication request durning WPA block period + /* Block all authentication request durning WPA block period */ if (pAd->StaCfg.bBlockAssoc == TRUE) { DBGPRINT(RT_DEBUG_TRACE, ("%s - Block Auth request durning WPA block period!\n", @@ -475,7 +475,7 @@ BOOLEAN AUTH_ReqSend(IN PRTMP_ADAPTER pAd, Seq = SeqNo; Status = MLME_SUCCESS; - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("%s - MlmeAuthReqAction(Alg:%d) allocate memory failed\n", diff --git a/drivers/staging/rt2860/sta/auth_rsp.c b/drivers/staging/rt2860/sta/auth_rsp.c index 3f383c519bbe..e3c07a466ed1 100644 --- a/drivers/staging/rt2860/sta/auth_rsp.c +++ b/drivers/staging/rt2860/sta/auth_rsp.c @@ -55,11 +55,11 @@ VOID AuthRspStateMachineInit(IN PRTMP_ADAPTER pAd, (STATE_MACHINE_FUNC) Drop, AUTH_RSP_IDLE, AUTH_RSP_MACHINE_BASE); - // column 1 + /* column 1 */ StateMachineSetAction(Sm, AUTH_RSP_IDLE, MT2_PEER_DEAUTH, (STATE_MACHINE_FUNC) PeerDeauthAction); - // column 2 + /* column 2 */ StateMachineSetAction(Sm, AUTH_RSP_WAIT_CHAL, MT2_PEER_DEAUTH, (STATE_MACHINE_FUNC) PeerDeauthAction); @@ -88,7 +88,7 @@ VOID PeerAuthSimpleRspGenAndSend(IN PRTMP_ADAPTER pAd, DBGPRINT(RT_DEBUG_TRACE, ("Peer AUTH fail...\n")); return; } - //Get an unused nonpaged memory + /*Get an unused nonpaged memory */ NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); if (NStatus != NDIS_STATUS_SUCCESS) return; @@ -126,7 +126,7 @@ VOID PeerDeauthAction(IN PRTMP_ADAPTER pAd, IN PMLME_QUEUE_ELEM Elem) RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0); - // send wireless event - for deauthentication + /* send wireless event - for deauthentication */ if (pAd->CommonCfg.bWirelessEvent) RTMPSendWirelessEvent(pAd, IW_DEAUTH_EVENT_FLAG, pAd->MacTab. diff --git a/drivers/staging/rt2860/sta/connect.c b/drivers/staging/rt2860/sta/connect.c index dc8b2d54a9fe..29906be51e58 100644 --- a/drivers/staging/rt2860/sta/connect.c +++ b/drivers/staging/rt2860/sta/connect.c @@ -37,35 +37,35 @@ #include "../rt_config.h" UCHAR CipherSuiteWpaNoneTkip[] = { - 0x00, 0x50, 0xf2, 0x01, // oui - 0x01, 0x00, // Version - 0x00, 0x50, 0xf2, 0x02, // Multicast - 0x01, 0x00, // Number of unicast - 0x00, 0x50, 0xf2, 0x02, // unicast - 0x01, 0x00, // number of authentication method - 0x00, 0x50, 0xf2, 0x00 // authentication + 0x00, 0x50, 0xf2, 0x01, /* oui */ + 0x01, 0x00, /* Version */ + 0x00, 0x50, 0xf2, 0x02, /* Multicast */ + 0x01, 0x00, /* Number of unicast */ + 0x00, 0x50, 0xf2, 0x02, /* unicast */ + 0x01, 0x00, /* number of authentication method */ + 0x00, 0x50, 0xf2, 0x00 /* authentication */ }; UCHAR CipherSuiteWpaNoneTkipLen = (sizeof(CipherSuiteWpaNoneTkip) / sizeof(UCHAR)); UCHAR CipherSuiteWpaNoneAes[] = { - 0x00, 0x50, 0xf2, 0x01, // oui - 0x01, 0x00, // Version - 0x00, 0x50, 0xf2, 0x04, // Multicast - 0x01, 0x00, // Number of unicast - 0x00, 0x50, 0xf2, 0x04, // unicast - 0x01, 0x00, // number of authentication method - 0x00, 0x50, 0xf2, 0x00 // authentication + 0x00, 0x50, 0xf2, 0x01, /* oui */ + 0x01, 0x00, /* Version */ + 0x00, 0x50, 0xf2, 0x04, /* Multicast */ + 0x01, 0x00, /* Number of unicast */ + 0x00, 0x50, 0xf2, 0x04, /* unicast */ + 0x01, 0x00, /* number of authentication method */ + 0x00, 0x50, 0xf2, 0x00 /* authentication */ }; UCHAR CipherSuiteWpaNoneAesLen = (sizeof(CipherSuiteWpaNoneAes) / sizeof(UCHAR)); -// The following MACRO is called after 1. starting an new IBSS, 2. succesfully JOIN an IBSS, -// or 3. succesfully ASSOCIATE to a BSS, 4. successfully RE_ASSOCIATE to a BSS -// All settings successfuly negotiated furing MLME state machines become final settings -// and are copied to pAd->StaActive +/* The following MACRO is called after 1. starting an new IBSS, 2. succesfully JOIN an IBSS, */ +/* or 3. succesfully ASSOCIATE to a BSS, 4. successfully RE_ASSOCIATE to a BSS */ +/* All settings successfuly negotiated furing MLME state machines become final settings */ +/* and are copied to pAd->StaActive */ #define COPY_SETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(_pAd) \ { \ NdisZeroMemory((_pAd)->CommonCfg.Ssid, MAX_LEN_OF_SSID); \ @@ -105,8 +105,8 @@ UCHAR CipherSuiteWpaNoneAesLen = VOID MlmeCntlInit(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * S, OUT STATE_MACHINE_FUNC Trans[]) { - // Control state machine differs from other state machines, the interface - // follows the standard interface + /* Control state machine differs from other state machines, the interface */ + /* follows the standard interface */ pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; } @@ -133,12 +133,12 @@ VOID MlmeCntlMachinePerformAction(IN PRTMP_ADAPTER pAd, CntlWaitJoinProc(pAd, Elem); break; - // CNTL_WAIT_REASSOC is the only state in CNTL machine that does - // not triggered directly or indirectly by "RTMPSetInformation(OID_xxx)". - // Therefore not protected by NDIS's "only one outstanding OID request" - // rule. Which means NDIS may SET OID in the middle of ROAMing attempts. - // Current approach is to block new SET request at RTMPSetInformation() - // when CntlMachine.CurrState is not CNTL_IDLE + /* CNTL_WAIT_REASSOC is the only state in CNTL machine that does */ + /* not triggered directly or indirectly by "RTMPSetInformation(OID_xxx)". */ + /* Therefore not protected by NDIS's "only one outstanding OID request" */ + /* rule. Which means NDIS may SET OID in the middle of ROAMing attempts. */ + /* Current approach is to block new SET request at RTMPSetInformation() */ + /* when CntlMachine.CurrState is not CNTL_IDLE */ case CNTL_WAIT_REASSOC: CntlWaitReassocProc(pAd, Elem); break; @@ -158,15 +158,15 @@ VOID MlmeCntlMachinePerformAction(IN PRTMP_ADAPTER pAd, case CNTL_WAIT_OID_LIST_SCAN: if (Elem->MsgType == MT2_SCAN_CONF) { - // Resume TxRing after SCANING complete. We hope the out-of-service time - // won't be too long to let upper layer time-out the waiting frames + /* Resume TxRing after SCANING complete. We hope the out-of-service time */ + /* won't be too long to let upper layer time-out the waiting frames */ RTMPResumeMsduTransmission(pAd); pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - // - // Set LED status to previous status. - // + /* */ + /* Set LED status to previous status. */ + /* */ if (pAd->bLedOnScanning) { pAd->bLedOnScanning = FALSE; RTMPSetLED(pAd, pAd->LedStatus); @@ -181,28 +181,28 @@ VOID MlmeCntlMachinePerformAction(IN PRTMP_ADAPTER pAd, } break; #ifdef RTMP_MAC_USB - // - // This state is for that we want to connect to an AP but - // it didn't find on BSS List table. So we need to scan the air first, - // after that we can try to connect to the desired AP if available. - // + /* */ + /* This state is for that we want to connect to an AP but */ + /* it didn't find on BSS List table. So we need to scan the air first, */ + /* after that we can try to connect to the desired AP if available. */ + /* */ case CNTL_WAIT_SCAN_FOR_CONNECT: if (Elem->MsgType == MT2_SCAN_CONF) { - // Resume TxRing after SCANING complete. We hope the out-of-service time - // won't be too long to let upper layer time-out the waiting frames + /* Resume TxRing after SCANING complete. We hope the out-of-service time */ + /* won't be too long to let upper layer time-out the waiting frames */ RTMPResumeMsduTransmission(pAd); #ifdef CCX_SUPPORT if (pAd->StaCfg.CCXReqType != MSRN_TYPE_UNUSED) { - // Cisco scan request is finished, prepare beacon report + /* Cisco scan request is finished, prepare beacon report */ MlmeEnqueue(pAd, AIRONET_STATE_MACHINE, MT2_AIRONET_SCAN_DONE, 0, NULL); } -#endif // CCX_SUPPORT // +#endif /* CCX_SUPPORT // */ pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - // - // Check if we can connect to. - // + /* */ + /* Check if we can connect to. */ + /* */ BssTableSsidSort(pAd, &pAd->MlmeAux.SsidBssTab, (CHAR *) pAd->MlmeAux. AutoReconnectSsid, @@ -212,7 +212,7 @@ VOID MlmeCntlMachinePerformAction(IN PRTMP_ADAPTER pAd, } } break; -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ default: DBGPRINT_ERR(("!ERROR! CNTL - Illegal message type(=%ld)", Elem->MsgType)); @@ -257,8 +257,8 @@ VOID CntlIdleProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if (pAd->StaCfg.WpaSupplicantUP != WPA_SUPPLICANT_ENABLE_WITH_WEB_UI) { - // Set the AutoReconnectSsid to prevent it reconnect to old SSID - // Since calling this indicate user don't want to connect to that SSID anymore. + /* Set the AutoReconnectSsid to prevent it reconnect to old SSID */ + /* Since calling this indicate user don't want to connect to that SSID anymore. */ pAd->MlmeAux.AutoReconnectSsidLen = 32; NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen); @@ -287,8 +287,8 @@ VOID CntlOidScanProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ULONG BssIdx = BSS_NOT_FOUND; BSS_ENTRY CurrBss; - // record current BSS if network is connected. - // 2003-2-13 do not include current IBSS if this is the only STA in this IBSS. + /* record current BSS if network is connected. */ + /* 2003-2-13 do not include current IBSS if this is the only STA in this IBSS. */ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) { BssIdx = BssSsidTableSearch(&pAd->ScanTab, pAd->CommonCfg.Bssid, @@ -300,14 +300,14 @@ VOID CntlOidScanProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) sizeof(BSS_ENTRY)); } } - // clean up previous SCAN result, add current BSS back to table if any + /* clean up previous SCAN result, add current BSS back to table if any */ BssTableInit(&pAd->ScanTab); if (BssIdx != BSS_NOT_FOUND) { - // DDK Note: If the NIC is associated with a particular BSSID and SSID - // that are not contained in the list of BSSIDs generated by this scan, the - // BSSID description of the currently associated BSSID and SSID should be - // appended to the list of BSSIDs in the NIC's database. - // To ensure this, we append this BSS as the first entry in SCAN result + /* DDK Note: If the NIC is associated with a particular BSSID and SSID */ + /* that are not contained in the list of BSSIDs generated by this scan, the */ + /* BSSID description of the currently associated BSSID and SSID should be */ + /* appended to the list of BSSIDs in the NIC's database. */ + /* To ensure this, we append this BSS as the first entry in SCAN result */ NdisMoveMemory(&pAd->ScanTab.BssEntry[0], &CurrBss, sizeof(BSS_ENTRY)); pAd->ScanTab.BssNr = 1; @@ -335,7 +335,7 @@ VOID CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MLME_DISASSOC_REQ_STRUCT DisassocReq; ULONG Now; - // Step 1. record the desired user settings to MlmeAux + /* Step 1. record the desired user settings to MlmeAux */ NdisZeroMemory(pAd->MlmeAux.Ssid, MAX_LEN_OF_SSID); NdisMoveMemory(pAd->MlmeAux.Ssid, pOidSsid->Ssid, pOidSsid->SsidLength); pAd->MlmeAux.SsidLen = (UCHAR) pOidSsid->SsidLength; @@ -344,16 +344,16 @@ VOID CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->StaCfg.bAutoConnectByBssid = FALSE; - // - // Update Reconnect Ssid, that user desired to connect. - // + /* */ + /* Update Reconnect Ssid, that user desired to connect. */ + /* */ NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, MAX_LEN_OF_SSID); NdisMoveMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); pAd->MlmeAux.AutoReconnectSsidLen = pAd->MlmeAux.SsidLen; - // step 2. find all matching BSS in the lastest SCAN result (inBssTab) - // & log them into MlmeAux.SsidBssTab for later-on iteration. Sort by RSSI order + /* step 2. find all matching BSS in the lastest SCAN result (inBssTab) */ + /* & log them into MlmeAux.SsidBssTab for later-on iteration. Sort by RSSI order */ BssTableSsidSort(pAd, &pAd->MlmeAux.SsidBssTab, (PCHAR) pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); @@ -371,18 +371,18 @@ VOID CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->CommonCfg.SsidLen) && MAC_ADDR_EQUAL(pAd->CommonCfg.Bssid, pAd->MlmeAux.SsidBssTab.BssEntry[0].Bssid)) { - // Case 1. already connected with an AP who has the desired SSID - // with highest RSSI + /* Case 1. already connected with an AP who has the desired SSID */ + /* with highest RSSI */ - // Add checking Mode "LEAP" for CCX 1.0 + /* Add checking Mode "LEAP" for CCX 1.0 */ if (((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) ) && (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED)) { - // case 1.1 For WPA, WPA-PSK, if the 1x port is not secured, we have to redo - // connection process + /* case 1.1 For WPA, WPA-PSK, if the 1x port is not secured, we have to redo */ + /* connection process */ DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - disassociate with current AP...\n")); DisassocParmFill(pAd, &DisassocReq, @@ -394,7 +394,7 @@ VOID CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) &DisassocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; } else if (pAd->bConfigChanged == TRUE) { - // case 1.2 Important Config has changed, we have to reconnect to the same AP + /* case 1.2 Important Config has changed, we have to reconnect to the same AP */ DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - disassociate with current AP Because config changed...\n")); DisassocParmFill(pAd, &DisassocReq, @@ -406,22 +406,22 @@ VOID CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) &DisassocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; } else { - // case 1.3. already connected to the SSID with highest RSSI. + /* case 1.3. already connected to the SSID with highest RSSI. */ DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - already with this BSSID. ignore this SET_SSID request\n")); - // - // (HCT 12.1) 1c_wlan_mediaevents required - // media connect events are indicated when associating with the same AP - // + /* */ + /* (HCT 12.1) 1c_wlan_mediaevents required */ + /* media connect events are indicated when associating with the same AP */ + /* */ if (INFRA_ON(pAd)) { - // - // Since MediaState already is NdisMediaStateConnected - // We just indicate the connect event again to meet the WHQL required. - // + /* */ + /* Since MediaState already is NdisMediaStateConnected */ + /* We just indicate the connect event again to meet the WHQL required. */ + /* */ pAd->IndicateMediaState = NdisMediaStateConnected; RTMP_IndicateMediaState(pAd); - pAd->ExtraInfo = GENERAL_LINK_UP; // Update extra information to link is up + pAd->ExtraInfo = GENERAL_LINK_UP; /* Update extra information to link is up */ } pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; @@ -430,26 +430,26 @@ VOID CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) 0); } } else if (INFRA_ON(pAd)) { - // - // For RT61 - // [88888] OID_802_11_SSID should have returned NDTEST_WEP_AP2(Returned: ) - // RT61 may lost SSID, and not connect to NDTEST_WEP_AP2 and will connect to NDTEST_WEP_AP2 by Autoreconnect - // But media status is connected, so the SSID not report correctly. - // + /* */ + /* For RT61 */ + /* [88888] OID_802_11_SSID should have returned NDTEST_WEP_AP2(Returned: ) */ + /* RT61 may lost SSID, and not connect to NDTEST_WEP_AP2 and will connect to NDTEST_WEP_AP2 by Autoreconnect */ + /* But media status is connected, so the SSID not report correctly. */ + /* */ if (!SSID_EQUAL (pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen, pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen)) { - // - // Different SSID means not Roaming case, so we let LinkDown() to Indicate a disconnect event. - // + /* */ + /* Different SSID means not Roaming case, so we let LinkDown() to Indicate a disconnect event. */ + /* */ pAd->MlmeAux.CurrReqIsFromNdis = TRUE; } - // case 2. active INFRA association existent - // roaming is done within miniport driver, nothing to do with configuration - // utility. so upon a new SET(OID_802_11_SSID) is received, we just - // disassociate with the current associated AP, - // then perform a new association with this new SSID, no matter the - // new/old SSID are the same or not. + /* case 2. active INFRA association existent */ + /* roaming is done within miniport driver, nothing to do with configuration */ + /* utility. so upon a new SET(OID_802_11_SSID) is received, we just */ + /* disassociate with the current associated AP, */ + /* then perform a new association with this new SSID, no matter the */ + /* new/old SSID are the same or not. */ DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - disassociate with current AP...\n")); DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, @@ -488,7 +488,7 @@ VOID CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; - // Reset Missed scan number + /* Reset Missed scan number */ pAd->StaCfg.LastScanTime = Now; } else { pAd->MlmeAux.BssIdx = 0; @@ -512,18 +512,18 @@ VOID CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MLME_DISASSOC_REQ_STRUCT DisassocReq; MLME_JOIN_REQ_STRUCT JoinReq; - // record user desired settings + /* record user desired settings */ COPY_MAC_ADDR(pAd->MlmeAux.Bssid, pOidBssid); pAd->MlmeAux.BssType = pAd->StaCfg.BssType; - // find the desired BSS in the latest SCAN result table + /* find the desired BSS in the latest SCAN result table */ BssIdx = BssTableSearch(&pAd->ScanTab, pOidBssid, pAd->MlmeAux.Channel); if (BssIdx == BSS_NOT_FOUND) { MLME_SCAN_REQ_STRUCT ScanReq; DBGPRINT(RT_DEBUG_TRACE, ("CNTL - BSSID not found. reply NDIS_STATUS_NOT_ACCEPTED\n")); - //pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; + /*pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; */ DBGPRINT(RT_DEBUG_TRACE, ("CNTL - BSSID not found. start a new scan\n")); @@ -532,13 +532,13 @@ VOID CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; - // Reset Missed scan number + /* Reset Missed scan number */ NdisGetSystemUpTime(&pAd->StaCfg.LastScanTime); return; } - // - // Update Reconnect Ssid, that user desired to connect. - // + /* */ + /* Update Reconnect Ssid, that user desired to connect. */ + /* */ NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, MAX_LEN_OF_SSID); pAd->MlmeAux.AutoReconnectSsidLen = pAd->ScanTab.BssEntry[BssIdx].SsidLen; @@ -546,21 +546,21 @@ VOID CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->ScanTab.BssEntry[BssIdx].Ssid, pAd->ScanTab.BssEntry[BssIdx].SsidLen); - // copy the matched BSS entry from ScanTab to MlmeAux.SsidBssTab. Why? - // Because we need this entry to become the JOIN target in later on SYNC state machine + /* copy the matched BSS entry from ScanTab to MlmeAux.SsidBssTab. Why? */ + /* Because we need this entry to become the JOIN target in later on SYNC state machine */ pAd->MlmeAux.BssIdx = 0; pAd->MlmeAux.SsidBssTab.BssNr = 1; NdisMoveMemory(&pAd->MlmeAux.SsidBssTab.BssEntry[0], &pAd->ScanTab.BssEntry[BssIdx], sizeof(BSS_ENTRY)); - // Add SSID into MlmeAux for site surey joining hidden SSID + /* Add SSID into MlmeAux for site surey joining hidden SSID */ pAd->MlmeAux.SsidLen = pAd->ScanTab.BssEntry[BssIdx].SsidLen; NdisMoveMemory(pAd->MlmeAux.Ssid, pAd->ScanTab.BssEntry[BssIdx].Ssid, pAd->MlmeAux.SsidLen); { if (INFRA_ON(pAd)) { - // disassoc from current AP first + /* disassoc from current AP first */ DBGPRINT(RT_DEBUG_TRACE, ("CNTL - disassociate with current AP ...\n")); DisassocParmFill(pAd, &DisassocReq, @@ -586,14 +586,14 @@ VOID CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_DISCONNECT Event C!\n")); } - // Change the wepstatus to original wepstatus + /* Change the wepstatus to original wepstatus */ pAd->StaCfg.WepStatus = pAd->StaCfg.OrigWepStatus; pAd->StaCfg.PairCipher = pAd->StaCfg.OrigWepStatus; pAd->StaCfg.GroupCipher = pAd->StaCfg.OrigWepStatus; - // Check cipher suite, AP must have more secured cipher than station setting - // Set the Pairwise and Group cipher to match the intended AP setting - // We can only connect to AP with less secured cipher setting + /* Check cipher suite, AP must have more secured cipher than station setting */ + /* Set the Pairwise and Group cipher to match the intended AP setting */ + /* We can only connect to AP with less secured cipher setting */ if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) { @@ -612,7 +612,7 @@ VOID CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->StaCfg.PairCipher = pAd->ScanTab.BssEntry[BssIdx].WPA. PairCipherAux; - else // There is no PairCipher Aux, downgrade our capability to TKIP + else /* There is no PairCipher Aux, downgrade our capability to TKIP */ pAd->StaCfg.PairCipher = Ndis802_11Encryption2Enabled; } else @@ -634,16 +634,16 @@ VOID CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->StaCfg.PairCipher = pAd->ScanTab.BssEntry[BssIdx].WPA2. PairCipherAux; - else // There is no PairCipher Aux, downgrade our capability to TKIP + else /* There is no PairCipher Aux, downgrade our capability to TKIP */ pAd->StaCfg.PairCipher = Ndis802_11Encryption2Enabled; - // RSN capability + /* RSN capability */ pAd->StaCfg.RsnCapability = pAd->ScanTab.BssEntry[BssIdx].WPA2. RsnCapability; } - // Set Mix cipher flag + /* Set Mix cipher flag */ pAd->StaCfg.bMixCipher = (pAd->StaCfg.PairCipher == pAd->StaCfg.GroupCipher) ? FALSE : TRUE; @@ -652,7 +652,7 @@ VOID CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) // If mix cipher, re-build RSNIE RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, 0); } */ - // No active association, join the BSS immediately + /* No active association, join the BSS immediately */ DBGPRINT(RT_DEBUG_TRACE, ("CNTL - joining %02x:%02x:%02x:%02x:%02x:%02x ...\n", pOidBssid[0], pOidBssid[1], pOidBssid[2], @@ -667,14 +667,14 @@ VOID CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } -// Roaming is the only external request triggering CNTL state machine -// despite of other "SET OID" operation. All "SET OID" related oerations -// happen in sequence, because no other SET OID will be sent to this device -// until the the previous SET operation is complete (successful o failed). -// So, how do we quarantee this ROAMING request won't corrupt other "SET OID"? -// or been corrupted by other "SET OID"? -// -// IRQL = DISPATCH_LEVEL +/* Roaming is the only external request triggering CNTL state machine */ +/* despite of other "SET OID" operation. All "SET OID" related oerations */ +/* happen in sequence, because no other SET OID will be sent to this device */ +/* until the the previous SET operation is complete (successful o failed). */ +/* So, how do we quarantee this ROAMING request won't corrupt other "SET OID"? */ +/* or been corrupted by other "SET OID"? */ +/* */ +/* IRQL = DISPATCH_LEVEL */ VOID CntlMlmeRoamingProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { UCHAR BBPValue = 0; @@ -682,7 +682,7 @@ VOID CntlMlmeRoamingProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Roaming in MlmeAux.RoamTab...\n")); { - //Let BBP register at 20MHz to do (fast) roaming. + /*Let BBP register at 20MHz to do (fast) roaming. */ RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); BBPValue &= (~0x18); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); @@ -720,7 +720,7 @@ VOID CntlWaitDisassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) LinkDown(pAd, FALSE); - // case 1. no matching BSS, and user wants ADHOC, so we just start a new one + /* case 1. no matching BSS, and user wants ADHOC, so we just start a new one */ if ((pAd->MlmeAux.SsidBssTab.BssNr == 0) && (pAd->StaCfg.BssType == BSS_ADHOC)) { DBGPRINT(RT_DEBUG_TRACE, @@ -732,7 +732,7 @@ VOID CntlWaitDisassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) sizeof(MLME_START_REQ_STRUCT), &StartReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_START; } - // case 2. try each matched BSS + /* case 2. try each matched BSS */ else { pAd->MlmeAux.BssIdx = 0; @@ -757,12 +757,12 @@ VOID CntlWaitJoinProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if (Elem->MsgType == MT2_JOIN_CONF) { NdisMoveMemory(&Reason, Elem->Msg, sizeof(USHORT)); if (Reason == MLME_SUCCESS) { - // 1. joined an IBSS, we are pretty much done here + /* 1. joined an IBSS, we are pretty much done here */ if (pAd->MlmeAux.BssType == BSS_ADHOC) { - // - // 5G bands rules of Japan: - // Ad hoc must be disabled in W53(ch52,56,60,64) channels. - // + /* */ + /* 5G bands rules of Japan: */ + /* Ad hoc must be disabled in W53(ch52,56,60,64) channels. */ + /* */ if ((pAd->CommonCfg.bIEEE80211H == 1) && RadarChannelCheck(pAd, pAd->CommonCfg.Channel) @@ -790,10 +790,10 @@ VOID CntlWaitJoinProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) NdisMediaStateConnected; pAd->ExtraInfo = GENERAL_LINK_UP; } - // 2. joined a new INFRA network, start from authentication + /* 2. joined a new INFRA network, start from authentication */ else { { - // either Ndis802_11AuthModeShared or Ndis802_11AuthModeAutoSwitch, try shared key first + /* either Ndis802_11AuthModeShared or Ndis802_11AuthModeAutoSwitch, try shared key first */ if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeShared) || (pAd->StaCfg.AuthMode == @@ -817,7 +817,7 @@ VOID CntlWaitJoinProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) CNTL_WAIT_AUTH; } } else { - // 3. failed, try next BSS + /* 3. failed, try next BSS */ pAd->MlmeAux.BssIdx++; IterateOnBssTab(pAd); } @@ -839,10 +839,10 @@ VOID CntlWaitStartProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if (Elem->MsgType == MT2_START_CONF) { NdisMoveMemory(&Result, Elem->Msg, sizeof(USHORT)); if (Result == MLME_SUCCESS) { - // - // 5G bands rules of Japan: - // Ad hoc must be disabled in W53(ch52,56,60,64) channels. - // + /* */ + /* 5G bands rules of Japan: */ + /* Ad hoc must be disabled in W53(ch52,56,60,64) channels. */ + /* */ if ((pAd->CommonCfg.bIEEE80211H == 1) && RadarChannelCheck(pAd, pAd->CommonCfg.Channel) ) { @@ -892,7 +892,7 @@ VOID CntlWaitStartProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } LinkUp(pAd, BSS_ADHOC); pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; - // Before send beacon, driver need do radar detection + /* Before send beacon, driver need do radar detection */ if ((pAd->CommonCfg.Channel > 14) && (pAd->CommonCfg.bIEEE80211H == 1) && RadarChannelCheck(pAd, pAd->CommonCfg.Channel)) { @@ -950,9 +950,9 @@ VOID CntlWaitAuthProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) CNTL_WAIT_ASSOC; } } else { - // This fail may because of the AP already keep us in its MAC table without - // ageing-out. The previous authentication attempt must have let it remove us. - // so try Authentication again may help. For D-Link DWL-900AP+ compatibility. + /* This fail may because of the AP already keep us in its MAC table without */ + /* ageing-out. The previous authentication attempt must have let it remove us. */ + /* so try Authentication again may help. For D-Link DWL-900AP+ compatibility. */ DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH FAIL, try again...\n")); @@ -961,7 +961,7 @@ VOID CntlWaitAuthProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Ndis802_11AuthModeShared) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeAutoSwitch)) { - // either Ndis802_11AuthModeShared or Ndis802_11AuthModeAutoSwitch, try shared key first + /* either Ndis802_11AuthModeShared or Ndis802_11AuthModeAutoSwitch, try shared key first */ AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, AUTH_MODE_KEY); @@ -1028,10 +1028,10 @@ VOID CntlWaitAuthProc2(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_AUTH2; } else { - // not success, try next BSS + /* not success, try next BSS */ DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH FAIL, give up; try next BSS\n")); - pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; //??????? + pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; /*??????? */ pAd->MlmeAux.BssIdx++; IterateOnBssTab(pAd); } @@ -1067,7 +1067,7 @@ VOID CntlWaitAssocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ("CNTL - Association successful on BSS #%ld\n", pAd->MlmeAux.BssIdx)); } else { - // not success, try next BSS + /* not success, try next BSS */ DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Association fails on BSS #%ld\n", pAd->MlmeAux.BssIdx)); @@ -1092,16 +1092,16 @@ VOID CntlWaitReassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if (Elem->MsgType == MT2_REASSOC_CONF) { NdisMoveMemory(&Result, Elem->Msg, sizeof(USHORT)); if (Result == MLME_SUCCESS) { - // send wireless event - for association + /* send wireless event - for association */ if (pAd->CommonCfg.bWirelessEvent) RTMPSendWirelessEvent(pAd, IW_ASSOC_EVENT_FLAG, pAd->MacTab. Content[BSSID_WCID].Addr, BSS0, 0); - // - // NDIS requires a new Link UP indication but no Link Down for RE-ASSOC - // + /* */ + /* NDIS requires a new Link UP indication but no Link Down for RE-ASSOC */ + /* */ LinkUp(pAd, BSS_INFRA); pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; @@ -1109,7 +1109,7 @@ VOID CntlWaitReassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ("CNTL - Re-assocition successful on BSS #%ld\n", pAd->MlmeAux.RoamIdx)); } else { - // reassoc failed, try to pick next BSS in the BSS Table + /* reassoc failed, try to pick next BSS in the BSS Table */ DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Re-assocition fails on BSS #%ld\n", pAd->MlmeAux.RoamIdx)); @@ -1128,7 +1128,7 @@ VOID AdhocTurnOnQos(IN PRTMP_ADAPTER pAd) #define AC2_DEF_TXOP 94 #define AC3_DEF_TXOP 47 - // Turn on QOs if use HT rate. + /* Turn on QOs if use HT rate. */ if (pAd->CommonCfg.APEdcaParm.bValid == FALSE) { pAd->CommonCfg.APEdcaParm.bValid = TRUE; pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3; @@ -1170,7 +1170,7 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) UCHAR Value = 0, idx = 0, HashIdx = 0; MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry = NULL; - // Init ChannelQuality to prevent DEAD_CQI at initial LinkUp + /* Init ChannelQuality to prevent DEAD_CQI at initial LinkUp */ pAd->Mlme.ChannelQuality = 50; pEntry = MacTableLookup(pAd, pAd->CommonCfg.Bssid); @@ -1181,15 +1181,15 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) pEntry = &pAd->MacTab.Content[BSSID_WCID]; - // - // ASSOC - DisassocTimeoutAction - // CNTL - Dis-associate successful - // !!! LINK DOWN !!! - // [88888] OID_802_11_SSID should have returned NDTEST_WEP_AP2(Returned: ) - // - // To prevent DisassocTimeoutAction to call Link down after we link up, - // cancel the DisassocTimer no matter what it start or not. - // + /* */ + /* ASSOC - DisassocTimeoutAction */ + /* CNTL - Dis-associate successful */ + /* !!! LINK DOWN !!! */ + /* [88888] OID_802_11_SSID should have returned NDTEST_WEP_AP2(Returned: ) */ + /* */ + /* To prevent DisassocTimeoutAction to call Link down after we link up, */ + /* cancel the DisassocTimer no matter what it start or not. */ + /* */ RTMPCancelTimer(&pAd->MlmeAux.DisassocTimer, &Cancelled); COPY_SETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(pAd); @@ -1197,8 +1197,8 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(pAd); #ifdef RTMP_MAC_PCI - // Before power save before link up function, We will force use 1R. - // So after link up, check Rx antenna # again. + /* Before power save before link up function, We will force use 1R. */ + /* So after link up, check Rx antenna # again. */ RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); if (pAd->Antenna.field.RxPath == 3) { Value |= (0x10); @@ -1209,7 +1209,7 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) } RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); pAd->StaCfg.BBPR3 = Value; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ if (BssType == BSS_ADHOC) { OPSTATUS_SET_FLAG(pAd, fOP_STATUS_ADHOC_ON); @@ -1226,17 +1226,17 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) DBGPRINT(RT_DEBUG_TRACE, ("!!!Infra LINK UP !!! \n")); } - // 3*3 - // reset Tx beamforming bit + /* 3*3 */ + /* reset Tx beamforming bit */ RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value); Value &= (~0x01); Value |= pAd->CommonCfg.RegTransmitSetting.field.TxBF; RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value); - // Change to AP channel + /* Change to AP channel */ if ((pAd->CommonCfg.CentralChannel > pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) { - // Must using 40MHz. + /* Must using 40MHz. */ pAd->CommonCfg.BBPCurrentBW = BW_40; AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); @@ -1246,13 +1246,13 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) Value |= 0x10; RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value); - // RX : control channel at lower + /* RX : control channel at lower */ RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); Value &= (~0x20); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); #ifdef RTMP_MAC_PCI pAd->StaCfg.BBPR3 = Value; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data); Data &= 0xfffffffe; @@ -1271,7 +1271,7 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) } else if ((pAd->CommonCfg.CentralChannel < pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) { - // Must using 40MHz. + /* Must using 40MHz. */ pAd->CommonCfg.BBPCurrentBW = BW_40; AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); @@ -1290,7 +1290,7 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); #ifdef RTMP_MAC_PCI pAd->StaCfg.BBPR3 = Value; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ if (pAd->MACVersion == 0x28600100) { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x1A); @@ -1321,7 +1321,7 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); #ifdef RTMP_MAC_PCI pAd->StaCfg.BBPR3 = Value; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ if (pAd->MACVersion == 0x28600100) { RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x16); @@ -1335,9 +1335,9 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) RTMPSetAGCInitValue(pAd, pAd->CommonCfg.BBPCurrentBW); - // - // Save BBP_R66 value, it will be used in RTUSBResumeMsduTransmission - // + /* */ + /* Save BBP_R66 value, it will be used in RTUSBResumeMsduTransmission */ + /* */ RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R66, &pAd->BbpTuning.R66CurrentValue); @@ -1355,12 +1355,12 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) AsicSetSlotTime(pAd, TRUE); AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm); - // Call this for RTS protectionfor legacy rate, we will always enable RTS threshold, but normally it will not hit + /* Call this for RTS protectionfor legacy rate, we will always enable RTS threshold, but normally it will not hit */ AsicUpdateProtect(pAd, 0, (OFDMSETPROTECT | CCKSETPROTECT), TRUE, FALSE); if ((pAd->StaActive.SupportedPhyInfo.bHtEnable == TRUE)) { - // Update HT protectionfor based on AP's operating mode. + /* Update HT protectionfor based on AP's operating mode. */ if (pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent == 1) { AsicUpdateProtect(pAd, pAd->MlmeAux.AddHtInfo.AddHtInfo2. @@ -1376,7 +1376,7 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) NdisZeroMemory(&pAd->DrsCounters, sizeof(COUNTER_DRS)); NdisGetSystemUpTime(&Now); - pAd->StaCfg.LastBeaconRxTime = Now; // last RX timestamp + pAd->StaCfg.LastBeaconRxTime = Now; /* last RX timestamp */ if ((pAd->CommonCfg.TxPreamble != Rt802_11PreambleLong) && CAP_IS_SHORT_PREAMBLE_ON(pAd->StaActive.CapabilityInfo)) { @@ -1394,18 +1394,18 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) if ((pAd->CommonCfg.Channel > 14) && (pAd->CommonCfg.bIEEE80211H == 1) && RadarChannelCheck(pAd, pAd->CommonCfg.Channel)) { - ; //Do nothing + ; /*Do nothing */ } else { AsicEnableIbssSync(pAd); } - // In ad hoc mode, use MAC table from index 1. - // p.s ASIC use all 0xff as termination of WCID table search.To prevent it's 0xff-ff-ff-ff-ff-ff, Write 0 here. + /* In ad hoc mode, use MAC table from index 1. */ + /* p.s ASIC use all 0xff as termination of WCID table search.To prevent it's 0xff-ff-ff-ff-ff-ff, Write 0 here. */ RTMP_IO_WRITE32(pAd, MAC_WCID_BASE, 0x00); RTMP_IO_WRITE32(pAd, 0x1808, 0x00); - // If WEP is enabled, add key material and cipherAlg into Asic - // Fill in Shared Key Table(offset: 0x6c00) and Shared Key Mode(offset: 0x7000) + /* If WEP is enabled, add key material and cipherAlg into Asic */ + /* Fill in Shared Key Table(offset: 0x6c00) and Shared Key Mode(offset: 0x7000) */ if (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled) { PUCHAR Key; @@ -1416,13 +1416,13 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) Key = pAd->SharedKey[BSS0][idx].Key; if (pAd->SharedKey[BSS0][idx].KeyLen > 0) { - // Set key material and cipherAlg to Asic + /* Set key material and cipherAlg to Asic */ AsicAddSharedKeyEntry(pAd, BSS0, idx, CipherAlg, Key, NULL, NULL); if (idx == pAd->StaCfg.DefaultKeyId) { - // Update WCID attribute table and IVEIV table for this group key table + /* Update WCID attribute table and IVEIV table for this group key table */ RTMPAddWcidAttributeEntry(pAd, BSS0, idx, @@ -1433,10 +1433,10 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) } } - // If WPANone is enabled, add key material and cipherAlg into Asic - // Fill in Shared Key Table(offset: 0x6c00) and Shared Key Mode(offset: 0x7000) + /* If WPANone is enabled, add key material and cipherAlg into Asic */ + /* Fill in Shared Key Table(offset: 0x6c00) and Shared Key Mode(offset: 0x7000) */ else if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) { - pAd->StaCfg.DefaultKeyId = 0; // always be zero + pAd->StaCfg.DefaultKeyId = 0; /* always be zero */ NdisZeroMemory(&pAd->SharedKey[BSS0][0], sizeof(CIPHER_KEY)); @@ -1453,7 +1453,7 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) &pAd->StaCfg.PMK[16], LEN_TKIP_TXMICK); } - // Decide its ChiperAlg + /* Decide its ChiperAlg */ if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_TKIP; @@ -1467,7 +1467,7 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_AES; } - // Set key material and cipherAlg to Asic + /* Set key material and cipherAlg to Asic */ AsicAddSharedKeyEntry(pAd, BSS0, 0, @@ -1476,16 +1476,16 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) pAd->SharedKey[BSS0][0].TxMic, pAd->SharedKey[BSS0][0].RxMic); - // Update WCID attribute table and IVEIV table for this group key table + /* Update WCID attribute table and IVEIV table for this group key table */ RTMPAddWcidAttributeEntry(pAd, BSS0, 0, pAd->SharedKey[BSS0][0]. CipherAlg, NULL); } - } else // BSS_INFRA + } else /* BSS_INFRA */ { - // Check the new SSID with last SSID + /* Check the new SSID with last SSID */ while (Cancelled == TRUE) { if (pAd->CommonCfg.LastSsidLen == pAd->CommonCfg.SsidLen) { @@ -1493,11 +1493,11 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) (pAd->CommonCfg.LastSsid, pAd->CommonCfg.Ssid, pAd->CommonCfg.LastSsidLen) == 0) { - // Link to the old one no linkdown is required. + /* Link to the old one no linkdown is required. */ break; } } - // Send link down event before set to link up + /* Send link down event before set to link up */ pAd->IndicateMediaState = NdisMediaStateDisconnected; RTMP_IndicateMediaState(pAd); pAd->ExtraInfo = GENERAL_LINK_DOWN; @@ -1506,43 +1506,43 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) break; } - // - // On WPA mode, Remove All Keys if not connect to the last BSSID - // Key will be set after 4-way handshake. - // + /* */ + /* On WPA mode, Remove All Keys if not connect to the last BSSID */ + /* Key will be set after 4-way handshake. */ + /* */ if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) { ULONG IV; - // Remove all WPA keys + /* Remove all WPA keys */ RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); RTMPWPARemoveAllKeys(pAd); pAd->StaCfg.PortSecured = WPA_802_1X_PORT_NOT_SECURED; pAd->StaCfg.PrivacyFilter = Ndis802_11PrivFilter8021xWEP; - // Fixed connection failed with Range Maximizer - 515 AP (Marvell Chip) when security is WPAPSK/TKIP - // If IV related values are too large in GroupMsg2, AP would ignore this message. + /* Fixed connection failed with Range Maximizer - 515 AP (Marvell Chip) when security is WPAPSK/TKIP */ + /* If IV related values are too large in GroupMsg2, AP would ignore this message. */ IV = 1; IV |= (pAd->StaCfg.DefaultKeyId << 30); AsicUpdateWCIDIVEIV(pAd, BSSID_WCID, IV, 0); } - // NOTE: - // the decision of using "short slot time" or not may change dynamically due to - // new STA association to the AP. so we have to decide that upon parsing BEACON, not here + /* NOTE: */ + /* the decision of using "short slot time" or not may change dynamically due to */ + /* new STA association to the AP. so we have to decide that upon parsing BEACON, not here */ - // NOTE: - // the decision to use "RTC/CTS" or "CTS-to-self" protection or not may change dynamically - // due to new STA association to the AP. so we have to decide that upon parsing BEACON, not here + /* NOTE: */ + /* the decision to use "RTC/CTS" or "CTS-to-self" protection or not may change dynamically */ + /* due to new STA association to the AP. so we have to decide that upon parsing BEACON, not here */ ComposePsPoll(pAd); ComposeNullFrame(pAd); AsicEnableBssSync(pAd); - // Add BSSID to WCID search table + /* Add BSSID to WCID search table */ AsicUpdateRxWCIDTable(pAd, BSSID_WCID, pAd->CommonCfg.Bssid); - // If WEP is enabled, add paiewise and shared key + /* If WEP is enabled, add paiewise and shared key */ if (((pAd->StaCfg.WpaSupplicantUP) && (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled) && (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED)) || @@ -1556,13 +1556,13 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) Key = pAd->SharedKey[BSS0][idx].Key; if (pAd->SharedKey[BSS0][idx].KeyLen > 0) { - // Set key material and cipherAlg to Asic + /* Set key material and cipherAlg to Asic */ AsicAddSharedKeyEntry(pAd, BSS0, idx, CipherAlg, Key, NULL, NULL); if (idx == pAd->StaCfg.DefaultKeyId) { - // Assign group key info + /* Assign group key info */ RTMPAddWcidAttributeEntry(pAd, BSS0, idx, @@ -1570,7 +1570,7 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) NULL); pEntry->Aid = BSSID_WCID; - // Assign pairwise key info + /* Assign pairwise key info */ RTMPAddWcidAttributeEntry(pAd, BSS0, idx, @@ -1580,11 +1580,11 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) } } } - // only INFRASTRUCTURE mode need to indicate connectivity immediately; ADHOC mode - // should wait until at least 2 active nodes in this BSSID. + /* only INFRASTRUCTURE mode need to indicate connectivity immediately; ADHOC mode */ + /* should wait until at least 2 active nodes in this BSSID. */ OPSTATUS_SET_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); - // For GUI ++ + /* For GUI ++ */ if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA) { pAd->IndicateMediaState = NdisMediaStateConnected; pAd->ExtraInfo = GENERAL_LINK_UP; @@ -1597,11 +1597,11 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) RTMPSetTimer(&pAd->Mlme.LinkDownTimer, LINK_DOWN_TIMEOUT); } - // -- + /* -- */ - // Add BSSID in my MAC Table. + /* Add BSSID in my MAC Table. */ NdisAcquireSpinLock(&pAd->MacTabLock); - // add this MAC entry into HASH table + /* add this MAC entry into HASH table */ if (pEntry) { HashIdx = MAC_ADDR_HASH_INDEX(pAd->CommonCfg.Bssid); if (pAd->MacTab.Hash[HashIdx] == NULL) { @@ -1618,8 +1618,8 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) MAC_ADDR_LEN); pEntry->Aid = BSSID_WCID; pEntry->pAd = pAd; - pEntry->ValidAsCLI = TRUE; //Although this is bssid..still set ValidAsCl - pAd->MacTab.Size = 1; // infra mode always set MACtab size =1. + pEntry->ValidAsCLI = TRUE; /*Although this is bssid..still set ValidAsCl */ + pAd->MacTab.Size = 1; /* infra mode always set MACtab size =1. */ pEntry->Sst = SST_ASSOC; pEntry->AuthState = SST_ASSOC; pEntry->AuthMode = pAd->StaCfg.AuthMode; @@ -1687,15 +1687,15 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) pAd->CommonCfg.BACapability.word, pAd->MacTab.Content[BSSID_WCID].ClientStatusFlags)); - // Set LED + /* Set LED */ RTMPSetLED(pAd, LED_LINK_UP); pAd->Mlme.PeriodicRound = 0; pAd->Mlme.OneSecPeriodicRound = 0; - pAd->bConfigChanged = FALSE; // Reset config flag - pAd->ExtraInfo = GENERAL_LINK_UP; // Update extra information to link is up + pAd->bConfigChanged = FALSE; /* Reset config flag */ + pAd->ExtraInfo = GENERAL_LINK_UP; /* Update extra information to link is up */ - // Set asic auto fall back + /* Set asic auto fall back */ { PUCHAR pTable; UCHAR TableSize = 0; @@ -1719,7 +1719,7 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) || (pEntry->HTPhyMode.field.MCS == 32)) pEntry->HTPhyMode.field.STBC = STBC_NONE; - // If the legacy mode is set, overwrite the transmit setting of this entry. + /* If the legacy mode is set, overwrite the transmit setting of this entry. */ if (pEntry->HTPhyMode.field.MODE <= MODE_OFDM) RTMPUpdateLegacyTxSetting((UCHAR) pAd->StaCfg. DesiredTransmitSetting.field. @@ -1728,9 +1728,9 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) pEntry->bAutoTxRateSwitch = TRUE; NdisReleaseSpinLock(&pAd->MacTabLock); - // Let Link Status Page display first initial rate. + /* Let Link Status Page display first initial rate. */ pAd->LastTxRate = (USHORT) (pEntry->HTPhyMode.word); - // Select DAC according to HT or Legacy + /* Select DAC according to HT or Legacy */ if (pAd->StaActive.SupportedPhyInfo.MCSSet[0] != 0x00) { RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &Value); Value &= (~0x18); @@ -1746,20 +1746,20 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) if (pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) { } else if (pEntry->MaxRAmpduFactor == 0) { - // If HT AP doesn't support MaxRAmpduFactor = 1, we need to set max PSDU to 0. - // Because our Init value is 1 at MACRegTable. + /* If HT AP doesn't support MaxRAmpduFactor = 1, we need to set max PSDU to 0. */ + /* Because our Init value is 1 at MACRegTable. */ RTMP_IO_WRITE32(pAd, MAX_LEN_CFG, 0x0fff); } - // Patch for Marvel AP to gain high throughput - // Need to set as following, - // 1. Set txop in register-EDCA_AC0_CFG as 0x60 - // 2. Set EnTXWriteBackDDONE in register-WPDMA_GLO_CFG as zero - // 3. PBF_MAX_PCNT as 0x1F3FBF9F - // 4. kick per two packets when dequeue - // - // Txop can only be modified when RDG is off, WMM is disable and TxBurst is enable - // - // if 1. Legacy AP WMM on, or 2. 11n AP, AMPDU disable. Force turn off burst no matter what bEnableTxBurst is. + /* Patch for Marvel AP to gain high throughput */ + /* Need to set as following, */ + /* 1. Set txop in register-EDCA_AC0_CFG as 0x60 */ + /* 2. Set EnTXWriteBackDDONE in register-WPDMA_GLO_CFG as zero */ + /* 3. PBF_MAX_PCNT as 0x1F3FBF9F */ + /* 4. kick per two packets when dequeue */ + /* */ + /* Txop can only be modified when RDG is off, WMM is disable and TxBurst is enable */ + /* */ + /* if 1. Legacy AP WMM on, or 2. 11n AP, AMPDU disable. Force turn off burst no matter what bEnableTxBurst is. */ if (!((pAd->CommonCfg.RxStream == 1) && (pAd->CommonCfg.TxStream == 1)) && (pAd->StaCfg.bForceTxBurst == FALSE) && @@ -1791,14 +1791,14 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) DBGPRINT(RT_DEBUG_TRACE, ("Txburst 3\n")); } - // Re-check to turn on TX burst or not. + /* Re-check to turn on TX burst or not. */ if ((pAd->CommonCfg.IOTestParm.bLastAtheros == TRUE) && ((STA_WEP_ON(pAd)) || (STA_TKIP_ON(pAd)))) { pAd->CommonCfg.IOTestParm.bNextDisableRxBA = TRUE; if (pAd->CommonCfg.bEnableTxBurst) { UINT32 MACValue = 0; - // Force disable TXOP value in this case. The same action in MLMEUpdateProtect too. - // I didn't change PBF_MAX_PCNT setting. + /* Force disable TXOP value in this case. The same action in MLMEUpdateProtect too. */ + /* I didn't change PBF_MAX_PCNT setting. */ RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &MACValue); MACValue &= 0xFFFFFF00; RTMP_IO_WRITE32(pAd, EDCA_AC0_CFG, MACValue); @@ -1813,9 +1813,9 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) DBGPRINT(RT_DEBUG_TRACE, ("!!!pAd->bNextDisableRxBA= %d \n", pAd->CommonCfg.IOTestParm.bNextDisableRxBA)); - // BSSID add in one MAC entry too. Because in Tx, ASIC need to check Cipher and IV/EIV, BAbitmap - // Pther information in MACTab.Content[BSSID_WCID] is not necessary for driver. - // Note: As STA, The MACTab.Content[BSSID_WCID]. PairwiseKey and Shared Key for BSS0 are the same. + /* BSSID add in one MAC entry too. Because in Tx, ASIC need to check Cipher and IV/EIV, BAbitmap */ + /* Pther information in MACTab.Content[BSSID_WCID] is not necessary for driver. */ + /* Note: As STA, The MACTab.Content[BSSID_WCID]. PairwiseKey and Shared Key for BSS0 are the same. */ if (pAd->StaCfg.WepStatus <= Ndis802_11WEPDisabled) { if (pAd->StaCfg.WpaSupplicantUP && @@ -1832,10 +1832,10 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) pEntry->PortSecured = pAd->StaCfg.PortSecured; NdisReleaseSpinLock(&pAd->MacTabLock); - // - // Patch Atheros AP TX will breakdown issue. - // AP Model: DLink DWL-8200AP - // + /* */ + /* Patch Atheros AP TX will breakdown issue. */ + /* AP Model: DLink DWL-8200AP */ + /* */ if (INFRA_ON(pAd) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && STA_TKIP_ON(pAd)) { RTMP_IO_WRITE32(pAd, RX_PARSER_CFG, 0x01); @@ -1877,14 +1877,14 @@ VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) { UCHAR i, ByteValue = 0; - // Do nothing if monitor mode is on + /* Do nothing if monitor mode is on */ if (MONITOR_ON(pAd)) return; RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_GO_TO_SLEEP_NOW); - //Comment the codes, beasue the line 2291 call the same function. - //RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - // Not allow go to sleep within linkdown function. + /*Comment the codes, beasue the line 2291 call the same function. */ + /*RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); */ + /* Not allow go to sleep within linkdown function. */ RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); if (pAd->CommonCfg.bWirelessEvent) { @@ -1904,7 +1904,7 @@ VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) } pAd->bPCIclkOff = FALSE; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) || RTMP_TEST_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND) @@ -1917,9 +1917,9 @@ VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) } #ifdef RTMP_MAC_PCI pAd->bPCIclkOff = FALSE; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ - if (ADHOC_ON(pAd)) // Adhoc mode link down + if (ADHOC_ON(pAd)) /* Adhoc mode link down */ { DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK DOWN 1!!!\n")); @@ -1932,14 +1932,14 @@ VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) pAd->CommonCfg.Channel); DBGPRINT(RT_DEBUG_TRACE, ("!!! MacTab.Size=%d !!!\n", pAd->MacTab.Size)); - } else // Infra structure mode + } else /* Infra structure mode */ { DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK DOWN 2!!!\n")); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_INFRA_ON); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); - // Saved last SSID for linkup comparison + /* Saved last SSID for linkup comparison */ pAd->CommonCfg.LastSsidLen = pAd->CommonCfg.SsidLen; NdisMoveMemory(pAd->CommonCfg.LastSsid, pAd->CommonCfg.Ssid, pAd->CommonCfg.LastSsidLen); @@ -1952,20 +1952,20 @@ VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) ("NDIS_STATUS_MEDIA_DISCONNECT Event A!\n")); pAd->MlmeAux.CurrReqIsFromNdis = FALSE; } else { - // - // If disassociation request is from NDIS, then we don't need to delete BSSID from entry. - // Otherwise lost beacon or receive De-Authentication from AP, - // then we should delete BSSID from BssTable. - // If we don't delete from entry, roaming will fail. - // + /* */ + /* If disassociation request is from NDIS, then we don't need to delete BSSID from entry. */ + /* Otherwise lost beacon or receive De-Authentication from AP, */ + /* then we should delete BSSID from BssTable. */ + /* If we don't delete from entry, roaming will fail. */ + /* */ BssTableDeleteEntry(&pAd->ScanTab, pAd->CommonCfg.Bssid, pAd->CommonCfg.Channel); } - // restore back to - - // 1. long slot (20 us) or short slot (9 us) time - // 2. turn on/off RTS/CTS and/or CTS-to-self protection - // 3. short preamble + /* restore back to - */ + /* 1. long slot (20 us) or short slot (9 us) time */ + /* 2. turn on/off RTS/CTS and/or CTS-to-self protection */ + /* 3. short preamble */ OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_BG_PROTECTION_INUSED); } @@ -1976,13 +1976,13 @@ VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) pAd->MacTab.Content[i].Addr); } - AsicSetSlotTime(pAd, TRUE); //FALSE); + AsicSetSlotTime(pAd, TRUE); /*FALSE); */ AsicSetEdcaParm(pAd, NULL); - // Set LED + /* Set LED */ RTMPSetLED(pAd, LED_LINK_DOWN); pAd->LedIndicatorStrength = 0xF0; - RTMPSetSignalLED(pAd, -100); // Force signal strength Led to be turned off, firmware is not done it. + RTMPSetSignalLED(pAd, -100); /* Force signal strength Led to be turned off, firmware is not done it. */ AsicDisableSync(pAd); @@ -1990,7 +1990,7 @@ VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) pAd->Mlme.OneSecPeriodicRound = 0; if (pAd->StaCfg.BssType == BSS_INFRA) { - // Remove StaCfg Information after link down + /* Remove StaCfg Information after link down */ NdisZeroMemory(pAd->CommonCfg.Bssid, MAC_ADDR_LEN); NdisZeroMemory(pAd->CommonCfg.Ssid, MAX_LEN_OF_SSID); pAd->CommonCfg.SsidLen = 0; @@ -2001,25 +2001,25 @@ VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) pAd->MlmeAux.HtCapabilityLen = 0; pAd->MlmeAux.NewExtChannelOffset = 0xff; - // Reset WPA-PSK state. Only reset when supplicant enabled + /* Reset WPA-PSK state. Only reset when supplicant enabled */ if (pAd->StaCfg.WpaState != SS_NOTUSE) { pAd->StaCfg.WpaState = SS_START; - // Clear Replay counter + /* Clear Replay counter */ NdisZeroMemory(pAd->StaCfg.ReplayCounter, 8); } - // - // if link down come from AP, we need to remove all WPA keys on WPA mode. - // otherwise will cause 4-way handshaking failed, since the WPA key not empty. - // + /* */ + /* if link down come from AP, we need to remove all WPA keys on WPA mode. */ + /* otherwise will cause 4-way handshaking failed, since the WPA key not empty. */ + /* */ if ((IsReqFromAP) && (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA)) { - // Remove all WPA keys + /* Remove all WPA keys */ RTMPWPARemoveAllKeys(pAd); } - // 802.1x port control + /* 802.1x port control */ - // Prevent clear PortSecured here with static WEP - // NetworkManger set security policy first then set SSID to connect AP. + /* Prevent clear PortSecured here with static WEP */ + /* NetworkManger set security policy first then set SSID to connect AP. */ if (pAd->StaCfg.WpaSupplicantUP && (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled) && (pAd->StaCfg.IEEE8021X == FALSE)) { @@ -2037,16 +2037,16 @@ VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) pAd->StaCfg.MicErrCnt = 0; pAd->IndicateMediaState = NdisMediaStateDisconnected; - // Update extra information to link is up + /* Update extra information to link is up */ pAd->ExtraInfo = GENERAL_LINK_DOWN; pAd->StaActive.SupportedPhyInfo.bHtEnable = FALSE; #ifdef RTMP_MAC_USB pAd->bUsbTxBulkAggre = FALSE; -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ - // Clean association information + /* Clean association information */ NdisZeroMemory(&pAd->StaCfg.AssocInfo, sizeof(NDIS_802_11_ASSOCIATION_INFORMATION)); pAd->StaCfg.AssocInfo.Length = @@ -2054,9 +2054,9 @@ VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) pAd->StaCfg.ReqVarIELen = 0; pAd->StaCfg.ResVarIELen = 0; - // - // Reset RSSI value after link down - // + /* */ + /* Reset RSSI value after link down */ + /* */ pAd->StaCfg.RssiSample.AvgRssi0 = 0; pAd->StaCfg.RssiSample.AvgRssi0X8 = 0; pAd->StaCfg.RssiSample.AvgRssi1 = 0; @@ -2064,20 +2064,20 @@ VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) pAd->StaCfg.RssiSample.AvgRssi2 = 0; pAd->StaCfg.RssiSample.AvgRssi2X8 = 0; - // Restore MlmeRate + /* Restore MlmeRate */ pAd->CommonCfg.MlmeRate = pAd->CommonCfg.BasicMlmeRate; pAd->CommonCfg.RtsRate = pAd->CommonCfg.BasicMlmeRate; - // - // After Link down, reset piggy-back setting in ASIC. Disable RDG. - // + /* */ + /* After Link down, reset piggy-back setting in ASIC. Disable RDG. */ + /* */ if (pAd->CommonCfg.BBPCurrentBW == BW_40) { pAd->CommonCfg.BBPCurrentBW = BW_20; RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &ByteValue); ByteValue &= (~0x18); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, ByteValue); } - // Reset DAC + /* Reset DAC */ RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &ByteValue); ByteValue &= (~0x18); if (pAd->Antenna.field.TxPath == 2) { @@ -2090,7 +2090,7 @@ VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) pAd->CommonCfg.BACapability.word = pAd->CommonCfg.REGBACapability.word; - // Restore all settings in the following. + /* Restore all settings in the following. */ AsicUpdateProtect(pAd, 0, (ALLN_SETPROTECT | CCKSETPROTECT | OFDMSETPROTECT), TRUE, FALSE); @@ -2101,7 +2101,7 @@ VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) RTMP_IO_WRITE32(pAd, MAX_LEN_CFG, 0x1fff); RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); -// Allow go to sleep after linkdown steps. +/* Allow go to sleep after linkdown steps. */ RTMP_SET_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0); @@ -2111,7 +2111,7 @@ VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) && (pAd->Antenna.field.RxPath > 1 || pAd->Antenna.field.TxPath > 1)) { RTMP_ASIC_MMPS_DISABLE(pAd); } -#endif // RT30xx // +#endif /* RT30xx // */ } /* @@ -2128,16 +2128,16 @@ VOID IterateOnBssTab(IN PRTMP_ADAPTER pAd) MLME_JOIN_REQ_STRUCT JoinReq; ULONG BssIdx; - // Change the wepstatus to original wepstatus + /* Change the wepstatus to original wepstatus */ pAd->StaCfg.WepStatus = pAd->StaCfg.OrigWepStatus; pAd->StaCfg.PairCipher = pAd->StaCfg.OrigWepStatus; pAd->StaCfg.GroupCipher = pAd->StaCfg.OrigWepStatus; BssIdx = pAd->MlmeAux.BssIdx; if (BssIdx < pAd->MlmeAux.SsidBssTab.BssNr) { - // Check cipher suite, AP must have more secured cipher than station setting - // Set the Pairwise and Group cipher to match the intended AP setting - // We can only connect to AP with less secured cipher setting + /* Check cipher suite, AP must have more secured cipher than station setting */ + /* Set the Pairwise and Group cipher to match the intended AP setting */ + /* We can only connect to AP with less secured cipher setting */ if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK)) { pAd->StaCfg.GroupCipher = @@ -2155,7 +2155,7 @@ VOID IterateOnBssTab(IN PRTMP_ADAPTER pAd) pAd->StaCfg.PairCipher = pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx]. WPA.PairCipherAux; - else // There is no PairCipher Aux, downgrade our capability to TKIP + else /* There is no PairCipher Aux, downgrade our capability to TKIP */ pAd->StaCfg.PairCipher = Ndis802_11Encryption2Enabled; } else if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) @@ -2176,16 +2176,16 @@ VOID IterateOnBssTab(IN PRTMP_ADAPTER pAd) pAd->StaCfg.PairCipher = pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx]. WPA2.PairCipherAux; - else // There is no PairCipher Aux, downgrade our capability to TKIP + else /* There is no PairCipher Aux, downgrade our capability to TKIP */ pAd->StaCfg.PairCipher = Ndis802_11Encryption2Enabled; - // RSN capability + /* RSN capability */ pAd->StaCfg.RsnCapability = pAd->MlmeAux.SsidBssTab.BssEntry[BssIdx].WPA2. RsnCapability; } - // Set Mix cipher flag + /* Set Mix cipher flag */ pAd->StaCfg.bMixCipher = (pAd->StaCfg.PairCipher == pAd->StaCfg.GroupCipher) ? FALSE : TRUE; @@ -2211,7 +2211,7 @@ VOID IterateOnBssTab(IN PRTMP_ADAPTER pAd) MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, sizeof(MLME_START_REQ_STRUCT), &StartReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_START; - } else // no more BSS + } else /* no more BSS */ { { @@ -2226,8 +2226,8 @@ VOID IterateOnBssTab(IN PRTMP_ADAPTER pAd) } } -// for re-association only -// IRQL = DISPATCH_LEVEL +/* for re-association only */ +/* IRQL = DISPATCH_LEVEL */ VOID IterateOnBssTab2(IN PRTMP_ADAPTER pAd) { MLME_REASSOC_REQ_STRUCT ReassocReq; @@ -2245,7 +2245,7 @@ VOID IterateOnBssTab2(IN PRTMP_ADAPTER pAd) AsicSwitchChannel(pAd, pBss->Channel, FALSE); AsicLockChannel(pAd, pBss->Channel); - // reassociate message has the same structure as associate message + /* reassociate message has the same structure as associate message */ AssocParmFill(pAd, &ReassocReq, pBss->Bssid, pBss->CapabilityInfo, ASSOC_TIMEOUT, pAd->StaCfg.DefaultListenCount); @@ -2253,7 +2253,7 @@ VOID IterateOnBssTab2(IN PRTMP_ADAPTER pAd) sizeof(MLME_REASSOC_REQ_STRUCT), &ReassocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_REASSOC; - } else // no more BSS + } else /* no more BSS */ { { @@ -2355,7 +2355,7 @@ VOID ComposePsPoll(IN PRTMP_ADAPTER pAd) COPY_MAC_ADDR(pAd->PsPollFrame.Ta, pAd->CurrentAddress); } -// IRQL = DISPATCH_LEVEL +/* IRQL = DISPATCH_LEVEL */ VOID ComposeNullFrame(IN PRTMP_ADAPTER pAd) { NdisZeroMemory(&pAd->NullFrame, sizeof(HEADER_802_11)); @@ -2366,7 +2366,7 @@ VOID ComposeNullFrame(IN PRTMP_ADAPTER pAd) COPY_MAC_ADDR(pAd->NullFrame.Addr2, pAd->CurrentAddress); COPY_MAC_ADDR(pAd->NullFrame.Addr3, pAd->CommonCfg.Bssid); } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB VOID MlmeCntlConfirm(IN PRTMP_ADAPTER pAd, IN ULONG MsgType, IN USHORT Msg) { @@ -2407,12 +2407,12 @@ VOID ComposePsPoll(IN PRTMP_ADAPTER pAd) RTMPMoveMemory(&pAd->PsPollContext.TransferBuffer->field. WirelessPacket[TXWI_SIZE + TXINFO_SIZE], &pAd->PsPollFrame, sizeof(PSPOLL_FRAME)); - // Append 4 extra zero bytes. + /* Append 4 extra zero bytes. */ pAd->PsPollContext.BulkOutSize = TXINFO_SIZE + TXWI_SIZE + sizeof(PSPOLL_FRAME) + 4; } -// IRQL = DISPATCH_LEVEL +/* IRQL = DISPATCH_LEVEL */ VOID ComposeNullFrame(IN PRTMP_ADAPTER pAd) { PTXINFO_STRUC pTxInfo; @@ -2446,7 +2446,7 @@ VOID ComposeNullFrame(IN PRTMP_ADAPTER pAd) pAd->NullContext.BulkOutSize = TXINFO_SIZE + TXWI_SIZE + sizeof(pAd->NullFrame) + 4; } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ /* ========================================================================== @@ -2477,27 +2477,27 @@ ULONG MakeIbssBeacon(IN PRTMP_ADAPTER pAd) if ((pAd->CommonCfg.PhyMode == PHY_11B) && (pAd->CommonCfg.Channel <= 14)) { - SupRate[0] = 0x82; // 1 mbps - SupRate[1] = 0x84; // 2 mbps - SupRate[2] = 0x8b; // 5.5 mbps - SupRate[3] = 0x96; // 11 mbps + SupRate[0] = 0x82; /* 1 mbps */ + SupRate[1] = 0x84; /* 2 mbps */ + SupRate[2] = 0x8b; /* 5.5 mbps */ + SupRate[3] = 0x96; /* 11 mbps */ SupRateLen = 4; ExtRateLen = 0; } else if (pAd->CommonCfg.Channel > 14) { - SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate - SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps - SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate - SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps - SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate - SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps - SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps - SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps + SupRate[0] = 0x8C; /* 6 mbps, in units of 0.5 Mbps, basic rate */ + SupRate[1] = 0x12; /* 9 mbps, in units of 0.5 Mbps */ + SupRate[2] = 0x98; /* 12 mbps, in units of 0.5 Mbps, basic rate */ + SupRate[3] = 0x24; /* 18 mbps, in units of 0.5 Mbps */ + SupRate[4] = 0xb0; /* 24 mbps, in units of 0.5 Mbps, basic rate */ + SupRate[5] = 0x48; /* 36 mbps, in units of 0.5 Mbps */ + SupRate[6] = 0x60; /* 48 mbps, in units of 0.5 Mbps */ + SupRate[7] = 0x6c; /* 54 mbps, in units of 0.5 Mbps */ SupRateLen = 8; ExtRateLen = 0; - // - // Also Update MlmeRate & RtsRate for G only & A only - // + /* */ + /* Also Update MlmeRate & RtsRate for G only & A only */ + /* */ pAd->CommonCfg.MlmeRate = RATE_6; pAd->CommonCfg.RtsRate = RATE_6; pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_OFDM; @@ -2508,20 +2508,20 @@ ULONG MakeIbssBeacon(IN PRTMP_ADAPTER pAd) pAd->MacTab.Content[BSS0Mcast_WCID].HTPhyMode.field.MCS = OfdmRateToRxwiMCS[pAd->CommonCfg.MlmeRate]; } else { - SupRate[0] = 0x82; // 1 mbps - SupRate[1] = 0x84; // 2 mbps - SupRate[2] = 0x8b; // 5.5 mbps - SupRate[3] = 0x96; // 11 mbps + SupRate[0] = 0x82; /* 1 mbps */ + SupRate[1] = 0x84; /* 2 mbps */ + SupRate[2] = 0x8b; /* 5.5 mbps */ + SupRate[3] = 0x96; /* 11 mbps */ SupRateLen = 4; - ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps, - ExtRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps - ExtRate[2] = 0x18; // 12 mbps, in units of 0.5 Mbps, - ExtRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps - ExtRate[4] = 0x30; // 24 mbps, in units of 0.5 Mbps, - ExtRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps - ExtRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps - ExtRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps + ExtRate[0] = 0x0C; /* 6 mbps, in units of 0.5 Mbps, */ + ExtRate[1] = 0x12; /* 9 mbps, in units of 0.5 Mbps */ + ExtRate[2] = 0x18; /* 12 mbps, in units of 0.5 Mbps, */ + ExtRate[3] = 0x24; /* 18 mbps, in units of 0.5 Mbps */ + ExtRate[4] = 0x30; /* 24 mbps, in units of 0.5 Mbps, */ + ExtRate[5] = 0x48; /* 36 mbps, in units of 0.5 Mbps */ + ExtRate[6] = 0x60; /* 48 mbps, in units of 0.5 Mbps */ + ExtRate[7] = 0x6c; /* 54 mbps, in units of 0.5 Mbps */ ExtRateLen = 8; } @@ -2530,7 +2530,7 @@ ULONG MakeIbssBeacon(IN PRTMP_ADAPTER pAd) pAd->StaActive.ExtRateLen = ExtRateLen; NdisMoveMemory(pAd->StaActive.ExtRate, ExtRate, ExtRateLen); - // compose IBSS beacon frame + /* compose IBSS beacon frame */ MgtMacHeaderInit(pAd, &BcnHdr, SUBTYPE_BEACON, 0, BROADCAST_ADDR, pAd->CommonCfg.Bssid); Privacy = (pAd->StaCfg.WepStatus == Ndis802_11Encryption1Enabled) @@ -2558,7 +2558,7 @@ ULONG MakeIbssBeacon(IN PRTMP_ADAPTER pAd) 1, &IbssIe, 1, &IbssLen, 2, &pAd->StaActive.AtimWin, END_OF_ARGS); - // add ERP_IE and EXT_RAE IE of in 802.11g + /* add ERP_IE and EXT_RAE IE of in 802.11g */ if (ExtRateLen) { ULONG tmp; @@ -2569,7 +2569,7 @@ ULONG MakeIbssBeacon(IN PRTMP_ADAPTER pAd) ExtRateLen, ExtRate, END_OF_ARGS); FrameLen += tmp; } - // If adhoc secruity is set for WPA-None, append the cipher suite IE + /* If adhoc secruity is set for WPA-None, append the cipher suite IE */ if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) { ULONG tmp; RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, @@ -2587,7 +2587,7 @@ ULONG MakeIbssBeacon(IN PRTMP_ADAPTER pAd) ULONG TmpLen; UCHAR HtLen, HtLen1; - // add HT Capability IE + /* add HT Capability IE */ HtLen = sizeof(pAd->CommonCfg.HtCapability); HtLen1 = sizeof(pAd->CommonCfg.AddHTInfo); @@ -2602,14 +2602,14 @@ ULONG MakeIbssBeacon(IN PRTMP_ADAPTER pAd) FrameLen += TmpLen; } - //beacon use reserved WCID 0xff + /*beacon use reserved WCID 0xff */ if (pAd->CommonCfg.Channel > 14) { RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, 0, 0xff, FrameLen, PID_MGMT, PID_BEACON, RATE_1, IFS_HTTXOP, FALSE, &pAd->CommonCfg.MlmeTransmit); } else { - // Set to use 1Mbps for Adhoc beacon. + /* Set to use 1Mbps for Adhoc beacon. */ HTTRANSMIT_SETTING Transmit; Transmit.word = 0; RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, TRUE, FALSE, FALSE, diff --git a/drivers/staging/rt2860/sta/rtmp_data.c b/drivers/staging/rt2860/sta/rtmp_data.c index 3a93ef699ce6..db65188ced3b 100644 --- a/drivers/staging/rt2860/sta/rtmp_data.c +++ b/drivers/staging/rt2860/sta/rtmp_data.c @@ -45,10 +45,10 @@ VOID STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, UCHAR *pTmpBuf; if (pAd->StaCfg.WpaSupplicantUP) { - // All EAPoL frames have to pass to upper layer (ex. WPA_SUPPLICANT daemon) - // TBD : process fragmented EAPol frames + /* All EAPoL frames have to pass to upper layer (ex. WPA_SUPPLICANT daemon) */ + /* TBD : process fragmented EAPol frames */ { - // In 802.1x mode, if the received frame is EAP-SUCCESS packet, turn on the PortSecured variable + /* In 802.1x mode, if the received frame is EAP-SUCCESS packet, turn on the PortSecured variable */ if (pAd->StaCfg.IEEE8021X == TRUE && (EAP_CODE_SUCCESS == WpaCheckEapCode(pAd, pRxBlk->pData, @@ -60,7 +60,7 @@ VOID STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, DBGPRINT_RAW(RT_DEBUG_TRACE, ("Receive EAP-SUCCESS Packet\n")); - //pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; + /*pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; */ STA_PORT_SECURED(pAd); if (pAd->StaCfg.IEEE8021x_required_keys == @@ -80,21 +80,21 @@ VOID STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, &pAd->MacTab. Content[BSSID_WCID]; - // Set key material and cipherAlg to Asic + /* Set key material and cipherAlg to Asic */ AsicAddSharedKeyEntry(pAd, BSS0, idx, CipherAlg, Key, NULL, NULL); - // Assign group key info + /* Assign group key info */ RTMPAddWcidAttributeEntry(pAd, BSS0, idx, CipherAlg, NULL); - // Assign pairwise key info + /* Assign pairwise key info */ RTMPAddWcidAttributeEntry(pAd, BSS0, idx, @@ -105,7 +105,7 @@ VOID STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, NdisMediaStateConnected; pAd->ExtraInfo = GENERAL_LINK_UP; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB union { char buf[sizeof @@ -144,7 +144,7 @@ VOID STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, NdisMediaStateConnected; pAd->ExtraInfo = GENERAL_LINK_UP; - // need to enqueue cmd to thread + /* need to enqueue cmd to thread */ RTUSBEnqueueCmdFromNdis(pAd, OID_802_11_ADD_WEP, TRUE, @@ -154,8 +154,8 @@ VOID STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, keyinfo) + len - 1); -#endif // RTMP_MAC_USB // - // For Preventing ShardKey Table is cleared by remove key procedure. +#endif /* RTMP_MAC_USB // */ + /* For Preventing ShardKey Table is cleared by remove key procedure. */ pAd->SharedKey[BSS0][idx]. CipherAlg = CipherAlg; pAd->SharedKey[BSS0][idx]. @@ -179,9 +179,9 @@ VOID STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, return; } } else { - // Special DATA frame that has to pass to MLME - // 1. Cisco Aironet frames for CCX2. We need pass it to MLME for special process - // 2. EAPOL handshaking frames when driver supplicant enabled, pass to MLME for special process + /* Special DATA frame that has to pass to MLME */ + /* 1. Cisco Aironet frames for CCX2. We need pass it to MLME for special process */ + /* 2. EAPOL handshaking frames when driver supplicant enabled, pass to MLME for special process */ { pTmpBuf = pRxBlk->pData - LENGTH_802_11; NdisMoveMemory(pTmpBuf, pRxBlk->pHeader, LENGTH_802_11); @@ -207,30 +207,30 @@ VOID STARxDataFrameAnnounce(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) { - // non-EAP frame + /* non-EAP frame */ if (!RTMPCheckWPAframe (pAd, pEntry, pRxBlk->pData, pRxBlk->DataSize, FromWhichBSSID)) { { - // drop all non-EAP DATA frame before - // this client's Port-Access-Control is secured + /* drop all non-EAP DATA frame before */ + /* this client's Port-Access-Control is secured */ if (pRxBlk->pHeader->FC.Wep) { - // unsupported cipher suite + /* unsupported cipher suite */ if (pAd->StaCfg.WepStatus == Ndis802_11EncryptionDisabled) { - // release packet + /* release packet */ RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); return; } } else { - // encryption in-use but receive a non-EAPOL clear text frame, drop it + /* encryption in-use but receive a non-EAPOL clear text frame, drop it */ if ((pAd->StaCfg.WepStatus != Ndis802_11EncryptionDisabled) && (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED)) { - // release packet + /* release packet */ RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); @@ -240,12 +240,12 @@ VOID STARxDataFrameAnnounce(IN PRTMP_ADAPTER pAd, } RX_BLK_CLEAR_FLAG(pRxBlk, fRX_EAP); if (!RX_BLK_TEST_FLAG(pRxBlk, fRX_ARALINK)) { - // Normal legacy, AMPDU or AMSDU + /* Normal legacy, AMPDU or AMSDU */ CmmRxnonRalinkFrameIndicate(pAd, pRxBlk, FromWhichBSSID); } else { - // ARALINK + /* ARALINK */ CmmRxRalinkFrameIndicate(pAd, pEntry, pRxBlk, FromWhichBSSID); } @@ -256,15 +256,15 @@ VOID STARxDataFrameAnnounce(IN PRTMP_ADAPTER pAd, && (pAd->CommonCfg.bDisableReordering == 0)) { Indicate_AMPDU_Packet(pAd, pRxBlk, FromWhichBSSID); } else { - // Determin the destination of the EAP frame - // to WPA state machine or upper layer + /* Determin the destination of the EAP frame */ + /* to WPA state machine or upper layer */ STARxEAPOLFrameIndicate(pAd, pEntry, pRxBlk, FromWhichBSSID); } } } -// For TKIP frame, calculate the MIC value +/* For TKIP frame, calculate the MIC value */ BOOLEAN STACheckTkipMICValue(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, IN RX_BLK * pRxBlk) { @@ -301,7 +301,7 @@ BOOLEAN STACheckTkipMICValue(IN PRTMP_ADAPTER pAd, RTMPReportMicError(pAd, pWpaKey); } - // release packet + /* release packet */ RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, NDIS_STATUS_FAILURE); return FALSE; @@ -310,14 +310,14 @@ BOOLEAN STACheckTkipMICValue(IN PRTMP_ADAPTER pAd, return TRUE; } -// -// All Rx routines use RX_BLK structure to hande rx events -// It is very important to build pRxBlk attributes -// 1. pHeader pointer to 802.11 Header -// 2. pData pointer to payload including LLC (just skip Header) -// 3. set payload size including LLC to DataSize -// 4. set some flags with RX_BLK_SET_FLAG() -// +/* */ +/* All Rx routines use RX_BLK structure to hande rx events */ +/* It is very important to build pRxBlk attributes */ +/* 1. pHeader pointer to 802.11 Header */ +/* 2. pData pointer to payload including LLC (just skip Header) */ +/* 3. set payload size including LLC to DataSize */ +/* 4. set some flags with RX_BLK_SET_FLAG() */ +/* */ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) { PRT28XX_RXD_STRUC pRxD = &(pRxBlk->RxD); @@ -330,17 +330,17 @@ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) UCHAR UserPriority = 0; { - // before LINK UP, all DATA frames are rejected + /* before LINK UP, all DATA frames are rejected */ if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) { - // release packet + /* release packet */ RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); return; } - // Drop not my BSS frames + /* Drop not my BSS frames */ if (pRxD->MyBss == 0) { { - // release packet + /* release packet */ RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); return; @@ -354,14 +354,14 @@ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) UCHAR *pData; DBGPRINT(RT_DEBUG_INFO, ("bAPSDCapable\n")); - // Qos bit 4 + /* Qos bit 4 */ pData = (PUCHAR) pHeader + LENGTH_802_11; if ((*pData >> 4) & 0x01) { DBGPRINT(RT_DEBUG_INFO, ("RxDone- Rcv EOSP frame, driver may fall into sleep\n")); pAd->CommonCfg.bInServicePeriod = FALSE; - // Force driver to fall into sleep mode when rcv EOSP frame + /* Force driver to fall into sleep mode when rcv EOSP frame */ if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { USHORT TbttNumToNextWakeUp; USHORT NextDtim = @@ -383,7 +383,7 @@ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) TbttNumToNextWakeUp = NextDtim; RTMP_SET_PSM_BIT(pAd, PWR_SAVE); - // if WMM-APSD is failed, try to disable following line + /* if WMM-APSD is failed, try to disable following line */ AsicSleepThenAutoWakeup(pAd, TbttNumToNextWakeUp); } @@ -395,58 +395,58 @@ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) ("Sending another trigger frame when More Data bit is set to 1\n")); } } - // Drop NULL, CF-ACK(no data), CF-POLL(no data), and CF-ACK+CF-POLL(no data) data frame - if ((pHeader->FC.SubType & 0x04)) // bit 2 : no DATA + /* Drop NULL, CF-ACK(no data), CF-POLL(no data), and CF-ACK+CF-POLL(no data) data frame */ + if ((pHeader->FC.SubType & 0x04)) /* bit 2 : no DATA */ { - // release packet + /* release packet */ RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); return; } - // Drop not my BSS frame (we can not only check the MyBss bit in RxD) + /* Drop not my BSS frame (we can not only check the MyBss bit in RxD) */ if (INFRA_ON(pAd)) { - // Infrastructure mode, check address 2 for BSSID + /* Infrastructure mode, check address 2 for BSSID */ if (!RTMPEqualMemory (&pHeader->Addr2, &pAd->CommonCfg.Bssid, 6)) { - // Receive frame not my BSSID - // release packet + /* Receive frame not my BSSID */ + /* release packet */ RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); return; } - } else // Ad-Hoc mode or Not associated + } else /* Ad-Hoc mode or Not associated */ { - // Ad-Hoc mode, check address 3 for BSSID + /* Ad-Hoc mode, check address 3 for BSSID */ if (!RTMPEqualMemory (&pHeader->Addr3, &pAd->CommonCfg.Bssid, 6)) { - // Receive frame not my BSSID - // release packet + /* Receive frame not my BSSID */ + /* release packet */ RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); return; } } - // - // find pEntry - // + /* */ + /* find pEntry */ + /* */ if (pRxWI->WirelessCliID < MAX_LEN_OF_MAC_TABLE) { pEntry = &pAd->MacTab.Content[pRxWI->WirelessCliID]; } else { - // 1. release packet if infra mode - // 2. new a pEntry if ad-hoc mode + /* 1. release packet if infra mode */ + /* 2. new a pEntry if ad-hoc mode */ RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); return; } - // infra or ad-hoc + /* infra or ad-hoc */ if (INFRA_ON(pAd)) { RX_BLK_SET_FLAG(pRxBlk, fRX_INFRA); ASSERT(pRxWI->WirelessCliID == BSSID_WCID); } - // check Atheros Client + /* check Atheros Client */ if ((pEntry->bIAmBadAtheros == FALSE) && (pRxD->AMPDU == 1) && (pHeader->FC.Retry)) { pEntry->bIAmBadAtheros = TRUE; @@ -461,26 +461,26 @@ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) pRxBlk->pData = (UCHAR *) pHeader; - // - // update RxBlk->pData, DataSize - // 802.11 Header, QOS, HTC, Hw Padding - // + /* */ + /* update RxBlk->pData, DataSize */ + /* 802.11 Header, QOS, HTC, Hw Padding */ + /* */ - // 1. skip 802.11 HEADER + /* 1. skip 802.11 HEADER */ { pRxBlk->pData += LENGTH_802_11; pRxBlk->DataSize -= LENGTH_802_11; } - // 2. QOS + /* 2. QOS */ if (pHeader->FC.SubType & 0x08) { RX_BLK_SET_FLAG(pRxBlk, fRX_QOS); UserPriority = *(pRxBlk->pData) & 0x0f; - // bit 7 in QoS Control field signals the HT A-MSDU format + /* bit 7 in QoS Control field signals the HT A-MSDU format */ if ((*pRxBlk->pData) & 0x80) { RX_BLK_SET_FLAG(pRxBlk, fRX_AMSDU); } - // skip QOS contorl field + /* skip QOS contorl field */ pRxBlk->pData += 2; pRxBlk->DataSize -= 2; } @@ -500,7 +500,7 @@ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) RTMP_PS_POLL_ENQUEUE(pAd); } } - // 3. Order bit: A-Ralink or HTC+ + /* 3. Order bit: A-Ralink or HTC+ */ if (pHeader->FC.Order) { #ifdef AGGREGATION_SUPPORT if ((pRxWI->PHYMODE <= MODE_OFDM) @@ -508,18 +508,18 @@ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) { RX_BLK_SET_FLAG(pRxBlk, fRX_ARALINK); } else -#endif // AGGREGATION_SUPPORT // +#endif /* AGGREGATION_SUPPORT // */ { RX_BLK_SET_FLAG(pRxBlk, fRX_HTC); - // skip HTC contorl field + /* skip HTC contorl field */ pRxBlk->pData += 4; pRxBlk->DataSize -= 4; } } - // 4. skip HW padding + /* 4. skip HW padding */ if (pRxD->L2PAD) { - // just move pData pointer - // because DataSize excluding HW padding + /* just move pData pointer */ + /* because DataSize excluding HW padding */ RX_BLK_SET_FLAG(pRxBlk, fRX_PAD); pRxBlk->pData += 2; } @@ -527,23 +527,23 @@ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) if (pRxD->BA) { RX_BLK_SET_FLAG(pRxBlk, fRX_AMPDU); } - // - // Case I Process Broadcast & Multicast data frame - // + /* */ + /* Case I Process Broadcast & Multicast data frame */ + /* */ if (pRxD->Bcast || pRxD->Mcast) { INC_COUNTER64(pAd->WlanCounters.MulticastReceivedFrameCount); - // Drop Mcast/Bcast frame with fragment bit on + /* Drop Mcast/Bcast frame with fragment bit on */ if (pHeader->FC.MoreFrag) { - // release packet + /* release packet */ RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); return; } - // Filter out Bcast frame which AP relayed for us + /* Filter out Bcast frame which AP relayed for us */ if (pHeader->FC.FrDs && MAC_ADDR_EQUAL(pHeader->Addr3, pAd->CurrentAddress)) { - // release packet + /* release packet */ RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); return; @@ -571,8 +571,8 @@ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) pAd->RalinkCounters.OneSecRxOkDataCnt++; if (!((pHeader->Frag == 0) && (pHeader->FC.MoreFrag == 0))) { - // re-assemble the fragmented packets - // return complete frame (pRxPacket) or NULL + /* re-assemble the fragmented packets */ + /* return complete frame (pRxPacket) or NULL */ bFragment = TRUE; pRxPacket = RTMPDeFragmentDataFrame(pAd, pRxBlk); } @@ -580,14 +580,14 @@ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) if (pRxPacket) { pEntry = &pAd->MacTab.Content[pRxWI->WirelessCliID]; - // process complete frame + /* process complete frame */ if (bFragment && (pRxD->Decrypted) && (pEntry->WepStatus == Ndis802_11Encryption2Enabled)) { - // Minus MIC length + /* Minus MIC length */ pRxBlk->DataSize -= 8; - // For TKIP frame, calculate the MIC value + /* For TKIP frame, calculate the MIC value */ if (STACheckTkipMICValue(pAd, pEntry, pRxBlk) == FALSE) { return; @@ -598,15 +598,15 @@ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) FromWhichBSSID); return; } else { - // just return - // because RTMPDeFragmentDataFrame() will release rx packet, - // if packet is fragmented + /* just return */ + /* because RTMPDeFragmentDataFrame() will release rx packet, */ + /* if packet is fragmented */ return; } } ASSERT(0); - // release packet + /* release packet */ RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); } @@ -631,7 +631,7 @@ VOID STAHandleRxMgmtFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) /* TODO: if MoreData == 0, station can go to sleep */ - // We should collect RSSI not only U2M data but also my beacon + /* We should collect RSSI not only U2M data but also my beacon */ if ((pHeader->FC.SubType == SUBTYPE_BEACON) && (MAC_ADDR_EQUAL(&pAd->CommonCfg.Bssid, &pHeader->Addr2)) && (pAd->RxAnt.EvaluatePeriod == 0)) { @@ -641,7 +641,7 @@ VOID STAHandleRxMgmtFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) pAd->StaCfg.LastSNR1 = (UCHAR) (pRxWI->SNR1); } - // First check the size, it MUST not exceed the mlme queue size + /* First check the size, it MUST not exceed the mlme queue size */ if (pRxWI->MPDUtotalByteCount > MGMT_DMA_BUFFER_SIZE) { DBGPRINT_ERR(("STAHandleRxMgmtFrame: frame too large, size = %d \n", pRxWI->MPDUtotalByteCount)); break; @@ -712,7 +712,7 @@ BOOLEAN STARxDoneInterruptHandle(IN PRTMP_ADAPTER pAd, IN BOOLEAN argc) RxProcessed = RxPending = 0; - // process whole rx ring + /* process whole rx ring */ while (1) { if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF | @@ -724,36 +724,36 @@ BOOLEAN STARxDoneInterruptHandle(IN PRTMP_ADAPTER pAd, IN BOOLEAN argc) } #ifdef RTMP_MAC_PCI if (RxProcessed++ > MAX_RX_PROCESS_CNT) { - // need to reschedule rx handle + /* need to reschedule rx handle */ bReschedule = TRUE; break; } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ - RxProcessed++; // test + RxProcessed++; /* test */ - // 1. allocate a new data packet into rx ring to replace received packet - // then processing the received packet - // 2. the callee must take charge of release of packet - // 3. As far as driver is concerned , - // the rx packet must - // a. be indicated to upper layer or - // b. be released if it is discarded + /* 1. allocate a new data packet into rx ring to replace received packet */ + /* then processing the received packet */ + /* 2. the callee must take charge of release of packet */ + /* 3. As far as driver is concerned , */ + /* the rx packet must */ + /* a. be indicated to upper layer or */ + /* b. be released if it is discarded */ pRxPacket = GetPacketFromRxRing(pAd, &(RxCell.RxD), &bReschedule, &RxPending); if (pRxPacket == NULL) { - // no more packet to process + /* no more packet to process */ break; } - // get rx ring descriptor + /* get rx ring descriptor */ pRxD = &(RxCell.RxD); - // get rx data buffer + /* get rx data buffer */ pData = GET_OS_PKT_DATAPTR(pRxPacket); pRxWI = (PRXWI_STRUC) pData; pHeader = (PHEADER_802_11) (pData + RXWI_SIZE); - // build RxCell + /* build RxCell */ RxCell.pRxWI = pRxWI; RxCell.pHeader = pHeader; RxCell.pRxPacket = pRxPacket; @@ -761,7 +761,7 @@ BOOLEAN STARxDoneInterruptHandle(IN PRTMP_ADAPTER pAd, IN BOOLEAN argc) RxCell.DataSize = pRxWI->MPDUtotalByteCount; RxCell.Flags = 0; - // Increase Total receive byte counter after real data received no mater any error or not + /* Increase Total receive byte counter after real data received no mater any error or not */ pAd->RalinkCounters.ReceivedByteCount += pRxWI->MPDUtotalByteCount; pAd->RalinkCounters.OneSecReceivedByteCount += @@ -780,32 +780,32 @@ BOOLEAN STARxDoneInterruptHandle(IN PRTMP_ADAPTER pAd, IN BOOLEAN argc) /* STARxDoneInterruptHandle() is called in rtusb_bulk.c */ - // Check for all RxD errors + /* Check for all RxD errors */ Status = RTMPCheckRxError(pAd, pHeader, pRxWI, pRxD); - // Handle the received frame + /* Handle the received frame */ if (Status == NDIS_STATUS_SUCCESS) { switch (pHeader->FC.Type) { - // CASE I, receive a DATA frame + /* CASE I, receive a DATA frame */ case BTYPE_DATA: { - // process DATA frame + /* process DATA frame */ STAHandleRxDataFrame(pAd, &RxCell); } break; - // CASE II, receive a MGMT frame + /* CASE II, receive a MGMT frame */ case BTYPE_MGMT: { STAHandleRxMgmtFrame(pAd, &RxCell); } break; - // CASE III. receive a CNTL frame + /* CASE III. receive a CNTL frame */ case BTYPE_CNTL: { STAHandleRxControlFrame(pAd, &RxCell); } break; - // discard other type + /* discard other type */ default: RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); @@ -813,7 +813,7 @@ BOOLEAN STARxDoneInterruptHandle(IN PRTMP_ADAPTER pAd, IN BOOLEAN argc) } } else { pAd->Counters8023.RxErrors++; - // discard this frame + /* discard this frame */ RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); } @@ -872,15 +872,15 @@ VOID STASendPackets(IN NDIS_HANDLE MiniportAdapterContext, || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS) || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) { - // Drop send request since hardware is in reset state + /* Drop send request since hardware is in reset state */ break; } else if (!INFRA_ON(pAd) && !ADHOC_ON(pAd)) { - // Drop send request since there are no physical connection yet + /* Drop send request since there are no physical connection yet */ break; } else { - // Record that orignal packet source is from NDIS layer,so that - // later on driver knows how to release this NDIS PACKET - RTMP_SET_PACKET_WCID(pPacket, 0); // this field is useless when in STA mode + /* Record that orignal packet source is from NDIS layer,so that */ + /* later on driver knows how to release this NDIS PACKET */ + RTMP_SET_PACKET_WCID(pPacket, 0); /* this field is useless when in STA mode */ RTMP_SET_PACKET_SOURCE(pPacket, PKTSRC_NDIS); NDIS_SET_PACKET_STATUS(pPacket, NDIS_STATUS_PENDING); @@ -896,7 +896,7 @@ VOID STASendPackets(IN NDIS_HANDLE MiniportAdapterContext, RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); } - // Dequeue outgoing frames from TxSwQueue[] and process it + /* Dequeue outgoing frames from TxSwQueue[] and process it */ RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); } @@ -934,16 +934,16 @@ NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) UCHAR FlgIsIP = 0; UCHAR Rate; - // Prepare packet information structure for buffer descriptor - // chained within a single NDIS packet. + /* Prepare packet information structure for buffer descriptor */ + /* chained within a single NDIS packet. */ RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); if (pSrcBufVA == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("STASendPacket --> pSrcBufVA == NULL !!!SrcBufLen=%x\n", SrcBufLen)); - // Resourece is low, system did not allocate virtual address - // return NDIS_STATUS_FAILURE directly to upper layer + /* Resourece is low, system did not allocate virtual address */ + /* return NDIS_STATUS_FAILURE directly to upper layer */ RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); return NDIS_STATUS_FAILURE; } @@ -954,8 +954,8 @@ NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); return (NDIS_STATUS_FAILURE); } - // In HT rate adhoc mode, A-MPDU is often used. So need to lookup BA Table and MAC Entry. - // Note multicast packets in adhoc also use BSSID_WCID index. + /* In HT rate adhoc mode, A-MPDU is often used. So need to lookup BA Table and MAC Entry. */ + /* Note multicast packets in adhoc also use BSSID_WCID index. */ { if (INFRA_ON(pAd)) { { @@ -978,8 +978,8 @@ NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) DBGPRINT(RT_DEBUG_ERROR, ("STASendPacket->Cannot find pEntry(%2x:%2x:%2x:%2x:%2x:%2x) in MacTab!\n", PRINT_MAC(pSrcBufVA))); - // Resourece is low, system did not allocate virtual address - // return NDIS_STATUS_FAILURE directly to upper layer + /* Resourece is low, system did not allocate virtual address */ + /* return NDIS_STATUS_FAILURE directly to upper layer */ RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); return NDIS_STATUS_FAILURE; } @@ -988,14 +988,14 @@ NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) ) { RTMP_SET_PACKET_WCID(pPacket, (UCHAR) pEntry->Aid); } - // - // Check the Ethernet Frame type of this packet, and set the RTMP_SET_PACKET_SPECIFIC flags. - // Here we set the PACKET_SPECIFIC flags(LLC, VLAN, DHCP/ARP, EAPOL). + /* */ + /* Check the Ethernet Frame type of this packet, and set the RTMP_SET_PACKET_SPECIFIC flags. */ + /* Here we set the PACKET_SPECIFIC flags(LLC, VLAN, DHCP/ARP, EAPOL). */ RTMPCheckEtherType(pAd, pPacket); - // - // WPA 802.1x secured port control - drop all non-802.1x frame before port secured - // + /* */ + /* WPA 802.1x secured port control - drop all non-802.1x frame before port secured */ + /* */ if (((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || @@ -1013,30 +1013,30 @@ NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) return (NDIS_STATUS_FAILURE); } - // STEP 1. Decide number of fragments required to deliver this MSDU. - // The estimation here is not very accurate because difficult to - // take encryption overhead into consideration here. The result - // "NumberOfFrag" is then just used to pre-check if enough free - // TXD are available to hold this MSDU. + /* STEP 1. Decide number of fragments required to deliver this MSDU. */ + /* The estimation here is not very accurate because difficult to */ + /* take encryption overhead into consideration here. The result */ + /* "NumberOfFrag" is then just used to pre-check if enough free */ + /* TXD are available to hold this MSDU. */ - if (*pSrcBufVA & 0x01) // fragmentation not allowed on multicast & broadcast + if (*pSrcBufVA & 0x01) /* fragmentation not allowed on multicast & broadcast */ NumberOfFrag = 1; else if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED)) - NumberOfFrag = 1; // Aggregation overwhelms fragmentation + NumberOfFrag = 1; /* Aggregation overwhelms fragmentation */ else if (CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_AMSDU_INUSED)) - NumberOfFrag = 1; // Aggregation overwhelms fragmentation + NumberOfFrag = 1; /* Aggregation overwhelms fragmentation */ else if ((pAd->StaCfg.HTPhyMode.field.MODE == MODE_HTMIX) || (pAd->StaCfg.HTPhyMode.field.MODE == MODE_HTGREENFIELD)) - NumberOfFrag = 1; // MIMO RATE overwhelms fragmentation + NumberOfFrag = 1; /* MIMO RATE overwhelms fragmentation */ else { - // The calculated "NumberOfFrag" is a rough estimation because of various - // encryption/encapsulation overhead not taken into consideration. This number is just - // used to make sure enough free TXD are available before fragmentation takes place. - // In case the actual required number of fragments of an NDIS packet - // excceeds "NumberOfFrag"caculated here and not enough free TXD available, the - // last fragment (i.e. last MPDU) will be dropped in RTMPHardTransmit() due to out of - // resource, and the NDIS packet will be indicated NDIS_STATUS_FAILURE. This should - // rarely happen and the penalty is just like a TX RETRY fail. Affordable. + /* The calculated "NumberOfFrag" is a rough estimation because of various */ + /* encryption/encapsulation overhead not taken into consideration. This number is just */ + /* used to make sure enough free TXD are available before fragmentation takes place. */ + /* In case the actual required number of fragments of an NDIS packet */ + /* excceeds "NumberOfFrag"caculated here and not enough free TXD available, the */ + /* last fragment (i.e. last MPDU) will be dropped in RTMPHardTransmit() due to out of */ + /* resource, and the NDIS packet will be indicated NDIS_STATUS_FAILURE. This should */ + /* rarely happen and the penalty is just like a TX RETRY fail. Affordable. */ AllowFragSize = (pAd->CommonCfg.FragmentThreshold) - LENGTH_802_11 - @@ -1044,21 +1044,21 @@ NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) NumberOfFrag = ((PacketInfo.TotalPacketLength - LENGTH_802_3 + LENGTH_802_1_H) / AllowFragSize) + 1; - // To get accurate number of fragmentation, Minus 1 if the size just match to allowable fragment size + /* To get accurate number of fragmentation, Minus 1 if the size just match to allowable fragment size */ if (((PacketInfo.TotalPacketLength - LENGTH_802_3 + LENGTH_802_1_H) % AllowFragSize) == 0) { NumberOfFrag--; } } - // Save fragment number to Ndis packet reserved field + /* Save fragment number to Ndis packet reserved field */ RTMP_SET_PACKET_FRAGMENTS(pPacket, NumberOfFrag); - // STEP 2. Check the requirement of RTS: - // If multiple fragment required, RTS is required only for the first fragment - // if the fragment size large than RTS threshold - // For RT28xx, Let ASIC send RTS/CTS -// RTMP_SET_PACKET_RTS(pPacket, 0); + /* STEP 2. Check the requirement of RTS: */ + /* If multiple fragment required, RTS is required only for the first fragment */ + /* if the fragment size large than RTS threshold */ + /* For RT28xx, Let ASIC send RTS/CTS */ +/* RTMP_SET_PACKET_RTS(pPacket, 0); */ if (NumberOfFrag > 1) RTSRequired = (pAd->CommonCfg.FragmentThreshold > @@ -1068,13 +1068,13 @@ NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) (PacketInfo.TotalPacketLength > pAd->CommonCfg.RtsThreshold) ? 1 : 0; - // Save RTS requirement to Ndis packet reserved field + /* Save RTS requirement to Ndis packet reserved field */ RTMP_SET_PACKET_RTS(pPacket, RTSRequired); RTMP_SET_PACKET_TXRATE(pPacket, pAd->CommonCfg.TxRate); - // - // STEP 3. Traffic classification. outcome = - // + /* */ + /* STEP 3. Traffic classification. outcome = */ + /* */ UserPriority = 0; QueIdx = QID_AC_BE; if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && @@ -1082,11 +1082,11 @@ NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) USHORT Protocol; UCHAR LlcSnapLen = 0, Byte0, Byte1; do { - // get Ethernet protocol field + /* get Ethernet protocol field */ Protocol = (USHORT) ((pSrcBufVA[12] << 8) + pSrcBufVA[13]); if (Protocol <= 1500) { - // get Ethernet protocol field from LLC/SNAP + /* get Ethernet protocol field from LLC/SNAP */ if (Sniff2BytesFromNdisBuffer (PacketInfo.pFirstBuffer, LENGTH_802_3 + 6, &Byte0, &Byte1) != NDIS_STATUS_SUCCESS) @@ -1095,17 +1095,17 @@ NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) Protocol = (USHORT) ((Byte0 << 8) + Byte1); LlcSnapLen = 8; } - // always AC_BE for non-IP packet + /* always AC_BE for non-IP packet */ if (Protocol != 0x0800) break; - // get IP header + /* get IP header */ if (Sniff2BytesFromNdisBuffer (PacketInfo.pFirstBuffer, LENGTH_802_3 + LlcSnapLen, &Byte0, &Byte1) != NDIS_STATUS_SUCCESS) break; - // return AC_BE if packet is not IPv4 + /* return AC_BE if packet is not IPv4 */ if ((Byte0 & 0xf0) != 0x40) break; @@ -1113,8 +1113,8 @@ NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) UserPriority = (Byte1 & 0xe0) >> 5; QueIdx = MapUserPriorityToAccessCategory[UserPriority]; - // TODO: have to check ACM bit. apply TSPEC if ACM is ON - // TODO: downgrade UP & QueIdx before passing ACM + /* TODO: have to check ACM bit. apply TSPEC if ACM is ON */ + /* TODO: downgrade UP & QueIdx before passing ACM */ /* Under WMM ACM control, we dont need to check the bit; Or when a TSPEC is built for VO but we will change to issue @@ -1129,7 +1129,7 @@ NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) RTMP_SET_PACKET_UP(pPacket, UserPriority); - // Make sure SendTxWait queue resource won't be used by other threads + /* Make sure SendTxWait queue resource won't be used by other threads */ RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); if (pAd->TxSwQueue[QueIdx].Number >= MAX_PACKETS_IN_QUEUE) { RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); @@ -1144,14 +1144,14 @@ NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) if ((pAd->CommonCfg.BACapability.field.AutoBA == TRUE) && IS_HT_STA(pEntry)) { - //PMAC_TABLE_ENTRY pMacEntry = &pAd->MacTab.Content[BSSID_WCID]; + /*PMAC_TABLE_ENTRY pMacEntry = &pAd->MacTab.Content[BSSID_WCID]; */ if (((pEntry->TXBAbitmap & (1 << UserPriority)) == 0) && ((pEntry->BADeclineBitmap & (1 << UserPriority)) == 0) && (pEntry->PortSecured == WPA_802_1X_PORT_SECURED) - // For IOT compatibility, if - // 1. It is Ralink chip or - // 2. It is OPEN or AES mode, - // then BA session can be bulit. + /* For IOT compatibility, if */ + /* 1. It is Ralink chip or */ + /* 2. It is OPEN or AES mode, */ + /* then BA session can be bulit. */ && ((pEntry->ValidAsCLI && pAd->MlmeAux.APRalinkIe != 0x0) || (pEntry->WepStatus != Ndis802_11WEPEnabled && pEntry->WepStatus != @@ -1162,7 +1162,7 @@ NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) } } - pAd->RalinkCounters.OneSecOsTxCount[QueIdx]++; // TODO: for debug only. to be removed + pAd->RalinkCounters.OneSecOsTxCount[QueIdx]++; /* TODO: for debug only. to be removed */ return NDIS_STATUS_SUCCESS; } @@ -1238,7 +1238,7 @@ NDIS_STATUS RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, return (Status); } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB /* Actually, this function used to check if the TxHardware Queue still has frame need to send. @@ -1248,7 +1248,7 @@ NDIS_STATUS RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx, IN UCHAR NumberRequired, IN PUCHAR FreeNumberIs) { - //ULONG FreeNumber = 0; + /*ULONG FreeNumber = 0; */ NDIS_STATUS Status = NDIS_STATUS_FAILURE; unsigned long IrqFlags; HT_TX_CONTEXT *pHTTXContext; @@ -1287,7 +1287,7 @@ NDIS_STATUS RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, return (Status); } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ VOID RTMPSendDisassociationFrame(IN PRTMP_ADAPTER pAd) { @@ -1300,7 +1300,7 @@ VOID RTMPSendNullFrame(IN PRTMP_ADAPTER pAd, ULONG Length; PHEADER_802_11 pHeader_802_11; - // WPA 802.1x secured port control + /* WPA 802.1x secured port control */ if (((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPAPSK) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) || @@ -1334,21 +1334,21 @@ VOID RTMPSendNullFrame(IN PRTMP_ADAPTER pAd, pAd->Sequence++; pHeader_802_11->Sequence = pAd->Sequence; - // Prepare QosNull function frame + /* Prepare QosNull function frame */ if (bQosNull) { pHeader_802_11->FC.SubType = SUBTYPE_QOS_NULL; - // copy QOS control bytes + /* copy QOS control bytes */ NullFrame[Length] = 0; NullFrame[Length + 1] = 0; - Length += 2; // if pad with 2 bytes for alignment, APSD will fail + Length += 2; /* if pad with 2 bytes for alignment, APSD will fail */ } HAL_KickOutNullFrameTx(pAd, 0, NullFrame, Length); } -// IRQL = DISPATCH_LEVEL +/* IRQL = DISPATCH_LEVEL */ VOID RTMPSendRTSFrame(IN PRTMP_ADAPTER pAd, IN PUCHAR pDA, IN unsigned int NextMpduSize, @@ -1358,19 +1358,19 @@ VOID RTMPSendRTSFrame(IN PRTMP_ADAPTER pAd, { } -// -------------------------------------------------------- -// FIND ENCRYPT KEY AND DECIDE CIPHER ALGORITHM -// Find the WPA key, either Group or Pairwise Key -// LEAP + TKIP also use WPA key. -// -------------------------------------------------------- -// Decide WEP bit and cipher suite to be used. Same cipher suite should be used for whole fragment burst -// In Cisco CCX 2.0 Leap Authentication -// WepStatus is Ndis802_11Encryption1Enabled but the key will use PairwiseKey -// Instead of the SharedKey, SharedKey Length may be Zero. +/* -------------------------------------------------------- */ +/* FIND ENCRYPT KEY AND DECIDE CIPHER ALGORITHM */ +/* Find the WPA key, either Group or Pairwise Key */ +/* LEAP + TKIP also use WPA key. */ +/* -------------------------------------------------------- */ +/* Decide WEP bit and cipher suite to be used. Same cipher suite should be used for whole fragment burst */ +/* In Cisco CCX 2.0 Leap Authentication */ +/* WepStatus is Ndis802_11Encryption1Enabled but the key will use PairwiseKey */ +/* Instead of the SharedKey, SharedKey Length may be Zero. */ VOID STAFindCipherAlgorithm(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) { - NDIS_802_11_ENCRYPTION_STATUS Cipher; // To indicate cipher used for this packet - UCHAR CipherAlg = CIPHER_NONE; // cipher alogrithm + NDIS_802_11_ENCRYPTION_STATUS Cipher; /* To indicate cipher used for this packet */ + UCHAR CipherAlg = CIPHER_NONE; /* cipher alogrithm */ UCHAR KeyIdx = 0xff; PUCHAR pSrcBufVA; PCIPHER_KEY pKey = NULL; @@ -1378,17 +1378,17 @@ VOID STAFindCipherAlgorithm(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) pSrcBufVA = GET_OS_PKT_DATAPTR(pTxBlk->pPacket); { - // Select Cipher + /* Select Cipher */ if ((*pSrcBufVA & 0x01) && (ADHOC_ON(pAd))) - Cipher = pAd->StaCfg.GroupCipher; // Cipher for Multicast or Broadcast + Cipher = pAd->StaCfg.GroupCipher; /* Cipher for Multicast or Broadcast */ else - Cipher = pAd->StaCfg.PairCipher; // Cipher for Unicast + Cipher = pAd->StaCfg.PairCipher; /* Cipher for Unicast */ if (RTMP_GET_PACKET_EAPOL(pTxBlk->pPacket)) { ASSERT(pAd->SharedKey[BSS0][0].CipherAlg <= CIPHER_CKIP128); - // 4-way handshaking frame must be clear + /* 4-way handshaking frame must be clear */ if (!(TX_BLK_TEST_FLAG(pTxBlk, fTX_bClearEAPFrame)) && (pAd->SharedKey[BSS0][0].CipherAlg) && (pAd->SharedKey[BSS0][0].KeyLen)) { @@ -1399,7 +1399,7 @@ VOID STAFindCipherAlgorithm(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) KeyIdx = pAd->StaCfg.DefaultKeyId; } else if ((Cipher == Ndis802_11Encryption2Enabled) || (Cipher == Ndis802_11Encryption3Enabled)) { - if ((*pSrcBufVA & 0x01) && (ADHOC_ON(pAd))) // multicast + if ((*pSrcBufVA & 0x01) && (ADHOC_ON(pAd))) /* multicast */ KeyIdx = pAd->StaCfg.DefaultKeyId; else if (pAd->SharedKey[BSS0][0].KeyLen) KeyIdx = 0; @@ -1419,7 +1419,7 @@ VOID STAFindCipherAlgorithm(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) WPA_802_1X_PORT_NOT_SECURED)) CipherAlg = CIPHER_NONE; else { - //Header_802_11.FC.Wep = 1; + /*Header_802_11.FC.Wep = 1; */ CipherAlg = pAd->SharedKey[BSS0][KeyIdx].CipherAlg; pKey = &pAd->SharedKey[BSS0][KeyIdx]; } @@ -1433,11 +1433,11 @@ VOID STABuildCommon802_11Header(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) { HEADER_802_11 *pHeader_802_11; - // - // MAKE A COMMON 802.11 HEADER - // + /* */ + /* MAKE A COMMON 802.11 HEADER */ + /* */ - // normal wlan header size : 24 octets + /* normal wlan header size : 24 octets */ pTxBlk->MpduHeaderLen = sizeof(HEADER_802_11); pHeader_802_11 = @@ -1469,7 +1469,7 @@ VOID STABuildCommon802_11Header(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) } } else { pHeader_802_11->Sequence = pAd->Sequence; - pAd->Sequence = (pAd->Sequence + 1) & MAXSEQ; // next sequence + pAd->Sequence = (pAd->Sequence + 1) & MAXSEQ; /* next sequence */ } pHeader_802_11->Frag = 0; @@ -1501,9 +1501,9 @@ VOID STABuildCommon802_11Header(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) if (pTxBlk->CipherAlg != CIPHER_NONE) pHeader_802_11->FC.Wep = 1; - // ----------------------------------------------------------------- - // STEP 2. MAKE A COMMON 802.11 HEADER SHARED BY ENTIRE FRAGMENT BURST. Fill sequence later. - // ----------------------------------------------------------------- + /* ----------------------------------------------------------------- */ + /* STEP 2. MAKE A COMMON 802.11 HEADER SHARED BY ENTIRE FRAGMENT BURST. Fill sequence later. */ + /* ----------------------------------------------------------------- */ if (pAd->CommonCfg.bAPSDForcePowerSave) pHeader_802_11->FC.PwrMgmt = PWR_SAVE; else @@ -1519,26 +1519,26 @@ VOID STABuildCache802_11Header(IN RTMP_ADAPTER * pAd, pHeader80211 = (PHEADER_802_11) pHeader; pMacEntry = pTxBlk->pMacEntry; - // - // Update the cached 802.11 HEADER - // + /* */ + /* Update the cached 802.11 HEADER */ + /* */ - // normal wlan header size : 24 octets + /* normal wlan header size : 24 octets */ pTxBlk->MpduHeaderLen = sizeof(HEADER_802_11); - // More Bit + /* More Bit */ pHeader80211->FC.MoreData = TX_BLK_TEST_FLAG(pTxBlk, fTX_bMoreData); - // Sequence + /* Sequence */ pHeader80211->Sequence = pMacEntry->TxSeq[pTxBlk->UserPriority]; pMacEntry->TxSeq[pTxBlk->UserPriority] = (pMacEntry->TxSeq[pTxBlk->UserPriority] + 1) & MAXSEQ; { - // Check if the frame can be sent through DLS direct link interface - // If packet can be sent through DLS, then force aggregation disable. (Hard to determine peer STA's capability) + /* Check if the frame can be sent through DLS direct link interface */ + /* If packet can be sent through DLS, then force aggregation disable. (Hard to determine peer STA's capability) */ - // The addr3 of normal packet send from DS is Dest Mac address. + /* The addr3 of normal packet send from DS is Dest Mac address. */ if (ADHOC_ON(pAd)) COPY_MAC_ADDR(pHeader80211->Addr3, pAd->CommonCfg.Bssid); @@ -1547,9 +1547,9 @@ VOID STABuildCache802_11Header(IN RTMP_ADAPTER * pAd, pTxBlk->pSrcBufHeader); } - // ----------------------------------------------------------------- - // STEP 2. MAKE A COMMON 802.11 HEADER SHARED BY ENTIRE FRAGMENT BURST. Fill sequence later. - // ----------------------------------------------------------------- + /* ----------------------------------------------------------------- */ + /* STEP 2. MAKE A COMMON 802.11 HEADER SHARED BY ENTIRE FRAGMENT BURST. Fill sequence later. */ + /* ----------------------------------------------------------------- */ if (pAd->CommonCfg.bAPSDForcePowerSave) pHeader80211->FC.PwrMgmt = PWR_SAVE; else @@ -1571,29 +1571,29 @@ static inline PUCHAR STA_Build_ARalink_Frame_Header(IN RTMP_ADAPTER * pAd, pHeaderBufPtr = &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; pHeader_802_11 = (HEADER_802_11 *) pHeaderBufPtr; - // steal "order" bit to mark "aggregation" + /* steal "order" bit to mark "aggregation" */ pHeader_802_11->FC.Order = 1; - // skip common header + /* skip common header */ pHeaderBufPtr += pTxBlk->MpduHeaderLen; if (TX_BLK_TEST_FLAG(pTxBlk, fTX_bWMM)) { - // - // build QOS Control bytes - // + /* */ + /* build QOS Control bytes */ + /* */ *pHeaderBufPtr = (pTxBlk->UserPriority & 0x0F); *(pHeaderBufPtr + 1) = 0; pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += 2; } - // padding at front of LLC header. LLC header should at 4-bytes aligment. + /* padding at front of LLC header. LLC header should at 4-bytes aligment. */ pTxBlk->HdrPadLen = (ULONG) pHeaderBufPtr; pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); pTxBlk->HdrPadLen = (ULONG) (pHeaderBufPtr - pTxBlk->HdrPadLen); - // For RA Aggregation, - // put the 2nd MSDU length(extra 2-byte field) after QOS_CONTROL in little endian format + /* For RA Aggregation, */ + /* put the 2nd MSDU length(extra 2-byte field) after QOS_CONTROL in little endian format */ pQEntry = pTxBlk->TxPacketList.Head; pNextPacket = QUEUE_ENTRY_TO_PACKET(pQEntry); nextBufLen = GET_OS_PKT_LEN(pNextPacket); @@ -1613,7 +1613,7 @@ static inline PUCHAR STA_Build_ARalink_Frame_Header(IN RTMP_ADAPTER * pAd, static inline PUCHAR STA_Build_AMSDU_Frame_Header(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) { - PUCHAR pHeaderBufPtr; //, pSaveBufPtr; + PUCHAR pHeaderBufPtr; /*, pSaveBufPtr; */ HEADER_802_11 *pHeader_802_11; STAFindCipherAlgorithm(pAd, pTxBlk); @@ -1622,31 +1622,31 @@ static inline PUCHAR STA_Build_AMSDU_Frame_Header(IN RTMP_ADAPTER * pAd, pHeaderBufPtr = &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; pHeader_802_11 = (HEADER_802_11 *) pHeaderBufPtr; - // skip common header + /* skip common header */ pHeaderBufPtr += pTxBlk->MpduHeaderLen; - // - // build QOS Control bytes - // + /* */ + /* build QOS Control bytes */ + /* */ *pHeaderBufPtr = (pTxBlk->UserPriority & 0x0F); - // - // A-MSDU packet - // + /* */ + /* A-MSDU packet */ + /* */ *pHeaderBufPtr |= 0x80; *(pHeaderBufPtr + 1) = 0; pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += 2; - //pSaveBufPtr = pHeaderBufPtr; + /*pSaveBufPtr = pHeaderBufPtr; */ - // - // padding at front of LLC header - // LLC header should locate at 4-octets aligment - // - // @@@ MpduHeaderLen excluding padding @@@ - // + /* */ + /* padding at front of LLC header */ + /* LLC header should locate at 4-octets aligment */ + /* */ + /* @@@ MpduHeaderLen excluding padding @@@ */ + /* */ pTxBlk->HdrPadLen = (ULONG) pHeaderBufPtr; pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); pTxBlk->HdrPadLen = (ULONG) (pHeaderBufPtr - pTxBlk->HdrPadLen); @@ -1680,7 +1680,7 @@ VOID STA_AMPDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) pMacEntry = pTxBlk->pMacEntry; if (pMacEntry->isCached) { - // NOTE: Please make sure the size of pMacEntry->CachedBuf[] is smaller than pTxBlk->HeaderBuf[]!!!! + /* NOTE: Please make sure the size of pMacEntry->CachedBuf[] is smaller than pTxBlk->HeaderBuf[]!!!! */ NdisMoveMemory((PUCHAR) & pTxBlk-> HeaderBuf[TXINFO_SIZE], (PUCHAR) & pMacEntry->CachedBuf[0], @@ -1699,26 +1699,26 @@ VOID STA_AMPDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) pHeader_802_11 = (HEADER_802_11 *) pHeaderBufPtr; - // skip common header + /* skip common header */ pHeaderBufPtr += pTxBlk->MpduHeaderLen; - // - // build QOS Control bytes - // + /* */ + /* build QOS Control bytes */ + /* */ *pHeaderBufPtr = (pTxBlk->UserPriority & 0x0F); *(pHeaderBufPtr + 1) = 0; pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += 2; - // - // build HTC+ - // HTC control filed following QoS field - // + /* */ + /* build HTC+ */ + /* HTC control filed following QoS field */ + /* */ if ((pAd->CommonCfg.bRdg == TRUE) && CLIENT_STATUS_TEST_FLAG(pTxBlk->pMacEntry, fCLIENT_STATUS_RDG_CAPABLE)) { if (pMacEntry->isCached == FALSE) { - // mark HTC bit + /* mark HTC bit */ pHeader_802_11->FC.Order = 1; NdisZeroMemory(pHeaderBufPtr, 4); @@ -1727,33 +1727,33 @@ VOID STA_AMPDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) pHeaderBufPtr += 4; pTxBlk->MpduHeaderLen += 4; } - //pTxBlk->MpduHeaderLen = pHeaderBufPtr - pTxBlk->HeaderBuf - TXWI_SIZE - TXINFO_SIZE; + /*pTxBlk->MpduHeaderLen = pHeaderBufPtr - pTxBlk->HeaderBuf - TXWI_SIZE - TXINFO_SIZE; */ ASSERT(pTxBlk->MpduHeaderLen >= 24); - // skip 802.3 header + /* skip 802.3 header */ pTxBlk->pSrcBufData = pTxBlk->pSrcBufHeader + LENGTH_802_3; pTxBlk->SrcBufLen -= LENGTH_802_3; - // skip vlan tag + /* skip vlan tag */ if (bVLANPkt) { pTxBlk->pSrcBufData += LENGTH_802_1Q; pTxBlk->SrcBufLen -= LENGTH_802_1Q; } - // - // padding at front of LLC header - // LLC header should locate at 4-octets aligment - // - // @@@ MpduHeaderLen excluding padding @@@ - // + /* */ + /* padding at front of LLC header */ + /* LLC header should locate at 4-octets aligment */ + /* */ + /* @@@ MpduHeaderLen excluding padding @@@ */ + /* */ pTxBlk->HdrPadLen = (ULONG) pHeaderBufPtr; pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); pTxBlk->HdrPadLen = (ULONG) (pHeaderBufPtr - pTxBlk->HdrPadLen); { - // - // Insert LLC-SNAP encapsulation - 8 octets - // + /* */ + /* Insert LLC-SNAP encapsulation - 8 octets */ + /* */ EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(pTxBlk-> pSrcBufData - 2, pTxBlk-> @@ -1762,7 +1762,7 @@ VOID STA_AMPDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) NdisMoveMemory(pHeaderBufPtr, pTxBlk->pExtraLlcSnapEncap, 6); pHeaderBufPtr += 6; - // get 2 octets (TypeofLen) + /* get 2 octets (TypeofLen) */ NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufData - 2, 2); pHeaderBufPtr += 2; @@ -1795,7 +1795,7 @@ VOID STA_AMPDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) pMacEntry->isCached = TRUE; } - // calculate Transmitted AMPDU count and ByteCount + /* calculate Transmitted AMPDU count and ByteCount */ { pAd->RalinkCounters.TransmittedMPDUsInAMPDUCount.u. LowPart++; @@ -1803,13 +1803,13 @@ VOID STA_AMPDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) QuadPart += pTxBlk->SrcBufLen; } - //FreeNumber = GET_TXRING_FREENO(pAd, QueIdx); + /*FreeNumber = GET_TXRING_FREENO(pAd, QueIdx); */ HAL_WriteTxResource(pAd, pTxBlk, TRUE, &FreeNumber); - // - // Kick out Tx - // + /* */ + /* Kick out Tx */ + /* */ if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_DISABLE_TX)) HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); @@ -1823,7 +1823,7 @@ VOID STA_AMSDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) { PUCHAR pHeaderBufPtr; USHORT FreeNumber; - USHORT subFramePayloadLen = 0; // AMSDU Subframe length without AMSDU-Header / Padding. + USHORT subFramePayloadLen = 0; /* AMSDU Subframe length without AMSDU-Header / Padding. */ USHORT totalMPDUSize = 0; UCHAR *subFrameHeader; UCHAR padding = 0; @@ -1848,11 +1848,11 @@ VOID STA_AMSDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) bVLANPkt = (RTMP_GET_PACKET_VLAN(pTxBlk->pPacket) ? TRUE : FALSE); - // skip 802.3 header + /* skip 802.3 header */ pTxBlk->pSrcBufData = pTxBlk->pSrcBufHeader + LENGTH_802_3; pTxBlk->SrcBufLen -= LENGTH_802_3; - // skip vlan tag + /* skip vlan tag */ if (bVLANPkt) { pTxBlk->pSrcBufData += LENGTH_802_1Q; pTxBlk->SrcBufLen -= LENGTH_802_1Q; @@ -1862,7 +1862,7 @@ VOID STA_AMSDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) pHeaderBufPtr = STA_Build_AMSDU_Frame_Header(pAd, pTxBlk); - // NOTE: TxWI->MPDUtotalByteCount will be updated after final frame was handled. + /* NOTE: TxWI->MPDUtotalByteCount will be updated after final frame was handled. */ RTMPWriteTxWI_Data(pAd, (PTXWI_STRUC) (&pTxBlk-> HeaderBuf @@ -1881,10 +1881,10 @@ VOID STA_AMSDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) pTxBlk->MpduHeaderLen = padding; } - // - // A-MSDU subframe - // DA(6)+SA(6)+Length(2) + LLC/SNAP Encap - // + /* */ + /* A-MSDU subframe */ + /* DA(6)+SA(6)+Length(2) + LLC/SNAP Encap */ + /* */ subFrameHeader = pHeaderBufPtr; subFramePayloadLen = pTxBlk->SrcBufLen; @@ -1893,9 +1893,9 @@ VOID STA_AMSDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) pHeaderBufPtr += LENGTH_AMSDU_SUBFRAMEHEAD; pTxBlk->MpduHeaderLen += LENGTH_AMSDU_SUBFRAMEHEAD; - // - // Insert LLC-SNAP encapsulation - 8 octets - // + /* */ + /* Insert LLC-SNAP encapsulation - 8 octets */ + /* */ EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(pTxBlk->pSrcBufData - 2, pTxBlk->pExtraLlcSnapEncap); @@ -1905,14 +1905,14 @@ VOID STA_AMSDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) NdisMoveMemory(pHeaderBufPtr, pTxBlk->pExtraLlcSnapEncap, 6); pHeaderBufPtr += 6; - // get 2 octets (TypeofLen) + /* get 2 octets (TypeofLen) */ NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufData - 2, 2); pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += LENGTH_802_1_H; subFramePayloadLen += LENGTH_802_1_H; } - // update subFrame Length field + /* update subFrame Length field */ subFrameHeader[12] = (subFramePayloadLen & 0xFF00) >> 8; subFrameHeader[13] = subFramePayloadLen & 0xFF; @@ -1932,7 +1932,7 @@ VOID STA_AMSDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) pAd->RalinkCounters.KickTxCount++; pAd->RalinkCounters.OneSecTxDoneCount++; - // calculate Transmitted AMSDU Count and ByteCount + /* calculate Transmitted AMSDU Count and ByteCount */ { pAd->RalinkCounters.TransmittedAMSDUCount.u.LowPart++; pAd->RalinkCounters.TransmittedOctetsInAMSDU.QuadPart += @@ -1944,9 +1944,9 @@ VOID STA_AMSDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) HAL_FinalWriteTxResource(pAd, pTxBlk, totalMPDUSize, FirstTx); HAL_LastTxIdx(pAd, pTxBlk->QueIdx, LastTxIdx); - // - // Kick out Tx - // + /* */ + /* Kick out Tx */ + /* */ if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_DISABLE_TX)) HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); } @@ -1985,11 +1985,11 @@ VOID STA_Legacy_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) STAFindCipherAlgorithm(pAd, pTxBlk); STABuildCommon802_11Header(pAd, pTxBlk); - // skip 802.3 header + /* skip 802.3 header */ pTxBlk->pSrcBufData = pTxBlk->pSrcBufHeader + LENGTH_802_3; pTxBlk->SrcBufLen -= LENGTH_802_3; - // skip vlan tag + /* skip vlan tag */ if (bVLANPkt) { pTxBlk->pSrcBufData += LENGTH_802_1Q; pTxBlk->SrcBufLen -= LENGTH_802_1Q; @@ -1998,13 +1998,13 @@ VOID STA_Legacy_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) pHeaderBufPtr = &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; pHeader_802_11 = (HEADER_802_11 *) pHeaderBufPtr; - // skip common header + /* skip common header */ pHeaderBufPtr += pTxBlk->MpduHeaderLen; if (TX_BLK_TEST_FLAG(pTxBlk, fTX_bWMM)) { - // - // build QOS Control bytes - // + /* */ + /* build QOS Control bytes */ + /* */ *(pHeaderBufPtr) = ((pTxBlk->UserPriority & 0x0F) | (pAd->CommonCfg. AckPolicy[pTxBlk-> @@ -2013,20 +2013,20 @@ VOID STA_Legacy_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += 2; } - // The remaining content of MPDU header should locate at 4-octets aligment + /* The remaining content of MPDU header should locate at 4-octets aligment */ pTxBlk->HdrPadLen = (ULONG) pHeaderBufPtr; pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); pTxBlk->HdrPadLen = (ULONG) (pHeaderBufPtr - pTxBlk->HdrPadLen); { - // - // Insert LLC-SNAP encapsulation - 8 octets - // - // - // if original Ethernet frame contains no LLC/SNAP, - // then an extra LLC/SNAP encap is required - // + /* */ + /* Insert LLC-SNAP encapsulation - 8 octets */ + /* */ + /* */ + /* if original Ethernet frame contains no LLC/SNAP, */ + /* then an extra LLC/SNAP encap is required */ + /* */ EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(pTxBlk->pSrcBufHeader, pTxBlk->pExtraLlcSnapEncap); if (pTxBlk->pExtraLlcSnapEncap) { @@ -2035,9 +2035,9 @@ VOID STA_Legacy_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) NdisMoveMemory(pHeaderBufPtr, pTxBlk->pExtraLlcSnapEncap, 6); pHeaderBufPtr += 6; - // skip vlan tag + /* skip vlan tag */ vlan_size = (bVLANPkt) ? LENGTH_802_1Q : 0; - // get 2 octets (TypeofLen) + /* get 2 octets (TypeofLen) */ NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufHeader + 12 + vlan_size, 2); @@ -2047,24 +2047,24 @@ VOID STA_Legacy_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) } - // - // prepare for TXWI - // use Wcid as Key Index - // + /* */ + /* prepare for TXWI */ + /* use Wcid as Key Index */ + /* */ RTMPWriteTxWI_Data(pAd, (PTXWI_STRUC) (&pTxBlk->HeaderBuf[TXINFO_SIZE]), pTxBlk); - //FreeNumber = GET_TXRING_FREENO(pAd, QueIdx); + /*FreeNumber = GET_TXRING_FREENO(pAd, QueIdx); */ HAL_WriteTxResource(pAd, pTxBlk, TRUE, &FreeNumber); pAd->RalinkCounters.KickTxCount++; pAd->RalinkCounters.OneSecTxDoneCount++; - // - // Kick out Tx - // + /* */ + /* Kick out Tx */ + /* */ if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_DISABLE_TX)) HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); } @@ -2083,7 +2083,7 @@ VOID STA_ARalink_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) ASSERT((pTxBlk->TxPacketList.Number == 2)); - FirstTx = LastTxIdx = 0; // Is it ok init they as 0? + FirstTx = LastTxIdx = 0; /* Is it ok init they as 0? */ while (pTxBlk->TxPacketList.Head) { pQEntry = RemoveHeadQueue(&pTxBlk->TxPacketList); pTxBlk->pPacket = QUEUE_ENTRY_TO_PACKET(pQEntry); @@ -2097,32 +2097,32 @@ VOID STA_ARalink_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) bVLANPkt = (RTMP_GET_PACKET_VLAN(pTxBlk->pPacket) ? TRUE : FALSE); - // skip 802.3 header + /* skip 802.3 header */ pTxBlk->pSrcBufData = pTxBlk->pSrcBufHeader + LENGTH_802_3; pTxBlk->SrcBufLen -= LENGTH_802_3; - // skip vlan tag + /* skip vlan tag */ if (bVLANPkt) { pTxBlk->pSrcBufData += LENGTH_802_1Q; pTxBlk->SrcBufLen -= LENGTH_802_1Q; } - if (frameNum == 0) { // For first frame, we need to create the 802.11 header + padding(optional) + RA-AGG-LEN + SNAP Header + if (frameNum == 0) { /* For first frame, we need to create the 802.11 header + padding(optional) + RA-AGG-LEN + SNAP Header */ pHeaderBufPtr = STA_Build_ARalink_Frame_Header(pAd, pTxBlk); - // It's ok write the TxWI here, because the TxWI->MPDUtotalByteCount - // will be updated after final frame was handled. + /* It's ok write the TxWI here, because the TxWI->MPDUtotalByteCount */ + /* will be updated after final frame was handled. */ RTMPWriteTxWI_Data(pAd, (PTXWI_STRUC) (&pTxBlk-> HeaderBuf [TXINFO_SIZE]), pTxBlk); - // - // Insert LLC-SNAP encapsulation - 8 octets - // + /* */ + /* Insert LLC-SNAP encapsulation - 8 octets */ + /* */ EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(pTxBlk-> pSrcBufData - 2, pTxBlk-> @@ -2132,23 +2132,23 @@ VOID STA_ARalink_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) NdisMoveMemory(pHeaderBufPtr, pTxBlk->pExtraLlcSnapEncap, 6); pHeaderBufPtr += 6; - // get 2 octets (TypeofLen) + /* get 2 octets (TypeofLen) */ NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufData - 2, 2); pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += LENGTH_802_1_H; } - } else { // For second aggregated frame, we need create the 802.3 header to headerBuf, because PCI will copy it to SDPtr0. + } else { /* For second aggregated frame, we need create the 802.3 header to headerBuf, because PCI will copy it to SDPtr0. */ pHeaderBufPtr = &pTxBlk->HeaderBuf[0]; pTxBlk->MpduHeaderLen = 0; - // A-Ralink sub-sequent frame header is the same as 802.3 header. - // DA(6)+SA(6)+FrameType(2) + /* A-Ralink sub-sequent frame header is the same as 802.3 header. */ + /* DA(6)+SA(6)+FrameType(2) */ NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufHeader, 12); pHeaderBufPtr += 12; - // get 2 octets (TypeofLen) + /* get 2 octets (TypeofLen) */ NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufData - 2, 2); pHeaderBufPtr += 2; @@ -2157,7 +2157,7 @@ VOID STA_ARalink_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) totalMPDUSize += pTxBlk->MpduHeaderLen + pTxBlk->SrcBufLen; - //FreeNumber = GET_TXRING_FREENO(pAd, QueIdx); + /*FreeNumber = GET_TXRING_FREENO(pAd, QueIdx); */ if (frameNum == 0) FirstTx = HAL_WriteMultiTxResource(pAd, pTxBlk, frameNum, @@ -2178,9 +2178,9 @@ VOID STA_ARalink_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) HAL_FinalWriteTxResource(pAd, pTxBlk, totalMPDUSize, FirstTx); HAL_LastTxIdx(pAd, pTxBlk->QueIdx, LastTxIdx); - // - // Kick out Tx - // + /* */ + /* Kick out Tx */ + /* */ if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_DISABLE_TX)) HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); @@ -2225,11 +2225,11 @@ VOID STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) &pTxBlk->pSrcBufHeader, &pTxBlk->SrcBufLen); } - // skip 802.3 header + /* skip 802.3 header */ pTxBlk->pSrcBufData = pTxBlk->pSrcBufHeader + LENGTH_802_3; pTxBlk->SrcBufLen -= LENGTH_802_3; - // skip vlan tag + /* skip vlan tag */ if (bVLANPkt) { pTxBlk->pSrcBufData += LENGTH_802_1Q; pTxBlk->SrcBufLen -= LENGTH_802_1Q; @@ -2238,34 +2238,34 @@ VOID STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) pHeaderBufPtr = &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; pHeader_802_11 = (HEADER_802_11 *) pHeaderBufPtr; - // skip common header + /* skip common header */ pHeaderBufPtr += pTxBlk->MpduHeaderLen; if (TX_BLK_TEST_FLAG(pTxBlk, fTX_bWMM)) { - // - // build QOS Control bytes - // + /* */ + /* build QOS Control bytes */ + /* */ *pHeaderBufPtr = (pTxBlk->UserPriority & 0x0F); *(pHeaderBufPtr + 1) = 0; pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += 2; } - // - // padding at front of LLC header - // LLC header should locate at 4-octets aligment - // + /* */ + /* padding at front of LLC header */ + /* LLC header should locate at 4-octets aligment */ + /* */ pTxBlk->HdrPadLen = (ULONG) pHeaderBufPtr; pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); pTxBlk->HdrPadLen = (ULONG) (pHeaderBufPtr - pTxBlk->HdrPadLen); - // - // Insert LLC-SNAP encapsulation - 8 octets - // - // - // if original Ethernet frame contains no LLC/SNAP, - // then an extra LLC/SNAP encap is required - // + /* */ + /* Insert LLC-SNAP encapsulation - 8 octets */ + /* */ + /* */ + /* if original Ethernet frame contains no LLC/SNAP, */ + /* then an extra LLC/SNAP encap is required */ + /* */ EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(pTxBlk->pSrcBufHeader, pTxBlk->pExtraLlcSnapEncap); if (pTxBlk->pExtraLlcSnapEncap) { @@ -2273,50 +2273,50 @@ VOID STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) NdisMoveMemory(pHeaderBufPtr, pTxBlk->pExtraLlcSnapEncap, 6); pHeaderBufPtr += 6; - // skip vlan tag + /* skip vlan tag */ vlan_size = (bVLANPkt) ? LENGTH_802_1Q : 0; - // get 2 octets (TypeofLen) + /* get 2 octets (TypeofLen) */ NdisMoveMemory(pHeaderBufPtr, pTxBlk->pSrcBufHeader + 12 + vlan_size, 2); pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += LENGTH_802_1_H; } - // If TKIP is used and fragmentation is required. Driver has to - // append TKIP MIC at tail of the scatter buffer - // MAC ASIC will only perform IV/EIV/ICV insertion but no TKIP MIC + /* If TKIP is used and fragmentation is required. Driver has to */ + /* append TKIP MIC at tail of the scatter buffer */ + /* MAC ASIC will only perform IV/EIV/ICV insertion but no TKIP MIC */ if (pTxBlk->CipherAlg == CIPHER_TKIP) { RTMPCalculateMICValue(pAd, pTxBlk->pPacket, pTxBlk->pExtraLlcSnapEncap, pTxBlk->pKey, 0); - // NOTE: DON'T refer the skb->len directly after following copy. Becasue the length is not adjust - // to correct lenght, refer to pTxBlk->SrcBufLen for the packet length in following progress. + /* NOTE: DON'T refer the skb->len directly after following copy. Becasue the length is not adjust */ + /* to correct lenght, refer to pTxBlk->SrcBufLen for the packet length in following progress. */ NdisMoveMemory(pTxBlk->pSrcBufData + pTxBlk->SrcBufLen, &pAd->PrivateInfo.Tx.MIC[0], 8); - //skb_put((RTPKT_TO_OSPKT(pTxBlk->pPacket))->tail, 8); + /*skb_put((RTPKT_TO_OSPKT(pTxBlk->pPacket))->tail, 8); */ pTxBlk->SrcBufLen += 8; pTxBlk->TotalFrameLen += 8; pTxBlk->CipherAlg = CIPHER_TKIP_NO_MIC; } - // - // calcuate the overhead bytes that encryption algorithm may add. This - // affects the calculate of "duration" field - // + /* */ + /* calcuate the overhead bytes that encryption algorithm may add. This */ + /* affects the calculate of "duration" field */ + /* */ if ((pTxBlk->CipherAlg == CIPHER_WEP64) || (pTxBlk->CipherAlg == CIPHER_WEP128)) - EncryptionOverhead = 8; //WEP: IV[4] + ICV[4]; + EncryptionOverhead = 8; /*WEP: IV[4] + ICV[4]; */ else if (pTxBlk->CipherAlg == CIPHER_TKIP_NO_MIC) - EncryptionOverhead = 12; //TKIP: IV[4] + EIV[4] + ICV[4], MIC will be added to TotalPacketLength + EncryptionOverhead = 12; /*TKIP: IV[4] + EIV[4] + ICV[4], MIC will be added to TotalPacketLength */ else if (pTxBlk->CipherAlg == CIPHER_TKIP) - EncryptionOverhead = 20; //TKIP: IV[4] + EIV[4] + ICV[4] + MIC[8] + EncryptionOverhead = 20; /*TKIP: IV[4] + EIV[4] + ICV[4] + MIC[8] */ else if (pTxBlk->CipherAlg == CIPHER_AES) - EncryptionOverhead = 16; // AES: IV[4] + EIV[4] + MIC[8] + EncryptionOverhead = 16; /* AES: IV[4] + EIV[4] + MIC[8] */ else EncryptionOverhead = 0; pTransmit = pTxBlk->pTransmit; - // Decide the TX rate + /* Decide the TX rate */ if (pTransmit->field.MODE == MODE_CCK) pTxBlk->TxRate = pTransmit->field.MCS; else if (pTransmit->field.MODE == MODE_OFDM) @@ -2324,7 +2324,7 @@ VOID STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) else pTxBlk->TxRate = RATE_6_5; - // decide how much time an ACK/CTS frame will consume in the air + /* decide how much time an ACK/CTS frame will consume in the air */ if (pTxBlk->TxRate <= RATE_LAST_OFDM_RATE) AckDuration = RTMPCalcDuration(pAd, @@ -2334,7 +2334,7 @@ VOID STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) else AckDuration = RTMPCalcDuration(pAd, RATE_6_5, 14); - // Init the total payload length of this frame. + /* Init the total payload length of this frame. */ SrcRemainingBytes = pTxBlk->SrcBufLen; pTxBlk->TotalFragNum = 0xff; @@ -2345,7 +2345,7 @@ VOID STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) FreeMpduSize -= pTxBlk->MpduHeaderLen; - if (SrcRemainingBytes <= FreeMpduSize) { // this is the last or only fragment + if (SrcRemainingBytes <= FreeMpduSize) { /* this is the last or only fragment */ pTxBlk->SrcBufLen = SrcRemainingBytes; @@ -2353,9 +2353,9 @@ VOID STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) pHeader_802_11->Duration = pAd->CommonCfg.Dsifs + AckDuration; - // Indicate the lower layer that this's the last fragment. + /* Indicate the lower layer that this's the last fragment. */ pTxBlk->TotalFragNum = fragNum; - } else { // more fragment is required + } else { /* more fragment is required */ pTxBlk->SrcBufLen = FreeMpduSize; @@ -2384,9 +2384,9 @@ VOID STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) pAd->RalinkCounters.KickTxCount++; pAd->RalinkCounters.OneSecTxDoneCount++; - // Update the frame number, remaining size of the NDIS packet payload. + /* Update the frame number, remaining size of the NDIS packet payload. */ - // space for 802.11 header. + /* space for 802.11 header. */ if (fragNum == 0 && pTxBlk->pExtraLlcSnapEncap) pTxBlk->MpduHeaderLen -= LENGTH_802_1_H; @@ -2394,13 +2394,13 @@ VOID STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) SrcRemainingBytes -= pTxBlk->SrcBufLen; pTxBlk->pSrcBufData += pTxBlk->SrcBufLen; - pHeader_802_11->Frag++; // increase Frag # + pHeader_802_11->Frag++; /* increase Frag # */ } while (SrcRemainingBytes > 0); - // - // Kick out Tx - // + /* */ + /* Kick out Tx */ + /* */ if (!RTMP_TEST_PSFLAG(pAd, fRTMP_PS_DISABLE_TX)) HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); } @@ -2440,10 +2440,10 @@ NDIS_STATUS STAHardTransmit(IN PRTMP_ADAPTER pAd, NDIS_PACKET *pPacket; PQUEUE_ENTRY pQEntry; - // --------------------------------------------- - // STEP 0. DO SANITY CHECK AND SOME EARLY PREPARATION. - // --------------------------------------------- - // + /* --------------------------------------------- */ + /* STEP 0. DO SANITY CHECK AND SOME EARLY PREPARATION. */ + /* --------------------------------------------- */ + /* */ ASSERT(pTxBlk->TxPacketList.Number); if (pTxBlk->TxPacketList.Head == NULL) { DBGPRINT(RT_DEBUG_ERROR, @@ -2454,23 +2454,23 @@ NDIS_STATUS STAHardTransmit(IN PRTMP_ADAPTER pAd, pPacket = QUEUE_ENTRY_TO_PACKET(pTxBlk->TxPacketList.Head); - // ------------------------------------------------------------------ - // STEP 1. WAKE UP PHY - // outgoing frame always wakeup PHY to prevent frame lost and - // turn off PSM bit to improve performance - // ------------------------------------------------------------------ - // not to change PSM bit, just send this frame out? + /* ------------------------------------------------------------------ */ + /* STEP 1. WAKE UP PHY */ + /* outgoing frame always wakeup PHY to prevent frame lost and */ + /* turn off PSM bit to improve performance */ + /* ------------------------------------------------------------------ */ + /* not to change PSM bit, just send this frame out? */ if ((pAd->StaCfg.Psm == PWR_SAVE) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { DBGPRINT_RAW(RT_DEBUG_INFO, ("AsicForceWakeup At HardTx\n")); #ifdef RTMP_MAC_PCI AsicForceWakeup(pAd, TRUE); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_FORCE_WAKE_UP, NULL, 0); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ } - // It should not change PSM bit, when APSD turn on. + /* It should not change PSM bit, when APSD turn on. */ if ((! (pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable) @@ -2504,7 +2504,7 @@ NDIS_STATUS STAHardTransmit(IN PRTMP_ADAPTER pAd, break; default: { - // It should not happened! + /* It should not happened! */ DBGPRINT(RT_DEBUG_ERROR, ("Send a pacekt was not classified!! It should not happen!\n")); while (pTxBlk->TxPacketList.Number) { @@ -2544,7 +2544,7 @@ VOID Sta_Announce_or_Forward_802_3_Packet(IN PRTMP_ADAPTER pAd, if (TRUE) { announce_802_3_packet(pAd, pPacket); } else { - // release packet + /* release packet */ RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); } } diff --git a/drivers/staging/rt2860/sta/sanity.c b/drivers/staging/rt2860/sta/sanity.c index 3986478bf281..ba6eaf670f10 100644 --- a/drivers/staging/rt2860/sta/sanity.c +++ b/drivers/staging/rt2860/sta/sanity.c @@ -86,7 +86,7 @@ BOOLEAN MlmeStartReqSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ -BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen, OUT PUCHAR pAddr2, OUT USHORT * pCapabilityInfo, OUT USHORT * pStatus, OUT USHORT * pAid, OUT UCHAR SupRate[], OUT UCHAR * pSupRateLen, OUT UCHAR ExtRate[], OUT UCHAR * pExtRateLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT ADD_HT_INFO_IE * pAddHtInfo, // AP might use this additional ht info IE +BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen, OUT PUCHAR pAddr2, OUT USHORT * pCapabilityInfo, OUT USHORT * pStatus, OUT USHORT * pAid, OUT UCHAR SupRate[], OUT UCHAR * pSupRateLen, OUT UCHAR ExtRate[], OUT UCHAR * pExtRateLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ OUT UCHAR * pHtCapabilityLen, OUT UCHAR * pAddHtInfoLen, OUT UCHAR * pNewExtChannelOffset, @@ -118,10 +118,10 @@ BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen NdisMoveMemory(pAid, &pFrame->Octet[4], 2); Length += 2; - // Aid already swaped byte order in RTMPFrameEndianChange() for big endian platform - *pAid = (*pAid) & 0x3fff; // AID is low 14-bit + /* Aid already swaped byte order in RTMPFrameEndianChange() for big endian platform */ + *pAid = (*pAid) & 0x3fff; /* AID is low 14-bit */ - // -- get supported rates from payload and advance the pointer + /* -- get supported rates from payload and advance the pointer */ IeType = pFrame->Octet[6]; *pSupRateLen = pFrame->Octet[7]; if ((IeType != IE_SUPP_RATES) @@ -134,11 +134,11 @@ BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen Length = Length + 2 + *pSupRateLen; - // many AP implement proprietary IEs in non-standard order, we'd better - // tolerate mis-ordered IEs to get best compatibility + /* many AP implement proprietary IEs in non-standard order, we'd better */ + /* tolerate mis-ordered IEs to get best compatibility */ pEid = (PEID_STRUCT) & pFrame->Octet[8 + (*pSupRateLen)]; - // get variable fields from payload and advance the pointer + /* get variable fields from payload and advance the pointer */ while ((Length + 2 + pEid->Len) <= MsgLen) { switch (pEid->Eid) { case IE_EXT_SUPP_RATES: @@ -150,7 +150,7 @@ BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen case IE_HT_CAP: case IE_HT_CAP2: - if (pEid->Len >= SIZE_HT_CAP_IE) //Note: allow extension.!! + if (pEid->Len >= SIZE_HT_CAP_IE) /*Note: allow extension.!! */ { NdisMoveMemory(pHtCapability, pEid->Octet, SIZE_HT_CAP_IE); @@ -172,8 +172,8 @@ BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen case IE_ADD_HT: case IE_ADD_HT2: if (pEid->Len >= sizeof(ADD_HT_INFO_IE)) { - // This IE allows extension, but we can ignore extra bytes beyond our knowledge , so only - // copy first sizeof(ADD_HT_INFO_IE) + /* This IE allows extension, but we can ignore extra bytes beyond our knowledge , so only */ + /* copy first sizeof(ADD_HT_INFO_IE) */ NdisMoveMemory(pAddHtInfo, pEid->Octet, sizeof(ADD_HT_INFO_IE)); @@ -201,31 +201,31 @@ BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen break; case IE_VENDOR_SPECIFIC: - // handle WME PARAMTER ELEMENT + /* handle WME PARAMTER ELEMENT */ if (NdisEqualMemory(pEid->Octet, WME_PARM_ELEM, 6) && (pEid->Len == 24)) { PUCHAR ptr; int i; - // parsing EDCA parameters + /* parsing EDCA parameters */ pEdcaParm->bValid = TRUE; - pEdcaParm->bQAck = FALSE; // pEid->Octet[0] & 0x10; - pEdcaParm->bQueueRequest = FALSE; // pEid->Octet[0] & 0x20; - pEdcaParm->bTxopRequest = FALSE; // pEid->Octet[0] & 0x40; - //pEdcaParm->bMoreDataAck = FALSE; // pEid->Octet[0] & 0x80; + pEdcaParm->bQAck = FALSE; /* pEid->Octet[0] & 0x10; */ + pEdcaParm->bQueueRequest = FALSE; /* pEid->Octet[0] & 0x20; */ + pEdcaParm->bTxopRequest = FALSE; /* pEid->Octet[0] & 0x40; */ + /*pEdcaParm->bMoreDataAck = FALSE; // pEid->Octet[0] & 0x80; */ pEdcaParm->EdcaUpdateCount = pEid->Octet[6] & 0x0f; pEdcaParm->bAPSDCapable = (pEid->Octet[6] & 0x80) ? 1 : 0; ptr = (PUCHAR) & pEid->Octet[8]; for (i = 0; i < 4; i++) { - UCHAR aci = (*ptr & 0x60) >> 5; // b5~6 is AC INDEX - pEdcaParm->bACM[aci] = (((*ptr) & 0x10) == 0x10); // b5 is ACM - pEdcaParm->Aifsn[aci] = (*ptr) & 0x0f; // b0~3 is AIFSN - pEdcaParm->Cwmin[aci] = *(ptr + 1) & 0x0f; // b0~4 is Cwmin - pEdcaParm->Cwmax[aci] = *(ptr + 1) >> 4; // b5~8 is Cwmax - pEdcaParm->Txop[aci] = *(ptr + 2) + 256 * (*(ptr + 3)); // in unit of 32-us - ptr += 4; // point to next AC + UCHAR aci = (*ptr & 0x60) >> 5; /* b5~6 is AC INDEX */ + pEdcaParm->bACM[aci] = (((*ptr) & 0x10) == 0x10); /* b5 is ACM */ + pEdcaParm->Aifsn[aci] = (*ptr) & 0x0f; /* b0~3 is AIFSN */ + pEdcaParm->Cwmin[aci] = *(ptr + 1) & 0x0f; /* b0~4 is Cwmin */ + pEdcaParm->Cwmax[aci] = *(ptr + 1) >> 4; /* b5~8 is Cwmax */ + pEdcaParm->Txop[aci] = *(ptr + 2) + 256 * (*(ptr + 3)); /* in unit of 32-us */ + ptr += 4; /* point to next AC */ } } break; @@ -280,7 +280,7 @@ BOOLEAN PeerProbeReqSanity(IN PRTMP_ADAPTER pAd, Idx = *pSsidLen + 2; - // -- get supported rates from payload and advance the pointer + /* -- get supported rates from payload and advance the pointer */ IeType = pFrame->Octet[Idx]; RateLen = pFrame->Octet[Idx + 1]; if (IeType != IE_SUPP_RATES) { @@ -319,15 +319,15 @@ BOOLEAN GetTimBit(IN CHAR * Ptr, IdxPtr++; *TimLen = *IdxPtr; - // get DTIM Count from TIM element + /* get DTIM Count from TIM element */ IdxPtr++; *DtimCount = *IdxPtr; - // get DTIM Period from TIM element + /* get DTIM Period from TIM element */ IdxPtr++; *DtimPeriod = *IdxPtr; - // get Bitmap Control from TIM element + /* get Bitmap Control from TIM element */ IdxPtr++; BitCntl = *IdxPtr; @@ -336,20 +336,20 @@ BOOLEAN GetTimBit(IN CHAR * Ptr, else *BcastFlag = FALSE; - // Parse Partial Virtual Bitmap from TIM element - N1 = BitCntl & 0xfe; // N1 is the first bitmap byte# - N2 = *TimLen - 4 + N1; // N2 is the last bitmap byte# + /* Parse Partial Virtual Bitmap from TIM element */ + N1 = BitCntl & 0xfe; /* N1 is the first bitmap byte# */ + N2 = *TimLen - 4 + N1; /* N2 is the last bitmap byte# */ if ((Aid < (N1 << 3)) || (Aid >= ((N2 + 1) << 3))) *MessageToMe = FALSE; else { - MyByte = (Aid >> 3) - N1; // my byte position in the bitmap byte-stream + MyByte = (Aid >> 3) - N1; /* my byte position in the bitmap byte-stream */ MyBit = Aid % 16 - ((MyByte & 0x01) ? 8 : 0); IdxPtr += (MyByte + 1); - //if (*IdxPtr) - // DBGPRINT(RT_DEBUG_WARN, ("TIM bitmap = 0x%02x\n", *IdxPtr)); + /*if (*IdxPtr) */ + /* DBGPRINT(RT_DEBUG_WARN, ("TIM bitmap = 0x%02x\n", *IdxPtr)); */ if (*IdxPtr & (0x01 << MyBit)) *MessageToMe = TRUE; diff --git a/drivers/staging/rt2860/sta/sync.c b/drivers/staging/rt2860/sta/sync.c index 56bb797e61a3..12ab2d40b0b9 100644 --- a/drivers/staging/rt2860/sta/sync.c +++ b/drivers/staging/rt2860/sta/sync.c @@ -37,7 +37,7 @@ */ #include "../rt_config.h" -#define ADHOC_ENTRY_BEACON_LOST_TIME (2*OS_HZ) // 2 sec +#define ADHOC_ENTRY_BEACON_LOST_TIME (2*OS_HZ) /* 2 sec */ /* ========================================================================== @@ -57,7 +57,7 @@ VOID SyncStateMachineInit(IN PRTMP_ADAPTER pAd, (STATE_MACHINE_FUNC) Drop, SYNC_IDLE, SYNC_MACHINE_BASE); - // column 1 + /* column 1 */ StateMachineSetAction(Sm, SYNC_IDLE, MT2_MLME_SCAN_REQ, (STATE_MACHINE_FUNC) MlmeScanReqAction); StateMachineSetAction(Sm, SYNC_IDLE, MT2_MLME_JOIN_REQ, @@ -69,7 +69,7 @@ VOID SyncStateMachineInit(IN PRTMP_ADAPTER pAd, StateMachineSetAction(Sm, SYNC_IDLE, MT2_PEER_PROBE_REQ, (STATE_MACHINE_FUNC) PeerProbeReqAction); - //column 2 + /*column 2 */ StateMachineSetAction(Sm, JOIN_WAIT_BEACON, MT2_MLME_SCAN_REQ, (STATE_MACHINE_FUNC) InvalidStateWhenScan); StateMachineSetAction(Sm, JOIN_WAIT_BEACON, MT2_MLME_JOIN_REQ, @@ -81,7 +81,7 @@ VOID SyncStateMachineInit(IN PRTMP_ADAPTER pAd, StateMachineSetAction(Sm, JOIN_WAIT_BEACON, MT2_BEACON_TIMEOUT, (STATE_MACHINE_FUNC) BeaconTimeoutAtJoinAction); - // column 3 + /* column 3 */ StateMachineSetAction(Sm, SCAN_LISTEN, MT2_MLME_SCAN_REQ, (STATE_MACHINE_FUNC) InvalidStateWhenScan); StateMachineSetAction(Sm, SCAN_LISTEN, MT2_MLME_JOIN_REQ, @@ -95,7 +95,7 @@ VOID SyncStateMachineInit(IN PRTMP_ADAPTER pAd, StateMachineSetAction(Sm, SCAN_LISTEN, MT2_SCAN_TIMEOUT, (STATE_MACHINE_FUNC) ScanTimeoutAction); - // timer init + /* timer init */ RTMPInitTimer(pAd, &pAd->MlmeAux.BeaconTimer, GET_TIMER_FUNCTION(BeaconTimeout), pAd, FALSE); RTMPInitTimer(pAd, &pAd->MlmeAux.ScanTimer, @@ -119,8 +119,8 @@ VOID BeaconTimeout(IN PVOID SystemSpecific1, DBGPRINT(RT_DEBUG_TRACE, ("SYNC - BeaconTimeout\n")); - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt + /* Do nothing if the driver is starting halt state. */ + /* This might happen when timer already been fired before cancel timer with mlmehalt */ if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) return; @@ -157,15 +157,15 @@ VOID ScanTimeout(IN PVOID SystemSpecific1, { RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; - // Do nothing if the driver is starting halt state. - // This might happen when timer already been fired before cancel timer with mlmehalt + /* Do nothing if the driver is starting halt state. */ + /* This might happen when timer already been fired before cancel timer with mlmehalt */ if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) return; if (MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_SCAN_TIMEOUT, 0, NULL)) { RTMP_MLME_HANDLER(pAd); } else { - // To prevent SyncMachine.CurrState is SCAN_LISTEN forever. + /* To prevent SyncMachine.CurrState is SCAN_LISTEN forever. */ pAd->MlmeAux.Channel = 0; ScanNextChannel(pAd); if (pAd->CommonCfg.bWirelessEvent) { @@ -193,14 +193,14 @@ VOID MlmeScanReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) PUCHAR pOutBuffer = NULL; NDIS_STATUS NStatus; - // Check the total scan tries for one single OID command - // If this is the CCX 2.0 Case, skip that! + /* Check the total scan tries for one single OID command */ + /* If this is the CCX 2.0 Case, skip that! */ if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_START_UP)) { DBGPRINT(RT_DEBUG_TRACE, ("SYNC - MlmeScanReqAction before Startup\n")); return; } - // Increase the scan retry counters. + /* Increase the scan retry counters. */ pAd->StaCfg.ScanCnt++; #ifdef RTMP_MAC_PCI @@ -219,24 +219,24 @@ VOID MlmeScanReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); } } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ - // first check the parameter sanity + /* first check the parameter sanity */ if (MlmeScanReqSanity(pAd, Elem->Msg, Elem->MsgLen, &BssType, (PCHAR) Ssid, &SsidLen, &ScanType)) { - // Check for channel load and noise hist request - // Suspend MSDU only at scan request, not the last two mentioned - // Suspend MSDU transmission here + /* Check for channel load and noise hist request */ + /* Suspend MSDU only at scan request, not the last two mentioned */ + /* Suspend MSDU transmission here */ RTMPSuspendMsduTransmission(pAd); - // - // To prevent data lost. - // Send an NULL data with turned PSM bit on to current associated AP before SCAN progress. - // And should send an NULL data with turned PSM bit off to AP, when scan progress done - // + /* */ + /* To prevent data lost. */ + /* Send an NULL data with turned PSM bit on to current associated AP before SCAN progress. */ + /* And should send an NULL data with turned PSM bit off to AP, when scan progress done */ + /* */ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) && (INFRA_ON(pAd))) { NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); @@ -250,7 +250,7 @@ VOID MlmeScanReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pHdr80211->FC.Type = BTYPE_DATA; pHdr80211->FC.PwrMgmt = PWR_SAVE; - // Send using priority queue + /* Send using priority queue */ MiniportMMRequest(pAd, 0, pOutBuffer, sizeof(HEADER_802_11)); DBGPRINT(RT_DEBUG_TRACE, @@ -262,21 +262,21 @@ VOID MlmeScanReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) NdisGetSystemUpTime(&Now); pAd->StaCfg.LastScanTime = Now; - // reset all the timers + /* reset all the timers */ RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &TimerCancelled); RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &TimerCancelled); - // record desired BSS parameters + /* record desired BSS parameters */ pAd->MlmeAux.BssType = BssType; pAd->MlmeAux.ScanType = ScanType; pAd->MlmeAux.SsidLen = SsidLen; NdisZeroMemory(pAd->MlmeAux.Ssid, MAX_LEN_OF_SSID); NdisMoveMemory(pAd->MlmeAux.Ssid, Ssid, SsidLen); - // start from the first channel + /* start from the first channel */ pAd->MlmeAux.Channel = FirstChannel(pAd); - // Let BBP register at 20MHz to do scan + /* Let BBP register at 20MHz to do scan */ RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); BBPValue &= (~0x18); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); @@ -324,18 +324,18 @@ VOID MlmeJoinReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) { RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ - // reset all the timers + /* reset all the timers */ RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &TimerCancelled); RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &TimerCancelled); pBss = &pAd->MlmeAux.SsidBssTab.BssEntry[pInfo->BssIdx]; - // record the desired SSID & BSSID we're waiting for + /* record the desired SSID & BSSID we're waiting for */ COPY_MAC_ADDR(pAd->MlmeAux.Bssid, pBss->Bssid); - // If AP's SSID is not hidden, it is OK for updating ssid to MlmeAux again. + /* If AP's SSID is not hidden, it is OK for updating ssid to MlmeAux again. */ if (pBss->Hidden == 0) { RTMPZeroMemory(pAd->MlmeAux.Ssid, MAX_LEN_OF_SSID); NdisMoveMemory(pAd->MlmeAux.Ssid, pBss->Ssid, pBss->SsidLen); @@ -346,14 +346,14 @@ VOID MlmeJoinReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->MlmeAux.Channel = pBss->Channel; pAd->MlmeAux.CentralChannel = pBss->CentralChannel; - // Let BBP register at 20MHz to do scan + /* Let BBP register at 20MHz to do scan */ RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); BBPValue &= (~0x18); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue); DBGPRINT(RT_DEBUG_TRACE, ("SYNC - BBP R4 to 20MHz.l\n")); - // switch channel and waiting for beacon timer + /* switch channel and waiting for beacon timer */ AsicSwitchChannel(pAd, pAd->MlmeAux.Channel, FALSE); AsicLockChannel(pAd, pAd->MlmeAux.Channel); RTMPSetTimer(&pAd->MlmeAux.BeaconTimer, JOIN_TIMEOUT); @@ -363,15 +363,15 @@ VOID MlmeJoinReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) (pAd->MlmeAux.Channel > 14) && RadarChannelCheck(pAd, pAd->MlmeAux.Channel)) ) { - // - // We can't send any Probe request frame to meet 802.11h. - // + /* */ + /* We can't send any Probe request frame to meet 802.11h. */ + /* */ if (pBss->Hidden == 0) break; } - // - // send probe request - // + /* */ + /* send probe request */ + /* */ NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); if (NStatus == NDIS_STATUS_SUCCESS) { if (pAd->MlmeAux.Channel <= 14) { @@ -380,9 +380,9 @@ VOID MlmeJoinReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pExtRate = pAd->CommonCfg.ExtRate; ExtRateLen = pAd->CommonCfg.ExtRateLen; } else { - // - // Overwrite Support Rate, CCK rate are not allowed - // + /* */ + /* Overwrite Support Rate, CCK rate are not allowed */ + /* */ pSupRate = ASupRate; SupRateLen = ASupRateLen; ExtRateLen = 0; @@ -442,14 +442,14 @@ VOID MlmeStartReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) UCHAR Ssid[MAX_LEN_OF_SSID], SsidLen; BOOLEAN TimerCancelled; - // New for WPA security suites - UCHAR VarIE[MAX_VIE_LEN]; // Total VIE length = MAX_VIE_LEN - -5 + /* New for WPA security suites */ + UCHAR VarIE[MAX_VIE_LEN]; /* Total VIE length = MAX_VIE_LEN - -5 */ NDIS_802_11_VARIABLE_IEs *pVIE = NULL; LARGE_INTEGER TimeStamp; BOOLEAN Privacy; USHORT Status; - // Init Variable IE structure + /* Init Variable IE structure */ pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; pVIE->Length = 0; TimeStamp.u.LowPart = 0; @@ -457,20 +457,20 @@ VOID MlmeStartReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if (MlmeStartReqSanity (pAd, Elem->Msg, Elem->MsgLen, (PCHAR) Ssid, &SsidLen)) { - // reset all the timers + /* reset all the timers */ RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &TimerCancelled); RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &TimerCancelled); - // - // Start a new IBSS. All IBSS parameters are decided now.... - // + /* */ + /* Start a new IBSS. All IBSS parameters are decided now.... */ + /* */ DBGPRINT(RT_DEBUG_TRACE, ("MlmeStartReqAction - Start a new IBSS. All IBSS parameters are decided now.... \n")); pAd->MlmeAux.BssType = BSS_ADHOC; NdisMoveMemory(pAd->MlmeAux.Ssid, Ssid, SsidLen); pAd->MlmeAux.SsidLen = SsidLen; - // generate a radom number as BSSID + /* generate a radom number as BSSID */ MacAddrRandomBssid(pAd, pAd->MlmeAux.Bssid); DBGPRINT(RT_DEBUG_TRACE, ("MlmeStartReqAction - generate a radom number as BSSID \n")); @@ -507,7 +507,7 @@ VOID MlmeStartReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) &pAd->MlmeAux.HtCapability, &pAd->MlmeAux.AddHtInfo); pAd->MlmeAux.HtCapabilityLen = sizeof(HT_CAPABILITY_IE); - // Not turn pAd->StaActive.SupportedHtPhy.bHtEnable = TRUE here. + /* Not turn pAd->StaActive.SupportedHtPhy.bHtEnable = TRUE here. */ DBGPRINT(RT_DEBUG_TRACE, ("SYNC -pAd->StaActive.SupportedHtPhy.bHtEnable = TRUE\n")); } else { @@ -516,7 +516,7 @@ VOID MlmeStartReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) NdisZeroMemory(&pAd->StaActive.SupportedPhyInfo. MCSSet[0], 16); } - // temporarily not support QOS in IBSS + /* temporarily not support QOS in IBSS */ NdisZeroMemory(&pAd->MlmeAux.APEdcaParm, sizeof(EDCA_PARM)); NdisZeroMemory(&pAd->MlmeAux.APQbssLoad, sizeof(QBSS_LOAD_PARM)); @@ -570,17 +570,17 @@ VOID PeerBeaconAtScanAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) QBSS_LOAD_PARM QbssLoad; QOS_CAPABILITY_PARM QosCapability; ULONG RalinkIe; - UCHAR VarIE[MAX_VIE_LEN]; // Total VIE length = MAX_VIE_LEN - -5 + UCHAR VarIE[MAX_VIE_LEN]; /* Total VIE length = MAX_VIE_LEN - -5 */ NDIS_802_11_VARIABLE_IEs *pVIE = NULL; HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE + ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ UCHAR HtCapabilityLen = 0, PreNHtCapabilityLen = 0; UCHAR AddHtInfoLen; UCHAR NewExtChannelOffset = 0xff; - // NdisFillMemory(Ssid, MAX_LEN_OF_SSID, 0x00); + /* NdisFillMemory(Ssid, MAX_LEN_OF_SSID, 0x00); */ pFrame = (PFRAME_802_11) Elem->Msg; - // Init Variable IE structure + /* Init Variable IE structure */ pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; pVIE->Length = 0; @@ -659,7 +659,7 @@ VOID PeerBeaconAtScanAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } - // sanity check fail, ignored + /* sanity check fail, ignored */ } /* @@ -688,19 +688,19 @@ VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) QBSS_LOAD_PARM QbssLoad; QOS_CAPABILITY_PARM QosCapability; USHORT Status; - UCHAR VarIE[MAX_VIE_LEN]; // Total VIE length = MAX_VIE_LEN - -5 + UCHAR VarIE[MAX_VIE_LEN]; /* Total VIE length = MAX_VIE_LEN - -5 */ NDIS_802_11_VARIABLE_IEs *pVIE = NULL; ULONG RalinkIe; ULONG Idx; HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE + ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ UCHAR HtCapabilityLen = 0, PreNHtCapabilityLen = 0; UCHAR AddHtInfoLen; UCHAR NewExtChannelOffset = 0xff; UCHAR CentralChannel; BOOLEAN bAllowNrate = FALSE; - // Init Variable IE structure + /* Init Variable IE structure */ pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; pVIE->Length = 0; RTMPZeroMemory(&HtCapability, sizeof(HtCapability)); @@ -743,18 +743,18 @@ VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) &AddHtInfoLen, &AddHtInfo, &NewExtChannelOffset, &LenVIE, pVIE)) { - // Disqualify 11b only adhoc when we are in 11g only adhoc mode + /* Disqualify 11b only adhoc when we are in 11g only adhoc mode */ if ((BssType == BSS_ADHOC) && (pAd->CommonCfg.PhyMode == PHY_11G) && ((SupRateLen + ExtRateLen) < 12)) return; - // BEACON from desired BSS/IBSS found. We should be able to decide most - // BSS parameters here. - // Q. But what happen if this JOIN doesn't conclude a successful ASSOCIATEION? - // Do we need to receover back all parameters belonging to previous BSS? - // A. Should be not. There's no back-door recover to previous AP. It still need - // a new JOIN-AUTH-ASSOC sequence. + /* BEACON from desired BSS/IBSS found. We should be able to decide most */ + /* BSS parameters here. */ + /* Q. But what happen if this JOIN doesn't conclude a successful ASSOCIATEION? */ + /* Do we need to receover back all parameters belonging to previous BSS? */ + /* A. Should be not. There's no back-door recover to previous AP. It still need */ + /* a new JOIN-AUTH-ASSOC sequence. */ if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, Bssid)) { DBGPRINT(RT_DEBUG_TRACE, ("SYNC - receive desired BEACON at JoinWaitBeacon... Channel = %d\n", @@ -762,7 +762,7 @@ VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &TimerCancelled); - // Update RSSI to prevent No signal display when cards first initialized + /* Update RSSI to prevent No signal display when cards first initialized */ pAd->StaCfg.RssiSample.LastRssi0 = ConvertToRssi(pAd, Elem->Rssi0, RSSI_0); pAd->StaCfg.RssiSample.LastRssi1 = @@ -782,10 +782,10 @@ VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->StaCfg.RssiSample.AvgRssi2X8 = pAd->StaCfg.RssiSample.AvgRssi2 << 3; - // - // We need to check if SSID only set to any, then we can record the current SSID. - // Otherwise will cause hidden SSID association failed. - // + /* */ + /* We need to check if SSID only set to any, then we can record the current SSID. */ + /* Otherwise will cause hidden SSID association failed. */ + /* */ if (pAd->MlmeAux.SsidLen == 0) { NdisMoveMemory(pAd->MlmeAux.Ssid, Ssid, SsidLen); @@ -858,9 +858,9 @@ VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) CapabilityInfo; } } else { - // - // Multiple SSID case, used correct CapabilityInfo - // + /* */ + /* Multiple SSID case, used correct CapabilityInfo */ + /* */ CapabilityInfo = pAd->ScanTab.BssEntry[Idx]. CapabilityInfo; @@ -877,8 +877,8 @@ VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->MlmeAux.CfpMaxDuration = Cf.CfpMaxDuration; pAd->MlmeAux.APRalinkIe = RalinkIe; - // Copy AP's supported rate to MlmeAux for creating assoication request - // Also filter out not supported rate + /* Copy AP's supported rate to MlmeAux for creating assoication request */ + /* Also filter out not supported rate */ pAd->MlmeAux.SupRateLen = SupRateLen; NdisMoveMemory(pAd->MlmeAux.SupRate, SupRate, SupRateLen); @@ -905,14 +905,14 @@ VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) RTMPZeroMemory(&pAd->MlmeAux.HtCapability, SIZE_HT_CAP_IE); - // filter out un-supported ht rates + /* filter out un-supported ht rates */ if (((HtCapabilityLen > 0) || (PreNHtCapabilityLen > 0)) && ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && (bAllowNrate))) { RTMPMoveMemory(&pAd->MlmeAux.AddHtInfo, &AddHtInfo, SIZE_ADD_HT_INFO_IE); - // StaActive.SupportedHtPhy.MCSSet stores Peer AP's 11n Rx capability + /* StaActive.SupportedHtPhy.MCSSet stores Peer AP's 11n Rx capability */ NdisMoveMemory(pAd->StaActive.SupportedPhyInfo. MCSSet, HtCapability.MCSSet, 16); pAd->MlmeAux.NewExtChannelOffset = @@ -925,7 +925,7 @@ VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) bPreNHt = TRUE; RTMPCheckHt(pAd, BSSID_WCID, &HtCapability, &AddHtInfo); - // Copy AP Parameter to StaActive. This is also in LinkUp. + /* Copy AP Parameter to StaActive. This is also in LinkUp. */ DBGPRINT(RT_DEBUG_TRACE, ("PeerBeaconAtJoinAction! (MpduDensity=%d, MaxRAmpduFactor=%d, BW=%d)\n", pAd->StaActive.SupportedHtPhy. @@ -936,7 +936,7 @@ VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if (AddHtInfoLen > 0) { CentralChannel = AddHtInfo.ControlChan; - // Check again the Bandwidth capability of this AP. + /* Check again the Bandwidth capability of this AP. */ if ((AddHtInfo.ControlChan > 2) && (AddHtInfo.AddHtInfo. ExtChanOffset == EXTCHA_BELOW) @@ -952,7 +952,7 @@ VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) CentralChannel = AddHtInfo.ControlChan + 2; } - // Check Error . + /* Check Error . */ if (pAd->MlmeAux.CentralChannel != CentralChannel) DBGPRINT(RT_DEBUG_ERROR, @@ -970,7 +970,7 @@ VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } else { - // To prevent error, let legacy AP must have same CentralChannel and Channel. + /* To prevent error, let legacy AP must have same CentralChannel and Channel. */ if ((HtCapabilityLen == 0) && (PreNHtCapabilityLen == 0)) pAd->MlmeAux.CentralChannel = @@ -988,7 +988,7 @@ VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) RTMPUpdateMlmeRate(pAd); - // copy QOS related information + /* copy QOS related information */ if ((pAd->CommonCfg.bWmmCapable) || (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) ) { @@ -1015,10 +1015,10 @@ VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->MlmeAux.ExtRateLen)); if (AironetCellPowerLimit != 0xFF) { - //We need to change our TxPower for CCX 2.0 AP Control of Client Transmit Power + /*We need to change our TxPower for CCX 2.0 AP Control of Client Transmit Power */ ChangeToCellPowerLimit(pAd, AironetCellPowerLimit); - } else //Used the default TX Power Percentage. + } else /*Used the default TX Power Percentage. */ pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault; @@ -1027,9 +1027,9 @@ VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_JOIN_CONF, 2, &Status); } - // not to me BEACON, ignored + /* not to me BEACON, ignored */ } - // sanity check fail, ignore this frame + /* sanity check fail, ignore this frame */ } /* @@ -1062,11 +1062,11 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) QBSS_LOAD_PARM QbssLoad; QOS_CAPABILITY_PARM QosCapability; ULONG RalinkIe; - // New for WPA security suites - UCHAR VarIE[MAX_VIE_LEN]; // Total VIE length = MAX_VIE_LEN - -5 + /* New for WPA security suites */ + UCHAR VarIE[MAX_VIE_LEN]; /* Total VIE length = MAX_VIE_LEN - -5 */ NDIS_802_11_VARIABLE_IEs *pVIE = NULL; HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE + ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ UCHAR HtCapabilityLen, PreNHtCapabilityLen; UCHAR AddHtInfoLen; UCHAR NewExtChannelOffset = 0xff; @@ -1075,7 +1075,7 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) )) return; - // Init Variable IE structure + /* Init Variable IE structure */ pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; pVIE->Length = 0; RTMPZeroMemory(&HtCapability, sizeof(HtCapability)); @@ -1132,27 +1132,27 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) SSID_EQUAL(Ssid, SsidLen, pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen) ? TRUE : FALSE; - // ignore BEACON not for my SSID + /* ignore BEACON not for my SSID */ if ((!is_my_ssid) && (!is_my_bssid)) return; - // It means STA waits disassoc completely from this AP, ignores this beacon. + /* It means STA waits disassoc completely from this AP, ignores this beacon. */ if (pAd->Mlme.CntlMachine.CurrState == CNTL_WAIT_DISASSOC) return; - // Copy Control channel for this BSSID. + /* Copy Control channel for this BSSID. */ if (AddHtInfoLen != 0) Channel = AddHtInfo.ControlChan; if ((HtCapabilityLen > 0) || (PreNHtCapabilityLen > 0)) HtCapabilityLen = SIZE_HT_CAP_IE; - // - // Housekeeping "SsidBssTab" table for later-on ROAMing usage. - // + /* */ + /* Housekeeping "SsidBssTab" table for later-on ROAMing usage. */ + /* */ Bssidx = BssTableSearch(&pAd->ScanTab, Bssid, Channel); if (Bssidx == BSS_NOT_FOUND) { - // discover new AP of this network, create BSS entry + /* discover new AP of this network, create BSS entry */ Bssidx = BssTableSetEntry(pAd, &pAd->ScanTab, Bssid, Ssid, SsidLen, BssType, BeaconPeriod, @@ -1165,7 +1165,7 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) CkipFlag, &EdcaParm, &QosCapability, &QbssLoad, LenVIE, pVIE); - if (Bssidx == BSS_NOT_FOUND) // return if BSS table full + if (Bssidx == BSS_NOT_FOUND) /* return if BSS table full */ return; NdisMoveMemory(pAd->ScanTab.BssEntry[Bssidx].PTSF, @@ -1179,16 +1179,16 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if ((pAd->CommonCfg.bIEEE80211H == 1) && (NewChannel != 0) && (Channel != NewChannel)) { - // Switching to channel 1 can prevent from rescanning the current channel immediately (by auto reconnection). - // In addition, clear the MLME queue and the scan table to discard the RX packets and previous scanning results. + /* Switching to channel 1 can prevent from rescanning the current channel immediately (by auto reconnection). */ + /* In addition, clear the MLME queue and the scan table to discard the RX packets and previous scanning results. */ AsicSwitchChannel(pAd, 1, FALSE); AsicLockChannel(pAd, 1); LinkDown(pAd, FALSE); MlmeQueueInit(&pAd->Mlme.Queue); BssTableInit(&pAd->ScanTab); - RTMPusecDelay(1000000); // use delay to prevent STA do reassoc + RTMPusecDelay(1000000); /* use delay to prevent STA do reassoc */ - // channel sanity check + /* channel sanity check */ for (index = 0; index < pAd->ChannelListNum; index++) { if (pAd->ChannelList[index].Channel == NewChannel) { @@ -1211,17 +1211,17 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) DBGPRINT_ERR(("PeerBeacon(can not find New Channel=%d in ChannelList[%d]\n", pAd->CommonCfg.Channel, pAd->ChannelListNum)); } } - // if the ssid matched & bssid unmatched, we should select the bssid with large value. - // This might happened when two STA start at the same time + /* if the ssid matched & bssid unmatched, we should select the bssid with large value. */ + /* This might happened when two STA start at the same time */ if ((!is_my_bssid) && ADHOC_ON(pAd)) { INT i; - // Add the safeguard against the mismatch of adhoc wep status + /* Add the safeguard against the mismatch of adhoc wep status */ if (pAd->StaCfg.WepStatus != pAd->ScanTab.BssEntry[Bssidx].WepStatus) { return; } - // collapse into the ADHOC network which has bigger BSSID value. + /* collapse into the ADHOC network which has bigger BSSID value. */ for (i = 0; i < 6; i++) { if (Bssid[i] > pAd->CommonCfg.Bssid[i]) { DBGPRINT(RT_DEBUG_TRACE, @@ -1233,8 +1233,8 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) COPY_MAC_ADDR(pAd->CommonCfg.Bssid, Bssid); AsicSetBssid(pAd, pAd->CommonCfg.Bssid); - MakeIbssBeacon(pAd); // re-build BEACON frame - AsicEnableIbssSync(pAd); // copy BEACON frame to on-chip memory + MakeIbssBeacon(pAd); /* re-build BEACON frame */ + AsicEnableIbssSync(pAd); /* copy BEACON frame to on-chip memory */ is_my_bssid = TRUE; break; } else if (Bssid[i] < pAd->CommonCfg.Bssid[i]) @@ -1244,12 +1244,12 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) NdisGetSystemUpTime(&Now); pBss = &pAd->ScanTab.BssEntry[Bssidx]; - pBss->Rssi = RealRssi; // lastest RSSI - pBss->LastBeaconRxTime = Now; // last RX timestamp + pBss->Rssi = RealRssi; /* lastest RSSI */ + pBss->LastBeaconRxTime = Now; /* last RX timestamp */ - // - // BEACON from my BSSID - either IBSS or INFRA network - // + /* */ + /* BEACON from my BSSID - either IBSS or INFRA network */ + /* */ if (is_my_bssid) { RXWI_STRUC RxWI; @@ -1263,17 +1263,17 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Update_Rssi_Sample(pAd, &pAd->StaCfg.RssiSample, &RxWI); if (AironetCellPowerLimit != 0xFF) { - // - // We get the Cisco (ccx) "TxPower Limit" required - // Changed to appropriate TxPower Limit for Ciso Compatible Extensions - // + /* */ + /* We get the Cisco (ccx) "TxPower Limit" required */ + /* Changed to appropriate TxPower Limit for Ciso Compatible Extensions */ + /* */ ChangeToCellPowerLimit(pAd, AironetCellPowerLimit); } else { - // - // AironetCellPowerLimit equal to 0xFF means the Cisco (ccx) "TxPower Limit" not exist. - // Used the default TX Power Percentage, that set from UI. - // + /* */ + /* AironetCellPowerLimit equal to 0xFF means the Cisco (ccx) "TxPower Limit" not exist. */ + /* Used the default TX Power Percentage, that set from UI. */ + /* */ pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault; } @@ -1283,7 +1283,7 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) UCHAR idx; MAC_TABLE_ENTRY *pEntry; - // supported rates array may not be sorted. sort it and find the maximum rate + /* supported rates array may not be sorted. sort it and find the maximum rate */ for (idx = 0; idx < SupRateLen; idx++) { if (MaxSupportedRateIn500Kbps < (SupRate[idx] & 0x7f)) @@ -1298,11 +1298,11 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ExtRate[idx] & 0x7f; } - // look up the existing table + /* look up the existing table */ pEntry = MacTableLookup(pAd, Addr2); - // Ad-hoc mode is using MAC address as BA session. So we need to continuously find newly joined adhoc station by receiving beacon. - // To prevent always check this, we use wcid == RESERVED_WCID to recognize it as newly joined adhoc station. + /* Ad-hoc mode is using MAC address as BA session. So we need to continuously find newly joined adhoc station by receiving beacon. */ + /* To prevent always check this, we use wcid == RESERVED_WCID to recognize it as newly joined adhoc station. */ if ((ADHOC_ON(pAd) && (Elem->Wcid == RESERVED_WCID)) || (pEntry @@ -1311,7 +1311,7 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ADHOC_ENTRY_BEACON_LOST_TIME) < Now))) { if (pEntry == NULL) - // Another adhoc joining, add to our MAC table. + /* Another adhoc joining, add to our MAC table. */ pEntry = MacTableInsertEntry(pAd, Addr2, @@ -1345,7 +1345,7 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if (pEntry && pEntry->ValidAsCLI) pEntry->LastBeaconRxTime = Now; - // At least another peer in this IBSS, declare MediaState as CONNECTED + /* At least another peer in this IBSS, declare MediaState as CONNECTED */ if (!OPSTATUS_TEST_FLAG (pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) { OPSTATUS_SET_FLAG(pAd, @@ -1357,10 +1357,10 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->ExtraInfo = GENERAL_LINK_UP; AsicSetBssid(pAd, pAd->CommonCfg.Bssid); - // 2003/03/12 - john - // Make sure this entry in "ScanTab" table, thus complies to Microsoft's policy that - // "site survey" result should always include the current connected network. - // + /* 2003/03/12 - john */ + /* Make sure this entry in "ScanTab" table, thus complies to Microsoft's policy that */ + /* "site survey" result should always include the current connected network. */ + /* */ Bssidx = BssTableSearch(&pAd->ScanTab, Bssid, Channel); @@ -1404,12 +1404,12 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if (INFRA_ON(pAd)) { BOOLEAN bUseShortSlot, bUseBGProtection; - // decide to use/change to - - // 1. long slot (20 us) or short slot (9 us) time - // 2. turn on/off RTS/CTS and/or CTS-to-self protection - // 3. short preamble + /* decide to use/change to - */ + /* 1. long slot (20 us) or short slot (9 us) time */ + /* 2. turn on/off RTS/CTS and/or CTS-to-self protection */ + /* 3. short preamble */ - //bUseShortSlot = pAd->CommonCfg.bUseShortSlotTime && CAP_IS_SHORT_SLOT(CapabilityInfo); + /*bUseShortSlot = pAd->CommonCfg.bUseShortSlotTime && CAP_IS_SHORT_SLOT(CapabilityInfo); */ bUseShortSlot = CAP_IS_SHORT_SLOT(CapabilityInfo); if (bUseShortSlot != @@ -1417,11 +1417,11 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) fOP_STATUS_SHORT_SLOT_INUSED)) AsicSetSlotTime(pAd, bUseShortSlot); - bUseBGProtection = (pAd->CommonCfg.UseBGProtection == 1) || // always use + bUseBGProtection = (pAd->CommonCfg.UseBGProtection == 1) || /* always use */ ((pAd->CommonCfg.UseBGProtection == 0) && ERP_IS_USE_PROTECTION(Erp)); - if (pAd->CommonCfg.Channel > 14) // always no BG protection in A-band. falsely happened when switching A/G band to a dual-band AP + if (pAd->CommonCfg.Channel > 14) /* always no BG protection in A-band. falsely happened when switching A/G band to a dual-band AP */ bUseBGProtection = FALSE; if (bUseBGProtection != @@ -1472,7 +1472,7 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ("SYNC - AP changed B/G protection to %d\n", bUseBGProtection)); } - // check Ht protection mode. and adhere to the Non-GF device indication by AP. + /* check Ht protection mode. and adhere to the Non-GF device indication by AP. */ if ((AddHtInfoLen != 0) && ((AddHtInfo.AddHtInfo2.OperaionMode != pAd->MlmeAux.AddHtInfo.AddHtInfo2. @@ -1532,7 +1532,7 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) EdcaParm.EdcaUpdateCount)); AsicSetEdcaParm(pAd, &EdcaParm); } - // copy QOS related information + /* copy QOS related information */ NdisMoveMemory(&pAd->CommonCfg.APQbssLoad, &QbssLoad, sizeof(QBSS_LOAD_PARM)); @@ -1540,28 +1540,28 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) &QosCapability, sizeof(QOS_CAPABILITY_PARM)); } - // only INFRASTRUCTURE mode support power-saving feature + /* only INFRASTRUCTURE mode support power-saving feature */ if ((INFRA_ON(pAd) && (pAd->StaCfg.Psm == PWR_SAVE)) || (pAd->CommonCfg.bAPSDForcePowerSave)) { UCHAR FreeNumber; - // 1. AP has backlogged unicast-to-me frame, stay AWAKE, send PSPOLL - // 2. AP has backlogged broadcast/multicast frame and we want those frames, stay AWAKE - // 3. we have outgoing frames in TxRing or MgmtRing, better stay AWAKE - // 4. Psm change to PWR_SAVE, but AP not been informed yet, we better stay AWAKE - // 5. otherwise, put PHY back to sleep to save battery. + /* 1. AP has backlogged unicast-to-me frame, stay AWAKE, send PSPOLL */ + /* 2. AP has backlogged broadcast/multicast frame and we want those frames, stay AWAKE */ + /* 3. we have outgoing frames in TxRing or MgmtRing, better stay AWAKE */ + /* 4. Psm change to PWR_SAVE, but AP not been informed yet, we better stay AWAKE */ + /* 5. otherwise, put PHY back to sleep to save battery. */ if (MessageToMe) { #ifdef RTMP_MAC_PCI if (OPSTATUS_TEST_FLAG (pAd, fOP_STATUS_PCIE_DEVICE)) { - // Restore to correct BBP R3 value + /* Restore to correct BBP R3 value */ if (pAd->Antenna.field.RxPath > 1) RTMP_BBP_IO_WRITE8_BY_REG_ID (pAd, BBP_R3, pAd->StaCfg.BBPR3); - // Turn clk to 80Mhz. + /* Turn clk to 80Mhz. */ } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ if (pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm. bAPSDCapable @@ -1587,7 +1587,7 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) (pAd, BBP_R3, pAd->StaCfg.BBPR3); } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ } else if ((pAd->TxSwQueue[QID_AC_BK].Number != 0) || (pAd->TxSwQueue[QID_AC_BE].Number != @@ -1617,8 +1617,8 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) (pAd, QID_MGMT, MGMT_RING_SIZE - 1, &FreeNumber) != NDIS_STATUS_SUCCESS)) { - // TODO: consider scheduled HCCA. might not be proper to use traditional DTIM-based power-saving scheme - // can we cheat here (i.e. just check MGMT & AC_BE) for better performance? + /* TODO: consider scheduled HCCA. might not be proper to use traditional DTIM-based power-saving scheme */ + /* can we cheat here (i.e. just check MGMT & AC_BE) for better performance? */ #ifdef RTMP_MAC_PCI if (OPSTATUS_TEST_FLAG (pAd, fOP_STATUS_PCIE_DEVICE)) { @@ -1628,7 +1628,7 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) (pAd, BBP_R3, pAd->StaCfg.BBPR3); } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ } else { if ((pAd->CommonCfg. bACMAPSDTr[QID_AC_VO]) @@ -1678,7 +1678,7 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if (!OPSTATUS_TEST_FLAG (pAd, fOP_STATUS_DOZE)) { - // Set a flag to go to sleep . Then after parse this RxDoneInterrupt, will go to sleep mode. + /* Set a flag to go to sleep . Then after parse this RxDoneInterrupt, will go to sleep mode. */ pAd-> ThisTbttNumToNextWakeUp = @@ -1692,9 +1692,9 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } } - // not my BSSID, ignore it + /* not my BSSID, ignore it */ } - // sanity check fail, ignore this frame + /* sanity check fail, ignore this frame */ } /* @@ -1728,12 +1728,12 @@ VOID PeerProbeReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if ((SsidLen == 0) || SSID_EQUAL(Ssid, SsidLen, pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen)) { - // allocate and send out ProbeRsp frame - NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + /* allocate and send out ProbeRsp frame */ + NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) return; - //pAd->StaCfg.AtimWin = 0; // ?????? + /*pAd->StaCfg.AtimWin = 0; // ?????? */ Privacy = (pAd->StaCfg.WepStatus == @@ -1774,7 +1774,7 @@ VOID PeerProbeReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) END_OF_ARGS); FrameLen += tmp; } - // If adhoc secruity is set for WPA-None, append the cipher suite IE + /* If adhoc secruity is set for WPA-None, append the cipher suite IE */ if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) { ULONG tmp; MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, @@ -1792,7 +1792,7 @@ VOID PeerProbeReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) HtLen = sizeof(pAd->CommonCfg.HtCapability); AddHtLen = sizeof(pAd->CommonCfg.AddHTInfo); NewExtLen = 1; - //New extension channel offset IE is included in Beacon, Probe Rsp or channel Switch Announcement Frame + /*New extension channel offset IE is included in Beacon, Probe Rsp or channel Switch Announcement Frame */ if (pAd->bBroadComHT == TRUE) { MakeOutgoingFrame(pOutBuffer + FrameLen, &TmpLen, 1, &WpaIe, 4, @@ -1852,14 +1852,14 @@ VOID ScanTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { pAd->MlmeAux.Channel = NextChannel(pAd, pAd->MlmeAux.Channel); - // Only one channel scanned for CISCO beacon request + /* Only one channel scanned for CISCO beacon request */ if ((pAd->MlmeAux.ScanType == SCAN_CISCO_ACTIVE) || (pAd->MlmeAux.ScanType == SCAN_CISCO_PASSIVE) || (pAd->MlmeAux.ScanType == SCAN_CISCO_NOISE) || (pAd->MlmeAux.ScanType == SCAN_CISCO_CHANNEL_LOAD)) pAd->MlmeAux.Channel = 0; - // this routine will stop if pAd->MlmeAux.Channel == 0 + /* this routine will stop if pAd->MlmeAux.Channel == 0 */ ScanNextChannel(pAd); } @@ -1942,12 +1942,12 @@ VOID EnqueueProbeRequest(IN PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_TRACE, ("force out a ProbeRequest ...\n")); - NState = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory + NState = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NState == NDIS_STATUS_SUCCESS) { MgtMacHeaderInit(pAd, &Hdr80211, SUBTYPE_PROBE_REQ, 0, BROADCAST_ADDR, BROADCAST_ADDR); - // this ProbeRequest explicitly specify SSID to reduce unwanted ProbeResponse + /* this ProbeRequest explicitly specify SSID to reduce unwanted ProbeResponse */ MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(HEADER_802_11), &Hdr80211, 1, &SsidIe, diff --git a/drivers/staging/rt2860/sta/wpa.c b/drivers/staging/rt2860/sta/wpa.c index 0a45643eedd9..15ed01e5efb0 100644 --- a/drivers/staging/rt2860/sta/wpa.c +++ b/drivers/staging/rt2860/sta/wpa.c @@ -63,7 +63,7 @@ VOID RTMPReportMicError(IN PRTMP_ADAPTER pAd, IN PCIPHER_KEY pWpaKey) ULONG Now; UCHAR unicastKey = (pWpaKey->Type == PAIRWISE_KEY ? 1 : 0); - // Record Last MIC error time and count + /* Record Last MIC error time and count */ NdisGetSystemUpTime(&Now); if (pAd->StaCfg.MicErrCnt == 0) { pAd->StaCfg.MicErrCnt++; @@ -71,7 +71,7 @@ VOID RTMPReportMicError(IN PRTMP_ADAPTER pAd, IN PCIPHER_KEY pWpaKey) NdisZeroMemory(pAd->StaCfg.ReplayCounter, 8); } else if (pAd->StaCfg.MicErrCnt == 1) { if ((pAd->StaCfg.LastMicErrorTime + (60 * OS_HZ)) < Now) { - // Update Last MIC error time, this did not violate two MIC errors within 60 seconds + /* Update Last MIC error time, this did not violate two MIC errors within 60 seconds */ pAd->StaCfg.LastMicErrorTime = Now; } else { @@ -83,23 +83,23 @@ VOID RTMPReportMicError(IN PRTMP_ADAPTER pAd, IN PCIPHER_KEY pWpaKey) BSS0, 0); pAd->StaCfg.LastMicErrorTime = Now; - // Violate MIC error counts, MIC countermeasures kicks in + /* Violate MIC error counts, MIC countermeasures kicks in */ pAd->StaCfg.MicErrCnt++; - // We shall block all reception - // We shall clean all Tx ring and disassoicate from AP after next EAPOL frame - // - // No necessary to clean all Tx ring, on RTMPHardTransmit will stop sending non-802.1X EAPOL packets - // if pAd->StaCfg.MicErrCnt greater than 2. - // - // RTMPRingCleanUp(pAd, QID_AC_BK); - // RTMPRingCleanUp(pAd, QID_AC_BE); - // RTMPRingCleanUp(pAd, QID_AC_VI); - // RTMPRingCleanUp(pAd, QID_AC_VO); - // RTMPRingCleanUp(pAd, QID_HCCA); + /* We shall block all reception */ + /* We shall clean all Tx ring and disassoicate from AP after next EAPOL frame */ + /* */ + /* No necessary to clean all Tx ring, on RTMPHardTransmit will stop sending non-802.1X EAPOL packets */ + /* if pAd->StaCfg.MicErrCnt greater than 2. */ + /* */ + /* RTMPRingCleanUp(pAd, QID_AC_BK); */ + /* RTMPRingCleanUp(pAd, QID_AC_BE); */ + /* RTMPRingCleanUp(pAd, QID_AC_VI); */ + /* RTMPRingCleanUp(pAd, QID_AC_VO); */ + /* RTMPRingCleanUp(pAd, QID_HCCA); */ } } else { - // MIC error count >= 2 - // This should not happen + /* MIC error count >= 2 */ + /* This should not happen */ ; } MlmeEnqueue(pAd, @@ -112,7 +112,7 @@ VOID RTMPReportMicError(IN PRTMP_ADAPTER pAd, IN PCIPHER_KEY pWpaKey) } #define LENGTH_EAP_H 4 -// If the received frame is EAP-Packet ,find out its EAP-Code (Request(0x01), Response(0x02), Success(0x03), Failure(0x04)). +/* If the received frame is EAP-Packet ,find out its EAP-Code (Request(0x01), Response(0x02), Success(0x03), Failure(0x04)). */ INT WpaCheckEapCode(IN PRTMP_ADAPTER pAd, IN PUCHAR pFrame, IN USHORT FrameLen, IN USHORT OffSet) { @@ -123,11 +123,11 @@ INT WpaCheckEapCode(IN PRTMP_ADAPTER pAd, if (FrameLen < OffSet + LENGTH_EAPOL_H + LENGTH_EAP_H) return result; - pData = pFrame + OffSet; // skip offset bytes + pData = pFrame + OffSet; /* skip offset bytes */ - if (*(pData + 1) == EAPPacket) // 802.1x header - Packet Type + if (*(pData + 1) == EAPPacket) /* 802.1x header - Packet Type */ { - result = *(pData + 4); // EAP header - Code + result = *(pData + 4); /* EAP header - Code */ } return result; @@ -161,7 +161,7 @@ VOID WpaMicFailureReportFrame(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) bUnicast = (Elem->Msg[0] == 1 ? TRUE : FALSE); pAd->Sequence = ((pAd->Sequence) + 1) & (MAX_SEQ_NUMBER); - // init 802.3 header and Fill Packet + /* init 802.3 header and Fill Packet */ MAKE_802_3_HEADER(Header802_3, pAd->CommonCfg.Bssid, pAd->CurrentAddress, EAPOL); @@ -171,59 +171,59 @@ VOID WpaMicFailureReportFrame(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Packet.KeyDesc.Type = WPA1_KEY_DESC; - // Request field presented + /* Request field presented */ Packet.KeyDesc.KeyInfo.Request = 1; if (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) { Packet.KeyDesc.KeyInfo.KeyDescVer = 2; - } else // TKIP + } else /* TKIP */ { Packet.KeyDesc.KeyInfo.KeyDescVer = 1; } Packet.KeyDesc.KeyInfo.KeyType = (bUnicast ? PAIRWISEKEY : GROUPKEY); - // KeyMic field presented + /* KeyMic field presented */ Packet.KeyDesc.KeyInfo.KeyMic = 1; - // Error field presented + /* Error field presented */ Packet.KeyDesc.KeyInfo.Error = 1; - // Update packet length after decide Key data payload + /* Update packet length after decide Key data payload */ SET_UINT16_TO_ARRARY(Packet.Body_Len, LEN_EAPOL_KEY_MSG) - // Key Replay Count + /* Key Replay Count */ NdisMoveMemory(Packet.KeyDesc.ReplayCounter, pAd->StaCfg.ReplayCounter, LEN_KEY_DESC_REPLAY); inc_byte_array(pAd->StaCfg.ReplayCounter, 8); - // Convert to little-endian format. + /* Convert to little-endian format. */ *((USHORT *) & Packet.KeyDesc.KeyInfo) = cpu2le16(*((USHORT *) & Packet.KeyDesc.KeyInfo)); - MlmeAllocateMemory(pAd, (PUCHAR *) & pOutBuffer); // allocate memory + MlmeAllocateMemory(pAd, (PUCHAR *) & pOutBuffer); /* allocate memory */ if (pOutBuffer == NULL) { return; } - // Prepare EAPOL frame for MIC calculation - // Be careful, only EAPOL frame is counted for MIC calculation + /* Prepare EAPOL frame for MIC calculation */ + /* Be careful, only EAPOL frame is counted for MIC calculation */ MakeOutgoingFrame(pOutBuffer, &FrameLen, CONV_ARRARY_TO_UINT16(Packet.Body_Len) + 4, &Packet, END_OF_ARGS); - // Prepare and Fill MIC value + /* Prepare and Fill MIC value */ NdisZeroMemory(Mic, sizeof(Mic)); - if (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) { // AES + if (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) { /* AES */ UCHAR digest[20] = { 0 }; HMAC_SHA1(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, digest, SHA1_DIGEST_SIZE); NdisMoveMemory(Mic, digest, LEN_KEY_DESC_MIC); - } else { // TKIP + } else { /* TKIP */ HMAC_MD5(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, Mic, MD5_DIGEST_SIZE); } NdisMoveMemory(Packet.KeyDesc.KeyMic, Mic, LEN_KEY_DESC_MIC); - // copy frame to Tx ring and send MIC failure report frame to authenticator + /* copy frame to Tx ring and send MIC failure report frame to authenticator */ RTMPToWirelessSta(pAd, &pAd->MacTab.Content[BSSID_WCID], Header802_3, LENGTH_802_3, (PUCHAR) & Packet, @@ -262,7 +262,7 @@ VOID WpaDisassocApAndBlockAssoc(IN PVOID SystemSpecific1, RTMP_ADAPTER *pAd = (PRTMP_ADAPTER) FunctionContext; MLME_DISASSOC_REQ_STRUCT DisassocReq; - // disassoc from current AP first + /* disassoc from current AP first */ DBGPRINT(RT_DEBUG_TRACE, ("RTMPReportMicError - disassociate with current AP after sending second continuous EAPOL frame\n")); DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, @@ -281,12 +281,12 @@ VOID WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd) pEntry = &pAd->MacTab.Content[BSSID_WCID]; - // Pairwise key shall use key#0 + /* Pairwise key shall use key#0 */ pSharedKey = &pAd->SharedKey[BSS0][0]; NdisMoveMemory(pAd->StaCfg.PTK, pEntry->PTK, LEN_PTK); - // Prepare pair-wise key information into shared key table + /* Prepare pair-wise key information into shared key table */ NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); pSharedKey->KeyLen = LEN_TKIP_EK; NdisMoveMemory(pSharedKey->Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); @@ -295,7 +295,7 @@ VOID WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd) NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.PTK[48 + LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); - // Decide its ChiperAlg + /* Decide its ChiperAlg */ if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) pSharedKey->CipherAlg = CIPHER_TKIP; else if (pAd->StaCfg.PairCipher == Ndis802_11Encryption3Enabled) @@ -303,7 +303,7 @@ VOID WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd) else pSharedKey->CipherAlg = CIPHER_NONE; - // Update these related information to MAC_TABLE_ENTRY + /* Update these related information to MAC_TABLE_ENTRY */ NdisMoveMemory(pEntry->PairwiseKey.Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); NdisMoveMemory(pEntry->PairwiseKey.RxMic, &pAd->StaCfg.PTK[48], @@ -312,7 +312,7 @@ VOID WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd) &pAd->StaCfg.PTK[48 + LEN_TKIP_RXMICK], LEN_TKIP_TXMICK); pEntry->PairwiseKey.CipherAlg = pSharedKey->CipherAlg; - // Update pairwise key information to ASIC Shared Key Table + /* Update pairwise key information to ASIC Shared Key Table */ AsicAddSharedKeyEntry(pAd, BSS0, 0, @@ -320,7 +320,7 @@ VOID WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd) pSharedKey->Key, pSharedKey->TxMic, pSharedKey->RxMic); - // Update ASIC WCID attribute table and IVEIV table + /* Update ASIC WCID attribute table and IVEIV table */ RTMPAddWcidAttributeEntry(pAd, BSS0, 0, pSharedKey->CipherAlg, pEntry); STA_PORT_SECURED(pAd); pAd->IndicateMediaState = NdisMediaStateConnected; @@ -336,7 +336,7 @@ VOID WpaStaGroupKeySetting(IN PRTMP_ADAPTER pAd) pSharedKey = &pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId]; - // Prepare pair-wise key information into shared key table + /* Prepare pair-wise key information into shared key table */ NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); pSharedKey->KeyLen = LEN_TKIP_EK; NdisMoveMemory(pSharedKey->Key, pAd->StaCfg.GTK, LEN_TKIP_EK); @@ -345,7 +345,7 @@ VOID WpaStaGroupKeySetting(IN PRTMP_ADAPTER pAd) NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.GTK[24], LEN_TKIP_TXMICK); - // Update Shared Key CipherAlg + /* Update Shared Key CipherAlg */ pSharedKey->CipherAlg = CIPHER_NONE; if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption2Enabled) pSharedKey->CipherAlg = CIPHER_TKIP; @@ -356,7 +356,7 @@ VOID WpaStaGroupKeySetting(IN PRTMP_ADAPTER pAd) else if (pAd->StaCfg.GroupCipher == Ndis802_11GroupWEP104Enabled) pSharedKey->CipherAlg = CIPHER_WEP128; - // Update group key information to ASIC Shared Key Table + /* Update group key information to ASIC Shared Key Table */ AsicAddSharedKeyEntry(pAd, BSS0, pAd->StaCfg.DefaultKeyId, @@ -364,7 +364,7 @@ VOID WpaStaGroupKeySetting(IN PRTMP_ADAPTER pAd) pSharedKey->Key, pSharedKey->TxMic, pSharedKey->RxMic); - // Update ASIC WCID attribute table and IVEIV table + /* Update ASIC WCID attribute table and IVEIV table */ RTMPAddWcidAttributeEntry(pAd, BSS0, pAd->StaCfg.DefaultKeyId, -- GitLab From cc27706961cbe2de1b2b1d1b498efa7b6f04a822 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 11 Dec 2009 12:23:15 -0800 Subject: [PATCH 166/235] Staging: rt28x0: fix comments in *.h files Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/ap.h | 6 +- drivers/staging/rt2860/chip/mac_pci.h | 1 - drivers/staging/rt2860/chip/mac_usb.h | 140 +- drivers/staging/rt2860/chip/rt2860.h | 12 +- drivers/staging/rt2860/chip/rt2870.h | 6 +- drivers/staging/rt2860/chip/rt3070.h | 10 +- drivers/staging/rt2860/chip/rt3090.h | 16 +- drivers/staging/rt2860/chip/rt30xx.h | 4 +- drivers/staging/rt2860/chip/rtmp_mac.h | 996 +++++++-------- drivers/staging/rt2860/chip/rtmp_phy.h | 80 +- drivers/staging/rt2860/chlist.h | 10 +- drivers/staging/rt2860/eeprom.h | 10 +- drivers/staging/rt2860/mlme.h | 562 ++++---- drivers/staging/rt2860/oid.h | 380 +++--- drivers/staging/rt2860/rt_config.h | 4 +- drivers/staging/rt2860/rt_linux.h | 108 +- drivers/staging/rt2860/rtmp.h | 1630 ++++++++++++------------ drivers/staging/rt2860/rtmp_chip.h | 194 +-- drivers/staging/rt2860/rtmp_ckipmic.h | 2 +- drivers/staging/rt2860/rtmp_def.h | 792 ++++++------ drivers/staging/rt2860/rtmp_dot11.h | 60 +- drivers/staging/rt2860/rtmp_iface.h | 12 +- drivers/staging/rt2860/rtmp_mcu.h | 2 +- drivers/staging/rt2860/rtmp_os.h | 6 +- drivers/staging/rt2860/rtmp_timer.h | 32 +- drivers/staging/rt2860/rtmp_type.h | 26 +- drivers/staging/rt2860/rtusb_io.h | 118 +- drivers/staging/rt2860/spectrum.h | 2 +- drivers/staging/rt2860/spectrum_def.h | 4 +- drivers/staging/rt2860/wpa.h | 120 +- 30 files changed, 2672 insertions(+), 2673 deletions(-) diff --git a/drivers/staging/rt2860/ap.h b/drivers/staging/rt2860/ap.h index 97da74984e2e..c7ff6947492d 100644 --- a/drivers/staging/rt2860/ap.h +++ b/drivers/staging/rt2860/ap.h @@ -40,7 +40,7 @@ #ifndef __AP_H__ #define __AP_H__ -// ap_wpa.c +/* ap_wpa.c */ VOID WpaStateMachineInit(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * Sm, OUT STATE_MACHINE_FUNC Trans[]); @@ -48,7 +48,7 @@ VOID WpaStateMachineInit(IN PRTMP_ADAPTER pAd, VOID BeaconUpdateExec(IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ VOID RTMPSetPiggyBack(IN PRTMP_ADAPTER pAd, IN BOOLEAN bPiggyBack); @@ -63,4 +63,4 @@ BOOLEAN MacTableDeleteEntry(IN PRTMP_ADAPTER pAd, MAC_TABLE_ENTRY *MacTableLookup(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr); -#endif // __AP_H__ +#endif /* __AP_H__ */ diff --git a/drivers/staging/rt2860/chip/mac_pci.h b/drivers/staging/rt2860/chip/mac_pci.h index b0aa0d37a61e..34f7b9a302df 100644 --- a/drivers/staging/rt2860/chip/mac_pci.h +++ b/drivers/staging/rt2860/chip/mac_pci.h @@ -178,7 +178,6 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { #define NEED_QUEUE_BACK_FOR_AGG(pAd, QueIdx, freeNum, _TxFrameType) \ (((freeNum != (TX_RING_SIZE-1)) && (pAd->TxSwQueue[QueIdx].Number == 0)) || (freeNum<3)) - //(((freeNum) != (TX_RING_SIZE-1)) && (pAd->TxSwQueue[QueIdx].Number == 1 /*0*/)) #define HAL_KickOutMgmtTx(_pAd, _QueIdx, _pPacket, _pSrcBufVA, _SrcBufLen) \ RtmpPCIMgmtKickOut(_pAd, _QueIdx, _pPacket, _pSrcBufVA, _SrcBufLen) diff --git a/drivers/staging/rt2860/chip/mac_usb.h b/drivers/staging/rt2860/chip/mac_usb.h index 8ce696974921..fe7ba28b9fc6 100644 --- a/drivers/staging/rt2860/chip/mac_usb.h +++ b/drivers/staging/rt2860/chip/mac_usb.h @@ -46,18 +46,18 @@ #define USB_CYC_CFG 0x02a4 #define BEACON_RING_SIZE 2 -#define MGMTPIPEIDX 0 // EP6 is highest priority +#define MGMTPIPEIDX 0 /* EP6 is highest priority */ -#define RTMP_PKT_TAIL_PADDING 11 // 3(max 4 byte padding) + 4 (last packet padding) + 4 (MaxBulkOutsize align padding) +#define RTMP_PKT_TAIL_PADDING 11 /* 3(max 4 byte padding) + 4 (last packet padding) + 4 (MaxBulkOutsize align padding) */ #define fRTMP_ADAPTER_NEED_STOP_TX \ (fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_HALT_IN_PROGRESS | \ fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_BULKOUT_RESET | \ fRTMP_ADAPTER_RADIO_OFF | fRTMP_ADAPTER_REMOVE_IN_PROGRESS) -// -// RXINFO appends at the end of each rx packet. -// +/* */ +/* RXINFO appends at the end of each rx packet. */ +/* */ #define RXINFO_SIZE 4 #define RT2870_RXDMALEN_FIELD_SIZE 4 @@ -66,17 +66,17 @@ typedef struct PACKED _RXINFO_STRUC { UINT32 DATA:1; UINT32 NULLDATA:1; UINT32 FRAG:1; - UINT32 U2M:1; // 1: this RX frame is unicast to me - UINT32 Mcast:1; // 1: this is a multicast frame - UINT32 Bcast:1; // 1: this is a broadcast frame - UINT32 MyBss:1; // 1: this frame belongs to the same BSSID - UINT32 Crc:1; // 1: CRC error - UINT32 CipherErr:2; // 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid - UINT32 AMSDU:1; // rx with 802.3 header, not 802.11 header. + UINT32 U2M:1; /* 1: this RX frame is unicast to me */ + UINT32 Mcast:1; /* 1: this is a multicast frame */ + UINT32 Bcast:1; /* 1: this is a broadcast frame */ + UINT32 MyBss:1; /* 1: this frame belongs to the same BSSID */ + UINT32 Crc:1; /* 1: CRC error */ + UINT32 CipherErr:2; /* 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid */ + UINT32 AMSDU:1; /* rx with 802.3 header, not 802.11 header. */ UINT32 HTC:1; UINT32 RSSI:1; UINT32 L2PAD:1; - UINT32 AMPDU:1; // To be moved + UINT32 AMPDU:1; /* To be moved */ UINT32 Decrypted:1; UINT32 PlcpRssil:1; UINT32 CipherAlg:1; @@ -84,35 +84,35 @@ typedef struct PACKED _RXINFO_STRUC { UINT32 PlcpSignal:12; } RXINFO_STRUC, *PRXINFO_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC; -// -// TXINFO -// +/* */ +/* TXINFO */ +/* */ #define TXINFO_SIZE 4 typedef struct _TXINFO_STRUC { - // Word 0 - UINT32 USBDMATxPktLen:16; //used ONLY in USB bulk Aggregation, Total byte counts of all sub-frame. + /* Word 0 */ + UINT32 USBDMATxPktLen:16; /*used ONLY in USB bulk Aggregation, Total byte counts of all sub-frame. */ UINT32 rsv:8; - UINT32 WIV:1; // Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition - UINT32 QSEL:2; // select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA - UINT32 SwUseLastRound:1; // Software use. - UINT32 rsv2:2; // Software use. - UINT32 USBDMANextVLD:1; //used ONLY in USB bulk Aggregation, NextValid - UINT32 USBDMATxburst:1; //used ONLY in USB bulk Aggre. Force USB DMA transmit frame from current selected endpoint + UINT32 WIV:1; /* Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition */ + UINT32 QSEL:2; /* select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA */ + UINT32 SwUseLastRound:1; /* Software use. */ + UINT32 rsv2:2; /* Software use. */ + UINT32 USBDMANextVLD:1; /*used ONLY in USB bulk Aggregation, NextValid */ + UINT32 USBDMATxburst:1; /*used ONLY in USB bulk Aggre. Force USB DMA transmit frame from current selected endpoint */ } TXINFO_STRUC, *PTXINFO_STRUC; -// -// Management ring buffer format -// +/* */ +/* Management ring buffer format */ +/* */ typedef struct _MGMT_STRUC { BOOLEAN Valid; PUCHAR pBuffer; ULONG Length; } MGMT_STRUC, *PMGMT_STRUC; -//////////////////////////////////////////////////////////////////////////// -// The TX_BUFFER structure forms the transmitted USB packet to the device -//////////////////////////////////////////////////////////////////////////// +/*////////////////////////////////////////////////////////////////////////// */ +/* The TX_BUFFER structure forms the transmitted USB packet to the device */ +/*////////////////////////////////////////////////////////////////////////// */ typedef struct __TX_BUFFER { union { UCHAR WirelessPacket[TX_BUFFER_NORMSIZE]; @@ -120,7 +120,7 @@ typedef struct __TX_BUFFER { PSPOLL_FRAME PsPollPacket; RTS_FRAME RTSFrame; } field; - UCHAR Aggregation[4]; //Buffer for save Aggregation size. + UCHAR Aggregation[4]; /*Buffer for save Aggregation size. */ } TX_BUFFER, *PTX_BUFFER; typedef struct __HTTX_BUFFER { @@ -130,22 +130,22 @@ typedef struct __HTTX_BUFFER { PSPOLL_FRAME PsPollPacket; RTS_FRAME RTSFrame; } field; - UCHAR Aggregation[4]; //Buffer for save Aggregation size. + UCHAR Aggregation[4]; /*Buffer for save Aggregation size. */ } HTTX_BUFFER, *PHTTX_BUFFER; -// used to track driver-generated write irps +/* used to track driver-generated write irps */ typedef struct _TX_CONTEXT { - PVOID pAd; //Initialized in MiniportInitialize - PURB pUrb; //Initialized in MiniportInitialize - PIRP pIrp; //used to cancel pending bulk out. - //Initialized in MiniportInitialize - PTX_BUFFER TransferBuffer; //Initialized in MiniportInitialize + PVOID pAd; /*Initialized in MiniportInitialize */ + PURB pUrb; /*Initialized in MiniportInitialize */ + PIRP pIrp; /*used to cancel pending bulk out. */ + /*Initialized in MiniportInitialize */ + PTX_BUFFER TransferBuffer; /*Initialized in MiniportInitialize */ ULONG BulkOutSize; UCHAR BulkOutPipeId; UCHAR SelfIdx; BOOLEAN InUse; - BOOLEAN bWaitingBulkOut; // at least one packet is in this TxContext, ready for making IRP anytime. - BOOLEAN bFullForBulkOut; // all tx buffer are full , so waiting for tx bulkout. + BOOLEAN bWaitingBulkOut; /* at least one packet is in this TxContext, ready for making IRP anytime. */ + BOOLEAN bFullForBulkOut; /* all tx buffer are full , so waiting for tx bulkout. */ BOOLEAN IRPPending; BOOLEAN LastOne; BOOLEAN bAggregatible; @@ -153,18 +153,18 @@ typedef struct _TX_CONTEXT { UCHAR Rsv[2]; ULONG DataOffset; UINT TxRate; - dma_addr_t data_dma; // urb dma on linux + dma_addr_t data_dma; /* urb dma on linux */ } TX_CONTEXT, *PTX_CONTEXT, **PPTX_CONTEXT; -// used to track driver-generated write irps +/* used to track driver-generated write irps */ typedef struct _HT_TX_CONTEXT { - PVOID pAd; //Initialized in MiniportInitialize - PURB pUrb; //Initialized in MiniportInitialize - PIRP pIrp; //used to cancel pending bulk out. - //Initialized in MiniportInitialize - PHTTX_BUFFER TransferBuffer; //Initialized in MiniportInitialize - ULONG BulkOutSize; // Indicate the total bulk-out size in bytes in one bulk-transmission + PVOID pAd; /*Initialized in MiniportInitialize */ + PURB pUrb; /*Initialized in MiniportInitialize */ + PIRP pIrp; /*used to cancel pending bulk out. */ + /*Initialized in MiniportInitialize */ + PHTTX_BUFFER TransferBuffer; /*Initialized in MiniportInitialize */ + ULONG BulkOutSize; /* Indicate the total bulk-out size in bytes in one bulk-transmission */ UCHAR BulkOutPipeId; BOOLEAN IRPPending; BOOLEAN LastOne; @@ -173,33 +173,33 @@ typedef struct _HT_TX_CONTEXT { BOOLEAN bCopySavePad; UCHAR SavedPad[8]; UCHAR Header_802_3[LENGTH_802_3]; - ULONG CurWritePosition; // Indicate the buffer offset which packet will be inserted start from. - ULONG CurWriteRealPos; // Indicate the buffer offset which packet now are writing to. - ULONG NextBulkOutPosition; // Indicate the buffer start offset of a bulk-transmission - ULONG ENextBulkOutPosition; // Indicate the buffer end offset of a bulk-transmission + ULONG CurWritePosition; /* Indicate the buffer offset which packet will be inserted start from. */ + ULONG CurWriteRealPos; /* Indicate the buffer offset which packet now are writing to. */ + ULONG NextBulkOutPosition; /* Indicate the buffer start offset of a bulk-transmission */ + ULONG ENextBulkOutPosition; /* Indicate the buffer end offset of a bulk-transmission */ UINT TxRate; - dma_addr_t data_dma; // urb dma on linux + dma_addr_t data_dma; /* urb dma on linux */ } HT_TX_CONTEXT, *PHT_TX_CONTEXT, **PPHT_TX_CONTEXT; -// -// Structure to keep track of receive packets and buffers to indicate -// receive data to the protocol. -// +/* */ +/* Structure to keep track of receive packets and buffers to indicate */ +/* receive data to the protocol. */ +/* */ typedef struct _RX_CONTEXT { PUCHAR TransferBuffer; PVOID pAd; - PIRP pIrp; //used to cancel pending bulk in. + PIRP pIrp; /*used to cancel pending bulk in. */ PURB pUrb; - //These 2 Boolean shouldn't both be 1 at the same time. - ULONG BulkInOffset; // number of packets waiting for reordering . -// BOOLEAN ReorderInUse; // At least one packet in this buffer are in reordering buffer and wait for receive indication - BOOLEAN bRxHandling; // Notify this packet is being process now. - BOOLEAN InUse; // USB Hardware Occupied. Wait for USB HW to put packet. - BOOLEAN Readable; // Receive Complete back. OK for driver to indicate receiving packet. - BOOLEAN IRPPending; // TODO: To be removed + /*These 2 Boolean shouldn't both be 1 at the same time. */ + ULONG BulkInOffset; /* number of packets waiting for reordering . */ +/* BOOLEAN ReorderInUse; // At least one packet in this buffer are in reordering buffer and wait for receive indication */ + BOOLEAN bRxHandling; /* Notify this packet is being process now. */ + BOOLEAN InUse; /* USB Hardware Occupied. Wait for USB HW to put packet. */ + BOOLEAN Readable; /* Receive Complete back. OK for driver to indicate receiving packet. */ + BOOLEAN IRPPending; /* TODO: To be removed */ atomic_t IrpLock; NDIS_SPIN_LOCK RxContextLock; - dma_addr_t data_dma; // urb dma on linux + dma_addr_t data_dma; /* urb dma on linux */ } RX_CONTEXT, *PRX_CONTEXT; /****************************************************************************** @@ -207,9 +207,9 @@ typedef struct _RX_CONTEXT { USB Frimware Related MACRO ******************************************************************************/ -// 8051 firmware image for usb - use last-half base address = 0x3000 +/* 8051 firmware image for usb - use last-half base address = 0x3000 */ #define FIRMWARE_IMAGE_BASE 0x3000 -#define MAX_FIRMWARE_IMAGE_SIZE 0x1000 // 4kbyte +#define MAX_FIRMWARE_IMAGE_SIZE 0x1000 /* 4kbyte */ #define RTMP_WRITE_FIRMWARE(_pAd, _pFwImage, _FwLen) \ RTUSBFirmwareWrite(_pAd, _pFwImage, _FwLen) @@ -278,7 +278,7 @@ typedef struct _RX_CONTEXT { #define HAL_KickOutNullFrameTx(_pAd, _QueIdx, _pNullFrame, _frameLen) \ RtmpUSBNullFrameKickOut(_pAd, _QueIdx, _pNullFrame, _frameLen) -#define GET_TXRING_FREENO(_pAd, _QueIdx) (_QueIdx) //(_pAd->TxRing[_QueIdx].TxSwFreeIdx) +#define GET_TXRING_FREENO(_pAd, _QueIdx) (_QueIdx) /*(_pAd->TxRing[_QueIdx].TxSwFreeIdx) */ #define GET_MGMTRING_FREENO(_pAd) (_pAd->MgmtRing.TxSwFreeIdx) /* ----------------- RX Related MACRO ----------------- */ @@ -344,4 +344,4 @@ typedef struct _RX_CONTEXT { #define RTMP_MLME_RADIO_OFF(pAd) \ RT28xxUsbMlmeRadioOFF(pAd); -#endif //__MAC_USB_H__ // +#endif /*__MAC_USB_H__ // */ diff --git a/drivers/staging/rt2860/chip/rt2860.h b/drivers/staging/rt2860/chip/rt2860.h index 6b976b47ad8e..f30b80820b92 100644 --- a/drivers/staging/rt2860/chip/rt2860.h +++ b/drivers/staging/rt2860/chip/rt2860.h @@ -38,17 +38,17 @@ #error "For RT2880, you should define the compile flag -DRTMP_MAC_PCI" #endif -// -// Device ID & Vendor ID, these values should match EEPROM value -// +/* */ +/* Device ID & Vendor ID, these values should match EEPROM value */ +/* */ #define NIC2860_PCI_DEVICE_ID 0x0601 #define NIC2860_PCIe_DEVICE_ID 0x0681 -#define NIC2760_PCI_DEVICE_ID 0x0701 // 1T/2R Cardbus ??? -#define NIC2790_PCIe_DEVICE_ID 0x0781 // 1T/2R miniCard +#define NIC2760_PCI_DEVICE_ID 0x0701 /* 1T/2R Cardbus ??? */ +#define NIC2790_PCIe_DEVICE_ID 0x0781 /* 1T/2R miniCard */ #define VEN_AWT_PCIe_DEVICE_ID 0x1059 #define VEN_AWT_PCI_VENDOR_ID 0x1A3B #define EDIMAX_PCI_VENDOR_ID 0x1432 -#endif //__RT2860_H__ // +#endif /*__RT2860_H__ // */ diff --git a/drivers/staging/rt2860/chip/rt2870.h b/drivers/staging/rt2860/chip/rt2870.h index 5115a3797e2c..8263f1baefae 100644 --- a/drivers/staging/rt2860/chip/rt2870.h +++ b/drivers/staging/rt2860/chip/rt2870.h @@ -40,7 +40,7 @@ #include "../rtmp_type.h" #include "mac_usb.h" -//#define RTMP_CHIP_NAME "RT2870" +/*#define RTMP_CHIP_NAME "RT2870" */ -#endif // RT2870 // -#endif //__RT2870_H__ // +#endif /* RT2870 // */ +#endif /*__RT2870_H__ // */ diff --git a/drivers/staging/rt2860/chip/rt3070.h b/drivers/staging/rt2860/chip/rt3070.h index 3781d9d9a927..172ce7054233 100644 --- a/drivers/staging/rt2860/chip/rt3070.h +++ b/drivers/staging/rt2860/chip/rt3070.h @@ -58,10 +58,10 @@ #include "mac_usb.h" #include "rt30xx.h" -// -// Device ID & Vendor ID, these values should match EEPROM value -// +/* */ +/* Device ID & Vendor ID, these values should match EEPROM value */ +/* */ -#endif // RT3070 // +#endif /* RT3070 // */ -#endif //__RT3070_H__ // +#endif /*__RT3070_H__ // */ diff --git a/drivers/staging/rt2860/chip/rt3090.h b/drivers/staging/rt2860/chip/rt3090.h index 92481ccabf38..102b938e74bd 100644 --- a/drivers/staging/rt2860/chip/rt3090.h +++ b/drivers/staging/rt2860/chip/rt3090.h @@ -60,13 +60,13 @@ #include "mac_pci.h" #include "rt30xx.h" -// -// Device ID & Vendor ID, these values should match EEPROM value -// -#define NIC3090_PCIe_DEVICE_ID 0x3090 // 1T/1R miniCard -#define NIC3091_PCIe_DEVICE_ID 0x3091 // 1T/2R miniCard -#define NIC3092_PCIe_DEVICE_ID 0x3092 // 2T/2R miniCard +/* */ +/* Device ID & Vendor ID, these values should match EEPROM value */ +/* */ +#define NIC3090_PCIe_DEVICE_ID 0x3090 /* 1T/1R miniCard */ +#define NIC3091_PCIe_DEVICE_ID 0x3091 /* 1T/2R miniCard */ +#define NIC3092_PCIe_DEVICE_ID 0x3092 /* 2T/2R miniCard */ -#endif // RT3090 // +#endif /* RT3090 // */ -#endif //__RT3090_H__ // +#endif /*__RT3090_H__ // */ diff --git a/drivers/staging/rt2860/chip/rt30xx.h b/drivers/staging/rt2860/chip/rt30xx.h index e6aa1756b4f3..477a20509a57 100644 --- a/drivers/staging/rt2860/chip/rt30xx.h +++ b/drivers/staging/rt2860/chip/rt30xx.h @@ -42,6 +42,6 @@ extern REG_PAIR RT30xx_RFRegTable[]; extern UCHAR NUM_RF_REG_PARMS; -#endif // RT30xx // +#endif /* RT30xx // */ -#endif //__RT30XX_H__ // +#endif /*__RT30XX_H__ // */ diff --git a/drivers/staging/rt2860/chip/rtmp_mac.h b/drivers/staging/rt2860/chip/rtmp_mac.h index 06321c0deaf8..dac15776ae72 100644 --- a/drivers/staging/rt2860/chip/rtmp_mac.h +++ b/drivers/staging/rt2860/chip/rtmp_mac.h @@ -38,70 +38,70 @@ #ifndef __RTMP_MAC_H__ #define __RTMP_MAC_H__ -// ================================================================================= -// TX / RX ring descriptor format -// ================================================================================= +/* ================================================================================= */ +/* TX / RX ring descriptor format */ +/* ================================================================================= */ -// the first 24-byte in TXD is called TXINFO and will be DMAed to MAC block through TXFIFO. -// MAC block use this TXINFO to control the transmission behavior of this frame. +/* the first 24-byte in TXD is called TXINFO and will be DMAed to MAC block through TXFIFO. */ +/* MAC block use this TXINFO to control the transmission behavior of this frame. */ #define FIFO_MGMT 0 #define FIFO_HCCA 1 #define FIFO_EDCA 2 -// -// TXD Wireless Information format for Tx ring and Mgmt Ring -// -//txop : for txop mode -// 0:txop for the MPDU frame will be handles by ASIC by register -// 1/2/3:the MPDU frame is send after PIFS/backoff/SIFS +/* */ +/* TXD Wireless Information format for Tx ring and Mgmt Ring */ +/* */ +/*txop : for txop mode */ +/* 0:txop for the MPDU frame will be handles by ASIC by register */ +/* 1/2/3:the MPDU frame is send after PIFS/backoff/SIFS */ typedef struct PACKED _TXWI_STRUC { - // Word 0 - // ex: 00 03 00 40 means txop = 3, PHYMODE = 1 - UINT32 FRAG:1; // 1 to inform TKIP engine this is a fragment. - UINT32 MIMOps:1; // the remote peer is in dynamic MIMO-PS mode + /* Word 0 */ + /* ex: 00 03 00 40 means txop = 3, PHYMODE = 1 */ + UINT32 FRAG:1; /* 1 to inform TKIP engine this is a fragment. */ + UINT32 MIMOps:1; /* the remote peer is in dynamic MIMO-PS mode */ UINT32 CFACK:1; UINT32 TS:1; UINT32 AMPDU:1; UINT32 MpduDensity:3; - UINT32 txop:2; //FOR "THIS" frame. 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs only when previous frame exchange is successful. + UINT32 txop:2; /*FOR "THIS" frame. 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs only when previous frame exchange is successful. */ UINT32 rsv:6; UINT32 MCS:7; - UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz + UINT32 BW:1; /*channel bandwidth 20MHz or 40 MHz */ UINT32 ShortGI:1; - UINT32 STBC:2; // 1: STBC support MCS =0-7, 2,3 : RESERVE - UINT32 Ifs:1; // -// UINT32 rsv2:2; //channel bandwidth 20MHz or 40 MHz + UINT32 STBC:2; /* 1: STBC support MCS =0-7, 2,3 : RESERVE */ + UINT32 Ifs:1; /* */ +/* UINT32 rsv2:2; //channel bandwidth 20MHz or 40 MHz */ UINT32 rsv2:1; - UINT32 TxBF:1; // 3*3 + UINT32 TxBF:1; /* 3*3 */ UINT32 PHYMODE:2; - // Word1 - // ex: 1c ff 38 00 means ACK=0, BAWinSize=7, MPDUtotalByteCount = 0x38 + /* Word1 */ + /* ex: 1c ff 38 00 means ACK=0, BAWinSize=7, MPDUtotalByteCount = 0x38 */ UINT32 ACK:1; UINT32 NSEQ:1; UINT32 BAWinSize:6; UINT32 WirelessCliID:8; UINT32 MPDUtotalByteCount:12; UINT32 PacketId:4; - //Word2 + /*Word2 */ UINT32 IV; - //Word3 + /*Word3 */ UINT32 EIV; } TXWI_STRUC, *PTXWI_STRUC; -// -// RXWI wireless information format, in PBF. invisible in driver. -// +/* */ +/* RXWI wireless information format, in PBF. invisible in driver. */ +/* */ typedef struct PACKED _RXWI_STRUC { - // Word 0 + /* Word 0 */ UINT32 WirelessCliID:8; UINT32 KeyIndex:2; UINT32 BSSID:3; UINT32 UDF:3; UINT32 MPDUtotalByteCount:12; UINT32 TID:4; - // Word 1 + /* Word 1 */ UINT32 FRAG:4; UINT32 SEQUENCE:12; UINT32 MCS:7; @@ -109,29 +109,29 @@ typedef struct PACKED _RXWI_STRUC { UINT32 ShortGI:1; UINT32 STBC:2; UINT32 rsv:3; - UINT32 PHYMODE:2; // 1: this RX frame is unicast to me - //Word2 + UINT32 PHYMODE:2; /* 1: this RX frame is unicast to me */ + /*Word2 */ UINT32 RSSI0:8; UINT32 RSSI1:8; UINT32 RSSI2:8; UINT32 rsv1:8; - //Word3 + /*Word3 */ UINT32 SNR0:8; UINT32 SNR1:8; - UINT32 FOFFSET:8; // RT35xx + UINT32 FOFFSET:8; /* RT35xx */ UINT32 rsv2:8; /*UINT32 rsv2:16; */ } RXWI_STRUC, *PRXWI_STRUC; -// ================================================================================= -// Register format -// ================================================================================= +/* ================================================================================= */ +/* Register format */ +/* ================================================================================= */ -// -// SCH/DMA registers - base address 0x0200 -// -// INT_SOURCE_CSR: Interrupt source register. Write one to clear corresponding bit -// +/* */ +/* SCH/DMA registers - base address 0x0200 */ +/* */ +/* INT_SOURCE_CSR: Interrupt source register. Write one to clear corresponding bit */ +/* */ #define DMA_CSR0 0x200 #define INT_SOURCE_CSR 0x200 typedef union _INT_SOURCE_CSR_STRUC { @@ -139,29 +139,29 @@ typedef union _INT_SOURCE_CSR_STRUC { UINT32 RxDelayINT:1; UINT32 TxDelayINT:1; UINT32 RxDone:1; - UINT32 Ac0DmaDone:1; //4 + UINT32 Ac0DmaDone:1; /*4 */ UINT32 Ac1DmaDone:1; UINT32 Ac2DmaDone:1; UINT32 Ac3DmaDone:1; - UINT32 HccaDmaDone:1; // bit7 + UINT32 HccaDmaDone:1; /* bit7 */ UINT32 MgmtDmaDone:1; - UINT32 MCUCommandINT:1; //bit 9 + UINT32 MCUCommandINT:1; /*bit 9 */ UINT32 RxTxCoherent:1; UINT32 TBTTInt:1; UINT32 PreTBTT:1; - UINT32 TXFifoStatusInt:1; //FIFO Statistics is full, sw should read 0x171c - UINT32 AutoWakeup:1; //bit14 + UINT32 TXFifoStatusInt:1; /*FIFO Statistics is full, sw should read 0x171c */ + UINT32 AutoWakeup:1; /*bit14 */ UINT32 GPTimer:1; - UINT32 RxCoherent:1; //bit16 + UINT32 RxCoherent:1; /*bit16 */ UINT32 TxCoherent:1; UINT32:14; } field; UINT32 word; } INT_SOURCE_CSR_STRUC, *PINT_SOURCE_CSR_STRUC; -// -// INT_MASK_CSR: Interrupt MASK register. 1: the interrupt is mask OFF -// +/* */ +/* INT_MASK_CSR: Interrupt MASK register. 1: the interrupt is mask OFF */ +/* */ #define INT_MASK_CSR 0x204 typedef union _INT_MASK_CSR_STRUC { struct { @@ -228,99 +228,99 @@ typedef union _DELAY_INT_CFG_STRUC { #define WMM_AIFSN_CFG 0x0214 typedef union _AIFSN_CSR_STRUC { struct { - UINT32 Aifsn0:4; // for AC_BE - UINT32 Aifsn1:4; // for AC_BK - UINT32 Aifsn2:4; // for AC_VI - UINT32 Aifsn3:4; // for AC_VO + UINT32 Aifsn0:4; /* for AC_BE */ + UINT32 Aifsn1:4; /* for AC_BK */ + UINT32 Aifsn2:4; /* for AC_VI */ + UINT32 Aifsn3:4; /* for AC_VO */ UINT32 Rsv:16; } field; UINT32 word; } AIFSN_CSR_STRUC, *PAIFSN_CSR_STRUC; -// -// CWMIN_CSR: CWmin for each EDCA AC -// +/* */ +/* CWMIN_CSR: CWmin for each EDCA AC */ +/* */ #define WMM_CWMIN_CFG 0x0218 typedef union _CWMIN_CSR_STRUC { struct { - UINT32 Cwmin0:4; // for AC_BE - UINT32 Cwmin1:4; // for AC_BK - UINT32 Cwmin2:4; // for AC_VI - UINT32 Cwmin3:4; // for AC_VO + UINT32 Cwmin0:4; /* for AC_BE */ + UINT32 Cwmin1:4; /* for AC_BK */ + UINT32 Cwmin2:4; /* for AC_VI */ + UINT32 Cwmin3:4; /* for AC_VO */ UINT32 Rsv:16; } field; UINT32 word; } CWMIN_CSR_STRUC, *PCWMIN_CSR_STRUC; -// -// CWMAX_CSR: CWmin for each EDCA AC -// +/* */ +/* CWMAX_CSR: CWmin for each EDCA AC */ +/* */ #define WMM_CWMAX_CFG 0x021c typedef union _CWMAX_CSR_STRUC { struct { - UINT32 Cwmax0:4; // for AC_BE - UINT32 Cwmax1:4; // for AC_BK - UINT32 Cwmax2:4; // for AC_VI - UINT32 Cwmax3:4; // for AC_VO + UINT32 Cwmax0:4; /* for AC_BE */ + UINT32 Cwmax1:4; /* for AC_BK */ + UINT32 Cwmax2:4; /* for AC_VI */ + UINT32 Cwmax3:4; /* for AC_VO */ UINT32 Rsv:16; } field; UINT32 word; } CWMAX_CSR_STRUC, *PCWMAX_CSR_STRUC; -// -// AC_TXOP_CSR0: AC_BK/AC_BE TXOP register -// +/* */ +/* AC_TXOP_CSR0: AC_BK/AC_BE TXOP register */ +/* */ #define WMM_TXOP0_CFG 0x0220 typedef union _AC_TXOP_CSR0_STRUC { struct { - USHORT Ac0Txop; // for AC_BK, in unit of 32us - USHORT Ac1Txop; // for AC_BE, in unit of 32us + USHORT Ac0Txop; /* for AC_BK, in unit of 32us */ + USHORT Ac1Txop; /* for AC_BE, in unit of 32us */ } field; UINT32 word; } AC_TXOP_CSR0_STRUC, *PAC_TXOP_CSR0_STRUC; -// -// AC_TXOP_CSR1: AC_VO/AC_VI TXOP register -// +/* */ +/* AC_TXOP_CSR1: AC_VO/AC_VI TXOP register */ +/* */ #define WMM_TXOP1_CFG 0x0224 typedef union _AC_TXOP_CSR1_STRUC { struct { - USHORT Ac2Txop; // for AC_VI, in unit of 32us - USHORT Ac3Txop; // for AC_VO, in unit of 32us + USHORT Ac2Txop; /* for AC_VI, in unit of 32us */ + USHORT Ac3Txop; /* for AC_VO, in unit of 32us */ } field; UINT32 word; } AC_TXOP_CSR1_STRUC, *PAC_TXOP_CSR1_STRUC; #define RINGREG_DIFF 0x10 -#define GPIO_CTRL_CFG 0x0228 //MAC_CSR13 +#define GPIO_CTRL_CFG 0x0228 /*MAC_CSR13 */ #define MCU_CMD_CFG 0x022c -#define TX_BASE_PTR0 0x0230 //AC_BK base address +#define TX_BASE_PTR0 0x0230 /*AC_BK base address */ #define TX_MAX_CNT0 0x0234 #define TX_CTX_IDX0 0x0238 #define TX_DTX_IDX0 0x023c -#define TX_BASE_PTR1 0x0240 //AC_BE base address +#define TX_BASE_PTR1 0x0240 /*AC_BE base address */ #define TX_MAX_CNT1 0x0244 #define TX_CTX_IDX1 0x0248 #define TX_DTX_IDX1 0x024c -#define TX_BASE_PTR2 0x0250 //AC_VI base address +#define TX_BASE_PTR2 0x0250 /*AC_VI base address */ #define TX_MAX_CNT2 0x0254 #define TX_CTX_IDX2 0x0258 #define TX_DTX_IDX2 0x025c -#define TX_BASE_PTR3 0x0260 //AC_VO base address +#define TX_BASE_PTR3 0x0260 /*AC_VO base address */ #define TX_MAX_CNT3 0x0264 #define TX_CTX_IDX3 0x0268 #define TX_DTX_IDX3 0x026c -#define TX_BASE_PTR4 0x0270 //HCCA base address +#define TX_BASE_PTR4 0x0270 /*HCCA base address */ #define TX_MAX_CNT4 0x0274 #define TX_CTX_IDX4 0x0278 #define TX_DTX_IDX4 0x027c -#define TX_BASE_PTR5 0x0280 //MGMT base address +#define TX_BASE_PTR5 0x0280 /*MGMT base address */ #define TX_MAX_CNT5 0x0284 #define TX_CTX_IDX5 0x0288 #define TX_DTX_IDX5 0x028c #define TX_MGMTMAX_CNT TX_MAX_CNT5 #define TX_MGMTCTX_IDX TX_CTX_IDX5 #define TX_MGMTDTX_IDX TX_DTX_IDX5 -#define RX_BASE_PTR 0x0290 //RX base address +#define RX_BASE_PTR 0x0290 /*RX base address */ #define RX_MAX_CNT 0x0294 #define RX_CRX_IDX 0x0298 #define RX_DRX_IDX 0x029c @@ -328,27 +328,27 @@ typedef union _AC_TXOP_CSR1_STRUC { #define USB_DMA_CFG 0x02a0 typedef union _USB_DMA_CFG_STRUC { struct { - UINT32 RxBulkAggTOut:8; //Rx Bulk Aggregation TimeOut in unit of 33ns - UINT32 RxBulkAggLmt:8; //Rx Bulk Aggregation Limit in unit of 256 bytes - UINT32 phyclear:1; //phy watch dog enable. write 1 + UINT32 RxBulkAggTOut:8; /*Rx Bulk Aggregation TimeOut in unit of 33ns */ + UINT32 RxBulkAggLmt:8; /*Rx Bulk Aggregation Limit in unit of 256 bytes */ + UINT32 phyclear:1; /*phy watch dog enable. write 1 */ UINT32 rsv:2; - UINT32 TxClear:1; //Clear USB DMA TX path - UINT32 TxopHalt:1; //Halt TXOP count down when TX buffer is full. - UINT32 RxBulkAggEn:1; //Enable Rx Bulk Aggregation - UINT32 RxBulkEn:1; //Enable USB DMA Rx - UINT32 TxBulkEn:1; //Enable USB DMA Tx - UINT32 EpoutValid:6; //OUT endpoint data valid - UINT32 RxBusy:1; //USB DMA RX FSM busy - UINT32 TxBusy:1; //USB DMA TX FSM busy + UINT32 TxClear:1; /*Clear USB DMA TX path */ + UINT32 TxopHalt:1; /*Halt TXOP count down when TX buffer is full. */ + UINT32 RxBulkAggEn:1; /*Enable Rx Bulk Aggregation */ + UINT32 RxBulkEn:1; /*Enable USB DMA Rx */ + UINT32 TxBulkEn:1; /*Enable USB DMA Tx */ + UINT32 EpoutValid:6; /*OUT endpoint data valid */ + UINT32 RxBusy:1; /*USB DMA RX FSM busy */ + UINT32 TxBusy:1; /*USB DMA TX FSM busy */ } field; UINT32 word; } USB_DMA_CFG_STRUC, *PUSB_DMA_CFG_STRUC; -// -// 3 PBF registers -// -// -// Most are for debug. Driver doesn't touch PBF register. +/* */ +/* 3 PBF registers */ +/* */ +/* */ +/* Most are for debug. Driver doesn't touch PBF register. */ #define PBF_SYS_CTRL 0x0400 #define PBF_CFG 0x0408 #define PBF_MAX_PCNT 0x040C @@ -361,224 +361,224 @@ typedef union _USB_DMA_CFG_STRUC { #ifdef RT30xx #ifdef RTMP_EFUSE_SUPPORT -// eFuse registers +/* eFuse registers */ #define EFUSE_CTRL 0x0580 #define EFUSE_DATA0 0x0590 #define EFUSE_DATA1 0x0594 #define EFUSE_DATA2 0x0598 #define EFUSE_DATA3 0x059c -#endif // RTMP_EFUSE_SUPPORT // -#endif // RT30xx // +#endif /* RTMP_EFUSE_SUPPORT // */ +#endif /* RT30xx // */ #define OSC_CTRL 0x5a4 #define PCIE_PHY_TX_ATTENUATION_CTRL 0x05C8 #define LDO_CFG0 0x05d4 #define GPIO_SWITCH 0x05dc -// -// 4 MAC registers -// -// -// 4.1 MAC SYSTEM configuration registers (offset:0x1000) -// +/* */ +/* 4 MAC registers */ +/* */ +/* */ +/* 4.1 MAC SYSTEM configuration registers (offset:0x1000) */ +/* */ #define MAC_CSR0 0x1000 typedef union _ASIC_VER_ID_STRUC { struct { - USHORT ASICRev; // reversion : 0 - USHORT ASICVer; // version : 2860 + USHORT ASICRev; /* reversion : 0 */ + USHORT ASICVer; /* version : 2860 */ } field; UINT32 word; } ASIC_VER_ID_STRUC, *PASIC_VER_ID_STRUC; -#define MAC_SYS_CTRL 0x1004 //MAC_CSR1 -#define MAC_ADDR_DW0 0x1008 // MAC ADDR DW0 -#define MAC_ADDR_DW1 0x100c // MAC ADDR DW1 -// -// MAC_CSR2: STA MAC register 0 -// +#define MAC_SYS_CTRL 0x1004 /*MAC_CSR1 */ +#define MAC_ADDR_DW0 0x1008 /* MAC ADDR DW0 */ +#define MAC_ADDR_DW1 0x100c /* MAC ADDR DW1 */ +/* */ +/* MAC_CSR2: STA MAC register 0 */ +/* */ typedef union _MAC_DW0_STRUC { struct { - UCHAR Byte0; // MAC address byte 0 - UCHAR Byte1; // MAC address byte 1 - UCHAR Byte2; // MAC address byte 2 - UCHAR Byte3; // MAC address byte 3 + UCHAR Byte0; /* MAC address byte 0 */ + UCHAR Byte1; /* MAC address byte 1 */ + UCHAR Byte2; /* MAC address byte 2 */ + UCHAR Byte3; /* MAC address byte 3 */ } field; UINT32 word; } MAC_DW0_STRUC, *PMAC_DW0_STRUC; -// -// MAC_CSR3: STA MAC register 1 -// +/* */ +/* MAC_CSR3: STA MAC register 1 */ +/* */ typedef union _MAC_DW1_STRUC { struct { - UCHAR Byte4; // MAC address byte 4 - UCHAR Byte5; // MAC address byte 5 + UCHAR Byte4; /* MAC address byte 4 */ + UCHAR Byte5; /* MAC address byte 5 */ UCHAR U2MeMask; UCHAR Rsvd1; } field; UINT32 word; } MAC_DW1_STRUC, *PMAC_DW1_STRUC; -#define MAC_BSSID_DW0 0x1010 // MAC BSSID DW0 -#define MAC_BSSID_DW1 0x1014 // MAC BSSID DW1 +#define MAC_BSSID_DW0 0x1010 /* MAC BSSID DW0 */ +#define MAC_BSSID_DW1 0x1014 /* MAC BSSID DW1 */ -// -// MAC_CSR5: BSSID register 1 -// +/* */ +/* MAC_CSR5: BSSID register 1 */ +/* */ typedef union _MAC_CSR5_STRUC { struct { - UCHAR Byte4; // BSSID byte 4 - UCHAR Byte5; // BSSID byte 5 - USHORT BssIdMask:2; // 0: one BSSID, 10: 4 BSSID, 01: 2 BSSID , 11: 8BSSID + UCHAR Byte4; /* BSSID byte 4 */ + UCHAR Byte5; /* BSSID byte 5 */ + USHORT BssIdMask:2; /* 0: one BSSID, 10: 4 BSSID, 01: 2 BSSID , 11: 8BSSID */ USHORT MBssBcnNum:3; USHORT Rsvd:11; } field; UINT32 word; } MAC_CSR5_STRUC, *PMAC_CSR5_STRUC; -#define MAX_LEN_CFG 0x1018 // rt2860b max 16k bytes. bit12:13 Maximum PSDU length (power factor) 0:2^13, 1:2^14, 2:2^15, 3:2^16 -#define BBP_CSR_CFG 0x101c // -// -// BBP_CSR_CFG: BBP serial control register -// +#define MAX_LEN_CFG 0x1018 /* rt2860b max 16k bytes. bit12:13 Maximum PSDU length (power factor) 0:2^13, 1:2^14, 2:2^15, 3:2^16 */ +#define BBP_CSR_CFG 0x101c /* */ +/* */ +/* BBP_CSR_CFG: BBP serial control register */ +/* */ typedef union _BBP_CSR_CFG_STRUC { struct { - UINT32 Value:8; // Register value to program into BBP - UINT32 RegNum:8; // Selected BBP register - UINT32 fRead:1; // 0: Write BBP, 1: Read BBP - UINT32 Busy:1; // 1: ASIC is busy execute BBP programming. - UINT32 BBP_PAR_DUR:1; // 0: 4 MAC clock cycles 1: 8 MAC clock cycles - UINT32 BBP_RW_MODE:1; // 0: use serial mode 1:parallel + UINT32 Value:8; /* Register value to program into BBP */ + UINT32 RegNum:8; /* Selected BBP register */ + UINT32 fRead:1; /* 0: Write BBP, 1: Read BBP */ + UINT32 Busy:1; /* 1: ASIC is busy execute BBP programming. */ + UINT32 BBP_PAR_DUR:1; /* 0: 4 MAC clock cycles 1: 8 MAC clock cycles */ + UINT32 BBP_RW_MODE:1; /* 0: use serial mode 1:parallel */ UINT32:12; } field; UINT32 word; } BBP_CSR_CFG_STRUC, *PBBP_CSR_CFG_STRUC; #define RF_CSR_CFG0 0x1020 -// -// RF_CSR_CFG: RF control register -// +/* */ +/* RF_CSR_CFG: RF control register */ +/* */ typedef union _RF_CSR_CFG0_STRUC { struct { - UINT32 RegIdAndContent:24; // Register value to program into BBP - UINT32 bitwidth:5; // Selected BBP register - UINT32 StandbyMode:1; // 0: high when stand by 1: low when standby - UINT32 Sel:1; // 0:RF_LE0 activate 1:RF_LE1 activate - UINT32 Busy:1; // 0: idle 1: 8busy + UINT32 RegIdAndContent:24; /* Register value to program into BBP */ + UINT32 bitwidth:5; /* Selected BBP register */ + UINT32 StandbyMode:1; /* 0: high when stand by 1: low when standby */ + UINT32 Sel:1; /* 0:RF_LE0 activate 1:RF_LE1 activate */ + UINT32 Busy:1; /* 0: idle 1: 8busy */ } field; UINT32 word; } RF_CSR_CFG0_STRUC, *PRF_CSR_CFG0_STRUC; #define RF_CSR_CFG1 0x1024 typedef union _RF_CSR_CFG1_STRUC { struct { - UINT32 RegIdAndContent:24; // Register value to program into BBP - UINT32 RFGap:5; // Gap between BB_CONTROL_RF and RF_LE. 0: 3 system clock cycle (37.5usec) 1: 5 system clock cycle (62.5usec) - UINT32 rsv:7; // 0: idle 1: 8busy + UINT32 RegIdAndContent:24; /* Register value to program into BBP */ + UINT32 RFGap:5; /* Gap between BB_CONTROL_RF and RF_LE. 0: 3 system clock cycle (37.5usec) 1: 5 system clock cycle (62.5usec) */ + UINT32 rsv:7; /* 0: idle 1: 8busy */ } field; UINT32 word; } RF_CSR_CFG1_STRUC, *PRF_CSR_CFG1_STRUC; -#define RF_CSR_CFG2 0x1028 // +#define RF_CSR_CFG2 0x1028 /* */ typedef union _RF_CSR_CFG2_STRUC { struct { - UINT32 RegIdAndContent:24; // Register value to program into BBP - UINT32 rsv:8; // 0: idle 1: 8busy + UINT32 RegIdAndContent:24; /* Register value to program into BBP */ + UINT32 rsv:8; /* 0: idle 1: 8busy */ } field; UINT32 word; } RF_CSR_CFG2_STRUC, *PRF_CSR_CFG2_STRUC; -#define LED_CFG 0x102c // MAC_CSR14 +#define LED_CFG 0x102c /* MAC_CSR14 */ typedef union _LED_CFG_STRUC { struct { - UINT32 OnPeriod:8; // blinking on period unit 1ms - UINT32 OffPeriod:8; // blinking off period unit 1ms - UINT32 SlowBlinkPeriod:6; // slow blinking period. unit:1ms + UINT32 OnPeriod:8; /* blinking on period unit 1ms */ + UINT32 OffPeriod:8; /* blinking off period unit 1ms */ + UINT32 SlowBlinkPeriod:6; /* slow blinking period. unit:1ms */ UINT32 rsv:2; - UINT32 RLedMode:2; // red Led Mode 0: off1: blinking upon TX2: periodic slow blinking3: always on - UINT32 GLedMode:2; // green Led Mode - UINT32 YLedMode:2; // yellow Led Mode - UINT32 LedPolar:1; // Led Polarity. 0: active low1: active high + UINT32 RLedMode:2; /* red Led Mode 0: off1: blinking upon TX2: periodic slow blinking3: always on */ + UINT32 GLedMode:2; /* green Led Mode */ + UINT32 YLedMode:2; /* yellow Led Mode */ + UINT32 LedPolar:1; /* Led Polarity. 0: active low1: active high */ UINT32:1; } field; UINT32 word; } LED_CFG_STRUC, *PLED_CFG_STRUC; -// -// 4.2 MAC TIMING configuration registers (offset:0x1100) -// -#define XIFS_TIME_CFG 0x1100 // MAC_CSR8 MAC_CSR9 +/* */ +/* 4.2 MAC TIMING configuration registers (offset:0x1100) */ +/* */ +#define XIFS_TIME_CFG 0x1100 /* MAC_CSR8 MAC_CSR9 */ typedef union _IFS_SLOT_CFG_STRUC { struct { - UINT32 CckmSifsTime:8; // unit 1us. Applied after CCK RX/TX - UINT32 OfdmSifsTime:8; // unit 1us. Applied after OFDM RX/TX - UINT32 OfdmXifsTime:4; //OFDM SIFS. unit 1us. Applied after OFDM RX when MAC doesn't reference BBP signal BBRXEND - UINT32 EIFS:9; // unit 1us - UINT32 BBRxendEnable:1; // reference RXEND signal to begin XIFS defer + UINT32 CckmSifsTime:8; /* unit 1us. Applied after CCK RX/TX */ + UINT32 OfdmSifsTime:8; /* unit 1us. Applied after OFDM RX/TX */ + UINT32 OfdmXifsTime:4; /*OFDM SIFS. unit 1us. Applied after OFDM RX when MAC doesn't reference BBP signal BBRXEND */ + UINT32 EIFS:9; /* unit 1us */ + UINT32 BBRxendEnable:1; /* reference RXEND signal to begin XIFS defer */ UINT32 rsv:2; } field; UINT32 word; } IFS_SLOT_CFG_STRUC, *PIFS_SLOT_CFG_STRUC; -#define BKOFF_SLOT_CFG 0x1104 // mac_csr9 last 8 bits -#define NAV_TIME_CFG 0x1108 // NAV (MAC_CSR15) -#define CH_TIME_CFG 0x110C // Count as channel busy -#define PBF_LIFE_TIMER 0x1110 //TX/RX MPDU timestamp timer (free run)Unit: 1us -#define BCN_TIME_CFG 0x1114 // TXRX_CSR9 +#define BKOFF_SLOT_CFG 0x1104 /* mac_csr9 last 8 bits */ +#define NAV_TIME_CFG 0x1108 /* NAV (MAC_CSR15) */ +#define CH_TIME_CFG 0x110C /* Count as channel busy */ +#define PBF_LIFE_TIMER 0x1110 /*TX/RX MPDU timestamp timer (free run)Unit: 1us */ +#define BCN_TIME_CFG 0x1114 /* TXRX_CSR9 */ #define BCN_OFFSET0 0x042C #define BCN_OFFSET1 0x0430 -// -// BCN_TIME_CFG : Synchronization control register -// +/* */ +/* BCN_TIME_CFG : Synchronization control register */ +/* */ typedef union _BCN_TIME_CFG_STRUC { struct { - UINT32 BeaconInterval:16; // in unit of 1/16 TU - UINT32 bTsfTicking:1; // Enable TSF auto counting - UINT32 TsfSyncMode:2; // Enable TSF sync, 00: disable, 01: infra mode, 10: ad-hoc mode + UINT32 BeaconInterval:16; /* in unit of 1/16 TU */ + UINT32 bTsfTicking:1; /* Enable TSF auto counting */ + UINT32 TsfSyncMode:2; /* Enable TSF sync, 00: disable, 01: infra mode, 10: ad-hoc mode */ UINT32 bTBTTEnable:1; - UINT32 bBeaconGen:1; // Enable beacon generator + UINT32 bBeaconGen:1; /* Enable beacon generator */ UINT32:3; UINT32 TxTimestampCompensate:8; } field; UINT32 word; } BCN_TIME_CFG_STRUC, *PBCN_TIME_CFG_STRUC; -#define TBTT_SYNC_CFG 0x1118 // txrx_csr10 -#define TSF_TIMER_DW0 0x111C // Local TSF timer lsb 32 bits. Read-only -#define TSF_TIMER_DW1 0x1120 // msb 32 bits. Read-only. -#define TBTT_TIMER 0x1124 // TImer remains till next TBTT. Read-only. TXRX_CSR14 -#define INT_TIMER_CFG 0x1128 // -#define INT_TIMER_EN 0x112c // GP-timer and pre-tbtt Int enable -#define CH_IDLE_STA 0x1130 // channel idle time -#define CH_BUSY_STA 0x1134 // channle busy time -// -// 4.2 MAC POWER configuration registers (offset:0x1200) -// -#define MAC_STATUS_CFG 0x1200 // old MAC_CSR12 -#define PWR_PIN_CFG 0x1204 // old MAC_CSR12 -#define AUTO_WAKEUP_CFG 0x1208 // old MAC_CSR10 -// -// AUTO_WAKEUP_CFG: Manual power control / status register -// +#define TBTT_SYNC_CFG 0x1118 /* txrx_csr10 */ +#define TSF_TIMER_DW0 0x111C /* Local TSF timer lsb 32 bits. Read-only */ +#define TSF_TIMER_DW1 0x1120 /* msb 32 bits. Read-only. */ +#define TBTT_TIMER 0x1124 /* TImer remains till next TBTT. Read-only. TXRX_CSR14 */ +#define INT_TIMER_CFG 0x1128 /* */ +#define INT_TIMER_EN 0x112c /* GP-timer and pre-tbtt Int enable */ +#define CH_IDLE_STA 0x1130 /* channel idle time */ +#define CH_BUSY_STA 0x1134 /* channle busy time */ +/* */ +/* 4.2 MAC POWER configuration registers (offset:0x1200) */ +/* */ +#define MAC_STATUS_CFG 0x1200 /* old MAC_CSR12 */ +#define PWR_PIN_CFG 0x1204 /* old MAC_CSR12 */ +#define AUTO_WAKEUP_CFG 0x1208 /* old MAC_CSR10 */ +/* */ +/* AUTO_WAKEUP_CFG: Manual power control / status register */ +/* */ typedef union _AUTO_WAKEUP_STRUC { struct { UINT32 AutoLeadTime:8; - UINT32 NumofSleepingTbtt:7; // ForceWake has high privilege than PutToSleep when both set - UINT32 EnableAutoWakeup:1; // 0:sleep, 1:awake + UINT32 NumofSleepingTbtt:7; /* ForceWake has high privilege than PutToSleep when both set */ + UINT32 EnableAutoWakeup:1; /* 0:sleep, 1:awake */ UINT32:16; } field; UINT32 word; } AUTO_WAKEUP_STRUC, *PAUTO_WAKEUP_STRUC; -// -// 4.3 MAC TX configuration registers (offset:0x1300) -// +/* */ +/* 4.3 MAC TX configuration registers (offset:0x1300) */ +/* */ -#define EDCA_AC0_CFG 0x1300 //AC_TXOP_CSR0 0x3474 +#define EDCA_AC0_CFG 0x1300 /*AC_TXOP_CSR0 0x3474 */ #define EDCA_AC1_CFG 0x1304 #define EDCA_AC2_CFG 0x1308 #define EDCA_AC3_CFG 0x130c typedef union _EDCA_AC_CFG_STRUC { struct { - UINT32 AcTxop:8; // in unit of 32us - UINT32 Aifsn:4; // # of slot time - UINT32 Cwmin:4; // - UINT32 Cwmax:4; //unit power of 2 - UINT32:12; // + UINT32 AcTxop:8; /* in unit of 32us */ + UINT32 Aifsn:4; /* # of slot time */ + UINT32 Cwmin:4; /* */ + UINT32 Cwmax:4; /*unit power of 2 */ + UINT32:12; /* */ } field; UINT32 word; } EDCA_AC_CFG_STRUC, *PEDCA_AC_CFG_STRUC; @@ -590,7 +590,7 @@ typedef union _EDCA_AC_CFG_STRUC { #define TX_PWR_CFG_3 0x1320 #define TX_PWR_CFG_4 0x1324 #define TX_PIN_CFG 0x1328 -#define TX_BAND_CFG 0x132c // 0x1 use upper 20MHz. 0 juse lower 20MHz +#define TX_BAND_CFG 0x132c /* 0x1 use upper 20MHz. 0 juse lower 20MHz */ #define TX_SW_CFG0 0x1330 #define TX_SW_CFG1 0x1334 #define TX_SW_CFG2 0x1338 @@ -601,9 +601,9 @@ typedef union _EDCA_AC_CFG_STRUC { typedef union _TX_RTS_CFG_STRUC { struct { UINT32 AutoRtsRetryLimit:8; - UINT32 RtsThres:16; // unit:byte - UINT32 RtsFbkEn:1; // enable rts rate fallback - UINT32 rsv:7; // 1: HT non-STBC control frame enable + UINT32 RtsThres:16; /* unit:byte */ + UINT32 RtsFbkEn:1; /* enable rts rate fallback */ + UINT32 rsv:7; /* 1: HT non-STBC control frame enable */ } field; UINT32 word; } TX_RTS_CFG_STRUC, *PTX_RTS_CFG_STRUC; @@ -611,38 +611,38 @@ typedef union _TX_RTS_CFG_STRUC { typedef union _TX_TIMEOUT_CFG_STRUC { struct { UINT32 rsv:4; - UINT32 MpduLifeTime:4; // expiration time = 2^(9+MPDU LIFE TIME) us - UINT32 RxAckTimeout:8; // unit:slot. Used for TX precedure - UINT32 TxopTimeout:8; //TXOP timeout value for TXOP truncation. It is recommended that (SLOT_TIME) > (TX_OP_TIMEOUT) > (RX_ACK_TIMEOUT) - UINT32 rsv2:8; // 1: HT non-STBC control frame enable + UINT32 MpduLifeTime:4; /* expiration time = 2^(9+MPDU LIFE TIME) us */ + UINT32 RxAckTimeout:8; /* unit:slot. Used for TX precedure */ + UINT32 TxopTimeout:8; /*TXOP timeout value for TXOP truncation. It is recommended that (SLOT_TIME) > (TX_OP_TIMEOUT) > (RX_ACK_TIMEOUT) */ + UINT32 rsv2:8; /* 1: HT non-STBC control frame enable */ } field; UINT32 word; } TX_TIMEOUT_CFG_STRUC, *PTX_TIMEOUT_CFG_STRUC; #define TX_RTY_CFG 0x134c typedef union PACKED _TX_RTY_CFG_STRUC { struct { - UINT32 ShortRtyLimit:8; // short retry limit - UINT32 LongRtyLimit:8; //long retry limit - UINT32 LongRtyThre:12; // Long retry threshoold - UINT32 NonAggRtyMode:1; // Non-Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer - UINT32 AggRtyMode:1; // Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer - UINT32 TxautoFBEnable:1; // Tx retry PHY rate auto fallback enable - UINT32 rsv:1; // 1: HT non-STBC control frame enable + UINT32 ShortRtyLimit:8; /* short retry limit */ + UINT32 LongRtyLimit:8; /*long retry limit */ + UINT32 LongRtyThre:12; /* Long retry threshoold */ + UINT32 NonAggRtyMode:1; /* Non-Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer */ + UINT32 AggRtyMode:1; /* Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer */ + UINT32 TxautoFBEnable:1; /* Tx retry PHY rate auto fallback enable */ + UINT32 rsv:1; /* 1: HT non-STBC control frame enable */ } field; UINT32 word; } TX_RTY_CFG_STRUC, *PTX_RTY_CFG_STRUC; #define TX_LINK_CFG 0x1350 typedef union PACKED _TX_LINK_CFG_STRUC { struct PACKED { - UINT32 RemoteMFBLifeTime:8; //remote MFB life time. unit : 32us - UINT32 MFBEnable:1; // TX apply remote MFB 1:enable - UINT32 RemoteUMFSEnable:1; // remote unsolicit MFB enable. 0: not apply remote remote unsolicit (MFS=7) - UINT32 TxMRQEn:1; // MCS request TX enable - UINT32 TxRDGEn:1; // RDG TX enable - UINT32 TxCFAckEn:1; // Piggyback CF-ACK enable - UINT32 rsv:3; // - UINT32 RemotMFB:8; // remote MCS feedback - UINT32 RemotMFS:8; //remote MCS feedback sequence number + UINT32 RemoteMFBLifeTime:8; /*remote MFB life time. unit : 32us */ + UINT32 MFBEnable:1; /* TX apply remote MFB 1:enable */ + UINT32 RemoteUMFSEnable:1; /* remote unsolicit MFB enable. 0: not apply remote remote unsolicit (MFS=7) */ + UINT32 TxMRQEn:1; /* MCS request TX enable */ + UINT32 TxRDGEn:1; /* RDG TX enable */ + UINT32 TxCFAckEn:1; /* Piggyback CF-ACK enable */ + UINT32 rsv:3; /* */ + UINT32 RemotMFB:8; /* remote MCS feedback */ + UINT32 RemotMFS:8; /*remote MCS feedback sequence number */ } field; UINT32 word; } TX_LINK_CFG_STRUC, *PTX_LINK_CFG_STRUC; @@ -677,116 +677,116 @@ typedef union _HT_FBK_CFG1_STRUC { #define LG_FBK_CFG0 0x135c typedef union _LG_FBK_CFG0_STRUC { struct { - UINT32 OFDMMCS0FBK:4; //initial value is 0 - UINT32 OFDMMCS1FBK:4; //initial value is 0 - UINT32 OFDMMCS2FBK:4; //initial value is 1 - UINT32 OFDMMCS3FBK:4; //initial value is 2 - UINT32 OFDMMCS4FBK:4; //initial value is 3 - UINT32 OFDMMCS5FBK:4; //initial value is 4 - UINT32 OFDMMCS6FBK:4; //initial value is 5 - UINT32 OFDMMCS7FBK:4; //initial value is 6 + UINT32 OFDMMCS0FBK:4; /*initial value is 0 */ + UINT32 OFDMMCS1FBK:4; /*initial value is 0 */ + UINT32 OFDMMCS2FBK:4; /*initial value is 1 */ + UINT32 OFDMMCS3FBK:4; /*initial value is 2 */ + UINT32 OFDMMCS4FBK:4; /*initial value is 3 */ + UINT32 OFDMMCS5FBK:4; /*initial value is 4 */ + UINT32 OFDMMCS6FBK:4; /*initial value is 5 */ + UINT32 OFDMMCS7FBK:4; /*initial value is 6 */ } field; UINT32 word; } LG_FBK_CFG0_STRUC, *PLG_FBK_CFG0_STRUC; #define LG_FBK_CFG1 0x1360 typedef union _LG_FBK_CFG1_STRUC { struct { - UINT32 CCKMCS0FBK:4; //initial value is 0 - UINT32 CCKMCS1FBK:4; //initial value is 0 - UINT32 CCKMCS2FBK:4; //initial value is 1 - UINT32 CCKMCS3FBK:4; //initial value is 2 + UINT32 CCKMCS0FBK:4; /*initial value is 0 */ + UINT32 CCKMCS1FBK:4; /*initial value is 0 */ + UINT32 CCKMCS2FBK:4; /*initial value is 1 */ + UINT32 CCKMCS3FBK:4; /*initial value is 2 */ UINT32 rsv:16; } field; UINT32 word; } LG_FBK_CFG1_STRUC, *PLG_FBK_CFG1_STRUC; -//======================================================= -//================ Protection Paramater================================ -//======================================================= -#define CCK_PROT_CFG 0x1364 //CCK Protection +/*======================================================= */ +/*================ Protection Paramater================================ */ +/*======================================================= */ +#define CCK_PROT_CFG 0x1364 /*CCK Protection */ #define ASIC_SHORTNAV 1 #define ASIC_LONGNAV 2 #define ASIC_RTS 1 #define ASIC_CTS 2 typedef union _PROT_CFG_STRUC { struct { - UINT32 ProtectRate:16; //Protection control frame rate for CCK TX(RTS/CTS/CFEnd). - UINT32 ProtectCtrl:2; //Protection control frame type for CCK TX. 1:RTS/CTS, 2:CTS-to-self, 0:None, 3:rsv - UINT32 ProtectNav:2; //TXOP protection type for CCK TX. 0:None, 1:ShortNAVprotect, 2:LongNAVProtect, 3:rsv - UINT32 TxopAllowCck:1; //CCK TXOP allowance.0:disallow. - UINT32 TxopAllowOfdm:1; //CCK TXOP allowance.0:disallow. - UINT32 TxopAllowMM20:1; //CCK TXOP allowance. 0:disallow. - UINT32 TxopAllowMM40:1; //CCK TXOP allowance.0:disallow. - UINT32 TxopAllowGF20:1; //CCK TXOP allowance.0:disallow. - UINT32 TxopAllowGF40:1; //CCK TXOP allowance.0:disallow. - UINT32 RTSThEn:1; //RTS threshold enable on CCK TX + UINT32 ProtectRate:16; /*Protection control frame rate for CCK TX(RTS/CTS/CFEnd). */ + UINT32 ProtectCtrl:2; /*Protection control frame type for CCK TX. 1:RTS/CTS, 2:CTS-to-self, 0:None, 3:rsv */ + UINT32 ProtectNav:2; /*TXOP protection type for CCK TX. 0:None, 1:ShortNAVprotect, 2:LongNAVProtect, 3:rsv */ + UINT32 TxopAllowCck:1; /*CCK TXOP allowance.0:disallow. */ + UINT32 TxopAllowOfdm:1; /*CCK TXOP allowance.0:disallow. */ + UINT32 TxopAllowMM20:1; /*CCK TXOP allowance. 0:disallow. */ + UINT32 TxopAllowMM40:1; /*CCK TXOP allowance.0:disallow. */ + UINT32 TxopAllowGF20:1; /*CCK TXOP allowance.0:disallow. */ + UINT32 TxopAllowGF40:1; /*CCK TXOP allowance.0:disallow. */ + UINT32 RTSThEn:1; /*RTS threshold enable on CCK TX */ UINT32 rsv:5; } field; UINT32 word; } PROT_CFG_STRUC, *PPROT_CFG_STRUC; -#define OFDM_PROT_CFG 0x1368 //OFDM Protection -#define MM20_PROT_CFG 0x136C //MM20 Protection -#define MM40_PROT_CFG 0x1370 //MM40 Protection -#define GF20_PROT_CFG 0x1374 //GF20 Protection -#define GF40_PROT_CFG 0x1378 //GR40 Protection -#define EXP_CTS_TIME 0x137C // -#define EXP_ACK_TIME 0x1380 // - -// -// 4.4 MAC RX configuration registers (offset:0x1400) -// -#define RX_FILTR_CFG 0x1400 //TXRX_CSR0 -#define AUTO_RSP_CFG 0x1404 //TXRX_CSR4 -// -// TXRX_CSR4: Auto-Responder/ -// +#define OFDM_PROT_CFG 0x1368 /*OFDM Protection */ +#define MM20_PROT_CFG 0x136C /*MM20 Protection */ +#define MM40_PROT_CFG 0x1370 /*MM40 Protection */ +#define GF20_PROT_CFG 0x1374 /*GF20 Protection */ +#define GF40_PROT_CFG 0x1378 /*GR40 Protection */ +#define EXP_CTS_TIME 0x137C /* */ +#define EXP_ACK_TIME 0x1380 /* */ + +/* */ +/* 4.4 MAC RX configuration registers (offset:0x1400) */ +/* */ +#define RX_FILTR_CFG 0x1400 /*TXRX_CSR0 */ +#define AUTO_RSP_CFG 0x1404 /*TXRX_CSR4 */ +/* */ +/* TXRX_CSR4: Auto-Responder/ */ +/* */ typedef union _AUTO_RSP_CFG_STRUC { struct { UINT32 AutoResponderEnable:1; - UINT32 BACAckPolicyEnable:1; // 0:long, 1:short preamble - UINT32 CTS40MMode:1; // Response CTS 40MHz duplicate mode - UINT32 CTS40MRef:1; // Response CTS 40MHz duplicate mode - UINT32 AutoResponderPreamble:1; // 0:long, 1:short preamble - UINT32 rsv:1; // Power bit value in conrtrol frame - UINT32 DualCTSEn:1; // Power bit value in conrtrol frame - UINT32 AckCtsPsmBit:1; // Power bit value in conrtrol frame + UINT32 BACAckPolicyEnable:1; /* 0:long, 1:short preamble */ + UINT32 CTS40MMode:1; /* Response CTS 40MHz duplicate mode */ + UINT32 CTS40MRef:1; /* Response CTS 40MHz duplicate mode */ + UINT32 AutoResponderPreamble:1; /* 0:long, 1:short preamble */ + UINT32 rsv:1; /* Power bit value in conrtrol frame */ + UINT32 DualCTSEn:1; /* Power bit value in conrtrol frame */ + UINT32 AckCtsPsmBit:1; /* Power bit value in conrtrol frame */ UINT32:24; } field; UINT32 word; } AUTO_RSP_CFG_STRUC, *PAUTO_RSP_CFG_STRUC; -#define LEGACY_BASIC_RATE 0x1408 // TXRX_CSR5 0x3054 +#define LEGACY_BASIC_RATE 0x1408 /* TXRX_CSR5 0x3054 */ #define HT_BASIC_RATE 0x140c #define HT_CTRL_CFG 0x1410 #define SIFS_COST_CFG 0x1414 -#define RX_PARSER_CFG 0x1418 //Set NAV for all received frames - -// -// 4.5 MAC Security configuration (offset:0x1500) -// -#define TX_SEC_CNT0 0x1500 // -#define RX_SEC_CNT0 0x1504 // -#define CCMP_FC_MUTE 0x1508 // -// -// 4.6 HCCA/PSMP (offset:0x1600) -// +#define RX_PARSER_CFG 0x1418 /*Set NAV for all received frames */ + +/* */ +/* 4.5 MAC Security configuration (offset:0x1500) */ +/* */ +#define TX_SEC_CNT0 0x1500 /* */ +#define RX_SEC_CNT0 0x1504 /* */ +#define CCMP_FC_MUTE 0x1508 /* */ +/* */ +/* 4.6 HCCA/PSMP (offset:0x1600) */ +/* */ #define TXOP_HLDR_ADDR0 0x1600 #define TXOP_HLDR_ADDR1 0x1604 #define TXOP_HLDR_ET 0x1608 #define QOS_CFPOLL_RA_DW0 0x160c #define QOS_CFPOLL_A1_DW1 0x1610 #define QOS_CFPOLL_QC 0x1614 -// -// 4.7 MAC Statistis registers (offset:0x1700) -// -#define RX_STA_CNT0 0x1700 // -#define RX_STA_CNT1 0x1704 // -#define RX_STA_CNT2 0x1708 // - -// -// RX_STA_CNT0_STRUC: RX PLCP error count & RX CRC error count -// +/* */ +/* 4.7 MAC Statistis registers (offset:0x1700) */ +/* */ +#define RX_STA_CNT0 0x1700 /* */ +#define RX_STA_CNT1 0x1704 /* */ +#define RX_STA_CNT2 0x1708 /* */ + +/* */ +/* RX_STA_CNT0_STRUC: RX PLCP error count & RX CRC error count */ +/* */ typedef union _RX_STA_CNT0_STRUC { struct { USHORT CrcErr; @@ -795,9 +795,9 @@ typedef union _RX_STA_CNT0_STRUC { UINT32 word; } RX_STA_CNT0_STRUC, *PRX_STA_CNT0_STRUC; -// -// RX_STA_CNT1_STRUC: RX False CCA count & RX LONG frame count -// +/* */ +/* RX_STA_CNT1_STRUC: RX False CCA count & RX LONG frame count */ +/* */ typedef union _RX_STA_CNT1_STRUC { struct { USHORT FalseCca; @@ -806,9 +806,9 @@ typedef union _RX_STA_CNT1_STRUC { UINT32 word; } RX_STA_CNT1_STRUC, *PRX_STA_CNT1_STRUC; -// -// RX_STA_CNT2_STRUC: -// +/* */ +/* RX_STA_CNT2_STRUC: */ +/* */ typedef union _RX_STA_CNT2_STRUC { struct { USHORT RxDupliCount; @@ -816,10 +816,10 @@ typedef union _RX_STA_CNT2_STRUC { } field; UINT32 word; } RX_STA_CNT2_STRUC, *PRX_STA_CNT2_STRUC; -#define TX_STA_CNT0 0x170C // -// -// STA_CSR3: TX Beacon count -// +#define TX_STA_CNT0 0x170C /* */ +/* */ +/* STA_CSR3: TX Beacon count */ +/* */ typedef union _TX_STA_CNT0_STRUC { struct { USHORT TxFailCount; @@ -827,10 +827,10 @@ typedef union _TX_STA_CNT0_STRUC { } field; UINT32 word; } TX_STA_CNT0_STRUC, *PTX_STA_CNT0_STRUC; -#define TX_STA_CNT1 0x1710 // -// -// TX_STA_CNT1: TX tx count -// +#define TX_STA_CNT1 0x1710 /* */ +/* */ +/* TX_STA_CNT1: TX tx count */ +/* */ typedef union _TX_STA_CNT1_STRUC { struct { USHORT TxSuccess; @@ -838,10 +838,10 @@ typedef union _TX_STA_CNT1_STRUC { } field; UINT32 word; } TX_STA_CNT1_STRUC, *PTX_STA_CNT1_STRUC; -#define TX_STA_CNT2 0x1714 // -// -// TX_STA_CNT2: TX tx count -// +#define TX_STA_CNT2 0x1714 /* */ +/* */ +/* TX_STA_CNT2: TX tx count */ +/* */ typedef union _TX_STA_CNT2_STRUC { struct { USHORT TxZeroLenCount; @@ -849,26 +849,26 @@ typedef union _TX_STA_CNT2_STRUC { } field; UINT32 word; } TX_STA_CNT2_STRUC, *PTX_STA_CNT2_STRUC; -#define TX_STA_FIFO 0x1718 // -// -// TX_STA_FIFO_STRUC: TX Result for specific PID status fifo register -// +#define TX_STA_FIFO 0x1718 /* */ +/* */ +/* TX_STA_FIFO_STRUC: TX Result for specific PID status fifo register */ +/* */ typedef union PACKED _TX_STA_FIFO_STRUC { struct { - UINT32 bValid:1; // 1:This register contains a valid TX result + UINT32 bValid:1; /* 1:This register contains a valid TX result */ UINT32 PidType:4; - UINT32 TxSuccess:1; // Tx No retry success - UINT32 TxAggre:1; // Tx Retry Success - UINT32 TxAckRequired:1; // Tx fail - UINT32 wcid:8; //wireless client index -// UINT32 SuccessRate:16; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16. - UINT32 SuccessRate:13; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16. + UINT32 TxSuccess:1; /* Tx No retry success */ + UINT32 TxAggre:1; /* Tx Retry Success */ + UINT32 TxAckRequired:1; /* Tx fail */ + UINT32 wcid:8; /*wireless client index */ +/* UINT32 SuccessRate:16; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16. */ + UINT32 SuccessRate:13; /*include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16. */ UINT32 TxBF:1; UINT32 Reserve:2; } field; UINT32 word; } TX_STA_FIFO_STRUC, *PTX_STA_FIFO_STRUC; -// Debug counter +/* Debug counter */ #define TX_AGG_CNT 0x171c typedef union _TX_AGG_CNT_STRUC { struct { @@ -877,7 +877,7 @@ typedef union _TX_AGG_CNT_STRUC { } field; UINT32 word; } TX_AGG_CNT_STRUC, *PTX_AGG_CNT_STRUC; -// Debug counter +/* Debug counter */ #define TX_AGG_CNT0 0x1720 typedef union _TX_AGG_CNT0_STRUC { struct { @@ -886,7 +886,7 @@ typedef union _TX_AGG_CNT0_STRUC { } field; UINT32 word; } TX_AGG_CNT0_STRUC, *PTX_AGG_CNT0_STRUC; -// Debug counter +/* Debug counter */ #define TX_AGG_CNT1 0x1724 typedef union _TX_AGG_CNT1_STRUC { struct { @@ -903,7 +903,7 @@ typedef union _TX_AGG_CNT2_STRUC { } field; UINT32 word; } TX_AGG_CNT2_STRUC, *PTX_AGG_CNT2_STRUC; -// Debug counter +/* Debug counter */ #define TX_AGG_CNT3 0x172c typedef union _TX_AGG_CNT3_STRUC { struct { @@ -912,7 +912,7 @@ typedef union _TX_AGG_CNT3_STRUC { } field; UINT32 word; } TX_AGG_CNT3_STRUC, *PTX_AGG_CNT3_STRUC; -// Debug counter +/* Debug counter */ #define TX_AGG_CNT4 0x1730 typedef union _TX_AGG_CNT4_STRUC { struct { @@ -948,32 +948,32 @@ typedef union _TX_AGG_CNT7_STRUC { #define MPDU_DENSITY_CNT 0x1740 typedef union _MPDU_DEN_CNT_STRUC { struct { - USHORT TXZeroDelCount; //TX zero length delimiter count - USHORT RXZeroDelCount; //RX zero length delimiter count + USHORT TXZeroDelCount; /*TX zero length delimiter count */ + USHORT RXZeroDelCount; /*RX zero length delimiter count */ } field; UINT32 word; } MPDU_DEN_CNT_STRUC, *PMPDU_DEN_CNT_STRUC; -// -// TXRX control registers - base address 0x3000 -// -// rt2860b UNKNOWN reg use R/O Reg Addr 0x77d0 first.. +/* */ +/* TXRX control registers - base address 0x3000 */ +/* */ +/* rt2860b UNKNOWN reg use R/O Reg Addr 0x77d0 first.. */ #define TXRX_CSR1 0x77d0 -// -// Security key table memory, base address = 0x1000 -// -#define MAC_WCID_BASE 0x1800 //8-bytes(use only 6-bytes) * 256 entry = +/* */ +/* Security key table memory, base address = 0x1000 */ +/* */ +#define MAC_WCID_BASE 0x1800 /*8-bytes(use only 6-bytes) * 256 entry = */ #define HW_WCID_ENTRY_SIZE 8 -#define PAIRWISE_KEY_TABLE_BASE 0x4000 // 32-byte * 256-entry = -byte +#define PAIRWISE_KEY_TABLE_BASE 0x4000 /* 32-byte * 256-entry = -byte */ #define HW_KEY_ENTRY_SIZE 0x20 -#define PAIRWISE_IVEIV_TABLE_BASE 0x6000 // 8-byte * 256-entry = -byte -#define MAC_IVEIV_TABLE_BASE 0x6000 // 8-byte * 256-entry = -byte +#define PAIRWISE_IVEIV_TABLE_BASE 0x6000 /* 8-byte * 256-entry = -byte */ +#define MAC_IVEIV_TABLE_BASE 0x6000 /* 8-byte * 256-entry = -byte */ #define HW_IVEIV_ENTRY_SIZE 8 -#define MAC_WCID_ATTRIBUTE_BASE 0x6800 // 4-byte * 256-entry = -byte +#define MAC_WCID_ATTRIBUTE_BASE 0x6800 /* 4-byte * 256-entry = -byte */ #define HW_WCID_ATTRI_SIZE 4 #define WCID_RESERVED 0x6bfc -#define SHARED_KEY_TABLE_BASE 0x6c00 // 32-byte * 16-entry = 512-byte -#define SHARED_KEY_MODE_BASE 0x7000 // 32-byte * 16-entry = 512-byte +#define SHARED_KEY_TABLE_BASE 0x6c00 /* 32-byte * 16-entry = 512-byte */ +#define SHARED_KEY_MODE_BASE 0x7000 /* 32-byte * 16-entry = 512-byte */ #define HW_SHARED_KEY_MODE_SIZE 4 #define SHAREDKEYTABLE 0 #define PAIRWISEKEYTABLE 1 @@ -999,48 +999,48 @@ typedef union _SHAREDKEY_MODE_STRUC { } field; UINT32 word; } SHAREDKEY_MODE_STRUC, *PSHAREDKEY_MODE_STRUC; -// 64-entry for pairwise key table -typedef struct _HW_WCID_ENTRY { // 8-byte per entry +/* 64-entry for pairwise key table */ +typedef struct _HW_WCID_ENTRY { /* 8-byte per entry */ UCHAR Address[6]; UCHAR Rsv[2]; } HW_WCID_ENTRY, PHW_WCID_ENTRY; -// ================================================================================= -// WCID format -// ================================================================================= -//7.1 WCID ENTRY format : 8bytes +/* ================================================================================= */ +/* WCID format */ +/* ================================================================================= */ +/*7.1 WCID ENTRY format : 8bytes */ typedef struct _WCID_ENTRY_STRUC { - UCHAR RXBABitmap7; // bit0 for TID8, bit7 for TID 15 - UCHAR RXBABitmap0; // bit0 for TID0, bit7 for TID 7 - UCHAR MAC[6]; // 0 for shared key table. 1 for pairwise key table + UCHAR RXBABitmap7; /* bit0 for TID8, bit7 for TID 15 */ + UCHAR RXBABitmap0; /* bit0 for TID0, bit7 for TID 7 */ + UCHAR MAC[6]; /* 0 for shared key table. 1 for pairwise key table */ } WCID_ENTRY_STRUC, *PWCID_ENTRY_STRUC; -//8.1.1 SECURITY KEY format : 8DW -// 32-byte per entry, total 16-entry for shared key table, 64-entry for pairwise key table -typedef struct _HW_KEY_ENTRY { // 32-byte per entry +/*8.1.1 SECURITY KEY format : 8DW */ +/* 32-byte per entry, total 16-entry for shared key table, 64-entry for pairwise key table */ +typedef struct _HW_KEY_ENTRY { /* 32-byte per entry */ UCHAR Key[16]; UCHAR TxMic[8]; UCHAR RxMic[8]; } HW_KEY_ENTRY, *PHW_KEY_ENTRY; -//8.1.2 IV/EIV format : 2DW +/*8.1.2 IV/EIV format : 2DW */ -//8.1.3 RX attribute entry format : 1DW +/*8.1.3 RX attribute entry format : 1DW */ typedef struct _MAC_ATTRIBUTE_STRUC { - UINT32 KeyTab:1; // 0 for shared key table. 1 for pairwise key table + UINT32 KeyTab:1; /* 0 for shared key table. 1 for pairwise key table */ UINT32 PairKeyMode:3; - UINT32 BSSIDIdx:3; //multipleBSS index for the WCID + UINT32 BSSIDIdx:3; /*multipleBSS index for the WCID */ UINT32 RXWIUDF:3; UINT32 rsv:22; } MAC_ATTRIBUTE_STRUC, *PMAC_ATTRIBUTE_STRUC; -// ================================================================================= -// HOST-MCU communication data structure -// ================================================================================= +/* ================================================================================= */ +/* HOST-MCU communication data structure */ +/* ================================================================================= */ -// -// H2M_MAILBOX_CSR: Host-to-MCU Mailbox -// +/* */ +/* H2M_MAILBOX_CSR: Host-to-MCU Mailbox */ +/* */ typedef union _H2M_MAILBOX_STRUC { struct { UINT32 LowByte:8; @@ -1051,9 +1051,9 @@ typedef union _H2M_MAILBOX_STRUC { UINT32 word; } H2M_MAILBOX_STRUC, *PH2M_MAILBOX_STRUC; -// -// M2H_CMD_DONE_CSR: MCU-to-Host command complete indication -// +/* */ +/* M2H_CMD_DONE_CSR: MCU-to-Host command complete indication */ +/* */ typedef union _M2H_CMD_DONE_STRUC { struct { UINT32 CmdToken0; @@ -1064,42 +1064,42 @@ typedef union _M2H_CMD_DONE_STRUC { UINT32 word; } M2H_CMD_DONE_STRUC, *PM2H_CMD_DONE_STRUC; -//NAV_TIME_CFG :NAV +/*NAV_TIME_CFG :NAV */ typedef union _NAV_TIME_CFG_STRUC { struct { - UCHAR Sifs; // in unit of 1-us - UCHAR SlotTime; // in unit of 1-us - USHORT Eifs:9; // in unit of 1-us - USHORT ZeroSifs:1; // Applied zero SIFS timer after OFDM RX 0: disable + UCHAR Sifs; /* in unit of 1-us */ + UCHAR SlotTime; /* in unit of 1-us */ + USHORT Eifs:9; /* in unit of 1-us */ + USHORT ZeroSifs:1; /* Applied zero SIFS timer after OFDM RX 0: disable */ USHORT rsv:6; } field; UINT32 word; } NAV_TIME_CFG_STRUC, *PNAV_TIME_CFG_STRUC; -// -// RX_FILTR_CFG: /RX configuration register -// +/* */ +/* RX_FILTR_CFG: /RX configuration register */ +/* */ typedef union _RX_FILTR_CFG_STRUC { struct { - UINT32 DropCRCErr:1; // Drop CRC error - UINT32 DropPhyErr:1; // Drop physical error - UINT32 DropNotToMe:1; // Drop not to me unicast frame - UINT32 DropNotMyBSSID:1; // Drop fram ToDs bit is true - - UINT32 DropVerErr:1; // Drop version error frame - UINT32 DropMcast:1; // Drop multicast frames - UINT32 DropBcast:1; // Drop broadcast frames - UINT32 DropDuplicate:1; // Drop duplicate frame - - UINT32 DropCFEndAck:1; // Drop Ps-Poll - UINT32 DropCFEnd:1; // Drop Ps-Poll - UINT32 DropAck:1; // Drop Ps-Poll - UINT32 DropCts:1; // Drop Ps-Poll - - UINT32 DropRts:1; // Drop Ps-Poll - UINT32 DropPsPoll:1; // Drop Ps-Poll - UINT32 DropBA:1; // - UINT32 DropBAR:1; // + UINT32 DropCRCErr:1; /* Drop CRC error */ + UINT32 DropPhyErr:1; /* Drop physical error */ + UINT32 DropNotToMe:1; /* Drop not to me unicast frame */ + UINT32 DropNotMyBSSID:1; /* Drop fram ToDs bit is true */ + + UINT32 DropVerErr:1; /* Drop version error frame */ + UINT32 DropMcast:1; /* Drop multicast frames */ + UINT32 DropBcast:1; /* Drop broadcast frames */ + UINT32 DropDuplicate:1; /* Drop duplicate frame */ + + UINT32 DropCFEndAck:1; /* Drop Ps-Poll */ + UINT32 DropCFEnd:1; /* Drop Ps-Poll */ + UINT32 DropAck:1; /* Drop Ps-Poll */ + UINT32 DropCts:1; /* Drop Ps-Poll */ + + UINT32 DropRts:1; /* Drop Ps-Poll */ + UINT32 DropPsPoll:1; /* Drop Ps-Poll */ + UINT32 DropBA:1; /* */ + UINT32 DropBAR:1; /* */ UINT32 DropRsvCntlType:1; UINT32:15; @@ -1107,23 +1107,23 @@ typedef union _RX_FILTR_CFG_STRUC { UINT32 word; } RX_FILTR_CFG_STRUC, *PRX_FILTR_CFG_STRUC; -// -// PHY_CSR4: RF serial control register -// +/* */ +/* PHY_CSR4: RF serial control register */ +/* */ typedef union _PHY_CSR4_STRUC { struct { - UINT32 RFRegValue:24; // Register value (include register id) serial out to RF/IF chip. - UINT32 NumberOfBits:5; // Number of bits used in RFRegValue (I:20, RFMD:22) - UINT32 IFSelect:1; // 1: select IF to program, 0: select RF to program - UINT32 PLL_LD:1; // RF PLL_LD status - UINT32 Busy:1; // 1: ASIC is busy execute RF programming. + UINT32 RFRegValue:24; /* Register value (include register id) serial out to RF/IF chip. */ + UINT32 NumberOfBits:5; /* Number of bits used in RFRegValue (I:20, RFMD:22) */ + UINT32 IFSelect:1; /* 1: select IF to program, 0: select RF to program */ + UINT32 PLL_LD:1; /* RF PLL_LD status */ + UINT32 Busy:1; /* 1: ASIC is busy execute RF programming. */ } field; UINT32 word; } PHY_CSR4_STRUC, *PPHY_CSR4_STRUC; -// -// SEC_CSR5: shared key table security mode register -// +/* */ +/* SEC_CSR5: shared key table security mode register */ +/* */ typedef union _SEC_CSR5_STRUC { struct { UINT32 Bss2Key0CipherAlg:3; @@ -1146,9 +1146,9 @@ typedef union _SEC_CSR5_STRUC { UINT32 word; } SEC_CSR5_STRUC, *PSEC_CSR5_STRUC; -// -// HOST_CMD_CSR: For HOST to interrupt embedded processor -// +/* */ +/* HOST_CMD_CSR: For HOST to interrupt embedded processor */ +/* */ typedef union _HOST_CMD_CSR_STRUC { struct { UINT32 HostCommand:8; @@ -1157,47 +1157,47 @@ typedef union _HOST_CMD_CSR_STRUC { UINT32 word; } HOST_CMD_CSR_STRUC, *PHOST_CMD_CSR_STRUC; -// -// AIFSN_CSR: AIFSN for each EDCA AC -// +/* */ +/* AIFSN_CSR: AIFSN for each EDCA AC */ +/* */ -// -// E2PROM_CSR: EEPROM control register -// +/* */ +/* E2PROM_CSR: EEPROM control register */ +/* */ typedef union _E2PROM_CSR_STRUC { struct { - UINT32 Reload:1; // Reload EEPROM content, write one to reload, self-cleared. + UINT32 Reload:1; /* Reload EEPROM content, write one to reload, self-cleared. */ UINT32 EepromSK:1; UINT32 EepromCS:1; UINT32 EepromDI:1; UINT32 EepromDO:1; - UINT32 Type:1; // 1: 93C46, 0:93C66 - UINT32 LoadStatus:1; // 1:loading, 0:done + UINT32 Type:1; /* 1: 93C46, 0:93C66 */ + UINT32 LoadStatus:1; /* 1:loading, 0:done */ UINT32 Rsvd:25; } field; UINT32 word; } E2PROM_CSR_STRUC, *PE2PROM_CSR_STRUC; -// -// QOS_CSR0: TXOP holder address0 register -// +/* */ +/* QOS_CSR0: TXOP holder address0 register */ +/* */ typedef union _QOS_CSR0_STRUC { struct { - UCHAR Byte0; // MAC address byte 0 - UCHAR Byte1; // MAC address byte 1 - UCHAR Byte2; // MAC address byte 2 - UCHAR Byte3; // MAC address byte 3 + UCHAR Byte0; /* MAC address byte 0 */ + UCHAR Byte1; /* MAC address byte 1 */ + UCHAR Byte2; /* MAC address byte 2 */ + UCHAR Byte3; /* MAC address byte 3 */ } field; UINT32 word; } QOS_CSR0_STRUC, *PQOS_CSR0_STRUC; -// -// QOS_CSR1: TXOP holder address1 register -// +/* */ +/* QOS_CSR1: TXOP holder address1 register */ +/* */ typedef union _QOS_CSR1_STRUC { struct { - UCHAR Byte4; // MAC address byte 4 - UCHAR Byte5; // MAC address byte 5 + UCHAR Byte4; /* MAC address byte 4 */ + UCHAR Byte5; /* MAC address byte 5 */ UCHAR Rsvd0; UCHAR Rsvd1; } field; @@ -1207,41 +1207,41 @@ typedef union _QOS_CSR1_STRUC { #define RF_CSR_CFG 0x500 typedef union _RF_CSR_CFG_STRUC { struct { - UINT RF_CSR_DATA:8; // DATA - UINT TESTCSR_RFACC_REGNUM:5; // RF register ID - UINT Rsvd2:3; // Reserved - UINT RF_CSR_WR:1; // 0: read 1: write - UINT RF_CSR_KICK:1; // kick RF register read/write - UINT Rsvd1:14; // Reserved + UINT RF_CSR_DATA:8; /* DATA */ + UINT TESTCSR_RFACC_REGNUM:5; /* RF register ID */ + UINT Rsvd2:3; /* Reserved */ + UINT RF_CSR_WR:1; /* 0: read 1: write */ + UINT RF_CSR_KICK:1; /* kick RF register read/write */ + UINT Rsvd1:14; /* Reserved */ } field; UINT word; } RF_CSR_CFG_STRUC, *PRF_CSR_CFG_STRUC; -// -// Other on-chip shared memory space, base = 0x2000 -// +/* */ +/* Other on-chip shared memory space, base = 0x2000 */ +/* */ -// CIS space - base address = 0x2000 +/* CIS space - base address = 0x2000 */ #define HW_CIS_BASE 0x2000 -// Carrier-sense CTS frame base address. It's where mac stores carrier-sense frame for carrier-sense function. +/* Carrier-sense CTS frame base address. It's where mac stores carrier-sense frame for carrier-sense function. */ #define HW_CS_CTS_BASE 0x7700 -// DFS CTS frame base address. It's where mac stores CTS frame for DFS. +/* DFS CTS frame base address. It's where mac stores CTS frame for DFS. */ #define HW_DFS_CTS_BASE 0x7780 #define HW_CTS_FRAME_SIZE 0x80 -// 2004-11-08 john - since NULL frame won't be that long (256 byte). We steal 16 tail bytes -// to save debugging settings -#define HW_DEBUG_SETTING_BASE 0x77f0 // 0x77f0~0x77ff total 16 bytes -#define HW_DEBUG_SETTING_BASE2 0x7770 // 0x77f0~0x77ff total 16 bytes - -// In order to support maximum 8 MBSS and its maximum length is 512 for each beacon -// Three section discontinue memory segments will be used. -// 1. The original region for BCN 0~3 -// 2. Extract memory from FCE table for BCN 4~5 -// 3. Extract memory from Pair-wise key table for BCN 6~7 -// It occupied those memory of wcid 238~253 for BCN 6 -// and wcid 222~237 for BCN 7 +/* 2004-11-08 john - since NULL frame won't be that long (256 byte). We steal 16 tail bytes */ +/* to save debugging settings */ +#define HW_DEBUG_SETTING_BASE 0x77f0 /* 0x77f0~0x77ff total 16 bytes */ +#define HW_DEBUG_SETTING_BASE2 0x7770 /* 0x77f0~0x77ff total 16 bytes */ + +/* In order to support maximum 8 MBSS and its maximum length is 512 for each beacon */ +/* Three section discontinue memory segments will be used. */ +/* 1. The original region for BCN 0~3 */ +/* 2. Extract memory from FCE table for BCN 4~5 */ +/* 3. Extract memory from Pair-wise key table for BCN 6~7 */ +/* It occupied those memory of wcid 238~253 for BCN 6 */ +/* and wcid 222~237 for BCN 7 */ #define HW_BEACON_MAX_SIZE 0x1000 /* unit: byte */ #define HW_BEACON_BASE0 0x7800 #define HW_BEACON_BASE1 0x7A00 @@ -1256,7 +1256,7 @@ typedef union _RF_CSR_CFG_STRUC { #define HW_BEACON_OFFSET 0x0200 #define HW_BEACON_CONTENT_LEN (HW_BEACON_OFFSET - TXWI_SIZE) -// HOST-MCU shared memory - base address = 0x2100 +/* HOST-MCU shared memory - base address = 0x2100 */ #define HOST_CMD_CSR 0x404 #define H2M_MAILBOX_CSR 0x7010 #define H2M_MAILBOX_CID 0x7014 @@ -1264,37 +1264,37 @@ typedef union _RF_CSR_CFG_STRUC { #define H2M_INT_SRC 0x7024 #define H2M_BBP_AGENT 0x7028 #define M2H_CMD_DONE_CSR 0x000c -#define MCU_TXOP_ARRAY_BASE 0x000c // TODO: to be provided by Albert -#define MCU_TXOP_ENTRY_SIZE 32 // TODO: to be provided by Albert -#define MAX_NUM_OF_TXOP_ENTRY 16 // TODO: must be same with 8051 firmware -#define MCU_MBOX_VERSION 0x01 // TODO: to be confirmed by Albert -#define MCU_MBOX_VERSION_OFFSET 5 // TODO: to be provided by Albert - -// -// Host DMA registers - base address 0x200 . TX0-3=EDCAQid0-3, TX4=HCCA, TX5=MGMT, -// -// -// DMA RING DESCRIPTOR -// +#define MCU_TXOP_ARRAY_BASE 0x000c /* TODO: to be provided by Albert */ +#define MCU_TXOP_ENTRY_SIZE 32 /* TODO: to be provided by Albert */ +#define MAX_NUM_OF_TXOP_ENTRY 16 /* TODO: must be same with 8051 firmware */ +#define MCU_MBOX_VERSION 0x01 /* TODO: to be confirmed by Albert */ +#define MCU_MBOX_VERSION_OFFSET 5 /* TODO: to be provided by Albert */ + +/* */ +/* Host DMA registers - base address 0x200 . TX0-3=EDCAQid0-3, TX4=HCCA, TX5=MGMT, */ +/* */ +/* */ +/* DMA RING DESCRIPTOR */ +/* */ #define E2PROM_CSR 0x0004 #define IO_CNTL_CSR 0x77d0 -// ================================================================ -// Tx / Rx / Mgmt ring descriptor definition -// ================================================================ +/* ================================================================ */ +/* Tx / Rx / Mgmt ring descriptor definition */ +/* ================================================================ */ -// the following PID values are used to mark outgoing frame type in TXD->PID so that -// proper TX statistics can be collected based on these categories -// b3-2 of PID field - +/* the following PID values are used to mark outgoing frame type in TXD->PID so that */ +/* proper TX statistics can be collected based on these categories */ +/* b3-2 of PID field - */ #define PID_MGMT 0x05 #define PID_BEACON 0x0c #define PID_DATA_NORMALUCAST 0x02 #define PID_DATA_AMPDU 0x04 #define PID_DATA_NO_ACK 0x08 #define PID_DATA_NOT_NORM_ACK 0x03 -// value domain of pTxD->HostQId (4-bit: 0~15) -#define QID_AC_BK 1 // meet ACI definition in 802.11e -#define QID_AC_BE 0 // meet ACI definition in 802.11e +/* value domain of pTxD->HostQId (4-bit: 0~15) */ +#define QID_AC_BK 1 /* meet ACI definition in 802.11e */ +#define QID_AC_BE 0 /* meet ACI definition in 802.11e */ #define QID_AC_VI 2 #define QID_AC_VO 3 #define QID_HCCA 4 @@ -1303,4 +1303,4 @@ typedef union _RF_CSR_CFG_STRUC { #define QID_RX 14 #define QID_OTHER 15 -#endif // __RTMP_MAC_H__ // +#endif /* __RTMP_MAC_H__ // */ diff --git a/drivers/staging/rt2860/chip/rtmp_phy.h b/drivers/staging/rt2860/chip/rtmp_phy.h index bbf920d818d8..fd1a989c1110 100644 --- a/drivers/staging/rt2860/chip/rtmp_phy.h +++ b/drivers/staging/rt2860/chip/rtmp_phy.h @@ -74,30 +74,30 @@ #define RF_R30 30 #define RF_R31 31 -// value domain of pAd->RfIcType -#define RFIC_2820 1 // 2.4G 2T3R -#define RFIC_2850 2 // 2.4G/5G 2T3R -#define RFIC_2720 3 // 2.4G 1T2R -#define RFIC_2750 4 // 2.4G/5G 1T2R -#define RFIC_3020 5 // 2.4G 1T1R -#define RFIC_2020 6 // 2.4G B/G -#define RFIC_3021 7 // 2.4G 1T2R -#define RFIC_3022 8 // 2.4G 2T2R -#define RFIC_3052 9 // 2.4G/5G 2T2R +/* value domain of pAd->RfIcType */ +#define RFIC_2820 1 /* 2.4G 2T3R */ +#define RFIC_2850 2 /* 2.4G/5G 2T3R */ +#define RFIC_2720 3 /* 2.4G 1T2R */ +#define RFIC_2750 4 /* 2.4G/5G 1T2R */ +#define RFIC_3020 5 /* 2.4G 1T1R */ +#define RFIC_2020 6 /* 2.4G B/G */ +#define RFIC_3021 7 /* 2.4G 1T2R */ +#define RFIC_3022 8 /* 2.4G 2T2R */ +#define RFIC_3052 9 /* 2.4G/5G 2T2R */ /* BBP sections */ -#define BBP_R0 0 // version -#define BBP_R1 1 // TSSI -#define BBP_R2 2 // TX configure +#define BBP_R0 0 /* version */ +#define BBP_R1 1 /* TSSI */ +#define BBP_R2 2 /* TX configure */ #define BBP_R3 3 #define BBP_R4 4 #define BBP_R5 5 #define BBP_R6 6 -#define BBP_R14 14 // RX configure +#define BBP_R14 14 /* RX configure */ #define BBP_R16 16 -#define BBP_R17 17 // RX sensibility +#define BBP_R17 17 /* RX sensibility */ #define BBP_R18 18 #define BBP_R21 21 #define BBP_R22 22 @@ -106,12 +106,12 @@ #define BBP_R26 26 #define BBP_R27 27 #define BBP_R31 31 -#define BBP_R49 49 //TSSI +#define BBP_R49 49 /*TSSI */ #define BBP_R50 50 #define BBP_R51 51 #define BBP_R52 52 #define BBP_R55 55 -#define BBP_R62 62 // Rx SQ0 Threshold HIGH +#define BBP_R62 62 /* Rx SQ0 Threshold HIGH */ #define BBP_R63 63 #define BBP_R64 64 #define BBP_R65 65 @@ -119,7 +119,7 @@ #define BBP_R67 67 #define BBP_R68 68 #define BBP_R69 69 -#define BBP_R70 70 // Rx AGC SQ CCK Xcorr threshold +#define BBP_R70 70 /* Rx AGC SQ CCK Xcorr threshold */ #define BBP_R73 73 #define BBP_R75 75 #define BBP_R77 77 @@ -133,7 +133,7 @@ #define BBP_R86 86 #define BBP_R91 91 #define BBP_R92 92 -#define BBP_R94 94 // Tx Gain Control +#define BBP_R94 94 /* Tx Gain Control */ #define BBP_R103 103 #define BBP_R105 105 #define BBP_R106 106 @@ -149,22 +149,22 @@ #define BBP_R122 122 #define BBP_R123 123 #ifdef RT30xx -#define BBP_R138 138 // add by johnli, RF power sequence setup, ADC dynamic on/off control -#endif // RT30xx // +#define BBP_R138 138 /* add by johnli, RF power sequence setup, ADC dynamic on/off control */ +#endif /* RT30xx // */ -#define BBPR94_DEFAULT 0x06 // Add 1 value will gain 1db +#define BBPR94_DEFAULT 0x06 /* Add 1 value will gain 1db */ -// -// BBP & RF are using indirect access. Before write any value into it. -// We have to make sure there is no outstanding command pending via checking busy bit. -// -#define MAX_BUSY_COUNT 100 // Number of retry before failing access BBP & RF indirect register +/* */ +/* BBP & RF are using indirect access. Before write any value into it. */ +/* We have to make sure there is no outstanding command pending via checking busy bit. */ +/* */ +#define MAX_BUSY_COUNT 100 /* Number of retry before failing access BBP & RF indirect register */ -//#define PHY_TR_SWITCH_TIME 5 // usec +/*#define PHY_TR_SWITCH_TIME 5 // usec */ -//#define BBP_R17_LOW_SENSIBILITY 0x50 -//#define BBP_R17_MID_SENSIBILITY 0x41 -//#define BBP_R17_DYNAMIC_UP_BOUND 0x40 +/*#define BBP_R17_LOW_SENSIBILITY 0x50 */ +/*#define BBP_R17_MID_SENSIBILITY 0x41 */ +/*#define BBP_R17_DYNAMIC_UP_BOUND 0x40 */ #define RSSI_FOR_VERY_LOW_SENSIBILITY -35 #define RSSI_FOR_LOW_SENSIBILITY -58 @@ -194,15 +194,15 @@ } \ } \ } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB #define RTMP_RF_IO_WRITE32(_A, _V) RTUSBWriteRFRegister(_A, _V) -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ #ifdef RT30xx #define RTMP_RF_IO_READ8_BY_REG_ID(_A, _I, _pV) RT30xxReadRFRegister(_A, _I, _pV) #define RTMP_RF_IO_WRITE8_BY_REG_ID(_A, _I, _V) RT30xxWriteRFRegister(_A, _I, _V) -#endif // RT30xx // +#endif /* RT30xx // */ /***************************************************************************** BBP register Read/Write marco definitions. @@ -276,7 +276,7 @@ But for some chipset which didn't have mcu (e.g., RBUS based chipset), we will use this function too and didn't access the bbp register via the MCU. */ -// Read BBP register by register's ID. Generate PER to test BA +/* Read BBP register by register's ID. Generate PER to test BA */ #define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \ { \ BBP_CSR_CFG_STRUC BbpCsr; \ @@ -425,7 +425,7 @@ But for some chipset which didn't have mcu (e.g., RBUS based chipset), we will use this function too and didn't access the bbp register via the MCU. */ -// Write BBP register by register's ID & value +/* Write BBP register by register's ID & value */ #define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \ { \ BBP_CSR_CFG_STRUC BbpCsr; \ @@ -510,7 +510,7 @@ DBGPRINT_ERR(("****** BBP_Write_Latch Buffer exceeds max boundry ****** \n")); \ } \ } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB #define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) RTUSBReadBBPRegister(_A, _I, _pV) @@ -518,7 +518,7 @@ #define BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) RTUSBWriteBBPRegister(_A, _I, _V) #define BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) RTUSBReadBBPRegister(_A, _I, _pV) -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ #ifdef RT30xx #define RTMP_ASIC_MMPS_DISABLE(_pAd) \ @@ -551,6 +551,6 @@ RTMP_IO_WRITE32(_pAd, 0x1210, _macData); \ }while(0) -#endif // RT30xx // +#endif /* RT30xx // */ -#endif // __RTMP_PHY_H__ // +#endif /* __RTMP_PHY_H__ // */ diff --git a/drivers/staging/rt2860/chlist.h b/drivers/staging/rt2860/chlist.h index e3d55b429fbc..af8b5ca75930 100644 --- a/drivers/staging/rt2860/chlist.h +++ b/drivers/staging/rt2860/chlist.h @@ -52,14 +52,14 @@ typedef struct _CH_DESP { UCHAR FirstChannel; UCHAR NumOfCh; - CHAR MaxTxPwr; // dBm - UCHAR Geography; // 0:out door, 1:in door, 2:both - BOOLEAN DfsReq; // Dfs require, 0: No, 1: yes. + CHAR MaxTxPwr; /* dBm */ + UCHAR Geography; /* 0:out door, 1:in door, 2:both */ + BOOLEAN DfsReq; /* Dfs require, 0: No, 1: yes. */ } CH_DESP, *PCH_DESP; typedef struct _CH_REGION { UCHAR CountReg[3]; - UCHAR DfsType; // 0: CE, 1: FCC, 2: JAP, 3:JAP_W53, JAP_W56 + UCHAR DfsType; /* 0: CE, 1: FCC, 2: JAP, 3:JAP_W53, JAP_W56 */ CH_DESP ChDesp[10]; } CH_REGION, *PCH_REGION; @@ -114,4 +114,4 @@ VOID N_SetCenCh(IN PRTMP_ADAPTER pAd); UINT8 GetCuntryMaxTxPwr(IN PRTMP_ADAPTER pAd, IN UINT8 channel); -#endif // __CHLIST_H__ +#endif /* __CHLIST_H__ */ diff --git a/drivers/staging/rt2860/eeprom.h b/drivers/staging/rt2860/eeprom.h index 56aa58300c7b..4d8e8bf1c236 100644 --- a/drivers/staging/rt2860/eeprom.h +++ b/drivers/staging/rt2860/eeprom.h @@ -43,25 +43,25 @@ ************************************************************************/ int rtmp_ee_prom_read16(IN PRTMP_ADAPTER pAd, IN USHORT Offset, OUT USHORT * pValue); -#endif // RTMP_PCI_SUPPORT // +#endif /* RTMP_PCI_SUPPORT // */ #ifdef RTMP_USB_SUPPORT /************************************************************************* * Public function declarations for usb-based prom chipset ************************************************************************/ NTSTATUS RTUSBReadEEPROM16(IN PRTMP_ADAPTER pAd, IN USHORT offset, OUT PUSHORT pData); -#endif // RTMP_USB_SUPPORT // +#endif /* RTMP_USB_SUPPORT // */ #ifdef RT30xx #ifdef RTMP_EFUSE_SUPPORT int rtmp_ee_efuse_read16(IN RTMP_ADAPTER * pAd, IN USHORT Offset, OUT USHORT * pValue); -#endif // RTMP_EFUSE_SUPPORT // -#endif // RT30xx // +#endif /* RTMP_EFUSE_SUPPORT // */ +#endif /* RT30xx // */ /************************************************************************* * Public function declarations for prom operation callback functions setting ************************************************************************/ INT RtmpChipOpsEepromHook(IN RTMP_ADAPTER * pAd, IN INT infType); -#endif // __EEPROM_H__ // +#endif /* __EEPROM_H__ // */ diff --git a/drivers/staging/rt2860/mlme.h b/drivers/staging/rt2860/mlme.h index cb3cc9bbc1f4..8585a4d95f0b 100644 --- a/drivers/staging/rt2860/mlme.h +++ b/drivers/staging/rt2860/mlme.h @@ -41,18 +41,18 @@ #include "rtmp_dot11.h" -// maximum supported capability information - -// ESS, IBSS, Privacy, Short Preamble, Spectrum mgmt, Short Slot +/* maximum supported capability information - */ +/* ESS, IBSS, Privacy, Short Preamble, Spectrum mgmt, Short Slot */ #define SUPPORTED_CAPABILITY_INFO 0x0533 #define END_OF_ARGS -1 #define LFSR_MASK 0x80000057 -#define MLME_TASK_EXEC_INTV 100/*200*/ // +#define MLME_TASK_EXEC_INTV 100/*200*/ /* */ #define LEAD_TIME 5 -#define MLME_TASK_EXEC_MULTIPLE 10 /*5*/ // MLME_TASK_EXEC_MULTIPLE * MLME_TASK_EXEC_INTV = 1 sec -#define REORDER_EXEC_INTV 100 // 0.1 sec +#define MLME_TASK_EXEC_MULTIPLE 10 /*5*/ /* MLME_TASK_EXEC_MULTIPLE * MLME_TASK_EXEC_INTV = 1 sec */ +#define REORDER_EXEC_INTV 100 /* 0.1 sec */ -// The definition of Radar detection duration region +/* The definition of Radar detection duration region */ #define CE 0 #define FCC 1 #define JAP 2 @@ -60,61 +60,61 @@ #define JAP_W56 4 #define MAX_RD_REGION 5 -#define BEACON_LOST_TIME 4 * OS_HZ // 2048 msec = 2 sec - -#define DLS_TIMEOUT 1200 // unit: msec -#define AUTH_TIMEOUT 300 // unit: msec -#define ASSOC_TIMEOUT 300 // unit: msec -#define JOIN_TIMEOUT 2000 // unit: msec -#define SHORT_CHANNEL_TIME 90 // unit: msec -#define MIN_CHANNEL_TIME 110 // unit: msec, for dual band scan -#define MAX_CHANNEL_TIME 140 // unit: msec, for single band scan -#define FAST_ACTIVE_SCAN_TIME 30 // Active scan waiting for probe response time -#define CW_MIN_IN_BITS 4 // actual CwMin = 2^CW_MIN_IN_BITS - 1 -#define LINK_DOWN_TIMEOUT 20000 // unit: msec -#define AUTO_WAKEUP_TIMEOUT 70 //unit: msec - -#define CW_MAX_IN_BITS 10 // actual CwMax = 2^CW_MAX_IN_BITS - 1 - -// Note: RSSI_TO_DBM_OFFSET has been changed to variable for new RF (2004-0720). -// SHould not refer to this constant anymore -//#define RSSI_TO_DBM_OFFSET 120 // for RT2530 RSSI-115 = dBm -#define RSSI_FOR_MID_TX_POWER -55 // -55 db is considered mid-distance -#define RSSI_FOR_LOW_TX_POWER -45 // -45 db is considered very short distance and - // eligible to use a lower TX power +#define BEACON_LOST_TIME 4 * OS_HZ /* 2048 msec = 2 sec */ + +#define DLS_TIMEOUT 1200 /* unit: msec */ +#define AUTH_TIMEOUT 300 /* unit: msec */ +#define ASSOC_TIMEOUT 300 /* unit: msec */ +#define JOIN_TIMEOUT 2000 /* unit: msec */ +#define SHORT_CHANNEL_TIME 90 /* unit: msec */ +#define MIN_CHANNEL_TIME 110 /* unit: msec, for dual band scan */ +#define MAX_CHANNEL_TIME 140 /* unit: msec, for single band scan */ +#define FAST_ACTIVE_SCAN_TIME 30 /* Active scan waiting for probe response time */ +#define CW_MIN_IN_BITS 4 /* actual CwMin = 2^CW_MIN_IN_BITS - 1 */ +#define LINK_DOWN_TIMEOUT 20000 /* unit: msec */ +#define AUTO_WAKEUP_TIMEOUT 70 /*unit: msec */ + +#define CW_MAX_IN_BITS 10 /* actual CwMax = 2^CW_MAX_IN_BITS - 1 */ + +/* Note: RSSI_TO_DBM_OFFSET has been changed to variable for new RF (2004-0720). */ +/* SHould not refer to this constant anymore */ +/*#define RSSI_TO_DBM_OFFSET 120 // for RT2530 RSSI-115 = dBm */ +#define RSSI_FOR_MID_TX_POWER -55 /* -55 db is considered mid-distance */ +#define RSSI_FOR_LOW_TX_POWER -45 /* -45 db is considered very short distance and */ + /* eligible to use a lower TX power */ #define RSSI_FOR_LOWEST_TX_POWER -30 -//#define MID_TX_POWER_DELTA 0 // 0 db from full TX power upon mid-distance to AP -#define LOW_TX_POWER_DELTA 6 // -3 db from full TX power upon very short distance. 1 grade is 0.5 db -#define LOWEST_TX_POWER_DELTA 16 // -8 db from full TX power upon shortest distance. 1 grade is 0.5 db +/*#define MID_TX_POWER_DELTA 0 // 0 db from full TX power upon mid-distance to AP */ +#define LOW_TX_POWER_DELTA 6 /* -3 db from full TX power upon very short distance. 1 grade is 0.5 db */ +#define LOWEST_TX_POWER_DELTA 16 /* -8 db from full TX power upon shortest distance. 1 grade is 0.5 db */ #define RSSI_TRIGGERED_UPON_BELOW_THRESHOLD 0 #define RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD 1 #define RSSI_THRESHOLD_FOR_ROAMING 25 #define RSSI_DELTA 5 -// Channel Quality Indication +/* Channel Quality Indication */ #define CQI_IS_GOOD(cqi) ((cqi) >= 50) -//#define CQI_IS_FAIR(cqi) (((cqi) >= 20) && ((cqi) < 50)) -#define CQI_IS_POOR(cqi) (cqi < 50) //(((cqi) >= 5) && ((cqi) < 20)) +/*#define CQI_IS_FAIR(cqi) (((cqi) >= 20) && ((cqi) < 50)) */ +#define CQI_IS_POOR(cqi) (cqi < 50) /*(((cqi) >= 5) && ((cqi) < 20)) */ #define CQI_IS_BAD(cqi) (cqi < 5) #define CQI_IS_DEAD(cqi) (cqi == 0) -// weighting factor to calculate Channel quality, total should be 100% +/* weighting factor to calculate Channel quality, total should be 100% */ #define RSSI_WEIGHTING 50 #define TX_WEIGHTING 30 #define RX_WEIGHTING 20 #define BSS_NOT_FOUND 0xFFFFFFFF -#define MAX_LEN_OF_MLME_QUEUE 40 //10 +#define MAX_LEN_OF_MLME_QUEUE 40 /*10 */ -#define SCAN_PASSIVE 18 // scan with no probe request, only wait beacon and probe response -#define SCAN_ACTIVE 19 // scan with probe request, and wait beacon and probe response -#define SCAN_CISCO_PASSIVE 20 // Single channel passive scan -#define SCAN_CISCO_ACTIVE 21 // Single channel active scan -#define SCAN_CISCO_NOISE 22 // Single channel passive scan for noise histogram collection -#define SCAN_CISCO_CHANNEL_LOAD 23 // Single channel passive scan for channel load collection -#define FAST_SCAN_ACTIVE 24 // scan with probe request, and wait beacon and probe response +#define SCAN_PASSIVE 18 /* scan with no probe request, only wait beacon and probe response */ +#define SCAN_ACTIVE 19 /* scan with probe request, and wait beacon and probe response */ +#define SCAN_CISCO_PASSIVE 20 /* Single channel passive scan */ +#define SCAN_CISCO_ACTIVE 21 /* Single channel active scan */ +#define SCAN_CISCO_NOISE 22 /* Single channel passive scan for noise histogram collection */ +#define SCAN_CISCO_CHANNEL_LOAD 23 /* Single channel passive scan for channel load collection */ +#define FAST_SCAN_ACTIVE 24 /* scan with probe request, and wait beacon and probe response */ #define MAC_ADDR_IS_GROUP(Addr) (((Addr[0]) & 0x01)) #define MAC_ADDR_HASH(Addr) (Addr[0] ^ Addr[1] ^ Addr[2] ^ Addr[3] ^ Addr[4] ^ Addr[5]) @@ -122,13 +122,13 @@ #define TID_MAC_HASH(Addr,TID) (TID^Addr[0] ^ Addr[1] ^ Addr[2] ^ Addr[3] ^ Addr[4] ^ Addr[5]) #define TID_MAC_HASH_INDEX(Addr,TID) (TID_MAC_HASH(Addr,TID) % HASH_TABLE_SIZE) -// LED Control -// assoiation ON. one LED ON. another blinking when TX, OFF when idle -// no association, both LED off +/* LED Control */ +/* assoiation ON. one LED ON. another blinking when TX, OFF when idle */ +/* no association, both LED off */ #define ASIC_LED_ACT_ON(pAd) RTMP_IO_WRITE32(pAd, MAC_CSR14, 0x00031e46) #define ASIC_LED_ACT_OFF(pAd) RTMP_IO_WRITE32(pAd, MAC_CSR14, 0x00001e46) -// bit definition of the 2-byte pBEACON->Capability field +/* bit definition of the 2-byte pBEACON->Capability field */ #define CAP_IS_ESS_ON(x) (((x) & 0x0001) != 0) #define CAP_IS_IBSS_ON(x) (((x) & 0x0002) != 0) #define CAP_IS_CF_POLLABLE_ON(x) (((x) & 0x0004) != 0) @@ -137,44 +137,44 @@ #define CAP_IS_SHORT_PREAMBLE_ON(x) (((x) & 0x0020) != 0) #define CAP_IS_PBCC_ON(x) (((x) & 0x0040) != 0) #define CAP_IS_AGILITY_ON(x) (((x) & 0x0080) != 0) -#define CAP_IS_SPECTRUM_MGMT(x) (((x) & 0x0100) != 0) // 802.11e d9 -#define CAP_IS_QOS(x) (((x) & 0x0200) != 0) // 802.11e d9 +#define CAP_IS_SPECTRUM_MGMT(x) (((x) & 0x0100) != 0) /* 802.11e d9 */ +#define CAP_IS_QOS(x) (((x) & 0x0200) != 0) /* 802.11e d9 */ #define CAP_IS_SHORT_SLOT(x) (((x) & 0x0400) != 0) -#define CAP_IS_APSD(x) (((x) & 0x0800) != 0) // 802.11e d9 -#define CAP_IS_IMMED_BA(x) (((x) & 0x1000) != 0) // 802.11e d9 +#define CAP_IS_APSD(x) (((x) & 0x0800) != 0) /* 802.11e d9 */ +#define CAP_IS_IMMED_BA(x) (((x) & 0x1000) != 0) /* 802.11e d9 */ #define CAP_IS_DSSS_OFDM(x) (((x) & 0x2000) != 0) -#define CAP_IS_DELAY_BA(x) (((x) & 0x4000) != 0) // 802.11e d9 +#define CAP_IS_DELAY_BA(x) (((x) & 0x4000) != 0) /* 802.11e d9 */ #define CAP_GENERATE(ess,ibss,priv,s_pre,s_slot,spectrum) (((ess) ? 0x0001 : 0x0000) | ((ibss) ? 0x0002 : 0x0000) | ((priv) ? 0x0010 : 0x0000) | ((s_pre) ? 0x0020 : 0x0000) | ((s_slot) ? 0x0400 : 0x0000) | ((spectrum) ? 0x0100 : 0x0000)) -#define ERP_IS_NON_ERP_PRESENT(x) (((x) & 0x01) != 0) // 802.11g -#define ERP_IS_USE_PROTECTION(x) (((x) & 0x02) != 0) // 802.11g -#define ERP_IS_USE_BARKER_PREAMBLE(x) (((x) & 0x04) != 0) // 802.11g +#define ERP_IS_NON_ERP_PRESENT(x) (((x) & 0x01) != 0) /* 802.11g */ +#define ERP_IS_USE_PROTECTION(x) (((x) & 0x02) != 0) /* 802.11g */ +#define ERP_IS_USE_BARKER_PREAMBLE(x) (((x) & 0x04) != 0) /* 802.11g */ -#define DRS_TX_QUALITY_WORST_BOUND 8 // 3 // just test by gary +#define DRS_TX_QUALITY_WORST_BOUND 8 /* 3 // just test by gary */ #define DRS_PENALTY 8 #define BA_NOTUSE 2 -//BA Policy subfiled value in ADDBA frame +/*BA Policy subfiled value in ADDBA frame */ #define IMMED_BA 1 #define DELAY_BA 0 -// BA Initiator subfield in DELBA frame +/* BA Initiator subfield in DELBA frame */ #define ORIGINATOR 1 #define RECIPIENT 0 -// ADDBA Status Code +/* ADDBA Status Code */ #define ADDBA_RESULTCODE_SUCCESS 0 #define ADDBA_RESULTCODE_REFUSED 37 #define ADDBA_RESULTCODE_INVALID_PARAMETERS 38 -// DELBA Reason Code +/* DELBA Reason Code */ #define DELBA_REASONCODE_QSTA_LEAVING 36 #define DELBA_REASONCODE_END_BA 37 #define DELBA_REASONCODE_UNKNOWN_BA 38 #define DELBA_REASONCODE_TIMEOUT 39 -// reset all OneSecTx counters +/* reset all OneSecTx counters */ #define RESET_ONE_SEC_TX_CNT(__pEntry) \ if (((__pEntry)) != NULL) \ { \ @@ -183,38 +183,38 @@ if (((__pEntry)) != NULL) \ (__pEntry)->OneSecTxNoRetryOkCount = 0; \ } -// -// 802.11 frame formats -// -// HT Capability INFO field in HT Cap IE . +/* */ +/* 802.11 frame formats */ +/* */ +/* HT Capability INFO field in HT Cap IE . */ typedef struct PACKED { USHORT AdvCoding:1; USHORT ChannelWidth:1; - USHORT MimoPs:2; //momi power safe - USHORT GF:1; //green field + USHORT MimoPs:2; /*momi power safe */ + USHORT GF:1; /*green field */ USHORT ShortGIfor20:1; - USHORT ShortGIfor40:1; //for40MHz + USHORT ShortGIfor40:1; /*for40MHz */ USHORT TxSTBC:1; USHORT RxSTBC:2; - USHORT DelayedBA:1; //rt2860c not support - USHORT AMsduSize:1; // only support as zero + USHORT DelayedBA:1; /*rt2860c not support */ + USHORT AMsduSize:1; /* only support as zero */ USHORT CCKmodein40:1; USHORT PSMP:1; USHORT Forty_Mhz_Intolerant:1; USHORT LSIGTxopProSup:1; } HT_CAP_INFO, *PHT_CAP_INFO; -// HT Capability INFO field in HT Cap IE . +/* HT Capability INFO field in HT Cap IE . */ typedef struct PACKED { UCHAR MaxRAmpduFactor:2; UCHAR MpduDensity:3; - UCHAR rsv:3; //momi power safe + UCHAR rsv:3; /*momi power safe */ } HT_CAP_PARM, *PHT_CAP_PARM; -// HT Capability INFO field in HT Cap IE . +/* HT Capability INFO field in HT Cap IE . */ typedef struct PACKED { UCHAR MCSSet[10]; - UCHAR SupRate[2]; // unit : 1Mbps + UCHAR SupRate[2]; /* unit : 1Mbps */ UCHAR TxMCSSetDefined:1; UCHAR TxRxNotEqual:1; UCHAR TxStream:2; @@ -223,18 +223,18 @@ typedef struct PACKED { UCHAR rsv3[3]; } HT_MCS_SET, *PHT_MCS_SET; -// HT Capability INFO field in HT Cap IE . +/* HT Capability INFO field in HT Cap IE . */ typedef struct PACKED { USHORT Pco:1; USHORT TranTime:2; - USHORT rsv:5; //momi power safe - USHORT MCSFeedback:2; //0:no MCS feedback, 2:unsolicited MCS feedback, 3:Full MCS feedback, 1:rsv. - USHORT PlusHTC:1; //+HTC control field support - USHORT RDGSupport:1; //reverse Direction Grant support + USHORT rsv:5; /*momi power safe */ + USHORT MCSFeedback:2; /*0:no MCS feedback, 2:unsolicited MCS feedback, 3:Full MCS feedback, 1:rsv. */ + USHORT PlusHTC:1; /*+HTC control field support */ + USHORT RDGSupport:1; /*reverse Direction Grant support */ USHORT rsv2:4; } EXT_HT_CAP_INFO, *PEXT_HT_CAP_INFO; -// HT Beamforming field in HT Cap IE . +/* HT Beamforming field in HT Cap IE . */ typedef struct PACKED _HT_BF_CAP { ULONG TxBFRecCapable:1; ULONG RxSoundCapable:1; @@ -258,7 +258,7 @@ typedef struct PACKED _HT_BF_CAP { ULONG rsv:3; } HT_BF_CAP, *PHT_BF_CAP; -// HT antenna selection field in HT Cap IE . +/* HT antenna selection field in HT Cap IE . */ typedef struct PACKED _HT_AS_CAP { UCHAR AntSelect:1; UCHAR ExpCSIFbkTxASEL:1; @@ -270,48 +270,48 @@ typedef struct PACKED _HT_AS_CAP { UCHAR rsv:1; } HT_AS_CAP, *PHT_AS_CAP; -// Draft 1.0 set IE length 26, but is extensible.. +/* Draft 1.0 set IE length 26, but is extensible.. */ #define SIZE_HT_CAP_IE 26 -// The structure for HT Capability IE. +/* The structure for HT Capability IE. */ typedef struct PACKED _HT_CAPABILITY_IE { HT_CAP_INFO HtCapInfo; HT_CAP_PARM HtCapParm; -// HT_MCS_SET HtMCSSet; +/* HT_MCS_SET HtMCSSet; */ UCHAR MCSSet[16]; EXT_HT_CAP_INFO ExtHtCapInfo; - HT_BF_CAP TxBFCap; // beamforming cap. rt2860c not support beamforming. - HT_AS_CAP ASCap; //antenna selection. + HT_BF_CAP TxBFCap; /* beamforming cap. rt2860c not support beamforming. */ + HT_AS_CAP ASCap; /*antenna selection. */ } HT_CAPABILITY_IE, *PHT_CAPABILITY_IE; -// 802.11n draft3 related structure definitions. -// 7.3.2.60 -#define dot11OBSSScanPassiveDwell 20 // in TU. min amount of time that the STA continously scans each channel when performing an active OBSS scan. -#define dot11OBSSScanActiveDwell 10 // in TU.min amount of time that the STA continously scans each channel when performing an passive OBSS scan. -#define dot11BSSWidthTriggerScanInterval 300 // in sec. max interval between scan operations to be performed to detect BSS channel width trigger events. -#define dot11OBSSScanPassiveTotalPerChannel 200 // in TU. min total amount of time that the STA scans each channel when performing a passive OBSS scan. -#define dot11OBSSScanActiveTotalPerChannel 20 //in TU. min total amount of time that the STA scans each channel when performing a active OBSS scan -#define dot11BSSWidthChannelTransactionDelayFactor 5 // min ratio between the delay time in performing a switch from 20MHz BSS to 20/40 BSS operation and the maximum - // interval between overlapping BSS scan operations. -#define dot11BSSScanActivityThreshold 25 // in %%, max total time that a STA may be active on the medium during a period of - // (dot11BSSWidthChannelTransactionDelayFactor * dot11BSSWidthTriggerScanInterval) seconds without - // being obligated to perform OBSS Scan operations. default is 25(== 0.25%) +/* 802.11n draft3 related structure definitions. */ +/* 7.3.2.60 */ +#define dot11OBSSScanPassiveDwell 20 /* in TU. min amount of time that the STA continously scans each channel when performing an active OBSS scan. */ +#define dot11OBSSScanActiveDwell 10 /* in TU.min amount of time that the STA continously scans each channel when performing an passive OBSS scan. */ +#define dot11BSSWidthTriggerScanInterval 300 /* in sec. max interval between scan operations to be performed to detect BSS channel width trigger events. */ +#define dot11OBSSScanPassiveTotalPerChannel 200 /* in TU. min total amount of time that the STA scans each channel when performing a passive OBSS scan. */ +#define dot11OBSSScanActiveTotalPerChannel 20 /*in TU. min total amount of time that the STA scans each channel when performing a active OBSS scan */ +#define dot11BSSWidthChannelTransactionDelayFactor 5 /* min ratio between the delay time in performing a switch from 20MHz BSS to 20/40 BSS operation and the maximum */ + /* interval between overlapping BSS scan operations. */ +#define dot11BSSScanActivityThreshold 25 /* in %%, max total time that a STA may be active on the medium during a period of */ + /* (dot11BSSWidthChannelTransactionDelayFactor * dot11BSSWidthTriggerScanInterval) seconds without */ + /* being obligated to perform OBSS Scan operations. default is 25(== 0.25%) */ typedef struct PACKED _OVERLAP_BSS_SCAN_IE { USHORT ScanPassiveDwell; USHORT ScanActiveDwell; - USHORT TriggerScanInt; // Trigger scan interval - USHORT PassiveTalPerChannel; // passive total per channel - USHORT ActiveTalPerChannel; // active total per channel - USHORT DelayFactor; // BSS width channel transition delay factor - USHORT ScanActThre; // Scan Activity threshold + USHORT TriggerScanInt; /* Trigger scan interval */ + USHORT PassiveTalPerChannel; /* passive total per channel */ + USHORT ActiveTalPerChannel; /* active total per channel */ + USHORT DelayFactor; /* BSS width channel transition delay factor */ + USHORT ScanActThre; /* Scan Activity threshold */ } OVERLAP_BSS_SCAN_IE, *POVERLAP_BSS_SCAN_IE; -// 7.3.2.56. 20/40 Coexistence element used in Element ID = 72 = IE_2040_BSS_COEXIST +/* 7.3.2.56. 20/40 Coexistence element used in Element ID = 72 = IE_2040_BSS_COEXIST */ typedef union PACKED _BSS_2040_COEXIST_IE { struct PACKED { UCHAR InfoReq:1; - UCHAR Intolerant40:1; // Inter-BSS. set 1 when prohibits a receiving BSS from operating as a 20/40 Mhz BSS. - UCHAR BSS20WidthReq:1; // Intra-BSS set 1 when prohibits a receiving AP from operating its BSS as a 20/40MHz BSS. + UCHAR Intolerant40:1; /* Inter-BSS. set 1 when prohibits a receiving BSS from operating as a 20/40 Mhz BSS. */ + UCHAR BSS20WidthReq:1; /* Intra-BSS set 1 when prohibits a receiving AP from operating its BSS as a 20/40MHz BSS. */ UCHAR rsv:5; } field; UCHAR word; @@ -320,22 +320,22 @@ typedef union PACKED _BSS_2040_COEXIST_IE { typedef struct _TRIGGER_EVENTA { BOOLEAN bValid; UCHAR BSSID[6]; - UCHAR RegClass; // Regulatory Class + UCHAR RegClass; /* Regulatory Class */ USHORT Channel; - ULONG CDCounter; // Maintain a seperate count down counter for each Event A. + ULONG CDCounter; /* Maintain a seperate count down counter for each Event A. */ } TRIGGER_EVENTA, *PTRIGGER_EVENTA; -// 20/40 trigger event table -// If one Event A delete or created, or if Event B is detected or not detected, STA should send 2040BSSCoexistence to AP. +/* 20/40 trigger event table */ +/* If one Event A delete or created, or if Event B is detected or not detected, STA should send 2040BSSCoexistence to AP. */ #define MAX_TRIGGER_EVENT 64 typedef struct _TRIGGER_EVENT_TAB { UCHAR EventANo; TRIGGER_EVENTA EventA[MAX_TRIGGER_EVENT]; - ULONG EventBCountDown; // Count down counter for Event B. + ULONG EventBCountDown; /* Count down counter for Event B. */ } TRIGGER_EVENT_TAB, *PTRIGGER_EVENT_TAB; -// 7.3.27 20/40 Bss Coexistence Mgmt capability used in extended capabilities information IE( ID = 127 = IE_EXT_CAPABILITY). -// This is the first octet and was defined in 802.11n D3.03 and 802.11yD9.0 +/* 7.3.27 20/40 Bss Coexistence Mgmt capability used in extended capabilities information IE( ID = 127 = IE_EXT_CAPABILITY). */ +/* This is the first octet and was defined in 802.11n D3.03 and 802.11yD9.0 */ typedef struct PACKED _EXT_CAP_INFO_ELEMENT { UCHAR BssCoexistMgmtSupport:1; UCHAR rsv:1; @@ -343,59 +343,59 @@ typedef struct PACKED _EXT_CAP_INFO_ELEMENT { UCHAR rsv2:5; } EXT_CAP_INFO_ELEMENT, *PEXT_CAP_INFO_ELEMENT; -// 802.11n 7.3.2.61 +/* 802.11n 7.3.2.61 */ typedef struct PACKED _BSS_2040_COEXIST_ELEMENT { - UCHAR ElementID; // ID = IE_2040_BSS_COEXIST = 72 + UCHAR ElementID; /* ID = IE_2040_BSS_COEXIST = 72 */ UCHAR Len; BSS_2040_COEXIST_IE BssCoexistIe; } BSS_2040_COEXIST_ELEMENT, *PBSS_2040_COEXIST_ELEMENT; -//802.11n 7.3.2.59 +/*802.11n 7.3.2.59 */ typedef struct PACKED _BSS_2040_INTOLERANT_CH_REPORT { - UCHAR ElementID; // ID = IE_2040_BSS_INTOLERANT_REPORT = 73 + UCHAR ElementID; /* ID = IE_2040_BSS_INTOLERANT_REPORT = 73 */ UCHAR Len; UCHAR RegulatoryClass; UCHAR ChList[0]; } BSS_2040_INTOLERANT_CH_REPORT, *PBSS_2040_INTOLERANT_CH_REPORT; -// The structure for channel switch annoucement IE. This is in 802.11n D3.03 +/* The structure for channel switch annoucement IE. This is in 802.11n D3.03 */ typedef struct PACKED _CHA_SWITCH_ANNOUNCE_IE { - UCHAR SwitchMode; //channel switch mode - UCHAR NewChannel; // - UCHAR SwitchCount; // + UCHAR SwitchMode; /*channel switch mode */ + UCHAR NewChannel; /* */ + UCHAR SwitchCount; /* */ } CHA_SWITCH_ANNOUNCE_IE, *PCHA_SWITCH_ANNOUNCE_IE; -// The structure for channel switch annoucement IE. This is in 802.11n D3.03 +/* The structure for channel switch annoucement IE. This is in 802.11n D3.03 */ typedef struct PACKED _SEC_CHA_OFFSET_IE { - UCHAR SecondaryChannelOffset; // 1: Secondary above, 3: Secondary below, 0: no Secondary + UCHAR SecondaryChannelOffset; /* 1: Secondary above, 3: Secondary below, 0: no Secondary */ } SEC_CHA_OFFSET_IE, *PSEC_CHA_OFFSET_IE; -// This structure is extracted from struct RT_HT_CAPABILITY +/* This structure is extracted from struct RT_HT_CAPABILITY */ typedef struct { - BOOLEAN bHtEnable; // If we should use ht rate. - BOOLEAN bPreNHt; // If we should use ht rate. - //Substract from HT Capability IE + BOOLEAN bHtEnable; /* If we should use ht rate. */ + BOOLEAN bPreNHt; /* If we should use ht rate. */ + /*Substract from HT Capability IE */ UCHAR MCSSet[16]; } RT_HT_PHY_INFO, *PRT_HT_PHY_INFO; -//This structure substracts ralink supports from all 802.11n-related features. -//Features not listed here but contained in 802.11n spec are not supported in rt2860. +/*This structure substracts ralink supports from all 802.11n-related features. */ +/*Features not listed here but contained in 802.11n spec are not supported in rt2860. */ typedef struct { USHORT ChannelWidth:1; - USHORT MimoPs:2; //mimo power safe MMPS_ - USHORT GF:1; //green field + USHORT MimoPs:2; /*mimo power safe MMPS_ */ + USHORT GF:1; /*green field */ USHORT ShortGIfor20:1; - USHORT ShortGIfor40:1; //for40MHz + USHORT ShortGIfor40:1; /*for40MHz */ USHORT TxSTBC:1; - USHORT RxSTBC:2; // 2 bits - USHORT AmsduEnable:1; // Enable to transmit A-MSDU. Suggest disable. We should use A-MPDU to gain best benifit of 802.11n - USHORT AmsduSize:1; // Max receiving A-MSDU size + USHORT RxSTBC:2; /* 2 bits */ + USHORT AmsduEnable:1; /* Enable to transmit A-MSDU. Suggest disable. We should use A-MPDU to gain best benifit of 802.11n */ + USHORT AmsduSize:1; /* Max receiving A-MSDU size */ USHORT rsv:5; - //Substract from Addiont HT INFO IE + /*Substract from Addiont HT INFO IE */ UCHAR MaxRAmpduFactor:2; UCHAR MpduDensity:3; - UCHAR ExtChanOffset:2; // Please not the difference with following UCHAR NewExtChannelOffset; from 802.11n + UCHAR ExtChanOffset:2; /* Please not the difference with following UCHAR NewExtChannelOffset; from 802.11n */ UCHAR RecomWidth:1; USHORT OperaionMode:2; @@ -404,19 +404,19 @@ typedef struct { USHORT OBSS_NonHTExist:1; USHORT rsv2:11; - // New Extension Channel Offset IE + /* New Extension Channel Offset IE */ UCHAR NewExtChannelOffset; - // Extension Capability IE = 127 + /* Extension Capability IE = 127 */ UCHAR BSSCoexist2040; } RT_HT_CAPABILITY, *PRT_HT_CAPABILITY; -// field in Addtional HT Information IE . +/* field in Addtional HT Information IE . */ typedef struct PACKED { UCHAR ExtChanOffset:2; UCHAR RecomWidth:1; UCHAR RifsMode:1; - UCHAR S_PSMPSup:1; //Indicate support for scheduled PSMP - UCHAR SerInterGranu:3; //service interval granularity + UCHAR S_PSMPSup:1; /*Indicate support for scheduled PSMP */ + UCHAR SerInterGranu:3; /*service interval granularity */ } ADD_HTINFO, *PADD_HTINFO; typedef struct PACKED { @@ -427,13 +427,13 @@ typedef struct PACKED { USHORT rsv2:11; } ADD_HTINFO2, *PADD_HTINFO2; -// TODO: Need sync with spec about the definition of StbcMcs. In Draft 3.03, it's reserved. +/* TODO: Need sync with spec about the definition of StbcMcs. In Draft 3.03, it's reserved. */ typedef struct PACKED { USHORT StbcMcs:6; USHORT DualBeacon:1; USHORT DualCTSProtect:1; USHORT STBCBeacon:1; - USHORT LsigTxopProt:1; // L-SIG TXOP protection full support + USHORT LsigTxopProt:1; /* L-SIG TXOP protection full support */ USHORT PcoActive:1; USHORT PcoPhase:1; USHORT rsv:4; @@ -445,7 +445,7 @@ typedef struct PACKED { ADD_HTINFO AddHtInfo; ADD_HTINFO2 AddHtInfo2; ADD_HTINFO3 AddHtInfo3; - UCHAR MCSSet[16]; // Basic MCS set + UCHAR MCSSet[16]; /* Basic MCS set */ } ADD_HT_INFO_IE, *PADD_HT_INFO_IE; typedef struct PACKED { @@ -457,7 +457,7 @@ typedef struct PACKED _FRAME_802_11 { UCHAR Octet[1]; } FRAME_802_11, *PFRAME_802_11; -// QoSNull embedding of management action. When HT Control MA field set to 1. +/* QoSNull embedding of management action. When HT Control MA field set to 1. */ typedef struct PACKED _MA_BODY { UCHAR Category; UCHAR Action; @@ -469,51 +469,51 @@ typedef struct PACKED _HEADER_802_3 { UCHAR SAAddr2[MAC_ADDR_LEN]; UCHAR Octet[2]; } HEADER_802_3, *PHEADER_802_3; -////Block ACK related format -// 2-byte BA Parameter field in DELBA frames to terminate an already set up bA +/*//Block ACK related format */ +/* 2-byte BA Parameter field in DELBA frames to terminate an already set up bA */ typedef struct PACKED { - USHORT Rsv:11; // always set to 0 - USHORT Initiator:1; // 1: originator 0:recipient - USHORT TID:4; // value of TC os TS + USHORT Rsv:11; /* always set to 0 */ + USHORT Initiator:1; /* 1: originator 0:recipient */ + USHORT TID:4; /* value of TC os TS */ } DELBA_PARM, *PDELBA_PARM; -// 2-byte BA Parameter Set field in ADDBA frames to signal parm for setting up a BA +/* 2-byte BA Parameter Set field in ADDBA frames to signal parm for setting up a BA */ typedef struct PACKED { - USHORT AMSDUSupported:1; // 0: not permitted 1: permitted - USHORT BAPolicy:1; // 1: immediately BA 0:delayed BA - USHORT TID:4; // value of TC os TS - USHORT BufSize:10; // number of buffe of size 2304 octetsr + USHORT AMSDUSupported:1; /* 0: not permitted 1: permitted */ + USHORT BAPolicy:1; /* 1: immediately BA 0:delayed BA */ + USHORT TID:4; /* value of TC os TS */ + USHORT BufSize:10; /* number of buffe of size 2304 octetsr */ } BA_PARM, *PBA_PARM; -// 2-byte BA Starting Seq CONTROL field +/* 2-byte BA Starting Seq CONTROL field */ typedef union PACKED { struct PACKED { - USHORT FragNum:4; // always set to 0 - USHORT StartSeq:12; // sequence number of the 1st MSDU for which this BAR is sent + USHORT FragNum:4; /* always set to 0 */ + USHORT StartSeq:12; /* sequence number of the 1st MSDU for which this BAR is sent */ } field; USHORT word; } BASEQ_CONTROL, *PBASEQ_CONTROL; -//BAControl and BARControl are the same -// 2-byte BA CONTROL field in BA frame +/*BAControl and BARControl are the same */ +/* 2-byte BA CONTROL field in BA frame */ typedef struct PACKED { - USHORT ACKPolicy:1; // only related to N-Delayed BA. But not support in RT2860b. 0:NormalACK 1:No ACK - USHORT MTID:1; //EWC V1.24 + USHORT ACKPolicy:1; /* only related to N-Delayed BA. But not support in RT2860b. 0:NormalACK 1:No ACK */ + USHORT MTID:1; /*EWC V1.24 */ USHORT Compressed:1; USHORT Rsv:9; USHORT TID:4; } BA_CONTROL, *PBA_CONTROL; -// 2-byte BAR CONTROL field in BAR frame +/* 2-byte BAR CONTROL field in BAR frame */ typedef struct PACKED { - USHORT ACKPolicy:1; // 0:normal ack, 1:no ack. - USHORT MTID:1; //if this bit1, use FRAME_MTBA_REQ, if 0, use FRAME_BA_REQ + USHORT ACKPolicy:1; /* 0:normal ack, 1:no ack. */ + USHORT MTID:1; /*if this bit1, use FRAME_MTBA_REQ, if 0, use FRAME_BA_REQ */ USHORT Compressed:1; USHORT Rsv1:9; USHORT TID:4; } BAR_CONTROL, *PBAR_CONTROL; -// BARControl in MTBAR frame +/* BARControl in MTBAR frame */ typedef struct PACKED { USHORT ACKPolicy:1; USHORT MTID:1; @@ -532,7 +532,7 @@ typedef struct { BASEQ_CONTROL BAStartingSeq; } EACH_TID, *PEACH_TID; -// BAREQ AND MTBAREQ have the same subtype BAR, 802.11n BAR use compressed bitmap. +/* BAREQ AND MTBAREQ have the same subtype BAR, 802.11n BAR use compressed bitmap. */ typedef struct PACKED _FRAME_BA_REQ { FRAME_CONTROL FC; USHORT Duration; @@ -552,7 +552,7 @@ typedef struct PACKED _FRAME_MTBA_REQ { BASEQ_CONTROL BAStartingSeq; } FRAME_MTBA_REQ, *PFRAME_MTBA_REQ; -// Compressed format is mandantory in HT STA +/* Compressed format is mandantory in HT STA */ typedef struct PACKED _FRAME_MTBA { FRAME_CONTROL FC; USHORT Duration; @@ -567,7 +567,7 @@ typedef struct PACKED _FRAME_PSMP_ACTION { HEADER_802_11 Hdr; UCHAR Category; UCHAR Action; - UCHAR Psmp; // 7.3.1.25 + UCHAR Psmp; /* 7.3.1.25 */ } FRAME_PSMP_ACTION, *PFRAME_PSMP_ACTION; typedef struct PACKED _FRAME_ACTION_HDR { @@ -576,17 +576,17 @@ typedef struct PACKED _FRAME_ACTION_HDR { UCHAR Action; } FRAME_ACTION_HDR, *PFRAME_ACTION_HDR; -//Action Frame -//Action Frame Category:Spectrum, Action:Channel Switch. 7.3.2.20 +/*Action Frame */ +/*Action Frame Category:Spectrum, Action:Channel Switch. 7.3.2.20 */ typedef struct PACKED _CHAN_SWITCH_ANNOUNCE { - UCHAR ElementID; // ID = IE_CHANNEL_SWITCH_ANNOUNCEMENT = 37 + UCHAR ElementID; /* ID = IE_CHANNEL_SWITCH_ANNOUNCEMENT = 37 */ UCHAR Len; CHA_SWITCH_ANNOUNCE_IE CSAnnounceIe; } CHAN_SWITCH_ANNOUNCE, *PCHAN_SWITCH_ANNOUNCE; -//802.11n : 7.3.2.20a +/*802.11n : 7.3.2.20a */ typedef struct PACKED _SECOND_CHAN_OFFSET { - UCHAR ElementID; // ID = IE_SECONDARY_CH_OFFSET = 62 + UCHAR ElementID; /* ID = IE_SECONDARY_CH_OFFSET = 62 */ UCHAR Len; SEC_CHA_OFFSET_IE SecChOffsetIe; } SECOND_CHAN_OFFSET, *PSECOND_CHAN_OFFSET; @@ -603,10 +603,10 @@ typedef struct PACKED _FRAME_ADDBA_REQ { HEADER_802_11 Hdr; UCHAR Category; UCHAR Action; - UCHAR Token; // 1 - BA_PARM BaParm; // 2 - 10 - USHORT TimeOutValue; // 0 - 0 - BASEQ_CONTROL BaStartSeq; // 0-0 + UCHAR Token; /* 1 */ + BA_PARM BaParm; /* 2 - 10 */ + USHORT TimeOutValue; /* 0 - 0 */ + BASEQ_CONTROL BaStartSeq; /* 0-0 */ } FRAME_ADDBA_REQ, *PFRAME_ADDBA_REQ; typedef struct PACKED _FRAME_ADDBA_RSP { @@ -615,7 +615,7 @@ typedef struct PACKED _FRAME_ADDBA_RSP { UCHAR Action; UCHAR Token; USHORT StatusCode; - BA_PARM BaParm; //0 - 2 + BA_PARM BaParm; /*0 - 2 */ USHORT TimeOutValue; } FRAME_ADDBA_RSP, *PFRAME_ADDBA_RSP; @@ -627,7 +627,7 @@ typedef struct PACKED _FRAME_DELBA_REQ { USHORT ReasonCode; } FRAME_DELBA_REQ, *PFRAME_DELBA_REQ; -//7.2.1.7 +/*7.2.1.7 */ typedef struct PACKED _FRAME_BAR { FRAME_CONTROL FC; USHORT Duration; @@ -637,7 +637,7 @@ typedef struct PACKED _FRAME_BAR { BASEQ_CONTROL StartingSeq; } FRAME_BAR, *PFRAME_BAR; -//7.2.1.7 +/*7.2.1.7 */ typedef struct PACKED _FRAME_BA { FRAME_CONTROL FC; USHORT Duration; @@ -648,7 +648,7 @@ typedef struct PACKED _FRAME_BA { UCHAR bitmask[8]; } FRAME_BA, *PFRAME_BA; -// Radio Measuement Request Frame Format +/* Radio Measuement Request Frame Format */ typedef struct PACKED _FRAME_RM_REQ_ACTION { HEADER_802_11 Hdr; UCHAR Category; @@ -668,21 +668,21 @@ typedef struct PACKED { } HT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE, *PHT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE; -// -// _Limit must be the 2**n - 1 -// _SEQ1 , _SEQ2 must be within 0 ~ _Limit -// +/* */ +/* _Limit must be the 2**n - 1 */ +/* _SEQ1 , _SEQ2 must be within 0 ~ _Limit */ +/* */ #define SEQ_STEPONE(_SEQ1, _SEQ2, _Limit) ((_SEQ1 == ((_SEQ2+1) & _Limit))) #define SEQ_SMALLER(_SEQ1, _SEQ2, _Limit) (((_SEQ1-_SEQ2) & ((_Limit+1)>>1))) #define SEQ_LARGER(_SEQ1, _SEQ2, _Limit) ((_SEQ1 != _SEQ2) && !(((_SEQ1-_SEQ2) & ((_Limit+1)>>1)))) #define SEQ_WITHIN_WIN(_SEQ1, _SEQ2, _WIN, _Limit) (SEQ_LARGER(_SEQ1, _SEQ2, _Limit) && \ SEQ_SMALLER(_SEQ1, ((_SEQ2+_WIN+1)&_Limit), _Limit)) -// -// Contention-free parameter (without ID and Length) -// +/* */ +/* Contention-free parameter (without ID and Length) */ +/* */ typedef struct PACKED { - BOOLEAN bValid; // 1: variable contains valid value + BOOLEAN bValid; /* 1: variable contains valid value */ UCHAR CfpCount; UCHAR CfpPeriod; USHORT CfpMaxDuration; @@ -690,39 +690,39 @@ typedef struct PACKED { } CF_PARM, *PCF_PARM; typedef struct _CIPHER_SUITE { - NDIS_802_11_ENCRYPTION_STATUS PairCipher; // Unicast cipher 1, this one has more secured cipher suite - NDIS_802_11_ENCRYPTION_STATUS PairCipherAux; // Unicast cipher 2 if AP announce two unicast cipher suite - NDIS_802_11_ENCRYPTION_STATUS GroupCipher; // Group cipher - USHORT RsnCapability; // RSN capability from beacon - BOOLEAN bMixMode; // Indicate Pair & Group cipher might be different + NDIS_802_11_ENCRYPTION_STATUS PairCipher; /* Unicast cipher 1, this one has more secured cipher suite */ + NDIS_802_11_ENCRYPTION_STATUS PairCipherAux; /* Unicast cipher 2 if AP announce two unicast cipher suite */ + NDIS_802_11_ENCRYPTION_STATUS GroupCipher; /* Group cipher */ + USHORT RsnCapability; /* RSN capability from beacon */ + BOOLEAN bMixMode; /* Indicate Pair & Group cipher might be different */ } CIPHER_SUITE, *PCIPHER_SUITE; -// EDCA configuration from AP's BEACON/ProbeRsp +/* EDCA configuration from AP's BEACON/ProbeRsp */ typedef struct { - BOOLEAN bValid; // 1: variable contains valid value - BOOLEAN bAdd; // 1: variable contains valid value + BOOLEAN bValid; /* 1: variable contains valid value */ + BOOLEAN bAdd; /* 1: variable contains valid value */ BOOLEAN bQAck; BOOLEAN bQueueRequest; BOOLEAN bTxopRequest; BOOLEAN bAPSDCapable; -// BOOLEAN bMoreDataAck; +/* BOOLEAN bMoreDataAck; */ UCHAR EdcaUpdateCount; - UCHAR Aifsn[4]; // 0:AC_BK, 1:AC_BE, 2:AC_VI, 3:AC_VO + UCHAR Aifsn[4]; /* 0:AC_BK, 1:AC_BE, 2:AC_VI, 3:AC_VO */ UCHAR Cwmin[4]; UCHAR Cwmax[4]; - USHORT Txop[4]; // in unit of 32-us - BOOLEAN bACM[4]; // 1: Admission Control of AC_BK is mandattory + USHORT Txop[4]; /* in unit of 32-us */ + BOOLEAN bACM[4]; /* 1: Admission Control of AC_BK is mandattory */ } EDCA_PARM, *PEDCA_PARM; -// QBSS LOAD information from QAP's BEACON/ProbeRsp +/* QBSS LOAD information from QAP's BEACON/ProbeRsp */ typedef struct { - BOOLEAN bValid; // 1: variable contains valid value + BOOLEAN bValid; /* 1: variable contains valid value */ USHORT StaNum; UCHAR ChannelUtilization; - USHORT RemainingAdmissionControl; // in unit of 32-us + USHORT RemainingAdmissionControl; /* in unit of 32-us */ } QBSS_LOAD_PARM, *PQBSS_LOAD_PARM; -// QBSS Info field in QSTA's assoc req +/* QBSS Info field in QSTA's assoc req */ typedef struct PACKED { UCHAR UAPSD_AC_VO:1; UCHAR UAPSD_AC_VI:1; @@ -733,21 +733,21 @@ typedef struct PACKED { UCHAR Rsv2:1; } QBSS_STA_INFO_PARM, *PQBSS_STA_INFO_PARM; -// QBSS Info field in QAP's Beacon/ProbeRsp +/* QBSS Info field in QAP's Beacon/ProbeRsp */ typedef struct PACKED { UCHAR ParamSetCount:4; UCHAR Rsv:3; UCHAR UAPSD:1; } QBSS_AP_INFO_PARM, *PQBSS_AP_INFO_PARM; -// QOS Capability reported in QAP's BEACON/ProbeRsp -// QOS Capability sent out in QSTA's AssociateReq/ReAssociateReq +/* QOS Capability reported in QAP's BEACON/ProbeRsp */ +/* QOS Capability sent out in QSTA's AssociateReq/ReAssociateReq */ typedef struct { - BOOLEAN bValid; // 1: variable contains valid value + BOOLEAN bValid; /* 1: variable contains valid value */ BOOLEAN bQAck; BOOLEAN bQueueRequest; BOOLEAN bTxopRequest; -// BOOLEAN bMoreDataAck; +/* BOOLEAN bMoreDataAck; */ UCHAR EdcaUpdateCount; } QOS_CAPABILITY_PARM, *PQOS_CAPABILITY_PARM; @@ -759,7 +759,7 @@ typedef struct { typedef struct { UCHAR Bssid[MAC_ADDR_LEN]; UCHAR Channel; - UCHAR CentralChannel; //Store the wide-band central channel for 40MHz. .used in 40MHz AP. Or this is the same as Channel. + UCHAR CentralChannel; /*Store the wide-band central channel for 40MHz. .used in 40MHz AP. Or this is the same as Channel. */ UCHAR BssType; USHORT AtimWin; USHORT BeaconPeriod; @@ -770,11 +770,11 @@ typedef struct { UCHAR ExtRateLen; HT_CAPABILITY_IE HtCapability; UCHAR HtCapabilityLen; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE + ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ UCHAR AddHtInfoLen; UCHAR NewExtChanOffset; CHAR Rssi; - UCHAR Privacy; // Indicate security function ON/OFF. Don't mess up with auth mode. + UCHAR Privacy; /* Indicate security function ON/OFF. Don't mess up with auth mode. */ UCHAR Hidden; USHORT DtimPeriod; @@ -787,30 +787,30 @@ typedef struct { UCHAR SsidLen; CHAR Ssid[MAX_LEN_OF_SSID]; - ULONG LastBeaconRxTime; // OS's timestamp + ULONG LastBeaconRxTime; /* OS's timestamp */ BOOLEAN bSES; - // New for WPA2 - CIPHER_SUITE WPA; // AP announced WPA cipher suite - CIPHER_SUITE WPA2; // AP announced WPA2 cipher suite + /* New for WPA2 */ + CIPHER_SUITE WPA; /* AP announced WPA cipher suite */ + CIPHER_SUITE WPA2; /* AP announced WPA2 cipher suite */ - // New for microsoft WPA support + /* New for microsoft WPA support */ NDIS_802_11_FIXED_IEs FixIEs; - NDIS_802_11_AUTHENTICATION_MODE AuthModeAux; // Addition mode for WPA2 / WPA capable AP + NDIS_802_11_AUTHENTICATION_MODE AuthModeAux; /* Addition mode for WPA2 / WPA capable AP */ NDIS_802_11_AUTHENTICATION_MODE AuthMode; - NDIS_802_11_WEP_STATUS WepStatus; // Unicast Encryption Algorithm extract from VAR_IE - USHORT VarIELen; // Length of next VIE include EID & Length + NDIS_802_11_WEP_STATUS WepStatus; /* Unicast Encryption Algorithm extract from VAR_IE */ + USHORT VarIELen; /* Length of next VIE include EID & Length */ UCHAR VarIEs[MAX_VIE_LEN]; - // CCX Ckip information + /* CCX Ckip information */ UCHAR CkipFlag; - // CCX 2 TSF - UCHAR PTSF[4]; // Parent TSF - UCHAR TTSF[8]; // Target TSF + /* CCX 2 TSF */ + UCHAR PTSF[4]; /* Parent TSF */ + UCHAR TTSF[8]; /* Target TSF */ - // 802.11e d9, and WMM + /* 802.11e d9, and WMM */ EDCA_PARM EdcaParm; QOS_CAPABILITY_PARM QosCapability; QBSS_LOAD_PARM QbssLoad; @@ -857,12 +857,12 @@ typedef struct _STATE_MACHINE { STATE_MACHINE_FUNC *TransFunc; } STATE_MACHINE, *PSTATE_MACHINE; -// MLME AUX data structure that hold temporarliy settings during a connection attempt. -// Once this attemp succeeds, all settings will be copy to pAd->StaActive. -// A connection attempt (user set OID, roaming, CCX fast roaming,..) consists of -// several steps (JOIN, AUTH, ASSOC or REASSOC) and may fail at any step. We purposely -// separate this under-trial settings away from pAd->StaActive so that once -// this new attempt failed, driver can auto-recover back to the active settings. +/* MLME AUX data structure that hold temporarliy settings during a connection attempt. */ +/* Once this attemp succeeds, all settings will be copy to pAd->StaActive. */ +/* A connection attempt (user set OID, roaming, CCX fast roaming,..) consists of */ +/* several steps (JOIN, AUTH, ASSOC or REASSOC) and may fail at any step. We purposely */ +/* separate this under-trial settings away from pAd->StaActive so that once */ +/* this new attempt failed, driver can auto-recover back to the active settings. */ typedef struct _MLME_AUX { UCHAR BssType; UCHAR Ssid[MAX_LEN_OF_SSID]; @@ -881,28 +881,28 @@ typedef struct _MLME_AUX { USHORT CfpPeriod; USHORT AtimWin; - // Copy supported rate from desired AP's beacon. We are trying to match - // AP's supported and extended rate settings. + /* Copy supported rate from desired AP's beacon. We are trying to match */ + /* AP's supported and extended rate settings. */ UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; UCHAR SupRateLen; UCHAR ExtRateLen; HT_CAPABILITY_IE HtCapability; UCHAR HtCapabilityLen; - ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE + ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ UCHAR NewExtChannelOffset; - //RT_HT_CAPABILITY SupportedHtPhy; + /*RT_HT_CAPABILITY SupportedHtPhy; */ - // new for QOS - QOS_CAPABILITY_PARM APQosCapability; // QOS capability of the current associated AP - EDCA_PARM APEdcaParm; // EDCA parameters of the current associated AP - QBSS_LOAD_PARM APQbssLoad; // QBSS load of the current associated AP + /* new for QOS */ + QOS_CAPABILITY_PARM APQosCapability; /* QOS capability of the current associated AP */ + EDCA_PARM APEdcaParm; /* EDCA parameters of the current associated AP */ + QBSS_LOAD_PARM APQbssLoad; /* QBSS load of the current associated AP */ - // new to keep Ralink specific feature + /* new to keep Ralink specific feature */ ULONG APRalinkIe; - BSS_TABLE SsidBssTab; // AP list for the same SSID - BSS_TABLE RoamTab; // AP list eligible for roaming + BSS_TABLE SsidBssTab; /* AP list for the same SSID */ + BSS_TABLE RoamTab; /* AP list eligible for roaming */ ULONG BssIdx; ULONG RoamIdx; @@ -914,7 +914,7 @@ typedef struct _MLME_AUX { } MLME_AUX, *PMLME_AUX; typedef struct _MLME_ADDBA_REQ_STRUCT { - UCHAR Wcid; // + UCHAR Wcid; /* */ UCHAR pAddr[MAC_ADDR_LEN]; UCHAR BaBufSize; USHORT TimeOutValue; @@ -924,13 +924,13 @@ typedef struct _MLME_ADDBA_REQ_STRUCT { } MLME_ADDBA_REQ_STRUCT, *PMLME_ADDBA_REQ_STRUCT; typedef struct _MLME_DELBA_REQ_STRUCT { - UCHAR Wcid; // + UCHAR Wcid; /* */ UCHAR Addr[MAC_ADDR_LEN]; UCHAR TID; UCHAR Initiator; } MLME_DELBA_REQ_STRUCT, *PMLME_DELBA_REQ_STRUCT; -// assoc struct is equal to reassoc +/* assoc struct is equal to reassoc */ typedef struct _MLME_ASSOC_REQ_STRUCT { UCHAR Addr[MAC_ADDR_LEN]; USHORT CapabilityInfo; @@ -991,62 +991,62 @@ typedef struct PACKED _RTMP_TX_RATE_SWITCH { UCHAR TrainDown; } RRTMP_TX_RATE_SWITCH, *PRTMP_TX_RATE_SWITCH; -// ========================== AP mlme.h =============================== -#define TBTT_PRELOAD_TIME 384 // usec. LomgPreamble + 24-byte at 1Mbps +/* ========================== AP mlme.h =============================== */ +#define TBTT_PRELOAD_TIME 384 /* usec. LomgPreamble + 24-byte at 1Mbps */ #define DEFAULT_DTIM_PERIOD 1 -#define MAC_TABLE_AGEOUT_TIME 300 // unit: sec -#define MAC_TABLE_ASSOC_TIMEOUT 5 // unit: sec +#define MAC_TABLE_AGEOUT_TIME 300 /* unit: sec */ +#define MAC_TABLE_ASSOC_TIMEOUT 5 /* unit: sec */ #define MAC_TABLE_FULL(Tab) ((Tab).size == MAX_LEN_OF_MAC_TABLE) -// AP shall drop the sta if contine Tx fail count reach it. -#define MAC_ENTRY_LIFE_CHECK_CNT 20 // packet cnt. +/* AP shall drop the sta if contine Tx fail count reach it. */ +#define MAC_ENTRY_LIFE_CHECK_CNT 20 /* packet cnt. */ -// Value domain of pMacEntry->Sst +/* Value domain of pMacEntry->Sst */ typedef enum _Sst { - SST_NOT_AUTH, // 0: equivalent to IEEE 802.11/1999 state 1 - SST_AUTH, // 1: equivalent to IEEE 802.11/1999 state 2 - SST_ASSOC // 2: equivalent to IEEE 802.11/1999 state 3 + SST_NOT_AUTH, /* 0: equivalent to IEEE 802.11/1999 state 1 */ + SST_AUTH, /* 1: equivalent to IEEE 802.11/1999 state 2 */ + SST_ASSOC /* 2: equivalent to IEEE 802.11/1999 state 3 */ } SST; -// value domain of pMacEntry->AuthState +/* value domain of pMacEntry->AuthState */ typedef enum _AuthState { AS_NOT_AUTH, - AS_AUTH_OPEN, // STA has been authenticated using OPEN SYSTEM - AS_AUTH_KEY, // STA has been authenticated using SHARED KEY - AS_AUTHENTICATING // STA is waiting for AUTH seq#3 using SHARED KEY + AS_AUTH_OPEN, /* STA has been authenticated using OPEN SYSTEM */ + AS_AUTH_KEY, /* STA has been authenticated using SHARED KEY */ + AS_AUTHENTICATING /* STA is waiting for AUTH seq#3 using SHARED KEY */ } AUTH_STATE; -//for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114 +/*for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114 */ typedef enum _ApWpaState { - AS_NOTUSE, // 0 - AS_DISCONNECT, // 1 - AS_DISCONNECTED, // 2 - AS_INITIALIZE, // 3 - AS_AUTHENTICATION, // 4 - AS_AUTHENTICATION2, // 5 - AS_INITPMK, // 6 - AS_INITPSK, // 7 - AS_PTKSTART, // 8 - AS_PTKINIT_NEGOTIATING, // 9 - AS_PTKINITDONE, // 10 - AS_UPDATEKEYS, // 11 - AS_INTEGRITY_FAILURE, // 12 - AS_KEYUPDATE, // 13 + AS_NOTUSE, /* 0 */ + AS_DISCONNECT, /* 1 */ + AS_DISCONNECTED, /* 2 */ + AS_INITIALIZE, /* 3 */ + AS_AUTHENTICATION, /* 4 */ + AS_AUTHENTICATION2, /* 5 */ + AS_INITPMK, /* 6 */ + AS_INITPSK, /* 7 */ + AS_PTKSTART, /* 8 */ + AS_PTKINIT_NEGOTIATING, /* 9 */ + AS_PTKINITDONE, /* 10 */ + AS_UPDATEKEYS, /* 11 */ + AS_INTEGRITY_FAILURE, /* 12 */ + AS_KEYUPDATE, /* 13 */ } AP_WPA_STATE; -// for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114 +/* for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114 */ typedef enum _GTKState { REKEY_NEGOTIATING, REKEY_ESTABLISHED, KEYERROR, } GTK_STATE; -// for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114 +/* for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114 */ typedef enum _WpaGTKState { SETKEYS, SETKEYS_DONE, } WPA_GTK_STATE; -// ====================== end of AP mlme.h ============================ +/* ====================== end of AP mlme.h ============================ */ -#endif // MLME_H__ +#endif /* MLME_H__ */ diff --git a/drivers/staging/rt2860/oid.h b/drivers/staging/rt2860/oid.h index 54fac1c135b8..ba721410230a 100644 --- a/drivers/staging/rt2860/oid.h +++ b/drivers/staging/rt2860/oid.h @@ -37,7 +37,7 @@ #ifndef _OID_H_ #define _OID_H_ -//#include +/*#include */ #ifndef TRUE #define TRUE 1 @@ -45,9 +45,9 @@ #ifndef FALSE #define FALSE 0 #endif -// -// IEEE 802.11 Structures and definitions -// +/* */ +/* IEEE 802.11 Structures and definitions */ +/* */ #define MAX_TX_POWER_LEVEL 100 /* mW */ #define MAX_RSSI_TRIGGER -10 /* dBm */ #define MIN_RSSI_TRIGGER -200 /* dBm */ @@ -55,19 +55,19 @@ #define MIN_FRAG_THRESHOLD 256 /* byte count */ #define MAX_RTS_THRESHOLD 2347 /* byte count */ -// new types for Media Specific Indications -// Extension channel offset +/* new types for Media Specific Indications */ +/* Extension channel offset */ #define EXTCHA_NONE 0 #define EXTCHA_ABOVE 0x1 #define EXTCHA_BELOW 0x3 -// BW +/* BW */ #define BAND_WIDTH_20 0 #define BAND_WIDTH_40 1 #define BAND_WIDTH_BOTH 2 -#define BAND_WIDTH_10 3 // 802.11j has 10MHz. This definition is for internal usage. doesn't fill in the IE or other field. -// SHORTGI -#define GAP_INTERVAL_400 1 // only support in HT mode +#define BAND_WIDTH_10 3 /* 802.11j has 10MHz. This definition is for internal usage. doesn't fill in the IE or other field. */ +/* SHORTGI */ +#define GAP_INTERVAL_400 1 /* only support in HT mode */ #define GAP_INTERVAL_800 0 #define GAP_INTERVAL_BOTH 2 @@ -78,12 +78,12 @@ #define NDIS_802_11_LENGTH_RATES 8 #define NDIS_802_11_LENGTH_RATES_EX 16 #define MAC_ADDR_LENGTH 6 -//#define MAX_NUM_OF_CHS 49 // 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL terminationc -#define MAX_NUM_OF_CHS 54 // 14 channels @2.4G + 12@UNII(lower/middle) + 16@HiperLAN2 + 11@UNII(upper) + 0 @Japan + 1 as NULL termination -#define MAX_NUMBER_OF_EVENT 10 // entry # in EVENT table -#define MAX_NUMBER_OF_MAC 32 // if MAX_MBSSID_NUM is 8, this value can't be larger than 211 +/*#define MAX_NUM_OF_CHS 49 // 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL terminationc */ +#define MAX_NUM_OF_CHS 54 /* 14 channels @2.4G + 12@UNII(lower/middle) + 16@HiperLAN2 + 11@UNII(upper) + 0 @Japan + 1 as NULL termination */ +#define MAX_NUMBER_OF_EVENT 10 /* entry # in EVENT table */ +#define MAX_NUMBER_OF_MAC 32 /* if MAX_MBSSID_NUM is 8, this value can't be larger than 211 */ #define MAX_NUMBER_OF_ACL 64 -#define MAX_LENGTH_OF_SUPPORT_RATES 12 // 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 +#define MAX_LENGTH_OF_SUPPORT_RATES 12 /* 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 */ #define MAX_NUMBER_OF_DLS_ENTRY 4 #define RT_QUERY_SIGNAL_CONTEXT 0x0402 @@ -91,9 +91,9 @@ #define RT_SET_APD_PID 0x0405 #define RT_SET_DEL_MAC_ENTRY 0x0406 #define RT_QUERY_EVENT_TABLE 0x0407 -// -// IEEE 802.11 OIDs -// +/* */ +/* IEEE 802.11 OIDs */ +/* */ #define OID_GET_SET_TOGGLE 0x8000 #define OID_GET_SET_FROM_UI 0x4000 @@ -119,7 +119,7 @@ #define RT_OID_802_11_QUERY_LAST_RX_RATE 0x0613 #define RT_OID_802_11_TX_POWER_LEVEL_1 0x0614 #define RT_OID_802_11_QUERY_PIDVID 0x0615 -//for WPA_SUPPLICANT_SUPPORT +/*for WPA_SUPPLICANT_SUPPORT */ #define OID_SET_COUNTERMEASURES 0x0616 #define RT_OID_WPA_SUPPLICANT_SUPPORT 0x0621 #define RT_OID_WE_VERSION_COMPILED 0x0622 @@ -132,7 +132,7 @@ typedef enum _NDIS_802_11_STATUS_TYPE { Ndis802_11StatusType_Authentication, Ndis802_11StatusType_MediaStreamMode, Ndis802_11StatusType_PMKID_CandidateList, - Ndis802_11StatusTypeMax // not a real type, defined as an upper bound + Ndis802_11StatusTypeMax /* not a real type, defined as an upper bound */ } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE; typedef UCHAR NDIS_802_11_MAC_ADDRESS[6]; @@ -141,7 +141,7 @@ typedef struct _NDIS_802_11_STATUS_INDICATION { NDIS_802_11_STATUS_TYPE StatusType; } NDIS_802_11_STATUS_INDICATION, *PNDIS_802_11_STATUS_INDICATION; -// mask for authentication/integrity fields +/* mask for authentication/integrity fields */ #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f #define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01 @@ -150,27 +150,27 @@ typedef struct _NDIS_802_11_STATUS_INDICATION { #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST { - ULONG Length; // Length of structure + ULONG Length; /* Length of structure */ NDIS_802_11_MAC_ADDRESS Bssid; ULONG Flags; } NDIS_802_11_AUTHENTICATION_REQUEST, *PNDIS_802_11_AUTHENTICATION_REQUEST; -//Added new types for PMKID Candidate lists. +/*Added new types for PMKID Candidate lists. */ typedef struct _PMKID_CANDIDATE { NDIS_802_11_MAC_ADDRESS BSSID; ULONG Flags; } PMKID_CANDIDATE, *PPMKID_CANDIDATE; typedef struct _NDIS_802_11_PMKID_CANDIDATE_LIST { - ULONG Version; // Version of the structure - ULONG NumCandidates; // No. of pmkid candidates + ULONG Version; /* Version of the structure */ + ULONG NumCandidates; /* No. of pmkid candidates */ PMKID_CANDIDATE CandidateList[1]; } NDIS_802_11_PMKID_CANDIDATE_LIST, *PNDIS_802_11_PMKID_CANDIDATE_LIST; -//Flags for PMKID Candidate list structure +/*Flags for PMKID Candidate list structure */ #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01 -// Added new types for OFDM 5G and 2.4G +/* Added new types for OFDM 5G and 2.4G */ typedef enum _NDIS_802_11_NETWORK_TYPE { Ndis802_11FH, Ndis802_11DS, @@ -179,11 +179,11 @@ typedef enum _NDIS_802_11_NETWORK_TYPE { Ndis802_11Automode, Ndis802_11OFDM5_N, Ndis802_11OFDM24_N, - Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound + Ndis802_11NetworkTypeMax /* not a real type, defined as an upper bound */ } NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE; typedef struct _NDIS_802_11_NETWORK_TYPE_LIST { - UINT NumberOfItems; // in list below, at least 1 + UINT NumberOfItems; /* in list below, at least 1 */ NDIS_802_11_NETWORK_TYPE NetworkType[1]; } NDIS_802_11_NETWORK_TYPE_LIST, *PNDIS_802_11_NETWORK_TYPE_LIST; @@ -192,33 +192,33 @@ typedef enum _NDIS_802_11_POWER_MODE { Ndis802_11PowerModeMAX_PSP, Ndis802_11PowerModeFast_PSP, Ndis802_11PowerModeLegacy_PSP, - Ndis802_11PowerModeMax // not a real mode, defined as an upper bound + Ndis802_11PowerModeMax /* not a real mode, defined as an upper bound */ } NDIS_802_11_POWER_MODE, *PNDIS_802_11_POWER_MODE; -typedef ULONG NDIS_802_11_TX_POWER_LEVEL; // in milliwatts +typedef ULONG NDIS_802_11_TX_POWER_LEVEL; /* in milliwatts */ -// -// Received Signal Strength Indication -// -typedef LONG NDIS_802_11_RSSI; // in dBm +/* */ +/* Received Signal Strength Indication */ +/* */ +typedef LONG NDIS_802_11_RSSI; /* in dBm */ typedef struct _NDIS_802_11_CONFIGURATION_FH { - ULONG Length; // Length of structure - ULONG HopPattern; // As defined by 802.11, MSB set - ULONG HopSet; // to one if non-802.11 - ULONG DwellTime; // units are Kusec + ULONG Length; /* Length of structure */ + ULONG HopPattern; /* As defined by 802.11, MSB set */ + ULONG HopSet; /* to one if non-802.11 */ + ULONG DwellTime; /* units are Kusec */ } NDIS_802_11_CONFIGURATION_FH, *PNDIS_802_11_CONFIGURATION_FH; typedef struct _NDIS_802_11_CONFIGURATION { - ULONG Length; // Length of structure - ULONG BeaconPeriod; // units are Kusec - ULONG ATIMWindow; // units are Kusec - ULONG DSConfig; // Frequency, units are kHz + ULONG Length; /* Length of structure */ + ULONG BeaconPeriod; /* units are Kusec */ + ULONG ATIMWindow; /* units are Kusec */ + ULONG DSConfig; /* Frequency, units are kHz */ NDIS_802_11_CONFIGURATION_FH FHConfig; } NDIS_802_11_CONFIGURATION, *PNDIS_802_11_CONFIGURATION; typedef struct _NDIS_802_11_STATISTICS { - ULONG Length; // Length of structure + ULONG Length; /* Length of structure */ LARGE_INTEGER TransmittedFragmentCount; LARGE_INTEGER MulticastTransmittedFrameCount; LARGE_INTEGER FailedCount; @@ -245,7 +245,7 @@ typedef struct _NDIS_802_11_STATISTICS { typedef ULONG NDIS_802_11_KEY_INDEX; typedef ULONGLONG NDIS_802_11_KEY_RSC; -#define MAX_RADIUS_SRV_NUM 2 // 802.1x failover number +#define MAX_RADIUS_SRV_NUM 2 /* 802.1x failover number */ typedef struct PACKED _RADIUS_SRV_INFO { UINT32 radius_ip; @@ -257,16 +257,16 @@ typedef struct PACKED _RADIUS_SRV_INFO { typedef struct PACKED _RADIUS_KEY_INFO { UCHAR radius_srv_num; RADIUS_SRV_INFO radius_srv_info[MAX_RADIUS_SRV_NUM]; - UCHAR ieee8021xWEP; // dynamic WEP + UCHAR ieee8021xWEP; /* dynamic WEP */ UCHAR key_index; - UCHAR key_length; // length of key in bytes + UCHAR key_length; /* length of key in bytes */ UCHAR key_material[13]; } RADIUS_KEY_INFO, *PRADIUS_KEY_INFO; -// It's used by 802.1x daemon to require relative configuration +/* It's used by 802.1x daemon to require relative configuration */ typedef struct PACKED _RADIUS_CONF { - UINT32 Length; // Length of this structure - UCHAR mbss_num; // indicate multiple BSS number + UINT32 Length; /* Length of this structure */ + UCHAR mbss_num; /* indicate multiple BSS number */ UINT32 own_ip_addr; UINT32 retry_interval; UINT32 session_timeout_interval; @@ -277,34 +277,34 @@ typedef struct PACKED _RADIUS_CONF { RADIUS_KEY_INFO RadiusInfo[8]; } RADIUS_CONF, *PRADIUS_CONF; -// Key mapping keys require a BSSID +/* Key mapping keys require a BSSID */ typedef struct _NDIS_802_11_KEY { - UINT Length; // Length of this structure + UINT Length; /* Length of this structure */ UINT KeyIndex; - UINT KeyLength; // length of key in bytes + UINT KeyLength; /* length of key in bytes */ NDIS_802_11_MAC_ADDRESS BSSID; NDIS_802_11_KEY_RSC KeyRSC; - UCHAR KeyMaterial[1]; // variable length depending on above field + UCHAR KeyMaterial[1]; /* variable length depending on above field */ } NDIS_802_11_KEY, *PNDIS_802_11_KEY; typedef struct _NDIS_802_11_PASSPHRASE { - UINT KeyLength; // length of key in bytes + UINT KeyLength; /* length of key in bytes */ NDIS_802_11_MAC_ADDRESS BSSID; - UCHAR KeyMaterial[1]; // variable length depending on above field + UCHAR KeyMaterial[1]; /* variable length depending on above field */ } NDIS_802_11_PASSPHRASE, *PNDIS_802_11_PASSPHRASE; typedef struct _NDIS_802_11_REMOVE_KEY { - UINT Length; // Length of this structure + UINT Length; /* Length of this structure */ UINT KeyIndex; NDIS_802_11_MAC_ADDRESS BSSID; } NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY; typedef struct _NDIS_802_11_WEP { - UINT Length; // Length of this structure - UINT KeyIndex; // 0 is the per-client key, 1-N are the - // global keys - UINT KeyLength; // length of key in bytes - UCHAR KeyMaterial[1]; // variable length depending on above field + UINT Length; /* Length of this structure */ + UINT KeyIndex; /* 0 is the per-client key, 1-N are the */ + /* global keys */ + UINT KeyLength; /* length of key in bytes */ + UCHAR KeyMaterial[1]; /* variable length depending on above field */ } NDIS_802_11_WEP, *PNDIS_802_11_WEP; typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE { @@ -312,10 +312,10 @@ typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE { Ndis802_11Infrastructure, Ndis802_11AutoUnknown, Ndis802_11Monitor, - Ndis802_11InfrastructureMax // Not a real value, defined as upper bound + Ndis802_11InfrastructureMax /* Not a real value, defined as upper bound */ } NDIS_802_11_NETWORK_INFRASTRUCTURE, *PNDIS_802_11_NETWORK_INFRASTRUCTURE; -// Add new authentication modes +/* Add new authentication modes */ typedef enum _NDIS_802_11_AUTHENTICATION_MODE { Ndis802_11AuthModeOpen, Ndis802_11AuthModeShared, @@ -327,25 +327,25 @@ typedef enum _NDIS_802_11_AUTHENTICATION_MODE { Ndis802_11AuthModeWPA2PSK, Ndis802_11AuthModeWPA1WPA2, Ndis802_11AuthModeWPA1PSKWPA2PSK, - Ndis802_11AuthModeMax // Not a real mode, defined as upper bound + Ndis802_11AuthModeMax /* Not a real mode, defined as upper bound */ } NDIS_802_11_AUTHENTICATION_MODE, *PNDIS_802_11_AUTHENTICATION_MODE; -typedef UCHAR NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; // Set of 8 data rates -typedef UCHAR NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; // Set of 16 data rates +typedef UCHAR NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; /* Set of 8 data rates */ +typedef UCHAR NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; /* Set of 16 data rates */ typedef struct PACKED _NDIS_802_11_SSID { - UINT SsidLength; // length of SSID field below, in bytes; - // this can be zero. - UCHAR Ssid[NDIS_802_11_LENGTH_SSID]; // SSID information field + UINT SsidLength; /* length of SSID field below, in bytes; */ + /* this can be zero. */ + UCHAR Ssid[NDIS_802_11_LENGTH_SSID]; /* SSID information field */ } NDIS_802_11_SSID, *PNDIS_802_11_SSID; typedef struct PACKED _NDIS_WLAN_BSSID { - ULONG Length; // Length of this structure - NDIS_802_11_MAC_ADDRESS MacAddress; // BSSID + ULONG Length; /* Length of this structure */ + NDIS_802_11_MAC_ADDRESS MacAddress; /* BSSID */ UCHAR Reserved[2]; - NDIS_802_11_SSID Ssid; // SSID - ULONG Privacy; // WEP encryption requirement - NDIS_802_11_RSSI Rssi; // receive signal strength in dBm + NDIS_802_11_SSID Ssid; /* SSID */ + ULONG Privacy; /* WEP encryption requirement */ + NDIS_802_11_RSSI Rssi; /* receive signal strength in dBm */ NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; NDIS_802_11_CONFIGURATION Configuration; NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; @@ -353,19 +353,19 @@ typedef struct PACKED _NDIS_WLAN_BSSID { } NDIS_WLAN_BSSID, *PNDIS_WLAN_BSSID; typedef struct PACKED _NDIS_802_11_BSSID_LIST { - UINT NumberOfItems; // in list below, at least 1 + UINT NumberOfItems; /* in list below, at least 1 */ NDIS_WLAN_BSSID Bssid[1]; } NDIS_802_11_BSSID_LIST, *PNDIS_802_11_BSSID_LIST; -// Added Capabilities, IELength and IEs for each BSSID +/* Added Capabilities, IELength and IEs for each BSSID */ typedef struct PACKED _NDIS_WLAN_BSSID_EX { - ULONG Length; // Length of this structure - NDIS_802_11_MAC_ADDRESS MacAddress; // BSSID + ULONG Length; /* Length of this structure */ + NDIS_802_11_MAC_ADDRESS MacAddress; /* BSSID */ UCHAR Reserved[2]; - NDIS_802_11_SSID Ssid; // SSID - UINT Privacy; // WEP encryption requirement - NDIS_802_11_RSSI Rssi; // receive signal - // strength in dBm + NDIS_802_11_SSID Ssid; /* SSID */ + UINT Privacy; /* WEP encryption requirement */ + NDIS_802_11_RSSI Rssi; /* receive signal */ + /* strength in dBm */ NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; NDIS_802_11_CONFIGURATION Configuration; NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; @@ -375,7 +375,7 @@ typedef struct PACKED _NDIS_WLAN_BSSID_EX { } NDIS_WLAN_BSSID_EX, *PNDIS_WLAN_BSSID_EX; typedef struct PACKED _NDIS_802_11_BSSID_LIST_EX { - UINT NumberOfItems; // in list below, at least 1 + UINT NumberOfItems; /* in list below, at least 1 */ NDIS_WLAN_BSSID_EX Bssid[1]; } NDIS_802_11_BSSID_LIST_EX, *PNDIS_802_11_BSSID_LIST_EX; @@ -387,7 +387,7 @@ typedef struct PACKED _NDIS_802_11_FIXED_IEs { typedef struct _NDIS_802_11_VARIABLE_IEs { UCHAR ElementID; - UCHAR Length; // Number of bytes in data field + UCHAR Length; /* Number of bytes in data field */ UCHAR data[1]; } NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs; @@ -402,8 +402,8 @@ typedef enum _NDIS_802_11_PRIVACY_FILTER { Ndis802_11PrivFilter8021xWEP } NDIS_802_11_PRIVACY_FILTER, *PNDIS_802_11_PRIVACY_FILTER; -// Added new encryption types -// Also aliased typedef to new name +/* Added new encryption types */ +/* Also aliased typedef to new name */ typedef enum _NDIS_802_11_WEP_STATUS { Ndis802_11WEPEnabled, Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled, @@ -417,7 +417,7 @@ typedef enum _NDIS_802_11_WEP_STATUS { Ndis802_11Encryption2KeyAbsent, Ndis802_11Encryption3Enabled, Ndis802_11Encryption3KeyAbsent, - Ndis802_11Encryption4Enabled, // TKIP or AES mix + Ndis802_11Encryption4Enabled, /* TKIP or AES mix */ Ndis802_11Encryption4KeyAbsent, Ndis802_11GroupWEP40Enabled, Ndis802_11GroupWEP104Enabled, @@ -465,13 +465,13 @@ typedef struct _NDIS_802_11_AUTHENTICATION_EVENT { NDIS_802_11_AUTHENTICATION_REQUEST Request[1]; } NDIS_802_11_AUTHENTICATION_EVENT, *PNDIS_802_11_AUTHENTICATION_EVENT; -// 802.11 Media stream constraints, associated with OID_802_11_MEDIA_STREAM_MODE +/* 802.11 Media stream constraints, associated with OID_802_11_MEDIA_STREAM_MODE */ typedef enum _NDIS_802_11_MEDIA_STREAM_MODE { Ndis802_11MediaStreamOff, Ndis802_11MediaStreamOn, } NDIS_802_11_MEDIA_STREAM_MODE, *PNDIS_802_11_MEDIA_STREAM_MODE; -// PMKID Structures +/* PMKID Structures */ typedef UCHAR NDIS_802_11_PMKID_VALUE[16]; typedef struct _BSSID_INFO { @@ -500,14 +500,14 @@ typedef struct _NDIS_802_11_CAPABILITY { AuthenticationEncryptionSupported[1]; } NDIS_802_11_CAPABILITY, *PNDIS_802_11_CAPABILITY; -#define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x01) // Sync. with AP for wsc upnp daemon +#define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x01) /* Sync. with AP for wsc upnp daemon */ #define RTPRIV_IOCTL_SET (SIOCIWFIRSTPRIV + 0x02) #define RTPRIV_IOCTL_STATISTICS (SIOCIWFIRSTPRIV + 0x09) #define RTPRIV_IOCTL_ADD_PMKID_CACHE (SIOCIWFIRSTPRIV + 0x0A) #define RTPRIV_IOCTL_RADIUS_DATA (SIOCIWFIRSTPRIV + 0x0C) #define RTPRIV_IOCTL_GSITESURVEY (SIOCIWFIRSTPRIV + 0x0D) -#define RT_PRIV_IOCTL_EXT (SIOCIWFIRSTPRIV + 0x0E) // Sync. with RT61 (for wpa_supplicant) +#define RT_PRIV_IOCTL_EXT (SIOCIWFIRSTPRIV + 0x0E) /* Sync. with RT61 (for wpa_supplicant) */ #define RTPRIV_IOCTL_GET_MAC_TABLE (SIOCIWFIRSTPRIV + 0x0F) #define RTPRIV_IOCTL_SHOW (SIOCIWFIRSTPRIV + 0x11) @@ -519,7 +519,7 @@ enum { #ifdef RTMP_MAC_USB SHOW_RXBULK_INFO = 8, SHOW_TXBULK_INFO = 9, -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ RAIO_OFF = 10, RAIO_ON = 11, SHOW_CFG_VALUE = 20, @@ -531,19 +531,19 @@ enum { #define OID_802_11_GET_COUNTRY_CODE 0x0716 #define OID_802_11_GET_CHANNEL_GEOGRAPHY 0x0717 -#define RT_OID_WSC_SET_PASSPHRASE 0x0740 // passphrase for wpa(2)-psk +#define RT_OID_WSC_SET_PASSPHRASE 0x0740 /* passphrase for wpa(2)-psk */ #define RT_OID_WSC_DRIVER_AUTO_CONNECT 0x0741 #define RT_OID_WSC_QUERY_DEFAULT_PROFILE 0x0742 #define RT_OID_WSC_SET_CONN_BY_PROFILE_INDEX 0x0743 #define RT_OID_WSC_SET_ACTION 0x0744 #define RT_OID_WSC_SET_SSID 0x0745 #define RT_OID_WSC_SET_PIN_CODE 0x0746 -#define RT_OID_WSC_SET_MODE 0x0747 // PIN or PBC -#define RT_OID_WSC_SET_CONF_MODE 0x0748 // Enrollee or Registrar +#define RT_OID_WSC_SET_MODE 0x0747 /* PIN or PBC */ +#define RT_OID_WSC_SET_CONF_MODE 0x0748 /* Enrollee or Registrar */ #define RT_OID_WSC_SET_PROFILE 0x0749 #define RT_OID_WSC_CONFIG_STATUS 0x074F #define RT_OID_802_11_WSC_QUERY_PROFILE 0x0750 -// for consistency with RT61 +/* for consistency with RT61 */ #define RT_OID_WSC_QUERY_STATUS 0x0751 #define RT_OID_WSC_PIN_CODE 0x0752 #define RT_OID_WSC_UUID 0x0753 @@ -555,20 +555,20 @@ enum { #define RT_OID_WSC_SERIAL_NO 0x0759 #define RT_OID_WSC_MAC_ADDRESS 0x0760 -// New for MeetingHouse Api support +/* New for MeetingHouse Api support */ #define OID_MH_802_1X_SUPPORTED 0xFFEDC100 -// MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!! +/* MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!! */ typedef union _HTTRANSMIT_SETTING { struct { - USHORT MCS:7; // MCS - USHORT BW:1; //channel bandwidth 20MHz or 40 MHz + USHORT MCS:7; /* MCS */ + USHORT BW:1; /*channel bandwidth 20MHz or 40 MHz */ USHORT ShortGI:1; - USHORT STBC:2; //SPACE -// USHORT rsv:3; + USHORT STBC:2; /*SPACE */ +/* USHORT rsv:3; */ USHORT rsv:2; USHORT TxBF:1; - USHORT MODE:2; // Use definition MODE_xxx. + USHORT MODE:2; /* Use definition MODE_xxx. */ } field; USHORT word; } HTTRANSMIT_SETTING, *PHTTRANSMIT_SETTING; @@ -585,45 +585,45 @@ typedef enum _RT_802_11_PHY_MODE { PHY_11A, PHY_11ABG_MIXED, PHY_11G, - PHY_11ABGN_MIXED, // both band 5 - PHY_11N_2_4G, // 11n-only with 2.4G band 6 - PHY_11GN_MIXED, // 2.4G band 7 - PHY_11AN_MIXED, // 5G band 8 - PHY_11BGN_MIXED, // if check 802.11b. 9 - PHY_11AGN_MIXED, // if check 802.11b. 10 - PHY_11N_5G, // 11n-only with 5G band 11 + PHY_11ABGN_MIXED, /* both band 5 */ + PHY_11N_2_4G, /* 11n-only with 2.4G band 6 */ + PHY_11GN_MIXED, /* 2.4G band 7 */ + PHY_11AN_MIXED, /* 5G band 8 */ + PHY_11BGN_MIXED, /* if check 802.11b. 9 */ + PHY_11AGN_MIXED, /* if check 802.11b. 10 */ + PHY_11N_5G, /* 11n-only with 5G band 11 */ } RT_802_11_PHY_MODE; -// put all proprietery for-query objects here to reduce # of Query_OID +/* put all proprietery for-query objects here to reduce # of Query_OID */ typedef struct _RT_802_11_LINK_STATUS { - ULONG CurrTxRate; // in units of 0.5Mbps - ULONG ChannelQuality; // 0..100 % - ULONG TxByteCount; // both ok and fail - ULONG RxByteCount; // both ok and fail - ULONG CentralChannel; // 40MHz central channel number + ULONG CurrTxRate; /* in units of 0.5Mbps */ + ULONG ChannelQuality; /* 0..100 % */ + ULONG TxByteCount; /* both ok and fail */ + ULONG RxByteCount; /* both ok and fail */ + ULONG CentralChannel; /* 40MHz central channel number */ } RT_802_11_LINK_STATUS, *PRT_802_11_LINK_STATUS; typedef struct _RT_802_11_EVENT_LOG { - LARGE_INTEGER SystemTime; // timestammp via NdisGetCurrentSystemTime() + LARGE_INTEGER SystemTime; /* timestammp via NdisGetCurrentSystemTime() */ UCHAR Addr[MAC_ADDR_LENGTH]; - USHORT Event; // EVENT_xxx + USHORT Event; /* EVENT_xxx */ } RT_802_11_EVENT_LOG, *PRT_802_11_EVENT_LOG; typedef struct _RT_802_11_EVENT_TABLE { ULONG Num; - ULONG Rsv; // to align Log[] at LARGE_INEGER boundary + ULONG Rsv; /* to align Log[] at LARGE_INEGER boundary */ RT_802_11_EVENT_LOG Log[MAX_NUMBER_OF_EVENT]; } RT_802_11_EVENT_TABLE, PRT_802_11_EVENT_TABLE; -// MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!! +/* MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!! */ typedef union _MACHTTRANSMIT_SETTING { struct { - USHORT MCS:7; // MCS - USHORT BW:1; //channel bandwidth 20MHz or 40 MHz + USHORT MCS:7; /* MCS */ + USHORT BW:1; /*channel bandwidth 20MHz or 40 MHz */ USHORT ShortGI:1; - USHORT STBC:2; //SPACE + USHORT STBC:2; /*SPACE */ USHORT rsv:3; - USHORT MODE:2; // Use definition MODE_xxx. + USHORT MODE:2; /* Use definition MODE_xxx. */ } field; USHORT word; } MACHTTRANSMIT_SETTING, *PMACHTTRANSMIT_SETTING; @@ -631,8 +631,8 @@ typedef union _MACHTTRANSMIT_SETTING { typedef struct _RT_802_11_MAC_ENTRY { UCHAR Addr[MAC_ADDR_LENGTH]; UCHAR Aid; - UCHAR Psm; // 0:PWR_ACTIVE, 1:PWR_SAVE - UCHAR MimoPs; // 0:MMPS_STATIC, 1:MMPS_DYNAMIC, 3:MMPS_Enabled + UCHAR Psm; /* 0:PWR_ACTIVE, 1:PWR_SAVE */ + UCHAR MimoPs; /* 0:MMPS_STATIC, 1:MMPS_DYNAMIC, 3:MMPS_Enabled */ CHAR AvgRssi0; CHAR AvgRssi1; CHAR AvgRssi2; @@ -645,48 +645,48 @@ typedef struct _RT_802_11_MAC_TABLE { RT_802_11_MAC_ENTRY Entry[MAX_NUMBER_OF_MAC]; } RT_802_11_MAC_TABLE, *PRT_802_11_MAC_TABLE; -// structure for query/set hardware register - MAC, BBP, RF register +/* structure for query/set hardware register - MAC, BBP, RF register */ typedef struct _RT_802_11_HARDWARE_REGISTER { - ULONG HardwareType; // 0:MAC, 1:BBP, 2:RF register, 3:EEPROM - ULONG Offset; // Q/S register offset addr - ULONG Data; // R/W data buffer + ULONG HardwareType; /* 0:MAC, 1:BBP, 2:RF register, 3:EEPROM */ + ULONG Offset; /* Q/S register offset addr */ + ULONG Data; /* R/W data buffer */ } RT_802_11_HARDWARE_REGISTER, *PRT_802_11_HARDWARE_REGISTER; typedef struct _RT_802_11_AP_CONFIG { - ULONG EnableTxBurst; // 0-disable, 1-enable - ULONG EnableTurboRate; // 0-disable, 1-enable 72/100mbps turbo rate - ULONG IsolateInterStaTraffic; // 0-disable, 1-enable isolation - ULONG HideSsid; // 0-disable, 1-enable hiding - ULONG UseBGProtection; // 0-AUTO, 1-always ON, 2-always OFF - ULONG UseShortSlotTime; // 0-no use, 1-use 9-us short slot time - ULONG Rsv1; // must be 0 - ULONG SystemErrorBitmap; // ignore upon SET, return system error upon QUERY + ULONG EnableTxBurst; /* 0-disable, 1-enable */ + ULONG EnableTurboRate; /* 0-disable, 1-enable 72/100mbps turbo rate */ + ULONG IsolateInterStaTraffic; /* 0-disable, 1-enable isolation */ + ULONG HideSsid; /* 0-disable, 1-enable hiding */ + ULONG UseBGProtection; /* 0-AUTO, 1-always ON, 2-always OFF */ + ULONG UseShortSlotTime; /* 0-no use, 1-use 9-us short slot time */ + ULONG Rsv1; /* must be 0 */ + ULONG SystemErrorBitmap; /* ignore upon SET, return system error upon QUERY */ } RT_802_11_AP_CONFIG, *PRT_802_11_AP_CONFIG; -// structure to query/set STA_CONFIG +/* structure to query/set STA_CONFIG */ typedef struct _RT_802_11_STA_CONFIG { - ULONG EnableTxBurst; // 0-disable, 1-enable - ULONG EnableTurboRate; // 0-disable, 1-enable 72/100mbps turbo rate - ULONG UseBGProtection; // 0-AUTO, 1-always ON, 2-always OFF - ULONG UseShortSlotTime; // 0-no use, 1-use 9-us short slot time when applicable - ULONG AdhocMode; // 0-11b rates only (WIFI spec), 1 - b/g mixed, 2 - g only - ULONG HwRadioStatus; // 0-OFF, 1-ON, default is 1, Read-Only - ULONG Rsv1; // must be 0 - ULONG SystemErrorBitmap; // ignore upon SET, return system error upon QUERY + ULONG EnableTxBurst; /* 0-disable, 1-enable */ + ULONG EnableTurboRate; /* 0-disable, 1-enable 72/100mbps turbo rate */ + ULONG UseBGProtection; /* 0-AUTO, 1-always ON, 2-always OFF */ + ULONG UseShortSlotTime; /* 0-no use, 1-use 9-us short slot time when applicable */ + ULONG AdhocMode; /* 0-11b rates only (WIFI spec), 1 - b/g mixed, 2 - g only */ + ULONG HwRadioStatus; /* 0-OFF, 1-ON, default is 1, Read-Only */ + ULONG Rsv1; /* must be 0 */ + ULONG SystemErrorBitmap; /* ignore upon SET, return system error upon QUERY */ } RT_802_11_STA_CONFIG, *PRT_802_11_STA_CONFIG; -// -// For OID Query or Set about BA structure -// +/* */ +/* For OID Query or Set about BA structure */ +/* */ typedef struct _OID_BACAP_STRUC { UCHAR RxBAWinLimit; UCHAR TxBAWinLimit; - UCHAR Policy; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid - UCHAR MpduDensity; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid - UCHAR AmsduEnable; //Enable AMSDU transmisstion - UCHAR AmsduSize; // 0:3839, 1:7935 bytes. UINT MSDUSizeToBytes[] = { 3839, 7935}; - UCHAR MMPSmode; // MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable - BOOLEAN AutoBA; // Auto BA will automatically + UCHAR Policy; /* 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid */ + UCHAR MpduDensity; /* 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid */ + UCHAR AmsduEnable; /*Enable AMSDU transmisstion */ + UCHAR AmsduSize; /* 0:3839, 1:7935 bytes. UINT MSDUSizeToBytes[] = { 3839, 7935}; */ + UCHAR MMPSmode; /* MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable */ + BOOLEAN AutoBA; /* Auto BA will automatically */ } OID_BACAP_STRUC, *POID_BACAP_STRUC; typedef struct _RT_802_11_ACL_ENTRY { @@ -695,7 +695,7 @@ typedef struct _RT_802_11_ACL_ENTRY { } RT_802_11_ACL_ENTRY, *PRT_802_11_ACL_ENTRY; typedef struct PACKED _RT_802_11_ACL { - ULONG Policy; // 0-disable, 1-positive list, 2-negative list + ULONG Policy; /* 0-disable, 1-positive list, 2-negative list */ ULONG Num; RT_802_11_ACL_ENTRY Entry[MAX_NUMBER_OF_ACL]; } RT_802_11_ACL, *PRT_802_11_ACL; @@ -714,29 +714,29 @@ typedef struct _RT_802_11_TX_RATES_ { UCHAR ExtRate[MAX_LENGTH_OF_SUPPORT_RATES]; } RT_802_11_TX_RATES, *PRT_802_11_TX_RATES; -// Definition of extra information code -#define GENERAL_LINK_UP 0x0 // Link is Up -#define GENERAL_LINK_DOWN 0x1 // Link is Down -#define HW_RADIO_OFF 0x2 // Hardware radio off -#define SW_RADIO_OFF 0x3 // Software radio off -#define AUTH_FAIL 0x4 // Open authentication fail -#define AUTH_FAIL_KEYS 0x5 // Shared authentication fail -#define ASSOC_FAIL 0x6 // Association failed -#define EAP_MIC_FAILURE 0x7 // Deauthencation because MIC failure -#define EAP_4WAY_TIMEOUT 0x8 // Deauthencation on 4-way handshake timeout -#define EAP_GROUP_KEY_TIMEOUT 0x9 // Deauthencation on group key handshake timeout -#define EAP_SUCCESS 0xa // EAP succeed -#define DETECT_RADAR_SIGNAL 0xb // Radar signal occur in current channel -#define EXTRA_INFO_MAX 0xb // Indicate Last OID +/* Definition of extra information code */ +#define GENERAL_LINK_UP 0x0 /* Link is Up */ +#define GENERAL_LINK_DOWN 0x1 /* Link is Down */ +#define HW_RADIO_OFF 0x2 /* Hardware radio off */ +#define SW_RADIO_OFF 0x3 /* Software radio off */ +#define AUTH_FAIL 0x4 /* Open authentication fail */ +#define AUTH_FAIL_KEYS 0x5 /* Shared authentication fail */ +#define ASSOC_FAIL 0x6 /* Association failed */ +#define EAP_MIC_FAILURE 0x7 /* Deauthencation because MIC failure */ +#define EAP_4WAY_TIMEOUT 0x8 /* Deauthencation on 4-way handshake timeout */ +#define EAP_GROUP_KEY_TIMEOUT 0x9 /* Deauthencation on group key handshake timeout */ +#define EAP_SUCCESS 0xa /* EAP succeed */ +#define DETECT_RADAR_SIGNAL 0xb /* Radar signal occur in current channel */ +#define EXTRA_INFO_MAX 0xb /* Indicate Last OID */ #define EXTRA_INFO_CLEAR 0xffffffff -// This is OID setting structure. So only GF or MM as Mode. This is valid when our wirelss mode has 802.11n in use. +/* This is OID setting structure. So only GF or MM as Mode. This is valid when our wirelss mode has 802.11n in use. */ typedef struct { - RT_802_11_PHY_MODE PhyMode; // + RT_802_11_PHY_MODE PhyMode; /* */ UCHAR TransmitNo; - UCHAR HtMode; //HTMODE_GF or HTMODE_MM - UCHAR ExtOffset; //extension channel above or below + UCHAR HtMode; /*HTMODE_GF or HTMODE_MM */ + UCHAR ExtOffset; /*extension channel above or below */ UCHAR MCS; UCHAR BW; UCHAR STBC; @@ -753,27 +753,27 @@ typedef enum _RT_802_11_D_CLIENT_MODE { } RT_802_11_D_CLIENT_MODE, *PRT_802_11_D_CLIENT_MODE; typedef struct _RT_CHANNEL_LIST_INFO { - UCHAR ChannelList[MAX_NUM_OF_CHS]; // list all supported channels for site survey - UCHAR ChannelListNum; // number of channel in ChannelList[] + UCHAR ChannelList[MAX_NUM_OF_CHS]; /* list all supported channels for site survey */ + UCHAR ChannelListNum; /* number of channel in ChannelList[] */ } RT_CHANNEL_LIST_INFO, *PRT_CHANNEL_LIST_INFO; -// WSC configured credential +/* WSC configured credential */ typedef struct _WSC_CREDENTIAL { - NDIS_802_11_SSID SSID; // mandatory - USHORT AuthType; // mandatory, 1: open, 2: wpa-psk, 4: shared, 8:wpa, 0x10: wpa2, 0x20: wpa2-psk - USHORT EncrType; // mandatory, 1: none, 2: wep, 4: tkip, 8: aes - UCHAR Key[64]; // mandatory, Maximum 64 byte + NDIS_802_11_SSID SSID; /* mandatory */ + USHORT AuthType; /* mandatory, 1: open, 2: wpa-psk, 4: shared, 8:wpa, 0x10: wpa2, 0x20: wpa2-psk */ + USHORT EncrType; /* mandatory, 1: none, 2: wep, 4: tkip, 8: aes */ + UCHAR Key[64]; /* mandatory, Maximum 64 byte */ USHORT KeyLength; - UCHAR MacAddr[6]; // mandatory, AP MAC address - UCHAR KeyIndex; // optional, default is 1 - UCHAR Rsvd[3]; // Make alignment + UCHAR MacAddr[6]; /* mandatory, AP MAC address */ + UCHAR KeyIndex; /* optional, default is 1 */ + UCHAR Rsvd[3]; /* Make alignment */ } WSC_CREDENTIAL, *PWSC_CREDENTIAL; -// WSC configured profiles +/* WSC configured profiles */ typedef struct _WSC_PROFILE { UINT ProfileCnt; - UINT ApplyProfileIdx; // add by johnli, fix WPS test plan 5.1.1 - WSC_CREDENTIAL Profile[8]; // Support up to 8 profiles + UINT ApplyProfileIdx; /* add by johnli, fix WPS test plan 5.1.1 */ + WSC_CREDENTIAL Profile[8]; /* Support up to 8 profiles */ } WSC_PROFILE, *PWSC_PROFILE; -#endif // _OID_H_ +#endif /* _OID_H_ */ diff --git a/drivers/staging/rt2860/rt_config.h b/drivers/staging/rt2860/rt_config.h index 8fa3f118c925..d1adef8948af 100644 --- a/drivers/staging/rt2860/rt_config.h +++ b/drivers/staging/rt2860/rt_config.h @@ -66,6 +66,6 @@ #ifdef IGMP_SNOOP_SUPPORT #include "igmp_snoop.h" -#endif // IGMP_SNOOP_SUPPORT // +#endif /* IGMP_SNOOP_SUPPORT // */ -#endif // __RT_CONFIG_H__ +#endif /* __RT_CONFIG_H__ */ diff --git a/drivers/staging/rt2860/rt_linux.h b/drivers/staging/rt2860/rt_linux.h index 478c8d0d6e9d..1e27c6674fd1 100644 --- a/drivers/staging/rt2860/rt_linux.h +++ b/drivers/staging/rt2860/rt_linux.h @@ -60,20 +60,20 @@ #include -// load firmware +/* load firmware */ #define __KERNEL_SYSCALLS__ #include #include #include -#include // for get_unaligned() +#include /* for get_unaligned() */ #define KTHREAD_SUPPORT 1 -// RT2870 2.1.0.0 has it disabled +/* RT2870 2.1.0.0 has it disabled */ #ifdef KTHREAD_SUPPORT #include #include -#endif // KTHREAD_SUPPORT // +#endif /* KTHREAD_SUPPORT // */ /*********************************************************************************** * Profile related sections @@ -82,12 +82,12 @@ #ifdef RTMP_MAC_PCI #define STA_PROFILE_PATH "/etc/Wireless/RT2860STA/RT2860STA.dat" #define STA_DRIVER_VERSION "2.1.0.0" -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB #define STA_PROFILE_PATH "/etc/Wireless/RT2870STA/RT2870STA.dat" #define STA_DRIVER_VERSION "2.1.0.0" -// RT3070 version: 2.1.1.0 -#endif // RTMP_MAC_USB // +/* RT3070 version: 2.1.1.0 */ +#endif /* RTMP_MAC_USB // */ extern const struct iw_handler_def rt28xx_iw_handler_def; @@ -124,8 +124,8 @@ typedef int (*HARD_START_XMIT_FUNC) (struct sk_buff * skb, #define PCI_DEVICE(vend,dev) \ .vendor = (vend), .device = (dev), \ .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID -#endif // PCI_DEVICE // -#endif // RTMP_MAC_PCI // +#endif /* PCI_DEVICE // */ +#endif /* RTMP_MAC_PCI // */ #define RT_MOD_INC_USE_COUNT() \ if (!try_module_get(THIS_MODULE)) \ @@ -140,7 +140,7 @@ typedef int (*HARD_START_XMIT_FUNC) (struct sk_buff * skb, #define RTMP_DEC_REF(_A) 0 #define RTMP_GET_REF(_A) 0 -// This function will be called when query /proc +/* This function will be called when query /proc */ struct iw_statistics *rt28xx_get_wireless_stats(IN struct net_device *net_dev); /*********************************************************************************** @@ -176,13 +176,13 @@ struct iw_statistics *rt28xx_get_wireless_stats(IN struct net_device *net_dev); /*********************************************************************************** * Ralink Specific network related constant definitions ***********************************************************************************/ -#define MIN_NET_DEVICE_FOR_AID 0x00 //0x00~0x3f -#define MIN_NET_DEVICE_FOR_MBSSID 0x00 //0x00,0x10,0x20,0x30 -#define MIN_NET_DEVICE_FOR_WDS 0x10 //0x40,0x50,0x60,0x70 +#define MIN_NET_DEVICE_FOR_AID 0x00 /*0x00~0x3f */ +#define MIN_NET_DEVICE_FOR_MBSSID 0x00 /*0x00,0x10,0x20,0x30 */ +#define MIN_NET_DEVICE_FOR_WDS 0x10 /*0x40,0x50,0x60,0x70 */ #define MIN_NET_DEVICE_FOR_APCLI 0x20 #define MIN_NET_DEVICE_FOR_MESH 0x30 #define MIN_NET_DEVICE_FOR_DLS 0x40 -#define NET_DEVICE_REAL_IDX_MASK 0x0f // for each operation mode, we maximum support 15 entities. +#define NET_DEVICE_REAL_IDX_MASK 0x0f /* for each operation mode, we maximum support 15 entities. */ #define NDIS_PACKET_TYPE_DIRECTED 0 #define NDIS_PACKET_TYPE_MULTICAST 1 @@ -217,9 +217,9 @@ struct os_lock { typedef spinlock_t NDIS_SPIN_LOCK; -// -// spin_lock enhanced for Nested spin lock -// +/* */ +/* spin_lock enhanced for Nested spin lock */ +/* */ #define NdisAllocateSpinLock(__lock) \ { \ spin_lock_init((spinlock_t *)(__lock)); \ @@ -238,7 +238,7 @@ typedef spinlock_t NDIS_SPIN_LOCK; spin_unlock_bh((spinlock_t *)(__lock)); \ } -// sample, use semaphore lock to replace IRQ lock, 2007/11/15 +/* sample, use semaphore lock to replace IRQ lock, 2007/11/15 */ #define RTMP_IRQ_LOCK(__lock, __irqflags) \ { \ __irqflags = 0; \ @@ -330,7 +330,7 @@ do { \ /*********************************************************************************** * OS Memory Access related data structure and definitions ***********************************************************************************/ -#define MEM_ALLOC_FLAG (GFP_ATOMIC) //(GFP_DMA | GFP_ATOMIC) +#define MEM_ALLOC_FLAG (GFP_ATOMIC) /*(GFP_DMA | GFP_ATOMIC) */ #define NdisMoveMemory(Destination, Source, Length) memmove(Destination, Source, Length) #define NdisCopyMemory(Destination, Source, Length) memcpy(Destination, Source, Length) @@ -405,10 +405,10 @@ struct os_cookie { struct pci_dev *parent_pci_dev; USHORT DeviceID; dma_addr_t pAd_pa; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB struct usb_device *pUsb_Dev; -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ RTMP_NET_TASK_STRUCT rx_done_task; RTMP_NET_TASK_STRUCT mgmt_dma_done_task; @@ -419,14 +419,14 @@ struct os_cookie { RTMP_NET_TASK_STRUCT tbtt_task; #ifdef RTMP_MAC_PCI RTMP_NET_TASK_STRUCT fifo_statistic_full_task; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB RTMP_NET_TASK_STRUCT null_frame_complete_task; RTMP_NET_TASK_STRUCT rts_frame_complete_task; RTMP_NET_TASK_STRUCT pspoll_frame_complete_task; -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ - unsigned long apd_pid; //802.1x daemon pid + unsigned long apd_pid; /*802.1x daemon pid */ INT ioctl_if_type; INT ioctl_if; }; @@ -501,12 +501,12 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, #define DEV_ALLOC_SKB(_length) \ dev_alloc_skb(_length) -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB #define PCI_MAP_SINGLE(_handle, _ptr, _size, _dir) (ULONG)0 #define PCI_UNMAP_SINGLE(_handle, _ptr, _size, _dir) -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ /* * ULONG @@ -545,7 +545,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, * Device Register I/O Access related definitions and data structures. **********************************************************************************/ #ifdef RTMP_MAC_PCI -//Patch for ASIC turst read/write bug, needs to remove after metel fix +/*Patch for ASIC turst read/write bug, needs to remove after metel fix */ #define RTMP_IO_READ32(_A, _R, _pV) \ { \ if ((_A)->bPCIclkOff == FALSE) \ @@ -603,7 +603,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ writeb((_V), (PUCHAR)((_A)->CSRBaseAddress + (_R))); \ } -#endif // #if defined(BRCM_6358) || defined(RALINK_2880) // +#endif /* #if defined(BRCM_6358) || defined(RALINK_2880) // */ #define RTMP_IO_WRITE16(_A, _R, _V) \ { \ @@ -611,9 +611,9 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ writew((_V), (PUSHORT)((_A)->CSRBaseAddress + (_R))); \ } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB -//Patch for ASIC turst read/write bug, needs to remove after metel fix +/*Patch for ASIC turst read/write bug, needs to remove after metel fix */ #define RTMP_IO_READ32(_A, _R, _pV) \ RTUSBReadMACRegister((_A), (_R), (PUINT32) (_pV)) @@ -634,7 +634,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, { \ RTUSBSingleWrite((_A), (_R), (USHORT) (_V)); \ } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ /*********************************************************************************** * Network Related data structure and marco definitions @@ -719,34 +719,34 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, #define CB_OFF 10 -// User Priority +/* User Priority */ #define RTMP_SET_PACKET_UP(_p, _prio) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+0] = _prio) #define RTMP_GET_PACKET_UP(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+0]) -// Fragment # +/* Fragment # */ #define RTMP_SET_PACKET_FRAGMENTS(_p, _num) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+1] = _num) #define RTMP_GET_PACKET_FRAGMENTS(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+1]) -// 0x0 ~0x7f: TX to AP's own BSS which has the specified AID. if AID>127, set bit 7 in RTMP_SET_PACKET_EMACTAB too. -//(this value also as MAC(on-chip WCID) table index) -// 0x80~0xff: TX to a WDS link. b0~6: WDS index +/* 0x0 ~0x7f: TX to AP's own BSS which has the specified AID. if AID>127, set bit 7 in RTMP_SET_PACKET_EMACTAB too. */ +/*(this value also as MAC(on-chip WCID) table index) */ +/* 0x80~0xff: TX to a WDS link. b0~6: WDS index */ #define RTMP_SET_PACKET_WCID(_p, _wdsidx) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+2] = _wdsidx) #define RTMP_GET_PACKET_WCID(_p) ((UCHAR)(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+2])) -// 0xff: PKTSRC_NDIS, others: local TX buffer index. This value affects how to a packet +/* 0xff: PKTSRC_NDIS, others: local TX buffer index. This value affects how to a packet */ #define RTMP_SET_PACKET_SOURCE(_p, _pktsrc) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+3] = _pktsrc) #define RTMP_GET_PACKET_SOURCE(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+3]) -// RTS/CTS-to-self protection method +/* RTS/CTS-to-self protection method */ #define RTMP_SET_PACKET_RTS(_p, _num) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+4] = _num) #define RTMP_GET_PACKET_RTS(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+4]) -// see RTMP_S(G)ET_PACKET_EMACTAB +/* see RTMP_S(G)ET_PACKET_EMACTAB */ -// TX rate index +/* TX rate index */ #define RTMP_SET_PACKET_TXRATE(_p, _rate) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+5] = _rate) #define RTMP_GET_PACKET_TXRATE(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+5]) -// From which Interface +/* From which Interface */ #define RTMP_SET_PACKET_IF(_p, _ifdx) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+6] = _ifdx) #define RTMP_GET_PACKET_IF(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+6]) #define RTMP_SET_PACKET_NET_DEVICE_MBSSID(_p, _bss) RTMP_SET_PACKET_IF((_p), (_bss)) @@ -759,9 +759,9 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, #define RTMP_SET_PACKET_MOREDATA(_p, _morebit) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+7] = _morebit) #define RTMP_GET_PACKET_MOREDATA(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+7]) -// -// Sepcific Pakcet Type definition -// +/* */ +/* Sepcific Pakcet Type definition */ +/* */ #define RTMP_PACKET_SPECIFIC_CB_OFFSET 11 #define RTMP_PACKET_SPECIFIC_DHCP 0x01 @@ -771,10 +771,10 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, #define RTMP_PACKET_SPECIFIC_VLAN 0x10 #define RTMP_PACKET_SPECIFIC_LLCSNAP 0x20 -//Specific +/*Specific */ #define RTMP_SET_PACKET_SPECIFIC(_p, _flg) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] = _flg) -//DHCP +/*DHCP */ #define RTMP_SET_PACKET_DHCP(_p, _flg) \ do{ \ if (_flg) \ @@ -784,7 +784,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, }while(0) #define RTMP_GET_PACKET_DHCP(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_DHCP) -//EAPOL +/*EAPOL */ #define RTMP_SET_PACKET_EAPOL(_p, _flg) \ do{ \ if (_flg) \ @@ -794,7 +794,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, }while(0) #define RTMP_GET_PACKET_EAPOL(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_EAPOL) -//WAI +/*WAI */ #define RTMP_SET_PACKET_WAI(_p, _flg) \ do{ \ if (_flg) \ @@ -806,7 +806,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, #define RTMP_GET_PACKET_LOWRATE(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & (RTMP_PACKET_SPECIFIC_EAPOL | RTMP_PACKET_SPECIFIC_DHCP | RTMP_PACKET_SPECIFIC_WAI)) -//VLAN +/*VLAN */ #define RTMP_SET_PACKET_VLAN(_p, _flg) \ do{ \ if (_flg) \ @@ -816,7 +816,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, }while(0) #define RTMP_GET_PACKET_VLAN(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_VLAN) -//LLC/SNAP +/*LLC/SNAP */ #define RTMP_SET_PACKET_LLCSNAP(_p, _flg) \ do{ \ if (_flg) \ @@ -827,7 +827,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, #define RTMP_GET_PACKET_LLCSNAP(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_LLCSNAP) -// IP +/* IP */ #define RTMP_SET_PACKET_IPV4(_p, _flg) \ do{ \ if (_flg) \ @@ -838,7 +838,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, #define RTMP_GET_PACKET_IPV4(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_IPV4) -// If this flag is set, it indicates that this EAPoL frame MUST be clear. +/* If this flag is set, it indicates that this EAPoL frame MUST be clear. */ #define RTMP_SET_PACKET_CLEAR_EAP_FRAME(_p, _flg) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+12] = _flg) #define RTMP_GET_PACKET_CLEAR_EAP_FRAME(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+12]) @@ -860,7 +860,7 @@ int rt28xx_packet_xmit(struct sk_buff *skb); #define IRQ_HANDLE_TYPE irqreturn_t IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ INT rt28xx_sta_ioctl(IN PNET_DEV net_dev, IN OUT struct ifreq *rq, IN INT cmd); @@ -869,4 +869,4 @@ extern int ra_mtd_read(int num, loff_t from, size_t len, u_char * buf); #define GET_PAD_FROM_NET_DEV(_pAd, _net_dev) (_pAd) = (PRTMP_ADAPTER)(_net_dev)->ml_priv; -#endif // __RT_LINUX_H__ // +#endif /* __RT_LINUX_H__ // */ diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h index f6b8f622af22..2ac9663657e5 100644 --- a/drivers/staging/rt2860/rtmp.h +++ b/drivers/staging/rt2860/rtmp.h @@ -49,14 +49,14 @@ typedef struct _RTMP_ADAPTER *PRTMP_ADAPTER; typedef struct _RTMP_CHIP_OP_ RTMP_CHIP_OP; -//#define DBG 1 +/*#define DBG 1 */ -//#define DBG_DIAGNOSE 1 +/*#define DBG_DIAGNOSE 1 */ -//+++Add by shiang for merge MiniportMMRequest() and MiniportDataMMRequest() into one function +/*+++Add by shiang for merge MiniportMMRequest() and MiniportDataMMRequest() into one function */ #define MAX_DATAMM_RETRY 3 #define MGMT_USE_QUEUE_FLAG 0x80 -//---Add by shiang for merge MiniportMMRequest() and MiniportDataMMRequest() into one function +/*---Add by shiang for merge MiniportMMRequest() and MiniportDataMMRequest() into one function */ #define MAXSEQ (0xFFF) @@ -79,7 +79,7 @@ extern UCHAR EAPOL_LLC_SNAP[8]; extern UCHAR EAPOL[2]; extern UCHAR IPX[2]; extern UCHAR APPLE_TALK[2]; -extern UCHAR RateIdToPlcpSignal[12]; // see IEEE802.11a-1999 p.14 +extern UCHAR RateIdToPlcpSignal[12]; /* see IEEE802.11a-1999 p.14 */ extern UCHAR OfdmRateToRxwiMCS[]; extern UCHAR OfdmSignalToRateId[16]; extern UCHAR default_cwmin[4]; @@ -147,9 +147,9 @@ extern UCHAR RateSwitchTable11N2SForABand[]; extern UCHAR PRE_N_HT_OUI[]; typedef struct _RSSI_SAMPLE { - CHAR LastRssi0; // last received RSSI - CHAR LastRssi1; // last received RSSI - CHAR LastRssi2; // last received RSSI + CHAR LastRssi0; /* last received RSSI */ + CHAR LastRssi1; /* last received RSSI */ + CHAR LastRssi2; /* last received RSSI */ CHAR AvgRssi0; CHAR AvgRssi1; CHAR AvgRssi2; @@ -158,14 +158,14 @@ typedef struct _RSSI_SAMPLE { SHORT AvgRssi2X8; } RSSI_SAMPLE; -// -// Queue structure and macros -// +/* */ +/* Queue structure and macros */ +/* */ typedef struct _QUEUE_ENTRY { struct _QUEUE_ENTRY *Next; } QUEUE_ENTRY, *PQUEUE_ENTRY; -// Queue structure +/* Queue structure */ typedef struct _QUEUE_HEADER { PQUEUE_ENTRY Head; PQUEUE_ENTRY Tail; @@ -224,15 +224,15 @@ typedef struct _QUEUE_HEADER { (QueueHeader)->Number++; \ } -// -// Macros for flag and ref count operations -// +/* */ +/* Macros for flag and ref count operations */ +/* */ #define RTMP_SET_FLAG(_M, _F) ((_M)->Flags |= (_F)) #define RTMP_CLEAR_FLAG(_M, _F) ((_M)->Flags &= ~(_F)) #define RTMP_CLEAR_FLAGS(_M) ((_M)->Flags = 0) #define RTMP_TEST_FLAG(_M, _F) (((_M)->Flags & (_F)) != 0) #define RTMP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F)) -// Macro for power save flag. +/* Macro for power save flag. */ #define RTMP_SET_PSFLAG(_M, _F) ((_M)->PSFlags |= (_F)) #define RTMP_CLEAR_PSFLAG(_M, _F) ((_M)->PSFlags &= ~(_F)) #define RTMP_CLEAR_PSFLAGS(_M) ((_M)->PSFlags = 0) @@ -266,7 +266,7 @@ typedef struct _QUEUE_HEADER { (_idx) = (_idx+1) % (_RingSize); \ } -// StaActive.SupportedHtPhy.MCSSet is copied from AP beacon. Don't need to update here. +/* StaActive.SupportedHtPhy.MCSSet is copied from AP beacon. Don't need to update here. */ #define COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(_pAd) \ { \ _pAd->StaActive.SupportedHtPhy.ChannelWidth = _pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth; \ @@ -290,25 +290,25 @@ typedef struct _QUEUE_HEADER { _pAd->MacTab.Content[BSSID_WCID].MaxRAmpduFactor = (UCHAR)(_pHtCapability->HtCapParm.MaxRAmpduFactor); \ } -// -// MACRO for 32-bit PCI register read / write -// -// Usage : RTMP_IO_READ32( -// PRTMP_ADAPTER pAd, -// ULONG Register_Offset, -// PULONG pValue) -// -// RTMP_IO_WRITE32( -// PRTMP_ADAPTER pAd, -// ULONG Register_Offset, -// ULONG Value) -// - -// -// Common fragment list structure - Identical to the scatter gather frag list structure -// -//#define RTMP_SCATTER_GATHER_ELEMENT SCATTER_GATHER_ELEMENT -//#define PRTMP_SCATTER_GATHER_ELEMENT PSCATTER_GATHER_ELEMENT +/* */ +/* MACRO for 32-bit PCI register read / write */ +/* */ +/* Usage : RTMP_IO_READ32( */ +/* PRTMP_ADAPTER pAd, */ +/* ULONG Register_Offset, */ +/* PULONG pValue) */ +/* */ +/* RTMP_IO_WRITE32( */ +/* PRTMP_ADAPTER pAd, */ +/* ULONG Register_Offset, */ +/* ULONG Value) */ +/* */ + +/* */ +/* Common fragment list structure - Identical to the scatter gather frag list structure */ +/* */ +/*#define RTMP_SCATTER_GATHER_ELEMENT SCATTER_GATHER_ELEMENT */ +/*#define PRTMP_SCATTER_GATHER_ELEMENT PSCATTER_GATHER_ELEMENT */ #define NIC_MAX_PHYS_BUF_COUNT 8 typedef struct _RTMP_SCATTER_GATHER_ELEMENT { @@ -323,9 +323,9 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { RTMP_SCATTER_GATHER_ELEMENT Elements[NIC_MAX_PHYS_BUF_COUNT]; } RTMP_SCATTER_GATHER_LIST, *PRTMP_SCATTER_GATHER_LIST; -// -// Some utility macros -// +/* */ +/* Some utility macros */ +/* */ #ifndef min #define min(_a, _b) (((_a) < (_b)) ? (_a) : (_b)) #endif @@ -343,11 +343,11 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { #define MONITOR_ON(_p) (((_p)->StaCfg.BssType) == BSS_MONITOR) #define IDLE_ON(_p) (!INFRA_ON(_p) && !ADHOC_ON(_p)) -// Check LEAP & CCKM flags +/* Check LEAP & CCKM flags */ #define LEAP_ON(_p) (((_p)->StaCfg.LeapAuthMode) == CISCO_AuthModeLEAP) #define LEAP_CCKM_ON(_p) ((((_p)->StaCfg.LeapAuthMode) == CISCO_AuthModeLEAP) && ((_p)->StaCfg.LeapAuthInfo.CCKM == TRUE)) -// if orginal Ethernet frame contains no LLC/SNAP, then an extra LLC/SNAP encap is required +/* if orginal Ethernet frame contains no LLC/SNAP, then an extra LLC/SNAP encap is required */ #define EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(_pBufVA, _pExtraLlcSnapEncap) \ { \ if (((*(_pBufVA + 12) << 8) + *(_pBufVA + 13)) > 1500) \ @@ -365,7 +365,7 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { } \ } -// New Define for new Tx Path. +/* New Define for new Tx Path. */ #define EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(_pBufVA, _pExtraLlcSnapEncap) \ { \ if (((*(_pBufVA) << 8) + *(_pBufVA + 1)) > 1500) \ @@ -390,13 +390,13 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { NdisMoveMemory((_p + MAC_ADDR_LEN * 2), _pType, LENGTH_802_3_TYPE); \ } -// if pData has no LLC/SNAP (neither RFC1042 nor Bridge tunnel), keep it that way. -// else if the received frame is LLC/SNAP-encaped IPX or APPLETALK, preserve the LLC/SNAP field -// else remove the LLC/SNAP field from the result Ethernet frame -// Patch for WHQL only, which did not turn on Netbios but use IPX within its payload -// Note: -// _pData & _DataSize may be altered (remove 8-byte LLC/SNAP) by this MACRO -// _pRemovedLLCSNAP: pointer to removed LLC/SNAP; NULL is not removed +/* if pData has no LLC/SNAP (neither RFC1042 nor Bridge tunnel), keep it that way. */ +/* else if the received frame is LLC/SNAP-encaped IPX or APPLETALK, preserve the LLC/SNAP field */ +/* else remove the LLC/SNAP field from the result Ethernet frame */ +/* Patch for WHQL only, which did not turn on Netbios but use IPX within its payload */ +/* Note: */ +/* _pData & _DataSize may be altered (remove 8-byte LLC/SNAP) by this MACRO */ +/* _pRemovedLLCSNAP: pointer to removed LLC/SNAP; NULL is not removed */ #define CONVERT_TO_802_3(_p8023hdr, _pDA, _pSA, _pData, _DataSize, _pRemovedLLCSNAP) \ { \ char LLC_Len[2]; \ @@ -430,9 +430,9 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { } \ } -// Enqueue this frame to MLME engine -// We need to enqueue the whole frame because MLME need to pass data type -// information from 802.11 header +/* Enqueue this frame to MLME engine */ +/* We need to enqueue the whole frame because MLME need to pass data type */ +/* information from 802.11 header */ #ifdef RTMP_MAC_PCI #define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \ { \ @@ -441,21 +441,21 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { RTMP_IO_READ32(_pAd, TSF_TIMER_DW0, &Low32TSF); \ MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (UCHAR)_Rssi0, (UCHAR)_Rssi1,(UCHAR)_Rssi2,_FrameSize, _pFrame, (UCHAR)_PlcpSignal); \ } -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB #define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \ { \ UINT32 High32TSF=0, Low32TSF=0; \ MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (UCHAR)_Rssi0, (UCHAR)_Rssi1,(UCHAR)_Rssi2,_FrameSize, _pFrame, (UCHAR)_PlcpSignal); \ } -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ #define MAC_ADDR_EQUAL(pAddr1,pAddr2) RTMPEqualMemory((PVOID)(pAddr1), (PVOID)(pAddr2), MAC_ADDR_LEN) #define SSID_EQUAL(ssid1, len1, ssid2, len2) ((len1==len2) && (RTMPEqualMemory(ssid1, ssid2, len1))) -// -// Check if it is Japan W53(ch52,56,60,64) channel. -// +/* */ +/* Check if it is Japan W53(ch52,56,60,64) channel. */ +/* */ #define JapanChannelCheck(channel) ((channel == 52) || (channel == 56) || (channel == 60) || (channel == 64)) #define STA_EXTRA_SETTING(_pAd) @@ -472,67 +472,67 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { STA_EXTRA_SETTING(_pAd); \ } -// -// Data buffer for DMA operation, the buffer must be contiguous physical memory -// Both DMA to / from CPU use the same structure. -// +/* */ +/* Data buffer for DMA operation, the buffer must be contiguous physical memory */ +/* Both DMA to / from CPU use the same structure. */ +/* */ typedef struct _RTMP_DMABUF { ULONG AllocSize; - PVOID AllocVa; // TxBuf virtual address - NDIS_PHYSICAL_ADDRESS AllocPa; // TxBuf physical address + PVOID AllocVa; /* TxBuf virtual address */ + NDIS_PHYSICAL_ADDRESS AllocPa; /* TxBuf physical address */ } RTMP_DMABUF, *PRTMP_DMABUF; -// -// Control block (Descriptor) for all ring descriptor DMA operation, buffer must be -// contiguous physical memory. NDIS_PACKET stored the binding Rx packet descriptor -// which won't be released, driver has to wait until upper layer return the packet -// before giveing up this rx ring descriptor to ASIC. NDIS_BUFFER is assocaited pair -// to describe the packet buffer. For Tx, NDIS_PACKET stored the tx packet descriptor -// which driver should ACK upper layer when the tx is physically done or failed. -// +/* */ +/* Control block (Descriptor) for all ring descriptor DMA operation, buffer must be */ +/* contiguous physical memory. NDIS_PACKET stored the binding Rx packet descriptor */ +/* which won't be released, driver has to wait until upper layer return the packet */ +/* before giveing up this rx ring descriptor to ASIC. NDIS_BUFFER is assocaited pair */ +/* to describe the packet buffer. For Tx, NDIS_PACKET stored the tx packet descriptor */ +/* which driver should ACK upper layer when the tx is physically done or failed. */ +/* */ typedef struct _RTMP_DMACB { - ULONG AllocSize; // Control block size - PVOID AllocVa; // Control block virtual address - NDIS_PHYSICAL_ADDRESS AllocPa; // Control block physical address + ULONG AllocSize; /* Control block size */ + PVOID AllocVa; /* Control block virtual address */ + NDIS_PHYSICAL_ADDRESS AllocPa; /* Control block physical address */ PNDIS_PACKET pNdisPacket; PNDIS_PACKET pNextNdisPacket; - RTMP_DMABUF DmaBuf; // Associated DMA buffer structure + RTMP_DMABUF DmaBuf; /* Associated DMA buffer structure */ } RTMP_DMACB, *PRTMP_DMACB; typedef struct _RTMP_TX_RING { RTMP_DMACB Cell[TX_RING_SIZE]; UINT32 TxCpuIdx; UINT32 TxDmaIdx; - UINT32 TxSwFreeIdx; // software next free tx index + UINT32 TxSwFreeIdx; /* software next free tx index */ } RTMP_TX_RING, *PRTMP_TX_RING; typedef struct _RTMP_RX_RING { RTMP_DMACB Cell[RX_RING_SIZE]; UINT32 RxCpuIdx; UINT32 RxDmaIdx; - INT32 RxSwReadIdx; // software next read index + INT32 RxSwReadIdx; /* software next read index */ } RTMP_RX_RING, *PRTMP_RX_RING; typedef struct _RTMP_MGMT_RING { RTMP_DMACB Cell[MGMT_RING_SIZE]; UINT32 TxCpuIdx; UINT32 TxDmaIdx; - UINT32 TxSwFreeIdx; // software next free tx index + UINT32 TxSwFreeIdx; /* software next free tx index */ } RTMP_MGMT_RING, *PRTMP_MGMT_RING; -// -// Statistic counter structure -// +/* */ +/* Statistic counter structure */ +/* */ typedef struct _COUNTER_802_3 { - // General Stats + /* General Stats */ ULONG GoodTransmits; ULONG GoodReceives; ULONG TxErrors; ULONG RxErrors; ULONG RxNoBuffer; - // Ethernet Stats + /* Ethernet Stats */ ULONG RcvAlignmentErrors; ULONG OneCollision; ULONG MoreCollisions; @@ -557,8 +557,8 @@ typedef struct _COUNTER_802_11 { } COUNTER_802_11, *PCOUNTER_802_11; typedef struct _COUNTER_RALINK { - ULONG TransmittedByteCount; // both successful and failure, used to calculate TX throughput - ULONG ReceivedByteCount; // both CRC okay and CRC error, used to calculate RX throughput + ULONG TransmittedByteCount; /* both successful and failure, used to calculate TX throughput */ + ULONG ReceivedByteCount; /* both CRC okay and CRC error, used to calculate RX throughput */ ULONG BeenDisassociatedCount; ULONG BadCQIAutoRecoveryCount; ULONG PoorCQIRoamingCount; @@ -580,17 +580,17 @@ typedef struct _COUNTER_RALINK { UINT32 OneSecReceivedByteCount; UINT32 OneSecFrameDuplicateCount; - UINT32 OneSecTransmittedByteCount; // both successful and failure, used to calculate TX throughput + UINT32 OneSecTransmittedByteCount; /* both successful and failure, used to calculate TX throughput */ UINT32 OneSecTxNoRetryOkCount; UINT32 OneSecTxRetryOkCount; UINT32 OneSecTxFailCount; - UINT32 OneSecFalseCCACnt; // CCA error count, for debug purpose, might move to global counter - UINT32 OneSecRxOkCnt; // RX without error - UINT32 OneSecRxOkDataCnt; // unicast-to-me DATA frame count - UINT32 OneSecRxFcsErrCnt; // CRC error + UINT32 OneSecFalseCCACnt; /* CCA error count, for debug purpose, might move to global counter */ + UINT32 OneSecRxOkCnt; /* RX without error */ + UINT32 OneSecRxOkDataCnt; /* unicast-to-me DATA frame count */ + UINT32 OneSecRxFcsErrCnt; /* CRC error */ UINT32 OneSecBeaconSentCnt; - UINT32 LastOneSecTotalTxCount; // OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount - UINT32 LastOneSecRxOkDataCnt; // OneSecRxOkDataCnt + UINT32 LastOneSecTotalTxCount; /* OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount */ + UINT32 LastOneSecRxOkDataCnt; /* OneSecRxOkDataCnt */ ULONG DuplicateRcv; ULONG TxAggCount; ULONG TxNonAggCount; @@ -622,15 +622,15 @@ typedef struct _COUNTER_RALINK { } COUNTER_RALINK, *PCOUNTER_RALINK; typedef struct _COUNTER_DRS { - // to record the each TX rate's quality. 0 is best, the bigger the worse. + /* to record the each TX rate's quality. 0 is best, the bigger the worse. */ USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH]; UCHAR PER[MAX_STEP_OF_TX_RATE_SWITCH]; - UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition - ULONG CurrTxRateStableTime; // # of second in current TX rate + UCHAR TxRateUpPenalty; /* extra # of second penalty due to last unstable condition */ + ULONG CurrTxRateStableTime; /* # of second in current TX rate */ BOOLEAN fNoisyEnvironment; BOOLEAN fLastSecAccordingRSSI; - UCHAR LastSecTxRateChangeAction; // 0: no change, 1:rate UP, 2:rate down - UCHAR LastTimeTxRateChangeAction; //Keep last time value of LastSecTxRateChangeAction + UCHAR LastSecTxRateChangeAction; /* 0: no change, 1:rate UP, 2:rate down */ + UCHAR LastTimeTxRateChangeAction; /*Keep last time value of LastSecTxRateChangeAction */ ULONG LastTxOkCount; } COUNTER_DRS, *PCOUNTER_DRS; @@ -638,22 +638,22 @@ typedef struct _COUNTER_DRS { * security key related data structure **************************************************************************/ typedef struct _CIPHER_KEY { - UCHAR Key[16]; // right now we implement 4 keys, 128 bits max - UCHAR RxMic[8]; // make alignment + UCHAR Key[16]; /* right now we implement 4 keys, 128 bits max */ + UCHAR RxMic[8]; /* make alignment */ UCHAR TxMic[8]; - UCHAR TxTsc[6]; // 48bit TSC value - UCHAR RxTsc[6]; // 48bit TSC value - UCHAR CipherAlg; // 0-none, 1:WEP64, 2:WEP128, 3:TKIP, 4:AES, 5:CKIP64, 6:CKIP128 + UCHAR TxTsc[6]; /* 48bit TSC value */ + UCHAR RxTsc[6]; /* 48bit TSC value */ + UCHAR CipherAlg; /* 0-none, 1:WEP64, 2:WEP128, 3:TKIP, 4:AES, 5:CKIP64, 6:CKIP128 */ UCHAR KeyLen; UCHAR BssId[6]; - // Key length for each key, 0: entry is invalid - UCHAR Type; // Indicate Pairwise/Group when reporting MIC error + /* Key length for each key, 0: entry is invalid */ + UCHAR Type; /* Indicate Pairwise/Group when reporting MIC error */ } CIPHER_KEY, *PCIPHER_KEY; -// structure to define WPA Group Key Rekey Interval +/* structure to define WPA Group Key Rekey Interval */ typedef struct PACKED _RT_802_11_WPA_REKEY { - ULONG ReKeyMethod; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based - ULONG ReKeyInterval; // time-based: seconds, packet-based: kilo-packets + ULONG ReKeyMethod; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */ + ULONG ReKeyInterval; /* time-based: seconds, packet-based: kilo-packets */ } RT_WPA_REKEY, *PRT_WPA_REKEY, RT_802_11_WPA_REKEY, *PRT_802_11_WPA_REKEY; #ifdef RTMP_MAC_USB @@ -661,26 +661,26 @@ typedef struct PACKED _RT_802_11_WPA_REKEY { * RTUSB I/O related data structure **************************************************************************/ typedef struct _RT_SET_ASIC_WCID { - ULONG WCID; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based - ULONG SetTid; // time-based: seconds, packet-based: kilo-packets - ULONG DeleteTid; // time-based: seconds, packet-based: kilo-packets - UCHAR Addr[MAC_ADDR_LEN]; // avoid in interrupt when write key + ULONG WCID; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */ + ULONG SetTid; /* time-based: seconds, packet-based: kilo-packets */ + ULONG DeleteTid; /* time-based: seconds, packet-based: kilo-packets */ + UCHAR Addr[MAC_ADDR_LEN]; /* avoid in interrupt when write key */ } RT_SET_ASIC_WCID, *PRT_SET_ASIC_WCID; typedef struct _RT_SET_ASIC_WCID_ATTRI { - ULONG WCID; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based - ULONG Cipher; // ASIC Cipher definition + ULONG WCID; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */ + ULONG Cipher; /* ASIC Cipher definition */ UCHAR Addr[ETH_LENGTH_OF_ADDRESS]; } RT_SET_ASIC_WCID_ATTRI, *PRT_SET_ASIC_WCID_ATTRI; -// for USB interface, avoid in interrupt when write key +/* for USB interface, avoid in interrupt when write key */ typedef struct RT_ADD_PAIRWISE_KEY_ENTRY { UCHAR MacAddr[6]; - USHORT MacTabMatchWCID; // ASIC + USHORT MacTabMatchWCID; /* ASIC */ CIPHER_KEY CipherKey; } RT_ADD_PAIRWISE_KEY_ENTRY, *PRT_ADD_PAIRWISE_KEY_ENTRY; -// Cipher suite type for mixed mode group cipher, P802.11i-2004 +/* Cipher suite type for mixed mode group cipher, P802.11i-2004 */ typedef enum _RT_802_11_CIPHER_SUITE_TYPE { Cipher_Type_NONE, Cipher_Type_WEP40, @@ -689,14 +689,14 @@ typedef enum _RT_802_11_CIPHER_SUITE_TYPE { Cipher_Type_CCMP, Cipher_Type_WEP104 } RT_802_11_CIPHER_SUITE_TYPE, *PRT_802_11_CIPHER_SUITE_TYPE; -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ typedef struct { UCHAR Addr[MAC_ADDR_LEN]; - UCHAR ErrorCode[2]; //00 01-Invalid authentication type - //00 02-Authentication timeout - //00 03-Challenge from AP failed - //00 04-Challenge to AP failed + UCHAR ErrorCode[2]; /*00 01-Invalid authentication type */ + /*00 02-Authentication timeout */ + /*00 03-Challenge from AP failed */ + /*00 04-Challenge to AP failed */ BOOLEAN Reported; } ROGUEAP_ENTRY, *PROGUEAP_ENTRY; @@ -705,23 +705,23 @@ typedef struct { ROGUEAP_ENTRY RogueApEntry[MAX_LEN_OF_BSS_TABLE]; } ROGUEAP_TABLE, *PROGUEAP_TABLE; -// -// Cisco IAPP format -// +/* */ +/* Cisco IAPP format */ +/* */ typedef struct _CISCO_IAPP_CONTENT_ { - USHORT Length; //IAPP Length - UCHAR MessageType; //IAPP type - UCHAR FunctionCode; //IAPP function type + USHORT Length; /*IAPP Length */ + UCHAR MessageType; /*IAPP type */ + UCHAR FunctionCode; /*IAPP function type */ UCHAR DestinaionMAC[MAC_ADDR_LEN]; UCHAR SourceMAC[MAC_ADDR_LEN]; - USHORT Tag; //Tag(element IE) - Adjacent AP report - USHORT TagLength; //Length of element not including 4 byte header - UCHAR OUI[4]; //0x00, 0x40, 0x96, 0x00 - UCHAR PreviousAP[MAC_ADDR_LEN]; //MAC Address of access point + USHORT Tag; /*Tag(element IE) - Adjacent AP report */ + USHORT TagLength; /*Length of element not including 4 byte header */ + UCHAR OUI[4]; /*0x00, 0x40, 0x96, 0x00 */ + UCHAR PreviousAP[MAC_ADDR_LEN]; /*MAC Address of access point */ USHORT Channel; USHORT SsidLen; UCHAR Ssid[MAX_LEN_OF_SSID]; - USHORT Seconds; //Seconds that the client has been disassociated. + USHORT Seconds; /*Seconds that the client has been disassociated. */ } CISCO_IAPP_CONTENT, *PCISCO_IAPP_CONTENT; /* @@ -732,55 +732,55 @@ typedef struct _FRAGMENT_FRAME { ULONG RxSize; USHORT Sequence; USHORT LastFrag; - ULONG Flags; // Some extra frame information. bit 0: LLC presented + ULONG Flags; /* Some extra frame information. bit 0: LLC presented */ } FRAGMENT_FRAME, *PFRAGMENT_FRAME; -// -// Packet information for NdisQueryPacket -// +/* */ +/* Packet information for NdisQueryPacket */ +/* */ typedef struct _PACKET_INFO { - UINT PhysicalBufferCount; // Physical breaks of buffer descripor chained - UINT BufferCount; // Number of Buffer descriptor chained - UINT TotalPacketLength; // Self explained - PNDIS_BUFFER pFirstBuffer; // Pointer to first buffer descriptor + UINT PhysicalBufferCount; /* Physical breaks of buffer descripor chained */ + UINT BufferCount; /* Number of Buffer descriptor chained */ + UINT TotalPacketLength; /* Self explained */ + PNDIS_BUFFER pFirstBuffer; /* Pointer to first buffer descriptor */ } PACKET_INFO, *PPACKET_INFO; -// -// Arcfour Structure Added by PaulWu -// +/* */ +/* Arcfour Structure Added by PaulWu */ +/* */ typedef struct _ARCFOUR { UINT X; UINT Y; UCHAR STATE[256]; } ARCFOURCONTEXT, *PARCFOURCONTEXT; -// -// Tkip Key structure which RC4 key & MIC calculation -// +/* */ +/* Tkip Key structure which RC4 key & MIC calculation */ +/* */ typedef struct _TKIP_KEY_INFO { - UINT nBytesInM; // # bytes in M for MICKEY + UINT nBytesInM; /* # bytes in M for MICKEY */ ULONG IV16; ULONG IV32; - ULONG K0; // for MICKEY Low - ULONG K1; // for MICKEY Hig - ULONG L; // Current state for MICKEY - ULONG R; // Current state for MICKEY - ULONG M; // Message accumulator for MICKEY + ULONG K0; /* for MICKEY Low */ + ULONG K1; /* for MICKEY Hig */ + ULONG L; /* Current state for MICKEY */ + ULONG R; /* Current state for MICKEY */ + ULONG M; /* Message accumulator for MICKEY */ UCHAR RC4KEY[16]; UCHAR MIC[8]; } TKIP_KEY_INFO, *PTKIP_KEY_INFO; -// -// Private / Misc data, counters for driver internal use -// +/* */ +/* Private / Misc data, counters for driver internal use */ +/* */ typedef struct __PRIVATE_STRUC { - UINT SystemResetCnt; // System reset counter - UINT TxRingFullCnt; // Tx ring full occurrance number - UINT PhyRxErrCnt; // PHY Rx error count, for debug purpose, might move to global counter - // Variables for WEP encryption / decryption in rtmp_wep.c + UINT SystemResetCnt; /* System reset counter */ + UINT TxRingFullCnt; /* Tx ring full occurrance number */ + UINT PhyRxErrCnt; /* PHY Rx error count, for debug purpose, might move to global counter */ + /* Variables for WEP encryption / decryption in rtmp_wep.c */ UINT FCSCRC32; ARCFOURCONTEXT WEPCONTEXT; - // Tkip stuff + /* Tkip stuff */ TKIP_KEY_INFO Tx; TKIP_KEY_INFO Rx; } PRIVATE_STRUC, *PPRIVATE_STRUC; @@ -788,19 +788,19 @@ typedef struct __PRIVATE_STRUC { /*************************************************************************** * Channel and BBP related data structures **************************************************************************/ -// structure to tune BBP R66 (BBP TUNING) +/* structure to tune BBP R66 (BBP TUNING) */ typedef struct _BBP_R66_TUNING { BOOLEAN bEnable; - USHORT FalseCcaLowerThreshold; // default 100 - USHORT FalseCcaUpperThreshold; // default 512 + USHORT FalseCcaLowerThreshold; /* default 100 */ + USHORT FalseCcaUpperThreshold; /* default 512 */ UCHAR R66Delta; UCHAR R66CurrentValue; - BOOLEAN R66LowerUpperSelect; //Before LinkUp, Used LowerBound or UpperBound as R66 value. + BOOLEAN R66LowerUpperSelect; /*Before LinkUp, Used LowerBound or UpperBound as R66 value. */ } BBP_R66_TUNING, *PBBP_R66_TUNING; -// structure to store channel TX power +/* structure to store channel TX power */ typedef struct _CHANNEL_TX_POWER { - USHORT RemainingTimeForUse; //unit: sec + USHORT RemainingTimeForUse; /*unit: sec */ UCHAR Channel; CHAR Power; CHAR Power2; @@ -808,26 +808,26 @@ typedef struct _CHANNEL_TX_POWER { UCHAR DfsReq; } CHANNEL_TX_POWER, *PCHANNEL_TX_POWER; -// structure to store 802.11j channel TX power +/* structure to store 802.11j channel TX power */ typedef struct _CHANNEL_11J_TX_POWER { UCHAR Channel; - UCHAR BW; // BW_10 or BW_20 + UCHAR BW; /* BW_10 or BW_20 */ CHAR Power; CHAR Power2; - USHORT RemainingTimeForUse; //unit: sec + USHORT RemainingTimeForUse; /*unit: sec */ } CHANNEL_11J_TX_POWER, *PCHANNEL_11J_TX_POWER; typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT { - UCHAR EvaluatePeriod; // 0:not evalute status, 1: evaluate status, 2: switching status + UCHAR EvaluatePeriod; /* 0:not evalute status, 1: evaluate status, 2: switching status */ UCHAR EvaluateStableCnt; - UCHAR Pair1PrimaryRxAnt; // 0:Ant-E1, 1:Ant-E2 - UCHAR Pair1SecondaryRxAnt; // 0:Ant-E1, 1:Ant-E2 - UCHAR Pair2PrimaryRxAnt; // 0:Ant-E3, 1:Ant-E4 - UCHAR Pair2SecondaryRxAnt; // 0:Ant-E3, 1:Ant-E4 - SHORT Pair1AvgRssi[2]; // AvgRssi[0]:E1, AvgRssi[1]:E2 - SHORT Pair2AvgRssi[2]; // AvgRssi[0]:E3, AvgRssi[1]:E4 - SHORT Pair1LastAvgRssi; // - SHORT Pair2LastAvgRssi; // + UCHAR Pair1PrimaryRxAnt; /* 0:Ant-E1, 1:Ant-E2 */ + UCHAR Pair1SecondaryRxAnt; /* 0:Ant-E1, 1:Ant-E2 */ + UCHAR Pair2PrimaryRxAnt; /* 0:Ant-E3, 1:Ant-E4 */ + UCHAR Pair2SecondaryRxAnt; /* 0:Ant-E3, 1:Ant-E4 */ + SHORT Pair1AvgRssi[2]; /* AvgRssi[0]:E1, AvgRssi[1]:E2 */ + SHORT Pair2AvgRssi[2]; /* AvgRssi[0]:E3, AvgRssi[1]:E4 */ + SHORT Pair1LastAvgRssi; /* */ + SHORT Pair2LastAvgRssi; /* */ ULONG RcvPktNumWhenEvaluate; BOOLEAN FirstPktArrivedWhenEvaluate; RALINK_TIMER_STRUCT RxAntDiversityTimer; @@ -837,19 +837,19 @@ typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT { * structure for radar detection and channel switch **************************************************************************/ typedef struct _RADAR_DETECT_STRUCT { - //BOOLEAN IEEE80211H; // 0: disable, 1: enable IEEE802.11h - UCHAR CSCount; //Channel switch counter - UCHAR CSPeriod; //Channel switch period (beacon count) - UCHAR RDCount; //Radar detection counter - UCHAR RDMode; //Radar Detection mode - UCHAR RDDurRegion; //Radar detection duration region + /*BOOLEAN IEEE80211H; // 0: disable, 1: enable IEEE802.11h */ + UCHAR CSCount; /*Channel switch counter */ + UCHAR CSPeriod; /*Channel switch period (beacon count) */ + UCHAR RDCount; /*Radar detection counter */ + UCHAR RDMode; /*Radar Detection mode */ + UCHAR RDDurRegion; /*Radar detection duration region */ UCHAR BBPR16; UCHAR BBPR17; UCHAR BBPR18; UCHAR BBPR21; UCHAR BBPR22; UCHAR BBPR64; - ULONG InServiceMonitorCount; // unit: sec + ULONG InServiceMonitorCount; /* unit: sec */ UINT8 DfsSessionTime; BOOLEAN bFastDfs; UINT8 ChMovingTime; @@ -863,25 +863,25 @@ typedef enum _ABGBAND_STATE_ { } ABGBAND_STATE; #ifdef RTMP_MAC_PCI -// Power save method control +/* Power save method control */ typedef union _PS_CONTROL { struct { - ULONG EnablePSinIdle:1; // Enable radio off when not connect to AP. radio on only when sitesurvey, - ULONG EnableNewPS:1; // Enable new Chip power save fucntion . New method can only be applied in chip version after 2872. and PCIe. - ULONG rt30xxPowerMode:2; // Power Level Mode for rt30xx chip - ULONG rt30xxFollowHostASPM:1; // Card Follows Host's setting for rt30xx chip. - ULONG rt30xxForceASPMTest:1; // Force enable L1 for rt30xx chip. This has higher priority than rt30xxFollowHostASPM Mode. - ULONG rsv:26; // Radio Measurement Enable + ULONG EnablePSinIdle:1; /* Enable radio off when not connect to AP. radio on only when sitesurvey, */ + ULONG EnableNewPS:1; /* Enable new Chip power save fucntion . New method can only be applied in chip version after 2872. and PCIe. */ + ULONG rt30xxPowerMode:2; /* Power Level Mode for rt30xx chip */ + ULONG rt30xxFollowHostASPM:1; /* Card Follows Host's setting for rt30xx chip. */ + ULONG rt30xxForceASPMTest:1; /* Force enable L1 for rt30xx chip. This has higher priority than rt30xxFollowHostASPM Mode. */ + ULONG rsv:26; /* Radio Measurement Enable */ } field; ULONG word; } PS_CONTROL, *PPS_CONTROL; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ /*************************************************************************** * structure for MLME state machine **************************************************************************/ typedef struct _MLME_STRUCT { - // STA state machines + /* STA state machines */ STATE_MACHINE CntlMachine; STATE_MACHINE AssocMachine; STATE_MACHINE AuthMachine; @@ -894,15 +894,15 @@ typedef struct _MLME_STRUCT { STATE_MACHINE_FUNC AuthRspFunc[AUTH_RSP_FUNC_SIZE]; STATE_MACHINE_FUNC SyncFunc[SYNC_FUNC_SIZE]; STATE_MACHINE_FUNC ActFunc[ACT_FUNC_SIZE]; - // Action + /* Action */ STATE_MACHINE ActMachine; - // common WPA state machine + /* common WPA state machine */ STATE_MACHINE WpaMachine; STATE_MACHINE_FUNC WpaFunc[WPA_FUNC_SIZE]; - ULONG ChannelQuality; // 0..100, Channel Quality Indication for Roaming - ULONG Now32; // latch the value of NdisGetSystemUpTime() + ULONG ChannelQuality; /* 0..100, Channel Quality Indication for Roaming */ + ULONG Now32; /* latch the value of NdisGetSystemUpTime() */ ULONG LastSendNULLpsmTime; BOOLEAN bRunning; @@ -919,7 +919,7 @@ typedef struct _MLME_STRUCT { UCHAR bPsPollTimerRunning; RALINK_TIMER_STRUCT PsPollTimer; RALINK_TIMER_STRUCT RadioOnOffTimer; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ ULONG PeriodicRound; ULONG OneSecPeriodicRound; @@ -931,12 +931,12 @@ typedef struct _MLME_STRUCT { #ifdef RT30xx UCHAR CaliBW40RfR24; UCHAR CaliBW20RfR24; -#endif // RT30xx // +#endif /* RT30xx // */ #ifdef RTMP_MAC_USB RALINK_TIMER_STRUCT AutoWakeupTimer; BOOLEAN AutoWakeupTimerRunning; -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ } MLME_STRUCT, *PMLME_STRUCT; /*************************************************************************** @@ -979,7 +979,7 @@ typedef struct _BA_ORI_ENTRY { UCHAR TID; UCHAR BAWinSize; UCHAR Token; -// Sequence is to fill every outgoing QoS DATA frame's sequence field in 802.11 header. +/* Sequence is to fill every outgoing QoS DATA frame's sequence field in 802.11 header. */ USHORT Sequence; USHORT TimeOutValue; ORI_BLOCKACK_STATUS ORI_BA_Status; @@ -990,47 +990,47 @@ typedef struct _BA_ORI_ENTRY { typedef struct _BA_REC_ENTRY { UCHAR Wcid; UCHAR TID; - UCHAR BAWinSize; // 7.3.1.14. each buffer is capable of holding a max AMSDU or MSDU. - //UCHAR NumOfRxPkt; - //UCHAR Curindidx; // the head in the RX reordering buffer + UCHAR BAWinSize; /* 7.3.1.14. each buffer is capable of holding a max AMSDU or MSDU. */ + /*UCHAR NumOfRxPkt; */ + /*UCHAR Curindidx; // the head in the RX reordering buffer */ USHORT LastIndSeq; -// USHORT LastIndSeqAtTimer; +/* USHORT LastIndSeqAtTimer; */ USHORT TimeOutValue; RALINK_TIMER_STRUCT RECBATimer; ULONG LastIndSeqAtTimer; ULONG nDropPacket; ULONG rcvSeq; REC_BLOCKACK_STATUS REC_BA_Status; -// UCHAR RxBufIdxUsed; - // corresponding virtual address for RX reordering packet storage. - //RTMP_REORDERDMABUF MAP_RXBuf[MAX_RX_REORDERBUF]; - NDIS_SPIN_LOCK RxReRingLock; // Rx Ring spinlock -// struct _BA_REC_ENTRY *pNext; +/* UCHAR RxBufIdxUsed; */ + /* corresponding virtual address for RX reordering packet storage. */ + /*RTMP_REORDERDMABUF MAP_RXBuf[MAX_RX_REORDERBUF]; */ + NDIS_SPIN_LOCK RxReRingLock; /* Rx Ring spinlock */ +/* struct _BA_REC_ENTRY *pNext; */ PVOID pAdapter; struct reordering_list list; } BA_REC_ENTRY, *PBA_REC_ENTRY; typedef struct { - ULONG numAsRecipient; // I am recipient of numAsRecipient clients. These client are in the BARecEntry[] - ULONG numAsOriginator; // I am originator of numAsOriginator clients. These clients are in the BAOriEntry[] - ULONG numDoneOriginator; // count Done Originator sessions + ULONG numAsRecipient; /* I am recipient of numAsRecipient clients. These client are in the BARecEntry[] */ + ULONG numAsOriginator; /* I am originator of numAsOriginator clients. These clients are in the BAOriEntry[] */ + ULONG numDoneOriginator; /* count Done Originator sessions */ BA_ORI_ENTRY BAOriEntry[MAX_LEN_OF_BA_ORI_TABLE]; BA_REC_ENTRY BARecEntry[MAX_LEN_OF_BA_REC_TABLE]; } BA_TABLE, *PBA_TABLE; -//For QureyBATableOID use; +/*For QureyBATableOID use; */ typedef struct PACKED _OID_BA_REC_ENTRY { UCHAR MACAddr[MAC_ADDR_LEN]; - UCHAR BaBitmap; // if (BaBitmap&(1<HTPhyMode.field.MODE >= MODE_HTMIX) -//This structure is for all 802.11n card InterOptibilityTest action. Reset all Num every n second. (Details see MLMEPeriodic) +/*This structure is for all 802.11n card InterOptibilityTest action. Reset all Num every n second. (Details see MLMEPeriodic) */ typedef struct _IOT_STRUC { UCHAR Threshold[2]; - UCHAR ReorderTimeOutNum[MAX_LEN_OF_BA_REC_TABLE]; // compare with threshold[0] - UCHAR RefreshNum[MAX_LEN_OF_BA_REC_TABLE]; // compare with threshold[1] + UCHAR ReorderTimeOutNum[MAX_LEN_OF_BA_REC_TABLE]; /* compare with threshold[0] */ + UCHAR RefreshNum[MAX_LEN_OF_BA_REC_TABLE]; /* compare with threshold[1] */ ULONG OneSecInWindowCount; ULONG OneSecFrameDuplicateCount; ULONG OneSecOutWindowCount; @@ -1098,16 +1098,16 @@ typedef struct _IOT_STRUC { BOOLEAN bToggle; } IOT_STRUC, *PIOT_STRUC; -// This is the registry setting for 802.11n transmit setting. Used in advanced page. +/* This is the registry setting for 802.11n transmit setting. Used in advanced page. */ typedef union _REG_TRANSMIT_SETTING { struct { - //UINT32 PhyMode:4; - //UINT32 MCS:7; // MCS + /*UINT32 PhyMode:4; */ + /*UINT32 MCS:7; // MCS */ UINT32 rsv0:10; UINT32 TxBF:1; - UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz + UINT32 BW:1; /*channel bandwidth 20MHz or 40 MHz */ UINT32 ShortGI:1; - UINT32 STBC:1; //SPACE + UINT32 STBC:1; /*SPACE */ UINT32 TRANSNO:2; UINT32 HTMODE:1; UINT32 EXTCHA:2; @@ -1118,9 +1118,9 @@ typedef union _REG_TRANSMIT_SETTING { typedef union _DESIRED_TRANSMIT_SETTING { struct { - USHORT MCS:7; // MCS + USHORT MCS:7; /* MCS */ USHORT PhyMode:4; - USHORT FixedTxMode:2; // If MCS isn't AUTO, fix rate in CCK, OFDM or HT mode. + USHORT FixedTxMode:2; /* If MCS isn't AUTO, fix rate in CCK, OFDM or HT mode. */ USHORT rsv:3; } field; USHORT word; @@ -1136,11 +1136,11 @@ typedef struct _BEACON_SYNC_STRUCT_ { UCHAR BeaconTxWI[HW_BEACON_MAX_COUNT][TXWI_SIZE]; ULONG TimIELocationInBeacon[HW_BEACON_MAX_COUNT]; ULONG CapabilityInfoLocationInBeacon[HW_BEACON_MAX_COUNT]; - BOOLEAN EnableBeacon; // trigger to enable beacon transmission. - UCHAR BeaconBitMap; // NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change. - UCHAR DtimBitOn; // NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change. + BOOLEAN EnableBeacon; /* trigger to enable beacon transmission. */ + UCHAR BeaconBitMap; /* NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change. */ + UCHAR DtimBitOn; /* NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change. */ } BEACON_SYNC_STRUCT; -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ /*************************************************************************** * Multiple SSID related data structures @@ -1168,39 +1168,39 @@ typedef struct _BEACON_SYNC_STRUCT_ { UCHAR bit_offset = wcid & 0x7; \ ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] |= BIT8[bit_offset]; } -// configuration common to OPMODE_AP as well as OPMODE_STA +/* configuration common to OPMODE_AP as well as OPMODE_STA */ typedef struct _COMMON_CONFIG { BOOLEAN bCountryFlag; UCHAR CountryCode[3]; UCHAR Geography; - UCHAR CountryRegion; // Enum of country region, 0:FCC, 1:IC, 2:ETSI, 3:SPAIN, 4:France, 5:MKK, 6:MKK1, 7:Israel - UCHAR CountryRegionForABand; // Enum of country region for A band - UCHAR PhyMode; // PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED - USHORT Dsifs; // in units of usec - ULONG PacketFilter; // Packet filter for receiving + UCHAR CountryRegion; /* Enum of country region, 0:FCC, 1:IC, 2:ETSI, 3:SPAIN, 4:France, 5:MKK, 6:MKK1, 7:Israel */ + UCHAR CountryRegionForABand; /* Enum of country region for A band */ + UCHAR PhyMode; /* PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED */ + USHORT Dsifs; /* in units of usec */ + ULONG PacketFilter; /* Packet filter for receiving */ UINT8 RegulatoryClass; - CHAR Ssid[MAX_LEN_OF_SSID]; // NOT NULL-terminated - UCHAR SsidLen; // the actual ssid length in used - UCHAR LastSsidLen; // the actual ssid length in used - CHAR LastSsid[MAX_LEN_OF_SSID]; // NOT NULL-terminated + CHAR Ssid[MAX_LEN_OF_SSID]; /* NOT NULL-terminated */ + UCHAR SsidLen; /* the actual ssid length in used */ + UCHAR LastSsidLen; /* the actual ssid length in used */ + CHAR LastSsid[MAX_LEN_OF_SSID]; /* NOT NULL-terminated */ UCHAR LastBssid[MAC_ADDR_LEN]; UCHAR Bssid[MAC_ADDR_LEN]; USHORT BeaconPeriod; UCHAR Channel; - UCHAR CentralChannel; // Central Channel when using 40MHz is indicating. not real channel. + UCHAR CentralChannel; /* Central Channel when using 40MHz is indicating. not real channel. */ UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; UCHAR SupRateLen; UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; UCHAR ExtRateLen; - UCHAR DesireRate[MAX_LEN_OF_SUPPORTED_RATES]; // OID_802_11_DESIRED_RATES + UCHAR DesireRate[MAX_LEN_OF_SUPPORTED_RATES]; /* OID_802_11_DESIRED_RATES */ UCHAR MaxDesiredRate; UCHAR ExpectedACKRate[MAX_LEN_OF_SUPPORTED_RATES]; - ULONG BasicRateBitmap; // backup basic ratebitmap + ULONG BasicRateBitmap; /* backup basic ratebitmap */ BOOLEAN bAPSDCapable; BOOLEAN bInServicePeriod; @@ -1216,83 +1216,83 @@ typedef struct _COMMON_CONFIG { BOOLEAN bACMAPSDTr[4]; /* no use */ BOOLEAN bNeedSendTriggerFrame; - BOOLEAN bAPSDForcePowerSave; // Force power save mode, should only use in APSD-STAUT + BOOLEAN bAPSDForcePowerSave; /* Force power save mode, should only use in APSD-STAUT */ ULONG TriggerTimerCount; UCHAR MaxSPLength; - UCHAR BBPCurrentBW; // BW_10, BW_20, BW_40 - // move to MULTISSID_STRUCT for MBSS - //HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI. - REG_TRANSMIT_SETTING RegTransmitSetting; //registry transmit setting. this is for reading registry setting only. not useful. - //UCHAR FixedTxMode; // Fixed Tx Mode (CCK, OFDM), for HT fixed tx mode (GF, MIX) , refer to RegTransmitSetting.field.HTMode - UCHAR TxRate; // Same value to fill in TXD. TxRate is 6-bit - UCHAR MaxTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11 - UCHAR TxRateIndex; // Tx rate index in RateSwitchTable - UCHAR TxRateTableSize; // Valid Tx rate table size in RateSwitchTable - //BOOLEAN bAutoTxRateSwitch; - UCHAR MinTxRate; // RATE_1, RATE_2, RATE_5_5, RATE_11 - UCHAR RtsRate; // RATE_xxx - HTTRANSMIT_SETTING MlmeTransmit; // MGMT frame PHY rate setting when operatin at Ht rate. - UCHAR MlmeRate; // RATE_xxx, used to send MLME frames - UCHAR BasicMlmeRate; // Default Rate for sending MLME frames - - USHORT RtsThreshold; // in unit of BYTE - USHORT FragmentThreshold; // in unit of BYTE - - UCHAR TxPower; // in unit of mW - ULONG TxPowerPercentage; // 0~100 % - ULONG TxPowerDefault; // keep for TxPowerPercentage + UCHAR BBPCurrentBW; /* BW_10, BW_20, BW_40 */ + /* move to MULTISSID_STRUCT for MBSS */ + /*HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI. */ + REG_TRANSMIT_SETTING RegTransmitSetting; /*registry transmit setting. this is for reading registry setting only. not useful. */ + /*UCHAR FixedTxMode; // Fixed Tx Mode (CCK, OFDM), for HT fixed tx mode (GF, MIX) , refer to RegTransmitSetting.field.HTMode */ + UCHAR TxRate; /* Same value to fill in TXD. TxRate is 6-bit */ + UCHAR MaxTxRate; /* RATE_1, RATE_2, RATE_5_5, RATE_11 */ + UCHAR TxRateIndex; /* Tx rate index in RateSwitchTable */ + UCHAR TxRateTableSize; /* Valid Tx rate table size in RateSwitchTable */ + /*BOOLEAN bAutoTxRateSwitch; */ + UCHAR MinTxRate; /* RATE_1, RATE_2, RATE_5_5, RATE_11 */ + UCHAR RtsRate; /* RATE_xxx */ + HTTRANSMIT_SETTING MlmeTransmit; /* MGMT frame PHY rate setting when operatin at Ht rate. */ + UCHAR MlmeRate; /* RATE_xxx, used to send MLME frames */ + UCHAR BasicMlmeRate; /* Default Rate for sending MLME frames */ + + USHORT RtsThreshold; /* in unit of BYTE */ + USHORT FragmentThreshold; /* in unit of BYTE */ + + UCHAR TxPower; /* in unit of mW */ + ULONG TxPowerPercentage; /* 0~100 % */ + ULONG TxPowerDefault; /* keep for TxPowerPercentage */ UINT8 PwrConstraint; - BACAP_STRUC BACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 - BACAP_STRUC REGBACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 + BACAP_STRUC BACapability; /* NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 */ + BACAP_STRUC REGBACapability; /* NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 */ - IOT_STRUC IOTestParm; // 802.11n InterOpbility Test Parameter; - ULONG TxPreamble; // Rt802_11PreambleLong, Rt802_11PreambleShort, Rt802_11PreambleAuto - BOOLEAN bUseZeroToDisableFragment; // Microsoft use 0 as disable - ULONG UseBGProtection; // 0: auto, 1: always use, 2: always not use - BOOLEAN bUseShortSlotTime; // 0: disable, 1 - use short slot (9us) - BOOLEAN bEnableTxBurst; // 1: enble TX PACKET BURST (when BA is established or AP is not a legacy WMM AP), 0: disable TX PACKET BURST - BOOLEAN bAggregationCapable; // 1: enable TX aggregation when the peer supports it - BOOLEAN bPiggyBackCapable; // 1: enable TX piggy-back according MAC's version - BOOLEAN bIEEE80211H; // 1: enable IEEE802.11h spec. - ULONG DisableOLBCDetect; // 0: enable OLBC detect; 1 disable OLBC detect + IOT_STRUC IOTestParm; /* 802.11n InterOpbility Test Parameter; */ + ULONG TxPreamble; /* Rt802_11PreambleLong, Rt802_11PreambleShort, Rt802_11PreambleAuto */ + BOOLEAN bUseZeroToDisableFragment; /* Microsoft use 0 as disable */ + ULONG UseBGProtection; /* 0: auto, 1: always use, 2: always not use */ + BOOLEAN bUseShortSlotTime; /* 0: disable, 1 - use short slot (9us) */ + BOOLEAN bEnableTxBurst; /* 1: enble TX PACKET BURST (when BA is established or AP is not a legacy WMM AP), 0: disable TX PACKET BURST */ + BOOLEAN bAggregationCapable; /* 1: enable TX aggregation when the peer supports it */ + BOOLEAN bPiggyBackCapable; /* 1: enable TX piggy-back according MAC's version */ + BOOLEAN bIEEE80211H; /* 1: enable IEEE802.11h spec. */ + ULONG DisableOLBCDetect; /* 0: enable OLBC detect; 1 disable OLBC detect */ BOOLEAN bRdg; - BOOLEAN bWmmCapable; // 0:disable WMM, 1:enable WMM - QOS_CAPABILITY_PARM APQosCapability; // QOS capability of the current associated AP - EDCA_PARM APEdcaParm; // EDCA parameters of the current associated AP - QBSS_LOAD_PARM APQbssLoad; // QBSS load of the current associated AP - UCHAR AckPolicy[4]; // ACK policy of the specified AC. see ACK_xxx - BOOLEAN bDLSCapable; // 0:disable DLS, 1:enable DLS - // a bitmap of BOOLEAN flags. each bit represent an operation status of a particular - // BOOLEAN control, either ON or OFF. These flags should always be accessed via - // OPSTATUS_TEST_FLAG(), OPSTATUS_SET_FLAG(), OP_STATUS_CLEAR_FLAG() macros. - // see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition + BOOLEAN bWmmCapable; /* 0:disable WMM, 1:enable WMM */ + QOS_CAPABILITY_PARM APQosCapability; /* QOS capability of the current associated AP */ + EDCA_PARM APEdcaParm; /* EDCA parameters of the current associated AP */ + QBSS_LOAD_PARM APQbssLoad; /* QBSS load of the current associated AP */ + UCHAR AckPolicy[4]; /* ACK policy of the specified AC. see ACK_xxx */ + BOOLEAN bDLSCapable; /* 0:disable DLS, 1:enable DLS */ + /* a bitmap of BOOLEAN flags. each bit represent an operation status of a particular */ + /* BOOLEAN control, either ON or OFF. These flags should always be accessed via */ + /* OPSTATUS_TEST_FLAG(), OPSTATUS_SET_FLAG(), OP_STATUS_CLEAR_FLAG() macros. */ + /* see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition */ ULONG OpStatusFlags; - BOOLEAN NdisRadioStateOff; //For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff. - ABGBAND_STATE BandState; // For setting BBP used on B/G or A mode. + BOOLEAN NdisRadioStateOff; /*For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff. */ + ABGBAND_STATE BandState; /* For setting BBP used on B/G or A mode. */ - // IEEE802.11H--DFS. + /* IEEE802.11H--DFS. */ RADAR_DETECT_STRUCT RadarDetect; - // HT - UCHAR BASize; // USer desired BAWindowSize. Should not exceed our max capability - //RT_HT_CAPABILITY SupportedHtPhy; + /* HT */ + UCHAR BASize; /* USer desired BAWindowSize. Should not exceed our max capability */ + /*RT_HT_CAPABILITY SupportedHtPhy; */ RT_HT_CAPABILITY DesiredHtPhy; HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHTInfo; // Useful as AP. - //This IE is used with channel switch announcement element when changing to a new 40MHz. - //This IE is included in channel switch ammouncement frames 7.4.1.5, beacons, probe Rsp. - NEW_EXT_CHAN_IE NewExtChanOffset; //7.3.2.20A, 1 if extension channel is above the control channel, 3 if below, 0 if not present + ADD_HT_INFO_IE AddHTInfo; /* Useful as AP. */ + /*This IE is used with channel switch announcement element when changing to a new 40MHz. */ + /*This IE is included in channel switch ammouncement frames 7.4.1.5, beacons, probe Rsp. */ + NEW_EXT_CHAN_IE NewExtChanOffset; /*7.3.2.20A, 1 if extension channel is above the control channel, 3 if below, 0 if not present */ BOOLEAN bHTProtect; BOOLEAN bMIMOPSEnable; BOOLEAN bBADecline; -//2008/11/05: KH add to support Antenna power-saving of AP<-- +/*2008/11/05: KH add to support Antenna power-saving of AP<-- */ BOOLEAN bGreenAPEnable; -//2008/11/05: KH add to support Antenna power-saving of AP--> +/*2008/11/05: KH add to support Antenna power-saving of AP--> */ BOOLEAN bDisableReordering; BOOLEAN bForty_Mhz_Intolerant; BOOLEAN bExtChannelSwitchAnnouncement; @@ -1301,19 +1301,19 @@ typedef struct _COMMON_CONFIG { UCHAR TxBASize; - // Enable wireless event + /* Enable wireless event */ BOOLEAN bWirelessEvent; - BOOLEAN bWiFiTest; // Enable this parameter for WiFi test + BOOLEAN bWiFiTest; /* Enable this parameter for WiFi test */ - // Tx & Rx Stream number selection + /* Tx & Rx Stream number selection */ UCHAR TxStream; UCHAR RxStream; - BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled + BOOLEAN bHardwareRadio; /* Hardware controlled Radio enabled */ #ifdef RTMP_MAC_USB - BOOLEAN bMultipleIRP; // Multiple Bulk IN flag - UCHAR NumOfBulkInIRP; // if bMultipleIRP == TRUE, NumOfBulkInIRP will be 4 otherwise be 1 + BOOLEAN bMultipleIRP; /* Multiple Bulk IN flag */ + UCHAR NumOfBulkInIRP; /* if bMultipleIRP == TRUE, NumOfBulkInIRP will be 4 otherwise be 1 */ RT_HT_CAPABILITY SupportedHtPhy; ULONG MaxPktOneTxBulk; UCHAR TxBulkFactor; @@ -1325,7 +1325,7 @@ typedef struct _COMMON_CONFIG { UINT32 BeaconAdjust; UINT32 BeaconFactor; UINT32 BeaconRemain; -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ NDIS_SPIN_LOCK MeasureReqTabLock; PMEASURE_REQ_TAB pMeasureReqTab; @@ -1333,10 +1333,10 @@ typedef struct _COMMON_CONFIG { NDIS_SPIN_LOCK TpcReqTabLock; PTPC_REQ_TAB pTpcReqTab; - BOOLEAN PSPXlink; // 0: Disable. 1: Enable + BOOLEAN PSPXlink; /* 0: Disable. 1: Enable */ #if defined(RT305x)||defined(RT30xx) - // request by Gary, for High Power issue + /* request by Gary, for High Power issue */ UCHAR HighPowerPatchDisabled; #endif @@ -1344,33 +1344,33 @@ typedef struct _COMMON_CONFIG { } COMMON_CONFIG, *PCOMMON_CONFIG; /* Modified by Wu Xi-Kun 4/21/2006 */ -// STA configuration and status +/* STA configuration and status */ typedef struct _STA_ADMIN_CONFIG { - // GROUP 1 - - // User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe - // the user intended configuration, but not necessary fully equal to the final - // settings in ACTIVE BSS after negotiation/compromize with the BSS holder (either - // AP or IBSS holder). - // Once initialized, user configuration can only be changed via OID_xxx - UCHAR BssType; // BSS_INFRA or BSS_ADHOC - USHORT AtimWin; // used when starting a new IBSS - - // GROUP 2 - - // User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe - // the user intended configuration, and should be always applied to the final - // settings in ACTIVE BSS without compromising with the BSS holder. - // Once initialized, user configuration can only be changed via OID_xxx + /* GROUP 1 - */ + /* User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe */ + /* the user intended configuration, but not necessary fully equal to the final */ + /* settings in ACTIVE BSS after negotiation/compromize with the BSS holder (either */ + /* AP or IBSS holder). */ + /* Once initialized, user configuration can only be changed via OID_xxx */ + UCHAR BssType; /* BSS_INFRA or BSS_ADHOC */ + USHORT AtimWin; /* used when starting a new IBSS */ + + /* GROUP 2 - */ + /* User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe */ + /* the user intended configuration, and should be always applied to the final */ + /* settings in ACTIVE BSS without compromising with the BSS holder. */ + /* Once initialized, user configuration can only be changed via OID_xxx */ UCHAR RssiTrigger; - UCHAR RssiTriggerMode; // RSSI_TRIGGERED_UPON_BELOW_THRESHOLD or RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD - USHORT DefaultListenCount; // default listen count; - ULONG WindowsPowerMode; // Power mode for AC power - ULONG WindowsBatteryPowerMode; // Power mode for battery if exists - BOOLEAN bWindowsACCAMEnable; // Enable CAM power mode when AC on - BOOLEAN bAutoReconnect; // Set to TRUE when setting OID_802_11_SSID with no matching BSSID - ULONG WindowsPowerProfile; // Windows power profile, for NDIS5.1 PnP - - // MIB:ieee802dot11.dot11smt(1).dot11StationConfigTable(1) - USHORT Psm; // power management mode (PWR_ACTIVE|PWR_SAVE) + UCHAR RssiTriggerMode; /* RSSI_TRIGGERED_UPON_BELOW_THRESHOLD or RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD */ + USHORT DefaultListenCount; /* default listen count; */ + ULONG WindowsPowerMode; /* Power mode for AC power */ + ULONG WindowsBatteryPowerMode; /* Power mode for battery if exists */ + BOOLEAN bWindowsACCAMEnable; /* Enable CAM power mode when AC on */ + BOOLEAN bAutoReconnect; /* Set to TRUE when setting OID_802_11_SSID with no matching BSSID */ + ULONG WindowsPowerProfile; /* Windows power profile, for NDIS5.1 PnP */ + + /* MIB:ieee802dot11.dot11smt(1).dot11StationConfigTable(1) */ + USHORT Psm; /* power management mode (PWR_ACTIVE|PWR_SAVE) */ USHORT DisassocReason; UCHAR DisassocSta[MAC_ADDR_LEN]; USHORT DeauthReason; @@ -1378,109 +1378,109 @@ typedef struct _STA_ADMIN_CONFIG { USHORT AuthFailReason; UCHAR AuthFailSta[MAC_ADDR_LEN]; - NDIS_802_11_PRIVACY_FILTER PrivacyFilter; // PrivacyFilter enum for 802.1X - NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined + NDIS_802_11_PRIVACY_FILTER PrivacyFilter; /* PrivacyFilter enum for 802.1X */ + NDIS_802_11_AUTHENTICATION_MODE AuthMode; /* This should match to whatever microsoft defined */ NDIS_802_11_WEP_STATUS WepStatus; - NDIS_802_11_WEP_STATUS OrigWepStatus; // Original wep status set from OID + NDIS_802_11_WEP_STATUS OrigWepStatus; /* Original wep status set from OID */ - // Add to support different cipher suite for WPA2/WPA mode - NDIS_802_11_ENCRYPTION_STATUS GroupCipher; // Multicast cipher suite - NDIS_802_11_ENCRYPTION_STATUS PairCipher; // Unicast cipher suite - BOOLEAN bMixCipher; // Indicate current Pair & Group use different cipher suites + /* Add to support different cipher suite for WPA2/WPA mode */ + NDIS_802_11_ENCRYPTION_STATUS GroupCipher; /* Multicast cipher suite */ + NDIS_802_11_ENCRYPTION_STATUS PairCipher; /* Unicast cipher suite */ + BOOLEAN bMixCipher; /* Indicate current Pair & Group use different cipher suites */ USHORT RsnCapability; NDIS_802_11_WEP_STATUS GroupKeyWepStatus; - UCHAR WpaPassPhrase[64]; // WPA PSK pass phrase - UINT WpaPassPhraseLen; // the length of WPA PSK pass phrase - UCHAR PMK[32]; // WPA PSK mode PMK - UCHAR PTK[64]; // WPA PSK mode PTK - UCHAR GTK[32]; // GTK from authenticator + UCHAR WpaPassPhrase[64]; /* WPA PSK pass phrase */ + UINT WpaPassPhraseLen; /* the length of WPA PSK pass phrase */ + UCHAR PMK[32]; /* WPA PSK mode PMK */ + UCHAR PTK[64]; /* WPA PSK mode PTK */ + UCHAR GTK[32]; /* GTK from authenticator */ BSSID_INFO SavedPMK[PMKID_NO]; - UINT SavedPMKNum; // Saved PMKID number + UINT SavedPMKNum; /* Saved PMKID number */ UCHAR DefaultKeyId; - // WPA 802.1x port control, WPA_802_1X_PORT_SECURED, WPA_802_1X_PORT_NOT_SECURED + /* WPA 802.1x port control, WPA_802_1X_PORT_SECURED, WPA_802_1X_PORT_NOT_SECURED */ UCHAR PortSecured; - // For WPA countermeasures - ULONG LastMicErrorTime; // record last MIC error time - ULONG MicErrCnt; // Should be 0, 1, 2, then reset to zero (after disassoiciation). - BOOLEAN bBlockAssoc; // Block associate attempt for 60 seconds after counter measure occurred. - // For WPA-PSK supplicant state - WPA_STATE WpaState; // Default is SS_NOTUSE and handled by microsoft 802.1x + /* For WPA countermeasures */ + ULONG LastMicErrorTime; /* record last MIC error time */ + ULONG MicErrCnt; /* Should be 0, 1, 2, then reset to zero (after disassoiciation). */ + BOOLEAN bBlockAssoc; /* Block associate attempt for 60 seconds after counter measure occurred. */ + /* For WPA-PSK supplicant state */ + WPA_STATE WpaState; /* Default is SS_NOTUSE and handled by microsoft 802.1x */ UCHAR ReplayCounter[8]; - UCHAR ANonce[32]; // ANonce for WPA-PSK from aurhenticator - UCHAR SNonce[32]; // SNonce for WPA-PSK + UCHAR ANonce[32]; /* ANonce for WPA-PSK from aurhenticator */ + UCHAR SNonce[32]; /* SNonce for WPA-PSK */ - UCHAR LastSNR0; // last received BEACON's SNR - UCHAR LastSNR1; // last received BEACON's SNR for 2nd antenna + UCHAR LastSNR0; /* last received BEACON's SNR */ + UCHAR LastSNR1; /* last received BEACON's SNR for 2nd antenna */ RSSI_SAMPLE RssiSample; ULONG NumOfAvgRssiSample; - ULONG LastBeaconRxTime; // OS's timestamp of the last BEACON RX time - ULONG Last11bBeaconRxTime; // OS's timestamp of the last 11B BEACON RX time - ULONG Last11gBeaconRxTime; // OS's timestamp of the last 11G BEACON RX time - ULONG Last20NBeaconRxTime; // OS's timestamp of the last 20MHz N BEACON RX time - - ULONG LastScanTime; // Record last scan time for issue BSSID_SCAN_LIST - ULONG ScanCnt; // Scan counts since most recent SSID, BSSID, SCAN OID request - BOOLEAN bSwRadio; // Software controlled Radio On/Off, TRUE: On - BOOLEAN bHwRadio; // Hardware controlled Radio On/Off, TRUE: On - BOOLEAN bRadio; // Radio state, And of Sw & Hw radio state - BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled - BOOLEAN bShowHiddenSSID; // Show all known SSID in SSID list get operation - - // New for WPA, windows want us to keep association information and - // Fixed IEs from last association response + ULONG LastBeaconRxTime; /* OS's timestamp of the last BEACON RX time */ + ULONG Last11bBeaconRxTime; /* OS's timestamp of the last 11B BEACON RX time */ + ULONG Last11gBeaconRxTime; /* OS's timestamp of the last 11G BEACON RX time */ + ULONG Last20NBeaconRxTime; /* OS's timestamp of the last 20MHz N BEACON RX time */ + + ULONG LastScanTime; /* Record last scan time for issue BSSID_SCAN_LIST */ + ULONG ScanCnt; /* Scan counts since most recent SSID, BSSID, SCAN OID request */ + BOOLEAN bSwRadio; /* Software controlled Radio On/Off, TRUE: On */ + BOOLEAN bHwRadio; /* Hardware controlled Radio On/Off, TRUE: On */ + BOOLEAN bRadio; /* Radio state, And of Sw & Hw radio state */ + BOOLEAN bHardwareRadio; /* Hardware controlled Radio enabled */ + BOOLEAN bShowHiddenSSID; /* Show all known SSID in SSID list get operation */ + + /* New for WPA, windows want us to keep association information and */ + /* Fixed IEs from last association response */ NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo; - USHORT ReqVarIELen; // Length of next VIE include EID & Length - UCHAR ReqVarIEs[MAX_VIE_LEN]; // The content saved here should be little-endian format. - USHORT ResVarIELen; // Length of next VIE include EID & Length + USHORT ReqVarIELen; /* Length of next VIE include EID & Length */ + UCHAR ReqVarIEs[MAX_VIE_LEN]; /* The content saved here should be little-endian format. */ + USHORT ResVarIELen; /* Length of next VIE include EID & Length */ UCHAR ResVarIEs[MAX_VIE_LEN]; UCHAR RSNIE_Len; - UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; // The content saved here should be little-endian format. - - ULONG CLBusyBytes; // Save the total bytes received durning channel load scan time - USHORT RPIDensity[8]; // Array for RPI density collection - - UCHAR RMReqCnt; // Number of measurement request saved. - UCHAR CurrentRMReqIdx; // Number of measurement request saved. - BOOLEAN ParallelReq; // Parallel measurement, only one request performed, - // It must be the same channel with maximum duration - USHORT ParallelDuration; // Maximum duration for parallel measurement - UCHAR ParallelChannel; // Only one channel with parallel measurement - USHORT IAPPToken; // IAPP dialog token - // Hack for channel load and noise histogram parameters - UCHAR NHFactor; // Parameter for Noise histogram - UCHAR CLFactor; // Parameter for channel load + UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; /* The content saved here should be little-endian format. */ + + ULONG CLBusyBytes; /* Save the total bytes received durning channel load scan time */ + USHORT RPIDensity[8]; /* Array for RPI density collection */ + + UCHAR RMReqCnt; /* Number of measurement request saved. */ + UCHAR CurrentRMReqIdx; /* Number of measurement request saved. */ + BOOLEAN ParallelReq; /* Parallel measurement, only one request performed, */ + /* It must be the same channel with maximum duration */ + USHORT ParallelDuration; /* Maximum duration for parallel measurement */ + UCHAR ParallelChannel; /* Only one channel with parallel measurement */ + USHORT IAPPToken; /* IAPP dialog token */ + /* Hack for channel load and noise histogram parameters */ + UCHAR NHFactor; /* Parameter for Noise histogram */ + UCHAR CLFactor; /* Parameter for channel load */ RALINK_TIMER_STRUCT StaQuickResponeForRateUpTimer; BOOLEAN StaQuickResponeForRateUpTimerRunning; - UCHAR DtimCount; // 0.. DtimPeriod-1 - UCHAR DtimPeriod; // default = 3 + UCHAR DtimCount; /* 0.. DtimPeriod-1 */ + UCHAR DtimPeriod; /* default = 3 */ - //////////////////////////////////////////////////////////////////////////////////////// - // This is only for WHQL test. + /*////////////////////////////////////////////////////////////////////////////////////// */ + /* This is only for WHQL test. */ BOOLEAN WhqlTest; - //////////////////////////////////////////////////////////////////////////////////////// + /*////////////////////////////////////////////////////////////////////////////////////// */ RALINK_TIMER_STRUCT WpaDisassocAndBlockAssocTimer; - // Fast Roaming - BOOLEAN bAutoRoaming; // 0:disable auto roaming by RSSI, 1:enable auto roaming by RSSI - CHAR dBmToRoam; // the condition to roam when receiving Rssi less than this value. It's negative value. + /* Fast Roaming */ + BOOLEAN bAutoRoaming; /* 0:disable auto roaming by RSSI, 1:enable auto roaming by RSSI */ + CHAR dBmToRoam; /* the condition to roam when receiving Rssi less than this value. It's negative value. */ BOOLEAN IEEE8021X; BOOLEAN IEEE8021x_required_keys; - CIPHER_KEY DesireSharedKey[4]; // Record user desired WEP keys + CIPHER_KEY DesireSharedKey[4]; /* Record user desired WEP keys */ UCHAR DesireSharedKeyId; - // 0: driver ignores wpa_supplicant - // 1: wpa_supplicant initiates scanning and AP selection - // 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters + /* 0: driver ignores wpa_supplicant */ + /* 1: wpa_supplicant initiates scanning and AP selection */ + /* 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters */ UCHAR WpaSupplicantUP; UCHAR WpaSupplicantScanCount; BOOLEAN bRSN_IE_FromWpaSupplicant; @@ -1491,63 +1491,63 @@ typedef struct _STA_ADMIN_CONFIG { BOOLEAN bTGnWifiTest; BOOLEAN bScanReqIsFromWebUI; - HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode; // For transmit phy setting in TXWI. + HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode; /* For transmit phy setting in TXWI. */ DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; RT_HT_PHY_INFO DesiredHtPhyInfo; BOOLEAN bAutoTxRateSwitch; #ifdef RTMP_MAC_PCI UCHAR BBPR3; - // PS Control has 2 meanings for advanced power save function. - // 1. EnablePSinIdle : When no connection, always radio off except need to do site survey. - // 2. EnableNewPS : will save more current in sleep or radio off mode. + /* PS Control has 2 meanings for advanced power save function. */ + /* 1. EnablePSinIdle : When no connection, always radio off except need to do site survey. */ + /* 2. EnableNewPS : will save more current in sleep or radio off mode. */ PS_CONTROL PSControl; -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ BOOLEAN bAutoConnectByBssid; - ULONG BeaconLostTime; // seconds - BOOLEAN bForceTxBurst; // 1: force enble TX PACKET BURST, 0: disable + ULONG BeaconLostTime; /* seconds */ + BOOLEAN bForceTxBurst; /* 1: force enble TX PACKET BURST, 0: disable */ } STA_ADMIN_CONFIG, *PSTA_ADMIN_CONFIG; -// This data structure keep the current active BSS/IBSS's configuration that this STA -// had agreed upon joining the network. Which means these parameters are usually decided -// by the BSS/IBSS creator instead of user configuration. Data in this data structurre -// is valid only when either ADHOC_ON(pAd) or INFRA_ON(pAd) is TRUE. -// Normally, after SCAN or failed roaming attempts, we need to recover back to -// the current active settings. +/* This data structure keep the current active BSS/IBSS's configuration that this STA */ +/* had agreed upon joining the network. Which means these parameters are usually decided */ +/* by the BSS/IBSS creator instead of user configuration. Data in this data structurre */ +/* is valid only when either ADHOC_ON(pAd) or INFRA_ON(pAd) is TRUE. */ +/* Normally, after SCAN or failed roaming attempts, we need to recover back to */ +/* the current active settings. */ typedef struct _STA_ACTIVE_CONFIG { USHORT Aid; - USHORT AtimWin; // in kusec; IBSS parameter set element + USHORT AtimWin; /* in kusec; IBSS parameter set element */ USHORT CapabilityInfo; USHORT CfpMaxDuration; USHORT CfpPeriod; - // Copy supported rate from desired AP's beacon. We are trying to match - // AP's supported and extended rate settings. + /* Copy supported rate from desired AP's beacon. We are trying to match */ + /* AP's supported and extended rate settings. */ UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; UCHAR SupRateLen; UCHAR ExtRateLen; - // Copy supported ht from desired AP's beacon. We are trying to match + /* Copy supported ht from desired AP's beacon. We are trying to match */ RT_HT_PHY_INFO SupportedPhyInfo; RT_HT_CAPABILITY SupportedHtPhy; } STA_ACTIVE_CONFIG, *PSTA_ACTIVE_CONFIG; typedef struct _MAC_TABLE_ENTRY { - //Choose 1 from ValidAsWDS and ValidAsCLI to validize. - BOOLEAN ValidAsCLI; // Sta mode, set this TRUE after Linkup,too. - BOOLEAN ValidAsWDS; // This is WDS Entry. only for AP mode. - BOOLEAN ValidAsApCli; //This is a AP-Client entry, only for AP mode which enable AP-Client functions. + /*Choose 1 from ValidAsWDS and ValidAsCLI to validize. */ + BOOLEAN ValidAsCLI; /* Sta mode, set this TRUE after Linkup,too. */ + BOOLEAN ValidAsWDS; /* This is WDS Entry. only for AP mode. */ + BOOLEAN ValidAsApCli; /*This is a AP-Client entry, only for AP mode which enable AP-Client functions. */ BOOLEAN ValidAsMesh; - BOOLEAN ValidAsDls; // This is DLS Entry. only for STA mode. + BOOLEAN ValidAsDls; /* This is DLS Entry. only for STA mode. */ BOOLEAN isCached; - BOOLEAN bIAmBadAtheros; // Flag if this is Atheros chip that has IOT problem. We need to turn on RTS/CTS protection. + BOOLEAN bIAmBadAtheros; /* Flag if this is Atheros chip that has IOT problem. We need to turn on RTS/CTS protection. */ - UCHAR EnqueueEapolStartTimerRunning; // Enqueue EAPoL-Start for triggering EAP SM - //jan for wpa - // record which entry revoke MIC Failure , if it leaves the BSS itself, AP won't update aMICFailTime MIB + UCHAR EnqueueEapolStartTimerRunning; /* Enqueue EAPoL-Start for triggering EAP SM */ + /*jan for wpa */ + /* record which entry revoke MIC Failure , if it leaves the BSS itself, AP won't update aMICFailTime MIB */ UCHAR CMTimerRunning; - UCHAR apidx; // MBSS number + UCHAR apidx; /* MBSS number */ UCHAR RSNIE_Len; UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; UCHAR ANonce[LEN_KEY_DESC_NONCE]; @@ -1556,14 +1556,14 @@ typedef struct _MAC_TABLE_ENTRY { UCHAR PTK[64]; UCHAR ReTryCounter; RALINK_TIMER_STRUCT RetryTimer; - RALINK_TIMER_STRUCT EnqueueStartForPSKTimer; // A timer which enqueue EAPoL-Start for triggering PSK SM - NDIS_802_11_AUTHENTICATION_MODE AuthMode; // This should match to whatever microsoft defined + RALINK_TIMER_STRUCT EnqueueStartForPSKTimer; /* A timer which enqueue EAPoL-Start for triggering PSK SM */ + NDIS_802_11_AUTHENTICATION_MODE AuthMode; /* This should match to whatever microsoft defined */ NDIS_802_11_WEP_STATUS WepStatus; NDIS_802_11_WEP_STATUS GroupKeyWepStatus; AP_WPA_STATE WpaState; GTK_STATE GTKState; USHORT PortSecured; - NDIS_802_11_PRIVACY_FILTER PrivacyFilter; // PrivacyFilter enum for 802.1X + NDIS_802_11_PRIVACY_FILTER PrivacyFilter; /* PrivacyFilter enum for 802.1X */ CIPHER_KEY PairwiseKey; PVOID pAd; INT PMKID_CacheIdx; @@ -1572,75 +1572,75 @@ typedef struct _MAC_TABLE_ENTRY { UCHAR Addr[MAC_ADDR_LEN]; UCHAR PsMode; SST Sst; - AUTH_STATE AuthState; // for SHARED KEY authentication state machine used only - BOOLEAN IsReassocSta; // Indicate whether this is a reassociation procedure + AUTH_STATE AuthState; /* for SHARED KEY authentication state machine used only */ + BOOLEAN IsReassocSta; /* Indicate whether this is a reassociation procedure */ USHORT Aid; USHORT CapabilityInfo; UCHAR LastRssi; ULONG NoDataIdleCount; - UINT16 StationKeepAliveCount; // unit: second + UINT16 StationKeepAliveCount; /* unit: second */ ULONG PsQIdleCount; QUEUE_HEADER PsQueue; - UINT32 StaConnectTime; // the live time of this station since associated with AP + UINT32 StaConnectTime; /* the live time of this station since associated with AP */ BOOLEAN bSendBAR; USHORT NoBADataCountDown; - UINT32 CachedBuf[16]; // UINT (4 bytes) for alignment - UINT TxBFCount; // 3*3 + UINT32 CachedBuf[16]; /* UINT (4 bytes) for alignment */ + UINT TxBFCount; /* 3*3 */ UINT FIFOCount; UINT DebugFIFOCount; UINT DebugTxCount; BOOLEAN bDlsInit; -//==================================================== -//WDS entry needs these -// if ValidAsWDS==TRUE, MatchWDSTabIdx is the index in WdsTab.MacTab +/*==================================================== */ +/*WDS entry needs these */ +/* if ValidAsWDS==TRUE, MatchWDSTabIdx is the index in WdsTab.MacTab */ UINT MatchWDSTabIdx; UCHAR MaxSupportedRate; UCHAR CurrTxRate; UCHAR CurrTxRateIndex; - // to record the each TX rate's quality. 0 is best, the bigger the worse. + /* to record the each TX rate's quality. 0 is best, the bigger the worse. */ USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH]; -// USHORT OneSecTxOkCount; +/* USHORT OneSecTxOkCount; */ UINT32 OneSecTxNoRetryOkCount; UINT32 OneSecTxRetryOkCount; UINT32 OneSecTxFailCount; UINT32 ContinueTxFailCnt; - UINT32 CurrTxRateStableTime; // # of second in current TX rate - UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition -//==================================================== + UINT32 CurrTxRateStableTime; /* # of second in current TX rate */ + UCHAR TxRateUpPenalty; /* extra # of second penalty due to last unstable condition */ +/*==================================================== */ BOOLEAN fNoisyEnvironment; BOOLEAN fLastSecAccordingRSSI; - UCHAR LastSecTxRateChangeAction; // 0: no change, 1:rate UP, 2:rate down - CHAR LastTimeTxRateChangeAction; //Keep last time value of LastSecTxRateChangeAction + UCHAR LastSecTxRateChangeAction; /* 0: no change, 1:rate UP, 2:rate down */ + CHAR LastTimeTxRateChangeAction; /*Keep last time value of LastSecTxRateChangeAction */ ULONG LastTxOkCount; UCHAR PER[MAX_STEP_OF_TX_RATE_SWITCH]; - // a bitmap of BOOLEAN flags. each bit represent an operation status of a particular - // BOOLEAN control, either ON or OFF. These flags should always be accessed via - // CLIENT_STATUS_TEST_FLAG(), CLIENT_STATUS_SET_FLAG(), CLIENT_STATUS_CLEAR_FLAG() macros. - // see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition. fCLIENT_STATUS_AMSDU_INUSED + /* a bitmap of BOOLEAN flags. each bit represent an operation status of a particular */ + /* BOOLEAN control, either ON or OFF. These flags should always be accessed via */ + /* CLIENT_STATUS_TEST_FLAG(), CLIENT_STATUS_SET_FLAG(), CLIENT_STATUS_CLEAR_FLAG() macros. */ + /* see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition. fCLIENT_STATUS_AMSDU_INUSED */ ULONG ClientStatusFlags; - HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode; // For transmit phy setting in TXWI. + HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode; /* For transmit phy setting in TXWI. */ - // HT EWC MIMO-N used parameters - USHORT RXBAbitmap; // fill to on-chip RXWI_BA_BITMASK in 8.1.3RX attribute entry format - USHORT TXBAbitmap; // This bitmap as originator, only keep in software used to mark AMPDU bit in TXWI + /* HT EWC MIMO-N used parameters */ + USHORT RXBAbitmap; /* fill to on-chip RXWI_BA_BITMASK in 8.1.3RX attribute entry format */ + USHORT TXBAbitmap; /* This bitmap as originator, only keep in software used to mark AMPDU bit in TXWI */ USHORT TXAutoBAbitmap; USHORT BADeclineBitmap; - USHORT BARecWcidArray[NUM_OF_TID]; // The mapping wcid of recipient session. if RXBAbitmap bit is masked - USHORT BAOriWcidArray[NUM_OF_TID]; // The mapping wcid of originator session. if TXBAbitmap bit is masked - USHORT BAOriSequence[NUM_OF_TID]; // The mapping wcid of originator session. if TXBAbitmap bit is masked + USHORT BARecWcidArray[NUM_OF_TID]; /* The mapping wcid of recipient session. if RXBAbitmap bit is masked */ + USHORT BAOriWcidArray[NUM_OF_TID]; /* The mapping wcid of originator session. if TXBAbitmap bit is masked */ + USHORT BAOriSequence[NUM_OF_TID]; /* The mapping wcid of originator session. if TXBAbitmap bit is masked */ - // 802.11n features. + /* 802.11n features. */ UCHAR MpduDensity; UCHAR MaxRAmpduFactor; UCHAR AMsduSize; - UCHAR MmpsMode; // MIMO power save more. + UCHAR MmpsMode; /* MIMO power save more. */ HT_CAPABILITY_IE HTCapability; @@ -1670,16 +1670,16 @@ typedef struct _MAC_TABLE { QUEUE_HEADER McastPsQueue; ULONG PsQIdleCount; BOOLEAN fAnyStationInPsm; - BOOLEAN fAnyStationBadAtheros; // Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip. - BOOLEAN fAnyTxOPForceDisable; // Check if it is necessary to disable BE TxOP - BOOLEAN fAllStationAsRalink; // Check if all stations are ralink-chipset - BOOLEAN fAnyStationIsLegacy; // Check if I use legacy rate to transmit to my BSS Station/ - BOOLEAN fAnyStationNonGF; // Check if any Station can't support GF. - BOOLEAN fAnyStation20Only; // Check if any Station can't support GF. - BOOLEAN fAnyStationMIMOPSDynamic; // Check if any Station is MIMO Dynamic - BOOLEAN fAnyBASession; // Check if there is BA session. Force turn on RTS/CTS -//2008/10/28: KH add to support Antenna power-saving of AP<-- -//2008/10/28: KH add to support Antenna power-saving of AP--> + BOOLEAN fAnyStationBadAtheros; /* Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip. */ + BOOLEAN fAnyTxOPForceDisable; /* Check if it is necessary to disable BE TxOP */ + BOOLEAN fAllStationAsRalink; /* Check if all stations are ralink-chipset */ + BOOLEAN fAnyStationIsLegacy; /* Check if I use legacy rate to transmit to my BSS Station/ */ + BOOLEAN fAnyStationNonGF; /* Check if any Station can't support GF. */ + BOOLEAN fAnyStation20Only; /* Check if any Station can't support GF. */ + BOOLEAN fAnyStationMIMOPSDynamic; /* Check if any Station is MIMO Dynamic */ + BOOLEAN fAnyBASession; /* Check if there is BA session. Force turn on RTS/CTS */ +/*2008/10/28: KH add to support Antenna power-saving of AP<-- */ +/*2008/10/28: KH add to support Antenna power-saving of AP--> */ } MAC_TABLE, *PMAC_TABLE; struct wificonf { @@ -1711,11 +1711,11 @@ struct _RTMP_CHIP_OP_ { void (*AsicHaltAction) (RTMP_ADAPTER * pAd); }; -// -// The miniport adapter structure -// +/* */ +/* The miniport adapter structure */ +/* */ struct _RTMP_ADAPTER { - PVOID OS_Cookie; // save specific structure relative to OS + PVOID OS_Cookie; /* save specific structure relative to OS */ PNET_DEV net_dev; ULONG VirtualIfCnt; @@ -1726,7 +1726,7 @@ struct _RTMP_ADAPTER { /*****************************************************************************************/ /* PCI related parameters */ /*****************************************************************************************/ - PUCHAR CSRBaseAddress; // PCI MMIO Base Address, all access will use + PUCHAR CSRBaseAddress; /* PCI MMIO Base Address, all access will use */ unsigned int irq_num; USHORT LnkCtrlBitMask; @@ -1735,26 +1735,26 @@ struct _RTMP_ADAPTER { USHORT HostLnkCtrlConfiguration; USHORT HostLnkCtrlOffset; USHORT PCIePowerSaveLevel; - ULONG Rt3xxHostLinkCtrl; // USed for 3090F chip - ULONG Rt3xxRalinkLinkCtrl; // USed for 3090F chip - USHORT DeviceID; // Read from PCI config + ULONG Rt3xxHostLinkCtrl; /* USed for 3090F chip */ + ULONG Rt3xxRalinkLinkCtrl; /* USed for 3090F chip */ + USHORT DeviceID; /* Read from PCI config */ ULONG AccessBBPFailCount; - BOOLEAN bPCIclkOff; // flag that indicate if the PICE power status in Configuration SPace.. - BOOLEAN bPCIclkOffDisableTx; // + BOOLEAN bPCIclkOff; /* flag that indicate if the PICE power status in Configuration SPace.. */ + BOOLEAN bPCIclkOffDisableTx; /* */ - BOOLEAN brt30xxBanMcuCmd; //when = 0xff means all commands are ok to set . - BOOLEAN b3090ESpecialChip; //3090E special chip that write EEPROM 0x24=0x9280. - ULONG CheckDmaBusyCount; // Check Interrupt Status Register Count. + BOOLEAN brt30xxBanMcuCmd; /*when = 0xff means all commands are ok to set . */ + BOOLEAN b3090ESpecialChip; /*3090E special chip that write EEPROM 0x24=0x9280. */ + ULONG CheckDmaBusyCount; /* Check Interrupt Status Register Count. */ UINT int_enable_reg; UINT int_disable_mask; UINT int_pending; - RTMP_DMABUF TxBufSpace[NUM_OF_TX_RING]; // Shared memory of all 1st pre-allocated TxBuf associated with each TXD - RTMP_DMABUF RxDescRing; // Shared memory for RX descriptors - RTMP_DMABUF TxDescRing[NUM_OF_TX_RING]; // Shared memory for Tx descriptors - RTMP_TX_RING TxRing[NUM_OF_TX_RING]; // AC0~4 + HCCA -#endif // RTMP_MAC_PCI // + RTMP_DMABUF TxBufSpace[NUM_OF_TX_RING]; /* Shared memory of all 1st pre-allocated TxBuf associated with each TXD */ + RTMP_DMABUF RxDescRing; /* Shared memory for RX descriptors */ + RTMP_DMABUF TxDescRing[NUM_OF_TX_RING]; /* Shared memory for Tx descriptors */ + RTMP_TX_RING TxRing[NUM_OF_TX_RING]; /* AC0~4 + HCCA */ +#endif /* RTMP_MAC_PCI // */ NDIS_SPIN_LOCK irq_lock; UCHAR irq_disabled; @@ -1764,28 +1764,28 @@ struct _RTMP_ADAPTER { /* USB related parameters */ /*****************************************************************************************/ struct usb_config_descriptor *config; - UINT BulkInEpAddr; // bulk-in endpoint address - UINT BulkOutEpAddr[6]; // bulk-out endpoint address + UINT BulkInEpAddr; /* bulk-in endpoint address */ + UINT BulkOutEpAddr[6]; /* bulk-out endpoint address */ UINT NumberOfPipes; USHORT BulkOutMaxPacketSize; USHORT BulkInMaxPacketSize; - //======Control Flags + /*======Control Flags */ LONG PendingIoCount; ULONG BulkFlags; - BOOLEAN bUsbTxBulkAggre; // Flags for bulk out data priority + BOOLEAN bUsbTxBulkAggre; /* Flags for bulk out data priority */ - //======Cmd Thread + /*======Cmd Thread */ CmdQ CmdQ; - NDIS_SPIN_LOCK CmdQLock; // CmdQLock spinlock + NDIS_SPIN_LOCK CmdQLock; /* CmdQLock spinlock */ RTMP_OS_TASK cmdQTask; - //======Semaphores (event) + /*======Semaphores (event) */ RTMP_OS_SEM UsbVendorReq_semaphore; PVOID UsbVendorReqBuf; wait_queue_head_t *wait; -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ /*****************************************************************************************/ /* RBUS related parameters */ @@ -1794,7 +1794,7 @@ struct _RTMP_ADAPTER { /*****************************************************************************************/ /* Both PCI/USB related parameters */ /*****************************************************************************************/ - //RTMP_DEV_INFO chipInfo; + /*RTMP_DEV_INFO chipInfo; */ RTMP_INF_TYPE infType; /*****************************************************************************************/ @@ -1802,42 +1802,42 @@ struct _RTMP_ADAPTER { /*****************************************************************************************/ RTMP_OS_TASK mlmeTask; #ifdef RTMP_TIMER_TASK_SUPPORT - // If you want use timer task to handle the timer related jobs, enable this. + /* If you want use timer task to handle the timer related jobs, enable this. */ RTMP_TIMER_TASK_QUEUE TimerQ; NDIS_SPIN_LOCK TimerQLock; RTMP_OS_TASK timerTask; -#endif // RTMP_TIMER_TASK_SUPPORT // +#endif /* RTMP_TIMER_TASK_SUPPORT // */ /*****************************************************************************************/ /* Tx related parameters */ /*****************************************************************************************/ - BOOLEAN DeQueueRunning[NUM_OF_TX_RING]; // for ensuring RTUSBDeQueuePacket get call once + BOOLEAN DeQueueRunning[NUM_OF_TX_RING]; /* for ensuring RTUSBDeQueuePacket get call once */ NDIS_SPIN_LOCK DeQueueLock[NUM_OF_TX_RING]; #ifdef RTMP_MAC_USB - // Data related context and AC specified, 4 AC supported - NDIS_SPIN_LOCK BulkOutLock[6]; // BulkOut spinlock for 4 ACs - NDIS_SPIN_LOCK MLMEBulkOutLock; // MLME BulkOut lock + /* Data related context and AC specified, 4 AC supported */ + NDIS_SPIN_LOCK BulkOutLock[6]; /* BulkOut spinlock for 4 ACs */ + NDIS_SPIN_LOCK MLMEBulkOutLock; /* MLME BulkOut lock */ HT_TX_CONTEXT TxContext[NUM_OF_TX_RING]; - NDIS_SPIN_LOCK TxContextQueueLock[NUM_OF_TX_RING]; // TxContextQueue spinlock + NDIS_SPIN_LOCK TxContextQueueLock[NUM_OF_TX_RING]; /* TxContextQueue spinlock */ - // 4 sets of Bulk Out index and pending flag - UCHAR NextBulkOutIndex[4]; // only used for 4 EDCA bulkout pipe + /* 4 sets of Bulk Out index and pending flag */ + UCHAR NextBulkOutIndex[4]; /* only used for 4 EDCA bulkout pipe */ - BOOLEAN BulkOutPending[6]; // used for total 6 bulkout pipe + BOOLEAN BulkOutPending[6]; /* used for total 6 bulkout pipe */ UCHAR bulkResetPipeid; BOOLEAN MgmtBulkPending; ULONG bulkResetReq[6]; -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ - // resource for software backlog queues - QUEUE_HEADER TxSwQueue[NUM_OF_TX_RING]; // 4 AC + 1 HCCA - NDIS_SPIN_LOCK TxSwQueueLock[NUM_OF_TX_RING]; // TxSwQueue spinlock + /* resource for software backlog queues */ + QUEUE_HEADER TxSwQueue[NUM_OF_TX_RING]; /* 4 AC + 1 HCCA */ + NDIS_SPIN_LOCK TxSwQueueLock[NUM_OF_TX_RING]; /* TxSwQueue spinlock */ - RTMP_DMABUF MgmtDescRing; // Shared memory for MGMT descriptors + RTMP_DMABUF MgmtDescRing; /* Shared memory for MGMT descriptors */ RTMP_MGMT_RING MgmtRing; - NDIS_SPIN_LOCK MgmtRingLock; // Prio Ring spinlock + NDIS_SPIN_LOCK MgmtRingLock; /* Prio Ring spinlock */ /*****************************************************************************************/ /* Rx related parameters */ @@ -1845,65 +1845,65 @@ struct _RTMP_ADAPTER { #ifdef RTMP_MAC_PCI RTMP_RX_RING RxRing; - NDIS_SPIN_LOCK RxRingLock; // Rx Ring spinlock + NDIS_SPIN_LOCK RxRingLock; /* Rx Ring spinlock */ #ifdef RT3090 - NDIS_SPIN_LOCK McuCmdLock; //MCU Command Queue spinlock -#endif // RT3090 // -#endif // RTMP_MAC_PCI // + NDIS_SPIN_LOCK McuCmdLock; /*MCU Command Queue spinlock */ +#endif /* RT3090 // */ +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB - RX_CONTEXT RxContext[RX_RING_SIZE]; // 1 for redundant multiple IRP bulk in. - NDIS_SPIN_LOCK BulkInLock; // BulkIn spinlock for 4 ACs - UCHAR PendingRx; // The Maximum pending Rx value should be RX_RING_SIZE. - UCHAR NextRxBulkInIndex; // Indicate the current RxContext Index which hold by Host controller. - UCHAR NextRxBulkInReadIndex; // Indicate the current RxContext Index which driver can read & process it. - ULONG NextRxBulkInPosition; // Want to contatenate 2 URB buffer while 1st is bulkin failed URB. This Position is 1st URB TransferLength. - ULONG TransferBufferLength; // current length of the packet buffer - ULONG ReadPosition; // current read position in a packet buffer -#endif // RTMP_MAC_USB // + RX_CONTEXT RxContext[RX_RING_SIZE]; /* 1 for redundant multiple IRP bulk in. */ + NDIS_SPIN_LOCK BulkInLock; /* BulkIn spinlock for 4 ACs */ + UCHAR PendingRx; /* The Maximum pending Rx value should be RX_RING_SIZE. */ + UCHAR NextRxBulkInIndex; /* Indicate the current RxContext Index which hold by Host controller. */ + UCHAR NextRxBulkInReadIndex; /* Indicate the current RxContext Index which driver can read & process it. */ + ULONG NextRxBulkInPosition; /* Want to contatenate 2 URB buffer while 1st is bulkin failed URB. This Position is 1st URB TransferLength. */ + ULONG TransferBufferLength; /* current length of the packet buffer */ + ULONG ReadPosition; /* current read position in a packet buffer */ +#endif /* RTMP_MAC_USB // */ /*****************************************************************************************/ /* ASIC related parameters */ /*****************************************************************************************/ - UINT32 MACVersion; // MAC version. Record rt2860C(0x28600100) or rt2860D (0x28600101).. + UINT32 MACVersion; /* MAC version. Record rt2860C(0x28600100) or rt2860D (0x28600101).. */ - // --------------------------- - // E2PROM - // --------------------------- - ULONG EepromVersion; // byte 0: version, byte 1: revision, byte 2~3: unused - ULONG FirmwareVersion; // byte 0: Minor version, byte 1: Major version, otherwise unused. + /* --------------------------- */ + /* E2PROM */ + /* --------------------------- */ + ULONG EepromVersion; /* byte 0: version, byte 1: revision, byte 2~3: unused */ + ULONG FirmwareVersion; /* byte 0: Minor version, byte 1: Major version, otherwise unused. */ USHORT EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS]; - UCHAR EEPROMAddressNum; // 93c46=6 93c66=8 + UCHAR EEPROMAddressNum; /* 93c46=6 93c66=8 */ BOOLEAN EepromAccess; UCHAR EFuseTag; - // --------------------------- - // BBP Control - // --------------------------- - UCHAR BbpWriteLatch[140]; // record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID - CHAR BbpRssiToDbmDelta; // change from UCHAR to CHAR for high power + /* --------------------------- */ + /* BBP Control */ + /* --------------------------- */ + UCHAR BbpWriteLatch[140]; /* record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID */ + CHAR BbpRssiToDbmDelta; /* change from UCHAR to CHAR for high power */ BBP_R66_TUNING BbpTuning; - // ---------------------------- - // RFIC control - // ---------------------------- - UCHAR RfIcType; // RFIC_xxx - ULONG RfFreqOffset; // Frequency offset for channel switching - RTMP_RF_REGS LatchRfRegs; // latch th latest RF programming value since RF IC doesn't support READ + /* ---------------------------- */ + /* RFIC control */ + /* ---------------------------- */ + UCHAR RfIcType; /* RFIC_xxx */ + ULONG RfFreqOffset; /* Frequency offset for channel switching */ + RTMP_RF_REGS LatchRfRegs; /* latch th latest RF programming value since RF IC doesn't support READ */ - EEPROM_ANTENNA_STRUC Antenna; // Since ANtenna definition is different for a & g. We need to save it for future reference. + EEPROM_ANTENNA_STRUC Antenna; /* Since ANtenna definition is different for a & g. We need to save it for future reference. */ EEPROM_NIC_CONFIG2_STRUC NicConfig2; - // This soft Rx Antenna Diversity mechanism is used only when user set - // RX Antenna = DIVERSITY ON + /* This soft Rx Antenna Diversity mechanism is used only when user set */ + /* RX Antenna = DIVERSITY ON */ SOFT_RX_ANT_DIVERSITY RxAnt; UCHAR RFProgSeq; - CHANNEL_TX_POWER TxPower[MAX_NUM_OF_CHANNELS]; // Store Tx power value for all channels. - CHANNEL_TX_POWER ChannelList[MAX_NUM_OF_CHANNELS]; // list all supported channels for site survey - CHANNEL_11J_TX_POWER TxPower11J[MAX_NUM_OF_11JCHANNELS]; // 802.11j channel and bw - CHANNEL_11J_TX_POWER ChannelList11J[MAX_NUM_OF_11JCHANNELS]; // list all supported channels for site survey + CHANNEL_TX_POWER TxPower[MAX_NUM_OF_CHANNELS]; /* Store Tx power value for all channels. */ + CHANNEL_TX_POWER ChannelList[MAX_NUM_OF_CHANNELS]; /* list all supported channels for site survey */ + CHANNEL_11J_TX_POWER TxPower11J[MAX_NUM_OF_11JCHANNELS]; /* 802.11j channel and bw */ + CHANNEL_11J_TX_POWER ChannelList11J[MAX_NUM_OF_11JCHANNELS]; /* list all supported channels for site survey */ - UCHAR ChannelListNum; // number of channel in ChannelList[] + UCHAR ChannelListNum; /* number of channel in ChannelList[] */ UCHAR Bbp94; BOOLEAN BbpForCCK; ULONG Tx20MPwrCfgABand[5]; @@ -1911,47 +1911,47 @@ struct _RTMP_ADAPTER { ULONG Tx40MPwrCfgABand[5]; ULONG Tx40MPwrCfgGBand[5]; - BOOLEAN bAutoTxAgcA; // Enable driver auto Tx Agc control - UCHAR TssiRefA; // Store Tssi reference value as 25 temperature. - UCHAR TssiPlusBoundaryA[5]; // Tssi boundary for increase Tx power to compensate. - UCHAR TssiMinusBoundaryA[5]; // Tssi boundary for decrease Tx power to compensate. - UCHAR TxAgcStepA; // Store Tx TSSI delta increment / decrement value - CHAR TxAgcCompensateA; // Store the compensation (TxAgcStep * (idx-1)) - - BOOLEAN bAutoTxAgcG; // Enable driver auto Tx Agc control - UCHAR TssiRefG; // Store Tssi reference value as 25 temperature. - UCHAR TssiPlusBoundaryG[5]; // Tssi boundary for increase Tx power to compensate. - UCHAR TssiMinusBoundaryG[5]; // Tssi boundary for decrease Tx power to compensate. - UCHAR TxAgcStepG; // Store Tx TSSI delta increment / decrement value - CHAR TxAgcCompensateG; // Store the compensation (TxAgcStep * (idx-1)) - - CHAR BGRssiOffset0; // Store B/G RSSI#0 Offset value on EEPROM 0x46h - CHAR BGRssiOffset1; // Store B/G RSSI#1 Offset value - CHAR BGRssiOffset2; // Store B/G RSSI#2 Offset value - - CHAR ARssiOffset0; // Store A RSSI#0 Offset value on EEPROM 0x4Ah - CHAR ARssiOffset1; // Store A RSSI#1 Offset value - CHAR ARssiOffset2; // Store A RSSI#2 Offset value - - CHAR BLNAGain; // Store B/G external LNA#0 value on EEPROM 0x44h - CHAR ALNAGain0; // Store A external LNA#0 value for ch36~64 - CHAR ALNAGain1; // Store A external LNA#1 value for ch100~128 - CHAR ALNAGain2; // Store A external LNA#2 value for ch132~165 + BOOLEAN bAutoTxAgcA; /* Enable driver auto Tx Agc control */ + UCHAR TssiRefA; /* Store Tssi reference value as 25 temperature. */ + UCHAR TssiPlusBoundaryA[5]; /* Tssi boundary for increase Tx power to compensate. */ + UCHAR TssiMinusBoundaryA[5]; /* Tssi boundary for decrease Tx power to compensate. */ + UCHAR TxAgcStepA; /* Store Tx TSSI delta increment / decrement value */ + CHAR TxAgcCompensateA; /* Store the compensation (TxAgcStep * (idx-1)) */ + + BOOLEAN bAutoTxAgcG; /* Enable driver auto Tx Agc control */ + UCHAR TssiRefG; /* Store Tssi reference value as 25 temperature. */ + UCHAR TssiPlusBoundaryG[5]; /* Tssi boundary for increase Tx power to compensate. */ + UCHAR TssiMinusBoundaryG[5]; /* Tssi boundary for decrease Tx power to compensate. */ + UCHAR TxAgcStepG; /* Store Tx TSSI delta increment / decrement value */ + CHAR TxAgcCompensateG; /* Store the compensation (TxAgcStep * (idx-1)) */ + + CHAR BGRssiOffset0; /* Store B/G RSSI#0 Offset value on EEPROM 0x46h */ + CHAR BGRssiOffset1; /* Store B/G RSSI#1 Offset value */ + CHAR BGRssiOffset2; /* Store B/G RSSI#2 Offset value */ + + CHAR ARssiOffset0; /* Store A RSSI#0 Offset value on EEPROM 0x4Ah */ + CHAR ARssiOffset1; /* Store A RSSI#1 Offset value */ + CHAR ARssiOffset2; /* Store A RSSI#2 Offset value */ + + CHAR BLNAGain; /* Store B/G external LNA#0 value on EEPROM 0x44h */ + CHAR ALNAGain0; /* Store A external LNA#0 value for ch36~64 */ + CHAR ALNAGain1; /* Store A external LNA#1 value for ch100~128 */ + CHAR ALNAGain2; /* Store A external LNA#2 value for ch132~165 */ #ifdef RT30xx - // for 3572 + /* for 3572 */ UCHAR Bbp25; UCHAR Bbp26; - UCHAR TxMixerGain24G; // Tx mixer gain value from EEPROM to improve Tx EVM / Tx DAC, 2.4G + UCHAR TxMixerGain24G; /* Tx mixer gain value from EEPROM to improve Tx EVM / Tx DAC, 2.4G */ UCHAR TxMixerGain5G; -#endif // RT30xx // - // ---------------------------- - // LED control - // ---------------------------- +#endif /* RT30xx // */ + /* ---------------------------- */ + /* LED control */ + /* ---------------------------- */ MCU_LEDCS_STRUC LedCntl; - USHORT Led1; // read from EEPROM 0x3c - USHORT Led2; // EEPROM 0x3e - USHORT Led3; // EEPROM 0x40 + USHORT Led1; /* read from EEPROM 0x3c */ + USHORT Led2; /* EEPROM 0x3e */ + USHORT Led3; /* EEPROM 0x40 */ UCHAR LedIndicatorStrength; UCHAR RssiSingalstrengthOffet; BOOLEAN bLedOnScanning; @@ -1960,12 +1960,12 @@ struct _RTMP_ADAPTER { /*****************************************************************************************/ /* 802.11 related parameters */ /*****************************************************************************************/ - // outgoing BEACON frame buffer and corresponding TXD + /* outgoing BEACON frame buffer and corresponding TXD */ TXWI_STRUC BeaconTxWI; PUCHAR BeaconBuf; USHORT BeaconOffset[HW_BEACON_MAX_COUNT]; - // pre-build PS-POLL and NULL frame upon link up. for efficiency purpose. + /* pre-build PS-POLL and NULL frame upon link up. for efficiency purpose. */ PSPOLL_FRAME PsPollFrame; HEADER_802_11 NullFrame; @@ -1974,45 +1974,45 @@ struct _RTMP_ADAPTER { TX_CONTEXT NullContext; TX_CONTEXT PsPollContext; TX_CONTEXT RTSContext; -#endif // RTMP_MAC_USB // - -//=========AP=========== - -//=======STA=========== - // ----------------------------------------------- - // STA specific configuration & operation status - // used only when pAd->OpMode == OPMODE_STA - // ----------------------------------------------- - STA_ADMIN_CONFIG StaCfg; // user desired settings - STA_ACTIVE_CONFIG StaActive; // valid only when ADHOC_ON(pAd) || INFRA_ON(pAd) - CHAR nickname[IW_ESSID_MAX_SIZE + 1]; // nickname, only used in the iwconfig i/f +#endif /* RTMP_MAC_USB // */ + +/*=========AP=========== */ + +/*=======STA=========== */ + /* ----------------------------------------------- */ + /* STA specific configuration & operation status */ + /* used only when pAd->OpMode == OPMODE_STA */ + /* ----------------------------------------------- */ + STA_ADMIN_CONFIG StaCfg; /* user desired settings */ + STA_ACTIVE_CONFIG StaActive; /* valid only when ADHOC_ON(pAd) || INFRA_ON(pAd) */ + CHAR nickname[IW_ESSID_MAX_SIZE + 1]; /* nickname, only used in the iwconfig i/f */ NDIS_MEDIA_STATE PreMediaState; -//=======Common=========== - // OP mode: either AP or STA - UCHAR OpMode; // OPMODE_STA, OPMODE_AP +/*=======Common=========== */ + /* OP mode: either AP or STA */ + UCHAR OpMode; /* OPMODE_STA, OPMODE_AP */ - NDIS_MEDIA_STATE IndicateMediaState; // Base on Indication state, default is NdisMediaStateDisConnected + NDIS_MEDIA_STATE IndicateMediaState; /* Base on Indication state, default is NdisMediaStateDisConnected */ /* MAT related parameters */ - // configuration: read from Registry & E2PROM - BOOLEAN bLocalAdminMAC; // Use user changed MAC - UCHAR PermanentAddress[MAC_ADDR_LEN]; // Factory default MAC address - UCHAR CurrentAddress[MAC_ADDR_LEN]; // User changed MAC address + /* configuration: read from Registry & E2PROM */ + BOOLEAN bLocalAdminMAC; /* Use user changed MAC */ + UCHAR PermanentAddress[MAC_ADDR_LEN]; /* Factory default MAC address */ + UCHAR CurrentAddress[MAC_ADDR_LEN]; /* User changed MAC address */ - // ------------------------------------------------------ - // common configuration to both OPMODE_STA and OPMODE_AP - // ------------------------------------------------------ + /* ------------------------------------------------------ */ + /* common configuration to both OPMODE_STA and OPMODE_AP */ + /* ------------------------------------------------------ */ COMMON_CONFIG CommonCfg; MLME_STRUCT Mlme; - // AP needs those vaiables for site survey feature. - MLME_AUX MlmeAux; // temporary settings used during MLME state machine - BSS_TABLE ScanTab; // store the latest SCAN result + /* AP needs those vaiables for site survey feature. */ + MLME_AUX MlmeAux; /* temporary settings used during MLME state machine */ + BSS_TABLE ScanTab; /* store the latest SCAN result */ - //About MacTab, the sta driver will use #0 and #1 for multicast and AP. - MAC_TABLE MacTab; // ASIC on-chip WCID entry table. At TX, ASIC always use key according to this on-chip table. + /*About MacTab, the sta driver will use #0 and #1 for multicast and AP. */ + MAC_TABLE MacTab; /* ASIC on-chip WCID entry table. At TX, ASIC always use key according to this on-chip table. */ NDIS_SPIN_LOCK MacTabLock; BA_TABLE BATable; @@ -2020,46 +2020,46 @@ struct _RTMP_ADAPTER { NDIS_SPIN_LOCK BATabLock; RALINK_TIMER_STRUCT RECBATimer; - // encryption/decryption KEY tables - CIPHER_KEY SharedKey[MAX_MBSSID_NUM][4]; // STA always use SharedKey[BSS0][0..3] + /* encryption/decryption KEY tables */ + CIPHER_KEY SharedKey[MAX_MBSSID_NUM][4]; /* STA always use SharedKey[BSS0][0..3] */ - // RX re-assembly buffer for fragmentation - FRAGMENT_FRAME FragFrame; // Frame storage for fragment frame + /* RX re-assembly buffer for fragmentation */ + FRAGMENT_FRAME FragFrame; /* Frame storage for fragment frame */ - // various Counters - COUNTER_802_3 Counters8023; // 802.3 counters - COUNTER_802_11 WlanCounters; // 802.11 MIB counters - COUNTER_RALINK RalinkCounters; // Ralink propriety counters - COUNTER_DRS DrsCounters; // counters for Dynamic TX Rate Switching - PRIVATE_STRUC PrivateInfo; // Private information & counters + /* various Counters */ + COUNTER_802_3 Counters8023; /* 802.3 counters */ + COUNTER_802_11 WlanCounters; /* 802.11 MIB counters */ + COUNTER_RALINK RalinkCounters; /* Ralink propriety counters */ + COUNTER_DRS DrsCounters; /* counters for Dynamic TX Rate Switching */ + PRIVATE_STRUC PrivateInfo; /* Private information & counters */ - // flags, see fRTMP_ADAPTER_xxx flags - ULONG Flags; // Represent current device status - ULONG PSFlags; // Power Save operation flag. + /* flags, see fRTMP_ADAPTER_xxx flags */ + ULONG Flags; /* Represent current device status */ + ULONG PSFlags; /* Power Save operation flag. */ - // current TX sequence # + /* current TX sequence # */ USHORT Sequence; - // Control disconnect / connect event generation - //+++Didn't used anymore + /* Control disconnect / connect event generation */ + /*+++Didn't used anymore */ ULONG LinkDownTime; - //--- + /*--- */ ULONG LastRxRate; ULONG LastTxRate; - //+++Used only for Station - BOOLEAN bConfigChanged; // Config Change flag for the same SSID setting - //--- + /*+++Used only for Station */ + BOOLEAN bConfigChanged; /* Config Change flag for the same SSID setting */ + /*--- */ - ULONG ExtraInfo; // Extra information for displaying status - ULONG SystemErrorBitmap; // b0: E2PROM version error + ULONG ExtraInfo; /* Extra information for displaying status */ + ULONG SystemErrorBitmap; /* b0: E2PROM version error */ - //+++Didn't used anymore - ULONG MacIcVersion; // MAC/BBP serial interface issue solved after ver.D - //--- + /*+++Didn't used anymore */ + ULONG MacIcVersion; /* MAC/BBP serial interface issue solved after ver.D */ + /*--- */ - // --------------------------- - // System event log - // --------------------------- + /* --------------------------- */ + /* System event log */ + /* --------------------------- */ RT_802_11_EVENT_TABLE EventTab; BOOLEAN HTCEnable; @@ -2070,64 +2070,64 @@ struct _RTMP_ADAPTER { #ifdef RTMP_MAC_USB ULONG BulkOutDataOneSecCount; ULONG BulkInDataOneSecCount; - ULONG BulkLastOneSecCount; // BulkOutDataOneSecCount + BulkInDataOneSecCount + ULONG BulkLastOneSecCount; /* BulkOutDataOneSecCount + BulkInDataOneSecCount */ ULONG watchDogRxCnt; ULONG watchDogRxOverFlowCnt; ULONG watchDogTxPendingCnt[NUM_OF_TX_RING]; INT TransferedLength[NUM_OF_TX_RING]; -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ BOOLEAN bUpdateBcnCntDone; - ULONG watchDogMacDeadlock; // prevent MAC/BBP into deadlock condition - // ---------------------------- - // DEBUG paramerts - // ---------------------------- - //ULONG DebugSetting[4]; + ULONG watchDogMacDeadlock; /* prevent MAC/BBP into deadlock condition */ + /* ---------------------------- */ + /* DEBUG paramerts */ + /* ---------------------------- */ + /*ULONG DebugSetting[4]; */ BOOLEAN bBanAllBaSetup; BOOLEAN bPromiscuous; - // ---------------------------- - // rt2860c emulation-use Parameters - // ---------------------------- - //ULONG rtsaccu[30]; - //ULONG ctsaccu[30]; - //ULONG cfendaccu[30]; - //ULONG bacontent[16]; - //ULONG rxint[RX_RING_SIZE+1]; - //UCHAR rcvba[60]; + /* ---------------------------- */ + /* rt2860c emulation-use Parameters */ + /* ---------------------------- */ + /*ULONG rtsaccu[30]; */ + /*ULONG ctsaccu[30]; */ + /*ULONG cfendaccu[30]; */ + /*ULONG bacontent[16]; */ + /*ULONG rxint[RX_RING_SIZE+1]; */ + /*UCHAR rcvba[60]; */ BOOLEAN bLinkAdapt; BOOLEAN bForcePrintTX; BOOLEAN bForcePrintRX; - //BOOLEAN bDisablescanning; //defined in RT2870 USB + /*BOOLEAN bDisablescanning; //defined in RT2870 USB */ BOOLEAN bStaFifoTest; BOOLEAN bProtectionTest; BOOLEAN bBroadComHT; - //+++Following add from RT2870 USB. + /*+++Following add from RT2870 USB. */ ULONG BulkOutReq; ULONG BulkOutComplete; ULONG BulkOutCompleteOther; - ULONG BulkOutCompleteCancel; // seems not use now? + ULONG BulkOutCompleteCancel; /* seems not use now? */ ULONG BulkInReq; ULONG BulkInComplete; ULONG BulkInCompleteFail; - //--- + /*--- */ struct wificonf WIFItestbed; struct reordering_mpdu_pool mpdu_blk_pool; - ULONG OneSecondnonBEpackets; // record non BE packets per second + ULONG OneSecondnonBEpackets; /* record non BE packets per second */ #ifdef LINUX struct iw_statistics iw_stats; struct net_device_stats stats; -#endif // LINUX // +#endif /* LINUX // */ ULONG TbttTickCount; #ifdef PCI_MSI_SUPPORT BOOLEAN HaveMsi; -#endif // PCI_MSI_SUPPORT // +#endif /* PCI_MSI_SUPPORT // */ UCHAR is_on; @@ -2143,30 +2143,30 @@ struct _RTMP_ADAPTER { #ifdef RTMP_EFUSE_SUPPORT BOOLEAN bUseEfuse; UCHAR EEPROMImage[1024]; -#endif // RTMP_EFUSE_SUPPORT // -#endif // RT30xx // +#endif /* RTMP_EFUSE_SUPPORT // */ +#endif /* RT30xx // */ }; #define DELAYINTMASK 0x0003fffb #define INTMASK 0x0003fffb #define IndMask 0x0003fffc -#define RxINT 0x00000005 // Delayed Rx or indivi rx -#define TxDataInt 0x000000fa // Delayed Tx or indivi tx -#define TxMgmtInt 0x00000102 // Delayed Tx or indivi tx -#define TxCoherent 0x00020000 // tx coherent -#define RxCoherent 0x00010000 // rx coherent -#define McuCommand 0x00000200 // mcu -#define PreTBTTInt 0x00001000 // Pre-TBTT interrupt -#define TBTTInt 0x00000800 // TBTT interrupt -#define GPTimeOutInt 0x00008000 // GPtimeout interrupt -#define AutoWakeupInt 0x00004000 // AutoWakeupInt interrupt -#define FifoStaFullInt 0x00002000 // fifo statistics full interrupt +#define RxINT 0x00000005 /* Delayed Rx or indivi rx */ +#define TxDataInt 0x000000fa /* Delayed Tx or indivi tx */ +#define TxMgmtInt 0x00000102 /* Delayed Tx or indivi tx */ +#define TxCoherent 0x00020000 /* tx coherent */ +#define RxCoherent 0x00010000 /* rx coherent */ +#define McuCommand 0x00000200 /* mcu */ +#define PreTBTTInt 0x00001000 /* Pre-TBTT interrupt */ +#define TBTTInt 0x00000800 /* TBTT interrupt */ +#define GPTimeOutInt 0x00008000 /* GPtimeout interrupt */ +#define AutoWakeupInt 0x00004000 /* AutoWakeupInt interrupt */ +#define FifoStaFullInt 0x00002000 /* fifo statistics full interrupt */ /*************************************************************************** * Rx Path software control block related data structures **************************************************************************/ typedef struct _RX_BLK_ { -// RXD_STRUC RxD; // sample +/* RXD_STRUC RxD; // sample */ RT28XX_RXD_STRUC RxD; PRXWI_STRUC pRxWI; PHEADER_802_11 pHeader; @@ -2174,7 +2174,7 @@ typedef struct _RX_BLK_ { UCHAR *pData; USHORT DataSize; USHORT Flags; - UCHAR UserPriority; // for calculate TKIP MIC using + UCHAR UserPriority; /* for calculate TKIP MIC using */ } RX_BLK; #define RX_BLK_SET_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags |= _flag) @@ -2210,53 +2210,53 @@ typedef struct _RX_BLK_ { #define TX_RALINK_FRAME 0x10 #define TX_FRAG_FRAME 0x20 -// Currently the sizeof(TX_BLK) is 148 bytes. +/* Currently the sizeof(TX_BLK) is 148 bytes. */ typedef struct _TX_BLK_ { UCHAR QueIdx; - UCHAR TxFrameType; // Indicate the Transmission type of the all frames in one batch - UCHAR TotalFrameNum; // Total frame number want to send-out in one batch - USHORT TotalFragNum; // Total frame fragments required in one batch - USHORT TotalFrameLen; // Total length of all frames want to send-out in one batch + UCHAR TxFrameType; /* Indicate the Transmission type of the all frames in one batch */ + UCHAR TotalFrameNum; /* Total frame number want to send-out in one batch */ + USHORT TotalFragNum; /* Total frame fragments required in one batch */ + USHORT TotalFrameLen; /* Total length of all frames want to send-out in one batch */ QUEUE_HEADER TxPacketList; - MAC_TABLE_ENTRY *pMacEntry; // NULL: packet with 802.11 RA field is multicast/broadcast address + MAC_TABLE_ENTRY *pMacEntry; /* NULL: packet with 802.11 RA field is multicast/broadcast address */ HTTRANSMIT_SETTING *pTransmit; - // Following structure used for the characteristics of a specific packet. + /* Following structure used for the characteristics of a specific packet. */ PNDIS_PACKET pPacket; - PUCHAR pSrcBufHeader; // Reference to the head of sk_buff->data - PUCHAR pSrcBufData; // Reference to the sk_buff->data, will changed depends on hanlding progresss - UINT SrcBufLen; // Length of packet payload which not including Layer 2 header - PUCHAR pExtraLlcSnapEncap; // NULL means no extra LLC/SNAP is required - UCHAR HeaderBuf[128]; // TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP - //RT2870 2.1.0.0 uses only 80 bytes - //RT3070 2.1.1.0 uses only 96 bytes - //RT3090 2.1.0.0 uses only 96 bytes - UCHAR MpduHeaderLen; // 802.11 header length NOT including the padding - UCHAR HdrPadLen; // recording Header Padding Length; - UCHAR apidx; // The interface associated to this packet - UCHAR Wcid; // The MAC entry associated to this packet - UCHAR UserPriority; // priority class of packet - UCHAR FrameGap; // what kind of IFS this packet use - UCHAR MpduReqNum; // number of fragments of this frame - UCHAR TxRate; // TODO: Obsoleted? Should change to MCS? - UCHAR CipherAlg; // cipher alogrithm + PUCHAR pSrcBufHeader; /* Reference to the head of sk_buff->data */ + PUCHAR pSrcBufData; /* Reference to the sk_buff->data, will changed depends on hanlding progresss */ + UINT SrcBufLen; /* Length of packet payload which not including Layer 2 header */ + PUCHAR pExtraLlcSnapEncap; /* NULL means no extra LLC/SNAP is required */ + UCHAR HeaderBuf[128]; /* TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP */ + /*RT2870 2.1.0.0 uses only 80 bytes */ + /*RT3070 2.1.1.0 uses only 96 bytes */ + /*RT3090 2.1.0.0 uses only 96 bytes */ + UCHAR MpduHeaderLen; /* 802.11 header length NOT including the padding */ + UCHAR HdrPadLen; /* recording Header Padding Length; */ + UCHAR apidx; /* The interface associated to this packet */ + UCHAR Wcid; /* The MAC entry associated to this packet */ + UCHAR UserPriority; /* priority class of packet */ + UCHAR FrameGap; /* what kind of IFS this packet use */ + UCHAR MpduReqNum; /* number of fragments of this frame */ + UCHAR TxRate; /* TODO: Obsoleted? Should change to MCS? */ + UCHAR CipherAlg; /* cipher alogrithm */ PCIPHER_KEY pKey; - USHORT Flags; //See following definitions for detail. + USHORT Flags; /*See following definitions for detail. */ - //YOU SHOULD NOT TOUCH IT! Following parameters are used for hardware-depended layer. - ULONG Priv; // Hardware specific value saved in here. + /*YOU SHOULD NOT TOUCH IT! Following parameters are used for hardware-depended layer. */ + ULONG Priv; /* Hardware specific value saved in here. */ } TX_BLK, *PTX_BLK; -#define fTX_bRtsRequired 0x0001 // Indicate if need send RTS frame for protection. Not used in RT2860/RT2870. -#define fTX_bAckRequired 0x0002 // the packet need ack response -#define fTX_bPiggyBack 0x0004 // Legacy device use Piggback or not -#define fTX_bHTRate 0x0008 // allow to use HT rate -#define fTX_bForceNonQoS 0x0010 // force to transmit frame without WMM-QoS in HT mode -#define fTX_bAllowFrag 0x0020 // allow to fragment the packet, A-MPDU, A-MSDU, A-Ralink is not allowed to fragment -#define fTX_bMoreData 0x0040 // there are more data packets in PowerSave Queue -#define fTX_bWMM 0x0080 // QOS Data +#define fTX_bRtsRequired 0x0001 /* Indicate if need send RTS frame for protection. Not used in RT2860/RT2870. */ +#define fTX_bAckRequired 0x0002 /* the packet need ack response */ +#define fTX_bPiggyBack 0x0004 /* Legacy device use Piggback or not */ +#define fTX_bHTRate 0x0008 /* allow to use HT rate */ +#define fTX_bForceNonQoS 0x0010 /* force to transmit frame without WMM-QoS in HT mode */ +#define fTX_bAllowFrag 0x0020 /* allow to fragment the packet, A-MPDU, A-MSDU, A-Ralink is not allowed to fragment */ +#define fTX_bMoreData 0x0040 /* there are more data packets in PowerSave Queue */ +#define fTX_bWMM 0x0080 /* QOS Data */ #define fTX_bClearEAPFrame 0x0100 #define TX_BLK_SET_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags |= _flag) @@ -2278,7 +2278,7 @@ static inline VOID ConvertMulticastIP2MAC(IN PUCHAR pIpAddr, switch (ProtoType) { case ETH_P_IPV6: -// memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS); +/* memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS); */ *(*ppMacAddr) = 0x33; *(*ppMacAddr + 1) = 0x33; *(*ppMacAddr + 2) = pIpAddr[12]; @@ -2289,7 +2289,7 @@ static inline VOID ConvertMulticastIP2MAC(IN PUCHAR pIpAddr, case ETH_P_IP: default: -// memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS); +/* memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS); */ *(*ppMacAddr) = 0x01; *(*ppMacAddr + 1) = 0x00; *(*ppMacAddr + 2) = 0x5e; @@ -2305,9 +2305,9 @@ static inline VOID ConvertMulticastIP2MAC(IN PUCHAR pIpAddr, char *GetPhyMode(int Mode); char *GetBW(int BW); -// -// Private routines in rtmp_init.c -// +/* */ +/* Private routines in rtmp_init.c */ +/* */ NDIS_STATUS RTMPAllocAdapterBlock(IN PVOID handle, OUT PRTMP_ADAPTER * ppAdapter); @@ -2328,7 +2328,7 @@ NDIS_STATUS RT30xxWriteRFRegister(IN PRTMP_ADAPTER pAd, NDIS_STATUS RT30xxReadRFRegister(IN PRTMP_ADAPTER pAd, IN UCHAR regID, IN PUCHAR pValue); -#endif // RTMP_RF_RW_SUPPORT // +#endif /* RTMP_RF_RW_SUPPORT // */ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr); @@ -2386,9 +2386,9 @@ VOID RTMPSetSignalLED(IN PRTMP_ADAPTER pAd, IN NDIS_802_11_RSSI Dbm); VOID RTMPEnableRxTx(IN PRTMP_ADAPTER pAd); -// -// prototype in action.c -// +/* */ +/* prototype in action.c */ +/* */ VOID ActionStateMachineInit(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * S, OUT STATE_MACHINE_FUNC Trans[]); @@ -2444,9 +2444,9 @@ BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd, IN ULONG Wcid, IN ULONG MsgLen, IN PFRAME_BA_REQ pMsg); -// -// Private routines in rtmp_data.c -// +/* */ +/* Private routines in rtmp_data.c */ +/* */ BOOLEAN RTMPHandleRxDoneInterrupt(IN PRTMP_ADAPTER pAd); BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd, @@ -2511,11 +2511,11 @@ NDIS_STATUS MlmeDataHardTransmit(IN PRTMP_ADAPTER pAd, VOID RTMPWriteTxDescriptor(IN PRTMP_ADAPTER pAd, IN PTXD_STRUC pTxD, IN BOOLEAN bWIV, IN UCHAR QSEL); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ USHORT RTMPCalcDuration(IN PRTMP_ADAPTER pAd, IN UCHAR Rate, IN ULONG Size); -VOID RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pTxWI, IN BOOLEAN FRAG, IN BOOLEAN CFACK, IN BOOLEAN InsTimestamp, IN BOOLEAN AMPDU, IN BOOLEAN Ack, IN BOOLEAN NSeq, // HW new a sequence. +VOID RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pTxWI, IN BOOLEAN FRAG, IN BOOLEAN CFACK, IN BOOLEAN InsTimestamp, IN BOOLEAN AMPDU, IN BOOLEAN Ack, IN BOOLEAN NSeq, /* HW new a sequence. */ IN UCHAR BASize, IN UCHAR WCID, IN ULONG Length, @@ -2538,8 +2538,8 @@ VOID RTMPResumeMsduTransmission(IN PRTMP_ADAPTER pAd); NDIS_STATUS MiniportMMRequest(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx, IN PUCHAR pData, IN UINT Length); -//+++mark by shiang, now this function merge to MiniportMMRequest() -//---mark by shiang, now this function merge to MiniportMMRequest() +/*+++mark by shiang, now this function merge to MiniportMMRequest() */ +/*---mark by shiang, now this function merge to MiniportMMRequest() */ VOID RTMPSendNullFrame(IN PRTMP_ADAPTER pAd, IN UCHAR TxRate, IN BOOLEAN bQosNull); @@ -2588,9 +2588,9 @@ BOOLEAN RTMPCheckDHCPFrame(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); -// -// Private routines in rtmp_wep.c -// +/* */ +/* Private routines in rtmp_wep.c */ +/* */ VOID RTMPInitWepEngine(IN PRTMP_ADAPTER pAd, IN PUCHAR pKey, IN UCHAR KeyId, IN UCHAR KeyLen, IN PUCHAR pDest); @@ -2619,11 +2619,11 @@ VOID WPAARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, UINT RTMP_CALC_FCS32(IN UINT Fcs, IN PUCHAR Cp, IN INT Len); -// -// MLME routines -// +/* */ +/* MLME routines */ +/* */ -// Asic/RF/BBP related functions +/* Asic/RF/BBP related functions */ VOID AsicAdjustTxPower(IN PRTMP_ADAPTER pAd); @@ -2711,7 +2711,7 @@ BOOLEAN AsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, #ifdef RTMP_MAC_PCI BOOLEAN AsicCheckCommanOk(IN PRTMP_ADAPTER pAd, IN UCHAR Command); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ VOID MacAddrRandomBssid(IN PRTMP_ADAPTER pAd, OUT PUCHAR pAddr); @@ -2748,7 +2748,7 @@ VOID BssTableDeleteEntry(IN OUT PBSS_TABLE pTab, VOID BATableDeleteORIEntry(IN OUT PRTMP_ADAPTER pAd, IN BA_ORI_ENTRY * pBAORIEntry); -VOID BssEntrySet(IN PRTMP_ADAPTER pAd, OUT PBSS_ENTRY pBss, IN PUCHAR pBssid, IN CHAR Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN USHORT BeaconPeriod, IN PCF_PARM CfParm, IN USHORT AtimWin, IN USHORT CapabilityInfo, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, // AP might use this additional ht info IE +VOID BssEntrySet(IN PRTMP_ADAPTER pAd, OUT PBSS_ENTRY pBss, IN PUCHAR pBssid, IN CHAR Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN USHORT BeaconPeriod, IN PCF_PARM CfParm, IN USHORT AtimWin, IN USHORT CapabilityInfo, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ IN UCHAR HtCapabilityLen, IN UCHAR AddHtInfoLen, IN UCHAR NewExtChanOffset, @@ -2761,7 +2761,7 @@ VOID BssEntrySet(IN PRTMP_ADAPTER pAd, OUT PBSS_ENTRY pBss, IN PUCHAR pBssid, IN IN PQBSS_LOAD_PARM pQbssLoad, IN USHORT LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE); -ULONG BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT PBSS_TABLE pTab, IN PUCHAR pBssid, IN CHAR Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN USHORT BeaconPeriod, IN CF_PARM * CfParm, IN USHORT AtimWin, IN USHORT CapabilityInfo, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, // AP might use this additional ht info IE +ULONG BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT PBSS_TABLE pTab, IN PUCHAR pBssid, IN CHAR Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN USHORT BeaconPeriod, IN CF_PARM * CfParm, IN USHORT AtimWin, IN USHORT CapabilityInfo, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ IN UCHAR HtCapabilityLen, IN UCHAR AddHtInfoLen, IN UCHAR NewExtChanOffset, @@ -2849,7 +2849,7 @@ VOID DisassocTimeout(IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); -//---------------------------------------------- +/*---------------------------------------------- */ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); VOID MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); @@ -2879,7 +2879,7 @@ VOID InvalidStateWhenDisassociate(IN PRTMP_ADAPTER pAd, #ifdef RTMP_MAC_USB VOID MlmeCntlConfirm(IN PRTMP_ADAPTER pAd, IN ULONG MsgType, IN USHORT Msg); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ VOID ComposePsPoll(IN PRTMP_ADAPTER pAd); @@ -2918,7 +2918,7 @@ VOID MlmeDeauthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); VOID InvalidStateWhenAuth(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -//============================================= +/*============================================= */ VOID AuthRspStateMachineInit(IN PRTMP_ADAPTER pAd, IN PSTATE_MACHINE Sm, @@ -2932,11 +2932,11 @@ VOID PeerAuthSimpleRspGenAndSend(IN PRTMP_ADAPTER pAd, IN USHORT Seq, IN USHORT Reason, IN USHORT Status); -// -// Private routines in dls.c -// +/* */ +/* Private routines in dls.c */ +/* */ -//======================================== +/*======================================== */ VOID SyncStateMachineInit(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * Sm, @@ -2959,7 +2959,7 @@ VOID InvalidStateWhenStart(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); VOID EnqueueProbeRequest(IN PRTMP_ADAPTER pAd); BOOLEAN ScanRunning(IN PRTMP_ADAPTER pAd); -//========================================= +/*========================================= */ VOID MlmeCntlInit(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * S, OUT STATE_MACHINE_FUNC Trans[]); @@ -3135,7 +3135,7 @@ BOOLEAN PeerAuthSanity(IN PRTMP_ADAPTER pAd, OUT USHORT * Seq, OUT USHORT * Status, OUT CHAR ChlgText[]); -BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen, OUT PUCHAR pAddr2, OUT USHORT * pCapabilityInfo, OUT USHORT * pStatus, OUT USHORT * pAid, OUT UCHAR SupRate[], OUT UCHAR * pSupRateLen, OUT UCHAR ExtRate[], OUT UCHAR * pExtRateLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT ADD_HT_INFO_IE * pAddHtInfo, // AP might use this additional ht info IE +BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen, OUT PUCHAR pAddr2, OUT USHORT * pCapabilityInfo, OUT USHORT * pStatus, OUT USHORT * pAid, OUT UCHAR SupRate[], OUT UCHAR * pSupRateLen, OUT UCHAR ExtRate[], OUT UCHAR * pExtRateLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ OUT UCHAR * pHtCapabilityLen, OUT UCHAR * pAddHtInfoLen, OUT UCHAR * pNewExtChannelOffset, @@ -3260,7 +3260,7 @@ VOID AsicSetRxAnt(IN PRTMP_ADAPTER pAd, IN UCHAR Ant); VOID RTMPFilterCalibration(IN PRTMP_ADAPTER pAd); #ifdef RTMP_EFUSE_SUPPORT -//2008/09/11:KH add to support efuse<-- +/*2008/09/11:KH add to support efuse<-- */ INT set_eFuseGetFreeBlockCount_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg); INT set_eFusedump_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg); @@ -3274,28 +3274,28 @@ int RtmpEfuseSupportCheck(IN RTMP_ADAPTER * pAd); VOID eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, PUINT EfuseFreeBlock); INT eFuse_init(IN PRTMP_ADAPTER pAd); -//2008/09/11:KH add to support efuse--> -#endif // RTMP_EFUSE_SUPPORT // +/*2008/09/11:KH add to support efuse--> */ +#endif /* RTMP_EFUSE_SUPPORT // */ -// add by johnli, RF power sequence setup +/* add by johnli, RF power sequence setup */ VOID RT30xxLoadRFNormalModeSetup(IN PRTMP_ADAPTER pAd); VOID RT30xxLoadRFSleepModeSetup(IN PRTMP_ADAPTER pAd); VOID RT30xxReverseRFSleepModeSetup(IN PRTMP_ADAPTER pAd); -// end johnli +/* end johnli */ #ifdef RT3070 VOID NICInitRT3070RFRegisters(IN RTMP_ADAPTER * pAd); -#endif // RT3070 // +#endif /* RT3070 // */ #ifdef RT3090 VOID NICInitRT3090RFRegisters(IN RTMP_ADAPTER * pAd); -#endif // RT3090 // +#endif /* RT3090 // */ VOID RT30xxHaltAction(IN PRTMP_ADAPTER pAd); VOID RT30xxSetRxAnt(IN PRTMP_ADAPTER pAd, IN UCHAR Ant); -#endif // RT30xx // +#endif /* RT30xx // */ VOID AsicEvaluateRxAnt(IN PRTMP_ADAPTER pAd); @@ -3333,9 +3333,9 @@ UCHAR NextChannel(IN PRTMP_ADAPTER pAd, IN UCHAR channel); VOID ChangeToCellPowerLimit(IN PRTMP_ADAPTER pAd, IN UCHAR AironetCellPowerLimit); -// -// Prototypes of function definition in rtmp_tkip.c -// +/* */ +/* Prototypes of function definition in rtmp_tkip.c */ +/* */ VOID RTMPInitTkipEngine(IN PRTMP_ADAPTER pAd, IN PUCHAR pTKey, IN UCHAR KeyId, @@ -3375,9 +3375,9 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, IN PUCHAR pData, IN ULONG DataByteCnt, IN PCIPHER_KEY pWpaKey); -// -// Prototypes of function definition in cmm_info.c -// +/* */ +/* Prototypes of function definition in cmm_info.c */ +/* */ INT RT_CfgSetCountryRegion(IN PRTMP_ADAPTER pAd, IN PSTRING arg, IN INT band); INT RT_CfgSetWirelessMode(IN PRTMP_ADAPTER pAd, IN PSTRING arg); @@ -3393,9 +3393,9 @@ INT RT_CfgSetWPAPSKKey(IN RTMP_ADAPTER * pAd, IN UCHAR * pHashStr, IN INT hashStrLen, OUT PUCHAR pPMKBuf); -// -// Prototypes of function definition in cmm_info.c -// +/* */ +/* Prototypes of function definition in cmm_info.c */ +/* */ VOID RTMPWPARemoveAllKeys(IN PRTMP_ADAPTER pAd); VOID RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, IN ULONG phymode); @@ -3478,9 +3478,9 @@ NDIS_STATUS RTMPSoftDecryptBroadCastData(IN PRTMP_ADAPTER pAd, VOID RTMPMakeRSNIE(IN PRTMP_ADAPTER pAd, IN UINT AuthMode, IN UINT WepStatus, IN UCHAR apidx); -// -// function prototype in ap_wpa.c -// +/* */ +/* function prototype in ap_wpa.c */ +/* */ VOID RTMPGetTxTscFromAsic(IN PRTMP_ADAPTER pAd, IN UCHAR apidx, OUT PUCHAR pTxTsc); @@ -3524,7 +3524,7 @@ VOID AES_GTK_KEY_WRAP(IN UCHAR * key, IN UCHAR * plaintext, IN UINT32 p_len, OUT UCHAR * ciphertext); -//typedef void (*TIMER_FUNCTION)(unsigned long); +/*typedef void (*TIMER_FUNCTION)(unsigned long); */ /* timeout -- ms */ VOID RTMP_SetPeriodicTimer(IN NDIS_MINIPORT_TIMER * pTimer, @@ -3675,7 +3675,7 @@ void ba_reordering_resource_release(PRTMP_ADAPTER pAd); PSTRING rstrtok(IN PSTRING s, IN const PSTRING ct); -////////// common ioctl functions ////////// +/*//////// common ioctl functions ////////// */ INT SetCommonHT(IN PRTMP_ADAPTER pAd); INT WpaCheckEapCode(IN PRTMP_ADAPTER pAd, @@ -3688,15 +3688,15 @@ int wext_notify_event_assoc(IN RTMP_ADAPTER * pAd); BOOLEAN STARxDoneInterruptHandle(IN PRTMP_ADAPTER pAd, IN BOOLEAN argc); -// AMPDU packet indication +/* AMPDU packet indication */ VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); -// AMSDU packet indication +/* AMSDU packet indication */ VOID Indicate_AMSDU_Packet(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); -// Normal legacy Rx packet indication +/* Normal legacy Rx packet indication */ VOID Indicate_Legacy_Packet(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); @@ -3711,7 +3711,7 @@ void wlan_802_11_to_802_3_packet(IN PRTMP_ADAPTER pAd, IN PUCHAR pHeader802_3, IN UCHAR FromWhichBSSID); -// remove LLC and get 802_3 Header +/* remove LLC and get 802_3 Header */ #define RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(_pRxBlk, _pHeader802_3) \ { \ PUCHAR _pRemovedLLCSNAP = NULL, _pDA, _pSA; \ @@ -3748,7 +3748,7 @@ VOID Sta_Announce_or_Forward_802_3_Packet(IN PRTMP_ADAPTER pAd, #define ANNOUNCE_OR_FORWARD_802_3_PACKET(_pAd, _pPacket, _FromWhichBSS)\ Sta_Announce_or_Forward_802_3_Packet(_pAd, _pPacket, _FromWhichBSS); - //announce_802_3_packet(_pAd, _pPacket); + /*announce_802_3_packet(_pAd, _pPacket); */ PNDIS_PACKET DuplicatePacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket, IN UCHAR FromWhichBSSID); @@ -3757,7 +3757,7 @@ PNDIS_PACKET ClonePacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket, IN PUCHAR pData, IN ULONG DataSize); -// Normal, AMPDU or AMSDU +/* Normal, AMPDU or AMSDU */ VOID CmmRxnonRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); @@ -3913,9 +3913,9 @@ INT RtmpRaDevCtrlInit(IN RTMP_ADAPTER * pAd, IN RTMP_INF_TYPE infType); BOOLEAN RtmpRaDevCtrlExit(IN RTMP_ADAPTER * pAd); #ifdef RTMP_MAC_PCI -// -// Function Prototype in cmm_data_pci.c -// +/* */ +/* Function Prototype in cmm_data_pci.c */ +/* */ USHORT RtmpPCI_WriteTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, IN BOOLEAN bIsLast, OUT USHORT * FreeNumber); @@ -3988,12 +3988,12 @@ VOID RT28xxPciStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, VOID RT28xxPciMlmeRadioOn(IN PRTMP_ADAPTER pAd); VOID RT28xxPciMlmeRadioOFF(IN PRTMP_ADAPTER pAd); -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB -// -// Function Prototype in rtusb_bulk.c -// +/* */ +/* Function Prototype in rtusb_bulk.c */ +/* */ VOID RTUSBInitTxDesc(IN PRTMP_ADAPTER pAd, IN PTX_CONTEXT pTxContext, IN UCHAR BulkOutPipeId, IN usb_complete_t Func); @@ -4036,9 +4036,9 @@ VOID RTUSBInitRxDesc(IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext); VOID RTUSBBulkRxHandle(IN unsigned long data); -// -// Function Prototype in rtusb_io.c -// +/* */ +/* Function Prototype in rtusb_io.c */ +/* */ NTSTATUS RTUSBMultiRead(IN PRTMP_ADAPTER pAd, IN USHORT Offset, OUT PUCHAR pData, IN USHORT length); @@ -4152,9 +4152,9 @@ VOID RTUSBMlmeHardTransmit(IN PRTMP_ADAPTER pAd, IN PMGMT_STRUC pMgmt); INT MlmeThread(IN PVOID Context); -// -// Function Prototype in rtusb_data.c -// +/* */ +/* Function Prototype in rtusb_data.c */ +/* */ NDIS_STATUS RTUSBFreeDescriptorRequest(IN PRTMP_ADAPTER pAd, IN UCHAR BulkOutPipeId, IN UINT32 NumberRequired); @@ -4167,9 +4167,9 @@ VOID RTMPWriteTxInfo(IN PRTMP_ADAPTER pAd, IN BOOLEAN bWiv, IN UCHAR QueueSel, IN UCHAR NextValid, IN UCHAR TxBurst); -// -// Function Prototype in cmm_data_usb.c -// +/* */ +/* Function Prototype in cmm_data_usb.c */ +/* */ USHORT RtmpUSB_WriteSubTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, IN BOOLEAN bIsLast, OUT USHORT * FreeNumber); @@ -4219,7 +4219,7 @@ VOID RT28xxUsbStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, VOID RT28xxUsbMlmeRadioOn(IN PRTMP_ADAPTER pAd); VOID RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ VOID AsicTurnOffRFClk(IN PRTMP_ADAPTER pAd, IN UCHAR Channel); @@ -4237,7 +4237,7 @@ BOOLEAN RtmpTimerQRemove(IN RTMP_ADAPTER * pAd, void RtmpTimerQExit(IN RTMP_ADAPTER * pAd); void RtmpTimerQInit(IN RTMP_ADAPTER * pAd); -#endif // RTMP_TIMER_TASK_SUPPORT // +#endif /* RTMP_TIMER_TASK_SUPPORT // */ VOID AsicStaBbpTuning(IN PRTMP_ADAPTER pAd); @@ -4291,7 +4291,7 @@ __inline VOID VIRTUAL_IF_DOWN(PRTMP_ADAPTER pAd) rt28xx_close(pAd->net_dev); return; } -#endif // LINUX // +#endif /* LINUX // */ /* OS Related funciton prototype definitions. @@ -4353,4 +4353,4 @@ int RtmpOSFileRead(IN RTMP_OS_FD osfd, IN char *pDataPtr, IN int readLen); int RtmpOSFileWrite(IN RTMP_OS_FD osfd, IN char *pDataPtr, IN int writeLen); -#endif // __RTMP_H__ +#endif /* __RTMP_H__ */ diff --git a/drivers/staging/rt2860/rtmp_chip.h b/drivers/staging/rt2860/rtmp_chip.h index 7fa73e65b29c..ea8d2ed52309 100644 --- a/drivers/staging/rt2860/rtmp_chip.h +++ b/drivers/staging/rt2860/rtmp_chip.h @@ -42,30 +42,30 @@ #ifdef RT2860 #include "chip/rt2860.h" -#endif // RT2860 // +#endif /* RT2860 // */ #ifdef RT2870 #include "chip/rt2870.h" -#endif // RT2870 // +#endif /* RT2870 // */ #ifdef RT3070 #include "chip/rt3070.h" -#endif // RT3070 // +#endif /* RT3070 // */ #ifdef RT3090 #include "chip/rt3090.h" -#endif // RT3090 // +#endif /* RT3090 // */ -// We will have a cost down version which mac version is 0x3090xxxx -// -// RT3090A facts -// -// a) 2.4 GHz -// b) Replacement for RT3090 -// c) Internal LNA -// d) Interference over channel #14 -// e) New BBP features (e.g., SIG re-modulation) -// +/* We will have a cost down version which mac version is 0x3090xxxx */ +/* */ +/* RT3090A facts */ +/* */ +/* a) 2.4 GHz */ +/* b) Replacement for RT3090 */ +/* c) Internal LNA */ +/* d) Interference over channel #14 */ +/* e) New BBP features (e.g., SIG re-modulation) */ +/* */ #define IS_RT3090A(_pAd) ((((_pAd)->MACVersion & 0xffff0000) == 0x30900000)) -// We will have a cost down version which mac version is 0x3090xxxx +/* We will have a cost down version which mac version is 0x3090xxxx */ #define IS_RT3090(_pAd) ((((_pAd)->MACVersion & 0xffff0000) == 0x30710000) || (IS_RT3090A(_pAd))) #define IS_RT3070(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x30700000) @@ -73,28 +73,28 @@ #define IS_RT2070(_pAd) (((_pAd)->RfIcType == RFIC_2020) || ((_pAd)->EFuseTag == 0x27)) #define IS_RT30xx(_pAd) (((_pAd)->MACVersion & 0xfff00000) == 0x30700000||IS_RT3090A(_pAd)) -//#define IS_RT305X(_pAd) ((_pAd)->MACVersion == 0x28720200) +/*#define IS_RT305X(_pAd) ((_pAd)->MACVersion == 0x28720200) */ /* RT3572, 3592, 3562, 3062 share the same MAC version */ #define IS_RT3572(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x35720000) #define IS_VERSION_BEFORE_F(_pAd) (((_pAd)->MACVersion&0xffff) <= 0x0211) -// F version is 0x0212, E version is 0x0211. 309x can save more power after F version. +/* F version is 0x0212, E version is 0x0211. 309x can save more power after F version. */ #define IS_VERSION_AFTER_F(_pAd) ((((_pAd)->MACVersion&0xffff) >= 0x0212) || (((_pAd)->b3090ESpecialChip == TRUE))) -// -// RT3390 facts -// -// a) Base on RT3090 (RF IC: RT3020) -// b) 2.4 GHz -// c) 1x1 -// d) Single chip -// e) Internal components: PA and LNA -// -//RT3390,RT3370 +/* */ +/* RT3390 facts */ +/* */ +/* a) Base on RT3090 (RF IC: RT3020) */ +/* b) 2.4 GHz */ +/* c) 1x1 */ +/* d) Single chip */ +/* e) Internal components: PA and LNA */ +/* */ +/*RT3390,RT3370 */ #define IS_RT3390(_pAd) (((_pAd)->MACVersion & 0xFFFF0000) == 0x33900000) -// ------------------------------------------------------ -// PCI registers - base address 0x0000 -// ------------------------------------------------------ +/* ------------------------------------------------------ */ +/* PCI registers - base address 0x0000 */ +/* ------------------------------------------------------ */ #define CHIP_PCI_CFG 0x0000 #define CHIP_PCI_EECTRL 0x0004 #define CHIP_PCI_MCUCTRL 0x0008 @@ -103,15 +103,15 @@ #define RETRY_LIMIT 10 -// ------------------------------------------------------ -// BBP & RF definition -// ------------------------------------------------------ +/* ------------------------------------------------------ */ +/* BBP & RF definition */ +/* ------------------------------------------------------ */ #define BUSY 1 #define IDLE 0 -//------------------------------------------------------------------------- -// EEPROM definition -//------------------------------------------------------------------------- +/*------------------------------------------------------------------------- */ +/* EEPROM definition */ +/*------------------------------------------------------------------------- */ #define EEDO 0x08 #define EEDI 0x04 #define EECS 0x02 @@ -123,11 +123,11 @@ #define EEPROM_EWDS_OPCODE 0x10 #define EEPROM_EWEN_OPCODE 0x13 -#define NUM_EEPROM_BBP_PARMS 19 // Include NIC Config 0, 1, CR, TX ALC step, BBPs +#define NUM_EEPROM_BBP_PARMS 19 /* Include NIC Config 0, 1, CR, TX ALC step, BBPs */ #define NUM_EEPROM_TX_G_PARMS 7 -#define EEPROM_NIC1_OFFSET 0x34 // The address is from NIC config 0, not BBP register ID -#define EEPROM_NIC2_OFFSET 0x36 // The address is from NIC config 0, not BBP register ID -#define EEPROM_BBP_BASE_OFFSET 0xf0 // The address is from NIC config 0, not BBP register ID +#define EEPROM_NIC1_OFFSET 0x34 /* The address is from NIC config 0, not BBP register ID */ +#define EEPROM_NIC2_OFFSET 0x36 /* The address is from NIC config 0, not BBP register ID */ +#define EEPROM_BBP_BASE_OFFSET 0xf0 /* The address is from NIC config 0, not BBP register ID */ #define EEPROM_G_TX_PWR_OFFSET 0x52 #define EEPROM_G_TX2_PWR_OFFSET 0x60 #define EEPROM_LED1_OFFSET 0x3c @@ -139,22 +139,22 @@ #define EEPROM_RSSI_A_OFFSET 0x4a #define EEPROM_TXMIXER_GAIN_5G 0x4c #define EEPROM_DEFINE_MAX_TXPWR 0x4e -#define EEPROM_TXPOWER_BYRATE_20MHZ_2_4G 0xde // 20MHZ 2.4G tx power. -#define EEPROM_TXPOWER_BYRATE_40MHZ_2_4G 0xee // 40MHZ 2.4G tx power. -#define EEPROM_TXPOWER_BYRATE_20MHZ_5G 0xfa // 20MHZ 5G tx power. -#define EEPROM_TXPOWER_BYRATE_40MHZ_5G 0x10a // 40MHZ 5G tx power. +#define EEPROM_TXPOWER_BYRATE_20MHZ_2_4G 0xde /* 20MHZ 2.4G tx power. */ +#define EEPROM_TXPOWER_BYRATE_40MHZ_2_4G 0xee /* 40MHZ 2.4G tx power. */ +#define EEPROM_TXPOWER_BYRATE_20MHZ_5G 0xfa /* 20MHZ 5G tx power. */ +#define EEPROM_TXPOWER_BYRATE_40MHZ_5G 0x10a /* 40MHZ 5G tx power. */ #define EEPROM_A_TX_PWR_OFFSET 0x78 #define EEPROM_A_TX2_PWR_OFFSET 0xa6 -//#define EEPROM_Japan_TX_PWR_OFFSET 0x90 // 802.11j -//#define EEPROM_Japan_TX2_PWR_OFFSET 0xbe -//#define EEPROM_TSSI_REF_OFFSET 0x54 -//#define EEPROM_TSSI_DELTA_OFFSET 0x24 -//#define EEPROM_CCK_TX_PWR_OFFSET 0x62 -//#define EEPROM_CALIBRATE_OFFSET 0x7c +/*#define EEPROM_Japan_TX_PWR_OFFSET 0x90 // 802.11j */ +/*#define EEPROM_Japan_TX2_PWR_OFFSET 0xbe */ +/*#define EEPROM_TSSI_REF_OFFSET 0x54 */ +/*#define EEPROM_TSSI_DELTA_OFFSET 0x24 */ +/*#define EEPROM_CCK_TX_PWR_OFFSET 0x62 */ +/*#define EEPROM_CALIBRATE_OFFSET 0x7c */ #define EEPROM_VERSION_OFFSET 0x02 #define EEPROM_FREQ_OFFSET 0x3a -#define EEPROM_TXPOWER_BYRATE 0xde // 20MHZ power. -#define EEPROM_TXPOWER_DELTA 0x50 // 20MHZ AND 40 MHZ use different power. This is delta in 40MHZ. +#define EEPROM_TXPOWER_BYRATE 0xde /* 20MHZ power. */ +#define EEPROM_TXPOWER_DELTA 0x50 /* 20MHZ AND 40 MHZ use different power. This is delta in 40MHZ. */ #define VALID_EEPROM_VERSION 1 /* @@ -163,13 +163,13 @@ #define RT28xx_EEPROM_READ16(_pAd, _offset, _value) \ (_pAd)->chipOps.eeread((RTMP_ADAPTER *)(_pAd), (USHORT)(_offset), (PUSHORT)&(_value)) -// ------------------------------------------------------------------- -// E2PROM data layout -// ------------------------------------------------------------------- +/* ------------------------------------------------------------------- */ +/* E2PROM data layout */ +/* ------------------------------------------------------------------- */ -// -// MCU_LEDCS: MCU LED Control Setting. -// +/* */ +/* MCU_LEDCS: MCU LED Control Setting. */ +/* */ typedef union _MCU_LEDCS_STRUC { struct { UCHAR LedMode:7; @@ -178,14 +178,14 @@ typedef union _MCU_LEDCS_STRUC { UCHAR word; } MCU_LEDCS_STRUC, *PMCU_LEDCS_STRUC; -// -// EEPROM antenna select format -// +/* */ +/* EEPROM antenna select format */ +/* */ typedef union _EEPROM_ANTENNA_STRUC { struct { - USHORT RxPath:4; // 1: 1R, 2: 2R, 3: 3R - USHORT TxPath:4; // 1: 1T, 2: 2T - USHORT RfIcType:4; // see E2PROM document + USHORT RxPath:4; /* 1: 1R, 2: 2R, 3: 3R */ + USHORT TxPath:4; /* 1: 1T, 2: 2T */ + USHORT RfIcType:4; /* see E2PROM document */ USHORT Rsv:4; } field; USHORT word; @@ -193,66 +193,66 @@ typedef union _EEPROM_ANTENNA_STRUC { typedef union _EEPROM_NIC_CINFIG2_STRUC { struct { - USHORT HardwareRadioControl:1; // 1:enable, 0:disable - USHORT DynamicTxAgcControl:1; // - USHORT ExternalLNAForG:1; // - USHORT ExternalLNAForA:1; // external LNA enable for 2.4G - USHORT CardbusAcceleration:1; // !!! NOTE: 0 - enable, 1 - disable + USHORT HardwareRadioControl:1; /* 1:enable, 0:disable */ + USHORT DynamicTxAgcControl:1; /* */ + USHORT ExternalLNAForG:1; /* */ + USHORT ExternalLNAForA:1; /* external LNA enable for 2.4G */ + USHORT CardbusAcceleration:1; /* !!! NOTE: 0 - enable, 1 - disable */ USHORT BW40MSidebandForG:1; USHORT BW40MSidebandForA:1; - USHORT EnableWPSPBC:1; // WPS PBC Control bit - USHORT BW40MAvailForG:1; // 0:enable, 1:disable - USHORT BW40MAvailForA:1; // 0:enable, 1:disable - USHORT Rsv1:1; // must be 0 - USHORT AntDiversity:1; // Antenna diversity - USHORT Rsv2:3; // must be 0 - USHORT DACTestBit:1; // control if driver should patch the DAC issue + USHORT EnableWPSPBC:1; /* WPS PBC Control bit */ + USHORT BW40MAvailForG:1; /* 0:enable, 1:disable */ + USHORT BW40MAvailForA:1; /* 0:enable, 1:disable */ + USHORT Rsv1:1; /* must be 0 */ + USHORT AntDiversity:1; /* Antenna diversity */ + USHORT Rsv2:3; /* must be 0 */ + USHORT DACTestBit:1; /* control if driver should patch the DAC issue */ } field; USHORT word; } EEPROM_NIC_CONFIG2_STRUC, *PEEPROM_NIC_CONFIG2_STRUC; -// -// TX_PWR Value valid range 0xFA(-6) ~ 0x24(36) -// +/* */ +/* TX_PWR Value valid range 0xFA(-6) ~ 0x24(36) */ +/* */ typedef union _EEPROM_TX_PWR_STRUC { struct { - CHAR Byte0; // Low Byte - CHAR Byte1; // High Byte + CHAR Byte0; /* Low Byte */ + CHAR Byte1; /* High Byte */ } field; USHORT word; } EEPROM_TX_PWR_STRUC, *PEEPROM_TX_PWR_STRUC; typedef union _EEPROM_VERSION_STRUC { struct { - UCHAR FaeReleaseNumber; // Low Byte - UCHAR Version; // High Byte + UCHAR FaeReleaseNumber; /* Low Byte */ + UCHAR Version; /* High Byte */ } field; USHORT word; } EEPROM_VERSION_STRUC, *PEEPROM_VERSION_STRUC; typedef union _EEPROM_LED_STRUC { struct { - USHORT PolarityRDY_G:1; // Polarity RDY_G setting. - USHORT PolarityRDY_A:1; // Polarity RDY_A setting. - USHORT PolarityACT:1; // Polarity ACT setting. - USHORT PolarityGPIO_0:1; // Polarity GPIO#0 setting. - USHORT PolarityGPIO_1:1; // Polarity GPIO#1 setting. - USHORT PolarityGPIO_2:1; // Polarity GPIO#2 setting. - USHORT PolarityGPIO_3:1; // Polarity GPIO#3 setting. - USHORT PolarityGPIO_4:1; // Polarity GPIO#4 setting. - USHORT LedMode:5; // Led mode. - USHORT Rsvd:3; // Reserved + USHORT PolarityRDY_G:1; /* Polarity RDY_G setting. */ + USHORT PolarityRDY_A:1; /* Polarity RDY_A setting. */ + USHORT PolarityACT:1; /* Polarity ACT setting. */ + USHORT PolarityGPIO_0:1; /* Polarity GPIO#0 setting. */ + USHORT PolarityGPIO_1:1; /* Polarity GPIO#1 setting. */ + USHORT PolarityGPIO_2:1; /* Polarity GPIO#2 setting. */ + USHORT PolarityGPIO_3:1; /* Polarity GPIO#3 setting. */ + USHORT PolarityGPIO_4:1; /* Polarity GPIO#4 setting. */ + USHORT LedMode:5; /* Led mode. */ + USHORT Rsvd:3; /* Reserved */ } field; USHORT word; } EEPROM_LED_STRUC, *PEEPROM_LED_STRUC; typedef union _EEPROM_TXPOWER_DELTA_STRUC { struct { - UCHAR DeltaValue:6; // Tx Power dalta value (MAX=4) - UCHAR Type:1; // 1: plus the delta value, 0: minus the delta value - UCHAR TxPowerEnable:1; // Enable + UCHAR DeltaValue:6; /* Tx Power dalta value (MAX=4) */ + UCHAR Type:1; /* 1: plus the delta value, 0: minus the delta value */ + UCHAR TxPowerEnable:1; /* Enable */ } field; UCHAR value; } EEPROM_TXPOWER_DELTA_STRUC, *PEEPROM_TXPOWER_DELTA_STRUC; -#endif // __RTMP_CHIP_H__ // +#endif /* __RTMP_CHIP_H__ // */ diff --git a/drivers/staging/rt2860/rtmp_ckipmic.h b/drivers/staging/rt2860/rtmp_ckipmic.h index ad35dca27dcc..a8108f78795f 100644 --- a/drivers/staging/rt2860/rtmp_ckipmic.h +++ b/drivers/staging/rt2860/rtmp_ckipmic.h @@ -60,4 +60,4 @@ VOID shift_row(IN PUCHAR in, OUT PUCHAR out); VOID mix_column(IN PUCHAR in, OUT PUCHAR out); -#endif //__RTMP_CKIPMIC_H__ +#endif /*__RTMP_CKIPMIC_H__ */ diff --git a/drivers/staging/rt2860/rtmp_def.h b/drivers/staging/rt2860/rtmp_def.h index 31b52d6ba1df..39c27f9c8614 100644 --- a/drivers/staging/rt2860/rtmp_def.h +++ b/drivers/staging/rt2860/rtmp_def.h @@ -41,9 +41,9 @@ #include "oid.h" -// -// Debug information verbosity: lower values indicate higher urgency -// +/* */ +/* Debug information verbosity: lower values indicate higher urgency */ +/* */ #define RT_DEBUG_OFF 0 #define RT_DEBUG_ERROR 1 #define RT_DEBUG_WARN 2 @@ -55,15 +55,15 @@ #define NIC_DBG_STRING ("**RT28xx**") #ifdef RTMP_MAC_USB -#define TX_RING_SIZE 8 // 1 +#define TX_RING_SIZE 8 /* 1 */ #define PRIO_RING_SIZE 8 -#define MGMT_RING_SIZE 32 // PRIO_RING_SIZE +#define MGMT_RING_SIZE 32 /* PRIO_RING_SIZE */ #define RX_RING_SIZE 8 #define MAX_TX_PROCESS 4 #define LOCAL_TXBUF_SIZE 2048 -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ -//#define PACKED +/*#define PACKED */ #define RALINK_2883_VERSION ((UINT32)0x28830300) #define RALINK_2880E_VERSION ((UINT32)0x28720200) @@ -71,38 +71,38 @@ #define MAX_RX_PKT_LEN 1520 -// -// Entry number for each DMA descriptor ring -// +/* */ +/* Entry number for each DMA descriptor ring */ +/* */ #ifdef RTMP_MAC_PCI -#define TX_RING_SIZE 64 //64 +#define TX_RING_SIZE 64 /*64 */ #define MGMT_RING_SIZE 128 -#define RX_RING_SIZE 128 //64 -#define MAX_TX_PROCESS TX_RING_SIZE //8 +#define RX_RING_SIZE 128 /*64 */ +#define MAX_TX_PROCESS TX_RING_SIZE /*8 */ #define MAX_DMA_DONE_PROCESS TX_RING_SIZE -#define MAX_TX_DONE_PROCESS TX_RING_SIZE //8 +#define MAX_TX_DONE_PROCESS TX_RING_SIZE /*8 */ #define LOCAL_TXBUF_SIZE 2 -#endif // RTMP_MAC_PCI // +#endif /* RTMP_MAC_PCI // */ -#define MAX_RX_PROCESS 128 //64 //32 +#define MAX_RX_PROCESS 128 /*64 //32 */ #define NUM_OF_LOCAL_TXBUF 2 #define TXD_SIZE 16 #define TXWI_SIZE 16 #define RXD_SIZE 16 #define RXWI_SIZE 16 -// TXINFO_SIZE + TXWI_SIZE + 802.11 Header Size + AMSDU sub frame header -#define TX_DMA_1ST_BUFFER_SIZE 96 // only the 1st physical buffer is pre-allocated -#define MGMT_DMA_BUFFER_SIZE 1536 //2048 -#define RX_BUFFER_AGGRESIZE 3840 //3904 //3968 //4096 //2048 //4096 -#define RX_BUFFER_NORMSIZE 3840 //3904 //3968 //4096 //2048 //4096 +/* TXINFO_SIZE + TXWI_SIZE + 802.11 Header Size + AMSDU sub frame header */ +#define TX_DMA_1ST_BUFFER_SIZE 96 /* only the 1st physical buffer is pre-allocated */ +#define MGMT_DMA_BUFFER_SIZE 1536 /*2048 */ +#define RX_BUFFER_AGGRESIZE 3840 /*3904 //3968 //4096 //2048 //4096 */ +#define RX_BUFFER_NORMSIZE 3840 /*3904 //3968 //4096 //2048 //4096 */ #define TX_BUFFER_NORMSIZE RX_BUFFER_NORMSIZE -#define MAX_FRAME_SIZE 2346 // Maximum 802.11 frame size -#define MAX_AGGREGATION_SIZE 3840 //3904 //3968 //4096 +#define MAX_FRAME_SIZE 2346 /* Maximum 802.11 frame size */ +#define MAX_AGGREGATION_SIZE 3840 /*3904 //3968 //4096 */ #define MAX_NUM_OF_TUPLE_CACHE 2 #define MAX_MCAST_LIST_SIZE 32 #define MAX_LEN_OF_VENDOR_DESC 64 -//#define MAX_SIZE_OF_MCAST_PSQ (NUM_OF_LOCAL_TXBUF >> 2) // AP won't spend more than 1/4 of total buffers on M/BCAST PSQ +/*#define MAX_SIZE_OF_MCAST_PSQ (NUM_OF_LOCAL_TXBUF >> 2) // AP won't spend more than 1/4 of total buffers on M/BCAST PSQ */ #define MAX_SIZE_OF_MCAST_PSQ 32 #define MAX_RX_PROCESS_CNT (RX_RING_SIZE) @@ -125,27 +125,27 @@ And in rt_main_end.c, clConfig.clNum = RX_RING_SIZE * 3; is changed to clConfig.clNum = RX_RING_SIZE * 4; */ -// TODO: For VxWorks the size is 256. Shall we cahnge the value as 256 for all OS????? -#define MAX_PACKETS_IN_QUEUE (512) //(512) // to pass WMM A5-WPAPSK +/* TODO: For VxWorks the size is 256. Shall we cahnge the value as 256 for all OS????? */ +#define MAX_PACKETS_IN_QUEUE (512) /*(512) // to pass WMM A5-WPAPSK */ #define MAX_PACKETS_IN_MCAST_PS_QUEUE 32 -#define MAX_PACKETS_IN_PS_QUEUE 128 //32 +#define MAX_PACKETS_IN_PS_QUEUE 128 /*32 */ #define WMM_NUM_OF_AC 4 /* AC0, AC1, AC2, and AC3 */ #ifdef RTMP_EFUSE_SUPPORT -//2008/09/11:KH add to support efuse<-- +/*2008/09/11:KH add to support efuse<-- */ #define MAX_EEPROM_BIN_FILE_SIZE 1024 #define EFUSE_BUFFER_PATH "/tmp/RT30xxEEPROM.bin" -//2008/09/11:KH add to support efuse--> -#endif // RTMP_EFUSE_SUPPORT // +/*2008/09/11:KH add to support efuse--> */ +#endif /* RTMP_EFUSE_SUPPORT // */ -// RxFilter +/* RxFilter */ #define STANORMAL 0x17f97 #define APNORMAL 0x15f97 #define PSPXLINK 0x17f93 -// -// RTMP_ADAPTER flags -// +/* */ +/* RTMP_ADAPTER flags */ +/* */ #define fRTMP_ADAPTER_MAP_REGISTER 0x00000001 #define fRTMP_ADAPTER_INTERRUPT_IN_USE 0x00000002 #define fRTMP_ADAPTER_HARDWARE_ERROR 0x00000004 @@ -171,13 +171,13 @@ #define fRTMP_ADAPTER_SCAN_2040 0x04000000 #define fRTMP_ADAPTER_RADIO_MEASUREMENT 0x08000000 -#define fRTMP_ADAPTER_START_UP 0x10000000 //Devive already initialized and enabled Tx/Rx. +#define fRTMP_ADAPTER_START_UP 0x10000000 /*Devive already initialized and enabled Tx/Rx. */ #define fRTMP_ADAPTER_MEDIA_STATE_CHANGE 0x20000000 #define fRTMP_ADAPTER_IDLE_RADIO_OFF 0x40000000 -// -// STA operation status flags -// +/* */ +/* STA operation status flags */ +/* */ #define fOP_STATUS_INFRA_ON 0x00000001 #define fOP_STATUS_ADHOC_ON 0x00000002 #define fOP_STATUS_BG_PROTECTION_INUSED 0x00000004 @@ -187,8 +187,8 @@ #define fOP_STATUS_MEDIA_STATE_CONNECTED 0x00000080 #define fOP_STATUS_WMM_INUSED 0x00000100 #define fOP_STATUS_AGGREGATION_INUSED 0x00000200 -#define fOP_STATUS_DOZE 0x00000400 // debug purpose -#define fOP_STATUS_PIGGYBACK_INUSED 0x00000800 // piggy-back, and aggregation +#define fOP_STATUS_DOZE 0x00000400 /* debug purpose */ +#define fOP_STATUS_PIGGYBACK_INUSED 0x00000800 /* piggy-back, and aggregation */ #define fOP_STATUS_APSD_INUSED 0x00001000 #define fOP_STATUS_TX_AMSDU_INUSED 0x00002000 #define fOP_STATUS_MAX_RETRY_ENABLED 0x00004000 @@ -196,25 +196,25 @@ #define fOP_STATUS_PCIE_DEVICE 0x00020000 #define fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE fOP_STATUS_PCIE_DEVICE -// -// RTMP_ADAPTER PSFlags : related to advanced power save. -// -// Indicate whether driver can go to sleep mode from now. This flag is useful AFTER link up +/* */ +/* RTMP_ADAPTER PSFlags : related to advanced power save. */ +/* */ +/* Indicate whether driver can go to sleep mode from now. This flag is useful AFTER link up */ #define fRTMP_PS_CAN_GO_SLEEP 0x00000001 -// Indicate whether driver has issue a LinkControl command to PCIe L1 +/* Indicate whether driver has issue a LinkControl command to PCIe L1 */ #define fRTMP_PS_SET_PCI_CLK_OFF_COMMAND 0x00000002 -// Indicate driver should disable kick off hardware to send packets from now. +/* Indicate driver should disable kick off hardware to send packets from now. */ #define fRTMP_PS_DISABLE_TX 0x00000004 -// Indicate driver should IMMEDIATELY fo to sleep after receiving AP's beacon in which doesn't indicate unicate nor multicast packets for me -//. This flag is used ONLY in RTMPHandleRxDoneInterrupt routine. +/* Indicate driver should IMMEDIATELY fo to sleep after receiving AP's beacon in which doesn't indicate unicate nor multicast packets for me */ +/*. This flag is used ONLY in RTMPHandleRxDoneInterrupt routine. */ #define fRTMP_PS_GO_TO_SLEEP_NOW 0x00000008 -#define fRTMP_PS_TOGGLE_L1 0x00000010 // Use Toggle L1 mechanism for rt28xx PCIe +#define fRTMP_PS_TOGGLE_L1 0x00000010 /* Use Toggle L1 mechanism for rt28xx PCIe */ #ifdef RT3090 #define WAKE_MCU_CMD 0x31 #define SLEEP_MCU_CMD 0x30 #define RFOFF_MCU_CMD 0x35 -#endif // RT3090 // +#endif /* RT3090 // */ #define CCKSETPROTECT 0x1 #define OFDMSETPROTECT 0x2 @@ -224,12 +224,12 @@ #define GR40SETPROTECT 0x20 #define ALLN_SETPROTECT (GR40SETPROTECT | GF20SETPROTECT | MM40SETPROTECT | MM20SETPROTECT) -// -// AP's client table operation status flags -// -#define fCLIENT_STATUS_WMM_CAPABLE 0x00000001 // CLIENT can parse QOS DATA frame -#define fCLIENT_STATUS_AGGREGATION_CAPABLE 0x00000002 // CLIENT can receive Ralink's proprietary TX aggregation frame -#define fCLIENT_STATUS_PIGGYBACK_CAPABLE 0x00000004 // CLIENT support piggy-back +/* */ +/* AP's client table operation status flags */ +/* */ +#define fCLIENT_STATUS_WMM_CAPABLE 0x00000001 /* CLIENT can parse QOS DATA frame */ +#define fCLIENT_STATUS_AGGREGATION_CAPABLE 0x00000002 /* CLIENT can receive Ralink's proprietary TX aggregation frame */ +#define fCLIENT_STATUS_PIGGYBACK_CAPABLE 0x00000004 /* CLIENT support piggy-back */ #define fCLIENT_STATUS_AMSDU_INUSED 0x00000008 #define fCLIENT_STATUS_SGI20_CAPABLE 0x00000010 #define fCLIENT_STATUS_SGI40_CAPABLE 0x00000020 @@ -241,45 +241,45 @@ #define fCLIENT_STATUS_APSD_CAPABLE 0x00000800 /* UAPSD STATION */ #define fCLIENT_STATUS_RALINK_CHIPSET 0x00100000 -// -// STA configuration flags -// +/* */ +/* STA configuration flags */ +/* */ -// 802.11n Operating Mode Definition. 0-3 also used in ASICUPdateProtect switch case +/* 802.11n Operating Mode Definition. 0-3 also used in ASICUPdateProtect switch case */ #define HT_NO_PROTECT 0 #define HT_LEGACY_PROTECT 1 #define HT_40_PROTECT 2 #define HT_2040_PROTECT 3 #define HT_RTSCTS_6M 7 -//following is our own definition in order to turn on our ASIC protection register in INFRASTRUCTURE. -#define HT_ATHEROS 8 // rt2860c has problem with atheros chip. we need to turn on RTS/CTS . -#define HT_FORCERTSCTS 9 // Force turn on RTS/CTS first. then go to evaluate if this force RTS is necessary. +/*following is our own definition in order to turn on our ASIC protection register in INFRASTRUCTURE. */ +#define HT_ATHEROS 8 /* rt2860c has problem with atheros chip. we need to turn on RTS/CTS . */ +#define HT_FORCERTSCTS 9 /* Force turn on RTS/CTS first. then go to evaluate if this force RTS is necessary. */ -// -// RX Packet Filter control flags. Apply on pAd->PacketFilter -// +/* */ +/* RX Packet Filter control flags. Apply on pAd->PacketFilter */ +/* */ #define fRX_FILTER_ACCEPT_DIRECT NDIS_PACKET_TYPE_DIRECTED #define fRX_FILTER_ACCEPT_MULTICAST NDIS_PACKET_TYPE_MULTICAST #define fRX_FILTER_ACCEPT_BROADCAST NDIS_PACKET_TYPE_BROADCAST #define fRX_FILTER_ACCEPT_ALL_MULTICAST NDIS_PACKET_TYPE_ALL_MULTICAST #define fRX_FILTER_ACCEPT_PROMISCUOUS NDIS_PACKET_TYPE_PROMISCUOUS -// -// Error code section -// -// NDIS_ERROR_CODE_ADAPTER_NOT_FOUND +/* */ +/* Error code section */ +/* */ +/* NDIS_ERROR_CODE_ADAPTER_NOT_FOUND */ #define ERRLOG_READ_PCI_SLOT_FAILED 0x00000101L #define ERRLOG_WRITE_PCI_SLOT_FAILED 0x00000102L #define ERRLOG_VENDOR_DEVICE_NOMATCH 0x00000103L -// NDIS_ERROR_CODE_ADAPTER_DISABLED +/* NDIS_ERROR_CODE_ADAPTER_DISABLED */ #define ERRLOG_BUS_MASTER_DISABLED 0x00000201L -// NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION +/* NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION */ #define ERRLOG_INVALID_SPEED_DUPLEX 0x00000301L #define ERRLOG_SET_SECONDARY_FAILED 0x00000302L -// NDIS_ERROR_CODE_OUT_OF_RESOURCES +/* NDIS_ERROR_CODE_OUT_OF_RESOURCES */ #define ERRLOG_OUT_OF_MEMORY 0x00000401L #define ERRLOG_OUT_OF_SHARED_MEMORY 0x00000402L #define ERRLOG_OUT_OF_MAP_REGISTERS 0x00000403L @@ -289,21 +289,21 @@ #define ERRLOG_OUT_OF_NDIS_PACKET 0x00000407L #define ERRLOG_OUT_OF_LOOKASIDE_MEMORY 0x00000408L -// NDIS_ERROR_CODE_HARDWARE_FAILURE +/* NDIS_ERROR_CODE_HARDWARE_FAILURE */ #define ERRLOG_SELFTEST_FAILED 0x00000501L #define ERRLOG_INITIALIZE_ADAPTER 0x00000502L #define ERRLOG_REMOVE_MINIPORT 0x00000503L -// NDIS_ERROR_CODE_RESOURCE_CONFLICT +/* NDIS_ERROR_CODE_RESOURCE_CONFLICT */ #define ERRLOG_MAP_IO_SPACE 0x00000601L #define ERRLOG_QUERY_ADAPTER_RESOURCES 0x00000602L #define ERRLOG_NO_IO_RESOURCE 0x00000603L #define ERRLOG_NO_INTERRUPT_RESOURCE 0x00000604L #define ERRLOG_NO_MEMORY_RESOURCE 0x00000605L -// WDS definition +/* WDS definition */ #define MAX_WDS_ENTRY 4 -#define WDS_PAIRWISE_KEY_OFFSET 60 // WDS links uses pairwise key#60 ~ 63 in ASIC pairwise key table +#define WDS_PAIRWISE_KEY_OFFSET 60 /* WDS links uses pairwise key#60 ~ 63 in ASIC pairwise key table */ #define WDS_DISABLE_MODE 0 #define WDS_RESTRICT_MODE 1 @@ -319,7 +319,7 @@ #ifdef MBSS_SUPPORT #undef MAX_MBSSID_NUM #define MAX_MBSSID_NUM (8 - MAX_MESH_NUM - MAX_APCLI_NUM) -#endif // MBSS_SUPPORT // +#endif /* MBSS_SUPPORT // */ /* sanity check for apidx */ #define MBSS_MR_APIDX_SANITY_CHECK(apidx) \ @@ -333,10 +333,10 @@ #define FIRST_MBSSID 1 #define MAX_BEACON_SIZE 512 -// If the MAX_MBSSID_NUM is larger than 6, -// it shall reserve some WCID space(wcid 222~253) for beacon frames. -// - these wcid 238~253 are reserved for beacon#6(ra6). -// - these wcid 222~237 are reserved for beacon#7(ra7). +/* If the MAX_MBSSID_NUM is larger than 6, */ +/* it shall reserve some WCID space(wcid 222~253) for beacon frames. */ +/* - these wcid 238~253 are reserved for beacon#6(ra6). */ +/* - these wcid 222~237 are reserved for beacon#7(ra7). */ #if defined(MAX_MBSSID_NUM) && (MAX_MBSSID_NUM == 8) #define HW_RESERVED_WCID 222 #elif defined(MAX_MBSSID_NUM) && (MAX_MBSSID_NUM == 7) @@ -345,17 +345,17 @@ #define HW_RESERVED_WCID 255 #endif -// Then dedicate wcid of DFS and Carrier-Sense. +/* Then dedicate wcid of DFS and Carrier-Sense. */ #define DFS_CTS_WCID (HW_RESERVED_WCID - 1) #define CS_CTS_WCID (HW_RESERVED_WCID - 2) #define LAST_SPECIFIC_WCID (HW_RESERVED_WCID - 2) -// If MAX_MBSSID_NUM is 8, the maximum available wcid for the associated STA is 211. -// If MAX_MBSSID_NUM is 7, the maximum available wcid for the associated STA is 228. +/* If MAX_MBSSID_NUM is 8, the maximum available wcid for the associated STA is 211. */ +/* If MAX_MBSSID_NUM is 7, the maximum available wcid for the associated STA is 228. */ #define MAX_AVAILABLE_CLIENT_WCID (LAST_SPECIFIC_WCID - MAX_MBSSID_NUM - 1) -// TX need WCID to find Cipher Key -// these wcid 212 ~ 219 are reserved for bc/mc packets if MAX_MBSSID_NUM is 8. +/* TX need WCID to find Cipher Key */ +/* these wcid 212 ~ 219 are reserved for bc/mc packets if MAX_MBSSID_NUM is 8. */ #define GET_GroupKey_WCID(__wcid, __bssidx) \ { \ __wcid = LAST_SPECIFIC_WCID - (MAX_MBSSID_NUM) + __bssidx; \ @@ -363,7 +363,7 @@ #define IsGroupKeyWCID(__wcid) (((__wcid) < LAST_SPECIFIC_WCID) && ((__wcid) >= (LAST_SPECIFIC_WCID - (MAX_MBSSID_NUM)))) -// definition to support multiple BSSID +/* definition to support multiple BSSID */ #define BSS0 0 #define BSS1 1 #define BSS2 2 @@ -373,26 +373,26 @@ #define BSS6 6 #define BSS7 7 -//============================================================ -// Length definitions +/*============================================================ */ +/* Length definitions */ #define PEER_KEY_NO 2 #define MAC_ADDR_LEN 6 #define TIMESTAMP_LEN 8 -#define MAX_LEN_OF_SUPPORTED_RATES MAX_LENGTH_OF_SUPPORT_RATES // 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 -#define MAX_LEN_OF_KEY 32 // 32 octets == 256 bits, Redefine for WPA -#define MAX_NUM_OF_CHANNELS MAX_NUM_OF_CHS // 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL termination -#define MAX_NUM_OF_11JCHANNELS 20 // 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL termination +#define MAX_LEN_OF_SUPPORTED_RATES MAX_LENGTH_OF_SUPPORT_RATES /* 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 */ +#define MAX_LEN_OF_KEY 32 /* 32 octets == 256 bits, Redefine for WPA */ +#define MAX_NUM_OF_CHANNELS MAX_NUM_OF_CHS /* 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL termination */ +#define MAX_NUM_OF_11JCHANNELS 20 /* 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL termination */ #define MAX_LEN_OF_SSID 32 #define CIPHER_TEXT_LEN 128 #define HASH_TABLE_SIZE 256 -#define MAX_VIE_LEN 1024 // New for WPA cipher suite variable IE sizes. +#define MAX_VIE_LEN 1024 /* New for WPA cipher suite variable IE sizes. */ #define MAX_SUPPORT_MCS 32 #define MAX_NUM_OF_BBP_LATCH 140 -//============================================================ -// ASIC WCID Table definition. -//============================================================ -#define BSSID_WCID 1 // in infra mode, always put bssid with this WCID +/*============================================================ */ +/* ASIC WCID Table definition. */ +/*============================================================ */ +#define BSSID_WCID 1 /* in infra mode, always put bssid with this WCID */ #define MCAST_WCID 0x0 #define BSS0Mcast_WCID 0x0 #define BSS1Mcast_WCID 0xf8 @@ -406,7 +406,7 @@ #define MAX_NUM_OF_ACL_LIST MAX_NUMBER_OF_ACL -#define MAX_LEN_OF_MAC_TABLE MAX_NUMBER_OF_MAC // if MAX_MBSSID_NUM is 8, this value can't be larger than 211 +#define MAX_LEN_OF_MAC_TABLE MAX_NUMBER_OF_MAC /* if MAX_MBSSID_NUM is 8, this value can't be larger than 211 */ #if MAX_LEN_OF_MAC_TABLE>MAX_AVAILABLE_CLIENT_WCID #error MAX_LEN_OF_MAC_TABLE can not be larger than MAX_AVAILABLE_CLIENT_WCID!!!! @@ -419,38 +419,38 @@ #define NUM_OF_TID 8 #define MAX_AID_BA 4 -#define MAX_LEN_OF_BA_REC_TABLE ((NUM_OF_TID * MAX_LEN_OF_MAC_TABLE)/2) // (NUM_OF_TID*MAX_AID_BA + 32) //Block ACK recipient -#define MAX_LEN_OF_BA_ORI_TABLE ((NUM_OF_TID * MAX_LEN_OF_MAC_TABLE)/2) // (NUM_OF_TID*MAX_AID_BA + 32) // Block ACK originator +#define MAX_LEN_OF_BA_REC_TABLE ((NUM_OF_TID * MAX_LEN_OF_MAC_TABLE)/2) /* (NUM_OF_TID*MAX_AID_BA + 32) //Block ACK recipient */ +#define MAX_LEN_OF_BA_ORI_TABLE ((NUM_OF_TID * MAX_LEN_OF_MAC_TABLE)/2) /* (NUM_OF_TID*MAX_AID_BA + 32) // Block ACK originator */ #define MAX_LEN_OF_BSS_TABLE 64 #define MAX_REORDERING_MPDU_NUM 512 -// key related definitions +/* key related definitions */ #define SHARE_KEY_NUM 4 -#define MAX_LEN_OF_SHARE_KEY 16 // byte count -#define MAX_LEN_OF_PEER_KEY 16 // byte count -#define PAIRWISE_KEY_NUM 64 // in MAC ASIC pairwise key table +#define MAX_LEN_OF_SHARE_KEY 16 /* byte count */ +#define MAX_LEN_OF_PEER_KEY 16 /* byte count */ +#define PAIRWISE_KEY_NUM 64 /* in MAC ASIC pairwise key table */ #define GROUP_KEY_NUM 4 #define PMK_LEN 32 -#define WDS_PAIRWISE_KEY_OFFSET 60 // WDS links uses pairwise key#60 ~ 63 in ASIC pairwise key table -#define PMKID_NO 4 // Number of PMKID saved supported +#define WDS_PAIRWISE_KEY_OFFSET 60 /* WDS links uses pairwise key#60 ~ 63 in ASIC pairwise key table */ +#define PMKID_NO 4 /* Number of PMKID saved supported */ #define MAX_LEN_OF_MLME_BUFFER 2048 -// power status related definitions +/* power status related definitions */ #define PWR_ACTIVE 0 #define PWR_SAVE 1 -#define PWR_MMPS 2 //MIMO power save +#define PWR_MMPS 2 /*MIMO power save */ -// Auth and Assoc mode related definitions +/* Auth and Assoc mode related definitions */ #define AUTH_MODE_OPEN 0x00 #define AUTH_MODE_KEY 0x01 -// BSS Type definitions -#define BSS_ADHOC 0 // = Ndis802_11IBSS -#define BSS_INFRA 1 // = Ndis802_11Infrastructure -#define BSS_ANY 2 // = Ndis802_11AutoUnknown -#define BSS_MONITOR 3 // = Ndis802_11Monitor +/* BSS Type definitions */ +#define BSS_ADHOC 0 /* = Ndis802_11IBSS */ +#define BSS_INFRA 1 /* = Ndis802_11Infrastructure */ +#define BSS_ANY 2 /* = Ndis802_11AutoUnknown */ +#define BSS_MONITOR 3 /* = Ndis802_11Monitor */ -// Reason code definitions +/* Reason code definitions */ #define REASON_RESERVED 0 #define REASON_UNSPECIFY 1 #define REASON_NO_LONGER_VALID 2 @@ -485,7 +485,7 @@ #define REASON_QOS_REQUEST_TIMEOUT 39 #define REASON_QOS_CIPHER_NOT_SUPPORT 45 -// Status code definitions +/* Status code definitions */ #define MLME_SUCCESS 0 #define MLME_UNSPECIFY_FAIL 1 #define MLME_CANNOT_SUPPORT_CAP 10 @@ -517,7 +517,7 @@ #define MLME_STATE_MACHINE_REJECT 0x53 #define MLME_MAC_TABLE_FAIL 0x54 -// IE code +/* IE code */ #define IE_SSID 0 #define IE_SUPP_RATES 1 #define IE_FH_PARM 2 @@ -525,83 +525,83 @@ #define IE_CF_PARM 4 #define IE_TIM 5 #define IE_IBSS_PARM 6 -#define IE_COUNTRY 7 // 802.11d -#define IE_802_11D_REQUEST 10 // 802.11d -#define IE_QBSS_LOAD 11 // 802.11e d9 -#define IE_EDCA_PARAMETER 12 // 802.11e d9 -#define IE_TSPEC 13 // 802.11e d9 -#define IE_TCLAS 14 // 802.11e d9 -#define IE_SCHEDULE 15 // 802.11e d9 +#define IE_COUNTRY 7 /* 802.11d */ +#define IE_802_11D_REQUEST 10 /* 802.11d */ +#define IE_QBSS_LOAD 11 /* 802.11e d9 */ +#define IE_EDCA_PARAMETER 12 /* 802.11e d9 */ +#define IE_TSPEC 13 /* 802.11e d9 */ +#define IE_TCLAS 14 /* 802.11e d9 */ +#define IE_SCHEDULE 15 /* 802.11e d9 */ #define IE_CHALLENGE_TEXT 16 -#define IE_POWER_CONSTRAINT 32 // 802.11h d3.3 -#define IE_POWER_CAPABILITY 33 // 802.11h d3.3 -#define IE_TPC_REQUEST 34 // 802.11h d3.3 -#define IE_TPC_REPORT 35 // 802.11h d3.3 -#define IE_SUPP_CHANNELS 36 // 802.11h d3.3 -#define IE_CHANNEL_SWITCH_ANNOUNCEMENT 37 // 802.11h d3.3 -#define IE_MEASUREMENT_REQUEST 38 // 802.11h d3.3 -#define IE_MEASUREMENT_REPORT 39 // 802.11h d3.3 -#define IE_QUIET 40 // 802.11h d3.3 -#define IE_IBSS_DFS 41 // 802.11h d3.3 -#define IE_ERP 42 // 802.11g -#define IE_TS_DELAY 43 // 802.11e d9 -#define IE_TCLAS_PROCESSING 44 // 802.11e d9 -#define IE_QOS_CAPABILITY 46 // 802.11e d6 -#define IE_HT_CAP 45 // 802.11n d1. HT CAPABILITY. ELEMENT ID TBD -#define IE_AP_CHANNEL_REPORT 51 // 802.11k d6 -#define IE_HT_CAP2 52 // 802.11n d1. HT CAPABILITY. ELEMENT ID TBD -#define IE_RSN 48 // 802.11i d3.0 -#define IE_WPA2 48 // WPA2 -#define IE_EXT_SUPP_RATES 50 // 802.11g -#define IE_SUPP_REG_CLASS 59 // 802.11y. Supported regulatory classes. -#define IE_EXT_CHANNEL_SWITCH_ANNOUNCEMENT 60 // 802.11n -#define IE_ADD_HT 61 // 802.11n d1. ADDITIONAL HT CAPABILITY. ELEMENT ID TBD -#define IE_ADD_HT2 53 // 802.11n d1. ADDITIONAL HT CAPABILITY. ELEMENT ID TBD - -// For 802.11n D3.03 -//#define IE_NEW_EXT_CHA_OFFSET 62 // 802.11n d1. New extension channel offset elemet -#define IE_SECONDARY_CH_OFFSET 62 // 802.11n D3.03 Secondary Channel Offset element -#define IE_WAPI 68 // WAPI information element -#define IE_2040_BSS_COEXIST 72 // 802.11n D3.0.3 -#define IE_2040_BSS_INTOLERANT_REPORT 73 // 802.11n D3.03 -#define IE_OVERLAPBSS_SCAN_PARM 74 // 802.11n D3.03 -#define IE_EXT_CAPABILITY 127 // 802.11n D3.03 - -#define IE_WPA 221 // WPA -#define IE_VENDOR_SPECIFIC 221 // Wifi WMM (WME) - -#define OUI_BROADCOM_HT 51 // -#define OUI_BROADCOM_HTADD 52 // -#define OUI_PREN_HT_CAP 51 // -#define OUI_PREN_ADD_HT 52 // - -// CCX information -#define IE_AIRONET_CKIP 133 // CCX1.0 ID 85H for CKIP -#define IE_AP_TX_POWER 150 // CCX 2.0 for AP transmit power -#define IE_MEASUREMENT_CAPABILITY 221 // CCX 2.0 +#define IE_POWER_CONSTRAINT 32 /* 802.11h d3.3 */ +#define IE_POWER_CAPABILITY 33 /* 802.11h d3.3 */ +#define IE_TPC_REQUEST 34 /* 802.11h d3.3 */ +#define IE_TPC_REPORT 35 /* 802.11h d3.3 */ +#define IE_SUPP_CHANNELS 36 /* 802.11h d3.3 */ +#define IE_CHANNEL_SWITCH_ANNOUNCEMENT 37 /* 802.11h d3.3 */ +#define IE_MEASUREMENT_REQUEST 38 /* 802.11h d3.3 */ +#define IE_MEASUREMENT_REPORT 39 /* 802.11h d3.3 */ +#define IE_QUIET 40 /* 802.11h d3.3 */ +#define IE_IBSS_DFS 41 /* 802.11h d3.3 */ +#define IE_ERP 42 /* 802.11g */ +#define IE_TS_DELAY 43 /* 802.11e d9 */ +#define IE_TCLAS_PROCESSING 44 /* 802.11e d9 */ +#define IE_QOS_CAPABILITY 46 /* 802.11e d6 */ +#define IE_HT_CAP 45 /* 802.11n d1. HT CAPABILITY. ELEMENT ID TBD */ +#define IE_AP_CHANNEL_REPORT 51 /* 802.11k d6 */ +#define IE_HT_CAP2 52 /* 802.11n d1. HT CAPABILITY. ELEMENT ID TBD */ +#define IE_RSN 48 /* 802.11i d3.0 */ +#define IE_WPA2 48 /* WPA2 */ +#define IE_EXT_SUPP_RATES 50 /* 802.11g */ +#define IE_SUPP_REG_CLASS 59 /* 802.11y. Supported regulatory classes. */ +#define IE_EXT_CHANNEL_SWITCH_ANNOUNCEMENT 60 /* 802.11n */ +#define IE_ADD_HT 61 /* 802.11n d1. ADDITIONAL HT CAPABILITY. ELEMENT ID TBD */ +#define IE_ADD_HT2 53 /* 802.11n d1. ADDITIONAL HT CAPABILITY. ELEMENT ID TBD */ + +/* For 802.11n D3.03 */ +/*#define IE_NEW_EXT_CHA_OFFSET 62 // 802.11n d1. New extension channel offset elemet */ +#define IE_SECONDARY_CH_OFFSET 62 /* 802.11n D3.03 Secondary Channel Offset element */ +#define IE_WAPI 68 /* WAPI information element */ +#define IE_2040_BSS_COEXIST 72 /* 802.11n D3.0.3 */ +#define IE_2040_BSS_INTOLERANT_REPORT 73 /* 802.11n D3.03 */ +#define IE_OVERLAPBSS_SCAN_PARM 74 /* 802.11n D3.03 */ +#define IE_EXT_CAPABILITY 127 /* 802.11n D3.03 */ + +#define IE_WPA 221 /* WPA */ +#define IE_VENDOR_SPECIFIC 221 /* Wifi WMM (WME) */ + +#define OUI_BROADCOM_HT 51 /* */ +#define OUI_BROADCOM_HTADD 52 /* */ +#define OUI_PREN_HT_CAP 51 /* */ +#define OUI_PREN_ADD_HT 52 /* */ + +/* CCX information */ +#define IE_AIRONET_CKIP 133 /* CCX1.0 ID 85H for CKIP */ +#define IE_AP_TX_POWER 150 /* CCX 2.0 for AP transmit power */ +#define IE_MEASUREMENT_CAPABILITY 221 /* CCX 2.0 */ #define IE_CCX_V2 221 -#define IE_AIRONET_IPADDRESS 149 // CCX ID 95H for IP Address -#define IE_AIRONET_CCKMREASSOC 156 // CCX ID 9CH for CCKM Reassociation Request element +#define IE_AIRONET_IPADDRESS 149 /* CCX ID 95H for IP Address */ +#define IE_AIRONET_CCKMREASSOC 156 /* CCX ID 9CH for CCKM Reassociation Request element */ #define CKIP_NEGOTIATION_LENGTH 30 #define AIRONET_IPADDRESS_LENGTH 10 #define AIRONET_CCKMREASSOC_LENGTH 24 -// ======================================================== -// MLME state machine definition -// ======================================================== +/* ======================================================== */ +/* MLME state machine definition */ +/* ======================================================== */ -// STA MLME state mahcines +/* STA MLME state mahcines */ #define ASSOC_STATE_MACHINE 1 #define AUTH_STATE_MACHINE 2 #define AUTH_RSP_STATE_MACHINE 3 #define SYNC_STATE_MACHINE 4 #define MLME_CNTL_STATE_MACHINE 5 #define WPA_PSK_STATE_MACHINE 6 -//#define LEAP_STATE_MACHINE 7 +/*#define LEAP_STATE_MACHINE 7 */ #define AIRONET_STATE_MACHINE 8 #define ACTION_STATE_MACHINE 9 -// AP MLME state machines +/* AP MLME state machines */ #define AP_ASSOC_STATE_MACHINE 11 #define AP_AUTH_STATE_MACHINE 12 #define AP_SYNC_STATE_MACHINE 14 @@ -611,9 +611,9 @@ #define WPA_STATE_MACHINE 23 -// -// STA's CONTROL/CONNECT state machine: states, events, total function # -// +/* */ +/* STA's CONTROL/CONNECT state machine: states, events, total function # */ +/* */ #define CNTL_IDLE 0 #define CNTL_WAIT_DISASSOC 1 #define CNTL_WAIT_JOIN 2 @@ -626,7 +626,7 @@ #define CNTL_WAIT_OID_DISASSOC 9 #ifdef RTMP_MAC_USB #define CNTL_WAIT_SCAN_FOR_CONNECT 10 -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ #define MT2_ASSOC_CONF 34 #define MT2_AUTH_CONF 35 @@ -645,9 +645,9 @@ #define CNTL_FUNC_SIZE 1 -// -// STA's ASSOC state machine: states, events, total function # -// +/* */ +/* STA's ASSOC state machine: states, events, total function # */ +/* */ #define ASSOC_IDLE 0 #define ASSOC_WAIT_RSP 1 #define REASSOC_WAIT_RSP 2 @@ -670,16 +670,16 @@ #define ASSOC_FUNC_SIZE (MAX_ASSOC_STATE * MAX_ASSOC_MSG) -// -// ACT state machine: states, events, total function # -// +/* */ +/* ACT state machine: states, events, total function # */ +/* */ #define ACT_IDLE 0 #define MAX_ACT_STATE 1 #define ACT_MACHINE_BASE 0 -//Those PEER_xx_CATE number is based on real Categary value in IEEE spec. Please don'es modify it by your self. -//Category +/*Those PEER_xx_CATE number is based on real Categary value in IEEE spec. Please don'es modify it by your self. */ +/*Category */ #define MT2_PEER_SPECTRUM_CATE 0 #define MT2_PEER_QOS_CATE 1 #define MT2_PEER_DLS_CATE 2 @@ -687,7 +687,7 @@ #define MT2_PEER_PUBLIC_CATE 4 #define MT2_PEER_RM_CATE 5 /* "FT_CATEGORY_BSS_TRANSITION equal to 6" is defined file of "dot11r_ft.h" */ -#define MT2_PEER_HT_CATE 7 // 7.4.7 +#define MT2_PEER_HT_CATE 7 /* 7.4.7 */ #define MAX_PEER_CATE_MSG 7 #define MT2_MLME_ADD_BA_CATE 8 @@ -698,7 +698,7 @@ #define MT2_ACT_INVALID 13 #define MAX_ACT_MSG 14 -//Category field +/*Category field */ #define CATEGORY_SPECTRUM 0 #define CATEGORY_QOS 1 #define CATEGORY_DLS 2 @@ -707,35 +707,35 @@ #define CATEGORY_RM 5 #define CATEGORY_HT 7 -// DLS Action frame definition +/* DLS Action frame definition */ #define ACTION_DLS_REQUEST 0 #define ACTION_DLS_RESPONSE 1 #define ACTION_DLS_TEARDOWN 2 -//Spectrum Action field value 802.11h 7.4.1 -#define SPEC_MRQ 0 // Request -#define SPEC_MRP 1 //Report +/*Spectrum Action field value 802.11h 7.4.1 */ +#define SPEC_MRQ 0 /* Request */ +#define SPEC_MRP 1 /*Report */ #define SPEC_TPCRQ 2 #define SPEC_TPCRP 3 #define SPEC_CHANNEL_SWITCH 4 -//BA Action field value +/*BA Action field value */ #define ADDBA_REQ 0 #define ADDBA_RESP 1 #define DELBA 2 -//Public's Action field value in Public Category. Some in 802.11y and some in 11n -#define ACTION_BSS_2040_COEXIST 0 // 11n -#define ACTION_DSE_ENABLEMENT 1 // 11y D9.0 -#define ACTION_DSE_DEENABLEMENT 2 // 11y D9.0 -#define ACTION_DSE_REG_LOCATION_ANNOUNCE 3 // 11y D9.0 -#define ACTION_EXT_CH_SWITCH_ANNOUNCE 4 // 11y D9.0 -#define ACTION_DSE_MEASUREMENT_REQ 5 // 11y D9.0 -#define ACTION_DSE_MEASUREMENT_REPORT 6 // 11y D9.0 -#define ACTION_MEASUREMENT_PILOT_ACTION 7 // 11y D9.0 -#define ACTION_DSE_POWER_CONSTRAINT 8 // 11y D9.0 - -//HT Action field value +/*Public's Action field value in Public Category. Some in 802.11y and some in 11n */ +#define ACTION_BSS_2040_COEXIST 0 /* 11n */ +#define ACTION_DSE_ENABLEMENT 1 /* 11y D9.0 */ +#define ACTION_DSE_DEENABLEMENT 2 /* 11y D9.0 */ +#define ACTION_DSE_REG_LOCATION_ANNOUNCE 3 /* 11y D9.0 */ +#define ACTION_EXT_CH_SWITCH_ANNOUNCE 4 /* 11y D9.0 */ +#define ACTION_DSE_MEASUREMENT_REQ 5 /* 11y D9.0 */ +#define ACTION_DSE_MEASUREMENT_REPORT 6 /* 11y D9.0 */ +#define ACTION_MEASUREMENT_PILOT_ACTION 7 /* 11y D9.0 */ +#define ACTION_DSE_POWER_CONSTRAINT 8 /* 11y D9.0 */ + +/*HT Action field value */ #define NOTIFY_BW_ACTION 0 #define SMPS_ACTION 1 #define PSMP_ACTION 2 @@ -747,9 +747,9 @@ #define HT_INFO_EXCHANGE 8 #define ACT_FUNC_SIZE (MAX_ACT_STATE * MAX_ACT_MSG) -// -// STA's AUTHENTICATION state machine: states, evvents, total function # -// +/* */ +/* STA's AUTHENTICATION state machine: states, evvents, total function # */ +/* */ #define AUTH_REQ_IDLE 0 #define AUTH_WAIT_SEQ2 1 #define AUTH_WAIT_SEQ4 2 @@ -763,9 +763,9 @@ #define AUTH_FUNC_SIZE (MAX_AUTH_STATE * MAX_AUTH_MSG) -// -// STA's AUTH_RSP state machine: states, events, total function # -// +/* */ +/* STA's AUTH_RSP state machine: states, events, total function # */ +/* */ #define AUTH_RSP_IDLE 0 #define AUTH_RSP_WAIT_CHAL 1 #define MAX_AUTH_RSP_STATE 2 @@ -778,10 +778,10 @@ #define AUTH_RSP_FUNC_SIZE (MAX_AUTH_RSP_STATE * MAX_AUTH_RSP_MSG) -// -// STA's SYNC state machine: states, events, total function # -// -#define SYNC_IDLE 0 // merge NO_BSS,IBSS_IDLE,IBSS_ACTIVE and BSS in to 1 state +/* */ +/* STA's SYNC state machine: states, events, total function # */ +/* */ +#define SYNC_IDLE 0 /* merge NO_BSS,IBSS_IDLE,IBSS_ACTIVE and BSS in to 1 state */ #define JOIN_WAIT_BEACON 1 #define SCAN_LISTEN 2 #define MAX_SYNC_STATE 3 @@ -801,7 +801,7 @@ #define SYNC_FUNC_SIZE (MAX_SYNC_STATE * MAX_SYNC_MSG) -//Messages for the DLS state machine +/*Messages for the DLS state machine */ #define DLS_IDLE 0 #define MAX_DLS_STATE 1 @@ -815,18 +815,18 @@ #define DLS_FUNC_SIZE (MAX_DLS_STATE * MAX_DLS_MSG) -// -// WSC State machine: states, events, total function # -// +/* */ +/* WSC State machine: states, events, total function # */ +/* */ -// -// AP's CONTROL/CONNECT state machine: states, events, total function # -// +/* */ +/* AP's CONTROL/CONNECT state machine: states, events, total function # */ +/* */ #define AP_CNTL_FUNC_SIZE 1 -// -// AP's ASSOC state machine: states, events, total function # -// +/* */ +/* AP's ASSOC state machine: states, events, total function # */ +/* */ #define AP_ASSOC_IDLE 0 #define AP_MAX_ASSOC_STATE 1 @@ -840,9 +840,9 @@ #define AP_ASSOC_FUNC_SIZE (AP_MAX_ASSOC_STATE * AP_MAX_ASSOC_MSG) -// -// AP's AUTHENTICATION state machine: states, events, total function # -// +/* */ +/* AP's AUTHENTICATION state machine: states, events, total function # */ +/* */ #define AP_AUTH_REQ_IDLE 0 #define AP_MAX_AUTH_STATE 1 @@ -856,9 +856,9 @@ #define AP_AUTH_FUNC_SIZE (AP_MAX_AUTH_STATE * AP_MAX_AUTH_MSG) -// -// AP's SYNC state machine: states, events, total function # -// +/* */ +/* AP's SYNC state machine: states, events, total function # */ +/* */ #define AP_SYNC_IDLE 0 #define AP_SCAN_LISTEN 1 #define AP_MAX_SYNC_STATE 2 @@ -874,9 +874,9 @@ #define AP_SYNC_FUNC_SIZE (AP_MAX_SYNC_STATE * AP_MAX_SYNC_MSG) -// -// Common WPA state machine: states, events, total function # -// +/* */ +/* Common WPA state machine: states, events, total function # */ +/* */ #define WPA_PTK 0 #define MAX_WPA_PTK_STATE 1 @@ -890,14 +890,14 @@ #define WPA_FUNC_SIZE (MAX_WPA_PTK_STATE * MAX_WPA_MSG) -// ============================================================================= +/* ============================================================================= */ -// value domain of 802.11 header FC.Tyte, which is b3..b2 of the 1st-byte of MAC header +/* value domain of 802.11 header FC.Tyte, which is b3..b2 of the 1st-byte of MAC header */ #define BTYPE_MGMT 0 #define BTYPE_CNTL 1 #define BTYPE_DATA 2 -// value domain of 802.11 MGMT frame's FC.subtype, which is b7..4 of the 1st-byte of MAC header +/* value domain of 802.11 MGMT frame's FC.subtype, which is b7..4 of the 1st-byte of MAC header */ #define SUBTYPE_ASSOC_REQ 0 #define SUBTYPE_ASSOC_RSP 1 #define SUBTYPE_REASSOC_REQ 2 @@ -912,7 +912,7 @@ #define SUBTYPE_ACTION 13 #define SUBTYPE_ACTION_NO_ACK 14 -// value domain of 802.11 CNTL frame's FC.subtype, which is b7..4 of the 1st-byte of MAC header +/* value domain of 802.11 CNTL frame's FC.subtype, which is b7..4 of the 1st-byte of MAC header */ #define SUBTYPE_WRAPPER 7 #define SUBTYPE_BLOCK_ACK_REQ 8 #define SUBTYPE_BLOCK_ACK 9 @@ -923,7 +923,7 @@ #define SUBTYPE_CFEND 14 #define SUBTYPE_CFEND_CFACK 15 -// value domain of 802.11 DATA frame's FC.subtype, which is b7..4 of the 1st-byte of MAC header +/* value domain of 802.11 DATA frame's FC.subtype, which is b7..4 of the 1st-byte of MAC header */ #define SUBTYPE_DATA 0 #define SUBTYPE_DATA_CFACK 1 #define SUBTYPE_DATA_CFPOLL 2 @@ -941,15 +941,15 @@ #define SUBTYPE_QOS_CFPOLL 14 #define SUBTYPE_QOS_CFACK_CFPOLL 15 -// ACK policy of QOS Control field bit 6:5 -#define NORMAL_ACK 0x00 // b6:5 = 00 -#define NO_ACK 0x20 // b6:5 = 01 -#define NO_EXPLICIT_ACK 0x40 // b6:5 = 10 -#define BLOCK_ACK 0x60 // b6:5 = 11 +/* ACK policy of QOS Control field bit 6:5 */ +#define NORMAL_ACK 0x00 /* b6:5 = 00 */ +#define NO_ACK 0x20 /* b6:5 = 01 */ +#define NO_EXPLICIT_ACK 0x40 /* b6:5 = 10 */ +#define BLOCK_ACK 0x60 /* b6:5 = 11 */ -// -// rtmp_data.c use these definition -// +/* */ +/* rtmp_data.c use these definition */ +/* */ #define LENGTH_802_11 24 #define LENGTH_802_11_AND_H 30 #define LENGTH_802_11_CRC_H 34 @@ -965,40 +965,40 @@ #define LENGTH_802_3_NO_TYPE 12 #define LENGTH_802_1Q 4 /* VLAN related */ -// STA_CSR4.field.TxResult +/* STA_CSR4.field.TxResult */ #define TX_RESULT_SUCCESS 0 #define TX_RESULT_ZERO_LENGTH 1 #define TX_RESULT_UNDER_RUN 2 #define TX_RESULT_OHY_ERROR 4 #define TX_RESULT_RETRY_FAIL 6 -// All PHY rate summary in TXD -// Preamble MODE in TxD +/* All PHY rate summary in TXD */ +/* Preamble MODE in TxD */ #define MODE_CCK 0 #define MODE_OFDM 1 #define MODE_HTMIX 2 #define MODE_HTGREENFIELD 3 -// MCS for CCK. BW.SGI.STBC are reserved -#define MCS_LONGP_RATE_1 0 // long preamble CCK 1Mbps -#define MCS_LONGP_RATE_2 1 // long preamble CCK 1Mbps +/* MCS for CCK. BW.SGI.STBC are reserved */ +#define MCS_LONGP_RATE_1 0 /* long preamble CCK 1Mbps */ +#define MCS_LONGP_RATE_2 1 /* long preamble CCK 1Mbps */ #define MCS_LONGP_RATE_5_5 2 #define MCS_LONGP_RATE_11 3 -#define MCS_SHORTP_RATE_1 4 // long preamble CCK 1Mbps. short is forbidden in 1Mbps -#define MCS_SHORTP_RATE_2 5 // short preamble CCK 2Mbps +#define MCS_SHORTP_RATE_1 4 /* long preamble CCK 1Mbps. short is forbidden in 1Mbps */ +#define MCS_SHORTP_RATE_2 5 /* short preamble CCK 2Mbps */ #define MCS_SHORTP_RATE_5_5 6 #define MCS_SHORTP_RATE_11 7 -// To send duplicate legacy OFDM. set BW=BW_40. SGI.STBC are reserved -#define MCS_RATE_6 0 // legacy OFDM -#define MCS_RATE_9 1 // OFDM -#define MCS_RATE_12 2 // OFDM -#define MCS_RATE_18 3 // OFDM -#define MCS_RATE_24 4 // OFDM -#define MCS_RATE_36 5 // OFDM -#define MCS_RATE_48 6 // OFDM -#define MCS_RATE_54 7 // OFDM -// HT -#define MCS_0 0 // 1S +/* To send duplicate legacy OFDM. set BW=BW_40. SGI.STBC are reserved */ +#define MCS_RATE_6 0 /* legacy OFDM */ +#define MCS_RATE_9 1 /* OFDM */ +#define MCS_RATE_12 2 /* OFDM */ +#define MCS_RATE_18 3 /* OFDM */ +#define MCS_RATE_24 4 /* OFDM */ +#define MCS_RATE_36 5 /* OFDM */ +#define MCS_RATE_48 6 /* OFDM */ +#define MCS_RATE_54 7 /* OFDM */ +/* HT */ +#define MCS_0 0 /* 1S */ #define MCS_1 1 #define MCS_2 2 #define MCS_3 3 @@ -1006,7 +1006,7 @@ #define MCS_5 5 #define MCS_6 6 #define MCS_7 7 -#define MCS_8 8 // 2S +#define MCS_8 8 /* 2S */ #define MCS_9 9 #define MCS_10 10 #define MCS_11 11 @@ -1014,7 +1014,7 @@ #define MCS_13 13 #define MCS_14 14 #define MCS_15 15 -#define MCS_16 16 // 3*3 +#define MCS_16 16 /* 3*3 */ #define MCS_17 17 #define MCS_18 18 #define MCS_19 19 @@ -1025,48 +1025,48 @@ #define MCS_32 32 #define MCS_AUTO 33 -// OID_HTPHYMODE -// MODE +/* OID_HTPHYMODE */ +/* MODE */ #define HTMODE_MM 0 #define HTMODE_GF 1 -// Fixed Tx MODE - HT, CCK or OFDM +/* Fixed Tx MODE - HT, CCK or OFDM */ #define FIXED_TXMODE_HT 0 #define FIXED_TXMODE_CCK 1 #define FIXED_TXMODE_OFDM 2 -// BW +/* BW */ #define BW_20 BAND_WIDTH_20 #define BW_40 BAND_WIDTH_40 #define BW_BOTH BAND_WIDTH_BOTH -#define BW_10 BAND_WIDTH_10 // 802.11j has 10MHz. This definition is for internal usage. doesn't fill in the IE or other field. +#define BW_10 BAND_WIDTH_10 /* 802.11j has 10MHz. This definition is for internal usage. doesn't fill in the IE or other field. */ -// SHORTGI -#define GI_400 GAP_INTERVAL_400 // only support in HT mode +/* SHORTGI */ +#define GI_400 GAP_INTERVAL_400 /* only support in HT mode */ #define GI_BOTH GAP_INTERVAL_BOTH #define GI_800 GAP_INTERVAL_800 -// STBC +/* STBC */ #define STBC_NONE 0 -#define STBC_USE 1 // limited use in rt2860b phy -#define RXSTBC_ONE 1 // rx support of one spatial stream -#define RXSTBC_TWO 2 // rx support of 1 and 2 spatial stream -#define RXSTBC_THR 3 // rx support of 1~3 spatial stream -// MCS FEEDBACK -#define MCSFBK_NONE 0 // not support mcs feedback / -#define MCSFBK_RSV 1 // reserved -#define MCSFBK_UNSOLICIT 2 // only support unsolict mcs feedback -#define MCSFBK_MRQ 3 // response to both MRQ and unsolict mcs feedback - -// MIMO power safe +#define STBC_USE 1 /* limited use in rt2860b phy */ +#define RXSTBC_ONE 1 /* rx support of one spatial stream */ +#define RXSTBC_TWO 2 /* rx support of 1 and 2 spatial stream */ +#define RXSTBC_THR 3 /* rx support of 1~3 spatial stream */ +/* MCS FEEDBACK */ +#define MCSFBK_NONE 0 /* not support mcs feedback / */ +#define MCSFBK_RSV 1 /* reserved */ +#define MCSFBK_UNSOLICIT 2 /* only support unsolict mcs feedback */ +#define MCSFBK_MRQ 3 /* response to both MRQ and unsolict mcs feedback */ + +/* MIMO power safe */ #define MMPS_STATIC 0 #define MMPS_DYNAMIC 1 #define MMPS_RSV 2 #define MMPS_ENABLE 3 -// A-MSDU size +/* A-MSDU size */ #define AMSDU_0 0 #define AMSDU_1 1 -// MCS use 7 bits +/* MCS use 7 bits */ #define TXRATEMIMO 0x80 #define TXRATEMCS 0x7F #define TXRATEOFDM 0x7F @@ -1074,77 +1074,77 @@ #define RATE_2 1 #define RATE_5_5 2 #define RATE_11 3 -#define RATE_6 4 // OFDM -#define RATE_9 5 // OFDM -#define RATE_12 6 // OFDM -#define RATE_18 7 // OFDM -#define RATE_24 8 // OFDM -#define RATE_36 9 // OFDM -#define RATE_48 10 // OFDM -#define RATE_54 11 // OFDM +#define RATE_6 4 /* OFDM */ +#define RATE_9 5 /* OFDM */ +#define RATE_12 6 /* OFDM */ +#define RATE_18 7 /* OFDM */ +#define RATE_24 8 /* OFDM */ +#define RATE_36 9 /* OFDM */ +#define RATE_48 10 /* OFDM */ +#define RATE_54 11 /* OFDM */ #define RATE_FIRST_OFDM_RATE RATE_6 #define RATE_LAST_OFDM_RATE RATE_54 -#define RATE_6_5 12 // HT mix -#define RATE_13 13 // HT mix -#define RATE_19_5 14 // HT mix -#define RATE_26 15 // HT mix -#define RATE_39 16 // HT mix -#define RATE_52 17 // HT mix -#define RATE_58_5 18 // HT mix -#define RATE_65 19 // HT mix -#define RATE_78 20 // HT mix -#define RATE_104 21 // HT mix -#define RATE_117 22 // HT mix -#define RATE_130 23 // HT mix -//#define RATE_AUTO_SWITCH 255 // for StaCfg.FixedTxRate only +#define RATE_6_5 12 /* HT mix */ +#define RATE_13 13 /* HT mix */ +#define RATE_19_5 14 /* HT mix */ +#define RATE_26 15 /* HT mix */ +#define RATE_39 16 /* HT mix */ +#define RATE_52 17 /* HT mix */ +#define RATE_58_5 18 /* HT mix */ +#define RATE_65 19 /* HT mix */ +#define RATE_78 20 /* HT mix */ +#define RATE_104 21 /* HT mix */ +#define RATE_117 22 /* HT mix */ +#define RATE_130 23 /* HT mix */ +/*#define RATE_AUTO_SWITCH 255 // for StaCfg.FixedTxRate only */ #define HTRATE_0 12 #define RATE_FIRST_MM_RATE HTRATE_0 #define RATE_FIRST_HT_RATE HTRATE_0 #define RATE_LAST_HT_RATE HTRATE_0 -// pTxWI->txop -#define IFS_HTTXOP 0 // The txop will be handles by ASIC. +/* pTxWI->txop */ +#define IFS_HTTXOP 0 /* The txop will be handles by ASIC. */ #define IFS_PIFS 1 #define IFS_SIFS 2 #define IFS_BACKOFF 3 -// pTxD->RetryMode +/* pTxD->RetryMode */ #define LONG_RETRY 1 #define SHORT_RETRY 0 -// Country Region definition +/* Country Region definition */ #define REGION_MINIMUM_BG_BAND 0 -#define REGION_0_BG_BAND 0 // 1-11 -#define REGION_1_BG_BAND 1 // 1-13 -#define REGION_2_BG_BAND 2 // 10-11 -#define REGION_3_BG_BAND 3 // 10-13 -#define REGION_4_BG_BAND 4 // 14 -#define REGION_5_BG_BAND 5 // 1-14 -#define REGION_6_BG_BAND 6 // 3-9 -#define REGION_7_BG_BAND 7 // 5-13 -#define REGION_31_BG_BAND 31 // 5-13 +#define REGION_0_BG_BAND 0 /* 1-11 */ +#define REGION_1_BG_BAND 1 /* 1-13 */ +#define REGION_2_BG_BAND 2 /* 10-11 */ +#define REGION_3_BG_BAND 3 /* 10-13 */ +#define REGION_4_BG_BAND 4 /* 14 */ +#define REGION_5_BG_BAND 5 /* 1-14 */ +#define REGION_6_BG_BAND 6 /* 3-9 */ +#define REGION_7_BG_BAND 7 /* 5-13 */ +#define REGION_31_BG_BAND 31 /* 5-13 */ #define REGION_MAXIMUM_BG_BAND 7 #define REGION_MINIMUM_A_BAND 0 -#define REGION_0_A_BAND 0 // 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165 -#define REGION_1_A_BAND 1 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 -#define REGION_2_A_BAND 2 // 36, 40, 44, 48, 52, 56, 60, 64 -#define REGION_3_A_BAND 3 // 52, 56, 60, 64, 149, 153, 157, 161 -#define REGION_4_A_BAND 4 // 149, 153, 157, 161, 165 -#define REGION_5_A_BAND 5 // 149, 153, 157, 161 -#define REGION_6_A_BAND 6 // 36, 40, 44, 48 -#define REGION_7_A_BAND 7 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173 -#define REGION_8_A_BAND 8 // 52, 56, 60, 64 -#define REGION_9_A_BAND 9 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165 -#define REGION_10_A_BAND 10 // 36, 40, 44, 48, 149, 153, 157, 161, 165 -#define REGION_11_A_BAND 11 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 149, 153, 157, 161 -#define REGION_12_A_BAND 12 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 -#define REGION_13_A_BAND 13 // 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161 -#define REGION_14_A_BAND 14 // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 136, 140, 149, 153, 157, 161, 165 -#define REGION_15_A_BAND 15 // 149, 153, 157, 161, 165, 169, 173 +#define REGION_0_A_BAND 0 /* 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165 */ +#define REGION_1_A_BAND 1 /* 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 */ +#define REGION_2_A_BAND 2 /* 36, 40, 44, 48, 52, 56, 60, 64 */ +#define REGION_3_A_BAND 3 /* 52, 56, 60, 64, 149, 153, 157, 161 */ +#define REGION_4_A_BAND 4 /* 149, 153, 157, 161, 165 */ +#define REGION_5_A_BAND 5 /* 149, 153, 157, 161 */ +#define REGION_6_A_BAND 6 /* 36, 40, 44, 48 */ +#define REGION_7_A_BAND 7 /* 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173 */ +#define REGION_8_A_BAND 8 /* 52, 56, 60, 64 */ +#define REGION_9_A_BAND 9 /* 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165 */ +#define REGION_10_A_BAND 10 /* 36, 40, 44, 48, 149, 153, 157, 161, 165 */ +#define REGION_11_A_BAND 11 /* 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 149, 153, 157, 161 */ +#define REGION_12_A_BAND 12 /* 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 */ +#define REGION_13_A_BAND 13 /* 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161 */ +#define REGION_14_A_BAND 14 /* 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 136, 140, 149, 153, 157, 161, 165 */ +#define REGION_15_A_BAND 15 /* 149, 153, 157, 161, 165, 169, 173 */ #define REGION_MAXIMUM_A_BAND 15 -// pTxD->CipherAlg +/* pTxD->CipherAlg */ #define CIPHER_NONE 0 #define CIPHER_WEP64 1 #define CIPHER_WEP128 2 @@ -1152,10 +1152,10 @@ #define CIPHER_AES 4 #define CIPHER_CKIP64 5 #define CIPHER_CKIP128 6 -#define CIPHER_TKIP_NO_MIC 7 // MIC appended by driver: not a valid value in hardware key table +#define CIPHER_TKIP_NO_MIC 7 /* MIC appended by driver: not a valid value in hardware key table */ #define CIPHER_SMS4 8 -// LED Status. +/* LED Status. */ #define LED_LINK_DOWN 0 #define LED_LINK_UP 1 #define LED_RADIO_OFF 2 @@ -1165,35 +1165,35 @@ #define LED_ON_SITE_SURVEY 6 #define LED_POWER_UP 7 -// value domain of pAd->LedCntl.LedMode and E2PROM +/* value domain of pAd->LedCntl.LedMode and E2PROM */ #define LED_MODE_DEFAULT 0 #define LED_MODE_TWO_LED 1 -//#define LED_MODE_SIGNAL_STREGTH 8 // EEPROM define =8 -#define LED_MODE_SIGNAL_STREGTH 0x40 // EEPROM define = 64 +/*#define LED_MODE_SIGNAL_STREGTH 8 // EEPROM define =8 */ +#define LED_MODE_SIGNAL_STREGTH 0x40 /* EEPROM define = 64 */ -// RC4 init value, used fro WEP & TKIP +/* RC4 init value, used fro WEP & TKIP */ #define PPPINITFCS32 0xffffffff /* Initial FCS value */ -// value domain of pAd->StaCfg.PortSecured. 802.1X controlled port definition +/* value domain of pAd->StaCfg.PortSecured. 802.1X controlled port definition */ #define WPA_802_1X_PORT_SECURED 1 #define WPA_802_1X_PORT_NOT_SECURED 2 #define PAIRWISE_KEY 1 #define GROUP_KEY 2 -//definition of DRS +/*definition of DRS */ #define MAX_STEP_OF_TX_RATE_SWITCH 32 -// pre-allocated free NDIS PACKET/BUFFER poll for internal usage +/* pre-allocated free NDIS PACKET/BUFFER poll for internal usage */ #define MAX_NUM_OF_FREE_NDIS_PACKET 128 -//Block ACK +/*Block ACK */ #define MAX_TX_REORDERBUF 64 #define MAX_RX_REORDERBUF 64 #define DEFAULT_TX_TIMEOUT 30 #define DEFAULT_RX_TIMEOUT 30 -// definition of Recipient or Originator +/* definition of Recipient or Originator */ #define I_RECIPIENT TRUE #define I_ORIGINATOR FALSE @@ -1201,43 +1201,43 @@ #define DEFAULT_RF_TX_POWER 5 #define MAX_INI_BUFFER_SIZE 4096 -#define MAX_PARAM_BUFFER_SIZE (2048) // enough for ACL (18*64) - //18 : the length of Mac address acceptable format "01:02:03:04:05:06;") - //64 : MAX_NUM_OF_ACL_LIST -// definition of pAd->OpMode +#define MAX_PARAM_BUFFER_SIZE (2048) /* enough for ACL (18*64) */ + /*18 : the length of Mac address acceptable format "01:02:03:04:05:06;") */ + /*64 : MAX_NUM_OF_ACL_LIST */ +/* definition of pAd->OpMode */ #define OPMODE_STA 0 #define OPMODE_AP 1 -//#define OPMODE_L3_BRG 2 // as AP and STA at the same time - -// ========================= AP rtmp_def.h =========================== -// value domain for pAd->EventTab.Log[].Event -#define EVENT_RESET_ACCESS_POINT 0 // Log = "hh:mm:ss Restart Access Point" -#define EVENT_ASSOCIATED 1 // Log = "hh:mm:ss STA 00:01:02:03:04:05 associated" -#define EVENT_DISASSOCIATED 2 // Log = "hh:mm:ss STA 00:01:02:03:04:05 left this BSS" -#define EVENT_AGED_OUT 3 // Log = "hh:mm:ss STA 00:01:02:03:04:05 was aged-out and removed from this BSS" +/*#define OPMODE_L3_BRG 2 // as AP and STA at the same time */ + +/* ========================= AP rtmp_def.h =========================== */ +/* value domain for pAd->EventTab.Log[].Event */ +#define EVENT_RESET_ACCESS_POINT 0 /* Log = "hh:mm:ss Restart Access Point" */ +#define EVENT_ASSOCIATED 1 /* Log = "hh:mm:ss STA 00:01:02:03:04:05 associated" */ +#define EVENT_DISASSOCIATED 2 /* Log = "hh:mm:ss STA 00:01:02:03:04:05 left this BSS" */ +#define EVENT_AGED_OUT 3 /* Log = "hh:mm:ss STA 00:01:02:03:04:05 was aged-out and removed from this BSS" */ #define EVENT_COUNTER_M 4 #define EVENT_INVALID_PSK 5 #define EVENT_MAX_EVENT_TYPE 6 -// ==== end of AP rtmp_def.h ============ +/* ==== end of AP rtmp_def.h ============ */ -// definition RSSI Number +/* definition RSSI Number */ #define RSSI_0 0 #define RSSI_1 1 #define RSSI_2 2 -// definition of radar detection -#define RD_NORMAL_MODE 0 // Not found radar signal -#define RD_SWITCHING_MODE 1 // Found radar signal, and doing channel switch -#define RD_SILENCE_MODE 2 // After channel switch, need to be silence a while to ensure radar not found +/* definition of radar detection */ +#define RD_NORMAL_MODE 0 /* Not found radar signal */ +#define RD_SWITCHING_MODE 1 /* Found radar signal, and doing channel switch */ +#define RD_SILENCE_MODE 2 /* After channel switch, need to be silence a while to ensure radar not found */ -//Driver defined cid for mapping status and command. +/*Driver defined cid for mapping status and command. */ #define SLEEPCID 0x11 #define WAKECID 0x22 #define QUERYPOWERCID 0x33 #define OWNERMCU 0x1 #define OWNERCPU 0x0 -// MBSSID definition +/* MBSSID definition */ #define ENTRY_NOT_FOUND 0xFF /* After Linux 2.6.9, @@ -1259,15 +1259,15 @@ #define INF_APCLI_DEV_NAME "apcli" #define INF_MESH_DEV_NAME "mesh" -// WEP Key TYPE +/* WEP Key TYPE */ #define WEP_HEXADECIMAL_TYPE 0 #define WEP_ASCII_TYPE 1 -// WIRELESS EVENTS definition +/* WIRELESS EVENTS definition */ /* Max number of char in custom event, refer to wireless_tools.28/wireless.20.h */ #define IW_CUSTOM_MAX_LEN 255 /* In bytes */ -// For system event - start +/* For system event - start */ #define IW_SYS_EVENT_FLAG_START 0x0200 #define IW_ASSOC_EVENT_FLAG 0x0200 #define IW_DISASSOC_EVENT_FLAG 0x0201 @@ -1288,12 +1288,12 @@ #define IW_STA_LINKDOWN_EVENT_FLAG 0x0210 #define IW_SCAN_COMPLETED_EVENT_FLAG 0x0211 #define IW_SCAN_ENQUEUE_FAIL_EVENT_FLAG 0x0212 -// if add new system event flag, please upadte the IW_SYS_EVENT_FLAG_END +/* if add new system event flag, please upadte the IW_SYS_EVENT_FLAG_END */ #define IW_SYS_EVENT_FLAG_END 0x0212 #define IW_SYS_EVENT_TYPE_NUM (IW_SYS_EVENT_FLAG_END - IW_SYS_EVENT_FLAG_START + 1) -// For system event - end +/* For system event - end */ -// For spoof attack event - start +/* For spoof attack event - start */ #define IW_SPOOF_EVENT_FLAG_START 0x0300 #define IW_CONFLICT_SSID_EVENT_FLAG 0x0300 #define IW_SPOOF_ASSOC_RESP_EVENT_FLAG 0x0301 @@ -1305,12 +1305,12 @@ #define IW_SPOOF_DEAUTH_EVENT_FLAG 0x0307 #define IW_SPOOF_UNKNOWN_MGMT_EVENT_FLAG 0x0308 #define IW_REPLAY_ATTACK_EVENT_FLAG 0x0309 -// if add new spoof attack event flag, please upadte the IW_SPOOF_EVENT_FLAG_END +/* if add new spoof attack event flag, please upadte the IW_SPOOF_EVENT_FLAG_END */ #define IW_SPOOF_EVENT_FLAG_END 0x0309 #define IW_SPOOF_EVENT_TYPE_NUM (IW_SPOOF_EVENT_FLAG_END - IW_SPOOF_EVENT_FLAG_START + 1) -// For spoof attack event - end +/* For spoof attack event - end */ -// For flooding attack event - start +/* For flooding attack event - start */ #define IW_FLOOD_EVENT_FLAG_START 0x0400 #define IW_FLOOD_AUTH_EVENT_FLAG 0x0400 #define IW_FLOOD_ASSOC_REQ_EVENT_FLAG 0x0401 @@ -1319,18 +1319,18 @@ #define IW_FLOOD_DISASSOC_EVENT_FLAG 0x0404 #define IW_FLOOD_DEAUTH_EVENT_FLAG 0x0405 #define IW_FLOOD_EAP_REQ_EVENT_FLAG 0x0406 -// if add new flooding attack event flag, please upadte the IW_FLOOD_EVENT_FLAG_END +/* if add new flooding attack event flag, please upadte the IW_FLOOD_EVENT_FLAG_END */ #define IW_FLOOD_EVENT_FLAG_END 0x0406 #define IW_FLOOD_EVENT_TYPE_NUM (IW_FLOOD_EVENT_FLAG_END - IW_FLOOD_EVENT_FLAG_START + 1) -// For flooding attack - end +/* For flooding attack - end */ -// End - WIRELESS EVENTS definition +/* End - WIRELESS EVENTS definition */ -// definition for DLS, kathy +/* definition for DLS, kathy */ #define MAX_NUM_OF_INIT_DLS_ENTRY 1 #define MAX_NUM_OF_DLS_ENTRY MAX_NUMBER_OF_DLS_ENTRY -//Block ACK, kathy +/*Block ACK, kathy */ #define MAX_TX_REORDERBUF 64 #define MAX_RX_REORDERBUF 64 #define DEFAULT_TX_TIMEOUT 30 @@ -1342,19 +1342,19 @@ #define IW_ESSID_MAX_SIZE 32 #endif -// For AsicRadioOff/AsicRadioOn function +/* For AsicRadioOff/AsicRadioOn function */ #define DOT11POWERSAVE 0 #define GUIRADIO_OFF 1 #define RTMP_HALT 2 #define GUI_IDLE_POWER_SAVE 3 -// -- +/* -- */ -// definition for WpaSupport flag +/* definition for WpaSupport flag */ #define WPA_SUPPLICANT_DISABLE 0 #define WPA_SUPPLICANT_ENABLE 1 #define WPA_SUPPLICANT_ENABLE_WITH_WEB_UI 2 -// Endian byte swapping codes +/* Endian byte swapping codes */ #define SWAP16(x) \ ((UINT16)( \ (((UINT16)(x) & (UINT16) 0x00ffU) << 8) | \ @@ -1423,4 +1423,4 @@ do{ \ } \ }while(0) -#endif // __RTMP_DEF_H__ +#endif /* __RTMP_DEF_H__ */ diff --git a/drivers/staging/rt2860/rtmp_dot11.h b/drivers/staging/rt2860/rtmp_dot11.h index 051840f8822e..fd9c7209bcbd 100644 --- a/drivers/staging/rt2860/rtmp_dot11.h +++ b/drivers/staging/rt2860/rtmp_dot11.h @@ -30,46 +30,46 @@ #include "rtmp_type.h" -// 4-byte HTC field. maybe included in any frame except non-QOS data frame. The Order bit must set 1. +/* 4-byte HTC field. maybe included in any frame except non-QOS data frame. The Order bit must set 1. */ typedef struct PACKED { - UINT32 MA:1; //management action payload exist in (QoS Null+HTC) - UINT32 TRQ:1; //sounding request - UINT32 MRQ:1; //MCS feedback. Request for a MCS feedback - UINT32 MRSorASI:3; // MRQ Sequence identifier. unchanged during entire procedure. 0x000-0x110. - UINT32 MFS:3; //SET to the received value of MRS. 0x111 for unsolicited MFB. - UINT32 MFBorASC:7; //Link adaptation feedback containing recommended MCS. 0x7f for no feedback or not available - UINT32 CalPos:2; // calibration position - UINT32 CalSeq:2; //calibration sequence - UINT32 FBKReq:2; //feedback request - UINT32 CSISTEERING:2; //CSI/ STEERING - UINT32 ZLFAnnouce:1; // ZLF announcement - UINT32 rsv:5; //calibration sequence - UINT32 ACConstraint:1; //feedback request - UINT32 RDG:1; //RDG / More PPDU + UINT32 MA:1; /*management action payload exist in (QoS Null+HTC) */ + UINT32 TRQ:1; /*sounding request */ + UINT32 MRQ:1; /*MCS feedback. Request for a MCS feedback */ + UINT32 MRSorASI:3; /* MRQ Sequence identifier. unchanged during entire procedure. 0x000-0x110. */ + UINT32 MFS:3; /*SET to the received value of MRS. 0x111 for unsolicited MFB. */ + UINT32 MFBorASC:7; /*Link adaptation feedback containing recommended MCS. 0x7f for no feedback or not available */ + UINT32 CalPos:2; /* calibration position */ + UINT32 CalSeq:2; /*calibration sequence */ + UINT32 FBKReq:2; /*feedback request */ + UINT32 CSISTEERING:2; /*CSI/ STEERING */ + UINT32 ZLFAnnouce:1; /* ZLF announcement */ + UINT32 rsv:5; /*calibration sequence */ + UINT32 ACConstraint:1; /*feedback request */ + UINT32 RDG:1; /*RDG / More PPDU */ } HT_CONTROL, *PHT_CONTROL; -// 2-byte QOS CONTROL field +/* 2-byte QOS CONTROL field */ typedef struct PACKED { USHORT TID:4; USHORT EOSP:1; - USHORT AckPolicy:2; //0: normal ACK 1:No ACK 2:scheduled under MTBA/PSMP 3: BA + USHORT AckPolicy:2; /*0: normal ACK 1:No ACK 2:scheduled under MTBA/PSMP 3: BA */ USHORT AMsduPresent:1; USHORT Txop_QueueSize:8; } QOS_CONTROL, *PQOS_CONTROL; -// 2-byte Frame control field +/* 2-byte Frame control field */ typedef struct PACKED { - USHORT Ver:2; // Protocol version - USHORT Type:2; // MSDU type - USHORT SubType:4; // MSDU subtype - USHORT ToDs:1; // To DS indication - USHORT FrDs:1; // From DS indication - USHORT MoreFrag:1; // More fragment bit - USHORT Retry:1; // Retry status bit - USHORT PwrMgmt:1; // Power management bit - USHORT MoreData:1; // More data bit - USHORT Wep:1; // Wep data - USHORT Order:1; // Strict order expected + USHORT Ver:2; /* Protocol version */ + USHORT Type:2; /* MSDU type */ + USHORT SubType:4; /* MSDU subtype */ + USHORT ToDs:1; /* To DS indication */ + USHORT FrDs:1; /* From DS indication */ + USHORT MoreFrag:1; /* More fragment bit */ + USHORT Retry:1; /* Retry status bit */ + USHORT PwrMgmt:1; /* Power management bit */ + USHORT MoreData:1; /* More data bit */ + USHORT Wep:1; /* Wep data */ + USHORT Order:1; /* Strict order expected */ } FRAME_CONTROL, *PFRAME_CONTROL; typedef struct PACKED _HEADER_802_11 { @@ -97,4 +97,4 @@ typedef struct PACKED _RTS_FRAME { UCHAR Addr2[MAC_ADDR_LEN]; } RTS_FRAME, *PRTS_FRAME; -#endif // __DOT11_BASE_H__ // +#endif /* __DOT11_BASE_H__ // */ diff --git a/drivers/staging/rt2860/rtmp_iface.h b/drivers/staging/rt2860/rtmp_iface.h index eee17d468442..84b08a05d84a 100644 --- a/drivers/staging/rt2860/rtmp_iface.h +++ b/drivers/staging/rt2860/rtmp_iface.h @@ -39,19 +39,19 @@ #ifdef RTMP_PCI_SUPPORT #include "iface/rtmp_pci.h" -#endif // RTMP_PCI_SUPPORT // +#endif /* RTMP_PCI_SUPPORT // */ #ifdef RTMP_USB_SUPPORT #include "iface/rtmp_usb.h" -#endif // RTMP_USB_SUPPORT // +#endif /* RTMP_USB_SUPPORT // */ typedef struct _INF_PCI_CONFIG_ { - unsigned long CSRBaseAddress; // PCI MMIO Base Address, all access will use + unsigned long CSRBaseAddress; /* PCI MMIO Base Address, all access will use */ unsigned int irq_num; } INF_PCI_CONFIG; typedef struct _INF_USB_CONFIG_ { - UINT8 BulkInEpAddr; // bulk-in endpoint address - UINT8 BulkOutEpAddr[6]; // bulk-out endpoint address + UINT8 BulkInEpAddr; /* bulk-in endpoint address */ + UINT8 BulkOutEpAddr[6]; /* bulk-out endpoint address */ } INF_USB_CONFIG; typedef struct _INF_RBUS_CONFIG_ { @@ -72,4 +72,4 @@ typedef union _RTMP_INF_CONFIG_ { struct _INF_RBUS_CONFIG_ rbusConfig; } RTMP_INF_CONFIG; -#endif // __RTMP_IFACE_H__ // +#endif /* __RTMP_IFACE_H__ // */ diff --git a/drivers/staging/rt2860/rtmp_mcu.h b/drivers/staging/rt2860/rtmp_mcu.h index 98dea1bb5788..1c317001b9ae 100644 --- a/drivers/staging/rt2860/rtmp_mcu.h +++ b/drivers/staging/rt2860/rtmp_mcu.h @@ -46,4 +46,4 @@ INT RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, IN UCHAR Command, IN UCHAR Token, IN UCHAR Arg0, IN UCHAR Arg1); -#endif // __RTMP_MCU_H__ // +#endif /* __RTMP_MCU_H__ // */ diff --git a/drivers/staging/rt2860/rtmp_os.h b/drivers/staging/rt2860/rtmp_os.h index 82b60fc6c260..eb79e6feb661 100644 --- a/drivers/staging/rt2860/rtmp_os.h +++ b/drivers/staging/rt2860/rtmp_os.h @@ -39,7 +39,7 @@ #ifdef LINUX #include "rt_linux.h" -#endif // LINUX // +#endif /* LINUX // */ /* This data structure mainly strip some callback function defined in @@ -69,7 +69,7 @@ typedef enum _RTMP_TASK_STATUS_ { typedef struct _RTMP_OS_TASK_ { char taskName[RTMP_OS_TASK_NAME_LEN]; void *priv; - //unsigned long taskFlags; + /*unsigned long taskFlags; */ RTMP_TASK_STATUS taskStatus; #ifndef KTHREAD_SUPPORT RTMP_OS_SEM taskSema; @@ -87,4 +87,4 @@ typedef struct _RTMP_OS_TASK_ { int RtmpOSIRQRequest(IN PNET_DEV pNetDev); int RtmpOSIRQRelease(IN PNET_DEV pNetDev); -#endif // __RMTP_OS_H__ // +#endif /* __RMTP_OS_H__ // */ diff --git a/drivers/staging/rt2860/rtmp_timer.h b/drivers/staging/rt2860/rtmp_timer.h index 9f771979710b..e1365765cd7a 100644 --- a/drivers/staging/rt2860/rtmp_timer.h +++ b/drivers/staging/rt2860/rtmp_timer.h @@ -50,29 +50,29 @@ rtmp_timer_##_func /* ----------------- Timer Related MARCO ---------------*/ -// In some os or chipset, we have a lot of timer functions and will read/write register, -// it's not allowed in Linux USB sub-system to do it ( because of sleep issue when -// submit to ctrl pipe). So we need a wrapper function to take care it. +/* In some os or chipset, we have a lot of timer functions and will read/write register, */ +/* it's not allowed in Linux USB sub-system to do it ( because of sleep issue when */ +/* submit to ctrl pipe). So we need a wrapper function to take care it. */ #ifdef RTMP_TIMER_TASK_SUPPORT typedef VOID(*RTMP_TIMER_TASK_HANDLE) (IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); -#endif // RTMP_TIMER_TASK_SUPPORT // +#endif /* RTMP_TIMER_TASK_SUPPORT // */ typedef struct _RALINK_TIMER_STRUCT { - RTMP_OS_TIMER TimerObj; // Ndis Timer object - BOOLEAN Valid; // Set to True when call RTMPInitTimer - BOOLEAN State; // True if timer cancelled - BOOLEAN PeriodicType; // True if timer is periodic timer - BOOLEAN Repeat; // True if periodic timer - ULONG TimerValue; // Timer value in milliseconds - ULONG cookie; // os specific object + RTMP_OS_TIMER TimerObj; /* Ndis Timer object */ + BOOLEAN Valid; /* Set to True when call RTMPInitTimer */ + BOOLEAN State; /* True if timer cancelled */ + BOOLEAN PeriodicType; /* True if timer is periodic timer */ + BOOLEAN Repeat; /* True if periodic timer */ + ULONG TimerValue; /* Timer value in milliseconds */ + ULONG cookie; /* os specific object */ #ifdef RTMP_TIMER_TASK_SUPPORT RTMP_TIMER_TASK_HANDLE handle; void *pAd; -#endif // RTMP_TIMER_TASK_SUPPORT // +#endif /* RTMP_TIMER_TASK_SUPPORT // */ } RALINK_TIMER_STRUCT, *PRALINK_TIMER_STRUCT; #ifdef RTMP_TIMER_TASK_SUPPORT @@ -113,7 +113,7 @@ void rtmp_timer_##_func(unsigned long data) \ if (pTimer->Repeat) \ RTMP_OS_Add_Timer(&pTimer->TimerObj, pTimer->TimerValue); \ } -#endif // RTMP_TIMER_TASK_SUPPORT // +#endif /* RTMP_TIMER_TASK_SUPPORT // */ DECLARE_TIMER_FUNCTION(MlmePeriodicExec); DECLARE_TIMER_FUNCTION(MlmeRssiReportExec); @@ -122,7 +122,7 @@ DECLARE_TIMER_FUNCTION(APSDPeriodicExec); DECLARE_TIMER_FUNCTION(AsicRfTuningExec); #ifdef RTMP_MAC_USB DECLARE_TIMER_FUNCTION(BeaconUpdateExec); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ DECLARE_TIMER_FUNCTION(BeaconTimeout); DECLARE_TIMER_FUNCTION(ScanTimeout); @@ -138,10 +138,10 @@ DECLARE_TIMER_FUNCTION(RadioOnExec); #ifdef RTMP_MAC_USB DECLARE_TIMER_FUNCTION(RtmpUsbStaAsicForceWakeupTimeout); -#endif // RTMP_MAC_USB // +#endif /* RTMP_MAC_USB // */ #if defined(AP_LED) || defined(STA_LED) DECLARE_TIMER_FUNCTION(LedCtrlMain); #endif -#endif // __RTMP_TIMER_H__ // +#endif /* __RTMP_TIMER_H__ // */ diff --git a/drivers/staging/rt2860/rtmp_type.h b/drivers/staging/rt2860/rtmp_type.h index 4900f9fd444c..11e3591cf76f 100644 --- a/drivers/staging/rt2860/rtmp_type.h +++ b/drivers/staging/rt2860/rtmp_type.h @@ -41,15 +41,15 @@ #define PACKED __attribute__ ((packed)) #ifdef LINUX -// Put platform dependent declaration here -// For example, linux type definition +/* Put platform dependent declaration here */ +/* For example, linux type definition */ typedef unsigned char UINT8; typedef unsigned short UINT16; typedef unsigned int UINT32; typedef unsigned long long UINT64; typedef int INT32; typedef long long INT64; -#endif // LINUX // +#endif /* LINUX // */ typedef unsigned char *PUINT8; typedef unsigned short *PUINT16; @@ -58,7 +58,7 @@ typedef unsigned long long *PUINT64; typedef int *PINT32; typedef long long *PINT64; -// modified for fixing compile warning on Sigma 8634 platform +/* modified for fixing compile warning on Sigma 8634 platform */ typedef char STRING; typedef signed char CHAR; @@ -72,13 +72,13 @@ typedef unsigned char UCHAR; typedef unsigned short USHORT; typedef unsigned int UINT; typedef unsigned long ULONG; -#endif // LINUX // +#endif /* LINUX // */ typedef unsigned long long ULONGLONG; typedef unsigned char BOOLEAN; #ifdef LINUX typedef void VOID; -#endif // LINUX // +#endif /* LINUX // */ typedef char *PSTRING; typedef VOID *PVOID; @@ -99,9 +99,9 @@ typedef union _LARGE_INTEGER { INT64 QuadPart; } LARGE_INTEGER; -// -// Register set pair for initialzation register set definition -// +/* */ +/* Register set pair for initialzation register set definition */ +/* */ typedef struct _RTMP_REG_PAIR { ULONG Register; ULONG Value; @@ -112,9 +112,9 @@ typedef struct _REG_PAIR { UCHAR Value; } REG_PAIR, *PREG_PAIR; -// -// Register set pair for initialzation register set definition -// +/* */ +/* Register set pair for initialzation register set definition */ +/* */ typedef struct _RTMP_RF_REGS { UCHAR Channel; ULONG R1; @@ -135,4 +135,4 @@ typedef int NTSTATUS; #define STATUS_SUCCESS 0x00 #define STATUS_UNSUCCESSFUL 0x01 -#endif // __RTMP_TYPE_H__ // +#endif /* __RTMP_TYPE_H__ // */ diff --git a/drivers/staging/rt2860/rtusb_io.h b/drivers/staging/rt2860/rtusb_io.h index 6217dd2430f8..ec1ffbab3690 100644 --- a/drivers/staging/rt2860/rtusb_io.h +++ b/drivers/staging/rt2860/rtusb_io.h @@ -30,54 +30,54 @@ #include "rtmp_type.h" -// New for MeetingHouse Api support -#define CMDTHREAD_VENDOR_RESET 0x0D730101 // cmd -#define CMDTHREAD_VENDOR_UNPLUG 0x0D730102 // cmd -#define CMDTHREAD_VENDOR_SWITCH_FUNCTION 0x0D730103 // cmd -#define CMDTHREAD_MULTI_WRITE_MAC 0x0D730107 // cmd -#define CMDTHREAD_MULTI_READ_MAC 0x0D730108 // cmd -#define CMDTHREAD_VENDOR_EEPROM_WRITE 0x0D73010A // cmd -#define CMDTHREAD_VENDOR_EEPROM_READ 0x0D73010B // cmd -#define CMDTHREAD_VENDOR_ENTER_TESTMODE 0x0D73010C // cmd -#define CMDTHREAD_VENDOR_EXIT_TESTMODE 0x0D73010D // cmd -#define CMDTHREAD_VENDOR_WRITE_BBP 0x0D730119 // cmd -#define CMDTHREAD_VENDOR_READ_BBP 0x0D730118 // cmd -#define CMDTHREAD_VENDOR_WRITE_RF 0x0D73011A // cmd -#define CMDTHREAD_VENDOR_FLIP_IQ 0x0D73011D // cmd -#define CMDTHREAD_RESET_BULK_OUT 0x0D730210 // cmd -#define CMDTHREAD_RESET_BULK_IN 0x0D730211 // cmd -#define CMDTHREAD_SET_PSM_BIT 0x0D730212 // cmd -#define CMDTHREAD_SET_RADIO 0x0D730214 // cmd -#define CMDTHREAD_UPDATE_TX_RATE 0x0D730216 // cmd -#define CMDTHREAD_802_11_ADD_KEY_WEP 0x0D730218 // cmd -#define CMDTHREAD_RESET_FROM_ERROR 0x0D73021A // cmd -#define CMDTHREAD_LINK_DOWN 0x0D73021B // cmd -#define CMDTHREAD_RESET_FROM_NDIS 0x0D73021C // cmd -#define CMDTHREAD_CHECK_GPIO 0x0D730215 // cmd -#define CMDTHREAD_FORCE_WAKE_UP 0x0D730222 // cmd -#define CMDTHREAD_SET_BW 0x0D730225 // cmd -#define CMDTHREAD_SET_ASIC_WCID 0x0D730226 // cmd -#define CMDTHREAD_SET_ASIC_WCID_CIPHER 0x0D730227 // cmd -#define CMDTHREAD_QKERIODIC_EXECUT 0x0D73023D // cmd -#define RT_CMD_SET_KEY_TABLE 0x0D730228 // cmd -#define RT_CMD_SET_RX_WCID_TABLE 0x0D730229 // cmd -#define CMDTHREAD_SET_CLIENT_MAC_ENTRY 0x0D73023E // cmd -#define CMDTHREAD_SET_GROUP_KEY 0x0D73023F // cmd -#define CMDTHREAD_SET_PAIRWISE_KEY 0x0D730240 // cmd - -#define CMDTHREAD_802_11_QUERY_HARDWARE_REGISTER 0x0D710105 // cmd -#define CMDTHREAD_802_11_SET_PHY_MODE 0x0D79010C // cmd -#define CMDTHREAD_802_11_SET_STA_CONFIG 0x0D790111 // cmd -#define CMDTHREAD_802_11_SET_PREAMBLE 0x0D790101 // cmd -#define CMDTHREAD_802_11_COUNTER_MEASURE 0x0D790102 // cmd -// add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet -#define CMDTHREAD_UPDATE_PROTECT 0x0D790103 // cmd -// end johnli - -//CMDTHREAD_MULTI_READ_MAC -//CMDTHREAD_MULTI_WRITE_MAC -//CMDTHREAD_VENDOR_EEPROM_READ -//CMDTHREAD_VENDOR_EEPROM_WRITE +/* New for MeetingHouse Api support */ +#define CMDTHREAD_VENDOR_RESET 0x0D730101 /* cmd */ +#define CMDTHREAD_VENDOR_UNPLUG 0x0D730102 /* cmd */ +#define CMDTHREAD_VENDOR_SWITCH_FUNCTION 0x0D730103 /* cmd */ +#define CMDTHREAD_MULTI_WRITE_MAC 0x0D730107 /* cmd */ +#define CMDTHREAD_MULTI_READ_MAC 0x0D730108 /* cmd */ +#define CMDTHREAD_VENDOR_EEPROM_WRITE 0x0D73010A /* cmd */ +#define CMDTHREAD_VENDOR_EEPROM_READ 0x0D73010B /* cmd */ +#define CMDTHREAD_VENDOR_ENTER_TESTMODE 0x0D73010C /* cmd */ +#define CMDTHREAD_VENDOR_EXIT_TESTMODE 0x0D73010D /* cmd */ +#define CMDTHREAD_VENDOR_WRITE_BBP 0x0D730119 /* cmd */ +#define CMDTHREAD_VENDOR_READ_BBP 0x0D730118 /* cmd */ +#define CMDTHREAD_VENDOR_WRITE_RF 0x0D73011A /* cmd */ +#define CMDTHREAD_VENDOR_FLIP_IQ 0x0D73011D /* cmd */ +#define CMDTHREAD_RESET_BULK_OUT 0x0D730210 /* cmd */ +#define CMDTHREAD_RESET_BULK_IN 0x0D730211 /* cmd */ +#define CMDTHREAD_SET_PSM_BIT 0x0D730212 /* cmd */ +#define CMDTHREAD_SET_RADIO 0x0D730214 /* cmd */ +#define CMDTHREAD_UPDATE_TX_RATE 0x0D730216 /* cmd */ +#define CMDTHREAD_802_11_ADD_KEY_WEP 0x0D730218 /* cmd */ +#define CMDTHREAD_RESET_FROM_ERROR 0x0D73021A /* cmd */ +#define CMDTHREAD_LINK_DOWN 0x0D73021B /* cmd */ +#define CMDTHREAD_RESET_FROM_NDIS 0x0D73021C /* cmd */ +#define CMDTHREAD_CHECK_GPIO 0x0D730215 /* cmd */ +#define CMDTHREAD_FORCE_WAKE_UP 0x0D730222 /* cmd */ +#define CMDTHREAD_SET_BW 0x0D730225 /* cmd */ +#define CMDTHREAD_SET_ASIC_WCID 0x0D730226 /* cmd */ +#define CMDTHREAD_SET_ASIC_WCID_CIPHER 0x0D730227 /* cmd */ +#define CMDTHREAD_QKERIODIC_EXECUT 0x0D73023D /* cmd */ +#define RT_CMD_SET_KEY_TABLE 0x0D730228 /* cmd */ +#define RT_CMD_SET_RX_WCID_TABLE 0x0D730229 /* cmd */ +#define CMDTHREAD_SET_CLIENT_MAC_ENTRY 0x0D73023E /* cmd */ +#define CMDTHREAD_SET_GROUP_KEY 0x0D73023F /* cmd */ +#define CMDTHREAD_SET_PAIRWISE_KEY 0x0D730240 /* cmd */ + +#define CMDTHREAD_802_11_QUERY_HARDWARE_REGISTER 0x0D710105 /* cmd */ +#define CMDTHREAD_802_11_SET_PHY_MODE 0x0D79010C /* cmd */ +#define CMDTHREAD_802_11_SET_STA_CONFIG 0x0D790111 /* cmd */ +#define CMDTHREAD_802_11_SET_PREAMBLE 0x0D790101 /* cmd */ +#define CMDTHREAD_802_11_COUNTER_MEASURE 0x0D790102 /* cmd */ +/* add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet */ +#define CMDTHREAD_UPDATE_PROTECT 0x0D790103 /* cmd */ +/* end johnli */ + +/*CMDTHREAD_MULTI_READ_MAC */ +/*CMDTHREAD_MULTI_WRITE_MAC */ +/*CMDTHREAD_VENDOR_EEPROM_READ */ +/*CMDTHREAD_VENDOR_EEPROM_WRITE */ typedef struct _CMDHandler_TLV { USHORT Offset; USHORT Length; @@ -116,7 +116,7 @@ typedef struct _CmdQ { USB Cmd to ASIC Related MACRO ******************************************************************************/ -// reset MAC of a station entry to 0xFFFFFFFFFFFF +/* reset MAC of a station entry to 0xFFFFFFFFFFFF */ #define RTMP_STA_ENTRY_MAC_RESET(pAd, Wcid) \ { RT_SET_ASIC_WCID SetAsicWcid; \ SetAsicWcid.WCID = Wcid; \ @@ -125,22 +125,22 @@ typedef struct _CmdQ { RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_ASIC_WCID, \ &SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); } -// add this entry into ASIC RX WCID search table +/* add this entry into ASIC RX WCID search table */ #define RTMP_STA_ENTRY_ADD(pAd, pEntry) \ RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_CLIENT_MAC_ENTRY, \ pEntry, sizeof(MAC_TABLE_ENTRY)); -// add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet -// Set MAC register value according operation mode +/* add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet */ +/* Set MAC register value according operation mode */ #define RTMP_UPDATE_PROTECT(pAd) \ RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_UPDATE_PROTECT, NULL, 0); -// end johnli +/* end johnli */ -// remove Pair-wise key material from ASIC -// yet implement +/* remove Pair-wise key material from ASIC */ +/* yet implement */ #define RTMP_STA_ENTRY_KEY_DEL(pAd, BssIdx, Wcid) -// add Client security information into ASIC WCID table and IVEIV table +/* add Client security information into ASIC WCID table and IVEIV table */ #define RTMP_STA_SECURITY_INFO_ADD(pAd, apidx, KeyID, pEntry) \ { RTMP_STA_ENTRY_MAC_RESET(pAd, pEntry->Aid); \ if (pEntry->Aid >= 1) { \ @@ -160,7 +160,7 @@ typedef struct _CmdQ { RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_ASIC_WCID_CIPHER, \ &SetAsicWcidAttri, sizeof(RT_SET_ASIC_WCID_ATTRI)); } } -// Insert the BA bitmap to ASIC for the Wcid entry +/* Insert the BA bitmap to ASIC for the Wcid entry */ #define RTMP_ADD_BA_SESSION_TO_ASIC(_pAd, _Aid, _TID) \ do{ \ RT_SET_ASIC_WCID SetAsicWcid; \ @@ -170,7 +170,7 @@ typedef struct _CmdQ { RTUSBEnqueueInternalCmd((_pAd), CMDTHREAD_SET_ASIC_WCID, &SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); \ }while(0) -// Remove the BA bitmap from ASIC for the Wcid entry +/* Remove the BA bitmap from ASIC for the Wcid entry */ #define RTMP_DEL_BA_SESSION_FROM_ASIC(_pAd, _Wcid, _TID) \ do{ \ RT_SET_ASIC_WCID SetAsicWcid; \ @@ -180,4 +180,4 @@ typedef struct _CmdQ { RTUSBEnqueueInternalCmd((_pAd), CMDTHREAD_SET_ASIC_WCID, &SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); \ }while(0) -#endif // __RTUSB_IO_H__ // +#endif /* __RTUSB_IO_H__ // */ diff --git a/drivers/staging/rt2860/spectrum.h b/drivers/staging/rt2860/spectrum.h index 64154e9fb6fe..b1e3ba0917d1 100644 --- a/drivers/staging/rt2860/spectrum.h +++ b/drivers/staging/rt2860/spectrum.h @@ -186,4 +186,4 @@ VOID NotifyChSwAnnToPeerAPs(IN PRTMP_ADAPTER pAd, VOID RguClass_BuildBcnChList(IN PRTMP_ADAPTER pAd, OUT PUCHAR pBuf, OUT PULONG pBufLen); -#endif // __SPECTRUM_H__ // +#endif /* __SPECTRUM_H__ // */ diff --git a/drivers/staging/rt2860/spectrum_def.h b/drivers/staging/rt2860/spectrum_def.h index 4ebe5f50cc2f..d100c3188bb7 100644 --- a/drivers/staging/rt2860/spectrum_def.h +++ b/drivers/staging/rt2860/spectrum_def.h @@ -58,7 +58,7 @@ typedef struct _MEASURE_REQ_ENTRY { ULONG lastTime; BOOLEAN Valid; UINT8 DialogToken; - UINT8 MeasureDialogToken[3]; // 0:basic measure, 1: CCA measure, 2: RPI_Histogram measure. + UINT8 MeasureDialogToken[3]; /* 0:basic measure, 1: CCA measure, 2: RPI_Histogram measure. */ } MEASURE_REQ_ENTRY, *PMEASURE_REQ_ENTRY; typedef struct _MEASURE_REQ_TAB { @@ -195,4 +195,4 @@ typedef struct PACKED _QUIET_INFO { UINT16 QuietOffset; } QUIET_INFO, *PQUIET_INFO; -#endif // __SPECTRUM_DEF_H__ // +#endif /* __SPECTRUM_DEF_H__ // */ diff --git a/drivers/staging/rt2860/wpa.h b/drivers/staging/rt2860/wpa.h index fb5843cd2628..5f998c7eeaeb 100644 --- a/drivers/staging/rt2860/wpa.h +++ b/drivers/staging/rt2860/wpa.h @@ -38,7 +38,7 @@ #ifndef __WPA_H__ #define __WPA_H__ -// EAPOL Key descripter frame format related length +/* EAPOL Key descripter frame format related length */ #define LEN_KEY_DESC_NONCE 32 #define LEN_KEY_DESC_IV 16 #define LEN_KEY_DESC_RSC 8 @@ -46,25 +46,25 @@ #define LEN_KEY_DESC_REPLAY 8 #define LEN_KEY_DESC_MIC 16 -// The length is the EAPoL-Key frame except key data field. -// Please refer to 802.11i-2004 ,Figure 43u in p.78 +/* The length is the EAPoL-Key frame except key data field. */ +/* Please refer to 802.11i-2004 ,Figure 43u in p.78 */ #define LEN_EAPOL_KEY_MSG (sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE) -// EAP Code Type. +/* EAP Code Type. */ #define EAP_CODE_REQUEST 1 #define EAP_CODE_RESPONSE 2 #define EAP_CODE_SUCCESS 3 #define EAP_CODE_FAILURE 4 -// EAPOL frame Protocol Version +/* EAPOL frame Protocol Version */ #define EAPOL_VER 1 #define EAPOL_VER2 2 -// EAPOL-KEY Descriptor Type +/* EAPOL-KEY Descriptor Type */ #define WPA1_KEY_DESC 0xfe #define WPA2_KEY_DESC 0x02 -// Key Descriptor Version of Key Information +/* Key Descriptor Version of Key Information */ #define DESC_TYPE_TKIP 1 #define DESC_TYPE_AES 2 @@ -73,11 +73,11 @@ #define LEN_MASTER_KEY 32 -// EAPOL EK, MK +/* EAPOL EK, MK */ #define LEN_EAP_EK 16 #define LEN_EAP_MICK 16 #define LEN_EAP_KEY ((LEN_EAP_EK)+(LEN_EAP_MICK)) -// TKIP key related +/* TKIP key related */ #define LEN_PMKID 16 #define LEN_TKIP_EK 16 #define LEN_TKIP_RXMICK 8 @@ -94,13 +94,13 @@ #define LEN_PMK_NAME 16 #define LEN_NONCE 32 -// RSN IE Length definition +/* RSN IE Length definition */ #define MAX_LEN_OF_RSNIE 255 #define MIN_LEN_OF_RSNIE 8 #define KEY_LIFETIME 3600 -//EAP Packet Type +/*EAP Packet Type */ #define EAPPacket 0 #define EAPOLStart 1 #define EAPOLLogoff 2 @@ -119,28 +119,28 @@ #define PAIRWISEKEY 1 #define GROUPKEY 0 -// Retry timer counter initial value +/* Retry timer counter initial value */ #define PEER_MSG1_RETRY_TIMER_CTR 0 #define PEER_MSG3_RETRY_TIMER_CTR 10 #define GROUP_MSG1_RETRY_TIMER_CTR 20 -//#ifdef CONFIG_AP_SUPPORT -// WPA mechanism retry timer interval -#define PEER_MSG1_RETRY_EXEC_INTV 1000 // 1 sec -#define PEER_MSG3_RETRY_EXEC_INTV 3000 // 3 sec -#define GROUP_KEY_UPDATE_EXEC_INTV 1000 // 1 sec -#define PEER_GROUP_KEY_UPDATE_INIV 2000 // 2 sec +/*#ifdef CONFIG_AP_SUPPORT */ +/* WPA mechanism retry timer interval */ +#define PEER_MSG1_RETRY_EXEC_INTV 1000 /* 1 sec */ +#define PEER_MSG3_RETRY_EXEC_INTV 3000 /* 3 sec */ +#define GROUP_KEY_UPDATE_EXEC_INTV 1000 /* 1 sec */ +#define PEER_GROUP_KEY_UPDATE_INIV 2000 /* 2 sec */ -#define ENQUEUE_EAPOL_START_TIMER 200 // 200 ms +#define ENQUEUE_EAPOL_START_TIMER 200 /* 200 ms */ -// group rekey interval +/* group rekey interval */ #define TIME_REKEY 0 #define PKT_REKEY 1 #define DISABLE_REKEY 2 #define MAX_REKEY 2 #define MAX_REKEY_INTER 0x3ffffff -//#endif // CONFIG_AP_SUPPORT // +/*#endif // CONFIG_AP_SUPPORT // */ #define GROUP_SUITE 0 #define PAIRWISE_SUITE 1 @@ -194,13 +194,13 @@ #define IS_WPA_CAPABILITY(a) (((a) >= Ndis802_11AuthModeWPA) && ((a) <= Ndis802_11AuthModeWPA1PSKWPA2PSK)) -// EAPOL Key Information definition within Key descriptor format +/* EAPOL Key Information definition within Key descriptor format */ typedef struct PACKED _KEY_INFO { UCHAR KeyMic:1; UCHAR Secure:1; UCHAR Error:1; UCHAR Request:1; - UCHAR EKD_DL:1; // EKD for AP; DL for STA + UCHAR EKD_DL:1; /* EKD for AP; DL for STA */ UCHAR Rsvd:3; UCHAR KeyDescVer:3; UCHAR KeyType:1; @@ -209,7 +209,7 @@ typedef struct PACKED _KEY_INFO { UCHAR KeyAck:1; } KEY_INFO, *PKEY_INFO; -// EAPOL Key descriptor format +/* EAPOL Key descriptor format */ typedef struct PACKED _KEY_DESCRIPTER { UCHAR Type; KEY_INFO KeyInfo; @@ -231,7 +231,7 @@ typedef struct PACKED _EAPOL_PACKET { KEY_DESCRIPTER KeyDesc; } EAPOL_PACKET, *PEAPOL_PACKET; -//802.11i D10 page 83 +/*802.11i D10 page 83 */ typedef struct PACKED _GTK_ENCAP { UCHAR Kid:2; UCHAR tx:1; @@ -248,7 +248,7 @@ typedef struct PACKED _KDE_ENCAP { GTK_ENCAP GTKEncap; } KDE_ENCAP, *PKDE_ENCAP; -// For WPA1 +/* For WPA1 */ typedef struct PACKED _RSNIE { UCHAR oui[4]; USHORT version; @@ -259,7 +259,7 @@ typedef struct PACKED _RSNIE { } ucast[1]; } RSNIE, *PRSNIE; -// For WPA2 +/* For WPA2 */ typedef struct PACKED _RSNIE2 { USHORT version; UCHAR mcast[4]; @@ -269,7 +269,7 @@ typedef struct PACKED _RSNIE2 { } ucast[1]; } RSNIE2, *PRSNIE2; -// AKM Suite +/* AKM Suite */ typedef struct PACKED _RSNIE_AUTH { USHORT acount; struct PACKED { @@ -294,45 +294,45 @@ typedef struct PACKED _EAP_HDR { UCHAR Body_Len[2]; UCHAR code; UCHAR identifier; - UCHAR length[2]; // including code and identifier, followed by length-2 octets of data + UCHAR length[2]; /* including code and identifier, followed by length-2 octets of data */ } EAP_HDR, *PEAP_HDR; -// For supplicant state machine states. 802.11i Draft 4.1, p. 97 -// We simplified it +/* For supplicant state machine states. 802.11i Draft 4.1, p. 97 */ +/* We simplified it */ typedef enum _WpaState { - SS_NOTUSE, // 0 - SS_START, // 1 - SS_WAIT_MSG_3, // 2 - SS_WAIT_GROUP, // 3 - SS_FINISH, // 4 - SS_KEYUPDATE, // 5 + SS_NOTUSE, /* 0 */ + SS_START, /* 1 */ + SS_WAIT_MSG_3, /* 2 */ + SS_WAIT_GROUP, /* 3 */ + SS_FINISH, /* 4 */ + SS_KEYUPDATE, /* 5 */ } WPA_STATE; -// -// The definition of the cipher combination -// -// bit3 bit2 bit1 bit0 -// +------------+------------+ -// | WPA | WPA2 | -// +------+-----+------+-----+ -// | TKIP | AES | TKIP | AES | -// | 0 | 1 | 1 | 0 | -> 0x06 -// | 0 | 1 | 1 | 1 | -> 0x07 -// | 1 | 0 | 0 | 1 | -> 0x09 -// | 1 | 0 | 1 | 1 | -> 0x0B -// | 1 | 1 | 0 | 1 | -> 0x0D -// | 1 | 1 | 1 | 0 | -> 0x0E -// | 1 | 1 | 1 | 1 | -> 0x0F -// +------+-----+------+-----+ -// +/* */ +/* The definition of the cipher combination */ +/* */ +/* bit3 bit2 bit1 bit0 */ +/* +------------+------------+ */ +/* | WPA | WPA2 | */ +/* +------+-----+------+-----+ */ +/* | TKIP | AES | TKIP | AES | */ +/* | 0 | 1 | 1 | 0 | -> 0x06 */ +/* | 0 | 1 | 1 | 1 | -> 0x07 */ +/* | 1 | 0 | 0 | 1 | -> 0x09 */ +/* | 1 | 0 | 1 | 1 | -> 0x0B */ +/* | 1 | 1 | 0 | 1 | -> 0x0D */ +/* | 1 | 1 | 1 | 0 | -> 0x0E */ +/* | 1 | 1 | 1 | 1 | -> 0x0F */ +/* +------+-----+------+-----+ */ +/* */ typedef enum _WpaMixPairCipher { MIX_CIPHER_NOTUSE = 0x00, - WPA_NONE_WPA2_TKIPAES = 0x03, // WPA2-TKIPAES + WPA_NONE_WPA2_TKIPAES = 0x03, /* WPA2-TKIPAES */ WPA_AES_WPA2_TKIP = 0x06, WPA_AES_WPA2_TKIPAES = 0x07, WPA_TKIP_WPA2_AES = 0x09, WPA_TKIP_WPA2_TKIPAES = 0x0B, - WPA_TKIPAES_WPA2_NONE = 0x0C, // WPA-TKIPAES + WPA_TKIPAES_WPA2_NONE = 0x0C, /* WPA-TKIPAES */ WPA_TKIPAES_WPA2_AES = 0x0D, WPA_TKIPAES_WPA2_TKIP = 0x0E, WPA_TKIPAES_WPA2_TKIPAES = 0x0F, @@ -341,22 +341,22 @@ typedef enum _WpaMixPairCipher { typedef struct PACKED _RSN_IE_HEADER_STRUCT { UCHAR Eid; UCHAR Length; - USHORT Version; // Little endian format + USHORT Version; /* Little endian format */ } RSN_IE_HEADER_STRUCT, *PRSN_IE_HEADER_STRUCT; -// Cipher suite selector types +/* Cipher suite selector types */ typedef struct PACKED _CIPHER_SUITE_STRUCT { UCHAR Oui[3]; UCHAR Type; } CIPHER_SUITE_STRUCT, *PCIPHER_SUITE_STRUCT; -// Authentication and Key Management suite selector +/* Authentication and Key Management suite selector */ typedef struct PACKED _AKM_SUITE_STRUCT { UCHAR Oui[3]; UCHAR Type; } AKM_SUITE_STRUCT, *PAKM_SUITE_STRUCT; -// RSN capability +/* RSN capability */ typedef struct PACKED _RSN_CAPABILITY { USHORT Rsv:10; USHORT GTKSAReplayCnt:2; -- GitLab From 51126deb201c59cc8cdc4873e3d130d6bc60513d Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 11 Dec 2009 12:23:15 -0800 Subject: [PATCH 167/235] Staging: rt28x0: remove typedefs (part one) Remove typedefs from rtmp_type.h. Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/ap.h | 20 +- drivers/staging/rt2860/chip/mac_pci.h | 104 +- drivers/staging/rt2860/chip/mac_usb.h | 114 +- drivers/staging/rt2860/chip/rt30xx.h | 2 +- drivers/staging/rt2860/chip/rtmp_mac.h | 980 ++--- drivers/staging/rt2860/chip/rtmp_phy.h | 18 +- drivers/staging/rt2860/chips/rt3070.c | 20 +- drivers/staging/rt2860/chips/rt3090.c | 16 +- drivers/staging/rt2860/chips/rt30xx.c | 42 +- drivers/staging/rt2860/chlist.h | 28 +- drivers/staging/rt2860/common/action.c | 108 +- drivers/staging/rt2860/common/action.h | 12 +- drivers/staging/rt2860/common/ba_action.c | 250 +- drivers/staging/rt2860/common/cmm_aes.c | 142 +- drivers/staging/rt2860/common/cmm_asic.c | 264 +- drivers/staging/rt2860/common/cmm_cfg.c | 42 +- drivers/staging/rt2860/common/cmm_data.c | 316 +- drivers/staging/rt2860/common/cmm_data_pci.c | 136 +- drivers/staging/rt2860/common/cmm_data_usb.c | 148 +- drivers/staging/rt2860/common/cmm_info.c | 88 +- drivers/staging/rt2860/common/cmm_mac_pci.c | 102 +- drivers/staging/rt2860/common/cmm_mac_usb.c | 90 +- drivers/staging/rt2860/common/cmm_sanity.c | 192 +- drivers/staging/rt2860/common/cmm_sync.c | 118 +- drivers/staging/rt2860/common/cmm_tkip.c | 224 +- drivers/staging/rt2860/common/cmm_wep.c | 86 +- drivers/staging/rt2860/common/cmm_wpa.c | 554 +-- drivers/staging/rt2860/common/crypt_hmac.c | 28 +- drivers/staging/rt2860/common/crypt_md5.c | 40 +- drivers/staging/rt2860/common/crypt_sha2.c | 34 +- drivers/staging/rt2860/common/dfs.c | 4 +- drivers/staging/rt2860/common/ee_efuse.c | 90 +- drivers/staging/rt2860/common/ee_prom.c | 34 +- drivers/staging/rt2860/common/eeprom.c | 4 +- drivers/staging/rt2860/common/firmware.h | 2 +- drivers/staging/rt2860/common/firmware_3070.h | 2 +- drivers/staging/rt2860/common/mlme.c | 646 +-- drivers/staging/rt2860/common/rt_channel.c | 66 +- drivers/staging/rt2860/common/rt_rf.c | 18 +- drivers/staging/rt2860/common/rtmp_init.c | 322 +- drivers/staging/rt2860/common/rtmp_mcu.c | 28 +- drivers/staging/rt2860/common/rtmp_timer.c | 10 +- drivers/staging/rt2860/common/spectrum.c | 430 +- drivers/staging/rt2860/crypt_hmac.h | 16 +- drivers/staging/rt2860/crypt_md5.h | 22 +- drivers/staging/rt2860/crypt_sha2.h | 22 +- drivers/staging/rt2860/dfs.h | 2 +- drivers/staging/rt2860/eeprom.h | 10 +- drivers/staging/rt2860/iface/rtmp_usb.h | 18 +- drivers/staging/rt2860/mlme.h | 732 ++-- drivers/staging/rt2860/oid.h | 364 +- drivers/staging/rt2860/pci_main_dev.c | 106 +- drivers/staging/rt2860/rt_linux.c | 168 +- drivers/staging/rt2860/rt_linux.h | 59 +- drivers/staging/rt2860/rt_main_dev.c | 24 +- drivers/staging/rt2860/rt_pci_rbus.c | 64 +- drivers/staging/rt2860/rt_usb.c | 36 +- drivers/staging/rt2860/rtmp.h | 3446 ++++++++--------- drivers/staging/rt2860/rtmp_chip.h | 90 +- drivers/staging/rt2860/rtmp_ckipmic.h | 24 +- drivers/staging/rt2860/rtmp_def.h | 76 +- drivers/staging/rt2860/rtmp_dot11.h | 86 +- drivers/staging/rt2860/rtmp_iface.h | 4 +- drivers/staging/rt2860/rtmp_mcu.h | 10 +- drivers/staging/rt2860/rtmp_timer.h | 14 +- drivers/staging/rt2860/rtmp_type.h | 85 +- drivers/staging/rt2860/rtusb_io.h | 16 +- drivers/staging/rt2860/spectrum.h | 102 +- drivers/staging/rt2860/spectrum_def.h | 120 +- drivers/staging/rt2860/sta/assoc.c | 242 +- drivers/staging/rt2860/sta/auth.c | 98 +- drivers/staging/rt2860/sta/auth_rsp.c | 22 +- drivers/staging/rt2860/sta/connect.c | 202 +- drivers/staging/rt2860/sta/rtmp_data.c | 290 +- drivers/staging/rt2860/sta/sanity.c | 92 +- drivers/staging/rt2860/sta/sync.c | 260 +- drivers/staging/rt2860/sta/wpa.c | 62 +- drivers/staging/rt2860/sta_ioctl.c | 128 +- drivers/staging/rt2860/usb_main_dev.c | 40 +- drivers/staging/rt2860/wpa.h | 176 +- drivers/staging/rt2870/common/rtusb_bulk.c | 82 +- drivers/staging/rt2870/common/rtusb_data.c | 38 +- drivers/staging/rt2870/common/rtusb_io.c | 262 +- drivers/staging/rt3070/firmware.h | 2 +- drivers/staging/rt3070/md4.h | 12 +- drivers/staging/rt3090/firmware.h | 2 +- 86 files changed, 6825 insertions(+), 6875 deletions(-) diff --git a/drivers/staging/rt2860/ap.h b/drivers/staging/rt2860/ap.h index c7ff6947492d..fb6ab69af2ba 100644 --- a/drivers/staging/rt2860/ap.h +++ b/drivers/staging/rt2860/ap.h @@ -41,26 +41,26 @@ #define __AP_H__ /* ap_wpa.c */ -VOID WpaStateMachineInit(IN PRTMP_ADAPTER pAd, +void WpaStateMachineInit(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * Sm, OUT STATE_MACHINE_FUNC Trans[]); #ifdef RTMP_MAC_USB -VOID BeaconUpdateExec(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +void BeaconUpdateExec(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3); #endif /* RTMP_MAC_USB // */ -VOID RTMPSetPiggyBack(IN PRTMP_ADAPTER pAd, IN BOOLEAN bPiggyBack); +void RTMPSetPiggyBack(IN PRTMP_ADAPTER pAd, IN BOOLEAN bPiggyBack); -VOID MacTableReset(IN PRTMP_ADAPTER pAd); +void MacTableReset(IN PRTMP_ADAPTER pAd); MAC_TABLE_ENTRY *MacTableInsertEntry(IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR apidx, IN BOOLEAN CleanAll); + u8 *pAddr, + u8 apidx, IN BOOLEAN CleanAll); BOOLEAN MacTableDeleteEntry(IN PRTMP_ADAPTER pAd, - IN USHORT wcid, IN PUCHAR pAddr); + u16 wcid, u8 *pAddr); -MAC_TABLE_ENTRY *MacTableLookup(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr); +MAC_TABLE_ENTRY *MacTableLookup(IN PRTMP_ADAPTER pAd, u8 *pAddr); #endif /* __AP_H__ */ diff --git a/drivers/staging/rt2860/chip/mac_pci.h b/drivers/staging/rt2860/chip/mac_pci.h index 34f7b9a302df..2d553275caa3 100644 --- a/drivers/staging/rt2860/chip/mac_pci.h +++ b/drivers/staging/rt2860/chip/mac_pci.h @@ -71,24 +71,24 @@ // typedef struct PACKED _TXD_STRUC { // Word 0 - UINT32 SDPtr0; + u32 SDPtr0; // Word 1 - UINT32 SDLen1:14; - UINT32 LastSec1:1; - UINT32 Burst:1; - UINT32 SDLen0:14; - UINT32 LastSec0:1; - UINT32 DMADONE:1; + u32 SDLen1:14; + u32 LastSec1:1; + u32 Burst:1; + u32 SDLen0:14; + u32 LastSec0:1; + u32 DMADONE:1; //Word2 - UINT32 SDPtr1; + u32 SDPtr1; //Word3 - UINT32 rsv2:24; - UINT32 WIV:1; // Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition - UINT32 QSEL:2; // select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA - UINT32 rsv:2; - UINT32 TCO:1; // - UINT32 UCO:1; // - UINT32 ICO:1; // + u32 rsv2:24; + u32 WIV:1; /* Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition */ + u32 QSEL:2; /* select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA */ + u32 rsv:2; + u32 TCO:1; /* */ + u32 UCO:1; /* */ + u32 ICO:1; /* */ } TXD_STRUC, *PTXD_STRUC; // @@ -96,47 +96,47 @@ typedef struct PACKED _TXD_STRUC { // typedef struct PACKED _RXD_STRUC { // Word 0 - UINT32 SDP0; + u32 SDP0; // Word 1 - UINT32 SDL1:14; - UINT32 Rsv:2; - UINT32 SDL0:14; - UINT32 LS0:1; - UINT32 DDONE:1; + u32 SDL1:14; + u32 Rsv:2; + u32 SDL0:14; + u32 LS0:1; + u32 DDONE:1; // Word 2 - UINT32 SDP1; + u32 SDP1; // Word 3 - UINT32 BA:1; - UINT32 DATA:1; - UINT32 NULLDATA:1; - UINT32 FRAG:1; - UINT32 U2M:1; // 1: this RX frame is unicast to me - UINT32 Mcast:1; // 1: this is a multicast frame - UINT32 Bcast:1; // 1: this is a broadcast frame - UINT32 MyBss:1; // 1: this frame belongs to the same BSSID - UINT32 Crc:1; // 1: CRC error - UINT32 CipherErr:2; // 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid - UINT32 AMSDU:1; // rx with 802.3 header, not 802.11 header. - UINT32 HTC:1; - UINT32 RSSI:1; - UINT32 L2PAD:1; - UINT32 AMPDU:1; - UINT32 Decrypted:1; // this frame is being decrypted. - UINT32 PlcpSignal:1; // To be moved - UINT32 PlcpRssil:1; // To be moved - UINT32 Rsv1:13; + u32 BA:1; + u32 DATA:1; + u32 NULLDATA:1; + u32 FRAG:1; + u32 U2M:1; /* 1: this RX frame is unicast to me */ + u32 Mcast:1; /* 1: this is a multicast frame */ + u32 Bcast:1; /* 1: this is a broadcast frame */ + u32 MyBss:1; /* 1: this frame belongs to the same BSSID */ + u32 Crc:1; /* 1: CRC error */ + u32 CipherErr:2; /* 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid */ + u32 AMSDU:1; /* rx with 802.3 header, not 802.11 header. */ + u32 HTC:1; + u32 RSSI:1; + u32 L2PAD:1; + u32 AMPDU:1; + u32 Decrypted:1; /* this frame is being decrypted. */ + u32 PlcpSignal:1; /* To be moved */ + u32 PlcpRssil:1; /* To be moved */ + u32 Rsv1:13; } RXD_STRUC, *PRXD_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC; typedef union _TX_ATTENUATION_CTRL_STRUC { struct { - ULONG RF_ISOLATION_ENABLE:1; - ULONG Reserve2:7; - ULONG PCIE_PHY_TX_ATTEN_VALUE:3; - ULONG PCIE_PHY_TX_ATTEN_EN:1; - ULONG Reserve1:20; + unsigned long RF_ISOLATION_ENABLE:1; + unsigned long Reserve2:7; + unsigned long PCIE_PHY_TX_ATTEN_VALUE:3; + unsigned long PCIE_PHY_TX_ATTEN_EN:1; + unsigned long Reserve1:20; } field; - ULONG word; + unsigned long word; } TX_ATTENUATION_CTRL_STRUC, *PTX_ATTENUATION_CTRL_STRUC; /* ----------------- EEPROM Related MACRO ----------------- */ @@ -148,7 +148,7 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { /* ----------------- Frimware Related MACRO ----------------- */ #define RTMP_WRITE_FIRMWARE(_pAd, _pFwImage, _FwLen) \ do{ \ - ULONG _i, _firm; \ + unsigned long _i, _firm; \ RTMP_IO_WRITE32(_pAd, PBF_SYS_CTRL, 0x10000); \ \ for(_i=0; _i<_FwLen; _i+=4) \ @@ -172,7 +172,7 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { #define RTMP_STOP_DEQUEUE(pAd, QueIdx, irqFlags) do{}while(0) #define RTMP_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, freeNum, pPacket) \ - ((freeNum) >= (ULONG)(pTxBlk->TotalFragNum + RTMP_GET_PACKET_FRAGMENTS(pPacket) + 3)) /* rough estimate we will use 3 more descriptor. */ + ((freeNum) >= (unsigned long)(pTxBlk->TotalFragNum + RTMP_GET_PACKET_FRAGMENTS(pPacket) + 3)) /* rough estimate we will use 3 more descriptor. */ #define RTMP_RELEASE_DESC_RESOURCE(pAd, QueIdx) \ do{}while(0) @@ -238,7 +238,7 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { // remove Pair-wise key material from ASIC #define RTMP_STA_ENTRY_KEY_DEL(pAd, BssIdx, Wcid) \ - AsicRemovePairwiseKeyEntry(pAd, BssIdx, (UCHAR)Wcid); + AsicRemovePairwiseKeyEntry(pAd, BssIdx, (u8)Wcid); // add Client security information into ASIC WCID table and IVEIV table #define RTMP_STA_SECURITY_INFO_ADD(pAd, apidx, KeyID, pEntry) \ @@ -260,7 +260,7 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { // Insert the BA bitmap to ASIC for the Wcid entry #define RTMP_ADD_BA_SESSION_TO_ASIC(_pAd, _Aid, _TID) \ do{ \ - UINT32 _Value = 0, _Offset; \ + u32 _Value = 0, _Offset; \ _Offset = MAC_WCID_BASE + (_Aid) * HW_WCID_ENTRY_SIZE + 4; \ RTMP_IO_READ32((_pAd), _Offset, &_Value);\ _Value |= (0x10000<<(_TID)); \ @@ -271,7 +271,7 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { // bitmap field starts at 0x10000 in ASIC WCID table #define RTMP_DEL_BA_SESSION_FROM_ASIC(_pAd, _Wcid, _TID) \ do{ \ - UINT32 _Value = 0, _Offset; \ + u32 _Value = 0, _Offset; \ _Offset = MAC_WCID_BASE + (_Wcid) * HW_WCID_ENTRY_SIZE + 4; \ RTMP_IO_READ32((_pAd), _Offset, &_Value); \ _Value &= (~(0x10000 << (_TID))); \ diff --git a/drivers/staging/rt2860/chip/mac_usb.h b/drivers/staging/rt2860/chip/mac_usb.h index fe7ba28b9fc6..b902074a41cc 100644 --- a/drivers/staging/rt2860/chip/mac_usb.h +++ b/drivers/staging/rt2860/chip/mac_usb.h @@ -62,26 +62,26 @@ #define RT2870_RXDMALEN_FIELD_SIZE 4 typedef struct PACKED _RXINFO_STRUC { - UINT32 BA:1; - UINT32 DATA:1; - UINT32 NULLDATA:1; - UINT32 FRAG:1; - UINT32 U2M:1; /* 1: this RX frame is unicast to me */ - UINT32 Mcast:1; /* 1: this is a multicast frame */ - UINT32 Bcast:1; /* 1: this is a broadcast frame */ - UINT32 MyBss:1; /* 1: this frame belongs to the same BSSID */ - UINT32 Crc:1; /* 1: CRC error */ - UINT32 CipherErr:2; /* 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid */ - UINT32 AMSDU:1; /* rx with 802.3 header, not 802.11 header. */ - UINT32 HTC:1; - UINT32 RSSI:1; - UINT32 L2PAD:1; - UINT32 AMPDU:1; /* To be moved */ - UINT32 Decrypted:1; - UINT32 PlcpRssil:1; - UINT32 CipherAlg:1; - UINT32 LastAMSDU:1; - UINT32 PlcpSignal:12; + u32 BA:1; + u32 DATA:1; + u32 NULLDATA:1; + u32 FRAG:1; + u32 U2M:1; /* 1: this RX frame is unicast to me */ + u32 Mcast:1; /* 1: this is a multicast frame */ + u32 Bcast:1; /* 1: this is a broadcast frame */ + u32 MyBss:1; /* 1: this frame belongs to the same BSSID */ + u32 Crc:1; /* 1: CRC error */ + u32 CipherErr:2; /* 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid */ + u32 AMSDU:1; /* rx with 802.3 header, not 802.11 header. */ + u32 HTC:1; + u32 RSSI:1; + u32 L2PAD:1; + u32 AMPDU:1; /* To be moved */ + u32 Decrypted:1; + u32 PlcpRssil:1; + u32 CipherAlg:1; + u32 LastAMSDU:1; + u32 PlcpSignal:12; } RXINFO_STRUC, *PRXINFO_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC; /* */ @@ -91,14 +91,14 @@ typedef struct PACKED _RXINFO_STRUC { typedef struct _TXINFO_STRUC { /* Word 0 */ - UINT32 USBDMATxPktLen:16; /*used ONLY in USB bulk Aggregation, Total byte counts of all sub-frame. */ - UINT32 rsv:8; - UINT32 WIV:1; /* Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition */ - UINT32 QSEL:2; /* select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA */ - UINT32 SwUseLastRound:1; /* Software use. */ - UINT32 rsv2:2; /* Software use. */ - UINT32 USBDMANextVLD:1; /*used ONLY in USB bulk Aggregation, NextValid */ - UINT32 USBDMATxburst:1; /*used ONLY in USB bulk Aggre. Force USB DMA transmit frame from current selected endpoint */ + u32 USBDMATxPktLen:16; /*used ONLY in USB bulk Aggregation, Total byte counts of all sub-frame. */ + u32 rsv:8; + u32 WIV:1; /* Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition */ + u32 QSEL:2; /* select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA */ + u32 SwUseLastRound:1; /* Software use. */ + u32 rsv2:2; /* Software use. */ + u32 USBDMANextVLD:1; /*used ONLY in USB bulk Aggregation, NextValid */ + u32 USBDMATxburst:1; /*used ONLY in USB bulk Aggre. Force USB DMA transmit frame from current selected endpoint */ } TXINFO_STRUC, *PTXINFO_STRUC; /* */ @@ -106,8 +106,8 @@ typedef struct _TXINFO_STRUC { /* */ typedef struct _MGMT_STRUC { BOOLEAN Valid; - PUCHAR pBuffer; - ULONG Length; + u8 *pBuffer; + unsigned long Length; } MGMT_STRUC, *PMGMT_STRUC; /*////////////////////////////////////////////////////////////////////////// */ @@ -115,69 +115,69 @@ typedef struct _MGMT_STRUC { /*////////////////////////////////////////////////////////////////////////// */ typedef struct __TX_BUFFER { union { - UCHAR WirelessPacket[TX_BUFFER_NORMSIZE]; + u8 WirelessPacket[TX_BUFFER_NORMSIZE]; HEADER_802_11 NullFrame; PSPOLL_FRAME PsPollPacket; RTS_FRAME RTSFrame; } field; - UCHAR Aggregation[4]; /*Buffer for save Aggregation size. */ + u8 Aggregation[4]; /*Buffer for save Aggregation size. */ } TX_BUFFER, *PTX_BUFFER; typedef struct __HTTX_BUFFER { union { - UCHAR WirelessPacket[MAX_TXBULK_SIZE]; + u8 WirelessPacket[MAX_TXBULK_SIZE]; HEADER_802_11 NullFrame; PSPOLL_FRAME PsPollPacket; RTS_FRAME RTSFrame; } field; - UCHAR Aggregation[4]; /*Buffer for save Aggregation size. */ + u8 Aggregation[4]; /*Buffer for save Aggregation size. */ } HTTX_BUFFER, *PHTTX_BUFFER; /* used to track driver-generated write irps */ typedef struct _TX_CONTEXT { - PVOID pAd; /*Initialized in MiniportInitialize */ + void *pAd; /*Initialized in MiniportInitialize */ PURB pUrb; /*Initialized in MiniportInitialize */ PIRP pIrp; /*used to cancel pending bulk out. */ /*Initialized in MiniportInitialize */ PTX_BUFFER TransferBuffer; /*Initialized in MiniportInitialize */ - ULONG BulkOutSize; - UCHAR BulkOutPipeId; - UCHAR SelfIdx; + unsigned long BulkOutSize; + u8 BulkOutPipeId; + u8 SelfIdx; BOOLEAN InUse; BOOLEAN bWaitingBulkOut; /* at least one packet is in this TxContext, ready for making IRP anytime. */ BOOLEAN bFullForBulkOut; /* all tx buffer are full , so waiting for tx bulkout. */ BOOLEAN IRPPending; BOOLEAN LastOne; BOOLEAN bAggregatible; - UCHAR Header_802_3[LENGTH_802_3]; - UCHAR Rsv[2]; - ULONG DataOffset; - UINT TxRate; + u8 Header_802_3[LENGTH_802_3]; + u8 Rsv[2]; + unsigned long DataOffset; + u32 TxRate; dma_addr_t data_dma; /* urb dma on linux */ } TX_CONTEXT, *PTX_CONTEXT, **PPTX_CONTEXT; /* used to track driver-generated write irps */ typedef struct _HT_TX_CONTEXT { - PVOID pAd; /*Initialized in MiniportInitialize */ + void *pAd; /*Initialized in MiniportInitialize */ PURB pUrb; /*Initialized in MiniportInitialize */ PIRP pIrp; /*used to cancel pending bulk out. */ /*Initialized in MiniportInitialize */ PHTTX_BUFFER TransferBuffer; /*Initialized in MiniportInitialize */ - ULONG BulkOutSize; /* Indicate the total bulk-out size in bytes in one bulk-transmission */ - UCHAR BulkOutPipeId; + unsigned long BulkOutSize; /* Indicate the total bulk-out size in bytes in one bulk-transmission */ + u8 BulkOutPipeId; BOOLEAN IRPPending; BOOLEAN LastOne; BOOLEAN bCurWriting; BOOLEAN bRingEmpty; BOOLEAN bCopySavePad; - UCHAR SavedPad[8]; - UCHAR Header_802_3[LENGTH_802_3]; - ULONG CurWritePosition; /* Indicate the buffer offset which packet will be inserted start from. */ - ULONG CurWriteRealPos; /* Indicate the buffer offset which packet now are writing to. */ - ULONG NextBulkOutPosition; /* Indicate the buffer start offset of a bulk-transmission */ - ULONG ENextBulkOutPosition; /* Indicate the buffer end offset of a bulk-transmission */ - UINT TxRate; + u8 SavedPad[8]; + u8 Header_802_3[LENGTH_802_3]; + unsigned long CurWritePosition; /* Indicate the buffer offset which packet will be inserted start from. */ + unsigned long CurWriteRealPos; /* Indicate the buffer offset which packet now are writing to. */ + unsigned long NextBulkOutPosition; /* Indicate the buffer start offset of a bulk-transmission */ + unsigned long ENextBulkOutPosition; /* Indicate the buffer end offset of a bulk-transmission */ + u32 TxRate; dma_addr_t data_dma; /* urb dma on linux */ } HT_TX_CONTEXT, *PHT_TX_CONTEXT, **PPHT_TX_CONTEXT; @@ -186,12 +186,12 @@ typedef struct _HT_TX_CONTEXT { /* receive data to the protocol. */ /* */ typedef struct _RX_CONTEXT { - PUCHAR TransferBuffer; - PVOID pAd; + u8 *TransferBuffer; + void *pAd; PIRP pIrp; /*used to cancel pending bulk in. */ PURB pUrb; /*These 2 Boolean shouldn't both be 1 at the same time. */ - ULONG BulkInOffset; /* number of packets waiting for reordering . */ + unsigned long BulkInOffset; /* number of packets waiting for reordering . */ /* BOOLEAN ReorderInUse; // At least one packet in this buffer are in reordering buffer and wait for receive indication */ BOOLEAN bRxHandling; /* Notify this packet is being process now. */ BOOLEAN InUse; /* USB Hardware Occupied. Wait for USB HW to put packet. */ @@ -332,9 +332,9 @@ typedef struct _RX_CONTEXT { MlmeSetPsmBit(_pAd, _val);\ else \ { \ - USHORT _psm_val; \ + u16 _psm_val; \ _psm_val = _val; \ - RTUSBEnqueueInternalCmd(_pAd, CMDTHREAD_SET_PSM_BIT, &(_psm_val), sizeof(USHORT)); \ + RTUSBEnqueueInternalCmd(_pAd, CMDTHREAD_SET_PSM_BIT, &(_psm_val), sizeof(u16)); \ }\ } diff --git a/drivers/staging/rt2860/chip/rt30xx.h b/drivers/staging/rt2860/chip/rt30xx.h index 477a20509a57..04c92ab796df 100644 --- a/drivers/staging/rt2860/chip/rt30xx.h +++ b/drivers/staging/rt2860/chip/rt30xx.h @@ -40,7 +40,7 @@ #ifdef RT30xx extern REG_PAIR RT30xx_RFRegTable[]; -extern UCHAR NUM_RF_REG_PARMS; +extern u8 NUM_RF_REG_PARMS; #endif /* RT30xx // */ diff --git a/drivers/staging/rt2860/chip/rtmp_mac.h b/drivers/staging/rt2860/chip/rtmp_mac.h index dac15776ae72..5efe5015cad4 100644 --- a/drivers/staging/rt2860/chip/rtmp_mac.h +++ b/drivers/staging/rt2860/chip/rtmp_mac.h @@ -57,37 +57,37 @@ typedef struct PACKED _TXWI_STRUC { /* Word 0 */ /* ex: 00 03 00 40 means txop = 3, PHYMODE = 1 */ - UINT32 FRAG:1; /* 1 to inform TKIP engine this is a fragment. */ - UINT32 MIMOps:1; /* the remote peer is in dynamic MIMO-PS mode */ - UINT32 CFACK:1; - UINT32 TS:1; - - UINT32 AMPDU:1; - UINT32 MpduDensity:3; - UINT32 txop:2; /*FOR "THIS" frame. 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs only when previous frame exchange is successful. */ - UINT32 rsv:6; - - UINT32 MCS:7; - UINT32 BW:1; /*channel bandwidth 20MHz or 40 MHz */ - UINT32 ShortGI:1; - UINT32 STBC:2; /* 1: STBC support MCS =0-7, 2,3 : RESERVE */ - UINT32 Ifs:1; /* */ -/* UINT32 rsv2:2; //channel bandwidth 20MHz or 40 MHz */ - UINT32 rsv2:1; - UINT32 TxBF:1; /* 3*3 */ - UINT32 PHYMODE:2; + u32 FRAG:1; /* 1 to inform TKIP engine this is a fragment. */ + u32 MIMOps:1; /* the remote peer is in dynamic MIMO-PS mode */ + u32 CFACK:1; + u32 TS:1; + + u32 AMPDU:1; + u32 MpduDensity:3; + u32 txop:2; /*FOR "THIS" frame. 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs only when previous frame exchange is successful. */ + u32 rsv:6; + + u32 MCS:7; + u32 BW:1; /*channel bandwidth 20MHz or 40 MHz */ + u32 ShortGI:1; + u32 STBC:2; /* 1: STBC support MCS =0-7, 2,3 : RESERVE */ + u32 Ifs:1; /* */ +/* u32 rsv2:2; //channel bandwidth 20MHz or 40 MHz */ + u32 rsv2:1; + u32 TxBF:1; /* 3*3 */ + u32 PHYMODE:2; /* Word1 */ /* ex: 1c ff 38 00 means ACK=0, BAWinSize=7, MPDUtotalByteCount = 0x38 */ - UINT32 ACK:1; - UINT32 NSEQ:1; - UINT32 BAWinSize:6; - UINT32 WirelessCliID:8; - UINT32 MPDUtotalByteCount:12; - UINT32 PacketId:4; + u32 ACK:1; + u32 NSEQ:1; + u32 BAWinSize:6; + u32 WirelessCliID:8; + u32 MPDUtotalByteCount:12; + u32 PacketId:4; /*Word2 */ - UINT32 IV; + u32 IV; /*Word3 */ - UINT32 EIV; + u32 EIV; } TXWI_STRUC, *PTXWI_STRUC; /* */ @@ -95,32 +95,32 @@ typedef struct PACKED _TXWI_STRUC { /* */ typedef struct PACKED _RXWI_STRUC { /* Word 0 */ - UINT32 WirelessCliID:8; - UINT32 KeyIndex:2; - UINT32 BSSID:3; - UINT32 UDF:3; - UINT32 MPDUtotalByteCount:12; - UINT32 TID:4; + u32 WirelessCliID:8; + u32 KeyIndex:2; + u32 BSSID:3; + u32 UDF:3; + u32 MPDUtotalByteCount:12; + u32 TID:4; /* Word 1 */ - UINT32 FRAG:4; - UINT32 SEQUENCE:12; - UINT32 MCS:7; - UINT32 BW:1; - UINT32 ShortGI:1; - UINT32 STBC:2; - UINT32 rsv:3; - UINT32 PHYMODE:2; /* 1: this RX frame is unicast to me */ + u32 FRAG:4; + u32 SEQUENCE:12; + u32 MCS:7; + u32 BW:1; + u32 ShortGI:1; + u32 STBC:2; + u32 rsv:3; + u32 PHYMODE:2; /* 1: this RX frame is unicast to me */ /*Word2 */ - UINT32 RSSI0:8; - UINT32 RSSI1:8; - UINT32 RSSI2:8; - UINT32 rsv1:8; + u32 RSSI0:8; + u32 RSSI1:8; + u32 RSSI2:8; + u32 rsv1:8; /*Word3 */ - UINT32 SNR0:8; - UINT32 SNR1:8; - UINT32 FOFFSET:8; /* RT35xx */ - UINT32 rsv2:8; - /*UINT32 rsv2:16; */ + u32 SNR0:8; + u32 SNR1:8; + u32 FOFFSET:8; /* RT35xx */ + u32 rsv2:8; + /*u32 rsv2:16; */ } RXWI_STRUC, *PRXWI_STRUC; /* ================================================================================= */ @@ -136,27 +136,27 @@ typedef struct PACKED _RXWI_STRUC { #define INT_SOURCE_CSR 0x200 typedef union _INT_SOURCE_CSR_STRUC { struct { - UINT32 RxDelayINT:1; - UINT32 TxDelayINT:1; - UINT32 RxDone:1; - UINT32 Ac0DmaDone:1; /*4 */ - UINT32 Ac1DmaDone:1; - UINT32 Ac2DmaDone:1; - UINT32 Ac3DmaDone:1; - UINT32 HccaDmaDone:1; /* bit7 */ - UINT32 MgmtDmaDone:1; - UINT32 MCUCommandINT:1; /*bit 9 */ - UINT32 RxTxCoherent:1; - UINT32 TBTTInt:1; - UINT32 PreTBTT:1; - UINT32 TXFifoStatusInt:1; /*FIFO Statistics is full, sw should read 0x171c */ - UINT32 AutoWakeup:1; /*bit14 */ - UINT32 GPTimer:1; - UINT32 RxCoherent:1; /*bit16 */ - UINT32 TxCoherent:1; - UINT32:14; + u32 RxDelayINT:1; + u32 TxDelayINT:1; + u32 RxDone:1; + u32 Ac0DmaDone:1; /*4 */ + u32 Ac1DmaDone:1; + u32 Ac2DmaDone:1; + u32 Ac3DmaDone:1; + u32 HccaDmaDone:1; /* bit7 */ + u32 MgmtDmaDone:1; + u32 MCUCommandINT:1; /*bit 9 */ + u32 RxTxCoherent:1; + u32 TBTTInt:1; + u32 PreTBTT:1; + u32 TXFifoStatusInt:1; /*FIFO Statistics is full, sw should read 0x171c */ + u32 AutoWakeup:1; /*bit14 */ + u32 GPTimer:1; + u32 RxCoherent:1; /*bit16 */ + u32 TxCoherent:1; + u32 : 14; } field; - UINT32 word; + u32 word; } INT_SOURCE_CSR_STRUC, *PINT_SOURCE_CSR_STRUC; /* */ @@ -165,76 +165,76 @@ typedef union _INT_SOURCE_CSR_STRUC { #define INT_MASK_CSR 0x204 typedef union _INT_MASK_CSR_STRUC { struct { - UINT32 RXDelay_INT_MSK:1; - UINT32 TxDelay:1; - UINT32 RxDone:1; - UINT32 Ac0DmaDone:1; - UINT32 Ac1DmaDone:1; - UINT32 Ac2DmaDone:1; - UINT32 Ac3DmaDone:1; - UINT32 HccaDmaDone:1; - UINT32 MgmtDmaDone:1; - UINT32 MCUCommandINT:1; - UINT32:20; - UINT32 RxCoherent:1; - UINT32 TxCoherent:1; + u32 RXDelay_INT_MSK:1; + u32 TxDelay:1; + u32 RxDone:1; + u32 Ac0DmaDone:1; + u32 Ac1DmaDone:1; + u32 Ac2DmaDone:1; + u32 Ac3DmaDone:1; + u32 HccaDmaDone:1; + u32 MgmtDmaDone:1; + u32 MCUCommandINT:1; + u32 : 20; + u32 RxCoherent:1; + u32 TxCoherent:1; } field; - UINT32 word; + u32 word; } INT_MASK_CSR_STRUC, *PINT_MASK_CSR_STRUC; #define WPDMA_GLO_CFG 0x208 typedef union _WPDMA_GLO_CFG_STRUC { struct { - UINT32 EnableTxDMA:1; - UINT32 TxDMABusy:1; - UINT32 EnableRxDMA:1; - UINT32 RxDMABusy:1; - UINT32 WPDMABurstSIZE:2; - UINT32 EnTXWriteBackDDONE:1; - UINT32 BigEndian:1; - UINT32 RXHdrScater:8; - UINT32 HDR_SEG_LEN:16; + u32 EnableTxDMA:1; + u32 TxDMABusy:1; + u32 EnableRxDMA:1; + u32 RxDMABusy:1; + u32 WPDMABurstSIZE:2; + u32 EnTXWriteBackDDONE:1; + u32 BigEndian:1; + u32 RXHdrScater:8; + u32 HDR_SEG_LEN:16; } field; - UINT32 word; + u32 word; } WPDMA_GLO_CFG_STRUC, *PWPDMA_GLO_CFG_STRUC; #define WPDMA_RST_IDX 0x20c typedef union _WPDMA_RST_IDX_STRUC { struct { - UINT32 RST_DTX_IDX0:1; - UINT32 RST_DTX_IDX1:1; - UINT32 RST_DTX_IDX2:1; - UINT32 RST_DTX_IDX3:1; - UINT32 RST_DTX_IDX4:1; - UINT32 RST_DTX_IDX5:1; - UINT32 rsv:10; - UINT32 RST_DRX_IDX0:1; - UINT32:15; + u32 RST_DTX_IDX0:1; + u32 RST_DTX_IDX1:1; + u32 RST_DTX_IDX2:1; + u32 RST_DTX_IDX3:1; + u32 RST_DTX_IDX4:1; + u32 RST_DTX_IDX5:1; + u32 rsv:10; + u32 RST_DRX_IDX0:1; + u32 : 15; } field; - UINT32 word; + u32 word; } WPDMA_RST_IDX_STRUC, *PWPDMA_RST_IDX_STRUC; #define DELAY_INT_CFG 0x0210 typedef union _DELAY_INT_CFG_STRUC { struct { - UINT32 RXMAX_PTIME:8; - UINT32 RXMAX_PINT:7; - UINT32 RXDLY_INT_EN:1; - UINT32 TXMAX_PTIME:8; - UINT32 TXMAX_PINT:7; - UINT32 TXDLY_INT_EN:1; + u32 RXMAX_PTIME:8; + u32 RXMAX_PINT:7; + u32 RXDLY_INT_EN:1; + u32 TXMAX_PTIME:8; + u32 TXMAX_PINT:7; + u32 TXDLY_INT_EN:1; } field; - UINT32 word; + u32 word; } DELAY_INT_CFG_STRUC, *PDELAY_INT_CFG_STRUC; #define WMM_AIFSN_CFG 0x0214 typedef union _AIFSN_CSR_STRUC { struct { - UINT32 Aifsn0:4; /* for AC_BE */ - UINT32 Aifsn1:4; /* for AC_BK */ - UINT32 Aifsn2:4; /* for AC_VI */ - UINT32 Aifsn3:4; /* for AC_VO */ - UINT32 Rsv:16; + u32 Aifsn0:4; /* for AC_BE */ + u32 Aifsn1:4; /* for AC_BK */ + u32 Aifsn2:4; /* for AC_VI */ + u32 Aifsn3:4; /* for AC_VO */ + u32 Rsv:16; } field; - UINT32 word; + u32 word; } AIFSN_CSR_STRUC, *PAIFSN_CSR_STRUC; /* */ /* CWMIN_CSR: CWmin for each EDCA AC */ @@ -242,13 +242,13 @@ typedef union _AIFSN_CSR_STRUC { #define WMM_CWMIN_CFG 0x0218 typedef union _CWMIN_CSR_STRUC { struct { - UINT32 Cwmin0:4; /* for AC_BE */ - UINT32 Cwmin1:4; /* for AC_BK */ - UINT32 Cwmin2:4; /* for AC_VI */ - UINT32 Cwmin3:4; /* for AC_VO */ - UINT32 Rsv:16; + u32 Cwmin0:4; /* for AC_BE */ + u32 Cwmin1:4; /* for AC_BK */ + u32 Cwmin2:4; /* for AC_VI */ + u32 Cwmin3:4; /* for AC_VO */ + u32 Rsv:16; } field; - UINT32 word; + u32 word; } CWMIN_CSR_STRUC, *PCWMIN_CSR_STRUC; /* */ @@ -257,13 +257,13 @@ typedef union _CWMIN_CSR_STRUC { #define WMM_CWMAX_CFG 0x021c typedef union _CWMAX_CSR_STRUC { struct { - UINT32 Cwmax0:4; /* for AC_BE */ - UINT32 Cwmax1:4; /* for AC_BK */ - UINT32 Cwmax2:4; /* for AC_VI */ - UINT32 Cwmax3:4; /* for AC_VO */ - UINT32 Rsv:16; + u32 Cwmax0:4; /* for AC_BE */ + u32 Cwmax1:4; /* for AC_BK */ + u32 Cwmax2:4; /* for AC_VI */ + u32 Cwmax3:4; /* for AC_VO */ + u32 Rsv:16; } field; - UINT32 word; + u32 word; } CWMAX_CSR_STRUC, *PCWMAX_CSR_STRUC; /* */ @@ -272,10 +272,10 @@ typedef union _CWMAX_CSR_STRUC { #define WMM_TXOP0_CFG 0x0220 typedef union _AC_TXOP_CSR0_STRUC { struct { - USHORT Ac0Txop; /* for AC_BK, in unit of 32us */ - USHORT Ac1Txop; /* for AC_BE, in unit of 32us */ + u16 Ac0Txop; /* for AC_BK, in unit of 32us */ + u16 Ac1Txop; /* for AC_BE, in unit of 32us */ } field; - UINT32 word; + u32 word; } AC_TXOP_CSR0_STRUC, *PAC_TXOP_CSR0_STRUC; /* */ @@ -284,10 +284,10 @@ typedef union _AC_TXOP_CSR0_STRUC { #define WMM_TXOP1_CFG 0x0224 typedef union _AC_TXOP_CSR1_STRUC { struct { - USHORT Ac2Txop; /* for AC_VI, in unit of 32us */ - USHORT Ac3Txop; /* for AC_VO, in unit of 32us */ + u16 Ac2Txop; /* for AC_VI, in unit of 32us */ + u16 Ac3Txop; /* for AC_VO, in unit of 32us */ } field; - UINT32 word; + u32 word; } AC_TXOP_CSR1_STRUC, *PAC_TXOP_CSR1_STRUC; #define RINGREG_DIFF 0x10 @@ -328,20 +328,20 @@ typedef union _AC_TXOP_CSR1_STRUC { #define USB_DMA_CFG 0x02a0 typedef union _USB_DMA_CFG_STRUC { struct { - UINT32 RxBulkAggTOut:8; /*Rx Bulk Aggregation TimeOut in unit of 33ns */ - UINT32 RxBulkAggLmt:8; /*Rx Bulk Aggregation Limit in unit of 256 bytes */ - UINT32 phyclear:1; /*phy watch dog enable. write 1 */ - UINT32 rsv:2; - UINT32 TxClear:1; /*Clear USB DMA TX path */ - UINT32 TxopHalt:1; /*Halt TXOP count down when TX buffer is full. */ - UINT32 RxBulkAggEn:1; /*Enable Rx Bulk Aggregation */ - UINT32 RxBulkEn:1; /*Enable USB DMA Rx */ - UINT32 TxBulkEn:1; /*Enable USB DMA Tx */ - UINT32 EpoutValid:6; /*OUT endpoint data valid */ - UINT32 RxBusy:1; /*USB DMA RX FSM busy */ - UINT32 TxBusy:1; /*USB DMA TX FSM busy */ + u32 RxBulkAggTOut:8; /*Rx Bulk Aggregation TimeOut in unit of 33ns */ + u32 RxBulkAggLmt:8; /*Rx Bulk Aggregation Limit in unit of 256 bytes */ + u32 phyclear:1; /*phy watch dog enable. write 1 */ + u32 rsv:2; + u32 TxClear:1; /*Clear USB DMA TX path */ + u32 TxopHalt:1; /*Halt TXOP count down when TX buffer is full. */ + u32 RxBulkAggEn:1; /*Enable Rx Bulk Aggregation */ + u32 RxBulkEn:1; /*Enable USB DMA Rx */ + u32 TxBulkEn:1; /*Enable USB DMA Tx */ + u32 EpoutValid:6; /*OUT endpoint data valid */ + u32 RxBusy:1; /*USB DMA RX FSM busy */ + u32 TxBusy:1; /*USB DMA TX FSM busy */ } field; - UINT32 word; + u32 word; } USB_DMA_CFG_STRUC, *PUSB_DMA_CFG_STRUC; /* */ @@ -384,10 +384,10 @@ typedef union _USB_DMA_CFG_STRUC { #define MAC_CSR0 0x1000 typedef union _ASIC_VER_ID_STRUC { struct { - USHORT ASICRev; /* reversion : 0 */ - USHORT ASICVer; /* version : 2860 */ + u16 ASICRev; /* reversion : 0 */ + u16 ASICVer; /* version : 2860 */ } field; - UINT32 word; + u32 word; } ASIC_VER_ID_STRUC, *PASIC_VER_ID_STRUC; #define MAC_SYS_CTRL 0x1004 /*MAC_CSR1 */ #define MAC_ADDR_DW0 0x1008 /* MAC ADDR DW0 */ @@ -397,12 +397,12 @@ typedef union _ASIC_VER_ID_STRUC { /* */ typedef union _MAC_DW0_STRUC { struct { - UCHAR Byte0; /* MAC address byte 0 */ - UCHAR Byte1; /* MAC address byte 1 */ - UCHAR Byte2; /* MAC address byte 2 */ - UCHAR Byte3; /* MAC address byte 3 */ + u8 Byte0; /* MAC address byte 0 */ + u8 Byte1; /* MAC address byte 1 */ + u8 Byte2; /* MAC address byte 2 */ + u8 Byte3; /* MAC address byte 3 */ } field; - UINT32 word; + u32 word; } MAC_DW0_STRUC, *PMAC_DW0_STRUC; /* */ @@ -410,12 +410,12 @@ typedef union _MAC_DW0_STRUC { /* */ typedef union _MAC_DW1_STRUC { struct { - UCHAR Byte4; /* MAC address byte 4 */ - UCHAR Byte5; /* MAC address byte 5 */ - UCHAR U2MeMask; - UCHAR Rsvd1; + u8 Byte4; /* MAC address byte 4 */ + u8 Byte5; /* MAC address byte 5 */ + u8 U2MeMask; + u8 Rsvd1; } field; - UINT32 word; + u32 word; } MAC_DW1_STRUC, *PMAC_DW1_STRUC; #define MAC_BSSID_DW0 0x1010 /* MAC BSSID DW0 */ @@ -426,13 +426,13 @@ typedef union _MAC_DW1_STRUC { /* */ typedef union _MAC_CSR5_STRUC { struct { - UCHAR Byte4; /* BSSID byte 4 */ - UCHAR Byte5; /* BSSID byte 5 */ - USHORT BssIdMask:2; /* 0: one BSSID, 10: 4 BSSID, 01: 2 BSSID , 11: 8BSSID */ - USHORT MBssBcnNum:3; - USHORT Rsvd:11; + u8 Byte4; /* BSSID byte 4 */ + u8 Byte5; /* BSSID byte 5 */ + u16 BssIdMask:2; /* 0: one BSSID, 10: 4 BSSID, 01: 2 BSSID , 11: 8BSSID */ + u16 MBssBcnNum:3; + u16 Rsvd:11; } field; - UINT32 word; + u32 word; } MAC_CSR5_STRUC, *PMAC_CSR5_STRUC; #define MAX_LEN_CFG 0x1018 /* rt2860b max 16k bytes. bit12:13 Maximum PSDU length (power factor) 0:2^13, 1:2^14, 2:2^15, 3:2^16 */ @@ -442,15 +442,15 @@ typedef union _MAC_CSR5_STRUC { /* */ typedef union _BBP_CSR_CFG_STRUC { struct { - UINT32 Value:8; /* Register value to program into BBP */ - UINT32 RegNum:8; /* Selected BBP register */ - UINT32 fRead:1; /* 0: Write BBP, 1: Read BBP */ - UINT32 Busy:1; /* 1: ASIC is busy execute BBP programming. */ - UINT32 BBP_PAR_DUR:1; /* 0: 4 MAC clock cycles 1: 8 MAC clock cycles */ - UINT32 BBP_RW_MODE:1; /* 0: use serial mode 1:parallel */ - UINT32:12; + u32 Value:8; /* Register value to program into BBP */ + u32 RegNum:8; /* Selected BBP register */ + u32 fRead:1; /* 0: Write BBP, 1: Read BBP */ + u32 Busy:1; /* 1: ASIC is busy execute BBP programming. */ + u32 BBP_PAR_DUR:1; /* 0: 4 MAC clock cycles 1: 8 MAC clock cycles */ + u32 BBP_RW_MODE:1; /* 0: use serial mode 1:parallel */ + u32 : 12; } field; - UINT32 word; + u32 word; } BBP_CSR_CFG_STRUC, *PBBP_CSR_CFG_STRUC; #define RF_CSR_CFG0 0x1020 /* */ @@ -458,45 +458,45 @@ typedef union _BBP_CSR_CFG_STRUC { /* */ typedef union _RF_CSR_CFG0_STRUC { struct { - UINT32 RegIdAndContent:24; /* Register value to program into BBP */ - UINT32 bitwidth:5; /* Selected BBP register */ - UINT32 StandbyMode:1; /* 0: high when stand by 1: low when standby */ - UINT32 Sel:1; /* 0:RF_LE0 activate 1:RF_LE1 activate */ - UINT32 Busy:1; /* 0: idle 1: 8busy */ + u32 RegIdAndContent:24; /* Register value to program into BBP */ + u32 bitwidth:5; /* Selected BBP register */ + u32 StandbyMode:1; /* 0: high when stand by 1: low when standby */ + u32 Sel:1; /* 0:RF_LE0 activate 1:RF_LE1 activate */ + u32 Busy:1; /* 0: idle 1: 8busy */ } field; - UINT32 word; + u32 word; } RF_CSR_CFG0_STRUC, *PRF_CSR_CFG0_STRUC; #define RF_CSR_CFG1 0x1024 typedef union _RF_CSR_CFG1_STRUC { struct { - UINT32 RegIdAndContent:24; /* Register value to program into BBP */ - UINT32 RFGap:5; /* Gap between BB_CONTROL_RF and RF_LE. 0: 3 system clock cycle (37.5usec) 1: 5 system clock cycle (62.5usec) */ - UINT32 rsv:7; /* 0: idle 1: 8busy */ + u32 RegIdAndContent:24; /* Register value to program into BBP */ + u32 RFGap:5; /* Gap between BB_CONTROL_RF and RF_LE. 0: 3 system clock cycle (37.5usec) 1: 5 system clock cycle (62.5usec) */ + u32 rsv:7; /* 0: idle 1: 8busy */ } field; - UINT32 word; + u32 word; } RF_CSR_CFG1_STRUC, *PRF_CSR_CFG1_STRUC; #define RF_CSR_CFG2 0x1028 /* */ typedef union _RF_CSR_CFG2_STRUC { struct { - UINT32 RegIdAndContent:24; /* Register value to program into BBP */ - UINT32 rsv:8; /* 0: idle 1: 8busy */ + u32 RegIdAndContent:24; /* Register value to program into BBP */ + u32 rsv:8; /* 0: idle 1: 8busy */ } field; - UINT32 word; + u32 word; } RF_CSR_CFG2_STRUC, *PRF_CSR_CFG2_STRUC; #define LED_CFG 0x102c /* MAC_CSR14 */ typedef union _LED_CFG_STRUC { struct { - UINT32 OnPeriod:8; /* blinking on period unit 1ms */ - UINT32 OffPeriod:8; /* blinking off period unit 1ms */ - UINT32 SlowBlinkPeriod:6; /* slow blinking period. unit:1ms */ - UINT32 rsv:2; - UINT32 RLedMode:2; /* red Led Mode 0: off1: blinking upon TX2: periodic slow blinking3: always on */ - UINT32 GLedMode:2; /* green Led Mode */ - UINT32 YLedMode:2; /* yellow Led Mode */ - UINT32 LedPolar:1; /* Led Polarity. 0: active low1: active high */ - UINT32:1; + u32 OnPeriod:8; /* blinking on period unit 1ms */ + u32 OffPeriod:8; /* blinking off period unit 1ms */ + u32 SlowBlinkPeriod:6; /* slow blinking period. unit:1ms */ + u32 rsv:2; + u32 RLedMode:2; /* red Led Mode 0: off1: blinking upon TX2: periodic slow blinking3: always on */ + u32 GLedMode:2; /* green Led Mode */ + u32 YLedMode:2; /* yellow Led Mode */ + u32 LedPolar:1; /* Led Polarity. 0: active low1: active high */ + u32 : 1; } field; - UINT32 word; + u32 word; } LED_CFG_STRUC, *PLED_CFG_STRUC; /* */ /* 4.2 MAC TIMING configuration registers (offset:0x1100) */ @@ -504,14 +504,14 @@ typedef union _LED_CFG_STRUC { #define XIFS_TIME_CFG 0x1100 /* MAC_CSR8 MAC_CSR9 */ typedef union _IFS_SLOT_CFG_STRUC { struct { - UINT32 CckmSifsTime:8; /* unit 1us. Applied after CCK RX/TX */ - UINT32 OfdmSifsTime:8; /* unit 1us. Applied after OFDM RX/TX */ - UINT32 OfdmXifsTime:4; /*OFDM SIFS. unit 1us. Applied after OFDM RX when MAC doesn't reference BBP signal BBRXEND */ - UINT32 EIFS:9; /* unit 1us */ - UINT32 BBRxendEnable:1; /* reference RXEND signal to begin XIFS defer */ - UINT32 rsv:2; + u32 CckmSifsTime:8; /* unit 1us. Applied after CCK RX/TX */ + u32 OfdmSifsTime:8; /* unit 1us. Applied after OFDM RX/TX */ + u32 OfdmXifsTime:4; /*OFDM SIFS. unit 1us. Applied after OFDM RX when MAC doesn't reference BBP signal BBRXEND */ + u32 EIFS:9; /* unit 1us */ + u32 BBRxendEnable:1; /* reference RXEND signal to begin XIFS defer */ + u32 rsv:2; } field; - UINT32 word; + u32 word; } IFS_SLOT_CFG_STRUC, *PIFS_SLOT_CFG_STRUC; #define BKOFF_SLOT_CFG 0x1104 /* mac_csr9 last 8 bits */ @@ -528,15 +528,15 @@ typedef union _IFS_SLOT_CFG_STRUC { /* */ typedef union _BCN_TIME_CFG_STRUC { struct { - UINT32 BeaconInterval:16; /* in unit of 1/16 TU */ - UINT32 bTsfTicking:1; /* Enable TSF auto counting */ - UINT32 TsfSyncMode:2; /* Enable TSF sync, 00: disable, 01: infra mode, 10: ad-hoc mode */ - UINT32 bTBTTEnable:1; - UINT32 bBeaconGen:1; /* Enable beacon generator */ - UINT32:3; - UINT32 TxTimestampCompensate:8; + u32 BeaconInterval:16; /* in unit of 1/16 TU */ + u32 bTsfTicking:1; /* Enable TSF auto counting */ + u32 TsfSyncMode:2; /* Enable TSF sync, 00: disable, 01: infra mode, 10: ad-hoc mode */ + u32 bTBTTEnable:1; + u32 bBeaconGen:1; /* Enable beacon generator */ + u32 : 3; + u32 TxTimestampCompensate:8; } field; - UINT32 word; + u32 word; } BCN_TIME_CFG_STRUC, *PBCN_TIME_CFG_STRUC; #define TBTT_SYNC_CFG 0x1118 /* txrx_csr10 */ #define TSF_TIMER_DW0 0x111C /* Local TSF timer lsb 32 bits. Read-only */ @@ -557,12 +557,12 @@ typedef union _BCN_TIME_CFG_STRUC { /* */ typedef union _AUTO_WAKEUP_STRUC { struct { - UINT32 AutoLeadTime:8; - UINT32 NumofSleepingTbtt:7; /* ForceWake has high privilege than PutToSleep when both set */ - UINT32 EnableAutoWakeup:1; /* 0:sleep, 1:awake */ - UINT32:16; + u32 AutoLeadTime:8; + u32 NumofSleepingTbtt:7; /* ForceWake has high privilege than PutToSleep when both set */ + u32 EnableAutoWakeup:1; /* 0:sleep, 1:awake */ + u32 : 16; } field; - UINT32 word; + u32 word; } AUTO_WAKEUP_STRUC, *PAUTO_WAKEUP_STRUC; /* */ /* 4.3 MAC TX configuration registers (offset:0x1300) */ @@ -574,13 +574,13 @@ typedef union _AUTO_WAKEUP_STRUC { #define EDCA_AC3_CFG 0x130c typedef union _EDCA_AC_CFG_STRUC { struct { - UINT32 AcTxop:8; /* in unit of 32us */ - UINT32 Aifsn:4; /* # of slot time */ - UINT32 Cwmin:4; /* */ - UINT32 Cwmax:4; /*unit power of 2 */ - UINT32:12; /* */ + u32 AcTxop:8; /* in unit of 32us */ + u32 Aifsn:4; /* # of slot time */ + u32 Cwmin:4; /* */ + u32 Cwmax:4; /*unit power of 2 */ + u32 : 12; /* */ } field; - UINT32 word; + u32 word; } EDCA_AC_CFG_STRUC, *PEDCA_AC_CFG_STRUC; #define EDCA_TID_AC_MAP 0x1310 @@ -600,104 +600,104 @@ typedef union _EDCA_AC_CFG_STRUC { typedef union _TX_RTS_CFG_STRUC { struct { - UINT32 AutoRtsRetryLimit:8; - UINT32 RtsThres:16; /* unit:byte */ - UINT32 RtsFbkEn:1; /* enable rts rate fallback */ - UINT32 rsv:7; /* 1: HT non-STBC control frame enable */ + u32 AutoRtsRetryLimit:8; + u32 RtsThres:16; /* unit:byte */ + u32 RtsFbkEn:1; /* enable rts rate fallback */ + u32 rsv:7; /* 1: HT non-STBC control frame enable */ } field; - UINT32 word; + u32 word; } TX_RTS_CFG_STRUC, *PTX_RTS_CFG_STRUC; #define TX_TIMEOUT_CFG 0x1348 typedef union _TX_TIMEOUT_CFG_STRUC { struct { - UINT32 rsv:4; - UINT32 MpduLifeTime:4; /* expiration time = 2^(9+MPDU LIFE TIME) us */ - UINT32 RxAckTimeout:8; /* unit:slot. Used for TX precedure */ - UINT32 TxopTimeout:8; /*TXOP timeout value for TXOP truncation. It is recommended that (SLOT_TIME) > (TX_OP_TIMEOUT) > (RX_ACK_TIMEOUT) */ - UINT32 rsv2:8; /* 1: HT non-STBC control frame enable */ + u32 rsv:4; + u32 MpduLifeTime:4; /* expiration time = 2^(9+MPDU LIFE TIME) us */ + u32 RxAckTimeout:8; /* unit:slot. Used for TX precedure */ + u32 TxopTimeout:8; /*TXOP timeout value for TXOP truncation. It is recommended that (SLOT_TIME) > (TX_OP_TIMEOUT) > (RX_ACK_TIMEOUT) */ + u32 rsv2:8; /* 1: HT non-STBC control frame enable */ } field; - UINT32 word; + u32 word; } TX_TIMEOUT_CFG_STRUC, *PTX_TIMEOUT_CFG_STRUC; #define TX_RTY_CFG 0x134c typedef union PACKED _TX_RTY_CFG_STRUC { struct { - UINT32 ShortRtyLimit:8; /* short retry limit */ - UINT32 LongRtyLimit:8; /*long retry limit */ - UINT32 LongRtyThre:12; /* Long retry threshoold */ - UINT32 NonAggRtyMode:1; /* Non-Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer */ - UINT32 AggRtyMode:1; /* Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer */ - UINT32 TxautoFBEnable:1; /* Tx retry PHY rate auto fallback enable */ - UINT32 rsv:1; /* 1: HT non-STBC control frame enable */ + u32 ShortRtyLimit:8; /* short retry limit */ + u32 LongRtyLimit:8; /*long retry limit */ + u32 LongRtyThre:12; /* Long retry threshoold */ + u32 NonAggRtyMode:1; /* Non-Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer */ + u32 AggRtyMode:1; /* Aggregate MPDU retry mode. 0:expired by retry limit, 1: expired by mpdu life timer */ + u32 TxautoFBEnable:1; /* Tx retry PHY rate auto fallback enable */ + u32 rsv:1; /* 1: HT non-STBC control frame enable */ } field; - UINT32 word; + u32 word; } TX_RTY_CFG_STRUC, *PTX_RTY_CFG_STRUC; #define TX_LINK_CFG 0x1350 typedef union PACKED _TX_LINK_CFG_STRUC { struct PACKED { - UINT32 RemoteMFBLifeTime:8; /*remote MFB life time. unit : 32us */ - UINT32 MFBEnable:1; /* TX apply remote MFB 1:enable */ - UINT32 RemoteUMFSEnable:1; /* remote unsolicit MFB enable. 0: not apply remote remote unsolicit (MFS=7) */ - UINT32 TxMRQEn:1; /* MCS request TX enable */ - UINT32 TxRDGEn:1; /* RDG TX enable */ - UINT32 TxCFAckEn:1; /* Piggyback CF-ACK enable */ - UINT32 rsv:3; /* */ - UINT32 RemotMFB:8; /* remote MCS feedback */ - UINT32 RemotMFS:8; /*remote MCS feedback sequence number */ + u32 RemoteMFBLifeTime:8; /*remote MFB life time. unit : 32us */ + u32 MFBEnable:1; /* TX apply remote MFB 1:enable */ + u32 RemoteUMFSEnable:1; /* remote unsolicit MFB enable. 0: not apply remote remote unsolicit (MFS=7) */ + u32 TxMRQEn:1; /* MCS request TX enable */ + u32 TxRDGEn:1; /* RDG TX enable */ + u32 TxCFAckEn:1; /* Piggyback CF-ACK enable */ + u32 rsv:3; /* */ + u32 RemotMFB:8; /* remote MCS feedback */ + u32 RemotMFS:8; /*remote MCS feedback sequence number */ } field; - UINT32 word; + u32 word; } TX_LINK_CFG_STRUC, *PTX_LINK_CFG_STRUC; #define HT_FBK_CFG0 0x1354 typedef union PACKED _HT_FBK_CFG0_STRUC { struct { - UINT32 HTMCS0FBK:4; - UINT32 HTMCS1FBK:4; - UINT32 HTMCS2FBK:4; - UINT32 HTMCS3FBK:4; - UINT32 HTMCS4FBK:4; - UINT32 HTMCS5FBK:4; - UINT32 HTMCS6FBK:4; - UINT32 HTMCS7FBK:4; + u32 HTMCS0FBK:4; + u32 HTMCS1FBK:4; + u32 HTMCS2FBK:4; + u32 HTMCS3FBK:4; + u32 HTMCS4FBK:4; + u32 HTMCS5FBK:4; + u32 HTMCS6FBK:4; + u32 HTMCS7FBK:4; } field; - UINT32 word; + u32 word; } HT_FBK_CFG0_STRUC, *PHT_FBK_CFG0_STRUC; #define HT_FBK_CFG1 0x1358 typedef union _HT_FBK_CFG1_STRUC { struct { - UINT32 HTMCS8FBK:4; - UINT32 HTMCS9FBK:4; - UINT32 HTMCS10FBK:4; - UINT32 HTMCS11FBK:4; - UINT32 HTMCS12FBK:4; - UINT32 HTMCS13FBK:4; - UINT32 HTMCS14FBK:4; - UINT32 HTMCS15FBK:4; + u32 HTMCS8FBK:4; + u32 HTMCS9FBK:4; + u32 HTMCS10FBK:4; + u32 HTMCS11FBK:4; + u32 HTMCS12FBK:4; + u32 HTMCS13FBK:4; + u32 HTMCS14FBK:4; + u32 HTMCS15FBK:4; } field; - UINT32 word; + u32 word; } HT_FBK_CFG1_STRUC, *PHT_FBK_CFG1_STRUC; #define LG_FBK_CFG0 0x135c typedef union _LG_FBK_CFG0_STRUC { struct { - UINT32 OFDMMCS0FBK:4; /*initial value is 0 */ - UINT32 OFDMMCS1FBK:4; /*initial value is 0 */ - UINT32 OFDMMCS2FBK:4; /*initial value is 1 */ - UINT32 OFDMMCS3FBK:4; /*initial value is 2 */ - UINT32 OFDMMCS4FBK:4; /*initial value is 3 */ - UINT32 OFDMMCS5FBK:4; /*initial value is 4 */ - UINT32 OFDMMCS6FBK:4; /*initial value is 5 */ - UINT32 OFDMMCS7FBK:4; /*initial value is 6 */ + u32 OFDMMCS0FBK:4; /*initial value is 0 */ + u32 OFDMMCS1FBK:4; /*initial value is 0 */ + u32 OFDMMCS2FBK:4; /*initial value is 1 */ + u32 OFDMMCS3FBK:4; /*initial value is 2 */ + u32 OFDMMCS4FBK:4; /*initial value is 3 */ + u32 OFDMMCS5FBK:4; /*initial value is 4 */ + u32 OFDMMCS6FBK:4; /*initial value is 5 */ + u32 OFDMMCS7FBK:4; /*initial value is 6 */ } field; - UINT32 word; + u32 word; } LG_FBK_CFG0_STRUC, *PLG_FBK_CFG0_STRUC; #define LG_FBK_CFG1 0x1360 typedef union _LG_FBK_CFG1_STRUC { struct { - UINT32 CCKMCS0FBK:4; /*initial value is 0 */ - UINT32 CCKMCS1FBK:4; /*initial value is 0 */ - UINT32 CCKMCS2FBK:4; /*initial value is 1 */ - UINT32 CCKMCS3FBK:4; /*initial value is 2 */ - UINT32 rsv:16; + u32 CCKMCS0FBK:4; /*initial value is 0 */ + u32 CCKMCS1FBK:4; /*initial value is 0 */ + u32 CCKMCS2FBK:4; /*initial value is 1 */ + u32 CCKMCS3FBK:4; /*initial value is 2 */ + u32 rsv:16; } field; - UINT32 word; + u32 word; } LG_FBK_CFG1_STRUC, *PLG_FBK_CFG1_STRUC; /*======================================================= */ @@ -705,24 +705,24 @@ typedef union _LG_FBK_CFG1_STRUC { /*======================================================= */ #define CCK_PROT_CFG 0x1364 /*CCK Protection */ #define ASIC_SHORTNAV 1 -#define ASIC_LONGNAV 2 +#define ASIC_longNAV 2 #define ASIC_RTS 1 #define ASIC_CTS 2 typedef union _PROT_CFG_STRUC { struct { - UINT32 ProtectRate:16; /*Protection control frame rate for CCK TX(RTS/CTS/CFEnd). */ - UINT32 ProtectCtrl:2; /*Protection control frame type for CCK TX. 1:RTS/CTS, 2:CTS-to-self, 0:None, 3:rsv */ - UINT32 ProtectNav:2; /*TXOP protection type for CCK TX. 0:None, 1:ShortNAVprotect, 2:LongNAVProtect, 3:rsv */ - UINT32 TxopAllowCck:1; /*CCK TXOP allowance.0:disallow. */ - UINT32 TxopAllowOfdm:1; /*CCK TXOP allowance.0:disallow. */ - UINT32 TxopAllowMM20:1; /*CCK TXOP allowance. 0:disallow. */ - UINT32 TxopAllowMM40:1; /*CCK TXOP allowance.0:disallow. */ - UINT32 TxopAllowGF20:1; /*CCK TXOP allowance.0:disallow. */ - UINT32 TxopAllowGF40:1; /*CCK TXOP allowance.0:disallow. */ - UINT32 RTSThEn:1; /*RTS threshold enable on CCK TX */ - UINT32 rsv:5; + u32 ProtectRate:16; /*Protection control frame rate for CCK TX(RTS/CTS/CFEnd). */ + u32 ProtectCtrl:2; /*Protection control frame type for CCK TX. 1:RTS/CTS, 2:CTS-to-self, 0:None, 3:rsv */ + u32 ProtectNav:2; /*TXOP protection type for CCK TX. 0:None, 1:ShortNAVprotect, 2:LongNAVProtect, 3:rsv */ + u32 TxopAllowCck:1; /*CCK TXOP allowance.0:disallow. */ + u32 TxopAllowOfdm:1; /*CCK TXOP allowance.0:disallow. */ + u32 TxopAllowMM20:1; /*CCK TXOP allowance. 0:disallow. */ + u32 TxopAllowMM40:1; /*CCK TXOP allowance.0:disallow. */ + u32 TxopAllowGF20:1; /*CCK TXOP allowance.0:disallow. */ + u32 TxopAllowGF40:1; /*CCK TXOP allowance.0:disallow. */ + u32 RTSThEn:1; /*RTS threshold enable on CCK TX */ + u32 rsv:5; } field; - UINT32 word; + u32 word; } PROT_CFG_STRUC, *PPROT_CFG_STRUC; #define OFDM_PROT_CFG 0x1368 /*OFDM Protection */ @@ -743,17 +743,17 @@ typedef union _PROT_CFG_STRUC { /* */ typedef union _AUTO_RSP_CFG_STRUC { struct { - UINT32 AutoResponderEnable:1; - UINT32 BACAckPolicyEnable:1; /* 0:long, 1:short preamble */ - UINT32 CTS40MMode:1; /* Response CTS 40MHz duplicate mode */ - UINT32 CTS40MRef:1; /* Response CTS 40MHz duplicate mode */ - UINT32 AutoResponderPreamble:1; /* 0:long, 1:short preamble */ - UINT32 rsv:1; /* Power bit value in conrtrol frame */ - UINT32 DualCTSEn:1; /* Power bit value in conrtrol frame */ - UINT32 AckCtsPsmBit:1; /* Power bit value in conrtrol frame */ - UINT32:24; + u32 AutoResponderEnable:1; + u32 BACAckPolicyEnable:1; /* 0:long, 1:short preamble */ + u32 CTS40MMode:1; /* Response CTS 40MHz duplicate mode */ + u32 CTS40MRef:1; /* Response CTS 40MHz duplicate mode */ + u32 AutoResponderPreamble:1; /* 0:long, 1:short preamble */ + u32 rsv:1; /* Power bit value in conrtrol frame */ + u32 DualCTSEn:1; /* Power bit value in conrtrol frame */ + u32 AckCtsPsmBit:1; /* Power bit value in conrtrol frame */ + u32 : 24; } field; - UINT32 word; + u32 word; } AUTO_RSP_CFG_STRUC, *PAUTO_RSP_CFG_STRUC; #define LEGACY_BASIC_RATE 0x1408 /* TXRX_CSR5 0x3054 */ @@ -789,21 +789,21 @@ typedef union _AUTO_RSP_CFG_STRUC { /* */ typedef union _RX_STA_CNT0_STRUC { struct { - USHORT CrcErr; - USHORT PhyErr; + u16 CrcErr; + u16 PhyErr; } field; - UINT32 word; + u32 word; } RX_STA_CNT0_STRUC, *PRX_STA_CNT0_STRUC; /* */ -/* RX_STA_CNT1_STRUC: RX False CCA count & RX LONG frame count */ +/* RX_STA_CNT1_STRUC: RX False CCA count & RX long frame count */ /* */ typedef union _RX_STA_CNT1_STRUC { struct { - USHORT FalseCca; - USHORT PlcpErr; + u16 FalseCca; + u16 PlcpErr; } field; - UINT32 word; + u32 word; } RX_STA_CNT1_STRUC, *PRX_STA_CNT1_STRUC; /* */ @@ -811,10 +811,10 @@ typedef union _RX_STA_CNT1_STRUC { /* */ typedef union _RX_STA_CNT2_STRUC { struct { - USHORT RxDupliCount; - USHORT RxFifoOverflowCount; + u16 RxDupliCount; + u16 RxFifoOverflowCount; } field; - UINT32 word; + u32 word; } RX_STA_CNT2_STRUC, *PRX_STA_CNT2_STRUC; #define TX_STA_CNT0 0x170C /* */ /* */ @@ -822,10 +822,10 @@ typedef union _RX_STA_CNT2_STRUC { /* */ typedef union _TX_STA_CNT0_STRUC { struct { - USHORT TxFailCount; - USHORT TxBeaconCount; + u16 TxFailCount; + u16 TxBeaconCount; } field; - UINT32 word; + u32 word; } TX_STA_CNT0_STRUC, *PTX_STA_CNT0_STRUC; #define TX_STA_CNT1 0x1710 /* */ /* */ @@ -833,10 +833,10 @@ typedef union _TX_STA_CNT0_STRUC { /* */ typedef union _TX_STA_CNT1_STRUC { struct { - USHORT TxSuccess; - USHORT TxRetransmit; + u16 TxSuccess; + u16 TxRetransmit; } field; - UINT32 word; + u32 word; } TX_STA_CNT1_STRUC, *PTX_STA_CNT1_STRUC; #define TX_STA_CNT2 0x1714 /* */ /* */ @@ -844,10 +844,10 @@ typedef union _TX_STA_CNT1_STRUC { /* */ typedef union _TX_STA_CNT2_STRUC { struct { - USHORT TxZeroLenCount; - USHORT TxUnderFlowCount; + u16 TxZeroLenCount; + u16 TxUnderFlowCount; } field; - UINT32 word; + u32 word; } TX_STA_CNT2_STRUC, *PTX_STA_CNT2_STRUC; #define TX_STA_FIFO 0x1718 /* */ /* */ @@ -855,103 +855,103 @@ typedef union _TX_STA_CNT2_STRUC { /* */ typedef union PACKED _TX_STA_FIFO_STRUC { struct { - UINT32 bValid:1; /* 1:This register contains a valid TX result */ - UINT32 PidType:4; - UINT32 TxSuccess:1; /* Tx No retry success */ - UINT32 TxAggre:1; /* Tx Retry Success */ - UINT32 TxAckRequired:1; /* Tx fail */ - UINT32 wcid:8; /*wireless client index */ -/* UINT32 SuccessRate:16; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16. */ - UINT32 SuccessRate:13; /*include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16. */ - UINT32 TxBF:1; - UINT32 Reserve:2; + u32 bValid:1; /* 1:This register contains a valid TX result */ + u32 PidType:4; + u32 TxSuccess:1; /* Tx No retry success */ + u32 TxAggre:1; /* Tx Retry Success */ + u32 TxAckRequired:1; /* Tx fail */ + u32 wcid:8; /*wireless client index */ +/* u32 SuccessRate:16; //include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16. */ + u32 SuccessRate:13; /*include MCS, mode ,shortGI, BW settingSame format as TXWI Word 0 Bit 31-16. */ + u32 TxBF:1; + u32 Reserve:2; } field; - UINT32 word; + u32 word; } TX_STA_FIFO_STRUC, *PTX_STA_FIFO_STRUC; /* Debug counter */ #define TX_AGG_CNT 0x171c typedef union _TX_AGG_CNT_STRUC { struct { - USHORT NonAggTxCount; - USHORT AggTxCount; + u16 NonAggTxCount; + u16 AggTxCount; } field; - UINT32 word; + u32 word; } TX_AGG_CNT_STRUC, *PTX_AGG_CNT_STRUC; /* Debug counter */ #define TX_AGG_CNT0 0x1720 typedef union _TX_AGG_CNT0_STRUC { struct { - USHORT AggSize1Count; - USHORT AggSize2Count; + u16 AggSize1Count; + u16 AggSize2Count; } field; - UINT32 word; + u32 word; } TX_AGG_CNT0_STRUC, *PTX_AGG_CNT0_STRUC; /* Debug counter */ #define TX_AGG_CNT1 0x1724 typedef union _TX_AGG_CNT1_STRUC { struct { - USHORT AggSize3Count; - USHORT AggSize4Count; + u16 AggSize3Count; + u16 AggSize4Count; } field; - UINT32 word; + u32 word; } TX_AGG_CNT1_STRUC, *PTX_AGG_CNT1_STRUC; #define TX_AGG_CNT2 0x1728 typedef union _TX_AGG_CNT2_STRUC { struct { - USHORT AggSize5Count; - USHORT AggSize6Count; + u16 AggSize5Count; + u16 AggSize6Count; } field; - UINT32 word; + u32 word; } TX_AGG_CNT2_STRUC, *PTX_AGG_CNT2_STRUC; /* Debug counter */ #define TX_AGG_CNT3 0x172c typedef union _TX_AGG_CNT3_STRUC { struct { - USHORT AggSize7Count; - USHORT AggSize8Count; + u16 AggSize7Count; + u16 AggSize8Count; } field; - UINT32 word; + u32 word; } TX_AGG_CNT3_STRUC, *PTX_AGG_CNT3_STRUC; /* Debug counter */ #define TX_AGG_CNT4 0x1730 typedef union _TX_AGG_CNT4_STRUC { struct { - USHORT AggSize9Count; - USHORT AggSize10Count; + u16 AggSize9Count; + u16 AggSize10Count; } field; - UINT32 word; + u32 word; } TX_AGG_CNT4_STRUC, *PTX_AGG_CNT4_STRUC; #define TX_AGG_CNT5 0x1734 typedef union _TX_AGG_CNT5_STRUC { struct { - USHORT AggSize11Count; - USHORT AggSize12Count; + u16 AggSize11Count; + u16 AggSize12Count; } field; - UINT32 word; + u32 word; } TX_AGG_CNT5_STRUC, *PTX_AGG_CNT5_STRUC; #define TX_AGG_CNT6 0x1738 typedef union _TX_AGG_CNT6_STRUC { struct { - USHORT AggSize13Count; - USHORT AggSize14Count; + u16 AggSize13Count; + u16 AggSize14Count; } field; - UINT32 word; + u32 word; } TX_AGG_CNT6_STRUC, *PTX_AGG_CNT6_STRUC; #define TX_AGG_CNT7 0x173c typedef union _TX_AGG_CNT7_STRUC { struct { - USHORT AggSize15Count; - USHORT AggSize16Count; + u16 AggSize15Count; + u16 AggSize16Count; } field; - UINT32 word; + u32 word; } TX_AGG_CNT7_STRUC, *PTX_AGG_CNT7_STRUC; #define MPDU_DENSITY_CNT 0x1740 typedef union _MPDU_DEN_CNT_STRUC { struct { - USHORT TXZeroDelCount; /*TX zero length delimiter count */ - USHORT RXZeroDelCount; /*RX zero length delimiter count */ + u16 TXZeroDelCount; /*TX zero length delimiter count */ + u16 RXZeroDelCount; /*RX zero length delimiter count */ } field; - UINT32 word; + u32 word; } MPDU_DEN_CNT_STRUC, *PMPDU_DEN_CNT_STRUC; /* */ /* TXRX control registers - base address 0x3000 */ @@ -980,29 +980,29 @@ typedef union _MPDU_DEN_CNT_STRUC { typedef union _SHAREDKEY_MODE_STRUC { struct { - UINT32 Bss0Key0CipherAlg:3; - UINT32:1; - UINT32 Bss0Key1CipherAlg:3; - UINT32:1; - UINT32 Bss0Key2CipherAlg:3; - UINT32:1; - UINT32 Bss0Key3CipherAlg:3; - UINT32:1; - UINT32 Bss1Key0CipherAlg:3; - UINT32:1; - UINT32 Bss1Key1CipherAlg:3; - UINT32:1; - UINT32 Bss1Key2CipherAlg:3; - UINT32:1; - UINT32 Bss1Key3CipherAlg:3; - UINT32:1; + u32 Bss0Key0CipherAlg:3; + u32 : 1; + u32 Bss0Key1CipherAlg:3; + u32 : 1; + u32 Bss0Key2CipherAlg:3; + u32 : 1; + u32 Bss0Key3CipherAlg:3; + u32 : 1; + u32 Bss1Key0CipherAlg:3; + u32 : 1; + u32 Bss1Key1CipherAlg:3; + u32 : 1; + u32 Bss1Key2CipherAlg:3; + u32 : 1; + u32 Bss1Key3CipherAlg:3; + u32 : 1; } field; - UINT32 word; + u32 word; } SHAREDKEY_MODE_STRUC, *PSHAREDKEY_MODE_STRUC; /* 64-entry for pairwise key table */ typedef struct _HW_WCID_ENTRY { /* 8-byte per entry */ - UCHAR Address[6]; - UCHAR Rsv[2]; + u8 Address[6]; + u8 Rsv[2]; } HW_WCID_ENTRY, PHW_WCID_ENTRY; /* ================================================================================= */ @@ -1010,28 +1010,28 @@ typedef struct _HW_WCID_ENTRY { /* 8-byte per entry */ /* ================================================================================= */ /*7.1 WCID ENTRY format : 8bytes */ typedef struct _WCID_ENTRY_STRUC { - UCHAR RXBABitmap7; /* bit0 for TID8, bit7 for TID 15 */ - UCHAR RXBABitmap0; /* bit0 for TID0, bit7 for TID 7 */ - UCHAR MAC[6]; /* 0 for shared key table. 1 for pairwise key table */ + u8 RXBABitmap7; /* bit0 for TID8, bit7 for TID 15 */ + u8 RXBABitmap0; /* bit0 for TID0, bit7 for TID 7 */ + u8 MAC[6]; /* 0 for shared key table. 1 for pairwise key table */ } WCID_ENTRY_STRUC, *PWCID_ENTRY_STRUC; /*8.1.1 SECURITY KEY format : 8DW */ /* 32-byte per entry, total 16-entry for shared key table, 64-entry for pairwise key table */ typedef struct _HW_KEY_ENTRY { /* 32-byte per entry */ - UCHAR Key[16]; - UCHAR TxMic[8]; - UCHAR RxMic[8]; + u8 Key[16]; + u8 TxMic[8]; + u8 RxMic[8]; } HW_KEY_ENTRY, *PHW_KEY_ENTRY; /*8.1.2 IV/EIV format : 2DW */ /*8.1.3 RX attribute entry format : 1DW */ typedef struct _MAC_ATTRIBUTE_STRUC { - UINT32 KeyTab:1; /* 0 for shared key table. 1 for pairwise key table */ - UINT32 PairKeyMode:3; - UINT32 BSSIDIdx:3; /*multipleBSS index for the WCID */ - UINT32 RXWIUDF:3; - UINT32 rsv:22; + u32 KeyTab:1; /* 0 for shared key table. 1 for pairwise key table */ + u32 PairKeyMode:3; + u32 BSSIDIdx:3; /*multipleBSS index for the WCID */ + u32 RXWIUDF:3; + u32 rsv:22; } MAC_ATTRIBUTE_STRUC, *PMAC_ATTRIBUTE_STRUC; /* ================================================================================= */ @@ -1043,12 +1043,12 @@ typedef struct _MAC_ATTRIBUTE_STRUC { /* */ typedef union _H2M_MAILBOX_STRUC { struct { - UINT32 LowByte:8; - UINT32 HighByte:8; - UINT32 CmdToken:8; - UINT32 Owner:8; + u32 LowByte:8; + u32 HighByte:8; + u32 CmdToken:8; + u32 Owner:8; } field; - UINT32 word; + u32 word; } H2M_MAILBOX_STRUC, *PH2M_MAILBOX_STRUC; /* */ @@ -1056,24 +1056,24 @@ typedef union _H2M_MAILBOX_STRUC { /* */ typedef union _M2H_CMD_DONE_STRUC { struct { - UINT32 CmdToken0; - UINT32 CmdToken1; - UINT32 CmdToken2; - UINT32 CmdToken3; + u32 CmdToken0; + u32 CmdToken1; + u32 CmdToken2; + u32 CmdToken3; } field; - UINT32 word; + u32 word; } M2H_CMD_DONE_STRUC, *PM2H_CMD_DONE_STRUC; /*NAV_TIME_CFG :NAV */ typedef union _NAV_TIME_CFG_STRUC { struct { - UCHAR Sifs; /* in unit of 1-us */ - UCHAR SlotTime; /* in unit of 1-us */ - USHORT Eifs:9; /* in unit of 1-us */ - USHORT ZeroSifs:1; /* Applied zero SIFS timer after OFDM RX 0: disable */ - USHORT rsv:6; + u8 Sifs; /* in unit of 1-us */ + u8 SlotTime; /* in unit of 1-us */ + u16 Eifs:9; /* in unit of 1-us */ + u16 ZeroSifs:1; /* Applied zero SIFS timer after OFDM RX 0: disable */ + u16 rsv:6; } field; - UINT32 word; + u32 word; } NAV_TIME_CFG_STRUC, *PNAV_TIME_CFG_STRUC; /* */ @@ -1081,30 +1081,30 @@ typedef union _NAV_TIME_CFG_STRUC { /* */ typedef union _RX_FILTR_CFG_STRUC { struct { - UINT32 DropCRCErr:1; /* Drop CRC error */ - UINT32 DropPhyErr:1; /* Drop physical error */ - UINT32 DropNotToMe:1; /* Drop not to me unicast frame */ - UINT32 DropNotMyBSSID:1; /* Drop fram ToDs bit is true */ - - UINT32 DropVerErr:1; /* Drop version error frame */ - UINT32 DropMcast:1; /* Drop multicast frames */ - UINT32 DropBcast:1; /* Drop broadcast frames */ - UINT32 DropDuplicate:1; /* Drop duplicate frame */ - - UINT32 DropCFEndAck:1; /* Drop Ps-Poll */ - UINT32 DropCFEnd:1; /* Drop Ps-Poll */ - UINT32 DropAck:1; /* Drop Ps-Poll */ - UINT32 DropCts:1; /* Drop Ps-Poll */ - - UINT32 DropRts:1; /* Drop Ps-Poll */ - UINT32 DropPsPoll:1; /* Drop Ps-Poll */ - UINT32 DropBA:1; /* */ - UINT32 DropBAR:1; /* */ - - UINT32 DropRsvCntlType:1; - UINT32:15; + u32 DropCRCErr:1; /* Drop CRC error */ + u32 DropPhyErr:1; /* Drop physical error */ + u32 DropNotToMe:1; /* Drop not to me unicast frame */ + u32 DropNotMyBSSID:1; /* Drop fram ToDs bit is true */ + + u32 DropVerErr:1; /* Drop version error frame */ + u32 DropMcast:1; /* Drop multicast frames */ + u32 DropBcast:1; /* Drop broadcast frames */ + u32 DropDuplicate:1; /* Drop duplicate frame */ + + u32 DropCFEndAck:1; /* Drop Ps-Poll */ + u32 DropCFEnd:1; /* Drop Ps-Poll */ + u32 DropAck:1; /* Drop Ps-Poll */ + u32 DropCts:1; /* Drop Ps-Poll */ + + u32 DropRts:1; /* Drop Ps-Poll */ + u32 DropPsPoll:1; /* Drop Ps-Poll */ + u32 DropBA:1; /* */ + u32 DropBAR:1; /* */ + + u32 DropRsvCntlType:1; + u32 : 15; } field; - UINT32 word; + u32 word; } RX_FILTR_CFG_STRUC, *PRX_FILTR_CFG_STRUC; /* */ @@ -1112,13 +1112,13 @@ typedef union _RX_FILTR_CFG_STRUC { /* */ typedef union _PHY_CSR4_STRUC { struct { - UINT32 RFRegValue:24; /* Register value (include register id) serial out to RF/IF chip. */ - UINT32 NumberOfBits:5; /* Number of bits used in RFRegValue (I:20, RFMD:22) */ - UINT32 IFSelect:1; /* 1: select IF to program, 0: select RF to program */ - UINT32 PLL_LD:1; /* RF PLL_LD status */ - UINT32 Busy:1; /* 1: ASIC is busy execute RF programming. */ + u32 RFRegValue:24; /* Register value (include register id) serial out to RF/IF chip. */ + u32 NumberOfBits:5; /* Number of bits used in RFRegValue (I:20, RFMD:22) */ + u32 IFSelect:1; /* 1: select IF to program, 0: select RF to program */ + u32 PLL_LD:1; /* RF PLL_LD status */ + u32 Busy:1; /* 1: ASIC is busy execute RF programming. */ } field; - UINT32 word; + u32 word; } PHY_CSR4_STRUC, *PPHY_CSR4_STRUC; /* */ @@ -1126,24 +1126,24 @@ typedef union _PHY_CSR4_STRUC { /* */ typedef union _SEC_CSR5_STRUC { struct { - UINT32 Bss2Key0CipherAlg:3; - UINT32:1; - UINT32 Bss2Key1CipherAlg:3; - UINT32:1; - UINT32 Bss2Key2CipherAlg:3; - UINT32:1; - UINT32 Bss2Key3CipherAlg:3; - UINT32:1; - UINT32 Bss3Key0CipherAlg:3; - UINT32:1; - UINT32 Bss3Key1CipherAlg:3; - UINT32:1; - UINT32 Bss3Key2CipherAlg:3; - UINT32:1; - UINT32 Bss3Key3CipherAlg:3; - UINT32:1; + u32 Bss2Key0CipherAlg:3; + u32 : 1; + u32 Bss2Key1CipherAlg:3; + u32 : 1; + u32 Bss2Key2CipherAlg:3; + u32 : 1; + u32 Bss2Key3CipherAlg:3; + u32 : 1; + u32 Bss3Key0CipherAlg:3; + u32 : 1; + u32 Bss3Key1CipherAlg:3; + u32 : 1; + u32 Bss3Key2CipherAlg:3; + u32 : 1; + u32 Bss3Key3CipherAlg:3; + u32 : 1; } field; - UINT32 word; + u32 word; } SEC_CSR5_STRUC, *PSEC_CSR5_STRUC; /* */ @@ -1151,10 +1151,10 @@ typedef union _SEC_CSR5_STRUC { /* */ typedef union _HOST_CMD_CSR_STRUC { struct { - UINT32 HostCommand:8; - UINT32 Rsv:24; + u32 HostCommand:8; + u32 Rsv:24; } field; - UINT32 word; + u32 word; } HOST_CMD_CSR_STRUC, *PHOST_CMD_CSR_STRUC; /* */ @@ -1166,16 +1166,16 @@ typedef union _HOST_CMD_CSR_STRUC { /* */ typedef union _E2PROM_CSR_STRUC { struct { - UINT32 Reload:1; /* Reload EEPROM content, write one to reload, self-cleared. */ - UINT32 EepromSK:1; - UINT32 EepromCS:1; - UINT32 EepromDI:1; - UINT32 EepromDO:1; - UINT32 Type:1; /* 1: 93C46, 0:93C66 */ - UINT32 LoadStatus:1; /* 1:loading, 0:done */ - UINT32 Rsvd:25; + u32 Reload:1; /* Reload EEPROM content, write one to reload, self-cleared. */ + u32 EepromSK:1; + u32 EepromCS:1; + u32 EepromDI:1; + u32 EepromDO:1; + u32 Type:1; /* 1: 93C46, 0:93C66 */ + u32 LoadStatus:1; /* 1:loading, 0:done */ + u32 Rsvd:25; } field; - UINT32 word; + u32 word; } E2PROM_CSR_STRUC, *PE2PROM_CSR_STRUC; /* */ @@ -1183,12 +1183,12 @@ typedef union _E2PROM_CSR_STRUC { /* */ typedef union _QOS_CSR0_STRUC { struct { - UCHAR Byte0; /* MAC address byte 0 */ - UCHAR Byte1; /* MAC address byte 1 */ - UCHAR Byte2; /* MAC address byte 2 */ - UCHAR Byte3; /* MAC address byte 3 */ + u8 Byte0; /* MAC address byte 0 */ + u8 Byte1; /* MAC address byte 1 */ + u8 Byte2; /* MAC address byte 2 */ + u8 Byte3; /* MAC address byte 3 */ } field; - UINT32 word; + u32 word; } QOS_CSR0_STRUC, *PQOS_CSR0_STRUC; /* */ @@ -1196,25 +1196,25 @@ typedef union _QOS_CSR0_STRUC { /* */ typedef union _QOS_CSR1_STRUC { struct { - UCHAR Byte4; /* MAC address byte 4 */ - UCHAR Byte5; /* MAC address byte 5 */ - UCHAR Rsvd0; - UCHAR Rsvd1; + u8 Byte4; /* MAC address byte 4 */ + u8 Byte5; /* MAC address byte 5 */ + u8 Rsvd0; + u8 Rsvd1; } field; - UINT32 word; + u32 word; } QOS_CSR1_STRUC, *PQOS_CSR1_STRUC; #define RF_CSR_CFG 0x500 typedef union _RF_CSR_CFG_STRUC { struct { - UINT RF_CSR_DATA:8; /* DATA */ - UINT TESTCSR_RFACC_REGNUM:5; /* RF register ID */ - UINT Rsvd2:3; /* Reserved */ - UINT RF_CSR_WR:1; /* 0: read 1: write */ - UINT RF_CSR_KICK:1; /* kick RF register read/write */ - UINT Rsvd1:14; /* Reserved */ + u32 RF_CSR_DATA:8; /* DATA */ + u32 TESTCSR_RFACC_REGNUM:5; /* RF register ID */ + u32 Rsvd2:3; /* Reserved */ + u32 RF_CSR_WR:1; /* 0: read 1: write */ + u32 RF_CSR_KICK:1; /* kick RF register read/write */ + u32 Rsvd1:14; /* Reserved */ } field; - UINT word; + u32 word; } RF_CSR_CFG_STRUC, *PRF_CSR_CFG_STRUC; /* */ diff --git a/drivers/staging/rt2860/chip/rtmp_phy.h b/drivers/staging/rt2860/chip/rtmp_phy.h index fd1a989c1110..48d186020059 100644 --- a/drivers/staging/rt2860/chip/rtmp_phy.h +++ b/drivers/staging/rt2860/chip/rtmp_phy.h @@ -180,7 +180,7 @@ if ((_A)->bPCIclkOff == FALSE) \ { \ PHY_CSR4_STRUC _value; \ - ULONG _busyCnt = 0; \ + unsigned long _busyCnt = 0; \ \ do { \ RTMP_IO_READ32((_A), RF_CSR_CFG0, &_value.word); \ @@ -248,7 +248,7 @@ if ((BbpCsr.field.Busy == IDLE) && \ (BbpCsr.field.RegNum == _bbpID)) \ { \ - *(_pV) = (UCHAR)BbpCsr.field.Value; \ + *(_pV) = (u8)BbpCsr.field.Value; \ break; \ } \ } \ @@ -313,7 +313,7 @@ if ((BbpCsr.field.Busy == IDLE) && \ (BbpCsr.field.RegNum == _I)) \ { \ - *(_pV) = (UCHAR)BbpCsr.field.Value; \ + *(_pV) = (u8)BbpCsr.field.Value; \ break; \ } \ } \ @@ -351,7 +351,7 @@ if ((BbpCsr.field.Busy == IDLE) && \ (BbpCsr.field.RegNum == _I)) \ { \ - *(_pV) = (UCHAR)BbpCsr.field.Value; \ + *(_pV) = (u8)BbpCsr.field.Value; \ break; \ } \ } \ @@ -429,7 +429,7 @@ #define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \ { \ BBP_CSR_CFG_STRUC BbpCsr; \ - INT BusyCnt = 0; \ + int BusyCnt = 0; \ BOOLEAN brc; \ if (_I < MAX_NUM_OF_BBP_LATCH) \ { \ @@ -523,8 +523,8 @@ #ifdef RT30xx #define RTMP_ASIC_MMPS_DISABLE(_pAd) \ do{ \ - UINT32 _macData; \ - UCHAR _bbpData = 0; \ + u32 _macData; \ + u8 _bbpData = 0; \ /* disable MMPS BBP control register */ \ RTMP_BBP_IO_READ8_BY_REG_ID(_pAd, BBP_R3, &_bbpData); \ _bbpData &= ~(0x04); /*bit 2*/ \ @@ -538,8 +538,8 @@ #define RTMP_ASIC_MMPS_ENABLE(_pAd) \ do{ \ - UINT32 _macData; \ - UCHAR _bbpData = 0; \ + u32 _macData; \ + u8 _bbpData = 0; \ /* enable MMPS BBP control register */ \ RTMP_BBP_IO_READ8_BY_REG_ID(_pAd, BBP_R3, &_bbpData); \ _bbpData |= (0x04); /*bit 2*/ \ diff --git a/drivers/staging/rt2860/chips/rt3070.c b/drivers/staging/rt2860/chips/rt3070.c index 4a6208765b62..beaaafa2b4a1 100644 --- a/drivers/staging/rt2860/chips/rt3070.c +++ b/drivers/staging/rt2860/chips/rt3070.c @@ -43,25 +43,25 @@ #error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" #endif /* RTMP_RF_RW_SUPPORT // */ -VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd) +void NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd) { - INT i; - UCHAR RFValue; + int i; + u8 RFValue; /* Driver must read EEPROM to get RfIcType before initial RF registers */ /* Initialize RF register to default value */ if (IS_RT3070(pAd) || IS_RT3071(pAd)) { /* Init RF calibration */ /* Driver should toggle RF R30 bit7 before init RF registers */ - UINT32 RfReg = 0; - UINT32 data; + u32 RfReg = 0; + u32 data; - RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR) & RfReg); + RT30xxReadRFRegister(pAd, RF_R30, (u8 *)& RfReg); RfReg |= 0x80; - RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR) RfReg); + RT30xxWriteRFRegister(pAd, RF_R30, (u8)RfReg); RTMPusecDelay(1000); RfReg &= 0x7F; - RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR) RfReg); + RT30xxWriteRFRegister(pAd, RF_R30, (u8)RfReg); /* Initialize RF register to default value */ for (i = 0; i < NUM_RF_REG_PARMS; i++) { @@ -84,9 +84,9 @@ VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd) } } else if (IS_RT3071(pAd)) { /* Driver should set RF R6 bit6 on before init RF registers */ - RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR) & RfReg); + RT30xxReadRFRegister(pAd, RF_R06, (u8 *)& RfReg); RfReg |= 0x40; - RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR) RfReg); + RT30xxWriteRFRegister(pAd, RF_R06, (u8)RfReg); /* init R31 */ RT30xxWriteRFRegister(pAd, RF_R31, 0x14); diff --git a/drivers/staging/rt2860/chips/rt3090.c b/drivers/staging/rt2860/chips/rt3090.c index cedacfb08791..b80928c902d9 100644 --- a/drivers/staging/rt2860/chips/rt3090.c +++ b/drivers/staging/rt2860/chips/rt3090.c @@ -43,22 +43,22 @@ #error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" #endif /* RTMP_RF_RW_SUPPORT // */ -VOID NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd) +void NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd) { - INT i; + int i; /* Driver must read EEPROM to get RfIcType before initial RF registers */ /* Initialize RF register to default value */ if (IS_RT3090(pAd)) { /* Init RF calibration */ /* Driver should toggle RF R30 bit7 before init RF registers */ - UINT32 RfReg = 0, data; + u32 RfReg = 0, data; - RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR) & RfReg); + RT30xxReadRFRegister(pAd, RF_R30, (u8 *)& RfReg); RfReg |= 0x80; - RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR) RfReg); + RT30xxWriteRFRegister(pAd, RF_R30, (u8)RfReg); RTMPusecDelay(1000); RfReg &= 0x7F; - RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR) RfReg); + RT30xxWriteRFRegister(pAd, RF_R30, (u8)RfReg); /* init R24, R31 */ RT30xxWriteRFRegister(pAd, RF_R24, 0x0F); @@ -90,9 +90,9 @@ VOID NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd) } /* Driver should set RF R6 bit6 on before calibration */ - RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR) & RfReg); + RT30xxReadRFRegister(pAd, RF_R06, (u8 *)& RfReg); RfReg |= 0x40; - RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR) RfReg); + RT30xxWriteRFRegister(pAd, RF_R06, (u8)RfReg); /*For RF filter Calibration */ RTMPFilterCalibration(pAd); diff --git a/drivers/staging/rt2860/chips/rt30xx.c b/drivers/staging/rt2860/chips/rt30xx.c index b03d94d851b5..39b483cce0db 100644 --- a/drivers/staging/rt2860/chips/rt30xx.c +++ b/drivers/staging/rt2860/chips/rt30xx.c @@ -87,19 +87,19 @@ REG_PAIR RT30xx_RFRegTable[] = { , }; -UCHAR NUM_RF_REG_PARMS = (sizeof(RT30xx_RFRegTable) / sizeof(REG_PAIR)); +u8 NUM_RF_REG_PARMS = (sizeof(RT30xx_RFRegTable) / sizeof(REG_PAIR)); /* Antenna divesity use GPIO3 and EESK pin for control */ /* Antenna and EEPROM access are both using EESK pin, */ /* Therefor we should avoid accessing EESK at the same time */ /* Then restore antenna after EEPROM access */ /* The original name of this function is AsicSetRxAnt(), now change to */ -/*VOID AsicSetRxAnt( */ -VOID RT30xxSetRxAnt(IN PRTMP_ADAPTER pAd, IN UCHAR Ant) +/*void AsicSetRxAnt( */ +void RT30xxSetRxAnt(IN PRTMP_ADAPTER pAd, u8 Ant) { - UINT32 Value; + u32 Value; #ifdef RTMP_MAC_PCI - UINT32 x; + u32 x; #endif if ((pAd->EepromAccess) || @@ -159,11 +159,11 @@ VOID RT30xxSetRxAnt(IN PRTMP_ADAPTER pAd, IN UCHAR Ant) ======================================================================== */ -VOID RTMPFilterCalibration(IN PRTMP_ADAPTER pAd) +void RTMPFilterCalibration(IN PRTMP_ADAPTER pAd) { - UCHAR R55x = 0, value, FilterTarget = 0x1E, BBPValue = 0; - UINT loop = 0, count = 0, loopcnt = 0, ReTry = 0; - UCHAR RF_R24_Value = 0; + u8 R55x = 0, value, FilterTarget = 0x1E, BBPValue = 0; + u32 loop = 0, count = 0, loopcnt = 0, ReTry = 0; + u8 RF_R24_Value = 0; /* Give bbp filter initial value */ pAd->Mlme.CaliBW20RfR24 = 0x1F; @@ -263,10 +263,10 @@ VOID RTMPFilterCalibration(IN PRTMP_ADAPTER pAd) if (loopcnt < 100) { if (loop++ == 0) { /*BandWidth = 20 MHz */ - pAd->Mlme.CaliBW20RfR24 = (UCHAR) RF_R24_Value; + pAd->Mlme.CaliBW20RfR24 = (u8)RF_R24_Value; } else { /*BandWidth = 40 MHz */ - pAd->Mlme.CaliBW40RfR24 = (UCHAR) RF_R24_Value; + pAd->Mlme.CaliBW40RfR24 = (u8)RF_R24_Value; break; } } else @@ -306,9 +306,9 @@ VOID RTMPFilterCalibration(IN PRTMP_ADAPTER pAd) ========================================================================== */ -VOID RT30xxLoadRFNormalModeSetup(IN PRTMP_ADAPTER pAd) +void RT30xxLoadRFNormalModeSetup(IN PRTMP_ADAPTER pAd) { - UCHAR RFValue; + u8 RFValue; /* RX0_PD & TX0_PD, RF R1 register Bit 2 & Bit 3 to 0 and RF_BLOCK_en,RX1_PD & TX1_PD, Bit0, Bit 4 & Bit5 to 1 */ RT30xxReadRFRegister(pAd, RF_R01, &RFValue); @@ -372,10 +372,10 @@ VOID RT30xxLoadRFNormalModeSetup(IN PRTMP_ADAPTER pAd) ========================================================================== */ -VOID RT30xxLoadRFSleepModeSetup(IN PRTMP_ADAPTER pAd) +void RT30xxLoadRFSleepModeSetup(IN PRTMP_ADAPTER pAd) { - UCHAR RFValue; - UINT32 MACValue; + u8 RFValue; + u32 MACValue; #ifdef RTMP_MAC_USB if (!IS_RT3572(pAd)) @@ -428,10 +428,10 @@ VOID RT30xxLoadRFSleepModeSetup(IN PRTMP_ADAPTER pAd) ========================================================================== */ -VOID RT30xxReverseRFSleepModeSetup(IN PRTMP_ADAPTER pAd) +void RT30xxReverseRFSleepModeSetup(IN PRTMP_ADAPTER pAd) { - UCHAR RFValue; - UINT32 MACValue; + u8 RFValue; + u32 MACValue; #ifdef RTMP_MAC_USB if (!IS_RT3572(pAd)) @@ -493,9 +493,9 @@ VOID RT30xxReverseRFSleepModeSetup(IN PRTMP_ADAPTER pAd) /* end johnli */ -VOID RT30xxHaltAction(IN PRTMP_ADAPTER pAd) +void RT30xxHaltAction(IN PRTMP_ADAPTER pAd) { - UINT32 TxPinCfg = 0x00050F0F; + u32 TxPinCfg = 0x00050F0F; /* */ /* Turn off LNA_PE or TRSW_POL */ diff --git a/drivers/staging/rt2860/chlist.h b/drivers/staging/rt2860/chlist.h index af8b5ca75930..4183c8b5a023 100644 --- a/drivers/staging/rt2860/chlist.h +++ b/drivers/staging/rt2860/chlist.h @@ -50,24 +50,24 @@ #define BAND_BOTH 2 typedef struct _CH_DESP { - UCHAR FirstChannel; - UCHAR NumOfCh; - CHAR MaxTxPwr; /* dBm */ - UCHAR Geography; /* 0:out door, 1:in door, 2:both */ + u8 FirstChannel; + u8 NumOfCh; + char MaxTxPwr; /* dBm */ + u8 Geography; /* 0:out door, 1:in door, 2:both */ BOOLEAN DfsReq; /* Dfs require, 0: No, 1: yes. */ } CH_DESP, *PCH_DESP; typedef struct _CH_REGION { - UCHAR CountReg[3]; - UCHAR DfsType; /* 0: CE, 1: FCC, 2: JAP, 3:JAP_W53, JAP_W56 */ + u8 CountReg[3]; + u8 DfsType; /* 0: CE, 1: FCC, 2: JAP, 3:JAP_W53, JAP_W56 */ CH_DESP ChDesp[10]; } CH_REGION, *PCH_REGION; extern CH_REGION ChRegion[]; typedef struct _CH_FREQ_MAP_ { - UINT16 channel; - UINT16 freqKHz; + u16 channel; + u16 freqKHz; } CH_FREQ_MAP; extern CH_FREQ_MAP CH_HZ_ID_MAP[]; @@ -103,15 +103,15 @@ extern int CH_HZ_ID_MAP_NUM; (_ch) = 1; \ }while(0) -VOID BuildChannelListEx(IN PRTMP_ADAPTER pAd); +void BuildChannelListEx(IN PRTMP_ADAPTER pAd); -VOID BuildBeaconChList(IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf, OUT PULONG pBufLen); +void BuildBeaconChList(IN PRTMP_ADAPTER pAd, + u8 *pBuf, unsigned long *pBufLen); -VOID N_ChannelCheck(IN PRTMP_ADAPTER pAd); +void N_ChannelCheck(IN PRTMP_ADAPTER pAd); -VOID N_SetCenCh(IN PRTMP_ADAPTER pAd); +void N_SetCenCh(IN PRTMP_ADAPTER pAd); -UINT8 GetCuntryMaxTxPwr(IN PRTMP_ADAPTER pAd, IN UINT8 channel); +u8 GetCuntryMaxTxPwr(IN PRTMP_ADAPTER pAd, u8 channel); #endif /* __CHLIST_H__ */ diff --git a/drivers/staging/rt2860/common/action.c b/drivers/staging/rt2860/common/action.c index f69681d65fcf..8928ee742676 100644 --- a/drivers/staging/rt2860/common/action.c +++ b/drivers/staging/rt2860/common/action.c @@ -39,7 +39,7 @@ #include "../rt_config.h" #include "action.h" -static VOID ReservedAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +static void ReservedAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); /* ========================================================================== @@ -58,7 +58,7 @@ static VOID ReservedAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); MT2_CLS3ERR cls3err_action ========================================================================== */ -VOID ActionStateMachineInit(IN PRTMP_ADAPTER pAd, +void ActionStateMachineInit(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * S, OUT STATE_MACHINE_FUNC Trans[]) { @@ -98,15 +98,15 @@ VOID ActionStateMachineInit(IN PRTMP_ADAPTER pAd, (STATE_MACHINE_FUNC) MlmeInvalidAction); } -VOID MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { MLME_ADDBA_REQ_STRUCT *pInfo; - UCHAR Addr[6]; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG Idx; + u8 Addr[6]; + u8 *pOutBuffer = NULL; + int NStatus; + unsigned long Idx; FRAME_ADDBA_REQ Frame; - ULONG FrameLen; + unsigned long FrameLen; BA_ORI_ENTRY *pBAEntry = NULL; pInfo = (MLME_ADDBA_REQ_STRUCT *) Elem->Msg; @@ -155,8 +155,8 @@ VOID MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Frame.BaStartSeq.field.StartSeq = pAd->MacTab.Content[pInfo->Wcid].TxSeq[pInfo->TID]; - *(USHORT *) (&Frame.BaParm) = - cpu2le16(*(USHORT *) (&Frame.BaParm)); + *(u16 *) (&Frame.BaParm) = + cpu2le16(*(u16 *) (&Frame.BaParm)); Frame.TimeOutValue = cpu2le16(Frame.TimeOutValue); Frame.BaStartSeq.word = cpu2le16(Frame.BaStartSeq.word); @@ -188,15 +188,15 @@ VOID MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { MLME_DELBA_REQ_STRUCT *pInfo; - PUCHAR pOutBuffer = NULL; - PUCHAR pOutBuffer2 = NULL; - NDIS_STATUS NStatus; - ULONG Idx; + u8 *pOutBuffer = NULL; + u8 *pOutBuffer2 = NULL; + int NStatus; + unsigned long Idx; FRAME_DELBA_REQ Frame; - ULONG FrameLen; + unsigned long FrameLen; FRAME_BAR FrameBar; pInfo = (MLME_DELBA_REQ_STRUCT *) Elem->Msg; @@ -264,8 +264,8 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Frame.DelbaParm.Initiator = pInfo->Initiator; Frame.DelbaParm.TID = pInfo->TID; Frame.ReasonCode = 39; /* Time Out */ - *(USHORT *) (&Frame.DelbaParm) = - cpu2le16(*(USHORT *) (&Frame.DelbaParm)); + *(u16 *) (&Frame.DelbaParm) = + cpu2le16(*(u16 *) (&Frame.DelbaParm)); Frame.ReasonCode = cpu2le16(Frame.ReasonCode); MakeOutgoingFrame(pOutBuffer, &FrameLen, @@ -278,27 +278,27 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } -VOID MlmeQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { } -VOID MlmeDLSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeDLSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { } -VOID MlmeInvalidAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeInvalidAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - /*PUCHAR pOutBuffer = NULL; */ + /*u8 * pOutBuffer = NULL; */ /*Return the receiving frame except the MSB of category filed set to 1. 7.3.1.11 */ } -VOID PeerQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { } -VOID PeerBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Action = Elem->Msg[LENGTH_802_11 + 1]; + u8 Action = Elem->Msg[LENGTH_802_11 + 1]; switch (Action) { case ADDBA_REQ: @@ -313,15 +313,15 @@ VOID PeerBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } -VOID PeerPublicAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerPublicAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { if (Elem->Wcid >= MAX_LEN_OF_MAC_TABLE) return; } -static VOID ReservedAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +static void ReservedAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Category; + u8 Category; if (Elem->MsgLen <= LENGTH_802_11) { return; @@ -333,19 +333,19 @@ static VOID ReservedAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) hex_dump("Reserved Action Frame", &Elem->Msg[0], Elem->MsgLen); } -VOID PeerRMAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerRMAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { return; } -static VOID respond_ht_information_exchange_action(IN PRTMP_ADAPTER pAd, +static void respond_ht_information_exchange_action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen; + u8 *pOutBuffer = NULL; + int NStatus; + unsigned long FrameLen; FRAME_HT_INFO HTINFOframe, *pFrame; - UCHAR *pAddr; + u8 *pAddr; /* 2. Always send back ADDBA Response */ NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ @@ -387,9 +387,9 @@ static VOID respond_ht_information_exchange_action(IN PRTMP_ADAPTER pAd, MlmeFreeMemory(pAd, pOutBuffer); } -VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Action = Elem->Msg[LENGTH_802_11 + 1]; + u8 Action = Elem->Msg[LENGTH_802_11 + 1]; if (Elem->Wcid >= MAX_LEN_OF_MAC_TABLE) return; @@ -467,11 +467,11 @@ VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) FALSE , then continue indicaterx at this moment. ========================================================================== */ -VOID ORIBATimerTimeout(IN PRTMP_ADAPTER pAd) +void ORIBATimerTimeout(IN PRTMP_ADAPTER pAd) { MAC_TABLE_ENTRY *pEntry; - INT i, total; - UCHAR TID; + int i, total; + u8 TID; total = pAd->MacTab.Size * NUM_OF_TID; @@ -489,15 +489,15 @@ VOID ORIBATimerTimeout(IN PRTMP_ADAPTER pAd) } } -VOID SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) +void SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) { FRAME_BAR FrameBar; - ULONG FrameLen; - NDIS_STATUS NStatus; - PUCHAR pOutBuffer = NULL; - USHORT Sequence; - UCHAR i, TID; - USHORT idx; + unsigned long FrameLen; + int NStatus; + u8 *pOutBuffer = NULL; + u16 Sequence; + u8 i, TID; + u16 idx; BA_ORI_ENTRY *pBAEntry; for (i = 0; i < NUM_OF_TID; i++) { @@ -547,9 +547,9 @@ VOID SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) } } -VOID ActHeaderInit(IN PRTMP_ADAPTER pAd, +void ActHeaderInit(IN PRTMP_ADAPTER pAd, IN OUT PHEADER_802_11 pHdr80211, - IN PUCHAR Addr1, IN PUCHAR Addr2, IN PUCHAR Addr3) + u8 *Addr1, u8 *Addr2, u8 *Addr3) { NdisZeroMemory(pHdr80211, sizeof(HEADER_802_11)); pHdr80211->FC.Type = BTYPE_MGMT; @@ -560,8 +560,8 @@ VOID ActHeaderInit(IN PRTMP_ADAPTER pAd, COPY_MAC_ADDR(pHdr80211->Addr3, Addr3); } -VOID BarHeaderInit(IN PRTMP_ADAPTER pAd, - IN OUT PFRAME_BAR pCntlBar, IN PUCHAR pDA, IN PUCHAR pSA) +void BarHeaderInit(IN PRTMP_ADAPTER pAd, + IN OUT PFRAME_BAR pCntlBar, u8 *pDA, u8 *pSA) { NdisZeroMemory(pCntlBar, sizeof(FRAME_BAR)); pCntlBar->FC.Type = BTYPE_CNTL; @@ -591,11 +591,11 @@ VOID BarHeaderInit(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -VOID InsertActField(IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, IN UINT8 Category, IN UINT8 ActCode) +void InsertActField(IN PRTMP_ADAPTER pAd, + u8 *pFrameBuf, + unsigned long *pFrameLen, u8 Category, u8 ActCode) { - ULONG TempLen; + unsigned long TempLen; MakeOutgoingFrame(pFrameBuf, &TempLen, 1, &Category, 1, &ActCode, END_OF_ARGS); diff --git a/drivers/staging/rt2860/common/action.h b/drivers/staging/rt2860/common/action.h index 2484c2ebf51f..f1d1ac73b1cb 100644 --- a/drivers/staging/rt2860/common/action.h +++ b/drivers/staging/rt2860/common/action.h @@ -40,16 +40,16 @@ #define __ACTION_H__ typedef struct PACKED __HT_INFO_OCTET { - UCHAR Request:1; - UCHAR Forty_MHz_Intolerant:1; - UCHAR STA_Channel_Width:1; - UCHAR Reserved:5; + u8 Request:1; + u8 Forty_MHz_Intolerant:1; + u8 STA_Channel_Width:1; + u8 Reserved:5; } HT_INFORMATION_OCTET; typedef struct PACKED __FRAME_HT_INFO { HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; + u8 Category; + u8 Action; HT_INFORMATION_OCTET HT_Info; } FRAME_HT_INFO, *PFRAME_HT_INFO; diff --git a/drivers/staging/rt2860/common/ba_action.c b/drivers/staging/rt2860/common/ba_action.c index 97cb40a28260..1ffa176ce8a5 100644 --- a/drivers/staging/rt2860/common/ba_action.c +++ b/drivers/staging/rt2860/common/ba_action.c @@ -41,19 +41,19 @@ static void ba_mpdu_blk_free(PRTMP_ADAPTER pAd, struct reordering_mpdu *mpdu_blk); -BA_ORI_ENTRY *BATableAllocOriEntry(IN PRTMP_ADAPTER pAd, OUT USHORT * Idx); +BA_ORI_ENTRY *BATableAllocOriEntry(IN PRTMP_ADAPTER pAd, u16 * Idx); -BA_REC_ENTRY *BATableAllocRecEntry(IN PRTMP_ADAPTER pAd, OUT USHORT * Idx); +BA_REC_ENTRY *BATableAllocRecEntry(IN PRTMP_ADAPTER pAd, u16 * Idx); -VOID BAOriSessionSetupTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); +void BAOriSessionSetupTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, + void *SystemSpecific3); -VOID BARecSessionIdleTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); +void BARecSessionIdleTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, + void *SystemSpecific3); BUILD_TIMER_FUNCTION(BAOriSessionSetupTimeout); BUILD_TIMER_FUNCTION(BARecSessionIdleTimeout); @@ -61,10 +61,10 @@ BUILD_TIMER_FUNCTION(BARecSessionIdleTimeout); #define ANNOUNCE_REORDERING_PACKET(_pAd, _mpdu_blk) \ Announce_Reordering_Packet(_pAd, _mpdu_blk); -VOID BA_MaxWinSizeReasign(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntryPeer, OUT UCHAR * pWinSize) +void BA_MaxWinSizeReasign(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntryPeer, u8 * pWinSize) { - UCHAR MaxSize; + u8 MaxSize; if (pAd->MACVersion >= RALINK_2883_VERSION) /* 3*3 */ { @@ -232,7 +232,7 @@ void ba_reordering_resource_release(PRTMP_ADAPTER pAd) BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num) { int i; - PUCHAR mem; + u8 *mem; struct reordering_mpdu *mpdu_blk; struct reordering_list *freelist; @@ -246,10 +246,10 @@ BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num) DBGPRINT(RT_DEBUG_TRACE, ("Allocate %d memory for BA reordering\n", - (UINT32) (num * sizeof(struct reordering_mpdu)))); + (u32)(num * sizeof(struct reordering_mpdu)))); /* allocate number of mpdu_blk memory */ - os_alloc_mem(pAd, (PUCHAR *) & mem, + os_alloc_mem(pAd, (u8 **) & mem, (num * sizeof(struct reordering_mpdu))); pAd->mpdu_blk_pool.mem = mem; @@ -303,12 +303,12 @@ static void ba_mpdu_blk_free(PRTMP_ADAPTER pAd, NdisReleaseSpinLock(&pAd->mpdu_blk_pool.lock); } -static USHORT ba_indicate_reordering_mpdus_in_order(IN PRTMP_ADAPTER pAd, +static u16 ba_indicate_reordering_mpdus_in_order(IN PRTMP_ADAPTER pAd, IN PBA_REC_ENTRY pBAEntry, - IN USHORT StartSeq) + u16 StartSeq) { struct reordering_mpdu *mpdu_blk; - USHORT LastIndSeq = RESET_RCV_SEQ; + u16 LastIndSeq = RESET_RCV_SEQ; NdisAcquireSpinLock(&pBAEntry->RxReRingLock); @@ -336,7 +336,7 @@ static USHORT ba_indicate_reordering_mpdus_in_order(IN PRTMP_ADAPTER pAd, static void ba_indicate_reordering_mpdus_le_seq(IN PRTMP_ADAPTER pAd, IN PBA_REC_ENTRY pBAEntry, - IN USHORT Sequence) + u16 Sequence) { struct reordering_mpdu *mpdu_blk; @@ -383,9 +383,9 @@ static void ba_refresh_reordering_mpdus(IN PRTMP_ADAPTER pAd, /*static */ void ba_flush_reordering_timeout_mpdus(IN PRTMP_ADAPTER pAd, IN PBA_REC_ENTRY pBAEntry, - IN ULONG Now32) + unsigned long Now32) { - USHORT Sequence; + u16 Sequence; /* if ((RTMP_TIME_AFTER((unsigned long)Now32, (unsigned long)(pBAEntry->LastIndSeqAtTimer+REORDERING_PACKET_TIMEOUT)) && */ /* (pBAEntry->list.qlen > ((pBAEntry->BAWinSize*7)/8))) //|| */ @@ -440,15 +440,15 @@ void ba_flush_reordering_timeout_mpdus(IN PRTMP_ADAPTER pAd, * generate ADDBA request to * set up BA agreement */ -VOID BAOriSessionSetUp(IN PRTMP_ADAPTER pAd, +void BAOriSessionSetUp(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, - IN UCHAR TID, - IN USHORT TimeOut, - IN ULONG DelayTime, IN BOOLEAN isForced) + u8 TID, + u16 TimeOut, + unsigned long DelayTime, IN BOOLEAN isForced) { /*MLME_ADDBA_REQ_STRUCT AddbaReq; */ BA_ORI_ENTRY *pBAEntry = NULL; - USHORT Idx; + u16 Idx; BOOLEAN Cancelled; if ((pAd->CommonCfg.BACapability.field.AutoBA != TRUE) @@ -506,16 +506,16 @@ VOID BAOriSessionSetUp(IN PRTMP_ADAPTER pAd, RTMPSetTimer(&pBAEntry->ORIBATimer, DelayTime); } -VOID BAOriSessionAdd(IN PRTMP_ADAPTER pAd, +void BAOriSessionAdd(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, IN PFRAME_ADDBA_RSP pFrame) { BA_ORI_ENTRY *pBAEntry = NULL; BOOLEAN Cancelled; - UCHAR TID; - USHORT Idx; - PUCHAR pOutBuffer2 = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen; + u8 TID; + u16 Idx; + u8 *pOutBuffer2 = NULL; + int NStatus; + unsigned long FrameLen; FRAME_BAR FrameBar; TID = pFrame->BaParm.TID; @@ -526,7 +526,7 @@ VOID BAOriSessionAdd(IN PRTMP_ADAPTER pAd, if ((Idx != 0) && (pBAEntry->TID == TID) && (pBAEntry->ORI_BA_Status == Originator_WaitRes)) { pBAEntry->BAWinSize = - min(pBAEntry->BAWinSize, ((UCHAR) pFrame->BaParm.BufSize)); + min(pBAEntry->BAWinSize, ((u8)pFrame->BaParm.BufSize)); BA_MaxWinSizeReasign(pAd, pEntry, &pBAEntry->BAWinSize); pBAEntry->TimeOutValue = pFrame->TimeOutValue; @@ -577,11 +577,11 @@ BOOLEAN BARecSessionAdd(IN PRTMP_ADAPTER pAd, BA_REC_ENTRY *pBAEntry = NULL; BOOLEAN Status = TRUE; BOOLEAN Cancelled; - USHORT Idx; - UCHAR TID; - UCHAR BAWinSize; - /*UINT32 Value; */ - /*UINT offset; */ + u16 Idx; + u8 TID; + u8 BAWinSize; + /*u32 Value; */ + /*u32 offset; */ ASSERT(pEntry); @@ -589,8 +589,8 @@ BOOLEAN BARecSessionAdd(IN PRTMP_ADAPTER pAd, TID = pFrame->BaParm.TID; BAWinSize = - min(((UCHAR) pFrame->BaParm.BufSize), - (UCHAR) pAd->CommonCfg.BACapability.field.RxBAWinLimit); + min(((u8)pFrame->BaParm.BufSize), + (u8)pAd->CommonCfg.BACapability.field.RxBAWinLimit); /* Intel patch */ if (BAWinSize == 0) { @@ -660,7 +660,7 @@ BOOLEAN BARecSessionAdd(IN PRTMP_ADAPTER pAd, return (Status); } -BA_REC_ENTRY *BATableAllocRecEntry(IN PRTMP_ADAPTER pAd, OUT USHORT * Idx) +BA_REC_ENTRY *BATableAllocRecEntry(IN PRTMP_ADAPTER pAd, u16 * Idx) { int i; BA_REC_ENTRY *pBAEntry = NULL; @@ -690,7 +690,7 @@ done: return pBAEntry; } -BA_ORI_ENTRY *BATableAllocOriEntry(IN PRTMP_ADAPTER pAd, OUT USHORT * Idx) +BA_ORI_ENTRY *BATableAllocOriEntry(IN PRTMP_ADAPTER pAd, u16 * Idx) { int i; BA_ORI_ENTRY *pBAEntry = NULL; @@ -718,7 +718,7 @@ done: return pBAEntry; } -VOID BATableFreeOriEntry(IN PRTMP_ADAPTER pAd, IN ULONG Idx) +void BATableFreeOriEntry(IN PRTMP_ADAPTER pAd, unsigned long Idx) { BA_ORI_ENTRY *pBAEntry = NULL; MAC_TABLE_ENTRY *pEntry; @@ -752,7 +752,7 @@ VOID BATableFreeOriEntry(IN PRTMP_ADAPTER pAd, IN ULONG Idx) } } -VOID BATableFreeRecEntry(IN PRTMP_ADAPTER pAd, IN ULONG Idx) +void BATableFreeRecEntry(IN PRTMP_ADAPTER pAd, unsigned long Idx) { BA_REC_ENTRY *pBAEntry = NULL; MAC_TABLE_ENTRY *pEntry; @@ -777,12 +777,12 @@ VOID BATableFreeRecEntry(IN PRTMP_ADAPTER pAd, IN ULONG Idx) } } -VOID BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR TID, +void BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd, + u8 Wcid, + u8 TID, IN BOOLEAN bPassive, IN BOOLEAN bForceSend) { - ULONG Idx = 0; + unsigned long Idx = 0; BA_ORI_ENTRY *pBAEntry; BOOLEAN Cancelled; @@ -867,10 +867,10 @@ VOID BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd, } } -VOID BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd, - IN UCHAR Wcid, IN UCHAR TID, IN BOOLEAN bPassive) +void BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd, + u8 Wcid, u8 TID, IN BOOLEAN bPassive) { - ULONG Idx = 0; + unsigned long Idx = 0; BA_REC_ENTRY *pBAEntry; if (Wcid >= MAX_LEN_OF_MAC_TABLE) { @@ -897,8 +897,8 @@ VOID BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd, && (pBAEntry->REC_BA_Status == Recipient_Accept)) { MLME_DELBA_REQ_STRUCT DelbaReq; BOOLEAN Cancelled; - /*ULONG offset; */ - /*UINT32 VALUE; */ + /*unsigned long offset; */ + /*u32 VALUE; */ RTMPCancelTimer(&pBAEntry->RECBATimer, &Cancelled); @@ -956,7 +956,7 @@ VOID BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd, BATableFreeRecEntry(pAd, Idx); } -VOID BASessionTearDownALL(IN OUT PRTMP_ADAPTER pAd, IN UCHAR Wcid) +void BASessionTearDownALL(IN OUT PRTMP_ADAPTER pAd, u8 Wcid) { int i; @@ -980,10 +980,10 @@ VOID BASessionTearDownALL(IN OUT PRTMP_ADAPTER pAd, IN UCHAR Wcid) FALSE , then continue indicaterx at this moment. ========================================================================== */ -VOID BAOriSessionSetupTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +void BAOriSessionSetupTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, + void *SystemSpecific3) { BA_ORI_ENTRY *pBAEntry = (BA_ORI_ENTRY *) FunctionContext; MAC_TABLE_ENTRY *pEntry; @@ -1008,14 +1008,14 @@ VOID BAOriSessionSetupTimeout(IN PVOID SystemSpecific1, NdisZeroMemory(&AddbaReq, sizeof(AddbaReq)); COPY_MAC_ADDR(AddbaReq.pAddr, pEntry->Addr); - AddbaReq.Wcid = (UCHAR) (pEntry->Aid); + AddbaReq.Wcid = (u8)(pEntry->Aid); AddbaReq.TID = pBAEntry->TID; AddbaReq.BaBufSize = pAd->CommonCfg.BACapability.field.RxBAWinLimit; AddbaReq.TimeOutValue = 0; AddbaReq.Token = pBAEntry->Token; MlmeEnqueue(pAd, ACTION_STATE_MACHINE, MT2_MLME_ADD_BA_CATE, - sizeof(MLME_ADDBA_REQ_STRUCT), (PVOID) & AddbaReq); + sizeof(MLME_ADDBA_REQ_STRUCT), (void *)& AddbaReq); RTMP_MLME_HANDLER(pAd); DBGPRINT(RT_DEBUG_TRACE, ("BA Ori Session Timeout(%d) : Send ADD BA again\n", @@ -1042,14 +1042,14 @@ VOID BAOriSessionSetupTimeout(IN PVOID SystemSpecific1, FALSE , then continue indicaterx at this moment. ========================================================================== */ -VOID BARecSessionIdleTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) +void BARecSessionIdleTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3) { BA_REC_ENTRY *pBAEntry = (BA_REC_ENTRY *) FunctionContext; PRTMP_ADAPTER pAd; - ULONG Now32; + unsigned long Now32; if (pBAEntry == NULL) return; @@ -1070,19 +1070,19 @@ VOID BARecSessionIdleTimeout(IN PVOID SystemSpecific1, } } -VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { /* 7.4.4.1 */ - /*ULONG Idx; */ - UCHAR Status = 1; - UCHAR pAddr[6]; + /*unsigned long Idx; */ + u8 Status = 1; + u8 pAddr[6]; FRAME_ADDBA_RSP ADDframe; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; + u8 *pOutBuffer = NULL; + int NStatus; PFRAME_ADDBA_REQ pAddreqFrame = NULL; - /*UCHAR BufSize; */ - ULONG FrameLen; - PULONG ptemp; + /*u8 BufSize; */ + unsigned long FrameLen; + unsigned long *ptemp; PMAC_TABLE_ENTRY pMacEntry; DBGPRINT(RT_DEBUG_TRACE, @@ -1096,7 +1096,7 @@ VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pMacEntry = &pAd->MacTab.Content[Elem->Wcid]; DBGPRINT(RT_DEBUG_TRACE, ("BA - PeerAddBAReqAction----> \n")); - ptemp = (PULONG) Elem->Msg; + ptemp = (unsigned long *)Elem->Msg; /*DBGPRINT_RAW(RT_DEBUG_EMU, ("%08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x:: %08x\n", *(ptemp), *(ptemp+1), *(ptemp+2), *(ptemp+3), *(ptemp+4), *(ptemp+5), *(ptemp+6), *(ptemp+7), *(ptemp+8))); */ if (PeerAddBAReqActionSanity(pAd, Elem->Msg, Elem->MsgLen, pAddr)) { @@ -1151,15 +1151,15 @@ VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ADDframe.BaParm.AMSDUSupported = 0; ADDframe.BaParm.TID = pAddreqFrame->BaParm.TID; ADDframe.BaParm.BufSize = - min(((UCHAR) pAddreqFrame->BaParm.BufSize), - (UCHAR) pAd->CommonCfg.BACapability.field.RxBAWinLimit); + min(((u8)pAddreqFrame->BaParm.BufSize), + (u8)pAd->CommonCfg.BACapability.field.RxBAWinLimit); if (ADDframe.BaParm.BufSize == 0) { ADDframe.BaParm.BufSize = 64; } ADDframe.TimeOutValue = 0; /*pAddreqFrame->TimeOutValue; */ - *(USHORT *) (&ADDframe.BaParm) = - cpu2le16(*(USHORT *) (&ADDframe.BaParm)); + *(u16 *) (&ADDframe.BaParm) = + cpu2le16(*(u16 *) (&ADDframe.BaParm)); ADDframe.StatusCode = cpu2le16(ADDframe.StatusCode); ADDframe.TimeOutValue = cpu2le16(ADDframe.TimeOutValue); @@ -1173,10 +1173,10 @@ VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ADDframe.BaParm.TID, ADDframe.BaParm.BufSize)); } -VOID PeerAddBARspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerAddBARspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - /*UCHAR Idx, i; */ - /*PUCHAR pOutBuffer = NULL; */ + /*u8 Idx, i; */ + /*u8 * pOutBuffer = NULL; */ PFRAME_ADDBA_RSP pFrame = NULL; /*PBA_ORI_ENTRY pBAEntry; */ @@ -1216,10 +1216,10 @@ VOID PeerAddBARspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } -VOID PeerDelBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerDelBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - /*UCHAR Idx; */ - /*PUCHAR pOutBuffer = NULL; */ + /*u8 Idx; */ + /*u8 * pOutBuffer = NULL; */ PFRAME_DELBA_REQ pDelFrame = NULL; DBGPRINT(RT_DEBUG_TRACE, ("%s ==>\n", __func__)); @@ -1244,23 +1244,23 @@ VOID PeerDelBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN ULONG MsgLen, IN PFRAME_BA_REQ pMsg) + unsigned long Wcid, + unsigned long MsgLen, IN PFRAME_BA_REQ pMsg) { PFRAME_BA_REQ pFrame = pMsg; /*PRTMP_REORDERBUF pBuffer; */ /*PRTMP_REORDERBUF pDmaBuf; */ PBA_REC_ENTRY pBAEntry; /*BOOLEAN Result; */ - ULONG Idx; - /*UCHAR NumRxPkt; */ - UCHAR TID; /*, i; */ + unsigned long Idx; + /*u8 NumRxPkt; */ + u8 TID; /*, i; */ - TID = (UCHAR) pFrame->BARControl.TID; + TID = (u8)pFrame->BARControl.TID; DBGPRINT(RT_DEBUG_TRACE, ("%s(): BAR-Wcid(%ld), Tid (%d)\n", __func__, Wcid, TID)); - /*hex_dump("BAR", (PCHAR) pFrame, MsgLen); */ + /*hex_dump("BAR", (char *)pFrame, MsgLen); */ /* Do nothing if the driver is starting halt state. */ /* This might happen when timer already been fired before cancel timer with mlmehalt */ if (RTMP_TEST_FLAG @@ -1309,13 +1309,13 @@ BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd, /* Description : Send PSMP Action frame If PSMP mode switches. */ -VOID SendPSMPAction(IN PRTMP_ADAPTER pAd, IN UCHAR Wcid, IN UCHAR Psmp) +void SendPSMPAction(IN PRTMP_ADAPTER pAd, u8 Wcid, u8 Psmp) { - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - /*ULONG Idx; */ + u8 *pOutBuffer = NULL; + int NStatus; + /*unsigned long Idx; */ FRAME_PSMP_ACTION Frame; - ULONG FrameLen; + unsigned long FrameLen; NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { @@ -1364,32 +1364,32 @@ VOID SendPSMPAction(IN PRTMP_ADAPTER pAd, IN UCHAR Wcid, IN UCHAR Psmp) #define RADIO_MEASUREMENT_REQUEST_ACTION 0 typedef struct PACKED { - UCHAR RegulatoryClass; - UCHAR ChannelNumber; - USHORT RandomInterval; - USHORT MeasurementDuration; - UCHAR MeasurementMode; - UCHAR BSSID[MAC_ADDR_LEN]; - UCHAR ReportingCondition; - UCHAR Threshold; - UCHAR SSIDIE[2]; /* 2 byte */ + u8 RegulatoryClass; + u8 ChannelNumber; + u16 RandomInterval; + u16 MeasurementDuration; + u8 MeasurementMode; + u8 BSSID[MAC_ADDR_LEN]; + u8 ReportingCondition; + u8 Threshold; + u8 SSIDIE[2]; /* 2 byte */ } BEACON_REQUEST; typedef struct PACKED { - UCHAR ID; - UCHAR Length; - UCHAR Token; - UCHAR RequestMode; - UCHAR Type; + u8 ID; + u8 Length; + u8 Token; + u8 RequestMode; + u8 Type; } MEASUREMENT_REQ; void convert_reordering_packet_to_preAMSDU_or_802_3_packet(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk, - IN UCHAR + u8 FromWhichBSSID) { PNDIS_PACKET pRxPkt; - UCHAR Header802_3[LENGTH_802_3]; + u8 Header802_3[LENGTH_802_3]; /* 1. get 802.3 Header */ /* 2. remove LLC */ @@ -1436,13 +1436,13 @@ void convert_reordering_packet_to_preAMSDU_or_802_3_packet(IN PRTMP_ADAPTER pAd, } \ } while (0); -static VOID ba_enqueue_reordering_packet(IN PRTMP_ADAPTER pAd, +static void ba_enqueue_reordering_packet(IN PRTMP_ADAPTER pAd, IN PBA_REC_ENTRY pBAEntry, IN RX_BLK * pRxBlk, - IN UCHAR FromWhichBSSID) + u8 FromWhichBSSID) { struct reordering_mpdu *mpdu_blk; - UINT16 Sequence = (UINT16) pRxBlk->pHeader->Sequence; + u16 Sequence = (u16)pRxBlk->pHeader->Sequence; mpdu_blk = ba_mpdu_blk_alloc(pAd); if ((mpdu_blk != NULL) && (!RX_BLK_TEST_FLAG(pRxBlk, fRX_EAP))) { @@ -1515,15 +1515,15 @@ static VOID ba_enqueue_reordering_packet(IN PRTMP_ADAPTER pAd, ========================================================================== */ -VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) +void Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, u8 FromWhichBSSID) { - USHORT Idx; + u16 Idx; PBA_REC_ENTRY pBAEntry = NULL; - UINT16 Sequence = pRxBlk->pHeader->Sequence; - ULONG Now32; - UCHAR Wcid = pRxBlk->pRxWI->WirelessCliID; - UCHAR TID = pRxBlk->pRxWI->TID; + u16 Sequence = pRxBlk->pHeader->Sequence; + unsigned long Now32; + u8 Wcid = pRxBlk->pRxWI->WirelessCliID; + u8 TID = pRxBlk->pRxWI->TID; if (!RX_BLK_TEST_FLAG(pRxBlk, fRX_AMSDU) && (pRxBlk->DataSize > MAX_RX_PKT_LEN)) { @@ -1578,7 +1578,7 @@ VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd, /* I. Check if in order. */ /* */ if (SEQ_STEPONE(Sequence, pBAEntry->LastIndSeq, MAXSEQ)) { - USHORT LastIndSeq; + u16 LastIndSeq; pBAEntry->LastIndSeq = Sequence; INDICATE_LEGACY_OR_AMSDU(pAd, pRxBlk, FromWhichBSSID); @@ -1624,7 +1624,7 @@ VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd, /* V. Receive seq surpasses Win(lastseq + nMSDU). So refresh all reorder buffer */ /* */ else { - LONG WinStartSeq, TmpSeq; + long WinStartSeq, TmpSeq; TmpSeq = Sequence - (pBAEntry->BAWinSize) - 1; if (TmpSeq < 0) { diff --git a/drivers/staging/rt2860/common/cmm_aes.c b/drivers/staging/rt2860/common/cmm_aes.c index 030678caf348..99b0b1bff468 100644 --- a/drivers/staging/rt2860/common/cmm_aes.c +++ b/drivers/staging/rt2860/common/cmm_aes.c @@ -38,8 +38,8 @@ #include "../rt_config.h" typedef struct { - UINT32 erk[64]; /* encryption round keys */ - UINT32 drk[64]; /* decryption round keys */ + u32 erk[64]; /* encryption round keys */ + u32 drk[64]; /* decryption round keys */ int nr; /* number of rounds */ } aes_context; @@ -47,7 +47,7 @@ typedef struct { /******** SBOX Table *********/ /*****************************/ -UCHAR SboxTable[256] = { +u8 SboxTable[256] = { 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, @@ -82,34 +82,34 @@ UCHAR SboxTable[256] = { 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 }; -VOID xor_32(IN PUCHAR a, IN PUCHAR b, OUT PUCHAR out) +void xor_32(u8 *a, u8 *b, u8 *out) { - INT i; + int i; for (i = 0; i < 4; i++) { out[i] = a[i] ^ b[i]; } } -VOID xor_128(IN PUCHAR a, IN PUCHAR b, OUT PUCHAR out) +void xor_128(u8 *a, u8 *b, u8 *out) { - INT i; + int i; for (i = 0; i < 16; i++) { out[i] = a[i] ^ b[i]; } } -UCHAR RTMPCkipSbox(IN UCHAR a) +u8 RTMPCkipSbox(u8 a) { return SboxTable[(int)a]; } -VOID next_key(IN PUCHAR key, IN INT round) +void next_key(u8 *key, int round) { - UCHAR rcon; - UCHAR sbox_key[4]; - UCHAR rcon_table[12] = { + u8 rcon; + u8 sbox_key[4]; + u8 rcon_table[12] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x36, 0x36 }; @@ -129,9 +129,9 @@ VOID next_key(IN PUCHAR key, IN INT round) xor_32(&key[12], &key[8], &key[12]); } -VOID byte_sub(IN PUCHAR in, OUT PUCHAR out) +void byte_sub(u8 *in, u8 *out) { - INT i; + int i; for (i = 0; i < 16; i++) { out[i] = RTMPCkipSbox(in[i]); @@ -151,7 +151,7 @@ void bitwise_xor(unsigned char *ina, unsigned char *inb, unsigned char *out) } } -VOID shift_row(IN PUCHAR in, OUT PUCHAR out) +void shift_row(u8 *in, u8 *out) { out[0] = in[0]; out[1] = in[5]; @@ -171,17 +171,17 @@ VOID shift_row(IN PUCHAR in, OUT PUCHAR out) out[15] = in[11]; } -VOID mix_column(IN PUCHAR in, OUT PUCHAR out) +void mix_column(u8 *in, u8 *out) { - INT i; - UCHAR add1b[4]; - UCHAR add1bf7[4]; - UCHAR rotl[4]; - UCHAR swap_halfs[4]; - UCHAR andf7[4]; - UCHAR rotr[4]; - UCHAR temp[4]; - UCHAR tempb[4]; + int i; + u8 add1b[4]; + u8 add1bf7[4]; + u8 rotl[4]; + u8 swap_halfs[4]; + u8 andf7[4]; + u8 rotr[4]; + u8 temp[4]; + u8 tempb[4]; for (i = 0; i < 4; i++) { if ((in[i] & 0x80) == 0x80) @@ -409,40 +409,40 @@ void construct_ctr_preload(unsigned char *ctr_preload, } BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, IN PCIPHER_KEY pWpaKey) + u8 *pData, + unsigned long DataByteCnt, IN PCIPHER_KEY pWpaKey) { - UCHAR KeyID; - UINT HeaderLen; - UCHAR PN[6]; - UINT payload_len; - UINT num_blocks; - UINT payload_remainder; - USHORT fc; - UCHAR fc0; - UCHAR fc1; - UINT frame_type; - UINT frame_subtype; - UINT from_ds; - UINT to_ds; - INT a4_exists; - INT qc_exists; - UCHAR aes_out[16]; + u8 KeyID; + u32 HeaderLen; + u8 PN[6]; + u32 payload_len; + u32 num_blocks; + u32 payload_remainder; + u16 fc; + u8 fc0; + u8 fc1; + u32 frame_type; + u32 frame_subtype; + u32 from_ds; + u32 to_ds; + int a4_exists; + int qc_exists; + u8 aes_out[16]; int payload_index; - UINT i; - UCHAR ctr_preload[16]; - UCHAR chain_buffer[16]; - UCHAR padded_buffer[16]; - UCHAR mic_iv[16]; - UCHAR mic_header1[16]; - UCHAR mic_header2[16]; - UCHAR MIC[8]; - UCHAR TrailMIC[8]; + u32 i; + u8 ctr_preload[16]; + u8 chain_buffer[16]; + u8 padded_buffer[16]; + u8 mic_iv[16]; + u8 mic_header1[16]; + u8 mic_header2[16]; + u8 MIC[8]; + u8 TrailMIC[8]; fc0 = *pData; fc1 = *(pData + 1); - fc = *((PUSHORT) pData); + fc = *((u16 *)pData); frame_type = ((fc0 >> 2) & 0x03); frame_subtype = ((fc0 >> 4) & 0x0f); @@ -460,7 +460,7 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, if (a4_exists) HeaderLen += 6; - KeyID = *((PUCHAR) (pData + HeaderLen + 3)); + KeyID = *((u8 *)(pData + HeaderLen + 3)); KeyID = KeyID >> 6; if (pWpaKey[KeyID].KeyLen == 0) { @@ -1202,16 +1202,16 @@ void rt_aes_decrypt(aes_context * ctx, uint8 input[16], uint8 output[16]) Return: ========================================================================== */ -VOID AES_GTK_KEY_WRAP(IN UCHAR * key, - IN UCHAR * plaintext, - IN UINT32 p_len, OUT UCHAR * ciphertext) +void AES_GTK_KEY_WRAP(u8 * key, + u8 * plaintext, + u32 p_len, u8 * ciphertext) { - UCHAR A[8], BIN[16], BOUT[16]; - UCHAR R[512]; - INT num_blocks = p_len / 8; /* unit:64bits */ - INT i, j; + u8 A[8], BIN[16], BOUT[16]; + u8 R[512]; + int num_blocks = p_len / 8; /* unit:64bits */ + int i, j; aes_context aesctx; - UCHAR xor; + u8 xor; rt_aes_set_key(&aesctx, key, 128); @@ -1264,18 +1264,18 @@ VOID AES_GTK_KEY_WRAP(IN UCHAR * key, ======================================================================== */ -VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key, - OUT UCHAR * plaintext, - IN UINT32 c_len, IN UCHAR * ciphertext) +void AES_GTK_KEY_UNWRAP(u8 * key, + u8 * plaintext, + u32 c_len, u8 * ciphertext) { - UCHAR A[8], BIN[16], BOUT[16]; - UCHAR xor; - INT i, j; + u8 A[8], BIN[16], BOUT[16]; + u8 xor; + int i, j; aes_context aesctx; - UCHAR *R; - INT num_blocks = c_len / 8; /* unit:64bits */ + u8 *R; + int num_blocks = c_len / 8; /* unit:64bits */ - os_alloc_mem(NULL, (PUCHAR *) & R, 512); + os_alloc_mem(NULL, (u8 **) & R, 512); if (R == NULL) { DBGPRINT(RT_DEBUG_ERROR, diff --git a/drivers/staging/rt2860/common/cmm_asic.c b/drivers/staging/rt2860/common/cmm_asic.c index 468aba574f46..ef7d2a6c58d5 100644 --- a/drivers/staging/rt2860/common/cmm_asic.c +++ b/drivers/staging/rt2860/common/cmm_asic.c @@ -177,7 +177,7 @@ RTMP_RF_REGS RF2850RegTable[] = { /* still lack of MMAC(Japan) ch 34,38,42,46 */ }; -UCHAR NUM_OF_2850_CHNL = (sizeof(RF2850RegTable) / sizeof(RTMP_RF_REGS)); +u8 NUM_OF_2850_CHNL = (sizeof(RF2850RegTable) / sizeof(RTMP_RF_REGS)); FREQUENCY_ITEM FreqItems3020[] = { /**************************************************/ @@ -216,11 +216,11 @@ FREQUENCY_ITEM FreqItems3020[] = { , }; -UCHAR NUM_OF_3020_CHNL = (sizeof(FreqItems3020) / sizeof(FREQUENCY_ITEM)); +u8 NUM_OF_3020_CHNL = (sizeof(FreqItems3020) / sizeof(FREQUENCY_ITEM)); -VOID AsicUpdateAutoFallBackTable(IN PRTMP_ADAPTER pAd, IN PUCHAR pRateTable) +void AsicUpdateAutoFallBackTable(IN PRTMP_ADAPTER pAd, u8 *pRateTable) { - UCHAR i; + u8 i; HT_FBK_CFG0_STRUC HtCfg0; HT_FBK_CFG1_STRUC HtCfg1; LG_FBK_CFG0_STRUC LgCfg0; @@ -234,7 +234,7 @@ VOID AsicUpdateAutoFallBackTable(IN PRTMP_ADAPTER pAd, IN PUCHAR pRateTable) LgCfg1.word = 0x00002100; pNextTxRate = (PRTMP_TX_RATE_SWITCH) pRateTable + 1; - for (i = 1; i < *((PUCHAR) pRateTable); i++) { + for (i = 1; i < *((u8 *)pRateTable); i++) { pCurrTxRate = (PRTMP_TX_RATE_SWITCH) pRateTable + 1 + i; switch (pCurrTxRate->Mode) { case 0: /*CCK */ @@ -417,16 +417,16 @@ VOID AsicUpdateAutoFallBackTable(IN PRTMP_ADAPTER pAd, IN PUCHAR pRateTable) we should choose not to use GF. But still set correct ASIC registers. ======================================================================== */ -VOID AsicUpdateProtect(IN PRTMP_ADAPTER pAd, - IN USHORT OperationMode, - IN UCHAR SetMask, +void AsicUpdateProtect(IN PRTMP_ADAPTER pAd, + u16 OperationMode, + u8 SetMask, IN BOOLEAN bDisableBGProtect, IN BOOLEAN bNonGFExist) { PROT_CFG_STRUC ProtCfg, ProtCfg4; - UINT32 Protect[6]; - USHORT offset; - UCHAR i; - UINT32 MacReg = 0; + u32 Protect[6]; + u16 offset; + u8 i; + u32 MacReg = 0; if (!(pAd->CommonCfg.bHTProtect) && (OperationMode != 8)) { return; @@ -631,14 +631,14 @@ VOID AsicUpdateProtect(IN PRTMP_ADAPTER pAd, ========================================================================== */ -VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) +void AsicSwitchChannel(IN PRTMP_ADAPTER pAd, u8 Channel, IN BOOLEAN bScan) { - ULONG R2 = 0, R3 = DEFAULT_RF_TX_POWER, R4 = 0; - CHAR TxPwer = 0, TxPwer2 = DEFAULT_RF_TX_POWER; /*Bbp94 = BBPR94_DEFAULT, TxPwer2 = DEFAULT_RF_TX_POWER; */ - UCHAR index; - UINT32 Value = 0; /*BbpReg, Value; */ + unsigned long R2 = 0, R3 = DEFAULT_RF_TX_POWER, R4 = 0; + char TxPwer = 0, TxPwer2 = DEFAULT_RF_TX_POWER; /*Bbp94 = BBPR94_DEFAULT, TxPwer2 = DEFAULT_RF_TX_POWER; */ + u8 index; + u32 Value = 0; /*BbpReg, Value; */ RTMP_RF_REGS *RFRegTable; - UCHAR RFValue; + u8 RFValue; RFValue = 0; /* Search Tx power value */ @@ -891,7 +891,7 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) /* Change BBP setting during siwtch from a->g, g->a */ if (Channel <= 14) { - ULONG TxPinCfg = 0x00050F0A; /*Gary 2007/08/09 0x050A0A */ + unsigned long TxPinCfg = 0x00050F0A; /*Gary 2007/08/09 0x050A0A */ RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R62, (0x37 - GET_LNA_GAIN(pAd))); @@ -951,7 +951,7 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) } #endif } else { - ULONG TxPinCfg = 0x00050F05; /*Gary 2007/8/9 0x050505 */ + unsigned long TxPinCfg = 0x00050F05; /*Gary 2007/8/9 0x050505 */ RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R62, (0x37 - GET_LNA_GAIN(pAd))); @@ -1002,7 +1002,7 @@ VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel, IN BOOLEAN bScan) RTMPusecDelay(1000); } -VOID AsicResetBBPAgent(IN PRTMP_ADAPTER pAd) +void AsicResetBBPAgent(IN PRTMP_ADAPTER pAd) { BBP_CSR_CFG_STRUC BbpCsr; DBGPRINT(RT_DEBUG_ERROR, ("Reset BBP Agent busy bit.!! \n")); @@ -1025,13 +1025,13 @@ VOID AsicResetBBPAgent(IN PRTMP_ADAPTER pAd) ========================================================================== */ -VOID AsicLockChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel) +void AsicLockChannel(IN PRTMP_ADAPTER pAd, u8 Channel) { } -VOID AsicRfTuningExec(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) +void AsicRfTuningExec(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3) { } @@ -1052,17 +1052,17 @@ VOID AsicRfTuningExec(IN PVOID SystemSpecific1, it should be called AFTER MlmeDynamicTxRatSwitching() ========================================================================== */ -VOID AsicAdjustTxPower(IN PRTMP_ADAPTER pAd) +void AsicAdjustTxPower(IN PRTMP_ADAPTER pAd) { - INT i, j; - CHAR DeltaPwr = 0; + int i, j; + char DeltaPwr = 0; BOOLEAN bAutoTxAgc = FALSE; - UCHAR TssiRef, *pTssiMinusBoundary, *pTssiPlusBoundary, TxAgcStep; - UCHAR BbpR1 = 0, BbpR49 = 0, idx; - PCHAR pTxAgcCompensate; - ULONG TxPwr[5]; - CHAR Value; - CHAR Rssi = -127; + u8 TssiRef, *pTssiMinusBoundary, *pTssiPlusBoundary, TxAgcStep; + u8 BbpR1 = 0, BbpR49 = 0, idx; + char *pTxAgcCompensate; + unsigned long TxPwr[5]; + char Value; + char Rssi = -127; if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) || #ifdef RTMP_MAC_PCI @@ -1152,10 +1152,10 @@ VOID AsicAdjustTxPower(IN PRTMP_ADAPTER pAd) break; } /* The index is the step we should decrease, idx = 0 means there is nothing to compensate */ -/* if (R3 > (ULONG) (TxAgcStep * (idx-1))) */ +/* if (R3 > (unsigned long)(TxAgcStep * (idx-1))) */ *pTxAgcCompensate = -(TxAgcStep * (idx - 1)); /* else */ -/* *pTxAgcCompensate = -((UCHAR)R3); */ +/* *pTxAgcCompensate = -((u8)R3); */ DeltaPwr += (*pTxAgcCompensate); DBGPRINT(RT_DEBUG_TRACE, @@ -1236,7 +1236,7 @@ VOID AsicAdjustTxPower(IN PRTMP_ADAPTER pAd) for (i = 0; i < 5; i++) { if (TxPwr[i] != 0xffffffff) { for (j = 0; j < 8; j++) { - Value = (CHAR) ((TxPwr[i] >> j * 4) & 0x0F); /* 0 ~ 15 */ + Value = (char)((TxPwr[i] >> j * 4) & 0x0F); /* 0 ~ 15 */ if ((Value + DeltaPwr) < 0) { Value = 0; /* min */ @@ -1277,8 +1277,8 @@ VOID AsicAdjustTxPower(IN PRTMP_ADAPTER pAd) ========================================================================== */ -VOID AsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp) +void AsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, + u16 TbttNumToNextWakeUp) { RTMP_STA_SLEEP_THEN_AUTO_WAKEUP(pAd, TbttNumToNextWakeUp); } @@ -1291,7 +1291,7 @@ VOID AsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, in INFRA BSS, we should use AsicSleepThenAutoWakeup() instead. ========================================================================== */ -VOID AsicForceSleep(IN PRTMP_ADAPTER pAd) +void AsicForceSleep(IN PRTMP_ADAPTER pAd) { } @@ -1306,7 +1306,7 @@ VOID AsicForceSleep(IN PRTMP_ADAPTER pAd) IRQL = DISPATCH_LEVEL ========================================================================== */ -VOID AsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) +void AsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) { DBGPRINT(RT_DEBUG_INFO, ("--> AsicForceWakeup \n")); RTMP_STA_FORCE_WAKEUP(pAd, bFromTx); @@ -1321,29 +1321,29 @@ VOID AsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) ========================================================================== */ -VOID AsicSetBssid(IN PRTMP_ADAPTER pAd, IN PUCHAR pBssid) +void AsicSetBssid(IN PRTMP_ADAPTER pAd, u8 *pBssid) { - ULONG Addr4; + unsigned long Addr4; DBGPRINT(RT_DEBUG_TRACE, ("==============> AsicSetBssid %x:%x:%x:%x:%x:%x\n", pBssid[0], pBssid[1], pBssid[2], pBssid[3], pBssid[4], pBssid[5])); - Addr4 = (ULONG) (pBssid[0]) | - (ULONG) (pBssid[1] << 8) | - (ULONG) (pBssid[2] << 16) | (ULONG) (pBssid[3] << 24); + Addr4 = (unsigned long)(pBssid[0]) | + (unsigned long)(pBssid[1] << 8) | + (unsigned long)(pBssid[2] << 16) | (unsigned long)(pBssid[3] << 24); RTMP_IO_WRITE32(pAd, MAC_BSSID_DW0, Addr4); Addr4 = 0; /* always one BSSID in STA mode */ - Addr4 = (ULONG) (pBssid[4]) | (ULONG) (pBssid[5] << 8); + Addr4 = (unsigned long)(pBssid[4]) | (unsigned long)(pBssid[5] << 8); RTMP_IO_WRITE32(pAd, MAC_BSSID_DW1, Addr4); } -VOID AsicSetMcastWC(IN PRTMP_ADAPTER pAd) +void AsicSetMcastWC(IN PRTMP_ADAPTER pAd) { MAC_TABLE_ENTRY *pEntry = &pAd->MacTab.Content[MCAST_WCID]; - USHORT offset; + u16 offset; pEntry->Sst = SST_ASSOC; pEntry->Aid = MCAST_WCID; /* Softap supports 1 BSSID and use WCID=0 as multicast Wcid index */ @@ -1360,10 +1360,10 @@ VOID AsicSetMcastWC(IN PRTMP_ADAPTER pAd) ========================================================================== */ -VOID AsicDelWcidTab(IN PRTMP_ADAPTER pAd, IN UCHAR Wcid) +void AsicDelWcidTab(IN PRTMP_ADAPTER pAd, u8 Wcid) { - ULONG Addr0 = 0x0, Addr1 = 0x0; - ULONG offset; + unsigned long Addr0 = 0x0, Addr1 = 0x0; + unsigned long offset; DBGPRINT(RT_DEBUG_TRACE, ("AsicDelWcidTab==>Wcid = 0x%x\n", Wcid)); offset = MAC_WCID_BASE + Wcid * HW_WCID_ENTRY_SIZE; @@ -1380,10 +1380,10 @@ VOID AsicDelWcidTab(IN PRTMP_ADAPTER pAd, IN UCHAR Wcid) ========================================================================== */ -VOID AsicEnableRDG(IN PRTMP_ADAPTER pAd) +void AsicEnableRDG(IN PRTMP_ADAPTER pAd) { TX_LINK_CFG_STRUC TxLinkCfg; - UINT32 Data = 0; + u32 Data = 0; RTMP_IO_READ32(pAd, TX_LINK_CFG, &TxLinkCfg.word); TxLinkCfg.field.TxRDGEn = 1; @@ -1405,10 +1405,10 @@ VOID AsicEnableRDG(IN PRTMP_ADAPTER pAd) ========================================================================== */ -VOID AsicDisableRDG(IN PRTMP_ADAPTER pAd) +void AsicDisableRDG(IN PRTMP_ADAPTER pAd) { TX_LINK_CFG_STRUC TxLinkCfg; - UINT32 Data = 0; + u32 Data = 0; RTMP_IO_READ32(pAd, TX_LINK_CFG, &TxLinkCfg.word); TxLinkCfg.field.TxRDGEn = 0; @@ -1441,7 +1441,7 @@ VOID AsicDisableRDG(IN PRTMP_ADAPTER pAd) ========================================================================== */ -VOID AsicDisableSync(IN PRTMP_ADAPTER pAd) +void AsicDisableSync(IN PRTMP_ADAPTER pAd) { BCN_TIME_CFG_STRUC csr; @@ -1468,7 +1468,7 @@ VOID AsicDisableSync(IN PRTMP_ADAPTER pAd) ========================================================================== */ -VOID AsicEnableBssSync(IN PRTMP_ADAPTER pAd) +void AsicEnableBssSync(IN PRTMP_ADAPTER pAd) { BCN_TIME_CFG_STRUC csr; @@ -1498,11 +1498,11 @@ VOID AsicEnableBssSync(IN PRTMP_ADAPTER pAd) ========================================================================== */ -VOID AsicEnableIbssSync(IN PRTMP_ADAPTER pAd) +void AsicEnableIbssSync(IN PRTMP_ADAPTER pAd) { BCN_TIME_CFG_STRUC csr9; - PUCHAR ptr; - UINT i; + u8 *ptr; + u32 i; DBGPRINT(RT_DEBUG_TRACE, ("--->AsicEnableIbssSync(ADHOC mode. MPDUtotalByteCount = %d)\n", @@ -1516,10 +1516,10 @@ VOID AsicEnableIbssSync(IN PRTMP_ADAPTER pAd) #ifdef RTMP_MAC_PCI /* move BEACON TXD and frame content to on-chip memory */ - ptr = (PUCHAR) & pAd->BeaconTxWI; + ptr = (u8 *)& pAd->BeaconTxWI; for (i = 0; i < TXWI_SIZE; i += 4) /* 16-byte TXWI field */ { - UINT32 longptr = + u32 longptr = *ptr + (*(ptr + 1) << 8) + (*(ptr + 2) << 16) + (*(ptr + 3) << 24); RTMP_IO_WRITE32(pAd, HW_BEACON_BASE0 + i, longptr); @@ -1529,7 +1529,7 @@ VOID AsicEnableIbssSync(IN PRTMP_ADAPTER pAd) /* start right after the 16-byte TXWI field */ ptr = pAd->BeaconBuf; for (i = 0; i < pAd->BeaconTxWI.MPDUtotalByteCount; i += 4) { - UINT32 longptr = + u32 longptr = *ptr + (*(ptr + 1) << 8) + (*(ptr + 2) << 16) + (*(ptr + 3) << 24); RTMP_IO_WRITE32(pAd, HW_BEACON_BASE0 + TXWI_SIZE + i, longptr); @@ -1538,10 +1538,10 @@ VOID AsicEnableIbssSync(IN PRTMP_ADAPTER pAd) #endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB /* move BEACON TXD and frame content to on-chip memory */ - ptr = (PUCHAR) & pAd->BeaconTxWI; + ptr = (u8 *)& pAd->BeaconTxWI; for (i = 0; i < TXWI_SIZE; i += 2) /* 16-byte TXWI field */ { - /*UINT32 longptr = *ptr + (*(ptr+1)<<8) + (*(ptr+2)<<16) + (*(ptr+3)<<24); */ + /*u32 longptr = *ptr + (*(ptr+1)<<8) + (*(ptr+2)<<16) + (*(ptr+3)<<24); */ /*RTMP_IO_WRITE32(pAd, HW_BEACON_BASE0 + i, longptr); */ RTUSBMultiWrite(pAd, HW_BEACON_BASE0 + i, ptr, 2); ptr += 2; @@ -1550,7 +1550,7 @@ VOID AsicEnableIbssSync(IN PRTMP_ADAPTER pAd) /* start right after the 16-byte TXWI field */ ptr = pAd->BeaconBuf; for (i = 0; i < pAd->BeaconTxWI.MPDUtotalByteCount; i += 2) { - /*UINT32 longptr = *ptr + (*(ptr+1)<<8) + (*(ptr+2)<<16) + (*(ptr+3)<<24); */ + /*u32 longptr = *ptr + (*(ptr+1)<<8) + (*(ptr+2)<<16) + (*(ptr+3)<<24); */ /*RTMP_IO_WRITE32(pAd, HW_BEACON_BASE0 + TXWI_SIZE + i, longptr); */ RTUSBMultiWrite(pAd, HW_BEACON_BASE0 + TXWI_SIZE + i, ptr, 2); ptr += 2; @@ -1581,7 +1581,7 @@ VOID AsicEnableIbssSync(IN PRTMP_ADAPTER pAd) ========================================================================== */ -VOID AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm) +void AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm) { EDCA_AC_CFG_STRUC Ac0Cfg, Ac1Cfg, Ac2Cfg, Ac3Cfg; AC_TXOP_CSR0_STRUC csr0; @@ -1862,10 +1862,10 @@ VOID AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm) ========================================================================== */ -VOID AsicSetSlotTime(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUseShortSlotTime) +void AsicSetSlotTime(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUseShortSlotTime) { - ULONG SlotTime; - UINT32 RegValue = 0; + unsigned long SlotTime; + u32 RegValue = 0; if (pAd->CommonCfg.Channel > 14) bUseShortSlotTime = TRUE; @@ -1930,16 +1930,16 @@ VOID AsicSetSlotTime(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUseShortSlotTime) Return: ======================================================================== */ -VOID AsicAddSharedKeyEntry(IN PRTMP_ADAPTER pAd, - IN UCHAR BssIndex, - IN UCHAR KeyIdx, - IN UCHAR CipherAlg, - IN PUCHAR pKey, IN PUCHAR pTxMic, IN PUCHAR pRxMic) +void AsicAddSharedKeyEntry(IN PRTMP_ADAPTER pAd, + u8 BssIndex, + u8 KeyIdx, + u8 CipherAlg, + u8 *pKey, u8 *pTxMic, u8 *pRxMic) { - ULONG offset; /*, csr0; */ + unsigned long offset; /*, csr0; */ SHAREDKEY_MODE_STRUC csr1; #ifdef RTMP_MAC_PCI - INT i; + int i; #endif /* RTMP_MAC_PCI // */ DBGPRINT(RT_DEBUG_TRACE, @@ -2048,10 +2048,10 @@ VOID AsicAddSharedKeyEntry(IN PRTMP_ADAPTER pAd, } /* IRQL = DISPATCH_LEVEL */ -VOID AsicRemoveSharedKeyEntry(IN PRTMP_ADAPTER pAd, - IN UCHAR BssIndex, IN UCHAR KeyIdx) +void AsicRemoveSharedKeyEntry(IN PRTMP_ADAPTER pAd, + u8 BssIndex, u8 KeyIdx) { - /*ULONG SecCsr0; */ + /*unsigned long SecCsr0; */ SHAREDKEY_MODE_STRUC csr1; DBGPRINT(RT_DEBUG_TRACE, @@ -2088,13 +2088,13 @@ VOID AsicRemoveSharedKeyEntry(IN PRTMP_ADAPTER pAd, } -VOID AsicUpdateWCIDAttribute(IN PRTMP_ADAPTER pAd, - IN USHORT WCID, - IN UCHAR BssIndex, - IN UCHAR CipherAlg, +void AsicUpdateWCIDAttribute(IN PRTMP_ADAPTER pAd, + u16 WCID, + u8 BssIndex, + u8 CipherAlg, IN BOOLEAN bUsePairewiseKeyTable) { - ULONG WCIDAttri = 0, offset; + unsigned long WCIDAttri = 0, offset; /* */ /* Update WCID attribute. */ @@ -2106,10 +2106,10 @@ VOID AsicUpdateWCIDAttribute(IN PRTMP_ADAPTER pAd, RTMP_IO_WRITE32(pAd, offset, WCIDAttri); } -VOID AsicUpdateWCIDIVEIV(IN PRTMP_ADAPTER pAd, - IN USHORT WCID, IN ULONG uIV, IN ULONG uEIV) +void AsicUpdateWCIDIVEIV(IN PRTMP_ADAPTER pAd, + u16 WCID, unsigned long uIV, unsigned long uEIV) { - ULONG offset; + unsigned long offset; offset = MAC_IVEIV_TABLE_BASE + (WCID * HW_IVEIV_ENTRY_SIZE); @@ -2117,11 +2117,11 @@ VOID AsicUpdateWCIDIVEIV(IN PRTMP_ADAPTER pAd, RTMP_IO_WRITE32(pAd, offset + 4, uEIV); } -VOID AsicUpdateRxWCIDTable(IN PRTMP_ADAPTER pAd, - IN USHORT WCID, IN PUCHAR pAddr) +void AsicUpdateRxWCIDTable(IN PRTMP_ADAPTER pAd, + u16 WCID, u8 *pAddr) { - ULONG offset; - ULONG Addr; + unsigned long offset; + unsigned long Addr; offset = MAC_WCID_BASE + (WCID * HW_WCID_ENTRY_SIZE); Addr = pAddr[0] + (pAddr[1] << 8) + (pAddr[2] << 16) + (pAddr[3] << 24); @@ -2163,25 +2163,25 @@ VOID AsicUpdateRxWCIDTable(IN PRTMP_ADAPTER pAd, For AP mode bTxKey must be always set to TRUE. ======================================================================== */ -VOID AsicAddKeyEntry(IN PRTMP_ADAPTER pAd, - IN USHORT WCID, - IN UCHAR BssIndex, - IN UCHAR KeyIdx, +void AsicAddKeyEntry(IN PRTMP_ADAPTER pAd, + u16 WCID, + u8 BssIndex, + u8 KeyIdx, IN PCIPHER_KEY pCipherKey, IN BOOLEAN bUsePairewiseKeyTable, IN BOOLEAN bTxKey) { - ULONG offset; -/* ULONG WCIDAttri = 0; */ - UCHAR IV4 = 0; - PUCHAR pKey = pCipherKey->Key; -/* ULONG KeyLen = pCipherKey->KeyLen; */ - PUCHAR pTxMic = pCipherKey->TxMic; - PUCHAR pRxMic = pCipherKey->RxMic; - PUCHAR pTxtsc = pCipherKey->TxTsc; - UCHAR CipherAlg = pCipherKey->CipherAlg; + unsigned long offset; +/* unsigned long WCIDAttri = 0; */ + u8 IV4 = 0; + u8 *pKey = pCipherKey->Key; +/* unsigned long KeyLen = pCipherKey->KeyLen; */ + u8 *pTxMic = pCipherKey->TxMic; + u8 *pRxMic = pCipherKey->RxMic; + u8 *pTxtsc = pCipherKey->TxTsc; + u8 CipherAlg = pCipherKey->CipherAlg; SHAREDKEY_MODE_STRUC csr1; #ifdef RTMP_MAC_PCI - UCHAR i; + u8 i; #endif /* RTMP_MAC_PCI // */ /* ASSERT(KeyLen <= MAX_LEN_OF_PEER_KEY); */ @@ -2271,7 +2271,7 @@ VOID AsicAddKeyEntry(IN PRTMP_ADAPTER pAd, } #endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB - UINT32 tmpVal; + u32 tmpVal; /* */ /* Write IV */ @@ -2291,7 +2291,7 @@ VOID AsicAddKeyEntry(IN PRTMP_ADAPTER pAd, /* Write EIV */ /* */ offset += 4; - RTMP_IO_WRITE32(pAd, offset, *(PUINT32) & pCipherKey->TxTsc[2]); + RTMP_IO_WRITE32(pAd, offset, *(u32 *)& pCipherKey->TxTsc[2]); #endif /* RTMP_MAC_USB // */ AsicUpdateWCIDAttribute(pAd, WCID, BssIndex, CipherAlg, @@ -2339,17 +2339,17 @@ VOID AsicAddKeyEntry(IN PRTMP_ADAPTER pAd, Return: ======================================================================== */ -VOID AsicAddPairwiseKeyEntry(IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR WCID, IN CIPHER_KEY * pCipherKey) +void AsicAddPairwiseKeyEntry(IN PRTMP_ADAPTER pAd, + u8 *pAddr, + u8 WCID, IN CIPHER_KEY * pCipherKey) { - INT i; - ULONG offset; - PUCHAR pKey = pCipherKey->Key; - PUCHAR pTxMic = pCipherKey->TxMic; - PUCHAR pRxMic = pCipherKey->RxMic; + int i; + unsigned long offset; + u8 *pKey = pCipherKey->Key; + u8 *pTxMic = pCipherKey->TxMic; + u8 *pRxMic = pCipherKey->RxMic; #ifdef DBG - UCHAR CipherAlg = pCipherKey->CipherAlg; + u8 CipherAlg = pCipherKey->CipherAlg; #endif /* DBG // */ /* EKEY */ @@ -2363,7 +2363,7 @@ VOID AsicAddPairwiseKeyEntry(IN PRTMP_ADAPTER pAd, RTUSBMultiWrite(pAd, offset, &pCipherKey->Key[0], MAX_LEN_OF_PEER_KEY); #endif /* RTMP_MAC_USB // */ for (i = 0; i < MAX_LEN_OF_PEER_KEY; i += 4) { - UINT32 Value; + u32 Value; RTMP_IO_READ32(pAd, offset + i, &Value); } @@ -2422,11 +2422,11 @@ VOID AsicAddPairwiseKeyEntry(IN PRTMP_ADAPTER pAd, Return: ======================================================================== */ -VOID AsicRemovePairwiseKeyEntry(IN PRTMP_ADAPTER pAd, - IN UCHAR BssIdx, IN UCHAR Wcid) +void AsicRemovePairwiseKeyEntry(IN PRTMP_ADAPTER pAd, + u8 BssIdx, u8 Wcid) { - ULONG WCIDAttri; - USHORT offset; + unsigned long WCIDAttri; + u16 offset; /* re-set the entry's WCID attribute as OPEN-NONE. */ offset = MAC_WCID_ATTRIBUTE_BASE + (Wcid * HW_WCID_ATTRI_SIZE); @@ -2435,8 +2435,8 @@ VOID AsicRemovePairwiseKeyEntry(IN PRTMP_ADAPTER pAd, } BOOLEAN AsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, - IN UCHAR Command, - IN UCHAR Token, IN UCHAR Arg0, IN UCHAR Arg1) + u8 Command, + u8 Token, u8 Arg0, u8 Arg1) { if (pAd->chipOps.sendCommandToMcu) @@ -2445,7 +2445,7 @@ BOOLEAN AsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, return TRUE; } -VOID AsicSetRxAnt(IN PRTMP_ADAPTER pAd, IN UCHAR Ant) +void AsicSetRxAnt(IN PRTMP_ADAPTER pAd, u8 Ant) { #ifdef RT30xx /* RT3572 ATE need not to do this. */ @@ -2453,14 +2453,14 @@ VOID AsicSetRxAnt(IN PRTMP_ADAPTER pAd, IN UCHAR Ant) #endif /* RT30xx // */ } -VOID AsicTurnOffRFClk(IN PRTMP_ADAPTER pAd, IN UCHAR Channel) +void AsicTurnOffRFClk(IN PRTMP_ADAPTER pAd, u8 Channel) { if (pAd->chipOps.AsicRfTurnOff) { pAd->chipOps.AsicRfTurnOff(pAd); } else { /* RF R2 bit 18 = 0 */ - UINT32 R1 = 0, R2 = 0, R3 = 0; - UCHAR index; + u32 R1 = 0, R2 = 0, R3 = 0; + u8 index; RTMP_RF_REGS *RFRegTable; RFRegTable = RF2850RegTable; @@ -2507,11 +2507,11 @@ VOID AsicTurnOffRFClk(IN PRTMP_ADAPTER pAd, IN UCHAR Channel) } } -VOID AsicTurnOnRFClk(IN PRTMP_ADAPTER pAd, IN UCHAR Channel) +void AsicTurnOnRFClk(IN PRTMP_ADAPTER pAd, u8 Channel) { /* RF R2 bit 18 = 0 */ - UINT32 R1 = 0, R2 = 0, R3 = 0; - UCHAR index; + u32 R1 = 0, R2 = 0, R3 = 0; + u8 index; RTMP_RF_REGS *RFRegTable; #ifdef PCIE_PS_SUPPORT diff --git a/drivers/staging/rt2860/common/cmm_cfg.c b/drivers/staging/rt2860/common/cmm_cfg.c index 7dbcb2300a28..9c6b7cacb089 100644 --- a/drivers/staging/rt2860/common/cmm_cfg.c +++ b/drivers/staging/rt2860/common/cmm_cfg.c @@ -80,10 +80,10 @@ char *GetBW(int BW) TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -INT RT_CfgSetCountryRegion(IN PRTMP_ADAPTER pAd, IN PSTRING arg, IN INT band) +int RT_CfgSetCountryRegion(IN PRTMP_ADAPTER pAd, char *arg, int band) { - LONG region, regionMax; - UCHAR *pCountryRegion; + long region, regionMax; + u8 *pCountryRegion; region = simple_strtol(arg, 0, 10); @@ -104,9 +104,9 @@ INT RT_CfgSetCountryRegion(IN PRTMP_ADAPTER pAd, IN PSTRING arg, IN INT band) } if ((region >= 0) && (region <= REGION_MAXIMUM_BG_BAND)) { - *pCountryRegion = (UCHAR) region; + *pCountryRegion = (u8)region; } else if ((region == REGION_31_BG_BAND) && (band == BAND_24G)) { - *pCountryRegion = (UCHAR) region; + *pCountryRegion = (u8)region; } else { DBGPRINT(RT_DEBUG_ERROR, ("CfgSetCountryRegion():region(%ld) out of range!\n", @@ -126,10 +126,10 @@ INT RT_CfgSetCountryRegion(IN PRTMP_ADAPTER pAd, IN PSTRING arg, IN INT band) TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -INT RT_CfgSetWirelessMode(IN PRTMP_ADAPTER pAd, IN PSTRING arg) +int RT_CfgSetWirelessMode(IN PRTMP_ADAPTER pAd, char *arg) { - INT MaxPhyMode = PHY_11G; - LONG WirelessMode; + int MaxPhyMode = PHY_11G; + long WirelessMode; MaxPhyMode = PHY_11N_5G; @@ -143,9 +143,9 @@ INT RT_CfgSetWirelessMode(IN PRTMP_ADAPTER pAd, IN PSTRING arg) } -INT RT_CfgSetShortSlot(IN PRTMP_ADAPTER pAd, IN PSTRING arg) +int RT_CfgSetShortSlot(IN PRTMP_ADAPTER pAd, char *arg) { - LONG ShortSlot; + long ShortSlot; ShortSlot = simple_strtol(arg, 0, 10); @@ -167,13 +167,13 @@ INT RT_CfgSetShortSlot(IN PRTMP_ADAPTER pAd, IN PSTRING arg) TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -INT RT_CfgSetWepKey(IN PRTMP_ADAPTER pAd, - IN PSTRING keyString, - IN CIPHER_KEY * pSharedKey, IN INT keyIdx) +int RT_CfgSetWepKey(IN PRTMP_ADAPTER pAd, + char *keyString, + IN CIPHER_KEY * pSharedKey, int keyIdx) { - INT KeyLen; - INT i; - UCHAR CipherAlg = CIPHER_NONE; + int KeyLen; + int i; + u8 CipherAlg = CIPHER_NONE; BOOLEAN bKeyIsHex = FALSE; /* TODO: Shall we do memset for the original key info?? */ @@ -230,13 +230,13 @@ INT RT_CfgSetWepKey(IN PRTMP_ADAPTER pAd, TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -INT RT_CfgSetWPAPSKKey(IN RTMP_ADAPTER * pAd, - IN PSTRING keyString, - IN UCHAR * pHashStr, - IN INT hashStrLen, OUT PUCHAR pPMKBuf) +int RT_CfgSetWPAPSKKey(IN RTMP_ADAPTER * pAd, + char *keyString, + u8 * pHashStr, + int hashStrLen, u8 *pPMKBuf) { int keyLen; - UCHAR keyMaterial[40]; + u8 keyMaterial[40]; keyLen = strlen(keyString); if ((keyLen < 8) || (keyLen > 64)) { diff --git a/drivers/staging/rt2860/common/cmm_data.c b/drivers/staging/rt2860/common/cmm_data.c index 81766db533ec..cd000fb2be93 100644 --- a/drivers/staging/rt2860/common/cmm_data.c +++ b/drivers/staging/rt2860/common/cmm_data.c @@ -27,39 +27,39 @@ #include "../rt_config.h" -UCHAR SNAP_802_1H[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; -UCHAR SNAP_BRIDGE_TUNNEL[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; +u8 SNAP_802_1H[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; +u8 SNAP_BRIDGE_TUNNEL[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; /* Add Cisco Aironet SNAP heade for CCX2 support */ -UCHAR SNAP_AIRONET[] = { 0xaa, 0xaa, 0x03, 0x00, 0x40, 0x96, 0x00, 0x00 }; -UCHAR CKIP_LLC_SNAP[] = { 0xaa, 0xaa, 0x03, 0x00, 0x40, 0x96, 0x00, 0x02 }; -UCHAR EAPOL_LLC_SNAP[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8e }; -UCHAR EAPOL[] = { 0x88, 0x8e }; -UCHAR TPID[] = { 0x81, 0x00 }; /* VLAN related */ +u8 SNAP_AIRONET[] = { 0xaa, 0xaa, 0x03, 0x00, 0x40, 0x96, 0x00, 0x00 }; +u8 CKIP_LLC_SNAP[] = { 0xaa, 0xaa, 0x03, 0x00, 0x40, 0x96, 0x00, 0x02 }; +u8 EAPOL_LLC_SNAP[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8e }; +u8 EAPOL[] = { 0x88, 0x8e }; +u8 TPID[] = { 0x81, 0x00 }; /* VLAN related */ -UCHAR IPX[] = { 0x81, 0x37 }; -UCHAR APPLE_TALK[] = { 0x80, 0xf3 }; +u8 IPX[] = { 0x81, 0x37 }; +u8 APPLE_TALK[] = { 0x80, 0xf3 }; -UCHAR RateIdToPlcpSignal[12] = { +u8 RateIdToPlcpSignal[12] = { 0, /* RATE_1 */ 1, /* RATE_2 */ 2, /* RATE_5_5 */ 3, /* RATE_11 *//* see BBP spec */ 11, /* RATE_6 */ 15, /* RATE_9 */ 10, /* RATE_12 */ 14, /* RATE_18 *//* see IEEE802.11a-1999 p.14 */ 9, /* RATE_24 */ 13, /* RATE_36 */ 8, /* RATE_48 */ 12 /* RATE_54 */ }; /* see IEEE802.11a-1999 p.14 */ -UCHAR OfdmSignalToRateId[16] = { +u8 OfdmSignalToRateId[16] = { RATE_54, RATE_54, RATE_54, RATE_54, /* OFDM PLCP Signal = 0, 1, 2, 3 respectively */ RATE_54, RATE_54, RATE_54, RATE_54, /* OFDM PLCP Signal = 4, 5, 6, 7 respectively */ RATE_48, RATE_24, RATE_12, RATE_6, /* OFDM PLCP Signal = 8, 9, 10, 11 respectively */ RATE_54, RATE_36, RATE_18, RATE_9, /* OFDM PLCP Signal = 12, 13, 14, 15 respectively */ }; -UCHAR OfdmRateToRxwiMCS[12] = { +u8 OfdmRateToRxwiMCS[12] = { 0, 0, 0, 0, 0, 1, 2, 3, /* OFDM rate 6,9,12,18 = rxwi mcs 0,1,2,3 */ 4, 5, 6, 7, /* OFDM rate 24,36,48,54 = rxwi mcs 4,5,6,7 */ }; -UCHAR RxwiMCSToOfdmRate[12] = { +u8 RxwiMCSToOfdmRate[12] = { RATE_6, RATE_9, RATE_12, RATE_18, RATE_24, RATE_36, RATE_48, RATE_54, /* OFDM rate 6,9,12,18 = rxwi mcs 0,1,2,3 */ 4, 5, 6, 7, /* OFDM rate 24,36,48,54 = rxwi mcs 4,5,6,7 */ @@ -71,12 +71,12 @@ char *MCSToMbps[] = "MM-4", "MM-5", "MM-6", "MM-7", "MM-8", "MM-9", "MM-10", "MM-11", "MM-12", "MM-13", "MM-14", "MM-15", "MM-32", "ee1", "ee2", "ee3" }; -UCHAR default_cwmin[] = +u8 default_cwmin[] = { CW_MIN_IN_BITS, CW_MIN_IN_BITS, CW_MIN_IN_BITS - 1, CW_MIN_IN_BITS - 2 }; -/*UCHAR default_cwmax[]={CW_MAX_IN_BITS, CW_MAX_IN_BITS, CW_MIN_IN_BITS, CW_MIN_IN_BITS-1}; */ -UCHAR default_sta_aifsn[] = { 3, 7, 2, 2 }; +/*u8 default_cwmax[]={CW_MAX_IN_BITS, CW_MAX_IN_BITS, CW_MIN_IN_BITS, CW_MIN_IN_BITS-1}; */ +u8 default_sta_aifsn[] = { 3, 7, 2, 2 }; -UCHAR MapUserPriorityToAccessCategory[8] = +u8 MapUserPriorityToAccessCategory[8] = { QID_AC_BE, QID_AC_BK, QID_AC_BK, QID_AC_BE, QID_AC_VI, QID_AC_VI, QID_AC_VO, QID_AC_VO }; @@ -104,16 +104,16 @@ QID_AC_VO, QID_AC_VO }; ======================================================================== */ -NDIS_STATUS MiniportMMRequest(IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, IN PUCHAR pData, IN UINT Length) +int MiniportMMRequest(IN PRTMP_ADAPTER pAd, + u8 QueIdx, u8 *pData, u32 Length) { PNDIS_PACKET pPacket; - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - ULONG FreeNum; - UCHAR rtmpHwHdr[TXINFO_SIZE + TXWI_SIZE]; /*RTMP_HW_HDR_LEN]; */ + int Status = NDIS_STATUS_SUCCESS; + unsigned long FreeNum; + u8 rtmpHwHdr[TXINFO_SIZE + TXWI_SIZE]; /*RTMP_HW_HDR_LEN]; */ #ifdef RTMP_MAC_PCI unsigned long IrqFlags = 0; - UCHAR IrqState; + u8 IrqState; #endif /* RTMP_MAC_PCI // */ BOOLEAN bUseDataQ = FALSE; int retryCnt = 0; @@ -164,7 +164,7 @@ NDIS_STATUS MiniportMMRequest(IN PRTMP_ADAPTER pAd, NdisZeroMemory(&rtmpHwHdr, (TXINFO_SIZE + TXWI_SIZE)); Status = RTMPAllocateNdisPacket(pAd, &pPacket, - (PUCHAR) & rtmpHwHdr, + (u8 *)& rtmpHwHdr, (TXINFO_SIZE + TXWI_SIZE), pData, Length); if (Status != NDIS_STATUS_SUCCESS) { @@ -242,12 +242,12 @@ NDIS_STATUS MiniportMMRequest(IN PRTMP_ADAPTER pAd, ======================================================================== */ -NDIS_STATUS MlmeHardTransmit(IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, IN PNDIS_PACKET pPacket) +int MlmeHardTransmit(IN PRTMP_ADAPTER pAd, + u8 QueIdx, IN PNDIS_PACKET pPacket) { PACKET_INFO PacketInfo; - PUCHAR pSrcBufVA; - UINT SrcBufLen; + u8 *pSrcBufVA; + u32 SrcBufLen; PHEADER_802_11 pHeader_802_11; if ((pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) @@ -270,18 +270,18 @@ NDIS_STATUS MlmeHardTransmit(IN PRTMP_ADAPTER pAd, } -NDIS_STATUS MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, IN PNDIS_PACKET pPacket) +int MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, + u8 QueIdx, IN PNDIS_PACKET pPacket) { PACKET_INFO PacketInfo; - PUCHAR pSrcBufVA; - UINT SrcBufLen; + u8 *pSrcBufVA; + u32 SrcBufLen; PHEADER_802_11 pHeader_802_11; BOOLEAN bAckRequired, bInsertTimestamp; - UCHAR MlmeRate; + u8 MlmeRate; PTXWI_STRUC pFirstTxWI; MAC_TABLE_ENTRY *pMacEntry = NULL; - UCHAR PID; + u8 PID; RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); @@ -421,7 +421,7 @@ NDIS_STATUS MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, bInsertTimestamp, FALSE, bAckRequired, FALSE, 0, RESERVED_WCID, (SrcBufLen - TXINFO_SIZE - TXWI_SIZE), PID, 0, - (UCHAR) pAd->CommonCfg.MlmeTransmit.field.MCS, + (u8)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); } else { /* dont use low rate to send QoS Null data frame */ @@ -430,7 +430,7 @@ NDIS_STATUS MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, 0, pMacEntry->Aid, (SrcBufLen - TXINFO_SIZE - TXWI_SIZE), pMacEntry->MaxHTPhyMode.field.MCS, 0, - (UCHAR) pMacEntry->MaxHTPhyMode.field.MCS, + (u8)pMacEntry->MaxHTPhyMode.field.MCS, IFS_BACKOFF, FALSE, &pMacEntry->MaxHTPhyMode); } @@ -506,10 +506,10 @@ NDIS_STATUS MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, (2).Normal ======================================================================== */ -static UCHAR TxPktClassification(IN RTMP_ADAPTER * pAd, IN PNDIS_PACKET pPacket) +static u8 TxPktClassification(IN RTMP_ADAPTER * pAd, IN PNDIS_PACKET pPacket) { - UCHAR TxFrameType = TX_UNKOWN_FRAME; - UCHAR Wcid; + u8 TxFrameType = TX_UNKOWN_FRAME; + u8 Wcid; MAC_TABLE_ENTRY *pMacEntry = NULL; BOOLEAN bHTRate = FALSE; @@ -712,16 +712,16 @@ BOOLEAN CanDoAggregateTransmit(IN RTMP_ADAPTER * pAd, ======================================================================== */ -VOID RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, IN UCHAR QIdx, /* BulkOutPipeId */ - IN UCHAR Max_Tx_Packets) +void RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, u8 QIdx, /* BulkOutPipeId */ + u8 Max_Tx_Packets) { PQUEUE_ENTRY pEntry = NULL; PNDIS_PACKET pPacket; - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - UCHAR Count = 0; + int Status = NDIS_STATUS_SUCCESS; + u8 Count = 0; PQUEUE_HEADER pQueue; - ULONG FreeNumber[NUM_OF_TX_RING]; - UCHAR QueIdx, sQIdx, eQIdx; + unsigned long FreeNumber[NUM_OF_TX_RING]; + u8 QueIdx, sQIdx, eQIdx; unsigned long IrqFlags = 0; BOOLEAN hasTxDesc = FALSE; TX_BLK TxBlk; @@ -780,7 +780,7 @@ VOID RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, IN UCHAR QI } pTxBlk = &TxBlk; - NdisZeroMemory((PUCHAR) pTxBlk, sizeof(TX_BLK)); + NdisZeroMemory((u8 *)pTxBlk, sizeof(TX_BLK)); /*InitializeQueueHeader(&pTxBlk->TxPacketList); // Didn't need it because we already memzero it. */ pTxBlk->QueIdx = QueIdx; @@ -908,9 +908,9 @@ VOID RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, IN UCHAR QI ======================================================================== */ -USHORT RTMPCalcDuration(IN PRTMP_ADAPTER pAd, IN UCHAR Rate, IN ULONG Size) +u16 RTMPCalcDuration(IN PRTMP_ADAPTER pAd, u8 Rate, unsigned long Size) { - ULONG Duration = 0; + unsigned long Duration = 0; if (Rate < RATE_FIRST_OFDM_RATE) /* CCK */ { @@ -921,14 +921,14 @@ USHORT RTMPCalcDuration(IN PRTMP_ADAPTER pAd, IN UCHAR Rate, IN ULONG Size) else Duration = 192; /* 144+48 preamble+plcp */ - Duration += (USHORT) ((Size << 4) / RateIdTo500Kbps[Rate]); + Duration += (u16)((Size << 4) / RateIdTo500Kbps[Rate]); if ((Size << 4) % RateIdTo500Kbps[Rate]) Duration++; } else if (Rate <= RATE_LAST_OFDM_RATE) /* OFDM rates */ { Duration = 20 + 6; /* 16+4 preamble+plcp + Signal Extension */ Duration += - 4 * (USHORT) ((11 + Size * 4) / RateIdTo500Kbps[Rate]); + 4 * (u16)((11 + Size * 4) / RateIdTo500Kbps[Rate]); if ((11 + Size * 4) % RateIdTo500Kbps[Rate]) Duration += 4; } else /*mimo rate */ @@ -936,7 +936,7 @@ USHORT RTMPCalcDuration(IN PRTMP_ADAPTER pAd, IN UCHAR Rate, IN ULONG Size) Duration = 20 + 6; /* 16+4 preamble+plcp + Signal Extension */ } - return (USHORT) Duration; + return (u16)Duration; } /* @@ -968,14 +968,14 @@ USHORT RTMPCalcDuration(IN PRTMP_ADAPTER pAd, IN UCHAR Rate, IN ULONG Size) ======================================================================== */ -VOID RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pOutTxWI, IN BOOLEAN FRAG, IN BOOLEAN CFACK, IN BOOLEAN InsTimestamp, IN BOOLEAN AMPDU, IN BOOLEAN Ack, IN BOOLEAN NSeq, /* HW new a sequence. */ - IN UCHAR BASize, - IN UCHAR WCID, - IN ULONG Length, - IN UCHAR PID, - IN UCHAR TID, - IN UCHAR TxRate, - IN UCHAR Txopmode, +void RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pOutTxWI, IN BOOLEAN FRAG, IN BOOLEAN CFACK, IN BOOLEAN InsTimestamp, IN BOOLEAN AMPDU, IN BOOLEAN Ack, IN BOOLEAN NSeq, /* HW new a sequence. */ + u8 BASize, + u8 WCID, + unsigned long Length, + u8 PID, + u8 TID, + u8 TxRate, + u8 Txopmode, IN BOOLEAN CfAck, IN HTTRANSMIT_SETTING * pTransmit) { PMAC_TABLE_ENTRY pMac = NULL; @@ -1056,12 +1056,12 @@ VOID RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pOutTxWI, IN BOOLEAN FRA NdisMoveMemory(pOutTxWI, &TxWI, sizeof(TXWI_STRUC)); } -VOID RTMPWriteTxWI_Data(IN PRTMP_ADAPTER pAd, +void RTMPWriteTxWI_Data(IN PRTMP_ADAPTER pAd, IN OUT PTXWI_STRUC pTxWI, IN TX_BLK * pTxBlk) { HTTRANSMIT_SETTING *pTransmit; PMAC_TABLE_ENTRY pMacEntry; - UCHAR BASize; + u8 BASize; ASSERT(pTxWI); @@ -1093,7 +1093,7 @@ VOID RTMPWriteTxWI_Data(IN PRTMP_ADAPTER pAd, /* John tune the performace with Intel Client in 20 MHz performance */ BASize = pAd->CommonCfg.TxBASize; if ((pTxBlk->TxFrameType == TX_AMPDU_FRAME) && (pMacEntry)) { - UCHAR RABAOriIdx = 0; /*The RA's BA Originator table index. */ + u8 RABAOriIdx = 0; /*The RA's BA Originator table index. */ RABAOriIdx = pTxBlk->pMacEntry->BAOriWcidArray[pTxBlk->UserPriority]; @@ -1134,7 +1134,7 @@ VOID RTMPWriteTxWI_Data(IN PRTMP_ADAPTER pAd, pTxWI->PacketId = pTxWI->MCS; } -VOID RTMPWriteTxWI_Cache(IN PRTMP_ADAPTER pAd, +void RTMPWriteTxWI_Cache(IN PRTMP_ADAPTER pAd, IN OUT PTXWI_STRUC pTxWI, IN TX_BLK * pTxBlk) { PHTTRANSMIT_SETTING /*pTxHTPhyMode, */ pTransmit; @@ -1195,7 +1195,7 @@ VOID RTMPWriteTxWI_Cache(IN PRTMP_ADAPTER pAd, /* 3. Fragmentation not in used */ /* 4. either no previous frame (pPrevAddr1=NULL) .OR. previoud frame is aggregatible */ BOOLEAN TxFrameIsAggregatible(IN PRTMP_ADAPTER pAd, - IN PUCHAR pPrevAddr1, IN PUCHAR p8023hdr) + u8 *pPrevAddr1, u8 *p8023hdr) { /* can't aggregate EAPOL (802.1x) frame */ @@ -1231,9 +1231,9 @@ BOOLEAN TxFrameIsAggregatible(IN PRTMP_ADAPTER pAd, ======================================================================== */ BOOLEAN PeerIsAggreOn(IN PRTMP_ADAPTER pAd, - IN ULONG TxRate, IN PMAC_TABLE_ENTRY pMacEntry) + unsigned long TxRate, IN PMAC_TABLE_ENTRY pMacEntry) { - ULONG AFlags = + unsigned long AFlags = (fCLIENT_STATUS_AMSDU_INUSED | fCLIENT_STATUS_AGGREGATION_CAPABLE); if (pMacEntry != NULL && CLIENT_STATUS_TEST_FLAG(pMacEntry, AFlags)) { @@ -1269,10 +1269,10 @@ BOOLEAN PeerIsAggreOn(IN PRTMP_ADAPTER pAd, ======================================================================== */ -PQUEUE_HEADER RTMPCheckTxSwQueue(IN PRTMP_ADAPTER pAd, OUT PUCHAR pQueIdx) +PQUEUE_HEADER RTMPCheckTxSwQueue(IN PRTMP_ADAPTER pAd, u8 *pQueIdx) { - ULONG Number; + unsigned long Number; /* 2004-11-15 to be removed. test aggregation only */ /* if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED)) && (*pNumber < 2)) */ /* return NULL; */ @@ -1317,7 +1317,7 @@ PQUEUE_HEADER RTMPCheckTxSwQueue(IN PRTMP_ADAPTER pAd, OUT PUCHAR pQueIdx) ======================================================================== */ -VOID RTMPSuspendMsduTransmission(IN PRTMP_ADAPTER pAd) +void RTMPSuspendMsduTransmission(IN PRTMP_ADAPTER pAd) { DBGPRINT(RT_DEBUG_TRACE, ("SCANNING, suspend MSDU transmission ...\n")); @@ -1354,9 +1354,9 @@ VOID RTMPSuspendMsduTransmission(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID RTMPResumeMsduTransmission(IN PRTMP_ADAPTER pAd) +void RTMPResumeMsduTransmission(IN PRTMP_ADAPTER pAd) { -/* UCHAR IrqState; */ +/* u8 IrqState; */ DBGPRINT(RT_DEBUG_TRACE, ("SCAN done, resume MSDU transmission ...\n")); @@ -1379,17 +1379,17 @@ VOID RTMPResumeMsduTransmission(IN PRTMP_ADAPTER pAd) RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); } -UINT deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, +u32 deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, PNDIS_PACKET pPacket, - IN PUCHAR pData, IN ULONG DataSize) + u8 *pData, unsigned long DataSize) { - USHORT PayloadSize; - USHORT SubFrameSize; + u16 PayloadSize; + u16 SubFrameSize; PHEADER_802_3 pAMSDUsubheader; - UINT nMSDU; - UCHAR Header802_3[14]; + u32 nMSDU; + u8 Header802_3[14]; - PUCHAR pPayload, pDA, pSA, pRemovedLLCSNAP; + u8 *pPayload, *pDA, *pSA, *pRemovedLLCSNAP; PNDIS_PACKET pClonePacket; nMSDU = 0; @@ -1479,14 +1479,14 @@ UINT deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, return nMSDU; } -UINT BA_Reorder_AMSDU_Annnounce(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) +u32 BA_Reorder_AMSDU_Annnounce(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) { - PUCHAR pData; - USHORT DataSize; - UINT nMSDU = 0; + u8 *pData; + u16 DataSize; + u32 nMSDU = 0; - pData = (PUCHAR) GET_OS_PKT_DATAPTR(pPacket); - DataSize = (USHORT) GET_OS_PKT_LEN(pPacket); + pData = (u8 *)GET_OS_PKT_DATAPTR(pPacket); + DataSize = (u16)GET_OS_PKT_LEN(pPacket); nMSDU = deaggregate_AMSDU_announce(pAd, pPacket, pData, DataSize); @@ -1501,9 +1501,9 @@ UINT BA_Reorder_AMSDU_Annnounce(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) pEntry - pointer to the MAC entry; NULL is not found ========================================================================== */ -MAC_TABLE_ENTRY *MacTableLookup(IN PRTMP_ADAPTER pAd, PUCHAR pAddr) +MAC_TABLE_ENTRY *MacTableLookup(IN PRTMP_ADAPTER pAd, u8 *pAddr) { - ULONG HashIdx; + unsigned long HashIdx; MAC_TABLE_ENTRY *pEntry = NULL; HashIdx = MAC_ADDR_HASH_INDEX(pAddr); @@ -1522,14 +1522,14 @@ MAC_TABLE_ENTRY *MacTableLookup(IN PRTMP_ADAPTER pAd, PUCHAR pAddr) } MAC_TABLE_ENTRY *MacTableInsertEntry(IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR apidx, IN BOOLEAN CleanAll) + u8 *pAddr, + u8 apidx, IN BOOLEAN CleanAll) { - UCHAR HashIdx; + u8 HashIdx; int i, FirstWcid; MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry; -/* USHORT offset; */ -/* ULONG addr; */ +/* u16 offset; */ +/* unsigned long addr; */ /* if FULL, return */ if (pAd->MacTab.Size >= MAX_LEN_OF_MAC_TABLE) @@ -1601,7 +1601,7 @@ MAC_TABLE_ENTRY *MacTableInsertEntry(IN PRTMP_ADAPTER pAd, AsicRemovePairwiseKeyEntry(pAd, pEntry-> apidx, - (UCHAR) i); + (u8)i); #endif /* RTMP_MAC_PCI // */ } } @@ -1615,7 +1615,7 @@ MAC_TABLE_ENTRY *MacTableInsertEntry(IN PRTMP_ADAPTER pAd, COPY_MAC_ADDR(pEntry->Addr, pAddr); pEntry->Sst = SST_NOT_AUTH; pEntry->AuthState = AS_NOT_AUTH; - pEntry->Aid = (USHORT) i; /*0; */ + pEntry->Aid = (u16)i; /*0; */ pEntry->CapabilityInfo = 0; pEntry->PsMode = PWR_ACTIVE; pEntry->PsQIdleCount = 0; @@ -1659,13 +1659,13 @@ MAC_TABLE_ENTRY *MacTableInsertEntry(IN PRTMP_ADAPTER pAd, ========================================================================== */ BOOLEAN MacTableDeleteEntry(IN PRTMP_ADAPTER pAd, - IN USHORT wcid, IN PUCHAR pAddr) + u16 wcid, u8 *pAddr) { - USHORT HashIdx; + u16 HashIdx; MAC_TABLE_ENTRY *pEntry, *pPrevEntry, *pProbeEntry; BOOLEAN Cancelled; - /*USHORT offset; // unused variable */ - /*UCHAR j; // unused variable */ + /*u16 offset; // unused variable */ + /*u8 j; // unused variable */ if (wcid >= MAX_LEN_OF_MAC_TABLE) return FALSE; @@ -1752,7 +1752,7 @@ BOOLEAN MacTableDeleteEntry(IN PRTMP_ADAPTER pAd, the power-saving queues are freed here. ========================================================================== */ -VOID MacTableReset(IN PRTMP_ADAPTER pAd) +void MacTableReset(IN PRTMP_ADAPTER pAd) { int i; @@ -1790,11 +1790,11 @@ VOID MacTableReset(IN PRTMP_ADAPTER pAd) ========================================================================== */ -VOID AssocParmFill(IN PRTMP_ADAPTER pAd, +void AssocParmFill(IN PRTMP_ADAPTER pAd, IN OUT MLME_ASSOC_REQ_STRUCT * AssocReq, - IN PUCHAR pAddr, - IN USHORT CapabilityInfo, - IN ULONG Timeout, IN USHORT ListenIntv) + u8 *pAddr, + u16 CapabilityInfo, + unsigned long Timeout, u16 ListenIntv) { COPY_MAC_ADDR(AssocReq->Addr, pAddr); /* Add mask to support 802.11b mode only */ @@ -1811,9 +1811,9 @@ VOID AssocParmFill(IN PRTMP_ADAPTER pAd, ========================================================================== */ -VOID DisassocParmFill(IN PRTMP_ADAPTER pAd, +void DisassocParmFill(IN PRTMP_ADAPTER pAd, IN OUT MLME_DISASSOC_REQ_STRUCT * DisassocReq, - IN PUCHAR pAddr, IN USHORT Reason) + u8 *pAddr, u16 Reason) { COPY_MAC_ADDR(DisassocReq->Addr, pAddr); DisassocReq->Reason = Reason; @@ -1856,21 +1856,21 @@ VOID DisassocParmFill(IN PRTMP_ADAPTER pAd, BOOLEAN RTMPCheckDHCPFrame(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) { PACKET_INFO PacketInfo; - ULONG NumberOfBytesRead = 0; - ULONG CurrentOffset = 0; - PVOID pVirtualAddress = NULL; - UINT NdisBufferLength; - PUCHAR pSrc; - USHORT Protocol; - UCHAR ByteOffset36 = 0; - UCHAR ByteOffset38 = 0; + unsigned long NumberOfBytesRead = 0; + unsigned long CurrentOffset = 0; + void *pVirtualAddress = NULL; + u32 NdisBufferLength; + u8 *pSrc; + u16 Protocol; + u8 ByteOffset36 = 0; + u8 ByteOffset38 = 0; BOOLEAN ReadFirstParm = TRUE; - RTMP_QueryPacketInfo(pPacket, &PacketInfo, (PUCHAR *) & pVirtualAddress, + RTMP_QueryPacketInfo(pPacket, &PacketInfo, (u8 **) & pVirtualAddress, &NdisBufferLength); NumberOfBytesRead += NdisBufferLength; - pSrc = (PUCHAR) pVirtualAddress; + pSrc = (u8 *)pVirtualAddress; Protocol = *(pSrc + 12) * 256 + *(pSrc + 13); /* */ @@ -1910,11 +1910,11 @@ BOOLEAN RTMPCheckDHCPFrame(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) { - USHORT TypeLen; - UCHAR Byte0, Byte1; - PUCHAR pSrcBuf; - UINT32 pktLen; - UINT16 srcPort, dstPort; + u16 TypeLen; + u8 Byte0, Byte1; + u8 *pSrcBuf; + u32 pktLen; + u16 srcPort, dstPort; BOOLEAN status = TRUE; pSrcBuf = GET_OS_PKT_DATAPTR(pPacket); @@ -1941,7 +1941,7 @@ BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) Sniff2BytesFromNdisBuffer((PNDIS_BUFFER) pSrcBuf, 6, &Byte0, &Byte1); RTMP_SET_PACKET_LLCSNAP(pPacket, 1); - TypeLen = (USHORT) ((Byte0 << 8) + Byte1); + TypeLen = (u16)((Byte0 << 8) + Byte1); pSrcBuf += 8; /* Skip this LLC/SNAP header */ } else { /*It just has 3-byte LLC header, maybe a legacy ether type frame. we didn't handle it. */ @@ -1963,7 +1963,7 @@ BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) RTMP_SET_PACKET_VLAN(pPacket, 1); Sniff2BytesFromNdisBuffer((PNDIS_BUFFER) pSrcBuf, 2, &Byte0, &Byte1); - TypeLen = (USHORT) ((Byte0 << 8) + Byte1); + TypeLen = (u16)((Byte0 << 8) + Byte1); pSrcBuf += 4; /* Skip the VLAN Header. */ } @@ -1978,10 +1978,10 @@ BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) pSrcBuf += 20; /* Skip the IP header */ srcPort = OS_NTOHS(get_unaligned - ((PUINT16) (pSrcBuf))); + ((u16 *)(pSrcBuf))); dstPort = OS_NTOHS(get_unaligned - ((PUINT16) (pSrcBuf + 2))); + ((u16 *)(pSrcBuf + 2))); if ((srcPort == 0x44 && dstPort == 0x43) || (srcPort == 0x43 && dstPort == 0x44)) { /*It's a BOOTP/DHCP packet */ RTMP_SET_PACKET_DHCP(pPacket, 1); @@ -2010,29 +2010,29 @@ BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) } -VOID Update_Rssi_Sample(IN PRTMP_ADAPTER pAd, +void Update_Rssi_Sample(IN PRTMP_ADAPTER pAd, IN RSSI_SAMPLE * pRssi, IN PRXWI_STRUC pRxWI) { - CHAR rssi0 = pRxWI->RSSI0; - CHAR rssi1 = pRxWI->RSSI1; - CHAR rssi2 = pRxWI->RSSI2; + char rssi0 = pRxWI->RSSI0; + char rssi1 = pRxWI->RSSI1; + char rssi2 = pRxWI->RSSI2; if (rssi0 != 0) { - pRssi->LastRssi0 = ConvertToRssi(pAd, (CHAR) rssi0, RSSI_0); + pRssi->LastRssi0 = ConvertToRssi(pAd, (char)rssi0, RSSI_0); pRssi->AvgRssi0X8 = (pRssi->AvgRssi0X8 - pRssi->AvgRssi0) + pRssi->LastRssi0; pRssi->AvgRssi0 = pRssi->AvgRssi0X8 >> 3; } if (rssi1 != 0) { - pRssi->LastRssi1 = ConvertToRssi(pAd, (CHAR) rssi1, RSSI_1); + pRssi->LastRssi1 = ConvertToRssi(pAd, (char)rssi1, RSSI_1); pRssi->AvgRssi1X8 = (pRssi->AvgRssi1X8 - pRssi->AvgRssi1) + pRssi->LastRssi1; pRssi->AvgRssi1 = pRssi->AvgRssi1X8 >> 3; } if (rssi2 != 0) { - pRssi->LastRssi2 = ConvertToRssi(pAd, (CHAR) rssi2, RSSI_2); + pRssi->LastRssi2 = ConvertToRssi(pAd, (char)rssi2, RSSI_2); pRssi->AvgRssi2X8 = (pRssi->AvgRssi2X8 - pRssi->AvgRssi2) + pRssi->LastRssi2; pRssi->AvgRssi2 = pRssi->AvgRssi2X8 >> 3; @@ -2040,11 +2040,11 @@ VOID Update_Rssi_Sample(IN PRTMP_ADAPTER pAd, } /* Normal legacy Rx packet indication */ -VOID Indicate_Legacy_Packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) +void Indicate_Legacy_Packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, u8 FromWhichBSSID) { PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; - UCHAR Header802_3[LENGTH_802_3]; + u8 Header802_3[LENGTH_802_3]; /* 1. get 802.3 Header */ /* 2. remove LLC */ @@ -2064,10 +2064,10 @@ VOID Indicate_Legacy_Packet(IN PRTMP_ADAPTER pAd, #ifdef RTMP_MAC_USB if (pAd->CommonCfg.bDisableReordering == 0) { PBA_REC_ENTRY pBAEntry; - ULONG Now32; - UCHAR Wcid = pRxBlk->pRxWI->WirelessCliID; - UCHAR TID = pRxBlk->pRxWI->TID; - USHORT Idx; + unsigned long Now32; + u8 Wcid = pRxBlk->pRxWI->WirelessCliID; + u8 TID = pRxBlk->pRxWI->TID; + u16 Idx; #define REORDERING_PACKET_TIMEOUT ((100 * OS_HZ)/1000) /* system ticks -- 100 ms */ @@ -2111,8 +2111,8 @@ VOID Indicate_Legacy_Packet(IN PRTMP_ADAPTER pAd, } /* Normal, AMPDU or AMSDU */ -VOID CmmRxnonRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) +void CmmRxnonRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, u8 FromWhichBSSID) { if (RX_BLK_TEST_FLAG(pRxBlk, fRX_AMPDU) && (pAd->CommonCfg.bDisableReordering == 0)) { @@ -2127,14 +2127,14 @@ VOID CmmRxnonRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, } } -VOID CmmRxRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, +void CmmRxRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, - IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) + IN RX_BLK * pRxBlk, u8 FromWhichBSSID) { - UCHAR Header802_3[LENGTH_802_3]; - UINT16 Msdu2Size; - UINT16 Payload1Size, Payload2Size; - PUCHAR pData2; + u8 Header802_3[LENGTH_802_3]; + u16 Msdu2Size; + u16 Payload1Size, Payload2Size; + u8 *pData2; PNDIS_PACKET pPacket2 = NULL; Msdu2Size = *(pRxBlk->pData) + (*(pRxBlk->pData + 1) << 8); @@ -2196,16 +2196,16 @@ PNDIS_PACKET RTMPDeFragmentDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) { PHEADER_802_11 pHeader = pRxBlk->pHeader; PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; - UCHAR *pData = pRxBlk->pData; - USHORT DataSize = pRxBlk->DataSize; + u8 *pData = pRxBlk->pData; + u16 DataSize = pRxBlk->DataSize; PNDIS_PACKET pRetPacket = NULL; - UCHAR *pFragBuffer = NULL; + u8 *pFragBuffer = NULL; BOOLEAN bReassDone = FALSE; - UCHAR HeaderRoom = 0; + u8 HeaderRoom = 0; ASSERT(pHeader); - HeaderRoom = pData - (UCHAR *) pHeader; + HeaderRoom = pData - (u8 *) pHeader; /* Re-assemble the fragmented packets */ if (pHeader->Frag == 0) /* Frag. Number is 0 : First frag or only one pkt */ @@ -2284,7 +2284,7 @@ done: pAd->FragFrame.pFragPacket = pNewFragPacket; pRxBlk->pHeader = (PHEADER_802_11) GET_OS_PKT_DATAPTR(pRetPacket); - pRxBlk->pData = (UCHAR *) pRxBlk->pHeader + HeaderRoom; + pRxBlk->pData = (u8 *) pRxBlk->pHeader + HeaderRoom; pRxBlk->DataSize = pAd->FragFrame.RxSize - HeaderRoom; pRxBlk->pRxPacket = pRetPacket; } else { @@ -2295,10 +2295,10 @@ done: return pRetPacket; } -VOID Indicate_AMSDU_Packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) +void Indicate_AMSDU_Packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, u8 FromWhichBSSID) { - UINT nMSDU; + u32 nMSDU; update_os_packet_info(pAd, pRxBlk, FromWhichBSSID); RTMP_SET_PACKET_IF(pRxBlk->pRxPacket, FromWhichBSSID); @@ -2307,8 +2307,8 @@ VOID Indicate_AMSDU_Packet(IN PRTMP_ADAPTER pAd, pRxBlk->DataSize); } -VOID Indicate_EAPOL_Packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) +void Indicate_EAPOL_Packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, u8 FromWhichBSSID) { MAC_TABLE_ENTRY *pEntry = NULL; @@ -2329,10 +2329,10 @@ VOID Indicate_EAPOL_Packet(IN PRTMP_ADAPTER pAd, } #define BCN_TBTT_OFFSET 64 /*defer 64 us */ -VOID ReSyncBeaconTime(IN PRTMP_ADAPTER pAd) +void ReSyncBeaconTime(IN PRTMP_ADAPTER pAd) { - UINT32 Offset; + u32 Offset; Offset = (pAd->TbttTickCount) % (BCN_TBTT_OFFSET); diff --git a/drivers/staging/rt2860/common/cmm_data_pci.c b/drivers/staging/rt2860/common/cmm_data_pci.c index 157ebc6dd2bf..19eb9286135d 100644 --- a/drivers/staging/rt2860/common/cmm_data_pci.c +++ b/drivers/staging/rt2860/common/cmm_data_pci.c @@ -32,24 +32,24 @@ */ #include "../rt_config.h" -USHORT RtmpPCI_WriteTxResource(IN PRTMP_ADAPTER pAd, +u16 RtmpPCI_WriteTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, - IN BOOLEAN bIsLast, OUT USHORT * FreeNumber) + IN BOOLEAN bIsLast, u16 * FreeNumber) { - UCHAR *pDMAHeaderBufVA; - USHORT TxIdx, RetTxIdx; + u8 *pDMAHeaderBufVA; + u16 TxIdx, RetTxIdx; PTXD_STRUC pTxD; - UINT32 BufBasePaLow; + u32 BufBasePaLow; PRTMP_TX_RING pTxRing; - USHORT hwHeaderLen; + u16 hwHeaderLen; /* */ /* get Tx Ring Resource */ /* */ pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; - pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; + pDMAHeaderBufVA = (u8 *)pTxRing->Cell[TxIdx].DmaBuf.AllocVa; BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); @@ -97,25 +97,25 @@ USHORT RtmpPCI_WriteTxResource(IN PRTMP_ADAPTER pAd, return RetTxIdx; } -USHORT RtmpPCI_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, +u16 RtmpPCI_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, IN BOOLEAN bIsLast, - OUT USHORT * FreeNumber) + u16 * FreeNumber) { - UCHAR *pDMAHeaderBufVA; - USHORT TxIdx, RetTxIdx; + u8 *pDMAHeaderBufVA; + u16 TxIdx, RetTxIdx; PTXD_STRUC pTxD; - UINT32 BufBasePaLow; + u32 BufBasePaLow; PRTMP_TX_RING pTxRing; - USHORT hwHeaderLen; + u16 hwHeaderLen; /* */ /* get Tx Ring Resource */ /* */ pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; - pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; + pDMAHeaderBufVA = (u8 *)pTxRing->Cell[TxIdx].DmaBuf.AllocVa; BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); @@ -156,18 +156,18 @@ USHORT RtmpPCI_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, return RetTxIdx; } -USHORT RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, +u16 RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, - IN UCHAR frameNum, OUT USHORT * FreeNumber) + u8 frameNum, u16 * FreeNumber) { BOOLEAN bIsLast; - UCHAR *pDMAHeaderBufVA; - USHORT TxIdx, RetTxIdx; + u8 *pDMAHeaderBufVA; + u16 TxIdx, RetTxIdx; PTXD_STRUC pTxD; - UINT32 BufBasePaLow; + u32 BufBasePaLow; PRTMP_TX_RING pTxRing; - USHORT hwHdrLen; - UINT32 firstDMALen; + u16 hwHdrLen; + u32 firstDMALen; bIsLast = ((frameNum == (pTxBlk->TotalFrameNum - 1)) ? 1 : 0); @@ -176,7 +176,7 @@ USHORT RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, /* */ pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; - pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; + pDMAHeaderBufVA = (u8 *)pTxRing->Cell[TxIdx].DmaBuf.AllocVa; BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); @@ -235,9 +235,9 @@ USHORT RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, } -VOID RtmpPCI_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, +void RtmpPCI_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, - IN USHORT totalMPDUSize, IN USHORT FirstTxIdx) + u16 totalMPDUSize, u16 FirstTxIdx) { PTXWI_STRUC pTxWI; @@ -252,8 +252,8 @@ VOID RtmpPCI_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, } -VOID RtmpPCIDataLastTxIdx(IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, IN USHORT LastTxIdx) +void RtmpPCIDataLastTxIdx(IN PRTMP_ADAPTER pAd, + u8 QueIdx, u16 LastTxIdx) { PTXD_STRUC pTxD; PRTMP_TX_RING pTxRing; @@ -272,24 +272,24 @@ VOID RtmpPCIDataLastTxIdx(IN PRTMP_ADAPTER pAd, } -USHORT RtmpPCI_WriteFragTxResource(IN PRTMP_ADAPTER pAd, +u16 RtmpPCI_WriteFragTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, - IN UCHAR fragNum, OUT USHORT * FreeNumber) + u8 fragNum, u16 * FreeNumber) { - UCHAR *pDMAHeaderBufVA; - USHORT TxIdx, RetTxIdx; + u8 *pDMAHeaderBufVA; + u16 TxIdx, RetTxIdx; PTXD_STRUC pTxD; - UINT32 BufBasePaLow; + u32 BufBasePaLow; PRTMP_TX_RING pTxRing; - USHORT hwHeaderLen; - UINT32 firstDMALen; + u16 hwHeaderLen; + u32 firstDMALen; /* */ /* Get Tx Ring Resource */ /* */ pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; - pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; + pDMAHeaderBufVA = (u8 *)pTxRing->Cell[TxIdx].DmaBuf.AllocVa; BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); @@ -342,12 +342,12 @@ USHORT RtmpPCI_WriteFragTxResource(IN PRTMP_ADAPTER pAd, This function handle PCI specific TxDesc and cpu index update and kick the packet out. */ int RtmpPCIMgmtKickOut(IN RTMP_ADAPTER * pAd, - IN UCHAR QueIdx, + u8 QueIdx, IN PNDIS_PACKET pPacket, - IN PUCHAR pSrcBufVA, IN UINT SrcBufLen) + u8 *pSrcBufVA, u32 SrcBufLen) { PTXD_STRUC pTxD; - ULONG SwIdx = pAd->MgmtRing.TxCpuIdx; + unsigned long SwIdx = pAd->MgmtRing.TxCpuIdx; pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[SwIdx].AllocVa; @@ -405,17 +405,17 @@ int RtmpPCIMgmtKickOut(IN RTMP_ADAPTER * pAd, ======================================================================== */ -NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd, +int RTMPCheckRxError(IN PRTMP_ADAPTER pAd, IN PHEADER_802_11 pHeader, IN PRXWI_STRUC pRxWI, IN PRT28XX_RXD_STRUC pRxD) { PCIPHER_KEY pWpaKey; - INT dBm; + int dBm; /* Phy errors & CRC errors */ if ( /*(pRxD->PhyErr) || */ (pRxD->Crc)) { /* Check RSSI for Noise Hist statistic collection. */ - dBm = (INT) (pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta; + dBm = (int)(pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta; if (dBm <= -87) pAd->StaCfg.RPIDensity[0] += 1; else if (dBm <= -82) @@ -516,14 +516,14 @@ NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd, return (NDIS_STATUS_SUCCESS); } -BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx) +BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, u8 QueIdx) { PRTMP_TX_RING pTxRing; PTXD_STRUC pTxD; PNDIS_PACKET pPacket; - UCHAR FREE = 0; + u8 FREE = 0; TXD_STRUC TxD, *pOriTxD; - /*ULONG IrqFlags; */ + /*unsigned long IrqFlags; */ BOOLEAN bReschedule = FALSE; ASSERT(QueIdx < NUM_OF_TX_RING); @@ -610,9 +610,9 @@ BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx) ======================================================================== */ BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd, - IN INT_SOURCE_CSR_STRUC TxRingBitmap) + INT_SOURCE_CSR_STRUC TxRingBitmap) { -/* UCHAR Count = 0; */ +/* u8 Count = 0; */ unsigned long IrqFlags; BOOLEAN bReschedule = FALSE; @@ -661,12 +661,12 @@ BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd, ======================================================================== */ -VOID RTMPHandleMgmtRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd) +void RTMPHandleMgmtRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd) { PTXD_STRUC pTxD; PNDIS_PACKET pPacket; /* int i; */ - UCHAR FREE = 0; + u8 FREE = 0; PRTMP_MGMT_RING pMgmtRing = &pAd->MgmtRing; NdisAcquireSpinLock(&pAd->MgmtRingLock); @@ -713,7 +713,7 @@ VOID RTMPHandleMgmtRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID RTMPHandleTBTTInterrupt(IN PRTMP_ADAPTER pAd) +void RTMPHandleTBTTInterrupt(IN PRTMP_ADAPTER pAd) { { if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { @@ -732,7 +732,7 @@ VOID RTMPHandleTBTTInterrupt(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID RTMPHandlePreTBTTInterrupt(IN PRTMP_ADAPTER pAd) +void RTMPHandlePreTBTTInterrupt(IN PRTMP_ADAPTER pAd) { { if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { @@ -743,7 +743,7 @@ VOID RTMPHandlePreTBTTInterrupt(IN PRTMP_ADAPTER pAd) } -VOID RTMPHandleRxCoherentInterrupt(IN PRTMP_ADAPTER pAd) +void RTMPHandleRxCoherentInterrupt(IN PRTMP_ADAPTER pAd) { WPDMA_GLO_CFG_STRUC GloCfg; @@ -776,12 +776,12 @@ VOID RTMPHandleRxCoherentInterrupt(IN PRTMP_ADAPTER pAd) PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, OUT PRT28XX_RXD_STRUC pSaveRxD, OUT BOOLEAN * pbReschedule, - IN OUT UINT32 * pRxPending) + IN u32 * pRxPending) { PRXD_STRUC pRxD; PNDIS_PACKET pRxPacket = NULL; PNDIS_PACKET pNewPacket; - PVOID AllocVa; + void *AllocVa; NDIS_PHYSICAL_ADDRESS AllocPa; BOOLEAN bReschedule = FALSE; RTMP_DMACB *pRxCell; @@ -864,23 +864,23 @@ done: return pRxPacket; } -NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, IN PNDIS_PACKET pPacket) +int MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, + u8 QueIdx, IN PNDIS_PACKET pPacket) { PACKET_INFO PacketInfo; - PUCHAR pSrcBufVA; - UINT SrcBufLen; + u8 *pSrcBufVA; + u32 SrcBufLen; PTXD_STRUC pTxD; PHEADER_802_11 pHeader_802_11; BOOLEAN bAckRequired, bInsertTimestamp; - ULONG SrcBufPA; - /*UCHAR TxBufIdx; */ - UCHAR MlmeRate; - ULONG SwIdx = pAd->TxRing[QueIdx].TxCpuIdx; + unsigned long SrcBufPA; + /*u8 TxBufIdx; */ + u8 MlmeRate; + unsigned long SwIdx = pAd->TxRing[QueIdx].TxCpuIdx; PTXWI_STRUC pFirstTxWI; - /*ULONG i; */ + /*unsigned long i; */ /*HTTRANSMIT_SETTING MlmeTransmit; //Rate for this MGMT frame. */ - ULONG FreeNum; + unsigned long FreeNum; MAC_TABLE_ENTRY *pMacEntry = NULL; RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); @@ -1000,14 +1000,14 @@ NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, bInsertTimestamp, FALSE, bAckRequired, FALSE, 0, RESERVED_WCID, (SrcBufLen - TXWI_SIZE), PID_MGMT, 0, - (UCHAR) pAd->CommonCfg.MlmeTransmit.field.MCS, + (u8)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); } else { RTMPWriteTxWI(pAd, pFirstTxWI, FALSE, FALSE, bInsertTimestamp, FALSE, bAckRequired, FALSE, 0, pMacEntry->Aid, (SrcBufLen - TXWI_SIZE), pMacEntry->MaxHTPhyMode.field.MCS, 0, - (UCHAR) pMacEntry->MaxHTPhyMode.field.MCS, + (u8)pMacEntry->MaxHTPhyMode.field.MCS, IFS_BACKOFF, FALSE, &pMacEntry->MaxHTPhyMode); } @@ -1040,8 +1040,8 @@ NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, return NDIS_STATUS_SUCCESS; } -NDIS_STATUS MlmeDataHardTransmit(IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, IN PNDIS_PACKET pPacket) +int MlmeDataHardTransmit(IN PRTMP_ADAPTER pAd, + u8 QueIdx, IN PNDIS_PACKET pPacket) { if ((pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) ) { @@ -1078,9 +1078,9 @@ NDIS_STATUS MlmeDataHardTransmit(IN PRTMP_ADAPTER pAd, ======================================================================== */ -VOID RTMPWriteTxDescriptor(IN PRTMP_ADAPTER pAd, +void RTMPWriteTxDescriptor(IN PRTMP_ADAPTER pAd, IN PTXD_STRUC pTxD, - IN BOOLEAN bWIV, IN UCHAR QueueSEL) + IN BOOLEAN bWIV, u8 QueueSEL) { /* */ /* Always use Long preamble before verifiation short preamble functionality works well. */ diff --git a/drivers/staging/rt2860/common/cmm_data_usb.c b/drivers/staging/rt2860/common/cmm_data_usb.c index da79fc03d762..790675659362 100644 --- a/drivers/staging/rt2860/common/cmm_data_usb.c +++ b/drivers/staging/rt2860/common/cmm_data_usb.c @@ -41,11 +41,11 @@ => => */ -static inline NDIS_STATUS RtmpUSBCanDoWrite(IN RTMP_ADAPTER * pAd, - IN UCHAR QueIdx, +static inline int RtmpUSBCanDoWrite(IN RTMP_ADAPTER * pAd, + u8 QueIdx, IN HT_TX_CONTEXT * pHTTXContext) { - NDIS_STATUS canWrite = NDIS_STATUS_RESOURCES; + int canWrite = NDIS_STATUS_RESOURCES; if (((pHTTXContext->CurWritePosition) < pHTTXContext->NextBulkOutPosition) @@ -68,9 +68,9 @@ static inline NDIS_STATUS RtmpUSBCanDoWrite(IN RTMP_ADAPTER * pAd, return canWrite; } -USHORT RtmpUSB_WriteSubTxResource(IN PRTMP_ADAPTER pAd, +u16 RtmpUSB_WriteSubTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, - IN BOOLEAN bIsLast, OUT USHORT * FreeNumber) + IN BOOLEAN bIsLast, u16 * FreeNumber) { /* Dummy function. Should be removed in the future. */ @@ -78,20 +78,20 @@ USHORT RtmpUSB_WriteSubTxResource(IN PRTMP_ADAPTER pAd, } -USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, +u16 RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, - IN UCHAR fragNum, OUT USHORT * FreeNumber) + u8 fragNum, u16 * FreeNumber) { HT_TX_CONTEXT *pHTTXContext; - USHORT hwHdrLen; /* The hwHdrLen consist of 802.11 header length plus the header padding length. */ - UINT32 fillOffset; + u16 hwHdrLen; /* The hwHdrLen consist of 802.11 header length plus the header padding length. */ + u32 fillOffset; TXINFO_STRUC *pTxInfo; TXWI_STRUC *pTxWI; - PUCHAR pWirelessPacket = NULL; - UCHAR QueIdx; - NDIS_STATUS Status; + u8 *pWirelessPacket = NULL; + u8 QueIdx; + int Status; unsigned long IrqFlags; - UINT32 USBDMApktLen = 0, DMAHdrLen, padding; + u32 USBDMApktLen = 0, DMAHdrLen, padding; BOOLEAN TxQLastRound = FALSE; /* */ @@ -146,7 +146,7 @@ USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, } } - NdisZeroMemory((PUCHAR) (&pTxBlk->HeaderBuf[0]), TXINFO_SIZE); + NdisZeroMemory((u8 *)(&pTxBlk->HeaderBuf[0]), TXINFO_SIZE); pTxInfo = (PTXINFO_STRUC) (&pTxBlk->HeaderBuf[0]); pTxWI = (PTXWI_STRUC) (&pTxBlk->HeaderBuf[TXINFO_SIZE]); @@ -166,7 +166,7 @@ USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, pTxBlk->Priv += (TXINFO_SIZE + USBDMApktLen); /* For TxInfo, the length of USBDMApktLen = TXWI_SIZE + 802.11 header + payload */ - RTMPWriteTxInfo(pAd, pTxInfo, (USHORT) (USBDMApktLen), FALSE, FIFO_EDCA, + RTMPWriteTxInfo(pAd, pTxInfo, (u16)(USBDMApktLen), FALSE, FIFO_EDCA, FALSE /*NextValid */ , FALSE); if (fragNum == pTxBlk->TotalFragNum) { @@ -215,21 +215,21 @@ USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, } -USHORT RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, +u16 RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, IN BOOLEAN bIsLast, - OUT USHORT * FreeNumber) + u16 * FreeNumber) { HT_TX_CONTEXT *pHTTXContext; - USHORT hwHdrLen; - UINT32 fillOffset; + u16 hwHdrLen; + u32 fillOffset; TXINFO_STRUC *pTxInfo; TXWI_STRUC *pTxWI; - PUCHAR pWirelessPacket; - UCHAR QueIdx; + u8 *pWirelessPacket; + u8 QueIdx; unsigned long IrqFlags; - NDIS_STATUS Status; - UINT32 USBDMApktLen = 0, DMAHdrLen, padding; + int Status; + u32 USBDMApktLen = 0, DMAHdrLen, padding; BOOLEAN bTxQLastRound = FALSE; /* For USB, didn't need PCI_MAP_SINGLE() */ @@ -278,7 +278,7 @@ USHORT RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, pTxBlk->Priv = (TXINFO_SIZE + USBDMApktLen); /* For TxInfo, the length of USBDMApktLen = TXWI_SIZE + 802.11 header + payload */ - RTMPWriteTxInfo(pAd, pTxInfo, (USHORT) (USBDMApktLen), FALSE, + RTMPWriteTxInfo(pAd, pTxInfo, (u16)(USBDMApktLen), FALSE, FIFO_EDCA, FALSE /*NextValid */ , FALSE); if ((pHTTXContext->CurWritePosition + 3906 + pTxBlk->Priv) > @@ -328,20 +328,20 @@ USHORT RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, } -USHORT RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, +u16 RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, - IN UCHAR frameNum, OUT USHORT * FreeNumber) + u8 frameNum, u16 * FreeNumber) { HT_TX_CONTEXT *pHTTXContext; - USHORT hwHdrLen; /* The hwHdrLen consist of 802.11 header length plus the header padding length. */ - UINT32 fillOffset; + u16 hwHdrLen; /* The hwHdrLen consist of 802.11 header length plus the header padding length. */ + u32 fillOffset; TXINFO_STRUC *pTxInfo; TXWI_STRUC *pTxWI; - PUCHAR pWirelessPacket = NULL; - UCHAR QueIdx; - NDIS_STATUS Status; + u8 *pWirelessPacket = NULL; + u8 QueIdx; + int Status; unsigned long IrqFlags; - /*UINT32 USBDMApktLen = 0, DMAHdrLen, padding; */ + /*u32 USBDMApktLen = 0, DMAHdrLen, padding; */ /* */ /* get Tx Ring Resource & Dma Buffer address */ @@ -401,7 +401,7 @@ USHORT RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, pTxBlk->Priv = TXINFO_SIZE + TXWI_SIZE + hwHdrLen; /* pTxInfo->USBDMApktLen now just a temp value and will to correct latter. */ - RTMPWriteTxInfo(pAd, pTxInfo, (USHORT) (pTxBlk->Priv), + RTMPWriteTxInfo(pAd, pTxInfo, (u16)(pTxBlk->Priv), FALSE, FIFO_EDCA, FALSE /*NextValid */ , FALSE); @@ -467,18 +467,18 @@ done: } -VOID RtmpUSB_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, +void RtmpUSB_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, - IN USHORT totalMPDUSize, IN USHORT TxIdx) + u16 totalMPDUSize, u16 TxIdx) { - UCHAR QueIdx; + u8 QueIdx; HT_TX_CONTEXT *pHTTXContext; - UINT32 fillOffset; + u32 fillOffset; TXINFO_STRUC *pTxInfo; TXWI_STRUC *pTxWI; - UINT32 USBDMApktLen, padding; + u32 USBDMApktLen, padding; unsigned long IrqFlags; - PUCHAR pWirelessPacket; + u8 *pWirelessPacket; QueIdx = pTxBlk->QueIdx; pHTTXContext = &pAd->TxContext[QueIdx]; @@ -492,10 +492,10 @@ VOID RtmpUSB_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, || ((pHTTXContext->ENextBulkOutPosition - 8) == pHTTXContext->CurWritePosition)) && (pHTTXContext->bCopySavePad == TRUE)) - pWirelessPacket = (PUCHAR) (&pHTTXContext->SavedPad[0]); + pWirelessPacket = (u8 *)(&pHTTXContext->SavedPad[0]); else pWirelessPacket = - (PUCHAR) (&pHTTXContext->TransferBuffer->field. + (u8 *)(&pHTTXContext->TransferBuffer->field. WirelessPacket[fillOffset]); /* */ @@ -547,8 +547,8 @@ VOID RtmpUSB_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, } -VOID RtmpUSBDataLastTxIdx(IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, IN USHORT TxIdx) +void RtmpUSBDataLastTxIdx(IN PRTMP_ADAPTER pAd, + u8 QueIdx, u16 TxIdx) { /* DO nothing for USB. */ } @@ -561,8 +561,8 @@ VOID RtmpUSBDataLastTxIdx(IN PRTMP_ADAPTER pAd, Check if the CurWriting flag is FALSE, if it's FALSE, we can do kick out. */ -VOID RtmpUSBDataKickOut(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, IN UCHAR QueIdx) +void RtmpUSBDataKickOut(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, u8 QueIdx) { RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << QueIdx)); RTUSBKickBulkOut(pAd); @@ -574,15 +574,15 @@ VOID RtmpUSBDataKickOut(IN PRTMP_ADAPTER pAd, This function handle RT2870 specific TxDesc and cpu index update and kick the packet out. */ int RtmpUSBMgmtKickOut(IN RTMP_ADAPTER * pAd, - IN UCHAR QueIdx, + u8 QueIdx, IN PNDIS_PACKET pPacket, - IN PUCHAR pSrcBufVA, IN UINT SrcBufLen) + u8 *pSrcBufVA, u32 SrcBufLen) { PTXINFO_STRUC pTxInfo; - ULONG BulkOutSize; - UCHAR padLen; - PUCHAR pDest; - ULONG SwIdx = pAd->MgmtRing.TxCpuIdx; + unsigned long BulkOutSize; + u8 padLen; + u8 *pDest; + unsigned long SwIdx = pAd->MgmtRing.TxCpuIdx; PTX_CONTEXT pMLMEContext = (PTX_CONTEXT) pAd->MgmtRing.Cell[SwIdx].AllocVa; unsigned long IrqFlags; @@ -592,7 +592,7 @@ int RtmpUSBMgmtKickOut(IN RTMP_ADAPTER * pAd, /* Build our URB for USBD */ BulkOutSize = SrcBufLen; BulkOutSize = (BulkOutSize + 3) & (~3); - RTMPWriteTxInfo(pAd, pTxInfo, (USHORT) (BulkOutSize - TXINFO_SIZE), + RTMPWriteTxInfo(pAd, pTxInfo, (u16)(BulkOutSize - TXINFO_SIZE), TRUE, EpToQueue[MGMTPIPEIDX], FALSE, FALSE); BulkOutSize += 4; /* Always add 4 extra bytes at every packet. */ @@ -605,7 +605,7 @@ int RtmpUSBMgmtKickOut(IN RTMP_ADAPTER * pAd, ASSERT((padLen <= RTMP_PKT_TAIL_PADDING)); /* Now memzero all extra padding bytes. */ - pDest = (PUCHAR) (pSrcBufVA + SrcBufLen); + pDest = (u8 *)(pSrcBufVA + SrcBufLen); skb_put(GET_OS_PKT_TYPE(pPacket), padLen); NdisZeroMemory(pDest, padLen); @@ -642,34 +642,34 @@ int RtmpUSBMgmtKickOut(IN RTMP_ADAPTER * pAd, return 0; } -VOID RtmpUSBNullFrameKickOut(IN RTMP_ADAPTER * pAd, - IN UCHAR QueIdx, - IN UCHAR * pNullFrame, IN UINT32 frameLen) +void RtmpUSBNullFrameKickOut(IN RTMP_ADAPTER * pAd, + u8 QueIdx, + u8 * pNullFrame, u32 frameLen) { if (pAd->NullContext.InUse == FALSE) { PTX_CONTEXT pNullContext; PTXINFO_STRUC pTxInfo; PTXWI_STRUC pTxWI; - PUCHAR pWirelessPkt; + u8 *pWirelessPkt; pNullContext = &(pAd->NullContext); /* Set the in use bit */ pNullContext->InUse = TRUE; pWirelessPkt = - (PUCHAR) & pNullContext->TransferBuffer->field. + (u8 *)& pNullContext->TransferBuffer->field. WirelessPacket[0]; RTMPZeroMemory(&pWirelessPkt[0], 100); pTxInfo = (PTXINFO_STRUC) & pWirelessPkt[0]; RTMPWriteTxInfo(pAd, pTxInfo, - (USHORT) (sizeof(HEADER_802_11) + TXWI_SIZE), + (u16)(sizeof(HEADER_802_11) + TXWI_SIZE), TRUE, EpToQueue[MGMTPIPEIDX], FALSE, FALSE); pTxInfo->QSEL = FIFO_EDCA; pTxWI = (PTXWI_STRUC) & pWirelessPkt[TXINFO_SIZE]; RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0, BSSID_WCID, (sizeof(HEADER_802_11)), 0, - 0, (UCHAR) pAd->CommonCfg.MlmeTransmit.field.MCS, + 0, (u8)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_HTTXOP, FALSE, &pAd->CommonCfg.MlmeTransmit); RTMPMoveMemory(&pWirelessPkt[TXWI_SIZE + TXINFO_SIZE], @@ -710,13 +710,13 @@ Note: PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, OUT PRT28XX_RXD_STRUC pSaveRxD, OUT BOOLEAN * pbReschedule, - IN OUT UINT32 * pRxPending) + IN u32 * pRxPending) { PRX_CONTEXT pRxContext; PNDIS_PACKET pSkb; - PUCHAR pData; - ULONG ThisFrameLen; - ULONG RxBufferLength; + u8 *pData; + unsigned long ThisFrameLen; + unsigned long RxBufferLength; PRXWI_STRUC pRxWI; pRxContext = &pAd->RxContext[pAd->NextRxBulkInReadIndex]; @@ -812,12 +812,12 @@ label_null: ======================================================================== */ -NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd, +int RTMPCheckRxError(IN PRTMP_ADAPTER pAd, IN PHEADER_802_11 pHeader, IN PRXWI_STRUC pRxWI, IN PRT28XX_RXD_STRUC pRxINFO) { PCIPHER_KEY pWpaKey; - INT dBm; + int dBm; if (pAd->bPromiscuous == TRUE) return (NDIS_STATUS_SUCCESS); @@ -827,7 +827,7 @@ NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd, /* Phy errors & CRC errors */ if (pRxINFO->Crc) { /* Check RSSI for Noise Hist statistic collection. */ - dBm = (INT) (pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta; + dBm = (int)(pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta; if (dBm <= -87) pAd->StaCfg.RPIDensity[0] += 1; else if (dBm <= -82) @@ -904,10 +904,10 @@ NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd, return (NDIS_STATUS_SUCCESS); } -VOID RtmpUsbStaAsicForceWakeupTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +void RtmpUsbStaAsicForceWakeupTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, + void *SystemSpecific3) { RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; @@ -919,7 +919,7 @@ VOID RtmpUsbStaAsicForceWakeupTimeout(IN PVOID SystemSpecific1, } } -VOID RT28xxUsbStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) +void RT28xxUsbStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) { BOOLEAN Canceled; @@ -931,8 +931,8 @@ VOID RT28xxUsbStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); } -VOID RT28xxUsbStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp) +void RT28xxUsbStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, + u16 TbttNumToNextWakeUp) { /* we have decided to SLEEP, so at least do it for a BEACON period. */ diff --git a/drivers/staging/rt2860/common/cmm_info.c b/drivers/staging/rt2860/common/cmm_info.c index 610eb75dd157..21780578f556 100644 --- a/drivers/staging/rt2860/common/cmm_info.c +++ b/drivers/staging/rt2860/common/cmm_info.c @@ -47,7 +47,7 @@ ======================================================================== */ -VOID RTMPSetDesiredRates(IN PRTMP_ADAPTER pAdapter, IN LONG Rates) +void RTMPSetDesiredRates(IN PRTMP_ADAPTER pAdapter, long Rates) { NDIS_802_11_RATES aryRates; @@ -235,10 +235,10 @@ VOID RTMPSetDesiredRates(IN PRTMP_ADAPTER pAdapter, IN LONG Rates) ======================================================================== */ -VOID RTMPWPARemoveAllKeys(IN PRTMP_ADAPTER pAd) +void RTMPWPARemoveAllKeys(IN PRTMP_ADAPTER pAd) { - UCHAR i; + u8 i; DBGPRINT(RT_DEBUG_TRACE, ("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", @@ -307,9 +307,9 @@ VOID RTMPWPARemoveAllKeys(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, IN ULONG phymode) +void RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, unsigned long phymode) { - INT i; + int i; /* the selected phymode must be supported by the RF IC encoded in E2PROM */ /* if no change, do nothing */ @@ -317,7 +317,7 @@ VOID RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, IN ULONG phymode) if (pAd->CommonCfg.PhyMode == phymode) return; */ - pAd->CommonCfg.PhyMode = (UCHAR) phymode; + pAd->CommonCfg.PhyMode = (u8)phymode; DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", @@ -435,13 +435,13 @@ VOID RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, IN ULONG phymode) ======================================================================== */ -VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode) +void RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode) { - /*ULONG *pmcs; */ - UINT32 Value = 0; - UCHAR BBPValue = 0; - UCHAR BBP3Value = 0; - UCHAR RxStream = pAd->CommonCfg.RxStream; + /*unsigned long *pmcs; */ + u32 Value = 0; + u8 BBPValue = 0; + u8 BBP3Value = 0; + u8 RxStream = pAd->CommonCfg.RxStream; DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n", @@ -475,20 +475,20 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode) /* Mimo power save, A-MSDU size, */ pAd->CommonCfg.DesiredHtPhy.AmsduEnable = - (USHORT) pAd->CommonCfg.BACapability.field.AmsduEnable; + (u16)pAd->CommonCfg.BACapability.field.AmsduEnable; pAd->CommonCfg.DesiredHtPhy.AmsduSize = - (UCHAR) pAd->CommonCfg.BACapability.field.AmsduSize; + (u8)pAd->CommonCfg.BACapability.field.AmsduSize; pAd->CommonCfg.DesiredHtPhy.MimoPs = - (UCHAR) pAd->CommonCfg.BACapability.field.MMPSmode; + (u8)pAd->CommonCfg.BACapability.field.MMPSmode; pAd->CommonCfg.DesiredHtPhy.MpduDensity = - (UCHAR) pAd->CommonCfg.BACapability.field.MpduDensity; + (u8)pAd->CommonCfg.BACapability.field.MpduDensity; pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = - (USHORT) pAd->CommonCfg.BACapability.field.AmsduSize; + (u16)pAd->CommonCfg.BACapability.field.AmsduSize; pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = - (USHORT) pAd->CommonCfg.BACapability.field.MMPSmode; + (u16)pAd->CommonCfg.BACapability.field.MMPSmode; pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = - (UCHAR) pAd->CommonCfg.BACapability.field.MpduDensity; + (u8)pAd->CommonCfg.BACapability.field.MpduDensity; DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n", @@ -648,11 +648,11 @@ VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode) ======================================================================== */ -VOID RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) +void RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, u8 apidx) { PRT_HT_PHY_INFO pDesired_ht_phy = NULL; - UCHAR TxStream = pAd->CommonCfg.TxStream; - UCHAR DesiredMcs = MCS_AUTO; + u8 TxStream = pAd->CommonCfg.TxStream; + u8 DesiredMcs = MCS_AUTO; do { { @@ -708,7 +708,7 @@ VOID RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) pDesired_ht_phy->MCSSet[0] = 0xff; pDesired_ht_phy->MCSSet[1] = 0xff; } else if (DesiredMcs <= MCS_15) { - ULONG mode; + unsigned long mode; mode = DesiredMcs / 8; if (mode < 2) @@ -724,7 +724,7 @@ VOID RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) pDesired_ht_phy->MCSSet[1] = 0xff; pDesired_ht_phy->MCSSet[2] = 0xff; } else if (DesiredMcs <= MCS_23) { - ULONG mode; + unsigned long mode; mode = DesiredMcs / 8; if (mode < 3) @@ -755,8 +755,8 @@ VOID RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) ======================================================================== */ -VOID RTMPUpdateHTIE(IN RT_HT_CAPABILITY * pRtHt, - IN UCHAR * pMcsSet, +void RTMPUpdateHTIE(IN RT_HT_CAPABILITY * pRtHt, + u8 * pMcsSet, OUT HT_CAPABILITY_IE * pHtCapability, OUT ADD_HT_INFO_IE * pAddHtInfo) { @@ -790,15 +790,15 @@ VOID RTMPUpdateHTIE(IN RT_HT_CAPABILITY * pRtHt, Return: ======================================================================== */ -VOID RTMPAddWcidAttributeEntry(IN PRTMP_ADAPTER pAd, - IN UCHAR BssIdx, - IN UCHAR KeyIdx, - IN UCHAR CipherAlg, IN MAC_TABLE_ENTRY * pEntry) +void RTMPAddWcidAttributeEntry(IN PRTMP_ADAPTER pAd, + u8 BssIdx, + u8 KeyIdx, + u8 CipherAlg, IN MAC_TABLE_ENTRY * pEntry) { - UINT32 WCIDAttri = 0; - USHORT offset; - UCHAR IVEIV = 0; - USHORT Wcid = 0; + u32 WCIDAttri = 0; + u16 offset; + u8 IVEIV = 0; + u16 Wcid = 0; { { @@ -872,7 +872,7 @@ Arguments: Note: ========================================================================== */ -PSTRING GetEncryptType(CHAR enc) +char *GetEncryptType(char enc) { if (enc == Ndis802_11WEPDisabled) return "NONE"; @@ -888,7 +888,7 @@ PSTRING GetEncryptType(CHAR enc) return "UNKNOW"; } -PSTRING GetAuthMode(CHAR auth) +char *GetAuthMode(char auth) { if (auth == Ndis802_11AuthModeOpen) return "OPEN"; @@ -914,7 +914,7 @@ PSTRING GetAuthMode(CHAR auth) return "UNKNOW"; } -INT SetCommonHT(IN PRTMP_ADAPTER pAd) +int SetCommonHT(IN PRTMP_ADAPTER pAd) { OID_SET_HT_PHYMODE SetHT; @@ -922,21 +922,21 @@ INT SetCommonHT(IN PRTMP_ADAPTER pAd) return FALSE; SetHT.PhyMode = pAd->CommonCfg.PhyMode; - SetHT.TransmitNo = ((UCHAR) pAd->Antenna.field.TxPath); - SetHT.HtMode = (UCHAR) pAd->CommonCfg.RegTransmitSetting.field.HTMODE; + SetHT.TransmitNo = ((u8)pAd->Antenna.field.TxPath); + SetHT.HtMode = (u8)pAd->CommonCfg.RegTransmitSetting.field.HTMODE; SetHT.ExtOffset = - (UCHAR) pAd->CommonCfg.RegTransmitSetting.field.EXTCHA; + (u8)pAd->CommonCfg.RegTransmitSetting.field.EXTCHA; SetHT.MCS = MCS_AUTO; - SetHT.BW = (UCHAR) pAd->CommonCfg.RegTransmitSetting.field.BW; - SetHT.STBC = (UCHAR) pAd->CommonCfg.RegTransmitSetting.field.STBC; - SetHT.SHORTGI = (UCHAR) pAd->CommonCfg.RegTransmitSetting.field.ShortGI; + SetHT.BW = (u8)pAd->CommonCfg.RegTransmitSetting.field.BW; + SetHT.STBC = (u8)pAd->CommonCfg.RegTransmitSetting.field.STBC; + SetHT.SHORTGI = (u8)pAd->CommonCfg.RegTransmitSetting.field.ShortGI; RTMPSetHT(pAd, &SetHT); return TRUE; } -PSTRING RTMPGetRalinkEncryModeStr(IN USHORT encryMode) +char *RTMPGetRalinkEncryModeStr(u16 encryMode) { switch (encryMode) { case Ndis802_11WEPDisabled: diff --git a/drivers/staging/rt2860/common/cmm_mac_pci.c b/drivers/staging/rt2860/common/cmm_mac_pci.c index 3b6f577a2919..c7f4be1181cd 100644 --- a/drivers/staging/rt2860/common/cmm_mac_pci.c +++ b/drivers/staging/rt2860/common/cmm_mac_pci.c @@ -48,16 +48,16 @@ ======================================================================== */ -NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) +int RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) { - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - ULONG RingBasePaHigh; - ULONG RingBasePaLow; - PVOID RingBaseVa; - INT index, num; + int Status = NDIS_STATUS_SUCCESS; + unsigned long RingBasePaHigh; + unsigned long RingBasePaLow; + void *RingBaseVa; + int index, num; PTXD_STRUC pTxD; PRXD_STRUC pRxD; - ULONG ErrorValue = 0; + unsigned long ErrorValue = 0; PRTMP_TX_RING pTxRing; PRTMP_DMABUF pDmaBuf; PNDIS_PACKET pPacket; @@ -71,9 +71,9 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) /* issue, I intentional set them all to 64 bytes. */ /* */ for (num = 0; num < NUM_OF_TX_RING; num++) { - ULONG BufBasePaHigh; - ULONG BufBasePaLow; - PVOID BufBaseVa; + unsigned long BufBasePaHigh; + unsigned long BufBasePaLow; + void *BufBaseVa; /* */ /* Allocate Tx ring descriptor's memory (5 TX rings = 4 ACs + 1 HCCA) */ @@ -171,12 +171,12 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) /* advance to next ring descriptor address */ pTxD->DMADONE = 1; RingBasePaLow += TXD_SIZE; - RingBaseVa = (PUCHAR) RingBaseVa + TXD_SIZE; + RingBaseVa = (u8 *)RingBaseVa + TXD_SIZE; /* advance to next TxBuf address */ BufBasePaLow += TX_DMA_1ST_BUFFER_SIZE; BufBaseVa = - (PUCHAR) BufBaseVa + TX_DMA_1ST_BUFFER_SIZE; + (u8 *)BufBaseVa + TX_DMA_1ST_BUFFER_SIZE; } DBGPRINT(RT_DEBUG_TRACE, ("TxRing[%d]: total %d entry allocated\n", num, @@ -228,7 +228,7 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) /* Offset to next ring descriptor address */ RingBasePaLow += TXD_SIZE; - RingBaseVa = (PUCHAR) RingBaseVa + TXD_SIZE; + RingBaseVa = (u8 *)RingBaseVa + TXD_SIZE; /* link the pre-allocated TxBuf to TXD */ pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[index].AllocVa; @@ -286,7 +286,7 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) /* Offset to next ring descriptor address */ RingBasePaLow += RXD_SIZE; - RingBaseVa = (PUCHAR) RingBaseVa + RXD_SIZE; + RingBaseVa = (u8 *)RingBaseVa + RXD_SIZE; /* Setup Rx associated Buffer size & allocate share memory */ pDmaBuf = &pAd->RxRing.Cell[index].DmaBuf; @@ -400,7 +400,7 @@ NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, IN UCHAR RingType) +void RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, u8 RingType) { PTXD_STRUC pTxD; PRXD_STRUC pRxD; @@ -409,7 +409,7 @@ VOID RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, IN UCHAR RingType) int i; PRTMP_TX_RING pTxRing; unsigned long IrqFlags; - /*UINT32 RxSwReadIdx; */ + /*u32 RxSwReadIdx; */ DBGPRINT(RT_DEBUG_TRACE, ("RTMPRingCleanUp(RingIdx=%d, Pending-NDIS=%ld)\n", RingType, @@ -533,7 +533,7 @@ VOID RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, IN UCHAR RingType) } } -VOID RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) +void RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) { int index, num, j; PRTMP_TX_RING pTxRing; @@ -667,7 +667,7 @@ Return Value: Note: ======================================================================== */ -VOID RT28XXDMADisable(IN RTMP_ADAPTER * pAd) +void RT28XXDMADisable(IN RTMP_ADAPTER * pAd) { WPDMA_GLO_CFG_STRUC GloCfg; @@ -691,7 +691,7 @@ Return Value: Note: ======================================================================== */ -VOID RT28XXDMAEnable(IN RTMP_ADAPTER * pAd) +void RT28XXDMAEnable(IN RTMP_ADAPTER * pAd) { WPDMA_GLO_CFG_STRUC GloCfg; int i = 0; @@ -721,10 +721,10 @@ VOID RT28XXDMAEnable(IN RTMP_ADAPTER * pAd) } -BOOLEAN AsicCheckCommanOk(IN PRTMP_ADAPTER pAd, IN UCHAR Command) +BOOLEAN AsicCheckCommanOk(IN PRTMP_ADAPTER pAd, u8 Command) { - UINT32 CmdStatus = 0, CID = 0, i; - UINT32 ThisCIDMask = 0; + u32 CmdStatus = 0, CID = 0, i; + u32 ThisCIDMask = 0; i = 0; do { @@ -794,15 +794,15 @@ Return Value: Note: ======================================================================== */ -VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, - IN INT apidx, - IN ULONG FrameLen, IN ULONG UpdatePos) +void RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, + int apidx, + unsigned long FrameLen, unsigned long UpdatePos) { - ULONG CapInfoPos = 0; - UCHAR *ptr, *ptr_update, *ptr_capinfo; - UINT i; + unsigned long CapInfoPos = 0; + u8 *ptr, *ptr_update, *ptr_capinfo; + u32 i; BOOLEAN bBcnReq = FALSE; - UCHAR bcn_idx = 0; + u8 bcn_idx = 0; { DBGPRINT(RT_DEBUG_ERROR, @@ -821,10 +821,10 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, RTMP_IO_WRITE32(pAd, pAd->BeaconOffset[bcn_idx] + i, 0x00); } else { - ptr = (PUCHAR) & pAd->BeaconTxWI; + ptr = (u8 *)& pAd->BeaconTxWI; for (i = 0; i < TXWI_SIZE; i += 4) /* 16-byte TXWI field */ { - UINT32 longptr = + u32 longptr = *ptr + (*(ptr + 1) << 8) + (*(ptr + 2) << 16) + (*(ptr + 3) << 24); RTMP_IO_WRITE32(pAd, pAd->BeaconOffset[bcn_idx] + i, @@ -853,7 +853,7 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, } -VOID RT28xxPciStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) +void RT28xxPciStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) { AUTO_WAKEUP_STRUC AutoWakeupCfg; @@ -949,8 +949,8 @@ VOID RT28xxPciStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) DBGPRINT(RT_DEBUG_TRACE, ("<=======RT28xxPciStaAsicForceWakeup\n")); } -VOID RT28xxPciStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp) +void RT28xxPciStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, + u16 TbttNumToNextWakeUp) { BOOLEAN brc; @@ -960,7 +960,7 @@ VOID RT28xxPciStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, } if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE) && pAd->StaCfg.PSControl.field.EnableNewPS == TRUE) { - ULONG Now = 0; + unsigned long Now = 0; if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WAKEUP_NOW)) { DBGPRINT(RT_DEBUG_TRACE, ("waking up now!\n")); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); @@ -1016,9 +1016,9 @@ VOID RT28xxPciStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, } -VOID PsPollWakeExec(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) +void PsPollWakeExec(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3) { RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; unsigned long flags; @@ -1044,9 +1044,9 @@ VOID PsPollWakeExec(IN PVOID SystemSpecific1, #endif /* PCIE_PS_SUPPORT // */ } -VOID RadioOnExec(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) +void RadioOnExec(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3) { RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; RTMP_CHIP_OP *pChipOps = &pAd->chipOps; @@ -1164,11 +1164,11 @@ VOID RadioOnExec(IN PVOID SystemSpecific1, ========================================================================== */ -BOOLEAN RT28xxPciAsicRadioOn(IN PRTMP_ADAPTER pAd, IN UCHAR Level) +BOOLEAN RT28xxPciAsicRadioOn(IN PRTMP_ADAPTER pAd, u8 Level) { /*WPDMA_GLO_CFG_STRUC DmaCfg; */ BOOLEAN Cancelled; - /*UINT32 MACValue; */ + /*u32 MACValue; */ if (pAd->OpMode == OPMODE_AP && Level == DOT11POWERSAVE) return FALSE; @@ -1287,15 +1287,15 @@ BOOLEAN RT28xxPciAsicRadioOn(IN PRTMP_ADAPTER pAd, IN UCHAR Level) ========================================================================== */ BOOLEAN RT28xxPciAsicRadioOff(IN PRTMP_ADAPTER pAd, - IN UCHAR Level, IN USHORT TbttNumToNextWakeUp) + u8 Level, u16 TbttNumToNextWakeUp) { WPDMA_GLO_CFG_STRUC DmaCfg; - UCHAR i, tempBBP_R3 = 0; + u8 i, tempBBP_R3 = 0; BOOLEAN brc = FALSE, Cancelled; - UINT32 TbTTTime = 0; - UINT32 PsPollTime = 0 /*, MACValue */ ; - ULONG BeaconPeriodTime; - UINT32 RxDmaIdx, RxCpuIdx; + u32 TbTTTime = 0; + u32 PsPollTime = 0 /*, MACValue */ ; + unsigned long BeaconPeriodTime; + u32 RxDmaIdx, RxCpuIdx; DBGPRINT(RT_DEBUG_TRACE, ("AsicRadioOff ===> Lv= %d, TxCpuIdx = %d, TxDmaIdx = %d. RxCpuIdx = %d, RxDmaIdx = %d.\n", Level, pAd->TxRing[0].TxCpuIdx, pAd->TxRing[0].TxDmaIdx, @@ -1497,7 +1497,7 @@ BOOLEAN RT28xxPciAsicRadioOff(IN PRTMP_ADAPTER pAd, return TRUE; } -VOID RT28xxPciMlmeRadioOn(IN PRTMP_ADAPTER pAd) +void RT28xxPciMlmeRadioOn(IN PRTMP_ADAPTER pAd) { if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) return; @@ -1546,7 +1546,7 @@ VOID RT28xxPciMlmeRadioOn(IN PRTMP_ADAPTER pAd) } } -VOID RT28xxPciMlmeRadioOFF(IN PRTMP_ADAPTER pAd) +void RT28xxPciMlmeRadioOFF(IN PRTMP_ADAPTER pAd) { BOOLEAN brc = TRUE; diff --git a/drivers/staging/rt2860/common/cmm_mac_usb.c b/drivers/staging/rt2860/common/cmm_mac_usb.c index 70e47db7cd51..d5bc37d82792 100644 --- a/drivers/staging/rt2860/common/cmm_mac_usb.c +++ b/drivers/staging/rt2860/common/cmm_mac_usb.c @@ -48,10 +48,10 @@ Note: NDIS packet descriptor. ======================================================================== */ -NDIS_STATUS NICInitRecv(IN PRTMP_ADAPTER pAd) +int NICInitRecv(IN PRTMP_ADAPTER pAd) { - UCHAR i; - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + u8 i; + int Status = NDIS_STATUS_SUCCESS; POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitRecv\n")); @@ -132,7 +132,7 @@ Return Value: Note: ======================================================================== */ -NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd) +int NICInitTransmit(IN PRTMP_ADAPTER pAd) { #define LM_USB_ALLOC(pObj, Context, TB_Type, BufferSize, Status, msg1, err1, msg2, err2) \ Context->pUrb = RTUSB_ALLOC_URB(0); \ @@ -159,15 +159,15 @@ NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd) Context->data_dma); \ Context->TransferBuffer = NULL; } - UCHAR i, acidx; - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + u8 i, acidx; + int Status = NDIS_STATUS_SUCCESS; PTX_CONTEXT pNullContext = &(pAd->NullContext); PTX_CONTEXT pPsPollContext = &(pAd->PsPollContext); PTX_CONTEXT pRTSContext = &(pAd->RTSContext); PTX_CONTEXT pMLMEContext = NULL; /* PHT_TX_CONTEXT pHTTXContext = NULL; */ POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - PVOID RingBaseVa; + void *RingBaseVa; /* RTMP_TX_RING *pTxRing; */ RTMP_MGMT_RING *pMgmtRing; @@ -233,7 +233,7 @@ NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd) /* Allocate MGMT ring descriptor's memory */ pAd->MgmtDescRing.AllocSize = MGMT_RING_SIZE * sizeof(TX_CONTEXT); - os_alloc_mem(pAd, (PUCHAR *) (&pAd->MgmtDescRing.AllocVa), + os_alloc_mem(pAd, (u8 **) (&pAd->MgmtDescRing.AllocVa), pAd->MgmtDescRing.AllocSize); if (pAd->MgmtDescRing.AllocVa == NULL) { DBGPRINT_ERR(("Failed to allocate a big buffer for MgmtDescRing!\n")); @@ -274,7 +274,7 @@ NDIS_STATUS NICInitTransmit(IN PRTMP_ADAPTER pAd) pMLMEContext->SelfIdx = i; /* Offset to next ring descriptor address */ - RingBaseVa = (PUCHAR) RingBaseVa + sizeof(TX_CONTEXT); + RingBaseVa = (u8 *)RingBaseVa + sizeof(TX_CONTEXT); } DBGPRINT(RT_DEBUG_TRACE, ("MGMT Ring: total %d entry allocated\n", i)); @@ -428,11 +428,11 @@ Return Value: Note: ======================================================================== */ -NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) +int RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) { /* COUNTER_802_11 pCounter = &pAd->WlanCounters; */ - NDIS_STATUS Status; - INT num; + int Status; + int num; DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPAllocTxRxRingMemory\n")); @@ -519,7 +519,7 @@ Return Value: Note: ======================================================================== */ -VOID RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) +void RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) { #define LM_URB_FREE(pObj, Context, BufferSize) \ if (NULL != Context->pUrb) { \ @@ -532,7 +532,7 @@ VOID RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) Context->data_dma); \ Context->TransferBuffer = NULL; } - UINT i, acidx; + u32 i, acidx; PTX_CONTEXT pNullContext = &pAd->NullContext; PTX_CONTEXT pPsPollContext = &pAd->PsPollContext; PTX_CONTEXT pRTSContext = &pAd->RTSContext; @@ -636,11 +636,11 @@ Return Value: Note: ======================================================================== */ -NDIS_STATUS RTUSBWriteHWMACAddress(IN PRTMP_ADAPTER pAd) +int RTUSBWriteHWMACAddress(IN PRTMP_ADAPTER pAd) { MAC_DW0_STRUC StaMacReg0; MAC_DW1_STRUC StaMacReg1; - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + int Status = NDIS_STATUS_SUCCESS; LARGE_INTEGER NOW; /* initialize the random number generator */ @@ -687,7 +687,7 @@ Return Value: Note: ======================================================================== */ -VOID RT28XXDMADisable(IN RTMP_ADAPTER * pAd) +void RT28XXDMADisable(IN RTMP_ADAPTER * pAd) { /* no use */ } @@ -706,7 +706,7 @@ Return Value: Note: ======================================================================== */ -VOID RT28XXDMAEnable(IN RTMP_ADAPTER * pAd) +void RT28XXDMAEnable(IN RTMP_ADAPTER * pAd) { WPDMA_GLO_CFG_STRUC GloCfg; USB_DMA_CFG_STRUC UsbCfg; @@ -767,18 +767,18 @@ Return Value: Note: ======================================================================== */ -VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, - IN INT apidx, - IN ULONG FrameLen, IN ULONG UpdatePos) +void RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, + int apidx, + unsigned long FrameLen, unsigned long UpdatePos) { - PUCHAR pBeaconFrame = NULL; - UCHAR *ptr; - UINT i, padding; + u8 *pBeaconFrame = NULL; + u8 *ptr; + u32 i, padding; BEACON_SYNC_STRUCT *pBeaconSync = pAd->CommonCfg.pBeaconSync; - UINT32 longValue; -/* USHORT shortValue; */ + u32 longValue; +/* u16 shortValue; */ BOOLEAN bBcnReq = FALSE; - UCHAR bcn_idx = 0; + u8 bcn_idx = 0; if (pBeaconFrame == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("pBeaconFrame is NULL!\n")); @@ -803,7 +803,7 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, (~(BEACON_BITMAP_MASK & (1 << bcn_idx))); NdisZeroMemory(pBeaconSync->BeaconTxWI[bcn_idx], TXWI_SIZE); } else { - ptr = (PUCHAR) & pAd->BeaconTxWI; + ptr = (u8 *)& pAd->BeaconTxWI; if (NdisEqualMemory(pBeaconSync->BeaconTxWI[bcn_idx], &pAd->BeaconTxWI, TXWI_SIZE) == FALSE) { /* If BeaconTxWI changed, we need to rewrite the TxWI for the Beacon frames. */ pBeaconSync->BeaconBitMap &= (~(BEACON_BITMAP_MASK & (1 << bcn_idx))); @@ -827,7 +827,7 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, ptr = pBeaconSync->BeaconBuf[bcn_idx]; padding = (FrameLen & 0x01); - NdisZeroMemory((PUCHAR) (pBeaconFrame + FrameLen), padding); + NdisZeroMemory((u8 *)(pBeaconFrame + FrameLen), padding); FrameLen += padding; for (i = 0; i < FrameLen /*HW_BEACON_OFFSET */ ; i += 2) { if (NdisEqualMemory(ptr, pBeaconFrame, 2) == FALSE) { @@ -849,7 +849,7 @@ VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, } -VOID RTUSBBssBeaconStop(IN RTMP_ADAPTER * pAd) +void RTUSBBssBeaconStop(IN RTMP_ADAPTER * pAd) { BEACON_SYNC_STRUCT *pBeaconSync; int i, offset; @@ -857,7 +857,7 @@ VOID RTUSBBssBeaconStop(IN RTMP_ADAPTER * pAd) pBeaconSync = pAd->CommonCfg.pBeaconSync; if (pBeaconSync && pBeaconSync->EnableBeacon) { - INT NumOfBcn; + int NumOfBcn; { NumOfBcn = MAX_MESH_NUM; @@ -883,7 +883,7 @@ VOID RTUSBBssBeaconStop(IN RTMP_ADAPTER * pAd) } } -VOID RTUSBBssBeaconStart(IN RTMP_ADAPTER * pAd) +void RTUSBBssBeaconStart(IN RTMP_ADAPTER * pAd) { int apidx; BEACON_SYNC_STRUCT *pBeaconSync; @@ -891,15 +891,15 @@ VOID RTUSBBssBeaconStart(IN RTMP_ADAPTER * pAd) pBeaconSync = pAd->CommonCfg.pBeaconSync; if (pBeaconSync && pBeaconSync->EnableBeacon) { - INT NumOfBcn; + int NumOfBcn; { NumOfBcn = MAX_MESH_NUM; } for (apidx = 0; apidx < NumOfBcn; apidx++) { - UCHAR CapabilityInfoLocationInBeacon = 0; - UCHAR TimIELocationInBeacon = 0; + u8 CapabilityInfoLocationInBeacon = 0; + u8 TimIELocationInBeacon = 0; NdisZeroMemory(pBeaconSync->BeaconBuf[apidx], HW_BEACON_OFFSET); @@ -929,12 +929,12 @@ VOID RTUSBBssBeaconStart(IN RTMP_ADAPTER * pAd) } } -VOID RTUSBBssBeaconInit(IN RTMP_ADAPTER * pAd) +void RTUSBBssBeaconInit(IN RTMP_ADAPTER * pAd) { BEACON_SYNC_STRUCT *pBeaconSync; int i; - os_alloc_mem(pAd, (PUCHAR *) (&pAd->CommonCfg.pBeaconSync), + os_alloc_mem(pAd, (u8 **) (&pAd->CommonCfg.pBeaconSync), sizeof(BEACON_SYNC_STRUCT)); /*NdisAllocMemory(pAd->CommonCfg.pBeaconSync, sizeof(BEACON_SYNC_STRUCT), MEM_ALLOC_FLAG); */ if (pAd->CommonCfg.pBeaconSync) { @@ -954,7 +954,7 @@ VOID RTUSBBssBeaconInit(IN RTMP_ADAPTER * pAd) } } -VOID RTUSBBssBeaconExit(IN RTMP_ADAPTER * pAd) +void RTUSBBssBeaconExit(IN RTMP_ADAPTER * pAd) { BEACON_SYNC_STRUCT *pBeaconSync; BOOLEAN Cancelled = TRUE; @@ -997,13 +997,13 @@ VOID RTUSBBssBeaconExit(IN RTMP_ADAPTER * pAd) ======================================================================== */ -VOID BeaconUpdateExec(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) +void BeaconUpdateExec(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3) { PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) FunctionContext; LARGE_INTEGER tsfTime_a; /*, tsfTime_b, deltaTime_exp, deltaTime_ab; */ - UINT32 delta, delta2MS, period2US, remain, remain_low, remain_high; + u32 delta, delta2MS, period2US, remain, remain_low, remain_high; /* BOOLEAN positive; */ if (pAd->CommonCfg.IsUpdateBeacon == TRUE) { @@ -1038,7 +1038,7 @@ VOID BeaconUpdateExec(IN PVOID SystemSpecific1, * 2870 Radio on/off Related functions. * ********************************************************************/ -VOID RT28xxUsbMlmeRadioOn(IN PRTMP_ADAPTER pAd) +void RT28xxUsbMlmeRadioOn(IN PRTMP_ADAPTER pAd) { RTMP_CHIP_OP *pChipOps = &pAd->chipOps; @@ -1068,10 +1068,10 @@ VOID RT28xxUsbMlmeRadioOn(IN PRTMP_ADAPTER pAd) RTMPSetLED(pAd, LED_RADIO_ON); } -VOID RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd) +void RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd) { WPDMA_GLO_CFG_STRUC GloCfg; - UINT32 Value, i; + u32 Value, i; DBGPRINT(RT_DEBUG_TRACE, ("RT28xxUsbMlmeRadioOFF()\n")); diff --git a/drivers/staging/rt2860/common/cmm_sanity.c b/drivers/staging/rt2860/common/cmm_sanity.c index bd1202532aa0..16cc31af3259 100644 --- a/drivers/staging/rt2860/common/cmm_sanity.c +++ b/drivers/staging/rt2860/common/cmm_sanity.c @@ -36,16 +36,16 @@ */ #include "../rt_config.h" -extern UCHAR CISCO_OUI[]; +extern u8 CISCO_OUI[]; -extern UCHAR WPA_OUI[]; -extern UCHAR RSN_OUI[]; -extern UCHAR WME_INFO_ELEM[]; -extern UCHAR WME_PARM_ELEM[]; -extern UCHAR Ccx2QosInfo[]; -extern UCHAR RALINK_OUI[]; -extern UCHAR BROADCOM_OUI[]; -extern UCHAR WPS_OUI[]; +extern u8 WPA_OUI[]; +extern u8 RSN_OUI[]; +extern u8 WME_INFO_ELEM[]; +extern u8 WME_PARM_ELEM[]; +extern u8 Ccx2QosInfo[]; +extern u8 RALINK_OUI[]; +extern u8 BROADCOM_OUI[]; +extern u8 WPS_OUI[]; /* ========================================================================== @@ -59,7 +59,7 @@ extern UCHAR WPS_OUI[]; ========================================================================== */ BOOLEAN MlmeAddBAReqSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, IN ULONG MsgLen, OUT PUCHAR pAddr2) + void * Msg, unsigned long MsgLen, u8 *pAddr2) { PMLME_ADDBA_REQ_STRUCT pInfo; @@ -97,7 +97,7 @@ BOOLEAN MlmeAddBAReqSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ -BOOLEAN MlmeDelBAReqSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULONG MsgLen) +BOOLEAN MlmeDelBAReqSanity(IN PRTMP_ADAPTER pAd, void * Msg, unsigned long MsgLen) { MLME_DELBA_REQ_STRUCT *pInfo; pInfo = (MLME_DELBA_REQ_STRUCT *) Msg; @@ -132,8 +132,8 @@ BOOLEAN MlmeDelBAReqSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULONG MsgLen) } BOOLEAN PeerAddBAReqActionSanity(IN PRTMP_ADAPTER pAd, - IN VOID * pMsg, - IN ULONG MsgLen, OUT PUCHAR pAddr2) + void * pMsg, + unsigned long MsgLen, u8 *pAddr2) { PFRAME_802_11 pFrame = (PFRAME_802_11) pMsg; PFRAME_ADDBA_REQ pAddFrame; @@ -145,8 +145,8 @@ BOOLEAN PeerAddBAReqActionSanity(IN PRTMP_ADAPTER pAd, return FALSE; } /* we support immediate BA. */ - *(USHORT *) (&pAddFrame->BaParm) = - cpu2le16(*(USHORT *) (&pAddFrame->BaParm)); + *(u16 *) (&pAddFrame->BaParm) = + cpu2le16(*(u16 *) (&pAddFrame->BaParm)); pAddFrame->TimeOutValue = cpu2le16(pAddFrame->TimeOutValue); pAddFrame->BaStartSeq.word = cpu2le16(pAddFrame->BaStartSeq.word); @@ -172,7 +172,7 @@ BOOLEAN PeerAddBAReqActionSanity(IN PRTMP_ADAPTER pAd, } BOOLEAN PeerAddBARspActionSanity(IN PRTMP_ADAPTER pAd, - IN VOID * pMsg, IN ULONG MsgLen) + void * pMsg, unsigned long MsgLen) { PFRAME_ADDBA_RSP pAddFrame; @@ -184,8 +184,8 @@ BOOLEAN PeerAddBARspActionSanity(IN PRTMP_ADAPTER pAd, return FALSE; } /* we support immediate BA. */ - *(USHORT *) (&pAddFrame->BaParm) = - cpu2le16(*(USHORT *) (&pAddFrame->BaParm)); + *(u16 *) (&pAddFrame->BaParm) = + cpu2le16(*(u16 *) (&pAddFrame->BaParm)); pAddFrame->StatusCode = cpu2le16(pAddFrame->StatusCode); pAddFrame->TimeOutValue = cpu2le16(pAddFrame->TimeOutValue); @@ -207,7 +207,7 @@ BOOLEAN PeerAddBARspActionSanity(IN PRTMP_ADAPTER pAd, } BOOLEAN PeerDelBAActionSanity(IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, IN VOID * pMsg, IN ULONG MsgLen) + u8 Wcid, void * pMsg, unsigned long MsgLen) { /*PFRAME_802_11 pFrame = (PFRAME_802_11)pMsg; */ PFRAME_DELBA_REQ pDelFrame; @@ -219,8 +219,8 @@ BOOLEAN PeerDelBAActionSanity(IN PRTMP_ADAPTER pAd, pDelFrame = (PFRAME_DELBA_REQ) (pMsg); - *(USHORT *) (&pDelFrame->DelbaParm) = - cpu2le16(*(USHORT *) (&pDelFrame->DelbaParm)); + *(u16 *) (&pDelFrame->DelbaParm) = + cpu2le16(*(u16 *) (&pDelFrame->DelbaParm)); pDelFrame->ReasonCode = cpu2le16(pDelFrame->ReasonCode); if (pDelFrame->DelbaParm.TID & 0xfff0) @@ -240,24 +240,24 @@ BOOLEAN PeerDelBAActionSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ -BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULONG MsgLen, IN UCHAR MsgChannel, OUT PUCHAR pAddr2, OUT PUCHAR pBssid, OUT CHAR Ssid[], OUT UCHAR * pSsidLen, OUT UCHAR * pBssType, OUT USHORT * pBeaconPeriod, OUT UCHAR * pChannel, OUT UCHAR * pNewChannel, OUT LARGE_INTEGER * pTimestamp, OUT CF_PARM * pCfParm, OUT USHORT * pAtimWin, OUT USHORT * pCapabilityInfo, OUT UCHAR * pErp, OUT UCHAR * pDtimCount, OUT UCHAR * pDtimPeriod, OUT UCHAR * pBcastFlag, OUT UCHAR * pMessageToMe, OUT UCHAR SupRate[], OUT UCHAR * pSupRateLen, OUT UCHAR ExtRate[], OUT UCHAR * pExtRateLen, OUT UCHAR * pCkipFlag, OUT UCHAR * pAironetCellPowerLimit, OUT PEDCA_PARM pEdcaParm, OUT PQBSS_LOAD_PARM pQbssLoad, OUT PQOS_CAPABILITY_PARM pQosCapability, OUT ULONG * pRalinkIe, OUT UCHAR * pHtCapabilityLen, OUT UCHAR * pPreNHtCapabilityLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT UCHAR * AddHtInfoLen, OUT ADD_HT_INFO_IE * AddHtInfo, OUT UCHAR * NewExtChannelOffset, /* Ht extension channel offset(above or below) */ - OUT USHORT * LengthVIE, +BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, void * Msg, unsigned long MsgLen, u8 MsgChannel, u8 *pAddr2, u8 *pBssid, char Ssid[], u8 * pSsidLen, u8 * pBssType, u16 * pBeaconPeriod, u8 * pChannel, u8 * pNewChannel, OUT LARGE_INTEGER * pTimestamp, OUT CF_PARM * pCfParm, u16 * pAtimWin, u16 * pCapabilityInfo, u8 * pErp, u8 * pDtimCount, u8 * pDtimPeriod, u8 * pBcastFlag, u8 * pMessageToMe, u8 SupRate[], u8 * pSupRateLen, u8 ExtRate[], u8 * pExtRateLen, u8 * pCkipFlag, u8 * pAironetCellPowerLimit, OUT PEDCA_PARM pEdcaParm, OUT PQBSS_LOAD_PARM pQbssLoad, OUT PQOS_CAPABILITY_PARM pQosCapability, unsigned long * pRalinkIe, u8 * pHtCapabilityLen, u8 * pPreNHtCapabilityLen, OUT HT_CAPABILITY_IE * pHtCapability, u8 * AddHtInfoLen, OUT ADD_HT_INFO_IE * AddHtInfo, u8 * NewExtChannelOffset, /* Ht extension channel offset(above or below) */ + u16 * LengthVIE, OUT PNDIS_802_11_VARIABLE_IEs pVIE) { - UCHAR *Ptr; - UCHAR TimLen; + u8 *Ptr; + u8 TimLen; PFRAME_802_11 pFrame; PEID_STRUCT pEid; - UCHAR SubType; - UCHAR Sanity; - /*UCHAR ECWMin, ECWMax; */ + u8 SubType; + u8 Sanity; + /*u8 ECWMin, ECWMax; */ /*MAC_CSR9_STRUC Csr9; */ - ULONG Length = 0; + unsigned long Length = 0; /* For some 11a AP which didn't have DS_IE, we use two conditions to decide the channel */ /* 1. If the AP is 11n enabled, then check the control channel. */ /* 2. If the AP didn't have any info about channel, use the channel we received this frame as the channel. (May inaccuracy!!) */ - UCHAR CtrlChannel = 0; + u8 CtrlChannel = 0; /* Add for 3 necessary EID field check */ Sanity = 0; @@ -287,7 +287,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON pFrame = (PFRAME_802_11) Msg; /* get subtype from header */ - SubType = (UCHAR) pFrame->Hdr.FC.SubType; + SubType = (u8)pFrame->Hdr.FC.SubType; /* get Addr2 and BSSID from header */ COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); @@ -377,17 +377,17 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON sizeof(HT_CAPABILITY_IE)); *pHtCapabilityLen = SIZE_HT_CAP_IE; /* Nnow we only support 26 bytes. */ - *(USHORT *) (&pHtCapability->HtCapInfo) = - cpu2le16(*(USHORT *) + *(u16 *) (&pHtCapability->HtCapInfo) = + cpu2le16(*(u16 *) (&pHtCapability->HtCapInfo)); - *(USHORT *) (&pHtCapability->ExtHtCapInfo) = - cpu2le16(*(USHORT *) + *(u16 *) (&pHtCapability->ExtHtCapInfo) = + cpu2le16(*(u16 *) (&pHtCapability->ExtHtCapInfo)); { *pPreNHtCapabilityLen = 0; /* Nnow we only support 26 bytes. */ - Ptr = (PUCHAR) pVIE; + Ptr = (u8 *)pVIE; NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid, pEid->Len + 2); @@ -410,15 +410,15 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON CtrlChannel = AddHtInfo->ControlChan; - *(USHORT *) (&AddHtInfo->AddHtInfo2) = - cpu2le16(*(USHORT *) + *(u16 *) (&AddHtInfo->AddHtInfo2) = + cpu2le16(*(u16 *) (&AddHtInfo->AddHtInfo2)); - *(USHORT *) (&AddHtInfo->AddHtInfo3) = - cpu2le16(*(USHORT *) + *(u16 *) (&AddHtInfo->AddHtInfo3) = + cpu2le16(*(u16 *) (&AddHtInfo->AddHtInfo3)); { - Ptr = (PUCHAR) pVIE; + Ptr = (u8 *)pVIE; NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid, pEid->Len + 2); @@ -493,7 +493,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON case IE_TIM: if (INFRA_ON(pAd) && SubType == SUBTYPE_BEACON) { - GetTimBit((PCHAR) pEid, pAd->StaActive.Aid, + GetTimBit((char *)pEid, pAd->StaActive.Aid, &TimLen, pBcastFlag, pDtimCount, pDtimPeriod, pMessageToMe); } @@ -565,14 +565,14 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON } } else if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4)) { /* Copy to pVIE which will report to microsoft bssid list. */ - Ptr = (PUCHAR) pVIE; + Ptr = (u8 *)pVIE; NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid, pEid->Len + 2); *LengthVIE += (pEid->Len + 2); } else if (NdisEqualMemory(pEid->Octet, WME_PARM_ELEM, 6) && (pEid->Len == 24)) { - PUCHAR ptr; + u8 *ptr; int i; /* parsing EDCA parameters */ @@ -586,7 +586,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON (pEid->Octet[6] & 0x80) ? 1 : 0; ptr = &pEid->Octet[8]; for (i = 0; i < 4; i++) { - UCHAR aci = (*ptr & 0x60) >> 5; /* b5~6 is AC INDEX */ + u8 aci = (*ptr & 0x60) >> 5; /* b5~6 is AC INDEX */ pEdcaParm->bACM[aci] = (((*ptr) & 0x10) == 0x10); /* b5 is ACM */ pEdcaParm->Aifsn[aci] = (*ptr) & 0x0f; /* b0~3 is AIFSN */ pEdcaParm->Cwmin[aci] = *(ptr + 1) & 0x0f; /* b0~4 is Cwmin */ @@ -653,7 +653,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON case IE_ERP: if (pEid->Len == 1) { - *pErp = (UCHAR) pEid->Octet[0]; + *pErp = (u8)pEid->Octet[0]; } break; @@ -684,7 +684,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON /* There is no OUI for version anymore, check the group cipher OUI before copying */ if (RTMPEqualMemory(pEid->Octet + 2, RSN_OUI, 3)) { /* Copy to pVIE which will report to microsoft bssid list. */ - Ptr = (PUCHAR) pVIE; + Ptr = (u8 *)pVIE; NdisMoveMemory(Ptr + *LengthVIE, &pEid->Eid, pEid->Len + 2); *LengthVIE += (pEid->Len + 2); @@ -696,12 +696,12 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON } Length = Length + 2 + pEid->Len; /* Eid[1] + Len[1]+ content[Len] */ - pEid = (PEID_STRUCT) ((UCHAR *) pEid + 2 + pEid->Len); + pEid = (PEID_STRUCT) ((u8 *) pEid + 2 + pEid->Len); } /* For some 11a AP. it did not have the channel EID, patch here */ { - UCHAR LatchRfChannel = MsgChannel; + u8 LatchRfChannel = MsgChannel; if ((pAd->LatchRfRegs.Channel > 14) && ((Sanity & 0x4) == 0)) { if (CtrlChannel != 0) *pChannel = CtrlChannel; @@ -731,11 +731,11 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * Msg, IN ULON ========================================================================== */ BOOLEAN MlmeScanReqSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, - IN ULONG MsgLen, - OUT UCHAR * pBssType, - OUT CHAR Ssid[], - OUT UCHAR * pSsidLen, OUT UCHAR * pScanType) + void * Msg, + unsigned long MsgLen, + u8 * pBssType, + char Ssid[], + u8 * pSsidLen, u8 * pScanType) { MLME_SCAN_REQ_STRUCT *Info; @@ -757,7 +757,7 @@ BOOLEAN MlmeScanReqSanity(IN PRTMP_ADAPTER pAd, } /* IRQL = DISPATCH_LEVEL */ -UCHAR ChannelSanity(IN PRTMP_ADAPTER pAd, IN UCHAR channel) +u8 ChannelSanity(IN PRTMP_ADAPTER pAd, u8 channel) { int i; @@ -780,9 +780,9 @@ UCHAR ChannelSanity(IN PRTMP_ADAPTER pAd, IN UCHAR channel) ========================================================================== */ BOOLEAN PeerDeauthSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, OUT USHORT * pReason) + void * Msg, + unsigned long MsgLen, + u8 *pAddr2, u16 * pReason) { PFRAME_802_11 pFrame = (PFRAME_802_11) Msg; @@ -804,12 +804,12 @@ BOOLEAN PeerDeauthSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ BOOLEAN PeerAuthSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr, - OUT USHORT * pAlg, - OUT USHORT * pSeq, - OUT USHORT * pStatus, CHAR * pChlgText) + void * Msg, + unsigned long MsgLen, + u8 *pAddr, + u16 * pAlg, + u16 * pSeq, + u16 * pStatus, char * pChlgText) { PFRAME_802_11 pFrame = (PFRAME_802_11) Msg; @@ -854,10 +854,10 @@ BOOLEAN PeerAuthSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ BOOLEAN MlmeAuthReqSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr, - OUT ULONG * pTimeout, OUT USHORT * pAlg) + void * Msg, + unsigned long MsgLen, + u8 *pAddr, + unsigned long * pTimeout, u16 * pAlg) { MLME_AUTH_REQ_STRUCT *pInfo; @@ -888,11 +888,11 @@ BOOLEAN MlmeAuthReqSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ BOOLEAN MlmeAssocReqSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, - IN ULONG MsgLen, - OUT PUCHAR pApAddr, - OUT USHORT * pCapabilityInfo, - OUT ULONG * pTimeout, OUT USHORT * pListenIntv) + void * Msg, + unsigned long MsgLen, + u8 *pApAddr, + u16 * pCapabilityInfo, + unsigned long * pTimeout, u16 * pListenIntv) { MLME_ASSOC_REQ_STRUCT *pInfo; @@ -917,9 +917,9 @@ BOOLEAN MlmeAssocReqSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ BOOLEAN PeerDisassocSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, OUT USHORT * pReason) + void * Msg, + unsigned long MsgLen, + u8 *pAddr2, u16 * pReason) { PFRAME_802_11 pFrame = (PFRAME_802_11) Msg; @@ -949,7 +949,7 @@ BOOLEAN PeerDisassocSanity(IN PRTMP_ADAPTER pAd, NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity(IN PBSS_ENTRY pBss) { NDIS_802_11_NETWORK_TYPE NetWorkType; - UCHAR rate, i; + u8 rate, i; NetWorkType = Ndis802_11DS; @@ -1014,24 +1014,24 @@ NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity(IN PBSS_ENTRY pBss) */ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, IN PEAPOL_PACKET pMsg, - IN ULONG MsgLen, - IN UCHAR MsgType, IN MAC_TABLE_ENTRY * pEntry) + unsigned long MsgLen, + u8 MsgType, IN MAC_TABLE_ENTRY * pEntry) { - UCHAR mic[LEN_KEY_DESC_MIC], digest[80], KEYDATA[MAX_LEN_OF_RSNIE]; + u8 mic[LEN_KEY_DESC_MIC], digest[80], KEYDATA[MAX_LEN_OF_RSNIE]; BOOLEAN bReplayDiff = FALSE; BOOLEAN bWPA2 = FALSE; KEY_INFO EapolKeyInfo; - UCHAR GroupKeyIndex = 0; + u8 GroupKeyIndex = 0; NdisZeroMemory(mic, sizeof(mic)); NdisZeroMemory(digest, sizeof(digest)); NdisZeroMemory(KEYDATA, sizeof(KEYDATA)); - NdisZeroMemory((PUCHAR) & EapolKeyInfo, sizeof(EapolKeyInfo)); + NdisZeroMemory((u8 *)& EapolKeyInfo, sizeof(EapolKeyInfo)); - NdisMoveMemory((PUCHAR) & EapolKeyInfo, - (PUCHAR) & pMsg->KeyDesc.KeyInfo, sizeof(KEY_INFO)); + NdisMoveMemory((u8 *)& EapolKeyInfo, + (u8 *)& pMsg->KeyDesc.KeyInfo, sizeof(KEY_INFO)); - *((USHORT *) & EapolKeyInfo) = cpu2le16(*((USHORT *) & EapolKeyInfo)); + *((u16 *) & EapolKeyInfo) = cpu2le16(*((u16 *) & EapolKeyInfo)); /* Choose WPA2 or not */ if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) @@ -1049,7 +1049,7 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, { /* First validate replay counter, only accept message with larger replay counter. */ /* Let equal pass, some AP start with all zero replay counter */ - UCHAR ZeroReplay[LEN_KEY_DESC_REPLAY]; + u8 ZeroReplay[LEN_KEY_DESC_REPLAY]; NdisZeroMemory(ZeroReplay, LEN_KEY_DESC_REPLAY); if ((RTMPCompareMemory @@ -1096,7 +1096,7 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, } /* 2. Verify MIC except Pairwise Msg1 */ if (MsgType != EAPOL_PAIR_MSG_1) { - UCHAR rcvd_mic[LEN_KEY_DESC_MIC]; + u8 rcvd_mic[LEN_KEY_DESC_MIC]; /* Record the received MIC for check later */ NdisMoveMemory(rcvd_mic, pMsg->KeyDesc.KeyMic, @@ -1105,11 +1105,11 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, if (EapolKeyInfo.KeyDescVer == DESC_TYPE_TKIP) /* TKIP */ { - HMAC_MD5(pEntry->PTK, LEN_EAP_MICK, (PUCHAR) pMsg, + HMAC_MD5(pEntry->PTK, LEN_EAP_MICK, (u8 *)pMsg, MsgLen, mic, MD5_DIGEST_SIZE); } else if (EapolKeyInfo.KeyDescVer == DESC_TYPE_AES) /* AES */ { - HMAC_SHA1(pEntry->PTK, LEN_EAP_MICK, (PUCHAR) pMsg, + HMAC_SHA1(pEntry->PTK, LEN_EAP_MICK, (u8 *)pMsg, MsgLen, digest, SHA1_DIGEST_SIZE); NdisMoveMemory(mic, digest, LEN_KEY_DESC_MIC); } @@ -1142,20 +1142,20 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, /* 2. Extract the context of the Key Data field if it exist. */ /* The field in pairwise_msg_2_WPA1(WPA2) & pairwise_msg_3_WPA1 is clear. */ /* The field in group_msg_1_WPA1(WPA2) & pairwise_msg_3_WPA2 is encrypted. */ - if (CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyDataLen) > 0) { + if (CONV_ARRARY_TO_u16(pMsg->KeyDesc.KeyDataLen) > 0) { /* Decrypt this field */ if ((MsgType == EAPOL_PAIR_MSG_3 && bWPA2) || (MsgType == EAPOL_GROUP_MSG_1)) { if ((EapolKeyInfo.KeyDescVer == DESC_TYPE_AES)) { /* AES */ AES_GTK_KEY_UNWRAP(&pEntry->PTK[16], KEYDATA, - CONV_ARRARY_TO_UINT16(pMsg-> + CONV_ARRARY_TO_u16(pMsg-> KeyDesc. KeyDataLen), pMsg->KeyDesc.KeyData); } else { - INT i; - UCHAR Key[32]; + int i; + u8 Key[32]; /* Decrypt TKIP GTK */ /* Construct 32 bytes RC4 Key */ NdisMoveMemory(Key, pMsg->KeyDesc.KeyIv, 16); @@ -1169,7 +1169,7 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, /* Decrypt GTK. Becareful, there is no ICV to check the result is correct or not */ ARCFOUR_DECRYPT(&pAd->PrivateInfo.WEPCONTEXT, KEYDATA, pMsg->KeyDesc.KeyData, - CONV_ARRARY_TO_UINT16(pMsg-> + CONV_ARRARY_TO_u16(pMsg-> KeyDesc. KeyDataLen)); } @@ -1180,7 +1180,7 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, } else if ((MsgType == EAPOL_PAIR_MSG_2) || (MsgType == EAPOL_PAIR_MSG_3 && !bWPA2)) { NdisMoveMemory(KEYDATA, pMsg->KeyDesc.KeyData, - CONV_ARRARY_TO_UINT16(pMsg->KeyDesc. + CONV_ARRARY_TO_u16(pMsg->KeyDesc. KeyDataLen)); } else { @@ -1192,7 +1192,7 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, /* 2. verify KDE format for pairwise_msg_3_WPA2, group_msg_1_WPA2 */ /* 3. update shared key for pairwise_msg_3_WPA2, group_msg_1_WPA1(WPA2) */ if (!RTMPParseEapolKeyData(pAd, KEYDATA, - CONV_ARRARY_TO_UINT16(pMsg->KeyDesc. + CONV_ARRARY_TO_u16(pMsg->KeyDesc. KeyDataLen), GroupKeyIndex, MsgType, bWPA2, pEntry)) { diff --git a/drivers/staging/rt2860/common/cmm_sync.c b/drivers/staging/rt2860/common/cmm_sync.c index c29e087a41d2..2d7f36a3e62c 100644 --- a/drivers/staging/rt2860/common/cmm_sync.c +++ b/drivers/staging/rt2860/common/cmm_sync.c @@ -57,41 +57,41 @@ #define BG_BAND_REGION_31_SIZE 14 /* 5 Ghz channel plan index in the TxPower arrays. */ -UCHAR A_BAND_REGION_0_CHANNEL_LIST[] = +u8 A_BAND_REGION_0_CHANNEL_LIST[] = { 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165 }; -UCHAR A_BAND_REGION_1_CHANNEL_LIST[] = +u8 A_BAND_REGION_1_CHANNEL_LIST[] = { 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 }; -UCHAR A_BAND_REGION_2_CHANNEL_LIST[] = { 36, 40, 44, 48, 52, 56, 60, 64 }; -UCHAR A_BAND_REGION_3_CHANNEL_LIST[] = { 52, 56, 60, 64, 149, 153, 157, 161 }; -UCHAR A_BAND_REGION_4_CHANNEL_LIST[] = { 149, 153, 157, 161, 165 }; -UCHAR A_BAND_REGION_5_CHANNEL_LIST[] = { 149, 153, 157, 161 }; -UCHAR A_BAND_REGION_6_CHANNEL_LIST[] = { 36, 40, 44, 48 }; -UCHAR A_BAND_REGION_7_CHANNEL_LIST[] = +u8 A_BAND_REGION_2_CHANNEL_LIST[] = { 36, 40, 44, 48, 52, 56, 60, 64 }; +u8 A_BAND_REGION_3_CHANNEL_LIST[] = { 52, 56, 60, 64, 149, 153, 157, 161 }; +u8 A_BAND_REGION_4_CHANNEL_LIST[] = { 149, 153, 157, 161, 165 }; +u8 A_BAND_REGION_5_CHANNEL_LIST[] = { 149, 153, 157, 161 }; +u8 A_BAND_REGION_6_CHANNEL_LIST[] = { 36, 40, 44, 48 }; +u8 A_BAND_REGION_7_CHANNEL_LIST[] = { 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173 }; -UCHAR A_BAND_REGION_8_CHANNEL_LIST[] = { 52, 56, 60, 64 }; -UCHAR A_BAND_REGION_9_CHANNEL_LIST[] = +u8 A_BAND_REGION_8_CHANNEL_LIST[] = { 52, 56, 60, 64 }; +u8 A_BAND_REGION_9_CHANNEL_LIST[] = { 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165 }; -UCHAR A_BAND_REGION_10_CHANNEL_LIST[] = +u8 A_BAND_REGION_10_CHANNEL_LIST[] = { 36, 40, 44, 48, 149, 153, 157, 161, 165 }; -UCHAR A_BAND_REGION_11_CHANNEL_LIST[] = +u8 A_BAND_REGION_11_CHANNEL_LIST[] = { 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 149, 153, 157, 161 }; -UCHAR A_BAND_REGION_12_CHANNEL_LIST[] = +u8 A_BAND_REGION_12_CHANNEL_LIST[] = { 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 }; -UCHAR A_BAND_REGION_13_CHANNEL_LIST[] = +u8 A_BAND_REGION_13_CHANNEL_LIST[] = { 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161 }; -UCHAR A_BAND_REGION_14_CHANNEL_LIST[] = +u8 A_BAND_REGION_14_CHANNEL_LIST[] = { 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 136, 140, 149, 153, 157, 161, 165 }; -UCHAR A_BAND_REGION_15_CHANNEL_LIST[] = { 149, 153, 157, 161, 165, 169, 173 }; +u8 A_BAND_REGION_15_CHANNEL_LIST[] = { 149, 153, 157, 161, 165, 169, 173 }; /*BaSizeArray follows the 802.11n definition as MaxRxFactor. 2^(13+factor) bytes. When factor =0, it's about Ba buffer size =8. */ -UCHAR BaSizeArray[4] = { 8, 16, 32, 64 }; +u8 BaSizeArray[4] = { 8, 16, 32, 64 }; /* ========================================================================== @@ -105,10 +105,10 @@ UCHAR BaSizeArray[4] = { 8, 16, 32, 64 }; ========================================================================== */ -VOID BuildChannelList(IN PRTMP_ADAPTER pAd) +void BuildChannelList(IN PRTMP_ADAPTER pAd) { - UCHAR i, j, index = 0, num = 0; - PUCHAR pChannelList = NULL; + u8 i, j, index = 0, num = 0; + u8 *pChannelList = NULL; NdisZeroMemory(pAd->ChannelList, MAX_NUM_OF_CHANNELS * sizeof(CHANNEL_TX_POWER)); @@ -200,99 +200,99 @@ VOID BuildChannelList(IN PRTMP_ADAPTER pAd) case REGION_0_A_BAND: num = sizeof(A_BAND_REGION_0_CHANNEL_LIST) / - sizeof(UCHAR); + sizeof(u8); pChannelList = A_BAND_REGION_0_CHANNEL_LIST; break; case REGION_1_A_BAND: num = sizeof(A_BAND_REGION_1_CHANNEL_LIST) / - sizeof(UCHAR); + sizeof(u8); pChannelList = A_BAND_REGION_1_CHANNEL_LIST; break; case REGION_2_A_BAND: num = sizeof(A_BAND_REGION_2_CHANNEL_LIST) / - sizeof(UCHAR); + sizeof(u8); pChannelList = A_BAND_REGION_2_CHANNEL_LIST; break; case REGION_3_A_BAND: num = sizeof(A_BAND_REGION_3_CHANNEL_LIST) / - sizeof(UCHAR); + sizeof(u8); pChannelList = A_BAND_REGION_3_CHANNEL_LIST; break; case REGION_4_A_BAND: num = sizeof(A_BAND_REGION_4_CHANNEL_LIST) / - sizeof(UCHAR); + sizeof(u8); pChannelList = A_BAND_REGION_4_CHANNEL_LIST; break; case REGION_5_A_BAND: num = sizeof(A_BAND_REGION_5_CHANNEL_LIST) / - sizeof(UCHAR); + sizeof(u8); pChannelList = A_BAND_REGION_5_CHANNEL_LIST; break; case REGION_6_A_BAND: num = sizeof(A_BAND_REGION_6_CHANNEL_LIST) / - sizeof(UCHAR); + sizeof(u8); pChannelList = A_BAND_REGION_6_CHANNEL_LIST; break; case REGION_7_A_BAND: num = sizeof(A_BAND_REGION_7_CHANNEL_LIST) / - sizeof(UCHAR); + sizeof(u8); pChannelList = A_BAND_REGION_7_CHANNEL_LIST; break; case REGION_8_A_BAND: num = sizeof(A_BAND_REGION_8_CHANNEL_LIST) / - sizeof(UCHAR); + sizeof(u8); pChannelList = A_BAND_REGION_8_CHANNEL_LIST; break; case REGION_9_A_BAND: num = sizeof(A_BAND_REGION_9_CHANNEL_LIST) / - sizeof(UCHAR); + sizeof(u8); pChannelList = A_BAND_REGION_9_CHANNEL_LIST; break; case REGION_10_A_BAND: num = sizeof(A_BAND_REGION_10_CHANNEL_LIST) / - sizeof(UCHAR); + sizeof(u8); pChannelList = A_BAND_REGION_10_CHANNEL_LIST; break; case REGION_11_A_BAND: num = sizeof(A_BAND_REGION_11_CHANNEL_LIST) / - sizeof(UCHAR); + sizeof(u8); pChannelList = A_BAND_REGION_11_CHANNEL_LIST; break; case REGION_12_A_BAND: num = sizeof(A_BAND_REGION_12_CHANNEL_LIST) / - sizeof(UCHAR); + sizeof(u8); pChannelList = A_BAND_REGION_12_CHANNEL_LIST; break; case REGION_13_A_BAND: num = sizeof(A_BAND_REGION_13_CHANNEL_LIST) / - sizeof(UCHAR); + sizeof(u8); pChannelList = A_BAND_REGION_13_CHANNEL_LIST; break; case REGION_14_A_BAND: num = sizeof(A_BAND_REGION_14_CHANNEL_LIST) / - sizeof(UCHAR); + sizeof(u8); pChannelList = A_BAND_REGION_14_CHANNEL_LIST; break; case REGION_15_A_BAND: num = sizeof(A_BAND_REGION_15_CHANNEL_LIST) / - sizeof(UCHAR); + sizeof(u8); pChannelList = A_BAND_REGION_15_CHANNEL_LIST; break; default: /* Error. should never happen */ @@ -303,7 +303,7 @@ VOID BuildChannelList(IN PRTMP_ADAPTER pAd) } if (num != 0) { - UCHAR RadarCh[15] = + u8 RadarCh[15] = { 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 }; for (i = 0; i < num; i++) { @@ -359,7 +359,7 @@ VOID BuildChannelList(IN PRTMP_ADAPTER pAd) ========================================================================== */ -UCHAR FirstChannel(IN PRTMP_ADAPTER pAd) +u8 FirstChannel(IN PRTMP_ADAPTER pAd) { return pAd->ChannelList[0].Channel; } @@ -375,10 +375,10 @@ UCHAR FirstChannel(IN PRTMP_ADAPTER pAd) return 0 if no more next channel ========================================================================== */ -UCHAR NextChannel(IN PRTMP_ADAPTER pAd, IN UCHAR channel) +u8 NextChannel(IN PRTMP_ADAPTER pAd, u8 channel) { int i; - UCHAR next_channel = 0; + u8 next_channel = 0; for (i = 0; i < (pAd->ChannelListNum - 1); i++) if (channel == pAd->ChannelList[i].Channel) { @@ -408,8 +408,8 @@ UCHAR NextChannel(IN PRTMP_ADAPTER pAd, IN UCHAR channel) the minimum value or next lower value. ========================================================================== */ -VOID ChangeToCellPowerLimit(IN PRTMP_ADAPTER pAd, - IN UCHAR AironetCellPowerLimit) +void ChangeToCellPowerLimit(IN PRTMP_ADAPTER pAd, + u8 AironetCellPowerLimit) { /*valud 0xFF means that hasn't found power limit information */ /*from the AP's Beacon/Probe response. */ @@ -435,9 +435,9 @@ VOID ChangeToCellPowerLimit(IN PRTMP_ADAPTER pAd, } -CHAR ConvertToRssi(IN PRTMP_ADAPTER pAd, IN CHAR Rssi, IN UCHAR RssiNumber) +char ConvertToRssi(IN PRTMP_ADAPTER pAd, char Rssi, u8 RssiNumber) { - UCHAR RssiOffset, LNAGain; + u8 RssiOffset, LNAGain; /* Rssi equals to zero should be an invalid value */ if (Rssi == 0) @@ -469,16 +469,16 @@ CHAR ConvertToRssi(IN PRTMP_ADAPTER pAd, IN CHAR Rssi, IN UCHAR RssiNumber) Scan next channel ========================================================================== */ -VOID ScanNextChannel(IN PRTMP_ADAPTER pAd) +void ScanNextChannel(IN PRTMP_ADAPTER pAd) { HEADER_802_11 Hdr80211; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - UCHAR SsidLen = 0, ScanType = pAd->MlmeAux.ScanType, BBPValue = 0; - USHORT Status; + u8 *pOutBuffer = NULL; + int NStatus; + unsigned long FrameLen = 0; + u8 SsidLen = 0, ScanType = pAd->MlmeAux.ScanType, BBPValue = 0; + u16 Status; PHEADER_802_11 pHdr80211; - UINT ScanTimeIn5gChannel = SHORT_CHANNEL_TIME; + u32 ScanTimeIn5gChannel = SHORT_CHANNEL_TIME; { if (MONITOR_ON(pAd)) @@ -520,7 +520,7 @@ VOID ScanNextChannel(IN PRTMP_ADAPTER pAd) && (INFRA_ON(pAd))) { NStatus = MlmeAllocateMemory(pAd, - (PVOID) & pOutBuffer); + (void *)& pOutBuffer); if (NStatus == NDIS_STATUS_SUCCESS) { pHdr80211 = (PHEADER_802_11) pOutBuffer; MgtMacHeaderInit(pAd, pHdr80211, @@ -650,7 +650,7 @@ VOID ScanNextChannel(IN PRTMP_ADAPTER pAd) pAd->CommonCfg.SupRate, END_OF_ARGS); if (pAd->CommonCfg.ExtRateLen) { - ULONG Tmp; + unsigned long Tmp; MakeOutgoingFrame(pOutBuffer + FrameLen, &Tmp, 1, &ExtRateIe, 1, &pAd->CommonCfg.ExtRateLen, @@ -661,9 +661,9 @@ VOID ScanNextChannel(IN PRTMP_ADAPTER pAd) } if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) { - ULONG Tmp; - UCHAR HtLen; - UCHAR BROADCOM[4] = { 0x0, 0x90, 0x4c, 0x33 }; + unsigned long Tmp; + u8 HtLen; + u8 BROADCOM[4] = { 0x0, 0x90, 0x4c, 0x33 }; if (pAd->bBroadComHT == TRUE) { HtLen = @@ -700,10 +700,10 @@ VOID ScanNextChannel(IN PRTMP_ADAPTER pAd) } } -VOID MgtProbReqMacHeaderInit(IN PRTMP_ADAPTER pAd, +void MgtProbReqMacHeaderInit(IN PRTMP_ADAPTER pAd, IN OUT PHEADER_802_11 pHdr80211, - IN UCHAR SubType, - IN UCHAR ToDs, IN PUCHAR pDA, IN PUCHAR pBssid) + u8 SubType, + u8 ToDs, u8 *pDA, u8 *pBssid) { NdisZeroMemory(pHdr80211, sizeof(HEADER_802_11)); diff --git a/drivers/staging/rt2860/common/cmm_tkip.c b/drivers/staging/rt2860/common/cmm_tkip.c index 97f0543a7a1f..ab00a0c5e3e3 100644 --- a/drivers/staging/rt2860/common/cmm_tkip.c +++ b/drivers/staging/rt2860/common/cmm_tkip.c @@ -42,7 +42,7 @@ ( ((A) << (n)) | ( ((A)>>(32-(n))) & ( (1UL << (n)) - 1 ) ) ) #define ROR32( A, n ) ROL32( (A), 32-(n) ) -UINT Tkip_Sbox_Lower[256] = { +u32 Tkip_Sbox_Lower[256] = { 0xA5, 0x84, 0x99, 0x8D, 0x0D, 0xBD, 0xB1, 0x54, 0x50, 0x03, 0xA9, 0x7D, 0x19, 0x62, 0xE6, 0x9A, 0x45, 0x9D, 0x40, 0x87, 0x15, 0xEB, 0xC9, 0x0B, @@ -77,7 +77,7 @@ UINT Tkip_Sbox_Lower[256] = { 0xC3, 0xB0, 0x77, 0x11, 0xCB, 0xFC, 0xD6, 0x3A }; -UINT Tkip_Sbox_Upper[256] = { +u32 Tkip_Sbox_Upper[256] = { 0xC6, 0xF8, 0xEE, 0xF6, 0xFF, 0xD6, 0xDE, 0x91, 0x60, 0x02, 0xCE, 0x56, 0xE7, 0xB5, 0x4D, 0xEC, 0x8F, 0x1F, 0x89, 0xFA, 0xEF, 0xB2, 0x8E, 0xFB, @@ -118,31 +118,31 @@ UINT Tkip_Sbox_Upper[256] = { typedef struct PACKED _IV_CONTROL_ { union PACKED { struct PACKED { - UCHAR rc0; - UCHAR rc1; - UCHAR rc2; + u8 rc0; + u8 rc1; + u8 rc2; union PACKED { struct PACKED { - UCHAR Rsvd:5; - UCHAR ExtIV:1; - UCHAR KeyID:2; + u8 Rsvd:5; + u8 ExtIV:1; + u8 KeyID:2; } field; - UCHAR Byte; + u8 Byte; } CONTROL; } field; - ULONG word; + unsigned long word; } IV16; - ULONG IV32; + unsigned long IV32; } TKIP_IV, *PTKIP_IV; /* ======================================================================== Routine Description: - Convert from UCHAR[] to ULONG in a portable way + Convert from u8[] to unsigned long in a portable way Arguments: pMICKey pointer to MIC Key @@ -154,10 +154,10 @@ typedef struct PACKED _IV_CONTROL_ { ======================================================================== */ -ULONG RTMPTkipGetUInt32(IN PUCHAR pMICKey) +unsigned long RTMPTkipGetUInt32(u8 *pMICKey) { - ULONG res = 0; - INT i; + unsigned long res = 0; + int i; for (i = 0; i < 4; i++) { res |= (*pMICKey++) << (8 * i); @@ -170,10 +170,10 @@ ULONG RTMPTkipGetUInt32(IN PUCHAR pMICKey) ======================================================================== Routine Description: - Convert from ULONG to UCHAR[] in a portable way + Convert from unsigned long to u8[] in a portable way Arguments: - pDst pointer to destination for convert ULONG to UCHAR[] + pDst pointer to destination for convert unsigned long to u8[] val the value for convert Return Value: @@ -185,12 +185,12 @@ ULONG RTMPTkipGetUInt32(IN PUCHAR pMICKey) ======================================================================== */ -VOID RTMPTkipPutUInt32(IN OUT PUCHAR pDst, IN ULONG val) +void RTMPTkipPutUInt32(IN u8 *pDst, unsigned long val) { - INT i; + int i; for (i = 0; i < 4; i++) { - *pDst++ = (UCHAR) (val & 0xff); + *pDst++ = (u8)(val & 0xff); val >>= 8; } } @@ -214,7 +214,7 @@ VOID RTMPTkipPutUInt32(IN OUT PUCHAR pDst, IN ULONG val) ======================================================================== */ -VOID RTMPTkipSetMICKey(IN PTKIP_KEY_INFO pTkip, IN PUCHAR pMICKey) +void RTMPTkipSetMICKey(IN PTKIP_KEY_INFO pTkip, u8 *pMICKey) { /* Set the key */ pTkip->K0 = RTMPTkipGetUInt32(pMICKey); @@ -245,7 +245,7 @@ VOID RTMPTkipSetMICKey(IN PTKIP_KEY_INFO pTkip, IN PUCHAR pMICKey) ======================================================================== */ -VOID RTMPTkipAppendByte(IN PTKIP_KEY_INFO pTkip, IN UCHAR uChar) +void RTMPTkipAppendByte(IN PTKIP_KEY_INFO pTkip, u8 uChar) { /* Append the byte to our word-sized buffer */ pTkip->M |= (uChar << (8 * pTkip->nBytesInM)); @@ -289,7 +289,7 @@ VOID RTMPTkipAppendByte(IN PTKIP_KEY_INFO pTkip, IN UCHAR uChar) ======================================================================== */ -VOID RTMPTkipAppend(IN PTKIP_KEY_INFO pTkip, IN PUCHAR pSrc, IN UINT nBytes) +void RTMPTkipAppend(IN PTKIP_KEY_INFO pTkip, u8 *pSrc, u32 nBytes) { /* This is simple */ while (nBytes > 0) { @@ -316,7 +316,7 @@ VOID RTMPTkipAppend(IN PTKIP_KEY_INFO pTkip, IN PUCHAR pSrc, IN UINT nBytes) the MIC Value is store in pAd->PrivateInfo.MIC ======================================================================== */ -VOID RTMPTkipGetMIC(IN PTKIP_KEY_INFO pTkip) +void RTMPTkipGetMIC(IN PTKIP_KEY_INFO pTkip) { /* Append the minimum padding */ RTMPTkipAppendByte(pTkip, 0x5a); @@ -355,12 +355,12 @@ VOID RTMPTkipGetMIC(IN PTKIP_KEY_INFO pTkip) ======================================================================== */ -VOID RTMPInitTkipEngine(IN PRTMP_ADAPTER pAd, - IN PUCHAR pKey, - IN UCHAR KeyId, - IN PUCHAR pTA, - IN PUCHAR pMICKey, - IN PUCHAR pTSC, OUT PULONG pIV16, OUT PULONG pIV32) +void RTMPInitTkipEngine(IN PRTMP_ADAPTER pAd, + u8 *pKey, + u8 KeyId, + u8 *pTA, + u8 *pMICKey, + u8 *pTSC, unsigned long *pIV16, unsigned long *pIV32) { TKIP_IV tkipIv; @@ -371,7 +371,7 @@ VOID RTMPInitTkipEngine(IN PRTMP_ADAPTER pAd, tkipIv.IV16.field.rc2 = *pTSC; tkipIv.IV16.field.CONTROL.field.ExtIV = 1; /* 0: non-extended IV, 1: an extended IV */ tkipIv.IV16.field.CONTROL.field.KeyID = KeyId; -/* tkipIv.IV32 = *(PULONG)(pTSC + 2); */ +/* tkipIv.IV32 = *(unsigned long *)(pTSC + 2); */ NdisMoveMemory(&tkipIv.IV32, (pTSC + 2), 4); /* Copy IV */ *pIV16 = tkipIv.IV16.word; @@ -399,12 +399,12 @@ VOID RTMPInitTkipEngine(IN PRTMP_ADAPTER pAd, ======================================================================== */ -VOID RTMPInitMICEngine(IN PRTMP_ADAPTER pAd, - IN PUCHAR pKey, - IN PUCHAR pDA, - IN PUCHAR pSA, IN UCHAR UserPriority, IN PUCHAR pMICKey) +void RTMPInitMICEngine(IN PRTMP_ADAPTER pAd, + u8 *pKey, + u8 *pDA, + u8 *pSA, u8 UserPriority, u8 *pMICKey) { - ULONG Priority = UserPriority; + unsigned long Priority = UserPriority; /* Init MIC value calculation */ RTMPTkipSetMICKey(&pAd->PrivateInfo.Tx, pMICKey); @@ -413,7 +413,7 @@ VOID RTMPInitMICEngine(IN PRTMP_ADAPTER pAd, /* SA */ RTMPTkipAppend(&pAd->PrivateInfo.Tx, pSA, MAC_ADDR_LEN); /* Priority + 3 bytes of 0 */ - RTMPTkipAppend(&pAd->PrivateInfo.Tx, (PUCHAR) & Priority, 4); + RTMPTkipAppend(&pAd->PrivateInfo.Tx, (u8 *)& Priority, 4); } /* @@ -441,14 +441,14 @@ VOID RTMPInitMICEngine(IN PRTMP_ADAPTER pAd, ======================================================================== */ BOOLEAN RTMPTkipCompareMICValue(IN PRTMP_ADAPTER pAd, - IN PUCHAR pSrc, - IN PUCHAR pDA, - IN PUCHAR pSA, - IN PUCHAR pMICKey, - IN UCHAR UserPriority, IN UINT Len) + u8 *pSrc, + u8 *pDA, + u8 *pSA, + u8 *pMICKey, + u8 UserPriority, u32 Len) { - UCHAR OldMic[8]; - ULONG Priority = UserPriority; + u8 OldMic[8]; + unsigned long Priority = UserPriority; /* Init MIC value calculation */ RTMPTkipSetMICKey(&pAd->PrivateInfo.Rx, pMICKey); @@ -457,7 +457,7 @@ BOOLEAN RTMPTkipCompareMICValue(IN PRTMP_ADAPTER pAd, /* SA */ RTMPTkipAppend(&pAd->PrivateInfo.Rx, pSA, MAC_ADDR_LEN); /* Priority + 3 bytes of 0 */ - RTMPTkipAppend(&pAd->PrivateInfo.Rx, (PUCHAR) & Priority, 4); + RTMPTkipAppend(&pAd->PrivateInfo.Rx, (u8 *)& Priority, 4); /* Calculate MIC value from plain text data */ RTMPTkipAppend(&pAd->PrivateInfo.Rx, pSrc, Len); @@ -500,17 +500,17 @@ BOOLEAN RTMPTkipCompareMICValue(IN PRTMP_ADAPTER pAd, ======================================================================== */ -VOID RTMPCalculateMICValue(IN PRTMP_ADAPTER pAd, +void RTMPCalculateMICValue(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket, - IN PUCHAR pEncap, - IN PCIPHER_KEY pKey, IN UCHAR apidx) + u8 *pEncap, + IN PCIPHER_KEY pKey, u8 apidx) { PACKET_INFO PacketInfo; - PUCHAR pSrcBufVA; - UINT SrcBufLen; - PUCHAR pSrc; - UCHAR UserPriority; - UCHAR vlan_offset = 0; + u8 *pSrcBufVA; + u32 SrcBufLen; + u8 *pSrc; + u8 UserPriority; + u8 vlan_offset = 0; RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); @@ -555,11 +555,11 @@ VOID RTMPCalculateMICValue(IN PRTMP_ADAPTER pAd, /* is synthesized from two 256 entry byte wide tables. */ /************************************************************/ -UINT tkip_sbox(UINT index) +u32 tkip_sbox(u32 index) { - UINT index_low; - UINT index_high; - UINT left, right; + u32 index_low; + u32 index_high; + u32 left, right; index_low = (index % 256); index_high = ((index >> 8) % 256); @@ -571,7 +571,7 @@ UINT tkip_sbox(UINT index) return (left ^ right); } -UINT rotr1(UINT a) +u32 rotr1(u32 a) { unsigned int b; @@ -584,24 +584,24 @@ UINT rotr1(UINT a) return b; } -VOID RTMPTkipMixKey(UCHAR * key, UCHAR * ta, ULONG pnl, /* Least significant 16 bits of PN */ - ULONG pnh, /* Most significant 32 bits of PN */ - UCHAR * rc4key, UINT * p1k) +void RTMPTkipMixKey(u8 * key, u8 * ta, unsigned long pnl, /* Least significant 16 bits of PN */ + unsigned long pnh, /* Most significant 32 bits of PN */ + u8 * rc4key, u32 * p1k) { - UINT tsc0; - UINT tsc1; - UINT tsc2; + u32 tsc0; + u32 tsc1; + u32 tsc2; - UINT ppk0; - UINT ppk1; - UINT ppk2; - UINT ppk3; - UINT ppk4; - UINT ppk5; + u32 ppk0; + u32 ppk1; + u32 ppk2; + u32 ppk3; + u32 ppk4; + u32 ppk5; - INT i; - INT j; + int i; + int j; tsc0 = (unsigned int)((pnh >> 16) % 65536); /* msb */ tsc1 = (unsigned int)(pnh % 65536); @@ -610,9 +610,9 @@ VOID RTMPTkipMixKey(UCHAR * key, UCHAR * ta, ULONG pnl, /* Least significant 16 /* Phase 1, step 1 */ p1k[0] = tsc1; p1k[1] = tsc0; - p1k[2] = (UINT) (ta[0] + (ta[1] * 256)); - p1k[3] = (UINT) (ta[2] + (ta[3] * 256)); - p1k[4] = (UINT) (ta[4] + (ta[5] * 256)); + p1k[2] = (u32)(ta[0] + (ta[1] * 256)); + p1k[3] = (u32)(ta[2] + (ta[3] * 256)); + p1k[4] = (u32)(ta[4] + (ta[5] * 256)); /* Phase 1, step 2 */ for (i = 0; i < 8; i++) { @@ -699,43 +699,43 @@ VOID RTMPTkipMixKey(UCHAR * key, UCHAR * ta, ULONG pnl, /* Least significant 16 /* FALSE: Decrypt Error! */ /* */ BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, - IN UCHAR UserPriority, IN PCIPHER_KEY pWpaKey) + u8 *pData, + unsigned long DataByteCnt, + u8 UserPriority, IN PCIPHER_KEY pWpaKey) { - UCHAR KeyID; - UINT HeaderLen; - UCHAR fc0; - UCHAR fc1; - USHORT fc; - UINT frame_type; - UINT frame_subtype; - UINT from_ds; - UINT to_ds; - INT a4_exists; - INT qc_exists; - USHORT duration; - USHORT seq_control; - USHORT qos_control; - UCHAR TA[MAC_ADDR_LEN]; - UCHAR DA[MAC_ADDR_LEN]; - UCHAR SA[MAC_ADDR_LEN]; - UCHAR RC4Key[16]; - UINT p1k[5]; /*for mix_key; */ - ULONG pnl; /* Least significant 16 bits of PN */ - ULONG pnh; /* Most significant 32 bits of PN */ - UINT num_blocks; - UINT payload_remainder; + u8 KeyID; + u32 HeaderLen; + u8 fc0; + u8 fc1; + u16 fc; + u32 frame_type; + u32 frame_subtype; + u32 from_ds; + u32 to_ds; + int a4_exists; + int qc_exists; + u16 duration; + u16 seq_control; + u16 qos_control; + u8 TA[MAC_ADDR_LEN]; + u8 DA[MAC_ADDR_LEN]; + u8 SA[MAC_ADDR_LEN]; + u8 RC4Key[16]; + u32 p1k[5]; /*for mix_key; */ + unsigned long pnl; /* Least significant 16 bits of PN */ + unsigned long pnh; /* Most significant 32 bits of PN */ + u32 num_blocks; + u32 payload_remainder; ARCFOURCONTEXT ArcFourContext; - UINT crc32 = 0; - UINT trailfcs = 0; - UCHAR MIC[8]; - UCHAR TrailMIC[8]; + u32 crc32 = 0; + u32 trailfcs = 0; + u8 MIC[8]; + u8 TrailMIC[8]; fc0 = *pData; fc1 = *(pData + 1); - fc = *((PUSHORT) pData); + fc = *((u16 *)pData); frame_type = ((fc0 >> 2) & 0x03); frame_subtype = ((fc0 >> 4) & 0x0f); @@ -753,7 +753,7 @@ BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd, if (a4_exists) HeaderLen += 6; - KeyID = *((PUCHAR) (pData + HeaderLen + 3)); + KeyID = *((u8 *)(pData + HeaderLen + 3)); KeyID = KeyID >> 6; if (pWpaKey[KeyID].KeyLen == 0) { @@ -763,15 +763,15 @@ BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd, return FALSE; } - duration = *((PUSHORT) (pData + 2)); + duration = *((u16 *)(pData + 2)); - seq_control = *((PUSHORT) (pData + 22)); + seq_control = *((u16 *)(pData + 22)); if (qc_exists) { if (a4_exists) { - qos_control = *((PUSHORT) (pData + 30)); + qos_control = *((u16 *)(pData + 30)); } else { - qos_control = *((PUSHORT) (pData + 24)); + qos_control = *((u16 *)(pData + 24)); } } @@ -797,7 +797,7 @@ BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd, payload_remainder = (DataByteCnt - 16) % 16; pnl = (*(pData + HeaderLen)) * 256 + *(pData + HeaderLen + 2); - pnh = *((PULONG) (pData + HeaderLen + 4)); + pnh = *((unsigned long *)(pData + HeaderLen + 4)); pnh = cpu2le32(pnh); RTMPTkipMixKey(pWpaKey[KeyID].Key, TA, pnl, pnh, RC4Key, p1k); diff --git a/drivers/staging/rt2860/common/cmm_wep.c b/drivers/staging/rt2860/common/cmm_wep.c index db40139d1fb8..05a921410caa 100644 --- a/drivers/staging/rt2860/common/cmm_wep.c +++ b/drivers/staging/rt2860/common/cmm_wep.c @@ -37,7 +37,7 @@ #include "../rt_config.h" -UINT FCSTAB_32[256] = { +u32 FCSTAB_32[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, @@ -105,7 +105,7 @@ UINT FCSTAB_32[256] = { }; /* -UCHAR WEPKEY[] = { +u8 WEPKEY[] = { //IV 0x00, 0x11, 0x22, //WEP KEY @@ -135,12 +135,12 @@ UCHAR WEPKEY[] = { ======================================================================== */ -VOID RTMPInitWepEngine(IN PRTMP_ADAPTER pAd, - IN PUCHAR pKey, - IN UCHAR KeyId, IN UCHAR KeyLen, IN OUT PUCHAR pDest) +void RTMPInitWepEngine(IN PRTMP_ADAPTER pAd, + u8 *pKey, + u8 KeyId, u8 KeyLen, IN u8 *pDest) { - UINT i; - UCHAR WEPKEY[] = { + u32 i; + u8 WEPKEY[] = { /*IV */ 0x00, 0x11, 0x22, /*WEP KEY */ @@ -184,8 +184,8 @@ VOID RTMPInitWepEngine(IN PRTMP_ADAPTER pAd, ======================================================================== */ -VOID RTMPEncryptData(IN PRTMP_ADAPTER pAd, - IN PUCHAR pSrc, IN PUCHAR pDest, IN UINT Len) +void RTMPEncryptData(IN PRTMP_ADAPTER pAd, + u8 *pSrc, u8 *pDest, u32 Len) { pAd->PrivateInfo.FCSCRC32 = RTMP_CALC_FCS32(pAd->PrivateInfo.FCSCRC32, pSrc, Len); @@ -212,21 +212,21 @@ VOID RTMPEncryptData(IN PRTMP_ADAPTER pAd, ======================================================================== */ BOOLEAN RTMPSoftDecryptWEP(IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, IN PCIPHER_KEY pGroupKey) + u8 *pData, + unsigned long DataByteCnt, IN PCIPHER_KEY pGroupKey) { - UINT trailfcs; - UINT crc32; - UCHAR KeyIdx; - UCHAR WEPKEY[] = { + u32 trailfcs; + u32 crc32; + u8 KeyIdx; + u8 WEPKEY[] = { /*IV */ 0x00, 0x11, 0x22, /*WEP KEY */ 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC }; - UCHAR *pPayload = (UCHAR *) pData + LENGTH_802_11; - ULONG payload_len = DataByteCnt - LENGTH_802_11; + u8 *pPayload = (u8 *) pData + LENGTH_802_11; + unsigned long payload_len = DataByteCnt - LENGTH_802_11; NdisMoveMemory(WEPKEY, pPayload, 3); /*Get WEP IV */ @@ -271,19 +271,19 @@ BOOLEAN RTMPSoftDecryptWEP(IN PRTMP_ADAPTER pAd, ======================================================================== */ -VOID ARCFOUR_INIT(IN PARCFOURCONTEXT Ctx, IN PUCHAR pKey, IN UINT KeyLen) +void ARCFOUR_INIT(IN PARCFOURCONTEXT Ctx, u8 *pKey, u32 KeyLen) { - UCHAR t, u; - UINT keyindex; - UINT stateindex; - PUCHAR state; - UINT counter; + u8 t, u; + u32 keyindex; + u32 stateindex; + u8 *state; + u32 counter; state = Ctx->STATE; Ctx->X = 0; Ctx->Y = 0; for (counter = 0; counter < 256; counter++) - state[counter] = (UCHAR) counter; + state[counter] = (u8)counter; keyindex = 0; stateindex = 0; for (counter = 0; counter < 256; counter++) { @@ -307,18 +307,18 @@ VOID ARCFOUR_INIT(IN PARCFOURCONTEXT Ctx, IN PUCHAR pKey, IN UINT KeyLen) Ctx Pointer to ARCFOUR CONTEXT (SBOX) Return Value: - UCHAR - the value of the ARCFOUR CONTEXT (S-BOX) + u8 - the value of the ARCFOUR CONTEXT (S-BOX) Note: ======================================================================== */ -UCHAR ARCFOUR_BYTE(IN PARCFOURCONTEXT Ctx) +u8 ARCFOUR_BYTE(IN PARCFOURCONTEXT Ctx) { - UINT x; - UINT y; - UCHAR sx, sy; - PUCHAR state; + u32 x; + u32 y; + u8 sx, sy; + u8 *state; state = Ctx->STATE; x = (Ctx->X + 1) & 0xff; @@ -353,10 +353,10 @@ UCHAR ARCFOUR_BYTE(IN PARCFOURCONTEXT Ctx) ======================================================================== */ -VOID ARCFOUR_DECRYPT(IN PARCFOURCONTEXT Ctx, - IN PUCHAR pDest, IN PUCHAR pSrc, IN UINT Len) +void ARCFOUR_DECRYPT(IN PARCFOURCONTEXT Ctx, + u8 *pDest, u8 *pSrc, u32 Len) { - UINT i; + u32 i; for (i = 0; i < Len; i++) pDest[i] = pSrc[i] ^ ARCFOUR_BYTE(Ctx); @@ -383,10 +383,10 @@ VOID ARCFOUR_DECRYPT(IN PARCFOURCONTEXT Ctx, ======================================================================== */ -VOID ARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, - IN PUCHAR pDest, IN PUCHAR pSrc, IN UINT Len) +void ARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, + u8 *pDest, u8 *pSrc, u32 Len) { - UINT i; + u32 i; for (i = 0; i < Len; i++) pDest[i] = pSrc[i] ^ ARCFOUR_BYTE(Ctx); @@ -407,10 +407,10 @@ VOID ARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, ======================================================================== */ -VOID WPAARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, - IN PUCHAR pDest, IN PUCHAR pSrc, IN UINT Len) +void WPAARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, + u8 *pDest, u8 *pSrc, u32 Len) { - UINT i; + u32 i; /*discard first 256 bytes */ for (i = 0; i < 256; i++) ARCFOUR_BYTE(Ctx); @@ -431,7 +431,7 @@ VOID WPAARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, Len the length of the data Return Value: - UINT - FCS 32 bits + u32 - FCS 32 bits IRQL = DISPATCH_LEVEL @@ -439,7 +439,7 @@ VOID WPAARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, ======================================================================== */ -UINT RTMP_CALC_FCS32(IN UINT Fcs, IN PUCHAR Cp, IN INT Len) +u32 RTMP_CALC_FCS32(u32 Fcs, u8 *Cp, int Len) { while (Len--) Fcs = (((Fcs) >> 8) ^ FCSTAB_32[((Fcs) ^ (*Cp++)) & 0xff]); @@ -463,11 +463,11 @@ UINT RTMP_CALC_FCS32(IN UINT Fcs, IN PUCHAR Cp, IN INT Len) ======================================================================== */ -VOID RTMPSetICV(IN PRTMP_ADAPTER pAd, IN PUCHAR pDest) +void RTMPSetICV(IN PRTMP_ADAPTER pAd, u8 *pDest) { pAd->PrivateInfo.FCSCRC32 ^= 0xffffffff; /* complement */ pAd->PrivateInfo.FCSCRC32 = cpu2le32(pAd->PrivateInfo.FCSCRC32); ARCFOUR_ENCRYPT(&pAd->PrivateInfo.WEPCONTEXT, pDest, - (PUCHAR) & pAd->PrivateInfo.FCSCRC32, 4); + (u8 *)& pAd->PrivateInfo.FCSCRC32, 4); } diff --git a/drivers/staging/rt2860/common/cmm_wpa.c b/drivers/staging/rt2860/common/cmm_wpa.c index 6940d778985d..3fce5a717194 100644 --- a/drivers/staging/rt2860/common/cmm_wpa.c +++ b/drivers/staging/rt2860/common/cmm_wpa.c @@ -37,47 +37,47 @@ */ #include "../rt_config.h" /* WPA OUI */ -UCHAR OUI_WPA_NONE_AKM[4] = { 0x00, 0x50, 0xF2, 0x00 }; -UCHAR OUI_WPA_VERSION[4] = { 0x00, 0x50, 0xF2, 0x01 }; -UCHAR OUI_WPA_WEP40[4] = { 0x00, 0x50, 0xF2, 0x01 }; -UCHAR OUI_WPA_TKIP[4] = { 0x00, 0x50, 0xF2, 0x02 }; -UCHAR OUI_WPA_CCMP[4] = { 0x00, 0x50, 0xF2, 0x04 }; -UCHAR OUI_WPA_WEP104[4] = { 0x00, 0x50, 0xF2, 0x05 }; -UCHAR OUI_WPA_8021X_AKM[4] = { 0x00, 0x50, 0xF2, 0x01 }; -UCHAR OUI_WPA_PSK_AKM[4] = { 0x00, 0x50, 0xF2, 0x02 }; +u8 OUI_WPA_NONE_AKM[4] = { 0x00, 0x50, 0xF2, 0x00 }; +u8 OUI_WPA_VERSION[4] = { 0x00, 0x50, 0xF2, 0x01 }; +u8 OUI_WPA_WEP40[4] = { 0x00, 0x50, 0xF2, 0x01 }; +u8 OUI_WPA_TKIP[4] = { 0x00, 0x50, 0xF2, 0x02 }; +u8 OUI_WPA_CCMP[4] = { 0x00, 0x50, 0xF2, 0x04 }; +u8 OUI_WPA_WEP104[4] = { 0x00, 0x50, 0xF2, 0x05 }; +u8 OUI_WPA_8021X_AKM[4] = { 0x00, 0x50, 0xF2, 0x01 }; +u8 OUI_WPA_PSK_AKM[4] = { 0x00, 0x50, 0xF2, 0x02 }; /* WPA2 OUI */ -UCHAR OUI_WPA2_WEP40[4] = { 0x00, 0x0F, 0xAC, 0x01 }; -UCHAR OUI_WPA2_TKIP[4] = { 0x00, 0x0F, 0xAC, 0x02 }; -UCHAR OUI_WPA2_CCMP[4] = { 0x00, 0x0F, 0xAC, 0x04 }; -UCHAR OUI_WPA2_8021X_AKM[4] = { 0x00, 0x0F, 0xAC, 0x01 }; -UCHAR OUI_WPA2_PSK_AKM[4] = { 0x00, 0x0F, 0xAC, 0x02 }; -UCHAR OUI_WPA2_WEP104[4] = { 0x00, 0x0F, 0xAC, 0x05 }; - -static VOID ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, - IN UCHAR GroupKeyWepStatus, - IN UCHAR keyDescVer, - IN UCHAR MsgType, - IN UCHAR DefaultKeyIdx, - IN UCHAR * GTK, - IN UCHAR * RSNIE, - IN UCHAR RSNIE_LEN, OUT PEAPOL_PACKET pMsg); - -static VOID CalculateMIC(IN UCHAR KeyDescVer, - IN UCHAR * PTK, OUT PEAPOL_PACKET pMsg); - -static VOID WpaEAPPacketAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); - -static VOID WpaEAPOLASFAlertAction(IN PRTMP_ADAPTER pAd, +u8 OUI_WPA2_WEP40[4] = { 0x00, 0x0F, 0xAC, 0x01 }; +u8 OUI_WPA2_TKIP[4] = { 0x00, 0x0F, 0xAC, 0x02 }; +u8 OUI_WPA2_CCMP[4] = { 0x00, 0x0F, 0xAC, 0x04 }; +u8 OUI_WPA2_8021X_AKM[4] = { 0x00, 0x0F, 0xAC, 0x01 }; +u8 OUI_WPA2_PSK_AKM[4] = { 0x00, 0x0F, 0xAC, 0x02 }; +u8 OUI_WPA2_WEP104[4] = { 0x00, 0x0F, 0xAC, 0x05 }; + +static void ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, + u8 GroupKeyWepStatus, + u8 keyDescVer, + u8 MsgType, + u8 DefaultKeyIdx, + u8 * GTK, + u8 * RSNIE, + u8 RSNIE_LEN, OUT PEAPOL_PACKET pMsg); + +static void CalculateMIC(u8 KeyDescVer, + u8 * PTK, OUT PEAPOL_PACKET pMsg); + +static void WpaEAPPacketAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); + +static void WpaEAPOLASFAlertAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -static VOID WpaEAPOLLogoffAction(IN PRTMP_ADAPTER pAd, +static void WpaEAPOLLogoffAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -static VOID WpaEAPOLStartAction(IN PRTMP_ADAPTER pAd, +static void WpaEAPOLStartAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -static VOID WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +static void WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); /* ========================================================================== @@ -87,7 +87,7 @@ static VOID WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); S - pointer to the association state machine ========================================================================== */ -VOID WpaStateMachineInit(IN PRTMP_ADAPTER pAd, +void WpaStateMachineInit(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * S, OUT STATE_MACHINE_FUNC Trans[]) { StateMachineInit(S, (STATE_MACHINE_FUNC *) Trans, MAX_WPA_PTK_STATE, @@ -115,15 +115,15 @@ VOID WpaStateMachineInit(IN PRTMP_ADAPTER pAd, Return: ========================================================================== */ -VOID WpaEAPPacketAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void WpaEAPPacketAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { } -VOID WpaEAPOLASFAlertAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void WpaEAPOLASFAlertAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { } -VOID WpaEAPOLLogoffAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void WpaEAPOLLogoffAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { } @@ -134,7 +134,7 @@ VOID WpaEAPOLLogoffAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Return: ========================================================================== */ -VOID WpaEAPOLStartAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void WpaEAPOLStartAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { MAC_TABLE_ENTRY *pEntry; PHEADER_802_11 pHeader; @@ -187,7 +187,7 @@ VOID WpaEAPOLStartAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Return: ========================================================================== */ -VOID WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { MAC_TABLE_ENTRY *pEntry; PHEADER_802_11 pHeader; @@ -200,15 +200,15 @@ VOID WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pEapol_packet = (PEAPOL_PACKET) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; - NdisZeroMemory((PUCHAR) & peerKeyInfo, sizeof(peerKeyInfo)); - NdisMoveMemory((PUCHAR) & peerKeyInfo, - (PUCHAR) & pEapol_packet->KeyDesc.KeyInfo, + NdisZeroMemory((u8 *)& peerKeyInfo, sizeof(peerKeyInfo)); + NdisMoveMemory((u8 *)& peerKeyInfo, + (u8 *)& pEapol_packet->KeyDesc.KeyInfo, sizeof(KEY_INFO)); hex_dump("Received Eapol frame", (unsigned char *)pEapol_packet, (Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H)); - *((USHORT *) & peerKeyInfo) = cpu2le16(*((USHORT *) & peerKeyInfo)); + *((u16 *) & peerKeyInfo) = cpu2le16(*((u16 *) & peerKeyInfo)); do { pEntry = MacTableLookup(pAd, pHeader->Addr2); @@ -300,7 +300,7 @@ VOID WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /* EAPOL-Key(0,1,0,0,P,0,0,SNonce,MIC,Data) */ /* Process 1. message 2 of 4-way HS in WPA or WPA2 */ /* 2. message 4 of 4-way HS in WPA */ - if (CONV_ARRARY_TO_UINT16 + if (CONV_ARRARY_TO_u16 (pEapol_packet->KeyDesc. KeyDataLen) == 0) { PeerPairMsg4Action(pAd, @@ -357,14 +357,14 @@ VOID WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ======================================================================== */ -VOID RTMPToWirelessSta(IN PRTMP_ADAPTER pAd, +void RTMPToWirelessSta(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, IN UINT DataLen, IN BOOLEAN bClearFrame) + u8 *pHeader802_3, + u32 HdrLen, + u8 *pData, u32 DataLen, IN BOOLEAN bClearFrame) { PNDIS_PACKET pPacket; - NDIS_STATUS Status; + int Status; if ((!pEntry) || ((!pEntry->ValidAsCLI) && (!pEntry->ValidAsApCli))) return; @@ -390,7 +390,7 @@ VOID RTMPToWirelessSta(IN PRTMP_ADAPTER pAd, pEntry-> apidx); - RTMP_SET_PACKET_WCID(pPacket, (UCHAR) pEntry->Aid); + RTMP_SET_PACKET_WCID(pPacket, (u8)pEntry->Aid); RTMP_SET_PACKET_MOREDATA(pPacket, FALSE); } @@ -398,7 +398,7 @@ VOID RTMPToWirelessSta(IN PRTMP_ADAPTER pAd, /* send out the packet */ Status = STASendPacket(pAd, pPacket); if (Status == NDIS_STATUS_SUCCESS) { - UCHAR Index; + u8 Index; /* Dequeue one frame from TxSwQueue0..3 queue and process it */ /* There are three place calling dequeue for TX ring. */ @@ -433,13 +433,13 @@ VOID RTMPToWirelessSta(IN PRTMP_ADAPTER pAd, ========================================================================== */ -VOID WPAStart4WayHS(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, IN ULONG TimeInterval) +void WPAStart4WayHS(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, unsigned long TimeInterval) { - UCHAR Header802_3[14]; + u8 Header802_3[14]; EAPOL_PACKET EAPOLPKT; - PUINT8 pBssid = NULL; - UCHAR group_cipher = Ndis802_11WEPDisabled; + u8 *pBssid = NULL; + u8 group_cipher = Ndis802_11WEPDisabled; DBGPRINT(RT_DEBUG_TRACE, ("===> WPAStart4WayHS\n")); @@ -468,7 +468,7 @@ VOID WPAStart4WayHS(IN PRTMP_ADAPTER pAd, ADD_ONE_To_64BIT_VAR(pEntry->R_Counter); /* Randomly generate ANonce */ - GenRandom(pAd, (UCHAR *) pBssid, pEntry->ANonce); + GenRandom(pAd, (u8 *) pBssid, pEntry->ANonce); /* Construct EAPoL message - Pairwise Msg 1 */ /* EAPOL-Key(0,0,1,0,P,0,0,ANonce,0,DataKD_M1) */ @@ -483,8 +483,8 @@ VOID WPAStart4WayHS(IN PRTMP_ADAPTER pAd, /* Make outgoing frame */ MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pBssid, EAPOL); RTMPToWirelessSta(pAd, pEntry, Header802_3, - LENGTH_802_3, (PUCHAR) & EAPOLPKT, - CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, + LENGTH_802_3, (u8 *)& EAPOLPKT, + CONV_ARRARY_TO_u16(EAPOLPKT.Body_Len) + 4, (pEntry->PortSecured == WPA_802_1X_PORT_SECURED) ? FALSE : TRUE); @@ -516,19 +516,19 @@ VOID WPAStart4WayHS(IN PRTMP_ADAPTER pAd, ======================================================================== */ -VOID PeerPairMsg1Action(IN PRTMP_ADAPTER pAd, +void PeerPairMsg1Action(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem) { - UCHAR PTK[80]; - UCHAR Header802_3[14]; + u8 PTK[80]; + u8 Header802_3[14]; PEAPOL_PACKET pMsg1; - UINT MsgLen; + u32 MsgLen; EAPOL_PACKET EAPOLPKT; - PUINT8 pCurrentAddr = NULL; - PUINT8 pmk_ptr = NULL; - UCHAR group_cipher = Ndis802_11WEPDisabled; - PUINT8 rsnie_ptr = NULL; - UCHAR rsnie_len = 0; + u8 *pCurrentAddr = NULL; + u8 *pmk_ptr = NULL; + u8 group_cipher = Ndis802_11WEPDisabled; + u8 *rsnie_ptr = NULL; + u8 rsnie_len = 0; DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg1Action \n")); @@ -566,7 +566,7 @@ VOID PeerPairMsg1Action(IN PRTMP_ADAPTER pAd, LEN_KEY_DESC_NONCE); /* Generate random SNonce */ - GenRandom(pAd, (UCHAR *) pCurrentAddr, pEntry->SNonce); + GenRandom(pAd, (u8 *) pCurrentAddr, pEntry->SNonce); { /* Calculate PTK(ANonce, SNonce) */ @@ -589,14 +589,14 @@ VOID PeerPairMsg1Action(IN PRTMP_ADAPTER pAd, ConstructEapolMsg(pEntry, group_cipher, EAPOL_PAIR_MSG_2, 0, /* DefaultKeyIdx */ pEntry->SNonce, NULL, /* TxRsc */ NULL, /* GTK */ - (UCHAR *) rsnie_ptr, rsnie_len, &EAPOLPKT); + (u8 *) rsnie_ptr, rsnie_len, &EAPOLPKT); /* Make outgoing frame */ MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pCurrentAddr, EAPOL); RTMPToWirelessSta(pAd, pEntry, - Header802_3, sizeof(Header802_3), (PUCHAR) & EAPOLPKT, - CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, TRUE); + Header802_3, sizeof(Header802_3), (u8 *)& EAPOLPKT, + CONV_ARRARY_TO_u16(EAPOLPKT.Body_Len) + 4, TRUE); DBGPRINT(RT_DEBUG_TRACE, ("<=== PeerPairMsg1Action: send Msg2 of 4-way \n")); @@ -609,24 +609,24 @@ VOID PeerPairMsg1Action(IN PRTMP_ADAPTER pAd, Return: ========================================================================== */ -VOID PeerPairMsg2Action(IN PRTMP_ADAPTER pAd, +void PeerPairMsg2Action(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem) { - UCHAR PTK[80]; + u8 PTK[80]; BOOLEAN Cancelled; PHEADER_802_11 pHeader; EAPOL_PACKET EAPOLPKT; PEAPOL_PACKET pMsg2; - UINT MsgLen; - UCHAR Header802_3[LENGTH_802_3]; - UCHAR TxTsc[6]; - PUINT8 pBssid = NULL; - PUINT8 pmk_ptr = NULL; - PUINT8 gtk_ptr = NULL; - UCHAR default_key = 0; - UCHAR group_cipher = Ndis802_11WEPDisabled; - PUINT8 rsnie_ptr = NULL; - UCHAR rsnie_len = 0; + u32 MsgLen; + u8 Header802_3[LENGTH_802_3]; + u8 TxTsc[6]; + u8 *pBssid = NULL; + u8 *pmk_ptr = NULL; + u8 *gtk_ptr = NULL; + u8 default_key = 0; + u8 group_cipher = Ndis802_11WEPDisabled; + u8 *rsnie_ptr = NULL; + u8 rsnie_len = 0; DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg2Action \n")); @@ -655,8 +655,8 @@ VOID PeerPairMsg2Action(IN PRTMP_ADAPTER pAd, { /* Derive PTK */ - WpaDerivePTK(pAd, (UCHAR *) pmk_ptr, pEntry->ANonce, /* ANONCE */ - (UCHAR *) pBssid, pEntry->SNonce, /* SNONCE */ + WpaDerivePTK(pAd, (u8 *) pmk_ptr, pEntry->ANonce, /* ANONCE */ + (u8 *) pBssid, pEntry->SNonce, /* SNONCE */ pEntry->Addr, PTK, LEN_PTK); NdisMoveMemory(pEntry->PTK, PTK, LEN_PTK); @@ -685,14 +685,14 @@ VOID PeerPairMsg2Action(IN PRTMP_ADAPTER pAd, default_key, pEntry->ANonce, TxTsc, - (UCHAR *) gtk_ptr, - (UCHAR *) rsnie_ptr, rsnie_len, &EAPOLPKT); + (u8 *) gtk_ptr, + (u8 *) rsnie_ptr, rsnie_len, &EAPOLPKT); /* Make outgoing frame */ MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pBssid, EAPOL); RTMPToWirelessSta(pAd, pEntry, Header802_3, LENGTH_802_3, - (PUCHAR) & EAPOLPKT, - CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, + (u8 *)& EAPOLPKT, + CONV_ARRARY_TO_u16(EAPOLPKT.Body_Len) + 4, (pEntry->PortSecured == WPA_802_1X_PORT_SECURED) ? FALSE : TRUE); @@ -724,16 +724,16 @@ VOID PeerPairMsg2Action(IN PRTMP_ADAPTER pAd, ======================================================================== */ -VOID PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, +void PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem) { PHEADER_802_11 pHeader; - UCHAR Header802_3[14]; + u8 Header802_3[14]; EAPOL_PACKET EAPOLPKT; PEAPOL_PACKET pMsg3; - UINT MsgLen; - PUINT8 pCurrentAddr = NULL; - UCHAR group_cipher = Ndis802_11WEPDisabled; + u32 MsgLen; + u8 *pCurrentAddr = NULL; + u8 group_cipher = Ndis802_11WEPDisabled; DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg3Action \n")); @@ -856,8 +856,8 @@ VOID PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pCurrentAddr, EAPOL); RTMPToWirelessSta(pAd, pEntry, Header802_3, sizeof(Header802_3), - (PUCHAR) & EAPOLPKT, - CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, TRUE); + (u8 *)& EAPOLPKT, + CONV_ARRARY_TO_u16(EAPOLPKT.Body_Len) + 4, TRUE); DBGPRINT(RT_DEBUG_TRACE, ("<=== PeerPairMsg3Action: send Msg4 of 4-way \n")); @@ -871,14 +871,14 @@ VOID PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, Return: ========================================================================== */ -VOID PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, +void PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem) { PEAPOL_PACKET pMsg4; PHEADER_802_11 pHeader; - UINT MsgLen; + u32 MsgLen; BOOLEAN Cancelled; - UCHAR group_cipher = Ndis802_11WEPDisabled; + u8 group_cipher = Ndis802_11WEPDisabled; DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg4Action\n")); @@ -935,7 +935,7 @@ VOID PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, /* Add Pair-wise key to Asic */ AsicAddPairwiseKeyEntry(pAd, pEntry->Addr, - (UCHAR) pEntry->Aid, + (u8)pEntry->Aid, &pEntry->PairwiseKey); /* update WCID attribute table and IVEIV table for this entry */ @@ -990,16 +990,16 @@ VOID PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, ========================================================================== */ -VOID WPAStart2WayGroupHS(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) +void WPAStart2WayGroupHS(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) { - UCHAR Header802_3[14]; - UCHAR TxTsc[6]; + u8 Header802_3[14]; + u8 TxTsc[6]; EAPOL_PACKET EAPOLPKT; - UCHAR group_cipher = Ndis802_11WEPDisabled; - UCHAR default_key = 0; - PUINT8 gnonce_ptr = NULL; - PUINT8 gtk_ptr = NULL; - PUINT8 pBssid = NULL; + u8 group_cipher = Ndis802_11WEPDisabled; + u8 default_key = 0; + u8 *gnonce_ptr = NULL; + u8 *gtk_ptr = NULL; + u8 *pBssid = NULL; DBGPRINT(RT_DEBUG_TRACE, ("===> WPAStart2WayGroupHS\n")); @@ -1016,15 +1016,15 @@ VOID WPAStart2WayGroupHS(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) group_cipher, EAPOL_GROUP_MSG_1, default_key, - (UCHAR *) gnonce_ptr, - TxTsc, (UCHAR *) gtk_ptr, NULL, 0, &EAPOLPKT); + (u8 *) gnonce_ptr, + TxTsc, (u8 *) gtk_ptr, NULL, 0, &EAPOLPKT); /* Make outgoing frame */ MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pBssid, EAPOL); RTMPToWirelessSta(pAd, pEntry, Header802_3, LENGTH_802_3, - (PUCHAR) & EAPOLPKT, - CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, + (u8 *)& EAPOLPKT, + CONV_ARRARY_TO_u16(EAPOLPKT.Body_Len) + 4, FALSE); } while (FALSE); @@ -1052,17 +1052,17 @@ VOID WPAStart2WayGroupHS(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) ======================================================================== */ -VOID PeerGroupMsg1Action(IN PRTMP_ADAPTER pAd, +void PeerGroupMsg1Action(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Header802_3[14]; + u8 Header802_3[14]; EAPOL_PACKET EAPOLPKT; PEAPOL_PACKET pGroup; - UINT MsgLen; + u32 MsgLen; BOOLEAN Cancelled; - UCHAR default_key = 0; - UCHAR group_cipher = Ndis802_11WEPDisabled; - PUINT8 pCurrentAddr = NULL; + u8 default_key = 0; + u8 group_cipher = Ndis802_11WEPDisabled; + u8 *pCurrentAddr = NULL; DBGPRINT(RT_DEBUG_TRACE, ("===> PeerGroupMsg1Action \n")); @@ -1117,8 +1117,8 @@ VOID PeerGroupMsg1Action(IN PRTMP_ADAPTER pAd, MAKE_802_3_HEADER(Header802_3, pEntry->Addr, pCurrentAddr, EAPOL); RTMPToWirelessSta(pAd, pEntry, Header802_3, sizeof(Header802_3), - (PUCHAR) & EAPOLPKT, - CONV_ARRARY_TO_UINT16(EAPOLPKT.Body_Len) + 4, FALSE); + (u8 *)& EAPOLPKT, + CONV_ARRARY_TO_u16(EAPOLPKT.Body_Len) + 4, FALSE); DBGPRINT(RT_DEBUG_TRACE, ("<=== PeerGroupMsg1Action: sned group message 2\n")); @@ -1131,15 +1131,15 @@ VOID PeerGroupMsg1Action(IN PRTMP_ADAPTER pAd, Return: ========================================================================== */ -VOID PeerGroupMsg2Action(IN PRTMP_ADAPTER pAd, +void PeerGroupMsg2Action(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, - IN VOID * Msg, IN UINT MsgLen) + void * Msg, u32 MsgLen) { - UINT Len; - PUCHAR pData; + u32 Len; + u8 *pData; BOOLEAN Cancelled; PEAPOL_PACKET pMsg2; - UCHAR group_cipher = Ndis802_11WEPDisabled; + u8 group_cipher = Ndis802_11WEPDisabled; DBGPRINT(RT_DEBUG_TRACE, ("===> PeerGroupMsg2Action \n")); @@ -1155,7 +1155,7 @@ VOID PeerGroupMsg2Action(IN PRTMP_ADAPTER pAd, if (pEntry->WpaState != AS_PTKINITDONE) break; - pData = (PUCHAR) Msg; + pData = (u8 *)Msg; pMsg2 = (PEAPOL_PACKET) (pData + LENGTH_802_1_H); Len = MsgLen - LENGTH_802_1_H; @@ -1226,7 +1226,7 @@ VOID PeerGroupMsg2Action(IN PRTMP_ADAPTER pAd, ======================================================================== */ -BOOLEAN WpaMsgTypeSubst(IN UCHAR EAPType, OUT INT * MsgType) +BOOLEAN WpaMsgTypeSubst(u8 EAPType, int * MsgType) { switch (EAPType) { case EAPPacket: @@ -1261,35 +1261,35 @@ BOOLEAN WpaMsgTypeSubst(IN UCHAR EAPType, OUT INT * MsgType) It is used to generate PTK, GTK or some specific random value. Arguments: - UCHAR *key, - the key material for HMAC_SHA1 use - INT key_len - the length of key - UCHAR *prefix - a prefix label - INT prefix_len - the length of the label - UCHAR *data - a specific data with variable length - INT data_len - the length of a specific data - INT len - the output lenght + u8 *key, - the key material for HMAC_SHA1 use + int key_len - the length of key + u8 *prefix - a prefix label + int prefix_len - the length of the label + u8 *data - a specific data with variable length + int data_len - the length of a specific data + int len - the output lenght Return Value: - UCHAR *output - the calculated result + u8 *output - the calculated result Note: 802.11i-2004 Annex H.3 ======================================================================== */ -VOID PRF(IN UCHAR * key, - IN INT key_len, - IN UCHAR * prefix, - IN INT prefix_len, - IN UCHAR * data, IN INT data_len, OUT UCHAR * output, IN INT len) +void PRF(u8 * key, + int key_len, + u8 * prefix, + int prefix_len, + u8 * data, int data_len, u8 * output, int len) { - INT i; - UCHAR *input; - INT currentindex = 0; - INT total_len; + int i; + u8 *input; + int currentindex = 0; + int total_len; /* Allocate memory for input */ - os_alloc_mem(NULL, (PUCHAR *) & input, 1024); + os_alloc_mem(NULL, (u8 **) & input, 1024); if (input == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("!!!PRF: no memory!!!\n")); @@ -1365,7 +1365,7 @@ static void F(char *password, unsigned char *ssid, int ssidlength, * ssidlength - length of ssid in octets * output must be 40 octets in length and outputs 256 bits of key */ -int PasswordHash(PSTRING password, PUCHAR ssid, INT ssidlength, PUCHAR output) +int PasswordHash(char *password, u8 *ssid, int ssidlength, u8 *output) { if ((strlen(password) > 63) || (ssidlength > 32)) return 0; @@ -1399,17 +1399,17 @@ int PasswordHash(PSTRING password, PUCHAR ssid, INT ssidlength, PUCHAR output) ======================================================================== */ -VOID WpaDerivePTK(IN PRTMP_ADAPTER pAd, - IN UCHAR * PMK, - IN UCHAR * ANonce, - IN UCHAR * AA, - IN UCHAR * SNonce, - IN UCHAR * SA, OUT UCHAR * output, IN UINT len) +void WpaDerivePTK(IN PRTMP_ADAPTER pAd, + u8 * PMK, + u8 * ANonce, + u8 * AA, + u8 * SNonce, + u8 * SA, u8 * output, u32 len) { - UCHAR concatenation[76]; - UINT CurrPos = 0; - UCHAR temp[32]; - UCHAR Prefix[] = + u8 concatenation[76]; + u32 CurrPos = 0; + u8 temp[32]; + u8 Prefix[] = { 'P', 'a', 'i', 'r', 'w', 'i', 's', 'e', ' ', 'k', 'e', 'y', ' ', 'e', 'x', 'p', 'a', 'n', 's', 'i', 'o', 'n' }; @@ -1478,13 +1478,13 @@ VOID WpaDerivePTK(IN PRTMP_ADAPTER pAd, ======================================================================== */ -VOID GenRandom(IN PRTMP_ADAPTER pAd, IN UCHAR * macAddr, OUT UCHAR * random) +void GenRandom(IN PRTMP_ADAPTER pAd, u8 * macAddr, u8 * random) { - INT i, curr; - UCHAR local[80], KeyCounter[32]; - UCHAR result[80]; - ULONG CurrentTime; - UCHAR prefix[] = + int i, curr; + u8 local[80], KeyCounter[32]; + u8 result[80]; + unsigned long CurrentTime; + u8 prefix[] = { 'I', 'n', 'i', 't', ' ', 'C', 'o', 'u', 'n', 't', 'e', 'r' }; /* Zero the related information */ @@ -1537,14 +1537,14 @@ VOID GenRandom(IN PRTMP_ADAPTER pAd, IN UCHAR * macAddr, OUT UCHAR * random) ======================================================================== */ -static VOID RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, - IN UCHAR ElementID, - IN UINT WepStatus, +static void RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, + u8 ElementID, + u32 WepStatus, IN BOOLEAN bMixCipher, - IN UCHAR FlexibleCipher, - OUT PUCHAR pRsnIe, OUT UCHAR * rsn_len) + u8 FlexibleCipher, + u8 *pRsnIe, u8 * rsn_len) { - UCHAR PairwiseCnt; + u8 PairwiseCnt; *rsn_len = 0; @@ -1609,7 +1609,7 @@ static VOID RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, if ((pAd->OpMode == OPMODE_STA) && (pAd->StaCfg.GroupCipher != Ndis802_11Encryption2Enabled) && (pAd->StaCfg.GroupCipher != Ndis802_11Encryption3Enabled)) { - UINT GroupCipher = pAd->StaCfg.GroupCipher; + u32 GroupCipher = pAd->StaCfg.GroupCipher; switch (GroupCipher) { case Ndis802_11GroupWEP40Enabled: NdisMoveMemory(pRsnie_cipher->mcast, @@ -1685,7 +1685,7 @@ static VOID RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, if ((pAd->OpMode == OPMODE_STA) && (pAd->StaCfg.GroupCipher != Ndis802_11Encryption2Enabled) && (pAd->StaCfg.GroupCipher != Ndis802_11Encryption3Enabled)) { - UINT GroupCipher = pAd->StaCfg.GroupCipher; + u32 GroupCipher = pAd->StaCfg.GroupCipher; switch (GroupCipher) { case Ndis802_11GroupWEP40Enabled: NdisMoveMemory(pRsnie_cipher->mcast, @@ -1722,14 +1722,14 @@ static VOID RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, ======================================================================== */ -static VOID RTMPMakeRsnIeAKM(IN PRTMP_ADAPTER pAd, - IN UCHAR ElementID, - IN UINT AuthMode, - IN UCHAR apidx, - OUT PUCHAR pRsnIe, OUT UCHAR * rsn_len) +static void RTMPMakeRsnIeAKM(IN PRTMP_ADAPTER pAd, + u8 ElementID, + u32 AuthMode, + u8 apidx, + u8 *pRsnIe, u8 * rsn_len) { RSNIE_AUTH *pRsnie_auth; - UCHAR AkmCnt = 1; /* default as 1 */ + u8 AkmCnt = 1; /* default as 1 */ pRsnie_auth = (RSNIE_AUTH *) (pRsnIe + (*rsn_len)); @@ -1803,10 +1803,10 @@ static VOID RTMPMakeRsnIeAKM(IN PRTMP_ADAPTER pAd, ======================================================================== */ -static VOID RTMPMakeRsnIeCap(IN PRTMP_ADAPTER pAd, - IN UCHAR ElementID, - IN UCHAR apidx, - OUT PUCHAR pRsnIe, OUT UCHAR * rsn_len) +static void RTMPMakeRsnIeCap(IN PRTMP_ADAPTER pAd, + u8 ElementID, + u8 apidx, + u8 *pRsnIe, u8 * rsn_len) { RSN_CAPABILITIES *pRSN_Cap; @@ -1840,15 +1840,15 @@ static VOID RTMPMakeRsnIeCap(IN PRTMP_ADAPTER pAd, ======================================================================== */ -VOID RTMPMakeRSNIE(IN PRTMP_ADAPTER pAd, - IN UINT AuthMode, IN UINT WepStatus, IN UCHAR apidx) +void RTMPMakeRSNIE(IN PRTMP_ADAPTER pAd, + u32 AuthMode, u32 WepStatus, u8 apidx) { - PUCHAR pRsnIe = NULL; /* primary RSNIE */ - UCHAR *rsnielen_cur_p = 0; /* the length of the primary RSNIE */ - UCHAR *rsnielen_ex_cur_p = 0; /* the length of the secondary RSNIE */ - UCHAR PrimaryRsnie; + u8 *pRsnIe = NULL; /* primary RSNIE */ + u8 *rsnielen_cur_p = 0; /* the length of the primary RSNIE */ + u8 *rsnielen_ex_cur_p = 0; /* the length of the secondary RSNIE */ + u8 PrimaryRsnie; BOOLEAN bMixCipher = FALSE; /* indicate the pairwise and group cipher are different */ - UCHAR p_offset; + u8 p_offset; WPA_MIX_PAIR_CIPHER FlexibleCipher = WPA_TKIPAES_WPA2_TKIPAES; /* it provide the more flexible cipher combination in WPA-WPA2 and TKIPAES mode */ rsnielen_cur_p = NULL; @@ -1934,10 +1934,10 @@ VOID RTMPMakeRSNIE(IN PRTMP_ADAPTER pAd, */ BOOLEAN RTMPCheckWPAframe(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR pData, - IN ULONG DataByteCount, IN UCHAR FromWhichBSSID) + u8 *pData, + unsigned long DataByteCount, u8 FromWhichBSSID) { - ULONG Body_len; + unsigned long Body_len; BOOLEAN Cancelled; if (DataByteCount < (LENGTH_802_1_H + LENGTH_EAPOL_H)) @@ -2014,7 +2014,7 @@ BOOLEAN RTMPCheckWPAframe(IN PRTMP_ADAPTER pAd, ========================================================================== */ -PSTRING GetEapolMsgType(CHAR msg) +char *GetEapolMsgType(char msg) { if (msg == EAPOL_PAIR_MSG_1) return "Pairwise Message 1"; @@ -2045,12 +2045,12 @@ PSTRING GetEapolMsgType(CHAR msg) ======================================================================== */ BOOLEAN RTMPCheckRSNIE(IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN UCHAR DataLen, - IN MAC_TABLE_ENTRY * pEntry, OUT UCHAR * Offset) + u8 *pData, + u8 DataLen, + IN MAC_TABLE_ENTRY * pEntry, u8 * Offset) { - PUCHAR pVIE; - UCHAR len; + u8 *pVIE; + u8 len; PEID_STRUCT pEid; BOOLEAN result = FALSE; @@ -2119,18 +2119,18 @@ BOOLEAN RTMPCheckRSNIE(IN PRTMP_ADAPTER pAd, ======================================================================== */ BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, - IN PUCHAR pKeyData, - IN UCHAR KeyDataLen, - IN UCHAR GroupKeyIndex, - IN UCHAR MsgType, + u8 *pKeyData, + u8 KeyDataLen, + u8 GroupKeyIndex, + u8 MsgType, IN BOOLEAN bWPA2, IN MAC_TABLE_ENTRY * pEntry) { PKDE_ENCAP pKDE = NULL; - PUCHAR pMyKeyData = pKeyData; - UCHAR KeyDataLength = KeyDataLen; - UCHAR GTKLEN = 0; - UCHAR DefaultIdx = 0; - UCHAR skip_offset; + u8 *pMyKeyData = pKeyData; + u8 KeyDataLength = KeyDataLen; + u8 GTKLEN = 0; + u8 DefaultIdx = 0; + u8 skip_offset; /* Verify The RSN IE contained in pairewise_msg_2 && pairewise_msg_3 and skip it */ if (MsgType == EAPOL_PAIR_MSG_2 || MsgType == EAPOL_PAIR_MSG_3) { @@ -2320,18 +2320,18 @@ BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, ======================================================================== */ -VOID ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, - IN UCHAR GroupKeyWepStatus, - IN UCHAR MsgType, - IN UCHAR DefaultKeyIdx, - IN UCHAR * KeyNonce, - IN UCHAR * TxRSC, - IN UCHAR * GTK, - IN UCHAR * RSNIE, - IN UCHAR RSNIE_Len, OUT PEAPOL_PACKET pMsg) +void ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, + u8 GroupKeyWepStatus, + u8 MsgType, + u8 DefaultKeyIdx, + u8 * KeyNonce, + u8 * TxRSC, + u8 * GTK, + u8 * RSNIE, + u8 RSNIE_Len, OUT PEAPOL_PACKET pMsg) { BOOLEAN bWPA2 = FALSE; - UCHAR KeyDescVer; + u8 KeyDescVer; /* Choose WPA2 or not */ if ((pEntry->AuthMode == Ndis802_11AuthModeWPA2) || @@ -2343,7 +2343,7 @@ VOID ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, pMsg->ProType = EAPOLKey; /* Default 95 bytes, the EAPoL-Key descriptor exclude Key-data field */ - SET_UINT16_TO_ARRARY(pMsg->Body_Len, LEN_EAPOL_KEY_MSG); + SET_u16_TO_ARRARY(pMsg->Body_Len, LEN_EAPOL_KEY_MSG); /* Fill in EAPoL descriptor */ if (bWPA2) @@ -2394,8 +2394,8 @@ VOID ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, pMsg->KeyDesc.KeyInfo.EKD_DL = 1; } /* key Information element has done. */ - *(USHORT *) (&pMsg->KeyDesc.KeyInfo) = - cpu2le16(*(USHORT *) (&pMsg->KeyDesc.KeyInfo)); + *(u16 *) (&pMsg->KeyDesc.KeyInfo) = + cpu2le16(*(u16 *) (&pMsg->KeyDesc.KeyInfo)); /* Fill in Key Length */ { @@ -2459,10 +2459,10 @@ VOID ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, ((bWPA2) ? "WPA2" : "WPA"), GetEapolMsgType(MsgType))); DBGPRINT(RT_DEBUG_TRACE, (" Body length = %d \n", - CONV_ARRARY_TO_UINT16(pMsg->Body_Len))); + CONV_ARRARY_TO_u16(pMsg->Body_Len))); DBGPRINT(RT_DEBUG_TRACE, (" Key length = %d \n", - CONV_ARRARY_TO_UINT16(pMsg->KeyDesc.KeyLength))); + CONV_ARRARY_TO_u16(pMsg->KeyDesc.KeyLength))); } @@ -2483,18 +2483,18 @@ VOID ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, ======================================================================== */ -VOID ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, - IN UCHAR GroupKeyWepStatus, - IN UCHAR keyDescVer, - IN UCHAR MsgType, - IN UCHAR DefaultKeyIdx, - IN UCHAR * GTK, - IN UCHAR * RSNIE, - IN UCHAR RSNIE_LEN, OUT PEAPOL_PACKET pMsg) +void ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, + u8 GroupKeyWepStatus, + u8 keyDescVer, + u8 MsgType, + u8 DefaultKeyIdx, + u8 * GTK, + u8 * RSNIE, + u8 RSNIE_LEN, OUT PEAPOL_PACKET pMsg) { - UCHAR *mpool, *Key_Data, *Rc4GTK; - UCHAR ekey[(LEN_KEY_DESC_IV + LEN_EAP_EK)]; - ULONG data_offset; + u8 *mpool, *Key_Data, *Rc4GTK; + u8 ekey[(LEN_KEY_DESC_IV + LEN_EAP_EK)]; + unsigned long data_offset; BOOLEAN bWPA2Capable = FALSE; PRTMP_ADAPTER pAd = pEntry->pAd; BOOLEAN GTK_Included = FALSE; @@ -2509,26 +2509,26 @@ VOID ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, return; /* allocate memory pool */ - os_alloc_mem(NULL, (PUCHAR *) & mpool, 1500); + os_alloc_mem(NULL, (u8 **) & mpool, 1500); if (mpool == NULL) return; /* Rc4GTK Len = 512 */ - Rc4GTK = (UCHAR *) ROUND_UP(mpool, 4); + Rc4GTK = (u8 *) ROUND_UP(mpool, 4); /* Key_Data Len = 512 */ - Key_Data = (UCHAR *) ROUND_UP(Rc4GTK + 512, 4); + Key_Data = (u8 *) ROUND_UP(Rc4GTK + 512, 4); NdisZeroMemory(Key_Data, 512); - SET_UINT16_TO_ARRARY(pMsg->KeyDesc.KeyDataLen, 0); + SET_u16_TO_ARRARY(pMsg->KeyDesc.KeyDataLen, 0); data_offset = 0; /* Encapsulate RSNIE in pairwise_msg2 & pairwise_msg3 */ if (RSNIE_LEN && ((MsgType == EAPOL_PAIR_MSG_2) || (MsgType == EAPOL_PAIR_MSG_3))) { - PUINT8 pmkid_ptr = NULL; - UINT8 pmkid_len = 0; + u8 *pmkid_ptr = NULL; + u8 pmkid_len = 0; RTMPInsertRSNIE(&Key_Data[data_offset], &data_offset, @@ -2584,8 +2584,8 @@ VOID ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, /*hex_dump("GTK_Included", Key_Data, data_offset); */ if ((keyDescVer == DESC_TYPE_AES)) { - UCHAR remainder = 0; - UCHAR pad_len = 0; + u8 remainder = 0; + u8 pad_len = 0; /* Key Descriptor Version 2 or 3: AES key wrap, defined in IETF RFC 3394, */ /* shall be used to encrypt the Key Data field using the KEK field from */ @@ -2596,7 +2596,7 @@ VOID ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, /* octets or if it is not a multiple of 8. The padding consists of appending */ /* a single octet 0xdd followed by zero or more 0x00 octets. */ if ((remainder = data_offset & 0x07) != 0) { - INT i; + int i; pad_len = (8 - remainder); Key_Data[data_offset] = 0xDD; @@ -2637,8 +2637,8 @@ VOID ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, } /* Update key data length field and total body length */ - SET_UINT16_TO_ARRARY(pMsg->KeyDesc.KeyDataLen, data_offset); - INC_UINT16_TO_ARRARY(pMsg->Body_Len, data_offset); + SET_u16_TO_ARRARY(pMsg->KeyDesc.KeyDataLen, data_offset); + INC_u16_TO_ARRARY(pMsg->Body_Len, data_offset); os_free_mem(NULL, mpool); @@ -2660,16 +2660,16 @@ VOID ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, ======================================================================== */ -static VOID CalculateMIC(IN UCHAR KeyDescVer, - IN UCHAR * PTK, OUT PEAPOL_PACKET pMsg) +static void CalculateMIC(u8 KeyDescVer, + u8 * PTK, OUT PEAPOL_PACKET pMsg) { - UCHAR *OutBuffer; - ULONG FrameLen = 0; - UCHAR mic[LEN_KEY_DESC_MIC]; - UCHAR digest[80]; + u8 *OutBuffer; + unsigned long FrameLen = 0; + u8 mic[LEN_KEY_DESC_MIC]; + u8 digest[80]; /* allocate memory for MIC calculation */ - os_alloc_mem(NULL, (PUCHAR *) & OutBuffer, 512); + os_alloc_mem(NULL, (u8 **) & OutBuffer, 512); if (OutBuffer == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("!!!CalculateMIC: no memory!!!\n")); @@ -2677,7 +2677,7 @@ static VOID CalculateMIC(IN UCHAR KeyDescVer, } /* make a frame for calculating MIC. */ MakeOutgoingFrame(OutBuffer, &FrameLen, - CONV_ARRARY_TO_UINT16(pMsg->Body_Len) + 4, pMsg, + CONV_ARRARY_TO_u16(pMsg->Body_Len) + 4, pMsg, END_OF_ARGS); NdisZeroMemory(mic, sizeof(mic)); @@ -2714,7 +2714,7 @@ static VOID CalculateMIC(IN UCHAR KeyDescVer, ======================================================================== */ -NDIS_STATUS RTMPSoftDecryptBroadCastData(IN PRTMP_ADAPTER pAd, +int RTMPSoftDecryptBroadCastData(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk, IN NDIS_802_11_ENCRYPTION_STATUS GroupCipher, IN PCIPHER_KEY pShard_key) @@ -2774,20 +2774,20 @@ NDIS_STATUS RTMPSoftDecryptBroadCastData(IN PRTMP_ADAPTER pAd, } -PUINT8 GetSuiteFromRSNIE(IN PUINT8 rsnie, - IN UINT rsnie_len, IN UINT8 type, OUT UINT8 * count) +u8 *GetSuiteFromRSNIE(u8 *rsnie, + u32 rsnie_len, u8 type, u8 * count) { PEID_STRUCT pEid; - INT len; - PUINT8 pBuf; - INT offset = 0; + int len; + u8 *pBuf; + int offset = 0; PRSNIE_AUTH pAkm; - UINT16 acount; + u16 acount; BOOLEAN isWPA2 = FALSE; pEid = (PEID_STRUCT) rsnie; len = rsnie_len - 2; /* exclude IE and length */ - pBuf = (PUINT8) & pEid->Octet[0]; + pBuf = (u8 *)& pEid->Octet[0]; /* set default value */ *count = 0; @@ -2800,7 +2800,7 @@ PUINT8 GetSuiteFromRSNIE(IN PUINT8 rsnie, /* Check WPA or WPA2 */ if (pEid->Eid == IE_WPA) { PRSNIE pRsnie = (PRSNIE) pBuf; - UINT16 ucount; + u16 ucount; if (len < sizeof(RSNIE)) { DBGPRINT_ERR(("%s : The length is too short for WPA\n", @@ -2831,7 +2831,7 @@ PUINT8 GetSuiteFromRSNIE(IN PUINT8 rsnie, } else if (pEid->Eid == IE_RSN) { PRSNIE2 pRsnie = (PRSNIE2) pBuf; - UINT16 ucount; + u16 ucount; isWPA2 = TRUE; @@ -2920,10 +2920,10 @@ PUINT8 GetSuiteFromRSNIE(IN PUINT8 rsnie, } -VOID WpaShowAllsuite(IN PUINT8 rsnie, IN UINT rsnie_len) +void WpaShowAllsuite(u8 *rsnie, u32 rsnie_len) { - PUINT8 pSuite = NULL; - UINT8 count; + u8 *pSuite = NULL; + u8 count; hex_dump("RSNIE", rsnie, rsnie_len); @@ -2952,25 +2952,25 @@ VOID WpaShowAllsuite(IN PUINT8 rsnie, IN UINT rsnie_len) } -VOID RTMPInsertRSNIE(IN PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN PUINT8 rsnie_ptr, - IN UINT8 rsnie_len, - IN PUINT8 pmkid_ptr, IN UINT8 pmkid_len) +void RTMPInsertRSNIE(u8 *pFrameBuf, + unsigned long *pFrameLen, + u8 *rsnie_ptr, + u8 rsnie_len, + u8 *pmkid_ptr, u8 pmkid_len) { - PUCHAR pTmpBuf; - ULONG TempLen = 0; - UINT8 extra_len = 0; - UINT16 pmk_count = 0; - UCHAR ie_num; - UINT8 total_len = 0; - UCHAR WPA2_OUI[3] = { 0x00, 0x0F, 0xAC }; + u8 *pTmpBuf; + unsigned long TempLen = 0; + u8 extra_len = 0; + u16 pmk_count = 0; + u8 ie_num; + u8 total_len = 0; + u8 WPA2_OUI[3] = { 0x00, 0x0F, 0xAC }; pTmpBuf = pFrameBuf; /* PMKID-List Must larger than 0 and the multiple of 16. */ if (pmkid_len > 0 && ((pmkid_len & 0x0f) == 0)) { - extra_len = sizeof(UINT16) + pmkid_len; + extra_len = sizeof(u16)+ pmkid_len; pmk_count = (pmkid_len >> 4); pmk_count = cpu2le16(pmk_count); diff --git a/drivers/staging/rt2860/common/crypt_hmac.c b/drivers/staging/rt2860/common/crypt_hmac.c index a50326af265e..6a086f92278a 100644 --- a/drivers/staging/rt2860/common/crypt_hmac.c +++ b/drivers/staging/rt2860/common/crypt_hmac.c @@ -46,16 +46,16 @@ Note: None ======================================================================== */ -VOID HMAC_SHA1(IN const UINT8 Key[], - IN UINT KeyLen, - IN const UINT8 Message[], - IN UINT MessageLen, OUT UINT8 MAC[], IN UINT MACLen) +void HMAC_SHA1(IN const u8 Key[], + u32 KeyLen, + IN const u8 Message[], + u32 MessageLen, u8 MAC[], u32 MACLen) { SHA1_CTX_STRUC sha_ctx1; SHA1_CTX_STRUC sha_ctx2; - UINT8 K0[SHA1_BLOCK_SIZE]; - UINT8 Digest[SHA1_DIGEST_SIZE]; - UINT index; + u8 K0[SHA1_BLOCK_SIZE]; + u8 Digest[SHA1_DIGEST_SIZE]; + u32 index; NdisZeroMemory(&sha_ctx1, sizeof(SHA1_CTX_STRUC)); NdisZeroMemory(&sha_ctx2, sizeof(SHA1_CTX_STRUC)); @@ -125,16 +125,16 @@ Note: None ======================================================================== */ -VOID HMAC_MD5(IN const UINT8 Key[], - IN UINT KeyLen, - IN const UINT8 Message[], - IN UINT MessageLen, OUT UINT8 MAC[], IN UINT MACLen) +void HMAC_MD5(IN const u8 Key[], + u32 KeyLen, + IN const u8 Message[], + u32 MessageLen, u8 MAC[], u32 MACLen) { MD5_CTX_STRUC md5_ctx1; MD5_CTX_STRUC md5_ctx2; - UINT8 K0[MD5_BLOCK_SIZE]; - UINT8 Digest[MD5_DIGEST_SIZE]; - UINT index; + u8 K0[MD5_BLOCK_SIZE]; + u8 Digest[MD5_DIGEST_SIZE]; + u32 index; NdisZeroMemory(&md5_ctx1, sizeof(MD5_CTX_STRUC)); NdisZeroMemory(&md5_ctx2, sizeof(MD5_CTX_STRUC)); diff --git a/drivers/staging/rt2860/common/crypt_md5.c b/drivers/staging/rt2860/common/crypt_md5.c index b3701f2bcc12..433aaf27dfa3 100644 --- a/drivers/staging/rt2860/common/crypt_md5.c +++ b/drivers/staging/rt2860/common/crypt_md5.c @@ -39,26 +39,26 @@ #define ROTL32(x,n) ROTL(x,n,32) /* 32 bits word */ #define ROUND1(a, b, c, d, x, s, ac) { \ - (a) += F((b),(c),(d)) + (x) + (UINT32)(ac); \ + (a) += F((b),(c),(d)) + (x) + (u32)(ac); \ (a) = ROTL32((a),(s)); \ (a) += (b); \ } #define ROUND2(a, b, c, d, x, s, ac) { \ - (a) += G((b),(c),(d)) + (x) + (UINT32)(ac); \ + (a) += G((b),(c),(d)) + (x) + (u32)(ac); \ (a) = ROTL32((a),(s)); \ (a) += (b); \ } #define ROUND3(a, b, c, d, x, s, ac) { \ - (a) += H((b),(c),(d)) + (x) + (UINT32)(ac); \ + (a) += H((b),(c),(d)) + (x) + (u32)(ac); \ (a) = ROTL32((a),(s)); \ (a) += (b); \ } #define ROUND4(a, b, c, d, x, s, ac) { \ - (a) += I((b),(c),(d)) + (x) + (UINT32)(ac); \ + (a) += I((b),(c),(d)) + (x) + (u32)(ac); \ (a) = ROTL32((a),(s)); \ (a) += (b); \ } -static const UINT32 MD5_DefaultHashValue[4] = { +static const u32 MD5_DefaultHashValue[4] = { 0x67452301UL, 0xefcdab89UL, 0x98badcfeUL, 0x10325476UL }; #endif /* MD5_SUPPORT */ @@ -79,7 +79,7 @@ Note: None ======================================================================== */ -VOID MD5_Init(IN MD5_CTX_STRUC * pMD5_CTX) +void MD5_Init(IN MD5_CTX_STRUC * pMD5_CTX) { NdisMoveMemory(pMD5_CTX->HashValue, MD5_DefaultHashValue, sizeof(MD5_DefaultHashValue)); @@ -103,11 +103,11 @@ Note: T[i] := floor(abs(sin(i + 1)) * (2 pow 32)), i is number of round ======================================================================== */ -VOID MD5_Hash(IN MD5_CTX_STRUC * pMD5_CTX) +void MD5_Hash(IN MD5_CTX_STRUC * pMD5_CTX) { - UINT32 X_i; - UINT32 X[16]; - UINT32 a, b, c, d; + u32 X_i; + u32 X[16]; + u32 a, b, c, d; /* Prepare the message schedule, {X_i} */ NdisMoveMemory(X, pMD5_CTX->Block, MD5_BLOCK_SIZE); @@ -238,11 +238,11 @@ Note: None ======================================================================== */ -VOID MD5_Append(IN MD5_CTX_STRUC * pMD5_CTX, - IN const UINT8 Message[], IN UINT MessageLen) +void MD5_Append(IN MD5_CTX_STRUC * pMD5_CTX, + IN const u8 Message[], u32 MessageLen) { - UINT appendLen = 0; - UINT diffLen = 0; + u32 appendLen = 0; + u32 diffLen = 0; while (appendLen != MessageLen) { diffLen = MessageLen - appendLen; @@ -280,10 +280,10 @@ Note: None ======================================================================== */ -VOID MD5_End(IN MD5_CTX_STRUC * pMD5_CTX, OUT UINT8 DigestMessage[]) +void MD5_End(IN MD5_CTX_STRUC * pMD5_CTX, u8 DigestMessage[]) { - UINT index; - UINT64 message_length_bits; + u32 index; + u64 message_length_bits; /* append 1 bits to end of the message */ NdisFillMemory(pMD5_CTX->Block + pMD5_CTX->BlockLen, 1, 0x80); @@ -299,7 +299,7 @@ VOID MD5_End(IN MD5_CTX_STRUC * pMD5_CTX, OUT UINT8 DigestMessage[]) NdisMoveMemory(&pMD5_CTX->Block[56], &message_length_bits, 8); MD5_Hash(pMD5_CTX); - /* Return message digest, transform the UINT32 hash value to bytes */ + /* Return message digest, transform the u32 hash value to bytes */ for (index = 0; index < 4; index++) pMD5_CTX->HashValue[index] = cpu2le32(pMD5_CTX->HashValue[index]); @@ -323,8 +323,8 @@ Note: None ======================================================================== */ -VOID RT_MD5(IN const UINT8 Message[], - IN UINT MessageLen, OUT UINT8 DigestMessage[]) +void RT_MD5(IN const u8 Message[], + u32 MessageLen, u8 DigestMessage[]) { MD5_CTX_STRUC md5_ctx; diff --git a/drivers/staging/rt2860/common/crypt_sha2.c b/drivers/staging/rt2860/common/crypt_sha2.c index 7b1bf8a3a7e1..9166ea019eda 100644 --- a/drivers/staging/rt2860/common/crypt_sha2.c +++ b/drivers/staging/rt2860/common/crypt_sha2.c @@ -41,11 +41,11 @@ #ifdef SHA1_SUPPORT /* SHA1 constants */ #define SHA1_MASK 0x0000000f -static const UINT32 SHA1_K[4] = { +static const u32 SHA1_K[4] = { 0x5a827999UL, 0x6ed9eba1UL, 0x8f1bbcdcUL, 0xca62c1d6UL }; -static const UINT32 SHA1_DefaultHashValue[5] = { +static const u32 SHA1_DefaultHashValue[5] = { 0x67452301UL, 0xefcdab89UL, 0x98badcfeUL, 0x10325476UL, 0xc3d2e1f0UL }; @@ -64,7 +64,7 @@ Note: None ======================================================================== */ -VOID RT_SHA1_Init(IN SHA1_CTX_STRUC * pSHA_CTX) +void RT_SHA1_Init(IN SHA1_CTX_STRUC * pSHA_CTX) { NdisMoveMemory(pSHA_CTX->HashValue, SHA1_DefaultHashValue, sizeof(SHA1_DefaultHashValue)); @@ -88,11 +88,11 @@ Note: None ======================================================================== */ -VOID SHA1_Hash(IN SHA1_CTX_STRUC * pSHA_CTX) +void SHA1_Hash(IN SHA1_CTX_STRUC * pSHA_CTX) { - UINT32 W_i, t, s; - UINT32 W[16]; - UINT32 a, b, c, d, e, T, f_t = 0; + u32 W_i, t, s; + u32 W[16]; + u32 a, b, c, d, e, T, f_t = 0; /* Prepare the message schedule, {W_i}, 0 < t < 15 */ NdisMoveMemory(W, pSHA_CTX->Block, SHA1_BLOCK_SIZE); @@ -168,11 +168,11 @@ Note: None ======================================================================== */ -VOID SHA1_Append(IN SHA1_CTX_STRUC * pSHA_CTX, - IN const UINT8 Message[], IN UINT MessageLen) +void SHA1_Append(IN SHA1_CTX_STRUC * pSHA_CTX, + IN const u8 Message[], u32 MessageLen) { - UINT appendLen = 0; - UINT diffLen = 0; + u32 appendLen = 0; + u32 diffLen = 0; while (appendLen != MessageLen) { diffLen = MessageLen - appendLen; @@ -210,10 +210,10 @@ Note: None ======================================================================== */ -VOID SHA1_End(IN SHA1_CTX_STRUC * pSHA_CTX, OUT UINT8 DigestMessage[]) +void SHA1_End(IN SHA1_CTX_STRUC * pSHA_CTX, u8 DigestMessage[]) { - UINT index; - UINT64 message_length_bits; + u32 index; + u64 message_length_bits; /* Append bit 1 to end of the message */ NdisFillMemory(pSHA_CTX->Block + pSHA_CTX->BlockLen, 1, 0x80); @@ -229,7 +229,7 @@ VOID SHA1_End(IN SHA1_CTX_STRUC * pSHA_CTX, OUT UINT8 DigestMessage[]) NdisMoveMemory(&pSHA_CTX->Block[56], &message_length_bits, 8); SHA1_Hash(pSHA_CTX); - /* Return message digest, transform the UINT32 hash value to bytes */ + /* Return message digest, transform the u32 hash value to bytes */ for (index = 0; index < 5; index++) pSHA_CTX->HashValue[index] = cpu2be32(pSHA_CTX->HashValue[index]); @@ -253,8 +253,8 @@ Note: None ======================================================================== */ -VOID RT_SHA1(IN const UINT8 Message[], - IN UINT MessageLen, OUT UINT8 DigestMessage[]) +void RT_SHA1(IN const u8 Message[], + u32 MessageLen, u8 DigestMessage[]) { SHA1_CTX_STRUC sha_ctx; diff --git a/drivers/staging/rt2860/common/dfs.c b/drivers/staging/rt2860/common/dfs.c index bfe742d9c693..8bee5cf03e4b 100644 --- a/drivers/staging/rt2860/common/dfs.c +++ b/drivers/staging/rt2860/common/dfs.c @@ -52,9 +52,9 @@ ======================================================================== */ -BOOLEAN RadarChannelCheck(IN PRTMP_ADAPTER pAd, IN UCHAR Ch) +BOOLEAN RadarChannelCheck(IN PRTMP_ADAPTER pAd, u8 Ch) { - INT i; + int i; BOOLEAN result = FALSE; for (i = 0; i < pAd->ChannelListNum; i++) { diff --git a/drivers/staging/rt2860/common/ee_efuse.c b/drivers/staging/rt2860/common/ee_efuse.c index 8e49cd713d13..b997151c25ff 100644 --- a/drivers/staging/rt2860/common/ee_efuse.c +++ b/drivers/staging/rt2860/common/ee_efuse.c @@ -48,16 +48,16 @@ typedef union _EFUSE_CTRL_STRUC { struct { - UINT32 EFSROM_AOUT:6; - UINT32 EFSROM_MODE:2; - UINT32 EFSROM_LDO_OFF_TIME:6; - UINT32 EFSROM_LDO_ON_TIME:2; - UINT32 EFSROM_AIN:10; - UINT32 RESERVED:4; - UINT32 EFSROM_KICK:1; - UINT32 SEL_EFUSE:1; + u32 EFSROM_AOUT:6; + u32 EFSROM_MODE:2; + u32 EFSROM_LDO_OFF_TIME:6; + u32 EFSROM_LDO_ON_TIME:2; + u32 EFSROM_AIN:10; + u32 RESERVED:4; + u32 EFSROM_KICK:1; + u32 SEL_EFUSE:1; } field; - UINT32 word; + u32 word; } EFUSE_CTRL_STRUC, *PEFUSE_CTRL_STRUC; /* @@ -73,13 +73,13 @@ typedef union _EFUSE_CTRL_STRUC { ======================================================================== */ -UCHAR eFuseReadRegisters(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, IN USHORT Length, OUT USHORT * pData) +u8 eFuseReadRegisters(IN PRTMP_ADAPTER pAd, + u16 Offset, u16 Length, u16 * pData) { EFUSE_CTRL_STRUC eFuseCtrlStruc; int i; - USHORT efuseDataOffset; - UINT32 data; + u16 efuseDataOffset; + u32 data; RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); @@ -132,7 +132,7 @@ UCHAR eFuseReadRegisters(IN PRTMP_ADAPTER pAd, NdisMoveMemory(pData, &data, Length); } - return (UCHAR) eFuseCtrlStruc.field.EFSROM_AOUT; + return (u8)eFuseCtrlStruc.field.EFSROM_AOUT; } @@ -149,14 +149,14 @@ UCHAR eFuseReadRegisters(IN PRTMP_ADAPTER pAd, ======================================================================== */ -VOID eFusePhysicalReadRegisters(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, OUT USHORT * pData) +void eFusePhysicalReadRegisters(IN PRTMP_ADAPTER pAd, + u16 Offset, + u16 Length, u16 * pData) { EFUSE_CTRL_STRUC eFuseCtrlStruc; int i; - USHORT efuseDataOffset; - UINT32 data; + u16 efuseDataOffset; + u32 data; RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrlStruc.word); @@ -214,16 +214,16 @@ VOID eFusePhysicalReadRegisters(IN PRTMP_ADAPTER pAd, ======================================================================== */ -static VOID eFuseReadPhysical(IN PRTMP_ADAPTER pAd, - IN PUSHORT lpInBuffer, - IN ULONG nInBufferSize, - OUT PUSHORT lpOutBuffer, IN ULONG nOutBufferSize) +static void eFuseReadPhysical(IN PRTMP_ADAPTER pAd, + u16 *lpInBuffer, + unsigned long nInBufferSize, + u16 *lpOutBuffer, unsigned long nOutBufferSize) { - USHORT *pInBuf = (USHORT *) lpInBuffer; - USHORT *pOutBuf = (USHORT *) lpOutBuffer; + u16 *pInBuf = (u16 *) lpInBuffer; + u16 *pOutBuf = (u16 *) lpOutBuffer; - USHORT Offset = pInBuf[0]; /*addr */ - USHORT Length = pInBuf[1]; /*length */ + u16 Offset = pInBuf[0]; /*addr */ + u16 Length = pInBuf[1]; /*length */ int i; for (i = 0; i < Length; i += 2) { @@ -244,20 +244,20 @@ static VOID eFuseReadPhysical(IN PRTMP_ADAPTER pAd, ======================================================================== */ -INT set_eFuseGetFreeBlockCount_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg) +int set_eFuseGetFreeBlockCount_Proc(IN PRTMP_ADAPTER pAd, char *arg) { - USHORT i; - USHORT LogicalAddress; - USHORT efusefreenum = 0; + u16 i; + u16 LogicalAddress; + u16 efusefreenum = 0; if (!pAd->bUseEfuse) return FALSE; for (i = EFUSE_USAGE_MAP_START; i <= EFUSE_USAGE_MAP_END; i += 2) { eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); if ((LogicalAddress & 0xff) == 0) { - efusefreenum = (UCHAR) (EFUSE_USAGE_MAP_END - i + 1); + efusefreenum = (u8)(EFUSE_USAGE_MAP_END - i + 1); break; } else if (((LogicalAddress >> 8) & 0xff) == 0) { - efusefreenum = (UCHAR) (EFUSE_USAGE_MAP_END - i); + efusefreenum = (u8)(EFUSE_USAGE_MAP_END - i); break; } @@ -268,10 +268,10 @@ INT set_eFuseGetFreeBlockCount_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg) return TRUE; } -INT set_eFusedump_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg) +int set_eFusedump_Proc(IN PRTMP_ADAPTER pAd, char *arg) { - USHORT InBuf[3]; - INT i = 0; + u16 InBuf[3]; + int i = 0; if (!pAd->bUseEfuse) return FALSE; for (i = 0; i < EFUSE_USAGE_MAP_END / 2; i++) { @@ -288,7 +288,7 @@ INT set_eFusedump_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg) } int rtmp_ee_efuse_read16(IN RTMP_ADAPTER * pAd, - IN USHORT Offset, OUT USHORT * pValue) + u16 Offset, u16 * pValue) { eFuseReadRegisters(pAd, Offset, 2, pValue); return (*pValue); @@ -296,7 +296,7 @@ int rtmp_ee_efuse_read16(IN RTMP_ADAPTER * pAd, int RtmpEfuseSupportCheck(IN RTMP_ADAPTER * pAd) { - USHORT value; + u16 value; if (IS_RT30xx(pAd)) { eFusePhysicalReadRegisters(pAd, EFUSE_TAG, 2, &value); @@ -305,10 +305,10 @@ int RtmpEfuseSupportCheck(IN RTMP_ADAPTER * pAd) return 0; } -VOID eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, PUINT EfuseFreeBlock) +void eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, u32 *EfuseFreeBlock) { - USHORT i; - USHORT LogicalAddress; + u16 i; + u16 LogicalAddress; if (!pAd->bUseEfuse) { DBGPRINT(RT_DEBUG_TRACE, ("eFuseGetFreeBlockCount Only supports efuse Mode\n")); @@ -317,10 +317,10 @@ VOID eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, PUINT EfuseFreeBlock) for (i = EFUSE_USAGE_MAP_START; i <= EFUSE_USAGE_MAP_END; i += 2) { eFusePhysicalReadRegisters(pAd, i, 2, &LogicalAddress); if ((LogicalAddress & 0xff) == 0) { - *EfuseFreeBlock = (UCHAR) (EFUSE_USAGE_MAP_END - i + 1); + *EfuseFreeBlock = (u8)(EFUSE_USAGE_MAP_END - i + 1); break; } else if (((LogicalAddress >> 8) & 0xff) == 0) { - *EfuseFreeBlock = (UCHAR) (EFUSE_USAGE_MAP_END - i); + *EfuseFreeBlock = (u8)(EFUSE_USAGE_MAP_END - i); break; } @@ -331,9 +331,9 @@ VOID eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, PUINT EfuseFreeBlock) ("eFuseGetFreeBlockCount is 0x%x\n", *EfuseFreeBlock)); } -INT eFuse_init(IN PRTMP_ADAPTER pAd) +int eFuse_init(IN PRTMP_ADAPTER pAd) { - UINT EfuseFreeBlock = 0; + u32 EfuseFreeBlock = 0; DBGPRINT(RT_DEBUG_ERROR, ("NVM is Efuse and its size =%x[%x-%x] \n", EFUSE_USAGE_MAP_SIZE, EFUSE_USAGE_MAP_START, diff --git a/drivers/staging/rt2860/common/ee_prom.c b/drivers/staging/rt2860/common/ee_prom.c index fa3f2311f3c5..8cd654c4f99b 100644 --- a/drivers/staging/rt2860/common/ee_prom.c +++ b/drivers/staging/rt2860/common/ee_prom.c @@ -38,7 +38,7 @@ #include "../rt_config.h" /* IRQL = PASSIVE_LEVEL */ -static inline VOID RaiseClock(IN PRTMP_ADAPTER pAd, IN UINT32 * x) +static inline void RaiseClock(IN PRTMP_ADAPTER pAd, u32 * x) { *x = *x | EESK; RTMP_IO_WRITE32(pAd, E2PROM_CSR, *x); @@ -46,7 +46,7 @@ static inline VOID RaiseClock(IN PRTMP_ADAPTER pAd, IN UINT32 * x) } /* IRQL = PASSIVE_LEVEL */ -static inline VOID LowerClock(IN PRTMP_ADAPTER pAd, IN UINT32 * x) +static inline void LowerClock(IN PRTMP_ADAPTER pAd, u32 * x) { *x = *x & ~EESK; RTMP_IO_WRITE32(pAd, E2PROM_CSR, *x); @@ -54,10 +54,10 @@ static inline VOID LowerClock(IN PRTMP_ADAPTER pAd, IN UINT32 * x) } /* IRQL = PASSIVE_LEVEL */ -static inline USHORT ShiftInBits(IN PRTMP_ADAPTER pAd) +static inline u16 ShiftInBits(IN PRTMP_ADAPTER pAd) { - UINT32 x, i; - USHORT data = 0; + u32 x, i; + u16 data = 0; RTMP_IO_READ32(pAd, E2PROM_CSR, &x); @@ -79,10 +79,10 @@ static inline USHORT ShiftInBits(IN PRTMP_ADAPTER pAd) } /* IRQL = PASSIVE_LEVEL */ -static inline VOID ShiftOutBits(IN PRTMP_ADAPTER pAd, - IN USHORT data, IN USHORT count) +static inline void ShiftOutBits(IN PRTMP_ADAPTER pAd, + u16 data, u16 count) { - UINT32 x, mask; + u32 x, mask; mask = 0x01 << (count - 1); RTMP_IO_READ32(pAd, E2PROM_CSR, &x); @@ -107,9 +107,9 @@ static inline VOID ShiftOutBits(IN PRTMP_ADAPTER pAd, } /* IRQL = PASSIVE_LEVEL */ -static inline VOID EEpromCleanup(IN PRTMP_ADAPTER pAd) +static inline void EEpromCleanup(IN PRTMP_ADAPTER pAd) { - UINT32 x; + u32 x; RTMP_IO_READ32(pAd, E2PROM_CSR, &x); @@ -120,9 +120,9 @@ static inline VOID EEpromCleanup(IN PRTMP_ADAPTER pAd) LowerClock(pAd, &x); } -static inline VOID EWEN(IN PRTMP_ADAPTER pAd) +static inline void EWEN(IN PRTMP_ADAPTER pAd) { - UINT32 x; + u32 x; /* reset bits and set EECS */ RTMP_IO_READ32(pAd, E2PROM_CSR, &x); @@ -141,9 +141,9 @@ static inline VOID EWEN(IN PRTMP_ADAPTER pAd) EEpromCleanup(pAd); } -static inline VOID EWDS(IN PRTMP_ADAPTER pAd) +static inline void EWDS(IN PRTMP_ADAPTER pAd) { - UINT32 x; + u32 x; /* reset bits and set EECS */ RTMP_IO_READ32(pAd, E2PROM_CSR, &x); @@ -164,10 +164,10 @@ static inline VOID EWDS(IN PRTMP_ADAPTER pAd) /* IRQL = PASSIVE_LEVEL */ int rtmp_ee_prom_read16(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, OUT USHORT * pValue) + u16 Offset, u16 * pValue) { - UINT32 x; - USHORT data; + u32 x; + u16 data; Offset /= 2; /* reset bits and set EECS */ diff --git a/drivers/staging/rt2860/common/eeprom.c b/drivers/staging/rt2860/common/eeprom.c index 202d313b6553..764de3a7807f 100644 --- a/drivers/staging/rt2860/common/eeprom.c +++ b/drivers/staging/rt2860/common/eeprom.c @@ -36,12 +36,12 @@ */ #include "../rt_config.h" -INT RtmpChipOpsEepromHook(IN RTMP_ADAPTER * pAd, IN INT infType) +int RtmpChipOpsEepromHook(IN RTMP_ADAPTER * pAd, int infType) { RTMP_CHIP_OP *pChipOps = &pAd->chipOps; #ifdef RT30xx #ifdef RTMP_EFUSE_SUPPORT - UINT32 eFuseCtrl, MacCsr0; + u32 eFuseCtrl, MacCsr0; int index; index = 0; diff --git a/drivers/staging/rt2860/common/firmware.h b/drivers/staging/rt2860/common/firmware.h index e984725358da..2fecd32f7600 100644 --- a/drivers/staging/rt2860/common/firmware.h +++ b/drivers/staging/rt2860/common/firmware.h @@ -43,7 +43,7 @@ /* AUTO GEN PLEASE DO NOT MODIFY IT */ -UCHAR FirmwareImage_2860 [] = { +u8 FirmwareImage_2860 [] = { 0x02, 0x03, 0x5e, 0x02, 0x02, 0xb1, 0x22, 0x22, 0xff, 0xff, 0xff, 0x02, 0x01, 0x82, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x1e, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x01, 0x33, 0xc0, 0xe0, 0xc0, 0xf0, 0xc0, 0x83, 0xc0, 0x82, 0xc0, 0xd0, 0x75, 0xd0, 0x18, 0xc2, 0xaf, 0x30, 0x45, 0x03, diff --git a/drivers/staging/rt2860/common/firmware_3070.h b/drivers/staging/rt2860/common/firmware_3070.h index 19569407f722..b710d40bc046 100644 --- a/drivers/staging/rt2860/common/firmware_3070.h +++ b/drivers/staging/rt2860/common/firmware_3070.h @@ -2,7 +2,7 @@ /* AUTO GEN PLEASE DO NOT MODIFY IT */ -UCHAR FirmwareImage_3070 [] = { +u8 FirmwareImage_3070 [] = { 0xff, 0xff, 0xff, 0x02, 0x10, 0x28, 0x02, 0x10, 0x32, 0x02, 0x10, 0x78, 0x02, 0x13, 0x1f, 0x02, 0x13, 0x20, 0x02, 0x13, 0x3f, 0x02, 0x13, 0x44, 0x12, 0x13, 0x40, 0x22, 0x02, 0x17, 0xae, 0x02, 0x18, 0xd2, 0x02, 0x14, 0x3d, 0x02, 0x13, 0x78, 0x30, 0x05, 0x06, 0x20, 0x0d, 0x03, 0x12, 0x19, diff --git a/drivers/staging/rt2860/common/mlme.c b/drivers/staging/rt2860/common/mlme.c index e047b89f88c3..fcf030b7db66 100644 --- a/drivers/staging/rt2860/common/mlme.c +++ b/drivers/staging/rt2860/common/mlme.c @@ -39,19 +39,19 @@ #include "../rt_config.h" #include -UCHAR CISCO_OUI[] = { 0x00, 0x40, 0x96 }; - -UCHAR WPA_OUI[] = { 0x00, 0x50, 0xf2, 0x01 }; -UCHAR RSN_OUI[] = { 0x00, 0x0f, 0xac }; -UCHAR WME_INFO_ELEM[] = { 0x00, 0x50, 0xf2, 0x02, 0x00, 0x01 }; -UCHAR WME_PARM_ELEM[] = { 0x00, 0x50, 0xf2, 0x02, 0x01, 0x01 }; -UCHAR Ccx2QosInfo[] = { 0x00, 0x40, 0x96, 0x04 }; -UCHAR RALINK_OUI[] = { 0x00, 0x0c, 0x43 }; -UCHAR BROADCOM_OUI[] = { 0x00, 0x90, 0x4c }; -UCHAR WPS_OUI[] = { 0x00, 0x50, 0xf2, 0x04 }; -UCHAR PRE_N_HT_OUI[] = { 0x00, 0x90, 0x4c }; - -UCHAR RateSwitchTable[] = { +u8 CISCO_OUI[] = { 0x00, 0x40, 0x96 }; + +u8 WPA_OUI[] = { 0x00, 0x50, 0xf2, 0x01 }; +u8 RSN_OUI[] = { 0x00, 0x0f, 0xac }; +u8 WME_INFO_ELEM[] = { 0x00, 0x50, 0xf2, 0x02, 0x00, 0x01 }; +u8 WME_PARM_ELEM[] = { 0x00, 0x50, 0xf2, 0x02, 0x01, 0x01 }; +u8 Ccx2QosInfo[] = { 0x00, 0x40, 0x96, 0x04 }; +u8 RALINK_OUI[] = { 0x00, 0x0c, 0x43 }; +u8 BROADCOM_OUI[] = { 0x00, 0x90, 0x4c }; +u8 WPS_OUI[] = { 0x00, 0x50, 0xf2, 0x04 }; +u8 PRE_N_HT_OUI[] = { 0x00, 0x90, 0x4c }; + +u8 RateSwitchTable[] = { /* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ 0x11, 0x00, 0, 0, 0, /* Initial used item after association */ 0x00, 0x00, 0, 40, 101, @@ -88,7 +88,7 @@ UCHAR RateSwitchTable[] = { 0x1f, 0x00, 0, 0, 0, }; -UCHAR RateSwitchTable11B[] = { +u8 RateSwitchTable11B[] = { /* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ 0x04, 0x03, 0, 0, 0, /* Initial used item after association */ 0x00, 0x00, 0, 40, 101, @@ -97,7 +97,7 @@ UCHAR RateSwitchTable11B[] = { 0x03, 0x00, 3, 20, 45, }; -UCHAR RateSwitchTable11BG[] = { +u8 RateSwitchTable11BG[] = { /* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ 0x0a, 0x00, 0, 0, 0, /* Initial used item after association */ 0x00, 0x00, 0, 40, 101, @@ -112,7 +112,7 @@ UCHAR RateSwitchTable11BG[] = { 0x09, 0x10, 7, 10, 13, }; -UCHAR RateSwitchTable11G[] = { +u8 RateSwitchTable11G[] = { /* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ 0x08, 0x00, 0, 0, 0, /* Initial used item after association */ 0x00, 0x10, 0, 20, 101, @@ -125,7 +125,7 @@ UCHAR RateSwitchTable11G[] = { 0x07, 0x10, 7, 10, 13, }; -UCHAR RateSwitchTable11N1S[] = { +u8 RateSwitchTable11N1S[] = { /* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ 0x0c, 0x0a, 0, 0, 0, /* Initial used item after association */ 0x00, 0x00, 0, 40, 101, @@ -142,7 +142,7 @@ UCHAR RateSwitchTable11N1S[] = { 0x0b, 0x23, 7, 8, 14, }; -UCHAR RateSwitchTable11N2S[] = { +u8 RateSwitchTable11N2S[] = { /* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ 0x0e, 0x0c, 0, 0, 0, /* Initial used item after association */ 0x00, 0x00, 0, 40, 101, @@ -161,7 +161,7 @@ UCHAR RateSwitchTable11N2S[] = { 0x0d, 0x22, 15, 8, 15, }; -UCHAR RateSwitchTable11N3S[] = { +u8 RateSwitchTable11N3S[] = { /* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ 0x0b, 0x00, 0, 0, 0, /* 0x0a, 0x00, 0, 0, 0, // Initial used item after association */ 0x00, 0x21, 0, 30, 101, @@ -177,7 +177,7 @@ UCHAR RateSwitchTable11N3S[] = { 0x0a, 0x22, 15, 8, 25, /* 0x09, 0x22, 15, 8, 25, */ }; -UCHAR RateSwitchTable11N2SForABand[] = { +u8 RateSwitchTable11N2SForABand[] = { /* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ 0x0b, 0x09, 0, 0, 0, /* Initial used item after association */ 0x00, 0x21, 0, 30, 101, @@ -193,7 +193,7 @@ UCHAR RateSwitchTable11N2SForABand[] = { 0x0a, 0x22, 15, 8, 25, }; -UCHAR RateSwitchTable11N3SForABand[] = { /* 3*3 */ +u8 RateSwitchTable11N3SForABand[] = { /* 3*3 */ /* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ 0x0b, 0x09, 0, 0, 0, /* Initial used item after association */ 0x00, 0x21, 0, 30, 101, @@ -209,7 +209,7 @@ UCHAR RateSwitchTable11N3SForABand[] = { /* 3*3 */ 0x0a, 0x22, 15, 8, 25, }; -UCHAR RateSwitchTable11BGN1S[] = { +u8 RateSwitchTable11BGN1S[] = { /* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ 0x0c, 0x0a, 0, 0, 0, /* Initial used item after association */ 0x00, 0x00, 0, 40, 101, @@ -226,7 +226,7 @@ UCHAR RateSwitchTable11BGN1S[] = { 0x0b, 0x23, 7, 8, 14, }; -UCHAR RateSwitchTable11BGN2S[] = { +u8 RateSwitchTable11BGN2S[] = { /* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ 0x0e, 0x0c, 0, 0, 0, /* Initial used item after association */ 0x00, 0x00, 0, 40, 101, @@ -245,7 +245,7 @@ UCHAR RateSwitchTable11BGN2S[] = { 0x0d, 0x22, 15, 8, 15, }; -UCHAR RateSwitchTable11BGN3S[] = { /* 3*3 */ +u8 RateSwitchTable11BGN3S[] = { /* 3*3 */ /* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ 0x0a, 0x00, 0, 0, 0, /* Initial used item after association */ 0x00, 0x21, 0, 30, 101, /*50 */ @@ -260,7 +260,7 @@ UCHAR RateSwitchTable11BGN3S[] = { /* 3*3 */ 0x09, 0x22, 23, 8, 25, }; -UCHAR RateSwitchTable11BGN2SForABand[] = { +u8 RateSwitchTable11BGN2SForABand[] = { /* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ 0x0b, 0x09, 0, 0, 0, /* Initial used item after association */ 0x00, 0x21, 0, 30, 101, /*50 */ @@ -276,7 +276,7 @@ UCHAR RateSwitchTable11BGN2SForABand[] = { 0x0a, 0x22, 15, 8, 25, }; -UCHAR RateSwitchTable11BGN3SForABand[] = { /* 3*3 */ +u8 RateSwitchTable11BGN3SForABand[] = { /* 3*3 */ /* Item No. Mode Curr-MCS TrainUp TrainDown // Mode- Bit0: STBC, Bit1: Short GI, Bit4,5: Mode(0:CCK, 1:OFDM, 2:HT Mix, 3:HT GF) */ 0x0c, 0x09, 0, 0, 0, /* Initial used item after association */ 0x00, 0x21, 0, 30, 101, /*50 */ @@ -293,10 +293,10 @@ UCHAR RateSwitchTable11BGN3SForABand[] = { /* 3*3 */ 0x0b, 0x22, 23, 8, 25, }; -extern UCHAR OfdmRateToRxwiMCS[]; +extern u8 OfdmRateToRxwiMCS[]; /* since RT61 has better RX sensibility, we have to limit TX ACK rate not to exceed our normal data TX rate. */ /* otherwise the WLAN peer may not be able to receive the ACK thus downgrade its data TX rate */ -ULONG BasicRateMask[12] = +unsigned long BasicRateMask[12] = { 0xfffff001 /* 1-Mbps */ , 0xfffff003 /* 2 Mbps */ , 0xfffff007 /* 5.5 */ , 0xfffff00f /* 11 */ , 0xfffff01f /* 6 */ , 0xfffff03f /* 9 */ , 0xfffff07f /* 12 */ , @@ -305,38 +305,38 @@ ULONG BasicRateMask[12] = 0xffffffff /* 54 */ }; -UCHAR BROADCAST_ADDR[MAC_ADDR_LEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; -UCHAR ZERO_MAC_ADDR[MAC_ADDR_LEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +u8 BROADCAST_ADDR[MAC_ADDR_LEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; +u8 ZERO_MAC_ADDR[MAC_ADDR_LEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; /* e.g. RssiSafeLevelForTxRate[RATE_36]" means if the current RSSI is greater than */ /* this value, then it's quaranteed capable of operating in 36 mbps TX rate in */ /* clean environment. */ /* TxRate: 1 2 5.5 11 6 9 12 18 24 36 48 54 72 100 */ -CHAR RssiSafeLevelForTxRate[] = +char RssiSafeLevelForTxRate[] = { -92, -91, -90, -87, -88, -86, -85, -83, -81, -78, -72, -71, -40, -40 }; -UCHAR RateIdToMbps[] = { 1, 2, 5, 11, 6, 9, 12, 18, 24, 36, 48, 54, 72, 100 }; -USHORT RateIdTo500Kbps[] = +u8 RateIdToMbps[] = { 1, 2, 5, 11, 6, 9, 12, 18, 24, 36, 48, 54, 72, 100 }; +u16 RateIdTo500Kbps[] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108, 144, 200 }; -UCHAR SsidIe = IE_SSID; -UCHAR SupRateIe = IE_SUPP_RATES; -UCHAR ExtRateIe = IE_EXT_SUPP_RATES; -UCHAR HtCapIe = IE_HT_CAP; -UCHAR AddHtInfoIe = IE_ADD_HT; -UCHAR NewExtChanIe = IE_SECONDARY_CH_OFFSET; -UCHAR ErpIe = IE_ERP; -UCHAR DsIe = IE_DS_PARM; -UCHAR TimIe = IE_TIM; -UCHAR WpaIe = IE_WPA; -UCHAR Wpa2Ie = IE_WPA2; -UCHAR IbssIe = IE_IBSS_PARM; +u8 SsidIe = IE_SSID; +u8 SupRateIe = IE_SUPP_RATES; +u8 ExtRateIe = IE_EXT_SUPP_RATES; +u8 HtCapIe = IE_HT_CAP; +u8 AddHtInfoIe = IE_ADD_HT; +u8 NewExtChanIe = IE_SECONDARY_CH_OFFSET; +u8 ErpIe = IE_ERP; +u8 DsIe = IE_DS_PARM; +u8 TimIe = IE_TIM; +u8 WpaIe = IE_WPA; +u8 Wpa2Ie = IE_WPA2; +u8 IbssIe = IE_IBSS_PARM; -extern UCHAR WPA_OUI[]; +extern u8 WPA_OUI[]; -UCHAR SES_OUI[] = { 0x00, 0x90, 0x4c }; +u8 SES_OUI[] = { 0x00, 0x90, 0x4c }; -UCHAR ZeroSsid[32] = +u8 ZeroSsid[32] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -356,9 +356,9 @@ UCHAR ZeroSsid[32] = ========================================================================== */ -NDIS_STATUS MlmeInit(IN PRTMP_ADAPTER pAd) +int MlmeInit(IN PRTMP_ADAPTER pAd) { - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + int Status = NDIS_STATUS_SUCCESS; DBGPRINT(RT_DEBUG_TRACE, ("--> MLME Initialize\n")); @@ -453,7 +453,7 @@ NDIS_STATUS MlmeInit(IN PRTMP_ADAPTER pAd) ========================================================================== */ -VOID MlmeHandler(IN PRTMP_ADAPTER pAd) +void MlmeHandler(IN PRTMP_ADAPTER pAd) { MLME_QUEUE_ELEM *Elem = NULL; @@ -571,7 +571,7 @@ VOID MlmeHandler(IN PRTMP_ADAPTER pAd) ========================================================================== */ -VOID MlmeHalt(IN PRTMP_ADAPTER pAd) +void MlmeHalt(IN PRTMP_ADAPTER pAd) { BOOLEAN Cancelled; @@ -639,7 +639,7 @@ VOID MlmeHalt(IN PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_TRACE, ("<== MlmeHalt\n")); } -VOID MlmeResetRalinkCounters(IN PRTMP_ADAPTER pAd) +void MlmeResetRalinkCounters(IN PRTMP_ADAPTER pAd) { pAd->RalinkCounters.LastOneSecRxOkDataCnt = pAd->RalinkCounters.OneSecRxOkDataCnt; @@ -689,11 +689,11 @@ VOID MlmeResetRalinkCounters(IN PRTMP_ADAPTER pAd) ========================================================================== */ #define ADHOC_BEACON_LOST_TIME (8*OS_HZ) /* 8 sec */ -VOID MlmePeriodicExec(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) +void MlmePeriodicExec(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3) { - ULONG TxTotalCnt; + unsigned long TxTotalCnt; PRTMP_ADAPTER pAd = (RTMP_ADAPTER *) FunctionContext; #ifdef RTMP_MAC_PCI @@ -706,7 +706,7 @@ VOID MlmePeriodicExec(IN PVOID SystemSpecific1, && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) /*&&(pAd->bPCIclkOff == FALSE) */ ) { - UINT32 data = 0; + u32 data = 0; /* Read GPIO pin2 as Hardware controlled radio state */ #ifndef RT3090 @@ -891,7 +891,7 @@ VOID MlmePeriodicExec(IN PVOID SystemSpecific1, /* 2. If in 0x10F4 the ((bit29==1) && (bit7==1)) OR ((bit29==1) && (bit5==1)), it means the deadlock has occurred. */ /* 3. If the deadlock occurred, reset MAC/BBP by setting 0x1004 to 0x0001 for a while then setting it back to 0x000C again. */ - UINT32 MacReg = 0; + u32 MacReg = 0; RTMP_IO_READ32(pAd, 0x10F4, &MacReg); if (((MacReg & 0x20000000) && (MacReg & 0x80)) @@ -921,7 +921,7 @@ VOID MlmePeriodicExec(IN PVOID SystemSpecific1, IRQL = DISPATCH_LEVEL ========================================================================== */ -BOOLEAN MlmeValidateSSID(IN PUCHAR pSsid, IN UCHAR SsidLen) +BOOLEAN MlmeValidateSSID(u8 *pSsid, u8 SsidLen) { int index; @@ -938,10 +938,10 @@ BOOLEAN MlmeValidateSSID(IN PUCHAR pSsid, IN UCHAR SsidLen) return (TRUE); } -VOID MlmeSelectTxRateTable(IN PRTMP_ADAPTER pAd, +void MlmeSelectTxRateTable(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR * ppTable, - IN PUCHAR pTableSize, IN PUCHAR pInitTxRateIdx) + u8 ** ppTable, + u8 *pTableSize, u8 *pInitTxRateIdx) { do { /* decide the rate table for tuning */ @@ -1144,9 +1144,9 @@ VOID MlmeSelectTxRateTable(IN PRTMP_ADAPTER pAd, } while (FALSE); } -VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) +void STAMlmePeriodicExec(PRTMP_ADAPTER pAd) { - ULONG TxTotalCnt; + unsigned long TxTotalCnt; int i; /* @@ -1341,8 +1341,8 @@ VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) if (pAd->StaCfg.bAutoRoaming) { BOOLEAN rv = FALSE; - CHAR dBmToRoam = pAd->StaCfg.dBmToRoam; - CHAR MaxRssi = RTMPMaxRssi(pAd, + char dBmToRoam = pAd->StaCfg.dBmToRoam; + char MaxRssi = RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample. LastRssi0, pAd->StaCfg.RssiSample. @@ -1357,7 +1357,7 @@ VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) && (MaxRssi <= dBmToRoam)) { DBGPRINT(RT_DEBUG_TRACE, ("Rssi=%d, dBmToRoam=%d\n", MaxRssi, - (CHAR) dBmToRoam)); + (char)dBmToRoam)); /* Add auto seamless roaming */ if (rv == FALSE) @@ -1392,7 +1392,7 @@ VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) LinkDown(pAd, FALSE); StartParmFill(pAd, &StartReq, - (CHAR *) pAd->MlmeAux.Ssid, + (char *) pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, sizeof(MLME_START_REQ_STRUCT), &StartReq); @@ -1439,7 +1439,7 @@ VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd) pAd->MlmeAux. AutoReconnectSsid)); ScanParmFill(pAd, &ScanReq, - (PSTRING) pAd->MlmeAux. + (char *)pAd->MlmeAux. AutoReconnectSsid, pAd->MlmeAux. AutoReconnectSsidLen, @@ -1487,9 +1487,9 @@ SKIP_AUTO_SCAN_CONN: } /* Link down report */ -VOID LinkDownExec(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) +void LinkDownExec(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3) { RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; @@ -1517,7 +1517,7 @@ VOID LinkDownExec(IN PVOID SystemSpecific1, } /* IRQL = DISPATCH_LEVEL */ -VOID MlmeAutoScan(IN PRTMP_ADAPTER pAd) +void MlmeAutoScan(IN PRTMP_ADAPTER pAd) { /* check CntlMachine.CurrState to avoid collision with NDIS SetOID request */ if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) { @@ -1532,7 +1532,7 @@ VOID MlmeAutoScan(IN PRTMP_ADAPTER pAd) } /* IRQL = DISPATCH_LEVEL */ -VOID MlmeAutoReconnectLastSSID(IN PRTMP_ADAPTER pAd) +void MlmeAutoReconnectLastSSID(IN PRTMP_ADAPTER pAd) { if (pAd->StaCfg.bAutoConnectByBssid) { DBGPRINT(RT_DEBUG_TRACE, @@ -1582,9 +1582,9 @@ VOID MlmeAutoReconnectLastSSID(IN PRTMP_ADAPTER pAd) Output: ========================================================================== */ -VOID MlmeCheckForRoaming(IN PRTMP_ADAPTER pAd, IN ULONG Now32) +void MlmeCheckForRoaming(IN PRTMP_ADAPTER pAd, unsigned long Now32) { - USHORT i; + u16 i; BSS_TABLE *pRoamTab = &pAd->MlmeAux.RoamTab; BSS_ENTRY *pBss; @@ -1642,7 +1642,7 @@ VOID MlmeCheckForRoaming(IN PRTMP_ADAPTER pAd, IN ULONG Now32) */ BOOLEAN MlmeCheckForFastRoaming(IN PRTMP_ADAPTER pAd) { - USHORT i; + u16 i; BSS_TABLE *pRoamTab = &pAd->MlmeAux.RoamTab; BSS_ENTRY *pBss; @@ -1699,10 +1699,10 @@ BOOLEAN MlmeCheckForFastRoaming(IN PRTMP_ADAPTER pAd) return FALSE; } -VOID MlmeSetTxRate(IN PRTMP_ADAPTER pAd, +void MlmeSetTxRate(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, IN PRTMP_TX_RATE_SWITCH pTxRate) { - UCHAR MaxMode = MODE_OFDM; + u8 MaxMode = MODE_OFDM; MaxMode = MODE_HTGREENFIELD; @@ -1820,7 +1820,7 @@ VOID MlmeSetTxRate(IN PRTMP_ADAPTER pAd, pEntry->HTPhyMode.field.MODE = MODE_HTGREENFIELD; } - pAd->LastTxRate = (USHORT) (pEntry->HTPhyMode.word); + pAd->LastTxRate = (u16)(pEntry->HTPhyMode.word); } /* @@ -1840,20 +1840,20 @@ VOID MlmeSetTxRate(IN PRTMP_ADAPTER pAd, call this routine every second ========================================================================== */ -VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) +void MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) { - UCHAR UpRateIdx = 0, DownRateIdx = 0, CurrRateIdx; - ULONG i, AccuTxTotalCnt = 0, TxTotalCnt; - ULONG TxErrorRatio = 0; + u8 UpRateIdx = 0, DownRateIdx = 0, CurrRateIdx; + unsigned long i, AccuTxTotalCnt = 0, TxTotalCnt; + unsigned long TxErrorRatio = 0; BOOLEAN bTxRateChanged = FALSE, bUpgradeQuality = FALSE; PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate = NULL; - PUCHAR pTable; - UCHAR TableSize = 0; - UCHAR InitTxRateIdx = 0, TrainUp, TrainDown; - CHAR Rssi, RssiOffset = 0; + u8 *pTable; + u8 TableSize = 0; + u8 InitTxRateIdx = 0, TrainUp, TrainDown; + char Rssi, RssiOffset = 0; TX_STA_CNT1_STRUC StaTx1; TX_STA_CNT0_STRUC TxStaCnt0; - ULONG TxRetransmit = 0, TxSuccess = 0, TxFailCount = 0; + unsigned long TxRetransmit = 0, TxSuccess = 0, TxFailCount = 0; MAC_TABLE_ENTRY *pEntry; RSSI_SAMPLE *pRssi = &pAd->StaCfg.RssiSample; @@ -1936,8 +1936,8 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) */ if (TxErrorRatio == 100) { TX_RTY_CFG_STRUC TxRtyCfg, TxRtyCfgtmp; - ULONG Index; - ULONG MACValue; + unsigned long Index; + unsigned long MACValue; RTMP_IO_READ32(pAd, TX_RTY_CFG, &TxRtyCfg.word); TxRtyCfgtmp.word = TxRtyCfg.word; @@ -2039,12 +2039,12 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) /* (criteria copied from RT2500 for Netopia case) */ /* */ if (TxTotalCnt <= 15) { - CHAR idx = 0; - UCHAR TxRateIdx; - UCHAR MCS0 = 0, MCS1 = 0, MCS2 = 0, MCS3 = 0, MCS4 = + char idx = 0; + u8 TxRateIdx; + u8 MCS0 = 0, MCS1 = 0, MCS2 = 0, MCS3 = 0, MCS4 = 0, MCS5 = 0, MCS6 = 0, MCS7 = 0; - UCHAR MCS12 = 0, MCS13 = 0, MCS14 = 0, MCS15 = 0; - UCHAR MCS20 = 0, MCS21 = 0, MCS22 = 0, MCS23 = 0; /* 3*3 */ + u8 MCS12 = 0, MCS13 = 0, MCS14 = 0, MCS15 = 0; + u8 MCS20 = 0, MCS21 = 0, MCS22 = 0, MCS23 = 0; /* 3*3 */ /* check the existence and index of each needed MCS */ while (idx < pTable[0]) { @@ -2198,10 +2198,10 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) } NdisZeroMemory(pEntry->TxQuality, - sizeof(USHORT) * + sizeof(u16)* MAX_STEP_OF_TX_RATE_SWITCH); NdisZeroMemory(pEntry->PER, - sizeof(UCHAR) * + sizeof(u8)* MAX_STEP_OF_TX_RATE_SWITCH); pEntry->fLastSecAccordingRSSI = TRUE; /* reset all OneSecTx counters */ @@ -2243,7 +2243,7 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) pEntry->TxQuality[UpRateIdx]--; /* may improve next UP rate's quality */ } - pEntry->PER[CurrRateIdx] = (UCHAR) TxErrorRatio; + pEntry->PER[CurrRateIdx] = (u8)TxErrorRatio; if (bTrainUpDown) { /* perform DRS - consider TxRate Down first, then rate up. */ @@ -2265,10 +2265,10 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) pEntry->TxRateUpPenalty = 0; pEntry->LastSecTxRateChangeAction = 1; /* rate UP */ NdisZeroMemory(pEntry->TxQuality, - sizeof(USHORT) * + sizeof(u16)* MAX_STEP_OF_TX_RATE_SWITCH); NdisZeroMemory(pEntry->PER, - sizeof(UCHAR) * + sizeof(u8)* MAX_STEP_OF_TX_RATE_SWITCH); /* */ @@ -2311,7 +2311,7 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) pEntry->LastTxOkCount = TxSuccess; { - UCHAR tmpTxRate; + u8 tmpTxRate; /* to fix tcp ack issue */ if (!bTxRateChanged @@ -2359,26 +2359,26 @@ VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID StaQuickResponeForRateUpExec(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +void StaQuickResponeForRateUpExec(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, + void *SystemSpecific3) { PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) FunctionContext; - UCHAR UpRateIdx = 0, DownRateIdx = 0, CurrRateIdx = 0; - ULONG TxTotalCnt; - ULONG TxErrorRatio = 0; + u8 UpRateIdx = 0, DownRateIdx = 0, CurrRateIdx = 0; + unsigned long TxTotalCnt; + unsigned long TxErrorRatio = 0; BOOLEAN bTxRateChanged; /*, bUpgradeQuality = FALSE; */ PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate = NULL; - PUCHAR pTable; - UCHAR TableSize = 0; - UCHAR InitTxRateIdx = 0, TrainUp, TrainDown; + u8 *pTable; + u8 TableSize = 0; + u8 InitTxRateIdx = 0, TrainUp, TrainDown; TX_STA_CNT1_STRUC StaTx1; TX_STA_CNT0_STRUC TxStaCnt0; - CHAR Rssi, ratio; - ULONG TxRetransmit = 0, TxSuccess = 0, TxFailCount = 0; + char Rssi, ratio; + unsigned long TxRetransmit = 0, TxSuccess = 0, TxFailCount = 0; MAC_TABLE_ENTRY *pEntry; - ULONG i; + unsigned long i; pAd->StaCfg.StaQuickResponeForRateUpTimerRunning = FALSE; @@ -2480,10 +2480,10 @@ VOID StaQuickResponeForRateUpExec(IN PVOID SystemSpecific1, /* */ if (TxTotalCnt <= 12) { NdisZeroMemory(pAd->DrsCounters.TxQuality, - sizeof(USHORT) * + sizeof(u16)* MAX_STEP_OF_TX_RATE_SWITCH); NdisZeroMemory(pAd->DrsCounters.PER, - sizeof(UCHAR) * + sizeof(u8)* MAX_STEP_OF_TX_RATE_SWITCH); if ((pAd->DrsCounters.LastSecTxRateChangeAction == 1) @@ -2503,7 +2503,7 @@ VOID StaQuickResponeForRateUpExec(IN PVOID SystemSpecific1, } do { - ULONG OneSecTxNoRetryOKRationCount; + unsigned long OneSecTxNoRetryOKRationCount; if (pAd->DrsCounters.LastTimeTxRateChangeAction == 0) ratio = 5; @@ -2517,7 +2517,7 @@ VOID StaQuickResponeForRateUpExec(IN PVOID SystemSpecific1, } pAd->DrsCounters.PER[CurrRateIdx] = - (UCHAR) TxErrorRatio; + (u8)TxErrorRatio; OneSecTxNoRetryOKRationCount = (TxSuccess * ratio); @@ -2551,10 +2551,10 @@ VOID StaQuickResponeForRateUpExec(IN PVOID SystemSpecific1, if (pAd->CommonCfg.TxRateIndex > CurrRateIdx) { pAd->DrsCounters.TxRateUpPenalty = 0; NdisZeroMemory(pAd->DrsCounters.TxQuality, - sizeof(USHORT) * + sizeof(u16)* MAX_STEP_OF_TX_RATE_SWITCH); NdisZeroMemory(pAd->DrsCounters.PER, - sizeof(UCHAR) * + sizeof(u8)* MAX_STEP_OF_TX_RATE_SWITCH); bTxRateChanged = TRUE; } @@ -2601,9 +2601,9 @@ VOID StaQuickResponeForRateUpExec(IN PVOID SystemSpecific1, ========================================================================== */ -VOID MlmeCheckPsmChange(IN PRTMP_ADAPTER pAd, IN ULONG Now32) +void MlmeCheckPsmChange(IN PRTMP_ADAPTER pAd, unsigned long Now32) { - ULONG PowerMode; + unsigned long PowerMode; /* condition - */ /* 1. Psm maybe ON only happen in INFRASTRUCTURE mode */ @@ -2638,7 +2638,7 @@ VOID MlmeCheckPsmChange(IN PRTMP_ADAPTER pAd, IN ULONG Now32) /* IRQL = PASSIVE_LEVEL */ /* IRQL = DISPATCH_LEVEL */ -VOID MlmeSetPsmBit(IN PRTMP_ADAPTER pAd, IN USHORT psm) +void MlmeSetPsmBit(IN PRTMP_ADAPTER pAd, u16 psm) { AUTO_RSP_CFG_STRUC csr4; @@ -2669,21 +2669,21 @@ VOID MlmeSetPsmBit(IN PRTMP_ADAPTER pAd, IN USHORT psm) channel quality based on the most up-to-date information ========================================================================== */ -VOID MlmeCalculateChannelQuality(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pMacEntry, IN ULONG Now32) +void MlmeCalculateChannelQuality(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pMacEntry, unsigned long Now32) { - ULONG TxOkCnt, TxCnt, TxPER, TxPRR; - ULONG RxCnt, RxPER; - UCHAR NorRssi; - CHAR MaxRssi; + unsigned long TxOkCnt, TxCnt, TxPER, TxPRR; + unsigned long RxCnt, RxPER; + u8 NorRssi; + char MaxRssi; RSSI_SAMPLE *pRssiSample = NULL; - UINT32 OneSecTxNoRetryOkCount = 0; - UINT32 OneSecTxRetryOkCount = 0; - UINT32 OneSecTxFailCount = 0; - UINT32 OneSecRxOkCnt = 0; - UINT32 OneSecRxFcsErrCnt = 0; - ULONG ChannelQuality = 0; /* 0..100, Channel Quality Indication for Roaming */ - ULONG BeaconLostTime = pAd->StaCfg.BeaconLostTime; + u32 OneSecTxNoRetryOkCount = 0; + u32 OneSecTxRetryOkCount = 0; + u32 OneSecTxFailCount = 0; + u32 OneSecRxOkCnt = 0; + u32 OneSecRxFcsErrCnt = 0; + unsigned long ChannelQuality = 0; /* 0..100, Channel Quality Indication for Roaming */ + unsigned long BeaconLostTime = pAd->StaCfg.BeaconLostTime; if (pAd->OpMode == OPMODE_STA) { pRssiSample = &pAd->StaCfg.RssiSample; @@ -2751,7 +2751,7 @@ VOID MlmeCalculateChannelQuality(IN PRTMP_ADAPTER pAd, } /* IRQL = DISPATCH_LEVEL */ -VOID MlmeSetTxPreamble(IN PRTMP_ADAPTER pAd, IN USHORT TxPreamble) +void MlmeSetTxPreamble(IN PRTMP_ADAPTER pAd, u16 TxPreamble) { AUTO_RSP_CFG_STRUC csr4; @@ -2764,13 +2764,13 @@ VOID MlmeSetTxPreamble(IN PRTMP_ADAPTER pAd, IN USHORT TxPreamble) RTMP_IO_READ32(pAd, AUTO_RSP_CFG, &csr4.word); if (TxPreamble == Rt802_11PreambleLong) { DBGPRINT(RT_DEBUG_TRACE, - ("MlmeSetTxPreamble (= LONG PREAMBLE)\n")); + ("MlmeSetTxPreamble (= long PREAMBLE)\n")); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); csr4.field.AutoResponderPreamble = 0; } else { /* NOTE: 1Mbps should always use long preamble */ DBGPRINT(RT_DEBUG_TRACE, - ("MlmeSetTxPreamble (= SHORT PREAMBLE)\n")); + ("MlmeSetTxPreamble (= short PREAMBLE)\n")); OPSTATUS_SET_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); csr4.field.AutoResponderPreamble = 1; } @@ -2785,14 +2785,14 @@ VOID MlmeSetTxPreamble(IN PRTMP_ADAPTER pAd, IN USHORT TxPreamble) ========================================================================== */ -VOID UpdateBasicRateBitmap(IN PRTMP_ADAPTER pAdapter) +void UpdateBasicRateBitmap(IN PRTMP_ADAPTER pAdapter) { - INT i, j; + int i, j; /* 1 2 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 */ - UCHAR rate[] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 }; - UCHAR *sup_p = pAdapter->CommonCfg.SupRate; - UCHAR *ext_p = pAdapter->CommonCfg.ExtRate; - ULONG bitmap = pAdapter->CommonCfg.BasicRateBitmap; + u8 rate[] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 }; + u8 *sup_p = pAdapter->CommonCfg.SupRate; + u8 *ext_p = pAdapter->CommonCfg.ExtRate; + unsigned long bitmap = pAdapter->CommonCfg.BasicRateBitmap; /* if A mode, always use fix BasicRateBitMap */ /*if (pAdapter->CommonCfg.Channel == PHY_11A) */ @@ -2831,19 +2831,19 @@ VOID UpdateBasicRateBitmap(IN PRTMP_ADAPTER pAdapter) /* IRQL = DISPATCH_LEVEL */ /* bLinkUp is to identify the inital link speed. */ /* TRUE indicates the rate update at linkup, we should not try to set the rate at 54Mbps. */ -VOID MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, IN UCHAR apidx) +void MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, u8 apidx) { int i, num; - UCHAR Rate = RATE_6, MaxDesire = RATE_1, MaxSupport = RATE_1; - UCHAR MinSupport = RATE_54; - ULONG BasicRateBitmap = 0; - UCHAR CurrBasicRate = RATE_1; - UCHAR *pSupRate, SupRateLen, *pExtRate, ExtRateLen; + u8 Rate = RATE_6, MaxDesire = RATE_1, MaxSupport = RATE_1; + u8 MinSupport = RATE_54; + unsigned long BasicRateBitmap = 0; + u8 CurrBasicRate = RATE_1; + u8 *pSupRate, SupRateLen, *pExtRate, ExtRateLen; PHTTRANSMIT_SETTING pHtPhy = NULL; PHTTRANSMIT_SETTING pMaxHtPhy = NULL; PHTTRANSMIT_SETTING pMinHtPhy = NULL; BOOLEAN *auto_rate_cur_p; - UCHAR HtMcs = MCS_AUTO; + u8 HtMcs = MCS_AUTO; /* find max desired rate */ UpdateBasicRateBitmap(pAd); @@ -3112,7 +3112,7 @@ VOID MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, IN UCHAR apidx) /* the DURATION field of outgoing uniicast DATA/MGMT frame */ for (i = 0; i < MAX_LEN_OF_SUPPORTED_RATES; i++) { if (BasicRateBitmap & (0x01 << i)) - CurrBasicRate = (UCHAR) i; + CurrBasicRate = (u8)i; pAd->CommonCfg.ExpectedACKRate[i] = CurrBasicRate; } @@ -3292,14 +3292,14 @@ VOID MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, IN UCHAR apidx) ========================================================================== */ -VOID MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) +void MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, u8 apidx) { - UCHAR StbcMcs; /*j, StbcMcs, bitmask; */ - CHAR i; /* 3*3 */ + u8 StbcMcs; /*j, StbcMcs, bitmask; */ + char i; /* 3*3 */ RT_HT_CAPABILITY *pRtHtCap = NULL; RT_HT_PHY_INFO *pActiveHtPhy = NULL; - ULONG BasicMCS; - UCHAR j, bitmask; + unsigned long BasicMCS; + u8 j, bitmask; PRT_HT_PHY_INFO pDesireHtPhy = NULL; PHTTRANSMIT_SETTING pHtPhy = NULL; PHTTRANSMIT_SETTING pMaxHtPhy = NULL; @@ -3326,7 +3326,7 @@ VOID MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) pRtHtCap = &pAd->StaActive.SupportedHtPhy; pActiveHtPhy = &pAd->StaActive.SupportedPhyInfo; - StbcMcs = (UCHAR) pAd->MlmeAux.AddHtInfo.AddHtInfo3.StbcMcs; + StbcMcs = (u8)pAd->MlmeAux.AddHtInfo.AddHtInfo3.StbcMcs; BasicMCS = pAd->MlmeAux.AddHtInfo.MCSSet[0] + (pAd->MlmeAux.AddHtInfo.MCSSet[1] << 8) + (StbcMcs << 16); @@ -3340,7 +3340,7 @@ VOID MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) return; pRtHtCap = &pAd->CommonCfg.DesiredHtPhy; - StbcMcs = (UCHAR) pAd->CommonCfg.AddHTInfo.AddHtInfo3.StbcMcs; + StbcMcs = (u8)pAd->CommonCfg.AddHTInfo.AddHtInfo3.StbcMcs; BasicMCS = pAd->CommonCfg.AddHTInfo.MCSSet[0] + (pAd->CommonCfg.AddHTInfo.MCSSet[1] << 8) + (StbcMcs << 16); @@ -3406,7 +3406,7 @@ VOID MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) pMinHtPhy->field.MCS)); } - for (i = 23; (CHAR) i >= 0; i--) /* 3*3 */ + for (i = 23; (char)i >= 0; i--) /* 3*3 */ { j = i / 8; bitmask = (1 << (i - (j * 8))); @@ -3444,7 +3444,7 @@ VOID MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, IN UCHAR apidx) DBGPRINT(RT_DEBUG_TRACE, ("MlmeUpdateHtTxRates<=== \n")); } -VOID BATableInit(IN PRTMP_ADAPTER pAd, IN BA_TABLE * Tab) +void BATableInit(IN PRTMP_ADAPTER pAd, IN BA_TABLE * Tab) { int i; @@ -3462,13 +3462,13 @@ VOID BATableInit(IN PRTMP_ADAPTER pAd, IN BA_TABLE * Tab) } /* IRQL = DISPATCH_LEVEL */ -VOID MlmeRadioOff(IN PRTMP_ADAPTER pAd) +void MlmeRadioOff(IN PRTMP_ADAPTER pAd) { RTMP_MLME_RADIO_OFF(pAd); } /* IRQL = DISPATCH_LEVEL */ -VOID MlmeRadioOn(IN PRTMP_ADAPTER pAd) +void MlmeRadioOn(IN PRTMP_ADAPTER pAd) { RTMP_MLME_RADIO_ON(pAd); } @@ -3487,7 +3487,7 @@ VOID MlmeRadioOn(IN PRTMP_ADAPTER pAd) IRQL = DISPATCH_LEVEL */ -VOID BssTableInit(IN BSS_TABLE * Tab) +void BssTableInit(IN BSS_TABLE * Tab) { int i; @@ -3510,9 +3510,9 @@ VOID BssTableInit(IN BSS_TABLE * Tab) IRQL = DISPATCH_LEVEL */ -ULONG BssTableSearch(IN BSS_TABLE * Tab, IN PUCHAR pBssid, IN UCHAR Channel) +unsigned long BssTableSearch(IN BSS_TABLE * Tab, u8 *pBssid, u8 Channel) { - UCHAR i; + u8 i; for (i = 0; i < Tab->BssNr; i++) { /* */ @@ -3525,14 +3525,14 @@ ULONG BssTableSearch(IN BSS_TABLE * Tab, IN PUCHAR pBssid, IN UCHAR Channel) return i; } } - return (ULONG) BSS_NOT_FOUND; + return (unsigned long)BSS_NOT_FOUND; } -ULONG BssSsidTableSearch(IN BSS_TABLE * Tab, - IN PUCHAR pBssid, - IN PUCHAR pSsid, IN UCHAR SsidLen, IN UCHAR Channel) +unsigned long BssSsidTableSearch(IN BSS_TABLE * Tab, + u8 *pBssid, + u8 *pSsid, u8 SsidLen, u8 Channel) { - UCHAR i; + u8 i; for (i = 0; i < Tab->BssNr; i++) { /* */ @@ -3547,15 +3547,15 @@ ULONG BssSsidTableSearch(IN BSS_TABLE * Tab, return i; } } - return (ULONG) BSS_NOT_FOUND; + return (unsigned long)BSS_NOT_FOUND; } -ULONG BssTableSearchWithSSID(IN BSS_TABLE * Tab, - IN PUCHAR Bssid, - IN PUCHAR pSsid, - IN UCHAR SsidLen, IN UCHAR Channel) +unsigned long BssTableSearchWithSSID(IN BSS_TABLE * Tab, + u8 *Bssid, + u8 *pSsid, + u8 SsidLen, u8 Channel) { - UCHAR i; + u8 i; for (i = 0; i < Tab->BssNr; i++) { if ((((Tab->BssEntry[i].Channel <= 14) && (Channel <= 14)) || @@ -3572,13 +3572,13 @@ ULONG BssTableSearchWithSSID(IN BSS_TABLE * Tab, return i; } } - return (ULONG) BSS_NOT_FOUND; + return (unsigned long)BSS_NOT_FOUND; } -ULONG BssSsidTableSearchBySSID(IN BSS_TABLE * Tab, - IN PUCHAR pSsid, IN UCHAR SsidLen) +unsigned long BssSsidTableSearchBySSID(IN BSS_TABLE * Tab, + u8 *pSsid, u8 SsidLen) { - UCHAR i; + u8 i; for (i = 0; i < Tab->BssNr; i++) { if (SSID_EQUAL @@ -3587,14 +3587,14 @@ ULONG BssSsidTableSearchBySSID(IN BSS_TABLE * Tab, return i; } } - return (ULONG) BSS_NOT_FOUND; + return (unsigned long)BSS_NOT_FOUND; } /* IRQL = DISPATCH_LEVEL */ -VOID BssTableDeleteEntry(IN OUT BSS_TABLE * Tab, - IN PUCHAR pBssid, IN UCHAR Channel) +void BssTableDeleteEntry(IN OUT BSS_TABLE * Tab, + u8 *pBssid, u8 Channel) { - UCHAR i, j; + u8 i, j; for (i = 0; i < Tab->BssNr; i++) { if ((Tab->BssEntry[i].Channel == Channel) && @@ -3621,7 +3621,7 @@ VOID BssTableDeleteEntry(IN OUT BSS_TABLE * Tab, // IRQL = DISPATCH_LEVEL ======================================================================== */ -VOID BATableDeleteORIEntry(IN OUT PRTMP_ADAPTER pAd, +void BATableDeleteORIEntry(IN OUT PRTMP_ADAPTER pAd, IN BA_ORI_ENTRY * pBAORIEntry) { @@ -3652,18 +3652,18 @@ VOID BATableDeleteORIEntry(IN OUT PRTMP_ADAPTER pAd, IRQL = DISPATCH_LEVEL */ -VOID BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, IN PUCHAR pBssid, IN CHAR Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN USHORT BeaconPeriod, IN PCF_PARM pCfParm, IN USHORT AtimWin, IN USHORT CapabilityInfo, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ - IN UCHAR HtCapabilityLen, - IN UCHAR AddHtInfoLen, - IN UCHAR NewExtChanOffset, - IN UCHAR Channel, - IN CHAR Rssi, +void BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, u8 *pBssid, char Ssid[], u8 SsidLen, u8 BssType, u16 BeaconPeriod, IN PCF_PARM pCfParm, u16 AtimWin, u16 CapabilityInfo, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ + u8 HtCapabilityLen, + u8 AddHtInfoLen, + u8 NewExtChanOffset, + u8 Channel, + char Rssi, IN LARGE_INTEGER TimeStamp, - IN UCHAR CkipFlag, + u8 CkipFlag, IN PEDCA_PARM pEdcaParm, IN PQOS_CAPABILITY_PARM pQosCapability, IN PQBSS_LOAD_PARM pQbssLoad, - IN USHORT LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE) + u16 LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE) { COPY_MAC_ADDR(pBss->Bssid, pBssid); /* Default Hidden SSID to be TRUE, it will be turned to FALSE after coping SSID */ @@ -3777,12 +3777,12 @@ VOID BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, IN PUCHAR pBssid, I { PEID_STRUCT pEid; - USHORT Length = 0; + u16 Length = 0; NdisZeroMemory(&pBss->WpaIE.IE[0], MAX_CUSTOM_LEN); NdisZeroMemory(&pBss->RsnIE.IE[0], MAX_CUSTOM_LEN); pEid = (PEID_STRUCT) pVIE; - while ((Length + 2 + (USHORT) pEid->Len) <= LengthVIE) { + while ((Length + 2 + (u16)pEid->Len) <= LengthVIE) { switch (pEid->Eid) { case IE_WPA: if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4)) { @@ -3808,8 +3808,8 @@ VOID BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, IN PUCHAR pBssid, I } break; } - Length = Length + 2 + (USHORT) pEid->Len; /* Eid[1] + Len[1]+ content[Len] */ - pEid = (PEID_STRUCT) ((UCHAR *) pEid + 2 + pEid->Len); + Length = Length + 2 + (u16)pEid->Len; /* Eid[1] + Len[1]+ content[Len] */ + pEid = (PEID_STRUCT) ((u8 *) pEid + 2 + pEid->Len); } } } @@ -3837,23 +3837,23 @@ VOID BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, IN PUCHAR pBssid, I IRQL = DISPATCH_LEVEL */ -ULONG BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT BSS_TABLE * Tab, IN PUCHAR pBssid, IN CHAR Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN USHORT BeaconPeriod, IN CF_PARM * CfParm, IN USHORT AtimWin, IN USHORT CapabilityInfo, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ - IN UCHAR HtCapabilityLen, - IN UCHAR AddHtInfoLen, - IN UCHAR NewExtChanOffset, - IN UCHAR ChannelNo, - IN CHAR Rssi, +unsigned long BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT BSS_TABLE * Tab, u8 *pBssid, char Ssid[], u8 SsidLen, u8 BssType, u16 BeaconPeriod, IN CF_PARM * CfParm, u16 AtimWin, u16 CapabilityInfo, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ + u8 HtCapabilityLen, + u8 AddHtInfoLen, + u8 NewExtChanOffset, + u8 ChannelNo, + char Rssi, IN LARGE_INTEGER TimeStamp, - IN UCHAR CkipFlag, + u8 CkipFlag, IN PEDCA_PARM pEdcaParm, IN PQOS_CAPABILITY_PARM pQosCapability, IN PQBSS_LOAD_PARM pQbssLoad, - IN USHORT LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE) + u16 LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE) { - ULONG Idx; + unsigned long Idx; Idx = - BssTableSearchWithSSID(Tab, pBssid, (UCHAR *) Ssid, SsidLen, + BssTableSearchWithSSID(Tab, pBssid, (u8 *) Ssid, SsidLen, ChannelNo); if (Idx == BSS_NOT_FOUND) { if (Tab->BssNr >= MAX_LEN_OF_BSS_TABLE) { @@ -3924,10 +3924,10 @@ ULONG BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT BSS_TABLE * Tab, IN PUCHAR pBss } /* IRQL = DISPATCH_LEVEL */ -VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, - OUT BSS_TABLE * OutTab, IN CHAR Ssid[], IN UCHAR SsidLen) +void BssTableSsidSort(IN PRTMP_ADAPTER pAd, + OUT BSS_TABLE * OutTab, char Ssid[], u8 SsidLen) { - INT i; + int i; BssTableInit(OutTab); for (i = 0; i < pAd->ScanTab.BssNr; i++) { @@ -4180,9 +4180,9 @@ VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, } /* IRQL = DISPATCH_LEVEL */ -VOID BssTableSortByRssi(IN OUT BSS_TABLE * OutTab) +void BssTableSortByRssi(IN OUT BSS_TABLE * OutTab) { - INT i, j; + int i, j; BSS_ENTRY TmpBss; for (i = 0; i < OutTab->BssNr - 1; i++) { @@ -4200,15 +4200,15 @@ VOID BssTableSortByRssi(IN OUT BSS_TABLE * OutTab) } } -VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) +void BssCipherParse(IN OUT PBSS_ENTRY pBss) { PEID_STRUCT pEid; - PUCHAR pTmp; + u8 *pTmp; PRSN_IE_HEADER_STRUCT pRsnHeader; PCIPHER_SUITE_STRUCT pCipher; PAKM_SUITE_STRUCT pAKM; - USHORT Count; - INT Length; + u16 Count; + int Length; NDIS_802_11_ENCRYPTION_STATUS TmpCipher; /* */ @@ -4237,11 +4237,11 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) pBss->WPA2.RsnCapability = 0; pBss->WPA2.bMixMode = FALSE; - Length = (INT) pBss->VarIELen; + Length = (int)pBss->VarIELen; while (Length > 0) { /* Parse cipher suite base on WPA1 & WPA2, they should be parsed differently */ - pTmp = ((PUCHAR) pBss->VarIEs) + pBss->VarIELen - Length; + pTmp = ((u8 *)pBss->VarIEs) + pBss->VarIELen - Length; pEid = (PEID_STRUCT) pTmp; switch (pEid->Eid) { case IE_WPA: @@ -4257,7 +4257,7 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) /* Skip OUI, version, and multicast suite */ /* This part should be improved in the future when AP supported multiple cipher suite. */ /* For now, it's OK since almost all APs have fixed cipher suite supported. */ - /* pTmp = (PUCHAR) pEid->Octet; */ + /* pTmp = (u8 *)pEid->Octet; */ pTmp += 11; /* Cipher Suite Selectors from Spec P802.11i/D3.2 P26. */ @@ -4293,9 +4293,9 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) pTmp += 1; /* skip all unicast cipher suites */ - /*Count = *(PUSHORT) pTmp; */ + /*Count = *(u16 *)pTmp; */ Count = (pTmp[1] << 8) + pTmp[0]; - pTmp += sizeof(USHORT); + pTmp += sizeof(u16); /* Parsing all unicast cipher suite */ while (Count > 0) { @@ -4332,9 +4332,9 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) } /* 4. get AKM suite counts */ - /*Count = *(PUSHORT) pTmp; */ + /*Count = *(u16 *)pTmp; */ Count = (pTmp[1] << 8) + pTmp[0]; - pTmp += sizeof(USHORT); + pTmp += sizeof(u16); pTmp += 3; switch (*pTmp) { @@ -4417,9 +4417,9 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) pTmp += sizeof(CIPHER_SUITE_STRUCT); /* 2. Get pairwise cipher counts */ - /*Count = *(PUSHORT) pTmp; */ + /*Count = *(u16 *)pTmp; */ Count = (pTmp[1] << 8) + pTmp[0]; - pTmp += sizeof(USHORT); + pTmp += sizeof(u16); /* 3. Get pairwise cipher */ /* Parsing all unicast cipher suite */ @@ -4457,9 +4457,9 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) } /* 4. get AKM suite counts */ - /*Count = *(PUSHORT) pTmp; */ + /*Count = *(u16 *)pTmp; */ Count = (pTmp[1] << 8) + pTmp[0]; - pTmp += sizeof(USHORT); + pTmp += sizeof(u16); /* 5. Get AKM ciphers */ /* Parsing all AKM ciphers */ @@ -4520,9 +4520,9 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) pBss->WepStatus = pBss->WPA2.PairCipher; /* 6. Get RSN capability */ - /*pBss->WPA2.RsnCapability = *(PUSHORT) pTmp; */ + /*pBss->WPA2.RsnCapability = *(u16 *)pTmp; */ pBss->WPA2.RsnCapability = (pTmp[1] << 8) + pTmp[0]; - pTmp += sizeof(USHORT); + pTmp += sizeof(u16); /* Check the Pair & Group, if different, turn on mixed mode flag */ if (pBss->WPA2.GroupCipher != pBss->WPA2.PairCipher) @@ -4546,9 +4546,9 @@ VOID BssCipherParse(IN OUT PBSS_ENTRY pBss) * \pre * \post */ -VOID MacAddrRandomBssid(IN PRTMP_ADAPTER pAd, OUT PUCHAR pAddr) +void MacAddrRandomBssid(IN PRTMP_ADAPTER pAd, u8 *pAddr) { - INT i; + int i; for (i = 0; i < MAC_ADDR_LEN; i++) { pAddr[i] = RandomByte(pAd); @@ -4572,10 +4572,10 @@ VOID MacAddrRandomBssid(IN PRTMP_ADAPTER pAd, OUT PUCHAR pAddr) IRQL = DISPATCH_LEVEL */ -VOID MgtMacHeaderInit(IN PRTMP_ADAPTER pAd, +void MgtMacHeaderInit(IN PRTMP_ADAPTER pAd, IN OUT PHEADER_802_11 pHdr80211, - IN UCHAR SubType, - IN UCHAR ToDs, IN PUCHAR pDA, IN PUCHAR pBssid) + u8 SubType, + u8 ToDs, u8 *pDA, u8 *pBssid) { NdisZeroMemory(pHdr80211, sizeof(HEADER_802_11)); @@ -4611,11 +4611,11 @@ VOID MgtMacHeaderInit(IN PRTMP_ADAPTER pAd, IRQL = DISPATCH_LEVEL ****************************************************************************/ -ULONG MakeOutgoingFrame(OUT UCHAR * Buffer, OUT ULONG * FrameLen, ...) +unsigned long MakeOutgoingFrame(u8 * Buffer, unsigned long * FrameLen, ...) { - UCHAR *p; + u8 *p; int leng; - ULONG TotLeng; + unsigned long TotLeng; va_list Args; /* calculates the total length */ @@ -4626,7 +4626,7 @@ ULONG MakeOutgoingFrame(OUT UCHAR * Buffer, OUT ULONG * FrameLen, ...) if (leng == END_OF_ARGS) { break; } - p = va_arg(Args, PVOID); + p = va_arg(Args, void *); NdisMoveMemory(&Buffer[TotLeng], p, leng); TotLeng = TotLeng + leng; } while (TRUE); @@ -4650,9 +4650,9 @@ ULONG MakeOutgoingFrame(OUT UCHAR * Buffer, OUT ULONG * FrameLen, ...) IRQL = PASSIVE_LEVEL */ -NDIS_STATUS MlmeQueueInit(IN MLME_QUEUE * Queue) +int MlmeQueueInit(IN MLME_QUEUE * Queue) { - INT i; + int i; NdisAllocateSpinLock(&Queue->Lock); @@ -4685,10 +4685,10 @@ NDIS_STATUS MlmeQueueInit(IN MLME_QUEUE * Queue) */ BOOLEAN MlmeEnqueue(IN PRTMP_ADAPTER pAd, - IN ULONG Machine, - IN ULONG MsgType, IN ULONG MsgLen, IN VOID * Msg) + unsigned long Machine, + unsigned long MsgType, unsigned long MsgLen, void * Msg) { - INT Tail; + int Tail; MLME_QUEUE *Queue = (MLME_QUEUE *) & pAd->Mlme.Queue; /* Do nothing if the driver is starting halt state. */ @@ -4745,17 +4745,17 @@ BOOLEAN MlmeEnqueue(IN PRTMP_ADAPTER pAd, */ BOOLEAN MlmeEnqueueForRecv(IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN ULONG TimeStampHigh, - IN ULONG TimeStampLow, - IN UCHAR Rssi0, - IN UCHAR Rssi1, - IN UCHAR Rssi2, - IN ULONG MsgLen, IN VOID * Msg, IN UCHAR Signal) + unsigned long Wcid, + unsigned long TimeStampHigh, + unsigned long TimeStampLow, + u8 Rssi0, + u8 Rssi1, + u8 Rssi2, + unsigned long MsgLen, void * Msg, u8 Signal) { - INT Tail, Machine; + int Tail, Machine; PFRAME_802_11 pFrame = (PFRAME_802_11) Msg; - INT MsgType; + int MsgType; MLME_QUEUE *Queue = (MLME_QUEUE *) & pAd->Mlme.Queue; /* Do nothing if the driver is starting halt state. */ @@ -4801,7 +4801,7 @@ BOOLEAN MlmeEnqueueForRecv(IN PRTMP_ADAPTER pAd, Queue->Entry[Tail].Rssi1 = Rssi1; Queue->Entry[Tail].Rssi2 = Rssi2; Queue->Entry[Tail].Signal = Signal; - Queue->Entry[Tail].Wcid = (UCHAR) Wcid; + Queue->Entry[Tail].Wcid = (u8)Wcid; Queue->Entry[Tail].Channel = pAd->LatchRfRegs.Channel; @@ -4840,7 +4840,7 @@ BOOLEAN MlmeDequeue(IN MLME_QUEUE * Queue, OUT MLME_QUEUE_ELEM ** Elem) } /* IRQL = DISPATCH_LEVEL */ -VOID MlmeRestartStateMachine(IN PRTMP_ADAPTER pAd) +void MlmeRestartStateMachine(IN PRTMP_ADAPTER pAd) { #ifdef RTMP_MAC_PCI MLME_QUEUE_ELEM *Elem = NULL; @@ -4962,7 +4962,7 @@ BOOLEAN MlmeQueueFull(IN MLME_QUEUE * Queue) IRQL = PASSIVE_LEVEL */ -VOID MlmeQueueDestroy(IN MLME_QUEUE * pQueue) +void MlmeQueueDestroy(IN MLME_QUEUE * pQueue) { NdisAcquireSpinLock(&(pQueue->Lock)); pQueue->Num = 0; @@ -4985,23 +4985,23 @@ VOID MlmeQueueDestroy(IN MLME_QUEUE * pQueue) */ BOOLEAN MsgTypeSubst(IN PRTMP_ADAPTER pAd, IN PFRAME_802_11 pFrame, - OUT INT * Machine, OUT INT * MsgType) + int * Machine, int * MsgType) { - USHORT Seq, Alg; - UCHAR EAPType; - PUCHAR pData; + u16 Seq, Alg; + u8 EAPType; + u8 *pData; /* Pointer to start of data frames including SNAP header */ - pData = (PUCHAR) pFrame + LENGTH_802_11; + pData = (u8 *)pFrame + LENGTH_802_11; /* The only data type will pass to this function is EAPOL frame */ if (pFrame->Hdr.FC.Type == BTYPE_DATA) { { *Machine = WPA_STATE_MACHINE; EAPType = - *((UCHAR *) pFrame + LENGTH_802_11 + + *((u8 *) pFrame + LENGTH_802_11 + LENGTH_802_1_H + 1); - return (WpaMsgTypeSubst(EAPType, (INT *) MsgType)); + return (WpaMsgTypeSubst(EAPType, (int *) MsgType)); } } @@ -5044,8 +5044,8 @@ BOOLEAN MsgTypeSubst(IN PRTMP_ADAPTER pAd, break; case SUBTYPE_AUTH: /* get the sequence number from payload 24 Mac Header + 2 bytes algorithm */ - NdisMoveMemory(&Seq, &pFrame->Octet[2], sizeof(USHORT)); - NdisMoveMemory(&Alg, &pFrame->Octet[0], sizeof(USHORT)); + NdisMoveMemory(&Seq, &pFrame->Octet[2], sizeof(u16)); + NdisMoveMemory(&Alg, &pFrame->Octet[0], sizeof(u16)); if (Seq == 1 || Seq == 3) { *Machine = AUTH_RSP_STATE_MACHINE; *MsgType = MT2_PEER_AUTH_ODD; @@ -5097,14 +5097,14 @@ BOOLEAN MsgTypeSubst(IN PRTMP_ADAPTER pAd, IRQL = PASSIVE_LEVEL */ -VOID StateMachineInit(IN STATE_MACHINE * S, +void StateMachineInit(IN STATE_MACHINE * S, IN STATE_MACHINE_FUNC Trans[], - IN ULONG StNr, - IN ULONG MsgNr, + unsigned long StNr, + unsigned long MsgNr, IN STATE_MACHINE_FUNC DefFunc, - IN ULONG InitState, IN ULONG Base) + unsigned long InitState, unsigned long Base) { - ULONG i, j; + unsigned long i, j; /* set number of states and messages */ S->NrState = StNr; @@ -5135,11 +5135,11 @@ VOID StateMachineInit(IN STATE_MACHINE * S, IRQL = PASSIVE_LEVEL */ -VOID StateMachineSetAction(IN STATE_MACHINE * S, - IN ULONG St, - IN ULONG Msg, IN STATE_MACHINE_FUNC Func) +void StateMachineSetAction(IN STATE_MACHINE * S, + unsigned long St, + unsigned long Msg, IN STATE_MACHINE_FUNC Func) { - ULONG MsgIdx; + unsigned long MsgIdx; MsgIdx = Msg - S->Base; @@ -5158,7 +5158,7 @@ VOID StateMachineSetAction(IN STATE_MACHINE * S, IRQL = DISPATCH_LEVEL */ -VOID StateMachinePerformAction(IN PRTMP_ADAPTER pAd, +void StateMachinePerformAction(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * S, IN MLME_QUEUE_ELEM * Elem) { (*(S->TransFunc[S->CurrState * S->NrMsg + Elem->MsgType - S->Base])) @@ -5173,7 +5173,7 @@ VOID StateMachinePerformAction(IN PRTMP_ADAPTER pAd, StateMachinePerformAction() ========================================================================== */ -VOID Drop(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void Drop(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { } @@ -5189,7 +5189,7 @@ VOID Drop(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID LfsrInit(IN PRTMP_ADAPTER pAd, IN ULONG Seed) +void LfsrInit(IN PRTMP_ADAPTER pAd, unsigned long Seed) { if (Seed == 0) pAd->Mlme.ShiftReg = 1; @@ -5202,15 +5202,15 @@ VOID LfsrInit(IN PRTMP_ADAPTER pAd, IN ULONG Seed) Description: ========================================================================== */ -UCHAR RandomByte(IN PRTMP_ADAPTER pAd) +u8 RandomByte(IN PRTMP_ADAPTER pAd) { - ULONG i; - UCHAR R, Result; + unsigned long i; + u8 R, Result; R = 0; if (pAd->Mlme.ShiftReg == 0) - NdisGetSystemUpTime((ULONG *) & pAd->Mlme.ShiftReg); + NdisGetSystemUpTime((unsigned long *) & pAd->Mlme.ShiftReg); for (i = 0; i < 8; i++) { if (pAd->Mlme.ShiftReg & 0x00000001) { @@ -5244,11 +5244,11 @@ UCHAR RandomByte(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID RTMPCheckRates(IN PRTMP_ADAPTER pAd, - IN OUT UCHAR SupRate[], IN OUT UCHAR * SupRateLen) +void RTMPCheckRates(IN PRTMP_ADAPTER pAd, + IN u8 SupRate[], IN u8 * SupRateLen) { - UCHAR RateIdx, i, j; - UCHAR NewRate[12], NewRateLen; + u8 RateIdx, i, j; + u8 NewRate[12], NewRateLen; NewRateLen = 0; @@ -5268,11 +5268,11 @@ VOID RTMPCheckRates(IN PRTMP_ADAPTER pAd, } BOOLEAN RTMPCheckChannel(IN PRTMP_ADAPTER pAd, - IN UCHAR CentralChannel, IN UCHAR Channel) + u8 CentralChannel, u8 Channel) { - UCHAR k; - UCHAR UpperChannel = 0, LowerChannel = 0; - UCHAR NoEffectChannelinList = 0; + u8 k; + u8 UpperChannel = 0, LowerChannel = 0; + u8 NoEffectChannelinList = 0; /* Find upper and lower channel according to 40MHz current operation. */ if (CentralChannel < Channel) { @@ -5321,7 +5321,7 @@ BOOLEAN RTMPCheckChannel(IN PRTMP_ADAPTER pAd, ======================================================================== */ BOOLEAN RTMPCheckHt(IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, + u8 Wcid, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo) { @@ -5449,11 +5449,11 @@ BOOLEAN RTMPCheckHt(IN PRTMP_ADAPTER pAd, ======================================================================== */ -VOID RTMPUpdateMlmeRate(IN PRTMP_ADAPTER pAd) +void RTMPUpdateMlmeRate(IN PRTMP_ADAPTER pAd) { - UCHAR MinimumRate; - UCHAR ProperMlmeRate; /*= RATE_54; */ - UCHAR i, j, RateIdx = 12; /*1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 */ + u8 MinimumRate; + u8 ProperMlmeRate; /*= RATE_54; */ + u8 i, j, RateIdx = 12; /*1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 */ BOOLEAN bMatch = FALSE; switch (pAd->CommonCfg.PhyMode) { @@ -5558,10 +5558,10 @@ VOID RTMPUpdateMlmeRate(IN PRTMP_ADAPTER pAd) pAd->CommonCfg.MlmeTransmit.word)); } -CHAR RTMPMaxRssi(IN PRTMP_ADAPTER pAd, - IN CHAR Rssi0, IN CHAR Rssi1, IN CHAR Rssi2) +char RTMPMaxRssi(IN PRTMP_ADAPTER pAd, + char Rssi0, char Rssi1, char Rssi2) { - CHAR larger = -127; + char larger = -127; if ((pAd->Antenna.field.RxPath == 1) && (Rssi0 != 0)) { larger = Rssi0; @@ -5594,9 +5594,9 @@ CHAR RTMPMaxRssi(IN PRTMP_ADAPTER pAd, ======================================================================== */ -VOID AsicEvaluateRxAnt(IN PRTMP_ADAPTER pAd) +void AsicEvaluateRxAnt(IN PRTMP_ADAPTER pAd) { - UCHAR BBPR3 = 0; + u8 BBPR3 = 0; if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_HALT_IN_PROGRESS | @@ -5638,7 +5638,7 @@ VOID AsicEvaluateRxAnt(IN PRTMP_ADAPTER pAd) if (OPSTATUS_TEST_FLAG (pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) ) { - ULONG TxTotalCnt = + unsigned long TxTotalCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount + pAd->RalinkCounters.OneSecTxRetryOkCount + pAd->RalinkCounters.OneSecTxFailCount; @@ -5673,13 +5673,13 @@ VOID AsicEvaluateRxAnt(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID AsicRxAntEvalTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) +void AsicRxAntEvalTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3) { RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; - UCHAR BBPR3 = 0; - CHAR larger = -127, rssi0, rssi1, rssi2; + u8 BBPR3 = 0; + char larger = -127, rssi0, rssi1, rssi2; if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_HALT_IN_PROGRESS | @@ -5745,9 +5745,9 @@ VOID AsicRxAntEvalTimeout(IN PVOID SystemSpecific1, } -VOID APSDPeriodicExec(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) +void APSDPeriodicExec(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3) { RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; @@ -5784,7 +5784,7 @@ VOID APSDPeriodicExec(IN PVOID SystemSpecific1, ======================================================================== */ -VOID RTMPSetPiggyBack(IN PRTMP_ADAPTER pAd, IN BOOLEAN bPiggyBack) +void RTMPSetPiggyBack(IN PRTMP_ADAPTER pAd, IN BOOLEAN bPiggyBack) { TX_LINK_CFG_STRUC TxLinkCfg; @@ -5850,13 +5850,13 @@ BOOLEAN RTMPAutoRateSwitchCheck(IN PRTMP_ADAPTER pAd) ======================================================================== */ -UCHAR RTMPStaFixedTxMode(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry) +u8 RTMPStaFixedTxMode(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry) { - UCHAR tx_mode = FIXED_TXMODE_HT; + u8 tx_mode = FIXED_TXMODE_HT; { tx_mode = - (UCHAR) pAd->StaCfg.DesiredTransmitSetting.field. + (u8)pAd->StaCfg.DesiredTransmitSetting.field. FixedTxMode; } @@ -5878,7 +5878,7 @@ UCHAR RTMPStaFixedTxMode(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry) ======================================================================== */ -VOID RTMPUpdateLegacyTxSetting(UCHAR fixed_tx_mode, PMAC_TABLE_ENTRY pEntry) +void RTMPUpdateLegacyTxSetting(u8 fixed_tx_mode, PMAC_TABLE_ENTRY pEntry) { HTTRANSMIT_SETTING TransmitSetting; @@ -5921,10 +5921,10 @@ VOID RTMPUpdateLegacyTxSetting(UCHAR fixed_tx_mode, PMAC_TABLE_ENTRY pEntry) ========================================================================== */ -VOID AsicStaBbpTuning(IN PRTMP_ADAPTER pAd) +void AsicStaBbpTuning(IN PRTMP_ADAPTER pAd) { - UCHAR OrigR66Value = 0, R66; /*, R66UpperBound = 0x30, R66LowerBound = 0x30; */ - CHAR Rssi; + u8 OrigR66Value = 0, R66; /*, R66UpperBound = 0x30, R66LowerBound = 0x30; */ + char Rssi; /* 2860C did not support Fase CCA, therefore can't tune */ if (pAd->MACVersion == 0x28600100) @@ -6033,9 +6033,9 @@ VOID AsicStaBbpTuning(IN PRTMP_ADAPTER pAd) } } -VOID RTMPSetAGCInitValue(IN PRTMP_ADAPTER pAd, IN UCHAR BandWidth) +void RTMPSetAGCInitValue(IN PRTMP_ADAPTER pAd, u8 BandWidth) { - UCHAR R66 = 0x30; + u8 R66 = 0x30; if (pAd->LatchRfRegs.Channel <= 14) { /* BG band */ #ifdef RT30xx @@ -6055,12 +6055,12 @@ VOID RTMPSetAGCInitValue(IN PRTMP_ADAPTER pAd, IN UCHAR BandWidth) { if (BandWidth == BW_20) { R66 = - (UCHAR) (0x32 + + (u8)(0x32 + (GET_LNA_GAIN(pAd) * 5) / 3); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); } else { R66 = - (UCHAR) (0x3A + + (u8)(0x3A + (GET_LNA_GAIN(pAd) * 5) / 3); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, R66); } diff --git a/drivers/staging/rt2860/common/rt_channel.c b/drivers/staging/rt2860/common/rt_channel.c index 0af7e6b0a4c0..3fe5d9762b2c 100644 --- a/drivers/staging/rt2860/common/rt_channel.c +++ b/drivers/staging/rt2860/common/rt_channel.c @@ -144,7 +144,7 @@ CH_FREQ_MAP CH_HZ_ID_MAP[] = { , /* Japan, means J16 */ }; -INT CH_HZ_ID_MAP_NUM = (sizeof(CH_HZ_ID_MAP) / sizeof(CH_FREQ_MAP)); +int CH_HZ_ID_MAP_NUM = (sizeof(CH_HZ_ID_MAP) / sizeof(CH_FREQ_MAP)); CH_REGION ChRegion[] = { { /* Antigua and Berbuda */ @@ -1422,14 +1422,14 @@ CH_REGION ChRegion[] = { , }; -static PCH_REGION GetChRegion(IN PUCHAR CntryCode) +static PCH_REGION GetChRegion(u8 *CntryCode) { - INT loop = 0; + int loop = 0; PCH_REGION pChRegion = NULL; - while (strcmp((PSTRING) ChRegion[loop].CountReg, "") != 0) { + while (strcmp((char *)ChRegion[loop].CountReg, "") != 0) { if (strncmp - ((PSTRING) ChRegion[loop].CountReg, (PSTRING) CntryCode, + ((char *)ChRegion[loop].CountReg, (char *)CntryCode, 2) == 0) { pChRegion = &ChRegion[loop]; break; @@ -1442,7 +1442,7 @@ static PCH_REGION GetChRegion(IN PUCHAR CntryCode) return pChRegion; } -static VOID ChBandCheck(IN UCHAR PhyMode, OUT PUCHAR pChType) +static void ChBandCheck(u8 PhyMode, u8 *pChType) { switch (PhyMode) { case PHY_11A: @@ -1461,12 +1461,12 @@ static VOID ChBandCheck(IN UCHAR PhyMode, OUT PUCHAR pChType) } } -static UCHAR FillChList(IN PRTMP_ADAPTER pAd, +static u8 FillChList(IN PRTMP_ADAPTER pAd, IN PCH_DESP pChDesp, - IN UCHAR Offset, IN UCHAR increment) + u8 Offset, u8 increment) { - INT i, j, l; - UCHAR channel; + int i, j, l; + u8 channel; j = Offset; for (i = 0; i < pChDesp->NumOfCh; i++) { @@ -1494,14 +1494,14 @@ static UCHAR FillChList(IN PRTMP_ADAPTER pAd, return j; } -static inline VOID CreateChList(IN PRTMP_ADAPTER pAd, - IN PCH_REGION pChRegion, IN UCHAR Geography) +static inline void CreateChList(IN PRTMP_ADAPTER pAd, + IN PCH_REGION pChRegion, u8 Geography) { - INT i; - UCHAR offset = 0; + int i; + u8 offset = 0; PCH_DESP pChDesp; - UCHAR ChType; - UCHAR increment; + u8 ChType; + u8 increment; if (pChRegion == NULL) return; @@ -1532,7 +1532,7 @@ static inline VOID CreateChList(IN PRTMP_ADAPTER pAd, } } -VOID BuildChannelListEx(IN PRTMP_ADAPTER pAd) +void BuildChannelListEx(IN PRTMP_ADAPTER pAd) { PCH_REGION pChReg; @@ -1540,14 +1540,14 @@ VOID BuildChannelListEx(IN PRTMP_ADAPTER pAd) CreateChList(pAd, pChReg, pAd->CommonCfg.Geography); } -VOID BuildBeaconChList(IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf, OUT PULONG pBufLen) +void BuildBeaconChList(IN PRTMP_ADAPTER pAd, + u8 *pBuf, unsigned long *pBufLen) { - INT i; - ULONG TmpLen; + int i; + unsigned long TmpLen; PCH_REGION pChRegion; PCH_DESP pChDesp; - UCHAR ChType; + u8 ChType; pChRegion = GetChRegion(pAd->CommonCfg.CountryCode); @@ -1581,9 +1581,9 @@ VOID BuildBeaconChList(IN PRTMP_ADAPTER pAd, } } -static BOOLEAN IsValidChannel(IN PRTMP_ADAPTER pAd, IN UCHAR channel) +static BOOLEAN IsValidChannel(IN PRTMP_ADAPTER pAd, u8 channel) { - INT i; + int i; for (i = 0; i < pAd->ChannelListNum; i++) { if (pAd->ChannelList[i].Channel == channel) @@ -1596,9 +1596,9 @@ static BOOLEAN IsValidChannel(IN PRTMP_ADAPTER pAd, IN UCHAR channel) return TRUE; } -static UCHAR GetExtCh(IN UCHAR Channel, IN UCHAR Direction) +static u8 GetExtCh(u8 Channel, u8 Direction) { - CHAR ExtCh; + char ExtCh; if (Direction == EXTCHA_ABOVE) ExtCh = Channel + 4; @@ -1608,10 +1608,10 @@ static UCHAR GetExtCh(IN UCHAR Channel, IN UCHAR Direction) return ExtCh; } -VOID N_ChannelCheck(IN PRTMP_ADAPTER pAd) +void N_ChannelCheck(IN PRTMP_ADAPTER pAd) { - /*UCHAR ChannelNum = pAd->ChannelListNum; */ - UCHAR Channel = pAd->CommonCfg.Channel; + /*u8 ChannelNum = pAd->ChannelListNum; */ + u8 Channel = pAd->CommonCfg.Channel; if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) && (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)) { @@ -1638,8 +1638,8 @@ VOID N_ChannelCheck(IN PRTMP_ADAPTER pAd) } } else { do { - UCHAR ExtCh; - UCHAR Dir = + u8 ExtCh; + u8 Dir = pAd->CommonCfg.RegTransmitSetting.field. EXTCHA; ExtCh = GetExtCh(Channel, Dir); @@ -1670,7 +1670,7 @@ VOID N_ChannelCheck(IN PRTMP_ADAPTER pAd) } -VOID N_SetCenCh(IN PRTMP_ADAPTER pAd) +void N_SetCenCh(IN PRTMP_ADAPTER pAd) { if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40) { if (pAd->CommonCfg.RegTransmitSetting.field.EXTCHA == @@ -1690,7 +1690,7 @@ VOID N_SetCenCh(IN PRTMP_ADAPTER pAd) } } -UINT8 GetCuntryMaxTxPwr(IN PRTMP_ADAPTER pAd, IN UINT8 channel) +u8 GetCuntryMaxTxPwr(IN PRTMP_ADAPTER pAd, u8 channel) { int i; for (i = 0; i < pAd->ChannelListNum; i++) { diff --git a/drivers/staging/rt2860/common/rt_rf.c b/drivers/staging/rt2860/common/rt_rf.c index 8b5be1766fba..6d6ca32691ff 100644 --- a/drivers/staging/rt2860/common/rt_rf.c +++ b/drivers/staging/rt2860/common/rt_rf.c @@ -53,11 +53,11 @@ ======================================================================== */ -NDIS_STATUS RT30xxWriteRFRegister(IN PRTMP_ADAPTER pAd, - IN UCHAR regID, IN UCHAR value) +int RT30xxWriteRFRegister(IN PRTMP_ADAPTER pAd, + u8 regID, u8 value) { RF_CSR_CFG_STRUC rfcsr; - UINT i = 0; + u32 i = 0; do { RTMP_IO_READ32(pAd, RF_CSR_CFG, &rfcsr.word); @@ -101,11 +101,11 @@ NDIS_STATUS RT30xxWriteRFRegister(IN PRTMP_ADAPTER pAd, ======================================================================== */ -NDIS_STATUS RT30xxReadRFRegister(IN PRTMP_ADAPTER pAd, - IN UCHAR regID, IN PUCHAR pValue) +int RT30xxReadRFRegister(IN PRTMP_ADAPTER pAd, + u8 regID, u8 *pValue) { RF_CSR_CFG_STRUC rfcsr; - UINT i = 0, k = 0; + u32 i = 0, k = 0; for (i = 0; i < MAX_BUSY_COUNT; i++) { RTMP_IO_READ32(pAd, RF_CSR_CFG, &rfcsr.word); @@ -126,7 +126,7 @@ NDIS_STATUS RT30xxReadRFRegister(IN PRTMP_ADAPTER pAd, } if ((rfcsr.field.RF_CSR_KICK == IDLE) && (rfcsr.field.TESTCSR_RFACC_REGNUM == regID)) { - *pValue = (UCHAR) rfcsr.field.RF_CSR_DATA; + *pValue = (u8)rfcsr.field.RF_CSR_DATA; break; } } @@ -139,13 +139,13 @@ NDIS_STATUS RT30xxReadRFRegister(IN PRTMP_ADAPTER pAd, return STATUS_SUCCESS; } -VOID NICInitRFRegisters(IN RTMP_ADAPTER * pAd) +void NICInitRFRegisters(IN RTMP_ADAPTER * pAd) { if (pAd->chipOps.AsicRfInit) pAd->chipOps.AsicRfInit(pAd); } -VOID RtmpChipOpsRFHook(IN RTMP_ADAPTER * pAd) +void RtmpChipOpsRFHook(IN RTMP_ADAPTER * pAd) { RTMP_CHIP_OP *pChipOps = &pAd->chipOps; diff --git a/drivers/staging/rt2860/common/rtmp_init.c b/drivers/staging/rt2860/common/rtmp_init.c index 0a958704e5a4..5735dd7c182d 100644 --- a/drivers/staging/rt2860/common/rtmp_init.c +++ b/drivers/staging/rt2860/common/rtmp_init.c @@ -36,7 +36,7 @@ */ #include "../rt_config.h" -UCHAR BIT8[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; +u8 BIT8[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; char *CipherName[] = { "none", "wep64", "wep128", "TKIP", "AES", "CKIP64", "CKIP128" }; @@ -152,13 +152,13 @@ RTMP_REG_PAIR STAMACRegTable[] = { ======================================================================== */ -NDIS_STATUS RTMPAllocAdapterBlock(IN PVOID handle, +int RTMPAllocAdapterBlock(void *handle, OUT PRTMP_ADAPTER * ppAdapter) { PRTMP_ADAPTER pAd; - NDIS_STATUS Status; - INT index; - UCHAR *pBeaconBuf = NULL; + int Status; + int index; + u8 *pBeaconBuf = NULL; DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPAllocAdapterBlock\n")); @@ -174,7 +174,7 @@ NDIS_STATUS RTMPAllocAdapterBlock(IN PVOID handle, } NdisZeroMemory(pBeaconBuf, MAX_BEACON_SIZE); - Status = AdapterBlockAllocateMemory(handle, (PVOID *) & pAd); + Status = AdapterBlockAllocateMemory(handle, (void **) & pAd); if (Status != NDIS_STATUS_SUCCESS) { DBGPRINT_ERR(("Failed to allocate memory - ADAPTER\n")); break; @@ -182,7 +182,7 @@ NDIS_STATUS RTMPAllocAdapterBlock(IN PVOID handle, pAd->BeaconBuf = pBeaconBuf; DBGPRINT(RT_DEBUG_OFF, ("\n\n=== pAd = %p, size = %d ===\n\n", pAd, - (UINT32) sizeof(RTMP_ADAPTER))); + (u32)sizeof(RTMP_ADAPTER))); /* Init spin locks */ NdisAllocateSpinLock(&pAd->MgmtRingLock); @@ -230,12 +230,12 @@ NDIS_STATUS RTMPAllocAdapterBlock(IN PVOID handle, ======================================================================== */ -VOID RTMPReadTxPwrPerRate(IN PRTMP_ADAPTER pAd) +void RTMPReadTxPwrPerRate(IN PRTMP_ADAPTER pAd) { - ULONG data, Adata, Gdata; - USHORT i, value, value2; - INT Apwrdelta, Gpwrdelta; - UCHAR t1, t2, t3, t4; + unsigned long data, Adata, Gdata; + u16 i, value, value2; + int Apwrdelta, Gpwrdelta; + u8 t1, t2, t3, t4; BOOLEAN bApwrdeltaMinus = TRUE, bGpwrdeltaMinus = TRUE; /* */ @@ -441,9 +441,9 @@ VOID RTMPReadTxPwrPerRate(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID RTMPReadChannelPwr(IN PRTMP_ADAPTER pAd) +void RTMPReadChannelPwr(IN PRTMP_ADAPTER pAd) { - UCHAR i, choffset; + u8 i, choffset; EEPROM_TX_PWR_STRUC Power; EEPROM_TX_PWR_STRUC Power2; @@ -650,10 +650,10 @@ VOID RTMPReadChannelPwr(IN PRTMP_ADAPTER pAd) ======================================================================== */ -NDIS_STATUS NICReadRegParameters(IN PRTMP_ADAPTER pAd, +int NICReadRegParameters(IN PRTMP_ADAPTER pAd, IN NDIS_HANDLE WrapperConfigurationContext) { - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + int Status = NDIS_STATUS_SUCCESS; DBGPRINT_S(Status, ("<-- NICReadRegParameters, Status=%x\n", Status)); return Status; } @@ -676,11 +676,11 @@ NDIS_STATUS NICReadRegParameters(IN PRTMP_ADAPTER pAd, ======================================================================== */ -VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) +void NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, u8 *mac_addr) { - UINT32 data = 0; - USHORT i, value, value2; - UCHAR TmpPhy; + u32 data = 0; + u16 i, value, value2; + u8 TmpPhy; EEPROM_TX_PWR_STRUC Power; EEPROM_VERSION_STRUC Version; EEPROM_ANTENNA_STRUC Antenna; @@ -707,29 +707,29 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) /* RT2860 MAC no longer auto load MAC address from E2PROM. Driver has to intialize */ /* MAC address registers according to E2PROM setting */ if (mac_addr == NULL || - strlen((PSTRING) mac_addr) != 17 || + strlen((char *)mac_addr) != 17 || mac_addr[2] != ':' || mac_addr[5] != ':' || mac_addr[8] != ':' || mac_addr[11] != ':' || mac_addr[14] != ':') { - USHORT Addr01, Addr23, Addr45; + u16 Addr01, Addr23, Addr45; RT28xx_EEPROM_READ16(pAd, 0x04, Addr01); RT28xx_EEPROM_READ16(pAd, 0x06, Addr23); RT28xx_EEPROM_READ16(pAd, 0x08, Addr45); - pAd->PermanentAddress[0] = (UCHAR) (Addr01 & 0xff); - pAd->PermanentAddress[1] = (UCHAR) (Addr01 >> 8); - pAd->PermanentAddress[2] = (UCHAR) (Addr23 & 0xff); - pAd->PermanentAddress[3] = (UCHAR) (Addr23 >> 8); - pAd->PermanentAddress[4] = (UCHAR) (Addr45 & 0xff); - pAd->PermanentAddress[5] = (UCHAR) (Addr45 >> 8); + pAd->PermanentAddress[0] = (u8)(Addr01 & 0xff); + pAd->PermanentAddress[1] = (u8)(Addr01 >> 8); + pAd->PermanentAddress[2] = (u8)(Addr23 & 0xff); + pAd->PermanentAddress[3] = (u8)(Addr23 >> 8); + pAd->PermanentAddress[4] = (u8)(Addr45 & 0xff); + pAd->PermanentAddress[5] = (u8)(Addr45 >> 8); DBGPRINT(RT_DEBUG_TRACE, ("Initialize MAC Address from E2PROM \n")); } else { - INT j; - PSTRING macptr; + int j; + char *macptr; - macptr = (PSTRING) mac_addr; + macptr = (char *)mac_addr; for (j = 0; j < MAC_ADDR_LEN; j++) { AtoH(macptr, &pAd->PermanentAddress[j], 1); @@ -898,15 +898,15 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) pAd->Antenna.word = Antenna.word; /* Set the RfICType here, then we can initialize RFIC related operation callbacks */ - pAd->Mlme.RealRxPath = (UCHAR) Antenna.field.RxPath; - pAd->RfIcType = (UCHAR) Antenna.field.RfIcType; + pAd->Mlme.RealRxPath = (u8)Antenna.field.RxPath; + pAd->RfIcType = (u8)Antenna.field.RfIcType; #ifdef RTMP_RF_RW_SUPPORT RtmpChipOpsRFHook(pAd); #endif /* RTMP_RF_RW_SUPPORT // */ #ifdef RTMP_MAC_PCI - sprintf((PSTRING) pAd->nickname, "RT2860STA"); + sprintf((char *)pAd->nickname, "RT2860STA"); #endif /* RTMP_MAC_PCI // */ /* */ @@ -1005,7 +1005,7 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) /* Read frequency offset setting for RF */ RT28xx_EEPROM_READ16(pAd, EEPROM_FREQ_OFFSET, value); if ((value & 0x00FF) != 0x00FF) - pAd->RfFreqOffset = (ULONG) (value & 0x00FF); + pAd->RfFreqOffset = (unsigned long)(value & 0x00FF); else pAd->RfFreqOffset = 0; DBGPRINT(RT_DEBUG_TRACE, @@ -1017,8 +1017,8 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) if ((value <= REGION_MAXIMUM_BG_BAND) && (value2 <= REGION_MAXIMUM_A_BAND)) { - pAd->CommonCfg.CountryRegion = ((UCHAR) value) | 0x80; - pAd->CommonCfg.CountryRegionForABand = ((UCHAR) value2) | 0x80; + pAd->CommonCfg.CountryRegion = ((u8)value) | 0x80; + pAd->CommonCfg.CountryRegionForABand = ((u8)value2) | 0x80; TmpPhy = pAd->CommonCfg.PhyMode; pAd->CommonCfg.PhyMode = 0xff; RTMPSetPhyMode(pAd, TmpPhy); @@ -1057,9 +1057,9 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) pAd->ARssiOffset2 = value & 0x00ff; pAd->ALNAGain2 = (value >> 8); - if (((UCHAR) pAd->ALNAGain1 == 0xFF) || (pAd->ALNAGain1 == 0x00)) + if (((u8)pAd->ALNAGain1 == 0xFF) || (pAd->ALNAGain1 == 0x00)) pAd->ALNAGain1 = pAd->ALNAGain0; - if (((UCHAR) pAd->ALNAGain2 == 0xFF) || (pAd->ALNAGain2 == 0x00)) + if (((u8)pAd->ALNAGain2 == 0xFF) || (pAd->ALNAGain2 == 0x00)) pAd->ALNAGain2 = pAd->ALNAGain0; /* Validate 11a RSSI_0 offset. */ @@ -1087,7 +1087,7 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) value &= 0x00ff; if (value != 0xff) { value &= 0x07; - pAd->TxMixerGain24G = (UCHAR) value; + pAd->TxMixerGain24G = (u8)value; } } #endif /* RT30xx // */ @@ -1133,23 +1133,23 @@ VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr) ======================================================================== */ -VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) +void NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) { - UINT32 data = 0; - UCHAR BBPR1 = 0; - USHORT i; + u32 data = 0; + u8 BBPR1 = 0; + u16 i; /* EEPROM_ANTENNA_STRUC Antenna; */ EEPROM_NIC_CONFIG2_STRUC NicConfig2; - UCHAR BBPR3 = 0; + u8 BBPR3 = 0; DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitAsicFromEEPROM\n")); for (i = 3; i < NUM_EEPROM_BBP_PARMS; i++) { - UCHAR BbpRegIdx, BbpValue; + u8 BbpRegIdx, BbpValue; if ((pAd->EEPROMDefaultValue[i] != 0xFFFF) && (pAd->EEPROMDefaultValue[i] != 0)) { - BbpRegIdx = (UCHAR) (pAd->EEPROMDefaultValue[i] >> 8); - BbpValue = (UCHAR) (pAd->EEPROMDefaultValue[i] & 0xff); + BbpRegIdx = (u8)(pAd->EEPROMDefaultValue[i] >> 8); + BbpValue = (u8)(pAd->EEPROMDefaultValue[i] & 0xff); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BbpRegIdx, BbpValue); } } @@ -1191,12 +1191,12 @@ VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) #endif /* RTMP_MAC_USB // */ } - AsicSendCommandToMcu(pAd, 0x52, 0xff, (UCHAR) pAd->Led1, - (UCHAR) (pAd->Led1 >> 8)); - AsicSendCommandToMcu(pAd, 0x53, 0xff, (UCHAR) pAd->Led2, - (UCHAR) (pAd->Led2 >> 8)); - AsicSendCommandToMcu(pAd, 0x54, 0xff, (UCHAR) pAd->Led3, - (UCHAR) (pAd->Led3 >> 8)); + AsicSendCommandToMcu(pAd, 0x52, 0xff, (u8)pAd->Led1, + (u8)(pAd->Led1 >> 8)); + AsicSendCommandToMcu(pAd, 0x53, 0xff, (u8)pAd->Led2, + (u8)(pAd->Led2 >> 8)); + AsicSendCommandToMcu(pAd, 0x54, 0xff, (u8)pAd->Led3, + (u8)(pAd->Led3 >> 8)); AsicSendCommandToMcu(pAd, 0x51, 0xff, 0, pAd->LedCntl.field.Polarity); pAd->LedIndicatorStrength = 0xFF; @@ -1306,16 +1306,16 @@ VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) /* update registers from EEPROM for RT3071 or later(3572/3592). */ if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) { - UCHAR RegIdx, RegValue; - USHORT value; + u8 RegIdx, RegValue; + u16 value; /* after RT3071, write BBP from EEPROM 0xF0 to 0x102 */ for (i = 0xF0; i <= 0x102; i = i + 2) { value = 0xFFFF; RT28xx_EEPROM_READ16(pAd, i, value); if ((value != 0xFFFF) && (value != 0)) { - RegIdx = (UCHAR) (value >> 8); - RegValue = (UCHAR) (value & 0xff); + RegIdx = (u8)(value >> 8); + RegValue = (u8)(value & 0xff); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, RegIdx, RegValue); DBGPRINT(RT_DEBUG_TRACE, @@ -1329,8 +1329,8 @@ VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) value = 0xFFFF; RT28xx_EEPROM_READ16(pAd, i, value); if ((value != 0xFFFF) && (value != 0)) { - RegIdx = (UCHAR) (value >> 8); - RegValue = (UCHAR) (value & 0xff); + RegIdx = (u8)(value >> 8); + RegValue = (u8)(value & 0xff); RT30xxWriteRFRegister(pAd, RegIdx, RegValue); DBGPRINT(RT_DEBUG_TRACE, ("Update RF Registers from EEPROM0x%x), BBP(0x%x) = 0x%x\n", @@ -1366,16 +1366,16 @@ VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) ======================================================================== */ -NDIS_STATUS NICInitializeAdapter(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) +int NICInitializeAdapter(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) { - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + int Status = NDIS_STATUS_SUCCESS; WPDMA_GLO_CFG_STRUC GloCfg; #ifdef RTMP_MAC_PCI - UINT32 Value; + u32 Value; DELAY_INT_CFG_STRUC IntCfg; #endif /* RTMP_MAC_PCI // */ /* INT_MASK_CSR_STRUC IntMask; */ - ULONG i = 0, j = 0; + unsigned long i = 0, j = 0; AC_TXOP_CSR0_STRUC csr0; DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitializeAdapter\n")); @@ -1562,22 +1562,22 @@ retry: ======================================================================== */ -NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) +int NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) { - ULONG Index = 0; - UCHAR R0 = 0xff; - UINT32 MacCsr12 = 0, Counter = 0; + unsigned long Index = 0; + u8 R0 = 0xff; + u32 MacCsr12 = 0, Counter = 0; #ifdef RTMP_MAC_USB - UINT32 MacCsr0 = 0; - NTSTATUS Status; - UCHAR Value = 0xff; + u32 MacCsr0 = 0; + int Status; + u8 Value = 0xff; #endif /* RTMP_MAC_USB // */ #ifdef RT30xx - UCHAR bbpreg = 0; - UCHAR RFValue = 0; + u8 bbpreg = 0; + u8 RFValue = 0; #endif /* RT30xx // */ - USHORT KeyIdx; - INT i, apidx; + u16 KeyIdx; + int i, apidx; DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitializeAsic\n")); @@ -1642,14 +1642,14 @@ NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) MACRegTable[Index].Value = 0x00000400; } #endif /* RT30xx // */ - RTMP_IO_WRITE32(pAd, (USHORT) MACRegTable[Index].Register, + RTMP_IO_WRITE32(pAd, (u16)MACRegTable[Index].Register, MACRegTable[Index].Value); } { for (Index = 0; Index < NUM_STA_MAC_REG_PARMS; Index++) { RTMP_IO_WRITE32(pAd, - (USHORT) STAMACRegTable[Index].Register, + (u16)STAMACRegTable[Index].Register, STAMACRegTable[Index].Value); } } @@ -1726,8 +1726,8 @@ NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) #ifdef RTMP_MAC_PCI /* TODO: shiang, check MACVersion, currently, rbus-based chip use this. */ if (pAd->MACVersion == 0x28720200) { - /*UCHAR value; */ - ULONG value2; + /*u8 value; */ + unsigned long value2; /*disable MLD by Bruce 20080704 */ /*BBP_IO_READ8_BY_REG_ID(pAd, BBP_R105, &value); */ @@ -1816,7 +1816,7 @@ NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) if (pAd->MACVersion >= RALINK_2880E_VERSION && pAd->MACVersion < RALINK_3070_VERSION) /* 3*3 */ { /* enlarge MAX_LEN_CFG */ - UINT32 csr; + u32 csr; RTMP_IO_READ32(pAd, MAX_LEN_CFG, &csr); csr &= 0xFFF; csr |= 0x2000; @@ -1824,14 +1824,14 @@ NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) } #ifdef RTMP_MAC_USB { - UCHAR MAC_Value[] = + u8 MAC_Value[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0 }; /*Initialize WCID table */ Value = 0xff; for (Index = 0; Index < 254; Index++) { RTUSBMultiWrite(pAd, - (USHORT) (MAC_WCID_BASE + Index * 8), + (u16)(MAC_WCID_BASE + Index * 8), MAC_Value, 8); } } @@ -1929,9 +1929,9 @@ NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) ======================================================================== */ -VOID NICIssueReset(IN PRTMP_ADAPTER pAd) +void NICIssueReset(IN PRTMP_ADAPTER pAd) { - UINT32 Value = 0; + u32 Value = 0; DBGPRINT(RT_DEBUG_TRACE, ("--> NICIssueReset\n")); /* Abort Tx, prevent ASIC from writing to Host memory */ @@ -1970,14 +1970,14 @@ BOOLEAN NICCheckForHang(IN PRTMP_ADAPTER pAd) return (FALSE); } -VOID NICUpdateFifoStaCounters(IN PRTMP_ADAPTER pAd) +void NICUpdateFifoStaCounters(IN PRTMP_ADAPTER pAd) { TX_STA_FIFO_STRUC StaFifo; MAC_TABLE_ENTRY *pEntry; - UCHAR i = 0; - UCHAR pid = 0, wcid = 0; - CHAR reTry; - UCHAR succMCS; + u8 i = 0; + u8 pid = 0, wcid = 0; + char reTry; + u8 succMCS; do { RTMP_IO_READ32(pAd, TX_STA_FIFO, &StaFifo.word); @@ -1985,7 +1985,7 @@ VOID NICUpdateFifoStaCounters(IN PRTMP_ADAPTER pAd) if (StaFifo.field.bValid == 0) break; - wcid = (UCHAR) StaFifo.field.wcid; + wcid = (u8)StaFifo.field.wcid; /* ignore NoACK and MGMT frame use 0xFF as WCID */ if ((StaFifo.field.TxAckRequired == 0) @@ -1995,7 +1995,7 @@ VOID NICUpdateFifoStaCounters(IN PRTMP_ADAPTER pAd) } /* PID store Tx MCS Rate */ - pid = (UCHAR) StaFifo.field.PidType; + pid = (u8)StaFifo.field.PidType; pEntry = &pAd->MacTab.Content[wcid]; @@ -2094,11 +2094,11 @@ VOID NICUpdateFifoStaCounters(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID NICUpdateRawCounters(IN PRTMP_ADAPTER pAd) +void NICUpdateRawCounters(IN PRTMP_ADAPTER pAd) { - UINT32 OldValue; /*, Value2; */ - /*ULONG PageSum, OneSecTransmitCount; */ - /*ULONG TxErrorRatio, Retry, Fail; */ + u32 OldValue; /*, Value2; */ + /*unsigned long PageSum, OneSecTransmitCount; */ + /*unsigned long TxErrorRatio, Retry, Fail; */ RX_STA_CNT0_STRUC RxStaCnt0; RX_STA_CNT1_STRUC RxStaCnt1; RX_STA_CNT2_STRUC RxStaCnt2; @@ -2299,7 +2299,7 @@ VOID NICUpdateRawCounters(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID NICResetFromError(IN PRTMP_ADAPTER pAd) +void NICResetFromError(IN PRTMP_ADAPTER pAd) { /* Reset BBP (according to alex, reset ASIC will force reset BBP */ /* Therefore, skip the reset BBP */ @@ -2317,9 +2317,9 @@ VOID NICResetFromError(IN PRTMP_ADAPTER pAd) AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); } -NDIS_STATUS NICLoadFirmware(IN PRTMP_ADAPTER pAd) +int NICLoadFirmware(IN PRTMP_ADAPTER pAd) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + int status = NDIS_STATUS_SUCCESS; if (pAd->chipOps.loadFirmware) status = pAd->chipOps.loadFirmware(pAd); @@ -2339,7 +2339,7 @@ NDIS_STATUS NICLoadFirmware(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID NICEraseFirmware(IN PRTMP_ADAPTER pAd) +void NICEraseFirmware(IN PRTMP_ADAPTER pAd) { if (pAd->chipOps.eraseFirmware) pAd->chipOps.eraseFirmware(pAd); @@ -2367,7 +2367,7 @@ VOID NICEraseFirmware(IN PRTMP_ADAPTER pAd) ======================================================================== */ -NDIS_STATUS NICLoadRateSwitchingParams(IN PRTMP_ADAPTER pAd) +int NICLoadRateSwitchingParams(IN PRTMP_ADAPTER pAd) { return NDIS_STATUS_SUCCESS; } @@ -2393,14 +2393,14 @@ NDIS_STATUS NICLoadRateSwitchingParams(IN PRTMP_ADAPTER pAd) ======================================================================== */ -ULONG RTMPCompareMemory(IN PVOID pSrc1, IN PVOID pSrc2, IN ULONG Length) +unsigned long RTMPCompareMemory(void *pSrc1, void *pSrc2, unsigned long Length) { - PUCHAR pMem1; - PUCHAR pMem2; - ULONG Index = 0; + u8 *pMem1; + u8 *pMem2; + unsigned long Index = 0; - pMem1 = (PUCHAR) pSrc1; - pMem2 = (PUCHAR) pSrc2; + pMem1 = (u8 *)pSrc1; + pMem2 = (u8 *)pSrc2; for (Index = 0; Index < Length; Index++) { if (pMem1[Index] > pMem2[Index]) @@ -2433,12 +2433,12 @@ ULONG RTMPCompareMemory(IN PVOID pSrc1, IN PVOID pSrc2, IN ULONG Length) ======================================================================== */ -VOID RTMPZeroMemory(IN PVOID pSrc, IN ULONG Length) +void RTMPZeroMemory(void *pSrc, unsigned long Length) { - PUCHAR pMem; - ULONG Index = 0; + u8 *pMem; + unsigned long Index = 0; - pMem = (PUCHAR) pSrc; + pMem = (u8 *)pSrc; for (Index = 0; Index < Length; Index++) { pMem[Index] = 0x00; @@ -2466,16 +2466,16 @@ VOID RTMPZeroMemory(IN PVOID pSrc, IN ULONG Length) ======================================================================== */ -VOID RTMPMoveMemory(OUT PVOID pDest, IN PVOID pSrc, IN ULONG Length) +void RTMPMoveMemory(void *pDest, void *pSrc, unsigned long Length) { - PUCHAR pMem1; - PUCHAR pMem2; - UINT Index; + u8 *pMem1; + u8 *pMem2; + u32 Index; ASSERT((Length == 0) || (pDest && pSrc)); - pMem1 = (PUCHAR) pDest; - pMem2 = (PUCHAR) pSrc; + pMem1 = (u8 *)pDest; + pMem2 = (u8 *)pSrc; for (Index = 0; Index < Length; Index++) { pMem1[Index] = pMem2[Index]; @@ -2500,9 +2500,9 @@ VOID RTMPMoveMemory(OUT PVOID pDest, IN PVOID pSrc, IN ULONG Length) ======================================================================== */ -VOID UserCfgInit(IN PRTMP_ADAPTER pAd) +void UserCfgInit(IN PRTMP_ADAPTER pAd) { - UINT key_index, bss_index; + u32 key_index, bss_index; DBGPRINT(RT_DEBUG_TRACE, ("--> UserCfgInit\n")); @@ -2703,7 +2703,7 @@ VOID UserCfgInit(IN PRTMP_ADAPTER pAd) /* PHY specification */ pAd->CommonCfg.PhyMode = PHY_11BG_MIXED; /* default PHY mode */ - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); /* CCK use LONG preamble */ + OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED); /* CCK use long preamble */ { /* user desired power mode */ @@ -2736,10 +2736,10 @@ VOID UserCfgInit(IN PRTMP_ADAPTER pAd) NdisZeroMemory(pAd->nickname, IW_ESSID_MAX_SIZE + 1); #ifdef RTMP_MAC_PCI - sprintf((PSTRING) pAd->nickname, "RT2860STA"); + sprintf((char *)pAd->nickname, "RT2860STA"); #endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB - sprintf((PSTRING) pAd->nickname, "RT2870STA"); + sprintf((char *)pAd->nickname, "RT2870STA"); #endif /* RTMP_MAC_USB // */ RTMPInitTimer(pAd, &pAd->StaCfg.WpaDisassocAndBlockAssocTimer, GET_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc), @@ -2810,7 +2810,7 @@ VOID UserCfgInit(IN PRTMP_ADAPTER pAd) } /* IRQL = PASSIVE_LEVEL */ -UCHAR BtoH(STRING ch) +u8 BtoH(char ch) { if (ch >= '0' && ch <= '9') return (ch - '0'); /* Handle numerals */ @@ -2822,7 +2822,7 @@ UCHAR BtoH(STRING ch) } /* */ -/* FUNCTION: AtoH(char *, UCHAR *, int) */ +/* FUNCTION: AtoH(char *, u8 *, int) */ /* */ /* PURPOSE: Converts ascii string to network order hex */ /* */ @@ -2838,13 +2838,13 @@ UCHAR BtoH(STRING ch) /* */ /* IRQL = PASSIVE_LEVEL */ -void AtoH(PSTRING src, PUCHAR dest, int destlen) +void AtoH(char *src, u8 *dest, int destlen) { - PSTRING srcptr; - PUCHAR destTemp; + char *srcptr; + u8 *destTemp; srcptr = src; - destTemp = (PUCHAR) dest; + destTemp = (u8 *)dest; while (destlen--) { *destTemp = BtoH(*srcptr++) << 4; /* Put 1st ascii byte in upper nibble. */ @@ -2875,9 +2875,9 @@ void AtoH(PSTRING src, PUCHAR dest, int destlen) ======================================================================== */ -VOID RTMPInitTimer(IN PRTMP_ADAPTER pAd, +void RTMPInitTimer(IN PRTMP_ADAPTER pAd, IN PRALINK_TIMER_STRUCT pTimer, - IN PVOID pTimerFunc, IN PVOID pData, IN BOOLEAN Repeat) + void *pTimerFunc, void *pData, IN BOOLEAN Repeat) { /* */ /* Set Valid to TRUE for later used. */ @@ -2888,13 +2888,13 @@ VOID RTMPInitTimer(IN PRTMP_ADAPTER pAd, pTimer->PeriodicType = Repeat; pTimer->State = FALSE; - pTimer->cookie = (ULONG) pData; + pTimer->cookie = (unsigned long)pData; #ifdef RTMP_TIMER_TASK_SUPPORT pTimer->pAd = pAd; #endif /* RTMP_TIMER_TASK_SUPPORT // */ - RTMP_OS_Init_Timer(pAd, &pTimer->TimerObj, pTimerFunc, (PVOID) pTimer); + RTMP_OS_Init_Timer(pAd, &pTimer->TimerObj, pTimerFunc, (void *)pTimer); } /* @@ -2915,7 +2915,7 @@ VOID RTMPInitTimer(IN PRTMP_ADAPTER pAd, ======================================================================== */ -VOID RTMPSetTimer(IN PRALINK_TIMER_STRUCT pTimer, IN ULONG Value) +void RTMPSetTimer(IN PRALINK_TIMER_STRUCT pTimer, unsigned long Value) { if (pTimer->Valid) { pTimer->TimerValue = Value; @@ -2950,7 +2950,7 @@ VOID RTMPSetTimer(IN PRALINK_TIMER_STRUCT pTimer, IN ULONG Value) ======================================================================== */ -VOID RTMPModTimer(IN PRALINK_TIMER_STRUCT pTimer, IN ULONG Value) +void RTMPModTimer(IN PRALINK_TIMER_STRUCT pTimer, unsigned long Value) { BOOLEAN Cancel; @@ -2989,7 +2989,7 @@ VOID RTMPModTimer(IN PRALINK_TIMER_STRUCT pTimer, IN ULONG Value) ======================================================================== */ -VOID RTMPCancelTimer(IN PRALINK_TIMER_STRUCT pTimer, OUT BOOLEAN * pCancelled) +void RTMPCancelTimer(IN PRALINK_TIMER_STRUCT pTimer, OUT BOOLEAN * pCancelled) { if (pTimer->Valid) { if (pTimer->State == FALSE) @@ -3030,11 +3030,11 @@ VOID RTMPCancelTimer(IN PRALINK_TIMER_STRUCT pTimer, OUT BOOLEAN * pCancelled) ======================================================================== */ -VOID RTMPSetLED(IN PRTMP_ADAPTER pAd, IN UCHAR Status) +void RTMPSetLED(IN PRTMP_ADAPTER pAd, u8 Status) { - /*ULONG data; */ - UCHAR HighByte = 0; - UCHAR LowByte; + /*unsigned long data; */ + u8 HighByte = 0; + u8 LowByte; LowByte = pAd->LedCntl.field.LedMode & 0x7f; switch (Status) { @@ -3117,9 +3117,9 @@ VOID RTMPSetLED(IN PRTMP_ADAPTER pAd, IN UCHAR Status) > -57 Excellent ======================================================================== */ -VOID RTMPSetSignalLED(IN PRTMP_ADAPTER pAd, IN NDIS_802_11_RSSI Dbm) +void RTMPSetSignalLED(IN PRTMP_ADAPTER pAd, IN NDIS_802_11_RSSI Dbm) { - UCHAR nLed = 0; + u8 nLed = 0; if (pAd->LedCntl.field.LedMode == LED_MODE_SIGNAL_STREGTH) { if (Dbm <= -90) @@ -3164,11 +3164,11 @@ VOID RTMPSetSignalLED(IN PRTMP_ADAPTER pAd, IN NDIS_802_11_RSSI Dbm) Before Enable RX, make sure you have enabled Interrupt. ======================================================================== */ -VOID RTMPEnableRxTx(IN PRTMP_ADAPTER pAd) +void RTMPEnableRxTx(IN PRTMP_ADAPTER pAd) { /* WPDMA_GLO_CFG_STRUC GloCfg; */ -/* ULONG i = 0; */ - UINT32 rx_filter_flag; +/* unsigned long i = 0; */ + u32 rx_filter_flag; DBGPRINT(RT_DEBUG_TRACE, ("==> RTMPEnableRxTx\n")); @@ -3199,12 +3199,12 @@ void CfgInitHook(PRTMP_ADAPTER pAd) } int rt28xx_init(IN PRTMP_ADAPTER pAd, - IN PSTRING pDefaultMac, IN PSTRING pHostName) + char *pDefaultMac, char *pHostName) { - UINT index; - UCHAR TmpPhy; - NDIS_STATUS Status; - UINT32 MacCsr0 = 0; + u32 index; + u8 TmpPhy; + int Status; + u32 MacCsr0 = 0; #ifdef RTMP_MAC_PCI { @@ -3346,20 +3346,20 @@ int rt28xx_init(IN PRTMP_ADAPTER pAd, /*Init Ba Capability parameters. */ /* RT28XX_BA_INIT(pAd); */ pAd->CommonCfg.DesiredHtPhy.MpduDensity = - (UCHAR) pAd->CommonCfg.BACapability.field.MpduDensity; + (u8)pAd->CommonCfg.BACapability.field.MpduDensity; pAd->CommonCfg.DesiredHtPhy.AmsduEnable = - (USHORT) pAd->CommonCfg.BACapability.field.AmsduEnable; + (u16)pAd->CommonCfg.BACapability.field.AmsduEnable; pAd->CommonCfg.DesiredHtPhy.AmsduSize = - (USHORT) pAd->CommonCfg.BACapability.field.AmsduSize; + (u16)pAd->CommonCfg.BACapability.field.AmsduSize; pAd->CommonCfg.DesiredHtPhy.MimoPs = - (USHORT) pAd->CommonCfg.BACapability.field.MMPSmode; + (u16)pAd->CommonCfg.BACapability.field.MMPSmode; /* UPdata to HT IE */ pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = - (USHORT) pAd->CommonCfg.BACapability.field.MMPSmode; + (u16)pAd->CommonCfg.BACapability.field.MMPSmode; pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = - (USHORT) pAd->CommonCfg.BACapability.field.AmsduSize; + (u16)pAd->CommonCfg.BACapability.field.AmsduSize; pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = - (UCHAR) pAd->CommonCfg.BACapability.field.MpduDensity; + (u8)pAd->CommonCfg.BACapability.field.MpduDensity; /* after reading Registry, we now know if in AP mode or STA mode */ @@ -3371,7 +3371,7 @@ int rt28xx_init(IN PRTMP_ADAPTER pAd, DBGPRINT(RT_DEBUG_OFF, ("2. Phy Mode = %d\n", pAd->CommonCfg.PhyMode)); /* We should read EEPROM for all cases. rt2860b */ - NICReadEEPROMParameters(pAd, (PUCHAR) pDefaultMac); + NICReadEEPROMParameters(pAd, (u8 *)pDefaultMac); DBGPRINT(RT_DEBUG_OFF, ("3. Phy Mode = %d\n", pAd->CommonCfg.PhyMode)); @@ -3476,7 +3476,7 @@ err0: /*---Add by shiang, move from os/linux/rt_main_dev.c */ -static INT RtmpChipOpsRegister(IN RTMP_ADAPTER * pAd, IN INT infType) +static int RtmpChipOpsRegister(IN RTMP_ADAPTER * pAd, int infType) { RTMP_CHIP_OP *pChipOps = &pAd->chipOps; int status; @@ -3508,9 +3508,9 @@ static INT RtmpChipOpsRegister(IN RTMP_ADAPTER * pAd, IN INT infType) return status; } -INT RtmpRaDevCtrlInit(IN RTMP_ADAPTER * pAd, IN RTMP_INF_TYPE infType) +int RtmpRaDevCtrlInit(IN RTMP_ADAPTER * pAd, IN RTMP_INF_TYPE infType) { - /*VOID *handle; */ + /*void *handle; */ /* Assign the interface type. We need use it when do register/EEPROM access. */ pAd->infType = infType; @@ -3521,7 +3521,7 @@ INT RtmpRaDevCtrlInit(IN RTMP_ADAPTER * pAd, IN RTMP_INF_TYPE infType) #ifdef RTMP_MAC_USB init_MUTEX(&(pAd->UsbVendorReq_semaphore)); - os_alloc_mem(pAd, (PUCHAR *) & pAd->UsbVendorReqBuf, + os_alloc_mem(pAd, (u8 **) & pAd->UsbVendorReqBuf, MAX_PARAM_BUFFER_SIZE - 1); if (pAd->UsbVendorReqBuf == NULL) { DBGPRINT(RT_DEBUG_ERROR, @@ -3544,7 +3544,7 @@ BOOLEAN RtmpRaDevCtrlExit(IN RTMP_ADAPTER * pAd) } /* not yet support MBSS */ -PNET_DEV get_netdev_from_bssid(IN PRTMP_ADAPTER pAd, IN UCHAR FromWhichBSSID) +PNET_DEV get_netdev_from_bssid(IN PRTMP_ADAPTER pAd, u8 FromWhichBSSID) { PNET_DEV dev_p = NULL; diff --git a/drivers/staging/rt2860/common/rtmp_mcu.c b/drivers/staging/rt2860/common/rtmp_mcu.c index 09d46f779db9..3d695278afea 100644 --- a/drivers/staging/rt2860/common/rtmp_mcu.c +++ b/drivers/staging/rt2860/common/rtmp_mcu.c @@ -57,7 +57,7 @@ /* New 8k byte firmware size for RT3071/RT3072 */ #define FIRMWAREIMAGE_MAX_LENGTH 0x2000 -#define FIRMWAREIMAGE_LENGTH (sizeof (FirmwareImage) / sizeof(UCHAR)) +#define FIRMWAREIMAGE_LENGTH (sizeof (FirmwareImage) / sizeof(u8)) #define FIRMWARE_MAJOR_VERSION 0 #define FIRMWAREIMAGEV1_LENGTH 0x1000 @@ -80,9 +80,9 @@ ======================================================================== */ -INT RtmpAsicEraseFirmware(IN PRTMP_ADAPTER pAd) +int RtmpAsicEraseFirmware(IN PRTMP_ADAPTER pAd) { - ULONG i; + unsigned long i; for (i = 0; i < MAX_FIRMWARE_IMAGE_SIZE; i += 4) RTMP_IO_WRITE32(pAd, FIRMWARE_IMAGE_BASE + i, 0); @@ -107,15 +107,15 @@ INT RtmpAsicEraseFirmware(IN PRTMP_ADAPTER pAd) ======================================================================== */ -NDIS_STATUS RtmpAsicLoadFirmware(IN PRTMP_ADAPTER pAd) +int RtmpAsicLoadFirmware(IN PRTMP_ADAPTER pAd) { - NDIS_STATUS Status = NDIS_STATUS_SUCCESS; - PUCHAR pFirmwareImage = NULL; - ULONG FileLength, Index; - UINT32 MacReg = 0; + int Status = NDIS_STATUS_SUCCESS; + u8 *pFirmwareImage = NULL; + unsigned long FileLength, Index; + u32 MacReg = 0; #ifdef RTMP_MAC_USB - UINT32 Version = (pAd->MACVersion >> 16); + u32 Version = (pAd->MACVersion >> 16); #endif /* New 8k byte firmware size for RT3071/RT3072 */ @@ -134,7 +134,7 @@ NDIS_STATUS RtmpAsicLoadFirmware(IN PRTMP_ADAPTER pAd) if ((Version != 0x2860) && (Version != 0x2872) && (Version != 0x3070)) { /* use the second part */ /*printk("KH:Use New Version,part2\n"); */ pFirmwareImage = - (PUCHAR) & + (u8 *)& FirmwareImage_3070[FIRMWAREIMAGEV1_LENGTH]; FileLength = FIRMWAREIMAGEV2_LENGTH; } else { @@ -172,13 +172,13 @@ NDIS_STATUS RtmpAsicLoadFirmware(IN PRTMP_ADAPTER pAd) return Status; } -INT RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, - IN UCHAR Command, - IN UCHAR Token, IN UCHAR Arg0, IN UCHAR Arg1) +int RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, + u8 Command, + u8 Token, u8 Arg0, u8 Arg1) { HOST_CMD_CSR_STRUC H2MCmd; H2M_MAILBOX_STRUC H2MMailbox; - ULONG i = 0; + unsigned long i = 0; #ifdef PCIE_PS_SUPPORT /* 3090F power solution 3 has hw limitation that needs to ban all mcu command */ diff --git a/drivers/staging/rt2860/common/rtmp_timer.c b/drivers/staging/rt2860/common/rtmp_timer.c index d29e6e8775e8..d5648d8967d9 100644 --- a/drivers/staging/rt2860/common/rtmp_timer.c +++ b/drivers/staging/rt2860/common/rtmp_timer.c @@ -67,9 +67,9 @@ BUILD_TIMER_FUNCTION(RtmpUsbStaAsicForceWakeupTimeout); #endif /* RTMP_MAC_USB // */ #if defined(AP_LED) || defined(STA_LED) -extern void LedCtrlMain(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +extern void LedCtrlMain(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3); BUILD_TIMER_FUNCTION(LedCtrlMain); #endif @@ -119,7 +119,7 @@ static void RtmpTimerQHandle(RTMP_ADAPTER * pAd) if ((pTimer->handle != NULL) && (!pAd->PM_FlgSuspend)) pTimer->handle(NULL, - (PVOID) pTimer->cookie, + (void *)pTimer->cookie, NULL, pTimer); if ((pTimer->Repeat) && (pTimer->State == FALSE)) @@ -138,7 +138,7 @@ static void RtmpTimerQHandle(RTMP_ADAPTER * pAd) } } -INT RtmpTimerQThread(IN OUT PVOID Context) +int RtmpTimerQThread(IN void *Context) { RTMP_OS_TASK *pTask; PRTMP_ADAPTER pAd; diff --git a/drivers/staging/rt2860/common/spectrum.c b/drivers/staging/rt2860/common/spectrum.c index 2cc73de092d0..b89ad5f5a462 100644 --- a/drivers/staging/rt2860/common/spectrum.c +++ b/drivers/staging/rt2860/common/spectrum.c @@ -261,23 +261,23 @@ DOT11_REGULATORY_INFORMATION JapanRegulatoryInfo[] = { #define JP_REGULATORY_INFO_SIZE (sizeof(JapanRegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION)) -CHAR RTMP_GetTxPwr(IN PRTMP_ADAPTER pAd, IN HTTRANSMIT_SETTING HTTxMode) +char RTMP_GetTxPwr(IN PRTMP_ADAPTER pAd, IN HTTRANSMIT_SETTING HTTxMode) { typedef struct __TX_PWR_CFG { - UINT8 Mode; - UINT8 MCS; - UINT16 req; - UINT8 shift; - UINT32 BitMask; + u8 Mode; + u8 MCS; + u16 req; + u8 shift; + u32 BitMask; } TX_PWR_CFG; - UINT32 Value; - INT Idx; - UINT8 PhyMode; - CHAR CurTxPwr; - UINT8 TxPwrRef = 0; - CHAR DaltaPwr; - ULONG TxPwr[5]; + u32 Value; + int Idx; + u8 PhyMode; + char CurTxPwr; + u8 TxPwrRef = 0; + char DaltaPwr; + unsigned long TxPwr[5]; TX_PWR_CFG TxPwrCfg[] = { {MODE_CCK, 0, 0, 4, 0x000000f0}, @@ -385,7 +385,7 @@ CHAR RTMP_GetTxPwr(IN PRTMP_ADAPTER pAd, IN HTTRANSMIT_SETTING HTTxMode) && (TxPwrCfg[Idx].MCS == HTTxMode.field.MCS)) { Value = TxPwr[TxPwrCfg[Idx].req]; DaltaPwr = - TxPwrRef - (CHAR) ((Value & TxPwrCfg[Idx].BitMask) + TxPwrRef - (char)((Value & TxPwrCfg[Idx].BitMask) >> TxPwrCfg[Idx].shift); CurTxPwr -= DaltaPwr; break; @@ -395,7 +395,7 @@ CHAR RTMP_GetTxPwr(IN PRTMP_ADAPTER pAd, IN HTTRANSMIT_SETTING HTTxMode) return CurTxPwr; } -VOID MeasureReqTabInit(IN PRTMP_ADAPTER pAd) +void MeasureReqTabInit(IN PRTMP_ADAPTER pAd) { NdisAllocateSpinLock(&pAd->CommonCfg.MeasureReqTabLock); @@ -412,7 +412,7 @@ VOID MeasureReqTabInit(IN PRTMP_ADAPTER pAd) return; } -VOID MeasureReqTabExit(IN PRTMP_ADAPTER pAd) +void MeasureReqTabExit(IN PRTMP_ADAPTER pAd) { NdisFreeSpinLock(&pAd->CommonCfg.MeasureReqTabLock); @@ -423,9 +423,9 @@ VOID MeasureReqTabExit(IN PRTMP_ADAPTER pAd) return; } -PMEASURE_REQ_ENTRY MeasureReqLookUp(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) +PMEASURE_REQ_ENTRY MeasureReqLookUp(IN PRTMP_ADAPTER pAd, u8 DialogToken) { - UINT HashIdx; + u32 HashIdx; PMEASURE_REQ_TAB pTab = pAd->CommonCfg.pMeasureReqTab; PMEASURE_REQ_ENTRY pEntry = NULL; PMEASURE_REQ_ENTRY pPrevEntry = NULL; @@ -455,13 +455,13 @@ PMEASURE_REQ_ENTRY MeasureReqLookUp(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) return pEntry; } -PMEASURE_REQ_ENTRY MeasureReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) +PMEASURE_REQ_ENTRY MeasureReqInsert(IN PRTMP_ADAPTER pAd, u8 DialogToken) { - INT i; - ULONG HashIdx; + int i; + unsigned long HashIdx; PMEASURE_REQ_TAB pTab = pAd->CommonCfg.pMeasureReqTab; PMEASURE_REQ_ENTRY pEntry = NULL, pCurrEntry; - ULONG Now; + unsigned long Now; if (pTab == NULL) { DBGPRINT(RT_DEBUG_ERROR, @@ -483,7 +483,7 @@ PMEASURE_REQ_ENTRY MeasureReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) MQ_REQ_AGE_OUT))) { PMEASURE_REQ_ENTRY pPrevEntry = NULL; - ULONG HashIdx = + unsigned long HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(pEntry-> DialogToken); PMEASURE_REQ_ENTRY pProbeEntry = @@ -548,7 +548,7 @@ PMEASURE_REQ_ENTRY MeasureReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) return pEntry; } -VOID MeasureReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) +void MeasureReqDelete(IN PRTMP_ADAPTER pAd, u8 DialogToken) { PMEASURE_REQ_TAB pTab = pAd->CommonCfg.pMeasureReqTab; PMEASURE_REQ_ENTRY pEntry = NULL; @@ -567,7 +567,7 @@ VOID MeasureReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) pEntry = MeasureReqLookUp(pAd, DialogToken); if (pEntry != NULL) { PMEASURE_REQ_ENTRY pPrevEntry = NULL; - ULONG HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(pEntry->DialogToken); + unsigned long HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(pEntry->DialogToken); PMEASURE_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx]; RTMP_SEM_LOCK(&pAd->CommonCfg.MeasureReqTabLock); @@ -595,7 +595,7 @@ VOID MeasureReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) return; } -VOID TpcReqTabInit(IN PRTMP_ADAPTER pAd) +void TpcReqTabInit(IN PRTMP_ADAPTER pAd) { NdisAllocateSpinLock(&pAd->CommonCfg.TpcReqTabLock); @@ -610,7 +610,7 @@ VOID TpcReqTabInit(IN PRTMP_ADAPTER pAd) return; } -VOID TpcReqTabExit(IN PRTMP_ADAPTER pAd) +void TpcReqTabExit(IN PRTMP_ADAPTER pAd) { NdisFreeSpinLock(&pAd->CommonCfg.TpcReqTabLock); @@ -621,9 +621,9 @@ VOID TpcReqTabExit(IN PRTMP_ADAPTER pAd) return; } -static PTPC_REQ_ENTRY TpcReqLookUp(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) +static PTPC_REQ_ENTRY TpcReqLookUp(IN PRTMP_ADAPTER pAd, u8 DialogToken) { - UINT HashIdx; + u32 HashIdx; PTPC_REQ_TAB pTab = pAd->CommonCfg.pTpcReqTab; PTPC_REQ_ENTRY pEntry = NULL; PTPC_REQ_ENTRY pPrevEntry = NULL; @@ -653,13 +653,13 @@ static PTPC_REQ_ENTRY TpcReqLookUp(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) return pEntry; } -static PTPC_REQ_ENTRY TpcReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) +static PTPC_REQ_ENTRY TpcReqInsert(IN PRTMP_ADAPTER pAd, u8 DialogToken) { - INT i; - ULONG HashIdx; + int i; + unsigned long HashIdx; PTPC_REQ_TAB pTab = pAd->CommonCfg.pTpcReqTab; PTPC_REQ_ENTRY pEntry = NULL, pCurrEntry; - ULONG Now; + unsigned long Now; if (pTab == NULL) { DBGPRINT(RT_DEBUG_ERROR, @@ -681,7 +681,7 @@ static PTPC_REQ_ENTRY TpcReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) TPC_REQ_AGE_OUT))) { PTPC_REQ_ENTRY pPrevEntry = NULL; - ULONG HashIdx = + unsigned long HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(pEntry-> DialogToken); PTPC_REQ_ENTRY pProbeEntry = @@ -745,7 +745,7 @@ static PTPC_REQ_ENTRY TpcReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) return pEntry; } -static VOID TpcReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) +static void TpcReqDelete(IN PRTMP_ADAPTER pAd, u8 DialogToken) { PTPC_REQ_TAB pTab = pAd->CommonCfg.pTpcReqTab; PTPC_REQ_ENTRY pEntry = NULL; @@ -764,7 +764,7 @@ static VOID TpcReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) pEntry = TpcReqLookUp(pAd, DialogToken); if (pEntry != NULL) { PTPC_REQ_ENTRY pPrevEntry = NULL; - ULONG HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(pEntry->DialogToken); + unsigned long HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(pEntry->DialogToken); PTPC_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx]; RTMP_SEM_LOCK(&pAd->CommonCfg.TpcReqTabLock); @@ -802,7 +802,7 @@ static VOID TpcReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken) Return : Current Time Stamp. ========================================================================== */ -static UINT64 GetCurrentTimeStamp(IN PRTMP_ADAPTER pAd) +static u64 GetCurrentTimeStamp(IN PRTMP_ADAPTER pAd) { /* get current time stamp. */ return 0; @@ -818,7 +818,7 @@ static UINT64 GetCurrentTimeStamp(IN PRTMP_ADAPTER pAd) Return : Current Time Stamp. ========================================================================== */ -static UINT8 GetCurTxPwr(IN PRTMP_ADAPTER pAd, IN UINT8 Wcid) +static u8 GetCurTxPwr(IN PRTMP_ADAPTER pAd, u8 Wcid) { return 16; /* 16 dBm */ } @@ -833,15 +833,15 @@ static UINT8 GetCurTxPwr(IN PRTMP_ADAPTER pAd, IN UINT8 Wcid) Return : Current Time Stamp. ========================================================================== */ -VOID InsertChannelRepIE(IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN PSTRING pCountry, IN UINT8 RegulatoryClass) +void InsertChannelRepIE(IN PRTMP_ADAPTER pAd, + u8 *pFrameBuf, + unsigned long *pFrameLen, + char *pCountry, u8 RegulatoryClass) { - ULONG TempLen; - UINT8 Len; - UINT8 IEId = IE_AP_CHANNEL_REPORT; - PUCHAR pChListPtr = NULL; + unsigned long TempLen; + u8 Len; + u8 IEId = IE_AP_CHANNEL_REPORT; + u8 *pChListPtr = NULL; Len = 1; if (strncmp(pCountry, "US", 2) == 0) { @@ -900,11 +900,11 @@ VOID InsertChannelRepIE(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -VOID InsertDialogToken(IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, IN UINT8 DialogToken) +void InsertDialogToken(IN PRTMP_ADAPTER pAd, + u8 *pFrameBuf, + unsigned long *pFrameLen, u8 DialogToken) { - ULONG TempLen; + unsigned long TempLen; MakeOutgoingFrame(pFrameBuf, &TempLen, 1, &DialogToken, END_OF_ARGS); *pFrameLen = *pFrameLen + TempLen; @@ -924,12 +924,12 @@ VOID InsertDialogToken(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -static VOID InsertTpcReqIE(IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, OUT PULONG pFrameLen) +static void InsertTpcReqIE(IN PRTMP_ADAPTER pAd, + u8 *pFrameBuf, unsigned long *pFrameLen) { - ULONG TempLen; - ULONG Len = 0; - UINT8 ElementID = IE_TPC_REQUEST; + unsigned long TempLen; + unsigned long Len = 0; + u8 ElementID = IE_TPC_REQUEST; MakeOutgoingFrame(pFrameBuf, &TempLen, 1, &ElementID, 1, &Len, END_OF_ARGS); @@ -953,14 +953,14 @@ static VOID InsertTpcReqIE(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -VOID InsertTpcReportIE(IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 TxPwr, IN UINT8 LinkMargin) +void InsertTpcReportIE(IN PRTMP_ADAPTER pAd, + u8 *pFrameBuf, + unsigned long *pFrameLen, + u8 TxPwr, u8 LinkMargin) { - ULONG TempLen; - ULONG Len = sizeof(TPC_REPORT_INFO); - UINT8 ElementID = IE_TPC_REPORT; + unsigned long TempLen; + unsigned long Len = sizeof(TPC_REPORT_INFO); + u8 ElementID = IE_TPC_REPORT; TPC_REPORT_INFO TpcReportIE; TpcReportIE.TxPwr = TxPwr; @@ -990,15 +990,15 @@ VOID InsertTpcReportIE(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -static VOID InsertChSwAnnIE(IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 ChSwMode, - IN UINT8 NewChannel, IN UINT8 ChSwCnt) +static void InsertChSwAnnIE(IN PRTMP_ADAPTER pAd, + u8 *pFrameBuf, + unsigned long *pFrameLen, + u8 ChSwMode, + u8 NewChannel, u8 ChSwCnt) { - ULONG TempLen; - ULONG Len = sizeof(CH_SW_ANN_INFO); - UINT8 ElementID = IE_CHANNEL_SWITCH_ANNOUNCEMENT; + unsigned long TempLen; + unsigned long Len = sizeof(CH_SW_ANN_INFO); + u8 ElementID = IE_CHANNEL_SWITCH_ANNOUNCEMENT; CH_SW_ANN_INFO ChSwAnnIE; ChSwAnnIE.ChSwMode = ChSwMode; @@ -1031,13 +1031,13 @@ static VOID InsertChSwAnnIE(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -static VOID InsertMeasureReqIE(IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 Len, IN PMEASURE_REQ_INFO pMeasureReqIE) +static void InsertMeasureReqIE(IN PRTMP_ADAPTER pAd, + u8 *pFrameBuf, + unsigned long *pFrameLen, + u8 Len, IN PMEASURE_REQ_INFO pMeasureReqIE) { - ULONG TempLen; - UINT8 ElementID = IE_MEASUREMENT_REQUEST; + unsigned long TempLen; + u8 ElementID = IE_MEASUREMENT_REQUEST; MakeOutgoingFrame(pFrameBuf, &TempLen, 1, &ElementID, @@ -1066,15 +1066,15 @@ static VOID InsertMeasureReqIE(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -static VOID InsertMeasureReportIE(IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, +static void InsertMeasureReportIE(IN PRTMP_ADAPTER pAd, + u8 *pFrameBuf, + unsigned long *pFrameLen, IN PMEASURE_REPORT_INFO pMeasureReportIE, - IN UINT8 ReportLnfoLen, IN PUINT8 pReportInfo) + u8 ReportLnfoLen, u8 *pReportInfo) { - ULONG TempLen; - ULONG Len; - UINT8 ElementID = IE_MEASUREMENT_REPORT; + unsigned long TempLen; + unsigned long Len; + u8 ElementID = IE_MEASUREMENT_REPORT; Len = sizeof(MEASURE_REPORT_INFO) + ReportLnfoLen; @@ -1105,17 +1105,17 @@ static VOID InsertMeasureReportIE(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -VOID MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd, - OUT PUCHAR pOutBuffer, - OUT PULONG pFrameLen, - IN UINT8 TotalLen, - IN UINT8 Category, - IN UINT8 Action, - IN UINT8 MeasureToken, - IN UINT8 MeasureReqMode, - IN UINT8 MeasureReqType, IN UINT8 NumOfRepetitions) +void MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd, + u8 *pOutBuffer, + unsigned long *pFrameLen, + u8 TotalLen, + u8 Category, + u8 Action, + u8 MeasureToken, + u8 MeasureReqMode, + u8 MeasureReqType, u8 NumOfRepetitions) { - ULONG TempLen; + unsigned long TempLen; MEASURE_REQ_INFO MeasureReqIE; InsertActField(pAd, (pOutBuffer + *pFrameLen), pFrameLen, Category, @@ -1155,17 +1155,17 @@ VOID MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -VOID EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UINT8 DialogToken, - IN UINT8 MeasureToken, - IN UINT8 MeasureReqMode, - IN UINT8 MeasureReqType, - IN UINT8 ReportInfoLen, IN PUINT8 pReportInfo) +void EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd, + u8 *pDA, + u8 DialogToken, + u8 MeasureToken, + u8 MeasureReqMode, + u8 MeasureReqType, + u8 ReportInfoLen, u8 *pReportInfo) { - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen; + u8 *pOutBuffer = NULL; + int NStatus; + unsigned long FrameLen; HEADER_802_11 ActHdr; MEASURE_REPORT_INFO MeasureRepIE; @@ -1173,13 +1173,13 @@ VOID EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd, MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, pAd->CurrentAddress); - NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); /*Get an unused nonpaged memory */ + NStatus = MlmeAllocateMemory(pAd, (void *)& pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__)); return; } - NdisMoveMemory(pOutBuffer, (PCHAR) & ActHdr, sizeof(HEADER_802_11)); + NdisMoveMemory(pOutBuffer, (char *)& ActHdr, sizeof(HEADER_802_11)); FrameLen = sizeof(HEADER_802_11); InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, @@ -1214,11 +1214,11 @@ VOID EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -VOID EnqueueTPCReq(IN PRTMP_ADAPTER pAd, IN PUCHAR pDA, IN UCHAR DialogToken) +void EnqueueTPCReq(IN PRTMP_ADAPTER pAd, u8 *pDA, u8 DialogToken) { - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen; + u8 *pOutBuffer = NULL; + int NStatus; + unsigned long FrameLen; HEADER_802_11 ActHdr; @@ -1226,13 +1226,13 @@ VOID EnqueueTPCReq(IN PRTMP_ADAPTER pAd, IN PUCHAR pDA, IN UCHAR DialogToken) MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, pAd->CurrentAddress); - NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); /*Get an unused nonpaged memory */ + NStatus = MlmeAllocateMemory(pAd, (void *)& pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__)); return; } - NdisMoveMemory(pOutBuffer, (PCHAR) & ActHdr, sizeof(HEADER_802_11)); + NdisMoveMemory(pOutBuffer, (char *)& ActHdr, sizeof(HEADER_802_11)); FrameLen = sizeof(HEADER_802_11); InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, @@ -1262,13 +1262,13 @@ VOID EnqueueTPCReq(IN PRTMP_ADAPTER pAd, IN PUCHAR pDA, IN UCHAR DialogToken) Return : None. ========================================================================== */ -VOID EnqueueTPCRep(IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UINT8 DialogToken, IN UINT8 TxPwr, IN UINT8 LinkMargin) +void EnqueueTPCRep(IN PRTMP_ADAPTER pAd, + u8 *pDA, + u8 DialogToken, u8 TxPwr, u8 LinkMargin) { - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen; + u8 *pOutBuffer = NULL; + int NStatus; + unsigned long FrameLen; HEADER_802_11 ActHdr; @@ -1276,13 +1276,13 @@ VOID EnqueueTPCRep(IN PRTMP_ADAPTER pAd, MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, pAd->CurrentAddress); - NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); /*Get an unused nonpaged memory */ + NStatus = MlmeAllocateMemory(pAd, (void *)& pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__)); return; } - NdisMoveMemory(pOutBuffer, (PCHAR) & ActHdr, sizeof(HEADER_802_11)); + NdisMoveMemory(pOutBuffer, (char *)& ActHdr, sizeof(HEADER_802_11)); FrameLen = sizeof(HEADER_802_11); InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, @@ -1315,12 +1315,12 @@ VOID EnqueueTPCRep(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -VOID EnqueueChSwAnn(IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, IN UINT8 ChSwMode, IN UINT8 NewCh) +void EnqueueChSwAnn(IN PRTMP_ADAPTER pAd, + u8 *pDA, u8 ChSwMode, u8 NewCh) { - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen; + u8 *pOutBuffer = NULL; + int NStatus; + unsigned long FrameLen; HEADER_802_11 ActHdr; @@ -1328,13 +1328,13 @@ VOID EnqueueChSwAnn(IN PRTMP_ADAPTER pAd, MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, pAd->CurrentAddress); - NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); /*Get an unused nonpaged memory */ + NStatus = MlmeAllocateMemory(pAd, (void *)& pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__)); return; } - NdisMoveMemory(pOutBuffer, (PCHAR) & ActHdr, sizeof(HEADER_802_11)); + NdisMoveMemory(pOutBuffer, (char *)& ActHdr, sizeof(HEADER_802_11)); FrameLen = sizeof(HEADER_802_11); InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, @@ -1349,10 +1349,10 @@ VOID EnqueueChSwAnn(IN PRTMP_ADAPTER pAd, return; } -static BOOLEAN DfsRequirementCheck(IN PRTMP_ADAPTER pAd, IN UINT8 Channel) +static BOOLEAN DfsRequirementCheck(IN PRTMP_ADAPTER pAd, u8 Channel) { BOOLEAN Result = FALSE; - INT i; + int i; do { /* check DFS procedure is running. */ @@ -1376,14 +1376,14 @@ static BOOLEAN DfsRequirementCheck(IN PRTMP_ADAPTER pAd, IN UINT8 Channel) return Result; } -VOID NotifyChSwAnnToPeerAPs(IN PRTMP_ADAPTER pAd, - IN PUCHAR pRA, - IN PUCHAR pTA, IN UINT8 ChSwMode, IN UINT8 Channel) +void NotifyChSwAnnToPeerAPs(IN PRTMP_ADAPTER pAd, + u8 *pRA, + u8 *pTA, u8 ChSwMode, u8 Channel) { } -static VOID StartDFSProcedure(IN PRTMP_ADAPTER pAd, - IN UCHAR Channel, IN UINT8 ChSwMode) +static void StartDFSProcedure(IN PRTMP_ADAPTER pAd, + u8 Channel, u8 ChSwMode) { /* start DFS procedure */ pAd->CommonCfg.Channel = Channel; @@ -1416,12 +1416,12 @@ static VOID StartDFSProcedure(IN PRTMP_ADAPTER pAd, 1 1 1 1 1 */ static BOOLEAN PeerChSwAnnSanity(IN PRTMP_ADAPTER pAd, - IN VOID * pMsg, - IN ULONG MsgLen, + void * pMsg, + unsigned long MsgLen, OUT PCH_SW_ANN_INFO pChSwAnnInfo) { PFRAME_802_11 Fr = (PFRAME_802_11) pMsg; - PUCHAR pFramePtr = Fr->Octet; + u8 *pFramePtr = Fr->Octet; BOOLEAN result = FALSE; PEID_STRUCT eid_ptr; @@ -1436,8 +1436,8 @@ static BOOLEAN PeerChSwAnnSanity(IN PRTMP_ADAPTER pAd, return result; eid_ptr = (PEID_STRUCT) pFramePtr; - while (((UCHAR *) eid_ptr + eid_ptr->Len + 1) < - ((PUCHAR) pFramePtr + MsgLen)) { + while (((u8 *) eid_ptr + eid_ptr->Len + 1) < + ((u8 *)pFramePtr + MsgLen)) { switch (eid_ptr->Eid) { case IE_CHANNEL_SWITCH_ANNOUNCEMENT: NdisMoveMemory(&pChSwAnnInfo->ChSwMode, eid_ptr->Octet, @@ -1453,7 +1453,7 @@ static BOOLEAN PeerChSwAnnSanity(IN PRTMP_ADAPTER pAd, default: break; } - eid_ptr = (PEID_STRUCT) ((UCHAR *) eid_ptr + 2 + eid_ptr->Len); + eid_ptr = (PEID_STRUCT) ((u8 *) eid_ptr + 2 + eid_ptr->Len); } return result; @@ -1473,19 +1473,19 @@ static BOOLEAN PeerChSwAnnSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ static BOOLEAN PeerMeasureReqSanity(IN PRTMP_ADAPTER pAd, - IN VOID * pMsg, - IN ULONG MsgLen, - OUT PUINT8 pDialogToken, + void * pMsg, + unsigned long MsgLen, + u8 *pDialogToken, OUT PMEASURE_REQ_INFO pMeasureReqInfo, OUT PMEASURE_REQ pMeasureReq) { PFRAME_802_11 Fr = (PFRAME_802_11) pMsg; - PUCHAR pFramePtr = Fr->Octet; + u8 *pFramePtr = Fr->Octet; BOOLEAN result = FALSE; PEID_STRUCT eid_ptr; - PUCHAR ptr; - UINT64 MeasureStartTime; - UINT16 MeasureDuration; + u8 *ptr; + u64 MeasureStartTime; + u16 MeasureDuration; /* skip 802.11 header. */ MsgLen -= sizeof(HEADER_802_11); @@ -1502,8 +1502,8 @@ static BOOLEAN PeerMeasureReqSanity(IN PRTMP_ADAPTER pAd, MsgLen -= 1; eid_ptr = (PEID_STRUCT) pFramePtr; - while (((UCHAR *) eid_ptr + eid_ptr->Len + 1) < - ((PUCHAR) pFramePtr + MsgLen)) { + while (((u8 *) eid_ptr + eid_ptr->Len + 1) < + ((u8 *)pFramePtr + MsgLen)) { switch (eid_ptr->Eid) { case IE_MEASUREMENT_REQUEST: NdisMoveMemory(&pMeasureReqInfo->Token, eid_ptr->Octet, @@ -1512,7 +1512,7 @@ static BOOLEAN PeerMeasureReqSanity(IN PRTMP_ADAPTER pAd, eid_ptr->Octet + 1, 1); NdisMoveMemory(&pMeasureReqInfo->ReqType, eid_ptr->Octet + 2, 1); - ptr = (PUCHAR) (eid_ptr->Octet + 3); + ptr = (u8 *)(eid_ptr->Octet + 3); NdisMoveMemory(&pMeasureReq->ChNum, ptr, 1); NdisMoveMemory(&MeasureStartTime, ptr + 1, 8); pMeasureReq->MeasureStartTime = @@ -1526,7 +1526,7 @@ static BOOLEAN PeerMeasureReqSanity(IN PRTMP_ADAPTER pAd, default: break; } - eid_ptr = (PEID_STRUCT) ((UCHAR *) eid_ptr + 2 + eid_ptr->Len); + eid_ptr = (PEID_STRUCT) ((u8 *) eid_ptr + 2 + eid_ptr->Len); } return result; @@ -1567,18 +1567,18 @@ static BOOLEAN PeerMeasureReqSanity(IN PRTMP_ADAPTER pAd, 0 1 2 3 4 5-7 */ static BOOLEAN PeerMeasureReportSanity(IN PRTMP_ADAPTER pAd, - IN VOID * pMsg, - IN ULONG MsgLen, - OUT PUINT8 pDialogToken, + void * pMsg, + unsigned long MsgLen, + u8 *pDialogToken, OUT PMEASURE_REPORT_INFO pMeasureReportInfo, - OUT PUINT8 pReportBuf) + u8 *pReportBuf) { PFRAME_802_11 Fr = (PFRAME_802_11) pMsg; - PUCHAR pFramePtr = Fr->Octet; + u8 *pFramePtr = Fr->Octet; BOOLEAN result = FALSE; PEID_STRUCT eid_ptr; - PUCHAR ptr; + u8 *ptr; /* skip 802.11 header. */ MsgLen -= sizeof(HEADER_802_11); @@ -1595,8 +1595,8 @@ static BOOLEAN PeerMeasureReportSanity(IN PRTMP_ADAPTER pAd, MsgLen -= 1; eid_ptr = (PEID_STRUCT) pFramePtr; - while (((UCHAR *) eid_ptr + eid_ptr->Len + 1) < - ((PUCHAR) pFramePtr + MsgLen)) { + while (((u8 *) eid_ptr + eid_ptr->Len + 1) < + ((u8 *)pFramePtr + MsgLen)) { switch (eid_ptr->Eid) { case IE_MEASUREMENT_REPORT: NdisMoveMemory(&pMeasureReportInfo->Token, @@ -1608,7 +1608,7 @@ static BOOLEAN PeerMeasureReportSanity(IN PRTMP_ADAPTER pAd, if (pMeasureReportInfo->ReportType == RM_BASIC) { PMEASURE_BASIC_REPORT pReport = (PMEASURE_BASIC_REPORT) pReportBuf; - ptr = (PUCHAR) (eid_ptr->Octet + 3); + ptr = (u8 *)(eid_ptr->Octet + 3); NdisMoveMemory(&pReport->ChNum, ptr, 1); NdisMoveMemory(&pReport->MeasureStartTime, ptr + 1, 8); @@ -1619,7 +1619,7 @@ static BOOLEAN PeerMeasureReportSanity(IN PRTMP_ADAPTER pAd, } else if (pMeasureReportInfo->ReportType == RM_CCA) { PMEASURE_CCA_REPORT pReport = (PMEASURE_CCA_REPORT) pReportBuf; - ptr = (PUCHAR) (eid_ptr->Octet + 3); + ptr = (u8 *)(eid_ptr->Octet + 3); NdisMoveMemory(&pReport->ChNum, ptr, 1); NdisMoveMemory(&pReport->MeasureStartTime, ptr + 1, 8); @@ -1632,7 +1632,7 @@ static BOOLEAN PeerMeasureReportSanity(IN PRTMP_ADAPTER pAd, RM_RPI_HISTOGRAM) { PMEASURE_RPI_REPORT pReport = (PMEASURE_RPI_REPORT) pReportBuf; - ptr = (PUCHAR) (eid_ptr->Octet + 3); + ptr = (u8 *)(eid_ptr->Octet + 3); NdisMoveMemory(&pReport->ChNum, ptr, 1); NdisMoveMemory(&pReport->MeasureStartTime, ptr + 1, 8); @@ -1647,7 +1647,7 @@ static BOOLEAN PeerMeasureReportSanity(IN PRTMP_ADAPTER pAd, default: break; } - eid_ptr = (PEID_STRUCT) ((UCHAR *) eid_ptr + 2 + eid_ptr->Len); + eid_ptr = (PEID_STRUCT) ((u8 *) eid_ptr + 2 + eid_ptr->Len); } return result; @@ -1667,11 +1667,11 @@ static BOOLEAN PeerMeasureReportSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ static BOOLEAN PeerTpcReqSanity(IN PRTMP_ADAPTER pAd, - IN VOID * pMsg, - IN ULONG MsgLen, OUT PUINT8 pDialogToken) + void * pMsg, + unsigned long MsgLen, u8 *pDialogToken) { PFRAME_802_11 Fr = (PFRAME_802_11) pMsg; - PUCHAR pFramePtr = Fr->Octet; + u8 *pFramePtr = Fr->Octet; BOOLEAN result = FALSE; PEID_STRUCT eid_ptr; @@ -1689,8 +1689,8 @@ static BOOLEAN PeerTpcReqSanity(IN PRTMP_ADAPTER pAd, MsgLen -= 1; eid_ptr = (PEID_STRUCT) pFramePtr; - while (((UCHAR *) eid_ptr + eid_ptr->Len + 1) < - ((PUCHAR) pFramePtr + MsgLen)) { + while (((u8 *) eid_ptr + eid_ptr->Len + 1) < + ((u8 *)pFramePtr + MsgLen)) { switch (eid_ptr->Eid) { case IE_TPC_REQUEST: result = TRUE; @@ -1699,7 +1699,7 @@ static BOOLEAN PeerTpcReqSanity(IN PRTMP_ADAPTER pAd, default: break; } - eid_ptr = (PEID_STRUCT) ((UCHAR *) eid_ptr + 2 + eid_ptr->Len); + eid_ptr = (PEID_STRUCT) ((u8 *) eid_ptr + 2 + eid_ptr->Len); } return result; @@ -1720,13 +1720,13 @@ static BOOLEAN PeerTpcReqSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ static BOOLEAN PeerTpcRepSanity(IN PRTMP_ADAPTER pAd, - IN VOID * pMsg, - IN ULONG MsgLen, - OUT PUINT8 pDialogToken, + void * pMsg, + unsigned long MsgLen, + u8 *pDialogToken, OUT PTPC_REPORT_INFO pTpcRepInfo) { PFRAME_802_11 Fr = (PFRAME_802_11) pMsg; - PUCHAR pFramePtr = Fr->Octet; + u8 *pFramePtr = Fr->Octet; BOOLEAN result = FALSE; PEID_STRUCT eid_ptr; @@ -1744,8 +1744,8 @@ static BOOLEAN PeerTpcRepSanity(IN PRTMP_ADAPTER pAd, MsgLen -= 1; eid_ptr = (PEID_STRUCT) pFramePtr; - while (((UCHAR *) eid_ptr + eid_ptr->Len + 1) < - ((PUCHAR) pFramePtr + MsgLen)) { + while (((u8 *) eid_ptr + eid_ptr->Len + 1) < + ((u8 *)pFramePtr + MsgLen)) { switch (eid_ptr->Eid) { case IE_TPC_REPORT: NdisMoveMemory(&pTpcRepInfo->TxPwr, eid_ptr->Octet, 1); @@ -1757,7 +1757,7 @@ static BOOLEAN PeerTpcRepSanity(IN PRTMP_ADAPTER pAd, default: break; } - eid_ptr = (PEID_STRUCT) ((UCHAR *) eid_ptr + 2 + eid_ptr->Len); + eid_ptr = (PEID_STRUCT) ((u8 *) eid_ptr + 2 + eid_ptr->Len); } return result; @@ -1774,12 +1774,12 @@ static BOOLEAN PeerTpcRepSanity(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -static VOID PeerChSwAnnAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +static void PeerChSwAnnAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { CH_SW_ANN_INFO ChSwAnnInfo; PFRAME_802_11 pFr = (PFRAME_802_11) Elem->Msg; - UCHAR index = 0, Channel = 0, NewChannel = 0; - ULONG Bssidx = 0; + u8 index = 0, Channel = 0, NewChannel = 0; + unsigned long Bssidx = 0; NdisZeroMemory(&ChSwAnnInfo, sizeof(CH_SW_ANN_INFO)); if (!PeerChSwAnnSanity(pAd, Elem->Msg, Elem->MsgLen, &ChSwAnnInfo)) { @@ -1856,11 +1856,11 @@ static VOID PeerChSwAnnAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Return : None. ========================================================================== */ -static VOID PeerMeasureReqAction(IN PRTMP_ADAPTER pAd, +static void PeerMeasureReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { PFRAME_802_11 pFr = (PFRAME_802_11) Elem->Msg; - UINT8 DialogToken; + u8 DialogToken; MEASURE_REQ_INFO MeasureReqInfo; MEASURE_REQ MeasureReq; MEASURE_REPORT_MODE ReportMode; @@ -1889,13 +1889,13 @@ static VOID PeerMeasureReqAction(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -static VOID PeerMeasureReportAction(IN PRTMP_ADAPTER pAd, +static void PeerMeasureReportAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { MEASURE_REPORT_INFO MeasureReportInfo; PFRAME_802_11 pFr = (PFRAME_802_11) Elem->Msg; - UINT8 DialogToken; - PUINT8 pMeasureReportInfo; + u8 DialogToken; + u8 *pMeasureReportInfo; /* if (pAd->CommonCfg.bIEEE80211H != TRUE) */ /* return; */ @@ -1965,14 +1965,14 @@ static VOID PeerMeasureReportAction(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -static VOID PeerTpcReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +static void PeerTpcReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { PFRAME_802_11 pFr = (PFRAME_802_11) Elem->Msg; - PUCHAR pFramePtr = pFr->Octet; - UINT8 DialogToken; - UINT8 TxPwr = GetCurTxPwr(pAd, Elem->Wcid); - UINT8 LinkMargin = 0; - CHAR RealRssi; + u8 *pFramePtr = pFr->Octet; + u8 DialogToken; + u8 TxPwr = GetCurTxPwr(pAd, Elem->Wcid); + u8 LinkMargin = 0; + char RealRssi; /* link margin: Ratio of the received signal power to the minimum desired by the station (STA). The */ /* STA may incorporate rate information and channel conditions, including interference, into its computation */ @@ -2007,9 +2007,9 @@ static VOID PeerTpcReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Return : None. ========================================================================== */ -static VOID PeerTpcRepAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +static void PeerTpcRepAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UINT8 DialogToken; + u8 DialogToken; TPC_REPORT_INFO TpcRepInfo; PTPC_REQ_ENTRY pEntry = NULL; @@ -2040,10 +2040,10 @@ static VOID PeerTpcRepAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Return : None. ========================================================================== */ -VOID PeerSpectrumAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerSpectrumAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Action = Elem->Msg[LENGTH_802_11 + 1]; + u8 Action = Elem->Msg[LENGTH_802_11 + 1]; if (pAd->CommonCfg.bIEEE80211H != TRUE) return; @@ -2085,26 +2085,26 @@ VOID PeerSpectrumAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Return : None. ========================================================================== */ -INT Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg) +int Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, char *arg) { - UINT Aid = 1; - UINT ArgIdx; - PSTRING thisChar; + u32 Aid = 1; + u32 ArgIdx; + char *thisChar; MEASURE_REQ_MODE MeasureReqMode; - UINT8 MeasureReqToken = RandomByte(pAd); - UINT8 MeasureReqType = RM_BASIC; - UINT8 MeasureCh = 1; - UINT64 MeasureStartTime = GetCurrentTimeStamp(pAd); + u8 MeasureReqToken = RandomByte(pAd); + u8 MeasureReqType = RM_BASIC; + u8 MeasureCh = 1; + u64 MeasureStartTime = GetCurrentTimeStamp(pAd); MEASURE_REQ MeasureReq; - UINT8 TotalLen; + u8 TotalLen; HEADER_802_11 ActHdr; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen; + u8 *pOutBuffer = NULL; + int NStatus; + unsigned long FrameLen; - NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); /*Get an unused nonpaged memory */ + NStatus = MlmeAllocateMemory(pAd, (void *)& pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__)); @@ -2115,7 +2115,7 @@ INT Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg) while ((thisChar = strsep((char **)&arg, "-")) != NULL) { switch (ArgIdx) { case 1: /* Aid. */ - Aid = (UINT8) simple_strtol(thisChar, 0, 16); + Aid = (u8)simple_strtol(thisChar, 0, 16); break; case 2: /* Measurement Request Type. */ @@ -2129,7 +2129,7 @@ INT Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg) break; case 3: /* Measurement channel. */ - MeasureCh = (UINT8) simple_strtol(thisChar, 0, 16); + MeasureCh = (u8)simple_strtol(thisChar, 0, 16); break; } ArgIdx++; @@ -2153,7 +2153,7 @@ INT Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg) MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pAd->MacTab.Content[Aid].Addr, pAd->CurrentAddress); - NdisMoveMemory(pOutBuffer, (PCHAR) & ActHdr, sizeof(HEADER_802_11)); + NdisMoveMemory(pOutBuffer, (char *)& ActHdr, sizeof(HEADER_802_11)); FrameLen = sizeof(HEADER_802_11); TotalLen = sizeof(MEASURE_REQ_INFO) + sizeof(MEASURE_REQ); @@ -2168,14 +2168,14 @@ INT Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg) MeasureReq.MeasureDuration = cpu2le16(2000); { - ULONG TempLen; + unsigned long TempLen; MakeOutgoingFrame(pOutBuffer + FrameLen, &TempLen, sizeof(MEASURE_REQ), &MeasureReq, END_OF_ARGS); FrameLen += TempLen; } - MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, (UINT) FrameLen); + MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, (u32)FrameLen); END_OF_MEASURE_REQ: MlmeFreeMemory(pAd, pOutBuffer); @@ -2183,13 +2183,13 @@ END_OF_MEASURE_REQ: return TRUE; } -INT Set_TpcReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg) +int Set_TpcReq_Proc(IN PRTMP_ADAPTER pAd, char *arg) { - UINT Aid; + u32 Aid; - UINT8 TpcReqToken = RandomByte(pAd); + u8 TpcReqToken = RandomByte(pAd); - Aid = (UINT) simple_strtol(arg, 0, 16); + Aid = (u32)simple_strtol(arg, 0, 16); DBGPRINT(RT_DEBUG_TRACE, ("%s::Aid = %d\n", __func__, Aid)); if (!VALID_WCID(Aid)) { diff --git a/drivers/staging/rt2860/crypt_hmac.h b/drivers/staging/rt2860/crypt_hmac.h index 6211640001c6..7a56515d7266 100644 --- a/drivers/staging/rt2860/crypt_hmac.h +++ b/drivers/staging/rt2860/crypt_hmac.h @@ -48,18 +48,18 @@ #ifdef SHA1_SUPPORT #define HMAC_SHA1_SUPPORT -VOID HMAC_SHA1(IN const UINT8 Key[], - IN UINT KeyLen, - IN const UINT8 Message[], - IN UINT MessageLen, OUT UINT8 MAC[], IN UINT MACLen); +void HMAC_SHA1(IN const u8 Key[], + u32 KeyLen, + IN const u8 Message[], + u32 MessageLen, u8 MAC[], u32 MACLen); #endif /* SHA1_SUPPORT */ #ifdef MD5_SUPPORT #define HMAC_MD5_SUPPORT -VOID HMAC_MD5(IN const UINT8 Key[], - IN UINT KeyLen, - IN const UINT8 Message[], - IN UINT MessageLen, OUT UINT8 MAC[], IN UINT MACLen); +void HMAC_MD5(IN const u8 Key[], + u32 KeyLen, + IN const u8 Message[], + u32 MessageLen, u8 MAC[], u32 MACLen); #endif /* MD5_SUPPORT */ #endif /* __CRYPT_HMAC_H__ */ diff --git a/drivers/staging/rt2860/crypt_md5.h b/drivers/staging/rt2860/crypt_md5.h index ecc67e47ef0c..bbabf12abf8a 100644 --- a/drivers/staging/rt2860/crypt_md5.h +++ b/drivers/staging/rt2860/crypt_md5.h @@ -54,19 +54,19 @@ #define MD5_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ #define MD5_DIGEST_SIZE 16 /* 128 bits = 16 bytes */ typedef struct { - UINT32 HashValue[4]; - UINT64 MessageLen; - UINT8 Block[MD5_BLOCK_SIZE]; - UINT BlockLen; + u32 HashValue[4]; + u64 MessageLen; + u8 Block[MD5_BLOCK_SIZE]; + u32 BlockLen; } MD5_CTX_STRUC, *PMD5_CTX_STRUC; -VOID MD5_Init(IN MD5_CTX_STRUC * pMD5_CTX); -VOID MD5_Hash(IN MD5_CTX_STRUC * pMD5_CTX); -VOID MD5_Append(IN MD5_CTX_STRUC * pMD5_CTX, - IN const UINT8 Message[], IN UINT MessageLen); -VOID MD5_End(IN MD5_CTX_STRUC * pMD5_CTX, OUT UINT8 DigestMessage[]); -VOID RT_MD5(IN const UINT8 Message[], - IN UINT MessageLen, OUT UINT8 DigestMessage[]); +void MD5_Init(IN MD5_CTX_STRUC * pMD5_CTX); +void MD5_Hash(IN MD5_CTX_STRUC * pMD5_CTX); +void MD5_Append(IN MD5_CTX_STRUC * pMD5_CTX, + IN const u8 Message[], u32 MessageLen); +void MD5_End(IN MD5_CTX_STRUC * pMD5_CTX, u8 DigestMessage[]); +void RT_MD5(IN const u8 Message[], + u32 MessageLen, u8 DigestMessage[]); #endif /* MD5_SUPPORT */ #endif /* __CRYPT_MD5_H__ */ diff --git a/drivers/staging/rt2860/crypt_sha2.h b/drivers/staging/rt2860/crypt_sha2.h index 33d999d70079..bfd88bc65f67 100644 --- a/drivers/staging/rt2860/crypt_sha2.h +++ b/drivers/staging/rt2860/crypt_sha2.h @@ -55,19 +55,19 @@ #define SHA1_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ #define SHA1_DIGEST_SIZE 20 /* 160 bits = 20 bytes */ typedef struct _SHA1_CTX_STRUC { - UINT32 HashValue[5]; /* 5 = (SHA1_DIGEST_SIZE / 32) */ - UINT64 MessageLen; /* total size */ - UINT8 Block[SHA1_BLOCK_SIZE]; - UINT BlockLen; + u32 HashValue[5]; /* 5 = (SHA1_DIGEST_SIZE / 32) */ + u64 MessageLen; /* total size */ + u8 Block[SHA1_BLOCK_SIZE]; + u32 BlockLen; } SHA1_CTX_STRUC, *PSHA1_CTX_STRUC; -VOID RT_SHA1_Init(IN SHA1_CTX_STRUC * pSHA_CTX); -VOID SHA1_Hash(IN SHA1_CTX_STRUC * pSHA_CTX); -VOID SHA1_Append(IN SHA1_CTX_STRUC * pSHA_CTX, - IN const UINT8 Message[], IN UINT MessageLen); -VOID SHA1_End(IN SHA1_CTX_STRUC * pSHA_CTX, OUT UINT8 DigestMessage[]); -VOID RT_SHA1(IN const UINT8 Message[], - IN UINT MessageLen, OUT UINT8 DigestMessage[]); +void RT_SHA1_Init(IN SHA1_CTX_STRUC * pSHA_CTX); +void SHA1_Hash(IN SHA1_CTX_STRUC * pSHA_CTX); +void SHA1_Append(IN SHA1_CTX_STRUC * pSHA_CTX, + IN const u8 Message[], u32 MessageLen); +void SHA1_End(IN SHA1_CTX_STRUC * pSHA_CTX, u8 DigestMessage[]); +void RT_SHA1(IN const u8 Message[], + u32 MessageLen, u8 DigestMessage[]); #endif /* SHA1_SUPPORT */ #endif /* __CRYPT_SHA2_H__ */ diff --git a/drivers/staging/rt2860/dfs.h b/drivers/staging/rt2860/dfs.h index 9e5e74d6783c..d094490200b9 100644 --- a/drivers/staging/rt2860/dfs.h +++ b/drivers/staging/rt2860/dfs.h @@ -36,4 +36,4 @@ Fonchi 03-12-2007 created */ -BOOLEAN RadarChannelCheck(IN PRTMP_ADAPTER pAd, IN UCHAR Ch); +BOOLEAN RadarChannelCheck(IN PRTMP_ADAPTER pAd, u8 Ch); diff --git a/drivers/staging/rt2860/eeprom.h b/drivers/staging/rt2860/eeprom.h index 4d8e8bf1c236..50df5a2562af 100644 --- a/drivers/staging/rt2860/eeprom.h +++ b/drivers/staging/rt2860/eeprom.h @@ -42,26 +42,26 @@ * Public function declarations for prom-based chipset ************************************************************************/ int rtmp_ee_prom_read16(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, OUT USHORT * pValue); + u16 Offset, u16 * pValue); #endif /* RTMP_PCI_SUPPORT // */ #ifdef RTMP_USB_SUPPORT /************************************************************************* * Public function declarations for usb-based prom chipset ************************************************************************/ -NTSTATUS RTUSBReadEEPROM16(IN PRTMP_ADAPTER pAd, - IN USHORT offset, OUT PUSHORT pData); +int RTUSBReadEEPROM16(IN PRTMP_ADAPTER pAd, + u16 offset, u16 *pData); #endif /* RTMP_USB_SUPPORT // */ #ifdef RT30xx #ifdef RTMP_EFUSE_SUPPORT int rtmp_ee_efuse_read16(IN RTMP_ADAPTER * pAd, - IN USHORT Offset, OUT USHORT * pValue); + u16 Offset, u16 * pValue); #endif /* RTMP_EFUSE_SUPPORT // */ #endif /* RT30xx // */ /************************************************************************* * Public function declarations for prom operation callback functions setting ************************************************************************/ -INT RtmpChipOpsEepromHook(IN RTMP_ADAPTER * pAd, IN INT infType); +int RtmpChipOpsEepromHook(IN RTMP_ADAPTER * pAd, int infType); #endif /* __EEPROM_H__ // */ diff --git a/drivers/staging/rt2860/iface/rtmp_usb.h b/drivers/staging/rt2860/iface/rtmp_usb.h index 26591b000b08..40d7d01cfe82 100644 --- a/drivers/staging/rt2860/iface/rtmp_usb.h +++ b/drivers/staging/rt2860/iface/rtmp_usb.h @@ -38,7 +38,7 @@ typedef struct urb *purbb_t; typedef struct usb_ctrlrequest devctrlrequest; #endif // LINUX // -extern UCHAR EpToQueue[6]; +extern u8 EpToQueue[6]; #define RXBULKAGGRE_ZISE 12 #define MAX_TXBULK_LIMIT (LOCAL_TXBUF_SIZE*(BULKAGGRE_ZISE-1)) @@ -110,8 +110,8 @@ extern void dump_urb(struct urb *purb); #define USBD_SHORT_TRANSFER_OK 0 #define PURB purbb_t -#define PIRP PVOID -#define NDIS_OID UINT +#define PIRP void * +#define NDIS_OID u32 #ifndef USB_ST_NOERROR #define USB_ST_NOERROR 0 #endif @@ -120,12 +120,12 @@ extern void dump_urb(struct urb *purb); #define CONTROL_TIMEOUT_JIFFIES ( (100 * OS_HZ) / 1000) #define UNLINK_TIMEOUT_MS 3 -VOID RTUSBBulkOutDataPacketComplete(purbb_t purb, struct pt_regs *pt_regs); -VOID RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs *pt_regs); -VOID RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs); -VOID RTUSBBulkOutRTSFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs); -VOID RTUSBBulkOutPsPollComplete(purbb_t pUrb, struct pt_regs *pt_regs); -VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs); +void RTUSBBulkOutDataPacketComplete(purbb_t purb, struct pt_regs *pt_regs); +void RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs *pt_regs); +void RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs); +void RTUSBBulkOutRTSFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs); +void RTUSBBulkOutPsPollComplete(purbb_t pUrb, struct pt_regs *pt_regs); +void RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs); #ifdef KTHREAD_SUPPORT #define RTUSBMlmeUp(pAd) \ diff --git a/drivers/staging/rt2860/mlme.h b/drivers/staging/rt2860/mlme.h index 8585a4d95f0b..3be1bc89095c 100644 --- a/drivers/staging/rt2860/mlme.h +++ b/drivers/staging/rt2860/mlme.h @@ -188,86 +188,86 @@ if (((__pEntry)) != NULL) \ /* */ /* HT Capability INFO field in HT Cap IE . */ typedef struct PACKED { - USHORT AdvCoding:1; - USHORT ChannelWidth:1; - USHORT MimoPs:2; /*momi power safe */ - USHORT GF:1; /*green field */ - USHORT ShortGIfor20:1; - USHORT ShortGIfor40:1; /*for40MHz */ - USHORT TxSTBC:1; - USHORT RxSTBC:2; - USHORT DelayedBA:1; /*rt2860c not support */ - USHORT AMsduSize:1; /* only support as zero */ - USHORT CCKmodein40:1; - USHORT PSMP:1; - USHORT Forty_Mhz_Intolerant:1; - USHORT LSIGTxopProSup:1; + u16 AdvCoding:1; + u16 ChannelWidth:1; + u16 MimoPs:2; /*momi power safe */ + u16 GF:1; /*green field */ + u16 ShortGIfor20:1; + u16 ShortGIfor40:1; /*for40MHz */ + u16 TxSTBC:1; + u16 RxSTBC:2; + u16 DelayedBA:1; /*rt2860c not support */ + u16 AMsduSize:1; /* only support as zero */ + u16 CCKmodein40:1; + u16 PSMP:1; + u16 Forty_Mhz_Intolerant:1; + u16 LSIGTxopProSup:1; } HT_CAP_INFO, *PHT_CAP_INFO; /* HT Capability INFO field in HT Cap IE . */ typedef struct PACKED { - UCHAR MaxRAmpduFactor:2; - UCHAR MpduDensity:3; - UCHAR rsv:3; /*momi power safe */ + u8 MaxRAmpduFactor:2; + u8 MpduDensity:3; + u8 rsv:3; /*momi power safe */ } HT_CAP_PARM, *PHT_CAP_PARM; /* HT Capability INFO field in HT Cap IE . */ typedef struct PACKED { - UCHAR MCSSet[10]; - UCHAR SupRate[2]; /* unit : 1Mbps */ - UCHAR TxMCSSetDefined:1; - UCHAR TxRxNotEqual:1; - UCHAR TxStream:2; - UCHAR MpduDensity:1; - UCHAR rsv:3; - UCHAR rsv3[3]; + u8 MCSSet[10]; + u8 SupRate[2]; /* unit : 1Mbps */ + u8 TxMCSSetDefined:1; + u8 TxRxNotEqual:1; + u8 TxStream:2; + u8 MpduDensity:1; + u8 rsv:3; + u8 rsv3[3]; } HT_MCS_SET, *PHT_MCS_SET; /* HT Capability INFO field in HT Cap IE . */ typedef struct PACKED { - USHORT Pco:1; - USHORT TranTime:2; - USHORT rsv:5; /*momi power safe */ - USHORT MCSFeedback:2; /*0:no MCS feedback, 2:unsolicited MCS feedback, 3:Full MCS feedback, 1:rsv. */ - USHORT PlusHTC:1; /*+HTC control field support */ - USHORT RDGSupport:1; /*reverse Direction Grant support */ - USHORT rsv2:4; + u16 Pco:1; + u16 TranTime:2; + u16 rsv:5; /*momi power safe */ + u16 MCSFeedback:2; /*0:no MCS feedback, 2:unsolicited MCS feedback, 3:Full MCS feedback, 1:rsv. */ + u16 PlusHTC:1; /*+HTC control field support */ + u16 RDGSupport:1; /*reverse Direction Grant support */ + u16 rsv2:4; } EXT_HT_CAP_INFO, *PEXT_HT_CAP_INFO; /* HT Beamforming field in HT Cap IE . */ typedef struct PACKED _HT_BF_CAP { - ULONG TxBFRecCapable:1; - ULONG RxSoundCapable:1; - ULONG TxSoundCapable:1; - ULONG RxNDPCapable:1; - ULONG TxNDPCapable:1; - ULONG ImpTxBFCapable:1; - ULONG Calibration:2; - ULONG ExpCSICapable:1; - ULONG ExpNoComSteerCapable:1; - ULONG ExpComSteerCapable:1; - ULONG ExpCSIFbk:2; - ULONG ExpNoComBF:2; - ULONG ExpComBF:2; - ULONG MinGrouping:2; - ULONG CSIBFAntSup:2; - ULONG NoComSteerBFAntSup:2; - ULONG ComSteerBFAntSup:2; - ULONG CSIRowBFSup:2; - ULONG ChanEstimation:2; - ULONG rsv:3; + unsigned long TxBFRecCapable:1; + unsigned long RxSoundCapable:1; + unsigned long TxSoundCapable:1; + unsigned long RxNDPCapable:1; + unsigned long TxNDPCapable:1; + unsigned long ImpTxBFCapable:1; + unsigned long Calibration:2; + unsigned long ExpCSICapable:1; + unsigned long ExpNoComSteerCapable:1; + unsigned long ExpComSteerCapable:1; + unsigned long ExpCSIFbk:2; + unsigned long ExpNoComBF:2; + unsigned long ExpComBF:2; + unsigned long MinGrouping:2; + unsigned long CSIBFAntSup:2; + unsigned long NoComSteerBFAntSup:2; + unsigned long ComSteerBFAntSup:2; + unsigned long CSIRowBFSup:2; + unsigned long ChanEstimation:2; + unsigned long rsv:3; } HT_BF_CAP, *PHT_BF_CAP; /* HT antenna selection field in HT Cap IE . */ typedef struct PACKED _HT_AS_CAP { - UCHAR AntSelect:1; - UCHAR ExpCSIFbkTxASEL:1; - UCHAR AntIndFbkTxASEL:1; - UCHAR ExpCSIFbk:1; - UCHAR AntIndFbk:1; - UCHAR RxASel:1; - UCHAR TxSoundPPDU:1; - UCHAR rsv:1; + u8 AntSelect:1; + u8 ExpCSIFbkTxASEL:1; + u8 AntIndFbkTxASEL:1; + u8 ExpCSIFbk:1; + u8 AntIndFbk:1; + u8 RxASel:1; + u8 TxSoundPPDU:1; + u8 rsv:1; } HT_AS_CAP, *PHT_AS_CAP; /* Draft 1.0 set IE length 26, but is extensible.. */ @@ -277,7 +277,7 @@ typedef struct PACKED _HT_CAPABILITY_IE { HT_CAP_INFO HtCapInfo; HT_CAP_PARM HtCapParm; /* HT_MCS_SET HtMCSSet; */ - UCHAR MCSSet[16]; + u8 MCSSet[16]; EXT_HT_CAP_INFO ExtHtCapInfo; HT_BF_CAP TxBFCap; /* beamforming cap. rt2860c not support beamforming. */ HT_AS_CAP ASCap; /*antenna selection. */ @@ -297,77 +297,77 @@ typedef struct PACKED _HT_CAPABILITY_IE { /* being obligated to perform OBSS Scan operations. default is 25(== 0.25%) */ typedef struct PACKED _OVERLAP_BSS_SCAN_IE { - USHORT ScanPassiveDwell; - USHORT ScanActiveDwell; - USHORT TriggerScanInt; /* Trigger scan interval */ - USHORT PassiveTalPerChannel; /* passive total per channel */ - USHORT ActiveTalPerChannel; /* active total per channel */ - USHORT DelayFactor; /* BSS width channel transition delay factor */ - USHORT ScanActThre; /* Scan Activity threshold */ + u16 ScanPassiveDwell; + u16 ScanActiveDwell; + u16 TriggerScanInt; /* Trigger scan interval */ + u16 PassiveTalPerChannel; /* passive total per channel */ + u16 ActiveTalPerChannel; /* active total per channel */ + u16 DelayFactor; /* BSS width channel transition delay factor */ + u16 ScanActThre; /* Scan Activity threshold */ } OVERLAP_BSS_SCAN_IE, *POVERLAP_BSS_SCAN_IE; /* 7.3.2.56. 20/40 Coexistence element used in Element ID = 72 = IE_2040_BSS_COEXIST */ typedef union PACKED _BSS_2040_COEXIST_IE { struct PACKED { - UCHAR InfoReq:1; - UCHAR Intolerant40:1; /* Inter-BSS. set 1 when prohibits a receiving BSS from operating as a 20/40 Mhz BSS. */ - UCHAR BSS20WidthReq:1; /* Intra-BSS set 1 when prohibits a receiving AP from operating its BSS as a 20/40MHz BSS. */ - UCHAR rsv:5; + u8 InfoReq:1; + u8 Intolerant40:1; /* Inter-BSS. set 1 when prohibits a receiving BSS from operating as a 20/40 Mhz BSS. */ + u8 BSS20WidthReq:1; /* Intra-BSS set 1 when prohibits a receiving AP from operating its BSS as a 20/40MHz BSS. */ + u8 rsv:5; } field; - UCHAR word; + u8 word; } BSS_2040_COEXIST_IE, *PBSS_2040_COEXIST_IE; typedef struct _TRIGGER_EVENTA { BOOLEAN bValid; - UCHAR BSSID[6]; - UCHAR RegClass; /* Regulatory Class */ - USHORT Channel; - ULONG CDCounter; /* Maintain a seperate count down counter for each Event A. */ + u8 BSSID[6]; + u8 RegClass; /* Regulatory Class */ + u16 Channel; + unsigned long CDCounter; /* Maintain a seperate count down counter for each Event A. */ } TRIGGER_EVENTA, *PTRIGGER_EVENTA; /* 20/40 trigger event table */ /* If one Event A delete or created, or if Event B is detected or not detected, STA should send 2040BSSCoexistence to AP. */ #define MAX_TRIGGER_EVENT 64 typedef struct _TRIGGER_EVENT_TAB { - UCHAR EventANo; + u8 EventANo; TRIGGER_EVENTA EventA[MAX_TRIGGER_EVENT]; - ULONG EventBCountDown; /* Count down counter for Event B. */ + unsigned long EventBCountDown; /* Count down counter for Event B. */ } TRIGGER_EVENT_TAB, *PTRIGGER_EVENT_TAB; /* 7.3.27 20/40 Bss Coexistence Mgmt capability used in extended capabilities information IE( ID = 127 = IE_EXT_CAPABILITY). */ /* This is the first octet and was defined in 802.11n D3.03 and 802.11yD9.0 */ typedef struct PACKED _EXT_CAP_INFO_ELEMENT { - UCHAR BssCoexistMgmtSupport:1; - UCHAR rsv:1; - UCHAR ExtendChannelSwitch:1; - UCHAR rsv2:5; + u8 BssCoexistMgmtSupport:1; + u8 rsv:1; + u8 ExtendChannelSwitch:1; + u8 rsv2:5; } EXT_CAP_INFO_ELEMENT, *PEXT_CAP_INFO_ELEMENT; /* 802.11n 7.3.2.61 */ typedef struct PACKED _BSS_2040_COEXIST_ELEMENT { - UCHAR ElementID; /* ID = IE_2040_BSS_COEXIST = 72 */ - UCHAR Len; + u8 ElementID; /* ID = IE_2040_BSS_COEXIST = 72 */ + u8 Len; BSS_2040_COEXIST_IE BssCoexistIe; } BSS_2040_COEXIST_ELEMENT, *PBSS_2040_COEXIST_ELEMENT; /*802.11n 7.3.2.59 */ typedef struct PACKED _BSS_2040_INTOLERANT_CH_REPORT { - UCHAR ElementID; /* ID = IE_2040_BSS_INTOLERANT_REPORT = 73 */ - UCHAR Len; - UCHAR RegulatoryClass; - UCHAR ChList[0]; + u8 ElementID; /* ID = IE_2040_BSS_INTOLERANT_REPORT = 73 */ + u8 Len; + u8 RegulatoryClass; + u8 ChList[0]; } BSS_2040_INTOLERANT_CH_REPORT, *PBSS_2040_INTOLERANT_CH_REPORT; /* The structure for channel switch annoucement IE. This is in 802.11n D3.03 */ typedef struct PACKED _CHA_SWITCH_ANNOUNCE_IE { - UCHAR SwitchMode; /*channel switch mode */ - UCHAR NewChannel; /* */ - UCHAR SwitchCount; /* */ + u8 SwitchMode; /*channel switch mode */ + u8 NewChannel; /* */ + u8 SwitchCount; /* */ } CHA_SWITCH_ANNOUNCE_IE, *PCHA_SWITCH_ANNOUNCE_IE; /* The structure for channel switch annoucement IE. This is in 802.11n D3.03 */ typedef struct PACKED _SEC_CHA_OFFSET_IE { - UCHAR SecondaryChannelOffset; /* 1: Secondary above, 3: Secondary below, 0: no Secondary */ + u8 SecondaryChannelOffset; /* 1: Secondary above, 3: Secondary below, 0: no Secondary */ } SEC_CHA_OFFSET_IE, *PSEC_CHA_OFFSET_IE; /* This structure is extracted from struct RT_HT_CAPABILITY */ @@ -375,156 +375,156 @@ typedef struct { BOOLEAN bHtEnable; /* If we should use ht rate. */ BOOLEAN bPreNHt; /* If we should use ht rate. */ /*Substract from HT Capability IE */ - UCHAR MCSSet[16]; + u8 MCSSet[16]; } RT_HT_PHY_INFO, *PRT_HT_PHY_INFO; /*This structure substracts ralink supports from all 802.11n-related features. */ /*Features not listed here but contained in 802.11n spec are not supported in rt2860. */ typedef struct { - USHORT ChannelWidth:1; - USHORT MimoPs:2; /*mimo power safe MMPS_ */ - USHORT GF:1; /*green field */ - USHORT ShortGIfor20:1; - USHORT ShortGIfor40:1; /*for40MHz */ - USHORT TxSTBC:1; - USHORT RxSTBC:2; /* 2 bits */ - USHORT AmsduEnable:1; /* Enable to transmit A-MSDU. Suggest disable. We should use A-MPDU to gain best benifit of 802.11n */ - USHORT AmsduSize:1; /* Max receiving A-MSDU size */ - USHORT rsv:5; + u16 ChannelWidth:1; + u16 MimoPs:2; /*mimo power safe MMPS_ */ + u16 GF:1; /*green field */ + u16 ShortGIfor20:1; + u16 ShortGIfor40:1; /*for40MHz */ + u16 TxSTBC:1; + u16 RxSTBC:2; /* 2 bits */ + u16 AmsduEnable:1; /* Enable to transmit A-MSDU. Suggest disable. We should use A-MPDU to gain best benifit of 802.11n */ + u16 AmsduSize:1; /* Max receiving A-MSDU size */ + u16 rsv:5; /*Substract from Addiont HT INFO IE */ - UCHAR MaxRAmpduFactor:2; - UCHAR MpduDensity:3; - UCHAR ExtChanOffset:2; /* Please not the difference with following UCHAR NewExtChannelOffset; from 802.11n */ - UCHAR RecomWidth:1; + u8 MaxRAmpduFactor:2; + u8 MpduDensity:3; + u8 ExtChanOffset:2; /* Please not the difference with following u8 NewExtChannelOffset; from 802.11n */ + u8 RecomWidth:1; - USHORT OperaionMode:2; - USHORT NonGfPresent:1; - USHORT rsv3:1; - USHORT OBSS_NonHTExist:1; - USHORT rsv2:11; + u16 OperaionMode:2; + u16 NonGfPresent:1; + u16 rsv3:1; + u16 OBSS_NonHTExist:1; + u16 rsv2:11; /* New Extension Channel Offset IE */ - UCHAR NewExtChannelOffset; + u8 NewExtChannelOffset; /* Extension Capability IE = 127 */ - UCHAR BSSCoexist2040; + u8 BSSCoexist2040; } RT_HT_CAPABILITY, *PRT_HT_CAPABILITY; /* field in Addtional HT Information IE . */ typedef struct PACKED { - UCHAR ExtChanOffset:2; - UCHAR RecomWidth:1; - UCHAR RifsMode:1; - UCHAR S_PSMPSup:1; /*Indicate support for scheduled PSMP */ - UCHAR SerInterGranu:3; /*service interval granularity */ + u8 ExtChanOffset:2; + u8 RecomWidth:1; + u8 RifsMode:1; + u8 S_PSMPSup:1; /*Indicate support for scheduled PSMP */ + u8 SerInterGranu:3; /*service interval granularity */ } ADD_HTINFO, *PADD_HTINFO; typedef struct PACKED { - USHORT OperaionMode:2; - USHORT NonGfPresent:1; - USHORT rsv:1; - USHORT OBSS_NonHTExist:1; - USHORT rsv2:11; + u16 OperaionMode:2; + u16 NonGfPresent:1; + u16 rsv:1; + u16 OBSS_NonHTExist:1; + u16 rsv2:11; } ADD_HTINFO2, *PADD_HTINFO2; /* TODO: Need sync with spec about the definition of StbcMcs. In Draft 3.03, it's reserved. */ typedef struct PACKED { - USHORT StbcMcs:6; - USHORT DualBeacon:1; - USHORT DualCTSProtect:1; - USHORT STBCBeacon:1; - USHORT LsigTxopProt:1; /* L-SIG TXOP protection full support */ - USHORT PcoActive:1; - USHORT PcoPhase:1; - USHORT rsv:4; + u16 StbcMcs:6; + u16 DualBeacon:1; + u16 DualCTSProtect:1; + u16 STBCBeacon:1; + u16 LsigTxopProt:1; /* L-SIG TXOP protection full support */ + u16 PcoActive:1; + u16 PcoPhase:1; + u16 rsv:4; } ADD_HTINFO3, *PADD_HTINFO3; #define SIZE_ADD_HT_INFO_IE 22 typedef struct PACKED { - UCHAR ControlChan; + u8 ControlChan; ADD_HTINFO AddHtInfo; ADD_HTINFO2 AddHtInfo2; ADD_HTINFO3 AddHtInfo3; - UCHAR MCSSet[16]; /* Basic MCS set */ + u8 MCSSet[16]; /* Basic MCS set */ } ADD_HT_INFO_IE, *PADD_HT_INFO_IE; typedef struct PACKED { - UCHAR NewExtChanOffset; + u8 NewExtChanOffset; } NEW_EXT_CHAN_IE, *PNEW_EXT_CHAN_IE; typedef struct PACKED _FRAME_802_11 { HEADER_802_11 Hdr; - UCHAR Octet[1]; + u8 Octet[1]; } FRAME_802_11, *PFRAME_802_11; /* QoSNull embedding of management action. When HT Control MA field set to 1. */ typedef struct PACKED _MA_BODY { - UCHAR Category; - UCHAR Action; - UCHAR Octet[1]; + u8 Category; + u8 Action; + u8 Octet[1]; } MA_BODY, *PMA_BODY; typedef struct PACKED _HEADER_802_3 { - UCHAR DAAddr1[MAC_ADDR_LEN]; - UCHAR SAAddr2[MAC_ADDR_LEN]; - UCHAR Octet[2]; + u8 DAAddr1[MAC_ADDR_LEN]; + u8 SAAddr2[MAC_ADDR_LEN]; + u8 Octet[2]; } HEADER_802_3, *PHEADER_802_3; /*//Block ACK related format */ /* 2-byte BA Parameter field in DELBA frames to terminate an already set up bA */ typedef struct PACKED { - USHORT Rsv:11; /* always set to 0 */ - USHORT Initiator:1; /* 1: originator 0:recipient */ - USHORT TID:4; /* value of TC os TS */ + u16 Rsv:11; /* always set to 0 */ + u16 Initiator:1; /* 1: originator 0:recipient */ + u16 TID:4; /* value of TC os TS */ } DELBA_PARM, *PDELBA_PARM; /* 2-byte BA Parameter Set field in ADDBA frames to signal parm for setting up a BA */ typedef struct PACKED { - USHORT AMSDUSupported:1; /* 0: not permitted 1: permitted */ - USHORT BAPolicy:1; /* 1: immediately BA 0:delayed BA */ - USHORT TID:4; /* value of TC os TS */ - USHORT BufSize:10; /* number of buffe of size 2304 octetsr */ + u16 AMSDUSupported:1; /* 0: not permitted 1: permitted */ + u16 BAPolicy:1; /* 1: immediately BA 0:delayed BA */ + u16 TID:4; /* value of TC os TS */ + u16 BufSize:10; /* number of buffe of size 2304 octetsr */ } BA_PARM, *PBA_PARM; /* 2-byte BA Starting Seq CONTROL field */ typedef union PACKED { struct PACKED { - USHORT FragNum:4; /* always set to 0 */ - USHORT StartSeq:12; /* sequence number of the 1st MSDU for which this BAR is sent */ + u16 FragNum:4; /* always set to 0 */ + u16 StartSeq:12; /* sequence number of the 1st MSDU for which this BAR is sent */ } field; - USHORT word; + u16 word; } BASEQ_CONTROL, *PBASEQ_CONTROL; /*BAControl and BARControl are the same */ /* 2-byte BA CONTROL field in BA frame */ typedef struct PACKED { - USHORT ACKPolicy:1; /* only related to N-Delayed BA. But not support in RT2860b. 0:NormalACK 1:No ACK */ - USHORT MTID:1; /*EWC V1.24 */ - USHORT Compressed:1; - USHORT Rsv:9; - USHORT TID:4; + u16 ACKPolicy:1; /* only related to N-Delayed BA. But not support in RT2860b. 0:NormalACK 1:No ACK */ + u16 MTID:1; /*EWC V1.24 */ + u16 Compressed:1; + u16 Rsv:9; + u16 TID:4; } BA_CONTROL, *PBA_CONTROL; /* 2-byte BAR CONTROL field in BAR frame */ typedef struct PACKED { - USHORT ACKPolicy:1; /* 0:normal ack, 1:no ack. */ - USHORT MTID:1; /*if this bit1, use FRAME_MTBA_REQ, if 0, use FRAME_BA_REQ */ - USHORT Compressed:1; - USHORT Rsv1:9; - USHORT TID:4; + u16 ACKPolicy:1; /* 0:normal ack, 1:no ack. */ + u16 MTID:1; /*if this bit1, use FRAME_MTBA_REQ, if 0, use FRAME_BA_REQ */ + u16 Compressed:1; + u16 Rsv1:9; + u16 TID:4; } BAR_CONTROL, *PBAR_CONTROL; /* BARControl in MTBAR frame */ typedef struct PACKED { - USHORT ACKPolicy:1; - USHORT MTID:1; - USHORT Compressed:1; - USHORT Rsv1:9; - USHORT NumTID:4; + u16 ACKPolicy:1; + u16 MTID:1; + u16 Compressed:1; + u16 Rsv1:9; + u16 NumTID:4; } MTBAR_CONTROL, *PMTBAR_CONTROL; typedef struct PACKED { - USHORT Rsv1:12; - USHORT TID:4; + u16 Rsv1:12; + u16 TID:4; } PER_TID_INFO, *PPER_TID_INFO; typedef struct { @@ -535,18 +535,18 @@ typedef struct { /* BAREQ AND MTBAREQ have the same subtype BAR, 802.11n BAR use compressed bitmap. */ typedef struct PACKED _FRAME_BA_REQ { FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; + u16 Duration; + u8 Addr1[MAC_ADDR_LEN]; + u8 Addr2[MAC_ADDR_LEN]; BAR_CONTROL BARControl; BASEQ_CONTROL BAStartingSeq; } FRAME_BA_REQ, *PFRAME_BA_REQ; typedef struct PACKED _FRAME_MTBA_REQ { FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; + u16 Duration; + u8 Addr1[MAC_ADDR_LEN]; + u8 Addr2[MAC_ADDR_LEN]; MTBAR_CONTROL MTBARControl; PER_TID_INFO PerTIDInfo; BASEQ_CONTROL BAStartingSeq; @@ -555,84 +555,84 @@ typedef struct PACKED _FRAME_MTBA_REQ { /* Compressed format is mandantory in HT STA */ typedef struct PACKED _FRAME_MTBA { FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; + u16 Duration; + u8 Addr1[MAC_ADDR_LEN]; + u8 Addr2[MAC_ADDR_LEN]; BA_CONTROL BAControl; BASEQ_CONTROL BAStartingSeq; - UCHAR BitMap[8]; + u8 BitMap[8]; } FRAME_MTBA, *PFRAME_MTBA; typedef struct PACKED _FRAME_PSMP_ACTION { HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; - UCHAR Psmp; /* 7.3.1.25 */ + u8 Category; + u8 Action; + u8 Psmp; /* 7.3.1.25 */ } FRAME_PSMP_ACTION, *PFRAME_PSMP_ACTION; typedef struct PACKED _FRAME_ACTION_HDR { HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; + u8 Category; + u8 Action; } FRAME_ACTION_HDR, *PFRAME_ACTION_HDR; /*Action Frame */ /*Action Frame Category:Spectrum, Action:Channel Switch. 7.3.2.20 */ typedef struct PACKED _CHAN_SWITCH_ANNOUNCE { - UCHAR ElementID; /* ID = IE_CHANNEL_SWITCH_ANNOUNCEMENT = 37 */ - UCHAR Len; + u8 ElementID; /* ID = IE_CHANNEL_SWITCH_ANNOUNCEMENT = 37 */ + u8 Len; CHA_SWITCH_ANNOUNCE_IE CSAnnounceIe; } CHAN_SWITCH_ANNOUNCE, *PCHAN_SWITCH_ANNOUNCE; /*802.11n : 7.3.2.20a */ typedef struct PACKED _SECOND_CHAN_OFFSET { - UCHAR ElementID; /* ID = IE_SECONDARY_CH_OFFSET = 62 */ - UCHAR Len; + u8 ElementID; /* ID = IE_SECONDARY_CH_OFFSET = 62 */ + u8 Len; SEC_CHA_OFFSET_IE SecChOffsetIe; } SECOND_CHAN_OFFSET, *PSECOND_CHAN_OFFSET; typedef struct PACKED _FRAME_SPETRUM_CS { HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; + u8 Category; + u8 Action; CHAN_SWITCH_ANNOUNCE CSAnnounce; SECOND_CHAN_OFFSET SecondChannel; } FRAME_SPETRUM_CS, *PFRAME_SPETRUM_CS; typedef struct PACKED _FRAME_ADDBA_REQ { HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; - UCHAR Token; /* 1 */ + u8 Category; + u8 Action; + u8 Token; /* 1 */ BA_PARM BaParm; /* 2 - 10 */ - USHORT TimeOutValue; /* 0 - 0 */ + u16 TimeOutValue; /* 0 - 0 */ BASEQ_CONTROL BaStartSeq; /* 0-0 */ } FRAME_ADDBA_REQ, *PFRAME_ADDBA_REQ; typedef struct PACKED _FRAME_ADDBA_RSP { HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; - UCHAR Token; - USHORT StatusCode; + u8 Category; + u8 Action; + u8 Token; + u16 StatusCode; BA_PARM BaParm; /*0 - 2 */ - USHORT TimeOutValue; + u16 TimeOutValue; } FRAME_ADDBA_RSP, *PFRAME_ADDBA_RSP; typedef struct PACKED _FRAME_DELBA_REQ { HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; + u8 Category; + u8 Action; DELBA_PARM DelbaParm; - USHORT ReasonCode; + u16 ReasonCode; } FRAME_DELBA_REQ, *PFRAME_DELBA_REQ; /*7.2.1.7 */ typedef struct PACKED _FRAME_BAR { FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; + u16 Duration; + u8 Addr1[MAC_ADDR_LEN]; + u8 Addr2[MAC_ADDR_LEN]; BAR_CONTROL BarControl; BASEQ_CONTROL StartingSeq; } FRAME_BAR, *PFRAME_BAR; @@ -640,31 +640,31 @@ typedef struct PACKED _FRAME_BAR { /*7.2.1.7 */ typedef struct PACKED _FRAME_BA { FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; + u16 Duration; + u8 Addr1[MAC_ADDR_LEN]; + u8 Addr2[MAC_ADDR_LEN]; BAR_CONTROL BarControl; BASEQ_CONTROL StartingSeq; - UCHAR bitmask[8]; + u8 bitmask[8]; } FRAME_BA, *PFRAME_BA; /* Radio Measuement Request Frame Format */ typedef struct PACKED _FRAME_RM_REQ_ACTION { HEADER_802_11 Hdr; - UCHAR Category; - UCHAR Action; - UCHAR Token; - USHORT Repetition; - UCHAR data[0]; + u8 Category; + u8 Action; + u8 Token; + u16 Repetition; + u8 data[0]; } FRAME_RM_REQ_ACTION, *PFRAME_RM_REQ_ACTION; typedef struct PACKED { - UCHAR ID; - UCHAR Length; - UCHAR ChannelSwitchMode; - UCHAR NewRegClass; - UCHAR NewChannelNum; - UCHAR ChannelSwitchCount; + u8 ID; + u8 Length; + u8 ChannelSwitchMode; + u8 NewRegClass; + u8 NewChannelNum; + u8 ChannelSwitchCount; } HT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE, *PHT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE; @@ -683,17 +683,17 @@ typedef struct PACKED { /* */ typedef struct PACKED { BOOLEAN bValid; /* 1: variable contains valid value */ - UCHAR CfpCount; - UCHAR CfpPeriod; - USHORT CfpMaxDuration; - USHORT CfpDurRemaining; + u8 CfpCount; + u8 CfpPeriod; + u16 CfpMaxDuration; + u16 CfpDurRemaining; } CF_PARM, *PCF_PARM; typedef struct _CIPHER_SUITE { NDIS_802_11_ENCRYPTION_STATUS PairCipher; /* Unicast cipher 1, this one has more secured cipher suite */ NDIS_802_11_ENCRYPTION_STATUS PairCipherAux; /* Unicast cipher 2 if AP announce two unicast cipher suite */ NDIS_802_11_ENCRYPTION_STATUS GroupCipher; /* Group cipher */ - USHORT RsnCapability; /* RSN capability from beacon */ + u16 RsnCapability; /* RSN capability from beacon */ BOOLEAN bMixMode; /* Indicate Pair & Group cipher might be different */ } CIPHER_SUITE, *PCIPHER_SUITE; @@ -706,38 +706,38 @@ typedef struct { BOOLEAN bTxopRequest; BOOLEAN bAPSDCapable; /* BOOLEAN bMoreDataAck; */ - UCHAR EdcaUpdateCount; - UCHAR Aifsn[4]; /* 0:AC_BK, 1:AC_BE, 2:AC_VI, 3:AC_VO */ - UCHAR Cwmin[4]; - UCHAR Cwmax[4]; - USHORT Txop[4]; /* in unit of 32-us */ + u8 EdcaUpdateCount; + u8 Aifsn[4]; /* 0:AC_BK, 1:AC_BE, 2:AC_VI, 3:AC_VO */ + u8 Cwmin[4]; + u8 Cwmax[4]; + u16 Txop[4]; /* in unit of 32-us */ BOOLEAN bACM[4]; /* 1: Admission Control of AC_BK is mandattory */ } EDCA_PARM, *PEDCA_PARM; /* QBSS LOAD information from QAP's BEACON/ProbeRsp */ typedef struct { BOOLEAN bValid; /* 1: variable contains valid value */ - USHORT StaNum; - UCHAR ChannelUtilization; - USHORT RemainingAdmissionControl; /* in unit of 32-us */ + u16 StaNum; + u8 ChannelUtilization; + u16 RemainingAdmissionControl; /* in unit of 32-us */ } QBSS_LOAD_PARM, *PQBSS_LOAD_PARM; /* QBSS Info field in QSTA's assoc req */ typedef struct PACKED { - UCHAR UAPSD_AC_VO:1; - UCHAR UAPSD_AC_VI:1; - UCHAR UAPSD_AC_BK:1; - UCHAR UAPSD_AC_BE:1; - UCHAR Rsv1:1; - UCHAR MaxSPLength:2; - UCHAR Rsv2:1; + u8 UAPSD_AC_VO:1; + u8 UAPSD_AC_VI:1; + u8 UAPSD_AC_BK:1; + u8 UAPSD_AC_BE:1; + u8 Rsv1:1; + u8 MaxSPLength:2; + u8 Rsv2:1; } QBSS_STA_INFO_PARM, *PQBSS_STA_INFO_PARM; /* QBSS Info field in QAP's Beacon/ProbeRsp */ typedef struct PACKED { - UCHAR ParamSetCount:4; - UCHAR Rsv:3; - UCHAR UAPSD:1; + u8 ParamSetCount:4; + u8 Rsv:3; + u8 UAPSD:1; } QBSS_AP_INFO_PARM, *PQBSS_AP_INFO_PARM; /* QOS Capability reported in QAP's BEACON/ProbeRsp */ @@ -748,46 +748,46 @@ typedef struct { BOOLEAN bQueueRequest; BOOLEAN bTxopRequest; /* BOOLEAN bMoreDataAck; */ - UCHAR EdcaUpdateCount; + u8 EdcaUpdateCount; } QOS_CAPABILITY_PARM, *PQOS_CAPABILITY_PARM; typedef struct { - UCHAR IELen; - UCHAR IE[MAX_CUSTOM_LEN]; + u8 IELen; + u8 IE[MAX_CUSTOM_LEN]; } WPA_IE_; typedef struct { - UCHAR Bssid[MAC_ADDR_LEN]; - UCHAR Channel; - UCHAR CentralChannel; /*Store the wide-band central channel for 40MHz. .used in 40MHz AP. Or this is the same as Channel. */ - UCHAR BssType; - USHORT AtimWin; - USHORT BeaconPeriod; - - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR ExtRateLen; + u8 Bssid[MAC_ADDR_LEN]; + u8 Channel; + u8 CentralChannel; /*Store the wide-band central channel for 40MHz. .used in 40MHz AP. Or this is the same as Channel. */ + u8 BssType; + u16 AtimWin; + u16 BeaconPeriod; + + u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES]; + u8 SupRateLen; + u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; + u8 ExtRateLen; HT_CAPABILITY_IE HtCapability; - UCHAR HtCapabilityLen; + u8 HtCapabilityLen; ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ - UCHAR AddHtInfoLen; - UCHAR NewExtChanOffset; - CHAR Rssi; - UCHAR Privacy; /* Indicate security function ON/OFF. Don't mess up with auth mode. */ - UCHAR Hidden; + u8 AddHtInfoLen; + u8 NewExtChanOffset; + char Rssi; + u8 Privacy; /* Indicate security function ON/OFF. Don't mess up with auth mode. */ + u8 Hidden; - USHORT DtimPeriod; - USHORT CapabilityInfo; + u16 DtimPeriod; + u16 CapabilityInfo; - USHORT CfpCount; - USHORT CfpPeriod; - USHORT CfpMaxDuration; - USHORT CfpDurRemaining; - UCHAR SsidLen; - CHAR Ssid[MAX_LEN_OF_SSID]; + u16 CfpCount; + u16 CfpPeriod; + u16 CfpMaxDuration; + u16 CfpDurRemaining; + u8 SsidLen; + char Ssid[MAX_LEN_OF_SSID]; - ULONG LastBeaconRxTime; /* OS's timestamp */ + unsigned long LastBeaconRxTime; /* OS's timestamp */ BOOLEAN bSES; @@ -800,15 +800,15 @@ typedef struct { NDIS_802_11_AUTHENTICATION_MODE AuthModeAux; /* Addition mode for WPA2 / WPA capable AP */ NDIS_802_11_AUTHENTICATION_MODE AuthMode; NDIS_802_11_WEP_STATUS WepStatus; /* Unicast Encryption Algorithm extract from VAR_IE */ - USHORT VarIELen; /* Length of next VIE include EID & Length */ - UCHAR VarIEs[MAX_VIE_LEN]; + u16 VarIELen; /* Length of next VIE include EID & Length */ + u8 VarIEs[MAX_VIE_LEN]; /* CCX Ckip information */ - UCHAR CkipFlag; + u8 CkipFlag; /* CCX 2 TSF */ - UCHAR PTSF[4]; /* Parent TSF */ - UCHAR TTSF[8]; /* Target TSF */ + u8 PTSF[4]; /* Parent TSF */ + u8 TTSF[8]; /* Target TSF */ /* 802.11e d9, and WMM */ EDCA_PARM EdcaParm; @@ -819,41 +819,41 @@ typedef struct { } BSS_ENTRY, *PBSS_ENTRY; typedef struct { - UCHAR BssNr; - UCHAR BssOverlapNr; + u8 BssNr; + u8 BssOverlapNr; BSS_ENTRY BssEntry[MAX_LEN_OF_BSS_TABLE]; } BSS_TABLE, *PBSS_TABLE; typedef struct _MLME_QUEUE_ELEM { - ULONG Machine; - ULONG MsgType; - ULONG MsgLen; - UCHAR Msg[MGMT_DMA_BUFFER_SIZE]; + unsigned long Machine; + unsigned long MsgType; + unsigned long MsgLen; + u8 Msg[MGMT_DMA_BUFFER_SIZE]; LARGE_INTEGER TimeStamp; - UCHAR Rssi0; - UCHAR Rssi1; - UCHAR Rssi2; - UCHAR Signal; - UCHAR Channel; - UCHAR Wcid; + u8 Rssi0; + u8 Rssi1; + u8 Rssi2; + u8 Signal; + u8 Channel; + u8 Wcid; BOOLEAN Occupied; } MLME_QUEUE_ELEM, *PMLME_QUEUE_ELEM; typedef struct _MLME_QUEUE { - ULONG Num; - ULONG Head; - ULONG Tail; + unsigned long Num; + unsigned long Head; + unsigned long Tail; NDIS_SPIN_LOCK Lock; MLME_QUEUE_ELEM Entry[MAX_LEN_OF_MLME_QUEUE]; } MLME_QUEUE, *PMLME_QUEUE; -typedef VOID(*STATE_MACHINE_FUNC) (VOID * Adaptor, MLME_QUEUE_ELEM * Elem); +typedef void(*STATE_MACHINE_FUNC) (void * Adaptor, MLME_QUEUE_ELEM * Elem); typedef struct _STATE_MACHINE { - ULONG Base; - ULONG NrState; - ULONG NrMsg; - ULONG CurrState; + unsigned long Base; + unsigned long NrState; + unsigned long NrMsg; + unsigned long CurrState; STATE_MACHINE_FUNC *TransFunc; } STATE_MACHINE, *PSTATE_MACHINE; @@ -864,33 +864,33 @@ typedef struct _STATE_MACHINE { /* separate this under-trial settings away from pAd->StaActive so that once */ /* this new attempt failed, driver can auto-recover back to the active settings. */ typedef struct _MLME_AUX { - UCHAR BssType; - UCHAR Ssid[MAX_LEN_OF_SSID]; - UCHAR SsidLen; - UCHAR Bssid[MAC_ADDR_LEN]; - UCHAR AutoReconnectSsid[MAX_LEN_OF_SSID]; - UCHAR AutoReconnectSsidLen; - USHORT Alg; - UCHAR ScanType; - UCHAR Channel; - UCHAR CentralChannel; - USHORT Aid; - USHORT CapabilityInfo; - USHORT BeaconPeriod; - USHORT CfpMaxDuration; - USHORT CfpPeriod; - USHORT AtimWin; + u8 BssType; + u8 Ssid[MAX_LEN_OF_SSID]; + u8 SsidLen; + u8 Bssid[MAC_ADDR_LEN]; + u8 AutoReconnectSsid[MAX_LEN_OF_SSID]; + u8 AutoReconnectSsidLen; + u16 Alg; + u8 ScanType; + u8 Channel; + u8 CentralChannel; + u16 Aid; + u16 CapabilityInfo; + u16 BeaconPeriod; + u16 CfpMaxDuration; + u16 CfpPeriod; + u16 AtimWin; /* Copy supported rate from desired AP's beacon. We are trying to match */ /* AP's supported and extended rate settings. */ - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen; - UCHAR ExtRateLen; + u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES]; + u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; + u8 SupRateLen; + u8 ExtRateLen; HT_CAPABILITY_IE HtCapability; - UCHAR HtCapabilityLen; + u8 HtCapabilityLen; ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ - UCHAR NewExtChannelOffset; + u8 NewExtChannelOffset; /*RT_HT_CAPABILITY SupportedHtPhy; */ /* new for QOS */ @@ -899,12 +899,12 @@ typedef struct _MLME_AUX { QBSS_LOAD_PARM APQbssLoad; /* QBSS load of the current associated AP */ /* new to keep Ralink specific feature */ - ULONG APRalinkIe; + unsigned long APRalinkIe; BSS_TABLE SsidBssTab; /* AP list for the same SSID */ BSS_TABLE RoamTab; /* AP list eligible for roaming */ - ULONG BssIdx; - ULONG RoamIdx; + unsigned long BssIdx; + unsigned long RoamIdx; BOOLEAN CurrReqIsFromNdis; @@ -914,81 +914,81 @@ typedef struct _MLME_AUX { } MLME_AUX, *PMLME_AUX; typedef struct _MLME_ADDBA_REQ_STRUCT { - UCHAR Wcid; /* */ - UCHAR pAddr[MAC_ADDR_LEN]; - UCHAR BaBufSize; - USHORT TimeOutValue; - UCHAR TID; - UCHAR Token; - USHORT BaStartSeq; + u8 Wcid; /* */ + u8 pAddr[MAC_ADDR_LEN]; + u8 BaBufSize; + u16 TimeOutValue; + u8 TID; + u8 Token; + u16 BaStartSeq; } MLME_ADDBA_REQ_STRUCT, *PMLME_ADDBA_REQ_STRUCT; typedef struct _MLME_DELBA_REQ_STRUCT { - UCHAR Wcid; /* */ - UCHAR Addr[MAC_ADDR_LEN]; - UCHAR TID; - UCHAR Initiator; + u8 Wcid; /* */ + u8 Addr[MAC_ADDR_LEN]; + u8 TID; + u8 Initiator; } MLME_DELBA_REQ_STRUCT, *PMLME_DELBA_REQ_STRUCT; /* assoc struct is equal to reassoc */ typedef struct _MLME_ASSOC_REQ_STRUCT { - UCHAR Addr[MAC_ADDR_LEN]; - USHORT CapabilityInfo; - USHORT ListenIntv; - ULONG Timeout; + u8 Addr[MAC_ADDR_LEN]; + u16 CapabilityInfo; + u16 ListenIntv; + unsigned long Timeout; } MLME_ASSOC_REQ_STRUCT, *PMLME_ASSOC_REQ_STRUCT, MLME_REASSOC_REQ_STRUCT, *PMLME_REASSOC_REQ_STRUCT; typedef struct _MLME_DISASSOC_REQ_STRUCT { - UCHAR Addr[MAC_ADDR_LEN]; - USHORT Reason; + u8 Addr[MAC_ADDR_LEN]; + u16 Reason; } MLME_DISASSOC_REQ_STRUCT, *PMLME_DISASSOC_REQ_STRUCT; typedef struct _MLME_AUTH_REQ_STRUCT { - UCHAR Addr[MAC_ADDR_LEN]; - USHORT Alg; - ULONG Timeout; + u8 Addr[MAC_ADDR_LEN]; + u16 Alg; + unsigned long Timeout; } MLME_AUTH_REQ_STRUCT, *PMLME_AUTH_REQ_STRUCT; typedef struct _MLME_DEAUTH_REQ_STRUCT { - UCHAR Addr[MAC_ADDR_LEN]; - USHORT Reason; + u8 Addr[MAC_ADDR_LEN]; + u16 Reason; } MLME_DEAUTH_REQ_STRUCT, *PMLME_DEAUTH_REQ_STRUCT; typedef struct { - ULONG BssIdx; + unsigned long BssIdx; } MLME_JOIN_REQ_STRUCT; typedef struct _MLME_SCAN_REQ_STRUCT { - UCHAR Bssid[MAC_ADDR_LEN]; - UCHAR BssType; - UCHAR ScanType; - UCHAR SsidLen; - CHAR Ssid[MAX_LEN_OF_SSID]; + u8 Bssid[MAC_ADDR_LEN]; + u8 BssType; + u8 ScanType; + u8 SsidLen; + char Ssid[MAX_LEN_OF_SSID]; } MLME_SCAN_REQ_STRUCT, *PMLME_SCAN_REQ_STRUCT; typedef struct _MLME_START_REQ_STRUCT { - CHAR Ssid[MAX_LEN_OF_SSID]; - UCHAR SsidLen; + char Ssid[MAX_LEN_OF_SSID]; + u8 SsidLen; } MLME_START_REQ_STRUCT, *PMLME_START_REQ_STRUCT; typedef struct PACKED { - UCHAR Eid; - UCHAR Len; - UCHAR Octet[1]; + u8 Eid; + u8 Len; + u8 Octet[1]; } EID_STRUCT, *PEID_STRUCT, BEACON_EID_STRUCT, *PBEACON_EID_STRUCT; typedef struct PACKED _RTMP_TX_RATE_SWITCH { - UCHAR ItemNo; - UCHAR STBC:1; - UCHAR ShortGI:1; - UCHAR BW:1; - UCHAR Rsv1:1; - UCHAR Mode:2; - UCHAR Rsv2:2; - UCHAR CurrMCS; - UCHAR TrainUp; - UCHAR TrainDown; + u8 ItemNo; + u8 STBC:1; + u8 ShortGI:1; + u8 BW:1; + u8 Rsv1:1; + u8 Mode:2; + u8 Rsv2:2; + u8 CurrMCS; + u8 TrainUp; + u8 TrainDown; } RRTMP_TX_RATE_SWITCH, *PRTMP_TX_RATE_SWITCH; /* ========================== AP mlme.h =============================== */ diff --git a/drivers/staging/rt2860/oid.h b/drivers/staging/rt2860/oid.h index ba721410230a..05a71f027468 100644 --- a/drivers/staging/rt2860/oid.h +++ b/drivers/staging/rt2860/oid.h @@ -135,7 +135,7 @@ typedef enum _NDIS_802_11_STATUS_TYPE { Ndis802_11StatusTypeMax /* not a real type, defined as an upper bound */ } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE; -typedef UCHAR NDIS_802_11_MAC_ADDRESS[6]; +typedef u8 NDIS_802_11_MAC_ADDRESS[6]; typedef struct _NDIS_802_11_STATUS_INDICATION { NDIS_802_11_STATUS_TYPE StatusType; @@ -150,20 +150,20 @@ typedef struct _NDIS_802_11_STATUS_INDICATION { #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST { - ULONG Length; /* Length of structure */ + unsigned long Length; /* Length of structure */ NDIS_802_11_MAC_ADDRESS Bssid; - ULONG Flags; + unsigned long Flags; } NDIS_802_11_AUTHENTICATION_REQUEST, *PNDIS_802_11_AUTHENTICATION_REQUEST; /*Added new types for PMKID Candidate lists. */ typedef struct _PMKID_CANDIDATE { NDIS_802_11_MAC_ADDRESS BSSID; - ULONG Flags; + unsigned long Flags; } PMKID_CANDIDATE, *PPMKID_CANDIDATE; typedef struct _NDIS_802_11_PMKID_CANDIDATE_LIST { - ULONG Version; /* Version of the structure */ - ULONG NumCandidates; /* No. of pmkid candidates */ + unsigned long Version; /* Version of the structure */ + unsigned long NumCandidates; /* No. of pmkid candidates */ PMKID_CANDIDATE CandidateList[1]; } NDIS_802_11_PMKID_CANDIDATE_LIST, *PNDIS_802_11_PMKID_CANDIDATE_LIST; @@ -183,7 +183,7 @@ typedef enum _NDIS_802_11_NETWORK_TYPE { } NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE; typedef struct _NDIS_802_11_NETWORK_TYPE_LIST { - UINT NumberOfItems; /* in list below, at least 1 */ + u32 NumberOfItems; /* in list below, at least 1 */ NDIS_802_11_NETWORK_TYPE NetworkType[1]; } NDIS_802_11_NETWORK_TYPE_LIST, *PNDIS_802_11_NETWORK_TYPE_LIST; @@ -195,30 +195,30 @@ typedef enum _NDIS_802_11_POWER_MODE { Ndis802_11PowerModeMax /* not a real mode, defined as an upper bound */ } NDIS_802_11_POWER_MODE, *PNDIS_802_11_POWER_MODE; -typedef ULONG NDIS_802_11_TX_POWER_LEVEL; /* in milliwatts */ +typedef unsigned long NDIS_802_11_TX_POWER_LEVEL; /* in milliwatts */ /* */ /* Received Signal Strength Indication */ /* */ -typedef LONG NDIS_802_11_RSSI; /* in dBm */ +typedef long NDIS_802_11_RSSI; /* in dBm */ typedef struct _NDIS_802_11_CONFIGURATION_FH { - ULONG Length; /* Length of structure */ - ULONG HopPattern; /* As defined by 802.11, MSB set */ - ULONG HopSet; /* to one if non-802.11 */ - ULONG DwellTime; /* units are Kusec */ + unsigned long Length; /* Length of structure */ + unsigned long HopPattern; /* As defined by 802.11, MSB set */ + unsigned long HopSet; /* to one if non-802.11 */ + unsigned long DwellTime; /* units are Kusec */ } NDIS_802_11_CONFIGURATION_FH, *PNDIS_802_11_CONFIGURATION_FH; typedef struct _NDIS_802_11_CONFIGURATION { - ULONG Length; /* Length of structure */ - ULONG BeaconPeriod; /* units are Kusec */ - ULONG ATIMWindow; /* units are Kusec */ - ULONG DSConfig; /* Frequency, units are kHz */ + unsigned long Length; /* Length of structure */ + unsigned long BeaconPeriod; /* units are Kusec */ + unsigned long ATIMWindow; /* units are Kusec */ + unsigned long DSConfig; /* Frequency, units are kHz */ NDIS_802_11_CONFIGURATION_FH FHConfig; } NDIS_802_11_CONFIGURATION, *PNDIS_802_11_CONFIGURATION; typedef struct _NDIS_802_11_STATISTICS { - ULONG Length; /* Length of structure */ + unsigned long Length; /* Length of structure */ LARGE_INTEGER TransmittedFragmentCount; LARGE_INTEGER MulticastTransmittedFrameCount; LARGE_INTEGER FailedCount; @@ -242,69 +242,69 @@ typedef struct _NDIS_802_11_STATISTICS { LARGE_INTEGER FourWayHandshakeFailures; } NDIS_802_11_STATISTICS, *PNDIS_802_11_STATISTICS; -typedef ULONG NDIS_802_11_KEY_INDEX; -typedef ULONGLONG NDIS_802_11_KEY_RSC; +typedef unsigned long NDIS_802_11_KEY_INDEX; +typedef unsigned long long NDIS_802_11_KEY_RSC; #define MAX_RADIUS_SRV_NUM 2 /* 802.1x failover number */ typedef struct PACKED _RADIUS_SRV_INFO { - UINT32 radius_ip; - UINT32 radius_port; - UCHAR radius_key[64]; - UCHAR radius_key_len; + u32 radius_ip; + u32 radius_port; + u8 radius_key[64]; + u8 radius_key_len; } RADIUS_SRV_INFO, *PRADIUS_SRV_INFO; typedef struct PACKED _RADIUS_KEY_INFO { - UCHAR radius_srv_num; + u8 radius_srv_num; RADIUS_SRV_INFO radius_srv_info[MAX_RADIUS_SRV_NUM]; - UCHAR ieee8021xWEP; /* dynamic WEP */ - UCHAR key_index; - UCHAR key_length; /* length of key in bytes */ - UCHAR key_material[13]; + u8 ieee8021xWEP; /* dynamic WEP */ + u8 key_index; + u8 key_length; /* length of key in bytes */ + u8 key_material[13]; } RADIUS_KEY_INFO, *PRADIUS_KEY_INFO; /* It's used by 802.1x daemon to require relative configuration */ typedef struct PACKED _RADIUS_CONF { - UINT32 Length; /* Length of this structure */ - UCHAR mbss_num; /* indicate multiple BSS number */ - UINT32 own_ip_addr; - UINT32 retry_interval; - UINT32 session_timeout_interval; - UCHAR EAPifname[8][IFNAMSIZ]; - UCHAR EAPifname_len[8]; - UCHAR PreAuthifname[8][IFNAMSIZ]; - UCHAR PreAuthifname_len[8]; + u32 Length; /* Length of this structure */ + u8 mbss_num; /* indicate multiple BSS number */ + u32 own_ip_addr; + u32 retry_interval; + u32 session_timeout_interval; + u8 EAPifname[8][IFNAMSIZ]; + u8 EAPifname_len[8]; + u8 PreAuthifname[8][IFNAMSIZ]; + u8 PreAuthifname_len[8]; RADIUS_KEY_INFO RadiusInfo[8]; } RADIUS_CONF, *PRADIUS_CONF; /* Key mapping keys require a BSSID */ typedef struct _NDIS_802_11_KEY { - UINT Length; /* Length of this structure */ - UINT KeyIndex; - UINT KeyLength; /* length of key in bytes */ + u32 Length; /* Length of this structure */ + u32 KeyIndex; + u32 KeyLength; /* length of key in bytes */ NDIS_802_11_MAC_ADDRESS BSSID; NDIS_802_11_KEY_RSC KeyRSC; - UCHAR KeyMaterial[1]; /* variable length depending on above field */ + u8 KeyMaterial[1]; /* variable length depending on above field */ } NDIS_802_11_KEY, *PNDIS_802_11_KEY; typedef struct _NDIS_802_11_PASSPHRASE { - UINT KeyLength; /* length of key in bytes */ + u32 KeyLength; /* length of key in bytes */ NDIS_802_11_MAC_ADDRESS BSSID; - UCHAR KeyMaterial[1]; /* variable length depending on above field */ + u8 KeyMaterial[1]; /* variable length depending on above field */ } NDIS_802_11_PASSPHRASE, *PNDIS_802_11_PASSPHRASE; typedef struct _NDIS_802_11_REMOVE_KEY { - UINT Length; /* Length of this structure */ - UINT KeyIndex; + u32 Length; /* Length of this structure */ + u32 KeyIndex; NDIS_802_11_MAC_ADDRESS BSSID; } NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY; typedef struct _NDIS_802_11_WEP { - UINT Length; /* Length of this structure */ - UINT KeyIndex; /* 0 is the per-client key, 1-N are the */ + u32 Length; /* Length of this structure */ + u32 KeyIndex; /* 0 is the per-client key, 1-N are the */ /* global keys */ - UINT KeyLength; /* length of key in bytes */ - UCHAR KeyMaterial[1]; /* variable length depending on above field */ + u32 KeyLength; /* length of key in bytes */ + u8 KeyMaterial[1]; /* variable length depending on above field */ } NDIS_802_11_WEP, *PNDIS_802_11_WEP; typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE { @@ -330,21 +330,21 @@ typedef enum _NDIS_802_11_AUTHENTICATION_MODE { Ndis802_11AuthModeMax /* Not a real mode, defined as upper bound */ } NDIS_802_11_AUTHENTICATION_MODE, *PNDIS_802_11_AUTHENTICATION_MODE; -typedef UCHAR NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; /* Set of 8 data rates */ -typedef UCHAR NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; /* Set of 16 data rates */ +typedef u8 NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; /* Set of 8 data rates */ +typedef u8 NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; /* Set of 16 data rates */ typedef struct PACKED _NDIS_802_11_SSID { - UINT SsidLength; /* length of SSID field below, in bytes; */ + u32 SsidLength; /* length of SSID field below, in bytes; */ /* this can be zero. */ - UCHAR Ssid[NDIS_802_11_LENGTH_SSID]; /* SSID information field */ + u8 Ssid[NDIS_802_11_LENGTH_SSID]; /* SSID information field */ } NDIS_802_11_SSID, *PNDIS_802_11_SSID; typedef struct PACKED _NDIS_WLAN_BSSID { - ULONG Length; /* Length of this structure */ + unsigned long Length; /* Length of this structure */ NDIS_802_11_MAC_ADDRESS MacAddress; /* BSSID */ - UCHAR Reserved[2]; + u8 Reserved[2]; NDIS_802_11_SSID Ssid; /* SSID */ - ULONG Privacy; /* WEP encryption requirement */ + unsigned long Privacy; /* WEP encryption requirement */ NDIS_802_11_RSSI Rssi; /* receive signal strength in dBm */ NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; NDIS_802_11_CONFIGURATION Configuration; @@ -353,49 +353,49 @@ typedef struct PACKED _NDIS_WLAN_BSSID { } NDIS_WLAN_BSSID, *PNDIS_WLAN_BSSID; typedef struct PACKED _NDIS_802_11_BSSID_LIST { - UINT NumberOfItems; /* in list below, at least 1 */ + u32 NumberOfItems; /* in list below, at least 1 */ NDIS_WLAN_BSSID Bssid[1]; } NDIS_802_11_BSSID_LIST, *PNDIS_802_11_BSSID_LIST; /* Added Capabilities, IELength and IEs for each BSSID */ typedef struct PACKED _NDIS_WLAN_BSSID_EX { - ULONG Length; /* Length of this structure */ + unsigned long Length; /* Length of this structure */ NDIS_802_11_MAC_ADDRESS MacAddress; /* BSSID */ - UCHAR Reserved[2]; + u8 Reserved[2]; NDIS_802_11_SSID Ssid; /* SSID */ - UINT Privacy; /* WEP encryption requirement */ + u32 Privacy; /* WEP encryption requirement */ NDIS_802_11_RSSI Rssi; /* receive signal */ /* strength in dBm */ NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; NDIS_802_11_CONFIGURATION Configuration; NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; NDIS_802_11_RATES_EX SupportedRates; - ULONG IELength; - UCHAR IEs[1]; + unsigned long IELength; + u8 IEs[1]; } NDIS_WLAN_BSSID_EX, *PNDIS_WLAN_BSSID_EX; typedef struct PACKED _NDIS_802_11_BSSID_LIST_EX { - UINT NumberOfItems; /* in list below, at least 1 */ + u32 NumberOfItems; /* in list below, at least 1 */ NDIS_WLAN_BSSID_EX Bssid[1]; } NDIS_802_11_BSSID_LIST_EX, *PNDIS_802_11_BSSID_LIST_EX; typedef struct PACKED _NDIS_802_11_FIXED_IEs { - UCHAR Timestamp[8]; - USHORT BeaconInterval; - USHORT Capabilities; + u8 Timestamp[8]; + u16 BeaconInterval; + u16 Capabilities; } NDIS_802_11_FIXED_IEs, *PNDIS_802_11_FIXED_IEs; typedef struct _NDIS_802_11_VARIABLE_IEs { - UCHAR ElementID; - UCHAR Length; /* Number of bytes in data field */ - UCHAR data[1]; + u8 ElementID; + u8 Length; /* Number of bytes in data field */ + u8 data[1]; } NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs; -typedef ULONG NDIS_802_11_FRAGMENTATION_THRESHOLD; +typedef unsigned long NDIS_802_11_FRAGMENTATION_THRESHOLD; -typedef ULONG NDIS_802_11_RTS_THRESHOLD; +typedef unsigned long NDIS_802_11_RTS_THRESHOLD; -typedef ULONG NDIS_802_11_ANTENNA; +typedef unsigned long NDIS_802_11_ANTENNA; typedef enum _NDIS_802_11_PRIVACY_FILTER { Ndis802_11PrivFilterAcceptAll, @@ -437,27 +437,27 @@ typedef enum _NDIS_802_11_RELOAD_DEFAULTS { #define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4 typedef struct _NDIS_802_11_AI_REQFI { - USHORT Capabilities; - USHORT ListenInterval; + u16 Capabilities; + u16 ListenInterval; NDIS_802_11_MAC_ADDRESS CurrentAPAddress; } NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI; typedef struct _NDIS_802_11_AI_RESFI { - USHORT Capabilities; - USHORT StatusCode; - USHORT AssociationId; + u16 Capabilities; + u16 StatusCode; + u16 AssociationId; } NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI; typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION { - ULONG Length; - USHORT AvailableRequestFixedIEs; + unsigned long Length; + u16 AvailableRequestFixedIEs; NDIS_802_11_AI_REQFI RequestFixedIEs; - ULONG RequestIELength; - ULONG OffsetRequestIEs; - USHORT AvailableResponseFixedIEs; + unsigned long RequestIELength; + unsigned long OffsetRequestIEs; + u16 AvailableResponseFixedIEs; NDIS_802_11_AI_RESFI ResponseFixedIEs; - ULONG ResponseIELength; - ULONG OffsetResponseIEs; + unsigned long ResponseIELength; + unsigned long OffsetResponseIEs; } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION; typedef struct _NDIS_802_11_AUTHENTICATION_EVENT { @@ -472,7 +472,7 @@ typedef enum _NDIS_802_11_MEDIA_STREAM_MODE { } NDIS_802_11_MEDIA_STREAM_MODE, *PNDIS_802_11_MEDIA_STREAM_MODE; /* PMKID Structures */ -typedef UCHAR NDIS_802_11_PMKID_VALUE[16]; +typedef u8 NDIS_802_11_PMKID_VALUE[16]; typedef struct _BSSID_INFO { NDIS_802_11_MAC_ADDRESS BSSID; @@ -480,8 +480,8 @@ typedef struct _BSSID_INFO { } BSSID_INFO, *PBSSID_INFO; typedef struct _NDIS_802_11_PMKID { - UINT Length; - UINT BSSIDInfoCount; + u32 Length; + u32 BSSIDInfoCount; BSSID_INFO BSSIDInfo[1]; } NDIS_802_11_PMKID, *PNDIS_802_11_PMKID; @@ -492,10 +492,10 @@ typedef struct _NDIS_802_11_AUTHENTICATION_ENCRYPTION { *PNDIS_802_11_AUTHENTICATION_ENCRYPTION; typedef struct _NDIS_802_11_CAPABILITY { - ULONG Length; - ULONG Version; - ULONG NoOfPMKIDs; - ULONG NoOfAuthEncryptPairsSupported; + unsigned long Length; + unsigned long Version; + unsigned long NoOfPMKIDs; + unsigned long NoOfAuthEncryptPairsSupported; NDIS_802_11_AUTHENTICATION_ENCRYPTION AuthenticationEncryptionSupported[1]; } NDIS_802_11_CAPABILITY, *PNDIS_802_11_CAPABILITY; @@ -561,16 +561,16 @@ enum { /* MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!! */ typedef union _HTTRANSMIT_SETTING { struct { - USHORT MCS:7; /* MCS */ - USHORT BW:1; /*channel bandwidth 20MHz or 40 MHz */ - USHORT ShortGI:1; - USHORT STBC:2; /*SPACE */ -/* USHORT rsv:3; */ - USHORT rsv:2; - USHORT TxBF:1; - USHORT MODE:2; /* Use definition MODE_xxx. */ + u16 MCS:7; /* MCS */ + u16 BW:1; /*channel bandwidth 20MHz or 40 MHz */ + u16 ShortGI:1; + u16 STBC:2; /*SPACE */ +/* u16 rsv:3; */ + u16 rsv:2; + u16 TxBF:1; + u16 MODE:2; /* Use definition MODE_xxx. */ } field; - USHORT word; + u16 word; } HTTRANSMIT_SETTING, *PHTTRANSMIT_SETTING; typedef enum _RT_802_11_PREAMBLE { @@ -596,122 +596,122 @@ typedef enum _RT_802_11_PHY_MODE { /* put all proprietery for-query objects here to reduce # of Query_OID */ typedef struct _RT_802_11_LINK_STATUS { - ULONG CurrTxRate; /* in units of 0.5Mbps */ - ULONG ChannelQuality; /* 0..100 % */ - ULONG TxByteCount; /* both ok and fail */ - ULONG RxByteCount; /* both ok and fail */ - ULONG CentralChannel; /* 40MHz central channel number */ + unsigned long CurrTxRate; /* in units of 0.5Mbps */ + unsigned long ChannelQuality; /* 0..100 % */ + unsigned long TxByteCount; /* both ok and fail */ + unsigned long RxByteCount; /* both ok and fail */ + unsigned long CentralChannel; /* 40MHz central channel number */ } RT_802_11_LINK_STATUS, *PRT_802_11_LINK_STATUS; typedef struct _RT_802_11_EVENT_LOG { LARGE_INTEGER SystemTime; /* timestammp via NdisGetCurrentSystemTime() */ - UCHAR Addr[MAC_ADDR_LENGTH]; - USHORT Event; /* EVENT_xxx */ + u8 Addr[MAC_ADDR_LENGTH]; + u16 Event; /* EVENT_xxx */ } RT_802_11_EVENT_LOG, *PRT_802_11_EVENT_LOG; typedef struct _RT_802_11_EVENT_TABLE { - ULONG Num; - ULONG Rsv; /* to align Log[] at LARGE_INEGER boundary */ + unsigned long Num; + unsigned long Rsv; /* to align Log[] at LARGE_INEGER boundary */ RT_802_11_EVENT_LOG Log[MAX_NUMBER_OF_EVENT]; } RT_802_11_EVENT_TABLE, PRT_802_11_EVENT_TABLE; /* MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!! */ typedef union _MACHTTRANSMIT_SETTING { struct { - USHORT MCS:7; /* MCS */ - USHORT BW:1; /*channel bandwidth 20MHz or 40 MHz */ - USHORT ShortGI:1; - USHORT STBC:2; /*SPACE */ - USHORT rsv:3; - USHORT MODE:2; /* Use definition MODE_xxx. */ + u16 MCS:7; /* MCS */ + u16 BW:1; /*channel bandwidth 20MHz or 40 MHz */ + u16 ShortGI:1; + u16 STBC:2; /*SPACE */ + u16 rsv:3; + u16 MODE:2; /* Use definition MODE_xxx. */ } field; - USHORT word; + u16 word; } MACHTTRANSMIT_SETTING, *PMACHTTRANSMIT_SETTING; typedef struct _RT_802_11_MAC_ENTRY { - UCHAR Addr[MAC_ADDR_LENGTH]; - UCHAR Aid; - UCHAR Psm; /* 0:PWR_ACTIVE, 1:PWR_SAVE */ - UCHAR MimoPs; /* 0:MMPS_STATIC, 1:MMPS_DYNAMIC, 3:MMPS_Enabled */ - CHAR AvgRssi0; - CHAR AvgRssi1; - CHAR AvgRssi2; - UINT32 ConnectedTime; + u8 Addr[MAC_ADDR_LENGTH]; + u8 Aid; + u8 Psm; /* 0:PWR_ACTIVE, 1:PWR_SAVE */ + u8 MimoPs; /* 0:MMPS_STATIC, 1:MMPS_DYNAMIC, 3:MMPS_Enabled */ + char AvgRssi0; + char AvgRssi1; + char AvgRssi2; + u32 ConnectedTime; MACHTTRANSMIT_SETTING TxRate; } RT_802_11_MAC_ENTRY, *PRT_802_11_MAC_ENTRY; typedef struct _RT_802_11_MAC_TABLE { - ULONG Num; + unsigned long Num; RT_802_11_MAC_ENTRY Entry[MAX_NUMBER_OF_MAC]; } RT_802_11_MAC_TABLE, *PRT_802_11_MAC_TABLE; /* structure for query/set hardware register - MAC, BBP, RF register */ typedef struct _RT_802_11_HARDWARE_REGISTER { - ULONG HardwareType; /* 0:MAC, 1:BBP, 2:RF register, 3:EEPROM */ - ULONG Offset; /* Q/S register offset addr */ - ULONG Data; /* R/W data buffer */ + unsigned long HardwareType; /* 0:MAC, 1:BBP, 2:RF register, 3:EEPROM */ + unsigned long Offset; /* Q/S register offset addr */ + unsigned long Data; /* R/W data buffer */ } RT_802_11_HARDWARE_REGISTER, *PRT_802_11_HARDWARE_REGISTER; typedef struct _RT_802_11_AP_CONFIG { - ULONG EnableTxBurst; /* 0-disable, 1-enable */ - ULONG EnableTurboRate; /* 0-disable, 1-enable 72/100mbps turbo rate */ - ULONG IsolateInterStaTraffic; /* 0-disable, 1-enable isolation */ - ULONG HideSsid; /* 0-disable, 1-enable hiding */ - ULONG UseBGProtection; /* 0-AUTO, 1-always ON, 2-always OFF */ - ULONG UseShortSlotTime; /* 0-no use, 1-use 9-us short slot time */ - ULONG Rsv1; /* must be 0 */ - ULONG SystemErrorBitmap; /* ignore upon SET, return system error upon QUERY */ + unsigned long EnableTxBurst; /* 0-disable, 1-enable */ + unsigned long EnableTurboRate; /* 0-disable, 1-enable 72/100mbps turbo rate */ + unsigned long IsolateInterStaTraffic; /* 0-disable, 1-enable isolation */ + unsigned long HideSsid; /* 0-disable, 1-enable hiding */ + unsigned long UseBGProtection; /* 0-AUTO, 1-always ON, 2-always OFF */ + unsigned long UseShortSlotTime; /* 0-no use, 1-use 9-us short slot time */ + unsigned long Rsv1; /* must be 0 */ + unsigned long SystemErrorBitmap; /* ignore upon SET, return system error upon QUERY */ } RT_802_11_AP_CONFIG, *PRT_802_11_AP_CONFIG; /* structure to query/set STA_CONFIG */ typedef struct _RT_802_11_STA_CONFIG { - ULONG EnableTxBurst; /* 0-disable, 1-enable */ - ULONG EnableTurboRate; /* 0-disable, 1-enable 72/100mbps turbo rate */ - ULONG UseBGProtection; /* 0-AUTO, 1-always ON, 2-always OFF */ - ULONG UseShortSlotTime; /* 0-no use, 1-use 9-us short slot time when applicable */ - ULONG AdhocMode; /* 0-11b rates only (WIFI spec), 1 - b/g mixed, 2 - g only */ - ULONG HwRadioStatus; /* 0-OFF, 1-ON, default is 1, Read-Only */ - ULONG Rsv1; /* must be 0 */ - ULONG SystemErrorBitmap; /* ignore upon SET, return system error upon QUERY */ + unsigned long EnableTxBurst; /* 0-disable, 1-enable */ + unsigned long EnableTurboRate; /* 0-disable, 1-enable 72/100mbps turbo rate */ + unsigned long UseBGProtection; /* 0-AUTO, 1-always ON, 2-always OFF */ + unsigned long UseShortSlotTime; /* 0-no use, 1-use 9-us short slot time when applicable */ + unsigned long AdhocMode; /* 0-11b rates only (WIFI spec), 1 - b/g mixed, 2 - g only */ + unsigned long HwRadioStatus; /* 0-OFF, 1-ON, default is 1, Read-Only */ + unsigned long Rsv1; /* must be 0 */ + unsigned long SystemErrorBitmap; /* ignore upon SET, return system error upon QUERY */ } RT_802_11_STA_CONFIG, *PRT_802_11_STA_CONFIG; /* */ /* For OID Query or Set about BA structure */ /* */ typedef struct _OID_BACAP_STRUC { - UCHAR RxBAWinLimit; - UCHAR TxBAWinLimit; - UCHAR Policy; /* 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid */ - UCHAR MpduDensity; /* 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid */ - UCHAR AmsduEnable; /*Enable AMSDU transmisstion */ - UCHAR AmsduSize; /* 0:3839, 1:7935 bytes. UINT MSDUSizeToBytes[] = { 3839, 7935}; */ - UCHAR MMPSmode; /* MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable */ + u8 RxBAWinLimit; + u8 TxBAWinLimit; + u8 Policy; /* 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid */ + u8 MpduDensity; /* 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid */ + u8 AmsduEnable; /*Enable AMSDU transmisstion */ + u8 AmsduSize; /* 0:3839, 1:7935 bytes. u32 MSDUSizeToBytes[] = { 3839, 7935}; */ + u8 MMPSmode; /* MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable */ BOOLEAN AutoBA; /* Auto BA will automatically */ } OID_BACAP_STRUC, *POID_BACAP_STRUC; typedef struct _RT_802_11_ACL_ENTRY { - UCHAR Addr[MAC_ADDR_LENGTH]; - USHORT Rsv; + u8 Addr[MAC_ADDR_LENGTH]; + u16 Rsv; } RT_802_11_ACL_ENTRY, *PRT_802_11_ACL_ENTRY; typedef struct PACKED _RT_802_11_ACL { - ULONG Policy; /* 0-disable, 1-positive list, 2-negative list */ - ULONG Num; + unsigned long Policy; /* 0-disable, 1-positive list, 2-negative list */ + unsigned long Num; RT_802_11_ACL_ENTRY Entry[MAX_NUMBER_OF_ACL]; } RT_802_11_ACL, *PRT_802_11_ACL; typedef struct _RT_802_11_WDS { - ULONG Num; + unsigned long Num; NDIS_802_11_MAC_ADDRESS Entry[24 /*MAX_NUM_OF_WDS_LINK */ ]; - ULONG KeyLength; - UCHAR KeyMaterial[32]; + unsigned long KeyLength; + u8 KeyMaterial[32]; } RT_802_11_WDS, *PRT_802_11_WDS; typedef struct _RT_802_11_TX_RATES_ { - UCHAR SupRateLen; - UCHAR SupRate[MAX_LENGTH_OF_SUPPORT_RATES]; - UCHAR ExtRateLen; - UCHAR ExtRate[MAX_LENGTH_OF_SUPPORT_RATES]; + u8 SupRateLen; + u8 SupRate[MAX_LENGTH_OF_SUPPORT_RATES]; + u8 ExtRateLen; + u8 ExtRate[MAX_LENGTH_OF_SUPPORT_RATES]; } RT_802_11_TX_RATES, *PRT_802_11_TX_RATES; /* Definition of extra information code */ @@ -734,14 +734,14 @@ typedef struct _RT_802_11_TX_RATES_ { /* This is OID setting structure. So only GF or MM as Mode. This is valid when our wirelss mode has 802.11n in use. */ typedef struct { RT_802_11_PHY_MODE PhyMode; /* */ - UCHAR TransmitNo; - UCHAR HtMode; /*HTMODE_GF or HTMODE_MM */ - UCHAR ExtOffset; /*extension channel above or below */ - UCHAR MCS; - UCHAR BW; - UCHAR STBC; - UCHAR SHORTGI; - UCHAR rsv; + u8 TransmitNo; + u8 HtMode; /*HTMODE_GF or HTMODE_MM */ + u8 ExtOffset; /*extension channel above or below */ + u8 MCS; + u8 BW; + u8 STBC; + u8 SHORTGI; + u8 rsv; } OID_SET_HT_PHYMODE, *POID_SET_HT_PHYMODE; #define MAX_CUSTOM_LEN 128 @@ -753,26 +753,26 @@ typedef enum _RT_802_11_D_CLIENT_MODE { } RT_802_11_D_CLIENT_MODE, *PRT_802_11_D_CLIENT_MODE; typedef struct _RT_CHANNEL_LIST_INFO { - UCHAR ChannelList[MAX_NUM_OF_CHS]; /* list all supported channels for site survey */ - UCHAR ChannelListNum; /* number of channel in ChannelList[] */ + u8 ChannelList[MAX_NUM_OF_CHS]; /* list all supported channels for site survey */ + u8 ChannelListNum; /* number of channel in ChannelList[] */ } RT_CHANNEL_LIST_INFO, *PRT_CHANNEL_LIST_INFO; /* WSC configured credential */ typedef struct _WSC_CREDENTIAL { NDIS_802_11_SSID SSID; /* mandatory */ - USHORT AuthType; /* mandatory, 1: open, 2: wpa-psk, 4: shared, 8:wpa, 0x10: wpa2, 0x20: wpa2-psk */ - USHORT EncrType; /* mandatory, 1: none, 2: wep, 4: tkip, 8: aes */ - UCHAR Key[64]; /* mandatory, Maximum 64 byte */ - USHORT KeyLength; - UCHAR MacAddr[6]; /* mandatory, AP MAC address */ - UCHAR KeyIndex; /* optional, default is 1 */ - UCHAR Rsvd[3]; /* Make alignment */ + u16 AuthType; /* mandatory, 1: open, 2: wpa-psk, 4: shared, 8:wpa, 0x10: wpa2, 0x20: wpa2-psk */ + u16 EncrType; /* mandatory, 1: none, 2: wep, 4: tkip, 8: aes */ + u8 Key[64]; /* mandatory, Maximum 64 byte */ + u16 KeyLength; + u8 MacAddr[6]; /* mandatory, AP MAC address */ + u8 KeyIndex; /* optional, default is 1 */ + u8 Rsvd[3]; /* Make alignment */ } WSC_CREDENTIAL, *PWSC_CREDENTIAL; /* WSC configured profiles */ typedef struct _WSC_PROFILE { - UINT ProfileCnt; - UINT ApplyProfileIdx; /* add by johnli, fix WPS test plan 5.1.1 */ + u32 ProfileCnt; + u32 ApplyProfileIdx; /* add by johnli, fix WPS test plan 5.1.1 */ WSC_CREDENTIAL Profile[8]; /* Support up to 8 profiles */ } WSC_PROFILE, *PWSC_PROFILE; diff --git a/drivers/staging/rt2860/pci_main_dev.c b/drivers/staging/rt2860/pci_main_dev.c index 76c71f1882f3..24f939ddd446 100644 --- a/drivers/staging/rt2860/pci_main_dev.c +++ b/drivers/staging/rt2860/pci_main_dev.c @@ -52,13 +52,13 @@ MODULE_ALIAS("rt3090sta"); extern int rt28xx_close(IN struct net_device *net_dev); extern int rt28xx_open(struct net_device *net_dev); -static VOID __devexit rt2860_remove_one(struct pci_dev *pci_dev); -static INT __devinit rt2860_probe(struct pci_dev *pci_dev, +static void __devexit rt2860_remove_one(struct pci_dev *pci_dev); +static int __devinit rt2860_probe(struct pci_dev *pci_dev, const struct pci_device_id *ent); static void __exit rt2860_cleanup_module(void); static int __init rt2860_init_module(void); -static VOID RTMPInitPCIeDevice(IN struct pci_dev *pci_dev, +static void RTMPInitPCIeDevice(IN struct pci_dev *pci_dev, IN PRTMP_ADAPTER pAd); #ifdef CONFIG_PM @@ -123,7 +123,7 @@ resume:rt2860_resume, ***************************************************************************/ #ifdef CONFIG_PM -VOID RT2860RejectPendingPackets(IN PRTMP_ADAPTER pAd) +void RT2860RejectPendingPackets(IN PRTMP_ADAPTER pAd) { /* clear PS packets */ /* clear TxSw packets */ @@ -133,7 +133,7 @@ static int rt2860_suspend(struct pci_dev *pci_dev, pm_message_t state) { struct net_device *net_dev = pci_get_drvdata(pci_dev); PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) NULL; - INT32 retval = 0; + int retval = 0; DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_suspend()\n")); @@ -185,7 +185,7 @@ static int rt2860_resume(struct pci_dev *pci_dev) { struct net_device *net_dev = pci_get_drvdata(pci_dev); PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) NULL; - INT32 retval; + int retval; /* set the power state of a PCI device */ /* PCI has 4 power states, DO (normal) ~ D3(less power) */ @@ -246,7 +246,7 @@ static int rt2860_resume(struct pci_dev *pci_dev) } #endif /* CONFIG_PM // */ -static INT __init rt2860_init_module(VOID) +static int __init rt2860_init_module(void) { return pci_register_driver(&rt2860_driver); } @@ -254,7 +254,7 @@ static INT __init rt2860_init_module(VOID) /* */ /* Driver module unload function */ /* */ -static VOID __exit rt2860_cleanup_module(VOID) +static void __exit rt2860_cleanup_module(void) { pci_unregister_driver(&rt2860_driver); } @@ -265,15 +265,15 @@ module_exit(rt2860_cleanup_module); /* */ /* PCI device probe & initialization function */ /* */ -static INT __devinit rt2860_probe(IN struct pci_dev *pci_dev, +static int __devinit rt2860_probe(IN struct pci_dev *pci_dev, IN const struct pci_device_id *pci_id) { PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) NULL; struct net_device *net_dev; - PVOID handle; - PSTRING print_name; - ULONG csr_addr; - INT rv = 0; + void *handle; + char *print_name; + unsigned long csr_addr; + int rv = 0; RTMP_OS_NETDEV_OP_HOOK netDevHook; DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_probe\n")); @@ -286,7 +286,7 @@ static INT __devinit rt2860_probe(IN struct pci_dev *pci_dev, return rv; } - print_name = (PSTRING) pci_name(pci_dev); + print_name = (char *)pci_name(pci_dev); if ((rv = pci_request_regions(pci_dev, print_name)) != 0) { DBGPRINT(RT_DEBUG_ERROR, @@ -300,14 +300,14 @@ static INT __devinit rt2860_probe(IN struct pci_dev *pci_dev, if (!csr_addr) { DBGPRINT(RT_DEBUG_ERROR, ("ioremap failed for device %s, region 0x%lX @ 0x%lX\n", - print_name, (ULONG) pci_resource_len(pci_dev, 0), - (ULONG) pci_resource_start(pci_dev, 0))); + print_name, (unsigned long)pci_resource_len(pci_dev, 0), + (unsigned long)pci_resource_start(pci_dev, 0))); goto err_out_free_res; } else { DBGPRINT(RT_DEBUG_TRACE, ("%s: at 0x%lx, VA 0x%lx, IRQ %d. \n", print_name, - (ULONG) pci_resource_start(pci_dev, 0), - (ULONG) csr_addr, pci_dev->irq)); + (unsigned long)pci_resource_start(pci_dev, 0), + (unsigned long)csr_addr, pci_dev->irq)); } /* Set DMA master */ @@ -329,10 +329,10 @@ static INT __devinit rt2860_probe(IN struct pci_dev *pci_dev, if (rv != NDIS_STATUS_SUCCESS) goto err_out_iounmap; /* Here are the RTMP_ADAPTER structure with pci-bus specific parameters. */ - pAd->CSRBaseAddress = (PUCHAR) csr_addr; + pAd->CSRBaseAddress = (u8 *)csr_addr; DBGPRINT(RT_DEBUG_ERROR, ("pAd->CSRBaseAddress =0x%lx, csr_addr=0x%lx!\n", - (ULONG) pAd->CSRBaseAddress, csr_addr)); + (unsigned long)pAd->CSRBaseAddress, csr_addr)); RtmpRaDevCtrlInit(pAd, RTMP_DEV_INF_PCI); /*NetDevInit============================================== */ @@ -389,11 +389,11 @@ err_out: return -ENODEV; /* probe fail */ } -static VOID __devexit rt2860_remove_one(IN struct pci_dev *pci_dev) +static void __devexit rt2860_remove_one(IN struct pci_dev *pci_dev) { PNET_DEV net_dev = pci_get_drvdata(pci_dev); RTMP_ADAPTER *pAd = NULL; - ULONG csr_addr = net_dev->base_addr; /* pAd->CSRBaseAddress; */ + unsigned long csr_addr = net_dev->base_addr; /* pAd->CSRBaseAddress; */ GET_PAD_FROM_NET_DEV(pAd, net_dev); @@ -456,9 +456,9 @@ BOOLEAN RT28XXChipsetCheck(IN void *_dev_p) * PCIe device initialization related procedures. * ***************************************************************************/ -static VOID RTMPInitPCIeDevice(IN struct pci_dev *pci_dev, IN PRTMP_ADAPTER pAd) +static void RTMPInitPCIeDevice(IN struct pci_dev *pci_dev, IN PRTMP_ADAPTER pAd) { - USHORT device_id; + u16 device_id; POS_COOKIE pObj; pObj = (POS_COOKIE) pAd->OS_Cookie; @@ -477,7 +477,7 @@ static VOID RTMPInitPCIeDevice(IN struct pci_dev *pci_dev, IN PRTMP_ADAPTER pAd) (device_id == NIC3092_PCIe_DEVICE_ID) || #endif /* RT3090 // */ 0) { - UINT32 MacCsr0 = 0, Index = 0; + u32 MacCsr0 = 0, Index = 0; do { RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0); @@ -495,11 +495,11 @@ static VOID RTMPInitPCIeDevice(IN struct pci_dev *pci_dev, IN PRTMP_ADAPTER pAd) } } -VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) +void RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) { - INT pos; - USHORT reg16, data2, PCIePowerSaveLevel, Configuration; - UINT32 MacValue; + int pos; + u16 reg16, data2, PCIePowerSaveLevel, Configuration; + u32 MacValue; BOOLEAN bFindIntel = FALSE; POS_COOKIE pObj; @@ -536,7 +536,7 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) ("====> Write 0x83 = 0x%x.\n", PCIePowerSaveLevel)); AsicSendCommandToMcu(pAd, 0x83, 0xff, - (UCHAR) PCIePowerSaveLevel, 0x00); + (u8)PCIePowerSaveLevel, 0x00); RT28xx_EEPROM_READ16(pAd, 0x22, PCIePowerSaveLevel); PCIePowerSaveLevel &= 0xff; PCIePowerSaveLevel = PCIePowerSaveLevel >> 6; @@ -570,7 +570,7 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) PCIePowerSaveLevel)); AsicSendCommandToMcu(pAd, 0x83, 0xff, - (UCHAR) PCIePowerSaveLevel, + (u8)PCIePowerSaveLevel, 0x00); } DBGPRINT(RT_DEBUG_TRACE, @@ -578,7 +578,7 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) pAd->LnkCtrlBitMask)); } } else if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) { - UCHAR LinkCtrlSetting = 0; + u8 LinkCtrlSetting = 0; /* Check 3090E special setting chip. */ RT28xx_EEPROM_READ16(pAd, 0x24, data2); @@ -630,7 +630,7 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) /* 1. read setting from inf file. */ PCIePowerSaveLevel = - (USHORT) pAd->StaCfg.PSControl.field.rt30xxPowerMode; + (u16)pAd->StaCfg.PSControl.field.rt30xxPowerMode; DBGPRINT(RT_DEBUG_ERROR, ("====> rt30xx Read PowerLevelMode = 0x%x.\n", PCIePowerSaveLevel)); @@ -642,13 +642,13 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) && (pAd->b3090ESpecialChip == FALSE)) { /* Chip Version E only allow 1, So force set 1. */ PCIePowerSaveLevel &= 0x1; - pAd->PCIePowerSaveLevel = (USHORT) PCIePowerSaveLevel; + pAd->PCIePowerSaveLevel = (u16)PCIePowerSaveLevel; DBGPRINT(RT_DEBUG_TRACE, ("====> rt30xx E Write 0x83 Command = 0x%x.\n", PCIePowerSaveLevel)); AsicSendCommandToMcu(pAd, 0x83, 0xff, - (UCHAR) PCIePowerSaveLevel, 0x00); + (u8)PCIePowerSaveLevel, 0x00); } else { /* Chip Version F and after only allow 1 or 2 or 3. This might be modified after new chip version come out. */ if (! @@ -658,7 +658,7 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_ERROR, ("====> rt30xx F Write 0x83 Command = 0x%x.\n", PCIePowerSaveLevel)); - pAd->PCIePowerSaveLevel = (USHORT) PCIePowerSaveLevel; + pAd->PCIePowerSaveLevel = (u16)PCIePowerSaveLevel; /* for 3090F , we need to add high-byte arg for 0x83 command to indicate the link control setting in */ /* PCI Configuration Space. Because firmware can't read PCI Configuration Space */ if ((pAd->Rt3xxRalinkLinkCtrl & 0x2) @@ -669,7 +669,7 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) ("====> rt30xxF LinkCtrlSetting = 0x%x.\n", LinkCtrlSetting)); AsicSendCommandToMcu(pAd, 0x83, 0xff, - (UCHAR) PCIePowerSaveLevel, + (u8)PCIePowerSaveLevel, LinkCtrlSetting); } } @@ -702,7 +702,7 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) RTMPFindHostPCIDev(pAd); if (pObj->parent_pci_dev) { - USHORT vendor_id; + u16 vendor_id; pci_read_config_word(pObj->parent_pci_dev, PCI_VENDOR_ID, &vendor_id); @@ -810,11 +810,11 @@ VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) } } -VOID RTMPFindHostPCIDev(IN PRTMP_ADAPTER pAd) +void RTMPFindHostPCIDev(IN PRTMP_ADAPTER pAd) { - USHORT reg16; - UCHAR reg8; - UINT DevFn; + u16 reg16; + u8 reg8; + u32 DevFn; PPCI_DEV pPci_dev; POS_COOKIE pObj; @@ -856,10 +856,10 @@ VOID RTMPFindHostPCIDev(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID RTMPPCIeLinkCtrlValueRestore(IN PRTMP_ADAPTER pAd, IN UCHAR Level) +void RTMPPCIeLinkCtrlValueRestore(IN PRTMP_ADAPTER pAd, u8 Level) { - USHORT PCIePowerSaveLevel, reg16; - USHORT Configuration; + u16 PCIePowerSaveLevel, reg16; + u16 Configuration; POS_COOKIE pObj; pObj = (POS_COOKIE) pAd->OS_Cookie; @@ -950,10 +950,10 @@ VOID RTMPPCIeLinkCtrlValueRestore(IN PRTMP_ADAPTER pAd, IN UCHAR Level) ======================================================================== */ -VOID RTMPPCIeLinkCtrlSetting(IN PRTMP_ADAPTER pAd, IN USHORT Max) +void RTMPPCIeLinkCtrlSetting(IN PRTMP_ADAPTER pAd, u16 Max) { - USHORT PCIePowerSaveLevel, reg16; - USHORT Configuration; + u16 PCIePowerSaveLevel, reg16; + u16 Configuration; POS_COOKIE pObj; pObj = (POS_COOKIE) pAd->OS_Cookie; @@ -1076,14 +1076,14 @@ VOID RTMPPCIeLinkCtrlSetting(IN PRTMP_ADAPTER pAd, IN USHORT Max) ======================================================================== */ -VOID RTMPrt3xSetPCIePowerLinkCtrl(IN PRTMP_ADAPTER pAd) +void RTMPrt3xSetPCIePowerLinkCtrl(IN PRTMP_ADAPTER pAd) { - ULONG HostConfiguration = 0; - ULONG Configuration; + unsigned long HostConfiguration = 0; + unsigned long Configuration; POS_COOKIE pObj; - INT pos; - USHORT reg16; + int pos; + u16 reg16; pObj = (POS_COOKIE) pAd->OS_Cookie; diff --git a/drivers/staging/rt2860/rt_linux.c b/drivers/staging/rt2860/rt_linux.c index 8413998b91e1..5f781f532815 100644 --- a/drivers/staging/rt2860/rt_linux.c +++ b/drivers/staging/rt2860/rt_linux.c @@ -28,7 +28,7 @@ #include #include "rt_config.h" -ULONG RTDebugLevel = RT_DEBUG_ERROR; +unsigned long RTDebugLevel = RT_DEBUG_ERROR; /* for wireless system event message */ char const *pWirelessSysEventText[IW_SYS_EVENT_TYPE_NUM] = { @@ -80,7 +80,7 @@ char const *pWirelessFloodEventText[IW_FLOOD_EVENT_TYPE_NUM] = { }; /* timeout -- ms */ -VOID RTMP_SetPeriodicTimer(IN NDIS_MINIPORT_TIMER * pTimer, +void RTMP_SetPeriodicTimer(IN NDIS_MINIPORT_TIMER * pTimer, IN unsigned long timeout) { timeout = ((timeout * OS_HZ) / 1000); @@ -89,16 +89,16 @@ VOID RTMP_SetPeriodicTimer(IN NDIS_MINIPORT_TIMER * pTimer, } /* convert NdisMInitializeTimer --> RTMP_OS_Init_Timer */ -VOID RTMP_OS_Init_Timer(IN PRTMP_ADAPTER pAd, +void RTMP_OS_Init_Timer(IN PRTMP_ADAPTER pAd, IN NDIS_MINIPORT_TIMER * pTimer, - IN TIMER_FUNCTION function, IN PVOID data) + IN TIMER_FUNCTION function, void *data) { init_timer(pTimer); pTimer->data = (unsigned long)data; pTimer->function = function; } -VOID RTMP_OS_Add_Timer(IN NDIS_MINIPORT_TIMER * pTimer, +void RTMP_OS_Add_Timer(IN NDIS_MINIPORT_TIMER * pTimer, IN unsigned long timeout) { if (timer_pending(pTimer)) @@ -109,14 +109,14 @@ VOID RTMP_OS_Add_Timer(IN NDIS_MINIPORT_TIMER * pTimer, add_timer(pTimer); } -VOID RTMP_OS_Mod_Timer(IN NDIS_MINIPORT_TIMER * pTimer, +void RTMP_OS_Mod_Timer(IN NDIS_MINIPORT_TIMER * pTimer, IN unsigned long timeout) { timeout = ((timeout * OS_HZ) / 1000); mod_timer(pTimer, jiffies + timeout); } -VOID RTMP_OS_Del_Timer(IN NDIS_MINIPORT_TIMER * pTimer, +void RTMP_OS_Del_Timer(IN NDIS_MINIPORT_TIMER * pTimer, OUT BOOLEAN * pCancelled) { if (timer_pending(pTimer)) { @@ -127,15 +127,15 @@ VOID RTMP_OS_Del_Timer(IN NDIS_MINIPORT_TIMER * pTimer, } -VOID RTMP_OS_Release_Packet(IN PRTMP_ADAPTER pAd, IN PQUEUE_ENTRY pEntry) +void RTMP_OS_Release_Packet(IN PRTMP_ADAPTER pAd, IN PQUEUE_ENTRY pEntry) { /*RTMPFreeNdisPacket(pAd, (struct sk_buff *)pEntry); */ } /* Unify all delay routine by using udelay */ -VOID RTMPusecDelay(IN ULONG usec) +void RTMPusecDelay(unsigned long usec) { - ULONG i; + unsigned long i; for (i = 0; i < (usec / 50); i++) udelay(50); @@ -150,9 +150,9 @@ void RTMP_GetCurrentSystemTime(LARGE_INTEGER * time) } /* pAd MUST allow to be NULL */ -NDIS_STATUS os_alloc_mem(IN RTMP_ADAPTER * pAd, OUT UCHAR ** mem, IN ULONG size) +int os_alloc_mem(IN RTMP_ADAPTER * pAd, u8 ** mem, unsigned long size) { - *mem = (PUCHAR) kmalloc(size, GFP_ATOMIC); + *mem = (u8 *)kmalloc(size, GFP_ATOMIC); if (*mem) return (NDIS_STATUS_SUCCESS); else @@ -160,7 +160,7 @@ NDIS_STATUS os_alloc_mem(IN RTMP_ADAPTER * pAd, OUT UCHAR ** mem, IN ULONG size) } /* pAd MUST allow to be NULL */ -NDIS_STATUS os_free_mem(IN PRTMP_ADAPTER pAd, IN PVOID mem) +int os_free_mem(IN PRTMP_ADAPTER pAd, void *mem) { ASSERT(mem); @@ -178,7 +178,7 @@ PNDIS_PACKET RtmpOSNetPktAlloc(IN RTMP_ADAPTER * pAd, IN int size) } PNDIS_PACKET RTMP_AllocateFragPacketBuffer(IN PRTMP_ADAPTER pAd, - IN ULONG Length) + unsigned long Length) { struct sk_buff *pkt; @@ -197,9 +197,9 @@ PNDIS_PACKET RTMP_AllocateFragPacketBuffer(IN PRTMP_ADAPTER pAd, } PNDIS_PACKET RTMP_AllocateTxPacketBuffer(IN PRTMP_ADAPTER pAd, - IN ULONG Length, + unsigned long Length, IN BOOLEAN Cached, - OUT PVOID * VirtualAddress) + void ** VirtualAddress) { struct sk_buff *pkt; @@ -212,17 +212,17 @@ PNDIS_PACKET RTMP_AllocateTxPacketBuffer(IN PRTMP_ADAPTER pAd, if (pkt) { RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pkt), PKTSRC_NDIS); - *VirtualAddress = (PVOID) pkt->data; + *VirtualAddress = (void *)pkt->data; } else { - *VirtualAddress = (PVOID) NULL; + *VirtualAddress = (void *)NULL; } return (PNDIS_PACKET) pkt; } -VOID build_tx_packet(IN PRTMP_ADAPTER pAd, +void build_tx_packet(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket, - IN PUCHAR pFrame, IN ULONG FrameLen) + u8 *pFrame, unsigned long FrameLen) { struct sk_buff *pTxPkt; @@ -233,7 +233,7 @@ VOID build_tx_packet(IN PRTMP_ADAPTER pAd, NdisMoveMemory(skb_put(pTxPkt, FrameLen), pFrame, FrameLen); } -VOID RTMPFreeAdapter(IN PRTMP_ADAPTER pAd) +void RTMPFreeAdapter(IN PRTMP_ADAPTER pAd) { POS_COOKIE os_cookie; int index; @@ -292,7 +292,7 @@ BOOLEAN OS_Need_Clone_Packet(void) ======================================================================== */ -NDIS_STATUS RTMPCloneNdisPacket(IN PRTMP_ADAPTER pAd, +int RTMPCloneNdisPacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN pInsAMSDUHdr, IN PNDIS_PACKET pInPacket, OUT PNDIS_PACKET * ppOutPacket) @@ -323,11 +323,11 @@ NDIS_STATUS RTMPCloneNdisPacket(IN PRTMP_ADAPTER pAd, } /* the allocated NDIS PACKET must be freed via RTMPFreeNdisPacket() */ -NDIS_STATUS RTMPAllocateNdisPacket(IN PRTMP_ADAPTER pAd, +int RTMPAllocateNdisPacket(IN PRTMP_ADAPTER pAd, OUT PNDIS_PACKET * ppPacket, - IN PUCHAR pHeader, - IN UINT HeaderLen, - IN PUCHAR pData, IN UINT DataLen) + u8 *pHeader, + u32 HeaderLen, + u8 *pData, u32 DataLen) { PNDIS_PACKET pPacket; ASSERT(pData); @@ -367,7 +367,7 @@ NDIS_STATUS RTMPAllocateNdisPacket(IN PRTMP_ADAPTER pAd, corresponding NDIS_BUFFER and allocated memory. ======================================================================== */ -VOID RTMPFreeNdisPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) +void RTMPFreeNdisPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) { dev_kfree_skb_any(RTPKT_TO_OSPKT(pPacket)); } @@ -375,19 +375,19 @@ VOID RTMPFreeNdisPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) /* IRQL = DISPATCH_LEVEL */ /* NOTE: we do have an assumption here, that Byte0 and Byte1 always reasid at the same */ /* scatter gather buffer */ -NDIS_STATUS Sniff2BytesFromNdisBuffer(IN PNDIS_BUFFER pFirstBuffer, - IN UCHAR DesiredOffset, - OUT PUCHAR pByte0, OUT PUCHAR pByte1) +int Sniff2BytesFromNdisBuffer(IN PNDIS_BUFFER pFirstBuffer, + u8 DesiredOffset, + u8 *pByte0, u8 *pByte1) { - *pByte0 = *(PUCHAR) (pFirstBuffer + DesiredOffset); - *pByte1 = *(PUCHAR) (pFirstBuffer + DesiredOffset + 1); + *pByte0 = *(u8 *)(pFirstBuffer + DesiredOffset); + *pByte1 = *(u8 *)(pFirstBuffer + DesiredOffset + 1); return NDIS_STATUS_SUCCESS; } void RTMP_QueryPacketInfo(IN PNDIS_PACKET pPacket, OUT PACKET_INFO * pPacketInfo, - OUT PUCHAR * pSrcBufVA, OUT UINT * pSrcBufLen) + u8 ** pSrcBufVA, u32 * pSrcBufLen) { pPacketInfo->BufferCount = 1; pPacketInfo->pFirstBuffer = (PNDIS_BUFFER) GET_OS_PKT_DATAPTR(pPacket); @@ -400,7 +400,7 @@ void RTMP_QueryPacketInfo(IN PNDIS_PACKET pPacket, void RTMP_QueryNextPacketInfo(IN PNDIS_PACKET * ppPacket, OUT PACKET_INFO * pPacketInfo, - OUT PUCHAR * pSrcBufVA, OUT UINT * pSrcBufLen) + u8 ** pSrcBufVA, u32 * pSrcBufLen) { PNDIS_PACKET pPacket = NULL; @@ -430,15 +430,15 @@ void RTMP_QueryNextPacketInfo(IN PNDIS_PACKET * ppPacket, } PNDIS_PACKET DuplicatePacket(IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, IN UCHAR FromWhichBSSID) + IN PNDIS_PACKET pPacket, u8 FromWhichBSSID) { struct sk_buff *skb; PNDIS_PACKET pRetPacket = NULL; - USHORT DataSize; - UCHAR *pData; + u16 DataSize; + u8 *pData; - DataSize = (USHORT) GET_OS_PKT_LEN(pPacket); - pData = (PUCHAR) GET_OS_PKT_DATAPTR(pPacket); + DataSize = (u16)GET_OS_PKT_LEN(pPacket); + pData = (u8 *)GET_OS_PKT_DATAPTR(pPacket); skb = skb_clone(RTPKT_TO_OSPKT(pPacket), MEM_ALLOC_FLAG); if (skb) { @@ -451,10 +451,10 @@ PNDIS_PACKET DuplicatePacket(IN PRTMP_ADAPTER pAd, } PNDIS_PACKET duplicate_pkt(IN PRTMP_ADAPTER pAd, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, - IN ULONG DataSize, IN UCHAR FromWhichBSSID) + u8 *pHeader802_3, + u32 HdrLen, + u8 *pData, + unsigned long DataSize, u8 FromWhichBSSID) { struct sk_buff *skb; PNDIS_PACKET pPacket = NULL; @@ -499,7 +499,7 @@ PNDIS_PACKET duplicate_pkt_with_TKIP_MIC(IN PRTMP_ADAPTER pAd, PNDIS_PACKET ClonePacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket, - IN PUCHAR pData, IN ULONG DataSize) + u8 *pData, unsigned long DataSize) { struct sk_buff *pRxPkt; struct sk_buff *pClonedPkt; @@ -525,7 +525,7 @@ PNDIS_PACKET ClonePacket(IN PRTMP_ADAPTER pAd, /* change OS packet DataPtr and DataLen */ /* */ void update_os_packet_info(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) + IN RX_BLK * pRxBlk, u8 FromWhichBSSID) { struct sk_buff *pOSPkt; @@ -540,8 +540,8 @@ void update_os_packet_info(IN PRTMP_ADAPTER pAd, void wlan_802_11_to_802_3_packet(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk, - IN PUCHAR pHeader802_3, - IN UCHAR FromWhichBSSID) + u8 *pHeader802_3, + u8 FromWhichBSSID) { struct sk_buff *pOSPkt; @@ -628,15 +628,15 @@ void hex_dump(char *str, unsigned char *pSrcBufVA, unsigned int SrcBufLen) ======================================================================== */ -VOID RTMPSendWirelessEvent(IN PRTMP_ADAPTER pAd, - IN USHORT Event_flag, - IN PUCHAR pAddr, IN UCHAR BssIdx, IN CHAR Rssi) +void RTMPSendWirelessEvent(IN PRTMP_ADAPTER pAd, + u16 Event_flag, + u8 *pAddr, u8 BssIdx, char Rssi) { /*union iwreq_data wrqu; */ - PSTRING pBuf = NULL, pBufPtr = NULL; - USHORT event, type, BufLen; - UCHAR event_table_len = 0; + char *pBuf = NULL, *pBufPtr = NULL; + u16 event, type, BufLen; + u8 event_table_len = 0; type = Event_flag & 0xFF00; event = Event_flag & 0x00FF; @@ -705,7 +705,7 @@ VOID RTMPSendWirelessEvent(IN PRTMP_ADAPTER pAd, BufLen = pBufPtr - pBuf; RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, Event_flag, NULL, - (PUCHAR) pBuf, BufLen); + (u8 *)pBuf, BufLen); /*DBGPRINT(RT_DEBUG_TRACE, ("%s : %s\n", __func__, pBuf)); */ kfree(pBuf); @@ -720,8 +720,8 @@ void send_monitor_packets(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) struct sk_buff *pOSPkt; wlan_ng_prism2_header *ph; int rate_index = 0; - USHORT header_len = 0; - UCHAR temp_header[40] = { 0 }; + u16 header_len = 0; + u8 temp_header[40] = { 0 }; u_int32_t ralinkrate[256] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108, 109, 110, 111, 112, 13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78, 104, 156, 208, 234, 260, 27, 54, 81, 108, 162, 216, 243, 270, /* Last 38 */ 54, 108, 162, 216, 324, 432, 486, 540, 14, 29, 43, 57, 87, 115, @@ -816,7 +816,7 @@ void send_monitor_packets(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) ph->msgcode = DIDmsg_lnxind_wlansniffrm; ph->msglen = sizeof(wlan_ng_prism2_header); - strcpy((PSTRING) ph->devname, (PSTRING) pAd->net_dev->name); + strcpy((char *)ph->devname, (char *)pAd->net_dev->name); ph->hosttime.did = DIDmsg_lnxind_wlansniffrm_hosttime; ph->hosttime.status = 0; @@ -865,13 +865,13 @@ void send_monitor_packets(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) if (pRxBlk->pRxWI->PHYMODE >= MODE_HTMIX) { rate_index = - 16 + ((UCHAR) pRxBlk->pRxWI->BW * 16) + - ((UCHAR) pRxBlk->pRxWI->ShortGI * 32) + - ((UCHAR) pRxBlk->pRxWI->MCS); + 16 + ((u8)pRxBlk->pRxWI->BW * 16) + + ((u8)pRxBlk->pRxWI->ShortGI * 32) + + ((u8)pRxBlk->pRxWI->MCS); } else if (pRxBlk->pRxWI->PHYMODE == MODE_OFDM) - rate_index = (UCHAR) (pRxBlk->pRxWI->MCS) + 4; + rate_index = (u8)(pRxBlk->pRxWI->MCS) + 4; else - rate_index = (UCHAR) (pRxBlk->pRxWI->MCS); + rate_index = (u8)(pRxBlk->pRxWI->MCS); if (rate_index < 0) rate_index = 0; if (rate_index > 255) @@ -1005,7 +1005,7 @@ int RtmpOSFileWrite(RTMP_OS_FD osfd, char *pDataPtr, int writeLen) Task create/management/kill related functions. *******************************************************************************/ -NDIS_STATUS RtmpOSTaskKill(IN RTMP_OS_TASK * pTask) +int RtmpOSTaskKill(IN RTMP_OS_TASK * pTask) { RTMP_ADAPTER *pAd; int ret = NDIS_STATUS_FAILURE; @@ -1043,7 +1043,7 @@ NDIS_STATUS RtmpOSTaskKill(IN RTMP_OS_TASK * pTask) } -INT RtmpOSTaskNotifyToExit(IN RTMP_OS_TASK * pTask) +int RtmpOSTaskNotifyToExit(IN RTMP_OS_TASK * pTask) { #ifndef KTHREAD_SUPPORT @@ -1058,7 +1058,7 @@ void RtmpOSTaskCustomize(IN RTMP_OS_TASK * pTask) #ifndef KTHREAD_SUPPORT - daemonize((PSTRING) & pTask->taskName[0] /*"%s",pAd->net_dev->name */ ); + daemonize((char *)& pTask->taskName[0] /*"%s",pAd->net_dev->name */ ); allow_signal(SIGTERM); allow_signal(SIGKILL); @@ -1070,10 +1070,10 @@ void RtmpOSTaskCustomize(IN RTMP_OS_TASK * pTask) #endif } -NDIS_STATUS RtmpOSTaskAttach(IN RTMP_OS_TASK * pTask, +int RtmpOSTaskAttach(IN RTMP_OS_TASK * pTask, IN int (*fn) (void *), IN void *arg) { - NDIS_STATUS status = NDIS_STATUS_SUCCESS; + int status = NDIS_STATUS_SUCCESS; #ifdef KTHREAD_SUPPORT pTask->task_killed = 0; @@ -1098,15 +1098,15 @@ NDIS_STATUS RtmpOSTaskAttach(IN RTMP_OS_TASK * pTask, return status; } -NDIS_STATUS RtmpOSTaskInit(IN RTMP_OS_TASK * pTask, - IN PSTRING pTaskName, IN VOID * pPriv) +int RtmpOSTaskInit(IN RTMP_OS_TASK * pTask, + char *pTaskName, void * pPriv) { int len; ASSERT(pTask); #ifndef KTHREAD_SUPPORT - NdisZeroMemory((PUCHAR) (pTask), sizeof(RTMP_OS_TASK)); + NdisZeroMemory((u8 *)(pTask), sizeof(RTMP_OS_TASK)); #endif len = strlen(pTaskName); @@ -1142,10 +1142,10 @@ void RTMP_IndicateMediaState(IN PRTMP_ADAPTER pAd) } int RtmpOSWrielessEventSend(IN RTMP_ADAPTER * pAd, - IN UINT32 eventType, - IN INT flags, - IN PUCHAR pSrcMac, - IN PUCHAR pData, IN UINT32 dataLen) + u32 eventType, + int flags, + u8 *pSrcMac, + u8 *pData, u32 dataLen) { union iwreq_data wrqu; @@ -1164,7 +1164,7 @@ int RtmpOSWrielessEventSend(IN RTMP_ADAPTER * pAd, return 0; } -int RtmpOSNetDevAddrSet(IN PNET_DEV pNetDev, IN PUCHAR pMacAddr) +int RtmpOSNetDevAddrSet(IN PNET_DEV pNetDev, u8 *pMacAddr) { struct net_device *net_dev; RTMP_ADAPTER *pAd; @@ -1189,11 +1189,11 @@ int RtmpOSNetDevAddrSet(IN PNET_DEV pNetDev, IN PUCHAR pMacAddr) */ static int RtmpOSNetDevRequestName(IN RTMP_ADAPTER * pAd, IN PNET_DEV dev, - IN PSTRING pPrefixStr, IN INT devIdx) + char *pPrefixStr, int devIdx) { PNET_DEV existNetDev; - STRING suffixName[IFNAMSIZ]; - STRING desiredName[IFNAMSIZ]; + char suffixName[IFNAMSIZ]; + char desiredName[IFNAMSIZ]; int ifNameIdx, prefixLen, slotNameLen; int Status; @@ -1243,7 +1243,7 @@ void RtmpOSNetDevFree(PNET_DEV pNetDev) free_netdev(pNetDev); } -INT RtmpOSNetDevAlloc(IN PNET_DEV * new_dev_p, IN UINT32 privDataSize) +int RtmpOSNetDevAlloc(IN PNET_DEV * new_dev_p, u32 privDataSize) { /* assign it as null first. */ *new_dev_p = NULL; @@ -1258,7 +1258,7 @@ INT RtmpOSNetDevAlloc(IN PNET_DEV * new_dev_p, IN UINT32 privDataSize) return NDIS_STATUS_FAILURE; } -PNET_DEV RtmpOSNetDevGetByName(PNET_DEV pNetDev, PSTRING pDevName) +PNET_DEV RtmpOSNetDevGetByName(PNET_DEV pNetDev, char *pDevName) { PNET_DEV pTargetNetDev = NULL; @@ -1278,7 +1278,7 @@ void RtmpOSNetDeviceRefPut(PNET_DEV pNetDev) dev_put(pNetDev); } -INT RtmpOSNetDevDestory(IN RTMP_ADAPTER * pAd, IN PNET_DEV pNetDev) +int RtmpOSNetDevDestory(IN RTMP_ADAPTER * pAd, IN PNET_DEV pNetDev) { /* TODO: Need to fix this */ @@ -1332,9 +1332,9 @@ int RtmpOSNetDevAttach(IN PNET_DEV pNetDev, } PNET_DEV RtmpOSNetDevCreate(IN RTMP_ADAPTER * pAd, - IN INT devType, - IN INT devNum, - IN INT privMemSize, IN PSTRING pNamePrefix) + int devType, + int devNum, + int privMemSize, char *pNamePrefix) { struct net_device *pNetDev = NULL; int status; diff --git a/drivers/staging/rt2860/rt_linux.h b/drivers/staging/rt2860/rt_linux.h index 1e27c6674fd1..629310a2af9d 100644 --- a/drivers/staging/rt2860/rt_linux.h +++ b/drivers/staging/rt2860/rt_linux.h @@ -99,7 +99,6 @@ extern const struct iw_handler_def rt28xx_iw_handler_def; #define IN #define OUT #define INOUT -#define NDIS_STATUS INT /*********************************************************************************** * OS Specific definitions and data structures @@ -390,7 +389,7 @@ typedef void (*TIMER_FUNCTION) (unsigned long); #define ONE_TICK 1 -static inline void NdisGetSystemUpTime(ULONG * time) +static inline void NdisGetSystemUpTime(unsigned long * time) { *time = jiffies; } @@ -403,7 +402,7 @@ struct os_cookie { #ifdef RTMP_MAC_PCI struct pci_dev *pci_dev; struct pci_dev *parent_pci_dev; - USHORT DeviceID; + u16 DeviceID; dma_addr_t pAd_pa; #endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB @@ -427,8 +426,8 @@ struct os_cookie { #endif /* RTMP_MAC_USB // */ unsigned long apd_pid; /*802.1x daemon pid */ - INT ioctl_if_type; - INT ioctl_if; + int ioctl_if_type; + int ioctl_if; }; typedef struct os_cookie *POS_COOKIE; @@ -440,7 +439,7 @@ typedef struct os_cookie *POS_COOKIE; addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] #ifdef DBG -extern ULONG RTDebugLevel; +extern unsigned long RTDebugLevel; #define DBGPRINT_RAW(Level, Fmt) \ do{ \ @@ -503,39 +502,39 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, dev_alloc_skb(_length) #endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB -#define PCI_MAP_SINGLE(_handle, _ptr, _size, _dir) (ULONG)0 +#define PCI_MAP_SINGLE(_handle, _ptr, _size, _dir) (unsigned long)0 #define PCI_UNMAP_SINGLE(_handle, _ptr, _size, _dir) #endif /* RTMP_MAC_USB // */ /* - * ULONG + * unsigned long * RTMP_GetPhysicalAddressLow( * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); */ #define RTMP_GetPhysicalAddressLow(PhysicalAddress) (PhysicalAddress) /* - * ULONG + * unsigned long * RTMP_GetPhysicalAddressHigh( * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); */ #define RTMP_GetPhysicalAddressHigh(PhysicalAddress) (0) /* - * VOID + * void * RTMP_SetPhysicalAddressLow( * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, - * IN ULONG Value); + * unsigned long Value); */ #define RTMP_SetPhysicalAddressLow(PhysicalAddress, Value) \ PhysicalAddress = Value; /* - * VOID + * void * RTMP_SetPhysicalAddressHigh( * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, - * IN ULONG Value); + * unsigned long Value); */ #define RTMP_SetPhysicalAddressHigh(PhysicalAddress, Value) @@ -572,7 +571,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, { \ if ((_A)->bPCIclkOff == FALSE) \ { \ - UINT Val; \ + u32 Val; \ Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ writel((_V), (void *)((_A)->CSRBaseAddress + (_R))); \ } \ @@ -580,7 +579,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, #define RTMP_IO_FORCE_WRITE32(_A, _R, _V) \ { \ - UINT Val; \ + u32 Val; \ Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ writel(_V, (void *)((_A)->CSRBaseAddress + (_R))); \ } @@ -588,51 +587,51 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, #if defined(RALINK_2880) || defined(RALINK_3052) #define RTMP_IO_WRITE8(_A, _R, _V) \ { \ - ULONG Val; \ - UCHAR _i; \ + unsigned long Val; \ + u8 _i; \ _i = ((_R) & 0x3); \ Val = readl((void *)((_A)->CSRBaseAddress + ((_R) - _i))); \ Val = Val & (~(0x000000ff << ((_i)*8))); \ - Val = Val | ((ULONG)(_V) << ((_i)*8)); \ + Val = Val | ((unsigned long)(_V) << ((_i)*8)); \ writel((Val), (void *)((_A)->CSRBaseAddress + ((_R) - _i))); \ } #else #define RTMP_IO_WRITE8(_A, _R, _V) \ { \ - UINT Val; \ + u32 Val; \ Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ - writeb((_V), (PUCHAR)((_A)->CSRBaseAddress + (_R))); \ + writeb((_V), (u8 *)((_A)->CSRBaseAddress + (_R))); \ } #endif /* #if defined(BRCM_6358) || defined(RALINK_2880) // */ #define RTMP_IO_WRITE16(_A, _R, _V) \ { \ - UINT Val; \ + u32 Val; \ Val = readl((void *)((_A)->CSRBaseAddress + MAC_CSR0)); \ - writew((_V), (PUSHORT)((_A)->CSRBaseAddress + (_R))); \ + writew((_V), (u16 *)((_A)->CSRBaseAddress + (_R))); \ } #endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB /*Patch for ASIC turst read/write bug, needs to remove after metel fix */ #define RTMP_IO_READ32(_A, _R, _pV) \ - RTUSBReadMACRegister((_A), (_R), (PUINT32) (_pV)) + RTUSBReadMACRegister((_A), (_R), (u32 *)(_pV)) #define RTMP_IO_READ8(_A, _R, _pV) \ { \ } #define RTMP_IO_WRITE32(_A, _R, _V) \ - RTUSBWriteMACRegister((_A), (_R), (UINT32) (_V)) + RTUSBWriteMACRegister((_A), (_R), (u32)(_V)) #define RTMP_IO_WRITE8(_A, _R, _V) \ { \ - USHORT _Val = _V; \ - RTUSBSingleWrite((_A), (_R), (USHORT) (_Val)); \ + u16 _Val = _V; \ + RTUSBSingleWrite((_A), (_R), (u16)(_Val)); \ } #define RTMP_IO_WRITE16(_A, _R, _V) \ { \ - RTUSBSingleWrite((_A), (_R), (USHORT) (_V)); \ + RTUSBSingleWrite((_A), (_R), (u16)(_V)); \ } #endif /* RTMP_MAC_USB // */ @@ -687,7 +686,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, #define GET_OS_PKT_DATATAIL(_pkt) \ (RTPKT_TO_OSPKT(_pkt)->tail) #define SET_OS_PKT_DATATAIL(_pkt, _start, _len) \ - ((RTPKT_TO_OSPKT(_pkt))->tail) = (PUCHAR)((_start) + (_len)) + ((RTPKT_TO_OSPKT(_pkt))->tail) = (u8 *)((_start) + (_len)) #define GET_OS_PKT_HEAD(_pkt) \ (RTPKT_TO_OSPKT(_pkt)->head) @@ -731,7 +730,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, /*(this value also as MAC(on-chip WCID) table index) */ /* 0x80~0xff: TX to a WDS link. b0~6: WDS index */ #define RTMP_SET_PACKET_WCID(_p, _wdsidx) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+2] = _wdsidx) -#define RTMP_GET_PACKET_WCID(_p) ((UCHAR)(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+2])) +#define RTMP_GET_PACKET_WCID(_p) ((u8)(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+2])) /* 0xff: PKTSRC_NDIS, others: local TX buffer index. This value affects how to a packet */ #define RTMP_SET_PACKET_SOURCE(_p, _pktsrc) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+3] = _pktsrc) @@ -862,7 +861,7 @@ int rt28xx_packet_xmit(struct sk_buff *skb); IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance); #endif /* RTMP_MAC_PCI // */ -INT rt28xx_sta_ioctl(IN PNET_DEV net_dev, IN OUT struct ifreq *rq, IN INT cmd); +int rt28xx_sta_ioctl(IN PNET_DEV net_dev, IN OUT struct ifreq *rq, int cmd); extern int ra_mtd_write(int num, loff_t to, size_t len, const u_char * buf); extern int ra_mtd_read(int num, loff_t from, size_t len, u_char * buf); diff --git a/drivers/staging/rt2860/rt_main_dev.c b/drivers/staging/rt2860/rt_main_dev.c index 84be9d0cfb98..21313ee596c6 100644 --- a/drivers/staging/rt2860/rt_main_dev.c +++ b/drivers/staging/rt2860/rt_main_dev.c @@ -41,8 +41,8 @@ /* Private Variables Used */ /*---------------------------------------------------------------------*/ -PSTRING mac = ""; /* default 00:00:00:00:00:00 */ -PSTRING hostname = ""; /* default CMPC */ +char *mac = ""; /* default 00:00:00:00:00:00 */ +char *hostname = ""; /* default CMPC */ module_param(mac, charp, 0); MODULE_PARM_DESC(mac, "rt28xx: wireless mac addr"); @@ -55,7 +55,7 @@ int rt28xx_close(IN struct net_device *net_dev); int rt28xx_open(struct net_device *net_dev); /* private function prototype */ -static INT rt28xx_send_packets(IN struct sk_buff *skb_p, +static int rt28xx_send_packets(IN struct sk_buff *skb_p, IN struct net_device *net_dev); static struct net_device_stats *RT28xx_get_ether_stats(IN struct net_device @@ -213,7 +213,7 @@ int rt28xx_close(IN PNET_DEV dev) struct net_device *net_dev = (struct net_device *)dev; RTMP_ADAPTER *pAd = NULL; BOOLEAN Cancelled; - UINT32 i = 0; + u32 i = 0; #ifdef RTMP_MAC_USB DECLARE_WAIT_QUEUE_HEAD(unlink_wakeup); @@ -304,7 +304,7 @@ int rt28xx_close(IN PNET_DEV dev) #ifdef RTMP_MAC_PCI { BOOLEAN brc; - /* ULONG Value; */ + /* unsigned long Value; */ if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) { RTMP_ASIC_INTERRUPT_DISABLE(pAd); @@ -418,14 +418,14 @@ int rt28xx_open(IN PNET_DEV dev) RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_START_UP); { - UINT32 reg = 0; + u32 reg = 0; RTMP_IO_READ32(pAd, 0x1300, ®); /* clear garbage interrupts */ printk("0x1300 = %08x\n", reg); } { /* u32 reg; */ -/* UINT8 byte; */ +/* u8 byte; */ /* u16 tmp; */ /* RTMP_IO_READ32(pAd, XIFS_TIME_CFG, ®); */ @@ -463,7 +463,7 @@ PNET_DEV RtmpPhyNetDevInit(IN RTMP_ADAPTER * pAd, IN RTMP_OS_NETDEV_OP_HOOK * pNetDevHook) { struct net_device *net_dev = NULL; -/* NDIS_STATUS Status; */ +/* int Status; */ net_dev = RtmpOSNetDevCreate(pAd, INT_MAIN, 0, sizeof(PRTMP_ADAPTER), @@ -480,7 +480,7 @@ PNET_DEV RtmpPhyNetDevInit(IN RTMP_ADAPTER * pAd, pNetDevHook->priv_flags = INT_MAIN; pNetDevHook->needProtcted = FALSE; - net_dev->ml_priv = (PVOID) pAd; + net_dev->ml_priv = (void *)pAd; pAd->net_dev = net_dev; netif_stop_queue(net_dev); @@ -571,7 +571,7 @@ static int rt28xx_send_packets(IN struct sk_buff *skb_p, return NETDEV_TX_OK; } - NdisZeroMemory((PUCHAR) & skb_p->cb[CB_OFF], 15); + NdisZeroMemory((u8 *)& skb_p->cb[CB_OFF], 15); RTMP_SET_PACKET_NET_DEVICE_MBSSID(skb_p, MAIN_MBSSID); return rt28xx_packet_xmit(skb_p); @@ -721,10 +721,10 @@ Return Value: Note: ======================================================================== */ -NDIS_STATUS AdapterBlockAllocateMemory(IN PVOID handle, OUT PVOID * ppAd) +int AdapterBlockAllocateMemory(void *handle, void ** ppAd) { - *ppAd = (PVOID) vmalloc(sizeof(RTMP_ADAPTER)); /*pci_alloc_consistent(pci_dev, sizeof(RTMP_ADAPTER), phy_addr); */ + *ppAd = (void *)vmalloc(sizeof(RTMP_ADAPTER)); /*pci_alloc_consistent(pci_dev, sizeof(RTMP_ADAPTER), phy_addr); */ if (*ppAd) { NdisZeroMemory(*ppAd, sizeof(RTMP_ADAPTER)); diff --git a/drivers/staging/rt2860/rt_pci_rbus.c b/drivers/staging/rt2860/rt_pci_rbus.c index 0f75c3f765c7..8df44ba436ff 100644 --- a/drivers/staging/rt2860/rt_pci_rbus.c +++ b/drivers/staging/rt2860/rt_pci_rbus.c @@ -78,54 +78,54 @@ static void fifo_statistic_full_tasklet(unsigned long data); **************************************************************************/ /* Function for TxDesc Memory allocation. */ void RTMP_AllocateTxDescMemory(IN PRTMP_ADAPTER pAd, - IN UINT Index, - IN ULONG Length, + u32 Index, + unsigned long Length, IN BOOLEAN Cached, - OUT PVOID * VirtualAddress, + void ** VirtualAddress, OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) { POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; *VirtualAddress = - (PVOID) pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, + (void *)pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, PhysicalAddress); } /* Function for MgmtDesc Memory allocation. */ void RTMP_AllocateMgmtDescMemory(IN PRTMP_ADAPTER pAd, - IN ULONG Length, + unsigned long Length, IN BOOLEAN Cached, - OUT PVOID * VirtualAddress, + void ** VirtualAddress, OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) { POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; *VirtualAddress = - (PVOID) pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, + (void *)pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, PhysicalAddress); } /* Function for RxDesc Memory allocation. */ void RTMP_AllocateRxDescMemory(IN PRTMP_ADAPTER pAd, - IN ULONG Length, + unsigned long Length, IN BOOLEAN Cached, - OUT PVOID * VirtualAddress, + void ** VirtualAddress, OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) { POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; *VirtualAddress = - (PVOID) pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, + (void *)pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, PhysicalAddress); } /* Function for free allocated Desc Memory. */ void RTMP_FreeDescMemory(IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN PVOID VirtualAddress, + unsigned long Length, + void *VirtualAddress, IN NDIS_PHYSICAL_ADDRESS PhysicalAddress) { POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; @@ -136,23 +136,23 @@ void RTMP_FreeDescMemory(IN PRTMP_ADAPTER pAd, /* Function for TxData DMA Memory allocation. */ void RTMP_AllocateFirstTxBuffer(IN PRTMP_ADAPTER pAd, - IN UINT Index, - IN ULONG Length, + u32 Index, + unsigned long Length, IN BOOLEAN Cached, - OUT PVOID * VirtualAddress, + void ** VirtualAddress, OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) { POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; *VirtualAddress = - (PVOID) pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, + (void *)pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, PhysicalAddress); } void RTMP_FreeFirstTxBuffer(IN PRTMP_ADAPTER pAd, - IN ULONG Length, + unsigned long Length, IN BOOLEAN Cached, - IN PVOID VirtualAddress, + void *VirtualAddress, IN NDIS_PHYSICAL_ADDRESS PhysicalAddress) { POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; @@ -171,15 +171,15 @@ void RTMP_FreeFirstTxBuffer(IN PRTMP_ADAPTER pAd, * PhysicalAddress: Physical address corresponding to virtual address */ void RTMP_AllocateSharedMemory(IN PRTMP_ADAPTER pAd, - IN ULONG Length, + unsigned long Length, IN BOOLEAN Cached, - OUT PVOID * VirtualAddress, + void ** VirtualAddress, OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) { POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; *VirtualAddress = - (PVOID) pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, + (void *)pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, PhysicalAddress); } @@ -195,9 +195,9 @@ void RTMP_AllocateSharedMemory(IN PRTMP_ADAPTER pAd, * Cached is ignored: always cached memory */ PNDIS_PACKET RTMP_AllocateRxPacketBuffer(IN PRTMP_ADAPTER pAd, - IN ULONG Length, + unsigned long Length, IN BOOLEAN Cached, - OUT PVOID * VirtualAddress, + void ** VirtualAddress, OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) { @@ -212,19 +212,19 @@ PNDIS_PACKET RTMP_AllocateRxPacketBuffer(IN PRTMP_ADAPTER pAd, if (pkt) { RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pkt), PKTSRC_NDIS); - *VirtualAddress = (PVOID) pkt->data; + *VirtualAddress = (void *)pkt->data; *PhysicalAddress = PCI_MAP_SINGLE(pAd, *VirtualAddress, Length, -1, PCI_DMA_FROMDEVICE); } else { - *VirtualAddress = (PVOID) NULL; + *VirtualAddress = (void *)NULL; *PhysicalAddress = (NDIS_PHYSICAL_ADDRESS) NULL; } return (PNDIS_PACKET) pkt; } -VOID Invalid_Remaining_Packet(IN PRTMP_ADAPTER pAd, IN ULONG VirtualAddress) +void Invalid_Remaining_Packet(IN PRTMP_ADAPTER pAd, unsigned long VirtualAddress) { NDIS_PHYSICAL_ADDRESS PhysicalAddress; @@ -233,7 +233,7 @@ VOID Invalid_Remaining_Packet(IN PRTMP_ADAPTER pAd, IN ULONG VirtualAddress) RX_BUFFER_NORMSIZE - 1600, -1, PCI_DMA_FROMDEVICE); } -NDIS_STATUS RtmpNetTaskInit(IN RTMP_ADAPTER * pAd) +int RtmpNetTaskInit(IN RTMP_ADAPTER * pAd) { POS_COOKIE pObj; @@ -273,7 +273,7 @@ void RtmpNetTaskExit(IN RTMP_ADAPTER * pAd) tasklet_kill(&pObj->fifo_statistic_full_task); } -NDIS_STATUS RtmpMgmtTaskInit(IN RTMP_ADAPTER * pAd) +int RtmpMgmtTaskInit(IN RTMP_ADAPTER * pAd) { return NDIS_STATUS_SUCCESS; @@ -293,7 +293,7 @@ Return Value: Note: ======================================================================== */ -VOID RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd) +void RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd) { return; @@ -401,7 +401,7 @@ static void rx_done_tasklet(unsigned long data) return; } - /* enable RxINT again */ + /* enable Rxint again */ rt2860_int_enable(pAd, INT_RX); RTMP_INT_UNLOCK(&pAd->irq_lock, flags); @@ -434,7 +434,7 @@ void fifo_statistic_full_tasklet(unsigned long data) return; } - /* enable RxINT again */ + /* enable Rxint again */ rt2860_int_enable(pAd, FifoStaFullInt); RTMP_INT_UNLOCK(&pAd->irq_lock, flags); @@ -712,7 +712,7 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) if (IntSource.word & INT_RX) { if ((pAd->int_disable_mask & INT_RX) == 0) { - /* mask RxINT */ + /* mask Rxint */ rt2860_int_disable(pAd, INT_RX); tasklet_hi_schedule(&pObj->rx_done_task); } diff --git a/drivers/staging/rt2860/rt_usb.c b/drivers/staging/rt2860/rt_usb.c index e4668dcc4108..2db7d6e14869 100644 --- a/drivers/staging/rt2860/rt_usb.c +++ b/drivers/staging/rt2860/rt_usb.c @@ -77,10 +77,10 @@ Return Value: Note: ======================================================================== */ -NDIS_STATUS RtmpMgmtTaskInit(IN RTMP_ADAPTER * pAd) +int RtmpMgmtTaskInit(IN RTMP_ADAPTER * pAd) { RTMP_OS_TASK *pTask; - NDIS_STATUS status; + int status; /* Creat TimerQ Thread, We need init timerQ related structure before create the timer thread. @@ -133,9 +133,9 @@ Return Value: Note: ======================================================================== */ -VOID RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd) +void RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd) { - INT ret; + int ret; RTMP_OS_TASK *pTask; /* Sleep 50 milliseconds so pending io might finish normally */ @@ -201,8 +201,8 @@ static void rtusb_dataout_complete(unsigned long data) purbb_t pUrb; POS_COOKIE pObj; PHT_TX_CONTEXT pHTTXContext; - UCHAR BulkOutPipeId; - NTSTATUS Status; + u8 BulkOutPipeId; + int Status; unsigned long IrqFlags; pUrb = (purbb_t) data; @@ -235,7 +235,7 @@ static void rtusb_dataout_complete(unsigned long data) } else /* STATUS_OTHER */ { - PUCHAR pBuf; + u8 *pBuf; pAd->BulkOutCompleteOther++; @@ -297,7 +297,7 @@ static void rtusb_null_frame_done_tasklet(unsigned long data) PRTMP_ADAPTER pAd; PTX_CONTEXT pNullContext; purbb_t pUrb; - NTSTATUS Status; + int Status; unsigned long irqFlag; pUrb = (purbb_t) data; @@ -346,7 +346,7 @@ static void rtusb_rts_frame_done_tasklet(unsigned long data) PRTMP_ADAPTER pAd; PTX_CONTEXT pRTSContext; purbb_t pUrb; - NTSTATUS Status; + int Status; unsigned long irqFlag; pUrb = (purbb_t) data; @@ -396,7 +396,7 @@ static void rtusb_pspoll_frame_done_tasklet(unsigned long data) PRTMP_ADAPTER pAd; PTX_CONTEXT pPsPollContext; purbb_t pUrb; - NTSTATUS Status; + int Status; pUrb = (purbb_t) data; pPsPollContext = (PTX_CONTEXT) pUrb->context; @@ -455,7 +455,7 @@ static void rx_done_tasklet(unsigned long data) purbb_t pUrb; PRX_CONTEXT pRxContext; PRTMP_ADAPTER pAd; - NTSTATUS Status; + int Status; unsigned int IrqFlags; pUrb = (purbb_t) data; @@ -519,7 +519,7 @@ static void rtusb_mgmt_dma_done_tasklet(unsigned long data) int index; PNDIS_PACKET pPacket; purbb_t pUrb; - NTSTATUS Status; + int Status; unsigned long IrqFlags; pUrb = (purbb_t) data; @@ -597,7 +597,7 @@ static void rtusb_ac3_dma_done_tasklet(unsigned long data) { PRTMP_ADAPTER pAd; PHT_TX_CONTEXT pHTTXContext; - UCHAR BulkOutPipeId = 3; + u8 BulkOutPipeId = 3; purbb_t pUrb; pUrb = (purbb_t) data; @@ -637,7 +637,7 @@ static void rtusb_ac2_dma_done_tasklet(unsigned long data) { PRTMP_ADAPTER pAd; PHT_TX_CONTEXT pHTTXContext; - UCHAR BulkOutPipeId = 2; + u8 BulkOutPipeId = 2; purbb_t pUrb; pUrb = (purbb_t) data; @@ -677,7 +677,7 @@ static void rtusb_ac1_dma_done_tasklet(unsigned long data) { PRTMP_ADAPTER pAd; PHT_TX_CONTEXT pHTTXContext; - UCHAR BulkOutPipeId = 1; + u8 BulkOutPipeId = 1; purbb_t pUrb; pUrb = (purbb_t) data; @@ -717,7 +717,7 @@ static void rtusb_ac0_dma_done_tasklet(unsigned long data) { PRTMP_ADAPTER pAd; PHT_TX_CONTEXT pHTTXContext; - UCHAR BulkOutPipeId = 0; + u8 BulkOutPipeId = 0; purbb_t pUrb; pUrb = (purbb_t) data; @@ -753,12 +753,12 @@ static void rtusb_ac0_dma_done_tasklet(unsigned long data) } -NDIS_STATUS RtmpNetTaskInit(IN RTMP_ADAPTER * pAd) +int RtmpNetTaskInit(IN RTMP_ADAPTER * pAd) { POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; /* Create receive tasklet */ - tasklet_init(&pObj->rx_done_task, rx_done_tasklet, (ULONG) pAd); + tasklet_init(&pObj->rx_done_task, rx_done_tasklet, (unsigned long)pAd); tasklet_init(&pObj->mgmt_dma_done_task, rtusb_mgmt_dma_done_tasklet, (unsigned long)pAd); tasklet_init(&pObj->ac0_dma_done_task, rtusb_ac0_dma_done_tasklet, diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h index 2ac9663657e5..6acd29f73121 100644 --- a/drivers/staging/rt2860/rtmp.h +++ b/drivers/staging/rt2860/rtmp.h @@ -62,100 +62,100 @@ typedef struct _RTMP_CHIP_OP_ RTMP_CHIP_OP; extern unsigned char SNAP_AIRONET[]; extern unsigned char CISCO_OUI[]; -extern UCHAR BaSizeArray[4]; +extern u8 BaSizeArray[4]; -extern UCHAR BROADCAST_ADDR[MAC_ADDR_LEN]; -extern UCHAR ZERO_MAC_ADDR[MAC_ADDR_LEN]; -extern ULONG BIT32[32]; -extern UCHAR BIT8[8]; +extern u8 BROADCAST_ADDR[MAC_ADDR_LEN]; +extern u8 ZERO_MAC_ADDR[MAC_ADDR_LEN]; +extern unsigned long BIT32[32]; +extern u8 BIT8[8]; extern char *CipherName[]; extern char *MCSToMbps[]; -extern UCHAR RxwiMCSToOfdmRate[12]; -extern UCHAR SNAP_802_1H[6]; -extern UCHAR SNAP_BRIDGE_TUNNEL[6]; -extern UCHAR SNAP_AIRONET[8]; -extern UCHAR CKIP_LLC_SNAP[8]; -extern UCHAR EAPOL_LLC_SNAP[8]; -extern UCHAR EAPOL[2]; -extern UCHAR IPX[2]; -extern UCHAR APPLE_TALK[2]; -extern UCHAR RateIdToPlcpSignal[12]; /* see IEEE802.11a-1999 p.14 */ -extern UCHAR OfdmRateToRxwiMCS[]; -extern UCHAR OfdmSignalToRateId[16]; -extern UCHAR default_cwmin[4]; -extern UCHAR default_cwmax[4]; -extern UCHAR default_sta_aifsn[4]; -extern UCHAR MapUserPriorityToAccessCategory[8]; - -extern USHORT RateUpPER[]; -extern USHORT RateDownPER[]; -extern UCHAR Phy11BNextRateDownward[]; -extern UCHAR Phy11BNextRateUpward[]; -extern UCHAR Phy11BGNextRateDownward[]; -extern UCHAR Phy11BGNextRateUpward[]; -extern UCHAR Phy11ANextRateDownward[]; -extern UCHAR Phy11ANextRateUpward[]; -extern CHAR RssiSafeLevelForTxRate[]; -extern UCHAR RateIdToMbps[]; -extern USHORT RateIdTo500Kbps[]; - -extern UCHAR CipherSuiteWpaNoneTkip[]; -extern UCHAR CipherSuiteWpaNoneTkipLen; - -extern UCHAR CipherSuiteWpaNoneAes[]; -extern UCHAR CipherSuiteWpaNoneAesLen; - -extern UCHAR SsidIe; -extern UCHAR SupRateIe; -extern UCHAR ExtRateIe; - -extern UCHAR HtCapIe; -extern UCHAR AddHtInfoIe; -extern UCHAR NewExtChanIe; - -extern UCHAR ErpIe; -extern UCHAR DsIe; -extern UCHAR TimIe; -extern UCHAR WpaIe; -extern UCHAR Wpa2Ie; -extern UCHAR IbssIe; -extern UCHAR Ccx2Ie; -extern UCHAR WapiIe; - -extern UCHAR WPA_OUI[]; -extern UCHAR RSN_OUI[]; -extern UCHAR WAPI_OUI[]; -extern UCHAR WME_INFO_ELEM[]; -extern UCHAR WME_PARM_ELEM[]; -extern UCHAR Ccx2QosInfo[]; -extern UCHAR Ccx2IeInfo[]; -extern UCHAR RALINK_OUI[]; -extern UCHAR PowerConstraintIE[]; - -extern UCHAR RateSwitchTable[]; -extern UCHAR RateSwitchTable11B[]; -extern UCHAR RateSwitchTable11G[]; -extern UCHAR RateSwitchTable11BG[]; - -extern UCHAR RateSwitchTable11BGN1S[]; -extern UCHAR RateSwitchTable11BGN2S[]; -extern UCHAR RateSwitchTable11BGN2SForABand[]; -extern UCHAR RateSwitchTable11N1S[]; -extern UCHAR RateSwitchTable11N2S[]; -extern UCHAR RateSwitchTable11N2SForABand[]; - -extern UCHAR PRE_N_HT_OUI[]; +extern u8 RxwiMCSToOfdmRate[12]; +extern u8 SNAP_802_1H[6]; +extern u8 SNAP_BRIDGE_TUNNEL[6]; +extern u8 SNAP_AIRONET[8]; +extern u8 CKIP_LLC_SNAP[8]; +extern u8 EAPOL_LLC_SNAP[8]; +extern u8 EAPOL[2]; +extern u8 IPX[2]; +extern u8 APPLE_TALK[2]; +extern u8 RateIdToPlcpSignal[12]; /* see IEEE802.11a-1999 p.14 */ +extern u8 OfdmRateToRxwiMCS[]; +extern u8 OfdmSignalToRateId[16]; +extern u8 default_cwmin[4]; +extern u8 default_cwmax[4]; +extern u8 default_sta_aifsn[4]; +extern u8 MapUserPriorityToAccessCategory[8]; + +extern u16 RateUpPER[]; +extern u16 RateDownPER[]; +extern u8 Phy11BNextRateDownward[]; +extern u8 Phy11BNextRateUpward[]; +extern u8 Phy11BGNextRateDownward[]; +extern u8 Phy11BGNextRateUpward[]; +extern u8 Phy11ANextRateDownward[]; +extern u8 Phy11ANextRateUpward[]; +extern char RssiSafeLevelForTxRate[]; +extern u8 RateIdToMbps[]; +extern u16 RateIdTo500Kbps[]; + +extern u8 CipherSuiteWpaNoneTkip[]; +extern u8 CipherSuiteWpaNoneTkipLen; + +extern u8 CipherSuiteWpaNoneAes[]; +extern u8 CipherSuiteWpaNoneAesLen; + +extern u8 SsidIe; +extern u8 SupRateIe; +extern u8 ExtRateIe; + +extern u8 HtCapIe; +extern u8 AddHtInfoIe; +extern u8 NewExtChanIe; + +extern u8 ErpIe; +extern u8 DsIe; +extern u8 TimIe; +extern u8 WpaIe; +extern u8 Wpa2Ie; +extern u8 IbssIe; +extern u8 Ccx2Ie; +extern u8 WapiIe; + +extern u8 WPA_OUI[]; +extern u8 RSN_OUI[]; +extern u8 WAPI_OUI[]; +extern u8 WME_INFO_ELEM[]; +extern u8 WME_PARM_ELEM[]; +extern u8 Ccx2QosInfo[]; +extern u8 Ccx2IeInfo[]; +extern u8 RALINK_OUI[]; +extern u8 PowerConstraintIE[]; + +extern u8 RateSwitchTable[]; +extern u8 RateSwitchTable11B[]; +extern u8 RateSwitchTable11G[]; +extern u8 RateSwitchTable11BG[]; + +extern u8 RateSwitchTable11BGN1S[]; +extern u8 RateSwitchTable11BGN2S[]; +extern u8 RateSwitchTable11BGN2SForABand[]; +extern u8 RateSwitchTable11N1S[]; +extern u8 RateSwitchTable11N2S[]; +extern u8 RateSwitchTable11N2SForABand[]; + +extern u8 PRE_N_HT_OUI[]; typedef struct _RSSI_SAMPLE { - CHAR LastRssi0; /* last received RSSI */ - CHAR LastRssi1; /* last received RSSI */ - CHAR LastRssi2; /* last received RSSI */ - CHAR AvgRssi0; - CHAR AvgRssi1; - CHAR AvgRssi2; - SHORT AvgRssi0X8; - SHORT AvgRssi1X8; - SHORT AvgRssi2X8; + char LastRssi0; /* last received RSSI */ + char LastRssi1; /* last received RSSI */ + char LastRssi2; /* last received RSSI */ + char AvgRssi0; + char AvgRssi1; + char AvgRssi2; + short AvgRssi0X8; + short AvgRssi1X8; + short AvgRssi2X8; } RSSI_SAMPLE; /* */ @@ -169,7 +169,7 @@ typedef struct _QUEUE_ENTRY { typedef struct _QUEUE_HEADER { PQUEUE_ENTRY Head; PQUEUE_ENTRY Tail; - ULONG Number; + unsigned long Number; } QUEUE_HEADER, *PQUEUE_HEADER; #define InitializeQueueHeader(QueueHeader) \ @@ -280,14 +280,14 @@ typedef struct _QUEUE_HEADER { _pAd->StaActive.SupportedHtPhy.RecomWidth = _pAd->MlmeAux.AddHtInfo.AddHtInfo.RecomWidth; \ _pAd->StaActive.SupportedHtPhy.OperaionMode = _pAd->MlmeAux.AddHtInfo.AddHtInfo2.OperaionMode; \ _pAd->StaActive.SupportedHtPhy.NonGfPresent = _pAd->MlmeAux.AddHtInfo.AddHtInfo2.NonGfPresent; \ - NdisMoveMemory((_pAd)->MacTab.Content[BSSID_WCID].HTCapability.MCSSet, (_pAd)->StaActive.SupportedPhyInfo.MCSSet, sizeof(UCHAR) * 16);\ + NdisMoveMemory((_pAd)->MacTab.Content[BSSID_WCID].HTCapability.MCSSet, (_pAd)->StaActive.SupportedPhyInfo.MCSSet, sizeof(u8)* 16);\ } #define COPY_AP_HTSETTINGS_FROM_BEACON(_pAd, _pHtCapability) \ { \ - _pAd->MacTab.Content[BSSID_WCID].AMsduSize = (UCHAR)(_pHtCapability->HtCapInfo.AMsduSize); \ - _pAd->MacTab.Content[BSSID_WCID].MmpsMode= (UCHAR)(_pHtCapability->HtCapInfo.MimoPs); \ - _pAd->MacTab.Content[BSSID_WCID].MaxRAmpduFactor = (UCHAR)(_pHtCapability->HtCapParm.MaxRAmpduFactor); \ + _pAd->MacTab.Content[BSSID_WCID].AMsduSize = (u8)(_pHtCapability->HtCapInfo.AMsduSize); \ + _pAd->MacTab.Content[BSSID_WCID].MmpsMode= (u8)(_pHtCapability->HtCapInfo.MimoPs); \ + _pAd->MacTab.Content[BSSID_WCID].MaxRAmpduFactor = (u8)(_pHtCapability->HtCapParm.MaxRAmpduFactor); \ } /* */ @@ -295,13 +295,13 @@ typedef struct _QUEUE_HEADER { /* */ /* Usage : RTMP_IO_READ32( */ /* PRTMP_ADAPTER pAd, */ -/* ULONG Register_Offset, */ -/* PULONG pValue) */ +/* unsigned long Register_Offset, */ +/* unsigned long * pValue) */ /* */ /* RTMP_IO_WRITE32( */ /* PRTMP_ADAPTER pAd, */ -/* ULONG Register_Offset, */ -/* ULONG Value) */ +/* unsigned long Register_Offset, */ +/* unsigned long Value) */ /* */ /* */ @@ -312,14 +312,14 @@ typedef struct _QUEUE_HEADER { #define NIC_MAX_PHYS_BUF_COUNT 8 typedef struct _RTMP_SCATTER_GATHER_ELEMENT { - PVOID Address; - ULONG Length; - PULONG Reserved; + void *Address; + unsigned long Length; + unsigned long *Reserved; } RTMP_SCATTER_GATHER_ELEMENT, *PRTMP_SCATTER_GATHER_ELEMENT; typedef struct _RTMP_SCATTER_GATHER_LIST { - ULONG NumberOfElements; - PULONG Reserved; + unsigned long NumberOfElements; + unsigned long *Reserved; RTMP_SCATTER_GATHER_ELEMENT Elements[NIC_MAX_PHYS_BUF_COUNT]; } RTMP_SCATTER_GATHER_LIST, *PRTMP_SCATTER_GATHER_LIST; @@ -405,13 +405,13 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { if (NdisEqualMemory(SNAP_802_1H, _pData, 6) || \ NdisEqualMemory(SNAP_BRIDGE_TUNNEL, _pData, 6)) \ { \ - PUCHAR pProto = _pData + 6; \ + u8 *pProto = _pData + 6; \ \ if ((NdisEqualMemory(IPX, pProto, 2) || NdisEqualMemory(APPLE_TALK, pProto, 2)) && \ NdisEqualMemory(SNAP_802_1H, _pData, 6)) \ { \ - LLC_Len[0] = (UCHAR)(_DataSize / 256); \ - LLC_Len[1] = (UCHAR)(_DataSize % 256); \ + LLC_Len[0] = (u8)(_DataSize / 256); \ + LLC_Len[1] = (u8)(_DataSize % 256); \ MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \ } \ else \ @@ -424,8 +424,8 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { } \ else \ { \ - LLC_Len[0] = (UCHAR)(_DataSize / 256); \ - LLC_Len[1] = (UCHAR)(_DataSize % 256); \ + LLC_Len[0] = (u8)(_DataSize / 256); \ + LLC_Len[1] = (u8)(_DataSize % 256); \ MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \ } \ } @@ -436,21 +436,21 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { #ifdef RTMP_MAC_PCI #define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \ { \ - UINT32 High32TSF, Low32TSF; \ + u32 High32TSF, Low32TSF; \ RTMP_IO_READ32(_pAd, TSF_TIMER_DW1, &High32TSF); \ RTMP_IO_READ32(_pAd, TSF_TIMER_DW0, &Low32TSF); \ - MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (UCHAR)_Rssi0, (UCHAR)_Rssi1,(UCHAR)_Rssi2,_FrameSize, _pFrame, (UCHAR)_PlcpSignal); \ + MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (u8)_Rssi0, (u8)_Rssi1,(u8)_Rssi2,_FrameSize, _pFrame, (u8)_PlcpSignal); \ } #endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB #define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \ { \ - UINT32 High32TSF=0, Low32TSF=0; \ - MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (UCHAR)_Rssi0, (UCHAR)_Rssi1,(UCHAR)_Rssi2,_FrameSize, _pFrame, (UCHAR)_PlcpSignal); \ + u32 High32TSF=0, Low32TSF=0; \ + MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (u8)_Rssi0, (u8)_Rssi1,(u8)_Rssi2,_FrameSize, _pFrame, (u8)_PlcpSignal); \ } #endif /* RTMP_MAC_USB // */ -#define MAC_ADDR_EQUAL(pAddr1,pAddr2) RTMPEqualMemory((PVOID)(pAddr1), (PVOID)(pAddr2), MAC_ADDR_LEN) +#define MAC_ADDR_EQUAL(pAddr1,pAddr2) RTMPEqualMemory((void *)(pAddr1), (void *)(pAddr2), MAC_ADDR_LEN) #define SSID_EQUAL(ssid1, len1, ssid2, len2) ((len1==len2) && (RTMPEqualMemory(ssid1, ssid2, len1))) /* */ @@ -477,8 +477,8 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { /* Both DMA to / from CPU use the same structure. */ /* */ typedef struct _RTMP_DMABUF { - ULONG AllocSize; - PVOID AllocVa; /* TxBuf virtual address */ + unsigned long AllocSize; + void *AllocVa; /* TxBuf virtual address */ NDIS_PHYSICAL_ADDRESS AllocPa; /* TxBuf physical address */ } RTMP_DMABUF, *PRTMP_DMABUF; @@ -491,8 +491,8 @@ typedef struct _RTMP_DMABUF { /* which driver should ACK upper layer when the tx is physically done or failed. */ /* */ typedef struct _RTMP_DMACB { - ULONG AllocSize; /* Control block size */ - PVOID AllocVa; /* Control block virtual address */ + unsigned long AllocSize; /* Control block size */ + void *AllocVa; /* Control block virtual address */ NDIS_PHYSICAL_ADDRESS AllocPa; /* Control block physical address */ PNDIS_PACKET pNdisPacket; PNDIS_PACKET pNextNdisPacket; @@ -502,23 +502,23 @@ typedef struct _RTMP_DMACB { typedef struct _RTMP_TX_RING { RTMP_DMACB Cell[TX_RING_SIZE]; - UINT32 TxCpuIdx; - UINT32 TxDmaIdx; - UINT32 TxSwFreeIdx; /* software next free tx index */ + u32 TxCpuIdx; + u32 TxDmaIdx; + u32 TxSwFreeIdx; /* software next free tx index */ } RTMP_TX_RING, *PRTMP_TX_RING; typedef struct _RTMP_RX_RING { RTMP_DMACB Cell[RX_RING_SIZE]; - UINT32 RxCpuIdx; - UINT32 RxDmaIdx; - INT32 RxSwReadIdx; /* software next read index */ + u32 RxCpuIdx; + u32 RxDmaIdx; + int RxSwReadIdx; /* software next read index */ } RTMP_RX_RING, *PRTMP_RX_RING; typedef struct _RTMP_MGMT_RING { RTMP_DMACB Cell[MGMT_RING_SIZE]; - UINT32 TxCpuIdx; - UINT32 TxDmaIdx; - UINT32 TxSwFreeIdx; /* software next free tx index */ + u32 TxCpuIdx; + u32 TxDmaIdx; + u32 TxSwFreeIdx; /* software next free tx index */ } RTMP_MGMT_RING, *PRTMP_MGMT_RING; /* */ @@ -526,21 +526,21 @@ typedef struct _RTMP_MGMT_RING { /* */ typedef struct _COUNTER_802_3 { /* General Stats */ - ULONG GoodTransmits; - ULONG GoodReceives; - ULONG TxErrors; - ULONG RxErrors; - ULONG RxNoBuffer; + unsigned long GoodTransmits; + unsigned long GoodReceives; + unsigned long TxErrors; + unsigned long RxErrors; + unsigned long RxNoBuffer; /* Ethernet Stats */ - ULONG RcvAlignmentErrors; - ULONG OneCollision; - ULONG MoreCollisions; + unsigned long RcvAlignmentErrors; + unsigned long OneCollision; + unsigned long MoreCollisions; } COUNTER_802_3, *PCOUNTER_802_3; typedef struct _COUNTER_802_11 { - ULONG Length; + unsigned long Length; LARGE_INTEGER LastTransmittedFragmentCount; LARGE_INTEGER TransmittedFragmentCount; LARGE_INTEGER MulticastTransmittedFrameCount; @@ -557,59 +557,59 @@ typedef struct _COUNTER_802_11 { } COUNTER_802_11, *PCOUNTER_802_11; typedef struct _COUNTER_RALINK { - ULONG TransmittedByteCount; /* both successful and failure, used to calculate TX throughput */ - ULONG ReceivedByteCount; /* both CRC okay and CRC error, used to calculate RX throughput */ - ULONG BeenDisassociatedCount; - ULONG BadCQIAutoRecoveryCount; - ULONG PoorCQIRoamingCount; - ULONG MgmtRingFullCount; - ULONG RxCountSinceLastNULL; - ULONG RxCount; - ULONG RxRingErrCount; - ULONG KickTxCount; - ULONG TxRingErrCount; + unsigned long TransmittedByteCount; /* both successful and failure, used to calculate TX throughput */ + unsigned long ReceivedByteCount; /* both CRC okay and CRC error, used to calculate RX throughput */ + unsigned long BeenDisassociatedCount; + unsigned long BadCQIAutoRecoveryCount; + unsigned long PoorCQIRoamingCount; + unsigned long MgmtRingFullCount; + unsigned long RxCountSinceLastNULL; + unsigned long RxCount; + unsigned long RxRingErrCount; + unsigned long KickTxCount; + unsigned long TxRingErrCount; LARGE_INTEGER RealFcsErrCount; - ULONG PendingNdisPacketCount; - - ULONG OneSecOsTxCount[NUM_OF_TX_RING]; - ULONG OneSecDmaDoneCount[NUM_OF_TX_RING]; - UINT32 OneSecTxDoneCount; - ULONG OneSecRxCount; - UINT32 OneSecTxAggregationCount; - UINT32 OneSecRxAggregationCount; - UINT32 OneSecReceivedByteCount; - UINT32 OneSecFrameDuplicateCount; - - UINT32 OneSecTransmittedByteCount; /* both successful and failure, used to calculate TX throughput */ - UINT32 OneSecTxNoRetryOkCount; - UINT32 OneSecTxRetryOkCount; - UINT32 OneSecTxFailCount; - UINT32 OneSecFalseCCACnt; /* CCA error count, for debug purpose, might move to global counter */ - UINT32 OneSecRxOkCnt; /* RX without error */ - UINT32 OneSecRxOkDataCnt; /* unicast-to-me DATA frame count */ - UINT32 OneSecRxFcsErrCnt; /* CRC error */ - UINT32 OneSecBeaconSentCnt; - UINT32 LastOneSecTotalTxCount; /* OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount */ - UINT32 LastOneSecRxOkDataCnt; /* OneSecRxOkDataCnt */ - ULONG DuplicateRcv; - ULONG TxAggCount; - ULONG TxNonAggCount; - ULONG TxAgg1MPDUCount; - ULONG TxAgg2MPDUCount; - ULONG TxAgg3MPDUCount; - ULONG TxAgg4MPDUCount; - ULONG TxAgg5MPDUCount; - ULONG TxAgg6MPDUCount; - ULONG TxAgg7MPDUCount; - ULONG TxAgg8MPDUCount; - ULONG TxAgg9MPDUCount; - ULONG TxAgg10MPDUCount; - ULONG TxAgg11MPDUCount; - ULONG TxAgg12MPDUCount; - ULONG TxAgg13MPDUCount; - ULONG TxAgg14MPDUCount; - ULONG TxAgg15MPDUCount; - ULONG TxAgg16MPDUCount; + unsigned long PendingNdisPacketCount; + + unsigned long OneSecOsTxCount[NUM_OF_TX_RING]; + unsigned long OneSecDmaDoneCount[NUM_OF_TX_RING]; + u32 OneSecTxDoneCount; + unsigned long OneSecRxCount; + u32 OneSecTxAggregationCount; + u32 OneSecRxAggregationCount; + u32 OneSecReceivedByteCount; + u32 OneSecFrameDuplicateCount; + + u32 OneSecTransmittedByteCount; /* both successful and failure, used to calculate TX throughput */ + u32 OneSecTxNoRetryOkCount; + u32 OneSecTxRetryOkCount; + u32 OneSecTxFailCount; + u32 OneSecFalseCCACnt; /* CCA error count, for debug purpose, might move to global counter */ + u32 OneSecRxOkCnt; /* RX without error */ + u32 OneSecRxOkDataCnt; /* unicast-to-me DATA frame count */ + u32 OneSecRxFcsErrCnt; /* CRC error */ + u32 OneSecBeaconSentCnt; + u32 LastOneSecTotalTxCount; /* OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount */ + u32 LastOneSecRxOkDataCnt; /* OneSecRxOkDataCnt */ + unsigned long DuplicateRcv; + unsigned long TxAggCount; + unsigned long TxNonAggCount; + unsigned long TxAgg1MPDUCount; + unsigned long TxAgg2MPDUCount; + unsigned long TxAgg3MPDUCount; + unsigned long TxAgg4MPDUCount; + unsigned long TxAgg5MPDUCount; + unsigned long TxAgg6MPDUCount; + unsigned long TxAgg7MPDUCount; + unsigned long TxAgg8MPDUCount; + unsigned long TxAgg9MPDUCount; + unsigned long TxAgg10MPDUCount; + unsigned long TxAgg11MPDUCount; + unsigned long TxAgg12MPDUCount; + unsigned long TxAgg13MPDUCount; + unsigned long TxAgg14MPDUCount; + unsigned long TxAgg15MPDUCount; + unsigned long TxAgg16MPDUCount; LARGE_INTEGER TransmittedOctetsInAMSDU; LARGE_INTEGER TransmittedAMSDUCount; @@ -623,37 +623,37 @@ typedef struct _COUNTER_RALINK { typedef struct _COUNTER_DRS { /* to record the each TX rate's quality. 0 is best, the bigger the worse. */ - USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH]; - UCHAR PER[MAX_STEP_OF_TX_RATE_SWITCH]; - UCHAR TxRateUpPenalty; /* extra # of second penalty due to last unstable condition */ - ULONG CurrTxRateStableTime; /* # of second in current TX rate */ + u16 TxQuality[MAX_STEP_OF_TX_RATE_SWITCH]; + u8 PER[MAX_STEP_OF_TX_RATE_SWITCH]; + u8 TxRateUpPenalty; /* extra # of second penalty due to last unstable condition */ + unsigned long CurrTxRateStableTime; /* # of second in current TX rate */ BOOLEAN fNoisyEnvironment; BOOLEAN fLastSecAccordingRSSI; - UCHAR LastSecTxRateChangeAction; /* 0: no change, 1:rate UP, 2:rate down */ - UCHAR LastTimeTxRateChangeAction; /*Keep last time value of LastSecTxRateChangeAction */ - ULONG LastTxOkCount; + u8 LastSecTxRateChangeAction; /* 0: no change, 1:rate UP, 2:rate down */ + u8 LastTimeTxRateChangeAction; /*Keep last time value of LastSecTxRateChangeAction */ + unsigned long LastTxOkCount; } COUNTER_DRS, *PCOUNTER_DRS; /*************************************************************************** * security key related data structure **************************************************************************/ typedef struct _CIPHER_KEY { - UCHAR Key[16]; /* right now we implement 4 keys, 128 bits max */ - UCHAR RxMic[8]; /* make alignment */ - UCHAR TxMic[8]; - UCHAR TxTsc[6]; /* 48bit TSC value */ - UCHAR RxTsc[6]; /* 48bit TSC value */ - UCHAR CipherAlg; /* 0-none, 1:WEP64, 2:WEP128, 3:TKIP, 4:AES, 5:CKIP64, 6:CKIP128 */ - UCHAR KeyLen; - UCHAR BssId[6]; + u8 Key[16]; /* right now we implement 4 keys, 128 bits max */ + u8 RxMic[8]; /* make alignment */ + u8 TxMic[8]; + u8 TxTsc[6]; /* 48bit TSC value */ + u8 RxTsc[6]; /* 48bit TSC value */ + u8 CipherAlg; /* 0-none, 1:WEP64, 2:WEP128, 3:TKIP, 4:AES, 5:CKIP64, 6:CKIP128 */ + u8 KeyLen; + u8 BssId[6]; /* Key length for each key, 0: entry is invalid */ - UCHAR Type; /* Indicate Pairwise/Group when reporting MIC error */ + u8 Type; /* Indicate Pairwise/Group when reporting MIC error */ } CIPHER_KEY, *PCIPHER_KEY; /* structure to define WPA Group Key Rekey Interval */ typedef struct PACKED _RT_802_11_WPA_REKEY { - ULONG ReKeyMethod; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */ - ULONG ReKeyInterval; /* time-based: seconds, packet-based: kilo-packets */ + unsigned long ReKeyMethod; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */ + unsigned long ReKeyInterval; /* time-based: seconds, packet-based: kilo-packets */ } RT_WPA_REKEY, *PRT_WPA_REKEY, RT_802_11_WPA_REKEY, *PRT_802_11_WPA_REKEY; #ifdef RTMP_MAC_USB @@ -661,22 +661,22 @@ typedef struct PACKED _RT_802_11_WPA_REKEY { * RTUSB I/O related data structure **************************************************************************/ typedef struct _RT_SET_ASIC_WCID { - ULONG WCID; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */ - ULONG SetTid; /* time-based: seconds, packet-based: kilo-packets */ - ULONG DeleteTid; /* time-based: seconds, packet-based: kilo-packets */ - UCHAR Addr[MAC_ADDR_LEN]; /* avoid in interrupt when write key */ + unsigned long WCID; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */ + unsigned long SetTid; /* time-based: seconds, packet-based: kilo-packets */ + unsigned long DeleteTid; /* time-based: seconds, packet-based: kilo-packets */ + u8 Addr[MAC_ADDR_LEN]; /* avoid in interrupt when write key */ } RT_SET_ASIC_WCID, *PRT_SET_ASIC_WCID; typedef struct _RT_SET_ASIC_WCID_ATTRI { - ULONG WCID; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */ - ULONG Cipher; /* ASIC Cipher definition */ - UCHAR Addr[ETH_LENGTH_OF_ADDRESS]; + unsigned long WCID; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */ + unsigned long Cipher; /* ASIC Cipher definition */ + u8 Addr[ETH_LENGTH_OF_ADDRESS]; } RT_SET_ASIC_WCID_ATTRI, *PRT_SET_ASIC_WCID_ATTRI; /* for USB interface, avoid in interrupt when write key */ typedef struct RT_ADD_PAIRWISE_KEY_ENTRY { - UCHAR MacAddr[6]; - USHORT MacTabMatchWCID; /* ASIC */ + u8 MacAddr[6]; + u16 MacTabMatchWCID; /* ASIC */ CIPHER_KEY CipherKey; } RT_ADD_PAIRWISE_KEY_ENTRY, *PRT_ADD_PAIRWISE_KEY_ENTRY; @@ -692,8 +692,8 @@ typedef enum _RT_802_11_CIPHER_SUITE_TYPE { #endif /* RTMP_MAC_USB // */ typedef struct { - UCHAR Addr[MAC_ADDR_LEN]; - UCHAR ErrorCode[2]; /*00 01-Invalid authentication type */ + u8 Addr[MAC_ADDR_LEN]; + u8 ErrorCode[2]; /*00 01-Invalid authentication type */ /*00 02-Authentication timeout */ /*00 03-Challenge from AP failed */ /*00 04-Challenge to AP failed */ @@ -701,7 +701,7 @@ typedef struct { } ROGUEAP_ENTRY, *PROGUEAP_ENTRY; typedef struct { - UCHAR RogueApNr; + u8 RogueApNr; ROGUEAP_ENTRY RogueApEntry[MAX_LEN_OF_BSS_TABLE]; } ROGUEAP_TABLE, *PROGUEAP_TABLE; @@ -709,19 +709,19 @@ typedef struct { /* Cisco IAPP format */ /* */ typedef struct _CISCO_IAPP_CONTENT_ { - USHORT Length; /*IAPP Length */ - UCHAR MessageType; /*IAPP type */ - UCHAR FunctionCode; /*IAPP function type */ - UCHAR DestinaionMAC[MAC_ADDR_LEN]; - UCHAR SourceMAC[MAC_ADDR_LEN]; - USHORT Tag; /*Tag(element IE) - Adjacent AP report */ - USHORT TagLength; /*Length of element not including 4 byte header */ - UCHAR OUI[4]; /*0x00, 0x40, 0x96, 0x00 */ - UCHAR PreviousAP[MAC_ADDR_LEN]; /*MAC Address of access point */ - USHORT Channel; - USHORT SsidLen; - UCHAR Ssid[MAX_LEN_OF_SSID]; - USHORT Seconds; /*Seconds that the client has been disassociated. */ + u16 Length; /*IAPP Length */ + u8 MessageType; /*IAPP type */ + u8 FunctionCode; /*IAPP function type */ + u8 DestinaionMAC[MAC_ADDR_LEN]; + u8 SourceMAC[MAC_ADDR_LEN]; + u16 Tag; /*Tag(element IE) - Adjacent AP report */ + u16 TagLength; /*Length of element not including 4 byte header */ + u8 OUI[4]; /*0x00, 0x40, 0x96, 0x00 */ + u8 PreviousAP[MAC_ADDR_LEN]; /*MAC Address of access point */ + u16 Channel; + u16 SsidLen; + u8 Ssid[MAX_LEN_OF_SSID]; + u16 Seconds; /*Seconds that the client has been disassociated. */ } CISCO_IAPP_CONTENT, *PCISCO_IAPP_CONTENT; /* @@ -729,19 +729,19 @@ typedef struct _CISCO_IAPP_CONTENT_ { */ typedef struct _FRAGMENT_FRAME { PNDIS_PACKET pFragPacket; - ULONG RxSize; - USHORT Sequence; - USHORT LastFrag; - ULONG Flags; /* Some extra frame information. bit 0: LLC presented */ + unsigned long RxSize; + u16 Sequence; + u16 LastFrag; + unsigned long Flags; /* Some extra frame information. bit 0: LLC presented */ } FRAGMENT_FRAME, *PFRAGMENT_FRAME; /* */ /* Packet information for NdisQueryPacket */ /* */ typedef struct _PACKET_INFO { - UINT PhysicalBufferCount; /* Physical breaks of buffer descripor chained */ - UINT BufferCount; /* Number of Buffer descriptor chained */ - UINT TotalPacketLength; /* Self explained */ + u32 PhysicalBufferCount; /* Physical breaks of buffer descripor chained */ + u32 BufferCount; /* Number of Buffer descriptor chained */ + u32 TotalPacketLength; /* Self explained */ PNDIS_BUFFER pFirstBuffer; /* Pointer to first buffer descriptor */ } PACKET_INFO, *PPACKET_INFO; @@ -749,36 +749,36 @@ typedef struct _PACKET_INFO { /* Arcfour Structure Added by PaulWu */ /* */ typedef struct _ARCFOUR { - UINT X; - UINT Y; - UCHAR STATE[256]; + u32 X; + u32 Y; + u8 STATE[256]; } ARCFOURCONTEXT, *PARCFOURCONTEXT; /* */ /* Tkip Key structure which RC4 key & MIC calculation */ /* */ typedef struct _TKIP_KEY_INFO { - UINT nBytesInM; /* # bytes in M for MICKEY */ - ULONG IV16; - ULONG IV32; - ULONG K0; /* for MICKEY Low */ - ULONG K1; /* for MICKEY Hig */ - ULONG L; /* Current state for MICKEY */ - ULONG R; /* Current state for MICKEY */ - ULONG M; /* Message accumulator for MICKEY */ - UCHAR RC4KEY[16]; - UCHAR MIC[8]; + u32 nBytesInM; /* # bytes in M for MICKEY */ + unsigned long IV16; + unsigned long IV32; + unsigned long K0; /* for MICKEY Low */ + unsigned long K1; /* for MICKEY Hig */ + unsigned long L; /* Current state for MICKEY */ + unsigned long R; /* Current state for MICKEY */ + unsigned long M; /* Message accumulator for MICKEY */ + u8 RC4KEY[16]; + u8 MIC[8]; } TKIP_KEY_INFO, *PTKIP_KEY_INFO; /* */ /* Private / Misc data, counters for driver internal use */ /* */ typedef struct __PRIVATE_STRUC { - UINT SystemResetCnt; /* System reset counter */ - UINT TxRingFullCnt; /* Tx ring full occurrance number */ - UINT PhyRxErrCnt; /* PHY Rx error count, for debug purpose, might move to global counter */ + u32 SystemResetCnt; /* System reset counter */ + u32 TxRingFullCnt; /* Tx ring full occurrance number */ + u32 PhyRxErrCnt; /* PHY Rx error count, for debug purpose, might move to global counter */ /* Variables for WEP encryption / decryption in rtmp_wep.c */ - UINT FCSCRC32; + u32 FCSCRC32; ARCFOURCONTEXT WEPCONTEXT; /* Tkip stuff */ TKIP_KEY_INFO Tx; @@ -791,44 +791,44 @@ typedef struct __PRIVATE_STRUC { /* structure to tune BBP R66 (BBP TUNING) */ typedef struct _BBP_R66_TUNING { BOOLEAN bEnable; - USHORT FalseCcaLowerThreshold; /* default 100 */ - USHORT FalseCcaUpperThreshold; /* default 512 */ - UCHAR R66Delta; - UCHAR R66CurrentValue; + u16 FalseCcaLowerThreshold; /* default 100 */ + u16 FalseCcaUpperThreshold; /* default 512 */ + u8 R66Delta; + u8 R66CurrentValue; BOOLEAN R66LowerUpperSelect; /*Before LinkUp, Used LowerBound or UpperBound as R66 value. */ } BBP_R66_TUNING, *PBBP_R66_TUNING; /* structure to store channel TX power */ typedef struct _CHANNEL_TX_POWER { - USHORT RemainingTimeForUse; /*unit: sec */ - UCHAR Channel; - CHAR Power; - CHAR Power2; - UCHAR MaxTxPwr; - UCHAR DfsReq; + u16 RemainingTimeForUse; /*unit: sec */ + u8 Channel; + char Power; + char Power2; + u8 MaxTxPwr; + u8 DfsReq; } CHANNEL_TX_POWER, *PCHANNEL_TX_POWER; /* structure to store 802.11j channel TX power */ typedef struct _CHANNEL_11J_TX_POWER { - UCHAR Channel; - UCHAR BW; /* BW_10 or BW_20 */ - CHAR Power; - CHAR Power2; - USHORT RemainingTimeForUse; /*unit: sec */ + u8 Channel; + u8 BW; /* BW_10 or BW_20 */ + char Power; + char Power2; + u16 RemainingTimeForUse; /*unit: sec */ } CHANNEL_11J_TX_POWER, *PCHANNEL_11J_TX_POWER; typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT { - UCHAR EvaluatePeriod; /* 0:not evalute status, 1: evaluate status, 2: switching status */ - UCHAR EvaluateStableCnt; - UCHAR Pair1PrimaryRxAnt; /* 0:Ant-E1, 1:Ant-E2 */ - UCHAR Pair1SecondaryRxAnt; /* 0:Ant-E1, 1:Ant-E2 */ - UCHAR Pair2PrimaryRxAnt; /* 0:Ant-E3, 1:Ant-E4 */ - UCHAR Pair2SecondaryRxAnt; /* 0:Ant-E3, 1:Ant-E4 */ - SHORT Pair1AvgRssi[2]; /* AvgRssi[0]:E1, AvgRssi[1]:E2 */ - SHORT Pair2AvgRssi[2]; /* AvgRssi[0]:E3, AvgRssi[1]:E4 */ - SHORT Pair1LastAvgRssi; /* */ - SHORT Pair2LastAvgRssi; /* */ - ULONG RcvPktNumWhenEvaluate; + u8 EvaluatePeriod; /* 0:not evalute status, 1: evaluate status, 2: switching status */ + u8 EvaluateStableCnt; + u8 Pair1PrimaryRxAnt; /* 0:Ant-E1, 1:Ant-E2 */ + u8 Pair1SecondaryRxAnt; /* 0:Ant-E1, 1:Ant-E2 */ + u8 Pair2PrimaryRxAnt; /* 0:Ant-E3, 1:Ant-E4 */ + u8 Pair2SecondaryRxAnt; /* 0:Ant-E3, 1:Ant-E4 */ + short Pair1AvgRssi[2]; /* AvgRssi[0]:E1, AvgRssi[1]:E2 */ + short Pair2AvgRssi[2]; /* AvgRssi[0]:E3, AvgRssi[1]:E4 */ + short Pair1LastAvgRssi; /* */ + short Pair2LastAvgRssi; /* */ + unsigned long RcvPktNumWhenEvaluate; BOOLEAN FirstPktArrivedWhenEvaluate; RALINK_TIMER_STRUCT RxAntDiversityTimer; } SOFT_RX_ANT_DIVERSITY, *PSOFT_RX_ANT_DIVERSITY; @@ -838,22 +838,22 @@ typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT { **************************************************************************/ typedef struct _RADAR_DETECT_STRUCT { /*BOOLEAN IEEE80211H; // 0: disable, 1: enable IEEE802.11h */ - UCHAR CSCount; /*Channel switch counter */ - UCHAR CSPeriod; /*Channel switch period (beacon count) */ - UCHAR RDCount; /*Radar detection counter */ - UCHAR RDMode; /*Radar Detection mode */ - UCHAR RDDurRegion; /*Radar detection duration region */ - UCHAR BBPR16; - UCHAR BBPR17; - UCHAR BBPR18; - UCHAR BBPR21; - UCHAR BBPR22; - UCHAR BBPR64; - ULONG InServiceMonitorCount; /* unit: sec */ - UINT8 DfsSessionTime; + u8 CSCount; /*Channel switch counter */ + u8 CSPeriod; /*Channel switch period (beacon count) */ + u8 RDCount; /*Radar detection counter */ + u8 RDMode; /*Radar Detection mode */ + u8 RDDurRegion; /*Radar detection duration region */ + u8 BBPR16; + u8 BBPR17; + u8 BBPR18; + u8 BBPR21; + u8 BBPR22; + u8 BBPR64; + unsigned long InServiceMonitorCount; /* unit: sec */ + u8 DfsSessionTime; BOOLEAN bFastDfs; - UINT8 ChMovingTime; - UINT8 LongPulseRadarTh; + u8 ChMovingTime; + u8 LongPulseRadarTh; } RADAR_DETECT_STRUCT, *PRADAR_DETECT_STRUCT; typedef enum _ABGBAND_STATE_ { @@ -866,14 +866,14 @@ typedef enum _ABGBAND_STATE_ { /* Power save method control */ typedef union _PS_CONTROL { struct { - ULONG EnablePSinIdle:1; /* Enable radio off when not connect to AP. radio on only when sitesurvey, */ - ULONG EnableNewPS:1; /* Enable new Chip power save fucntion . New method can only be applied in chip version after 2872. and PCIe. */ - ULONG rt30xxPowerMode:2; /* Power Level Mode for rt30xx chip */ - ULONG rt30xxFollowHostASPM:1; /* Card Follows Host's setting for rt30xx chip. */ - ULONG rt30xxForceASPMTest:1; /* Force enable L1 for rt30xx chip. This has higher priority than rt30xxFollowHostASPM Mode. */ - ULONG rsv:26; /* Radio Measurement Enable */ + unsigned long EnablePSinIdle:1; /* Enable radio off when not connect to AP. radio on only when sitesurvey, */ + unsigned long EnableNewPS:1; /* Enable new Chip power save fucntion . New method can only be applied in chip version after 2872. and PCIe. */ + unsigned long rt30xxPowerMode:2; /* Power Level Mode for rt30xx chip */ + unsigned long rt30xxFollowHostASPM:1; /* Card Follows Host's setting for rt30xx chip. */ + unsigned long rt30xxForceASPMTest:1; /* Force enable L1 for rt30xx chip. This has higher priority than rt30xxFollowHostASPM Mode. */ + unsigned long rsv:26; /* Radio Measurement Enable */ } field; - ULONG word; + unsigned long word; } PS_CONTROL, *PPS_CONTROL; #endif /* RTMP_MAC_PCI // */ @@ -901,36 +901,36 @@ typedef struct _MLME_STRUCT { STATE_MACHINE WpaMachine; STATE_MACHINE_FUNC WpaFunc[WPA_FUNC_SIZE]; - ULONG ChannelQuality; /* 0..100, Channel Quality Indication for Roaming */ - ULONG Now32; /* latch the value of NdisGetSystemUpTime() */ - ULONG LastSendNULLpsmTime; + unsigned long ChannelQuality; /* 0..100, Channel Quality Indication for Roaming */ + unsigned long Now32; /* latch the value of NdisGetSystemUpTime() */ + unsigned long LastSendNULLpsmTime; BOOLEAN bRunning; NDIS_SPIN_LOCK TaskLock; MLME_QUEUE Queue; - UINT ShiftReg; + u32 ShiftReg; RALINK_TIMER_STRUCT PeriodicTimer; RALINK_TIMER_STRUCT APSDPeriodicTimer; RALINK_TIMER_STRUCT LinkDownTimer; RALINK_TIMER_STRUCT LinkUpTimer; #ifdef RTMP_MAC_PCI - UCHAR bPsPollTimerRunning; + u8 bPsPollTimerRunning; RALINK_TIMER_STRUCT PsPollTimer; RALINK_TIMER_STRUCT RadioOnOffTimer; #endif /* RTMP_MAC_PCI // */ - ULONG PeriodicRound; - ULONG OneSecPeriodicRound; + unsigned long PeriodicRound; + unsigned long OneSecPeriodicRound; - UCHAR RealRxPath; + u8 RealRxPath; BOOLEAN bLowThroughput; BOOLEAN bEnableAutoAntennaCheck; RALINK_TIMER_STRUCT RxAntEvalTimer; #ifdef RT30xx - UCHAR CaliBW40RfR24; - UCHAR CaliBW20RfR24; + u8 CaliBW40RfR24; + u8 CaliBW20RfR24; #endif /* RT30xx // */ #ifdef RTMP_MAC_USB @@ -955,7 +955,7 @@ struct reordering_list { }; struct reordering_mpdu_pool { - PVOID mem; + void *mem; NDIS_SPIN_LOCK lock; struct reordering_list freelist; }; @@ -975,97 +975,97 @@ typedef enum _ORI_BLOCKACK_STATUS { } ORI_BLOCKACK_STATUS, *PORI_BLOCKACK_STATUS; typedef struct _BA_ORI_ENTRY { - UCHAR Wcid; - UCHAR TID; - UCHAR BAWinSize; - UCHAR Token; + u8 Wcid; + u8 TID; + u8 BAWinSize; + u8 Token; /* Sequence is to fill every outgoing QoS DATA frame's sequence field in 802.11 header. */ - USHORT Sequence; - USHORT TimeOutValue; + u16 Sequence; + u16 TimeOutValue; ORI_BLOCKACK_STATUS ORI_BA_Status; RALINK_TIMER_STRUCT ORIBATimer; - PVOID pAdapter; + void *pAdapter; } BA_ORI_ENTRY, *PBA_ORI_ENTRY; typedef struct _BA_REC_ENTRY { - UCHAR Wcid; - UCHAR TID; - UCHAR BAWinSize; /* 7.3.1.14. each buffer is capable of holding a max AMSDU or MSDU. */ - /*UCHAR NumOfRxPkt; */ - /*UCHAR Curindidx; // the head in the RX reordering buffer */ - USHORT LastIndSeq; -/* USHORT LastIndSeqAtTimer; */ - USHORT TimeOutValue; + u8 Wcid; + u8 TID; + u8 BAWinSize; /* 7.3.1.14. each buffer is capable of holding a max AMSDU or MSDU. */ + /*u8 NumOfRxPkt; */ + /*u8 Curindidx; // the head in the RX reordering buffer */ + u16 LastIndSeq; +/* u16 LastIndSeqAtTimer; */ + u16 TimeOutValue; RALINK_TIMER_STRUCT RECBATimer; - ULONG LastIndSeqAtTimer; - ULONG nDropPacket; - ULONG rcvSeq; + unsigned long LastIndSeqAtTimer; + unsigned long nDropPacket; + unsigned long rcvSeq; REC_BLOCKACK_STATUS REC_BA_Status; -/* UCHAR RxBufIdxUsed; */ +/* u8 RxBufIdxUsed; */ /* corresponding virtual address for RX reordering packet storage. */ /*RTMP_REORDERDMABUF MAP_RXBuf[MAX_RX_REORDERBUF]; */ NDIS_SPIN_LOCK RxReRingLock; /* Rx Ring spinlock */ /* struct _BA_REC_ENTRY *pNext; */ - PVOID pAdapter; + void *pAdapter; struct reordering_list list; } BA_REC_ENTRY, *PBA_REC_ENTRY; typedef struct { - ULONG numAsRecipient; /* I am recipient of numAsRecipient clients. These client are in the BARecEntry[] */ - ULONG numAsOriginator; /* I am originator of numAsOriginator clients. These clients are in the BAOriEntry[] */ - ULONG numDoneOriginator; /* count Done Originator sessions */ + unsigned long numAsRecipient; /* I am recipient of numAsRecipient clients. These client are in the BARecEntry[] */ + unsigned long numAsOriginator; /* I am originator of numAsOriginator clients. These clients are in the BAOriEntry[] */ + unsigned long numDoneOriginator; /* count Done Originator sessions */ BA_ORI_ENTRY BAOriEntry[MAX_LEN_OF_BA_ORI_TABLE]; BA_REC_ENTRY BARecEntry[MAX_LEN_OF_BA_REC_TABLE]; } BA_TABLE, *PBA_TABLE; /*For QureyBATableOID use; */ typedef struct PACKED _OID_BA_REC_ENTRY { - UCHAR MACAddr[MAC_ADDR_LEN]; - UCHAR BaBitmap; /* if (BaBitmap&(1<> 3; \ - UCHAR bit_offset = wcid & 0x7; \ + { u8 tim_offset = wcid >> 3; \ + u8 bit_offset = wcid & 0x7; \ ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] &= (~BIT8[bit_offset]); } /* set a station PS TIM bit */ #define WLAN_MR_TIM_BIT_SET(ad_p, apidx, wcid) \ - { UCHAR tim_offset = wcid >> 3; \ - UCHAR bit_offset = wcid & 0x7; \ + { u8 tim_offset = wcid >> 3; \ + u8 bit_offset = wcid & 0x7; \ ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] |= BIT8[bit_offset]; } /* configuration common to OPMODE_AP as well as OPMODE_STA */ typedef struct _COMMON_CONFIG { BOOLEAN bCountryFlag; - UCHAR CountryCode[3]; - UCHAR Geography; - UCHAR CountryRegion; /* Enum of country region, 0:FCC, 1:IC, 2:ETSI, 3:SPAIN, 4:France, 5:MKK, 6:MKK1, 7:Israel */ - UCHAR CountryRegionForABand; /* Enum of country region for A band */ - UCHAR PhyMode; /* PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED */ - USHORT Dsifs; /* in units of usec */ - ULONG PacketFilter; /* Packet filter for receiving */ - UINT8 RegulatoryClass; - - CHAR Ssid[MAX_LEN_OF_SSID]; /* NOT NULL-terminated */ - UCHAR SsidLen; /* the actual ssid length in used */ - UCHAR LastSsidLen; /* the actual ssid length in used */ - CHAR LastSsid[MAX_LEN_OF_SSID]; /* NOT NULL-terminated */ - UCHAR LastBssid[MAC_ADDR_LEN]; - - UCHAR Bssid[MAC_ADDR_LEN]; - USHORT BeaconPeriod; - UCHAR Channel; - UCHAR CentralChannel; /* Central Channel when using 40MHz is indicating. not real channel. */ - - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR ExtRateLen; - UCHAR DesireRate[MAX_LEN_OF_SUPPORTED_RATES]; /* OID_802_11_DESIRED_RATES */ - UCHAR MaxDesiredRate; - UCHAR ExpectedACKRate[MAX_LEN_OF_SUPPORTED_RATES]; - - ULONG BasicRateBitmap; /* backup basic ratebitmap */ + u8 CountryCode[3]; + u8 Geography; + u8 CountryRegion; /* Enum of country region, 0:FCC, 1:IC, 2:ETSI, 3:SPAIN, 4:France, 5:MKK, 6:MKK1, 7:Israel */ + u8 CountryRegionForABand; /* Enum of country region for A band */ + u8 PhyMode; /* PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED */ + u16 Dsifs; /* in units of usec */ + unsigned long PacketFilter; /* Packet filter for receiving */ + u8 RegulatoryClass; + + char Ssid[MAX_LEN_OF_SSID]; /* NOT NULL-terminated */ + u8 SsidLen; /* the actual ssid length in used */ + u8 LastSsidLen; /* the actual ssid length in used */ + char LastSsid[MAX_LEN_OF_SSID]; /* NOT NULL-terminated */ + u8 LastBssid[MAC_ADDR_LEN]; + + u8 Bssid[MAC_ADDR_LEN]; + u16 BeaconPeriod; + u8 Channel; + u8 CentralChannel; /* Central Channel when using 40MHz is indicating. not real channel. */ + + u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES]; + u8 SupRateLen; + u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; + u8 ExtRateLen; + u8 DesireRate[MAX_LEN_OF_SUPPORTED_RATES]; /* OID_802_11_DESIRED_RATES */ + u8 MaxDesiredRate; + u8 ExpectedACKRate[MAX_LEN_OF_SUPPORTED_RATES]; + + unsigned long BasicRateBitmap; /* backup basic ratebitmap */ BOOLEAN bAPSDCapable; BOOLEAN bInServicePeriod; @@ -1217,45 +1217,45 @@ typedef struct _COMMON_CONFIG { BOOLEAN bNeedSendTriggerFrame; BOOLEAN bAPSDForcePowerSave; /* Force power save mode, should only use in APSD-STAUT */ - ULONG TriggerTimerCount; - UCHAR MaxSPLength; - UCHAR BBPCurrentBW; /* BW_10, BW_20, BW_40 */ + unsigned long TriggerTimerCount; + u8 MaxSPLength; + u8 BBPCurrentBW; /* BW_10, BW_20, BW_40 */ /* move to MULTISSID_STRUCT for MBSS */ /*HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI. */ REG_TRANSMIT_SETTING RegTransmitSetting; /*registry transmit setting. this is for reading registry setting only. not useful. */ - /*UCHAR FixedTxMode; // Fixed Tx Mode (CCK, OFDM), for HT fixed tx mode (GF, MIX) , refer to RegTransmitSetting.field.HTMode */ - UCHAR TxRate; /* Same value to fill in TXD. TxRate is 6-bit */ - UCHAR MaxTxRate; /* RATE_1, RATE_2, RATE_5_5, RATE_11 */ - UCHAR TxRateIndex; /* Tx rate index in RateSwitchTable */ - UCHAR TxRateTableSize; /* Valid Tx rate table size in RateSwitchTable */ + /*u8 FixedTxMode; // Fixed Tx Mode (CCK, OFDM), for HT fixed tx mode (GF, MIX) , refer to RegTransmitSetting.field.HTMode */ + u8 TxRate; /* Same value to fill in TXD. TxRate is 6-bit */ + u8 MaxTxRate; /* RATE_1, RATE_2, RATE_5_5, RATE_11 */ + u8 TxRateIndex; /* Tx rate index in RateSwitchTable */ + u8 TxRateTableSize; /* Valid Tx rate table size in RateSwitchTable */ /*BOOLEAN bAutoTxRateSwitch; */ - UCHAR MinTxRate; /* RATE_1, RATE_2, RATE_5_5, RATE_11 */ - UCHAR RtsRate; /* RATE_xxx */ + u8 MinTxRate; /* RATE_1, RATE_2, RATE_5_5, RATE_11 */ + u8 RtsRate; /* RATE_xxx */ HTTRANSMIT_SETTING MlmeTransmit; /* MGMT frame PHY rate setting when operatin at Ht rate. */ - UCHAR MlmeRate; /* RATE_xxx, used to send MLME frames */ - UCHAR BasicMlmeRate; /* Default Rate for sending MLME frames */ + u8 MlmeRate; /* RATE_xxx, used to send MLME frames */ + u8 BasicMlmeRate; /* Default Rate for sending MLME frames */ - USHORT RtsThreshold; /* in unit of BYTE */ - USHORT FragmentThreshold; /* in unit of BYTE */ + u16 RtsThreshold; /* in unit of BYTE */ + u16 FragmentThreshold; /* in unit of BYTE */ - UCHAR TxPower; /* in unit of mW */ - ULONG TxPowerPercentage; /* 0~100 % */ - ULONG TxPowerDefault; /* keep for TxPowerPercentage */ - UINT8 PwrConstraint; + u8 TxPower; /* in unit of mW */ + unsigned long TxPowerPercentage; /* 0~100 % */ + unsigned long TxPowerDefault; /* keep for TxPowerPercentage */ + u8 PwrConstraint; BACAP_STRUC BACapability; /* NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 */ BACAP_STRUC REGBACapability; /* NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 */ IOT_STRUC IOTestParm; /* 802.11n InterOpbility Test Parameter; */ - ULONG TxPreamble; /* Rt802_11PreambleLong, Rt802_11PreambleShort, Rt802_11PreambleAuto */ + unsigned long TxPreamble; /* Rt802_11PreambleLong, Rt802_11PreambleShort, Rt802_11PreambleAuto */ BOOLEAN bUseZeroToDisableFragment; /* Microsoft use 0 as disable */ - ULONG UseBGProtection; /* 0: auto, 1: always use, 2: always not use */ + unsigned long UseBGProtection; /* 0: auto, 1: always use, 2: always not use */ BOOLEAN bUseShortSlotTime; /* 0: disable, 1 - use short slot (9us) */ BOOLEAN bEnableTxBurst; /* 1: enble TX PACKET BURST (when BA is established or AP is not a legacy WMM AP), 0: disable TX PACKET BURST */ BOOLEAN bAggregationCapable; /* 1: enable TX aggregation when the peer supports it */ BOOLEAN bPiggyBackCapable; /* 1: enable TX piggy-back according MAC's version */ BOOLEAN bIEEE80211H; /* 1: enable IEEE802.11h spec. */ - ULONG DisableOLBCDetect; /* 0: enable OLBC detect; 1 disable OLBC detect */ + unsigned long DisableOLBCDetect; /* 0: enable OLBC detect; 1 disable OLBC detect */ BOOLEAN bRdg; @@ -1263,13 +1263,13 @@ typedef struct _COMMON_CONFIG { QOS_CAPABILITY_PARM APQosCapability; /* QOS capability of the current associated AP */ EDCA_PARM APEdcaParm; /* EDCA parameters of the current associated AP */ QBSS_LOAD_PARM APQbssLoad; /* QBSS load of the current associated AP */ - UCHAR AckPolicy[4]; /* ACK policy of the specified AC. see ACK_xxx */ + u8 AckPolicy[4]; /* ACK policy of the specified AC. see ACK_xxx */ BOOLEAN bDLSCapable; /* 0:disable DLS, 1:enable DLS */ /* a bitmap of BOOLEAN flags. each bit represent an operation status of a particular */ /* BOOLEAN control, either ON or OFF. These flags should always be accessed via */ /* OPSTATUS_TEST_FLAG(), OPSTATUS_SET_FLAG(), OP_STATUS_CLEAR_FLAG() macros. */ /* see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition */ - ULONG OpStatusFlags; + unsigned long OpStatusFlags; BOOLEAN NdisRadioStateOff; /*For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff. */ ABGBAND_STATE BandState; /* For setting BBP used on B/G or A mode. */ @@ -1278,7 +1278,7 @@ typedef struct _COMMON_CONFIG { RADAR_DETECT_STRUCT RadarDetect; /* HT */ - UCHAR BASize; /* USer desired BAWindowSize. Should not exceed our max capability */ + u8 BASize; /* USer desired BAWindowSize. Should not exceed our max capability */ /*RT_HT_CAPABILITY SupportedHtPhy; */ RT_HT_CAPABILITY DesiredHtPhy; HT_CAPABILITY_IE HtCapability; @@ -1297,34 +1297,34 @@ typedef struct _COMMON_CONFIG { BOOLEAN bForty_Mhz_Intolerant; BOOLEAN bExtChannelSwitchAnnouncement; BOOLEAN bRcvBSSWidthTriggerEvents; - ULONG LastRcvBSSWidthTriggerEventsTime; + unsigned long LastRcvBSSWidthTriggerEventsTime; - UCHAR TxBASize; + u8 TxBASize; /* Enable wireless event */ BOOLEAN bWirelessEvent; BOOLEAN bWiFiTest; /* Enable this parameter for WiFi test */ /* Tx & Rx Stream number selection */ - UCHAR TxStream; - UCHAR RxStream; + u8 TxStream; + u8 RxStream; BOOLEAN bHardwareRadio; /* Hardware controlled Radio enabled */ #ifdef RTMP_MAC_USB BOOLEAN bMultipleIRP; /* Multiple Bulk IN flag */ - UCHAR NumOfBulkInIRP; /* if bMultipleIRP == TRUE, NumOfBulkInIRP will be 4 otherwise be 1 */ + u8 NumOfBulkInIRP; /* if bMultipleIRP == TRUE, NumOfBulkInIRP will be 4 otherwise be 1 */ RT_HT_CAPABILITY SupportedHtPhy; - ULONG MaxPktOneTxBulk; - UCHAR TxBulkFactor; - UCHAR RxBulkFactor; + unsigned long MaxPktOneTxBulk; + u8 TxBulkFactor; + u8 RxBulkFactor; BOOLEAN IsUpdateBeacon; BEACON_SYNC_STRUCT *pBeaconSync; RALINK_TIMER_STRUCT BeaconUpdateTimer; - UINT32 BeaconAdjust; - UINT32 BeaconFactor; - UINT32 BeaconRemain; + u32 BeaconAdjust; + u32 BeaconFactor; + u32 BeaconRemain; #endif /* RTMP_MAC_USB // */ NDIS_SPIN_LOCK MeasureReqTabLock; @@ -1337,7 +1337,7 @@ typedef struct _COMMON_CONFIG { #if defined(RT305x)||defined(RT30xx) /* request by Gary, for High Power issue */ - UCHAR HighPowerPatchDisabled; + u8 HighPowerPatchDisabled; #endif BOOLEAN HT_DisallowTKIP; /* Restrict the encryption type in 11n HT mode */ @@ -1352,31 +1352,31 @@ typedef struct _STA_ADMIN_CONFIG { /* settings in ACTIVE BSS after negotiation/compromize with the BSS holder (either */ /* AP or IBSS holder). */ /* Once initialized, user configuration can only be changed via OID_xxx */ - UCHAR BssType; /* BSS_INFRA or BSS_ADHOC */ - USHORT AtimWin; /* used when starting a new IBSS */ + u8 BssType; /* BSS_INFRA or BSS_ADHOC */ + u16 AtimWin; /* used when starting a new IBSS */ /* GROUP 2 - */ /* User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe */ /* the user intended configuration, and should be always applied to the final */ /* settings in ACTIVE BSS without compromising with the BSS holder. */ /* Once initialized, user configuration can only be changed via OID_xxx */ - UCHAR RssiTrigger; - UCHAR RssiTriggerMode; /* RSSI_TRIGGERED_UPON_BELOW_THRESHOLD or RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD */ - USHORT DefaultListenCount; /* default listen count; */ - ULONG WindowsPowerMode; /* Power mode for AC power */ - ULONG WindowsBatteryPowerMode; /* Power mode for battery if exists */ + u8 RssiTrigger; + u8 RssiTriggerMode; /* RSSI_TRIGGERED_UPON_BELOW_THRESHOLD or RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD */ + u16 DefaultListenCount; /* default listen count; */ + unsigned long WindowsPowerMode; /* Power mode for AC power */ + unsigned long WindowsBatteryPowerMode; /* Power mode for battery if exists */ BOOLEAN bWindowsACCAMEnable; /* Enable CAM power mode when AC on */ BOOLEAN bAutoReconnect; /* Set to TRUE when setting OID_802_11_SSID with no matching BSSID */ - ULONG WindowsPowerProfile; /* Windows power profile, for NDIS5.1 PnP */ + unsigned long WindowsPowerProfile; /* Windows power profile, for NDIS5.1 PnP */ /* MIB:ieee802dot11.dot11smt(1).dot11StationConfigTable(1) */ - USHORT Psm; /* power management mode (PWR_ACTIVE|PWR_SAVE) */ - USHORT DisassocReason; - UCHAR DisassocSta[MAC_ADDR_LEN]; - USHORT DeauthReason; - UCHAR DeauthSta[MAC_ADDR_LEN]; - USHORT AuthFailReason; - UCHAR AuthFailSta[MAC_ADDR_LEN]; + u16 Psm; /* power management mode (PWR_ACTIVE|PWR_SAVE) */ + u16 DisassocReason; + u8 DisassocSta[MAC_ADDR_LEN]; + u16 DeauthReason; + u8 DeauthSta[MAC_ADDR_LEN]; + u16 AuthFailReason; + u8 AuthFailSta[MAC_ADDR_LEN]; NDIS_802_11_PRIVACY_FILTER PrivacyFilter; /* PrivacyFilter enum for 802.1X */ NDIS_802_11_AUTHENTICATION_MODE AuthMode; /* This should match to whatever microsoft defined */ @@ -1387,45 +1387,45 @@ typedef struct _STA_ADMIN_CONFIG { NDIS_802_11_ENCRYPTION_STATUS GroupCipher; /* Multicast cipher suite */ NDIS_802_11_ENCRYPTION_STATUS PairCipher; /* Unicast cipher suite */ BOOLEAN bMixCipher; /* Indicate current Pair & Group use different cipher suites */ - USHORT RsnCapability; + u16 RsnCapability; NDIS_802_11_WEP_STATUS GroupKeyWepStatus; - UCHAR WpaPassPhrase[64]; /* WPA PSK pass phrase */ - UINT WpaPassPhraseLen; /* the length of WPA PSK pass phrase */ - UCHAR PMK[32]; /* WPA PSK mode PMK */ - UCHAR PTK[64]; /* WPA PSK mode PTK */ - UCHAR GTK[32]; /* GTK from authenticator */ + u8 WpaPassPhrase[64]; /* WPA PSK pass phrase */ + u32 WpaPassPhraseLen; /* the length of WPA PSK pass phrase */ + u8 PMK[32]; /* WPA PSK mode PMK */ + u8 PTK[64]; /* WPA PSK mode PTK */ + u8 GTK[32]; /* GTK from authenticator */ BSSID_INFO SavedPMK[PMKID_NO]; - UINT SavedPMKNum; /* Saved PMKID number */ + u32 SavedPMKNum; /* Saved PMKID number */ - UCHAR DefaultKeyId; + u8 DefaultKeyId; /* WPA 802.1x port control, WPA_802_1X_PORT_SECURED, WPA_802_1X_PORT_NOT_SECURED */ - UCHAR PortSecured; + u8 PortSecured; /* For WPA countermeasures */ - ULONG LastMicErrorTime; /* record last MIC error time */ - ULONG MicErrCnt; /* Should be 0, 1, 2, then reset to zero (after disassoiciation). */ + unsigned long LastMicErrorTime; /* record last MIC error time */ + unsigned long MicErrCnt; /* Should be 0, 1, 2, then reset to zero (after disassoiciation). */ BOOLEAN bBlockAssoc; /* Block associate attempt for 60 seconds after counter measure occurred. */ /* For WPA-PSK supplicant state */ WPA_STATE WpaState; /* Default is SS_NOTUSE and handled by microsoft 802.1x */ - UCHAR ReplayCounter[8]; - UCHAR ANonce[32]; /* ANonce for WPA-PSK from aurhenticator */ - UCHAR SNonce[32]; /* SNonce for WPA-PSK */ + u8 ReplayCounter[8]; + u8 ANonce[32]; /* ANonce for WPA-PSK from aurhenticator */ + u8 SNonce[32]; /* SNonce for WPA-PSK */ - UCHAR LastSNR0; /* last received BEACON's SNR */ - UCHAR LastSNR1; /* last received BEACON's SNR for 2nd antenna */ + u8 LastSNR0; /* last received BEACON's SNR */ + u8 LastSNR1; /* last received BEACON's SNR for 2nd antenna */ RSSI_SAMPLE RssiSample; - ULONG NumOfAvgRssiSample; + unsigned long NumOfAvgRssiSample; - ULONG LastBeaconRxTime; /* OS's timestamp of the last BEACON RX time */ - ULONG Last11bBeaconRxTime; /* OS's timestamp of the last 11B BEACON RX time */ - ULONG Last11gBeaconRxTime; /* OS's timestamp of the last 11G BEACON RX time */ - ULONG Last20NBeaconRxTime; /* OS's timestamp of the last 20MHz N BEACON RX time */ + unsigned long LastBeaconRxTime; /* OS's timestamp of the last BEACON RX time */ + unsigned long Last11bBeaconRxTime; /* OS's timestamp of the last 11B BEACON RX time */ + unsigned long Last11gBeaconRxTime; /* OS's timestamp of the last 11G BEACON RX time */ + unsigned long Last20NBeaconRxTime; /* OS's timestamp of the last 20MHz N BEACON RX time */ - ULONG LastScanTime; /* Record last scan time for issue BSSID_SCAN_LIST */ - ULONG ScanCnt; /* Scan counts since most recent SSID, BSSID, SCAN OID request */ + unsigned long LastScanTime; /* Record last scan time for issue BSSID_SCAN_LIST */ + unsigned long ScanCnt; /* Scan counts since most recent SSID, BSSID, SCAN OID request */ BOOLEAN bSwRadio; /* Software controlled Radio On/Off, TRUE: On */ BOOLEAN bHwRadio; /* Hardware controlled Radio On/Off, TRUE: On */ BOOLEAN bRadio; /* Radio state, And of Sw & Hw radio state */ @@ -1435,33 +1435,33 @@ typedef struct _STA_ADMIN_CONFIG { /* New for WPA, windows want us to keep association information and */ /* Fixed IEs from last association response */ NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo; - USHORT ReqVarIELen; /* Length of next VIE include EID & Length */ - UCHAR ReqVarIEs[MAX_VIE_LEN]; /* The content saved here should be little-endian format. */ - USHORT ResVarIELen; /* Length of next VIE include EID & Length */ - UCHAR ResVarIEs[MAX_VIE_LEN]; + u16 ReqVarIELen; /* Length of next VIE include EID & Length */ + u8 ReqVarIEs[MAX_VIE_LEN]; /* The content saved here should be little-endian format. */ + u16 ResVarIELen; /* Length of next VIE include EID & Length */ + u8 ResVarIEs[MAX_VIE_LEN]; - UCHAR RSNIE_Len; - UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; /* The content saved here should be little-endian format. */ + u8 RSNIE_Len; + u8 RSN_IE[MAX_LEN_OF_RSNIE]; /* The content saved here should be little-endian format. */ - ULONG CLBusyBytes; /* Save the total bytes received durning channel load scan time */ - USHORT RPIDensity[8]; /* Array for RPI density collection */ + unsigned long CLBusyBytes; /* Save the total bytes received durning channel load scan time */ + u16 RPIDensity[8]; /* Array for RPI density collection */ - UCHAR RMReqCnt; /* Number of measurement request saved. */ - UCHAR CurrentRMReqIdx; /* Number of measurement request saved. */ + u8 RMReqCnt; /* Number of measurement request saved. */ + u8 CurrentRMReqIdx; /* Number of measurement request saved. */ BOOLEAN ParallelReq; /* Parallel measurement, only one request performed, */ /* It must be the same channel with maximum duration */ - USHORT ParallelDuration; /* Maximum duration for parallel measurement */ - UCHAR ParallelChannel; /* Only one channel with parallel measurement */ - USHORT IAPPToken; /* IAPP dialog token */ + u16 ParallelDuration; /* Maximum duration for parallel measurement */ + u8 ParallelChannel; /* Only one channel with parallel measurement */ + u16 IAPPToken; /* IAPP dialog token */ /* Hack for channel load and noise histogram parameters */ - UCHAR NHFactor; /* Parameter for Noise histogram */ - UCHAR CLFactor; /* Parameter for channel load */ + u8 NHFactor; /* Parameter for Noise histogram */ + u8 CLFactor; /* Parameter for channel load */ RALINK_TIMER_STRUCT StaQuickResponeForRateUpTimer; BOOLEAN StaQuickResponeForRateUpTimerRunning; - UCHAR DtimCount; /* 0.. DtimPeriod-1 */ - UCHAR DtimPeriod; /* default = 3 */ + u8 DtimCount; /* 0.. DtimPeriod-1 */ + u8 DtimPeriod; /* default = 3 */ /*////////////////////////////////////////////////////////////////////////////////////// */ /* This is only for WHQL test. */ @@ -1471,22 +1471,22 @@ typedef struct _STA_ADMIN_CONFIG { RALINK_TIMER_STRUCT WpaDisassocAndBlockAssocTimer; /* Fast Roaming */ BOOLEAN bAutoRoaming; /* 0:disable auto roaming by RSSI, 1:enable auto roaming by RSSI */ - CHAR dBmToRoam; /* the condition to roam when receiving Rssi less than this value. It's negative value. */ + char dBmToRoam; /* the condition to roam when receiving Rssi less than this value. It's negative value. */ BOOLEAN IEEE8021X; BOOLEAN IEEE8021x_required_keys; CIPHER_KEY DesireSharedKey[4]; /* Record user desired WEP keys */ - UCHAR DesireSharedKeyId; + u8 DesireSharedKeyId; /* 0: driver ignores wpa_supplicant */ /* 1: wpa_supplicant initiates scanning and AP selection */ /* 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters */ - UCHAR WpaSupplicantUP; - UCHAR WpaSupplicantScanCount; + u8 WpaSupplicantUP; + u8 WpaSupplicantScanCount; BOOLEAN bRSN_IE_FromWpaSupplicant; - CHAR dev_name[16]; - USHORT OriDevType; + char dev_name[16]; + u16 OriDevType; BOOLEAN bTGnWifiTest; BOOLEAN bScanReqIsFromWebUI; @@ -1497,7 +1497,7 @@ typedef struct _STA_ADMIN_CONFIG { BOOLEAN bAutoTxRateSwitch; #ifdef RTMP_MAC_PCI - UCHAR BBPR3; + u8 BBPR3; /* PS Control has 2 meanings for advanced power save function. */ /* 1. EnablePSinIdle : When no connection, always radio off except need to do site survey. */ /* 2. EnableNewPS : will save more current in sleep or radio off mode. */ @@ -1505,7 +1505,7 @@ typedef struct _STA_ADMIN_CONFIG { #endif /* RTMP_MAC_PCI // */ BOOLEAN bAutoConnectByBssid; - ULONG BeaconLostTime; /* seconds */ + unsigned long BeaconLostTime; /* seconds */ BOOLEAN bForceTxBurst; /* 1: force enble TX PACKET BURST, 0: disable */ } STA_ADMIN_CONFIG, *PSTA_ADMIN_CONFIG; @@ -1516,18 +1516,18 @@ typedef struct _STA_ADMIN_CONFIG { /* Normally, after SCAN or failed roaming attempts, we need to recover back to */ /* the current active settings. */ typedef struct _STA_ACTIVE_CONFIG { - USHORT Aid; - USHORT AtimWin; /* in kusec; IBSS parameter set element */ - USHORT CapabilityInfo; - USHORT CfpMaxDuration; - USHORT CfpPeriod; + u16 Aid; + u16 AtimWin; /* in kusec; IBSS parameter set element */ + u16 CapabilityInfo; + u16 CfpMaxDuration; + u16 CfpPeriod; /* Copy supported rate from desired AP's beacon. We are trying to match */ /* AP's supported and extended rate settings. */ - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen; - UCHAR ExtRateLen; + u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES]; + u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; + u8 SupRateLen; + u8 ExtRateLen; /* Copy supported ht from desired AP's beacon. We are trying to match */ RT_HT_PHY_INFO SupportedPhyInfo; RT_HT_CAPABILITY SupportedHtPhy; @@ -1543,18 +1543,18 @@ typedef struct _MAC_TABLE_ENTRY { BOOLEAN isCached; BOOLEAN bIAmBadAtheros; /* Flag if this is Atheros chip that has IOT problem. We need to turn on RTS/CTS protection. */ - UCHAR EnqueueEapolStartTimerRunning; /* Enqueue EAPoL-Start for triggering EAP SM */ + u8 EnqueueEapolStartTimerRunning; /* Enqueue EAPoL-Start for triggering EAP SM */ /*jan for wpa */ /* record which entry revoke MIC Failure , if it leaves the BSS itself, AP won't update aMICFailTime MIB */ - UCHAR CMTimerRunning; - UCHAR apidx; /* MBSS number */ - UCHAR RSNIE_Len; - UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; - UCHAR ANonce[LEN_KEY_DESC_NONCE]; - UCHAR SNonce[LEN_KEY_DESC_NONCE]; - UCHAR R_Counter[LEN_KEY_DESC_REPLAY]; - UCHAR PTK[64]; - UCHAR ReTryCounter; + u8 CMTimerRunning; + u8 apidx; /* MBSS number */ + u8 RSNIE_Len; + u8 RSN_IE[MAX_LEN_OF_RSNIE]; + u8 ANonce[LEN_KEY_DESC_NONCE]; + u8 SNonce[LEN_KEY_DESC_NONCE]; + u8 R_Counter[LEN_KEY_DESC_REPLAY]; + u8 PTK[64]; + u8 ReTryCounter; RALINK_TIMER_STRUCT RetryTimer; RALINK_TIMER_STRUCT EnqueueStartForPSKTimer; /* A timer which enqueue EAPoL-Start for triggering PSK SM */ NDIS_802_11_AUTHENTICATION_MODE AuthMode; /* This should match to whatever microsoft defined */ @@ -1562,113 +1562,113 @@ typedef struct _MAC_TABLE_ENTRY { NDIS_802_11_WEP_STATUS GroupKeyWepStatus; AP_WPA_STATE WpaState; GTK_STATE GTKState; - USHORT PortSecured; + u16 PortSecured; NDIS_802_11_PRIVACY_FILTER PrivacyFilter; /* PrivacyFilter enum for 802.1X */ CIPHER_KEY PairwiseKey; - PVOID pAd; - INT PMKID_CacheIdx; - UCHAR PMKID[LEN_PMKID]; + void *pAd; + int PMKID_CacheIdx; + u8 PMKID[LEN_PMKID]; - UCHAR Addr[MAC_ADDR_LEN]; - UCHAR PsMode; + u8 Addr[MAC_ADDR_LEN]; + u8 PsMode; SST Sst; AUTH_STATE AuthState; /* for SHARED KEY authentication state machine used only */ BOOLEAN IsReassocSta; /* Indicate whether this is a reassociation procedure */ - USHORT Aid; - USHORT CapabilityInfo; - UCHAR LastRssi; - ULONG NoDataIdleCount; - UINT16 StationKeepAliveCount; /* unit: second */ - ULONG PsQIdleCount; + u16 Aid; + u16 CapabilityInfo; + u8 LastRssi; + unsigned long NoDataIdleCount; + u16 StationKeepAliveCount; /* unit: second */ + unsigned long PsQIdleCount; QUEUE_HEADER PsQueue; - UINT32 StaConnectTime; /* the live time of this station since associated with AP */ + u32 StaConnectTime; /* the live time of this station since associated with AP */ BOOLEAN bSendBAR; - USHORT NoBADataCountDown; + u16 NoBADataCountDown; - UINT32 CachedBuf[16]; /* UINT (4 bytes) for alignment */ - UINT TxBFCount; /* 3*3 */ - UINT FIFOCount; - UINT DebugFIFOCount; - UINT DebugTxCount; + u32 CachedBuf[16]; /* u32 (4 bytes) for alignment */ + u32 TxBFCount; /* 3*3 */ + u32 FIFOCount; + u32 DebugFIFOCount; + u32 DebugTxCount; BOOLEAN bDlsInit; /*==================================================== */ /*WDS entry needs these */ /* if ValidAsWDS==TRUE, MatchWDSTabIdx is the index in WdsTab.MacTab */ - UINT MatchWDSTabIdx; - UCHAR MaxSupportedRate; - UCHAR CurrTxRate; - UCHAR CurrTxRateIndex; + u32 MatchWDSTabIdx; + u8 MaxSupportedRate; + u8 CurrTxRate; + u8 CurrTxRateIndex; /* to record the each TX rate's quality. 0 is best, the bigger the worse. */ - USHORT TxQuality[MAX_STEP_OF_TX_RATE_SWITCH]; -/* USHORT OneSecTxOkCount; */ - UINT32 OneSecTxNoRetryOkCount; - UINT32 OneSecTxRetryOkCount; - UINT32 OneSecTxFailCount; - UINT32 ContinueTxFailCnt; - UINT32 CurrTxRateStableTime; /* # of second in current TX rate */ - UCHAR TxRateUpPenalty; /* extra # of second penalty due to last unstable condition */ + u16 TxQuality[MAX_STEP_OF_TX_RATE_SWITCH]; +/* u16 OneSecTxOkCount; */ + u32 OneSecTxNoRetryOkCount; + u32 OneSecTxRetryOkCount; + u32 OneSecTxFailCount; + u32 ContinueTxFailCnt; + u32 CurrTxRateStableTime; /* # of second in current TX rate */ + u8 TxRateUpPenalty; /* extra # of second penalty due to last unstable condition */ /*==================================================== */ BOOLEAN fNoisyEnvironment; BOOLEAN fLastSecAccordingRSSI; - UCHAR LastSecTxRateChangeAction; /* 0: no change, 1:rate UP, 2:rate down */ - CHAR LastTimeTxRateChangeAction; /*Keep last time value of LastSecTxRateChangeAction */ - ULONG LastTxOkCount; - UCHAR PER[MAX_STEP_OF_TX_RATE_SWITCH]; + u8 LastSecTxRateChangeAction; /* 0: no change, 1:rate UP, 2:rate down */ + char LastTimeTxRateChangeAction; /*Keep last time value of LastSecTxRateChangeAction */ + unsigned long LastTxOkCount; + u8 PER[MAX_STEP_OF_TX_RATE_SWITCH]; /* a bitmap of BOOLEAN flags. each bit represent an operation status of a particular */ /* BOOLEAN control, either ON or OFF. These flags should always be accessed via */ /* CLIENT_STATUS_TEST_FLAG(), CLIENT_STATUS_SET_FLAG(), CLIENT_STATUS_CLEAR_FLAG() macros. */ /* see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition. fCLIENT_STATUS_AMSDU_INUSED */ - ULONG ClientStatusFlags; + unsigned long ClientStatusFlags; HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode; /* For transmit phy setting in TXWI. */ /* HT EWC MIMO-N used parameters */ - USHORT RXBAbitmap; /* fill to on-chip RXWI_BA_BITMASK in 8.1.3RX attribute entry format */ - USHORT TXBAbitmap; /* This bitmap as originator, only keep in software used to mark AMPDU bit in TXWI */ - USHORT TXAutoBAbitmap; - USHORT BADeclineBitmap; - USHORT BARecWcidArray[NUM_OF_TID]; /* The mapping wcid of recipient session. if RXBAbitmap bit is masked */ - USHORT BAOriWcidArray[NUM_OF_TID]; /* The mapping wcid of originator session. if TXBAbitmap bit is masked */ - USHORT BAOriSequence[NUM_OF_TID]; /* The mapping wcid of originator session. if TXBAbitmap bit is masked */ + u16 RXBAbitmap; /* fill to on-chip RXWI_BA_BITMASK in 8.1.3RX attribute entry format */ + u16 TXBAbitmap; /* This bitmap as originator, only keep in software used to mark AMPDU bit in TXWI */ + u16 TXAutoBAbitmap; + u16 BADeclineBitmap; + u16 BARecWcidArray[NUM_OF_TID]; /* The mapping wcid of recipient session. if RXBAbitmap bit is masked */ + u16 BAOriWcidArray[NUM_OF_TID]; /* The mapping wcid of originator session. if TXBAbitmap bit is masked */ + u16 BAOriSequence[NUM_OF_TID]; /* The mapping wcid of originator session. if TXBAbitmap bit is masked */ /* 802.11n features. */ - UCHAR MpduDensity; - UCHAR MaxRAmpduFactor; - UCHAR AMsduSize; - UCHAR MmpsMode; /* MIMO power save more. */ + u8 MpduDensity; + u8 MaxRAmpduFactor; + u8 AMsduSize; + u8 MmpsMode; /* MIMO power save more. */ HT_CAPABILITY_IE HTCapability; BOOLEAN bAutoTxRateSwitch; - UCHAR RateLen; + u8 RateLen; struct _MAC_TABLE_ENTRY *pNext; - USHORT TxSeq[NUM_OF_TID]; - USHORT NonQosDataSeq; + u16 TxSeq[NUM_OF_TID]; + u16 NonQosDataSeq; RSSI_SAMPLE RssiSample; - UINT32 TXMCSExpected[16]; - UINT32 TXMCSSuccessful[16]; - UINT32 TXMCSFailed[16]; - UINT32 TXMCSAutoFallBack[16][16]; + u32 TXMCSExpected[16]; + u32 TXMCSSuccessful[16]; + u32 TXMCSFailed[16]; + u32 TXMCSAutoFallBack[16][16]; - ULONG LastBeaconRxTime; + unsigned long LastBeaconRxTime; - ULONG AssocDeadLine; + unsigned long AssocDeadLine; } MAC_TABLE_ENTRY, *PMAC_TABLE_ENTRY; typedef struct _MAC_TABLE { - USHORT Size; + u16 Size; MAC_TABLE_ENTRY *Hash[HASH_TABLE_SIZE]; MAC_TABLE_ENTRY Content[MAX_LEN_OF_MAC_TABLE]; QUEUE_HEADER McastPsQueue; - ULONG PsQIdleCount; + unsigned long PsQIdleCount; BOOLEAN fAnyStationInPsm; BOOLEAN fAnyStationBadAtheros; /* Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip. */ BOOLEAN fAnyTxOPForceDisable; /* Check if it is necessary to disable BE TxOP */ @@ -1688,19 +1688,19 @@ struct wificonf { }; typedef struct _RTMP_DEV_INFO_ { - UCHAR chipName[16]; + u8 chipName[16]; RTMP_INF_TYPE infType; } RTMP_DEV_INFO; struct _RTMP_CHIP_OP_ { /* Calibration access related callback functions */ int (*eeinit) (RTMP_ADAPTER * pAd); /* int (*eeinit)(RTMP_ADAPTER *pAd); */ - int (*eeread) (RTMP_ADAPTER * pAd, USHORT offset, PUSHORT pValue); /* int (*eeread)(RTMP_ADAPTER *pAd, int offset, PUSHORT pValue); */ + int (*eeread) (RTMP_ADAPTER * pAd, u16 offset, u16 *pValue); /* int (*eeread)(RTMP_ADAPTER *pAd, int offset, u16 *pValue); */ /* MCU related callback functions */ int (*loadFirmware) (RTMP_ADAPTER * pAd); /* int (*loadFirmware)(RTMP_ADAPTER *pAd); */ int (*eraseFirmware) (RTMP_ADAPTER * pAd); /* int (*eraseFirmware)(RTMP_ADAPTER *pAd); */ - int (*sendCommandToMcu) (RTMP_ADAPTER * pAd, UCHAR cmd, UCHAR token, UCHAR arg0, UCHAR arg1);; /* int (*sendCommandToMcu)(RTMP_ADAPTER *pAd, UCHAR cmd, UCHAR token, UCHAR arg0, UCHAR arg1); */ + int (*sendCommandToMcu) (RTMP_ADAPTER * pAd, u8 cmd, u8 token, u8 arg0, u8 arg1);; /* int (*sendCommandToMcu)(RTMP_ADAPTER *pAd, u8 cmd, u8 token, u8 arg0, u8 arg1); */ /* RF access related callback functions */ REG_PAIR *pRFRegTable; @@ -1715,40 +1715,40 @@ struct _RTMP_CHIP_OP_ { /* The miniport adapter structure */ /* */ struct _RTMP_ADAPTER { - PVOID OS_Cookie; /* save specific structure relative to OS */ + void *OS_Cookie; /* save specific structure relative to OS */ PNET_DEV net_dev; - ULONG VirtualIfCnt; + unsigned long VirtualIfCnt; RTMP_CHIP_OP chipOps; - USHORT ThisTbttNumToNextWakeUp; + u16 ThisTbttNumToNextWakeUp; #ifdef RTMP_MAC_PCI /*****************************************************************************************/ /* PCI related parameters */ /*****************************************************************************************/ - PUCHAR CSRBaseAddress; /* PCI MMIO Base Address, all access will use */ + u8 *CSRBaseAddress; /* PCI MMIO Base Address, all access will use */ unsigned int irq_num; - USHORT LnkCtrlBitMask; - USHORT RLnkCtrlConfiguration; - USHORT RLnkCtrlOffset; - USHORT HostLnkCtrlConfiguration; - USHORT HostLnkCtrlOffset; - USHORT PCIePowerSaveLevel; - ULONG Rt3xxHostLinkCtrl; /* USed for 3090F chip */ - ULONG Rt3xxRalinkLinkCtrl; /* USed for 3090F chip */ - USHORT DeviceID; /* Read from PCI config */ - ULONG AccessBBPFailCount; + u16 LnkCtrlBitMask; + u16 RLnkCtrlConfiguration; + u16 RLnkCtrlOffset; + u16 HostLnkCtrlConfiguration; + u16 HostLnkCtrlOffset; + u16 PCIePowerSaveLevel; + unsigned long Rt3xxHostLinkCtrl; /* USed for 3090F chip */ + unsigned long Rt3xxRalinkLinkCtrl; /* USed for 3090F chip */ + u16 DeviceID; /* Read from PCI config */ + unsigned long AccessBBPFailCount; BOOLEAN bPCIclkOff; /* flag that indicate if the PICE power status in Configuration SPace.. */ BOOLEAN bPCIclkOffDisableTx; /* */ BOOLEAN brt30xxBanMcuCmd; /*when = 0xff means all commands are ok to set . */ BOOLEAN b3090ESpecialChip; /*3090E special chip that write EEPROM 0x24=0x9280. */ - ULONG CheckDmaBusyCount; /* Check Interrupt Status Register Count. */ + unsigned long CheckDmaBusyCount; /* Check Interrupt Status Register Count. */ - UINT int_enable_reg; - UINT int_disable_mask; - UINT int_pending; + u32 int_enable_reg; + u32 int_disable_mask; + u32 int_pending; RTMP_DMABUF TxBufSpace[NUM_OF_TX_RING]; /* Shared memory of all 1st pre-allocated TxBuf associated with each TXD */ RTMP_DMABUF RxDescRing; /* Shared memory for RX descriptors */ @@ -1757,23 +1757,23 @@ struct _RTMP_ADAPTER { #endif /* RTMP_MAC_PCI // */ NDIS_SPIN_LOCK irq_lock; - UCHAR irq_disabled; + u8 irq_disabled; #ifdef RTMP_MAC_USB /*****************************************************************************************/ /* USB related parameters */ /*****************************************************************************************/ struct usb_config_descriptor *config; - UINT BulkInEpAddr; /* bulk-in endpoint address */ - UINT BulkOutEpAddr[6]; /* bulk-out endpoint address */ + u32 BulkInEpAddr; /* bulk-in endpoint address */ + u32 BulkOutEpAddr[6]; /* bulk-out endpoint address */ - UINT NumberOfPipes; - USHORT BulkOutMaxPacketSize; - USHORT BulkInMaxPacketSize; + u32 NumberOfPipes; + u16 BulkOutMaxPacketSize; + u16 BulkInMaxPacketSize; /*======Control Flags */ - LONG PendingIoCount; - ULONG BulkFlags; + long PendingIoCount; + unsigned long BulkFlags; BOOLEAN bUsbTxBulkAggre; /* Flags for bulk out data priority */ /*======Cmd Thread */ @@ -1783,7 +1783,7 @@ struct _RTMP_ADAPTER { /*======Semaphores (event) */ RTMP_OS_SEM UsbVendorReq_semaphore; - PVOID UsbVendorReqBuf; + void *UsbVendorReqBuf; wait_queue_head_t *wait; #endif /* RTMP_MAC_USB // */ @@ -1823,12 +1823,12 @@ struct _RTMP_ADAPTER { NDIS_SPIN_LOCK TxContextQueueLock[NUM_OF_TX_RING]; /* TxContextQueue spinlock */ /* 4 sets of Bulk Out index and pending flag */ - UCHAR NextBulkOutIndex[4]; /* only used for 4 EDCA bulkout pipe */ + u8 NextBulkOutIndex[4]; /* only used for 4 EDCA bulkout pipe */ BOOLEAN BulkOutPending[6]; /* used for total 6 bulkout pipe */ - UCHAR bulkResetPipeid; + u8 bulkResetPipeid; BOOLEAN MgmtBulkPending; - ULONG bulkResetReq[6]; + unsigned long bulkResetReq[6]; #endif /* RTMP_MAC_USB // */ /* resource for software backlog queues */ @@ -1853,41 +1853,41 @@ struct _RTMP_ADAPTER { #ifdef RTMP_MAC_USB RX_CONTEXT RxContext[RX_RING_SIZE]; /* 1 for redundant multiple IRP bulk in. */ NDIS_SPIN_LOCK BulkInLock; /* BulkIn spinlock for 4 ACs */ - UCHAR PendingRx; /* The Maximum pending Rx value should be RX_RING_SIZE. */ - UCHAR NextRxBulkInIndex; /* Indicate the current RxContext Index which hold by Host controller. */ - UCHAR NextRxBulkInReadIndex; /* Indicate the current RxContext Index which driver can read & process it. */ - ULONG NextRxBulkInPosition; /* Want to contatenate 2 URB buffer while 1st is bulkin failed URB. This Position is 1st URB TransferLength. */ - ULONG TransferBufferLength; /* current length of the packet buffer */ - ULONG ReadPosition; /* current read position in a packet buffer */ + u8 PendingRx; /* The Maximum pending Rx value should be RX_RING_SIZE. */ + u8 NextRxBulkInIndex; /* Indicate the current RxContext Index which hold by Host controller. */ + u8 NextRxBulkInReadIndex; /* Indicate the current RxContext Index which driver can read & process it. */ + unsigned long NextRxBulkInPosition; /* Want to contatenate 2 URB buffer while 1st is bulkin failed URB. This Position is 1st URB TransferLength. */ + unsigned long TransferBufferLength; /* current length of the packet buffer */ + unsigned long ReadPosition; /* current read position in a packet buffer */ #endif /* RTMP_MAC_USB // */ /*****************************************************************************************/ /* ASIC related parameters */ /*****************************************************************************************/ - UINT32 MACVersion; /* MAC version. Record rt2860C(0x28600100) or rt2860D (0x28600101).. */ + u32 MACVersion; /* MAC version. Record rt2860C(0x28600100) or rt2860D (0x28600101).. */ /* --------------------------- */ /* E2PROM */ /* --------------------------- */ - ULONG EepromVersion; /* byte 0: version, byte 1: revision, byte 2~3: unused */ - ULONG FirmwareVersion; /* byte 0: Minor version, byte 1: Major version, otherwise unused. */ - USHORT EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS]; - UCHAR EEPROMAddressNum; /* 93c46=6 93c66=8 */ + unsigned long EepromVersion; /* byte 0: version, byte 1: revision, byte 2~3: unused */ + unsigned long FirmwareVersion; /* byte 0: Minor version, byte 1: Major version, otherwise unused. */ + u16 EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS]; + u8 EEPROMAddressNum; /* 93c46=6 93c66=8 */ BOOLEAN EepromAccess; - UCHAR EFuseTag; + u8 EFuseTag; /* --------------------------- */ /* BBP Control */ /* --------------------------- */ - UCHAR BbpWriteLatch[140]; /* record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID */ - CHAR BbpRssiToDbmDelta; /* change from UCHAR to CHAR for high power */ + u8 BbpWriteLatch[140]; /* record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID */ + char BbpRssiToDbmDelta; /* change from u8 to char for high power */ BBP_R66_TUNING BbpTuning; /* ---------------------------- */ /* RFIC control */ /* ---------------------------- */ - UCHAR RfIcType; /* RFIC_xxx */ - ULONG RfFreqOffset; /* Frequency offset for channel switching */ + u8 RfIcType; /* RFIC_xxx */ + unsigned long RfFreqOffset; /* Frequency offset for channel switching */ RTMP_RF_REGS LatchRfRegs; /* latch th latest RF programming value since RF IC doesn't support READ */ EEPROM_ANTENNA_STRUC Antenna; /* Since ANtenna definition is different for a & g. We need to save it for future reference. */ @@ -1897,73 +1897,73 @@ struct _RTMP_ADAPTER { /* RX Antenna = DIVERSITY ON */ SOFT_RX_ANT_DIVERSITY RxAnt; - UCHAR RFProgSeq; + u8 RFProgSeq; CHANNEL_TX_POWER TxPower[MAX_NUM_OF_CHANNELS]; /* Store Tx power value for all channels. */ CHANNEL_TX_POWER ChannelList[MAX_NUM_OF_CHANNELS]; /* list all supported channels for site survey */ CHANNEL_11J_TX_POWER TxPower11J[MAX_NUM_OF_11JCHANNELS]; /* 802.11j channel and bw */ CHANNEL_11J_TX_POWER ChannelList11J[MAX_NUM_OF_11JCHANNELS]; /* list all supported channels for site survey */ - UCHAR ChannelListNum; /* number of channel in ChannelList[] */ - UCHAR Bbp94; + u8 ChannelListNum; /* number of channel in ChannelList[] */ + u8 Bbp94; BOOLEAN BbpForCCK; - ULONG Tx20MPwrCfgABand[5]; - ULONG Tx20MPwrCfgGBand[5]; - ULONG Tx40MPwrCfgABand[5]; - ULONG Tx40MPwrCfgGBand[5]; + unsigned long Tx20MPwrCfgABand[5]; + unsigned long Tx20MPwrCfgGBand[5]; + unsigned long Tx40MPwrCfgABand[5]; + unsigned long Tx40MPwrCfgGBand[5]; BOOLEAN bAutoTxAgcA; /* Enable driver auto Tx Agc control */ - UCHAR TssiRefA; /* Store Tssi reference value as 25 temperature. */ - UCHAR TssiPlusBoundaryA[5]; /* Tssi boundary for increase Tx power to compensate. */ - UCHAR TssiMinusBoundaryA[5]; /* Tssi boundary for decrease Tx power to compensate. */ - UCHAR TxAgcStepA; /* Store Tx TSSI delta increment / decrement value */ - CHAR TxAgcCompensateA; /* Store the compensation (TxAgcStep * (idx-1)) */ + u8 TssiRefA; /* Store Tssi reference value as 25 temperature. */ + u8 TssiPlusBoundaryA[5]; /* Tssi boundary for increase Tx power to compensate. */ + u8 TssiMinusBoundaryA[5]; /* Tssi boundary for decrease Tx power to compensate. */ + u8 TxAgcStepA; /* Store Tx TSSI delta increment / decrement value */ + char TxAgcCompensateA; /* Store the compensation (TxAgcStep * (idx-1)) */ BOOLEAN bAutoTxAgcG; /* Enable driver auto Tx Agc control */ - UCHAR TssiRefG; /* Store Tssi reference value as 25 temperature. */ - UCHAR TssiPlusBoundaryG[5]; /* Tssi boundary for increase Tx power to compensate. */ - UCHAR TssiMinusBoundaryG[5]; /* Tssi boundary for decrease Tx power to compensate. */ - UCHAR TxAgcStepG; /* Store Tx TSSI delta increment / decrement value */ - CHAR TxAgcCompensateG; /* Store the compensation (TxAgcStep * (idx-1)) */ - - CHAR BGRssiOffset0; /* Store B/G RSSI#0 Offset value on EEPROM 0x46h */ - CHAR BGRssiOffset1; /* Store B/G RSSI#1 Offset value */ - CHAR BGRssiOffset2; /* Store B/G RSSI#2 Offset value */ - - CHAR ARssiOffset0; /* Store A RSSI#0 Offset value on EEPROM 0x4Ah */ - CHAR ARssiOffset1; /* Store A RSSI#1 Offset value */ - CHAR ARssiOffset2; /* Store A RSSI#2 Offset value */ - - CHAR BLNAGain; /* Store B/G external LNA#0 value on EEPROM 0x44h */ - CHAR ALNAGain0; /* Store A external LNA#0 value for ch36~64 */ - CHAR ALNAGain1; /* Store A external LNA#1 value for ch100~128 */ - CHAR ALNAGain2; /* Store A external LNA#2 value for ch132~165 */ + u8 TssiRefG; /* Store Tssi reference value as 25 temperature. */ + u8 TssiPlusBoundaryG[5]; /* Tssi boundary for increase Tx power to compensate. */ + u8 TssiMinusBoundaryG[5]; /* Tssi boundary for decrease Tx power to compensate. */ + u8 TxAgcStepG; /* Store Tx TSSI delta increment / decrement value */ + char TxAgcCompensateG; /* Store the compensation (TxAgcStep * (idx-1)) */ + + char BGRssiOffset0; /* Store B/G RSSI#0 Offset value on EEPROM 0x46h */ + char BGRssiOffset1; /* Store B/G RSSI#1 Offset value */ + char BGRssiOffset2; /* Store B/G RSSI#2 Offset value */ + + char ARssiOffset0; /* Store A RSSI#0 Offset value on EEPROM 0x4Ah */ + char ARssiOffset1; /* Store A RSSI#1 Offset value */ + char ARssiOffset2; /* Store A RSSI#2 Offset value */ + + char BLNAGain; /* Store B/G external LNA#0 value on EEPROM 0x44h */ + char ALNAGain0; /* Store A external LNA#0 value for ch36~64 */ + char ALNAGain1; /* Store A external LNA#1 value for ch100~128 */ + char ALNAGain2; /* Store A external LNA#2 value for ch132~165 */ #ifdef RT30xx /* for 3572 */ - UCHAR Bbp25; - UCHAR Bbp26; + u8 Bbp25; + u8 Bbp26; - UCHAR TxMixerGain24G; /* Tx mixer gain value from EEPROM to improve Tx EVM / Tx DAC, 2.4G */ - UCHAR TxMixerGain5G; + u8 TxMixerGain24G; /* Tx mixer gain value from EEPROM to improve Tx EVM / Tx DAC, 2.4G */ + u8 TxMixerGain5G; #endif /* RT30xx // */ /* ---------------------------- */ /* LED control */ /* ---------------------------- */ MCU_LEDCS_STRUC LedCntl; - USHORT Led1; /* read from EEPROM 0x3c */ - USHORT Led2; /* EEPROM 0x3e */ - USHORT Led3; /* EEPROM 0x40 */ - UCHAR LedIndicatorStrength; - UCHAR RssiSingalstrengthOffet; + u16 Led1; /* read from EEPROM 0x3c */ + u16 Led2; /* EEPROM 0x3e */ + u16 Led3; /* EEPROM 0x40 */ + u8 LedIndicatorStrength; + u8 RssiSingalstrengthOffet; BOOLEAN bLedOnScanning; - UCHAR LedStatus; + u8 LedStatus; /*****************************************************************************************/ /* 802.11 related parameters */ /*****************************************************************************************/ /* outgoing BEACON frame buffer and corresponding TXD */ TXWI_STRUC BeaconTxWI; - PUCHAR BeaconBuf; - USHORT BeaconOffset[HW_BEACON_MAX_COUNT]; + u8 *BeaconBuf; + u16 BeaconOffset[HW_BEACON_MAX_COUNT]; /* pre-build PS-POLL and NULL frame upon link up. for efficiency purpose. */ PSPOLL_FRAME PsPollFrame; @@ -1985,21 +1985,21 @@ struct _RTMP_ADAPTER { /* ----------------------------------------------- */ STA_ADMIN_CONFIG StaCfg; /* user desired settings */ STA_ACTIVE_CONFIG StaActive; /* valid only when ADHOC_ON(pAd) || INFRA_ON(pAd) */ - CHAR nickname[IW_ESSID_MAX_SIZE + 1]; /* nickname, only used in the iwconfig i/f */ - NDIS_MEDIA_STATE PreMediaState; + char nickname[IW_ESSID_MAX_SIZE + 1]; /* nickname, only used in the iwconfig i/f */ + int PreMediaState; /*=======Common=========== */ /* OP mode: either AP or STA */ - UCHAR OpMode; /* OPMODE_STA, OPMODE_AP */ + u8 OpMode; /* OPMODE_STA, OPMODE_AP */ - NDIS_MEDIA_STATE IndicateMediaState; /* Base on Indication state, default is NdisMediaStateDisConnected */ + int IndicateMediaState; /* Base on Indication state, default is NdisMediaStateDisConnected */ /* MAT related parameters */ /* configuration: read from Registry & E2PROM */ BOOLEAN bLocalAdminMAC; /* Use user changed MAC */ - UCHAR PermanentAddress[MAC_ADDR_LEN]; /* Factory default MAC address */ - UCHAR CurrentAddress[MAC_ADDR_LEN]; /* User changed MAC address */ + u8 PermanentAddress[MAC_ADDR_LEN]; /* Factory default MAC address */ + u8 CurrentAddress[MAC_ADDR_LEN]; /* User changed MAC address */ /* ------------------------------------------------------ */ /* common configuration to both OPMODE_STA and OPMODE_AP */ @@ -2034,27 +2034,27 @@ struct _RTMP_ADAPTER { PRIVATE_STRUC PrivateInfo; /* Private information & counters */ /* flags, see fRTMP_ADAPTER_xxx flags */ - ULONG Flags; /* Represent current device status */ - ULONG PSFlags; /* Power Save operation flag. */ + unsigned long Flags; /* Represent current device status */ + unsigned long PSFlags; /* Power Save operation flag. */ /* current TX sequence # */ - USHORT Sequence; + u16 Sequence; /* Control disconnect / connect event generation */ /*+++Didn't used anymore */ - ULONG LinkDownTime; + unsigned long LinkDownTime; /*--- */ - ULONG LastRxRate; - ULONG LastTxRate; + unsigned long LastRxRate; + unsigned long LastTxRate; /*+++Used only for Station */ BOOLEAN bConfigChanged; /* Config Change flag for the same SSID setting */ /*--- */ - ULONG ExtraInfo; /* Extra information for displaying status */ - ULONG SystemErrorBitmap; /* b0: E2PROM version error */ + unsigned long ExtraInfo; /* Extra information for displaying status */ + unsigned long SystemErrorBitmap; /* b0: E2PROM version error */ /*+++Didn't used anymore */ - ULONG MacIcVersion; /* MAC/BBP serial interface issue solved after ver.D */ + unsigned long MacIcVersion; /* MAC/BBP serial interface issue solved after ver.D */ /*--- */ /* --------------------------- */ @@ -2068,33 +2068,33 @@ struct _RTMP_ADAPTER { /* Statistic related parameters */ /*****************************************************************************************/ #ifdef RTMP_MAC_USB - ULONG BulkOutDataOneSecCount; - ULONG BulkInDataOneSecCount; - ULONG BulkLastOneSecCount; /* BulkOutDataOneSecCount + BulkInDataOneSecCount */ - ULONG watchDogRxCnt; - ULONG watchDogRxOverFlowCnt; - ULONG watchDogTxPendingCnt[NUM_OF_TX_RING]; - INT TransferedLength[NUM_OF_TX_RING]; + unsigned long BulkOutDataOneSecCount; + unsigned long BulkInDataOneSecCount; + unsigned long BulkLastOneSecCount; /* BulkOutDataOneSecCount + BulkInDataOneSecCount */ + unsigned long watchDogRxCnt; + unsigned long watchDogRxOverFlowCnt; + unsigned long watchDogTxPendingCnt[NUM_OF_TX_RING]; + int TransferedLength[NUM_OF_TX_RING]; #endif /* RTMP_MAC_USB // */ BOOLEAN bUpdateBcnCntDone; - ULONG watchDogMacDeadlock; /* prevent MAC/BBP into deadlock condition */ + unsigned long watchDogMacDeadlock; /* prevent MAC/BBP into deadlock condition */ /* ---------------------------- */ /* DEBUG paramerts */ /* ---------------------------- */ - /*ULONG DebugSetting[4]; */ + /*unsigned long DebugSetting[4]; */ BOOLEAN bBanAllBaSetup; BOOLEAN bPromiscuous; /* ---------------------------- */ /* rt2860c emulation-use Parameters */ /* ---------------------------- */ - /*ULONG rtsaccu[30]; */ - /*ULONG ctsaccu[30]; */ - /*ULONG cfendaccu[30]; */ - /*ULONG bacontent[16]; */ - /*ULONG rxint[RX_RING_SIZE+1]; */ - /*UCHAR rcvba[60]; */ + /*unsigned long rtsaccu[30]; */ + /*unsigned long ctsaccu[30]; */ + /*unsigned long cfendaccu[30]; */ + /*unsigned long bacontent[16]; */ + /*unsigned long rxint[RX_RING_SIZE+1]; */ + /*u8 rcvba[60]; */ BOOLEAN bLinkAdapt; BOOLEAN bForcePrintTX; BOOLEAN bForcePrintRX; @@ -2103,20 +2103,20 @@ struct _RTMP_ADAPTER { BOOLEAN bProtectionTest; BOOLEAN bBroadComHT; /*+++Following add from RT2870 USB. */ - ULONG BulkOutReq; - ULONG BulkOutComplete; - ULONG BulkOutCompleteOther; - ULONG BulkOutCompleteCancel; /* seems not use now? */ - ULONG BulkInReq; - ULONG BulkInComplete; - ULONG BulkInCompleteFail; + unsigned long BulkOutReq; + unsigned long BulkOutComplete; + unsigned long BulkOutCompleteOther; + unsigned long BulkOutCompleteCancel; /* seems not use now? */ + unsigned long BulkInReq; + unsigned long BulkInComplete; + unsigned long BulkInCompleteFail; /*--- */ struct wificonf WIFItestbed; struct reordering_mpdu_pool mpdu_blk_pool; - ULONG OneSecondnonBEpackets; /* record non BE packets per second */ + unsigned long OneSecondnonBEpackets; /* record non BE packets per second */ #ifdef LINUX struct iw_statistics iw_stats; @@ -2124,25 +2124,25 @@ struct _RTMP_ADAPTER { struct net_device_stats stats; #endif /* LINUX // */ - ULONG TbttTickCount; + unsigned long TbttTickCount; #ifdef PCI_MSI_SUPPORT BOOLEAN HaveMsi; #endif /* PCI_MSI_SUPPORT // */ - UCHAR is_on; + u8 is_on; #define TIME_BASE (1000000/OS_HZ) #define TIME_ONE_SECOND (1000000/TIME_BASE) - UCHAR flg_be_adjust; - ULONG be_adjust_last_time; + u8 flg_be_adjust; + unsigned long be_adjust_last_time; - UINT8 FlgCtsEnabled; - UINT8 PM_FlgSuspend; + u8 FlgCtsEnabled; + u8 PM_FlgSuspend; #ifdef RT30xx #ifdef RTMP_EFUSE_SUPPORT BOOLEAN bUseEfuse; - UCHAR EEPROMImage[1024]; + u8 EEPROMImage[1024]; #endif /* RTMP_EFUSE_SUPPORT // */ #endif /* RT30xx // */ }; @@ -2171,10 +2171,10 @@ typedef struct _RX_BLK_ { PRXWI_STRUC pRxWI; PHEADER_802_11 pHeader; PNDIS_PACKET pRxPacket; - UCHAR *pData; - USHORT DataSize; - USHORT Flags; - UCHAR UserPriority; /* for calculate TKIP MIC using */ + u8 *pData; + u16 DataSize; + u16 Flags; + u8 UserPriority; /* for calculate TKIP MIC using */ } RX_BLK; #define RX_BLK_SET_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags |= _flag) @@ -2212,11 +2212,11 @@ typedef struct _RX_BLK_ { /* Currently the sizeof(TX_BLK) is 148 bytes. */ typedef struct _TX_BLK_ { - UCHAR QueIdx; - UCHAR TxFrameType; /* Indicate the Transmission type of the all frames in one batch */ - UCHAR TotalFrameNum; /* Total frame number want to send-out in one batch */ - USHORT TotalFragNum; /* Total frame fragments required in one batch */ - USHORT TotalFrameLen; /* Total length of all frames want to send-out in one batch */ + u8 QueIdx; + u8 TxFrameType; /* Indicate the Transmission type of the all frames in one batch */ + u8 TotalFrameNum; /* Total frame number want to send-out in one batch */ + u16 TotalFragNum; /* Total frame fragments required in one batch */ + u16 TotalFrameLen; /* Total length of all frames want to send-out in one batch */ QUEUE_HEADER TxPacketList; MAC_TABLE_ENTRY *pMacEntry; /* NULL: packet with 802.11 RA field is multicast/broadcast address */ @@ -2224,29 +2224,29 @@ typedef struct _TX_BLK_ { /* Following structure used for the characteristics of a specific packet. */ PNDIS_PACKET pPacket; - PUCHAR pSrcBufHeader; /* Reference to the head of sk_buff->data */ - PUCHAR pSrcBufData; /* Reference to the sk_buff->data, will changed depends on hanlding progresss */ - UINT SrcBufLen; /* Length of packet payload which not including Layer 2 header */ - PUCHAR pExtraLlcSnapEncap; /* NULL means no extra LLC/SNAP is required */ - UCHAR HeaderBuf[128]; /* TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP */ + u8 *pSrcBufHeader; /* Reference to the head of sk_buff->data */ + u8 *pSrcBufData; /* Reference to the sk_buff->data, will changed depends on hanlding progresss */ + u32 SrcBufLen; /* Length of packet payload which not including Layer 2 header */ + u8 *pExtraLlcSnapEncap; /* NULL means no extra LLC/SNAP is required */ + u8 HeaderBuf[128]; /* TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP */ /*RT2870 2.1.0.0 uses only 80 bytes */ /*RT3070 2.1.1.0 uses only 96 bytes */ /*RT3090 2.1.0.0 uses only 96 bytes */ - UCHAR MpduHeaderLen; /* 802.11 header length NOT including the padding */ - UCHAR HdrPadLen; /* recording Header Padding Length; */ - UCHAR apidx; /* The interface associated to this packet */ - UCHAR Wcid; /* The MAC entry associated to this packet */ - UCHAR UserPriority; /* priority class of packet */ - UCHAR FrameGap; /* what kind of IFS this packet use */ - UCHAR MpduReqNum; /* number of fragments of this frame */ - UCHAR TxRate; /* TODO: Obsoleted? Should change to MCS? */ - UCHAR CipherAlg; /* cipher alogrithm */ + u8 MpduHeaderLen; /* 802.11 header length NOT including the padding */ + u8 HdrPadLen; /* recording Header Padding Length; */ + u8 apidx; /* The interface associated to this packet */ + u8 Wcid; /* The MAC entry associated to this packet */ + u8 UserPriority; /* priority class of packet */ + u8 FrameGap; /* what kind of IFS this packet use */ + u8 MpduReqNum; /* number of fragments of this frame */ + u8 TxRate; /* TODO: Obsoleted? Should change to MCS? */ + u8 CipherAlg; /* cipher alogrithm */ PCIPHER_KEY pKey; - USHORT Flags; /*See following definitions for detail. */ + u16 Flags; /*See following definitions for detail. */ /*YOU SHOULD NOT TOUCH IT! Following parameters are used for hardware-depended layer. */ - ULONG Priv; /* Hardware specific value saved in here. */ + unsigned long Priv; /* Hardware specific value saved in here. */ } TX_BLK, *PTX_BLK; #define fTX_bRtsRequired 0x0001 /* Indicate if need send RTS frame for protection. Not used in RT2860/RT2870. */ @@ -2266,9 +2266,9 @@ typedef struct _TX_BLK_ { /*************************************************************************** * Other static inline function definitions **************************************************************************/ -static inline VOID ConvertMulticastIP2MAC(IN PUCHAR pIpAddr, - IN PUCHAR * ppMacAddr, - IN UINT16 ProtoType) +static inline void ConvertMulticastIP2MAC(u8 *pIpAddr, + u8 ** ppMacAddr, + u16 ProtoType) { if (pIpAddr == NULL) return; @@ -2308,141 +2308,141 @@ char *GetBW(int BW); /* */ /* Private routines in rtmp_init.c */ /* */ -NDIS_STATUS RTMPAllocAdapterBlock(IN PVOID handle, +int RTMPAllocAdapterBlock(void *handle, OUT PRTMP_ADAPTER * ppAdapter); -NDIS_STATUS RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd); +int RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd); -VOID RTMPFreeAdapter(IN PRTMP_ADAPTER pAd); +void RTMPFreeAdapter(IN PRTMP_ADAPTER pAd); -NDIS_STATUS NICReadRegParameters(IN PRTMP_ADAPTER pAd, +int NICReadRegParameters(IN PRTMP_ADAPTER pAd, IN NDIS_HANDLE WrapperConfigurationContext); #ifdef RTMP_RF_RW_SUPPORT -VOID NICInitRFRegisters(IN PRTMP_ADAPTER pAd); +void NICInitRFRegisters(IN PRTMP_ADAPTER pAd); -VOID RtmpChipOpsRFHook(IN RTMP_ADAPTER * pAd); +void RtmpChipOpsRFHook(IN RTMP_ADAPTER * pAd); -NDIS_STATUS RT30xxWriteRFRegister(IN PRTMP_ADAPTER pAd, - IN UCHAR regID, IN UCHAR value); +int RT30xxWriteRFRegister(IN PRTMP_ADAPTER pAd, + u8 regID, u8 value); -NDIS_STATUS RT30xxReadRFRegister(IN PRTMP_ADAPTER pAd, - IN UCHAR regID, IN PUCHAR pValue); +int RT30xxReadRFRegister(IN PRTMP_ADAPTER pAd, + u8 regID, u8 *pValue); #endif /* RTMP_RF_RW_SUPPORT // */ -VOID NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, IN PUCHAR mac_addr); +void NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, u8 *mac_addr); -VOID NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd); +void NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd); -NDIS_STATUS NICInitializeAdapter(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset); +int NICInitializeAdapter(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset); -NDIS_STATUS NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset); +int NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset); -VOID NICIssueReset(IN PRTMP_ADAPTER pAd); +void NICIssueReset(IN PRTMP_ADAPTER pAd); -VOID RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, IN UCHAR RingType); +void RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, u8 RingType); -VOID UserCfgInit(IN PRTMP_ADAPTER pAd); +void UserCfgInit(IN PRTMP_ADAPTER pAd); -VOID NICResetFromError(IN PRTMP_ADAPTER pAd); +void NICResetFromError(IN PRTMP_ADAPTER pAd); -NDIS_STATUS NICLoadFirmware(IN PRTMP_ADAPTER pAd); +int NICLoadFirmware(IN PRTMP_ADAPTER pAd); -VOID NICEraseFirmware(IN PRTMP_ADAPTER pAd); +void NICEraseFirmware(IN PRTMP_ADAPTER pAd); -NDIS_STATUS NICLoadRateSwitchingParams(IN PRTMP_ADAPTER pAd); +int NICLoadRateSwitchingParams(IN PRTMP_ADAPTER pAd); BOOLEAN NICCheckForHang(IN PRTMP_ADAPTER pAd); -VOID NICUpdateFifoStaCounters(IN PRTMP_ADAPTER pAd); +void NICUpdateFifoStaCounters(IN PRTMP_ADAPTER pAd); -VOID NICUpdateRawCounters(IN PRTMP_ADAPTER pAd); +void NICUpdateRawCounters(IN PRTMP_ADAPTER pAd); -VOID RTMPZeroMemory(IN PVOID pSrc, IN ULONG Length); +void RTMPZeroMemory(void *pSrc, unsigned long Length); -ULONG RTMPCompareMemory(IN PVOID pSrc1, IN PVOID pSrc2, IN ULONG Length); +unsigned long RTMPCompareMemory(void *pSrc1, void *pSrc2, unsigned long Length); -VOID RTMPMoveMemory(OUT PVOID pDest, IN PVOID pSrc, IN ULONG Length); +void RTMPMoveMemory(void *pDest, void *pSrc, unsigned long Length); -VOID AtoH(PSTRING src, PUCHAR dest, int destlen); +void AtoH(char *src, u8 *dest, int destlen); -UCHAR BtoH(char ch); +u8 BtoH(char ch); -VOID RTMPPatchMacBbpBug(IN PRTMP_ADAPTER pAd); +void RTMPPatchMacBbpBug(IN PRTMP_ADAPTER pAd); -VOID RTMPInitTimer(IN PRTMP_ADAPTER pAd, +void RTMPInitTimer(IN PRTMP_ADAPTER pAd, IN PRALINK_TIMER_STRUCT pTimer, - IN PVOID pTimerFunc, IN PVOID pData, IN BOOLEAN Repeat); + void *pTimerFunc, void *pData, IN BOOLEAN Repeat); -VOID RTMPSetTimer(IN PRALINK_TIMER_STRUCT pTimer, IN ULONG Value); +void RTMPSetTimer(IN PRALINK_TIMER_STRUCT pTimer, unsigned long Value); -VOID RTMPModTimer(IN PRALINK_TIMER_STRUCT pTimer, IN ULONG Value); +void RTMPModTimer(IN PRALINK_TIMER_STRUCT pTimer, unsigned long Value); -VOID RTMPCancelTimer(IN PRALINK_TIMER_STRUCT pTimer, OUT BOOLEAN * pCancelled); +void RTMPCancelTimer(IN PRALINK_TIMER_STRUCT pTimer, OUT BOOLEAN * pCancelled); -VOID RTMPSetLED(IN PRTMP_ADAPTER pAd, IN UCHAR Status); +void RTMPSetLED(IN PRTMP_ADAPTER pAd, u8 Status); -VOID RTMPSetSignalLED(IN PRTMP_ADAPTER pAd, IN NDIS_802_11_RSSI Dbm); +void RTMPSetSignalLED(IN PRTMP_ADAPTER pAd, IN NDIS_802_11_RSSI Dbm); -VOID RTMPEnableRxTx(IN PRTMP_ADAPTER pAd); +void RTMPEnableRxTx(IN PRTMP_ADAPTER pAd); /* */ /* prototype in action.c */ /* */ -VOID ActionStateMachineInit(IN PRTMP_ADAPTER pAd, +void ActionStateMachineInit(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * S, OUT STATE_MACHINE_FUNC Trans[]); -VOID MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID MlmeDLSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeDLSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID MlmeInvalidAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeInvalidAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID MlmeQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerAddBARspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerAddBARspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerDelBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerDelBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID SendPSMPAction(IN PRTMP_ADAPTER pAd, IN UCHAR Wcid, IN UCHAR Psmp); +void SendPSMPAction(IN PRTMP_ADAPTER pAd, u8 Wcid, u8 Psmp); -VOID PeerRMAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerRMAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerPublicAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerPublicAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID RECBATimerTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +void RECBATimerTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3); -VOID ORIBATimerTimeout(IN PRTMP_ADAPTER pAd); +void ORIBATimerTimeout(IN PRTMP_ADAPTER pAd); -VOID SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry); +void SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry); -VOID ActHeaderInit(IN PRTMP_ADAPTER pAd, +void ActHeaderInit(IN PRTMP_ADAPTER pAd, IN OUT PHEADER_802_11 pHdr80211, - IN PUCHAR Addr1, IN PUCHAR Addr2, IN PUCHAR Addr3); + u8 *Addr1, u8 *Addr2, u8 *Addr3); -VOID BarHeaderInit(IN PRTMP_ADAPTER pAd, - IN OUT PFRAME_BAR pCntlBar, IN PUCHAR pDA, IN PUCHAR pSA); +void BarHeaderInit(IN PRTMP_ADAPTER pAd, + IN OUT PFRAME_BAR pCntlBar, u8 *pDA, u8 *pSA); -VOID InsertActField(IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, IN UINT8 Category, IN UINT8 ActCode); +void InsertActField(IN PRTMP_ADAPTER pAd, + u8 *pFrameBuf, + unsigned long *pFrameLen, u8 Category, u8 ActCode); BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN ULONG MsgLen, IN PFRAME_BA_REQ pMsg); + unsigned long Wcid, + unsigned long MsgLen, IN PFRAME_BA_REQ pMsg); /* */ /* Private routines in rtmp_data.c */ @@ -2450,139 +2450,139 @@ BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd, BOOLEAN RTMPHandleRxDoneInterrupt(IN PRTMP_ADAPTER pAd); BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd, - IN INT_SOURCE_CSR_STRUC TxRingBitmap); + INT_SOURCE_CSR_STRUC TxRingBitmap); -VOID RTMPHandleMgmtRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd); +void RTMPHandleMgmtRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd); -VOID RTMPHandleTBTTInterrupt(IN PRTMP_ADAPTER pAd); +void RTMPHandleTBTTInterrupt(IN PRTMP_ADAPTER pAd); -VOID RTMPHandlePreTBTTInterrupt(IN PRTMP_ADAPTER pAd); +void RTMPHandlePreTBTTInterrupt(IN PRTMP_ADAPTER pAd); void RTMPHandleTwakeupInterrupt(IN PRTMP_ADAPTER pAd); -VOID RTMPHandleRxCoherentInterrupt(IN PRTMP_ADAPTER pAd); +void RTMPHandleRxCoherentInterrupt(IN PRTMP_ADAPTER pAd); BOOLEAN TxFrameIsAggregatible(IN PRTMP_ADAPTER pAd, - IN PUCHAR pPrevAddr1, IN PUCHAR p8023hdr); + u8 *pPrevAddr1, u8 *p8023hdr); BOOLEAN PeerIsAggreOn(IN PRTMP_ADAPTER pAd, - IN ULONG TxRate, IN PMAC_TABLE_ENTRY pMacEntry); + unsigned long TxRate, IN PMAC_TABLE_ENTRY pMacEntry); -NDIS_STATUS Sniff2BytesFromNdisBuffer(IN PNDIS_BUFFER pFirstBuffer, - IN UCHAR DesiredOffset, - OUT PUCHAR pByte0, OUT PUCHAR pByte1); +int Sniff2BytesFromNdisBuffer(IN PNDIS_BUFFER pFirstBuffer, + u8 DesiredOffset, + u8 *pByte0, u8 *pByte1); -NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); +int STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); -VOID STASendPackets(IN NDIS_HANDLE MiniportAdapterContext, - IN PPNDIS_PACKET ppPacketArray, IN UINT NumberOfPackets); +void STASendPackets(IN NDIS_HANDLE MiniportAdapterContext, + IN PPNDIS_PACKET ppPacketArray, u32 NumberOfPackets); -VOID RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, +void RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, - IN UCHAR QueIdx, IN UCHAR Max_Tx_Packets); + u8 QueIdx, u8 Max_Tx_Packets); -NDIS_STATUS RTMPHardTransmit(IN PRTMP_ADAPTER pAd, +int RTMPHardTransmit(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket, - IN UCHAR QueIdx, OUT PULONG pFreeTXDLeft); + u8 QueIdx, unsigned long *pFreeTXDLeft); -NDIS_STATUS STAHardTransmit(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, IN UCHAR QueIdx); +int STAHardTransmit(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, u8 QueIdx); -VOID STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, +void STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, - IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); + IN RX_BLK * pRxBlk, u8 FromWhichBSSID); -NDIS_STATUS RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, - IN UCHAR RingType, - IN UCHAR NumberRequired, IN PUCHAR FreeNumberIs); +int RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, + u8 RingType, + u8 NumberRequired, u8 *FreeNumberIs); -NDIS_STATUS MlmeHardTransmit(IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, IN PNDIS_PACKET pPacket); +int MlmeHardTransmit(IN PRTMP_ADAPTER pAd, + u8 QueIdx, IN PNDIS_PACKET pPacket); -NDIS_STATUS MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, IN PNDIS_PACKET pPacket); +int MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, + u8 QueIdx, IN PNDIS_PACKET pPacket); #ifdef RTMP_MAC_PCI -NDIS_STATUS MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, IN PNDIS_PACKET pPacket); +int MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, + u8 QueIdx, IN PNDIS_PACKET pPacket); -NDIS_STATUS MlmeDataHardTransmit(IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, IN PNDIS_PACKET pPacket); +int MlmeDataHardTransmit(IN PRTMP_ADAPTER pAd, + u8 QueIdx, IN PNDIS_PACKET pPacket); -VOID RTMPWriteTxDescriptor(IN PRTMP_ADAPTER pAd, - IN PTXD_STRUC pTxD, IN BOOLEAN bWIV, IN UCHAR QSEL); +void RTMPWriteTxDescriptor(IN PRTMP_ADAPTER pAd, + IN PTXD_STRUC pTxD, IN BOOLEAN bWIV, u8 QSEL); #endif /* RTMP_MAC_PCI // */ -USHORT RTMPCalcDuration(IN PRTMP_ADAPTER pAd, IN UCHAR Rate, IN ULONG Size); +u16 RTMPCalcDuration(IN PRTMP_ADAPTER pAd, u8 Rate, unsigned long Size); -VOID RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pTxWI, IN BOOLEAN FRAG, IN BOOLEAN CFACK, IN BOOLEAN InsTimestamp, IN BOOLEAN AMPDU, IN BOOLEAN Ack, IN BOOLEAN NSeq, /* HW new a sequence. */ - IN UCHAR BASize, - IN UCHAR WCID, - IN ULONG Length, - IN UCHAR PID, - IN UCHAR TID, - IN UCHAR TxRate, - IN UCHAR Txopmode, +void RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pTxWI, IN BOOLEAN FRAG, IN BOOLEAN CFACK, IN BOOLEAN InsTimestamp, IN BOOLEAN AMPDU, IN BOOLEAN Ack, IN BOOLEAN NSeq, /* HW new a sequence. */ + u8 BASize, + u8 WCID, + unsigned long Length, + u8 PID, + u8 TID, + u8 TxRate, + u8 Txopmode, IN BOOLEAN CfAck, IN HTTRANSMIT_SETTING * pTransmit); -VOID RTMPWriteTxWI_Data(IN PRTMP_ADAPTER pAd, +void RTMPWriteTxWI_Data(IN PRTMP_ADAPTER pAd, IN OUT PTXWI_STRUC pTxWI, IN TX_BLK * pTxBlk); -VOID RTMPWriteTxWI_Cache(IN PRTMP_ADAPTER pAd, +void RTMPWriteTxWI_Cache(IN PRTMP_ADAPTER pAd, IN OUT PTXWI_STRUC pTxWI, IN TX_BLK * pTxBlk); -VOID RTMPSuspendMsduTransmission(IN PRTMP_ADAPTER pAd); +void RTMPSuspendMsduTransmission(IN PRTMP_ADAPTER pAd); -VOID RTMPResumeMsduTransmission(IN PRTMP_ADAPTER pAd); +void RTMPResumeMsduTransmission(IN PRTMP_ADAPTER pAd); -NDIS_STATUS MiniportMMRequest(IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, IN PUCHAR pData, IN UINT Length); +int MiniportMMRequest(IN PRTMP_ADAPTER pAd, + u8 QueIdx, u8 *pData, u32 Length); /*+++mark by shiang, now this function merge to MiniportMMRequest() */ /*---mark by shiang, now this function merge to MiniportMMRequest() */ -VOID RTMPSendNullFrame(IN PRTMP_ADAPTER pAd, - IN UCHAR TxRate, IN BOOLEAN bQosNull); +void RTMPSendNullFrame(IN PRTMP_ADAPTER pAd, + u8 TxRate, IN BOOLEAN bQosNull); -VOID RTMPSendDisassociationFrame(IN PRTMP_ADAPTER pAd); +void RTMPSendDisassociationFrame(IN PRTMP_ADAPTER pAd); -VOID RTMPSendRTSFrame(IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, +void RTMPSendRTSFrame(IN PRTMP_ADAPTER pAd, + u8 *pDA, IN unsigned int NextMpduSize, - IN UCHAR TxRate, - IN UCHAR RTSRate, - IN USHORT AckDuration, - IN UCHAR QueIdx, IN UCHAR FrameGap); + u8 TxRate, + u8 RTSRate, + u16 AckDuration, + u8 QueIdx, u8 FrameGap); -PQUEUE_HEADER RTMPCheckTxSwQueue(IN PRTMP_ADAPTER pAd, OUT UCHAR * QueIdx); +PQUEUE_HEADER RTMPCheckTxSwQueue(IN PRTMP_ADAPTER pAd, u8 * QueIdx); -VOID RTMPReportMicError(IN PRTMP_ADAPTER pAd, IN PCIPHER_KEY pWpaKey); +void RTMPReportMicError(IN PRTMP_ADAPTER pAd, IN PCIPHER_KEY pWpaKey); -VOID WpaMicFailureReportFrame(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void WpaMicFailureReportFrame(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID WpaDisassocApAndBlockAssoc(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); +void WpaDisassocApAndBlockAssoc(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, + void *SystemSpecific3); -VOID WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd); +void WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd); -VOID WpaStaGroupKeySetting(IN PRTMP_ADAPTER pAd); +void WpaStaGroupKeySetting(IN PRTMP_ADAPTER pAd); -NDIS_STATUS RTMPCloneNdisPacket(IN PRTMP_ADAPTER pAd, +int RTMPCloneNdisPacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN pInsAMSDUHdr, IN PNDIS_PACKET pInPacket, OUT PNDIS_PACKET * ppOutPacket); -NDIS_STATUS RTMPAllocateNdisPacket(IN PRTMP_ADAPTER pAd, +int RTMPAllocateNdisPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET * pPacket, - IN PUCHAR pHeader, - IN UINT HeaderLen, - IN PUCHAR pData, IN UINT DataLen); + u8 *pHeader, + u32 HeaderLen, + u8 *pData, u32 DataLen); -VOID RTMPFreeNdisPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); +void RTMPFreeNdisPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); -BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, IN UCHAR QueIdx); +BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, u8 QueIdx); BOOLEAN RTMPCheckDHCPFrame(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); @@ -2591,33 +2591,33 @@ BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); /* */ /* Private routines in rtmp_wep.c */ /* */ -VOID RTMPInitWepEngine(IN PRTMP_ADAPTER pAd, - IN PUCHAR pKey, - IN UCHAR KeyId, IN UCHAR KeyLen, IN PUCHAR pDest); +void RTMPInitWepEngine(IN PRTMP_ADAPTER pAd, + u8 *pKey, + u8 KeyId, u8 KeyLen, u8 *pDest); -VOID RTMPEncryptData(IN PRTMP_ADAPTER pAd, - IN PUCHAR pSrc, IN PUCHAR pDest, IN UINT Len); +void RTMPEncryptData(IN PRTMP_ADAPTER pAd, + u8 *pSrc, u8 *pDest, u32 Len); BOOLEAN RTMPSoftDecryptWEP(IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, IN PCIPHER_KEY pGroupKey); + u8 *pData, + unsigned long DataByteCnt, IN PCIPHER_KEY pGroupKey); -VOID RTMPSetICV(IN PRTMP_ADAPTER pAd, IN PUCHAR pDest); +void RTMPSetICV(IN PRTMP_ADAPTER pAd, u8 *pDest); -VOID ARCFOUR_INIT(IN PARCFOURCONTEXT Ctx, IN PUCHAR pKey, IN UINT KeyLen); +void ARCFOUR_INIT(IN PARCFOURCONTEXT Ctx, u8 *pKey, u32 KeyLen); -UCHAR ARCFOUR_BYTE(IN PARCFOURCONTEXT Ctx); +u8 ARCFOUR_BYTE(IN PARCFOURCONTEXT Ctx); -VOID ARCFOUR_DECRYPT(IN PARCFOURCONTEXT Ctx, - IN PUCHAR pDest, IN PUCHAR pSrc, IN UINT Len); +void ARCFOUR_DECRYPT(IN PARCFOURCONTEXT Ctx, + u8 *pDest, u8 *pSrc, u32 Len); -VOID ARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, - IN PUCHAR pDest, IN PUCHAR pSrc, IN UINT Len); +void ARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, + u8 *pDest, u8 *pSrc, u32 Len); -VOID WPAARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, - IN PUCHAR pDest, IN PUCHAR pSrc, IN UINT Len); +void WPAARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, + u8 *pDest, u8 *pSrc, u32 Len); -UINT RTMP_CALC_FCS32(IN UINT Fcs, IN PUCHAR Cp, IN INT Len); +u32 RTMP_CALC_FCS32(u32 Fcs, u8 *Cp, int Len); /* */ /* MLME routines */ @@ -2625,190 +2625,190 @@ UINT RTMP_CALC_FCS32(IN UINT Fcs, IN PUCHAR Cp, IN INT Len); /* Asic/RF/BBP related functions */ -VOID AsicAdjustTxPower(IN PRTMP_ADAPTER pAd); +void AsicAdjustTxPower(IN PRTMP_ADAPTER pAd); -VOID AsicUpdateProtect(IN PRTMP_ADAPTER pAd, - IN USHORT OperaionMode, - IN UCHAR SetMask, +void AsicUpdateProtect(IN PRTMP_ADAPTER pAd, + u16 OperaionMode, + u8 SetMask, IN BOOLEAN bDisableBGProtect, IN BOOLEAN bNonGFExist); -VOID AsicSwitchChannel(IN PRTMP_ADAPTER pAd, - IN UCHAR Channel, IN BOOLEAN bScan); +void AsicSwitchChannel(IN PRTMP_ADAPTER pAd, + u8 Channel, IN BOOLEAN bScan); -VOID AsicLockChannel(IN PRTMP_ADAPTER pAd, IN UCHAR Channel); +void AsicLockChannel(IN PRTMP_ADAPTER pAd, u8 Channel); -VOID AsicRfTuningExec(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +void AsicRfTuningExec(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3); -VOID AsicResetBBPAgent(IN PRTMP_ADAPTER pAd); +void AsicResetBBPAgent(IN PRTMP_ADAPTER pAd); -VOID AsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp); +void AsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, + u16 TbttNumToNextWakeUp); -VOID AsicForceSleep(IN PRTMP_ADAPTER pAd); +void AsicForceSleep(IN PRTMP_ADAPTER pAd); -VOID AsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx); +void AsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx); -VOID AsicSetBssid(IN PRTMP_ADAPTER pAd, IN PUCHAR pBssid); +void AsicSetBssid(IN PRTMP_ADAPTER pAd, u8 *pBssid); -VOID AsicSetMcastWC(IN PRTMP_ADAPTER pAd); +void AsicSetMcastWC(IN PRTMP_ADAPTER pAd); -VOID AsicDelWcidTab(IN PRTMP_ADAPTER pAd, IN UCHAR Wcid); +void AsicDelWcidTab(IN PRTMP_ADAPTER pAd, u8 Wcid); -VOID AsicEnableRDG(IN PRTMP_ADAPTER pAd); +void AsicEnableRDG(IN PRTMP_ADAPTER pAd); -VOID AsicDisableRDG(IN PRTMP_ADAPTER pAd); +void AsicDisableRDG(IN PRTMP_ADAPTER pAd); -VOID AsicDisableSync(IN PRTMP_ADAPTER pAd); +void AsicDisableSync(IN PRTMP_ADAPTER pAd); -VOID AsicEnableBssSync(IN PRTMP_ADAPTER pAd); +void AsicEnableBssSync(IN PRTMP_ADAPTER pAd); -VOID AsicEnableIbssSync(IN PRTMP_ADAPTER pAd); +void AsicEnableIbssSync(IN PRTMP_ADAPTER pAd); -VOID AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm); +void AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm); -VOID AsicSetSlotTime(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUseShortSlotTime); +void AsicSetSlotTime(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUseShortSlotTime); -VOID AsicAddSharedKeyEntry(IN PRTMP_ADAPTER pAd, - IN UCHAR BssIndex, - IN UCHAR KeyIdx, - IN UCHAR CipherAlg, - IN PUCHAR pKey, IN PUCHAR pTxMic, IN PUCHAR pRxMic); +void AsicAddSharedKeyEntry(IN PRTMP_ADAPTER pAd, + u8 BssIndex, + u8 KeyIdx, + u8 CipherAlg, + u8 *pKey, u8 *pTxMic, u8 *pRxMic); -VOID AsicRemoveSharedKeyEntry(IN PRTMP_ADAPTER pAd, - IN UCHAR BssIndex, IN UCHAR KeyIdx); +void AsicRemoveSharedKeyEntry(IN PRTMP_ADAPTER pAd, + u8 BssIndex, u8 KeyIdx); -VOID AsicUpdateWCIDAttribute(IN PRTMP_ADAPTER pAd, - IN USHORT WCID, - IN UCHAR BssIndex, - IN UCHAR CipherAlg, +void AsicUpdateWCIDAttribute(IN PRTMP_ADAPTER pAd, + u16 WCID, + u8 BssIndex, + u8 CipherAlg, IN BOOLEAN bUsePairewiseKeyTable); -VOID AsicUpdateWCIDIVEIV(IN PRTMP_ADAPTER pAd, - IN USHORT WCID, IN ULONG uIV, IN ULONG uEIV); +void AsicUpdateWCIDIVEIV(IN PRTMP_ADAPTER pAd, + u16 WCID, unsigned long uIV, unsigned long uEIV); -VOID AsicUpdateRxWCIDTable(IN PRTMP_ADAPTER pAd, - IN USHORT WCID, IN PUCHAR pAddr); +void AsicUpdateRxWCIDTable(IN PRTMP_ADAPTER pAd, + u16 WCID, u8 *pAddr); -VOID AsicAddKeyEntry(IN PRTMP_ADAPTER pAd, - IN USHORT WCID, - IN UCHAR BssIndex, - IN UCHAR KeyIdx, +void AsicAddKeyEntry(IN PRTMP_ADAPTER pAd, + u16 WCID, + u8 BssIndex, + u8 KeyIdx, IN PCIPHER_KEY pCipherKey, IN BOOLEAN bUsePairewiseKeyTable, IN BOOLEAN bTxKey); -VOID AsicAddPairwiseKeyEntry(IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UCHAR WCID, IN CIPHER_KEY * pCipherKey); +void AsicAddPairwiseKeyEntry(IN PRTMP_ADAPTER pAd, + u8 *pAddr, + u8 WCID, IN CIPHER_KEY * pCipherKey); -VOID AsicRemovePairwiseKeyEntry(IN PRTMP_ADAPTER pAd, - IN UCHAR BssIdx, IN UCHAR Wcid); +void AsicRemovePairwiseKeyEntry(IN PRTMP_ADAPTER pAd, + u8 BssIdx, u8 Wcid); BOOLEAN AsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, - IN UCHAR Command, - IN UCHAR Token, IN UCHAR Arg0, IN UCHAR Arg1); + u8 Command, + u8 Token, u8 Arg0, u8 Arg1); #ifdef RTMP_MAC_PCI -BOOLEAN AsicCheckCommanOk(IN PRTMP_ADAPTER pAd, IN UCHAR Command); +BOOLEAN AsicCheckCommanOk(IN PRTMP_ADAPTER pAd, u8 Command); #endif /* RTMP_MAC_PCI // */ -VOID MacAddrRandomBssid(IN PRTMP_ADAPTER pAd, OUT PUCHAR pAddr); +void MacAddrRandomBssid(IN PRTMP_ADAPTER pAd, u8 *pAddr); -VOID MgtMacHeaderInit(IN PRTMP_ADAPTER pAd, +void MgtMacHeaderInit(IN PRTMP_ADAPTER pAd, IN OUT PHEADER_802_11 pHdr80211, - IN UCHAR SubType, - IN UCHAR ToDs, IN PUCHAR pDA, IN PUCHAR pBssid); + u8 SubType, + u8 ToDs, u8 *pDA, u8 *pBssid); -VOID MlmeRadioOff(IN PRTMP_ADAPTER pAd); +void MlmeRadioOff(IN PRTMP_ADAPTER pAd); -VOID MlmeRadioOn(IN PRTMP_ADAPTER pAd); +void MlmeRadioOn(IN PRTMP_ADAPTER pAd); -VOID BssTableInit(IN BSS_TABLE * Tab); +void BssTableInit(IN BSS_TABLE * Tab); -VOID BATableInit(IN PRTMP_ADAPTER pAd, IN BA_TABLE * Tab); +void BATableInit(IN PRTMP_ADAPTER pAd, IN BA_TABLE * Tab); -ULONG BssTableSearch(IN BSS_TABLE * Tab, IN PUCHAR pBssid, IN UCHAR Channel); +unsigned long BssTableSearch(IN BSS_TABLE * Tab, u8 *pBssid, u8 Channel); -ULONG BssSsidTableSearch(IN BSS_TABLE * Tab, - IN PUCHAR pBssid, - IN PUCHAR pSsid, IN UCHAR SsidLen, IN UCHAR Channel); +unsigned long BssSsidTableSearch(IN BSS_TABLE * Tab, + u8 *pBssid, + u8 *pSsid, u8 SsidLen, u8 Channel); -ULONG BssTableSearchWithSSID(IN BSS_TABLE * Tab, - IN PUCHAR Bssid, - IN PUCHAR pSsid, - IN UCHAR SsidLen, IN UCHAR Channel); +unsigned long BssTableSearchWithSSID(IN BSS_TABLE * Tab, + u8 *Bssid, + u8 *pSsid, + u8 SsidLen, u8 Channel); -ULONG BssSsidTableSearchBySSID(IN BSS_TABLE * Tab, - IN PUCHAR pSsid, IN UCHAR SsidLen); +unsigned long BssSsidTableSearchBySSID(IN BSS_TABLE * Tab, + u8 *pSsid, u8 SsidLen); -VOID BssTableDeleteEntry(IN OUT PBSS_TABLE pTab, - IN PUCHAR pBssid, IN UCHAR Channel); +void BssTableDeleteEntry(IN OUT PBSS_TABLE pTab, + u8 *pBssid, u8 Channel); -VOID BATableDeleteORIEntry(IN OUT PRTMP_ADAPTER pAd, +void BATableDeleteORIEntry(IN OUT PRTMP_ADAPTER pAd, IN BA_ORI_ENTRY * pBAORIEntry); -VOID BssEntrySet(IN PRTMP_ADAPTER pAd, OUT PBSS_ENTRY pBss, IN PUCHAR pBssid, IN CHAR Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN USHORT BeaconPeriod, IN PCF_PARM CfParm, IN USHORT AtimWin, IN USHORT CapabilityInfo, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ - IN UCHAR HtCapabilityLen, - IN UCHAR AddHtInfoLen, - IN UCHAR NewExtChanOffset, - IN UCHAR Channel, - IN CHAR Rssi, +void BssEntrySet(IN PRTMP_ADAPTER pAd, OUT PBSS_ENTRY pBss, u8 *pBssid, char Ssid[], u8 SsidLen, u8 BssType, u16 BeaconPeriod, IN PCF_PARM CfParm, u16 AtimWin, u16 CapabilityInfo, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ + u8 HtCapabilityLen, + u8 AddHtInfoLen, + u8 NewExtChanOffset, + u8 Channel, + char Rssi, IN LARGE_INTEGER TimeStamp, - IN UCHAR CkipFlag, + u8 CkipFlag, IN PEDCA_PARM pEdcaParm, IN PQOS_CAPABILITY_PARM pQosCapability, IN PQBSS_LOAD_PARM pQbssLoad, - IN USHORT LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE); - -ULONG BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT PBSS_TABLE pTab, IN PUCHAR pBssid, IN CHAR Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN USHORT BeaconPeriod, IN CF_PARM * CfParm, IN USHORT AtimWin, IN USHORT CapabilityInfo, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ - IN UCHAR HtCapabilityLen, - IN UCHAR AddHtInfoLen, - IN UCHAR NewExtChanOffset, - IN UCHAR Channel, - IN CHAR Rssi, + u16 LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE); + +unsigned long BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT PBSS_TABLE pTab, u8 *pBssid, char Ssid[], u8 SsidLen, u8 BssType, u16 BeaconPeriod, IN CF_PARM * CfParm, u16 AtimWin, u16 CapabilityInfo, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ + u8 HtCapabilityLen, + u8 AddHtInfoLen, + u8 NewExtChanOffset, + u8 Channel, + char Rssi, IN LARGE_INTEGER TimeStamp, - IN UCHAR CkipFlag, + u8 CkipFlag, IN PEDCA_PARM pEdcaParm, IN PQOS_CAPABILITY_PARM pQosCapability, IN PQBSS_LOAD_PARM pQbssLoad, - IN USHORT LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE); + u16 LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE); -VOID BATableInsertEntry(IN PRTMP_ADAPTER pAd, - IN USHORT Aid, - IN USHORT TimeOutValue, - IN USHORT StartingSeq, - IN UCHAR TID, - IN UCHAR BAWinSize, - IN UCHAR OriginatorStatus, IN BOOLEAN IsRecipient); +void BATableInsertEntry(IN PRTMP_ADAPTER pAd, + u16 Aid, + u16 TimeOutValue, + u16 StartingSeq, + u8 TID, + u8 BAWinSize, + u8 OriginatorStatus, IN BOOLEAN IsRecipient); -VOID BssTableSsidSort(IN PRTMP_ADAPTER pAd, - OUT BSS_TABLE * OutTab, IN CHAR Ssid[], IN UCHAR SsidLen); +void BssTableSsidSort(IN PRTMP_ADAPTER pAd, + OUT BSS_TABLE * OutTab, char Ssid[], u8 SsidLen); -VOID BssTableSortByRssi(IN OUT BSS_TABLE * OutTab); +void BssTableSortByRssi(IN OUT BSS_TABLE * OutTab); -VOID BssCipherParse(IN OUT PBSS_ENTRY pBss); +void BssCipherParse(IN OUT PBSS_ENTRY pBss); -NDIS_STATUS MlmeQueueInit(IN MLME_QUEUE * Queue); +int MlmeQueueInit(IN MLME_QUEUE * Queue); -VOID MlmeQueueDestroy(IN MLME_QUEUE * Queue); +void MlmeQueueDestroy(IN MLME_QUEUE * Queue); BOOLEAN MlmeEnqueue(IN PRTMP_ADAPTER pAd, - IN ULONG Machine, - IN ULONG MsgType, IN ULONG MsgLen, IN VOID * Msg); + unsigned long Machine, + unsigned long MsgType, unsigned long MsgLen, void * Msg); BOOLEAN MlmeEnqueueForRecv(IN PRTMP_ADAPTER pAd, - IN ULONG Wcid, - IN ULONG TimeStampHigh, - IN ULONG TimeStampLow, - IN UCHAR Rssi0, - IN UCHAR Rssi1, - IN UCHAR Rssi2, - IN ULONG MsgLen, IN PVOID Msg, IN UCHAR Signal); + unsigned long Wcid, + unsigned long TimeStampHigh, + unsigned long TimeStampLow, + u8 Rssi0, + u8 Rssi1, + u8 Rssi2, + unsigned long MsgLen, void *Msg, u8 Signal); BOOLEAN MlmeDequeue(IN MLME_QUEUE * Queue, OUT MLME_QUEUE_ELEM ** Elem); -VOID MlmeRestartStateMachine(IN PRTMP_ADAPTER pAd); +void MlmeRestartStateMachine(IN PRTMP_ADAPTER pAd); BOOLEAN MlmeQueueEmpty(IN MLME_QUEUE * Queue); @@ -2816,121 +2816,121 @@ BOOLEAN MlmeQueueFull(IN MLME_QUEUE * Queue); BOOLEAN MsgTypeSubst(IN PRTMP_ADAPTER pAd, IN PFRAME_802_11 pFrame, - OUT INT * Machine, OUT INT * MsgType); + int * Machine, int * MsgType); -VOID StateMachineInit(IN STATE_MACHINE * Sm, +void StateMachineInit(IN STATE_MACHINE * Sm, IN STATE_MACHINE_FUNC Trans[], - IN ULONG StNr, - IN ULONG MsgNr, + unsigned long StNr, + unsigned long MsgNr, IN STATE_MACHINE_FUNC DefFunc, - IN ULONG InitState, IN ULONG Base); + unsigned long InitState, unsigned long Base); -VOID StateMachineSetAction(IN STATE_MACHINE * S, - IN ULONG St, ULONG Msg, IN STATE_MACHINE_FUNC F); +void StateMachineSetAction(IN STATE_MACHINE * S, + unsigned long St, unsigned long Msg, IN STATE_MACHINE_FUNC F); -VOID StateMachinePerformAction(IN PRTMP_ADAPTER pAd, +void StateMachinePerformAction(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * S, IN MLME_QUEUE_ELEM * Elem); -VOID Drop(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void Drop(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID AssocStateMachineInit(IN PRTMP_ADAPTER pAd, +void AssocStateMachineInit(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * Sm, OUT STATE_MACHINE_FUNC Trans[]); -VOID ReassocTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +void ReassocTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3); -VOID AssocTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +void AssocTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3); -VOID DisassocTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +void DisassocTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3); /*---------------------------------------------- */ -VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID MlmeDisassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeDisassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerAssocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerAssocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerReassocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerReassocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerDisassocAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerDisassocAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID DisassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void DisassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID AssocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void AssocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID ReassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void ReassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID Cls3errAction(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr); +void Cls3errAction(IN PRTMP_ADAPTER pAd, u8 *pAddr); -VOID InvalidStateWhenAssoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void InvalidStateWhenAssoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID InvalidStateWhenReassoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void InvalidStateWhenReassoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID InvalidStateWhenDisassociate(IN PRTMP_ADAPTER pAd, +void InvalidStateWhenDisassociate(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); #ifdef RTMP_MAC_USB -VOID MlmeCntlConfirm(IN PRTMP_ADAPTER pAd, IN ULONG MsgType, IN USHORT Msg); +void MlmeCntlConfirm(IN PRTMP_ADAPTER pAd, unsigned long MsgType, u16 Msg); #endif /* RTMP_MAC_USB // */ -VOID ComposePsPoll(IN PRTMP_ADAPTER pAd); +void ComposePsPoll(IN PRTMP_ADAPTER pAd); -VOID ComposeNullFrame(IN PRTMP_ADAPTER pAd); +void ComposeNullFrame(IN PRTMP_ADAPTER pAd); -VOID AssocPostProc(IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr2, - IN USHORT CapabilityInfo, - IN USHORT Aid, - IN UCHAR SupRate[], - IN UCHAR SupRateLen, - IN UCHAR ExtRate[], - IN UCHAR ExtRateLen, +void AssocPostProc(IN PRTMP_ADAPTER pAd, + u8 *pAddr2, + u16 CapabilityInfo, + u16 Aid, + u8 SupRate[], + u8 SupRateLen, + u8 ExtRate[], + u8 ExtRateLen, IN PEDCA_PARM pEdcaParm, IN HT_CAPABILITY_IE * pHtCapability, - IN UCHAR HtCapabilityLen, IN ADD_HT_INFO_IE * pAddHtInfo); + u8 HtCapabilityLen, IN ADD_HT_INFO_IE * pAddHtInfo); -VOID AuthStateMachineInit(IN PRTMP_ADAPTER pAd, +void AuthStateMachineInit(IN PRTMP_ADAPTER pAd, IN PSTATE_MACHINE sm, OUT STATE_MACHINE_FUNC Trans[]); -VOID AuthTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +void AuthTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3); -VOID MlmeAuthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeAuthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerAuthRspAtSeq2Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerAuthRspAtSeq2Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerAuthRspAtSeq4Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerAuthRspAtSeq4Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID AuthTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void AuthTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID Cls2errAction(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr); +void Cls2errAction(IN PRTMP_ADAPTER pAd, u8 *pAddr); -VOID MlmeDeauthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeDeauthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID InvalidStateWhenAuth(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void InvalidStateWhenAuth(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); /*============================================= */ -VOID AuthRspStateMachineInit(IN PRTMP_ADAPTER pAd, +void AuthRspStateMachineInit(IN PRTMP_ADAPTER pAd, IN PSTATE_MACHINE Sm, IN STATE_MACHINE_FUNC Trans[]); -VOID PeerDeauthAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerDeauthAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerAuthSimpleRspGenAndSend(IN PRTMP_ADAPTER pAd, +void PeerAuthSimpleRspGenAndSend(IN PRTMP_ADAPTER pAd, IN PHEADER_802_11 pHdr80211, - IN USHORT Alg, - IN USHORT Seq, - IN USHORT Reason, IN USHORT Status); + u16 Alg, + u16 Seq, + u16 Reason, u16 Status); /* */ /* Private routines in dls.c */ @@ -2938,691 +2938,691 @@ VOID PeerAuthSimpleRspGenAndSend(IN PRTMP_ADAPTER pAd, /*======================================== */ -VOID SyncStateMachineInit(IN PRTMP_ADAPTER pAd, +void SyncStateMachineInit(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * Sm, OUT STATE_MACHINE_FUNC Trans[]); -VOID BeaconTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +void BeaconTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3); -VOID ScanTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +void ScanTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3); -VOID InvalidStateWhenScan(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void InvalidStateWhenScan(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID InvalidStateWhenJoin(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void InvalidStateWhenJoin(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID InvalidStateWhenStart(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void InvalidStateWhenStart(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID EnqueueProbeRequest(IN PRTMP_ADAPTER pAd); +void EnqueueProbeRequest(IN PRTMP_ADAPTER pAd); BOOLEAN ScanRunning(IN PRTMP_ADAPTER pAd); /*========================================= */ -VOID MlmeCntlInit(IN PRTMP_ADAPTER pAd, +void MlmeCntlInit(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * S, OUT STATE_MACHINE_FUNC Trans[]); -VOID MlmeCntlMachinePerformAction(IN PRTMP_ADAPTER pAd, +void MlmeCntlMachinePerformAction(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * S, IN MLME_QUEUE_ELEM * Elem); -VOID CntlIdleProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlIdleProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID CntlOidScanProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlOidScanProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID CntlMlmeRoamingProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlMlmeRoamingProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID CntlWaitDisassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlWaitDisassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID CntlWaitJoinProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlWaitJoinProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID CntlWaitReassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlWaitReassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID CntlWaitStartProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlWaitStartProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID CntlWaitAuthProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlWaitAuthProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID CntlWaitAuthProc2(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlWaitAuthProc2(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID CntlWaitAssocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlWaitAssocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType); +void LinkUp(IN PRTMP_ADAPTER pAd, u8 BssType); -VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP); +void LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP); -VOID IterateOnBssTab(IN PRTMP_ADAPTER pAd); +void IterateOnBssTab(IN PRTMP_ADAPTER pAd); -VOID IterateOnBssTab2(IN PRTMP_ADAPTER pAd);; +void IterateOnBssTab2(IN PRTMP_ADAPTER pAd);; -VOID JoinParmFill(IN PRTMP_ADAPTER pAd, - IN OUT MLME_JOIN_REQ_STRUCT * JoinReq, IN ULONG BssIdx); +void JoinParmFill(IN PRTMP_ADAPTER pAd, + IN OUT MLME_JOIN_REQ_STRUCT * JoinReq, unsigned long BssIdx); -VOID AssocParmFill(IN PRTMP_ADAPTER pAd, +void AssocParmFill(IN PRTMP_ADAPTER pAd, IN OUT MLME_ASSOC_REQ_STRUCT * AssocReq, - IN PUCHAR pAddr, - IN USHORT CapabilityInfo, - IN ULONG Timeout, IN USHORT ListenIntv); + u8 *pAddr, + u16 CapabilityInfo, + unsigned long Timeout, u16 ListenIntv); -VOID ScanParmFill(IN PRTMP_ADAPTER pAd, +void ScanParmFill(IN PRTMP_ADAPTER pAd, IN OUT MLME_SCAN_REQ_STRUCT * ScanReq, - IN STRING Ssid[], - IN UCHAR SsidLen, IN UCHAR BssType, IN UCHAR ScanType); + char Ssid[], + u8 SsidLen, u8 BssType, u8 ScanType); -VOID DisassocParmFill(IN PRTMP_ADAPTER pAd, +void DisassocParmFill(IN PRTMP_ADAPTER pAd, IN OUT MLME_DISASSOC_REQ_STRUCT * DisassocReq, - IN PUCHAR pAddr, IN USHORT Reason); + u8 *pAddr, u16 Reason); -VOID StartParmFill(IN PRTMP_ADAPTER pAd, +void StartParmFill(IN PRTMP_ADAPTER pAd, IN OUT MLME_START_REQ_STRUCT * StartReq, - IN CHAR Ssid[], IN UCHAR SsidLen); + char Ssid[], u8 SsidLen); -VOID AuthParmFill(IN PRTMP_ADAPTER pAd, +void AuthParmFill(IN PRTMP_ADAPTER pAd, IN OUT MLME_AUTH_REQ_STRUCT * AuthReq, - IN PUCHAR pAddr, IN USHORT Alg); + u8 *pAddr, u16 Alg); -VOID EnqueuePsPoll(IN PRTMP_ADAPTER pAd); +void EnqueuePsPoll(IN PRTMP_ADAPTER pAd); -VOID EnqueueBeaconFrame(IN PRTMP_ADAPTER pAd); +void EnqueueBeaconFrame(IN PRTMP_ADAPTER pAd); -VOID MlmeJoinReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeJoinReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID MlmeScanReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeScanReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID MlmeStartReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeStartReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID ScanTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void ScanTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID BeaconTimeoutAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void BeaconTimeoutAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerBeaconAtScanAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerBeaconAtScanAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID PeerProbeReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerProbeReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); -VOID ScanNextChannel(IN PRTMP_ADAPTER pAd); +void ScanNextChannel(IN PRTMP_ADAPTER pAd); -ULONG MakeIbssBeacon(IN PRTMP_ADAPTER pAd); +unsigned long MakeIbssBeacon(IN PRTMP_ADAPTER pAd); BOOLEAN MlmeScanReqSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, - IN ULONG MsgLen, - OUT UCHAR * BssType, - OUT CHAR ssid[], - OUT UCHAR * SsidLen, OUT UCHAR * ScanType); + void * Msg, + unsigned long MsgLen, + u8 * BssType, + char ssid[], + u8 * SsidLen, u8 * ScanType); BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, - IN ULONG MsgLen, - IN UCHAR MsgChannel, - OUT PUCHAR pAddr2, - OUT PUCHAR pBssid, - OUT CHAR Ssid[], - OUT UCHAR * pSsidLen, - OUT UCHAR * pBssType, - OUT USHORT * pBeaconPeriod, - OUT UCHAR * pChannel, - OUT UCHAR * pNewChannel, + void * Msg, + unsigned long MsgLen, + u8 MsgChannel, + u8 *pAddr2, + u8 *pBssid, + char Ssid[], + u8 * pSsidLen, + u8 * pBssType, + u16 * pBeaconPeriod, + u8 * pChannel, + u8 * pNewChannel, OUT LARGE_INTEGER * pTimestamp, OUT CF_PARM * pCfParm, - OUT USHORT * pAtimWin, - OUT USHORT * pCapabilityInfo, - OUT UCHAR * pErp, - OUT UCHAR * pDtimCount, - OUT UCHAR * pDtimPeriod, - OUT UCHAR * pBcastFlag, - OUT UCHAR * pMessageToMe, - OUT UCHAR SupRate[], - OUT UCHAR * pSupRateLen, - OUT UCHAR ExtRate[], - OUT UCHAR * pExtRateLen, - OUT UCHAR * pCkipFlag, - OUT UCHAR * pAironetCellPowerLimit, + u16 * pAtimWin, + u16 * pCapabilityInfo, + u8 * pErp, + u8 * pDtimCount, + u8 * pDtimPeriod, + u8 * pBcastFlag, + u8 * pMessageToMe, + u8 SupRate[], + u8 * pSupRateLen, + u8 ExtRate[], + u8 * pExtRateLen, + u8 * pCkipFlag, + u8 * pAironetCellPowerLimit, OUT PEDCA_PARM pEdcaParm, OUT PQBSS_LOAD_PARM pQbssLoad, OUT PQOS_CAPABILITY_PARM pQosCapability, - OUT ULONG * pRalinkIe, - OUT UCHAR * pHtCapabilityLen, - OUT UCHAR * pPreNHtCapabilityLen, + unsigned long * pRalinkIe, + u8 * pHtCapabilityLen, + u8 * pPreNHtCapabilityLen, OUT HT_CAPABILITY_IE * pHtCapability, - OUT UCHAR * AddHtInfoLen, + u8 * AddHtInfoLen, OUT ADD_HT_INFO_IE * AddHtInfo, - OUT UCHAR * NewExtChannel, - OUT USHORT * LengthVIE, + u8 * NewExtChannel, + u16 * LengthVIE, OUT PNDIS_802_11_VARIABLE_IEs pVIE); BOOLEAN PeerAddBAReqActionSanity(IN PRTMP_ADAPTER pAd, - IN VOID * pMsg, - IN ULONG MsgLen, OUT PUCHAR pAddr2); + void * pMsg, + unsigned long MsgLen, u8 *pAddr2); BOOLEAN PeerAddBARspActionSanity(IN PRTMP_ADAPTER pAd, - IN VOID * pMsg, IN ULONG MsgLen); + void * pMsg, unsigned long MsgLen); BOOLEAN PeerDelBAActionSanity(IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, IN VOID * pMsg, IN ULONG MsgLen); + u8 Wcid, void * pMsg, unsigned long MsgLen); BOOLEAN MlmeAssocReqSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, - IN ULONG MsgLen, - OUT PUCHAR pApAddr, - OUT USHORT * CapabilityInfo, - OUT ULONG * Timeout, OUT USHORT * ListenIntv); + void * Msg, + unsigned long MsgLen, + u8 *pApAddr, + u16 * CapabilityInfo, + unsigned long * Timeout, u16 * ListenIntv); BOOLEAN MlmeAuthReqSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr, - OUT ULONG * Timeout, OUT USHORT * Alg); + void * Msg, + unsigned long MsgLen, + u8 *pAddr, + unsigned long * Timeout, u16 * Alg); BOOLEAN MlmeStartReqSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, - IN ULONG MsgLen, - OUT CHAR Ssid[], OUT UCHAR * Ssidlen); + void * Msg, + unsigned long MsgLen, + char Ssid[], u8 * Ssidlen); BOOLEAN PeerAuthSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr, - OUT USHORT * Alg, - OUT USHORT * Seq, - OUT USHORT * Status, OUT CHAR ChlgText[]); - -BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen, OUT PUCHAR pAddr2, OUT USHORT * pCapabilityInfo, OUT USHORT * pStatus, OUT USHORT * pAid, OUT UCHAR SupRate[], OUT UCHAR * pSupRateLen, OUT UCHAR ExtRate[], OUT UCHAR * pExtRateLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ - OUT UCHAR * pHtCapabilityLen, - OUT UCHAR * pAddHtInfoLen, - OUT UCHAR * pNewExtChannelOffset, - OUT PEDCA_PARM pEdcaParm, OUT UCHAR * pCkipFlag); + void * Msg, + unsigned long MsgLen, + u8 *pAddr, + u16 * Alg, + u16 * Seq, + u16 * Status, char ChlgText[]); + +BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, void * pMsg, unsigned long MsgLen, u8 *pAddr2, u16 * pCapabilityInfo, u16 * pStatus, u16 * pAid, u8 SupRate[], u8 * pSupRateLen, u8 ExtRate[], u8 * pExtRateLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ + u8 * pHtCapabilityLen, + u8 * pAddHtInfoLen, + u8 * pNewExtChannelOffset, + OUT PEDCA_PARM pEdcaParm, u8 * pCkipFlag); BOOLEAN PeerDisassocSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, OUT USHORT * Reason); + void * Msg, + unsigned long MsgLen, + u8 *pAddr2, u16 * Reason); BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, IN PEAPOL_PACKET pMsg, - IN ULONG MsgLen, - IN UCHAR MsgType, IN MAC_TABLE_ENTRY * pEntry); + unsigned long MsgLen, + u8 MsgType, IN MAC_TABLE_ENTRY * pEntry); BOOLEAN PeerDeauthSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, OUT USHORT * Reason); + void * Msg, + unsigned long MsgLen, + u8 *pAddr2, u16 * Reason); BOOLEAN PeerProbeReqSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT CHAR Ssid[], OUT UCHAR * pSsidLen); + void * Msg, + unsigned long MsgLen, + u8 *pAddr2, + char Ssid[], u8 * pSsidLen); -BOOLEAN GetTimBit(IN CHAR * Ptr, - IN USHORT Aid, - OUT UCHAR * TimLen, - OUT UCHAR * BcastFlag, - OUT UCHAR * DtimCount, - OUT UCHAR * DtimPeriod, OUT UCHAR * MessageToMe); +BOOLEAN GetTimBit(char * Ptr, + u16 Aid, + u8 * TimLen, + u8 * BcastFlag, + u8 * DtimCount, + u8 * DtimPeriod, u8 * MessageToMe); -UCHAR ChannelSanity(IN PRTMP_ADAPTER pAd, IN UCHAR channel); +u8 ChannelSanity(IN PRTMP_ADAPTER pAd, u8 channel); NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity(IN PBSS_ENTRY pBss); BOOLEAN MlmeDelBAReqSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, IN ULONG MsgLen); + void * Msg, unsigned long MsgLen); BOOLEAN MlmeAddBAReqSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, IN ULONG MsgLen, OUT PUCHAR pAddr2); + void * Msg, unsigned long MsgLen, u8 *pAddr2); -ULONG MakeOutgoingFrame(OUT UCHAR * Buffer, OUT ULONG * Length, ...); +unsigned long MakeOutgoingFrame(u8 * Buffer, unsigned long * Length, ...); -VOID LfsrInit(IN PRTMP_ADAPTER pAd, IN ULONG Seed); +void LfsrInit(IN PRTMP_ADAPTER pAd, unsigned long Seed); -UCHAR RandomByte(IN PRTMP_ADAPTER pAd); +u8 RandomByte(IN PRTMP_ADAPTER pAd); -VOID AsicUpdateAutoFallBackTable(IN PRTMP_ADAPTER pAd, IN PUCHAR pTxRate); +void AsicUpdateAutoFallBackTable(IN PRTMP_ADAPTER pAd, u8 *pTxRate); -VOID MlmePeriodicExec(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +void MlmePeriodicExec(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3); -VOID LinkDownExec(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +void LinkDownExec(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3); -VOID STAMlmePeriodicExec(PRTMP_ADAPTER pAd); +void STAMlmePeriodicExec(PRTMP_ADAPTER pAd); -VOID MlmeAutoScan(IN PRTMP_ADAPTER pAd); +void MlmeAutoScan(IN PRTMP_ADAPTER pAd); -VOID MlmeAutoReconnectLastSSID(IN PRTMP_ADAPTER pAd); +void MlmeAutoReconnectLastSSID(IN PRTMP_ADAPTER pAd); -BOOLEAN MlmeValidateSSID(IN PUCHAR pSsid, IN UCHAR SsidLen); +BOOLEAN MlmeValidateSSID(u8 *pSsid, u8 SsidLen); -VOID MlmeCheckForRoaming(IN PRTMP_ADAPTER pAd, IN ULONG Now32); +void MlmeCheckForRoaming(IN PRTMP_ADAPTER pAd, unsigned long Now32); BOOLEAN MlmeCheckForFastRoaming(IN PRTMP_ADAPTER pAd); -VOID MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd); +void MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd); -VOID MlmeSetTxRate(IN PRTMP_ADAPTER pAd, +void MlmeSetTxRate(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, IN PRTMP_TX_RATE_SWITCH pTxRate); -VOID MlmeSelectTxRateTable(IN PRTMP_ADAPTER pAd, +void MlmeSelectTxRateTable(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR * ppTable, - IN PUCHAR pTableSize, IN PUCHAR pInitTxRateIdx); + u8 ** ppTable, + u8 *pTableSize, u8 *pInitTxRateIdx); -VOID MlmeCalculateChannelQuality(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pMacEntry, IN ULONG Now); +void MlmeCalculateChannelQuality(IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pMacEntry, unsigned long Now); -VOID MlmeCheckPsmChange(IN PRTMP_ADAPTER pAd, IN ULONG Now32); +void MlmeCheckPsmChange(IN PRTMP_ADAPTER pAd, unsigned long Now32); -VOID MlmeSetPsmBit(IN PRTMP_ADAPTER pAd, IN USHORT psm); +void MlmeSetPsmBit(IN PRTMP_ADAPTER pAd, u16 psm); -VOID MlmeSetTxPreamble(IN PRTMP_ADAPTER pAd, IN USHORT TxPreamble); +void MlmeSetTxPreamble(IN PRTMP_ADAPTER pAd, u16 TxPreamble); -VOID UpdateBasicRateBitmap(IN PRTMP_ADAPTER pAd); +void UpdateBasicRateBitmap(IN PRTMP_ADAPTER pAd); -VOID MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, - IN BOOLEAN bLinkUp, IN UCHAR apidx); +void MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, + IN BOOLEAN bLinkUp, u8 apidx); -VOID MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, IN UCHAR apidx); +void MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, u8 apidx); -VOID RTMPCheckRates(IN PRTMP_ADAPTER pAd, - IN OUT UCHAR SupRate[], IN OUT UCHAR * SupRateLen); +void RTMPCheckRates(IN PRTMP_ADAPTER pAd, + IN u8 SupRate[], IN u8 * SupRateLen); BOOLEAN RTMPCheckChannel(IN PRTMP_ADAPTER pAd, - IN UCHAR CentralChannel, IN UCHAR Channel); + u8 CentralChannel, u8 Channel); BOOLEAN RTMPCheckHt(IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, + u8 Wcid, IN OUT HT_CAPABILITY_IE * pHtCapability, IN OUT ADD_HT_INFO_IE * pAddHtInfo); -VOID StaQuickResponeForRateUpExec(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); +void StaQuickResponeForRateUpExec(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, + void *SystemSpecific3); -VOID RTMPUpdateMlmeRate(IN PRTMP_ADAPTER pAd); +void RTMPUpdateMlmeRate(IN PRTMP_ADAPTER pAd); -CHAR RTMPMaxRssi(IN PRTMP_ADAPTER pAd, - IN CHAR Rssi0, IN CHAR Rssi1, IN CHAR Rssi2); +char RTMPMaxRssi(IN PRTMP_ADAPTER pAd, + char Rssi0, char Rssi1, char Rssi2); #ifdef RT30xx -VOID AsicSetRxAnt(IN PRTMP_ADAPTER pAd, IN UCHAR Ant); +void AsicSetRxAnt(IN PRTMP_ADAPTER pAd, u8 Ant); -VOID RTMPFilterCalibration(IN PRTMP_ADAPTER pAd); +void RTMPFilterCalibration(IN PRTMP_ADAPTER pAd); #ifdef RTMP_EFUSE_SUPPORT /*2008/09/11:KH add to support efuse<-- */ -INT set_eFuseGetFreeBlockCount_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg); +int set_eFuseGetFreeBlockCount_Proc(IN PRTMP_ADAPTER pAd, char *arg); -INT set_eFusedump_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg); +int set_eFusedump_Proc(IN PRTMP_ADAPTER pAd, char *arg); -VOID eFusePhysicalReadRegisters(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, - IN USHORT Length, OUT USHORT * pData); +void eFusePhysicalReadRegisters(IN PRTMP_ADAPTER pAd, + u16 Offset, + u16 Length, u16 * pData); int RtmpEfuseSupportCheck(IN RTMP_ADAPTER * pAd); -VOID eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, PUINT EfuseFreeBlock); +void eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, u32 *EfuseFreeBlock); -INT eFuse_init(IN PRTMP_ADAPTER pAd); +int eFuse_init(IN PRTMP_ADAPTER pAd); /*2008/09/11:KH add to support efuse--> */ #endif /* RTMP_EFUSE_SUPPORT // */ /* add by johnli, RF power sequence setup */ -VOID RT30xxLoadRFNormalModeSetup(IN PRTMP_ADAPTER pAd); +void RT30xxLoadRFNormalModeSetup(IN PRTMP_ADAPTER pAd); -VOID RT30xxLoadRFSleepModeSetup(IN PRTMP_ADAPTER pAd); +void RT30xxLoadRFSleepModeSetup(IN PRTMP_ADAPTER pAd); -VOID RT30xxReverseRFSleepModeSetup(IN PRTMP_ADAPTER pAd); +void RT30xxReverseRFSleepModeSetup(IN PRTMP_ADAPTER pAd); /* end johnli */ #ifdef RT3070 -VOID NICInitRT3070RFRegisters(IN RTMP_ADAPTER * pAd); +void NICInitRT3070RFRegisters(IN RTMP_ADAPTER * pAd); #endif /* RT3070 // */ #ifdef RT3090 -VOID NICInitRT3090RFRegisters(IN RTMP_ADAPTER * pAd); +void NICInitRT3090RFRegisters(IN RTMP_ADAPTER * pAd); #endif /* RT3090 // */ -VOID RT30xxHaltAction(IN PRTMP_ADAPTER pAd); +void RT30xxHaltAction(IN PRTMP_ADAPTER pAd); -VOID RT30xxSetRxAnt(IN PRTMP_ADAPTER pAd, IN UCHAR Ant); +void RT30xxSetRxAnt(IN PRTMP_ADAPTER pAd, u8 Ant); #endif /* RT30xx // */ -VOID AsicEvaluateRxAnt(IN PRTMP_ADAPTER pAd); +void AsicEvaluateRxAnt(IN PRTMP_ADAPTER pAd); -VOID AsicRxAntEvalTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +void AsicRxAntEvalTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3); -VOID APSDPeriodicExec(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +void APSDPeriodicExec(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3); BOOLEAN RTMPCheckEntryEnableAutoRateSwitch(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry); -UCHAR RTMPStaFixedTxMode(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry); +u8 RTMPStaFixedTxMode(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry); -VOID RTMPUpdateLegacyTxSetting(UCHAR fixed_tx_mode, PMAC_TABLE_ENTRY pEntry); +void RTMPUpdateLegacyTxSetting(u8 fixed_tx_mode, PMAC_TABLE_ENTRY pEntry); BOOLEAN RTMPAutoRateSwitchCheck(IN PRTMP_ADAPTER pAd); -NDIS_STATUS MlmeInit(IN PRTMP_ADAPTER pAd); +int MlmeInit(IN PRTMP_ADAPTER pAd); -VOID MlmeHandler(IN PRTMP_ADAPTER pAd); +void MlmeHandler(IN PRTMP_ADAPTER pAd); -VOID MlmeHalt(IN PRTMP_ADAPTER pAd); +void MlmeHalt(IN PRTMP_ADAPTER pAd); -VOID MlmeResetRalinkCounters(IN PRTMP_ADAPTER pAd); +void MlmeResetRalinkCounters(IN PRTMP_ADAPTER pAd); -VOID BuildChannelList(IN PRTMP_ADAPTER pAd); +void BuildChannelList(IN PRTMP_ADAPTER pAd); -UCHAR FirstChannel(IN PRTMP_ADAPTER pAd); +u8 FirstChannel(IN PRTMP_ADAPTER pAd); -UCHAR NextChannel(IN PRTMP_ADAPTER pAd, IN UCHAR channel); +u8 NextChannel(IN PRTMP_ADAPTER pAd, u8 channel); -VOID ChangeToCellPowerLimit(IN PRTMP_ADAPTER pAd, - IN UCHAR AironetCellPowerLimit); +void ChangeToCellPowerLimit(IN PRTMP_ADAPTER pAd, + u8 AironetCellPowerLimit); /* */ /* Prototypes of function definition in rtmp_tkip.c */ /* */ -VOID RTMPInitTkipEngine(IN PRTMP_ADAPTER pAd, - IN PUCHAR pTKey, - IN UCHAR KeyId, - IN PUCHAR pTA, - IN PUCHAR pMICKey, - IN PUCHAR pTSC, OUT PULONG pIV16, OUT PULONG pIV32); - -VOID RTMPInitMICEngine(IN PRTMP_ADAPTER pAd, - IN PUCHAR pKey, - IN PUCHAR pDA, - IN PUCHAR pSA, IN UCHAR UserPriority, IN PUCHAR pMICKey); +void RTMPInitTkipEngine(IN PRTMP_ADAPTER pAd, + u8 *pTKey, + u8 KeyId, + u8 *pTA, + u8 *pMICKey, + u8 *pTSC, unsigned long *pIV16, unsigned long *pIV32); + +void RTMPInitMICEngine(IN PRTMP_ADAPTER pAd, + u8 *pKey, + u8 *pDA, + u8 *pSA, u8 UserPriority, u8 *pMICKey); BOOLEAN RTMPTkipCompareMICValue(IN PRTMP_ADAPTER pAd, - IN PUCHAR pSrc, - IN PUCHAR pDA, - IN PUCHAR pSA, - IN PUCHAR pMICKey, - IN UCHAR UserPriority, IN UINT Len); + u8 *pSrc, + u8 *pDA, + u8 *pSA, + u8 *pMICKey, + u8 UserPriority, u32 Len); -VOID RTMPCalculateMICValue(IN PRTMP_ADAPTER pAd, +void RTMPCalculateMICValue(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket, - IN PUCHAR pEncap, - IN PCIPHER_KEY pKey, IN UCHAR apidx); + u8 *pEncap, + IN PCIPHER_KEY pKey, u8 apidx); -VOID RTMPTkipAppendByte(IN PTKIP_KEY_INFO pTkip, IN UCHAR uChar); +void RTMPTkipAppendByte(IN PTKIP_KEY_INFO pTkip, u8 uChar); -VOID RTMPTkipAppend(IN PTKIP_KEY_INFO pTkip, IN PUCHAR pSrc, IN UINT nBytes); +void RTMPTkipAppend(IN PTKIP_KEY_INFO pTkip, u8 *pSrc, u32 nBytes); -VOID RTMPTkipGetMIC(IN PTKIP_KEY_INFO pTkip); +void RTMPTkipGetMIC(IN PTKIP_KEY_INFO pTkip); BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, - IN UCHAR UserPriority, IN PCIPHER_KEY pWpaKey); + u8 *pData, + unsigned long DataByteCnt, + u8 UserPriority, IN PCIPHER_KEY pWpaKey); BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG DataByteCnt, IN PCIPHER_KEY pWpaKey); + u8 *pData, + unsigned long DataByteCnt, IN PCIPHER_KEY pWpaKey); /* */ /* Prototypes of function definition in cmm_info.c */ /* */ -INT RT_CfgSetCountryRegion(IN PRTMP_ADAPTER pAd, IN PSTRING arg, IN INT band); +int RT_CfgSetCountryRegion(IN PRTMP_ADAPTER pAd, char *arg, int band); -INT RT_CfgSetWirelessMode(IN PRTMP_ADAPTER pAd, IN PSTRING arg); +int RT_CfgSetWirelessMode(IN PRTMP_ADAPTER pAd, char *arg); -INT RT_CfgSetShortSlot(IN PRTMP_ADAPTER pAd, IN PSTRING arg); +int RT_CfgSetShortSlot(IN PRTMP_ADAPTER pAd, char *arg); -INT RT_CfgSetWepKey(IN PRTMP_ADAPTER pAd, - IN PSTRING keyString, - IN CIPHER_KEY * pSharedKey, IN INT keyIdx); +int RT_CfgSetWepKey(IN PRTMP_ADAPTER pAd, + char *keyString, + IN CIPHER_KEY * pSharedKey, int keyIdx); -INT RT_CfgSetWPAPSKKey(IN RTMP_ADAPTER * pAd, - IN PSTRING keyString, - IN UCHAR * pHashStr, - IN INT hashStrLen, OUT PUCHAR pPMKBuf); +int RT_CfgSetWPAPSKKey(IN RTMP_ADAPTER * pAd, + char *keyString, + u8 * pHashStr, + int hashStrLen, u8 *pPMKBuf); /* */ /* Prototypes of function definition in cmm_info.c */ /* */ -VOID RTMPWPARemoveAllKeys(IN PRTMP_ADAPTER pAd); +void RTMPWPARemoveAllKeys(IN PRTMP_ADAPTER pAd); -VOID RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, IN ULONG phymode); +void RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, unsigned long phymode); -VOID RTMPUpdateHTIE(IN RT_HT_CAPABILITY * pRtHt, - IN UCHAR * pMcsSet, +void RTMPUpdateHTIE(IN RT_HT_CAPABILITY * pRtHt, + u8 * pMcsSet, OUT HT_CAPABILITY_IE * pHtCapability, OUT ADD_HT_INFO_IE * pAddHtInfo); -VOID RTMPAddWcidAttributeEntry(IN PRTMP_ADAPTER pAd, - IN UCHAR BssIdx, - IN UCHAR KeyIdx, - IN UCHAR CipherAlg, IN MAC_TABLE_ENTRY * pEntry); +void RTMPAddWcidAttributeEntry(IN PRTMP_ADAPTER pAd, + u8 BssIdx, + u8 KeyIdx, + u8 CipherAlg, IN MAC_TABLE_ENTRY * pEntry); -PSTRING GetEncryptType(CHAR enc); +char *GetEncryptType(char enc); -PSTRING GetAuthMode(CHAR auth); +char *GetAuthMode(char auth); -VOID RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode); +void RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode); -VOID RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, IN UCHAR apidx); +void RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, u8 apidx); -VOID RTMPSendWirelessEvent(IN PRTMP_ADAPTER pAd, - IN USHORT Event_flag, - IN PUCHAR pAddr, IN UCHAR BssIdx, IN CHAR Rssi); +void RTMPSendWirelessEvent(IN PRTMP_ADAPTER pAd, + u16 Event_flag, + u8 *pAddr, u8 BssIdx, char Rssi); -CHAR ConvertToRssi(IN PRTMP_ADAPTER pAd, IN CHAR Rssi, IN UCHAR RssiNumber); +char ConvertToRssi(IN PRTMP_ADAPTER pAd, char Rssi, u8 RssiNumber); /*=================================== Function prototype in cmm_wpa.c =================================== */ -VOID RTMPToWirelessSta(IN PRTMP_ADAPTER pAd, +void RTMPToWirelessSta(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, - IN UINT DataLen, IN BOOLEAN bClearFrame); + u8 *pHeader802_3, + u32 HdrLen, + u8 *pData, + u32 DataLen, IN BOOLEAN bClearFrame); -VOID WpaDerivePTK(IN PRTMP_ADAPTER pAd, - IN UCHAR * PMK, - IN UCHAR * ANonce, - IN UCHAR * AA, - IN UCHAR * SNonce, - IN UCHAR * SA, OUT UCHAR * output, IN UINT len); +void WpaDerivePTK(IN PRTMP_ADAPTER pAd, + u8 * PMK, + u8 * ANonce, + u8 * AA, + u8 * SNonce, + u8 * SA, u8 * output, u32 len); -VOID GenRandom(IN PRTMP_ADAPTER pAd, IN UCHAR * macAddr, OUT UCHAR * random); +void GenRandom(IN PRTMP_ADAPTER pAd, u8 * macAddr, u8 * random); BOOLEAN RTMPCheckWPAframe(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR pData, - IN ULONG DataByteCount, IN UCHAR FromWhichBSSID); + u8 *pData, + unsigned long DataByteCount, u8 FromWhichBSSID); -VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key, - OUT UCHAR * plaintext, - IN UINT32 c_len, IN UCHAR * ciphertext); +void AES_GTK_KEY_UNWRAP(u8 * key, + u8 * plaintext, + u32 c_len, u8 * ciphertext); BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, - IN PUCHAR pKeyData, - IN UCHAR KeyDataLen, - IN UCHAR GroupKeyIndex, - IN UCHAR MsgType, + u8 *pKeyData, + u8 KeyDataLen, + u8 GroupKeyIndex, + u8 MsgType, IN BOOLEAN bWPA2, IN MAC_TABLE_ENTRY * pEntry); -VOID ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, - IN UCHAR GroupKeyWepStatus, - IN UCHAR MsgType, - IN UCHAR DefaultKeyIdx, - IN UCHAR * KeyNonce, - IN UCHAR * TxRSC, - IN UCHAR * GTK, - IN UCHAR * RSNIE, - IN UCHAR RSNIE_Len, OUT PEAPOL_PACKET pMsg); - -NDIS_STATUS RTMPSoftDecryptBroadCastData(IN PRTMP_ADAPTER pAd, +void ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, + u8 GroupKeyWepStatus, + u8 MsgType, + u8 DefaultKeyIdx, + u8 * KeyNonce, + u8 * TxRSC, + u8 * GTK, + u8 * RSNIE, + u8 RSNIE_Len, OUT PEAPOL_PACKET pMsg); + +int RTMPSoftDecryptBroadCastData(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk, IN NDIS_802_11_ENCRYPTION_STATUS GroupCipher, IN PCIPHER_KEY pShard_key); -VOID RTMPMakeRSNIE(IN PRTMP_ADAPTER pAd, - IN UINT AuthMode, IN UINT WepStatus, IN UCHAR apidx); +void RTMPMakeRSNIE(IN PRTMP_ADAPTER pAd, + u32 AuthMode, u32 WepStatus, u8 apidx); /* */ /* function prototype in ap_wpa.c */ /* */ -VOID RTMPGetTxTscFromAsic(IN PRTMP_ADAPTER pAd, - IN UCHAR apidx, OUT PUCHAR pTxTsc); +void RTMPGetTxTscFromAsic(IN PRTMP_ADAPTER pAd, + u8 apidx, u8 *pTxTsc); -VOID APInstallPairwiseKey(PRTMP_ADAPTER pAd, PMAC_TABLE_ENTRY pEntry); +void APInstallPairwiseKey(PRTMP_ADAPTER pAd, PMAC_TABLE_ENTRY pEntry); -UINT APValidateRSNIE(IN PRTMP_ADAPTER pAd, +u32 APValidateRSNIE(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, - IN PUCHAR pRsnIe, IN UCHAR rsnie_len); + u8 *pRsnIe, u8 rsnie_len); -VOID HandleCounterMeasure(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry); +void HandleCounterMeasure(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry); -VOID WPAStart4WayHS(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, IN ULONG TimeInterval); +void WPAStart4WayHS(IN PRTMP_ADAPTER pAd, + IN MAC_TABLE_ENTRY * pEntry, unsigned long TimeInterval); -VOID WPAStart2WayGroupHS(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry); +void WPAStart2WayGroupHS(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry); -VOID PeerPairMsg1Action(IN PRTMP_ADAPTER pAd, +void PeerPairMsg1Action(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem); -VOID PeerPairMsg2Action(IN PRTMP_ADAPTER pAd, +void PeerPairMsg2Action(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem); -VOID PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, +void PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem); -VOID PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, +void PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem); -VOID PeerGroupMsg1Action(IN PRTMP_ADAPTER pAd, +void PeerGroupMsg1Action(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, IN MLME_QUEUE_ELEM * Elem); -VOID PeerGroupMsg2Action(IN PRTMP_ADAPTER pAd, +void PeerGroupMsg2Action(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, - IN VOID * Msg, IN UINT MsgLen); + void * Msg, u32 MsgLen); -VOID WpaDeriveGTK(IN UCHAR * PMK, - IN UCHAR * GNonce, - IN UCHAR * AA, OUT UCHAR * output, IN UINT len); +void WpaDeriveGTK(u8 * PMK, + u8 * GNonce, + u8 * AA, u8 * output, u32 len); -VOID AES_GTK_KEY_WRAP(IN UCHAR * key, - IN UCHAR * plaintext, - IN UINT32 p_len, OUT UCHAR * ciphertext); +void AES_GTK_KEY_WRAP(u8 * key, + u8 * plaintext, + u32 p_len, u8 * ciphertext); /*typedef void (*TIMER_FUNCTION)(unsigned long); */ /* timeout -- ms */ -VOID RTMP_SetPeriodicTimer(IN NDIS_MINIPORT_TIMER * pTimer, +void RTMP_SetPeriodicTimer(IN NDIS_MINIPORT_TIMER * pTimer, IN unsigned long timeout); -VOID RTMP_OS_Init_Timer(IN PRTMP_ADAPTER pAd, +void RTMP_OS_Init_Timer(IN PRTMP_ADAPTER pAd, IN NDIS_MINIPORT_TIMER * pTimer, - IN TIMER_FUNCTION function, IN PVOID data); + IN TIMER_FUNCTION function, void *data); -VOID RTMP_OS_Add_Timer(IN NDIS_MINIPORT_TIMER * pTimer, +void RTMP_OS_Add_Timer(IN NDIS_MINIPORT_TIMER * pTimer, IN unsigned long timeout); -VOID RTMP_OS_Mod_Timer(IN NDIS_MINIPORT_TIMER * pTimer, +void RTMP_OS_Mod_Timer(IN NDIS_MINIPORT_TIMER * pTimer, IN unsigned long timeout); -VOID RTMP_OS_Del_Timer(IN NDIS_MINIPORT_TIMER * pTimer, +void RTMP_OS_Del_Timer(IN NDIS_MINIPORT_TIMER * pTimer, OUT BOOLEAN * pCancelled); -VOID RTMP_OS_Release_Packet(IN PRTMP_ADAPTER pAd, IN PQUEUE_ENTRY pEntry); +void RTMP_OS_Release_Packet(IN PRTMP_ADAPTER pAd, IN PQUEUE_ENTRY pEntry); -VOID RTMPusecDelay(IN ULONG usec); +void RTMPusecDelay(unsigned long usec); -NDIS_STATUS os_alloc_mem(IN RTMP_ADAPTER * pAd, - OUT UCHAR ** mem, IN ULONG size); +int os_alloc_mem(IN RTMP_ADAPTER * pAd, + u8 ** mem, unsigned long size); -NDIS_STATUS os_free_mem(IN PRTMP_ADAPTER pAd, IN PVOID mem); +int os_free_mem(IN PRTMP_ADAPTER pAd, void *mem); void RTMP_AllocateSharedMemory(IN PRTMP_ADAPTER pAd, - IN ULONG Length, + unsigned long Length, IN BOOLEAN Cached, - OUT PVOID * VirtualAddress, + void ** VirtualAddress, OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); -VOID RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd); +void RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd); -NDIS_STATUS AdapterBlockAllocateMemory(IN PVOID handle, OUT PVOID * ppAd); +int AdapterBlockAllocateMemory(void *handle, void ** ppAd); void RTMP_AllocateTxDescMemory(IN PRTMP_ADAPTER pAd, - IN UINT Index, - IN ULONG Length, + u32 Index, + unsigned long Length, IN BOOLEAN Cached, - OUT PVOID * VirtualAddress, + void ** VirtualAddress, OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); void RTMP_AllocateFirstTxBuffer(IN PRTMP_ADAPTER pAd, - IN UINT Index, - IN ULONG Length, + u32 Index, + unsigned long Length, IN BOOLEAN Cached, - OUT PVOID * VirtualAddress, + void ** VirtualAddress, OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); void RTMP_FreeFirstTxBuffer(IN PRTMP_ADAPTER pAd, - IN ULONG Length, + unsigned long Length, IN BOOLEAN Cached, - IN PVOID VirtualAddress, + void *VirtualAddress, IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); void RTMP_AllocateMgmtDescMemory(IN PRTMP_ADAPTER pAd, - IN ULONG Length, + unsigned long Length, IN BOOLEAN Cached, - OUT PVOID * VirtualAddress, + void ** VirtualAddress, OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); void RTMP_AllocateRxDescMemory(IN PRTMP_ADAPTER pAd, - IN ULONG Length, + unsigned long Length, IN BOOLEAN Cached, - OUT PVOID * VirtualAddress, + void ** VirtualAddress, OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); void RTMP_FreeDescMemory(IN PRTMP_ADAPTER pAd, - IN ULONG Length, - IN PVOID VirtualAddress, + unsigned long Length, + void *VirtualAddress, IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); PNDIS_PACKET RtmpOSNetPktAlloc(IN RTMP_ADAPTER * pAd, IN int size); PNDIS_PACKET RTMP_AllocateRxPacketBuffer(IN PRTMP_ADAPTER pAd, - IN ULONG Length, + unsigned long Length, IN BOOLEAN Cached, - OUT PVOID * VirtualAddress, + void ** VirtualAddress, OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); PNDIS_PACKET RTMP_AllocateTxPacketBuffer(IN PRTMP_ADAPTER pAd, - IN ULONG Length, + unsigned long Length, IN BOOLEAN Cached, - OUT PVOID * VirtualAddress); + void ** VirtualAddress); PNDIS_PACKET RTMP_AllocateFragPacketBuffer(IN PRTMP_ADAPTER pAd, - IN ULONG Length); + unsigned long Length); void RTMP_QueryPacketInfo(IN PNDIS_PACKET pPacket, OUT PACKET_INFO * pPacketInfo, - OUT PUCHAR * pSrcBufVA, OUT UINT * pSrcBufLen); + u8 ** pSrcBufVA, u32 * pSrcBufLen); void RTMP_QueryNextPacketInfo(IN PNDIS_PACKET * ppPacket, OUT PACKET_INFO * pPacketInfo, - OUT PUCHAR * pSrcBufVA, OUT UINT * pSrcBufLen); + u8 ** pSrcBufVA, u32 * pSrcBufLen); BOOLEAN RTMP_FillTxBlkInfo(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk); @@ -3631,57 +3631,57 @@ rt_get_sg_list_from_packet(PNDIS_PACKET pPacket, RTMP_SCATTER_GATHER_LIST * sg); void announce_802_3_packet(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); -UINT BA_Reorder_AMSDU_Annnounce(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); +u32 BA_Reorder_AMSDU_Annnounce(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); -PNET_DEV get_netdev_from_bssid(IN PRTMP_ADAPTER pAd, IN UCHAR FromWhichBSSID); +PNET_DEV get_netdev_from_bssid(IN PRTMP_ADAPTER pAd, u8 FromWhichBSSID); PNDIS_PACKET duplicate_pkt(IN PRTMP_ADAPTER pAd, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, - IN ULONG DataSize, IN UCHAR FromWhichBSSID); + u8 *pHeader802_3, + u32 HdrLen, + u8 *pData, + unsigned long DataSize, u8 FromWhichBSSID); PNDIS_PACKET duplicate_pkt_with_TKIP_MIC(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pOldPkt); void ba_flush_reordering_timeout_mpdus(IN PRTMP_ADAPTER pAd, IN PBA_REC_ENTRY pBAEntry, - IN ULONG Now32); + unsigned long Now32); -VOID BAOriSessionSetUp(IN PRTMP_ADAPTER pAd, +void BAOriSessionSetUp(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, - IN UCHAR TID, - IN USHORT TimeOut, - IN ULONG DelayTime, IN BOOLEAN isForced); + u8 TID, + u16 TimeOut, + unsigned long DelayTime, IN BOOLEAN isForced); -VOID BASessionTearDownALL(IN OUT PRTMP_ADAPTER pAd, IN UCHAR Wcid); +void BASessionTearDownALL(IN OUT PRTMP_ADAPTER pAd, u8 Wcid); BOOLEAN OS_Need_Clone_Packet(void); -VOID build_tx_packet(IN PRTMP_ADAPTER pAd, +void build_tx_packet(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket, - IN PUCHAR pFrame, IN ULONG FrameLen); + u8 *pFrame, unsigned long FrameLen); -VOID BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR TID, +void BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd, + u8 Wcid, + u8 TID, IN BOOLEAN bPassive, IN BOOLEAN bForceSend); -VOID BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd, - IN UCHAR Wcid, IN UCHAR TID, IN BOOLEAN bPassive); +void BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd, + u8 Wcid, u8 TID, IN BOOLEAN bPassive); BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num); void ba_reordering_resource_release(PRTMP_ADAPTER pAd); -PSTRING rstrtok(IN PSTRING s, IN const PSTRING ct); +char *rstrtok(char *s, IN const char *ct); /*//////// common ioctl functions ////////// */ -INT SetCommonHT(IN PRTMP_ADAPTER pAd); +int SetCommonHT(IN PRTMP_ADAPTER pAd); -INT WpaCheckEapCode(IN PRTMP_ADAPTER pAd, - IN PUCHAR pFrame, IN USHORT FrameLen, IN USHORT OffSet); +int WpaCheckEapCode(IN PRTMP_ADAPTER pAd, + u8 *pFrame, u16 FrameLen, u16 OffSet); -VOID WpaSendMicFailureToWpaSupplicant(IN PRTMP_ADAPTER pAd, +void WpaSendMicFailureToWpaSupplicant(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUnicast); int wext_notify_event_assoc(IN RTMP_ADAPTER * pAd); @@ -3689,37 +3689,37 @@ int wext_notify_event_assoc(IN RTMP_ADAPTER * pAd); BOOLEAN STARxDoneInterruptHandle(IN PRTMP_ADAPTER pAd, IN BOOLEAN argc); /* AMPDU packet indication */ -VOID Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); +void Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, u8 FromWhichBSSID); /* AMSDU packet indication */ -VOID Indicate_AMSDU_Packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); +void Indicate_AMSDU_Packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, u8 FromWhichBSSID); /* Normal legacy Rx packet indication */ -VOID Indicate_Legacy_Packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); +void Indicate_Legacy_Packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, u8 FromWhichBSSID); -VOID Indicate_EAPOL_Packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); +void Indicate_EAPOL_Packet(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, u8 FromWhichBSSID); void update_os_packet_info(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); + IN RX_BLK * pRxBlk, u8 FromWhichBSSID); void wlan_802_11_to_802_3_packet(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk, - IN PUCHAR pHeader802_3, - IN UCHAR FromWhichBSSID); + u8 *pHeader802_3, + u8 FromWhichBSSID); /* remove LLC and get 802_3 Header */ #define RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(_pRxBlk, _pHeader802_3) \ { \ - PUCHAR _pRemovedLLCSNAP = NULL, _pDA, _pSA; \ + u8 *_pRemovedLLCSNAP = NULL, *_pDA, *_pSA; \ \ if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_MESH)) \ { \ _pDA = _pRxBlk->pHeader->Addr3; \ - _pSA = (PUCHAR)_pRxBlk->pHeader + sizeof(HEADER_802_11); \ + _pSA = (u8 *)_pRxBlk->pHeader + sizeof(HEADER_802_11); \ } \ else \ { \ @@ -3742,36 +3742,36 @@ void wlan_802_11_to_802_3_packet(IN PRTMP_ADAPTER pAd, _pRxBlk->DataSize, _pRemovedLLCSNAP); \ } -VOID Sta_Announce_or_Forward_802_3_Packet(IN PRTMP_ADAPTER pAd, +void Sta_Announce_or_Forward_802_3_Packet(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket, - IN UCHAR FromWhichBSSID); + u8 FromWhichBSSID); #define ANNOUNCE_OR_FORWARD_802_3_PACKET(_pAd, _pPacket, _FromWhichBSS)\ Sta_Announce_or_Forward_802_3_Packet(_pAd, _pPacket, _FromWhichBSS); /*announce_802_3_packet(_pAd, _pPacket); */ PNDIS_PACKET DuplicatePacket(IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, IN UCHAR FromWhichBSSID); + IN PNDIS_PACKET pPacket, u8 FromWhichBSSID); PNDIS_PACKET ClonePacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket, - IN PUCHAR pData, IN ULONG DataSize); + u8 *pData, unsigned long DataSize); /* Normal, AMPDU or AMSDU */ -VOID CmmRxnonRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); +void CmmRxnonRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, + IN RX_BLK * pRxBlk, u8 FromWhichBSSID); -VOID CmmRxRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, +void CmmRxRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, - IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID); + IN RX_BLK * pRxBlk, u8 FromWhichBSSID); -VOID Update_Rssi_Sample(IN PRTMP_ADAPTER pAd, +void Update_Rssi_Sample(IN PRTMP_ADAPTER pAd, IN RSSI_SAMPLE * pRssi, IN PRXWI_STRUC pRxWI); PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, OUT PRT28XX_RXD_STRUC pSaveRxD, OUT BOOLEAN * pbReschedule, - IN OUT UINT32 * pRxPending); + IN u32 * pRxPending); PNDIS_PACKET RTMPDeFragmentDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk); @@ -3798,17 +3798,17 @@ enum { /* Definition from madwifi */ typedef struct { - UINT32 did; - UINT16 status; - UINT16 len; - UINT32 data; + u32 did; + u16 status; + u16 len; + u32 data; } p80211item_uint32_t; typedef struct { - UINT32 msgcode; - UINT32 msglen; + u32 msgcode; + u32 msglen; #define WLAN_DEVNAMELEN_MAX 16 - UINT8 devname[WLAN_DEVNAMELEN_MAX]; + u8 devname[WLAN_DEVNAMELEN_MAX]; p80211item_uint32_t hosttime; p80211item_uint32_t mactime; p80211item_uint32_t channel; @@ -3823,18 +3823,18 @@ typedef struct { /* The radio capture header precedes the 802.11 header. */ typedef struct PACKED _ieee80211_radiotap_header { - UINT8 it_version; /* Version 0. Only increases + u8 it_version; /* Version 0. Only increases * for drastic changes, * introduction of compatible * new fields does not count. */ - UINT8 it_pad; - UINT16 it_len; /* length of the whole + u8 it_pad; + u16 it_len; /* length of the whole * header in bytes, including * it_version, it_pad, * it_len, and data fields. */ - UINT32 it_present; /* A bitmap telling which + u32 it_present; /* A bitmap telling which * fields are present. Set bit 31 * (0x80000000) to extend the * bitmap by another 32 bits. @@ -3868,38 +3868,38 @@ enum ieee80211_radiotap_type { typedef struct _wlan_radiotap_header { ieee80211_radiotap_header wt_ihdr; - INT64 wt_tsft; - UINT8 wt_flags; - UINT8 wt_rate; + long long wt_tsft; + u8 wt_flags; + u8 wt_rate; } wlan_radiotap_header; /* Definition from madwifi */ void send_monitor_packets(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk); -VOID RTMPSetDesiredRates(IN PRTMP_ADAPTER pAdapter, IN LONG Rates); +void RTMPSetDesiredRates(IN PRTMP_ADAPTER pAdapter, long Rates); -INT Set_FixedTxMode_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg); +int Set_FixedTxMode_Proc(IN PRTMP_ADAPTER pAd, char *arg); BOOLEAN RT28XXChipsetCheck(IN void *_dev_p); -VOID RT28XXDMADisable(IN RTMP_ADAPTER * pAd); +void RT28XXDMADisable(IN RTMP_ADAPTER * pAd); -VOID RT28XXDMAEnable(IN RTMP_ADAPTER * pAd); +void RT28XXDMAEnable(IN RTMP_ADAPTER * pAd); -VOID RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, - IN INT apidx, - IN ULONG BeaconLen, IN ULONG UpdatePos); +void RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, + int apidx, + unsigned long BeaconLen, unsigned long UpdatePos); int rt28xx_init(IN PRTMP_ADAPTER pAd, - IN PSTRING pDefaultMac, IN PSTRING pHostName); + char *pDefaultMac, char *pHostName); -NDIS_STATUS RtmpNetTaskInit(IN RTMP_ADAPTER * pAd); +int RtmpNetTaskInit(IN RTMP_ADAPTER * pAd); -VOID RtmpNetTaskExit(IN PRTMP_ADAPTER pAd); +void RtmpNetTaskExit(IN PRTMP_ADAPTER pAd); -NDIS_STATUS RtmpMgmtTaskInit(IN RTMP_ADAPTER * pAd); +int RtmpMgmtTaskInit(IN RTMP_ADAPTER * pAd); -VOID RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd); +void RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd); void tbtt_tasklet(unsigned long data); @@ -3908,7 +3908,7 @@ PNET_DEV RtmpPhyNetDevInit(IN RTMP_ADAPTER * pAd, BOOLEAN RtmpPhyNetDevExit(IN RTMP_ADAPTER * pAd, IN PNET_DEV net_dev); -INT RtmpRaDevCtrlInit(IN RTMP_ADAPTER * pAd, IN RTMP_INF_TYPE infType); +int RtmpRaDevCtrlInit(IN RTMP_ADAPTER * pAd, IN RTMP_INF_TYPE infType); BOOLEAN RtmpRaDevCtrlExit(IN RTMP_ADAPTER * pAd); @@ -3916,317 +3916,317 @@ BOOLEAN RtmpRaDevCtrlExit(IN RTMP_ADAPTER * pAd); /* */ /* Function Prototype in cmm_data_pci.c */ /* */ -USHORT RtmpPCI_WriteTxResource(IN PRTMP_ADAPTER pAd, +u16 RtmpPCI_WriteTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, - IN BOOLEAN bIsLast, OUT USHORT * FreeNumber); + IN BOOLEAN bIsLast, u16 * FreeNumber); -USHORT RtmpPCI_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, +u16 RtmpPCI_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, IN BOOLEAN bIsLast, - OUT USHORT * FreeNumber); + u16 * FreeNumber); -USHORT RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, +u16 RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, - IN UCHAR frameNum, OUT USHORT * FreeNumber); + u8 frameNum, u16 * FreeNumber); -USHORT RtmpPCI_WriteFragTxResource(IN PRTMP_ADAPTER pAd, +u16 RtmpPCI_WriteFragTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, - IN UCHAR fragNum, OUT USHORT * FreeNumber); + u8 fragNum, u16 * FreeNumber); -USHORT RtmpPCI_WriteSubTxResource(IN PRTMP_ADAPTER pAd, +u16 RtmpPCI_WriteSubTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, - IN BOOLEAN bIsLast, OUT USHORT * FreeNumber); + IN BOOLEAN bIsLast, u16 * FreeNumber); -VOID RtmpPCI_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, +void RtmpPCI_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, - IN USHORT totalMPDUSize, - IN USHORT FirstTxIdx); + u16 totalMPDUSize, + u16 FirstTxIdx); -VOID RtmpPCIDataLastTxIdx(IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, IN USHORT LastTxIdx); +void RtmpPCIDataLastTxIdx(IN PRTMP_ADAPTER pAd, + u8 QueIdx, u16 LastTxIdx); -VOID RtmpPCIDataKickOut(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, IN UCHAR QueIdx); +void RtmpPCIDataKickOut(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, u8 QueIdx); int RtmpPCIMgmtKickOut(IN RTMP_ADAPTER * pAd, - IN UCHAR QueIdx, + u8 QueIdx, IN PNDIS_PACKET pPacket, - IN PUCHAR pSrcBufVA, IN UINT SrcBufLen); + u8 *pSrcBufVA, u32 SrcBufLen); -NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd, +int RTMPCheckRxError(IN PRTMP_ADAPTER pAd, IN PHEADER_802_11 pHeader, IN PRXWI_STRUC pRxWI, IN PRT28XX_RXD_STRUC pRxD); BOOLEAN RT28xxPciAsicRadioOff(IN PRTMP_ADAPTER pAd, - IN UCHAR Level, IN USHORT TbttNumToNextWakeUp); + u8 Level, u16 TbttNumToNextWakeUp); -BOOLEAN RT28xxPciAsicRadioOn(IN PRTMP_ADAPTER pAd, IN UCHAR Level); +BOOLEAN RT28xxPciAsicRadioOn(IN PRTMP_ADAPTER pAd, u8 Level); -VOID RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd); +void RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd); -VOID RTMPFindHostPCIDev(IN PRTMP_ADAPTER pAd); +void RTMPFindHostPCIDev(IN PRTMP_ADAPTER pAd); -VOID RTMPPCIeLinkCtrlValueRestore(IN PRTMP_ADAPTER pAd, IN UCHAR Level); +void RTMPPCIeLinkCtrlValueRestore(IN PRTMP_ADAPTER pAd, u8 Level); -VOID RTMPPCIeLinkCtrlSetting(IN PRTMP_ADAPTER pAd, IN USHORT Max); +void RTMPPCIeLinkCtrlSetting(IN PRTMP_ADAPTER pAd, u16 Max); -VOID RTMPrt3xSetPCIePowerLinkCtrl(IN PRTMP_ADAPTER pAd); +void RTMPrt3xSetPCIePowerLinkCtrl(IN PRTMP_ADAPTER pAd); -VOID PsPollWakeExec(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +void PsPollWakeExec(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3); -VOID RadioOnExec(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); +void RadioOnExec(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3); -VOID RT28xxPciStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx); +void RT28xxPciStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx); -VOID RT28xxPciStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp); +void RT28xxPciStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, + u16 TbttNumToNextWakeUp); -VOID RT28xxPciMlmeRadioOn(IN PRTMP_ADAPTER pAd); +void RT28xxPciMlmeRadioOn(IN PRTMP_ADAPTER pAd); -VOID RT28xxPciMlmeRadioOFF(IN PRTMP_ADAPTER pAd); +void RT28xxPciMlmeRadioOFF(IN PRTMP_ADAPTER pAd); #endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB /* */ /* Function Prototype in rtusb_bulk.c */ /* */ -VOID RTUSBInitTxDesc(IN PRTMP_ADAPTER pAd, +void RTUSBInitTxDesc(IN PRTMP_ADAPTER pAd, IN PTX_CONTEXT pTxContext, - IN UCHAR BulkOutPipeId, IN usb_complete_t Func); + u8 BulkOutPipeId, IN usb_complete_t Func); -VOID RTUSBInitHTTxDesc(IN PRTMP_ADAPTER pAd, +void RTUSBInitHTTxDesc(IN PRTMP_ADAPTER pAd, IN PHT_TX_CONTEXT pTxContext, - IN UCHAR BulkOutPipeId, - IN ULONG BulkOutSize, IN usb_complete_t Func); + u8 BulkOutPipeId, + unsigned long BulkOutSize, IN usb_complete_t Func); -VOID RTUSBInitRxDesc(IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext); +void RTUSBInitRxDesc(IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext); -VOID RTUSBCleanUpDataBulkOutQueue(IN PRTMP_ADAPTER pAd); +void RTUSBCleanUpDataBulkOutQueue(IN PRTMP_ADAPTER pAd); -VOID RTUSBCancelPendingBulkOutIRP(IN PRTMP_ADAPTER pAd); +void RTUSBCancelPendingBulkOutIRP(IN PRTMP_ADAPTER pAd); -VOID RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, - IN UCHAR BulkOutPipeId, IN UCHAR Index); +void RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, + u8 BulkOutPipeId, u8 Index); -VOID RTUSBBulkOutNullFrame(IN PRTMP_ADAPTER pAd); +void RTUSBBulkOutNullFrame(IN PRTMP_ADAPTER pAd); -VOID RTUSBBulkOutRTSFrame(IN PRTMP_ADAPTER pAd); +void RTUSBBulkOutRTSFrame(IN PRTMP_ADAPTER pAd); -VOID RTUSBCancelPendingBulkInIRP(IN PRTMP_ADAPTER pAd); +void RTUSBCancelPendingBulkInIRP(IN PRTMP_ADAPTER pAd); -VOID RTUSBCancelPendingIRPs(IN PRTMP_ADAPTER pAd); +void RTUSBCancelPendingIRPs(IN PRTMP_ADAPTER pAd); -VOID RTUSBBulkOutMLMEPacket(IN PRTMP_ADAPTER pAd, IN UCHAR Index); +void RTUSBBulkOutMLMEPacket(IN PRTMP_ADAPTER pAd, u8 Index); -VOID RTUSBBulkOutPsPoll(IN PRTMP_ADAPTER pAd); +void RTUSBBulkOutPsPoll(IN PRTMP_ADAPTER pAd); -VOID RTUSBCleanUpMLMEBulkOutQueue(IN PRTMP_ADAPTER pAd); +void RTUSBCleanUpMLMEBulkOutQueue(IN PRTMP_ADAPTER pAd); -VOID RTUSBKickBulkOut(IN PRTMP_ADAPTER pAd); +void RTUSBKickBulkOut(IN PRTMP_ADAPTER pAd); -VOID RTUSBBulkReceive(IN PRTMP_ADAPTER pAd); +void RTUSBBulkReceive(IN PRTMP_ADAPTER pAd); -VOID DoBulkIn(IN RTMP_ADAPTER * pAd); +void DoBulkIn(IN RTMP_ADAPTER * pAd); -VOID RTUSBInitRxDesc(IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext); +void RTUSBInitRxDesc(IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext); -VOID RTUSBBulkRxHandle(IN unsigned long data); +void RTUSBBulkRxHandle(IN unsigned long data); /* */ /* Function Prototype in rtusb_io.c */ /* */ -NTSTATUS RTUSBMultiRead(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, OUT PUCHAR pData, IN USHORT length); +int RTUSBMultiRead(IN PRTMP_ADAPTER pAd, + u16 Offset, u8 *pData, u16 length); -NTSTATUS RTUSBMultiWrite(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, IN PUCHAR pData, IN USHORT length); +int RTUSBMultiWrite(IN PRTMP_ADAPTER pAd, + u16 Offset, u8 *pData, u16 length); -NTSTATUS RTUSBMultiWrite_OneByte(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, IN PUCHAR pData); +int RTUSBMultiWrite_OneByte(IN PRTMP_ADAPTER pAd, + u16 Offset, u8 *pData); -NTSTATUS RTUSBReadBBPRegister(IN PRTMP_ADAPTER pAd, - IN UCHAR Id, IN PUCHAR pValue); +int RTUSBReadBBPRegister(IN PRTMP_ADAPTER pAd, + u8 Id, u8 *pValue); -NTSTATUS RTUSBWriteBBPRegister(IN PRTMP_ADAPTER pAd, - IN UCHAR Id, IN UCHAR Value); +int RTUSBWriteBBPRegister(IN PRTMP_ADAPTER pAd, + u8 Id, u8 Value); -NTSTATUS RTUSBWriteRFRegister(IN PRTMP_ADAPTER pAd, IN UINT32 Value); +int RTUSBWriteRFRegister(IN PRTMP_ADAPTER pAd, u32 Value); -NTSTATUS RTUSB_VendorRequest(IN PRTMP_ADAPTER pAd, - IN UINT32 TransferFlags, - IN UCHAR ReservedBits, - IN UCHAR Request, - IN USHORT Value, - IN USHORT Index, - IN PVOID TransferBuffer, - IN UINT32 TransferBufferLength); +int RTUSB_VendorRequest(IN PRTMP_ADAPTER pAd, + u32 TransferFlags, + u8 ReservedBits, + u8 Request, + u16 Value, + u16 Index, + void *TransferBuffer, + u32 TransferBufferLength); -NTSTATUS RTUSBReadEEPROM(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, OUT PUCHAR pData, IN USHORT length); +int RTUSBReadEEPROM(IN PRTMP_ADAPTER pAd, + u16 Offset, u8 *pData, u16 length); -NTSTATUS RTUSBWriteEEPROM(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, IN PUCHAR pData, IN USHORT length); +int RTUSBWriteEEPROM(IN PRTMP_ADAPTER pAd, + u16 Offset, u8 *pData, u16 length); -VOID RTUSBPutToSleep(IN PRTMP_ADAPTER pAd); +void RTUSBPutToSleep(IN PRTMP_ADAPTER pAd); -NTSTATUS RTUSBWakeUp(IN PRTMP_ADAPTER pAd); +int RTUSBWakeUp(IN PRTMP_ADAPTER pAd); -VOID RTUSBInitializeCmdQ(IN PCmdQ cmdq); +void RTUSBInitializeCmdQ(IN PCmdQ cmdq); -NDIS_STATUS RTUSBEnqueueCmdFromNdis(IN PRTMP_ADAPTER pAd, +int RTUSBEnqueueCmdFromNdis(IN PRTMP_ADAPTER pAd, IN NDIS_OID Oid, IN BOOLEAN SetInformation, - IN PVOID pInformationBuffer, - IN UINT32 InformationBufferLength); + void *pInformationBuffer, + u32 InformationBufferLength); -NDIS_STATUS RTUSBEnqueueInternalCmd(IN PRTMP_ADAPTER pAd, +int RTUSBEnqueueInternalCmd(IN PRTMP_ADAPTER pAd, IN NDIS_OID Oid, - IN PVOID pInformationBuffer, - IN UINT32 InformationBufferLength); + void *pInformationBuffer, + u32 InformationBufferLength); -VOID RTUSBDequeueCmd(IN PCmdQ cmdq, OUT PCmdQElmt * pcmdqelmt); +void RTUSBDequeueCmd(IN PCmdQ cmdq, OUT PCmdQElmt * pcmdqelmt); -INT RTUSBCmdThread(IN OUT PVOID Context); +int RTUSBCmdThread(IN void *Context); -VOID RTUSBBssBeaconExit(IN RTMP_ADAPTER * pAd); +void RTUSBBssBeaconExit(IN RTMP_ADAPTER * pAd); -VOID RTUSBBssBeaconStop(IN RTMP_ADAPTER * pAd); +void RTUSBBssBeaconStop(IN RTMP_ADAPTER * pAd); -VOID RTUSBBssBeaconStart(IN RTMP_ADAPTER * pAd); +void RTUSBBssBeaconStart(IN RTMP_ADAPTER * pAd); -VOID RTUSBBssBeaconInit(IN RTMP_ADAPTER * pAd); +void RTUSBBssBeaconInit(IN RTMP_ADAPTER * pAd); -VOID RTUSBWatchDog(IN RTMP_ADAPTER * pAd); +void RTUSBWatchDog(IN RTMP_ADAPTER * pAd); -NTSTATUS RTUSBWriteMACRegister(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, IN UINT32 Value); +int RTUSBWriteMACRegister(IN PRTMP_ADAPTER pAd, + u16 Offset, u32 Value); -NTSTATUS RTUSBReadMACRegister(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, OUT PUINT32 pValue); +int RTUSBReadMACRegister(IN PRTMP_ADAPTER pAd, + u16 Offset, u32 *pValue); -NTSTATUS RTUSBSingleWrite(IN RTMP_ADAPTER * pAd, - IN USHORT Offset, IN USHORT Value); +int RTUSBSingleWrite(IN RTMP_ADAPTER * pAd, + u16 Offset, u16 Value); -NTSTATUS RTUSBFirmwareWrite(IN PRTMP_ADAPTER pAd, - IN PUCHAR pFwImage, IN ULONG FwLen); +int RTUSBFirmwareWrite(IN PRTMP_ADAPTER pAd, + u8 *pFwImage, unsigned long FwLen); -NTSTATUS RTUSBVenderReset(IN PRTMP_ADAPTER pAd); +int RTUSBVenderReset(IN PRTMP_ADAPTER pAd); -NDIS_STATUS RTUSBSetHardWareRegister(IN PRTMP_ADAPTER pAdapter, IN PVOID pBuf); +int RTUSBSetHardWareRegister(IN PRTMP_ADAPTER pAdapter, void *pBuf); -NDIS_STATUS RTUSBQueryHardWareRegister(IN PRTMP_ADAPTER pAdapter, - IN PVOID pBuf); +int RTUSBQueryHardWareRegister(IN PRTMP_ADAPTER pAdapter, + void *pBuf); -VOID CMDHandler(IN PRTMP_ADAPTER pAd); +void CMDHandler(IN PRTMP_ADAPTER pAd); -NDIS_STATUS RTUSBWriteHWMACAddress(IN PRTMP_ADAPTER pAdapter); +int RTUSBWriteHWMACAddress(IN PRTMP_ADAPTER pAdapter); -VOID MacTableInitialize(IN PRTMP_ADAPTER pAd); +void MacTableInitialize(IN PRTMP_ADAPTER pAd); -VOID MlmeSetPsm(IN PRTMP_ADAPTER pAd, IN USHORT psm); +void MlmeSetPsm(IN PRTMP_ADAPTER pAd, u16 psm); -NDIS_STATUS RTMPWPAAddKeyProc(IN PRTMP_ADAPTER pAd, IN PVOID pBuf); +int RTMPWPAAddKeyProc(IN PRTMP_ADAPTER pAd, void *pBuf); -VOID AsicRxAntEvalAction(IN PRTMP_ADAPTER pAd); +void AsicRxAntEvalAction(IN PRTMP_ADAPTER pAd); void append_pkt(IN PRTMP_ADAPTER pAd, - IN PUCHAR pHeader802_3, - IN UINT HdrLen, - IN PUCHAR pData, - IN ULONG DataSize, OUT PNDIS_PACKET * ppPacket); + u8 *pHeader802_3, + u32 HdrLen, + u8 *pData, + unsigned long DataSize, OUT PNDIS_PACKET * ppPacket); -UINT deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, +u32 deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, PNDIS_PACKET pPacket, - IN PUCHAR pData, IN ULONG DataSize); + u8 *pData, unsigned long DataSize); -NDIS_STATUS RTMPCheckRxError(IN PRTMP_ADAPTER pAd, +int RTMPCheckRxError(IN PRTMP_ADAPTER pAd, IN PHEADER_802_11 pHeader, IN PRXWI_STRUC pRxWI, IN PRT28XX_RXD_STRUC pRxINFO); -VOID RTUSBMlmeHardTransmit(IN PRTMP_ADAPTER pAd, IN PMGMT_STRUC pMgmt); +void RTUSBMlmeHardTransmit(IN PRTMP_ADAPTER pAd, IN PMGMT_STRUC pMgmt); -INT MlmeThread(IN PVOID Context); +int MlmeThread(void *Context); /* */ /* Function Prototype in rtusb_data.c */ /* */ -NDIS_STATUS RTUSBFreeDescriptorRequest(IN PRTMP_ADAPTER pAd, - IN UCHAR BulkOutPipeId, - IN UINT32 NumberRequired); +int RTUSBFreeDescriptorRequest(IN PRTMP_ADAPTER pAd, + u8 BulkOutPipeId, + u32 NumberRequired); -BOOLEAN RTUSBNeedQueueBackForAgg(IN RTMP_ADAPTER * pAd, IN UCHAR BulkOutPipeId); +BOOLEAN RTUSBNeedQueueBackForAgg(IN RTMP_ADAPTER * pAd, u8 BulkOutPipeId); -VOID RTMPWriteTxInfo(IN PRTMP_ADAPTER pAd, +void RTMPWriteTxInfo(IN PRTMP_ADAPTER pAd, IN PTXINFO_STRUC pTxInfo, - IN USHORT USBDMApktLen, + u16 USBDMApktLen, IN BOOLEAN bWiv, - IN UCHAR QueueSel, IN UCHAR NextValid, IN UCHAR TxBurst); + u8 QueueSel, u8 NextValid, u8 TxBurst); /* */ /* Function Prototype in cmm_data_usb.c */ /* */ -USHORT RtmpUSB_WriteSubTxResource(IN PRTMP_ADAPTER pAd, +u16 RtmpUSB_WriteSubTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, - IN BOOLEAN bIsLast, OUT USHORT * FreeNumber); + IN BOOLEAN bIsLast, u16 * FreeNumber); -USHORT RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, +u16 RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, IN BOOLEAN bIsLast, - OUT USHORT * FreeNumber); + u16 * FreeNumber); -USHORT RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, +u16 RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, - IN UCHAR fragNum, OUT USHORT * FreeNumber); + u8 fragNum, u16 * FreeNumber); -USHORT RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, +u16 RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, - IN UCHAR frameNum, OUT USHORT * FreeNumber); + u8 frameNum, u16 * FreeNumber); -VOID RtmpUSB_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, +void RtmpUSB_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, - IN USHORT totalMPDUSize, IN USHORT TxIdx); + u16 totalMPDUSize, u16 TxIdx); -VOID RtmpUSBDataLastTxIdx(IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, IN USHORT TxIdx); +void RtmpUSBDataLastTxIdx(IN PRTMP_ADAPTER pAd, + u8 QueIdx, u16 TxIdx); -VOID RtmpUSBDataKickOut(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, IN UCHAR QueIdx); +void RtmpUSBDataKickOut(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, u8 QueIdx); int RtmpUSBMgmtKickOut(IN RTMP_ADAPTER * pAd, - IN UCHAR QueIdx, + u8 QueIdx, IN PNDIS_PACKET pPacket, - IN PUCHAR pSrcBufVA, IN UINT SrcBufLen); + u8 *pSrcBufVA, u32 SrcBufLen); -VOID RtmpUSBNullFrameKickOut(IN RTMP_ADAPTER * pAd, - IN UCHAR QueIdx, - IN UCHAR * pNullFrame, IN UINT32 frameLen); +void RtmpUSBNullFrameKickOut(IN RTMP_ADAPTER * pAd, + u8 QueIdx, + u8 * pNullFrame, u32 frameLen); -VOID RtmpUsbStaAsicForceWakeupTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); +void RtmpUsbStaAsicForceWakeupTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, + void *SystemSpecific3); -VOID RT28xxUsbStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx); +void RT28xxUsbStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx); -VOID RT28xxUsbStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp); +void RT28xxUsbStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, + u16 TbttNumToNextWakeUp); -VOID RT28xxUsbMlmeRadioOn(IN PRTMP_ADAPTER pAd); +void RT28xxUsbMlmeRadioOn(IN PRTMP_ADAPTER pAd); -VOID RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd); +void RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd); #endif /* RTMP_MAC_USB // */ -VOID AsicTurnOffRFClk(IN PRTMP_ADAPTER pAd, IN UCHAR Channel); +void AsicTurnOffRFClk(IN PRTMP_ADAPTER pAd, u8 Channel); -VOID AsicTurnOnRFClk(IN PRTMP_ADAPTER pAd, IN UCHAR Channel); +void AsicTurnOnRFClk(IN PRTMP_ADAPTER pAd, u8 Channel); #ifdef RTMP_TIMER_TASK_SUPPORT -INT RtmpTimerQThread(IN OUT PVOID Context); +int RtmpTimerQThread(IN void *Context); RTMP_TIMER_TASK_ENTRY *RtmpTimerQInsert(IN RTMP_ADAPTER * pAd, IN RALINK_TIMER_STRUCT * pTimer); @@ -4239,28 +4239,28 @@ void RtmpTimerQExit(IN RTMP_ADAPTER * pAd); void RtmpTimerQInit(IN RTMP_ADAPTER * pAd); #endif /* RTMP_TIMER_TASK_SUPPORT // */ -VOID AsicStaBbpTuning(IN PRTMP_ADAPTER pAd); +void AsicStaBbpTuning(IN PRTMP_ADAPTER pAd); BOOLEAN StaAddMacTableEntry(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, - IN UCHAR MaxSupportedRateIn500Kbps, + u8 MaxSupportedRateIn500Kbps, IN HT_CAPABILITY_IE * pHtCapability, - IN UCHAR HtCapabilityLen, + u8 HtCapabilityLen, IN ADD_HT_INFO_IE * pAddHtInfo, - IN UCHAR AddHtInfoLen, IN USHORT CapabilityInfo); + u8 AddHtInfoLen, u16 CapabilityInfo); BOOLEAN AUTH_ReqSend(IN PRTMP_ADAPTER pAd, IN PMLME_QUEUE_ELEM pElem, IN PRALINK_TIMER_STRUCT pAuthTimer, - IN PSTRING pSMName, - IN USHORT SeqNo, - IN PUCHAR pNewElement, IN ULONG ElementLen); + char *pSMName, + u16 SeqNo, + u8 *pNewElement, unsigned long ElementLen); void RTMP_IndicateMediaState(IN PRTMP_ADAPTER pAd); -VOID ReSyncBeaconTime(IN PRTMP_ADAPTER pAd); +void ReSyncBeaconTime(IN PRTMP_ADAPTER pAd); -VOID RTMPSetAGCInitValue(IN PRTMP_ADAPTER pAd, IN UCHAR BandWidth); +void RTMPSetAGCInitValue(IN PRTMP_ADAPTER pAd, u8 BandWidth); int rt28xx_close(IN PNET_DEV dev); int rt28xx_open(IN PNET_DEV dev); @@ -4270,7 +4270,7 @@ int rt28xx_open(IN PNET_DEV dev); #define VIRTUAL_IF_NUM(__pAd) ((__pAd)->VirtualIfCnt) #ifdef LINUX -__inline INT VIRTUAL_IF_UP(PRTMP_ADAPTER pAd) +__inline int VIRTUAL_IF_UP(PRTMP_ADAPTER pAd) { if (VIRTUAL_IF_NUM(pAd) == 0) { if (rt28xx_open(pAd->net_dev) != 0) { @@ -4284,7 +4284,7 @@ __inline INT VIRTUAL_IF_UP(PRTMP_ADAPTER pAd) return 0; } -__inline VOID VIRTUAL_IF_DOWN(PRTMP_ADAPTER pAd) +__inline void VIRTUAL_IF_DOWN(PRTMP_ADAPTER pAd) { VIRTUAL_IF_DEC(pAd); if (VIRTUAL_IF_NUM(pAd) == 0) @@ -4298,12 +4298,12 @@ __inline VOID VIRTUAL_IF_DOWN(PRTMP_ADAPTER pAd) TODO: Maybe we need to move these function prototypes to other proper place. */ int RtmpOSWrielessEventSend(IN RTMP_ADAPTER * pAd, - IN UINT32 eventType, - IN INT flags, - IN PUCHAR pSrcMac, - IN PUCHAR pData, IN UINT32 dataLen); + u32 eventType, + int flags, + u8 *pSrcMac, + u8 *pData, u32 dataLen); -int RtmpOSNetDevAddrSet(IN PNET_DEV pNetDev, IN PUCHAR pMacAddr); +int RtmpOSNetDevAddrSet(IN PNET_DEV pNetDev, u8 *pMacAddr); int RtmpOSNetDevAttach(IN PNET_DEV pNetDev, IN RTMP_OS_NETDEV_OP_HOOK * pDevOpHook); @@ -4312,32 +4312,32 @@ void RtmpOSNetDevClose(IN PNET_DEV pNetDev); void RtmpOSNetDevDetach(IN PNET_DEV pNetDev); -INT RtmpOSNetDevAlloc(IN PNET_DEV * pNewNetDev, IN UINT32 privDataSize); +int RtmpOSNetDevAlloc(IN PNET_DEV * pNewNetDev, u32 privDataSize); void RtmpOSNetDevFree(IN PNET_DEV pNetDev); -PNET_DEV RtmpOSNetDevGetByName(IN PNET_DEV pNetDev, IN PSTRING pDevName); +PNET_DEV RtmpOSNetDevGetByName(IN PNET_DEV pNetDev, char *pDevName); void RtmpOSNetDeviceRefPut(IN PNET_DEV pNetDev); PNET_DEV RtmpOSNetDevCreate(IN RTMP_ADAPTER * pAd, - IN INT devType, - IN INT devNum, - IN INT privMemSize, IN PSTRING pNamePrefix); + int devType, + int devNum, + int privMemSize, char *pNamePrefix); /* Task operation related function prototypes */ void RtmpOSTaskCustomize(IN RTMP_OS_TASK * pTask); -INT RtmpOSTaskNotifyToExit(IN RTMP_OS_TASK * pTask); +int RtmpOSTaskNotifyToExit(IN RTMP_OS_TASK * pTask); -NDIS_STATUS RtmpOSTaskKill(IN RTMP_OS_TASK * pTask); +int RtmpOSTaskKill(IN RTMP_OS_TASK * pTask); -NDIS_STATUS RtmpOSTaskInit(IN RTMP_OS_TASK * pTask, - PSTRING pTaskName, VOID * pPriv); +int RtmpOSTaskInit(IN RTMP_OS_TASK * pTask, + char *pTaskName, void * pPriv); -NDIS_STATUS RtmpOSTaskAttach(IN RTMP_OS_TASK * pTask, +int RtmpOSTaskAttach(IN RTMP_OS_TASK * pTask, IN int (*fn) (void *), IN void *arg); /* diff --git a/drivers/staging/rt2860/rtmp_chip.h b/drivers/staging/rt2860/rtmp_chip.h index ea8d2ed52309..a089472b6d4b 100644 --- a/drivers/staging/rt2860/rtmp_chip.h +++ b/drivers/staging/rt2860/rtmp_chip.h @@ -161,7 +161,7 @@ * EEPROM operation related marcos */ #define RT28xx_EEPROM_READ16(_pAd, _offset, _value) \ - (_pAd)->chipOps.eeread((RTMP_ADAPTER *)(_pAd), (USHORT)(_offset), (PUSHORT)&(_value)) + (_pAd)->chipOps.eeread((RTMP_ADAPTER *)(_pAd), (u16)(_offset), (u16 *)&(_value)) /* ------------------------------------------------------------------- */ /* E2PROM data layout */ @@ -172,10 +172,10 @@ /* */ typedef union _MCU_LEDCS_STRUC { struct { - UCHAR LedMode:7; - UCHAR Polarity:1; + u8 LedMode:7; + u8 Polarity:1; } field; - UCHAR word; + u8 word; } MCU_LEDCS_STRUC, *PMCU_LEDCS_STRUC; /* */ @@ -183,32 +183,32 @@ typedef union _MCU_LEDCS_STRUC { /* */ typedef union _EEPROM_ANTENNA_STRUC { struct { - USHORT RxPath:4; /* 1: 1R, 2: 2R, 3: 3R */ - USHORT TxPath:4; /* 1: 1T, 2: 2T */ - USHORT RfIcType:4; /* see E2PROM document */ - USHORT Rsv:4; + u16 RxPath:4; /* 1: 1R, 2: 2R, 3: 3R */ + u16 TxPath:4; /* 1: 1T, 2: 2T */ + u16 RfIcType:4; /* see E2PROM document */ + u16 Rsv:4; } field; - USHORT word; + u16 word; } EEPROM_ANTENNA_STRUC, *PEEPROM_ANTENNA_STRUC; typedef union _EEPROM_NIC_CINFIG2_STRUC { struct { - USHORT HardwareRadioControl:1; /* 1:enable, 0:disable */ - USHORT DynamicTxAgcControl:1; /* */ - USHORT ExternalLNAForG:1; /* */ - USHORT ExternalLNAForA:1; /* external LNA enable for 2.4G */ - USHORT CardbusAcceleration:1; /* !!! NOTE: 0 - enable, 1 - disable */ - USHORT BW40MSidebandForG:1; - USHORT BW40MSidebandForA:1; - USHORT EnableWPSPBC:1; /* WPS PBC Control bit */ - USHORT BW40MAvailForG:1; /* 0:enable, 1:disable */ - USHORT BW40MAvailForA:1; /* 0:enable, 1:disable */ - USHORT Rsv1:1; /* must be 0 */ - USHORT AntDiversity:1; /* Antenna diversity */ - USHORT Rsv2:3; /* must be 0 */ - USHORT DACTestBit:1; /* control if driver should patch the DAC issue */ + u16 HardwareRadioControl:1; /* 1:enable, 0:disable */ + u16 DynamicTxAgcControl:1; /* */ + u16 ExternalLNAForG:1; /* */ + u16 ExternalLNAForA:1; /* external LNA enable for 2.4G */ + u16 CardbusAcceleration:1; /* !!! NOTE: 0 - enable, 1 - disable */ + u16 BW40MSidebandForG:1; + u16 BW40MSidebandForA:1; + u16 EnableWPSPBC:1; /* WPS PBC Control bit */ + u16 BW40MAvailForG:1; /* 0:enable, 1:disable */ + u16 BW40MAvailForA:1; /* 0:enable, 1:disable */ + u16 Rsv1:1; /* must be 0 */ + u16 AntDiversity:1; /* Antenna diversity */ + u16 Rsv2:3; /* must be 0 */ + u16 DACTestBit:1; /* control if driver should patch the DAC issue */ } field; - USHORT word; + u16 word; } EEPROM_NIC_CONFIG2_STRUC, *PEEPROM_NIC_CONFIG2_STRUC; /* */ @@ -216,43 +216,43 @@ typedef union _EEPROM_NIC_CINFIG2_STRUC { /* */ typedef union _EEPROM_TX_PWR_STRUC { struct { - CHAR Byte0; /* Low Byte */ - CHAR Byte1; /* High Byte */ + char Byte0; /* Low Byte */ + char Byte1; /* High Byte */ } field; - USHORT word; + u16 word; } EEPROM_TX_PWR_STRUC, *PEEPROM_TX_PWR_STRUC; typedef union _EEPROM_VERSION_STRUC { struct { - UCHAR FaeReleaseNumber; /* Low Byte */ - UCHAR Version; /* High Byte */ + u8 FaeReleaseNumber; /* Low Byte */ + u8 Version; /* High Byte */ } field; - USHORT word; + u16 word; } EEPROM_VERSION_STRUC, *PEEPROM_VERSION_STRUC; typedef union _EEPROM_LED_STRUC { struct { - USHORT PolarityRDY_G:1; /* Polarity RDY_G setting. */ - USHORT PolarityRDY_A:1; /* Polarity RDY_A setting. */ - USHORT PolarityACT:1; /* Polarity ACT setting. */ - USHORT PolarityGPIO_0:1; /* Polarity GPIO#0 setting. */ - USHORT PolarityGPIO_1:1; /* Polarity GPIO#1 setting. */ - USHORT PolarityGPIO_2:1; /* Polarity GPIO#2 setting. */ - USHORT PolarityGPIO_3:1; /* Polarity GPIO#3 setting. */ - USHORT PolarityGPIO_4:1; /* Polarity GPIO#4 setting. */ - USHORT LedMode:5; /* Led mode. */ - USHORT Rsvd:3; /* Reserved */ + u16 PolarityRDY_G:1; /* Polarity RDY_G setting. */ + u16 PolarityRDY_A:1; /* Polarity RDY_A setting. */ + u16 PolarityACT:1; /* Polarity ACT setting. */ + u16 PolarityGPIO_0:1; /* Polarity GPIO#0 setting. */ + u16 PolarityGPIO_1:1; /* Polarity GPIO#1 setting. */ + u16 PolarityGPIO_2:1; /* Polarity GPIO#2 setting. */ + u16 PolarityGPIO_3:1; /* Polarity GPIO#3 setting. */ + u16 PolarityGPIO_4:1; /* Polarity GPIO#4 setting. */ + u16 LedMode:5; /* Led mode. */ + u16 Rsvd:3; /* Reserved */ } field; - USHORT word; + u16 word; } EEPROM_LED_STRUC, *PEEPROM_LED_STRUC; typedef union _EEPROM_TXPOWER_DELTA_STRUC { struct { - UCHAR DeltaValue:6; /* Tx Power dalta value (MAX=4) */ - UCHAR Type:1; /* 1: plus the delta value, 0: minus the delta value */ - UCHAR TxPowerEnable:1; /* Enable */ + u8 DeltaValue:6; /* Tx Power dalta value (MAX=4) */ + u8 Type:1; /* 1: plus the delta value, 0: minus the delta value */ + u8 TxPowerEnable:1; /* Enable */ } field; - UCHAR value; + u8 value; } EEPROM_TXPOWER_DELTA_STRUC, *PEEPROM_TXPOWER_DELTA_STRUC; #endif /* __RTMP_CHIP_H__ // */ diff --git a/drivers/staging/rt2860/rtmp_ckipmic.h b/drivers/staging/rt2860/rtmp_ckipmic.h index a8108f78795f..301ba5f77bb7 100644 --- a/drivers/staging/rt2860/rtmp_ckipmic.h +++ b/drivers/staging/rt2860/rtmp_ckipmic.h @@ -39,25 +39,25 @@ typedef struct _MIC_CONTEXT { /* --- MMH context */ - UCHAR CK[16]; /* the key */ - UCHAR coefficient[16]; /* current aes counter mode coefficients */ - ULONGLONG accum; /* accumulated mic, reduced to u32 in final() */ - UINT position; /* current position (byte offset) in message */ - UCHAR part[4]; /* for conversion of message to u32 for mmh */ + u8 CK[16]; /* the key */ + u8 coefficient[16]; /* current aes counter mode coefficients */ + unsigned long long accum; /* accumulated mic, reduced to u32 in final() */ + u32 position; /* current position (byte offset) in message */ + u8 part[4]; /* for conversion of message to u32 for mmh */ } MIC_CONTEXT, *PMIC_CONTEXT; -VOID xor_128(IN PUCHAR a, IN PUCHAR b, OUT PUCHAR out); +void xor_128(u8 *a, u8 *b, u8 *out); -UCHAR RTMPCkipSbox(IN UCHAR a); +u8 RTMPCkipSbox(u8 a); -VOID xor_32(IN PUCHAR a, IN PUCHAR b, OUT PUCHAR out); +void xor_32(u8 *a, u8 *b, u8 *out); -VOID next_key(IN PUCHAR key, IN INT round); +void next_key(u8 *key, int round); -VOID byte_sub(IN PUCHAR in, OUT PUCHAR out); +void byte_sub(u8 *in, u8 *out); -VOID shift_row(IN PUCHAR in, OUT PUCHAR out); +void shift_row(u8 *in, u8 *out); -VOID mix_column(IN PUCHAR in, OUT PUCHAR out); +void mix_column(u8 *in, u8 *out); #endif /*__RTMP_CKIPMIC_H__ */ diff --git a/drivers/staging/rt2860/rtmp_def.h b/drivers/staging/rt2860/rtmp_def.h index 39c27f9c8614..92f6114b5547 100644 --- a/drivers/staging/rt2860/rtmp_def.h +++ b/drivers/staging/rt2860/rtmp_def.h @@ -51,8 +51,8 @@ #define RT_DEBUG_INFO 4 #define RT_DEBUG_LOUD 5 -#define NIC_TAG ((ULONG)'0682') -#define NIC_DBG_STRING ("**RT28xx**") +#define NIC_TAG ((unsigned long)'0682') +#define NIC_DBG_char ("**RT28xx**") #ifdef RTMP_MAC_USB #define TX_RING_SIZE 8 /* 1 */ @@ -65,9 +65,9 @@ /*#define PACKED */ -#define RALINK_2883_VERSION ((UINT32)0x28830300) -#define RALINK_2880E_VERSION ((UINT32)0x28720200) -#define RALINK_3070_VERSION ((UINT32)0x30700200) +#define RALINK_2883_VERSION ((u32)0x28830300) +#define RALINK_2880E_VERSION ((u32)0x28720200) +#define RALINK_3070_VERSION ((u32)0x30700200) #define MAX_RX_PKT_LEN 1520 @@ -453,7 +453,7 @@ /* Reason code definitions */ #define REASON_RESERVED 0 #define REASON_UNSPECIFY 1 -#define REASON_NO_LONGER_VALID 2 +#define REASON_NO_longER_VALID 2 #define REASON_DEAUTH_STA_LEAVING 3 #define REASON_DISASSOC_INACTIVE 4 #define REASON_DISASSPC_AP_UNABLE 5 @@ -533,7 +533,7 @@ #define IE_TCLAS 14 /* 802.11e d9 */ #define IE_SCHEDULE 15 /* 802.11e d9 */ #define IE_CHALLENGE_TEXT 16 -#define IE_POWER_CONSTRAINT 32 /* 802.11h d3.3 */ +#define IE_POWER_CONSTRAint 32 /* 802.11h d3.3 */ #define IE_POWER_CAPABILITY 33 /* 802.11h d3.3 */ #define IE_TPC_REQUEST 34 /* 802.11h d3.3 */ #define IE_TPC_REPORT 35 /* 802.11h d3.3 */ @@ -980,10 +980,10 @@ #define MODE_HTGREENFIELD 3 /* MCS for CCK. BW.SGI.STBC are reserved */ -#define MCS_LONGP_RATE_1 0 /* long preamble CCK 1Mbps */ -#define MCS_LONGP_RATE_2 1 /* long preamble CCK 1Mbps */ -#define MCS_LONGP_RATE_5_5 2 -#define MCS_LONGP_RATE_11 3 +#define MCS_longP_RATE_1 0 /* long preamble CCK 1Mbps */ +#define MCS_longP_RATE_2 1 /* long preamble CCK 1Mbps */ +#define MCS_longP_RATE_5_5 2 +#define MCS_longP_RATE_11 3 #define MCS_SHORTP_RATE_1 4 /* long preamble CCK 1Mbps. short is forbidden in 1Mbps */ #define MCS_SHORTP_RATE_2 5 /* short preamble CCK 2Mbps */ #define MCS_SHORTP_RATE_5_5 6 @@ -1109,7 +1109,7 @@ #define IFS_BACKOFF 3 /* pTxD->RetryMode */ -#define LONG_RETRY 1 +#define long_RETRY 1 #define SHORT_RETRY 0 /* Country Region definition */ @@ -1211,7 +1211,7 @@ /* ========================= AP rtmp_def.h =========================== */ /* value domain for pAd->EventTab.Log[].Event */ -#define EVENT_RESET_ACCESS_POINT 0 /* Log = "hh:mm:ss Restart Access Point" */ +#define EVENT_RESET_ACCESS_POint 0 /* Log = "hh:mm:ss Restart Access Point" */ #define EVENT_ASSOCIATED 1 /* Log = "hh:mm:ss STA 00:01:02:03:04:05 associated" */ #define EVENT_DISASSOCIATED 2 /* Log = "hh:mm:ss STA 00:01:02:03:04:05 left this BSS" */ #define EVENT_AGED_OUT 3 /* Log = "hh:mm:ss STA 00:01:02:03:04:05 was aged-out and removed from this BSS" */ @@ -1356,34 +1356,34 @@ /* Endian byte swapping codes */ #define SWAP16(x) \ - ((UINT16)( \ - (((UINT16)(x) & (UINT16) 0x00ffU) << 8) | \ - (((UINT16)(x) & (UINT16) 0xff00U) >> 8) )) + ((u16)( \ + (((u16)(x) & (u16)0x00ffU) << 8) | \ + (((u16)(x) & (u16)0xff00U) >> 8) )) #define SWAP32(x) \ - ((UINT32)( \ - (((UINT32)(x) & (UINT32) 0x000000ffUL) << 24) | \ - (((UINT32)(x) & (UINT32) 0x0000ff00UL) << 8) | \ - (((UINT32)(x) & (UINT32) 0x00ff0000UL) >> 8) | \ - (((UINT32)(x) & (UINT32) 0xff000000UL) >> 24) )) + ((u32)( \ + (((u32)(x) & (u32)0x000000ffUL) << 24) | \ + (((u32)(x) & (u32)0x0000ff00UL) << 8) | \ + (((u32)(x) & (u32)0x00ff0000UL) >> 8) | \ + (((u32)(x) & (u32)0xff000000UL) >> 24) )) #define SWAP64(x) \ - ((UINT64)( \ - (UINT64)(((UINT64)(x) & (UINT64) 0x00000000000000ffULL) << 56) | \ - (UINT64)(((UINT64)(x) & (UINT64) 0x000000000000ff00ULL) << 40) | \ - (UINT64)(((UINT64)(x) & (UINT64) 0x0000000000ff0000ULL) << 24) | \ - (UINT64)(((UINT64)(x) & (UINT64) 0x00000000ff000000ULL) << 8) | \ - (UINT64)(((UINT64)(x) & (UINT64) 0x000000ff00000000ULL) >> 8) | \ - (UINT64)(((UINT64)(x) & (UINT64) 0x0000ff0000000000ULL) >> 24) | \ - (UINT64)(((UINT64)(x) & (UINT64) 0x00ff000000000000ULL) >> 40) | \ - (UINT64)(((UINT64)(x) & (UINT64) 0xff00000000000000ULL) >> 56) )) - -#define cpu2le64(x) ((UINT64)(x)) -#define le2cpu64(x) ((UINT64)(x)) -#define cpu2le32(x) ((UINT32)(x)) -#define le2cpu32(x) ((UINT32)(x)) -#define cpu2le16(x) ((UINT16)(x)) -#define le2cpu16(x) ((UINT16)(x)) + ((u64)( \ + (u64)(((u64)(x) & (u64)0x00000000000000ffULL) << 56) | \ + (u64)(((u64)(x) & (u64)0x000000000000ff00ULL) << 40) | \ + (u64)(((u64)(x) & (u64)0x0000000000ff0000ULL) << 24) | \ + (u64)(((u64)(x) & (u64)0x00000000ff000000ULL) << 8) | \ + (u64)(((u64)(x) & (u64)0x000000ff00000000ULL) >> 8) | \ + (u64)(((u64)(x) & (u64)0x0000ff0000000000ULL) >> 24) | \ + (u64)(((u64)(x) & (u64)0x00ff000000000000ULL) >> 40) | \ + (u64)(((u64)(x) & (u64)0xff00000000000000ULL) >> 56) )) + +#define cpu2le64(x) ((u64)(x)) +#define le2cpu64(x) ((u64)(x)) +#define cpu2le32(x) ((u32)(x)) +#define le2cpu32(x) ((u32)(x)) +#define cpu2le16(x) ((u16)(x)) +#define le2cpu16(x) ((u16)(x)) #define cpu2be64(x) SWAP64((x)) #define be2cpu64(x) SWAP64((x)) #define cpu2be32(x) SWAP32((x)) @@ -1395,7 +1395,7 @@ #define A2Dec(_X, _p) \ { \ - UCHAR *p; \ + u8 *p; \ _X = 0; \ p = _p; \ while (((*p >= '0') && (*p <= '9'))) \ diff --git a/drivers/staging/rt2860/rtmp_dot11.h b/drivers/staging/rt2860/rtmp_dot11.h index fd9c7209bcbd..e97034375e36 100644 --- a/drivers/staging/rt2860/rtmp_dot11.h +++ b/drivers/staging/rt2860/rtmp_dot11.h @@ -32,69 +32,69 @@ /* 4-byte HTC field. maybe included in any frame except non-QOS data frame. The Order bit must set 1. */ typedef struct PACKED { - UINT32 MA:1; /*management action payload exist in (QoS Null+HTC) */ - UINT32 TRQ:1; /*sounding request */ - UINT32 MRQ:1; /*MCS feedback. Request for a MCS feedback */ - UINT32 MRSorASI:3; /* MRQ Sequence identifier. unchanged during entire procedure. 0x000-0x110. */ - UINT32 MFS:3; /*SET to the received value of MRS. 0x111 for unsolicited MFB. */ - UINT32 MFBorASC:7; /*Link adaptation feedback containing recommended MCS. 0x7f for no feedback or not available */ - UINT32 CalPos:2; /* calibration position */ - UINT32 CalSeq:2; /*calibration sequence */ - UINT32 FBKReq:2; /*feedback request */ - UINT32 CSISTEERING:2; /*CSI/ STEERING */ - UINT32 ZLFAnnouce:1; /* ZLF announcement */ - UINT32 rsv:5; /*calibration sequence */ - UINT32 ACConstraint:1; /*feedback request */ - UINT32 RDG:1; /*RDG / More PPDU */ + u32 MA:1; /*management action payload exist in (QoS Null+HTC) */ + u32 TRQ:1; /*sounding request */ + u32 MRQ:1; /*MCS feedback. Request for a MCS feedback */ + u32 MRSorASI:3; /* MRQ Sequence identifier. unchanged during entire procedure. 0x000-0x110. */ + u32 MFS:3; /*SET to the received value of MRS. 0x111 for unsolicited MFB. */ + u32 MFBorASC:7; /*Link adaptation feedback containing recommended MCS. 0x7f for no feedback or not available */ + u32 CalPos:2; /* calibration position */ + u32 CalSeq:2; /*calibration sequence */ + u32 FBKReq:2; /*feedback request */ + u32 CSISTEERING:2; /*CSI/ STEERING */ + u32 ZLFAnnouce:1; /* ZLF announcement */ + u32 rsv:5; /*calibration sequence */ + u32 ACConstraint:1; /*feedback request */ + u32 RDG:1; /*RDG / More PPDU */ } HT_CONTROL, *PHT_CONTROL; /* 2-byte QOS CONTROL field */ typedef struct PACKED { - USHORT TID:4; - USHORT EOSP:1; - USHORT AckPolicy:2; /*0: normal ACK 1:No ACK 2:scheduled under MTBA/PSMP 3: BA */ - USHORT AMsduPresent:1; - USHORT Txop_QueueSize:8; + u16 TID:4; + u16 EOSP:1; + u16 AckPolicy:2; /*0: normal ACK 1:No ACK 2:scheduled under MTBA/PSMP 3: BA */ + u16 AMsduPresent:1; + u16 Txop_QueueSize:8; } QOS_CONTROL, *PQOS_CONTROL; /* 2-byte Frame control field */ typedef struct PACKED { - USHORT Ver:2; /* Protocol version */ - USHORT Type:2; /* MSDU type */ - USHORT SubType:4; /* MSDU subtype */ - USHORT ToDs:1; /* To DS indication */ - USHORT FrDs:1; /* From DS indication */ - USHORT MoreFrag:1; /* More fragment bit */ - USHORT Retry:1; /* Retry status bit */ - USHORT PwrMgmt:1; /* Power management bit */ - USHORT MoreData:1; /* More data bit */ - USHORT Wep:1; /* Wep data */ - USHORT Order:1; /* Strict order expected */ + u16 Ver:2; /* Protocol version */ + u16 Type:2; /* MSDU type */ + u16 SubType:4; /* MSDU subtype */ + u16 ToDs:1; /* To DS indication */ + u16 FrDs:1; /* From DS indication */ + u16 MoreFrag:1; /* More fragment bit */ + u16 Retry:1; /* Retry status bit */ + u16 PwrMgmt:1; /* Power management bit */ + u16 MoreData:1; /* More data bit */ + u16 Wep:1; /* Wep data */ + u16 Order:1; /* Strict order expected */ } FRAME_CONTROL, *PFRAME_CONTROL; typedef struct PACKED _HEADER_802_11 { FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; - UCHAR Addr3[MAC_ADDR_LEN]; - USHORT Frag:4; - USHORT Sequence:12; - UCHAR Octet[0]; + u16 Duration; + u8 Addr1[MAC_ADDR_LEN]; + u8 Addr2[MAC_ADDR_LEN]; + u8 Addr3[MAC_ADDR_LEN]; + u16 Frag:4; + u16 Sequence:12; + u8 Octet[0]; } HEADER_802_11, *PHEADER_802_11; typedef struct PACKED _PSPOLL_FRAME { FRAME_CONTROL FC; - USHORT Aid; - UCHAR Bssid[MAC_ADDR_LEN]; - UCHAR Ta[MAC_ADDR_LEN]; + u16 Aid; + u8 Bssid[MAC_ADDR_LEN]; + u8 Ta[MAC_ADDR_LEN]; } PSPOLL_FRAME, *PPSPOLL_FRAME; typedef struct PACKED _RTS_FRAME { FRAME_CONTROL FC; - USHORT Duration; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; + u16 Duration; + u8 Addr1[MAC_ADDR_LEN]; + u8 Addr2[MAC_ADDR_LEN]; } RTS_FRAME, *PRTS_FRAME; #endif /* __DOT11_BASE_H__ // */ diff --git a/drivers/staging/rt2860/rtmp_iface.h b/drivers/staging/rt2860/rtmp_iface.h index 84b08a05d84a..cafb618adf70 100644 --- a/drivers/staging/rt2860/rtmp_iface.h +++ b/drivers/staging/rt2860/rtmp_iface.h @@ -50,8 +50,8 @@ typedef struct _INF_PCI_CONFIG_ { } INF_PCI_CONFIG; typedef struct _INF_USB_CONFIG_ { - UINT8 BulkInEpAddr; /* bulk-in endpoint address */ - UINT8 BulkOutEpAddr[6]; /* bulk-out endpoint address */ + u8 BulkInEpAddr; /* bulk-in endpoint address */ + u8 BulkOutEpAddr[6]; /* bulk-out endpoint address */ } INF_USB_CONFIG; typedef struct _INF_RBUS_CONFIG_ { diff --git a/drivers/staging/rt2860/rtmp_mcu.h b/drivers/staging/rt2860/rtmp_mcu.h index 1c317001b9ae..378f01ecc282 100644 --- a/drivers/staging/rt2860/rtmp_mcu.h +++ b/drivers/staging/rt2860/rtmp_mcu.h @@ -38,12 +38,12 @@ #ifndef __RTMP_MCU_H__ #define __RTMP_MCU_H__ -INT RtmpAsicEraseFirmware(IN PRTMP_ADAPTER pAd); +int RtmpAsicEraseFirmware(IN PRTMP_ADAPTER pAd); -NDIS_STATUS RtmpAsicLoadFirmware(IN PRTMP_ADAPTER pAd); +int RtmpAsicLoadFirmware(IN PRTMP_ADAPTER pAd); -INT RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, - IN UCHAR Command, - IN UCHAR Token, IN UCHAR Arg0, IN UCHAR Arg1); +int RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, + u8 Command, + u8 Token, u8 Arg0, u8 Arg1); #endif /* __RTMP_MCU_H__ // */ diff --git a/drivers/staging/rt2860/rtmp_timer.h b/drivers/staging/rt2860/rtmp_timer.h index e1365765cd7a..441571dbaff4 100644 --- a/drivers/staging/rt2860/rtmp_timer.h +++ b/drivers/staging/rt2860/rtmp_timer.h @@ -55,10 +55,10 @@ /* submit to ctrl pipe). So we need a wrapper function to take care it. */ #ifdef RTMP_TIMER_TASK_SUPPORT -typedef VOID(*RTMP_TIMER_TASK_HANDLE) (IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); +typedef void(*RTMP_TIMER_TASK_HANDLE) (void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, + void *SystemSpecific3); #endif /* RTMP_TIMER_TASK_SUPPORT // */ typedef struct _RALINK_TIMER_STRUCT { @@ -67,8 +67,8 @@ typedef struct _RALINK_TIMER_STRUCT { BOOLEAN State; /* True if timer cancelled */ BOOLEAN PeriodicType; /* True if timer is periodic timer */ BOOLEAN Repeat; /* True if periodic timer */ - ULONG TimerValue; /* Timer value in milliseconds */ - ULONG cookie; /* os specific object */ + unsigned long TimerValue; /* Timer value in milliseconds */ + unsigned long cookie; /* os specific object */ #ifdef RTMP_TIMER_TASK_SUPPORT RTMP_TIMER_TASK_HANDLE handle; void *pAd; @@ -109,7 +109,7 @@ void rtmp_timer_##_func(unsigned long data) \ { \ PRALINK_TIMER_STRUCT pTimer = (PRALINK_TIMER_STRUCT) data; \ \ - _func(NULL, (PVOID) pTimer->cookie, NULL, pTimer); \ + _func(NULL, (void *)pTimer->cookie, NULL, pTimer); \ if (pTimer->Repeat) \ RTMP_OS_Add_Timer(&pTimer->TimerObj, pTimer->TimerValue); \ } diff --git a/drivers/staging/rt2860/rtmp_type.h b/drivers/staging/rt2860/rtmp_type.h index 11e3591cf76f..8de142840d39 100644 --- a/drivers/staging/rt2860/rtmp_type.h +++ b/drivers/staging/rt2860/rtmp_type.h @@ -38,100 +38,51 @@ #ifndef __RTMP_TYPE_H__ #define __RTMP_TYPE_H__ -#define PACKED __attribute__ ((packed)) - -#ifdef LINUX -/* Put platform dependent declaration here */ -/* For example, linux type definition */ -typedef unsigned char UINT8; -typedef unsigned short UINT16; -typedef unsigned int UINT32; -typedef unsigned long long UINT64; -typedef int INT32; -typedef long long INT64; -#endif /* LINUX // */ - -typedef unsigned char *PUINT8; -typedef unsigned short *PUINT16; -typedef unsigned int *PUINT32; -typedef unsigned long long *PUINT64; -typedef int *PINT32; -typedef long long *PINT64; - -/* modified for fixing compile warning on Sigma 8634 platform */ -typedef char STRING; -typedef signed char CHAR; - -typedef signed short SHORT; -typedef signed int INT; -typedef signed long LONG; -typedef signed long long LONGLONG; +#include -#ifdef LINUX -typedef unsigned char UCHAR; -typedef unsigned short USHORT; -typedef unsigned int UINT; -typedef unsigned long ULONG; -#endif /* LINUX // */ -typedef unsigned long long ULONGLONG; +#define PACKED __attribute__ ((packed)) typedef unsigned char BOOLEAN; -#ifdef LINUX -typedef void VOID; -#endif /* LINUX // */ - -typedef char *PSTRING; -typedef VOID *PVOID; -typedef CHAR *PCHAR; -typedef UCHAR *PUCHAR; -typedef USHORT *PUSHORT; -typedef LONG *PLONG; -typedef ULONG *PULONG; -typedef UINT *PUINT; - -typedef unsigned int NDIS_MEDIA_STATE; typedef union _LARGE_INTEGER { struct { - UINT LowPart; - INT32 HighPart; + u32 LowPart; + int HighPart; } u; - INT64 QuadPart; + long long QuadPart; } LARGE_INTEGER; /* */ /* Register set pair for initialzation register set definition */ /* */ typedef struct _RTMP_REG_PAIR { - ULONG Register; - ULONG Value; + unsigned long Register; + unsigned long Value; } RTMP_REG_PAIR, *PRTMP_REG_PAIR; typedef struct _REG_PAIR { - UCHAR Register; - UCHAR Value; + u8 Register; + u8 Value; } REG_PAIR, *PREG_PAIR; /* */ /* Register set pair for initialzation register set definition */ /* */ typedef struct _RTMP_RF_REGS { - UCHAR Channel; - ULONG R1; - ULONG R2; - ULONG R3; - ULONG R4; + u8 Channel; + unsigned long R1; + unsigned long R2; + unsigned long R3; + unsigned long R4; } RTMP_RF_REGS, *PRTMP_RF_REGS; typedef struct _FREQUENCY_ITEM { - UCHAR Channel; - UCHAR N; - UCHAR R; - UCHAR K; + u8 Channel; + u8 N; + u8 R; + u8 K; } FREQUENCY_ITEM, *PFREQUENCY_ITEM; -typedef int NTSTATUS; - #define STATUS_SUCCESS 0x00 #define STATUS_UNSUCCESSFUL 0x01 diff --git a/drivers/staging/rt2860/rtusb_io.h b/drivers/staging/rt2860/rtusb_io.h index ec1ffbab3690..547f6ab4ef32 100644 --- a/drivers/staging/rt2860/rtusb_io.h +++ b/drivers/staging/rt2860/rtusb_io.h @@ -79,25 +79,25 @@ /*CMDTHREAD_VENDOR_EEPROM_READ */ /*CMDTHREAD_VENDOR_EEPROM_WRITE */ typedef struct _CMDHandler_TLV { - USHORT Offset; - USHORT Length; - UCHAR DataFirst; + u16 Offset; + u16 Length; + u8 DataFirst; } CMDHandler_TLV, *PCMDHandler_TLV; typedef struct _CmdQElmt { - UINT command; - PVOID buffer; - ULONG bufferlength; + u32 command; + void *buffer; + unsigned long bufferlength; BOOLEAN CmdFromNdis; BOOLEAN SetOperation; struct _CmdQElmt *next; } CmdQElmt, *PCmdQElmt; typedef struct _CmdQ { - UINT size; + u32 size; CmdQElmt *head; CmdQElmt *tail; - UINT32 CmdQState; + u32 CmdQState; } CmdQ, *PCmdQ; #define EnqueueCmd(cmdq, cmdqelmt) \ diff --git a/drivers/staging/rt2860/spectrum.h b/drivers/staging/rt2860/spectrum.h index b1e3ba0917d1..b4e9fbc2fd81 100644 --- a/drivers/staging/rt2860/spectrum.h +++ b/drivers/staging/rt2860/spectrum.h @@ -31,7 +31,7 @@ #include "rtmp_type.h" #include "spectrum_def.h" -CHAR RTMP_GetTxPwr(IN PRTMP_ADAPTER pAd, IN HTTRANSMIT_SETTING HTTxMode); +char RTMP_GetTxPwr(IN PRTMP_ADAPTER pAd, IN HTTRANSMIT_SETTING HTTxMode); /* ========================================================================== @@ -45,16 +45,16 @@ CHAR RTMP_GetTxPwr(IN PRTMP_ADAPTER pAd, IN HTTRANSMIT_SETTING HTTxMode); Return : None. ========================================================================== */ -VOID MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd, - OUT PUCHAR pOutBuffer, - OUT PULONG pFrameLen, - IN UINT8 TotalLen, - IN UINT8 Category, - IN UINT8 Action, - IN UINT8 MeasureToken, - IN UINT8 MeasureReqMode, - IN UINT8 MeasureReqType, - IN UINT8 NumOfRepetitions); +void MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd, + u8 *pOutBuffer, + unsigned long *pFrameLen, + u8 TotalLen, + u8 Category, + u8 Action, + u8 MeasureToken, + u8 MeasureReqMode, + u8 MeasureReqType, + u8 NumOfRepetitions); /* ========================================================================== @@ -68,13 +68,13 @@ VOID MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -VOID EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UINT8 DialogToken, - IN UINT8 MeasureToken, - IN UINT8 MeasureReqMode, - IN UINT8 MeasureReqType, - IN UINT8 ReportInfoLen, IN PUINT8 pReportInfo); +void EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd, + u8 *pDA, + u8 DialogToken, + u8 MeasureToken, + u8 MeasureReqMode, + u8 MeasureReqType, + u8 ReportInfoLen, u8 *pReportInfo); /* ========================================================================== @@ -88,7 +88,7 @@ VOID EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -VOID EnqueueTPCReq(IN PRTMP_ADAPTER pAd, IN PUCHAR pDA, IN UCHAR DialogToken); +void EnqueueTPCReq(IN PRTMP_ADAPTER pAd, u8 *pDA, u8 DialogToken); /* ========================================================================== @@ -102,9 +102,9 @@ VOID EnqueueTPCReq(IN PRTMP_ADAPTER pAd, IN PUCHAR pDA, IN UCHAR DialogToken); Return : None. ========================================================================== */ -VOID EnqueueTPCRep(IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, - IN UINT8 DialogToken, IN UINT8 TxPwr, IN UINT8 LinkMargin); +void EnqueueTPCRep(IN PRTMP_ADAPTER pAd, + u8 *pDA, + u8 DialogToken, u8 TxPwr, u8 LinkMargin); /* ========================================================================== @@ -120,8 +120,8 @@ VOID EnqueueTPCRep(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -VOID EnqueueChSwAnn(IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, IN UINT8 ChSwMode, IN UINT8 NewCh); +void EnqueueChSwAnn(IN PRTMP_ADAPTER pAd, + u8 *pDA, u8 ChSwMode, u8 NewCh); /* ========================================================================== @@ -135,7 +135,7 @@ VOID EnqueueChSwAnn(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -VOID PeerSpectrumAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerSpectrumAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); /* ========================================================================== @@ -146,44 +146,44 @@ VOID PeerSpectrumAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); Return : None. ========================================================================== */ -INT Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg); +int Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, char *arg); -INT Set_TpcReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg); +int Set_TpcReq_Proc(IN PRTMP_ADAPTER pAd, char *arg); -INT Set_PwrConstraint(IN PRTMP_ADAPTER pAd, IN PSTRING arg); +int Set_PwrConstraint(IN PRTMP_ADAPTER pAd, char *arg); -VOID MeasureReqTabInit(IN PRTMP_ADAPTER pAd); +void MeasureReqTabInit(IN PRTMP_ADAPTER pAd); -VOID MeasureReqTabExit(IN PRTMP_ADAPTER pAd); +void MeasureReqTabExit(IN PRTMP_ADAPTER pAd); -PMEASURE_REQ_ENTRY MeasureReqLookUp(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken); +PMEASURE_REQ_ENTRY MeasureReqLookUp(IN PRTMP_ADAPTER pAd, u8 DialogToken); -PMEASURE_REQ_ENTRY MeasureReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken); +PMEASURE_REQ_ENTRY MeasureReqInsert(IN PRTMP_ADAPTER pAd, u8 DialogToken); -VOID MeasureReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken); +void MeasureReqDelete(IN PRTMP_ADAPTER pAd, u8 DialogToken); -VOID InsertChannelRepIE(IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN PSTRING pCountry, IN UINT8 RegulatoryClass); +void InsertChannelRepIE(IN PRTMP_ADAPTER pAd, + u8 *pFrameBuf, + unsigned long *pFrameLen, + char *pCountry, u8 RegulatoryClass); -VOID InsertTpcReportIE(IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN UINT8 TxPwr, IN UINT8 LinkMargin); +void InsertTpcReportIE(IN PRTMP_ADAPTER pAd, + u8 *pFrameBuf, + unsigned long *pFrameLen, + u8 TxPwr, u8 LinkMargin); -VOID InsertDialogToken(IN PRTMP_ADAPTER pAd, - OUT PUCHAR pFrameBuf, - OUT PULONG pFrameLen, IN UINT8 DialogToken); +void InsertDialogToken(IN PRTMP_ADAPTER pAd, + u8 *pFrameBuf, + unsigned long *pFrameLen, u8 DialogToken); -VOID TpcReqTabInit(IN PRTMP_ADAPTER pAd); +void TpcReqTabInit(IN PRTMP_ADAPTER pAd); -VOID TpcReqTabExit(IN PRTMP_ADAPTER pAd); +void TpcReqTabExit(IN PRTMP_ADAPTER pAd); -VOID NotifyChSwAnnToPeerAPs(IN PRTMP_ADAPTER pAd, - IN PUCHAR pRA, - IN PUCHAR pTA, IN UINT8 ChSwMode, IN UINT8 Channel); +void NotifyChSwAnnToPeerAPs(IN PRTMP_ADAPTER pAd, + u8 *pRA, + u8 *pTA, u8 ChSwMode, u8 Channel); -VOID RguClass_BuildBcnChList(IN PRTMP_ADAPTER pAd, - OUT PUCHAR pBuf, OUT PULONG pBufLen); +void RguClass_BuildBcnChList(IN PRTMP_ADAPTER pAd, + u8 *pBuf, unsigned long *pBufLen); #endif /* __SPECTRUM_H__ // */ diff --git a/drivers/staging/rt2860/spectrum_def.h b/drivers/staging/rt2860/spectrum_def.h index d100c3188bb7..30678b93fb83 100644 --- a/drivers/staging/rt2860/spectrum_def.h +++ b/drivers/staging/rt2860/spectrum_def.h @@ -55,40 +55,40 @@ typedef struct _MEASURE_REQ_ENTRY { struct _MEASURE_REQ_ENTRY *pNext; - ULONG lastTime; + unsigned long lastTime; BOOLEAN Valid; - UINT8 DialogToken; - UINT8 MeasureDialogToken[3]; /* 0:basic measure, 1: CCA measure, 2: RPI_Histogram measure. */ + u8 DialogToken; + u8 MeasureDialogToken[3]; /* 0:basic measure, 1: CCA measure, 2: RPI_Histogram measure. */ } MEASURE_REQ_ENTRY, *PMEASURE_REQ_ENTRY; typedef struct _MEASURE_REQ_TAB { - UCHAR Size; + u8 Size; PMEASURE_REQ_ENTRY Hash[MAX_HASH_MEASURE_REQ_TAB_SIZE]; MEASURE_REQ_ENTRY Content[MAX_MEASURE_REQ_TAB_SIZE]; } MEASURE_REQ_TAB, *PMEASURE_REQ_TAB; typedef struct _TPC_REQ_ENTRY { struct _TPC_REQ_ENTRY *pNext; - ULONG lastTime; + unsigned long lastTime; BOOLEAN Valid; - UINT8 DialogToken; + u8 DialogToken; } TPC_REQ_ENTRY, *PTPC_REQ_ENTRY; typedef struct _TPC_REQ_TAB { - UCHAR Size; + u8 Size; PTPC_REQ_ENTRY Hash[MAX_HASH_TPC_REQ_TAB_SIZE]; TPC_REQ_ENTRY Content[MAX_TPC_REQ_TAB_SIZE]; } TPC_REQ_TAB, *PTPC_REQ_TAB; /* The regulatory information */ typedef struct _DOT11_CHANNEL_SET { - UCHAR NumberOfChannels; - UINT8 MaxTxPwr; - UCHAR ChannelList[16]; + u8 NumberOfChannels; + u8 MaxTxPwr; + u8 ChannelList[16]; } DOT11_CHANNEL_SET, *PDOT11_CHANNEL_SET; typedef struct _DOT11_REGULATORY_INFORMATION { - UCHAR RegulatoryClass; + u8 RegulatoryClass; DOT11_CHANNEL_SET ChannelSet; } DOT11_REGULATORY_INFORMATION, *PDOT11_REGULATORY_INFORMATION; @@ -102,97 +102,97 @@ typedef struct _DOT11_REGULATORY_INFORMATION { #define RM_NOISE_HISTOGRAM 4 typedef struct PACKED _TPC_REPORT_INFO { - UINT8 TxPwr; - UINT8 LinkMargin; + u8 TxPwr; + u8 LinkMargin; } TPC_REPORT_INFO, *PTPC_REPORT_INFO; typedef struct PACKED _CH_SW_ANN_INFO { - UINT8 ChSwMode; - UINT8 Channel; - UINT8 ChSwCnt; + u8 ChSwMode; + u8 Channel; + u8 ChSwCnt; } CH_SW_ANN_INFO, *PCH_SW_ANN_INFO; typedef union PACKED _MEASURE_REQ_MODE { struct PACKED { - UINT8 Parallel:1; - UINT8 Enable:1; - UINT8 Request:1; - UINT8 Report:1; - UINT8 DurationMandatory:1; - UINT8:3; + u8 Parallel:1; + u8 Enable:1; + u8 Request:1; + u8 Report:1; + u8 DurationMandatory:1; + u8:3; } field; - UINT8 word; + u8 word; } MEASURE_REQ_MODE, *PMEASURE_REQ_MODE; typedef struct PACKED _MEASURE_REQ { - UINT8 ChNum; - UINT64 MeasureStartTime; - UINT16 MeasureDuration; + u8 ChNum; + u64 MeasureStartTime; + u16 MeasureDuration; } MEASURE_REQ, *PMEASURE_REQ; typedef struct PACKED _MEASURE_REQ_INFO { - UINT8 Token; + u8 Token; MEASURE_REQ_MODE ReqMode; - UINT8 ReqType; - UINT8 Oct[0]; + u8 ReqType; + u8 Oct[0]; } MEASURE_REQ_INFO, *PMEASURE_REQ_INFO; typedef union PACKED _MEASURE_BASIC_REPORT_MAP { struct PACKED { - UINT8 BSS:1; + u8 BSS:1; - UINT8 OfdmPreamble:1; - UINT8 UnidentifiedSignal:1; - UINT8 Radar:1; - UINT8 Unmeasure:1; - UINT8 Rev:3; + u8 OfdmPreamble:1; + u8 UnidentifiedSignal:1; + u8 Radar:1; + u8 Unmeasure:1; + u8 Rev:3; } field; - UINT8 word; + u8 word; } MEASURE_BASIC_REPORT_MAP, *PMEASURE_BASIC_REPORT_MAP; typedef struct PACKED _MEASURE_BASIC_REPORT { - UINT8 ChNum; - UINT64 MeasureStartTime; - UINT16 MeasureDuration; + u8 ChNum; + u64 MeasureStartTime; + u16 MeasureDuration; MEASURE_BASIC_REPORT_MAP Map; } MEASURE_BASIC_REPORT, *PMEASURE_BASIC_REPORT; typedef struct PACKED _MEASURE_CCA_REPORT { - UINT8 ChNum; - UINT64 MeasureStartTime; - UINT16 MeasureDuration; - UINT8 CCA_Busy_Fraction; + u8 ChNum; + u64 MeasureStartTime; + u16 MeasureDuration; + u8 CCA_Busy_Fraction; } MEASURE_CCA_REPORT, *PMEASURE_CCA_REPORT; typedef struct PACKED _MEASURE_RPI_REPORT { - UINT8 ChNum; - UINT64 MeasureStartTime; - UINT16 MeasureDuration; - UINT8 RPI_Density[8]; + u8 ChNum; + u64 MeasureStartTime; + u16 MeasureDuration; + u8 RPI_Density[8]; } MEASURE_RPI_REPORT, *PMEASURE_RPI_REPORT; typedef union PACKED _MEASURE_REPORT_MODE { struct PACKED { - UINT8 Late:1; - UINT8 Incapable:1; - UINT8 Refused:1; - UINT8 Rev:5; + u8 Late:1; + u8 Incapable:1; + u8 Refused:1; + u8 Rev:5; } field; - UINT8 word; + u8 word; } MEASURE_REPORT_MODE, *PMEASURE_REPORT_MODE; typedef struct PACKED _MEASURE_REPORT_INFO { - UINT8 Token; - UINT8 ReportMode; - UINT8 ReportType; - UINT8 Octect[0]; + u8 Token; + u8 ReportMode; + u8 ReportType; + u8 Octect[0]; } MEASURE_REPORT_INFO, *PMEASURE_REPORT_INFO; typedef struct PACKED _QUIET_INFO { - UINT8 QuietCnt; - UINT8 QuietPeriod; - UINT16 QuietDuration; - UINT16 QuietOffset; + u8 QuietCnt; + u8 QuietPeriod; + u16 QuietDuration; + u16 QuietOffset; } QUIET_INFO, *PQUIET_INFO; #endif /* __SPECTRUM_DEF_H__ // */ diff --git a/drivers/staging/rt2860/sta/assoc.c b/drivers/staging/rt2860/sta/assoc.c index c5a17381fc78..f2192ff16577 100644 --- a/drivers/staging/rt2860/sta/assoc.c +++ b/drivers/staging/rt2860/sta/assoc.c @@ -36,7 +36,7 @@ */ #include "../rt_config.h" -UCHAR CipherWpaTemplate[] = { +u8 CipherWpaTemplate[] = { 0xdd, /* WPA IE */ 0x16, /* Length */ 0x00, 0x50, 0xf2, 0x01, /* oui */ @@ -48,7 +48,7 @@ UCHAR CipherWpaTemplate[] = { 0x00, 0x50, 0xf2, 0x01 /* authentication */ }; -UCHAR CipherWpa2Template[] = { +u8 CipherWpa2Template[] = { 0x30, /* RSN IE */ 0x14, /* Length */ 0x01, 0x00, /* Version */ @@ -60,7 +60,7 @@ UCHAR CipherWpa2Template[] = { 0x00, 0x00, /* RSN capability */ }; -UCHAR Ccx2IeInfo[] = { 0x00, 0x40, 0x96, 0x03, 0x02 }; +u8 Ccx2IeInfo[] = { 0x00, 0x40, 0x96, 0x03, 0x02 }; /* ========================================================================== @@ -73,7 +73,7 @@ UCHAR Ccx2IeInfo[] = { 0x00, 0x40, 0x96, 0x03, 0x02 }; ========================================================================== */ -VOID AssocStateMachineInit(IN PRTMP_ADAPTER pAd, +void AssocStateMachineInit(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * S, OUT STATE_MACHINE_FUNC Trans[]) { StateMachineInit(S, Trans, MAX_ASSOC_STATE, MAX_ASSOC_MSG, @@ -165,9 +165,9 @@ VOID AssocStateMachineInit(IN PRTMP_ADAPTER pAd, ========================================================================== */ -VOID AssocTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) +void AssocTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3) { RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; @@ -193,9 +193,9 @@ VOID AssocTimeout(IN PVOID SystemSpecific1, ========================================================================== */ -VOID ReassocTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) +void ReassocTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3) { RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; @@ -221,9 +221,9 @@ VOID ReassocTimeout(IN PVOID SystemSpecific1, ========================================================================== */ -VOID DisassocTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) +void DisassocTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3) { RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; @@ -259,23 +259,23 @@ VOID DisassocTimeout(IN PVOID SystemSpecific1, ========================================================================== */ -VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR ApAddr[6]; + u8 ApAddr[6]; HEADER_802_11 AssocHdr; - UCHAR WmeIe[9] = + u8 WmeIe[9] = { IE_VENDOR_SPECIFIC, 0x07, 0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00 }; - USHORT ListenIntv; - ULONG Timeout; - USHORT CapabilityInfo; + u16 ListenIntv; + unsigned long Timeout; + u16 CapabilityInfo; BOOLEAN TimerCancelled; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - ULONG tmp; - USHORT VarIesOffset; - USHORT Status; + u8 *pOutBuffer = NULL; + int NStatus; + unsigned long FrameLen = 0; + unsigned long tmp; + u16 VarIesOffset; + u16 Status; /* Block all authentication request durning WPA block period */ if (pAd->StaCfg.bBlockAssoc == TRUE) { @@ -377,9 +377,9 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /* HT */ if ((pAd->MlmeAux.HtCapabilityLen > 0) && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) { - ULONG TmpLen; - UCHAR HtLen; - UCHAR BROADCOM[4] = { 0x0, 0x90, 0x4c, 0x33 }; + unsigned long TmpLen; + u8 HtLen; + u8 BROADCOM[4] = { 0x0, 0x90, 0x4c, 0x33 }; if (pAd->StaActive.SupportedPhyInfo.bPreNHt == TRUE) { HtLen = SIZE_HT_CAP_IE + 4; MakeOutgoingFrame(pOutBuffer + FrameLen, @@ -409,8 +409,8 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if (pAd->CommonCfg.bAggregationCapable) { if ((pAd->CommonCfg.bPiggyBackCapable) && ((pAd->MlmeAux.APRalinkIe & 0x00000003) == 3)) { - ULONG TmpLen; - UCHAR RalinkIe[9] = + unsigned long TmpLen; + u8 RalinkIe[9] = { IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x03, 0x00, 0x00, 0x00 }; MakeOutgoingFrame(pOutBuffer + FrameLen, @@ -418,8 +418,8 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) END_OF_ARGS); FrameLen += TmpLen; } else if (pAd->MlmeAux.APRalinkIe & 0x00000001) { - ULONG TmpLen; - UCHAR RalinkIe[9] = + unsigned long TmpLen; + u8 RalinkIe[9] = { IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x01, 0x00, 0x00, 0x00 }; MakeOutgoingFrame(pOutBuffer + FrameLen, @@ -428,8 +428,8 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) FrameLen += TmpLen; } } else { - ULONG TmpLen; - UCHAR RalinkIe[9] = + unsigned long TmpLen; + u8 RalinkIe[9] = { IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x06, 0x00, 0x00, 0x00 }; MakeOutgoingFrame(pOutBuffer + FrameLen, &TmpLen, 9, @@ -450,7 +450,7 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) QosInfo.UAPSD_AC_VO = pAd->CommonCfg.bAPSDAC_VO; QosInfo.MaxSPLength = pAd->CommonCfg.MaxSPLength; - WmeIe[8] |= *(PUCHAR) & QosInfo; + WmeIe[8] |= *(u8 *)& QosInfo; } else { /* The Parameter Set Count is set to ¡§0¡¨ in the association request frames */ /* WmeIe[8] |= (pAd->MlmeAux.APEdcaParm.EdcaUpdateCount & 0x0f); */ @@ -472,7 +472,7 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) ) ) { - UCHAR RSNIe = IE_WPA; + u8 RSNIe = IE_WPA; if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2PSK) || (pAd->StaCfg.AuthMode == @@ -488,7 +488,7 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /* Check for WPA PMK cache list */ if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA2) { - INT idx; + int idx; BOOLEAN FoundPMK = FALSE; /* Search chched PMKID, append it if existed */ for (idx = 0; idx < PMKID_NO; idx++) { @@ -502,7 +502,7 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } if (FoundPMK) { /* Set PMK number */ - *(PUSHORT) & pAd->StaCfg.RSN_IE[pAd-> + *(u16 *)& pAd->StaCfg.RSN_IE[pAd-> StaCfg. RSNIE_Len] = 1; @@ -589,21 +589,21 @@ VOID MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR ApAddr[6]; + u8 ApAddr[6]; HEADER_802_11 ReassocHdr; - UCHAR WmeIe[9] = + u8 WmeIe[9] = { IE_VENDOR_SPECIFIC, 0x07, 0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00 }; - USHORT CapabilityInfo, ListenIntv; - ULONG Timeout; - ULONG FrameLen = 0; + u16 CapabilityInfo, ListenIntv; + unsigned long Timeout; + unsigned long FrameLen = 0; BOOLEAN TimerCancelled; - NDIS_STATUS NStatus; - ULONG tmp; - PUCHAR pOutBuffer = NULL; - USHORT Status; + int NStatus; + unsigned long tmp; + u8 *pOutBuffer = NULL; + u16 Status; /* Block all authentication request durning WPA block period */ if (pAd->StaCfg.bBlockAssoc == TRUE) { @@ -669,7 +669,7 @@ VOID MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) QosInfo.UAPSD_AC_VO = pAd->CommonCfg.bAPSDAC_VO; QosInfo.MaxSPLength = pAd->CommonCfg.MaxSPLength; - WmeIe[8] |= *(PUCHAR) & QosInfo; + WmeIe[8] |= *(u8 *)& QosInfo; } MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, @@ -679,9 +679,9 @@ VOID MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /* HT */ if ((pAd->MlmeAux.HtCapabilityLen > 0) && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) { - ULONG TmpLen; - UCHAR HtLen; - UCHAR BROADCOM[4] = { 0x0, 0x90, 0x4c, 0x33 }; + unsigned long TmpLen; + u8 HtLen; + u8 BROADCOM[4] = { 0x0, 0x90, 0x4c, 0x33 }; if (pAd->StaActive.SupportedPhyInfo.bPreNHt == TRUE) { HtLen = SIZE_HT_CAP_IE + 4; MakeOutgoingFrame(pOutBuffer + FrameLen, @@ -711,8 +711,8 @@ VOID MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if (pAd->CommonCfg.bAggregationCapable) { if ((pAd->CommonCfg.bPiggyBackCapable) && ((pAd->MlmeAux.APRalinkIe & 0x00000003) == 3)) { - ULONG TmpLen; - UCHAR RalinkIe[9] = + unsigned long TmpLen; + u8 RalinkIe[9] = { IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x03, 0x00, 0x00, 0x00 }; MakeOutgoingFrame(pOutBuffer + FrameLen, @@ -720,8 +720,8 @@ VOID MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) END_OF_ARGS); FrameLen += TmpLen; } else if (pAd->MlmeAux.APRalinkIe & 0x00000001) { - ULONG TmpLen; - UCHAR RalinkIe[9] = + unsigned long TmpLen; + u8 RalinkIe[9] = { IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x01, 0x00, 0x00, 0x00 }; MakeOutgoingFrame(pOutBuffer + FrameLen, @@ -730,8 +730,8 @@ VOID MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) FrameLen += TmpLen; } } else { - ULONG TmpLen; - UCHAR RalinkIe[9] = + unsigned long TmpLen; + u8 RalinkIe[9] = { IE_VENDOR_SPECIFIC, 7, 0x00, 0x0c, 0x43, 0x04, 0x00, 0x00, 0x00 }; MakeOutgoingFrame(pOutBuffer + FrameLen, &TmpLen, 9, @@ -765,17 +765,17 @@ VOID MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID MlmeDisassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeDisassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { PMLME_DISASSOC_REQ_STRUCT pDisassocReq; HEADER_802_11 DisassocHdr; PHEADER_802_11 pDisassocHdr; - PUCHAR pOutBuffer = NULL; - ULONG FrameLen = 0; - NDIS_STATUS NStatus; + u8 *pOutBuffer = NULL; + unsigned long FrameLen = 0; + int NStatus; BOOLEAN TimerCancelled; - ULONG Timeout = 500; - USHORT Status; + unsigned long Timeout = 500; + u16 Status; /* skip sanity check */ pDisassocReq = (PMLME_DISASSOC_REQ_STRUCT) (Elem->Msg); @@ -835,20 +835,20 @@ VOID MlmeDisassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID PeerAssocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerAssocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT CapabilityInfo, Status, Aid; - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], SupRateLen; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRateLen; - UCHAR Addr2[MAC_ADDR_LEN]; + u16 CapabilityInfo, Status, Aid; + u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES], SupRateLen; + u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRateLen; + u8 Addr2[MAC_ADDR_LEN]; BOOLEAN TimerCancelled; - UCHAR CkipFlag; + u8 CkipFlag; EDCA_PARM EdcaParm; HT_CAPABILITY_IE HtCapability; ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ - UCHAR HtCapabilityLen = 0; - UCHAR AddHtInfoLen; - UCHAR NewExtChannelOffset = 0xff; + u8 HtCapabilityLen = 0; + u8 AddHtInfoLen; + u8 NewExtChannelOffset = 0xff; if (PeerAssocRspSanity (pAd, Elem->Msg, Elem->MsgLen, Addr2, &CapabilityInfo, &Status, @@ -870,8 +870,8 @@ VOID PeerAssocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) &TimerCancelled); if (Status == MLME_SUCCESS) { - UCHAR MaxSupportedRateIn500Kbps = 0; - UCHAR idx; + u8 MaxSupportedRateIn500Kbps = 0; + u8 idx; /* supported rates array may not be sorted. sort it and find the maximum rate */ for (idx = 0; idx < SupRateLen; idx++) { @@ -924,22 +924,22 @@ VOID PeerAssocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID PeerReassocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerReassocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT CapabilityInfo; - USHORT Status; - USHORT Aid; - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], SupRateLen; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRateLen; - UCHAR Addr2[MAC_ADDR_LEN]; - UCHAR CkipFlag; + u16 CapabilityInfo; + u16 Status; + u16 Aid; + u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES], SupRateLen; + u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRateLen; + u8 Addr2[MAC_ADDR_LEN]; + u8 CkipFlag; BOOLEAN TimerCancelled; EDCA_PARM EdcaParm; HT_CAPABILITY_IE HtCapability; ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ - UCHAR HtCapabilityLen; - UCHAR AddHtInfoLen; - UCHAR NewExtChannelOffset = 0xff; + u8 HtCapabilityLen; + u8 AddHtInfoLen; + u8 NewExtChannelOffset = 0xff; if (PeerAssocRspSanity (pAd, Elem->Msg, Elem->MsgLen, Addr2, &CapabilityInfo, &Status, @@ -994,9 +994,9 @@ VOID PeerReassocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID AssocPostProc(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr2, IN USHORT CapabilityInfo, IN USHORT Aid, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN PEDCA_PARM pEdcaParm, IN HT_CAPABILITY_IE * pHtCapability, IN UCHAR HtCapabilityLen, IN ADD_HT_INFO_IE * pAddHtInfo) /* AP might use this additional ht info IE */ +void AssocPostProc(IN PRTMP_ADAPTER pAd, u8 *pAddr2, u16 CapabilityInfo, u16 Aid, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, IN PEDCA_PARM pEdcaParm, IN HT_CAPABILITY_IE * pHtCapability, u8 HtCapabilityLen, IN ADD_HT_INFO_IE * pAddHtInfo) /* AP might use this additional ht info IE */ { - ULONG Idx; + unsigned long Idx; pAd->MlmeAux.BssType = BSS_INFRA; COPY_MAC_ADDR(pAd->MlmeAux.Bssid, pAddr2); @@ -1067,8 +1067,8 @@ VOID AssocPostProc(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr2, IN USHORT CapabilityI /* Store appropriate RSN_IE for WPA SM negotiation later */ if ((pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) && (pAd->ScanTab.BssEntry[Idx].VarIELen != 0)) { - PUCHAR pVIE; - USHORT len; + u8 *pVIE; + u16 len; PEID_STRUCT pEid; pVIE = pAd->ScanTab.BssEntry[Idx].VarIEs; @@ -1144,10 +1144,10 @@ VOID AssocPostProc(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr2, IN USHORT CapabilityI ========================================================================== */ -VOID PeerDisassocAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerDisassocAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Addr2[MAC_ADDR_LEN]; - USHORT Reason; + u8 Addr2[MAC_ADDR_LEN]; + u16 Reason; DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - PeerDisassocAction()\n")); if (PeerDisassocSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Reason)) { @@ -1189,9 +1189,9 @@ VOID PeerDisassocAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID AssocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void AssocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Status; + u16 Status; DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - AssocTimeoutAction\n")); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; Status = MLME_REJ_TIMEOUT; @@ -1207,9 +1207,9 @@ VOID AssocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID ReassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void ReassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Status; + u16 Status; DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - ReassocTimeoutAction\n")); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; Status = MLME_REJ_TIMEOUT; @@ -1225,9 +1225,9 @@ VOID ReassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID DisassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void DisassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Status; + u16 Status; DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - DisassocTimeoutAction\n")); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; Status = MLME_SUCCESS; @@ -1235,9 +1235,9 @@ VOID DisassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) &Status); } -VOID InvalidStateWhenAssoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void InvalidStateWhenAssoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Status; + u16 Status; DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - InvalidStateWhenAssoc(state=%ld), reset ASSOC state machine\n", pAd->Mlme.AssocMachine.CurrState)); @@ -1246,9 +1246,9 @@ VOID InvalidStateWhenAssoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_ASSOC_CONF, 2, &Status); } -VOID InvalidStateWhenReassoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void InvalidStateWhenReassoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Status; + u16 Status; DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - InvalidStateWhenReassoc(state=%ld), reset ASSOC state machine\n", pAd->Mlme.AssocMachine.CurrState)); @@ -1257,10 +1257,10 @@ VOID InvalidStateWhenReassoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, &Status); } -VOID InvalidStateWhenDisassociate(IN PRTMP_ADAPTER pAd, +void InvalidStateWhenDisassociate(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Status; + u16 Status; DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - InvalidStateWhenDisassoc(state=%ld), reset ASSOC state machine\n", pAd->Mlme.AssocMachine.CurrState)); @@ -1283,14 +1283,14 @@ VOID InvalidStateWhenDisassociate(IN PRTMP_ADAPTER pAd, ========================================================================== */ -VOID Cls3errAction(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr) +void Cls3errAction(IN PRTMP_ADAPTER pAd, u8 *pAddr) { HEADER_802_11 DisassocHdr; PHEADER_802_11 pDisassocHdr; - PUCHAR pOutBuffer = NULL; - ULONG FrameLen = 0; - NDIS_STATUS NStatus; - USHORT Reason = REASON_CLS3ERR; + u8 *pOutBuffer = NULL; + unsigned long FrameLen = 0; + int NStatus; + u16 Reason = REASON_CLS3ERR; NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) @@ -1336,13 +1336,13 @@ int wext_notify_event_assoc(IN RTMP_ADAPTER * pAd) BOOLEAN StaAddMacTableEntry(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, - IN UCHAR MaxSupportedRateIn500Kbps, + u8 MaxSupportedRateIn500Kbps, IN HT_CAPABILITY_IE * pHtCapability, - IN UCHAR HtCapabilityLen, + u8 HtCapabilityLen, IN ADD_HT_INFO_IE * pAddHtInfo, - IN UCHAR AddHtInfoLen, IN USHORT CapabilityInfo) + u8 AddHtInfoLen, u16 CapabilityInfo) { - UCHAR MaxSupportedRate = RATE_11; + u8 MaxSupportedRate = RATE_11; if (ADHOC_ON(pAd)) CLIENT_STATUS_CLEAR_FLAG(pEntry, fCLIENT_STATUS_WMM_CAPABLE); @@ -1448,8 +1448,8 @@ BOOLEAN StaAddMacTableEntry(IN PRTMP_ADAPTER pAd, /* If this Entry supports 802.11n, upgrade to HT rate. */ if ((HtCapabilityLen != 0) && (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) { - UCHAR j, bitmask; /*k,bitmask; */ - CHAR i; + u8 j, bitmask; /*k,bitmask; */ + char i; if (ADHOC_ON(pAd)) CLIENT_STATUS_SET_FLAG(pEntry, @@ -1526,8 +1526,8 @@ BOOLEAN StaAddMacTableEntry(IN PRTMP_ADAPTER pAd, pEntry->MpduDensity = pHtCapability->HtCapParm.MpduDensity; pEntry->MaxRAmpduFactor = pHtCapability->HtCapParm.MaxRAmpduFactor; - pEntry->MmpsMode = (UCHAR) pHtCapability->HtCapInfo.MimoPs; - pEntry->AMsduSize = (UCHAR) pHtCapability->HtCapInfo.AMsduSize; + pEntry->MmpsMode = (u8)pHtCapability->HtCapInfo.MimoPs; + pEntry->AMsduSize = (u8)pHtCapability->HtCapInfo.AMsduSize; pEntry->HTPhyMode.word = pEntry->MaxHTPhyMode.word; if (pAd->CommonCfg.DesiredHtPhy.AmsduEnable @@ -1567,8 +1567,8 @@ BOOLEAN StaAddMacTableEntry(IN PRTMP_ADAPTER pAd, /* Set asic auto fall back */ if (pAd->StaCfg.bAutoTxRateSwitch == TRUE) { - PUCHAR pTable; - UCHAR TableSize = 0; + u8 *pTable; + u8 TableSize = 0; MlmeSelectTxRateTable(pAd, pEntry, &pTable, &TableSize, &pEntry->CurrTxRateIndex); @@ -1579,7 +1579,7 @@ BOOLEAN StaAddMacTableEntry(IN PRTMP_ADAPTER pAd, pEntry->bAutoTxRateSwitch = FALSE; /* If the legacy mode is set, overwrite the transmit setting of this entry. */ - RTMPUpdateLegacyTxSetting((UCHAR) pAd->StaCfg. + RTMPUpdateLegacyTxSetting((u8)pAd->StaCfg. DesiredTransmitSetting.field. FixedTxMode, pEntry); } diff --git a/drivers/staging/rt2860/sta/auth.c b/drivers/staging/rt2860/sta/auth.c index a69b6a7f03e2..ddb357ac041c 100644 --- a/drivers/staging/rt2860/sta/auth.c +++ b/drivers/staging/rt2860/sta/auth.c @@ -95,9 +95,9 @@ void AuthStateMachineInit(IN PRTMP_ADAPTER pAd, ========================================================================== */ -VOID AuthTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) +void AuthTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3) { RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; @@ -125,13 +125,13 @@ VOID AuthTimeout(IN PVOID SystemSpecific1, ========================================================================== */ -VOID MlmeAuthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeAuthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { if (AUTH_ReqSend (pAd, Elem, &pAd->MlmeAux.AuthTimer, "AUTH", 1, NULL, 0)) pAd->Mlme.AuthMachine.CurrState = AUTH_WAIT_SEQ2; else { - USHORT Status; + u16 Status; pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; Status = MLME_INVALID_FORMAT; @@ -148,23 +148,23 @@ VOID MlmeAuthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID PeerAuthRspAtSeq2Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerAuthRspAtSeq2Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Addr2[MAC_ADDR_LEN]; - USHORT Seq, Status, RemoteStatus, Alg; - UCHAR ChlgText[CIPHER_TEXT_LEN]; - UCHAR CyperChlgText[CIPHER_TEXT_LEN + 8 + 8]; - UCHAR Element[2]; + u8 Addr2[MAC_ADDR_LEN]; + u16 Seq, Status, RemoteStatus, Alg; + u8 ChlgText[CIPHER_TEXT_LEN]; + u8 CyperChlgText[CIPHER_TEXT_LEN + 8 + 8]; + u8 Element[2]; HEADER_802_11 AuthHdr; BOOLEAN TimerCancelled; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - USHORT Status2; + u8 *pOutBuffer = NULL; + int NStatus; + unsigned long FrameLen = 0; + u16 Status2; if (PeerAuthSanity (pAd, Elem->Msg, Elem->MsgLen, Addr2, &Alg, &Seq, &Status, - (PCHAR) ChlgText)) { + (char *)ChlgText)) { if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, Addr2) && Seq == 2) { DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Receive AUTH_RSP seq#2 to me (Alg=%d, Status=%d)\n", @@ -224,18 +224,18 @@ VOID PeerAuthRspAtSeq2Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) KeyLen, CyperChlgText); - Alg = cpu2le16(*(USHORT *) & Alg); - Seq = cpu2le16(*(USHORT *) & Seq); + Alg = cpu2le16(*(u16 *) & Alg); + Seq = cpu2le16(*(u16 *) & Seq); RemoteStatus = - cpu2le16(*(USHORT *) & + cpu2le16(*(u16 *) & RemoteStatus); - RTMPEncryptData(pAd, (PUCHAR) & Alg, + RTMPEncryptData(pAd, (u8 *)& Alg, CyperChlgText + 4, 2); - RTMPEncryptData(pAd, (PUCHAR) & Seq, + RTMPEncryptData(pAd, (u8 *)& Seq, CyperChlgText + 6, 2); RTMPEncryptData(pAd, - (PUCHAR) & RemoteStatus, + (u8 *)& RemoteStatus, CyperChlgText + 8, 2); Element[0] = 16; Element[1] = 128; @@ -282,11 +282,11 @@ VOID PeerAuthRspAtSeq2Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID PeerAuthRspAtSeq4Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerAuthRspAtSeq4Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Addr2[MAC_ADDR_LEN]; - USHORT Alg, Seq, Status; - CHAR ChlgText[CIPHER_TEXT_LEN]; + u8 Addr2[MAC_ADDR_LEN]; + u16 Alg, Seq, Status; + char ChlgText[CIPHER_TEXT_LEN]; BOOLEAN TimerCancelled; if (PeerAuthSanity @@ -321,14 +321,14 @@ VOID PeerAuthRspAtSeq4Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID MlmeDeauthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeDeauthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { MLME_DEAUTH_REQ_STRUCT *pInfo; HEADER_802_11 DeauthHdr; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - USHORT Status; + u8 *pOutBuffer = NULL; + int NStatus; + unsigned long FrameLen = 0; + u16 Status; pInfo = (MLME_DEAUTH_REQ_STRUCT *) Elem->Msg; @@ -374,9 +374,9 @@ VOID MlmeDeauthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID AuthTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void AuthTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Status; + u16 Status; DBGPRINT(RT_DEBUG_TRACE, ("AUTH - AuthTimeoutAction\n")); pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE; Status = MLME_REJ_TIMEOUT; @@ -391,9 +391,9 @@ VOID AuthTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID InvalidStateWhenAuth(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void InvalidStateWhenAuth(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Status; + u16 Status; DBGPRINT(RT_DEBUG_TRACE, ("AUTH - InvalidStateWhenAuth (state=%ld), reset AUTH state machine\n", pAd->Mlme.AuthMachine.CurrState)); @@ -414,13 +414,13 @@ VOID InvalidStateWhenAuth(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID Cls2errAction(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr) +void Cls2errAction(IN PRTMP_ADAPTER pAd, u8 *pAddr) { HEADER_802_11 DeauthHdr; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - USHORT Reason = REASON_CLS2ERR; + u8 *pOutBuffer = NULL; + int NStatus; + unsigned long FrameLen = 0; + u16 Reason = REASON_CLS2ERR; NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) @@ -442,18 +442,18 @@ VOID Cls2errAction(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr) BOOLEAN AUTH_ReqSend(IN PRTMP_ADAPTER pAd, IN PMLME_QUEUE_ELEM pElem, IN PRALINK_TIMER_STRUCT pAuthTimer, - IN PSTRING pSMName, - IN USHORT SeqNo, - IN PUCHAR pNewElement, IN ULONG ElementLen) + char *pSMName, + u16 SeqNo, + u8 *pNewElement, unsigned long ElementLen) { - USHORT Alg, Seq, Status; - UCHAR Addr[6]; - ULONG Timeout; + u16 Alg, Seq, Status; + u8 Addr[6]; + unsigned long Timeout; HEADER_802_11 AuthHdr; BOOLEAN TimerCancelled; - NDIS_STATUS NStatus; - PUCHAR pOutBuffer = NULL; - ULONG FrameLen = 0, tmp = 0; + int NStatus; + u8 *pOutBuffer = NULL; + unsigned long FrameLen = 0, tmp = 0; /* Block all authentication request durning WPA block period */ if (pAd->StaCfg.bBlockAssoc == TRUE) { diff --git a/drivers/staging/rt2860/sta/auth_rsp.c b/drivers/staging/rt2860/sta/auth_rsp.c index e3c07a466ed1..d155dc6cdf1d 100644 --- a/drivers/staging/rt2860/sta/auth_rsp.c +++ b/drivers/staging/rt2860/sta/auth_rsp.c @@ -47,7 +47,7 @@ ========================================================================== */ -VOID AuthRspStateMachineInit(IN PRTMP_ADAPTER pAd, +void AuthRspStateMachineInit(IN PRTMP_ADAPTER pAd, IN PSTATE_MACHINE Sm, IN STATE_MACHINE_FUNC Trans[]) { @@ -73,16 +73,16 @@ VOID AuthRspStateMachineInit(IN PRTMP_ADAPTER pAd, ========================================================================== */ -VOID PeerAuthSimpleRspGenAndSend(IN PRTMP_ADAPTER pAd, +void PeerAuthSimpleRspGenAndSend(IN PRTMP_ADAPTER pAd, IN PHEADER_802_11 pHdr80211, - IN USHORT Alg, - IN USHORT Seq, - IN USHORT Reason, IN USHORT Status) + u16 Alg, + u16 Seq, + u16 Reason, u16 Status) { HEADER_802_11 AuthHdr; - ULONG FrameLen = 0; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; + unsigned long FrameLen = 0; + u8 *pOutBuffer = NULL; + int NStatus; if (Reason != MLME_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("Peer AUTH fail...\n")); @@ -110,10 +110,10 @@ VOID PeerAuthSimpleRspGenAndSend(IN PRTMP_ADAPTER pAd, ========================================================================== */ -VOID PeerDeauthAction(IN PRTMP_ADAPTER pAd, IN PMLME_QUEUE_ELEM Elem) +void PeerDeauthAction(IN PRTMP_ADAPTER pAd, IN PMLME_QUEUE_ELEM Elem) { - UCHAR Addr2[MAC_ADDR_LEN]; - USHORT Reason; + u8 Addr2[MAC_ADDR_LEN]; + u16 Reason; if (PeerDeauthSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Reason)) { if (INFRA_ON(pAd) diff --git a/drivers/staging/rt2860/sta/connect.c b/drivers/staging/rt2860/sta/connect.c index 29906be51e58..c11389f89789 100644 --- a/drivers/staging/rt2860/sta/connect.c +++ b/drivers/staging/rt2860/sta/connect.c @@ -36,7 +36,7 @@ */ #include "../rt_config.h" -UCHAR CipherSuiteWpaNoneTkip[] = { +u8 CipherSuiteWpaNoneTkip[] = { 0x00, 0x50, 0xf2, 0x01, /* oui */ 0x01, 0x00, /* Version */ 0x00, 0x50, 0xf2, 0x02, /* Multicast */ @@ -46,10 +46,10 @@ UCHAR CipherSuiteWpaNoneTkip[] = { 0x00, 0x50, 0xf2, 0x00 /* authentication */ }; -UCHAR CipherSuiteWpaNoneTkipLen = - (sizeof(CipherSuiteWpaNoneTkip) / sizeof(UCHAR)); +u8 CipherSuiteWpaNoneTkipLen = + (sizeof(CipherSuiteWpaNoneTkip) / sizeof(u8)); -UCHAR CipherSuiteWpaNoneAes[] = { +u8 CipherSuiteWpaNoneAes[] = { 0x00, 0x50, 0xf2, 0x01, /* oui */ 0x01, 0x00, /* Version */ 0x00, 0x50, 0xf2, 0x04, /* Multicast */ @@ -59,8 +59,8 @@ UCHAR CipherSuiteWpaNoneAes[] = { 0x00, 0x50, 0xf2, 0x00 /* authentication */ }; -UCHAR CipherSuiteWpaNoneAesLen = - (sizeof(CipherSuiteWpaNoneAes) / sizeof(UCHAR)); +u8 CipherSuiteWpaNoneAesLen = + (sizeof(CipherSuiteWpaNoneAes) / sizeof(u8)); /* The following MACRO is called after 1. starting an new IBSS, 2. succesfully JOIN an IBSS, */ /* or 3. succesfully ASSOCIATE to a BSS, 4. successfully RE_ASSOCIATE to a BSS */ @@ -102,7 +102,7 @@ UCHAR CipherSuiteWpaNoneAesLen = ========================================================================== */ -VOID MlmeCntlInit(IN PRTMP_ADAPTER pAd, +void MlmeCntlInit(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * S, OUT STATE_MACHINE_FUNC Trans[]) { /* Control state machine differs from other state machines, the interface */ @@ -118,7 +118,7 @@ VOID MlmeCntlInit(IN PRTMP_ADAPTER pAd, ========================================================================== */ -VOID MlmeCntlMachinePerformAction(IN PRTMP_ADAPTER pAd, +void MlmeCntlMachinePerformAction(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * S, IN MLME_QUEUE_ELEM * Elem) { @@ -204,7 +204,7 @@ VOID MlmeCntlMachinePerformAction(IN PRTMP_ADAPTER pAd, /* Check if we can connect to. */ /* */ BssTableSsidSort(pAd, &pAd->MlmeAux.SsidBssTab, - (CHAR *) pAd->MlmeAux. + (char *) pAd->MlmeAux. AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen); if (pAd->MlmeAux.SsidBssTab.BssNr > 0) { @@ -228,7 +228,7 @@ VOID MlmeCntlMachinePerformAction(IN PRTMP_ADAPTER pAd, ========================================================================== */ -VOID CntlIdleProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlIdleProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { MLME_DISASSOC_REQ_STRUCT DisassocReq; @@ -281,10 +281,10 @@ VOID CntlIdleProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } -VOID CntlOidScanProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlOidScanProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { MLME_SCAN_REQ_STRUCT ScanReq; - ULONG BssIdx = BSS_NOT_FOUND; + unsigned long BssIdx = BSS_NOT_FOUND; BSS_ENTRY CurrBss; /* record current BSS if network is connected. */ @@ -292,7 +292,7 @@ VOID CntlOidScanProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) { BssIdx = BssSsidTableSearch(&pAd->ScanTab, pAd->CommonCfg.Bssid, - (PUCHAR) pAd->CommonCfg.Ssid, + (u8 *)pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen, pAd->CommonCfg.Channel); if (BssIdx != BSS_NOT_FOUND) { @@ -313,7 +313,7 @@ VOID CntlOidScanProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->ScanTab.BssNr = 1; } - ScanParmFill(pAd, &ScanReq, (PSTRING) Elem->Msg, Elem->MsgLen, BSS_ANY, + ScanParmFill(pAd, &ScanReq, (char *)Elem->Msg, Elem->MsgLen, BSS_ANY, SCAN_ACTIVE); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); @@ -329,16 +329,16 @@ VOID CntlOidScanProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { PNDIS_802_11_SSID pOidSsid = (NDIS_802_11_SSID *) Elem->Msg; MLME_DISASSOC_REQ_STRUCT DisassocReq; - ULONG Now; + unsigned long Now; /* Step 1. record the desired user settings to MlmeAux */ NdisZeroMemory(pAd->MlmeAux.Ssid, MAX_LEN_OF_SSID); NdisMoveMemory(pAd->MlmeAux.Ssid, pOidSsid->Ssid, pOidSsid->SsidLength); - pAd->MlmeAux.SsidLen = (UCHAR) pOidSsid->SsidLength; + pAd->MlmeAux.SsidLen = (u8)pOidSsid->SsidLength; NdisZeroMemory(pAd->MlmeAux.Bssid, MAC_ADDR_LEN); pAd->MlmeAux.BssType = pAd->StaCfg.BssType; @@ -355,7 +355,7 @@ VOID CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /* step 2. find all matching BSS in the lastest SCAN result (inBssTab) */ /* & log them into MlmeAux.SsidBssTab for later-on iteration. Sort by RSSI order */ BssTableSsidSort(pAd, &pAd->MlmeAux.SsidBssTab, - (PCHAR) pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); + (char *)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - %d BSS of %d BSS match the desire (%d)SSID - %s\n", @@ -481,7 +481,7 @@ VOID CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - No matching BSS, start a new scan\n")); - ScanParmFill(pAd, &ScanReq, (PSTRING) pAd->MlmeAux.Ssid, + ScanParmFill(pAd, &ScanReq, (char *)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, BSS_ANY, SCAN_ACTIVE); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, @@ -505,10 +505,10 @@ VOID CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - ULONG BssIdx; - PUCHAR pOidBssid = (PUCHAR) Elem->Msg; + unsigned long BssIdx; + u8 *pOidBssid = (u8 *)Elem->Msg; MLME_DISASSOC_REQ_STRUCT DisassocReq; MLME_JOIN_REQ_STRUCT JoinReq; @@ -527,7 +527,7 @@ VOID CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) DBGPRINT(RT_DEBUG_TRACE, ("CNTL - BSSID not found. start a new scan\n")); - ScanParmFill(pAd, &ScanReq, (PSTRING) pAd->MlmeAux.Ssid, + ScanParmFill(pAd, &ScanReq, (char *)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, BSS_ANY, SCAN_ACTIVE); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); @@ -675,9 +675,9 @@ VOID CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /* or been corrupted by other "SET OID"? */ /* */ /* IRQL = DISPATCH_LEVEL */ -VOID CntlMlmeRoamingProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlMlmeRoamingProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR BBPValue = 0; + u8 BBPValue = 0; DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Roaming in MlmeAux.RoamTab...\n")); @@ -705,7 +705,7 @@ VOID CntlMlmeRoamingProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID CntlWaitDisassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlWaitDisassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { MLME_START_REQ_STRUCT StartReq; @@ -726,7 +726,7 @@ VOID CntlWaitDisassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) DBGPRINT(RT_DEBUG_TRACE, ("CNTL - No matching BSS, start a new ADHOC (Ssid=%s)...\n", pAd->MlmeAux.Ssid)); - StartParmFill(pAd, &StartReq, (PCHAR) pAd->MlmeAux.Ssid, + StartParmFill(pAd, &StartReq, (char *)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, sizeof(MLME_START_REQ_STRUCT), &StartReq); @@ -749,13 +749,13 @@ VOID CntlWaitDisassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID CntlWaitJoinProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlWaitJoinProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Reason; + u16 Reason; MLME_AUTH_REQ_STRUCT AuthReq; if (Elem->MsgType == MT2_JOIN_CONF) { - NdisMoveMemory(&Reason, Elem->Msg, sizeof(USHORT)); + NdisMoveMemory(&Reason, Elem->Msg, sizeof(u16)); if (Reason == MLME_SUCCESS) { /* 1. joined an IBSS, we are pretty much done here */ if (pAd->MlmeAux.BssType == BSS_ADHOC) { @@ -832,12 +832,12 @@ VOID CntlWaitJoinProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID CntlWaitStartProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlWaitStartProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Result; + u16 Result; if (Elem->MsgType == MT2_START_CONF) { - NdisMoveMemory(&Result, Elem->Msg, sizeof(USHORT)); + NdisMoveMemory(&Result, Elem->Msg, sizeof(u16)); if (Result == MLME_SUCCESS) { /* */ /* 5G bands rules of Japan: */ @@ -925,14 +925,14 @@ VOID CntlWaitStartProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID CntlWaitAuthProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlWaitAuthProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Reason; + u16 Reason; MLME_ASSOC_REQ_STRUCT AssocReq; MLME_AUTH_REQ_STRUCT AuthReq; if (Elem->MsgType == MT2_AUTH_CONF) { - NdisMoveMemory(&Reason, Elem->Msg, sizeof(USHORT)); + NdisMoveMemory(&Reason, Elem->Msg, sizeof(u16)); if (Reason == MLME_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH OK\n")); AssocParmFill(pAd, &AssocReq, pAd->MlmeAux.Bssid, @@ -989,14 +989,14 @@ VOID CntlWaitAuthProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID CntlWaitAuthProc2(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlWaitAuthProc2(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Reason; + u16 Reason; MLME_ASSOC_REQ_STRUCT AssocReq; MLME_AUTH_REQ_STRUCT AuthReq; if (Elem->MsgType == MT2_AUTH_CONF) { - NdisMoveMemory(&Reason, Elem->Msg, sizeof(USHORT)); + NdisMoveMemory(&Reason, Elem->Msg, sizeof(u16)); if (Reason == MLME_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH OK\n")); AssocParmFill(pAd, &AssocReq, pAd->MlmeAux.Bssid, @@ -1047,12 +1047,12 @@ VOID CntlWaitAuthProc2(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID CntlWaitAssocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlWaitAssocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Reason; + u16 Reason; if (Elem->MsgType == MT2_ASSOC_CONF) { - NdisMoveMemory(&Reason, Elem->Msg, sizeof(USHORT)); + NdisMoveMemory(&Reason, Elem->Msg, sizeof(u16)); if (Reason == MLME_SUCCESS) { if (pAd->CommonCfg.bWirelessEvent) { RTMPSendWirelessEvent(pAd, IW_ASSOC_EVENT_FLAG, @@ -1085,12 +1085,12 @@ VOID CntlWaitAssocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID CntlWaitReassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlWaitReassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Result; + u16 Result; if (Elem->MsgType == MT2_REASSOC_CONF) { - NdisMoveMemory(&Result, Elem->Msg, sizeof(USHORT)); + NdisMoveMemory(&Result, Elem->Msg, sizeof(u16)); if (Result == MLME_SUCCESS) { /* send wireless event - for association */ if (pAd->CommonCfg.bWirelessEvent) @@ -1121,7 +1121,7 @@ VOID CntlWaitReassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } -VOID AdhocTurnOnQos(IN PRTMP_ADAPTER pAd) +void AdhocTurnOnQos(IN PRTMP_ADAPTER pAd) { #define AC0_DEF_TXOP 0 #define AC1_DEF_TXOP 0 @@ -1162,12 +1162,12 @@ VOID AdhocTurnOnQos(IN PRTMP_ADAPTER pAd) ========================================================================== */ -VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) +void LinkUp(IN PRTMP_ADAPTER pAd, u8 BssType) { - ULONG Now; - UINT32 Data; + unsigned long Now; + u32 Data; BOOLEAN Cancelled; - UCHAR Value = 0, idx = 0, HashIdx = 0; + u8 Value = 0, idx = 0, HashIdx = 0; MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry = NULL; /* Init ChannelQuality to prevent DEAD_CQI at initial LinkUp */ @@ -1408,8 +1408,8 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) /* Fill in Shared Key Table(offset: 0x6c00) and Shared Key Mode(offset: 0x7000) */ if (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled) { - PUCHAR Key; - UCHAR CipherAlg; + u8 *Key; + u8 CipherAlg; for (idx = 0; idx < SHARE_KEY_NUM; idx++) { CipherAlg = pAd->SharedKey[BSS0][idx].CipherAlg; @@ -1511,7 +1511,7 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) /* Key will be set after 4-way handshake. */ /* */ if (pAd->StaCfg.AuthMode >= Ndis802_11AuthModeWPA) { - ULONG IV; + unsigned long IV; /* Remove all WPA keys */ RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); @@ -1548,8 +1548,8 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) (pAd->StaCfg.PortSecured == WPA_802_1X_PORT_SECURED)) || ((pAd->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_DISABLE) && (pAd->StaCfg.WepStatus == Ndis802_11WEPEnabled))) { - PUCHAR Key; - UCHAR CipherAlg; + u8 *Key; + u8 CipherAlg; for (idx = 0; idx < SHARE_KEY_NUM; idx++) { CipherAlg = pAd->SharedKey[BSS0][idx].CipherAlg; @@ -1697,8 +1697,8 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) /* Set asic auto fall back */ { - PUCHAR pTable; - UCHAR TableSize = 0; + u8 *pTable; + u8 TableSize = 0; MlmeSelectTxRateTable(pAd, &pAd->MacTab.Content[BSSID_WCID], &pTable, &TableSize, @@ -1721,7 +1721,7 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) /* If the legacy mode is set, overwrite the transmit setting of this entry. */ if (pEntry->HTPhyMode.field.MODE <= MODE_OFDM) - RTMPUpdateLegacyTxSetting((UCHAR) pAd->StaCfg. + RTMPUpdateLegacyTxSetting((u8)pAd->StaCfg. DesiredTransmitSetting.field. FixedTxMode, pEntry); } else @@ -1729,7 +1729,7 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) NdisReleaseSpinLock(&pAd->MacTabLock); /* Let Link Status Page display first initial rate. */ - pAd->LastTxRate = (USHORT) (pEntry->HTPhyMode.word); + pAd->LastTxRate = (u16)(pEntry->HTPhyMode.word); /* Select DAC according to HT or Legacy */ if (pAd->StaActive.SupportedPhyInfo.MCSSet[0] != 0x00) { RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R1, &Value); @@ -1796,7 +1796,7 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) && ((STA_WEP_ON(pAd)) || (STA_TKIP_ON(pAd)))) { pAd->CommonCfg.IOTestParm.bNextDisableRxBA = TRUE; if (pAd->CommonCfg.bEnableTxBurst) { - UINT32 MACValue = 0; + u32 MACValue = 0; /* Force disable TXOP value in this case. The same action in MLMEUpdateProtect too. */ /* I didn't change PBF_MAX_PCNT setting. */ RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &MACValue); @@ -1873,9 +1873,9 @@ VOID LinkUp(IN PRTMP_ADAPTER pAd, IN UCHAR BssType) ========================================================================== */ -VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) +void LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) { - UCHAR i, ByteValue = 0; + u8 i, ByteValue = 0; /* Do nothing if monitor mode is on */ if (MONITOR_ON(pAd)) @@ -2122,11 +2122,11 @@ VOID LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) ========================================================================== */ -VOID IterateOnBssTab(IN PRTMP_ADAPTER pAd) +void IterateOnBssTab(IN PRTMP_ADAPTER pAd) { MLME_START_REQ_STRUCT StartReq; MLME_JOIN_REQ_STRUCT JoinReq; - ULONG BssIdx; + unsigned long BssIdx; /* Change the wepstatus to original wepstatus */ pAd->StaCfg.WepStatus = pAd->StaCfg.OrigWepStatus; @@ -2206,7 +2206,7 @@ VOID IterateOnBssTab(IN PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_TRACE, ("CNTL - All BSS fail; start a new ADHOC (Ssid=%s)...\n", pAd->MlmeAux.Ssid)); - StartParmFill(pAd, &StartReq, (PCHAR) pAd->MlmeAux.Ssid, + StartParmFill(pAd, &StartReq, (char *)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, sizeof(MLME_START_REQ_STRUCT), &StartReq); @@ -2228,10 +2228,10 @@ VOID IterateOnBssTab(IN PRTMP_ADAPTER pAd) /* for re-association only */ /* IRQL = DISPATCH_LEVEL */ -VOID IterateOnBssTab2(IN PRTMP_ADAPTER pAd) +void IterateOnBssTab2(IN PRTMP_ADAPTER pAd) { MLME_REASSOC_REQ_STRUCT ReassocReq; - ULONG BssIdx; + unsigned long BssIdx; BSS_ENTRY *pBss; BssIdx = pAd->MlmeAux.RoamIdx; @@ -2276,8 +2276,8 @@ VOID IterateOnBssTab2(IN PRTMP_ADAPTER pAd) ========================================================================== */ -VOID JoinParmFill(IN PRTMP_ADAPTER pAd, - IN OUT MLME_JOIN_REQ_STRUCT * JoinReq, IN ULONG BssIdx) +void JoinParmFill(IN PRTMP_ADAPTER pAd, + IN OUT MLME_JOIN_REQ_STRUCT * JoinReq, unsigned long BssIdx) { JoinReq->BssIdx = BssIdx; } @@ -2290,10 +2290,10 @@ VOID JoinParmFill(IN PRTMP_ADAPTER pAd, ========================================================================== */ -VOID ScanParmFill(IN PRTMP_ADAPTER pAd, +void ScanParmFill(IN PRTMP_ADAPTER pAd, IN OUT MLME_SCAN_REQ_STRUCT * ScanReq, - IN STRING Ssid[], - IN UCHAR SsidLen, IN UCHAR BssType, IN UCHAR ScanType) + char Ssid[], + u8 SsidLen, u8 BssType, u8 ScanType) { NdisZeroMemory(ScanReq->Ssid, MAX_LEN_OF_SSID); ScanReq->SsidLen = SsidLen; @@ -2310,9 +2310,9 @@ VOID ScanParmFill(IN PRTMP_ADAPTER pAd, ========================================================================== */ -VOID StartParmFill(IN PRTMP_ADAPTER pAd, +void StartParmFill(IN PRTMP_ADAPTER pAd, IN OUT MLME_START_REQ_STRUCT * StartReq, - IN CHAR Ssid[], IN UCHAR SsidLen) + char Ssid[], u8 SsidLen) { ASSERT(SsidLen <= MAX_LEN_OF_SSID); NdisMoveMemory(StartReq->Ssid, Ssid, SsidLen); @@ -2327,9 +2327,9 @@ VOID StartParmFill(IN PRTMP_ADAPTER pAd, ========================================================================== */ -VOID AuthParmFill(IN PRTMP_ADAPTER pAd, +void AuthParmFill(IN PRTMP_ADAPTER pAd, IN OUT MLME_AUTH_REQ_STRUCT * AuthReq, - IN PUCHAR pAddr, IN USHORT Alg) + u8 *pAddr, u16 Alg) { COPY_MAC_ADDR(AuthReq->Addr, pAddr); AuthReq->Alg = Alg; @@ -2345,7 +2345,7 @@ VOID AuthParmFill(IN PRTMP_ADAPTER pAd, ========================================================================== */ #ifdef RTMP_MAC_PCI -VOID ComposePsPoll(IN PRTMP_ADAPTER pAd) +void ComposePsPoll(IN PRTMP_ADAPTER pAd) { NdisZeroMemory(&pAd->PsPollFrame, sizeof(PSPOLL_FRAME)); pAd->PsPollFrame.FC.Type = BTYPE_CNTL; @@ -2356,7 +2356,7 @@ VOID ComposePsPoll(IN PRTMP_ADAPTER pAd) } /* IRQL = DISPATCH_LEVEL */ -VOID ComposeNullFrame(IN PRTMP_ADAPTER pAd) +void ComposeNullFrame(IN PRTMP_ADAPTER pAd) { NdisZeroMemory(&pAd->NullFrame, sizeof(HEADER_802_11)); pAd->NullFrame.FC.Type = BTYPE_DATA; @@ -2368,13 +2368,13 @@ VOID ComposeNullFrame(IN PRTMP_ADAPTER pAd) } #endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB -VOID MlmeCntlConfirm(IN PRTMP_ADAPTER pAd, IN ULONG MsgType, IN USHORT Msg) +void MlmeCntlConfirm(IN PRTMP_ADAPTER pAd, unsigned long MsgType, u16 Msg) { - MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MsgType, sizeof(USHORT), + MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MsgType, sizeof(u16), &Msg); } -VOID ComposePsPoll(IN PRTMP_ADAPTER pAd) +void ComposePsPoll(IN PRTMP_ADAPTER pAd) { PTXINFO_STRUC pTxInfo; PTXWI_STRUC pTxWI; @@ -2395,14 +2395,14 @@ VOID ComposePsPoll(IN PRTMP_ADAPTER pAd) (PTXINFO_STRUC) & pAd->PsPollContext.TransferBuffer->field. WirelessPacket[0]; RTMPWriteTxInfo(pAd, pTxInfo, - (USHORT) (sizeof(PSPOLL_FRAME) + TXWI_SIZE), TRUE, + (u16)(sizeof(PSPOLL_FRAME) + TXWI_SIZE), TRUE, EpToQueue[MGMTPIPEIDX], FALSE, FALSE); pTxWI = (PTXWI_STRUC) & pAd->PsPollContext.TransferBuffer->field. WirelessPacket[TXINFO_SIZE]; RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0, BSSID_WCID, (sizeof(PSPOLL_FRAME)), 0, 0, - (UCHAR) pAd->CommonCfg.MlmeTransmit.field.MCS, + (u8)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); RTMPMoveMemory(&pAd->PsPollContext.TransferBuffer->field. WirelessPacket[TXWI_SIZE + TXINFO_SIZE], @@ -2413,7 +2413,7 @@ VOID ComposePsPoll(IN PRTMP_ADAPTER pAd) } /* IRQL = DISPATCH_LEVEL */ -VOID ComposeNullFrame(IN PRTMP_ADAPTER pAd) +void ComposeNullFrame(IN PRTMP_ADAPTER pAd) { PTXINFO_STRUC pTxInfo; PTXWI_STRUC pTxWI; @@ -2431,14 +2431,14 @@ VOID ComposeNullFrame(IN PRTMP_ADAPTER pAd) (PTXINFO_STRUC) & pAd->NullContext.TransferBuffer->field. WirelessPacket[0]; RTMPWriteTxInfo(pAd, pTxInfo, - (USHORT) (sizeof(HEADER_802_11) + TXWI_SIZE), TRUE, + (u16)(sizeof(HEADER_802_11) + TXWI_SIZE), TRUE, EpToQueue[MGMTPIPEIDX], FALSE, FALSE); pTxWI = (PTXWI_STRUC) & pAd->NullContext.TransferBuffer->field. WirelessPacket[TXINFO_SIZE]; RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0, BSSID_WCID, (sizeof(HEADER_802_11)), 0, 0, - (UCHAR) pAd->CommonCfg.MlmeTransmit.field.MCS, + (u8)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); RTMPMoveMemory(&pAd->NullContext.TransferBuffer->field. WirelessPacket[TXWI_SIZE + TXINFO_SIZE], &pAd->NullFrame, @@ -2458,22 +2458,22 @@ VOID ComposeNullFrame(IN PRTMP_ADAPTER pAd) ========================================================================== */ -ULONG MakeIbssBeacon(IN PRTMP_ADAPTER pAd) +unsigned long MakeIbssBeacon(IN PRTMP_ADAPTER pAd) { - UCHAR DsLen = 1, IbssLen = 2; - UCHAR LocalErpIe[3] = { IE_ERP, 1, 0x04 }; + u8 DsLen = 1, IbssLen = 2; + u8 LocalErpIe[3] = { IE_ERP, 1, 0x04 }; HEADER_802_11 BcnHdr; - USHORT CapabilityInfo; + u16 CapabilityInfo; LARGE_INTEGER FakeTimestamp; - ULONG FrameLen = 0; + unsigned long FrameLen = 0; PTXWI_STRUC pTxWI = &pAd->BeaconTxWI; - UCHAR *pBeaconFrame = pAd->BeaconBuf; + u8 *pBeaconFrame = pAd->BeaconBuf; BOOLEAN Privacy; - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen = 0; - UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR ExtRateLen = 0; - UCHAR RSNIe = IE_WPA; + u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES]; + u8 SupRateLen = 0; + u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; + u8 ExtRateLen = 0; + u8 RSNIe = IE_WPA; if ((pAd->CommonCfg.PhyMode == PHY_11B) && (pAd->CommonCfg.Channel <= 14)) { @@ -2560,7 +2560,7 @@ ULONG MakeIbssBeacon(IN PRTMP_ADAPTER pAd) /* add ERP_IE and EXT_RAE IE of in 802.11g */ if (ExtRateLen) { - ULONG tmp; + unsigned long tmp; MakeOutgoingFrame(pBeaconFrame + FrameLen, &tmp, 3, LocalErpIe, @@ -2571,7 +2571,7 @@ ULONG MakeIbssBeacon(IN PRTMP_ADAPTER pAd) } /* If adhoc secruity is set for WPA-None, append the cipher suite IE */ if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) { - ULONG tmp; + unsigned long tmp; RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, BSS0); @@ -2584,8 +2584,8 @@ ULONG MakeIbssBeacon(IN PRTMP_ADAPTER pAd) } if ((pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)) { - ULONG TmpLen; - UCHAR HtLen, HtLen1; + unsigned long TmpLen; + u8 HtLen, HtLen1; /* add HT Capability IE */ HtLen = sizeof(pAd->CommonCfg.HtCapability); diff --git a/drivers/staging/rt2860/sta/rtmp_data.c b/drivers/staging/rt2860/sta/rtmp_data.c index db65188ced3b..b40e511ea5b5 100644 --- a/drivers/staging/rt2860/sta/rtmp_data.c +++ b/drivers/staging/rt2860/sta/rtmp_data.c @@ -36,13 +36,13 @@ */ #include "../rt_config.h" -VOID STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, +void STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, - IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) + IN RX_BLK * pRxBlk, u8 FromWhichBSSID) { PRT28XX_RXD_STRUC pRxD = &(pRxBlk->RxD); PRXWI_STRUC pRxWI = pRxBlk->pRxWI; - UCHAR *pTmpBuf; + u8 *pTmpBuf; if (pAd->StaCfg.WpaSupplicantUP) { /* All EAPoL frames have to pass to upper layer (ex. WPA_SUPPLICANT daemon) */ @@ -54,8 +54,8 @@ VOID STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, WpaCheckEapCode(pAd, pRxBlk->pData, pRxBlk->DataSize, LENGTH_802_1_H))) { - PUCHAR Key; - UCHAR CipherAlg; + u8 *Key; + u8 CipherAlg; int idx = 0; DBGPRINT_RAW(RT_DEBUG_TRACE, @@ -138,7 +138,7 @@ VOID STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, WepKey.keyinfo.KeyLength = len; pAd->SharedKey[BSS0][idx]. KeyLen = - (UCHAR) (len <= 5 ? 5 : 13); + (u8)(len <= 5 ? 5 : 13); pAd->IndicateMediaState = NdisMediaStateConnected; @@ -202,9 +202,9 @@ VOID STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, } -VOID STARxDataFrameAnnounce(IN PRTMP_ADAPTER pAd, +void STARxDataFrameAnnounce(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, - IN RX_BLK * pRxBlk, IN UCHAR FromWhichBSSID) + IN RX_BLK * pRxBlk, u8 FromWhichBSSID) { /* non-EAP frame */ @@ -269,11 +269,11 @@ BOOLEAN STACheckTkipMICValue(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry, IN RX_BLK * pRxBlk) { PHEADER_802_11 pHeader = pRxBlk->pHeader; - UCHAR *pData = pRxBlk->pData; - USHORT DataSize = pRxBlk->DataSize; - UCHAR UserPriority = pRxBlk->UserPriority; + u8 *pData = pRxBlk->pData; + u16 DataSize = pRxBlk->DataSize; + u8 UserPriority = pRxBlk->UserPriority; PCIPHER_KEY pWpaKey; - UCHAR *pDA, *pSA; + u8 *pDA, *pSA; pWpaKey = &pAd->SharedKey[BSS0][pRxBlk->pRxWI->KeyIndex]; @@ -318,7 +318,7 @@ BOOLEAN STACheckTkipMICValue(IN PRTMP_ADAPTER pAd, /* 3. set payload size including LLC to DataSize */ /* 4. set some flags with RX_BLK_SET_FLAG() */ /* */ -VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) +void STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) { PRT28XX_RXD_STRUC pRxD = &(pRxBlk->RxD); PRXWI_STRUC pRxWI = pRxBlk->pRxWI; @@ -326,8 +326,8 @@ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; BOOLEAN bFragment = FALSE; MAC_TABLE_ENTRY *pEntry = NULL; - UCHAR FromWhichBSSID = BSS0; - UCHAR UserPriority = 0; + u8 FromWhichBSSID = BSS0; + u8 UserPriority = 0; { /* before LINK UP, all DATA frames are rejected */ @@ -351,11 +351,11 @@ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) if (pAd->CommonCfg.bAPSDCapable && pAd->CommonCfg.APEdcaParm.bAPSDCapable && (pHeader->FC.SubType & 0x08)) { - UCHAR *pData; + u8 *pData; DBGPRINT(RT_DEBUG_INFO, ("bAPSDCapable\n")); /* Qos bit 4 */ - pData = (PUCHAR) pHeader + LENGTH_802_11; + pData = (u8 *)pHeader + LENGTH_802_11; if ((*pData >> 4) & 0x01) { DBGPRINT(RT_DEBUG_INFO, ("RxDone- Rcv EOSP frame, driver may fall into sleep\n")); @@ -363,14 +363,14 @@ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) /* Force driver to fall into sleep mode when rcv EOSP frame */ if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { - USHORT TbttNumToNextWakeUp; - USHORT NextDtim = + u16 TbttNumToNextWakeUp; + u16 NextDtim = pAd->StaCfg.DtimPeriod; - ULONG Now; + unsigned long Now; NdisGetSystemUpTime(&Now); NextDtim -= - (USHORT) (Now - + (u16)(Now - pAd->StaCfg. LastBeaconRxTime) / pAd->CommonCfg.BeaconPeriod; @@ -459,7 +459,7 @@ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) } } - pRxBlk->pData = (UCHAR *) pHeader; + pRxBlk->pData = (u8 *) pHeader; /* */ /* update RxBlk->pData, DataSize */ @@ -553,7 +553,7 @@ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) return; } else if (pRxD->U2M) { pAd->LastRxRate = - (USHORT) ((pRxWI->MCS) + (pRxWI->BW << 7) + + (u16)((pRxWI->MCS) + (pRxWI->BW << 7) + (pRxWI->ShortGI << 8) + (pRxWI->PHYMODE << 14)); if (ADHOC_ON(pAd)) { @@ -565,8 +565,8 @@ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) Update_Rssi_Sample(pAd, &pAd->StaCfg.RssiSample, pRxWI); - pAd->StaCfg.LastSNR0 = (UCHAR) (pRxWI->SNR0); - pAd->StaCfg.LastSNR1 = (UCHAR) (pRxWI->SNR1); + pAd->StaCfg.LastSNR0 = (u8)(pRxWI->SNR0); + pAd->StaCfg.LastSNR1 = (u8)(pRxWI->SNR1); pAd->RalinkCounters.OneSecRxOkDataCnt++; @@ -610,7 +610,7 @@ VOID STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); } -VOID STAHandleRxMgmtFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) +void STAHandleRxMgmtFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) { PRT28XX_RXD_STRUC pRxD = &(pRxBlk->RxD); PRXWI_STRUC pRxWI = pRxBlk->pRxWI; @@ -637,8 +637,8 @@ VOID STAHandleRxMgmtFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) && (pAd->RxAnt.EvaluatePeriod == 0)) { Update_Rssi_Sample(pAd, &pAd->StaCfg.RssiSample, pRxWI); - pAd->StaCfg.LastSNR0 = (UCHAR) (pRxWI->SNR0); - pAd->StaCfg.LastSNR1 = (UCHAR) (pRxWI->SNR1); + pAd->StaCfg.LastSNR0 = (u8)(pRxWI->SNR0); + pAd->StaCfg.LastSNR1 = (u8)(pRxWI->SNR1); } /* First check the size, it MUST not exceed the mlme queue size */ @@ -656,7 +656,7 @@ VOID STAHandleRxMgmtFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_SUCCESS); } -VOID STAHandleRxControlFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) +void STAHandleRxControlFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) { PRXWI_STRUC pRxWI = pRxBlk->pRxWI; PHEADER_802_11 pHeader = pRxBlk->pHeader; @@ -700,11 +700,11 @@ VOID STAHandleRxControlFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) */ BOOLEAN STARxDoneInterruptHandle(IN PRTMP_ADAPTER pAd, IN BOOLEAN argc) { - NDIS_STATUS Status; - UINT32 RxProcessed, RxPending; + int Status; + u32 RxProcessed, RxPending; BOOLEAN bReschedule = FALSE; RT28XX_RXD_STRUC *pRxD; - UCHAR *pData; + u8 *pData; PRXWI_STRUC pRxWI; PNDIS_PACKET pRxPacket; PHEADER_802_11 pHeader; @@ -757,7 +757,7 @@ BOOLEAN STARxDoneInterruptHandle(IN PRTMP_ADAPTER pAd, IN BOOLEAN argc) RxCell.pRxWI = pRxWI; RxCell.pHeader = pHeader; RxCell.pRxPacket = pRxPacket; - RxCell.pData = (UCHAR *) pHeader; + RxCell.pData = (u8 *) pHeader; RxCell.DataSize = pRxWI->MPDUtotalByteCount; RxCell.Flags = 0; @@ -833,7 +833,7 @@ BOOLEAN STARxDoneInterruptHandle(IN PRTMP_ADAPTER pAd, IN BOOLEAN argc) ======================================================================== */ -VOID RTMPHandleTwakeupInterrupt(IN PRTMP_ADAPTER pAd) +void RTMPHandleTwakeupInterrupt(IN PRTMP_ADAPTER pAd) { AsicForceWakeup(pAd, FALSE); } @@ -846,7 +846,7 @@ Routine Description: Arguments: NDIS_HANDLE MiniportAdapterContext Pointer refer to the device handle, i.e., the pAd. PPNDIS_PACKET ppPacketArray The packet array need to do transmission. - UINT NumberOfPackets Number of packet in packet array. + u32 NumberOfPackets Number of packet in packet array. Return Value: NONE @@ -856,10 +856,10 @@ Note: You only can put OS-depened & STA related code in here. ======================================================================== */ -VOID STASendPackets(IN NDIS_HANDLE MiniportAdapterContext, - IN PPNDIS_PACKET ppPacketArray, IN UINT NumberOfPackets) +void STASendPackets(IN NDIS_HANDLE MiniportAdapterContext, + IN PPNDIS_PACKET ppPacketArray, u32 NumberOfPackets) { - UINT Index; + u32 Index; PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) MiniportAdapterContext; PNDIS_PACKET pPacket; BOOLEAN allowToSend = FALSE; @@ -920,19 +920,19 @@ Note: You only can put OS-indepened & STA related code in here. ======================================================================== */ -NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) +int STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) { PACKET_INFO PacketInfo; - PUCHAR pSrcBufVA; - UINT SrcBufLen; - UINT AllowFragSize; - UCHAR NumberOfFrag; - UCHAR RTSRequired; - UCHAR QueIdx, UserPriority; + u8 *pSrcBufVA; + u32 SrcBufLen; + u32 AllowFragSize; + u8 NumberOfFrag; + u8 RTSRequired; + u8 QueIdx, UserPriority; MAC_TABLE_ENTRY *pEntry = NULL; unsigned int IrqFlags; - UCHAR FlgIsIP = 0; - UCHAR Rate; + u8 FlgIsIP = 0; + u8 Rate; /* Prepare packet information structure for buffer descriptor */ /* chained within a single NDIS packet. */ @@ -986,7 +986,7 @@ NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) if (ADHOC_ON(pAd) ) { - RTMP_SET_PACKET_WCID(pPacket, (UCHAR) pEntry->Aid); + RTMP_SET_PACKET_WCID(pPacket, (u8)pEntry->Aid); } /* */ /* Check the Ethernet Frame type of this packet, and set the RTMP_SET_PACKET_SPECIFIC flags. */ @@ -1079,12 +1079,12 @@ NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) QueIdx = QID_AC_BE; if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED) && CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_WMM_CAPABLE)) { - USHORT Protocol; - UCHAR LlcSnapLen = 0, Byte0, Byte1; + u16 Protocol; + u8 LlcSnapLen = 0, Byte0, Byte1; do { /* get Ethernet protocol field */ Protocol = - (USHORT) ((pSrcBufVA[12] << 8) + pSrcBufVA[13]); + (u16)((pSrcBufVA[12] << 8) + pSrcBufVA[13]); if (Protocol <= 1500) { /* get Ethernet protocol field from LLC/SNAP */ if (Sniff2BytesFromNdisBuffer @@ -1092,7 +1092,7 @@ NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) &Byte0, &Byte1) != NDIS_STATUS_SUCCESS) break; - Protocol = (USHORT) ((Byte0 << 8) + Byte1); + Protocol = (u16)((Byte0 << 8) + Byte1); LlcSnapLen = 8; } /* always AC_BE for non-IP packet */ @@ -1189,12 +1189,12 @@ NDIS_STATUS STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) ======================================================================== */ #ifdef RTMP_MAC_PCI -NDIS_STATUS RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN UCHAR NumberRequired, IN PUCHAR FreeNumberIs) +int RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, + u8 QueIdx, + u8 NumberRequired, u8 *FreeNumberIs) { - ULONG FreeNumber = 0; - NDIS_STATUS Status = NDIS_STATUS_FAILURE; + unsigned long FreeNumber = 0; + int Status = NDIS_STATUS_FAILURE; switch (QueIdx) { case QID_AC_BK: @@ -1234,7 +1234,7 @@ NDIS_STATUS RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, ("RTMPFreeTXDRequest::Invalid QueIdx(=%d)\n", QueIdx)); break; } - *FreeNumberIs = (UCHAR) FreeNumber; + *FreeNumberIs = (u8)FreeNumber; return (Status); } @@ -1244,12 +1244,12 @@ NDIS_STATUS RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, Actually, this function used to check if the TxHardware Queue still has frame need to send. If no frame need to send, go to sleep, else, still wake up. */ -NDIS_STATUS RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN UCHAR NumberRequired, IN PUCHAR FreeNumberIs) +int RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, + u8 QueIdx, + u8 NumberRequired, u8 *FreeNumberIs) { - /*ULONG FreeNumber = 0; */ - NDIS_STATUS Status = NDIS_STATUS_FAILURE; + /*unsigned long FreeNumber = 0; */ + int Status = NDIS_STATUS_FAILURE; unsigned long IrqFlags; HT_TX_CONTEXT *pHTTXContext; @@ -1289,15 +1289,15 @@ NDIS_STATUS RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, } #endif /* RTMP_MAC_USB // */ -VOID RTMPSendDisassociationFrame(IN PRTMP_ADAPTER pAd) +void RTMPSendDisassociationFrame(IN PRTMP_ADAPTER pAd) { } -VOID RTMPSendNullFrame(IN PRTMP_ADAPTER pAd, - IN UCHAR TxRate, IN BOOLEAN bQosNull) +void RTMPSendNullFrame(IN PRTMP_ADAPTER pAd, + u8 TxRate, IN BOOLEAN bQosNull) { - UCHAR NullFrame[48]; - ULONG Length; + u8 NullFrame[48]; + unsigned long Length; PHEADER_802_11 pHeader_802_11; /* WPA 802.1x secured port control */ @@ -1349,12 +1349,12 @@ VOID RTMPSendNullFrame(IN PRTMP_ADAPTER pAd, } /* IRQL = DISPATCH_LEVEL */ -VOID RTMPSendRTSFrame(IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA, +void RTMPSendRTSFrame(IN PRTMP_ADAPTER pAd, + u8 *pDA, IN unsigned int NextMpduSize, - IN UCHAR TxRate, - IN UCHAR RTSRate, - IN USHORT AckDuration, IN UCHAR QueIdx, IN UCHAR FrameGap) + u8 TxRate, + u8 RTSRate, + u16 AckDuration, u8 QueIdx, u8 FrameGap) { } @@ -1367,12 +1367,12 @@ VOID RTMPSendRTSFrame(IN PRTMP_ADAPTER pAd, /* In Cisco CCX 2.0 Leap Authentication */ /* WepStatus is Ndis802_11Encryption1Enabled but the key will use PairwiseKey */ /* Instead of the SharedKey, SharedKey Length may be Zero. */ -VOID STAFindCipherAlgorithm(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) +void STAFindCipherAlgorithm(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) { NDIS_802_11_ENCRYPTION_STATUS Cipher; /* To indicate cipher used for this packet */ - UCHAR CipherAlg = CIPHER_NONE; /* cipher alogrithm */ - UCHAR KeyIdx = 0xff; - PUCHAR pSrcBufVA; + u8 CipherAlg = CIPHER_NONE; /* cipher alogrithm */ + u8 KeyIdx = 0xff; + u8 *pSrcBufVA; PCIPHER_KEY pKey = NULL; pSrcBufVA = GET_OS_PKT_DATAPTR(pTxBlk->pPacket); @@ -1429,7 +1429,7 @@ VOID STAFindCipherAlgorithm(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) pTxBlk->pKey = pKey; } -VOID STABuildCommon802_11Header(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) +void STABuildCommon802_11Header(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) { HEADER_802_11 *pHeader_802_11; @@ -1510,8 +1510,8 @@ VOID STABuildCommon802_11Header(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) pHeader_802_11->FC.PwrMgmt = (pAd->StaCfg.Psm == PWR_SAVE); } -VOID STABuildCache802_11Header(IN RTMP_ADAPTER * pAd, - IN TX_BLK * pTxBlk, IN UCHAR * pHeader) +void STABuildCache802_11Header(IN RTMP_ADAPTER * pAd, + IN TX_BLK * pTxBlk, u8 * pHeader) { MAC_TABLE_ENTRY *pMacEntry; PHEADER_802_11 pHeader80211; @@ -1556,13 +1556,13 @@ VOID STABuildCache802_11Header(IN RTMP_ADAPTER * pAd, pHeader80211->FC.PwrMgmt = (pAd->StaCfg.Psm == PWR_SAVE); } -static inline PUCHAR STA_Build_ARalink_Frame_Header(IN RTMP_ADAPTER * pAd, +static inline u8 *STA_Build_ARalink_Frame_Header(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) { - PUCHAR pHeaderBufPtr; + u8 *pHeaderBufPtr; HEADER_802_11 *pHeader_802_11; PNDIS_PACKET pNextPacket; - UINT32 nextBufLen; + u32 nextBufLen; PQUEUE_ENTRY pQEntry; STAFindCipherAlgorithm(pAd, pTxBlk); @@ -1588,9 +1588,9 @@ static inline PUCHAR STA_Build_ARalink_Frame_Header(IN RTMP_ADAPTER * pAd, pTxBlk->MpduHeaderLen += 2; } /* padding at front of LLC header. LLC header should at 4-bytes aligment. */ - pTxBlk->HdrPadLen = (ULONG) pHeaderBufPtr; - pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); - pTxBlk->HdrPadLen = (ULONG) (pHeaderBufPtr - pTxBlk->HdrPadLen); + pTxBlk->HdrPadLen = (unsigned long)pHeaderBufPtr; + pHeaderBufPtr = (u8 *)ROUND_UP(pHeaderBufPtr, 4); + pTxBlk->HdrPadLen = (unsigned long)(pHeaderBufPtr - pTxBlk->HdrPadLen); /* For RA Aggregation, */ /* put the 2nd MSDU length(extra 2-byte field) after QOS_CONTROL in little endian format */ @@ -1600,8 +1600,8 @@ static inline PUCHAR STA_Build_ARalink_Frame_Header(IN RTMP_ADAPTER * pAd, if (RTMP_GET_PACKET_VLAN(pNextPacket)) nextBufLen -= LENGTH_802_1Q; - *pHeaderBufPtr = (UCHAR) nextBufLen & 0xff; - *(pHeaderBufPtr + 1) = (UCHAR) (nextBufLen >> 8); + *pHeaderBufPtr = (u8)nextBufLen & 0xff; + *(pHeaderBufPtr + 1) = (u8)(nextBufLen >> 8); pHeaderBufPtr += 2; pTxBlk->MpduHeaderLen += 2; @@ -1610,10 +1610,10 @@ static inline PUCHAR STA_Build_ARalink_Frame_Header(IN RTMP_ADAPTER * pAd, } -static inline PUCHAR STA_Build_AMSDU_Frame_Header(IN RTMP_ADAPTER * pAd, +static inline u8 *STA_Build_AMSDU_Frame_Header(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) { - PUCHAR pHeaderBufPtr; /*, pSaveBufPtr; */ + u8 *pHeaderBufPtr; /*, pSaveBufPtr; */ HEADER_802_11 *pHeader_802_11; STAFindCipherAlgorithm(pAd, pTxBlk); @@ -1647,19 +1647,19 @@ static inline PUCHAR STA_Build_AMSDU_Frame_Header(IN RTMP_ADAPTER * pAd, /* */ /* @@@ MpduHeaderLen excluding padding @@@ */ /* */ - pTxBlk->HdrPadLen = (ULONG) pHeaderBufPtr; - pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); - pTxBlk->HdrPadLen = (ULONG) (pHeaderBufPtr - pTxBlk->HdrPadLen); + pTxBlk->HdrPadLen = (unsigned long)pHeaderBufPtr; + pHeaderBufPtr = (u8 *)ROUND_UP(pHeaderBufPtr, 4); + pTxBlk->HdrPadLen = (unsigned long)(pHeaderBufPtr - pTxBlk->HdrPadLen); return pHeaderBufPtr; } -VOID STA_AMPDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) +void STA_AMPDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) { HEADER_802_11 *pHeader_802_11; - PUCHAR pHeaderBufPtr; - USHORT FreeNumber; + u8 *pHeaderBufPtr; + u16 FreeNumber; MAC_TABLE_ENTRY *pMacEntry; BOOLEAN bVLANPkt; PQUEUE_ENTRY pQEntry; @@ -1681,12 +1681,12 @@ VOID STA_AMPDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) pMacEntry = pTxBlk->pMacEntry; if (pMacEntry->isCached) { /* NOTE: Please make sure the size of pMacEntry->CachedBuf[] is smaller than pTxBlk->HeaderBuf[]!!!! */ - NdisMoveMemory((PUCHAR) & pTxBlk-> + NdisMoveMemory((u8 *)& pTxBlk-> HeaderBuf[TXINFO_SIZE], - (PUCHAR) & pMacEntry->CachedBuf[0], + (u8 *)& pMacEntry->CachedBuf[0], TXWI_SIZE + sizeof(HEADER_802_11)); pHeaderBufPtr = - (PUCHAR) (&pTxBlk-> + (u8 *)(&pTxBlk-> HeaderBuf[TXINFO_SIZE + TXWI_SIZE]); STABuildCache802_11Header(pAd, pTxBlk, pHeaderBufPtr); } else { @@ -1745,9 +1745,9 @@ VOID STA_AMPDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) /* */ /* @@@ MpduHeaderLen excluding padding @@@ */ /* */ - pTxBlk->HdrPadLen = (ULONG) pHeaderBufPtr; - pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); - pTxBlk->HdrPadLen = (ULONG) (pHeaderBufPtr - pTxBlk->HdrPadLen); + pTxBlk->HdrPadLen = (unsigned long)pHeaderBufPtr; + pHeaderBufPtr = (u8 *)ROUND_UP(pHeaderBufPtr, 4); + pTxBlk->HdrPadLen = (unsigned long)(pHeaderBufPtr - pTxBlk->HdrPadLen); { @@ -1784,13 +1784,13 @@ VOID STA_AMPDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) [TXINFO_SIZE]), pTxBlk); - NdisZeroMemory((PUCHAR) (&pMacEntry->CachedBuf[0]), + NdisZeroMemory((u8 *)(&pMacEntry->CachedBuf[0]), sizeof(pMacEntry->CachedBuf)); - NdisMoveMemory((PUCHAR) (&pMacEntry->CachedBuf[0]), - (PUCHAR) (&pTxBlk-> + NdisMoveMemory((u8 *)(&pMacEntry->CachedBuf[0]), + (u8 *)(&pTxBlk-> HeaderBuf[TXINFO_SIZE]), (pHeaderBufPtr - - (PUCHAR) (&pTxBlk-> + (u8 *)(&pTxBlk-> HeaderBuf[TXINFO_SIZE]))); pMacEntry->isCached = TRUE; } @@ -1819,15 +1819,15 @@ VOID STA_AMPDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) } -VOID STA_AMSDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) +void STA_AMSDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) { - PUCHAR pHeaderBufPtr; - USHORT FreeNumber; - USHORT subFramePayloadLen = 0; /* AMSDU Subframe length without AMSDU-Header / Padding. */ - USHORT totalMPDUSize = 0; - UCHAR *subFrameHeader; - UCHAR padding = 0; - USHORT FirstTx = 0, LastTxIdx = 0; + u8 *pHeaderBufPtr; + u16 FreeNumber; + u16 subFramePayloadLen = 0; /* AMSDU Subframe length without AMSDU-Header / Padding. */ + u16 totalMPDUSize = 0; + u8 *subFrameHeader; + u8 padding = 0; + u16 FirstTx = 0, LastTxIdx = 0; BOOLEAN bVLANPkt; int frameNum = 0; PQUEUE_ENTRY pQEntry; @@ -1951,11 +1951,11 @@ VOID STA_AMSDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); } -VOID STA_Legacy_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) +void STA_Legacy_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) { HEADER_802_11 *pHeader_802_11; - PUCHAR pHeaderBufPtr; - USHORT FreeNumber; + u8 *pHeaderBufPtr; + u16 FreeNumber; BOOLEAN bVLANPkt; PQUEUE_ENTRY pQEntry; @@ -2014,9 +2014,9 @@ VOID STA_Legacy_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) pTxBlk->MpduHeaderLen += 2; } /* The remaining content of MPDU header should locate at 4-octets aligment */ - pTxBlk->HdrPadLen = (ULONG) pHeaderBufPtr; - pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); - pTxBlk->HdrPadLen = (ULONG) (pHeaderBufPtr - pTxBlk->HdrPadLen); + pTxBlk->HdrPadLen = (unsigned long)pHeaderBufPtr; + pHeaderBufPtr = (u8 *)ROUND_UP(pHeaderBufPtr, 4); + pTxBlk->HdrPadLen = (unsigned long)(pHeaderBufPtr - pTxBlk->HdrPadLen); { @@ -2030,7 +2030,7 @@ VOID STA_Legacy_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(pTxBlk->pSrcBufHeader, pTxBlk->pExtraLlcSnapEncap); if (pTxBlk->pExtraLlcSnapEncap) { - UCHAR vlan_size; + u8 vlan_size; NdisMoveMemory(pHeaderBufPtr, pTxBlk->pExtraLlcSnapEncap, 6); @@ -2069,12 +2069,12 @@ VOID STA_Legacy_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); } -VOID STA_ARalink_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) +void STA_ARalink_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) { - PUCHAR pHeaderBufPtr; - USHORT FreeNumber; - USHORT totalMPDUSize = 0; - USHORT FirstTx, LastTxIdx; + u8 *pHeaderBufPtr; + u16 FreeNumber; + u16 totalMPDUSize = 0; + u16 FirstTx, LastTxIdx; int frameNum = 0; BOOLEAN bVLANPkt; PQUEUE_ENTRY pQEntry; @@ -2186,17 +2186,17 @@ VOID STA_ARalink_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) } -VOID STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) +void STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) { HEADER_802_11 *pHeader_802_11; - PUCHAR pHeaderBufPtr; - USHORT FreeNumber; - UCHAR fragNum = 0; + u8 *pHeaderBufPtr; + u16 FreeNumber; + u8 fragNum = 0; PACKET_INFO PacketInfo; - USHORT EncryptionOverhead = 0; - UINT32 FreeMpduSize, SrcRemainingBytes; - USHORT AckDuration; - UINT NextMpduSize; + u16 EncryptionOverhead = 0; + u32 FreeMpduSize, SrcRemainingBytes; + u16 AckDuration; + u32 NextMpduSize; BOOLEAN bVLANPkt; PQUEUE_ENTRY pQEntry; HTTRANSMIT_SETTING *pTransmit; @@ -2255,9 +2255,9 @@ VOID STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) /* padding at front of LLC header */ /* LLC header should locate at 4-octets aligment */ /* */ - pTxBlk->HdrPadLen = (ULONG) pHeaderBufPtr; - pHeaderBufPtr = (PUCHAR) ROUND_UP(pHeaderBufPtr, 4); - pTxBlk->HdrPadLen = (ULONG) (pHeaderBufPtr - pTxBlk->HdrPadLen); + pTxBlk->HdrPadLen = (unsigned long)pHeaderBufPtr; + pHeaderBufPtr = (u8 *)ROUND_UP(pHeaderBufPtr, 4); + pTxBlk->HdrPadLen = (unsigned long)(pHeaderBufPtr - pTxBlk->HdrPadLen); /* */ /* Insert LLC-SNAP encapsulation - 8 octets */ @@ -2269,7 +2269,7 @@ VOID STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(pTxBlk->pSrcBufHeader, pTxBlk->pExtraLlcSnapEncap); if (pTxBlk->pExtraLlcSnapEncap) { - UCHAR vlan_size; + u8 vlan_size; NdisMoveMemory(pHeaderBufPtr, pTxBlk->pExtraLlcSnapEncap, 6); pHeaderBufPtr += 6; @@ -2360,8 +2360,8 @@ VOID STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) pTxBlk->SrcBufLen = FreeMpduSize; NextMpduSize = - min(((UINT) SrcRemainingBytes - pTxBlk->SrcBufLen), - ((UINT) pAd->CommonCfg.FragmentThreshold)); + min(((u32)SrcRemainingBytes - pTxBlk->SrcBufLen), + ((u32)pAd->CommonCfg.FragmentThreshold)); pHeader_802_11->FC.MoreFrag = 1; pHeader_802_11->Duration = (3 * pAd->CommonCfg.Dsifs) + (2 * AckDuration) + @@ -2434,8 +2434,8 @@ VOID STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) ======================================================================== */ -NDIS_STATUS STAHardTransmit(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, IN UCHAR QueIdx) +int STAHardTransmit(IN PRTMP_ADAPTER pAd, + IN TX_BLK * pTxBlk, u8 QueIdx) { NDIS_PACKET *pPacket; PQUEUE_ENTRY pQEntry; @@ -2523,7 +2523,7 @@ NDIS_STATUS STAHardTransmit(IN PRTMP_ADAPTER pAd, } -ULONG HashBytesPolynomial(UCHAR * value, unsigned int len) +unsigned long HashBytesPolynomial(u8 * value, unsigned int len) { unsigned char *word = value; unsigned int ret = 0; @@ -2537,9 +2537,9 @@ ULONG HashBytesPolynomial(UCHAR * value, unsigned int len) return ret; } -VOID Sta_Announce_or_Forward_802_3_Packet(IN PRTMP_ADAPTER pAd, +void Sta_Announce_or_Forward_802_3_Packet(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket, - IN UCHAR FromWhichBSSID) + u8 FromWhichBSSID) { if (TRUE) { announce_802_3_packet(pAd, pPacket); diff --git a/drivers/staging/rt2860/sta/sanity.c b/drivers/staging/rt2860/sta/sanity.c index ba6eaf670f10..a79348f43bc4 100644 --- a/drivers/staging/rt2860/sta/sanity.c +++ b/drivers/staging/rt2860/sta/sanity.c @@ -36,15 +36,15 @@ */ #include "../rt_config.h" -extern UCHAR CISCO_OUI[]; +extern u8 CISCO_OUI[]; -extern UCHAR WPA_OUI[]; -extern UCHAR RSN_OUI[]; -extern UCHAR WME_INFO_ELEM[]; -extern UCHAR WME_PARM_ELEM[]; -extern UCHAR Ccx2QosInfo[]; -extern UCHAR RALINK_OUI[]; -extern UCHAR BROADCOM_OUI[]; +extern u8 WPA_OUI[]; +extern u8 RSN_OUI[]; +extern u8 WME_INFO_ELEM[]; +extern u8 WME_PARM_ELEM[]; +extern u8 Ccx2QosInfo[]; +extern u8 RALINK_OUI[]; +extern u8 BROADCOM_OUI[]; /* ========================================================================== @@ -55,9 +55,9 @@ extern UCHAR BROADCOM_OUI[]; ========================================================================== */ BOOLEAN MlmeStartReqSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, - IN ULONG MsgLen, - OUT CHAR Ssid[], OUT UCHAR * pSsidLen) + void * Msg, + unsigned long MsgLen, + char Ssid[], u8 * pSsidLen) { MLME_START_REQ_STRUCT *Info; @@ -86,22 +86,22 @@ BOOLEAN MlmeStartReqSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ -BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen, OUT PUCHAR pAddr2, OUT USHORT * pCapabilityInfo, OUT USHORT * pStatus, OUT USHORT * pAid, OUT UCHAR SupRate[], OUT UCHAR * pSupRateLen, OUT UCHAR ExtRate[], OUT UCHAR * pExtRateLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ - OUT UCHAR * pHtCapabilityLen, - OUT UCHAR * pAddHtInfoLen, - OUT UCHAR * pNewExtChannelOffset, - OUT PEDCA_PARM pEdcaParm, OUT UCHAR * pCkipFlag) +BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, void * pMsg, unsigned long MsgLen, u8 *pAddr2, u16 * pCapabilityInfo, u16 * pStatus, u16 * pAid, u8 SupRate[], u8 * pSupRateLen, u8 ExtRate[], u8 * pExtRateLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ + u8 * pHtCapabilityLen, + u8 * pAddHtInfoLen, + u8 * pNewExtChannelOffset, + OUT PEDCA_PARM pEdcaParm, u8 * pCkipFlag) { - CHAR IeType, *Ptr; + char IeType, *Ptr; PFRAME_802_11 pFrame = (PFRAME_802_11) pMsg; PEID_STRUCT pEid; - ULONG Length = 0; + unsigned long Length = 0; *pNewExtChannelOffset = 0xff; *pHtCapabilityLen = 0; *pAddHtInfoLen = 0; COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); - Ptr = (PCHAR) pFrame->Octet; + Ptr = (char *)pFrame->Octet; Length += LENGTH_802_11; NdisMoveMemory(pCapabilityInfo, &pFrame->Octet[0], 2); @@ -155,11 +155,11 @@ BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen NdisMoveMemory(pHtCapability, pEid->Octet, SIZE_HT_CAP_IE); - *(USHORT *) (&pHtCapability->HtCapInfo) = - cpu2le16(*(USHORT *) + *(u16 *) (&pHtCapability->HtCapInfo) = + cpu2le16(*(u16 *) (&pHtCapability->HtCapInfo)); - *(USHORT *) (&pHtCapability->ExtHtCapInfo) = - cpu2le16(*(USHORT *) + *(u16 *) (&pHtCapability->ExtHtCapInfo) = + cpu2le16(*(u16 *) (&pHtCapability->ExtHtCapInfo)); *pHtCapabilityLen = SIZE_HT_CAP_IE; @@ -177,11 +177,11 @@ BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen NdisMoveMemory(pAddHtInfo, pEid->Octet, sizeof(ADD_HT_INFO_IE)); - *(USHORT *) (&pAddHtInfo->AddHtInfo2) = - cpu2le16(*(USHORT *) + *(u16 *) (&pAddHtInfo->AddHtInfo2) = + cpu2le16(*(u16 *) (&pAddHtInfo->AddHtInfo2)); - *(USHORT *) (&pAddHtInfo->AddHtInfo3) = - cpu2le16(*(USHORT *) + *(u16 *) (&pAddHtInfo->AddHtInfo3) = + cpu2le16(*(u16 *) (&pAddHtInfo->AddHtInfo3)); *pAddHtInfoLen = SIZE_ADD_HT_INFO_IE; @@ -204,7 +204,7 @@ BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen /* handle WME PARAMTER ELEMENT */ if (NdisEqualMemory(pEid->Octet, WME_PARM_ELEM, 6) && (pEid->Len == 24)) { - PUCHAR ptr; + u8 *ptr; int i; /* parsing EDCA parameters */ @@ -217,9 +217,9 @@ BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen pEid->Octet[6] & 0x0f; pEdcaParm->bAPSDCapable = (pEid->Octet[6] & 0x80) ? 1 : 0; - ptr = (PUCHAR) & pEid->Octet[8]; + ptr = (u8 *)& pEid->Octet[8]; for (i = 0; i < 4; i++) { - UCHAR aci = (*ptr & 0x60) >> 5; /* b5~6 is AC INDEX */ + u8 aci = (*ptr & 0x60) >> 5; /* b5~6 is AC INDEX */ pEdcaParm->bACM[aci] = (((*ptr) & 0x10) == 0x10); /* b5 is ACM */ pEdcaParm->Aifsn[aci] = (*ptr) & 0x0f; /* b0~3 is AIFSN */ pEdcaParm->Cwmin[aci] = *(ptr + 1) & 0x0f; /* b0~4 is Cwmin */ @@ -237,7 +237,7 @@ BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen } Length = Length + 2 + pEid->Len; - pEid = (PEID_STRUCT) ((UCHAR *) pEid + 2 + pEid->Len); + pEid = (PEID_STRUCT) ((u8 *) pEid + 2 + pEid->Len); } return TRUE; @@ -255,14 +255,14 @@ BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen ========================================================================== */ BOOLEAN PeerProbeReqSanity(IN PRTMP_ADAPTER pAd, - IN VOID * Msg, - IN ULONG MsgLen, - OUT PUCHAR pAddr2, - OUT CHAR Ssid[], OUT UCHAR * pSsidLen) + void * Msg, + unsigned long MsgLen, + u8 *pAddr2, + char Ssid[], u8 * pSsidLen) { - UCHAR Idx; - UCHAR RateLen; - CHAR IeType; + u8 Idx; + u8 RateLen; + char IeType; PFRAME_802_11 pFrame = (PFRAME_802_11) Msg; COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); @@ -304,15 +304,15 @@ BOOLEAN PeerProbeReqSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ -BOOLEAN GetTimBit(IN CHAR * Ptr, - IN USHORT Aid, - OUT UCHAR * TimLen, - OUT UCHAR * BcastFlag, - OUT UCHAR * DtimCount, - OUT UCHAR * DtimPeriod, OUT UCHAR * MessageToMe) +BOOLEAN GetTimBit(char * Ptr, + u16 Aid, + u8 * TimLen, + u8 * BcastFlag, + u8 * DtimCount, + u8 * DtimPeriod, u8 * MessageToMe) { - UCHAR BitCntl, N1, N2, MyByte, MyBit; - CHAR *IdxPtr; + u8 BitCntl, N1, N2, MyByte, MyBit; + char *IdxPtr; IdxPtr = Ptr; diff --git a/drivers/staging/rt2860/sta/sync.c b/drivers/staging/rt2860/sta/sync.c index 12ab2d40b0b9..448e75f0df16 100644 --- a/drivers/staging/rt2860/sta/sync.c +++ b/drivers/staging/rt2860/sta/sync.c @@ -50,7 +50,7 @@ ========================================================================== */ -VOID SyncStateMachineInit(IN PRTMP_ADAPTER pAd, +void SyncStateMachineInit(IN PRTMP_ADAPTER pAd, IN STATE_MACHINE * Sm, OUT STATE_MACHINE_FUNC Trans[]) { StateMachineInit(Sm, Trans, MAX_SYNC_STATE, MAX_SYNC_MSG, @@ -111,9 +111,9 @@ VOID SyncStateMachineInit(IN PRTMP_ADAPTER pAd, ========================================================================== */ -VOID BeaconTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) +void BeaconTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3) { RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; @@ -126,7 +126,7 @@ VOID BeaconTimeout(IN PVOID SystemSpecific1, if ((pAd->CommonCfg.BBPCurrentBW == BW_40) ) { - UCHAR BBPValue = 0; + u8 BBPValue = 0; AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue); @@ -151,9 +151,9 @@ VOID BeaconTimeout(IN PVOID SystemSpecific1, ========================================================================== */ -VOID ScanTimeout(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, IN PVOID SystemSpecific3) +void ScanTimeout(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, void *SystemSpecific3) { RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; @@ -183,15 +183,15 @@ VOID ScanTimeout(IN PVOID SystemSpecific1, MLME SCAN req state machine procedure ========================================================================== */ -VOID MlmeScanReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeScanReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Ssid[MAX_LEN_OF_SSID], SsidLen, ScanType, BssType, BBPValue = 0; + u8 Ssid[MAX_LEN_OF_SSID], SsidLen, ScanType, BssType, BBPValue = 0; BOOLEAN TimerCancelled; - ULONG Now; - USHORT Status; + unsigned long Now; + u16 Status; PHEADER_802_11 pHdr80211; - PUCHAR pOutBuffer = NULL; - NDIS_STATUS NStatus; + u8 *pOutBuffer = NULL; + int NStatus; /* Check the total scan tries for one single OID command */ /* If this is the CCX 2.0 Case, skip that! */ @@ -225,7 +225,7 @@ VOID MlmeScanReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if (MlmeScanReqSanity(pAd, Elem->Msg, Elem->MsgLen, - &BssType, (PCHAR) Ssid, &SsidLen, &ScanType)) { + &BssType, (char *)Ssid, &SsidLen, &ScanType)) { /* Check for channel load and noise hist request */ /* Suspend MSDU only at scan request, not the last two mentioned */ @@ -239,7 +239,7 @@ VOID MlmeScanReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /* */ if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED) && (INFRA_ON(pAd))) { - NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); + NStatus = MlmeAllocateMemory(pAd, (void *)& pOutBuffer); if (NStatus == NDIS_STATUS_SUCCESS) { pHdr80211 = (PHEADER_802_11) pOutBuffer; MgtMacHeaderInit(pAd, pHdr80211, @@ -297,21 +297,21 @@ VOID MlmeScanReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MLME JOIN req state machine procedure ========================================================================== */ -VOID MlmeJoinReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeJoinReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR BBPValue = 0; + u8 BBPValue = 0; BSS_ENTRY *pBss; BOOLEAN TimerCancelled; HEADER_802_11 Hdr80211; - NDIS_STATUS NStatus; - ULONG FrameLen = 0; - PUCHAR pOutBuffer = NULL; - PUCHAR pSupRate = NULL; - UCHAR SupRateLen; - PUCHAR pExtRate = NULL; - UCHAR ExtRateLen; - UCHAR ASupRate[] = { 0x8C, 0x12, 0x98, 0x24, 0xb0, 0x48, 0x60, 0x6C }; - UCHAR ASupRateLen = sizeof(ASupRate) / sizeof(UCHAR); + int NStatus; + unsigned long FrameLen = 0; + u8 *pOutBuffer = NULL; + u8 *pSupRate = NULL; + u8 SupRateLen; + u8 *pExtRate = NULL; + u8 ExtRateLen; + u8 ASupRate[] = { 0x8C, 0x12, 0x98, 0x24, 0xb0, 0x48, 0x60, 0x6C }; + u8 ASupRateLen = sizeof(ASupRate) / sizeof(u8); MLME_JOIN_REQ_STRUCT *pInfo = (MLME_JOIN_REQ_STRUCT *) (Elem->Msg); DBGPRINT(RT_DEBUG_TRACE, @@ -409,7 +409,7 @@ VOID MlmeJoinReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) END_OF_ARGS); if (ExtRateLen) { - ULONG Tmp; + unsigned long Tmp; MakeOutgoingFrame(pOutBuffer + FrameLen, &Tmp, 1, &ExtRateIe, 1, &ExtRateLen, @@ -437,17 +437,17 @@ VOID MlmeJoinReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MLME START Request state machine procedure, starting an IBSS ========================================================================== */ -VOID MlmeStartReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeStartReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Ssid[MAX_LEN_OF_SSID], SsidLen; + u8 Ssid[MAX_LEN_OF_SSID], SsidLen; BOOLEAN TimerCancelled; /* New for WPA security suites */ - UCHAR VarIE[MAX_VIE_LEN]; /* Total VIE length = MAX_VIE_LEN - -5 */ + u8 VarIE[MAX_VIE_LEN]; /* Total VIE length = MAX_VIE_LEN - -5 */ NDIS_802_11_VARIABLE_IEs *pVIE = NULL; LARGE_INTEGER TimeStamp; BOOLEAN Privacy; - USHORT Status; + u16 Status; /* Init Variable IE structure */ pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; @@ -456,7 +456,7 @@ VOID MlmeStartReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) TimeStamp.u.HighPart = 0; if (MlmeStartReqSanity - (pAd, Elem->Msg, Elem->MsgLen, (PCHAR) Ssid, &SsidLen)) { + (pAd, Elem->Msg, Elem->MsgLen, (char *)Ssid, &SsidLen)) { /* reset all the timers */ RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &TimerCancelled); RTMPCancelTimer(&pAd->MlmeAux.BeaconTimer, &TimerCancelled); @@ -550,33 +550,33 @@ VOID MlmeStartReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) peer sends beacon back when scanning ========================================================================== */ -VOID PeerBeaconAtScanAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerBeaconAtScanAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Bssid[MAC_ADDR_LEN], Addr2[MAC_ADDR_LEN]; - UCHAR Ssid[MAX_LEN_OF_SSID], BssType, Channel, NewChannel, + u8 Bssid[MAC_ADDR_LEN], Addr2[MAC_ADDR_LEN]; + u8 Ssid[MAX_LEN_OF_SSID], BssType, Channel, NewChannel, SsidLen, DtimCount, DtimPeriod, BcastFlag, MessageToMe; CF_PARM CfParm; - USHORT BeaconPeriod, AtimWin, CapabilityInfo; + u16 BeaconPeriod, AtimWin, CapabilityInfo; PFRAME_802_11 pFrame; LARGE_INTEGER TimeStamp; - UCHAR Erp; - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], + u8 Erp; + u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen, ExtRateLen; - USHORT LenVIE; - UCHAR CkipFlag; - UCHAR AironetCellPowerLimit; + u8 SupRateLen, ExtRateLen; + u16 LenVIE; + u8 CkipFlag; + u8 AironetCellPowerLimit; EDCA_PARM EdcaParm; QBSS_LOAD_PARM QbssLoad; QOS_CAPABILITY_PARM QosCapability; - ULONG RalinkIe; - UCHAR VarIE[MAX_VIE_LEN]; /* Total VIE length = MAX_VIE_LEN - -5 */ + unsigned long RalinkIe; + u8 VarIE[MAX_VIE_LEN]; /* Total VIE length = MAX_VIE_LEN - -5 */ NDIS_802_11_VARIABLE_IEs *pVIE = NULL; HT_CAPABILITY_IE HtCapability; ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ - UCHAR HtCapabilityLen = 0, PreNHtCapabilityLen = 0; - UCHAR AddHtInfoLen; - UCHAR NewExtChannelOffset = 0xff; + u8 HtCapabilityLen = 0, PreNHtCapabilityLen = 0; + u8 AddHtInfoLen; + u8 NewExtChannelOffset = 0xff; /* NdisFillMemory(Ssid, MAX_LEN_OF_SSID, 0x00); */ pFrame = (PFRAME_802_11) Elem->Msg; @@ -593,7 +593,7 @@ VOID PeerBeaconAtScanAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Elem->Channel, Addr2, Bssid, - (PCHAR) Ssid, + (char *)Ssid, &SsidLen, &BssType, &BeaconPeriod, @@ -624,8 +624,8 @@ VOID PeerBeaconAtScanAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) &AddHtInfoLen, &AddHtInfo, &NewExtChannelOffset, &LenVIE, pVIE)) { - ULONG Idx; - CHAR Rssi = 0; + unsigned long Idx; + char Rssi = 0; Idx = BssTableSearch(&pAd->ScanTab, Bssid, Channel); if (Idx != BSS_NOT_FOUND) @@ -640,7 +640,7 @@ VOID PeerBeaconAtScanAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) HtCapabilityLen = SIZE_HT_CAP_IE; Idx = - BssTableSetEntry(pAd, &pAd->ScanTab, Bssid, (PCHAR) Ssid, + BssTableSetEntry(pAd, &pAd->ScanTab, Bssid, (char *)Ssid, SsidLen, BssType, BeaconPeriod, &CfParm, AtimWin, CapabilityInfo, SupRate, SupRateLen, ExtRate, ExtRateLen, @@ -668,36 +668,36 @@ VOID PeerBeaconAtScanAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) When waiting joining the (I)BSS, beacon received from external ========================================================================== */ -VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Bssid[MAC_ADDR_LEN], Addr2[MAC_ADDR_LEN]; - UCHAR Ssid[MAX_LEN_OF_SSID], SsidLen, BssType, Channel, MessageToMe, + u8 Bssid[MAC_ADDR_LEN], Addr2[MAC_ADDR_LEN]; + u8 Ssid[MAX_LEN_OF_SSID], SsidLen, BssType, Channel, MessageToMe, DtimCount, DtimPeriod, BcastFlag, NewChannel; LARGE_INTEGER TimeStamp; - USHORT BeaconPeriod, AtimWin, CapabilityInfo; + u16 BeaconPeriod, AtimWin, CapabilityInfo; CF_PARM Cf; BOOLEAN TimerCancelled; - UCHAR Erp; - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], + u8 Erp; + u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen, ExtRateLen; - UCHAR CkipFlag; - USHORT LenVIE; - UCHAR AironetCellPowerLimit; + u8 SupRateLen, ExtRateLen; + u8 CkipFlag; + u16 LenVIE; + u8 AironetCellPowerLimit; EDCA_PARM EdcaParm; QBSS_LOAD_PARM QbssLoad; QOS_CAPABILITY_PARM QosCapability; - USHORT Status; - UCHAR VarIE[MAX_VIE_LEN]; /* Total VIE length = MAX_VIE_LEN - -5 */ + u16 Status; + u8 VarIE[MAX_VIE_LEN]; /* Total VIE length = MAX_VIE_LEN - -5 */ NDIS_802_11_VARIABLE_IEs *pVIE = NULL; - ULONG RalinkIe; - ULONG Idx; + unsigned long RalinkIe; + unsigned long Idx; HT_CAPABILITY_IE HtCapability; ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ - UCHAR HtCapabilityLen = 0, PreNHtCapabilityLen = 0; - UCHAR AddHtInfoLen; - UCHAR NewExtChannelOffset = 0xff; - UCHAR CentralChannel; + u8 HtCapabilityLen = 0, PreNHtCapabilityLen = 0; + u8 AddHtInfoLen; + u8 NewExtChannelOffset = 0xff; + u8 CentralChannel; BOOLEAN bAllowNrate = FALSE; /* Init Variable IE structure */ @@ -712,7 +712,7 @@ VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Elem->Channel, Addr2, Bssid, - (PCHAR) Ssid, + (char *)Ssid, &SsidLen, &BssType, &BeaconPeriod, @@ -798,7 +798,7 @@ VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Channel); if (Idx == BSS_NOT_FOUND) { - CHAR Rssi = 0; + char Rssi = 0; Rssi = RTMPMaxRssi(pAd, ConvertToRssi(pAd, @@ -816,7 +816,7 @@ VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Idx = BssTableSetEntry(pAd, &pAd->ScanTab, Bssid, - (CHAR *) Ssid, + (char *) Ssid, SsidLen, BssType, BeaconPeriod, &Cf, AtimWin, @@ -1041,35 +1041,35 @@ VOID PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Bssid[MAC_ADDR_LEN], Addr2[MAC_ADDR_LEN]; - CHAR Ssid[MAX_LEN_OF_SSID]; + u8 Bssid[MAC_ADDR_LEN], Addr2[MAC_ADDR_LEN]; + char Ssid[MAX_LEN_OF_SSID]; CF_PARM CfParm; - UCHAR SsidLen, MessageToMe = 0, BssType, Channel, NewChannel, index = 0; - UCHAR DtimCount = 0, DtimPeriod = 0, BcastFlag = 0; - USHORT CapabilityInfo, AtimWin, BeaconPeriod; + u8 SsidLen, MessageToMe = 0, BssType, Channel, NewChannel, index = 0; + u8 DtimCount = 0, DtimPeriod = 0, BcastFlag = 0; + u16 CapabilityInfo, AtimWin, BeaconPeriod; LARGE_INTEGER TimeStamp; - USHORT TbttNumToNextWakeUp; - UCHAR Erp; - UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES], + u16 TbttNumToNextWakeUp; + u8 Erp; + u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES], ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; - UCHAR SupRateLen, ExtRateLen; - UCHAR CkipFlag; - USHORT LenVIE; - UCHAR AironetCellPowerLimit; + u8 SupRateLen, ExtRateLen; + u8 CkipFlag; + u16 LenVIE; + u8 AironetCellPowerLimit; EDCA_PARM EdcaParm; QBSS_LOAD_PARM QbssLoad; QOS_CAPABILITY_PARM QosCapability; - ULONG RalinkIe; + unsigned long RalinkIe; /* New for WPA security suites */ - UCHAR VarIE[MAX_VIE_LEN]; /* Total VIE length = MAX_VIE_LEN - -5 */ + u8 VarIE[MAX_VIE_LEN]; /* Total VIE length = MAX_VIE_LEN - -5 */ NDIS_802_11_VARIABLE_IEs *pVIE = NULL; HT_CAPABILITY_IE HtCapability; ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ - UCHAR HtCapabilityLen, PreNHtCapabilityLen; - UCHAR AddHtInfoLen; - UCHAR NewExtChannelOffset = 0xff; + u8 HtCapabilityLen, PreNHtCapabilityLen; + u8 AddHtInfoLen; + u8 NewExtChannelOffset = 0xff; if (!(INFRA_ON(pAd) || ADHOC_ON(pAd) )) @@ -1119,9 +1119,9 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) &AddHtInfo, &NewExtChannelOffset, &LenVIE, pVIE)) { BOOLEAN is_my_bssid, is_my_ssid; - ULONG Bssidx, Now; + unsigned long Bssidx, Now; BSS_ENTRY *pBss; - CHAR RealRssi = + char RealRssi = RTMPMaxRssi(pAd, ConvertToRssi(pAd, Elem->Rssi0, RSSI_0), ConvertToRssi(pAd, Elem->Rssi1, RSSI_1), ConvertToRssi(pAd, Elem->Rssi2, RSSI_2)); @@ -1214,7 +1214,7 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /* if the ssid matched & bssid unmatched, we should select the bssid with large value. */ /* This might happened when two STA start at the same time */ if ((!is_my_bssid) && ADHOC_ON(pAd)) { - INT i; + int i; /* Add the safeguard against the mismatch of adhoc wep status */ if (pAd->StaCfg.WepStatus != @@ -1279,8 +1279,8 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } if (ADHOC_ON(pAd) && (CAP_IS_IBSS_ON(CapabilityInfo))) { - UCHAR MaxSupportedRateIn500Kbps = 0; - UCHAR idx; + u8 MaxSupportedRateIn500Kbps = 0; + u8 idx; MAC_TABLE_ENTRY *pEntry; /* supported rates array may not be sorted. sort it and find the maximum rate */ @@ -1516,7 +1516,7 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MlmeSetTxPreamble(pAd, Rt802_11PreambleLong); DBGPRINT(RT_DEBUG_TRACE, - ("SYNC - AP forced to use LONG preamble\n")); + ("SYNC - AP forced to use long preamble\n")); } if (OPSTATUS_TEST_FLAG @@ -1543,7 +1543,7 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /* only INFRASTRUCTURE mode support power-saving feature */ if ((INFRA_ON(pAd) && (pAd->StaCfg.Psm == PWR_SAVE)) || (pAd->CommonCfg.bAPSDForcePowerSave)) { - UCHAR FreeNumber; + u8 FreeNumber; /* 1. AP has backlogged unicast-to-me frame, stay AWAKE, send PSPOLL */ /* 2. AP has backlogged broadcast/multicast frame and we want those frames, stay AWAKE */ /* 3. we have outgoing frames in TxRing or MgmtRing, better stay AWAKE */ @@ -1660,7 +1660,7 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) due to MaxSPLength. */ } else { - USHORT NextDtim = DtimCount; + u16 NextDtim = DtimCount; if (NextDtim == 0) NextDtim = DtimPeriod; @@ -1703,22 +1703,22 @@ VOID PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Receive PROBE REQ from remote peer when operating in IBSS mode ========================================================================== */ -VOID PeerProbeReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerProbeReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - UCHAR Addr2[MAC_ADDR_LEN]; - CHAR Ssid[MAX_LEN_OF_SSID]; - UCHAR SsidLen; - UCHAR HtLen, AddHtLen, NewExtLen; + u8 Addr2[MAC_ADDR_LEN]; + char Ssid[MAX_LEN_OF_SSID]; + u8 SsidLen; + u8 HtLen, AddHtLen, NewExtLen; HEADER_802_11 ProbeRspHdr; - NDIS_STATUS NStatus; - PUCHAR pOutBuffer = NULL; - ULONG FrameLen = 0; + int NStatus; + u8 *pOutBuffer = NULL; + unsigned long FrameLen = 0; LARGE_INTEGER FakeTimestamp; - UCHAR DsLen = 1, IbssLen = 2; - UCHAR LocalErpIe[3] = { IE_ERP, 1, 0 }; + u8 DsLen = 1, IbssLen = 2; + u8 LocalErpIe[3] = { IE_ERP, 1, 0 }; BOOLEAN Privacy; - USHORT CapabilityInfo; - UCHAR RSNIe = IE_WPA; + u16 CapabilityInfo; + u8 RSNIe = IE_WPA; if (!ADHOC_ON(pAd)) return; @@ -1764,7 +1764,7 @@ VOID PeerProbeReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) &pAd->StaActive.AtimWin, END_OF_ARGS); if (pAd->StaActive.ExtRateLen) { - ULONG tmp; + unsigned long tmp; MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, 3, LocalErpIe, 1, &ExtRateIe, @@ -1776,7 +1776,7 @@ VOID PeerProbeReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } /* If adhoc secruity is set for WPA-None, append the cipher suite IE */ if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone) { - ULONG tmp; + unsigned long tmp; MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp, 1, &RSNIe, 1, &pAd->StaCfg.RSNIE_Len, @@ -1787,8 +1787,8 @@ VOID PeerProbeReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) { - ULONG TmpLen; - UCHAR BROADCOM[4] = { 0x0, 0x90, 0x4c, 0x33 }; + unsigned long TmpLen; + u8 BROADCOM[4] = { 0x0, 0x90, 0x4c, 0x33 }; HtLen = sizeof(pAd->CommonCfg.HtCapability); AddHtLen = sizeof(pAd->CommonCfg.AddHTInfo); NewExtLen = 1; @@ -1833,9 +1833,9 @@ VOID PeerProbeReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } -VOID BeaconTimeoutAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void BeaconTimeoutAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Status; + u16 Status; DBGPRINT(RT_DEBUG_TRACE, ("SYNC - BeaconTimeoutAtJoinAction\n")); pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE; Status = MLME_REJ_TIMEOUT; @@ -1848,7 +1848,7 @@ VOID BeaconTimeoutAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Scan timeout procedure. basically add channel index by 1 and rescan ========================================================================== */ -VOID ScanTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void ScanTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { pAd->MlmeAux.Channel = NextChannel(pAd, pAd->MlmeAux.Channel); @@ -1868,9 +1868,9 @@ VOID ScanTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Description: ========================================================================== */ -VOID InvalidStateWhenScan(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void InvalidStateWhenScan(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Status; + u16 Status; DBGPRINT(RT_DEBUG_TRACE, ("AYNC - InvalidStateWhenScan(state=%ld). Reset SYNC machine\n", pAd->Mlme.SyncMachine.CurrState)); @@ -1884,9 +1884,9 @@ VOID InvalidStateWhenScan(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Description: ========================================================================== */ -VOID InvalidStateWhenJoin(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void InvalidStateWhenJoin(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Status; + u16 Status; DBGPRINT(RT_DEBUG_TRACE, ("InvalidStateWhenJoin(state=%ld). Reset SYNC machine\n", pAd->Mlme.SyncMachine.CurrState)); @@ -1900,9 +1900,9 @@ VOID InvalidStateWhenJoin(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Description: ========================================================================== */ -VOID InvalidStateWhenStart(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void InvalidStateWhenStart(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - USHORT Status; + u16 Status; DBGPRINT(RT_DEBUG_TRACE, ("InvalidStateWhenStart(state=%ld). Reset SYNC machine\n", pAd->Mlme.SyncMachine.CurrState)); @@ -1919,12 +1919,12 @@ VOID InvalidStateWhenStart(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -VOID EnqueuePsPoll(IN PRTMP_ADAPTER pAd) +void EnqueuePsPoll(IN PRTMP_ADAPTER pAd) { if (pAd->StaCfg.WindowsPowerMode == Ndis802_11PowerModeLegacy_PSP) pAd->PsPollFrame.FC.PwrMgmt = PWR_SAVE; - MiniportMMRequest(pAd, 0, (PUCHAR) & pAd->PsPollFrame, + MiniportMMRequest(pAd, 0, (u8 *)& pAd->PsPollFrame, sizeof(PSPOLL_FRAME)); } @@ -1933,11 +1933,11 @@ VOID EnqueuePsPoll(IN PRTMP_ADAPTER pAd) Description: ========================================================================== */ -VOID EnqueueProbeRequest(IN PRTMP_ADAPTER pAd) +void EnqueueProbeRequest(IN PRTMP_ADAPTER pAd) { - NDIS_STATUS NState; - PUCHAR pOutBuffer; - ULONG FrameLen = 0; + int NState; + u8 *pOutBuffer; + unsigned long FrameLen = 0; HEADER_802_11 Hdr80211; DBGPRINT(RT_DEBUG_TRACE, ("force out a ProbeRequest ...\n")); diff --git a/drivers/staging/rt2860/sta/wpa.c b/drivers/staging/rt2860/sta/wpa.c index 15ed01e5efb0..abc730b6565f 100644 --- a/drivers/staging/rt2860/sta/wpa.c +++ b/drivers/staging/rt2860/sta/wpa.c @@ -37,7 +37,7 @@ */ #include "../rt_config.h" -void inc_byte_array(UCHAR * counter, int len); +void inc_byte_array(u8 * counter, int len); /* ======================================================================== @@ -58,10 +58,10 @@ void inc_byte_array(UCHAR * counter, int len); ======================================================================== */ -VOID RTMPReportMicError(IN PRTMP_ADAPTER pAd, IN PCIPHER_KEY pWpaKey) +void RTMPReportMicError(IN PRTMP_ADAPTER pAd, IN PCIPHER_KEY pWpaKey) { - ULONG Now; - UCHAR unicastKey = (pWpaKey->Type == PAIRWISE_KEY ? 1 : 0); + unsigned long Now; + u8 unicastKey = (pWpaKey->Type == PAIRWISE_KEY ? 1 : 0); /* Record Last MIC error time and count */ NdisGetSystemUpTime(&Now); @@ -113,12 +113,12 @@ VOID RTMPReportMicError(IN PRTMP_ADAPTER pAd, IN PCIPHER_KEY pWpaKey) #define LENGTH_EAP_H 4 /* If the received frame is EAP-Packet ,find out its EAP-Code (Request(0x01), Response(0x02), Success(0x03), Failure(0x04)). */ -INT WpaCheckEapCode(IN PRTMP_ADAPTER pAd, - IN PUCHAR pFrame, IN USHORT FrameLen, IN USHORT OffSet) +int WpaCheckEapCode(IN PRTMP_ADAPTER pAd, + u8 *pFrame, u16 FrameLen, u16 OffSet) { - PUCHAR pData; - INT result = 0; + u8 *pData; + int result = 0; if (FrameLen < OffSet + LENGTH_EAPOL_H + LENGTH_EAP_H) return result; @@ -133,7 +133,7 @@ INT WpaCheckEapCode(IN PRTMP_ADAPTER pAd, return result; } -VOID WpaSendMicFailureToWpaSupplicant(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUnicast) +void WpaSendMicFailureToWpaSupplicant(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUnicast) { char custom[IW_CUSTOM_MAX] = { 0 }; @@ -141,19 +141,19 @@ VOID WpaSendMicFailureToWpaSupplicant(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUnicast) if (bUnicast) sprintf(custom, "%s unicast", custom); - RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, -1, NULL, (PUCHAR) custom, + RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, -1, NULL, (u8 *)custom, strlen(custom)); return; } -VOID WpaMicFailureReportFrame(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void WpaMicFailureReportFrame(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { - PUCHAR pOutBuffer = NULL; - UCHAR Header802_3[14]; - ULONG FrameLen = 0; + u8 *pOutBuffer = NULL; + u8 Header802_3[14]; + unsigned long FrameLen = 0; EAPOL_PACKET Packet; - UCHAR Mic[16]; + u8 Mic[16]; BOOLEAN bUnicast; DBGPRINT(RT_DEBUG_TRACE, ("WpaMicFailureReportFrame ----->\n")); @@ -190,30 +190,30 @@ VOID WpaMicFailureReportFrame(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Packet.KeyDesc.KeyInfo.Error = 1; /* Update packet length after decide Key data payload */ - SET_UINT16_TO_ARRARY(Packet.Body_Len, LEN_EAPOL_KEY_MSG) + SET_u16_TO_ARRARY(Packet.Body_Len, LEN_EAPOL_KEY_MSG) /* Key Replay Count */ NdisMoveMemory(Packet.KeyDesc.ReplayCounter, pAd->StaCfg.ReplayCounter, LEN_KEY_DESC_REPLAY); inc_byte_array(pAd->StaCfg.ReplayCounter, 8); /* Convert to little-endian format. */ - *((USHORT *) & Packet.KeyDesc.KeyInfo) = - cpu2le16(*((USHORT *) & Packet.KeyDesc.KeyInfo)); + *((u16 *) & Packet.KeyDesc.KeyInfo) = + cpu2le16(*((u16 *) & Packet.KeyDesc.KeyInfo)); - MlmeAllocateMemory(pAd, (PUCHAR *) & pOutBuffer); /* allocate memory */ + MlmeAllocateMemory(pAd, (u8 **) & pOutBuffer); /* allocate memory */ if (pOutBuffer == NULL) { return; } /* Prepare EAPOL frame for MIC calculation */ /* Be careful, only EAPOL frame is counted for MIC calculation */ MakeOutgoingFrame(pOutBuffer, &FrameLen, - CONV_ARRARY_TO_UINT16(Packet.Body_Len) + 4, &Packet, + CONV_ARRARY_TO_u16(Packet.Body_Len) + 4, &Packet, END_OF_ARGS); /* Prepare and Fill MIC value */ NdisZeroMemory(Mic, sizeof(Mic)); if (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) { /* AES */ - UCHAR digest[20] = { 0 }; + u8 digest[20] = { 0 }; HMAC_SHA1(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, digest, SHA1_DIGEST_SIZE); NdisMoveMemory(Mic, digest, LEN_KEY_DESC_MIC); @@ -226,10 +226,10 @@ VOID WpaMicFailureReportFrame(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /* copy frame to Tx ring and send MIC failure report frame to authenticator */ RTMPToWirelessSta(pAd, &pAd->MacTab.Content[BSSID_WCID], Header802_3, LENGTH_802_3, - (PUCHAR) & Packet, - CONV_ARRARY_TO_UINT16(Packet.Body_Len) + 4, FALSE); + (u8 *)& Packet, + CONV_ARRARY_TO_u16(Packet.Body_Len) + 4, FALSE); - MlmeFreeMemory(pAd, (PUCHAR) pOutBuffer); + MlmeFreeMemory(pAd, (u8 *)pOutBuffer); DBGPRINT(RT_DEBUG_TRACE, ("WpaMicFailureReportFrame <-----\n")); } @@ -243,7 +243,7 @@ VOID WpaMicFailureReportFrame(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) * rolling over to more significant bytes if the byte was incremented from * 0xff to 0x00. */ -void inc_byte_array(UCHAR * counter, int len) +void inc_byte_array(u8 * counter, int len) { int pos = len - 1; while (pos >= 0) { @@ -254,10 +254,10 @@ void inc_byte_array(UCHAR * counter, int len) } } -VOID WpaDisassocApAndBlockAssoc(IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) +void WpaDisassocApAndBlockAssoc(void *SystemSpecific1, + void *FunctionContext, + void *SystemSpecific2, + void *SystemSpecific3) { RTMP_ADAPTER *pAd = (PRTMP_ADAPTER) FunctionContext; MLME_DISASSOC_REQ_STRUCT DisassocReq; @@ -274,7 +274,7 @@ VOID WpaDisassocApAndBlockAssoc(IN PVOID SystemSpecific1, pAd->StaCfg.bBlockAssoc = TRUE; } -VOID WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd) +void WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd) { PCIPHER_KEY pSharedKey; PMAC_TABLE_ENTRY pEntry; @@ -330,7 +330,7 @@ VOID WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd) } -VOID WpaStaGroupKeySetting(IN PRTMP_ADAPTER pAd) +void WpaStaGroupKeySetting(IN PRTMP_ADAPTER pAd) { PCIPHER_KEY pSharedKey; diff --git a/drivers/staging/rt2860/sta_ioctl.c b/drivers/staging/rt2860/sta_ioctl.c index d92a41e9b551..88a792270e90 100644 --- a/drivers/staging/rt2860/sta_ioctl.c +++ b/drivers/staging/rt2860/sta_ioctl.c @@ -40,7 +40,7 @@ #include "rt_config.h" #ifdef DBG -extern ULONG RTDebugLevel; +extern unsigned long RTDebugLevel; #endif #define NR_WEP_KEYS 4 @@ -49,16 +49,16 @@ extern ULONG RTDebugLevel; #define GROUP_KEY_NO 4 -extern UCHAR CipherWpa2Template[]; +extern u8 CipherWpa2Template[]; typedef struct PACKED _RT_VERSION_INFO { - UCHAR DriverVersionW; - UCHAR DriverVersionX; - UCHAR DriverVersionY; - UCHAR DriverVersionZ; - UINT DriverBuildYear; - UINT DriverBuildMonth; - UINT DriverBuildDay; + u8 DriverVersionW; + u8 DriverVersionX; + u8 DriverVersionY; + u8 DriverVersionZ; + u32 DriverBuildYear; + u32 DriverBuildMonth; + u32 DriverBuildDay; } RT_VERSION_INFO, *PRT_VERSION_INFO; static __s32 ralinkrate[] = { 2, 4, 11, 22, /* CCK */ @@ -73,13 +73,13 @@ static __s32 ralinkrate[] = { 2, 4, 11, 22, /* CCK */ 90, 180, 270, 360, 540, 720, 810, 900 }; -INT Set_SSID_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg); +int Set_SSID_Proc(IN PRTMP_ADAPTER pAdapter, char *arg); -INT Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg); +int Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, char *arg); -VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) +void RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) { - ULONG KeyIdx; + unsigned long KeyIdx; MAC_TABLE_ENTRY *pEntry; DBGPRINT(RT_DEBUG_TRACE, ("RTMPAddKey ------>\n")); @@ -260,8 +260,8 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) } } else /* dynamic WEP from wpa_supplicant */ { - UCHAR CipherAlg; - PUCHAR Key; + u8 CipherAlg; + u8 *Key; if (pKey->KeyLength == 32) goto end; @@ -279,7 +279,7 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) /* set key material and key length */ pEntry->PairwiseKey.KeyLen = - (UCHAR) pKey->KeyLength; + (u8)pKey->KeyLength; NdisMoveMemory(pEntry->PairwiseKey.Key, &pKey->KeyMaterial, pKey->KeyLength); @@ -295,7 +295,7 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) /* Add Pair-wise key to Asic */ AsicAddPairwiseKeyEntry(pAd, pEntry->Addr, - (UCHAR) pEntry-> + (u8)pEntry-> Aid, &pEntry-> PairwiseKey); @@ -310,11 +310,11 @@ VOID RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) } } else { /* Default key for tx (shared key) */ - pAd->StaCfg.DefaultKeyId = (UCHAR) KeyIdx; + pAd->StaCfg.DefaultKeyId = (u8)KeyIdx; /* set key material and key length */ pAd->SharedKey[BSS0][KeyIdx].KeyLen = - (UCHAR) pKey->KeyLength; + (u8)pKey->KeyLength; NdisMoveMemory(pAd->SharedKey[BSS0][KeyIdx].Key, &pKey->KeyMaterial, pKey->KeyLength); @@ -408,8 +408,8 @@ int rt_ioctl_giwfreq(struct net_device *dev, struct iw_freq *freq, char *extra) { PRTMP_ADAPTER pAdapter = NULL; - UCHAR ch; - ULONG m = 2412000; + u8 ch; + unsigned long m = 2412000; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -613,7 +613,7 @@ int rt_ioctl_siwap(struct net_device *dev, MlmeEnqueue(pAdapter, MLME_CNTL_STATE_MACHINE, OID_802_11_BSSID, - sizeof(NDIS_802_11_MAC_ADDRESS), (VOID *) & Bssid); + sizeof(NDIS_802_11_MAC_ADDRESS), (void *) & Bssid); DBGPRINT(RT_DEBUG_TRACE, ("IOCTL::SIOCSIWAP %02x:%02x:%02x:%02x:%02x:%02x\n", Bssid[0], @@ -728,7 +728,7 @@ int rt_ioctl_siwscan(struct net_device *dev, { PRTMP_ADAPTER pAdapter = NULL; - ULONG Now; + unsigned long Now; int Status = NDIS_STATUS_SUCCESS; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -804,10 +804,10 @@ int rt_ioctl_giwscan(struct net_device *dev, { PRTMP_ADAPTER pAdapter = NULL; int i = 0; - PSTRING current_ev = extra, previous_ev = extra; - PSTRING end_buf; - PSTRING current_val; - STRING custom[MAX_CUSTOM_LEN] = { 0 }; + char *current_ev = extra, *previous_ev = extra; + char *end_buf; + char *current_val; + char custom[MAX_CUSTOM_LEN] = { 0 }; struct iw_event iwe; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -945,7 +945,7 @@ int rt_ioctl_giwscan(struct net_device *dev, previous_ev = current_ev; current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, - (PSTRING) pAdapter->ScanTab. + (char *)pAdapter->ScanTab. BssEntry[i].Ssid); if (current_ev == previous_ev) return -E2BIG; @@ -1027,7 +1027,7 @@ int rt_ioctl_giwscan(struct net_device *dev, /*Bit Rate */ /*================================ */ if (pAdapter->ScanTab.BssEntry[i].SupRateLen) { - UCHAR tmpRate = + u8 tmpRate = pAdapter->ScanTab.BssEntry[i].SupRate[pAdapter-> ScanTab. BssEntry[i]. @@ -1062,8 +1062,8 @@ int rt_ioctl_giwscan(struct net_device *dev, pAdapter->ScanTab.BssEntry[i].HtCapability. MCSSet[1] ? 15 : 7; int rate_index = - 12 + ((UCHAR) capInfo.ChannelWidth * 24) + - ((UCHAR) shortGI * 48) + ((UCHAR) maxMCS); + 12 + ((u8)capInfo.ChannelWidth * 24) + + ((u8)shortGI * 48) + ((u8)maxMCS); if (rate_index < 0) rate_index = 0; if (rate_index > rate_count) @@ -1140,7 +1140,7 @@ int rt_ioctl_siwessid(struct net_device *dev, } if (data->flags) { - PSTRING pSsidString = NULL; + char *pSsidString = NULL; /* Includes null character. */ if (data->length > (IW_ESSID_MAX_SIZE + 1)) @@ -1231,8 +1231,8 @@ int rt_ioctl_giwnickn(struct net_device *dev, GET_PAD_FROM_NET_DEV(pAdapter, dev); - if (data->length > strlen((PSTRING) pAdapter->nickname) + 1) - data->length = strlen((PSTRING) pAdapter->nickname) + 1; + if (data->length > strlen((char *)pAdapter->nickname) + 1) + data->length = strlen((char *)pAdapter->nickname) + 1; if (data->length > 0) { memcpy(nickname, pAdapter->nickname, data->length - 1); nickname[data->length - 1] = '\0'; @@ -1506,9 +1506,9 @@ rt_ioctl_giwencode(struct net_device *dev, } -void getBaInfo(IN PRTMP_ADAPTER pAd, IN PSTRING pOutBuf) +void getBaInfo(IN PRTMP_ADAPTER pAd, char *pOutBuf) { - INT i, j; + int i, j; BA_ORI_ENTRY *pOriBAEntry; BA_REC_ENTRY *pRecBAEntry; @@ -1816,8 +1816,8 @@ int rt_ioctl_giwauth(struct net_device *dev, } void fnSetCipherKey(IN PRTMP_ADAPTER pAdapter, - IN INT keyIdx, - IN UCHAR CipherAlg, + int keyIdx, + u8 CipherAlg, IN BOOLEAN bGTK, IN struct iw_encode_ext *ext) { NdisZeroMemory(&pAdapter->SharedKey[BSS0][keyIdx], sizeof(CIPHER_KEY)); @@ -1881,7 +1881,7 @@ int rt_ioctl_siwencodeext(struct net_device *dev, AsicRemovePairwiseKeyEntry(pAdapter, BSS0, BSSID_WCID); pAdapter->SharedKey[BSS0][keyIdx].KeyLen = 0; pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = CIPHER_NONE; - AsicRemoveSharedKeyEntry(pAdapter, 0, (UCHAR) keyIdx); + AsicRemoveSharedKeyEntry(pAdapter, 0, (u8)keyIdx); NdisZeroMemory(&pAdapter->SharedKey[BSS0][keyIdx], sizeof(CIPHER_KEY)); DBGPRINT(RT_DEBUG_TRACE, @@ -2019,7 +2019,7 @@ rt_ioctl_giwencodeext(struct net_device *dev, union iwreq_data *wrqu, char *extra) { PRTMP_ADAPTER pAd = NULL; - PCHAR pKey = NULL; + char *pKey = NULL; struct iw_point *encoding = &wrqu->encoding; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; int idx, max_key_len; @@ -2063,7 +2063,7 @@ rt_ioctl_giwencodeext(struct net_device *dev, return -E2BIG; else { ext->key_len = pAd->SharedKey[BSS0][idx].KeyLen; - pKey = (PCHAR) & (pAd->SharedKey[BSS0][idx].Key[0]); + pKey = (char *)& (pAd->SharedKey[BSS0][idx].Key[0]); } break; case Ndis802_11Encryption2Enabled: @@ -2077,7 +2077,7 @@ rt_ioctl_giwencodeext(struct net_device *dev, return -E2BIG; else { ext->key_len = 32; - pKey = (PCHAR) & pAd->StaCfg.PMK[0]; + pKey = (char *)& pAd->StaCfg.PMK[0]; } break; default: @@ -2140,7 +2140,7 @@ int rt_ioctl_giwgenie(struct net_device *dev, wrqu->data.length = pAd->StaCfg.RSNIE_Len; memcpy(extra, &pAd->StaCfg.RSN_IE[0], pAd->StaCfg.RSNIE_Len); } else { - UCHAR RSNIe = IE_WPA; + u8 RSNIe = IE_WPA; if (wrqu->data.length < (pAd->StaCfg.RSNIE_Len + 2)) /* ID, Len */ return -E2BIG; @@ -2165,7 +2165,7 @@ int rt_ioctl_siwpmksa(struct net_device *dev, { PRTMP_ADAPTER pAd = NULL; struct iw_pmksa *pPmksa = (struct iw_pmksa *)wrqu->data.pointer; - INT CachedIdx = 0, idx = 0; + int CachedIdx = 0, idx = 0; GET_PAD_FROM_NET_DEV(pAd, dev); @@ -2268,7 +2268,7 @@ int rt_ioctl_siwrate(struct net_device *dev, union iwreq_data *wrqu, char *extra) { PRTMP_ADAPTER pAd = NULL; - UINT32 rate = wrqu->bitrate.value, fixed = wrqu->bitrate.fixed; + u32 rate = wrqu->bitrate.value, fixed = wrqu->bitrate.fixed; GET_PAD_FROM_NET_DEV(pAd, dev); @@ -2359,15 +2359,15 @@ int rt_ioctl_giwrate(struct net_device *dev, pAd->MacTab.Content[BSSID_WCID].HTPhyMode.word; if (ht_setting.field.MODE >= MODE_HTMIX) { -/* rate_index = 12 + ((UCHAR)ht_setting.field.BW *16) + ((UCHAR)ht_setting.field.ShortGI *32) + ((UCHAR)ht_setting.field.MCS); */ +/* rate_index = 12 + ((u8)ht_setting.field.BW *16) + ((u8)ht_setting.field.ShortGI *32) + ((u8)ht_setting.field.MCS); */ rate_index = - 12 + ((UCHAR) ht_setting.field.BW * 24) + - ((UCHAR) ht_setting.field.ShortGI * 48) + - ((UCHAR) ht_setting.field.MCS); + 12 + ((u8)ht_setting.field.BW * 24) + + ((u8)ht_setting.field.ShortGI * 48) + + ((u8)ht_setting.field.MCS); } else if (ht_setting.field.MODE == MODE_OFDM) - rate_index = (UCHAR) (ht_setting.field.MCS) + 4; + rate_index = (u8)(ht_setting.field.MCS) + 4; else if (ht_setting.field.MODE == MODE_CCK) - rate_index = (UCHAR) (ht_setting.field.MCS); + rate_index = (u8)(ht_setting.field.MCS); if (rate_index < 0) rate_index = 0; @@ -2447,14 +2447,14 @@ const struct iw_handler_def rt28xx_iw_handler_def = { #endif }; -INT rt28xx_sta_ioctl(IN struct net_device *net_dev, - IN OUT struct ifreq *rq, IN INT cmd) +int rt28xx_sta_ioctl(IN struct net_device *net_dev, + IN OUT struct ifreq *rq, int cmd) { POS_COOKIE pObj; RTMP_ADAPTER *pAd = NULL; struct iwreq *wrq = (struct iwreq *)rq; BOOLEAN StateMachineTouched = FALSE; - INT Status = NDIS_STATUS_SUCCESS; + int Status = NDIS_STATUS_SUCCESS; GET_PAD_FROM_NET_DEV(pAd, net_dev); @@ -2522,7 +2522,7 @@ INT rt28xx_sta_ioctl(IN struct net_device *net_dev, { struct iw_point *erq = NULL; erq = &wrq->u.data; - erq->length = strlen((PSTRING) pAd->nickname); + erq->length = strlen((char *)pAd->nickname); Status = copy_to_user(erq->pointer, pAd->nickname, erq->length); @@ -2639,7 +2639,7 @@ INT rt28xx_sta_ioctl(IN struct net_device *net_dev, TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -INT Set_SSID_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) +int Set_SSID_Proc(IN PRTMP_ADAPTER pAdapter, char *arg) { NDIS_802_11_SSID Ssid, *pSsid = NULL; BOOLEAN StateMachineTouched = FALSE; @@ -2669,18 +2669,18 @@ INT Set_SSID_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) if ((pAdapter->StaCfg.WpaPassPhraseLen >= 8) && (pAdapter->StaCfg.WpaPassPhraseLen <= 64)) { - STRING passphrase_str[65] = { 0 }; - UCHAR keyMaterial[40]; + char passphrase_str[65] = { 0 }; + u8 keyMaterial[40]; RTMPMoveMemory(passphrase_str, pAdapter->StaCfg.WpaPassPhrase, pAdapter->StaCfg.WpaPassPhraseLen); RTMPZeroMemory(pAdapter->StaCfg.PMK, 32); if (pAdapter->StaCfg.WpaPassPhraseLen == 64) { - AtoH((PSTRING) pAdapter->StaCfg.WpaPassPhrase, + AtoH((char *)pAdapter->StaCfg.WpaPassPhrase, pAdapter->StaCfg.PMK, 32); } else { - PasswordHash((PSTRING) pAdapter->StaCfg. + PasswordHash((char *)pAdapter->StaCfg. WpaPassPhrase, Ssid.Ssid, Ssid.SsidLength, keyMaterial); NdisMoveMemory(pAdapter->StaCfg.PMK, @@ -2695,7 +2695,7 @@ INT Set_SSID_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) MlmeEnqueue(pAdapter, MLME_CNTL_STATE_MACHINE, OID_802_11_SSID, - sizeof(NDIS_802_11_SSID), (VOID *) pSsid); + sizeof(NDIS_802_11_SSID), (void *) pSsid); StateMachineTouched = TRUE; DBGPRINT(RT_DEBUG_TRACE, @@ -2718,9 +2718,9 @@ INT Set_SSID_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -INT Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) +int Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, char *arg) { - UINT32 Value = 0; + u32 Value = 0; if (strcmp(arg, "Adhoc") == 0) { if (pAdapter->StaCfg.BssType != BSS_ADHOC) { @@ -2789,7 +2789,7 @@ INT Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, IN PSTRING arg) DBGPRINT(RT_DEBUG_TRACE, ("===>Set_NetworkType_Proc::(INFRA)\n")); } else if (strcmp(arg, "Monitor") == 0) { - UCHAR bbpValue = 0; + u8 bbpValue = 0; BCN_TIME_CFG_STRUC csr; OPSTATUS_CLEAR_FLAG(pAdapter, fOP_STATUS_INFRA_ON); OPSTATUS_CLEAR_FLAG(pAdapter, fOP_STATUS_ADHOC_ON); diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c index 74529d11602c..4e387d575443 100644 --- a/drivers/staging/rt2860/usb_main_dev.c +++ b/drivers/staging/rt2860/usb_main_dev.c @@ -143,7 +143,7 @@ struct usb_device_id rtusb_usb_id[] = { {} /* Terminating entry */ }; -INT const rtusb_usb_id_len = +int const rtusb_usb_id_len = sizeof(rtusb_usb_id) / sizeof(struct usb_device_id); MODULE_DEVICE_TABLE(usb, rtusb_usb_id); @@ -185,7 +185,7 @@ BOOLEAN RT28XXChipsetCheck(IN void *_dev_p) { struct usb_interface *intf = (struct usb_interface *)_dev_p; struct usb_device *dev_p = interface_to_usbdev(intf); - UINT32 i; + u32 i; for (i = 0; i < rtusb_usb_id_len; i++) { if (dev_p->descriptor.idVendor == rtusb_usb_id[i].idVendor && @@ -225,8 +225,8 @@ static BOOLEAN USBDevConfigInit(IN struct usb_device *dev, IN RTMP_ADAPTER * pAd) { struct usb_host_interface *iface_desc; - ULONG BulkOutIdx; - UINT32 i; + unsigned long BulkOutIdx; + u32 i; /* get the active interface descriptor */ iface_desc = intf->cur_altsetting; @@ -338,7 +338,7 @@ resume:rt2870_resume, #ifdef CONFIG_PM -VOID RT2870RejectPendingPackets(IN PRTMP_ADAPTER pAd) +void RT2870RejectPendingPackets(IN PRTMP_ADAPTER pAd) { /* clear PS packets */ /* clear TxSw packets */ @@ -382,14 +382,14 @@ static int rt2870_resume(struct usb_interface *intf) #endif /* CONFIG_PM // */ /* Init driver module */ -INT __init rtusb_init(void) +int __init rtusb_init(void) { printk("rtusb init --->\n"); return usb_register(&rtusb_driver); } /* Deinit driver module */ -VOID __exit rtusb_exit(void) +void __exit rtusb_exit(void) { usb_deregister(&rtusb_driver); printk("<--- rtusb exit\n"); @@ -416,7 +416,7 @@ Return Value: Note: ======================================================================== */ -INT MlmeThread(IN void *Context) +int MlmeThread(IN void *Context) { RTMP_ADAPTER *pAd; RTMP_OS_TASK *pTask; @@ -485,7 +485,7 @@ Return Value: Note: ======================================================================== */ -INT RTUSBCmdThread(IN void *Context) +int RTUSBCmdThread(IN void *Context) { RTMP_ADAPTER *pAd; RTMP_OS_TASK *pTask; @@ -533,13 +533,13 @@ INT RTUSBCmdThread(IN void *Context) if (pCmdQElmt->buffer != NULL) os_free_mem(pAd, pCmdQElmt->buffer); - os_free_mem(pAd, (PUCHAR) pCmdQElmt); + os_free_mem(pAd, (u8 *)pCmdQElmt); } else { if ((pCmdQElmt->buffer != NULL) && (pCmdQElmt->bufferlength != 0)) os_free_mem(pAd, pCmdQElmt->buffer); - os_free_mem(pAd, (PUCHAR) pCmdQElmt); + os_free_mem(pAd, (u8 *)pCmdQElmt); } } } @@ -570,15 +570,15 @@ INT RTUSBCmdThread(IN void *Context) } -VOID RTUSBWatchDog(IN RTMP_ADAPTER * pAd) +void RTUSBWatchDog(IN RTMP_ADAPTER * pAd) { PHT_TX_CONTEXT pHTTXContext; int idx; - ULONG irqFlags; + unsigned long irqFlags; PURB pUrb; BOOLEAN needDumpSeq = FALSE; - UINT32 MACValue; - UINT32 TxRxQ_Pcnt; + u32 MACValue; + u32 TxRxQ_Pcnt; idx = 0; RTMP_IO_READ32(pAd, TXRXQ_PCNT, &MACValue); @@ -621,7 +621,7 @@ VOID RTUSBWatchDog(IN RTMP_ADAPTER * pAd) RTMP_IRQ_LOCK(&pAd->BulkOutLock[idx], irqFlags); if ((pAd->BulkOutPending[idx] == TRUE) && pAd->watchDogTxPendingCnt) { - INT actual_length = 0, transfer_buffer_length = 0; + int actual_length = 0, transfer_buffer_length = 0; BOOLEAN isDataPacket = FALSE; pAd->watchDogTxPendingCnt[idx]++; @@ -723,9 +723,9 @@ VOID RTUSBWatchDog(IN RTMP_ADAPTER * pAd) /* For Sigma debug, dump the ba_reordering sequence. */ if ((needDumpSeq == TRUE) && (pAd->CommonCfg.bDisableReordering == 0)) { - USHORT Idx; + u16 Idx; PBA_REC_ENTRY pBAEntry = NULL; - UCHAR count = 0; + u8 count = 0; struct reordering_mpdu *mpdu_blk; Idx = pAd->MacTab.Content[BSSID_WCID].BARecWcidArray[0]; @@ -809,8 +809,8 @@ static int __devinit rt2870_probe(IN struct usb_interface *intf, { struct net_device *net_dev = NULL; RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) NULL; - INT status, rv; - PVOID handle; + int status, rv; + void *handle; RTMP_OS_NETDEV_OP_HOOK netDevHook; DBGPRINT(RT_DEBUG_TRACE, ("===>rt2870_probe()!\n")); diff --git a/drivers/staging/rt2860/wpa.h b/drivers/staging/rt2860/wpa.h index 5f998c7eeaeb..05254c8b079a 100644 --- a/drivers/staging/rt2860/wpa.h +++ b/drivers/staging/rt2860/wpa.h @@ -158,18 +158,18 @@ #ifndef ROUND_UP #define ROUND_UP(__x, __y) \ - (((ULONG)((__x)+((__y)-1))) & ((ULONG)~((__y)-1))) + (((unsigned long)((__x)+((__y)-1))) & ((unsigned long)~((__y)-1))) #endif -#define SET_UINT16_TO_ARRARY(_V, _LEN) \ +#define SET_u16_TO_ARRARY(_V, _LEN) \ { \ _V[0] = (_LEN & 0xFF00) >> 8; \ _V[1] = (_LEN & 0xFF); \ } -#define INC_UINT16_TO_ARRARY(_V, _LEN) \ +#define INC_u16_TO_ARRARY(_V, _LEN) \ { \ - UINT16 var_len; \ + u16 var_len; \ \ var_len = (_V[0]<<8) | (_V[1]); \ var_len += _LEN; \ @@ -178,11 +178,11 @@ _V[1] = (var_len & 0xFF); \ } -#define CONV_ARRARY_TO_UINT16(_V) ((_V[0]<<8) | (_V[1])) +#define CONV_ARRARY_TO_u16(_V) ((_V[0]<<8) | (_V[1])) #define ADD_ONE_To_64BIT_VAR(_V) \ { \ - UCHAR cnt = LEN_KEY_DESC_REPLAY; \ + u8 cnt = LEN_KEY_DESC_REPLAY; \ do \ { \ cnt--; \ @@ -196,105 +196,105 @@ /* EAPOL Key Information definition within Key descriptor format */ typedef struct PACKED _KEY_INFO { - UCHAR KeyMic:1; - UCHAR Secure:1; - UCHAR Error:1; - UCHAR Request:1; - UCHAR EKD_DL:1; /* EKD for AP; DL for STA */ - UCHAR Rsvd:3; - UCHAR KeyDescVer:3; - UCHAR KeyType:1; - UCHAR KeyIndex:2; - UCHAR Install:1; - UCHAR KeyAck:1; + u8 KeyMic:1; + u8 Secure:1; + u8 Error:1; + u8 Request:1; + u8 EKD_DL:1; /* EKD for AP; DL for STA */ + u8 Rsvd:3; + u8 KeyDescVer:3; + u8 KeyType:1; + u8 KeyIndex:2; + u8 Install:1; + u8 KeyAck:1; } KEY_INFO, *PKEY_INFO; /* EAPOL Key descriptor format */ typedef struct PACKED _KEY_DESCRIPTER { - UCHAR Type; + u8 Type; KEY_INFO KeyInfo; - UCHAR KeyLength[2]; - UCHAR ReplayCounter[LEN_KEY_DESC_REPLAY]; - UCHAR KeyNonce[LEN_KEY_DESC_NONCE]; - UCHAR KeyIv[LEN_KEY_DESC_IV]; - UCHAR KeyRsc[LEN_KEY_DESC_RSC]; - UCHAR KeyId[LEN_KEY_DESC_ID]; - UCHAR KeyMic[LEN_KEY_DESC_MIC]; - UCHAR KeyDataLen[2]; - UCHAR KeyData[MAX_LEN_OF_RSNIE]; + u8 KeyLength[2]; + u8 ReplayCounter[LEN_KEY_DESC_REPLAY]; + u8 KeyNonce[LEN_KEY_DESC_NONCE]; + u8 KeyIv[LEN_KEY_DESC_IV]; + u8 KeyRsc[LEN_KEY_DESC_RSC]; + u8 KeyId[LEN_KEY_DESC_ID]; + u8 KeyMic[LEN_KEY_DESC_MIC]; + u8 KeyDataLen[2]; + u8 KeyData[MAX_LEN_OF_RSNIE]; } KEY_DESCRIPTER, *PKEY_DESCRIPTER; typedef struct PACKED _EAPOL_PACKET { - UCHAR ProVer; - UCHAR ProType; - UCHAR Body_Len[2]; + u8 ProVer; + u8 ProType; + u8 Body_Len[2]; KEY_DESCRIPTER KeyDesc; } EAPOL_PACKET, *PEAPOL_PACKET; /*802.11i D10 page 83 */ typedef struct PACKED _GTK_ENCAP { - UCHAR Kid:2; - UCHAR tx:1; - UCHAR rsv:5; - UCHAR rsv1; - UCHAR GTK[TKIP_GTK_LENGTH]; + u8 Kid:2; + u8 tx:1; + u8 rsv:5; + u8 rsv1; + u8 GTK[TKIP_GTK_LENGTH]; } GTK_ENCAP, *PGTK_ENCAP; typedef struct PACKED _KDE_ENCAP { - UCHAR Type; - UCHAR Len; - UCHAR OUI[3]; - UCHAR DataType; + u8 Type; + u8 Len; + u8 OUI[3]; + u8 DataType; GTK_ENCAP GTKEncap; } KDE_ENCAP, *PKDE_ENCAP; /* For WPA1 */ typedef struct PACKED _RSNIE { - UCHAR oui[4]; - USHORT version; - UCHAR mcast[4]; - USHORT ucount; + u8 oui[4]; + u16 version; + u8 mcast[4]; + u16 ucount; struct PACKED { - UCHAR oui[4]; + u8 oui[4]; } ucast[1]; } RSNIE, *PRSNIE; /* For WPA2 */ typedef struct PACKED _RSNIE2 { - USHORT version; - UCHAR mcast[4]; - USHORT ucount; + u16 version; + u8 mcast[4]; + u16 ucount; struct PACKED { - UCHAR oui[4]; + u8 oui[4]; } ucast[1]; } RSNIE2, *PRSNIE2; /* AKM Suite */ typedef struct PACKED _RSNIE_AUTH { - USHORT acount; + u16 acount; struct PACKED { - UCHAR oui[4]; + u8 oui[4]; } auth[1]; } RSNIE_AUTH, *PRSNIE_AUTH; typedef union PACKED _RSN_CAPABILITIES { struct PACKED { - USHORT PreAuth:1; - USHORT No_Pairwise:1; - USHORT PTKSA_R_Counter:2; - USHORT GTKSA_R_Counter:2; - USHORT Rsvd:10; + u16 PreAuth:1; + u16 No_Pairwise:1; + u16 PTKSA_R_Counter:2; + u16 GTKSA_R_Counter:2; + u16 Rsvd:10; } field; - USHORT word; + u16 word; } RSN_CAPABILITIES, *PRSN_CAPABILITIES; typedef struct PACKED _EAP_HDR { - UCHAR ProVer; - UCHAR ProType; - UCHAR Body_Len[2]; - UCHAR code; - UCHAR identifier; - UCHAR length[2]; /* including code and identifier, followed by length-2 octets of data */ + u8 ProVer; + u8 ProType; + u8 Body_Len[2]; + u8 code; + u8 identifier; + u8 length[2]; /* including code and identifier, followed by length-2 octets of data */ } EAP_HDR, *PEAP_HDR; /* For supplicant state machine states. 802.11i Draft 4.1, p. 97 */ @@ -339,55 +339,55 @@ typedef enum _WpaMixPairCipher { } WPA_MIX_PAIR_CIPHER; typedef struct PACKED _RSN_IE_HEADER_STRUCT { - UCHAR Eid; - UCHAR Length; - USHORT Version; /* Little endian format */ + u8 Eid; + u8 Length; + u16 Version; /* Little endian format */ } RSN_IE_HEADER_STRUCT, *PRSN_IE_HEADER_STRUCT; /* Cipher suite selector types */ typedef struct PACKED _CIPHER_SUITE_STRUCT { - UCHAR Oui[3]; - UCHAR Type; + u8 Oui[3]; + u8 Type; } CIPHER_SUITE_STRUCT, *PCIPHER_SUITE_STRUCT; /* Authentication and Key Management suite selector */ typedef struct PACKED _AKM_SUITE_STRUCT { - UCHAR Oui[3]; - UCHAR Type; + u8 Oui[3]; + u8 Type; } AKM_SUITE_STRUCT, *PAKM_SUITE_STRUCT; /* RSN capability */ typedef struct PACKED _RSN_CAPABILITY { - USHORT Rsv:10; - USHORT GTKSAReplayCnt:2; - USHORT PTKSAReplayCnt:2; - USHORT NoPairwise:1; - USHORT PreAuth:1; + u16 Rsv:10; + u16 GTKSAReplayCnt:2; + u16 PTKSAReplayCnt:2; + u16 NoPairwise:1; + u16 PreAuth:1; } RSN_CAPABILITY, *PRSN_CAPABILITY; /*======================================== The prototype is defined in cmm_wpa.c ========================================*/ -BOOLEAN WpaMsgTypeSubst(IN UCHAR EAPType, OUT INT * MsgType); +BOOLEAN WpaMsgTypeSubst(u8 EAPType, int * MsgType); -VOID PRF(IN UCHAR * key, - IN INT key_len, - IN UCHAR * prefix, - IN INT prefix_len, - IN UCHAR * data, IN INT data_len, OUT UCHAR * output, IN INT len); +void PRF(u8 * key, + int key_len, + u8 * prefix, + int prefix_len, + u8 * data, int data_len, u8 * output, int len); int PasswordHash(char *password, unsigned char *ssid, int ssidlength, unsigned char *output); -PUINT8 GetSuiteFromRSNIE(IN PUINT8 rsnie, - IN UINT rsnie_len, IN UINT8 type, OUT UINT8 * count); +u8 *GetSuiteFromRSNIE(u8 *rsnie, + u32 rsnie_len, u8 type, u8 * count); -VOID WpaShowAllsuite(IN PUINT8 rsnie, IN UINT rsnie_len); +void WpaShowAllsuite(u8 *rsnie, u32 rsnie_len); -VOID RTMPInsertRSNIE(IN PUCHAR pFrameBuf, - OUT PULONG pFrameLen, - IN PUINT8 rsnie_ptr, - IN UINT8 rsnie_len, - IN PUINT8 pmkid_ptr, IN UINT8 pmkid_len); +void RTMPInsertRSNIE(u8 *pFrameBuf, + unsigned long *pFrameLen, + u8 *rsnie_ptr, + u8 rsnie_len, + u8 *pmkid_ptr, u8 pmkid_len); #endif diff --git a/drivers/staging/rt2870/common/rtusb_bulk.c b/drivers/staging/rt2870/common/rtusb_bulk.c index a45f64810dce..b180f1314422 100644 --- a/drivers/staging/rt2870/common/rtusb_bulk.c +++ b/drivers/staging/rt2870/common/rtusb_bulk.c @@ -41,7 +41,7 @@ #include "../rt_config.h" /* Match total 6 bulkout endpoint to corresponding queue. */ -UCHAR EpToQueue[6] = +u8 EpToQueue[6] = { FIFO_EDCA, FIFO_EDCA, FIFO_EDCA, FIFO_EDCA, FIFO_EDCA, FIFO_MGMT }; /*static BOOLEAN SingleBulkOut = FALSE; */ @@ -58,12 +58,12 @@ void RTUSB_FILL_BULK_URB(struct urb *pUrb, } -VOID RTUSBInitTxDesc(IN PRTMP_ADAPTER pAd, +void RTUSBInitTxDesc(IN PRTMP_ADAPTER pAd, IN PTX_CONTEXT pTxContext, - IN UCHAR BulkOutPipeId, IN usb_complete_t Func) + u8 BulkOutPipeId, IN usb_complete_t Func) { PURB pUrb; - PUCHAR pSrc = NULL; + u8 *pSrc = NULL; POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; pUrb = pTxContext->pUrb; @@ -76,7 +76,7 @@ VOID RTUSBInitTxDesc(IN PRTMP_ADAPTER pAd, pSrc = &pTxContext->TransferBuffer->Aggregation[2]; } else { pSrc = - (PUCHAR) pTxContext->TransferBuffer->field.WirelessPacket; + (u8 *)pTxContext->TransferBuffer->field.WirelessPacket; } /*Initialize a tx bulk urb */ @@ -96,13 +96,13 @@ VOID RTUSBInitTxDesc(IN PRTMP_ADAPTER pAd, } -VOID RTUSBInitHTTxDesc(IN PRTMP_ADAPTER pAd, +void RTUSBInitHTTxDesc(IN PRTMP_ADAPTER pAd, IN PHT_TX_CONTEXT pTxContext, - IN UCHAR BulkOutPipeId, - IN ULONG BulkOutSize, IN usb_complete_t Func) + u8 BulkOutPipeId, + unsigned long BulkOutSize, IN usb_complete_t Func) { PURB pUrb; - PUCHAR pSrc = NULL; + u8 *pSrc = NULL; POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; pUrb = pTxContext->pUrb; @@ -128,11 +128,11 @@ VOID RTUSBInitHTTxDesc(IN PRTMP_ADAPTER pAd, } -VOID RTUSBInitRxDesc(IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext) +void RTUSBInitRxDesc(IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext) { PURB pUrb; POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - ULONG RX_bulk_size; + unsigned long RX_bulk_size; pUrb = pRxContext->pUrb; ASSERT(pUrb); @@ -179,8 +179,8 @@ VOID RTUSBInitRxDesc(IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext) if(1 /*!(in_interrupt() & 0xffff0000)*/) \ RTMP_IRQ_UNLOCK((pLock), IrqFlags); -VOID RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, - IN UCHAR BulkOutPipeId, IN UCHAR Index) +void RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, + u8 BulkOutPipeId, u8 Index) { PHT_TX_CONTEXT pHTTXContext; @@ -188,11 +188,11 @@ VOID RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, int ret = 0; PTXINFO_STRUC pTxInfo, pLastTxInfo = NULL; PTXWI_STRUC pTxWI; - ULONG TmpBulkEndPos, ThisBulkSize; + unsigned long TmpBulkEndPos, ThisBulkSize; unsigned long IrqFlags = 0, IrqFlags2 = 0; - PUCHAR pWirelessPkt, pAppendant; + u8 *pWirelessPkt, *pAppendant; BOOLEAN bTxQLastRound = FALSE; - UCHAR allzero[4] = { 0x0, 0x0, 0x0, 0x0 }; + u8 allzero[4] = { 0x0, 0x0, 0x0, 0x0 }; BULK_OUT_LOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags); if ((pAd->BulkOutPending[BulkOutPipeId] == TRUE) @@ -334,7 +334,7 @@ VOID RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad)); hex_dump("Wrong QSel Pkt:", - (PUCHAR) & pWirelessPkt[TmpBulkEndPos], + (u8 *)& pWirelessPkt[TmpBulkEndPos], (pHTTXContext->CurWritePosition - pHTTXContext->NextBulkOutPosition)); } @@ -429,7 +429,7 @@ VOID RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, ENextBulkOutPosition], 8); pHTTXContext->bCopySavePad = TRUE; if (RTMPEqualMemory(pHTTXContext->SavedPad, allzero, 4)) { - PUCHAR pBuf = &pHTTXContext->SavedPad[0]; + u8 *pBuf = &pHTTXContext->SavedPad[0]; DBGPRINT_RAW(RT_DEBUG_ERROR, ("WARNING-Zero-3:%02x%02x%02x%02x%02x%02x%02x%02x,CWPos=%ld, CWRPos=%ld, bCW=%d, NBPos=%ld, TBPos=%ld, TBSize=%ld\n", pBuf[0], pBuf[1], pBuf[2], pBuf[3], @@ -495,12 +495,12 @@ VOID RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, } -VOID RTUSBBulkOutDataPacketComplete(purbb_t pUrb, struct pt_regs * pt_regs) +void RTUSBBulkOutDataPacketComplete(purbb_t pUrb, struct pt_regs * pt_regs) { PHT_TX_CONTEXT pHTTXContext; PRTMP_ADAPTER pAd; POS_COOKIE pObj; - UCHAR BulkOutPipeId; + u8 BulkOutPipeId; pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; pAd = pHTTXContext->pAd; @@ -544,7 +544,7 @@ VOID RTUSBBulkOutDataPacketComplete(purbb_t pUrb, struct pt_regs * pt_regs) ======================================================================== */ -VOID RTUSBBulkOutNullFrame(IN PRTMP_ADAPTER pAd) +void RTUSBBulkOutNullFrame(IN PRTMP_ADAPTER pAd) { PTX_CONTEXT pNullContext = &(pAd->NullContext); PURB pUrb; @@ -589,11 +589,11 @@ VOID RTUSBBulkOutNullFrame(IN PRTMP_ADAPTER pAd) } /* NULL frame use BulkOutPipeId = 0 */ -VOID RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs * pt_regs) +void RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs * pt_regs) { PRTMP_ADAPTER pAd; PTX_CONTEXT pNullContext; - NTSTATUS Status; + int Status; POS_COOKIE pObj; pNullContext = (PTX_CONTEXT) pUrb->context; @@ -618,7 +618,7 @@ VOID RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs * pt_regs) ======================================================================== */ -VOID RTUSBBulkOutMLMEPacket(IN PRTMP_ADAPTER pAd, IN UCHAR Index) +void RTUSBBulkOutMLMEPacket(IN PRTMP_ADAPTER pAd, u8 Index) { PTX_CONTEXT pMLMEContext; PURB pUrb; @@ -684,11 +684,11 @@ VOID RTUSBBulkOutMLMEPacket(IN PRTMP_ADAPTER pAd, IN UCHAR Index) /* printk("<---RTUSBBulkOutMLMEPacket,Cpu=%d!, Dma=%d, SwIdx=%d!\n", pAd->MgmtRing.TxCpuIdx, pAd->MgmtRing.TxDmaIdx, pAd->MgmtRing.TxSwFreeIdx); */ } -VOID RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs * pt_regs) +void RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs * pt_regs) { PTX_CONTEXT pMLMEContext; PRTMP_ADAPTER pAd; - NTSTATUS Status; + int Status; POS_COOKIE pObj; int index; @@ -716,7 +716,7 @@ VOID RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs * pt_regs) ======================================================================== */ -VOID RTUSBBulkOutPsPoll(IN PRTMP_ADAPTER pAd) +void RTUSBBulkOutPsPoll(IN PRTMP_ADAPTER pAd) { PTX_CONTEXT pPsPollContext = &(pAd->PsPollContext); PURB pUrb; @@ -758,11 +758,11 @@ VOID RTUSBBulkOutPsPoll(IN PRTMP_ADAPTER pAd) } /* PS-Poll frame use BulkOutPipeId = 0 */ -VOID RTUSBBulkOutPsPollComplete(purbb_t pUrb, struct pt_regs * pt_regs) +void RTUSBBulkOutPsPollComplete(purbb_t pUrb, struct pt_regs * pt_regs) { PRTMP_ADAPTER pAd; PTX_CONTEXT pPsPollContext; - NTSTATUS Status; + int Status; POS_COOKIE pObj; pPsPollContext = (PTX_CONTEXT) pUrb->context; @@ -774,7 +774,7 @@ VOID RTUSBBulkOutPsPollComplete(purbb_t pUrb, struct pt_regs * pt_regs) tasklet_hi_schedule(&pObj->pspoll_frame_complete_task); } -VOID DoBulkIn(IN RTMP_ADAPTER * pAd) +void DoBulkIn(IN RTMP_ADAPTER * pAd) { PRX_CONTEXT pRxContext; PURB pUrb; @@ -845,7 +845,7 @@ VOID DoBulkIn(IN RTMP_ADAPTER * pAd) fRTMP_ADAPTER_RADIO_OFF | fRTMP_ADAPTER_RESET_IN_PROGRESS | \ fRTMP_ADAPTER_REMOVE_IN_PROGRESS) -VOID RTUSBBulkReceive(IN PRTMP_ADAPTER pAd) +void RTUSBBulkReceive(IN PRTMP_ADAPTER pAd) { PRX_CONTEXT pRxContext; unsigned long IrqFlags; @@ -912,7 +912,7 @@ VOID RTUSBBulkReceive(IN PRTMP_ADAPTER pAd) Always returns STATUS_MORE_PROCESSING_REQUIRED ======================================================================== */ -VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs) +void RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs) { /* use a receive tasklet to handle received packets; */ /* or sometimes hardware IRQ will be disabled here, so we can not */ @@ -943,7 +943,7 @@ VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs) ======================================================================== */ -VOID RTUSBKickBulkOut(IN PRTMP_ADAPTER pAd) +void RTUSBKickBulkOut(IN PRTMP_ADAPTER pAd) { /* BulkIn Reset will reset whole USB PHY. So we need to make sure fRTMP_ADAPTER_BULKIN_RESET not flaged. */ if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NEED_STOP_TX) @@ -1033,9 +1033,9 @@ VOID RTUSBKickBulkOut(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID RTUSBCleanUpDataBulkOutQueue(IN PRTMP_ADAPTER pAd) +void RTUSBCleanUpDataBulkOutQueue(IN PRTMP_ADAPTER pAd) { - UCHAR Idx; + u8 Idx; PHT_TX_CONTEXT pTxContext; DBGPRINT(RT_DEBUG_TRACE, ("--->CleanUpDataBulkOutQueue\n")); @@ -1066,7 +1066,7 @@ VOID RTUSBCleanUpDataBulkOutQueue(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID RTUSBCleanUpMLMEBulkOutQueue(IN PRTMP_ADAPTER pAd) +void RTUSBCleanUpMLMEBulkOutQueue(IN PRTMP_ADAPTER pAd) { DBGPRINT(RT_DEBUG_TRACE, ("--->CleanUpMLMEBulkOutQueue\n")); DBGPRINT(RT_DEBUG_TRACE, ("<---CleanUpMLMEBulkOutQueue\n")); @@ -1085,7 +1085,7 @@ VOID RTUSBCleanUpMLMEBulkOutQueue(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID RTUSBCancelPendingIRPs(IN PRTMP_ADAPTER pAd) +void RTUSBCancelPendingIRPs(IN PRTMP_ADAPTER pAd) { RTUSBCancelPendingBulkInIRP(pAd); RTUSBCancelPendingBulkOutIRP(pAd); @@ -1104,10 +1104,10 @@ VOID RTUSBCancelPendingIRPs(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID RTUSBCancelPendingBulkInIRP(IN PRTMP_ADAPTER pAd) +void RTUSBCancelPendingBulkInIRP(IN PRTMP_ADAPTER pAd) { PRX_CONTEXT pRxContext; - UINT i; + u32 i; DBGPRINT_RAW(RT_DEBUG_TRACE, ("--->RTUSBCancelPendingBulkInIRP\n")); for (i = 0; i < (RX_RING_SIZE); i++) { @@ -1136,7 +1136,7 @@ VOID RTUSBCancelPendingBulkInIRP(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID RTUSBCancelPendingBulkOutIRP(IN PRTMP_ADAPTER pAd) +void RTUSBCancelPendingBulkOutIRP(IN PRTMP_ADAPTER pAd) { PHT_TX_CONTEXT pHTTXContext; PTX_CONTEXT pMLMEContext; @@ -1144,7 +1144,7 @@ VOID RTUSBCancelPendingBulkOutIRP(IN PRTMP_ADAPTER pAd) PTX_CONTEXT pNullContext; PTX_CONTEXT pPsPollContext; PTX_CONTEXT pRTSContext; - UINT i, Idx; + u32 i, Idx; /* unsigned int IrqFlags; */ /* NDIS_SPIN_LOCK *pLock; */ /* BOOLEAN *pPending; */ diff --git a/drivers/staging/rt2870/common/rtusb_data.c b/drivers/staging/rt2870/common/rtusb_data.c index e6b0afc817f1..c58201ffde7a 100644 --- a/drivers/staging/rt2870/common/rtusb_data.c +++ b/drivers/staging/rt2870/common/rtusb_data.c @@ -41,14 +41,14 @@ #include "../rt_config.h" -extern UCHAR Phy11BGNextRateUpward[]; /* defined in mlme.c */ -extern UCHAR EpToQueue[]; +extern u8 Phy11BGNextRateUpward[]; /* defined in mlme.c */ +extern u8 EpToQueue[]; -VOID REPORT_AMSDU_FRAMES_TO_LLC(IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, IN ULONG DataSize) +void REPORT_AMSDU_FRAMES_TO_LLC(IN PRTMP_ADAPTER pAd, + u8 *pData, unsigned long DataSize) { PNDIS_PACKET pPacket; - UINT nMSDU; + u32 nMSDU; struct sk_buff *pSkb; nMSDU = 0; @@ -85,13 +85,13 @@ VOID REPORT_AMSDU_FRAMES_TO_LLC(IN PRTMP_ADAPTER pAd, ======================================================================== */ -NDIS_STATUS RTUSBFreeDescriptorRequest(IN PRTMP_ADAPTER pAd, - IN UCHAR BulkOutPipeId, - IN UINT32 NumberRequired) +int RTUSBFreeDescriptorRequest(IN PRTMP_ADAPTER pAd, + u8 BulkOutPipeId, + u32 NumberRequired) { -/* UCHAR FreeNumber = 0; */ -/* UINT Index; */ - NDIS_STATUS Status = NDIS_STATUS_FAILURE; +/* u8 FreeNumber = 0; */ +/* u32 Index; */ + int Status = NDIS_STATUS_FAILURE; unsigned long IrqFlags; HT_TX_CONTEXT *pHTTXContext; @@ -127,8 +127,8 @@ NDIS_STATUS RTUSBFreeDescriptorRequest(IN PRTMP_ADAPTER pAd, return (Status); } -NDIS_STATUS RTUSBFreeDescriptorRelease(IN RTMP_ADAPTER * pAd, - IN UCHAR BulkOutPipeId) +int RTUSBFreeDescriptorRelease(IN RTMP_ADAPTER * pAd, + u8 BulkOutPipeId) { unsigned long IrqFlags; HT_TX_CONTEXT *pHTTXContext; @@ -141,7 +141,7 @@ NDIS_STATUS RTUSBFreeDescriptorRelease(IN RTMP_ADAPTER * pAd, return (NDIS_STATUS_SUCCESS); } -BOOLEAN RTUSBNeedQueueBackForAgg(IN RTMP_ADAPTER * pAd, IN UCHAR BulkOutPipeId) +BOOLEAN RTUSBNeedQueueBackForAgg(IN RTMP_ADAPTER * pAd, u8 BulkOutPipeId) { unsigned long IrqFlags; HT_TX_CONTEXT *pHTTXContext; @@ -191,9 +191,9 @@ BOOLEAN RTUSBNeedQueueBackForAgg(IN RTMP_ADAPTER * pAd, IN UCHAR BulkOutPipeId) ======================================================================== */ -VOID RTUSBRejectPendingPackets(IN PRTMP_ADAPTER pAd) +void RTUSBRejectPendingPackets(IN PRTMP_ADAPTER pAd) { - UCHAR Index; + u8 Index; PQUEUE_ENTRY pEntry; PNDIS_PACKET pPacket; PQUEUE_HEADER pQueue; @@ -240,11 +240,11 @@ VOID RTUSBRejectPendingPackets(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID RTMPWriteTxInfo(IN PRTMP_ADAPTER pAd, +void RTMPWriteTxInfo(IN PRTMP_ADAPTER pAd, IN PTXINFO_STRUC pTxInfo, - IN USHORT USBDMApktLen, + u16 USBDMApktLen, IN BOOLEAN bWiv, - IN UCHAR QueueSel, IN UCHAR NextValid, IN UCHAR TxBurst) + u8 QueueSel, u8 NextValid, u8 TxBurst) { pTxInfo->USBDMATxPktLen = USBDMApktLen; pTxInfo->QSEL = QueueSel; diff --git a/drivers/staging/rt2870/common/rtusb_io.c b/drivers/staging/rt2870/common/rtusb_io.c index dd2e0d051934..861b6b15b045 100644 --- a/drivers/staging/rt2870/common/rtusb_io.c +++ b/drivers/staging/rt2870/common/rtusb_io.c @@ -56,9 +56,9 @@ ======================================================================== */ -static NTSTATUS RTUSBFirmwareRun(IN PRTMP_ADAPTER pAd) +static int RTUSBFirmwareRun(IN PRTMP_ADAPTER pAd) { - NTSTATUS Status; + int Status; Status = RTUSB_VendorRequest(pAd, USBD_TRANSFER_DIRECTION_OUT, @@ -83,13 +83,13 @@ static NTSTATUS RTUSBFirmwareRun(IN PRTMP_ADAPTER pAd) ======================================================================== */ -NTSTATUS RTUSBFirmwareWrite(IN PRTMP_ADAPTER pAd, - IN PUCHAR pFwImage, IN ULONG FwLen) +int RTUSBFirmwareWrite(IN PRTMP_ADAPTER pAd, + u8 *pFwImage, unsigned long FwLen) { - UINT32 MacReg; - NTSTATUS Status; -/* ULONG i; */ - USHORT writeLen; + u32 MacReg; + int Status; +/* unsigned long i; */ + u16 writeLen; Status = RTUSBReadMACRegister(pAd, MAC_CSR0, &MacReg); @@ -109,9 +109,9 @@ NTSTATUS RTUSBFirmwareWrite(IN PRTMP_ADAPTER pAd, return Status; } -NTSTATUS RTUSBVenderReset(IN PRTMP_ADAPTER pAd) +int RTUSBVenderReset(IN PRTMP_ADAPTER pAd) { - NTSTATUS Status; + int Status; DBGPRINT_RAW(RT_DEBUG_ERROR, ("-->RTUSBVenderReset\n")); Status = RTUSB_VendorRequest(pAd, USBD_TRANSFER_DIRECTION_OUT, @@ -137,10 +137,10 @@ NTSTATUS RTUSBVenderReset(IN PRTMP_ADAPTER pAd) ======================================================================== */ -NTSTATUS RTUSBMultiRead(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, OUT PUCHAR pData, IN USHORT length) +int RTUSBMultiRead(IN PRTMP_ADAPTER pAd, + u16 Offset, u8 *pData, u16 length) { - NTSTATUS Status; + int Status; Status = RTUSB_VendorRequest(pAd, (USBD_TRANSFER_DIRECTION_IN | @@ -166,10 +166,10 @@ NTSTATUS RTUSBMultiRead(IN PRTMP_ADAPTER pAd, ======================================================================== */ -NTSTATUS RTUSBMultiWrite_OneByte(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, IN PUCHAR pData) +int RTUSBMultiWrite_OneByte(IN PRTMP_ADAPTER pAd, + u16 Offset, u8 *pData) { - NTSTATUS Status; + int Status; /* TODO: In 2870, use this funciton carefully cause it's not stable. */ Status = RTUSB_VendorRequest(pAd, @@ -180,19 +180,19 @@ NTSTATUS RTUSBMultiWrite_OneByte(IN PRTMP_ADAPTER pAd, return Status; } -NTSTATUS RTUSBMultiWrite(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, IN PUCHAR pData, IN USHORT length) +int RTUSBMultiWrite(IN PRTMP_ADAPTER pAd, + u16 Offset, u8 *pData, u16 length) { - NTSTATUS Status; + int Status; - USHORT index = 0, Value; - PUCHAR pSrc = pData; - USHORT resude = 0; + u16 index = 0, Value; + u8 *pSrc = pData; + u16 resude = 0; resude = length % 2; length += resude; do { - Value = (USHORT) (*pSrc | (*(pSrc + 1) << 8)); + Value = (u16)(*pSrc | (*(pSrc + 1) << 8)); Status = RTUSBSingleWrite(pAd, Offset + index, Value); index += 2; length -= 2; @@ -202,10 +202,10 @@ NTSTATUS RTUSBMultiWrite(IN PRTMP_ADAPTER pAd, return Status; } -NTSTATUS RTUSBSingleWrite(IN RTMP_ADAPTER * pAd, - IN USHORT Offset, IN USHORT Value) +int RTUSBSingleWrite(IN RTMP_ADAPTER * pAd, + u16 Offset, u16 Value) { - NTSTATUS Status; + int Status; Status = RTUSB_VendorRequest(pAd, USBD_TRANSFER_DIRECTION_OUT, @@ -231,11 +231,11 @@ NTSTATUS RTUSBSingleWrite(IN RTMP_ADAPTER * pAd, ======================================================================== */ -NTSTATUS RTUSBReadMACRegister(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, OUT PUINT32 pValue) +int RTUSBReadMACRegister(IN PRTMP_ADAPTER pAd, + u16 Offset, u32 *pValue) { - NTSTATUS Status = 0; - UINT32 localVal; + int Status = 0; + u32 localVal; Status = RTUSB_VendorRequest(pAd, (USBD_TRANSFER_DIRECTION_IN | @@ -266,18 +266,18 @@ NTSTATUS RTUSBReadMACRegister(IN PRTMP_ADAPTER pAd, ======================================================================== */ -NTSTATUS RTUSBWriteMACRegister(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, IN UINT32 Value) +int RTUSBWriteMACRegister(IN PRTMP_ADAPTER pAd, + u16 Offset, u32 Value) { - NTSTATUS Status; - UINT32 localVal; + int Status; + u32 localVal; localVal = Value; - Status = RTUSBSingleWrite(pAd, Offset, (USHORT) (localVal & 0xffff)); + Status = RTUSBSingleWrite(pAd, Offset, (u16)(localVal & 0xffff)); Status = RTUSBSingleWrite(pAd, Offset + 2, - (USHORT) ((localVal & 0xffff0000) >> 16)); + (u16)((localVal & 0xffff0000) >> 16)); return Status; } @@ -297,12 +297,12 @@ NTSTATUS RTUSBWriteMACRegister(IN PRTMP_ADAPTER pAd, ======================================================================== */ -NTSTATUS RTUSBReadBBPRegister(IN PRTMP_ADAPTER pAd, - IN UCHAR Id, IN PUCHAR pValue) +int RTUSBReadBBPRegister(IN PRTMP_ADAPTER pAd, + u8 Id, u8 *pValue) { BBP_CSR_CFG_STRUC BbpCsr; - UINT i = 0; - NTSTATUS status; + u32 i = 0; + int status; /* Verify the busy condition */ do { @@ -342,7 +342,7 @@ NTSTATUS RTUSBReadBBPRegister(IN PRTMP_ADAPTER pAd, status = RTUSBReadMACRegister(pAd, BBP_CSR_CFG, &BbpCsr.word); if (status >= 0) { if (!(BbpCsr.field.Busy == BUSY)) { - *pValue = (UCHAR) BbpCsr.field.Value; + *pValue = (u8)BbpCsr.field.Value; break; } } @@ -383,12 +383,12 @@ NTSTATUS RTUSBReadBBPRegister(IN PRTMP_ADAPTER pAd, ======================================================================== */ -NTSTATUS RTUSBWriteBBPRegister(IN PRTMP_ADAPTER pAd, - IN UCHAR Id, IN UCHAR Value) +int RTUSBWriteBBPRegister(IN PRTMP_ADAPTER pAd, + u8 Id, u8 Value) { BBP_CSR_CFG_STRUC BbpCsr; - UINT i = 0; - NTSTATUS status; + u32 i = 0; + int status; /* Verify the busy condition */ do { status = RTUSBReadMACRegister(pAd, BBP_CSR_CFG, &BbpCsr.word); @@ -438,11 +438,11 @@ NTSTATUS RTUSBWriteBBPRegister(IN PRTMP_ADAPTER pAd, ======================================================================== */ -NTSTATUS RTUSBWriteRFRegister(IN PRTMP_ADAPTER pAd, IN UINT32 Value) +int RTUSBWriteRFRegister(IN PRTMP_ADAPTER pAd, u32 Value) { PHY_CSR4_STRUC PhyCsr4; - UINT i = 0; - NTSTATUS status; + u32 i = 0; + int status; NdisZeroMemory(&PhyCsr4, sizeof(PHY_CSR4_STRUC)); do { @@ -486,10 +486,10 @@ NTSTATUS RTUSBWriteRFRegister(IN PRTMP_ADAPTER pAd, IN UINT32 Value) ======================================================================== */ -NTSTATUS RTUSBReadEEPROM(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, OUT PUCHAR pData, IN USHORT length) +int RTUSBReadEEPROM(IN PRTMP_ADAPTER pAd, + u16 Offset, u8 *pData, u16 length) { - NTSTATUS Status = STATUS_SUCCESS; + int Status = STATUS_SUCCESS; Status = RTUSB_VendorRequest(pAd, (USBD_TRANSFER_DIRECTION_IN | @@ -515,10 +515,10 @@ NTSTATUS RTUSBReadEEPROM(IN PRTMP_ADAPTER pAd, ======================================================================== */ -NTSTATUS RTUSBWriteEEPROM(IN PRTMP_ADAPTER pAd, - IN USHORT Offset, IN PUCHAR pData, IN USHORT length) +int RTUSBWriteEEPROM(IN PRTMP_ADAPTER pAd, + u16 Offset, u8 *pData, u16 length) { - NTSTATUS Status = STATUS_SUCCESS; + int Status = STATUS_SUCCESS; Status = RTUSB_VendorRequest(pAd, USBD_TRANSFER_DIRECTION_OUT, @@ -528,13 +528,13 @@ NTSTATUS RTUSBWriteEEPROM(IN PRTMP_ADAPTER pAd, return Status; } -NTSTATUS RTUSBReadEEPROM16(IN PRTMP_ADAPTER pAd, - IN USHORT offset, OUT PUSHORT pData) +int RTUSBReadEEPROM16(IN PRTMP_ADAPTER pAd, + u16 offset, u16 *pData) { - NTSTATUS status; - USHORT localData; + int status; + u16 localData; - status = RTUSBReadEEPROM(pAd, offset, (PUCHAR) (&localData), 2); + status = RTUSBReadEEPROM(pAd, offset, (u8 *)(&localData), 2); if (status == STATUS_SUCCESS) *pData = le2cpu16(localData); @@ -557,9 +557,9 @@ NTSTATUS RTUSBReadEEPROM16(IN PRTMP_ADAPTER pAd, ======================================================================== */ -VOID RTUSBPutToSleep(IN PRTMP_ADAPTER pAd) +void RTUSBPutToSleep(IN PRTMP_ADAPTER pAd) { - UINT32 value; + u32 value; /* Timeout 0x40 x 50us */ value = (SLEEPCID << 16) + (OWNERMCU << 24) + (0x40 << 8) + 1; @@ -585,9 +585,9 @@ VOID RTUSBPutToSleep(IN PRTMP_ADAPTER pAd) ======================================================================== */ -NTSTATUS RTUSBWakeUp(IN PRTMP_ADAPTER pAd) +int RTUSBWakeUp(IN PRTMP_ADAPTER pAd) { - NTSTATUS Status; + int Status; Status = RTUSB_VendorRequest(pAd, USBD_TRANSFER_DIRECTION_OUT, @@ -612,7 +612,7 @@ NTSTATUS RTUSBWakeUp(IN PRTMP_ADAPTER pAd) ======================================================================== */ -VOID RTUSBInitializeCmdQ(IN PCmdQ cmdq) +void RTUSBInitializeCmdQ(IN PCmdQ cmdq) { cmdq->head = NULL; cmdq->tail = NULL; @@ -635,13 +635,13 @@ VOID RTUSBInitializeCmdQ(IN PCmdQ cmdq) ======================================================================== */ -NDIS_STATUS RTUSBEnqueueCmdFromNdis(IN PRTMP_ADAPTER pAd, +int RTUSBEnqueueCmdFromNdis(IN PRTMP_ADAPTER pAd, IN NDIS_OID Oid, IN BOOLEAN SetInformation, - IN PVOID pInformationBuffer, - IN UINT32 InformationBufferLength) + void *pInformationBuffer, + u32 InformationBufferLength) { - NDIS_STATUS status; + int status; PCmdQElmt cmdqelmt = NULL; RTMP_OS_TASK *pTask = &pAd->cmdQTask; @@ -654,14 +654,14 @@ NDIS_STATUS RTUSBEnqueueCmdFromNdis(IN PRTMP_ADAPTER pAd, #endif return (NDIS_STATUS_RESOURCES); - status = os_alloc_mem(pAd, (PUCHAR *) (&cmdqelmt), sizeof(CmdQElmt)); + status = os_alloc_mem(pAd, (u8 **) (&cmdqelmt), sizeof(CmdQElmt)); if ((status != NDIS_STATUS_SUCCESS) || (cmdqelmt == NULL)) return (NDIS_STATUS_RESOURCES); cmdqelmt->buffer = NULL; if (pInformationBuffer != NULL) { status = - os_alloc_mem(pAd, (PUCHAR *) & cmdqelmt->buffer, + os_alloc_mem(pAd, (u8 **) & cmdqelmt->buffer, InformationBufferLength); if ((status != NDIS_STATUS_SUCCESS) || (cmdqelmt->buffer == NULL)) { @@ -716,22 +716,22 @@ NDIS_STATUS RTUSBEnqueueCmdFromNdis(IN PRTMP_ADAPTER pAd, ======================================================================== */ -NDIS_STATUS RTUSBEnqueueInternalCmd(IN PRTMP_ADAPTER pAd, +int RTUSBEnqueueInternalCmd(IN PRTMP_ADAPTER pAd, IN NDIS_OID Oid, - IN PVOID pInformationBuffer, - IN UINT32 InformationBufferLength) + void *pInformationBuffer, + u32 InformationBufferLength) { - NDIS_STATUS status; + int status; PCmdQElmt cmdqelmt = NULL; - status = os_alloc_mem(pAd, (PUCHAR *) & cmdqelmt, sizeof(CmdQElmt)); + status = os_alloc_mem(pAd, (u8 **) & cmdqelmt, sizeof(CmdQElmt)); if ((status != NDIS_STATUS_SUCCESS) || (cmdqelmt == NULL)) return (NDIS_STATUS_RESOURCES); NdisZeroMemory(cmdqelmt, sizeof(CmdQElmt)); if (InformationBufferLength > 0) { status = - os_alloc_mem(pAd, (PUCHAR *) & cmdqelmt->buffer, + os_alloc_mem(pAd, (u8 **) & cmdqelmt->buffer, InformationBufferLength); if ((status != NDIS_STATUS_SUCCESS) || (cmdqelmt->buffer == NULL)) { @@ -785,7 +785,7 @@ NDIS_STATUS RTUSBEnqueueInternalCmd(IN PRTMP_ADAPTER pAd, ======================================================================== */ -VOID RTUSBDequeueCmd(IN PCmdQ cmdq, OUT PCmdQElmt * pcmdqelmt) +void RTUSBDequeueCmd(IN PCmdQ cmdq, OUT PCmdQElmt * pcmdqelmt) { *pcmdqelmt = cmdq->head; @@ -833,14 +833,14 @@ VOID RTUSBDequeueCmd(IN PCmdQ cmdq, OUT PCmdQElmt * pcmdqelmt) ======================================================================== */ -NTSTATUS RTUSB_VendorRequest(IN PRTMP_ADAPTER pAd, - IN UINT32 TransferFlags, - IN UCHAR RequestType, - IN UCHAR Request, - IN USHORT Value, - IN USHORT Index, - IN PVOID TransferBuffer, - IN UINT32 TransferBufferLength) +int RTUSB_VendorRequest(IN PRTMP_ADAPTER pAd, + u32 TransferFlags, + u8 RequestType, + u8 Request, + u16 Value, + u16 Index, + void *TransferBuffer, + u32 TransferBufferLength) { int ret = 0; POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; @@ -954,22 +954,22 @@ NTSTATUS RTUSB_VendorRequest(IN PRTMP_ADAPTER pAd, ======================================================================== */ -NTSTATUS RTUSB_ResetDevice(IN PRTMP_ADAPTER pAd) +int RTUSB_ResetDevice(IN PRTMP_ADAPTER pAd) { - NTSTATUS Status = TRUE; + int Status = TRUE; DBGPRINT_RAW(RT_DEBUG_TRACE, ("--->USB_ResetDevice\n")); /*RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS); */ return Status; } -VOID CMDHandler(IN PRTMP_ADAPTER pAd) +void CMDHandler(IN PRTMP_ADAPTER pAd) { PCmdQElmt cmdqelmt; - PUCHAR pData; - NDIS_STATUS NdisStatus = NDIS_STATUS_SUCCESS; -/* ULONG Now = 0; */ - NTSTATUS ntStatus; + u8 *pData; + int NdisStatus = NDIS_STATUS_SUCCESS; +/* unsigned long Now = 0; */ + int ntStatus; /* unsigned long IrqFlags; */ while (pAd && pAd->CmdQ.size > 0) { @@ -990,7 +990,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) switch (cmdqelmt->command) { case CMDTHREAD_CHECK_GPIO: { - UINT32 data; + u32 data; { /* Read GPIO pin2 as Hardware controlled radio state */ @@ -1052,8 +1052,8 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) case CMDTHREAD_RESET_BULK_OUT: { - UINT32 MACValue; - UCHAR Index; + u32 MACValue; + u8 Index; int ret = 0; PHT_TX_CONTEXT pHTTXContext; /* RTMP_TX_RING *pTxRing; */ @@ -1273,7 +1273,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) if (pAd-> bulkResetPipeid == 0) { - UCHAR + u8 pendingContext = 0; PHT_TX_CONTEXT @@ -1377,7 +1377,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) if ((atomic_read(&pAd->PendingRx) == 0) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS))) { - UCHAR i; + u8 i; RTUSBRxPacket(pAd); pAd->NextRxBulkInReadIndex = 0; // Next Rx Read index pAd->NextRxBulkInIndex = 0; // Rx Bulk pointer @@ -1405,7 +1405,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) /* All transfers must be aborted or cancelled before attempting to reset the pipe. */ { - UINT32 MACValue; + u32 MACValue; { /*while ((atomic_read(&pAd->PendingRx) > 0) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) */ @@ -1440,7 +1440,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) | fRTMP_ADAPTER_NIC_NOT_EXIST))))) { - UCHAR i; + u8 i; if (RTMP_TEST_FLAG (pAd, @@ -1607,8 +1607,8 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) case CMDTHREAD_SET_ASIC_WCID: { RT_SET_ASIC_WCID SetAsicWcid; - USHORT offset; - UINT32 MACValue, MACRValue = 0; + u16 offset; + u32 MACValue, MACRValue = 0; SetAsicWcid = *((PRT_SET_ASIC_WCID) (pData)); @@ -1618,7 +1618,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) offset = MAC_WCID_BASE + - ((UCHAR) SetAsicWcid.WCID) * + ((u8)SetAsicWcid.WCID) * HW_WCID_ENTRY_SIZE; DBGPRINT_RAW(RT_DEBUG_TRACE, @@ -1673,8 +1673,8 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) case CMDTHREAD_SET_ASIC_WCID_CIPHER: { RT_SET_ASIC_WCID_ATTRI SetAsicWcidAttri; - USHORT offset; - UINT32 MACRValue = 0; + u16 offset; + u32 MACRValue = 0; SHAREDKEY_MODE_STRUC csr1; SetAsicWcidAttri = *((PRT_SET_ASIC_WCID_ATTRI) @@ -1686,7 +1686,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) offset = MAC_WCID_ATTRIBUTE_BASE + - ((UCHAR) SetAsicWcidAttri.WCID) * + ((u8)SetAsicWcidAttri.WCID) * HW_WCID_ATTRI_SIZE; DBGPRINT_RAW(RT_DEBUG_TRACE, @@ -1698,7 +1698,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) &MACRValue); MACRValue = 0; MACRValue |= - (((UCHAR) SetAsicWcidAttri. + (((u8)SetAsicWcidAttri. Cipher) << 1); RTUSBWriteMACRegister(pAd, offset, @@ -1709,7 +1709,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) offset = PAIRWISE_IVEIV_TABLE_BASE + - ((UCHAR) SetAsicWcidAttri.WCID) * + ((u8)SetAsicWcidAttri.WCID) * HW_IVEIV_ENTRY_SIZE; MACRValue = 0; if ((SetAsicWcidAttri.Cipher <= @@ -1738,7 +1738,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) &MACRValue); MACRValue &= (~0xe); MACRValue |= - (((UCHAR) SetAsicWcidAttri. + (((u8)SetAsicWcidAttri. Cipher) << 1); RTUSBWriteMACRegister(pAd, @@ -1779,7 +1779,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) (pData)); AsicAddPairwiseKeyEntry(pAd, KeyInfo.MacAddr, - (UCHAR) KeyInfo. + (u8)KeyInfo. MacTabMatchWCID, &KeyInfo. CipherKey); @@ -1789,9 +1789,9 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) case RT_CMD_SET_RX_WCID_TABLE: /*General call for RTMPAddWcidAttributeEntry() */ { PMAC_TABLE_ENTRY pEntry; - UCHAR KeyIdx = 0; - UCHAR CipherAlg = CIPHER_NONE; - UCHAR ApIdx = BSS0; + u8 KeyIdx = 0; + u8 CipherAlg = CIPHER_NONE; + u8 ApIdx = BSS0; pEntry = (PMAC_TABLE_ENTRY) (pData); @@ -1813,7 +1813,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) AsicRemovePairwiseKeyEntry(pAd, pEntry-> apidx, - (UCHAR) + (u8) pEntry-> Aid); if ((pEntry->AuthMode <= @@ -1821,10 +1821,10 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) && (pEntry->WepStatus == Ndis802_11Encryption1Enabled)) { - UINT32 uIV = 1; - PUCHAR ptr; + u32 uIV = 1; + u8 *ptr; - ptr = (PUCHAR) & uIV; + ptr = (u8 *)& uIV; *(ptr + 3) = (pAd->StaCfg. DefaultKeyId << 6); @@ -1844,10 +1844,10 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) } else if (pEntry->AuthMode == Ndis802_11AuthModeWPANone) { - UINT32 uIV = 1; - PUCHAR ptr; + u32 uIV = 1; + u8 *ptr; - ptr = (PUCHAR) & uIV; + ptr = (u8 *)& uIV; *(ptr + 3) = (pAd->StaCfg. DefaultKeyId << 6); @@ -1869,7 +1869,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) /* Other case, disable engine. */ /* Don't worry WPA key, we will add WPA Key after 4-Way handshaking. */ /* */ - USHORT offset; + u16 offset; offset = MAC_WCID_ATTRIBUTE_BASE + @@ -1906,8 +1906,8 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) case OID_802_11_ADD_WEP: { - UINT i; - UINT32 KeyIdx; + u32 i; + u32 KeyIdx; PNDIS_802_11_WEP pWepKey; DBGPRINT(RT_DEBUG_TRACE, @@ -1926,10 +1926,10 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_ERROR, ("CmdThread::OID_802_11_ADD_WEP, INVALID_DATA!!\n")); } else { - UCHAR CipherAlg; + u8 CipherAlg; pAd->SharedKey[BSS0][KeyIdx]. KeyLen = - (UCHAR) pWepKey->KeyLength; + (u8)pWepKey->KeyLength; NdisMoveMemory(pAd-> SharedKey[BSS0] [KeyIdx].Key, @@ -1969,14 +1969,14 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) if (pWepKey-> KeyIndex & 0x80000000) { /* Default key for tx (shared key) */ - UCHAR IVEIV[8]; - UINT32 WCIDAttri, Value; - USHORT offset, offset2; + u8 IVEIV[8]; + u32 WCIDAttri, Value; + u16 offset, offset2; NdisZeroMemory(IVEIV, 8); pAd->StaCfg. DefaultKeyId = - (UCHAR) KeyIdx; + (u8)KeyIdx; /* Add BSSID to WCTable. because this is Tx wep key. */ /* WCID Attribute UDF:3, BSSIdx:3, Alg:3, Keytable:1=PAIRWISE KEY, BSSIdx is 0 */ WCIDAttri = @@ -1993,7 +1993,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) WCIDAttri); /* 1. IV/EIV */ /* Specify key index to find shared key. */ - IVEIV[3] = (UCHAR) (KeyIdx << 6); /*WEP Eiv bit off. groupkey index is not 0 */ + IVEIV[3] = (u8)(KeyIdx << 6); /*WEP Eiv bit off. groupkey index is not 0 */ offset = PAIRWISE_IVEIV_TABLE_BASE + @@ -2052,7 +2052,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) } AsicAddSharedKeyEntry(pAd, BSS0, - (UCHAR) + (u8) KeyIdx, CipherAlg, pWepKey-> @@ -2080,7 +2080,7 @@ VOID CMDHandler(IN PRTMP_ADAPTER pAd) case CMDTHREAD_SET_PSM_BIT: { - USHORT *pPsm = (USHORT *) pData; + u16 *pPsm = (u16 *) pData; MlmeSetPsmBit(pAd, *pPsm); } break; diff --git a/drivers/staging/rt3070/firmware.h b/drivers/staging/rt3070/firmware.h index d3c5d6c5ad53..5cf9cbcf4ab6 100644 --- a/drivers/staging/rt3070/firmware.h +++ b/drivers/staging/rt3070/firmware.h @@ -43,7 +43,7 @@ /* AUTO GEN PLEASE DO NOT MODIFY IT */ -UCHAR FirmwareImage_2870 [] = { +u8 FirmwareImage_2870 [] = { 0xff, 0xff, 0xff, 0x02, 0x10, 0x28, 0x02, 0x10, 0x32, 0x02, 0x10, 0x78, 0x02, 0x12, 0x67, 0x02, 0x12, 0x68, 0x02, 0x12, 0x87, 0x02, 0x12, 0x8c, 0x12, 0x12, 0x88, 0x22, 0x02, 0x16, 0x49, 0x02, 0x17, 0x1f, 0x02, 0x13, 0x77, 0x02, 0x12, 0x8d, 0x30, 0x05, 0x06, 0x20, 0x0d, 0x03, 0x12, 0x17, diff --git a/drivers/staging/rt3070/md4.h b/drivers/staging/rt3070/md4.h index f1e5b526350a..a9cc7b0f3ee3 100644 --- a/drivers/staging/rt3070/md4.h +++ b/drivers/staging/rt3070/md4.h @@ -30,13 +30,13 @@ /* MD4 context. */ typedef struct _MD4_CTX_ { - ULONG state[4]; /* state (ABCD) */ - ULONG count[2]; /* number of bits, modulo 2^64 (lsb first) */ - UCHAR buffer[64]; /* input buffer */ + unsigned long state[4]; /* state (ABCD) */ + unsigned long count[2]; /* number of bits, modulo 2^64 (lsb first) */ + u8 buffer[64]; /* input buffer */ } MD4_CTX; -VOID MD4Init (MD4_CTX *); -VOID MD4Update (MD4_CTX *, PUCHAR, UINT); -VOID MD4Final (UCHAR [16], MD4_CTX *); +void MD4Init (MD4_CTX *); +void MD4Update (MD4_CTX *, u8 *, UINT); +void MD4Final (u8 [16], MD4_CTX *); #endif //__MD4_H__ \ No newline at end of file diff --git a/drivers/staging/rt3090/firmware.h b/drivers/staging/rt3090/firmware.h index ef2576251dfa..17056e26795b 100644 --- a/drivers/staging/rt3090/firmware.h +++ b/drivers/staging/rt3090/firmware.h @@ -2,7 +2,7 @@ /* AUTO GEN PLEASE DO NOT MODIFY IT */ -UCHAR FirmwareImage_3090 [] = { +u8 FirmwareImage_3090 [] = { 0x02, 0x02, 0xf3, 0x02, 0x02, 0xa1, 0x22, 0x22, 0xff, 0xff, 0xff, 0x02, 0x01, 0x27, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x1e, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0xd8, 0xc0, 0xe0, 0xc0, 0xf0, 0xc0, 0x83, 0xc0, 0x82, 0xc0, 0xd0, 0x75, 0xd0, 0x18, 0xc2, 0xaf, 0x30, 0x45, 0x03, -- GitLab From 8a10a54656aff69de3530efa793cbec8d2b51d02 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 11 Dec 2009 12:23:15 -0800 Subject: [PATCH 168/235] Staging: rt28x0: remove typedefs (part two) Remove typedefs from rt_linux.h and rtmp_usb.h. Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/chip/mac_usb.h | 2 +- drivers/staging/rt2860/common/ba_action.c | 4 +- drivers/staging/rt2860/common/cmm_data.c | 40 ++-- drivers/staging/rt2860/common/cmm_data_pci.c | 20 +- drivers/staging/rt2860/common/cmm_data_usb.c | 6 +- drivers/staging/rt2860/common/cmm_mac_pci.c | 26 +-- drivers/staging/rt2860/common/cmm_mac_usb.c | 6 +- drivers/staging/rt2860/common/cmm_tkip.c | 4 +- drivers/staging/rt2860/common/cmm_wpa.c | 4 +- drivers/staging/rt2860/common/rtmp_init.c | 6 +- drivers/staging/rt2860/iface/rtmp_pci.h | 6 +- drivers/staging/rt2860/iface/rtmp_usb.h | 18 +- drivers/staging/rt2860/mlme.h | 2 +- drivers/staging/rt2860/pci_main_dev.c | 34 +-- drivers/staging/rt2860/rt_linux.c | 124 +++++------ drivers/staging/rt2860/rt_linux.h | 60 ++---- drivers/staging/rt2860/rt_main_dev.c | 16 +- drivers/staging/rt2860/rt_pci_rbus.c | 86 ++++---- drivers/staging/rt2860/rt_usb.c | 52 ++--- drivers/staging/rt2860/rtmp.h | 210 +++++++++---------- drivers/staging/rt2860/rtmp_os.h | 8 +- drivers/staging/rt2860/rtmp_timer.h | 2 +- drivers/staging/rt2860/sta/rtmp_data.c | 28 +-- drivers/staging/rt2860/sta_ioctl.c | 4 +- drivers/staging/rt2860/usb_main_dev.c | 2 +- drivers/staging/rt2870/common/rtusb_bulk.c | 38 ++-- drivers/staging/rt2870/common/rtusb_data.c | 6 +- drivers/staging/rt2870/common/rtusb_io.c | 2 +- 28 files changed, 394 insertions(+), 422 deletions(-) diff --git a/drivers/staging/rt2860/chip/mac_usb.h b/drivers/staging/rt2860/chip/mac_usb.h index b902074a41cc..f146232bf157 100644 --- a/drivers/staging/rt2860/chip/mac_usb.h +++ b/drivers/staging/rt2860/chip/mac_usb.h @@ -198,7 +198,7 @@ typedef struct _RX_CONTEXT { BOOLEAN Readable; /* Receive Complete back. OK for driver to indicate receiving packet. */ BOOLEAN IRPPending; /* TODO: To be removed */ atomic_t IrpLock; - NDIS_SPIN_LOCK RxContextLock; + spinlock_t RxContextLock; dma_addr_t data_dma; /* urb dma on linux */ } RX_CONTEXT, *PRX_CONTEXT; diff --git a/drivers/staging/rt2860/common/ba_action.c b/drivers/staging/rt2860/common/ba_action.c index 1ffa176ce8a5..f90d709bcf40 100644 --- a/drivers/staging/rt2860/common/ba_action.c +++ b/drivers/staging/rt2860/common/ba_action.c @@ -100,7 +100,7 @@ void BA_MaxWinSizeReasign(IN PRTMP_ADAPTER pAd, void Announce_Reordering_Packet(IN PRTMP_ADAPTER pAd, IN struct reordering_mpdu *mpdu) { - PNDIS_PACKET pPacket; + void *pPacket; pPacket = mpdu->pPacket; @@ -1388,7 +1388,7 @@ void convert_reordering_packet_to_preAMSDU_or_802_3_packet(IN PRTMP_ADAPTER pAd, u8 FromWhichBSSID) { - PNDIS_PACKET pRxPkt; + void *pRxPkt; u8 Header802_3[LENGTH_802_3]; /* 1. get 802.3 Header */ diff --git a/drivers/staging/rt2860/common/cmm_data.c b/drivers/staging/rt2860/common/cmm_data.c index cd000fb2be93..64b217710344 100644 --- a/drivers/staging/rt2860/common/cmm_data.c +++ b/drivers/staging/rt2860/common/cmm_data.c @@ -107,7 +107,7 @@ QID_AC_VO, QID_AC_VO }; int MiniportMMRequest(IN PRTMP_ADAPTER pAd, u8 QueIdx, u8 *pData, u32 Length) { - PNDIS_PACKET pPacket; + void *pPacket; int Status = NDIS_STATUS_SUCCESS; unsigned long FreeNum; u8 rtmpHwHdr[TXINFO_SIZE + TXWI_SIZE]; /*RTMP_HW_HDR_LEN]; */ @@ -243,7 +243,7 @@ int MiniportMMRequest(IN PRTMP_ADAPTER pAd, ======================================================================== */ int MlmeHardTransmit(IN PRTMP_ADAPTER pAd, - u8 QueIdx, IN PNDIS_PACKET pPacket) + u8 QueIdx, void *pPacket) { PACKET_INFO PacketInfo; u8 *pSrcBufVA; @@ -271,7 +271,7 @@ int MlmeHardTransmit(IN PRTMP_ADAPTER pAd, } int MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, - u8 QueIdx, IN PNDIS_PACKET pPacket) + u8 QueIdx, void *pPacket) { PACKET_INFO PacketInfo; u8 *pSrcBufVA; @@ -506,7 +506,7 @@ int MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, (2).Normal ======================================================================== */ -static u8 TxPktClassification(IN RTMP_ADAPTER * pAd, IN PNDIS_PACKET pPacket) +static u8 TxPktClassification(IN RTMP_ADAPTER * pAd, void *pPacket) { u8 TxFrameType = TX_UNKOWN_FRAME; u8 Wcid; @@ -557,7 +557,7 @@ static u8 TxPktClassification(IN RTMP_ADAPTER * pAd, IN PNDIS_PACKET pPacket) BOOLEAN RTMP_FillTxBlkInfo(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) { PACKET_INFO PacketInfo; - PNDIS_PACKET pPacket; + void *pPacket; PMAC_TABLE_ENTRY pMacEntry = NULL; pPacket = pTxBlk->pPacket; @@ -663,7 +663,7 @@ BOOLEAN RTMP_FillTxBlkInfo(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) } BOOLEAN CanDoAggregateTransmit(IN RTMP_ADAPTER * pAd, - IN NDIS_PACKET * pPacket, IN TX_BLK * pTxBlk) + char * pPacket, IN TX_BLK * pTxBlk) { /*DBGPRINT(RT_DEBUG_TRACE, ("Check if can do aggregation! TxFrameType=%d!\n", pTxBlk->TxFrameType)); */ @@ -716,7 +716,7 @@ void RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, u8 QIdx, /* u8 Max_Tx_Packets) { PQUEUE_ENTRY pEntry = NULL; - PNDIS_PACKET pPacket; + void *pPacket; int Status = NDIS_STATUS_SUCCESS; u8 Count = 0; PQUEUE_HEADER pQueue; @@ -1380,7 +1380,7 @@ void RTMPResumeMsduTransmission(IN PRTMP_ADAPTER pAd) } u32 deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, - PNDIS_PACKET pPacket, + void *pPacket, u8 *pData, unsigned long DataSize) { u16 PayloadSize; @@ -1390,7 +1390,7 @@ u32 deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, u8 Header802_3[14]; u8 *pPayload, *pDA, *pSA, *pRemovedLLCSNAP; - PNDIS_PACKET pClonePacket; + void *pClonePacket; nMSDU = 0; @@ -1479,7 +1479,7 @@ u32 deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, return nMSDU; } -u32 BA_Reorder_AMSDU_Annnounce(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) +u32 BA_Reorder_AMSDU_Annnounce(IN PRTMP_ADAPTER pAd, void *pPacket) { u8 *pData; u16 DataSize; @@ -1853,7 +1853,7 @@ void DisassocParmFill(IN PRTMP_ADAPTER pAd, ======================================================================== */ -BOOLEAN RTMPCheckDHCPFrame(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) +BOOLEAN RTMPCheckDHCPFrame(IN PRTMP_ADAPTER pAd, void *pPacket) { PACKET_INFO PacketInfo; unsigned long NumberOfBytesRead = 0; @@ -1908,7 +1908,7 @@ BOOLEAN RTMPCheckDHCPFrame(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) return TRUE; } -BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) +BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, void *pPacket) { u16 TypeLen; u8 Byte0, Byte1; @@ -1938,7 +1938,7 @@ BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) */ if (pSrcBuf[0] == 0xAA && pSrcBuf[1] == 0xAA && pSrcBuf[2] == 0x03) { - Sniff2BytesFromNdisBuffer((PNDIS_BUFFER) pSrcBuf, 6, + Sniff2BytesFromNdisBuffer((char *)pSrcBuf, 6, &Byte0, &Byte1); RTMP_SET_PACKET_LLCSNAP(pPacket, 1); TypeLen = (u16)((Byte0 << 8) + Byte1); @@ -1961,7 +1961,7 @@ BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) Frame Check Sequence (4-bytes) */ RTMP_SET_PACKET_VLAN(pPacket, 1); - Sniff2BytesFromNdisBuffer((PNDIS_BUFFER) pSrcBuf, 2, &Byte0, + Sniff2BytesFromNdisBuffer((char *)pSrcBuf, 2, &Byte0, &Byte1); TypeLen = (u16)((Byte0 << 8) + Byte1); @@ -2043,7 +2043,7 @@ void Update_Rssi_Sample(IN PRTMP_ADAPTER pAd, void Indicate_Legacy_Packet(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk, u8 FromWhichBSSID) { - PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; + void *pRxPacket = pRxBlk->pRxPacket; u8 Header802_3[LENGTH_802_3]; /* 1. get 802.3 Header */ @@ -2135,7 +2135,7 @@ void CmmRxRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, u16 Msdu2Size; u16 Payload1Size, Payload2Size; u8 *pData2; - PNDIS_PACKET pPacket2 = NULL; + void *pPacket2 = NULL; Msdu2Size = *(pRxBlk->pData) + (*(pRxBlk->pData + 1) << 8); @@ -2192,13 +2192,13 @@ void CmmRxRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, _fragFrame.Flags = 0; \ } -PNDIS_PACKET RTMPDeFragmentDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) +void *RTMPDeFragmentDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) { PHEADER_802_11 pHeader = pRxBlk->pHeader; - PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; + void *pRxPacket = pRxBlk->pRxPacket; u8 *pData = pRxBlk->pData; u16 DataSize = pRxBlk->DataSize; - PNDIS_PACKET pRetPacket = NULL; + void *pRetPacket = NULL; u8 *pFragBuffer = NULL; BOOLEAN bReassDone = FALSE; u8 HeaderRoom = 0; @@ -2273,7 +2273,7 @@ done: /* return defragmented packet if packet is reassembled completely */ /* otherwise return NULL */ if (bReassDone) { - PNDIS_PACKET pNewFragPacket; + void *pNewFragPacket; /* allocate a new packet buffer for fragment */ pNewFragPacket = diff --git a/drivers/staging/rt2860/common/cmm_data_pci.c b/drivers/staging/rt2860/common/cmm_data_pci.c index 19eb9286135d..b2549473fa8b 100644 --- a/drivers/staging/rt2860/common/cmm_data_pci.c +++ b/drivers/staging/rt2860/common/cmm_data_pci.c @@ -343,7 +343,7 @@ u16 RtmpPCI_WriteFragTxResource(IN PRTMP_ADAPTER pAd, */ int RtmpPCIMgmtKickOut(IN RTMP_ADAPTER * pAd, u8 QueIdx, - IN PNDIS_PACKET pPacket, + void *pPacket, u8 *pSrcBufVA, u32 SrcBufLen) { PTXD_STRUC pTxD; @@ -520,7 +520,7 @@ BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, u8 QueIdx) { PRTMP_TX_RING pTxRing; PTXD_STRUC pTxD; - PNDIS_PACKET pPacket; + void *pPacket; u8 FREE = 0; TXD_STRUC TxD, *pOriTxD; /*unsigned long IrqFlags; */ @@ -664,7 +664,7 @@ BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd, void RTMPHandleMgmtRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd) { PTXD_STRUC pTxD; - PNDIS_PACKET pPacket; + void *pPacket; /* int i; */ u8 FREE = 0; PRTMP_MGMT_RING pMgmtRing = &pAd->MgmtRing; @@ -773,16 +773,16 @@ void RTMPHandleRxCoherentInterrupt(IN PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_TRACE, ("<== RTMPHandleRxCoherentInterrupt \n")); } -PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, +void *GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, OUT PRT28XX_RXD_STRUC pSaveRxD, OUT BOOLEAN * pbReschedule, IN u32 * pRxPending) { PRXD_STRUC pRxD; - PNDIS_PACKET pRxPacket = NULL; - PNDIS_PACKET pNewPacket; + void *pRxPacket = NULL; + void *pNewPacket; void *AllocVa; - NDIS_PHYSICAL_ADDRESS AllocPa; + dma_addr_t AllocPa; BOOLEAN bReschedule = FALSE; RTMP_DMACB *pRxCell; @@ -834,7 +834,7 @@ PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, pRxPacket = pRxCell->pNdisPacket; pRxCell->DmaBuf.AllocSize = RX_BUFFER_AGGRESIZE; - pRxCell->pNdisPacket = (PNDIS_PACKET) pNewPacket; + pRxCell->pNdisPacket = (void *)pNewPacket; pRxCell->DmaBuf.AllocVa = AllocVa; pRxCell->DmaBuf.AllocPa = AllocPa; /* update SDP0 to new buffer of rx packet */ @@ -865,7 +865,7 @@ done: } int MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, - u8 QueIdx, IN PNDIS_PACKET pPacket) + u8 QueIdx, void *pPacket) { PACKET_INFO PacketInfo; u8 *pSrcBufVA; @@ -1041,7 +1041,7 @@ int MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, } int MlmeDataHardTransmit(IN PRTMP_ADAPTER pAd, - u8 QueIdx, IN PNDIS_PACKET pPacket) + u8 QueIdx, void *pPacket) { if ((pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) ) { diff --git a/drivers/staging/rt2860/common/cmm_data_usb.c b/drivers/staging/rt2860/common/cmm_data_usb.c index 790675659362..f3a7208e043e 100644 --- a/drivers/staging/rt2860/common/cmm_data_usb.c +++ b/drivers/staging/rt2860/common/cmm_data_usb.c @@ -575,7 +575,7 @@ void RtmpUSBDataKickOut(IN PRTMP_ADAPTER pAd, */ int RtmpUSBMgmtKickOut(IN RTMP_ADAPTER * pAd, u8 QueIdx, - IN PNDIS_PACKET pPacket, + void *pPacket, u8 *pSrcBufVA, u32 SrcBufLen) { PTXINFO_STRUC pTxInfo; @@ -707,13 +707,13 @@ Return Value: Note: ======================================================================== */ -PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, +void *GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, OUT PRT28XX_RXD_STRUC pSaveRxD, OUT BOOLEAN * pbReschedule, IN u32 * pRxPending) { PRX_CONTEXT pRxContext; - PNDIS_PACKET pSkb; + void *pSkb; u8 *pData; unsigned long ThisFrameLen; unsigned long RxBufferLength; diff --git a/drivers/staging/rt2860/common/cmm_mac_pci.c b/drivers/staging/rt2860/common/cmm_mac_pci.c index c7f4be1181cd..f00534220562 100644 --- a/drivers/staging/rt2860/common/cmm_mac_pci.c +++ b/drivers/staging/rt2860/common/cmm_mac_pci.c @@ -60,7 +60,7 @@ int RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) unsigned long ErrorValue = 0; PRTMP_TX_RING pTxRing; PRTMP_DMABUF pDmaBuf; - PNDIS_PACKET pPacket; + void *pPacket; /* PRTMP_REORDERBUF pReorderBuf; */ DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPAllocTxRxRingMemory\n")); @@ -405,7 +405,7 @@ void RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, u8 RingType) PTXD_STRUC pTxD; PRXD_STRUC pRxD; PQUEUE_ENTRY pEntry; - PNDIS_PACKET pPacket; + void *pPacket; int i; PRTMP_TX_RING pTxRing; unsigned long IrqFlags; @@ -428,8 +428,8 @@ void RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, u8 RingType) { pTxD = (PTXD_STRUC) pTxRing->Cell[i].AllocVa; - pPacket = (PNDIS_PACKET) pTxRing->Cell[i].pNdisPacket; - /* release scatter-and-gather NDIS_PACKET */ + pPacket = (void *)pTxRing->Cell[i].pNdisPacket; + /* release scatter-and-gather char */ if (pPacket) { RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); @@ -437,8 +437,8 @@ void RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, u8 RingType) } pPacket = - (PNDIS_PACKET) pTxRing->Cell[i].pNextNdisPacket; - /* release scatter-and-gather NDIS_PACKET */ + (void *)pTxRing->Cell[i].pNextNdisPacket; + /* release scatter-and-gather char */ if (pPacket) { RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); @@ -474,8 +474,8 @@ void RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, u8 RingType) pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[i].AllocVa; pPacket = - (PNDIS_PACKET) pAd->MgmtRing.Cell[i].pNdisPacket; - /* rlease scatter-and-gather NDIS_PACKET */ + (void *)pAd->MgmtRing.Cell[i].pNdisPacket; + /* rlease scatter-and-gather char */ if (pPacket) { PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr0, pTxD->SDLen0, @@ -486,9 +486,9 @@ void RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, u8 RingType) pAd->MgmtRing.Cell[i].pNdisPacket = NULL; pPacket = - (PNDIS_PACKET) pAd->MgmtRing.Cell[i]. + (void *)pAd->MgmtRing.Cell[i]. pNextNdisPacket; - /* release scatter-and-gather NDIS_PACKET */ + /* release scatter-and-gather char */ if (pPacket) { PCI_UNMAP_SINGLE(pAd, pTxD->SDPtr1, pTxD->SDLen1, @@ -538,17 +538,17 @@ void RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) int index, num, j; PRTMP_TX_RING pTxRing; PTXD_STRUC pTxD; - PNDIS_PACKET pPacket; + void *pPacket; unsigned int IrqFlags; - /*POS_COOKIE pObj =(POS_COOKIE) pAd->OS_Cookie; */ + /*struct os_cookie *pObj =(struct os_cookie *)pAd->OS_Cookie; */ DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPFreeTxRxRingMemory\n")); /* Free TxSwQueue Packet */ for (index = 0; index < NUM_OF_TX_RING; index++) { PQUEUE_ENTRY pEntry; - PNDIS_PACKET pPacket; + void *pPacket; PQUEUE_HEADER pQueue; RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); diff --git a/drivers/staging/rt2860/common/cmm_mac_usb.c b/drivers/staging/rt2860/common/cmm_mac_usb.c index d5bc37d82792..251debb67d7c 100644 --- a/drivers/staging/rt2860/common/cmm_mac_usb.c +++ b/drivers/staging/rt2860/common/cmm_mac_usb.c @@ -52,7 +52,7 @@ int NICInitRecv(IN PRTMP_ADAPTER pAd) { u8 i; int Status = NDIS_STATUS_SUCCESS; - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitRecv\n")); pObj = pObj; @@ -166,7 +166,7 @@ int NICInitTransmit(IN PRTMP_ADAPTER pAd) PTX_CONTEXT pRTSContext = &(pAd->RTSContext); PTX_CONTEXT pMLMEContext = NULL; /* PHT_TX_CONTEXT pHTTXContext = NULL; */ - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; void *RingBaseVa; /* RTMP_TX_RING *pTxRing; */ RTMP_MGMT_RING *pMgmtRing; @@ -538,7 +538,7 @@ void RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) PTX_CONTEXT pRTSContext = &pAd->RTSContext; /* PHT_TX_CONTEXT pHTTXContext; */ /*PRTMP_REORDERBUF pReorderBuf; */ - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; /* RTMP_TX_RING *pTxRing; */ DBGPRINT(RT_DEBUG_ERROR, ("---> RTMPFreeTxRxRingMemory\n")); diff --git a/drivers/staging/rt2860/common/cmm_tkip.c b/drivers/staging/rt2860/common/cmm_tkip.c index ab00a0c5e3e3..0ac9d744a86d 100644 --- a/drivers/staging/rt2860/common/cmm_tkip.c +++ b/drivers/staging/rt2860/common/cmm_tkip.c @@ -487,7 +487,7 @@ BOOLEAN RTMPTkipCompareMICValue(IN PRTMP_ADAPTER pAd, Arguments: pAd Pointer to our adapter - PNDIS_PACKET Pointer to Ndis Packet for MIC calculation + void * Pointer to Ndis Packet for MIC calculation pEncap Pointer to LLC encap data LenEncap Total encap length, might be 0 which indicates no encap @@ -501,7 +501,7 @@ BOOLEAN RTMPTkipCompareMICValue(IN PRTMP_ADAPTER pAd, ======================================================================== */ void RTMPCalculateMICValue(IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, + void *pPacket, u8 *pEncap, IN PCIPHER_KEY pKey, u8 apidx) { diff --git a/drivers/staging/rt2860/common/cmm_wpa.c b/drivers/staging/rt2860/common/cmm_wpa.c index 3fce5a717194..6daccd94e1e1 100644 --- a/drivers/staging/rt2860/common/cmm_wpa.c +++ b/drivers/staging/rt2860/common/cmm_wpa.c @@ -347,7 +347,7 @@ void WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Arguments: pAd Pointer to our adapter - PNDIS_PACKET Pointer to outgoing Ndis frame + void * Pointer to outgoing Ndis frame NumberOfFrag Number of fragment required Return Value: @@ -363,7 +363,7 @@ void RTMPToWirelessSta(IN PRTMP_ADAPTER pAd, u32 HdrLen, u8 *pData, u32 DataLen, IN BOOLEAN bClearFrame) { - PNDIS_PACKET pPacket; + void *pPacket; int Status; if ((!pEntry) || ((!pEntry->ValidAsCLI) && (!pEntry->ValidAsApCli))) diff --git a/drivers/staging/rt2860/common/rtmp_init.c b/drivers/staging/rt2860/common/rtmp_init.c index 5735dd7c182d..5cda0ea53f3b 100644 --- a/drivers/staging/rt2860/common/rtmp_init.c +++ b/drivers/staging/rt2860/common/rtmp_init.c @@ -651,7 +651,7 @@ void RTMPReadChannelPwr(IN PRTMP_ADAPTER pAd) ======================================================================== */ int NICReadRegParameters(IN PRTMP_ADAPTER pAd, - IN NDIS_HANDLE WrapperConfigurationContext) + void *WrapperConfigurationContext) { int Status = NDIS_STATUS_SUCCESS; DBGPRINT_S(Status, ("<-- NICReadRegParameters, Status=%x\n", Status)); @@ -3544,9 +3544,9 @@ BOOLEAN RtmpRaDevCtrlExit(IN RTMP_ADAPTER * pAd) } /* not yet support MBSS */ -PNET_DEV get_netdev_from_bssid(IN PRTMP_ADAPTER pAd, u8 FromWhichBSSID) +struct net_device *get_netdev_from_bssid(IN PRTMP_ADAPTER pAd, u8 FromWhichBSSID) { - PNET_DEV dev_p = NULL; + struct net_device *dev_p = NULL; { dev_p = pAd->net_dev; diff --git a/drivers/staging/rt2860/iface/rtmp_pci.h b/drivers/staging/rt2860/iface/rtmp_pci.h index 4f42158321ce..7759d56a3043 100644 --- a/drivers/staging/rt2860/iface/rtmp_pci.h +++ b/drivers/staging/rt2860/iface/rtmp_pci.h @@ -29,7 +29,7 @@ #define __RTMP_PCI_H__ #define RT28XX_HANDLE_DEV_ASSIGN(handle, dev_p) \ - ((POS_COOKIE)handle)->pci_dev = dev_p; + ((struct os_cookie *)handle)->pci_dev = dev_p; #ifdef LINUX // set driver data @@ -41,12 +41,12 @@ #ifdef PCI_MSI_SUPPORT #define RTMP_MSI_ENABLE(_pAd) \ - { POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \ + { struct os_cookie *_pObj = (struct os_cookie *)(_pAd->OS_Cookie); \ (_pAd)->HaveMsi = pci_enable_msi(_pObj->pci_dev) == 0 ? TRUE : FALSE; \ } #define RTMP_MSI_DISABLE(_pAd) \ - { POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \ + { struct os_cookie *_pObj = (struct os_cookie *)(_pAd->OS_Cookie); \ if (_pAd->HaveMsi == TRUE) \ pci_disable_msi(_pObj->pci_dev); \ _pAd->HaveMsi = FALSE; \ diff --git a/drivers/staging/rt2860/iface/rtmp_usb.h b/drivers/staging/rt2860/iface/rtmp_usb.h index 40d7d01cfe82..f2955a2de029 100644 --- a/drivers/staging/rt2860/iface/rtmp_usb.h +++ b/drivers/staging/rt2860/iface/rtmp_usb.h @@ -32,10 +32,6 @@ #ifdef LINUX #include - -typedef struct usb_device *PUSB_DEV; -typedef struct urb *purbb_t; -typedef struct usb_ctrlrequest devctrlrequest; #endif // LINUX // extern u8 EpToQueue[6]; @@ -108,7 +104,7 @@ extern void dump_urb(struct urb *purb); #define USBD_TRANSFER_DIRECTION_OUT 0 #define USBD_TRANSFER_DIRECTION_IN 0 #define USBD_SHORT_TRANSFER_OK 0 -#define PURB purbb_t +#define PURB struct urb * #define PIRP void * #define NDIS_OID u32 @@ -120,12 +116,12 @@ extern void dump_urb(struct urb *purb); #define CONTROL_TIMEOUT_JIFFIES ( (100 * OS_HZ) / 1000) #define UNLINK_TIMEOUT_MS 3 -void RTUSBBulkOutDataPacketComplete(purbb_t purb, struct pt_regs *pt_regs); -void RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs *pt_regs); -void RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs); -void RTUSBBulkOutRTSFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs); -void RTUSBBulkOutPsPollComplete(purbb_t pUrb, struct pt_regs *pt_regs); -void RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs); +void RTUSBBulkOutDataPacketComplete(struct urb *purb, struct pt_regs *pt_regs); +void RTUSBBulkOutMLMEPacketComplete(struct urb *pUrb, struct pt_regs *pt_regs); +void RTUSBBulkOutNullFrameComplete(struct urb *pUrb, struct pt_regs *pt_regs); +void RTUSBBulkOutRTSFrameComplete(struct urb *pUrb, struct pt_regs *pt_regs); +void RTUSBBulkOutPsPollComplete(struct urb *pUrb, struct pt_regs *pt_regs); +void RTUSBBulkRxComplete(struct urb *pUrb, struct pt_regs *pt_regs); #ifdef KTHREAD_SUPPORT #define RTUSBMlmeUp(pAd) \ diff --git a/drivers/staging/rt2860/mlme.h b/drivers/staging/rt2860/mlme.h index 3be1bc89095c..09e326ee85b0 100644 --- a/drivers/staging/rt2860/mlme.h +++ b/drivers/staging/rt2860/mlme.h @@ -843,7 +843,7 @@ typedef struct _MLME_QUEUE { unsigned long Num; unsigned long Head; unsigned long Tail; - NDIS_SPIN_LOCK Lock; + spinlock_t Lock; MLME_QUEUE_ELEM Entry[MAX_LEN_OF_MLME_QUEUE]; } MLME_QUEUE, *PMLME_QUEUE; diff --git a/drivers/staging/rt2860/pci_main_dev.c b/drivers/staging/rt2860/pci_main_dev.c index 24f939ddd446..20db402b1d99 100644 --- a/drivers/staging/rt2860/pci_main_dev.c +++ b/drivers/staging/rt2860/pci_main_dev.c @@ -160,7 +160,7 @@ static int rt2860_suspend(struct pci_dev *pci_dev, pm_message_t state) RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); /* take down the device */ - rt28xx_close((PNET_DEV) net_dev); + rt28xx_close((struct net_device *)net_dev); RT_MOD_DEC_USE_COUNT(); } @@ -223,7 +223,7 @@ static int rt2860_resume(struct pci_dev *pci_dev) /* mark device as attached from system and restart if needed */ netif_device_attach(net_dev); - if (rt28xx_open((PNET_DEV) net_dev) != 0) { + if (rt28xx_open((struct net_device *)net_dev) != 0) { /* open fail */ DBGPRINT(RT_DEBUG_TRACE, ("<=== rt2860_resume()\n")); @@ -323,7 +323,7 @@ static int __devinit rt2860_probe(IN struct pci_dev *pci_dev, goto err_out_iounmap; } - ((POS_COOKIE) handle)->pci_dev = pci_dev; + ((struct os_cookie *)handle)->pci_dev = pci_dev; rv = RTMPAllocAdapterBlock(handle, &pAd); /*shiang: we may need the pci_dev for allocate structure of "RTMP_ADAPTER" */ if (rv != NDIS_STATUS_SUCCESS) @@ -391,7 +391,7 @@ err_out: static void __devexit rt2860_remove_one(IN struct pci_dev *pci_dev) { - PNET_DEV net_dev = pci_get_drvdata(pci_dev); + struct net_device *net_dev = pci_get_drvdata(pci_dev); RTMP_ADAPTER *pAd = NULL; unsigned long csr_addr = net_dev->base_addr; /* pAd->CSRBaseAddress; */ @@ -459,9 +459,9 @@ BOOLEAN RT28XXChipsetCheck(IN void *_dev_p) static void RTMPInitPCIeDevice(IN struct pci_dev *pci_dev, IN PRTMP_ADAPTER pAd) { u16 device_id; - POS_COOKIE pObj; + struct os_cookie *pObj; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; pci_read_config_word(pci_dev, PCI_DEVICE_ID, &device_id); device_id = le2cpu16(device_id); pObj->DeviceID = device_id; @@ -501,9 +501,9 @@ void RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) u16 reg16, data2, PCIePowerSaveLevel, Configuration; u32 MacValue; BOOLEAN bFindIntel = FALSE; - POS_COOKIE pObj; + struct os_cookie *pObj; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) return; @@ -815,10 +815,10 @@ void RTMPFindHostPCIDev(IN PRTMP_ADAPTER pAd) u16 reg16; u8 reg8; u32 DevFn; - PPCI_DEV pPci_dev; - POS_COOKIE pObj; + struct pci_dev *pPci_dev; + struct os_cookie *pObj; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) return; @@ -860,9 +860,9 @@ void RTMPPCIeLinkCtrlValueRestore(IN PRTMP_ADAPTER pAd, u8 Level) { u16 PCIePowerSaveLevel, reg16; u16 Configuration; - POS_COOKIE pObj; + struct os_cookie *pObj; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) return; @@ -954,9 +954,9 @@ void RTMPPCIeLinkCtrlSetting(IN PRTMP_ADAPTER pAd, u16 Max) { u16 PCIePowerSaveLevel, reg16; u16 Configuration; - POS_COOKIE pObj; + struct os_cookie *pObj; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_PCIE_DEVICE)) return; @@ -1081,11 +1081,11 @@ void RTMPrt3xSetPCIePowerLinkCtrl(IN PRTMP_ADAPTER pAd) unsigned long HostConfiguration = 0; unsigned long Configuration; - POS_COOKIE pObj; + struct os_cookie *pObj; int pos; u16 reg16; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; DBGPRINT(RT_DEBUG_INFO, ("RTMPrt3xSetPCIePowerLinkCtrl.===> %lx\n", diff --git a/drivers/staging/rt2860/rt_linux.c b/drivers/staging/rt2860/rt_linux.c index 5f781f532815..4c2811799442 100644 --- a/drivers/staging/rt2860/rt_linux.c +++ b/drivers/staging/rt2860/rt_linux.c @@ -80,7 +80,7 @@ char const *pWirelessFloodEventText[IW_FLOOD_EVENT_TYPE_NUM] = { }; /* timeout -- ms */ -void RTMP_SetPeriodicTimer(IN NDIS_MINIPORT_TIMER * pTimer, +void RTMP_SetPeriodicTimer(struct timer_list * pTimer, IN unsigned long timeout) { timeout = ((timeout * OS_HZ) / 1000); @@ -90,7 +90,7 @@ void RTMP_SetPeriodicTimer(IN NDIS_MINIPORT_TIMER * pTimer, /* convert NdisMInitializeTimer --> RTMP_OS_Init_Timer */ void RTMP_OS_Init_Timer(IN PRTMP_ADAPTER pAd, - IN NDIS_MINIPORT_TIMER * pTimer, + struct timer_list * pTimer, IN TIMER_FUNCTION function, void *data) { init_timer(pTimer); @@ -98,7 +98,7 @@ void RTMP_OS_Init_Timer(IN PRTMP_ADAPTER pAd, pTimer->function = function; } -void RTMP_OS_Add_Timer(IN NDIS_MINIPORT_TIMER * pTimer, +void RTMP_OS_Add_Timer(struct timer_list * pTimer, IN unsigned long timeout) { if (timer_pending(pTimer)) @@ -109,14 +109,14 @@ void RTMP_OS_Add_Timer(IN NDIS_MINIPORT_TIMER * pTimer, add_timer(pTimer); } -void RTMP_OS_Mod_Timer(IN NDIS_MINIPORT_TIMER * pTimer, +void RTMP_OS_Mod_Timer(struct timer_list * pTimer, IN unsigned long timeout) { timeout = ((timeout * OS_HZ) / 1000); mod_timer(pTimer, jiffies + timeout); } -void RTMP_OS_Del_Timer(IN NDIS_MINIPORT_TIMER * pTimer, +void RTMP_OS_Del_Timer(struct timer_list * pTimer, OUT BOOLEAN * pCancelled) { if (timer_pending(pTimer)) { @@ -168,16 +168,16 @@ int os_free_mem(IN PRTMP_ADAPTER pAd, void *mem) return (NDIS_STATUS_SUCCESS); } -PNDIS_PACKET RtmpOSNetPktAlloc(IN RTMP_ADAPTER * pAd, IN int size) +void *RtmpOSNetPktAlloc(IN RTMP_ADAPTER * pAd, IN int size) { struct sk_buff *skb; /* Add 2 more bytes for ip header alignment */ skb = dev_alloc_skb(size + 2); - return ((PNDIS_PACKET) skb); + return ((void *)skb); } -PNDIS_PACKET RTMP_AllocateFragPacketBuffer(IN PRTMP_ADAPTER pAd, +void *RTMP_AllocateFragPacketBuffer(IN PRTMP_ADAPTER pAd, unsigned long Length) { struct sk_buff *pkt; @@ -193,10 +193,10 @@ PNDIS_PACKET RTMP_AllocateFragPacketBuffer(IN PRTMP_ADAPTER pAd, RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pkt), PKTSRC_NDIS); } - return (PNDIS_PACKET) pkt; + return (void *)pkt; } -PNDIS_PACKET RTMP_AllocateTxPacketBuffer(IN PRTMP_ADAPTER pAd, +void *RTMP_AllocateTxPacketBuffer(IN PRTMP_ADAPTER pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress) @@ -217,11 +217,11 @@ PNDIS_PACKET RTMP_AllocateTxPacketBuffer(IN PRTMP_ADAPTER pAd, *VirtualAddress = (void *)NULL; } - return (PNDIS_PACKET) pkt; + return (void *)pkt; } void build_tx_packet(IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, + void *pPacket, u8 *pFrame, unsigned long FrameLen) { @@ -235,10 +235,10 @@ void build_tx_packet(IN PRTMP_ADAPTER pAd, void RTMPFreeAdapter(IN PRTMP_ADAPTER pAd) { - POS_COOKIE os_cookie; + struct os_cookie *os_cookie; int index; - os_cookie = (POS_COOKIE) pAd->OS_Cookie; + os_cookie = (struct os_cookie *)pAd->OS_Cookie; if (pAd->BeaconBuf) kfree(pAd->BeaconBuf); @@ -277,7 +277,7 @@ BOOLEAN OS_Need_Clone_Packet(void) clone an input NDIS PACKET to another one. The new internally created NDIS PACKET must have only one NDIS BUFFER return - byte copied. 0 means can't create NDIS PACKET - NOTE: internally created NDIS_PACKET should be destroyed by RTMPFreeNdisPacket + NOTE: internally created char should be destroyed by RTMPFreeNdisPacket Arguments: pAd Pointer to our adapter @@ -294,8 +294,8 @@ BOOLEAN OS_Need_Clone_Packet(void) */ int RTMPCloneNdisPacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN pInsAMSDUHdr, - IN PNDIS_PACKET pInPacket, - OUT PNDIS_PACKET * ppOutPacket) + void *pInPacket, + void ** ppOutPacket) { struct sk_buff *pkt; @@ -324,18 +324,18 @@ int RTMPCloneNdisPacket(IN PRTMP_ADAPTER pAd, /* the allocated NDIS PACKET must be freed via RTMPFreeNdisPacket() */ int RTMPAllocateNdisPacket(IN PRTMP_ADAPTER pAd, - OUT PNDIS_PACKET * ppPacket, + void ** ppPacket, u8 *pHeader, u32 HeaderLen, u8 *pData, u32 DataLen) { - PNDIS_PACKET pPacket; + void *pPacket; ASSERT(pData); ASSERT(DataLen); /* 1. Allocate a packet */ pPacket = - (PNDIS_PACKET *) dev_alloc_skb(HeaderLen + DataLen + + (void **) dev_alloc_skb(HeaderLen + DataLen + RTMP_PKT_TAIL_PADDING); if (pPacket == NULL) { *ppPacket = NULL; @@ -363,11 +363,11 @@ int RTMPAllocateNdisPacket(IN PRTMP_ADAPTER pAd, /* ======================================================================== Description: - This routine frees a miniport internally allocated NDIS_PACKET and its + This routine frees a miniport internally allocated char and its corresponding NDIS_BUFFER and allocated memory. ======================================================================== */ -void RTMPFreeNdisPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) +void RTMPFreeNdisPacket(IN PRTMP_ADAPTER pAd, void *pPacket) { dev_kfree_skb_any(RTPKT_TO_OSPKT(pPacket)); } @@ -375,7 +375,7 @@ void RTMPFreeNdisPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) /* IRQL = DISPATCH_LEVEL */ /* NOTE: we do have an assumption here, that Byte0 and Byte1 always reasid at the same */ /* scatter gather buffer */ -int Sniff2BytesFromNdisBuffer(IN PNDIS_BUFFER pFirstBuffer, +int Sniff2BytesFromNdisBuffer(char *pFirstBuffer, u8 DesiredOffset, u8 *pByte0, u8 *pByte1) { @@ -385,12 +385,12 @@ int Sniff2BytesFromNdisBuffer(IN PNDIS_BUFFER pFirstBuffer, return NDIS_STATUS_SUCCESS; } -void RTMP_QueryPacketInfo(IN PNDIS_PACKET pPacket, +void RTMP_QueryPacketInfo(void *pPacket, OUT PACKET_INFO * pPacketInfo, u8 ** pSrcBufVA, u32 * pSrcBufLen) { pPacketInfo->BufferCount = 1; - pPacketInfo->pFirstBuffer = (PNDIS_BUFFER) GET_OS_PKT_DATAPTR(pPacket); + pPacketInfo->pFirstBuffer = (char *)GET_OS_PKT_DATAPTR(pPacket); pPacketInfo->PhysicalBufferCount = 1; pPacketInfo->TotalPacketLength = GET_OS_PKT_LEN(pPacket); @@ -398,11 +398,11 @@ void RTMP_QueryPacketInfo(IN PNDIS_PACKET pPacket, *pSrcBufLen = GET_OS_PKT_LEN(pPacket); } -void RTMP_QueryNextPacketInfo(IN PNDIS_PACKET * ppPacket, +void RTMP_QueryNextPacketInfo(void ** ppPacket, OUT PACKET_INFO * pPacketInfo, u8 ** pSrcBufVA, u32 * pSrcBufLen) { - PNDIS_PACKET pPacket = NULL; + void *pPacket = NULL; if (*ppPacket) pPacket = GET_OS_PKT_NEXT(*ppPacket); @@ -410,7 +410,7 @@ void RTMP_QueryNextPacketInfo(IN PNDIS_PACKET * ppPacket, if (pPacket) { pPacketInfo->BufferCount = 1; pPacketInfo->pFirstBuffer = - (PNDIS_BUFFER) GET_OS_PKT_DATAPTR(pPacket); + (char *)GET_OS_PKT_DATAPTR(pPacket); pPacketInfo->PhysicalBufferCount = 1; pPacketInfo->TotalPacketLength = GET_OS_PKT_LEN(pPacket); @@ -429,11 +429,11 @@ void RTMP_QueryNextPacketInfo(IN PNDIS_PACKET * ppPacket, } } -PNDIS_PACKET DuplicatePacket(IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, u8 FromWhichBSSID) +void *DuplicatePacket(IN PRTMP_ADAPTER pAd, + void *pPacket, u8 FromWhichBSSID) { struct sk_buff *skb; - PNDIS_PACKET pRetPacket = NULL; + void *pRetPacket = NULL; u16 DataSize; u8 *pData; @@ -450,14 +450,14 @@ PNDIS_PACKET DuplicatePacket(IN PRTMP_ADAPTER pAd, } -PNDIS_PACKET duplicate_pkt(IN PRTMP_ADAPTER pAd, +void *duplicate_pkt(IN PRTMP_ADAPTER pAd, u8 *pHeader802_3, u32 HdrLen, u8 *pData, unsigned long DataSize, u8 FromWhichBSSID) { struct sk_buff *skb; - PNDIS_PACKET pPacket = NULL; + void *pPacket = NULL; if ((skb = __dev_alloc_skb(HdrLen + DataSize + 2, MEM_ALLOC_FLAG)) != NULL) { @@ -474,8 +474,8 @@ PNDIS_PACKET duplicate_pkt(IN PRTMP_ADAPTER pAd, } #define TKIP_TX_MIC_SIZE 8 -PNDIS_PACKET duplicate_pkt_with_TKIP_MIC(IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket) +void *duplicate_pkt_with_TKIP_MIC(IN PRTMP_ADAPTER pAd, + void *pPacket) { struct sk_buff *skb, *newskb; @@ -497,8 +497,8 @@ PNDIS_PACKET duplicate_pkt_with_TKIP_MIC(IN PRTMP_ADAPTER pAd, return OSPKT_TO_RTPKT(skb); } -PNDIS_PACKET ClonePacket(IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, +void *ClonePacket(IN PRTMP_ADAPTER pAd, + void *pPacket, u8 *pData, unsigned long DataSize) { struct sk_buff *pRxPkt; @@ -564,7 +564,7 @@ void wlan_802_11_to_802_3_packet(IN PRTMP_ADAPTER pAd, LENGTH_802_3); } -void announce_802_3_packet(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) +void announce_802_3_packet(IN PRTMP_ADAPTER pAd, void *pPacket) { struct sk_buff *pRxPkt; @@ -580,7 +580,7 @@ void announce_802_3_packet(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) } PRTMP_SCATTER_GATHER_LIST -rt_get_sg_list_from_packet(PNDIS_PACKET pPacket, RTMP_SCATTER_GATHER_LIST * sg) +rt_get_sg_list_from_packet(void *pPacket, RTMP_SCATTER_GATHER_LIST * sg) { sg->NumberOfElements = 1; sg->Elements[0].Address = GET_OS_PKT_DATAPTR(pPacket); @@ -905,7 +905,7 @@ err_free_sk_buff: Device IRQ related functions. *******************************************************************************/ -int RtmpOSIRQRequest(IN PNET_DEV pNetDev) +int RtmpOSIRQRequest(struct net_device *pNetDev) { #ifdef RTMP_PCI_SUPPORT struct net_device *net_dev = pNetDev; @@ -917,7 +917,7 @@ int RtmpOSIRQRequest(IN PNET_DEV pNetDev) ASSERT(pAd); if (pAd->infType == RTMP_DEV_INF_PCI) { - POS_COOKIE _pObj = (POS_COOKIE) (pAd->OS_Cookie); + struct os_cookie *_pObj = (struct os_cookie *)(pAd->OS_Cookie); RTMP_MSI_ENABLE(pAd); retval = request_irq(_pObj->pci_dev->irq, rt2860_interrupt, SA_SHIRQ, @@ -932,7 +932,7 @@ int RtmpOSIRQRequest(IN PNET_DEV pNetDev) #endif } -int RtmpOSIRQRelease(IN PNET_DEV pNetDev) +int RtmpOSIRQRelease(struct net_device *pNetDev) { struct net_device *net_dev = pNetDev; PRTMP_ADAPTER pAd = NULL; @@ -943,7 +943,7 @@ int RtmpOSIRQRelease(IN PNET_DEV pNetDev) #ifdef RTMP_PCI_SUPPORT if (pAd->infType == RTMP_DEV_INF_PCI) { - POS_COOKIE pObj = (POS_COOKIE) (pAd->OS_Cookie); + struct os_cookie *pObj = (struct os_cookie *)(pAd->OS_Cookie); synchronize_irq(pObj->pci_dev->irq); free_irq(pObj->pci_dev->irq, (net_dev)); RTMP_MSI_DISABLE(pAd); @@ -958,7 +958,7 @@ int RtmpOSIRQRelease(IN PNET_DEV pNetDev) File open/close related functions. *******************************************************************************/ -RTMP_OS_FD RtmpOSFileOpen(char *pPath, int flag, int mode) +struct file *RtmpOSFileOpen(char *pPath, int flag, int mode) { struct file *filePtr; @@ -969,21 +969,21 @@ RTMP_OS_FD RtmpOSFileOpen(char *pPath, int flag, int mode) -PTR_ERR(filePtr), pPath)); } - return (RTMP_OS_FD) filePtr; + return (struct file *)filePtr; } -int RtmpOSFileClose(RTMP_OS_FD osfd) +int RtmpOSFileClose(struct file *osfd) { filp_close(osfd, NULL); return 0; } -void RtmpOSFileSeek(RTMP_OS_FD osfd, int offset) +void RtmpOSFileSeek(struct file *osfd, int offset) { osfd->f_pos = offset; } -int RtmpOSFileRead(RTMP_OS_FD osfd, char *pDataPtr, int readLen) +int RtmpOSFileRead(struct file *osfd, char *pDataPtr, int readLen) { /* The object must have a read method */ if (osfd->f_op && osfd->f_op->read) { @@ -994,7 +994,7 @@ int RtmpOSFileRead(RTMP_OS_FD osfd, char *pDataPtr, int readLen) } } -int RtmpOSFileWrite(RTMP_OS_FD osfd, char *pDataPtr, int writeLen) +int RtmpOSFileWrite(struct file *osfd, char *pDataPtr, int writeLen) { return osfd->f_op->write(osfd, pDataPtr, (size_t) writeLen, &osfd->f_pos); @@ -1164,7 +1164,7 @@ int RtmpOSWrielessEventSend(IN RTMP_ADAPTER * pAd, return 0; } -int RtmpOSNetDevAddrSet(IN PNET_DEV pNetDev, u8 *pMacAddr) +int RtmpOSNetDevAddrSet(struct net_device *pNetDev, u8 *pMacAddr) { struct net_device *net_dev; RTMP_ADAPTER *pAd; @@ -1188,10 +1188,10 @@ int RtmpOSNetDevAddrSet(IN PNET_DEV pNetDev, u8 *pMacAddr) * Assign the network dev name for created Ralink WiFi interface. */ static int RtmpOSNetDevRequestName(IN RTMP_ADAPTER * pAd, - IN PNET_DEV dev, + struct net_device *dev, char *pPrefixStr, int devIdx) { - PNET_DEV existNetDev; + struct net_device *existNetDev; char suffixName[IFNAMSIZ]; char desiredName[IFNAMSIZ]; int ifNameIdx, prefixLen, slotNameLen; @@ -1231,19 +1231,19 @@ static int RtmpOSNetDevRequestName(IN RTMP_ADAPTER * pAd, return Status; } -void RtmpOSNetDevClose(IN PNET_DEV pNetDev) +void RtmpOSNetDevClose(struct net_device *pNetDev) { dev_close(pNetDev); } -void RtmpOSNetDevFree(PNET_DEV pNetDev) +void RtmpOSNetDevFree(struct net_device *pNetDev) { ASSERT(pNetDev); free_netdev(pNetDev); } -int RtmpOSNetDevAlloc(IN PNET_DEV * new_dev_p, u32 privDataSize) +int RtmpOSNetDevAlloc(struct net_device ** new_dev_p, u32 privDataSize) { /* assign it as null first. */ *new_dev_p = NULL; @@ -1258,16 +1258,16 @@ int RtmpOSNetDevAlloc(IN PNET_DEV * new_dev_p, u32 privDataSize) return NDIS_STATUS_FAILURE; } -PNET_DEV RtmpOSNetDevGetByName(PNET_DEV pNetDev, char *pDevName) +struct net_device *RtmpOSNetDevGetByName(struct net_device *pNetDev, char *pDevName) { - PNET_DEV pTargetNetDev = NULL; + struct net_device *pTargetNetDev = NULL; pTargetNetDev = dev_get_by_name(dev_net(pNetDev), pDevName); return pTargetNetDev; } -void RtmpOSNetDeviceRefPut(PNET_DEV pNetDev) +void RtmpOSNetDeviceRefPut(struct net_device *pNetDev) { /* every time dev_get_by_name is called, and it has returned a valid struct @@ -1278,7 +1278,7 @@ void RtmpOSNetDeviceRefPut(PNET_DEV pNetDev) dev_put(pNetDev); } -int RtmpOSNetDevDestory(IN RTMP_ADAPTER * pAd, IN PNET_DEV pNetDev) +int RtmpOSNetDevDestory(IN RTMP_ADAPTER * pAd, struct net_device *pNetDev) { /* TODO: Need to fix this */ @@ -1286,12 +1286,12 @@ int RtmpOSNetDevDestory(IN RTMP_ADAPTER * pAd, IN PNET_DEV pNetDev) return 0; } -void RtmpOSNetDevDetach(PNET_DEV pNetDev) +void RtmpOSNetDevDetach(struct net_device *pNetDev) { unregister_netdev(pNetDev); } -int RtmpOSNetDevAttach(IN PNET_DEV pNetDev, +int RtmpOSNetDevAttach(struct net_device *pNetDev, IN RTMP_OS_NETDEV_OP_HOOK * pDevOpHook) { int ret, rtnl_locked = FALSE; @@ -1331,7 +1331,7 @@ int RtmpOSNetDevAttach(IN PNET_DEV pNetDev, return NDIS_STATUS_FAILURE; } -PNET_DEV RtmpOSNetDevCreate(IN RTMP_ADAPTER * pAd, +struct net_device *RtmpOSNetDevCreate(IN RTMP_ADAPTER * pAd, int devType, int devNum, int privMemSize, char *pNamePrefix) diff --git a/drivers/staging/rt2860/rt_linux.h b/drivers/staging/rt2860/rt_linux.h index 629310a2af9d..d63ac7d3936a 100644 --- a/drivers/staging/rt2860/rt_linux.h +++ b/drivers/staging/rt2860/rt_linux.h @@ -103,18 +103,6 @@ extern const struct iw_handler_def rt28xx_iw_handler_def; /*********************************************************************************** * OS Specific definitions and data structures ***********************************************************************************/ -typedef struct pci_dev *PPCI_DEV; -typedef struct net_device *PNET_DEV; -typedef void *PNDIS_PACKET; -typedef char NDIS_PACKET; -typedef PNDIS_PACKET *PPNDIS_PACKET; -typedef dma_addr_t NDIS_PHYSICAL_ADDRESS; -typedef dma_addr_t *PNDIS_PHYSICAL_ADDRESS; -typedef void *NDIS_HANDLE; -typedef char *PNDIS_BUFFER; -typedef struct pid *RTMP_OS_PID; -typedef struct semaphore RTMP_OS_SEM; - typedef int (*HARD_START_XMIT_FUNC) (struct sk_buff * skb, struct net_device * net_dev); @@ -196,8 +184,6 @@ struct iw_statistics *rt28xx_get_wireless_stats(IN struct net_device *net_dev); /*********************************************************************************** * OS file operation related data structure definitions ***********************************************************************************/ -typedef struct file *RTMP_OS_FD; - typedef struct _RTMP_OS_FS_INFO_ { int fsuid; int fsgid; @@ -214,8 +200,6 @@ struct os_lock { unsigned long flags; }; -typedef spinlock_t NDIS_SPIN_LOCK; - /* */ /* spin_lock enhanced for Nested spin lock */ /* */ @@ -349,23 +333,17 @@ do { \ ***********************************************************************************/ #define RTMP_OS_MGMT_TASK_FLAGS CLONE_VM -typedef struct pid *THREAD_PID; #define THREAD_PID_INIT_VALUE NULL #define GET_PID(_v) find_get_pid((_v)) #define GET_PID_NUMBER(_v) pid_nr((_v)) #define CHECK_PID_LEGALITY(_pid) if (pid_nr((_pid)) > 0) #define KILL_THREAD_PID(_A, _B, _C) kill_pid((_A), (_B), (_C)) -typedef struct tasklet_struct RTMP_NET_TASK_STRUCT; -typedef struct tasklet_struct *PRTMP_NET_TASK_STRUCT; - /*********************************************************************************** * Timer related definitions and data structures. **********************************************************************************/ #define OS_HZ HZ -typedef struct timer_list NDIS_MINIPORT_TIMER; -typedef struct timer_list RTMP_OS_TIMER; typedef void (*TIMER_FUNCTION) (unsigned long); #define OS_WAIT(_time) \ @@ -409,20 +387,20 @@ struct os_cookie { struct usb_device *pUsb_Dev; #endif /* RTMP_MAC_USB // */ - RTMP_NET_TASK_STRUCT rx_done_task; - RTMP_NET_TASK_STRUCT mgmt_dma_done_task; - RTMP_NET_TASK_STRUCT ac0_dma_done_task; - RTMP_NET_TASK_STRUCT ac1_dma_done_task; - RTMP_NET_TASK_STRUCT ac2_dma_done_task; - RTMP_NET_TASK_STRUCT ac3_dma_done_task; - RTMP_NET_TASK_STRUCT tbtt_task; + struct tasklet_struct rx_done_task; + struct tasklet_struct mgmt_dma_done_task; + struct tasklet_struct ac0_dma_done_task; + struct tasklet_struct ac1_dma_done_task; + struct tasklet_struct ac2_dma_done_task; + struct tasklet_struct ac3_dma_done_task; + struct tasklet_struct tbtt_task; #ifdef RTMP_MAC_PCI - RTMP_NET_TASK_STRUCT fifo_statistic_full_task; + struct tasklet_struct fifo_statistic_full_task; #endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB - RTMP_NET_TASK_STRUCT null_frame_complete_task; - RTMP_NET_TASK_STRUCT rts_frame_complete_task; - RTMP_NET_TASK_STRUCT pspoll_frame_complete_task; + struct tasklet_struct null_frame_complete_task; + struct tasklet_struct rts_frame_complete_task; + struct tasklet_struct pspoll_frame_complete_task; #endif /* RTMP_MAC_USB // */ unsigned long apd_pid; /*802.1x daemon pid */ @@ -430,8 +408,6 @@ struct os_cookie { int ioctl_if; }; -typedef struct os_cookie *POS_COOKIE; - /*********************************************************************************** * OS debugging and printing related definitions and data structure ***********************************************************************************/ @@ -510,21 +486,21 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, /* * unsigned long * RTMP_GetPhysicalAddressLow( - * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); + * dma_addr_t PhysicalAddress); */ #define RTMP_GetPhysicalAddressLow(PhysicalAddress) (PhysicalAddress) /* * unsigned long * RTMP_GetPhysicalAddressHigh( - * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); + * dma_addr_t PhysicalAddress); */ #define RTMP_GetPhysicalAddressHigh(PhysicalAddress) (0) /* * void * RTMP_SetPhysicalAddressLow( - * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, + * dma_addr_t PhysicalAddress, * unsigned long Value); */ #define RTMP_SetPhysicalAddressLow(PhysicalAddress, Value) \ @@ -533,7 +509,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, /* * void * RTMP_SetPhysicalAddressHigh( - * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, + * dma_addr_t PhysicalAddress, * unsigned long Value); */ #define RTMP_SetPhysicalAddressHigh(PhysicalAddress, Value) @@ -652,7 +628,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, #define RTMP_OS_NETDEV_CARRIER_OFF(_pNetDev) netif_carrier_off((_pNetDev)) #define QUEUE_ENTRY_TO_PACKET(pEntry) \ - (PNDIS_PACKET)(pEntry) + (void *)(pEntry) #define PACKET_TO_QUEUE_ENTRY(pPacket) \ (PQUEUE_ENTRY)(pPacket) @@ -671,7 +647,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, * os packet to rt packet */ #define RTPKT_TO_OSPKT(_p) ((struct sk_buff *)(_p)) -#define OSPKT_TO_RTPKT(_p) ((PNDIS_PACKET)(_p)) +#define OSPKT_TO_RTPKT(_p) ((void *)(_p)) #define GET_OS_PKT_DATAPTR(_pkt) \ (RTPKT_TO_OSPKT(_pkt)->data) @@ -861,7 +837,7 @@ int rt28xx_packet_xmit(struct sk_buff *skb); IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance); #endif /* RTMP_MAC_PCI // */ -int rt28xx_sta_ioctl(IN PNET_DEV net_dev, IN OUT struct ifreq *rq, int cmd); +int rt28xx_sta_ioctl(struct net_device *net_dev, IN OUT struct ifreq *rq, int cmd); extern int ra_mtd_write(int num, loff_t to, size_t len, const u_char * buf); extern int ra_mtd_read(int num, loff_t from, size_t len, u_char * buf); diff --git a/drivers/staging/rt2860/rt_main_dev.c b/drivers/staging/rt2860/rt_main_dev.c index 21313ee596c6..347279912e44 100644 --- a/drivers/staging/rt2860/rt_main_dev.c +++ b/drivers/staging/rt2860/rt_main_dev.c @@ -208,7 +208,7 @@ Note: (3) BA Reordering: ba_reordering_resource_release() ======================================================================== */ -int rt28xx_close(IN PNET_DEV dev) +int rt28xx_close(struct net_device *dev) { struct net_device *net_dev = (struct net_device *)dev; RTMP_ADAPTER *pAd = NULL; @@ -378,12 +378,12 @@ Return Value: Note: ======================================================================== */ -int rt28xx_open(IN PNET_DEV dev) +int rt28xx_open(struct net_device *dev) { struct net_device *net_dev = (struct net_device *)dev; PRTMP_ADAPTER pAd = NULL; int retval = 0; - /*POS_COOKIE pObj; */ + /*struct os_cookie *pObj; */ GET_PAD_FROM_NET_DEV(pAd, net_dev); @@ -459,7 +459,7 @@ static const struct net_device_ops rt2860_netdev_ops = { .ndo_start_xmit = rt28xx_send_packets, }; -PNET_DEV RtmpPhyNetDevInit(IN RTMP_ADAPTER * pAd, +struct net_device *RtmpPhyNetDevInit(IN RTMP_ADAPTER * pAd, IN RTMP_OS_NETDEV_OP_HOOK * pNetDevHook) { struct net_device *net_dev = NULL; @@ -511,7 +511,7 @@ int rt28xx_packet_xmit(struct sk_buff *skb) struct net_device *net_dev = skb->dev; PRTMP_ADAPTER pAd = NULL; int status = NETDEV_TX_OK; - PNDIS_PACKET pPacket = (PNDIS_PACKET) skb; + void *pPacket = (void *)skb; GET_PAD_FROM_NET_DEV(pAd, net_dev); @@ -534,7 +534,7 @@ int rt28xx_packet_xmit(struct sk_buff *skb) } RTMP_SET_PACKET_5VT(pPacket, 0); - STASendPackets((NDIS_HANDLE) pAd, (PPNDIS_PACKET) & pPacket, 1); + STASendPackets((void *)pAd, (void **)& pPacket, 1); status = NETDEV_TX_OK; done: @@ -566,7 +566,7 @@ static int rt28xx_send_packets(IN struct sk_buff *skb_p, GET_PAD_FROM_NET_DEV(pAd, net_dev); if (!(net_dev->flags & IFF_UP)) { - RELEASE_NDIS_PACKET(pAd, (PNDIS_PACKET) skb_p, + RELEASE_NDIS_PACKET(pAd, (void *)skb_p, NDIS_STATUS_FAILURE); return NETDEV_TX_OK; } @@ -690,7 +690,7 @@ static struct net_device_stats *RT28xx_get_ether_stats(IN struct net_device return NULL; } -BOOLEAN RtmpPhyNetDevExit(IN RTMP_ADAPTER * pAd, IN PNET_DEV net_dev) +BOOLEAN RtmpPhyNetDevExit(IN RTMP_ADAPTER * pAd, struct net_device *net_dev) { /* Unregister network device */ diff --git a/drivers/staging/rt2860/rt_pci_rbus.c b/drivers/staging/rt2860/rt_pci_rbus.c index 8df44ba436ff..7494df4a7d6c 100644 --- a/drivers/staging/rt2860/rt_pci_rbus.c +++ b/drivers/staging/rt2860/rt_pci_rbus.c @@ -82,9 +82,9 @@ void RTMP_AllocateTxDescMemory(IN PRTMP_ADAPTER pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) + dma_addr_t *PhysicalAddress) { - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; *VirtualAddress = (void *)pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, @@ -97,9 +97,9 @@ void RTMP_AllocateMgmtDescMemory(IN PRTMP_ADAPTER pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) + dma_addr_t *PhysicalAddress) { - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; *VirtualAddress = (void *)pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, @@ -112,9 +112,9 @@ void RTMP_AllocateRxDescMemory(IN PRTMP_ADAPTER pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) + dma_addr_t *PhysicalAddress) { - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; *VirtualAddress = (void *)pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, @@ -126,9 +126,9 @@ void RTMP_AllocateRxDescMemory(IN PRTMP_ADAPTER pAd, void RTMP_FreeDescMemory(IN PRTMP_ADAPTER pAd, unsigned long Length, void *VirtualAddress, - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress) + dma_addr_t PhysicalAddress) { - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; pci_free_consistent(pObj->pci_dev, Length, VirtualAddress, PhysicalAddress); @@ -140,9 +140,9 @@ void RTMP_AllocateFirstTxBuffer(IN PRTMP_ADAPTER pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) + dma_addr_t *PhysicalAddress) { - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; *VirtualAddress = (void *)pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, @@ -153,9 +153,9 @@ void RTMP_FreeFirstTxBuffer(IN PRTMP_ADAPTER pAd, unsigned long Length, IN BOOLEAN Cached, void *VirtualAddress, - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress) + dma_addr_t PhysicalAddress) { - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; pci_free_consistent(pObj->pci_dev, Length, VirtualAddress, PhysicalAddress); @@ -174,9 +174,9 @@ void RTMP_AllocateSharedMemory(IN PRTMP_ADAPTER pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress) + dma_addr_t *PhysicalAddress) { - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; *VirtualAddress = (void *)pci_alloc_consistent(pObj->pci_dev, sizeof(char) * Length, @@ -194,11 +194,11 @@ void RTMP_AllocateSharedMemory(IN PRTMP_ADAPTER pAd, * Notes: * Cached is ignored: always cached memory */ -PNDIS_PACKET RTMP_AllocateRxPacketBuffer(IN PRTMP_ADAPTER pAd, +void *RTMP_AllocateRxPacketBuffer(IN PRTMP_ADAPTER pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS + OUT dma_addr_t * PhysicalAddress) { struct sk_buff *pkt; @@ -218,15 +218,15 @@ PNDIS_PACKET RTMP_AllocateRxPacketBuffer(IN PRTMP_ADAPTER pAd, PCI_DMA_FROMDEVICE); } else { *VirtualAddress = (void *)NULL; - *PhysicalAddress = (NDIS_PHYSICAL_ADDRESS) NULL; + *PhysicalAddress = (dma_addr_t)NULL; } - return (PNDIS_PACKET) pkt; + return (void *)pkt; } void Invalid_Remaining_Packet(IN PRTMP_ADAPTER pAd, unsigned long VirtualAddress) { - NDIS_PHYSICAL_ADDRESS PhysicalAddress; + dma_addr_t PhysicalAddress; PhysicalAddress = PCI_MAP_SINGLE(pAd, (void *)(VirtualAddress + 1600), @@ -235,9 +235,9 @@ void Invalid_Remaining_Packet(IN PRTMP_ADAPTER pAd, unsigned long VirtualAddress int RtmpNetTaskInit(IN RTMP_ADAPTER * pAd) { - POS_COOKIE pObj; + struct os_cookie *pObj; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; tasklet_init(&pObj->rx_done_task, rx_done_tasklet, (unsigned long)pAd); tasklet_init(&pObj->mgmt_dma_done_task, mgmt_dma_done_tasklet, @@ -259,9 +259,9 @@ int RtmpNetTaskInit(IN RTMP_ADAPTER * pAd) void RtmpNetTaskExit(IN RTMP_ADAPTER * pAd) { - POS_COOKIE pObj; + struct os_cookie *pObj; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; tasklet_kill(&pObj->rx_done_task); tasklet_kill(&pObj->mgmt_dma_done_task); @@ -339,7 +339,7 @@ static void mgmt_dma_done_tasklet(unsigned long data) unsigned long flags; PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; + struct os_cookie *pObj; /* Do nothing if the driver is starting halt state. */ /* This might happen when timer already been fired before cancel timer with mlmehalt */ @@ -347,7 +347,7 @@ static void mgmt_dma_done_tasklet(unsigned long data) (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; /* printk("mgmt_dma_done_process\n"); */ IntSource.word = 0; @@ -378,7 +378,7 @@ static void rx_done_tasklet(unsigned long data) unsigned long flags; PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; BOOLEAN bReschedule = 0; - POS_COOKIE pObj; + struct os_cookie *pObj; /* Do nothing if the driver is starting halt state. */ /* This might happen when timer already been fired before cancel timer with mlmehalt */ @@ -386,7 +386,7 @@ static void rx_done_tasklet(unsigned long data) (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; pAd->int_pending &= ~(INT_RX); bReschedule = STARxDoneInterruptHandle(pAd, 0); @@ -411,7 +411,7 @@ void fifo_statistic_full_tasklet(unsigned long data) { unsigned long flags; PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; - POS_COOKIE pObj; + struct os_cookie *pObj; /* Do nothing if the driver is starting halt state. */ /* This might happen when timer already been fired before cancel timer with mlmehalt */ @@ -419,7 +419,7 @@ void fifo_statistic_full_tasklet(unsigned long data) (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; pAd->int_pending &= ~(FifoStaFullInt); NICUpdateFifoStaCounters(pAd); @@ -446,7 +446,7 @@ static void ac3_dma_done_tasklet(unsigned long data) unsigned long flags; PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; + struct os_cookie *pObj; BOOLEAN bReschedule = 0; /* Do nothing if the driver is starting halt state. */ @@ -455,7 +455,7 @@ static void ac3_dma_done_tasklet(unsigned long data) (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; /* printk("ac0_dma_done_process\n"); */ IntSource.word = 0; @@ -484,7 +484,7 @@ static void ac2_dma_done_tasklet(unsigned long data) unsigned long flags; PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; + struct os_cookie *pObj; BOOLEAN bReschedule = 0; /* Do nothing if the driver is starting halt state. */ @@ -493,7 +493,7 @@ static void ac2_dma_done_tasklet(unsigned long data) (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; IntSource.word = 0; IntSource.field.Ac2DmaDone = 1; @@ -522,7 +522,7 @@ static void ac1_dma_done_tasklet(unsigned long data) unsigned long flags; PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; + struct os_cookie *pObj; BOOLEAN bReschedule = 0; /* Do nothing if the driver is starting halt state. */ @@ -531,7 +531,7 @@ static void ac1_dma_done_tasklet(unsigned long data) (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; /* printk("ac0_dma_done_process\n"); */ IntSource.word = 0; @@ -560,7 +560,7 @@ static void ac0_dma_done_tasklet(unsigned long data) unsigned long flags; PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; + struct os_cookie *pObj; BOOLEAN bReschedule = 0; /* Do nothing if the driver is starting halt state. */ @@ -569,7 +569,7 @@ static void ac0_dma_done_tasklet(unsigned long data) (pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)) return; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; /* printk("ac0_dma_done_process\n"); */ IntSource.word = 0; @@ -606,11 +606,11 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) struct net_device *net_dev = (struct net_device *)dev_instance; PRTMP_ADAPTER pAd = NULL; INT_SOURCE_CSR_STRUC IntSource; - POS_COOKIE pObj; + struct os_cookie *pObj; GET_PAD_FROM_NET_DEV(pAd, net_dev); - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; /* Note 03312008: we can not return here before RTMP_IO_READ32(pAd, INT_SOURCE_CSR, &IntSource.word); @@ -794,7 +794,7 @@ dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, int sd_idx, int direction) { PRTMP_ADAPTER pAd; - POS_COOKIE pObj; + struct os_cookie *pObj; /* ------ Porting Information ------ @@ -813,7 +813,7 @@ dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, */ pAd = (PRTMP_ADAPTER) handle; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; if (sd_idx == 1) { PTX_BLK pTxBlk; @@ -830,10 +830,10 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int direction) { PRTMP_ADAPTER pAd; - POS_COOKIE pObj; + struct os_cookie *pObj; pAd = (PRTMP_ADAPTER) handle; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; pci_unmap_single(pObj->pci_dev, dma_addr, size, direction); diff --git a/drivers/staging/rt2860/rt_usb.c b/drivers/staging/rt2860/rt_usb.c index 2db7d6e14869..68f6f48f7251 100644 --- a/drivers/staging/rt2860/rt_usb.c +++ b/drivers/staging/rt2860/rt_usb.c @@ -198,17 +198,17 @@ void RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd) static void rtusb_dataout_complete(unsigned long data) { PRTMP_ADAPTER pAd; - purbb_t pUrb; - POS_COOKIE pObj; + struct urb *pUrb; + struct os_cookie *pObj; PHT_TX_CONTEXT pHTTXContext; u8 BulkOutPipeId; int Status; unsigned long IrqFlags; - pUrb = (purbb_t) data; + pUrb = (struct urb *)data; pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; pAd = pHTTXContext->pAd; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; Status = pUrb->status; /* Store BulkOut PipeId */ @@ -296,11 +296,11 @@ static void rtusb_null_frame_done_tasklet(unsigned long data) { PRTMP_ADAPTER pAd; PTX_CONTEXT pNullContext; - purbb_t pUrb; + struct urb *pUrb; int Status; unsigned long irqFlag; - pUrb = (purbb_t) data; + pUrb = (struct urb *)data; pNullContext = (PTX_CONTEXT) pUrb->context; pAd = pNullContext->pAd; Status = pUrb->status; @@ -345,11 +345,11 @@ static void rtusb_rts_frame_done_tasklet(unsigned long data) { PRTMP_ADAPTER pAd; PTX_CONTEXT pRTSContext; - purbb_t pUrb; + struct urb *pUrb; int Status; unsigned long irqFlag; - pUrb = (purbb_t) data; + pUrb = (struct urb *)data; pRTSContext = (PTX_CONTEXT) pUrb->context; pAd = pRTSContext->pAd; Status = pUrb->status; @@ -395,10 +395,10 @@ static void rtusb_pspoll_frame_done_tasklet(unsigned long data) { PRTMP_ADAPTER pAd; PTX_CONTEXT pPsPollContext; - purbb_t pUrb; + struct urb *pUrb; int Status; - pUrb = (purbb_t) data; + pUrb = (struct urb *)data; pPsPollContext = (PTX_CONTEXT) pUrb->context; pAd = pPsPollContext->pAd; Status = pUrb->status; @@ -452,13 +452,13 @@ Note: */ static void rx_done_tasklet(unsigned long data) { - purbb_t pUrb; + struct urb *pUrb; PRX_CONTEXT pRxContext; PRTMP_ADAPTER pAd; int Status; unsigned int IrqFlags; - pUrb = (purbb_t) data; + pUrb = (struct urb *)data; pRxContext = (PRX_CONTEXT) pUrb->context; pAd = pRxContext->pAd; Status = pUrb->status; @@ -517,12 +517,12 @@ static void rtusb_mgmt_dma_done_tasklet(unsigned long data) PRTMP_ADAPTER pAd; PTX_CONTEXT pMLMEContext; int index; - PNDIS_PACKET pPacket; - purbb_t pUrb; + void *pPacket; + struct urb *pUrb; int Status; unsigned long IrqFlags; - pUrb = (purbb_t) data; + pUrb = (struct urb *)data; pMLMEContext = (PTX_CONTEXT) pUrb->context; pAd = pMLMEContext->pAd; Status = pUrb->status; @@ -598,9 +598,9 @@ static void rtusb_ac3_dma_done_tasklet(unsigned long data) PRTMP_ADAPTER pAd; PHT_TX_CONTEXT pHTTXContext; u8 BulkOutPipeId = 3; - purbb_t pUrb; + struct urb *pUrb; - pUrb = (purbb_t) data; + pUrb = (struct urb *)data; pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; pAd = pHTTXContext->pAd; @@ -638,9 +638,9 @@ static void rtusb_ac2_dma_done_tasklet(unsigned long data) PRTMP_ADAPTER pAd; PHT_TX_CONTEXT pHTTXContext; u8 BulkOutPipeId = 2; - purbb_t pUrb; + struct urb *pUrb; - pUrb = (purbb_t) data; + pUrb = (struct urb *)data; pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; pAd = pHTTXContext->pAd; @@ -678,9 +678,9 @@ static void rtusb_ac1_dma_done_tasklet(unsigned long data) PRTMP_ADAPTER pAd; PHT_TX_CONTEXT pHTTXContext; u8 BulkOutPipeId = 1; - purbb_t pUrb; + struct urb *pUrb; - pUrb = (purbb_t) data; + pUrb = (struct urb *)data; pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; pAd = pHTTXContext->pAd; @@ -718,9 +718,9 @@ static void rtusb_ac0_dma_done_tasklet(unsigned long data) PRTMP_ADAPTER pAd; PHT_TX_CONTEXT pHTTXContext; u8 BulkOutPipeId = 0; - purbb_t pUrb; + struct urb *pUrb; - pUrb = (purbb_t) data; + pUrb = (struct urb *)data; pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; pAd = pHTTXContext->pAd; @@ -755,7 +755,7 @@ static void rtusb_ac0_dma_done_tasklet(unsigned long data) int RtmpNetTaskInit(IN RTMP_ADAPTER * pAd) { - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; /* Create receive tasklet */ tasklet_init(&pObj->rx_done_task, rx_done_tasklet, (unsigned long)pAd); @@ -782,9 +782,9 @@ int RtmpNetTaskInit(IN RTMP_ADAPTER * pAd) void RtmpNetTaskExit(IN RTMP_ADAPTER * pAd) { - POS_COOKIE pObj; + struct os_cookie *pObj; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; tasklet_kill(&pObj->rx_done_task); tasklet_kill(&pObj->mgmt_dma_done_task); diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h index 6acd29f73121..8182b2aa4563 100644 --- a/drivers/staging/rt2860/rtmp.h +++ b/drivers/staging/rt2860/rtmp.h @@ -479,23 +479,23 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { typedef struct _RTMP_DMABUF { unsigned long AllocSize; void *AllocVa; /* TxBuf virtual address */ - NDIS_PHYSICAL_ADDRESS AllocPa; /* TxBuf physical address */ + dma_addr_t AllocPa; /* TxBuf physical address */ } RTMP_DMABUF, *PRTMP_DMABUF; /* */ /* Control block (Descriptor) for all ring descriptor DMA operation, buffer must be */ -/* contiguous physical memory. NDIS_PACKET stored the binding Rx packet descriptor */ +/* contiguous physical memory. char stored the binding Rx packet descriptor */ /* which won't be released, driver has to wait until upper layer return the packet */ /* before giveing up this rx ring descriptor to ASIC. NDIS_BUFFER is assocaited pair */ -/* to describe the packet buffer. For Tx, NDIS_PACKET stored the tx packet descriptor */ +/* to describe the packet buffer. For Tx, char stored the tx packet descriptor */ /* which driver should ACK upper layer when the tx is physically done or failed. */ /* */ typedef struct _RTMP_DMACB { unsigned long AllocSize; /* Control block size */ void *AllocVa; /* Control block virtual address */ - NDIS_PHYSICAL_ADDRESS AllocPa; /* Control block physical address */ - PNDIS_PACKET pNdisPacket; - PNDIS_PACKET pNextNdisPacket; + dma_addr_t AllocPa; /* Control block physical address */ + void *pNdisPacket; + void *pNextNdisPacket; RTMP_DMABUF DmaBuf; /* Associated DMA buffer structure */ } RTMP_DMACB, *PRTMP_DMACB; @@ -728,7 +728,7 @@ typedef struct _CISCO_IAPP_CONTENT_ { * Fragment Frame structure */ typedef struct _FRAGMENT_FRAME { - PNDIS_PACKET pFragPacket; + void *pFragPacket; unsigned long RxSize; u16 Sequence; u16 LastFrag; @@ -742,7 +742,7 @@ typedef struct _PACKET_INFO { u32 PhysicalBufferCount; /* Physical breaks of buffer descripor chained */ u32 BufferCount; /* Number of Buffer descriptor chained */ u32 TotalPacketLength; /* Self explained */ - PNDIS_BUFFER pFirstBuffer; /* Pointer to first buffer descriptor */ + char *pFirstBuffer; /* Pointer to first buffer descriptor */ } PACKET_INFO, *PPACKET_INFO; /* */ @@ -906,7 +906,7 @@ typedef struct _MLME_STRUCT { unsigned long LastSendNULLpsmTime; BOOLEAN bRunning; - NDIS_SPIN_LOCK TaskLock; + spinlock_t TaskLock; MLME_QUEUE Queue; u32 ShiftReg; @@ -944,7 +944,7 @@ typedef struct _MLME_STRUCT { **************************************************************************/ struct reordering_mpdu { struct reordering_mpdu *next; - PNDIS_PACKET pPacket; /* coverted to 802.3 frame */ + void *pPacket; /* coverted to 802.3 frame */ int Sequence; /* sequence number of MPDU */ BOOLEAN bAMSDU; }; @@ -956,7 +956,7 @@ struct reordering_list { struct reordering_mpdu_pool { void *mem; - NDIS_SPIN_LOCK lock; + spinlock_t lock; struct reordering_list freelist; }; @@ -1004,7 +1004,7 @@ typedef struct _BA_REC_ENTRY { /* u8 RxBufIdxUsed; */ /* corresponding virtual address for RX reordering packet storage. */ /*RTMP_REORDERDMABUF MAP_RXBuf[MAX_RX_REORDERBUF]; */ - NDIS_SPIN_LOCK RxReRingLock; /* Rx Ring spinlock */ + spinlock_t RxReRingLock; /* Rx Ring spinlock */ /* struct _BA_REC_ENTRY *pNext; */ void *pAdapter; struct reordering_list list; @@ -1327,10 +1327,10 @@ typedef struct _COMMON_CONFIG { u32 BeaconRemain; #endif /* RTMP_MAC_USB // */ - NDIS_SPIN_LOCK MeasureReqTabLock; + spinlock_t MeasureReqTabLock; PMEASURE_REQ_TAB pMeasureReqTab; - NDIS_SPIN_LOCK TpcReqTabLock; + spinlock_t TpcReqTabLock; PTPC_REQ_TAB pTpcReqTab; BOOLEAN PSPXlink; /* 0: Disable. 1: Enable */ @@ -1716,7 +1716,7 @@ struct _RTMP_CHIP_OP_ { /* */ struct _RTMP_ADAPTER { void *OS_Cookie; /* save specific structure relative to OS */ - PNET_DEV net_dev; + struct net_device *net_dev; unsigned long VirtualIfCnt; RTMP_CHIP_OP chipOps; @@ -1756,7 +1756,7 @@ struct _RTMP_ADAPTER { RTMP_TX_RING TxRing[NUM_OF_TX_RING]; /* AC0~4 + HCCA */ #endif /* RTMP_MAC_PCI // */ - NDIS_SPIN_LOCK irq_lock; + spinlock_t irq_lock; u8 irq_disabled; #ifdef RTMP_MAC_USB @@ -1778,11 +1778,11 @@ struct _RTMP_ADAPTER { /*======Cmd Thread */ CmdQ CmdQ; - NDIS_SPIN_LOCK CmdQLock; /* CmdQLock spinlock */ + spinlock_t CmdQLock; /* CmdQLock spinlock */ RTMP_OS_TASK cmdQTask; /*======Semaphores (event) */ - RTMP_OS_SEM UsbVendorReq_semaphore; + struct semaphore UsbVendorReq_semaphore; void *UsbVendorReqBuf; wait_queue_head_t *wait; #endif /* RTMP_MAC_USB // */ @@ -1804,7 +1804,7 @@ struct _RTMP_ADAPTER { #ifdef RTMP_TIMER_TASK_SUPPORT /* If you want use timer task to handle the timer related jobs, enable this. */ RTMP_TIMER_TASK_QUEUE TimerQ; - NDIS_SPIN_LOCK TimerQLock; + spinlock_t TimerQLock; RTMP_OS_TASK timerTask; #endif /* RTMP_TIMER_TASK_SUPPORT // */ @@ -1812,15 +1812,15 @@ struct _RTMP_ADAPTER { /* Tx related parameters */ /*****************************************************************************************/ BOOLEAN DeQueueRunning[NUM_OF_TX_RING]; /* for ensuring RTUSBDeQueuePacket get call once */ - NDIS_SPIN_LOCK DeQueueLock[NUM_OF_TX_RING]; + spinlock_t DeQueueLock[NUM_OF_TX_RING]; #ifdef RTMP_MAC_USB /* Data related context and AC specified, 4 AC supported */ - NDIS_SPIN_LOCK BulkOutLock[6]; /* BulkOut spinlock for 4 ACs */ - NDIS_SPIN_LOCK MLMEBulkOutLock; /* MLME BulkOut lock */ + spinlock_t BulkOutLock[6]; /* BulkOut spinlock for 4 ACs */ + spinlock_t MLMEBulkOutLock; /* MLME BulkOut lock */ HT_TX_CONTEXT TxContext[NUM_OF_TX_RING]; - NDIS_SPIN_LOCK TxContextQueueLock[NUM_OF_TX_RING]; /* TxContextQueue spinlock */ + spinlock_t TxContextQueueLock[NUM_OF_TX_RING]; /* TxContextQueue spinlock */ /* 4 sets of Bulk Out index and pending flag */ u8 NextBulkOutIndex[4]; /* only used for 4 EDCA bulkout pipe */ @@ -1833,11 +1833,11 @@ struct _RTMP_ADAPTER { /* resource for software backlog queues */ QUEUE_HEADER TxSwQueue[NUM_OF_TX_RING]; /* 4 AC + 1 HCCA */ - NDIS_SPIN_LOCK TxSwQueueLock[NUM_OF_TX_RING]; /* TxSwQueue spinlock */ + spinlock_t TxSwQueueLock[NUM_OF_TX_RING]; /* TxSwQueue spinlock */ RTMP_DMABUF MgmtDescRing; /* Shared memory for MGMT descriptors */ RTMP_MGMT_RING MgmtRing; - NDIS_SPIN_LOCK MgmtRingLock; /* Prio Ring spinlock */ + spinlock_t MgmtRingLock; /* Prio Ring spinlock */ /*****************************************************************************************/ /* Rx related parameters */ @@ -1845,14 +1845,14 @@ struct _RTMP_ADAPTER { #ifdef RTMP_MAC_PCI RTMP_RX_RING RxRing; - NDIS_SPIN_LOCK RxRingLock; /* Rx Ring spinlock */ + spinlock_t RxRingLock; /* Rx Ring spinlock */ #ifdef RT3090 - NDIS_SPIN_LOCK McuCmdLock; /*MCU Command Queue spinlock */ + spinlock_t McuCmdLock; /*MCU Command Queue spinlock */ #endif /* RT3090 // */ #endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB RX_CONTEXT RxContext[RX_RING_SIZE]; /* 1 for redundant multiple IRP bulk in. */ - NDIS_SPIN_LOCK BulkInLock; /* BulkIn spinlock for 4 ACs */ + spinlock_t BulkInLock; /* BulkIn spinlock for 4 ACs */ u8 PendingRx; /* The Maximum pending Rx value should be RX_RING_SIZE. */ u8 NextRxBulkInIndex; /* Indicate the current RxContext Index which hold by Host controller. */ u8 NextRxBulkInReadIndex; /* Indicate the current RxContext Index which driver can read & process it. */ @@ -2013,11 +2013,11 @@ struct _RTMP_ADAPTER { /*About MacTab, the sta driver will use #0 and #1 for multicast and AP. */ MAC_TABLE MacTab; /* ASIC on-chip WCID entry table. At TX, ASIC always use key according to this on-chip table. */ - NDIS_SPIN_LOCK MacTabLock; + spinlock_t MacTabLock; BA_TABLE BATable; - NDIS_SPIN_LOCK BATabLock; + spinlock_t BATabLock; RALINK_TIMER_STRUCT RECBATimer; /* encryption/decryption KEY tables */ @@ -2170,7 +2170,7 @@ typedef struct _RX_BLK_ { RT28XX_RXD_STRUC RxD; PRXWI_STRUC pRxWI; PHEADER_802_11 pHeader; - PNDIS_PACKET pRxPacket; + void *pRxPacket; u8 *pData; u16 DataSize; u16 Flags; @@ -2223,7 +2223,7 @@ typedef struct _TX_BLK_ { HTTRANSMIT_SETTING *pTransmit; /* Following structure used for the characteristics of a specific packet. */ - PNDIS_PACKET pPacket; + void *pPacket; u8 *pSrcBufHeader; /* Reference to the head of sk_buff->data */ u8 *pSrcBufData; /* Reference to the sk_buff->data, will changed depends on hanlding progresss */ u32 SrcBufLen; /* Length of packet payload which not including Layer 2 header */ @@ -2316,7 +2316,7 @@ int RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd); void RTMPFreeAdapter(IN PRTMP_ADAPTER pAd); int NICReadRegParameters(IN PRTMP_ADAPTER pAd, - IN NDIS_HANDLE WrapperConfigurationContext); + void *WrapperConfigurationContext); #ifdef RTMP_RF_RW_SUPPORT void NICInitRFRegisters(IN PRTMP_ADAPTER pAd); @@ -2468,21 +2468,21 @@ BOOLEAN TxFrameIsAggregatible(IN PRTMP_ADAPTER pAd, BOOLEAN PeerIsAggreOn(IN PRTMP_ADAPTER pAd, unsigned long TxRate, IN PMAC_TABLE_ENTRY pMacEntry); -int Sniff2BytesFromNdisBuffer(IN PNDIS_BUFFER pFirstBuffer, +int Sniff2BytesFromNdisBuffer(char *pFirstBuffer, u8 DesiredOffset, u8 *pByte0, u8 *pByte1); -int STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); +int STASendPacket(IN PRTMP_ADAPTER pAd, void *pPacket); -void STASendPackets(IN NDIS_HANDLE MiniportAdapterContext, - IN PPNDIS_PACKET ppPacketArray, u32 NumberOfPackets); +void STASendPackets(void *MiniportAdapterContext, + void **ppPacketArray, u32 NumberOfPackets); void RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, u8 QueIdx, u8 Max_Tx_Packets); int RTMPHardTransmit(IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, + void *pPacket, u8 QueIdx, unsigned long *pFreeTXDLeft); int STAHardTransmit(IN PRTMP_ADAPTER pAd, @@ -2497,17 +2497,17 @@ int RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, u8 NumberRequired, u8 *FreeNumberIs); int MlmeHardTransmit(IN PRTMP_ADAPTER pAd, - u8 QueIdx, IN PNDIS_PACKET pPacket); + u8 QueIdx, void *pPacket); int MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, - u8 QueIdx, IN PNDIS_PACKET pPacket); + u8 QueIdx, void *pPacket); #ifdef RTMP_MAC_PCI int MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, - u8 QueIdx, IN PNDIS_PACKET pPacket); + u8 QueIdx, void *pPacket); int MlmeDataHardTransmit(IN PRTMP_ADAPTER pAd, - u8 QueIdx, IN PNDIS_PACKET pPacket); + u8 QueIdx, void *pPacket); void RTMPWriteTxDescriptor(IN PRTMP_ADAPTER pAd, IN PTXD_STRUC pTxD, IN BOOLEAN bWIV, u8 QSEL); @@ -2571,22 +2571,22 @@ void WpaStaGroupKeySetting(IN PRTMP_ADAPTER pAd); int RTMPCloneNdisPacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN pInsAMSDUHdr, - IN PNDIS_PACKET pInPacket, - OUT PNDIS_PACKET * ppOutPacket); + void *pInPacket, + void ** ppOutPacket); int RTMPAllocateNdisPacket(IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET * pPacket, + void ** pPacket, u8 *pHeader, u32 HeaderLen, u8 *pData, u32 DataLen); -void RTMPFreeNdisPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); +void RTMPFreeNdisPacket(IN PRTMP_ADAPTER pAd, void *pPacket); BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, u8 QueIdx); -BOOLEAN RTMPCheckDHCPFrame(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); +BOOLEAN RTMPCheckDHCPFrame(IN PRTMP_ADAPTER pAd, void *pPacket); -BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); +BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, void *pPacket); /* */ /* Private routines in rtmp_wep.c */ @@ -3356,7 +3356,7 @@ BOOLEAN RTMPTkipCompareMICValue(IN PRTMP_ADAPTER pAd, u8 UserPriority, u32 Len); void RTMPCalculateMICValue(IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, + void *pPacket, u8 *pEncap, IN PCIPHER_KEY pKey, u8 apidx); @@ -3527,20 +3527,20 @@ void AES_GTK_KEY_WRAP(u8 * key, /*typedef void (*TIMER_FUNCTION)(unsigned long); */ /* timeout -- ms */ -void RTMP_SetPeriodicTimer(IN NDIS_MINIPORT_TIMER * pTimer, +void RTMP_SetPeriodicTimer(struct timer_list * pTimer, IN unsigned long timeout); void RTMP_OS_Init_Timer(IN PRTMP_ADAPTER pAd, - IN NDIS_MINIPORT_TIMER * pTimer, + struct timer_list * pTimer, IN TIMER_FUNCTION function, void *data); -void RTMP_OS_Add_Timer(IN NDIS_MINIPORT_TIMER * pTimer, +void RTMP_OS_Add_Timer(struct timer_list * pTimer, IN unsigned long timeout); -void RTMP_OS_Mod_Timer(IN NDIS_MINIPORT_TIMER * pTimer, +void RTMP_OS_Mod_Timer(struct timer_list * pTimer, IN unsigned long timeout); -void RTMP_OS_Del_Timer(IN NDIS_MINIPORT_TIMER * pTimer, +void RTMP_OS_Del_Timer(struct timer_list * pTimer, OUT BOOLEAN * pCancelled); void RTMP_OS_Release_Packet(IN PRTMP_ADAPTER pAd, IN PQUEUE_ENTRY pEntry); @@ -3556,7 +3556,7 @@ void RTMP_AllocateSharedMemory(IN PRTMP_ADAPTER pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); + dma_addr_t *PhysicalAddress); void RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd); @@ -3567,82 +3567,82 @@ void RTMP_AllocateTxDescMemory(IN PRTMP_ADAPTER pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); + dma_addr_t *PhysicalAddress); void RTMP_AllocateFirstTxBuffer(IN PRTMP_ADAPTER pAd, u32 Index, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); + dma_addr_t *PhysicalAddress); void RTMP_FreeFirstTxBuffer(IN PRTMP_ADAPTER pAd, unsigned long Length, IN BOOLEAN Cached, void *VirtualAddress, - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); + dma_addr_t PhysicalAddress); void RTMP_AllocateMgmtDescMemory(IN PRTMP_ADAPTER pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); + dma_addr_t *PhysicalAddress); void RTMP_AllocateRxDescMemory(IN PRTMP_ADAPTER pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress); + dma_addr_t *PhysicalAddress); void RTMP_FreeDescMemory(IN PRTMP_ADAPTER pAd, unsigned long Length, void *VirtualAddress, - IN NDIS_PHYSICAL_ADDRESS PhysicalAddress); + dma_addr_t PhysicalAddress); -PNDIS_PACKET RtmpOSNetPktAlloc(IN RTMP_ADAPTER * pAd, IN int size); +void *RtmpOSNetPktAlloc(IN RTMP_ADAPTER * pAd, IN int size); -PNDIS_PACKET RTMP_AllocateRxPacketBuffer(IN PRTMP_ADAPTER pAd, +void *RTMP_AllocateRxPacketBuffer(IN PRTMP_ADAPTER pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, - OUT PNDIS_PHYSICAL_ADDRESS + OUT dma_addr_t * PhysicalAddress); -PNDIS_PACKET RTMP_AllocateTxPacketBuffer(IN PRTMP_ADAPTER pAd, +void *RTMP_AllocateTxPacketBuffer(IN PRTMP_ADAPTER pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress); -PNDIS_PACKET RTMP_AllocateFragPacketBuffer(IN PRTMP_ADAPTER pAd, +void *RTMP_AllocateFragPacketBuffer(IN PRTMP_ADAPTER pAd, unsigned long Length); -void RTMP_QueryPacketInfo(IN PNDIS_PACKET pPacket, +void RTMP_QueryPacketInfo(void *pPacket, OUT PACKET_INFO * pPacketInfo, u8 ** pSrcBufVA, u32 * pSrcBufLen); -void RTMP_QueryNextPacketInfo(IN PNDIS_PACKET * ppPacket, +void RTMP_QueryNextPacketInfo(void ** ppPacket, OUT PACKET_INFO * pPacketInfo, u8 ** pSrcBufVA, u32 * pSrcBufLen); BOOLEAN RTMP_FillTxBlkInfo(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk); PRTMP_SCATTER_GATHER_LIST -rt_get_sg_list_from_packet(PNDIS_PACKET pPacket, RTMP_SCATTER_GATHER_LIST * sg); +rt_get_sg_list_from_packet(void *pPacket, RTMP_SCATTER_GATHER_LIST * sg); -void announce_802_3_packet(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); +void announce_802_3_packet(IN PRTMP_ADAPTER pAd, void *pPacket); -u32 BA_Reorder_AMSDU_Annnounce(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket); +u32 BA_Reorder_AMSDU_Annnounce(IN PRTMP_ADAPTER pAd, void *pPacket); -PNET_DEV get_netdev_from_bssid(IN PRTMP_ADAPTER pAd, u8 FromWhichBSSID); +struct net_device *get_netdev_from_bssid(IN PRTMP_ADAPTER pAd, u8 FromWhichBSSID); -PNDIS_PACKET duplicate_pkt(IN PRTMP_ADAPTER pAd, +void *duplicate_pkt(IN PRTMP_ADAPTER pAd, u8 *pHeader802_3, u32 HdrLen, u8 *pData, unsigned long DataSize, u8 FromWhichBSSID); -PNDIS_PACKET duplicate_pkt_with_TKIP_MIC(IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pOldPkt); +void *duplicate_pkt_with_TKIP_MIC(IN PRTMP_ADAPTER pAd, + void *pOldPkt); void ba_flush_reordering_timeout_mpdus(IN PRTMP_ADAPTER pAd, IN PBA_REC_ENTRY pBAEntry, @@ -3659,7 +3659,7 @@ void BASessionTearDownALL(IN OUT PRTMP_ADAPTER pAd, u8 Wcid); BOOLEAN OS_Need_Clone_Packet(void); void build_tx_packet(IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, + void *pPacket, u8 *pFrame, unsigned long FrameLen); void BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd, @@ -3743,18 +3743,18 @@ void wlan_802_11_to_802_3_packet(IN PRTMP_ADAPTER pAd, } void Sta_Announce_or_Forward_802_3_Packet(IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, + void *pPacket, u8 FromWhichBSSID); #define ANNOUNCE_OR_FORWARD_802_3_PACKET(_pAd, _pPacket, _FromWhichBSS)\ Sta_Announce_or_Forward_802_3_Packet(_pAd, _pPacket, _FromWhichBSS); /*announce_802_3_packet(_pAd, _pPacket); */ -PNDIS_PACKET DuplicatePacket(IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, u8 FromWhichBSSID); +void *DuplicatePacket(IN PRTMP_ADAPTER pAd, + void *pPacket, u8 FromWhichBSSID); -PNDIS_PACKET ClonePacket(IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, +void *ClonePacket(IN PRTMP_ADAPTER pAd, + void *pPacket, u8 *pData, unsigned long DataSize); /* Normal, AMPDU or AMSDU */ @@ -3768,12 +3768,12 @@ void CmmRxRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, void Update_Rssi_Sample(IN PRTMP_ADAPTER pAd, IN RSSI_SAMPLE * pRssi, IN PRXWI_STRUC pRxWI); -PNDIS_PACKET GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, +void *GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, OUT PRT28XX_RXD_STRUC pSaveRxD, OUT BOOLEAN * pbReschedule, IN u32 * pRxPending); -PNDIS_PACKET RTMPDeFragmentDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk); +void *RTMPDeFragmentDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk); enum { DIDmsg_lnxind_wlansniffrm = 0x00000044, @@ -3903,10 +3903,10 @@ void RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd); void tbtt_tasklet(unsigned long data); -PNET_DEV RtmpPhyNetDevInit(IN RTMP_ADAPTER * pAd, +struct net_device *RtmpPhyNetDevInit(IN RTMP_ADAPTER * pAd, IN RTMP_OS_NETDEV_OP_HOOK * pNetHook); -BOOLEAN RtmpPhyNetDevExit(IN RTMP_ADAPTER * pAd, IN PNET_DEV net_dev); +BOOLEAN RtmpPhyNetDevExit(IN RTMP_ADAPTER * pAd, struct net_device *net_dev); int RtmpRaDevCtrlInit(IN RTMP_ADAPTER * pAd, IN RTMP_INF_TYPE infType); @@ -3950,7 +3950,7 @@ void RtmpPCIDataKickOut(IN PRTMP_ADAPTER pAd, int RtmpPCIMgmtKickOut(IN RTMP_ADAPTER * pAd, u8 QueIdx, - IN PNDIS_PACKET pPacket, + void *pPacket, u8 *pSrcBufVA, u32 SrcBufLen); int RTMPCheckRxError(IN PRTMP_ADAPTER pAd, @@ -4137,10 +4137,10 @@ void append_pkt(IN PRTMP_ADAPTER pAd, u8 *pHeader802_3, u32 HdrLen, u8 *pData, - unsigned long DataSize, OUT PNDIS_PACKET * ppPacket); + unsigned long DataSize, void ** ppPacket); u32 deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, - PNDIS_PACKET pPacket, + void *pPacket, u8 *pData, unsigned long DataSize); int RTMPCheckRxError(IN PRTMP_ADAPTER pAd, @@ -4199,7 +4199,7 @@ void RtmpUSBDataKickOut(IN PRTMP_ADAPTER pAd, int RtmpUSBMgmtKickOut(IN RTMP_ADAPTER * pAd, u8 QueIdx, - IN PNDIS_PACKET pPacket, + void *pPacket, u8 *pSrcBufVA, u32 SrcBufLen); void RtmpUSBNullFrameKickOut(IN RTMP_ADAPTER * pAd, @@ -4262,8 +4262,8 @@ void ReSyncBeaconTime(IN PRTMP_ADAPTER pAd); void RTMPSetAGCInitValue(IN PRTMP_ADAPTER pAd, u8 BandWidth); -int rt28xx_close(IN PNET_DEV dev); -int rt28xx_open(IN PNET_DEV dev); +int rt28xx_close(struct net_device *dev); +int rt28xx_open(struct net_device *dev); #define VIRTUAL_IF_INC(__pAd) ((__pAd)->VirtualIfCnt++) #define VIRTUAL_IF_DEC(__pAd) ((__pAd)->VirtualIfCnt--) @@ -4303,24 +4303,24 @@ int RtmpOSWrielessEventSend(IN RTMP_ADAPTER * pAd, u8 *pSrcMac, u8 *pData, u32 dataLen); -int RtmpOSNetDevAddrSet(IN PNET_DEV pNetDev, u8 *pMacAddr); +int RtmpOSNetDevAddrSet(struct net_device *pNetDev, u8 *pMacAddr); -int RtmpOSNetDevAttach(IN PNET_DEV pNetDev, +int RtmpOSNetDevAttach(struct net_device *pNetDev, IN RTMP_OS_NETDEV_OP_HOOK * pDevOpHook); -void RtmpOSNetDevClose(IN PNET_DEV pNetDev); +void RtmpOSNetDevClose(struct net_device *pNetDev); -void RtmpOSNetDevDetach(IN PNET_DEV pNetDev); +void RtmpOSNetDevDetach(struct net_device *pNetDev); -int RtmpOSNetDevAlloc(IN PNET_DEV * pNewNetDev, u32 privDataSize); +int RtmpOSNetDevAlloc(struct net_device ** pNewNetDev, u32 privDataSize); -void RtmpOSNetDevFree(IN PNET_DEV pNetDev); +void RtmpOSNetDevFree(struct net_device *pNetDev); -PNET_DEV RtmpOSNetDevGetByName(IN PNET_DEV pNetDev, char *pDevName); +struct net_device *RtmpOSNetDevGetByName(struct net_device *pNetDev, char *pDevName); -void RtmpOSNetDeviceRefPut(IN PNET_DEV pNetDev); +void RtmpOSNetDeviceRefPut(struct net_device *pNetDev); -PNET_DEV RtmpOSNetDevCreate(IN RTMP_ADAPTER * pAd, +struct net_device *RtmpOSNetDevCreate(IN RTMP_ADAPTER * pAd, int devType, int devNum, int privMemSize, char *pNamePrefix); @@ -4343,14 +4343,14 @@ int RtmpOSTaskAttach(IN RTMP_OS_TASK * pTask, /* File operation related function prototypes */ -RTMP_OS_FD RtmpOSFileOpen(IN char *pPath, IN int flag, IN int mode); +struct file *RtmpOSFileOpen(IN char *pPath, IN int flag, IN int mode); -int RtmpOSFileClose(IN RTMP_OS_FD osfd); +int RtmpOSFileClose(struct file *osfd); -void RtmpOSFileSeek(IN RTMP_OS_FD osfd, IN int offset); +void RtmpOSFileSeek(struct file *osfd, IN int offset); -int RtmpOSFileRead(IN RTMP_OS_FD osfd, IN char *pDataPtr, IN int readLen); +int RtmpOSFileRead(struct file *osfd, IN char *pDataPtr, IN int readLen); -int RtmpOSFileWrite(IN RTMP_OS_FD osfd, IN char *pDataPtr, IN int writeLen); +int RtmpOSFileWrite(struct file *osfd, IN char *pDataPtr, IN int writeLen); #endif /* __RTMP_H__ */ diff --git a/drivers/staging/rt2860/rtmp_os.h b/drivers/staging/rt2860/rtmp_os.h index eb79e6feb661..cff01289de95 100644 --- a/drivers/staging/rt2860/rtmp_os.h +++ b/drivers/staging/rt2860/rtmp_os.h @@ -72,8 +72,8 @@ typedef struct _RTMP_OS_TASK_ { /*unsigned long taskFlags; */ RTMP_TASK_STATUS taskStatus; #ifndef KTHREAD_SUPPORT - RTMP_OS_SEM taskSema; - RTMP_OS_PID taskPID; + struct semaphore taskSema; + struct pid *taskPID; struct completion taskComplete; #endif unsigned char task_killed; @@ -84,7 +84,7 @@ typedef struct _RTMP_OS_TASK_ { #endif } RTMP_OS_TASK; -int RtmpOSIRQRequest(IN PNET_DEV pNetDev); -int RtmpOSIRQRelease(IN PNET_DEV pNetDev); +int RtmpOSIRQRequest(struct net_device *pNetDev); +int RtmpOSIRQRelease(struct net_device *pNetDev); #endif /* __RMTP_OS_H__ // */ diff --git a/drivers/staging/rt2860/rtmp_timer.h b/drivers/staging/rt2860/rtmp_timer.h index 441571dbaff4..c81e507dbadb 100644 --- a/drivers/staging/rt2860/rtmp_timer.h +++ b/drivers/staging/rt2860/rtmp_timer.h @@ -62,7 +62,7 @@ typedef void(*RTMP_TIMER_TASK_HANDLE) (void *SystemSpecific1, #endif /* RTMP_TIMER_TASK_SUPPORT // */ typedef struct _RALINK_TIMER_STRUCT { - RTMP_OS_TIMER TimerObj; /* Ndis Timer object */ + struct timer_list TimerObj; /* Ndis Timer object */ BOOLEAN Valid; /* Set to True when call RTMPInitTimer */ BOOLEAN State; /* True if timer cancelled */ BOOLEAN PeriodicType; /* True if timer is periodic timer */ diff --git a/drivers/staging/rt2860/sta/rtmp_data.c b/drivers/staging/rt2860/sta/rtmp_data.c index b40e511ea5b5..3d2d67817768 100644 --- a/drivers/staging/rt2860/sta/rtmp_data.c +++ b/drivers/staging/rt2860/sta/rtmp_data.c @@ -323,7 +323,7 @@ void STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) PRT28XX_RXD_STRUC pRxD = &(pRxBlk->RxD); PRXWI_STRUC pRxWI = pRxBlk->pRxWI; PHEADER_802_11 pHeader = pRxBlk->pHeader; - PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; + void *pRxPacket = pRxBlk->pRxPacket; BOOLEAN bFragment = FALSE; MAC_TABLE_ENTRY *pEntry = NULL; u8 FromWhichBSSID = BSS0; @@ -615,7 +615,7 @@ void STAHandleRxMgmtFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) PRT28XX_RXD_STRUC pRxD = &(pRxBlk->RxD); PRXWI_STRUC pRxWI = pRxBlk->pRxWI; PHEADER_802_11 pHeader = pRxBlk->pHeader; - PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; + void *pRxPacket = pRxBlk->pRxPacket; do { @@ -660,7 +660,7 @@ void STAHandleRxControlFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) { PRXWI_STRUC pRxWI = pRxBlk->pRxWI; PHEADER_802_11 pHeader = pRxBlk->pHeader; - PNDIS_PACKET pRxPacket = pRxBlk->pRxPacket; + void *pRxPacket = pRxBlk->pRxPacket; switch (pHeader->FC.SubType) { case SUBTYPE_BLOCK_ACK_REQ: @@ -706,7 +706,7 @@ BOOLEAN STARxDoneInterruptHandle(IN PRTMP_ADAPTER pAd, IN BOOLEAN argc) RT28XX_RXD_STRUC *pRxD; u8 *pData; PRXWI_STRUC pRxWI; - PNDIS_PACKET pRxPacket; + void *pRxPacket; PHEADER_802_11 pHeader; RX_BLK RxCell; @@ -844,8 +844,8 @@ Routine Description: Early checking and OS-depened parsing for Tx packet send to our STA driver. Arguments: - NDIS_HANDLE MiniportAdapterContext Pointer refer to the device handle, i.e., the pAd. - PPNDIS_PACKET ppPacketArray The packet array need to do transmission. + void * MiniportAdapterContext Pointer refer to the device handle, i.e., the pAd. + void ** ppPacketArray The packet array need to do transmission. u32 NumberOfPackets Number of packet in packet array. Return Value: @@ -856,12 +856,12 @@ Note: You only can put OS-depened & STA related code in here. ======================================================================== */ -void STASendPackets(IN NDIS_HANDLE MiniportAdapterContext, - IN PPNDIS_PACKET ppPacketArray, u32 NumberOfPackets) +void STASendPackets(void *MiniportAdapterContext, + void **ppPacketArray, u32 NumberOfPackets) { u32 Index; PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) MiniportAdapterContext; - PNDIS_PACKET pPacket; + void *pPacket; BOOLEAN allowToSend = FALSE; for (Index = 0; Index < NumberOfPackets; Index++) { @@ -920,7 +920,7 @@ Note: You only can put OS-indepened & STA related code in here. ======================================================================== */ -int STASendPacket(IN PRTMP_ADAPTER pAd, IN PNDIS_PACKET pPacket) +int STASendPacket(IN PRTMP_ADAPTER pAd, void *pPacket) { PACKET_INFO PacketInfo; u8 *pSrcBufVA; @@ -1561,7 +1561,7 @@ static inline u8 *STA_Build_ARalink_Frame_Header(IN RTMP_ADAPTER * pAd, { u8 *pHeaderBufPtr; HEADER_802_11 *pHeader_802_11; - PNDIS_PACKET pNextPacket; + void *pNextPacket; u32 nextBufLen; PQUEUE_ENTRY pQEntry; @@ -2422,7 +2422,7 @@ void STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) Arguments: pAd Pointer to our adapter - PNDIS_PACKET Pointer to outgoing Ndis frame + void * Pointer to outgoing Ndis frame NumberOfFrag Number of fragment required Return Value: @@ -2437,7 +2437,7 @@ void STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) int STAHardTransmit(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk, u8 QueIdx) { - NDIS_PACKET *pPacket; + char *pPacket; PQUEUE_ENTRY pQEntry; /* --------------------------------------------- */ @@ -2538,7 +2538,7 @@ unsigned long HashBytesPolynomial(u8 * value, unsigned int len) } void Sta_Announce_or_Forward_802_3_Packet(IN PRTMP_ADAPTER pAd, - IN PNDIS_PACKET pPacket, + void *pPacket, u8 FromWhichBSSID) { if (TRUE) { diff --git a/drivers/staging/rt2860/sta_ioctl.c b/drivers/staging/rt2860/sta_ioctl.c index 88a792270e90..d542f4f5f6b5 100644 --- a/drivers/staging/rt2860/sta_ioctl.c +++ b/drivers/staging/rt2860/sta_ioctl.c @@ -2450,7 +2450,7 @@ const struct iw_handler_def rt28xx_iw_handler_def = { int rt28xx_sta_ioctl(IN struct net_device *net_dev, IN OUT struct ifreq *rq, int cmd) { - POS_COOKIE pObj; + struct os_cookie *pObj; RTMP_ADAPTER *pAd = NULL; struct iwreq *wrq = (struct iwreq *)rq; BOOLEAN StateMachineTouched = FALSE; @@ -2458,7 +2458,7 @@ int rt28xx_sta_ioctl(IN struct net_device *net_dev, GET_PAD_FROM_NET_DEV(pAd, net_dev); - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; /*check if the interface is down */ if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c index 4e387d575443..65b0fd717821 100644 --- a/drivers/staging/rt2860/usb_main_dev.c +++ b/drivers/staging/rt2860/usb_main_dev.c @@ -827,7 +827,7 @@ static int __devinit rt2870_probe(IN struct usb_interface *intf, ("rt2870_probe(): Allocate memory for os handle failed!\n"); return -ENOMEM; } - ((POS_COOKIE) handle)->pUsb_Dev = usb_dev; + ((struct os_cookie *)handle)->pUsb_Dev = usb_dev; rv = RTMPAllocAdapterBlock(handle, &pAd); if (rv != NDIS_STATUS_SUCCESS) { diff --git a/drivers/staging/rt2870/common/rtusb_bulk.c b/drivers/staging/rt2870/common/rtusb_bulk.c index b180f1314422..d2e967b13a95 100644 --- a/drivers/staging/rt2870/common/rtusb_bulk.c +++ b/drivers/staging/rt2870/common/rtusb_bulk.c @@ -64,7 +64,7 @@ void RTUSBInitTxDesc(IN PRTMP_ADAPTER pAd, { PURB pUrb; u8 *pSrc = NULL; - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; pUrb = pTxContext->pUrb; ASSERT(pUrb); @@ -103,7 +103,7 @@ void RTUSBInitHTTxDesc(IN PRTMP_ADAPTER pAd, { PURB pUrb; u8 *pSrc = NULL; - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; pUrb = pTxContext->pUrb; ASSERT(pUrb); @@ -131,7 +131,7 @@ void RTUSBInitHTTxDesc(IN PRTMP_ADAPTER pAd, void RTUSBInitRxDesc(IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext) { PURB pUrb; - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; unsigned long RX_bulk_size; pUrb = pRxContext->pUrb; @@ -495,16 +495,16 @@ void RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, } -void RTUSBBulkOutDataPacketComplete(purbb_t pUrb, struct pt_regs * pt_regs) +void RTUSBBulkOutDataPacketComplete(struct urb *pUrb, struct pt_regs * pt_regs) { PHT_TX_CONTEXT pHTTXContext; PRTMP_ADAPTER pAd; - POS_COOKIE pObj; + struct os_cookie *pObj; u8 BulkOutPipeId; pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; pAd = pHTTXContext->pAd; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; /* Store BulkOut PipeId */ BulkOutPipeId = pHTTXContext->BulkOutPipeId; @@ -589,18 +589,18 @@ void RTUSBBulkOutNullFrame(IN PRTMP_ADAPTER pAd) } /* NULL frame use BulkOutPipeId = 0 */ -void RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs * pt_regs) +void RTUSBBulkOutNullFrameComplete(struct urb *pUrb, struct pt_regs * pt_regs) { PRTMP_ADAPTER pAd; PTX_CONTEXT pNullContext; int Status; - POS_COOKIE pObj; + struct os_cookie *pObj; pNullContext = (PTX_CONTEXT) pUrb->context; pAd = pNullContext->pAd; Status = pUrb->status; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; pObj->null_frame_complete_task.data = (unsigned long)pUrb; tasklet_hi_schedule(&pObj->null_frame_complete_task); } @@ -684,18 +684,18 @@ void RTUSBBulkOutMLMEPacket(IN PRTMP_ADAPTER pAd, u8 Index) /* printk("<---RTUSBBulkOutMLMEPacket,Cpu=%d!, Dma=%d, SwIdx=%d!\n", pAd->MgmtRing.TxCpuIdx, pAd->MgmtRing.TxDmaIdx, pAd->MgmtRing.TxSwFreeIdx); */ } -void RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs * pt_regs) +void RTUSBBulkOutMLMEPacketComplete(struct urb *pUrb, struct pt_regs * pt_regs) { PTX_CONTEXT pMLMEContext; PRTMP_ADAPTER pAd; int Status; - POS_COOKIE pObj; + struct os_cookie *pObj; int index; /*DBGPRINT_RAW(RT_DEBUG_INFO, ("--->RTUSBBulkOutMLMEPacketComplete\n")); */ pMLMEContext = (PTX_CONTEXT) pUrb->context; pAd = pMLMEContext->pAd; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; Status = pUrb->status; index = pMLMEContext->SelfIdx; @@ -758,18 +758,18 @@ void RTUSBBulkOutPsPoll(IN PRTMP_ADAPTER pAd) } /* PS-Poll frame use BulkOutPipeId = 0 */ -void RTUSBBulkOutPsPollComplete(purbb_t pUrb, struct pt_regs * pt_regs) +void RTUSBBulkOutPsPollComplete(struct urb *pUrb, struct pt_regs * pt_regs) { PRTMP_ADAPTER pAd; PTX_CONTEXT pPsPollContext; int Status; - POS_COOKIE pObj; + struct os_cookie *pObj; pPsPollContext = (PTX_CONTEXT) pUrb->context; pAd = pPsPollContext->pAd; Status = pUrb->status; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; pObj->pspoll_frame_complete_task.data = (unsigned long)pUrb; tasklet_hi_schedule(&pObj->pspoll_frame_complete_task); } @@ -912,18 +912,18 @@ void RTUSBBulkReceive(IN PRTMP_ADAPTER pAd) Always returns STATUS_MORE_PROCESSING_REQUIRED ======================================================================== */ -void RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs) +void RTUSBBulkRxComplete(struct urb *pUrb, struct pt_regs *pt_regs) { /* use a receive tasklet to handle received packets; */ /* or sometimes hardware IRQ will be disabled here, so we can not */ /* use spin_lock_bh()/spin_unlock_bh() after IRQ is disabled. :< */ PRX_CONTEXT pRxContext; PRTMP_ADAPTER pAd; - POS_COOKIE pObj; + struct os_cookie *pObj; pRxContext = (PRX_CONTEXT) pUrb->context; pAd = pRxContext->pAd; - pObj = (POS_COOKIE) pAd->OS_Cookie; + pObj = (struct os_cookie *)pAd->OS_Cookie; pObj->rx_done_task.data = (unsigned long)pUrb; tasklet_hi_schedule(&pObj->rx_done_task); @@ -1146,7 +1146,7 @@ void RTUSBCancelPendingBulkOutIRP(IN PRTMP_ADAPTER pAd) PTX_CONTEXT pRTSContext; u32 i, Idx; /* unsigned int IrqFlags; */ -/* NDIS_SPIN_LOCK *pLock; */ +/* spinlock_t *pLock; */ /* BOOLEAN *pPending; */ /* pLock = &pAd->BulkOutLock[MGMTPIPEIDX]; */ diff --git a/drivers/staging/rt2870/common/rtusb_data.c b/drivers/staging/rt2870/common/rtusb_data.c index c58201ffde7a..471fd4ead812 100644 --- a/drivers/staging/rt2870/common/rtusb_data.c +++ b/drivers/staging/rt2870/common/rtusb_data.c @@ -47,14 +47,14 @@ extern u8 EpToQueue[]; void REPORT_AMSDU_FRAMES_TO_LLC(IN PRTMP_ADAPTER pAd, u8 *pData, unsigned long DataSize) { - PNDIS_PACKET pPacket; + void *pPacket; u32 nMSDU; struct sk_buff *pSkb; nMSDU = 0; /* allocate a rx packet */ pSkb = dev_alloc_skb(RX_BUFFER_AGGRESIZE); - pPacket = (PNDIS_PACKET) OSPKT_TO_RTPKT(pSkb); + pPacket = (void *)OSPKT_TO_RTPKT(pSkb); if (pSkb) { /* convert 802.11 to 802.3 packet */ @@ -195,7 +195,7 @@ void RTUSBRejectPendingPackets(IN PRTMP_ADAPTER pAd) { u8 Index; PQUEUE_ENTRY pEntry; - PNDIS_PACKET pPacket; + void *pPacket; PQUEUE_HEADER pQueue; for (Index = 0; Index < 4; Index++) { diff --git a/drivers/staging/rt2870/common/rtusb_io.c b/drivers/staging/rt2870/common/rtusb_io.c index 861b6b15b045..d15a92eef04a 100644 --- a/drivers/staging/rt2870/common/rtusb_io.c +++ b/drivers/staging/rt2870/common/rtusb_io.c @@ -843,7 +843,7 @@ int RTUSB_VendorRequest(IN PRTMP_ADAPTER pAd, u32 TransferBufferLength) { int ret = 0; - POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; + struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) { DBGPRINT(RT_DEBUG_ERROR, ("device disconnected\n")); -- GitLab From 62eb734b490c3851deb5cdba99e477f102549b68 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 11 Dec 2009 12:23:16 -0800 Subject: [PATCH 169/235] Staging: rt28x0: remove typedefs (part three) Remove misc typedefs. Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/ap.h | 14 +- drivers/staging/rt2860/chip/mac_pci.h | 8 +- drivers/staging/rt2860/chip/mac_usb.h | 52 +- drivers/staging/rt2860/chip/rt30xx.h | 2 +- drivers/staging/rt2860/chip/rtmp_mac.h | 27 +- drivers/staging/rt2860/chip/rtmp_phy.h | 4 +- drivers/staging/rt2860/chips/rt3070.c | 2 +- drivers/staging/rt2860/chips/rt3090.c | 2 +- drivers/staging/rt2860/chips/rt30xx.c | 16 +- drivers/staging/rt2860/chlist.h | 28 +- drivers/staging/rt2860/common/action.c | 100 +- drivers/staging/rt2860/common/action.h | 12 +- drivers/staging/rt2860/common/ba_action.c | 204 +- drivers/staging/rt2860/common/cmm_aes.c | 18 +- drivers/staging/rt2860/common/cmm_asic.c | 92 +- drivers/staging/rt2860/common/cmm_cfg.c | 14 +- drivers/staging/rt2860/common/cmm_data.c | 168 +- drivers/staging/rt2860/common/cmm_data_pci.c | 134 +- drivers/staging/rt2860/common/cmm_data_usb.c | 132 +- drivers/staging/rt2860/common/cmm_info.c | 34 +- drivers/staging/rt2860/common/cmm_mac_pci.c | 96 +- drivers/staging/rt2860/common/cmm_mac_usb.c | 184 +- drivers/staging/rt2860/common/cmm_sanity.c | 118 +- drivers/staging/rt2860/common/cmm_sync.c | 50 +- drivers/staging/rt2860/common/cmm_tkip.c | 34 +- drivers/staging/rt2860/common/cmm_wep.c | 36 +- drivers/staging/rt2860/common/cmm_wpa.c | 272 +-- drivers/staging/rt2860/common/crypt_hmac.c | 16 +- drivers/staging/rt2860/common/crypt_md5.c | 16 +- drivers/staging/rt2860/common/crypt_sha2.c | 22 +- drivers/staging/rt2860/common/dfs.c | 2 +- drivers/staging/rt2860/common/ee_efuse.c | 18 +- drivers/staging/rt2860/common/ee_prom.c | 16 +- drivers/staging/rt2860/common/eeprom.c | 4 +- drivers/staging/rt2860/common/mlme.c | 316 +-- drivers/staging/rt2860/common/rt_channel.c | 38 +- drivers/staging/rt2860/common/rt_rf.c | 10 +- drivers/staging/rt2860/common/rtmp_init.c | 96 +- drivers/staging/rt2860/common/rtmp_mcu.c | 6 +- drivers/staging/rt2860/common/rtmp_timer.c | 42 +- drivers/staging/rt2860/common/spectrum.c | 338 ++-- drivers/staging/rt2860/crypt_md5.h | 13 +- drivers/staging/rt2860/crypt_sha2.h | 12 +- drivers/staging/rt2860/dfs.h | 2 +- drivers/staging/rt2860/eeprom.h | 8 +- drivers/staging/rt2860/iface/rtmp_usb.h | 8 +- drivers/staging/rt2860/mlme.h | 420 ++-- drivers/staging/rt2860/oid.h | 231 ++- drivers/staging/rt2860/pci_main_dev.c | 36 +- drivers/staging/rt2860/rt_linux.c | 110 +- drivers/staging/rt2860/rt_linux.h | 10 +- drivers/staging/rt2860/rt_main_dev.c | 42 +- drivers/staging/rt2860/rt_pci_rbus.c | 58 +- drivers/staging/rt2860/rt_usb.c | 72 +- drivers/staging/rt2860/rtmp.h | 1854 +++++++++--------- drivers/staging/rt2860/rtmp_chip.h | 2 +- drivers/staging/rt2860/rtmp_ckipmic.h | 4 +- drivers/staging/rt2860/rtmp_def.h | 4 +- drivers/staging/rt2860/rtmp_dot11.h | 30 +- drivers/staging/rt2860/rtmp_iface.h | 18 +- drivers/staging/rt2860/rtmp_mcu.h | 6 +- drivers/staging/rt2860/rtmp_os.h | 8 +- drivers/staging/rt2860/rtmp_timer.h | 32 +- drivers/staging/rt2860/rtmp_type.h | 16 +- drivers/staging/rt2860/rtusb_io.h | 38 +- drivers/staging/rt2860/spectrum.h | 44 +- drivers/staging/rt2860/spectrum_def.h | 78 +- drivers/staging/rt2860/sta/assoc.c | 108 +- drivers/staging/rt2860/sta/auth.c | 46 +- drivers/staging/rt2860/sta/auth_rsp.c | 14 +- drivers/staging/rt2860/sta/connect.c | 220 +-- drivers/staging/rt2860/sta/rtmp_data.c | 200 +- drivers/staging/rt2860/sta/sanity.c | 28 +- drivers/staging/rt2860/sta/sync.c | 160 +- drivers/staging/rt2860/sta/wpa.c | 32 +- drivers/staging/rt2860/sta_ioctl.c | 128 +- drivers/staging/rt2860/usb_main_dev.c | 64 +- drivers/staging/rt2860/wpa.h | 60 +- drivers/staging/rt2870/common/rtusb_bulk.c | 104 +- drivers/staging/rt2870/common/rtusb_data.c | 26 +- drivers/staging/rt2870/common/rtusb_io.c | 112 +- 81 files changed, 3628 insertions(+), 3623 deletions(-) diff --git a/drivers/staging/rt2860/ap.h b/drivers/staging/rt2860/ap.h index fb6ab69af2ba..3f744a52aac7 100644 --- a/drivers/staging/rt2860/ap.h +++ b/drivers/staging/rt2860/ap.h @@ -41,8 +41,8 @@ #define __AP_H__ /* ap_wpa.c */ -void WpaStateMachineInit(IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE * Sm, OUT STATE_MACHINE_FUNC Trans[]); +void WpaStateMachineInit(struct rt_rtmp_adapter *pAd, + struct rt_state_machine *Sm, OUT STATE_MACHINE_FUNC Trans[]); #ifdef RTMP_MAC_USB void BeaconUpdateExec(void *SystemSpecific1, @@ -50,17 +50,17 @@ void BeaconUpdateExec(void *SystemSpecific1, void *SystemSpecific2, void *SystemSpecific3); #endif /* RTMP_MAC_USB // */ -void RTMPSetPiggyBack(IN PRTMP_ADAPTER pAd, IN BOOLEAN bPiggyBack); +void RTMPSetPiggyBack(struct rt_rtmp_adapter *pAd, IN BOOLEAN bPiggyBack); -void MacTableReset(IN PRTMP_ADAPTER pAd); +void MacTableReset(struct rt_rtmp_adapter *pAd); -MAC_TABLE_ENTRY *MacTableInsertEntry(IN PRTMP_ADAPTER pAd, +struct rt_mac_table_entry *MacTableInsertEntry(struct rt_rtmp_adapter *pAd, u8 *pAddr, u8 apidx, IN BOOLEAN CleanAll); -BOOLEAN MacTableDeleteEntry(IN PRTMP_ADAPTER pAd, +BOOLEAN MacTableDeleteEntry(struct rt_rtmp_adapter *pAd, u16 wcid, u8 *pAddr); -MAC_TABLE_ENTRY *MacTableLookup(IN PRTMP_ADAPTER pAd, u8 *pAddr); +struct rt_mac_table_entry *MacTableLookup(struct rt_rtmp_adapter *pAd, u8 *pAddr); #endif /* __AP_H__ */ diff --git a/drivers/staging/rt2860/chip/mac_pci.h b/drivers/staging/rt2860/chip/mac_pci.h index 2d553275caa3..8dbadd033859 100644 --- a/drivers/staging/rt2860/chip/mac_pci.h +++ b/drivers/staging/rt2860/chip/mac_pci.h @@ -69,7 +69,7 @@ // // TX descriptor format, Tx ring, Mgmt Ring // -typedef struct PACKED _TXD_STRUC { +struct PACKED rt_txd { // Word 0 u32 SDPtr0; // Word 1 @@ -89,12 +89,12 @@ typedef struct PACKED _TXD_STRUC { u32 TCO:1; /* */ u32 UCO:1; /* */ u32 ICO:1; /* */ -} TXD_STRUC, *PTXD_STRUC; +}; // // Rx descriptor format, Rx Ring // -typedef struct PACKED _RXD_STRUC { +typedef struct PACKED rt_rxd { // Word 0 u32 SDP0; // Word 1 @@ -125,7 +125,7 @@ typedef struct PACKED _RXD_STRUC { u32 PlcpSignal:1; /* To be moved */ u32 PlcpRssil:1; /* To be moved */ u32 Rsv1:13; -} RXD_STRUC, *PRXD_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC; +} RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC; typedef union _TX_ATTENUATION_CTRL_STRUC { struct { diff --git a/drivers/staging/rt2860/chip/mac_usb.h b/drivers/staging/rt2860/chip/mac_usb.h index f146232bf157..0b67c0b1de03 100644 --- a/drivers/staging/rt2860/chip/mac_usb.h +++ b/drivers/staging/rt2860/chip/mac_usb.h @@ -61,7 +61,7 @@ #define RXINFO_SIZE 4 #define RT2870_RXDMALEN_FIELD_SIZE 4 -typedef struct PACKED _RXINFO_STRUC { +typedef struct PACKED rt_rxinfo { u32 BA:1; u32 DATA:1; u32 NULLDATA:1; @@ -82,14 +82,14 @@ typedef struct PACKED _RXINFO_STRUC { u32 CipherAlg:1; u32 LastAMSDU:1; u32 PlcpSignal:12; -} RXINFO_STRUC, *PRXINFO_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC; +} RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC; /* */ /* TXINFO */ /* */ #define TXINFO_SIZE 4 -typedef struct _TXINFO_STRUC { +struct rt_txinfo { /* Word 0 */ u32 USBDMATxPktLen:16; /*used ONLY in USB bulk Aggregation, Total byte counts of all sub-frame. */ u32 rsv:8; @@ -99,47 +99,47 @@ typedef struct _TXINFO_STRUC { u32 rsv2:2; /* Software use. */ u32 USBDMANextVLD:1; /*used ONLY in USB bulk Aggregation, NextValid */ u32 USBDMATxburst:1; /*used ONLY in USB bulk Aggre. Force USB DMA transmit frame from current selected endpoint */ -} TXINFO_STRUC, *PTXINFO_STRUC; +}; /* */ /* Management ring buffer format */ /* */ -typedef struct _MGMT_STRUC { +struct rt_mgmt { BOOLEAN Valid; u8 *pBuffer; unsigned long Length; -} MGMT_STRUC, *PMGMT_STRUC; +}; /*////////////////////////////////////////////////////////////////////////// */ -/* The TX_BUFFER structure forms the transmitted USB packet to the device */ +/* The struct rt_tx_buffer structure forms the transmitted USB packet to the device */ /*////////////////////////////////////////////////////////////////////////// */ -typedef struct __TX_BUFFER { +struct rt_tx_buffer { union { u8 WirelessPacket[TX_BUFFER_NORMSIZE]; - HEADER_802_11 NullFrame; - PSPOLL_FRAME PsPollPacket; - RTS_FRAME RTSFrame; + struct rt_header_802_11 NullFrame; + struct rt_pspoll_frame PsPollPacket; + struct rt_rts_frame RTSFrame; } field; u8 Aggregation[4]; /*Buffer for save Aggregation size. */ -} TX_BUFFER, *PTX_BUFFER; +}; -typedef struct __HTTX_BUFFER { +struct rt_httx_buffer { union { u8 WirelessPacket[MAX_TXBULK_SIZE]; - HEADER_802_11 NullFrame; - PSPOLL_FRAME PsPollPacket; - RTS_FRAME RTSFrame; + struct rt_header_802_11 NullFrame; + struct rt_pspoll_frame PsPollPacket; + struct rt_rts_frame RTSFrame; } field; u8 Aggregation[4]; /*Buffer for save Aggregation size. */ -} HTTX_BUFFER, *PHTTX_BUFFER; +}; /* used to track driver-generated write irps */ -typedef struct _TX_CONTEXT { +struct rt_tx_context { void *pAd; /*Initialized in MiniportInitialize */ PURB pUrb; /*Initialized in MiniportInitialize */ PIRP pIrp; /*used to cancel pending bulk out. */ /*Initialized in MiniportInitialize */ - PTX_BUFFER TransferBuffer; /*Initialized in MiniportInitialize */ + struct rt_tx_buffer *TransferBuffer; /*Initialized in MiniportInitialize */ unsigned long BulkOutSize; u8 BulkOutPipeId; u8 SelfIdx; @@ -155,15 +155,15 @@ typedef struct _TX_CONTEXT { u32 TxRate; dma_addr_t data_dma; /* urb dma on linux */ -} TX_CONTEXT, *PTX_CONTEXT, **PPTX_CONTEXT; +}; /* used to track driver-generated write irps */ -typedef struct _HT_TX_CONTEXT { +struct rt_ht_tx_context { void *pAd; /*Initialized in MiniportInitialize */ PURB pUrb; /*Initialized in MiniportInitialize */ PIRP pIrp; /*used to cancel pending bulk out. */ /*Initialized in MiniportInitialize */ - PHTTX_BUFFER TransferBuffer; /*Initialized in MiniportInitialize */ + struct rt_httx_buffer *TransferBuffer; /*Initialized in MiniportInitialize */ unsigned long BulkOutSize; /* Indicate the total bulk-out size in bytes in one bulk-transmission */ u8 BulkOutPipeId; BOOLEAN IRPPending; @@ -179,13 +179,13 @@ typedef struct _HT_TX_CONTEXT { unsigned long ENextBulkOutPosition; /* Indicate the buffer end offset of a bulk-transmission */ u32 TxRate; dma_addr_t data_dma; /* urb dma on linux */ -} HT_TX_CONTEXT, *PHT_TX_CONTEXT, **PPHT_TX_CONTEXT; +}; /* */ /* Structure to keep track of receive packets and buffers to indicate */ /* receive data to the protocol. */ /* */ -typedef struct _RX_CONTEXT { +struct rt_rx_context { u8 *TransferBuffer; void *pAd; PIRP pIrp; /*used to cancel pending bulk in. */ @@ -200,7 +200,7 @@ typedef struct _RX_CONTEXT { atomic_t IrpLock; spinlock_t RxContextLock; dma_addr_t data_dma; /* urb dma on linux */ -} RX_CONTEXT, *PRX_CONTEXT; +}; /****************************************************************************** @@ -309,7 +309,7 @@ typedef struct _RX_CONTEXT { RTUSBMlmeUp(pAd); #define RTMP_HANDLE_COUNTER_MEASURE(_pAd, _pEntry) \ - { RTUSBEnqueueInternalCmd(_pAd, CMDTHREAD_802_11_COUNTER_MEASURE, _pEntry, sizeof(MAC_TABLE_ENTRY)); \ + { RTUSBEnqueueInternalCmd(_pAd, CMDTHREAD_802_11_COUNTER_MEASURE, _pEntry, sizeof(struct rt_mac_table_entry)); \ RTUSBMlmeUp(_pAd); \ } diff --git a/drivers/staging/rt2860/chip/rt30xx.h b/drivers/staging/rt2860/chip/rt30xx.h index 04c92ab796df..02e1d728fb41 100644 --- a/drivers/staging/rt2860/chip/rt30xx.h +++ b/drivers/staging/rt2860/chip/rt30xx.h @@ -39,7 +39,7 @@ #ifdef RT30xx -extern REG_PAIR RT30xx_RFRegTable[]; +extern struct rt_reg_pair RT30xx_RFRegTable[]; extern u8 NUM_RF_REG_PARMS; #endif /* RT30xx // */ diff --git a/drivers/staging/rt2860/chip/rtmp_mac.h b/drivers/staging/rt2860/chip/rtmp_mac.h index 5efe5015cad4..f6a72581d3bd 100644 --- a/drivers/staging/rt2860/chip/rtmp_mac.h +++ b/drivers/staging/rt2860/chip/rtmp_mac.h @@ -54,7 +54,7 @@ /*txop : for txop mode */ /* 0:txop for the MPDU frame will be handles by ASIC by register */ /* 1/2/3:the MPDU frame is send after PIFS/backoff/SIFS */ -typedef struct PACKED _TXWI_STRUC { +struct PACKED rt_txwi { /* Word 0 */ /* ex: 00 03 00 40 means txop = 3, PHYMODE = 1 */ u32 FRAG:1; /* 1 to inform TKIP engine this is a fragment. */ @@ -88,12 +88,12 @@ typedef struct PACKED _TXWI_STRUC { u32 IV; /*Word3 */ u32 EIV; -} TXWI_STRUC, *PTXWI_STRUC; +}; /* */ /* RXWI wireless information format, in PBF. invisible in driver. */ /* */ -typedef struct PACKED _RXWI_STRUC { +struct PACKED rt_rxwi { /* Word 0 */ u32 WirelessCliID:8; u32 KeyIndex:2; @@ -121,7 +121,7 @@ typedef struct PACKED _RXWI_STRUC { u32 FOFFSET:8; /* RT35xx */ u32 rsv2:8; /*u32 rsv2:16; */ -} RXWI_STRUC, *PRXWI_STRUC; +}; /* ================================================================================= */ /* Register format */ @@ -999,40 +999,41 @@ typedef union _SHAREDKEY_MODE_STRUC { } field; u32 word; } SHAREDKEY_MODE_STRUC, *PSHAREDKEY_MODE_STRUC; -/* 64-entry for pairwise key table */ -typedef struct _HW_WCID_ENTRY { /* 8-byte per entry */ + +/* 8-byte per entry, 64-entry for pairwise key table */ +struct rt_hw_wcid_entry { u8 Address[6]; u8 Rsv[2]; -} HW_WCID_ENTRY, PHW_WCID_ENTRY; +}; /* ================================================================================= */ /* WCID format */ /* ================================================================================= */ /*7.1 WCID ENTRY format : 8bytes */ -typedef struct _WCID_ENTRY_STRUC { +struct rt_wcid_entry { u8 RXBABitmap7; /* bit0 for TID8, bit7 for TID 15 */ u8 RXBABitmap0; /* bit0 for TID0, bit7 for TID 7 */ u8 MAC[6]; /* 0 for shared key table. 1 for pairwise key table */ -} WCID_ENTRY_STRUC, *PWCID_ENTRY_STRUC; +}; /*8.1.1 SECURITY KEY format : 8DW */ /* 32-byte per entry, total 16-entry for shared key table, 64-entry for pairwise key table */ -typedef struct _HW_KEY_ENTRY { /* 32-byte per entry */ +struct rt_hw_key_entry { u8 Key[16]; u8 TxMic[8]; u8 RxMic[8]; -} HW_KEY_ENTRY, *PHW_KEY_ENTRY; +}; /*8.1.2 IV/EIV format : 2DW */ /*8.1.3 RX attribute entry format : 1DW */ -typedef struct _MAC_ATTRIBUTE_STRUC { +struct rt_mac_attribute { u32 KeyTab:1; /* 0 for shared key table. 1 for pairwise key table */ u32 PairKeyMode:3; u32 BSSIDIdx:3; /*multipleBSS index for the WCID */ u32 RXWIUDF:3; u32 rsv:22; -} MAC_ATTRIBUTE_STRUC, *PMAC_ATTRIBUTE_STRUC; +}; /* ================================================================================= */ /* HOST-MCU communication data structure */ diff --git a/drivers/staging/rt2860/chip/rtmp_phy.h b/drivers/staging/rt2860/chip/rtmp_phy.h index 48d186020059..8b8b0f47f03b 100644 --- a/drivers/staging/rt2860/chip/rtmp_phy.h +++ b/drivers/staging/rt2860/chip/rtmp_phy.h @@ -212,7 +212,7 @@ #ifdef RTMP_MAC_PCI /* basic marco for BBP read operation. - _pAd: the data structure pointer of RTMP_ADAPTER + _pAd: the data structure pointer of struct rt_rtmp_adapter _bbpID : the bbp register ID _pV: data pointer used to save the value of queried bbp register. _bViaMCU: if we need access the bbp via the MCU. @@ -370,7 +370,7 @@ /* basic marco for BBP write operation. - _pAd: the data structure pointer of RTMP_ADAPTER + _pAd: the data structure pointer of struct rt_rtmp_adapter _bbpID : the bbp register ID _pV: data used to save the value of queried bbp register. _bViaMCU: if we need access the bbp via the MCU. diff --git a/drivers/staging/rt2860/chips/rt3070.c b/drivers/staging/rt2860/chips/rt3070.c index beaaafa2b4a1..627bad943a3c 100644 --- a/drivers/staging/rt2860/chips/rt3070.c +++ b/drivers/staging/rt2860/chips/rt3070.c @@ -43,7 +43,7 @@ #error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" #endif /* RTMP_RF_RW_SUPPORT // */ -void NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd) +void NICInitRT3070RFRegisters(struct rt_rtmp_adapter *pAd) { int i; u8 RFValue; diff --git a/drivers/staging/rt2860/chips/rt3090.c b/drivers/staging/rt2860/chips/rt3090.c index b80928c902d9..5927ba4c5a9b 100644 --- a/drivers/staging/rt2860/chips/rt3090.c +++ b/drivers/staging/rt2860/chips/rt3090.c @@ -43,7 +43,7 @@ #error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip" #endif /* RTMP_RF_RW_SUPPORT // */ -void NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd) +void NICInitRT3090RFRegisters(struct rt_rtmp_adapter *pAd) { int i; /* Driver must read EEPROM to get RfIcType before initial RF registers */ diff --git a/drivers/staging/rt2860/chips/rt30xx.c b/drivers/staging/rt2860/chips/rt30xx.c index 39b483cce0db..6e684a3ccf0e 100644 --- a/drivers/staging/rt2860/chips/rt30xx.c +++ b/drivers/staging/rt2860/chips/rt30xx.c @@ -46,7 +46,7 @@ /* */ /* RF register initialization set */ /* */ -REG_PAIR RT30xx_RFRegTable[] = { +struct rt_reg_pair RT30xx_RFRegTable[] = { {RF_R04, 0x40} , {RF_R05, 0x03} @@ -87,7 +87,7 @@ REG_PAIR RT30xx_RFRegTable[] = { , }; -u8 NUM_RF_REG_PARMS = (sizeof(RT30xx_RFRegTable) / sizeof(REG_PAIR)); +u8 NUM_RF_REG_PARMS = (sizeof(RT30xx_RFRegTable) / sizeof(struct rt_reg_pair)); /* Antenna divesity use GPIO3 and EESK pin for control */ /* Antenna and EEPROM access are both using EESK pin, */ @@ -95,7 +95,7 @@ u8 NUM_RF_REG_PARMS = (sizeof(RT30xx_RFRegTable) / sizeof(REG_PAIR)); /* Then restore antenna after EEPROM access */ /* The original name of this function is AsicSetRxAnt(), now change to */ /*void AsicSetRxAnt( */ -void RT30xxSetRxAnt(IN PRTMP_ADAPTER pAd, u8 Ant) +void RT30xxSetRxAnt(struct rt_rtmp_adapter *pAd, u8 Ant) { u32 Value; #ifdef RTMP_MAC_PCI @@ -159,7 +159,7 @@ void RT30xxSetRxAnt(IN PRTMP_ADAPTER pAd, u8 Ant) ======================================================================== */ -void RTMPFilterCalibration(IN PRTMP_ADAPTER pAd) +void RTMPFilterCalibration(struct rt_rtmp_adapter *pAd) { u8 R55x = 0, value, FilterTarget = 0x1E, BBPValue = 0; u32 loop = 0, count = 0, loopcnt = 0, ReTry = 0; @@ -306,7 +306,7 @@ void RTMPFilterCalibration(IN PRTMP_ADAPTER pAd) ========================================================================== */ -void RT30xxLoadRFNormalModeSetup(IN PRTMP_ADAPTER pAd) +void RT30xxLoadRFNormalModeSetup(struct rt_rtmp_adapter *pAd) { u8 RFValue; @@ -372,7 +372,7 @@ void RT30xxLoadRFNormalModeSetup(IN PRTMP_ADAPTER pAd) ========================================================================== */ -void RT30xxLoadRFSleepModeSetup(IN PRTMP_ADAPTER pAd) +void RT30xxLoadRFSleepModeSetup(struct rt_rtmp_adapter *pAd) { u8 RFValue; u32 MACValue; @@ -428,7 +428,7 @@ void RT30xxLoadRFSleepModeSetup(IN PRTMP_ADAPTER pAd) ========================================================================== */ -void RT30xxReverseRFSleepModeSetup(IN PRTMP_ADAPTER pAd) +void RT30xxReverseRFSleepModeSetup(struct rt_rtmp_adapter *pAd) { u8 RFValue; u32 MACValue; @@ -493,7 +493,7 @@ void RT30xxReverseRFSleepModeSetup(IN PRTMP_ADAPTER pAd) /* end johnli */ -void RT30xxHaltAction(IN PRTMP_ADAPTER pAd) +void RT30xxHaltAction(struct rt_rtmp_adapter *pAd) { u32 TxPinCfg = 0x00050F0F; diff --git a/drivers/staging/rt2860/chlist.h b/drivers/staging/rt2860/chlist.h index 4183c8b5a023..ada65e5ac610 100644 --- a/drivers/staging/rt2860/chlist.h +++ b/drivers/staging/rt2860/chlist.h @@ -49,28 +49,28 @@ #define BAND_24G 1 #define BAND_BOTH 2 -typedef struct _CH_DESP { +struct rt_ch_desp { u8 FirstChannel; u8 NumOfCh; char MaxTxPwr; /* dBm */ u8 Geography; /* 0:out door, 1:in door, 2:both */ BOOLEAN DfsReq; /* Dfs require, 0: No, 1: yes. */ -} CH_DESP, *PCH_DESP; +}; -typedef struct _CH_REGION { +struct rt_ch_region { u8 CountReg[3]; u8 DfsType; /* 0: CE, 1: FCC, 2: JAP, 3:JAP_W53, JAP_W56 */ - CH_DESP ChDesp[10]; -} CH_REGION, *PCH_REGION; + struct rt_ch_desp ChDesp[10]; +}; -extern CH_REGION ChRegion[]; +extern struct rt_ch_region ChRegion[]; -typedef struct _CH_FREQ_MAP_ { +struct rt_ch_freq_map { u16 channel; u16 freqKHz; -} CH_FREQ_MAP; +}; -extern CH_FREQ_MAP CH_HZ_ID_MAP[]; +extern struct rt_ch_freq_map CH_HZ_ID_MAP[]; extern int CH_HZ_ID_MAP_NUM; #define MAP_CHANNEL_ID_TO_KHZ(_ch, _khz) \ @@ -103,15 +103,15 @@ extern int CH_HZ_ID_MAP_NUM; (_ch) = 1; \ }while(0) -void BuildChannelListEx(IN PRTMP_ADAPTER pAd); +void BuildChannelListEx(struct rt_rtmp_adapter *pAd); -void BuildBeaconChList(IN PRTMP_ADAPTER pAd, +void BuildBeaconChList(struct rt_rtmp_adapter *pAd, u8 *pBuf, unsigned long *pBufLen); -void N_ChannelCheck(IN PRTMP_ADAPTER pAd); +void N_ChannelCheck(struct rt_rtmp_adapter *pAd); -void N_SetCenCh(IN PRTMP_ADAPTER pAd); +void N_SetCenCh(struct rt_rtmp_adapter *pAd); -u8 GetCuntryMaxTxPwr(IN PRTMP_ADAPTER pAd, u8 channel); +u8 GetCuntryMaxTxPwr(struct rt_rtmp_adapter *pAd, u8 channel); #endif /* __CHLIST_H__ */ diff --git a/drivers/staging/rt2860/common/action.c b/drivers/staging/rt2860/common/action.c index 8928ee742676..56ad236e1144 100644 --- a/drivers/staging/rt2860/common/action.c +++ b/drivers/staging/rt2860/common/action.c @@ -39,7 +39,7 @@ #include "../rt_config.h" #include "action.h" -static void ReservedAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +static void ReservedAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); /* ========================================================================== @@ -58,8 +58,8 @@ static void ReservedAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); MT2_CLS3ERR cls3err_action ========================================================================== */ -void ActionStateMachineInit(IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE * S, +void ActionStateMachineInit(struct rt_rtmp_adapter *pAd, + struct rt_state_machine *S, OUT STATE_MACHINE_FUNC Trans[]) { StateMachineInit(S, (STATE_MACHINE_FUNC *) Trans, MAX_ACT_STATE, @@ -98,19 +98,19 @@ void ActionStateMachineInit(IN PRTMP_ADAPTER pAd, (STATE_MACHINE_FUNC) MlmeInvalidAction); } -void MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeADDBAAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { - MLME_ADDBA_REQ_STRUCT *pInfo; + struct rt_mlme_addba_req *pInfo; u8 Addr[6]; u8 *pOutBuffer = NULL; int NStatus; unsigned long Idx; - FRAME_ADDBA_REQ Frame; + struct rt_frame_addba_req Frame; unsigned long FrameLen; - BA_ORI_ENTRY *pBAEntry = NULL; + struct rt_ba_ori_entry *pBAEntry = NULL; - pInfo = (MLME_ADDBA_REQ_STRUCT *) Elem->Msg; - NdisZeroMemory(&Frame, sizeof(FRAME_ADDBA_REQ)); + pInfo = (struct rt_mlme_addba_req *)Elem->Msg; + NdisZeroMemory(&Frame, sizeof(struct rt_frame_addba_req)); if (MlmeAddBAReqSanity(pAd, Elem->Msg, Elem->MsgLen, Addr)) { NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ @@ -161,7 +161,7 @@ void MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Frame.BaStartSeq.word = cpu2le16(Frame.BaStartSeq.word); MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_ADDBA_REQ), &Frame, END_OF_ARGS); + sizeof(struct rt_frame_addba_req), &Frame, END_OF_ARGS); MiniportMMRequest(pAd, (MGMT_USE_QUEUE_FLAG | @@ -182,26 +182,26 @@ void MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Description: send DELBA and delete BaEntry if any Parametrs: - Elem - MLME message MLME_DELBA_REQ_STRUCT + Elem - MLME message struct rt_mlme_delba_req IRQL = DISPATCH_LEVEL ========================================================================== */ -void MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeDELBAAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { - MLME_DELBA_REQ_STRUCT *pInfo; + struct rt_mlme_delba_req *pInfo; u8 *pOutBuffer = NULL; u8 *pOutBuffer2 = NULL; int NStatus; unsigned long Idx; - FRAME_DELBA_REQ Frame; + struct rt_frame_delba_req Frame; unsigned long FrameLen; - FRAME_BAR FrameBar; + struct rt_frame_bar FrameBar; - pInfo = (MLME_DELBA_REQ_STRUCT *) Elem->Msg; + pInfo = (struct rt_mlme_delba_req *)Elem->Msg; /* must send back DELBA */ - NdisZeroMemory(&Frame, sizeof(FRAME_DELBA_REQ)); + NdisZeroMemory(&Frame, sizeof(struct rt_frame_delba_req)); DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeDELBAAction(), Initiator(%d) \n", pInfo->Initiator)); @@ -236,7 +236,7 @@ void MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) FrameBar.BarControl.MTID = 0; /* make sure sequence not clear in DEL funciton. */ MakeOutgoingFrame(pOutBuffer2, &FrameLen, - sizeof(FRAME_BAR), &FrameBar, END_OF_ARGS); + sizeof(struct rt_frame_bar), &FrameBar, END_OF_ARGS); MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer2, FrameLen); MlmeFreeMemory(pAd, pOutBuffer2); DBGPRINT(RT_DEBUG_TRACE, @@ -269,7 +269,7 @@ void MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Frame.ReasonCode = cpu2le16(Frame.ReasonCode); MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_DELBA_REQ), &Frame, END_OF_ARGS); + sizeof(struct rt_frame_delba_req), &Frame, END_OF_ARGS); MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); DBGPRINT(RT_DEBUG_TRACE, @@ -278,25 +278,25 @@ void MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } -void MlmeQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeQOSAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { } -void MlmeDLSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeDLSAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { } -void MlmeInvalidAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeInvalidAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { /*u8 * pOutBuffer = NULL; */ /*Return the receiving frame except the MSB of category filed set to 1. 7.3.1.11 */ } -void PeerQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerQOSAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { } -void PeerBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerBAAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 Action = Elem->Msg[LENGTH_802_11 + 1]; @@ -313,13 +313,13 @@ void PeerBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } -void PeerPublicAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerPublicAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { if (Elem->Wcid >= MAX_LEN_OF_MAC_TABLE) return; } -static void ReservedAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +static void ReservedAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 Category; @@ -333,18 +333,18 @@ static void ReservedAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) hex_dump("Reserved Action Frame", &Elem->Msg[0], Elem->MsgLen); } -void PeerRMAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerRMAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { return; } -static void respond_ht_information_exchange_action(IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM * Elem) +static void respond_ht_information_exchange_action(struct rt_rtmp_adapter *pAd, + struct rt_mlme_queue_elem *Elem) { u8 *pOutBuffer = NULL; int NStatus; unsigned long FrameLen; - FRAME_HT_INFO HTINFOframe, *pFrame; + struct rt_frame_ht_info HTINFOframe, *pFrame; u8 *pAddr; /* 2. Always send back ADDBA Response */ @@ -356,10 +356,10 @@ static void respond_ht_information_exchange_action(IN PRTMP_ADAPTER pAd, return; } /* get RA */ - pFrame = (FRAME_HT_INFO *) & Elem->Msg[0]; + pFrame = (struct rt_frame_ht_info *) & Elem->Msg[0]; pAddr = pFrame->Hdr.Addr2; - NdisZeroMemory(&HTINFOframe, sizeof(FRAME_HT_INFO)); + NdisZeroMemory(&HTINFOframe, sizeof(struct rt_frame_ht_info)); /* 2-1. Prepare ADDBA Response frame. */ { if (ADHOC_ON(pAd)) @@ -381,13 +381,13 @@ static void respond_ht_information_exchange_action(IN PRTMP_ADAPTER pAd, pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth; MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_HT_INFO), &HTINFOframe, END_OF_ARGS); + sizeof(struct rt_frame_ht_info), &HTINFOframe, END_OF_ARGS); MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); } -void PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerHTAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 Action = Elem->Msg[LENGTH_802_11 + 1]; @@ -436,10 +436,10 @@ void PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) break; case HT_INFO_EXCHANGE: { - HT_INFORMATION_OCTET *pHT_info; + struct rt_ht_information_octet *pHT_info; pHT_info = - (HT_INFORMATION_OCTET *) & Elem->Msg[LENGTH_802_11 + + (struct rt_ht_information_octet *) & Elem->Msg[LENGTH_802_11 + 2]; /* 7.4.8.10 */ DBGPRINT(RT_DEBUG_TRACE, @@ -467,9 +467,9 @@ void PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) FALSE , then continue indicaterx at this moment. ========================================================================== */ -void ORIBATimerTimeout(IN PRTMP_ADAPTER pAd) +void ORIBATimerTimeout(struct rt_rtmp_adapter *pAd) { - MAC_TABLE_ENTRY *pEntry; + struct rt_mac_table_entry *pEntry; int i, total; u8 TID; @@ -489,16 +489,16 @@ void ORIBATimerTimeout(IN PRTMP_ADAPTER pAd) } } -void SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) +void SendRefreshBAR(struct rt_rtmp_adapter *pAd, struct rt_mac_table_entry *pEntry) { - FRAME_BAR FrameBar; + struct rt_frame_bar FrameBar; unsigned long FrameLen; int NStatus; u8 *pOutBuffer = NULL; u16 Sequence; u8 i, TID; u16 idx; - BA_ORI_ENTRY *pBAEntry; + struct rt_ba_ori_entry *pBAEntry; for (i = 0; i < NUM_OF_TID; i++) { idx = pEntry->BAOriWcidArray[i]; @@ -529,7 +529,7 @@ void SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) FrameBar.BarControl.TID = TID; /* make sure sequence not clear in DEL funciton. */ MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_BAR), &FrameBar, + sizeof(struct rt_frame_bar), &FrameBar, END_OF_ARGS); /*if (!(CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_RALINK_CHIPSET))) */ if (1) /* Now we always send BAR. */ @@ -547,11 +547,11 @@ void SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) } } -void ActHeaderInit(IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, +void ActHeaderInit(struct rt_rtmp_adapter *pAd, + struct rt_header_802_11 * pHdr80211, u8 *Addr1, u8 *Addr2, u8 *Addr3) { - NdisZeroMemory(pHdr80211, sizeof(HEADER_802_11)); + NdisZeroMemory(pHdr80211, sizeof(struct rt_header_802_11)); pHdr80211->FC.Type = BTYPE_MGMT; pHdr80211->FC.SubType = SUBTYPE_ACTION; @@ -560,10 +560,10 @@ void ActHeaderInit(IN PRTMP_ADAPTER pAd, COPY_MAC_ADDR(pHdr80211->Addr3, Addr3); } -void BarHeaderInit(IN PRTMP_ADAPTER pAd, - IN OUT PFRAME_BAR pCntlBar, u8 *pDA, u8 *pSA) +void BarHeaderInit(struct rt_rtmp_adapter *pAd, + struct rt_frame_bar * pCntlBar, u8 *pDA, u8 *pSA) { - NdisZeroMemory(pCntlBar, sizeof(FRAME_BAR)); + NdisZeroMemory(pCntlBar, sizeof(struct rt_frame_bar)); pCntlBar->FC.Type = BTYPE_CNTL; pCntlBar->FC.SubType = SUBTYPE_BLOCK_ACK_REQ; pCntlBar->BarControl.MTID = 0; @@ -571,7 +571,7 @@ void BarHeaderInit(IN PRTMP_ADAPTER pAd, pCntlBar->BarControl.ACKPolicy = 0; pCntlBar->Duration = - 16 + RTMPCalcDuration(pAd, RATE_1, sizeof(FRAME_BA)); + 16 + RTMPCalcDuration(pAd, RATE_1, sizeof(struct rt_frame_ba)); COPY_MAC_ADDR(pCntlBar->Addr1, pDA); COPY_MAC_ADDR(pCntlBar->Addr2, pSA); @@ -591,7 +591,7 @@ void BarHeaderInit(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -void InsertActField(IN PRTMP_ADAPTER pAd, +void InsertActField(struct rt_rtmp_adapter *pAd, u8 *pFrameBuf, unsigned long *pFrameLen, u8 Category, u8 ActCode) { diff --git a/drivers/staging/rt2860/common/action.h b/drivers/staging/rt2860/common/action.h index f1d1ac73b1cb..974f8b84039f 100644 --- a/drivers/staging/rt2860/common/action.h +++ b/drivers/staging/rt2860/common/action.h @@ -39,18 +39,18 @@ #ifndef __ACTION_H__ #define __ACTION_H__ -typedef struct PACKED __HT_INFO_OCTET { +struct PACKED rt_ht_information_octet { u8 Request:1; u8 Forty_MHz_Intolerant:1; u8 STA_Channel_Width:1; u8 Reserved:5; -} HT_INFORMATION_OCTET; +}; -typedef struct PACKED __FRAME_HT_INFO { - HEADER_802_11 Hdr; +struct PACKED rt_frame_ht_info { + struct rt_header_802_11 Hdr; u8 Category; u8 Action; - HT_INFORMATION_OCTET HT_Info; -} FRAME_HT_INFO, *PFRAME_HT_INFO; + struct rt_ht_information_octet HT_Info; +}; #endif /* __ACTION_H__ */ diff --git a/drivers/staging/rt2860/common/ba_action.c b/drivers/staging/rt2860/common/ba_action.c index f90d709bcf40..69eea402d32d 100644 --- a/drivers/staging/rt2860/common/ba_action.c +++ b/drivers/staging/rt2860/common/ba_action.c @@ -38,12 +38,12 @@ #define RESET_RCV_SEQ (0xFFFF) -static void ba_mpdu_blk_free(PRTMP_ADAPTER pAd, +static void ba_mpdu_blk_free(struct rt_rtmp_adapter *pAd, struct reordering_mpdu *mpdu_blk); -BA_ORI_ENTRY *BATableAllocOriEntry(IN PRTMP_ADAPTER pAd, u16 * Idx); +struct rt_ba_ori_entry *BATableAllocOriEntry(struct rt_rtmp_adapter *pAd, u16 * Idx); -BA_REC_ENTRY *BATableAllocRecEntry(IN PRTMP_ADAPTER pAd, u16 * Idx); +struct rt_ba_rec_entry *BATableAllocRecEntry(struct rt_rtmp_adapter *pAd, u16 * Idx); void BAOriSessionSetupTimeout(void *SystemSpecific1, void *FunctionContext, @@ -61,8 +61,8 @@ BUILD_TIMER_FUNCTION(BARecSessionIdleTimeout); #define ANNOUNCE_REORDERING_PACKET(_pAd, _mpdu_blk) \ Announce_Reordering_Packet(_pAd, _mpdu_blk); -void BA_MaxWinSizeReasign(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntryPeer, u8 * pWinSize) +void BA_MaxWinSizeReasign(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntryPeer, u8 * pWinSize) { u8 MaxSize; @@ -97,7 +97,7 @@ void BA_MaxWinSizeReasign(IN PRTMP_ADAPTER pAd, } } -void Announce_Reordering_Packet(IN PRTMP_ADAPTER pAd, +void Announce_Reordering_Packet(struct rt_rtmp_adapter *pAd, IN struct reordering_mpdu *mpdu) { void *pPacket; @@ -194,10 +194,10 @@ static inline struct reordering_mpdu *ba_reordering_mpdu_probe(struct /* * free all resource for reordering mechanism */ -void ba_reordering_resource_release(PRTMP_ADAPTER pAd) +void ba_reordering_resource_release(struct rt_rtmp_adapter *pAd) { - BA_TABLE *Tab; - PBA_REC_ENTRY pBAEntry; + struct rt_ba_table *Tab; + struct rt_ba_rec_entry *pBAEntry; struct reordering_mpdu *mpdu_blk; int i; @@ -229,7 +229,7 @@ void ba_reordering_resource_release(PRTMP_ADAPTER pAd) /* * Allocate all resource for reordering mechanism */ -BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num) +BOOLEAN ba_reordering_resource_init(struct rt_rtmp_adapter *pAd, int num) { int i; u8 *mem; @@ -277,7 +277,7 @@ BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num) /*static int blk_count=0; // sample take off, no use */ -static struct reordering_mpdu *ba_mpdu_blk_alloc(PRTMP_ADAPTER pAd) +static struct reordering_mpdu *ba_mpdu_blk_alloc(struct rt_rtmp_adapter *pAd) { struct reordering_mpdu *mpdu_blk; @@ -292,7 +292,7 @@ static struct reordering_mpdu *ba_mpdu_blk_alloc(PRTMP_ADAPTER pAd) return mpdu_blk; } -static void ba_mpdu_blk_free(PRTMP_ADAPTER pAd, +static void ba_mpdu_blk_free(struct rt_rtmp_adapter *pAd, struct reordering_mpdu *mpdu_blk) { ASSERT(mpdu_blk); @@ -303,8 +303,8 @@ static void ba_mpdu_blk_free(PRTMP_ADAPTER pAd, NdisReleaseSpinLock(&pAd->mpdu_blk_pool.lock); } -static u16 ba_indicate_reordering_mpdus_in_order(IN PRTMP_ADAPTER pAd, - IN PBA_REC_ENTRY pBAEntry, +static u16 ba_indicate_reordering_mpdus_in_order(struct rt_rtmp_adapter *pAd, + struct rt_ba_rec_entry *pBAEntry, u16 StartSeq) { struct reordering_mpdu *mpdu_blk; @@ -334,8 +334,8 @@ static u16 ba_indicate_reordering_mpdus_in_order(IN PRTMP_ADAPTER pAd, return LastIndSeq; } -static void ba_indicate_reordering_mpdus_le_seq(IN PRTMP_ADAPTER pAd, - IN PBA_REC_ENTRY pBAEntry, +static void ba_indicate_reordering_mpdus_le_seq(struct rt_rtmp_adapter *pAd, + struct rt_ba_rec_entry *pBAEntry, u16 Sequence) { struct reordering_mpdu *mpdu_blk; @@ -358,8 +358,8 @@ static void ba_indicate_reordering_mpdus_le_seq(IN PRTMP_ADAPTER pAd, NdisReleaseSpinLock(&pBAEntry->RxReRingLock); } -static void ba_refresh_reordering_mpdus(IN PRTMP_ADAPTER pAd, - PBA_REC_ENTRY pBAEntry) +static void ba_refresh_reordering_mpdus(struct rt_rtmp_adapter *pAd, + struct rt_ba_rec_entry *pBAEntry) { struct reordering_mpdu *mpdu_blk; @@ -381,8 +381,8 @@ static void ba_refresh_reordering_mpdus(IN PRTMP_ADAPTER pAd, } /*static */ -void ba_flush_reordering_timeout_mpdus(IN PRTMP_ADAPTER pAd, - IN PBA_REC_ENTRY pBAEntry, +void ba_flush_reordering_timeout_mpdus(struct rt_rtmp_adapter *pAd, + struct rt_ba_rec_entry *pBAEntry, unsigned long Now32) { u16 Sequence; @@ -440,14 +440,14 @@ void ba_flush_reordering_timeout_mpdus(IN PRTMP_ADAPTER pAd, * generate ADDBA request to * set up BA agreement */ -void BAOriSessionSetUp(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, +void BAOriSessionSetUp(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, u8 TID, u16 TimeOut, unsigned long DelayTime, IN BOOLEAN isForced) { - /*MLME_ADDBA_REQ_STRUCT AddbaReq; */ - BA_ORI_ENTRY *pBAEntry = NULL; + /*struct rt_mlme_addba_req AddbaReq; */ + struct rt_ba_ori_entry *pBAEntry = NULL; u16 Idx; BOOLEAN Cancelled; @@ -506,17 +506,17 @@ void BAOriSessionSetUp(IN PRTMP_ADAPTER pAd, RTMPSetTimer(&pBAEntry->ORIBATimer, DelayTime); } -void BAOriSessionAdd(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, IN PFRAME_ADDBA_RSP pFrame) +void BAOriSessionAdd(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, struct rt_frame_addba_rsp * pFrame) { - BA_ORI_ENTRY *pBAEntry = NULL; + struct rt_ba_ori_entry *pBAEntry = NULL; BOOLEAN Cancelled; u8 TID; u16 Idx; u8 *pOutBuffer2 = NULL; int NStatus; unsigned long FrameLen; - FRAME_BAR FrameBar; + struct rt_frame_bar FrameBar; TID = pFrame->BaParm.TID; Idx = pEntry->BAOriWcidArray[TID]; @@ -562,7 +562,7 @@ void BAOriSessionAdd(IN PRTMP_ADAPTER pAd, FrameBar.StartingSeq.field.StartSeq = pBAEntry->Sequence; /* make sure sequence not clear in DEL funciton. */ FrameBar.BarControl.TID = pBAEntry->TID; /* make sure sequence not clear in DEL funciton. */ MakeOutgoingFrame(pOutBuffer2, &FrameLen, - sizeof(FRAME_BAR), &FrameBar, END_OF_ARGS); + sizeof(struct rt_frame_bar), &FrameBar, END_OF_ARGS); MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer2, FrameLen); MlmeFreeMemory(pAd, pOutBuffer2); @@ -571,10 +571,10 @@ void BAOriSessionAdd(IN PRTMP_ADAPTER pAd, } } -BOOLEAN BARecSessionAdd(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, IN PFRAME_ADDBA_REQ pFrame) +BOOLEAN BARecSessionAdd(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, struct rt_frame_addba_req * pFrame) { - BA_REC_ENTRY *pBAEntry = NULL; + struct rt_ba_rec_entry *pBAEntry = NULL; BOOLEAN Status = TRUE; BOOLEAN Cancelled; u16 Idx; @@ -660,10 +660,10 @@ BOOLEAN BARecSessionAdd(IN PRTMP_ADAPTER pAd, return (Status); } -BA_REC_ENTRY *BATableAllocRecEntry(IN PRTMP_ADAPTER pAd, u16 * Idx) +struct rt_ba_rec_entry *BATableAllocRecEntry(struct rt_rtmp_adapter *pAd, u16 * Idx) { int i; - BA_REC_ENTRY *pBAEntry = NULL; + struct rt_ba_rec_entry *pBAEntry = NULL; NdisAcquireSpinLock(&pAd->BATabLock); @@ -690,10 +690,10 @@ done: return pBAEntry; } -BA_ORI_ENTRY *BATableAllocOriEntry(IN PRTMP_ADAPTER pAd, u16 * Idx) +struct rt_ba_ori_entry *BATableAllocOriEntry(struct rt_rtmp_adapter *pAd, u16 * Idx) { int i; - BA_ORI_ENTRY *pBAEntry = NULL; + struct rt_ba_ori_entry *pBAEntry = NULL; NdisAcquireSpinLock(&pAd->BATabLock); @@ -718,10 +718,10 @@ done: return pBAEntry; } -void BATableFreeOriEntry(IN PRTMP_ADAPTER pAd, unsigned long Idx) +void BATableFreeOriEntry(struct rt_rtmp_adapter *pAd, unsigned long Idx) { - BA_ORI_ENTRY *pBAEntry = NULL; - MAC_TABLE_ENTRY *pEntry; + struct rt_ba_ori_entry *pBAEntry = NULL; + struct rt_mac_table_entry *pEntry; if ((Idx == 0) || (Idx >= MAX_LEN_OF_BA_ORI_TABLE)) return; @@ -752,10 +752,10 @@ void BATableFreeOriEntry(IN PRTMP_ADAPTER pAd, unsigned long Idx) } } -void BATableFreeRecEntry(IN PRTMP_ADAPTER pAd, unsigned long Idx) +void BATableFreeRecEntry(struct rt_rtmp_adapter *pAd, unsigned long Idx) { - BA_REC_ENTRY *pBAEntry = NULL; - MAC_TABLE_ENTRY *pEntry; + struct rt_ba_rec_entry *pBAEntry = NULL; + struct rt_mac_table_entry *pEntry; if ((Idx == 0) || (Idx >= MAX_LEN_OF_BA_REC_TABLE)) return; @@ -777,13 +777,13 @@ void BATableFreeRecEntry(IN PRTMP_ADAPTER pAd, unsigned long Idx) } } -void BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd, +void BAOriSessionTearDown(struct rt_rtmp_adapter *pAd, u8 Wcid, u8 TID, IN BOOLEAN bPassive, IN BOOLEAN bForceSend) { unsigned long Idx = 0; - BA_ORI_ENTRY *pBAEntry; + struct rt_ba_ori_entry *pBAEntry; BOOLEAN Cancelled; if (Wcid >= MAX_LEN_OF_MAC_TABLE) { @@ -796,13 +796,13 @@ void BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd, if ((Idx == 0) || (Idx >= MAX_LEN_OF_BA_ORI_TABLE)) { if (bForceSend == TRUE) { /* force send specified TID DelBA */ - MLME_DELBA_REQ_STRUCT DelbaReq; - MLME_QUEUE_ELEM *Elem = - (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), + struct rt_mlme_delba_req DelbaReq; + struct rt_mlme_queue_elem *Elem = + (struct rt_mlme_queue_elem *)kmalloc(sizeof(struct rt_mlme_queue_elem), MEM_ALLOC_FLAG); if (Elem != NULL) { NdisZeroMemory(&DelbaReq, sizeof(DelbaReq)); - NdisZeroMemory(Elem, sizeof(MLME_QUEUE_ELEM)); + NdisZeroMemory(Elem, sizeof(struct rt_mlme_queue_elem)); COPY_MAC_ADDR(DelbaReq.Addr, pAd->MacTab.Content[Wcid].Addr); @@ -836,13 +836,13 @@ void BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd, /* */ if ((bPassive == FALSE) && (TID == pBAEntry->TID) && (pBAEntry->ORI_BA_Status == Originator_Done)) { - MLME_DELBA_REQ_STRUCT DelbaReq; - MLME_QUEUE_ELEM *Elem = - (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), + struct rt_mlme_delba_req DelbaReq; + struct rt_mlme_queue_elem *Elem = + (struct rt_mlme_queue_elem *)kmalloc(sizeof(struct rt_mlme_queue_elem), MEM_ALLOC_FLAG); if (Elem != NULL) { NdisZeroMemory(&DelbaReq, sizeof(DelbaReq)); - NdisZeroMemory(Elem, sizeof(MLME_QUEUE_ELEM)); + NdisZeroMemory(Elem, sizeof(struct rt_mlme_queue_elem)); COPY_MAC_ADDR(DelbaReq.Addr, pAd->MacTab.Content[Wcid].Addr); @@ -867,11 +867,11 @@ void BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd, } } -void BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd, +void BARecSessionTearDown(struct rt_rtmp_adapter *pAd, u8 Wcid, u8 TID, IN BOOLEAN bPassive) { unsigned long Idx = 0; - BA_REC_ENTRY *pBAEntry; + struct rt_ba_rec_entry *pBAEntry; if (Wcid >= MAX_LEN_OF_MAC_TABLE) { return; @@ -895,7 +895,7 @@ void BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd, /* */ if ((TID == pBAEntry->TID) && (pBAEntry->REC_BA_Status == Recipient_Accept)) { - MLME_DELBA_REQ_STRUCT DelbaReq; + struct rt_mlme_delba_req DelbaReq; BOOLEAN Cancelled; /*unsigned long offset; */ /*u32 VALUE; */ @@ -906,12 +906,12 @@ void BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd, /* 1. Send DELBA Action Frame */ /* */ if (bPassive == FALSE) { - MLME_QUEUE_ELEM *Elem = - (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), + struct rt_mlme_queue_elem *Elem = + (struct rt_mlme_queue_elem *)kmalloc(sizeof(struct rt_mlme_queue_elem), MEM_ALLOC_FLAG); if (Elem != NULL) { NdisZeroMemory(&DelbaReq, sizeof(DelbaReq)); - NdisZeroMemory(Elem, sizeof(MLME_QUEUE_ELEM)); + NdisZeroMemory(Elem, sizeof(struct rt_mlme_queue_elem)); COPY_MAC_ADDR(DelbaReq.Addr, pAd->MacTab.Content[Wcid].Addr); @@ -956,7 +956,7 @@ void BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd, BATableFreeRecEntry(pAd, Idx); } -void BASessionTearDownALL(IN OUT PRTMP_ADAPTER pAd, u8 Wcid) +void BASessionTearDownALL(struct rt_rtmp_adapter *pAd, u8 Wcid) { int i; @@ -985,9 +985,9 @@ void BAOriSessionSetupTimeout(void *SystemSpecific1, void *SystemSpecific2, void *SystemSpecific3) { - BA_ORI_ENTRY *pBAEntry = (BA_ORI_ENTRY *) FunctionContext; - MAC_TABLE_ENTRY *pEntry; - PRTMP_ADAPTER pAd; + struct rt_ba_ori_entry *pBAEntry = (struct rt_ba_ori_entry *)FunctionContext; + struct rt_mac_table_entry *pEntry; + struct rt_rtmp_adapter *pAd; if (pBAEntry == NULL) return; @@ -1004,7 +1004,7 @@ void BAOriSessionSetupTimeout(void *SystemSpecific1, if ((pBAEntry->ORI_BA_Status == Originator_WaitRes) && (pBAEntry->Token < ORI_SESSION_MAX_RETRY)) { - MLME_ADDBA_REQ_STRUCT AddbaReq; + struct rt_mlme_addba_req AddbaReq; NdisZeroMemory(&AddbaReq, sizeof(AddbaReq)); COPY_MAC_ADDR(AddbaReq.pAddr, pEntry->Addr); @@ -1015,7 +1015,7 @@ void BAOriSessionSetupTimeout(void *SystemSpecific1, AddbaReq.TimeOutValue = 0; AddbaReq.Token = pBAEntry->Token; MlmeEnqueue(pAd, ACTION_STATE_MACHINE, MT2_MLME_ADD_BA_CATE, - sizeof(MLME_ADDBA_REQ_STRUCT), (void *)& AddbaReq); + sizeof(struct rt_mlme_addba_req), (void *)& AddbaReq); RTMP_MLME_HANDLER(pAd); DBGPRINT(RT_DEBUG_TRACE, ("BA Ori Session Timeout(%d) : Send ADD BA again\n", @@ -1047,8 +1047,8 @@ void BARecSessionIdleTimeout(void *SystemSpecific1, void *SystemSpecific2, void *SystemSpecific3) { - BA_REC_ENTRY *pBAEntry = (BA_REC_ENTRY *) FunctionContext; - PRTMP_ADAPTER pAd; + struct rt_ba_rec_entry *pBAEntry = (struct rt_ba_rec_entry *)FunctionContext; + struct rt_rtmp_adapter *pAd; unsigned long Now32; if (pBAEntry == NULL) @@ -1070,20 +1070,20 @@ void BARecSessionIdleTimeout(void *SystemSpecific1, } } -void PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerAddBAReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { /* 7.4.4.1 */ /*unsigned long Idx; */ u8 Status = 1; u8 pAddr[6]; - FRAME_ADDBA_RSP ADDframe; + struct rt_frame_addba_rsp ADDframe; u8 *pOutBuffer = NULL; int NStatus; - PFRAME_ADDBA_REQ pAddreqFrame = NULL; + struct rt_frame_addba_req * pAddreqFrame = NULL; /*u8 BufSize; */ unsigned long FrameLen; unsigned long *ptemp; - PMAC_TABLE_ENTRY pMacEntry; + struct rt_mac_table_entry *pMacEntry; DBGPRINT(RT_DEBUG_TRACE, ("%s ==> (Wcid = %d)\n", __func__, Elem->Wcid)); @@ -1103,7 +1103,7 @@ void PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if ((pAd->CommonCfg.bBADecline == FALSE) && IS_HT_STA(pMacEntry)) { - pAddreqFrame = (PFRAME_ADDBA_REQ) (&Elem->Msg[0]); + pAddreqFrame = (struct rt_frame_addba_req *) (&Elem->Msg[0]); DBGPRINT(RT_DEBUG_OFF, ("Rcv Wcid(%d) AddBAReq\n", Elem->Wcid)); if (BARecSessionAdd @@ -1120,7 +1120,7 @@ void PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if (pAd->MacTab.Content[Elem->Wcid].ValidAsCLI) ASSERT(pAd->MacTab.Content[Elem->Wcid].Sst == SST_ASSOC); - pAddreqFrame = (PFRAME_ADDBA_REQ) (&Elem->Msg[0]); + pAddreqFrame = (struct rt_frame_addba_req *) (&Elem->Msg[0]); /* 2. Always send back ADDBA Response */ NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { @@ -1129,7 +1129,7 @@ void PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) return; } - NdisZeroMemory(&ADDframe, sizeof(FRAME_ADDBA_RSP)); + NdisZeroMemory(&ADDframe, sizeof(struct rt_frame_addba_rsp)); /* 2-1. Prepare ADDBA Response frame. */ { @@ -1164,7 +1164,7 @@ void PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ADDframe.TimeOutValue = cpu2le16(ADDframe.TimeOutValue); MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_ADDBA_RSP), &ADDframe, END_OF_ARGS); + sizeof(struct rt_frame_addba_rsp), &ADDframe, END_OF_ARGS); MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); @@ -1173,12 +1173,12 @@ void PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ADDframe.BaParm.TID, ADDframe.BaParm.BufSize)); } -void PeerAddBARspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerAddBARspAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { /*u8 Idx, i; */ /*u8 * pOutBuffer = NULL; */ - PFRAME_ADDBA_RSP pFrame = NULL; - /*PBA_ORI_ENTRY pBAEntry; */ + struct rt_frame_addba_rsp * pFrame = NULL; + /*struct rt_ba_ori_entry *pBAEntry; */ /*ADDBA Response from unknown peer, ignore this. */ if (Elem->Wcid >= MAX_LEN_OF_MAC_TABLE) @@ -1189,7 +1189,7 @@ void PeerAddBARspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /*hex_dump("PeerAddBARspAction()", Elem->Msg, Elem->MsgLen); */ if (PeerAddBARspActionSanity(pAd, Elem->Msg, Elem->MsgLen)) { - pFrame = (PFRAME_ADDBA_RSP) (&Elem->Msg[0]); + pFrame = (struct rt_frame_addba_rsp *) (&Elem->Msg[0]); DBGPRINT(RT_DEBUG_TRACE, ("\t\t StatusCode = %d\n", pFrame->StatusCode)); @@ -1216,16 +1216,16 @@ void PeerAddBARspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } -void PeerDelBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerDelBAAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { /*u8 Idx; */ /*u8 * pOutBuffer = NULL; */ - PFRAME_DELBA_REQ pDelFrame = NULL; + struct rt_frame_delba_req * pDelFrame = NULL; DBGPRINT(RT_DEBUG_TRACE, ("%s ==>\n", __func__)); /*DELBA Request from unknown peer, ignore this. */ if (PeerDelBAActionSanity(pAd, Elem->Wcid, Elem->Msg, Elem->MsgLen)) { - pDelFrame = (PFRAME_DELBA_REQ) (&Elem->Msg[0]); + pDelFrame = (struct rt_frame_delba_req *) (&Elem->Msg[0]); if (pDelFrame->DelbaParm.Initiator == ORIGINATOR) { DBGPRINT(RT_DEBUG_TRACE, ("BA - PeerDelBAAction----> ORIGINATOR\n")); @@ -1243,14 +1243,14 @@ void PeerDelBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } -BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd, +BOOLEAN CntlEnqueueForRecv(struct rt_rtmp_adapter *pAd, unsigned long Wcid, - unsigned long MsgLen, IN PFRAME_BA_REQ pMsg) + unsigned long MsgLen, struct rt_frame_ba_req * pMsg) { - PFRAME_BA_REQ pFrame = pMsg; + struct rt_frame_ba_req * pFrame = pMsg; /*PRTMP_REORDERBUF pBuffer; */ /*PRTMP_REORDERBUF pDmaBuf; */ - PBA_REC_ENTRY pBAEntry; + struct rt_ba_rec_entry *pBAEntry; /*BOOLEAN Result; */ unsigned long Idx; /*u8 NumRxPkt; */ @@ -1271,10 +1271,10 @@ BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd, if (MsgLen > MGMT_DMA_BUFFER_SIZE) { DBGPRINT_ERR(("CntlEnqueueForRecv: frame too large, size = %ld \n", MsgLen)); return FALSE; - } else if (MsgLen != sizeof(FRAME_BA_REQ)) { + } else if (MsgLen != sizeof(struct rt_frame_ba_req)) { DBGPRINT_ERR(("CntlEnqueueForRecv: BlockAck Request frame length size = %ld incorrect\n", MsgLen)); return FALSE; - } else if (MsgLen != sizeof(FRAME_BA_REQ)) { + } else if (MsgLen != sizeof(struct rt_frame_ba_req)) { DBGPRINT_ERR(("CntlEnqueueForRecv: BlockAck Request frame length size = %ld incorrect\n", MsgLen)); return FALSE; } @@ -1309,12 +1309,12 @@ BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd, /* Description : Send PSMP Action frame If PSMP mode switches. */ -void SendPSMPAction(IN PRTMP_ADAPTER pAd, u8 Wcid, u8 Psmp) +void SendPSMPAction(struct rt_rtmp_adapter *pAd, u8 Wcid, u8 Psmp) { u8 *pOutBuffer = NULL; int NStatus; /*unsigned long Idx; */ - FRAME_PSMP_ACTION Frame; + struct rt_frame_psmp_action Frame; unsigned long FrameLen; NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ @@ -1355,7 +1355,7 @@ void SendPSMPAction(IN PRTMP_ADAPTER pAd, u8 Wcid, u8 Psmp) break; } MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(FRAME_PSMP_ACTION), &Frame, END_OF_ARGS); + sizeof(struct rt_frame_psmp_action), &Frame, END_OF_ARGS); MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); DBGPRINT(RT_DEBUG_ERROR, ("HT - SendPSMPAction( %d ) \n", Frame.Psmp)); @@ -1363,7 +1363,7 @@ void SendPSMPAction(IN PRTMP_ADAPTER pAd, u8 Wcid, u8 Psmp) #define RADIO_MEASUREMENT_REQUEST_ACTION 0 -typedef struct PACKED { +struct PACKED rt_beacon_request { u8 RegulatoryClass; u8 ChannelNumber; u16 RandomInterval; @@ -1373,18 +1373,18 @@ typedef struct PACKED { u8 ReportingCondition; u8 Threshold; u8 SSIDIE[2]; /* 2 byte */ -} BEACON_REQUEST; +}; -typedef struct PACKED { +struct PACKED rt_measurement_req { u8 ID; u8 Length; u8 Token; u8 RequestMode; u8 Type; -} MEASUREMENT_REQ; +}; -void convert_reordering_packet_to_preAMSDU_or_802_3_packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, +void convert_reordering_packet_to_preAMSDU_or_802_3_packet(struct rt_rtmp_adapter *pAd, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID) { @@ -1436,9 +1436,9 @@ void convert_reordering_packet_to_preAMSDU_or_802_3_packet(IN PRTMP_ADAPTER pAd, } \ } while (0); -static void ba_enqueue_reordering_packet(IN PRTMP_ADAPTER pAd, - IN PBA_REC_ENTRY pBAEntry, - IN RX_BLK * pRxBlk, +static void ba_enqueue_reordering_packet(struct rt_rtmp_adapter *pAd, + struct rt_ba_rec_entry *pBAEntry, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID) { struct reordering_mpdu *mpdu_blk; @@ -1515,11 +1515,11 @@ static void ba_enqueue_reordering_packet(IN PRTMP_ADAPTER pAd, ========================================================================== */ -void Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, u8 FromWhichBSSID) +void Indicate_AMPDU_Packet(struct rt_rtmp_adapter *pAd, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID) { u16 Idx; - PBA_REC_ENTRY pBAEntry = NULL; + struct rt_ba_rec_entry *pBAEntry = NULL; u16 Sequence = pRxBlk->pHeader->Sequence; unsigned long Now32; u8 Wcid = pRxBlk->pRxWI->WirelessCliID; diff --git a/drivers/staging/rt2860/common/cmm_aes.c b/drivers/staging/rt2860/common/cmm_aes.c index 99b0b1bff468..6730d78badfc 100644 --- a/drivers/staging/rt2860/common/cmm_aes.c +++ b/drivers/staging/rt2860/common/cmm_aes.c @@ -37,11 +37,11 @@ #include "../rt_config.h" -typedef struct { +struct aes_context { u32 erk[64]; /* encryption round keys */ u32 drk[64]; /* decryption round keys */ int nr; /* number of rounds */ -} aes_context; +}; /*****************************/ /******** SBOX Table *********/ @@ -408,9 +408,9 @@ void construct_ctr_preload(unsigned char *ctr_preload, } -BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, +BOOLEAN RTMPSoftDecryptAES(struct rt_rtmp_adapter *pAd, u8 *pData, - unsigned long DataByteCnt, IN PCIPHER_KEY pWpaKey) + unsigned long DataByteCnt, struct rt_cipher_key *pWpaKey) { u8 KeyID; u32 HeaderLen; @@ -878,7 +878,7 @@ static uint32 KT3[256]; (b)[(i) + 3] = (uint8) ( (n) ); \ } -int rt_aes_set_key(aes_context * ctx, uint8 * key, int nbits) +int rt_aes_set_key(struct aes_context * ctx, uint8 * key, int nbits) { int i; uint32 *RK, *SK; @@ -1020,7 +1020,7 @@ int rt_aes_set_key(aes_context * ctx, uint8 * key, int nbits) /* AES 128-bit block encryption routine */ -void rt_aes_encrypt(aes_context * ctx, uint8 input[16], uint8 output[16]) +void rt_aes_encrypt(struct aes_context * ctx, uint8 input[16], uint8 output[16]) { uint32 *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3; @@ -1107,7 +1107,7 @@ void rt_aes_encrypt(aes_context * ctx, uint8 input[16], uint8 output[16]) /* AES 128-bit block decryption routine */ -void rt_aes_decrypt(aes_context * ctx, uint8 input[16], uint8 output[16]) +void rt_aes_decrypt(struct aes_context * ctx, uint8 input[16], uint8 output[16]) { uint32 *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3; @@ -1210,7 +1210,7 @@ void AES_GTK_KEY_WRAP(u8 * key, u8 R[512]; int num_blocks = p_len / 8; /* unit:64bits */ int i, j; - aes_context aesctx; + struct aes_context aesctx; u8 xor; rt_aes_set_key(&aesctx, key, 128); @@ -1271,7 +1271,7 @@ void AES_GTK_KEY_UNWRAP(u8 * key, u8 A[8], BIN[16], BOUT[16]; u8 xor; int i, j; - aes_context aesctx; + struct aes_context aesctx; u8 *R; int num_blocks = c_len / 8; /* unit:64bits */ diff --git a/drivers/staging/rt2860/common/cmm_asic.c b/drivers/staging/rt2860/common/cmm_asic.c index ef7d2a6c58d5..fafba27fcd7b 100644 --- a/drivers/staging/rt2860/common/cmm_asic.c +++ b/drivers/staging/rt2860/common/cmm_asic.c @@ -38,7 +38,7 @@ #include "../rt_config.h" /* Reset the RFIC setting to new series */ -RTMP_RF_REGS RF2850RegTable[] = { +struct rt_rtmp_rf_regs RF2850RegTable[] = { /* ch R1 R2 R3(TX0~4=0) R4 */ {1, 0x98402ecc, 0x984c0786, 0x9816b455, 0x9800510b} , @@ -177,9 +177,9 @@ RTMP_RF_REGS RF2850RegTable[] = { /* still lack of MMAC(Japan) ch 34,38,42,46 */ }; -u8 NUM_OF_2850_CHNL = (sizeof(RF2850RegTable) / sizeof(RTMP_RF_REGS)); +u8 NUM_OF_2850_CHNL = (sizeof(RF2850RegTable) / sizeof(struct rt_rtmp_rf_regs)); -FREQUENCY_ITEM FreqItems3020[] = { +struct rt_frequency_item FreqItems3020[] = { /**************************************************/ /* ISM : 2.4 to 2.483 GHz // */ /**************************************************/ @@ -216,16 +216,16 @@ FREQUENCY_ITEM FreqItems3020[] = { , }; -u8 NUM_OF_3020_CHNL = (sizeof(FreqItems3020) / sizeof(FREQUENCY_ITEM)); +u8 NUM_OF_3020_CHNL = (sizeof(FreqItems3020) / sizeof(struct rt_frequency_item)); -void AsicUpdateAutoFallBackTable(IN PRTMP_ADAPTER pAd, u8 *pRateTable) +void AsicUpdateAutoFallBackTable(struct rt_rtmp_adapter *pAd, u8 *pRateTable) { u8 i; HT_FBK_CFG0_STRUC HtCfg0; HT_FBK_CFG1_STRUC HtCfg1; LG_FBK_CFG0_STRUC LgCfg0; LG_FBK_CFG1_STRUC LgCfg1; - PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate; + struct rt_rtmp_tx_rate_switch *pCurrTxRate, *pNextTxRate; /* set to initial value */ HtCfg0.word = 0x65432100; @@ -233,9 +233,9 @@ void AsicUpdateAutoFallBackTable(IN PRTMP_ADAPTER pAd, u8 *pRateTable) LgCfg0.word = 0xedcba988; LgCfg1.word = 0x00002100; - pNextTxRate = (PRTMP_TX_RATE_SWITCH) pRateTable + 1; + pNextTxRate = (struct rt_rtmp_tx_rate_switch *) pRateTable + 1; for (i = 1; i < *((u8 *)pRateTable); i++) { - pCurrTxRate = (PRTMP_TX_RATE_SWITCH) pRateTable + 1 + i; + pCurrTxRate = (struct rt_rtmp_tx_rate_switch *) pRateTable + 1 + i; switch (pCurrTxRate->Mode) { case 0: /*CCK */ break; @@ -417,7 +417,7 @@ void AsicUpdateAutoFallBackTable(IN PRTMP_ADAPTER pAd, u8 *pRateTable) we should choose not to use GF. But still set correct ASIC registers. ======================================================================== */ -void AsicUpdateProtect(IN PRTMP_ADAPTER pAd, +void AsicUpdateProtect(struct rt_rtmp_adapter *pAd, u16 OperationMode, u8 SetMask, IN BOOLEAN bDisableBGProtect, IN BOOLEAN bNonGFExist) @@ -631,13 +631,13 @@ void AsicUpdateProtect(IN PRTMP_ADAPTER pAd, ========================================================================== */ -void AsicSwitchChannel(IN PRTMP_ADAPTER pAd, u8 Channel, IN BOOLEAN bScan) +void AsicSwitchChannel(struct rt_rtmp_adapter *pAd, u8 Channel, IN BOOLEAN bScan) { unsigned long R2 = 0, R3 = DEFAULT_RF_TX_POWER, R4 = 0; char TxPwer = 0, TxPwer2 = DEFAULT_RF_TX_POWER; /*Bbp94 = BBPR94_DEFAULT, TxPwer2 = DEFAULT_RF_TX_POWER; */ u8 index; u32 Value = 0; /*BbpReg, Value; */ - RTMP_RF_REGS *RFRegTable; + struct rt_rtmp_rf_regs *RFRegTable; u8 RFValue; RFValue = 0; @@ -1002,7 +1002,7 @@ void AsicSwitchChannel(IN PRTMP_ADAPTER pAd, u8 Channel, IN BOOLEAN bScan) RTMPusecDelay(1000); } -void AsicResetBBPAgent(IN PRTMP_ADAPTER pAd) +void AsicResetBBPAgent(struct rt_rtmp_adapter *pAd) { BBP_CSR_CFG_STRUC BbpCsr; DBGPRINT(RT_DEBUG_ERROR, ("Reset BBP Agent busy bit.!! \n")); @@ -1025,7 +1025,7 @@ void AsicResetBBPAgent(IN PRTMP_ADAPTER pAd) ========================================================================== */ -void AsicLockChannel(IN PRTMP_ADAPTER pAd, u8 Channel) +void AsicLockChannel(struct rt_rtmp_adapter *pAd, u8 Channel) { } @@ -1052,7 +1052,7 @@ void AsicRfTuningExec(void *SystemSpecific1, it should be called AFTER MlmeDynamicTxRatSwitching() ========================================================================== */ -void AsicAdjustTxPower(IN PRTMP_ADAPTER pAd) +void AsicAdjustTxPower(struct rt_rtmp_adapter *pAd) { int i, j; char DeltaPwr = 0; @@ -1277,7 +1277,7 @@ void AsicAdjustTxPower(IN PRTMP_ADAPTER pAd) ========================================================================== */ -void AsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, +void AsicSleepThenAutoWakeup(struct rt_rtmp_adapter *pAd, u16 TbttNumToNextWakeUp) { RTMP_STA_SLEEP_THEN_AUTO_WAKEUP(pAd, TbttNumToNextWakeUp); @@ -1291,7 +1291,7 @@ void AsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, in INFRA BSS, we should use AsicSleepThenAutoWakeup() instead. ========================================================================== */ -void AsicForceSleep(IN PRTMP_ADAPTER pAd) +void AsicForceSleep(struct rt_rtmp_adapter *pAd) { } @@ -1306,7 +1306,7 @@ void AsicForceSleep(IN PRTMP_ADAPTER pAd) IRQL = DISPATCH_LEVEL ========================================================================== */ -void AsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) +void AsicForceWakeup(struct rt_rtmp_adapter *pAd, IN BOOLEAN bFromTx) { DBGPRINT(RT_DEBUG_INFO, ("--> AsicForceWakeup \n")); RTMP_STA_FORCE_WAKEUP(pAd, bFromTx); @@ -1321,7 +1321,7 @@ void AsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) ========================================================================== */ -void AsicSetBssid(IN PRTMP_ADAPTER pAd, u8 *pBssid) +void AsicSetBssid(struct rt_rtmp_adapter *pAd, u8 *pBssid) { unsigned long Addr4; DBGPRINT(RT_DEBUG_TRACE, @@ -1340,9 +1340,9 @@ void AsicSetBssid(IN PRTMP_ADAPTER pAd, u8 *pBssid) RTMP_IO_WRITE32(pAd, MAC_BSSID_DW1, Addr4); } -void AsicSetMcastWC(IN PRTMP_ADAPTER pAd) +void AsicSetMcastWC(struct rt_rtmp_adapter *pAd) { - MAC_TABLE_ENTRY *pEntry = &pAd->MacTab.Content[MCAST_WCID]; + struct rt_mac_table_entry *pEntry = &pAd->MacTab.Content[MCAST_WCID]; u16 offset; pEntry->Sst = SST_ASSOC; @@ -1360,7 +1360,7 @@ void AsicSetMcastWC(IN PRTMP_ADAPTER pAd) ========================================================================== */ -void AsicDelWcidTab(IN PRTMP_ADAPTER pAd, u8 Wcid) +void AsicDelWcidTab(struct rt_rtmp_adapter *pAd, u8 Wcid) { unsigned long Addr0 = 0x0, Addr1 = 0x0; unsigned long offset; @@ -1380,7 +1380,7 @@ void AsicDelWcidTab(IN PRTMP_ADAPTER pAd, u8 Wcid) ========================================================================== */ -void AsicEnableRDG(IN PRTMP_ADAPTER pAd) +void AsicEnableRDG(struct rt_rtmp_adapter *pAd) { TX_LINK_CFG_STRUC TxLinkCfg; u32 Data = 0; @@ -1405,7 +1405,7 @@ void AsicEnableRDG(IN PRTMP_ADAPTER pAd) ========================================================================== */ -void AsicDisableRDG(IN PRTMP_ADAPTER pAd) +void AsicDisableRDG(struct rt_rtmp_adapter *pAd) { TX_LINK_CFG_STRUC TxLinkCfg; u32 Data = 0; @@ -1441,7 +1441,7 @@ void AsicDisableRDG(IN PRTMP_ADAPTER pAd) ========================================================================== */ -void AsicDisableSync(IN PRTMP_ADAPTER pAd) +void AsicDisableSync(struct rt_rtmp_adapter *pAd) { BCN_TIME_CFG_STRUC csr; @@ -1468,7 +1468,7 @@ void AsicDisableSync(IN PRTMP_ADAPTER pAd) ========================================================================== */ -void AsicEnableBssSync(IN PRTMP_ADAPTER pAd) +void AsicEnableBssSync(struct rt_rtmp_adapter *pAd) { BCN_TIME_CFG_STRUC csr; @@ -1498,7 +1498,7 @@ void AsicEnableBssSync(IN PRTMP_ADAPTER pAd) ========================================================================== */ -void AsicEnableIbssSync(IN PRTMP_ADAPTER pAd) +void AsicEnableIbssSync(struct rt_rtmp_adapter *pAd) { BCN_TIME_CFG_STRUC csr9; u8 *ptr; @@ -1581,7 +1581,7 @@ void AsicEnableIbssSync(IN PRTMP_ADAPTER pAd) ========================================================================== */ -void AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm) +void AsicSetEdcaParm(struct rt_rtmp_adapter *pAd, struct rt_edca_parm *pEdcaParm) { EDCA_AC_CFG_STRUC Ac0Cfg, Ac1Cfg, Ac2Cfg, Ac3Cfg; AC_TXOP_CSR0_STRUC csr0; @@ -1676,7 +1676,7 @@ void AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm) RTMP_IO_WRITE32(pAd, WMM_AIFSN_CFG, 0x00002222); - NdisZeroMemory(&pAd->CommonCfg.APEdcaParm, sizeof(EDCA_PARM)); + NdisZeroMemory(&pAd->CommonCfg.APEdcaParm, sizeof(struct rt_edca_parm)); } else { OPSTATUS_SET_FLAG(pAd, fOP_STATUS_WMM_INUSED); /*======================================================== */ @@ -1823,7 +1823,7 @@ void AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm) RTMP_IO_WRITE32(pAd, WMM_AIFSN_CFG, AifsnCsr.word); NdisMoveMemory(&pAd->CommonCfg.APEdcaParm, pEdcaParm, - sizeof(EDCA_PARM)); + sizeof(struct rt_edca_parm)); if (!ADHOC_ON(pAd)) { DBGPRINT(RT_DEBUG_TRACE, ("EDCA [#%d]: AIFSN CWmin CWmax TXOP(us) ACM\n", @@ -1862,7 +1862,7 @@ void AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm) ========================================================================== */ -void AsicSetSlotTime(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUseShortSlotTime) +void AsicSetSlotTime(struct rt_rtmp_adapter *pAd, IN BOOLEAN bUseShortSlotTime) { unsigned long SlotTime; u32 RegValue = 0; @@ -1930,7 +1930,7 @@ void AsicSetSlotTime(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUseShortSlotTime) Return: ======================================================================== */ -void AsicAddSharedKeyEntry(IN PRTMP_ADAPTER pAd, +void AsicAddSharedKeyEntry(struct rt_rtmp_adapter *pAd, u8 BssIndex, u8 KeyIdx, u8 CipherAlg, @@ -2048,7 +2048,7 @@ void AsicAddSharedKeyEntry(IN PRTMP_ADAPTER pAd, } /* IRQL = DISPATCH_LEVEL */ -void AsicRemoveSharedKeyEntry(IN PRTMP_ADAPTER pAd, +void AsicRemoveSharedKeyEntry(struct rt_rtmp_adapter *pAd, u8 BssIndex, u8 KeyIdx) { /*unsigned long SecCsr0; */ @@ -2088,7 +2088,7 @@ void AsicRemoveSharedKeyEntry(IN PRTMP_ADAPTER pAd, } -void AsicUpdateWCIDAttribute(IN PRTMP_ADAPTER pAd, +void AsicUpdateWCIDAttribute(struct rt_rtmp_adapter *pAd, u16 WCID, u8 BssIndex, u8 CipherAlg, @@ -2106,7 +2106,7 @@ void AsicUpdateWCIDAttribute(IN PRTMP_ADAPTER pAd, RTMP_IO_WRITE32(pAd, offset, WCIDAttri); } -void AsicUpdateWCIDIVEIV(IN PRTMP_ADAPTER pAd, +void AsicUpdateWCIDIVEIV(struct rt_rtmp_adapter *pAd, u16 WCID, unsigned long uIV, unsigned long uEIV) { unsigned long offset; @@ -2117,7 +2117,7 @@ void AsicUpdateWCIDIVEIV(IN PRTMP_ADAPTER pAd, RTMP_IO_WRITE32(pAd, offset + 4, uEIV); } -void AsicUpdateRxWCIDTable(IN PRTMP_ADAPTER pAd, +void AsicUpdateRxWCIDTable(struct rt_rtmp_adapter *pAd, u16 WCID, u8 *pAddr) { unsigned long offset; @@ -2163,11 +2163,11 @@ void AsicUpdateRxWCIDTable(IN PRTMP_ADAPTER pAd, For AP mode bTxKey must be always set to TRUE. ======================================================================== */ -void AsicAddKeyEntry(IN PRTMP_ADAPTER pAd, +void AsicAddKeyEntry(struct rt_rtmp_adapter *pAd, u16 WCID, u8 BssIndex, u8 KeyIdx, - IN PCIPHER_KEY pCipherKey, + struct rt_cipher_key *pCipherKey, IN BOOLEAN bUsePairewiseKeyTable, IN BOOLEAN bTxKey) { unsigned long offset; @@ -2339,9 +2339,9 @@ void AsicAddKeyEntry(IN PRTMP_ADAPTER pAd, Return: ======================================================================== */ -void AsicAddPairwiseKeyEntry(IN PRTMP_ADAPTER pAd, +void AsicAddPairwiseKeyEntry(struct rt_rtmp_adapter *pAd, u8 *pAddr, - u8 WCID, IN CIPHER_KEY * pCipherKey) + u8 WCID, struct rt_cipher_key *pCipherKey) { int i; unsigned long offset; @@ -2422,7 +2422,7 @@ void AsicAddPairwiseKeyEntry(IN PRTMP_ADAPTER pAd, Return: ======================================================================== */ -void AsicRemovePairwiseKeyEntry(IN PRTMP_ADAPTER pAd, +void AsicRemovePairwiseKeyEntry(struct rt_rtmp_adapter *pAd, u8 BssIdx, u8 Wcid) { unsigned long WCIDAttri; @@ -2434,7 +2434,7 @@ void AsicRemovePairwiseKeyEntry(IN PRTMP_ADAPTER pAd, RTMP_IO_WRITE32(pAd, offset, WCIDAttri); } -BOOLEAN AsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, +BOOLEAN AsicSendCommandToMcu(struct rt_rtmp_adapter *pAd, u8 Command, u8 Token, u8 Arg0, u8 Arg1) { @@ -2445,7 +2445,7 @@ BOOLEAN AsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, return TRUE; } -void AsicSetRxAnt(IN PRTMP_ADAPTER pAd, u8 Ant) +void AsicSetRxAnt(struct rt_rtmp_adapter *pAd, u8 Ant) { #ifdef RT30xx /* RT3572 ATE need not to do this. */ @@ -2453,7 +2453,7 @@ void AsicSetRxAnt(IN PRTMP_ADAPTER pAd, u8 Ant) #endif /* RT30xx // */ } -void AsicTurnOffRFClk(IN PRTMP_ADAPTER pAd, u8 Channel) +void AsicTurnOffRFClk(struct rt_rtmp_adapter *pAd, u8 Channel) { if (pAd->chipOps.AsicRfTurnOff) { pAd->chipOps.AsicRfTurnOff(pAd); @@ -2461,7 +2461,7 @@ void AsicTurnOffRFClk(IN PRTMP_ADAPTER pAd, u8 Channel) /* RF R2 bit 18 = 0 */ u32 R1 = 0, R2 = 0, R3 = 0; u8 index; - RTMP_RF_REGS *RFRegTable; + struct rt_rtmp_rf_regs *RFRegTable; RFRegTable = RF2850RegTable; @@ -2507,12 +2507,12 @@ void AsicTurnOffRFClk(IN PRTMP_ADAPTER pAd, u8 Channel) } } -void AsicTurnOnRFClk(IN PRTMP_ADAPTER pAd, u8 Channel) +void AsicTurnOnRFClk(struct rt_rtmp_adapter *pAd, u8 Channel) { /* RF R2 bit 18 = 0 */ u32 R1 = 0, R2 = 0, R3 = 0; u8 index; - RTMP_RF_REGS *RFRegTable; + struct rt_rtmp_rf_regs *RFRegTable; #ifdef PCIE_PS_SUPPORT /* The RF programming sequence is difference between 3xxx and 2xxx */ diff --git a/drivers/staging/rt2860/common/cmm_cfg.c b/drivers/staging/rt2860/common/cmm_cfg.c index 9c6b7cacb089..24f439378439 100644 --- a/drivers/staging/rt2860/common/cmm_cfg.c +++ b/drivers/staging/rt2860/common/cmm_cfg.c @@ -80,7 +80,7 @@ char *GetBW(int BW) TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -int RT_CfgSetCountryRegion(IN PRTMP_ADAPTER pAd, char *arg, int band) +int RT_CfgSetCountryRegion(struct rt_rtmp_adapter *pAd, char *arg, int band) { long region, regionMax; u8 *pCountryRegion; @@ -126,7 +126,7 @@ int RT_CfgSetCountryRegion(IN PRTMP_ADAPTER pAd, char *arg, int band) TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -int RT_CfgSetWirelessMode(IN PRTMP_ADAPTER pAd, char *arg) +int RT_CfgSetWirelessMode(struct rt_rtmp_adapter *pAd, char *arg) { int MaxPhyMode = PHY_11G; long WirelessMode; @@ -143,7 +143,7 @@ int RT_CfgSetWirelessMode(IN PRTMP_ADAPTER pAd, char *arg) } -int RT_CfgSetShortSlot(IN PRTMP_ADAPTER pAd, char *arg) +int RT_CfgSetShortSlot(struct rt_rtmp_adapter *pAd, char *arg) { long ShortSlot; @@ -167,9 +167,9 @@ int RT_CfgSetShortSlot(IN PRTMP_ADAPTER pAd, char *arg) TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -int RT_CfgSetWepKey(IN PRTMP_ADAPTER pAd, +int RT_CfgSetWepKey(struct rt_rtmp_adapter *pAd, char *keyString, - IN CIPHER_KEY * pSharedKey, int keyIdx) + struct rt_cipher_key *pSharedKey, int keyIdx) { int KeyLen; int i; @@ -177,7 +177,7 @@ int RT_CfgSetWepKey(IN PRTMP_ADAPTER pAd, BOOLEAN bKeyIsHex = FALSE; /* TODO: Shall we do memset for the original key info?? */ - memset(pSharedKey, 0, sizeof(CIPHER_KEY)); + memset(pSharedKey, 0, sizeof(struct rt_cipher_key)); KeyLen = strlen(keyString); switch (KeyLen) { case 5: /*wep 40 Ascii type */ @@ -230,7 +230,7 @@ int RT_CfgSetWepKey(IN PRTMP_ADAPTER pAd, TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -int RT_CfgSetWPAPSKKey(IN RTMP_ADAPTER * pAd, +int RT_CfgSetWPAPSKKey(struct rt_rtmp_adapter *pAd, char *keyString, u8 * pHashStr, int hashStrLen, u8 *pPMKBuf) diff --git a/drivers/staging/rt2860/common/cmm_data.c b/drivers/staging/rt2860/common/cmm_data.c index 64b217710344..2d2c311bc7a4 100644 --- a/drivers/staging/rt2860/common/cmm_data.c +++ b/drivers/staging/rt2860/common/cmm_data.c @@ -104,7 +104,7 @@ QID_AC_VO, QID_AC_VO }; ======================================================================== */ -int MiniportMMRequest(IN PRTMP_ADAPTER pAd, +int MiniportMMRequest(struct rt_rtmp_adapter *pAd, u8 QueIdx, u8 *pData, u32 Length) { void *pPacket; @@ -242,13 +242,13 @@ int MiniportMMRequest(IN PRTMP_ADAPTER pAd, ======================================================================== */ -int MlmeHardTransmit(IN PRTMP_ADAPTER pAd, +int MlmeHardTransmit(struct rt_rtmp_adapter *pAd, u8 QueIdx, void *pPacket) { - PACKET_INFO PacketInfo; + struct rt_packet_info PacketInfo; u8 *pSrcBufVA; u32 SrcBufLen; - PHEADER_802_11 pHeader_802_11; + struct rt_header_802_11 * pHeader_802_11; if ((pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) ) { @@ -259,7 +259,7 @@ int MlmeHardTransmit(IN PRTMP_ADAPTER pAd, if (pSrcBufVA == NULL) return NDIS_STATUS_FAILURE; - pHeader_802_11 = (PHEADER_802_11) (pSrcBufVA + TXINFO_SIZE + TXWI_SIZE); + pHeader_802_11 = (struct rt_header_802_11 *) (pSrcBufVA + TXINFO_SIZE + TXWI_SIZE); #ifdef RTMP_MAC_PCI if (pAd->MACVersion == 0x28600100) @@ -270,17 +270,17 @@ int MlmeHardTransmit(IN PRTMP_ADAPTER pAd, } -int MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, +int MlmeHardTransmitMgmtRing(struct rt_rtmp_adapter *pAd, u8 QueIdx, void *pPacket) { - PACKET_INFO PacketInfo; + struct rt_packet_info PacketInfo; u8 *pSrcBufVA; u32 SrcBufLen; - PHEADER_802_11 pHeader_802_11; + struct rt_header_802_11 * pHeader_802_11; BOOLEAN bAckRequired, bInsertTimestamp; u8 MlmeRate; - PTXWI_STRUC pFirstTxWI; - MAC_TABLE_ENTRY *pMacEntry = NULL; + struct rt_txwi * pFirstTxWI; + struct rt_mac_table_entry *pMacEntry = NULL; u8 PID; RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); @@ -299,8 +299,8 @@ int MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, AsicForceWakeup(pAd, TRUE); } - pFirstTxWI = (PTXWI_STRUC) (pSrcBufVA + TXINFO_SIZE); - pHeader_802_11 = (PHEADER_802_11) (pSrcBufVA + TXINFO_SIZE + TXWI_SIZE); /*TXWI_SIZE); */ + pFirstTxWI = (struct rt_txwi *) (pSrcBufVA + TXINFO_SIZE); + pHeader_802_11 = (struct rt_header_802_11 *) (pSrcBufVA + TXINFO_SIZE + TXWI_SIZE); /*TXWI_SIZE); */ if (pHeader_802_11->Addr1[0] & 0x01) { MlmeRate = pAd->CommonCfg.BasicMlmeRate; @@ -506,11 +506,11 @@ int MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, (2).Normal ======================================================================== */ -static u8 TxPktClassification(IN RTMP_ADAPTER * pAd, void *pPacket) +static u8 TxPktClassification(struct rt_rtmp_adapter *pAd, void *pPacket) { u8 TxFrameType = TX_UNKOWN_FRAME; u8 Wcid; - MAC_TABLE_ENTRY *pMacEntry = NULL; + struct rt_mac_table_entry *pMacEntry = NULL; BOOLEAN bHTRate = FALSE; Wcid = RTMP_GET_PACKET_WCID(pPacket); @@ -554,11 +554,11 @@ static u8 TxPktClassification(IN RTMP_ADAPTER * pAd, void *pPacket) return TxFrameType; } -BOOLEAN RTMP_FillTxBlkInfo(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) +BOOLEAN RTMP_FillTxBlkInfo(struct rt_rtmp_adapter *pAd, struct rt_tx_blk *pTxBlk) { - PACKET_INFO PacketInfo; + struct rt_packet_info PacketInfo; void *pPacket; - PMAC_TABLE_ENTRY pMacEntry = NULL; + struct rt_mac_table_entry *pMacEntry = NULL; pPacket = pTxBlk->pPacket; RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pTxBlk->pSrcBufHeader, @@ -662,8 +662,8 @@ BOOLEAN RTMP_FillTxBlkInfo(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) return TRUE; } -BOOLEAN CanDoAggregateTransmit(IN RTMP_ADAPTER * pAd, - char * pPacket, IN TX_BLK * pTxBlk) +BOOLEAN CanDoAggregateTransmit(struct rt_rtmp_adapter *pAd, + char * pPacket, struct rt_tx_blk *pTxBlk) { /*DBGPRINT(RT_DEBUG_TRACE, ("Check if can do aggregation! TxFrameType=%d!\n", pTxBlk->TxFrameType)); */ @@ -712,20 +712,20 @@ BOOLEAN CanDoAggregateTransmit(IN RTMP_ADAPTER * pAd, ======================================================================== */ -void RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, u8 QIdx, /* BulkOutPipeId */ +void RTMPDeQueuePacket(struct rt_rtmp_adapter *pAd, IN BOOLEAN bIntContext, u8 QIdx, /* BulkOutPipeId */ u8 Max_Tx_Packets) { - PQUEUE_ENTRY pEntry = NULL; + struct rt_queue_entry *pEntry = NULL; void *pPacket; int Status = NDIS_STATUS_SUCCESS; u8 Count = 0; - PQUEUE_HEADER pQueue; + struct rt_queue_header *pQueue; unsigned long FreeNumber[NUM_OF_TX_RING]; u8 QueIdx, sQIdx, eQIdx; unsigned long IrqFlags = 0; BOOLEAN hasTxDesc = FALSE; - TX_BLK TxBlk; - TX_BLK *pTxBlk; + struct rt_tx_blk TxBlk; + struct rt_tx_blk *pTxBlk; if (QIdx == NUM_OF_TX_RING) { sQIdx = 0; @@ -780,7 +780,7 @@ void RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, u8 QIdx, /* } pTxBlk = &TxBlk; - NdisZeroMemory((u8 *)pTxBlk, sizeof(TX_BLK)); + NdisZeroMemory((u8 *)pTxBlk, sizeof(struct rt_tx_blk)); /*InitializeQueueHeader(&pTxBlk->TxPacketList); // Didn't need it because we already memzero it. */ pTxBlk->QueIdx = QueIdx; @@ -908,7 +908,7 @@ void RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, IN BOOLEAN bIntContext, u8 QIdx, /* ======================================================================== */ -u16 RTMPCalcDuration(IN PRTMP_ADAPTER pAd, u8 Rate, unsigned long Size) +u16 RTMPCalcDuration(struct rt_rtmp_adapter *pAd, u8 Rate, unsigned long Size) { unsigned long Duration = 0; @@ -968,7 +968,7 @@ u16 RTMPCalcDuration(IN PRTMP_ADAPTER pAd, u8 Rate, unsigned long Size) ======================================================================== */ -void RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pOutTxWI, IN BOOLEAN FRAG, IN BOOLEAN CFACK, IN BOOLEAN InsTimestamp, IN BOOLEAN AMPDU, IN BOOLEAN Ack, IN BOOLEAN NSeq, /* HW new a sequence. */ +void RTMPWriteTxWI(struct rt_rtmp_adapter *pAd, struct rt_txwi * pOutTxWI, IN BOOLEAN FRAG, IN BOOLEAN CFACK, IN BOOLEAN InsTimestamp, IN BOOLEAN AMPDU, IN BOOLEAN Ack, IN BOOLEAN NSeq, /* HW new a sequence. */ u8 BASize, u8 WCID, unsigned long Length, @@ -978,9 +978,9 @@ void RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pOutTxWI, IN BOOLEAN FRA u8 Txopmode, IN BOOLEAN CfAck, IN HTTRANSMIT_SETTING * pTransmit) { - PMAC_TABLE_ENTRY pMac = NULL; - TXWI_STRUC TxWI; - PTXWI_STRUC pTxWI; + struct rt_mac_table_entry *pMac = NULL; + struct rt_txwi TxWI; + struct rt_txwi * pTxWI; if (WCID < MAX_LEN_OF_MAC_TABLE) pMac = &pAd->MacTab.Content[WCID]; @@ -1053,14 +1053,14 @@ void RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pOutTxWI, IN BOOLEAN FRA } pTxWI->PacketId = pTxWI->MCS; - NdisMoveMemory(pOutTxWI, &TxWI, sizeof(TXWI_STRUC)); + NdisMoveMemory(pOutTxWI, &TxWI, sizeof(struct rt_txwi)); } -void RTMPWriteTxWI_Data(IN PRTMP_ADAPTER pAd, - IN OUT PTXWI_STRUC pTxWI, IN TX_BLK * pTxBlk) +void RTMPWriteTxWI_Data(struct rt_rtmp_adapter *pAd, + struct rt_txwi * pTxWI, struct rt_tx_blk *pTxBlk) { HTTRANSMIT_SETTING *pTransmit; - PMAC_TABLE_ENTRY pMacEntry; + struct rt_mac_table_entry *pMacEntry; u8 BASize; ASSERT(pTxWI); @@ -1134,11 +1134,11 @@ void RTMPWriteTxWI_Data(IN PRTMP_ADAPTER pAd, pTxWI->PacketId = pTxWI->MCS; } -void RTMPWriteTxWI_Cache(IN PRTMP_ADAPTER pAd, - IN OUT PTXWI_STRUC pTxWI, IN TX_BLK * pTxBlk) +void RTMPWriteTxWI_Cache(struct rt_rtmp_adapter *pAd, + struct rt_txwi * pTxWI, struct rt_tx_blk *pTxBlk) { PHTTRANSMIT_SETTING /*pTxHTPhyMode, */ pTransmit; - PMAC_TABLE_ENTRY pMacEntry; + struct rt_mac_table_entry *pMacEntry; /* */ /* update TXWI */ @@ -1194,7 +1194,7 @@ void RTMPWriteTxWI_Cache(IN PRTMP_ADAPTER pAd, /* 2. AGGREGATION_IN_USED */ /* 3. Fragmentation not in used */ /* 4. either no previous frame (pPrevAddr1=NULL) .OR. previoud frame is aggregatible */ -BOOLEAN TxFrameIsAggregatible(IN PRTMP_ADAPTER pAd, +BOOLEAN TxFrameIsAggregatible(struct rt_rtmp_adapter *pAd, u8 *pPrevAddr1, u8 *p8023hdr) { @@ -1230,8 +1230,8 @@ BOOLEAN TxFrameIsAggregatible(IN PRTMP_ADAPTER pAd, ======================================================================== */ -BOOLEAN PeerIsAggreOn(IN PRTMP_ADAPTER pAd, - unsigned long TxRate, IN PMAC_TABLE_ENTRY pMacEntry) +BOOLEAN PeerIsAggreOn(struct rt_rtmp_adapter *pAd, + unsigned long TxRate, struct rt_mac_table_entry *pMacEntry) { unsigned long AFlags = (fCLIENT_STATUS_AMSDU_INUSED | fCLIENT_STATUS_AGGREGATION_CAPABLE); @@ -1269,7 +1269,7 @@ BOOLEAN PeerIsAggreOn(IN PRTMP_ADAPTER pAd, ======================================================================== */ -PQUEUE_HEADER RTMPCheckTxSwQueue(IN PRTMP_ADAPTER pAd, u8 *pQueIdx) +struct rt_queue_header *RTMPCheckTxSwQueue(struct rt_rtmp_adapter *pAd, u8 *pQueIdx) { unsigned long Number; @@ -1317,7 +1317,7 @@ PQUEUE_HEADER RTMPCheckTxSwQueue(IN PRTMP_ADAPTER pAd, u8 *pQueIdx) ======================================================================== */ -void RTMPSuspendMsduTransmission(IN PRTMP_ADAPTER pAd) +void RTMPSuspendMsduTransmission(struct rt_rtmp_adapter *pAd) { DBGPRINT(RT_DEBUG_TRACE, ("SCANNING, suspend MSDU transmission ...\n")); @@ -1354,7 +1354,7 @@ void RTMPSuspendMsduTransmission(IN PRTMP_ADAPTER pAd) ======================================================================== */ -void RTMPResumeMsduTransmission(IN PRTMP_ADAPTER pAd) +void RTMPResumeMsduTransmission(struct rt_rtmp_adapter *pAd) { /* u8 IrqState; */ @@ -1379,13 +1379,13 @@ void RTMPResumeMsduTransmission(IN PRTMP_ADAPTER pAd) RTMPDeQueuePacket(pAd, FALSE, NUM_OF_TX_RING, MAX_TX_PROCESS); } -u32 deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, +u32 deaggregate_AMSDU_announce(struct rt_rtmp_adapter *pAd, void *pPacket, u8 *pData, unsigned long DataSize) { u16 PayloadSize; u16 SubFrameSize; - PHEADER_802_3 pAMSDUsubheader; + struct rt_header_802_3 * pAMSDUsubheader; u32 nMSDU; u8 Header802_3[14]; @@ -1399,7 +1399,7 @@ u32 deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, nMSDU++; /*hex_dump("subheader", pData, 64); */ - pAMSDUsubheader = (PHEADER_802_3) pData; + pAMSDUsubheader = (struct rt_header_802_3 *) pData; /*pData += LENGTH_802_3; */ PayloadSize = pAMSDUsubheader->Octet[1] + @@ -1421,8 +1421,8 @@ u32 deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, if ((Header802_3[12] == 0x88) && (Header802_3[13] == 0x8E)) { /* avoid local heap overflow, use dyanamic allocation */ - MLME_QUEUE_ELEM *Elem = - (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), + struct rt_mlme_queue_elem *Elem = + (struct rt_mlme_queue_elem *)kmalloc(sizeof(struct rt_mlme_queue_elem), MEM_ALLOC_FLAG); if (Elem != NULL) { memmove(Elem->Msg + @@ -1479,7 +1479,7 @@ u32 deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, return nMSDU; } -u32 BA_Reorder_AMSDU_Annnounce(IN PRTMP_ADAPTER pAd, void *pPacket) +u32 BA_Reorder_AMSDU_Annnounce(struct rt_rtmp_adapter *pAd, void *pPacket) { u8 *pData; u16 DataSize; @@ -1501,10 +1501,10 @@ u32 BA_Reorder_AMSDU_Annnounce(IN PRTMP_ADAPTER pAd, void *pPacket) pEntry - pointer to the MAC entry; NULL is not found ========================================================================== */ -MAC_TABLE_ENTRY *MacTableLookup(IN PRTMP_ADAPTER pAd, u8 *pAddr) +struct rt_mac_table_entry *MacTableLookup(struct rt_rtmp_adapter *pAd, u8 *pAddr) { unsigned long HashIdx; - MAC_TABLE_ENTRY *pEntry = NULL; + struct rt_mac_table_entry *pEntry = NULL; HashIdx = MAC_ADDR_HASH_INDEX(pAddr); pEntry = pAd->MacTab.Hash[HashIdx]; @@ -1521,13 +1521,13 @@ MAC_TABLE_ENTRY *MacTableLookup(IN PRTMP_ADAPTER pAd, u8 *pAddr) return pEntry; } -MAC_TABLE_ENTRY *MacTableInsertEntry(IN PRTMP_ADAPTER pAd, +struct rt_mac_table_entry *MacTableInsertEntry(struct rt_rtmp_adapter *pAd, u8 *pAddr, u8 apidx, IN BOOLEAN CleanAll) { u8 HashIdx; int i, FirstWcid; - MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry; + struct rt_mac_table_entry *pEntry = NULL, *pCurrEntry; /* u16 offset; */ /* unsigned long addr; */ @@ -1554,7 +1554,7 @@ MAC_TABLE_ENTRY *MacTableInsertEntry(IN PRTMP_ADAPTER pAd, if (CleanAll == TRUE) { pEntry->MaxSupportedRate = RATE_11; pEntry->CurrTxRate = RATE_11; - NdisZeroMemory(pEntry, sizeof(MAC_TABLE_ENTRY)); + NdisZeroMemory(pEntry, sizeof(struct rt_mac_table_entry)); pEntry->PairwiseKey.KeyLen = 0; pEntry->PairwiseKey.CipherAlg = CIPHER_NONE; } @@ -1658,11 +1658,11 @@ MAC_TABLE_ENTRY *MacTableInsertEntry(IN PRTMP_ADAPTER pAd, Delete a specified client from MAC table ========================================================================== */ -BOOLEAN MacTableDeleteEntry(IN PRTMP_ADAPTER pAd, +BOOLEAN MacTableDeleteEntry(struct rt_rtmp_adapter *pAd, u16 wcid, u8 *pAddr) { u16 HashIdx; - MAC_TABLE_ENTRY *pEntry, *pPrevEntry, *pProbeEntry; + struct rt_mac_table_entry *pEntry, *pPrevEntry, *pProbeEntry; BOOLEAN Cancelled; /*u16 offset; // unused variable */ /*u8 j; // unused variable */ @@ -1722,7 +1722,7 @@ BOOLEAN MacTableDeleteEntry(IN PRTMP_ADAPTER pAd, EAPOL_START_DISABLE; } - NdisZeroMemory(pEntry, sizeof(MAC_TABLE_ENTRY)); + NdisZeroMemory(pEntry, sizeof(struct rt_mac_table_entry)); pAd->MacTab.Size--; DBGPRINT(RT_DEBUG_TRACE, ("MacTableDeleteEntry1 - Total= %d\n", @@ -1752,7 +1752,7 @@ BOOLEAN MacTableDeleteEntry(IN PRTMP_ADAPTER pAd, the power-saving queues are freed here. ========================================================================== */ -void MacTableReset(IN PRTMP_ADAPTER pAd) +void MacTableReset(struct rt_rtmp_adapter *pAd) { int i; @@ -1790,8 +1790,8 @@ void MacTableReset(IN PRTMP_ADAPTER pAd) ========================================================================== */ -void AssocParmFill(IN PRTMP_ADAPTER pAd, - IN OUT MLME_ASSOC_REQ_STRUCT * AssocReq, +void AssocParmFill(struct rt_rtmp_adapter *pAd, + struct rt_mlme_assoc_req *AssocReq, u8 *pAddr, u16 CapabilityInfo, unsigned long Timeout, u16 ListenIntv) @@ -1811,8 +1811,8 @@ void AssocParmFill(IN PRTMP_ADAPTER pAd, ========================================================================== */ -void DisassocParmFill(IN PRTMP_ADAPTER pAd, - IN OUT MLME_DISASSOC_REQ_STRUCT * DisassocReq, +void DisassocParmFill(struct rt_rtmp_adapter *pAd, + struct rt_mlme_disassoc_req *DisassocReq, u8 *pAddr, u16 Reason) { COPY_MAC_ADDR(DisassocReq->Addr, pAddr); @@ -1853,9 +1853,9 @@ void DisassocParmFill(IN PRTMP_ADAPTER pAd, ======================================================================== */ -BOOLEAN RTMPCheckDHCPFrame(IN PRTMP_ADAPTER pAd, void *pPacket) +BOOLEAN RTMPCheckDHCPFrame(struct rt_rtmp_adapter *pAd, void *pPacket) { - PACKET_INFO PacketInfo; + struct rt_packet_info PacketInfo; unsigned long NumberOfBytesRead = 0; unsigned long CurrentOffset = 0; void *pVirtualAddress = NULL; @@ -1908,7 +1908,7 @@ BOOLEAN RTMPCheckDHCPFrame(IN PRTMP_ADAPTER pAd, void *pPacket) return TRUE; } -BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, void *pPacket) +BOOLEAN RTMPCheckEtherType(struct rt_rtmp_adapter *pAd, void *pPacket) { u16 TypeLen; u8 Byte0, Byte1; @@ -2010,8 +2010,8 @@ BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, void *pPacket) } -void Update_Rssi_Sample(IN PRTMP_ADAPTER pAd, - IN RSSI_SAMPLE * pRssi, IN PRXWI_STRUC pRxWI) +void Update_Rssi_Sample(struct rt_rtmp_adapter *pAd, + struct rt_rssi_sample *pRssi, struct rt_rxwi * pRxWI) { char rssi0 = pRxWI->RSSI0; char rssi1 = pRxWI->RSSI1; @@ -2040,8 +2040,8 @@ void Update_Rssi_Sample(IN PRTMP_ADAPTER pAd, } /* Normal legacy Rx packet indication */ -void Indicate_Legacy_Packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, u8 FromWhichBSSID) +void Indicate_Legacy_Packet(struct rt_rtmp_adapter *pAd, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID) { void *pRxPacket = pRxBlk->pRxPacket; u8 Header802_3[LENGTH_802_3]; @@ -2063,7 +2063,7 @@ void Indicate_Legacy_Packet(IN PRTMP_ADAPTER pAd, #ifdef RTMP_MAC_USB if (pAd->CommonCfg.bDisableReordering == 0) { - PBA_REC_ENTRY pBAEntry; + struct rt_ba_rec_entry *pBAEntry; unsigned long Now32; u8 Wcid = pRxBlk->pRxWI->WirelessCliID; u8 TID = pRxBlk->pRxWI->TID; @@ -2111,8 +2111,8 @@ void Indicate_Legacy_Packet(IN PRTMP_ADAPTER pAd, } /* Normal, AMPDU or AMSDU */ -void CmmRxnonRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, u8 FromWhichBSSID) +void CmmRxnonRalinkFrameIndicate(struct rt_rtmp_adapter *pAd, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID) { if (RX_BLK_TEST_FLAG(pRxBlk, fRX_AMPDU) && (pAd->CommonCfg.bDisableReordering == 0)) { @@ -2127,9 +2127,9 @@ void CmmRxnonRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, } } -void CmmRxRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, - IN RX_BLK * pRxBlk, u8 FromWhichBSSID) +void CmmRxRalinkFrameIndicate(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID) { u8 Header802_3[LENGTH_802_3]; u16 Msdu2Size; @@ -2192,9 +2192,9 @@ void CmmRxRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, _fragFrame.Flags = 0; \ } -void *RTMPDeFragmentDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) +void *RTMPDeFragmentDataFrame(struct rt_rtmp_adapter *pAd, struct rt_rx_blk *pRxBlk) { - PHEADER_802_11 pHeader = pRxBlk->pHeader; + struct rt_header_802_11 * pHeader = pRxBlk->pHeader; void *pRxPacket = pRxBlk->pRxPacket; u8 *pData = pRxBlk->pData; u16 DataSize = pRxBlk->DataSize; @@ -2283,7 +2283,7 @@ done: pRetPacket = pAd->FragFrame.pFragPacket; pAd->FragFrame.pFragPacket = pNewFragPacket; pRxBlk->pHeader = - (PHEADER_802_11) GET_OS_PKT_DATAPTR(pRetPacket); + (struct rt_header_802_11 *) GET_OS_PKT_DATAPTR(pRetPacket); pRxBlk->pData = (u8 *) pRxBlk->pHeader + HeaderRoom; pRxBlk->DataSize = pAd->FragFrame.RxSize - HeaderRoom; pRxBlk->pRxPacket = pRetPacket; @@ -2295,8 +2295,8 @@ done: return pRetPacket; } -void Indicate_AMSDU_Packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, u8 FromWhichBSSID) +void Indicate_AMSDU_Packet(struct rt_rtmp_adapter *pAd, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID) { u32 nMSDU; @@ -2307,10 +2307,10 @@ void Indicate_AMSDU_Packet(IN PRTMP_ADAPTER pAd, pRxBlk->DataSize); } -void Indicate_EAPOL_Packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, u8 FromWhichBSSID) +void Indicate_EAPOL_Packet(struct rt_rtmp_adapter *pAd, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID) { - MAC_TABLE_ENTRY *pEntry = NULL; + struct rt_mac_table_entry *pEntry = NULL; { pEntry = &pAd->MacTab.Content[BSSID_WCID]; @@ -2329,7 +2329,7 @@ void Indicate_EAPOL_Packet(IN PRTMP_ADAPTER pAd, } #define BCN_TBTT_OFFSET 64 /*defer 64 us */ -void ReSyncBeaconTime(IN PRTMP_ADAPTER pAd) +void ReSyncBeaconTime(struct rt_rtmp_adapter *pAd) { u32 Offset; diff --git a/drivers/staging/rt2860/common/cmm_data_pci.c b/drivers/staging/rt2860/common/cmm_data_pci.c index b2549473fa8b..e6cb55a1292e 100644 --- a/drivers/staging/rt2860/common/cmm_data_pci.c +++ b/drivers/staging/rt2860/common/cmm_data_pci.c @@ -32,16 +32,16 @@ */ #include "../rt_config.h" -u16 RtmpPCI_WriteTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +u16 RtmpPCI_WriteTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, IN BOOLEAN bIsLast, u16 * FreeNumber) { u8 *pDMAHeaderBufVA; u16 TxIdx, RetTxIdx; - PTXD_STRUC pTxD; + struct rt_txd * pTxD; u32 BufBasePaLow; - PRTMP_TX_RING pTxRing; + struct rt_rtmp_tx_ring *pTxRing; u16 hwHeaderLen; /* */ @@ -73,7 +73,7 @@ u16 RtmpPCI_WriteTxResource(IN PRTMP_ADAPTER pAd, /* build Tx Descriptor */ /* */ - pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; + pTxD = (struct rt_txd *) pTxRing->Cell[TxIdx].AllocVa; NdisZeroMemory(pTxD, TXD_SIZE); pTxD->SDPtr0 = BufBasePaLow; @@ -97,17 +97,17 @@ u16 RtmpPCI_WriteTxResource(IN PRTMP_ADAPTER pAd, return RetTxIdx; } -u16 RtmpPCI_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +u16 RtmpPCI_WriteSingleTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, IN BOOLEAN bIsLast, u16 * FreeNumber) { u8 *pDMAHeaderBufVA; u16 TxIdx, RetTxIdx; - PTXD_STRUC pTxD; + struct rt_txd * pTxD; u32 BufBasePaLow; - PRTMP_TX_RING pTxRing; + struct rt_rtmp_tx_ring *pTxRing; u16 hwHeaderLen; /* */ @@ -132,7 +132,7 @@ u16 RtmpPCI_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, /* */ /* build Tx Descriptor */ /* */ - pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; + pTxD = (struct rt_txd *) pTxRing->Cell[TxIdx].AllocVa; NdisZeroMemory(pTxD, TXD_SIZE); pTxD->SDPtr0 = BufBasePaLow; @@ -156,16 +156,16 @@ u16 RtmpPCI_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, return RetTxIdx; } -u16 RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +u16 RtmpPCI_WriteMultiTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, u8 frameNum, u16 * FreeNumber) { BOOLEAN bIsLast; u8 *pDMAHeaderBufVA; u16 TxIdx, RetTxIdx; - PTXD_STRUC pTxD; + struct rt_txd * pTxD; u32 BufBasePaLow; - PRTMP_TX_RING pTxRing; + struct rt_rtmp_tx_ring *pTxRing; u16 hwHdrLen; u32 firstDMALen; @@ -210,7 +210,7 @@ u16 RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, /* */ /* build Tx Descriptor */ /* */ - pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; + pTxD = (struct rt_txd *) pTxRing->Cell[TxIdx].AllocVa; NdisZeroMemory(pTxD, TXD_SIZE); pTxD->SDPtr0 = BufBasePaLow; @@ -235,28 +235,28 @@ u16 RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, } -void RtmpPCI_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +void RtmpPCI_FinalWriteTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, u16 totalMPDUSize, u16 FirstTxIdx) { - PTXWI_STRUC pTxWI; - PRTMP_TX_RING pTxRing; + struct rt_txwi * pTxWI; + struct rt_rtmp_tx_ring *pTxRing; /* */ /* get Tx Ring Resource */ /* */ pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; - pTxWI = (PTXWI_STRUC) pTxRing->Cell[FirstTxIdx].DmaBuf.AllocVa; + pTxWI = (struct rt_txwi *) pTxRing->Cell[FirstTxIdx].DmaBuf.AllocVa; pTxWI->MPDUtotalByteCount = totalMPDUSize; } -void RtmpPCIDataLastTxIdx(IN PRTMP_ADAPTER pAd, +void RtmpPCIDataLastTxIdx(struct rt_rtmp_adapter *pAd, u8 QueIdx, u16 LastTxIdx) { - PTXD_STRUC pTxD; - PRTMP_TX_RING pTxRing; + struct rt_txd * pTxD; + struct rt_rtmp_tx_ring *pTxRing; /* */ /* get Tx Ring Resource */ @@ -266,21 +266,21 @@ void RtmpPCIDataLastTxIdx(IN PRTMP_ADAPTER pAd, /* */ /* build Tx Descriptor */ /* */ - pTxD = (PTXD_STRUC) pTxRing->Cell[LastTxIdx].AllocVa; + pTxD = (struct rt_txd *) pTxRing->Cell[LastTxIdx].AllocVa; pTxD->LastSec1 = 1; } -u16 RtmpPCI_WriteFragTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +u16 RtmpPCI_WriteFragTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, u8 fragNum, u16 * FreeNumber) { u8 *pDMAHeaderBufVA; u16 TxIdx, RetTxIdx; - PTXD_STRUC pTxD; + struct rt_txd * pTxD; u32 BufBasePaLow; - PRTMP_TX_RING pTxRing; + struct rt_rtmp_tx_ring *pTxRing; u16 hwHeaderLen; u32 firstDMALen; @@ -305,7 +305,7 @@ u16 RtmpPCI_WriteFragTxResource(IN PRTMP_ADAPTER pAd, /* */ /* Build Tx Descriptor */ /* */ - pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; + pTxD = (struct rt_txd *) pTxRing->Cell[TxIdx].AllocVa; NdisZeroMemory(pTxD, TXD_SIZE); if (fragNum == pTxBlk->TotalFragNum) { @@ -341,15 +341,15 @@ u16 RtmpPCI_WriteFragTxResource(IN PRTMP_ADAPTER pAd, Must be run in Interrupt context This function handle PCI specific TxDesc and cpu index update and kick the packet out. */ -int RtmpPCIMgmtKickOut(IN RTMP_ADAPTER * pAd, +int RtmpPCIMgmtKickOut(struct rt_rtmp_adapter *pAd, u8 QueIdx, void *pPacket, u8 *pSrcBufVA, u32 SrcBufLen) { - PTXD_STRUC pTxD; + struct rt_txd * pTxD; unsigned long SwIdx = pAd->MgmtRing.TxCpuIdx; - pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[SwIdx].AllocVa; + pTxD = (struct rt_txd *) pAd->MgmtRing.Cell[SwIdx].AllocVa; pAd->MgmtRing.Cell[SwIdx].pNdisPacket = pPacket; pAd->MgmtRing.Cell[SwIdx].pNextNdisPacket = NULL; @@ -405,11 +405,11 @@ int RtmpPCIMgmtKickOut(IN RTMP_ADAPTER * pAd, ======================================================================== */ -int RTMPCheckRxError(IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHeader, - IN PRXWI_STRUC pRxWI, IN PRT28XX_RXD_STRUC pRxD) +int RTMPCheckRxError(struct rt_rtmp_adapter *pAd, + struct rt_header_802_11 * pHeader, + struct rt_rxwi * pRxWI, IN PRT28XX_RXD_STRUC pRxD) { - PCIPHER_KEY pWpaKey; + struct rt_cipher_key *pWpaKey; int dBm; /* Phy errors & CRC errors */ @@ -516,13 +516,13 @@ int RTMPCheckRxError(IN PRTMP_ADAPTER pAd, return (NDIS_STATUS_SUCCESS); } -BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, u8 QueIdx) +BOOLEAN RTMPFreeTXDUponTxDmaDone(struct rt_rtmp_adapter *pAd, u8 QueIdx) { - PRTMP_TX_RING pTxRing; - PTXD_STRUC pTxD; + struct rt_rtmp_tx_ring *pTxRing; + struct rt_txd * pTxD; void *pPacket; u8 FREE = 0; - TXD_STRUC TxD, *pOriTxD; + struct rt_txd TxD, *pOriTxD; /*unsigned long IrqFlags; */ BOOLEAN bReschedule = FALSE; @@ -541,9 +541,9 @@ BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, u8 QueIdx) /* Note : If (pAd->ate.bQATxStart == TRUE), we will never reach here. */ FREE++; pTxD = - (PTXD_STRUC) (pTxRing->Cell[pTxRing->TxSwFreeIdx].AllocVa); + (struct rt_txd *) (pTxRing->Cell[pTxRing->TxSwFreeIdx].AllocVa); pOriTxD = pTxD; - NdisMoveMemory(&TxD, pTxD, sizeof(TXD_STRUC)); + NdisMoveMemory(&TxD, pTxD, sizeof(struct rt_txd)); pTxD = &TxD; pTxD->DMADONE = 0; @@ -584,7 +584,7 @@ BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, u8 QueIdx) /* get tx_tdx_idx again */ RTMP_IO_READ32(pAd, TX_DTX_IDX0 + QueIdx * RINGREG_DIFF, &pTxRing->TxDmaIdx); - NdisMoveMemory(pOriTxD, pTxD, sizeof(TXD_STRUC)); + NdisMoveMemory(pOriTxD, pTxD, sizeof(struct rt_txd)); /* RTMP_IRQ_UNLOCK(&pAd->irq_lock, IrqFlags); */ } @@ -609,7 +609,7 @@ BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, u8 QueIdx) ======================================================================== */ -BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd, +BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(struct rt_rtmp_adapter *pAd, INT_SOURCE_CSR_STRUC TxRingBitmap) { /* u8 Count = 0; */ @@ -661,13 +661,13 @@ BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd, ======================================================================== */ -void RTMPHandleMgmtRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd) +void RTMPHandleMgmtRingDmaDoneInterrupt(struct rt_rtmp_adapter *pAd) { - PTXD_STRUC pTxD; + struct rt_txd * pTxD; void *pPacket; /* int i; */ u8 FREE = 0; - PRTMP_MGMT_RING pMgmtRing = &pAd->MgmtRing; + struct rt_rtmp_mgmt_ring *pMgmtRing = &pAd->MgmtRing; NdisAcquireSpinLock(&pAd->MgmtRingLock); @@ -675,7 +675,7 @@ void RTMPHandleMgmtRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd) while (pMgmtRing->TxSwFreeIdx != pMgmtRing->TxDmaIdx) { FREE++; pTxD = - (PTXD_STRUC) (pMgmtRing->Cell[pAd->MgmtRing.TxSwFreeIdx]. + (struct rt_txd *) (pMgmtRing->Cell[pAd->MgmtRing.TxSwFreeIdx]. AllocVa); pTxD->DMADONE = 0; pPacket = pMgmtRing->Cell[pMgmtRing->TxSwFreeIdx].pNdisPacket; @@ -713,7 +713,7 @@ void RTMPHandleMgmtRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd) ======================================================================== */ -void RTMPHandleTBTTInterrupt(IN PRTMP_ADAPTER pAd) +void RTMPHandleTBTTInterrupt(struct rt_rtmp_adapter *pAd) { { if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { @@ -732,7 +732,7 @@ void RTMPHandleTBTTInterrupt(IN PRTMP_ADAPTER pAd) ======================================================================== */ -void RTMPHandlePreTBTTInterrupt(IN PRTMP_ADAPTER pAd) +void RTMPHandlePreTBTTInterrupt(struct rt_rtmp_adapter *pAd) { { if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { @@ -743,7 +743,7 @@ void RTMPHandlePreTBTTInterrupt(IN PRTMP_ADAPTER pAd) } -void RTMPHandleRxCoherentInterrupt(IN PRTMP_ADAPTER pAd) +void RTMPHandleRxCoherentInterrupt(struct rt_rtmp_adapter *pAd) { WPDMA_GLO_CFG_STRUC GloCfg; @@ -773,18 +773,18 @@ void RTMPHandleRxCoherentInterrupt(IN PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_TRACE, ("<== RTMPHandleRxCoherentInterrupt \n")); } -void *GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, +void *GetPacketFromRxRing(struct rt_rtmp_adapter *pAd, OUT PRT28XX_RXD_STRUC pSaveRxD, OUT BOOLEAN * pbReschedule, IN u32 * pRxPending) { - PRXD_STRUC pRxD; + struct rt_rxd * pRxD; void *pRxPacket = NULL; void *pNewPacket; void *AllocVa; dma_addr_t AllocPa; BOOLEAN bReschedule = FALSE; - RTMP_DMACB *pRxCell; + struct rt_rtmp_dmacb *pRxCell; RTMP_SEM_LOCK(&pAd->RxRingLock); @@ -811,7 +811,7 @@ void *GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, pRxCell = &pAd->RxRing.Cell[pAd->RxRing.RxSwReadIdx]; /* Point to Rx indexed rx ring descriptor */ - pRxD = (PRXD_STRUC) pRxCell->AllocVa; + pRxD = (struct rt_rxd *) pRxCell->AllocVa; if (pRxD->DDONE == 0) { *pRxPending = 0; @@ -864,24 +864,24 @@ done: return pRxPacket; } -int MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, +int MlmeHardTransmitTxRing(struct rt_rtmp_adapter *pAd, u8 QueIdx, void *pPacket) { - PACKET_INFO PacketInfo; + struct rt_packet_info PacketInfo; u8 *pSrcBufVA; u32 SrcBufLen; - PTXD_STRUC pTxD; - PHEADER_802_11 pHeader_802_11; + struct rt_txd * pTxD; + struct rt_header_802_11 * pHeader_802_11; BOOLEAN bAckRequired, bInsertTimestamp; unsigned long SrcBufPA; /*u8 TxBufIdx; */ u8 MlmeRate; unsigned long SwIdx = pAd->TxRing[QueIdx].TxCpuIdx; - PTXWI_STRUC pFirstTxWI; + struct rt_txwi * pFirstTxWI; /*unsigned long i; */ /*HTTRANSMIT_SETTING MlmeTransmit; //Rate for this MGMT frame. */ unsigned long FreeNum; - MAC_TABLE_ENTRY *pMacEntry = NULL; + struct rt_mac_table_entry *pMacEntry = NULL; RTMP_QueryPacketInfo(pPacket, &PacketInfo, &pSrcBufVA, &SrcBufLen); @@ -901,7 +901,7 @@ int MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, SwIdx = pAd->TxRing[QueIdx].TxCpuIdx; - pTxD = (PTXD_STRUC) pAd->TxRing[QueIdx].Cell[SwIdx].AllocVa; + pTxD = (struct rt_txd *) pAd->TxRing[QueIdx].Cell[SwIdx].AllocVa; if (pAd->TxRing[QueIdx].Cell[SwIdx].pNdisPacket) { DBGPRINT(RT_DEBUG_OFF, ("MlmeHardTransmit Error\n")); @@ -915,9 +915,9 @@ int MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) AsicForceWakeup(pAd, TRUE); } - pFirstTxWI = (PTXWI_STRUC) pSrcBufVA; + pFirstTxWI = (struct rt_txwi *) pSrcBufVA; - pHeader_802_11 = (PHEADER_802_11) (pSrcBufVA + TXWI_SIZE); + pHeader_802_11 = (struct rt_header_802_11 *) (pSrcBufVA + TXWI_SIZE); if (pHeader_802_11->Addr1[0] & 0x01) { MlmeRate = pAd->CommonCfg.BasicMlmeRate; } else { @@ -1040,7 +1040,7 @@ int MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, return NDIS_STATUS_SUCCESS; } -int MlmeDataHardTransmit(IN PRTMP_ADAPTER pAd, +int MlmeDataHardTransmit(struct rt_rtmp_adapter *pAd, u8 QueIdx, void *pPacket) { if ((pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) @@ -1078,8 +1078,8 @@ int MlmeDataHardTransmit(IN PRTMP_ADAPTER pAd, ======================================================================== */ -void RTMPWriteTxDescriptor(IN PRTMP_ADAPTER pAd, - IN PTXD_STRUC pTxD, +void RTMPWriteTxDescriptor(struct rt_rtmp_adapter *pAd, + struct rt_txd * pTxD, IN BOOLEAN bWIV, u8 QueueSEL) { /* */ diff --git a/drivers/staging/rt2860/common/cmm_data_usb.c b/drivers/staging/rt2860/common/cmm_data_usb.c index f3a7208e043e..7c56c2f51987 100644 --- a/drivers/staging/rt2860/common/cmm_data_usb.c +++ b/drivers/staging/rt2860/common/cmm_data_usb.c @@ -41,9 +41,9 @@ => => */ -static inline int RtmpUSBCanDoWrite(IN RTMP_ADAPTER * pAd, +static inline int RtmpUSBCanDoWrite(struct rt_rtmp_adapter *pAd, u8 QueIdx, - IN HT_TX_CONTEXT * pHTTXContext) + struct rt_ht_tx_context *pHTTXContext) { int canWrite = NDIS_STATUS_RESOURCES; @@ -68,8 +68,8 @@ static inline int RtmpUSBCanDoWrite(IN RTMP_ADAPTER * pAd, return canWrite; } -u16 RtmpUSB_WriteSubTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +u16 RtmpUSB_WriteSubTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, IN BOOLEAN bIsLast, u16 * FreeNumber) { @@ -78,15 +78,15 @@ u16 RtmpUSB_WriteSubTxResource(IN PRTMP_ADAPTER pAd, } -u16 RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +u16 RtmpUSB_WriteFragTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, u8 fragNum, u16 * FreeNumber) { - HT_TX_CONTEXT *pHTTXContext; + struct rt_ht_tx_context *pHTTXContext; u16 hwHdrLen; /* The hwHdrLen consist of 802.11 header length plus the header padding length. */ u32 fillOffset; - TXINFO_STRUC *pTxInfo; - TXWI_STRUC *pTxWI; + struct rt_txinfo *pTxInfo; + struct rt_txwi *pTxWI; u8 *pWirelessPacket = NULL; u8 QueIdx; int Status; @@ -147,8 +147,8 @@ u16 RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, } NdisZeroMemory((u8 *)(&pTxBlk->HeaderBuf[0]), TXINFO_SIZE); - pTxInfo = (PTXINFO_STRUC) (&pTxBlk->HeaderBuf[0]); - pTxWI = (PTXWI_STRUC) (&pTxBlk->HeaderBuf[TXINFO_SIZE]); + pTxInfo = (struct rt_txinfo *)(&pTxBlk->HeaderBuf[0]); + pTxWI = (struct rt_txwi *) (&pTxBlk->HeaderBuf[TXINFO_SIZE]); pWirelessPacket = &pHTTXContext->TransferBuffer->field.WirelessPacket[fillOffset]; @@ -215,16 +215,16 @@ u16 RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, } -u16 RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +u16 RtmpUSB_WriteSingleTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, IN BOOLEAN bIsLast, u16 * FreeNumber) { - HT_TX_CONTEXT *pHTTXContext; + struct rt_ht_tx_context *pHTTXContext; u16 hwHdrLen; u32 fillOffset; - TXINFO_STRUC *pTxInfo; - TXWI_STRUC *pTxWI; + struct rt_txinfo *pTxInfo; + struct rt_txwi *pTxWI; u8 *pWirelessPacket; u8 QueIdx; unsigned long IrqFlags; @@ -249,8 +249,8 @@ u16 RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, if (Status == NDIS_STATUS_SUCCESS) { pHTTXContext->bCurWriting = TRUE; - pTxInfo = (PTXINFO_STRUC) (&pTxBlk->HeaderBuf[0]); - pTxWI = (PTXWI_STRUC) (&pTxBlk->HeaderBuf[TXINFO_SIZE]); + pTxInfo = (struct rt_txinfo *)(&pTxBlk->HeaderBuf[0]); + pTxWI = (struct rt_txwi *) (&pTxBlk->HeaderBuf[TXINFO_SIZE]); /* Reserve space for 8 bytes padding. */ if ((pHTTXContext->ENextBulkOutPosition == @@ -328,15 +328,15 @@ u16 RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, } -u16 RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +u16 RtmpUSB_WriteMultiTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, u8 frameNum, u16 * FreeNumber) { - HT_TX_CONTEXT *pHTTXContext; + struct rt_ht_tx_context *pHTTXContext; u16 hwHdrLen; /* The hwHdrLen consist of 802.11 header length plus the header padding length. */ u32 fillOffset; - TXINFO_STRUC *pTxInfo; - TXWI_STRUC *pTxWI; + struct rt_txinfo *pTxInfo; + struct rt_txwi *pTxWI; u8 *pWirelessPacket = NULL; u8 QueIdx; int Status; @@ -357,8 +357,8 @@ u16 RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, if (Status == NDIS_STATUS_SUCCESS) { pHTTXContext->bCurWriting = TRUE; - pTxInfo = (PTXINFO_STRUC) (&pTxBlk->HeaderBuf[0]); - pTxWI = (PTXWI_STRUC) (&pTxBlk->HeaderBuf[TXINFO_SIZE]); + pTxInfo = (struct rt_txinfo *)(&pTxBlk->HeaderBuf[0]); + pTxWI = (struct rt_txwi *) (&pTxBlk->HeaderBuf[TXINFO_SIZE]); /* Reserve space for 8 bytes padding. */ if ((pHTTXContext->ENextBulkOutPosition == @@ -467,15 +467,15 @@ done: } -void RtmpUSB_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +void RtmpUSB_FinalWriteTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, u16 totalMPDUSize, u16 TxIdx) { u8 QueIdx; - HT_TX_CONTEXT *pHTTXContext; + struct rt_ht_tx_context *pHTTXContext; u32 fillOffset; - TXINFO_STRUC *pTxInfo; - TXWI_STRUC *pTxWI; + struct rt_txinfo *pTxInfo; + struct rt_txwi *pTxWI; u32 USBDMApktLen, padding; unsigned long IrqFlags; u8 *pWirelessPacket; @@ -502,7 +502,7 @@ void RtmpUSB_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, /* Update TxInfo->USBDMApktLen , */ /* the length = TXWI_SIZE + 802.11_hdr + 802.11_hdr_pad + payload_of_all_batch_frames + Bulk-Out-padding */ /* */ - pTxInfo = (PTXINFO_STRUC) (pWirelessPacket); + pTxInfo = (struct rt_txinfo *)(pWirelessPacket); /* Calculate the bulk-out padding */ USBDMApktLen = pTxBlk->Priv - TXINFO_SIZE; @@ -514,7 +514,7 @@ void RtmpUSB_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, /* */ /* Update TXWI->MPDUtotalByteCount , */ /* the length = 802.11 header + payload_of_all_batch_frames */ - pTxWI = (PTXWI_STRUC) (pWirelessPacket + TXINFO_SIZE); + pTxWI = (struct rt_txwi *) (pWirelessPacket + TXINFO_SIZE); pTxWI->MPDUtotalByteCount = totalMPDUSize; /* */ @@ -547,7 +547,7 @@ void RtmpUSB_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, } -void RtmpUSBDataLastTxIdx(IN PRTMP_ADAPTER pAd, +void RtmpUSBDataLastTxIdx(struct rt_rtmp_adapter *pAd, u8 QueIdx, u16 TxIdx) { /* DO nothing for USB. */ @@ -561,8 +561,8 @@ void RtmpUSBDataLastTxIdx(IN PRTMP_ADAPTER pAd, Check if the CurWriting flag is FALSE, if it's FALSE, we can do kick out. */ -void RtmpUSBDataKickOut(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, u8 QueIdx) +void RtmpUSBDataKickOut(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, u8 QueIdx) { RTUSB_SET_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << QueIdx)); RTUSBKickBulkOut(pAd); @@ -573,21 +573,21 @@ void RtmpUSBDataKickOut(IN PRTMP_ADAPTER pAd, Must be run in Interrupt context This function handle RT2870 specific TxDesc and cpu index update and kick the packet out. */ -int RtmpUSBMgmtKickOut(IN RTMP_ADAPTER * pAd, +int RtmpUSBMgmtKickOut(struct rt_rtmp_adapter *pAd, u8 QueIdx, void *pPacket, u8 *pSrcBufVA, u32 SrcBufLen) { - PTXINFO_STRUC pTxInfo; + struct rt_txinfo *pTxInfo; unsigned long BulkOutSize; u8 padLen; u8 *pDest; unsigned long SwIdx = pAd->MgmtRing.TxCpuIdx; - PTX_CONTEXT pMLMEContext = - (PTX_CONTEXT) pAd->MgmtRing.Cell[SwIdx].AllocVa; + struct rt_tx_context *pMLMEContext = + (struct rt_tx_context *)pAd->MgmtRing.Cell[SwIdx].AllocVa; unsigned long IrqFlags; - pTxInfo = (PTXINFO_STRUC) (pSrcBufVA); + pTxInfo = (struct rt_txinfo *)(pSrcBufVA); /* Build our URB for USBD */ BulkOutSize = SrcBufLen; @@ -613,7 +613,7 @@ int RtmpUSBMgmtKickOut(IN RTMP_ADAPTER * pAd, pAd->MgmtRing.Cell[pAd->MgmtRing.TxCpuIdx].pNdisPacket = pPacket; pMLMEContext->TransferBuffer = - (PTX_BUFFER) (GET_OS_PKT_DATAPTR(pPacket)); + (struct rt_tx_buffer *)(GET_OS_PKT_DATAPTR(pPacket)); /* Length in TxInfo should be 8 less than bulkout size. */ pMLMEContext->BulkOutSize = BulkOutSize; @@ -642,14 +642,14 @@ int RtmpUSBMgmtKickOut(IN RTMP_ADAPTER * pAd, return 0; } -void RtmpUSBNullFrameKickOut(IN RTMP_ADAPTER * pAd, +void RtmpUSBNullFrameKickOut(struct rt_rtmp_adapter *pAd, u8 QueIdx, u8 * pNullFrame, u32 frameLen) { if (pAd->NullContext.InUse == FALSE) { - PTX_CONTEXT pNullContext; - PTXINFO_STRUC pTxInfo; - PTXWI_STRUC pTxWI; + struct rt_tx_context *pNullContext; + struct rt_txinfo *pTxInfo; + struct rt_txwi * pTxWI; u8 *pWirelessPkt; pNullContext = &(pAd->NullContext); @@ -661,19 +661,19 @@ void RtmpUSBNullFrameKickOut(IN RTMP_ADAPTER * pAd, WirelessPacket[0]; RTMPZeroMemory(&pWirelessPkt[0], 100); - pTxInfo = (PTXINFO_STRUC) & pWirelessPkt[0]; + pTxInfo = (struct rt_txinfo *)& pWirelessPkt[0]; RTMPWriteTxInfo(pAd, pTxInfo, - (u16)(sizeof(HEADER_802_11) + TXWI_SIZE), + (u16)(sizeof(struct rt_header_802_11) + TXWI_SIZE), TRUE, EpToQueue[MGMTPIPEIDX], FALSE, FALSE); pTxInfo->QSEL = FIFO_EDCA; - pTxWI = (PTXWI_STRUC) & pWirelessPkt[TXINFO_SIZE]; + pTxWI = (struct rt_txwi *) & pWirelessPkt[TXINFO_SIZE]; RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, FALSE, FALSE, TRUE, - FALSE, 0, BSSID_WCID, (sizeof(HEADER_802_11)), 0, + FALSE, 0, BSSID_WCID, (sizeof(struct rt_header_802_11)), 0, 0, (u8)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_HTTXOP, FALSE, &pAd->CommonCfg.MlmeTransmit); RTMPMoveMemory(&pWirelessPkt[TXWI_SIZE + TXINFO_SIZE], - &pAd->NullFrame, sizeof(HEADER_802_11)); + &pAd->NullFrame, sizeof(struct rt_header_802_11)); pAd->NullContext.BulkOutSize = TXINFO_SIZE + TXWI_SIZE + sizeof(pAd->NullFrame) + 4; @@ -707,17 +707,17 @@ Return Value: Note: ======================================================================== */ -void *GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, +void *GetPacketFromRxRing(struct rt_rtmp_adapter *pAd, OUT PRT28XX_RXD_STRUC pSaveRxD, OUT BOOLEAN * pbReschedule, IN u32 * pRxPending) { - PRX_CONTEXT pRxContext; + struct rt_rx_context *pRxContext; void *pSkb; u8 *pData; unsigned long ThisFrameLen; unsigned long RxBufferLength; - PRXWI_STRUC pRxWI; + struct rt_rxwi * pRxWI; pRxContext = &pAd->RxContext[pAd->NextRxBulkInReadIndex]; if ((pRxContext->Readable == FALSE) || (pRxContext->InUse == TRUE)) @@ -725,8 +725,8 @@ void *GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, RxBufferLength = pRxContext->BulkInOffset - pAd->ReadPosition; if (RxBufferLength < - (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXWI_STRUC) + - sizeof(RXINFO_STRUC))) { + (RT2870_RXDMALEN_FIELD_SIZE + sizeof(struct rt_rxwi) + + sizeof(struct rt_rxinfo))) { goto label_null; } @@ -748,7 +748,7 @@ void *GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, goto label_null; } - if ((ThisFrameLen + 8) > RxBufferLength) /* 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC)) */ + if ((ThisFrameLen + 8) > RxBufferLength) /* 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(struct rt_rxinfo)) */ { DBGPRINT(RT_DEBUG_TRACE, ("BIRIdx(%d):FrameLen(0x%lx) outranges. BulkInLen=0x%lx, remaining RxBufLen=0x%lx, ReadPos=0x%lx\n", @@ -761,7 +761,7 @@ void *GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, } /* skip USB frame length field */ pData += RT2870_RXDMALEN_FIELD_SIZE; - pRxWI = (PRXWI_STRUC) pData; + pRxWI = (struct rt_rxwi *) pData; if (pRxWI->MPDUtotalByteCount > ThisFrameLen) { DBGPRINT(RT_DEBUG_ERROR, ("%s():pRxWIMPDUtotalByteCount(%d) large than RxDMALen(%ld)\n", @@ -783,10 +783,10 @@ void *GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pSkb), PKTSRC_NDIS); /* copy RxD */ - *pSaveRxD = *(PRXINFO_STRUC) (pData + ThisFrameLen); + *pSaveRxD = *(struct rt_rxinfo *) (pData + ThisFrameLen); /* update next packet read position. */ - pAd->ReadPosition += (ThisFrameLen + RT2870_RXDMALEN_FIELD_SIZE + RXINFO_SIZE); /* 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC)) */ + pAd->ReadPosition += (ThisFrameLen + RT2870_RXDMALEN_FIELD_SIZE + RXINFO_SIZE); /* 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(struct rt_rxinfo)) */ return pSkb; @@ -812,11 +812,11 @@ label_null: ======================================================================== */ -int RTMPCheckRxError(IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHeader, - IN PRXWI_STRUC pRxWI, IN PRT28XX_RXD_STRUC pRxINFO) +int RTMPCheckRxError(struct rt_rtmp_adapter *pAd, + struct rt_header_802_11 * pHeader, + struct rt_rxwi * pRxWI, IN PRT28XX_RXD_STRUC pRxINFO) { - PCIPHER_KEY pWpaKey; + struct rt_cipher_key *pWpaKey; int dBm; if (pAd->bPromiscuous == TRUE) @@ -909,7 +909,7 @@ void RtmpUsbStaAsicForceWakeupTimeout(void *SystemSpecific1, void *SystemSpecific2, void *SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)FunctionContext; if (pAd && pAd->Mlme.AutoWakeupTimerRunning) { AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02); @@ -919,7 +919,7 @@ void RtmpUsbStaAsicForceWakeupTimeout(void *SystemSpecific1, } } -void RT28xxUsbStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) +void RT28xxUsbStaAsicForceWakeup(struct rt_rtmp_adapter *pAd, IN BOOLEAN bFromTx) { BOOLEAN Canceled; @@ -931,7 +931,7 @@ void RT28xxUsbStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); } -void RT28xxUsbStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, +void RT28xxUsbStaAsicSleepThenAutoWakeup(struct rt_rtmp_adapter *pAd, u16 TbttNumToNextWakeUp) { diff --git a/drivers/staging/rt2860/common/cmm_info.c b/drivers/staging/rt2860/common/cmm_info.c index 21780578f556..25302e8363b9 100644 --- a/drivers/staging/rt2860/common/cmm_info.c +++ b/drivers/staging/rt2860/common/cmm_info.c @@ -47,7 +47,7 @@ ======================================================================== */ -void RTMPSetDesiredRates(IN PRTMP_ADAPTER pAdapter, long Rates) +void RTMPSetDesiredRates(struct rt_rtmp_adapter *pAdapter, long Rates) { NDIS_802_11_RATES aryRates; @@ -235,7 +235,7 @@ void RTMPSetDesiredRates(IN PRTMP_ADAPTER pAdapter, long Rates) ======================================================================== */ -void RTMPWPARemoveAllKeys(IN PRTMP_ADAPTER pAd) +void RTMPWPARemoveAllKeys(struct rt_rtmp_adapter *pAd) { u8 i; @@ -262,7 +262,7 @@ void RTMPWPARemoveAllKeys(IN PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_TRACE, ("remove %s key #%d\n", CipherName[pAd->SharedKey[BSS0][i].CipherAlg], i)); - NdisZeroMemory(&pAd->SharedKey[BSS0][i], sizeof(CIPHER_KEY)); + NdisZeroMemory(&pAd->SharedKey[BSS0][i], sizeof(struct rt_cipher_key)); AsicRemoveSharedKeyEntry(pAd, BSS0, i); } @@ -307,7 +307,7 @@ void RTMPWPARemoveAllKeys(IN PRTMP_ADAPTER pAd) ======================================================================== */ -void RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, unsigned long phymode) +void RTMPSetPhyMode(struct rt_rtmp_adapter *pAd, unsigned long phymode) { int i; /* the selected phymode must be supported by the RF IC encoded in E2PROM */ @@ -435,7 +435,7 @@ void RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, unsigned long phymode) ======================================================================== */ -void RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode) +void RTMPSetHT(struct rt_rtmp_adapter *pAd, struct rt_oid_set_ht_phymode *pHTPhyMode) { /*unsigned long *pmcs; */ u32 Value = 0; @@ -648,9 +648,9 @@ void RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode) ======================================================================== */ -void RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, u8 apidx) +void RTMPSetIndividualHT(struct rt_rtmp_adapter *pAd, u8 apidx) { - PRT_HT_PHY_INFO pDesired_ht_phy = NULL; + struct rt_ht_phy_info *pDesired_ht_phy = NULL; u8 TxStream = pAd->CommonCfg.TxStream; u8 DesiredMcs = MCS_AUTO; @@ -669,7 +669,7 @@ void RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, u8 apidx) ("RTMPSetIndividualHT: invalid apidx(%d)\n", apidx)); return; } - RTMPZeroMemory(pDesired_ht_phy, sizeof(RT_HT_PHY_INFO)); + RTMPZeroMemory(pDesired_ht_phy, sizeof(struct rt_ht_phy_info)); DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs)); @@ -755,13 +755,13 @@ void RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, u8 apidx) ======================================================================== */ -void RTMPUpdateHTIE(IN RT_HT_CAPABILITY * pRtHt, +void RTMPUpdateHTIE(struct rt_ht_capability *pRtHt, u8 * pMcsSet, - OUT HT_CAPABILITY_IE * pHtCapability, - OUT ADD_HT_INFO_IE * pAddHtInfo) + struct rt_ht_capability_ie * pHtCapability, + struct rt_add_ht_info_ie * pAddHtInfo) { - RTMPZeroMemory(pHtCapability, sizeof(HT_CAPABILITY_IE)); - RTMPZeroMemory(pAddHtInfo, sizeof(ADD_HT_INFO_IE)); + RTMPZeroMemory(pHtCapability, sizeof(struct rt_ht_capability_ie)); + RTMPZeroMemory(pAddHtInfo, sizeof(struct rt_add_ht_info_ie)); pHtCapability->HtCapInfo.ChannelWidth = pRtHt->ChannelWidth; pHtCapability->HtCapInfo.MimoPs = pRtHt->MimoPs; @@ -790,10 +790,10 @@ void RTMPUpdateHTIE(IN RT_HT_CAPABILITY * pRtHt, Return: ======================================================================== */ -void RTMPAddWcidAttributeEntry(IN PRTMP_ADAPTER pAd, +void RTMPAddWcidAttributeEntry(struct rt_rtmp_adapter *pAd, u8 BssIdx, u8 KeyIdx, - u8 CipherAlg, IN MAC_TABLE_ENTRY * pEntry) + u8 CipherAlg, struct rt_mac_table_entry *pEntry) { u32 WCIDAttri = 0; u16 offset; @@ -914,9 +914,9 @@ char *GetAuthMode(char auth) return "UNKNOW"; } -int SetCommonHT(IN PRTMP_ADAPTER pAd) +int SetCommonHT(struct rt_rtmp_adapter *pAd) { - OID_SET_HT_PHYMODE SetHT; + struct rt_oid_set_ht_phymode SetHT; if (pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED) return FALSE; diff --git a/drivers/staging/rt2860/common/cmm_mac_pci.c b/drivers/staging/rt2860/common/cmm_mac_pci.c index f00534220562..11dfdc58c77b 100644 --- a/drivers/staging/rt2860/common/cmm_mac_pci.c +++ b/drivers/staging/rt2860/common/cmm_mac_pci.c @@ -48,18 +48,18 @@ ======================================================================== */ -int RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) +int RTMPAllocTxRxRingMemory(struct rt_rtmp_adapter *pAd) { int Status = NDIS_STATUS_SUCCESS; unsigned long RingBasePaHigh; unsigned long RingBasePaLow; void *RingBaseVa; int index, num; - PTXD_STRUC pTxD; - PRXD_STRUC pRxD; + struct rt_txd * pTxD; + struct rt_rxd * pRxD; unsigned long ErrorValue = 0; - PRTMP_TX_RING pTxRing; - PRTMP_DMABUF pDmaBuf; + struct rt_rtmp_tx_ring *pTxRing; + struct rt_rtmp_dmabuf *pDmaBuf; void *pPacket; /* PRTMP_REORDERBUF pReorderBuf; */ @@ -166,7 +166,7 @@ int RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) /* link the pre-allocated TxBuf to TXD */ pTxD = - (PTXD_STRUC) pTxRing->Cell[index].AllocVa; + (struct rt_txd *) pTxRing->Cell[index].AllocVa; pTxD->SDPtr0 = BufBasePaLow; /* advance to next ring descriptor address */ pTxD->DMADONE = 1; @@ -231,7 +231,7 @@ int RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) RingBaseVa = (u8 *)RingBaseVa + TXD_SIZE; /* link the pre-allocated TxBuf to TXD */ - pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[index].AllocVa; + pTxD = (struct rt_txd *) pAd->MgmtRing.Cell[index].AllocVa; pTxD->DMADONE = 1; /* no pre-allocated buffer required in MgmtRing for scatter-gather case */ @@ -312,7 +312,7 @@ int RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) NdisZeroMemory(pDmaBuf->AllocVa, pDmaBuf->AllocSize); /* Write RxD buffer address & allocated buffer length */ - pRxD = (PRXD_STRUC) pAd->RxRing.Cell[index].AllocVa; + pRxD = (struct rt_rxd *) pAd->RxRing.Cell[index].AllocVa; pRxD->SDP0 = RTMP_GetPhysicalAddressLow(pDmaBuf->AllocPa); pRxD->DDONE = 0; @@ -324,7 +324,7 @@ int RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) } while (FALSE); - NdisZeroMemory(&pAd->FragFrame, sizeof(FRAGMENT_FRAME)); + NdisZeroMemory(&pAd->FragFrame, sizeof(struct rt_fragment_frame)); pAd->FragFrame.pFragPacket = RTMP_AllocateFragPacketBuffer(pAd, RX_BUFFER_NORMSIZE); @@ -400,14 +400,14 @@ int RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) ======================================================================== */ -void RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, u8 RingType) +void RTMPRingCleanUp(struct rt_rtmp_adapter *pAd, u8 RingType) { - PTXD_STRUC pTxD; - PRXD_STRUC pRxD; - PQUEUE_ENTRY pEntry; + struct rt_txd * pTxD; + struct rt_rxd * pRxD; + struct rt_queue_entry *pEntry; void *pPacket; int i; - PRTMP_TX_RING pTxRing; + struct rt_rtmp_tx_ring *pTxRing; unsigned long IrqFlags; /*u32 RxSwReadIdx; */ @@ -426,7 +426,7 @@ void RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, u8 RingType) /* We have to clean all descriptors in case some error happened with reset */ for (i = 0; i < TX_RING_SIZE; i++) /* We have to scan all TX ring */ { - pTxD = (PTXD_STRUC) pTxRing->Cell[i].AllocVa; + pTxD = (struct rt_txd *) pTxRing->Cell[i].AllocVa; pPacket = (void *)pTxRing->Cell[i].pNdisPacket; /* release scatter-and-gather char */ @@ -471,7 +471,7 @@ void RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, u8 RingType) NdisAcquireSpinLock(&pAd->MgmtRingLock); for (i = 0; i < MGMT_RING_SIZE; i++) { - pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[i].AllocVa; + pTxD = (struct rt_txd *) pAd->MgmtRing.Cell[i].AllocVa; pPacket = (void *)pAd->MgmtRing.Cell[i].pNdisPacket; @@ -514,7 +514,7 @@ void RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, u8 RingType) NdisAcquireSpinLock(&pAd->RxRingLock); for (i = 0; i < RX_RING_SIZE; i++) { - pRxD = (PRXD_STRUC) pAd->RxRing.Cell[i].AllocVa; + pRxD = (struct rt_rxd *) pAd->RxRing.Cell[i].AllocVa; pRxD->DDONE = 0; } @@ -533,11 +533,11 @@ void RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, u8 RingType) } } -void RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) +void RTMPFreeTxRxRingMemory(struct rt_rtmp_adapter *pAd) { int index, num, j; - PRTMP_TX_RING pTxRing; - PTXD_STRUC pTxD; + struct rt_rtmp_tx_ring *pTxRing; + struct rt_txd * pTxD; void *pPacket; unsigned int IrqFlags; @@ -547,9 +547,9 @@ void RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) /* Free TxSwQueue Packet */ for (index = 0; index < NUM_OF_TX_RING; index++) { - PQUEUE_ENTRY pEntry; + struct rt_queue_entry *pEntry; void *pPacket; - PQUEUE_HEADER pQueue; + struct rt_queue_header *pQueue; RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags); pQueue = &pAd->TxSwQueue[index]; @@ -566,7 +566,7 @@ void RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) pTxRing = &pAd->TxRing[index]; for (j = 0; j < TX_RING_SIZE; j++) { - pTxD = (PTXD_STRUC) (pTxRing->Cell[j].AllocVa); + pTxD = (struct rt_txd *) (pTxRing->Cell[j].AllocVa); pPacket = pTxRing->Cell[j].pNdisPacket; if (pPacket) { @@ -607,21 +607,21 @@ void RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) NDIS_STATUS_SUCCESS); } } - NdisZeroMemory(pAd->RxRing.Cell, RX_RING_SIZE * sizeof(RTMP_DMACB)); + NdisZeroMemory(pAd->RxRing.Cell, RX_RING_SIZE * sizeof(struct rt_rtmp_dmacb)); if (pAd->RxDescRing.AllocVa) { RTMP_FreeDescMemory(pAd, pAd->RxDescRing.AllocSize, pAd->RxDescRing.AllocVa, pAd->RxDescRing.AllocPa); } - NdisZeroMemory(&pAd->RxDescRing, sizeof(RTMP_DMABUF)); + NdisZeroMemory(&pAd->RxDescRing, sizeof(struct rt_rtmp_dmabuf)); if (pAd->MgmtDescRing.AllocVa) { RTMP_FreeDescMemory(pAd, pAd->MgmtDescRing.AllocSize, pAd->MgmtDescRing.AllocVa, pAd->MgmtDescRing.AllocPa); } - NdisZeroMemory(&pAd->MgmtDescRing, sizeof(RTMP_DMABUF)); + NdisZeroMemory(&pAd->MgmtDescRing, sizeof(struct rt_rtmp_dmabuf)); for (num = 0; num < NUM_OF_TX_RING; num++) { if (pAd->TxBufSpace[num].AllocVa) { @@ -631,14 +631,14 @@ void RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) pAd->TxBufSpace[num].AllocVa, pAd->TxBufSpace[num].AllocPa); } - NdisZeroMemory(&pAd->TxBufSpace[num], sizeof(RTMP_DMABUF)); + NdisZeroMemory(&pAd->TxBufSpace[num], sizeof(struct rt_rtmp_dmabuf)); if (pAd->TxDescRing[num].AllocVa) { RTMP_FreeDescMemory(pAd, pAd->TxDescRing[num].AllocSize, pAd->TxDescRing[num].AllocVa, pAd->TxDescRing[num].AllocPa); } - NdisZeroMemory(&pAd->TxDescRing[num], sizeof(RTMP_DMABUF)); + NdisZeroMemory(&pAd->TxDescRing[num], sizeof(struct rt_rtmp_dmabuf)); } if (pAd->FragFrame.pFragPacket) @@ -667,7 +667,7 @@ Return Value: Note: ======================================================================== */ -void RT28XXDMADisable(IN RTMP_ADAPTER * pAd) +void RT28XXDMADisable(struct rt_rtmp_adapter *pAd) { WPDMA_GLO_CFG_STRUC GloCfg; @@ -691,7 +691,7 @@ Return Value: Note: ======================================================================== */ -void RT28XXDMAEnable(IN RTMP_ADAPTER * pAd) +void RT28XXDMAEnable(struct rt_rtmp_adapter *pAd) { WPDMA_GLO_CFG_STRUC GloCfg; int i = 0; @@ -721,7 +721,7 @@ void RT28XXDMAEnable(IN RTMP_ADAPTER * pAd) } -BOOLEAN AsicCheckCommanOk(IN PRTMP_ADAPTER pAd, u8 Command) +BOOLEAN AsicCheckCommanOk(struct rt_rtmp_adapter *pAd, u8 Command) { u32 CmdStatus = 0, CID = 0, i; u32 ThisCIDMask = 0; @@ -794,7 +794,7 @@ Return Value: Note: ======================================================================== */ -void RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, +void RT28xx_UpdateBeaconToAsic(struct rt_rtmp_adapter *pAd, int apidx, unsigned long FrameLen, unsigned long UpdatePos) { @@ -853,7 +853,7 @@ void RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, } -void RT28xxPciStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) +void RT28xxPciStaAsicForceWakeup(struct rt_rtmp_adapter *pAd, IN BOOLEAN bFromTx) { AUTO_WAKEUP_STRUC AutoWakeupCfg; @@ -888,7 +888,7 @@ void RT28xxPciStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) /* add by johnli, RF power sequence setup, load RF normal operation-mode setup */ if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) && IS_VERSION_AFTER_F(pAd)) { - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + struct rt_rtmp_chip_op *pChipOps = &pAd->chipOps; if (pChipOps->AsicReverseRfFromSleepMode) pChipOps-> @@ -949,7 +949,7 @@ void RT28xxPciStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx) DBGPRINT(RT_DEBUG_TRACE, ("<=======RT28xxPciStaAsicForceWakeup\n")); } -void RT28xxPciStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, +void RT28xxPciStaAsicSleepThenAutoWakeup(struct rt_rtmp_adapter *pAd, u16 TbttNumToNextWakeUp) { BOOLEAN brc; @@ -1020,7 +1020,7 @@ void PsPollWakeExec(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)FunctionContext; unsigned long flags; DBGPRINT(RT_DEBUG_TRACE, ("-->PsPollWakeExec \n")); @@ -1048,8 +1048,8 @@ void RadioOnExec(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)FunctionContext; + struct rt_rtmp_chip_op *pChipOps = &pAd->chipOps; WPDMA_GLO_CFG_STRUC DmaCfg; BOOLEAN Cancelled; @@ -1164,7 +1164,7 @@ void RadioOnExec(void *SystemSpecific1, ========================================================================== */ -BOOLEAN RT28xxPciAsicRadioOn(IN PRTMP_ADAPTER pAd, u8 Level) +BOOLEAN RT28xxPciAsicRadioOn(struct rt_rtmp_adapter *pAd, u8 Level) { /*WPDMA_GLO_CFG_STRUC DmaCfg; */ BOOLEAN Cancelled; @@ -1223,7 +1223,7 @@ BOOLEAN RT28xxPciAsicRadioOn(IN PRTMP_ADAPTER pAd, u8 Level) /* add by johnli, RF power sequence setup, load RF normal operation-mode setup */ if ((IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd))) { - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + struct rt_rtmp_chip_op *pChipOps = &pAd->chipOps; if (pChipOps->AsicReverseRfFromSleepMode) pChipOps->AsicReverseRfFromSleepMode(pAd); @@ -1286,7 +1286,7 @@ BOOLEAN RT28xxPciAsicRadioOn(IN PRTMP_ADAPTER pAd, u8 Level) ========================================================================== */ -BOOLEAN RT28xxPciAsicRadioOff(IN PRTMP_ADAPTER pAd, +BOOLEAN RT28xxPciAsicRadioOff(struct rt_rtmp_adapter *pAd, u8 Level, u16 TbttNumToNextWakeUp) { WPDMA_GLO_CFG_STRUC DmaCfg; @@ -1497,7 +1497,7 @@ BOOLEAN RT28xxPciAsicRadioOff(IN PRTMP_ADAPTER pAd, return TRUE; } -void RT28xxPciMlmeRadioOn(IN PRTMP_ADAPTER pAd) +void RT28xxPciMlmeRadioOn(struct rt_rtmp_adapter *pAd) { if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) return; @@ -1546,7 +1546,7 @@ void RT28xxPciMlmeRadioOn(IN PRTMP_ADAPTER pAd) } } -void RT28xxPciMlmeRadioOFF(IN PRTMP_ADAPTER pAd) +void RT28xxPciMlmeRadioOFF(struct rt_rtmp_adapter *pAd) { BOOLEAN brc = TRUE; @@ -1556,9 +1556,9 @@ void RT28xxPciMlmeRadioOFF(IN PRTMP_ADAPTER pAd) /* Link down first if any association exists */ if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) { if (INFRA_ON(pAd) || ADHOC_ON(pAd)) { - MLME_DISASSOC_REQ_STRUCT DisReq; - MLME_QUEUE_ELEM *pMsgElem = - (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), + struct rt_mlme_disassoc_req DisReq; + struct rt_mlme_queue_elem *pMsgElem = + (struct rt_mlme_queue_elem *)kmalloc(sizeof(struct rt_mlme_queue_elem), MEM_ALLOC_FLAG); if (pMsgElem) { @@ -1569,10 +1569,10 @@ void RT28xxPciMlmeRadioOFF(IN PRTMP_ADAPTER pAd) pMsgElem->Machine = ASSOC_STATE_MACHINE; pMsgElem->MsgType = MT2_MLME_DISASSOC_REQ; pMsgElem->MsgLen = - sizeof(MLME_DISASSOC_REQ_STRUCT); + sizeof(struct rt_mlme_disassoc_req); NdisMoveMemory(pMsgElem->Msg, &DisReq, sizeof - (MLME_DISASSOC_REQ_STRUCT)); + (struct rt_mlme_disassoc_req)); MlmeDisassocReqAction(pAd, pMsgElem); kfree(pMsgElem); diff --git a/drivers/staging/rt2860/common/cmm_mac_usb.c b/drivers/staging/rt2860/common/cmm_mac_usb.c index 251debb67d7c..010c37c4c724 100644 --- a/drivers/staging/rt2860/common/cmm_mac_usb.c +++ b/drivers/staging/rt2860/common/cmm_mac_usb.c @@ -43,12 +43,12 @@ Return Value: Note: Initialize all receive releated private buffer, include those define - in RTMP_ADAPTER structure and all private data structures. The mahor + in struct rt_rtmp_adapter structure and all private data structures. The mahor work is to allocate buffer for each packet and chain buffer to NDIS packet descriptor. ======================================================================== */ -int NICInitRecv(IN PRTMP_ADAPTER pAd) +int NICInitRecv(struct rt_rtmp_adapter *pAd) { u8 i; int Status = NDIS_STATUS_SUCCESS; @@ -64,7 +64,7 @@ int NICInitRecv(IN PRTMP_ADAPTER pAd) pAd->NextRxBulkInPosition = 0; for (i = 0; i < (RX_RING_SIZE); i++) { - PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); + struct rt_rx_context *pRxContext = &(pAd->RxContext[i]); /*Allocate URB */ pRxContext->pUrb = RTUSB_ALLOC_URB(0); @@ -98,7 +98,7 @@ int NICInitRecv(IN PRTMP_ADAPTER pAd) out1: for (i = 0; i < (RX_RING_SIZE); i++) { - PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); + struct rt_rx_context *pRxContext = &(pAd->RxContext[i]); if (NULL != pRxContext->TransferBuffer) { RTUSB_URB_FREE_BUFFER(pObj->pUsb_Dev, MAX_RXBULK_SIZE, @@ -132,7 +132,7 @@ Return Value: Note: ======================================================================== */ -int NICInitTransmit(IN PRTMP_ADAPTER pAd) +int NICInitTransmit(struct rt_rtmp_adapter *pAd) { #define LM_USB_ALLOC(pObj, Context, TB_Type, BufferSize, Status, msg1, err1, msg2, err2) \ Context->pUrb = RTUSB_ALLOC_URB(0); \ @@ -161,15 +161,15 @@ int NICInitTransmit(IN PRTMP_ADAPTER pAd) u8 i, acidx; int Status = NDIS_STATUS_SUCCESS; - PTX_CONTEXT pNullContext = &(pAd->NullContext); - PTX_CONTEXT pPsPollContext = &(pAd->PsPollContext); - PTX_CONTEXT pRTSContext = &(pAd->RTSContext); - PTX_CONTEXT pMLMEContext = NULL; -/* PHT_TX_CONTEXT pHTTXContext = NULL; */ + struct rt_tx_context *pNullContext = &(pAd->NullContext); + struct rt_tx_context *pPsPollContext = &(pAd->PsPollContext); + struct rt_tx_context *pRTSContext = &(pAd->RTSContext); + struct rt_tx_context *pMLMEContext = NULL; +/* struct rt_ht_tx_context *pHTTXContext = NULL; */ struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; void *RingBaseVa; -/* RTMP_TX_RING *pTxRing; */ - RTMP_MGMT_RING *pMgmtRing; +/* struct rt_rtmp_tx_ring *pTxRing; */ + struct rt_rtmp_mgmt_ring *pMgmtRing; DBGPRINT(RT_DEBUG_TRACE, ("--> NICInitTransmit\n")); pObj = pObj; @@ -199,15 +199,15 @@ int NICInitTransmit(IN PRTMP_ADAPTER pAd) /* TX_RING_SIZE, 4 ACs */ /* */ for (acidx = 0; acidx < 4; acidx++) { - PHT_TX_CONTEXT pHTTXContext = &(pAd->TxContext[acidx]); + struct rt_ht_tx_context *pHTTXContext = &(pAd->TxContext[acidx]); - NdisZeroMemory(pHTTXContext, sizeof(HT_TX_CONTEXT)); + NdisZeroMemory(pHTTXContext, sizeof(struct rt_ht_tx_context)); /*Allocate URB */ - LM_USB_ALLOC(pObj, pHTTXContext, PHTTX_BUFFER, - sizeof(HTTX_BUFFER), Status, + LM_USB_ALLOC(pObj, pHTTXContext, struct rt_httx_buffer *, + sizeof(struct rt_httx_buffer), Status, ("<-- ERROR in Alloc TX TxContext[%d] urb!! \n", acidx), done, - ("<-- ERROR in Alloc TX TxContext[%d] HTTX_BUFFER !! \n", + ("<-- ERROR in Alloc TX TxContext[%d] struct rt_httx_buffer !! \n", acidx), out1); NdisZeroMemory(pHTTXContext->TransferBuffer-> @@ -232,7 +232,7 @@ int NICInitTransmit(IN PRTMP_ADAPTER pAd) /* Allocate MGMT ring descriptor's memory */ pAd->MgmtDescRing.AllocSize = - MGMT_RING_SIZE * sizeof(TX_CONTEXT); + MGMT_RING_SIZE * sizeof(struct rt_tx_context); os_alloc_mem(pAd, (u8 **) (&pAd->MgmtDescRing.AllocVa), pAd->MgmtDescRing.AllocSize); if (pAd->MgmtDescRing.AllocVa == NULL) { @@ -248,14 +248,14 @@ int NICInitTransmit(IN PRTMP_ADAPTER pAd) pMgmtRing = &pAd->MgmtRing; for (i = 0; i < MGMT_RING_SIZE; i++) { /* link the pre-allocated Mgmt buffer to MgmtRing.Cell */ - pMgmtRing->Cell[i].AllocSize = sizeof(TX_CONTEXT); + pMgmtRing->Cell[i].AllocSize = sizeof(struct rt_tx_context); pMgmtRing->Cell[i].AllocVa = RingBaseVa; pMgmtRing->Cell[i].pNdisPacket = NULL; pMgmtRing->Cell[i].pNextNdisPacket = NULL; /*Allocate URB for MLMEContext */ pMLMEContext = - (PTX_CONTEXT) pAd->MgmtRing.Cell[i].AllocVa; + (struct rt_tx_context *)pAd->MgmtRing.Cell[i].AllocVa; pMLMEContext->pUrb = RTUSB_ALLOC_URB(0); if (pMLMEContext->pUrb == NULL) { DBGPRINT(RT_DEBUG_ERROR, @@ -274,7 +274,7 @@ int NICInitTransmit(IN PRTMP_ADAPTER pAd) pMLMEContext->SelfIdx = i; /* Offset to next ring descriptor address */ - RingBaseVa = (u8 *)RingBaseVa + sizeof(TX_CONTEXT); + RingBaseVa = (u8 *)RingBaseVa + sizeof(struct rt_tx_context); } DBGPRINT(RT_DEBUG_TRACE, ("MGMT Ring: total %d entry allocated\n", i)); @@ -289,16 +289,16 @@ int NICInitTransmit(IN PRTMP_ADAPTER pAd) /* */ for (i = 0; i < BEACON_RING_SIZE; i++) /* 2 */ { - PTX_CONTEXT pBeaconContext = &(pAd->BeaconContext[i]); + struct rt_tx_context *pBeaconContext = &(pAd->BeaconContext[i]); - NdisZeroMemory(pBeaconContext, sizeof(TX_CONTEXT)); + NdisZeroMemory(pBeaconContext, sizeof(struct rt_tx_context)); /*Allocate URB */ - LM_USB_ALLOC(pObj, pBeaconContext, PTX_BUFFER, - sizeof(TX_BUFFER), Status, + LM_USB_ALLOC(pObj, pBeaconContext, struct rt_tx_buffer *, + sizeof(struct rt_tx_buffer), Status, ("<-- ERROR in Alloc TX BeaconContext[%d] urb!! \n", i), out2, - ("<-- ERROR in Alloc TX BeaconContext[%d] TX_BUFFER !! \n", + ("<-- ERROR in Alloc TX BeaconContext[%d] struct rt_tx_buffer !! \n", i), out3); pBeaconContext->pAd = pAd; @@ -310,14 +310,14 @@ int NICInitTransmit(IN PRTMP_ADAPTER pAd) /* */ /* NullContext */ /* */ - NdisZeroMemory(pNullContext, sizeof(TX_CONTEXT)); + NdisZeroMemory(pNullContext, sizeof(struct rt_tx_context)); /*Allocate URB */ - LM_USB_ALLOC(pObj, pNullContext, PTX_BUFFER, sizeof(TX_BUFFER), + LM_USB_ALLOC(pObj, pNullContext, struct rt_tx_buffer *, sizeof(struct rt_tx_buffer), Status, ("<-- ERROR in Alloc TX NullContext urb!! \n"), out3, - ("<-- ERROR in Alloc TX NullContext TX_BUFFER !! \n"), + ("<-- ERROR in Alloc TX NullContext struct rt_tx_buffer !! \n"), out4); pNullContext->pAd = pAd; @@ -328,14 +328,14 @@ int NICInitTransmit(IN PRTMP_ADAPTER pAd) /* */ /* RTSContext */ /* */ - NdisZeroMemory(pRTSContext, sizeof(TX_CONTEXT)); + NdisZeroMemory(pRTSContext, sizeof(struct rt_tx_context)); /*Allocate URB */ - LM_USB_ALLOC(pObj, pRTSContext, PTX_BUFFER, sizeof(TX_BUFFER), + LM_USB_ALLOC(pObj, pRTSContext, struct rt_tx_buffer *, sizeof(struct rt_tx_buffer), Status, ("<-- ERROR in Alloc TX RTSContext urb!! \n"), out4, - ("<-- ERROR in Alloc TX RTSContext TX_BUFFER !! \n"), + ("<-- ERROR in Alloc TX RTSContext struct rt_tx_buffer !! \n"), out5); pRTSContext->pAd = pAd; @@ -346,13 +346,13 @@ int NICInitTransmit(IN PRTMP_ADAPTER pAd) /* */ /* PsPollContext */ /* */ - /*NdisZeroMemory(pPsPollContext, sizeof(TX_CONTEXT)); */ + /*NdisZeroMemory(pPsPollContext, sizeof(struct rt_tx_context)); */ /*Allocate URB */ - LM_USB_ALLOC(pObj, pPsPollContext, PTX_BUFFER, - sizeof(TX_BUFFER), Status, + LM_USB_ALLOC(pObj, pPsPollContext, struct rt_tx_buffer *, + sizeof(struct rt_tx_buffer), Status, ("<-- ERROR in Alloc TX PsPollContext urb!! \n"), out5, - ("<-- ERROR in Alloc TX PsPollContext TX_BUFFER !! \n"), + ("<-- ERROR in Alloc TX PsPollContext struct rt_tx_buffer !! \n"), out6); pPsPollContext->pAd = pAd; @@ -371,19 +371,19 @@ done: /* --------------------------- ERROR HANDLE --------------------------- */ out6: - LM_URB_FREE(pObj, pPsPollContext, sizeof(TX_BUFFER)); + LM_URB_FREE(pObj, pPsPollContext, sizeof(struct rt_tx_buffer)); out5: - LM_URB_FREE(pObj, pRTSContext, sizeof(TX_BUFFER)); + LM_URB_FREE(pObj, pRTSContext, sizeof(struct rt_tx_buffer)); out4: - LM_URB_FREE(pObj, pNullContext, sizeof(TX_BUFFER)); + LM_URB_FREE(pObj, pNullContext, sizeof(struct rt_tx_buffer)); out3: for (i = 0; i < BEACON_RING_SIZE; i++) { - PTX_CONTEXT pBeaconContext = &(pAd->BeaconContext[i]); + struct rt_tx_context *pBeaconContext = &(pAd->BeaconContext[i]); if (pBeaconContext) - LM_URB_FREE(pObj, pBeaconContext, sizeof(TX_BUFFER)); + LM_URB_FREE(pObj, pBeaconContext, sizeof(struct rt_tx_buffer)); } out2: @@ -391,10 +391,10 @@ out2: pMgmtRing = &pAd->MgmtRing; for (i = 0; i < MGMT_RING_SIZE; i++) { pMLMEContext = - (PTX_CONTEXT) pAd->MgmtRing.Cell[i].AllocVa; + (struct rt_tx_context *)pAd->MgmtRing.Cell[i].AllocVa; if (pMLMEContext) LM_URB_FREE(pObj, pMLMEContext, - sizeof(TX_BUFFER)); + sizeof(struct rt_tx_buffer)); } os_free_mem(pAd, pAd->MgmtDescRing.AllocVa); pAd->MgmtDescRing.AllocVa = NULL; @@ -402,9 +402,9 @@ out2: out1: for (acidx = 0; acidx < 4; acidx++) { - PHT_TX_CONTEXT pTxContext = &(pAd->TxContext[acidx]); + struct rt_ht_tx_context *pTxContext = &(pAd->TxContext[acidx]); if (pTxContext) - LM_URB_FREE(pObj, pTxContext, sizeof(HTTX_BUFFER)); + LM_URB_FREE(pObj, pTxContext, sizeof(struct rt_httx_buffer)); } /* Here we didn't have any pre-allocated memory need to free. */ @@ -428,16 +428,16 @@ Return Value: Note: ======================================================================== */ -int RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) +int RTMPAllocTxRxRingMemory(struct rt_rtmp_adapter *pAd) { -/* COUNTER_802_11 pCounter = &pAd->WlanCounters; */ +/* struct rt_counter_802_11 pCounter = &pAd->WlanCounters; */ int Status; int num; DBGPRINT(RT_DEBUG_TRACE, ("--> RTMPAllocTxRxRingMemory\n")); do { - /* Init the CmdQ and CmdQLock */ + /* Init the struct rt_cmdq and CmdQLock */ NdisAllocateSpinLock(&pAd->CmdQLock); NdisAcquireSpinLock(&pAd->CmdQLock); RTUSBInitializeCmdQ(&pAd->CmdQ); @@ -490,7 +490,7 @@ int RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd) } while (FALSE); - NdisZeroMemory(&pAd->FragFrame, sizeof(FRAGMENT_FRAME)); + NdisZeroMemory(&pAd->FragFrame, sizeof(struct rt_fragment_frame)); pAd->FragFrame.pFragPacket = RTMP_AllocateFragPacketBuffer(pAd, RX_BUFFER_NORMSIZE); @@ -519,7 +519,7 @@ Return Value: Note: ======================================================================== */ -void RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) +void RTMPFreeTxRxRingMemory(struct rt_rtmp_adapter *pAd) { #define LM_URB_FREE(pObj, Context, BufferSize) \ if (NULL != Context->pUrb) { \ @@ -533,45 +533,45 @@ void RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) Context->TransferBuffer = NULL; } u32 i, acidx; - PTX_CONTEXT pNullContext = &pAd->NullContext; - PTX_CONTEXT pPsPollContext = &pAd->PsPollContext; - PTX_CONTEXT pRTSContext = &pAd->RTSContext; -/* PHT_TX_CONTEXT pHTTXContext; */ + struct rt_tx_context *pNullContext = &pAd->NullContext; + struct rt_tx_context *pPsPollContext = &pAd->PsPollContext; + struct rt_tx_context *pRTSContext = &pAd->RTSContext; +/* struct rt_ht_tx_context *pHTTXContext; */ /*PRTMP_REORDERBUF pReorderBuf; */ struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; -/* RTMP_TX_RING *pTxRing; */ +/* struct rt_rtmp_tx_ring *pTxRing; */ DBGPRINT(RT_DEBUG_ERROR, ("---> RTMPFreeTxRxRingMemory\n")); pObj = pObj; /* Free all resources for the RECEIVE buffer queue. */ for (i = 0; i < (RX_RING_SIZE); i++) { - PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); + struct rt_rx_context *pRxContext = &(pAd->RxContext[i]); if (pRxContext) LM_URB_FREE(pObj, pRxContext, MAX_RXBULK_SIZE); } /* Free PsPoll frame resource */ - LM_URB_FREE(pObj, pPsPollContext, sizeof(TX_BUFFER)); + LM_URB_FREE(pObj, pPsPollContext, sizeof(struct rt_tx_buffer)); /* Free NULL frame resource */ - LM_URB_FREE(pObj, pNullContext, sizeof(TX_BUFFER)); + LM_URB_FREE(pObj, pNullContext, sizeof(struct rt_tx_buffer)); /* Free RTS frame resource */ - LM_URB_FREE(pObj, pRTSContext, sizeof(TX_BUFFER)); + LM_URB_FREE(pObj, pRTSContext, sizeof(struct rt_tx_buffer)); /* Free beacon frame resource */ for (i = 0; i < BEACON_RING_SIZE; i++) { - PTX_CONTEXT pBeaconContext = &(pAd->BeaconContext[i]); + struct rt_tx_context *pBeaconContext = &(pAd->BeaconContext[i]); if (pBeaconContext) - LM_URB_FREE(pObj, pBeaconContext, sizeof(TX_BUFFER)); + LM_URB_FREE(pObj, pBeaconContext, sizeof(struct rt_tx_buffer)); } /* Free mgmt frame resource */ for (i = 0; i < MGMT_RING_SIZE; i++) { - PTX_CONTEXT pMLMEContext = - (PTX_CONTEXT) pAd->MgmtRing.Cell[i].AllocVa; - /*LM_URB_FREE(pObj, pMLMEContext, sizeof(TX_BUFFER)); */ + struct rt_tx_context *pMLMEContext = + (struct rt_tx_context *)pAd->MgmtRing.Cell[i].AllocVa; + /*LM_URB_FREE(pObj, pMLMEContext, sizeof(struct rt_tx_buffer)); */ if (NULL != pAd->MgmtRing.Cell[i].pNdisPacket) { RTMPFreeNdisPacket(pAd, pAd->MgmtRing.Cell[i].pNdisPacket); @@ -592,9 +592,9 @@ void RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd) /* Free Tx frame resource */ for (acidx = 0; acidx < 4; acidx++) { - PHT_TX_CONTEXT pHTTXContext = &(pAd->TxContext[acidx]); + struct rt_ht_tx_context *pHTTXContext = &(pAd->TxContext[acidx]); if (pHTTXContext) - LM_URB_FREE(pObj, pHTTXContext, sizeof(HTTX_BUFFER)); + LM_URB_FREE(pObj, pHTTXContext, sizeof(struct rt_httx_buffer)); } if (pAd->FragFrame.pFragPacket) @@ -636,7 +636,7 @@ Return Value: Note: ======================================================================== */ -int RTUSBWriteHWMACAddress(IN PRTMP_ADAPTER pAd) +int RTUSBWriteHWMACAddress(struct rt_rtmp_adapter *pAd) { MAC_DW0_STRUC StaMacReg0; MAC_DW1_STRUC StaMacReg1; @@ -687,7 +687,7 @@ Return Value: Note: ======================================================================== */ -void RT28XXDMADisable(IN RTMP_ADAPTER * pAd) +void RT28XXDMADisable(struct rt_rtmp_adapter *pAd) { /* no use */ } @@ -706,7 +706,7 @@ Return Value: Note: ======================================================================== */ -void RT28XXDMAEnable(IN RTMP_ADAPTER * pAd) +void RT28XXDMAEnable(struct rt_rtmp_adapter *pAd) { WPDMA_GLO_CFG_STRUC GloCfg; USB_DMA_CFG_STRUC UsbCfg; @@ -767,14 +767,14 @@ Return Value: Note: ======================================================================== */ -void RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, +void RT28xx_UpdateBeaconToAsic(struct rt_rtmp_adapter *pAd, int apidx, unsigned long FrameLen, unsigned long UpdatePos) { u8 *pBeaconFrame = NULL; u8 *ptr; u32 i, padding; - BEACON_SYNC_STRUCT *pBeaconSync = pAd->CommonCfg.pBeaconSync; + struct rt_beacon_sync *pBeaconSync = pAd->CommonCfg.pBeaconSync; u32 longValue; /* u16 shortValue; */ BOOLEAN bBcnReq = FALSE; @@ -849,9 +849,9 @@ void RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, } -void RTUSBBssBeaconStop(IN RTMP_ADAPTER * pAd) +void RTUSBBssBeaconStop(struct rt_rtmp_adapter *pAd) { - BEACON_SYNC_STRUCT *pBeaconSync; + struct rt_beacon_sync *pBeaconSync; int i, offset; BOOLEAN Cancelled = TRUE; @@ -883,10 +883,10 @@ void RTUSBBssBeaconStop(IN RTMP_ADAPTER * pAd) } } -void RTUSBBssBeaconStart(IN RTMP_ADAPTER * pAd) +void RTUSBBssBeaconStart(struct rt_rtmp_adapter *pAd) { int apidx; - BEACON_SYNC_STRUCT *pBeaconSync; + struct rt_beacon_sync *pBeaconSync; /* LARGE_INTEGER tsfTime, deltaTime; */ pBeaconSync = pAd->CommonCfg.pBeaconSync; @@ -929,17 +929,17 @@ void RTUSBBssBeaconStart(IN RTMP_ADAPTER * pAd) } } -void RTUSBBssBeaconInit(IN RTMP_ADAPTER * pAd) +void RTUSBBssBeaconInit(struct rt_rtmp_adapter *pAd) { - BEACON_SYNC_STRUCT *pBeaconSync; + struct rt_beacon_sync *pBeaconSync; int i; os_alloc_mem(pAd, (u8 **) (&pAd->CommonCfg.pBeaconSync), - sizeof(BEACON_SYNC_STRUCT)); - /*NdisAllocMemory(pAd->CommonCfg.pBeaconSync, sizeof(BEACON_SYNC_STRUCT), MEM_ALLOC_FLAG); */ + sizeof(struct rt_beacon_sync)); + /*NdisAllocMemory(pAd->CommonCfg.pBeaconSync, sizeof(struct rt_beacon_sync), MEM_ALLOC_FLAG); */ if (pAd->CommonCfg.pBeaconSync) { pBeaconSync = pAd->CommonCfg.pBeaconSync; - NdisZeroMemory(pBeaconSync, sizeof(BEACON_SYNC_STRUCT)); + NdisZeroMemory(pBeaconSync, sizeof(struct rt_beacon_sync)); for (i = 0; i < HW_BEACON_MAX_COUNT; i++) { NdisZeroMemory(pBeaconSync->BeaconBuf[i], HW_BEACON_OFFSET); @@ -954,9 +954,9 @@ void RTUSBBssBeaconInit(IN RTMP_ADAPTER * pAd) } } -void RTUSBBssBeaconExit(IN RTMP_ADAPTER * pAd) +void RTUSBBssBeaconExit(struct rt_rtmp_adapter *pAd) { - BEACON_SYNC_STRUCT *pBeaconSync; + struct rt_beacon_sync *pBeaconSync; BOOLEAN Cancelled = TRUE; int i; @@ -1001,7 +1001,7 @@ void BeaconUpdateExec(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3) { - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) FunctionContext; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)FunctionContext; LARGE_INTEGER tsfTime_a; /*, tsfTime_b, deltaTime_exp, deltaTime_ab; */ u32 delta, delta2MS, period2US, remain, remain_low, remain_high; /* BOOLEAN positive; */ @@ -1038,9 +1038,9 @@ void BeaconUpdateExec(void *SystemSpecific1, * 2870 Radio on/off Related functions. * ********************************************************************/ -void RT28xxUsbMlmeRadioOn(IN PRTMP_ADAPTER pAd) +void RT28xxUsbMlmeRadioOn(struct rt_rtmp_adapter *pAd) { - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + struct rt_rtmp_chip_op *pChipOps = &pAd->chipOps; DBGPRINT(RT_DEBUG_TRACE, ("RT28xxUsbMlmeRadioOn()\n")); @@ -1068,7 +1068,7 @@ void RT28xxUsbMlmeRadioOn(IN PRTMP_ADAPTER pAd) RTMPSetLED(pAd, LED_RADIO_ON); } -void RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd) +void RT28xxUsbMlmeRadioOFF(struct rt_rtmp_adapter *pAd) { WPDMA_GLO_CFG_STRUC GloCfg; u32 Value, i; @@ -1080,14 +1080,14 @@ void RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd) /* Clear PMKID cache. */ pAd->StaCfg.SavedPMKNum = 0; - RTMPZeroMemory(pAd->StaCfg.SavedPMK, (PMKID_NO * sizeof(BSSID_INFO))); + RTMPZeroMemory(pAd->StaCfg.SavedPMK, (PMKID_NO * sizeof(struct rt_bssid_info))); /* Link down first if any association exists */ if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) { if (INFRA_ON(pAd) || ADHOC_ON(pAd)) { - MLME_DISASSOC_REQ_STRUCT DisReq; - MLME_QUEUE_ELEM *pMsgElem = - (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), + struct rt_mlme_disassoc_req DisReq; + struct rt_mlme_queue_elem *pMsgElem = + (struct rt_mlme_queue_elem *)kmalloc(sizeof(struct rt_mlme_queue_elem), MEM_ALLOC_FLAG); if (pMsgElem) { @@ -1098,10 +1098,10 @@ void RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd) pMsgElem->Machine = ASSOC_STATE_MACHINE; pMsgElem->MsgType = MT2_MLME_DISASSOC_REQ; pMsgElem->MsgLen = - sizeof(MLME_DISASSOC_REQ_STRUCT); + sizeof(struct rt_mlme_disassoc_req); NdisMoveMemory(pMsgElem->Msg, &DisReq, sizeof - (MLME_DISASSOC_REQ_STRUCT)); + (struct rt_mlme_disassoc_req)); MlmeDisassocReqAction(pAd, pMsgElem); kfree(pMsgElem); diff --git a/drivers/staging/rt2860/common/cmm_sanity.c b/drivers/staging/rt2860/common/cmm_sanity.c index 16cc31af3259..556e3d06b88b 100644 --- a/drivers/staging/rt2860/common/cmm_sanity.c +++ b/drivers/staging/rt2860/common/cmm_sanity.c @@ -58,14 +58,14 @@ extern u8 WPS_OUI[]; ========================================================================== */ -BOOLEAN MlmeAddBAReqSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN MlmeAddBAReqSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, u8 *pAddr2) { - PMLME_ADDBA_REQ_STRUCT pInfo; + struct rt_mlme_addba_req *pInfo; - pInfo = (MLME_ADDBA_REQ_STRUCT *) Msg; + pInfo = (struct rt_mlme_addba_req *)Msg; - if ((MsgLen != sizeof(MLME_ADDBA_REQ_STRUCT))) { + if ((MsgLen != sizeof(struct rt_mlme_addba_req))) { DBGPRINT(RT_DEBUG_TRACE, ("MlmeAddBAReqSanity fail - message lenght not correct.\n")); return FALSE; @@ -97,12 +97,12 @@ BOOLEAN MlmeAddBAReqSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ -BOOLEAN MlmeDelBAReqSanity(IN PRTMP_ADAPTER pAd, void * Msg, unsigned long MsgLen) +BOOLEAN MlmeDelBAReqSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen) { - MLME_DELBA_REQ_STRUCT *pInfo; - pInfo = (MLME_DELBA_REQ_STRUCT *) Msg; + struct rt_mlme_delba_req *pInfo; + pInfo = (struct rt_mlme_delba_req *)Msg; - if ((MsgLen != sizeof(MLME_DELBA_REQ_STRUCT))) { + if ((MsgLen != sizeof(struct rt_mlme_delba_req))) { DBGPRINT(RT_DEBUG_ERROR, ("MlmeDelBAReqSanity fail - message lenght not correct.\n")); return FALSE; @@ -131,14 +131,14 @@ BOOLEAN MlmeDelBAReqSanity(IN PRTMP_ADAPTER pAd, void * Msg, unsigned long MsgLe return TRUE; } -BOOLEAN PeerAddBAReqActionSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN PeerAddBAReqActionSanity(struct rt_rtmp_adapter *pAd, void * pMsg, unsigned long MsgLen, u8 *pAddr2) { - PFRAME_802_11 pFrame = (PFRAME_802_11) pMsg; - PFRAME_ADDBA_REQ pAddFrame; - pAddFrame = (PFRAME_ADDBA_REQ) (pMsg); - if (MsgLen < (sizeof(FRAME_ADDBA_REQ))) { + struct rt_frame_802_11 * pFrame = (struct rt_frame_802_11 *) pMsg; + struct rt_frame_addba_req * pAddFrame; + pAddFrame = (struct rt_frame_addba_req *) (pMsg); + if (MsgLen < (sizeof(struct rt_frame_addba_req))) { DBGPRINT(RT_DEBUG_ERROR, ("PeerAddBAReqActionSanity: ADDBA Request frame length size = %ld incorrect\n", MsgLen)); @@ -171,13 +171,13 @@ BOOLEAN PeerAddBAReqActionSanity(IN PRTMP_ADAPTER pAd, return TRUE; } -BOOLEAN PeerAddBARspActionSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN PeerAddBARspActionSanity(struct rt_rtmp_adapter *pAd, void * pMsg, unsigned long MsgLen) { - PFRAME_ADDBA_RSP pAddFrame; + struct rt_frame_addba_rsp * pAddFrame; - pAddFrame = (PFRAME_ADDBA_RSP) (pMsg); - if (MsgLen < (sizeof(FRAME_ADDBA_RSP))) { + pAddFrame = (struct rt_frame_addba_rsp *) (pMsg); + if (MsgLen < (sizeof(struct rt_frame_addba_rsp))) { DBGPRINT(RT_DEBUG_ERROR, ("PeerAddBARspActionSanity: ADDBA Response frame length size = %ld incorrect\n", MsgLen)); @@ -206,18 +206,18 @@ BOOLEAN PeerAddBARspActionSanity(IN PRTMP_ADAPTER pAd, } -BOOLEAN PeerDelBAActionSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN PeerDelBAActionSanity(struct rt_rtmp_adapter *pAd, u8 Wcid, void * pMsg, unsigned long MsgLen) { - /*PFRAME_802_11 pFrame = (PFRAME_802_11)pMsg; */ - PFRAME_DELBA_REQ pDelFrame; - if (MsgLen != (sizeof(FRAME_DELBA_REQ))) + /*struct rt_frame_802_11 * pFrame = (struct rt_frame_802_11 *)pMsg; */ + struct rt_frame_delba_req * pDelFrame; + if (MsgLen != (sizeof(struct rt_frame_delba_req))) return FALSE; if (Wcid >= MAX_LEN_OF_MAC_TABLE) return FALSE; - pDelFrame = (PFRAME_DELBA_REQ) (pMsg); + pDelFrame = (struct rt_frame_delba_req *) (pMsg); *(u16 *) (&pDelFrame->DelbaParm) = cpu2le16(*(u16 *) (&pDelFrame->DelbaParm)); @@ -240,14 +240,14 @@ BOOLEAN PeerDelBAActionSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ -BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, void * Msg, unsigned long MsgLen, u8 MsgChannel, u8 *pAddr2, u8 *pBssid, char Ssid[], u8 * pSsidLen, u8 * pBssType, u16 * pBeaconPeriod, u8 * pChannel, u8 * pNewChannel, OUT LARGE_INTEGER * pTimestamp, OUT CF_PARM * pCfParm, u16 * pAtimWin, u16 * pCapabilityInfo, u8 * pErp, u8 * pDtimCount, u8 * pDtimPeriod, u8 * pBcastFlag, u8 * pMessageToMe, u8 SupRate[], u8 * pSupRateLen, u8 ExtRate[], u8 * pExtRateLen, u8 * pCkipFlag, u8 * pAironetCellPowerLimit, OUT PEDCA_PARM pEdcaParm, OUT PQBSS_LOAD_PARM pQbssLoad, OUT PQOS_CAPABILITY_PARM pQosCapability, unsigned long * pRalinkIe, u8 * pHtCapabilityLen, u8 * pPreNHtCapabilityLen, OUT HT_CAPABILITY_IE * pHtCapability, u8 * AddHtInfoLen, OUT ADD_HT_INFO_IE * AddHtInfo, u8 * NewExtChannelOffset, /* Ht extension channel offset(above or below) */ +BOOLEAN PeerBeaconAndProbeRspSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, u8 MsgChannel, u8 *pAddr2, u8 *pBssid, char Ssid[], u8 * pSsidLen, u8 * pBssType, u16 * pBeaconPeriod, u8 * pChannel, u8 * pNewChannel, OUT LARGE_INTEGER * pTimestamp, struct rt_cf_parm * pCfParm, u16 * pAtimWin, u16 * pCapabilityInfo, u8 * pErp, u8 * pDtimCount, u8 * pDtimPeriod, u8 * pBcastFlag, u8 * pMessageToMe, u8 SupRate[], u8 * pSupRateLen, u8 ExtRate[], u8 * pExtRateLen, u8 * pCkipFlag, u8 * pAironetCellPowerLimit, struct rt_edca_parm *pEdcaParm, struct rt_qbss_load_parm *pQbssLoad, struct rt_qos_capability_parm *pQosCapability, unsigned long * pRalinkIe, u8 * pHtCapabilityLen, u8 * pPreNHtCapabilityLen, struct rt_ht_capability_ie * pHtCapability, u8 * AddHtInfoLen, struct rt_add_ht_info_ie * AddHtInfo, u8 * NewExtChannelOffset, /* Ht extension channel offset(above or below) */ u16 * LengthVIE, - OUT PNDIS_802_11_VARIABLE_IEs pVIE) + struct rt_ndis_802_11_variable_ies *pVIE) { u8 *Ptr; u8 TimLen; - PFRAME_802_11 pFrame; - PEID_STRUCT pEid; + struct rt_frame_802_11 * pFrame; + struct rt_eid * pEid; u8 SubType; u8 Sanity; /*u8 ECWMin, ECWMax; */ @@ -284,7 +284,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, void * Msg, unsigned l pEdcaParm->bValid = FALSE; /* default: no IE_EDCA_PARAMETER found */ pQosCapability->bValid = FALSE; /* default: no IE_QOS_CAPABILITY found */ - pFrame = (PFRAME_802_11) Msg; + pFrame = (struct rt_frame_802_11 *) Msg; /* get subtype from header */ SubType = (u8)pFrame->Hdr.FC.SubType; @@ -320,7 +320,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, void * Msg, unsigned l else *pBssType = BSS_ADHOC; - pEid = (PEID_STRUCT) Ptr; + pEid = (struct rt_eid *) Ptr; /* get variable fields from payload and advance the pointer */ while ((Length + 2 + pEid->Len) <= MsgLen) { @@ -374,7 +374,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, void * Msg, unsigned l if (pEid->Len >= SIZE_HT_CAP_IE) /*Note: allow extension.!! */ { NdisMoveMemory(pHtCapability, pEid->Octet, - sizeof(HT_CAPABILITY_IE)); + sizeof(struct rt_ht_capability_ie)); *pHtCapabilityLen = SIZE_HT_CAP_IE; /* Nnow we only support 26 bytes. */ *(u16 *) (&pHtCapability->HtCapInfo) = @@ -401,11 +401,11 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, void * Msg, unsigned l break; case IE_ADD_HT: - if (pEid->Len >= sizeof(ADD_HT_INFO_IE)) { + if (pEid->Len >= sizeof(struct rt_add_ht_info_ie)) { /* This IE allows extension, but we can ignore extra bytes beyond our knowledge , so only */ - /* copy first sizeof(ADD_HT_INFO_IE) */ + /* copy first sizeof(struct rt_add_ht_info_ie) */ NdisMoveMemory(AddHtInfo, pEid->Octet, - sizeof(ADD_HT_INFO_IE)); + sizeof(struct rt_add_ht_info_ie)); *AddHtInfoLen = SIZE_ADD_HT_INFO_IE; CtrlChannel = AddHtInfo->ControlChan; @@ -516,14 +516,14 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, void * Msg, unsigned l if ((pEid->Octet[3] == OUI_BROADCOM_HT) && (pEid->Len >= 30)) { { - NdisMoveMemory(pHtCapability, &pEid->Octet[4], sizeof(HT_CAPABILITY_IE)); + NdisMoveMemory(pHtCapability, &pEid->Octet[4], sizeof(struct rt_ht_capability_ie)); *pHtCapabilityLen = SIZE_HT_CAP_IE; // Nnow we only support 26 bytes. } } if ((pEid->Octet[3] == OUI_BROADCOM_HT) && (pEid->Len >= 26)) { { - NdisMoveMemory(AddHtInfo, &pEid->Octet[4], sizeof(ADD_HT_INFO_IE)); + NdisMoveMemory(AddHtInfo, &pEid->Octet[4], sizeof(struct rt_add_ht_info_ie)); *AddHtInfoLen = SIZE_ADD_HT_INFO_IE; // Nnow we only support 26 bytes. } } @@ -552,7 +552,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, void * Msg, unsigned l NdisMoveMemory(pHtCapability, &pEid->Octet[4], sizeof - (HT_CAPABILITY_IE)); + (struct rt_ht_capability_ie)); *pPreNHtCapabilityLen = SIZE_HT_CAP_IE; } @@ -560,7 +560,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, void * Msg, unsigned l && (pEid->Len >= 26)) { NdisMoveMemory(AddHtInfo, &pEid->Octet[4], - sizeof(ADD_HT_INFO_IE)); + sizeof(struct rt_add_ht_info_ie)); *AddHtInfoLen = SIZE_ADD_HT_INFO_IE; } } else if (NdisEqualMemory(pEid->Octet, WPA_OUI, 4)) { @@ -696,7 +696,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, void * Msg, unsigned l } Length = Length + 2 + pEid->Len; /* Eid[1] + Len[1]+ content[Len] */ - pEid = (PEID_STRUCT) ((u8 *) pEid + 2 + pEid->Len); + pEid = (struct rt_eid *) ((u8 *) pEid + 2 + pEid->Len); } /* For some 11a AP. it did not have the channel EID, patch here */ @@ -730,16 +730,16 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, void * Msg, unsigned l TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -BOOLEAN MlmeScanReqSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN MlmeScanReqSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, u8 * pBssType, char Ssid[], u8 * pSsidLen, u8 * pScanType) { - MLME_SCAN_REQ_STRUCT *Info; + struct rt_mlme_scan_req *Info; - Info = (MLME_SCAN_REQ_STRUCT *) (Msg); + Info = (struct rt_mlme_scan_req *)(Msg); *pBssType = Info->BssType; *pSsidLen = Info->SsidLen; NdisMoveMemory(Ssid, Info->Ssid, *pSsidLen); @@ -757,7 +757,7 @@ BOOLEAN MlmeScanReqSanity(IN PRTMP_ADAPTER pAd, } /* IRQL = DISPATCH_LEVEL */ -u8 ChannelSanity(IN PRTMP_ADAPTER pAd, u8 channel) +u8 ChannelSanity(struct rt_rtmp_adapter *pAd, u8 channel) { int i; @@ -779,12 +779,12 @@ u8 ChannelSanity(IN PRTMP_ADAPTER pAd, u8 channel) ========================================================================== */ -BOOLEAN PeerDeauthSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN PeerDeauthSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, u8 *pAddr2, u16 * pReason) { - PFRAME_802_11 pFrame = (PFRAME_802_11) Msg; + struct rt_frame_802_11 * pFrame = (struct rt_frame_802_11 *) Msg; COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); NdisMoveMemory(pReason, &pFrame->Octet[0], 2); @@ -803,7 +803,7 @@ BOOLEAN PeerDeauthSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ -BOOLEAN PeerAuthSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN PeerAuthSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, u8 *pAddr, @@ -811,7 +811,7 @@ BOOLEAN PeerAuthSanity(IN PRTMP_ADAPTER pAd, u16 * pSeq, u16 * pStatus, char * pChlgText) { - PFRAME_802_11 pFrame = (PFRAME_802_11) Msg; + struct rt_frame_802_11 * pFrame = (struct rt_frame_802_11 *) Msg; COPY_MAC_ADDR(pAddr, pFrame->Hdr.Addr2); NdisMoveMemory(pAlg, &pFrame->Octet[0], 2); @@ -853,15 +853,15 @@ BOOLEAN PeerAuthSanity(IN PRTMP_ADAPTER pAd, TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -BOOLEAN MlmeAuthReqSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN MlmeAuthReqSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, u8 *pAddr, unsigned long * pTimeout, u16 * pAlg) { - MLME_AUTH_REQ_STRUCT *pInfo; + struct rt_mlme_auth_req *pInfo; - pInfo = (MLME_AUTH_REQ_STRUCT *) Msg; + pInfo = (struct rt_mlme_auth_req *)Msg; COPY_MAC_ADDR(pAddr, pInfo->Addr); *pTimeout = pInfo->Timeout; *pAlg = pInfo->Alg; @@ -887,16 +887,16 @@ BOOLEAN MlmeAuthReqSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ -BOOLEAN MlmeAssocReqSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN MlmeAssocReqSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, u8 *pApAddr, u16 * pCapabilityInfo, unsigned long * pTimeout, u16 * pListenIntv) { - MLME_ASSOC_REQ_STRUCT *pInfo; + struct rt_mlme_assoc_req *pInfo; - pInfo = (MLME_ASSOC_REQ_STRUCT *) Msg; + pInfo = (struct rt_mlme_assoc_req *)Msg; *pTimeout = pInfo->Timeout; /* timeout */ COPY_MAC_ADDR(pApAddr, pInfo->Addr); /* AP address */ *pCapabilityInfo = pInfo->CapabilityInfo; /* capability info */ @@ -916,12 +916,12 @@ BOOLEAN MlmeAssocReqSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ -BOOLEAN PeerDisassocSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN PeerDisassocSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, u8 *pAddr2, u16 * pReason) { - PFRAME_802_11 pFrame = (PFRAME_802_11) Msg; + struct rt_frame_802_11 * pFrame = (struct rt_frame_802_11 *) Msg; COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); NdisMoveMemory(pReason, &pFrame->Octet[0], 2); @@ -946,7 +946,7 @@ BOOLEAN PeerDisassocSanity(IN PRTMP_ADAPTER pAd, ======================================================================== */ -NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity(IN PBSS_ENTRY pBss) +NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity(struct rt_bss_entry *pBss) { NDIS_802_11_NETWORK_TYPE NetWorkType; u8 rate, i; @@ -1012,15 +1012,15 @@ NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity(IN PBSS_ENTRY pBss) FALSE otherwise ========================================================================== */ -BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, - IN PEAPOL_PACKET pMsg, +BOOLEAN PeerWpaMessageSanity(struct rt_rtmp_adapter *pAd, + struct rt_eapol_packet * pMsg, unsigned long MsgLen, - u8 MsgType, IN MAC_TABLE_ENTRY * pEntry) + u8 MsgType, struct rt_mac_table_entry *pEntry) { u8 mic[LEN_KEY_DESC_MIC], digest[80], KEYDATA[MAX_LEN_OF_RSNIE]; BOOLEAN bReplayDiff = FALSE; BOOLEAN bWPA2 = FALSE; - KEY_INFO EapolKeyInfo; + struct rt_key_info EapolKeyInfo; u8 GroupKeyIndex = 0; NdisZeroMemory(mic, sizeof(mic)); @@ -1029,7 +1029,7 @@ BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, NdisZeroMemory((u8 *)& EapolKeyInfo, sizeof(EapolKeyInfo)); NdisMoveMemory((u8 *)& EapolKeyInfo, - (u8 *)& pMsg->KeyDesc.KeyInfo, sizeof(KEY_INFO)); + (u8 *)& pMsg->KeyDesc.KeyInfo, sizeof(struct rt_key_info)); *((u16 *) & EapolKeyInfo) = cpu2le16(*((u16 *) & EapolKeyInfo)); diff --git a/drivers/staging/rt2860/common/cmm_sync.c b/drivers/staging/rt2860/common/cmm_sync.c index 2d7f36a3e62c..f84194da47bc 100644 --- a/drivers/staging/rt2860/common/cmm_sync.c +++ b/drivers/staging/rt2860/common/cmm_sync.c @@ -105,13 +105,13 @@ u8 BaSizeArray[4] = { 8, 16, 32, 64 }; ========================================================================== */ -void BuildChannelList(IN PRTMP_ADAPTER pAd) +void BuildChannelList(struct rt_rtmp_adapter *pAd) { u8 i, j, index = 0, num = 0; u8 *pChannelList = NULL; NdisZeroMemory(pAd->ChannelList, - MAX_NUM_OF_CHANNELS * sizeof(CHANNEL_TX_POWER)); + MAX_NUM_OF_CHANNELS * sizeof(struct rt_channel_tx_power)); /* if not 11a-only mode, channel list starts from 2.4Ghz band */ if ((pAd->CommonCfg.PhyMode != PHY_11A) @@ -122,63 +122,63 @@ void BuildChannelList(IN PRTMP_ADAPTER pAd) case REGION_0_BG_BAND: /* 1 -11 */ NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_0_START], - sizeof(CHANNEL_TX_POWER) * + sizeof(struct rt_channel_tx_power) * BG_BAND_REGION_0_SIZE); index += BG_BAND_REGION_0_SIZE; break; case REGION_1_BG_BAND: /* 1 - 13 */ NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_1_START], - sizeof(CHANNEL_TX_POWER) * + sizeof(struct rt_channel_tx_power) * BG_BAND_REGION_1_SIZE); index += BG_BAND_REGION_1_SIZE; break; case REGION_2_BG_BAND: /* 10 - 11 */ NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_2_START], - sizeof(CHANNEL_TX_POWER) * + sizeof(struct rt_channel_tx_power) * BG_BAND_REGION_2_SIZE); index += BG_BAND_REGION_2_SIZE; break; case REGION_3_BG_BAND: /* 10 - 13 */ NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_3_START], - sizeof(CHANNEL_TX_POWER) * + sizeof(struct rt_channel_tx_power) * BG_BAND_REGION_3_SIZE); index += BG_BAND_REGION_3_SIZE; break; case REGION_4_BG_BAND: /* 14 */ NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_4_START], - sizeof(CHANNEL_TX_POWER) * + sizeof(struct rt_channel_tx_power) * BG_BAND_REGION_4_SIZE); index += BG_BAND_REGION_4_SIZE; break; case REGION_5_BG_BAND: /* 1 - 14 */ NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_5_START], - sizeof(CHANNEL_TX_POWER) * + sizeof(struct rt_channel_tx_power) * BG_BAND_REGION_5_SIZE); index += BG_BAND_REGION_5_SIZE; break; case REGION_6_BG_BAND: /* 3 - 9 */ NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_6_START], - sizeof(CHANNEL_TX_POWER) * + sizeof(struct rt_channel_tx_power) * BG_BAND_REGION_6_SIZE); index += BG_BAND_REGION_6_SIZE; break; case REGION_7_BG_BAND: /* 5 - 13 */ NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_7_START], - sizeof(CHANNEL_TX_POWER) * + sizeof(struct rt_channel_tx_power) * BG_BAND_REGION_7_SIZE); index += BG_BAND_REGION_7_SIZE; break; case REGION_31_BG_BAND: /* 1 - 14 */ NdisMoveMemory(&pAd->ChannelList[index], &pAd->TxPower[BG_BAND_REGION_31_START], - sizeof(CHANNEL_TX_POWER) * + sizeof(struct rt_channel_tx_power) * BG_BAND_REGION_31_SIZE); index += BG_BAND_REGION_31_SIZE; break; @@ -315,7 +315,7 @@ void BuildChannelList(IN PRTMP_ADAPTER pAd) + i], &pAd->TxPower[j], sizeof - (CHANNEL_TX_POWER)); + (struct rt_channel_tx_power)); } for (j = 0; j < 15; j++) { if (pChannelList[i] == RadarCh[j]) @@ -359,7 +359,7 @@ void BuildChannelList(IN PRTMP_ADAPTER pAd) ========================================================================== */ -u8 FirstChannel(IN PRTMP_ADAPTER pAd) +u8 FirstChannel(struct rt_rtmp_adapter *pAd) { return pAd->ChannelList[0].Channel; } @@ -375,7 +375,7 @@ u8 FirstChannel(IN PRTMP_ADAPTER pAd) return 0 if no more next channel ========================================================================== */ -u8 NextChannel(IN PRTMP_ADAPTER pAd, u8 channel) +u8 NextChannel(struct rt_rtmp_adapter *pAd, u8 channel) { int i; u8 next_channel = 0; @@ -408,7 +408,7 @@ u8 NextChannel(IN PRTMP_ADAPTER pAd, u8 channel) the minimum value or next lower value. ========================================================================== */ -void ChangeToCellPowerLimit(IN PRTMP_ADAPTER pAd, +void ChangeToCellPowerLimit(struct rt_rtmp_adapter *pAd, u8 AironetCellPowerLimit) { /*valud 0xFF means that hasn't found power limit information */ @@ -435,7 +435,7 @@ void ChangeToCellPowerLimit(IN PRTMP_ADAPTER pAd, } -char ConvertToRssi(IN PRTMP_ADAPTER pAd, char Rssi, u8 RssiNumber) +char ConvertToRssi(struct rt_rtmp_adapter *pAd, char Rssi, u8 RssiNumber) { u8 RssiOffset, LNAGain; @@ -469,15 +469,15 @@ char ConvertToRssi(IN PRTMP_ADAPTER pAd, char Rssi, u8 RssiNumber) Scan next channel ========================================================================== */ -void ScanNextChannel(IN PRTMP_ADAPTER pAd) +void ScanNextChannel(struct rt_rtmp_adapter *pAd) { - HEADER_802_11 Hdr80211; + struct rt_header_802_11 Hdr80211; u8 *pOutBuffer = NULL; int NStatus; unsigned long FrameLen = 0; u8 SsidLen = 0, ScanType = pAd->MlmeAux.ScanType, BBPValue = 0; u16 Status; - PHEADER_802_11 pHdr80211; + struct rt_header_802_11 * pHdr80211; u32 ScanTimeIn5gChannel = SHORT_CHANNEL_TIME; { @@ -522,7 +522,7 @@ void ScanNextChannel(IN PRTMP_ADAPTER pAd) MlmeAllocateMemory(pAd, (void *)& pOutBuffer); if (NStatus == NDIS_STATUS_SUCCESS) { - pHdr80211 = (PHEADER_802_11) pOutBuffer; + pHdr80211 = (struct rt_header_802_11 *) pOutBuffer; MgtMacHeaderInit(pAd, pHdr80211, SUBTYPE_NULL_FUNC, 1, pAd->CommonCfg.Bssid, @@ -535,7 +535,7 @@ void ScanNextChannel(IN PRTMP_ADAPTER pAd) /* Send using priority queue */ MiniportMMRequest(pAd, 0, pOutBuffer, sizeof - (HEADER_802_11)); + (struct rt_header_802_11)); DBGPRINT(RT_DEBUG_TRACE, ("MlmeScanReqAction -- Send PSM Data frame\n")); MlmeFreeMemory(pAd, pOutBuffer); @@ -642,7 +642,7 @@ void ScanNextChannel(IN PRTMP_ADAPTER pAd) MgtMacHeaderInit(pAd, &Hdr80211, SUBTYPE_PROBE_REQ, 0, BROADCAST_ADDR, BROADCAST_ADDR); MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &Hdr80211, 1, + sizeof(struct rt_header_802_11), &Hdr80211, 1, &SsidIe, 1, &SsidLen, SsidLen, pAd->MlmeAux.Ssid, 1, &SupRateIe, 1, &pAd->CommonCfg.SupRateLen, @@ -700,12 +700,12 @@ void ScanNextChannel(IN PRTMP_ADAPTER pAd) } } -void MgtProbReqMacHeaderInit(IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, +void MgtProbReqMacHeaderInit(struct rt_rtmp_adapter *pAd, + struct rt_header_802_11 * pHdr80211, u8 SubType, u8 ToDs, u8 *pDA, u8 *pBssid) { - NdisZeroMemory(pHdr80211, sizeof(HEADER_802_11)); + NdisZeroMemory(pHdr80211, sizeof(struct rt_header_802_11)); pHdr80211->FC.Type = BTYPE_MGMT; pHdr80211->FC.SubType = SubType; diff --git a/drivers/staging/rt2860/common/cmm_tkip.c b/drivers/staging/rt2860/common/cmm_tkip.c index 0ac9d744a86d..7a2a48eb8e51 100644 --- a/drivers/staging/rt2860/common/cmm_tkip.c +++ b/drivers/staging/rt2860/common/cmm_tkip.c @@ -115,7 +115,7 @@ u32 Tkip_Sbox_Upper[256] = { /* */ /* Expanded IV for TKIP function. */ /* */ -typedef struct PACKED _IV_CONTROL_ { +struct PACKED rt_tkip_iv { union PACKED { struct PACKED { u8 rc0; @@ -136,7 +136,7 @@ typedef struct PACKED _IV_CONTROL_ { } IV16; unsigned long IV32; -} TKIP_IV, *PTKIP_IV; +}; /* ======================================================================== @@ -214,7 +214,7 @@ void RTMPTkipPutUInt32(IN u8 *pDst, unsigned long val) ======================================================================== */ -void RTMPTkipSetMICKey(IN PTKIP_KEY_INFO pTkip, u8 *pMICKey) +void RTMPTkipSetMICKey(struct rt_tkip_key_info *pTkip, u8 *pMICKey) { /* Set the key */ pTkip->K0 = RTMPTkipGetUInt32(pMICKey); @@ -245,7 +245,7 @@ void RTMPTkipSetMICKey(IN PTKIP_KEY_INFO pTkip, u8 *pMICKey) ======================================================================== */ -void RTMPTkipAppendByte(IN PTKIP_KEY_INFO pTkip, u8 uChar) +void RTMPTkipAppendByte(struct rt_tkip_key_info *pTkip, u8 uChar) { /* Append the byte to our word-sized buffer */ pTkip->M |= (uChar << (8 * pTkip->nBytesInM)); @@ -289,7 +289,7 @@ void RTMPTkipAppendByte(IN PTKIP_KEY_INFO pTkip, u8 uChar) ======================================================================== */ -void RTMPTkipAppend(IN PTKIP_KEY_INFO pTkip, u8 *pSrc, u32 nBytes) +void RTMPTkipAppend(struct rt_tkip_key_info *pTkip, u8 *pSrc, u32 nBytes) { /* This is simple */ while (nBytes > 0) { @@ -316,7 +316,7 @@ void RTMPTkipAppend(IN PTKIP_KEY_INFO pTkip, u8 *pSrc, u32 nBytes) the MIC Value is store in pAd->PrivateInfo.MIC ======================================================================== */ -void RTMPTkipGetMIC(IN PTKIP_KEY_INFO pTkip) +void RTMPTkipGetMIC(struct rt_tkip_key_info *pTkip) { /* Append the minimum padding */ RTMPTkipAppendByte(pTkip, 0x5a); @@ -355,17 +355,17 @@ void RTMPTkipGetMIC(IN PTKIP_KEY_INFO pTkip) ======================================================================== */ -void RTMPInitTkipEngine(IN PRTMP_ADAPTER pAd, +void RTMPInitTkipEngine(struct rt_rtmp_adapter *pAd, u8 *pKey, u8 KeyId, u8 *pTA, u8 *pMICKey, u8 *pTSC, unsigned long *pIV16, unsigned long *pIV32) { - TKIP_IV tkipIv; + struct rt_tkip_iv tkipIv; /* Prepare 8 bytes TKIP encapsulation for MPDU */ - NdisZeroMemory(&tkipIv, sizeof(TKIP_IV)); + NdisZeroMemory(&tkipIv, sizeof(struct rt_tkip_iv)); tkipIv.IV16.field.rc0 = *(pTSC + 1); tkipIv.IV16.field.rc1 = (tkipIv.IV16.field.rc0 | 0x20) & 0x7f; tkipIv.IV16.field.rc2 = *pTSC; @@ -399,7 +399,7 @@ void RTMPInitTkipEngine(IN PRTMP_ADAPTER pAd, ======================================================================== */ -void RTMPInitMICEngine(IN PRTMP_ADAPTER pAd, +void RTMPInitMICEngine(struct rt_rtmp_adapter *pAd, u8 *pKey, u8 *pDA, u8 *pSA, u8 UserPriority, u8 *pMICKey) @@ -440,7 +440,7 @@ void RTMPInitMICEngine(IN PRTMP_ADAPTER pAd, ======================================================================== */ -BOOLEAN RTMPTkipCompareMICValue(IN PRTMP_ADAPTER pAd, +BOOLEAN RTMPTkipCompareMICValue(struct rt_rtmp_adapter *pAd, u8 *pSrc, u8 *pDA, u8 *pSA, @@ -500,12 +500,12 @@ BOOLEAN RTMPTkipCompareMICValue(IN PRTMP_ADAPTER pAd, ======================================================================== */ -void RTMPCalculateMICValue(IN PRTMP_ADAPTER pAd, +void RTMPCalculateMICValue(struct rt_rtmp_adapter *pAd, void *pPacket, u8 *pEncap, - IN PCIPHER_KEY pKey, u8 apidx) + struct rt_cipher_key *pKey, u8 apidx) { - PACKET_INFO PacketInfo; + struct rt_packet_info PacketInfo; u8 *pSrcBufVA; u32 SrcBufLen; u8 *pSrc; @@ -698,10 +698,10 @@ void RTMPTkipMixKey(u8 * key, u8 * ta, unsigned long pnl, /* Least significant 1 /* TRUE: Success! */ /* FALSE: Decrypt Error! */ /* */ -BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd, +BOOLEAN RTMPSoftDecryptTKIP(struct rt_rtmp_adapter *pAd, u8 *pData, unsigned long DataByteCnt, - u8 UserPriority, IN PCIPHER_KEY pWpaKey) + u8 UserPriority, struct rt_cipher_key *pWpaKey) { u8 KeyID; u32 HeaderLen; @@ -726,7 +726,7 @@ BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd, unsigned long pnh; /* Most significant 32 bits of PN */ u32 num_blocks; u32 payload_remainder; - ARCFOURCONTEXT ArcFourContext; + struct rt_arcfourcontext ArcFourContext; u32 crc32 = 0; u32 trailfcs = 0; u8 MIC[8]; diff --git a/drivers/staging/rt2860/common/cmm_wep.c b/drivers/staging/rt2860/common/cmm_wep.c index 05a921410caa..c72835504ecb 100644 --- a/drivers/staging/rt2860/common/cmm_wep.c +++ b/drivers/staging/rt2860/common/cmm_wep.c @@ -135,7 +135,7 @@ u8 WEPKEY[] = { ======================================================================== */ -void RTMPInitWepEngine(IN PRTMP_ADAPTER pAd, +void RTMPInitWepEngine(struct rt_rtmp_adapter *pAd, u8 *pKey, u8 KeyId, u8 KeyLen, IN u8 *pDest) { @@ -184,7 +184,7 @@ void RTMPInitWepEngine(IN PRTMP_ADAPTER pAd, ======================================================================== */ -void RTMPEncryptData(IN PRTMP_ADAPTER pAd, +void RTMPEncryptData(struct rt_rtmp_adapter *pAd, u8 *pSrc, u8 *pDest, u32 Len) { pAd->PrivateInfo.FCSCRC32 = @@ -211,9 +211,9 @@ void RTMPEncryptData(IN PRTMP_ADAPTER pAd, ======================================================================== */ -BOOLEAN RTMPSoftDecryptWEP(IN PRTMP_ADAPTER pAd, +BOOLEAN RTMPSoftDecryptWEP(struct rt_rtmp_adapter *pAd, u8 *pData, - unsigned long DataByteCnt, IN PCIPHER_KEY pGroupKey) + unsigned long DataByteCnt, struct rt_cipher_key *pGroupKey) { u32 trailfcs; u32 crc32; @@ -255,10 +255,10 @@ BOOLEAN RTMPSoftDecryptWEP(IN PRTMP_ADAPTER pAd, ======================================================================== Routine Description: - The Stream Cipher Encryption Algorithm "ARCFOUR" initialize + The Stream Cipher Encryption Algorithm "struct rt_arcfour" initialize Arguments: - Ctx Pointer to ARCFOUR CONTEXT (SBOX) + Ctx Pointer to struct rt_arcfour CONTEXT (SBOX) pKey Pointer to the WEP KEY KeyLen Indicate the length fo the WEP KEY @@ -271,7 +271,7 @@ BOOLEAN RTMPSoftDecryptWEP(IN PRTMP_ADAPTER pAd, ======================================================================== */ -void ARCFOUR_INIT(IN PARCFOURCONTEXT Ctx, u8 *pKey, u32 KeyLen) +void ARCFOUR_INIT(struct rt_arcfourcontext *Ctx, u8 *pKey, u32 KeyLen) { u8 t, u; u32 keyindex; @@ -301,19 +301,19 @@ void ARCFOUR_INIT(IN PARCFOURCONTEXT Ctx, u8 *pKey, u32 KeyLen) ======================================================================== Routine Description: - Get bytes from ARCFOUR CONTEXT (S-BOX) + Get bytes from struct rt_arcfour CONTEXT (S-BOX) Arguments: - Ctx Pointer to ARCFOUR CONTEXT (SBOX) + Ctx Pointer to struct rt_arcfour CONTEXT (SBOX) Return Value: - u8 - the value of the ARCFOUR CONTEXT (S-BOX) + u8 - the value of the struct rt_arcfour CONTEXT (S-BOX) Note: ======================================================================== */ -u8 ARCFOUR_BYTE(IN PARCFOURCONTEXT Ctx) +u8 ARCFOUR_BYTE(struct rt_arcfourcontext *Ctx) { u32 x; u32 y; @@ -341,7 +341,7 @@ u8 ARCFOUR_BYTE(IN PARCFOURCONTEXT Ctx) The Stream Cipher Decryption Algorithm Arguments: - Ctx Pointer to ARCFOUR CONTEXT (SBOX) + Ctx Pointer to struct rt_arcfour CONTEXT (SBOX) pDest Pointer to the Destination pSrc Pointer to the Source data Len Indicate the length of the Source data @@ -353,7 +353,7 @@ u8 ARCFOUR_BYTE(IN PARCFOURCONTEXT Ctx) ======================================================================== */ -void ARCFOUR_DECRYPT(IN PARCFOURCONTEXT Ctx, +void ARCFOUR_DECRYPT(struct rt_arcfourcontext *Ctx, u8 *pDest, u8 *pSrc, u32 Len) { u32 i; @@ -369,7 +369,7 @@ void ARCFOUR_DECRYPT(IN PARCFOURCONTEXT Ctx, The Stream Cipher Encryption Algorithm Arguments: - Ctx Pointer to ARCFOUR CONTEXT (SBOX) + Ctx Pointer to struct rt_arcfour CONTEXT (SBOX) pDest Pointer to the Destination pSrc Pointer to the Source data Len Indicate the length of the Source dta @@ -383,7 +383,7 @@ void ARCFOUR_DECRYPT(IN PARCFOURCONTEXT Ctx, ======================================================================== */ -void ARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, +void ARCFOUR_ENCRYPT(struct rt_arcfourcontext *Ctx, u8 *pDest, u8 *pSrc, u32 Len) { u32 i; @@ -399,7 +399,7 @@ void ARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, The Stream Cipher Encryption Algorithm which conform to the special requirement to encrypt GTK. Arguments: - Ctx Pointer to ARCFOUR CONTEXT (SBOX) + Ctx Pointer to struct rt_arcfour CONTEXT (SBOX) pDest Pointer to the Destination pSrc Pointer to the Source data Len Indicate the length of the Source dta @@ -407,7 +407,7 @@ void ARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, ======================================================================== */ -void WPAARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, +void WPAARCFOUR_ENCRYPT(struct rt_arcfourcontext *Ctx, u8 *pDest, u8 *pSrc, u32 Len) { u32 i; @@ -463,7 +463,7 @@ u32 RTMP_CALC_FCS32(u32 Fcs, u8 *Cp, int Len) ======================================================================== */ -void RTMPSetICV(IN PRTMP_ADAPTER pAd, u8 *pDest) +void RTMPSetICV(struct rt_rtmp_adapter *pAd, u8 *pDest) { pAd->PrivateInfo.FCSCRC32 ^= 0xffffffff; /* complement */ pAd->PrivateInfo.FCSCRC32 = cpu2le32(pAd->PrivateInfo.FCSCRC32); diff --git a/drivers/staging/rt2860/common/cmm_wpa.c b/drivers/staging/rt2860/common/cmm_wpa.c index 6daccd94e1e1..7b51be0e8dd3 100644 --- a/drivers/staging/rt2860/common/cmm_wpa.c +++ b/drivers/staging/rt2860/common/cmm_wpa.c @@ -54,30 +54,30 @@ u8 OUI_WPA2_8021X_AKM[4] = { 0x00, 0x0F, 0xAC, 0x01 }; u8 OUI_WPA2_PSK_AKM[4] = { 0x00, 0x0F, 0xAC, 0x02 }; u8 OUI_WPA2_WEP104[4] = { 0x00, 0x0F, 0xAC, 0x05 }; -static void ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, +static void ConstructEapolKeyData(struct rt_mac_table_entry *pEntry, u8 GroupKeyWepStatus, u8 keyDescVer, u8 MsgType, u8 DefaultKeyIdx, u8 * GTK, u8 * RSNIE, - u8 RSNIE_LEN, OUT PEAPOL_PACKET pMsg); + u8 RSNIE_LEN, struct rt_eapol_packet * pMsg); static void CalculateMIC(u8 KeyDescVer, - u8 * PTK, OUT PEAPOL_PACKET pMsg); + u8 * PTK, struct rt_eapol_packet * pMsg); -static void WpaEAPPacketAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +static void WpaEAPPacketAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -static void WpaEAPOLASFAlertAction(IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM * Elem); +static void WpaEAPOLASFAlertAction(struct rt_rtmp_adapter *pAd, + struct rt_mlme_queue_elem *Elem); -static void WpaEAPOLLogoffAction(IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM * Elem); +static void WpaEAPOLLogoffAction(struct rt_rtmp_adapter *pAd, + struct rt_mlme_queue_elem *Elem); -static void WpaEAPOLStartAction(IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM * Elem); +static void WpaEAPOLStartAction(struct rt_rtmp_adapter *pAd, + struct rt_mlme_queue_elem *Elem); -static void WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +static void WpaEAPOLKeyAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); /* ========================================================================== @@ -87,8 +87,8 @@ static void WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); S - pointer to the association state machine ========================================================================== */ -void WpaStateMachineInit(IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE * S, OUT STATE_MACHINE_FUNC Trans[]) +void WpaStateMachineInit(struct rt_rtmp_adapter *pAd, + struct rt_state_machine *S, OUT STATE_MACHINE_FUNC Trans[]) { StateMachineInit(S, (STATE_MACHINE_FUNC *) Trans, MAX_WPA_PTK_STATE, MAX_WPA_MSG, (STATE_MACHINE_FUNC) Drop, WPA_PTK, @@ -115,15 +115,15 @@ void WpaStateMachineInit(IN PRTMP_ADAPTER pAd, Return: ========================================================================== */ -void WpaEAPPacketAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void WpaEAPPacketAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { } -void WpaEAPOLASFAlertAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void WpaEAPOLASFAlertAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { } -void WpaEAPOLLogoffAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void WpaEAPOLLogoffAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { } @@ -134,14 +134,14 @@ void WpaEAPOLLogoffAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Return: ========================================================================== */ -void WpaEAPOLStartAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void WpaEAPOLStartAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { - MAC_TABLE_ENTRY *pEntry; - PHEADER_802_11 pHeader; + struct rt_mac_table_entry *pEntry; + struct rt_header_802_11 * pHeader; DBGPRINT(RT_DEBUG_TRACE, ("WpaEAPOLStartAction ===> \n")); - pHeader = (PHEADER_802_11) Elem->Msg; + pHeader = (struct rt_header_802_11 *) Elem->Msg; /*For normaol PSK, we enqueue an EAPOL-Start command to trigger the process. */ if (Elem->MsgLen == 6) @@ -187,23 +187,23 @@ void WpaEAPOLStartAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Return: ========================================================================== */ -void WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void WpaEAPOLKeyAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { - MAC_TABLE_ENTRY *pEntry; - PHEADER_802_11 pHeader; - PEAPOL_PACKET pEapol_packet; - KEY_INFO peerKeyInfo; + struct rt_mac_table_entry *pEntry; + struct rt_header_802_11 * pHeader; + struct rt_eapol_packet * pEapol_packet; + struct rt_key_info peerKeyInfo; DBGPRINT(RT_DEBUG_TRACE, ("WpaEAPOLKeyAction ===>\n")); - pHeader = (PHEADER_802_11) Elem->Msg; + pHeader = (struct rt_header_802_11 *) Elem->Msg; pEapol_packet = - (PEAPOL_PACKET) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; + (struct rt_eapol_packet *) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; NdisZeroMemory((u8 *)& peerKeyInfo, sizeof(peerKeyInfo)); NdisMoveMemory((u8 *)& peerKeyInfo, (u8 *)& pEapol_packet->KeyDesc.KeyInfo, - sizeof(KEY_INFO)); + sizeof(struct rt_key_info)); hex_dump("Received Eapol frame", (unsigned char *)pEapol_packet, (Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H)); @@ -357,8 +357,8 @@ void WpaEAPOLKeyAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ======================================================================== */ -void RTMPToWirelessSta(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, +void RTMPToWirelessSta(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, u8 *pHeader802_3, u32 HdrLen, u8 *pData, u32 DataLen, IN BOOLEAN bClearFrame) @@ -433,11 +433,11 @@ void RTMPToWirelessSta(IN PRTMP_ADAPTER pAd, ========================================================================== */ -void WPAStart4WayHS(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, unsigned long TimeInterval) +void WPAStart4WayHS(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, unsigned long TimeInterval) { u8 Header802_3[14]; - EAPOL_PACKET EAPOLPKT; + struct rt_eapol_packet EAPOLPKT; u8 *pBssid = NULL; u8 group_cipher = Ndis802_11WEPDisabled; @@ -472,7 +472,7 @@ void WPAStart4WayHS(IN PRTMP_ADAPTER pAd, /* Construct EAPoL message - Pairwise Msg 1 */ /* EAPOL-Key(0,0,1,0,P,0,0,ANonce,0,DataKD_M1) */ - NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); + NdisZeroMemory(&EAPOLPKT, sizeof(struct rt_eapol_packet)); ConstructEapolMsg(pEntry, group_cipher, EAPOL_PAIR_MSG_1, 0, /* Default key index */ pEntry->ANonce, NULL, /* TxRSC */ NULL, /* GTK */ @@ -516,14 +516,14 @@ void WPAStart4WayHS(IN PRTMP_ADAPTER pAd, ======================================================================== */ -void PeerPairMsg1Action(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem) +void PeerPairMsg1Action(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem) { u8 PTK[80]; u8 Header802_3[14]; - PEAPOL_PACKET pMsg1; + struct rt_eapol_packet * pMsg1; u32 MsgLen; - EAPOL_PACKET EAPOLPKT; + struct rt_eapol_packet EAPOLPKT; u8 *pCurrentAddr = NULL; u8 *pmk_ptr = NULL; u8 group_cipher = Ndis802_11WEPDisabled; @@ -537,7 +537,7 @@ void PeerPairMsg1Action(IN PRTMP_ADAPTER pAd, if (Elem->MsgLen < (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + - sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) + sizeof(struct rt_key_descripter) - MAX_LEN_OF_RSNIE - 2)) return; { @@ -549,7 +549,7 @@ void PeerPairMsg1Action(IN PRTMP_ADAPTER pAd, } /* Store the received frame */ - pMsg1 = (PEAPOL_PACKET) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; + pMsg1 = (struct rt_eapol_packet *) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; /* Sanity Check peer Pairwise message 1 - Replay Counter */ @@ -585,7 +585,7 @@ void PeerPairMsg1Action(IN PRTMP_ADAPTER pAd, /* Construct EAPoL message - Pairwise Msg 2 */ /* EAPOL-Key(0,1,0,0,P,0,0,SNonce,MIC,DataKD_M2) */ - NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); + NdisZeroMemory(&EAPOLPKT, sizeof(struct rt_eapol_packet)); ConstructEapolMsg(pEntry, group_cipher, EAPOL_PAIR_MSG_2, 0, /* DefaultKeyIdx */ pEntry->SNonce, NULL, /* TxRsc */ NULL, /* GTK */ @@ -609,14 +609,14 @@ void PeerPairMsg1Action(IN PRTMP_ADAPTER pAd, Return: ========================================================================== */ -void PeerPairMsg2Action(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem) +void PeerPairMsg2Action(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem) { u8 PTK[80]; BOOLEAN Cancelled; - PHEADER_802_11 pHeader; - EAPOL_PACKET EAPOLPKT; - PEAPOL_PACKET pMsg2; + struct rt_header_802_11 * pHeader; + struct rt_eapol_packet EAPOLPKT; + struct rt_eapol_packet * pMsg2; u32 MsgLen; u8 Header802_3[LENGTH_802_3]; u8 TxTsc[6]; @@ -635,7 +635,7 @@ void PeerPairMsg2Action(IN PRTMP_ADAPTER pAd, if (Elem->MsgLen < (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + - sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) + sizeof(struct rt_key_descripter) - MAX_LEN_OF_RSNIE - 2)) return; /* check Entry in valid State */ @@ -643,10 +643,10 @@ void PeerPairMsg2Action(IN PRTMP_ADAPTER pAd, return; /* pointer to 802.11 header */ - pHeader = (PHEADER_802_11) Elem->Msg; + pHeader = (struct rt_header_802_11 *) Elem->Msg; /* skip 802.11_header(24-byte) and LLC_header(8) */ - pMsg2 = (PEAPOL_PACKET) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; + pMsg2 = (struct rt_eapol_packet *) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; /* Store SNonce */ @@ -678,7 +678,7 @@ void PeerPairMsg2Action(IN PRTMP_ADAPTER pAd, ADD_ONE_To_64BIT_VAR(pEntry->R_Counter); /* Construct EAPoL message - Pairwise Msg 3 */ - NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); + NdisZeroMemory(&EAPOLPKT, sizeof(struct rt_eapol_packet)); ConstructEapolMsg(pEntry, group_cipher, EAPOL_PAIR_MSG_3, @@ -724,13 +724,13 @@ void PeerPairMsg2Action(IN PRTMP_ADAPTER pAd, ======================================================================== */ -void PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem) +void PeerPairMsg3Action(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem) { - PHEADER_802_11 pHeader; + struct rt_header_802_11 * pHeader; u8 Header802_3[14]; - EAPOL_PACKET EAPOLPKT; - PEAPOL_PACKET pMsg3; + struct rt_eapol_packet EAPOLPKT; + struct rt_eapol_packet * pMsg3; u32 MsgLen; u8 *pCurrentAddr = NULL; u8 group_cipher = Ndis802_11WEPDisabled; @@ -742,7 +742,7 @@ void PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, if (Elem->MsgLen < (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + - sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) + sizeof(struct rt_key_descripter) - MAX_LEN_OF_RSNIE - 2)) return; { @@ -752,8 +752,8 @@ void PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, } /* Record 802.11 header & the received EAPOL packet Msg3 */ - pHeader = (PHEADER_802_11) Elem->Msg; - pMsg3 = (PEAPOL_PACKET) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; + pHeader = (struct rt_header_802_11 *) Elem->Msg; + pMsg3 = (struct rt_eapol_packet *) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; /* Sanity Check peer Pairwise message 3 - Replay Counter, MIC, RSNIE */ @@ -771,7 +771,7 @@ void PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, return; } /* Construct EAPoL message - Pairwise Msg 4 */ - NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); + NdisZeroMemory(&EAPOLPKT, sizeof(struct rt_eapol_packet)); ConstructEapolMsg(pEntry, group_cipher, EAPOL_PAIR_MSG_4, 0, /* group key index not used in message 4 */ NULL, /* Nonce not used in message 4 */ NULL, /* TxRSC not used in message 4 */ @@ -784,14 +784,14 @@ void PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, /* Update pairwise key */ { - PCIPHER_KEY pSharedKey; + struct rt_cipher_key *pSharedKey; pSharedKey = &pAd->SharedKey[BSS0][0]; NdisMoveMemory(pAd->StaCfg.PTK, pEntry->PTK, LEN_PTK); /* Prepare pair-wise key information into shared key table */ - NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); + NdisZeroMemory(pSharedKey, sizeof(struct rt_cipher_key)); pSharedKey->KeyLen = LEN_TKIP_EK; NdisMoveMemory(pSharedKey->Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); @@ -809,7 +809,7 @@ void PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, else pSharedKey->CipherAlg = CIPHER_NONE; - /* Update these related information to MAC_TABLE_ENTRY */ + /* Update these related information to struct rt_mac_table_entry */ pEntry = &pAd->MacTab.Content[BSSID_WCID]; NdisMoveMemory(pEntry->PairwiseKey.Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); @@ -871,11 +871,11 @@ void PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, Return: ========================================================================== */ -void PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem) +void PeerPairMsg4Action(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem) { - PEAPOL_PACKET pMsg4; - PHEADER_802_11 pHeader; + struct rt_eapol_packet * pMsg4; + struct rt_header_802_11 * pHeader; u32 MsgLen; BOOLEAN Cancelled; u8 group_cipher = Ndis802_11WEPDisabled; @@ -888,18 +888,18 @@ void PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, if (Elem->MsgLen < (LENGTH_802_11 + LENGTH_802_1_H + LENGTH_EAPOL_H + - sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE - 2)) + sizeof(struct rt_key_descripter) - MAX_LEN_OF_RSNIE - 2)) break; if (pEntry->WpaState < AS_PTKINIT_NEGOTIATING) break; /* pointer to 802.11 header */ - pHeader = (PHEADER_802_11) Elem->Msg; + pHeader = (struct rt_header_802_11 *) Elem->Msg; /* skip 802.11_header(24-byte) and LLC_header(8) */ pMsg4 = - (PEAPOL_PACKET) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; + (struct rt_eapol_packet *) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; /* Sanity Check peer Pairwise message 4 - Replay Counter, MIC */ @@ -908,7 +908,7 @@ void PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, break; /* 3. uses the MLME.SETKEYS.request to configure PTK into MAC */ - NdisZeroMemory(&pEntry->PairwiseKey, sizeof(CIPHER_KEY)); + NdisZeroMemory(&pEntry->PairwiseKey, sizeof(struct rt_cipher_key)); /* reset IVEIV in Asic */ AsicUpdateWCIDIVEIV(pAd, pEntry->Aid, 1, 0); @@ -990,11 +990,11 @@ void PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, ========================================================================== */ -void WPAStart2WayGroupHS(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) +void WPAStart2WayGroupHS(struct rt_rtmp_adapter *pAd, struct rt_mac_table_entry *pEntry) { u8 Header802_3[14]; u8 TxTsc[6]; - EAPOL_PACKET EAPOLPKT; + struct rt_eapol_packet EAPOLPKT; u8 group_cipher = Ndis802_11WEPDisabled; u8 default_key = 0; u8 *gnonce_ptr = NULL; @@ -1011,7 +1011,7 @@ void WPAStart2WayGroupHS(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) ADD_ONE_To_64BIT_VAR(pEntry->R_Counter); /* Construct EAPoL message - Group Msg 1 */ - NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); + NdisZeroMemory(&EAPOLPKT, sizeof(struct rt_eapol_packet)); ConstructEapolMsg(pEntry, group_cipher, EAPOL_GROUP_MSG_1, @@ -1052,12 +1052,12 @@ void WPAStart2WayGroupHS(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) ======================================================================== */ -void PeerGroupMsg1Action(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem) +void PeerGroupMsg1Action(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem) { u8 Header802_3[14]; - EAPOL_PACKET EAPOLPKT; - PEAPOL_PACKET pGroup; + struct rt_eapol_packet EAPOLPKT; + struct rt_eapol_packet * pGroup; u32 MsgLen; BOOLEAN Cancelled; u8 default_key = 0; @@ -1076,7 +1076,7 @@ void PeerGroupMsg1Action(IN PRTMP_ADAPTER pAd, } /* Process Group Message 1 frame. skip 802.11 header(24) & LLC_SNAP header(8) */ - pGroup = (PEAPOL_PACKET) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; + pGroup = (struct rt_eapol_packet *) & Elem->Msg[LENGTH_802_11 + LENGTH_802_1_H]; MsgLen = Elem->MsgLen - LENGTH_802_11 - LENGTH_802_1_H; /* Sanity Check peer group message 1 - Replay Counter, MIC, RSNIE */ @@ -1092,7 +1092,7 @@ void PeerGroupMsg1Action(IN PRTMP_ADAPTER pAd, LEN_KEY_DESC_REPLAY); /* Construct EAPoL message - Group Msg 2 */ - NdisZeroMemory(&EAPOLPKT, sizeof(EAPOL_PACKET)); + NdisZeroMemory(&EAPOLPKT, sizeof(struct rt_eapol_packet)); ConstructEapolMsg(pEntry, group_cipher, EAPOL_GROUP_MSG_2, default_key, NULL, /* Nonce not used */ NULL, /* TxRSC not used */ NULL, /* GTK not used */ @@ -1131,14 +1131,14 @@ void PeerGroupMsg1Action(IN PRTMP_ADAPTER pAd, Return: ========================================================================== */ -void PeerGroupMsg2Action(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, +void PeerGroupMsg2Action(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, void * Msg, u32 MsgLen) { u32 Len; u8 *pData; BOOLEAN Cancelled; - PEAPOL_PACKET pMsg2; + struct rt_eapol_packet * pMsg2; u8 group_cipher = Ndis802_11WEPDisabled; DBGPRINT(RT_DEBUG_TRACE, ("===> PeerGroupMsg2Action \n")); @@ -1148,7 +1148,7 @@ void PeerGroupMsg2Action(IN PRTMP_ADAPTER pAd, break; if (MsgLen < - (LENGTH_802_1_H + LENGTH_EAPOL_H + sizeof(KEY_DESCRIPTER) - + (LENGTH_802_1_H + LENGTH_EAPOL_H + sizeof(struct rt_key_descripter) - MAX_LEN_OF_RSNIE - 2)) break; @@ -1156,7 +1156,7 @@ void PeerGroupMsg2Action(IN PRTMP_ADAPTER pAd, break; pData = (u8 *)Msg; - pMsg2 = (PEAPOL_PACKET) (pData + LENGTH_802_1_H); + pMsg2 = (struct rt_eapol_packet *) (pData + LENGTH_802_1_H); Len = MsgLen - LENGTH_802_1_H; /* Sanity Check peer group message 2 - Replay Counter, MIC */ @@ -1399,7 +1399,7 @@ int PasswordHash(char *password, u8 *ssid, int ssidlength, u8 *output) ======================================================================== */ -void WpaDerivePTK(IN PRTMP_ADAPTER pAd, +void WpaDerivePTK(struct rt_rtmp_adapter *pAd, u8 * PMK, u8 * ANonce, u8 * AA, @@ -1478,7 +1478,7 @@ void WpaDerivePTK(IN PRTMP_ADAPTER pAd, ======================================================================== */ -void GenRandom(IN PRTMP_ADAPTER pAd, u8 * macAddr, u8 * random) +void GenRandom(struct rt_rtmp_adapter *pAd, u8 * macAddr, u8 * random) { int i, curr; u8 local[80], KeyCounter[32]; @@ -1537,7 +1537,7 @@ void GenRandom(IN PRTMP_ADAPTER pAd, u8 * macAddr, u8 * random) ======================================================================== */ -static void RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, +static void RTMPMakeRsnIeCipher(struct rt_rtmp_adapter *pAd, u8 ElementID, u32 WepStatus, IN BOOLEAN bMixCipher, @@ -1550,7 +1550,7 @@ static void RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, /* decide WPA2 or WPA1 */ if (ElementID == Wpa2Ie) { - RSNIE2 *pRsnie_cipher = (RSNIE2 *) pRsnIe; + struct rt_rsnie2 *pRsnie_cipher = (struct rt_rsnie2 *)pRsnIe; /* Assign the verson as 1 */ pRsnie_cipher->version = 1; @@ -1562,7 +1562,7 @@ static void RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, pRsnie_cipher->ucount = 1; NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_TKIP, 4); - *rsn_len = sizeof(RSNIE2); + *rsn_len = sizeof(struct rt_rsnie2); break; /* AES mode */ @@ -1576,7 +1576,7 @@ static void RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, pRsnie_cipher->ucount = 1; NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA2_CCMP, 4); - *rsn_len = sizeof(RSNIE2); + *rsn_len = sizeof(struct rt_rsnie2); break; /* TKIP-AES mix mode */ @@ -1602,7 +1602,7 @@ static void RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, } pRsnie_cipher->ucount = PairwiseCnt; - *rsn_len = sizeof(RSNIE2) + (4 * (PairwiseCnt - 1)); + *rsn_len = sizeof(struct rt_rsnie2) + (4 * (PairwiseCnt - 1)); break; } @@ -1625,7 +1625,7 @@ static void RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, pRsnie_cipher->version = cpu2le16(pRsnie_cipher->version); pRsnie_cipher->ucount = cpu2le16(pRsnie_cipher->ucount); } else { - RSNIE *pRsnie_cipher = (RSNIE *) pRsnIe; + struct rt_rsnie *pRsnie_cipher = (struct rt_rsnie *)pRsnIe; /* Assign OUI and version */ NdisMoveMemory(pRsnie_cipher->oui, OUI_WPA_VERSION, 4); @@ -1638,7 +1638,7 @@ static void RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, pRsnie_cipher->ucount = 1; NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_TKIP, 4); - *rsn_len = sizeof(RSNIE); + *rsn_len = sizeof(struct rt_rsnie); break; /* AES mode */ @@ -1652,7 +1652,7 @@ static void RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, pRsnie_cipher->ucount = 1; NdisMoveMemory(pRsnie_cipher->ucast[0].oui, OUI_WPA_CCMP, 4); - *rsn_len = sizeof(RSNIE); + *rsn_len = sizeof(struct rt_rsnie); break; /* TKIP-AES mix mode */ @@ -1678,7 +1678,7 @@ static void RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, } pRsnie_cipher->ucount = PairwiseCnt; - *rsn_len = sizeof(RSNIE) + (4 * (PairwiseCnt - 1)); + *rsn_len = sizeof(struct rt_rsnie) + (4 * (PairwiseCnt - 1)); break; } @@ -1722,16 +1722,16 @@ static void RTMPMakeRsnIeCipher(IN PRTMP_ADAPTER pAd, ======================================================================== */ -static void RTMPMakeRsnIeAKM(IN PRTMP_ADAPTER pAd, +static void RTMPMakeRsnIeAKM(struct rt_rtmp_adapter *pAd, u8 ElementID, u32 AuthMode, u8 apidx, u8 *pRsnIe, u8 * rsn_len) { - RSNIE_AUTH *pRsnie_auth; + struct rt_rsnie_auth *pRsnie_auth; u8 AkmCnt = 1; /* default as 1 */ - pRsnie_auth = (RSNIE_AUTH *) (pRsnIe + (*rsn_len)); + pRsnie_auth = (struct rt_rsnie_auth *) (pRsnIe + (*rsn_len)); /* decide WPA2 or WPA1 */ if (ElementID == Wpa2Ie) { @@ -1781,7 +1781,7 @@ static void RTMPMakeRsnIeAKM(IN PRTMP_ADAPTER pAd, pRsnie_auth->acount = cpu2le16(pRsnie_auth->acount); /* update current RSNIE length */ - (*rsn_len) += (sizeof(RSNIE_AUTH) + (4 * (AkmCnt - 1))); + (*rsn_len) += (sizeof(struct rt_rsnie_auth) + (4 * (AkmCnt - 1))); } @@ -1803,7 +1803,7 @@ static void RTMPMakeRsnIeAKM(IN PRTMP_ADAPTER pAd, ======================================================================== */ -static void RTMPMakeRsnIeCap(IN PRTMP_ADAPTER pAd, +static void RTMPMakeRsnIeCap(struct rt_rtmp_adapter *pAd, u8 ElementID, u8 apidx, u8 *pRsnIe, u8 * rsn_len) @@ -1840,7 +1840,7 @@ static void RTMPMakeRsnIeCap(IN PRTMP_ADAPTER pAd, ======================================================================== */ -void RTMPMakeRSNIE(IN PRTMP_ADAPTER pAd, +void RTMPMakeRSNIE(struct rt_rtmp_adapter *pAd, u32 AuthMode, u32 WepStatus, u8 apidx) { u8 *pRsnIe = NULL; /* primary RSNIE */ @@ -1932,8 +1932,8 @@ void RTMPMakeRSNIE(IN PRTMP_ADAPTER pAd, FALSE - otherwise ========================================================================== */ -BOOLEAN RTMPCheckWPAframe(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, +BOOLEAN RTMPCheckWPAframe(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, u8 *pData, unsigned long DataByteCount, u8 FromWhichBSSID) { @@ -2044,22 +2044,22 @@ char *GetEapolMsgType(char msg) ======================================================================== */ -BOOLEAN RTMPCheckRSNIE(IN PRTMP_ADAPTER pAd, +BOOLEAN RTMPCheckRSNIE(struct rt_rtmp_adapter *pAd, u8 *pData, u8 DataLen, - IN MAC_TABLE_ENTRY * pEntry, u8 * Offset) + struct rt_mac_table_entry *pEntry, u8 * Offset) { u8 *pVIE; u8 len; - PEID_STRUCT pEid; + struct rt_eid * pEid; BOOLEAN result = FALSE; pVIE = pData; len = DataLen; *Offset = 0; - while (len > sizeof(RSNIE2)) { - pEid = (PEID_STRUCT) pVIE; + while (len > sizeof(struct rt_rsnie2)) { + pEid = (struct rt_eid *) pVIE; /* WPA RSN IE */ if ((pEid->Eid == IE_WPA) && (NdisEqualMemory(pEid->Octet, WPA_OUI, 4))) { @@ -2118,14 +2118,14 @@ BOOLEAN RTMPCheckRSNIE(IN PRTMP_ADAPTER pAd, ======================================================================== */ -BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, +BOOLEAN RTMPParseEapolKeyData(struct rt_rtmp_adapter *pAd, u8 *pKeyData, u8 KeyDataLen, u8 GroupKeyIndex, u8 MsgType, - IN BOOLEAN bWPA2, IN MAC_TABLE_ENTRY * pEntry) + IN BOOLEAN bWPA2, struct rt_mac_table_entry *pEntry) { - PKDE_ENCAP pKDE = NULL; + struct rt_kde_encap * pKDE = NULL; u8 *pMyKeyData = pKeyData; u8 KeyDataLength = KeyDataLen; u8 GTKLEN = 0; @@ -2177,7 +2177,7 @@ BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, && (MsgType == EAPOL_PAIR_MSG_3 || MsgType == EAPOL_GROUP_MSG_1)) { if (KeyDataLength >= 8) /* KDE format exclude GTK length */ { - pKDE = (PKDE_ENCAP) pMyKeyData; + pKDE = (struct rt_kde_encap *) pMyKeyData; DefaultIdx = pKDE->GTKEncap.Kid; @@ -2224,7 +2224,7 @@ BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, } { - PCIPHER_KEY pSharedKey; + struct rt_cipher_key *pSharedKey; /* set key material, TxMic and RxMic */ NdisMoveMemory(pAd->StaCfg.GTK, pMyKeyData, 32); @@ -2233,7 +2233,7 @@ BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, pSharedKey = &pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId]; /* Prepare pair-wise key information into shared key table */ - NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); + NdisZeroMemory(pSharedKey, sizeof(struct rt_cipher_key)); pSharedKey->KeyLen = LEN_TKIP_EK; NdisMoveMemory(pSharedKey->Key, pAd->StaCfg.GTK, LEN_TKIP_EK); NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.GTK[16], @@ -2320,7 +2320,7 @@ BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, ======================================================================== */ -void ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, +void ConstructEapolMsg(struct rt_mac_table_entry *pEntry, u8 GroupKeyWepStatus, u8 MsgType, u8 DefaultKeyIdx, @@ -2328,7 +2328,7 @@ void ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, u8 * TxRSC, u8 * GTK, u8 * RSNIE, - u8 RSNIE_Len, OUT PEAPOL_PACKET pMsg) + u8 RSNIE_Len, struct rt_eapol_packet * pMsg) { BOOLEAN bWPA2 = FALSE; u8 KeyDescVer; @@ -2483,20 +2483,20 @@ void ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, ======================================================================== */ -void ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, +void ConstructEapolKeyData(struct rt_mac_table_entry *pEntry, u8 GroupKeyWepStatus, u8 keyDescVer, u8 MsgType, u8 DefaultKeyIdx, u8 * GTK, u8 * RSNIE, - u8 RSNIE_LEN, OUT PEAPOL_PACKET pMsg) + u8 RSNIE_LEN, struct rt_eapol_packet * pMsg) { u8 *mpool, *Key_Data, *Rc4GTK; u8 ekey[(LEN_KEY_DESC_IV + LEN_EAP_EK)]; unsigned long data_offset; BOOLEAN bWPA2Capable = FALSE; - PRTMP_ADAPTER pAd = pEntry->pAd; + struct rt_rtmp_adapter *pAd = pEntry->pAd; BOOLEAN GTK_Included = FALSE; /* Choose WPA2 or not */ @@ -2661,7 +2661,7 @@ void ConstructEapolKeyData(IN PMAC_TABLE_ENTRY pEntry, ======================================================================== */ static void CalculateMIC(u8 KeyDescVer, - u8 * PTK, OUT PEAPOL_PACKET pMsg) + u8 * PTK, struct rt_eapol_packet * pMsg) { u8 *OutBuffer; unsigned long FrameLen = 0; @@ -2714,12 +2714,12 @@ static void CalculateMIC(u8 KeyDescVer, ======================================================================== */ -int RTMPSoftDecryptBroadCastData(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, +int RTMPSoftDecryptBroadCastData(struct rt_rtmp_adapter *pAd, + struct rt_rx_blk *pRxBlk, IN NDIS_802_11_ENCRYPTION_STATUS - GroupCipher, IN PCIPHER_KEY pShard_key) + GroupCipher, struct rt_cipher_key *pShard_key) { - PRXWI_STRUC pRxWI = pRxBlk->pRxWI; + struct rt_rxwi * pRxWI = pRxBlk->pRxWI; /* handle WEP decryption */ if (GroupCipher == Ndis802_11Encryption1Enabled) { @@ -2777,15 +2777,15 @@ int RTMPSoftDecryptBroadCastData(IN PRTMP_ADAPTER pAd, u8 *GetSuiteFromRSNIE(u8 *rsnie, u32 rsnie_len, u8 type, u8 * count) { - PEID_STRUCT pEid; + struct rt_eid * pEid; int len; u8 *pBuf; int offset = 0; - PRSNIE_AUTH pAkm; + struct rt_rsnie_auth *pAkm; u16 acount; BOOLEAN isWPA2 = FALSE; - pEid = (PEID_STRUCT) rsnie; + pEid = (struct rt_eid *) rsnie; len = rsnie_len - 2; /* exclude IE and length */ pBuf = (u8 *)& pEid->Octet[0]; @@ -2799,10 +2799,10 @@ u8 *GetSuiteFromRSNIE(u8 *rsnie, } /* Check WPA or WPA2 */ if (pEid->Eid == IE_WPA) { - PRSNIE pRsnie = (PRSNIE) pBuf; + struct rt_rsnie *pRsnie = (struct rt_rsnie *)pBuf; u16 ucount; - if (len < sizeof(RSNIE)) { + if (len < sizeof(struct rt_rsnie)) { DBGPRINT_ERR(("%s : The length is too short for WPA\n", __func__)); return NULL; @@ -2827,15 +2827,15 @@ u8 *GetSuiteFromRSNIE(u8 *rsnie, return pRsnie->ucast[0].oui; } - offset = sizeof(RSNIE) + (4 * (ucount - 1)); + offset = sizeof(struct rt_rsnie) + (4 * (ucount - 1)); } else if (pEid->Eid == IE_RSN) { - PRSNIE2 pRsnie = (PRSNIE2) pBuf; + struct rt_rsnie2 *pRsnie = (struct rt_rsnie2 *)pBuf; u16 ucount; isWPA2 = TRUE; - if (len < sizeof(RSNIE2)) { + if (len < sizeof(struct rt_rsnie2)) { DBGPRINT_ERR(("%s : The length is too short for WPA2\n", __func__)); return NULL; @@ -2860,7 +2860,7 @@ u8 *GetSuiteFromRSNIE(u8 *rsnie, return pRsnie->ucast[0].oui; } - offset = sizeof(RSNIE2) + (4 * (ucount - 1)); + offset = sizeof(struct rt_rsnie2) + (4 * (ucount - 1)); } else { DBGPRINT_ERR(("%s : Unknown IE (%d)\n", __func__, pEid->Eid)); @@ -2871,13 +2871,13 @@ u8 *GetSuiteFromRSNIE(u8 *rsnie, pBuf += offset; len -= offset; - if (len < sizeof(RSNIE_AUTH)) { + if (len < sizeof(struct rt_rsnie_auth)) { DBGPRINT_ERR(("%s : The length of RSNIE is too short\n", __func__)); return NULL; } /* pointer to AKM count */ - pAkm = (PRSNIE_AUTH) pBuf; + pAkm = (struct rt_rsnie_auth *)pBuf; /* Get the count of pairwise cipher */ acount = cpu2le16(pAkm->acount); @@ -2893,7 +2893,7 @@ u8 *GetSuiteFromRSNIE(u8 *rsnie, *count = acount; return pAkm->auth[0].oui; } - offset = sizeof(RSNIE_AUTH) + (4 * (acount - 1)); + offset = sizeof(struct rt_rsnie_auth) + (4 * (acount - 1)); pBuf += offset; len -= offset; diff --git a/drivers/staging/rt2860/common/crypt_hmac.c b/drivers/staging/rt2860/common/crypt_hmac.c index 6a086f92278a..d7ab08ec1a41 100644 --- a/drivers/staging/rt2860/common/crypt_hmac.c +++ b/drivers/staging/rt2860/common/crypt_hmac.c @@ -51,14 +51,14 @@ void HMAC_SHA1(IN const u8 Key[], IN const u8 Message[], u32 MessageLen, u8 MAC[], u32 MACLen) { - SHA1_CTX_STRUC sha_ctx1; - SHA1_CTX_STRUC sha_ctx2; + struct rt_sha1_ctx sha_ctx1; + struct rt_sha1_ctx sha_ctx2; u8 K0[SHA1_BLOCK_SIZE]; u8 Digest[SHA1_DIGEST_SIZE]; u32 index; - NdisZeroMemory(&sha_ctx1, sizeof(SHA1_CTX_STRUC)); - NdisZeroMemory(&sha_ctx2, sizeof(SHA1_CTX_STRUC)); + NdisZeroMemory(&sha_ctx1, sizeof(struct rt_sha1_ctx)); + NdisZeroMemory(&sha_ctx2, sizeof(struct rt_sha1_ctx)); /* * If the length of K = B(Block size): K0 = K. * If the length of K > B: hash K to obtain an L byte string, @@ -130,14 +130,14 @@ void HMAC_MD5(IN const u8 Key[], IN const u8 Message[], u32 MessageLen, u8 MAC[], u32 MACLen) { - MD5_CTX_STRUC md5_ctx1; - MD5_CTX_STRUC md5_ctx2; + struct rt_md5_ctx_struc md5_ctx1; + struct rt_md5_ctx_struc md5_ctx2; u8 K0[MD5_BLOCK_SIZE]; u8 Digest[MD5_DIGEST_SIZE]; u32 index; - NdisZeroMemory(&md5_ctx1, sizeof(MD5_CTX_STRUC)); - NdisZeroMemory(&md5_ctx2, sizeof(MD5_CTX_STRUC)); + NdisZeroMemory(&md5_ctx1, sizeof(struct rt_md5_ctx_struc)); + NdisZeroMemory(&md5_ctx2, sizeof(struct rt_md5_ctx_struc)); /* * If the length of K = B(Block size): K0 = K. * If the length of K > B: hash K to obtain an L byte string, diff --git a/drivers/staging/rt2860/common/crypt_md5.c b/drivers/staging/rt2860/common/crypt_md5.c index 433aaf27dfa3..6deab659c22b 100644 --- a/drivers/staging/rt2860/common/crypt_md5.c +++ b/drivers/staging/rt2860/common/crypt_md5.c @@ -79,7 +79,7 @@ Note: None ======================================================================== */ -void MD5_Init(IN MD5_CTX_STRUC * pMD5_CTX) +void MD5_Init(struct rt_md5_ctx_struc *pMD5_CTX) { NdisMoveMemory(pMD5_CTX->HashValue, MD5_DefaultHashValue, sizeof(MD5_DefaultHashValue)); @@ -103,7 +103,7 @@ Note: T[i] := floor(abs(sin(i + 1)) * (2 pow 32)), i is number of round ======================================================================== */ -void MD5_Hash(IN MD5_CTX_STRUC * pMD5_CTX) +void MD5_Hash(struct rt_md5_ctx_struc *pMD5_CTX) { u32 X_i; u32 X[16]; @@ -227,7 +227,7 @@ Routine Description: will be called. Arguments: - pMD5_CTX Pointer to MD5_CTX_STRUC + pMD5_CTX Pointer to struct rt_md5_ctx_struc message Message context messageLen The length of message in bytes @@ -238,7 +238,7 @@ Note: None ======================================================================== */ -void MD5_Append(IN MD5_CTX_STRUC * pMD5_CTX, +void MD5_Append(struct rt_md5_ctx_struc *pMD5_CTX, IN const u8 Message[], u32 MessageLen) { u32 appendLen = 0; @@ -271,7 +271,7 @@ Routine Description: 3. Transform the Hash Value to digest message Arguments: - pMD5_CTX Pointer to MD5_CTX_STRUC + pMD5_CTX Pointer to struct rt_md5_ctx_struc Return Value: digestMessage Digest message @@ -280,7 +280,7 @@ Note: None ======================================================================== */ -void MD5_End(IN MD5_CTX_STRUC * pMD5_CTX, u8 DigestMessage[]) +void MD5_End(struct rt_md5_ctx_struc *pMD5_CTX, u8 DigestMessage[]) { u32 index; u64 message_length_bits; @@ -326,9 +326,9 @@ Note: void RT_MD5(IN const u8 Message[], u32 MessageLen, u8 DigestMessage[]) { - MD5_CTX_STRUC md5_ctx; + struct rt_md5_ctx_struc md5_ctx; - NdisZeroMemory(&md5_ctx, sizeof(MD5_CTX_STRUC)); + NdisZeroMemory(&md5_ctx, sizeof(struct rt_md5_ctx_struc)); MD5_Init(&md5_ctx); MD5_Append(&md5_ctx, Message, MessageLen); MD5_End(&md5_ctx, DigestMessage); diff --git a/drivers/staging/rt2860/common/crypt_sha2.c b/drivers/staging/rt2860/common/crypt_sha2.c index 9166ea019eda..fa83fb287fe5 100644 --- a/drivers/staging/rt2860/common/crypt_sha2.c +++ b/drivers/staging/rt2860/common/crypt_sha2.c @@ -52,10 +52,10 @@ static const u32 SHA1_DefaultHashValue[5] = { /* ======================================================================== Routine Description: - Initial SHA1_CTX_STRUC + Initial struct rt_sha1_ctx Arguments: - pSHA_CTX Pointer to SHA1_CTX_STRUC + pSHA_CTX Pointer to struct rt_sha1_ctx Return Value: None @@ -64,7 +64,7 @@ Note: None ======================================================================== */ -void RT_SHA1_Init(IN SHA1_CTX_STRUC * pSHA_CTX) +void RT_SHA1_Init(struct rt_sha1_ctx *pSHA_CTX) { NdisMoveMemory(pSHA_CTX->HashValue, SHA1_DefaultHashValue, sizeof(SHA1_DefaultHashValue)); @@ -79,7 +79,7 @@ Routine Description: SHA1 computation for one block (512 bits) Arguments: - pSHA_CTX Pointer to SHA1_CTX_STRUC + pSHA_CTX Pointer to struct rt_sha1_ctx Return Value: None @@ -88,7 +88,7 @@ Note: None ======================================================================== */ -void SHA1_Hash(IN SHA1_CTX_STRUC * pSHA_CTX) +void SHA1_Hash(struct rt_sha1_ctx *pSHA_CTX) { u32 W_i, t, s; u32 W[16]; @@ -157,7 +157,7 @@ Routine Description: will be called. Arguments: - pSHA_CTX Pointer to SHA1_CTX_STRUC + pSHA_CTX Pointer to struct rt_sha1_ctx message Message context messageLen The length of message in bytes @@ -168,7 +168,7 @@ Note: None ======================================================================== */ -void SHA1_Append(IN SHA1_CTX_STRUC * pSHA_CTX, +void SHA1_Append(struct rt_sha1_ctx *pSHA_CTX, IN const u8 Message[], u32 MessageLen) { u32 appendLen = 0; @@ -201,7 +201,7 @@ Routine Description: 3. Transform the Hash Value to digest message Arguments: - pSHA_CTX Pointer to SHA1_CTX_STRUC + pSHA_CTX Pointer to struct rt_sha1_ctx Return Value: digestMessage Digest message @@ -210,7 +210,7 @@ Note: None ======================================================================== */ -void SHA1_End(IN SHA1_CTX_STRUC * pSHA_CTX, u8 DigestMessage[]) +void SHA1_End(struct rt_sha1_ctx *pSHA_CTX, u8 DigestMessage[]) { u32 index; u64 message_length_bits; @@ -257,9 +257,9 @@ void RT_SHA1(IN const u8 Message[], u32 MessageLen, u8 DigestMessage[]) { - SHA1_CTX_STRUC sha_ctx; + struct rt_sha1_ctx sha_ctx; - NdisZeroMemory(&sha_ctx, sizeof(SHA1_CTX_STRUC)); + NdisZeroMemory(&sha_ctx, sizeof(struct rt_sha1_ctx)); RT_SHA1_Init(&sha_ctx); SHA1_Append(&sha_ctx, Message, MessageLen); SHA1_End(&sha_ctx, DigestMessage); diff --git a/drivers/staging/rt2860/common/dfs.c b/drivers/staging/rt2860/common/dfs.c index 8bee5cf03e4b..71cbb2665243 100644 --- a/drivers/staging/rt2860/common/dfs.c +++ b/drivers/staging/rt2860/common/dfs.c @@ -52,7 +52,7 @@ ======================================================================== */ -BOOLEAN RadarChannelCheck(IN PRTMP_ADAPTER pAd, u8 Ch) +BOOLEAN RadarChannelCheck(struct rt_rtmp_adapter *pAd, u8 Ch) { int i; BOOLEAN result = FALSE; diff --git a/drivers/staging/rt2860/common/ee_efuse.c b/drivers/staging/rt2860/common/ee_efuse.c index b997151c25ff..03412f5bc990 100644 --- a/drivers/staging/rt2860/common/ee_efuse.c +++ b/drivers/staging/rt2860/common/ee_efuse.c @@ -73,7 +73,7 @@ typedef union _EFUSE_CTRL_STRUC { ======================================================================== */ -u8 eFuseReadRegisters(IN PRTMP_ADAPTER pAd, +u8 eFuseReadRegisters(struct rt_rtmp_adapter *pAd, u16 Offset, u16 Length, u16 * pData) { EFUSE_CTRL_STRUC eFuseCtrlStruc; @@ -149,7 +149,7 @@ u8 eFuseReadRegisters(IN PRTMP_ADAPTER pAd, ======================================================================== */ -void eFusePhysicalReadRegisters(IN PRTMP_ADAPTER pAd, +void eFusePhysicalReadRegisters(struct rt_rtmp_adapter *pAd, u16 Offset, u16 Length, u16 * pData) { @@ -214,7 +214,7 @@ void eFusePhysicalReadRegisters(IN PRTMP_ADAPTER pAd, ======================================================================== */ -static void eFuseReadPhysical(IN PRTMP_ADAPTER pAd, +static void eFuseReadPhysical(struct rt_rtmp_adapter *pAd, u16 *lpInBuffer, unsigned long nInBufferSize, u16 *lpOutBuffer, unsigned long nOutBufferSize) @@ -244,7 +244,7 @@ static void eFuseReadPhysical(IN PRTMP_ADAPTER pAd, ======================================================================== */ -int set_eFuseGetFreeBlockCount_Proc(IN PRTMP_ADAPTER pAd, char *arg) +int set_eFuseGetFreeBlockCount_Proc(struct rt_rtmp_adapter *pAd, char *arg) { u16 i; u16 LogicalAddress; @@ -268,7 +268,7 @@ int set_eFuseGetFreeBlockCount_Proc(IN PRTMP_ADAPTER pAd, char *arg) return TRUE; } -int set_eFusedump_Proc(IN PRTMP_ADAPTER pAd, char *arg) +int set_eFusedump_Proc(struct rt_rtmp_adapter *pAd, char *arg) { u16 InBuf[3]; int i = 0; @@ -287,14 +287,14 @@ int set_eFusedump_Proc(IN PRTMP_ADAPTER pAd, char *arg) return TRUE; } -int rtmp_ee_efuse_read16(IN RTMP_ADAPTER * pAd, +int rtmp_ee_efuse_read16(struct rt_rtmp_adapter *pAd, u16 Offset, u16 * pValue) { eFuseReadRegisters(pAd, Offset, 2, pValue); return (*pValue); } -int RtmpEfuseSupportCheck(IN RTMP_ADAPTER * pAd) +int RtmpEfuseSupportCheck(struct rt_rtmp_adapter *pAd) { u16 value; @@ -305,7 +305,7 @@ int RtmpEfuseSupportCheck(IN RTMP_ADAPTER * pAd) return 0; } -void eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, u32 *EfuseFreeBlock) +void eFuseGetFreeBlockCount(struct rt_rtmp_adapter *pAd, u32 *EfuseFreeBlock) { u16 i; u16 LogicalAddress; @@ -331,7 +331,7 @@ void eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, u32 *EfuseFreeBlock) ("eFuseGetFreeBlockCount is 0x%x\n", *EfuseFreeBlock)); } -int eFuse_init(IN PRTMP_ADAPTER pAd) +int eFuse_init(struct rt_rtmp_adapter *pAd) { u32 EfuseFreeBlock = 0; DBGPRINT(RT_DEBUG_ERROR, diff --git a/drivers/staging/rt2860/common/ee_prom.c b/drivers/staging/rt2860/common/ee_prom.c index 8cd654c4f99b..2083740a844b 100644 --- a/drivers/staging/rt2860/common/ee_prom.c +++ b/drivers/staging/rt2860/common/ee_prom.c @@ -38,7 +38,7 @@ #include "../rt_config.h" /* IRQL = PASSIVE_LEVEL */ -static inline void RaiseClock(IN PRTMP_ADAPTER pAd, u32 * x) +static inline void RaiseClock(struct rt_rtmp_adapter *pAd, u32 * x) { *x = *x | EESK; RTMP_IO_WRITE32(pAd, E2PROM_CSR, *x); @@ -46,7 +46,7 @@ static inline void RaiseClock(IN PRTMP_ADAPTER pAd, u32 * x) } /* IRQL = PASSIVE_LEVEL */ -static inline void LowerClock(IN PRTMP_ADAPTER pAd, u32 * x) +static inline void LowerClock(struct rt_rtmp_adapter *pAd, u32 * x) { *x = *x & ~EESK; RTMP_IO_WRITE32(pAd, E2PROM_CSR, *x); @@ -54,7 +54,7 @@ static inline void LowerClock(IN PRTMP_ADAPTER pAd, u32 * x) } /* IRQL = PASSIVE_LEVEL */ -static inline u16 ShiftInBits(IN PRTMP_ADAPTER pAd) +static inline u16 ShiftInBits(struct rt_rtmp_adapter *pAd) { u32 x, i; u16 data = 0; @@ -79,7 +79,7 @@ static inline u16 ShiftInBits(IN PRTMP_ADAPTER pAd) } /* IRQL = PASSIVE_LEVEL */ -static inline void ShiftOutBits(IN PRTMP_ADAPTER pAd, +static inline void ShiftOutBits(struct rt_rtmp_adapter *pAd, u16 data, u16 count) { u32 x, mask; @@ -107,7 +107,7 @@ static inline void ShiftOutBits(IN PRTMP_ADAPTER pAd, } /* IRQL = PASSIVE_LEVEL */ -static inline void EEpromCleanup(IN PRTMP_ADAPTER pAd) +static inline void EEpromCleanup(struct rt_rtmp_adapter *pAd) { u32 x; @@ -120,7 +120,7 @@ static inline void EEpromCleanup(IN PRTMP_ADAPTER pAd) LowerClock(pAd, &x); } -static inline void EWEN(IN PRTMP_ADAPTER pAd) +static inline void EWEN(struct rt_rtmp_adapter *pAd) { u32 x; @@ -141,7 +141,7 @@ static inline void EWEN(IN PRTMP_ADAPTER pAd) EEpromCleanup(pAd); } -static inline void EWDS(IN PRTMP_ADAPTER pAd) +static inline void EWDS(struct rt_rtmp_adapter *pAd) { u32 x; @@ -163,7 +163,7 @@ static inline void EWDS(IN PRTMP_ADAPTER pAd) } /* IRQL = PASSIVE_LEVEL */ -int rtmp_ee_prom_read16(IN PRTMP_ADAPTER pAd, +int rtmp_ee_prom_read16(struct rt_rtmp_adapter *pAd, u16 Offset, u16 * pValue) { u32 x; diff --git a/drivers/staging/rt2860/common/eeprom.c b/drivers/staging/rt2860/common/eeprom.c index 764de3a7807f..94670076d32b 100644 --- a/drivers/staging/rt2860/common/eeprom.c +++ b/drivers/staging/rt2860/common/eeprom.c @@ -36,9 +36,9 @@ */ #include "../rt_config.h" -int RtmpChipOpsEepromHook(IN RTMP_ADAPTER * pAd, int infType) +int RtmpChipOpsEepromHook(struct rt_rtmp_adapter *pAd, int infType) { - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + struct rt_rtmp_chip_op *pChipOps = &pAd->chipOps; #ifdef RT30xx #ifdef RTMP_EFUSE_SUPPORT u32 eFuseCtrl, MacCsr0; diff --git a/drivers/staging/rt2860/common/mlme.c b/drivers/staging/rt2860/common/mlme.c index fcf030b7db66..8cd8f53ed0e6 100644 --- a/drivers/staging/rt2860/common/mlme.c +++ b/drivers/staging/rt2860/common/mlme.c @@ -356,7 +356,7 @@ u8 ZeroSsid[32] = ========================================================================== */ -int MlmeInit(IN PRTMP_ADAPTER pAd) +int MlmeInit(struct rt_rtmp_adapter *pAd) { int Status = NDIS_STATUS_SUCCESS; @@ -453,9 +453,9 @@ int MlmeInit(IN PRTMP_ADAPTER pAd) ========================================================================== */ -void MlmeHandler(IN PRTMP_ADAPTER pAd) +void MlmeHandler(struct rt_rtmp_adapter *pAd) { - MLME_QUEUE_ELEM *Elem = NULL; + struct rt_mlme_queue_elem *Elem = NULL; /* Only accept MLME and Frame from peer side, no other (control/data) frame should */ /* get into this state machine */ @@ -571,7 +571,7 @@ void MlmeHandler(IN PRTMP_ADAPTER pAd) ========================================================================== */ -void MlmeHalt(IN PRTMP_ADAPTER pAd) +void MlmeHalt(struct rt_rtmp_adapter *pAd) { BOOLEAN Cancelled; @@ -610,7 +610,7 @@ void MlmeHalt(IN PRTMP_ADAPTER pAd) RTMPCancelTimer(&pAd->Mlme.RxAntEvalTimer, &Cancelled); if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) { - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + struct rt_rtmp_chip_op *pChipOps = &pAd->chipOps; /* Set LED */ RTMPSetLED(pAd, LED_HALT); @@ -639,7 +639,7 @@ void MlmeHalt(IN PRTMP_ADAPTER pAd) DBGPRINT(RT_DEBUG_TRACE, ("<== MlmeHalt\n")); } -void MlmeResetRalinkCounters(IN PRTMP_ADAPTER pAd) +void MlmeResetRalinkCounters(struct rt_rtmp_adapter *pAd) { pAd->RalinkCounters.LastOneSecRxOkDataCnt = pAd->RalinkCounters.OneSecRxOkDataCnt; @@ -694,7 +694,7 @@ void MlmePeriodicExec(void *SystemSpecific1, void *SystemSpecific2, void *SystemSpecific3) { unsigned long TxTotalCnt; - PRTMP_ADAPTER pAd = (RTMP_ADAPTER *) FunctionContext; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)FunctionContext; #ifdef RTMP_MAC_PCI { @@ -938,8 +938,8 @@ BOOLEAN MlmeValidateSSID(u8 *pSsid, u8 SsidLen) return (TRUE); } -void MlmeSelectTxRateTable(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, +void MlmeSelectTxRateTable(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, u8 ** ppTable, u8 *pTableSize, u8 *pInitTxRateIdx) { @@ -1144,7 +1144,7 @@ void MlmeSelectTxRateTable(IN PRTMP_ADAPTER pAd, } while (FALSE); } -void STAMlmePeriodicExec(PRTMP_ADAPTER pAd) +void STAMlmePeriodicExec(struct rt_rtmp_adapter *pAd) { unsigned long TxTotalCnt; int i; @@ -1385,7 +1385,7 @@ void STAMlmePeriodicExec(PRTMP_ADAPTER pAd) pAd->StaCfg.LastBeaconRxTime + ADHOC_BEACON_LOST_TIME) && OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) { - MLME_START_REQ_STRUCT StartReq; + struct rt_mlme_start_req StartReq; DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - excessive BEACON lost, last STA in this IBSS, MediaState=Disconnected\n")); @@ -1395,12 +1395,12 @@ void STAMlmePeriodicExec(PRTMP_ADAPTER pAd) (char *) pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, - sizeof(MLME_START_REQ_STRUCT), &StartReq); + sizeof(struct rt_mlme_start_req), &StartReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_START; } for (i = 1; i < MAX_LEN_OF_MAC_TABLE; i++) { - MAC_TABLE_ENTRY *pEntry = &pAd->MacTab.Content[i]; + struct rt_mac_table_entry *pEntry = &pAd->MacTab.Content[i]; if (pEntry->ValidAsCLI == FALSE) continue; @@ -1429,7 +1429,7 @@ void STAMlmePeriodicExec(PRTMP_ADAPTER pAd) pAd->MlmeAux.AutoReconnectSsidLen) == TRUE)) { if ((pAd->ScanTab.BssNr == 0) && (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE)) { - MLME_SCAN_REQ_STRUCT ScanReq; + struct rt_mlme_scan_req ScanReq; if (RTMP_TIME_AFTER (pAd->Mlme.Now32, @@ -1447,7 +1447,7 @@ void STAMlmePeriodicExec(PRTMP_ADAPTER pAd) MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, sizeof - (MLME_SCAN_REQ_STRUCT), + (struct rt_mlme_scan_req), &ScanReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; @@ -1491,10 +1491,10 @@ void LinkDownExec(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)FunctionContext; if (pAd != NULL) { - MLME_DISASSOC_REQ_STRUCT DisassocReq; + struct rt_mlme_disassoc_req DisassocReq; if ((pAd->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED) && (INFRA_ON(pAd))) { @@ -1505,7 +1505,7 @@ void LinkDownExec(void *SystemSpecific1, REASON_DISASSOC_STA_LEAVING); MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, - sizeof(MLME_DISASSOC_REQ_STRUCT), + sizeof(struct rt_mlme_disassoc_req), &DisassocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; @@ -1517,7 +1517,7 @@ void LinkDownExec(void *SystemSpecific1, } /* IRQL = DISPATCH_LEVEL */ -void MlmeAutoScan(IN PRTMP_ADAPTER pAd) +void MlmeAutoScan(struct rt_rtmp_adapter *pAd) { /* check CntlMachine.CurrState to avoid collision with NDIS SetOID request */ if (pAd->Mlme.CntlMachine.CurrState == CNTL_IDLE) { @@ -1532,7 +1532,7 @@ void MlmeAutoScan(IN PRTMP_ADAPTER pAd) } /* IRQL = DISPATCH_LEVEL */ -void MlmeAutoReconnectLastSSID(IN PRTMP_ADAPTER pAd) +void MlmeAutoReconnectLastSSID(struct rt_rtmp_adapter *pAd) { if (pAd->StaCfg.bAutoConnectByBssid) { DBGPRINT(RT_DEBUG_TRACE, @@ -1555,7 +1555,7 @@ void MlmeAutoReconnectLastSSID(IN PRTMP_ADAPTER pAd) (MlmeValidateSSID (pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen) == TRUE)) { - NDIS_802_11_SSID OidSsid; + struct rt_ndis_802_11_ssid OidSsid; OidSsid.SsidLength = pAd->MlmeAux.AutoReconnectSsidLen; NdisMoveMemory(OidSsid.Ssid, pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen); @@ -1565,7 +1565,7 @@ void MlmeAutoReconnectLastSSID(IN PRTMP_ADAPTER pAd) pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen)); MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, OID_802_11_SSID, - sizeof(NDIS_802_11_SSID), &OidSsid); + sizeof(struct rt_ndis_802_11_ssid), &OidSsid); RTMP_MLME_HANDLER(pAd); } } @@ -1582,11 +1582,11 @@ void MlmeAutoReconnectLastSSID(IN PRTMP_ADAPTER pAd) Output: ========================================================================== */ -void MlmeCheckForRoaming(IN PRTMP_ADAPTER pAd, unsigned long Now32) +void MlmeCheckForRoaming(struct rt_rtmp_adapter *pAd, unsigned long Now32) { u16 i; - BSS_TABLE *pRoamTab = &pAd->MlmeAux.RoamTab; - BSS_ENTRY *pBss; + struct rt_bss_table *pRoamTab = &pAd->MlmeAux.RoamTab; + struct rt_bss_entry *pBss; DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeCheckForRoaming\n")); /* put all roaming candidates into RoamTab, and sort in RSSI order */ @@ -1607,7 +1607,7 @@ void MlmeCheckForRoaming(IN PRTMP_ADAPTER pAd, unsigned long Now32) /* AP passing all above rules is put into roaming candidate table */ NdisMoveMemory(&pRoamTab->BssEntry[pRoamTab->BssNr], pBss, - sizeof(BSS_ENTRY)); + sizeof(struct rt_bss_entry)); pRoamTab->BssNr += 1; } @@ -1640,11 +1640,11 @@ void MlmeCheckForRoaming(IN PRTMP_ADAPTER pAd, unsigned long Now32) Output: ========================================================================== */ -BOOLEAN MlmeCheckForFastRoaming(IN PRTMP_ADAPTER pAd) +BOOLEAN MlmeCheckForFastRoaming(struct rt_rtmp_adapter *pAd) { u16 i; - BSS_TABLE *pRoamTab = &pAd->MlmeAux.RoamTab; - BSS_ENTRY *pBss; + struct rt_bss_table *pRoamTab = &pAd->MlmeAux.RoamTab; + struct rt_bss_entry *pBss; DBGPRINT(RT_DEBUG_TRACE, ("==> MlmeCheckForFastRoaming\n")); /* put all roaming candidates into RoamTab, and sort in RSSI order */ @@ -1676,7 +1676,7 @@ BOOLEAN MlmeCheckForFastRoaming(IN PRTMP_ADAPTER pAd) pBss->Rssi)); /* AP passing all above rules is put into roaming candidate table */ NdisMoveMemory(&pRoamTab->BssEntry[pRoamTab->BssNr], pBss, - sizeof(BSS_ENTRY)); + sizeof(struct rt_bss_entry)); pRoamTab->BssNr += 1; } @@ -1699,8 +1699,8 @@ BOOLEAN MlmeCheckForFastRoaming(IN PRTMP_ADAPTER pAd) return FALSE; } -void MlmeSetTxRate(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, IN PRTMP_TX_RATE_SWITCH pTxRate) +void MlmeSetTxRate(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, struct rt_rtmp_tx_rate_switch * pTxRate) { u8 MaxMode = MODE_OFDM; @@ -1840,13 +1840,13 @@ void MlmeSetTxRate(IN PRTMP_ADAPTER pAd, call this routine every second ========================================================================== */ -void MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) +void MlmeDynamicTxRateSwitching(struct rt_rtmp_adapter *pAd) { u8 UpRateIdx = 0, DownRateIdx = 0, CurrRateIdx; unsigned long i, AccuTxTotalCnt = 0, TxTotalCnt; unsigned long TxErrorRatio = 0; BOOLEAN bTxRateChanged = FALSE, bUpgradeQuality = FALSE; - PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate = NULL; + struct rt_rtmp_tx_rate_switch *pCurrTxRate, *pNextTxRate = NULL; u8 *pTable; u8 TableSize = 0; u8 InitTxRateIdx = 0, TrainUp, TrainDown; @@ -1854,8 +1854,8 @@ void MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) TX_STA_CNT1_STRUC StaTx1; TX_STA_CNT0_STRUC TxStaCnt0; unsigned long TxRetransmit = 0, TxSuccess = 0, TxFailCount = 0; - MAC_TABLE_ENTRY *pEntry; - RSSI_SAMPLE *pRssi = &pAd->StaCfg.RssiSample; + struct rt_mac_table_entry *pEntry; + struct rt_rssi_sample *pRssi = &pAd->StaCfg.RssiSample; /* */ /* walk through MAC table, see if need to change AP's TX rate toward each entry */ @@ -1982,7 +1982,7 @@ void MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) /* When switch from Fixed rate -> auto rate, the REAL TX rate might be different from pAd->CommonCfg.TxRateIndex. */ /* So need to sync here. */ pCurrTxRate = - (PRTMP_TX_RATE_SWITCH) & pTable[(CurrRateIdx + 1) * 5]; + (struct rt_rtmp_tx_rate_switch *) & pTable[(CurrRateIdx + 1) * 5]; if ((pEntry->HTPhyMode.field.MCS != pCurrTxRate->CurrMCS) /*&& (pAd->StaCfg.bAutoTxRateSwitch == TRUE) */ ) { @@ -1990,7 +1990,7 @@ void MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) /* Need to sync Real Tx rate and our record. */ /* Then return for next DRS. */ pCurrTxRate = - (PRTMP_TX_RATE_SWITCH) & pTable[(InitTxRateIdx + 1) + (struct rt_rtmp_tx_rate_switch *) & pTable[(InitTxRateIdx + 1) * 5]; pEntry->CurrTxRateIndex = InitTxRateIdx; MlmeSetTxRate(pAd, pEntry, pCurrTxRate); @@ -2012,7 +2012,7 @@ void MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) } pCurrTxRate = - (PRTMP_TX_RATE_SWITCH) & pTable[(CurrRateIdx + 1) * 5]; + (struct rt_rtmp_tx_rate_switch *) & pTable[(CurrRateIdx + 1) * 5]; if ((Rssi > -65) && (pCurrTxRate->Mode >= MODE_HTMIX)) { TrainUp = @@ -2049,7 +2049,7 @@ void MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) /* check the existence and index of each needed MCS */ while (idx < pTable[0]) { pCurrTxRate = - (PRTMP_TX_RATE_SWITCH) & pTable[(idx + 1) * + (struct rt_rtmp_tx_rate_switch *) & pTable[(idx + 1) * 5]; if (pCurrTxRate->CurrMCS == MCS_0) { @@ -2192,7 +2192,7 @@ void MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) { pEntry->CurrTxRateIndex = TxRateIdx; pNextTxRate = - (PRTMP_TX_RATE_SWITCH) & + (struct rt_rtmp_tx_rate_switch *) & pTable[(pEntry->CurrTxRateIndex + 1) * 5]; MlmeSetTxRate(pAd, pEntry, pNextTxRate); } @@ -2332,7 +2332,7 @@ void MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd) } pNextTxRate = - (PRTMP_TX_RATE_SWITCH) & pTable[(tmpTxRate + 1) * + (struct rt_rtmp_tx_rate_switch *) & pTable[(tmpTxRate + 1) * 5]; } if (bTxRateChanged && pNextTxRate) { @@ -2364,12 +2364,12 @@ void StaQuickResponeForRateUpExec(void *SystemSpecific1, void *SystemSpecific2, void *SystemSpecific3) { - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) FunctionContext; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)FunctionContext; u8 UpRateIdx = 0, DownRateIdx = 0, CurrRateIdx = 0; unsigned long TxTotalCnt; unsigned long TxErrorRatio = 0; BOOLEAN bTxRateChanged; /*, bUpgradeQuality = FALSE; */ - PRTMP_TX_RATE_SWITCH pCurrTxRate, pNextTxRate = NULL; + struct rt_rtmp_tx_rate_switch *pCurrTxRate, *pNextTxRate = NULL; u8 *pTable; u8 TableSize = 0; u8 InitTxRateIdx = 0, TrainUp, TrainDown; @@ -2377,7 +2377,7 @@ void StaQuickResponeForRateUpExec(void *SystemSpecific1, TX_STA_CNT0_STRUC TxStaCnt0; char Rssi, ratio; unsigned long TxRetransmit = 0, TxSuccess = 0, TxFailCount = 0; - MAC_TABLE_ENTRY *pEntry; + struct rt_mac_table_entry *pEntry; unsigned long i; pAd->StaCfg.StaQuickResponeForRateUpTimerRunning = FALSE; @@ -2421,7 +2421,7 @@ void StaQuickResponeForRateUpExec(void *SystemSpecific1, } pCurrTxRate = - (PRTMP_TX_RATE_SWITCH) & pTable[(CurrRateIdx + 1) * 5]; + (struct rt_rtmp_tx_rate_switch *) & pTable[(CurrRateIdx + 1) * 5]; if ((Rssi > -65) && (pCurrTxRate->Mode >= MODE_HTMIX)) { TrainUp = @@ -2574,7 +2574,7 @@ void StaQuickResponeForRateUpExec(void *SystemSpecific1, } pNextTxRate = - (PRTMP_TX_RATE_SWITCH) & + (struct rt_rtmp_tx_rate_switch *) & pTable[(pAd->CommonCfg.TxRateIndex + 1) * 5]; if (bTxRateChanged && pNextTxRate) { MlmeSetTxRate(pAd, pEntry, pNextTxRate); @@ -2601,7 +2601,7 @@ void StaQuickResponeForRateUpExec(void *SystemSpecific1, ========================================================================== */ -void MlmeCheckPsmChange(IN PRTMP_ADAPTER pAd, unsigned long Now32) +void MlmeCheckPsmChange(struct rt_rtmp_adapter *pAd, unsigned long Now32) { unsigned long PowerMode; @@ -2638,7 +2638,7 @@ void MlmeCheckPsmChange(IN PRTMP_ADAPTER pAd, unsigned long Now32) /* IRQL = PASSIVE_LEVEL */ /* IRQL = DISPATCH_LEVEL */ -void MlmeSetPsmBit(IN PRTMP_ADAPTER pAd, u16 psm) +void MlmeSetPsmBit(struct rt_rtmp_adapter *pAd, u16 psm) { AUTO_RSP_CFG_STRUC csr4; @@ -2669,14 +2669,14 @@ void MlmeSetPsmBit(IN PRTMP_ADAPTER pAd, u16 psm) channel quality based on the most up-to-date information ========================================================================== */ -void MlmeCalculateChannelQuality(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pMacEntry, unsigned long Now32) +void MlmeCalculateChannelQuality(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pMacEntry, unsigned long Now32) { unsigned long TxOkCnt, TxCnt, TxPER, TxPRR; unsigned long RxCnt, RxPER; u8 NorRssi; char MaxRssi; - RSSI_SAMPLE *pRssiSample = NULL; + struct rt_rssi_sample *pRssiSample = NULL; u32 OneSecTxNoRetryOkCount = 0; u32 OneSecTxRetryOkCount = 0; u32 OneSecTxFailCount = 0; @@ -2751,7 +2751,7 @@ void MlmeCalculateChannelQuality(IN PRTMP_ADAPTER pAd, } /* IRQL = DISPATCH_LEVEL */ -void MlmeSetTxPreamble(IN PRTMP_ADAPTER pAd, u16 TxPreamble) +void MlmeSetTxPreamble(struct rt_rtmp_adapter *pAd, u16 TxPreamble) { AUTO_RSP_CFG_STRUC csr4; @@ -2785,7 +2785,7 @@ void MlmeSetTxPreamble(IN PRTMP_ADAPTER pAd, u16 TxPreamble) ========================================================================== */ -void UpdateBasicRateBitmap(IN PRTMP_ADAPTER pAdapter) +void UpdateBasicRateBitmap(struct rt_rtmp_adapter *pAdapter) { int i, j; /* 1 2 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54 */ @@ -2831,7 +2831,7 @@ void UpdateBasicRateBitmap(IN PRTMP_ADAPTER pAdapter) /* IRQL = DISPATCH_LEVEL */ /* bLinkUp is to identify the inital link speed. */ /* TRUE indicates the rate update at linkup, we should not try to set the rate at 54Mbps. */ -void MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, u8 apidx) +void MlmeUpdateTxRates(struct rt_rtmp_adapter *pAd, IN BOOLEAN bLinkUp, u8 apidx) { int i, num; u8 Rate = RATE_6, MaxDesire = RATE_1, MaxSupport = RATE_1; @@ -3292,15 +3292,15 @@ void MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, IN BOOLEAN bLinkUp, u8 apidx) ========================================================================== */ -void MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, u8 apidx) +void MlmeUpdateHtTxRates(struct rt_rtmp_adapter *pAd, u8 apidx) { u8 StbcMcs; /*j, StbcMcs, bitmask; */ char i; /* 3*3 */ - RT_HT_CAPABILITY *pRtHtCap = NULL; - RT_HT_PHY_INFO *pActiveHtPhy = NULL; + struct rt_ht_capability *pRtHtCap = NULL; + struct rt_ht_phy_info *pActiveHtPhy = NULL; unsigned long BasicMCS; u8 j, bitmask; - PRT_HT_PHY_INFO pDesireHtPhy = NULL; + struct rt_ht_phy_info *pDesireHtPhy = NULL; PHTTRANSMIT_SETTING pHtPhy = NULL; PHTTRANSMIT_SETTING pMaxHtPhy = NULL; PHTTRANSMIT_SETTING pMinHtPhy = NULL; @@ -3444,7 +3444,7 @@ void MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, u8 apidx) DBGPRINT(RT_DEBUG_TRACE, ("MlmeUpdateHtTxRates<=== \n")); } -void BATableInit(IN PRTMP_ADAPTER pAd, IN BA_TABLE * Tab) +void BATableInit(struct rt_rtmp_adapter *pAd, struct rt_ba_table *Tab) { int i; @@ -3462,13 +3462,13 @@ void BATableInit(IN PRTMP_ADAPTER pAd, IN BA_TABLE * Tab) } /* IRQL = DISPATCH_LEVEL */ -void MlmeRadioOff(IN PRTMP_ADAPTER pAd) +void MlmeRadioOff(struct rt_rtmp_adapter *pAd) { RTMP_MLME_RADIO_OFF(pAd); } /* IRQL = DISPATCH_LEVEL */ -void MlmeRadioOn(IN PRTMP_ADAPTER pAd) +void MlmeRadioOn(struct rt_rtmp_adapter *pAd) { RTMP_MLME_RADIO_ON(pAd); } @@ -3487,14 +3487,14 @@ void MlmeRadioOn(IN PRTMP_ADAPTER pAd) IRQL = DISPATCH_LEVEL */ -void BssTableInit(IN BSS_TABLE * Tab) +void BssTableInit(struct rt_bss_table *Tab) { int i; Tab->BssNr = 0; Tab->BssOverlapNr = 0; for (i = 0; i < MAX_LEN_OF_BSS_TABLE; i++) { - NdisZeroMemory(&Tab->BssEntry[i], sizeof(BSS_ENTRY)); + NdisZeroMemory(&Tab->BssEntry[i], sizeof(struct rt_bss_entry)); Tab->BssEntry[i].Rssi = -127; /* initial the rssi as a minimum value */ } } @@ -3510,7 +3510,7 @@ void BssTableInit(IN BSS_TABLE * Tab) IRQL = DISPATCH_LEVEL */ -unsigned long BssTableSearch(IN BSS_TABLE * Tab, u8 *pBssid, u8 Channel) +unsigned long BssTableSearch(struct rt_bss_table *Tab, u8 *pBssid, u8 Channel) { u8 i; @@ -3528,7 +3528,7 @@ unsigned long BssTableSearch(IN BSS_TABLE * Tab, u8 *pBssid, u8 Channel) return (unsigned long)BSS_NOT_FOUND; } -unsigned long BssSsidTableSearch(IN BSS_TABLE * Tab, +unsigned long BssSsidTableSearch(struct rt_bss_table *Tab, u8 *pBssid, u8 *pSsid, u8 SsidLen, u8 Channel) { @@ -3550,7 +3550,7 @@ unsigned long BssSsidTableSearch(IN BSS_TABLE * Tab, return (unsigned long)BSS_NOT_FOUND; } -unsigned long BssTableSearchWithSSID(IN BSS_TABLE * Tab, +unsigned long BssTableSearchWithSSID(struct rt_bss_table *Tab, u8 *Bssid, u8 *pSsid, u8 SsidLen, u8 Channel) @@ -3575,7 +3575,7 @@ unsigned long BssTableSearchWithSSID(IN BSS_TABLE * Tab, return (unsigned long)BSS_NOT_FOUND; } -unsigned long BssSsidTableSearchBySSID(IN BSS_TABLE * Tab, +unsigned long BssSsidTableSearchBySSID(struct rt_bss_table *Tab, u8 *pSsid, u8 SsidLen) { u8 i; @@ -3591,7 +3591,7 @@ unsigned long BssSsidTableSearchBySSID(IN BSS_TABLE * Tab, } /* IRQL = DISPATCH_LEVEL */ -void BssTableDeleteEntry(IN OUT BSS_TABLE * Tab, +void BssTableDeleteEntry(struct rt_bss_table *Tab, u8 *pBssid, u8 Channel) { u8 i, j; @@ -3602,10 +3602,10 @@ void BssTableDeleteEntry(IN OUT BSS_TABLE * Tab, for (j = i; j < Tab->BssNr - 1; j++) { NdisMoveMemory(&(Tab->BssEntry[j]), &(Tab->BssEntry[j + 1]), - sizeof(BSS_ENTRY)); + sizeof(struct rt_bss_entry)); } NdisZeroMemory(&(Tab->BssEntry[Tab->BssNr - 1]), - sizeof(BSS_ENTRY)); + sizeof(struct rt_bss_entry)); Tab->BssNr -= 1; return; } @@ -3621,8 +3621,8 @@ void BssTableDeleteEntry(IN OUT BSS_TABLE * Tab, // IRQL = DISPATCH_LEVEL ======================================================================== */ -void BATableDeleteORIEntry(IN OUT PRTMP_ADAPTER pAd, - IN BA_ORI_ENTRY * pBAORIEntry) +void BATableDeleteORIEntry(struct rt_rtmp_adapter *pAd, + struct rt_ba_ori_entry *pBAORIEntry) { if (pBAORIEntry->ORI_BA_Status != Originator_NONE) { @@ -3652,7 +3652,7 @@ void BATableDeleteORIEntry(IN OUT PRTMP_ADAPTER pAd, IRQL = DISPATCH_LEVEL */ -void BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, u8 *pBssid, char Ssid[], u8 SsidLen, u8 BssType, u16 BeaconPeriod, IN PCF_PARM pCfParm, u16 AtimWin, u16 CapabilityInfo, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ +void BssEntrySet(struct rt_rtmp_adapter *pAd, struct rt_bss_entry *pBss, u8 *pBssid, char Ssid[], u8 SsidLen, u8 BssType, u16 BeaconPeriod, struct rt_cf_parm * pCfParm, u16 AtimWin, u16 CapabilityInfo, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, struct rt_ht_capability_ie * pHtCapability, struct rt_add_ht_info_ie * pAddHtInfo, /* AP might use this additional ht info IE */ u8 HtCapabilityLen, u8 AddHtInfoLen, u8 NewExtChanOffset, @@ -3660,10 +3660,10 @@ void BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, u8 *pBssid, char Ss char Rssi, IN LARGE_INTEGER TimeStamp, u8 CkipFlag, - IN PEDCA_PARM pEdcaParm, - IN PQOS_CAPABILITY_PARM pQosCapability, - IN PQBSS_LOAD_PARM pQbssLoad, - u16 LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE) + struct rt_edca_parm *pEdcaParm, + struct rt_qos_capability_parm *pQosCapability, + struct rt_qbss_load_parm *pQbssLoad, + u16 LengthVIE, struct rt_ndis_802_11_variable_ies *pVIE) { COPY_MAC_ADDR(pBss->Bssid, pBssid); /* Default Hidden SSID to be TRUE, it will be turned to FALSE after coping SSID */ @@ -3761,27 +3761,27 @@ void BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, u8 *pBssid, char Ss /* new for QOS */ if (pEdcaParm) - NdisMoveMemory(&pBss->EdcaParm, pEdcaParm, sizeof(EDCA_PARM)); + NdisMoveMemory(&pBss->EdcaParm, pEdcaParm, sizeof(struct rt_edca_parm)); else pBss->EdcaParm.bValid = FALSE; if (pQosCapability) NdisMoveMemory(&pBss->QosCapability, pQosCapability, - sizeof(QOS_CAPABILITY_PARM)); + sizeof(struct rt_qos_capability_parm)); else pBss->QosCapability.bValid = FALSE; if (pQbssLoad) NdisMoveMemory(&pBss->QbssLoad, pQbssLoad, - sizeof(QBSS_LOAD_PARM)); + sizeof(struct rt_qbss_load_parm)); else pBss->QbssLoad.bValid = FALSE; { - PEID_STRUCT pEid; + struct rt_eid * pEid; u16 Length = 0; NdisZeroMemory(&pBss->WpaIE.IE[0], MAX_CUSTOM_LEN); NdisZeroMemory(&pBss->RsnIE.IE[0], MAX_CUSTOM_LEN); - pEid = (PEID_STRUCT) pVIE; + pEid = (struct rt_eid *) pVIE; while ((Length + 2 + (u16)pEid->Len) <= LengthVIE) { switch (pEid->Eid) { case IE_WPA: @@ -3809,7 +3809,7 @@ void BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, u8 *pBssid, char Ss break; } Length = Length + 2 + (u16)pEid->Len; /* Eid[1] + Len[1]+ content[Len] */ - pEid = (PEID_STRUCT) ((u8 *) pEid + 2 + pEid->Len); + pEid = (struct rt_eid *) ((u8 *) pEid + 2 + pEid->Len); } } } @@ -3837,7 +3837,7 @@ void BssEntrySet(IN PRTMP_ADAPTER pAd, OUT BSS_ENTRY * pBss, u8 *pBssid, char Ss IRQL = DISPATCH_LEVEL */ -unsigned long BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT BSS_TABLE * Tab, u8 *pBssid, char Ssid[], u8 SsidLen, u8 BssType, u16 BeaconPeriod, IN CF_PARM * CfParm, u16 AtimWin, u16 CapabilityInfo, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ +unsigned long BssTableSetEntry(struct rt_rtmp_adapter *pAd, struct rt_bss_table *Tab, u8 *pBssid, char Ssid[], u8 SsidLen, u8 BssType, u16 BeaconPeriod, struct rt_cf_parm * CfParm, u16 AtimWin, u16 CapabilityInfo, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, struct rt_ht_capability_ie * pHtCapability, struct rt_add_ht_info_ie * pAddHtInfo, /* AP might use this additional ht info IE */ u8 HtCapabilityLen, u8 AddHtInfoLen, u8 NewExtChanOffset, @@ -3845,10 +3845,10 @@ unsigned long BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT BSS_TABLE * Tab, u8 *pB char Rssi, IN LARGE_INTEGER TimeStamp, u8 CkipFlag, - IN PEDCA_PARM pEdcaParm, - IN PQOS_CAPABILITY_PARM pQosCapability, - IN PQBSS_LOAD_PARM pQbssLoad, - u16 LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE) + struct rt_edca_parm *pEdcaParm, + struct rt_qos_capability_parm *pQosCapability, + struct rt_qbss_load_parm *pQbssLoad, + u16 LengthVIE, struct rt_ndis_802_11_variable_ies *pVIE) { unsigned long Idx; @@ -3924,14 +3924,14 @@ unsigned long BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT BSS_TABLE * Tab, u8 *pB } /* IRQL = DISPATCH_LEVEL */ -void BssTableSsidSort(IN PRTMP_ADAPTER pAd, - OUT BSS_TABLE * OutTab, char Ssid[], u8 SsidLen) +void BssTableSsidSort(struct rt_rtmp_adapter *pAd, + struct rt_bss_table *OutTab, char Ssid[], u8 SsidLen) { int i; BssTableInit(OutTab); for (i = 0; i < pAd->ScanTab.BssNr; i++) { - BSS_ENTRY *pInBss = &pAd->ScanTab.BssEntry[i]; + struct rt_bss_entry *pInBss = &pAd->ScanTab.BssEntry[i]; BOOLEAN bIsHiddenApIncluded = FALSE; if (((pAd->CommonCfg.bIEEE80211H == 1) && @@ -3945,7 +3945,7 @@ void BssTableSsidSort(IN PRTMP_ADAPTER pAd, if ((pInBss->BssType == pAd->StaCfg.BssType) && (SSID_EQUAL(Ssid, SsidLen, pInBss->Ssid, pInBss->SsidLen) || bIsHiddenApIncluded)) { - BSS_ENTRY *pOutBss = &OutTab->BssEntry[OutTab->BssNr]; + struct rt_bss_entry *pOutBss = &OutTab->BssEntry[OutTab->BssNr]; /* 2.4G/5G N only mode */ if ((pInBss->HtCapabilityLen == 0) && @@ -4067,12 +4067,12 @@ void BssTableSsidSort(IN PRTMP_ADAPTER pAd, } } /* copy matching BSS from InTab to OutTab */ - NdisMoveMemory(pOutBss, pInBss, sizeof(BSS_ENTRY)); + NdisMoveMemory(pOutBss, pInBss, sizeof(struct rt_bss_entry)); OutTab->BssNr++; } else if ((pInBss->BssType == pAd->StaCfg.BssType) && (SsidLen == 0)) { - BSS_ENTRY *pOutBss = &OutTab->BssEntry[OutTab->BssNr]; + struct rt_bss_entry *pOutBss = &OutTab->BssEntry[OutTab->BssNr]; /* 2.4G/5G N only mode */ if ((pInBss->HtCapabilityLen == 0) && @@ -4167,7 +4167,7 @@ void BssTableSsidSort(IN PRTMP_ADAPTER pAd, } } /* copy matching BSS from InTab to OutTab */ - NdisMoveMemory(pOutBss, pInBss, sizeof(BSS_ENTRY)); + NdisMoveMemory(pOutBss, pInBss, sizeof(struct rt_bss_entry)); OutTab->BssNr++; } @@ -4180,33 +4180,33 @@ void BssTableSsidSort(IN PRTMP_ADAPTER pAd, } /* IRQL = DISPATCH_LEVEL */ -void BssTableSortByRssi(IN OUT BSS_TABLE * OutTab) +void BssTableSortByRssi(struct rt_bss_table *OutTab) { int i, j; - BSS_ENTRY TmpBss; + struct rt_bss_entry TmpBss; for (i = 0; i < OutTab->BssNr - 1; i++) { for (j = i + 1; j < OutTab->BssNr; j++) { if (OutTab->BssEntry[j].Rssi > OutTab->BssEntry[i].Rssi) { NdisMoveMemory(&TmpBss, &OutTab->BssEntry[j], - sizeof(BSS_ENTRY)); + sizeof(struct rt_bss_entry)); NdisMoveMemory(&OutTab->BssEntry[j], &OutTab->BssEntry[i], - sizeof(BSS_ENTRY)); + sizeof(struct rt_bss_entry)); NdisMoveMemory(&OutTab->BssEntry[i], &TmpBss, - sizeof(BSS_ENTRY)); + sizeof(struct rt_bss_entry)); } } } } -void BssCipherParse(IN OUT PBSS_ENTRY pBss) +void BssCipherParse(struct rt_bss_entry *pBss) { - PEID_STRUCT pEid; + struct rt_eid * pEid; u8 *pTmp; - PRSN_IE_HEADER_STRUCT pRsnHeader; - PCIPHER_SUITE_STRUCT pCipher; - PAKM_SUITE_STRUCT pAKM; + struct rt_rsn_ie_header * pRsnHeader; + struct rt_cipher_suite_struct * pCipher; + struct rt_akm_suite * pAKM; u16 Count; int Length; NDIS_802_11_ENCRYPTION_STATUS TmpCipher; @@ -4242,7 +4242,7 @@ void BssCipherParse(IN OUT PBSS_ENTRY pBss) while (Length > 0) { /* Parse cipher suite base on WPA1 & WPA2, they should be parsed differently */ pTmp = ((u8 *)pBss->VarIEs) + pBss->VarIELen - Length; - pEid = (PEID_STRUCT) pTmp; + pEid = (struct rt_eid *) pTmp; switch (pEid->Eid) { case IE_WPA: if (NdisEqualMemory(pEid->Octet, SES_OUI, 3) @@ -4380,15 +4380,15 @@ void BssCipherParse(IN OUT PBSS_ENTRY pBss) break; case IE_RSN: - pRsnHeader = (PRSN_IE_HEADER_STRUCT) pTmp; + pRsnHeader = (struct rt_rsn_ie_header *) pTmp; /* 0. Version must be 1 */ if (le2cpu16(pRsnHeader->Version) != 1) break; - pTmp += sizeof(RSN_IE_HEADER_STRUCT); + pTmp += sizeof(struct rt_rsn_ie_header); /* 1. Check group cipher */ - pCipher = (PCIPHER_SUITE_STRUCT) pTmp; + pCipher = (struct rt_cipher_suite_struct *) pTmp; if (!RTMPEqualMemory(pTmp, RSN_OUI, 3)) break; @@ -4414,7 +4414,7 @@ void BssCipherParse(IN OUT PBSS_ENTRY pBss) break; } /* set to correct offset for next parsing */ - pTmp += sizeof(CIPHER_SUITE_STRUCT); + pTmp += sizeof(struct rt_cipher_suite_struct); /* 2. Get pairwise cipher counts */ /*Count = *(u16 *)pTmp; */ @@ -4425,7 +4425,7 @@ void BssCipherParse(IN OUT PBSS_ENTRY pBss) /* Parsing all unicast cipher suite */ while (Count > 0) { /* Skip OUI */ - pCipher = (PCIPHER_SUITE_STRUCT) pTmp; + pCipher = (struct rt_cipher_suite_struct *) pTmp; TmpCipher = Ndis802_11WEPDisabled; switch (pCipher->Type) { case 1: @@ -4452,7 +4452,7 @@ void BssCipherParse(IN OUT PBSS_ENTRY pBss) } else { pBss->WPA2.PairCipherAux = TmpCipher; } - pTmp += sizeof(CIPHER_SUITE_STRUCT); + pTmp += sizeof(struct rt_cipher_suite_struct); Count--; } @@ -4464,7 +4464,7 @@ void BssCipherParse(IN OUT PBSS_ENTRY pBss) /* 5. Get AKM ciphers */ /* Parsing all AKM ciphers */ while (Count > 0) { - pAKM = (PAKM_SUITE_STRUCT) pTmp; + pAKM = (struct rt_akm_suite *) pTmp; if (!RTMPEqualMemory(pTmp, RSN_OUI, 3)) break; @@ -4499,7 +4499,7 @@ void BssCipherParse(IN OUT PBSS_ENTRY pBss) Ndis802_11AuthModeMax; break; } - pTmp += (Count * sizeof(AKM_SUITE_STRUCT)); + pTmp += (Count * sizeof(struct rt_akm_suite)); Count--; } @@ -4546,7 +4546,7 @@ void BssCipherParse(IN OUT PBSS_ENTRY pBss) * \pre * \post */ -void MacAddrRandomBssid(IN PRTMP_ADAPTER pAd, u8 *pAddr) +void MacAddrRandomBssid(struct rt_rtmp_adapter *pAd, u8 *pAddr) { int i; @@ -4572,12 +4572,12 @@ void MacAddrRandomBssid(IN PRTMP_ADAPTER pAd, u8 *pAddr) IRQL = DISPATCH_LEVEL */ -void MgtMacHeaderInit(IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, +void MgtMacHeaderInit(struct rt_rtmp_adapter *pAd, + struct rt_header_802_11 * pHdr80211, u8 SubType, u8 ToDs, u8 *pDA, u8 *pBssid) { - NdisZeroMemory(pHdr80211, sizeof(HEADER_802_11)); + NdisZeroMemory(pHdr80211, sizeof(struct rt_header_802_11)); pHdr80211->FC.Type = BTYPE_MGMT; pHdr80211->FC.SubType = SubType; @@ -4650,7 +4650,7 @@ unsigned long MakeOutgoingFrame(u8 * Buffer, unsigned long * FrameLen, ...) IRQL = PASSIVE_LEVEL */ -int MlmeQueueInit(IN MLME_QUEUE * Queue) +int MlmeQueueInit(struct rt_mlme_queue *Queue) { int i; @@ -4684,12 +4684,12 @@ int MlmeQueueInit(IN MLME_QUEUE * Queue) IRQL = DISPATCH_LEVEL */ -BOOLEAN MlmeEnqueue(IN PRTMP_ADAPTER pAd, +BOOLEAN MlmeEnqueue(struct rt_rtmp_adapter *pAd, unsigned long Machine, unsigned long MsgType, unsigned long MsgLen, void * Msg) { int Tail; - MLME_QUEUE *Queue = (MLME_QUEUE *) & pAd->Mlme.Queue; + struct rt_mlme_queue *Queue = (struct rt_mlme_queue *)& pAd->Mlme.Queue; /* Do nothing if the driver is starting halt state. */ /* This might happen when timer already been fired before cancel timer with mlmehalt */ @@ -4744,7 +4744,7 @@ BOOLEAN MlmeEnqueue(IN PRTMP_ADAPTER pAd, IRQL = DISPATCH_LEVEL */ -BOOLEAN MlmeEnqueueForRecv(IN PRTMP_ADAPTER pAd, +BOOLEAN MlmeEnqueueForRecv(struct rt_rtmp_adapter *pAd, unsigned long Wcid, unsigned long TimeStampHigh, unsigned long TimeStampLow, @@ -4754,9 +4754,9 @@ BOOLEAN MlmeEnqueueForRecv(IN PRTMP_ADAPTER pAd, unsigned long MsgLen, void * Msg, u8 Signal) { int Tail, Machine; - PFRAME_802_11 pFrame = (PFRAME_802_11) Msg; + struct rt_frame_802_11 * pFrame = (struct rt_frame_802_11 *) Msg; int MsgType; - MLME_QUEUE *Queue = (MLME_QUEUE *) & pAd->Mlme.Queue; + struct rt_mlme_queue *Queue = (struct rt_mlme_queue *)& pAd->Mlme.Queue; /* Do nothing if the driver is starting halt state. */ /* This might happen when timer already been fired before cancel timer with mlmehalt */ @@ -4826,7 +4826,7 @@ BOOLEAN MlmeEnqueueForRecv(IN PRTMP_ADAPTER pAd, IRQL = DISPATCH_LEVEL */ -BOOLEAN MlmeDequeue(IN MLME_QUEUE * Queue, OUT MLME_QUEUE_ELEM ** Elem) +BOOLEAN MlmeDequeue(struct rt_mlme_queue *Queue, struct rt_mlme_queue_elem ** Elem) { NdisAcquireSpinLock(&(Queue->Lock)); *Elem = &(Queue->Entry[Queue->Head]); @@ -4840,10 +4840,10 @@ BOOLEAN MlmeDequeue(IN MLME_QUEUE * Queue, OUT MLME_QUEUE_ELEM ** Elem) } /* IRQL = DISPATCH_LEVEL */ -void MlmeRestartStateMachine(IN PRTMP_ADAPTER pAd) +void MlmeRestartStateMachine(struct rt_rtmp_adapter *pAd) { #ifdef RTMP_MAC_PCI - MLME_QUEUE_ELEM *Elem = NULL; + struct rt_mlme_queue_elem *Elem = NULL; #endif /* RTMP_MAC_PCI // */ BOOLEAN Cancelled; @@ -4919,7 +4919,7 @@ void MlmeRestartStateMachine(IN PRTMP_ADAPTER pAd) IRQL = DISPATCH_LEVEL */ -BOOLEAN MlmeQueueEmpty(IN MLME_QUEUE * Queue) +BOOLEAN MlmeQueueEmpty(struct rt_mlme_queue *Queue) { BOOLEAN Ans; @@ -4940,7 +4940,7 @@ BOOLEAN MlmeQueueEmpty(IN MLME_QUEUE * Queue) IRQL = DISPATCH_LEVEL */ -BOOLEAN MlmeQueueFull(IN MLME_QUEUE * Queue) +BOOLEAN MlmeQueueFull(struct rt_mlme_queue *Queue) { BOOLEAN Ans; @@ -4962,7 +4962,7 @@ BOOLEAN MlmeQueueFull(IN MLME_QUEUE * Queue) IRQL = PASSIVE_LEVEL */ -void MlmeQueueDestroy(IN MLME_QUEUE * pQueue) +void MlmeQueueDestroy(struct rt_mlme_queue *pQueue) { NdisAcquireSpinLock(&(pQueue->Lock)); pQueue->Num = 0; @@ -4983,8 +4983,8 @@ void MlmeQueueDestroy(IN MLME_QUEUE * pQueue) IRQL = DISPATCH_LEVEL */ -BOOLEAN MsgTypeSubst(IN PRTMP_ADAPTER pAd, - IN PFRAME_802_11 pFrame, +BOOLEAN MsgTypeSubst(struct rt_rtmp_adapter *pAd, + struct rt_frame_802_11 * pFrame, int * Machine, int * MsgType) { u16 Seq, Alg; @@ -5097,7 +5097,7 @@ BOOLEAN MsgTypeSubst(IN PRTMP_ADAPTER pAd, IRQL = PASSIVE_LEVEL */ -void StateMachineInit(IN STATE_MACHINE * S, +void StateMachineInit(struct rt_state_machine *S, IN STATE_MACHINE_FUNC Trans[], unsigned long StNr, unsigned long MsgNr, @@ -5135,7 +5135,7 @@ void StateMachineInit(IN STATE_MACHINE * S, IRQL = PASSIVE_LEVEL */ -void StateMachineSetAction(IN STATE_MACHINE * S, +void StateMachineSetAction(struct rt_state_machine *S, unsigned long St, unsigned long Msg, IN STATE_MACHINE_FUNC Func) { @@ -5158,8 +5158,8 @@ void StateMachineSetAction(IN STATE_MACHINE * S, IRQL = DISPATCH_LEVEL */ -void StateMachinePerformAction(IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE * S, IN MLME_QUEUE_ELEM * Elem) +void StateMachinePerformAction(struct rt_rtmp_adapter *pAd, + struct rt_state_machine *S, struct rt_mlme_queue_elem *Elem) { (*(S->TransFunc[S->CurrState * S->NrMsg + Elem->MsgType - S->Base])) (pAd, Elem); @@ -5173,7 +5173,7 @@ void StateMachinePerformAction(IN PRTMP_ADAPTER pAd, StateMachinePerformAction() ========================================================================== */ -void Drop(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void Drop(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { } @@ -5189,7 +5189,7 @@ void Drop(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void LfsrInit(IN PRTMP_ADAPTER pAd, unsigned long Seed) +void LfsrInit(struct rt_rtmp_adapter *pAd, unsigned long Seed) { if (Seed == 0) pAd->Mlme.ShiftReg = 1; @@ -5202,7 +5202,7 @@ void LfsrInit(IN PRTMP_ADAPTER pAd, unsigned long Seed) Description: ========================================================================== */ -u8 RandomByte(IN PRTMP_ADAPTER pAd) +u8 RandomByte(struct rt_rtmp_adapter *pAd) { unsigned long i; u8 R, Result; @@ -5244,7 +5244,7 @@ u8 RandomByte(IN PRTMP_ADAPTER pAd) ======================================================================== */ -void RTMPCheckRates(IN PRTMP_ADAPTER pAd, +void RTMPCheckRates(struct rt_rtmp_adapter *pAd, IN u8 SupRate[], IN u8 * SupRateLen) { u8 RateIdx, i, j; @@ -5267,7 +5267,7 @@ void RTMPCheckRates(IN PRTMP_ADAPTER pAd, NdisMoveMemory(SupRate, NewRate, NewRateLen); } -BOOLEAN RTMPCheckChannel(IN PRTMP_ADAPTER pAd, +BOOLEAN RTMPCheckChannel(struct rt_rtmp_adapter *pAd, u8 CentralChannel, u8 Channel) { u8 k; @@ -5320,10 +5320,10 @@ BOOLEAN RTMPCheckChannel(IN PRTMP_ADAPTER pAd, ======================================================================== */ -BOOLEAN RTMPCheckHt(IN PRTMP_ADAPTER pAd, +BOOLEAN RTMPCheckHt(struct rt_rtmp_adapter *pAd, u8 Wcid, - IN HT_CAPABILITY_IE * pHtCapability, - IN ADD_HT_INFO_IE * pAddHtInfo) + struct rt_ht_capability_ie * pHtCapability, + struct rt_add_ht_info_ie * pAddHtInfo) { if (Wcid >= MAX_LEN_OF_MAC_TABLE) return FALSE; @@ -5449,7 +5449,7 @@ BOOLEAN RTMPCheckHt(IN PRTMP_ADAPTER pAd, ======================================================================== */ -void RTMPUpdateMlmeRate(IN PRTMP_ADAPTER pAd) +void RTMPUpdateMlmeRate(struct rt_rtmp_adapter *pAd) { u8 MinimumRate; u8 ProperMlmeRate; /*= RATE_54; */ @@ -5558,7 +5558,7 @@ void RTMPUpdateMlmeRate(IN PRTMP_ADAPTER pAd) pAd->CommonCfg.MlmeTransmit.word)); } -char RTMPMaxRssi(IN PRTMP_ADAPTER pAd, +char RTMPMaxRssi(struct rt_rtmp_adapter *pAd, char Rssi0, char Rssi1, char Rssi2) { char larger = -127; @@ -5594,7 +5594,7 @@ char RTMPMaxRssi(IN PRTMP_ADAPTER pAd, ======================================================================== */ -void AsicEvaluateRxAnt(IN PRTMP_ADAPTER pAd) +void AsicEvaluateRxAnt(struct rt_rtmp_adapter *pAd) { u8 BBPR3 = 0; @@ -5677,7 +5677,7 @@ void AsicRxAntEvalTimeout(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)FunctionContext; u8 BBPR3 = 0; char larger = -127, rssi0, rssi1, rssi2; @@ -5749,7 +5749,7 @@ void APSDPeriodicExec(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)FunctionContext; if (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)) return; @@ -5784,7 +5784,7 @@ void APSDPeriodicExec(void *SystemSpecific1, ======================================================================== */ -void RTMPSetPiggyBack(IN PRTMP_ADAPTER pAd, IN BOOLEAN bPiggyBack) +void RTMPSetPiggyBack(struct rt_rtmp_adapter *pAd, IN BOOLEAN bPiggyBack) { TX_LINK_CFG_STRUC TxLinkCfg; @@ -5809,8 +5809,8 @@ void RTMPSetPiggyBack(IN PRTMP_ADAPTER pAd, IN BOOLEAN bPiggyBack) ======================================================================== */ -BOOLEAN RTMPCheckEntryEnableAutoRateSwitch(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry) +BOOLEAN RTMPCheckEntryEnableAutoRateSwitch(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry) { BOOLEAN result = TRUE; @@ -5826,7 +5826,7 @@ BOOLEAN RTMPCheckEntryEnableAutoRateSwitch(IN PRTMP_ADAPTER pAd, return result; } -BOOLEAN RTMPAutoRateSwitchCheck(IN PRTMP_ADAPTER pAd) +BOOLEAN RTMPAutoRateSwitchCheck(struct rt_rtmp_adapter *pAd) { { if (pAd->StaCfg.bAutoTxRateSwitch) @@ -5850,7 +5850,7 @@ BOOLEAN RTMPAutoRateSwitchCheck(IN PRTMP_ADAPTER pAd) ======================================================================== */ -u8 RTMPStaFixedTxMode(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry) +u8 RTMPStaFixedTxMode(struct rt_rtmp_adapter *pAd, struct rt_mac_table_entry *pEntry) { u8 tx_mode = FIXED_TXMODE_HT; @@ -5878,7 +5878,7 @@ u8 RTMPStaFixedTxMode(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry) ======================================================================== */ -void RTMPUpdateLegacyTxSetting(u8 fixed_tx_mode, PMAC_TABLE_ENTRY pEntry) +void RTMPUpdateLegacyTxSetting(u8 fixed_tx_mode, struct rt_mac_table_entry *pEntry) { HTTRANSMIT_SETTING TransmitSetting; @@ -5921,7 +5921,7 @@ void RTMPUpdateLegacyTxSetting(u8 fixed_tx_mode, PMAC_TABLE_ENTRY pEntry) ========================================================================== */ -void AsicStaBbpTuning(IN PRTMP_ADAPTER pAd) +void AsicStaBbpTuning(struct rt_rtmp_adapter *pAd) { u8 OrigR66Value = 0, R66; /*, R66UpperBound = 0x30, R66LowerBound = 0x30; */ char Rssi; @@ -6033,7 +6033,7 @@ void AsicStaBbpTuning(IN PRTMP_ADAPTER pAd) } } -void RTMPSetAGCInitValue(IN PRTMP_ADAPTER pAd, u8 BandWidth) +void RTMPSetAGCInitValue(struct rt_rtmp_adapter *pAd, u8 BandWidth) { u8 R66 = 0x30; diff --git a/drivers/staging/rt2860/common/rt_channel.c b/drivers/staging/rt2860/common/rt_channel.c index 3fe5d9762b2c..538798981177 100644 --- a/drivers/staging/rt2860/common/rt_channel.c +++ b/drivers/staging/rt2860/common/rt_channel.c @@ -26,7 +26,7 @@ */ #include "../rt_config.h" -CH_FREQ_MAP CH_HZ_ID_MAP[] = { +struct rt_ch_freq_map CH_HZ_ID_MAP[] = { {1, 2412} , {2, 2417} @@ -144,9 +144,9 @@ CH_FREQ_MAP CH_HZ_ID_MAP[] = { , /* Japan, means J16 */ }; -int CH_HZ_ID_MAP_NUM = (sizeof(CH_HZ_ID_MAP) / sizeof(CH_FREQ_MAP)); +int CH_HZ_ID_MAP_NUM = (sizeof(CH_HZ_ID_MAP) / sizeof(struct rt_ch_freq_map)); -CH_REGION ChRegion[] = { +struct rt_ch_region ChRegion[] = { { /* Antigua and Berbuda */ "AG", CE, @@ -1422,10 +1422,10 @@ CH_REGION ChRegion[] = { , }; -static PCH_REGION GetChRegion(u8 *CntryCode) +static struct rt_ch_region *GetChRegion(u8 *CntryCode) { int loop = 0; - PCH_REGION pChRegion = NULL; + struct rt_ch_region *pChRegion = NULL; while (strcmp((char *)ChRegion[loop].CountReg, "") != 0) { if (strncmp @@ -1461,8 +1461,8 @@ static void ChBandCheck(u8 PhyMode, u8 *pChType) } } -static u8 FillChList(IN PRTMP_ADAPTER pAd, - IN PCH_DESP pChDesp, +static u8 FillChList(struct rt_rtmp_adapter *pAd, + struct rt_ch_desp *pChDesp, u8 Offset, u8 increment) { int i, j, l; @@ -1494,12 +1494,12 @@ static u8 FillChList(IN PRTMP_ADAPTER pAd, return j; } -static inline void CreateChList(IN PRTMP_ADAPTER pAd, - IN PCH_REGION pChRegion, u8 Geography) +static inline void CreateChList(struct rt_rtmp_adapter *pAd, + struct rt_ch_region *pChRegion, u8 Geography) { int i; u8 offset = 0; - PCH_DESP pChDesp; + struct rt_ch_desp *pChDesp; u8 ChType; u8 increment; @@ -1532,21 +1532,21 @@ static inline void CreateChList(IN PRTMP_ADAPTER pAd, } } -void BuildChannelListEx(IN PRTMP_ADAPTER pAd) +void BuildChannelListEx(struct rt_rtmp_adapter *pAd) { - PCH_REGION pChReg; + struct rt_ch_region *pChReg; pChReg = GetChRegion(pAd->CommonCfg.CountryCode); CreateChList(pAd, pChReg, pAd->CommonCfg.Geography); } -void BuildBeaconChList(IN PRTMP_ADAPTER pAd, +void BuildBeaconChList(struct rt_rtmp_adapter *pAd, u8 *pBuf, unsigned long *pBufLen) { int i; unsigned long TmpLen; - PCH_REGION pChRegion; - PCH_DESP pChDesp; + struct rt_ch_region *pChRegion; + struct rt_ch_desp *pChDesp; u8 ChType; pChRegion = GetChRegion(pAd->CommonCfg.CountryCode); @@ -1581,7 +1581,7 @@ void BuildBeaconChList(IN PRTMP_ADAPTER pAd, } } -static BOOLEAN IsValidChannel(IN PRTMP_ADAPTER pAd, u8 channel) +static BOOLEAN IsValidChannel(struct rt_rtmp_adapter *pAd, u8 channel) { int i; @@ -1608,7 +1608,7 @@ static u8 GetExtCh(u8 Channel, u8 Direction) return ExtCh; } -void N_ChannelCheck(IN PRTMP_ADAPTER pAd) +void N_ChannelCheck(struct rt_rtmp_adapter *pAd) { /*u8 ChannelNum = pAd->ChannelListNum; */ u8 Channel = pAd->CommonCfg.Channel; @@ -1670,7 +1670,7 @@ void N_ChannelCheck(IN PRTMP_ADAPTER pAd) } -void N_SetCenCh(IN PRTMP_ADAPTER pAd) +void N_SetCenCh(struct rt_rtmp_adapter *pAd) { if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40) { if (pAd->CommonCfg.RegTransmitSetting.field.EXTCHA == @@ -1690,7 +1690,7 @@ void N_SetCenCh(IN PRTMP_ADAPTER pAd) } } -u8 GetCuntryMaxTxPwr(IN PRTMP_ADAPTER pAd, u8 channel) +u8 GetCuntryMaxTxPwr(struct rt_rtmp_adapter *pAd, u8 channel) { int i; for (i = 0; i < pAd->ChannelListNum; i++) { diff --git a/drivers/staging/rt2860/common/rt_rf.c b/drivers/staging/rt2860/common/rt_rf.c index 6d6ca32691ff..fb0ca88fa3ea 100644 --- a/drivers/staging/rt2860/common/rt_rf.c +++ b/drivers/staging/rt2860/common/rt_rf.c @@ -53,7 +53,7 @@ ======================================================================== */ -int RT30xxWriteRFRegister(IN PRTMP_ADAPTER pAd, +int RT30xxWriteRFRegister(struct rt_rtmp_adapter *pAd, u8 regID, u8 value) { RF_CSR_CFG_STRUC rfcsr; @@ -101,7 +101,7 @@ int RT30xxWriteRFRegister(IN PRTMP_ADAPTER pAd, ======================================================================== */ -int RT30xxReadRFRegister(IN PRTMP_ADAPTER pAd, +int RT30xxReadRFRegister(struct rt_rtmp_adapter *pAd, u8 regID, u8 *pValue) { RF_CSR_CFG_STRUC rfcsr; @@ -139,15 +139,15 @@ int RT30xxReadRFRegister(IN PRTMP_ADAPTER pAd, return STATUS_SUCCESS; } -void NICInitRFRegisters(IN RTMP_ADAPTER * pAd) +void NICInitRFRegisters(struct rt_rtmp_adapter *pAd) { if (pAd->chipOps.AsicRfInit) pAd->chipOps.AsicRfInit(pAd); } -void RtmpChipOpsRFHook(IN RTMP_ADAPTER * pAd) +void RtmpChipOpsRFHook(struct rt_rtmp_adapter *pAd) { - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + struct rt_rtmp_chip_op *pChipOps = &pAd->chipOps; pChipOps->pRFRegTable = NULL; pChipOps->AsicRfInit = NULL; diff --git a/drivers/staging/rt2860/common/rtmp_init.c b/drivers/staging/rt2860/common/rtmp_init.c index 5cda0ea53f3b..46e7a2a41125 100644 --- a/drivers/staging/rt2860/common/rtmp_init.c +++ b/drivers/staging/rt2860/common/rtmp_init.c @@ -43,7 +43,7 @@ char *CipherName[] = /* */ /* BBP register initialization set */ /* */ -REG_PAIR BBPRegTable[] = { +struct rt_reg_pair BBPRegTable[] = { {BBP_R65, 0x2C}, /* fix rssi issue */ {BBP_R66, 0x38}, /* Also set this default value to pAd->BbpTuning.R66CurrentValue at initial */ {BBP_R69, 0x12}, @@ -61,13 +61,13 @@ REG_PAIR BBPRegTable[] = { {BBP_R106, 0x35}, /* for ShortGI throughput */ }; -#define NUM_BBP_REG_PARMS (sizeof(BBPRegTable) / sizeof(REG_PAIR)) +#define NUM_BBP_REG_PARMS (sizeof(BBPRegTable) / sizeof(struct rt_reg_pair)) /* */ /* ASIC register initialization sets */ /* */ -RTMP_REG_PAIR MACRegTable[] = { +struct rt_rtmp_reg_pair MACRegTable[] = { #if defined(HW_BEACON_OFFSET) && (HW_BEACON_OFFSET == 0x200) {BCN_OFFSET0, 0xf8f0e8e0}, /* 0x3800(e0), 0x3A00(e8), 0x3C00(f0), 0x3E00(f8), 512B for each beacon */ {BCN_OFFSET1, 0x6f77d0c8}, /* 0x3200(c8), 0x3400(d0), 0x1DC0(77), 0x1BC0(6f), 512B for each beacon */ @@ -124,20 +124,20 @@ RTMP_REG_PAIR MACRegTable[] = { {PWR_PIN_CFG, 0x00000003}, /* patch for 2880-E */ }; -RTMP_REG_PAIR STAMACRegTable[] = { +struct rt_rtmp_reg_pair STAMACRegTable[] = { {WMM_AIFSN_CFG, 0x00002273}, {WMM_CWMIN_CFG, 0x00002344}, {WMM_CWMAX_CFG, 0x000034aa}, }; -#define NUM_MAC_REG_PARMS (sizeof(MACRegTable) / sizeof(RTMP_REG_PAIR)) -#define NUM_STA_MAC_REG_PARMS (sizeof(STAMACRegTable) / sizeof(RTMP_REG_PAIR)) +#define NUM_MAC_REG_PARMS (sizeof(MACRegTable) / sizeof(struct rt_rtmp_reg_pair)) +#define NUM_STA_MAC_REG_PARMS (sizeof(STAMACRegTable) / sizeof(struct rt_rtmp_reg_pair)) /* ======================================================================== Routine Description: - Allocate RTMP_ADAPTER data block and do some initialization + Allocate struct rt_rtmp_adapter data block and do some initialization Arguments: Adapter Pointer to our adapter @@ -153,9 +153,9 @@ RTMP_REG_PAIR STAMACRegTable[] = { ======================================================================== */ int RTMPAllocAdapterBlock(void *handle, - OUT PRTMP_ADAPTER * ppAdapter) + struct rt_rtmp_adapter * * ppAdapter) { - PRTMP_ADAPTER pAd; + struct rt_rtmp_adapter *pAd; int Status; int index; u8 *pBeaconBuf = NULL; @@ -165,7 +165,7 @@ int RTMPAllocAdapterBlock(void *handle, *ppAdapter = NULL; do { - /* Allocate RTMP_ADAPTER memory block */ + /* Allocate struct rt_rtmp_adapter memory block */ pBeaconBuf = kmalloc(MAX_BEACON_SIZE, MEM_ALLOC_FLAG); if (pBeaconBuf == NULL) { Status = NDIS_STATUS_FAILURE; @@ -182,7 +182,7 @@ int RTMPAllocAdapterBlock(void *handle, pAd->BeaconBuf = pBeaconBuf; DBGPRINT(RT_DEBUG_OFF, ("\n\n=== pAd = %p, size = %d ===\n\n", pAd, - (u32)sizeof(RTMP_ADAPTER))); + (u32)sizeof(struct rt_rtmp_adapter))); /* Init spin locks */ NdisAllocateSpinLock(&pAd->MgmtRingLock); @@ -230,7 +230,7 @@ int RTMPAllocAdapterBlock(void *handle, ======================================================================== */ -void RTMPReadTxPwrPerRate(IN PRTMP_ADAPTER pAd) +void RTMPReadTxPwrPerRate(struct rt_rtmp_adapter *pAd) { unsigned long data, Adata, Gdata; u16 i, value, value2; @@ -441,7 +441,7 @@ void RTMPReadTxPwrPerRate(IN PRTMP_ADAPTER pAd) ======================================================================== */ -void RTMPReadChannelPwr(IN PRTMP_ADAPTER pAd) +void RTMPReadChannelPwr(struct rt_rtmp_adapter *pAd) { u8 i, choffset; EEPROM_TX_PWR_STRUC Power; @@ -650,7 +650,7 @@ void RTMPReadChannelPwr(IN PRTMP_ADAPTER pAd) ======================================================================== */ -int NICReadRegParameters(IN PRTMP_ADAPTER pAd, +int NICReadRegParameters(struct rt_rtmp_adapter *pAd, void *WrapperConfigurationContext) { int Status = NDIS_STATUS_SUCCESS; @@ -676,7 +676,7 @@ int NICReadRegParameters(IN PRTMP_ADAPTER pAd, ======================================================================== */ -void NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, u8 *mac_addr) +void NICReadEEPROMParameters(struct rt_rtmp_adapter *pAd, u8 *mac_addr) { u32 data = 0; u16 i, value, value2; @@ -1133,7 +1133,7 @@ void NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, u8 *mac_addr) ======================================================================== */ -void NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) +void NICInitAsicFromEEPROM(struct rt_rtmp_adapter *pAd) { u32 data = 0; u8 BBPR1 = 0; @@ -1242,7 +1242,7 @@ void NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) #ifdef RTMP_MAC_PCI #ifdef RT30xx if (IS_RT3090(pAd) || IS_RT3572(pAd) || IS_RT3390(pAd)) { - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + struct rt_rtmp_chip_op *pChipOps = &pAd->chipOps; if (pChipOps->AsicReverseRfFromSleepMode) pChipOps->AsicReverseRfFromSleepMode(pAd); } @@ -1366,7 +1366,7 @@ void NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd) ======================================================================== */ -int NICInitializeAdapter(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) +int NICInitializeAdapter(struct rt_rtmp_adapter *pAd, IN BOOLEAN bHardReset) { int Status = NDIS_STATUS_SUCCESS; WPDMA_GLO_CFG_STRUC GloCfg; @@ -1562,7 +1562,7 @@ retry: ======================================================================== */ -int NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) +int NICInitializeAsic(struct rt_rtmp_adapter *pAd, IN BOOLEAN bHardReset) { unsigned long Index = 0; u8 R0 = 0xff; @@ -1929,7 +1929,7 @@ int NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset) ======================================================================== */ -void NICIssueReset(IN PRTMP_ADAPTER pAd) +void NICIssueReset(struct rt_rtmp_adapter *pAd) { u32 Value = 0; DBGPRINT(RT_DEBUG_TRACE, ("--> NICIssueReset\n")); @@ -1965,15 +1965,15 @@ void NICIssueReset(IN PRTMP_ADAPTER pAd) ======================================================================== */ -BOOLEAN NICCheckForHang(IN PRTMP_ADAPTER pAd) +BOOLEAN NICCheckForHang(struct rt_rtmp_adapter *pAd) { return (FALSE); } -void NICUpdateFifoStaCounters(IN PRTMP_ADAPTER pAd) +void NICUpdateFifoStaCounters(struct rt_rtmp_adapter *pAd) { TX_STA_FIFO_STRUC StaFifo; - MAC_TABLE_ENTRY *pEntry; + struct rt_mac_table_entry *pEntry; u8 i = 0; u8 pid = 0, wcid = 0; char reTry; @@ -2094,7 +2094,7 @@ void NICUpdateFifoStaCounters(IN PRTMP_ADAPTER pAd) ======================================================================== */ -void NICUpdateRawCounters(IN PRTMP_ADAPTER pAd) +void NICUpdateRawCounters(struct rt_rtmp_adapter *pAd) { u32 OldValue; /*, Value2; */ /*unsigned long PageSum, OneSecTransmitCount; */ @@ -2114,7 +2114,7 @@ void NICUpdateRawCounters(IN PRTMP_ADAPTER pAd) TX_AGG_CNT5_STRUC TxAggCnt5; TX_AGG_CNT6_STRUC TxAggCnt6; TX_AGG_CNT7_STRUC TxAggCnt7; - COUNTER_RALINK *pRalinkCounters; + struct rt_counter_ralink *pRalinkCounters; pRalinkCounters = &pAd->RalinkCounters; @@ -2299,7 +2299,7 @@ void NICUpdateRawCounters(IN PRTMP_ADAPTER pAd) ======================================================================== */ -void NICResetFromError(IN PRTMP_ADAPTER pAd) +void NICResetFromError(struct rt_rtmp_adapter *pAd) { /* Reset BBP (according to alex, reset ASIC will force reset BBP */ /* Therefore, skip the reset BBP */ @@ -2317,7 +2317,7 @@ void NICResetFromError(IN PRTMP_ADAPTER pAd) AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); } -int NICLoadFirmware(IN PRTMP_ADAPTER pAd) +int NICLoadFirmware(struct rt_rtmp_adapter *pAd) { int status = NDIS_STATUS_SUCCESS; if (pAd->chipOps.loadFirmware) @@ -2339,7 +2339,7 @@ int NICLoadFirmware(IN PRTMP_ADAPTER pAd) ======================================================================== */ -void NICEraseFirmware(IN PRTMP_ADAPTER pAd) +void NICEraseFirmware(struct rt_rtmp_adapter *pAd) { if (pAd->chipOps.eraseFirmware) pAd->chipOps.eraseFirmware(pAd); @@ -2367,7 +2367,7 @@ void NICEraseFirmware(IN PRTMP_ADAPTER pAd) ======================================================================== */ -int NICLoadRateSwitchingParams(IN PRTMP_ADAPTER pAd) +int NICLoadRateSwitchingParams(struct rt_rtmp_adapter *pAd) { return NDIS_STATUS_SUCCESS; } @@ -2500,7 +2500,7 @@ void RTMPMoveMemory(void *pDest, void *pSrc, unsigned long Length) ======================================================================== */ -void UserCfgInit(IN PRTMP_ADAPTER pAd) +void UserCfgInit(struct rt_rtmp_adapter *pAd) { u32 key_index, bss_index; @@ -2673,7 +2673,7 @@ void UserCfgInit(IN PRTMP_ADAPTER pAd) pAd->CommonCfg.NdisRadioStateOff = FALSE; /* New to support microsoft disable radio with OID command */ pAd->StaCfg.RssiTrigger = 0; - NdisZeroMemory(&pAd->StaCfg.RssiSample, sizeof(RSSI_SAMPLE)); + NdisZeroMemory(&pAd->StaCfg.RssiSample, sizeof(struct rt_rssi_sample)); pAd->StaCfg.RssiTriggerMode = RSSI_TRIGGERED_UPON_BELOW_THRESHOLD; pAd->StaCfg.AtimWin = 0; @@ -2793,7 +2793,7 @@ void UserCfgInit(IN PRTMP_ADAPTER pAd) /*pAd->bTest1 = FALSE; */ /* initialize MAC table and allocate spin lock */ - NdisZeroMemory(&pAd->MacTab, sizeof(MAC_TABLE)); + NdisZeroMemory(&pAd->MacTab, sizeof(struct rt_mac_table)); InitializeQueueHeader(&pAd->MacTab.McastPsQueue); NdisAllocateSpinLock(&pAd->MacTabLock); @@ -2875,8 +2875,8 @@ void AtoH(char *src, u8 *dest, int destlen) ======================================================================== */ -void RTMPInitTimer(IN PRTMP_ADAPTER pAd, - IN PRALINK_TIMER_STRUCT pTimer, +void RTMPInitTimer(struct rt_rtmp_adapter *pAd, + struct rt_ralink_timer *pTimer, void *pTimerFunc, void *pData, IN BOOLEAN Repeat) { /* */ @@ -2915,7 +2915,7 @@ void RTMPInitTimer(IN PRTMP_ADAPTER pAd, ======================================================================== */ -void RTMPSetTimer(IN PRALINK_TIMER_STRUCT pTimer, unsigned long Value) +void RTMPSetTimer(struct rt_ralink_timer *pTimer, unsigned long Value) { if (pTimer->Valid) { pTimer->TimerValue = Value; @@ -2950,7 +2950,7 @@ void RTMPSetTimer(IN PRALINK_TIMER_STRUCT pTimer, unsigned long Value) ======================================================================== */ -void RTMPModTimer(IN PRALINK_TIMER_STRUCT pTimer, unsigned long Value) +void RTMPModTimer(struct rt_ralink_timer *pTimer, unsigned long Value) { BOOLEAN Cancel; @@ -2989,7 +2989,7 @@ void RTMPModTimer(IN PRALINK_TIMER_STRUCT pTimer, unsigned long Value) ======================================================================== */ -void RTMPCancelTimer(IN PRALINK_TIMER_STRUCT pTimer, OUT BOOLEAN * pCancelled) +void RTMPCancelTimer(struct rt_ralink_timer *pTimer, OUT BOOLEAN * pCancelled) { if (pTimer->Valid) { if (pTimer->State == FALSE) @@ -3030,7 +3030,7 @@ void RTMPCancelTimer(IN PRALINK_TIMER_STRUCT pTimer, OUT BOOLEAN * pCancelled) ======================================================================== */ -void RTMPSetLED(IN PRTMP_ADAPTER pAd, u8 Status) +void RTMPSetLED(struct rt_rtmp_adapter *pAd, u8 Status) { /*unsigned long data; */ u8 HighByte = 0; @@ -3117,7 +3117,7 @@ void RTMPSetLED(IN PRTMP_ADAPTER pAd, u8 Status) > -57 Excellent ======================================================================== */ -void RTMPSetSignalLED(IN PRTMP_ADAPTER pAd, IN NDIS_802_11_RSSI Dbm) +void RTMPSetSignalLED(struct rt_rtmp_adapter *pAd, IN NDIS_802_11_RSSI Dbm) { u8 nLed = 0; @@ -3164,7 +3164,7 @@ void RTMPSetSignalLED(IN PRTMP_ADAPTER pAd, IN NDIS_802_11_RSSI Dbm) Before Enable RX, make sure you have enabled Interrupt. ======================================================================== */ -void RTMPEnableRxTx(IN PRTMP_ADAPTER pAd) +void RTMPEnableRxTx(struct rt_rtmp_adapter *pAd) { /* WPDMA_GLO_CFG_STRUC GloCfg; */ /* unsigned long i = 0; */ @@ -3193,12 +3193,12 @@ void RTMPEnableRxTx(IN PRTMP_ADAPTER pAd) } /*+++Add by shiang, move from os/linux/rt_main_dev.c */ -void CfgInitHook(PRTMP_ADAPTER pAd) +void CfgInitHook(struct rt_rtmp_adapter *pAd) { pAd->bBroadComHT = TRUE; } -int rt28xx_init(IN PRTMP_ADAPTER pAd, +int rt28xx_init(struct rt_rtmp_adapter *pAd, char *pDefaultMac, char *pHostName) { u32 index; @@ -3476,12 +3476,12 @@ err0: /*---Add by shiang, move from os/linux/rt_main_dev.c */ -static int RtmpChipOpsRegister(IN RTMP_ADAPTER * pAd, int infType) +static int RtmpChipOpsRegister(struct rt_rtmp_adapter *pAd, int infType) { - RTMP_CHIP_OP *pChipOps = &pAd->chipOps; + struct rt_rtmp_chip_op *pChipOps = &pAd->chipOps; int status; - memset(pChipOps, 0, sizeof(RTMP_CHIP_OP)); + memset(pChipOps, 0, sizeof(struct rt_rtmp_chip_op)); /* set eeprom related hook functions */ status = RtmpChipOpsEepromHook(pAd, infType); @@ -3508,7 +3508,7 @@ static int RtmpChipOpsRegister(IN RTMP_ADAPTER * pAd, int infType) return status; } -int RtmpRaDevCtrlInit(IN RTMP_ADAPTER * pAd, IN RTMP_INF_TYPE infType) +int RtmpRaDevCtrlInit(struct rt_rtmp_adapter *pAd, IN RTMP_INF_TYPE infType) { /*void *handle; */ @@ -3535,7 +3535,7 @@ int RtmpRaDevCtrlInit(IN RTMP_ADAPTER * pAd, IN RTMP_INF_TYPE infType) return 0; } -BOOLEAN RtmpRaDevCtrlExit(IN RTMP_ADAPTER * pAd) +BOOLEAN RtmpRaDevCtrlExit(struct rt_rtmp_adapter *pAd) { RTMPFreeAdapter(pAd); @@ -3544,7 +3544,7 @@ BOOLEAN RtmpRaDevCtrlExit(IN RTMP_ADAPTER * pAd) } /* not yet support MBSS */ -struct net_device *get_netdev_from_bssid(IN PRTMP_ADAPTER pAd, u8 FromWhichBSSID) +struct net_device *get_netdev_from_bssid(struct rt_rtmp_adapter *pAd, u8 FromWhichBSSID) { struct net_device *dev_p = NULL; diff --git a/drivers/staging/rt2860/common/rtmp_mcu.c b/drivers/staging/rt2860/common/rtmp_mcu.c index 3d695278afea..683abad30f66 100644 --- a/drivers/staging/rt2860/common/rtmp_mcu.c +++ b/drivers/staging/rt2860/common/rtmp_mcu.c @@ -80,7 +80,7 @@ ======================================================================== */ -int RtmpAsicEraseFirmware(IN PRTMP_ADAPTER pAd) +int RtmpAsicEraseFirmware(struct rt_rtmp_adapter *pAd) { unsigned long i; @@ -107,7 +107,7 @@ int RtmpAsicEraseFirmware(IN PRTMP_ADAPTER pAd) ======================================================================== */ -int RtmpAsicLoadFirmware(IN PRTMP_ADAPTER pAd) +int RtmpAsicLoadFirmware(struct rt_rtmp_adapter *pAd) { int Status = NDIS_STATUS_SUCCESS; @@ -172,7 +172,7 @@ int RtmpAsicLoadFirmware(IN PRTMP_ADAPTER pAd) return Status; } -int RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, +int RtmpAsicSendCommandToMcu(struct rt_rtmp_adapter *pAd, u8 Command, u8 Token, u8 Arg0, u8 Arg1) { diff --git a/drivers/staging/rt2860/common/rtmp_timer.c b/drivers/staging/rt2860/common/rtmp_timer.c index d5648d8967d9..42e47d9dc2c9 100644 --- a/drivers/staging/rt2860/common/rtmp_timer.c +++ b/drivers/staging/rt2860/common/rtmp_timer.c @@ -74,15 +74,15 @@ BUILD_TIMER_FUNCTION(LedCtrlMain); #endif #ifdef RTMP_TIMER_TASK_SUPPORT -static void RtmpTimerQHandle(RTMP_ADAPTER * pAd) +static void RtmpTimerQHandle(struct rt_rtmp_adapter *pAd) { #ifndef KTHREAD_SUPPORT int status; #endif - RALINK_TIMER_STRUCT *pTimer; - RTMP_TIMER_TASK_ENTRY *pEntry; + struct rt_ralink_timer *pTimer; + struct rt_rtmp_timer_task_entry *pEntry; unsigned long irqFlag; - RTMP_OS_TASK *pTask; + struct rt_rtmp_os_task *pTask; pTask = &pAd->timerTask; while (!pTask->task_killed) { @@ -140,11 +140,11 @@ static void RtmpTimerQHandle(RTMP_ADAPTER * pAd) int RtmpTimerQThread(IN void *Context) { - RTMP_OS_TASK *pTask; - PRTMP_ADAPTER pAd; + struct rt_rtmp_os_task *pTask; + struct rt_rtmp_adapter *pAd; - pTask = (RTMP_OS_TASK *) Context; - pAd = (PRTMP_ADAPTER) pTask->priv; + pTask = (struct rt_rtmp_os_task *)Context; + pAd = (struct rt_rtmp_adapter *)pTask->priv; RtmpOSTaskCustomize(pTask); @@ -174,12 +174,12 @@ int RtmpTimerQThread(IN void *Context) } -RTMP_TIMER_TASK_ENTRY *RtmpTimerQInsert(IN RTMP_ADAPTER * pAd, - IN RALINK_TIMER_STRUCT * pTimer) +struct rt_rtmp_timer_task_entry *RtmpTimerQInsert(struct rt_rtmp_adapter *pAd, + struct rt_ralink_timer *pTimer) { - RTMP_TIMER_TASK_ENTRY *pQNode = NULL, *pQTail; + struct rt_rtmp_timer_task_entry *pQNode = NULL, *pQTail; unsigned long irqFlags; - RTMP_OS_TASK *pTask = &pAd->timerTask; + struct rt_rtmp_os_task *pTask = &pAd->timerTask; RTMP_INT_LOCK(&pAd->TimerQLock, irqFlags); if (pAd->TimerQ.status & RTMP_TASK_CAN_DO_INSERT) { @@ -211,9 +211,9 @@ RTMP_TIMER_TASK_ENTRY *RtmpTimerQInsert(IN RTMP_ADAPTER * pAd, return pQNode; } -BOOLEAN RtmpTimerQRemove(IN RTMP_ADAPTER * pAd, IN RALINK_TIMER_STRUCT * pTimer) +BOOLEAN RtmpTimerQRemove(struct rt_rtmp_adapter *pAd, struct rt_ralink_timer *pTimer) { - RTMP_TIMER_TASK_ENTRY *pNode, *pPrev = NULL; + struct rt_rtmp_timer_task_entry *pNode, *pPrev = NULL; unsigned long irqFlags; RTMP_INT_LOCK(&pAd->TimerQLock, irqFlags); @@ -245,9 +245,9 @@ BOOLEAN RtmpTimerQRemove(IN RTMP_ADAPTER * pAd, IN RALINK_TIMER_STRUCT * pTimer) return TRUE; } -void RtmpTimerQExit(RTMP_ADAPTER * pAd) +void RtmpTimerQExit(struct rt_rtmp_adapter *pAd) { - RTMP_TIMER_TASK_ENTRY *pTimerQ; + struct rt_rtmp_timer_task_entry *pTimerQ; unsigned long irqFlags; RTMP_INT_LOCK(&pAd->TimerQLock, irqFlags); @@ -267,10 +267,10 @@ void RtmpTimerQExit(RTMP_ADAPTER * pAd) } -void RtmpTimerQInit(RTMP_ADAPTER * pAd) +void RtmpTimerQInit(struct rt_rtmp_adapter *pAd) { int i; - RTMP_TIMER_TASK_ENTRY *pQNode, *pEntry; + struct rt_rtmp_timer_task_entry *pQNode, *pEntry; unsigned long irqFlags; NdisAllocateSpinLock(&pAd->TimerQLock); @@ -278,12 +278,12 @@ void RtmpTimerQInit(RTMP_ADAPTER * pAd) NdisZeroMemory(&pAd->TimerQ, sizeof(pAd->TimerQ)); os_alloc_mem(pAd, &pAd->TimerQ.pTimerQPoll, - sizeof(RTMP_TIMER_TASK_ENTRY) * TIMER_QUEUE_SIZE_MAX); + sizeof(struct rt_rtmp_timer_task_entry) * TIMER_QUEUE_SIZE_MAX); if (pAd->TimerQ.pTimerQPoll) { pEntry = NULL; - pQNode = (RTMP_TIMER_TASK_ENTRY *) pAd->TimerQ.pTimerQPoll; + pQNode = (struct rt_rtmp_timer_task_entry *)pAd->TimerQ.pTimerQPoll; NdisZeroMemory(pAd->TimerQ.pTimerQPoll, - sizeof(RTMP_TIMER_TASK_ENTRY) * + sizeof(struct rt_rtmp_timer_task_entry) * TIMER_QUEUE_SIZE_MAX); RTMP_INT_LOCK(&pAd->TimerQLock, irqFlags); diff --git a/drivers/staging/rt2860/common/spectrum.c b/drivers/staging/rt2860/common/spectrum.c index b89ad5f5a462..51e38d809333 100644 --- a/drivers/staging/rt2860/common/spectrum.c +++ b/drivers/staging/rt2860/common/spectrum.c @@ -40,7 +40,7 @@ #include "action.h" /* The regulatory information in the USA (US) */ -DOT11_REGULATORY_INFORMATION USARegulatoryInfo[] = { +struct rt_dot11_regulatory_information USARegulatoryInfo[] = { /* "regulatory class" "number of channels" "Max Tx Pwr" "channel list" */ {0, {0, 0, {0} } @@ -95,10 +95,10 @@ DOT11_REGULATORY_INFORMATION USARegulatoryInfo[] = { } }; -#define USA_REGULATORY_INFO_SIZE (sizeof(USARegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION)) +#define USA_REGULATORY_INFO_SIZE (sizeof(USARegulatoryInfo) / sizeof(struct rt_dot11_regulatory_information)) /* The regulatory information in Europe */ -DOT11_REGULATORY_INFORMATION EuropeRegulatoryInfo[] = { +struct rt_dot11_regulatory_information EuropeRegulatoryInfo[] = { /* "regulatory class" "number of channels" "Max Tx Pwr" "channel list" */ {0, {0, 0, {0} } @@ -121,10 +121,10 @@ DOT11_REGULATORY_INFORMATION EuropeRegulatoryInfo[] = { } }; -#define EU_REGULATORY_INFO_SIZE (sizeof(EuropeRegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION)) +#define EU_REGULATORY_INFO_SIZE (sizeof(EuropeRegulatoryInfo) / sizeof(struct rt_dot11_regulatory_information)) /* The regulatory information in Japan */ -DOT11_REGULATORY_INFORMATION JapanRegulatoryInfo[] = { +struct rt_dot11_regulatory_information JapanRegulatoryInfo[] = { /* "regulatory class" "number of channels" "Max Tx Pwr" "channel list" */ {0, {0, 0, {0} } @@ -259,17 +259,17 @@ DOT11_REGULATORY_INFORMATION JapanRegulatoryInfo[] = { } }; -#define JP_REGULATORY_INFO_SIZE (sizeof(JapanRegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION)) +#define JP_REGULATORY_INFO_SIZE (sizeof(JapanRegulatoryInfo) / sizeof(struct rt_dot11_regulatory_information)) -char RTMP_GetTxPwr(IN PRTMP_ADAPTER pAd, IN HTTRANSMIT_SETTING HTTxMode) +char RTMP_GetTxPwr(struct rt_rtmp_adapter *pAd, IN HTTRANSMIT_SETTING HTTxMode) { - typedef struct __TX_PWR_CFG { + struct tx_pwr_cfg { u8 Mode; u8 MCS; u16 req; u8 shift; u32 BitMask; - } TX_PWR_CFG; + }; u32 Value; int Idx; @@ -279,7 +279,7 @@ char RTMP_GetTxPwr(IN PRTMP_ADAPTER pAd, IN HTTRANSMIT_SETTING HTTxMode) char DaltaPwr; unsigned long TxPwr[5]; - TX_PWR_CFG TxPwrCfg[] = { + struct tx_pwr_cfg TxPwrCfg[] = { {MODE_CCK, 0, 0, 4, 0x000000f0}, {MODE_CCK, 1, 0, 0, 0x0000000f}, {MODE_CCK, 2, 0, 12, 0x0000f000}, @@ -310,7 +310,7 @@ char RTMP_GetTxPwr(IN PRTMP_ADAPTER pAd, IN HTTRANSMIT_SETTING HTTxMode) {MODE_HTMIX, 14, 3, 12, 0x0000f000}, {MODE_HTMIX, 15, 3, 8, 0x00000f00} }; -#define MAX_TXPWR_TAB_SIZE (sizeof(TxPwrCfg) / sizeof(TX_PWR_CFG)) +#define MAX_TXPWR_TAB_SIZE (sizeof(TxPwrCfg) / sizeof(struct tx_pwr_cfg)) CurTxPwr = 19; @@ -395,15 +395,15 @@ char RTMP_GetTxPwr(IN PRTMP_ADAPTER pAd, IN HTTRANSMIT_SETTING HTTxMode) return CurTxPwr; } -void MeasureReqTabInit(IN PRTMP_ADAPTER pAd) +void MeasureReqTabInit(struct rt_rtmp_adapter *pAd) { NdisAllocateSpinLock(&pAd->CommonCfg.MeasureReqTabLock); pAd->CommonCfg.pMeasureReqTab = - kmalloc(sizeof(MEASURE_REQ_TAB), GFP_ATOMIC); + kmalloc(sizeof(struct rt_measure_req_tab), GFP_ATOMIC); if (pAd->CommonCfg.pMeasureReqTab) NdisZeroMemory(pAd->CommonCfg.pMeasureReqTab, - sizeof(MEASURE_REQ_TAB)); + sizeof(struct rt_measure_req_tab)); else DBGPRINT(RT_DEBUG_ERROR, ("%s Fail to alloc memory for pAd->CommonCfg.pMeasureReqTab.\n", @@ -412,7 +412,7 @@ void MeasureReqTabInit(IN PRTMP_ADAPTER pAd) return; } -void MeasureReqTabExit(IN PRTMP_ADAPTER pAd) +void MeasureReqTabExit(struct rt_rtmp_adapter *pAd) { NdisFreeSpinLock(&pAd->CommonCfg.MeasureReqTabLock); @@ -423,12 +423,12 @@ void MeasureReqTabExit(IN PRTMP_ADAPTER pAd) return; } -PMEASURE_REQ_ENTRY MeasureReqLookUp(IN PRTMP_ADAPTER pAd, u8 DialogToken) +struct rt_measure_req_entry *MeasureReqLookUp(struct rt_rtmp_adapter *pAd, u8 DialogToken) { u32 HashIdx; - PMEASURE_REQ_TAB pTab = pAd->CommonCfg.pMeasureReqTab; - PMEASURE_REQ_ENTRY pEntry = NULL; - PMEASURE_REQ_ENTRY pPrevEntry = NULL; + struct rt_measure_req_tab *pTab = pAd->CommonCfg.pMeasureReqTab; + struct rt_measure_req_entry *pEntry = NULL; + struct rt_measure_req_entry *pPrevEntry = NULL; if (pTab == NULL) { DBGPRINT(RT_DEBUG_ERROR, @@ -455,12 +455,12 @@ PMEASURE_REQ_ENTRY MeasureReqLookUp(IN PRTMP_ADAPTER pAd, u8 DialogToken) return pEntry; } -PMEASURE_REQ_ENTRY MeasureReqInsert(IN PRTMP_ADAPTER pAd, u8 DialogToken) +struct rt_measure_req_entry *MeasureReqInsert(struct rt_rtmp_adapter *pAd, u8 DialogToken) { int i; unsigned long HashIdx; - PMEASURE_REQ_TAB pTab = pAd->CommonCfg.pMeasureReqTab; - PMEASURE_REQ_ENTRY pEntry = NULL, pCurrEntry; + struct rt_measure_req_tab *pTab = pAd->CommonCfg.pMeasureReqTab; + struct rt_measure_req_entry *pEntry = NULL, *pCurrEntry; unsigned long Now; if (pTab == NULL) { @@ -482,11 +482,11 @@ PMEASURE_REQ_ENTRY MeasureReqInsert(IN PRTMP_ADAPTER pAd, u8 DialogToken) lastTime + MQ_REQ_AGE_OUT))) { - PMEASURE_REQ_ENTRY pPrevEntry = NULL; + struct rt_measure_req_entry *pPrevEntry = NULL; unsigned long HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(pEntry-> DialogToken); - PMEASURE_REQ_ENTRY pProbeEntry = + struct rt_measure_req_entry *pProbeEntry = pTab->Hash[HashIdx]; /* update Hash list */ @@ -507,7 +507,7 @@ PMEASURE_REQ_ENTRY MeasureReqInsert(IN PRTMP_ADAPTER pAd, u8 DialogToken) } while (pProbeEntry); NdisZeroMemory(pEntry, - sizeof(MEASURE_REQ_ENTRY)); + sizeof(struct rt_measure_req_entry)); pTab->Size--; break; @@ -548,10 +548,10 @@ PMEASURE_REQ_ENTRY MeasureReqInsert(IN PRTMP_ADAPTER pAd, u8 DialogToken) return pEntry; } -void MeasureReqDelete(IN PRTMP_ADAPTER pAd, u8 DialogToken) +void MeasureReqDelete(struct rt_rtmp_adapter *pAd, u8 DialogToken) { - PMEASURE_REQ_TAB pTab = pAd->CommonCfg.pMeasureReqTab; - PMEASURE_REQ_ENTRY pEntry = NULL; + struct rt_measure_req_tab *pTab = pAd->CommonCfg.pMeasureReqTab; + struct rt_measure_req_entry *pEntry = NULL; if (pTab == NULL) { DBGPRINT(RT_DEBUG_ERROR, @@ -566,9 +566,9 @@ void MeasureReqDelete(IN PRTMP_ADAPTER pAd, u8 DialogToken) pEntry = MeasureReqLookUp(pAd, DialogToken); if (pEntry != NULL) { - PMEASURE_REQ_ENTRY pPrevEntry = NULL; + struct rt_measure_req_entry *pPrevEntry = NULL; unsigned long HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(pEntry->DialogToken); - PMEASURE_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx]; + struct rt_measure_req_entry *pProbeEntry = pTab->Hash[HashIdx]; RTMP_SEM_LOCK(&pAd->CommonCfg.MeasureReqTabLock); /* update Hash list */ @@ -586,7 +586,7 @@ void MeasureReqDelete(IN PRTMP_ADAPTER pAd, u8 DialogToken) pProbeEntry = pProbeEntry->pNext; } while (pProbeEntry); - NdisZeroMemory(pEntry, sizeof(MEASURE_REQ_ENTRY)); + NdisZeroMemory(pEntry, sizeof(struct rt_measure_req_entry)); pTab->Size--; RTMP_SEM_UNLOCK(&pAd->CommonCfg.MeasureReqTabLock); @@ -595,13 +595,13 @@ void MeasureReqDelete(IN PRTMP_ADAPTER pAd, u8 DialogToken) return; } -void TpcReqTabInit(IN PRTMP_ADAPTER pAd) +void TpcReqTabInit(struct rt_rtmp_adapter *pAd) { NdisAllocateSpinLock(&pAd->CommonCfg.TpcReqTabLock); - pAd->CommonCfg.pTpcReqTab = kmalloc(sizeof(TPC_REQ_TAB), GFP_ATOMIC); + pAd->CommonCfg.pTpcReqTab = kmalloc(sizeof(struct rt_tpc_req_tab), GFP_ATOMIC); if (pAd->CommonCfg.pTpcReqTab) - NdisZeroMemory(pAd->CommonCfg.pTpcReqTab, sizeof(TPC_REQ_TAB)); + NdisZeroMemory(pAd->CommonCfg.pTpcReqTab, sizeof(struct rt_tpc_req_tab)); else DBGPRINT(RT_DEBUG_ERROR, ("%s Fail to alloc memory for pAd->CommonCfg.pTpcReqTab.\n", @@ -610,7 +610,7 @@ void TpcReqTabInit(IN PRTMP_ADAPTER pAd) return; } -void TpcReqTabExit(IN PRTMP_ADAPTER pAd) +void TpcReqTabExit(struct rt_rtmp_adapter *pAd) { NdisFreeSpinLock(&pAd->CommonCfg.TpcReqTabLock); @@ -621,12 +621,12 @@ void TpcReqTabExit(IN PRTMP_ADAPTER pAd) return; } -static PTPC_REQ_ENTRY TpcReqLookUp(IN PRTMP_ADAPTER pAd, u8 DialogToken) +static struct rt_tpc_req_entry *TpcReqLookUp(struct rt_rtmp_adapter *pAd, u8 DialogToken) { u32 HashIdx; - PTPC_REQ_TAB pTab = pAd->CommonCfg.pTpcReqTab; - PTPC_REQ_ENTRY pEntry = NULL; - PTPC_REQ_ENTRY pPrevEntry = NULL; + struct rt_tpc_req_tab *pTab = pAd->CommonCfg.pTpcReqTab; + struct rt_tpc_req_entry *pEntry = NULL; + struct rt_tpc_req_entry *pPrevEntry = NULL; if (pTab == NULL) { DBGPRINT(RT_DEBUG_ERROR, @@ -653,12 +653,12 @@ static PTPC_REQ_ENTRY TpcReqLookUp(IN PRTMP_ADAPTER pAd, u8 DialogToken) return pEntry; } -static PTPC_REQ_ENTRY TpcReqInsert(IN PRTMP_ADAPTER pAd, u8 DialogToken) +static struct rt_tpc_req_entry *TpcReqInsert(struct rt_rtmp_adapter *pAd, u8 DialogToken) { int i; unsigned long HashIdx; - PTPC_REQ_TAB pTab = pAd->CommonCfg.pTpcReqTab; - PTPC_REQ_ENTRY pEntry = NULL, pCurrEntry; + struct rt_tpc_req_tab *pTab = pAd->CommonCfg.pTpcReqTab; + struct rt_tpc_req_entry *pEntry = NULL, *pCurrEntry; unsigned long Now; if (pTab == NULL) { @@ -680,11 +680,11 @@ static PTPC_REQ_ENTRY TpcReqInsert(IN PRTMP_ADAPTER pAd, u8 DialogToken) lastTime + TPC_REQ_AGE_OUT))) { - PTPC_REQ_ENTRY pPrevEntry = NULL; + struct rt_tpc_req_entry *pPrevEntry = NULL; unsigned long HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(pEntry-> DialogToken); - PTPC_REQ_ENTRY pProbeEntry = + struct rt_tpc_req_entry *pProbeEntry = pTab->Hash[HashIdx]; /* update Hash list */ @@ -704,7 +704,7 @@ static PTPC_REQ_ENTRY TpcReqInsert(IN PRTMP_ADAPTER pAd, u8 DialogToken) pProbeEntry = pProbeEntry->pNext; } while (pProbeEntry); - NdisZeroMemory(pEntry, sizeof(TPC_REQ_ENTRY)); + NdisZeroMemory(pEntry, sizeof(struct rt_tpc_req_entry)); pTab->Size--; break; @@ -745,10 +745,10 @@ static PTPC_REQ_ENTRY TpcReqInsert(IN PRTMP_ADAPTER pAd, u8 DialogToken) return pEntry; } -static void TpcReqDelete(IN PRTMP_ADAPTER pAd, u8 DialogToken) +static void TpcReqDelete(struct rt_rtmp_adapter *pAd, u8 DialogToken) { - PTPC_REQ_TAB pTab = pAd->CommonCfg.pTpcReqTab; - PTPC_REQ_ENTRY pEntry = NULL; + struct rt_tpc_req_tab *pTab = pAd->CommonCfg.pTpcReqTab; + struct rt_tpc_req_entry *pEntry = NULL; if (pTab == NULL) { DBGPRINT(RT_DEBUG_ERROR, @@ -763,9 +763,9 @@ static void TpcReqDelete(IN PRTMP_ADAPTER pAd, u8 DialogToken) pEntry = TpcReqLookUp(pAd, DialogToken); if (pEntry != NULL) { - PTPC_REQ_ENTRY pPrevEntry = NULL; + struct rt_tpc_req_entry *pPrevEntry = NULL; unsigned long HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(pEntry->DialogToken); - PTPC_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx]; + struct rt_tpc_req_entry *pProbeEntry = pTab->Hash[HashIdx]; RTMP_SEM_LOCK(&pAd->CommonCfg.TpcReqTabLock); /* update Hash list */ @@ -783,7 +783,7 @@ static void TpcReqDelete(IN PRTMP_ADAPTER pAd, u8 DialogToken) pProbeEntry = pProbeEntry->pNext; } while (pProbeEntry); - NdisZeroMemory(pEntry, sizeof(TPC_REQ_ENTRY)); + NdisZeroMemory(pEntry, sizeof(struct rt_tpc_req_entry)); pTab->Size--; RTMP_SEM_UNLOCK(&pAd->CommonCfg.TpcReqTabLock); @@ -802,7 +802,7 @@ static void TpcReqDelete(IN PRTMP_ADAPTER pAd, u8 DialogToken) Return : Current Time Stamp. ========================================================================== */ -static u64 GetCurrentTimeStamp(IN PRTMP_ADAPTER pAd) +static u64 GetCurrentTimeStamp(struct rt_rtmp_adapter *pAd) { /* get current time stamp. */ return 0; @@ -818,7 +818,7 @@ static u64 GetCurrentTimeStamp(IN PRTMP_ADAPTER pAd) Return : Current Time Stamp. ========================================================================== */ -static u8 GetCurTxPwr(IN PRTMP_ADAPTER pAd, u8 Wcid) +static u8 GetCurTxPwr(struct rt_rtmp_adapter *pAd, u8 Wcid) { return 16; /* 16 dBm */ } @@ -833,7 +833,7 @@ static u8 GetCurTxPwr(IN PRTMP_ADAPTER pAd, u8 Wcid) Return : Current Time Stamp. ========================================================================== */ -void InsertChannelRepIE(IN PRTMP_ADAPTER pAd, +void InsertChannelRepIE(struct rt_rtmp_adapter *pAd, u8 *pFrameBuf, unsigned long *pFrameLen, char *pCountry, u8 RegulatoryClass) @@ -900,7 +900,7 @@ void InsertChannelRepIE(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -void InsertDialogToken(IN PRTMP_ADAPTER pAd, +void InsertDialogToken(struct rt_rtmp_adapter *pAd, u8 *pFrameBuf, unsigned long *pFrameLen, u8 DialogToken) { @@ -924,7 +924,7 @@ void InsertDialogToken(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -static void InsertTpcReqIE(IN PRTMP_ADAPTER pAd, +static void InsertTpcReqIE(struct rt_rtmp_adapter *pAd, u8 *pFrameBuf, unsigned long *pFrameLen) { unsigned long TempLen; @@ -953,15 +953,15 @@ static void InsertTpcReqIE(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -void InsertTpcReportIE(IN PRTMP_ADAPTER pAd, +void InsertTpcReportIE(struct rt_rtmp_adapter *pAd, u8 *pFrameBuf, unsigned long *pFrameLen, u8 TxPwr, u8 LinkMargin) { unsigned long TempLen; - unsigned long Len = sizeof(TPC_REPORT_INFO); + unsigned long Len = sizeof(struct rt_tpc_report_info); u8 ElementID = IE_TPC_REPORT; - TPC_REPORT_INFO TpcReportIE; + struct rt_tpc_report_info TpcReportIE; TpcReportIE.TxPwr = TxPwr; TpcReportIE.LinkMargin = LinkMargin; @@ -990,16 +990,16 @@ void InsertTpcReportIE(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -static void InsertChSwAnnIE(IN PRTMP_ADAPTER pAd, +static void InsertChSwAnnIE(struct rt_rtmp_adapter *pAd, u8 *pFrameBuf, unsigned long *pFrameLen, u8 ChSwMode, u8 NewChannel, u8 ChSwCnt) { unsigned long TempLen; - unsigned long Len = sizeof(CH_SW_ANN_INFO); + unsigned long Len = sizeof(struct rt_ch_sw_ann_info); u8 ElementID = IE_CHANNEL_SWITCH_ANNOUNCEMENT; - CH_SW_ANN_INFO ChSwAnnIE; + struct rt_ch_sw_ann_info ChSwAnnIE; ChSwAnnIE.ChSwMode = ChSwMode; ChSwAnnIE.Channel = NewChannel; @@ -1031,10 +1031,10 @@ static void InsertChSwAnnIE(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -static void InsertMeasureReqIE(IN PRTMP_ADAPTER pAd, +static void InsertMeasureReqIE(struct rt_rtmp_adapter *pAd, u8 *pFrameBuf, unsigned long *pFrameLen, - u8 Len, IN PMEASURE_REQ_INFO pMeasureReqIE) + u8 Len, struct rt_measure_req_info * pMeasureReqIE) { unsigned long TempLen; u8 ElementID = IE_MEASUREMENT_REQUEST; @@ -1042,7 +1042,7 @@ static void InsertMeasureReqIE(IN PRTMP_ADAPTER pAd, MakeOutgoingFrame(pFrameBuf, &TempLen, 1, &ElementID, 1, &Len, - sizeof(MEASURE_REQ_INFO), pMeasureReqIE, END_OF_ARGS); + sizeof(struct rt_measure_req_info), pMeasureReqIE, END_OF_ARGS); *pFrameLen = *pFrameLen + TempLen; @@ -1066,17 +1066,17 @@ static void InsertMeasureReqIE(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -static void InsertMeasureReportIE(IN PRTMP_ADAPTER pAd, +static void InsertMeasureReportIE(struct rt_rtmp_adapter *pAd, u8 *pFrameBuf, unsigned long *pFrameLen, - IN PMEASURE_REPORT_INFO pMeasureReportIE, + struct rt_measure_report_info * pMeasureReportIE, u8 ReportLnfoLen, u8 *pReportInfo) { unsigned long TempLen; unsigned long Len; u8 ElementID = IE_MEASUREMENT_REPORT; - Len = sizeof(MEASURE_REPORT_INFO) + ReportLnfoLen; + Len = sizeof(struct rt_measure_report_info) + ReportLnfoLen; MakeOutgoingFrame(pFrameBuf, &TempLen, 1, &ElementID, @@ -1105,7 +1105,7 @@ static void InsertMeasureReportIE(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -void MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd, +void MakeMeasurementReqFrame(struct rt_rtmp_adapter *pAd, u8 *pOutBuffer, unsigned long *pFrameLen, u8 TotalLen, @@ -1116,7 +1116,7 @@ void MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd, u8 MeasureReqType, u8 NumOfRepetitions) { unsigned long TempLen; - MEASURE_REQ_INFO MeasureReqIE; + struct rt_measure_req_info MeasureReqIE; InsertActField(pAd, (pOutBuffer + *pFrameLen), pFrameLen, Category, Action); @@ -1133,7 +1133,7 @@ void MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd, *pFrameLen += TempLen; } /* prepare Measurement IE. */ - NdisZeroMemory(&MeasureReqIE, sizeof(MEASURE_REQ_INFO)); + NdisZeroMemory(&MeasureReqIE, sizeof(struct rt_measure_req_info)); MeasureReqIE.Token = MeasureToken; MeasureReqIE.ReqMode.word = MeasureReqMode; MeasureReqIE.ReqType = MeasureReqType; @@ -1155,7 +1155,7 @@ void MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -void EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd, +void EnqueueMeasurementRep(struct rt_rtmp_adapter *pAd, u8 *pDA, u8 DialogToken, u8 MeasureToken, @@ -1166,8 +1166,8 @@ void EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd, u8 *pOutBuffer = NULL; int NStatus; unsigned long FrameLen; - HEADER_802_11 ActHdr; - MEASURE_REPORT_INFO MeasureRepIE; + struct rt_header_802_11 ActHdr; + struct rt_measure_report_info MeasureRepIE; /* build action frame header. */ MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, @@ -1179,8 +1179,8 @@ void EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd, ("%s() allocate memory failed \n", __func__)); return; } - NdisMoveMemory(pOutBuffer, (char *)& ActHdr, sizeof(HEADER_802_11)); - FrameLen = sizeof(HEADER_802_11); + NdisMoveMemory(pOutBuffer, (char *)& ActHdr, sizeof(struct rt_header_802_11)); + FrameLen = sizeof(struct rt_header_802_11); InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_MRP); @@ -1189,7 +1189,7 @@ void EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd, InsertDialogToken(pAd, (pOutBuffer + FrameLen), &FrameLen, DialogToken); /* prepare Measurement IE. */ - NdisZeroMemory(&MeasureRepIE, sizeof(MEASURE_REPORT_INFO)); + NdisZeroMemory(&MeasureRepIE, sizeof(struct rt_measure_report_info)); MeasureRepIE.Token = MeasureToken; MeasureRepIE.ReportMode = MeasureReqMode; MeasureRepIE.ReportType = MeasureReqType; @@ -1214,13 +1214,13 @@ void EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -void EnqueueTPCReq(IN PRTMP_ADAPTER pAd, u8 *pDA, u8 DialogToken) +void EnqueueTPCReq(struct rt_rtmp_adapter *pAd, u8 *pDA, u8 DialogToken) { u8 *pOutBuffer = NULL; int NStatus; unsigned long FrameLen; - HEADER_802_11 ActHdr; + struct rt_header_802_11 ActHdr; /* build action frame header. */ MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, @@ -1232,8 +1232,8 @@ void EnqueueTPCReq(IN PRTMP_ADAPTER pAd, u8 *pDA, u8 DialogToken) ("%s() allocate memory failed \n", __func__)); return; } - NdisMoveMemory(pOutBuffer, (char *)& ActHdr, sizeof(HEADER_802_11)); - FrameLen = sizeof(HEADER_802_11); + NdisMoveMemory(pOutBuffer, (char *)& ActHdr, sizeof(struct rt_header_802_11)); + FrameLen = sizeof(struct rt_header_802_11); InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_TPCRQ); @@ -1262,7 +1262,7 @@ void EnqueueTPCReq(IN PRTMP_ADAPTER pAd, u8 *pDA, u8 DialogToken) Return : None. ========================================================================== */ -void EnqueueTPCRep(IN PRTMP_ADAPTER pAd, +void EnqueueTPCRep(struct rt_rtmp_adapter *pAd, u8 *pDA, u8 DialogToken, u8 TxPwr, u8 LinkMargin) { @@ -1270,7 +1270,7 @@ void EnqueueTPCRep(IN PRTMP_ADAPTER pAd, int NStatus; unsigned long FrameLen; - HEADER_802_11 ActHdr; + struct rt_header_802_11 ActHdr; /* build action frame header. */ MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, @@ -1282,8 +1282,8 @@ void EnqueueTPCRep(IN PRTMP_ADAPTER pAd, ("%s() allocate memory failed \n", __func__)); return; } - NdisMoveMemory(pOutBuffer, (char *)& ActHdr, sizeof(HEADER_802_11)); - FrameLen = sizeof(HEADER_802_11); + NdisMoveMemory(pOutBuffer, (char *)& ActHdr, sizeof(struct rt_header_802_11)); + FrameLen = sizeof(struct rt_header_802_11); InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_TPCRP); @@ -1315,14 +1315,14 @@ void EnqueueTPCRep(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -void EnqueueChSwAnn(IN PRTMP_ADAPTER pAd, +void EnqueueChSwAnn(struct rt_rtmp_adapter *pAd, u8 *pDA, u8 ChSwMode, u8 NewCh) { u8 *pOutBuffer = NULL; int NStatus; unsigned long FrameLen; - HEADER_802_11 ActHdr; + struct rt_header_802_11 ActHdr; /* build action frame header. */ MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA, @@ -1334,8 +1334,8 @@ void EnqueueChSwAnn(IN PRTMP_ADAPTER pAd, ("%s() allocate memory failed \n", __func__)); return; } - NdisMoveMemory(pOutBuffer, (char *)& ActHdr, sizeof(HEADER_802_11)); - FrameLen = sizeof(HEADER_802_11); + NdisMoveMemory(pOutBuffer, (char *)& ActHdr, sizeof(struct rt_header_802_11)); + FrameLen = sizeof(struct rt_header_802_11); InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_CHANNEL_SWITCH); @@ -1349,7 +1349,7 @@ void EnqueueChSwAnn(IN PRTMP_ADAPTER pAd, return; } -static BOOLEAN DfsRequirementCheck(IN PRTMP_ADAPTER pAd, u8 Channel) +static BOOLEAN DfsRequirementCheck(struct rt_rtmp_adapter *pAd, u8 Channel) { BOOLEAN Result = FALSE; int i; @@ -1376,13 +1376,13 @@ static BOOLEAN DfsRequirementCheck(IN PRTMP_ADAPTER pAd, u8 Channel) return Result; } -void NotifyChSwAnnToPeerAPs(IN PRTMP_ADAPTER pAd, +void NotifyChSwAnnToPeerAPs(struct rt_rtmp_adapter *pAd, u8 *pRA, u8 *pTA, u8 ChSwMode, u8 Channel) { } -static void StartDFSProcedure(IN PRTMP_ADAPTER pAd, +static void StartDFSProcedure(struct rt_rtmp_adapter *pAd, u8 Channel, u8 ChSwMode) { /* start DFS procedure */ @@ -1415,18 +1415,18 @@ static void StartDFSProcedure(IN PRTMP_ADAPTER pAd, +----+-----+-----------+------------+-----------+ 1 1 1 1 1 */ -static BOOLEAN PeerChSwAnnSanity(IN PRTMP_ADAPTER pAd, +static BOOLEAN PeerChSwAnnSanity(struct rt_rtmp_adapter *pAd, void * pMsg, unsigned long MsgLen, - OUT PCH_SW_ANN_INFO pChSwAnnInfo) + struct rt_ch_sw_ann_info * pChSwAnnInfo) { - PFRAME_802_11 Fr = (PFRAME_802_11) pMsg; + struct rt_frame_802_11 * Fr = (struct rt_frame_802_11 *) pMsg; u8 *pFramePtr = Fr->Octet; BOOLEAN result = FALSE; - PEID_STRUCT eid_ptr; + struct rt_eid * eid_ptr; /* skip 802.11 header. */ - MsgLen -= sizeof(HEADER_802_11); + MsgLen -= sizeof(struct rt_header_802_11); /* skip category and action code. */ pFramePtr += 2; @@ -1435,7 +1435,7 @@ static BOOLEAN PeerChSwAnnSanity(IN PRTMP_ADAPTER pAd, if (pChSwAnnInfo == NULL) return result; - eid_ptr = (PEID_STRUCT) pFramePtr; + eid_ptr = (struct rt_eid *) pFramePtr; while (((u8 *) eid_ptr + eid_ptr->Len + 1) < ((u8 *)pFramePtr + MsgLen)) { switch (eid_ptr->Eid) { @@ -1453,7 +1453,7 @@ static BOOLEAN PeerChSwAnnSanity(IN PRTMP_ADAPTER pAd, default: break; } - eid_ptr = (PEID_STRUCT) ((u8 *) eid_ptr + 2 + eid_ptr->Len); + eid_ptr = (struct rt_eid *) ((u8 *) eid_ptr + 2 + eid_ptr->Len); } return result; @@ -1472,23 +1472,23 @@ static BOOLEAN PeerChSwAnnSanity(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -static BOOLEAN PeerMeasureReqSanity(IN PRTMP_ADAPTER pAd, +static BOOLEAN PeerMeasureReqSanity(struct rt_rtmp_adapter *pAd, void * pMsg, unsigned long MsgLen, u8 *pDialogToken, - OUT PMEASURE_REQ_INFO pMeasureReqInfo, - OUT PMEASURE_REQ pMeasureReq) + struct rt_measure_req_info * pMeasureReqInfo, + struct rt_measure_req * pMeasureReq) { - PFRAME_802_11 Fr = (PFRAME_802_11) pMsg; + struct rt_frame_802_11 * Fr = (struct rt_frame_802_11 *) pMsg; u8 *pFramePtr = Fr->Octet; BOOLEAN result = FALSE; - PEID_STRUCT eid_ptr; + struct rt_eid * eid_ptr; u8 *ptr; u64 MeasureStartTime; u16 MeasureDuration; /* skip 802.11 header. */ - MsgLen -= sizeof(HEADER_802_11); + MsgLen -= sizeof(struct rt_header_802_11); /* skip category and action code. */ pFramePtr += 2; @@ -1501,7 +1501,7 @@ static BOOLEAN PeerMeasureReqSanity(IN PRTMP_ADAPTER pAd, pFramePtr += 1; MsgLen -= 1; - eid_ptr = (PEID_STRUCT) pFramePtr; + eid_ptr = (struct rt_eid *) pFramePtr; while (((u8 *) eid_ptr + eid_ptr->Len + 1) < ((u8 *)pFramePtr + MsgLen)) { switch (eid_ptr->Eid) { @@ -1526,7 +1526,7 @@ static BOOLEAN PeerMeasureReqSanity(IN PRTMP_ADAPTER pAd, default: break; } - eid_ptr = (PEID_STRUCT) ((u8 *) eid_ptr + 2 + eid_ptr->Len); + eid_ptr = (struct rt_eid *) ((u8 *) eid_ptr + 2 + eid_ptr->Len); } return result; @@ -1566,22 +1566,22 @@ static BOOLEAN PeerMeasureReqSanity(IN PRTMP_ADAPTER pAd, +-----+---------------+---------------------+-------+------------+----------+ 0 1 2 3 4 5-7 */ -static BOOLEAN PeerMeasureReportSanity(IN PRTMP_ADAPTER pAd, +static BOOLEAN PeerMeasureReportSanity(struct rt_rtmp_adapter *pAd, void * pMsg, unsigned long MsgLen, u8 *pDialogToken, - OUT PMEASURE_REPORT_INFO + struct rt_measure_report_info * pMeasureReportInfo, u8 *pReportBuf) { - PFRAME_802_11 Fr = (PFRAME_802_11) pMsg; + struct rt_frame_802_11 * Fr = (struct rt_frame_802_11 *) pMsg; u8 *pFramePtr = Fr->Octet; BOOLEAN result = FALSE; - PEID_STRUCT eid_ptr; + struct rt_eid * eid_ptr; u8 *ptr; /* skip 802.11 header. */ - MsgLen -= sizeof(HEADER_802_11); + MsgLen -= sizeof(struct rt_header_802_11); /* skip category and action code. */ pFramePtr += 2; @@ -1594,7 +1594,7 @@ static BOOLEAN PeerMeasureReportSanity(IN PRTMP_ADAPTER pAd, pFramePtr += 1; MsgLen -= 1; - eid_ptr = (PEID_STRUCT) pFramePtr; + eid_ptr = (struct rt_eid *) pFramePtr; while (((u8 *) eid_ptr + eid_ptr->Len + 1) < ((u8 *)pFramePtr + MsgLen)) { switch (eid_ptr->Eid) { @@ -1606,8 +1606,8 @@ static BOOLEAN PeerMeasureReportSanity(IN PRTMP_ADAPTER pAd, NdisMoveMemory(&pMeasureReportInfo->ReportType, eid_ptr->Octet + 2, 1); if (pMeasureReportInfo->ReportType == RM_BASIC) { - PMEASURE_BASIC_REPORT pReport = - (PMEASURE_BASIC_REPORT) pReportBuf; + struct rt_measure_basic_report * pReport = + (struct rt_measure_basic_report *) pReportBuf; ptr = (u8 *)(eid_ptr->Octet + 3); NdisMoveMemory(&pReport->ChNum, ptr, 1); NdisMoveMemory(&pReport->MeasureStartTime, @@ -1617,8 +1617,8 @@ static BOOLEAN PeerMeasureReportSanity(IN PRTMP_ADAPTER pAd, NdisMoveMemory(&pReport->Map, ptr + 11, 1); } else if (pMeasureReportInfo->ReportType == RM_CCA) { - PMEASURE_CCA_REPORT pReport = - (PMEASURE_CCA_REPORT) pReportBuf; + struct rt_measure_cca_report * pReport = + (struct rt_measure_cca_report *) pReportBuf; ptr = (u8 *)(eid_ptr->Octet + 3); NdisMoveMemory(&pReport->ChNum, ptr, 1); NdisMoveMemory(&pReport->MeasureStartTime, @@ -1630,8 +1630,8 @@ static BOOLEAN PeerMeasureReportSanity(IN PRTMP_ADAPTER pAd, } else if (pMeasureReportInfo->ReportType == RM_RPI_HISTOGRAM) { - PMEASURE_RPI_REPORT pReport = - (PMEASURE_RPI_REPORT) pReportBuf; + struct rt_measure_rpi_report * pReport = + (struct rt_measure_rpi_report *) pReportBuf; ptr = (u8 *)(eid_ptr->Octet + 3); NdisMoveMemory(&pReport->ChNum, ptr, 1); NdisMoveMemory(&pReport->MeasureStartTime, @@ -1647,7 +1647,7 @@ static BOOLEAN PeerMeasureReportSanity(IN PRTMP_ADAPTER pAd, default: break; } - eid_ptr = (PEID_STRUCT) ((u8 *) eid_ptr + 2 + eid_ptr->Len); + eid_ptr = (struct rt_eid *) ((u8 *) eid_ptr + 2 + eid_ptr->Len); } return result; @@ -1666,16 +1666,16 @@ static BOOLEAN PeerMeasureReportSanity(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -static BOOLEAN PeerTpcReqSanity(IN PRTMP_ADAPTER pAd, +static BOOLEAN PeerTpcReqSanity(struct rt_rtmp_adapter *pAd, void * pMsg, unsigned long MsgLen, u8 *pDialogToken) { - PFRAME_802_11 Fr = (PFRAME_802_11) pMsg; + struct rt_frame_802_11 * Fr = (struct rt_frame_802_11 *) pMsg; u8 *pFramePtr = Fr->Octet; BOOLEAN result = FALSE; - PEID_STRUCT eid_ptr; + struct rt_eid * eid_ptr; - MsgLen -= sizeof(HEADER_802_11); + MsgLen -= sizeof(struct rt_header_802_11); /* skip category and action code. */ pFramePtr += 2; @@ -1688,7 +1688,7 @@ static BOOLEAN PeerTpcReqSanity(IN PRTMP_ADAPTER pAd, pFramePtr += 1; MsgLen -= 1; - eid_ptr = (PEID_STRUCT) pFramePtr; + eid_ptr = (struct rt_eid *) pFramePtr; while (((u8 *) eid_ptr + eid_ptr->Len + 1) < ((u8 *)pFramePtr + MsgLen)) { switch (eid_ptr->Eid) { @@ -1699,7 +1699,7 @@ static BOOLEAN PeerTpcReqSanity(IN PRTMP_ADAPTER pAd, default: break; } - eid_ptr = (PEID_STRUCT) ((u8 *) eid_ptr + 2 + eid_ptr->Len); + eid_ptr = (struct rt_eid *) ((u8 *) eid_ptr + 2 + eid_ptr->Len); } return result; @@ -1719,18 +1719,18 @@ static BOOLEAN PeerTpcReqSanity(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -static BOOLEAN PeerTpcRepSanity(IN PRTMP_ADAPTER pAd, +static BOOLEAN PeerTpcRepSanity(struct rt_rtmp_adapter *pAd, void * pMsg, unsigned long MsgLen, u8 *pDialogToken, - OUT PTPC_REPORT_INFO pTpcRepInfo) + struct rt_tpc_report_info * pTpcRepInfo) { - PFRAME_802_11 Fr = (PFRAME_802_11) pMsg; + struct rt_frame_802_11 * Fr = (struct rt_frame_802_11 *) pMsg; u8 *pFramePtr = Fr->Octet; BOOLEAN result = FALSE; - PEID_STRUCT eid_ptr; + struct rt_eid * eid_ptr; - MsgLen -= sizeof(HEADER_802_11); + MsgLen -= sizeof(struct rt_header_802_11); /* skip category and action code. */ pFramePtr += 2; @@ -1743,7 +1743,7 @@ static BOOLEAN PeerTpcRepSanity(IN PRTMP_ADAPTER pAd, pFramePtr += 1; MsgLen -= 1; - eid_ptr = (PEID_STRUCT) pFramePtr; + eid_ptr = (struct rt_eid *) pFramePtr; while (((u8 *) eid_ptr + eid_ptr->Len + 1) < ((u8 *)pFramePtr + MsgLen)) { switch (eid_ptr->Eid) { @@ -1757,7 +1757,7 @@ static BOOLEAN PeerTpcRepSanity(IN PRTMP_ADAPTER pAd, default: break; } - eid_ptr = (PEID_STRUCT) ((u8 *) eid_ptr + 2 + eid_ptr->Len); + eid_ptr = (struct rt_eid *) ((u8 *) eid_ptr + 2 + eid_ptr->Len); } return result; @@ -1774,14 +1774,14 @@ static BOOLEAN PeerTpcRepSanity(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -static void PeerChSwAnnAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +static void PeerChSwAnnAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { - CH_SW_ANN_INFO ChSwAnnInfo; - PFRAME_802_11 pFr = (PFRAME_802_11) Elem->Msg; + struct rt_ch_sw_ann_info ChSwAnnInfo; + struct rt_frame_802_11 * pFr = (struct rt_frame_802_11 *) Elem->Msg; u8 index = 0, Channel = 0, NewChannel = 0; unsigned long Bssidx = 0; - NdisZeroMemory(&ChSwAnnInfo, sizeof(CH_SW_ANN_INFO)); + NdisZeroMemory(&ChSwAnnInfo, sizeof(struct rt_ch_sw_ann_info)); if (!PeerChSwAnnSanity(pAd, Elem->Msg, Elem->MsgLen, &ChSwAnnInfo)) { DBGPRINT(RT_DEBUG_TRACE, ("Invalid Channel Switch Action Frame.\n")); @@ -1856,13 +1856,13 @@ static void PeerChSwAnnAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Return : None. ========================================================================== */ -static void PeerMeasureReqAction(IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM * Elem) +static void PeerMeasureReqAction(struct rt_rtmp_adapter *pAd, + struct rt_mlme_queue_elem *Elem) { - PFRAME_802_11 pFr = (PFRAME_802_11) Elem->Msg; + struct rt_frame_802_11 * pFr = (struct rt_frame_802_11 *) Elem->Msg; u8 DialogToken; - MEASURE_REQ_INFO MeasureReqInfo; - MEASURE_REQ MeasureReq; + struct rt_measure_req_info MeasureReqInfo; + struct rt_measure_req MeasureReq; MEASURE_REPORT_MODE ReportMode; if (PeerMeasureReqSanity @@ -1889,11 +1889,11 @@ static void PeerMeasureReqAction(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -static void PeerMeasureReportAction(IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM * Elem) +static void PeerMeasureReportAction(struct rt_rtmp_adapter *pAd, + struct rt_mlme_queue_elem *Elem) { - MEASURE_REPORT_INFO MeasureReportInfo; - PFRAME_802_11 pFr = (PFRAME_802_11) Elem->Msg; + struct rt_measure_report_info MeasureReportInfo; + struct rt_frame_802_11 * pFr = (struct rt_frame_802_11 *) Elem->Msg; u8 DialogToken; u8 *pMeasureReportInfo; @@ -1901,20 +1901,20 @@ static void PeerMeasureReportAction(IN PRTMP_ADAPTER pAd, /* return; */ if ((pMeasureReportInfo = - kmalloc(sizeof(MEASURE_RPI_REPORT), GFP_ATOMIC)) == NULL) { + kmalloc(sizeof(struct rt_measure_rpi_report), GFP_ATOMIC)) == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("%s unable to alloc memory for measure report buffer (size=%zu).\n", - __func__, sizeof(MEASURE_RPI_REPORT))); + __func__, sizeof(struct rt_measure_rpi_report))); return; } - NdisZeroMemory(&MeasureReportInfo, sizeof(MEASURE_REPORT_INFO)); - NdisZeroMemory(pMeasureReportInfo, sizeof(MEASURE_RPI_REPORT)); + NdisZeroMemory(&MeasureReportInfo, sizeof(struct rt_measure_report_info)); + NdisZeroMemory(pMeasureReportInfo, sizeof(struct rt_measure_rpi_report)); if (PeerMeasureReportSanity (pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &MeasureReportInfo, pMeasureReportInfo)) { do { - PMEASURE_REQ_ENTRY pEntry = NULL; + struct rt_measure_req_entry *pEntry = NULL; /* Not a autonomous measure report. */ /* check the dialog token field. drop it if the dialog token doesn't match. */ @@ -1927,8 +1927,8 @@ static void PeerMeasureReportAction(IN PRTMP_ADAPTER pAd, MeasureReqDelete(pAd, pEntry->DialogToken); if (MeasureReportInfo.ReportType == RM_BASIC) { - PMEASURE_BASIC_REPORT pBasicReport = - (PMEASURE_BASIC_REPORT) pMeasureReportInfo; + struct rt_measure_basic_report * pBasicReport = + (struct rt_measure_basic_report *) pMeasureReportInfo; if ((pBasicReport->Map.field.Radar) && (DfsRequirementCheck @@ -1965,9 +1965,9 @@ static void PeerMeasureReportAction(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -static void PeerTpcReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +static void PeerTpcReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { - PFRAME_802_11 pFr = (PFRAME_802_11) Elem->Msg; + struct rt_frame_802_11 * pFr = (struct rt_frame_802_11 *) Elem->Msg; u8 *pFramePtr = pFr->Octet; u8 DialogToken; u8 TxPwr = GetCurTxPwr(pAd, Elem->Wcid); @@ -2007,13 +2007,13 @@ static void PeerTpcReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Return : None. ========================================================================== */ -static void PeerTpcRepAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +static void PeerTpcRepAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 DialogToken; - TPC_REPORT_INFO TpcRepInfo; - PTPC_REQ_ENTRY pEntry = NULL; + struct rt_tpc_report_info TpcRepInfo; + struct rt_tpc_req_entry *pEntry = NULL; - NdisZeroMemory(&TpcRepInfo, sizeof(TPC_REPORT_INFO)); + NdisZeroMemory(&TpcRepInfo, sizeof(struct rt_tpc_report_info)); if (PeerTpcRepSanity (pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &TpcRepInfo)) { if ((pEntry = TpcReqLookUp(pAd, DialogToken)) != NULL) { @@ -2040,7 +2040,7 @@ static void PeerTpcRepAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Return : None. ========================================================================== */ -void PeerSpectrumAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerSpectrumAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 Action = Elem->Msg[LENGTH_802_11 + 1]; @@ -2085,7 +2085,7 @@ void PeerSpectrumAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Return : None. ========================================================================== */ -int Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, char *arg) +int Set_MeasureReq_Proc(struct rt_rtmp_adapter *pAd, char *arg) { u32 Aid = 1; u32 ArgIdx; @@ -2096,10 +2096,10 @@ int Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, char *arg) u8 MeasureReqType = RM_BASIC; u8 MeasureCh = 1; u64 MeasureStartTime = GetCurrentTimeStamp(pAd); - MEASURE_REQ MeasureReq; + struct rt_measure_req MeasureReq; u8 TotalLen; - HEADER_802_11 ActHdr; + struct rt_header_802_11 ActHdr; u8 *pOutBuffer = NULL; int NStatus; unsigned long FrameLen; @@ -2153,13 +2153,13 @@ int Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, char *arg) MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pAd->MacTab.Content[Aid].Addr, pAd->CurrentAddress); - NdisMoveMemory(pOutBuffer, (char *)& ActHdr, sizeof(HEADER_802_11)); - FrameLen = sizeof(HEADER_802_11); + NdisMoveMemory(pOutBuffer, (char *)& ActHdr, sizeof(struct rt_header_802_11)); + FrameLen = sizeof(struct rt_header_802_11); - TotalLen = sizeof(MEASURE_REQ_INFO) + sizeof(MEASURE_REQ); + TotalLen = sizeof(struct rt_measure_req_info) + sizeof(struct rt_measure_req); MakeMeasurementReqFrame(pAd, pOutBuffer, &FrameLen, - sizeof(MEASURE_REQ_INFO), CATEGORY_RM, RM_BASIC, + sizeof(struct rt_measure_req_info), CATEGORY_RM, RM_BASIC, MeasureReqToken, MeasureReqMode.word, MeasureReqType, 0); @@ -2170,7 +2170,7 @@ int Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, char *arg) { unsigned long TempLen; MakeOutgoingFrame(pOutBuffer + FrameLen, &TempLen, - sizeof(MEASURE_REQ), &MeasureReq, + sizeof(struct rt_measure_req), &MeasureReq, END_OF_ARGS); FrameLen += TempLen; } @@ -2183,7 +2183,7 @@ END_OF_MEASURE_REQ: return TRUE; } -int Set_TpcReq_Proc(IN PRTMP_ADAPTER pAd, char *arg) +int Set_TpcReq_Proc(struct rt_rtmp_adapter *pAd, char *arg) { u32 Aid; diff --git a/drivers/staging/rt2860/crypt_md5.h b/drivers/staging/rt2860/crypt_md5.h index bbabf12abf8a..26f974554b26 100644 --- a/drivers/staging/rt2860/crypt_md5.h +++ b/drivers/staging/rt2860/crypt_md5.h @@ -53,18 +53,19 @@ #ifdef MD5_SUPPORT #define MD5_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ #define MD5_DIGEST_SIZE 16 /* 128 bits = 16 bytes */ -typedef struct { + +struct rt_md5_ctx_struc { u32 HashValue[4]; u64 MessageLen; u8 Block[MD5_BLOCK_SIZE]; u32 BlockLen; -} MD5_CTX_STRUC, *PMD5_CTX_STRUC; +}; -void MD5_Init(IN MD5_CTX_STRUC * pMD5_CTX); -void MD5_Hash(IN MD5_CTX_STRUC * pMD5_CTX); -void MD5_Append(IN MD5_CTX_STRUC * pMD5_CTX, +void MD5_Init(struct rt_md5_ctx_struc *pMD5_CTX); +void MD5_Hash(struct rt_md5_ctx_struc *pMD5_CTX); +void MD5_Append(struct rt_md5_ctx_struc *pMD5_CTX, IN const u8 Message[], u32 MessageLen); -void MD5_End(IN MD5_CTX_STRUC * pMD5_CTX, u8 DigestMessage[]); +void MD5_End(struct rt_md5_ctx_struc *pMD5_CTX, u8 DigestMessage[]); void RT_MD5(IN const u8 Message[], u32 MessageLen, u8 DigestMessage[]); #endif /* MD5_SUPPORT */ diff --git a/drivers/staging/rt2860/crypt_sha2.h b/drivers/staging/rt2860/crypt_sha2.h index bfd88bc65f67..20d11ab865c1 100644 --- a/drivers/staging/rt2860/crypt_sha2.h +++ b/drivers/staging/rt2860/crypt_sha2.h @@ -54,18 +54,18 @@ #ifdef SHA1_SUPPORT #define SHA1_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ #define SHA1_DIGEST_SIZE 20 /* 160 bits = 20 bytes */ -typedef struct _SHA1_CTX_STRUC { +struct rt_sha1_ctx { u32 HashValue[5]; /* 5 = (SHA1_DIGEST_SIZE / 32) */ u64 MessageLen; /* total size */ u8 Block[SHA1_BLOCK_SIZE]; u32 BlockLen; -} SHA1_CTX_STRUC, *PSHA1_CTX_STRUC; +}; -void RT_SHA1_Init(IN SHA1_CTX_STRUC * pSHA_CTX); -void SHA1_Hash(IN SHA1_CTX_STRUC * pSHA_CTX); -void SHA1_Append(IN SHA1_CTX_STRUC * pSHA_CTX, +void RT_SHA1_Init(struct rt_sha1_ctx *pSHA_CTX); +void SHA1_Hash(struct rt_sha1_ctx *pSHA_CTX); +void SHA1_Append(struct rt_sha1_ctx *pSHA_CTX, IN const u8 Message[], u32 MessageLen); -void SHA1_End(IN SHA1_CTX_STRUC * pSHA_CTX, u8 DigestMessage[]); +void SHA1_End(struct rt_sha1_ctx *pSHA_CTX, u8 DigestMessage[]); void RT_SHA1(IN const u8 Message[], u32 MessageLen, u8 DigestMessage[]); #endif /* SHA1_SUPPORT */ diff --git a/drivers/staging/rt2860/dfs.h b/drivers/staging/rt2860/dfs.h index d094490200b9..5fbab259acae 100644 --- a/drivers/staging/rt2860/dfs.h +++ b/drivers/staging/rt2860/dfs.h @@ -36,4 +36,4 @@ Fonchi 03-12-2007 created */ -BOOLEAN RadarChannelCheck(IN PRTMP_ADAPTER pAd, u8 Ch); +BOOLEAN RadarChannelCheck(struct rt_rtmp_adapter *pAd, u8 Ch); diff --git a/drivers/staging/rt2860/eeprom.h b/drivers/staging/rt2860/eeprom.h index 50df5a2562af..039801a97099 100644 --- a/drivers/staging/rt2860/eeprom.h +++ b/drivers/staging/rt2860/eeprom.h @@ -41,20 +41,20 @@ /************************************************************************* * Public function declarations for prom-based chipset ************************************************************************/ -int rtmp_ee_prom_read16(IN PRTMP_ADAPTER pAd, +int rtmp_ee_prom_read16(struct rt_rtmp_adapter *pAd, u16 Offset, u16 * pValue); #endif /* RTMP_PCI_SUPPORT // */ #ifdef RTMP_USB_SUPPORT /************************************************************************* * Public function declarations for usb-based prom chipset ************************************************************************/ -int RTUSBReadEEPROM16(IN PRTMP_ADAPTER pAd, +int RTUSBReadEEPROM16(struct rt_rtmp_adapter *pAd, u16 offset, u16 *pData); #endif /* RTMP_USB_SUPPORT // */ #ifdef RT30xx #ifdef RTMP_EFUSE_SUPPORT -int rtmp_ee_efuse_read16(IN RTMP_ADAPTER * pAd, +int rtmp_ee_efuse_read16(struct rt_rtmp_adapter *pAd, u16 Offset, u16 * pValue); #endif /* RTMP_EFUSE_SUPPORT // */ #endif /* RT30xx // */ @@ -62,6 +62,6 @@ int rtmp_ee_efuse_read16(IN RTMP_ADAPTER * pAd, /************************************************************************* * Public function declarations for prom operation callback functions setting ************************************************************************/ -int RtmpChipOpsEepromHook(IN RTMP_ADAPTER * pAd, int infType); +int RtmpChipOpsEepromHook(struct rt_rtmp_adapter *pAd, int infType); #endif /* __EEPROM_H__ // */ diff --git a/drivers/staging/rt2860/iface/rtmp_usb.h b/drivers/staging/rt2860/iface/rtmp_usb.h index f2955a2de029..6bb384a74660 100644 --- a/drivers/staging/rt2860/iface/rtmp_usb.h +++ b/drivers/staging/rt2860/iface/rtmp_usb.h @@ -126,7 +126,7 @@ void RTUSBBulkRxComplete(struct urb *pUrb, struct pt_regs *pt_regs); #ifdef KTHREAD_SUPPORT #define RTUSBMlmeUp(pAd) \ do{ \ - RTMP_OS_TASK *_pTask = &((pAd)->mlmeTask);\ + struct rt_rtmp_os_task *_pTask = &((pAd)->mlmeTask);\ if (_pTask->kthread_task) \ { \ _pTask->kthread_running = TRUE; \ @@ -136,7 +136,7 @@ void RTUSBBulkRxComplete(struct urb *pUrb, struct pt_regs *pt_regs); #else #define RTUSBMlmeUp(pAd) \ do{ \ - RTMP_OS_TASK *_pTask = &((pAd)->mlmeTask);\ + struct rt_rtmp_os_task *_pTask = &((pAd)->mlmeTask);\ CHECK_PID_LEGALITY(_pTask->taskPID) \ { \ RTMP_SEM_EVENT_UP(&(_pTask->taskSema)); \ @@ -147,7 +147,7 @@ void RTUSBBulkRxComplete(struct urb *pUrb, struct pt_regs *pt_regs); #ifdef KTHREAD_SUPPORT #define RTUSBCMDUp(pAd) \ do{ \ - RTMP_OS_TASK *_pTask = &((pAd)->cmdQTask); \ + struct rt_rtmp_os_task *_pTask = &((pAd)->cmdQTask); \ { \ _pTask->kthread_running = TRUE; \ wake_up(&_pTask->kthread_q); \ @@ -157,7 +157,7 @@ void RTUSBBulkRxComplete(struct urb *pUrb, struct pt_regs *pt_regs); #else #define RTUSBCMDUp(pAd) \ do{ \ - RTMP_OS_TASK *_pTask = &((pAd)->cmdQTask); \ + struct rt_rtmp_os_task *_pTask = &((pAd)->cmdQTask); \ CHECK_PID_LEGALITY(_pTask->taskPID) \ {\ RTMP_SEM_EVENT_UP(&(_pTask->taskSema)); \ diff --git a/drivers/staging/rt2860/mlme.h b/drivers/staging/rt2860/mlme.h index 09e326ee85b0..11434132f93b 100644 --- a/drivers/staging/rt2860/mlme.h +++ b/drivers/staging/rt2860/mlme.h @@ -187,7 +187,7 @@ if (((__pEntry)) != NULL) \ /* 802.11 frame formats */ /* */ /* HT Capability INFO field in HT Cap IE . */ -typedef struct PACKED { +struct PACKED rt_ht_cap_info { u16 AdvCoding:1; u16 ChannelWidth:1; u16 MimoPs:2; /*momi power safe */ @@ -202,17 +202,17 @@ typedef struct PACKED { u16 PSMP:1; u16 Forty_Mhz_Intolerant:1; u16 LSIGTxopProSup:1; -} HT_CAP_INFO, *PHT_CAP_INFO; +}; /* HT Capability INFO field in HT Cap IE . */ -typedef struct PACKED { +struct PACKED rt_ht_cap_parm { u8 MaxRAmpduFactor:2; u8 MpduDensity:3; u8 rsv:3; /*momi power safe */ -} HT_CAP_PARM, *PHT_CAP_PARM; +}; /* HT Capability INFO field in HT Cap IE . */ -typedef struct PACKED { +struct PACKED rt_ht_mcs_set { u8 MCSSet[10]; u8 SupRate[2]; /* unit : 1Mbps */ u8 TxMCSSetDefined:1; @@ -221,10 +221,10 @@ typedef struct PACKED { u8 MpduDensity:1; u8 rsv:3; u8 rsv3[3]; -} HT_MCS_SET, *PHT_MCS_SET; +}; /* HT Capability INFO field in HT Cap IE . */ -typedef struct PACKED { +struct PACKED rt_ext_ht_cap_info { u16 Pco:1; u16 TranTime:2; u16 rsv:5; /*momi power safe */ @@ -232,10 +232,10 @@ typedef struct PACKED { u16 PlusHTC:1; /*+HTC control field support */ u16 RDGSupport:1; /*reverse Direction Grant support */ u16 rsv2:4; -} EXT_HT_CAP_INFO, *PEXT_HT_CAP_INFO; +}; /* HT Beamforming field in HT Cap IE . */ -typedef struct PACKED _HT_BF_CAP { +struct PACKED rt_ht_bf_cap { unsigned long TxBFRecCapable:1; unsigned long RxSoundCapable:1; unsigned long TxSoundCapable:1; @@ -256,10 +256,10 @@ typedef struct PACKED _HT_BF_CAP { unsigned long CSIRowBFSup:2; unsigned long ChanEstimation:2; unsigned long rsv:3; -} HT_BF_CAP, *PHT_BF_CAP; +}; /* HT antenna selection field in HT Cap IE . */ -typedef struct PACKED _HT_AS_CAP { +struct PACKED rt_ht_as_cap { u8 AntSelect:1; u8 ExpCSIFbkTxASEL:1; u8 AntIndFbkTxASEL:1; @@ -268,20 +268,20 @@ typedef struct PACKED _HT_AS_CAP { u8 RxASel:1; u8 TxSoundPPDU:1; u8 rsv:1; -} HT_AS_CAP, *PHT_AS_CAP; +}; /* Draft 1.0 set IE length 26, but is extensible.. */ #define SIZE_HT_CAP_IE 26 /* The structure for HT Capability IE. */ -typedef struct PACKED _HT_CAPABILITY_IE { - HT_CAP_INFO HtCapInfo; - HT_CAP_PARM HtCapParm; -/* HT_MCS_SET HtMCSSet; */ +struct PACKED rt_ht_capability_ie { + struct rt_ht_cap_info HtCapInfo; + struct rt_ht_cap_parm HtCapParm; +/* struct rt_ht_mcs_set HtMCSSet; */ u8 MCSSet[16]; - EXT_HT_CAP_INFO ExtHtCapInfo; - HT_BF_CAP TxBFCap; /* beamforming cap. rt2860c not support beamforming. */ - HT_AS_CAP ASCap; /*antenna selection. */ -} HT_CAPABILITY_IE, *PHT_CAPABILITY_IE; + struct rt_ext_ht_cap_info ExtHtCapInfo; + struct rt_ht_bf_cap TxBFCap; /* beamforming cap. rt2860c not support beamforming. */ + struct rt_ht_as_cap ASCap; /*antenna selection. */ +}; /* 802.11n draft3 related structure definitions. */ /* 7.3.2.60 */ @@ -296,7 +296,7 @@ typedef struct PACKED _HT_CAPABILITY_IE { /* (dot11BSSWidthChannelTransactionDelayFactor * dot11BSSWidthTriggerScanInterval) seconds without */ /* being obligated to perform OBSS Scan operations. default is 25(== 0.25%) */ -typedef struct PACKED _OVERLAP_BSS_SCAN_IE { +struct PACKED rt_overlap_bss_scan_ie { u16 ScanPassiveDwell; u16 ScanActiveDwell; u16 TriggerScanInt; /* Trigger scan interval */ @@ -304,7 +304,7 @@ typedef struct PACKED _OVERLAP_BSS_SCAN_IE { u16 ActiveTalPerChannel; /* active total per channel */ u16 DelayFactor; /* BSS width channel transition delay factor */ u16 ScanActThre; /* Scan Activity threshold */ -} OVERLAP_BSS_SCAN_IE, *POVERLAP_BSS_SCAN_IE; +}; /* 7.3.2.56. 20/40 Coexistence element used in Element ID = 72 = IE_2040_BSS_COEXIST */ typedef union PACKED _BSS_2040_COEXIST_IE { @@ -317,70 +317,70 @@ typedef union PACKED _BSS_2040_COEXIST_IE { u8 word; } BSS_2040_COEXIST_IE, *PBSS_2040_COEXIST_IE; -typedef struct _TRIGGER_EVENTA { +struct rt_trigger_eventa { BOOLEAN bValid; u8 BSSID[6]; u8 RegClass; /* Regulatory Class */ u16 Channel; unsigned long CDCounter; /* Maintain a seperate count down counter for each Event A. */ -} TRIGGER_EVENTA, *PTRIGGER_EVENTA; +}; /* 20/40 trigger event table */ /* If one Event A delete or created, or if Event B is detected or not detected, STA should send 2040BSSCoexistence to AP. */ #define MAX_TRIGGER_EVENT 64 -typedef struct _TRIGGER_EVENT_TAB { +struct rt_trigger_event_tab { u8 EventANo; - TRIGGER_EVENTA EventA[MAX_TRIGGER_EVENT]; + struct rt_trigger_eventa EventA[MAX_TRIGGER_EVENT]; unsigned long EventBCountDown; /* Count down counter for Event B. */ -} TRIGGER_EVENT_TAB, *PTRIGGER_EVENT_TAB; +}; /* 7.3.27 20/40 Bss Coexistence Mgmt capability used in extended capabilities information IE( ID = 127 = IE_EXT_CAPABILITY). */ /* This is the first octet and was defined in 802.11n D3.03 and 802.11yD9.0 */ -typedef struct PACKED _EXT_CAP_INFO_ELEMENT { +struct PACKED rt_ext_cap_info_element { u8 BssCoexistMgmtSupport:1; u8 rsv:1; u8 ExtendChannelSwitch:1; u8 rsv2:5; -} EXT_CAP_INFO_ELEMENT, *PEXT_CAP_INFO_ELEMENT; +}; /* 802.11n 7.3.2.61 */ -typedef struct PACKED _BSS_2040_COEXIST_ELEMENT { +struct PACKED rt_bss_2040_coexist_element { u8 ElementID; /* ID = IE_2040_BSS_COEXIST = 72 */ u8 Len; BSS_2040_COEXIST_IE BssCoexistIe; -} BSS_2040_COEXIST_ELEMENT, *PBSS_2040_COEXIST_ELEMENT; +}; /*802.11n 7.3.2.59 */ -typedef struct PACKED _BSS_2040_INTOLERANT_CH_REPORT { +struct PACKED rt_bss_2040_intolerant_ch_report { u8 ElementID; /* ID = IE_2040_BSS_INTOLERANT_REPORT = 73 */ u8 Len; u8 RegulatoryClass; u8 ChList[0]; -} BSS_2040_INTOLERANT_CH_REPORT, *PBSS_2040_INTOLERANT_CH_REPORT; +}; /* The structure for channel switch annoucement IE. This is in 802.11n D3.03 */ -typedef struct PACKED _CHA_SWITCH_ANNOUNCE_IE { +struct PACKED rt_cha_switch_announce_ie { u8 SwitchMode; /*channel switch mode */ u8 NewChannel; /* */ u8 SwitchCount; /* */ -} CHA_SWITCH_ANNOUNCE_IE, *PCHA_SWITCH_ANNOUNCE_IE; +}; /* The structure for channel switch annoucement IE. This is in 802.11n D3.03 */ -typedef struct PACKED _SEC_CHA_OFFSET_IE { +struct PACKED rt_sec_cha_offset_ie { u8 SecondaryChannelOffset; /* 1: Secondary above, 3: Secondary below, 0: no Secondary */ -} SEC_CHA_OFFSET_IE, *PSEC_CHA_OFFSET_IE; +}; -/* This structure is extracted from struct RT_HT_CAPABILITY */ -typedef struct { +/* This structure is extracted from struct struct rt_ht_capability */ +struct rt_ht_phy_info { BOOLEAN bHtEnable; /* If we should use ht rate. */ BOOLEAN bPreNHt; /* If we should use ht rate. */ /*Substract from HT Capability IE */ u8 MCSSet[16]; -} RT_HT_PHY_INFO, *PRT_HT_PHY_INFO; +}; /*This structure substracts ralink supports from all 802.11n-related features. */ /*Features not listed here but contained in 802.11n spec are not supported in rt2860. */ -typedef struct { +struct rt_ht_capability { u16 ChannelWidth:1; u16 MimoPs:2; /*mimo power safe MMPS_ */ u16 GF:1; /*green field */ @@ -408,27 +408,27 @@ typedef struct { u8 NewExtChannelOffset; /* Extension Capability IE = 127 */ u8 BSSCoexist2040; -} RT_HT_CAPABILITY, *PRT_HT_CAPABILITY; +}; /* field in Addtional HT Information IE . */ -typedef struct PACKED { +struct PACKED rt_add_htinfo { u8 ExtChanOffset:2; u8 RecomWidth:1; u8 RifsMode:1; u8 S_PSMPSup:1; /*Indicate support for scheduled PSMP */ u8 SerInterGranu:3; /*service interval granularity */ -} ADD_HTINFO, *PADD_HTINFO; +}; -typedef struct PACKED { +struct PACKED rt_add_htinfo2 { u16 OperaionMode:2; u16 NonGfPresent:1; u16 rsv:1; u16 OBSS_NonHTExist:1; u16 rsv2:11; -} ADD_HTINFO2, *PADD_HTINFO2; +}; /* TODO: Need sync with spec about the definition of StbcMcs. In Draft 3.03, it's reserved. */ -typedef struct PACKED { +struct PACKED rt_add_htinfo3 { u16 StbcMcs:6; u16 DualBeacon:1; u16 DualCTSProtect:1; @@ -437,56 +437,56 @@ typedef struct PACKED { u16 PcoActive:1; u16 PcoPhase:1; u16 rsv:4; -} ADD_HTINFO3, *PADD_HTINFO3; +}; #define SIZE_ADD_HT_INFO_IE 22 -typedef struct PACKED { +struct PACKED rt_add_ht_info_ie { u8 ControlChan; - ADD_HTINFO AddHtInfo; - ADD_HTINFO2 AddHtInfo2; - ADD_HTINFO3 AddHtInfo3; + struct rt_add_htinfo AddHtInfo; + struct rt_add_htinfo2 AddHtInfo2; + struct rt_add_htinfo3 AddHtInfo3; u8 MCSSet[16]; /* Basic MCS set */ -} ADD_HT_INFO_IE, *PADD_HT_INFO_IE; +}; -typedef struct PACKED { +struct PACKED rt_new_ext_chan_ie { u8 NewExtChanOffset; -} NEW_EXT_CHAN_IE, *PNEW_EXT_CHAN_IE; +}; -typedef struct PACKED _FRAME_802_11 { - HEADER_802_11 Hdr; +struct PACKED rt_frame_802_11 { + struct rt_header_802_11 Hdr; u8 Octet[1]; -} FRAME_802_11, *PFRAME_802_11; +}; /* QoSNull embedding of management action. When HT Control MA field set to 1. */ -typedef struct PACKED _MA_BODY { +struct PACKED rt_ma_body { u8 Category; u8 Action; u8 Octet[1]; -} MA_BODY, *PMA_BODY; +}; -typedef struct PACKED _HEADER_802_3 { +struct PACKED rt_header_802_3 { u8 DAAddr1[MAC_ADDR_LEN]; u8 SAAddr2[MAC_ADDR_LEN]; u8 Octet[2]; -} HEADER_802_3, *PHEADER_802_3; +}; /*//Block ACK related format */ /* 2-byte BA Parameter field in DELBA frames to terminate an already set up bA */ -typedef struct PACKED { +struct PACKED rt_delba_parm { u16 Rsv:11; /* always set to 0 */ u16 Initiator:1; /* 1: originator 0:recipient */ u16 TID:4; /* value of TC os TS */ -} DELBA_PARM, *PDELBA_PARM; +}; /* 2-byte BA Parameter Set field in ADDBA frames to signal parm for setting up a BA */ -typedef struct PACKED { +struct PACKED rt_ba_parm { u16 AMSDUSupported:1; /* 0: not permitted 1: permitted */ u16 BAPolicy:1; /* 1: immediately BA 0:delayed BA */ u16 TID:4; /* value of TC os TS */ u16 BufSize:10; /* number of buffe of size 2304 octetsr */ -} BA_PARM, *PBA_PARM; +}; /* 2-byte BA Starting Seq CONTROL field */ -typedef union PACKED { +typedef union PACKED _BASEQ_CONTROL { struct PACKED { u16 FragNum:4; /* always set to 0 */ u16 StartSeq:12; /* sequence number of the 1st MSDU for which this BAR is sent */ @@ -496,177 +496,176 @@ typedef union PACKED { /*BAControl and BARControl are the same */ /* 2-byte BA CONTROL field in BA frame */ -typedef struct PACKED { +struct PACKED rt_ba_control { u16 ACKPolicy:1; /* only related to N-Delayed BA. But not support in RT2860b. 0:NormalACK 1:No ACK */ u16 MTID:1; /*EWC V1.24 */ u16 Compressed:1; u16 Rsv:9; u16 TID:4; -} BA_CONTROL, *PBA_CONTROL; +}; /* 2-byte BAR CONTROL field in BAR frame */ -typedef struct PACKED { +struct PACKED rt_bar_control { u16 ACKPolicy:1; /* 0:normal ack, 1:no ack. */ - u16 MTID:1; /*if this bit1, use FRAME_MTBA_REQ, if 0, use FRAME_BA_REQ */ + u16 MTID:1; /*if this bit1, use struct rt_frame_mtba_req, if 0, use struct rt_frame_ba_req */ u16 Compressed:1; u16 Rsv1:9; u16 TID:4; -} BAR_CONTROL, *PBAR_CONTROL; +}; /* BARControl in MTBAR frame */ -typedef struct PACKED { +struct PACKED rt_mtbar_control { u16 ACKPolicy:1; u16 MTID:1; u16 Compressed:1; u16 Rsv1:9; u16 NumTID:4; -} MTBAR_CONTROL, *PMTBAR_CONTROL; +}; -typedef struct PACKED { +struct PACKED rt_per_tid_info { u16 Rsv1:12; u16 TID:4; -} PER_TID_INFO, *PPER_TID_INFO; +}; -typedef struct { - PER_TID_INFO PerTID; +struct rt_each_tid { + struct rt_per_tid_info PerTID; BASEQ_CONTROL BAStartingSeq; -} EACH_TID, *PEACH_TID; +}; /* BAREQ AND MTBAREQ have the same subtype BAR, 802.11n BAR use compressed bitmap. */ -typedef struct PACKED _FRAME_BA_REQ { - FRAME_CONTROL FC; +struct PACKED rt_frame_ba_req { + struct rt_frame_control FC; u16 Duration; u8 Addr1[MAC_ADDR_LEN]; u8 Addr2[MAC_ADDR_LEN]; - BAR_CONTROL BARControl; + struct rt_bar_control BARControl; BASEQ_CONTROL BAStartingSeq; -} FRAME_BA_REQ, *PFRAME_BA_REQ; +}; -typedef struct PACKED _FRAME_MTBA_REQ { - FRAME_CONTROL FC; +struct PACKED rt_frame_mtba_req { + struct rt_frame_control FC; u16 Duration; u8 Addr1[MAC_ADDR_LEN]; u8 Addr2[MAC_ADDR_LEN]; - MTBAR_CONTROL MTBARControl; - PER_TID_INFO PerTIDInfo; + struct rt_mtbar_control MTBARControl; + struct rt_per_tid_info PerTIDInfo; BASEQ_CONTROL BAStartingSeq; -} FRAME_MTBA_REQ, *PFRAME_MTBA_REQ; +}; /* Compressed format is mandantory in HT STA */ -typedef struct PACKED _FRAME_MTBA { - FRAME_CONTROL FC; +struct PACKED rt_frame_mtba { + struct rt_frame_control FC; u16 Duration; u8 Addr1[MAC_ADDR_LEN]; u8 Addr2[MAC_ADDR_LEN]; - BA_CONTROL BAControl; + struct rt_ba_control BAControl; BASEQ_CONTROL BAStartingSeq; u8 BitMap[8]; -} FRAME_MTBA, *PFRAME_MTBA; +}; -typedef struct PACKED _FRAME_PSMP_ACTION { - HEADER_802_11 Hdr; +struct PACKED rt_frame_psmp_action { + struct rt_header_802_11 Hdr; u8 Category; u8 Action; u8 Psmp; /* 7.3.1.25 */ -} FRAME_PSMP_ACTION, *PFRAME_PSMP_ACTION; +}; -typedef struct PACKED _FRAME_ACTION_HDR { - HEADER_802_11 Hdr; +struct PACKED rt_frame_action_hdr { + struct rt_header_802_11 Hdr; u8 Category; u8 Action; -} FRAME_ACTION_HDR, *PFRAME_ACTION_HDR; +}; /*Action Frame */ /*Action Frame Category:Spectrum, Action:Channel Switch. 7.3.2.20 */ -typedef struct PACKED _CHAN_SWITCH_ANNOUNCE { +struct PACKED rt_chan_switch_announce { u8 ElementID; /* ID = IE_CHANNEL_SWITCH_ANNOUNCEMENT = 37 */ u8 Len; - CHA_SWITCH_ANNOUNCE_IE CSAnnounceIe; -} CHAN_SWITCH_ANNOUNCE, *PCHAN_SWITCH_ANNOUNCE; + struct rt_cha_switch_announce_ie CSAnnounceIe; +}; /*802.11n : 7.3.2.20a */ -typedef struct PACKED _SECOND_CHAN_OFFSET { +struct PACKED rt_second_chan_offset { u8 ElementID; /* ID = IE_SECONDARY_CH_OFFSET = 62 */ u8 Len; - SEC_CHA_OFFSET_IE SecChOffsetIe; -} SECOND_CHAN_OFFSET, *PSECOND_CHAN_OFFSET; + struct rt_sec_cha_offset_ie SecChOffsetIe; +}; -typedef struct PACKED _FRAME_SPETRUM_CS { - HEADER_802_11 Hdr; +struct PACKED rt_frame_spetrum_cs { + struct rt_header_802_11 Hdr; u8 Category; u8 Action; - CHAN_SWITCH_ANNOUNCE CSAnnounce; - SECOND_CHAN_OFFSET SecondChannel; -} FRAME_SPETRUM_CS, *PFRAME_SPETRUM_CS; + struct rt_chan_switch_announce CSAnnounce; + struct rt_second_chan_offset SecondChannel; +}; -typedef struct PACKED _FRAME_ADDBA_REQ { - HEADER_802_11 Hdr; +struct PACKED rt_frame_addba_req { + struct rt_header_802_11 Hdr; u8 Category; u8 Action; u8 Token; /* 1 */ - BA_PARM BaParm; /* 2 - 10 */ + struct rt_ba_parm BaParm; /* 2 - 10 */ u16 TimeOutValue; /* 0 - 0 */ BASEQ_CONTROL BaStartSeq; /* 0-0 */ -} FRAME_ADDBA_REQ, *PFRAME_ADDBA_REQ; +}; -typedef struct PACKED _FRAME_ADDBA_RSP { - HEADER_802_11 Hdr; +struct PACKED rt_frame_addba_rsp { + struct rt_header_802_11 Hdr; u8 Category; u8 Action; u8 Token; u16 StatusCode; - BA_PARM BaParm; /*0 - 2 */ + struct rt_ba_parm BaParm; /*0 - 2 */ u16 TimeOutValue; -} FRAME_ADDBA_RSP, *PFRAME_ADDBA_RSP; +}; -typedef struct PACKED _FRAME_DELBA_REQ { - HEADER_802_11 Hdr; +struct PACKED rt_frame_delba_req { + struct rt_header_802_11 Hdr; u8 Category; u8 Action; - DELBA_PARM DelbaParm; + struct rt_delba_parm DelbaParm; u16 ReasonCode; -} FRAME_DELBA_REQ, *PFRAME_DELBA_REQ; +}; /*7.2.1.7 */ -typedef struct PACKED _FRAME_BAR { - FRAME_CONTROL FC; +struct PACKED rt_frame_bar { + struct rt_frame_control FC; u16 Duration; u8 Addr1[MAC_ADDR_LEN]; u8 Addr2[MAC_ADDR_LEN]; - BAR_CONTROL BarControl; + struct rt_bar_control BarControl; BASEQ_CONTROL StartingSeq; -} FRAME_BAR, *PFRAME_BAR; +}; /*7.2.1.7 */ -typedef struct PACKED _FRAME_BA { - FRAME_CONTROL FC; +struct PACKED rt_frame_ba { + struct rt_frame_control FC; u16 Duration; u8 Addr1[MAC_ADDR_LEN]; u8 Addr2[MAC_ADDR_LEN]; - BAR_CONTROL BarControl; + struct rt_bar_control BarControl; BASEQ_CONTROL StartingSeq; u8 bitmask[8]; -} FRAME_BA, *PFRAME_BA; +}; /* Radio Measuement Request Frame Format */ -typedef struct PACKED _FRAME_RM_REQ_ACTION { - HEADER_802_11 Hdr; +struct PACKED rt_frame_rm_req_action { + struct rt_header_802_11 Hdr; u8 Category; u8 Action; u8 Token; u16 Repetition; u8 data[0]; -} FRAME_RM_REQ_ACTION, *PFRAME_RM_REQ_ACTION; +}; -typedef struct PACKED { +struct PACKED rt_ht_ext_channel_switch_announcement_ie { u8 ID; u8 Length; u8 ChannelSwitchMode; u8 NewRegClass; u8 NewChannelNum; u8 ChannelSwitchCount; -} HT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE, - *PHT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE; +}; /* */ /* _Limit must be the 2**n - 1 */ @@ -681,24 +680,24 @@ typedef struct PACKED { /* */ /* Contention-free parameter (without ID and Length) */ /* */ -typedef struct PACKED { +struct PACKED rt_cf_parm { BOOLEAN bValid; /* 1: variable contains valid value */ u8 CfpCount; u8 CfpPeriod; u16 CfpMaxDuration; u16 CfpDurRemaining; -} CF_PARM, *PCF_PARM; +}; -typedef struct _CIPHER_SUITE { +struct rt_cipher_suite { NDIS_802_11_ENCRYPTION_STATUS PairCipher; /* Unicast cipher 1, this one has more secured cipher suite */ NDIS_802_11_ENCRYPTION_STATUS PairCipherAux; /* Unicast cipher 2 if AP announce two unicast cipher suite */ NDIS_802_11_ENCRYPTION_STATUS GroupCipher; /* Group cipher */ u16 RsnCapability; /* RSN capability from beacon */ BOOLEAN bMixMode; /* Indicate Pair & Group cipher might be different */ -} CIPHER_SUITE, *PCIPHER_SUITE; +}; /* EDCA configuration from AP's BEACON/ProbeRsp */ -typedef struct { +struct rt_edca_parm { BOOLEAN bValid; /* 1: variable contains valid value */ BOOLEAN bAdd; /* 1: variable contains valid value */ BOOLEAN bQAck; @@ -712,18 +711,18 @@ typedef struct { u8 Cwmax[4]; u16 Txop[4]; /* in unit of 32-us */ BOOLEAN bACM[4]; /* 1: Admission Control of AC_BK is mandattory */ -} EDCA_PARM, *PEDCA_PARM; +}; /* QBSS LOAD information from QAP's BEACON/ProbeRsp */ -typedef struct { +struct rt_qbss_load_parm { BOOLEAN bValid; /* 1: variable contains valid value */ u16 StaNum; u8 ChannelUtilization; u16 RemainingAdmissionControl; /* in unit of 32-us */ -} QBSS_LOAD_PARM, *PQBSS_LOAD_PARM; +}; /* QBSS Info field in QSTA's assoc req */ -typedef struct PACKED { +struct PACKED rt_qbss_sta_info_parm { u8 UAPSD_AC_VO:1; u8 UAPSD_AC_VI:1; u8 UAPSD_AC_BK:1; @@ -731,32 +730,32 @@ typedef struct PACKED { u8 Rsv1:1; u8 MaxSPLength:2; u8 Rsv2:1; -} QBSS_STA_INFO_PARM, *PQBSS_STA_INFO_PARM; +}; /* QBSS Info field in QAP's Beacon/ProbeRsp */ -typedef struct PACKED { +struct PACKED rt_qbss_ap_info_parm { u8 ParamSetCount:4; u8 Rsv:3; u8 UAPSD:1; -} QBSS_AP_INFO_PARM, *PQBSS_AP_INFO_PARM; +}; /* QOS Capability reported in QAP's BEACON/ProbeRsp */ /* QOS Capability sent out in QSTA's AssociateReq/ReAssociateReq */ -typedef struct { +struct rt_qos_capability_parm { BOOLEAN bValid; /* 1: variable contains valid value */ BOOLEAN bQAck; BOOLEAN bQueueRequest; BOOLEAN bTxopRequest; /* BOOLEAN bMoreDataAck; */ u8 EdcaUpdateCount; -} QOS_CAPABILITY_PARM, *PQOS_CAPABILITY_PARM; +}; -typedef struct { +struct rt_wpa_ie { u8 IELen; u8 IE[MAX_CUSTOM_LEN]; -} WPA_IE_; +}; -typedef struct { +struct rt_bss_entry { u8 Bssid[MAC_ADDR_LEN]; u8 Channel; u8 CentralChannel; /*Store the wide-band central channel for 40MHz. .used in 40MHz AP. Or this is the same as Channel. */ @@ -768,9 +767,9 @@ typedef struct { u8 SupRateLen; u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; u8 ExtRateLen; - HT_CAPABILITY_IE HtCapability; + struct rt_ht_capability_ie HtCapability; u8 HtCapabilityLen; - ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ + struct rt_add_ht_info_ie AddHtInfo; /* AP might use this additional ht info IE */ u8 AddHtInfoLen; u8 NewExtChanOffset; char Rssi; @@ -792,11 +791,11 @@ typedef struct { BOOLEAN bSES; /* New for WPA2 */ - CIPHER_SUITE WPA; /* AP announced WPA cipher suite */ - CIPHER_SUITE WPA2; /* AP announced WPA2 cipher suite */ + struct rt_cipher_suite WPA; /* AP announced WPA cipher suite */ + struct rt_cipher_suite WPA2; /* AP announced WPA2 cipher suite */ /* New for microsoft WPA support */ - NDIS_802_11_FIXED_IEs FixIEs; + struct rt_ndis_802_11_fixed_ies FixIEs; NDIS_802_11_AUTHENTICATION_MODE AuthModeAux; /* Addition mode for WPA2 / WPA capable AP */ NDIS_802_11_AUTHENTICATION_MODE AuthMode; NDIS_802_11_WEP_STATUS WepStatus; /* Unicast Encryption Algorithm extract from VAR_IE */ @@ -811,20 +810,20 @@ typedef struct { u8 TTSF[8]; /* Target TSF */ /* 802.11e d9, and WMM */ - EDCA_PARM EdcaParm; - QOS_CAPABILITY_PARM QosCapability; - QBSS_LOAD_PARM QbssLoad; - WPA_IE_ WpaIE; - WPA_IE_ RsnIE; -} BSS_ENTRY, *PBSS_ENTRY; - -typedef struct { + struct rt_edca_parm EdcaParm; + struct rt_qos_capability_parm QosCapability; + struct rt_qbss_load_parm QbssLoad; + struct rt_wpa_ie WpaIE; + struct rt_wpa_ie RsnIE; +}; + +struct rt_bss_table { u8 BssNr; u8 BssOverlapNr; - BSS_ENTRY BssEntry[MAX_LEN_OF_BSS_TABLE]; -} BSS_TABLE, *PBSS_TABLE; + struct rt_bss_entry BssEntry[MAX_LEN_OF_BSS_TABLE]; +}; -typedef struct _MLME_QUEUE_ELEM { +struct rt_mlme_queue_elem { unsigned long Machine; unsigned long MsgType; unsigned long MsgLen; @@ -837,25 +836,25 @@ typedef struct _MLME_QUEUE_ELEM { u8 Channel; u8 Wcid; BOOLEAN Occupied; -} MLME_QUEUE_ELEM, *PMLME_QUEUE_ELEM; +}; -typedef struct _MLME_QUEUE { +struct rt_mlme_queue { unsigned long Num; unsigned long Head; unsigned long Tail; spinlock_t Lock; - MLME_QUEUE_ELEM Entry[MAX_LEN_OF_MLME_QUEUE]; -} MLME_QUEUE, *PMLME_QUEUE; + struct rt_mlme_queue_elem Entry[MAX_LEN_OF_MLME_QUEUE]; +}; -typedef void(*STATE_MACHINE_FUNC) (void * Adaptor, MLME_QUEUE_ELEM * Elem); +typedef void(*STATE_MACHINE_FUNC) (void * Adaptor, struct rt_mlme_queue_elem *Elem); -typedef struct _STATE_MACHINE { +struct rt_state_machine { unsigned long Base; unsigned long NrState; unsigned long NrMsg; unsigned long CurrState; STATE_MACHINE_FUNC *TransFunc; -} STATE_MACHINE, *PSTATE_MACHINE; +}; /* MLME AUX data structure that hold temporarliy settings during a connection attempt. */ /* Once this attemp succeeds, all settings will be copy to pAd->StaActive. */ @@ -863,7 +862,7 @@ typedef struct _STATE_MACHINE { /* several steps (JOIN, AUTH, ASSOC or REASSOC) and may fail at any step. We purposely */ /* separate this under-trial settings away from pAd->StaActive so that once */ /* this new attempt failed, driver can auto-recover back to the active settings. */ -typedef struct _MLME_AUX { +struct rt_mlme_aux { u8 BssType; u8 Ssid[MAX_LEN_OF_SSID]; u8 SsidLen; @@ -887,33 +886,33 @@ typedef struct _MLME_AUX { u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES]; u8 SupRateLen; u8 ExtRateLen; - HT_CAPABILITY_IE HtCapability; + struct rt_ht_capability_ie HtCapability; u8 HtCapabilityLen; - ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ + struct rt_add_ht_info_ie AddHtInfo; /* AP might use this additional ht info IE */ u8 NewExtChannelOffset; - /*RT_HT_CAPABILITY SupportedHtPhy; */ + /*struct rt_ht_capability SupportedHtPhy; */ /* new for QOS */ - QOS_CAPABILITY_PARM APQosCapability; /* QOS capability of the current associated AP */ - EDCA_PARM APEdcaParm; /* EDCA parameters of the current associated AP */ - QBSS_LOAD_PARM APQbssLoad; /* QBSS load of the current associated AP */ + struct rt_qos_capability_parm APQosCapability; /* QOS capability of the current associated AP */ + struct rt_edca_parm APEdcaParm; /* EDCA parameters of the current associated AP */ + struct rt_qbss_load_parm APQbssLoad; /* QBSS load of the current associated AP */ /* new to keep Ralink specific feature */ unsigned long APRalinkIe; - BSS_TABLE SsidBssTab; /* AP list for the same SSID */ - BSS_TABLE RoamTab; /* AP list eligible for roaming */ + struct rt_bss_table SsidBssTab; /* AP list for the same SSID */ + struct rt_bss_table RoamTab; /* AP list eligible for roaming */ unsigned long BssIdx; unsigned long RoamIdx; BOOLEAN CurrReqIsFromNdis; - RALINK_TIMER_STRUCT BeaconTimer, ScanTimer; - RALINK_TIMER_STRUCT AuthTimer; - RALINK_TIMER_STRUCT AssocTimer, ReassocTimer, DisassocTimer; -} MLME_AUX, *PMLME_AUX; + struct rt_ralink_timer BeaconTimer, ScanTimer; + struct rt_ralink_timer AuthTimer; + struct rt_ralink_timer AssocTimer, ReassocTimer, DisassocTimer; +}; -typedef struct _MLME_ADDBA_REQ_STRUCT { +struct rt_mlme_addba_req { u8 Wcid; /* */ u8 pAddr[MAC_ADDR_LEN]; u8 BaBufSize; @@ -921,64 +920,63 @@ typedef struct _MLME_ADDBA_REQ_STRUCT { u8 TID; u8 Token; u16 BaStartSeq; -} MLME_ADDBA_REQ_STRUCT, *PMLME_ADDBA_REQ_STRUCT; +}; -typedef struct _MLME_DELBA_REQ_STRUCT { +struct rt_mlme_delba_req { u8 Wcid; /* */ u8 Addr[MAC_ADDR_LEN]; u8 TID; u8 Initiator; -} MLME_DELBA_REQ_STRUCT, *PMLME_DELBA_REQ_STRUCT; +}; /* assoc struct is equal to reassoc */ -typedef struct _MLME_ASSOC_REQ_STRUCT { +struct rt_mlme_assoc_req { u8 Addr[MAC_ADDR_LEN]; u16 CapabilityInfo; u16 ListenIntv; unsigned long Timeout; -} MLME_ASSOC_REQ_STRUCT, *PMLME_ASSOC_REQ_STRUCT, MLME_REASSOC_REQ_STRUCT, - *PMLME_REASSOC_REQ_STRUCT; +}; -typedef struct _MLME_DISASSOC_REQ_STRUCT { +struct rt_mlme_disassoc_req { u8 Addr[MAC_ADDR_LEN]; u16 Reason; -} MLME_DISASSOC_REQ_STRUCT, *PMLME_DISASSOC_REQ_STRUCT; +}; -typedef struct _MLME_AUTH_REQ_STRUCT { +struct rt_mlme_auth_req { u8 Addr[MAC_ADDR_LEN]; u16 Alg; unsigned long Timeout; -} MLME_AUTH_REQ_STRUCT, *PMLME_AUTH_REQ_STRUCT; +}; -typedef struct _MLME_DEAUTH_REQ_STRUCT { +struct rt_mlme_deauth_req { u8 Addr[MAC_ADDR_LEN]; u16 Reason; -} MLME_DEAUTH_REQ_STRUCT, *PMLME_DEAUTH_REQ_STRUCT; +}; -typedef struct { +struct rt_mlme_join_req { unsigned long BssIdx; -} MLME_JOIN_REQ_STRUCT; +}; -typedef struct _MLME_SCAN_REQ_STRUCT { +struct rt_mlme_scan_req { u8 Bssid[MAC_ADDR_LEN]; u8 BssType; u8 ScanType; u8 SsidLen; char Ssid[MAX_LEN_OF_SSID]; -} MLME_SCAN_REQ_STRUCT, *PMLME_SCAN_REQ_STRUCT; +}; -typedef struct _MLME_START_REQ_STRUCT { +struct rt_mlme_start_req { char Ssid[MAX_LEN_OF_SSID]; u8 SsidLen; -} MLME_START_REQ_STRUCT, *PMLME_START_REQ_STRUCT; +}; -typedef struct PACKED { +struct PACKED rt_eid { u8 Eid; u8 Len; u8 Octet[1]; -} EID_STRUCT, *PEID_STRUCT, BEACON_EID_STRUCT, *PBEACON_EID_STRUCT; +}; -typedef struct PACKED _RTMP_TX_RATE_SWITCH { +struct PACKED rt_rtmp_tx_rate_switch { u8 ItemNo; u8 STBC:1; u8 ShortGI:1; @@ -989,7 +987,7 @@ typedef struct PACKED _RTMP_TX_RATE_SWITCH { u8 CurrMCS; u8 TrainUp; u8 TrainDown; -} RRTMP_TX_RATE_SWITCH, *PRTMP_TX_RATE_SWITCH; +}; /* ========================== AP mlme.h =============================== */ #define TBTT_PRELOAD_TIME 384 /* usec. LomgPreamble + 24-byte at 1Mbps */ diff --git a/drivers/staging/rt2860/oid.h b/drivers/staging/rt2860/oid.h index 05a71f027468..fa4a2e692e79 100644 --- a/drivers/staging/rt2860/oid.h +++ b/drivers/staging/rt2860/oid.h @@ -137,9 +137,9 @@ typedef enum _NDIS_802_11_STATUS_TYPE { typedef u8 NDIS_802_11_MAC_ADDRESS[6]; -typedef struct _NDIS_802_11_STATUS_INDICATION { +struct rt_ndis_802_11_status_indication { NDIS_802_11_STATUS_TYPE StatusType; -} NDIS_802_11_STATUS_INDICATION, *PNDIS_802_11_STATUS_INDICATION; +}; /* mask for authentication/integrity fields */ #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f @@ -149,23 +149,23 @@ typedef struct _NDIS_802_11_STATUS_INDICATION { #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E -typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST { +struct rt_ndis_802_11_authentication_request { unsigned long Length; /* Length of structure */ NDIS_802_11_MAC_ADDRESS Bssid; unsigned long Flags; -} NDIS_802_11_AUTHENTICATION_REQUEST, *PNDIS_802_11_AUTHENTICATION_REQUEST; +}; /*Added new types for PMKID Candidate lists. */ -typedef struct _PMKID_CANDIDATE { +struct rt_pmkid_candidate { NDIS_802_11_MAC_ADDRESS BSSID; unsigned long Flags; -} PMKID_CANDIDATE, *PPMKID_CANDIDATE; +}; -typedef struct _NDIS_802_11_PMKID_CANDIDATE_LIST { +struct rt_ndis_802_11_pmkid_candidate_list { unsigned long Version; /* Version of the structure */ unsigned long NumCandidates; /* No. of pmkid candidates */ - PMKID_CANDIDATE CandidateList[1]; -} NDIS_802_11_PMKID_CANDIDATE_LIST, *PNDIS_802_11_PMKID_CANDIDATE_LIST; + struct rt_pmkid_candidate CandidateList[1]; +}; /*Flags for PMKID Candidate list structure */ #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01 @@ -182,10 +182,10 @@ typedef enum _NDIS_802_11_NETWORK_TYPE { Ndis802_11NetworkTypeMax /* not a real type, defined as an upper bound */ } NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE; -typedef struct _NDIS_802_11_NETWORK_TYPE_LIST { +struct rt_ndis_802_11_network_type_list { u32 NumberOfItems; /* in list below, at least 1 */ NDIS_802_11_NETWORK_TYPE NetworkType[1]; -} NDIS_802_11_NETWORK_TYPE_LIST, *PNDIS_802_11_NETWORK_TYPE_LIST; +}; typedef enum _NDIS_802_11_POWER_MODE { Ndis802_11PowerModeCAM, @@ -202,22 +202,22 @@ typedef unsigned long NDIS_802_11_TX_POWER_LEVEL; /* in milliwatts */ /* */ typedef long NDIS_802_11_RSSI; /* in dBm */ -typedef struct _NDIS_802_11_CONFIGURATION_FH { +struct rt_ndis_802_11_configuration_fh { unsigned long Length; /* Length of structure */ unsigned long HopPattern; /* As defined by 802.11, MSB set */ unsigned long HopSet; /* to one if non-802.11 */ unsigned long DwellTime; /* units are Kusec */ -} NDIS_802_11_CONFIGURATION_FH, *PNDIS_802_11_CONFIGURATION_FH; +}; -typedef struct _NDIS_802_11_CONFIGURATION { +struct rt_ndis_802_11_configuration { unsigned long Length; /* Length of structure */ unsigned long BeaconPeriod; /* units are Kusec */ unsigned long ATIMWindow; /* units are Kusec */ unsigned long DSConfig; /* Frequency, units are kHz */ - NDIS_802_11_CONFIGURATION_FH FHConfig; -} NDIS_802_11_CONFIGURATION, *PNDIS_802_11_CONFIGURATION; + struct rt_ndis_802_11_configuration_fh FHConfig; +}; -typedef struct _NDIS_802_11_STATISTICS { +struct rt_ndis_802_11_statistics { unsigned long Length; /* Length of structure */ LARGE_INTEGER TransmittedFragmentCount; LARGE_INTEGER MulticastTransmittedFrameCount; @@ -240,31 +240,31 @@ typedef struct _NDIS_802_11_STATISTICS { LARGE_INTEGER CCMPReplays; LARGE_INTEGER CCMPDecryptErrors; LARGE_INTEGER FourWayHandshakeFailures; -} NDIS_802_11_STATISTICS, *PNDIS_802_11_STATISTICS; +}; typedef unsigned long NDIS_802_11_KEY_INDEX; typedef unsigned long long NDIS_802_11_KEY_RSC; #define MAX_RADIUS_SRV_NUM 2 /* 802.1x failover number */ -typedef struct PACKED _RADIUS_SRV_INFO { +struct PACKED rt_radius_srv_info { u32 radius_ip; u32 radius_port; u8 radius_key[64]; u8 radius_key_len; -} RADIUS_SRV_INFO, *PRADIUS_SRV_INFO; +}; -typedef struct PACKED _RADIUS_KEY_INFO { +struct PACKED rt_radius_key_info { u8 radius_srv_num; - RADIUS_SRV_INFO radius_srv_info[MAX_RADIUS_SRV_NUM]; + struct rt_radius_srv_info radius_srv_info[MAX_RADIUS_SRV_NUM]; u8 ieee8021xWEP; /* dynamic WEP */ u8 key_index; u8 key_length; /* length of key in bytes */ u8 key_material[13]; -} RADIUS_KEY_INFO, *PRADIUS_KEY_INFO; +}; /* It's used by 802.1x daemon to require relative configuration */ -typedef struct PACKED _RADIUS_CONF { +struct PACKED rt_radius_conf { u32 Length; /* Length of this structure */ u8 mbss_num; /* indicate multiple BSS number */ u32 own_ip_addr; @@ -274,38 +274,38 @@ typedef struct PACKED _RADIUS_CONF { u8 EAPifname_len[8]; u8 PreAuthifname[8][IFNAMSIZ]; u8 PreAuthifname_len[8]; - RADIUS_KEY_INFO RadiusInfo[8]; -} RADIUS_CONF, *PRADIUS_CONF; + struct rt_radius_key_info RadiusInfo[8]; +}; /* Key mapping keys require a BSSID */ -typedef struct _NDIS_802_11_KEY { +struct rt_ndis_802_11_key { u32 Length; /* Length of this structure */ u32 KeyIndex; u32 KeyLength; /* length of key in bytes */ NDIS_802_11_MAC_ADDRESS BSSID; NDIS_802_11_KEY_RSC KeyRSC; u8 KeyMaterial[1]; /* variable length depending on above field */ -} NDIS_802_11_KEY, *PNDIS_802_11_KEY; +}; -typedef struct _NDIS_802_11_PASSPHRASE { +struct rt_ndis_802_11_passphrase { u32 KeyLength; /* length of key in bytes */ NDIS_802_11_MAC_ADDRESS BSSID; u8 KeyMaterial[1]; /* variable length depending on above field */ -} NDIS_802_11_PASSPHRASE, *PNDIS_802_11_PASSPHRASE; +}; -typedef struct _NDIS_802_11_REMOVE_KEY { +struct rt_ndis_802_11_remove_key { u32 Length; /* Length of this structure */ u32 KeyIndex; NDIS_802_11_MAC_ADDRESS BSSID; -} NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY; +}; -typedef struct _NDIS_802_11_WEP { +struct rt_ndis_802_11_wep { u32 Length; /* Length of this structure */ u32 KeyIndex; /* 0 is the per-client key, 1-N are the */ /* global keys */ u32 KeyLength; /* length of key in bytes */ u8 KeyMaterial[1]; /* variable length depending on above field */ -} NDIS_802_11_WEP, *PNDIS_802_11_WEP; +}; typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE { Ndis802_11IBSS, @@ -333,63 +333,63 @@ typedef enum _NDIS_802_11_AUTHENTICATION_MODE { typedef u8 NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; /* Set of 8 data rates */ typedef u8 NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; /* Set of 16 data rates */ -typedef struct PACKED _NDIS_802_11_SSID { +struct PACKED rt_ndis_802_11_ssid { u32 SsidLength; /* length of SSID field below, in bytes; */ /* this can be zero. */ u8 Ssid[NDIS_802_11_LENGTH_SSID]; /* SSID information field */ -} NDIS_802_11_SSID, *PNDIS_802_11_SSID; +}; -typedef struct PACKED _NDIS_WLAN_BSSID { +struct PACKED rt_ndis_wlan_bssid { unsigned long Length; /* Length of this structure */ NDIS_802_11_MAC_ADDRESS MacAddress; /* BSSID */ u8 Reserved[2]; - NDIS_802_11_SSID Ssid; /* SSID */ + struct rt_ndis_802_11_ssid Ssid; /* SSID */ unsigned long Privacy; /* WEP encryption requirement */ NDIS_802_11_RSSI Rssi; /* receive signal strength in dBm */ NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; - NDIS_802_11_CONFIGURATION Configuration; + struct rt_ndis_802_11_configuration Configuration; NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; NDIS_802_11_RATES SupportedRates; -} NDIS_WLAN_BSSID, *PNDIS_WLAN_BSSID; +}; -typedef struct PACKED _NDIS_802_11_BSSID_LIST { +struct PACKED rt_ndis_802_11_bssid_list { u32 NumberOfItems; /* in list below, at least 1 */ - NDIS_WLAN_BSSID Bssid[1]; -} NDIS_802_11_BSSID_LIST, *PNDIS_802_11_BSSID_LIST; + struct rt_ndis_wlan_bssid Bssid[1]; +}; /* Added Capabilities, IELength and IEs for each BSSID */ -typedef struct PACKED _NDIS_WLAN_BSSID_EX { +struct PACKED rt_ndis_wlan_bssid_ex { unsigned long Length; /* Length of this structure */ NDIS_802_11_MAC_ADDRESS MacAddress; /* BSSID */ u8 Reserved[2]; - NDIS_802_11_SSID Ssid; /* SSID */ + struct rt_ndis_802_11_ssid Ssid; /* SSID */ u32 Privacy; /* WEP encryption requirement */ NDIS_802_11_RSSI Rssi; /* receive signal */ /* strength in dBm */ NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; - NDIS_802_11_CONFIGURATION Configuration; + struct rt_ndis_802_11_configuration Configuration; NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; NDIS_802_11_RATES_EX SupportedRates; unsigned long IELength; u8 IEs[1]; -} NDIS_WLAN_BSSID_EX, *PNDIS_WLAN_BSSID_EX; +}; -typedef struct PACKED _NDIS_802_11_BSSID_LIST_EX { +struct PACKED rt_ndis_802_11_bssid_list_ex { u32 NumberOfItems; /* in list below, at least 1 */ - NDIS_WLAN_BSSID_EX Bssid[1]; -} NDIS_802_11_BSSID_LIST_EX, *PNDIS_802_11_BSSID_LIST_EX; + struct rt_ndis_wlan_bssid_ex Bssid[1]; +}; -typedef struct PACKED _NDIS_802_11_FIXED_IEs { +struct PACKED rt_ndis_802_11_fixed_ies { u8 Timestamp[8]; u16 BeaconInterval; u16 Capabilities; -} NDIS_802_11_FIXED_IEs, *PNDIS_802_11_FIXED_IEs; +}; -typedef struct _NDIS_802_11_VARIABLE_IEs { +struct rt_ndis_802_11_variable_ies { u8 ElementID; u8 Length; /* Number of bytes in data field */ u8 data[1]; -} NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs; +}; typedef unsigned long NDIS_802_11_FRAGMENTATION_THRESHOLD; @@ -436,34 +436,34 @@ typedef enum _NDIS_802_11_RELOAD_DEFAULTS { #define NDIS_802_11_AI_RESFI_STATUSCODE 2 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4 -typedef struct _NDIS_802_11_AI_REQFI { +struct rt_ndis_802_11_ai_reqfi { u16 Capabilities; u16 ListenInterval; NDIS_802_11_MAC_ADDRESS CurrentAPAddress; -} NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI; +}; -typedef struct _NDIS_802_11_AI_RESFI { +struct rt_ndis_802_11_ai_resfi { u16 Capabilities; u16 StatusCode; u16 AssociationId; -} NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI; +}; -typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION { +struct rt_ndis_802_11_association_information { unsigned long Length; u16 AvailableRequestFixedIEs; - NDIS_802_11_AI_REQFI RequestFixedIEs; + struct rt_ndis_802_11_ai_reqfi RequestFixedIEs; unsigned long RequestIELength; unsigned long OffsetRequestIEs; u16 AvailableResponseFixedIEs; - NDIS_802_11_AI_RESFI ResponseFixedIEs; + struct rt_ndis_802_11_ai_resfi ResponseFixedIEs; unsigned long ResponseIELength; unsigned long OffsetResponseIEs; -} NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION; +}; -typedef struct _NDIS_802_11_AUTHENTICATION_EVENT { - NDIS_802_11_STATUS_INDICATION Status; - NDIS_802_11_AUTHENTICATION_REQUEST Request[1]; -} NDIS_802_11_AUTHENTICATION_EVENT, *PNDIS_802_11_AUTHENTICATION_EVENT; +struct rt_ndis_802_11_authentication_event { + struct rt_ndis_802_11_status_indication Status; + struct rt_ndis_802_11_authentication_request Request[1]; +}; /* 802.11 Media stream constraints, associated with OID_802_11_MEDIA_STREAM_MODE */ typedef enum _NDIS_802_11_MEDIA_STREAM_MODE { @@ -474,31 +474,30 @@ typedef enum _NDIS_802_11_MEDIA_STREAM_MODE { /* PMKID Structures */ typedef u8 NDIS_802_11_PMKID_VALUE[16]; -typedef struct _BSSID_INFO { +struct rt_bssid_info { NDIS_802_11_MAC_ADDRESS BSSID; NDIS_802_11_PMKID_VALUE PMKID; -} BSSID_INFO, *PBSSID_INFO; +}; -typedef struct _NDIS_802_11_PMKID { +struct rt_ndis_802_11_pmkid { u32 Length; u32 BSSIDInfoCount; - BSSID_INFO BSSIDInfo[1]; -} NDIS_802_11_PMKID, *PNDIS_802_11_PMKID; + struct rt_bssid_info BSSIDInfo[1]; +}; -typedef struct _NDIS_802_11_AUTHENTICATION_ENCRYPTION { +struct rt_ndis_802_11_authentication_encryption { NDIS_802_11_AUTHENTICATION_MODE AuthModeSupported; NDIS_802_11_ENCRYPTION_STATUS EncryptStatusSupported; -} NDIS_802_11_AUTHENTICATION_ENCRYPTION, - *PNDIS_802_11_AUTHENTICATION_ENCRYPTION; +}; -typedef struct _NDIS_802_11_CAPABILITY { +struct rt_ndis_802_11_capability { unsigned long Length; unsigned long Version; unsigned long NoOfPMKIDs; unsigned long NoOfAuthEncryptPairsSupported; - NDIS_802_11_AUTHENTICATION_ENCRYPTION + struct rt_ndis_802_11_authentication_encryption AuthenticationEncryptionSupported[1]; -} NDIS_802_11_CAPABILITY, *PNDIS_802_11_CAPABILITY; +}; #define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x01) /* Sync. with AP for wsc upnp daemon */ #define RTPRIV_IOCTL_SET (SIOCIWFIRSTPRIV + 0x02) @@ -595,25 +594,25 @@ typedef enum _RT_802_11_PHY_MODE { } RT_802_11_PHY_MODE; /* put all proprietery for-query objects here to reduce # of Query_OID */ -typedef struct _RT_802_11_LINK_STATUS { +struct rt_802_11_link_status { unsigned long CurrTxRate; /* in units of 0.5Mbps */ unsigned long ChannelQuality; /* 0..100 % */ unsigned long TxByteCount; /* both ok and fail */ unsigned long RxByteCount; /* both ok and fail */ unsigned long CentralChannel; /* 40MHz central channel number */ -} RT_802_11_LINK_STATUS, *PRT_802_11_LINK_STATUS; +}; -typedef struct _RT_802_11_EVENT_LOG { +struct rt_802_11_event_log { LARGE_INTEGER SystemTime; /* timestammp via NdisGetCurrentSystemTime() */ u8 Addr[MAC_ADDR_LENGTH]; u16 Event; /* EVENT_xxx */ -} RT_802_11_EVENT_LOG, *PRT_802_11_EVENT_LOG; +}; -typedef struct _RT_802_11_EVENT_TABLE { +struct rt_802_11_event_table { unsigned long Num; unsigned long Rsv; /* to align Log[] at LARGE_INEGER boundary */ - RT_802_11_EVENT_LOG Log[MAX_NUMBER_OF_EVENT]; -} RT_802_11_EVENT_TABLE, PRT_802_11_EVENT_TABLE; + struct rt_802_11_event_log Log[MAX_NUMBER_OF_EVENT]; +}; /* MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!! */ typedef union _MACHTTRANSMIT_SETTING { @@ -628,7 +627,7 @@ typedef union _MACHTTRANSMIT_SETTING { u16 word; } MACHTTRANSMIT_SETTING, *PMACHTTRANSMIT_SETTING; -typedef struct _RT_802_11_MAC_ENTRY { +struct rt_802_11_mac_entry { u8 Addr[MAC_ADDR_LENGTH]; u8 Aid; u8 Psm; /* 0:PWR_ACTIVE, 1:PWR_SAVE */ @@ -638,21 +637,21 @@ typedef struct _RT_802_11_MAC_ENTRY { char AvgRssi2; u32 ConnectedTime; MACHTTRANSMIT_SETTING TxRate; -} RT_802_11_MAC_ENTRY, *PRT_802_11_MAC_ENTRY; +}; -typedef struct _RT_802_11_MAC_TABLE { +struct rt_802_11_mac_table { unsigned long Num; - RT_802_11_MAC_ENTRY Entry[MAX_NUMBER_OF_MAC]; -} RT_802_11_MAC_TABLE, *PRT_802_11_MAC_TABLE; + struct rt_802_11_mac_entry Entry[MAX_NUMBER_OF_MAC]; +}; /* structure for query/set hardware register - MAC, BBP, RF register */ -typedef struct _RT_802_11_HARDWARE_REGISTER { +struct rt_802_11_hardware_register { unsigned long HardwareType; /* 0:MAC, 1:BBP, 2:RF register, 3:EEPROM */ unsigned long Offset; /* Q/S register offset addr */ unsigned long Data; /* R/W data buffer */ -} RT_802_11_HARDWARE_REGISTER, *PRT_802_11_HARDWARE_REGISTER; +}; -typedef struct _RT_802_11_AP_CONFIG { +struct rt_802_11_ap_config { unsigned long EnableTxBurst; /* 0-disable, 1-enable */ unsigned long EnableTurboRate; /* 0-disable, 1-enable 72/100mbps turbo rate */ unsigned long IsolateInterStaTraffic; /* 0-disable, 1-enable isolation */ @@ -661,10 +660,10 @@ typedef struct _RT_802_11_AP_CONFIG { unsigned long UseShortSlotTime; /* 0-no use, 1-use 9-us short slot time */ unsigned long Rsv1; /* must be 0 */ unsigned long SystemErrorBitmap; /* ignore upon SET, return system error upon QUERY */ -} RT_802_11_AP_CONFIG, *PRT_802_11_AP_CONFIG; +}; /* structure to query/set STA_CONFIG */ -typedef struct _RT_802_11_STA_CONFIG { +struct rt_802_11_sta_config { unsigned long EnableTxBurst; /* 0-disable, 1-enable */ unsigned long EnableTurboRate; /* 0-disable, 1-enable 72/100mbps turbo rate */ unsigned long UseBGProtection; /* 0-AUTO, 1-always ON, 2-always OFF */ @@ -673,12 +672,12 @@ typedef struct _RT_802_11_STA_CONFIG { unsigned long HwRadioStatus; /* 0-OFF, 1-ON, default is 1, Read-Only */ unsigned long Rsv1; /* must be 0 */ unsigned long SystemErrorBitmap; /* ignore upon SET, return system error upon QUERY */ -} RT_802_11_STA_CONFIG, *PRT_802_11_STA_CONFIG; +}; /* */ /* For OID Query or Set about BA structure */ /* */ -typedef struct _OID_BACAP_STRUC { +struct rt_oid_bacap { u8 RxBAWinLimit; u8 TxBAWinLimit; u8 Policy; /* 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid */ @@ -687,32 +686,32 @@ typedef struct _OID_BACAP_STRUC { u8 AmsduSize; /* 0:3839, 1:7935 bytes. u32 MSDUSizeToBytes[] = { 3839, 7935}; */ u8 MMPSmode; /* MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable */ BOOLEAN AutoBA; /* Auto BA will automatically */ -} OID_BACAP_STRUC, *POID_BACAP_STRUC; +}; -typedef struct _RT_802_11_ACL_ENTRY { +struct rt_802_11_acl_entry { u8 Addr[MAC_ADDR_LENGTH]; u16 Rsv; -} RT_802_11_ACL_ENTRY, *PRT_802_11_ACL_ENTRY; +}; -typedef struct PACKED _RT_802_11_ACL { +struct PACKED rt_rt_802_11_acl { unsigned long Policy; /* 0-disable, 1-positive list, 2-negative list */ unsigned long Num; - RT_802_11_ACL_ENTRY Entry[MAX_NUMBER_OF_ACL]; -} RT_802_11_ACL, *PRT_802_11_ACL; + struct rt_802_11_acl_entry Entry[MAX_NUMBER_OF_ACL]; +}; -typedef struct _RT_802_11_WDS { +struct rt_802_11_wds { unsigned long Num; NDIS_802_11_MAC_ADDRESS Entry[24 /*MAX_NUM_OF_WDS_LINK */ ]; unsigned long KeyLength; u8 KeyMaterial[32]; -} RT_802_11_WDS, *PRT_802_11_WDS; +}; -typedef struct _RT_802_11_TX_RATES_ { +struct rt_802_11_tx_rates { u8 SupRateLen; u8 SupRate[MAX_LENGTH_OF_SUPPORT_RATES]; u8 ExtRateLen; u8 ExtRate[MAX_LENGTH_OF_SUPPORT_RATES]; -} RT_802_11_TX_RATES, *PRT_802_11_TX_RATES; +}; /* Definition of extra information code */ #define GENERAL_LINK_UP 0x0 /* Link is Up */ @@ -732,7 +731,7 @@ typedef struct _RT_802_11_TX_RATES_ { #define EXTRA_INFO_CLEAR 0xffffffff /* This is OID setting structure. So only GF or MM as Mode. This is valid when our wirelss mode has 802.11n in use. */ -typedef struct { +struct rt_oid_set_ht_phymode { RT_802_11_PHY_MODE PhyMode; /* */ u8 TransmitNo; u8 HtMode; /*HTMODE_GF or HTMODE_MM */ @@ -742,7 +741,7 @@ typedef struct { u8 STBC; u8 SHORTGI; u8 rsv; -} OID_SET_HT_PHYMODE, *POID_SET_HT_PHYMODE; +}; #define MAX_CUSTOM_LEN 128 @@ -752,14 +751,14 @@ typedef enum _RT_802_11_D_CLIENT_MODE { Rt802_11_D_Strict, } RT_802_11_D_CLIENT_MODE, *PRT_802_11_D_CLIENT_MODE; -typedef struct _RT_CHANNEL_LIST_INFO { +struct rt_channel_list_info { u8 ChannelList[MAX_NUM_OF_CHS]; /* list all supported channels for site survey */ u8 ChannelListNum; /* number of channel in ChannelList[] */ -} RT_CHANNEL_LIST_INFO, *PRT_CHANNEL_LIST_INFO; +}; /* WSC configured credential */ -typedef struct _WSC_CREDENTIAL { - NDIS_802_11_SSID SSID; /* mandatory */ +struct rt_wsc_credential { + struct rt_ndis_802_11_ssid SSID; /* mandatory */ u16 AuthType; /* mandatory, 1: open, 2: wpa-psk, 4: shared, 8:wpa, 0x10: wpa2, 0x20: wpa2-psk */ u16 EncrType; /* mandatory, 1: none, 2: wep, 4: tkip, 8: aes */ u8 Key[64]; /* mandatory, Maximum 64 byte */ @@ -767,13 +766,13 @@ typedef struct _WSC_CREDENTIAL { u8 MacAddr[6]; /* mandatory, AP MAC address */ u8 KeyIndex; /* optional, default is 1 */ u8 Rsvd[3]; /* Make alignment */ -} WSC_CREDENTIAL, *PWSC_CREDENTIAL; +}; /* WSC configured profiles */ -typedef struct _WSC_PROFILE { +struct rt_wsc_profile { u32 ProfileCnt; u32 ApplyProfileIdx; /* add by johnli, fix WPS test plan 5.1.1 */ - WSC_CREDENTIAL Profile[8]; /* Support up to 8 profiles */ -} WSC_PROFILE, *PWSC_PROFILE; + struct rt_wsc_credential Profile[8]; /* Support up to 8 profiles */ +}; #endif /* _OID_H_ */ diff --git a/drivers/staging/rt2860/pci_main_dev.c b/drivers/staging/rt2860/pci_main_dev.c index 20db402b1d99..6af430419070 100644 --- a/drivers/staging/rt2860/pci_main_dev.c +++ b/drivers/staging/rt2860/pci_main_dev.c @@ -59,7 +59,7 @@ static void __exit rt2860_cleanup_module(void); static int __init rt2860_init_module(void); static void RTMPInitPCIeDevice(IN struct pci_dev *pci_dev, - IN PRTMP_ADAPTER pAd); + struct rt_rtmp_adapter *pAd); #ifdef CONFIG_PM static int rt2860_suspend(struct pci_dev *pci_dev, pm_message_t state); @@ -123,7 +123,7 @@ resume:rt2860_resume, ***************************************************************************/ #ifdef CONFIG_PM -void RT2860RejectPendingPackets(IN PRTMP_ADAPTER pAd) +void RT2860RejectPendingPackets(struct rt_rtmp_adapter *pAd) { /* clear PS packets */ /* clear TxSw packets */ @@ -132,7 +132,7 @@ void RT2860RejectPendingPackets(IN PRTMP_ADAPTER pAd) static int rt2860_suspend(struct pci_dev *pci_dev, pm_message_t state) { struct net_device *net_dev = pci_get_drvdata(pci_dev); - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) NULL; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)NULL; int retval = 0; DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_suspend()\n")); @@ -184,7 +184,7 @@ static int rt2860_suspend(struct pci_dev *pci_dev, pm_message_t state) static int rt2860_resume(struct pci_dev *pci_dev) { struct net_device *net_dev = pci_get_drvdata(pci_dev); - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) NULL; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)NULL; int retval; /* set the power state of a PCI device */ @@ -268,13 +268,13 @@ module_exit(rt2860_cleanup_module); static int __devinit rt2860_probe(IN struct pci_dev *pci_dev, IN const struct pci_device_id *pci_id) { - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) NULL; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)NULL; struct net_device *net_dev; void *handle; char *print_name; unsigned long csr_addr; int rv = 0; - RTMP_OS_NETDEV_OP_HOOK netDevHook; + struct rt_rtmp_os_netdev_op_hook netDevHook; DBGPRINT(RT_DEBUG_TRACE, ("===> rt2860_probe\n")); @@ -314,7 +314,7 @@ static int __devinit rt2860_probe(IN struct pci_dev *pci_dev, pci_set_master(pci_dev); /*RtmpDevInit============================================== */ - /* Allocate RTMP_ADAPTER adapter structure */ + /* Allocate struct rt_rtmp_adapter adapter structure */ handle = kmalloc(sizeof(struct os_cookie), GFP_KERNEL); if (handle == NULL) { DBGPRINT(RT_DEBUG_ERROR, @@ -325,10 +325,10 @@ static int __devinit rt2860_probe(IN struct pci_dev *pci_dev, ((struct os_cookie *)handle)->pci_dev = pci_dev; - rv = RTMPAllocAdapterBlock(handle, &pAd); /*shiang: we may need the pci_dev for allocate structure of "RTMP_ADAPTER" */ + rv = RTMPAllocAdapterBlock(handle, &pAd); /*shiang: we may need the pci_dev for allocate structure of "struct rt_rtmp_adapter" */ if (rv != NDIS_STATUS_SUCCESS) goto err_out_iounmap; - /* Here are the RTMP_ADAPTER structure with pci-bus specific parameters. */ + /* Here are the struct rt_rtmp_adapter structure with pci-bus specific parameters. */ pAd->CSRBaseAddress = (u8 *)csr_addr; DBGPRINT(RT_DEBUG_ERROR, ("pAd->CSRBaseAddress =0x%lx, csr_addr=0x%lx!\n", @@ -369,7 +369,7 @@ err_out_free_netdev: RtmpOSNetDevFree(net_dev); err_out_free_radev: - /* free RTMP_ADAPTER strcuture and os_cookie */ + /* free struct rt_rtmp_adapter strcuture and os_cookie */ RTMPFreeAdapter(pAd); err_out_iounmap: @@ -392,7 +392,7 @@ err_out: static void __devexit rt2860_remove_one(IN struct pci_dev *pci_dev) { struct net_device *net_dev = pci_get_drvdata(pci_dev); - RTMP_ADAPTER *pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; unsigned long csr_addr = net_dev->base_addr; /* pAd->CSRBaseAddress; */ GET_PAD_FROM_NET_DEV(pAd, net_dev); @@ -410,7 +410,7 @@ static void __devexit rt2860_remove_one(IN struct pci_dev *pci_dev) release_mem_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); - /* Free RTMP_ADAPTER related structures. */ + /* Free struct rt_rtmp_adapter related structures. */ RtmpRaDevCtrlExit(pAd); } else { @@ -456,7 +456,7 @@ BOOLEAN RT28XXChipsetCheck(IN void *_dev_p) * PCIe device initialization related procedures. * ***************************************************************************/ -static void RTMPInitPCIeDevice(IN struct pci_dev *pci_dev, IN PRTMP_ADAPTER pAd) +static void RTMPInitPCIeDevice(struct pci_dev *pci_dev, struct rt_rtmp_adapter *pAd) { u16 device_id; struct os_cookie *pObj; @@ -495,7 +495,7 @@ static void RTMPInitPCIeDevice(IN struct pci_dev *pci_dev, IN PRTMP_ADAPTER pAd) } } -void RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) +void RTMPInitPCIeLinkCtrlValue(struct rt_rtmp_adapter *pAd) { int pos; u16 reg16, data2, PCIePowerSaveLevel, Configuration; @@ -810,7 +810,7 @@ void RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd) } } -void RTMPFindHostPCIDev(IN PRTMP_ADAPTER pAd) +void RTMPFindHostPCIDev(struct rt_rtmp_adapter *pAd) { u16 reg16; u8 reg8; @@ -856,7 +856,7 @@ void RTMPFindHostPCIDev(IN PRTMP_ADAPTER pAd) ======================================================================== */ -void RTMPPCIeLinkCtrlValueRestore(IN PRTMP_ADAPTER pAd, u8 Level) +void RTMPPCIeLinkCtrlValueRestore(struct rt_rtmp_adapter *pAd, u8 Level) { u16 PCIePowerSaveLevel, reg16; u16 Configuration; @@ -950,7 +950,7 @@ void RTMPPCIeLinkCtrlValueRestore(IN PRTMP_ADAPTER pAd, u8 Level) ======================================================================== */ -void RTMPPCIeLinkCtrlSetting(IN PRTMP_ADAPTER pAd, u16 Max) +void RTMPPCIeLinkCtrlSetting(struct rt_rtmp_adapter *pAd, u16 Max) { u16 PCIePowerSaveLevel, reg16; u16 Configuration; @@ -1076,7 +1076,7 @@ void RTMPPCIeLinkCtrlSetting(IN PRTMP_ADAPTER pAd, u16 Max) ======================================================================== */ -void RTMPrt3xSetPCIePowerLinkCtrl(IN PRTMP_ADAPTER pAd) +void RTMPrt3xSetPCIePowerLinkCtrl(struct rt_rtmp_adapter *pAd) { unsigned long HostConfiguration = 0; diff --git a/drivers/staging/rt2860/rt_linux.c b/drivers/staging/rt2860/rt_linux.c index 4c2811799442..a94593c548ef 100644 --- a/drivers/staging/rt2860/rt_linux.c +++ b/drivers/staging/rt2860/rt_linux.c @@ -89,7 +89,7 @@ void RTMP_SetPeriodicTimer(struct timer_list * pTimer, } /* convert NdisMInitializeTimer --> RTMP_OS_Init_Timer */ -void RTMP_OS_Init_Timer(IN PRTMP_ADAPTER pAd, +void RTMP_OS_Init_Timer(struct rt_rtmp_adapter *pAd, struct timer_list * pTimer, IN TIMER_FUNCTION function, void *data) { @@ -127,7 +127,7 @@ void RTMP_OS_Del_Timer(struct timer_list * pTimer, } -void RTMP_OS_Release_Packet(IN PRTMP_ADAPTER pAd, IN PQUEUE_ENTRY pEntry) +void RTMP_OS_Release_Packet(struct rt_rtmp_adapter *pAd, struct rt_queue_entry *pEntry) { /*RTMPFreeNdisPacket(pAd, (struct sk_buff *)pEntry); */ } @@ -150,7 +150,7 @@ void RTMP_GetCurrentSystemTime(LARGE_INTEGER * time) } /* pAd MUST allow to be NULL */ -int os_alloc_mem(IN RTMP_ADAPTER * pAd, u8 ** mem, unsigned long size) +int os_alloc_mem(struct rt_rtmp_adapter *pAd, u8 ** mem, unsigned long size) { *mem = (u8 *)kmalloc(size, GFP_ATOMIC); if (*mem) @@ -160,7 +160,7 @@ int os_alloc_mem(IN RTMP_ADAPTER * pAd, u8 ** mem, unsigned long size) } /* pAd MUST allow to be NULL */ -int os_free_mem(IN PRTMP_ADAPTER pAd, void *mem) +int os_free_mem(struct rt_rtmp_adapter *pAd, void *mem) { ASSERT(mem); @@ -168,7 +168,7 @@ int os_free_mem(IN PRTMP_ADAPTER pAd, void *mem) return (NDIS_STATUS_SUCCESS); } -void *RtmpOSNetPktAlloc(IN RTMP_ADAPTER * pAd, IN int size) +void *RtmpOSNetPktAlloc(struct rt_rtmp_adapter *pAd, IN int size) { struct sk_buff *skb; /* Add 2 more bytes for ip header alignment */ @@ -177,7 +177,7 @@ void *RtmpOSNetPktAlloc(IN RTMP_ADAPTER * pAd, IN int size) return ((void *)skb); } -void *RTMP_AllocateFragPacketBuffer(IN PRTMP_ADAPTER pAd, +void *RTMP_AllocateFragPacketBuffer(struct rt_rtmp_adapter *pAd, unsigned long Length) { struct sk_buff *pkt; @@ -196,7 +196,7 @@ void *RTMP_AllocateFragPacketBuffer(IN PRTMP_ADAPTER pAd, return (void *)pkt; } -void *RTMP_AllocateTxPacketBuffer(IN PRTMP_ADAPTER pAd, +void *RTMP_AllocateTxPacketBuffer(struct rt_rtmp_adapter *pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress) @@ -220,7 +220,7 @@ void *RTMP_AllocateTxPacketBuffer(IN PRTMP_ADAPTER pAd, return (void *)pkt; } -void build_tx_packet(IN PRTMP_ADAPTER pAd, +void build_tx_packet(struct rt_rtmp_adapter *pAd, void *pPacket, u8 *pFrame, unsigned long FrameLen) { @@ -233,7 +233,7 @@ void build_tx_packet(IN PRTMP_ADAPTER pAd, NdisMoveMemory(skb_put(pTxPkt, FrameLen), pFrame, FrameLen); } -void RTMPFreeAdapter(IN PRTMP_ADAPTER pAd) +void RTMPFreeAdapter(struct rt_rtmp_adapter *pAd) { struct os_cookie *os_cookie; int index; @@ -260,7 +260,7 @@ void RTMPFreeAdapter(IN PRTMP_ADAPTER pAd) NdisFreeSpinLock(&pAd->irq_lock); - vfree(pAd); /* pci_free_consistent(os_cookie->pci_dev,sizeof(RTMP_ADAPTER),pAd,os_cookie->pAd_pa); */ + vfree(pAd); /* pci_free_consistent(os_cookie->pci_dev,sizeof(struct rt_rtmp_adapter),pAd,os_cookie->pAd_pa); */ if (os_cookie) kfree(os_cookie); } @@ -292,7 +292,7 @@ BOOLEAN OS_Need_Clone_Packet(void) ======================================================================== */ -int RTMPCloneNdisPacket(IN PRTMP_ADAPTER pAd, +int RTMPCloneNdisPacket(struct rt_rtmp_adapter *pAd, IN BOOLEAN pInsAMSDUHdr, void *pInPacket, void ** ppOutPacket) @@ -323,7 +323,7 @@ int RTMPCloneNdisPacket(IN PRTMP_ADAPTER pAd, } /* the allocated NDIS PACKET must be freed via RTMPFreeNdisPacket() */ -int RTMPAllocateNdisPacket(IN PRTMP_ADAPTER pAd, +int RTMPAllocateNdisPacket(struct rt_rtmp_adapter *pAd, void ** ppPacket, u8 *pHeader, u32 HeaderLen, @@ -367,7 +367,7 @@ int RTMPAllocateNdisPacket(IN PRTMP_ADAPTER pAd, corresponding NDIS_BUFFER and allocated memory. ======================================================================== */ -void RTMPFreeNdisPacket(IN PRTMP_ADAPTER pAd, void *pPacket) +void RTMPFreeNdisPacket(struct rt_rtmp_adapter *pAd, void *pPacket) { dev_kfree_skb_any(RTPKT_TO_OSPKT(pPacket)); } @@ -386,7 +386,7 @@ int Sniff2BytesFromNdisBuffer(char *pFirstBuffer, } void RTMP_QueryPacketInfo(void *pPacket, - OUT PACKET_INFO * pPacketInfo, + struct rt_packet_info *pPacketInfo, u8 ** pSrcBufVA, u32 * pSrcBufLen) { pPacketInfo->BufferCount = 1; @@ -399,7 +399,7 @@ void RTMP_QueryPacketInfo(void *pPacket, } void RTMP_QueryNextPacketInfo(void ** ppPacket, - OUT PACKET_INFO * pPacketInfo, + struct rt_packet_info *pPacketInfo, u8 ** pSrcBufVA, u32 * pSrcBufLen) { void *pPacket = NULL; @@ -429,7 +429,7 @@ void RTMP_QueryNextPacketInfo(void ** ppPacket, } } -void *DuplicatePacket(IN PRTMP_ADAPTER pAd, +void *DuplicatePacket(struct rt_rtmp_adapter *pAd, void *pPacket, u8 FromWhichBSSID) { struct sk_buff *skb; @@ -450,7 +450,7 @@ void *DuplicatePacket(IN PRTMP_ADAPTER pAd, } -void *duplicate_pkt(IN PRTMP_ADAPTER pAd, +void *duplicate_pkt(struct rt_rtmp_adapter *pAd, u8 *pHeader802_3, u32 HdrLen, u8 *pData, @@ -474,7 +474,7 @@ void *duplicate_pkt(IN PRTMP_ADAPTER pAd, } #define TKIP_TX_MIC_SIZE 8 -void *duplicate_pkt_with_TKIP_MIC(IN PRTMP_ADAPTER pAd, +void *duplicate_pkt_with_TKIP_MIC(struct rt_rtmp_adapter *pAd, void *pPacket) { struct sk_buff *skb, *newskb; @@ -497,7 +497,7 @@ void *duplicate_pkt_with_TKIP_MIC(IN PRTMP_ADAPTER pAd, return OSPKT_TO_RTPKT(skb); } -void *ClonePacket(IN PRTMP_ADAPTER pAd, +void *ClonePacket(struct rt_rtmp_adapter *pAd, void *pPacket, u8 *pData, unsigned long DataSize) { @@ -524,8 +524,8 @@ void *ClonePacket(IN PRTMP_ADAPTER pAd, /* */ /* change OS packet DataPtr and DataLen */ /* */ -void update_os_packet_info(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, u8 FromWhichBSSID) +void update_os_packet_info(struct rt_rtmp_adapter *pAd, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID) { struct sk_buff *pOSPkt; @@ -538,8 +538,8 @@ void update_os_packet_info(IN PRTMP_ADAPTER pAd, pOSPkt->tail = pOSPkt->data + pOSPkt->len; } -void wlan_802_11_to_802_3_packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, +void wlan_802_11_to_802_3_packet(struct rt_rtmp_adapter *pAd, + struct rt_rx_blk *pRxBlk, u8 *pHeader802_3, u8 FromWhichBSSID) { @@ -564,7 +564,7 @@ void wlan_802_11_to_802_3_packet(IN PRTMP_ADAPTER pAd, LENGTH_802_3); } -void announce_802_3_packet(IN PRTMP_ADAPTER pAd, void *pPacket) +void announce_802_3_packet(struct rt_rtmp_adapter *pAd, void *pPacket) { struct sk_buff *pRxPkt; @@ -579,8 +579,8 @@ void announce_802_3_packet(IN PRTMP_ADAPTER pAd, void *pPacket) netif_rx(pRxPkt); } -PRTMP_SCATTER_GATHER_LIST -rt_get_sg_list_from_packet(void *pPacket, RTMP_SCATTER_GATHER_LIST * sg) +struct rt_rtmp_sg_list * +rt_get_sg_list_from_packet(void *pPacket, struct rt_rtmp_sg_list *sg) { sg->NumberOfElements = 1; sg->Elements[0].Address = GET_OS_PKT_DATAPTR(pPacket); @@ -628,7 +628,7 @@ void hex_dump(char *str, unsigned char *pSrcBufVA, unsigned int SrcBufLen) ======================================================================== */ -void RTMPSendWirelessEvent(IN PRTMP_ADAPTER pAd, +void RTMPSendWirelessEvent(struct rt_rtmp_adapter *pAd, u16 Event_flag, u8 *pAddr, u8 BssIdx, char Rssi) { @@ -715,10 +715,10 @@ void RTMPSendWirelessEvent(IN PRTMP_ADAPTER pAd, __func__)); } -void send_monitor_packets(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) +void send_monitor_packets(struct rt_rtmp_adapter *pAd, struct rt_rx_blk *pRxBlk) { struct sk_buff *pOSPkt; - wlan_ng_prism2_header *ph; + struct rt_wlan_ng_prism2_header *ph; int rate_index = 0; u16 header_len = 0; u8 temp_header[40] = { 0 }; @@ -743,11 +743,11 @@ void send_monitor_packets(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) goto err_free_sk_buff; } - if (pRxBlk->DataSize + sizeof(wlan_ng_prism2_header) > + if (pRxBlk->DataSize + sizeof(struct rt_wlan_ng_prism2_header) > RX_BUFFER_AGGRESIZE) { DBGPRINT(RT_DEBUG_ERROR, ("%s : Size is too large! (%zu)\n", __func__, - pRxBlk->DataSize + sizeof(wlan_ng_prism2_header))); + pRxBlk->DataSize + sizeof(struct rt_wlan_ng_prism2_header))); goto err_free_sk_buff; } @@ -795,9 +795,9 @@ void send_monitor_packets(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) skb_pull(pOSPkt, (pRxBlk->pData - pOSPkt->data)); } /*end if */ - if (skb_headroom(pOSPkt) < (sizeof(wlan_ng_prism2_header) + header_len)) { + if (skb_headroom(pOSPkt) < (sizeof(struct rt_wlan_ng_prism2_header) + header_len)) { if (pskb_expand_head - (pOSPkt, (sizeof(wlan_ng_prism2_header) + header_len), 0, + (pOSPkt, (sizeof(struct rt_wlan_ng_prism2_header) + header_len), 0, GFP_ATOMIC)) { DBGPRINT(RT_DEBUG_ERROR, ("%s : Reallocate header size of sk_buff fail!\n", @@ -810,12 +810,12 @@ void send_monitor_packets(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) NdisMoveMemory(skb_push(pOSPkt, header_len), temp_header, header_len); - ph = (wlan_ng_prism2_header *) skb_push(pOSPkt, - sizeof(wlan_ng_prism2_header)); - NdisZeroMemory(ph, sizeof(wlan_ng_prism2_header)); + ph = (struct rt_wlan_ng_prism2_header *)skb_push(pOSPkt, + sizeof(struct rt_wlan_ng_prism2_header)); + NdisZeroMemory(ph, sizeof(struct rt_wlan_ng_prism2_header)); ph->msgcode = DIDmsg_lnxind_wlansniffrm; - ph->msglen = sizeof(wlan_ng_prism2_header); + ph->msglen = sizeof(struct rt_wlan_ng_prism2_header); strcpy((char *)ph->devname, (char *)pAd->net_dev->name); ph->hosttime.did = DIDmsg_lnxind_wlansniffrm_hosttime; @@ -909,7 +909,7 @@ int RtmpOSIRQRequest(struct net_device *pNetDev) { #ifdef RTMP_PCI_SUPPORT struct net_device *net_dev = pNetDev; - PRTMP_ADAPTER pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; int retval = 0; GET_PAD_FROM_NET_DEV(pAd, pNetDev); @@ -935,7 +935,7 @@ int RtmpOSIRQRequest(struct net_device *pNetDev) int RtmpOSIRQRelease(struct net_device *pNetDev) { struct net_device *net_dev = pNetDev; - PRTMP_ADAPTER pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; GET_PAD_FROM_NET_DEV(pAd, net_dev); @@ -1005,12 +1005,12 @@ int RtmpOSFileWrite(struct file *osfd, char *pDataPtr, int writeLen) Task create/management/kill related functions. *******************************************************************************/ -int RtmpOSTaskKill(IN RTMP_OS_TASK * pTask) +int RtmpOSTaskKill(struct rt_rtmp_os_task *pTask) { - RTMP_ADAPTER *pAd; + struct rt_rtmp_adapter *pAd; int ret = NDIS_STATUS_FAILURE; - pAd = (RTMP_ADAPTER *) pTask->priv; + pAd = (struct rt_rtmp_adapter *)pTask->priv; #ifdef KTHREAD_SUPPORT if (pTask->kthread_task) { @@ -1043,7 +1043,7 @@ int RtmpOSTaskKill(IN RTMP_OS_TASK * pTask) } -int RtmpOSTaskNotifyToExit(IN RTMP_OS_TASK * pTask) +int RtmpOSTaskNotifyToExit(struct rt_rtmp_os_task *pTask) { #ifndef KTHREAD_SUPPORT @@ -1053,7 +1053,7 @@ int RtmpOSTaskNotifyToExit(IN RTMP_OS_TASK * pTask) return 0; } -void RtmpOSTaskCustomize(IN RTMP_OS_TASK * pTask) +void RtmpOSTaskCustomize(struct rt_rtmp_os_task *pTask) { #ifndef KTHREAD_SUPPORT @@ -1070,7 +1070,7 @@ void RtmpOSTaskCustomize(IN RTMP_OS_TASK * pTask) #endif } -int RtmpOSTaskAttach(IN RTMP_OS_TASK * pTask, +int RtmpOSTaskAttach(struct rt_rtmp_os_task *pTask, IN int (*fn) (void *), IN void *arg) { int status = NDIS_STATUS_SUCCESS; @@ -1098,7 +1098,7 @@ int RtmpOSTaskAttach(IN RTMP_OS_TASK * pTask, return status; } -int RtmpOSTaskInit(IN RTMP_OS_TASK * pTask, +int RtmpOSTaskInit(struct rt_rtmp_os_task *pTask, char *pTaskName, void * pPriv) { int len; @@ -1106,7 +1106,7 @@ int RtmpOSTaskInit(IN RTMP_OS_TASK * pTask, ASSERT(pTask); #ifndef KTHREAD_SUPPORT - NdisZeroMemory((u8 *)(pTask), sizeof(RTMP_OS_TASK)); + NdisZeroMemory((u8 *)(pTask), sizeof(struct rt_rtmp_os_task)); #endif len = strlen(pTaskName); @@ -1126,7 +1126,7 @@ int RtmpOSTaskInit(IN RTMP_OS_TASK * pTask, return NDIS_STATUS_SUCCESS; } -void RTMP_IndicateMediaState(IN PRTMP_ADAPTER pAd) +void RTMP_IndicateMediaState(struct rt_rtmp_adapter *pAd) { if (pAd->CommonCfg.bWirelessEvent) { if (pAd->IndicateMediaState == NdisMediaStateConnected) { @@ -1141,7 +1141,7 @@ void RTMP_IndicateMediaState(IN PRTMP_ADAPTER pAd) } } -int RtmpOSWrielessEventSend(IN RTMP_ADAPTER * pAd, +int RtmpOSWrielessEventSend(struct rt_rtmp_adapter *pAd, u32 eventType, int flags, u8 *pSrcMac, @@ -1167,7 +1167,7 @@ int RtmpOSWrielessEventSend(IN RTMP_ADAPTER * pAd, int RtmpOSNetDevAddrSet(struct net_device *pNetDev, u8 *pMacAddr) { struct net_device *net_dev; - RTMP_ADAPTER *pAd; + struct rt_rtmp_adapter *pAd; net_dev = pNetDev; GET_PAD_FROM_NET_DEV(pAd, net_dev); @@ -1187,7 +1187,7 @@ int RtmpOSNetDevAddrSet(struct net_device *pNetDev, u8 *pMacAddr) /* * Assign the network dev name for created Ralink WiFi interface. */ -static int RtmpOSNetDevRequestName(IN RTMP_ADAPTER * pAd, +static int RtmpOSNetDevRequestName(struct rt_rtmp_adapter *pAd, struct net_device *dev, char *pPrefixStr, int devIdx) { @@ -1278,7 +1278,7 @@ void RtmpOSNetDeviceRefPut(struct net_device *pNetDev) dev_put(pNetDev); } -int RtmpOSNetDevDestory(IN RTMP_ADAPTER * pAd, struct net_device *pNetDev) +int RtmpOSNetDevDestory(struct rt_rtmp_adapter *pAd, struct net_device *pNetDev) { /* TODO: Need to fix this */ @@ -1292,14 +1292,14 @@ void RtmpOSNetDevDetach(struct net_device *pNetDev) } int RtmpOSNetDevAttach(struct net_device *pNetDev, - IN RTMP_OS_NETDEV_OP_HOOK * pDevOpHook) + struct rt_rtmp_os_netdev_op_hook *pDevOpHook) { int ret, rtnl_locked = FALSE; DBGPRINT(RT_DEBUG_TRACE, ("RtmpOSNetDevAttach()--->\n")); /* If we need hook some callback function to the net device structrue, now do it. */ if (pDevOpHook) { - PRTMP_ADAPTER pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; GET_PAD_FROM_NET_DEV(pAd, pNetDev); @@ -1331,7 +1331,7 @@ int RtmpOSNetDevAttach(struct net_device *pNetDev, return NDIS_STATUS_FAILURE; } -struct net_device *RtmpOSNetDevCreate(IN RTMP_ADAPTER * pAd, +struct net_device *RtmpOSNetDevCreate(struct rt_rtmp_adapter *pAd, int devType, int devNum, int privMemSize, char *pNamePrefix) diff --git a/drivers/staging/rt2860/rt_linux.h b/drivers/staging/rt2860/rt_linux.h index d63ac7d3936a..e1eb740839e5 100644 --- a/drivers/staging/rt2860/rt_linux.h +++ b/drivers/staging/rt2860/rt_linux.h @@ -184,11 +184,11 @@ struct iw_statistics *rt28xx_get_wireless_stats(IN struct net_device *net_dev); /*********************************************************************************** * OS file operation related data structure definitions ***********************************************************************************/ -typedef struct _RTMP_OS_FS_INFO_ { +struct rt_rtmp_os_fs_info { int fsuid; int fsgid; mm_segment_t fs; -} RTMP_OS_FS_INFO; +}; #define IS_FILE_OPEN_ERR(_fd) IS_ERR((_fd)) @@ -373,7 +373,7 @@ static inline void NdisGetSystemUpTime(unsigned long * time) } /*********************************************************************************** - * OS specific cookie data structure binding to RTMP_ADAPTER + * OS specific cookie data structure binding to struct rt_rtmp_adapter ***********************************************************************************/ struct os_cookie { @@ -631,7 +631,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, (void *)(pEntry) #define PACKET_TO_QUEUE_ENTRY(pPacket) \ - (PQUEUE_ENTRY)(pPacket) + (struct rt_queue_entry *)(pPacket) #define GET_SG_LIST_FROM_PACKET(_p, _sc) \ rt_get_sg_list_from_packet(_p, _sc) @@ -842,6 +842,6 @@ int rt28xx_sta_ioctl(struct net_device *net_dev, IN OUT struct ifreq *rq, int cm extern int ra_mtd_write(int num, loff_t to, size_t len, const u_char * buf); extern int ra_mtd_read(int num, loff_t from, size_t len, u_char * buf); -#define GET_PAD_FROM_NET_DEV(_pAd, _net_dev) (_pAd) = (PRTMP_ADAPTER)(_net_dev)->ml_priv; +#define GET_PAD_FROM_NET_DEV(_pAd, _net_dev) (_pAd) = (struct rt_rtmp_adapter *)(_net_dev)->ml_priv; #endif /* __RT_LINUX_H__ // */ diff --git a/drivers/staging/rt2860/rt_main_dev.c b/drivers/staging/rt2860/rt_main_dev.c index 347279912e44..fbbec9d2dcdd 100644 --- a/drivers/staging/rt2860/rt_main_dev.c +++ b/drivers/staging/rt2860/rt_main_dev.c @@ -83,7 +83,7 @@ Note: */ int MainVirtualIF_close(IN struct net_device *net_dev) { - RTMP_ADAPTER *pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; GET_PAD_FROM_NET_DEV(pAd, net_dev); @@ -99,9 +99,9 @@ int MainVirtualIF_close(IN struct net_device *net_dev) if (INFRA_ON(pAd) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) { - MLME_DISASSOC_REQ_STRUCT DisReq; - MLME_QUEUE_ELEM *MsgElem = - (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), + struct rt_mlme_disassoc_req DisReq; + struct rt_mlme_queue_elem *MsgElem = + (struct rt_mlme_queue_elem *)kmalloc(sizeof(struct rt_mlme_queue_elem), MEM_ALLOC_FLAG); if (MsgElem) { @@ -112,10 +112,10 @@ int MainVirtualIF_close(IN struct net_device *net_dev) MsgElem->Machine = ASSOC_STATE_MACHINE; MsgElem->MsgType = MT2_MLME_DISASSOC_REQ; MsgElem->MsgLen = - sizeof(MLME_DISASSOC_REQ_STRUCT); + sizeof(struct rt_mlme_disassoc_req); NdisMoveMemory(MsgElem->Msg, &DisReq, sizeof - (MLME_DISASSOC_REQ_STRUCT)); + (struct rt_mlme_disassoc_req)); /* Prevent to connect AP again in STAMlmePeriodicExec */ pAd->MlmeAux.AutoReconnectSsidLen = 32; @@ -167,7 +167,7 @@ Note: */ int MainVirtualIF_open(IN struct net_device *net_dev) { - RTMP_ADAPTER *pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; GET_PAD_FROM_NET_DEV(pAd, net_dev); @@ -211,7 +211,7 @@ Note: int rt28xx_close(struct net_device *dev) { struct net_device *net_dev = (struct net_device *)dev; - RTMP_ADAPTER *pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; BOOLEAN Cancelled; u32 i = 0; @@ -381,7 +381,7 @@ Note: int rt28xx_open(struct net_device *dev) { struct net_device *net_dev = (struct net_device *)dev; - PRTMP_ADAPTER pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; int retval = 0; /*struct os_cookie *pObj; */ @@ -459,14 +459,14 @@ static const struct net_device_ops rt2860_netdev_ops = { .ndo_start_xmit = rt28xx_send_packets, }; -struct net_device *RtmpPhyNetDevInit(IN RTMP_ADAPTER * pAd, - IN RTMP_OS_NETDEV_OP_HOOK * pNetDevHook) +struct net_device *RtmpPhyNetDevInit(struct rt_rtmp_adapter *pAd, + struct rt_rtmp_os_netdev_op_hook *pNetDevHook) { struct net_device *net_dev = NULL; /* int Status; */ net_dev = - RtmpOSNetDevCreate(pAd, INT_MAIN, 0, sizeof(PRTMP_ADAPTER), + RtmpOSNetDevCreate(pAd, INT_MAIN, 0, sizeof(struct rt_rtmp_adapter *), INF_MAIN_DEV_NAME); if (net_dev == NULL) { printk @@ -475,7 +475,7 @@ struct net_device *RtmpPhyNetDevInit(IN RTMP_ADAPTER * pAd, } NdisZeroMemory((unsigned char *)pNetDevHook, - sizeof(RTMP_OS_NETDEV_OP_HOOK)); + sizeof(struct rt_rtmp_os_netdev_op_hook)); pNetDevHook->netdev_ops = &rt2860_netdev_ops; pNetDevHook->priv_flags = INT_MAIN; pNetDevHook->needProtcted = FALSE; @@ -509,7 +509,7 @@ Note: int rt28xx_packet_xmit(struct sk_buff *skb) { struct net_device *net_dev = skb->dev; - PRTMP_ADAPTER pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; int status = NETDEV_TX_OK; void *pPacket = (void *)skb; @@ -561,7 +561,7 @@ Note: static int rt28xx_send_packets(IN struct sk_buff *skb_p, IN struct net_device *net_dev) { - RTMP_ADAPTER *pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; GET_PAD_FROM_NET_DEV(pAd, net_dev); @@ -580,7 +580,7 @@ static int rt28xx_send_packets(IN struct sk_buff *skb_p, /* This function will be called when query /proc */ struct iw_statistics *rt28xx_get_wireless_stats(IN struct net_device *net_dev) { - PRTMP_ADAPTER pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; GET_PAD_FROM_NET_DEV(pAd, net_dev); @@ -643,7 +643,7 @@ void tbtt_tasklet(unsigned long data) static struct net_device_stats *RT28xx_get_ether_stats(IN struct net_device *net_dev) { - RTMP_ADAPTER *pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; if (net_dev) GET_PAD_FROM_NET_DEV(pAd, net_dev); @@ -690,7 +690,7 @@ static struct net_device_stats *RT28xx_get_ether_stats(IN struct net_device return NULL; } -BOOLEAN RtmpPhyNetDevExit(IN RTMP_ADAPTER * pAd, struct net_device *net_dev) +BOOLEAN RtmpPhyNetDevExit(struct rt_rtmp_adapter *pAd, struct net_device *net_dev) { /* Unregister network device */ @@ -724,11 +724,11 @@ Note: int AdapterBlockAllocateMemory(void *handle, void ** ppAd) { - *ppAd = (void *)vmalloc(sizeof(RTMP_ADAPTER)); /*pci_alloc_consistent(pci_dev, sizeof(RTMP_ADAPTER), phy_addr); */ + *ppAd = (void *)vmalloc(sizeof(struct rt_rtmp_adapter)); /*pci_alloc_consistent(pci_dev, sizeof(struct rt_rtmp_adapter), phy_addr); */ if (*ppAd) { - NdisZeroMemory(*ppAd, sizeof(RTMP_ADAPTER)); - ((PRTMP_ADAPTER) * ppAd)->OS_Cookie = handle; + NdisZeroMemory(*ppAd, sizeof(struct rt_rtmp_adapter)); + ((struct rt_rtmp_adapter *)* ppAd)->OS_Cookie = handle; return (NDIS_STATUS_SUCCESS); } else { return (NDIS_STATUS_FAILURE); diff --git a/drivers/staging/rt2860/rt_pci_rbus.c b/drivers/staging/rt2860/rt_pci_rbus.c index 7494df4a7d6c..e0a0aeeb17a2 100644 --- a/drivers/staging/rt2860/rt_pci_rbus.c +++ b/drivers/staging/rt2860/rt_pci_rbus.c @@ -77,7 +77,7 @@ static void fifo_statistic_full_tasklet(unsigned long data); * **************************************************************************/ /* Function for TxDesc Memory allocation. */ -void RTMP_AllocateTxDescMemory(IN PRTMP_ADAPTER pAd, +void RTMP_AllocateTxDescMemory(struct rt_rtmp_adapter *pAd, u32 Index, unsigned long Length, IN BOOLEAN Cached, @@ -93,7 +93,7 @@ void RTMP_AllocateTxDescMemory(IN PRTMP_ADAPTER pAd, } /* Function for MgmtDesc Memory allocation. */ -void RTMP_AllocateMgmtDescMemory(IN PRTMP_ADAPTER pAd, +void RTMP_AllocateMgmtDescMemory(struct rt_rtmp_adapter *pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, @@ -108,7 +108,7 @@ void RTMP_AllocateMgmtDescMemory(IN PRTMP_ADAPTER pAd, } /* Function for RxDesc Memory allocation. */ -void RTMP_AllocateRxDescMemory(IN PRTMP_ADAPTER pAd, +void RTMP_AllocateRxDescMemory(struct rt_rtmp_adapter *pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, @@ -123,7 +123,7 @@ void RTMP_AllocateRxDescMemory(IN PRTMP_ADAPTER pAd, } /* Function for free allocated Desc Memory. */ -void RTMP_FreeDescMemory(IN PRTMP_ADAPTER pAd, +void RTMP_FreeDescMemory(struct rt_rtmp_adapter *pAd, unsigned long Length, void *VirtualAddress, dma_addr_t PhysicalAddress) @@ -135,7 +135,7 @@ void RTMP_FreeDescMemory(IN PRTMP_ADAPTER pAd, } /* Function for TxData DMA Memory allocation. */ -void RTMP_AllocateFirstTxBuffer(IN PRTMP_ADAPTER pAd, +void RTMP_AllocateFirstTxBuffer(struct rt_rtmp_adapter *pAd, u32 Index, unsigned long Length, IN BOOLEAN Cached, @@ -149,7 +149,7 @@ void RTMP_AllocateFirstTxBuffer(IN PRTMP_ADAPTER pAd, PhysicalAddress); } -void RTMP_FreeFirstTxBuffer(IN PRTMP_ADAPTER pAd, +void RTMP_FreeFirstTxBuffer(struct rt_rtmp_adapter *pAd, unsigned long Length, IN BOOLEAN Cached, void *VirtualAddress, @@ -170,7 +170,7 @@ void RTMP_FreeFirstTxBuffer(IN PRTMP_ADAPTER pAd, * VirtualAddress: Pointer to memory is returned here * PhysicalAddress: Physical address corresponding to virtual address */ -void RTMP_AllocateSharedMemory(IN PRTMP_ADAPTER pAd, +void RTMP_AllocateSharedMemory(struct rt_rtmp_adapter *pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, @@ -194,7 +194,7 @@ void RTMP_AllocateSharedMemory(IN PRTMP_ADAPTER pAd, * Notes: * Cached is ignored: always cached memory */ -void *RTMP_AllocateRxPacketBuffer(IN PRTMP_ADAPTER pAd, +void *RTMP_AllocateRxPacketBuffer(struct rt_rtmp_adapter *pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, @@ -224,7 +224,7 @@ void *RTMP_AllocateRxPacketBuffer(IN PRTMP_ADAPTER pAd, return (void *)pkt; } -void Invalid_Remaining_Packet(IN PRTMP_ADAPTER pAd, unsigned long VirtualAddress) +void Invalid_Remaining_Packet(struct rt_rtmp_adapter *pAd, unsigned long VirtualAddress) { dma_addr_t PhysicalAddress; @@ -233,7 +233,7 @@ void Invalid_Remaining_Packet(IN PRTMP_ADAPTER pAd, unsigned long VirtualAddress RX_BUFFER_NORMSIZE - 1600, -1, PCI_DMA_FROMDEVICE); } -int RtmpNetTaskInit(IN RTMP_ADAPTER * pAd) +int RtmpNetTaskInit(struct rt_rtmp_adapter *pAd) { struct os_cookie *pObj; @@ -257,7 +257,7 @@ int RtmpNetTaskInit(IN RTMP_ADAPTER * pAd) return NDIS_STATUS_SUCCESS; } -void RtmpNetTaskExit(IN RTMP_ADAPTER * pAd) +void RtmpNetTaskExit(struct rt_rtmp_adapter *pAd) { struct os_cookie *pObj; @@ -273,7 +273,7 @@ void RtmpNetTaskExit(IN RTMP_ADAPTER * pAd) tasklet_kill(&pObj->fifo_statistic_full_task); } -int RtmpMgmtTaskInit(IN RTMP_ADAPTER * pAd) +int RtmpMgmtTaskInit(struct rt_rtmp_adapter *pAd) { return NDIS_STATUS_SUCCESS; @@ -293,13 +293,13 @@ Return Value: Note: ======================================================================== */ -void RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd) +void RtmpMgmtTaskExit(struct rt_rtmp_adapter *pAd) { return; } -static inline void rt2860_int_enable(PRTMP_ADAPTER pAd, unsigned int mode) +static inline void rt2860_int_enable(struct rt_rtmp_adapter *pAd, unsigned int mode) { u32 regValue; @@ -316,7 +316,7 @@ static inline void rt2860_int_enable(PRTMP_ADAPTER pAd, unsigned int mode) RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE); } -static inline void rt2860_int_disable(PRTMP_ADAPTER pAd, unsigned int mode) +static inline void rt2860_int_disable(struct rt_rtmp_adapter *pAd, unsigned int mode) { u32 regValue; @@ -337,7 +337,7 @@ static inline void rt2860_int_disable(PRTMP_ADAPTER pAd, unsigned int mode) static void mgmt_dma_done_tasklet(unsigned long data) { unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)data; INT_SOURCE_CSR_STRUC IntSource; struct os_cookie *pObj; @@ -376,7 +376,7 @@ static void mgmt_dma_done_tasklet(unsigned long data) static void rx_done_tasklet(unsigned long data) { unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)data; BOOLEAN bReschedule = 0; struct os_cookie *pObj; @@ -410,7 +410,7 @@ static void rx_done_tasklet(unsigned long data) void fifo_statistic_full_tasklet(unsigned long data) { unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)data; struct os_cookie *pObj; /* Do nothing if the driver is starting halt state. */ @@ -444,7 +444,7 @@ void fifo_statistic_full_tasklet(unsigned long data) static void ac3_dma_done_tasklet(unsigned long data) { unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)data; INT_SOURCE_CSR_STRUC IntSource; struct os_cookie *pObj; BOOLEAN bReschedule = 0; @@ -482,7 +482,7 @@ static void ac3_dma_done_tasklet(unsigned long data) static void ac2_dma_done_tasklet(unsigned long data) { unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)data; INT_SOURCE_CSR_STRUC IntSource; struct os_cookie *pObj; BOOLEAN bReschedule = 0; @@ -520,7 +520,7 @@ static void ac2_dma_done_tasklet(unsigned long data) static void ac1_dma_done_tasklet(unsigned long data) { unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)data; INT_SOURCE_CSR_STRUC IntSource; struct os_cookie *pObj; BOOLEAN bReschedule = 0; @@ -558,7 +558,7 @@ static void ac1_dma_done_tasklet(unsigned long data) static void ac0_dma_done_tasklet(unsigned long data) { unsigned long flags; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) data; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)data; INT_SOURCE_CSR_STRUC IntSource; struct os_cookie *pObj; BOOLEAN bReschedule = 0; @@ -604,7 +604,7 @@ int print_int_count; IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) { struct net_device *net_dev = (struct net_device *)dev_instance; - PRTMP_ADAPTER pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; INT_SOURCE_CSR_STRUC IntSource; struct os_cookie *pObj; @@ -793,7 +793,7 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance) dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, int sd_idx, int direction) { - PRTMP_ADAPTER pAd; + struct rt_rtmp_adapter *pAd; struct os_cookie *pObj; /* @@ -812,12 +812,12 @@ dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, sd_idx = -1 */ - pAd = (PRTMP_ADAPTER) handle; + pAd = (struct rt_rtmp_adapter *)handle; pObj = (struct os_cookie *)pAd->OS_Cookie; if (sd_idx == 1) { - PTX_BLK pTxBlk; - pTxBlk = (PTX_BLK) ptr; + struct rt_tx_blk *pTxBlk; + pTxBlk = (struct rt_tx_blk *)ptr; return pci_map_single(pObj->pci_dev, pTxBlk->pSrcBufData, pTxBlk->SrcBufLen, direction); } else { @@ -829,10 +829,10 @@ dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int direction) { - PRTMP_ADAPTER pAd; + struct rt_rtmp_adapter *pAd; struct os_cookie *pObj; - pAd = (PRTMP_ADAPTER) handle; + pAd = (struct rt_rtmp_adapter *)handle; pObj = (struct os_cookie *)pAd->OS_Cookie; pci_unmap_single(pObj->pci_dev, dma_addr, size, direction); diff --git a/drivers/staging/rt2860/rt_usb.c b/drivers/staging/rt2860/rt_usb.c index 68f6f48f7251..01a7eb4e8ba8 100644 --- a/drivers/staging/rt2860/rt_usb.c +++ b/drivers/staging/rt2860/rt_usb.c @@ -77,9 +77,9 @@ Return Value: Note: ======================================================================== */ -int RtmpMgmtTaskInit(IN RTMP_ADAPTER * pAd) +int RtmpMgmtTaskInit(struct rt_rtmp_adapter *pAd) { - RTMP_OS_TASK *pTask; + struct rt_rtmp_os_task *pTask; int status; /* @@ -133,10 +133,10 @@ Return Value: Note: ======================================================================== */ -void RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd) +void RtmpMgmtTaskExit(struct rt_rtmp_adapter *pAd) { int ret; - RTMP_OS_TASK *pTask; + struct rt_rtmp_os_task *pTask; /* Sleep 50 milliseconds so pending io might finish normally */ RTMPusecDelay(50000); @@ -197,16 +197,16 @@ void RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd) static void rtusb_dataout_complete(unsigned long data) { - PRTMP_ADAPTER pAd; + struct rt_rtmp_adapter *pAd; struct urb *pUrb; struct os_cookie *pObj; - PHT_TX_CONTEXT pHTTXContext; + struct rt_ht_tx_context *pHTTXContext; u8 BulkOutPipeId; int Status; unsigned long IrqFlags; pUrb = (struct urb *)data; - pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; + pHTTXContext = (struct rt_ht_tx_context *)pUrb->context; pAd = pHTTXContext->pAd; pObj = (struct os_cookie *)pAd->OS_Cookie; Status = pUrb->status; @@ -294,14 +294,14 @@ static void rtusb_dataout_complete(unsigned long data) static void rtusb_null_frame_done_tasklet(unsigned long data) { - PRTMP_ADAPTER pAd; - PTX_CONTEXT pNullContext; + struct rt_rtmp_adapter *pAd; + struct rt_tx_context *pNullContext; struct urb *pUrb; int Status; unsigned long irqFlag; pUrb = (struct urb *)data; - pNullContext = (PTX_CONTEXT) pUrb->context; + pNullContext = (struct rt_tx_context *)pUrb->context; pAd = pNullContext->pAd; Status = pUrb->status; @@ -343,14 +343,14 @@ static void rtusb_null_frame_done_tasklet(unsigned long data) static void rtusb_rts_frame_done_tasklet(unsigned long data) { - PRTMP_ADAPTER pAd; - PTX_CONTEXT pRTSContext; + struct rt_rtmp_adapter *pAd; + struct rt_tx_context *pRTSContext; struct urb *pUrb; int Status; unsigned long irqFlag; pUrb = (struct urb *)data; - pRTSContext = (PTX_CONTEXT) pUrb->context; + pRTSContext = (struct rt_tx_context *)pUrb->context; pAd = pRTSContext->pAd; Status = pUrb->status; @@ -393,13 +393,13 @@ static void rtusb_rts_frame_done_tasklet(unsigned long data) static void rtusb_pspoll_frame_done_tasklet(unsigned long data) { - PRTMP_ADAPTER pAd; - PTX_CONTEXT pPsPollContext; + struct rt_rtmp_adapter *pAd; + struct rt_tx_context *pPsPollContext; struct urb *pUrb; int Status; pUrb = (struct urb *)data; - pPsPollContext = (PTX_CONTEXT) pUrb->context; + pPsPollContext = (struct rt_tx_context *)pUrb->context; pAd = pPsPollContext->pAd; Status = pUrb->status; @@ -453,13 +453,13 @@ Note: static void rx_done_tasklet(unsigned long data) { struct urb *pUrb; - PRX_CONTEXT pRxContext; - PRTMP_ADAPTER pAd; + struct rt_rx_context *pRxContext; + struct rt_rtmp_adapter *pAd; int Status; unsigned int IrqFlags; pUrb = (struct urb *)data; - pRxContext = (PRX_CONTEXT) pUrb->context; + pRxContext = (struct rt_rx_context *)pUrb->context; pAd = pRxContext->pAd; Status = pUrb->status; @@ -514,8 +514,8 @@ static void rx_done_tasklet(unsigned long data) static void rtusb_mgmt_dma_done_tasklet(unsigned long data) { - PRTMP_ADAPTER pAd; - PTX_CONTEXT pMLMEContext; + struct rt_rtmp_adapter *pAd; + struct rt_tx_context *pMLMEContext; int index; void *pPacket; struct urb *pUrb; @@ -523,7 +523,7 @@ static void rtusb_mgmt_dma_done_tasklet(unsigned long data) unsigned long IrqFlags; pUrb = (struct urb *)data; - pMLMEContext = (PTX_CONTEXT) pUrb->context; + pMLMEContext = (struct rt_tx_context *)pUrb->context; pAd = pMLMEContext->pAd; Status = pUrb->status; index = pMLMEContext->SelfIdx; @@ -595,13 +595,13 @@ static void rtusb_mgmt_dma_done_tasklet(unsigned long data) static void rtusb_ac3_dma_done_tasklet(unsigned long data) { - PRTMP_ADAPTER pAd; - PHT_TX_CONTEXT pHTTXContext; + struct rt_rtmp_adapter *pAd; + struct rt_ht_tx_context *pHTTXContext; u8 BulkOutPipeId = 3; struct urb *pUrb; pUrb = (struct urb *)data; - pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; + pHTTXContext = (struct rt_ht_tx_context *)pUrb->context; pAd = pHTTXContext->pAd; rtusb_dataout_complete((unsigned long)pUrb); @@ -635,13 +635,13 @@ static void rtusb_ac3_dma_done_tasklet(unsigned long data) static void rtusb_ac2_dma_done_tasklet(unsigned long data) { - PRTMP_ADAPTER pAd; - PHT_TX_CONTEXT pHTTXContext; + struct rt_rtmp_adapter *pAd; + struct rt_ht_tx_context *pHTTXContext; u8 BulkOutPipeId = 2; struct urb *pUrb; pUrb = (struct urb *)data; - pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; + pHTTXContext = (struct rt_ht_tx_context *)pUrb->context; pAd = pHTTXContext->pAd; rtusb_dataout_complete((unsigned long)pUrb); @@ -675,13 +675,13 @@ static void rtusb_ac2_dma_done_tasklet(unsigned long data) static void rtusb_ac1_dma_done_tasklet(unsigned long data) { - PRTMP_ADAPTER pAd; - PHT_TX_CONTEXT pHTTXContext; + struct rt_rtmp_adapter *pAd; + struct rt_ht_tx_context *pHTTXContext; u8 BulkOutPipeId = 1; struct urb *pUrb; pUrb = (struct urb *)data; - pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; + pHTTXContext = (struct rt_ht_tx_context *)pUrb->context; pAd = pHTTXContext->pAd; rtusb_dataout_complete((unsigned long)pUrb); @@ -715,13 +715,13 @@ static void rtusb_ac1_dma_done_tasklet(unsigned long data) static void rtusb_ac0_dma_done_tasklet(unsigned long data) { - PRTMP_ADAPTER pAd; - PHT_TX_CONTEXT pHTTXContext; + struct rt_rtmp_adapter *pAd; + struct rt_ht_tx_context *pHTTXContext; u8 BulkOutPipeId = 0; struct urb *pUrb; pUrb = (struct urb *)data; - pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; + pHTTXContext = (struct rt_ht_tx_context *)pUrb->context; pAd = pHTTXContext->pAd; rtusb_dataout_complete((unsigned long)pUrb); @@ -753,7 +753,7 @@ static void rtusb_ac0_dma_done_tasklet(unsigned long data) } -int RtmpNetTaskInit(IN RTMP_ADAPTER * pAd) +int RtmpNetTaskInit(struct rt_rtmp_adapter *pAd) { struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; @@ -780,7 +780,7 @@ int RtmpNetTaskInit(IN RTMP_ADAPTER * pAd) return NDIS_STATUS_SUCCESS; } -void RtmpNetTaskExit(IN RTMP_ADAPTER * pAd) +void RtmpNetTaskExit(struct rt_rtmp_adapter *pAd) { struct os_cookie *pObj; diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h index 8182b2aa4563..c50abf4b8068 100644 --- a/drivers/staging/rt2860/rtmp.h +++ b/drivers/staging/rt2860/rtmp.h @@ -44,10 +44,7 @@ #include "rtmp_dot11.h" #include "rtmp_chip.h" -typedef struct _RTMP_ADAPTER RTMP_ADAPTER; -typedef struct _RTMP_ADAPTER *PRTMP_ADAPTER; - -typedef struct _RTMP_CHIP_OP_ RTMP_CHIP_OP; +struct rt_rtmp_adapter; /*#define DBG 1 */ @@ -146,7 +143,7 @@ extern u8 RateSwitchTable11N2SForABand[]; extern u8 PRE_N_HT_OUI[]; -typedef struct _RSSI_SAMPLE { +struct rt_rssi_sample { char LastRssi0; /* last received RSSI */ char LastRssi1; /* last received RSSI */ char LastRssi2; /* last received RSSI */ @@ -156,21 +153,23 @@ typedef struct _RSSI_SAMPLE { short AvgRssi0X8; short AvgRssi1X8; short AvgRssi2X8; -} RSSI_SAMPLE; +}; /* */ /* Queue structure and macros */ /* */ -typedef struct _QUEUE_ENTRY { - struct _QUEUE_ENTRY *Next; -} QUEUE_ENTRY, *PQUEUE_ENTRY; +struct rt_queue_entry; + +struct rt_queue_entry { + struct rt_queue_entry *Next; +}; /* Queue structure */ -typedef struct _QUEUE_HEADER { - PQUEUE_ENTRY Head; - PQUEUE_ENTRY Tail; +struct rt_queue_header { + struct rt_queue_entry *Head; + struct rt_queue_entry *Tail; unsigned long Number; -} QUEUE_HEADER, *PQUEUE_HEADER; +}; #define InitializeQueueHeader(QueueHeader) \ { \ @@ -181,7 +180,7 @@ typedef struct _QUEUE_HEADER { #define RemoveHeadQueue(QueueHeader) \ (QueueHeader)->Head; \ { \ - PQUEUE_ENTRY pNext; \ + struct rt_queue_entry *pNext; \ if ((QueueHeader)->Head != NULL) \ { \ pNext = (QueueHeader)->Head->Next; \ @@ -195,32 +194,32 @@ typedef struct _QUEUE_HEADER { #define InsertHeadQueue(QueueHeader, QueueEntry) \ { \ - ((PQUEUE_ENTRY)QueueEntry)->Next = (QueueHeader)->Head; \ - (QueueHeader)->Head = (PQUEUE_ENTRY)(QueueEntry); \ + ((struct rt_queue_entry *)QueueEntry)->Next = (QueueHeader)->Head; \ + (QueueHeader)->Head = (struct rt_queue_entry *)(QueueEntry); \ if ((QueueHeader)->Tail == NULL) \ - (QueueHeader)->Tail = (PQUEUE_ENTRY)(QueueEntry); \ + (QueueHeader)->Tail = (struct rt_queue_entry *)(QueueEntry); \ (QueueHeader)->Number++; \ } #define InsertTailQueue(QueueHeader, QueueEntry) \ { \ - ((PQUEUE_ENTRY)QueueEntry)->Next = NULL; \ + ((struct rt_queue_entry *)QueueEntry)->Next = NULL; \ if ((QueueHeader)->Tail) \ - (QueueHeader)->Tail->Next = (PQUEUE_ENTRY)(QueueEntry); \ + (QueueHeader)->Tail->Next = (struct rt_queue_entry *)(QueueEntry); \ else \ - (QueueHeader)->Head = (PQUEUE_ENTRY)(QueueEntry); \ - (QueueHeader)->Tail = (PQUEUE_ENTRY)(QueueEntry); \ + (QueueHeader)->Head = (struct rt_queue_entry *)(QueueEntry); \ + (QueueHeader)->Tail = (struct rt_queue_entry *)(QueueEntry); \ (QueueHeader)->Number++; \ } #define InsertTailQueueAc(pAd, pEntry, QueueHeader, QueueEntry) \ { \ - ((PQUEUE_ENTRY)QueueEntry)->Next = NULL; \ + ((struct rt_queue_entry *)QueueEntry)->Next = NULL; \ if ((QueueHeader)->Tail) \ - (QueueHeader)->Tail->Next = (PQUEUE_ENTRY)(QueueEntry); \ + (QueueHeader)->Tail->Next = (struct rt_queue_entry *)(QueueEntry); \ else \ - (QueueHeader)->Head = (PQUEUE_ENTRY)(QueueEntry); \ - (QueueHeader)->Tail = (PQUEUE_ENTRY)(QueueEntry); \ + (QueueHeader)->Head = (struct rt_queue_entry *)(QueueEntry); \ + (QueueHeader)->Tail = (struct rt_queue_entry *)(QueueEntry); \ (QueueHeader)->Number++; \ } @@ -294,12 +293,12 @@ typedef struct _QUEUE_HEADER { /* MACRO for 32-bit PCI register read / write */ /* */ /* Usage : RTMP_IO_READ32( */ -/* PRTMP_ADAPTER pAd, */ +/* struct rt_rtmp_adapter *pAd, */ /* unsigned long Register_Offset, */ /* unsigned long * pValue) */ /* */ /* RTMP_IO_WRITE32( */ -/* PRTMP_ADAPTER pAd, */ +/* struct rt_rtmp_adapter *pAd, */ /* unsigned long Register_Offset, */ /* unsigned long Value) */ /* */ @@ -307,21 +306,21 @@ typedef struct _QUEUE_HEADER { /* */ /* Common fragment list structure - Identical to the scatter gather frag list structure */ /* */ -/*#define RTMP_SCATTER_GATHER_ELEMENT SCATTER_GATHER_ELEMENT */ -/*#define PRTMP_SCATTER_GATHER_ELEMENT PSCATTER_GATHER_ELEMENT */ +/*#define struct rt_rtmp_sg_element SCATTER_GATHER_ELEMENT */ +/*#define struct rt_rtmp_sg_element *PSCATTER_GATHER_ELEMENT */ #define NIC_MAX_PHYS_BUF_COUNT 8 -typedef struct _RTMP_SCATTER_GATHER_ELEMENT { +struct rt_rtmp_sg_element { void *Address; unsigned long Length; unsigned long *Reserved; -} RTMP_SCATTER_GATHER_ELEMENT, *PRTMP_SCATTER_GATHER_ELEMENT; +}; -typedef struct _RTMP_SCATTER_GATHER_LIST { +struct rt_rtmp_sg_list { unsigned long NumberOfElements; unsigned long *Reserved; - RTMP_SCATTER_GATHER_ELEMENT Elements[NIC_MAX_PHYS_BUF_COUNT]; -} RTMP_SCATTER_GATHER_LIST, *PRTMP_SCATTER_GATHER_LIST; + struct rt_rtmp_sg_element Elements[NIC_MAX_PHYS_BUF_COUNT]; +}; /* */ /* Some utility macros */ @@ -476,11 +475,11 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { /* Data buffer for DMA operation, the buffer must be contiguous physical memory */ /* Both DMA to / from CPU use the same structure. */ /* */ -typedef struct _RTMP_DMABUF { +struct rt_rtmp_dmabuf { unsigned long AllocSize; void *AllocVa; /* TxBuf virtual address */ dma_addr_t AllocPa; /* TxBuf physical address */ -} RTMP_DMABUF, *PRTMP_DMABUF; +}; /* */ /* Control block (Descriptor) for all ring descriptor DMA operation, buffer must be */ @@ -490,41 +489,41 @@ typedef struct _RTMP_DMABUF { /* to describe the packet buffer. For Tx, char stored the tx packet descriptor */ /* which driver should ACK upper layer when the tx is physically done or failed. */ /* */ -typedef struct _RTMP_DMACB { +struct rt_rtmp_dmacb { unsigned long AllocSize; /* Control block size */ void *AllocVa; /* Control block virtual address */ dma_addr_t AllocPa; /* Control block physical address */ void *pNdisPacket; void *pNextNdisPacket; - RTMP_DMABUF DmaBuf; /* Associated DMA buffer structure */ -} RTMP_DMACB, *PRTMP_DMACB; + struct rt_rtmp_dmabuf DmaBuf; /* Associated DMA buffer structure */ +}; -typedef struct _RTMP_TX_RING { - RTMP_DMACB Cell[TX_RING_SIZE]; +struct rt_rtmp_tx_ring { + struct rt_rtmp_dmacb Cell[TX_RING_SIZE]; u32 TxCpuIdx; u32 TxDmaIdx; u32 TxSwFreeIdx; /* software next free tx index */ -} RTMP_TX_RING, *PRTMP_TX_RING; +}; -typedef struct _RTMP_RX_RING { - RTMP_DMACB Cell[RX_RING_SIZE]; +struct rt_rtmp_rx_ring { + struct rt_rtmp_dmacb Cell[RX_RING_SIZE]; u32 RxCpuIdx; u32 RxDmaIdx; int RxSwReadIdx; /* software next read index */ -} RTMP_RX_RING, *PRTMP_RX_RING; +}; -typedef struct _RTMP_MGMT_RING { - RTMP_DMACB Cell[MGMT_RING_SIZE]; +struct rt_rtmp_mgmt_ring { + struct rt_rtmp_dmacb Cell[MGMT_RING_SIZE]; u32 TxCpuIdx; u32 TxDmaIdx; u32 TxSwFreeIdx; /* software next free tx index */ -} RTMP_MGMT_RING, *PRTMP_MGMT_RING; +}; /* */ /* Statistic counter structure */ /* */ -typedef struct _COUNTER_802_3 { +struct rt_counter_802_3 { /* General Stats */ unsigned long GoodTransmits; unsigned long GoodReceives; @@ -537,9 +536,9 @@ typedef struct _COUNTER_802_3 { unsigned long OneCollision; unsigned long MoreCollisions; -} COUNTER_802_3, *PCOUNTER_802_3; +}; -typedef struct _COUNTER_802_11 { +struct rt_counter_802_11 { unsigned long Length; LARGE_INTEGER LastTransmittedFragmentCount; LARGE_INTEGER TransmittedFragmentCount; @@ -554,9 +553,9 @@ typedef struct _COUNTER_802_11 { LARGE_INTEGER ReceivedFragmentCount; LARGE_INTEGER MulticastReceivedFrameCount; LARGE_INTEGER FCSErrorCount; -} COUNTER_802_11, *PCOUNTER_802_11; +}; -typedef struct _COUNTER_RALINK { +struct rt_counter_ralink { unsigned long TransmittedByteCount; /* both successful and failure, used to calculate TX throughput */ unsigned long ReceivedByteCount; /* both CRC okay and CRC error, used to calculate RX throughput */ unsigned long BeenDisassociatedCount; @@ -619,9 +618,9 @@ typedef struct _COUNTER_RALINK { LARGE_INTEGER TransmittedMPDUsInAMPDUCount; LARGE_INTEGER TransmittedOctetsInAMPDUCount; LARGE_INTEGER MPDUInReceivedAMPDUCount; -} COUNTER_RALINK, *PCOUNTER_RALINK; +}; -typedef struct _COUNTER_DRS { +struct rt_counter_drs { /* to record the each TX rate's quality. 0 is best, the bigger the worse. */ u16 TxQuality[MAX_STEP_OF_TX_RATE_SWITCH]; u8 PER[MAX_STEP_OF_TX_RATE_SWITCH]; @@ -632,12 +631,12 @@ typedef struct _COUNTER_DRS { u8 LastSecTxRateChangeAction; /* 0: no change, 1:rate UP, 2:rate down */ u8 LastTimeTxRateChangeAction; /*Keep last time value of LastSecTxRateChangeAction */ unsigned long LastTxOkCount; -} COUNTER_DRS, *PCOUNTER_DRS; +}; /*************************************************************************** * security key related data structure **************************************************************************/ -typedef struct _CIPHER_KEY { +struct rt_cipher_key { u8 Key[16]; /* right now we implement 4 keys, 128 bits max */ u8 RxMic[8]; /* make alignment */ u8 TxMic[8]; @@ -648,37 +647,37 @@ typedef struct _CIPHER_KEY { u8 BssId[6]; /* Key length for each key, 0: entry is invalid */ u8 Type; /* Indicate Pairwise/Group when reporting MIC error */ -} CIPHER_KEY, *PCIPHER_KEY; +}; /* structure to define WPA Group Key Rekey Interval */ -typedef struct PACKED _RT_802_11_WPA_REKEY { +struct PACKED rt_802_11_wpa_rekey { unsigned long ReKeyMethod; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */ unsigned long ReKeyInterval; /* time-based: seconds, packet-based: kilo-packets */ -} RT_WPA_REKEY, *PRT_WPA_REKEY, RT_802_11_WPA_REKEY, *PRT_802_11_WPA_REKEY; +}; #ifdef RTMP_MAC_USB /*************************************************************************** * RTUSB I/O related data structure **************************************************************************/ -typedef struct _RT_SET_ASIC_WCID { +struct rt_set_asic_wcid { unsigned long WCID; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */ unsigned long SetTid; /* time-based: seconds, packet-based: kilo-packets */ unsigned long DeleteTid; /* time-based: seconds, packet-based: kilo-packets */ u8 Addr[MAC_ADDR_LEN]; /* avoid in interrupt when write key */ -} RT_SET_ASIC_WCID, *PRT_SET_ASIC_WCID; +}; -typedef struct _RT_SET_ASIC_WCID_ATTRI { +struct rt_set_asic_wcid_attri { unsigned long WCID; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */ unsigned long Cipher; /* ASIC Cipher definition */ u8 Addr[ETH_LENGTH_OF_ADDRESS]; -} RT_SET_ASIC_WCID_ATTRI, *PRT_SET_ASIC_WCID_ATTRI; +}; /* for USB interface, avoid in interrupt when write key */ -typedef struct RT_ADD_PAIRWISE_KEY_ENTRY { +struct rt_add_pairwise_key_entry { u8 MacAddr[6]; u16 MacTabMatchWCID; /* ASIC */ - CIPHER_KEY CipherKey; -} RT_ADD_PAIRWISE_KEY_ENTRY, *PRT_ADD_PAIRWISE_KEY_ENTRY; + struct rt_cipher_key CipherKey; +}; /* Cipher suite type for mixed mode group cipher, P802.11i-2004 */ typedef enum _RT_802_11_CIPHER_SUITE_TYPE { @@ -691,24 +690,24 @@ typedef enum _RT_802_11_CIPHER_SUITE_TYPE { } RT_802_11_CIPHER_SUITE_TYPE, *PRT_802_11_CIPHER_SUITE_TYPE; #endif /* RTMP_MAC_USB // */ -typedef struct { +struct rt_rogueap_entry { u8 Addr[MAC_ADDR_LEN]; u8 ErrorCode[2]; /*00 01-Invalid authentication type */ /*00 02-Authentication timeout */ /*00 03-Challenge from AP failed */ /*00 04-Challenge to AP failed */ BOOLEAN Reported; -} ROGUEAP_ENTRY, *PROGUEAP_ENTRY; +}; -typedef struct { +struct rt_rogueap_table { u8 RogueApNr; - ROGUEAP_ENTRY RogueApEntry[MAX_LEN_OF_BSS_TABLE]; -} ROGUEAP_TABLE, *PROGUEAP_TABLE; + struct rt_rogueap_entry RogueApEntry[MAX_LEN_OF_BSS_TABLE]; +}; /* */ /* Cisco IAPP format */ /* */ -typedef struct _CISCO_IAPP_CONTENT_ { +struct rt_cisco_iapp_content { u16 Length; /*IAPP Length */ u8 MessageType; /*IAPP type */ u8 FunctionCode; /*IAPP function type */ @@ -722,42 +721,42 @@ typedef struct _CISCO_IAPP_CONTENT_ { u16 SsidLen; u8 Ssid[MAX_LEN_OF_SSID]; u16 Seconds; /*Seconds that the client has been disassociated. */ -} CISCO_IAPP_CONTENT, *PCISCO_IAPP_CONTENT; +}; /* * Fragment Frame structure */ -typedef struct _FRAGMENT_FRAME { +struct rt_fragment_frame { void *pFragPacket; unsigned long RxSize; u16 Sequence; u16 LastFrag; unsigned long Flags; /* Some extra frame information. bit 0: LLC presented */ -} FRAGMENT_FRAME, *PFRAGMENT_FRAME; +}; /* */ /* Packet information for NdisQueryPacket */ /* */ -typedef struct _PACKET_INFO { +struct rt_packet_info { u32 PhysicalBufferCount; /* Physical breaks of buffer descripor chained */ u32 BufferCount; /* Number of Buffer descriptor chained */ u32 TotalPacketLength; /* Self explained */ char *pFirstBuffer; /* Pointer to first buffer descriptor */ -} PACKET_INFO, *PPACKET_INFO; +}; /* */ /* Arcfour Structure Added by PaulWu */ /* */ -typedef struct _ARCFOUR { +struct rt_arcfourcontext { u32 X; u32 Y; u8 STATE[256]; -} ARCFOURCONTEXT, *PARCFOURCONTEXT; +}; /* */ /* Tkip Key structure which RC4 key & MIC calculation */ /* */ -typedef struct _TKIP_KEY_INFO { +struct rt_tkip_key_info { u32 nBytesInM; /* # bytes in M for MICKEY */ unsigned long IV16; unsigned long IV32; @@ -768,56 +767,56 @@ typedef struct _TKIP_KEY_INFO { unsigned long M; /* Message accumulator for MICKEY */ u8 RC4KEY[16]; u8 MIC[8]; -} TKIP_KEY_INFO, *PTKIP_KEY_INFO; +}; /* */ /* Private / Misc data, counters for driver internal use */ /* */ -typedef struct __PRIVATE_STRUC { +struct rt_private { u32 SystemResetCnt; /* System reset counter */ u32 TxRingFullCnt; /* Tx ring full occurrance number */ u32 PhyRxErrCnt; /* PHY Rx error count, for debug purpose, might move to global counter */ /* Variables for WEP encryption / decryption in rtmp_wep.c */ u32 FCSCRC32; - ARCFOURCONTEXT WEPCONTEXT; + struct rt_arcfourcontext WEPCONTEXT; /* Tkip stuff */ - TKIP_KEY_INFO Tx; - TKIP_KEY_INFO Rx; -} PRIVATE_STRUC, *PPRIVATE_STRUC; + struct rt_tkip_key_info Tx; + struct rt_tkip_key_info Rx; +}; /*************************************************************************** * Channel and BBP related data structures **************************************************************************/ /* structure to tune BBP R66 (BBP TUNING) */ -typedef struct _BBP_R66_TUNING { +struct rt_bbp_r66_tuning { BOOLEAN bEnable; u16 FalseCcaLowerThreshold; /* default 100 */ u16 FalseCcaUpperThreshold; /* default 512 */ u8 R66Delta; u8 R66CurrentValue; BOOLEAN R66LowerUpperSelect; /*Before LinkUp, Used LowerBound or UpperBound as R66 value. */ -} BBP_R66_TUNING, *PBBP_R66_TUNING; +}; /* structure to store channel TX power */ -typedef struct _CHANNEL_TX_POWER { +struct rt_channel_tx_power { u16 RemainingTimeForUse; /*unit: sec */ u8 Channel; char Power; char Power2; u8 MaxTxPwr; u8 DfsReq; -} CHANNEL_TX_POWER, *PCHANNEL_TX_POWER; +}; /* structure to store 802.11j channel TX power */ -typedef struct _CHANNEL_11J_TX_POWER { +struct rt_channel_11j_tx_power { u8 Channel; u8 BW; /* BW_10 or BW_20 */ char Power; char Power2; u16 RemainingTimeForUse; /*unit: sec */ -} CHANNEL_11J_TX_POWER, *PCHANNEL_11J_TX_POWER; +}; -typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT { +struct rt_soft_rx_ant_diversity { u8 EvaluatePeriod; /* 0:not evalute status, 1: evaluate status, 2: switching status */ u8 EvaluateStableCnt; u8 Pair1PrimaryRxAnt; /* 0:Ant-E1, 1:Ant-E2 */ @@ -830,13 +829,13 @@ typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT { short Pair2LastAvgRssi; /* */ unsigned long RcvPktNumWhenEvaluate; BOOLEAN FirstPktArrivedWhenEvaluate; - RALINK_TIMER_STRUCT RxAntDiversityTimer; -} SOFT_RX_ANT_DIVERSITY, *PSOFT_RX_ANT_DIVERSITY; + struct rt_ralink_timer RxAntDiversityTimer; +}; /*************************************************************************** * structure for radar detection and channel switch **************************************************************************/ -typedef struct _RADAR_DETECT_STRUCT { +struct rt_radar_detect { /*BOOLEAN IEEE80211H; // 0: disable, 1: enable IEEE802.11h */ u8 CSCount; /*Channel switch counter */ u8 CSPeriod; /*Channel switch period (beacon count) */ @@ -854,7 +853,7 @@ typedef struct _RADAR_DETECT_STRUCT { BOOLEAN bFastDfs; u8 ChMovingTime; u8 LongPulseRadarTh; -} RADAR_DETECT_STRUCT, *PRADAR_DETECT_STRUCT; +}; typedef enum _ABGBAND_STATE_ { UNKNOWN_BAND, @@ -880,25 +879,25 @@ typedef union _PS_CONTROL { /*************************************************************************** * structure for MLME state machine **************************************************************************/ -typedef struct _MLME_STRUCT { +struct rt_mlme { /* STA state machines */ - STATE_MACHINE CntlMachine; - STATE_MACHINE AssocMachine; - STATE_MACHINE AuthMachine; - STATE_MACHINE AuthRspMachine; - STATE_MACHINE SyncMachine; - STATE_MACHINE WpaPskMachine; - STATE_MACHINE LeapMachine; + struct rt_state_machine CntlMachine; + struct rt_state_machine AssocMachine; + struct rt_state_machine AuthMachine; + struct rt_state_machine AuthRspMachine; + struct rt_state_machine SyncMachine; + struct rt_state_machine WpaPskMachine; + struct rt_state_machine LeapMachine; STATE_MACHINE_FUNC AssocFunc[ASSOC_FUNC_SIZE]; STATE_MACHINE_FUNC AuthFunc[AUTH_FUNC_SIZE]; STATE_MACHINE_FUNC AuthRspFunc[AUTH_RSP_FUNC_SIZE]; STATE_MACHINE_FUNC SyncFunc[SYNC_FUNC_SIZE]; STATE_MACHINE_FUNC ActFunc[ACT_FUNC_SIZE]; /* Action */ - STATE_MACHINE ActMachine; + struct rt_state_machine ActMachine; /* common WPA state machine */ - STATE_MACHINE WpaMachine; + struct rt_state_machine WpaMachine; STATE_MACHINE_FUNC WpaFunc[WPA_FUNC_SIZE]; unsigned long ChannelQuality; /* 0..100, Channel Quality Indication for Roaming */ @@ -907,18 +906,18 @@ typedef struct _MLME_STRUCT { BOOLEAN bRunning; spinlock_t TaskLock; - MLME_QUEUE Queue; + struct rt_mlme_queue Queue; u32 ShiftReg; - RALINK_TIMER_STRUCT PeriodicTimer; - RALINK_TIMER_STRUCT APSDPeriodicTimer; - RALINK_TIMER_STRUCT LinkDownTimer; - RALINK_TIMER_STRUCT LinkUpTimer; + struct rt_ralink_timer PeriodicTimer; + struct rt_ralink_timer APSDPeriodicTimer; + struct rt_ralink_timer LinkDownTimer; + struct rt_ralink_timer LinkUpTimer; #ifdef RTMP_MAC_PCI u8 bPsPollTimerRunning; - RALINK_TIMER_STRUCT PsPollTimer; - RALINK_TIMER_STRUCT RadioOnOffTimer; + struct rt_ralink_timer PsPollTimer; + struct rt_ralink_timer RadioOnOffTimer; #endif /* RTMP_MAC_PCI // */ unsigned long PeriodicRound; unsigned long OneSecPeriodicRound; @@ -926,7 +925,7 @@ typedef struct _MLME_STRUCT { u8 RealRxPath; BOOLEAN bLowThroughput; BOOLEAN bEnableAutoAntennaCheck; - RALINK_TIMER_STRUCT RxAntEvalTimer; + struct rt_ralink_timer RxAntEvalTimer; #ifdef RT30xx u8 CaliBW40RfR24; @@ -934,10 +933,10 @@ typedef struct _MLME_STRUCT { #endif /* RT30xx // */ #ifdef RTMP_MAC_USB - RALINK_TIMER_STRUCT AutoWakeupTimer; + struct rt_ralink_timer AutoWakeupTimer; BOOLEAN AutoWakeupTimerRunning; #endif /* RTMP_MAC_USB // */ -} MLME_STRUCT, *PMLME_STRUCT; +}; /*************************************************************************** * 802.11 N related data structures @@ -974,7 +973,7 @@ typedef enum _ORI_BLOCKACK_STATUS { Originator_Done } ORI_BLOCKACK_STATUS, *PORI_BLOCKACK_STATUS; -typedef struct _BA_ORI_ENTRY { +struct rt_ba_ori_entry { u8 Wcid; u8 TID; u8 BAWinSize; @@ -983,11 +982,11 @@ typedef struct _BA_ORI_ENTRY { u16 Sequence; u16 TimeOutValue; ORI_BLOCKACK_STATUS ORI_BA_Status; - RALINK_TIMER_STRUCT ORIBATimer; + struct rt_ralink_timer ORIBATimer; void *pAdapter; -} BA_ORI_ENTRY, *PBA_ORI_ENTRY; +}; -typedef struct _BA_REC_ENTRY { +struct rt_ba_rec_entry { u8 Wcid; u8 TID; u8 BAWinSize; /* 7.3.1.14. each buffer is capable of holding a max AMSDU or MSDU. */ @@ -996,7 +995,7 @@ typedef struct _BA_REC_ENTRY { u16 LastIndSeq; /* u16 LastIndSeqAtTimer; */ u16 TimeOutValue; - RALINK_TIMER_STRUCT RECBATimer; + struct rt_ralink_timer RECBATimer; unsigned long LastIndSeqAtTimer; unsigned long nDropPacket; unsigned long rcvSeq; @@ -1008,40 +1007,40 @@ typedef struct _BA_REC_ENTRY { /* struct _BA_REC_ENTRY *pNext; */ void *pAdapter; struct reordering_list list; -} BA_REC_ENTRY, *PBA_REC_ENTRY; +}; -typedef struct { +struct rt_ba_table { unsigned long numAsRecipient; /* I am recipient of numAsRecipient clients. These client are in the BARecEntry[] */ unsigned long numAsOriginator; /* I am originator of numAsOriginator clients. These clients are in the BAOriEntry[] */ unsigned long numDoneOriginator; /* count Done Originator sessions */ - BA_ORI_ENTRY BAOriEntry[MAX_LEN_OF_BA_ORI_TABLE]; - BA_REC_ENTRY BARecEntry[MAX_LEN_OF_BA_REC_TABLE]; -} BA_TABLE, *PBA_TABLE; + struct rt_ba_ori_entry BAOriEntry[MAX_LEN_OF_BA_ORI_TABLE]; + struct rt_ba_rec_entry BARecEntry[MAX_LEN_OF_BA_REC_TABLE]; +}; /*For QureyBATableOID use; */ -typedef struct PACKED _OID_BA_REC_ENTRY { +struct PACKED rt_oid_ba_rec_entry { u8 MACAddr[MAC_ADDR_LEN]; u8 BaBitmap; /* if (BaBitmap&(1<MaxHTPhyMode.field.MODE >= MODE_HTMIX) @@ -1079,7 +1078,7 @@ typedef struct { (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX) /*This structure is for all 802.11n card InterOptibilityTest action. Reset all Num every n second. (Details see MLMEPeriodic) */ -typedef struct _IOT_STRUC { +struct rt_iot { u8 Threshold[2]; u8 ReorderTimeOutNum[MAX_LEN_OF_BA_REC_TABLE]; /* compare with threshold[0] */ u8 RefreshNum[MAX_LEN_OF_BA_REC_TABLE]; /* compare with threshold[1] */ @@ -1096,7 +1095,7 @@ typedef struct _IOT_STRUC { BOOLEAN bNowAtherosBurstOn; BOOLEAN bNextDisableRxBA; BOOLEAN bToggle; -} IOT_STRUC, *PIOT_STRUC; +}; /* This is the registry setting for 802.11n transmit setting. Used in advanced page. */ typedef union _REG_TRANSMIT_SETTING { @@ -1131,7 +1130,7 @@ typedef union _DESIRED_TRANSMIT_SETTING { * USB-based chip Beacon related data structures **************************************************************************/ #define BEACON_BITMAP_MASK 0xff -typedef struct _BEACON_SYNC_STRUCT_ { +struct rt_beacon_sync { u8 BeaconBuf[HW_BEACON_MAX_COUNT][HW_BEACON_OFFSET]; u8 BeaconTxWI[HW_BEACON_MAX_COUNT][TXWI_SIZE]; unsigned long TimIELocationInBeacon[HW_BEACON_MAX_COUNT]; @@ -1139,7 +1138,7 @@ typedef struct _BEACON_SYNC_STRUCT_ { BOOLEAN EnableBeacon; /* trigger to enable beacon transmission. */ u8 BeaconBitMap; /* NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change. */ u8 DtimBitOn; /* NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change. */ -} BEACON_SYNC_STRUCT; +}; #endif /* RTMP_MAC_USB // */ /*************************************************************************** @@ -1169,7 +1168,7 @@ typedef struct _BEACON_SYNC_STRUCT_ { ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] |= BIT8[bit_offset]; } /* configuration common to OPMODE_AP as well as OPMODE_STA */ -typedef struct _COMMON_CONFIG { +struct rt_common_config { BOOLEAN bCountryFlag; u8 CountryCode[3]; @@ -1246,7 +1245,7 @@ typedef struct _COMMON_CONFIG { BACAP_STRUC BACapability; /* NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 */ BACAP_STRUC REGBACapability; /* NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 */ - IOT_STRUC IOTestParm; /* 802.11n InterOpbility Test Parameter; */ + struct rt_iot IOTestParm; /* 802.11n InterOpbility Test Parameter; */ unsigned long TxPreamble; /* Rt802_11PreambleLong, Rt802_11PreambleShort, Rt802_11PreambleAuto */ BOOLEAN bUseZeroToDisableFragment; /* Microsoft use 0 as disable */ unsigned long UseBGProtection; /* 0: auto, 1: always use, 2: always not use */ @@ -1260,9 +1259,9 @@ typedef struct _COMMON_CONFIG { BOOLEAN bRdg; BOOLEAN bWmmCapable; /* 0:disable WMM, 1:enable WMM */ - QOS_CAPABILITY_PARM APQosCapability; /* QOS capability of the current associated AP */ - EDCA_PARM APEdcaParm; /* EDCA parameters of the current associated AP */ - QBSS_LOAD_PARM APQbssLoad; /* QBSS load of the current associated AP */ + struct rt_qos_capability_parm APQosCapability; /* QOS capability of the current associated AP */ + struct rt_edca_parm APEdcaParm; /* EDCA parameters of the current associated AP */ + struct rt_qbss_load_parm APQbssLoad; /* QBSS load of the current associated AP */ u8 AckPolicy[4]; /* ACK policy of the specified AC. see ACK_xxx */ BOOLEAN bDLSCapable; /* 0:disable DLS, 1:enable DLS */ /* a bitmap of BOOLEAN flags. each bit represent an operation status of a particular */ @@ -1275,17 +1274,17 @@ typedef struct _COMMON_CONFIG { ABGBAND_STATE BandState; /* For setting BBP used on B/G or A mode. */ /* IEEE802.11H--DFS. */ - RADAR_DETECT_STRUCT RadarDetect; + struct rt_radar_detect RadarDetect; /* HT */ u8 BASize; /* USer desired BAWindowSize. Should not exceed our max capability */ - /*RT_HT_CAPABILITY SupportedHtPhy; */ - RT_HT_CAPABILITY DesiredHtPhy; - HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHTInfo; /* Useful as AP. */ + /*struct rt_ht_capability SupportedHtPhy; */ + struct rt_ht_capability DesiredHtPhy; + struct rt_ht_capability_ie HtCapability; + struct rt_add_ht_info_ie AddHTInfo; /* Useful as AP. */ /*This IE is used with channel switch announcement element when changing to a new 40MHz. */ /*This IE is included in channel switch ammouncement frames 7.4.1.5, beacons, probe Rsp. */ - NEW_EXT_CHAN_IE NewExtChanOffset; /*7.3.2.20A, 1 if extension channel is above the control channel, 3 if below, 0 if not present */ + struct rt_new_ext_chan_ie NewExtChanOffset; /*7.3.2.20A, 1 if extension channel is above the control channel, 3 if below, 0 if not present */ BOOLEAN bHTProtect; BOOLEAN bMIMOPSEnable; @@ -1314,24 +1313,24 @@ typedef struct _COMMON_CONFIG { #ifdef RTMP_MAC_USB BOOLEAN bMultipleIRP; /* Multiple Bulk IN flag */ u8 NumOfBulkInIRP; /* if bMultipleIRP == TRUE, NumOfBulkInIRP will be 4 otherwise be 1 */ - RT_HT_CAPABILITY SupportedHtPhy; + struct rt_ht_capability SupportedHtPhy; unsigned long MaxPktOneTxBulk; u8 TxBulkFactor; u8 RxBulkFactor; BOOLEAN IsUpdateBeacon; - BEACON_SYNC_STRUCT *pBeaconSync; - RALINK_TIMER_STRUCT BeaconUpdateTimer; + struct rt_beacon_sync *pBeaconSync; + struct rt_ralink_timer BeaconUpdateTimer; u32 BeaconAdjust; u32 BeaconFactor; u32 BeaconRemain; #endif /* RTMP_MAC_USB // */ spinlock_t MeasureReqTabLock; - PMEASURE_REQ_TAB pMeasureReqTab; + struct rt_measure_req_tab *pMeasureReqTab; spinlock_t TpcReqTabLock; - PTPC_REQ_TAB pTpcReqTab; + struct rt_tpc_req_tab *pTpcReqTab; BOOLEAN PSPXlink; /* 0: Disable. 1: Enable */ @@ -1341,11 +1340,11 @@ typedef struct _COMMON_CONFIG { #endif BOOLEAN HT_DisallowTKIP; /* Restrict the encryption type in 11n HT mode */ -} COMMON_CONFIG, *PCOMMON_CONFIG; +}; /* Modified by Wu Xi-Kun 4/21/2006 */ /* STA configuration and status */ -typedef struct _STA_ADMIN_CONFIG { +struct rt_sta_admin_config { /* GROUP 1 - */ /* User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe */ /* the user intended configuration, but not necessary fully equal to the final */ @@ -1396,7 +1395,7 @@ typedef struct _STA_ADMIN_CONFIG { u8 PMK[32]; /* WPA PSK mode PMK */ u8 PTK[64]; /* WPA PSK mode PTK */ u8 GTK[32]; /* GTK from authenticator */ - BSSID_INFO SavedPMK[PMKID_NO]; + struct rt_bssid_info SavedPMK[PMKID_NO]; u32 SavedPMKNum; /* Saved PMKID number */ u8 DefaultKeyId; @@ -1416,7 +1415,7 @@ typedef struct _STA_ADMIN_CONFIG { u8 LastSNR0; /* last received BEACON's SNR */ u8 LastSNR1; /* last received BEACON's SNR for 2nd antenna */ - RSSI_SAMPLE RssiSample; + struct rt_rssi_sample RssiSample; unsigned long NumOfAvgRssiSample; unsigned long LastBeaconRxTime; /* OS's timestamp of the last BEACON RX time */ @@ -1434,7 +1433,7 @@ typedef struct _STA_ADMIN_CONFIG { /* New for WPA, windows want us to keep association information and */ /* Fixed IEs from last association response */ - NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo; + struct rt_ndis_802_11_association_information AssocInfo; u16 ReqVarIELen; /* Length of next VIE include EID & Length */ u8 ReqVarIEs[MAX_VIE_LEN]; /* The content saved here should be little-endian format. */ u16 ResVarIELen; /* Length of next VIE include EID & Length */ @@ -1457,7 +1456,7 @@ typedef struct _STA_ADMIN_CONFIG { u8 NHFactor; /* Parameter for Noise histogram */ u8 CLFactor; /* Parameter for channel load */ - RALINK_TIMER_STRUCT StaQuickResponeForRateUpTimer; + struct rt_ralink_timer StaQuickResponeForRateUpTimer; BOOLEAN StaQuickResponeForRateUpTimerRunning; u8 DtimCount; /* 0.. DtimPeriod-1 */ @@ -1468,14 +1467,14 @@ typedef struct _STA_ADMIN_CONFIG { BOOLEAN WhqlTest; /*////////////////////////////////////////////////////////////////////////////////////// */ - RALINK_TIMER_STRUCT WpaDisassocAndBlockAssocTimer; + struct rt_ralink_timer WpaDisassocAndBlockAssocTimer; /* Fast Roaming */ BOOLEAN bAutoRoaming; /* 0:disable auto roaming by RSSI, 1:enable auto roaming by RSSI */ char dBmToRoam; /* the condition to roam when receiving Rssi less than this value. It's negative value. */ BOOLEAN IEEE8021X; BOOLEAN IEEE8021x_required_keys; - CIPHER_KEY DesireSharedKey[4]; /* Record user desired WEP keys */ + struct rt_cipher_key DesireSharedKey[4]; /* Record user desired WEP keys */ u8 DesireSharedKeyId; /* 0: driver ignores wpa_supplicant */ @@ -1493,7 +1492,7 @@ typedef struct _STA_ADMIN_CONFIG { HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode; /* For transmit phy setting in TXWI. */ DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; - RT_HT_PHY_INFO DesiredHtPhyInfo; + struct rt_ht_phy_info DesiredHtPhyInfo; BOOLEAN bAutoTxRateSwitch; #ifdef RTMP_MAC_PCI @@ -1507,7 +1506,7 @@ typedef struct _STA_ADMIN_CONFIG { BOOLEAN bAutoConnectByBssid; unsigned long BeaconLostTime; /* seconds */ BOOLEAN bForceTxBurst; /* 1: force enble TX PACKET BURST, 0: disable */ -} STA_ADMIN_CONFIG, *PSTA_ADMIN_CONFIG; +}; /* This data structure keep the current active BSS/IBSS's configuration that this STA */ /* had agreed upon joining the network. Which means these parameters are usually decided */ @@ -1515,7 +1514,7 @@ typedef struct _STA_ADMIN_CONFIG { /* is valid only when either ADHOC_ON(pAd) or INFRA_ON(pAd) is TRUE. */ /* Normally, after SCAN or failed roaming attempts, we need to recover back to */ /* the current active settings. */ -typedef struct _STA_ACTIVE_CONFIG { +struct rt_sta_active_config { u16 Aid; u16 AtimWin; /* in kusec; IBSS parameter set element */ u16 CapabilityInfo; @@ -1529,11 +1528,13 @@ typedef struct _STA_ACTIVE_CONFIG { u8 SupRateLen; u8 ExtRateLen; /* Copy supported ht from desired AP's beacon. We are trying to match */ - RT_HT_PHY_INFO SupportedPhyInfo; - RT_HT_CAPABILITY SupportedHtPhy; -} STA_ACTIVE_CONFIG, *PSTA_ACTIVE_CONFIG; + struct rt_ht_phy_info SupportedPhyInfo; + struct rt_ht_capability SupportedHtPhy; +}; -typedef struct _MAC_TABLE_ENTRY { +struct rt_mac_table_entry; + +struct rt_mac_table_entry { /*Choose 1 from ValidAsWDS and ValidAsCLI to validize. */ BOOLEAN ValidAsCLI; /* Sta mode, set this TRUE after Linkup,too. */ BOOLEAN ValidAsWDS; /* This is WDS Entry. only for AP mode. */ @@ -1555,8 +1556,8 @@ typedef struct _MAC_TABLE_ENTRY { u8 R_Counter[LEN_KEY_DESC_REPLAY]; u8 PTK[64]; u8 ReTryCounter; - RALINK_TIMER_STRUCT RetryTimer; - RALINK_TIMER_STRUCT EnqueueStartForPSKTimer; /* A timer which enqueue EAPoL-Start for triggering PSK SM */ + struct rt_ralink_timer RetryTimer; + struct rt_ralink_timer EnqueueStartForPSKTimer; /* A timer which enqueue EAPoL-Start for triggering PSK SM */ NDIS_802_11_AUTHENTICATION_MODE AuthMode; /* This should match to whatever microsoft defined */ NDIS_802_11_WEP_STATUS WepStatus; NDIS_802_11_WEP_STATUS GroupKeyWepStatus; @@ -1564,7 +1565,7 @@ typedef struct _MAC_TABLE_ENTRY { GTK_STATE GTKState; u16 PortSecured; NDIS_802_11_PRIVACY_FILTER PrivacyFilter; /* PrivacyFilter enum for 802.1X */ - CIPHER_KEY PairwiseKey; + struct rt_cipher_key PairwiseKey; void *pAd; int PMKID_CacheIdx; u8 PMKID[LEN_PMKID]; @@ -1580,7 +1581,7 @@ typedef struct _MAC_TABLE_ENTRY { unsigned long NoDataIdleCount; u16 StationKeepAliveCount; /* unit: second */ unsigned long PsQIdleCount; - QUEUE_HEADER PsQueue; + struct rt_queue_header PsQueue; u32 StaConnectTime; /* the live time of this station since associated with AP */ @@ -1642,16 +1643,16 @@ typedef struct _MAC_TABLE_ENTRY { u8 AMsduSize; u8 MmpsMode; /* MIMO power save more. */ - HT_CAPABILITY_IE HTCapability; + struct rt_ht_capability_ie HTCapability; BOOLEAN bAutoTxRateSwitch; u8 RateLen; - struct _MAC_TABLE_ENTRY *pNext; + struct rt_mac_table_entry *pNext; u16 TxSeq[NUM_OF_TID]; u16 NonQosDataSeq; - RSSI_SAMPLE RssiSample; + struct rt_rssi_sample RssiSample; u32 TXMCSExpected[16]; u32 TXMCSSuccessful[16]; @@ -1661,13 +1662,13 @@ typedef struct _MAC_TABLE_ENTRY { unsigned long LastBeaconRxTime; unsigned long AssocDeadLine; -} MAC_TABLE_ENTRY, *PMAC_TABLE_ENTRY; +}; -typedef struct _MAC_TABLE { +struct rt_mac_table { u16 Size; - MAC_TABLE_ENTRY *Hash[HASH_TABLE_SIZE]; - MAC_TABLE_ENTRY Content[MAX_LEN_OF_MAC_TABLE]; - QUEUE_HEADER McastPsQueue; + struct rt_mac_table_entry *Hash[HASH_TABLE_SIZE]; + struct rt_mac_table_entry Content[MAX_LEN_OF_MAC_TABLE]; + struct rt_queue_header McastPsQueue; unsigned long PsQIdleCount; BOOLEAN fAnyStationInPsm; BOOLEAN fAnyStationBadAtheros; /* Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip. */ @@ -1680,46 +1681,46 @@ typedef struct _MAC_TABLE { BOOLEAN fAnyBASession; /* Check if there is BA session. Force turn on RTS/CTS */ /*2008/10/28: KH add to support Antenna power-saving of AP<-- */ /*2008/10/28: KH add to support Antenna power-saving of AP--> */ -} MAC_TABLE, *PMAC_TABLE; +}; struct wificonf { BOOLEAN bShortGI; BOOLEAN bGreenField; }; -typedef struct _RTMP_DEV_INFO_ { +struct rt_rtmp_dev_info { u8 chipName[16]; RTMP_INF_TYPE infType; -} RTMP_DEV_INFO; +}; -struct _RTMP_CHIP_OP_ { +struct rt_rtmp_chip_op { /* Calibration access related callback functions */ - int (*eeinit) (RTMP_ADAPTER * pAd); /* int (*eeinit)(RTMP_ADAPTER *pAd); */ - int (*eeread) (RTMP_ADAPTER * pAd, u16 offset, u16 *pValue); /* int (*eeread)(RTMP_ADAPTER *pAd, int offset, u16 *pValue); */ + int (*eeinit) (struct rt_rtmp_adapter *pAd); /* int (*eeinit)(struct rt_rtmp_adapter *pAd); */ + int (*eeread) (struct rt_rtmp_adapter *pAd, u16 offset, u16 *pValue); /* int (*eeread)(struct rt_rtmp_adapter *pAd, int offset, u16 *pValue); */ /* MCU related callback functions */ - int (*loadFirmware) (RTMP_ADAPTER * pAd); /* int (*loadFirmware)(RTMP_ADAPTER *pAd); */ - int (*eraseFirmware) (RTMP_ADAPTER * pAd); /* int (*eraseFirmware)(RTMP_ADAPTER *pAd); */ - int (*sendCommandToMcu) (RTMP_ADAPTER * pAd, u8 cmd, u8 token, u8 arg0, u8 arg1);; /* int (*sendCommandToMcu)(RTMP_ADAPTER *pAd, u8 cmd, u8 token, u8 arg0, u8 arg1); */ + int (*loadFirmware) (struct rt_rtmp_adapter *pAd); /* int (*loadFirmware)(struct rt_rtmp_adapter *pAd); */ + int (*eraseFirmware) (struct rt_rtmp_adapter *pAd); /* int (*eraseFirmware)(struct rt_rtmp_adapter *pAd); */ + int (*sendCommandToMcu) (struct rt_rtmp_adapter *pAd, u8 cmd, u8 token, u8 arg0, u8 arg1);; /* int (*sendCommandToMcu)(struct rt_rtmp_adapter *pAd, u8 cmd, u8 token, u8 arg0, u8 arg1); */ /* RF access related callback functions */ - REG_PAIR *pRFRegTable; - void (*AsicRfInit) (RTMP_ADAPTER * pAd); - void (*AsicRfTurnOn) (RTMP_ADAPTER * pAd); - void (*AsicRfTurnOff) (RTMP_ADAPTER * pAd); - void (*AsicReverseRfFromSleepMode) (RTMP_ADAPTER * pAd); - void (*AsicHaltAction) (RTMP_ADAPTER * pAd); + struct rt_reg_pair *pRFRegTable; + void (*AsicRfInit) (struct rt_rtmp_adapter *pAd); + void (*AsicRfTurnOn) (struct rt_rtmp_adapter *pAd); + void (*AsicRfTurnOff) (struct rt_rtmp_adapter *pAd); + void (*AsicReverseRfFromSleepMode) (struct rt_rtmp_adapter *pAd); + void (*AsicHaltAction) (struct rt_rtmp_adapter *pAd); }; /* */ /* The miniport adapter structure */ /* */ -struct _RTMP_ADAPTER { +struct rt_rtmp_adapter { void *OS_Cookie; /* save specific structure relative to OS */ struct net_device *net_dev; unsigned long VirtualIfCnt; - RTMP_CHIP_OP chipOps; + struct rt_rtmp_chip_op chipOps; u16 ThisTbttNumToNextWakeUp; #ifdef RTMP_MAC_PCI @@ -1750,10 +1751,10 @@ struct _RTMP_ADAPTER { u32 int_disable_mask; u32 int_pending; - RTMP_DMABUF TxBufSpace[NUM_OF_TX_RING]; /* Shared memory of all 1st pre-allocated TxBuf associated with each TXD */ - RTMP_DMABUF RxDescRing; /* Shared memory for RX descriptors */ - RTMP_DMABUF TxDescRing[NUM_OF_TX_RING]; /* Shared memory for Tx descriptors */ - RTMP_TX_RING TxRing[NUM_OF_TX_RING]; /* AC0~4 + HCCA */ + struct rt_rtmp_dmabuf TxBufSpace[NUM_OF_TX_RING]; /* Shared memory of all 1st pre-allocated TxBuf associated with each TXD */ + struct rt_rtmp_dmabuf RxDescRing; /* Shared memory for RX descriptors */ + struct rt_rtmp_dmabuf TxDescRing[NUM_OF_TX_RING]; /* Shared memory for Tx descriptors */ + struct rt_rtmp_tx_ring TxRing[NUM_OF_TX_RING]; /* AC0~4 + HCCA */ #endif /* RTMP_MAC_PCI // */ spinlock_t irq_lock; @@ -1777,9 +1778,9 @@ struct _RTMP_ADAPTER { BOOLEAN bUsbTxBulkAggre; /* Flags for bulk out data priority */ /*======Cmd Thread */ - CmdQ CmdQ; + struct rt_cmdq CmdQ; spinlock_t CmdQLock; /* CmdQLock spinlock */ - RTMP_OS_TASK cmdQTask; + struct rt_rtmp_os_task cmdQTask; /*======Semaphores (event) */ struct semaphore UsbVendorReq_semaphore; @@ -1794,18 +1795,18 @@ struct _RTMP_ADAPTER { /*****************************************************************************************/ /* Both PCI/USB related parameters */ /*****************************************************************************************/ - /*RTMP_DEV_INFO chipInfo; */ + /*struct rt_rtmp_dev_info chipInfo; */ RTMP_INF_TYPE infType; /*****************************************************************************************/ /* Driver Mgmt related parameters */ /*****************************************************************************************/ - RTMP_OS_TASK mlmeTask; + struct rt_rtmp_os_task mlmeTask; #ifdef RTMP_TIMER_TASK_SUPPORT /* If you want use timer task to handle the timer related jobs, enable this. */ - RTMP_TIMER_TASK_QUEUE TimerQ; + struct rt_rtmp_timer_task_queue TimerQ; spinlock_t TimerQLock; - RTMP_OS_TASK timerTask; + struct rt_rtmp_os_task timerTask; #endif /* RTMP_TIMER_TASK_SUPPORT // */ /*****************************************************************************************/ @@ -1819,7 +1820,7 @@ struct _RTMP_ADAPTER { spinlock_t BulkOutLock[6]; /* BulkOut spinlock for 4 ACs */ spinlock_t MLMEBulkOutLock; /* MLME BulkOut lock */ - HT_TX_CONTEXT TxContext[NUM_OF_TX_RING]; + struct rt_ht_tx_context TxContext[NUM_OF_TX_RING]; spinlock_t TxContextQueueLock[NUM_OF_TX_RING]; /* TxContextQueue spinlock */ /* 4 sets of Bulk Out index and pending flag */ @@ -1832,11 +1833,11 @@ struct _RTMP_ADAPTER { #endif /* RTMP_MAC_USB // */ /* resource for software backlog queues */ - QUEUE_HEADER TxSwQueue[NUM_OF_TX_RING]; /* 4 AC + 1 HCCA */ + struct rt_queue_header TxSwQueue[NUM_OF_TX_RING]; /* 4 AC + 1 HCCA */ spinlock_t TxSwQueueLock[NUM_OF_TX_RING]; /* TxSwQueue spinlock */ - RTMP_DMABUF MgmtDescRing; /* Shared memory for MGMT descriptors */ - RTMP_MGMT_RING MgmtRing; + struct rt_rtmp_dmabuf MgmtDescRing; /* Shared memory for MGMT descriptors */ + struct rt_rtmp_mgmt_ring MgmtRing; spinlock_t MgmtRingLock; /* Prio Ring spinlock */ /*****************************************************************************************/ @@ -1844,14 +1845,14 @@ struct _RTMP_ADAPTER { /*****************************************************************************************/ #ifdef RTMP_MAC_PCI - RTMP_RX_RING RxRing; + struct rt_rtmp_rx_ring RxRing; spinlock_t RxRingLock; /* Rx Ring spinlock */ #ifdef RT3090 spinlock_t McuCmdLock; /*MCU Command Queue spinlock */ #endif /* RT3090 // */ #endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB - RX_CONTEXT RxContext[RX_RING_SIZE]; /* 1 for redundant multiple IRP bulk in. */ + struct rt_rx_context RxContext[RX_RING_SIZE]; /* 1 for redundant multiple IRP bulk in. */ spinlock_t BulkInLock; /* BulkIn spinlock for 4 ACs */ u8 PendingRx; /* The Maximum pending Rx value should be RX_RING_SIZE. */ u8 NextRxBulkInIndex; /* Indicate the current RxContext Index which hold by Host controller. */ @@ -1881,27 +1882,27 @@ struct _RTMP_ADAPTER { /* --------------------------- */ u8 BbpWriteLatch[140]; /* record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID */ char BbpRssiToDbmDelta; /* change from u8 to char for high power */ - BBP_R66_TUNING BbpTuning; + struct rt_bbp_r66_tuning BbpTuning; /* ---------------------------- */ /* RFIC control */ /* ---------------------------- */ u8 RfIcType; /* RFIC_xxx */ unsigned long RfFreqOffset; /* Frequency offset for channel switching */ - RTMP_RF_REGS LatchRfRegs; /* latch th latest RF programming value since RF IC doesn't support READ */ + struct rt_rtmp_rf_regs LatchRfRegs; /* latch th latest RF programming value since RF IC doesn't support READ */ EEPROM_ANTENNA_STRUC Antenna; /* Since ANtenna definition is different for a & g. We need to save it for future reference. */ EEPROM_NIC_CONFIG2_STRUC NicConfig2; /* This soft Rx Antenna Diversity mechanism is used only when user set */ /* RX Antenna = DIVERSITY ON */ - SOFT_RX_ANT_DIVERSITY RxAnt; + struct rt_soft_rx_ant_diversity RxAnt; u8 RFProgSeq; - CHANNEL_TX_POWER TxPower[MAX_NUM_OF_CHANNELS]; /* Store Tx power value for all channels. */ - CHANNEL_TX_POWER ChannelList[MAX_NUM_OF_CHANNELS]; /* list all supported channels for site survey */ - CHANNEL_11J_TX_POWER TxPower11J[MAX_NUM_OF_11JCHANNELS]; /* 802.11j channel and bw */ - CHANNEL_11J_TX_POWER ChannelList11J[MAX_NUM_OF_11JCHANNELS]; /* list all supported channels for site survey */ + struct rt_channel_tx_power TxPower[MAX_NUM_OF_CHANNELS]; /* Store Tx power value for all channels. */ + struct rt_channel_tx_power ChannelList[MAX_NUM_OF_CHANNELS]; /* list all supported channels for site survey */ + struct rt_channel_11j_tx_power TxPower11J[MAX_NUM_OF_11JCHANNELS]; /* 802.11j channel and bw */ + struct rt_channel_11j_tx_power ChannelList11J[MAX_NUM_OF_11JCHANNELS]; /* list all supported channels for site survey */ u8 ChannelListNum; /* number of channel in ChannelList[] */ u8 Bbp94; @@ -1961,19 +1962,19 @@ struct _RTMP_ADAPTER { /* 802.11 related parameters */ /*****************************************************************************************/ /* outgoing BEACON frame buffer and corresponding TXD */ - TXWI_STRUC BeaconTxWI; + struct rt_txwi BeaconTxWI; u8 *BeaconBuf; u16 BeaconOffset[HW_BEACON_MAX_COUNT]; /* pre-build PS-POLL and NULL frame upon link up. for efficiency purpose. */ - PSPOLL_FRAME PsPollFrame; - HEADER_802_11 NullFrame; + struct rt_pspoll_frame PsPollFrame; + struct rt_header_802_11 NullFrame; #ifdef RTMP_MAC_USB - TX_CONTEXT BeaconContext[BEACON_RING_SIZE]; - TX_CONTEXT NullContext; - TX_CONTEXT PsPollContext; - TX_CONTEXT RTSContext; + struct rt_tx_context BeaconContext[BEACON_RING_SIZE]; + struct rt_tx_context NullContext; + struct rt_tx_context PsPollContext; + struct rt_tx_context RTSContext; #endif /* RTMP_MAC_USB // */ /*=========AP=========== */ @@ -1983,8 +1984,8 @@ struct _RTMP_ADAPTER { /* STA specific configuration & operation status */ /* used only when pAd->OpMode == OPMODE_STA */ /* ----------------------------------------------- */ - STA_ADMIN_CONFIG StaCfg; /* user desired settings */ - STA_ACTIVE_CONFIG StaActive; /* valid only when ADHOC_ON(pAd) || INFRA_ON(pAd) */ + struct rt_sta_admin_config StaCfg; /* user desired settings */ + struct rt_sta_active_config StaActive; /* valid only when ADHOC_ON(pAd) || INFRA_ON(pAd) */ char nickname[IW_ESSID_MAX_SIZE + 1]; /* nickname, only used in the iwconfig i/f */ int PreMediaState; @@ -2004,34 +2005,34 @@ struct _RTMP_ADAPTER { /* ------------------------------------------------------ */ /* common configuration to both OPMODE_STA and OPMODE_AP */ /* ------------------------------------------------------ */ - COMMON_CONFIG CommonCfg; - MLME_STRUCT Mlme; + struct rt_common_config CommonCfg; + struct rt_mlme Mlme; /* AP needs those vaiables for site survey feature. */ - MLME_AUX MlmeAux; /* temporary settings used during MLME state machine */ - BSS_TABLE ScanTab; /* store the latest SCAN result */ + struct rt_mlme_aux MlmeAux; /* temporary settings used during MLME state machine */ + struct rt_bss_table ScanTab; /* store the latest SCAN result */ /*About MacTab, the sta driver will use #0 and #1 for multicast and AP. */ - MAC_TABLE MacTab; /* ASIC on-chip WCID entry table. At TX, ASIC always use key according to this on-chip table. */ + struct rt_mac_table MacTab; /* ASIC on-chip WCID entry table. At TX, ASIC always use key according to this on-chip table. */ spinlock_t MacTabLock; - BA_TABLE BATable; + struct rt_ba_table BATable; spinlock_t BATabLock; - RALINK_TIMER_STRUCT RECBATimer; + struct rt_ralink_timer RECBATimer; /* encryption/decryption KEY tables */ - CIPHER_KEY SharedKey[MAX_MBSSID_NUM][4]; /* STA always use SharedKey[BSS0][0..3] */ + struct rt_cipher_key SharedKey[MAX_MBSSID_NUM][4]; /* STA always use SharedKey[BSS0][0..3] */ /* RX re-assembly buffer for fragmentation */ - FRAGMENT_FRAME FragFrame; /* Frame storage for fragment frame */ + struct rt_fragment_frame FragFrame; /* Frame storage for fragment frame */ /* various Counters */ - COUNTER_802_3 Counters8023; /* 802.3 counters */ - COUNTER_802_11 WlanCounters; /* 802.11 MIB counters */ - COUNTER_RALINK RalinkCounters; /* Ralink propriety counters */ - COUNTER_DRS DrsCounters; /* counters for Dynamic TX Rate Switching */ - PRIVATE_STRUC PrivateInfo; /* Private information & counters */ + struct rt_counter_802_3 Counters8023; /* 802.3 counters */ + struct rt_counter_802_11 WlanCounters; /* 802.11 MIB counters */ + struct rt_counter_ralink RalinkCounters; /* Ralink propriety counters */ + struct rt_counter_drs DrsCounters; /* counters for Dynamic TX Rate Switching */ + struct rt_private PrivateInfo; /* Private information & counters */ /* flags, see fRTMP_ADAPTER_xxx flags */ unsigned long Flags; /* Represent current device status */ @@ -2060,7 +2061,7 @@ struct _RTMP_ADAPTER { /* --------------------------- */ /* System event log */ /* --------------------------- */ - RT_802_11_EVENT_TABLE EventTab; + struct rt_802_11_event_table EventTab; BOOLEAN HTCEnable; @@ -2165,17 +2166,16 @@ struct _RTMP_ADAPTER { /*************************************************************************** * Rx Path software control block related data structures **************************************************************************/ -typedef struct _RX_BLK_ { -/* RXD_STRUC RxD; // sample */ +struct rt_rx_blk { RT28XX_RXD_STRUC RxD; - PRXWI_STRUC pRxWI; - PHEADER_802_11 pHeader; + struct rt_rxwi * pRxWI; + struct rt_header_802_11 * pHeader; void *pRxPacket; u8 *pData; u16 DataSize; u16 Flags; u8 UserPriority; /* for calculate TKIP MIC using */ -} RX_BLK; +}; #define RX_BLK_SET_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags |= _flag) #define RX_BLK_TEST_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags & _flag) @@ -2210,16 +2210,16 @@ typedef struct _RX_BLK_ { #define TX_RALINK_FRAME 0x10 #define TX_FRAG_FRAME 0x20 -/* Currently the sizeof(TX_BLK) is 148 bytes. */ -typedef struct _TX_BLK_ { +/* Currently the sizeof(struct rt_tx_blk) is 148 bytes. */ +struct rt_tx_blk { u8 QueIdx; u8 TxFrameType; /* Indicate the Transmission type of the all frames in one batch */ u8 TotalFrameNum; /* Total frame number want to send-out in one batch */ u16 TotalFragNum; /* Total frame fragments required in one batch */ u16 TotalFrameLen; /* Total length of all frames want to send-out in one batch */ - QUEUE_HEADER TxPacketList; - MAC_TABLE_ENTRY *pMacEntry; /* NULL: packet with 802.11 RA field is multicast/broadcast address */ + struct rt_queue_header TxPacketList; + struct rt_mac_table_entry *pMacEntry; /* NULL: packet with 802.11 RA field is multicast/broadcast address */ HTTRANSMIT_SETTING *pTransmit; /* Following structure used for the characteristics of a specific packet. */ @@ -2241,13 +2241,13 @@ typedef struct _TX_BLK_ { u8 MpduReqNum; /* number of fragments of this frame */ u8 TxRate; /* TODO: Obsoleted? Should change to MCS? */ u8 CipherAlg; /* cipher alogrithm */ - PCIPHER_KEY pKey; + struct rt_cipher_key *pKey; u16 Flags; /*See following definitions for detail. */ /*YOU SHOULD NOT TOUCH IT! Following parameters are used for hardware-depended layer. */ unsigned long Priv; /* Hardware specific value saved in here. */ -} TX_BLK, *PTX_BLK; +}; #define fTX_bRtsRequired 0x0001 /* Indicate if need send RTS frame for protection. Not used in RT2860/RT2870. */ #define fTX_bAckRequired 0x0002 /* the packet need ack response */ @@ -2309,54 +2309,54 @@ char *GetBW(int BW); /* Private routines in rtmp_init.c */ /* */ int RTMPAllocAdapterBlock(void *handle, - OUT PRTMP_ADAPTER * ppAdapter); + struct rt_rtmp_adapter * * ppAdapter); -int RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd); +int RTMPAllocTxRxRingMemory(struct rt_rtmp_adapter *pAd); -void RTMPFreeAdapter(IN PRTMP_ADAPTER pAd); +void RTMPFreeAdapter(struct rt_rtmp_adapter *pAd); -int NICReadRegParameters(IN PRTMP_ADAPTER pAd, +int NICReadRegParameters(struct rt_rtmp_adapter *pAd, void *WrapperConfigurationContext); #ifdef RTMP_RF_RW_SUPPORT -void NICInitRFRegisters(IN PRTMP_ADAPTER pAd); +void NICInitRFRegisters(struct rt_rtmp_adapter *pAd); -void RtmpChipOpsRFHook(IN RTMP_ADAPTER * pAd); +void RtmpChipOpsRFHook(struct rt_rtmp_adapter *pAd); -int RT30xxWriteRFRegister(IN PRTMP_ADAPTER pAd, +int RT30xxWriteRFRegister(struct rt_rtmp_adapter *pAd, u8 regID, u8 value); -int RT30xxReadRFRegister(IN PRTMP_ADAPTER pAd, +int RT30xxReadRFRegister(struct rt_rtmp_adapter *pAd, u8 regID, u8 *pValue); #endif /* RTMP_RF_RW_SUPPORT // */ -void NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, u8 *mac_addr); +void NICReadEEPROMParameters(struct rt_rtmp_adapter *pAd, u8 *mac_addr); -void NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd); +void NICInitAsicFromEEPROM(struct rt_rtmp_adapter *pAd); -int NICInitializeAdapter(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset); +int NICInitializeAdapter(struct rt_rtmp_adapter *pAd, IN BOOLEAN bHardReset); -int NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset); +int NICInitializeAsic(struct rt_rtmp_adapter *pAd, IN BOOLEAN bHardReset); -void NICIssueReset(IN PRTMP_ADAPTER pAd); +void NICIssueReset(struct rt_rtmp_adapter *pAd); -void RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, u8 RingType); +void RTMPRingCleanUp(struct rt_rtmp_adapter *pAd, u8 RingType); -void UserCfgInit(IN PRTMP_ADAPTER pAd); +void UserCfgInit(struct rt_rtmp_adapter *pAd); -void NICResetFromError(IN PRTMP_ADAPTER pAd); +void NICResetFromError(struct rt_rtmp_adapter *pAd); -int NICLoadFirmware(IN PRTMP_ADAPTER pAd); +int NICLoadFirmware(struct rt_rtmp_adapter *pAd); -void NICEraseFirmware(IN PRTMP_ADAPTER pAd); +void NICEraseFirmware(struct rt_rtmp_adapter *pAd); -int NICLoadRateSwitchingParams(IN PRTMP_ADAPTER pAd); +int NICLoadRateSwitchingParams(struct rt_rtmp_adapter *pAd); -BOOLEAN NICCheckForHang(IN PRTMP_ADAPTER pAd); +BOOLEAN NICCheckForHang(struct rt_rtmp_adapter *pAd); -void NICUpdateFifoStaCounters(IN PRTMP_ADAPTER pAd); +void NICUpdateFifoStaCounters(struct rt_rtmp_adapter *pAd); -void NICUpdateRawCounters(IN PRTMP_ADAPTER pAd); +void NICUpdateRawCounters(struct rt_rtmp_adapter *pAd); void RTMPZeroMemory(void *pSrc, unsigned long Length); @@ -2368,154 +2368,154 @@ void AtoH(char *src, u8 *dest, int destlen); u8 BtoH(char ch); -void RTMPPatchMacBbpBug(IN PRTMP_ADAPTER pAd); +void RTMPPatchMacBbpBug(struct rt_rtmp_adapter *pAd); -void RTMPInitTimer(IN PRTMP_ADAPTER pAd, - IN PRALINK_TIMER_STRUCT pTimer, +void RTMPInitTimer(struct rt_rtmp_adapter *pAd, + struct rt_ralink_timer *pTimer, void *pTimerFunc, void *pData, IN BOOLEAN Repeat); -void RTMPSetTimer(IN PRALINK_TIMER_STRUCT pTimer, unsigned long Value); +void RTMPSetTimer(struct rt_ralink_timer *pTimer, unsigned long Value); -void RTMPModTimer(IN PRALINK_TIMER_STRUCT pTimer, unsigned long Value); +void RTMPModTimer(struct rt_ralink_timer *pTimer, unsigned long Value); -void RTMPCancelTimer(IN PRALINK_TIMER_STRUCT pTimer, OUT BOOLEAN * pCancelled); +void RTMPCancelTimer(struct rt_ralink_timer *pTimer, OUT BOOLEAN * pCancelled); -void RTMPSetLED(IN PRTMP_ADAPTER pAd, u8 Status); +void RTMPSetLED(struct rt_rtmp_adapter *pAd, u8 Status); -void RTMPSetSignalLED(IN PRTMP_ADAPTER pAd, IN NDIS_802_11_RSSI Dbm); +void RTMPSetSignalLED(struct rt_rtmp_adapter *pAd, IN NDIS_802_11_RSSI Dbm); -void RTMPEnableRxTx(IN PRTMP_ADAPTER pAd); +void RTMPEnableRxTx(struct rt_rtmp_adapter *pAd); /* */ /* prototype in action.c */ /* */ -void ActionStateMachineInit(IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE * S, +void ActionStateMachineInit(struct rt_rtmp_adapter *pAd, + struct rt_state_machine *S, OUT STATE_MACHINE_FUNC Trans[]); -void MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeADDBAAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeDELBAAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void MlmeDLSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeDLSAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void MlmeInvalidAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeInvalidAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void MlmeQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeQOSAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerAddBAReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void PeerAddBARspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerAddBARspAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void PeerDelBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerDelBAAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void PeerBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerBAAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void SendPSMPAction(IN PRTMP_ADAPTER pAd, u8 Wcid, u8 Psmp); +void SendPSMPAction(struct rt_rtmp_adapter *pAd, u8 Wcid, u8 Psmp); -void PeerRMAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerRMAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void PeerPublicAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerPublicAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerHTAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void PeerQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerQOSAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); void RECBATimerTimeout(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3); -void ORIBATimerTimeout(IN PRTMP_ADAPTER pAd); +void ORIBATimerTimeout(struct rt_rtmp_adapter *pAd); -void SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry); +void SendRefreshBAR(struct rt_rtmp_adapter *pAd, struct rt_mac_table_entry *pEntry); -void ActHeaderInit(IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, +void ActHeaderInit(struct rt_rtmp_adapter *pAd, + struct rt_header_802_11 * pHdr80211, u8 *Addr1, u8 *Addr2, u8 *Addr3); -void BarHeaderInit(IN PRTMP_ADAPTER pAd, - IN OUT PFRAME_BAR pCntlBar, u8 *pDA, u8 *pSA); +void BarHeaderInit(struct rt_rtmp_adapter *pAd, + struct rt_frame_bar * pCntlBar, u8 *pDA, u8 *pSA); -void InsertActField(IN PRTMP_ADAPTER pAd, +void InsertActField(struct rt_rtmp_adapter *pAd, u8 *pFrameBuf, unsigned long *pFrameLen, u8 Category, u8 ActCode); -BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd, +BOOLEAN CntlEnqueueForRecv(struct rt_rtmp_adapter *pAd, unsigned long Wcid, - unsigned long MsgLen, IN PFRAME_BA_REQ pMsg); + unsigned long MsgLen, struct rt_frame_ba_req * pMsg); /* */ /* Private routines in rtmp_data.c */ /* */ -BOOLEAN RTMPHandleRxDoneInterrupt(IN PRTMP_ADAPTER pAd); +BOOLEAN RTMPHandleRxDoneInterrupt(struct rt_rtmp_adapter *pAd); -BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd, +BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(struct rt_rtmp_adapter *pAd, INT_SOURCE_CSR_STRUC TxRingBitmap); -void RTMPHandleMgmtRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd); +void RTMPHandleMgmtRingDmaDoneInterrupt(struct rt_rtmp_adapter *pAd); -void RTMPHandleTBTTInterrupt(IN PRTMP_ADAPTER pAd); +void RTMPHandleTBTTInterrupt(struct rt_rtmp_adapter *pAd); -void RTMPHandlePreTBTTInterrupt(IN PRTMP_ADAPTER pAd); +void RTMPHandlePreTBTTInterrupt(struct rt_rtmp_adapter *pAd); -void RTMPHandleTwakeupInterrupt(IN PRTMP_ADAPTER pAd); +void RTMPHandleTwakeupInterrupt(struct rt_rtmp_adapter *pAd); -void RTMPHandleRxCoherentInterrupt(IN PRTMP_ADAPTER pAd); +void RTMPHandleRxCoherentInterrupt(struct rt_rtmp_adapter *pAd); -BOOLEAN TxFrameIsAggregatible(IN PRTMP_ADAPTER pAd, +BOOLEAN TxFrameIsAggregatible(struct rt_rtmp_adapter *pAd, u8 *pPrevAddr1, u8 *p8023hdr); -BOOLEAN PeerIsAggreOn(IN PRTMP_ADAPTER pAd, - unsigned long TxRate, IN PMAC_TABLE_ENTRY pMacEntry); +BOOLEAN PeerIsAggreOn(struct rt_rtmp_adapter *pAd, + unsigned long TxRate, struct rt_mac_table_entry *pMacEntry); int Sniff2BytesFromNdisBuffer(char *pFirstBuffer, u8 DesiredOffset, u8 *pByte0, u8 *pByte1); -int STASendPacket(IN PRTMP_ADAPTER pAd, void *pPacket); +int STASendPacket(struct rt_rtmp_adapter *pAd, void *pPacket); void STASendPackets(void *MiniportAdapterContext, void **ppPacketArray, u32 NumberOfPackets); -void RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd, +void RTMPDeQueuePacket(struct rt_rtmp_adapter *pAd, IN BOOLEAN bIntContext, u8 QueIdx, u8 Max_Tx_Packets); -int RTMPHardTransmit(IN PRTMP_ADAPTER pAd, +int RTMPHardTransmit(struct rt_rtmp_adapter *pAd, void *pPacket, u8 QueIdx, unsigned long *pFreeTXDLeft); -int STAHardTransmit(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, u8 QueIdx); +int STAHardTransmit(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, u8 QueIdx); -void STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, - IN RX_BLK * pRxBlk, u8 FromWhichBSSID); +void STARxEAPOLFrameIndicate(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID); -int RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, +int RTMPFreeTXDRequest(struct rt_rtmp_adapter *pAd, u8 RingType, u8 NumberRequired, u8 *FreeNumberIs); -int MlmeHardTransmit(IN PRTMP_ADAPTER pAd, +int MlmeHardTransmit(struct rt_rtmp_adapter *pAd, u8 QueIdx, void *pPacket); -int MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd, +int MlmeHardTransmitMgmtRing(struct rt_rtmp_adapter *pAd, u8 QueIdx, void *pPacket); #ifdef RTMP_MAC_PCI -int MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd, +int MlmeHardTransmitTxRing(struct rt_rtmp_adapter *pAd, u8 QueIdx, void *pPacket); -int MlmeDataHardTransmit(IN PRTMP_ADAPTER pAd, +int MlmeDataHardTransmit(struct rt_rtmp_adapter *pAd, u8 QueIdx, void *pPacket); -void RTMPWriteTxDescriptor(IN PRTMP_ADAPTER pAd, - IN PTXD_STRUC pTxD, IN BOOLEAN bWIV, u8 QSEL); +void RTMPWriteTxDescriptor(struct rt_rtmp_adapter *pAd, + struct rt_txd * pTxD, IN BOOLEAN bWIV, u8 QSEL); #endif /* RTMP_MAC_PCI // */ -u16 RTMPCalcDuration(IN PRTMP_ADAPTER pAd, u8 Rate, unsigned long Size); +u16 RTMPCalcDuration(struct rt_rtmp_adapter *pAd, u8 Rate, unsigned long Size); -void RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pTxWI, IN BOOLEAN FRAG, IN BOOLEAN CFACK, IN BOOLEAN InsTimestamp, IN BOOLEAN AMPDU, IN BOOLEAN Ack, IN BOOLEAN NSeq, /* HW new a sequence. */ +void RTMPWriteTxWI(struct rt_rtmp_adapter *pAd, struct rt_txwi * pTxWI, IN BOOLEAN FRAG, IN BOOLEAN CFACK, IN BOOLEAN InsTimestamp, IN BOOLEAN AMPDU, IN BOOLEAN Ack, IN BOOLEAN NSeq, /* HW new a sequence. */ u8 BASize, u8 WCID, unsigned long Length, @@ -2525,28 +2525,28 @@ void RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pTxWI, IN BOOLEAN FRAG, u8 Txopmode, IN BOOLEAN CfAck, IN HTTRANSMIT_SETTING * pTransmit); -void RTMPWriteTxWI_Data(IN PRTMP_ADAPTER pAd, - IN OUT PTXWI_STRUC pTxWI, IN TX_BLK * pTxBlk); +void RTMPWriteTxWI_Data(struct rt_rtmp_adapter *pAd, + struct rt_txwi * pTxWI, struct rt_tx_blk *pTxBlk); -void RTMPWriteTxWI_Cache(IN PRTMP_ADAPTER pAd, - IN OUT PTXWI_STRUC pTxWI, IN TX_BLK * pTxBlk); +void RTMPWriteTxWI_Cache(struct rt_rtmp_adapter *pAd, + struct rt_txwi * pTxWI, struct rt_tx_blk *pTxBlk); -void RTMPSuspendMsduTransmission(IN PRTMP_ADAPTER pAd); +void RTMPSuspendMsduTransmission(struct rt_rtmp_adapter *pAd); -void RTMPResumeMsduTransmission(IN PRTMP_ADAPTER pAd); +void RTMPResumeMsduTransmission(struct rt_rtmp_adapter *pAd); -int MiniportMMRequest(IN PRTMP_ADAPTER pAd, +int MiniportMMRequest(struct rt_rtmp_adapter *pAd, u8 QueIdx, u8 *pData, u32 Length); /*+++mark by shiang, now this function merge to MiniportMMRequest() */ /*---mark by shiang, now this function merge to MiniportMMRequest() */ -void RTMPSendNullFrame(IN PRTMP_ADAPTER pAd, +void RTMPSendNullFrame(struct rt_rtmp_adapter *pAd, u8 TxRate, IN BOOLEAN bQosNull); -void RTMPSendDisassociationFrame(IN PRTMP_ADAPTER pAd); +void RTMPSendDisassociationFrame(struct rt_rtmp_adapter *pAd); -void RTMPSendRTSFrame(IN PRTMP_ADAPTER pAd, +void RTMPSendRTSFrame(struct rt_rtmp_adapter *pAd, u8 *pDA, IN unsigned int NextMpduSize, u8 TxRate, @@ -2554,67 +2554,67 @@ void RTMPSendRTSFrame(IN PRTMP_ADAPTER pAd, u16 AckDuration, u8 QueIdx, u8 FrameGap); -PQUEUE_HEADER RTMPCheckTxSwQueue(IN PRTMP_ADAPTER pAd, u8 * QueIdx); +struct rt_queue_header *RTMPCheckTxSwQueue(struct rt_rtmp_adapter *pAd, u8 * QueIdx); -void RTMPReportMicError(IN PRTMP_ADAPTER pAd, IN PCIPHER_KEY pWpaKey); +void RTMPReportMicError(struct rt_rtmp_adapter *pAd, struct rt_cipher_key *pWpaKey); -void WpaMicFailureReportFrame(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void WpaMicFailureReportFrame(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); void WpaDisassocApAndBlockAssoc(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3); -void WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd); +void WpaStaPairwiseKeySetting(struct rt_rtmp_adapter *pAd); -void WpaStaGroupKeySetting(IN PRTMP_ADAPTER pAd); +void WpaStaGroupKeySetting(struct rt_rtmp_adapter *pAd); -int RTMPCloneNdisPacket(IN PRTMP_ADAPTER pAd, +int RTMPCloneNdisPacket(struct rt_rtmp_adapter *pAd, IN BOOLEAN pInsAMSDUHdr, void *pInPacket, void ** ppOutPacket); -int RTMPAllocateNdisPacket(IN PRTMP_ADAPTER pAd, +int RTMPAllocateNdisPacket(struct rt_rtmp_adapter *pAd, void ** pPacket, u8 *pHeader, u32 HeaderLen, u8 *pData, u32 DataLen); -void RTMPFreeNdisPacket(IN PRTMP_ADAPTER pAd, void *pPacket); +void RTMPFreeNdisPacket(struct rt_rtmp_adapter *pAd, void *pPacket); -BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, u8 QueIdx); +BOOLEAN RTMPFreeTXDUponTxDmaDone(struct rt_rtmp_adapter *pAd, u8 QueIdx); -BOOLEAN RTMPCheckDHCPFrame(IN PRTMP_ADAPTER pAd, void *pPacket); +BOOLEAN RTMPCheckDHCPFrame(struct rt_rtmp_adapter *pAd, void *pPacket); -BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, void *pPacket); +BOOLEAN RTMPCheckEtherType(struct rt_rtmp_adapter *pAd, void *pPacket); /* */ /* Private routines in rtmp_wep.c */ /* */ -void RTMPInitWepEngine(IN PRTMP_ADAPTER pAd, +void RTMPInitWepEngine(struct rt_rtmp_adapter *pAd, u8 *pKey, u8 KeyId, u8 KeyLen, u8 *pDest); -void RTMPEncryptData(IN PRTMP_ADAPTER pAd, +void RTMPEncryptData(struct rt_rtmp_adapter *pAd, u8 *pSrc, u8 *pDest, u32 Len); -BOOLEAN RTMPSoftDecryptWEP(IN PRTMP_ADAPTER pAd, +BOOLEAN RTMPSoftDecryptWEP(struct rt_rtmp_adapter *pAd, u8 *pData, - unsigned long DataByteCnt, IN PCIPHER_KEY pGroupKey); + unsigned long DataByteCnt, struct rt_cipher_key *pGroupKey); -void RTMPSetICV(IN PRTMP_ADAPTER pAd, u8 *pDest); +void RTMPSetICV(struct rt_rtmp_adapter *pAd, u8 *pDest); -void ARCFOUR_INIT(IN PARCFOURCONTEXT Ctx, u8 *pKey, u32 KeyLen); +void ARCFOUR_INIT(struct rt_arcfourcontext *Ctx, u8 *pKey, u32 KeyLen); -u8 ARCFOUR_BYTE(IN PARCFOURCONTEXT Ctx); +u8 ARCFOUR_BYTE(struct rt_arcfourcontext *Ctx); -void ARCFOUR_DECRYPT(IN PARCFOURCONTEXT Ctx, +void ARCFOUR_DECRYPT(struct rt_arcfourcontext *Ctx, u8 *pDest, u8 *pSrc, u32 Len); -void ARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, +void ARCFOUR_ENCRYPT(struct rt_arcfourcontext *Ctx, u8 *pDest, u8 *pSrc, u32 Len); -void WPAARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx, +void WPAARCFOUR_ENCRYPT(struct rt_arcfourcontext *Ctx, u8 *pDest, u8 *pSrc, u32 Len); u32 RTMP_CALC_FCS32(u32 Fcs, u8 *Cp, int Len); @@ -2625,130 +2625,130 @@ u32 RTMP_CALC_FCS32(u32 Fcs, u8 *Cp, int Len); /* Asic/RF/BBP related functions */ -void AsicAdjustTxPower(IN PRTMP_ADAPTER pAd); +void AsicAdjustTxPower(struct rt_rtmp_adapter *pAd); -void AsicUpdateProtect(IN PRTMP_ADAPTER pAd, +void AsicUpdateProtect(struct rt_rtmp_adapter *pAd, u16 OperaionMode, u8 SetMask, IN BOOLEAN bDisableBGProtect, IN BOOLEAN bNonGFExist); -void AsicSwitchChannel(IN PRTMP_ADAPTER pAd, +void AsicSwitchChannel(struct rt_rtmp_adapter *pAd, u8 Channel, IN BOOLEAN bScan); -void AsicLockChannel(IN PRTMP_ADAPTER pAd, u8 Channel); +void AsicLockChannel(struct rt_rtmp_adapter *pAd, u8 Channel); void AsicRfTuningExec(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3); -void AsicResetBBPAgent(IN PRTMP_ADAPTER pAd); +void AsicResetBBPAgent(struct rt_rtmp_adapter *pAd); -void AsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, +void AsicSleepThenAutoWakeup(struct rt_rtmp_adapter *pAd, u16 TbttNumToNextWakeUp); -void AsicForceSleep(IN PRTMP_ADAPTER pAd); +void AsicForceSleep(struct rt_rtmp_adapter *pAd); -void AsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx); +void AsicForceWakeup(struct rt_rtmp_adapter *pAd, IN BOOLEAN bFromTx); -void AsicSetBssid(IN PRTMP_ADAPTER pAd, u8 *pBssid); +void AsicSetBssid(struct rt_rtmp_adapter *pAd, u8 *pBssid); -void AsicSetMcastWC(IN PRTMP_ADAPTER pAd); +void AsicSetMcastWC(struct rt_rtmp_adapter *pAd); -void AsicDelWcidTab(IN PRTMP_ADAPTER pAd, u8 Wcid); +void AsicDelWcidTab(struct rt_rtmp_adapter *pAd, u8 Wcid); -void AsicEnableRDG(IN PRTMP_ADAPTER pAd); +void AsicEnableRDG(struct rt_rtmp_adapter *pAd); -void AsicDisableRDG(IN PRTMP_ADAPTER pAd); +void AsicDisableRDG(struct rt_rtmp_adapter *pAd); -void AsicDisableSync(IN PRTMP_ADAPTER pAd); +void AsicDisableSync(struct rt_rtmp_adapter *pAd); -void AsicEnableBssSync(IN PRTMP_ADAPTER pAd); +void AsicEnableBssSync(struct rt_rtmp_adapter *pAd); -void AsicEnableIbssSync(IN PRTMP_ADAPTER pAd); +void AsicEnableIbssSync(struct rt_rtmp_adapter *pAd); -void AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm); +void AsicSetEdcaParm(struct rt_rtmp_adapter *pAd, struct rt_edca_parm *pEdcaParm); -void AsicSetSlotTime(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUseShortSlotTime); +void AsicSetSlotTime(struct rt_rtmp_adapter *pAd, IN BOOLEAN bUseShortSlotTime); -void AsicAddSharedKeyEntry(IN PRTMP_ADAPTER pAd, +void AsicAddSharedKeyEntry(struct rt_rtmp_adapter *pAd, u8 BssIndex, u8 KeyIdx, u8 CipherAlg, u8 *pKey, u8 *pTxMic, u8 *pRxMic); -void AsicRemoveSharedKeyEntry(IN PRTMP_ADAPTER pAd, +void AsicRemoveSharedKeyEntry(struct rt_rtmp_adapter *pAd, u8 BssIndex, u8 KeyIdx); -void AsicUpdateWCIDAttribute(IN PRTMP_ADAPTER pAd, +void AsicUpdateWCIDAttribute(struct rt_rtmp_adapter *pAd, u16 WCID, u8 BssIndex, u8 CipherAlg, IN BOOLEAN bUsePairewiseKeyTable); -void AsicUpdateWCIDIVEIV(IN PRTMP_ADAPTER pAd, +void AsicUpdateWCIDIVEIV(struct rt_rtmp_adapter *pAd, u16 WCID, unsigned long uIV, unsigned long uEIV); -void AsicUpdateRxWCIDTable(IN PRTMP_ADAPTER pAd, +void AsicUpdateRxWCIDTable(struct rt_rtmp_adapter *pAd, u16 WCID, u8 *pAddr); -void AsicAddKeyEntry(IN PRTMP_ADAPTER pAd, +void AsicAddKeyEntry(struct rt_rtmp_adapter *pAd, u16 WCID, u8 BssIndex, u8 KeyIdx, - IN PCIPHER_KEY pCipherKey, + struct rt_cipher_key *pCipherKey, IN BOOLEAN bUsePairewiseKeyTable, IN BOOLEAN bTxKey); -void AsicAddPairwiseKeyEntry(IN PRTMP_ADAPTER pAd, +void AsicAddPairwiseKeyEntry(struct rt_rtmp_adapter *pAd, u8 *pAddr, - u8 WCID, IN CIPHER_KEY * pCipherKey); + u8 WCID, struct rt_cipher_key *pCipherKey); -void AsicRemovePairwiseKeyEntry(IN PRTMP_ADAPTER pAd, +void AsicRemovePairwiseKeyEntry(struct rt_rtmp_adapter *pAd, u8 BssIdx, u8 Wcid); -BOOLEAN AsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, +BOOLEAN AsicSendCommandToMcu(struct rt_rtmp_adapter *pAd, u8 Command, u8 Token, u8 Arg0, u8 Arg1); #ifdef RTMP_MAC_PCI -BOOLEAN AsicCheckCommanOk(IN PRTMP_ADAPTER pAd, u8 Command); +BOOLEAN AsicCheckCommanOk(struct rt_rtmp_adapter *pAd, u8 Command); #endif /* RTMP_MAC_PCI // */ -void MacAddrRandomBssid(IN PRTMP_ADAPTER pAd, u8 *pAddr); +void MacAddrRandomBssid(struct rt_rtmp_adapter *pAd, u8 *pAddr); -void MgtMacHeaderInit(IN PRTMP_ADAPTER pAd, - IN OUT PHEADER_802_11 pHdr80211, +void MgtMacHeaderInit(struct rt_rtmp_adapter *pAd, + struct rt_header_802_11 * pHdr80211, u8 SubType, u8 ToDs, u8 *pDA, u8 *pBssid); -void MlmeRadioOff(IN PRTMP_ADAPTER pAd); +void MlmeRadioOff(struct rt_rtmp_adapter *pAd); -void MlmeRadioOn(IN PRTMP_ADAPTER pAd); +void MlmeRadioOn(struct rt_rtmp_adapter *pAd); -void BssTableInit(IN BSS_TABLE * Tab); +void BssTableInit(struct rt_bss_table *Tab); -void BATableInit(IN PRTMP_ADAPTER pAd, IN BA_TABLE * Tab); +void BATableInit(struct rt_rtmp_adapter *pAd, struct rt_ba_table *Tab); -unsigned long BssTableSearch(IN BSS_TABLE * Tab, u8 *pBssid, u8 Channel); +unsigned long BssTableSearch(struct rt_bss_table *Tab, u8 *pBssid, u8 Channel); -unsigned long BssSsidTableSearch(IN BSS_TABLE * Tab, +unsigned long BssSsidTableSearch(struct rt_bss_table *Tab, u8 *pBssid, u8 *pSsid, u8 SsidLen, u8 Channel); -unsigned long BssTableSearchWithSSID(IN BSS_TABLE * Tab, +unsigned long BssTableSearchWithSSID(struct rt_bss_table *Tab, u8 *Bssid, u8 *pSsid, u8 SsidLen, u8 Channel); -unsigned long BssSsidTableSearchBySSID(IN BSS_TABLE * Tab, +unsigned long BssSsidTableSearchBySSID(struct rt_bss_table *Tab, u8 *pSsid, u8 SsidLen); -void BssTableDeleteEntry(IN OUT PBSS_TABLE pTab, +void BssTableDeleteEntry(struct rt_bss_table *pTab, u8 *pBssid, u8 Channel); -void BATableDeleteORIEntry(IN OUT PRTMP_ADAPTER pAd, - IN BA_ORI_ENTRY * pBAORIEntry); +void BATableDeleteORIEntry(struct rt_rtmp_adapter *pAd, + struct rt_ba_ori_entry *pBAORIEntry); -void BssEntrySet(IN PRTMP_ADAPTER pAd, OUT PBSS_ENTRY pBss, u8 *pBssid, char Ssid[], u8 SsidLen, u8 BssType, u16 BeaconPeriod, IN PCF_PARM CfParm, u16 AtimWin, u16 CapabilityInfo, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ +void BssEntrySet(struct rt_rtmp_adapter *pAd, struct rt_bss_entry *pBss, u8 *pBssid, char Ssid[], u8 SsidLen, u8 BssType, u16 BeaconPeriod, struct rt_cf_parm * CfParm, u16 AtimWin, u16 CapabilityInfo, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, struct rt_ht_capability_ie * pHtCapability, struct rt_add_ht_info_ie * pAddHtInfo, /* AP might use this additional ht info IE */ u8 HtCapabilityLen, u8 AddHtInfoLen, u8 NewExtChanOffset, @@ -2756,12 +2756,12 @@ void BssEntrySet(IN PRTMP_ADAPTER pAd, OUT PBSS_ENTRY pBss, u8 *pBssid, char Ssi char Rssi, IN LARGE_INTEGER TimeStamp, u8 CkipFlag, - IN PEDCA_PARM pEdcaParm, - IN PQOS_CAPABILITY_PARM pQosCapability, - IN PQBSS_LOAD_PARM pQbssLoad, - u16 LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE); + struct rt_edca_parm *pEdcaParm, + struct rt_qos_capability_parm *pQosCapability, + struct rt_qbss_load_parm *pQbssLoad, + u16 LengthVIE, struct rt_ndis_802_11_variable_ies *pVIE); -unsigned long BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT PBSS_TABLE pTab, u8 *pBssid, char Ssid[], u8 SsidLen, u8 BssType, u16 BeaconPeriod, IN CF_PARM * CfParm, u16 AtimWin, u16 CapabilityInfo, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ +unsigned long BssTableSetEntry(struct rt_rtmp_adapter *pAd, struct rt_bss_table *pTab, u8 *pBssid, char Ssid[], u8 SsidLen, u8 BssType, u16 BeaconPeriod, struct rt_cf_parm * CfParm, u16 AtimWin, u16 CapabilityInfo, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, struct rt_ht_capability_ie * pHtCapability, struct rt_add_ht_info_ie * pAddHtInfo, /* AP might use this additional ht info IE */ u8 HtCapabilityLen, u8 AddHtInfoLen, u8 NewExtChanOffset, @@ -2769,12 +2769,12 @@ unsigned long BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT PBSS_TABLE pTab, u8 *pB char Rssi, IN LARGE_INTEGER TimeStamp, u8 CkipFlag, - IN PEDCA_PARM pEdcaParm, - IN PQOS_CAPABILITY_PARM pQosCapability, - IN PQBSS_LOAD_PARM pQbssLoad, - u16 LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE); + struct rt_edca_parm *pEdcaParm, + struct rt_qos_capability_parm *pQosCapability, + struct rt_qbss_load_parm *pQbssLoad, + u16 LengthVIE, struct rt_ndis_802_11_variable_ies *pVIE); -void BATableInsertEntry(IN PRTMP_ADAPTER pAd, +void BATableInsertEntry(struct rt_rtmp_adapter *pAd, u16 Aid, u16 TimeOutValue, u16 StartingSeq, @@ -2782,22 +2782,22 @@ void BATableInsertEntry(IN PRTMP_ADAPTER pAd, u8 BAWinSize, u8 OriginatorStatus, IN BOOLEAN IsRecipient); -void BssTableSsidSort(IN PRTMP_ADAPTER pAd, - OUT BSS_TABLE * OutTab, char Ssid[], u8 SsidLen); +void BssTableSsidSort(struct rt_rtmp_adapter *pAd, + struct rt_bss_table *OutTab, char Ssid[], u8 SsidLen); -void BssTableSortByRssi(IN OUT BSS_TABLE * OutTab); +void BssTableSortByRssi(struct rt_bss_table *OutTab); -void BssCipherParse(IN OUT PBSS_ENTRY pBss); +void BssCipherParse(struct rt_bss_entry *pBss); -int MlmeQueueInit(IN MLME_QUEUE * Queue); +int MlmeQueueInit(struct rt_mlme_queue *Queue); -void MlmeQueueDestroy(IN MLME_QUEUE * Queue); +void MlmeQueueDestroy(struct rt_mlme_queue *Queue); -BOOLEAN MlmeEnqueue(IN PRTMP_ADAPTER pAd, +BOOLEAN MlmeEnqueue(struct rt_rtmp_adapter *pAd, unsigned long Machine, unsigned long MsgType, unsigned long MsgLen, void * Msg); -BOOLEAN MlmeEnqueueForRecv(IN PRTMP_ADAPTER pAd, +BOOLEAN MlmeEnqueueForRecv(struct rt_rtmp_adapter *pAd, unsigned long Wcid, unsigned long TimeStampHigh, unsigned long TimeStampLow, @@ -2806,35 +2806,35 @@ BOOLEAN MlmeEnqueueForRecv(IN PRTMP_ADAPTER pAd, u8 Rssi2, unsigned long MsgLen, void *Msg, u8 Signal); -BOOLEAN MlmeDequeue(IN MLME_QUEUE * Queue, OUT MLME_QUEUE_ELEM ** Elem); +BOOLEAN MlmeDequeue(struct rt_mlme_queue *Queue, struct rt_mlme_queue_elem ** Elem); -void MlmeRestartStateMachine(IN PRTMP_ADAPTER pAd); +void MlmeRestartStateMachine(struct rt_rtmp_adapter *pAd); -BOOLEAN MlmeQueueEmpty(IN MLME_QUEUE * Queue); +BOOLEAN MlmeQueueEmpty(struct rt_mlme_queue *Queue); -BOOLEAN MlmeQueueFull(IN MLME_QUEUE * Queue); +BOOLEAN MlmeQueueFull(struct rt_mlme_queue *Queue); -BOOLEAN MsgTypeSubst(IN PRTMP_ADAPTER pAd, - IN PFRAME_802_11 pFrame, +BOOLEAN MsgTypeSubst(struct rt_rtmp_adapter *pAd, + struct rt_frame_802_11 * pFrame, int * Machine, int * MsgType); -void StateMachineInit(IN STATE_MACHINE * Sm, +void StateMachineInit(struct rt_state_machine *Sm, IN STATE_MACHINE_FUNC Trans[], unsigned long StNr, unsigned long MsgNr, IN STATE_MACHINE_FUNC DefFunc, unsigned long InitState, unsigned long Base); -void StateMachineSetAction(IN STATE_MACHINE * S, +void StateMachineSetAction(struct rt_state_machine *S, unsigned long St, unsigned long Msg, IN STATE_MACHINE_FUNC F); -void StateMachinePerformAction(IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE * S, IN MLME_QUEUE_ELEM * Elem); +void StateMachinePerformAction(struct rt_rtmp_adapter *pAd, + struct rt_state_machine *S, struct rt_mlme_queue_elem *Elem); -void Drop(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void Drop(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void AssocStateMachineInit(IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE * Sm, +void AssocStateMachineInit(struct rt_rtmp_adapter *pAd, + struct rt_state_machine *Sm, OUT STATE_MACHINE_FUNC Trans[]); void ReassocTimeout(void *SystemSpecific1, @@ -2850,42 +2850,42 @@ void DisassocTimeout(void *SystemSpecific1, void *SystemSpecific2, void *SystemSpecific3); /*---------------------------------------------- */ -void MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeAssocReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeReassocReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void MlmeDisassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeDisassocReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void PeerAssocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerAssocRspAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void PeerReassocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerReassocRspAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void PeerDisassocAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerDisassocAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void DisassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void DisassocTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void AssocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void AssocTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void ReassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void ReassocTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void Cls3errAction(IN PRTMP_ADAPTER pAd, u8 *pAddr); +void Cls3errAction(struct rt_rtmp_adapter *pAd, u8 *pAddr); -void InvalidStateWhenAssoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void InvalidStateWhenAssoc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void InvalidStateWhenReassoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void InvalidStateWhenReassoc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void InvalidStateWhenDisassociate(IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM * Elem); +void InvalidStateWhenDisassociate(struct rt_rtmp_adapter *pAd, + struct rt_mlme_queue_elem *Elem); #ifdef RTMP_MAC_USB -void MlmeCntlConfirm(IN PRTMP_ADAPTER pAd, unsigned long MsgType, u16 Msg); +void MlmeCntlConfirm(struct rt_rtmp_adapter *pAd, unsigned long MsgType, u16 Msg); #endif /* RTMP_MAC_USB // */ -void ComposePsPoll(IN PRTMP_ADAPTER pAd); +void ComposePsPoll(struct rt_rtmp_adapter *pAd); -void ComposeNullFrame(IN PRTMP_ADAPTER pAd); +void ComposeNullFrame(struct rt_rtmp_adapter *pAd); -void AssocPostProc(IN PRTMP_ADAPTER pAd, +void AssocPostProc(struct rt_rtmp_adapter *pAd, u8 *pAddr2, u16 CapabilityInfo, u16 Aid, @@ -2893,41 +2893,41 @@ void AssocPostProc(IN PRTMP_ADAPTER pAd, u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, - IN PEDCA_PARM pEdcaParm, - IN HT_CAPABILITY_IE * pHtCapability, - u8 HtCapabilityLen, IN ADD_HT_INFO_IE * pAddHtInfo); + struct rt_edca_parm *pEdcaParm, + struct rt_ht_capability_ie * pHtCapability, + u8 HtCapabilityLen, struct rt_add_ht_info_ie * pAddHtInfo); -void AuthStateMachineInit(IN PRTMP_ADAPTER pAd, - IN PSTATE_MACHINE sm, OUT STATE_MACHINE_FUNC Trans[]); +void AuthStateMachineInit(struct rt_rtmp_adapter *pAd, + struct rt_state_machine *sm, OUT STATE_MACHINE_FUNC Trans[]); void AuthTimeout(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3); -void MlmeAuthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeAuthReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void PeerAuthRspAtSeq2Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerAuthRspAtSeq2Action(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void PeerAuthRspAtSeq4Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerAuthRspAtSeq4Action(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void AuthTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void AuthTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void Cls2errAction(IN PRTMP_ADAPTER pAd, u8 *pAddr); +void Cls2errAction(struct rt_rtmp_adapter *pAd, u8 *pAddr); -void MlmeDeauthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeDeauthReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void InvalidStateWhenAuth(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void InvalidStateWhenAuth(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); /*============================================= */ -void AuthRspStateMachineInit(IN PRTMP_ADAPTER pAd, - IN PSTATE_MACHINE Sm, +void AuthRspStateMachineInit(struct rt_rtmp_adapter *pAd, + struct rt_state_machine *Sm, IN STATE_MACHINE_FUNC Trans[]); -void PeerDeauthAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerDeauthAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void PeerAuthSimpleRspGenAndSend(IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHdr80211, +void PeerAuthSimpleRspGenAndSend(struct rt_rtmp_adapter *pAd, + struct rt_header_802_11 * pHdr80211, u16 Alg, u16 Seq, u16 Reason, u16 Status); @@ -2938,8 +2938,8 @@ void PeerAuthSimpleRspGenAndSend(IN PRTMP_ADAPTER pAd, /*======================================== */ -void SyncStateMachineInit(IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE * Sm, +void SyncStateMachineInit(struct rt_rtmp_adapter *pAd, + struct rt_state_machine *Sm, OUT STATE_MACHINE_FUNC Trans[]); void BeaconTimeout(void *SystemSpecific1, @@ -2950,116 +2950,116 @@ void ScanTimeout(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3); -void InvalidStateWhenScan(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void InvalidStateWhenScan(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void InvalidStateWhenJoin(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void InvalidStateWhenJoin(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void InvalidStateWhenStart(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void InvalidStateWhenStart(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void EnqueueProbeRequest(IN PRTMP_ADAPTER pAd); +void EnqueueProbeRequest(struct rt_rtmp_adapter *pAd); -BOOLEAN ScanRunning(IN PRTMP_ADAPTER pAd); +BOOLEAN ScanRunning(struct rt_rtmp_adapter *pAd); /*========================================= */ -void MlmeCntlInit(IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE * S, OUT STATE_MACHINE_FUNC Trans[]); +void MlmeCntlInit(struct rt_rtmp_adapter *pAd, + struct rt_state_machine *S, OUT STATE_MACHINE_FUNC Trans[]); -void MlmeCntlMachinePerformAction(IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE * S, - IN MLME_QUEUE_ELEM * Elem); +void MlmeCntlMachinePerformAction(struct rt_rtmp_adapter *pAd, + struct rt_state_machine *S, + struct rt_mlme_queue_elem *Elem); -void CntlIdleProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlIdleProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void CntlOidScanProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlOidScanProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlOidSsidProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlOidRTBssidProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void CntlMlmeRoamingProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlMlmeRoamingProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void CntlWaitDisassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlWaitDisassocProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void CntlWaitJoinProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlWaitJoinProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void CntlWaitReassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlWaitReassocProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void CntlWaitStartProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlWaitStartProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void CntlWaitAuthProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlWaitAuthProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void CntlWaitAuthProc2(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlWaitAuthProc2(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void CntlWaitAssocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void CntlWaitAssocProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void LinkUp(IN PRTMP_ADAPTER pAd, u8 BssType); +void LinkUp(struct rt_rtmp_adapter *pAd, u8 BssType); -void LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP); +void LinkDown(struct rt_rtmp_adapter *pAd, IN BOOLEAN IsReqFromAP); -void IterateOnBssTab(IN PRTMP_ADAPTER pAd); +void IterateOnBssTab(struct rt_rtmp_adapter *pAd); -void IterateOnBssTab2(IN PRTMP_ADAPTER pAd);; +void IterateOnBssTab2(struct rt_rtmp_adapter *pAd);; -void JoinParmFill(IN PRTMP_ADAPTER pAd, - IN OUT MLME_JOIN_REQ_STRUCT * JoinReq, unsigned long BssIdx); +void JoinParmFill(struct rt_rtmp_adapter *pAd, + struct rt_mlme_join_req *JoinReq, unsigned long BssIdx); -void AssocParmFill(IN PRTMP_ADAPTER pAd, - IN OUT MLME_ASSOC_REQ_STRUCT * AssocReq, +void AssocParmFill(struct rt_rtmp_adapter *pAd, + struct rt_mlme_assoc_req *AssocReq, u8 *pAddr, u16 CapabilityInfo, unsigned long Timeout, u16 ListenIntv); -void ScanParmFill(IN PRTMP_ADAPTER pAd, - IN OUT MLME_SCAN_REQ_STRUCT * ScanReq, +void ScanParmFill(struct rt_rtmp_adapter *pAd, + struct rt_mlme_scan_req *ScanReq, char Ssid[], u8 SsidLen, u8 BssType, u8 ScanType); -void DisassocParmFill(IN PRTMP_ADAPTER pAd, - IN OUT MLME_DISASSOC_REQ_STRUCT * DisassocReq, +void DisassocParmFill(struct rt_rtmp_adapter *pAd, + struct rt_mlme_disassoc_req *DisassocReq, u8 *pAddr, u16 Reason); -void StartParmFill(IN PRTMP_ADAPTER pAd, - IN OUT MLME_START_REQ_STRUCT * StartReq, +void StartParmFill(struct rt_rtmp_adapter *pAd, + struct rt_mlme_start_req *StartReq, char Ssid[], u8 SsidLen); -void AuthParmFill(IN PRTMP_ADAPTER pAd, - IN OUT MLME_AUTH_REQ_STRUCT * AuthReq, +void AuthParmFill(struct rt_rtmp_adapter *pAd, + struct rt_mlme_auth_req *AuthReq, u8 *pAddr, u16 Alg); -void EnqueuePsPoll(IN PRTMP_ADAPTER pAd); +void EnqueuePsPoll(struct rt_rtmp_adapter *pAd); -void EnqueueBeaconFrame(IN PRTMP_ADAPTER pAd); +void EnqueueBeaconFrame(struct rt_rtmp_adapter *pAd); -void MlmeJoinReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeJoinReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void MlmeScanReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeScanReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void MlmeStartReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void MlmeStartReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void ScanTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void ScanTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void BeaconTimeoutAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void BeaconTimeoutAtJoinAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void PeerBeaconAtScanAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerBeaconAtScanAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerBeaconAtJoinAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerBeacon(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void PeerProbeReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerProbeReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); -void ScanNextChannel(IN PRTMP_ADAPTER pAd); +void ScanNextChannel(struct rt_rtmp_adapter *pAd); -unsigned long MakeIbssBeacon(IN PRTMP_ADAPTER pAd); +unsigned long MakeIbssBeacon(struct rt_rtmp_adapter *pAd); -BOOLEAN MlmeScanReqSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN MlmeScanReqSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, u8 * BssType, char ssid[], u8 * SsidLen, u8 * ScanType); -BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN PeerBeaconAndProbeRspSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, u8 MsgChannel, @@ -3072,7 +3072,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, u8 * pChannel, u8 * pNewChannel, OUT LARGE_INTEGER * pTimestamp, - OUT CF_PARM * pCfParm, + struct rt_cf_parm * pCfParm, u16 * pAtimWin, u16 * pCapabilityInfo, u8 * pErp, @@ -3086,48 +3086,48 @@ BOOLEAN PeerBeaconAndProbeRspSanity(IN PRTMP_ADAPTER pAd, u8 * pExtRateLen, u8 * pCkipFlag, u8 * pAironetCellPowerLimit, - OUT PEDCA_PARM pEdcaParm, - OUT PQBSS_LOAD_PARM pQbssLoad, - OUT PQOS_CAPABILITY_PARM pQosCapability, + struct rt_edca_parm *pEdcaParm, + struct rt_qbss_load_parm *pQbssLoad, + struct rt_qos_capability_parm *pQosCapability, unsigned long * pRalinkIe, u8 * pHtCapabilityLen, u8 * pPreNHtCapabilityLen, - OUT HT_CAPABILITY_IE * pHtCapability, + struct rt_ht_capability_ie * pHtCapability, u8 * AddHtInfoLen, - OUT ADD_HT_INFO_IE * AddHtInfo, + struct rt_add_ht_info_ie * AddHtInfo, u8 * NewExtChannel, u16 * LengthVIE, - OUT PNDIS_802_11_VARIABLE_IEs pVIE); + struct rt_ndis_802_11_variable_ies *pVIE); -BOOLEAN PeerAddBAReqActionSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN PeerAddBAReqActionSanity(struct rt_rtmp_adapter *pAd, void * pMsg, unsigned long MsgLen, u8 *pAddr2); -BOOLEAN PeerAddBARspActionSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN PeerAddBARspActionSanity(struct rt_rtmp_adapter *pAd, void * pMsg, unsigned long MsgLen); -BOOLEAN PeerDelBAActionSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN PeerDelBAActionSanity(struct rt_rtmp_adapter *pAd, u8 Wcid, void * pMsg, unsigned long MsgLen); -BOOLEAN MlmeAssocReqSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN MlmeAssocReqSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, u8 *pApAddr, u16 * CapabilityInfo, unsigned long * Timeout, u16 * ListenIntv); -BOOLEAN MlmeAuthReqSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN MlmeAuthReqSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, u8 *pAddr, unsigned long * Timeout, u16 * Alg); -BOOLEAN MlmeStartReqSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN MlmeStartReqSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, char Ssid[], u8 * Ssidlen); -BOOLEAN PeerAuthSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN PeerAuthSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, u8 *pAddr, @@ -3135,28 +3135,28 @@ BOOLEAN PeerAuthSanity(IN PRTMP_ADAPTER pAd, u16 * Seq, u16 * Status, char ChlgText[]); -BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, void * pMsg, unsigned long MsgLen, u8 *pAddr2, u16 * pCapabilityInfo, u16 * pStatus, u16 * pAid, u8 SupRate[], u8 * pSupRateLen, u8 ExtRate[], u8 * pExtRateLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ +BOOLEAN PeerAssocRspSanity(struct rt_rtmp_adapter *pAd, void * pMsg, unsigned long MsgLen, u8 *pAddr2, u16 * pCapabilityInfo, u16 * pStatus, u16 * pAid, u8 SupRate[], u8 * pSupRateLen, u8 ExtRate[], u8 * pExtRateLen, struct rt_ht_capability_ie * pHtCapability, struct rt_add_ht_info_ie * pAddHtInfo, /* AP might use this additional ht info IE */ u8 * pHtCapabilityLen, u8 * pAddHtInfoLen, u8 * pNewExtChannelOffset, - OUT PEDCA_PARM pEdcaParm, u8 * pCkipFlag); + struct rt_edca_parm *pEdcaParm, u8 * pCkipFlag); -BOOLEAN PeerDisassocSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN PeerDisassocSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, u8 *pAddr2, u16 * Reason); -BOOLEAN PeerWpaMessageSanity(IN PRTMP_ADAPTER pAd, - IN PEAPOL_PACKET pMsg, +BOOLEAN PeerWpaMessageSanity(struct rt_rtmp_adapter *pAd, + struct rt_eapol_packet * pMsg, unsigned long MsgLen, - u8 MsgType, IN MAC_TABLE_ENTRY * pEntry); + u8 MsgType, struct rt_mac_table_entry *pEntry); -BOOLEAN PeerDeauthSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN PeerDeauthSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, u8 *pAddr2, u16 * Reason); -BOOLEAN PeerProbeReqSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN PeerProbeReqSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, u8 *pAddr2, @@ -3169,23 +3169,23 @@ BOOLEAN GetTimBit(char * Ptr, u8 * DtimCount, u8 * DtimPeriod, u8 * MessageToMe); -u8 ChannelSanity(IN PRTMP_ADAPTER pAd, u8 channel); +u8 ChannelSanity(struct rt_rtmp_adapter *pAd, u8 channel); -NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity(IN PBSS_ENTRY pBss); +NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity(struct rt_bss_entry *pBss); -BOOLEAN MlmeDelBAReqSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN MlmeDelBAReqSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen); -BOOLEAN MlmeAddBAReqSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN MlmeAddBAReqSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, u8 *pAddr2); unsigned long MakeOutgoingFrame(u8 * Buffer, unsigned long * Length, ...); -void LfsrInit(IN PRTMP_ADAPTER pAd, unsigned long Seed); +void LfsrInit(struct rt_rtmp_adapter *pAd, unsigned long Seed); -u8 RandomByte(IN PRTMP_ADAPTER pAd); +u8 RandomByte(struct rt_rtmp_adapter *pAd); -void AsicUpdateAutoFallBackTable(IN PRTMP_ADAPTER pAd, u8 *pTxRate); +void AsicUpdateAutoFallBackTable(struct rt_rtmp_adapter *pAd, u8 *pTxRate); void MlmePeriodicExec(void *SystemSpecific1, void *FunctionContext, @@ -3195,109 +3195,109 @@ void LinkDownExec(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3); -void STAMlmePeriodicExec(PRTMP_ADAPTER pAd); +void STAMlmePeriodicExec(struct rt_rtmp_adapter *pAd); -void MlmeAutoScan(IN PRTMP_ADAPTER pAd); +void MlmeAutoScan(struct rt_rtmp_adapter *pAd); -void MlmeAutoReconnectLastSSID(IN PRTMP_ADAPTER pAd); +void MlmeAutoReconnectLastSSID(struct rt_rtmp_adapter *pAd); BOOLEAN MlmeValidateSSID(u8 *pSsid, u8 SsidLen); -void MlmeCheckForRoaming(IN PRTMP_ADAPTER pAd, unsigned long Now32); +void MlmeCheckForRoaming(struct rt_rtmp_adapter *pAd, unsigned long Now32); -BOOLEAN MlmeCheckForFastRoaming(IN PRTMP_ADAPTER pAd); +BOOLEAN MlmeCheckForFastRoaming(struct rt_rtmp_adapter *pAd); -void MlmeDynamicTxRateSwitching(IN PRTMP_ADAPTER pAd); +void MlmeDynamicTxRateSwitching(struct rt_rtmp_adapter *pAd); -void MlmeSetTxRate(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, IN PRTMP_TX_RATE_SWITCH pTxRate); +void MlmeSetTxRate(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, struct rt_rtmp_tx_rate_switch * pTxRate); -void MlmeSelectTxRateTable(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, +void MlmeSelectTxRateTable(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, u8 ** ppTable, u8 *pTableSize, u8 *pInitTxRateIdx); -void MlmeCalculateChannelQuality(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pMacEntry, unsigned long Now); +void MlmeCalculateChannelQuality(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pMacEntry, unsigned long Now); -void MlmeCheckPsmChange(IN PRTMP_ADAPTER pAd, unsigned long Now32); +void MlmeCheckPsmChange(struct rt_rtmp_adapter *pAd, unsigned long Now32); -void MlmeSetPsmBit(IN PRTMP_ADAPTER pAd, u16 psm); +void MlmeSetPsmBit(struct rt_rtmp_adapter *pAd, u16 psm); -void MlmeSetTxPreamble(IN PRTMP_ADAPTER pAd, u16 TxPreamble); +void MlmeSetTxPreamble(struct rt_rtmp_adapter *pAd, u16 TxPreamble); -void UpdateBasicRateBitmap(IN PRTMP_ADAPTER pAd); +void UpdateBasicRateBitmap(struct rt_rtmp_adapter *pAd); -void MlmeUpdateTxRates(IN PRTMP_ADAPTER pAd, +void MlmeUpdateTxRates(struct rt_rtmp_adapter *pAd, IN BOOLEAN bLinkUp, u8 apidx); -void MlmeUpdateHtTxRates(IN PRTMP_ADAPTER pAd, u8 apidx); +void MlmeUpdateHtTxRates(struct rt_rtmp_adapter *pAd, u8 apidx); -void RTMPCheckRates(IN PRTMP_ADAPTER pAd, +void RTMPCheckRates(struct rt_rtmp_adapter *pAd, IN u8 SupRate[], IN u8 * SupRateLen); -BOOLEAN RTMPCheckChannel(IN PRTMP_ADAPTER pAd, +BOOLEAN RTMPCheckChannel(struct rt_rtmp_adapter *pAd, u8 CentralChannel, u8 Channel); -BOOLEAN RTMPCheckHt(IN PRTMP_ADAPTER pAd, +BOOLEAN RTMPCheckHt(struct rt_rtmp_adapter *pAd, u8 Wcid, - IN OUT HT_CAPABILITY_IE * pHtCapability, - IN OUT ADD_HT_INFO_IE * pAddHtInfo); + struct rt_ht_capability_ie * pHtCapability, + struct rt_add_ht_info_ie * pAddHtInfo); void StaQuickResponeForRateUpExec(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3); -void RTMPUpdateMlmeRate(IN PRTMP_ADAPTER pAd); +void RTMPUpdateMlmeRate(struct rt_rtmp_adapter *pAd); -char RTMPMaxRssi(IN PRTMP_ADAPTER pAd, +char RTMPMaxRssi(struct rt_rtmp_adapter *pAd, char Rssi0, char Rssi1, char Rssi2); #ifdef RT30xx -void AsicSetRxAnt(IN PRTMP_ADAPTER pAd, u8 Ant); +void AsicSetRxAnt(struct rt_rtmp_adapter *pAd, u8 Ant); -void RTMPFilterCalibration(IN PRTMP_ADAPTER pAd); +void RTMPFilterCalibration(struct rt_rtmp_adapter *pAd); #ifdef RTMP_EFUSE_SUPPORT /*2008/09/11:KH add to support efuse<-- */ -int set_eFuseGetFreeBlockCount_Proc(IN PRTMP_ADAPTER pAd, char *arg); +int set_eFuseGetFreeBlockCount_Proc(struct rt_rtmp_adapter *pAd, char *arg); -int set_eFusedump_Proc(IN PRTMP_ADAPTER pAd, char *arg); +int set_eFusedump_Proc(struct rt_rtmp_adapter *pAd, char *arg); -void eFusePhysicalReadRegisters(IN PRTMP_ADAPTER pAd, +void eFusePhysicalReadRegisters(struct rt_rtmp_adapter *pAd, u16 Offset, u16 Length, u16 * pData); -int RtmpEfuseSupportCheck(IN RTMP_ADAPTER * pAd); +int RtmpEfuseSupportCheck(struct rt_rtmp_adapter *pAd); -void eFuseGetFreeBlockCount(IN PRTMP_ADAPTER pAd, u32 *EfuseFreeBlock); +void eFuseGetFreeBlockCount(struct rt_rtmp_adapter *pAd, u32 *EfuseFreeBlock); -int eFuse_init(IN PRTMP_ADAPTER pAd); +int eFuse_init(struct rt_rtmp_adapter *pAd); /*2008/09/11:KH add to support efuse--> */ #endif /* RTMP_EFUSE_SUPPORT // */ /* add by johnli, RF power sequence setup */ -void RT30xxLoadRFNormalModeSetup(IN PRTMP_ADAPTER pAd); +void RT30xxLoadRFNormalModeSetup(struct rt_rtmp_adapter *pAd); -void RT30xxLoadRFSleepModeSetup(IN PRTMP_ADAPTER pAd); +void RT30xxLoadRFSleepModeSetup(struct rt_rtmp_adapter *pAd); -void RT30xxReverseRFSleepModeSetup(IN PRTMP_ADAPTER pAd); +void RT30xxReverseRFSleepModeSetup(struct rt_rtmp_adapter *pAd); /* end johnli */ #ifdef RT3070 -void NICInitRT3070RFRegisters(IN RTMP_ADAPTER * pAd); +void NICInitRT3070RFRegisters(struct rt_rtmp_adapter *pAd); #endif /* RT3070 // */ #ifdef RT3090 -void NICInitRT3090RFRegisters(IN RTMP_ADAPTER * pAd); +void NICInitRT3090RFRegisters(struct rt_rtmp_adapter *pAd); #endif /* RT3090 // */ -void RT30xxHaltAction(IN PRTMP_ADAPTER pAd); +void RT30xxHaltAction(struct rt_rtmp_adapter *pAd); -void RT30xxSetRxAnt(IN PRTMP_ADAPTER pAd, u8 Ant); +void RT30xxSetRxAnt(struct rt_rtmp_adapter *pAd, u8 Ant); #endif /* RT30xx // */ -void AsicEvaluateRxAnt(IN PRTMP_ADAPTER pAd); +void AsicEvaluateRxAnt(struct rt_rtmp_adapter *pAd); void AsicRxAntEvalTimeout(void *SystemSpecific1, void *FunctionContext, @@ -3307,88 +3307,88 @@ void APSDPeriodicExec(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3); -BOOLEAN RTMPCheckEntryEnableAutoRateSwitch(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry); +BOOLEAN RTMPCheckEntryEnableAutoRateSwitch(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry); -u8 RTMPStaFixedTxMode(IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry); +u8 RTMPStaFixedTxMode(struct rt_rtmp_adapter *pAd, struct rt_mac_table_entry *pEntry); -void RTMPUpdateLegacyTxSetting(u8 fixed_tx_mode, PMAC_TABLE_ENTRY pEntry); +void RTMPUpdateLegacyTxSetting(u8 fixed_tx_mode, struct rt_mac_table_entry *pEntry); -BOOLEAN RTMPAutoRateSwitchCheck(IN PRTMP_ADAPTER pAd); +BOOLEAN RTMPAutoRateSwitchCheck(struct rt_rtmp_adapter *pAd); -int MlmeInit(IN PRTMP_ADAPTER pAd); +int MlmeInit(struct rt_rtmp_adapter *pAd); -void MlmeHandler(IN PRTMP_ADAPTER pAd); +void MlmeHandler(struct rt_rtmp_adapter *pAd); -void MlmeHalt(IN PRTMP_ADAPTER pAd); +void MlmeHalt(struct rt_rtmp_adapter *pAd); -void MlmeResetRalinkCounters(IN PRTMP_ADAPTER pAd); +void MlmeResetRalinkCounters(struct rt_rtmp_adapter *pAd); -void BuildChannelList(IN PRTMP_ADAPTER pAd); +void BuildChannelList(struct rt_rtmp_adapter *pAd); -u8 FirstChannel(IN PRTMP_ADAPTER pAd); +u8 FirstChannel(struct rt_rtmp_adapter *pAd); -u8 NextChannel(IN PRTMP_ADAPTER pAd, u8 channel); +u8 NextChannel(struct rt_rtmp_adapter *pAd, u8 channel); -void ChangeToCellPowerLimit(IN PRTMP_ADAPTER pAd, +void ChangeToCellPowerLimit(struct rt_rtmp_adapter *pAd, u8 AironetCellPowerLimit); /* */ /* Prototypes of function definition in rtmp_tkip.c */ /* */ -void RTMPInitTkipEngine(IN PRTMP_ADAPTER pAd, +void RTMPInitTkipEngine(struct rt_rtmp_adapter *pAd, u8 *pTKey, u8 KeyId, u8 *pTA, u8 *pMICKey, u8 *pTSC, unsigned long *pIV16, unsigned long *pIV32); -void RTMPInitMICEngine(IN PRTMP_ADAPTER pAd, +void RTMPInitMICEngine(struct rt_rtmp_adapter *pAd, u8 *pKey, u8 *pDA, u8 *pSA, u8 UserPriority, u8 *pMICKey); -BOOLEAN RTMPTkipCompareMICValue(IN PRTMP_ADAPTER pAd, +BOOLEAN RTMPTkipCompareMICValue(struct rt_rtmp_adapter *pAd, u8 *pSrc, u8 *pDA, u8 *pSA, u8 *pMICKey, u8 UserPriority, u32 Len); -void RTMPCalculateMICValue(IN PRTMP_ADAPTER pAd, +void RTMPCalculateMICValue(struct rt_rtmp_adapter *pAd, void *pPacket, u8 *pEncap, - IN PCIPHER_KEY pKey, u8 apidx); + struct rt_cipher_key *pKey, u8 apidx); -void RTMPTkipAppendByte(IN PTKIP_KEY_INFO pTkip, u8 uChar); +void RTMPTkipAppendByte(struct rt_tkip_key_info *pTkip, u8 uChar); -void RTMPTkipAppend(IN PTKIP_KEY_INFO pTkip, u8 *pSrc, u32 nBytes); +void RTMPTkipAppend(struct rt_tkip_key_info *pTkip, u8 *pSrc, u32 nBytes); -void RTMPTkipGetMIC(IN PTKIP_KEY_INFO pTkip); +void RTMPTkipGetMIC(struct rt_tkip_key_info *pTkip); -BOOLEAN RTMPSoftDecryptTKIP(IN PRTMP_ADAPTER pAd, +BOOLEAN RTMPSoftDecryptTKIP(struct rt_rtmp_adapter *pAd, u8 *pData, unsigned long DataByteCnt, - u8 UserPriority, IN PCIPHER_KEY pWpaKey); + u8 UserPriority, struct rt_cipher_key *pWpaKey); -BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, +BOOLEAN RTMPSoftDecryptAES(struct rt_rtmp_adapter *pAd, u8 *pData, - unsigned long DataByteCnt, IN PCIPHER_KEY pWpaKey); + unsigned long DataByteCnt, struct rt_cipher_key *pWpaKey); /* */ /* Prototypes of function definition in cmm_info.c */ /* */ -int RT_CfgSetCountryRegion(IN PRTMP_ADAPTER pAd, char *arg, int band); +int RT_CfgSetCountryRegion(struct rt_rtmp_adapter *pAd, char *arg, int band); -int RT_CfgSetWirelessMode(IN PRTMP_ADAPTER pAd, char *arg); +int RT_CfgSetWirelessMode(struct rt_rtmp_adapter *pAd, char *arg); -int RT_CfgSetShortSlot(IN PRTMP_ADAPTER pAd, char *arg); +int RT_CfgSetShortSlot(struct rt_rtmp_adapter *pAd, char *arg); -int RT_CfgSetWepKey(IN PRTMP_ADAPTER pAd, +int RT_CfgSetWepKey(struct rt_rtmp_adapter *pAd, char *keyString, - IN CIPHER_KEY * pSharedKey, int keyIdx); + struct rt_cipher_key *pSharedKey, int keyIdx); -int RT_CfgSetWPAPSKKey(IN RTMP_ADAPTER * pAd, +int RT_CfgSetWPAPSKKey(struct rt_rtmp_adapter *pAd, char *keyString, u8 * pHashStr, int hashStrLen, u8 *pPMKBuf); @@ -3396,55 +3396,55 @@ int RT_CfgSetWPAPSKKey(IN RTMP_ADAPTER * pAd, /* */ /* Prototypes of function definition in cmm_info.c */ /* */ -void RTMPWPARemoveAllKeys(IN PRTMP_ADAPTER pAd); +void RTMPWPARemoveAllKeys(struct rt_rtmp_adapter *pAd); -void RTMPSetPhyMode(IN PRTMP_ADAPTER pAd, unsigned long phymode); +void RTMPSetPhyMode(struct rt_rtmp_adapter *pAd, unsigned long phymode); -void RTMPUpdateHTIE(IN RT_HT_CAPABILITY * pRtHt, +void RTMPUpdateHTIE(struct rt_ht_capability *pRtHt, u8 * pMcsSet, - OUT HT_CAPABILITY_IE * pHtCapability, - OUT ADD_HT_INFO_IE * pAddHtInfo); + struct rt_ht_capability_ie * pHtCapability, + struct rt_add_ht_info_ie * pAddHtInfo); -void RTMPAddWcidAttributeEntry(IN PRTMP_ADAPTER pAd, +void RTMPAddWcidAttributeEntry(struct rt_rtmp_adapter *pAd, u8 BssIdx, u8 KeyIdx, - u8 CipherAlg, IN MAC_TABLE_ENTRY * pEntry); + u8 CipherAlg, struct rt_mac_table_entry *pEntry); char *GetEncryptType(char enc); char *GetAuthMode(char auth); -void RTMPSetHT(IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE * pHTPhyMode); +void RTMPSetHT(struct rt_rtmp_adapter *pAd, struct rt_oid_set_ht_phymode *pHTPhyMode); -void RTMPSetIndividualHT(IN PRTMP_ADAPTER pAd, u8 apidx); +void RTMPSetIndividualHT(struct rt_rtmp_adapter *pAd, u8 apidx); -void RTMPSendWirelessEvent(IN PRTMP_ADAPTER pAd, +void RTMPSendWirelessEvent(struct rt_rtmp_adapter *pAd, u16 Event_flag, u8 *pAddr, u8 BssIdx, char Rssi); -char ConvertToRssi(IN PRTMP_ADAPTER pAd, char Rssi, u8 RssiNumber); +char ConvertToRssi(struct rt_rtmp_adapter *pAd, char Rssi, u8 RssiNumber); /*=================================== Function prototype in cmm_wpa.c =================================== */ -void RTMPToWirelessSta(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, +void RTMPToWirelessSta(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, u8 *pHeader802_3, u32 HdrLen, u8 *pData, u32 DataLen, IN BOOLEAN bClearFrame); -void WpaDerivePTK(IN PRTMP_ADAPTER pAd, +void WpaDerivePTK(struct rt_rtmp_adapter *pAd, u8 * PMK, u8 * ANonce, u8 * AA, u8 * SNonce, u8 * SA, u8 * output, u32 len); -void GenRandom(IN PRTMP_ADAPTER pAd, u8 * macAddr, u8 * random); +void GenRandom(struct rt_rtmp_adapter *pAd, u8 * macAddr, u8 * random); -BOOLEAN RTMPCheckWPAframe(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, +BOOLEAN RTMPCheckWPAframe(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, u8 *pData, unsigned long DataByteCount, u8 FromWhichBSSID); @@ -3452,14 +3452,14 @@ void AES_GTK_KEY_UNWRAP(u8 * key, u8 * plaintext, u32 c_len, u8 * ciphertext); -BOOLEAN RTMPParseEapolKeyData(IN PRTMP_ADAPTER pAd, +BOOLEAN RTMPParseEapolKeyData(struct rt_rtmp_adapter *pAd, u8 *pKeyData, u8 KeyDataLen, u8 GroupKeyIndex, u8 MsgType, - IN BOOLEAN bWPA2, IN MAC_TABLE_ENTRY * pEntry); + IN BOOLEAN bWPA2, struct rt_mac_table_entry *pEntry); -void ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, +void ConstructEapolMsg(struct rt_mac_table_entry *pEntry, u8 GroupKeyWepStatus, u8 MsgType, u8 DefaultKeyIdx, @@ -3467,53 +3467,53 @@ void ConstructEapolMsg(IN PMAC_TABLE_ENTRY pEntry, u8 * TxRSC, u8 * GTK, u8 * RSNIE, - u8 RSNIE_Len, OUT PEAPOL_PACKET pMsg); + u8 RSNIE_Len, struct rt_eapol_packet * pMsg); -int RTMPSoftDecryptBroadCastData(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, +int RTMPSoftDecryptBroadCastData(struct rt_rtmp_adapter *pAd, + struct rt_rx_blk *pRxBlk, IN NDIS_802_11_ENCRYPTION_STATUS GroupCipher, - IN PCIPHER_KEY pShard_key); + struct rt_cipher_key *pShard_key); -void RTMPMakeRSNIE(IN PRTMP_ADAPTER pAd, +void RTMPMakeRSNIE(struct rt_rtmp_adapter *pAd, u32 AuthMode, u32 WepStatus, u8 apidx); /* */ /* function prototype in ap_wpa.c */ /* */ -void RTMPGetTxTscFromAsic(IN PRTMP_ADAPTER pAd, +void RTMPGetTxTscFromAsic(struct rt_rtmp_adapter *pAd, u8 apidx, u8 *pTxTsc); -void APInstallPairwiseKey(PRTMP_ADAPTER pAd, PMAC_TABLE_ENTRY pEntry); +void APInstallPairwiseKey(struct rt_rtmp_adapter *pAd, struct rt_mac_table_entry *pEntry); -u32 APValidateRSNIE(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, +u32 APValidateRSNIE(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, u8 *pRsnIe, u8 rsnie_len); -void HandleCounterMeasure(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry); +void HandleCounterMeasure(struct rt_rtmp_adapter *pAd, struct rt_mac_table_entry *pEntry); -void WPAStart4WayHS(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, unsigned long TimeInterval); +void WPAStart4WayHS(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, unsigned long TimeInterval); -void WPAStart2WayGroupHS(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry); +void WPAStart2WayGroupHS(struct rt_rtmp_adapter *pAd, struct rt_mac_table_entry *pEntry); -void PeerPairMsg1Action(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem); +void PeerPairMsg1Action(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem); -void PeerPairMsg2Action(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem); +void PeerPairMsg2Action(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem); -void PeerPairMsg3Action(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem); +void PeerPairMsg3Action(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem); -void PeerPairMsg4Action(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, IN MLME_QUEUE_ELEM * Elem); +void PeerPairMsg4Action(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem); -void PeerGroupMsg1Action(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, IN MLME_QUEUE_ELEM * Elem); +void PeerGroupMsg1Action(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, struct rt_mlme_queue_elem *Elem); -void PeerGroupMsg2Action(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, +void PeerGroupMsg2Action(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, void * Msg, u32 MsgLen); void WpaDeriveGTK(u8 * PMK, @@ -3530,7 +3530,7 @@ void AES_GTK_KEY_WRAP(u8 * key, void RTMP_SetPeriodicTimer(struct timer_list * pTimer, IN unsigned long timeout); -void RTMP_OS_Init_Timer(IN PRTMP_ADAPTER pAd, +void RTMP_OS_Init_Timer(struct rt_rtmp_adapter *pAd, struct timer_list * pTimer, IN TIMER_FUNCTION function, void *data); @@ -3543,171 +3543,171 @@ void RTMP_OS_Mod_Timer(struct timer_list * pTimer, void RTMP_OS_Del_Timer(struct timer_list * pTimer, OUT BOOLEAN * pCancelled); -void RTMP_OS_Release_Packet(IN PRTMP_ADAPTER pAd, IN PQUEUE_ENTRY pEntry); +void RTMP_OS_Release_Packet(struct rt_rtmp_adapter *pAd, struct rt_queue_entry *pEntry); void RTMPusecDelay(unsigned long usec); -int os_alloc_mem(IN RTMP_ADAPTER * pAd, +int os_alloc_mem(struct rt_rtmp_adapter *pAd, u8 ** mem, unsigned long size); -int os_free_mem(IN PRTMP_ADAPTER pAd, void *mem); +int os_free_mem(struct rt_rtmp_adapter *pAd, void *mem); -void RTMP_AllocateSharedMemory(IN PRTMP_ADAPTER pAd, +void RTMP_AllocateSharedMemory(struct rt_rtmp_adapter *pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, dma_addr_t *PhysicalAddress); -void RTMPFreeTxRxRingMemory(IN PRTMP_ADAPTER pAd); +void RTMPFreeTxRxRingMemory(struct rt_rtmp_adapter *pAd); int AdapterBlockAllocateMemory(void *handle, void ** ppAd); -void RTMP_AllocateTxDescMemory(IN PRTMP_ADAPTER pAd, +void RTMP_AllocateTxDescMemory(struct rt_rtmp_adapter *pAd, u32 Index, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, dma_addr_t *PhysicalAddress); -void RTMP_AllocateFirstTxBuffer(IN PRTMP_ADAPTER pAd, +void RTMP_AllocateFirstTxBuffer(struct rt_rtmp_adapter *pAd, u32 Index, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, dma_addr_t *PhysicalAddress); -void RTMP_FreeFirstTxBuffer(IN PRTMP_ADAPTER pAd, +void RTMP_FreeFirstTxBuffer(struct rt_rtmp_adapter *pAd, unsigned long Length, IN BOOLEAN Cached, void *VirtualAddress, dma_addr_t PhysicalAddress); -void RTMP_AllocateMgmtDescMemory(IN PRTMP_ADAPTER pAd, +void RTMP_AllocateMgmtDescMemory(struct rt_rtmp_adapter *pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, dma_addr_t *PhysicalAddress); -void RTMP_AllocateRxDescMemory(IN PRTMP_ADAPTER pAd, +void RTMP_AllocateRxDescMemory(struct rt_rtmp_adapter *pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, dma_addr_t *PhysicalAddress); -void RTMP_FreeDescMemory(IN PRTMP_ADAPTER pAd, +void RTMP_FreeDescMemory(struct rt_rtmp_adapter *pAd, unsigned long Length, void *VirtualAddress, dma_addr_t PhysicalAddress); -void *RtmpOSNetPktAlloc(IN RTMP_ADAPTER * pAd, IN int size); +void *RtmpOSNetPktAlloc(struct rt_rtmp_adapter *pAd, IN int size); -void *RTMP_AllocateRxPacketBuffer(IN PRTMP_ADAPTER pAd, +void *RTMP_AllocateRxPacketBuffer(struct rt_rtmp_adapter *pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress, OUT dma_addr_t * PhysicalAddress); -void *RTMP_AllocateTxPacketBuffer(IN PRTMP_ADAPTER pAd, +void *RTMP_AllocateTxPacketBuffer(struct rt_rtmp_adapter *pAd, unsigned long Length, IN BOOLEAN Cached, void ** VirtualAddress); -void *RTMP_AllocateFragPacketBuffer(IN PRTMP_ADAPTER pAd, +void *RTMP_AllocateFragPacketBuffer(struct rt_rtmp_adapter *pAd, unsigned long Length); void RTMP_QueryPacketInfo(void *pPacket, - OUT PACKET_INFO * pPacketInfo, + struct rt_packet_info *pPacketInfo, u8 ** pSrcBufVA, u32 * pSrcBufLen); void RTMP_QueryNextPacketInfo(void ** ppPacket, - OUT PACKET_INFO * pPacketInfo, + struct rt_packet_info *pPacketInfo, u8 ** pSrcBufVA, u32 * pSrcBufLen); -BOOLEAN RTMP_FillTxBlkInfo(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk); +BOOLEAN RTMP_FillTxBlkInfo(struct rt_rtmp_adapter *pAd, struct rt_tx_blk *pTxBlk); -PRTMP_SCATTER_GATHER_LIST -rt_get_sg_list_from_packet(void *pPacket, RTMP_SCATTER_GATHER_LIST * sg); +struct rt_rtmp_sg_list * +rt_get_sg_list_from_packet(void *pPacket, struct rt_rtmp_sg_list *sg); -void announce_802_3_packet(IN PRTMP_ADAPTER pAd, void *pPacket); +void announce_802_3_packet(struct rt_rtmp_adapter *pAd, void *pPacket); -u32 BA_Reorder_AMSDU_Annnounce(IN PRTMP_ADAPTER pAd, void *pPacket); +u32 BA_Reorder_AMSDU_Annnounce(struct rt_rtmp_adapter *pAd, void *pPacket); -struct net_device *get_netdev_from_bssid(IN PRTMP_ADAPTER pAd, u8 FromWhichBSSID); +struct net_device *get_netdev_from_bssid(struct rt_rtmp_adapter *pAd, u8 FromWhichBSSID); -void *duplicate_pkt(IN PRTMP_ADAPTER pAd, +void *duplicate_pkt(struct rt_rtmp_adapter *pAd, u8 *pHeader802_3, u32 HdrLen, u8 *pData, unsigned long DataSize, u8 FromWhichBSSID); -void *duplicate_pkt_with_TKIP_MIC(IN PRTMP_ADAPTER pAd, +void *duplicate_pkt_with_TKIP_MIC(struct rt_rtmp_adapter *pAd, void *pOldPkt); -void ba_flush_reordering_timeout_mpdus(IN PRTMP_ADAPTER pAd, - IN PBA_REC_ENTRY pBAEntry, +void ba_flush_reordering_timeout_mpdus(struct rt_rtmp_adapter *pAd, + struct rt_ba_rec_entry *pBAEntry, unsigned long Now32); -void BAOriSessionSetUp(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, +void BAOriSessionSetUp(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, u8 TID, u16 TimeOut, unsigned long DelayTime, IN BOOLEAN isForced); -void BASessionTearDownALL(IN OUT PRTMP_ADAPTER pAd, u8 Wcid); +void BASessionTearDownALL(struct rt_rtmp_adapter *pAd, u8 Wcid); BOOLEAN OS_Need_Clone_Packet(void); -void build_tx_packet(IN PRTMP_ADAPTER pAd, +void build_tx_packet(struct rt_rtmp_adapter *pAd, void *pPacket, u8 *pFrame, unsigned long FrameLen); -void BAOriSessionTearDown(IN OUT PRTMP_ADAPTER pAd, +void BAOriSessionTearDown(struct rt_rtmp_adapter *pAd, u8 Wcid, u8 TID, IN BOOLEAN bPassive, IN BOOLEAN bForceSend); -void BARecSessionTearDown(IN OUT PRTMP_ADAPTER pAd, +void BARecSessionTearDown(struct rt_rtmp_adapter *pAd, u8 Wcid, u8 TID, IN BOOLEAN bPassive); -BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num); -void ba_reordering_resource_release(PRTMP_ADAPTER pAd); +BOOLEAN ba_reordering_resource_init(struct rt_rtmp_adapter *pAd, int num); +void ba_reordering_resource_release(struct rt_rtmp_adapter *pAd); char *rstrtok(char *s, IN const char *ct); /*//////// common ioctl functions ////////// */ -int SetCommonHT(IN PRTMP_ADAPTER pAd); +int SetCommonHT(struct rt_rtmp_adapter *pAd); -int WpaCheckEapCode(IN PRTMP_ADAPTER pAd, +int WpaCheckEapCode(struct rt_rtmp_adapter *pAd, u8 *pFrame, u16 FrameLen, u16 OffSet); -void WpaSendMicFailureToWpaSupplicant(IN PRTMP_ADAPTER pAd, +void WpaSendMicFailureToWpaSupplicant(struct rt_rtmp_adapter *pAd, IN BOOLEAN bUnicast); -int wext_notify_event_assoc(IN RTMP_ADAPTER * pAd); +int wext_notify_event_assoc(struct rt_rtmp_adapter *pAd); -BOOLEAN STARxDoneInterruptHandle(IN PRTMP_ADAPTER pAd, IN BOOLEAN argc); +BOOLEAN STARxDoneInterruptHandle(struct rt_rtmp_adapter *pAd, IN BOOLEAN argc); /* AMPDU packet indication */ -void Indicate_AMPDU_Packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, u8 FromWhichBSSID); +void Indicate_AMPDU_Packet(struct rt_rtmp_adapter *pAd, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID); /* AMSDU packet indication */ -void Indicate_AMSDU_Packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, u8 FromWhichBSSID); +void Indicate_AMSDU_Packet(struct rt_rtmp_adapter *pAd, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID); /* Normal legacy Rx packet indication */ -void Indicate_Legacy_Packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, u8 FromWhichBSSID); +void Indicate_Legacy_Packet(struct rt_rtmp_adapter *pAd, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID); -void Indicate_EAPOL_Packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, u8 FromWhichBSSID); +void Indicate_EAPOL_Packet(struct rt_rtmp_adapter *pAd, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID); -void update_os_packet_info(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, u8 FromWhichBSSID); +void update_os_packet_info(struct rt_rtmp_adapter *pAd, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID); -void wlan_802_11_to_802_3_packet(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, +void wlan_802_11_to_802_3_packet(struct rt_rtmp_adapter *pAd, + struct rt_rx_blk *pRxBlk, u8 *pHeader802_3, u8 FromWhichBSSID); @@ -3719,7 +3719,7 @@ void wlan_802_11_to_802_3_packet(IN PRTMP_ADAPTER pAd, if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_MESH)) \ { \ _pDA = _pRxBlk->pHeader->Addr3; \ - _pSA = (u8 *)_pRxBlk->pHeader + sizeof(HEADER_802_11); \ + _pSA = (u8 *)_pRxBlk->pHeader + sizeof(struct rt_header_802_11); \ } \ else \ { \ @@ -3742,7 +3742,7 @@ void wlan_802_11_to_802_3_packet(IN PRTMP_ADAPTER pAd, _pRxBlk->DataSize, _pRemovedLLCSNAP); \ } -void Sta_Announce_or_Forward_802_3_Packet(IN PRTMP_ADAPTER pAd, +void Sta_Announce_or_Forward_802_3_Packet(struct rt_rtmp_adapter *pAd, void *pPacket, u8 FromWhichBSSID); @@ -3750,30 +3750,30 @@ void Sta_Announce_or_Forward_802_3_Packet(IN PRTMP_ADAPTER pAd, Sta_Announce_or_Forward_802_3_Packet(_pAd, _pPacket, _FromWhichBSS); /*announce_802_3_packet(_pAd, _pPacket); */ -void *DuplicatePacket(IN PRTMP_ADAPTER pAd, +void *DuplicatePacket(struct rt_rtmp_adapter *pAd, void *pPacket, u8 FromWhichBSSID); -void *ClonePacket(IN PRTMP_ADAPTER pAd, +void *ClonePacket(struct rt_rtmp_adapter *pAd, void *pPacket, u8 *pData, unsigned long DataSize); /* Normal, AMPDU or AMSDU */ -void CmmRxnonRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, - IN RX_BLK * pRxBlk, u8 FromWhichBSSID); +void CmmRxnonRalinkFrameIndicate(struct rt_rtmp_adapter *pAd, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID); -void CmmRxRalinkFrameIndicate(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, - IN RX_BLK * pRxBlk, u8 FromWhichBSSID); +void CmmRxRalinkFrameIndicate(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID); -void Update_Rssi_Sample(IN PRTMP_ADAPTER pAd, - IN RSSI_SAMPLE * pRssi, IN PRXWI_STRUC pRxWI); +void Update_Rssi_Sample(struct rt_rtmp_adapter *pAd, + struct rt_rssi_sample *pRssi, struct rt_rxwi * pRxWI); -void *GetPacketFromRxRing(IN PRTMP_ADAPTER pAd, +void *GetPacketFromRxRing(struct rt_rtmp_adapter *pAd, OUT PRT28XX_RXD_STRUC pSaveRxD, OUT BOOLEAN * pbReschedule, IN u32 * pRxPending); -void *RTMPDeFragmentDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk); +void *RTMPDeFragmentDataFrame(struct rt_rtmp_adapter *pAd, struct rt_rx_blk *pRxBlk); enum { DIDmsg_lnxind_wlansniffrm = 0x00000044, @@ -3797,32 +3797,32 @@ enum { }; /* Definition from madwifi */ -typedef struct { +struct rt_p80211item_uint32 { u32 did; u16 status; u16 len; u32 data; -} p80211item_uint32_t; +}; -typedef struct { +struct rt_wlan_ng_prism2_header { u32 msgcode; u32 msglen; #define WLAN_DEVNAMELEN_MAX 16 u8 devname[WLAN_DEVNAMELEN_MAX]; - p80211item_uint32_t hosttime; - p80211item_uint32_t mactime; - p80211item_uint32_t channel; - p80211item_uint32_t rssi; - p80211item_uint32_t sq; - p80211item_uint32_t signal; - p80211item_uint32_t noise; - p80211item_uint32_t rate; - p80211item_uint32_t istx; - p80211item_uint32_t frmlen; -} wlan_ng_prism2_header; + struct rt_p80211item_uint32 hosttime; + struct rt_p80211item_uint32 mactime; + struct rt_p80211item_uint32 channel; + struct rt_p80211item_uint32 rssi; + struct rt_p80211item_uint32 sq; + struct rt_p80211item_uint32 signal; + struct rt_p80211item_uint32 noise; + struct rt_p80211item_uint32 rate; + struct rt_p80211item_uint32 istx; + struct rt_p80211item_uint32 frmlen; +}; /* The radio capture header precedes the 802.11 header. */ -typedef struct PACKED _ieee80211_radiotap_header { +struct PACKED rt_ieee80211_radiotap_header { u8 it_version; /* Version 0. Only increases * for drastic changes, * introduction of compatible @@ -3841,7 +3841,7 @@ typedef struct PACKED _ieee80211_radiotap_header { * Additional extensions are made * by setting bit 31. */ -} ieee80211_radiotap_header; +}; enum ieee80211_radiotap_type { IEEE80211_RADIOTAP_TSFT = 0, @@ -3866,111 +3866,111 @@ enum ieee80211_radiotap_type { (1 << IEEE80211_RADIOTAP_RATE) | \ 0) -typedef struct _wlan_radiotap_header { - ieee80211_radiotap_header wt_ihdr; +struct rt_wlan_radiotap_header { + struct rt_ieee80211_radiotap_header wt_ihdr; long long wt_tsft; u8 wt_flags; u8 wt_rate; -} wlan_radiotap_header; +}; /* Definition from madwifi */ -void send_monitor_packets(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk); +void send_monitor_packets(struct rt_rtmp_adapter *pAd, struct rt_rx_blk *pRxBlk); -void RTMPSetDesiredRates(IN PRTMP_ADAPTER pAdapter, long Rates); +void RTMPSetDesiredRates(struct rt_rtmp_adapter *pAdapter, long Rates); -int Set_FixedTxMode_Proc(IN PRTMP_ADAPTER pAd, char *arg); +int Set_FixedTxMode_Proc(struct rt_rtmp_adapter *pAd, char *arg); BOOLEAN RT28XXChipsetCheck(IN void *_dev_p); -void RT28XXDMADisable(IN RTMP_ADAPTER * pAd); +void RT28XXDMADisable(struct rt_rtmp_adapter *pAd); -void RT28XXDMAEnable(IN RTMP_ADAPTER * pAd); +void RT28XXDMAEnable(struct rt_rtmp_adapter *pAd); -void RT28xx_UpdateBeaconToAsic(IN RTMP_ADAPTER * pAd, +void RT28xx_UpdateBeaconToAsic(struct rt_rtmp_adapter *pAd, int apidx, unsigned long BeaconLen, unsigned long UpdatePos); -int rt28xx_init(IN PRTMP_ADAPTER pAd, +int rt28xx_init(struct rt_rtmp_adapter *pAd, char *pDefaultMac, char *pHostName); -int RtmpNetTaskInit(IN RTMP_ADAPTER * pAd); +int RtmpNetTaskInit(struct rt_rtmp_adapter *pAd); -void RtmpNetTaskExit(IN PRTMP_ADAPTER pAd); +void RtmpNetTaskExit(struct rt_rtmp_adapter *pAd); -int RtmpMgmtTaskInit(IN RTMP_ADAPTER * pAd); +int RtmpMgmtTaskInit(struct rt_rtmp_adapter *pAd); -void RtmpMgmtTaskExit(IN RTMP_ADAPTER * pAd); +void RtmpMgmtTaskExit(struct rt_rtmp_adapter *pAd); void tbtt_tasklet(unsigned long data); -struct net_device *RtmpPhyNetDevInit(IN RTMP_ADAPTER * pAd, - IN RTMP_OS_NETDEV_OP_HOOK * pNetHook); +struct net_device *RtmpPhyNetDevInit(struct rt_rtmp_adapter *pAd, + struct rt_rtmp_os_netdev_op_hook *pNetHook); -BOOLEAN RtmpPhyNetDevExit(IN RTMP_ADAPTER * pAd, struct net_device *net_dev); +BOOLEAN RtmpPhyNetDevExit(struct rt_rtmp_adapter *pAd, struct net_device *net_dev); -int RtmpRaDevCtrlInit(IN RTMP_ADAPTER * pAd, IN RTMP_INF_TYPE infType); +int RtmpRaDevCtrlInit(struct rt_rtmp_adapter *pAd, IN RTMP_INF_TYPE infType); -BOOLEAN RtmpRaDevCtrlExit(IN RTMP_ADAPTER * pAd); +BOOLEAN RtmpRaDevCtrlExit(struct rt_rtmp_adapter *pAd); #ifdef RTMP_MAC_PCI /* */ /* Function Prototype in cmm_data_pci.c */ /* */ -u16 RtmpPCI_WriteTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +u16 RtmpPCI_WriteTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, IN BOOLEAN bIsLast, u16 * FreeNumber); -u16 RtmpPCI_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +u16 RtmpPCI_WriteSingleTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, IN BOOLEAN bIsLast, u16 * FreeNumber); -u16 RtmpPCI_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +u16 RtmpPCI_WriteMultiTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, u8 frameNum, u16 * FreeNumber); -u16 RtmpPCI_WriteFragTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +u16 RtmpPCI_WriteFragTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, u8 fragNum, u16 * FreeNumber); -u16 RtmpPCI_WriteSubTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +u16 RtmpPCI_WriteSubTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, IN BOOLEAN bIsLast, u16 * FreeNumber); -void RtmpPCI_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +void RtmpPCI_FinalWriteTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, u16 totalMPDUSize, u16 FirstTxIdx); -void RtmpPCIDataLastTxIdx(IN PRTMP_ADAPTER pAd, +void RtmpPCIDataLastTxIdx(struct rt_rtmp_adapter *pAd, u8 QueIdx, u16 LastTxIdx); -void RtmpPCIDataKickOut(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, u8 QueIdx); +void RtmpPCIDataKickOut(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, u8 QueIdx); -int RtmpPCIMgmtKickOut(IN RTMP_ADAPTER * pAd, +int RtmpPCIMgmtKickOut(struct rt_rtmp_adapter *pAd, u8 QueIdx, void *pPacket, u8 *pSrcBufVA, u32 SrcBufLen); -int RTMPCheckRxError(IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHeader, - IN PRXWI_STRUC pRxWI, IN PRT28XX_RXD_STRUC pRxD); +int RTMPCheckRxError(struct rt_rtmp_adapter *pAd, + struct rt_header_802_11 * pHeader, + struct rt_rxwi * pRxWI, IN PRT28XX_RXD_STRUC pRxD); -BOOLEAN RT28xxPciAsicRadioOff(IN PRTMP_ADAPTER pAd, +BOOLEAN RT28xxPciAsicRadioOff(struct rt_rtmp_adapter *pAd, u8 Level, u16 TbttNumToNextWakeUp); -BOOLEAN RT28xxPciAsicRadioOn(IN PRTMP_ADAPTER pAd, u8 Level); +BOOLEAN RT28xxPciAsicRadioOn(struct rt_rtmp_adapter *pAd, u8 Level); -void RTMPInitPCIeLinkCtrlValue(IN PRTMP_ADAPTER pAd); +void RTMPInitPCIeLinkCtrlValue(struct rt_rtmp_adapter *pAd); -void RTMPFindHostPCIDev(IN PRTMP_ADAPTER pAd); +void RTMPFindHostPCIDev(struct rt_rtmp_adapter *pAd); -void RTMPPCIeLinkCtrlValueRestore(IN PRTMP_ADAPTER pAd, u8 Level); +void RTMPPCIeLinkCtrlValueRestore(struct rt_rtmp_adapter *pAd, u8 Level); -void RTMPPCIeLinkCtrlSetting(IN PRTMP_ADAPTER pAd, u16 Max); +void RTMPPCIeLinkCtrlSetting(struct rt_rtmp_adapter *pAd, u16 Max); -void RTMPrt3xSetPCIePowerLinkCtrl(IN PRTMP_ADAPTER pAd); +void RTMPrt3xSetPCIePowerLinkCtrl(struct rt_rtmp_adapter *pAd); void PsPollWakeExec(void *SystemSpecific1, void *FunctionContext, @@ -3980,83 +3980,83 @@ void RadioOnExec(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3); -void RT28xxPciStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx); +void RT28xxPciStaAsicForceWakeup(struct rt_rtmp_adapter *pAd, IN BOOLEAN bFromTx); -void RT28xxPciStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, +void RT28xxPciStaAsicSleepThenAutoWakeup(struct rt_rtmp_adapter *pAd, u16 TbttNumToNextWakeUp); -void RT28xxPciMlmeRadioOn(IN PRTMP_ADAPTER pAd); +void RT28xxPciMlmeRadioOn(struct rt_rtmp_adapter *pAd); -void RT28xxPciMlmeRadioOFF(IN PRTMP_ADAPTER pAd); +void RT28xxPciMlmeRadioOFF(struct rt_rtmp_adapter *pAd); #endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB /* */ /* Function Prototype in rtusb_bulk.c */ /* */ -void RTUSBInitTxDesc(IN PRTMP_ADAPTER pAd, - IN PTX_CONTEXT pTxContext, +void RTUSBInitTxDesc(struct rt_rtmp_adapter *pAd, + struct rt_tx_context *pTxContext, u8 BulkOutPipeId, IN usb_complete_t Func); -void RTUSBInitHTTxDesc(IN PRTMP_ADAPTER pAd, - IN PHT_TX_CONTEXT pTxContext, +void RTUSBInitHTTxDesc(struct rt_rtmp_adapter *pAd, + struct rt_ht_tx_context *pTxContext, u8 BulkOutPipeId, unsigned long BulkOutSize, IN usb_complete_t Func); -void RTUSBInitRxDesc(IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext); +void RTUSBInitRxDesc(struct rt_rtmp_adapter *pAd, struct rt_rx_context *pRxContext); -void RTUSBCleanUpDataBulkOutQueue(IN PRTMP_ADAPTER pAd); +void RTUSBCleanUpDataBulkOutQueue(struct rt_rtmp_adapter *pAd); -void RTUSBCancelPendingBulkOutIRP(IN PRTMP_ADAPTER pAd); +void RTUSBCancelPendingBulkOutIRP(struct rt_rtmp_adapter *pAd); -void RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, +void RTUSBBulkOutDataPacket(struct rt_rtmp_adapter *pAd, u8 BulkOutPipeId, u8 Index); -void RTUSBBulkOutNullFrame(IN PRTMP_ADAPTER pAd); +void RTUSBBulkOutNullFrame(struct rt_rtmp_adapter *pAd); -void RTUSBBulkOutRTSFrame(IN PRTMP_ADAPTER pAd); +void RTUSBBulkOutRTSFrame(struct rt_rtmp_adapter *pAd); -void RTUSBCancelPendingBulkInIRP(IN PRTMP_ADAPTER pAd); +void RTUSBCancelPendingBulkInIRP(struct rt_rtmp_adapter *pAd); -void RTUSBCancelPendingIRPs(IN PRTMP_ADAPTER pAd); +void RTUSBCancelPendingIRPs(struct rt_rtmp_adapter *pAd); -void RTUSBBulkOutMLMEPacket(IN PRTMP_ADAPTER pAd, u8 Index); +void RTUSBBulkOutMLMEPacket(struct rt_rtmp_adapter *pAd, u8 Index); -void RTUSBBulkOutPsPoll(IN PRTMP_ADAPTER pAd); +void RTUSBBulkOutPsPoll(struct rt_rtmp_adapter *pAd); -void RTUSBCleanUpMLMEBulkOutQueue(IN PRTMP_ADAPTER pAd); +void RTUSBCleanUpMLMEBulkOutQueue(struct rt_rtmp_adapter *pAd); -void RTUSBKickBulkOut(IN PRTMP_ADAPTER pAd); +void RTUSBKickBulkOut(struct rt_rtmp_adapter *pAd); -void RTUSBBulkReceive(IN PRTMP_ADAPTER pAd); +void RTUSBBulkReceive(struct rt_rtmp_adapter *pAd); -void DoBulkIn(IN RTMP_ADAPTER * pAd); +void DoBulkIn(struct rt_rtmp_adapter *pAd); -void RTUSBInitRxDesc(IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext); +void RTUSBInitRxDesc(struct rt_rtmp_adapter *pAd, struct rt_rx_context *pRxContext); void RTUSBBulkRxHandle(IN unsigned long data); /* */ /* Function Prototype in rtusb_io.c */ /* */ -int RTUSBMultiRead(IN PRTMP_ADAPTER pAd, +int RTUSBMultiRead(struct rt_rtmp_adapter *pAd, u16 Offset, u8 *pData, u16 length); -int RTUSBMultiWrite(IN PRTMP_ADAPTER pAd, +int RTUSBMultiWrite(struct rt_rtmp_adapter *pAd, u16 Offset, u8 *pData, u16 length); -int RTUSBMultiWrite_OneByte(IN PRTMP_ADAPTER pAd, +int RTUSBMultiWrite_OneByte(struct rt_rtmp_adapter *pAd, u16 Offset, u8 *pData); -int RTUSBReadBBPRegister(IN PRTMP_ADAPTER pAd, +int RTUSBReadBBPRegister(struct rt_rtmp_adapter *pAd, u8 Id, u8 *pValue); -int RTUSBWriteBBPRegister(IN PRTMP_ADAPTER pAd, +int RTUSBWriteBBPRegister(struct rt_rtmp_adapter *pAd, u8 Id, u8 Value); -int RTUSBWriteRFRegister(IN PRTMP_ADAPTER pAd, u32 Value); +int RTUSBWriteRFRegister(struct rt_rtmp_adapter *pAd, u32 Value); -int RTUSB_VendorRequest(IN PRTMP_ADAPTER pAd, +int RTUSB_VendorRequest(struct rt_rtmp_adapter *pAd, u32 TransferFlags, u8 ReservedBits, u8 Request, @@ -4065,104 +4065,104 @@ int RTUSB_VendorRequest(IN PRTMP_ADAPTER pAd, void *TransferBuffer, u32 TransferBufferLength); -int RTUSBReadEEPROM(IN PRTMP_ADAPTER pAd, +int RTUSBReadEEPROM(struct rt_rtmp_adapter *pAd, u16 Offset, u8 *pData, u16 length); -int RTUSBWriteEEPROM(IN PRTMP_ADAPTER pAd, +int RTUSBWriteEEPROM(struct rt_rtmp_adapter *pAd, u16 Offset, u8 *pData, u16 length); -void RTUSBPutToSleep(IN PRTMP_ADAPTER pAd); +void RTUSBPutToSleep(struct rt_rtmp_adapter *pAd); -int RTUSBWakeUp(IN PRTMP_ADAPTER pAd); +int RTUSBWakeUp(struct rt_rtmp_adapter *pAd); -void RTUSBInitializeCmdQ(IN PCmdQ cmdq); +void RTUSBInitializeCmdQ(struct rt_cmdq *cmdq); -int RTUSBEnqueueCmdFromNdis(IN PRTMP_ADAPTER pAd, +int RTUSBEnqueueCmdFromNdis(struct rt_rtmp_adapter *pAd, IN NDIS_OID Oid, IN BOOLEAN SetInformation, void *pInformationBuffer, u32 InformationBufferLength); -int RTUSBEnqueueInternalCmd(IN PRTMP_ADAPTER pAd, +int RTUSBEnqueueInternalCmd(struct rt_rtmp_adapter *pAd, IN NDIS_OID Oid, void *pInformationBuffer, u32 InformationBufferLength); -void RTUSBDequeueCmd(IN PCmdQ cmdq, OUT PCmdQElmt * pcmdqelmt); +void RTUSBDequeueCmd(struct rt_cmdq *cmdq, struct rt_cmdqelmt * * pcmdqelmt); int RTUSBCmdThread(IN void *Context); -void RTUSBBssBeaconExit(IN RTMP_ADAPTER * pAd); +void RTUSBBssBeaconExit(struct rt_rtmp_adapter *pAd); -void RTUSBBssBeaconStop(IN RTMP_ADAPTER * pAd); +void RTUSBBssBeaconStop(struct rt_rtmp_adapter *pAd); -void RTUSBBssBeaconStart(IN RTMP_ADAPTER * pAd); +void RTUSBBssBeaconStart(struct rt_rtmp_adapter *pAd); -void RTUSBBssBeaconInit(IN RTMP_ADAPTER * pAd); +void RTUSBBssBeaconInit(struct rt_rtmp_adapter *pAd); -void RTUSBWatchDog(IN RTMP_ADAPTER * pAd); +void RTUSBWatchDog(struct rt_rtmp_adapter *pAd); -int RTUSBWriteMACRegister(IN PRTMP_ADAPTER pAd, +int RTUSBWriteMACRegister(struct rt_rtmp_adapter *pAd, u16 Offset, u32 Value); -int RTUSBReadMACRegister(IN PRTMP_ADAPTER pAd, +int RTUSBReadMACRegister(struct rt_rtmp_adapter *pAd, u16 Offset, u32 *pValue); -int RTUSBSingleWrite(IN RTMP_ADAPTER * pAd, +int RTUSBSingleWrite(struct rt_rtmp_adapter *pAd, u16 Offset, u16 Value); -int RTUSBFirmwareWrite(IN PRTMP_ADAPTER pAd, +int RTUSBFirmwareWrite(struct rt_rtmp_adapter *pAd, u8 *pFwImage, unsigned long FwLen); -int RTUSBVenderReset(IN PRTMP_ADAPTER pAd); +int RTUSBVenderReset(struct rt_rtmp_adapter *pAd); -int RTUSBSetHardWareRegister(IN PRTMP_ADAPTER pAdapter, void *pBuf); +int RTUSBSetHardWareRegister(struct rt_rtmp_adapter *pAdapter, void *pBuf); -int RTUSBQueryHardWareRegister(IN PRTMP_ADAPTER pAdapter, +int RTUSBQueryHardWareRegister(struct rt_rtmp_adapter *pAdapter, void *pBuf); -void CMDHandler(IN PRTMP_ADAPTER pAd); +void CMDHandler(struct rt_rtmp_adapter *pAd); -int RTUSBWriteHWMACAddress(IN PRTMP_ADAPTER pAdapter); +int RTUSBWriteHWMACAddress(struct rt_rtmp_adapter *pAdapter); -void MacTableInitialize(IN PRTMP_ADAPTER pAd); +void MacTableInitialize(struct rt_rtmp_adapter *pAd); -void MlmeSetPsm(IN PRTMP_ADAPTER pAd, u16 psm); +void MlmeSetPsm(struct rt_rtmp_adapter *pAd, u16 psm); -int RTMPWPAAddKeyProc(IN PRTMP_ADAPTER pAd, void *pBuf); +int RTMPWPAAddKeyProc(struct rt_rtmp_adapter *pAd, void *pBuf); -void AsicRxAntEvalAction(IN PRTMP_ADAPTER pAd); +void AsicRxAntEvalAction(struct rt_rtmp_adapter *pAd); -void append_pkt(IN PRTMP_ADAPTER pAd, +void append_pkt(struct rt_rtmp_adapter *pAd, u8 *pHeader802_3, u32 HdrLen, u8 *pData, unsigned long DataSize, void ** ppPacket); -u32 deaggregate_AMSDU_announce(IN PRTMP_ADAPTER pAd, +u32 deaggregate_AMSDU_announce(struct rt_rtmp_adapter *pAd, void *pPacket, u8 *pData, unsigned long DataSize); -int RTMPCheckRxError(IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHeader, - IN PRXWI_STRUC pRxWI, +int RTMPCheckRxError(struct rt_rtmp_adapter *pAd, + struct rt_header_802_11 * pHeader, + struct rt_rxwi * pRxWI, IN PRT28XX_RXD_STRUC pRxINFO); -void RTUSBMlmeHardTransmit(IN PRTMP_ADAPTER pAd, IN PMGMT_STRUC pMgmt); +void RTUSBMlmeHardTransmit(struct rt_rtmp_adapter *pAd, struct rt_mgmt *pMgmt); int MlmeThread(void *Context); /* */ /* Function Prototype in rtusb_data.c */ /* */ -int RTUSBFreeDescriptorRequest(IN PRTMP_ADAPTER pAd, +int RTUSBFreeDescriptorRequest(struct rt_rtmp_adapter *pAd, u8 BulkOutPipeId, u32 NumberRequired); -BOOLEAN RTUSBNeedQueueBackForAgg(IN RTMP_ADAPTER * pAd, u8 BulkOutPipeId); +BOOLEAN RTUSBNeedQueueBackForAgg(struct rt_rtmp_adapter *pAd, u8 BulkOutPipeId); -void RTMPWriteTxInfo(IN PRTMP_ADAPTER pAd, - IN PTXINFO_STRUC pTxInfo, +void RTMPWriteTxInfo(struct rt_rtmp_adapter *pAd, + struct rt_txinfo *pTxInfo, u16 USBDMApktLen, IN BOOLEAN bWiv, u8 QueueSel, u8 NextValid, u8 TxBurst); @@ -4170,39 +4170,39 @@ void RTMPWriteTxInfo(IN PRTMP_ADAPTER pAd, /* */ /* Function Prototype in cmm_data_usb.c */ /* */ -u16 RtmpUSB_WriteSubTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +u16 RtmpUSB_WriteSubTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, IN BOOLEAN bIsLast, u16 * FreeNumber); -u16 RtmpUSB_WriteSingleTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +u16 RtmpUSB_WriteSingleTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, IN BOOLEAN bIsLast, u16 * FreeNumber); -u16 RtmpUSB_WriteFragTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +u16 RtmpUSB_WriteFragTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, u8 fragNum, u16 * FreeNumber); -u16 RtmpUSB_WriteMultiTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +u16 RtmpUSB_WriteMultiTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, u8 frameNum, u16 * FreeNumber); -void RtmpUSB_FinalWriteTxResource(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, +void RtmpUSB_FinalWriteTxResource(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, u16 totalMPDUSize, u16 TxIdx); -void RtmpUSBDataLastTxIdx(IN PRTMP_ADAPTER pAd, +void RtmpUSBDataLastTxIdx(struct rt_rtmp_adapter *pAd, u8 QueIdx, u16 TxIdx); -void RtmpUSBDataKickOut(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, u8 QueIdx); +void RtmpUSBDataKickOut(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, u8 QueIdx); -int RtmpUSBMgmtKickOut(IN RTMP_ADAPTER * pAd, +int RtmpUSBMgmtKickOut(struct rt_rtmp_adapter *pAd, u8 QueIdx, void *pPacket, u8 *pSrcBufVA, u32 SrcBufLen); -void RtmpUSBNullFrameKickOut(IN RTMP_ADAPTER * pAd, +void RtmpUSBNullFrameKickOut(struct rt_rtmp_adapter *pAd, u8 QueIdx, u8 * pNullFrame, u32 frameLen); @@ -4211,56 +4211,56 @@ void RtmpUsbStaAsicForceWakeupTimeout(void *SystemSpecific1, void *SystemSpecific2, void *SystemSpecific3); -void RT28xxUsbStaAsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx); +void RT28xxUsbStaAsicForceWakeup(struct rt_rtmp_adapter *pAd, IN BOOLEAN bFromTx); -void RT28xxUsbStaAsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd, +void RT28xxUsbStaAsicSleepThenAutoWakeup(struct rt_rtmp_adapter *pAd, u16 TbttNumToNextWakeUp); -void RT28xxUsbMlmeRadioOn(IN PRTMP_ADAPTER pAd); +void RT28xxUsbMlmeRadioOn(struct rt_rtmp_adapter *pAd); -void RT28xxUsbMlmeRadioOFF(IN PRTMP_ADAPTER pAd); +void RT28xxUsbMlmeRadioOFF(struct rt_rtmp_adapter *pAd); #endif /* RTMP_MAC_USB // */ -void AsicTurnOffRFClk(IN PRTMP_ADAPTER pAd, u8 Channel); +void AsicTurnOffRFClk(struct rt_rtmp_adapter *pAd, u8 Channel); -void AsicTurnOnRFClk(IN PRTMP_ADAPTER pAd, u8 Channel); +void AsicTurnOnRFClk(struct rt_rtmp_adapter *pAd, u8 Channel); #ifdef RTMP_TIMER_TASK_SUPPORT int RtmpTimerQThread(IN void *Context); -RTMP_TIMER_TASK_ENTRY *RtmpTimerQInsert(IN RTMP_ADAPTER * pAd, - IN RALINK_TIMER_STRUCT * pTimer); +struct rt_rtmp_timer_task_entry *RtmpTimerQInsert(struct rt_rtmp_adapter *pAd, + struct rt_ralink_timer *pTimer); -BOOLEAN RtmpTimerQRemove(IN RTMP_ADAPTER * pAd, - IN RALINK_TIMER_STRUCT * pTimer); +BOOLEAN RtmpTimerQRemove(struct rt_rtmp_adapter *pAd, + struct rt_ralink_timer *pTimer); -void RtmpTimerQExit(IN RTMP_ADAPTER * pAd); +void RtmpTimerQExit(struct rt_rtmp_adapter *pAd); -void RtmpTimerQInit(IN RTMP_ADAPTER * pAd); +void RtmpTimerQInit(struct rt_rtmp_adapter *pAd); #endif /* RTMP_TIMER_TASK_SUPPORT // */ -void AsicStaBbpTuning(IN PRTMP_ADAPTER pAd); +void AsicStaBbpTuning(struct rt_rtmp_adapter *pAd); -BOOLEAN StaAddMacTableEntry(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, +BOOLEAN StaAddMacTableEntry(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, u8 MaxSupportedRateIn500Kbps, - IN HT_CAPABILITY_IE * pHtCapability, + struct rt_ht_capability_ie * pHtCapability, u8 HtCapabilityLen, - IN ADD_HT_INFO_IE * pAddHtInfo, + struct rt_add_ht_info_ie * pAddHtInfo, u8 AddHtInfoLen, u16 CapabilityInfo); -BOOLEAN AUTH_ReqSend(IN PRTMP_ADAPTER pAd, - IN PMLME_QUEUE_ELEM pElem, - IN PRALINK_TIMER_STRUCT pAuthTimer, +BOOLEAN AUTH_ReqSend(struct rt_rtmp_adapter *pAd, + struct rt_mlme_queue_elem *pElem, + struct rt_ralink_timer *pAuthTimer, char *pSMName, u16 SeqNo, u8 *pNewElement, unsigned long ElementLen); -void RTMP_IndicateMediaState(IN PRTMP_ADAPTER pAd); +void RTMP_IndicateMediaState(struct rt_rtmp_adapter *pAd); -void ReSyncBeaconTime(IN PRTMP_ADAPTER pAd); +void ReSyncBeaconTime(struct rt_rtmp_adapter *pAd); -void RTMPSetAGCInitValue(IN PRTMP_ADAPTER pAd, u8 BandWidth); +void RTMPSetAGCInitValue(struct rt_rtmp_adapter *pAd, u8 BandWidth); int rt28xx_close(struct net_device *dev); int rt28xx_open(struct net_device *dev); @@ -4270,7 +4270,7 @@ int rt28xx_open(struct net_device *dev); #define VIRTUAL_IF_NUM(__pAd) ((__pAd)->VirtualIfCnt) #ifdef LINUX -__inline int VIRTUAL_IF_UP(PRTMP_ADAPTER pAd) +__inline int VIRTUAL_IF_UP(struct rt_rtmp_adapter *pAd) { if (VIRTUAL_IF_NUM(pAd) == 0) { if (rt28xx_open(pAd->net_dev) != 0) { @@ -4284,7 +4284,7 @@ __inline int VIRTUAL_IF_UP(PRTMP_ADAPTER pAd) return 0; } -__inline void VIRTUAL_IF_DOWN(PRTMP_ADAPTER pAd) +__inline void VIRTUAL_IF_DOWN(struct rt_rtmp_adapter *pAd) { VIRTUAL_IF_DEC(pAd); if (VIRTUAL_IF_NUM(pAd) == 0) @@ -4297,7 +4297,7 @@ __inline void VIRTUAL_IF_DOWN(PRTMP_ADAPTER pAd) OS Related funciton prototype definitions. TODO: Maybe we need to move these function prototypes to other proper place. */ -int RtmpOSWrielessEventSend(IN RTMP_ADAPTER * pAd, +int RtmpOSWrielessEventSend(struct rt_rtmp_adapter *pAd, u32 eventType, int flags, u8 *pSrcMac, @@ -4306,7 +4306,7 @@ int RtmpOSWrielessEventSend(IN RTMP_ADAPTER * pAd, int RtmpOSNetDevAddrSet(struct net_device *pNetDev, u8 *pMacAddr); int RtmpOSNetDevAttach(struct net_device *pNetDev, - IN RTMP_OS_NETDEV_OP_HOOK * pDevOpHook); + struct rt_rtmp_os_netdev_op_hook *pDevOpHook); void RtmpOSNetDevClose(struct net_device *pNetDev); @@ -4320,7 +4320,7 @@ struct net_device *RtmpOSNetDevGetByName(struct net_device *pNetDev, char *pDevN void RtmpOSNetDeviceRefPut(struct net_device *pNetDev); -struct net_device *RtmpOSNetDevCreate(IN RTMP_ADAPTER * pAd, +struct net_device *RtmpOSNetDevCreate(struct rt_rtmp_adapter *pAd, int devType, int devNum, int privMemSize, char *pNamePrefix); @@ -4328,16 +4328,16 @@ struct net_device *RtmpOSNetDevCreate(IN RTMP_ADAPTER * pAd, /* Task operation related function prototypes */ -void RtmpOSTaskCustomize(IN RTMP_OS_TASK * pTask); +void RtmpOSTaskCustomize(struct rt_rtmp_os_task *pTask); -int RtmpOSTaskNotifyToExit(IN RTMP_OS_TASK * pTask); +int RtmpOSTaskNotifyToExit(struct rt_rtmp_os_task *pTask); -int RtmpOSTaskKill(IN RTMP_OS_TASK * pTask); +int RtmpOSTaskKill(struct rt_rtmp_os_task *pTask); -int RtmpOSTaskInit(IN RTMP_OS_TASK * pTask, +int RtmpOSTaskInit(struct rt_rtmp_os_task *pTask, char *pTaskName, void * pPriv); -int RtmpOSTaskAttach(IN RTMP_OS_TASK * pTask, +int RtmpOSTaskAttach(struct rt_rtmp_os_task *pTask, IN int (*fn) (void *), IN void *arg); /* diff --git a/drivers/staging/rt2860/rtmp_chip.h b/drivers/staging/rt2860/rtmp_chip.h index a089472b6d4b..32ff3504e9e8 100644 --- a/drivers/staging/rt2860/rtmp_chip.h +++ b/drivers/staging/rt2860/rtmp_chip.h @@ -161,7 +161,7 @@ * EEPROM operation related marcos */ #define RT28xx_EEPROM_READ16(_pAd, _offset, _value) \ - (_pAd)->chipOps.eeread((RTMP_ADAPTER *)(_pAd), (u16)(_offset), (u16 *)&(_value)) + (_pAd)->chipOps.eeread((struct rt_rtmp_adapter *)(_pAd), (u16)(_offset), (u16 *)&(_value)) /* ------------------------------------------------------------------- */ /* E2PROM data layout */ diff --git a/drivers/staging/rt2860/rtmp_ckipmic.h b/drivers/staging/rt2860/rtmp_ckipmic.h index 301ba5f77bb7..6ff935dd3dd1 100644 --- a/drivers/staging/rt2860/rtmp_ckipmic.h +++ b/drivers/staging/rt2860/rtmp_ckipmic.h @@ -37,14 +37,14 @@ #ifndef __RTMP_CKIPMIC_H__ #define __RTMP_CKIPMIC_H__ -typedef struct _MIC_CONTEXT { +struct rt_mic_context { /* --- MMH context */ u8 CK[16]; /* the key */ u8 coefficient[16]; /* current aes counter mode coefficients */ unsigned long long accum; /* accumulated mic, reduced to u32 in final() */ u32 position; /* current position (byte offset) in message */ u8 part[4]; /* for conversion of message to u32 for mmh */ -} MIC_CONTEXT, *PMIC_CONTEXT; +}; void xor_128(u8 *a, u8 *b, u8 *out); diff --git a/drivers/staging/rt2860/rtmp_def.h b/drivers/staging/rt2860/rtmp_def.h index 92f6114b5547..c79eceb6e71c 100644 --- a/drivers/staging/rt2860/rtmp_def.h +++ b/drivers/staging/rt2860/rtmp_def.h @@ -144,7 +144,7 @@ #define APNORMAL 0x15f97 #define PSPXLINK 0x17f93 /* */ -/* RTMP_ADAPTER flags */ +/* struct rt_rtmp_adapter flags */ /* */ #define fRTMP_ADAPTER_MAP_REGISTER 0x00000001 #define fRTMP_ADAPTER_INTERRUPT_IN_USE 0x00000002 @@ -197,7 +197,7 @@ #define fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE fOP_STATUS_PCIE_DEVICE /* */ -/* RTMP_ADAPTER PSFlags : related to advanced power save. */ +/* struct rt_rtmp_adapter PSFlags : related to advanced power save. */ /* */ /* Indicate whether driver can go to sleep mode from now. This flag is useful AFTER link up */ #define fRTMP_PS_CAN_GO_SLEEP 0x00000001 diff --git a/drivers/staging/rt2860/rtmp_dot11.h b/drivers/staging/rt2860/rtmp_dot11.h index e97034375e36..4f8abd77ada5 100644 --- a/drivers/staging/rt2860/rtmp_dot11.h +++ b/drivers/staging/rt2860/rtmp_dot11.h @@ -31,7 +31,7 @@ #include "rtmp_type.h" /* 4-byte HTC field. maybe included in any frame except non-QOS data frame. The Order bit must set 1. */ -typedef struct PACKED { +struct PACKED rt_ht_control { u32 MA:1; /*management action payload exist in (QoS Null+HTC) */ u32 TRQ:1; /*sounding request */ u32 MRQ:1; /*MCS feedback. Request for a MCS feedback */ @@ -46,19 +46,19 @@ typedef struct PACKED { u32 rsv:5; /*calibration sequence */ u32 ACConstraint:1; /*feedback request */ u32 RDG:1; /*RDG / More PPDU */ -} HT_CONTROL, *PHT_CONTROL; +}; /* 2-byte QOS CONTROL field */ -typedef struct PACKED { +struct PACKED rt_qos_control { u16 TID:4; u16 EOSP:1; u16 AckPolicy:2; /*0: normal ACK 1:No ACK 2:scheduled under MTBA/PSMP 3: BA */ u16 AMsduPresent:1; u16 Txop_QueueSize:8; -} QOS_CONTROL, *PQOS_CONTROL; +}; /* 2-byte Frame control field */ -typedef struct PACKED { +struct PACKED rt_frame_control { u16 Ver:2; /* Protocol version */ u16 Type:2; /* MSDU type */ u16 SubType:4; /* MSDU subtype */ @@ -70,10 +70,10 @@ typedef struct PACKED { u16 MoreData:1; /* More data bit */ u16 Wep:1; /* Wep data */ u16 Order:1; /* Strict order expected */ -} FRAME_CONTROL, *PFRAME_CONTROL; +}; -typedef struct PACKED _HEADER_802_11 { - FRAME_CONTROL FC; +struct PACKED rt_header_802_11 { + struct rt_frame_control FC; u16 Duration; u8 Addr1[MAC_ADDR_LEN]; u8 Addr2[MAC_ADDR_LEN]; @@ -81,20 +81,20 @@ typedef struct PACKED _HEADER_802_11 { u16 Frag:4; u16 Sequence:12; u8 Octet[0]; -} HEADER_802_11, *PHEADER_802_11; +}; -typedef struct PACKED _PSPOLL_FRAME { - FRAME_CONTROL FC; +struct PACKED rt_pspoll_frame { + struct rt_frame_control FC; u16 Aid; u8 Bssid[MAC_ADDR_LEN]; u8 Ta[MAC_ADDR_LEN]; -} PSPOLL_FRAME, *PPSPOLL_FRAME; +}; -typedef struct PACKED _RTS_FRAME { - FRAME_CONTROL FC; +struct PACKED rt_rts_frame { + struct rt_frame_control FC; u16 Duration; u8 Addr1[MAC_ADDR_LEN]; u8 Addr2[MAC_ADDR_LEN]; -} RTS_FRAME, *PRTS_FRAME; +}; #endif /* __DOT11_BASE_H__ // */ diff --git a/drivers/staging/rt2860/rtmp_iface.h b/drivers/staging/rt2860/rtmp_iface.h index cafb618adf70..808c05529848 100644 --- a/drivers/staging/rt2860/rtmp_iface.h +++ b/drivers/staging/rt2860/rtmp_iface.h @@ -44,20 +44,20 @@ #include "iface/rtmp_usb.h" #endif /* RTMP_USB_SUPPORT // */ -typedef struct _INF_PCI_CONFIG_ { +struct rt_inf_pci_config { unsigned long CSRBaseAddress; /* PCI MMIO Base Address, all access will use */ unsigned int irq_num; -} INF_PCI_CONFIG; +}; -typedef struct _INF_USB_CONFIG_ { +struct rt_inf_usb_config { u8 BulkInEpAddr; /* bulk-in endpoint address */ u8 BulkOutEpAddr[6]; /* bulk-out endpoint address */ -} INF_USB_CONFIG; +}; -typedef struct _INF_RBUS_CONFIG_ { +struct rt_inf_rbus_config { unsigned long csr_addr; unsigned int irq; -} INF_RBUS_CONFIG; +}; typedef enum _RTMP_INF_TYPE_ { RTMP_DEV_INF_UNKNOWN = 0, @@ -67,9 +67,9 @@ typedef enum _RTMP_INF_TYPE_ { } RTMP_INF_TYPE; typedef union _RTMP_INF_CONFIG_ { - struct _INF_PCI_CONFIG_ pciConfig; - struct _INF_USB_CONFIG_ usbConfig; - struct _INF_RBUS_CONFIG_ rbusConfig; + struct rt_inf_pci_config pciConfig; + struct rt_inf_usb_config usbConfig; + struct rt_inf_rbus_config rbusConfig; } RTMP_INF_CONFIG; #endif /* __RTMP_IFACE_H__ // */ diff --git a/drivers/staging/rt2860/rtmp_mcu.h b/drivers/staging/rt2860/rtmp_mcu.h index 378f01ecc282..d0987e55cdad 100644 --- a/drivers/staging/rt2860/rtmp_mcu.h +++ b/drivers/staging/rt2860/rtmp_mcu.h @@ -38,11 +38,11 @@ #ifndef __RTMP_MCU_H__ #define __RTMP_MCU_H__ -int RtmpAsicEraseFirmware(IN PRTMP_ADAPTER pAd); +int RtmpAsicEraseFirmware(struct rt_rtmp_adapter *pAd); -int RtmpAsicLoadFirmware(IN PRTMP_ADAPTER pAd); +int RtmpAsicLoadFirmware(struct rt_rtmp_adapter *pAd); -int RtmpAsicSendCommandToMcu(IN PRTMP_ADAPTER pAd, +int RtmpAsicSendCommandToMcu(struct rt_rtmp_adapter *pAd, u8 Command, u8 Token, u8 Arg0, u8 Arg1); diff --git a/drivers/staging/rt2860/rtmp_os.h b/drivers/staging/rt2860/rtmp_os.h index cff01289de95..94c30c8ca662 100644 --- a/drivers/staging/rt2860/rtmp_os.h +++ b/drivers/staging/rt2860/rtmp_os.h @@ -48,14 +48,14 @@ The definition of this data structure may various depends on different OS. Use it carefully. */ -typedef struct _RTMP_OS_NETDEV_OP_HOOK_ { +struct rt_rtmp_os_netdev_op_hook { const struct net_device_ops *netdev_ops; void *priv; int priv_flags; unsigned char devAddr[6]; unsigned char devName[16]; unsigned char needProtcted; -} RTMP_OS_NETDEV_OP_HOOK, *PRTMP_OS_NETDEV_OP_HOOK; +}; typedef enum _RTMP_TASK_STATUS_ { RTMP_TASK_STAT_UNKNOWN = 0, @@ -66,7 +66,7 @@ typedef enum _RTMP_TASK_STATUS_ { #define RTMP_TASK_CAN_DO_INSERT (RTMP_TASK_STAT_INITED |RTMP_TASK_STAT_RUNNING) #define RTMP_OS_TASK_NAME_LEN 16 -typedef struct _RTMP_OS_TASK_ { +struct rt_rtmp_os_task { char taskName[RTMP_OS_TASK_NAME_LEN]; void *priv; /*unsigned long taskFlags; */ @@ -82,7 +82,7 @@ typedef struct _RTMP_OS_TASK_ { wait_queue_head_t kthread_q; BOOLEAN kthread_running; #endif -} RTMP_OS_TASK; +}; int RtmpOSIRQRequest(struct net_device *pNetDev); int RtmpOSIRQRelease(struct net_device *pNetDev); diff --git a/drivers/staging/rt2860/rtmp_timer.h b/drivers/staging/rt2860/rtmp_timer.h index c81e507dbadb..28b8ac6e8352 100644 --- a/drivers/staging/rt2860/rtmp_timer.h +++ b/drivers/staging/rt2860/rtmp_timer.h @@ -61,7 +61,7 @@ typedef void(*RTMP_TIMER_TASK_HANDLE) (void *SystemSpecific1, void *SystemSpecific3); #endif /* RTMP_TIMER_TASK_SUPPORT // */ -typedef struct _RALINK_TIMER_STRUCT { +struct rt_ralink_timer { struct timer_list TimerObj; /* Ndis Timer object */ BOOLEAN Valid; /* Set to True when call RTMPInitTimer */ BOOLEAN State; /* True if timer cancelled */ @@ -73,32 +73,32 @@ typedef struct _RALINK_TIMER_STRUCT { RTMP_TIMER_TASK_HANDLE handle; void *pAd; #endif /* RTMP_TIMER_TASK_SUPPORT // */ -} RALINK_TIMER_STRUCT, *PRALINK_TIMER_STRUCT; +}; #ifdef RTMP_TIMER_TASK_SUPPORT -typedef struct _RTMP_TIMER_TASK_ENTRY_ { - RALINK_TIMER_STRUCT *pRaTimer; - struct _RTMP_TIMER_TASK_ENTRY_ *pNext; -} RTMP_TIMER_TASK_ENTRY; +struct rt_rtmp_timer_task_entry { + struct rt_ralink_timer *pRaTimer; + struct rt_rtmp_timer_task_entry *pNext; +}; #define TIMER_QUEUE_SIZE_MAX 128 -typedef struct _RTMP_TIMER_TASK_QUEUE_ { +struct rt_rtmp_timer_task_queue { unsigned int status; unsigned char *pTimerQPoll; - RTMP_TIMER_TASK_ENTRY *pQPollFreeList; - RTMP_TIMER_TASK_ENTRY *pQHead; - RTMP_TIMER_TASK_ENTRY *pQTail; -} RTMP_TIMER_TASK_QUEUE; + struct rt_rtmp_timer_task_entry *pQPollFreeList; + struct rt_rtmp_timer_task_entry *pQHead; + struct rt_rtmp_timer_task_entry *pQTail; +}; #define BUILD_TIMER_FUNCTION(_func) \ void rtmp_timer_##_func(unsigned long data) \ { \ - PRALINK_TIMER_STRUCT _pTimer = (PRALINK_TIMER_STRUCT)data; \ - RTMP_TIMER_TASK_ENTRY *_pQNode; \ - RTMP_ADAPTER *_pAd; \ + struct rt_ralink_timer *_pTimer = (struct rt_ralink_timer *)data; \ + struct rt_rtmp_timer_task_entry *_pQNode; \ + struct rt_rtmp_adapter *_pAd; \ \ _pTimer->handle = _func; \ - _pAd = (RTMP_ADAPTER *)_pTimer->pAd; \ + _pAd = (struct rt_rtmp_adapter *)_pTimer->pAd; \ _pQNode = RtmpTimerQInsert(_pAd, _pTimer); \ if ((_pQNode == NULL) && (_pAd->TimerQ.status & RTMP_TASK_CAN_DO_INSERT)) \ RTMP_OS_Add_Timer(&_pTimer->TimerObj, OS_HZ); \ @@ -107,7 +107,7 @@ void rtmp_timer_##_func(unsigned long data) \ #define BUILD_TIMER_FUNCTION(_func) \ void rtmp_timer_##_func(unsigned long data) \ { \ - PRALINK_TIMER_STRUCT pTimer = (PRALINK_TIMER_STRUCT) data; \ + struct rt_ralink_timer *pTimer = (struct rt_ralink_timer *)data; \ \ _func(NULL, (void *)pTimer->cookie, NULL, pTimer); \ if (pTimer->Repeat) \ diff --git a/drivers/staging/rt2860/rtmp_type.h b/drivers/staging/rt2860/rtmp_type.h index 8de142840d39..d9bb2d64c8b8 100644 --- a/drivers/staging/rt2860/rtmp_type.h +++ b/drivers/staging/rt2860/rtmp_type.h @@ -55,33 +55,33 @@ typedef union _LARGE_INTEGER { /* */ /* Register set pair for initialzation register set definition */ /* */ -typedef struct _RTMP_REG_PAIR { +struct rt_rtmp_reg_pair { unsigned long Register; unsigned long Value; -} RTMP_REG_PAIR, *PRTMP_REG_PAIR; +}; -typedef struct _REG_PAIR { +struct rt_reg_pair { u8 Register; u8 Value; -} REG_PAIR, *PREG_PAIR; +}; /* */ /* Register set pair for initialzation register set definition */ /* */ -typedef struct _RTMP_RF_REGS { +struct rt_rtmp_rf_regs { u8 Channel; unsigned long R1; unsigned long R2; unsigned long R3; unsigned long R4; -} RTMP_RF_REGS, *PRTMP_RF_REGS; +}; -typedef struct _FREQUENCY_ITEM { +struct rt_frequency_item { u8 Channel; u8 N; u8 R; u8 K; -} FREQUENCY_ITEM, *PFREQUENCY_ITEM; +}; #define STATUS_SUCCESS 0x00 #define STATUS_UNSUCCESSFUL 0x01 diff --git a/drivers/staging/rt2860/rtusb_io.h b/drivers/staging/rt2860/rtusb_io.h index 547f6ab4ef32..64a2fe435284 100644 --- a/drivers/staging/rt2860/rtusb_io.h +++ b/drivers/staging/rt2860/rtusb_io.h @@ -78,27 +78,29 @@ /*CMDTHREAD_MULTI_WRITE_MAC */ /*CMDTHREAD_VENDOR_EEPROM_READ */ /*CMDTHREAD_VENDOR_EEPROM_WRITE */ -typedef struct _CMDHandler_TLV { +struct rt_cmdhandler_tlv { u16 Offset; u16 Length; u8 DataFirst; -} CMDHandler_TLV, *PCMDHandler_TLV; +}; -typedef struct _CmdQElmt { +struct rt_cmdqelmt; + +struct rt_cmdqelmt { u32 command; void *buffer; unsigned long bufferlength; BOOLEAN CmdFromNdis; BOOLEAN SetOperation; - struct _CmdQElmt *next; -} CmdQElmt, *PCmdQElmt; + struct rt_cmdqelmt *next; +}; -typedef struct _CmdQ { +struct rt_cmdq { u32 size; - CmdQElmt *head; - CmdQElmt *tail; + struct rt_cmdqelmt *head; + struct rt_cmdqelmt *tail; u32 CmdQState; -} CmdQ, *PCmdQ; +}; #define EnqueueCmd(cmdq, cmdqelmt) \ { \ @@ -118,17 +120,17 @@ typedef struct _CmdQ { ******************************************************************************/ /* reset MAC of a station entry to 0xFFFFFFFFFFFF */ #define RTMP_STA_ENTRY_MAC_RESET(pAd, Wcid) \ - { RT_SET_ASIC_WCID SetAsicWcid; \ + { struct rt_set_asic_wcid SetAsicWcid; \ SetAsicWcid.WCID = Wcid; \ SetAsicWcid.SetTid = 0xffffffff; \ SetAsicWcid.DeleteTid = 0xffffffff; \ RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_ASIC_WCID, \ - &SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); } + &SetAsicWcid, sizeof(struct rt_set_asic_wcid)); } /* add this entry into ASIC RX WCID search table */ #define RTMP_STA_ENTRY_ADD(pAd, pEntry) \ RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_CLIENT_MAC_ENTRY, \ - pEntry, sizeof(MAC_TABLE_ENTRY)); + pEntry, sizeof(struct rt_mac_table_entry)); /* add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet */ /* Set MAC register value according operation mode */ @@ -144,7 +146,7 @@ typedef struct _CmdQ { #define RTMP_STA_SECURITY_INFO_ADD(pAd, apidx, KeyID, pEntry) \ { RTMP_STA_ENTRY_MAC_RESET(pAd, pEntry->Aid); \ if (pEntry->Aid >= 1) { \ - RT_SET_ASIC_WCID_ATTRI SetAsicWcidAttri; \ + struct rt_set_asic_wcid_attri SetAsicWcidAttri; \ SetAsicWcidAttri.WCID = pEntry->Aid; \ if ((pEntry->AuthMode <= Ndis802_11AuthModeAutoSwitch) && \ (pEntry->WepStatus == Ndis802_11Encryption1Enabled)) \ @@ -158,26 +160,26 @@ typedef struct _CmdQ { else SetAsicWcidAttri.Cipher = 0; \ DBGPRINT(RT_DEBUG_TRACE, ("aid cipher = %ld\n",SetAsicWcidAttri.Cipher)); \ RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_ASIC_WCID_CIPHER, \ - &SetAsicWcidAttri, sizeof(RT_SET_ASIC_WCID_ATTRI)); } } + &SetAsicWcidAttri, sizeof(struct rt_set_asic_wcid_attri)); } } /* Insert the BA bitmap to ASIC for the Wcid entry */ #define RTMP_ADD_BA_SESSION_TO_ASIC(_pAd, _Aid, _TID) \ do{ \ - RT_SET_ASIC_WCID SetAsicWcid; \ + struct rt_set_asic_wcid SetAsicWcid; \ SetAsicWcid.WCID = (_Aid); \ SetAsicWcid.SetTid = (0x10000<<(_TID)); \ SetAsicWcid.DeleteTid = 0xffffffff; \ - RTUSBEnqueueInternalCmd((_pAd), CMDTHREAD_SET_ASIC_WCID, &SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); \ + RTUSBEnqueueInternalCmd((_pAd), CMDTHREAD_SET_ASIC_WCID, &SetAsicWcid, sizeof(struct rt_set_asic_wcid)); \ }while(0) /* Remove the BA bitmap from ASIC for the Wcid entry */ #define RTMP_DEL_BA_SESSION_FROM_ASIC(_pAd, _Wcid, _TID) \ do{ \ - RT_SET_ASIC_WCID SetAsicWcid; \ + struct rt_set_asic_wcid SetAsicWcid; \ SetAsicWcid.WCID = (_Wcid); \ SetAsicWcid.SetTid = (0xffffffff); \ SetAsicWcid.DeleteTid = (0x10000<<(_TID) ); \ - RTUSBEnqueueInternalCmd((_pAd), CMDTHREAD_SET_ASIC_WCID, &SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); \ + RTUSBEnqueueInternalCmd((_pAd), CMDTHREAD_SET_ASIC_WCID, &SetAsicWcid, sizeof(struct rt_set_asic_wcid)); \ }while(0) #endif /* __RTUSB_IO_H__ // */ diff --git a/drivers/staging/rt2860/spectrum.h b/drivers/staging/rt2860/spectrum.h index b4e9fbc2fd81..648fd632b606 100644 --- a/drivers/staging/rt2860/spectrum.h +++ b/drivers/staging/rt2860/spectrum.h @@ -31,7 +31,7 @@ #include "rtmp_type.h" #include "spectrum_def.h" -char RTMP_GetTxPwr(IN PRTMP_ADAPTER pAd, IN HTTRANSMIT_SETTING HTTxMode); +char RTMP_GetTxPwr(struct rt_rtmp_adapter *pAd, IN HTTRANSMIT_SETTING HTTxMode); /* ========================================================================== @@ -45,7 +45,7 @@ char RTMP_GetTxPwr(IN PRTMP_ADAPTER pAd, IN HTTRANSMIT_SETTING HTTxMode); Return : None. ========================================================================== */ -void MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd, +void MakeMeasurementReqFrame(struct rt_rtmp_adapter *pAd, u8 *pOutBuffer, unsigned long *pFrameLen, u8 TotalLen, @@ -68,7 +68,7 @@ void MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -void EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd, +void EnqueueMeasurementRep(struct rt_rtmp_adapter *pAd, u8 *pDA, u8 DialogToken, u8 MeasureToken, @@ -88,7 +88,7 @@ void EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -void EnqueueTPCReq(IN PRTMP_ADAPTER pAd, u8 *pDA, u8 DialogToken); +void EnqueueTPCReq(struct rt_rtmp_adapter *pAd, u8 *pDA, u8 DialogToken); /* ========================================================================== @@ -102,7 +102,7 @@ void EnqueueTPCReq(IN PRTMP_ADAPTER pAd, u8 *pDA, u8 DialogToken); Return : None. ========================================================================== */ -void EnqueueTPCRep(IN PRTMP_ADAPTER pAd, +void EnqueueTPCRep(struct rt_rtmp_adapter *pAd, u8 *pDA, u8 DialogToken, u8 TxPwr, u8 LinkMargin); @@ -120,7 +120,7 @@ void EnqueueTPCRep(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -void EnqueueChSwAnn(IN PRTMP_ADAPTER pAd, +void EnqueueChSwAnn(struct rt_rtmp_adapter *pAd, u8 *pDA, u8 ChSwMode, u8 NewCh); /* @@ -135,7 +135,7 @@ void EnqueueChSwAnn(IN PRTMP_ADAPTER pAd, Return : None. ========================================================================== */ -void PeerSpectrumAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); +void PeerSpectrumAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem); /* ========================================================================== @@ -146,44 +146,44 @@ void PeerSpectrumAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); Return : None. ========================================================================== */ -int Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, char *arg); +int Set_MeasureReq_Proc(struct rt_rtmp_adapter *pAd, char *arg); -int Set_TpcReq_Proc(IN PRTMP_ADAPTER pAd, char *arg); +int Set_TpcReq_Proc(struct rt_rtmp_adapter *pAd, char *arg); -int Set_PwrConstraint(IN PRTMP_ADAPTER pAd, char *arg); +int Set_PwrConstraint(struct rt_rtmp_adapter *pAd, char *arg); -void MeasureReqTabInit(IN PRTMP_ADAPTER pAd); +void MeasureReqTabInit(struct rt_rtmp_adapter *pAd); -void MeasureReqTabExit(IN PRTMP_ADAPTER pAd); +void MeasureReqTabExit(struct rt_rtmp_adapter *pAd); -PMEASURE_REQ_ENTRY MeasureReqLookUp(IN PRTMP_ADAPTER pAd, u8 DialogToken); +struct rt_measure_req_entry *MeasureReqLookUp(struct rt_rtmp_adapter *pAd, u8 DialogToken); -PMEASURE_REQ_ENTRY MeasureReqInsert(IN PRTMP_ADAPTER pAd, u8 DialogToken); +struct rt_measure_req_entry *MeasureReqInsert(struct rt_rtmp_adapter *pAd, u8 DialogToken); -void MeasureReqDelete(IN PRTMP_ADAPTER pAd, u8 DialogToken); +void MeasureReqDelete(struct rt_rtmp_adapter *pAd, u8 DialogToken); -void InsertChannelRepIE(IN PRTMP_ADAPTER pAd, +void InsertChannelRepIE(struct rt_rtmp_adapter *pAd, u8 *pFrameBuf, unsigned long *pFrameLen, char *pCountry, u8 RegulatoryClass); -void InsertTpcReportIE(IN PRTMP_ADAPTER pAd, +void InsertTpcReportIE(struct rt_rtmp_adapter *pAd, u8 *pFrameBuf, unsigned long *pFrameLen, u8 TxPwr, u8 LinkMargin); -void InsertDialogToken(IN PRTMP_ADAPTER pAd, +void InsertDialogToken(struct rt_rtmp_adapter *pAd, u8 *pFrameBuf, unsigned long *pFrameLen, u8 DialogToken); -void TpcReqTabInit(IN PRTMP_ADAPTER pAd); +void TpcReqTabInit(struct rt_rtmp_adapter *pAd); -void TpcReqTabExit(IN PRTMP_ADAPTER pAd); +void TpcReqTabExit(struct rt_rtmp_adapter *pAd); -void NotifyChSwAnnToPeerAPs(IN PRTMP_ADAPTER pAd, +void NotifyChSwAnnToPeerAPs(struct rt_rtmp_adapter *pAd, u8 *pRA, u8 *pTA, u8 ChSwMode, u8 Channel); -void RguClass_BuildBcnChList(IN PRTMP_ADAPTER pAd, +void RguClass_BuildBcnChList(struct rt_rtmp_adapter *pAd, u8 *pBuf, unsigned long *pBufLen); #endif /* __SPECTRUM_H__ // */ diff --git a/drivers/staging/rt2860/spectrum_def.h b/drivers/staging/rt2860/spectrum_def.h index 30678b93fb83..8ffcfb0d04f8 100644 --- a/drivers/staging/rt2860/spectrum_def.h +++ b/drivers/staging/rt2860/spectrum_def.h @@ -53,44 +53,48 @@ #define TPC_DIALOGTOKEN_HASH_INDEX(_DialogToken) ((_DialogToken) % MAX_HASH_TPC_REQ_TAB_SIZE) #define MQ_DIALOGTOKEN_HASH_INDEX(_DialogToken) ((_DialogToken) % MAX_MEASURE_REQ_TAB_SIZE) -typedef struct _MEASURE_REQ_ENTRY { - struct _MEASURE_REQ_ENTRY *pNext; +struct rt_measure_req_entry; + +struct rt_measure_req_entry { + struct rt_measure_req_entry *pNext; unsigned long lastTime; BOOLEAN Valid; u8 DialogToken; u8 MeasureDialogToken[3]; /* 0:basic measure, 1: CCA measure, 2: RPI_Histogram measure. */ -} MEASURE_REQ_ENTRY, *PMEASURE_REQ_ENTRY; +}; -typedef struct _MEASURE_REQ_TAB { +struct rt_measure_req_tab { u8 Size; - PMEASURE_REQ_ENTRY Hash[MAX_HASH_MEASURE_REQ_TAB_SIZE]; - MEASURE_REQ_ENTRY Content[MAX_MEASURE_REQ_TAB_SIZE]; -} MEASURE_REQ_TAB, *PMEASURE_REQ_TAB; + struct rt_measure_req_entry *Hash[MAX_HASH_MEASURE_REQ_TAB_SIZE]; + struct rt_measure_req_entry Content[MAX_MEASURE_REQ_TAB_SIZE]; +}; + +struct rt_tpc_req_entry; -typedef struct _TPC_REQ_ENTRY { - struct _TPC_REQ_ENTRY *pNext; +struct rt_tpc_req_entry { + struct rt_tpc_req_entry *pNext; unsigned long lastTime; BOOLEAN Valid; u8 DialogToken; -} TPC_REQ_ENTRY, *PTPC_REQ_ENTRY; +}; -typedef struct _TPC_REQ_TAB { +struct rt_tpc_req_tab { u8 Size; - PTPC_REQ_ENTRY Hash[MAX_HASH_TPC_REQ_TAB_SIZE]; - TPC_REQ_ENTRY Content[MAX_TPC_REQ_TAB_SIZE]; -} TPC_REQ_TAB, *PTPC_REQ_TAB; + struct rt_tpc_req_entry *Hash[MAX_HASH_TPC_REQ_TAB_SIZE]; + struct rt_tpc_req_entry Content[MAX_TPC_REQ_TAB_SIZE]; +}; /* The regulatory information */ -typedef struct _DOT11_CHANNEL_SET { +struct rt_dot11_channel_set { u8 NumberOfChannels; u8 MaxTxPwr; u8 ChannelList[16]; -} DOT11_CHANNEL_SET, *PDOT11_CHANNEL_SET; +}; -typedef struct _DOT11_REGULATORY_INFORMATION { +struct rt_dot11_regulatory_information { u8 RegulatoryClass; - DOT11_CHANNEL_SET ChannelSet; -} DOT11_REGULATORY_INFORMATION, *PDOT11_REGULATORY_INFORMATION; + struct rt_dot11_channel_set ChannelSet; +}; #define RM_TPC_REQ 0 #define RM_MEASURE_REQ 1 @@ -101,16 +105,16 @@ typedef struct _DOT11_REGULATORY_INFORMATION { #define RM_CH_LOAD 3 #define RM_NOISE_HISTOGRAM 4 -typedef struct PACKED _TPC_REPORT_INFO { +struct PACKED rt_tpc_report_info { u8 TxPwr; u8 LinkMargin; -} TPC_REPORT_INFO, *PTPC_REPORT_INFO; +}; -typedef struct PACKED _CH_SW_ANN_INFO { +struct PACKED rt_ch_sw_ann_info { u8 ChSwMode; u8 Channel; u8 ChSwCnt; -} CH_SW_ANN_INFO, *PCH_SW_ANN_INFO; +}; typedef union PACKED _MEASURE_REQ_MODE { struct PACKED { @@ -124,18 +128,18 @@ typedef union PACKED _MEASURE_REQ_MODE { u8 word; } MEASURE_REQ_MODE, *PMEASURE_REQ_MODE; -typedef struct PACKED _MEASURE_REQ { +struct PACKED rt_measure_req { u8 ChNum; u64 MeasureStartTime; u16 MeasureDuration; -} MEASURE_REQ, *PMEASURE_REQ; +}; -typedef struct PACKED _MEASURE_REQ_INFO { +struct PACKED rt_measure_req_info { u8 Token; MEASURE_REQ_MODE ReqMode; u8 ReqType; u8 Oct[0]; -} MEASURE_REQ_INFO, *PMEASURE_REQ_INFO; +}; typedef union PACKED _MEASURE_BASIC_REPORT_MAP { struct PACKED { @@ -150,26 +154,26 @@ typedef union PACKED _MEASURE_BASIC_REPORT_MAP { u8 word; } MEASURE_BASIC_REPORT_MAP, *PMEASURE_BASIC_REPORT_MAP; -typedef struct PACKED _MEASURE_BASIC_REPORT { +struct PACKED rt_measure_basic_report { u8 ChNum; u64 MeasureStartTime; u16 MeasureDuration; MEASURE_BASIC_REPORT_MAP Map; -} MEASURE_BASIC_REPORT, *PMEASURE_BASIC_REPORT; +}; -typedef struct PACKED _MEASURE_CCA_REPORT { +struct PACKED rt_measure_cca_report { u8 ChNum; u64 MeasureStartTime; u16 MeasureDuration; u8 CCA_Busy_Fraction; -} MEASURE_CCA_REPORT, *PMEASURE_CCA_REPORT; +}; -typedef struct PACKED _MEASURE_RPI_REPORT { +struct PACKED rt_measure_rpi_report { u8 ChNum; u64 MeasureStartTime; u16 MeasureDuration; u8 RPI_Density[8]; -} MEASURE_RPI_REPORT, *PMEASURE_RPI_REPORT; +}; typedef union PACKED _MEASURE_REPORT_MODE { struct PACKED { @@ -181,18 +185,18 @@ typedef union PACKED _MEASURE_REPORT_MODE { u8 word; } MEASURE_REPORT_MODE, *PMEASURE_REPORT_MODE; -typedef struct PACKED _MEASURE_REPORT_INFO { +struct PACKED rt_measure_report_info { u8 Token; u8 ReportMode; u8 ReportType; u8 Octect[0]; -} MEASURE_REPORT_INFO, *PMEASURE_REPORT_INFO; +}; -typedef struct PACKED _QUIET_INFO { +struct PACKED rt_quiet_info { u8 QuietCnt; u8 QuietPeriod; u16 QuietDuration; u16 QuietOffset; -} QUIET_INFO, *PQUIET_INFO; +}; #endif /* __SPECTRUM_DEF_H__ // */ diff --git a/drivers/staging/rt2860/sta/assoc.c b/drivers/staging/rt2860/sta/assoc.c index f2192ff16577..733bc083a6a7 100644 --- a/drivers/staging/rt2860/sta/assoc.c +++ b/drivers/staging/rt2860/sta/assoc.c @@ -73,8 +73,8 @@ u8 Ccx2IeInfo[] = { 0x00, 0x40, 0x96, 0x03, 0x02 }; ========================================================================== */ -void AssocStateMachineInit(IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE * S, OUT STATE_MACHINE_FUNC Trans[]) +void AssocStateMachineInit(struct rt_rtmp_adapter *pAd, + struct rt_state_machine *S, OUT STATE_MACHINE_FUNC Trans[]) { StateMachineInit(S, Trans, MAX_ASSOC_STATE, MAX_ASSOC_MSG, (STATE_MACHINE_FUNC) Drop, ASSOC_IDLE, @@ -169,7 +169,7 @@ void AssocTimeout(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)FunctionContext; /* Do nothing if the driver is starting halt state. */ /* This might happen when timer already been fired before cancel timer with mlmehalt */ @@ -197,7 +197,7 @@ void ReassocTimeout(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)FunctionContext; /* Do nothing if the driver is starting halt state. */ /* This might happen when timer already been fired before cancel timer with mlmehalt */ @@ -225,7 +225,7 @@ void DisassocTimeout(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)FunctionContext; /* Do nothing if the driver is starting halt state. */ /* This might happen when timer already been fired before cancel timer with mlmehalt */ @@ -259,10 +259,10 @@ void DisassocTimeout(void *SystemSpecific1, ========================================================================== */ -void MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeAssocReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 ApAddr[6]; - HEADER_802_11 AssocHdr; + struct rt_header_802_11 AssocHdr; u8 WmeIe[9] = { IE_VENDOR_SPECIFIC, 0x07, 0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00 }; @@ -306,7 +306,7 @@ void MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } /* Add by James 03/06/27 */ pAd->StaCfg.AssocInfo.Length = - sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); + sizeof(struct rt_ndis_802_11_association_information); /* Association don't need to report MAC address */ pAd->StaCfg.AssocInfo.AvailableRequestFixedIEs = NDIS_802_11_AI_REQFI_CAPABILITIES | @@ -318,7 +318,7 @@ void MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /* Only reassociate need this */ /*COPY_MAC_ADDR(pAd->StaCfg.AssocInfo.RequestFixedIEs.CurrentAPAddress, ApAddr); */ pAd->StaCfg.AssocInfo.OffsetRequestIEs = - sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); + sizeof(struct rt_ndis_802_11_association_information); NdisZeroMemory(pAd->StaCfg.ReqVarIEs, MAX_VIE_LEN); /* First add SSID */ @@ -355,7 +355,7 @@ void MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /* Build basic frame first */ MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &AssocHdr, + sizeof(struct rt_header_802_11), &AssocHdr, 2, &CapabilityInfo, 2, &ListenIntv, 1, &SsidIe, @@ -440,10 +440,10 @@ void MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if (pAd->MlmeAux.APEdcaParm.bValid) { if (pAd->CommonCfg.bAPSDCapable && pAd->MlmeAux.APEdcaParm.bAPSDCapable) { - QBSS_STA_INFO_PARM QosInfo; + struct rt_qbss_sta_info_parm QosInfo; NdisZeroMemory(&QosInfo, - sizeof(QBSS_STA_INFO_PARM)); + sizeof(struct rt_qbss_sta_info_parm)); QosInfo.UAPSD_AC_BE = pAd->CommonCfg.bAPSDAC_BE; QosInfo.UAPSD_AC_BK = pAd->CommonCfg.bAPSDAC_BK; QosInfo.UAPSD_AC_VI = pAd->CommonCfg.bAPSDAC_VI; @@ -589,10 +589,10 @@ void MlmeAssocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeReassocReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 ApAddr[6]; - HEADER_802_11 ReassocHdr; + struct rt_header_802_11 ReassocHdr; u8 WmeIe[9] = { IE_VENDOR_SPECIFIC, 0x07, 0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00 }; @@ -638,7 +638,7 @@ void MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ("ASSOC - Send RE-ASSOC request...\n")); MgtMacHeaderInit(pAd, &ReassocHdr, SUBTYPE_REASSOC_REQ, 0, ApAddr, ApAddr); - MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(HEADER_802_11), + MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(struct rt_header_802_11), &ReassocHdr, 2, &CapabilityInfo, 2, &ListenIntv, MAC_ADDR_LEN, ApAddr, 1, &SsidIe, 1, &pAd->MlmeAux.SsidLen, @@ -659,10 +659,10 @@ void MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if (pAd->MlmeAux.APEdcaParm.bValid) { if (pAd->CommonCfg.bAPSDCapable && pAd->MlmeAux.APEdcaParm.bAPSDCapable) { - QBSS_STA_INFO_PARM QosInfo; + struct rt_qbss_sta_info_parm QosInfo; NdisZeroMemory(&QosInfo, - sizeof(QBSS_STA_INFO_PARM)); + sizeof(struct rt_qbss_sta_info_parm)); QosInfo.UAPSD_AC_BE = pAd->CommonCfg.bAPSDAC_BE; QosInfo.UAPSD_AC_BK = pAd->CommonCfg.bAPSDAC_BK; QosInfo.UAPSD_AC_VI = pAd->CommonCfg.bAPSDAC_VI; @@ -765,11 +765,11 @@ void MlmeReassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void MlmeDisassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeDisassocReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { - PMLME_DISASSOC_REQ_STRUCT pDisassocReq; - HEADER_802_11 DisassocHdr; - PHEADER_802_11 pDisassocHdr; + struct rt_mlme_disassoc_req *pDisassocReq; + struct rt_header_802_11 DisassocHdr; + struct rt_header_802_11 * pDisassocHdr; u8 *pOutBuffer = NULL; unsigned long FrameLen = 0; int NStatus; @@ -778,7 +778,7 @@ void MlmeDisassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) u16 Status; /* skip sanity check */ - pDisassocReq = (PMLME_DISASSOC_REQ_STRUCT) (Elem->Msg); + pDisassocReq = (struct rt_mlme_disassoc_req *)(Elem->Msg); NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { @@ -801,14 +801,14 @@ void MlmeDisassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pDisassocReq->Reason)); MgtMacHeaderInit(pAd, &DisassocHdr, SUBTYPE_DISASSOC, 0, pDisassocReq->Addr, pDisassocReq->Addr); /* patch peap ttls switching issue */ MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &DisassocHdr, + sizeof(struct rt_header_802_11), &DisassocHdr, 2, &pDisassocReq->Reason, END_OF_ARGS); MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); /* To patch Instance and Buffalo(N) AP */ /* Driver has to send deauth to Instance AP, but Buffalo(N) needs to send disassoc to reset Authenticator's state machine */ /* Therefore, we send both of them. */ - pDisassocHdr = (PHEADER_802_11) pOutBuffer; + pDisassocHdr = (struct rt_header_802_11 *) pOutBuffer; pDisassocHdr->FC.SubType = SUBTYPE_DEAUTH; MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); @@ -835,7 +835,7 @@ void MlmeDisassocReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void PeerAssocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerAssocRspAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 CapabilityInfo, Status, Aid; u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES], SupRateLen; @@ -843,9 +843,9 @@ void PeerAssocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) u8 Addr2[MAC_ADDR_LEN]; BOOLEAN TimerCancelled; u8 CkipFlag; - EDCA_PARM EdcaParm; - HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ + struct rt_edca_parm EdcaParm; + struct rt_ht_capability_ie HtCapability; + struct rt_add_ht_info_ie AddHtInfo; /* AP might use this additional ht info IE */ u8 HtCapabilityLen = 0; u8 AddHtInfoLen; u8 NewExtChannelOffset = 0xff; @@ -924,7 +924,7 @@ void PeerAssocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void PeerReassocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerReassocRspAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 CapabilityInfo; u16 Status; @@ -934,9 +934,9 @@ void PeerReassocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) u8 Addr2[MAC_ADDR_LEN]; u8 CkipFlag; BOOLEAN TimerCancelled; - EDCA_PARM EdcaParm; - HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ + struct rt_edca_parm EdcaParm; + struct rt_ht_capability_ie HtCapability; + struct rt_add_ht_info_ie AddHtInfo; /* AP might use this additional ht info IE */ u8 HtCapabilityLen; u8 AddHtInfoLen; u8 NewExtChannelOffset = 0xff; @@ -994,7 +994,7 @@ void PeerReassocRspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void AssocPostProc(IN PRTMP_ADAPTER pAd, u8 *pAddr2, u16 CapabilityInfo, u16 Aid, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, IN PEDCA_PARM pEdcaParm, IN HT_CAPABILITY_IE * pHtCapability, u8 HtCapabilityLen, IN ADD_HT_INFO_IE * pAddHtInfo) /* AP might use this additional ht info IE */ +void AssocPostProc(struct rt_rtmp_adapter *pAd, u8 *pAddr2, u16 CapabilityInfo, u16 Aid, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, struct rt_edca_parm *pEdcaParm, struct rt_ht_capability_ie * pHtCapability, u8 HtCapabilityLen, struct rt_add_ht_info_ie * pAddHtInfo) /* AP might use this additional ht info IE */ { unsigned long Idx; @@ -1029,7 +1029,7 @@ void AssocPostProc(IN PRTMP_ADAPTER pAd, u8 *pAddr2, u16 CapabilityInfo, u16 Aid } - NdisMoveMemory(&pAd->MlmeAux.APEdcaParm, pEdcaParm, sizeof(EDCA_PARM)); + NdisMoveMemory(&pAd->MlmeAux.APEdcaParm, pEdcaParm, sizeof(struct rt_edca_parm)); /* filter out un-supported rates */ pAd->MlmeAux.SupRateLen = SupRateLen; @@ -1069,7 +1069,7 @@ void AssocPostProc(IN PRTMP_ADAPTER pAd, u8 *pAddr2, u16 CapabilityInfo, u16 Aid && (pAd->ScanTab.BssEntry[Idx].VarIELen != 0)) { u8 *pVIE; u16 len; - PEID_STRUCT pEid; + struct rt_eid * pEid; pVIE = pAd->ScanTab.BssEntry[Idx].VarIEs; len = pAd->ScanTab.BssEntry[Idx].VarIELen; @@ -1079,7 +1079,7 @@ void AssocPostProc(IN PRTMP_ADAPTER pAd, u8 *pAddr2, u16 CapabilityInfo, u16 Aid RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_CAN_GO_SLEEP); while (len > 0) { - pEid = (PEID_STRUCT) pVIE; + pEid = (struct rt_eid *) pVIE; /* For WPA/WPAPSK */ if ((pEid->Eid == IE_WPA) && @@ -1144,7 +1144,7 @@ void AssocPostProc(IN PRTMP_ADAPTER pAd, u8 *pAddr2, u16 CapabilityInfo, u16 Aid ========================================================================== */ -void PeerDisassocAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerDisassocAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 Addr2[MAC_ADDR_LEN]; u16 Reason; @@ -1189,7 +1189,7 @@ void PeerDisassocAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void AssocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void AssocTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 Status; DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - AssocTimeoutAction\n")); @@ -1207,7 +1207,7 @@ void AssocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void ReassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void ReassocTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 Status; DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - ReassocTimeoutAction\n")); @@ -1225,7 +1225,7 @@ void ReassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void DisassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void DisassocTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 Status; DBGPRINT(RT_DEBUG_TRACE, ("ASSOC - DisassocTimeoutAction\n")); @@ -1235,7 +1235,7 @@ void DisassocTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) &Status); } -void InvalidStateWhenAssoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void InvalidStateWhenAssoc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 Status; DBGPRINT(RT_DEBUG_TRACE, @@ -1246,7 +1246,7 @@ void InvalidStateWhenAssoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_ASSOC_CONF, 2, &Status); } -void InvalidStateWhenReassoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void InvalidStateWhenReassoc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 Status; DBGPRINT(RT_DEBUG_TRACE, @@ -1257,8 +1257,8 @@ void InvalidStateWhenReassoc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, &Status); } -void InvalidStateWhenDisassociate(IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM * Elem) +void InvalidStateWhenDisassociate(struct rt_rtmp_adapter *pAd, + struct rt_mlme_queue_elem *Elem) { u16 Status; DBGPRINT(RT_DEBUG_TRACE, @@ -1283,10 +1283,10 @@ void InvalidStateWhenDisassociate(IN PRTMP_ADAPTER pAd, ========================================================================== */ -void Cls3errAction(IN PRTMP_ADAPTER pAd, u8 *pAddr) +void Cls3errAction(struct rt_rtmp_adapter *pAd, u8 *pAddr) { - HEADER_802_11 DisassocHdr; - PHEADER_802_11 pDisassocHdr; + struct rt_header_802_11 DisassocHdr; + struct rt_header_802_11 * pDisassocHdr; u8 *pOutBuffer = NULL; unsigned long FrameLen = 0; int NStatus; @@ -1300,14 +1300,14 @@ void Cls3errAction(IN PRTMP_ADAPTER pAd, u8 *pAddr) ("ASSOC - Class 3 Error, Send DISASSOC frame\n")); MgtMacHeaderInit(pAd, &DisassocHdr, SUBTYPE_DISASSOC, 0, pAddr, pAd->CommonCfg.Bssid); /* patch peap ttls switching issue */ MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &DisassocHdr, + sizeof(struct rt_header_802_11), &DisassocHdr, 2, &Reason, END_OF_ARGS); MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); /* To patch Instance and Buffalo(N) AP */ /* Driver has to send deauth to Instance AP, but Buffalo(N) needs to send disassoc to reset Authenticator's state machine */ /* Therefore, we send both of them. */ - pDisassocHdr = (PHEADER_802_11) pOutBuffer; + pDisassocHdr = (struct rt_header_802_11 *) pOutBuffer; pDisassocHdr->FC.SubType = SUBTYPE_DEAUTH; MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); @@ -1317,7 +1317,7 @@ void Cls3errAction(IN PRTMP_ADAPTER pAd, u8 *pAddr) COPY_MAC_ADDR(pAd->StaCfg.DisassocSta, pAddr); } -int wext_notify_event_assoc(IN RTMP_ADAPTER * pAd) +int wext_notify_event_assoc(struct rt_rtmp_adapter *pAd) { char custom[IW_CUSTOM_MAX] = { 0 }; @@ -1334,12 +1334,12 @@ int wext_notify_event_assoc(IN RTMP_ADAPTER * pAd) } -BOOLEAN StaAddMacTableEntry(IN PRTMP_ADAPTER pAd, - IN PMAC_TABLE_ENTRY pEntry, +BOOLEAN StaAddMacTableEntry(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, u8 MaxSupportedRateIn500Kbps, - IN HT_CAPABILITY_IE * pHtCapability, + struct rt_ht_capability_ie * pHtCapability, u8 HtCapabilityLen, - IN ADD_HT_INFO_IE * pAddHtInfo, + struct rt_add_ht_info_ie * pAddHtInfo, u8 AddHtInfoLen, u16 CapabilityInfo) { u8 MaxSupportedRate = RATE_11; diff --git a/drivers/staging/rt2860/sta/auth.c b/drivers/staging/rt2860/sta/auth.c index ddb357ac041c..404bd220679d 100644 --- a/drivers/staging/rt2860/sta/auth.c +++ b/drivers/staging/rt2860/sta/auth.c @@ -55,8 +55,8 @@ ========================================================================== */ -void AuthStateMachineInit(IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE * Sm, OUT STATE_MACHINE_FUNC Trans[]) +void AuthStateMachineInit(struct rt_rtmp_adapter *pAd, + struct rt_state_machine *Sm, OUT STATE_MACHINE_FUNC Trans[]) { StateMachineInit(Sm, Trans, MAX_AUTH_STATE, MAX_AUTH_MSG, (STATE_MACHINE_FUNC) Drop, AUTH_REQ_IDLE, @@ -99,7 +99,7 @@ void AuthTimeout(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)FunctionContext; DBGPRINT(RT_DEBUG_TRACE, ("AUTH - AuthTimeout\n")); @@ -125,7 +125,7 @@ void AuthTimeout(void *SystemSpecific1, ========================================================================== */ -void MlmeAuthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeAuthReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { if (AUTH_ReqSend (pAd, Elem, &pAd->MlmeAux.AuthTimer, "AUTH", 1, NULL, 0)) @@ -148,14 +148,14 @@ void MlmeAuthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void PeerAuthRspAtSeq2Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerAuthRspAtSeq2Action(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 Addr2[MAC_ADDR_LEN]; u16 Seq, Status, RemoteStatus, Alg; u8 ChlgText[CIPHER_TEXT_LEN]; u8 CyperChlgText[CIPHER_TEXT_LEN + 8 + 8]; u8 Element[2]; - HEADER_802_11 AuthHdr; + struct rt_header_802_11 AuthHdr; BOOLEAN TimerCancelled; u8 *pOutBuffer = NULL; int NStatus; @@ -246,7 +246,7 @@ void PeerAuthRspAtSeq2Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) 128); RTMPSetICV(pAd, CyperChlgText + 140); MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), + sizeof(struct rt_header_802_11), &AuthHdr, CIPHER_TEXT_LEN + 16, CyperChlgText, @@ -282,7 +282,7 @@ void PeerAuthRspAtSeq2Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void PeerAuthRspAtSeq4Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerAuthRspAtSeq4Action(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 Addr2[MAC_ADDR_LEN]; u16 Alg, Seq, Status; @@ -321,16 +321,16 @@ void PeerAuthRspAtSeq4Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void MlmeDeauthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeDeauthReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { - MLME_DEAUTH_REQ_STRUCT *pInfo; - HEADER_802_11 DeauthHdr; + struct rt_mlme_deauth_req *pInfo; + struct rt_header_802_11 DeauthHdr; u8 *pOutBuffer = NULL; int NStatus; unsigned long FrameLen = 0; u16 Status; - pInfo = (MLME_DEAUTH_REQ_STRUCT *) Elem->Msg; + pInfo = (struct rt_mlme_deauth_req *)Elem->Msg; NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ if (NStatus != NDIS_STATUS_SUCCESS) { @@ -348,7 +348,7 @@ void MlmeDeauthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pInfo->Reason)); MgtMacHeaderInit(pAd, &DeauthHdr, SUBTYPE_DEAUTH, 0, pInfo->Addr, pAd->MlmeAux.Bssid); - MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(HEADER_802_11), + MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(struct rt_header_802_11), &DeauthHdr, 2, &pInfo->Reason, END_OF_ARGS); MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); @@ -374,7 +374,7 @@ void MlmeDeauthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void AuthTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void AuthTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 Status; DBGPRINT(RT_DEBUG_TRACE, ("AUTH - AuthTimeoutAction\n")); @@ -391,7 +391,7 @@ void AuthTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void InvalidStateWhenAuth(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void InvalidStateWhenAuth(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 Status; DBGPRINT(RT_DEBUG_TRACE, @@ -414,9 +414,9 @@ void InvalidStateWhenAuth(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void Cls2errAction(IN PRTMP_ADAPTER pAd, u8 *pAddr) +void Cls2errAction(struct rt_rtmp_adapter *pAd, u8 *pAddr) { - HEADER_802_11 DeauthHdr; + struct rt_header_802_11 DeauthHdr; u8 *pOutBuffer = NULL; int NStatus; unsigned long FrameLen = 0; @@ -430,7 +430,7 @@ void Cls2errAction(IN PRTMP_ADAPTER pAd, u8 *pAddr) ("AUTH - Class 2 error, Send DEAUTH frame...\n")); MgtMacHeaderInit(pAd, &DeauthHdr, SUBTYPE_DEAUTH, 0, pAddr, pAd->MlmeAux.Bssid); - MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(HEADER_802_11), + MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(struct rt_header_802_11), &DeauthHdr, 2, &Reason, END_OF_ARGS); MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); @@ -439,9 +439,9 @@ void Cls2errAction(IN PRTMP_ADAPTER pAd, u8 *pAddr) COPY_MAC_ADDR(pAd->StaCfg.DeauthSta, pAddr); } -BOOLEAN AUTH_ReqSend(IN PRTMP_ADAPTER pAd, - IN PMLME_QUEUE_ELEM pElem, - IN PRALINK_TIMER_STRUCT pAuthTimer, +BOOLEAN AUTH_ReqSend(struct rt_rtmp_adapter *pAd, + struct rt_mlme_queue_elem *pElem, + struct rt_ralink_timer *pAuthTimer, char *pSMName, u16 SeqNo, u8 *pNewElement, unsigned long ElementLen) @@ -449,7 +449,7 @@ BOOLEAN AUTH_ReqSend(IN PRTMP_ADAPTER pAd, u16 Alg, Seq, Status; u8 Addr[6]; unsigned long Timeout; - HEADER_802_11 AuthHdr; + struct rt_header_802_11 AuthHdr; BOOLEAN TimerCancelled; int NStatus; u8 *pOutBuffer = NULL; @@ -492,7 +492,7 @@ BOOLEAN AUTH_ReqSend(IN PRTMP_ADAPTER pAd, Alg)); MgtMacHeaderInit(pAd, &AuthHdr, SUBTYPE_AUTH, 0, Addr, pAd->MlmeAux.Bssid); - MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(HEADER_802_11), + MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(struct rt_header_802_11), &AuthHdr, 2, &Alg, 2, &Seq, 2, &Status, END_OF_ARGS); diff --git a/drivers/staging/rt2860/sta/auth_rsp.c b/drivers/staging/rt2860/sta/auth_rsp.c index d155dc6cdf1d..5b018b757308 100644 --- a/drivers/staging/rt2860/sta/auth_rsp.c +++ b/drivers/staging/rt2860/sta/auth_rsp.c @@ -47,8 +47,8 @@ ========================================================================== */ -void AuthRspStateMachineInit(IN PRTMP_ADAPTER pAd, - IN PSTATE_MACHINE Sm, +void AuthRspStateMachineInit(struct rt_rtmp_adapter *pAd, + struct rt_state_machine *Sm, IN STATE_MACHINE_FUNC Trans[]) { StateMachineInit(Sm, Trans, MAX_AUTH_RSP_STATE, MAX_AUTH_RSP_MSG, @@ -73,13 +73,13 @@ void AuthRspStateMachineInit(IN PRTMP_ADAPTER pAd, ========================================================================== */ -void PeerAuthSimpleRspGenAndSend(IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHdr80211, +void PeerAuthSimpleRspGenAndSend(struct rt_rtmp_adapter *pAd, + struct rt_header_802_11 * pHdr80211, u16 Alg, u16 Seq, u16 Reason, u16 Status) { - HEADER_802_11 AuthHdr; + struct rt_header_802_11 AuthHdr; unsigned long FrameLen = 0; u8 *pOutBuffer = NULL; int NStatus; @@ -96,7 +96,7 @@ void PeerAuthSimpleRspGenAndSend(IN PRTMP_ADAPTER pAd, DBGPRINT(RT_DEBUG_TRACE, ("Send AUTH response (seq#2)...\n")); MgtMacHeaderInit(pAd, &AuthHdr, SUBTYPE_AUTH, 0, pHdr80211->Addr2, pAd->MlmeAux.Bssid); - MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(HEADER_802_11), + MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(struct rt_header_802_11), &AuthHdr, 2, &Alg, 2, &Seq, 2, &Reason, END_OF_ARGS); MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen); MlmeFreeMemory(pAd, pOutBuffer); @@ -110,7 +110,7 @@ void PeerAuthSimpleRspGenAndSend(IN PRTMP_ADAPTER pAd, ========================================================================== */ -void PeerDeauthAction(IN PRTMP_ADAPTER pAd, IN PMLME_QUEUE_ELEM Elem) +void PeerDeauthAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 Addr2[MAC_ADDR_LEN]; u16 Reason; diff --git a/drivers/staging/rt2860/sta/connect.c b/drivers/staging/rt2860/sta/connect.c index c11389f89789..9c7752076b00 100644 --- a/drivers/staging/rt2860/sta/connect.c +++ b/drivers/staging/rt2860/sta/connect.c @@ -84,9 +84,9 @@ u8 CipherSuiteWpaNoneAesLen = NdisMoveMemory((_pAd)->StaActive.SupRate, (_pAd)->MlmeAux.SupRate, (_pAd)->MlmeAux.SupRateLen);\ (_pAd)->StaActive.ExtRateLen = (_pAd)->MlmeAux.ExtRateLen; \ NdisMoveMemory((_pAd)->StaActive.ExtRate, (_pAd)->MlmeAux.ExtRate, (_pAd)->MlmeAux.ExtRateLen);\ - NdisMoveMemory(&(_pAd)->CommonCfg.APEdcaParm, &(_pAd)->MlmeAux.APEdcaParm, sizeof(EDCA_PARM));\ - NdisMoveMemory(&(_pAd)->CommonCfg.APQosCapability, &(_pAd)->MlmeAux.APQosCapability, sizeof(QOS_CAPABILITY_PARM));\ - NdisMoveMemory(&(_pAd)->CommonCfg.APQbssLoad, &(_pAd)->MlmeAux.APQbssLoad, sizeof(QBSS_LOAD_PARM));\ + NdisMoveMemory(&(_pAd)->CommonCfg.APEdcaParm, &(_pAd)->MlmeAux.APEdcaParm, sizeof(struct rt_edca_parm));\ + NdisMoveMemory(&(_pAd)->CommonCfg.APQosCapability, &(_pAd)->MlmeAux.APQosCapability, sizeof(struct rt_qos_capability_parm));\ + NdisMoveMemory(&(_pAd)->CommonCfg.APQbssLoad, &(_pAd)->MlmeAux.APQbssLoad, sizeof(struct rt_qbss_load_parm));\ COPY_MAC_ADDR((_pAd)->MacTab.Content[BSSID_WCID].Addr, (_pAd)->MlmeAux.Bssid); \ (_pAd)->MacTab.Content[BSSID_WCID].Aid = (_pAd)->MlmeAux.Aid; \ (_pAd)->MacTab.Content[BSSID_WCID].PairwiseKey.CipherAlg = (_pAd)->StaCfg.PairCipher;\ @@ -102,8 +102,8 @@ u8 CipherSuiteWpaNoneAesLen = ========================================================================== */ -void MlmeCntlInit(IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE * S, OUT STATE_MACHINE_FUNC Trans[]) +void MlmeCntlInit(struct rt_rtmp_adapter *pAd, + struct rt_state_machine *S, OUT STATE_MACHINE_FUNC Trans[]) { /* Control state machine differs from other state machines, the interface */ /* follows the standard interface */ @@ -118,9 +118,9 @@ void MlmeCntlInit(IN PRTMP_ADAPTER pAd, ========================================================================== */ -void MlmeCntlMachinePerformAction(IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE * S, - IN MLME_QUEUE_ELEM * Elem) +void MlmeCntlMachinePerformAction(struct rt_rtmp_adapter *pAd, + struct rt_state_machine *S, + struct rt_mlme_queue_elem *Elem) { switch (pAd->Mlme.CntlMachine.CurrState) { case CNTL_IDLE: @@ -228,9 +228,9 @@ void MlmeCntlMachinePerformAction(IN PRTMP_ADAPTER pAd, ========================================================================== */ -void CntlIdleProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlIdleProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { - MLME_DISASSOC_REQ_STRUCT DisassocReq; + struct rt_mlme_disassoc_req DisassocReq; if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) return; @@ -252,7 +252,7 @@ void CntlIdleProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_DISASSOC_STA_LEAVING); MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, - sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); + sizeof(struct rt_mlme_disassoc_req), &DisassocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC; if (pAd->StaCfg.WpaSupplicantUP != @@ -281,11 +281,11 @@ void CntlIdleProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } -void CntlOidScanProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlOidScanProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { - MLME_SCAN_REQ_STRUCT ScanReq; + struct rt_mlme_scan_req ScanReq; unsigned long BssIdx = BSS_NOT_FOUND; - BSS_ENTRY CurrBss; + struct rt_bss_entry CurrBss; /* record current BSS if network is connected. */ /* 2003-2-13 do not include current IBSS if this is the only STA in this IBSS. */ @@ -297,7 +297,7 @@ void CntlOidScanProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->CommonCfg.Channel); if (BssIdx != BSS_NOT_FOUND) { NdisMoveMemory(&CurrBss, &pAd->ScanTab.BssEntry[BssIdx], - sizeof(BSS_ENTRY)); + sizeof(struct rt_bss_entry)); } } /* clean up previous SCAN result, add current BSS back to table if any */ @@ -309,14 +309,14 @@ void CntlOidScanProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /* appended to the list of BSSIDs in the NIC's database. */ /* To ensure this, we append this BSS as the first entry in SCAN result */ NdisMoveMemory(&pAd->ScanTab.BssEntry[0], &CurrBss, - sizeof(BSS_ENTRY)); + sizeof(struct rt_bss_entry)); pAd->ScanTab.BssNr = 1; } ScanParmFill(pAd, &ScanReq, (char *)Elem->Msg, Elem->MsgLen, BSS_ANY, SCAN_ACTIVE); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, - sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); + sizeof(struct rt_mlme_scan_req), &ScanReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; } @@ -329,10 +329,10 @@ void CntlOidScanProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlOidSsidProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { - PNDIS_802_11_SSID pOidSsid = (NDIS_802_11_SSID *) Elem->Msg; - MLME_DISASSOC_REQ_STRUCT DisassocReq; + struct rt_ndis_802_11_ssid * pOidSsid = (struct rt_ndis_802_11_ssid *) Elem->Msg; + struct rt_mlme_disassoc_req DisassocReq; unsigned long Now; /* Step 1. record the desired user settings to MlmeAux */ @@ -390,7 +390,7 @@ void CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) REASON_DISASSOC_STA_LEAVING); MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, - sizeof(MLME_DISASSOC_REQ_STRUCT), + sizeof(struct rt_mlme_disassoc_req), &DisassocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; } else if (pAd->bConfigChanged == TRUE) { @@ -402,7 +402,7 @@ void CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) REASON_DISASSOC_STA_LEAVING); MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, - sizeof(MLME_DISASSOC_REQ_STRUCT), + sizeof(struct rt_mlme_disassoc_req), &DisassocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; } else { @@ -455,7 +455,7 @@ void CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_DISASSOC_STA_LEAVING); MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, - sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); + sizeof(struct rt_mlme_disassoc_req), &DisassocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; } else { if (ADHOC_ON(pAd)) { @@ -477,7 +477,7 @@ void CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) (MlmeValidateSSID(pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen) == TRUE) ) { - MLME_SCAN_REQ_STRUCT ScanReq; + struct rt_mlme_scan_req ScanReq; DBGPRINT(RT_DEBUG_TRACE, ("CntlOidSsidProc():CNTL - No matching BSS, start a new scan\n")); @@ -485,7 +485,7 @@ void CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->MlmeAux.SsidLen, BSS_ANY, SCAN_ACTIVE); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, - sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); + sizeof(struct rt_mlme_scan_req), &ScanReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; /* Reset Missed scan number */ @@ -505,12 +505,12 @@ void CntlOidSsidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlOidRTBssidProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { unsigned long BssIdx; u8 *pOidBssid = (u8 *)Elem->Msg; - MLME_DISASSOC_REQ_STRUCT DisassocReq; - MLME_JOIN_REQ_STRUCT JoinReq; + struct rt_mlme_disassoc_req DisassocReq; + struct rt_mlme_join_req JoinReq; /* record user desired settings */ COPY_MAC_ADDR(pAd->MlmeAux.Bssid, pOidBssid); @@ -519,7 +519,7 @@ void CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /* find the desired BSS in the latest SCAN result table */ BssIdx = BssTableSearch(&pAd->ScanTab, pOidBssid, pAd->MlmeAux.Channel); if (BssIdx == BSS_NOT_FOUND) { - MLME_SCAN_REQ_STRUCT ScanReq; + struct rt_mlme_scan_req ScanReq; DBGPRINT(RT_DEBUG_TRACE, ("CNTL - BSSID not found. reply NDIS_STATUS_NOT_ACCEPTED\n")); @@ -530,7 +530,7 @@ void CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ScanParmFill(pAd, &ScanReq, (char *)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen, BSS_ANY, SCAN_ACTIVE); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_SCAN_REQ, - sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq); + sizeof(struct rt_mlme_scan_req), &ScanReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_LIST_SCAN; /* Reset Missed scan number */ NdisGetSystemUpTime(&pAd->StaCfg.LastScanTime); @@ -551,7 +551,7 @@ void CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) pAd->MlmeAux.BssIdx = 0; pAd->MlmeAux.SsidBssTab.BssNr = 1; NdisMoveMemory(&pAd->MlmeAux.SsidBssTab.BssEntry[0], - &pAd->ScanTab.BssEntry[BssIdx], sizeof(BSS_ENTRY)); + &pAd->ScanTab.BssEntry[BssIdx], sizeof(struct rt_bss_entry)); /* Add SSID into MlmeAux for site surey joining hidden SSID */ pAd->MlmeAux.SsidLen = pAd->ScanTab.BssEntry[BssIdx].SsidLen; @@ -568,7 +568,7 @@ void CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) REASON_DISASSOC_STA_LEAVING); MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, - sizeof(MLME_DISASSOC_REQ_STRUCT), + sizeof(struct rt_mlme_disassoc_req), &DisassocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; @@ -660,7 +660,7 @@ void CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) JoinParmFill(pAd, &JoinReq, pAd->MlmeAux.BssIdx); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_JOIN_REQ, - sizeof(MLME_JOIN_REQ_STRUCT), &JoinReq); + sizeof(struct rt_mlme_join_req), &JoinReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_JOIN; } @@ -675,7 +675,7 @@ void CntlOidRTBssidProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /* or been corrupted by other "SET OID"? */ /* */ /* IRQL = DISPATCH_LEVEL */ -void CntlMlmeRoamingProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlMlmeRoamingProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 BBPValue = 0; @@ -705,9 +705,9 @@ void CntlMlmeRoamingProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void CntlWaitDisassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlWaitDisassocProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { - MLME_START_REQ_STRUCT StartReq; + struct rt_mlme_start_req StartReq; if (Elem->MsgType == MT2_DISASSOC_CONF) { DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Dis-associate successful\n")); @@ -729,7 +729,7 @@ void CntlWaitDisassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) StartParmFill(pAd, &StartReq, (char *)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, - sizeof(MLME_START_REQ_STRUCT), &StartReq); + sizeof(struct rt_mlme_start_req), &StartReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_START; } /* case 2. try each matched BSS */ @@ -749,10 +749,10 @@ void CntlWaitDisassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void CntlWaitJoinProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlWaitJoinProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 Reason; - MLME_AUTH_REQ_STRUCT AuthReq; + struct rt_mlme_auth_req AuthReq; if (Elem->MsgType == MT2_JOIN_CONF) { NdisMoveMemory(&Reason, Elem->Msg, sizeof(u16)); @@ -809,7 +809,7 @@ void CntlWaitJoinProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_MLME_AUTH_REQ, sizeof - (MLME_AUTH_REQ_STRUCT), + (struct rt_mlme_auth_req), &AuthReq); } @@ -832,7 +832,7 @@ void CntlWaitJoinProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void CntlWaitStartProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlWaitStartProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 Result; @@ -859,7 +859,7 @@ void CntlWaitStartProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) SetCommonHT(pAd); NdisMoveMemory(&pAd->MlmeAux.AddHtInfo, &pAd->CommonCfg.AddHTInfo, - sizeof(ADD_HT_INFO_IE)); + sizeof(struct rt_add_ht_info_ie)); RTMPCheckHt(pAd, BSSID_WCID, &pAd->CommonCfg.HtCapability, &pAd->CommonCfg.AddHTInfo); @@ -925,11 +925,11 @@ void CntlWaitStartProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void CntlWaitAuthProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlWaitAuthProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 Reason; - MLME_ASSOC_REQ_STRUCT AssocReq; - MLME_AUTH_REQ_STRUCT AuthReq; + struct rt_mlme_assoc_req AssocReq; + struct rt_mlme_auth_req AuthReq; if (Elem->MsgType == MT2_AUTH_CONF) { NdisMoveMemory(&Reason, Elem->Msg, sizeof(u16)); @@ -943,7 +943,7 @@ void CntlWaitAuthProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_ASSOC_REQ, - sizeof(MLME_ASSOC_REQ_STRUCT), + sizeof(struct rt_mlme_assoc_req), &AssocReq); pAd->Mlme.CntlMachine.CurrState = @@ -972,7 +972,7 @@ void CntlWaitAuthProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_MLME_AUTH_REQ, - sizeof(MLME_AUTH_REQ_STRUCT), + sizeof(struct rt_mlme_auth_req), &AuthReq); } @@ -989,11 +989,11 @@ void CntlWaitAuthProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void CntlWaitAuthProc2(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlWaitAuthProc2(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 Reason; - MLME_ASSOC_REQ_STRUCT AssocReq; - MLME_AUTH_REQ_STRUCT AuthReq; + struct rt_mlme_assoc_req AssocReq; + struct rt_mlme_auth_req AuthReq; if (Elem->MsgType == MT2_AUTH_CONF) { NdisMoveMemory(&Reason, Elem->Msg, sizeof(u16)); @@ -1006,7 +1006,7 @@ void CntlWaitAuthProc2(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) { MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_ASSOC_REQ, - sizeof(MLME_ASSOC_REQ_STRUCT), + sizeof(struct rt_mlme_assoc_req), &AssocReq); pAd->Mlme.CntlMachine.CurrState = @@ -1022,7 +1022,7 @@ void CntlWaitAuthProc2(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Ndis802_11AuthModeOpen); MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_MLME_AUTH_REQ, - sizeof(MLME_AUTH_REQ_STRUCT), + sizeof(struct rt_mlme_auth_req), &AuthReq); pAd->Mlme.CntlMachine.CurrState = @@ -1047,7 +1047,7 @@ void CntlWaitAuthProc2(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void CntlWaitAssocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlWaitAssocProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 Reason; @@ -1085,7 +1085,7 @@ void CntlWaitAssocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void CntlWaitReassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void CntlWaitReassocProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 Result; @@ -1121,7 +1121,7 @@ void CntlWaitReassocProc(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } -void AdhocTurnOnQos(IN PRTMP_ADAPTER pAd) +void AdhocTurnOnQos(struct rt_rtmp_adapter *pAd) { #define AC0_DEF_TXOP 0 #define AC1_DEF_TXOP 0 @@ -1162,13 +1162,13 @@ void AdhocTurnOnQos(IN PRTMP_ADAPTER pAd) ========================================================================== */ -void LinkUp(IN PRTMP_ADAPTER pAd, u8 BssType) +void LinkUp(struct rt_rtmp_adapter *pAd, u8 BssType) { unsigned long Now; u32 Data; BOOLEAN Cancelled; u8 Value = 0, idx = 0, HashIdx = 0; - MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry = NULL; + struct rt_mac_table_entry *pEntry = NULL, *pCurrEntry = NULL; /* Init ChannelQuality to prevent DEAD_CQI at initial LinkUp */ pAd->Mlme.ChannelQuality = 50; @@ -1373,7 +1373,7 @@ void LinkUp(IN PRTMP_ADAPTER pAd, u8 BssType) FALSE); } - NdisZeroMemory(&pAd->DrsCounters, sizeof(COUNTER_DRS)); + NdisZeroMemory(&pAd->DrsCounters, sizeof(struct rt_counter_drs)); NdisGetSystemUpTime(&Now); pAd->StaCfg.LastBeaconRxTime = Now; /* last RX timestamp */ @@ -1439,7 +1439,7 @@ void LinkUp(IN PRTMP_ADAPTER pAd, u8 BssType) pAd->StaCfg.DefaultKeyId = 0; /* always be zero */ NdisZeroMemory(&pAd->SharedKey[BSS0][0], - sizeof(CIPHER_KEY)); + sizeof(struct rt_cipher_key)); pAd->SharedKey[BSS0][0].KeyLen = LEN_TKIP_EK; NdisMoveMemory(pAd->SharedKey[BSS0][0].Key, pAd->StaCfg.PMK, LEN_TKIP_EK); @@ -1873,7 +1873,7 @@ void LinkUp(IN PRTMP_ADAPTER pAd, u8 BssType) ========================================================================== */ -void LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) +void LinkDown(struct rt_rtmp_adapter *pAd, IN BOOLEAN IsReqFromAP) { u8 i, ByteValue = 0; @@ -1996,8 +1996,8 @@ void LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) pAd->CommonCfg.SsidLen = 0; } - NdisZeroMemory(&pAd->MlmeAux.HtCapability, sizeof(HT_CAPABILITY_IE)); - NdisZeroMemory(&pAd->MlmeAux.AddHtInfo, sizeof(ADD_HT_INFO_IE)); + NdisZeroMemory(&pAd->MlmeAux.HtCapability, sizeof(struct rt_ht_capability_ie)); + NdisZeroMemory(&pAd->MlmeAux.AddHtInfo, sizeof(struct rt_add_ht_info_ie)); pAd->MlmeAux.HtCapabilityLen = 0; pAd->MlmeAux.NewExtChannelOffset = 0xff; @@ -2030,7 +2030,7 @@ void LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) } NdisAcquireSpinLock(&pAd->MacTabLock); - NdisZeroMemory(&pAd->MacTab, sizeof(MAC_TABLE)); + NdisZeroMemory(&pAd->MacTab, sizeof(struct rt_mac_table)); pAd->MacTab.Content[BSSID_WCID].PortSecured = pAd->StaCfg.PortSecured; NdisReleaseSpinLock(&pAd->MacTabLock); @@ -2048,9 +2048,9 @@ void LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) /* Clean association information */ NdisZeroMemory(&pAd->StaCfg.AssocInfo, - sizeof(NDIS_802_11_ASSOCIATION_INFORMATION)); + sizeof(struct rt_ndis_802_11_association_information)); pAd->StaCfg.AssocInfo.Length = - sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); + sizeof(struct rt_ndis_802_11_association_information); pAd->StaCfg.ReqVarIELen = 0; pAd->StaCfg.ResVarIELen = 0; @@ -2122,10 +2122,10 @@ void LinkDown(IN PRTMP_ADAPTER pAd, IN BOOLEAN IsReqFromAP) ========================================================================== */ -void IterateOnBssTab(IN PRTMP_ADAPTER pAd) +void IterateOnBssTab(struct rt_rtmp_adapter *pAd) { - MLME_START_REQ_STRUCT StartReq; - MLME_JOIN_REQ_STRUCT JoinReq; + struct rt_mlme_start_req StartReq; + struct rt_mlme_join_req JoinReq; unsigned long BssIdx; /* Change the wepstatus to original wepstatus */ @@ -2200,7 +2200,7 @@ void IterateOnBssTab(IN PRTMP_ADAPTER pAd) pAd->MlmeAux.SsidBssTab.BssNr)); JoinParmFill(pAd, &JoinReq, BssIdx); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_JOIN_REQ, - sizeof(MLME_JOIN_REQ_STRUCT), &JoinReq); + sizeof(struct rt_mlme_join_req), &JoinReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_JOIN; } else if (pAd->StaCfg.BssType == BSS_ADHOC) { DBGPRINT(RT_DEBUG_TRACE, @@ -2209,7 +2209,7 @@ void IterateOnBssTab(IN PRTMP_ADAPTER pAd) StartParmFill(pAd, &StartReq, (char *)pAd->MlmeAux.Ssid, pAd->MlmeAux.SsidLen); MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_START_REQ, - sizeof(MLME_START_REQ_STRUCT), &StartReq); + sizeof(struct rt_mlme_start_req), &StartReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_START; } else /* no more BSS */ { @@ -2228,11 +2228,11 @@ void IterateOnBssTab(IN PRTMP_ADAPTER pAd) /* for re-association only */ /* IRQL = DISPATCH_LEVEL */ -void IterateOnBssTab2(IN PRTMP_ADAPTER pAd) +void IterateOnBssTab2(struct rt_rtmp_adapter *pAd) { - MLME_REASSOC_REQ_STRUCT ReassocReq; + struct rt_mlme_assoc_req ReassocReq; unsigned long BssIdx; - BSS_ENTRY *pBss; + struct rt_bss_entry *pBss; BssIdx = pAd->MlmeAux.RoamIdx; pBss = &pAd->MlmeAux.RoamTab.BssEntry[BssIdx]; @@ -2250,7 +2250,7 @@ void IterateOnBssTab2(IN PRTMP_ADAPTER pAd) pBss->CapabilityInfo, ASSOC_TIMEOUT, pAd->StaCfg.DefaultListenCount); MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_REASSOC_REQ, - sizeof(MLME_REASSOC_REQ_STRUCT), &ReassocReq); + sizeof(struct rt_mlme_assoc_req), &ReassocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_REASSOC; } else /* no more BSS */ @@ -2276,8 +2276,8 @@ void IterateOnBssTab2(IN PRTMP_ADAPTER pAd) ========================================================================== */ -void JoinParmFill(IN PRTMP_ADAPTER pAd, - IN OUT MLME_JOIN_REQ_STRUCT * JoinReq, unsigned long BssIdx) +void JoinParmFill(struct rt_rtmp_adapter *pAd, + struct rt_mlme_join_req *JoinReq, unsigned long BssIdx) { JoinReq->BssIdx = BssIdx; } @@ -2290,8 +2290,8 @@ void JoinParmFill(IN PRTMP_ADAPTER pAd, ========================================================================== */ -void ScanParmFill(IN PRTMP_ADAPTER pAd, - IN OUT MLME_SCAN_REQ_STRUCT * ScanReq, +void ScanParmFill(struct rt_rtmp_adapter *pAd, + struct rt_mlme_scan_req *ScanReq, char Ssid[], u8 SsidLen, u8 BssType, u8 ScanType) { @@ -2310,8 +2310,8 @@ void ScanParmFill(IN PRTMP_ADAPTER pAd, ========================================================================== */ -void StartParmFill(IN PRTMP_ADAPTER pAd, - IN OUT MLME_START_REQ_STRUCT * StartReq, +void StartParmFill(struct rt_rtmp_adapter *pAd, + struct rt_mlme_start_req *StartReq, char Ssid[], u8 SsidLen) { ASSERT(SsidLen <= MAX_LEN_OF_SSID); @@ -2327,8 +2327,8 @@ void StartParmFill(IN PRTMP_ADAPTER pAd, ========================================================================== */ -void AuthParmFill(IN PRTMP_ADAPTER pAd, - IN OUT MLME_AUTH_REQ_STRUCT * AuthReq, +void AuthParmFill(struct rt_rtmp_adapter *pAd, + struct rt_mlme_auth_req *AuthReq, u8 *pAddr, u16 Alg) { COPY_MAC_ADDR(AuthReq->Addr, pAddr); @@ -2345,9 +2345,9 @@ void AuthParmFill(IN PRTMP_ADAPTER pAd, ========================================================================== */ #ifdef RTMP_MAC_PCI -void ComposePsPoll(IN PRTMP_ADAPTER pAd) +void ComposePsPoll(struct rt_rtmp_adapter *pAd) { - NdisZeroMemory(&pAd->PsPollFrame, sizeof(PSPOLL_FRAME)); + NdisZeroMemory(&pAd->PsPollFrame, sizeof(struct rt_pspoll_frame)); pAd->PsPollFrame.FC.Type = BTYPE_CNTL; pAd->PsPollFrame.FC.SubType = SUBTYPE_PS_POLL; pAd->PsPollFrame.Aid = pAd->StaActive.Aid | 0xC000; @@ -2356,9 +2356,9 @@ void ComposePsPoll(IN PRTMP_ADAPTER pAd) } /* IRQL = DISPATCH_LEVEL */ -void ComposeNullFrame(IN PRTMP_ADAPTER pAd) +void ComposeNullFrame(struct rt_rtmp_adapter *pAd) { - NdisZeroMemory(&pAd->NullFrame, sizeof(HEADER_802_11)); + NdisZeroMemory(&pAd->NullFrame, sizeof(struct rt_header_802_11)); pAd->NullFrame.FC.Type = BTYPE_DATA; pAd->NullFrame.FC.SubType = SUBTYPE_NULL_FUNC; pAd->NullFrame.FC.ToDs = 1; @@ -2368,19 +2368,19 @@ void ComposeNullFrame(IN PRTMP_ADAPTER pAd) } #endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB -void MlmeCntlConfirm(IN PRTMP_ADAPTER pAd, unsigned long MsgType, u16 Msg) +void MlmeCntlConfirm(struct rt_rtmp_adapter *pAd, unsigned long MsgType, u16 Msg) { MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MsgType, sizeof(u16), &Msg); } -void ComposePsPoll(IN PRTMP_ADAPTER pAd) +void ComposePsPoll(struct rt_rtmp_adapter *pAd) { - PTXINFO_STRUC pTxInfo; - PTXWI_STRUC pTxWI; + struct rt_txinfo *pTxInfo; + struct rt_txwi * pTxWI; DBGPRINT(RT_DEBUG_TRACE, ("ComposePsPoll\n")); - NdisZeroMemory(&pAd->PsPollFrame, sizeof(PSPOLL_FRAME)); + NdisZeroMemory(&pAd->PsPollFrame, sizeof(struct rt_pspoll_frame)); pAd->PsPollFrame.FC.PwrMgmt = 0; pAd->PsPollFrame.FC.Type = BTYPE_CNTL; @@ -2392,33 +2392,33 @@ void ComposePsPoll(IN PRTMP_ADAPTER pAd) RTMPZeroMemory(&pAd->PsPollContext.TransferBuffer->field. WirelessPacket[0], 100); pTxInfo = - (PTXINFO_STRUC) & pAd->PsPollContext.TransferBuffer->field. + (struct rt_txinfo *)& pAd->PsPollContext.TransferBuffer->field. WirelessPacket[0]; RTMPWriteTxInfo(pAd, pTxInfo, - (u16)(sizeof(PSPOLL_FRAME) + TXWI_SIZE), TRUE, + (u16)(sizeof(struct rt_pspoll_frame) + TXWI_SIZE), TRUE, EpToQueue[MGMTPIPEIDX], FALSE, FALSE); pTxWI = - (PTXWI_STRUC) & pAd->PsPollContext.TransferBuffer->field. + (struct rt_txwi *) & pAd->PsPollContext.TransferBuffer->field. WirelessPacket[TXINFO_SIZE]; RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0, - BSSID_WCID, (sizeof(PSPOLL_FRAME)), 0, 0, + BSSID_WCID, (sizeof(struct rt_pspoll_frame)), 0, 0, (u8)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); RTMPMoveMemory(&pAd->PsPollContext.TransferBuffer->field. WirelessPacket[TXWI_SIZE + TXINFO_SIZE], - &pAd->PsPollFrame, sizeof(PSPOLL_FRAME)); + &pAd->PsPollFrame, sizeof(struct rt_pspoll_frame)); /* Append 4 extra zero bytes. */ pAd->PsPollContext.BulkOutSize = - TXINFO_SIZE + TXWI_SIZE + sizeof(PSPOLL_FRAME) + 4; + TXINFO_SIZE + TXWI_SIZE + sizeof(struct rt_pspoll_frame) + 4; } /* IRQL = DISPATCH_LEVEL */ -void ComposeNullFrame(IN PRTMP_ADAPTER pAd) +void ComposeNullFrame(struct rt_rtmp_adapter *pAd) { - PTXINFO_STRUC pTxInfo; - PTXWI_STRUC pTxWI; + struct rt_txinfo *pTxInfo; + struct rt_txwi * pTxWI; - NdisZeroMemory(&pAd->NullFrame, sizeof(HEADER_802_11)); + NdisZeroMemory(&pAd->NullFrame, sizeof(struct rt_header_802_11)); pAd->NullFrame.FC.Type = BTYPE_DATA; pAd->NullFrame.FC.SubType = SUBTYPE_NULL_FUNC; pAd->NullFrame.FC.ToDs = 1; @@ -2428,21 +2428,21 @@ void ComposeNullFrame(IN PRTMP_ADAPTER pAd) RTMPZeroMemory(&pAd->NullContext.TransferBuffer->field. WirelessPacket[0], 100); pTxInfo = - (PTXINFO_STRUC) & pAd->NullContext.TransferBuffer->field. + (struct rt_txinfo *)& pAd->NullContext.TransferBuffer->field. WirelessPacket[0]; RTMPWriteTxInfo(pAd, pTxInfo, - (u16)(sizeof(HEADER_802_11) + TXWI_SIZE), TRUE, + (u16)(sizeof(struct rt_header_802_11) + TXWI_SIZE), TRUE, EpToQueue[MGMTPIPEIDX], FALSE, FALSE); pTxWI = - (PTXWI_STRUC) & pAd->NullContext.TransferBuffer->field. + (struct rt_txwi *) & pAd->NullContext.TransferBuffer->field. WirelessPacket[TXINFO_SIZE]; RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0, - BSSID_WCID, (sizeof(HEADER_802_11)), 0, 0, + BSSID_WCID, (sizeof(struct rt_header_802_11)), 0, 0, (u8)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_BACKOFF, FALSE, &pAd->CommonCfg.MlmeTransmit); RTMPMoveMemory(&pAd->NullContext.TransferBuffer->field. WirelessPacket[TXWI_SIZE + TXINFO_SIZE], &pAd->NullFrame, - sizeof(HEADER_802_11)); + sizeof(struct rt_header_802_11)); pAd->NullContext.BulkOutSize = TXINFO_SIZE + TXWI_SIZE + sizeof(pAd->NullFrame) + 4; } @@ -2458,15 +2458,15 @@ void ComposeNullFrame(IN PRTMP_ADAPTER pAd) ========================================================================== */ -unsigned long MakeIbssBeacon(IN PRTMP_ADAPTER pAd) +unsigned long MakeIbssBeacon(struct rt_rtmp_adapter *pAd) { u8 DsLen = 1, IbssLen = 2; u8 LocalErpIe[3] = { IE_ERP, 1, 0x04 }; - HEADER_802_11 BcnHdr; + struct rt_header_802_11 BcnHdr; u16 CapabilityInfo; LARGE_INTEGER FakeTimestamp; unsigned long FrameLen = 0; - PTXWI_STRUC pTxWI = &pAd->BeaconTxWI; + struct rt_txwi * pTxWI = &pAd->BeaconTxWI; u8 *pBeaconFrame = pAd->BeaconBuf; BOOLEAN Privacy; u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES]; @@ -2542,7 +2542,7 @@ unsigned long MakeIbssBeacon(IN PRTMP_ADAPTER pAd) 0, 0); MakeOutgoingFrame(pBeaconFrame, &FrameLen, - sizeof(HEADER_802_11), &BcnHdr, + sizeof(struct rt_header_802_11), &BcnHdr, TIMESTAMP_LEN, &FakeTimestamp, 2, &pAd->CommonCfg.BeaconPeriod, 2, &CapabilityInfo, diff --git a/drivers/staging/rt2860/sta/rtmp_data.c b/drivers/staging/rt2860/sta/rtmp_data.c index 3d2d67817768..8c0ab2df0011 100644 --- a/drivers/staging/rt2860/sta/rtmp_data.c +++ b/drivers/staging/rt2860/sta/rtmp_data.c @@ -36,12 +36,12 @@ */ #include "../rt_config.h" -void STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, - IN RX_BLK * pRxBlk, u8 FromWhichBSSID) +void STARxEAPOLFrameIndicate(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID) { PRT28XX_RXD_STRUC pRxD = &(pRxBlk->RxD); - PRXWI_STRUC pRxWI = pRxBlk->pRxWI; + struct rt_rxwi * pRxWI = pRxBlk->pRxWI; u8 *pTmpBuf; if (pAd->StaCfg.WpaSupplicantUP) { @@ -76,7 +76,7 @@ void STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, if (pAd->StaCfg.DesireSharedKey[idx]. KeyLen > 0) { #ifdef RTMP_MAC_PCI - MAC_TABLE_ENTRY *pEntry = + struct rt_mac_table_entry *pEntry = &pAd->MacTab. Content[BSSID_WCID]; @@ -109,11 +109,11 @@ void STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, #ifdef RTMP_MAC_USB union { char buf[sizeof - (NDIS_802_11_WEP) + (struct rt_ndis_802_11_wep) + MAX_LEN_OF_KEY - 1]; - NDIS_802_11_WEP keyinfo; + struct rt_ndis_802_11_wep keyinfo; } WepKey; int len; @@ -202,9 +202,9 @@ void STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd, } -void STARxDataFrameAnnounce(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, - IN RX_BLK * pRxBlk, u8 FromWhichBSSID) +void STARxDataFrameAnnounce(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, + struct rt_rx_blk *pRxBlk, u8 FromWhichBSSID) { /* non-EAP frame */ @@ -265,14 +265,14 @@ void STARxDataFrameAnnounce(IN PRTMP_ADAPTER pAd, } /* For TKIP frame, calculate the MIC value */ -BOOLEAN STACheckTkipMICValue(IN PRTMP_ADAPTER pAd, - IN MAC_TABLE_ENTRY * pEntry, IN RX_BLK * pRxBlk) +BOOLEAN STACheckTkipMICValue(struct rt_rtmp_adapter *pAd, + struct rt_mac_table_entry *pEntry, struct rt_rx_blk *pRxBlk) { - PHEADER_802_11 pHeader = pRxBlk->pHeader; + struct rt_header_802_11 * pHeader = pRxBlk->pHeader; u8 *pData = pRxBlk->pData; u16 DataSize = pRxBlk->DataSize; u8 UserPriority = pRxBlk->UserPriority; - PCIPHER_KEY pWpaKey; + struct rt_cipher_key *pWpaKey; u8 *pDA, *pSA; pWpaKey = &pAd->SharedKey[BSS0][pRxBlk->pRxWI->KeyIndex]; @@ -311,21 +311,21 @@ BOOLEAN STACheckTkipMICValue(IN PRTMP_ADAPTER pAd, } /* */ -/* All Rx routines use RX_BLK structure to hande rx events */ +/* All Rx routines use struct rt_rx_blk structure to hande rx events */ /* It is very important to build pRxBlk attributes */ /* 1. pHeader pointer to 802.11 Header */ /* 2. pData pointer to payload including LLC (just skip Header) */ /* 3. set payload size including LLC to DataSize */ /* 4. set some flags with RX_BLK_SET_FLAG() */ /* */ -void STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) +void STAHandleRxDataFrame(struct rt_rtmp_adapter *pAd, struct rt_rx_blk *pRxBlk) { PRT28XX_RXD_STRUC pRxD = &(pRxBlk->RxD); - PRXWI_STRUC pRxWI = pRxBlk->pRxWI; - PHEADER_802_11 pHeader = pRxBlk->pHeader; + struct rt_rxwi * pRxWI = pRxBlk->pRxWI; + struct rt_header_802_11 * pHeader = pRxBlk->pHeader; void *pRxPacket = pRxBlk->pRxPacket; BOOLEAN bFragment = FALSE; - MAC_TABLE_ENTRY *pEntry = NULL; + struct rt_mac_table_entry *pEntry = NULL; u8 FromWhichBSSID = BSS0; u8 UserPriority = 0; @@ -610,11 +610,11 @@ void STAHandleRxDataFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_FAILURE); } -void STAHandleRxMgmtFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) +void STAHandleRxMgmtFrame(struct rt_rtmp_adapter *pAd, struct rt_rx_blk *pRxBlk) { PRT28XX_RXD_STRUC pRxD = &(pRxBlk->RxD); - PRXWI_STRUC pRxWI = pRxBlk->pRxWI; - PHEADER_802_11 pHeader = pRxBlk->pHeader; + struct rt_rxwi * pRxWI = pRxBlk->pRxWI; + struct rt_header_802_11 * pHeader = pRxBlk->pHeader; void *pRxPacket = pRxBlk->pRxPacket; do { @@ -656,10 +656,10 @@ void STAHandleRxMgmtFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) RELEASE_NDIS_PACKET(pAd, pRxPacket, NDIS_STATUS_SUCCESS); } -void STAHandleRxControlFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) +void STAHandleRxControlFrame(struct rt_rtmp_adapter *pAd, struct rt_rx_blk *pRxBlk) { - PRXWI_STRUC pRxWI = pRxBlk->pRxWI; - PHEADER_802_11 pHeader = pRxBlk->pHeader; + struct rt_rxwi * pRxWI = pRxBlk->pRxWI; + struct rt_header_802_11 * pHeader = pRxBlk->pHeader; void *pRxPacket = pRxBlk->pRxPacket; switch (pHeader->FC.SubType) { @@ -667,7 +667,7 @@ void STAHandleRxControlFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) { CntlEnqueueForRecv(pAd, pRxWI->WirelessCliID, (pRxWI->MPDUtotalByteCount), - (PFRAME_BA_REQ) pHeader); + (struct rt_frame_ba_req *) pHeader); } break; case SUBTYPE_BLOCK_ACK: @@ -698,17 +698,17 @@ void STAHandleRxControlFrame(IN PRTMP_ADAPTER pAd, IN RX_BLK * pRxBlk) Need to consider QOS DATA format when converting to 802.3 ======================================================================== */ -BOOLEAN STARxDoneInterruptHandle(IN PRTMP_ADAPTER pAd, IN BOOLEAN argc) +BOOLEAN STARxDoneInterruptHandle(struct rt_rtmp_adapter *pAd, IN BOOLEAN argc) { int Status; u32 RxProcessed, RxPending; BOOLEAN bReschedule = FALSE; - RT28XX_RXD_STRUC *pRxD; + PRT28XX_RXD_STRUC pRxD; u8 *pData; - PRXWI_STRUC pRxWI; + struct rt_rxwi * pRxWI; void *pRxPacket; - PHEADER_802_11 pHeader; - RX_BLK RxCell; + struct rt_header_802_11 * pHeader; + struct rt_rx_blk RxCell; RxProcessed = RxPending = 0; @@ -750,8 +750,8 @@ BOOLEAN STARxDoneInterruptHandle(IN PRTMP_ADAPTER pAd, IN BOOLEAN argc) pRxD = &(RxCell.RxD); /* get rx data buffer */ pData = GET_OS_PKT_DATAPTR(pRxPacket); - pRxWI = (PRXWI_STRUC) pData; - pHeader = (PHEADER_802_11) (pData + RXWI_SIZE); + pRxWI = (struct rt_rxwi *) pData; + pHeader = (struct rt_header_802_11 *) (pData + RXWI_SIZE); /* build RxCell */ RxCell.pRxWI = pRxWI; @@ -833,7 +833,7 @@ BOOLEAN STARxDoneInterruptHandle(IN PRTMP_ADAPTER pAd, IN BOOLEAN argc) ======================================================================== */ -void RTMPHandleTwakeupInterrupt(IN PRTMP_ADAPTER pAd) +void RTMPHandleTwakeupInterrupt(struct rt_rtmp_adapter *pAd) { AsicForceWakeup(pAd, FALSE); } @@ -860,7 +860,7 @@ void STASendPackets(void *MiniportAdapterContext, void **ppPacketArray, u32 NumberOfPackets) { u32 Index; - PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) MiniportAdapterContext; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)MiniportAdapterContext; void *pPacket; BOOLEAN allowToSend = FALSE; @@ -920,16 +920,16 @@ Note: You only can put OS-indepened & STA related code in here. ======================================================================== */ -int STASendPacket(IN PRTMP_ADAPTER pAd, void *pPacket) +int STASendPacket(struct rt_rtmp_adapter *pAd, void *pPacket) { - PACKET_INFO PacketInfo; + struct rt_packet_info PacketInfo; u8 *pSrcBufVA; u32 SrcBufLen; u32 AllowFragSize; u8 NumberOfFrag; u8 RTSRequired; u8 QueIdx, UserPriority; - MAC_TABLE_ENTRY *pEntry = NULL; + struct rt_mac_table_entry *pEntry = NULL; unsigned int IrqFlags; u8 FlgIsIP = 0; u8 Rate; @@ -1144,7 +1144,7 @@ int STASendPacket(IN PRTMP_ADAPTER pAd, void *pPacket) if ((pAd->CommonCfg.BACapability.field.AutoBA == TRUE) && IS_HT_STA(pEntry)) { - /*PMAC_TABLE_ENTRY pMacEntry = &pAd->MacTab.Content[BSSID_WCID]; */ + /*struct rt_mac_table_entry *pMacEntry = &pAd->MacTab.Content[BSSID_WCID]; */ if (((pEntry->TXBAbitmap & (1 << UserPriority)) == 0) && ((pEntry->BADeclineBitmap & (1 << UserPriority)) == 0) && (pEntry->PortSecured == WPA_802_1X_PORT_SECURED) @@ -1189,7 +1189,7 @@ int STASendPacket(IN PRTMP_ADAPTER pAd, void *pPacket) ======================================================================== */ #ifdef RTMP_MAC_PCI -int RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, +int RTMPFreeTXDRequest(struct rt_rtmp_adapter *pAd, u8 QueIdx, u8 NumberRequired, u8 *FreeNumberIs) { @@ -1244,14 +1244,14 @@ int RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, Actually, this function used to check if the TxHardware Queue still has frame need to send. If no frame need to send, go to sleep, else, still wake up. */ -int RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, +int RTMPFreeTXDRequest(struct rt_rtmp_adapter *pAd, u8 QueIdx, u8 NumberRequired, u8 *FreeNumberIs) { /*unsigned long FreeNumber = 0; */ int Status = NDIS_STATUS_FAILURE; unsigned long IrqFlags; - HT_TX_CONTEXT *pHTTXContext; + struct rt_ht_tx_context *pHTTXContext; switch (QueIdx) { case QID_AC_BK: @@ -1289,16 +1289,16 @@ int RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd, } #endif /* RTMP_MAC_USB // */ -void RTMPSendDisassociationFrame(IN PRTMP_ADAPTER pAd) +void RTMPSendDisassociationFrame(struct rt_rtmp_adapter *pAd) { } -void RTMPSendNullFrame(IN PRTMP_ADAPTER pAd, +void RTMPSendNullFrame(struct rt_rtmp_adapter *pAd, u8 TxRate, IN BOOLEAN bQosNull) { u8 NullFrame[48]; unsigned long Length; - PHEADER_802_11 pHeader_802_11; + struct rt_header_802_11 * pHeader_802_11; /* WPA 802.1x secured port control */ if (((pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPA) || @@ -1311,9 +1311,9 @@ void RTMPSendNullFrame(IN PRTMP_ADAPTER pAd, } NdisZeroMemory(NullFrame, 48); - Length = sizeof(HEADER_802_11); + Length = sizeof(struct rt_header_802_11); - pHeader_802_11 = (PHEADER_802_11) NullFrame; + pHeader_802_11 = (struct rt_header_802_11 *) NullFrame; pHeader_802_11->FC.Type = BTYPE_DATA; pHeader_802_11->FC.SubType = SUBTYPE_NULL_FUNC; @@ -1349,7 +1349,7 @@ void RTMPSendNullFrame(IN PRTMP_ADAPTER pAd, } /* IRQL = DISPATCH_LEVEL */ -void RTMPSendRTSFrame(IN PRTMP_ADAPTER pAd, +void RTMPSendRTSFrame(struct rt_rtmp_adapter *pAd, u8 *pDA, IN unsigned int NextMpduSize, u8 TxRate, @@ -1367,13 +1367,13 @@ void RTMPSendRTSFrame(IN PRTMP_ADAPTER pAd, /* In Cisco CCX 2.0 Leap Authentication */ /* WepStatus is Ndis802_11Encryption1Enabled but the key will use PairwiseKey */ /* Instead of the SharedKey, SharedKey Length may be Zero. */ -void STAFindCipherAlgorithm(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) +void STAFindCipherAlgorithm(struct rt_rtmp_adapter *pAd, struct rt_tx_blk *pTxBlk) { NDIS_802_11_ENCRYPTION_STATUS Cipher; /* To indicate cipher used for this packet */ u8 CipherAlg = CIPHER_NONE; /* cipher alogrithm */ u8 KeyIdx = 0xff; u8 *pSrcBufVA; - PCIPHER_KEY pKey = NULL; + struct rt_cipher_key *pKey = NULL; pSrcBufVA = GET_OS_PKT_DATAPTR(pTxBlk->pPacket); @@ -1429,21 +1429,21 @@ void STAFindCipherAlgorithm(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) pTxBlk->pKey = pKey; } -void STABuildCommon802_11Header(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) +void STABuildCommon802_11Header(struct rt_rtmp_adapter *pAd, struct rt_tx_blk *pTxBlk) { - HEADER_802_11 *pHeader_802_11; + struct rt_header_802_11 *pHeader_802_11; /* */ /* MAKE A COMMON 802.11 HEADER */ /* */ /* normal wlan header size : 24 octets */ - pTxBlk->MpduHeaderLen = sizeof(HEADER_802_11); + pTxBlk->MpduHeaderLen = sizeof(struct rt_header_802_11); pHeader_802_11 = - (HEADER_802_11 *) & pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; + (struct rt_header_802_11 *) & pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; - NdisZeroMemory(pHeader_802_11, sizeof(HEADER_802_11)); + NdisZeroMemory(pHeader_802_11, sizeof(struct rt_header_802_11)); pHeader_802_11->FC.FrDs = 0; pHeader_802_11->FC.Type = BTYPE_DATA; @@ -1510,13 +1510,13 @@ void STABuildCommon802_11Header(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) pHeader_802_11->FC.PwrMgmt = (pAd->StaCfg.Psm == PWR_SAVE); } -void STABuildCache802_11Header(IN RTMP_ADAPTER * pAd, - IN TX_BLK * pTxBlk, u8 * pHeader) +void STABuildCache802_11Header(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, u8 * pHeader) { - MAC_TABLE_ENTRY *pMacEntry; - PHEADER_802_11 pHeader80211; + struct rt_mac_table_entry *pMacEntry; + struct rt_header_802_11 * pHeader80211; - pHeader80211 = (PHEADER_802_11) pHeader; + pHeader80211 = (struct rt_header_802_11 *) pHeader; pMacEntry = pTxBlk->pMacEntry; /* */ @@ -1524,7 +1524,7 @@ void STABuildCache802_11Header(IN RTMP_ADAPTER * pAd, /* */ /* normal wlan header size : 24 octets */ - pTxBlk->MpduHeaderLen = sizeof(HEADER_802_11); + pTxBlk->MpduHeaderLen = sizeof(struct rt_header_802_11); /* More Bit */ pHeader80211->FC.MoreData = TX_BLK_TEST_FLAG(pTxBlk, fTX_bMoreData); @@ -1556,20 +1556,20 @@ void STABuildCache802_11Header(IN RTMP_ADAPTER * pAd, pHeader80211->FC.PwrMgmt = (pAd->StaCfg.Psm == PWR_SAVE); } -static inline u8 *STA_Build_ARalink_Frame_Header(IN RTMP_ADAPTER * pAd, - IN TX_BLK * pTxBlk) +static inline u8 *STA_Build_ARalink_Frame_Header(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk) { u8 *pHeaderBufPtr; - HEADER_802_11 *pHeader_802_11; + struct rt_header_802_11 *pHeader_802_11; void *pNextPacket; u32 nextBufLen; - PQUEUE_ENTRY pQEntry; + struct rt_queue_entry *pQEntry; STAFindCipherAlgorithm(pAd, pTxBlk); STABuildCommon802_11Header(pAd, pTxBlk); pHeaderBufPtr = &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; - pHeader_802_11 = (HEADER_802_11 *) pHeaderBufPtr; + pHeader_802_11 = (struct rt_header_802_11 *) pHeaderBufPtr; /* steal "order" bit to mark "aggregation" */ pHeader_802_11->FC.Order = 1; @@ -1593,7 +1593,7 @@ static inline u8 *STA_Build_ARalink_Frame_Header(IN RTMP_ADAPTER * pAd, pTxBlk->HdrPadLen = (unsigned long)(pHeaderBufPtr - pTxBlk->HdrPadLen); /* For RA Aggregation, */ - /* put the 2nd MSDU length(extra 2-byte field) after QOS_CONTROL in little endian format */ + /* put the 2nd MSDU length(extra 2-byte field) after struct rt_qos_control in little endian format */ pQEntry = pTxBlk->TxPacketList.Head; pNextPacket = QUEUE_ENTRY_TO_PACKET(pQEntry); nextBufLen = GET_OS_PKT_LEN(pNextPacket); @@ -1610,17 +1610,17 @@ static inline u8 *STA_Build_ARalink_Frame_Header(IN RTMP_ADAPTER * pAd, } -static inline u8 *STA_Build_AMSDU_Frame_Header(IN RTMP_ADAPTER * pAd, - IN TX_BLK * pTxBlk) +static inline u8 *STA_Build_AMSDU_Frame_Header(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk) { u8 *pHeaderBufPtr; /*, pSaveBufPtr; */ - HEADER_802_11 *pHeader_802_11; + struct rt_header_802_11 *pHeader_802_11; STAFindCipherAlgorithm(pAd, pTxBlk); STABuildCommon802_11Header(pAd, pTxBlk); pHeaderBufPtr = &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; - pHeader_802_11 = (HEADER_802_11 *) pHeaderBufPtr; + pHeader_802_11 = (struct rt_header_802_11 *) pHeaderBufPtr; /* skip common header */ pHeaderBufPtr += pTxBlk->MpduHeaderLen; @@ -1655,14 +1655,14 @@ static inline u8 *STA_Build_AMSDU_Frame_Header(IN RTMP_ADAPTER * pAd, } -void STA_AMPDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) +void STA_AMPDU_Frame_Tx(struct rt_rtmp_adapter *pAd, struct rt_tx_blk *pTxBlk) { - HEADER_802_11 *pHeader_802_11; + struct rt_header_802_11 *pHeader_802_11; u8 *pHeaderBufPtr; u16 FreeNumber; - MAC_TABLE_ENTRY *pMacEntry; + struct rt_mac_table_entry *pMacEntry; BOOLEAN bVLANPkt; - PQUEUE_ENTRY pQEntry; + struct rt_queue_entry *pQEntry; ASSERT(pTxBlk); @@ -1684,7 +1684,7 @@ void STA_AMPDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) NdisMoveMemory((u8 *)& pTxBlk-> HeaderBuf[TXINFO_SIZE], (u8 *)& pMacEntry->CachedBuf[0], - TXWI_SIZE + sizeof(HEADER_802_11)); + TXWI_SIZE + sizeof(struct rt_header_802_11)); pHeaderBufPtr = (u8 *)(&pTxBlk-> HeaderBuf[TXINFO_SIZE + TXWI_SIZE]); @@ -1697,7 +1697,7 @@ void STA_AMPDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; } - pHeader_802_11 = (HEADER_802_11 *) pHeaderBufPtr; + pHeader_802_11 = (struct rt_header_802_11 *) pHeaderBufPtr; /* skip common header */ pHeaderBufPtr += pTxBlk->MpduHeaderLen; @@ -1773,13 +1773,13 @@ void STA_AMPDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) if (pMacEntry->isCached) { RTMPWriteTxWI_Cache(pAd, - (PTXWI_STRUC) (&pTxBlk-> + (struct rt_txwi *) (&pTxBlk-> HeaderBuf [TXINFO_SIZE]), pTxBlk); } else { RTMPWriteTxWI_Data(pAd, - (PTXWI_STRUC) (&pTxBlk-> + (struct rt_txwi *) (&pTxBlk-> HeaderBuf [TXINFO_SIZE]), pTxBlk); @@ -1819,7 +1819,7 @@ void STA_AMPDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) } -void STA_AMSDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) +void STA_AMSDU_Frame_Tx(struct rt_rtmp_adapter *pAd, struct rt_tx_blk *pTxBlk) { u8 *pHeaderBufPtr; u16 FreeNumber; @@ -1830,7 +1830,7 @@ void STA_AMSDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) u16 FirstTx = 0, LastTxIdx = 0; BOOLEAN bVLANPkt; int frameNum = 0; - PQUEUE_ENTRY pQEntry; + struct rt_queue_entry *pQEntry; ASSERT(pTxBlk); @@ -1864,7 +1864,7 @@ void STA_AMSDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) /* NOTE: TxWI->MPDUtotalByteCount will be updated after final frame was handled. */ RTMPWriteTxWI_Data(pAd, - (PTXWI_STRUC) (&pTxBlk-> + (struct rt_txwi *) (&pTxBlk-> HeaderBuf [TXINFO_SIZE]), pTxBlk); @@ -1951,13 +1951,13 @@ void STA_AMSDU_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); } -void STA_Legacy_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) +void STA_Legacy_Frame_Tx(struct rt_rtmp_adapter *pAd, struct rt_tx_blk *pTxBlk) { - HEADER_802_11 *pHeader_802_11; + struct rt_header_802_11 *pHeader_802_11; u8 *pHeaderBufPtr; u16 FreeNumber; BOOLEAN bVLANPkt; - PQUEUE_ENTRY pQEntry; + struct rt_queue_entry *pQEntry; ASSERT(pTxBlk); @@ -1996,7 +1996,7 @@ void STA_Legacy_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) } pHeaderBufPtr = &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; - pHeader_802_11 = (HEADER_802_11 *) pHeaderBufPtr; + pHeader_802_11 = (struct rt_header_802_11 *) pHeaderBufPtr; /* skip common header */ pHeaderBufPtr += pTxBlk->MpduHeaderLen; @@ -2052,7 +2052,7 @@ void STA_Legacy_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) /* use Wcid as Key Index */ /* */ - RTMPWriteTxWI_Data(pAd, (PTXWI_STRUC) (&pTxBlk->HeaderBuf[TXINFO_SIZE]), + RTMPWriteTxWI_Data(pAd, (struct rt_txwi *) (&pTxBlk->HeaderBuf[TXINFO_SIZE]), pTxBlk); /*FreeNumber = GET_TXRING_FREENO(pAd, QueIdx); */ @@ -2069,7 +2069,7 @@ void STA_Legacy_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) HAL_KickOutTx(pAd, pTxBlk, pTxBlk->QueIdx); } -void STA_ARalink_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) +void STA_ARalink_Frame_Tx(struct rt_rtmp_adapter *pAd, struct rt_tx_blk *pTxBlk) { u8 *pHeaderBufPtr; u16 FreeNumber; @@ -2077,7 +2077,7 @@ void STA_ARalink_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) u16 FirstTx, LastTxIdx; int frameNum = 0; BOOLEAN bVLANPkt; - PQUEUE_ENTRY pQEntry; + struct rt_queue_entry *pQEntry; ASSERT(pTxBlk); @@ -2115,7 +2115,7 @@ void STA_ARalink_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) /* It's ok write the TxWI here, because the TxWI->MPDUtotalByteCount */ /* will be updated after final frame was handled. */ RTMPWriteTxWI_Data(pAd, - (PTXWI_STRUC) (&pTxBlk-> + (struct rt_txwi *) (&pTxBlk-> HeaderBuf [TXINFO_SIZE]), pTxBlk); @@ -2186,19 +2186,19 @@ void STA_ARalink_Frame_Tx(IN PRTMP_ADAPTER pAd, IN TX_BLK * pTxBlk) } -void STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) +void STA_Fragment_Frame_Tx(struct rt_rtmp_adapter *pAd, struct rt_tx_blk *pTxBlk) { - HEADER_802_11 *pHeader_802_11; + struct rt_header_802_11 *pHeader_802_11; u8 *pHeaderBufPtr; u16 FreeNumber; u8 fragNum = 0; - PACKET_INFO PacketInfo; + struct rt_packet_info PacketInfo; u16 EncryptionOverhead = 0; u32 FreeMpduSize, SrcRemainingBytes; u16 AckDuration; u32 NextMpduSize; BOOLEAN bVLANPkt; - PQUEUE_ENTRY pQEntry; + struct rt_queue_entry *pQEntry; HTTRANSMIT_SETTING *pTransmit; ASSERT(pTxBlk); @@ -2236,7 +2236,7 @@ void STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) } pHeaderBufPtr = &pTxBlk->HeaderBuf[TXINFO_SIZE + TXWI_SIZE]; - pHeader_802_11 = (HEADER_802_11 *) pHeaderBufPtr; + pHeader_802_11 = (struct rt_header_802_11 *) pHeaderBufPtr; /* skip common header */ pHeaderBufPtr += pTxBlk->MpduHeaderLen; @@ -2375,7 +2375,7 @@ void STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) pTxBlk->FrameGap = IFS_SIFS; RTMPWriteTxWI_Data(pAd, - (PTXWI_STRUC) (&pTxBlk-> + (struct rt_txwi *) (&pTxBlk-> HeaderBuf[TXINFO_SIZE]), pTxBlk); @@ -2434,11 +2434,11 @@ void STA_Fragment_Frame_Tx(IN RTMP_ADAPTER * pAd, IN TX_BLK * pTxBlk) ======================================================================== */ -int STAHardTransmit(IN PRTMP_ADAPTER pAd, - IN TX_BLK * pTxBlk, u8 QueIdx) +int STAHardTransmit(struct rt_rtmp_adapter *pAd, + struct rt_tx_blk *pTxBlk, u8 QueIdx) { char *pPacket; - PQUEUE_ENTRY pQEntry; + struct rt_queue_entry *pQEntry; /* --------------------------------------------- */ /* STEP 0. DO SANITY CHECK AND SOME EARLY PREPARATION. */ @@ -2537,7 +2537,7 @@ unsigned long HashBytesPolynomial(u8 * value, unsigned int len) return ret; } -void Sta_Announce_or_Forward_802_3_Packet(IN PRTMP_ADAPTER pAd, +void Sta_Announce_or_Forward_802_3_Packet(struct rt_rtmp_adapter *pAd, void *pPacket, u8 FromWhichBSSID) { diff --git a/drivers/staging/rt2860/sta/sanity.c b/drivers/staging/rt2860/sta/sanity.c index a79348f43bc4..64a0e8739048 100644 --- a/drivers/staging/rt2860/sta/sanity.c +++ b/drivers/staging/rt2860/sta/sanity.c @@ -54,14 +54,14 @@ extern u8 BROADCOM_OUI[]; TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -BOOLEAN MlmeStartReqSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN MlmeStartReqSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, char Ssid[], u8 * pSsidLen) { - MLME_START_REQ_STRUCT *Info; + struct rt_mlme_start_req *Info; - Info = (MLME_START_REQ_STRUCT *) (Msg); + Info = (struct rt_mlme_start_req *)(Msg); if (Info->SsidLen > MAX_LEN_OF_SSID) { DBGPRINT(RT_DEBUG_TRACE, @@ -86,15 +86,15 @@ BOOLEAN MlmeStartReqSanity(IN PRTMP_ADAPTER pAd, ========================================================================== */ -BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, void * pMsg, unsigned long MsgLen, u8 *pAddr2, u16 * pCapabilityInfo, u16 * pStatus, u16 * pAid, u8 SupRate[], u8 * pSupRateLen, u8 ExtRate[], u8 * pExtRateLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ +BOOLEAN PeerAssocRspSanity(struct rt_rtmp_adapter *pAd, void * pMsg, unsigned long MsgLen, u8 *pAddr2, u16 * pCapabilityInfo, u16 * pStatus, u16 * pAid, u8 SupRate[], u8 * pSupRateLen, u8 ExtRate[], u8 * pExtRateLen, struct rt_ht_capability_ie * pHtCapability, struct rt_add_ht_info_ie * pAddHtInfo, /* AP might use this additional ht info IE */ u8 * pHtCapabilityLen, u8 * pAddHtInfoLen, u8 * pNewExtChannelOffset, - OUT PEDCA_PARM pEdcaParm, u8 * pCkipFlag) + struct rt_edca_parm *pEdcaParm, u8 * pCkipFlag) { char IeType, *Ptr; - PFRAME_802_11 pFrame = (PFRAME_802_11) pMsg; - PEID_STRUCT pEid; + struct rt_frame_802_11 * pFrame = (struct rt_frame_802_11 *) pMsg; + struct rt_eid * pEid; unsigned long Length = 0; *pNewExtChannelOffset = 0xff; @@ -136,7 +136,7 @@ BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, void * pMsg, unsigned long MsgL /* many AP implement proprietary IEs in non-standard order, we'd better */ /* tolerate mis-ordered IEs to get best compatibility */ - pEid = (PEID_STRUCT) & pFrame->Octet[8 + (*pSupRateLen)]; + pEid = (struct rt_eid *) & pFrame->Octet[8 + (*pSupRateLen)]; /* get variable fields from payload and advance the pointer */ while ((Length + 2 + pEid->Len) <= MsgLen) { @@ -171,11 +171,11 @@ BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, void * pMsg, unsigned long MsgL break; case IE_ADD_HT: case IE_ADD_HT2: - if (pEid->Len >= sizeof(ADD_HT_INFO_IE)) { + if (pEid->Len >= sizeof(struct rt_add_ht_info_ie)) { /* This IE allows extension, but we can ignore extra bytes beyond our knowledge , so only */ - /* copy first sizeof(ADD_HT_INFO_IE) */ + /* copy first sizeof(struct rt_add_ht_info_ie) */ NdisMoveMemory(pAddHtInfo, pEid->Octet, - sizeof(ADD_HT_INFO_IE)); + sizeof(struct rt_add_ht_info_ie)); *(u16 *) (&pAddHtInfo->AddHtInfo2) = cpu2le16(*(u16 *) @@ -237,7 +237,7 @@ BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, void * pMsg, unsigned long MsgL } Length = Length + 2 + pEid->Len; - pEid = (PEID_STRUCT) ((u8 *) pEid + 2 + pEid->Len); + pEid = (struct rt_eid *) ((u8 *) pEid + 2 + pEid->Len); } return TRUE; @@ -254,7 +254,7 @@ BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, void * pMsg, unsigned long MsgL ========================================================================== */ -BOOLEAN PeerProbeReqSanity(IN PRTMP_ADAPTER pAd, +BOOLEAN PeerProbeReqSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned long MsgLen, u8 *pAddr2, @@ -263,7 +263,7 @@ BOOLEAN PeerProbeReqSanity(IN PRTMP_ADAPTER pAd, u8 Idx; u8 RateLen; char IeType; - PFRAME_802_11 pFrame = (PFRAME_802_11) Msg; + struct rt_frame_802_11 * pFrame = (struct rt_frame_802_11 *) Msg; COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2); diff --git a/drivers/staging/rt2860/sta/sync.c b/drivers/staging/rt2860/sta/sync.c index 448e75f0df16..cbe90a6496d2 100644 --- a/drivers/staging/rt2860/sta/sync.c +++ b/drivers/staging/rt2860/sta/sync.c @@ -50,8 +50,8 @@ ========================================================================== */ -void SyncStateMachineInit(IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE * Sm, OUT STATE_MACHINE_FUNC Trans[]) +void SyncStateMachineInit(struct rt_rtmp_adapter *pAd, + struct rt_state_machine *Sm, OUT STATE_MACHINE_FUNC Trans[]) { StateMachineInit(Sm, Trans, MAX_SYNC_STATE, MAX_SYNC_MSG, (STATE_MACHINE_FUNC) Drop, SYNC_IDLE, @@ -115,7 +115,7 @@ void BeaconTimeout(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)FunctionContext; DBGPRINT(RT_DEBUG_TRACE, ("SYNC - BeaconTimeout\n")); @@ -155,7 +155,7 @@ void ScanTimeout(void *SystemSpecific1, void *FunctionContext, void *SystemSpecific2, void *SystemSpecific3) { - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)FunctionContext; /* Do nothing if the driver is starting halt state. */ /* This might happen when timer already been fired before cancel timer with mlmehalt */ @@ -183,13 +183,13 @@ void ScanTimeout(void *SystemSpecific1, MLME SCAN req state machine procedure ========================================================================== */ -void MlmeScanReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeScanReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 Ssid[MAX_LEN_OF_SSID], SsidLen, ScanType, BssType, BBPValue = 0; BOOLEAN TimerCancelled; unsigned long Now; u16 Status; - PHEADER_802_11 pHdr80211; + struct rt_header_802_11 * pHdr80211; u8 *pOutBuffer = NULL; int NStatus; @@ -241,7 +241,7 @@ void MlmeScanReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) && (INFRA_ON(pAd))) { NStatus = MlmeAllocateMemory(pAd, (void *)& pOutBuffer); if (NStatus == NDIS_STATUS_SUCCESS) { - pHdr80211 = (PHEADER_802_11) pOutBuffer; + pHdr80211 = (struct rt_header_802_11 *) pOutBuffer; MgtMacHeaderInit(pAd, pHdr80211, SUBTYPE_NULL_FUNC, 1, pAd->CommonCfg.Bssid, @@ -252,7 +252,7 @@ void MlmeScanReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /* Send using priority queue */ MiniportMMRequest(pAd, 0, pOutBuffer, - sizeof(HEADER_802_11)); + sizeof(struct rt_header_802_11)); DBGPRINT(RT_DEBUG_TRACE, ("MlmeScanReqAction -- Send PSM Data frame for off channel RM\n")); MlmeFreeMemory(pAd, pOutBuffer); @@ -297,12 +297,12 @@ void MlmeScanReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MLME JOIN req state machine procedure ========================================================================== */ -void MlmeJoinReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeJoinReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 BBPValue = 0; - BSS_ENTRY *pBss; + struct rt_bss_entry *pBss; BOOLEAN TimerCancelled; - HEADER_802_11 Hdr80211; + struct rt_header_802_11 Hdr80211; int NStatus; unsigned long FrameLen = 0; u8 *pOutBuffer = NULL; @@ -312,7 +312,7 @@ void MlmeJoinReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) u8 ExtRateLen; u8 ASupRate[] = { 0x8C, 0x12, 0x98, 0x24, 0xb0, 0x48, 0x60, 0x6C }; u8 ASupRateLen = sizeof(ASupRate) / sizeof(u8); - MLME_JOIN_REQ_STRUCT *pInfo = (MLME_JOIN_REQ_STRUCT *) (Elem->Msg); + struct rt_mlme_join_req *pInfo = (struct rt_mlme_join_req *)(Elem->Msg); DBGPRINT(RT_DEBUG_TRACE, ("SYNC - MlmeJoinReqAction(BSS #%ld)\n", pInfo->BssIdx)); @@ -400,7 +400,7 @@ void MlmeJoinReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) BROADCAST_ADDR); MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &Hdr80211, + sizeof(struct rt_header_802_11), &Hdr80211, 1, &SsidIe, 1, &pAd->MlmeAux.SsidLen, pAd->MlmeAux.SsidLen, @@ -437,20 +437,20 @@ void MlmeJoinReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MLME START Request state machine procedure, starting an IBSS ========================================================================== */ -void MlmeStartReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void MlmeStartReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 Ssid[MAX_LEN_OF_SSID], SsidLen; BOOLEAN TimerCancelled; /* New for WPA security suites */ u8 VarIE[MAX_VIE_LEN]; /* Total VIE length = MAX_VIE_LEN - -5 */ - NDIS_802_11_VARIABLE_IEs *pVIE = NULL; + struct rt_ndis_802_11_variable_ies *pVIE = NULL; LARGE_INTEGER TimeStamp; BOOLEAN Privacy; u16 Status; /* Init Variable IE structure */ - pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; + pVIE = (struct rt_ndis_802_11_variable_ies *)VarIE; pVIE->Length = 0; TimeStamp.u.LowPart = 0; TimeStamp.u.HighPart = 0; @@ -506,7 +506,7 @@ void MlmeStartReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) &pAd->StaCfg.DesiredHtPhyInfo.MCSSet[0], &pAd->MlmeAux.HtCapability, &pAd->MlmeAux.AddHtInfo); - pAd->MlmeAux.HtCapabilityLen = sizeof(HT_CAPABILITY_IE); + pAd->MlmeAux.HtCapabilityLen = sizeof(struct rt_ht_capability_ie); /* Not turn pAd->StaActive.SupportedHtPhy.bHtEnable = TRUE here. */ DBGPRINT(RT_DEBUG_TRACE, ("SYNC -pAd->StaActive.SupportedHtPhy.bHtEnable = TRUE\n")); @@ -517,11 +517,11 @@ void MlmeStartReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) MCSSet[0], 16); } /* temporarily not support QOS in IBSS */ - NdisZeroMemory(&pAd->MlmeAux.APEdcaParm, sizeof(EDCA_PARM)); + NdisZeroMemory(&pAd->MlmeAux.APEdcaParm, sizeof(struct rt_edca_parm)); NdisZeroMemory(&pAd->MlmeAux.APQbssLoad, - sizeof(QBSS_LOAD_PARM)); + sizeof(struct rt_qbss_load_parm)); NdisZeroMemory(&pAd->MlmeAux.APQosCapability, - sizeof(QOS_CAPABILITY_PARM)); + sizeof(struct rt_qos_capability_parm)); AsicSwitchChannel(pAd, pAd->MlmeAux.Channel, FALSE); AsicLockChannel(pAd, pAd->MlmeAux.Channel); @@ -550,14 +550,14 @@ void MlmeStartReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) peer sends beacon back when scanning ========================================================================== */ -void PeerBeaconAtScanAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerBeaconAtScanAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 Bssid[MAC_ADDR_LEN], Addr2[MAC_ADDR_LEN]; u8 Ssid[MAX_LEN_OF_SSID], BssType, Channel, NewChannel, SsidLen, DtimCount, DtimPeriod, BcastFlag, MessageToMe; - CF_PARM CfParm; + struct rt_cf_parm CfParm; u16 BeaconPeriod, AtimWin, CapabilityInfo; - PFRAME_802_11 pFrame; + struct rt_frame_802_11 * pFrame; LARGE_INTEGER TimeStamp; u8 Erp; u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES], @@ -566,26 +566,26 @@ void PeerBeaconAtScanAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) u16 LenVIE; u8 CkipFlag; u8 AironetCellPowerLimit; - EDCA_PARM EdcaParm; - QBSS_LOAD_PARM QbssLoad; - QOS_CAPABILITY_PARM QosCapability; + struct rt_edca_parm EdcaParm; + struct rt_qbss_load_parm QbssLoad; + struct rt_qos_capability_parm QosCapability; unsigned long RalinkIe; u8 VarIE[MAX_VIE_LEN]; /* Total VIE length = MAX_VIE_LEN - -5 */ - NDIS_802_11_VARIABLE_IEs *pVIE = NULL; - HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ + struct rt_ndis_802_11_variable_ies *pVIE = NULL; + struct rt_ht_capability_ie HtCapability; + struct rt_add_ht_info_ie AddHtInfo; /* AP might use this additional ht info IE */ u8 HtCapabilityLen = 0, PreNHtCapabilityLen = 0; u8 AddHtInfoLen; u8 NewExtChannelOffset = 0xff; /* NdisFillMemory(Ssid, MAX_LEN_OF_SSID, 0x00); */ - pFrame = (PFRAME_802_11) Elem->Msg; + pFrame = (struct rt_frame_802_11 *) Elem->Msg; /* Init Variable IE structure */ - pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; + pVIE = (struct rt_ndis_802_11_variable_ies *)VarIE; pVIE->Length = 0; RTMPZeroMemory(&HtCapability, sizeof(HtCapability)); - RTMPZeroMemory(&AddHtInfo, sizeof(ADD_HT_INFO_IE)); + RTMPZeroMemory(&AddHtInfo, sizeof(struct rt_add_ht_info_ie)); if (PeerBeaconAndProbeRspSanity(pAd, Elem->Msg, @@ -668,14 +668,14 @@ void PeerBeaconAtScanAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) When waiting joining the (I)BSS, beacon received from external ========================================================================== */ -void PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerBeaconAtJoinAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 Bssid[MAC_ADDR_LEN], Addr2[MAC_ADDR_LEN]; u8 Ssid[MAX_LEN_OF_SSID], SsidLen, BssType, Channel, MessageToMe, DtimCount, DtimPeriod, BcastFlag, NewChannel; LARGE_INTEGER TimeStamp; u16 BeaconPeriod, AtimWin, CapabilityInfo; - CF_PARM Cf; + struct rt_cf_parm Cf; BOOLEAN TimerCancelled; u8 Erp; u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES], @@ -684,16 +684,16 @@ void PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) u8 CkipFlag; u16 LenVIE; u8 AironetCellPowerLimit; - EDCA_PARM EdcaParm; - QBSS_LOAD_PARM QbssLoad; - QOS_CAPABILITY_PARM QosCapability; + struct rt_edca_parm EdcaParm; + struct rt_qbss_load_parm QbssLoad; + struct rt_qos_capability_parm QosCapability; u16 Status; u8 VarIE[MAX_VIE_LEN]; /* Total VIE length = MAX_VIE_LEN - -5 */ - NDIS_802_11_VARIABLE_IEs *pVIE = NULL; + struct rt_ndis_802_11_variable_ies *pVIE = NULL; unsigned long RalinkIe; unsigned long Idx; - HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ + struct rt_ht_capability_ie HtCapability; + struct rt_add_ht_info_ie AddHtInfo; /* AP might use this additional ht info IE */ u8 HtCapabilityLen = 0, PreNHtCapabilityLen = 0; u8 AddHtInfoLen; u8 NewExtChannelOffset = 0xff; @@ -701,10 +701,10 @@ void PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) BOOLEAN bAllowNrate = FALSE; /* Init Variable IE structure */ - pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; + pVIE = (struct rt_ndis_802_11_variable_ies *)VarIE; pVIE->Length = 0; RTMPZeroMemory(&HtCapability, sizeof(HtCapability)); - RTMPZeroMemory(&AddHtInfo, sizeof(ADD_HT_INFO_IE)); + RTMPZeroMemory(&AddHtInfo, sizeof(struct rt_add_ht_info_ie)); if (PeerBeaconAndProbeRspSanity(pAd, Elem->Msg, @@ -993,20 +993,20 @@ void PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) || (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) ) { NdisMoveMemory(&pAd->MlmeAux.APEdcaParm, - &EdcaParm, sizeof(EDCA_PARM)); + &EdcaParm, sizeof(struct rt_edca_parm)); NdisMoveMemory(&pAd->MlmeAux.APQbssLoad, &QbssLoad, - sizeof(QBSS_LOAD_PARM)); + sizeof(struct rt_qbss_load_parm)); NdisMoveMemory(&pAd->MlmeAux.APQosCapability, &QosCapability, - sizeof(QOS_CAPABILITY_PARM)); + sizeof(struct rt_qos_capability_parm)); } else { NdisZeroMemory(&pAd->MlmeAux.APEdcaParm, - sizeof(EDCA_PARM)); + sizeof(struct rt_edca_parm)); NdisZeroMemory(&pAd->MlmeAux.APQbssLoad, - sizeof(QBSS_LOAD_PARM)); + sizeof(struct rt_qbss_load_parm)); NdisZeroMemory(&pAd->MlmeAux.APQosCapability, - sizeof(QOS_CAPABILITY_PARM)); + sizeof(struct rt_qos_capability_parm)); } DBGPRINT(RT_DEBUG_TRACE, @@ -1041,11 +1041,11 @@ void PeerBeaconAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerBeacon(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 Bssid[MAC_ADDR_LEN], Addr2[MAC_ADDR_LEN]; char Ssid[MAX_LEN_OF_SSID]; - CF_PARM CfParm; + struct rt_cf_parm CfParm; u8 SsidLen, MessageToMe = 0, BssType, Channel, NewChannel, index = 0; u8 DtimCount = 0, DtimPeriod = 0, BcastFlag = 0; u16 CapabilityInfo, AtimWin, BeaconPeriod; @@ -1058,15 +1058,15 @@ void PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) u8 CkipFlag; u16 LenVIE; u8 AironetCellPowerLimit; - EDCA_PARM EdcaParm; - QBSS_LOAD_PARM QbssLoad; - QOS_CAPABILITY_PARM QosCapability; + struct rt_edca_parm EdcaParm; + struct rt_qbss_load_parm QbssLoad; + struct rt_qos_capability_parm QosCapability; unsigned long RalinkIe; /* New for WPA security suites */ u8 VarIE[MAX_VIE_LEN]; /* Total VIE length = MAX_VIE_LEN - -5 */ - NDIS_802_11_VARIABLE_IEs *pVIE = NULL; - HT_CAPABILITY_IE HtCapability; - ADD_HT_INFO_IE AddHtInfo; /* AP might use this additional ht info IE */ + struct rt_ndis_802_11_variable_ies *pVIE = NULL; + struct rt_ht_capability_ie HtCapability; + struct rt_add_ht_info_ie AddHtInfo; /* AP might use this additional ht info IE */ u8 HtCapabilityLen, PreNHtCapabilityLen; u8 AddHtInfoLen; u8 NewExtChannelOffset = 0xff; @@ -1076,10 +1076,10 @@ void PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) return; /* Init Variable IE structure */ - pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE; + pVIE = (struct rt_ndis_802_11_variable_ies *)VarIE; pVIE->Length = 0; RTMPZeroMemory(&HtCapability, sizeof(HtCapability)); - RTMPZeroMemory(&AddHtInfo, sizeof(ADD_HT_INFO_IE)); + RTMPZeroMemory(&AddHtInfo, sizeof(struct rt_add_ht_info_ie)); if (PeerBeaconAndProbeRspSanity(pAd, Elem->Msg, @@ -1120,7 +1120,7 @@ void PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) &NewExtChannelOffset, &LenVIE, pVIE)) { BOOLEAN is_my_bssid, is_my_ssid; unsigned long Bssidx, Now; - BSS_ENTRY *pBss; + struct rt_bss_entry *pBss; char RealRssi = RTMPMaxRssi(pAd, ConvertToRssi(pAd, Elem->Rssi0, RSSI_0), ConvertToRssi(pAd, Elem->Rssi1, RSSI_1), @@ -1251,7 +1251,7 @@ void PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /* BEACON from my BSSID - either IBSS or INFRA network */ /* */ if (is_my_bssid) { - RXWI_STRUC RxWI; + struct rt_rxwi RxWI; pAd->StaCfg.DtimCount = DtimCount; pAd->StaCfg.DtimPeriod = DtimPeriod; @@ -1281,7 +1281,7 @@ void PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) if (ADHOC_ON(pAd) && (CAP_IS_IBSS_ON(CapabilityInfo))) { u8 MaxSupportedRateIn500Kbps = 0; u8 idx; - MAC_TABLE_ENTRY *pEntry; + struct rt_mac_table_entry *pEntry; /* supported rates array may not be sorted. sort it and find the maximum rate */ for (idx = 0; idx < SupRateLen; idx++) { @@ -1535,10 +1535,10 @@ void PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) /* copy QOS related information */ NdisMoveMemory(&pAd->CommonCfg.APQbssLoad, &QbssLoad, - sizeof(QBSS_LOAD_PARM)); + sizeof(struct rt_qbss_load_parm)); NdisMoveMemory(&pAd->CommonCfg.APQosCapability, &QosCapability, - sizeof(QOS_CAPABILITY_PARM)); + sizeof(struct rt_qos_capability_parm)); } /* only INFRASTRUCTURE mode support power-saving feature */ if ((INFRA_ON(pAd) && (pAd->StaCfg.Psm == PWR_SAVE)) @@ -1703,13 +1703,13 @@ void PeerBeacon(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Receive PROBE REQ from remote peer when operating in IBSS mode ========================================================================== */ -void PeerProbeReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void PeerProbeReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 Addr2[MAC_ADDR_LEN]; char Ssid[MAX_LEN_OF_SSID]; u8 SsidLen; u8 HtLen, AddHtLen, NewExtLen; - HEADER_802_11 ProbeRspHdr; + struct rt_header_802_11 ProbeRspHdr; int NStatus; u8 *pOutBuffer = NULL; unsigned long FrameLen = 0; @@ -1748,7 +1748,7 @@ void PeerProbeReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Rt802_11PreambleShort), 0, 0); MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &ProbeRspHdr, + sizeof(struct rt_header_802_11), &ProbeRspHdr, TIMESTAMP_LEN, &FakeTimestamp, 2, &pAd->CommonCfg.BeaconPeriod, 2, &CapabilityInfo, @@ -1807,19 +1807,19 @@ void PeerProbeReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) &TmpLen, 1, &HtCapIe, 1, &HtLen, sizeof - (HT_CAPABILITY_IE), + (struct rt_ht_capability_ie), &pAd->CommonCfg. HtCapability, 1, &AddHtInfoIe, 1, &AddHtLen, sizeof - (ADD_HT_INFO_IE), + (struct rt_add_ht_info_ie), &pAd->CommonCfg. AddHTInfo, 1, &NewExtChanIe, 1, &NewExtLen, sizeof - (NEW_EXT_CHAN_IE), + (struct rt_new_ext_chan_ie), &pAd->CommonCfg. NewExtChanOffset, END_OF_ARGS); @@ -1833,7 +1833,7 @@ void PeerProbeReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) } } -void BeaconTimeoutAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void BeaconTimeoutAtJoinAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 Status; DBGPRINT(RT_DEBUG_TRACE, ("SYNC - BeaconTimeoutAtJoinAction\n")); @@ -1848,7 +1848,7 @@ void BeaconTimeoutAtJoinAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Scan timeout procedure. basically add channel index by 1 and rescan ========================================================================== */ -void ScanTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void ScanTimeoutAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { pAd->MlmeAux.Channel = NextChannel(pAd, pAd->MlmeAux.Channel); @@ -1868,7 +1868,7 @@ void ScanTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Description: ========================================================================== */ -void InvalidStateWhenScan(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void InvalidStateWhenScan(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 Status; DBGPRINT(RT_DEBUG_TRACE, @@ -1884,7 +1884,7 @@ void InvalidStateWhenScan(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Description: ========================================================================== */ -void InvalidStateWhenJoin(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void InvalidStateWhenJoin(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 Status; DBGPRINT(RT_DEBUG_TRACE, @@ -1900,7 +1900,7 @@ void InvalidStateWhenJoin(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) Description: ========================================================================== */ -void InvalidStateWhenStart(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void InvalidStateWhenStart(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u16 Status; DBGPRINT(RT_DEBUG_TRACE, @@ -1919,13 +1919,13 @@ void InvalidStateWhenStart(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ========================================================================== */ -void EnqueuePsPoll(IN PRTMP_ADAPTER pAd) +void EnqueuePsPoll(struct rt_rtmp_adapter *pAd) { if (pAd->StaCfg.WindowsPowerMode == Ndis802_11PowerModeLegacy_PSP) pAd->PsPollFrame.FC.PwrMgmt = PWR_SAVE; MiniportMMRequest(pAd, 0, (u8 *)& pAd->PsPollFrame, - sizeof(PSPOLL_FRAME)); + sizeof(struct rt_pspoll_frame)); } /* @@ -1933,12 +1933,12 @@ void EnqueuePsPoll(IN PRTMP_ADAPTER pAd) Description: ========================================================================== */ -void EnqueueProbeRequest(IN PRTMP_ADAPTER pAd) +void EnqueueProbeRequest(struct rt_rtmp_adapter *pAd) { int NState; u8 *pOutBuffer; unsigned long FrameLen = 0; - HEADER_802_11 Hdr80211; + struct rt_header_802_11 Hdr80211; DBGPRINT(RT_DEBUG_TRACE, ("force out a ProbeRequest ...\n")); @@ -1949,7 +1949,7 @@ void EnqueueProbeRequest(IN PRTMP_ADAPTER pAd) /* this ProbeRequest explicitly specify SSID to reduce unwanted ProbeResponse */ MakeOutgoingFrame(pOutBuffer, &FrameLen, - sizeof(HEADER_802_11), &Hdr80211, + sizeof(struct rt_header_802_11), &Hdr80211, 1, &SsidIe, 1, &pAd->CommonCfg.SsidLen, pAd->CommonCfg.SsidLen, pAd->CommonCfg.Ssid, @@ -1963,7 +1963,7 @@ void EnqueueProbeRequest(IN PRTMP_ADAPTER pAd) } -BOOLEAN ScanRunning(IN PRTMP_ADAPTER pAd) +BOOLEAN ScanRunning(struct rt_rtmp_adapter *pAd) { return (pAd->Mlme.SyncMachine.CurrState == SCAN_LISTEN) ? TRUE : FALSE; } diff --git a/drivers/staging/rt2860/sta/wpa.c b/drivers/staging/rt2860/sta/wpa.c index abc730b6565f..69b8a24daa21 100644 --- a/drivers/staging/rt2860/sta/wpa.c +++ b/drivers/staging/rt2860/sta/wpa.c @@ -58,7 +58,7 @@ void inc_byte_array(u8 * counter, int len); ======================================================================== */ -void RTMPReportMicError(IN PRTMP_ADAPTER pAd, IN PCIPHER_KEY pWpaKey) +void RTMPReportMicError(struct rt_rtmp_adapter *pAd, struct rt_cipher_key *pWpaKey) { unsigned long Now; u8 unicastKey = (pWpaKey->Type == PAIRWISE_KEY ? 1 : 0); @@ -113,7 +113,7 @@ void RTMPReportMicError(IN PRTMP_ADAPTER pAd, IN PCIPHER_KEY pWpaKey) #define LENGTH_EAP_H 4 /* If the received frame is EAP-Packet ,find out its EAP-Code (Request(0x01), Response(0x02), Success(0x03), Failure(0x04)). */ -int WpaCheckEapCode(IN PRTMP_ADAPTER pAd, +int WpaCheckEapCode(struct rt_rtmp_adapter *pAd, u8 *pFrame, u16 FrameLen, u16 OffSet) { @@ -133,7 +133,7 @@ int WpaCheckEapCode(IN PRTMP_ADAPTER pAd, return result; } -void WpaSendMicFailureToWpaSupplicant(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUnicast) +void WpaSendMicFailureToWpaSupplicant(struct rt_rtmp_adapter *pAd, IN BOOLEAN bUnicast) { char custom[IW_CUSTOM_MAX] = { 0 }; @@ -147,12 +147,12 @@ void WpaSendMicFailureToWpaSupplicant(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUnicast) return; } -void WpaMicFailureReportFrame(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) +void WpaMicFailureReportFrame(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem) { u8 *pOutBuffer = NULL; u8 Header802_3[14]; unsigned long FrameLen = 0; - EAPOL_PACKET Packet; + struct rt_eapol_packet Packet; u8 Mic[16]; BOOLEAN bUnicast; @@ -259,8 +259,8 @@ void WpaDisassocApAndBlockAssoc(void *SystemSpecific1, void *SystemSpecific2, void *SystemSpecific3) { - RTMP_ADAPTER *pAd = (PRTMP_ADAPTER) FunctionContext; - MLME_DISASSOC_REQ_STRUCT DisassocReq; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)FunctionContext; + struct rt_mlme_disassoc_req DisassocReq; /* disassoc from current AP first */ DBGPRINT(RT_DEBUG_TRACE, @@ -268,16 +268,16 @@ void WpaDisassocApAndBlockAssoc(void *SystemSpecific1, DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_MIC_FAILURE); MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, - sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq); + sizeof(struct rt_mlme_disassoc_req), &DisassocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC; pAd->StaCfg.bBlockAssoc = TRUE; } -void WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd) +void WpaStaPairwiseKeySetting(struct rt_rtmp_adapter *pAd) { - PCIPHER_KEY pSharedKey; - PMAC_TABLE_ENTRY pEntry; + struct rt_cipher_key *pSharedKey; + struct rt_mac_table_entry *pEntry; pEntry = &pAd->MacTab.Content[BSSID_WCID]; @@ -287,7 +287,7 @@ void WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd) NdisMoveMemory(pAd->StaCfg.PTK, pEntry->PTK, LEN_PTK); /* Prepare pair-wise key information into shared key table */ - NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); + NdisZeroMemory(pSharedKey, sizeof(struct rt_cipher_key)); pSharedKey->KeyLen = LEN_TKIP_EK; NdisMoveMemory(pSharedKey->Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.PTK[48], @@ -303,7 +303,7 @@ void WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd) else pSharedKey->CipherAlg = CIPHER_NONE; - /* Update these related information to MAC_TABLE_ENTRY */ + /* Update these related information to struct rt_mac_table_entry */ NdisMoveMemory(pEntry->PairwiseKey.Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK); NdisMoveMemory(pEntry->PairwiseKey.RxMic, &pAd->StaCfg.PTK[48], @@ -330,14 +330,14 @@ void WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd) } -void WpaStaGroupKeySetting(IN PRTMP_ADAPTER pAd) +void WpaStaGroupKeySetting(struct rt_rtmp_adapter *pAd) { - PCIPHER_KEY pSharedKey; + struct rt_cipher_key *pSharedKey; pSharedKey = &pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId]; /* Prepare pair-wise key information into shared key table */ - NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); + NdisZeroMemory(pSharedKey, sizeof(struct rt_cipher_key)); pSharedKey->KeyLen = LEN_TKIP_EK; NdisMoveMemory(pSharedKey->Key, pAd->StaCfg.GTK, LEN_TKIP_EK); NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.GTK[16], diff --git a/drivers/staging/rt2860/sta_ioctl.c b/drivers/staging/rt2860/sta_ioctl.c index d542f4f5f6b5..04f81bdeb0c8 100644 --- a/drivers/staging/rt2860/sta_ioctl.c +++ b/drivers/staging/rt2860/sta_ioctl.c @@ -51,7 +51,7 @@ extern unsigned long RTDebugLevel; extern u8 CipherWpa2Template[]; -typedef struct PACKED _RT_VERSION_INFO { +struct PACKED rt_version_info { u8 DriverVersionW; u8 DriverVersionX; u8 DriverVersionY; @@ -59,7 +59,7 @@ typedef struct PACKED _RT_VERSION_INFO { u32 DriverBuildYear; u32 DriverBuildMonth; u32 DriverBuildDay; -} RT_VERSION_INFO, *PRT_VERSION_INFO; +}; static __s32 ralinkrate[] = { 2, 4, 11, 22, /* CCK */ 12, 18, 24, 36, 48, 72, 96, 108, /* OFDM */ @@ -73,14 +73,14 @@ static __s32 ralinkrate[] = { 2, 4, 11, 22, /* CCK */ 90, 180, 270, 360, 540, 720, 810, 900 }; -int Set_SSID_Proc(IN PRTMP_ADAPTER pAdapter, char *arg); +int Set_SSID_Proc(struct rt_rtmp_adapter *pAdapter, char *arg); -int Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, char *arg); +int Set_NetworkType_Proc(struct rt_rtmp_adapter *pAdapter, char *arg); -void RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) +void RTMPAddKey(struct rt_rtmp_adapter *pAd, struct rt_ndis_802_11_key *pKey) { unsigned long KeyIdx; - MAC_TABLE_ENTRY *pEntry; + struct rt_mac_table_entry *pEntry; DBGPRINT(RT_DEBUG_TRACE, ("RTMPAddKey ------>\n")); @@ -95,7 +95,7 @@ void RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) } /* Update PTK */ NdisZeroMemory(&pAd->SharedKey[BSS0][0], - sizeof(CIPHER_KEY)); + sizeof(struct rt_cipher_key)); pAd->SharedKey[BSS0][0].KeyLen = LEN_TKIP_EK; NdisMoveMemory(pAd->SharedKey[BSS0][0].Key, pKey->KeyMaterial, LEN_TKIP_EK); @@ -129,7 +129,7 @@ void RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) else pAd->SharedKey[BSS0][0].CipherAlg = CIPHER_NONE; - /* Update these related information to MAC_TABLE_ENTRY */ + /* Update these related information to struct rt_mac_table_entry */ pEntry = &pAd->MacTab.Content[BSSID_WCID]; NdisMoveMemory(pEntry->PairwiseKey.Key, pAd->SharedKey[BSS0][0].Key, @@ -174,7 +174,7 @@ void RTMPAddKey(IN PRTMP_ADAPTER pAd, IN PNDIS_802_11_KEY pKey) NdisZeroMemory(&pAd-> SharedKey[BSS0][pAd->StaCfg. DefaultKeyId], - sizeof(CIPHER_KEY)); + sizeof(struct rt_cipher_key)); pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].KeyLen = LEN_TKIP_EK; NdisMoveMemory(pAd-> @@ -373,7 +373,7 @@ int rt_ioctl_siwfreq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *freq, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; int chan = -1; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -407,7 +407,7 @@ int rt_ioctl_giwfreq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *freq, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; u8 ch; unsigned long m = 2412000; @@ -426,7 +426,7 @@ int rt_ioctl_giwfreq(struct net_device *dev, int rt_ioctl_siwmode(struct net_device *dev, struct iw_request_info *info, __u32 * mode, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -462,7 +462,7 @@ int rt_ioctl_siwmode(struct net_device *dev, int rt_ioctl_giwmode(struct net_device *dev, struct iw_request_info *info, __u32 * mode, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -482,7 +482,7 @@ int rt_ioctl_giwmode(struct net_device *dev, int rt_ioctl_siwsens(struct net_device *dev, struct iw_request_info *info, char *name, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -505,7 +505,7 @@ int rt_ioctl_giwrange(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; struct iw_range *range = (struct iw_range *)extra; u16 val; int i; @@ -586,7 +586,7 @@ int rt_ioctl_siwap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *ap_addr, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; NDIS_802_11_MAC_ADDRESS Bssid; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -626,7 +626,7 @@ int rt_ioctl_giwap(struct net_device *dev, struct iw_request_info *info, struct sockaddr *ap_addr, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -662,7 +662,7 @@ int rt_ioctl_giwap(struct net_device *dev, * NB: various calculations are based on the orinoco/wavelan * drivers for compatibility */ -static void set_quality(PRTMP_ADAPTER pAdapter, +static void set_quality(struct rt_rtmp_adapter *pAdapter, struct iw_quality *iq, signed char rssi) { __u8 ChannelQuality; @@ -689,7 +689,7 @@ int rt_ioctl_iwaplist(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; struct sockaddr addr[IW_MAX_AP]; struct iw_quality qual[IW_MAX_AP]; @@ -726,7 +726,7 @@ int rt_ioctl_siwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; unsigned long Now; int Status = NDIS_STATUS_SUCCESS; @@ -802,7 +802,7 @@ int rt_ioctl_giwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; int i = 0; char *current_ev = extra, *previous_ev = extra; char *end_buf; @@ -867,7 +867,7 @@ int rt_ioctl_giwscan(struct net_device *dev, iwe.cmd = SIOCGIWNAME; { - PBSS_ENTRY pBssEntry = &pAdapter->ScanTab.BssEntry[i]; + struct rt_bss_entry *pBssEntry = &pAdapter->ScanTab.BssEntry[i]; BOOLEAN isGonly = FALSE; int rateCnt = 0; @@ -1052,7 +1052,7 @@ int rt_ioctl_giwscan(struct net_device *dev, 0) { int rate_count = sizeof(ralinkrate) / sizeof(__s32); - HT_CAP_INFO capInfo = + struct rt_ht_cap_info capInfo = pAdapter->ScanTab.BssEntry[i].HtCapability. HtCapInfo; int shortGI = @@ -1129,7 +1129,7 @@ int rt_ioctl_siwessid(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *essid) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -1166,7 +1166,7 @@ int rt_ioctl_giwessid(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *essid) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -1204,7 +1204,7 @@ int rt_ioctl_siwnickn(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *nickname) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -1227,7 +1227,7 @@ int rt_ioctl_giwnickn(struct net_device *dev, struct iw_request_info *info, struct iw_point *data, char *nickname) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -1244,7 +1244,7 @@ int rt_ioctl_siwrts(struct net_device *dev, struct iw_request_info *info, struct iw_param *rts, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; u16 val; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -1274,7 +1274,7 @@ int rt_ioctl_giwrts(struct net_device *dev, struct iw_request_info *info, struct iw_param *rts, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -1295,7 +1295,7 @@ int rt_ioctl_siwfrag(struct net_device *dev, struct iw_request_info *info, struct iw_param *frag, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; u16 val; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -1324,7 +1324,7 @@ int rt_ioctl_giwfrag(struct net_device *dev, struct iw_request_info *info, struct iw_param *frag, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -1347,7 +1347,7 @@ int rt_ioctl_siwencode(struct net_device *dev, struct iw_request_info *info, struct iw_point *erq, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -1451,7 +1451,7 @@ rt_ioctl_giwencode(struct net_device *dev, struct iw_point *erq, char *key) { int kid; - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -1506,14 +1506,14 @@ rt_ioctl_giwencode(struct net_device *dev, } -void getBaInfo(IN PRTMP_ADAPTER pAd, char *pOutBuf) +void getBaInfo(struct rt_rtmp_adapter *pAd, char *pOutBuf) { int i, j; - BA_ORI_ENTRY *pOriBAEntry; - BA_REC_ENTRY *pRecBAEntry; + struct rt_ba_ori_entry *pOriBAEntry; + struct rt_ba_rec_entry *pRecBAEntry; for (i = 0; i < MAX_LEN_OF_MAC_TABLE; i++) { - PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[i]; + struct rt_mac_table_entry *pEntry = &pAd->MacTab.Content[i]; if (((pEntry->ValidAsCLI || pEntry->ValidAsApCli) && (pEntry->Sst == SST_ASSOC)) || (pEntry->ValidAsWDS) || (pEntry->ValidAsMesh)) { @@ -1566,11 +1566,11 @@ int rt_ioctl_siwmlme(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; struct iw_mlme *pMlme = (struct iw_mlme *)wrqu->data.pointer; - MLME_QUEUE_ELEM MsgElem; - MLME_DISASSOC_REQ_STRUCT DisAssocReq; - MLME_DEAUTH_REQ_STRUCT DeAuthReq; + struct rt_mlme_queue_elem MsgElem; + struct rt_mlme_disassoc_req DisAssocReq; + struct rt_mlme_deauth_req DeAuthReq; GET_PAD_FROM_NET_DEV(pAd, dev); @@ -1586,9 +1586,9 @@ int rt_ioctl_siwmlme(struct net_device *dev, ("====> %s - IW_MLME_DEAUTH\n", __func__)); COPY_MAC_ADDR(DeAuthReq.Addr, pAd->CommonCfg.Bssid); DeAuthReq.Reason = pMlme->reason_code; - MsgElem.MsgLen = sizeof(MLME_DEAUTH_REQ_STRUCT); + MsgElem.MsgLen = sizeof(struct rt_mlme_deauth_req); NdisMoveMemory(MsgElem.Msg, &DeAuthReq, - sizeof(MLME_DEAUTH_REQ_STRUCT)); + sizeof(struct rt_mlme_deauth_req)); MlmeDeauthReqAction(pAd, &MsgElem); if (INFRA_ON(pAd)) { LinkDown(pAd, FALSE); @@ -1605,9 +1605,9 @@ int rt_ioctl_siwmlme(struct net_device *dev, MsgElem.Machine = ASSOC_STATE_MACHINE; MsgElem.MsgType = MT2_MLME_DISASSOC_REQ; - MsgElem.MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT); + MsgElem.MsgLen = sizeof(struct rt_mlme_disassoc_req); NdisMoveMemory(MsgElem.Msg, &DisAssocReq, - sizeof(MLME_DISASSOC_REQ_STRUCT)); + sizeof(struct rt_mlme_disassoc_req)); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC; MlmeDisassocReqAction(pAd, &MsgElem); @@ -1626,7 +1626,7 @@ int rt_ioctl_siwauth(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; struct iw_param *param = &wrqu->param; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -1776,7 +1776,7 @@ int rt_ioctl_giwauth(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; struct iw_param *param = &wrqu->param; GET_PAD_FROM_NET_DEV(pAdapter, dev); @@ -1815,12 +1815,12 @@ int rt_ioctl_giwauth(struct net_device *dev, return 0; } -void fnSetCipherKey(IN PRTMP_ADAPTER pAdapter, +void fnSetCipherKey(struct rt_rtmp_adapter *pAdapter, int keyIdx, u8 CipherAlg, IN BOOLEAN bGTK, IN struct iw_encode_ext *ext) { - NdisZeroMemory(&pAdapter->SharedKey[BSS0][keyIdx], sizeof(CIPHER_KEY)); + NdisZeroMemory(&pAdapter->SharedKey[BSS0][keyIdx], sizeof(struct rt_cipher_key)); pAdapter->SharedKey[BSS0][keyIdx].KeyLen = LEN_TKIP_EK; NdisMoveMemory(pAdapter->SharedKey[BSS0][keyIdx].Key, ext->key, LEN_TKIP_EK); @@ -1862,7 +1862,7 @@ int rt_ioctl_siwencodeext(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAdapter = NULL; + struct rt_rtmp_adapter *pAdapter = NULL; struct iw_point *encoding = &wrqu->encoding; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; int keyIdx, alg = ext->alg; @@ -1883,7 +1883,7 @@ int rt_ioctl_siwencodeext(struct net_device *dev, pAdapter->SharedKey[BSS0][keyIdx].CipherAlg = CIPHER_NONE; AsicRemoveSharedKeyEntry(pAdapter, 0, (u8)keyIdx); NdisZeroMemory(&pAdapter->SharedKey[BSS0][keyIdx], - sizeof(CIPHER_KEY)); + sizeof(struct rt_cipher_key)); DBGPRINT(RT_DEBUG_TRACE, ("%s::Remove all keys!(encoding->flags = %x)\n", __func__, encoding->flags)); @@ -2018,7 +2018,7 @@ rt_ioctl_giwencodeext(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; char *pKey = NULL; struct iw_point *encoding = &wrqu->encoding; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; @@ -2096,7 +2096,7 @@ int rt_ioctl_siwgenie(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; GET_PAD_FROM_NET_DEV(pAd, dev); @@ -2123,7 +2123,7 @@ int rt_ioctl_giwgenie(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; GET_PAD_FROM_NET_DEV(pAd, dev); @@ -2163,7 +2163,7 @@ int rt_ioctl_siwpmksa(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; struct iw_pmksa *pPmksa = (struct iw_pmksa *)wrqu->data.pointer; int CachedIdx = 0, idx = 0; @@ -2176,7 +2176,7 @@ int rt_ioctl_siwpmksa(struct net_device *dev, switch (pPmksa->cmd) { case IW_PMKSA_FLUSH: NdisZeroMemory(pAd->StaCfg.SavedPMK, - sizeof(BSSID_INFO) * PMKID_NO); + sizeof(struct rt_bssid_info) * PMKID_NO); DBGPRINT(RT_DEBUG_TRACE, ("rt_ioctl_siwpmksa - IW_PMKSA_FLUSH\n")); break; @@ -2267,7 +2267,7 @@ int rt_ioctl_siwrate(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; u32 rate = wrqu->bitrate.value, fixed = wrqu->bitrate.fixed; GET_PAD_FROM_NET_DEV(pAd, dev); @@ -2323,7 +2323,7 @@ int rt_ioctl_giwrate(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - PRTMP_ADAPTER pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; int rate_index = 0, rate_count = 0; HTTRANSMIT_SETTING ht_setting; /* Remove to global variable @@ -2451,7 +2451,7 @@ int rt28xx_sta_ioctl(IN struct net_device *net_dev, IN OUT struct ifreq *rq, int cmd) { struct os_cookie *pObj; - RTMP_ADAPTER *pAd = NULL; + struct rt_rtmp_adapter *pAd = NULL; struct iwreq *wrq = (struct iwreq *)rq; BOOLEAN StateMachineTouched = FALSE; int Status = NDIS_STATUS_SUCCESS; @@ -2639,14 +2639,14 @@ int rt28xx_sta_ioctl(IN struct net_device *net_dev, TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -int Set_SSID_Proc(IN PRTMP_ADAPTER pAdapter, char *arg) +int Set_SSID_Proc(struct rt_rtmp_adapter *pAdapter, char *arg) { - NDIS_802_11_SSID Ssid, *pSsid = NULL; + struct rt_ndis_802_11_ssid Ssid, *pSsid = NULL; BOOLEAN StateMachineTouched = FALSE; int success = TRUE; if (strlen(arg) <= MAX_LEN_OF_SSID) { - NdisZeroMemory(&Ssid, sizeof(NDIS_802_11_SSID)); + NdisZeroMemory(&Ssid, sizeof(struct rt_ndis_802_11_ssid)); if (strlen(arg) != 0) { NdisMoveMemory(Ssid.Ssid, arg, strlen(arg)); Ssid.SsidLength = strlen(arg); @@ -2695,7 +2695,7 @@ int Set_SSID_Proc(IN PRTMP_ADAPTER pAdapter, char *arg) MlmeEnqueue(pAdapter, MLME_CNTL_STATE_MACHINE, OID_802_11_SSID, - sizeof(NDIS_802_11_SSID), (void *) pSsid); + sizeof(struct rt_ndis_802_11_ssid), (void *) pSsid); StateMachineTouched = TRUE; DBGPRINT(RT_DEBUG_TRACE, @@ -2718,7 +2718,7 @@ int Set_SSID_Proc(IN PRTMP_ADAPTER pAdapter, char *arg) TRUE if all parameters are OK, FALSE otherwise ========================================================================== */ -int Set_NetworkType_Proc(IN PRTMP_ADAPTER pAdapter, char *arg) +int Set_NetworkType_Proc(struct rt_rtmp_adapter *pAdapter, char *arg) { u32 Value = 0; diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c index 65b0fd717821..c1d1fb535a37 100644 --- a/drivers/staging/rt2860/usb_main_dev.c +++ b/drivers/staging/rt2860/usb_main_dev.c @@ -148,12 +148,12 @@ int const rtusb_usb_id_len = MODULE_DEVICE_TABLE(usb, rtusb_usb_id); -static void rt2870_disconnect(IN struct usb_device *dev, IN PRTMP_ADAPTER pAd); +static void rt2870_disconnect(struct usb_device *dev, struct rt_rtmp_adapter *pAd); static int __devinit rt2870_probe(IN struct usb_interface *intf, IN struct usb_device *usb_dev, IN const struct usb_device_id *dev_id, - IN RTMP_ADAPTER ** ppAd); + struct rt_rtmp_adapter ** ppAd); #ifndef PF_NOFREEZE #define PF_NOFREEZE 0 @@ -164,7 +164,7 @@ extern int rt28xx_open(struct net_device *net_dev); static BOOLEAN USBDevConfigInit(IN struct usb_device *dev, IN struct usb_interface *intf, - IN RTMP_ADAPTER * pAd); + struct rt_rtmp_adapter *pAd); /* ======================================================================== @@ -222,7 +222,7 @@ static void rtusb_disconnect(struct usb_interface *intf); static BOOLEAN USBDevConfigInit(IN struct usb_device *dev, IN struct usb_interface *intf, - IN RTMP_ADAPTER * pAd) + struct rt_rtmp_adapter *pAd) { struct usb_host_interface *iface_desc; unsigned long BulkOutIdx; @@ -299,7 +299,7 @@ static BOOLEAN USBDevConfigInit(IN struct usb_device *dev, static int rtusb_probe(struct usb_interface *intf, const struct usb_device_id *id) { - RTMP_ADAPTER *pAd; + struct rt_rtmp_adapter *pAd; struct usb_device *dev; int rv; @@ -316,7 +316,7 @@ static int rtusb_probe(struct usb_interface *intf, static void rtusb_disconnect(struct usb_interface *intf) { struct usb_device *dev = interface_to_usbdev(intf); - PRTMP_ADAPTER pAd; + struct rt_rtmp_adapter *pAd; pAd = usb_get_intfdata(intf); usb_set_intfdata(intf, NULL); @@ -338,7 +338,7 @@ resume:rt2870_resume, #ifdef CONFIG_PM -void RT2870RejectPendingPackets(IN PRTMP_ADAPTER pAd) +void RT2870RejectPendingPackets(struct rt_rtmp_adapter *pAd) { /* clear PS packets */ /* clear TxSw packets */ @@ -347,7 +347,7 @@ void RT2870RejectPendingPackets(IN PRTMP_ADAPTER pAd) static int rt2870_suspend(struct usb_interface *intf, pm_message_t state) { struct net_device *net_dev; - PRTMP_ADAPTER pAd = usb_get_intfdata(intf); + struct rt_rtmp_adapter *pAd = usb_get_intfdata(intf); DBGPRINT(RT_DEBUG_TRACE, ("===> rt2870_suspend()\n")); net_dev = pAd->net_dev; @@ -365,7 +365,7 @@ static int rt2870_suspend(struct usb_interface *intf, pm_message_t state) static int rt2870_resume(struct usb_interface *intf) { struct net_device *net_dev; - PRTMP_ADAPTER pAd = usb_get_intfdata(intf); + struct rt_rtmp_adapter *pAd = usb_get_intfdata(intf); DBGPRINT(RT_DEBUG_TRACE, ("===> rt2870_resume()\n")); @@ -418,13 +418,13 @@ Note: */ int MlmeThread(IN void *Context) { - RTMP_ADAPTER *pAd; - RTMP_OS_TASK *pTask; + struct rt_rtmp_adapter *pAd; + struct rt_rtmp_os_task *pTask; int status; status = 0; - pTask = (RTMP_OS_TASK *) Context; - pAd = (PRTMP_ADAPTER) pTask->priv; + pTask = (struct rt_rtmp_os_task *)Context; + pAd = (struct rt_rtmp_adapter *)pTask->priv; RtmpOSTaskCustomize(pTask); @@ -487,13 +487,13 @@ Note: */ int RTUSBCmdThread(IN void *Context) { - RTMP_ADAPTER *pAd; - RTMP_OS_TASK *pTask; + struct rt_rtmp_adapter *pAd; + struct rt_rtmp_os_task *pTask; int status; status = 0; - pTask = (RTMP_OS_TASK *) Context; - pAd = (PRTMP_ADAPTER) pTask->priv; + pTask = (struct rt_rtmp_os_task *)Context; + pAd = (struct rt_rtmp_adapter *)pTask->priv; RtmpOSTaskCustomize(pTask); @@ -522,7 +522,7 @@ int RTUSBCmdThread(IN void *Context) } if (pAd && !pAd->PM_FlgSuspend) { /* Clear the CmdQElements. */ - CmdQElmt *pCmdQElmt = NULL; + struct rt_cmdqelmt *pCmdQElmt = NULL; NdisAcquireSpinLock(&pAd->CmdQLock); pAd->CmdQ.CmdQState = RTMP_TASK_STAT_STOPED; @@ -570,9 +570,9 @@ int RTUSBCmdThread(IN void *Context) } -void RTUSBWatchDog(IN RTMP_ADAPTER * pAd) +void RTUSBWatchDog(struct rt_rtmp_adapter *pAd) { - PHT_TX_CONTEXT pHTTXContext; + struct rt_ht_tx_context *pHTTXContext; int idx; unsigned long irqFlags; PURB pUrb; @@ -635,7 +635,7 @@ void RTUSBWatchDog(IN RTMP_ADAPTER * pAd) ) { /* FIXME: Following code just support single bulk out. If you wanna support multiple bulk out. Modify it! */ pHTTXContext = - (PHT_TX_CONTEXT) (&pAd->TxContext[idx]); + (struct rt_ht_tx_context *)(&pAd->TxContext[idx]); if (pHTTXContext->IRPPending) { /* Check TxContext. */ pUrb = pHTTXContext->pUrb; @@ -644,19 +644,19 @@ void RTUSBWatchDog(IN RTMP_ADAPTER * pAd) pUrb->transfer_buffer_length; isDataPacket = TRUE; } else if (idx == MGMTPIPEIDX) { - PTX_CONTEXT pMLMEContext, pNULLContext, - pPsPollContext; + struct rt_tx_context *pMLMEContext, *pNULLContext, + *pPsPollContext; /*Check MgmtContext. */ pMLMEContext = - (PTX_CONTEXT) (pAd->MgmtRing. + (struct rt_tx_context *)(pAd->MgmtRing. Cell[pAd->MgmtRing. TxDmaIdx]. AllocVa); pPsPollContext = - (PTX_CONTEXT) (&pAd->PsPollContext); + (struct rt_tx_context *)(&pAd->PsPollContext); pNULLContext = - (PTX_CONTEXT) (&pAd->NullContext); + (struct rt_tx_context *)(&pAd->NullContext); if (pMLMEContext->IRPPending) { ASSERT(pMLMEContext-> @@ -724,7 +724,7 @@ void RTUSBWatchDog(IN RTMP_ADAPTER * pAd) /* For Sigma debug, dump the ba_reordering sequence. */ if ((needDumpSeq == TRUE) && (pAd->CommonCfg.bDisableReordering == 0)) { u16 Idx; - PBA_REC_ENTRY pBAEntry = NULL; + struct rt_ba_rec_entry *pBAEntry = NULL; u8 count = 0; struct reordering_mpdu *mpdu_blk; @@ -768,7 +768,7 @@ Return Value: Note: ======================================================================== */ -static void rt2870_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd) +static void rt2870_disconnect(struct usb_device *dev, struct rt_rtmp_adapter *pAd) { DBGPRINT(RT_DEBUG_ERROR, ("rtusb_disconnect: unregister usbnet usb-%s-%s\n", @@ -805,13 +805,13 @@ static void rt2870_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd) static int __devinit rt2870_probe(IN struct usb_interface *intf, IN struct usb_device *usb_dev, IN const struct usb_device_id *dev_id, - IN RTMP_ADAPTER ** ppAd) + struct rt_rtmp_adapter ** ppAd) { struct net_device *net_dev = NULL; - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) NULL; + struct rt_rtmp_adapter *pAd = (struct rt_rtmp_adapter *)NULL; int status, rv; void *handle; - RTMP_OS_NETDEV_OP_HOOK netDevHook; + struct rt_rtmp_os_netdev_op_hook netDevHook; DBGPRINT(RT_DEBUG_TRACE, ("===>rt2870_probe()!\n")); @@ -820,7 +820,7 @@ static int __devinit rt2870_probe(IN struct usb_interface *intf, /* goto err_out; */ /*RtmpDevInit============================================= */ - /* Allocate RTMP_ADAPTER adapter structure */ + /* Allocate struct rt_rtmp_adapter adapter structure */ handle = kmalloc(sizeof(struct os_cookie), GFP_KERNEL); if (handle == NULL) { printk diff --git a/drivers/staging/rt2860/wpa.h b/drivers/staging/rt2860/wpa.h index 05254c8b079a..6199ae6cdcd0 100644 --- a/drivers/staging/rt2860/wpa.h +++ b/drivers/staging/rt2860/wpa.h @@ -48,7 +48,7 @@ /* The length is the EAPoL-Key frame except key data field. */ /* Please refer to 802.11i-2004 ,Figure 43u in p.78 */ -#define LEN_EAPOL_KEY_MSG (sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE) +#define LEN_EAPOL_KEY_MSG (sizeof(struct rt_key_descripter) - MAX_LEN_OF_RSNIE) /* EAP Code Type. */ #define EAP_CODE_REQUEST 1 @@ -195,7 +195,7 @@ #define IS_WPA_CAPABILITY(a) (((a) >= Ndis802_11AuthModeWPA) && ((a) <= Ndis802_11AuthModeWPA1PSKWPA2PSK)) /* EAPOL Key Information definition within Key descriptor format */ -typedef struct PACKED _KEY_INFO { +struct PACKED rt_key_info { u8 KeyMic:1; u8 Secure:1; u8 Error:1; @@ -207,12 +207,12 @@ typedef struct PACKED _KEY_INFO { u8 KeyIndex:2; u8 Install:1; u8 KeyAck:1; -} KEY_INFO, *PKEY_INFO; +}; /* EAPOL Key descriptor format */ -typedef struct PACKED _KEY_DESCRIPTER { +struct PACKED rt_key_descripter { u8 Type; - KEY_INFO KeyInfo; + struct rt_key_info KeyInfo; u8 KeyLength[2]; u8 ReplayCounter[LEN_KEY_DESC_REPLAY]; u8 KeyNonce[LEN_KEY_DESC_NONCE]; @@ -222,34 +222,34 @@ typedef struct PACKED _KEY_DESCRIPTER { u8 KeyMic[LEN_KEY_DESC_MIC]; u8 KeyDataLen[2]; u8 KeyData[MAX_LEN_OF_RSNIE]; -} KEY_DESCRIPTER, *PKEY_DESCRIPTER; +}; -typedef struct PACKED _EAPOL_PACKET { +struct PACKED rt_eapol_packet { u8 ProVer; u8 ProType; u8 Body_Len[2]; - KEY_DESCRIPTER KeyDesc; -} EAPOL_PACKET, *PEAPOL_PACKET; + struct rt_key_descripter KeyDesc; +}; /*802.11i D10 page 83 */ -typedef struct PACKED _GTK_ENCAP { +struct PACKED rt_gtk_encap { u8 Kid:2; u8 tx:1; u8 rsv:5; u8 rsv1; u8 GTK[TKIP_GTK_LENGTH]; -} GTK_ENCAP, *PGTK_ENCAP; +}; -typedef struct PACKED _KDE_ENCAP { +struct PACKED rt_kde_encap { u8 Type; u8 Len; u8 OUI[3]; u8 DataType; - GTK_ENCAP GTKEncap; -} KDE_ENCAP, *PKDE_ENCAP; + struct rt_gtk_encap GTKEncap; +}; /* For WPA1 */ -typedef struct PACKED _RSNIE { +struct PACKED rt_rsnie { u8 oui[4]; u16 version; u8 mcast[4]; @@ -257,25 +257,25 @@ typedef struct PACKED _RSNIE { struct PACKED { u8 oui[4]; } ucast[1]; -} RSNIE, *PRSNIE; +}; /* For WPA2 */ -typedef struct PACKED _RSNIE2 { +struct PACKED rt_rsnie2 { u16 version; u8 mcast[4]; u16 ucount; struct PACKED { u8 oui[4]; } ucast[1]; -} RSNIE2, *PRSNIE2; +}; /* AKM Suite */ -typedef struct PACKED _RSNIE_AUTH { +struct PACKED rt_rsnie_auth { u16 acount; struct PACKED { u8 oui[4]; } auth[1]; -} RSNIE_AUTH, *PRSNIE_AUTH; +}; typedef union PACKED _RSN_CAPABILITIES { struct PACKED { @@ -288,14 +288,14 @@ typedef union PACKED _RSN_CAPABILITIES { u16 word; } RSN_CAPABILITIES, *PRSN_CAPABILITIES; -typedef struct PACKED _EAP_HDR { +struct PACKED rt_eap_hdr { u8 ProVer; u8 ProType; u8 Body_Len[2]; u8 code; u8 identifier; u8 length[2]; /* including code and identifier, followed by length-2 octets of data */ -} EAP_HDR, *PEAP_HDR; +}; /* For supplicant state machine states. 802.11i Draft 4.1, p. 97 */ /* We simplified it */ @@ -338,32 +338,32 @@ typedef enum _WpaMixPairCipher { WPA_TKIPAES_WPA2_TKIPAES = 0x0F, } WPA_MIX_PAIR_CIPHER; -typedef struct PACKED _RSN_IE_HEADER_STRUCT { +struct PACKED rt_rsn_ie_header { u8 Eid; u8 Length; u16 Version; /* Little endian format */ -} RSN_IE_HEADER_STRUCT, *PRSN_IE_HEADER_STRUCT; +}; /* Cipher suite selector types */ -typedef struct PACKED _CIPHER_SUITE_STRUCT { +struct PACKED rt_cipher_suite_struct { u8 Oui[3]; u8 Type; -} CIPHER_SUITE_STRUCT, *PCIPHER_SUITE_STRUCT; +}; /* Authentication and Key Management suite selector */ -typedef struct PACKED _AKM_SUITE_STRUCT { +struct PACKED rt_akm_suite { u8 Oui[3]; u8 Type; -} AKM_SUITE_STRUCT, *PAKM_SUITE_STRUCT; +}; /* RSN capability */ -typedef struct PACKED _RSN_CAPABILITY { +struct PACKED rt_rsn_capability { u16 Rsv:10; u16 GTKSAReplayCnt:2; u16 PTKSAReplayCnt:2; u16 NoPairwise:1; u16 PreAuth:1; -} RSN_CAPABILITY, *PRSN_CAPABILITY; +}; /*======================================== The prototype is defined in cmm_wpa.c diff --git a/drivers/staging/rt2870/common/rtusb_bulk.c b/drivers/staging/rt2870/common/rtusb_bulk.c index d2e967b13a95..379780c72b3c 100644 --- a/drivers/staging/rt2870/common/rtusb_bulk.c +++ b/drivers/staging/rt2870/common/rtusb_bulk.c @@ -58,8 +58,8 @@ void RTUSB_FILL_BULK_URB(struct urb *pUrb, } -void RTUSBInitTxDesc(IN PRTMP_ADAPTER pAd, - IN PTX_CONTEXT pTxContext, +void RTUSBInitTxDesc(struct rt_rtmp_adapter *pAd, + struct rt_tx_context *pTxContext, u8 BulkOutPipeId, IN usb_complete_t Func) { PURB pUrb; @@ -96,8 +96,8 @@ void RTUSBInitTxDesc(IN PRTMP_ADAPTER pAd, } -void RTUSBInitHTTxDesc(IN PRTMP_ADAPTER pAd, - IN PHT_TX_CONTEXT pTxContext, +void RTUSBInitHTTxDesc(struct rt_rtmp_adapter *pAd, + struct rt_ht_tx_context *pTxContext, u8 BulkOutPipeId, unsigned long BulkOutSize, IN usb_complete_t Func) { @@ -128,7 +128,7 @@ void RTUSBInitHTTxDesc(IN PRTMP_ADAPTER pAd, } -void RTUSBInitRxDesc(IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext) +void RTUSBInitRxDesc(struct rt_rtmp_adapter *pAd, struct rt_rx_context *pRxContext) { PURB pUrb; struct os_cookie *pObj = (struct os_cookie *)pAd->OS_Cookie; @@ -179,15 +179,15 @@ void RTUSBInitRxDesc(IN PRTMP_ADAPTER pAd, IN PRX_CONTEXT pRxContext) if(1 /*!(in_interrupt() & 0xffff0000)*/) \ RTMP_IRQ_UNLOCK((pLock), IrqFlags); -void RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, +void RTUSBBulkOutDataPacket(struct rt_rtmp_adapter *pAd, u8 BulkOutPipeId, u8 Index) { - PHT_TX_CONTEXT pHTTXContext; + struct rt_ht_tx_context *pHTTXContext; PURB pUrb; int ret = 0; - PTXINFO_STRUC pTxInfo, pLastTxInfo = NULL; - PTXWI_STRUC pTxWI; + struct rt_txinfo *pTxInfo, *pLastTxInfo = NULL; + struct rt_txwi * pTxWI; unsigned long TmpBulkEndPos, ThisBulkSize; unsigned long IrqFlags = 0, IrqFlags2 = 0; u8 *pWirelessPkt, *pAppendant; @@ -273,9 +273,9 @@ void RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, } do { - pTxInfo = (PTXINFO_STRUC) & pWirelessPkt[TmpBulkEndPos]; + pTxInfo = (struct rt_txinfo *)& pWirelessPkt[TmpBulkEndPos]; pTxWI = - (PTXWI_STRUC) & pWirelessPkt[TmpBulkEndPos + TXINFO_SIZE]; + (struct rt_txwi *) & pWirelessPkt[TmpBulkEndPos + TXINFO_SIZE]; if (pAd->bForcePrintTX == TRUE) DBGPRINT(RT_DEBUG_TRACE, @@ -497,12 +497,12 @@ void RTUSBBulkOutDataPacket(IN PRTMP_ADAPTER pAd, void RTUSBBulkOutDataPacketComplete(struct urb *pUrb, struct pt_regs * pt_regs) { - PHT_TX_CONTEXT pHTTXContext; - PRTMP_ADAPTER pAd; + struct rt_ht_tx_context *pHTTXContext; + struct rt_rtmp_adapter *pAd; struct os_cookie *pObj; u8 BulkOutPipeId; - pHTTXContext = (PHT_TX_CONTEXT) pUrb->context; + pHTTXContext = (struct rt_ht_tx_context *)pUrb->context; pAd = pHTTXContext->pAd; pObj = (struct os_cookie *)pAd->OS_Cookie; @@ -544,9 +544,9 @@ void RTUSBBulkOutDataPacketComplete(struct urb *pUrb, struct pt_regs * pt_regs) ======================================================================== */ -void RTUSBBulkOutNullFrame(IN PRTMP_ADAPTER pAd) +void RTUSBBulkOutNullFrame(struct rt_rtmp_adapter *pAd) { - PTX_CONTEXT pNullContext = &(pAd->NullContext); + struct rt_tx_context *pNullContext = &(pAd->NullContext); PURB pUrb; int ret = 0; unsigned long IrqFlags; @@ -591,12 +591,12 @@ void RTUSBBulkOutNullFrame(IN PRTMP_ADAPTER pAd) /* NULL frame use BulkOutPipeId = 0 */ void RTUSBBulkOutNullFrameComplete(struct urb *pUrb, struct pt_regs * pt_regs) { - PRTMP_ADAPTER pAd; - PTX_CONTEXT pNullContext; + struct rt_rtmp_adapter *pAd; + struct rt_tx_context *pNullContext; int Status; struct os_cookie *pObj; - pNullContext = (PTX_CONTEXT) pUrb->context; + pNullContext = (struct rt_tx_context *)pUrb->context; pAd = pNullContext->pAd; Status = pUrb->status; @@ -618,15 +618,15 @@ void RTUSBBulkOutNullFrameComplete(struct urb *pUrb, struct pt_regs * pt_regs) ======================================================================== */ -void RTUSBBulkOutMLMEPacket(IN PRTMP_ADAPTER pAd, u8 Index) +void RTUSBBulkOutMLMEPacket(struct rt_rtmp_adapter *pAd, u8 Index) { - PTX_CONTEXT pMLMEContext; + struct rt_tx_context *pMLMEContext; PURB pUrb; int ret = 0; unsigned long IrqFlags; pMLMEContext = - (PTX_CONTEXT) pAd->MgmtRing.Cell[pAd->MgmtRing.TxDmaIdx].AllocVa; + (struct rt_tx_context *)pAd->MgmtRing.Cell[pAd->MgmtRing.TxDmaIdx].AllocVa; pUrb = pMLMEContext->pUrb; if ((pAd->MgmtRing.TxSwFreeIdx >= MGMT_RING_SIZE) || @@ -686,14 +686,14 @@ void RTUSBBulkOutMLMEPacket(IN PRTMP_ADAPTER pAd, u8 Index) void RTUSBBulkOutMLMEPacketComplete(struct urb *pUrb, struct pt_regs * pt_regs) { - PTX_CONTEXT pMLMEContext; - PRTMP_ADAPTER pAd; + struct rt_tx_context *pMLMEContext; + struct rt_rtmp_adapter *pAd; int Status; struct os_cookie *pObj; int index; /*DBGPRINT_RAW(RT_DEBUG_INFO, ("--->RTUSBBulkOutMLMEPacketComplete\n")); */ - pMLMEContext = (PTX_CONTEXT) pUrb->context; + pMLMEContext = (struct rt_tx_context *)pUrb->context; pAd = pMLMEContext->pAd; pObj = (struct os_cookie *)pAd->OS_Cookie; Status = pUrb->status; @@ -716,9 +716,9 @@ void RTUSBBulkOutMLMEPacketComplete(struct urb *pUrb, struct pt_regs * pt_regs) ======================================================================== */ -void RTUSBBulkOutPsPoll(IN PRTMP_ADAPTER pAd) +void RTUSBBulkOutPsPoll(struct rt_rtmp_adapter *pAd) { - PTX_CONTEXT pPsPollContext = &(pAd->PsPollContext); + struct rt_tx_context *pPsPollContext = &(pAd->PsPollContext); PURB pUrb; int ret = 0; unsigned long IrqFlags; @@ -760,12 +760,12 @@ void RTUSBBulkOutPsPoll(IN PRTMP_ADAPTER pAd) /* PS-Poll frame use BulkOutPipeId = 0 */ void RTUSBBulkOutPsPollComplete(struct urb *pUrb, struct pt_regs * pt_regs) { - PRTMP_ADAPTER pAd; - PTX_CONTEXT pPsPollContext; + struct rt_rtmp_adapter *pAd; + struct rt_tx_context *pPsPollContext; int Status; struct os_cookie *pObj; - pPsPollContext = (PTX_CONTEXT) pUrb->context; + pPsPollContext = (struct rt_tx_context *)pUrb->context; pAd = pPsPollContext->pAd; Status = pUrb->status; @@ -774,9 +774,9 @@ void RTUSBBulkOutPsPollComplete(struct urb *pUrb, struct pt_regs * pt_regs) tasklet_hi_schedule(&pObj->pspoll_frame_complete_task); } -void DoBulkIn(IN RTMP_ADAPTER * pAd) +void DoBulkIn(struct rt_rtmp_adapter *pAd) { - PRX_CONTEXT pRxContext; + struct rt_rx_context *pRxContext; PURB pUrb; int ret = 0; unsigned long IrqFlags; @@ -845,9 +845,9 @@ void DoBulkIn(IN RTMP_ADAPTER * pAd) fRTMP_ADAPTER_RADIO_OFF | fRTMP_ADAPTER_RESET_IN_PROGRESS | \ fRTMP_ADAPTER_REMOVE_IN_PROGRESS) -void RTUSBBulkReceive(IN PRTMP_ADAPTER pAd) +void RTUSBBulkReceive(struct rt_rtmp_adapter *pAd) { - PRX_CONTEXT pRxContext; + struct rt_rx_context *pRxContext; unsigned long IrqFlags; /* sanity check */ @@ -917,11 +917,11 @@ void RTUSBBulkRxComplete(struct urb *pUrb, struct pt_regs *pt_regs) /* use a receive tasklet to handle received packets; */ /* or sometimes hardware IRQ will be disabled here, so we can not */ /* use spin_lock_bh()/spin_unlock_bh() after IRQ is disabled. :< */ - PRX_CONTEXT pRxContext; - PRTMP_ADAPTER pAd; + struct rt_rx_context *pRxContext; + struct rt_rtmp_adapter *pAd; struct os_cookie *pObj; - pRxContext = (PRX_CONTEXT) pUrb->context; + pRxContext = (struct rt_rx_context *)pUrb->context; pAd = pRxContext->pAd; pObj = (struct os_cookie *)pAd->OS_Cookie; @@ -943,7 +943,7 @@ void RTUSBBulkRxComplete(struct urb *pUrb, struct pt_regs *pt_regs) ======================================================================== */ -void RTUSBKickBulkOut(IN PRTMP_ADAPTER pAd) +void RTUSBKickBulkOut(struct rt_rtmp_adapter *pAd) { /* BulkIn Reset will reset whole USB PHY. So we need to make sure fRTMP_ADAPTER_BULKIN_RESET not flaged. */ if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NEED_STOP_TX) @@ -1033,10 +1033,10 @@ void RTUSBKickBulkOut(IN PRTMP_ADAPTER pAd) ======================================================================== */ -void RTUSBCleanUpDataBulkOutQueue(IN PRTMP_ADAPTER pAd) +void RTUSBCleanUpDataBulkOutQueue(struct rt_rtmp_adapter *pAd) { u8 Idx; - PHT_TX_CONTEXT pTxContext; + struct rt_ht_tx_context *pTxContext; DBGPRINT(RT_DEBUG_TRACE, ("--->CleanUpDataBulkOutQueue\n")); @@ -1066,7 +1066,7 @@ void RTUSBCleanUpDataBulkOutQueue(IN PRTMP_ADAPTER pAd) ======================================================================== */ -void RTUSBCleanUpMLMEBulkOutQueue(IN PRTMP_ADAPTER pAd) +void RTUSBCleanUpMLMEBulkOutQueue(struct rt_rtmp_adapter *pAd) { DBGPRINT(RT_DEBUG_TRACE, ("--->CleanUpMLMEBulkOutQueue\n")); DBGPRINT(RT_DEBUG_TRACE, ("<---CleanUpMLMEBulkOutQueue\n")); @@ -1085,7 +1085,7 @@ void RTUSBCleanUpMLMEBulkOutQueue(IN PRTMP_ADAPTER pAd) ======================================================================== */ -void RTUSBCancelPendingIRPs(IN PRTMP_ADAPTER pAd) +void RTUSBCancelPendingIRPs(struct rt_rtmp_adapter *pAd) { RTUSBCancelPendingBulkInIRP(pAd); RTUSBCancelPendingBulkOutIRP(pAd); @@ -1104,9 +1104,9 @@ void RTUSBCancelPendingIRPs(IN PRTMP_ADAPTER pAd) ======================================================================== */ -void RTUSBCancelPendingBulkInIRP(IN PRTMP_ADAPTER pAd) +void RTUSBCancelPendingBulkInIRP(struct rt_rtmp_adapter *pAd) { - PRX_CONTEXT pRxContext; + struct rt_rx_context *pRxContext; u32 i; DBGPRINT_RAW(RT_DEBUG_TRACE, ("--->RTUSBCancelPendingBulkInIRP\n")); @@ -1136,14 +1136,14 @@ void RTUSBCancelPendingBulkInIRP(IN PRTMP_ADAPTER pAd) ======================================================================== */ -void RTUSBCancelPendingBulkOutIRP(IN PRTMP_ADAPTER pAd) +void RTUSBCancelPendingBulkOutIRP(struct rt_rtmp_adapter *pAd) { - PHT_TX_CONTEXT pHTTXContext; - PTX_CONTEXT pMLMEContext; - PTX_CONTEXT pBeaconContext; - PTX_CONTEXT pNullContext; - PTX_CONTEXT pPsPollContext; - PTX_CONTEXT pRTSContext; + struct rt_ht_tx_context *pHTTXContext; + struct rt_tx_context *pMLMEContext; + struct rt_tx_context *pBeaconContext; + struct rt_tx_context *pNullContext; + struct rt_tx_context *pPsPollContext; + struct rt_tx_context *pRTSContext; u32 i, Idx; /* unsigned int IrqFlags; */ /* spinlock_t *pLock; */ @@ -1173,7 +1173,7 @@ void RTUSBCancelPendingBulkOutIRP(IN PRTMP_ADAPTER pAd) /*RTMP_IRQ_LOCK(pLock, IrqFlags); */ for (i = 0; i < MGMT_RING_SIZE; i++) { - pMLMEContext = (PTX_CONTEXT) pAd->MgmtRing.Cell[i].AllocVa; + pMLMEContext = (struct rt_tx_context *)pAd->MgmtRing.Cell[i].AllocVa; if (pMLMEContext && (pMLMEContext->IRPPending == TRUE)) { /* Get the USB_CONTEXT and cancel it's IRP; the completion routine will itself */ diff --git a/drivers/staging/rt2870/common/rtusb_data.c b/drivers/staging/rt2870/common/rtusb_data.c index 471fd4ead812..4583764c78d2 100644 --- a/drivers/staging/rt2870/common/rtusb_data.c +++ b/drivers/staging/rt2870/common/rtusb_data.c @@ -44,7 +44,7 @@ extern u8 Phy11BGNextRateUpward[]; /* defined in mlme.c */ extern u8 EpToQueue[]; -void REPORT_AMSDU_FRAMES_TO_LLC(IN PRTMP_ADAPTER pAd, +void REPORT_AMSDU_FRAMES_TO_LLC(struct rt_rtmp_adapter *pAd, u8 *pData, unsigned long DataSize) { void *pPacket; @@ -85,7 +85,7 @@ void REPORT_AMSDU_FRAMES_TO_LLC(IN PRTMP_ADAPTER pAd, ======================================================================== */ -int RTUSBFreeDescriptorRequest(IN PRTMP_ADAPTER pAd, +int RTUSBFreeDescriptorRequest(struct rt_rtmp_adapter *pAd, u8 BulkOutPipeId, u32 NumberRequired) { @@ -93,7 +93,7 @@ int RTUSBFreeDescriptorRequest(IN PRTMP_ADAPTER pAd, /* u32 Index; */ int Status = NDIS_STATUS_FAILURE; unsigned long IrqFlags; - HT_TX_CONTEXT *pHTTXContext; + struct rt_ht_tx_context *pHTTXContext; pHTTXContext = &pAd->TxContext[BulkOutPipeId]; RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); @@ -127,11 +127,11 @@ int RTUSBFreeDescriptorRequest(IN PRTMP_ADAPTER pAd, return (Status); } -int RTUSBFreeDescriptorRelease(IN RTMP_ADAPTER * pAd, +int RTUSBFreeDescriptorRelease(struct rt_rtmp_adapter *pAd, u8 BulkOutPipeId) { unsigned long IrqFlags; - HT_TX_CONTEXT *pHTTXContext; + struct rt_ht_tx_context *pHTTXContext; pHTTXContext = &pAd->TxContext[BulkOutPipeId]; RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); @@ -141,10 +141,10 @@ int RTUSBFreeDescriptorRelease(IN RTMP_ADAPTER * pAd, return (NDIS_STATUS_SUCCESS); } -BOOLEAN RTUSBNeedQueueBackForAgg(IN RTMP_ADAPTER * pAd, u8 BulkOutPipeId) +BOOLEAN RTUSBNeedQueueBackForAgg(struct rt_rtmp_adapter *pAd, u8 BulkOutPipeId) { unsigned long IrqFlags; - HT_TX_CONTEXT *pHTTXContext; + struct rt_ht_tx_context *pHTTXContext; BOOLEAN needQueBack = FALSE; pHTTXContext = &pAd->TxContext[BulkOutPipeId]; @@ -191,17 +191,17 @@ BOOLEAN RTUSBNeedQueueBackForAgg(IN RTMP_ADAPTER * pAd, u8 BulkOutPipeId) ======================================================================== */ -void RTUSBRejectPendingPackets(IN PRTMP_ADAPTER pAd) +void RTUSBRejectPendingPackets(struct rt_rtmp_adapter *pAd) { u8 Index; - PQUEUE_ENTRY pEntry; + struct rt_queue_entry *pEntry; void *pPacket; - PQUEUE_HEADER pQueue; + struct rt_queue_header *pQueue; for (Index = 0; Index < 4; Index++) { NdisAcquireSpinLock(&pAd->TxSwQueueLock[Index]); while (pAd->TxSwQueue[Index].Head != NULL) { - pQueue = (PQUEUE_HEADER) & (pAd->TxSwQueue[Index]); + pQueue = (struct rt_queue_header *)& (pAd->TxSwQueue[Index]); pEntry = RemoveHeadQueue(pQueue); pPacket = QUEUE_ENTRY_TO_PACKET(pEntry); RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); @@ -240,8 +240,8 @@ void RTUSBRejectPendingPackets(IN PRTMP_ADAPTER pAd) ======================================================================== */ -void RTMPWriteTxInfo(IN PRTMP_ADAPTER pAd, - IN PTXINFO_STRUC pTxInfo, +void RTMPWriteTxInfo(struct rt_rtmp_adapter *pAd, + struct rt_txinfo *pTxInfo, u16 USBDMApktLen, IN BOOLEAN bWiv, u8 QueueSel, u8 NextValid, u8 TxBurst) diff --git a/drivers/staging/rt2870/common/rtusb_io.c b/drivers/staging/rt2870/common/rtusb_io.c index d15a92eef04a..34443f2243f1 100644 --- a/drivers/staging/rt2870/common/rtusb_io.c +++ b/drivers/staging/rt2870/common/rtusb_io.c @@ -56,7 +56,7 @@ ======================================================================== */ -static int RTUSBFirmwareRun(IN PRTMP_ADAPTER pAd) +static int RTUSBFirmwareRun(struct rt_rtmp_adapter *pAd) { int Status; @@ -83,7 +83,7 @@ static int RTUSBFirmwareRun(IN PRTMP_ADAPTER pAd) ======================================================================== */ -int RTUSBFirmwareWrite(IN PRTMP_ADAPTER pAd, +int RTUSBFirmwareWrite(struct rt_rtmp_adapter *pAd, u8 *pFwImage, unsigned long FwLen) { u32 MacReg; @@ -109,7 +109,7 @@ int RTUSBFirmwareWrite(IN PRTMP_ADAPTER pAd, return Status; } -int RTUSBVenderReset(IN PRTMP_ADAPTER pAd) +int RTUSBVenderReset(struct rt_rtmp_adapter *pAd) { int Status; DBGPRINT_RAW(RT_DEBUG_ERROR, ("-->RTUSBVenderReset\n")); @@ -137,7 +137,7 @@ int RTUSBVenderReset(IN PRTMP_ADAPTER pAd) ======================================================================== */ -int RTUSBMultiRead(IN PRTMP_ADAPTER pAd, +int RTUSBMultiRead(struct rt_rtmp_adapter *pAd, u16 Offset, u8 *pData, u16 length) { int Status; @@ -166,7 +166,7 @@ int RTUSBMultiRead(IN PRTMP_ADAPTER pAd, ======================================================================== */ -int RTUSBMultiWrite_OneByte(IN PRTMP_ADAPTER pAd, +int RTUSBMultiWrite_OneByte(struct rt_rtmp_adapter *pAd, u16 Offset, u8 *pData) { int Status; @@ -180,7 +180,7 @@ int RTUSBMultiWrite_OneByte(IN PRTMP_ADAPTER pAd, return Status; } -int RTUSBMultiWrite(IN PRTMP_ADAPTER pAd, +int RTUSBMultiWrite(struct rt_rtmp_adapter *pAd, u16 Offset, u8 *pData, u16 length) { int Status; @@ -202,7 +202,7 @@ int RTUSBMultiWrite(IN PRTMP_ADAPTER pAd, return Status; } -int RTUSBSingleWrite(IN RTMP_ADAPTER * pAd, +int RTUSBSingleWrite(struct rt_rtmp_adapter *pAd, u16 Offset, u16 Value) { int Status; @@ -231,7 +231,7 @@ int RTUSBSingleWrite(IN RTMP_ADAPTER * pAd, ======================================================================== */ -int RTUSBReadMACRegister(IN PRTMP_ADAPTER pAd, +int RTUSBReadMACRegister(struct rt_rtmp_adapter *pAd, u16 Offset, u32 *pValue) { int Status = 0; @@ -266,7 +266,7 @@ int RTUSBReadMACRegister(IN PRTMP_ADAPTER pAd, ======================================================================== */ -int RTUSBWriteMACRegister(IN PRTMP_ADAPTER pAd, +int RTUSBWriteMACRegister(struct rt_rtmp_adapter *pAd, u16 Offset, u32 Value) { int Status; @@ -297,7 +297,7 @@ int RTUSBWriteMACRegister(IN PRTMP_ADAPTER pAd, ======================================================================== */ -int RTUSBReadBBPRegister(IN PRTMP_ADAPTER pAd, +int RTUSBReadBBPRegister(struct rt_rtmp_adapter *pAd, u8 Id, u8 *pValue) { BBP_CSR_CFG_STRUC BbpCsr; @@ -383,7 +383,7 @@ int RTUSBReadBBPRegister(IN PRTMP_ADAPTER pAd, ======================================================================== */ -int RTUSBWriteBBPRegister(IN PRTMP_ADAPTER pAd, +int RTUSBWriteBBPRegister(struct rt_rtmp_adapter *pAd, u8 Id, u8 Value) { BBP_CSR_CFG_STRUC BbpCsr; @@ -438,7 +438,7 @@ int RTUSBWriteBBPRegister(IN PRTMP_ADAPTER pAd, ======================================================================== */ -int RTUSBWriteRFRegister(IN PRTMP_ADAPTER pAd, u32 Value) +int RTUSBWriteRFRegister(struct rt_rtmp_adapter *pAd, u32 Value) { PHY_CSR4_STRUC PhyCsr4; u32 i = 0; @@ -486,7 +486,7 @@ int RTUSBWriteRFRegister(IN PRTMP_ADAPTER pAd, u32 Value) ======================================================================== */ -int RTUSBReadEEPROM(IN PRTMP_ADAPTER pAd, +int RTUSBReadEEPROM(struct rt_rtmp_adapter *pAd, u16 Offset, u8 *pData, u16 length) { int Status = STATUS_SUCCESS; @@ -515,7 +515,7 @@ int RTUSBReadEEPROM(IN PRTMP_ADAPTER pAd, ======================================================================== */ -int RTUSBWriteEEPROM(IN PRTMP_ADAPTER pAd, +int RTUSBWriteEEPROM(struct rt_rtmp_adapter *pAd, u16 Offset, u8 *pData, u16 length) { int Status = STATUS_SUCCESS; @@ -528,7 +528,7 @@ int RTUSBWriteEEPROM(IN PRTMP_ADAPTER pAd, return Status; } -int RTUSBReadEEPROM16(IN PRTMP_ADAPTER pAd, +int RTUSBReadEEPROM16(struct rt_rtmp_adapter *pAd, u16 offset, u16 *pData) { int status; @@ -557,7 +557,7 @@ int RTUSBReadEEPROM16(IN PRTMP_ADAPTER pAd, ======================================================================== */ -void RTUSBPutToSleep(IN PRTMP_ADAPTER pAd) +void RTUSBPutToSleep(struct rt_rtmp_adapter *pAd) { u32 value; @@ -585,7 +585,7 @@ void RTUSBPutToSleep(IN PRTMP_ADAPTER pAd) ======================================================================== */ -int RTUSBWakeUp(IN PRTMP_ADAPTER pAd) +int RTUSBWakeUp(struct rt_rtmp_adapter *pAd) { int Status; @@ -612,7 +612,7 @@ int RTUSBWakeUp(IN PRTMP_ADAPTER pAd) ======================================================================== */ -void RTUSBInitializeCmdQ(IN PCmdQ cmdq) +void RTUSBInitializeCmdQ(struct rt_cmdq *cmdq) { cmdq->head = NULL; cmdq->tail = NULL; @@ -635,15 +635,15 @@ void RTUSBInitializeCmdQ(IN PCmdQ cmdq) ======================================================================== */ -int RTUSBEnqueueCmdFromNdis(IN PRTMP_ADAPTER pAd, +int RTUSBEnqueueCmdFromNdis(struct rt_rtmp_adapter *pAd, IN NDIS_OID Oid, IN BOOLEAN SetInformation, void *pInformationBuffer, u32 InformationBufferLength) { int status; - PCmdQElmt cmdqelmt = NULL; - RTMP_OS_TASK *pTask = &pAd->cmdQTask; + struct rt_cmdqelmt *cmdqelmt = NULL; + struct rt_rtmp_os_task *pTask = &pAd->cmdQTask; #ifdef KTHREAD_SUPPORT if (pTask->kthread_task == NULL) @@ -654,7 +654,7 @@ int RTUSBEnqueueCmdFromNdis(IN PRTMP_ADAPTER pAd, #endif return (NDIS_STATUS_RESOURCES); - status = os_alloc_mem(pAd, (u8 **) (&cmdqelmt), sizeof(CmdQElmt)); + status = os_alloc_mem(pAd, (u8 **) (&cmdqelmt), sizeof(struct rt_cmdqelmt)); if ((status != NDIS_STATUS_SUCCESS) || (cmdqelmt == NULL)) return (NDIS_STATUS_RESOURCES); @@ -716,18 +716,18 @@ int RTUSBEnqueueCmdFromNdis(IN PRTMP_ADAPTER pAd, ======================================================================== */ -int RTUSBEnqueueInternalCmd(IN PRTMP_ADAPTER pAd, +int RTUSBEnqueueInternalCmd(struct rt_rtmp_adapter *pAd, IN NDIS_OID Oid, void *pInformationBuffer, u32 InformationBufferLength) { int status; - PCmdQElmt cmdqelmt = NULL; + struct rt_cmdqelmt *cmdqelmt = NULL; - status = os_alloc_mem(pAd, (u8 **) & cmdqelmt, sizeof(CmdQElmt)); + status = os_alloc_mem(pAd, (u8 **) & cmdqelmt, sizeof(struct rt_cmdqelmt)); if ((status != NDIS_STATUS_SUCCESS) || (cmdqelmt == NULL)) return (NDIS_STATUS_RESOURCES); - NdisZeroMemory(cmdqelmt, sizeof(CmdQElmt)); + NdisZeroMemory(cmdqelmt, sizeof(struct rt_cmdqelmt)); if (InformationBufferLength > 0) { status = @@ -785,7 +785,7 @@ int RTUSBEnqueueInternalCmd(IN PRTMP_ADAPTER pAd, ======================================================================== */ -void RTUSBDequeueCmd(IN PCmdQ cmdq, OUT PCmdQElmt * pcmdqelmt) +void RTUSBDequeueCmd(struct rt_cmdq *cmdq, struct rt_cmdqelmt * * pcmdqelmt) { *pcmdqelmt = cmdq->head; @@ -833,7 +833,7 @@ void RTUSBDequeueCmd(IN PCmdQ cmdq, OUT PCmdQElmt * pcmdqelmt) ======================================================================== */ -int RTUSB_VendorRequest(IN PRTMP_ADAPTER pAd, +int RTUSB_VendorRequest(struct rt_rtmp_adapter *pAd, u32 TransferFlags, u8 RequestType, u8 Request, @@ -954,7 +954,7 @@ int RTUSB_VendorRequest(IN PRTMP_ADAPTER pAd, ======================================================================== */ -int RTUSB_ResetDevice(IN PRTMP_ADAPTER pAd) +int RTUSB_ResetDevice(struct rt_rtmp_adapter *pAd) { int Status = TRUE; @@ -963,9 +963,9 @@ int RTUSB_ResetDevice(IN PRTMP_ADAPTER pAd) return Status; } -void CMDHandler(IN PRTMP_ADAPTER pAd) +void CMDHandler(struct rt_rtmp_adapter *pAd) { - PCmdQElmt cmdqelmt; + struct rt_cmdqelmt *cmdqelmt; u8 *pData; int NdisStatus = NDIS_STATUS_SUCCESS; /* unsigned long Now = 0; */ @@ -1055,8 +1055,8 @@ void CMDHandler(IN PRTMP_ADAPTER pAd) u32 MACValue; u8 Index; int ret = 0; - PHT_TX_CONTEXT pHTTXContext; -/* RTMP_TX_RING *pTxRing; */ + struct rt_ht_tx_context *pHTTXContext; +/* struct rt_rtmp_tx_ring *pTxRing; */ unsigned long IrqFlags; DBGPRINT_RAW(RT_DEBUG_TRACE, @@ -1276,34 +1276,34 @@ void CMDHandler(IN PRTMP_ADAPTER pAd) u8 pendingContext = 0; - PHT_TX_CONTEXT + struct rt_ht_tx_context * pHTTXContext = - (PHT_TX_CONTEXT) + (struct rt_ht_tx_context *) (&pAd-> TxContext [pAd-> bulkResetPipeid]); - PTX_CONTEXT + struct rt_tx_context * pMLMEContext = - (PTX_CONTEXT) + (struct rt_tx_context *) (pAd-> MgmtRing. Cell[pAd-> MgmtRing. TxDmaIdx]. AllocVa); - PTX_CONTEXT + struct rt_tx_context * pNULLContext = - (PTX_CONTEXT) + (struct rt_tx_context *) (&pAd-> PsPollContext); - PTX_CONTEXT + struct rt_tx_context * pPsPollContext = - (PTX_CONTEXT) + (struct rt_tx_context *) (&pAd-> NullContext); @@ -1383,7 +1383,7 @@ void CMDHandler(IN PRTMP_ADAPTER pAd) pAd->NextRxBulkInIndex = 0; // Rx Bulk pointer for (i = 0; i < (RX_RING_SIZE); i++) { - PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); + struct rt_rx_context *pRxContext = &(pAd->RxContext[i]); pRxContext->pAd = pAd; pRxContext->InUse = FALSE; @@ -1490,7 +1490,7 @@ void CMDHandler(IN PRTMP_ADAPTER pAd) pAd->NextRxBulkInIndex = 0; // Rx Bulk pointer for (i = 0; i < (RX_RING_SIZE); i++) { - PRX_CONTEXT pRxContext = &(pAd->RxContext[i]); + struct rt_rx_context *pRxContext = &(pAd->RxContext[i]); pRxContext->pAd = pAd; pRxContext->InUse = FALSE; @@ -1506,7 +1506,7 @@ void CMDHandler(IN PRTMP_ADAPTER pAd) pAd->CommonCfg. NumOfBulkInIRP; i++) { /*RTUSBBulkReceive(pAd); */ - PRX_CONTEXT pRxContext; + struct rt_rx_context *pRxContext; PURB pUrb; int ret = 0; unsigned long IrqFlags; @@ -1606,11 +1606,11 @@ void CMDHandler(IN PRTMP_ADAPTER pAd) case CMDTHREAD_SET_ASIC_WCID: { - RT_SET_ASIC_WCID SetAsicWcid; + struct rt_set_asic_wcid SetAsicWcid; u16 offset; u32 MACValue, MACRValue = 0; SetAsicWcid = - *((PRT_SET_ASIC_WCID) (pData)); + *((struct rt_set_asic_wcid *)(pData)); if (SetAsicWcid.WCID >= MAX_LEN_OF_MAC_TABLE) @@ -1672,12 +1672,12 @@ void CMDHandler(IN PRTMP_ADAPTER pAd) case CMDTHREAD_SET_ASIC_WCID_CIPHER: { - RT_SET_ASIC_WCID_ATTRI SetAsicWcidAttri; + struct rt_set_asic_wcid_attri SetAsicWcidAttri; u16 offset; u32 MACRValue = 0; SHAREDKEY_MODE_STRUC csr1; SetAsicWcidAttri = - *((PRT_SET_ASIC_WCID_ATTRI) + *((struct rt_set_asic_wcid_attri *) (pData)); if (SetAsicWcidAttri.WCID >= @@ -1773,9 +1773,9 @@ void CMDHandler(IN PRTMP_ADAPTER pAd) /*Benson modified for USB interface, avoid in interrupt when write key, 20080724 --> */ case RT_CMD_SET_KEY_TABLE: /*General call for AsicAddPairwiseKeyEntry() */ { - RT_ADD_PAIRWISE_KEY_ENTRY KeyInfo; + struct rt_add_pairwise_key_entry KeyInfo; KeyInfo = - *((PRT_ADD_PAIRWISE_KEY_ENTRY) + *((struct rt_add_pairwise_key_entry *) (pData)); AsicAddPairwiseKeyEntry(pAd, KeyInfo.MacAddr, @@ -1788,12 +1788,12 @@ void CMDHandler(IN PRTMP_ADAPTER pAd) case RT_CMD_SET_RX_WCID_TABLE: /*General call for RTMPAddWcidAttributeEntry() */ { - PMAC_TABLE_ENTRY pEntry; + struct rt_mac_table_entry *pEntry; u8 KeyIdx = 0; u8 CipherAlg = CIPHER_NONE; u8 ApIdx = BSS0; - pEntry = (PMAC_TABLE_ENTRY) (pData); + pEntry = (struct rt_mac_table_entry *)(pData); RTMPAddWcidAttributeEntry(pAd, ApIdx, @@ -1806,8 +1806,8 @@ void CMDHandler(IN PRTMP_ADAPTER pAd) case CMDTHREAD_SET_CLIENT_MAC_ENTRY: { - MAC_TABLE_ENTRY *pEntry; - pEntry = (MAC_TABLE_ENTRY *) pData; + struct rt_mac_table_entry *pEntry; + pEntry = (struct rt_mac_table_entry *)pData; { AsicRemovePairwiseKeyEntry(pAd, @@ -1908,12 +1908,12 @@ void CMDHandler(IN PRTMP_ADAPTER pAd) { u32 i; u32 KeyIdx; - PNDIS_802_11_WEP pWepKey; + struct rt_ndis_802_11_wep *pWepKey; DBGPRINT(RT_DEBUG_TRACE, ("CmdThread::OID_802_11_ADD_WEP \n")); - pWepKey = (PNDIS_802_11_WEP) pData; + pWepKey = (struct rt_ndis_802_11_wep *)pData; KeyIdx = pWepKey->KeyIndex & 0x0fffffff; /* it is a shared key */ -- GitLab From 23d1d3d92283d6888e8e595cd52848728cd3da35 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Mon, 2 Nov 2009 16:25:32 +0100 Subject: [PATCH 170/235] Staging: rt28x0: Add proper selection of WIRELESS_EXT and WEXT_PRIV After the incorporation of the patch entitled "wext: refactor", some of the wireless drivers in drivers/staging fail to build because they need to have CONFIG_WIRELESS_EXT and CONFIG_WEXT_PRIV defined. [ patch description borrowed from the previous fix for wireless staging drivers ("staging: Add proper selection of WIRELESS_EXT and WEXT_PRIV") authored by Larry Finger ] Cc: Larry Finger Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/Kconfig | 2 ++ drivers/staging/rt2870/Kconfig | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/staging/rt2860/Kconfig b/drivers/staging/rt2860/Kconfig index bd5f8666dde2..f9962b693128 100644 --- a/drivers/staging/rt2860/Kconfig +++ b/drivers/staging/rt2860/Kconfig @@ -1,6 +1,8 @@ config RT2860 tristate "Ralink 2860/3090 wireless support" depends on PCI && X86 && WLAN + select WIRELESS_EXT + select WEXT_PRIV ---help--- This is an experimental driver for the Ralink 2860 and 3090 wireless chips. diff --git a/drivers/staging/rt2870/Kconfig b/drivers/staging/rt2870/Kconfig index aea5c8221810..fd3ba3a3b127 100644 --- a/drivers/staging/rt2870/Kconfig +++ b/drivers/staging/rt2870/Kconfig @@ -1,5 +1,7 @@ config RT2870 tristate "Ralink 2870/3070 wireless support" depends on USB && X86 && WLAN + select WIRELESS_EXT + select WEXT_PRIV ---help--- This is an experimental driver for the Ralink xx70 wireless chips. -- GitLab From ad26848142950277172a983e7e525fa8806a6300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dalfu=C3=9F?= Date: Fri, 6 Nov 2009 14:49:00 +0100 Subject: [PATCH 171/235] Staging: rt2860: remove remainders of /etc reading stuff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The stuff that tries to read a file from /etc is already removed, so this patch just removes the last remainders. Signed-off-by: Sebastian Dalfuß Bartlomiej Zolnierkiewicz --- drivers/staging/rt2860/TODO | 1 - drivers/staging/rt2860/rt_linux.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/staging/rt2860/TODO b/drivers/staging/rt2860/TODO index 6158dc2a4b66..8e2f6ee0a2be 100644 --- a/drivers/staging/rt2860/TODO +++ b/drivers/staging/rt2860/TODO @@ -9,7 +9,6 @@ TODO: - checkpatch.pl clean - sparse clean - port to in-kernel 80211 stack and common rt2x00 infrastructure - - remove reading from /etc/ config files - review by the wireless developer community Please send any patches or complaints about this driver to Greg diff --git a/drivers/staging/rt2860/rt_linux.h b/drivers/staging/rt2860/rt_linux.h index e1eb740839e5..7efc109c22ff 100644 --- a/drivers/staging/rt2860/rt_linux.h +++ b/drivers/staging/rt2860/rt_linux.h @@ -80,11 +80,9 @@ ***********************************************************************************/ #ifdef RTMP_MAC_PCI -#define STA_PROFILE_PATH "/etc/Wireless/RT2860STA/RT2860STA.dat" #define STA_DRIVER_VERSION "2.1.0.0" #endif /* RTMP_MAC_PCI // */ #ifdef RTMP_MAC_USB -#define STA_PROFILE_PATH "/etc/Wireless/RT2870STA/RT2870STA.dat" #define STA_DRIVER_VERSION "2.1.0.0" /* RT3070 version: 2.1.1.0 */ #endif /* RTMP_MAC_USB // */ -- GitLab From d6dbc0126beedc43f19abb5870c892f7bd105b2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dalfu=C3=9F?= Date: Fri, 6 Nov 2009 14:49:28 +0100 Subject: [PATCH 172/235] Staging: rt2860: remove superfluous newlines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch is based on next-20091106. This tiny patch removes a few quite unnecessary extra newlines from DBGPRINT() and printk() strings. Signed-off-by: Sebastian Dalfuß Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/common/rtmp_init.c | 2 +- drivers/staging/rt2860/common/rtmp_mcu.c | 2 +- drivers/staging/rt2860/rt_linux.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rt2860/common/rtmp_init.c b/drivers/staging/rt2860/common/rtmp_init.c index 46e7a2a41125..d3c7c17e36a8 100644 --- a/drivers/staging/rt2860/common/rtmp_init.c +++ b/drivers/staging/rt2860/common/rtmp_init.c @@ -181,7 +181,7 @@ int RTMPAllocAdapterBlock(void *handle, } pAd->BeaconBuf = pBeaconBuf; DBGPRINT(RT_DEBUG_OFF, - ("\n\n=== pAd = %p, size = %d ===\n\n", pAd, + ("=== pAd = %p, size = %d ===\n", pAd, (u32)sizeof(struct rt_rtmp_adapter))); /* Init spin locks */ diff --git a/drivers/staging/rt2860/common/rtmp_mcu.c b/drivers/staging/rt2860/common/rtmp_mcu.c index 683abad30f66..9f03901433bb 100644 --- a/drivers/staging/rt2860/common/rtmp_mcu.c +++ b/drivers/staging/rt2860/common/rtmp_mcu.c @@ -163,7 +163,7 @@ int RtmpAsicLoadFirmware(struct rt_rtmp_adapter *pAd) if (Index > 1000) { DBGPRINT(RT_DEBUG_ERROR, - ("NICLoadFirmware: MCU is not ready\n\n\n")); + ("NICLoadFirmware: MCU is not ready\n")); Status = NDIS_STATUS_FAILURE; } diff --git a/drivers/staging/rt2860/rt_linux.c b/drivers/staging/rt2860/rt_linux.c index a94593c548ef..d84ac32b8a87 100644 --- a/drivers/staging/rt2860/rt_linux.c +++ b/drivers/staging/rt2860/rt_linux.c @@ -340,7 +340,7 @@ int RTMPAllocateNdisPacket(struct rt_rtmp_adapter *pAd, if (pPacket == NULL) { *ppPacket = NULL; #ifdef DEBUG - printk("RTMPAllocateNdisPacket Fail\n\n"); + printk("RTMPAllocateNdisPacket Fail\n"); #endif return NDIS_STATUS_FAILURE; } -- GitLab From 82c7c11fdbbf4a741524daf16f320909ef0d666a Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Fri, 18 Sep 2009 12:59:22 -0700 Subject: [PATCH 173/235] Staging: octeon: don't ignore request_irq() return code Signed-off-by: Roel Kluin Acked-by: David Daney Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon/ethernet-rgmii.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/octeon/ethernet-rgmii.c b/drivers/staging/octeon/ethernet-rgmii.c index 8704133fe127..fbaa465d2fac 100644 --- a/drivers/staging/octeon/ethernet-rgmii.c +++ b/drivers/staging/octeon/ethernet-rgmii.c @@ -308,7 +308,7 @@ int cvm_oct_rgmii_init(struct net_device *dev) /* * Due to GMX errata in CN3XXX series chips, it is necessary - * to take the link down immediately whne the PHY changes + * to take the link down immediately when the PHY changes * state. In order to do this we call the poll function every * time the RGMII inband status changes. This may cause * problems if the PHY doesn't implement inband status @@ -317,6 +317,8 @@ int cvm_oct_rgmii_init(struct net_device *dev) if (number_rgmii_ports == 0) { r = request_irq(OCTEON_IRQ_RML, cvm_oct_rgmii_rml_interrupt, IRQF_SHARED, "RGMII", &number_rgmii_ports); + if (r != 0) + return r; } number_rgmii_ports++; -- GitLab From 5008c456c1cdcb8ef7265dcb6d20317f54d3e8ee Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Mon, 12 Oct 2009 23:47:36 -0300 Subject: [PATCH 174/235] Staging: vt6656: use lowercase for VIA USB vendor id Signed-off-by: Otavio Salvador Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index b02ca2d66fee..bf65b1118837 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -103,7 +103,7 @@ #include "card.h" /*--------------------- Export Definitions -------------------------*/ -#define VNT_USB_VENDOR_ID 0x160A +#define VNT_USB_VENDOR_ID 0x160a #define VNT_USB_PRODUCT_ID 0x3184 #define MAC_MAX_CONTEXT_REG (256+128) -- GitLab From ee93e1971dc2dbc3133962b3d914b18d7c93a681 Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Fri, 16 Oct 2009 20:17:57 +0200 Subject: [PATCH 175/235] Staging: vt6655: Correct unsigned bound issue uNodeIndex is unsigned, check whether it is within bounds instead. Signed-off-by: Roel Kluin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/wroute.c | 2 +- drivers/staging/vt6656/rxtx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/vt6655/wroute.c b/drivers/staging/vt6655/wroute.c index ab991618a298..1d02040e80e0 100644 --- a/drivers/staging/vt6655/wroute.c +++ b/drivers/staging/vt6655/wroute.c @@ -113,7 +113,7 @@ BOOL ROUTEbRelay (PSDevice pDevice, PBYTE pbySkbData, UINT uDataLen, UINT uNodeI } if (pDevice->bEnableHostWEP) { - if (uNodeIndex >= 0) { + if (uNodeIndex < MAX_NODE_NUM + 1) { pTransmitKey = &STempKey; pTransmitKey->byCipherSuite = pMgmt->sNodeDBTable[uNodeIndex].byCipherSuite; pTransmitKey->dwKeyIndex = pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex; diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 94ddf8bab62b..d9fa36c95230 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -3153,7 +3153,7 @@ bRelayPacketSend ( } if (pDevice->bEnableHostWEP) { - if (uNodeIndex >= 0) { + if (uNodeIndex < MAX_NODE_NUM + 1) { pTransmitKey = &STempKey; pTransmitKey->byCipherSuite = pMgmt->sNodeDBTable[uNodeIndex].byCipherSuite; pTransmitKey->dwKeyIndex = pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex; -- GitLab From 6d0158fac61973654d8045fb8d15df8c4e84aaec Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 25 Oct 2009 22:46:45 -0500 Subject: [PATCH 176/235] Staging: vt6655 remove kcompat.h The vt6655 driver is integrated in the kernel so it no longer needs the compatibility header. Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/device.h | 1 - drivers/staging/vt6655/kcompat.h | 39 -------------------------------- 2 files changed, 40 deletions(-) delete mode 100644 drivers/staging/vt6655/kcompat.h diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h index fa7f0fcad33b..bbc5478a4575 100644 --- a/drivers/staging/vt6655/device.h +++ b/drivers/staging/vt6655/device.h @@ -79,7 +79,6 @@ // device specific // -#include "kcompat.h" #include "device_cfg.h" #include "ttype.h" #include "80211hdr.h" diff --git a/drivers/staging/vt6655/kcompat.h b/drivers/staging/vt6655/kcompat.h deleted file mode 100644 index 2cf634ca67d6..000000000000 --- a/drivers/staging/vt6655/kcompat.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 - * 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: kcompat.h - * - * Purpose: define kernel compatibility header - * - * Author: Lyndon Chen - * - * Date: Apr 8, 2002 - * - */ - -#ifndef _KCOMPAT_H -#define _KCOMPAT_H - -#include - -#ifndef HAVE_NETDEV_PRIV -#define netdev_priv(dev) (dev->priv) -#endif - -#endif - -- GitLab From d30b271910e4bcbd7d068939617933a64852dfc8 Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 25 Oct 2009 22:46:46 -0500 Subject: [PATCH 177/235] Staging: vt6656 remove kcompat.h The vt6656 driver is integrated in the kernel so it no longer needs the compatibility header. Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/device.h | 1 - drivers/staging/vt6656/kcompat.h | 39 -------------------------------- 2 files changed, 40 deletions(-) delete mode 100644 drivers/staging/vt6656/kcompat.h diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index bf65b1118837..b4d8ed9b28a1 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -88,7 +88,6 @@ // device specific // -#include "kcompat.h" #include "device_cfg.h" #include "ttype.h" #include "80211hdr.h" diff --git a/drivers/staging/vt6656/kcompat.h b/drivers/staging/vt6656/kcompat.h deleted file mode 100644 index 2cf634ca67d6..000000000000 --- a/drivers/staging/vt6656/kcompat.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 - * 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: kcompat.h - * - * Purpose: define kernel compatibility header - * - * Author: Lyndon Chen - * - * Date: Apr 8, 2002 - * - */ - -#ifndef _KCOMPAT_H -#define _KCOMPAT_H - -#include - -#ifndef HAVE_NETDEV_PRIV -#define netdev_priv(dev) (dev->priv) -#endif - -#endif - -- GitLab From a8ee05f54c9901f6497e05ae737c32a93c7a8f5e Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 25 Oct 2009 22:46:47 -0500 Subject: [PATCH 178/235] Staging: vt6655 remove duplicate includes Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/wcmd.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/vt6655/wcmd.c b/drivers/staging/vt6655/wcmd.c index d81f5b79a157..c9eabf9995df 100644 --- a/drivers/staging/vt6655/wcmd.c +++ b/drivers/staging/vt6655/wcmd.c @@ -48,7 +48,6 @@ #include "wmgr.h" #include "power.h" #include "wctl.h" -#include "card.h" #include "baseband.h" #include "rxtx.h" #include "rf.h" -- GitLab From 50fcfe57ee629c24f85618883c0eb09e3630339a Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 25 Oct 2009 22:46:48 -0500 Subject: [PATCH 179/235] Staging: vt6656 remove duplicate includes Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/baseband.c | 1 - drivers/staging/vt6656/hostap.c | 1 - drivers/staging/vt6656/main_usb.c | 2 -- drivers/staging/vt6656/wcmd.c | 1 - 4 files changed, 5 deletions(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index 820a7b8e6fb8..59a86e27f20d 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -46,7 +46,6 @@ #include "control.h" #include "datarate.h" #include "rndis.h" -#include "control.h" /*--------------------- Static Definitions -------------------------*/ static int msglevel =MSG_LEVEL_INFO; diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c index 0c8267a10078..1078d616c497 100644 --- a/drivers/staging/vt6656/hostap.c +++ b/drivers/staging/vt6656/hostap.c @@ -37,7 +37,6 @@ #include "baseband.h" #include "wpactl.h" #include "key.h" -#include "mac.h" #include "datarate.h" #define VIAWGET_HOSTAPD_MAX_BUF_SIZE 1024 diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 05186110c029..c14730083134 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -64,11 +64,9 @@ #include "ioctl.h" #include "iwctl.h" #include "dpc.h" -#include "iocmd.h" #include "datarate.h" #include "rf.h" #include "firmware.h" -#include "mac.h" #include "rndis.h" #include "control.h" #include "channel.h" diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 6912344fdfae..0464093ed840 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -48,7 +48,6 @@ #include "wmgr.h" #include "power.h" #include "wctl.h" -#include "card.h" #include "baseband.h" #include "control.h" #include "rxtx.h" -- GitLab From 3afc571e6b2b2d6b291309363e196d814b583e66 Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 25 Oct 2009 22:46:49 -0500 Subject: [PATCH 180/235] Staging: vt6655 remove unneeded version.h Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/device.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h index bbc5478a4575..cde44d21b75c 100644 --- a/drivers/staging/vt6655/device.h +++ b/drivers/staging/vt6655/device.h @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include -- GitLab From 42caa16a70b875bb171874af329c7575fa10c091 Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 25 Oct 2009 22:46:50 -0500 Subject: [PATCH 181/235] Staging: vt6656 remove unneeded version.h and version check Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/device.h | 1 - drivers/staging/vt6656/main_usb.c | 6 ------ 2 files changed, 7 deletions(-) diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index b4d8ed9b28a1..8b541d1d0e23 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index c14730083134..3c1efaa6e4b6 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -807,12 +807,6 @@ vntwusb_found1(struct usb_interface *intf, const struct usb_device_id *id) kfree(pDevice); return -ENODEV; } - //2008-0623-02by MikeLiu - //2007-0821-01by MikeLiu - //#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21) - //usb_set_intfdata(intf, pDevice); - //SET_NETDEV_DEV(netdev, &intf->dev); - //#endif //2008-07-21-01by MikeLiu //register wpadev -- GitLab From 47a14f13c81c407f816917528f84b85532af2819 Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 25 Oct 2009 22:46:51 -0500 Subject: [PATCH 182/235] Staging: vt6655: remove __cplusplus ifdefs Signed-off-by: Shawn Bohrer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/rxtx.h | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h index 17bd1b1f40e6..5da815efe70b 100644 --- a/drivers/staging/vt6655/rxtx.h +++ b/drivers/staging/vt6655/rxtx.h @@ -35,17 +35,10 @@ /*--------------------- Export Definitions -------------------------*/ -/*--------------------- Export Classes ----------------------------*/ - /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ - -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ - /* VOID vGenerateMACHeader( IN PSDevice pDevice, @@ -111,14 +104,4 @@ VOID vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, PBYTE pbMPDU, UINT c CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket); CMD_STATUS csBeacon_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket); -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - - - #endif // __RXTX_H__ - - - -- GitLab From 6884bb09244498bfa67a99737f33b638d8eae450 Mon Sep 17 00:00:00 2001 From: Huang Weiyi Date: Thu, 17 Sep 2009 21:25:49 +0800 Subject: [PATCH 183/235] Staging: vme: remove unused #include Remove unused #include ('s) in drivers/staging/vme/bridges/vme_ca91cx42.c drivers/staging/vme/bridges/vme_tsi148.c drivers/staging/vme/devices/vme_user.c drivers/staging/vme/vme.c Signed-off-by: Huang Weiyi Acked-by: Martyn Welch Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/bridges/vme_ca91cx42.c | 1 - drivers/staging/vme/bridges/vme_tsi148.c | 1 - drivers/staging/vme/devices/vme_user.c | 1 - drivers/staging/vme/vme.c | 1 - 4 files changed, 4 deletions(-) diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c index e139eaeaa174..2810d80fa0e6 100644 --- a/drivers/staging/vme/bridges/vme_ca91cx42.c +++ b/drivers/staging/vme/bridges/vme_ca91cx42.c @@ -15,7 +15,6 @@ * option) any later version. */ -#include #include #include #include diff --git a/drivers/staging/vme/bridges/vme_tsi148.c b/drivers/staging/vme/bridges/vme_tsi148.c index 00fe0803c21c..4d20125adcdd 100644 --- a/drivers/staging/vme/bridges/vme_tsi148.c +++ b/drivers/staging/vme/bridges/vme_tsi148.c @@ -13,7 +13,6 @@ * option) any later version. */ -#include #include #include #include diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 78912883d153..dc9be4778fe5 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include diff --git a/drivers/staging/vme/vme.c b/drivers/staging/vme/vme.c index 477a1adfd0e9..24743078a4af 100644 --- a/drivers/staging/vme/vme.c +++ b/drivers/staging/vme/vme.c @@ -13,7 +13,6 @@ * option) any later version. */ -#include #include #include #include -- GitLab From beb9ccc635433065a099b75dc8b22caf0844014a Mon Sep 17 00:00:00 2001 From: Martyn Welch Date: Thu, 29 Oct 2009 16:34:48 +0000 Subject: [PATCH 184/235] staging: vme: correct array overflow Eric Sesterhenn noticed that vme_user is overflowing an array used by sprintf. Use a bigger array. CC: Eric Sesterhenn Signed-off-by: Martyn Welch Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index dc9be4778fe5..e228942ee081 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -624,7 +624,7 @@ err_nocard: static int __init vme_user_probe(struct device *dev, int cur_bus, int cur_slot) { int i, err; - char name[8]; + char name[12]; /* Save pointer to the bridge device */ if (vme_user_bridge != NULL) { -- GitLab From c813f592a5e65cfd9321f51c95a6977e9518dde6 Mon Sep 17 00:00:00 2001 From: Martyn Welch Date: Thu, 29 Oct 2009 16:34:54 +0000 Subject: [PATCH 185/235] Staging: vme: Pull common VME interrupt handling into core code Currently the VME callback infrastructure is replicated in each VME driver. Move this common code into the VME core. Rename functions to fit in better with naming of other VME functions. Signed-off-by: Martyn Welch Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/bridges/vme_ca91cx42.c | 78 ++++-------------- drivers/staging/vme/bridges/vme_tsi148.c | 94 ++++++---------------- drivers/staging/vme/vme.c | 76 +++++++++++++---- drivers/staging/vme/vme.h | 6 +- drivers/staging/vme/vme_api.txt | 6 +- drivers/staging/vme/vme_bridge.h | 9 ++- 6 files changed, 111 insertions(+), 158 deletions(-) diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c index 2810d80fa0e6..74d54bb3f8e6 100644 --- a/drivers/staging/vme/bridges/vme_ca91cx42.c +++ b/drivers/staging/vme/bridges/vme_ca91cx42.c @@ -53,9 +53,6 @@ struct mutex vme_int; /* * Only one VME interrupt can be * generated at a time, provide locking */ -struct mutex vme_irq; /* Locking for VME irq callback configuration */ - - static char driver_name[] = "vme_ca91cx42"; @@ -157,23 +154,13 @@ static u32 ca91cx42_LERR_irqhandler(void) static u32 ca91cx42_VIRQ_irqhandler(int stat) { int vec, i, serviced = 0; - void (*call)(int, int, void *); - void *priv_data; for (i = 7; i > 0; i--) { if (stat & (1 << i)) { vec = ioread32(ca91cx42_bridge->base + CA91CX42_V_STATID[i]) & 0xff; - call = ca91cx42_bridge->irq[i - 1].callback[vec].func; - priv_data = - ca91cx42_bridge->irq[i - 1].callback[vec].priv_data; - - if (call != NULL) - call(i, vec, priv_data); - else - printk("Spurilous VME interrupt, level:%x, " - "vector:%x\n", i, vec); + vme_irq_handler(ca91cx42_bridge, i, vec); serviced |= (1 << i); } @@ -234,6 +221,8 @@ static int ca91cx42_irq_init(struct vme_bridge *bridge) /* Initialise list for VME bus errors */ INIT_LIST_HEAD(&(bridge->vme_errors)); + mutex_init(&(bridge->irq_mtx)); + /* Disable interrupts from PCI to VME */ iowrite32(0, bridge->base + VINT_EN); @@ -281,66 +270,31 @@ static void ca91cx42_irq_exit(struct pci_dev *pdev) /* * Set up an VME interrupt */ -int ca91cx42_request_irq(int level, int statid, - void (*callback)(int level, int vector, void *priv_data), - void *priv_data) +void ca91cx42_irq_set(int level, int state, int sync) + { + struct pci_dev *pdev; u32 tmp; - mutex_lock(&(vme_irq)); - - if (ca91cx42_bridge->irq[level - 1].callback[statid].func) { - mutex_unlock(&(vme_irq)); - printk("VME Interrupt already taken\n"); - return -EBUSY; - } - - - ca91cx42_bridge->irq[level - 1].count++; - ca91cx42_bridge->irq[level - 1].callback[statid].priv_data = priv_data; - ca91cx42_bridge->irq[level - 1].callback[statid].func = callback; - /* Enable IRQ level */ tmp = ioread32(ca91cx42_bridge->base + LINT_EN); - tmp |= CA91CX42_LINT_VIRQ[level]; - iowrite32(tmp, ca91cx42_bridge->base + LINT_EN); - mutex_unlock(&(vme_irq)); - - return 0; -} - -/* - * Free VME interrupt - */ -void ca91cx42_free_irq(int level, int statid) -{ - u32 tmp; - struct pci_dev *pdev; - - mutex_lock(&(vme_irq)); - - ca91cx42_bridge->irq[level - 1].count--; - - /* Disable IRQ level if no more interrupts attached at this level*/ - if (ca91cx42_bridge->irq[level - 1].count == 0) { - tmp = ioread32(ca91cx42_bridge->base + LINT_EN); + if (state == 0) tmp &= ~CA91CX42_LINT_VIRQ[level]; - iowrite32(tmp, ca91cx42_bridge->base + LINT_EN); + else + tmp |= CA91CX42_LINT_VIRQ[level]; + iowrite32(tmp, ca91cx42_bridge->base + LINT_EN); + + if ((state == 0) && (sync != 0)) { pdev = container_of(ca91cx42_bridge->parent, struct pci_dev, dev); synchronize_irq(pdev->irq); } - - ca91cx42_bridge->irq[level - 1].callback[statid].func = NULL; - ca91cx42_bridge->irq[level - 1].callback[statid].priv_data = NULL; - - mutex_unlock(&(vme_irq)); } -int ca91cx42_generate_irq(int level, int statid) +int ca91cx42_irq_generate(int level, int statid) { u32 tmp; @@ -1064,7 +1018,6 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id) init_waitqueue_head(&dma_queue); init_waitqueue_head(&iack_queue); mutex_init(&(vme_int)); - mutex_init(&(vme_irq)); mutex_init(&(vme_rmw)); ca91cx42_bridge->parent = &(pdev->dev); @@ -1181,9 +1134,8 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id) ca91cx42_bridge->dma_list_exec = ca91cx42_dma_list_exec; ca91cx42_bridge->dma_list_empty = ca91cx42_dma_list_empty; #endif - ca91cx42_bridge->request_irq = ca91cx42_request_irq; - ca91cx42_bridge->free_irq = ca91cx42_free_irq; - ca91cx42_bridge->generate_irq = ca91cx42_generate_irq; + ca91cx42_bridge->irq_set = ca91cx42_irq_set; + ca91cx42_bridge->irq_generate = ca91cx42_irq_generate; #if 0 ca91cx42_bridge->lm_set = ca91cx42_lm_set; ca91cx42_bridge->lm_get = ca91cx42_lm_get; diff --git a/drivers/staging/vme/bridges/vme_tsi148.c b/drivers/staging/vme/bridges/vme_tsi148.c index 4d20125adcdd..5b5c73ec103e 100644 --- a/drivers/staging/vme/bridges/vme_tsi148.c +++ b/drivers/staging/vme/bridges/vme_tsi148.c @@ -77,8 +77,6 @@ struct mutex vme_int; /* * Only one VME interrupt can be * generated at a time, provide locking */ -struct mutex vme_irq; /* Locking for VME irq callback configuration */ - static char driver_name[] = "vme_tsi148"; @@ -251,8 +249,6 @@ static u32 tsi148_IACK_irqhandler(void) static u32 tsi148_VIRQ_irqhandler(u32 stat) { int vec, i, serviced = 0; - void (*call)(int, int, void *); - void *priv_data; for (i = 7; i > 0; i--) { if (stat & (1 << i)) { @@ -265,15 +261,7 @@ static u32 tsi148_VIRQ_irqhandler(u32 stat) vec = ioread8(tsi148_bridge->base + TSI148_LCSR_VIACK[i] + 3); - call = tsi148_bridge->irq[i - 1].callback[vec].func; - priv_data = - tsi148_bridge->irq[i-1].callback[vec].priv_data; - - if (call != NULL) - call(i, vec, priv_data); - else - printk("Spurilous VME interrupt, level:%x, " - "vector:%x\n", i, vec); + vme_irq_handler(tsi148_bridge, i, vec); serviced |= (1 << i); } @@ -353,6 +341,8 @@ static int tsi148_irq_init(struct vme_bridge *bridge) /* Initialise list for VME bus errors */ INIT_LIST_HEAD(&(bridge->vme_errors)); + mutex_init(&(bridge->irq_mtx)); + result = request_irq(pdev->irq, tsi148_irqhandler, IRQF_SHARED, @@ -432,55 +422,15 @@ int tsi148_iack_received(void) } /* - * Set up an VME interrupt + * Configure VME interrupt */ -int tsi148_request_irq(int level, int statid, - void (*callback)(int level, int vector, void *priv_data), - void *priv_data) +void tsi148_irq_set(int level, int state, int sync) { - u32 tmp; - - mutex_lock(&(vme_irq)); - - if(tsi148_bridge->irq[level - 1].callback[statid].func) { - mutex_unlock(&(vme_irq)); - printk("VME Interrupt already taken\n"); - return -EBUSY; - } - - - tsi148_bridge->irq[level - 1].count++; - tsi148_bridge->irq[level - 1].callback[statid].priv_data = priv_data; - tsi148_bridge->irq[level - 1].callback[statid].func = callback; - - /* Enable IRQ level */ - tmp = ioread32be(tsi148_bridge->base + TSI148_LCSR_INTEO); - tmp |= TSI148_LCSR_INTEO_IRQEO[level - 1]; - iowrite32be(tmp, tsi148_bridge->base + TSI148_LCSR_INTEO); - - tmp = ioread32be(tsi148_bridge->base + TSI148_LCSR_INTEN); - tmp |= TSI148_LCSR_INTEN_IRQEN[level - 1]; - iowrite32be(tmp, tsi148_bridge->base + TSI148_LCSR_INTEN); - - mutex_unlock(&(vme_irq)); - - return 0; -} - -/* - * Free VME interrupt - */ -void tsi148_free_irq(int level, int statid) -{ - u32 tmp; struct pci_dev *pdev; + u32 tmp; - mutex_lock(&(vme_irq)); - - tsi148_bridge->irq[level - 1].count--; - - /* Disable IRQ level if no more interrupts attached at this level*/ - if (tsi148_bridge->irq[level - 1].count == 0) { + /* We need to do the ordering differently for enabling and disabling */ + if (state == 0) { tmp = ioread32be(tsi148_bridge->base + TSI148_LCSR_INTEN); tmp &= ~TSI148_LCSR_INTEN_IRQEN[level - 1]; iowrite32be(tmp, tsi148_bridge->base + TSI148_LCSR_INTEN); @@ -489,22 +439,28 @@ void tsi148_free_irq(int level, int statid) tmp &= ~TSI148_LCSR_INTEO_IRQEO[level - 1]; iowrite32be(tmp, tsi148_bridge->base + TSI148_LCSR_INTEO); - pdev = container_of(tsi148_bridge->parent, struct pci_dev, dev); + if (sync != 0) { + pdev = container_of(tsi148_bridge->parent, + struct pci_dev, dev); - synchronize_irq(pdev->irq); - } - - tsi148_bridge->irq[level - 1].callback[statid].func = NULL; - tsi148_bridge->irq[level - 1].callback[statid].priv_data = NULL; + synchronize_irq(pdev->irq); + } + } else { + tmp = ioread32be(tsi148_bridge->base + TSI148_LCSR_INTEO); + tmp |= TSI148_LCSR_INTEO_IRQEO[level - 1]; + iowrite32be(tmp, tsi148_bridge->base + TSI148_LCSR_INTEO); - mutex_unlock(&(vme_irq)); + tmp = ioread32be(tsi148_bridge->base + TSI148_LCSR_INTEN); + tmp |= TSI148_LCSR_INTEN_IRQEN[level - 1]; + iowrite32be(tmp, tsi148_bridge->base + TSI148_LCSR_INTEN); + } } /* * Generate a VME bus interrupt at the requested level & vector. Wait for * interrupt to be acked. */ -int tsi148_generate_irq(int level, int statid) +int tsi148_irq_generate(int level, int statid) { u32 tmp; @@ -2333,7 +2289,6 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id) init_waitqueue_head(&dma_queue[1]); init_waitqueue_head(&iack_queue); mutex_init(&(vme_int)); - mutex_init(&(vme_irq)); mutex_init(&(vme_rmw)); tsi148_bridge->parent = &(pdev->dev); @@ -2481,9 +2436,8 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id) tsi148_bridge->dma_list_add = tsi148_dma_list_add; tsi148_bridge->dma_list_exec = tsi148_dma_list_exec; tsi148_bridge->dma_list_empty = tsi148_dma_list_empty; - tsi148_bridge->request_irq = tsi148_request_irq; - tsi148_bridge->free_irq = tsi148_free_irq; - tsi148_bridge->generate_irq = tsi148_generate_irq; + tsi148_bridge->irq_set = tsi148_irq_set; + tsi148_bridge->irq_generate = tsi148_irq_generate; tsi148_bridge->lm_set = tsi148_lm_set; tsi148_bridge->lm_get = tsi148_lm_get; tsi148_bridge->lm_attach = tsi148_lm_attach; diff --git a/drivers/staging/vme/vme.c b/drivers/staging/vme/vme.c index 24743078a4af..241929f99265 100644 --- a/drivers/staging/vme/vme.c +++ b/drivers/staging/vme/vme.c @@ -974,7 +974,23 @@ int vme_dma_free(struct vme_resource *resource) } EXPORT_SYMBOL(vme_dma_free); -int vme_request_irq(struct device *dev, int level, int statid, +void vme_irq_handler(struct vme_bridge *bridge, int level, int statid) +{ + void (*call)(int, int, void *); + void *priv_data; + + call = bridge->irq[level - 1].callback[statid].func; + priv_data = bridge->irq[level - 1].callback[statid].priv_data; + + if (call != NULL) + call(level, statid, priv_data); + else + printk(KERN_WARNING "Spurilous VME interrupt, level:%x, " + "vector:%x\n", level, statid); +} +EXPORT_SYMBOL(vme_irq_handler); + +int vme_irq_request(struct device *dev, int level, int statid, void (*callback)(int level, int vector, void *priv_data), void *priv_data) { @@ -987,20 +1003,37 @@ int vme_request_irq(struct device *dev, int level, int statid, } if((level < 1) || (level > 7)) { - printk(KERN_WARNING "Invalid interrupt level\n"); + printk(KERN_ERR "Invalid interrupt level\n"); return -EINVAL; } - if (bridge->request_irq == NULL) { - printk("Registering interrupts not supported\n"); + if (bridge->irq_set == NULL) { + printk(KERN_ERR "Configuring interrupts not supported\n"); return -EINVAL; } - return bridge->request_irq(level, statid, callback, priv_data); + mutex_lock(&(bridge->irq_mtx)); + + if (bridge->irq[level - 1].callback[statid].func) { + mutex_unlock(&(bridge->irq_mtx)); + printk(KERN_WARNING "VME Interrupt already taken\n"); + return -EBUSY; + } + + bridge->irq[level - 1].count++; + bridge->irq[level - 1].callback[statid].priv_data = priv_data; + bridge->irq[level - 1].callback[statid].func = callback; + + /* Enable IRQ level */ + bridge->irq_set(level, 1, 1); + + mutex_unlock(&(bridge->irq_mtx)); + + return 0; } -EXPORT_SYMBOL(vme_request_irq); +EXPORT_SYMBOL(vme_irq_request); -void vme_free_irq(struct device *dev, int level, int statid) +void vme_irq_free(struct device *dev, int level, int statid) { struct vme_bridge *bridge; @@ -1011,20 +1044,31 @@ void vme_free_irq(struct device *dev, int level, int statid) } if((level < 1) || (level > 7)) { - printk(KERN_WARNING "Invalid interrupt level\n"); + printk(KERN_ERR "Invalid interrupt level\n"); return; } - if (bridge->free_irq == NULL) { - printk("Freeing interrupts not supported\n"); + if (bridge->irq_set == NULL) { + printk(KERN_ERR "Configuring interrupts not supported\n"); return; } - bridge->free_irq(level, statid); + mutex_lock(&(bridge->irq_mtx)); + + bridge->irq[level - 1].count--; + + /* Disable IRQ level if no more interrupts attached at this level*/ + if (bridge->irq[level - 1].count == 0) + bridge->irq_set(level, 0, 1); + + bridge->irq[level - 1].callback[statid].func = NULL; + bridge->irq[level - 1].callback[statid].priv_data = NULL; + + mutex_unlock(&(bridge->irq_mtx)); } -EXPORT_SYMBOL(vme_free_irq); +EXPORT_SYMBOL(vme_irq_free); -int vme_generate_irq(struct device *dev, int level, int statid) +int vme_irq_generate(struct device *dev, int level, int statid) { struct vme_bridge *bridge; @@ -1039,14 +1083,14 @@ int vme_generate_irq(struct device *dev, int level, int statid) return -EINVAL; } - if (bridge->generate_irq == NULL) { + if (bridge->irq_generate == NULL) { printk("Interrupt generation not supported\n"); return -EINVAL; } - return bridge->generate_irq(level, statid); + return bridge->irq_generate(level, statid); } -EXPORT_SYMBOL(vme_generate_irq); +EXPORT_SYMBOL(vme_irq_generate); /* * Request the location monitor, return resource or NULL diff --git a/drivers/staging/vme/vme.h b/drivers/staging/vme/vme.h index 6206e91d1992..f999f6a83c72 100644 --- a/drivers/staging/vme/vme.h +++ b/drivers/staging/vme/vme.h @@ -136,10 +136,10 @@ int vme_dma_list_exec(struct vme_dma_list *); int vme_dma_list_free(struct vme_dma_list *); int vme_dma_free(struct vme_resource *); -int vme_request_irq(struct device *, int, int, +int vme_irq_request(struct device *, int, int, void (*callback)(int, int, void *), void *); -void vme_free_irq(struct device *, int, int); -int vme_generate_irq(struct device *, int, int); +void vme_irq_free(struct device *, int, int); +int vme_irq_generate(struct device *, int, int); struct vme_resource * vme_lm_request(struct device *); int vme_lm_count(struct vme_resource *); diff --git a/drivers/staging/vme/vme_api.txt b/drivers/staging/vme/vme_api.txt index 591eba5c9036..36b7a3c8421f 100644 --- a/drivers/staging/vme/vme_api.txt +++ b/drivers/staging/vme/vme_api.txt @@ -290,10 +290,10 @@ status ID combination. Any given combination can only be assigned a single callback function. A void pointer parameter is provided, the value of which is passed to the callback function, the use of this pointer is user undefined: - int vme_request_irq(struct device *dev, int level, int statid, + int vme_irq_request(struct device *dev, int level, int statid, void (*callback)(int, int, void *), void *priv); - void vme_free_irq(struct device *dev, int level, int statid); + void vme_irq_free(struct device *dev, int level, int statid); The callback parameters are as follows. Care must be taken in writing a callback function, callback functions run in interrupt context: @@ -307,7 +307,7 @@ Interrupt Generation The following function can be used to generate a VME interrupt at a given VME level and VME status ID: - int vme_generate_irq(struct device *dev, int level, int statid); + int vme_irq_generate(struct device *dev, int level, int statid); Location monitors diff --git a/drivers/staging/vme/vme_bridge.h b/drivers/staging/vme/vme_bridge.h index e43cc19103b3..851fa92559f6 100644 --- a/drivers/staging/vme/vme_bridge.h +++ b/drivers/staging/vme/vme_bridge.h @@ -120,6 +120,8 @@ struct vme_bridge { /* Interrupt callbacks */ struct vme_irq irq[7]; + /* Locking for VME irq callback configuration */ + struct mutex irq_mtx; /* Slave Functions */ int (*slave_get) (struct vme_slave_resource *, int *, @@ -149,9 +151,8 @@ struct vme_bridge { int (*dma_list_empty) (struct vme_dma_list *); /* Interrupt Functions */ - int (*request_irq) (int, int, void (*cback)(int, int, void*), void *); - void (*free_irq) (int, int); - int (*generate_irq) (int, int); + void (*irq_set) (int, int, int); + int (*irq_generate) (int, int); /* Location monitor functions */ int (*lm_set) (struct vme_lm_resource *, unsigned long long, @@ -175,6 +176,8 @@ struct vme_bridge { #endif }; +void vme_irq_handler(struct vme_bridge *, int, int); + int vme_register_bridge (struct vme_bridge *); void vme_unregister_bridge (struct vme_bridge *); -- GitLab From 70d7aa889f7c107a768d07389998e4fd89a7103d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 29 Oct 2009 16:18:53 -0700 Subject: [PATCH 186/235] Staging: vme: fix compiler warnings in vme_ca91cx42.c It's causing people to ignore problems in the file, so get rid of them so it's obvious something is wrong in the future. Cc: Martyn Welch Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/bridges/vme_ca91cx42.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c index 74d54bb3f8e6..1cf3e91db59d 100644 --- a/drivers/staging/vme/bridges/vme_ca91cx42.c +++ b/drivers/staging/vme/bridges/vme_ca91cx42.c @@ -1171,7 +1171,9 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id) vme_unregister_bridge(ca91cx42_bridge); err_reg: ca91cx42_crcsr_exit(pdev); +#if 0 err_crcsr: +#endif err_lm: /* resources are stored in link list */ list_for_each(pos, &(ca91cx42_bridge->lm_resources)) { @@ -1226,7 +1228,6 @@ void ca91cx42_remove(struct pci_dev *pdev) struct vme_slave_resource *slave_image; struct vme_dma_resource *dma_ctrlr; struct vme_lm_resource *lm; - int i; /* Turn off Ints */ iowrite32(0, ca91cx42_bridge->base + LINT_EN); -- GitLab From 59c2290428dd93a4117aa453fc4c2be38da288c0 Mon Sep 17 00:00:00 2001 From: Martyn Welch Date: Thu, 29 Oct 2009 16:35:01 +0000 Subject: [PATCH 187/235] Staging: vme: Allow size of 0 when disabling a window The TSI148 driver currently does not allow a size of zero to be passed to a window. Zero is a valid value if the window is being disabled. Allow windows to be disabled and their registers cleared. Signed-off-by: Martyn Welch Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/bridges/vme_tsi148.c | 56 ++++++++++++++---------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/drivers/staging/vme/bridges/vme_tsi148.c b/drivers/staging/vme/bridges/vme_tsi148.c index 5b5c73ec103e..03eb48e4d8fd 100644 --- a/drivers/staging/vme/bridges/vme_tsi148.c +++ b/drivers/staging/vme/bridges/vme_tsi148.c @@ -846,7 +846,7 @@ static int tsi148_alloc_resource(struct vme_master_resource *image, image->pci_resource.start); /* If the existing size is OK, return */ - if (existing_size == (size - 1)) + if ((size != 0) && (existing_size == (size - 1))) return 0; if (existing_size != 0) { @@ -858,6 +858,11 @@ static int tsi148_alloc_resource(struct vme_master_resource *image, memset(&(image->pci_resource), 0, sizeof(struct resource)); } + /* Exit here if size is zero */ + if (size == 0) { + return 0; + } + if (image->pci_resource.name == NULL) { image->pci_resource.name = kmalloc(VMENAMSIZ+3, GFP_KERNEL); if (image->pci_resource.name == NULL) { @@ -936,12 +941,13 @@ int tsi148_master_set( struct vme_master_resource *image, int enabled, /* Verify input data */ if (vme_base & 0xFFFF) { - printk("Invalid VME Window alignment\n"); + printk(KERN_ERR "Invalid VME Window alignment\n"); retval = -EINVAL; goto err_window; } - if (size < 0x10000) { - printk("Invalid VME Window size\n"); + + if ((size == 0) && (enabled != 0)) { + printk(KERN_ERR "Size must be non-zero for enabled windows\n"); retval = -EINVAL; goto err_window; } @@ -949,26 +955,31 @@ int tsi148_master_set( struct vme_master_resource *image, int enabled, spin_lock(&(image->lock)); /* Let's allocate the resource here rather than further up the stack as - * it avoids pushing loads of bus dependant stuff up the stack + * it avoids pushing loads of bus dependant stuff up the stack. If size + * is zero, any existing resource will be freed. */ retval = tsi148_alloc_resource(image, size); if (retval) { spin_unlock(&(image->lock)); - printk(KERN_ERR "Unable to allocate memory for resource " - "name\n"); - retval = -ENOMEM; + printk(KERN_ERR "Unable to allocate memory for " + "resource\n"); goto err_res; } - pci_base = (unsigned long long)image->pci_resource.start; - + if (size == 0) { + pci_base = 0; + pci_bound = 0; + vme_offset = 0; + } else { + pci_base = (unsigned long long)image->pci_resource.start; - /* - * Bound address is a valid address for the window, adjust - * according to window granularity. - */ - pci_bound = pci_base + (size - 0x10000); - vme_offset = vme_base - pci_base; + /* + * Bound address is a valid address for the window, adjust + * according to window granularity. + */ + pci_bound = pci_base + (size - 0x10000); + vme_offset = vme_base - pci_base; + } /* Convert 64-bit variables to 2x 32-bit variables */ reg_split(pci_base, &pci_base_high, &pci_base_low); @@ -977,19 +988,19 @@ int tsi148_master_set( struct vme_master_resource *image, int enabled, if (pci_base_low & 0xFFFF) { spin_unlock(&(image->lock)); - printk("Invalid PCI base alignment\n"); + printk(KERN_ERR "Invalid PCI base alignment\n"); retval = -EINVAL; goto err_gran; } if (pci_bound_low & 0xFFFF) { spin_unlock(&(image->lock)); - printk("Invalid PCI bound alignment\n"); + printk(KERN_ERR "Invalid PCI bound alignment\n"); retval = -EINVAL; goto err_gran; } if (vme_offset_low & 0xFFFF) { spin_unlock(&(image->lock)); - printk("Invalid VME Offset alignment\n"); + printk(KERN_ERR "Invalid VME Offset alignment\n"); retval = -EINVAL; goto err_gran; } @@ -1049,7 +1060,8 @@ int tsi148_master_set( struct vme_master_resource *image, int enabled, temp_ctl |= TSI148_LCSR_OTAT_TM_2eSST; } if (cycle & VME_2eSSTB) { - printk("Currently not setting Broadcast Select Registers\n"); + printk(KERN_WARNING "Currently not setting Broadcast Select " + "Registers\n"); temp_ctl &= ~TSI148_LCSR_OTAT_TM_M; temp_ctl |= TSI148_LCSR_OTAT_TM_2eSSTB; } @@ -1065,7 +1077,7 @@ int tsi148_master_set( struct vme_master_resource *image, int enabled, break; default: spin_unlock(&(image->lock)); - printk("Invalid data width\n"); + printk(KERN_ERR "Invalid data width\n"); retval = -EINVAL; goto err_dwidth; } @@ -1102,7 +1114,7 @@ int tsi148_master_set( struct vme_master_resource *image, int enabled, break; default: spin_unlock(&(image->lock)); - printk("Invalid address space\n"); + printk(KERN_ERR "Invalid address space\n"); retval = -EINVAL; goto err_aspace; break; -- GitLab From 8be9226c8f686c6dd2bae0a7ed4f5795e89d32d8 Mon Sep 17 00:00:00 2001 From: Martyn Welch Date: Thu, 29 Oct 2009 16:35:08 +0000 Subject: [PATCH 188/235] Staging: vme: Correct operation of vme_lm_free The vme_lm_free() function is not clearing up the resource created in vme_lm_request(). In addition vme_lm_free() is void function and is used in exit/error paths, we should wait for mutex to become free rather than exiting and not freeing the resource. Signed-off-by: Martyn Welch Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/vme.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/vme/vme.c b/drivers/staging/vme/vme.c index 241929f99265..a6154f96b826 100644 --- a/drivers/staging/vme/vme.c +++ b/drivers/staging/vme/vme.c @@ -1191,7 +1191,7 @@ int vme_lm_set(struct vme_resource *resource, unsigned long long lm_base, /* XXX Check parameters */ - return lm->parent->lm_set(lm, lm_base, aspace, cycle); + return bridge->lm_set(lm, lm_base, aspace, cycle); } EXPORT_SYMBOL(vme_lm_set); @@ -1271,16 +1271,18 @@ void vme_lm_free(struct vme_resource *resource) lm = list_entry(resource->entry, struct vme_lm_resource, list); - if (mutex_trylock(&(lm->mtx))) { - printk(KERN_ERR "Resource busy, can't free\n"); - return; - } + mutex_lock(&(lm->mtx)); - /* XXX Check to see that there aren't any callbacks still attached */ + /* XXX + * Check to see that there aren't any callbacks still attached, if + * there are we should probably be detaching them! + */ lm->locked = 0; mutex_unlock(&(lm->mtx)); + + kfree(resource); } EXPORT_SYMBOL(vme_lm_free); -- GitLab From a4b02959d5bec1b3e3a3e266b196673a89e62c29 Mon Sep 17 00:00:00 2001 From: Martyn Welch Date: Thu, 29 Oct 2009 16:35:14 +0000 Subject: [PATCH 189/235] Staging: vme: Clean up tsi148 driver * Remove message from IACK interrupt handler * Correct clearing of location monitor interrupts * Remove interrupt cleanup code that's duplcated in sub function Signed-off-by: Martyn Welch Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/bridges/vme_tsi148.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/staging/vme/bridges/vme_tsi148.c b/drivers/staging/vme/bridges/vme_tsi148.c index 03eb48e4d8fd..89a7dccb934f 100644 --- a/drivers/staging/vme/bridges/vme_tsi148.c +++ b/drivers/staging/vme/bridges/vme_tsi148.c @@ -237,7 +237,6 @@ static u32 tsi148_VERR_irqhandler(void) */ static u32 tsi148_IACK_irqhandler(void) { - printk("tsi148_IACK_irqhandler\n"); wake_up(&iack_queue); return TSI148_LCSR_INTC_IACKC; @@ -2121,7 +2120,7 @@ int tsi148_lm_detach(struct vme_lm_resource *lm, int monitor) iowrite32be(tmp, tsi148_bridge->base + TSI148_LCSR_INTEO); iowrite32be(TSI148_LCSR_INTC_LMC[monitor], - tsi148_bridge->base + TSI148_LCSR_INTEO); + tsi148_bridge->base + TSI148_LCSR_INTC); /* Detach callback */ lm_callback[monitor] = NULL; @@ -2581,13 +2580,6 @@ static void tsi148_remove(struct pci_dev *pdev) iowrite32be(0x8000, tsi148_bridge->base + TSI148_LCSR_VICR); } - /* - * Disable and clear all interrupts. - */ - iowrite32be(0x0, tsi148_bridge->base + TSI148_LCSR_INTEO); - iowrite32be(0xFFFFFFFF, tsi148_bridge->base + TSI148_LCSR_INTC); - iowrite32be(0xFFFFFFFF, tsi148_bridge->base + TSI148_LCSR_INTEN); - /* * Map all Interrupts to PCI INTA */ -- GitLab From 58e507987b285f3df99f839c79da3985555ac220 Mon Sep 17 00:00:00 2001 From: Martyn Welch Date: Thu, 29 Oct 2009 16:35:20 +0000 Subject: [PATCH 190/235] Staging: vme: Rename VME DMA functions The DMA resource allocation function is called "vme_request_dma" while master and slave window allocation functions are called "vme_master_request" and "vme_slave_request" respectively. Rename "vme_request_dma" to "vme_dma_request" to fit the pattern. Signed-off-by: Martyn Welch Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/TODO | 2 +- drivers/staging/vme/vme.c | 4 ++-- drivers/staging/vme/vme.h | 2 +- drivers/staging/vme/vme_api.txt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/vme/TODO b/drivers/staging/vme/TODO index adc5fca42afd..2201ff6f74d1 100644 --- a/drivers/staging/vme/TODO +++ b/drivers/staging/vme/TODO @@ -11,7 +11,7 @@ The current DMA resource Allocation provides no means of selecting the suitability of a DMA controller based on it's supported modes of operation, as opposed to the resource allocation mechanisms for master and slave windows: - struct vme_resource *vme_request_dma(struct device *dev); + struct vme_resource *vme_dma_request(struct device *dev); As opposed to: diff --git a/drivers/staging/vme/vme.c b/drivers/staging/vme/vme.c index a6154f96b826..ca9e4de46149 100644 --- a/drivers/staging/vme/vme.c +++ b/drivers/staging/vme/vme.c @@ -643,7 +643,7 @@ EXPORT_SYMBOL(vme_master_free); * Request a DMA controller with specific attributes, return some unique * identifier. */ -struct vme_resource *vme_request_dma(struct device *dev) +struct vme_resource *vme_dma_request(struct device *dev) { struct vme_bridge *bridge; struct list_head *dma_pos = NULL; @@ -704,7 +704,7 @@ err_ctrlr: err_bus: return NULL; } -EXPORT_SYMBOL(vme_request_dma); +EXPORT_SYMBOL(vme_dma_request); /* * Start new list diff --git a/drivers/staging/vme/vme.h b/drivers/staging/vme/vme.h index f999f6a83c72..97dc22e34caf 100644 --- a/drivers/staging/vme/vme.h +++ b/drivers/staging/vme/vme.h @@ -123,7 +123,7 @@ unsigned int vme_master_rmw (struct vme_resource *, unsigned int, unsigned int, unsigned int, loff_t); void vme_master_free(struct vme_resource *); -struct vme_resource *vme_request_dma(struct device *); +struct vme_resource *vme_dma_request(struct device *); struct vme_dma_list *vme_new_dma_list(struct vme_resource *); struct vme_dma_attr *vme_dma_pattern_attribute(u32, vme_pattern_t); struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t); diff --git a/drivers/staging/vme/vme_api.txt b/drivers/staging/vme/vme_api.txt index 36b7a3c8421f..a5c1b1cd5fcc 100644 --- a/drivers/staging/vme/vme_api.txt +++ b/drivers/staging/vme/vme_api.txt @@ -77,7 +77,7 @@ driver in question: struct vme_resource * vme_slave_request(struct device *dev, vme_address_t aspace, vme_cycle_t cycle); - struct vme_resource *vme_request_dma(struct device *dev); + struct vme_resource *vme_dma_request(struct device *dev); For slave windows these attributes are split into those of type 'vme_address_t' and 'vme_cycle_t'. Master windows add a further set of attributes 'vme_cycle_t'. -- GitLab From a5c330fe8b2f1e17133190e0b297a710c5a4de04 Mon Sep 17 00:00:00 2001 From: Martyn Welch Date: Thu, 29 Oct 2009 16:35:27 +0000 Subject: [PATCH 191/235] staging: vme: Fix mutex locking Fix incorrect use of mutex_trylock(). Signed-off-by: Martyn Welch Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/vme.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vme/vme.c b/drivers/staging/vme/vme.c index ca9e4de46149..994fdb9b2127 100644 --- a/drivers/staging/vme/vme.c +++ b/drivers/staging/vme/vme.c @@ -879,7 +879,7 @@ int vme_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *src, return -EINVAL; } - if (mutex_trylock(&(list->mtx))) { + if (!mutex_trylock(&(list->mtx))) { printk("Link List already submitted\n"); return -EINVAL; } @@ -922,7 +922,7 @@ int vme_dma_list_free(struct vme_dma_list *list) return -EINVAL; } - if (mutex_trylock(&(list->mtx))) { + if (!mutex_trylock(&(list->mtx))) { printk("Link List in use\n"); return -EINVAL; } @@ -955,7 +955,7 @@ int vme_dma_free(struct vme_resource *resource) ctrlr = list_entry(resource->entry, struct vme_dma_resource, list); - if (mutex_trylock(&(ctrlr->mtx))) { + if (!mutex_trylock(&(ctrlr->mtx))) { printk("Resource busy, can't free\n"); return -EBUSY; } -- GitLab From 6c8e49dd41a568a1e31e8020ba423a1ade8393b1 Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Tue, 3 Nov 2009 23:48:58 +0100 Subject: [PATCH 192/235] Staging: dst: Fix parentheses `|' has a higher precedence than `?' so since MSG_WAITALL is defined 0x100, MSG_MORE was always written to the msg_flag. Signed-off-by: Roel Kluin Acked-by: Evgeniy Polyakov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dst/state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/dst/state.c b/drivers/staging/dst/state.c index d057e52f3b64..bccbd6dbb172 100644 --- a/drivers/staging/dst/state.c +++ b/drivers/staging/dst/state.c @@ -121,7 +121,7 @@ int dst_data_send_header(struct socket *sock, msg.msg_namelen = 0; msg.msg_control = NULL; msg.msg_controllen = 0; - msg.msg_flags = MSG_WAITALL | (more)?MSG_MORE:0; + msg.msg_flags = MSG_WAITALL | (more ? MSG_MORE : 0); err = kernel_sendmsg(sock, &msg, &iov, 1, iov.iov_len); if (err != size) { -- GitLab From 76e407980728123223fac5c2e8273bc6e7e43cfd Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Wed, 4 Nov 2009 13:56:23 -0800 Subject: [PATCH 193/235] Staging: RTL8192SU depends on USB USB device driver needs to depend on USB to prevent build errors: ERROR: "usb_kill_urb" [drivers/staging/rtl8192su/r8192s_usb.ko] undefined! ERROR: "usb_deregister" [drivers/staging/rtl8192su/r8192s_usb.ko] undefined! ERROR: "usb_control_msg" [drivers/staging/rtl8192su/r8192s_usb.ko] undefined! ERROR: "usb_submit_urb" [drivers/staging/rtl8192su/r8192s_usb.ko] undefined! ERROR: "usb_register_driver" [drivers/staging/rtl8192su/r8192s_usb.ko] undefined! ERROR: "usb_free_urb" [drivers/staging/rtl8192su/r8192s_usb.ko] undefined! ERROR: "usb_alloc_urb" [drivers/staging/rtl8192su/r8192s_usb.ko] undefined! Signed-off-by: Randy Dunlap Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192su/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192su/Kconfig b/drivers/staging/rtl8192su/Kconfig index b8c95f942069..123fa6d6a93b 100644 --- a/drivers/staging/rtl8192su/Kconfig +++ b/drivers/staging/rtl8192su/Kconfig @@ -1,6 +1,6 @@ config RTL8192SU tristate "RealTek RTL8192SU Wireless LAN NIC driver" - depends on PCI && WLAN + depends on PCI && WLAN && USB depends on WIRELESS_EXT default N ---help--- -- GitLab From d5f5d89f0a48930436dba9735fda4663e7b55ed2 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Tue, 10 Nov 2009 09:04:28 -0800 Subject: [PATCH 194/235] Staging: iio: fix ring buffer build max1363 uses both the iio hardware ring buffer and software ring buffer interfaces, but its Makefile and Kconfig do not reflect that usage, so its build breaks. Add a new Kconfig symbol to reflect that usage and change max1363.h & Makefile to use the new Kconfig symbol. Signed-off-by: Randy Dunlap Signed-off-by: Jonathan Cameron --- drivers/staging/iio/adc/Kconfig | 9 +++++++++ drivers/staging/iio/adc/Makefile | 2 +- drivers/staging/iio/adc/max1363.h | 6 +++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig index a2f1626eab41..3989c0ca0e0d 100644 --- a/drivers/staging/iio/adc/Kconfig +++ b/drivers/staging/iio/adc/Kconfig @@ -12,3 +12,12 @@ config MAX1363 convertors (ADC). (max1361, max1362, max1363, max1364, max1136, max1136, max1137, max1138, max1139, max1236, max1237, max11238, max1239) Provides direct access via sysfs. + +config MAX1363_RING_BUFFER + bool "MAXIM max1363: use ring buffer" + depends on MAX1363 + select IIO_RING_BUFFER + select IIO_SW_RING + help + Say yes here to include ring buffer support in the MAX1363 + ADC driver. diff --git a/drivers/staging/iio/adc/Makefile b/drivers/staging/iio/adc/Makefile index 0c2b6f39e8c8..08cee5c22b92 100644 --- a/drivers/staging/iio/adc/Makefile +++ b/drivers/staging/iio/adc/Makefile @@ -3,6 +3,6 @@ # max1363-y := max1363_core.o -max1363-$(CONFIG_IIO_RING_BUFFER) += max1363_ring.o +max1363-$(CONFIG_MAX1363_RING_BUFFER) += max1363_ring.o obj-$(CONFIG_MAX1363) += max1363.o diff --git a/drivers/staging/iio/adc/max1363.h b/drivers/staging/iio/adc/max1363.h index 8aca81f14d0b..c112fbef2705 100644 --- a/drivers/staging/iio/adc/max1363.h +++ b/drivers/staging/iio/adc/max1363.h @@ -228,7 +228,7 @@ struct max1363_state { struct iio_trigger *trig; struct regulator *reg; }; -#ifdef CONFIG_IIO_RING_BUFFER +#ifdef CONFIG_MAX1363_RING_BUFFER ssize_t max1363_scan_from_ring(struct device *dev, struct device_attribute *attr, @@ -239,7 +239,7 @@ void max1363_ring_cleanup(struct iio_dev *indio_dev); int max1363_initialize_ring(struct iio_ring_buffer *ring); void max1363_uninitialize_ring(struct iio_ring_buffer *ring); -#else /* CONFIG_IIO_RING_BUFFER */ +#else /* CONFIG_MAX1363_RING_BUFFER */ static inline void max1363_uninitialize_ring(struct iio_ring_buffer *ring) { @@ -265,5 +265,5 @@ max1363_register_ring_funcs_and_init(struct iio_dev *indio_dev) }; static inline void max1363_ring_cleanup(struct iio_dev *indio_dev) {}; -#endif /* CONFIG_IIO_RING_BUFFER */ +#endif /* CONFIG_MAX1363_RING_BUFFER */ #endif /* _MAX1363_H_ */ -- GitLab From 988536981327c9b8d28a6e956de285791e137cd3 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Wed, 11 Nov 2009 09:31:42 -0800 Subject: [PATCH 195/235] Staging: vt665*: fix printk formats Fix printk format warnings in vt665[56]: drivers/staging/vt6655/wpa.c:150: warning: format '%ld' expects type 'long int', but argument 3 has type 'unsigned int' drivers/staging/vt6655/wpa.c:181: warning: format '%ld' expects type 'long int', but argument 3 has type 'unsigned int' drivers/staging/vt6656/wpa.c:150: warning: format '%ld' expects type 'long int', but argument 3 has type 'unsigned int' drivers/staging/vt6656/wpa.c:181: warning: format '%ld' expects type 'long int', but argument 3 has type 'unsigned int' drivers/staging/vt6656/firmware.c:804: warning: format '%ld' expects type 'long int', but argument 3 has type 'unsigned int' Signed-off-by: Randy Dunlap Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/wpa.c | 4 ++-- drivers/staging/vt6656/firmware.c | 2 +- drivers/staging/vt6656/wpa.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/vt6655/wpa.c b/drivers/staging/vt6655/wpa.c index f92d33ffe775..5da671418b52 100644 --- a/drivers/staging/vt6655/wpa.c +++ b/drivers/staging/vt6655/wpa.c @@ -147,7 +147,7 @@ WPA_ParseRSN ( if (pRSN->len >= 12) //oui1(4)+ver(2)+GKS(4)+PKSCnt(2) { j = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wPKCount: %d, sizeof(pBSSList->abyPKType): %ld\n", pRSN->wPKCount, sizeof(pBSSList->abyPKType)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wPKCount: %d, sizeof(pBSSList->abyPKType): %zu\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 ( !memcmp(pRSN->PKSList[i].abyOUI, abyOUI00, 4)) @@ -178,7 +178,7 @@ WPA_ParseRSN ( // overlay IE_RSN_Auth structure into correct place pIE_RSN_Auth = (PWLAN_IE_RSN_AUTH) pRSN->PKSList[m].abyOUI; j = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAuthCount: %d, sizeof(pBSSList->abyAuthType): %ld\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAuthCount: %d, sizeof(pBSSList->abyAuthType): %zu\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) diff --git a/drivers/staging/vt6656/firmware.c b/drivers/staging/vt6656/firmware.c index 52daa3bda739..585b6b12c5ba 100644 --- a/drivers/staging/vt6656/firmware.c +++ b/drivers/staging/vt6656/firmware.c @@ -801,7 +801,7 @@ FIRMWAREbDownload( &(pBuffer[ii]) ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Download firmware...%d %ld\n", ii, sizeof(abyFirmware)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Download firmware...%d %zu\n", ii, sizeof(abyFirmware)); if (NdisStatus != STATUS_SUCCESS) { if (pBuffer) kfree(pBuffer); diff --git a/drivers/staging/vt6656/wpa.c b/drivers/staging/vt6656/wpa.c index f92d33ffe775..5da671418b52 100644 --- a/drivers/staging/vt6656/wpa.c +++ b/drivers/staging/vt6656/wpa.c @@ -147,7 +147,7 @@ WPA_ParseRSN ( if (pRSN->len >= 12) //oui1(4)+ver(2)+GKS(4)+PKSCnt(2) { j = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wPKCount: %d, sizeof(pBSSList->abyPKType): %ld\n", pRSN->wPKCount, sizeof(pBSSList->abyPKType)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wPKCount: %d, sizeof(pBSSList->abyPKType): %zu\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 ( !memcmp(pRSN->PKSList[i].abyOUI, abyOUI00, 4)) @@ -178,7 +178,7 @@ WPA_ParseRSN ( // overlay IE_RSN_Auth structure into correct place pIE_RSN_Auth = (PWLAN_IE_RSN_AUTH) pRSN->PKSList[m].abyOUI; j = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAuthCount: %d, sizeof(pBSSList->abyAuthType): %ld\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAuthCount: %d, sizeof(pBSSList->abyAuthType): %zu\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) -- GitLab From 727acb4fb2143ac7228b9a49f9e2f73f71e748d9 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Tue, 17 Nov 2009 10:17:42 -0800 Subject: [PATCH 196/235] Staging: sep: fix 2 warnings Fix printk format warning: drivers/staging/sep/sep_driver.c:276: warning: format '%08llx' expects type 'long long unsigned int', but argument 2 has type 'dma_addr_t' and variable may be used uninitialized (correct): drivers/staging/sep/sep_driver.c:1774: warning: 'error' may be used uninitialized in this function Signed-off-by: Randy Dunlap Acked-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sep/sep_driver.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c index f890a16096c0..67c7d2ca7ca0 100644 --- a/drivers/staging/sep/sep_driver.c +++ b/drivers/staging/sep/sep_driver.c @@ -273,7 +273,8 @@ static dma_addr_t sep_shared_virt_to_bus(struct sep_device *sep, void *virt_address) { dma_addr_t pa = sep->shared_bus + (virt_address - sep->shared_addr); - edbg("sep: virt to bus b %08llx v %p\n", pa, virt_address); + edbg("sep: virt to bus b %08llx v %p\n", + (unsigned long long)pa, virt_address); return pa; } @@ -1788,6 +1789,7 @@ static int sep_create_flow_dma_tables_handler(struct sep_device *sep, first_table_data.physical_address = 0xffffffff; /* find the free structure for flow data */ + error = -EINVAL; flow_context_ptr = sep_find_flow_context(sep, SEP_FREE_FLOW_ID); if (flow_context_ptr == NULL) goto end_function; -- GitLab From 51bf00aef02d410bf74afb31ec2d5dbcedb1a52f Mon Sep 17 00:00:00 2001 From: Amit Kucheria Date: Mon, 9 Nov 2009 15:10:15 +0200 Subject: [PATCH 197/235] Staging: iio: Fix typos in documentation Spell-check wouln't catch these :) Signed-off-by: Amit Kucheria Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/Documentation/device.txt | 4 ++-- drivers/staging/iio/Documentation/overview.txt | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/staging/iio/Documentation/device.txt b/drivers/staging/iio/Documentation/device.txt index 6916cd333350..69d9570f29fc 100644 --- a/drivers/staging/iio/Documentation/device.txt +++ b/drivers/staging/iio/Documentation/device.txt @@ -10,7 +10,7 @@ First allocate one using: struct iio_dev *indio_dev = iio_allocate_device(); -The fill in the following. +Then fill in the following: indio_dev->dev.parent the struct device associated with the underlying hardware. @@ -45,5 +45,5 @@ allocated prior to registering the device with the iio-core, but must be registered afterwards (otherwise the whole parentage of devices gets confused) -On remove iio_device_unregister(indio_dev) will remove the device from +On remove, iio_device_unregister(indio_dev) will remove the device from the core, and iio_free_device will clean up. diff --git a/drivers/staging/iio/Documentation/overview.txt b/drivers/staging/iio/Documentation/overview.txt index 64584ad40241..e39dfc1705aa 100644 --- a/drivers/staging/iio/Documentation/overview.txt +++ b/drivers/staging/iio/Documentation/overview.txt @@ -24,11 +24,12 @@ hwmon with simple polled access to device channels via sysfs. * Event chrdevs. These are similar to input in that they provide a route to user space for hardware triggered events. Such events include threshold detectors, free-fall detectors and more complex action -detection. They events themselves are currently very simple with +detection. The events themselves are currently very simple with merely an event code and a timestamp. Any data associated with the -event must be accessed via polling. Note a given device may have one -or more event channel. These events are turned on or off (if possible) -via sysfs interfaces. +event must be accessed via polling. + +Note: A given device may have one or more event channel. These events are +turned on or off (if possible) via sysfs interfaces. * Hardware ring buffer support. Some recent sensors have included fifo / ring buffers on the sensor chip. These greatly reduce the load -- GitLab From ee1f1fa4071416b130fd0771d1f26ea3f41e1fc3 Mon Sep 17 00:00:00 2001 From: Amit Kucheria Date: Mon, 9 Nov 2009 15:14:28 +0200 Subject: [PATCH 198/235] Staging: iio: tsl2563 ambient light sensor driver Add driver support for the tsl2563 TAOS ambient light sensor. After looking at discussions on LKML, the driver was modified from a 'hwmon' driver to an 'iio' driver. The sysfs interfaces have been tested on an RX51 (N900) to see if it responds to changing light conditions. The only real reason for submitting this to staging is that it is dependent on the IIO subsystem. Signed-off-by: Amit Kucheria Cc: Jonathan Cameron Cc: linux-omap@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/light/Kconfig | 11 + drivers/staging/iio/light/Makefile | 1 + drivers/staging/iio/light/tsl2563.c | 772 ++++++++++++++++++++++++++++ drivers/staging/iio/light/tsl2563.h | 9 + 4 files changed, 793 insertions(+) create mode 100644 drivers/staging/iio/light/tsl2563.c create mode 100644 drivers/staging/iio/light/tsl2563.h diff --git a/drivers/staging/iio/light/Kconfig b/drivers/staging/iio/light/Kconfig index 12af0c46fe22..cf0d0d64b958 100644 --- a/drivers/staging/iio/light/Kconfig +++ b/drivers/staging/iio/light/Kconfig @@ -11,3 +11,14 @@ config TSL2561 convertor. This chip has two light sensors. One is broadband including infrared whilst the other measures only infrared. Provides direct access via sysfs. + +config SENSORS_TSL2563 + tristate "TAOS TSL2563 ambient light sensor" + depends on I2C + help + If you say yes here you get support for the Taos TSL2563 + ambient light sensor (found in N900). + + This driver can also be built as a module. If so, the module + will be called tsl2563. + diff --git a/drivers/staging/iio/light/Makefile b/drivers/staging/iio/light/Makefile index ccff15167609..30dbfb1033a3 100644 --- a/drivers/staging/iio/light/Makefile +++ b/drivers/staging/iio/light/Makefile @@ -3,3 +3,4 @@ # obj-$(CONFIG_TSL2561) += tsl2561.o +obj-$(CONFIG_SENSORS_TSL2563) += tsl2563.o diff --git a/drivers/staging/iio/light/tsl2563.c b/drivers/staging/iio/light/tsl2563.c new file mode 100644 index 000000000000..3e812b2d0cd4 --- /dev/null +++ b/drivers/staging/iio/light/tsl2563.c @@ -0,0 +1,772 @@ +/* + * drivers/i2c/chips/tsl2563.c + * + * Copyright (C) 2008 Nokia Corporation + * + * Written by Timo O. Karjalainen + * Contact: Amit Kucheria + * + * Converted to IIO driver + * Amit Kucheria + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * 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 St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../iio.h" +#include "tsl2563.h" + +#define DRIVER_NAME "tsl2563" + +/* Use this many bits for fraction part. */ +#define ADC_FRAC_BITS (14) + +/* Given number of 1/10000's in ADC_FRAC_BITS precision. */ +#define FRAC10K(f) (((f) * (1L << (ADC_FRAC_BITS))) / (10000)) + +/* Bits used for fraction in calibration coefficients.*/ +#define CALIB_FRAC_BITS (10) +/* 0.5 in CALIB_FRAC_BITS precision */ +#define CALIB_FRAC_HALF (1 << (CALIB_FRAC_BITS - 1)) +/* Make a fraction from a number n that was multiplied with b. */ +#define CALIB_FRAC(n, b) (((n) << CALIB_FRAC_BITS) / (b)) +/* Decimal 10^(digits in sysfs presentation) */ +#define CALIB_BASE_SYSFS (1000) + +#define TSL2563_CMD (0x80) +#define TSL2563_CLEARINT (0x40) + +#define TSL2563_REG_CTRL (0x00) +#define TSL2563_REG_TIMING (0x01) +#define TSL2563_REG_LOWLOW (0x02) /* data0 low threshold, 2 bytes */ +#define TSL2563_REG_LOWHIGH (0x03) +#define TSL2563_REG_HIGHLOW (0x04) /* data0 high threshold, 2 bytes */ +#define TSL2563_REG_HIGHHIGH (0x05) +#define TSL2563_REG_INT (0x06) +#define TSL2563_REG_ID (0x0a) +#define TSL2563_REG_DATA0LOW (0x0c) /* broadband sensor value, 2 bytes */ +#define TSL2563_REG_DATA0HIGH (0x0d) +#define TSL2563_REG_DATA1LOW (0x0e) /* infrared sensor value, 2 bytes */ +#define TSL2563_REG_DATA1HIGH (0x0f) + +#define TSL2563_CMD_POWER_ON (0x03) +#define TSL2563_CMD_POWER_OFF (0x00) +#define TSL2563_CTRL_POWER_MASK (0x03) + +#define TSL2563_TIMING_13MS (0x00) +#define TSL2563_TIMING_100MS (0x01) +#define TSL2563_TIMING_400MS (0x02) +#define TSL2563_TIMING_MASK (0x03) +#define TSL2563_TIMING_GAIN16 (0x10) +#define TSL2563_TIMING_GAIN1 (0x00) + +#define TSL2563_INT_DISBLED (0x00) +#define TSL2563_INT_LEVEL (0x10) +#define TSL2563_INT_PERSIST(n) ((n) & 0x0F) + +struct tsl2563_gainlevel_coeff { + u8 gaintime; + u16 min; + u16 max; +}; + +static struct tsl2563_gainlevel_coeff tsl2563_gainlevel_table[] = { + { + .gaintime = TSL2563_TIMING_400MS | TSL2563_TIMING_GAIN16, + .min = 0, + .max = 65534, + }, { + .gaintime = TSL2563_TIMING_400MS | TSL2563_TIMING_GAIN1, + .min = 2048, + .max = 65534, + }, { + .gaintime = TSL2563_TIMING_100MS | TSL2563_TIMING_GAIN1, + .min = 4095, + .max = 37177, + }, { + .gaintime = TSL2563_TIMING_13MS | TSL2563_TIMING_GAIN1, + .min = 3000, + .max = 65535, + }, +}; + +struct tsl2563_chip { + struct mutex lock; + struct i2c_client *client; + struct iio_dev *indio_dev; + struct delayed_work poweroff_work; + + /* Remember state for suspend and resume functions */ + pm_message_t state; + + struct tsl2563_gainlevel_coeff *gainlevel; + + /* Thresholds are in lux */ + u16 low_thres; + u16 high_thres; + u8 intr; + + /* Calibration coefficients */ + u32 calib0; + u32 calib1; + int cover_comp_gain; + + /* Cache current values, to be returned while suspended */ + u32 data0; + u32 data1; +}; + +static int tsl2563_write(struct i2c_client *client, u8 reg, u8 value) +{ + int ret; + u8 buf[2]; + + buf[0] = TSL2563_CMD | reg; + buf[1] = value; + + ret = i2c_master_send(client, buf, sizeof(buf)); + return (ret == sizeof(buf)) ? 0 : ret; +} + +static int tsl2563_read(struct i2c_client *client, u8 reg, void *buf, int len) +{ + int ret; + u8 cmd = TSL2563_CMD | reg; + + ret = i2c_master_send(client, &cmd, sizeof(cmd)); + if (ret != sizeof(cmd)) + return ret; + + return i2c_master_recv(client, buf, len); +} + +static int tsl2563_set_power(struct tsl2563_chip *chip, int on) +{ + struct i2c_client *client = chip->client; + u8 cmd; + + cmd = on ? TSL2563_CMD_POWER_ON : TSL2563_CMD_POWER_OFF; + return tsl2563_write(client, TSL2563_REG_CTRL, cmd); +} + +/* + * Return value is 0 for off, 1 for on, or a negative error + * code if reading failed. + */ +static int tsl2563_get_power(struct tsl2563_chip *chip) +{ + struct i2c_client *client = chip->client; + int ret; + u8 val; + + ret = tsl2563_read(client, TSL2563_REG_CTRL, &val, sizeof(val)); + if (ret != sizeof(val)) + return ret; + + return (val & TSL2563_CTRL_POWER_MASK) == TSL2563_CMD_POWER_ON; +} + +static int tsl2563_configure(struct tsl2563_chip *chip) +{ + struct i2c_client *client = chip->client; + int ret; + + ret = tsl2563_write(client, TSL2563_REG_TIMING, + chip->gainlevel->gaintime); + if (ret) + goto out; + + ret = tsl2563_write(client, TSL2563_REG_INT, chip->intr); + +out: + return ret; +} + +static void tsl2563_poweroff_work(struct work_struct *work) +{ + struct tsl2563_chip *chip = + container_of(work, struct tsl2563_chip, poweroff_work.work); + tsl2563_set_power(chip, 0); +} + +static int tsl2563_detect(struct tsl2563_chip *chip) +{ + int ret; + + ret = tsl2563_set_power(chip, 1); + if (ret) + return ret; + + ret = tsl2563_get_power(chip); + if (ret < 0) + return ret; + + return ret ? 0 : -ENODEV; +} + +static int tsl2563_read_id(struct tsl2563_chip *chip, u8 *id) +{ + struct i2c_client *client = chip->client; + int ret; + + ret = tsl2563_read(client, TSL2563_REG_ID, id, sizeof(*id)); + if (ret != sizeof(*id)) + return ret; + + return 0; +} + +/* + * "Normalized" ADC value is one obtained with 400ms of integration time and + * 16x gain. This function returns the number of bits of shift needed to + * convert between normalized values and HW values obtained using given + * timing and gain settings. + */ +static int adc_shiftbits(u8 timing) +{ + int shift = 0; + + switch (timing & TSL2563_TIMING_MASK) { + case TSL2563_TIMING_13MS: + shift += 5; + break; + case TSL2563_TIMING_100MS: + shift += 2; + break; + case TSL2563_TIMING_400MS: + /* no-op */ + break; + } + + if (!(timing & TSL2563_TIMING_GAIN16)) + shift += 4; + + return shift; +} + +/* Convert a HW ADC value to normalized scale. */ +static u32 normalize_adc(u16 adc, u8 timing) +{ + return adc << adc_shiftbits(timing); +} + +static void tsl2563_wait_adc(struct tsl2563_chip *chip) +{ + unsigned int delay; + + switch (chip->gainlevel->gaintime & TSL2563_TIMING_MASK) { + case TSL2563_TIMING_13MS: + delay = 14; + break; + case TSL2563_TIMING_100MS: + delay = 101; + break; + default: + delay = 402; + } + /* + * TODO: Make sure that we wait at least required delay but why we + * have to extend it one tick more? + */ + schedule_timeout_interruptible(msecs_to_jiffies(delay) + 2); +} + +static int tsl2563_adjust_gainlevel(struct tsl2563_chip *chip, u16 adc) +{ + struct i2c_client *client = chip->client; + + if (adc > chip->gainlevel->max || adc < chip->gainlevel->min) { + + (adc > chip->gainlevel->max) ? + chip->gainlevel++ : chip->gainlevel--; + + tsl2563_write(client, TSL2563_REG_TIMING, + chip->gainlevel->gaintime); + + tsl2563_wait_adc(chip); + tsl2563_wait_adc(chip); + + return 1; + } else + return 0; +} + +static int tsl2563_get_adc(struct tsl2563_chip *chip) +{ + struct i2c_client *client = chip->client; + u8 buf0[2], buf1[2]; + u16 adc0, adc1; + int retry = 1; + int ret = 0; + + if (chip->state.event != PM_EVENT_ON) + goto out; + + cancel_delayed_work(&chip->poweroff_work); + + if (!tsl2563_get_power(chip)) { + ret = tsl2563_set_power(chip, 1); + if (ret) + goto out; + ret = tsl2563_configure(chip); + if (ret) + goto out; + tsl2563_wait_adc(chip); + } + + while (retry) { + ret = tsl2563_read(client, + TSL2563_REG_DATA0LOW | TSL2563_CLEARINT, + buf0, sizeof(buf0)); + if (ret != sizeof(buf0)) + goto out; + + ret = tsl2563_read(client, TSL2563_REG_DATA1LOW, + buf1, sizeof(buf1)); + if (ret != sizeof(buf1)) + goto out; + + adc0 = (buf0[1] << 8) + buf0[0]; + adc1 = (buf1[1] << 8) + buf1[0]; + + retry = tsl2563_adjust_gainlevel(chip, adc0); + } + + chip->data0 = normalize_adc(adc0, chip->gainlevel->gaintime); + chip->data1 = normalize_adc(adc1, chip->gainlevel->gaintime); + + schedule_delayed_work(&chip->poweroff_work, 5 * HZ); + + ret = 0; +out: + return ret; +} + +static inline int calib_to_sysfs(u32 calib) +{ + return (int) (((calib * CALIB_BASE_SYSFS) + + CALIB_FRAC_HALF) >> CALIB_FRAC_BITS); +} + +static inline u32 calib_from_sysfs(int value) +{ + return (((u32) value) << CALIB_FRAC_BITS) / CALIB_BASE_SYSFS; +} + +/* + * Conversions between lux and ADC values. + * + * The basic formula is lux = c0 * adc0 - c1 * adc1, where c0 and c1 are + * appropriate constants. Different constants are needed for different + * kinds of light, determined by the ratio adc1/adc0 (basically the ratio + * of the intensities in infrared and visible wavelengths). lux_table below + * lists the upper threshold of the adc1/adc0 ratio and the corresponding + * constants. + */ + +struct tsl2563_lux_coeff { + unsigned long ch_ratio; + unsigned long ch0_coeff; + unsigned long ch1_coeff; +}; + +static const struct tsl2563_lux_coeff lux_table[] = { + { + .ch_ratio = FRAC10K(1300), + .ch0_coeff = FRAC10K(315), + .ch1_coeff = FRAC10K(262), + }, { + .ch_ratio = FRAC10K(2600), + .ch0_coeff = FRAC10K(337), + .ch1_coeff = FRAC10K(430), + }, { + .ch_ratio = FRAC10K(3900), + .ch0_coeff = FRAC10K(363), + .ch1_coeff = FRAC10K(529), + }, { + .ch_ratio = FRAC10K(5200), + .ch0_coeff = FRAC10K(392), + .ch1_coeff = FRAC10K(605), + }, { + .ch_ratio = FRAC10K(6500), + .ch0_coeff = FRAC10K(229), + .ch1_coeff = FRAC10K(291), + }, { + .ch_ratio = FRAC10K(8000), + .ch0_coeff = FRAC10K(157), + .ch1_coeff = FRAC10K(180), + }, { + .ch_ratio = FRAC10K(13000), + .ch0_coeff = FRAC10K(34), + .ch1_coeff = FRAC10K(26), + }, { + .ch_ratio = ULONG_MAX, + .ch0_coeff = 0, + .ch1_coeff = 0, + }, +}; + +/* + * Convert normalized, scaled ADC values to lux. + */ +static unsigned int adc_to_lux(u32 adc0, u32 adc1) +{ + const struct tsl2563_lux_coeff *lp = lux_table; + unsigned long ratio, lux, ch0 = adc0, ch1 = adc1; + + ratio = ch0 ? ((ch1 << ADC_FRAC_BITS) / ch0) : ULONG_MAX; + + while (lp->ch_ratio < ratio) + lp++; + + lux = ch0 * lp->ch0_coeff - ch1 * lp->ch1_coeff; + + return (unsigned int) (lux >> ADC_FRAC_BITS); +} + +/*--------------------------------------------------------------*/ +/* Sysfs interface */ +/*--------------------------------------------------------------*/ + +static ssize_t tsl2563_adc0_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct tsl2563_chip *chip = indio_dev->dev_data; + int ret; + + mutex_lock(&chip->lock); + + ret = tsl2563_get_adc(chip); + if (ret) + goto out; + + ret = snprintf(buf, PAGE_SIZE, "%d\n", chip->data0); +out: + mutex_unlock(&chip->lock); + return ret; +} + +static ssize_t tsl2563_adc1_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct tsl2563_chip *chip = indio_dev->dev_data; + int ret; + + mutex_lock(&chip->lock); + + ret = tsl2563_get_adc(chip); + if (ret) + goto out; + + ret = snprintf(buf, PAGE_SIZE, "%d\n", chip->data1); +out: + mutex_unlock(&chip->lock); + return ret; +} + +/* Apply calibration coefficient to ADC count. */ +static u32 calib_adc(u32 adc, u32 calib) +{ + unsigned long scaled = adc; + + scaled *= calib; + scaled >>= CALIB_FRAC_BITS; + + return (u32) scaled; +} + +static ssize_t tsl2563_lux_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct tsl2563_chip *chip = indio_dev->dev_data; + u32 calib0, calib1; + int ret; + + mutex_lock(&chip->lock); + + ret = tsl2563_get_adc(chip); + if (ret) + goto out; + + calib0 = calib_adc(chip->data0, chip->calib0) * chip->cover_comp_gain; + calib1 = calib_adc(chip->data1, chip->calib1) * chip->cover_comp_gain; + + ret = snprintf(buf, PAGE_SIZE, "%d\n", adc_to_lux(calib0, calib1)); + +out: + mutex_unlock(&chip->lock); + return ret; +} + +static ssize_t format_calib(char *buf, int len, u32 calib) +{ + return snprintf(buf, PAGE_SIZE, "%d\n", calib_to_sysfs(calib)); +} + +static ssize_t tsl2563_calib0_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct tsl2563_chip *chip = indio_dev->dev_data; + int ret; + + mutex_lock(&chip->lock); + ret = format_calib(buf, PAGE_SIZE, chip->calib0); + mutex_unlock(&chip->lock); + return ret; +} + +static ssize_t tsl2563_calib1_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct tsl2563_chip *chip = indio_dev->dev_data; + int ret; + + mutex_lock(&chip->lock); + ret = format_calib(buf, PAGE_SIZE, chip->calib1); + mutex_unlock(&chip->lock); + return ret; +} + +static int do_calib_store(struct device *dev, const char *buf, size_t len, + int ch) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct tsl2563_chip *chip = indio_dev->dev_data; + int value; + u32 calib; + + if (1 != sscanf(buf, "%d", &value)) + return -EINVAL; + + calib = calib_from_sysfs(value); + + if (ch) + chip->calib1 = calib; + else + chip->calib0 = calib; + + return len; +} + +static ssize_t tsl2563_calib0_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + return do_calib_store(dev, buf, len, 0); +} + +static ssize_t tsl2563_calib1_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + return do_calib_store(dev, buf, len, 1); +} + +/* AmitXXXX: Convert to IIO_DEV_ATTR_LIGHT* as in tsl2561 + * once I understand what they mean */ +static DEVICE_ATTR(adc0, S_IRUGO, tsl2563_adc0_show, NULL); +static DEVICE_ATTR(adc1, S_IRUGO, tsl2563_adc1_show, NULL); +static DEVICE_ATTR(lux, S_IRUGO, tsl2563_lux_show, NULL); +static DEVICE_ATTR(calib0, S_IRUGO | S_IWUSR, + tsl2563_calib0_show, tsl2563_calib0_store); +static DEVICE_ATTR(calib1, S_IRUGO | S_IWUSR, + tsl2563_calib1_show, tsl2563_calib1_store); + +static struct attribute *tsl2563_attributes[] = { + &dev_attr_adc0.attr, + &dev_attr_adc1.attr, + &dev_attr_lux.attr, + &dev_attr_calib0.attr, + &dev_attr_calib1.attr, + NULL +}; + +static const struct attribute_group tsl2563_group = { + .attrs = tsl2563_attributes, +}; + +/*--------------------------------------------------------------*/ +/* Probe, Attach, Remove */ +/*--------------------------------------------------------------*/ +static struct i2c_driver tsl2563_i2c_driver; + +static int __devinit tsl2563_probe(struct i2c_client *client, + const struct i2c_device_id *device_id) +{ + struct tsl2563_chip *chip; + struct tsl2563_platform_data *pdata = client->dev.platform_data; + int err = 0; + int ret; + u8 id; + + chip = kzalloc(sizeof(*chip), GFP_KERNEL); + if (!chip) + return -ENOMEM; + + i2c_set_clientdata(client, chip); + chip->client = client; + + err = tsl2563_detect(chip); + if (err) { + dev_err(&client->dev, "device not found, error %d \n", -err); + goto fail1; + } + + err = tsl2563_read_id(chip, &id); + if (err) + goto fail1; + + mutex_init(&chip->lock); + + /* Default values used until userspace says otherwise */ + chip->low_thres = 0x0; + chip->high_thres = 0xffff; + chip->gainlevel = tsl2563_gainlevel_table; + chip->intr = TSL2563_INT_PERSIST(4); + chip->calib0 = calib_from_sysfs(CALIB_BASE_SYSFS); + chip->calib1 = calib_from_sysfs(CALIB_BASE_SYSFS); + + if (pdata) + chip->cover_comp_gain = pdata->cover_comp_gain; + else + chip->cover_comp_gain = 1; + + dev_info(&client->dev, "model %d, rev. %d\n", id >> 4, id & 0x0f); + + chip->indio_dev = iio_allocate_device(); + if (!chip->indio_dev) + goto fail1; + chip->indio_dev->attrs = &tsl2563_group; + chip->indio_dev->dev.parent = &client->dev; + chip->indio_dev->dev_data = (void *)(chip); + chip->indio_dev->driver_module = THIS_MODULE; + chip->indio_dev->modes = INDIO_DIRECT_MODE; + ret = iio_device_register(chip->indio_dev); + if (ret) + goto fail1; + + err = tsl2563_configure(chip); + if (err) + goto fail2; + + INIT_DELAYED_WORK(&chip->poweroff_work, tsl2563_poweroff_work); + schedule_delayed_work(&chip->poweroff_work, 5 * HZ); + + return 0; +fail2: + iio_device_unregister(chip->indio_dev); +fail1: + kfree(chip); + return err; +} + +static int tsl2563_remove(struct i2c_client *client) +{ + struct tsl2563_chip *chip = i2c_get_clientdata(client); + + iio_device_unregister(chip->indio_dev); + + kfree(chip); + return 0; +} + +static int tsl2563_suspend(struct i2c_client *client, pm_message_t state) +{ + struct tsl2563_chip *chip = i2c_get_clientdata(client); + int ret; + + mutex_lock(&chip->lock); + + ret = tsl2563_set_power(chip, 0); + if (ret) + goto out; + + chip->state = state; + +out: + mutex_unlock(&chip->lock); + return ret; +} + +static int tsl2563_resume(struct i2c_client *client) +{ + struct tsl2563_chip *chip = i2c_get_clientdata(client); + int ret; + + mutex_lock(&chip->lock); + + ret = tsl2563_set_power(chip, 1); + if (ret) + goto out; + + ret = tsl2563_configure(chip); + if (ret) + goto out; + + chip->state.event = PM_EVENT_ON; + +out: + mutex_unlock(&chip->lock); + return ret; +} + +static const struct i2c_device_id tsl2563_id[] = { + { DRIVER_NAME, 0 }, + { }, +}; +MODULE_DEVICE_TABLE(i2c, tsl2563_id); + +static struct i2c_driver tsl2563_i2c_driver = { + .driver = { + .name = DRIVER_NAME, + }, + .suspend = tsl2563_suspend, + .resume = tsl2563_resume, + .probe = tsl2563_probe, + .remove = __devexit_p(tsl2563_remove), + .id_table = tsl2563_id, +}; + +static int __init tsl2563_init(void) +{ + return i2c_add_driver(&tsl2563_i2c_driver); +} + +static void __exit tsl2563_exit(void) +{ + i2c_del_driver(&tsl2563_i2c_driver); +} + +MODULE_AUTHOR("Nokia Corporation"); +MODULE_DESCRIPTION("tsl2563 light sensor driver"); +MODULE_LICENSE("GPL"); + +module_init(tsl2563_init); +module_exit(tsl2563_exit); diff --git a/drivers/staging/iio/light/tsl2563.h b/drivers/staging/iio/light/tsl2563.h new file mode 100644 index 000000000000..b97368bd7fff --- /dev/null +++ b/drivers/staging/iio/light/tsl2563.h @@ -0,0 +1,9 @@ +#ifndef __LINUX_TSL2563_H +#define __LINUX_TSL2563_H + +struct tsl2563_platform_data { + int cover_comp_gain; +}; + +#endif /* __LINUX_TSL2563_H */ + -- GitLab From 956cd45d03efd10f8b780d54b6e5e28d0afc2ef9 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Mon, 9 Nov 2009 17:19:45 +0100 Subject: [PATCH 199/235] Staging: rt28x0: fix comments in chip/mac_pci.h Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/chip/mac_pci.h | 72 +++++++++++++-------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/drivers/staging/rt2860/chip/mac_pci.h b/drivers/staging/rt2860/chip/mac_pci.h index 8dbadd033859..bc704acaa3d7 100644 --- a/drivers/staging/rt2860/chip/mac_pci.h +++ b/drivers/staging/rt2860/chip/mac_pci.h @@ -43,10 +43,10 @@ #include "../rtmp_iface.h" #include "../rtmp_dot11.h" -// -// Device ID & Vendor ID related definitions, -// NOTE: you should not add the new VendorID/DeviceID here unless you not sure it belongs to what chip. -// +/* */ +/* Device ID & Vendor ID related definitions, */ +/* NOTE: you should not add the new VendorID/DeviceID here unless you not sure it belongs to what chip. */ +/* */ #define NIC_PCI_VENDOR_ID 0x1814 #define PCIBUS_INTEL_VENDOR 0x8086 @@ -66,22 +66,22 @@ #define AUX_CTRL 0x10c -// -// TX descriptor format, Tx ring, Mgmt Ring -// +/* */ +/* TX descriptor format, Tx ring, Mgmt Ring */ +/* */ struct PACKED rt_txd { - // Word 0 + /* Word 0 */ u32 SDPtr0; - // Word 1 + /* Word 1 */ u32 SDLen1:14; u32 LastSec1:1; u32 Burst:1; u32 SDLen0:14; u32 LastSec0:1; u32 DMADONE:1; - //Word2 + /*Word2 */ u32 SDPtr1; - //Word3 + /*Word3 */ u32 rsv2:24; u32 WIV:1; /* Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition */ u32 QSEL:2; /* select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA */ @@ -91,21 +91,21 @@ struct PACKED rt_txd { u32 ICO:1; /* */ }; -// -// Rx descriptor format, Rx Ring -// +/* */ +/* Rx descriptor format, Rx Ring */ +/* */ typedef struct PACKED rt_rxd { - // Word 0 + /* Word 0 */ u32 SDP0; - // Word 1 + /* Word 1 */ u32 SDL1:14; u32 Rsv:2; u32 SDL0:14; u32 LS0:1; u32 DDONE:1; - // Word 2 + /* Word 2 */ u32 SDP1; - // Word 3 + /* Word 3 */ u32 BA:1; u32 DATA:1; u32 NULLDATA:1; @@ -141,9 +141,9 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { /* ----------------- EEPROM Related MACRO ----------------- */ -// 8051 firmware image for RT2860 - base address = 0x4000 +/* 8051 firmware image for RT2860 - base address = 0x4000 */ #define FIRMWARE_IMAGE_BASE 0x2000 -#define MAX_FIRMWARE_IMAGE_SIZE 0x2000 // 8kbyte +#define MAX_FIRMWARE_IMAGE_SIZE 0x2000 /* 8kbyte */ /* ----------------- Frimware Related MACRO ----------------- */ #define RTMP_WRITE_FIRMWARE(_pAd, _pFwImage, _FwLen) \ @@ -222,25 +222,25 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { /* ----------------- RX Related MACRO ----------------- */ /* ----------------- ASIC Related MACRO ----------------- */ -// reset MAC of a station entry to 0x000000000000 +/* reset MAC of a station entry to 0x000000000000 */ #define RTMP_STA_ENTRY_MAC_RESET(pAd, Wcid) \ AsicDelWcidTab(pAd, Wcid); -// add this entry into ASIC RX WCID search table +/* add this entry into ASIC RX WCID search table */ #define RTMP_STA_ENTRY_ADD(pAd, pEntry) \ AsicUpdateRxWCIDTable(pAd, pEntry->Aid, pEntry->Addr); -// add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet -// Set MAC register value according operation mode +/* add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet */ +/* Set MAC register value according operation mode */ #define RTMP_UPDATE_PROTECT(pAd) \ AsicUpdateProtect(pAd, 0, (ALLN_SETPROTECT), TRUE, 0); -// end johnli +/* end johnli */ -// remove Pair-wise key material from ASIC +/* remove Pair-wise key material from ASIC */ #define RTMP_STA_ENTRY_KEY_DEL(pAd, BssIdx, Wcid) \ AsicRemovePairwiseKeyEntry(pAd, BssIdx, (u8)Wcid); -// add Client security information into ASIC WCID table and IVEIV table +/* add Client security information into ASIC WCID table and IVEIV table */ #define RTMP_STA_SECURITY_INFO_ADD(pAd, apidx, KeyID, pEntry) \ RTMPAddWcidAttributeEntry(pAd, apidx, KeyID, \ pAd->SharedKey[apidx][KeyID].CipherAlg, pEntry); @@ -257,7 +257,7 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { pAd->SharedKey[apidx][KeyID].CipherAlg, \ pEntry); } -// Insert the BA bitmap to ASIC for the Wcid entry +/* Insert the BA bitmap to ASIC for the Wcid entry */ #define RTMP_ADD_BA_SESSION_TO_ASIC(_pAd, _Aid, _TID) \ do{ \ u32 _Value = 0, _Offset; \ @@ -267,8 +267,8 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { RTMP_IO_WRITE32((_pAd), _Offset, _Value);\ }while(0) -// Remove the BA bitmap from ASIC for the Wcid entry -// bitmap field starts at 0x10000 in ASIC WCID table +/* Remove the BA bitmap from ASIC for the Wcid entry */ +/* bitmap field starts at 0x10000 in ASIC WCID table */ #define RTMP_DEL_BA_SESSION_FROM_ASIC(_pAd, _Wcid, _TID) \ do{ \ u32 _Value = 0, _Offset; \ @@ -280,10 +280,10 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { /* ----------------- Interface Related MACRO ----------------- */ -// -// Enable & Disable NIC interrupt via writing interrupt mask register -// Since it use ADAPTER structure, it have to be put after structure definition. -// +/* */ +/* Enable & Disable NIC interrupt via writing interrupt mask register */ +/* Since it use ADAPTER structure, it have to be put after structure definition. */ +/* */ #define RTMP_ASIC_INTERRUPT_DISABLE(_pAd) \ do{ \ RTMP_IO_WRITE32((_pAd), INT_MASK_CSR, 0x0); /* 0: disable */ \ @@ -324,7 +324,7 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { /* ----------------- Power Save Related MACRO ----------------- */ #define RTMP_PS_POLL_ENQUEUE(pAd) EnqueuePsPoll(pAd) -// For RTMPPCIePowerLinkCtrlRestore () function +/* For RTMPPCIePowerLinkCtrlRestore () function */ #define RESTORE_HALT 1 #define RESTORE_WAKEUP 2 #define RESTORE_CLOSE 3 @@ -352,4 +352,4 @@ typedef union _TX_ATTENUATION_CTRL_STRUC { #define RTMP_MLME_RADIO_OFF(pAd) \ RT28xxPciMlmeRadioOFF(pAd); -#endif //__MAC_PCI_H__ // +#endif /*__MAC_PCI_H__ // */ -- GitLab From 06aea994cf03ec589b198ff718ae7fee4ec41659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dalfu=C3=9F?= Date: Sat, 7 Nov 2009 17:31:12 +0100 Subject: [PATCH 200/235] Staging: rt2860: reduce superfluous exclamation marks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This removes superfluous exclamation marks from strings and comments, and also three spelling typos. Signed-off-by: Sebastian Dalfuß Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/common/ba_action.c | 4 +- drivers/staging/rt2860/common/cmm_aes.c | 2 +- drivers/staging/rt2860/common/cmm_asic.c | 2 +- drivers/staging/rt2860/common/cmm_data.c | 8 ++-- drivers/staging/rt2860/common/cmm_data_2860.c | 2 +- drivers/staging/rt2860/common/cmm_data_pci.c | 2 +- drivers/staging/rt2860/common/cmm_mac_pci.c | 2 +- drivers/staging/rt2860/common/cmm_mac_usb.c | 22 +++++----- drivers/staging/rt2860/common/cmm_sanity.c | 4 +- drivers/staging/rt2860/common/cmm_tkip.c | 2 +- drivers/staging/rt2860/common/cmm_wep.c | 2 +- drivers/staging/rt2860/common/cmm_wpa.c | 4 +- drivers/staging/rt2860/common/mlme.c | 8 ++-- drivers/staging/rt2860/common/rt_rf.c | 2 +- drivers/staging/rt2860/common/rtmp_init.c | 6 +-- drivers/staging/rt2860/oid.h | 4 +- drivers/staging/rt2860/rt_linux.c | 4 +- drivers/staging/rt2860/rt_linux.h | 2 +- drivers/staging/rt2860/rt_main_dev.c | 2 +- drivers/staging/rt2860/rtmp_chip.h | 2 +- drivers/staging/rt2860/rtmp_def.h | 2 +- drivers/staging/rt2860/sta/assoc.c | 4 +- drivers/staging/rt2860/sta/connect.c | 40 +++++++++---------- drivers/staging/rt2860/sta/rtmp_data.c | 12 +++--- drivers/staging/rt2860/sta/sanity.c | 2 +- drivers/staging/rt2860/sta_ioctl.c | 14 +++---- drivers/staging/rt2860/usb_main_dev.c | 4 +- 27 files changed, 82 insertions(+), 82 deletions(-) diff --git a/drivers/staging/rt2860/common/ba_action.c b/drivers/staging/rt2860/common/ba_action.c index 69eea402d32d..174f2a73a1bb 100644 --- a/drivers/staging/rt2860/common/ba_action.c +++ b/drivers/staging/rt2860/common/ba_action.c @@ -1481,7 +1481,7 @@ static void ba_enqueue_reordering_packet(struct rt_rtmp_adapter *pAd, NdisReleaseSpinLock(&pBAEntry->RxReRingLock); } else { DBGPRINT(RT_DEBUG_ERROR, - ("!!! (%d) Can't allocate reordering mpdu blk\n", + (" (%d) Can't allocate reordering mpdu blk\n", pBAEntry->list.qlen)); /* @@ -1542,7 +1542,7 @@ void Indicate_AMPDU_Packet(struct rt_rtmp_adapter *pAd, } pBAEntry = &pAd->BATable.BARecEntry[Idx]; } else { - /* impossible !!! */ + /* impossible ! */ ASSERT(0); /* release packet */ RELEASE_NDIS_PACKET(pAd, pRxBlk->pRxPacket, diff --git a/drivers/staging/rt2860/common/cmm_aes.c b/drivers/staging/rt2860/common/cmm_aes.c index 6730d78badfc..250357c5cd65 100644 --- a/drivers/staging/rt2860/common/cmm_aes.c +++ b/drivers/staging/rt2860/common/cmm_aes.c @@ -1279,7 +1279,7 @@ void AES_GTK_KEY_UNWRAP(u8 * key, if (R == NULL) { DBGPRINT(RT_DEBUG_ERROR, - ("!!!AES_GTK_KEY_UNWRAP: no memory!!!\n")); + ("AES_GTK_KEY_UNWRAP: no memory!\n")); return; } /* End of if */ diff --git a/drivers/staging/rt2860/common/cmm_asic.c b/drivers/staging/rt2860/common/cmm_asic.c index fafba27fcd7b..4d77e83eb418 100644 --- a/drivers/staging/rt2860/common/cmm_asic.c +++ b/drivers/staging/rt2860/common/cmm_asic.c @@ -1005,7 +1005,7 @@ void AsicSwitchChannel(struct rt_rtmp_adapter *pAd, u8 Channel, IN BOOLEAN bScan void AsicResetBBPAgent(struct rt_rtmp_adapter *pAd) { BBP_CSR_CFG_STRUC BbpCsr; - DBGPRINT(RT_DEBUG_ERROR, ("Reset BBP Agent busy bit.!! \n")); + DBGPRINT(RT_DEBUG_ERROR, ("Reset BBP Agent busy bit!\n")); /* Still need to find why BBP agent keeps busy, but in fact, hardware still function ok. Now clear busy first. */ RTMP_IO_READ32(pAd, H2M_BBP_AGENT, &BbpCsr.word); BbpCsr.field.Busy = 0; diff --git a/drivers/staging/rt2860/common/cmm_data.c b/drivers/staging/rt2860/common/cmm_data.c index 2d2c311bc7a4..68263cee7952 100644 --- a/drivers/staging/rt2860/common/cmm_data.c +++ b/drivers/staging/rt2860/common/cmm_data.c @@ -397,7 +397,7 @@ int MlmeHardTransmitMgmtRing(struct rt_rtmp_adapter *pAd, && (pAd->CommonCfg.bIEEE80211H == 1) && (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE)) { DBGPRINT(RT_DEBUG_ERROR, - ("MlmeHardTransmit --> radar detect not in normal mode !!!\n")); + ("MlmeHardTransmit --> radar detect not in normal mode!\n")); /* if (!IrqState) */ RTMP_SEM_UNLOCK(&pAd->MgmtRingLock); return (NDIS_STATUS_FAILURE); @@ -964,7 +964,7 @@ u16 RTMPCalcDuration(struct rt_rtmp_adapter *pAd, u8 Rate, unsigned long Size) IRQL = PASSIVE_LEVEL IRQL = DISPATCH_LEVEL - See also : BASmartHardTransmit() !!! + See also : BASmartHardTransmit() ! ======================================================================== */ @@ -1708,7 +1708,7 @@ BOOLEAN MacTableDeleteEntry(struct rt_rtmp_adapter *pAd, pProbeEntry = pProbeEntry->pNext; } while (pProbeEntry); - /* not found !!! */ + /* not found ! */ ASSERT(pProbeEntry != NULL); RTMP_STA_ENTRY_KEY_DEL(pAd, BSS0, wcid); @@ -1729,7 +1729,7 @@ BOOLEAN MacTableDeleteEntry(struct rt_rtmp_adapter *pAd, pAd->MacTab.Size)); } else { DBGPRINT(RT_DEBUG_OFF, - ("\n%s: Impossible Wcid = %d !!!!!\n", + ("\n%s: Impossible Wcid = %d !\n", __func__, wcid)); } } diff --git a/drivers/staging/rt2860/common/cmm_data_2860.c b/drivers/staging/rt2860/common/cmm_data_2860.c index 857ff450b6c9..d3ae7ca5a700 100644 --- a/drivers/staging/rt2860/common/cmm_data_2860.c +++ b/drivers/staging/rt2860/common/cmm_data_2860.c @@ -847,7 +847,7 @@ VOID RT28xxPciStaAsicForceWakeup( AutoWakeupCfg.word = 0; RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - // If this is called from Halt. ALWAYS force wakeup!!! + // If this is called from Halt. ALWAYS force wakeup! if (Level == RTMP_HALT) { RT28xxPciAsicRadioOn(pAd, RTMP_HALT); diff --git a/drivers/staging/rt2860/common/cmm_data_pci.c b/drivers/staging/rt2860/common/cmm_data_pci.c index e6cb55a1292e..43d73a05c8eb 100644 --- a/drivers/staging/rt2860/common/cmm_data_pci.c +++ b/drivers/staging/rt2860/common/cmm_data_pci.c @@ -979,7 +979,7 @@ int MlmeHardTransmitTxRing(struct rt_rtmp_adapter *pAd, && (pAd->CommonCfg.bIEEE80211H == 1) && (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE)) { DBGPRINT(RT_DEBUG_ERROR, - ("MlmeHardTransmit --> radar detect not in normal mode !!!\n")); + ("MlmeHardTransmit --> radar detect not in normal mode!\n")); /*NdisReleaseSpinLock(&pAd->TxRingLock); */ return (NDIS_STATUS_FAILURE); } diff --git a/drivers/staging/rt2860/common/cmm_mac_pci.c b/drivers/staging/rt2860/common/cmm_mac_pci.c index 11dfdc58c77b..560ebd398e1d 100644 --- a/drivers/staging/rt2860/common/cmm_mac_pci.c +++ b/drivers/staging/rt2860/common/cmm_mac_pci.c @@ -1650,7 +1650,7 @@ void RT28xxPciMlmeRadioOFF(struct rt_rtmp_adapter *pAd) if (brc == FALSE) { DBGPRINT(RT_DEBUG_ERROR, - ("%s call RT28xxPciAsicRadioOff fail !!\n", + ("%s call RT28xxPciAsicRadioOff fail!\n", __func__)); } } diff --git a/drivers/staging/rt2860/common/cmm_mac_usb.c b/drivers/staging/rt2860/common/cmm_mac_usb.c index 010c37c4c724..9dd6959cd5a5 100644 --- a/drivers/staging/rt2860/common/cmm_mac_usb.c +++ b/drivers/staging/rt2860/common/cmm_mac_usb.c @@ -205,9 +205,9 @@ int NICInitTransmit(struct rt_rtmp_adapter *pAd) /*Allocate URB */ LM_USB_ALLOC(pObj, pHTTXContext, struct rt_httx_buffer *, sizeof(struct rt_httx_buffer), Status, - ("<-- ERROR in Alloc TX TxContext[%d] urb!! \n", + ("<-- ERROR in Alloc TX TxContext[%d] urb!\n", acidx), done, - ("<-- ERROR in Alloc TX TxContext[%d] struct rt_httx_buffer !! \n", + ("<-- ERROR in Alloc TX TxContext[%d] struct rt_httx_buffer!\n", acidx), out1); NdisZeroMemory(pHTTXContext->TransferBuffer-> @@ -259,7 +259,7 @@ int NICInitTransmit(struct rt_rtmp_adapter *pAd) pMLMEContext->pUrb = RTUSB_ALLOC_URB(0); if (pMLMEContext->pUrb == NULL) { DBGPRINT(RT_DEBUG_ERROR, - ("<-- ERROR in Alloc TX MLMEContext[%d] urb!! \n", + ("<-- ERROR in Alloc TX MLMEContext[%d] urb!\n", i)); Status = NDIS_STATUS_RESOURCES; goto out2; @@ -296,9 +296,9 @@ int NICInitTransmit(struct rt_rtmp_adapter *pAd) /*Allocate URB */ LM_USB_ALLOC(pObj, pBeaconContext, struct rt_tx_buffer *, sizeof(struct rt_tx_buffer), Status, - ("<-- ERROR in Alloc TX BeaconContext[%d] urb!! \n", + ("<-- ERROR in Alloc TX BeaconContext[%d] urb!\n", i), out2, - ("<-- ERROR in Alloc TX BeaconContext[%d] struct rt_tx_buffer !! \n", + ("<-- ERROR in Alloc TX BeaconContext[%d] struct rt_tx_buffer!\n", i), out3); pBeaconContext->pAd = pAd; @@ -315,9 +315,9 @@ int NICInitTransmit(struct rt_rtmp_adapter *pAd) /*Allocate URB */ LM_USB_ALLOC(pObj, pNullContext, struct rt_tx_buffer *, sizeof(struct rt_tx_buffer), Status, - ("<-- ERROR in Alloc TX NullContext urb!! \n"), + ("<-- ERROR in Alloc TX NullContext urb!\n"), out3, - ("<-- ERROR in Alloc TX NullContext struct rt_tx_buffer !! \n"), + ("<-- ERROR in Alloc TX NullContext struct rt_tx_buffer!\n"), out4); pNullContext->pAd = pAd; @@ -333,9 +333,9 @@ int NICInitTransmit(struct rt_rtmp_adapter *pAd) /*Allocate URB */ LM_USB_ALLOC(pObj, pRTSContext, struct rt_tx_buffer *, sizeof(struct rt_tx_buffer), Status, - ("<-- ERROR in Alloc TX RTSContext urb!! \n"), + ("<-- ERROR in Alloc TX RTSContext urb!\n"), out4, - ("<-- ERROR in Alloc TX RTSContext struct rt_tx_buffer !! \n"), + ("<-- ERROR in Alloc TX RTSContext struct rt_tx_buffer!\n"), out5); pRTSContext->pAd = pAd; @@ -350,9 +350,9 @@ int NICInitTransmit(struct rt_rtmp_adapter *pAd) /*Allocate URB */ LM_USB_ALLOC(pObj, pPsPollContext, struct rt_tx_buffer *, sizeof(struct rt_tx_buffer), Status, - ("<-- ERROR in Alloc TX PsPollContext urb!! \n"), + ("<-- ERROR in Alloc TX PsPollContext urb!\n"), out5, - ("<-- ERROR in Alloc TX PsPollContext struct rt_tx_buffer !! \n"), + ("<-- ERROR in Alloc TX PsPollContext struct rt_tx_buffer!\n"), out6); pPsPollContext->pAd = pAd; diff --git a/drivers/staging/rt2860/common/cmm_sanity.c b/drivers/staging/rt2860/common/cmm_sanity.c index 556e3d06b88b..6b003c903444 100644 --- a/drivers/staging/rt2860/common/cmm_sanity.c +++ b/drivers/staging/rt2860/common/cmm_sanity.c @@ -256,7 +256,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(struct rt_rtmp_adapter *pAd, void * Msg, uns /* For some 11a AP which didn't have DS_IE, we use two conditions to decide the channel */ /* 1. If the AP is 11n enabled, then check the control channel. */ - /* 2. If the AP didn't have any info about channel, use the channel we received this frame as the channel. (May inaccuracy!!) */ + /* 2. If the AP didn't have any info about channel, use the channel we received this frame as the channel. (May inaccuracy!) */ u8 CtrlChannel = 0; /* Add for 3 necessary EID field check */ @@ -371,7 +371,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity(struct rt_rtmp_adapter *pAd, void * Msg, uns break; case IE_HT_CAP: - if (pEid->Len >= SIZE_HT_CAP_IE) /*Note: allow extension.!! */ + if (pEid->Len >= SIZE_HT_CAP_IE) /*Note: allow extension! */ { NdisMoveMemory(pHtCapability, pEid->Octet, sizeof(struct rt_ht_capability_ie)); diff --git a/drivers/staging/rt2860/common/cmm_tkip.c b/drivers/staging/rt2860/common/cmm_tkip.c index 7a2a48eb8e51..4881ef9ba022 100644 --- a/drivers/staging/rt2860/common/cmm_tkip.c +++ b/drivers/staging/rt2860/common/cmm_tkip.c @@ -828,6 +828,6 @@ BOOLEAN RTMPSoftDecryptTKIP(struct rt_rtmp_adapter *pAd, /*RTMPReportMicError(pAd, &pWpaKey[KeyID]); // marked by AlbertY @ 20060630 */ return (FALSE); } - /*DBGPRINT(RT_DEBUG_TRACE, "RTMPSoftDecryptTKIP Decript done!!\n"); */ + /*DBGPRINT(RT_DEBUG_TRACE, "RTMPSoftDecryptTKIP Decript done!\n"); */ return TRUE; } diff --git a/drivers/staging/rt2860/common/cmm_wep.c b/drivers/staging/rt2860/common/cmm_wep.c index c72835504ecb..76f880cb39b0 100644 --- a/drivers/staging/rt2860/common/cmm_wep.c +++ b/drivers/staging/rt2860/common/cmm_wep.c @@ -245,7 +245,7 @@ BOOLEAN RTMPSoftDecryptWEP(struct rt_rtmp_adapter *pAd, crc32 ^= 0xffffffff; /* complement */ if (crc32 != cpu2le32(trailfcs)) { - DBGPRINT(RT_DEBUG_TRACE, ("! WEP Data CRC Error !\n")); /*CRC error. */ + DBGPRINT(RT_DEBUG_TRACE, ("WEP Data CRC Error!\n")); /*CRC error. */ return (FALSE); } return (TRUE); diff --git a/drivers/staging/rt2860/common/cmm_wpa.c b/drivers/staging/rt2860/common/cmm_wpa.c index 7b51be0e8dd3..94e119faaa71 100644 --- a/drivers/staging/rt2860/common/cmm_wpa.c +++ b/drivers/staging/rt2860/common/cmm_wpa.c @@ -1292,7 +1292,7 @@ void PRF(u8 * key, os_alloc_mem(NULL, (u8 **) & input, 1024); if (input == NULL) { - DBGPRINT(RT_DEBUG_ERROR, ("!!!PRF: no memory!!!\n")); + DBGPRINT(RT_DEBUG_ERROR, ("PRF: no memory!\n")); return; } /* Generate concatenation input */ @@ -2672,7 +2672,7 @@ static void CalculateMIC(u8 KeyDescVer, os_alloc_mem(NULL, (u8 **) & OutBuffer, 512); if (OutBuffer == NULL) { - DBGPRINT(RT_DEBUG_ERROR, ("!!!CalculateMIC: no memory!!!\n")); + DBGPRINT(RT_DEBUG_ERROR, ("CalculateMIC: no memory!\n")); return; } /* make a frame for calculating MIC. */ diff --git a/drivers/staging/rt2860/common/mlme.c b/drivers/staging/rt2860/common/mlme.c index 8cd8f53ed0e6..9fc34a8f2180 100644 --- a/drivers/staging/rt2860/common/mlme.c +++ b/drivers/staging/rt2860/common/mlme.c @@ -483,7 +483,7 @@ void MlmeHandler(struct rt_rtmp_adapter *pAd) #ifdef RTMP_MAC_USB if (Elem->MsgType == MT2_RESET_CONF) { DBGPRINT_RAW(RT_DEBUG_TRACE, - ("!!! reset MLME state machine !!!\n")); + ("reset MLME state machine!\n")); MlmeRestartStateMachine(pAd); Elem->Occupied = FALSE; Elem->MsgLen = 0; @@ -4042,7 +4042,7 @@ void BssTableSsidSort(struct rt_rtmp_adapter *pAd, } /* Since the AP is using hidden SSID, and we are trying to connect to ANY */ /* It definitely will fail. So, skip it. */ - /* CCX also require not even try to connect it!! */ + /* CCX also require not even try to connect it! */ if (SsidLen == 0) continue; @@ -4600,8 +4600,8 @@ void MgtMacHeaderInit(struct rt_rtmp_adapter *pAd, * input params: * Buffer - pointer to a pre-allocated memory segment * args - a list of pairs. - * NOTE NOTE NOTE!!!! the last argument must be NULL, otherwise this - * function will FAIL!!! + * NOTE NOTE NOTE! the last argument must be NULL, otherwise this + * function will FAIL! * return: * Size of the buffer * usage: diff --git a/drivers/staging/rt2860/common/rt_rf.c b/drivers/staging/rt2860/common/rt_rf.c index fb0ca88fa3ea..519121d81040 100644 --- a/drivers/staging/rt2860/common/rt_rf.c +++ b/drivers/staging/rt2860/common/rt_rf.c @@ -72,7 +72,7 @@ int RT30xxWriteRFRegister(struct rt_rtmp_adapter *pAd, if ((i == RETRY_LIMIT) || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) { DBGPRINT_RAW(RT_DEBUG_ERROR, - ("Retry count exhausted or device removed!!!\n")); + ("Retry count exhausted or device removed!\n")); return STATUS_UNSUCCESSFUL; } diff --git a/drivers/staging/rt2860/common/rtmp_init.c b/drivers/staging/rt2860/common/rtmp_init.c index d3c7c17e36a8..21a95ffdfb86 100644 --- a/drivers/staging/rt2860/common/rtmp_init.c +++ b/drivers/staging/rt2860/common/rtmp_init.c @@ -75,7 +75,7 @@ struct rt_rtmp_reg_pair MACRegTable[] = { {BCN_OFFSET0, 0xece8e4e0}, /* 0x3800, 0x3A00, 0x3C00, 0x3E00, 512B for each beacon */ {BCN_OFFSET1, 0xfcf8f4f0}, /* 0x3800, 0x3A00, 0x3C00, 0x3E00, 512B for each beacon */ #else -#error You must re-calculate new value for BCN_OFFSET0 & BCN_OFFSET1 in MACRegTable[]!!! +#error You must re-calculate new value for BCN_OFFSET0 & BCN_OFFSET1 in MACRegTable[]! #endif /* HW_BEACON_OFFSET // */ {LEGACY_BASIC_RATE, 0x0000013f}, /* Basic rate set bitmap */ @@ -1272,7 +1272,7 @@ void NICInitAsicFromEEPROM(struct rt_rtmp_adapter *pAd) pAd->bAutoTxAgcA = pAd->bAutoTxAgcG = FALSE; /* */ /* Since BBP has been progamed, to make sure BBP setting will be */ - /* upate inside of AsicAntennaSelect, so reset to UNKNOWN_BAND!! */ + /* upate inside of AsicAntennaSelect, so reset to UNKNOWN_BAND! */ /* */ pAd->CommonCfg.BandState = UNKNOWN_BAND; @@ -3470,7 +3470,7 @@ err1: err0: #endif /* ST // */ - DBGPRINT(RT_DEBUG_ERROR, ("!!! rt28xx Initialized fail !!!\n")); + DBGPRINT(RT_DEBUG_ERROR, ("rt28xx Initialized fail!\n")); return FALSE; } diff --git a/drivers/staging/rt2860/oid.h b/drivers/staging/rt2860/oid.h index fa4a2e692e79..fd1c14192451 100644 --- a/drivers/staging/rt2860/oid.h +++ b/drivers/staging/rt2860/oid.h @@ -557,7 +557,7 @@ enum { /* New for MeetingHouse Api support */ #define OID_MH_802_1X_SUPPORTED 0xFFEDC100 -/* MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!! */ +/* MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition! */ typedef union _HTTRANSMIT_SETTING { struct { u16 MCS:7; /* MCS */ @@ -614,7 +614,7 @@ struct rt_802_11_event_table { struct rt_802_11_event_log Log[MAX_NUMBER_OF_EVENT]; }; -/* MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!! */ +/* MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition! */ typedef union _MACHTTRANSMIT_SETTING { struct { u16 MCS:7; /* MCS */ diff --git a/drivers/staging/rt2860/rt_linux.c b/drivers/staging/rt2860/rt_linux.c index d84ac32b8a87..9357fb26cc2a 100644 --- a/drivers/staging/rt2860/rt_linux.c +++ b/drivers/staging/rt2860/rt_linux.c @@ -51,7 +51,7 @@ char const *pWirelessSysEventText[IW_SYS_EVENT_TYPE_NUM] = { "connects with our wireless client", /* IW_STA_LINKUP_EVENT_FLAG */ "disconnects with our wireless client", /* IW_STA_LINKDOWN_EVENT_FLAG */ "scan completed" /* IW_SCAN_COMPLETED_EVENT_FLAG */ - "scan terminate!! Busy!! Enqueue fail!!" /* IW_SCAN_ENQUEUE_FAIL_EVENT_FLAG */ + "scan terminate! Busy! Enqueue fail!" /* IW_SCAN_ENQUEUE_FAIL_EVENT_FLAG */ }; /* for wireless IDS_spoof_attack event message */ @@ -1282,7 +1282,7 @@ int RtmpOSNetDevDestory(struct rt_rtmp_adapter *pAd, struct net_device *pNetDev) { /* TODO: Need to fix this */ - printk("WARNING: This function(%s) not implement yet!!!\n", __func__); + printk("WARNING: This function(%s) not implement yet!\n", __func__); return 0; } diff --git a/drivers/staging/rt2860/rt_linux.h b/drivers/staging/rt2860/rt_linux.h index 7efc109c22ff..f85508d9d5a9 100644 --- a/drivers/staging/rt2860/rt_linux.h +++ b/drivers/staging/rt2860/rt_linux.h @@ -427,7 +427,7 @@ do{ \ #define DBGPRINT_ERR(Fmt) \ { \ - printk("ERROR!!! "); \ + printk("ERROR! "); \ printk Fmt; \ } diff --git a/drivers/staging/rt2860/rt_main_dev.c b/drivers/staging/rt2860/rt_main_dev.c index fbbec9d2dcdd..c3d92802d0c9 100644 --- a/drivers/staging/rt2860/rt_main_dev.c +++ b/drivers/staging/rt2860/rt_main_dev.c @@ -321,7 +321,7 @@ int rt28xx_close(struct net_device *dev) if (brc == FALSE) { DBGPRINT(RT_DEBUG_ERROR, - ("%s call RT28xxPciAsicRadioOff fail !!\n", + ("%s call RT28xxPciAsicRadioOff fail!\n", __func__)); } } diff --git a/drivers/staging/rt2860/rtmp_chip.h b/drivers/staging/rt2860/rtmp_chip.h index 32ff3504e9e8..0adf2cd2deb7 100644 --- a/drivers/staging/rt2860/rtmp_chip.h +++ b/drivers/staging/rt2860/rtmp_chip.h @@ -197,7 +197,7 @@ typedef union _EEPROM_NIC_CINFIG2_STRUC { u16 DynamicTxAgcControl:1; /* */ u16 ExternalLNAForG:1; /* */ u16 ExternalLNAForA:1; /* external LNA enable for 2.4G */ - u16 CardbusAcceleration:1; /* !!! NOTE: 0 - enable, 1 - disable */ + u16 CardbusAcceleration:1; /* ! NOTE: 0 - enable, 1 - disable */ u16 BW40MSidebandForG:1; u16 BW40MSidebandForA:1; u16 EnableWPSPBC:1; /* WPS PBC Control bit */ diff --git a/drivers/staging/rt2860/rtmp_def.h b/drivers/staging/rt2860/rtmp_def.h index c79eceb6e71c..9c54bacb845b 100644 --- a/drivers/staging/rt2860/rtmp_def.h +++ b/drivers/staging/rt2860/rtmp_def.h @@ -409,7 +409,7 @@ #define MAX_LEN_OF_MAC_TABLE MAX_NUMBER_OF_MAC /* if MAX_MBSSID_NUM is 8, this value can't be larger than 211 */ #if MAX_LEN_OF_MAC_TABLE>MAX_AVAILABLE_CLIENT_WCID -#error MAX_LEN_OF_MAC_TABLE can not be larger than MAX_AVAILABLE_CLIENT_WCID!!!! +#error MAX_LEN_OF_MAC_TABLE can not be larger than MAX_AVAILABLE_CLIENT_WCID! #endif #define MAX_NUM_OF_WDS_LINK_PERBSSID 3 diff --git a/drivers/staging/rt2860/sta/assoc.c b/drivers/staging/rt2860/sta/assoc.c index 733bc083a6a7..7055f229e511 100644 --- a/drivers/staging/rt2860/sta/assoc.c +++ b/drivers/staging/rt2860/sta/assoc.c @@ -563,7 +563,7 @@ void MlmeAssocReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem * pAd->Mlme.AssocMachine.CurrState = ASSOC_WAIT_RSP; } else { DBGPRINT(RT_DEBUG_TRACE, - ("ASSOC - MlmeAssocReqAction() sanity check failed. BUG!!!!!! \n")); + ("ASSOC - MlmeAssocReqAction() sanity check failed. BUG!\n")); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; Status = MLME_INVALID_FORMAT; MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_ASSOC_CONF, 2, @@ -746,7 +746,7 @@ void MlmeReassocReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem pAd->Mlme.AssocMachine.CurrState = REASSOC_WAIT_RSP; } else { DBGPRINT(RT_DEBUG_TRACE, - ("ASSOC - MlmeReassocReqAction() sanity check failed. BUG!!!! \n")); + ("ASSOC - MlmeReassocReqAction() sanity check failed. BUG!\n")); pAd->Mlme.AssocMachine.CurrState = ASSOC_IDLE; Status = MLME_INVALID_FORMAT; MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_REASSOC_CONF, 2, diff --git a/drivers/staging/rt2860/sta/connect.c b/drivers/staging/rt2860/sta/connect.c index 9c7752076b00..17e59ba3d807 100644 --- a/drivers/staging/rt2860/sta/connect.c +++ b/drivers/staging/rt2860/sta/connect.c @@ -214,7 +214,7 @@ void MlmeCntlMachinePerformAction(struct rt_rtmp_adapter *pAd, break; #endif /* RTMP_MAC_USB // */ default: - DBGPRINT_ERR(("!ERROR! CNTL - Illegal message type(=%ld)", + DBGPRINT_ERR(("ERROR! CNTL - Illegal message type(=%ld)", Elem->MsgType)); break; } @@ -911,7 +911,7 @@ void CntlWaitStartProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *E pAd->CommonCfg.Bssid[5])); } else { DBGPRINT(RT_DEBUG_TRACE, - ("CNTL - Start IBSS fail. BUG!!!!!\n")); + ("CNTL - Start IBSS fail. BUG!\n")); pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; } } @@ -1184,7 +1184,7 @@ void LinkUp(struct rt_rtmp_adapter *pAd, u8 BssType) /* */ /* ASSOC - DisassocTimeoutAction */ /* CNTL - Dis-associate successful */ - /* !!! LINK DOWN !!! */ + /* ! LINK DOWN ! */ /* [88888] OID_802_11_SSID should have returned NDTEST_WEP_AP2(Returned: ) */ /* */ /* To prevent DisassocTimeoutAction to call Link down after we link up, */ @@ -1218,12 +1218,12 @@ void LinkUp(struct rt_rtmp_adapter *pAd, u8 BssType) if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED) AdhocTurnOnQos(pAd); - DBGPRINT(RT_DEBUG_TRACE, ("!!!Adhoc LINK UP !!! \n")); + DBGPRINT(RT_DEBUG_TRACE, ("Adhoc LINK UP!\n")); } else { OPSTATUS_SET_FLAG(pAd, fOP_STATUS_INFRA_ON); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_ADHOC_ON); - DBGPRINT(RT_DEBUG_TRACE, ("!!!Infra LINK UP !!! \n")); + DBGPRINT(RT_DEBUG_TRACE, ("Infra LINK UP!\n")); } /* 3*3 */ @@ -1262,11 +1262,11 @@ void LinkUp(struct rt_rtmp_adapter *pAd, u8 BssType) RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x1A); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x0A); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x16); - DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n")); + DBGPRINT(RT_DEBUG_TRACE, ("rt2860C !\n")); } DBGPRINT(RT_DEBUG_TRACE, - ("!!!40MHz Lower LINK UP !!! Control Channel at Below. Central = %d \n", + ("40MHz Lower LINK UP! Control Channel at Below. Central = %d \n", pAd->CommonCfg.CentralChannel)); } else if ((pAd->CommonCfg.CentralChannel < pAd->CommonCfg.Channel) && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == @@ -1296,11 +1296,11 @@ void LinkUp(struct rt_rtmp_adapter *pAd, u8 BssType) RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x1A); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x0A); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x16); - DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n")); + DBGPRINT(RT_DEBUG_TRACE, ("rt2860C !\n")); } DBGPRINT(RT_DEBUG_TRACE, - ("!!! 40MHz Upper LINK UP !!! Control Channel at UpperCentral = %d \n", + ("40MHz Upper LINK UP! Control Channel at UpperCentral = %d \n", pAd->CommonCfg.CentralChannel)); } else { pAd->CommonCfg.BBPCurrentBW = BW_20; @@ -1327,10 +1327,10 @@ void LinkUp(struct rt_rtmp_adapter *pAd, u8 BssType) RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x16); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R70, 0x08); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R73, 0x11); - DBGPRINT(RT_DEBUG_TRACE, ("!!!rt2860C !!! \n")); + DBGPRINT(RT_DEBUG_TRACE, ("rt2860C !\n")); } - DBGPRINT(RT_DEBUG_TRACE, ("!!! 20MHz LINK UP !!! \n")); + DBGPRINT(RT_DEBUG_TRACE, ("20MHz LINK UP!\n")); } RTMPSetAGCInitValue(pAd, pAd->CommonCfg.BBPCurrentBW); @@ -1342,12 +1342,12 @@ void LinkUp(struct rt_rtmp_adapter *pAd, u8 BssType) &pAd->BbpTuning.R66CurrentValue); DBGPRINT(RT_DEBUG_TRACE, - ("!!! LINK UP !!! (BssType=%d, AID=%d, ssid=%s, Channel=%d, CentralChannel = %d)\n", + ("LINK UP! (BssType=%d, AID=%d, ssid=%s, Channel=%d, CentralChannel = %d)\n", BssType, pAd->StaActive.Aid, pAd->CommonCfg.Ssid, pAd->CommonCfg.Channel, pAd->CommonCfg.CentralChannel)); DBGPRINT(RT_DEBUG_TRACE, - ("!!! LINK UP !!! (Density =%d, )\n", + ("LINK UP! (Density =%d, )\n", pAd->MacTab.Content[BSSID_WCID].MpduDensity)); AsicSetBssid(pAd, pAd->CommonCfg.Bssid); @@ -1634,13 +1634,13 @@ void LinkUp(struct rt_rtmp_adapter *pAd, u8 BssType) NdisReleaseSpinLock(&pAd->MacTabLock); DBGPRINT(RT_DEBUG_TRACE, - ("!!! LINK UP !!! ClientStatusFlags=%lx)\n", + ("LINK UP! ClientStatusFlags=%lx)\n", pAd->MacTab.Content[BSSID_WCID].ClientStatusFlags)); MlmeUpdateTxRates(pAd, TRUE, BSS0); MlmeUpdateHtTxRates(pAd, BSS0); DBGPRINT(RT_DEBUG_TRACE, - ("!!! LINK UP !! (StaActive.bHtEnable =%d, )\n", + ("LINK UP! (StaActive.bHtEnable =%d, )\n", pAd->StaActive.SupportedPhyInfo.bHtEnable)); if (pAd->CommonCfg.bAggregationCapable) { @@ -1811,7 +1811,7 @@ void LinkUp(struct rt_rtmp_adapter *pAd, u8 BssType) pAd->CommonCfg.IOTestParm.bLastAtheros = FALSE; COPY_MAC_ADDR(pAd->CommonCfg.LastBssid, pAd->CommonCfg.Bssid); DBGPRINT(RT_DEBUG_TRACE, - ("!!!pAd->bNextDisableRxBA= %d \n", + ("pAd->bNextDisableRxBA= %d \n", pAd->CommonCfg.IOTestParm.bNextDisableRxBA)); /* BSSID add in one MAC entry too. Because in Tx, ASIC need to check Cipher and IV/EIV, BAbitmap */ /* Pther information in MACTab.Content[BSSID_WCID] is not necessary for driver. */ @@ -1893,7 +1893,7 @@ void LinkDown(struct rt_rtmp_adapter *pAd, IN BOOLEAN IsReqFromAP) BSS0, 0); } - DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK DOWN !!!\n")); + DBGPRINT(RT_DEBUG_TRACE, ("LINK DOWN!\n")); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_AGGREGATION_INUSED); #ifdef RTMP_MAC_PCI @@ -1921,7 +1921,7 @@ void LinkDown(struct rt_rtmp_adapter *pAd, IN BOOLEAN IsReqFromAP) if (ADHOC_ON(pAd)) /* Adhoc mode link down */ { - DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK DOWN 1!!!\n")); + DBGPRINT(RT_DEBUG_TRACE, ("LINK DOWN 1!\n")); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_ADHOC_ON); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); @@ -1931,10 +1931,10 @@ void LinkDown(struct rt_rtmp_adapter *pAd, IN BOOLEAN IsReqFromAP) BssTableDeleteEntry(&pAd->ScanTab, pAd->CommonCfg.Bssid, pAd->CommonCfg.Channel); DBGPRINT(RT_DEBUG_TRACE, - ("!!! MacTab.Size=%d !!!\n", pAd->MacTab.Size)); + (" MacTab.Size=%d !\n", pAd->MacTab.Size)); } else /* Infra structure mode */ { - DBGPRINT(RT_DEBUG_TRACE, ("!!! LINK DOWN 2!!!\n")); + DBGPRINT(RT_DEBUG_TRACE, ("LINK DOWN 2!\n")); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_INFRA_ON); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED); diff --git a/drivers/staging/rt2860/sta/rtmp_data.c b/drivers/staging/rt2860/sta/rtmp_data.c index 8c0ab2df0011..c50394759079 100644 --- a/drivers/staging/rt2860/sta/rtmp_data.c +++ b/drivers/staging/rt2860/sta/rtmp_data.c @@ -192,7 +192,7 @@ void STARxEAPOLFrameIndicate(struct rt_rtmp_adapter *pAd, pRxWI->RSSI1, pRxWI->RSSI2, pRxD->PlcpSignal); DBGPRINT_RAW(RT_DEBUG_TRACE, - ("!!! report EAPOL/AIRONET DATA to MLME (len=%d) !!!\n", + ("report EAPOL/AIRONET DATA to MLME (len=%d) !\n", pRxBlk->DataSize)); } } @@ -940,7 +940,7 @@ int STASendPacket(struct rt_rtmp_adapter *pAd, void *pPacket) if (pSrcBufVA == NULL) { DBGPRINT(RT_DEBUG_ERROR, - ("STASendPacket --> pSrcBufVA == NULL !!!SrcBufLen=%x\n", + ("STASendPacket --> pSrcBufVA == NULL !SrcBufLen=%x\n", SrcBufLen)); /* Resourece is low, system did not allocate virtual address */ /* return NDIS_STATUS_FAILURE directly to upper layer */ @@ -950,7 +950,7 @@ int STASendPacket(struct rt_rtmp_adapter *pAd, void *pPacket) if (SrcBufLen < 14) { DBGPRINT(RT_DEBUG_ERROR, - ("STASendPacket --> Ndis Packet buffer error !!!\n")); + ("STASendPacket --> Ndis Packet buffer error!\n")); RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); return (NDIS_STATUS_FAILURE); } @@ -1007,7 +1007,7 @@ int STASendPacket(struct rt_rtmp_adapter *pAd, void *pPacket) && (RTMP_GET_PACKET_EAPOL(pPacket) == FALSE) ) { DBGPRINT(RT_DEBUG_TRACE, - ("STASendPacket --> Drop packet before port secured !!!\n")); + ("STASendPacket --> Drop packet before port secured!\n")); RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); return (NDIS_STATUS_FAILURE); @@ -1680,7 +1680,7 @@ void STA_AMPDU_Frame_Tx(struct rt_rtmp_adapter *pAd, struct rt_tx_blk *pTxBlk) pMacEntry = pTxBlk->pMacEntry; if (pMacEntry->isCached) { - /* NOTE: Please make sure the size of pMacEntry->CachedBuf[] is smaller than pTxBlk->HeaderBuf[]!!!! */ + /* NOTE: Please make sure the size of pMacEntry->CachedBuf[] is smaller than pTxBlk->HeaderBuf[]! */ NdisMoveMemory((u8 *)& pTxBlk-> HeaderBuf[TXINFO_SIZE], (u8 *)& pMacEntry->CachedBuf[0], @@ -2506,7 +2506,7 @@ int STAHardTransmit(struct rt_rtmp_adapter *pAd, { /* It should not happened! */ DBGPRINT(RT_DEBUG_ERROR, - ("Send a pacekt was not classified!! It should not happen!\n")); + ("Send a packet was not classified! It should not happen!\n")); while (pTxBlk->TxPacketList.Number) { pQEntry = RemoveHeadQueue(&pTxBlk->TxPacketList); diff --git a/drivers/staging/rt2860/sta/sanity.c b/drivers/staging/rt2860/sta/sanity.c index 64a0e8739048..8f9fd19be151 100644 --- a/drivers/staging/rt2860/sta/sanity.c +++ b/drivers/staging/rt2860/sta/sanity.c @@ -150,7 +150,7 @@ BOOLEAN PeerAssocRspSanity(struct rt_rtmp_adapter *pAd, void * pMsg, unsigned lo case IE_HT_CAP: case IE_HT_CAP2: - if (pEid->Len >= SIZE_HT_CAP_IE) /*Note: allow extension.!! */ + if (pEid->Len >= SIZE_HT_CAP_IE) /*Note: allow extension! */ { NdisMoveMemory(pHtCapability, pEid->Octet, SIZE_HT_CAP_IE); diff --git a/drivers/staging/rt2860/sta_ioctl.c b/drivers/staging/rt2860/sta_ioctl.c index 04f81bdeb0c8..d8fbe6cc6941 100644 --- a/drivers/staging/rt2860/sta_ioctl.c +++ b/drivers/staging/rt2860/sta_ioctl.c @@ -600,7 +600,7 @@ int rt_ioctl_siwap(struct net_device *dev, if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) { RTMP_MLME_RESET_STATE_MACHINE(pAdapter); DBGPRINT(RT_DEBUG_TRACE, - ("!!! MLME busy, reset MLME state machine !!!\n")); + ("MLME busy, reset MLME state machine!\n")); } /* tell CNTL state machine to call NdisMSetInformationComplete() after completing */ /* this request, because this request is initiated by NDIS. */ @@ -741,7 +741,7 @@ int rt_ioctl_siwscan(struct net_device *dev, if (MONITOR_ON(pAdapter)) { DBGPRINT(RT_DEBUG_TRACE, - ("!!! Driver is in Monitor Mode now !!!\n")); + ("Driver is in Monitor Mode now!\n")); return -EINVAL; } @@ -758,7 +758,7 @@ int rt_ioctl_siwscan(struct net_device *dev, if ((pAdapter->StaCfg.WpaSupplicantUP == WPA_SUPPLICANT_ENABLE) && (pAdapter->StaCfg.WpaSupplicantScanCount > 3)) { DBGPRINT(RT_DEBUG_TRACE, - ("!!! WpaSupplicantScanCount > 3\n")); + ("WpaSupplicantScanCount > 3\n")); Status = NDIS_STATUS_SUCCESS; break; } @@ -771,7 +771,7 @@ int rt_ioctl_siwscan(struct net_device *dev, && (pAdapter->StaCfg.PortSecured == WPA_802_1X_PORT_NOT_SECURED)) { DBGPRINT(RT_DEBUG_TRACE, - ("!!! Link UP, Port Not Secured! ignore this set::OID_802_11_BSSID_LIST_SCAN\n")); + ("Link UP, Port Not Secured! ignore this set::OID_802_11_BSSID_LIST_SCAN\n")); Status = NDIS_STATUS_SUCCESS; break; } @@ -779,7 +779,7 @@ int rt_ioctl_siwscan(struct net_device *dev, if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) { RTMP_MLME_RESET_STATE_MACHINE(pAdapter); DBGPRINT(RT_DEBUG_TRACE, - ("!!! MLME busy, reset MLME state machine !!!\n")); + ("MLME busy, reset MLME state machine!\n")); } /* tell CNTL state machine to call NdisMSetInformationComplete() after completing */ /* this request, because this request is initiated by NDIS. */ @@ -2256,7 +2256,7 @@ int rt_ioctl_siwpmksa(struct net_device *dev, break; default: DBGPRINT(RT_DEBUG_TRACE, - ("rt_ioctl_siwpmksa - Unknow Command!!\n")); + ("rt_ioctl_siwpmksa - Unknown Command!\n")); break; } @@ -2664,7 +2664,7 @@ int Set_SSID_Proc(struct rt_rtmp_adapter *pAdapter, char *arg) if (pAdapter->Mlme.CntlMachine.CurrState != CNTL_IDLE) { RTMP_MLME_RESET_STATE_MACHINE(pAdapter); DBGPRINT(RT_DEBUG_TRACE, - ("!!! MLME busy, reset MLME state machine !!!\n")); + ("MLME busy, reset MLME state machine!\n")); } if ((pAdapter->StaCfg.WpaPassPhraseLen >= 8) && diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c index c1d1fb535a37..925a236e1044 100644 --- a/drivers/staging/rt2860/usb_main_dev.c +++ b/drivers/staging/rt2860/usb_main_dev.c @@ -584,7 +584,7 @@ void RTUSBWatchDog(struct rt_rtmp_adapter *pAd) RTMP_IO_READ32(pAd, TXRXQ_PCNT, &MACValue); if ((MACValue & 0xff) != 0) { DBGPRINT(RT_DEBUG_TRACE, - ("TX QUEUE 0 Not EMPTY(Value=0x%0x). !!!!!!!!!!!!!!!\n", + ("TX QUEUE 0 Not EMPTY(Value=0x%0x)!\n", MACValue)); RTMP_IO_WRITE32(pAd, PBF_CFG, 0xf40012); while ((MACValue & 0xff) != 0 && (idx++ < 10)) { @@ -707,7 +707,7 @@ void RTUSBWatchDog(struct rt_rtmp_adapter *pAd) } } else { DBGPRINT(RT_DEBUG_ERROR, - ("Unkonw bulkOut URB maybe hanged!!!!!!!!!!!!\n")); + ("Unknown bulkOut URB maybe hanged!\n")); } } else { RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[idx], -- GitLab From cdbf3a394ca2f6e3464bc19676e959a92a725eb0 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Mon, 9 Nov 2009 17:20:39 +0100 Subject: [PATCH 201/235] Staging: rt28x0: remove no longer needed common/cmm_data_2860.c Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/common/cmm_data_2860.c | 1199 ----------------- 1 file changed, 1199 deletions(-) delete mode 100644 drivers/staging/rt2860/common/cmm_data_2860.c diff --git a/drivers/staging/rt2860/common/cmm_data_2860.c b/drivers/staging/rt2860/common/cmm_data_2860.c deleted file mode 100644 index d3ae7ca5a700..000000000000 --- a/drivers/staging/rt2860/common/cmm_data_2860.c +++ /dev/null @@ -1,1199 +0,0 @@ -/* - ************************************************************************* - * Ralink Tech Inc. - * 5F., No.36, Taiyuan St., Jhubei City, - * Hsinchu County 302, - * Taiwan, R.O.C. - * - * (c) Copyright 2002-2007, Ralink Technology, Inc. - * - * 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * * - ************************************************************************* -*/ - -/* - All functions in this file must be PCI-depended, or you should out your function - in other files. - -*/ -#include "../rt_config.h" - -extern RTMP_RF_REGS RF2850RegTable[]; -extern UCHAR NUM_OF_2850_CHNL; - -USHORT RtmpPCI_WriteTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN BOOLEAN bIsLast, - OUT USHORT *FreeNumber) -{ - - UCHAR *pDMAHeaderBufVA; - USHORT TxIdx, RetTxIdx; - PTXD_STRUC pTxD; - UINT32 BufBasePaLow; - PRTMP_TX_RING pTxRing; - USHORT hwHeaderLen; - - // - // get Tx Ring Resource - // - pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; - TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; - pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; - BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); - - // copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer - if (pTxBlk->TxFrameType == TX_AMSDU_FRAME) - { - hwHeaderLen = pTxBlk->MpduHeaderLen - LENGTH_AMSDU_SUBFRAMEHEAD + pTxBlk->HdrPadLen + LENGTH_AMSDU_SUBFRAMEHEAD; - } - else - { - hwHeaderLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; - } - NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, TXINFO_SIZE + TXWI_SIZE + hwHeaderLen); - - pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket; - pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; - - // - // build Tx Descriptor - // - - pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; - NdisZeroMemory(pTxD, TXD_SIZE); - - pTxD->SDPtr0 = BufBasePaLow; - pTxD->SDLen0 = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; // include padding - pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE);; - pTxD->SDLen1 = pTxBlk->SrcBufLen; - pTxD->LastSec0 = 0; - pTxD->LastSec1 = (bIsLast) ? 1 : 0; - - RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); - - RetTxIdx = TxIdx; - // - // Update Tx index - // - INC_RING_INDEX(TxIdx, TX_RING_SIZE); - pTxRing->TxCpuIdx = TxIdx; - - *FreeNumber -= 1; - - return RetTxIdx; -} - - -USHORT RtmpPCI_WriteSingleTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN BOOLEAN bIsLast, - OUT USHORT *FreeNumber) -{ - - UCHAR *pDMAHeaderBufVA; - USHORT TxIdx, RetTxIdx; - PTXD_STRUC pTxD; - UINT32 BufBasePaLow; - PRTMP_TX_RING pTxRing; - USHORT hwHeaderLen; - - // - // get Tx Ring Resource - // - pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; - TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; - pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; - BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); - - // copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer - hwHeaderLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; - - NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, TXINFO_SIZE + TXWI_SIZE + hwHeaderLen); - - pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket; - pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; - - // - // build Tx Descriptor - // - pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; - - NdisZeroMemory(pTxD, TXD_SIZE); - - pTxD->SDPtr0 = BufBasePaLow; - pTxD->SDLen0 = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; // include padding - pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE);; - pTxD->SDLen1 = pTxBlk->SrcBufLen; - pTxD->LastSec0 = 0; - pTxD->LastSec1 = (bIsLast) ? 1 : 0; - - RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); - - RetTxIdx = TxIdx; - // - // Update Tx index - // - INC_RING_INDEX(TxIdx, TX_RING_SIZE); - pTxRing->TxCpuIdx = TxIdx; - - *FreeNumber -= 1; - - return RetTxIdx; -} - - -USHORT RtmpPCI_WriteMultiTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR frameNum, - OUT USHORT *FreeNumber) -{ - BOOLEAN bIsLast; - UCHAR *pDMAHeaderBufVA; - USHORT TxIdx, RetTxIdx; - PTXD_STRUC pTxD; - UINT32 BufBasePaLow; - PRTMP_TX_RING pTxRing; - USHORT hwHdrLen; - UINT32 firstDMALen; - - bIsLast = ((frameNum == (pTxBlk->TotalFrameNum - 1)) ? 1 : 0); - - // - // get Tx Ring Resource - // - pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; - TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; - pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; - BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); - - if (frameNum == 0) - { - // copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer - if (pTxBlk->TxFrameType == TX_AMSDU_FRAME) - //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_AMSDU_SUBFRAMEHEAD, 4)+LENGTH_AMSDU_SUBFRAMEHEAD; - hwHdrLen = pTxBlk->MpduHeaderLen - LENGTH_AMSDU_SUBFRAMEHEAD + pTxBlk->HdrPadLen + LENGTH_AMSDU_SUBFRAMEHEAD; - else if (pTxBlk->TxFrameType == TX_RALINK_FRAME) - //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen-LENGTH_ARALINK_HEADER_FIELD, 4)+LENGTH_ARALINK_HEADER_FIELD; - hwHdrLen = pTxBlk->MpduHeaderLen - LENGTH_ARALINK_HEADER_FIELD + pTxBlk->HdrPadLen + LENGTH_ARALINK_HEADER_FIELD; - else - //hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); - hwHdrLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; - - firstDMALen = TXINFO_SIZE + TXWI_SIZE + hwHdrLen; - } - else - { - firstDMALen = pTxBlk->MpduHeaderLen; - } - - NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, firstDMALen); - - pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket; - pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; - - // - // build Tx Descriptor - // - pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; - - NdisZeroMemory(pTxD, TXD_SIZE); - - pTxD->SDPtr0 = BufBasePaLow; - pTxD->SDLen0 = firstDMALen; // include padding - pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE);; - pTxD->SDLen1 = pTxBlk->SrcBufLen; - pTxD->LastSec0 = 0; - pTxD->LastSec1 = (bIsLast) ? 1 : 0; - - RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); - - RetTxIdx = TxIdx; - // - // Update Tx index - // - INC_RING_INDEX(TxIdx, TX_RING_SIZE); - pTxRing->TxCpuIdx = TxIdx; - - *FreeNumber -= 1; - - return RetTxIdx; - -} - - -VOID RtmpPCI_FinalWriteTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN USHORT totalMPDUSize, - IN USHORT FirstTxIdx) -{ - - PTXWI_STRUC pTxWI; - PRTMP_TX_RING pTxRing; - - // - // get Tx Ring Resource - // - pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; - pTxWI = (PTXWI_STRUC) pTxRing->Cell[FirstTxIdx].DmaBuf.AllocVa; - pTxWI->MPDUtotalByteCount = totalMPDUSize; -} - - -VOID RtmpPCIDataLastTxIdx( - IN PRTMP_ADAPTER pAd, - IN UCHAR QueIdx, - IN USHORT LastTxIdx) -{ - PTXD_STRUC pTxD; - PRTMP_TX_RING pTxRing; - - // - // get Tx Ring Resource - // - pTxRing = &pAd->TxRing[QueIdx]; - - // - // build Tx Descriptor - // - pTxD = (PTXD_STRUC) pTxRing->Cell[LastTxIdx].AllocVa; - - pTxD->LastSec1 = 1; -} - - -USHORT RtmpPCI_WriteFragTxResource( - IN PRTMP_ADAPTER pAd, - IN TX_BLK *pTxBlk, - IN UCHAR fragNum, - OUT USHORT *FreeNumber) -{ - UCHAR *pDMAHeaderBufVA; - USHORT TxIdx, RetTxIdx; - PTXD_STRUC pTxD; - UINT32 BufBasePaLow; - PRTMP_TX_RING pTxRing; - USHORT hwHeaderLen; - UINT32 firstDMALen; - - // - // Get Tx Ring Resource - // - pTxRing = &pAd->TxRing[pTxBlk->QueIdx]; - TxIdx = pAd->TxRing[pTxBlk->QueIdx].TxCpuIdx; - pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa; - BufBasePaLow = RTMP_GetPhysicalAddressLow(pTxRing->Cell[TxIdx].DmaBuf.AllocPa); - - // - // Copy TXINFO + TXWI + WLAN Header + LLC into DMA Header Buffer - // - hwHeaderLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen; - - firstDMALen = TXINFO_SIZE + TXWI_SIZE + hwHeaderLen; - NdisMoveMemory(pDMAHeaderBufVA, pTxBlk->HeaderBuf, firstDMALen); - - - // - // Build Tx Descriptor - // - pTxD = (PTXD_STRUC) pTxRing->Cell[TxIdx].AllocVa; - - NdisZeroMemory(pTxD, TXD_SIZE); - - if (fragNum == pTxBlk->TotalFragNum) - { - pTxRing->Cell[TxIdx].pNdisPacket = pTxBlk->pPacket; - pTxRing->Cell[TxIdx].pNextNdisPacket = NULL; - } - - pTxD->SDPtr0 = BufBasePaLow; - pTxD->SDLen0 = firstDMALen; // include padding - pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, pTxBlk, 0, 1, PCI_DMA_TODEVICE); - pTxD->SDLen1 = pTxBlk->SrcBufLen; - pTxD->LastSec0 = 0; - pTxD->LastSec1 = 1; - - RTMPWriteTxDescriptor(pAd, pTxD, FALSE, FIFO_EDCA); - - RetTxIdx = TxIdx; - pTxBlk->Priv += pTxBlk->SrcBufLen; - - // - // Update Tx index - // - INC_RING_INDEX(TxIdx, TX_RING_SIZE); - pTxRing->TxCpuIdx = TxIdx; - - *FreeNumber -= 1; - - return RetTxIdx; - -} - -/* - Must be run in Interrupt context - This function handle PCI specific TxDesc and cpu index update and kick the packet out. - */ -int RtmpPCIMgmtKickOut( - IN RTMP_ADAPTER *pAd, - IN UCHAR QueIdx, - IN PNDIS_PACKET pPacket, - IN PUCHAR pSrcBufVA, - IN UINT SrcBufLen) -{ - PTXD_STRUC pTxD; - ULONG SwIdx = pAd->MgmtRing.TxCpuIdx; - - pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[SwIdx].AllocVa; - if (!pTxD) - return 0; - - pAd->MgmtRing.Cell[SwIdx].pNdisPacket = pPacket; - pAd->MgmtRing.Cell[SwIdx].pNextNdisPacket = NULL; - - RTMPWriteTxDescriptor(pAd, pTxD, TRUE, FIFO_MGMT); - pTxD->LastSec0 = 1; - pTxD->LastSec1 = 1; - pTxD->DMADONE = 0; - pTxD->SDLen1 = 0; - pTxD->SDPtr0 = PCI_MAP_SINGLE(pAd, pSrcBufVA, SrcBufLen, 0, PCI_DMA_TODEVICE);; - pTxD->SDLen0 = SrcBufLen; - - pAd->RalinkCounters.KickTxCount++; - pAd->RalinkCounters.OneSecTxDoneCount++; - - // Increase TX_CTX_IDX, but write to register later. - INC_RING_INDEX(pAd->MgmtRing.TxCpuIdx, MGMT_RING_SIZE); - - RTMP_IO_WRITE32(pAd, TX_MGMTCTX_IDX, pAd->MgmtRing.TxCpuIdx); - - return 0; -} - -/* - ======================================================================== - - Routine Description: - Check Rx descriptor, return NDIS_STATUS_FAILURE if any error dound - - Arguments: - pRxD Pointer to the Rx descriptor - - Return Value: - NDIS_STATUS_SUCCESS No err - NDIS_STATUS_FAILURE Error - - Note: - - ======================================================================== -*/ -NDIS_STATUS RTMPCheckRxError( - IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHeader, - IN PRXWI_STRUC pRxWI, - IN PRT28XX_RXD_STRUC pRxD) -{ - PCIPHER_KEY pWpaKey; - INT dBm; - - // Phy errors & CRC errors - if (/*(pRxD->PhyErr) ||*/ (pRxD->Crc)) - { - // Check RSSI for Noise Hist statistic collection. - dBm = (INT) (pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta; - if (dBm <= -87) - pAd->StaCfg.RPIDensity[0] += 1; - else if (dBm <= -82) - pAd->StaCfg.RPIDensity[1] += 1; - else if (dBm <= -77) - pAd->StaCfg.RPIDensity[2] += 1; - else if (dBm <= -72) - pAd->StaCfg.RPIDensity[3] += 1; - else if (dBm <= -67) - pAd->StaCfg.RPIDensity[4] += 1; - else if (dBm <= -62) - pAd->StaCfg.RPIDensity[5] += 1; - else if (dBm <= -57) - pAd->StaCfg.RPIDensity[6] += 1; - else if (dBm > -57) - pAd->StaCfg.RPIDensity[7] += 1; - - return(NDIS_STATUS_FAILURE); - } - - // Add Rx size to channel load counter, we should ignore error counts - pAd->StaCfg.CLBusyBytes += (pRxD->SDL0 + 14); - - // Drop ToDs promiscous frame, it is opened due to CCX 2 channel load statistics - if (pHeader != NULL) - { - if (pHeader->FC.ToDs) - { - return(NDIS_STATUS_FAILURE); - } - } - - // Drop not U2M frames, cant's drop here because we will drop beacon in this case - // I am kind of doubting the U2M bit operation - // if (pRxD->U2M == 0) - // return(NDIS_STATUS_FAILURE); - - // drop decyption fail frame - if (pRxD->CipherErr) - { - if (pRxD->CipherErr == 2) - {DBGPRINT_RAW(RT_DEBUG_TRACE,("pRxD ERROR: ICV ok but MICErr "));} - else if (pRxD->CipherErr == 1) - {DBGPRINT_RAW(RT_DEBUG_TRACE,("pRxD ERROR: ICV Err "));} - else if (pRxD->CipherErr == 3) - DBGPRINT_RAW(RT_DEBUG_TRACE,("pRxD ERROR: Key not valid ")); - - if (((pRxD->CipherErr & 1) == 1) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) - RTMPSendWirelessEvent(pAd, IW_ICV_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - - DBGPRINT_RAW(RT_DEBUG_TRACE,(" %d (len=%d, Mcast=%d, MyBss=%d, Wcid=%d, KeyId=%d)\n", - pRxD->CipherErr, - pRxD->SDL0, - pRxD->Mcast | pRxD->Bcast, - pRxD->MyBss, - pRxWI->WirelessCliID, - pRxWI->KeyIndex)); - - // - // MIC Error - // - if (pRxD->CipherErr == 2) - { - pWpaKey = &pAd->SharedKey[BSS0][pRxWI->KeyIndex]; - - if (pAd->StaCfg.WpaSupplicantUP) - WpaSendMicFailureToWpaSupplicant(pAd, - (pWpaKey->Type == PAIRWISEKEY) ? TRUE:FALSE); - else - RTMPReportMicError(pAd, pWpaKey); - - if (((pRxD->CipherErr & 2) == 2) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) - RTMPSendWirelessEvent(pAd, IW_MIC_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); - - DBGPRINT_RAW(RT_DEBUG_ERROR,("Rx MIC Value error\n")); - } - - if (pHeader == NULL) - return(NDIS_STATUS_SUCCESS); - - return(NDIS_STATUS_FAILURE); - } - - return(NDIS_STATUS_SUCCESS); -} - -/* - ========================================================================== - Description: - This routine sends command to firmware and turn our chip to power save mode. - Both RadioOff and .11 power save function needs to call this routine. - Input: - Level = GUIRADIO_OFF : GUI Radio Off mode - Level = DOT11POWERSAVE : 802.11 power save mode - Level = RTMP_HALT : When Disable device. - - ========================================================================== - */ -VOID RT28xxPciAsicRadioOff( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level, - IN USHORT TbttNumToNextWakeUp) -{ - WPDMA_GLO_CFG_STRUC DmaCfg; - UCHAR i, tempBBP_R3 = 0; - BOOLEAN brc = FALSE, Cancelled; - UINT32 TbTTTime = 0; - UINT32 PsPollTime = 0, MACValue; - ULONG BeaconPeriodTime; - UINT32 RxDmaIdx, RxCpuIdx; - DBGPRINT(RT_DEBUG_TRACE, ("AsicRadioOff ===> TxCpuIdx = %d, TxDmaIdx = %d. RxCpuIdx = %d, RxDmaIdx = %d.\n", pAd->TxRing[0].TxCpuIdx, pAd->TxRing[0].TxDmaIdx, pAd->RxRing.RxCpuIdx, pAd->RxRing.RxDmaIdx)); - - // Check Rx DMA busy status, if more than half is occupied, give up this radio off. - RTMP_IO_READ32(pAd, RX_DRX_IDX , &RxDmaIdx); - RTMP_IO_READ32(pAd, RX_CRX_IDX , &RxCpuIdx); - if ((RxDmaIdx > RxCpuIdx) && ((RxDmaIdx - RxCpuIdx) > RX_RING_SIZE/3)) - { - DBGPRINT(RT_DEBUG_TRACE, ("AsicRadioOff ===> return1. RxDmaIdx = %d , RxCpuIdx = %d. \n", RxDmaIdx, RxCpuIdx)); - return; - } - else if ((RxCpuIdx >= RxDmaIdx) && ((RxCpuIdx - RxDmaIdx) < RX_RING_SIZE/3)) - { - DBGPRINT(RT_DEBUG_TRACE, ("AsicRadioOff ===> return2. RxCpuIdx = %d. RxDmaIdx = %d , \n", RxCpuIdx, RxDmaIdx)); - return; - } - - // Once go into this function, disable tx because don't want too many packets in queue to prevent HW stops. - RTMP_SET_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); - - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) - { - RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - - if (Level == DOT11POWERSAVE) - { - RTMP_IO_READ32(pAd, TBTT_TIMER, &TbTTTime); - TbTTTime &= 0x1ffff; - // 00. check if need to do sleep in this DTIM period. If next beacon will arrive within 30ms , ...doesn't necessarily sleep. - // TbTTTime uint = 64us, LEAD_TIME unit = 1024us, PsPollTime unit = 1ms - if (((64*TbTTTime) <((LEAD_TIME*1024) + 40000)) && (TbttNumToNextWakeUp == 0)) - { - DBGPRINT(RT_DEBUG_TRACE, ("TbTTTime = 0x%x , give up this sleep. \n", TbTTTime)); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); - return; - } - else - { - PsPollTime = (64*TbTTTime- LEAD_TIME*1024)/1000; - PsPollTime -= 3; - - BeaconPeriodTime = pAd->CommonCfg.BeaconPeriod*102/100; - if (TbttNumToNextWakeUp > 0) - PsPollTime += ((TbttNumToNextWakeUp -1) * BeaconPeriodTime); - - pAd->Mlme.bPsPollTimerRunning = TRUE; - RTMPSetTimer(&pAd->Mlme.PsPollTimer, PsPollTime); - } - } - } - - // 0. Disable Tx DMA. - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &DmaCfg.word); - DmaCfg.field.EnableTxDMA = 0; - RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, DmaCfg.word); - - // 1. Wait DMA not busy - i = 0; - do - { - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &DmaCfg.word); - if ((DmaCfg.field.TxDMABusy == 0) && (DmaCfg.field.RxDMABusy == 0)) - break; - RTMPusecDelay(20); - i++; - }while(i < 50); - - if (i >= 50) - { - DBGPRINT(RT_DEBUG_TRACE, ("DMA keeps busy. return on RT28xxPciAsicRadioOff ()\n")); - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &DmaCfg.word); - DmaCfg.field.EnableTxDMA = 1; - RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, DmaCfg.word); - pAd->CheckDmaBusyCount++; - return; - } - else - { - pAd->CheckDmaBusyCount = 0; - } - - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); - - // Set to 1R. - if (pAd->Antenna.field.RxPath > 1) - { - tempBBP_R3 = (pAd->StaCfg.BBPR3 & 0xE7); - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, tempBBP_R3); - } - - // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. - if (INFRA_ON(pAd) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) - && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - // Must using 40MHz. - AsicTurnOffRFClk(pAd, pAd->CommonCfg.CentralChannel); - } - else - { - // Must using 20MHz. - AsicTurnOffRFClk(pAd, pAd->CommonCfg.Channel); - } - - if (Level != RTMP_HALT) - { - // Change Interrupt bitmask. - RTMP_IO_WRITE32(pAd, INT_MASK_CSR, AutoWakeupInt); - } - else - { - NICDisableInterrupt(pAd); - } - - RTMP_IO_WRITE32(pAd, RX_CRX_IDX, pAd->RxRing.RxCpuIdx); - // Disable MAC Rx - RTMP_IO_READ32(pAd, MAC_SYS_CTRL , &MACValue); - MACValue &= 0xf7; - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL , MACValue); - - // 2. Send Sleep command - RTMP_IO_WRITE32(pAd, H2M_MAILBOX_STATUS, 0xffffffff); - RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CID, 0xffffffff); - // send POWER-SAVE command to MCU. high-byte = 1 save power as much as possible. high byte = 0 save less power - AsicSendCommandToMcu(pAd, 0x30, PowerSafeCID, 0xff, 0x1); - // 2-1. Wait command success - // Status = 1 : success, Status = 2, already sleep, Status = 3, Maybe MAC is busy so can't finish this task. - brc = AsicCheckCommanOk(pAd, PowerSafeCID); - - if (brc == FALSE) - { - // try again - AsicSendCommandToMcu(pAd, 0x30, PowerSafeCID, 0xff, 0x01); // send POWER-SAVE command to MCU. Timeout unit:40us. - //RTMPusecDelay(200); - brc = AsicCheckCommanOk(pAd, PowerSafeCID); - } - - // 3. After 0x30 command is ok, send radio off command. lowbyte = 0 for power safe. - // If 0x30 command is not ok this time, we can ignore 0x35 command. It will make sure not cause firmware'r problem. - if ((Level == DOT11POWERSAVE) && (brc == TRUE)) - { - AsicSendCommandToMcu(pAd, 0x35, PowerRadioOffCID, 0, 0x00); // lowbyte = 0 means to do power safe, NOT turn off radio. - // 3-1. Wait command success - AsicCheckCommanOk(pAd, PowerRadioOffCID); - } - else if (brc == TRUE) - { - AsicSendCommandToMcu(pAd, 0x35, PowerRadioOffCID, 1, 0x00); // lowbyte = 0 means to do power safe, NOT turn off radio. - // 3-1. Wait command success - AsicCheckCommanOk(pAd, PowerRadioOffCID); - } - - // Wait DMA not busy - i = 0; - do - { - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &DmaCfg.word); - if ((DmaCfg.field.RxDMABusy == 0) && (DmaCfg.field.TxDMABusy == 0)) - break; - RTMPusecDelay(20); - i++; - }while(i < 50); - - if (i >= 50) - { - pAd->CheckDmaBusyCount++; - DBGPRINT(RT_DEBUG_TRACE, ("DMA Rx keeps busy. on RT28xxPciAsicRadioOff ()\n")); - } - else - { - pAd->CheckDmaBusyCount = 0; - } - - if (Level == DOT11POWERSAVE) - { - AUTO_WAKEUP_STRUC AutoWakeupCfg; - //RTMPSetTimer(&pAd->Mlme.PsPollTimer, 90); - - // we have decided to SLEEP, so at least do it for a BEACON period. - if (TbttNumToNextWakeUp == 0) - TbttNumToNextWakeUp = 1; - - AutoWakeupCfg.word = 0; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - - // 1. Set auto wake up timer. - AutoWakeupCfg.field.NumofSleepingTbtt = TbttNumToNextWakeUp - 1; - AutoWakeupCfg.field.EnableAutoWakeup = 1; - AutoWakeupCfg.field.AutoLeadTime = LEAD_TIME; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - } - - // 4-1. If it's to disable our device. Need to restore PCI Configuration Space to its original value. - if (Level == RTMP_HALT) - { - if ((brc == TRUE) && (i < 50)) - RTMPPCIeLinkCtrlSetting(pAd, 0); - } - // 4. Set PCI configuration Space Link Comtrol fields. Only Radio Off needs to call this function - else - { - if ((brc == TRUE) && (i < 50)) - RTMPPCIeLinkCtrlSetting(pAd, 3); - } - - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_DISABLE_TX); -} - - -/* - ========================================================================== - Description: - This routine sends command to firmware and turn our chip to wake up mode from power save mode. - Both RadioOn and .11 power save function needs to call this routine. - Input: - Level = GUIRADIO_OFF : call this function is from Radio Off to Radio On. Need to restore PCI host value. - Level = other value : normal wake up function. - - ========================================================================== - */ -BOOLEAN RT28xxPciAsicRadioOn( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level) -{ - WPDMA_GLO_CFG_STRUC DmaCfg; - BOOLEAN Cancelled, brv = TRUE; - UINT32 MACValue; - - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) - { - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - if ((Level == GUIRADIO_OFF) || (Level == GUI_IDLE_POWER_SAVE) - || (RTMP_TEST_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND))) - { - DBGPRINT(RT_DEBUG_TRACE, ("RT28xxPciAsicRadioOn ()\n")); - // 1. Set PCI Link Control in Configuration Space. - RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); - RTMPusecDelay(6000); - } - } - - pAd->bPCIclkOff = FALSE; - RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, 0x3a80); - // 2. Send wake up command. - AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x02); - - // 2-1. wait command ok. - brv = AsicCheckCommanOk(pAd, PowerWakeCID); - if (brv) - { - NICEnableInterrupt(pAd); - - // 3. Enable Tx DMA. - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &DmaCfg.word); - DmaCfg.field.EnableTxDMA = 1; - DmaCfg.field.EnableRxDMA = 1; - RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, DmaCfg.word); - - // Eable MAC Rx - RTMP_IO_READ32(pAd, MAC_SYS_CTRL , &MACValue); - MACValue |= 0x8; - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL , MACValue); - - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF); - if (Level == GUI_IDLE_POWER_SAVE) - { - // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. - if (INFRA_ON(pAd) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) - && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - // Must using 40MHz. - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - } - else - { - // Must using 20MHz. - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - } - } - return TRUE; - } - else - return FALSE; -} - -VOID RT28xxPciStaAsicForceWakeup( - IN PRTMP_ADAPTER pAd, - IN UCHAR Level) -{ - AUTO_WAKEUP_STRUC AutoWakeupCfg; - - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WAKEUP_NOW)) - { - DBGPRINT(RT_DEBUG_TRACE, ("waking up now!\n")); - return; - } - - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_WAKEUP_NOW); - RTMP_CLEAR_PSFLAG(pAd, fRTMP_PS_GO_TO_SLEEP_NOW); - - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) - { - // Support PCIe Advance Power Save - if (((Level == FROM_TX) && (pAd->Mlme.bPsPollTimerRunning == TRUE)) || - (Level == RTMP_HALT)) - { - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); - RTMPusecDelay(5000); - DBGPRINT(RT_DEBUG_TRACE, ("=======AsicForceWakeup===bFromTx\n")); - } - - AutoWakeupCfg.word = 0; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - - // If this is called from Halt. ALWAYS force wakeup! - if (Level == RTMP_HALT) - { - RT28xxPciAsicRadioOn(pAd, RTMP_HALT); - } - else - { - if (RT28xxPciAsicRadioOn(pAd, DOT11POWERSAVE)) - { - // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. - if (INFRA_ON(pAd) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) - && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - // Must using 40MHz. - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - } - else - { - // Must using 20MHz. - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - } - } - } - } - else - { - // PCI, 2860-PCIe - AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x00); - AutoWakeupCfg.word = 0; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - } - - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_WAKEUP_NOW); - DBGPRINT(RT_DEBUG_TRACE, ("<=======RT28xxPciStaAsicForceWakeup\n")); -} - -VOID RT28xxPciStaAsicSleepThenAutoWakeup( - IN PRTMP_ADAPTER pAd, - IN USHORT TbttNumToNextWakeUp) -{ - if (pAd->StaCfg.bRadio == FALSE) - { - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); - return; - } - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) - { - ULONG Now = 0; - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WAKEUP_NOW)) - { - DBGPRINT(RT_DEBUG_TRACE, ("waking up now!\n")); - OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE); - return; - } - - NdisGetSystemUpTime(&Now); - // If last send NULL fram time is too close to this receiving beacon (within 8ms), don't go to sleep for this DTM. - // Because Some AP can't queuing outgoing frames immediately. - if (((pAd->Mlme.LastSendNULLpsmTime + 8) >= Now) && (pAd->Mlme.LastSendNULLpsmTime <= Now)) - { - DBGPRINT(RT_DEBUG_TRACE, ("Now = %lu, LastSendNULLpsmTime=%lu : RxCountSinceLastNULL = %lu. \n", Now, pAd->Mlme.LastSendNULLpsmTime, pAd->RalinkCounters.RxCountSinceLastNULL)); - return; - } - else if ((pAd->RalinkCounters.RxCountSinceLastNULL > 0) && ((pAd->Mlme.LastSendNULLpsmTime + pAd->CommonCfg.BeaconPeriod) >= Now)) - { - DBGPRINT(RT_DEBUG_TRACE, ("Now = %lu, LastSendNULLpsmTime=%lu: RxCountSinceLastNULL = %lu > 0 \n", Now, pAd->Mlme.LastSendNULLpsmTime, pAd->RalinkCounters.RxCountSinceLastNULL)); - return; - } - - RT28xxPciAsicRadioOff(pAd, DOT11POWERSAVE, TbttNumToNextWakeUp); - } - else - { - AUTO_WAKEUP_STRUC AutoWakeupCfg; - // we have decided to SLEEP, so at least do it for a BEACON period. - if (TbttNumToNextWakeUp == 0) - TbttNumToNextWakeUp = 1; - - AutoWakeupCfg.word = 0; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - AutoWakeupCfg.field.NumofSleepingTbtt = TbttNumToNextWakeUp - 1; - AutoWakeupCfg.field.EnableAutoWakeup = 1; - AutoWakeupCfg.field.AutoLeadTime = 5; - RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word); - AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x00); // send POWER-SAVE command to MCU. Timeout 40us. - DBGPRINT(RT_DEBUG_TRACE, ("<-- %s, TbttNumToNextWakeUp=%d \n", __func__, TbttNumToNextWakeUp)); - } - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_DOZE); -} - -VOID PsPollWakeExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; - unsigned long flags; - - DBGPRINT(RT_DEBUG_TRACE,("-->PsPollWakeExec \n")); - RTMP_INT_LOCK(&pAd->irq_lock, flags); - if (pAd->Mlme.bPsPollTimerRunning) - { - RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); - } - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMP_INT_UNLOCK(&pAd->irq_lock, flags); -} - -VOID RadioOnExec( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3) -{ - RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; - WPDMA_GLO_CFG_STRUC DmaCfg; - BOOLEAN Cancelled; - - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - DBGPRINT(RT_DEBUG_TRACE,("-->RadioOnExec() return on fOP_STATUS_DOZE == TRUE; \n")); - RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); - return; - } - - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - { - DBGPRINT(RT_DEBUG_TRACE,("-->RadioOnExec() return on SCAN_IN_PROGRESS; \n")); - RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); - return; - } - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - if (pAd->StaCfg.bRadio == TRUE) - { - pAd->bPCIclkOff = FALSE; - RTMPRingCleanUp(pAd, QID_AC_BK); - RTMPRingCleanUp(pAd, QID_AC_BE); - RTMPRingCleanUp(pAd, QID_AC_VI); - RTMPRingCleanUp(pAd, QID_AC_VO); - RTMPRingCleanUp(pAd, QID_HCCA); - RTMPRingCleanUp(pAd, QID_MGMT); - RTMPRingCleanUp(pAd, QID_RX); - - // 2. Send wake up command. - AsicSendCommandToMcu(pAd, 0x31, PowerWakeCID, 0x00, 0x02); - // 2-1. wait command ok. - AsicCheckCommanOk(pAd, PowerWakeCID); - - // When PCI clock is off, don't want to service interrupt. So when back to clock on, enable interrupt. - NICEnableInterrupt(pAd); - - // 3. Enable Tx DMA. - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &DmaCfg.word); - DmaCfg.field.EnableTxDMA = 1; - RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, DmaCfg.word); - - // In Radio Off, we turn off RF clk, So now need to call ASICSwitchChannel again. - if (INFRA_ON(pAd) && (pAd->CommonCfg.CentralChannel != pAd->CommonCfg.Channel) - && (pAd->MlmeAux.HtCapability.HtCapInfo.ChannelWidth == BW_40)) - { - // Must using 40MHz. - AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel); - } - else - { - // Must using 20MHz. - AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); - AsicLockChannel(pAd, pAd->CommonCfg.Channel); - } - - // Clear Radio off flag - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - - // Set LED - RTMPSetLED(pAd, LED_RADIO_ON); - - if (pAd->StaCfg.Psm == PWR_ACTIVE) - { - RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, pAd->StaCfg.BBPR3); - } - } - else - { - RT28xxPciAsicRadioOff(pAd, GUIRADIO_OFF, 0); - } -} - -VOID RT28xxPciMlmeRadioOn( - IN PRTMP_ADAPTER pAd) -{ - if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) - return; - - DBGPRINT(RT_DEBUG_TRACE,("%s===>\n", __func__)); - - if ((pAd->OpMode == OPMODE_AP) || - ((pAd->OpMode == OPMODE_STA) && (!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)))) - { - NICResetFromError(pAd); - - /* - RTMPRingCleanUp(pAd, QID_AC_BK); - RTMPRingCleanUp(pAd, QID_AC_BE); - RTMPRingCleanUp(pAd, QID_AC_VI); - RTMPRingCleanUp(pAd, QID_AC_VO); - RTMPRingCleanUp(pAd, QID_HCCA); - RTMPRingCleanUp(pAd, QID_MGMT); - RTMPRingCleanUp(pAd, QID_RX); - */ - - // Enable Tx/Rx - RTMPEnableRxTx(pAd); - - // Clear Radio off flag - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - - // Set LED - RTMPSetLED(pAd, LED_RADIO_ON); - } - - if ((pAd->OpMode == OPMODE_STA) && - (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE))) - { - BOOLEAN Cancelled; - - RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_WAKEUP); - - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); - RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 10); - } -} - -VOID RT28xxPciMlmeRadioOFF( - IN PRTMP_ADAPTER pAd) -{ - WPDMA_GLO_CFG_STRUC GloCfg; - UINT32 i; - - if (pAd->StaCfg.bRadio == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE,("-->MlmeRadioOff() return on bRadio == TRUE; \n")); - return; - } - - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) - return; - - DBGPRINT(RT_DEBUG_TRACE,("%s===>\n", __func__)); - - // Set LED - RTMPSetLED(pAd, LED_RADIO_OFF); - - { - BOOLEAN Cancelled; - - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) - { - RTMPCancelTimer(&pAd->MlmeAux.ScanTimer, &Cancelled); - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS); - } - - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) - { - BOOLEAN Cancelled; - - // Always radio on since the NIC needs to set the MCU command (LED_RADIO_OFF). - if ((pAd->OpMode == OPMODE_STA) && - (IDLE_ON(pAd)) && - (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))) - { - RT28xxPciAsicRadioOn(pAd, GUI_IDLE_POWER_SAVE); - } - - pAd->Mlme.bPsPollTimerRunning = FALSE; - RTMPCancelTimer(&pAd->Mlme.PsPollTimer, &Cancelled); - RTMPCancelTimer(&pAd->Mlme.RadioOnOffTimer, &Cancelled); - } - - // Link down first if any association exists - if (INFRA_ON(pAd) || ADHOC_ON(pAd)) - LinkDown(pAd, FALSE); - RTMPusecDelay(10000); - //========================================== - // Clean up old bss table - BssTableInit(&pAd->ScanTab); - - RTMPRingCleanUp(pAd, QID_AC_BK); - RTMPRingCleanUp(pAd, QID_AC_BE); - RTMPRingCleanUp(pAd, QID_AC_VI); - RTMPRingCleanUp(pAd, QID_AC_VO); - RTMPRingCleanUp(pAd, QID_HCCA); - RTMPRingCleanUp(pAd, QID_MGMT); - RTMPRingCleanUp(pAd, QID_RX); - - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE)) - { - RTMPSetTimer(&pAd->Mlme.RadioOnOffTimer, 500); - return; - } - } - - // Set Radio off flag - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF); - - // Disable Tx/Rx DMA - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); // disable DMA - GloCfg.field.EnableTxDMA = 0; - GloCfg.field.EnableRxDMA = 0; - RTMP_IO_WRITE32(pAd, WPDMA_GLO_CFG, GloCfg.word); // abort all TX rings - - - // MAC_SYS_CTRL => value = 0x0 => 40mA - RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, 0); - - // PWR_PIN_CFG => value = 0x0 => 40mA - RTMP_IO_WRITE32(pAd, PWR_PIN_CFG, 0); - - // TX_PIN_CFG => value = 0x0 => 20mA - RTMP_IO_WRITE32(pAd, TX_PIN_CFG, 0); - - if (pAd->CommonCfg.BBPCurrentBW == BW_40) - { - // Must using 40MHz. - AsicTurnOffRFClk(pAd, pAd->CommonCfg.CentralChannel); - } - else - { - // Must using 20MHz. - AsicTurnOffRFClk(pAd, pAd->CommonCfg.Channel); - } - - // Waiting for DMA idle - i = 0; - do - { - RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); - if ((GloCfg.field.TxDMABusy == 0) && (GloCfg.field.RxDMABusy == 0)) - break; - - RTMPusecDelay(1000); - }while (i++ < 100); -} -- GitLab From f5e08ca72288b9762f49778622617184180496e7 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Fri, 13 Nov 2009 15:13:43 -0500 Subject: [PATCH 202/235] Staging: usbip: Fix typo "Contoroller". Signed-off-by: Robert P. J. Day Signed-off-by: Greg Kroah-Hartman --- drivers/staging/usbip/vhci_hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index 6e91fc2bd850..ef4371358dbe 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c @@ -56,7 +56,7 @@ static void vhci_stop(struct usb_hcd *hcd); static int vhci_get_frame_number(struct usb_hcd *hcd); static const char driver_name[] = "vhci_hcd"; -static const char driver_desc[] = "USB/IP Virtual Host Contoroller"; +static const char driver_desc[] = "USB/IP Virtual Host Controller"; struct vhci_hcd *the_controller; -- GitLab From d52ac3f24e721cd279e7eba1b87914f1454c67ed Mon Sep 17 00:00:00 2001 From: Mariusz Ziulek Date: Thu, 12 Nov 2009 15:01:16 +0100 Subject: [PATCH 203/235] staging: dst: fix coding style Signed-off-by: Mariusz Ziulek Cc: Evgeniy Polyakov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dst/crypto.c | 64 ++++++++++++++------------- drivers/staging/dst/dcore.c | 26 ++++++----- drivers/staging/dst/export.c | 31 +++++++------ drivers/staging/dst/state.c | 73 +++++++++++++++++-------------- drivers/staging/dst/thread_pool.c | 39 +++++++++-------- drivers/staging/dst/trans.c | 18 ++++---- 6 files changed, 135 insertions(+), 116 deletions(-) diff --git a/drivers/staging/dst/crypto.c b/drivers/staging/dst/crypto.c index 7250f90f5924..351295c97a4b 100644 --- a/drivers/staging/dst/crypto.c +++ b/drivers/staging/dst/crypto.c @@ -64,7 +64,8 @@ err_out_exit: return ERR_PTR(err); } -static struct crypto_ablkcipher *dst_init_cipher(struct dst_crypto_ctl *ctl, u8 *key) +static struct crypto_ablkcipher *dst_init_cipher(struct dst_crypto_ctl *ctl, + u8 *key) { int err = -EINVAL; struct crypto_ablkcipher *cipher; @@ -105,7 +106,7 @@ static void dst_crypto_pages_free(struct dst_crypto_engine *e) { unsigned int i; - for (i=0; ipage_num; ++i) + for (i = 0; i < e->page_num; ++i) __free_page(e->pages[i]); kfree(e->pages); } @@ -118,7 +119,7 @@ static int dst_crypto_pages_alloc(struct dst_crypto_engine *e, int num) if (!e->pages) return -ENOMEM; - for (i=0; ipages[i] = alloc_page(GFP_KERNEL); if (!e->pages[i]) goto err_out_free_pages; @@ -139,7 +140,8 @@ err_out_free_pages: * Initialize crypto engine for given node. * Setup cipher/hash, keys, pool of threads and private data. */ -static int dst_crypto_engine_init(struct dst_crypto_engine *e, struct dst_node *n) +static int dst_crypto_engine_init(struct dst_crypto_engine *e, + struct dst_node *n) { int err; struct dst_crypto_ctl *ctl = &n->crypto; @@ -198,8 +200,7 @@ static void dst_crypto_engine_exit(struct dst_crypto_engine *e) /* * Waiting for cipher processing to be completed. */ -struct dst_crypto_completion -{ +struct dst_crypto_completion { struct completion complete; int error; }; @@ -237,17 +238,17 @@ static int dst_crypto_process(struct ablkcipher_request *req, err = crypto_ablkcipher_decrypt(req); switch (err) { - case -EINPROGRESS: - case -EBUSY: - err = wait_for_completion_interruptible_timeout(&c.complete, - timeout); - if (!err) - err = -ETIMEDOUT; - else - err = c.error; - break; - default: - break; + case -EINPROGRESS: + case -EBUSY: + err = wait_for_completion_interruptible_timeout(&c.complete, + timeout); + if (!err) + err = -ETIMEDOUT; + else + err = c.error; + break; + default: + break; } return err; @@ -263,7 +264,7 @@ static int dst_crypto_process(struct ablkcipher_request *req, * temporary storage, which is then being sent to the remote peer. */ static int dst_trans_iter_out(struct bio *bio, struct dst_crypto_engine *e, - int (* iterator) (struct dst_crypto_engine *e, + int (*iterator) (struct dst_crypto_engine *e, struct scatterlist *dst, struct scatterlist *src)) { @@ -286,7 +287,7 @@ static int dst_trans_iter_out(struct bio *bio, struct dst_crypto_engine *e, } static int dst_trans_iter_in(struct bio *bio, struct dst_crypto_engine *e, - int (* iterator) (struct dst_crypto_engine *e, + int (*iterator) (struct dst_crypto_engine *e, struct scatterlist *dst, struct scatterlist *src)) { @@ -411,9 +412,9 @@ static void dst_crypto_thread_cleanup(void *private) * Initialize crypto engine for given node: store keys, create pool * of threads, initialize each one. * - * Each thread has unique ID, but 0 and 1 are reserved for receiving and accepting - * threads (if export node), so IDs could start from 2, but starting them - * from 10 allows easily understand what this thread is for. + * Each thread has unique ID, but 0 and 1 are reserved for receiving and + * accepting threads (if export node), so IDs could start from 2, but starting + * them from 10 allows easily understand what this thread is for. */ int dst_node_crypto_init(struct dst_node *n, struct dst_crypto_ctl *ctl) { @@ -436,10 +437,10 @@ int dst_node_crypto_init(struct dst_node *n, struct dst_crypto_ctl *ctl) } memcpy(&n->crypto, ctl, sizeof(struct dst_crypto_ctl)); - for (i=0; ithread_num; ++i) { + for (i = 0; i < ctl->thread_num; ++i) { snprintf(name, sizeof(name), "%s-crypto-%d", n->name, i); /* Unique ids... */ - err = thread_pool_add_worker(n->pool, name, i+10, + err = thread_pool_add_worker(n->pool, name, i + 10, dst_crypto_thread_init, dst_crypto_thread_cleanup, n); if (err) goto err_out_free_threads; @@ -496,8 +497,8 @@ static void dst_dump_bio(struct bio *bio) bv->bv_len, bv->bv_offset); p = kmap(bv->bv_page) + bv->bv_offset; - for (i=0; ibv_len; ++i) - printk("%02x ", p[i]); + for (i = 0; i < bv->bv_len; ++i) + printk(KERN_DEBUG "%02x ", p[i]); kunmap(bv->bv_page); printk("\n"); } @@ -532,7 +533,7 @@ static int dst_crypto_process_sending(struct dst_crypto_engine *e, printk(KERN_DEBUG "%s: bio: %llu/%u, rw: %lu, hash: ", __func__, (u64)bio->bi_sector, bio->bi_size, bio_data_dir(bio)); - for (i=0; ihash); ++i) + for (i = 0; i < crypto_hash_digestsize(e->hash); ++i) printk("%02x ", hash[i]); printk("\n"); } @@ -572,9 +573,9 @@ static int dst_crypto_process_receiving(struct dst_crypto_engine *e, unsigned int i; printk(", recv/calc: "); - for (i=0; ihash); ++i) { + for (i = 0; i < crypto_hash_digestsize(e->hash); ++i) printk("%02x/%02x ", recv_hash[i], hash[i]); - } + } printk("\n"); #endif @@ -680,8 +681,9 @@ static int dst_export_crypto_action(void *crypto_engine, void *schedule_data) struct dst_export_priv *p = bio->bi_private; int err; - dprintk("%s: e: %p, data: %p, bio: %llu/%u, dir: %lu.\n", __func__, - e, e->data, (u64)bio->bi_sector, bio->bi_size, bio_data_dir(bio)); + dprintk("%s: e: %p, data: %p, bio: %llu/%u, dir: %lu.\n", + __func__, e, e->data, (u64)bio->bi_sector, + bio->bi_size, bio_data_dir(bio)); e->enc = (bio_data_dir(bio) == READ); e->iv = p->cmd.id; diff --git a/drivers/staging/dst/dcore.c b/drivers/staging/dst/dcore.c index c24e4e0367a2..fd5bd0ea1e0d 100644 --- a/drivers/staging/dst/dcore.c +++ b/drivers/staging/dst/dcore.c @@ -116,7 +116,7 @@ static int dst_request(struct request_queue *q, struct bio *bio) * bio_rw_flagged(bio, BIO_RW_DISCARD) only, which does not * work in this case. */ - //err = -EOPNOTSUPP; + /* err = -EOPNOTSUPP; */ err = 0; goto end_io; } @@ -197,7 +197,8 @@ static int dst_node_create_disk(struct dst_node *n) n->disk->fops = &dst_blk_ops; n->disk->queue = n->queue; n->disk->private_data = n; - snprintf(n->disk->disk_name, sizeof(n->disk->disk_name), "dst-%s", n->name); + snprintf(n->disk->disk_name, sizeof(n->disk->disk_name), + "dst-%s", n->name); return 0; @@ -246,7 +247,8 @@ static ssize_t dst_show_type(struct device *dev, return sprintf(buf, "%u.%u.%u.%u:%d\n", NIPQUAD(sin->sin_addr.s_addr), ntohs(sin->sin_port)); } else if (family == AF_INET6) { - struct sockaddr_in6 *sin = (struct sockaddr_in6 *)&info->net.addr; + struct sockaddr_in6 *sin = (struct sockaddr_in6 *) + &info->net.addr; return sprintf(buf, "%pi6:%d\n", &sin->sin6_addr, ntohs(sin->sin6_port)); @@ -261,7 +263,7 @@ static ssize_t dst_show_type(struct device *dev, sz -= size; buf += size; - for (i=0; iinfo->device, &dst_node_attrs[i]); if (err) @@ -306,7 +308,7 @@ static void dst_remove_node_attributes(struct dst_node *n) { int i; - for (i=0; iinfo->device, &dst_node_attrs[i]); } @@ -358,7 +360,7 @@ err_out_exit: */ static inline unsigned int dst_hash(char *str, unsigned int size) { - return (jhash(str, size, 0) % dst_hashtable_size); + return jhash(str, size, 0) % dst_hashtable_size; } static void dst_node_remove(struct dst_node *n) @@ -641,7 +643,8 @@ static int dst_start_remote(struct dst_node *n) dst_node_set_size(n); add_disk(n->disk); - dprintk("DST: started remote node '%s', minor: %d.\n", n->name, n->disk->first_minor); + dprintk("DST: started remote node '%s', minor: %d.\n", + n->name, n->disk->first_minor); return 0; } @@ -740,7 +743,8 @@ static int dst_node_remove_unload(struct dst_node *n) * counter will be equal to 1), * and subsequent dst_node_put() calls will free the node. */ - dprintk("%s: going to sleep with %d refcnt.\n", __func__, atomic_read(&n->refcnt)); + dprintk("%s: going to sleep with %d refcnt.\n", + __func__, atomic_read(&n->refcnt)); wait_event(n->wait, atomic_read(&n->refcnt) <= 2); dst_node_put(n); @@ -921,7 +925,7 @@ static int __init dst_hashtable_init(void) if (!dst_hashtable) return -ENOMEM; - for (i=0; inode; struct dst_secure *sentry; @@ -73,9 +74,9 @@ static unsigned int dst_check_permissions(struct dst_state *main, struct dst_sta /* * This '2' below is a port field. This may be very wrong to do - * in atalk for example though. If there will be any need to extent - * protocol to something else, I can create per-family helpers and - * use them instead of this memcmp. + * in atalk for example though. If there will be any need + * to extent protocol to something else, I can create + * per-family helpers and use them instead of this memcmp. */ if (memcmp(s->addr.sa_data + 2, sa->sa_data + 2, sa->sa_data_len - 2)) @@ -125,8 +126,8 @@ static struct dst_state *dst_accept_client(struct dst_state *st) * Magic HZ? Polling check above is not safe in * all cases (like socket reset in BH context), * so it is simpler just to postpone it to the - * process context instead of implementing special - * locking there. + * process context instead of implementing + * special locking there. */ schedule_timeout(HZ); } @@ -272,8 +273,8 @@ static void dst_state_cleanup_export(struct dst_state *st) if (p) bio_put(p->bio); - dprintk("%s: st: %p, refcnt: %d, list_empty: %d, p: %p.\n", - __func__, st, atomic_read(&st->refcnt), + dprintk("%s: st: %p, refcnt: %d, list_empty: %d, p: " + "%p.\n", __func__, st, atomic_read(&st->refcnt), list_empty(&st->request_list), p); } } @@ -303,9 +304,9 @@ static int dst_accept(void *init_data, void *schedule_data) if (!err) { while (n->trans_scan_timeout) { err = wait_event_interruptible_timeout(st->thread_wait, - !list_empty(&st->request_list) || - !n->trans_scan_timeout || - st->need_exit, + !list_empty(&st->request_list) || + !n->trans_scan_timeout || + st->need_exit, HZ); if (!n->trans_scan_timeout || st->need_exit) @@ -341,8 +342,9 @@ static int dst_accept(void *init_data, void *schedule_data) int dst_start_export(struct dst_node *n) { if (list_empty(&n->security_list)) { - printk(KERN_ERR "You are trying to export node '%s' without security attributes.\n" - "No clients will be allowed to connect. Exiting.\n", n->name); + printk(KERN_ERR "You are trying to export node '%s' " + "without security attributes.\nNo clients will " + "be allowed to connect. Exiting.\n", n->name); return -EINVAL; } return dst_node_trans_init(n, sizeof(struct dst_export_priv)); @@ -552,7 +554,8 @@ int dst_process_io(struct dst_state *st) if (!bio) goto err_out_exit; - priv = (struct dst_export_priv *)(((void *)bio) - sizeof (struct dst_export_priv)); + priv = (struct dst_export_priv *)(((void *)bio) - + sizeof (struct dst_export_priv)); priv->state = dst_state_get(st); priv->bio = bio; diff --git a/drivers/staging/dst/state.c b/drivers/staging/dst/state.c index bccbd6dbb172..02a05e6c48c3 100644 --- a/drivers/staging/dst/state.c +++ b/drivers/staging/dst/state.c @@ -30,13 +30,13 @@ * Polling machinery. */ -struct dst_poll_helper -{ - poll_table pt; +struct dst_poll_helper { + poll_table pt; struct dst_state *st; }; -static int dst_queue_wake(wait_queue_t *wait, unsigned mode, int sync, void *key) +static int dst_queue_wake(wait_queue_t *wait, unsigned mode, + int sync, void *key) { struct dst_state *st = container_of(wait, struct dst_state, wait); @@ -92,7 +92,7 @@ static int dst_data_recv_header(struct socket *sock, msg.msg_namelen = 0; msg.msg_control = NULL; msg.msg_controllen = 0; - msg.msg_flags = (block)?MSG_WAITALL:MSG_DONTWAIT; + msg.msg_flags = (block) ? MSG_WAITALL : MSG_DONTWAIT; err = kernel_recvmsg(sock, &msg, &iov, 1, iov.iov_len, msg.msg_flags); @@ -217,8 +217,8 @@ void dst_dump_addr(struct socket *sk, struct sockaddr *sa, char *str) { if (sk->ops->family == AF_INET) { struct sockaddr_in *sin = (struct sockaddr_in *)sa; - printk(KERN_INFO "%s %u.%u.%u.%u:%d.\n", - str, NIPQUAD(sin->sin_addr.s_addr), ntohs(sin->sin_port)); + printk(KERN_INFO "%s %u.%u.%u.%u:%d.\n", str, + NIPQUAD(sin->sin_addr.s_addr), ntohs(sin->sin_port)); } else if (sk->ops->family == AF_INET6) { struct sockaddr_in6 *sin = (struct sockaddr_in6 *)sa; printk(KERN_INFO "%s %pi6:%d", @@ -271,13 +271,13 @@ err_out_exit: * State reset is used to reconnect to the remote peer. * May fail, but who cares, we will try again later. */ -static void inline dst_state_reset_nolock(struct dst_state *st) +static inline void dst_state_reset_nolock(struct dst_state *st) { dst_state_exit_connected(st); dst_state_init_connected(st); } -static void inline dst_state_reset(struct dst_state *st) +static inline void dst_state_reset(struct dst_state *st) { dst_state_lock(st); dst_state_reset_nolock(st); @@ -335,9 +335,11 @@ static int dst_send_ping(struct dst_state *st) cmd->cmd = __cpu_to_be32(DST_PING); - err = dst_data_send_header(st->socket, cmd, sizeof(struct dst_cmd), 0); + err = dst_data_send_header(st->socket, cmd, + sizeof(struct dst_cmd), 0); } - dprintk("%s: st: %p, socket: %p, err: %d.\n", __func__, st, st->socket, err); + dprintk("%s: st: %p, socket: %p, err: %d.\n", __func__, + st, st->socket, err); dst_state_unlock(st); return err; @@ -390,8 +392,7 @@ int dst_data_recv(struct dst_state *st, void *data, unsigned int size) err = -ECONNRESET; dst_state_lock(st); - if ( st->socket && - (st->read_socket == st->socket) && + if (st->socket && (st->read_socket == st->socket) && (revents & POLLIN)) { err = dst_data_recv_raw(st, data, size); if (err > 0) { @@ -402,8 +403,9 @@ int dst_data_recv(struct dst_state *st, void *data, unsigned int size) } if (revents & err_mask || !st->socket) { - dprintk("%s: revents: %x, socket: %p, size: %u, err: %d.\n", - __func__, revents, st->socket, size, err); + dprintk("%s: revents: %x, socket: %p, size: %u, " + "err: %d.\n", __func__, revents, + st->socket, size, err); err = -ECONNRESET; } @@ -440,7 +442,8 @@ static int dst_process_cfg(struct dst_state *st) /* * Receive block IO from the network. */ -static int dst_recv_bio(struct dst_state *st, struct bio *bio, unsigned int total_size) +static int dst_recv_bio(struct dst_state *st, struct bio *bio, + unsigned int total_size) { struct bio_vec *bv; int i, err; @@ -450,9 +453,10 @@ static int dst_recv_bio(struct dst_state *st, struct bio *bio, unsigned int tota bio_for_each_segment(bv, bio, i) { sz = min(total_size, bv->bv_len); - dprintk("%s: bio: %llu/%u, total: %u, len: %u, sz: %u, off: %u.\n", - __func__, (u64)bio->bi_sector, bio->bi_size, total_size, - bv->bv_len, sz, bv->bv_offset); + dprintk("%s: bio: %llu/%u, total: %u, len: %u, sz: %u, " + "off: %u.\n", __func__, (u64)bio->bi_sector, + bio->bi_size, total_size, bv->bv_len, sz, + bv->bv_offset); data = kmap(bv->bv_page) + bv->bv_offset; err = dst_data_recv(st, data, sz); @@ -590,7 +594,8 @@ static int dst_recv_processing(struct dst_state *st) cmd->flags, cmd->rw); /* - * This should catch protocol breakage and random garbage instead of commands. + * This should catch protocol breakage and random garbage + * instead of commands. */ if (unlikely(cmd->csize > st->size - sizeof(struct dst_cmd))) { err = -EBADMSG; @@ -599,20 +604,20 @@ static int dst_recv_processing(struct dst_state *st) err = -EPROTO; switch (cmd->cmd) { - case DST_IO_RESPONSE: - err = dst_process_io_response(st); - break; - case DST_IO: - err = dst_process_io(st); - break; - case DST_CFG: - err = dst_process_cfg(st); - break; - case DST_PING: - err = 0; - break; - default: - break; + case DST_IO_RESPONSE: + err = dst_process_io_response(st); + break; + case DST_IO: + err = dst_process_io(st); + break; + case DST_CFG: + err = dst_process_cfg(st); + break; + case DST_PING: + err = 0; + break; + default: + break; } out_exit: diff --git a/drivers/staging/dst/thread_pool.c b/drivers/staging/dst/thread_pool.c index 7bed4e851029..29a82b2602f3 100644 --- a/drivers/staging/dst/thread_pool.c +++ b/drivers/staging/dst/thread_pool.c @@ -30,8 +30,7 @@ * When action is being performed, thread can not be used by other users, * instead they will sleep until there is free thread to pick their work. */ -struct thread_pool_worker -{ +struct thread_pool_worker { struct list_head worker_entry; struct task_struct *thread; @@ -48,8 +47,8 @@ struct thread_pool_worker void *private; void *schedule_data; - int (* action)(void *private, void *schedule_data); - void (* cleanup)(void *private); + int (*action)(void *private, void *schedule_data); + void (*cleanup)(void *private); }; static void thread_pool_exit_worker(struct thread_pool_worker *w) @@ -116,10 +115,12 @@ void thread_pool_del_worker(struct thread_pool *p) struct thread_pool_worker *w = NULL; while (!w && p->thread_num) { - wait_event(p->wait, !list_empty(&p->ready_list) || !p->thread_num); + wait_event(p->wait, !list_empty(&p->ready_list) || + !p->thread_num); dprintk("%s: locking list_empty: %d, thread_num: %d.\n", - __func__, list_empty(&p->ready_list), p->thread_num); + __func__, list_empty(&p->ready_list), + p->thread_num); mutex_lock(&p->thread_lock); if (!list_empty(&p->ready_list)) { @@ -127,8 +128,9 @@ void thread_pool_del_worker(struct thread_pool *p) struct thread_pool_worker, worker_entry); - dprintk("%s: deleting w: %p, thread_num: %d, list: %p [%p.%p].\n", - __func__, w, p->thread_num, &p->ready_list, + dprintk("%s: deleting w: %p, thread_num: %d, " + "list: %p [%p.%p].\n", __func__, + w, p->thread_num, &p->ready_list, p->ready_list.prev, p->ready_list.next); p->thread_num--; @@ -182,8 +184,8 @@ void thread_pool_del_worker_id(struct thread_pool *p, unsigned int id) int thread_pool_add_worker(struct thread_pool *p, char *name, unsigned int id, - void *(* init)(void *private), - void (* cleanup)(void *private), + void *(*init)(void *private), + void (*cleanup)(void *private), void *private) { struct thread_pool_worker *w; @@ -243,8 +245,8 @@ void thread_pool_destroy(struct thread_pool *p) * They will have sequential IDs started from zero. */ struct thread_pool *thread_pool_create(int num, char *name, - void *(* init)(void *private), - void (* cleanup)(void *private), + void *(*init)(void *private), + void (*cleanup)(void *private), void *private) { struct thread_pool_worker *w, *tmp; @@ -262,7 +264,7 @@ struct thread_pool *thread_pool_create(int num, char *name, INIT_LIST_HEAD(&p->active_list); p->thread_num = 0; - for (i=0; ihas_data = 1; wake_up(&w->wait); } else { - list_move_tail(&w->worker_entry, &p->ready_list); + list_move_tail(&w->worker_entry, + &p->ready_list); } break; @@ -336,8 +339,8 @@ int thread_pool_schedule_private(struct thread_pool *p, * Schedule execution on arbitrary thread from the pool. */ int thread_pool_schedule(struct thread_pool *p, - int (* setup)(void *private, void *data), - int (* action)(void *private, void *data), + int (*setup)(void *private, void *data), + int (*action)(void *private, void *data), void *data, long timeout) { return thread_pool_schedule_private(p, setup, diff --git a/drivers/staging/dst/trans.c b/drivers/staging/dst/trans.c index 557d372a496c..1c36a6bc31d5 100644 --- a/drivers/staging/dst/trans.c +++ b/drivers/staging/dst/trans.c @@ -58,7 +58,7 @@ struct dst_trans *dst_trans_search(struct dst_node *node, dst_gen_t gen) } dprintk("%s: %s transaction: id: %llu.\n", __func__, - (ret)?"found":"not found", gen); + (ret) ? "found" : "not found", gen); return ret; } @@ -88,9 +88,9 @@ static int dst_trans_insert(struct dst_trans *new) new->send_time = jiffies; if (ret) { - printk("%s: exist: old: gen: %llu, bio: %llu/%u, send_time: %lu, " - "new: gen: %llu, bio: %llu/%u, send_time: %lu.\n", - __func__, + printk(KERN_DEBUG "%s: exist: old: gen: %llu, bio: %llu/%u, " + "send_time: %lu, new: gen: %llu, bio: %llu/%u, " + "send_time: %lu.\n", __func__, ret->gen, (u64)ret->bio->bi_sector, ret->bio->bi_size, ret->send_time, new->gen, (u64)new->bio->bi_sector, @@ -206,7 +206,8 @@ err_out_exit: */ static void dst_trans_scan(struct work_struct *work) { - struct dst_node *n = container_of(work, struct dst_node, trans_work.work); + struct dst_node *n = container_of(work, struct dst_node, + trans_work.work); struct rb_node *rb_node; struct dst_trans *t; unsigned long timeout = n->trans_scan_timeout; @@ -246,8 +247,8 @@ static void dst_trans_scan(struct work_struct *work) mutex_unlock(&n->trans_lock); /* - * If no timeout specified then system is in the middle of exiting process, - * so no need to reschedule scanning process again. + * If no timeout specified then system is in the middle of exiting + * process, so no need to reschedule scanning process again. */ if (timeout) { if (!num) @@ -313,7 +314,8 @@ int dst_node_trans_init(struct dst_node *n, unsigned int size) if (!n->trans_cache) goto err_out_exit; - n->trans_pool = mempool_create_slab_pool(dst_mempool_num, n->trans_cache); + n->trans_pool = mempool_create_slab_pool(dst_mempool_num, + n->trans_cache); if (!n->trans_pool) goto err_out_cache_destroy; -- GitLab From bbc9a9916bc1cd997f3bf303e7930d5f3c804d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= Date: Sat, 14 Nov 2009 13:09:06 -0200 Subject: [PATCH 204/235] Staging: fix assorted typos all over the place MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Goddard Rosa Signed-off-by: Greg Kroah-Hartman --- drivers/staging/altpciechdma/altpciechdma.c | 6 +++--- .../drivers/addi-data/APCI1710_INCCPT.c | 6 +++--- .../comedi/drivers/addi-data/APCI1710_Tor.c | 2 +- .../comedi/drivers/addi-data/addi_common.h | 2 +- .../comedi/drivers/addi-data/hwdrv_apci3120.c | 2 +- .../comedi/drivers/addi-data/hwdrv_apci3501.c | 2 +- drivers/staging/comedi/drivers/cb_pcidio.c | 4 ++-- drivers/staging/comedi/drivers/me4000.c | 2 +- drivers/staging/comedi/drivers/pcl812.c | 6 +++--- drivers/staging/comedi/drivers/pcl816.c | 4 ++-- drivers/staging/comedi/drivers/pcl818.c | 10 +++++----- drivers/staging/dst/export.c | 2 +- drivers/staging/et131x/et131x_adapter.h | 2 +- drivers/staging/hv/hv_api.h | 4 ++-- drivers/staging/iio/accel/accel.h | 6 +++--- drivers/staging/iio/accel/sca3000.h | 4 ++-- drivers/staging/iio/accel/sca3000_core.c | 2 +- drivers/staging/octeon/cvmx-pow.h | 2 +- drivers/staging/octeon/ethernet-tx.c | 2 +- drivers/staging/otus/80211core/ccmd.c | 4 ++-- drivers/staging/otus/80211core/cmm.c | 4 ++-- drivers/staging/otus/80211core/cmmsta.c | 4 ++-- drivers/staging/otus/80211core/ctxrx.c | 2 +- drivers/staging/otus/80211core/pub_zfi.h | 2 +- drivers/staging/quatech_usb2/quatech_usb2.c | 2 +- drivers/staging/rar/rar_driver.c | 4 ++-- drivers/staging/rt2860/sta/rtmp_data.c | 2 +- .../rtl8187se/ieee80211/ieee80211_softmac.c | 6 +++--- drivers/staging/rtl8187se/r8180.h | 2 +- drivers/staging/rtl8187se/r8180_core.c | 10 +++++----- drivers/staging/rtl8187se/r8180_dm.c | 12 +++++------ drivers/staging/rtl8187se/r8180_rtl8225z2.c | 2 +- drivers/staging/rtl8187se/r8180_wx.c | 2 +- drivers/staging/rtl8187se/r8185b_init.c | 4 ++-- .../rtl8192e/ieee80211/ieee80211_module.c | 2 +- .../rtl8192e/ieee80211/ieee80211_softmac.c | 4 ++-- drivers/staging/rtl8192e/r8190_rtl8256.c | 2 +- drivers/staging/rtl8192e/r8192E_core.c | 6 +++--- drivers/staging/rtl8192e/r8192E_dm.c | 20 +++++++++---------- drivers/staging/rtl8192e/r8192E_wx.c | 2 +- drivers/staging/rtl8192e/r819xE_cmdpkt.c | 2 +- drivers/staging/rtl8192e/r819xE_phyreg.h | 2 +- .../rtl8192su/ieee80211/ieee80211_module.c | 2 +- .../rtl8192su/ieee80211/ieee80211_softmac.c | 4 ++-- drivers/staging/rtl8192su/ieee80211/readme | 2 +- drivers/staging/rtl8192su/r8192S_phy.c | 4 ++-- drivers/staging/rtl8192su/r8192S_phyreg.h | 2 +- drivers/staging/rtl8192su/r8192S_rtl6052.c | 4 ++-- drivers/staging/rtl8192su/r8192U_dm.c | 10 +++++----- drivers/staging/rtl8192su/r8192U_wx.c | 2 +- drivers/staging/rtl8192su/r819xU_cmdpkt.c | 2 +- drivers/staging/sep/sep_driver.c | 2 +- drivers/staging/serqt_usb2/serqt_usb2.c | 2 +- drivers/staging/vt6655/device_main.c | 2 +- drivers/staging/vt6655/ioctl.c | 4 ++-- drivers/staging/vt6655/mib.h | 4 ++-- drivers/staging/vt6656/baseband.c | 2 +- drivers/staging/vt6656/channel.c | 2 +- drivers/staging/vt6656/ioctl.c | 4 ++-- drivers/staging/vt6656/iwctl.c | 2 +- drivers/staging/vt6656/main_usb.c | 2 +- drivers/staging/vt6656/mib.h | 4 ++-- drivers/staging/vt6656/wcmd.c | 2 +- 63 files changed, 118 insertions(+), 118 deletions(-) diff --git a/drivers/staging/altpciechdma/altpciechdma.c b/drivers/staging/altpciechdma/altpciechdma.c index e0c5ba4b4c29..2f07dd4563ac 100644 --- a/drivers/staging/altpciechdma/altpciechdma.c +++ b/drivers/staging/altpciechdma/altpciechdma.c @@ -212,7 +212,7 @@ struct ape_dev { int msi_enabled; /* whether this driver could obtain the regions */ int got_regions; - /* irq line succesfully requested by this driver, -1 otherwise */ + /* irq line successfully requested by this driver, -1 otherwise */ int irq_line; /* board revision */ u8 revision; @@ -336,7 +336,7 @@ static int __devinit map_bars(struct ape_dev *ape, struct pci_dev *dev) printk(KERN_DEBUG "BAR[%d] mapped at 0x%p with length %lu(/%lu).\n", i, ape->bar[i], bar_min_len[i], bar_length); } - /* succesfully mapped all required BAR regions */ + /* successfully mapped all required BAR regions */ rc = 0; goto success; fail: @@ -911,7 +911,7 @@ static int __devinit probe(struct pci_dev *dev, const struct pci_device_id *id) /* perform DMA engines loop back test */ rc = dma_test(ape, dev); (void)rc; - /* succesfully took the device */ + /* successfully took the device */ rc = 0; printk(KERN_DEBUG "probe() successful.\n"); goto end; diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.c index 6c092efee7bd..a15c952c0fab 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.c @@ -3807,7 +3807,7 @@ int i_APCI1710_EnableFrequencyMeasurement(struct comedi_device *dev, s_ModuleInfo[b_ModulNbr]. s_SiemensCounterInfo.s_InitFlag.b_CounterInit == 1) { /********************************************/ - /* Test if frequency mesurement initialised */ + /* Test if frequency measurement initialised */ /********************************************/ if (devpriv-> @@ -3953,7 +3953,7 @@ int i_APCI1710_DisableFrequencyMeasurement(struct comedi_device *dev, unsigned c s_ModuleInfo[b_ModulNbr]. s_SiemensCounterInfo.s_InitFlag.b_CounterInit == 1) { /********************************************/ - /* Test if frequency mesurement initialised */ + /* Test if frequency measurement initialised */ /********************************************/ if (devpriv-> @@ -5166,7 +5166,7 @@ int i_APCI1710_ReadFrequencyMeasurement(struct comedi_device *dev, s_ModuleInfo[b_ModulNbr]. s_SiemensCounterInfo.s_InitFlag.b_CounterInit == 1) { /********************************************/ - /* Test if frequency mesurement initialised */ + /* Test if frequency measurement initialised */ /********************************************/ if (devpriv-> diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.c index 43198aafb2dc..7e1254475792 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.c @@ -1808,7 +1808,7 @@ int i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device 2) { if (dw_Status & 4) { /************************/ - /* Tor counter owerflow */ + /* Tor counter overflow */ /************************/ *pb_TorCounterStatus diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h b/drivers/staging/comedi/drivers/addi-data/addi_common.h index edd657b902aa..3ab27cf0facc 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.h @@ -82,7 +82,7 @@ struct addi_board { int i_NbrDiChannel; /* Number of DI channels */ int i_NbrDoChannel; /* Number of DO channels */ - int i_DoMaxdata; /* data to set all chanels high */ + int i_DoMaxdata; /* data to set all channels high */ int i_NbrTTLChannel; /* Number of TTL channels */ const struct comedi_lrange *pr_TTLRangelist; /* rangelist for TTL */ diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 222b5499dc0e..172fba8dbfe5 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -1468,7 +1468,7 @@ void v_APCI3120_Interrupt(int irq, void *d) int_amcc = inl(devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR); /* get AMCC int register */ if ((!int_daq) && (!(int_amcc & ANY_S593X_INT))) { - comedi_error(dev, "IRQ from unknow source"); + comedi_error(dev, "IRQ from unknown source"); return; } diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c index ef21f03fc961..7b38d177394b 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c @@ -724,7 +724,7 @@ void v_APCI3501_Interrupt(int irq, void *d) APCI3501_TCW_IRQ) & 0x1; if ((!ui_Timer_AOWatchdog)) { - comedi_error(dev, "IRQ from unknow source"); + comedi_error(dev, "IRQ from unknown source"); return; } diff --git a/drivers/staging/comedi/drivers/cb_pcidio.c b/drivers/staging/comedi/drivers/cb_pcidio.c index 09e6e3bdfb3e..7daad0a17fb1 100644 --- a/drivers/staging/comedi/drivers/cb_pcidio.c +++ b/drivers/staging/comedi/drivers/cb_pcidio.c @@ -109,12 +109,12 @@ MODULE_DEVICE_TABLE(pci, pcidio_pci_table); several hardware drivers keep similar information in this structure, feel free to suggest moving the variable to the struct comedi_device struct. */ struct pcidio_private { - int data; /* curently unused */ + int data; /* currently unused */ /* would be useful for a PCI device */ struct pci_dev *pci_dev; - /* used for DO readback, curently unused */ + /* used for DO readback, currently unused */ unsigned int do_readback[4]; /* up to 4 unsigned int suffice to hold 96 bits for PCI-DIO96 */ unsigned long dio_reg_base; /* address of port A of the first 8255 chip on board */ diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 6079913d14b0..8b9fa0f9f1f6 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -840,7 +840,7 @@ static int xilinx_download(struct comedi_device *dev) "comedi%d: me4000: xilinx_download(): DONE flag is not set\n", dev->minor); printk(KERN_ERR - "comedi%d: me4000: xilinx_download(): Download not succesful\n", + "comedi%d: me4000: xilinx_download(): Download not successful\n", dev->minor); return -EIO; } diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c index 0b51a48c3ad8..0a5bc3d6da8c 100644 --- a/drivers/staging/comedi/drivers/pcl812.c +++ b/drivers/staging/comedi/drivers/pcl812.c @@ -51,7 +51,7 @@ Options for PCL-812: 5=A/D input range is +/-0.3125V [5] - 0=D/A outputs 0-5V (internal reference -5V) 1=D/A outputs 0-10V (internal reference -10V) - 2=D/A outputs unknow (external reference) + 2=D/A outputs unknown (external reference) Options for PCL-812PG, ACL-8112PG: [0] - IO Base @@ -63,7 +63,7 @@ Options for PCL-812PG, ACL-8112PG: 1=A/D have max +/-10V input [5] - 0=D/A outputs 0-5V (internal reference -5V) 1=D/A outputs 0-10V (internal reference -10V) - 2=D/A outputs unknow (external reference) + 2=D/A outputs unknown (external reference) Options for ACL-8112DG/HG, A-822PGL/PGH, A-823PGL/PGH, ACL-8216, A-826PG: [0] - IO Base @@ -75,7 +75,7 @@ Options for ACL-8112DG/HG, A-822PGL/PGH, A-823PGL/PGH, ACL-8216, A-826PG: 1=A/D channels are DIFF [5] - 0=D/A outputs 0-5V (internal reference -5V) 1=D/A outputs 0-10V (internal reference -10V) - 2=D/A outputs unknow (external reference) + 2=D/A outputs unknown (external reference) Options for A-821PGL/PGH: [0] - IO Base diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index 1b1708a58b67..852fe2458fdc 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -112,7 +112,7 @@ struct pcl816_board { int n_dichan; /* num of DI chans */ int n_dochan; /* num of DO chans */ const struct comedi_lrange *ai_range_type; /* default A/D rangelist */ - const struct comedi_lrange *ao_range_type; /* dafault D/A rangelist */ + const struct comedi_lrange *ao_range_type; /* default D/A rangelist */ unsigned int io_range; /* len of IO space */ unsigned int IRQbits; /* allowed interrupts */ unsigned int DMAbits; /* allowed DMA chans */ @@ -445,7 +445,7 @@ static irqreturn_t interrupt_pcl816(int irq, void *d) comedi_error(dev, "bad IRQ!"); return IRQ_NONE; } - comedi_error(dev, "IRQ from unknow source!"); + comedi_error(dev, "IRQ from unknown source!"); return IRQ_NONE; } diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index 819dd838b075..d0481013a837 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -50,7 +50,7 @@ A word or two about DMA. Driver support DMA operations at two ways: 1, 10=A/D input -10V..+10V [5] - 0, 5=D/A output 0-5V (internal reference -5V) 1, 10=D/A output 0-10V (internal reference -10V) - 2 =D/A output unknow (external reference) + 2 =D/A output unknown (external reference) Options for PCL-818, PCL-818H: [0] - IO Base @@ -60,7 +60,7 @@ A word or two about DMA. Driver support DMA operations at two ways: 1= 1MHz clock for 8254 [4] - 0, 5=D/A output 0-5V (internal reference -5V) 1, 10=D/A output 0-10V (internal reference -10V) - 2 =D/A output unknow (external reference) + 2 =D/A output unknown (external reference) Options for PCL-818HD, PCL-818HG: [0] - IO Base @@ -71,7 +71,7 @@ A word or two about DMA. Driver support DMA operations at two ways: 1= 1MHz clock for 8254 [4] - 0, 5=D/A output 0-5V (internal reference -5V) 1, 10=D/A output 0-10V (internal reference -10V) - 2 =D/A output unknow (external reference) + 2 =D/A output unknown (external reference) Options for PCL-718: [0] - IO Base @@ -92,7 +92,7 @@ A word or two about DMA. Driver support DMA operations at two ways: 10= user defined unipolar [5] - 0, 5=D/A outputs 0-5V (internal reference -5V) 1, 10=D/A outputs 0-10V (internal reference -10V) - 2=D/A outputs unknow (external reference) + 2=D/A outputs unknown (external reference) [6] - 0, 60=max 60kHz A/D sampling 1,100=max 100kHz A/D sampling (PCL-718 with Option 001 installed) @@ -876,7 +876,7 @@ static irqreturn_t interrupt_pcl818(int irq, void *d) return IRQ_NONE; } - comedi_error(dev, "IRQ from unknow source!"); + comedi_error(dev, "IRQ from unknown source!"); return IRQ_NONE; } diff --git a/drivers/staging/dst/export.c b/drivers/staging/dst/export.c index da5b6cf9baac..c324230e8b60 100644 --- a/drivers/staging/dst/export.c +++ b/drivers/staging/dst/export.c @@ -203,7 +203,7 @@ err_out_exit: * so to play good with all cases we just queue BIO into the queue * and wake up processing thread, which gets completed request and * send (encrypting if needed) it back to the client (if it was a read - * request), or sends back reply that writing succesfully completed. + * request), or sends back reply that writing successfully completed. */ static int dst_export_process_request_queue(struct dst_state *st) { diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h index cc5a6ba55dcf..81109b302cf5 100644 --- a/drivers/staging/et131x/et131x_adapter.h +++ b/drivers/staging/et131x/et131x_adapter.h @@ -162,7 +162,7 @@ typedef struct _ce_stats_t { u32 tx_deferred; /* Rx Statistics. */ - u32 rx_ov_flow; /* Rx Over Flow */ + u32 rx_ov_flow; /* Rx Overflow */ u32 length_err; u32 alignment_err; diff --git a/drivers/staging/hv/hv_api.h b/drivers/staging/hv/hv_api.h index 251e2d155331..9eb818ee07ba 100644 --- a/drivers/staging/hv/hv_api.h +++ b/drivers/staging/hv/hv_api.h @@ -316,13 +316,13 @@ /* * HV_STATUS_VMX_INSTRUCTION_FAILED - * The requested VMX instruction failed to complete succesfully. + * The requested VMX instruction failed to complete successfully. */ #define HV_STATUS_VMX_INSTRUCTION_FAILED ((u16)0x1011) /* * HV_STATUS_VMX_INSTRUCTION_FAILED_WITH_STATUS - * The requested VMX instruction failed to complete succesfully indicating + * The requested VMX instruction failed to complete successfully indicating * status. */ #define HV_STATUS_VMX_INSTRUCTION_FAILED_WITH_STATUS ((u16)0x1012) diff --git a/drivers/staging/iio/accel/accel.h b/drivers/staging/iio/accel/accel.h index 811fa0527a43..d7fc7f98348e 100644 --- a/drivers/staging/iio/accel/accel.h +++ b/drivers/staging/iio/accel/accel.h @@ -31,13 +31,13 @@ IIO_DEVICE_ATTR(accel_z, S_IRUGO, _show, NULL, _addr) /* Thresholds are somewhat chip dependent - may need quite a few defs here */ -/* For unified thesholds (shared across all directions */ +/* For unified thresholds (shared across all directions */ /** * IIO_DEV_ATTR_ACCEL_THRESH: unified threshold * @_mode: read/write * @_show: read detector threshold value - * @_store: write detector theshold value + * @_store: write detector threshold value * @_addr: driver specific data, typically a register address * * This one is for cases where as single threshold covers all directions @@ -48,7 +48,7 @@ /** * IIO_DEV_ATTR_ACCEL_THRESH_X: independant direction threshold, x axis * @_mode: readable / writable - * @_show: read x axis detector theshold value + * @_show: read x axis detector threshold value * @_store: write x axis detector threshold value * @_addr: device driver dependant, typically a register address **/ diff --git a/drivers/staging/iio/accel/sca3000.h b/drivers/staging/iio/accel/sca3000.h index 29e11da09572..da7d3cb5ae71 100644 --- a/drivers/staging/iio/accel/sca3000.h +++ b/drivers/staging/iio/accel/sca3000.h @@ -74,7 +74,7 @@ #define SCA3000_MEAS_MODE_OP_2 0x02 /* In motion detection mode the accelerations are band pass filtered - * (aprox 1 - 25Hz) and then a programmable theshold used to trigger + * (aprox 1 - 25Hz) and then a programmable threshold used to trigger * and interrupt. */ #define SCA3000_MEAS_MODE_MOT_DET 0x03 @@ -139,7 +139,7 @@ /* Values of mulipexed registers (write to ctrl_data after select) */ #define SCA3000_REG_ADDR_CTRL_DATA 0x22 -/* Measurment modes available on some sca3000 series chips. Code assumes others +/* Measurement modes available on some sca3000 series chips. Code assumes others * may become available in the future. * * Bypass - Bypass the low-pass filter in the signal channel so as to increase diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c index e27e3b7d1003..cedcaa2b3d1f 100644 --- a/drivers/staging/iio/accel/sca3000_core.c +++ b/drivers/staging/iio/accel/sca3000_core.c @@ -720,7 +720,7 @@ error_ret: static IIO_DEV_ATTR_TEMP(sca3000_read_temp); /** - * sca3000_show_thresh() sysfs query of a theshold + * sca3000_show_thresh() sysfs query of a threshold **/ static ssize_t sca3000_show_thresh(struct device *dev, struct device_attribute *attr, diff --git a/drivers/staging/octeon/cvmx-pow.h b/drivers/staging/octeon/cvmx-pow.h index c5d66f272b0d..bf9e069a898c 100644 --- a/drivers/staging/octeon/cvmx-pow.h +++ b/drivers/staging/octeon/cvmx-pow.h @@ -1959,7 +1959,7 @@ static inline uint32_t cvmx_pow_tag_get_hw_bits(uint64_t tag) * @buffer_size: * The size of the supplied buffer * - * Returns Zero on sucess, negative on failure + * Returns Zero on success, negative on failure */ extern int cvmx_pow_capture(void *buffer, int buffer_size); diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c index 81a851390f1b..535294105f65 100644 --- a/drivers/staging/octeon/ethernet-tx.c +++ b/drivers/staging/octeon/ethernet-tx.c @@ -624,7 +624,7 @@ int cvm_oct_transmit_qos(struct net_device *dev, void *work_queue_entry, EXPORT_SYMBOL(cvm_oct_transmit_qos); /** - * This function frees all skb that are currenty queued for TX. + * This function frees all skb that are currently queued for TX. * * @dev: Device being shutdown */ diff --git a/drivers/staging/otus/80211core/ccmd.c b/drivers/staging/otus/80211core/ccmd.c index 83dd8ba1328c..8da28eee7fb0 100644 --- a/drivers/staging/otus/80211core/ccmd.c +++ b/drivers/staging/otus/80211core/ccmd.c @@ -899,7 +899,7 @@ u16_t zfiWlanDisable(zdev_t *dev, u8_t ResetKeyCache) zfStaDisableSWEncryption(dev); } - /* Improve WEP/TKIP performace with HT AP, + /* Improve WEP/TKIP performance with HT AP, detail information please look bug#32495 */ /* zfHpSetTTSIFSTime(dev, 0x8); */ @@ -1407,7 +1407,7 @@ u16_t zfWlanReset(zdev_t *dev) zfStaDisableSWEncryption(dev); } - /* Improve WEP/TKIP performace with HT AP, + /* Improve WEP/TKIP performance with HT AP, detail information please look bug#32495 */ /* zfHpSetTTSIFSTime(dev, 0x8); */ diff --git a/drivers/staging/otus/80211core/cmm.c b/drivers/staging/otus/80211core/cmm.c index bed16b581a5f..a6c1b41ba848 100644 --- a/drivers/staging/otus/80211core/cmm.c +++ b/drivers/staging/otus/80211core/cmm.c @@ -1428,7 +1428,7 @@ void zfProcessManagement(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* AddInf { /* Beacon */ case ZM_WLAN_FRAME_TYPE_BEACON : - /* if enable 802.11h and current chanel is silent but receive beacon from other AP */ + /* if enable 802.11h and current channel is silent but receive beacon from other AP */ if (((wd->regulationTable.allowChannel[wd->regulationTable.CurChIndex].channelFlags & ZM_REG_FLAG_CHANNEL_CSA) != 0) && wd->sta.DFSEnable) { @@ -1469,7 +1469,7 @@ void zfProcessManagement(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* AddInf break; /* Probe response */ case ZM_WLAN_FRAME_TYPE_PROBERSP : - /* if enable 802.11h and current chanel is silent but receive probe response from other AP */ + /* if enable 802.11h and current channel is silent but receive probe response from other AP */ if (((wd->regulationTable.allowChannel[wd->regulationTable.CurChIndex].channelFlags & ZM_REG_FLAG_CHANNEL_CSA) != 0) && wd->sta.DFSEnable) { diff --git a/drivers/staging/otus/80211core/cmmsta.c b/drivers/staging/otus/80211core/cmmsta.c index b28a4e25e107..a11d559167b1 100644 --- a/drivers/staging/otus/80211core/cmmsta.c +++ b/drivers/staging/otus/80211core/cmmsta.c @@ -216,7 +216,7 @@ void zfStaConnectFail(zdev_t* dev, u16_t reason, u16_t* bssid, u8_t weight) /* Change internal state */ zfChangeAdapterState(dev, ZM_STA_STATE_DISCONNECT); - /* Improve WEP/TKIP performace with HT AP, detail information please look bug#32495 */ + /* Improve WEP/TKIP performance with HT AP, detail information please look bug#32495 */ //zfHpSetTTSIFSTime(dev, 0x8); /* Notify wrapper of connection status changes */ @@ -4148,7 +4148,7 @@ void zfInfraConnectNetwork(zdev_t* dev) wd->sta.bIsSharedKey = 0; } - /* Improve WEP/TKIP performace with HT AP, detail information please look bug#32495 */ + /* Improve WEP/TKIP performance with HT AP, detail information please look bug#32495 */ /* if ( (pBssInfo->broadcomHTAp == 1) && (wd->sta.SWEncryptEnable != 0) ) diff --git a/drivers/staging/otus/80211core/ctxrx.c b/drivers/staging/otus/80211core/ctxrx.c index e258a7df5363..ac54d5a636b0 100644 --- a/drivers/staging/otus/80211core/ctxrx.c +++ b/drivers/staging/otus/80211core/ctxrx.c @@ -3093,7 +3093,7 @@ u16_t zfWlanRxFilter(zdev_t* dev, zbuf_t* buf) frameType = zmw_rx_buf_readh(dev, buf, offset); - // Don't divide 2^4 because we don't want the fragementation pkt to be treated as + // Don't divide 2^4 because we don't want the fragmentation pkt to be treated as // duplicated frames seq = zmw_rx_buf_readh(dev, buf, offset+22); dst0 = zmw_rx_buf_readh(dev, buf, offset+4); diff --git a/drivers/staging/otus/80211core/pub_zfi.h b/drivers/staging/otus/80211core/pub_zfi.h index 60b7d1c56dee..b7b7f455f357 100644 --- a/drivers/staging/otus/80211core/pub_zfi.h +++ b/drivers/staging/otus/80211core/pub_zfi.h @@ -782,7 +782,7 @@ extern void zfiWlanSetDynamicSIFSParam(zdev_t* dev, u8_t val); /***** End of section 2 *****/ -/***** section 3 performace evaluation *****/ +/***** section 3 performance evaluation *****/ #ifdef ZM_ENABLE_PERFORMANCE_EVALUATION extern void zfiTxPerformanceMSDU(zdev_t* dev, u32_t tick); extern void zfiRxPerformanceMPDU(zdev_t* dev, zbuf_t* buf); diff --git a/drivers/staging/quatech_usb2/quatech_usb2.c b/drivers/staging/quatech_usb2/quatech_usb2.c index 2acef9466d47..f7726f1d3641 100644 --- a/drivers/staging/quatech_usb2/quatech_usb2.c +++ b/drivers/staging/quatech_usb2/quatech_usb2.c @@ -1670,7 +1670,7 @@ __func__); dbg("%s(): failed resubmitting read urb, error %d", __func__, result); } else { - dbg("%s() sucessfully resumitted read urb", __func__); + dbg("%s() successfully resubmitted read urb", __func__); if (tty_st && RxCount) { /* if some inbound data was processed, then * we need to push that through the tty layer diff --git a/drivers/staging/rar/rar_driver.c b/drivers/staging/rar/rar_driver.c index 9805d74bd341..d85d1890e81e 100644 --- a/drivers/staging/rar/rar_driver.c +++ b/drivers/staging/rar/rar_driver.c @@ -66,7 +66,7 @@ static int __init rar_init_handler(void); static void __exit rar_exit_handler(void); /* - function that is activated on the succesfull probe of the RAR device + function that is activated on the successfull probe of the RAR device */ static int __devinit rar_probe(struct pci_dev *pdev, const struct pci_device_id *ent); @@ -319,7 +319,7 @@ static int memrar_init_rar_params(struct pci_dev *pdev) } /* - function that is activaed on the succesfull probe of the RAR device + function that is activated on the successfull probe of the RAR device */ static int __devinit rar_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { diff --git a/drivers/staging/rt2860/sta/rtmp_data.c b/drivers/staging/rt2860/sta/rtmp_data.c index c50394759079..5d348e9d9b79 100644 --- a/drivers/staging/rt2860/sta/rtmp_data.c +++ b/drivers/staging/rt2860/sta/rtmp_data.c @@ -913,7 +913,7 @@ Arguments: pPacket Pointer to send packet Return Value: - NDIS_STATUS_SUCCESS If succes to queue the packet into TxSwQueue. + NDIS_STATUS_SUCCESS If success to queue the packet into TxSwQueue. NDIS_STATUS_FAILURE If failed to do en-queue. Note: diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c index 334e4c7ec61b..1fe19c39d702 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c @@ -1837,7 +1837,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, if (((ieee->current_network.wmm_info^info_element->data[6])& \ 0x0f)||(!ieee->init_wmmparam_flag)) { - //refresh paramete element for current network + // refresh parameter element for current network // update the register parameter for hardware ieee->init_wmmparam_flag = 1; queue_work(ieee->wq, &ieee->wmm_param_update_wq); @@ -1958,10 +1958,10 @@ associate_complete: * care of the ieee802.11 fragmentation. * So the driver receives a fragment per time and might * call the stop function when it want without take care - * to have enought room to TX an entire packet. + * to have enough room to TX an entire packet. * This might be useful if each fragment need it's own * descriptor, thus just keep a total free memory > than - * the max fragmentation treshold is not enought.. If the + * the max fragmentation threshold is not enough.. If the * ieee802.11 stack passed a TXB struct then you needed * to keep N free descriptors where * N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD diff --git a/drivers/staging/rtl8187se/r8180.h b/drivers/staging/rtl8187se/r8180.h index 35ed60be891a..1fd953036399 100644 --- a/drivers/staging/rtl8187se/r8180.h +++ b/drivers/staging/rtl8187se/r8180.h @@ -599,7 +599,7 @@ typedef struct r8180_priv u8 RSSI; char RxPower; u8 InitialGain; - //For adjust Dig Threshhold during Legacy/Leisure Power Save Mode + //For adjust Dig Threshold during Legacy/Leisure Power Save Mode u32 DozePeriodInPast2Sec; // Don't access BB/RF under disable PLL situation. u8 InitialGainBackUp; diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index 53e654d0d4fa..dfe5ed90739a 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c @@ -1848,7 +1848,7 @@ void rtl8180_rx(struct net_device *dev) sizeof(u8), PCI_DMA_FROMDEVICE); -drop: // this is used when we have not enought mem +drop: // this is used when we have not enough mem /* restore the descriptor */ *(priv->rxringtail+2)=priv->rxbuffer->dma; *(priv->rxringtail)=*(priv->rxringtail) &~ 0xfff; @@ -1919,8 +1919,8 @@ rate) /* * This function doesn't require lock because we make * sure it's called with the tx_lock already acquired. - * this come from the kernel's hard_xmit callback (trought - * the ieee stack, or from the try_wake_queue (again trought + * this come from the kernel's hard_xmit callback (through + * the ieee stack, or from the try_wake_queue (again through * the ieee stack. */ priority = AC2Q(skb->priority); @@ -3399,7 +3399,7 @@ void rtl8180_adapter_start(struct net_device *dev) /* The following is very strange. seems to be that 1 means test mode, but we need to acknolwledges the nic when a packet is ready - altought we set it to 0 + although we set it to 0 */ write_nic_byte(dev, @@ -4144,7 +4144,7 @@ void rtl8180_tx_isr(struct net_device *dev, int pri,short error) } /* we check all the descriptors between the head and the nic, - * but not the currenly pointed by the nic (the next to be txed) + * but not the currently pointed by the nic (the next to be txed) * and the previous of the pointed (might be in process ??) */ offs = (nic - nicbegin); diff --git a/drivers/staging/rtl8187se/r8180_dm.c b/drivers/staging/rtl8187se/r8180_dm.c index b6eeeeccff9e..e0c1606677d4 100644 --- a/drivers/staging/rtl8187se/r8180_dm.c +++ b/drivers/staging/rtl8187se/r8180_dm.c @@ -36,7 +36,7 @@ bool CheckHighPower(struct net_device *dev) // // Note: // The reason why we udpate Tx power level here instead of DoRxHighPower() -// is the number of IO to change Tx power is much more than chane TR switch +// is the number of IO to change Tx power is much more than channel TR switch // and they are related to OFDM and MAC registers. // So, we don't want to update it so frequently in per-Rx packet base. // @@ -1326,7 +1326,7 @@ SetAntenna8185( break; default: - printk("SetAntenna8185: unkown RFChipID(%d)\n", priv->rf_chip); + printk("SetAntenna8185: unknown RFChipID(%d)\n", priv->rf_chip); break; } break; @@ -1346,13 +1346,13 @@ SetAntenna8185( break; default: - printk("SetAntenna8185: unkown RFChipID(%d)\n", priv->rf_chip); + printk("SetAntenna8185: unknown RFChipID(%d)\n", priv->rf_chip); break; } break; default: - printk("SetAntenna8185: unkown u1bAntennaIndex(%d)\n", u1bAntennaIndex); + printk("SetAntenna8185: unknown u1bAntennaIndex(%d)\n", u1bAntennaIndex); break; } @@ -1448,7 +1448,7 @@ SwAntennaDiversity( priv->bAdSwitchedChecking = false; - // Adjust Rx signal strength threashold. + // Adjust Rx signal strength threshold. priv->AdRxSsThreshold = (priv->AdRxSignalStrength + priv->AdRxSsBeforeSwitched) / 2; priv->AdRxSsThreshold = (priv->AdRxSsThreshold > priv->AdMaxRxSsThreshold) ? @@ -1562,7 +1562,7 @@ SwAntennaDiversity( // priv->AdRxSignalStrength, priv->AdRxSsThreshold); priv->bAdSwitchedChecking = false; - // Increase Rx signal strength threashold if necessary. + // Increase Rx signal strength threshold if necessary. if( (priv->AdRxSignalStrength > (priv->AdRxSsThreshold + 10)) && // Signal is much stronger than current threshold priv->AdRxSsThreshold <= priv->AdMaxRxSsThreshold) // Current threhold is not yet reach upper limit. { diff --git a/drivers/staging/rtl8187se/r8180_rtl8225z2.c b/drivers/staging/rtl8187se/r8180_rtl8225z2.c index b648751cdaa3..60ee3bcb63ab 100644 --- a/drivers/staging/rtl8187se/r8180_rtl8225z2.c +++ b/drivers/staging/rtl8187se/r8180_rtl8225z2.c @@ -1058,7 +1058,7 @@ bool SetZebraRFPowerState8185(struct net_device *dev, break; default: bResult = false; - printk("SetZebraRFPowerState8185(): unknow state to set: 0x%X!!!\n", eRFPowerState); + printk("SetZebraRFPowerState8185(): unknown state to set: 0x%X!!!\n", eRFPowerState); break; } break; diff --git a/drivers/staging/rtl8187se/r8180_wx.c b/drivers/staging/rtl8187se/r8180_wx.c index 766892e31f52..536cb6e8e796 100644 --- a/drivers/staging/rtl8187se/r8180_wx.c +++ b/drivers/staging/rtl8187se/r8180_wx.c @@ -276,7 +276,7 @@ static int rtl8180_wx_get_range(struct net_device *dev, range->max_qual.updated = 7; /* Updated all three */ range->avg_qual.qual = 92; /* > 8% missed beacons is 'bad' */ - /* TODO: Find real 'good' to 'bad' threshol value for RSSI */ + /* TODO: Find real 'good' to 'bad' threshold value for RSSI */ range->avg_qual.level = 20 + -98; range->avg_qual.noise = 0; range->avg_qual.updated = 7; /* Updated all three */ diff --git a/drivers/staging/rtl8187se/r8185b_init.c b/drivers/staging/rtl8187se/r8185b_init.c index cd07059b25b5..bdb66d83778c 100644 --- a/drivers/staging/rtl8187se/r8185b_init.c +++ b/drivers/staging/rtl8187se/r8185b_init.c @@ -2493,8 +2493,8 @@ void rtl8185b_adapter_start(struct net_device *dev) PhyConfig8185(dev); // We assume RegWirelessMode has already been initialized before, - // however, we has to validate the wireless mode here and provide a reasonble - // initialized value if necessary. 2005.01.13, by rcnjko. + // however, we has to validate the wireless mode here and provide a + // reasonable initialized value if necessary. 2005.01.13, by rcnjko. SupportedWirelessMode = GetSupportedWirelessMode8185(dev); if( (ieee->mode != WIRELESS_MODE_B) && (ieee->mode != WIRELESS_MODE_G) && diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c index 12c2a18e1fa2..2644155737a8 100644 --- a/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c @@ -164,7 +164,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ieee->privacy_invoked = 0; ieee->ieee802_1x = 1; ieee->raw_tx = 0; - //ieee->hwsec_support = 1; //defalt support hw security. //use module_param instead. + //ieee->hwsec_support = 1; //default support hw security. //use module_param instead. ieee->hwsec_active = 0; //disable hwsec, switch it on when necessary. ieee80211_softmac_init(ieee); diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c index eae7c4579a68..593d22825184 100644 --- a/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c @@ -2330,10 +2330,10 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, * care of the ieee802.11 fragmentation. * So the driver receives a fragment per time and might * call the stop function when it want without take care - * to have enought room to TX an entire packet. + * to have enough room to TX an entire packet. * This might be useful if each fragment need it's own * descriptor, thus just keep a total free memory > than - * the max fragmentation treshold is not enought.. If the + * the max fragmentation threshold is not enough.. If the * ieee802.11 stack passed a TXB struct then you needed * to keep N free descriptors where * N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD diff --git a/drivers/staging/rtl8192e/r8190_rtl8256.c b/drivers/staging/rtl8192e/r8190_rtl8256.c index 0eaee3ad2230..3d67fbb65b96 100644 --- a/drivers/staging/rtl8192e/r8190_rtl8256.c +++ b/drivers/staging/rtl8192e/r8190_rtl8256.c @@ -629,7 +629,7 @@ SetRFPowerState8190( default: bResult = false; - RT_TRACE(COMP_ERR, "SetRFPowerState8190(): unknow state to set: 0x%X!!!\n", eRFPowerState); + RT_TRACE(COMP_ERR, "SetRFPowerState8190(): unknown state to set: 0x%X!!!\n", eRFPowerState); break; } diff --git a/drivers/staging/rtl8192e/r8192E_core.c b/drivers/staging/rtl8192e/r8192E_core.c index b0802a7aeb5f..ff8fe7e32a92 100644 --- a/drivers/staging/rtl8192e/r8192E_core.c +++ b/drivers/staging/rtl8192e/r8192E_core.c @@ -1041,7 +1041,7 @@ static void rtl8192_tx_isr(struct net_device *dev, int prio) tx_desc_819x_pci *entry = &ring->desc[ring->idx]; struct sk_buff *skb; - /* beacon packet will only use the first descriptor defautly, + /* beacon packet will only use the first descriptor defaultly, * and the OWN may not be cleared by the hardware * */ if(prio != BEACON_QUEUE) { @@ -2562,7 +2562,7 @@ static void rtl8192_read_eeprom_info(struct net_device* dev) priv->bTXPowerDataReadFromEEPORM = false; } - // 2007/11/15 MH 8190PCI Default=2T4R, 8192PCIE dafault=1T2R + // 2007/11/15 MH 8190PCI Default=2T4R, 8192PCIE default=1T2R priv->rf_type = RTL819X_DEFAULT_RF_TYPE; if(priv->card_8192_version > VERSION_8190_BD) @@ -3554,7 +3554,7 @@ void rtl8192_prepare_beacon(struct r8192_priv *priv) //spin_lock_irqsave(&priv->tx_lock,flags); /* prepare misc info for the beacon xmit */ tcb_desc->queue_index = BEACON_QUEUE; - /* IBSS does not support HT yet, use 1M defautly */ + /* IBSS does not support HT yet, use 1M defaultly */ tcb_desc->data_rate = 2; tcb_desc->RATRIndex = 7; tcb_desc->bTxDisableRateFallBack = 1; diff --git a/drivers/staging/rtl8192e/r8192E_dm.c b/drivers/staging/rtl8192e/r8192E_dm.c index bf876322dac2..5ffb4f74055b 100644 --- a/drivers/staging/rtl8192e/r8192E_dm.c +++ b/drivers/staging/rtl8192e/r8192E_dm.c @@ -455,7 +455,7 @@ static void dm_check_rate_adaptive(struct net_device * dev) (pra->low_rssi_thresh_for_ra40M):(pra->low_rssi_thresh_for_ra20M); } - //DbgPrint("[DM] THresh H/L=%d/%d\n\r", RATR.HighRSSIThreshForRA, RATR.LowRSSIThreshForRA); + //DbgPrint("[DM] Thresh H/L=%d/%d\n\r", RATR.HighRSSIThreshForRA, RATR.LowRSSIThreshForRA); if(priv->undecorated_smoothed_pwdb >= (long)HighRSSIThreshForRA) { //DbgPrint("[DM] RSSI=%d STA=HIGH\n\r", pHalData->UndecoratedSmoothedPWDB); @@ -571,7 +571,7 @@ static u32 OFDMSwingTable[OFDM_Table_Length] = { 0x5a400169, // 3, +3db 0x50800142, // 4, +2db 0x47c0011f, // 5, +1db - 0x40000100, // 6, +0db ===> default, upper for higher temprature, lower for low temprature + 0x40000100, // 6, +0db ===> default, upper for higher temperature, lower for low temperature 0x390000e4, // 7, -1db 0x32c000cb, // 8, -2db 0x2d4000b5, // 9, -3db @@ -932,14 +932,14 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device * dev) RT_TRACE(COMP_POWER_TRACKING, "Readback ThermalMeterA = %d \n", tmpRegA); if(tmpRegA < 3 || tmpRegA > 13) return; - if(tmpRegA >= 12) // if over 12, TP will be bad when high temprature + if(tmpRegA >= 12) // if over 12, TP will be bad when high temperature tmpRegA = 12; RT_TRACE(COMP_POWER_TRACKING, "Valid ThermalMeterA = %d \n", tmpRegA); priv->ThermalMeter[0] = ThermalMeterVal; //We use fixed value by Bryant's suggestion priv->ThermalMeter[1] = ThermalMeterVal; //We use fixed value by Bryant's suggestion - //Get current RF-A temprature index - if(priv->ThermalMeter[0] >= (u8)tmpRegA) //lower temprature + //Get current RF-A temperature index + if(priv->ThermalMeter[0] >= (u8)tmpRegA) //lower temperature { tmpOFDMindex = tmpCCK20Mindex = 6+(priv->ThermalMeter[0]-(u8)tmpRegA); tmpCCK40Mindex = tmpCCK20Mindex - 6; @@ -953,7 +953,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device * dev) else { tmpval = ((u8)tmpRegA - priv->ThermalMeter[0]); - if(tmpval >= 6) // higher temprature + if(tmpval >= 6) // higher temperature tmpOFDMindex = tmpCCK20Mindex = 0; // max to +6dB else tmpOFDMindex = tmpCCK20Mindex = 6 - tmpval; @@ -2017,7 +2017,7 @@ static void dm_dig_init(struct net_device *dev) dm_digtable.dbg_mode = DM_DBG_OFF; //off=by real rssi value, on=by DM_DigTable.Rssi_val for new dig dm_digtable.dig_algorithm_switch = 0; - /* 2007/10/04 MH Define init gain threshol. */ + /* 2007/10/04 MH Define init gain threshold. */ dm_digtable.dig_state = DM_STA_DIG_MAX; dm_digtable.dig_highpwr_state = DM_STA_DIG_MAX; dm_digtable.initialgain_lowerbound_state = false; @@ -2145,7 +2145,7 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( /*DbgPrint("DIG Check\n\r RSSI=%d LOW=%d HIGH=%d STATE=%d", pHalData->UndecoratedSmoothedPWDB, DM_DigTable.RssiLowThresh, DM_DigTable.RssiHighThresh, DM_DigTable.Dig_State);*/ - /* 1. When RSSI decrease, We have to judge if it is smaller than a treshold + /* 1. When RSSI decrease, We have to judge if it is smaller than a threshold and then execute below step. */ if ((priv->undecorated_smoothed_pwdb <= dm_digtable.rssi_low_thresh)) { @@ -2205,7 +2205,7 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( } - /* 2. When RSSI increase, We have to judge if it is larger than a treshold + /* 2. When RSSI increase, We have to judge if it is larger than a threshold and then execute below step. */ if ((priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh) ) { @@ -2314,7 +2314,7 @@ static void dm_ctrl_initgain_byrssi_highpwr( } /* 3. When RSSI >75% or <70%, it is a high power issue. We have to judge if - it is larger than a treshold and then execute below step. */ + it is larger than a threshold and then execute below step. */ // 2008/02/05 MH SD3-Jerry Modify PD_TH for high power issue. if (priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_power_highthresh) { diff --git a/drivers/staging/rtl8192e/r8192E_wx.c b/drivers/staging/rtl8192e/r8192E_wx.c index e9e799c22863..d1eb89229cdf 100644 --- a/drivers/staging/rtl8192e/r8192E_wx.c +++ b/drivers/staging/rtl8192e/r8192E_wx.c @@ -446,7 +446,7 @@ static int rtl8180_wx_get_range(struct net_device *dev, range->max_qual.updated = 7; /* Updated all three */ range->avg_qual.qual = 92; /* > 8% missed beacons is 'bad' */ - /* TODO: Find real 'good' to 'bad' threshol value for RSSI */ + /* TODO: Find real 'good' to 'bad' threshold value for RSSI */ range->avg_qual.level = 20 + -98; range->avg_qual.noise = 0; range->avg_qual.updated = 7; /* Updated all three */ diff --git a/drivers/staging/rtl8192e/r819xE_cmdpkt.c b/drivers/staging/rtl8192e/r819xE_cmdpkt.c index d6b7d2f39e3e..2aaa4e1bb375 100644 --- a/drivers/staging/rtl8192e/r819xE_cmdpkt.c +++ b/drivers/staging/rtl8192e/r819xE_cmdpkt.c @@ -783,7 +783,7 @@ u32 cmpk_message_handle_rx(struct net_device *dev, struct ieee80211_rx_stats *ps default: - RT_TRACE(COMP_EVENTS, "---->cmpk_message_handle_rx():unknow CMD Element\n"); + RT_TRACE(COMP_EVENTS, "---->cmpk_message_handle_rx():unknown CMD Element\n"); return 1; /* This is a command packet. */ } // 2007/01/22 MH Display received rx command packet info. diff --git a/drivers/staging/rtl8192e/r819xE_phyreg.h b/drivers/staging/rtl8192e/r819xE_phyreg.h index d4a439275eff..37f0feefaf2c 100644 --- a/drivers/staging/rtl8192e/r819xE_phyreg.h +++ b/drivers/staging/rtl8192e/r819xE_phyreg.h @@ -294,7 +294,7 @@ #define bR2RCCAMask 0x00000f00 #define bHSSI_R2TDelay 0xf8000000 #define bHSSI_T2RDelay 0xf80000 -#define bContTxHSSI 0x400 //chane gain at continue Tx +#define bContTxHSSI 0x400 //channel gain at continue Tx #define bIGFromCCK 0x200 #define bAGCAddress 0x3f #define bRxHPTx 0x7000 diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c index c3383bb8b760..e8c67d5dfb76 100644 --- a/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c @@ -156,7 +156,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ieee->privacy_invoked = 0; ieee->ieee802_1x = 1; ieee->raw_tx = 0; - //ieee->hwsec_support = 1; //defalt support hw security. //use module_param instead. + //ieee->hwsec_support = 1; //default support hw security. //use module_param instead. ieee->hwsec_active = 0; //disable hwsec, switch it on when necessary. ieee80211_softmac_init(ieee); diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c index fd8e11252f1b..203c0a5cc8c1 100644 --- a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c @@ -2120,10 +2120,10 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, * care of the ieee802.11 fragmentation. * So the driver receives a fragment per time and might * call the stop function when it want without take care - * to have enought room to TX an entire packet. + * to have enough room to TX an entire packet. * This might be useful if each fragment need it's own * descriptor, thus just keep a total free memory > than - * the max fragmentation treshold is not enought.. If the + * the max fragmentation threshold is not enough.. If the * ieee802.11 stack passed a TXB struct then you needed * to keep N free descriptors where * N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD diff --git a/drivers/staging/rtl8192su/ieee80211/readme b/drivers/staging/rtl8192su/ieee80211/readme index 5764f2859286..7ba177ba3e33 100644 --- a/drivers/staging/rtl8192su/ieee80211/readme +++ b/drivers/staging/rtl8192su/ieee80211/readme @@ -37,7 +37,7 @@ What this layer doesn't do (yet) disassociate clients, and it is really prone to always allow access. In bss client mode it is a bit rough with AP deauth and disassoc requests. - It has not any entry point to view the collected stats. -- Altought it takes care of the card supported rates in the management frame +- Although it takes care of the card supported rates in the management frame it sends, support for rate changing on TXed packet is not complete. - Give up once associated in bss client mode (it never detect a signal loss condition to disassociate and restart scanning) diff --git a/drivers/staging/rtl8192su/r8192S_phy.c b/drivers/staging/rtl8192su/r8192S_phy.c index 2c111d712f8f..77ab026288d3 100644 --- a/drivers/staging/rtl8192su/r8192S_phy.c +++ b/drivers/staging/rtl8192su/r8192S_phy.c @@ -1728,7 +1728,7 @@ static bool phy_SetRFPowerState8192SU(struct net_device* dev,RT_RF_POWER_STATE e default: bResult = FALSE; - //RT_ASSERT(FALSE, ("phy_SetRFPowerState8192SU(): unknow state to set: 0x%X!!!\n", eRFPowerState)); + //RT_ASSERT(FALSE, ("phy_SetRFPowerState8192SU(): unknown state to set: 0x%X!!!\n", eRFPowerState)); break; } break; @@ -2711,7 +2711,7 @@ u8 rtl8192_phy_SwChnl(struct net_device* dev, u8 channel) // However, this procedure is performed synchronously which should be running under // passive level. // -//not understant it +//not understand it void PHY_SwChnlPhy8192S( // Only called during initialize struct net_device* dev, u8 channel diff --git a/drivers/staging/rtl8192su/r8192S_phyreg.h b/drivers/staging/rtl8192su/r8192S_phyreg.h index acf644f430aa..2e4d76d196aa 100644 --- a/drivers/staging/rtl8192su/r8192S_phyreg.h +++ b/drivers/staging/rtl8192su/r8192S_phyreg.h @@ -453,7 +453,7 @@ #define bR2RCCAMask 0x00000f00 #define bHSSI_R2TDelay 0xf8000000 #define bHSSI_T2RDelay 0xf80000 -#define bContTxHSSI 0x400 //chane gain at continue Tx +#define bContTxHSSI 0x400 //channel gain at continue Tx #define bIGFromCCK 0x200 #define bAGCAddress 0x3f #define bRxHPTx 0x7000 diff --git a/drivers/staging/rtl8192su/r8192S_rtl6052.c b/drivers/staging/rtl8192su/r8192S_rtl6052.c index 69ef6dfc588b..22398099adae 100644 --- a/drivers/staging/rtl8192su/r8192S_rtl6052.c +++ b/drivers/staging/rtl8192su/r8192S_rtl6052.c @@ -326,7 +326,7 @@ extern void PHY_RF6052SetOFDMTxPower(struct net_device* dev, u8 powerlevel) // // If path A and Path B coexist, we must limit Path A tx power. - // Protect Path B pwr over or under flow. We need to calculate upper and + // Protect Path B pwr over or underflow. We need to calculate upper and // lower bound of path A tx power. // if (priv->rf_type == RF_2T2R) @@ -354,7 +354,7 @@ extern void PHY_RF6052SetOFDMTxPower(struct net_device* dev, u8 powerlevel) // // If path A and Path B coexist, we must limit Path A tx power. - // Protect Path B pwr over or under flow. We need to calculate upper and + // Protect Path B pwr under/over flow. We need to calculate upper and // lower bound of path A tx power. // if (priv->rf_type == RF_2T2R) diff --git a/drivers/staging/rtl8192su/r8192U_dm.c b/drivers/staging/rtl8192su/r8192U_dm.c index 5358ae8ba616..7891e9640272 100644 --- a/drivers/staging/rtl8192su/r8192U_dm.c +++ b/drivers/staging/rtl8192su/r8192U_dm.c @@ -593,7 +593,7 @@ static u32 OFDMSwingTable[OFDM_Table_Length] = { 0x5a400169, // 3, +3db 0x50800142, // 4, +2db 0x47c0011f, // 5, +1db - 0x40000100, // 6, +0db ===> default, upper for higher temprature, lower for low temprature + 0x40000100, // 6, +0db ===> default, upper for higher temperature, lower for low temperature 0x390000e4, // 7, -1db 0x32c000cb, // 8, -2db 0x2d4000b5, // 9, -3db @@ -912,14 +912,14 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device * dev) RT_TRACE(COMP_POWER_TRACKING, "Readback ThermalMeterA = %d \n", tmpRegA); if(tmpRegA < 3 || tmpRegA > 13) return; - if(tmpRegA >= 12) // if over 12, TP will be bad when high temprature + if(tmpRegA >= 12) // if over 12, TP will be bad when high temperature tmpRegA = 12; RT_TRACE(COMP_POWER_TRACKING, "Valid ThermalMeterA = %d \n", tmpRegA); priv->ThermalMeter[0] = ThermalMeterVal; //We use fixed value by Bryant's suggestion priv->ThermalMeter[1] = ThermalMeterVal; //We use fixed value by Bryant's suggestion - //Get current RF-A temprature index - if(priv->ThermalMeter[0] >= (u8)tmpRegA) //lower temprature + //Get current RF-A temperature index + if(priv->ThermalMeter[0] >= (u8)tmpRegA) //lower temperature { tmpOFDMindex = tmpCCK20Mindex = 6+(priv->ThermalMeter[0]-(u8)tmpRegA); tmpCCK40Mindex = tmpCCK20Mindex - 6; @@ -933,7 +933,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device * dev) else { tmpval = ((u8)tmpRegA - priv->ThermalMeter[0]); - if(tmpval >= 6) // higher temprature + if(tmpval >= 6) // higher temperature tmpOFDMindex = tmpCCK20Mindex = 0; // max to +6dB else tmpOFDMindex = tmpCCK20Mindex = 6 - tmpval; diff --git a/drivers/staging/rtl8192su/r8192U_wx.c b/drivers/staging/rtl8192su/r8192U_wx.c index 2208c9b1e726..a7cc6f9a4739 100644 --- a/drivers/staging/rtl8192su/r8192U_wx.c +++ b/drivers/staging/rtl8192su/r8192U_wx.c @@ -435,7 +435,7 @@ static int rtl8180_wx_get_range(struct net_device *dev, range->max_qual.updated = 7; /* Updated all three */ range->avg_qual.qual = 92; /* > 8% missed beacons is 'bad' */ - /* TODO: Find real 'good' to 'bad' threshol value for RSSI */ + /* TODO: Find real 'good' to 'bad' threshold value for RSSI */ range->avg_qual.level = 20 + -98; range->avg_qual.noise = 0; range->avg_qual.updated = 7; /* Updated all three */ diff --git a/drivers/staging/rtl8192su/r819xU_cmdpkt.c b/drivers/staging/rtl8192su/r819xU_cmdpkt.c index e2ba93e30757..3ebfe79bb663 100644 --- a/drivers/staging/rtl8192su/r819xU_cmdpkt.c +++ b/drivers/staging/rtl8192su/r819xU_cmdpkt.c @@ -697,7 +697,7 @@ cmpk_message_handle_rx( default: - RT_TRACE(COMP_ERR, "---->cmpk_message_handle_rx():unknow CMD Element\n"); + RT_TRACE(COMP_ERR, "---->cmpk_message_handle_rx():unknown CMD Element\n"); return 1; /* This is a command packet. */ } // 2007/01/22 MH Display received rx command packet info. diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c index 67c7d2ca7ca0..e7bc9ec63a8c 100644 --- a/drivers/staging/sep/sep_driver.c +++ b/drivers/staging/sep/sep_driver.c @@ -2449,7 +2449,7 @@ static void sep_configure_dma_burst(struct sep_device *sep) #endif /* - Function that is activaed on the succesful probe of the SEP device + Function that is activated on the successful probe of the SEP device */ static int __devinit sep_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c index 52af44cfbe83..060e9de3b065 100644 --- a/drivers/staging/serqt_usb2/serqt_usb2.c +++ b/drivers/staging/serqt_usb2/serqt_usb2.c @@ -929,7 +929,7 @@ static int qt_open(struct tty_struct *tty, dbg(__FILE__ "qt_setuart completed.\n"); /* - * Put this here to make it responsive to stty and defauls set by + * Put this here to make it responsive to stty and defaults set by * the tty layer */ /* FIXME: is this needed? */ diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 53450b48eaa6..0db8d7b6e79c 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -661,7 +661,7 @@ else if(zonetype!=pDevice->abyEEPROM[EEP_OFS_ZONETYPE]) printk("zonetype in file[%02x] mismatch with in EEPROM[%02x]\n",zonetype,pDevice->abyEEPROM[EEP_OFS_ZONETYPE]); else - printk("Read Zonetype file sucess,use default zonetype setting[%02x]\n",zonetype); + printk("Read Zonetype file success,use default zonetype setting[%02x]\n",zonetype); } } else diff --git a/drivers/staging/vt6655/ioctl.c b/drivers/staging/vt6655/ioctl.c index fc9cbe0acd64..d9a5fd21ab31 100644 --- a/drivers/staging/vt6655/ioctl.c +++ b/drivers/staging/vt6655/ioctl.c @@ -159,7 +159,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { else if(zonetype == 0x02) { //Europe sZoneTypeCmd.ZoneType = ZoneType_Europe; } - else { //Unknow ZoneType + else { //Unknown ZoneType printk("Error:ZoneType[%x] Unknown ???\n",zonetype); result = -EFAULT; break; @@ -692,7 +692,7 @@ if(wpa_Result.authenticated==TRUE) { wireless_send_event(pDevice->dev, IWEVCUSTOM, &wrqu, pItemSSID->abySSID); } #endif - pDevice->fWPA_Authened = TRUE; //is sucessful peer to wpa_Result.authenticated? + pDevice->fWPA_Authened = TRUE; //is successful peer to wpa_Result.authenticated? } //printk("get private wpa_supplicant announce WPA SM\n"); diff --git a/drivers/staging/vt6655/mib.h b/drivers/staging/vt6655/mib.h index 69e04f70b6c1..2aa2b91de72b 100644 --- a/drivers/staging/vt6655/mib.h +++ b/drivers/staging/vt6655/mib.h @@ -325,10 +325,10 @@ typedef struct tagSStatCounter { #ifdef Calcu_LinkQual //Tx count: ULONG TxNoRetryOkCount; //success tx no retry ! - ULONG TxRetryOkCount; //sucess tx but retry ! + ULONG TxRetryOkCount; //success tx but retry ! ULONG TxFailCount; //fail tx ? //Rx count: - ULONG RxOkCnt; //sucess rx ! + ULONG RxOkCnt; //success rx ! ULONG RxFcsErrCnt; //fail rx ? //statistic ULONG SignalStren; diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index 59a86e27f20d..7dc01dbfc6ff 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -1040,7 +1040,7 @@ else { if(pDevice->config_file.ZoneType !=pDevice->abyEEPROM[EEP_OFS_ZONETYPE]) printk("zonetype in file[%02x] mismatch with in EEPROM[%02x]\n",pDevice->config_file.ZoneType,pDevice->abyEEPROM[EEP_OFS_ZONETYPE]); else - printk("Read Zonetype file sucess,use default zonetype setting[%02x]\n",pDevice->config_file.ZoneType); + printk("Read Zonetype file success,use default zonetype setting[%02x]\n",pDevice->config_file.ZoneType); } } diff --git a/drivers/staging/vt6656/channel.c b/drivers/staging/vt6656/channel.c index e49796f7b814..f7136b0073bb 100644 --- a/drivers/staging/vt6656/channel.c +++ b/drivers/staging/vt6656/channel.c @@ -19,7 +19,7 @@ * * File: channel.c * - * Purpose: Channel number maping + * Purpose: Channel number mapping * * Author: Lucas Lin * diff --git a/drivers/staging/vt6656/ioctl.c b/drivers/staging/vt6656/ioctl.c index d94131fe5243..6f33005a615f 100644 --- a/drivers/staging/vt6656/ioctl.c +++ b/drivers/staging/vt6656/ioctl.c @@ -152,7 +152,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { else if(zonetype == 0x02) { //Europe sZoneTypeCmd.ZoneType = ZoneType_Europe; } - else { //Unknow ZoneType + else { //Unknown ZoneType printk("Error:ZoneType[%x] Unknown ???\n",zonetype); result = -EFAULT; break; @@ -679,7 +679,7 @@ if(wpa_Result.authenticated==TRUE) { wireless_send_event(pDevice->dev, IWEVCUSTOM, &wrqu, pItemSSID->abySSID); } #endif - pDevice->fWPA_Authened = TRUE; //is sucessful peer to wpa_Result.authenticated? + pDevice->fWPA_Authened = TRUE; //is successful peer to wpa_Result.authenticated? } //printk("get private wpa_supplicant announce WPA SM\n"); diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index aa8d1a2394a4..b7c6a22fe321 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -1724,7 +1724,7 @@ int iwctl_siwauth(struct net_device *dev, case IW_AUTH_WPA_ENABLED: //pDevice->bWPADEVUp = !! wrq->value; //if(pDevice->bWPADEVUp==TRUE) - // printk("iwctl_siwauth:set WPADEV to enable sucessful*******\n"); + // printk("iwctl_siwauth:set WPADEV to enable successful*******\n"); //else // printk("iwctl_siwauth:set WPADEV to enable fail?????\n"); break; diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 3c1efaa6e4b6..ef17c4958c67 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -1537,7 +1537,7 @@ if(result!=0) { return buffer; } -//return --->-1:fail; >=0:sucessful +//return --->-1:fail; >=0:successful static int Read_config_file(PSDevice pDevice) { int result=0; UCHAR tmpbuffer[100]; diff --git a/drivers/staging/vt6656/mib.h b/drivers/staging/vt6656/mib.h index b806b4d29717..ac996d2cd911 100644 --- a/drivers/staging/vt6656/mib.h +++ b/drivers/staging/vt6656/mib.h @@ -357,10 +357,10 @@ typedef struct tagSStatCounter { #ifdef Calcu_LinkQual //Tx count: ULONG TxNoRetryOkCount; //success tx no retry ! - ULONG TxRetryOkCount; //sucess tx but retry ! + ULONG TxRetryOkCount; //success tx but retry ! ULONG TxFailCount; //fail tx ? //Rx count: - ULONG RxOkCnt; //sucess rx ! + ULONG RxOkCnt; //success rx ! ULONG RxFcsErrCnt; //fail rx ? //statistic ULONG SignalStren; diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 0464093ed840..51b2dcfbab91 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -1331,7 +1331,7 @@ BSSvSecondTxData( } spin_lock_irq(&pDevice->lock); - //is wap_supplicant running sucessful OR only open && sharekey mode! + //is wap_supplicant running successful OR only open && sharekey mode! #if 1 if(((pDevice->bLinkPass ==TRUE)&&(pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || //open && sharekey linking (pDevice->fWPA_Authened == TRUE)) { //wpa linking -- GitLab From d44eb889ccf80e417794963e57cc40bd1519e554 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Mon, 9 Nov 2009 10:53:20 -0600 Subject: [PATCH 205/235] Staging: rtl8187se: Remove card8185 variable to simplify flow When this code is used for the rtl8187se, the value of card_8185 in struct r8180_priv is always 7 or 8. As a result, the program flow can be simplified. Signed-off-by: Larry Finger Tested-by: Bernhard Schiffner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/r8180.h | 17 -- drivers/staging/rtl8187se/r8180_core.c | 239 ++++---------------- drivers/staging/rtl8187se/r8180_dm.c | 1 - drivers/staging/rtl8187se/r8180_rtl8225z2.c | 46 ++-- drivers/staging/rtl8187se/r8185b_init.c | 29 +-- 5 files changed, 73 insertions(+), 259 deletions(-) diff --git a/drivers/staging/rtl8187se/r8180.h b/drivers/staging/rtl8187se/r8180.h index 1fd953036399..8b33fe006253 100644 --- a/drivers/staging/rtl8187se/r8180.h +++ b/drivers/staging/rtl8187se/r8180.h @@ -77,21 +77,6 @@ typedef enum _WIRELESS_MODE { WIRELESS_MODE_AUTO = 0x08, } WIRELESS_MODE; -typedef enum _VERSION_8185{ - // RTL8185 - VERSION_8185_UNKNOWN, - VERSION_8185_C, // C-cut - VERSION_8185_D, // D-cut - // RTL8185B - VERSION_8185B_B, // B-cut - VERSION_8185B_D, // D-cut - VERSION_8185B_E, // E-cut - //RTL8187S-PCIE - VERSION_8187S_B, // B-cut - VERSION_8187S_C, // C-cut - VERSION_8187S_D, // D-cut - -}VERSION_8185,*PVERSION_8185; typedef struct ChnlAccessSetting { u16 SIFS_Timer; u16 DIFS_Timer; @@ -341,8 +326,6 @@ typedef struct r8180_priv int irq; struct ieee80211_device *ieee80211; - short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D, 3:rtl8185B */ - short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */ short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */ short enable_gpio0; enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type; diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index dfe5ed90739a..585cf683a044 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c @@ -886,8 +886,6 @@ void rtl8180_rx_enable(struct net_device *dev) rxconf = rxconf | (1<card_8185 == 0) - rxconf = rxconf | (1<ieee80211->iw_mode == IW_MODE_MONITOR){ @@ -910,9 +908,6 @@ void rtl8180_rx_enable(struct net_device *dev) rxconf = rxconf &~ RCR_CS_MASK; - if (!priv->card_8185) - rxconf |= (priv->rcr_csense<card_8185) { - byte = read_nic_byte(dev,CW_CONF); - byte &= ~(1<card_8185) - txconf = txconf &~ (1<retry_rts<card_8185) { - if (priv->hw_plcp_len) - txconf = txconf &~ TCR_PLCP_LEN; - else - txconf = txconf | TCR_PLCP_LEN; - } else - txconf = txconf &~ TCR_SAT; + if (priv->hw_plcp_len) + txconf = txconf & ~TCR_PLCP_LEN; + else + txconf = txconf | TCR_PLCP_LEN; txconf = txconf &~ TCR_MXDMA_MASK; txconf = txconf | (TCR_MXDMA_2048<SignalQuality = quality; - if(!priv->card_8185) - printk("check your card type\n"); stats.signal = (u8)quality;//priv->wstats.qual.level = priv->SignalStrength; stats.signalstrength = RXAGC; @@ -2221,10 +2202,8 @@ short rtl8180_tx(struct net_device *dev, u8* txbuf, int len, int priority, *(tail+6) = 0; *(tail+7) = 0; - if(priv->card_8185){ - //FIXME: this should be triggered by HW encryption parameters. - *tail |= (1<<15); //no encrypt - } + /*FIXME: this should be triggered by HW encryption parameters.*/ + *tail |= (1<<15); /* no encrypt */ if(remain==len && !descfrag) { ownbit_flag = false; //added by david woo,2007.12.14 @@ -2266,7 +2245,7 @@ short rtl8180_tx(struct net_device *dev, u8* txbuf, int len, int priority, /* hw_plcp_len is not used for rtl8180 chip */ /* FIXME */ - if(priv->card_8185 == 0 || !priv->hw_plcp_len){ + if (!priv->hw_plcp_len) { duration = rtl8180_len2duration(len, rate, &ext); *(tail+1) = *(tail+1) | ((duration & 0x7fff)<<16); if(ext) *(tail+1) = *(tail+1) |(1<<31); //plcp length extension @@ -2355,8 +2334,7 @@ void rtl8180_link_change(struct net_device *dev) rtl8180_set_mode(dev, EPROM_CMD_NORMAL); - if(priv->card_8185) - rtl8180_set_chan(dev, priv->chan); + rtl8180_set_chan(dev, priv->chan); } void rtl8180_rq_tx_ack(struct net_device *dev){ @@ -2702,8 +2680,6 @@ short rtl8180_init(struct net_device *dev) struct r8180_priv *priv = ieee80211_priv(dev); u16 word; u16 version; - u8 hw_version; - //u8 config3; u32 usValue; u16 tmpu16; int i, j; @@ -2928,46 +2904,11 @@ short rtl8180_init(struct net_device *dev) priv->InitialGain = 6; - hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT; + DMESG("MAC controller is a RTL8187SE b/g"); + priv->phy_ver = 2; - switch (hw_version){ - case HW_VERID_R8185B_B: - priv->card_8185 = VERSION_8187S_C; - DMESG("MAC controller is a RTL8187SE b/g"); - priv->phy_ver = 2; - break; - case HW_VERID_R8185_ABC: - DMESG("MAC controller is a RTL8185 b/g"); - priv->card_8185 = 1; - /* you should not find a card with 8225 PHY ver < C*/ - priv->phy_ver = 2; - break; - case HW_VERID_R8185_D: - DMESG("MAC controller is a RTL8185 b/g (V. D)"); - priv->card_8185 = 2; - /* you should not find a card with 8225 PHY ver < C*/ - priv->phy_ver = 2; - break; - case HW_VERID_R8180_ABCD: - DMESG("MAC controller is a RTL8180"); - priv->card_8185 = 0; - break; - case HW_VERID_R8180_F: - DMESG("MAC controller is a RTL8180 (v. F)"); - priv->card_8185 = 0; - break; - default: - DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version); - priv->card_8185 = 0; - break; - } - - if(priv->card_8185){ - priv->ieee80211->modulation |= IEEE80211_OFDM_MODULATION; - priv->ieee80211->short_slot = 1; - } - /* you should not found any 8185 Ver B Card */ - priv->card_8185_Bversion = 0; + priv->ieee80211->modulation |= IEEE80211_OFDM_MODULATION; + priv->ieee80211->short_slot = 1; // just for sync 85 priv->card_type = PCI; @@ -3026,12 +2967,10 @@ short rtl8180_init(struct net_device *dev) priv->chtxpwr[i]=word & 0xff; priv->chtxpwr[i+1]=(word & 0xff00)>>8; } - if(priv->card_8185){ - for(i=1,j=0; i<14; i+=2,j++){ - word = eprom_read(dev,EPROM_TXPW_OFDM_CH1_2 + j); - priv->chtxpwr_ofdm[i]=word & 0xff; - priv->chtxpwr_ofdm[i+1]=(word & 0xff00)>>8; - } + for (i = 1, j = 0; i < 14; i += 2, j++) { + word = eprom_read(dev, EPROM_TXPW_OFDM_CH1_2 + j); + priv->chtxpwr_ofdm[i] = word & 0xff; + priv->chtxpwr_ofdm[i+1] = (word & 0xff00)>>8; } //3Read crystal calibtration and thermal meter indication on 87SE. @@ -3057,37 +2996,11 @@ short rtl8180_init(struct net_device *dev) version = eprom_read(dev,EPROM_VERSION); DMESG("EEPROM version %x",version); - if( (!priv->card_8185) && version < 0x0101){ - DMESG ("EEPROM version too old, assuming defaults"); - DMESG ("If you see this message *plase* send your \ -DMESG output to andreamrl@tiscali.it THANKS"); - priv->digphy=1; - priv->antb=0; - priv->diversity=1; - priv->cs_treshold=0xc; - priv->rcr_csense=1; - priv->rf_chip=RFCHIPID_PHILIPS; - }else{ - if(!priv->card_8185){ - u8 rfparam = eprom_read(dev,RF_PARAM); - DMESG("RfParam: %x",rfparam); + priv->rcr_csense = 3; - priv->digphy = rfparam & (1<antb = rfparam & (1<cs_treshold = (eprom_read(dev, ENERGY_TRESHOLD) & 0xff00) >> 8; - priv->rcr_csense = (rfparam & RF_PARAM_CARRIERSENSE_MASK) >> - RF_PARAM_CARRIERSENSE_SHIFT; - - priv->diversity = - (read_nic_byte(dev,CONFIG2)&(1<rcr_csense = 3; - } - - priv->cs_treshold = (eprom_read(dev,ENERGY_TRESHOLD)&0xff00) >>8; - - priv->rf_chip = 0xff & eprom_read(dev,RFCHIPID); - } + priv->rf_chip = 0xff & eprom_read(dev, RFCHIPID); priv->rf_chip = RF_ZEBRA4; priv->rf_sleep = rtl8225z4_rf_sleep; @@ -3099,19 +3012,6 @@ DMESG output to andreamrl@tiscali.it THANKS"); priv->rf_set_chan = rtl8225z2_rf_set_chan; priv->rf_set_sens = NULL; - if(!priv->card_8185){ - if(priv->antb) - DMESG ("Antenna B is default antenna"); - else - DMESG ("Antenna A is default antenna"); - - if(priv->diversity) - DMESG ("Antenna diversity is enabled"); - else - DMESG("Antenna diversity is disabled"); - - DMESG("Carrier sense %d",priv->rcr_csense); - } if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount)) return -ENOMEM; @@ -3144,17 +3044,6 @@ DMESG output to andreamrl@tiscali.it THANKS"); TX_BEACON_RING_ADDR)) return -ENOMEM; - if(!priv->card_8185){ - if(read_nic_byte(dev, CONFIG0) & (1<irq, (void *)rtl8180_interrupt, IRQF_SHARED, dev->name, dev)){ #else @@ -3172,17 +3061,6 @@ DMESG output to andreamrl@tiscali.it THANKS"); void rtl8180_no_hw_wep(struct net_device *dev) { - struct r8180_priv *priv = ieee80211_priv(dev); - - if (!priv->card_8185) { - u8 security; - - security = read_nic_byte(dev, SECURITY); - security &=~(1<card_8185){ - anaparam = eprom_read(dev,EPROM_ANAPARAM_ADDRLWORD); - anaparam |= eprom_read(dev,EPROM_ANAPARAM_ADDRHWORD)<<16; - - rtl8180_set_anaparam(dev,anaparam); - } /* These might be unnecessary since we do in rx_enable / tx_enable */ fix_rx_fifo(dev); fix_tx_fifo(dev); @@ -3406,54 +3276,27 @@ void rtl8180_adapter_start(struct net_device *dev) CONFIG2, read_nic_byte(dev,CONFIG2) &~\ (1<card_8185) - write_nic_byte(dev, + write_nic_byte(dev, CONFIG2, read_nic_byte(dev,CONFIG2)|(1<<4)); rtl8180_set_mode(dev,EPROM_CMD_NORMAL); write_nic_dword(dev,INT_TIMEOUT,0); - if(!priv->card_8185) - { - /* - experimental - this might be needed to calibrate AGC, - anyway it shouldn't hurt - */ - write_nic_byte(dev, CONFIG5, - read_nic_byte(dev, CONFIG5) | (1<card_8185){ - rtl8185_set_rate(dev); - write_nic_byte(dev, RATE_FALLBACK, 0x81); - }else{ - word = read_nic_word(dev, BRSR); - word &= ~BRSR_MBR; - word &= ~BRSR_BPLCP; - word |= ieeerate2rtlrate(priv->ieee80211->basic_rate); - word |= 0x0f; - write_nic_word(dev, BRSR, word); - } + rtl8185_set_rate(dev); + write_nic_byte(dev, RATE_FALLBACK, 0x81); - if(priv->card_8185){ - write_nic_byte(dev, GP_ENABLE,read_nic_byte(dev, GP_ENABLE) & ~(1<<6)); + write_nic_byte(dev, GP_ENABLE, read_nic_byte(dev, GP_ENABLE) & ~(1<<6)); - //FIXME cfg 3 ClkRun enable - isn't it ReadOnly ? - rtl8180_set_mode(dev, EPROM_CMD_CONFIG); - write_nic_byte(dev,CONFIG3, read_nic_byte(dev, CONFIG3) - | (1 << CONFIG3_CLKRUN_SHIFT)); - rtl8180_set_mode(dev, EPROM_CMD_NORMAL); - } + /*FIXME cfg 3 ClkRun enable - isn't it ReadOnly ? */ + rtl8180_set_mode(dev, EPROM_CMD_CONFIG); + write_nic_byte(dev, CONFIG3, read_nic_byte(dev, CONFIG3) + | (1 << CONFIG3_CLKRUN_SHIFT)); + rtl8180_set_mode(dev, EPROM_CMD_NORMAL); priv->rf_init(dev); diff --git a/drivers/staging/rtl8187se/r8180_dm.c b/drivers/staging/rtl8187se/r8180_dm.c index e0c1606677d4..cbca58db85e1 100644 --- a/drivers/staging/rtl8187se/r8180_dm.c +++ b/drivers/staging/rtl8187se/r8180_dm.c @@ -197,7 +197,6 @@ DIG_Zebra( { // Advised from SD3 DZ priv->InitialGain = 4; // In 87B, m74dBm means State 4 (m82dBm) } - //if(pHalData->VersionID != VERSION_8187B_B) { // Advised from SD3 DZ OfdmFA1 = 0x20; } diff --git a/drivers/staging/rtl8187se/r8180_rtl8225z2.c b/drivers/staging/rtl8187se/r8180_rtl8225z2.c index 60ee3bcb63ab..830a571be540 100644 --- a/drivers/staging/rtl8187se/r8180_rtl8225z2.c +++ b/drivers/staging/rtl8187se/r8180_rtl8225z2.c @@ -445,30 +445,28 @@ s8 DbmToTxPwrIdx(struct r8180_priv *priv, WIRELESS_MODE WirelessMode, * OFDM Power in dBm = Index * 0.5 + 0 * CCK Power in dBm = Index * 0.25 + 13 */ - if (priv->card_8185 >= VERSION_8187S_B) { - s32 tmp = 0; - - if (WirelessMode == WIRELESS_MODE_G) { - bUseDefault = false; - tmp = (2 * PowerInDbm); - - if (tmp < 0) - TxPwrIdx = 0; - else if (tmp > 40) /* 40 means 20 dBm. */ - TxPwrIdx = 40; - else - TxPwrIdx = (s8)tmp; - } else if (WirelessMode == WIRELESS_MODE_B) { - bUseDefault = false; - tmp = (4 * PowerInDbm) - 52; - - if(tmp < 0) - TxPwrIdx = 0; - else if (tmp > 28) /* 28 means 20 dBm. */ - TxPwrIdx = 28; - else - TxPwrIdx = (s8)tmp; - } + s32 tmp = 0; + + if (WirelessMode == WIRELESS_MODE_G) { + bUseDefault = false; + tmp = (2 * PowerInDbm); + + if (tmp < 0) + TxPwrIdx = 0; + else if (tmp > 40) /* 40 means 20 dBm. */ + TxPwrIdx = 40; + else + TxPwrIdx = (s8)tmp; + } else if (WirelessMode == WIRELESS_MODE_B) { + bUseDefault = false; + tmp = (4 * PowerInDbm) - 52; + + if (tmp < 0) + TxPwrIdx = 0; + else if (tmp > 28) /* 28 means 20 dBm. */ + TxPwrIdx = 28; + else + TxPwrIdx = (s8)tmp; } /* diff --git a/drivers/staging/rtl8187se/r8185b_init.c b/drivers/staging/rtl8187se/r8185b_init.c index bdb66d83778c..50309f2da9c1 100644 --- a/drivers/staging/rtl8187se/r8185b_init.c +++ b/drivers/staging/rtl8187se/r8185b_init.c @@ -1023,6 +1023,7 @@ ZEBRA_Config_85BASIC_HardCode( u32 addr,data; u32 u4bRegOffset, u4bRegValue, u4bRF23, u4bRF24; u8 u1b24E; + int d_cut = 0; //============================================================================= @@ -1035,8 +1036,10 @@ ZEBRA_Config_85BASIC_HardCode( u4bRF23= RF_ReadReg(dev, 0x08); mdelay(1); u4bRF24= RF_ReadReg(dev, 0x09); mdelay(1); - if (u4bRF23==0x818 && u4bRF24==0x70C && priv->card_8185 == VERSION_8187S_C) - priv->card_8185 = VERSION_8187S_D; + if (u4bRF23 == 0x818 && u4bRF24 == 0x70C) { + d_cut = 1; + printk(KERN_INFO "rtl8187se: card type changed from C- to D-cut\n"); + } // Page0 : reg0-reg15 @@ -1070,18 +1073,9 @@ ZEBRA_Config_85BASIC_HardCode( RF_WriteReg(dev, 0x03, 0x0806); mdelay(1); - if(priv->card_8185 < VERSION_8187S_C) - { - RF_WriteReg(dev, 0x04, 0x03f7); mdelay(1); - RF_WriteReg(dev, 0x05, 0x05ab); mdelay(1); - RF_WriteReg(dev, 0x06, 0x00c1); mdelay(1); - } - else - { - RF_WriteReg(dev, 0x04, 0x03a7); mdelay(1); - RF_WriteReg(dev, 0x05, 0x059b); mdelay(1); - RF_WriteReg(dev, 0x06, 0x0081); mdelay(1); - } + RF_WriteReg(dev, 0x04, 0x03a7); mdelay(1); + RF_WriteReg(dev, 0x05, 0x059b); mdelay(1); + RF_WriteReg(dev, 0x06, 0x0081); mdelay(1); RF_WriteReg(dev, 0x07, 0x01A0); mdelay(1); @@ -1091,14 +1085,11 @@ ZEBRA_Config_85BASIC_HardCode( RF_WriteReg(dev, 0x0a, 0x0001); mdelay(1); RF_WriteReg(dev, 0x0b, 0x0418); mdelay(1); - if(priv->card_8185 == VERSION_8187S_D) - { + if (d_cut) { RF_WriteReg(dev, 0x0c, 0x0fbe); mdelay(1); RF_WriteReg(dev, 0x0d, 0x0008); mdelay(1); RF_WriteReg(dev, 0x0e, 0x0807); mdelay(1); // RX LO buffer - } - else - { + } else { RF_WriteReg(dev, 0x0c, 0x0fbe); mdelay(1); RF_WriteReg(dev, 0x0d, 0x0008); mdelay(1); RF_WriteReg(dev, 0x0e, 0x0806); mdelay(1); // RX LO buffer -- GitLab From 8eee44dafdaaafaa0623c3ceaf4e507403365311 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Tue, 10 Nov 2009 16:44:47 -0600 Subject: [PATCH 206/235] Staging: rtl8187se: Remove card_type The vendor-written driver for the RTL8187SE has a private variable for the card type, even though it only occurs in PCI format. Signed-off-by: Larry Finger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/r8180.h | 1 - drivers/staging/rtl8187se/r8180_core.c | 9 ---- drivers/staging/rtl8187se/r8180_rtl8225z2.c | 53 +++++---------------- 3 files changed, 13 insertions(+), 50 deletions(-) diff --git a/drivers/staging/rtl8187se/r8180.h b/drivers/staging/rtl8187se/r8180.h index 8b33fe006253..ce828885b64f 100644 --- a/drivers/staging/rtl8187se/r8180.h +++ b/drivers/staging/rtl8187se/r8180.h @@ -328,7 +328,6 @@ typedef struct r8180_priv short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */ short enable_gpio0; - enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type; short hw_plcp_len; short plcp_preamble_mode; // 0:auto 1:short 2:long diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index 585cf683a044..57c62b0a402f 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c @@ -2911,8 +2911,6 @@ short rtl8180_init(struct net_device *dev) priv->ieee80211->short_slot = 1; // just for sync 85 - priv->card_type = PCI; - DMESG("This is a PCI NIC"); priv->enable_gpio0 = 0; usValue = eprom_read(dev, EEPROM_SW_REVD_OFFSET); @@ -3233,7 +3231,6 @@ void rtl8185_set_rate(struct net_device *dev) void rtl8180_adapter_start(struct net_device *dev) { struct r8180_priv *priv = ieee80211_priv(dev); - u8 config3; rtl8180_rtx_disable(dev); rtl8180_reset(dev); @@ -3247,12 +3244,6 @@ void rtl8180_adapter_start(struct net_device *dev) rtl8180_beacon_tx_disable(dev); - if(priv->card_type == CARDBUS ){ - config3=read_nic_byte(dev, CONFIG3); - write_nic_byte(dev,CONFIG3,config3 | CONFIG3_FuncRegEn); - write_nic_word(dev,FEMR, FEMR_INTR | FEMR_WKUP | FEMR_GWAKE | - read_nic_word(dev, FEMR)); - } rtl8180_set_mode(dev, EPROM_CMD_CONFIG); write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]); write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff ); diff --git a/drivers/staging/rtl8187se/r8180_rtl8225z2.c b/drivers/staging/rtl8187se/r8180_rtl8225z2.c index 830a571be540..afe10f0b75a8 100644 --- a/drivers/staging/rtl8187se/r8180_rtl8225z2.c +++ b/drivers/staging/rtl8187se/r8180_rtl8225z2.c @@ -23,7 +23,6 @@ static void write_rtl8225(struct net_device *dev, u8 adr, u16 data) u16 out, select; u8 bit; u32 bangdata = (data << 4) | (adr & 0xf); - struct r8180_priv *priv = ieee80211_priv(dev); out = read_nic_word(dev, RFPinsOutput) & 0xfff3; @@ -33,7 +32,7 @@ static void write_rtl8225(struct net_device *dev, u8 adr, u16 data) select = read_nic_word(dev, RFPinsSelect); write_nic_word(dev, RFPinsSelect, select | 0x7 | - ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO)); + SW_CONTROL_GPIO); force_pci_posting(dev); udelay(10); @@ -71,16 +70,11 @@ static void write_rtl8225(struct net_device *dev, u8 adr, u16 data) force_pci_posting(dev); udelay(10); - write_nic_word(dev, RFPinsOutput, out | - ((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN)); + write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN); - write_nic_word(dev, RFPinsSelect, select | - ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO)); + write_nic_word(dev, RFPinsSelect, select | SW_CONTROL_GPIO); - if (priv->card_type == USB) - mdelay(2); - else - rtl8185_rf_pins_enable(dev); + rtl8185_rf_pins_enable(dev); } static const u16 rtl8225bcd_rxgain[] = { @@ -174,15 +168,9 @@ static void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch) u8 cck_power_level = 0xff & priv->chtxpwr[ch]; u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch]; - if (priv->card_type == USB) { - max_cck_power_level = 11; - max_ofdm_power_level = 25; - min_ofdm_power_level = 10; - } else { - max_cck_power_level = 35; - max_ofdm_power_level = 35; - min_ofdm_power_level = 0; - } + max_cck_power_level = 35; + max_ofdm_power_level = 35; + min_ofdm_power_level = 0; if (cck_power_level > max_cck_power_level) cck_power_level = max_cck_power_level; @@ -629,8 +617,7 @@ void rtl8225z2_rf_init(struct net_device *dev) priv->chan = channel; - if (priv->card_type != USB) - rtl8225_host_pci_init(dev); + rtl8225_host_pci_init(dev); write_nic_dword(dev, RF_TIMING, 0x000a8008); @@ -653,7 +640,7 @@ void rtl8225z2_rf_init(struct net_device *dev) write_rtl8225(dev, 0x4, 0x8c3); mdelay(1); write_rtl8225(dev, 0x5, 0xc72); mdelay(1); write_rtl8225(dev, 0x6, 0xe6); mdelay(1); - write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1); + write_rtl8225(dev, 0x7, rtl8225_chan[channel]); mdelay(1); write_rtl8225(dev, 0x8, 0x3f); mdelay(1); write_rtl8225(dev, 0x9, 0x335); mdelay(1); write_rtl8225(dev, 0xa, 0x9d4); mdelay(1); @@ -679,13 +666,6 @@ void rtl8225z2_rf_init(struct net_device *dev) write_rtl8225(dev, 0x2, 0xc4d); - if (priv->card_type == USB) { - mdelay(200); - - write_rtl8225(dev, 0x2, 0x44d); - mdelay(100); - } - /* FIXME!! rtl8187 we have to check if calibrarion * is successful and eventually cal. again (repeat * the two write on reg 2) @@ -705,9 +685,6 @@ void rtl8225z2_rf_init(struct net_device *dev) write_rtl8225(dev, 0x0, 0x2bf); - if (priv->card_type != USB) - rtl8185_rf_pins_enable(dev); - for (i = 0; i < 128; i++) { data = rtl8225_agc[i]; @@ -724,7 +701,7 @@ void rtl8225z2_rf_init(struct net_device *dev) write_phy_ofdm(dev, 0x00, 0x01); mdelay(1); write_phy_ofdm(dev, 0x01, 0x02); mdelay(1); - write_phy_ofdm(dev, 0x02, ((priv->card_type == USB) ? 0x42 : 0x62)); mdelay(1); + write_phy_ofdm(dev, 0x02, 0x62); mdelay(1); write_phy_ofdm(dev, 0x03, 0x00); mdelay(1); write_phy_ofdm(dev, 0x04, 0x00); mdelay(1); write_phy_ofdm(dev, 0x05, 0x00); mdelay(1); @@ -772,7 +749,7 @@ void rtl8225z2_rf_init(struct net_device *dev) write_phy_cck(dev, 0x6, 0xfc); mdelay(1); write_phy_cck(dev, 0x7, 0x78); mdelay(1); write_phy_cck(dev, 0x8, 0x2e); mdelay(1); - write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1); + write_phy_cck(dev, 0x10, 0x93); mdelay(1); write_phy_cck(dev, 0x11, 0x88); mdelay(1); write_phy_cck(dev, 0x12, 0x47); mdelay(1); write_phy_cck(dev, 0x13, 0xd0); @@ -806,12 +783,8 @@ void rtl8225z2_rf_init(struct net_device *dev) /* switch to high-speed 3-wire * last digit. 2 for both cck and ofdm */ - if (priv->card_type == USB) - write_nic_dword(dev, 0x94, 0x3dc00002); - else { - write_nic_dword(dev, 0x94, 0x15c00002); - rtl8185_rf_pins_enable(dev); - } + write_nic_dword(dev, 0x94, 0x15c00002); + rtl8185_rf_pins_enable(dev); rtl8225_rf_set_chan(dev, priv->chan); } -- GitLab From ad988ba5c024ef5c96eed0387ff37e63b8c9f7e0 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Mon, 16 Nov 2009 23:35:38 -0600 Subject: [PATCH 207/235] Staging: rtl8187se: Rename staging driver to avoid name conflict with mainline driver Now that active development has begun on a mainline version of a driver for the RTL8187SE that should be called rtl8187se, there is a conflict with the driver in staging with the same name. To solve the conflict, rename the driver in staging to r8187se. Signed-off-by: Larry Finger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/Makefile | 2 +- drivers/staging/rtl8187se/Kconfig | 3 ++- drivers/staging/rtl8187se/Makefile | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 3c6135b4126c..edae7d681e6e 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -19,7 +19,7 @@ obj-$(CONFIG_COMEDI) += comedi/ obj-$(CONFIG_ASUS_OLED) += asus_oled/ obj-$(CONFIG_PANEL) += panel/ obj-$(CONFIG_ALTERA_PCIE_CHDMA) += altpciechdma/ -obj-$(CONFIG_RTL8187SE) += rtl8187se/ +obj-$(CONFIG_R8187SE) += rtl8187se/ obj-$(CONFIG_RTL8192SU) += rtl8192su/ obj-$(CONFIG_RTL8192E) += rtl8192e/ obj-$(CONFIG_INPUT_MIMIO) += mimio/ diff --git a/drivers/staging/rtl8187se/Kconfig b/drivers/staging/rtl8187se/Kconfig index 3211dd3765a0..e24a6f7a0d85 100644 --- a/drivers/staging/rtl8187se/Kconfig +++ b/drivers/staging/rtl8187se/Kconfig @@ -1,7 +1,8 @@ -config RTL8187SE +config R8187SE tristate "RealTek RTL8187SE Wireless LAN NIC driver" depends on PCI && WLAN select WIRELESS_EXT select WEXT_PRIV default N ---help--- + If built as a module, it will be called r8187se.ko. diff --git a/drivers/staging/rtl8187se/Makefile b/drivers/staging/rtl8187se/Makefile index ac35cffe5d4a..b395acf5a38e 100644 --- a/drivers/staging/rtl8187se/Makefile +++ b/drivers/staging/rtl8187se/Makefile @@ -16,7 +16,7 @@ EXTRA_CFLAGS += -DENABLE_LPS #EXTRA_CFLAGS += -mhard-float -DCONFIG_FORCE_HARD_FLOAT=y -rtl8187se-objs := \ +r8187se-objs := \ r8180_core.o \ r8180_93cx6.o \ r8180_wx.o \ @@ -35,5 +35,5 @@ rtl8187se-objs := \ ieee80211/ieee80211_crypt_ccmp.o \ ieee80211/ieee80211_crypt_wep.o -obj-$(CONFIG_RTL8187SE) += rtl8187se.o +obj-$(CONFIG_R8187SE) += r8187se.o -- GitLab From b491f147a142d21ea848c47331109630e07a73c8 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 18 Nov 2009 14:06:50 +0000 Subject: [PATCH 208/235] Staging: et131x: Kill MAC_IF_CTRL typedefs Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_address_map.h | 62 +++++++-------------- drivers/staging/et131x/et1310_mac.c | 17 +++--- 2 files changed, 29 insertions(+), 50 deletions(-) diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index d4652e9e1225..c9b6ffe13851 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h @@ -1451,49 +1451,25 @@ typedef struct _RXMAC_t { /* Location: */ /* * structure for Interface Control reg in mac address map. * located at address 0x5038 + * + * 31: reset if module + * 30-28: reserved + * 27: tbi mode + * 26: ghd mode + * 25: lhd mode + * 24: phy mode + * 23: reset per mii + * 22-17: reserved + * 16: speed + * 15: reset pe100x + * 14-11: reserved + * 10: force quiet + * 9: no cipher + * 8: disable link fail + * 7: reset gpsi + * 6-1: reserved + * 0: enable jabber protection */ -typedef union _MAC_IF_CTRL_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 reset_if_module:1; /* bit 31 */ - u32 reserved4:3; /* bit 28-30 */ - u32 tbi_mode:1; /* bit 27 */ - u32 ghd_mode:1; /* bit 26 */ - u32 lhd_mode:1; /* bit 25 */ - u32 phy_mode:1; /* bit 24 */ - u32 reset_per_mii:1; /* bit 23 */ - u32 reserved3:6; /* bits 17-22 */ - u32 speed:1; /* bit 16 */ - u32 reset_pe100x:1; /* bit 15 */ - u32 reserved2:4; /* bits 11-14 */ - u32 force_quiet:1; /* bit 10 */ - u32 no_cipher:1; /* bit 9 */ - u32 disable_link_fail:1; /* bit 8 */ - u32 reset_gpsi:1; /* bit 7 */ - u32 reserved1:6; /* bits 1-6 */ - u32 enab_jab_protect:1; /* bit 0 */ -#else - u32 enab_jab_protect:1; /* bit 0 */ - u32 reserved1:6; /* bits 1-6 */ - u32 reset_gpsi:1; /* bit 7 */ - u32 disable_link_fail:1; /* bit 8 */ - u32 no_cipher:1; /* bit 9 */ - u32 force_quiet:1; /* bit 10 */ - u32 reserved2:4; /* bits 11-14 */ - u32 reset_pe100x:1; /* bit 15 */ - u32 speed:1; /* bit 16 */ - u32 reserved3:6; /* bits 17-22 */ - u32 reset_per_mii:1; /* bit 23 */ - u32 phy_mode:1; /* bit 24 */ - u32 lhd_mode:1; /* bit 25 */ - u32 ghd_mode:1; /* bit 26 */ - u32 tbi_mode:1; /* bit 27 */ - u32 reserved4:3; /* bit 28-30 */ - u32 reset_if_module:1; /* bit 31 */ -#endif - } bits; -} MAC_IF_CTRL_t, *PMAC_IF_CTRL_t; /* * structure for Interface Status reg in mac address map. @@ -1588,7 +1564,7 @@ typedef struct _MAC_t { /* Location: */ u32 mii_mgmt_ctrl; /* 0x502C */ u32 mii_mgmt_stat; /* 0x5030 */ u32 mii_mgmt_indicator; /* 0x5034 */ - MAC_IF_CTRL_t if_ctrl; /* 0x5038 */ + u32 if_ctrl; /* 0x5038 */ MAC_IF_STAT_t if_stat; /* 0x503C */ MAC_STATION_ADDR1_t station_addr_1; /* 0x5040 */ MAC_STATION_ADDR2_t station_addr_2; /* 0x5044 */ diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c index ae7cee43a165..03c1f2238f2a 100644 --- a/drivers/staging/et131x/et1310_mac.c +++ b/drivers/staging/et131x/et1310_mac.c @@ -118,7 +118,7 @@ void ConfigMACRegs1(struct et131x_adapter *etdev) writel(0x00A1F037, &pMac->hfdp); /* Next lets configure the MAC Interface Control register */ - writel(0, &pMac->if_ctrl.value); + writel(0, &pMac->if_ctrl); /* Let's move on to setting up the mii management configuration */ writel(0x07, &pMac->mii_mgmt_cfg); /* Clock reset 0x7 */ @@ -162,22 +162,23 @@ void ConfigMACRegs2(struct et131x_adapter *etdev) struct _MAC_t __iomem *pMac = &etdev->regs->mac; u32 cfg1; u32 cfg2; - MAC_IF_CTRL_t ifctrl; + u32 ifctrl; TXMAC_CTL_t ctl; ctl.value = readl(&etdev->regs->txmac.ctl.value); cfg1 = readl(&pMac->cfg1); cfg2 = readl(&pMac->cfg2); - ifctrl.value = readl(&pMac->if_ctrl.value); + ifctrl = readl(&pMac->if_ctrl); /* Set up the if mode bits */ cfg2 &= ~0x300; if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS) { cfg2 |= 0x200; - ifctrl.bits.phy_mode = 0x0; + /* Phy mode bit */ + ifctrl &= ~(1 << 24); } else { cfg2 |= 0x100; - ifctrl.bits.phy_mode = 0x1; + ifctrl |= (1 << 24); } /* We need to enable Rx/Tx */ @@ -198,9 +199,11 @@ void ConfigMACRegs2(struct et131x_adapter *etdev) if (etdev->duplex_mode) cfg2 |= 0x01; - ifctrl.bits.ghd_mode = !etdev->duplex_mode; + ifctrl &= ~(1 << 26); + if (!etdev->duplex_mode) + ifctrl |= (1<<26); /* Enable ghd */ - writel(ifctrl.value, &pMac->if_ctrl.value); + writel(ifctrl, &pMac->if_ctrl); writel(cfg2, &pMac->cfg2); do { -- GitLab From ae8d9d845a31d168182b93a546f2d1ec3b1b4a82 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 18 Nov 2009 14:06:57 +0000 Subject: [PATCH 209/235] Staging: et131x: clean up MAC_STAT register One by one... Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_address_map.h | 164 +++++++------------- drivers/staging/et131x/et1310_mac.c | 99 +++--------- 2 files changed, 74 insertions(+), 189 deletions(-) diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index c9b6ffe13851..1f9c207c3859 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h @@ -1577,120 +1577,60 @@ typedef struct _MAC_t { /* Location: */ /* * structure for Carry Register One and it's Mask Register reg located in mac * stat address map address 0x6130 and 0x6138. + * + * 31: tr64 + * 30: tr127 + * 29: tr255 + * 28: tr511 + * 27: tr1k + * 26: trmax + * 25: trmgv + * 24-17: unused + * 16: rbyt + * 15: rpkt + * 14: rfcs + * 13: rmca + * 12: rbca + * 11: rxcf + * 10: rxpf + * 9: rxuo + * 8: raln + * 7: rflr + * 6: rcde + * 5: rcse + * 4: rund + * 3: rovr + * 2: rfrg + * 1: rjbr + * 0: rdrp */ -typedef union _MAC_STAT_REG_1_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 tr64:1; /* bit 31 */ - u32 tr127:1; /* bit 30 */ - u32 tr255:1; /* bit 29 */ - u32 tr511:1; /* bit 28 */ - u32 tr1k:1; /* bit 27 */ - u32 trmax:1; /* bit 26 */ - u32 trmgv:1; /* bit 25 */ - u32 unused:8; /* bits 17-24 */ - u32 rbyt:1; /* bit 16 */ - u32 rpkt:1; /* bit 15 */ - u32 rfcs:1; /* bit 14 */ - u32 rmca:1; /* bit 13 */ - u32 rbca:1; /* bit 12 */ - u32 rxcf:1; /* bit 11 */ - u32 rxpf:1; /* bit 10 */ - u32 rxuo:1; /* bit 9 */ - u32 raln:1; /* bit 8 */ - u32 rflr:1; /* bit 7 */ - u32 rcde:1; /* bit 6 */ - u32 rcse:1; /* bit 5 */ - u32 rund:1; /* bit 4 */ - u32 rovr:1; /* bit 3 */ - u32 rfrg:1; /* bit 2 */ - u32 rjbr:1; /* bit 1 */ - u32 rdrp:1; /* bit 0 */ -#else - u32 rdrp:1; /* bit 0 */ - u32 rjbr:1; /* bit 1 */ - u32 rfrg:1; /* bit 2 */ - u32 rovr:1; /* bit 3 */ - u32 rund:1; /* bit 4 */ - u32 rcse:1; /* bit 5 */ - u32 rcde:1; /* bit 6 */ - u32 rflr:1; /* bit 7 */ - u32 raln:1; /* bit 8 */ - u32 rxuo:1; /* bit 9 */ - u32 rxpf:1; /* bit 10 */ - u32 rxcf:1; /* bit 11 */ - u32 rbca:1; /* bit 12 */ - u32 rmca:1; /* bit 13 */ - u32 rfcs:1; /* bit 14 */ - u32 rpkt:1; /* bit 15 */ - u32 rbyt:1; /* bit 16 */ - u32 unused:8; /* bits 17-24 */ - u32 trmgv:1; /* bit 25 */ - u32 trmax:1; /* bit 26 */ - u32 tr1k:1; /* bit 27 */ - u32 tr511:1; /* bit 28 */ - u32 tr255:1; /* bit 29 */ - u32 tr127:1; /* bit 30 */ - u32 tr64:1; /* bit 31 */ -#endif - } bits; -} MAC_STAT_REG_1_t, *PMAC_STAT_REG_1_t; /* * structure for Carry Register Two Mask Register reg in mac stat address map. * located at address 0x613C + * + * 31-20: unused + * 19: tjbr + * 18: tfcs + * 17: txcf + * 16: tovr + * 15: tund + * 14: trfg + * 13: tbyt + * 12: tpkt + * 11: tmca + * 10: tbca + * 9: txpf + * 8: tdfr + * 7: tedf + * 6: tscl + * 5: tmcl + * 4: tlcl + * 3: txcl + * 2: tncl + * 1: tpfh + * 0: tdrp */ -typedef union _MAC_STAT_REG_2_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 unused:12; /* bit 20-31 */ - u32 tjbr:1; /* bit 19 */ - u32 tfcs:1; /* bit 18 */ - u32 txcf:1; /* bit 17 */ - u32 tovr:1; /* bit 16 */ - u32 tund:1; /* bit 15 */ - u32 tfrg:1; /* bit 14 */ - u32 tbyt:1; /* bit 13 */ - u32 tpkt:1; /* bit 12 */ - u32 tmca:1; /* bit 11 */ - u32 tbca:1; /* bit 10 */ - u32 txpf:1; /* bit 9 */ - u32 tdfr:1; /* bit 8 */ - u32 tedf:1; /* bit 7 */ - u32 tscl:1; /* bit 6 */ - u32 tmcl:1; /* bit 5 */ - u32 tlcl:1; /* bit 4 */ - u32 txcl:1; /* bit 3 */ - u32 tncl:1; /* bit 2 */ - u32 tpfh:1; /* bit 1 */ - u32 tdrp:1; /* bit 0 */ -#else - u32 tdrp:1; /* bit 0 */ - u32 tpfh:1; /* bit 1 */ - u32 tncl:1; /* bit 2 */ - u32 txcl:1; /* bit 3 */ - u32 tlcl:1; /* bit 4 */ - u32 tmcl:1; /* bit 5 */ - u32 tscl:1; /* bit 6 */ - u32 tedf:1; /* bit 7 */ - u32 tdfr:1; /* bit 8 */ - u32 txpf:1; /* bit 9 */ - u32 tbca:1; /* bit 10 */ - u32 tmca:1; /* bit 11 */ - u32 tpkt:1; /* bit 12 */ - u32 tbyt:1; /* bit 13 */ - u32 tfrg:1; /* bit 14 */ - u32 tund:1; /* bit 15 */ - u32 tovr:1; /* bit 16 */ - u32 txcf:1; /* bit 17 */ - u32 tfcs:1; /* bit 18 */ - u32 tjbr:1; /* bit 19 */ - u32 unused:12; /* bit 20-31 */ -#endif - } bits; -} MAC_STAT_REG_2_t, *PMAC_STAT_REG_2_t; /* * MAC STATS Module of JAGCore Address Mapping @@ -1831,16 +1771,16 @@ typedef struct _MAC_STAT_t { /* Location: */ u32 TFrg; /* 0x612C */ /* Carry Register One Register */ - MAC_STAT_REG_1_t Carry1; /* 0x6130 */ + u32 Carry1; /* 0x6130 */ /* Carry Register Two Register */ - MAC_STAT_REG_2_t Carry2; /* 0x6134 */ + u32 Carry2; /* 0x6134 */ /* Carry Register One Mask Register */ - MAC_STAT_REG_1_t Carry1M; /* 0x6138 */ + u32 Carry1M; /* 0x6138 */ /* Carry Register Two Mask Register */ - MAC_STAT_REG_2_t Carry2M; /* 0x613C */ + u32 Carry2M; /* 0x613C */ } MAC_STAT_t, *PMAC_STAT_t; /* END OF MAC STAT REGISTER ADDRESS MAP */ diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c index 03c1f2238f2a..8a199b05fa14 100644 --- a/drivers/staging/et131x/et1310_mac.c +++ b/drivers/staging/et131x/et1310_mac.c @@ -414,63 +414,8 @@ void ConfigMacStatRegs(struct et131x_adapter *etdev) * Initially this will be all counters. It may become clear later * that we do not need to track all counters. */ - { - MAC_STAT_REG_1_t Carry1M = { 0xffffffff }; - - Carry1M.bits.rdrp = 0; - Carry1M.bits.rjbr = 1; - Carry1M.bits.rfrg = 0; - Carry1M.bits.rovr = 0; - Carry1M.bits.rund = 1; - Carry1M.bits.rcse = 1; - Carry1M.bits.rcde = 0; - Carry1M.bits.rflr = 0; - Carry1M.bits.raln = 0; - Carry1M.bits.rxuo = 1; - Carry1M.bits.rxpf = 1; - Carry1M.bits.rxcf = 1; - Carry1M.bits.rbca = 1; - Carry1M.bits.rmca = 1; - Carry1M.bits.rfcs = 0; - Carry1M.bits.rpkt = 1; - Carry1M.bits.rbyt = 1; - Carry1M.bits.trmgv = 1; - Carry1M.bits.trmax = 1; - Carry1M.bits.tr1k = 1; - Carry1M.bits.tr511 = 1; - Carry1M.bits.tr255 = 1; - Carry1M.bits.tr127 = 1; - Carry1M.bits.tr64 = 1; - - writel(Carry1M.value, &pDevMacStat->Carry1M.value); - } - - { - MAC_STAT_REG_2_t Carry2M = { 0xffffffff }; - - Carry2M.bits.tdrp = 1; - Carry2M.bits.tpfh = 1; - Carry2M.bits.tncl = 0; - Carry2M.bits.txcl = 1; - Carry2M.bits.tlcl = 0; - Carry2M.bits.tmcl = 0; - Carry2M.bits.tscl = 0; - Carry2M.bits.tedf = 1; - Carry2M.bits.tdfr = 0; - Carry2M.bits.txpf = 1; - Carry2M.bits.tbca = 1; - Carry2M.bits.tmca = 1; - Carry2M.bits.tpkt = 1; - Carry2M.bits.tbyt = 1; - Carry2M.bits.tfrg = 1; - Carry2M.bits.tund = 0; - Carry2M.bits.tovr = 0; - Carry2M.bits.txcf = 1; - Carry2M.bits.tfcs = 1; - Carry2M.bits.tjbr = 1; - - writel(Carry2M.value, &pDevMacStat->Carry2M.value); - } + writel(0xFFFFBE32, &pDevMacStat->Carry1M); + writel(0xFFFE7E8B, &pDevMacStat->Carry2M); } void ConfigFlowControl(struct et131x_adapter *etdev) @@ -546,17 +491,17 @@ void UpdateMacStatHostCounters(struct et131x_adapter *etdev) */ void HandleMacStatInterrupt(struct et131x_adapter *etdev) { - MAC_STAT_REG_1_t Carry1; - MAC_STAT_REG_2_t Carry2; + u32 Carry1; + u32 Carry2; /* Read the interrupt bits from the register(s). These are Clear On * Write. */ - Carry1.value = readl(&etdev->regs->macStat.Carry1.value); - Carry2.value = readl(&etdev->regs->macStat.Carry2.value); + Carry1 = readl(&etdev->regs->macStat.Carry1); + Carry2 = readl(&etdev->regs->macStat.Carry2); - writel(Carry1.value, &etdev->regs->macStat.Carry1.value); - writel(Carry2.value, &etdev->regs->macStat.Carry2.value); + writel(Carry1, &etdev->regs->macStat.Carry1); + writel(Carry2, &etdev->regs->macStat.Carry2); /* We need to do update the host copy of all the MAC_STAT counters. * For each counter, check it's overflow bit. If the overflow bit is @@ -564,33 +509,33 @@ void HandleMacStatInterrupt(struct et131x_adapter *etdev) * revolution of the counter. This routine is called when the counter * block indicates that one of the counters has wrapped. */ - if (Carry1.bits.rfcs) + if (Carry1 & (1 << 14)) etdev->Stats.code_violations += COUNTER_WRAP_16_BIT; - if (Carry1.bits.raln) + if (Carry1 & (1 << 8)) etdev->Stats.alignment_err += COUNTER_WRAP_12_BIT; - if (Carry1.bits.rflr) + if (Carry1 & (1 << 7)) etdev->Stats.length_err += COUNTER_WRAP_16_BIT; - if (Carry1.bits.rfrg) + if (Carry1 & (1 << 2)) etdev->Stats.other_errors += COUNTER_WRAP_16_BIT; - if (Carry1.bits.rcde) + if (Carry1 & (1 << 6)) etdev->Stats.crc_err += COUNTER_WRAP_16_BIT; - if (Carry1.bits.rovr) + if (Carry1 & (1 << 3)) etdev->Stats.rx_ov_flow += COUNTER_WRAP_16_BIT; - if (Carry1.bits.rdrp) + if (Carry1 & (1 << 0)) etdev->Stats.norcvbuf += COUNTER_WRAP_16_BIT; - if (Carry2.bits.tovr) + if (Carry2 & (1 << 16)) etdev->Stats.max_pkt_error += COUNTER_WRAP_12_BIT; - if (Carry2.bits.tund) + if (Carry2 & (1 << 15)) etdev->Stats.tx_uflo += COUNTER_WRAP_12_BIT; - if (Carry2.bits.tscl) + if (Carry2 & (1 << 6)) etdev->Stats.first_collision += COUNTER_WRAP_12_BIT; - if (Carry2.bits.tdfr) + if (Carry2 & (1 << 8)) etdev->Stats.tx_deferred += COUNTER_WRAP_12_BIT; - if (Carry2.bits.tmcl) + if (Carry2 & (1 << 5)) etdev->Stats.excessive_collisions += COUNTER_WRAP_12_BIT; - if (Carry2.bits.tlcl) + if (Carry2 & (1 << 4)) etdev->Stats.late_collisions += COUNTER_WRAP_12_BIT; - if (Carry2.bits.tncl) + if (Carry2 & (1 << 2)) etdev->Stats.collisions += COUNTER_WRAP_12_BIT; } -- GitLab From 74f38633f2827451e5f8a44a3508b467ccfad5af Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 18 Nov 2009 14:07:03 +0000 Subject: [PATCH 210/235] Staging: et131x: clean up mac stat names Might as well use something short and obvious Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_mac.c | 92 ++++++++++++++--------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c index 8a199b05fa14..6563b7d9162a 100644 --- a/drivers/staging/et131x/et1310_mac.c +++ b/drivers/staging/et131x/et1310_mac.c @@ -388,34 +388,34 @@ void ConfigTxMacRegs(struct et131x_adapter *etdev) void ConfigMacStatRegs(struct et131x_adapter *etdev) { - struct _MAC_STAT_t __iomem *pDevMacStat = + struct _MAC_STAT_t __iomem *macstat = &etdev->regs->macStat; /* Next we need to initialize all the MAC_STAT registers to zero on * the device. */ - writel(0, &pDevMacStat->RFcs); - writel(0, &pDevMacStat->RAln); - writel(0, &pDevMacStat->RFlr); - writel(0, &pDevMacStat->RDrp); - writel(0, &pDevMacStat->RCde); - writel(0, &pDevMacStat->ROvr); - writel(0, &pDevMacStat->RFrg); - - writel(0, &pDevMacStat->TScl); - writel(0, &pDevMacStat->TDfr); - writel(0, &pDevMacStat->TMcl); - writel(0, &pDevMacStat->TLcl); - writel(0, &pDevMacStat->TNcl); - writel(0, &pDevMacStat->TOvr); - writel(0, &pDevMacStat->TUnd); + writel(0, &macstat->RFcs); + writel(0, &macstat->RAln); + writel(0, &macstat->RFlr); + writel(0, &macstat->RDrp); + writel(0, &macstat->RCde); + writel(0, &macstat->ROvr); + writel(0, &macstat->RFrg); + + writel(0, &macstat->TScl); + writel(0, &macstat->TDfr); + writel(0, &macstat->TMcl); + writel(0, &macstat->TLcl); + writel(0, &macstat->TNcl); + writel(0, &macstat->TOvr); + writel(0, &macstat->TUnd); /* Unmask any counters that we want to track the overflow of. * Initially this will be all counters. It may become clear later * that we do not need to track all counters. */ - writel(0xFFFFBE32, &pDevMacStat->Carry1M); - writel(0xFFFE7E8B, &pDevMacStat->Carry2M); + writel(0xFFFFBE32, &macstat->Carry1M); + writel(0xFFFE7E8B, &macstat->Carry2M); } void ConfigFlowControl(struct et131x_adapter *etdev) @@ -423,28 +423,28 @@ void ConfigFlowControl(struct et131x_adapter *etdev) if (etdev->duplex_mode == 0) { etdev->FlowControl = None; } else { - char RemotePause, RemoteAsyncPause; + char remote_pause, remote_async_pause; ET1310_PhyAccessMiBit(etdev, - TRUEPHY_BIT_READ, 5, 10, &RemotePause); + TRUEPHY_BIT_READ, 5, 10, &remote_pause); ET1310_PhyAccessMiBit(etdev, TRUEPHY_BIT_READ, 5, 11, - &RemoteAsyncPause); + &remote_async_pause); - if ((RemotePause == TRUEPHY_BIT_SET) && - (RemoteAsyncPause == TRUEPHY_BIT_SET)) { + if ((remote_pause == TRUEPHY_BIT_SET) && + (remote_async_pause == TRUEPHY_BIT_SET)) { etdev->FlowControl = etdev->RegistryFlowControl; - } else if ((RemotePause == TRUEPHY_BIT_SET) && - (RemoteAsyncPause == TRUEPHY_BIT_CLEAR)) { + } else if ((remote_pause == TRUEPHY_BIT_SET) && + (remote_async_pause == TRUEPHY_BIT_CLEAR)) { if (etdev->RegistryFlowControl == Both) etdev->FlowControl = Both; else etdev->FlowControl = None; - } else if ((RemotePause == TRUEPHY_BIT_CLEAR) && - (RemoteAsyncPause == TRUEPHY_BIT_CLEAR)) { + } else if ((remote_pause == TRUEPHY_BIT_CLEAR) && + (remote_async_pause == TRUEPHY_BIT_CLEAR)) { etdev->FlowControl = None; - } else {/* if (RemotePause == TRUEPHY_CLEAR_BIT && - RemoteAsyncPause == TRUEPHY_SET_BIT) */ + } else {/* if (remote_pause == TRUEPHY_CLEAR_BIT && + remote_async_pause == TRUEPHY_SET_BIT) */ if (etdev->RegistryFlowControl == Both) etdev->FlowControl = RxOnly; else @@ -460,25 +460,25 @@ void ConfigFlowControl(struct et131x_adapter *etdev) void UpdateMacStatHostCounters(struct et131x_adapter *etdev) { struct _ce_stats_t *stats = &etdev->Stats; - struct _MAC_STAT_t __iomem *pDevMacStat = + struct _MAC_STAT_t __iomem *macstat = &etdev->regs->macStat; - stats->collisions += readl(&pDevMacStat->TNcl); - stats->first_collision += readl(&pDevMacStat->TScl); - stats->tx_deferred += readl(&pDevMacStat->TDfr); - stats->excessive_collisions += readl(&pDevMacStat->TMcl); - stats->late_collisions += readl(&pDevMacStat->TLcl); - stats->tx_uflo += readl(&pDevMacStat->TUnd); - stats->max_pkt_error += readl(&pDevMacStat->TOvr); - - stats->alignment_err += readl(&pDevMacStat->RAln); - stats->crc_err += readl(&pDevMacStat->RCde); - stats->norcvbuf += readl(&pDevMacStat->RDrp); - stats->rx_ov_flow += readl(&pDevMacStat->ROvr); - stats->code_violations += readl(&pDevMacStat->RFcs); - stats->length_err += readl(&pDevMacStat->RFlr); - - stats->other_errors += readl(&pDevMacStat->RFrg); + stats->collisions += readl(&macstat->TNcl); + stats->first_collision += readl(&macstat->TScl); + stats->tx_deferred += readl(&macstat->TDfr); + stats->excessive_collisions += readl(&macstat->TMcl); + stats->late_collisions += readl(&macstat->TLcl); + stats->tx_uflo += readl(&macstat->TUnd); + stats->max_pkt_error += readl(&macstat->TOvr); + + stats->alignment_err += readl(&macstat->RAln); + stats->crc_err += readl(&macstat->RCde); + stats->norcvbuf += readl(&macstat->RDrp); + stats->rx_ov_flow += readl(&macstat->ROvr); + stats->code_violations += readl(&macstat->RFcs); + stats->length_err += readl(&macstat->RFlr); + + stats->other_errors += readl(&macstat->RFrg); } /** -- GitLab From f838cabdb27a7f3c28c186360865cf5118c469a6 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 18 Nov 2009 14:07:09 +0000 Subject: [PATCH 211/235] Staging: et131x: kill TXTEST and TXFILL, clean up CF_PARAM Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_address_map.h | 57 +++++---------------- drivers/staging/et131x/et1310_mac.c | 12 ++--- drivers/staging/et131x/et131x_adapter.h | 2 +- drivers/staging/et131x/et131x_isr.c | 5 +- 4 files changed, 19 insertions(+), 57 deletions(-) diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index 1f9c207c3859..9fa8628f81f5 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h @@ -727,59 +727,26 @@ typedef union _TXMAC_ERR_CNT_t { /* * structure for max fill reg in txmac address map * located at address 0x300C + * 31-12: unused + * 11-0: max fill */ -typedef union _TXMAC_MAX_FILL_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 unused:20; /* bits 12-31 */ - u32 max_fill:12; /* bits 0-11 */ -#else - u32 max_fill:12; /* bits 0-11 */ - u32 unused:20; /* bits 12-31 */ -#endif - } bits; -} TXMAC_MAX_FILL_t, *PTXMAC_MAX_FILL_t; /* * structure for cf parameter reg in txmac address map * located at address 0x3010 + * 31-16: cfep + * 15-0: cfpt */ -typedef union _TXMAC_CF_PARAM_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 cfep:16; /* bits 16-31 */ - u32 cfpt:16; /* bits 0-15 */ -#else - u32 cfpt:16; /* bits 0-15 */ - u32 cfep:16; /* bits 16-31 */ -#endif - } bits; -} TXMAC_CF_PARAM_t, *PTXMAC_CF_PARAM_t; /* * structure for tx test reg in txmac address map * located at address 0x3014 + * 31-17: unused + * 16: reserved1 + * 15: txtest_en + * 14-11: unused + * 10-0: txq test pointer */ -typedef union _TXMAC_TXTEST_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 unused2:15; /* bits 17-31 */ - u32 reserved1:1; /* bit 16 */ - u32 txtest_en:1; /* bit 15 */ - u32 unused1:4; /* bits 11-14 */ - u32 txqtest_ptr:11; /* bits 0-11 */ -#else - u32 txqtest_ptr:11; /* bits 0-10 */ - u32 unused1:4; /* bits 11-14 */ - u32 txtest_en:1; /* bit 15 */ - u32 reserved1:1; /* bit 16 */ - u32 unused2:15; /* bits 17-31 */ -#endif - } bits; -} TXMAC_TXTEST_t, *PTXMAC_TXTEST_t; /* * structure for error reg in txmac address map @@ -869,9 +836,9 @@ typedef struct _TXMAC_t { /* Location: */ TXMAC_CTL_t ctl; /* 0x3000 */ TXMAC_SHADOW_PTR_t shadow_ptr; /* 0x3004 */ TXMAC_ERR_CNT_t err_cnt; /* 0x3008 */ - TXMAC_MAX_FILL_t max_fill; /* 0x300C */ - TXMAC_CF_PARAM_t cf_param; /* 0x3010 */ - TXMAC_TXTEST_t tx_test; /* 0x3014 */ + u32 max_fill; /* 0x300C */ + u32 cf_param; /* 0x3010 */ + u32 tx_test; /* 0x3014 */ TXMAC_ERR_t err; /* 0x3018 */ TXMAC_ERR_INT_t err_int; /* 0x301C */ TXMAC_BP_CTRL_t bp_ctrl; /* 0x3020 */ diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c index 6563b7d9162a..b8a1f2037314 100644 --- a/drivers/staging/et131x/et1310_mac.c +++ b/drivers/staging/et131x/et1310_mac.c @@ -371,19 +371,15 @@ void ConfigRxMacRegs(struct et131x_adapter *etdev) void ConfigTxMacRegs(struct et131x_adapter *etdev) { struct _TXMAC_t __iomem *pTxMac = &etdev->regs->txmac; - TXMAC_CF_PARAM_t Local; /* We need to update the Control Frame Parameters * cfpt - control frame pause timer set to 64 (0x40) * cfep - control frame extended pause timer set to 0x0 */ - if (etdev->FlowControl == None) { - writel(0, &pTxMac->cf_param.value); - } else { - Local.bits.cfpt = 0x40; - Local.bits.cfep = 0x0; - writel(Local.value, &pTxMac->cf_param.value); - } + if (etdev->FlowControl == None) + writel(0, &pTxMac->cf_param); + else + writel(0x40, &pTxMac->cf_param); } void ConfigMacStatRegs(struct et131x_adapter *etdev) diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h index 81109b302cf5..ed35f8afdd41 100644 --- a/drivers/staging/et131x/et131x_adapter.h +++ b/drivers/staging/et131x/et131x_adapter.h @@ -214,7 +214,7 @@ struct et131x_adapter { u8 MCList[NIC_MAX_MCAST_LIST][ETH_ALEN]; /* MAC test */ - TXMAC_TXTEST_t TxMacTest; + u32 TxMacTest; /* Pointer to the device's PCI register space */ ADDRESS_MAP_t __iomem *regs; diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c index ccd9bc22e185..486abe47dfc7 100644 --- a/drivers/staging/et131x/et131x_isr.c +++ b/drivers/staging/et131x/et131x_isr.c @@ -337,11 +337,10 @@ void et131x_isr_handler(struct work_struct *work) */ /* TRAP();*/ - etdev->TxMacTest.value = - readl(&iomem->txmac.tx_test.value); + etdev->TxMacTest = readl(&iomem->txmac.tx_test); dev_warn(&etdev->pdev->dev, "RxDMA_ERR interrupt, error %x\n", - etdev->TxMacTest.value); + etdev->TxMacTest); } /* Handle the Wake on LAN Event */ -- GitLab From d97aabcd0ea6dd3375747b1e02b9164c4064880d Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 18 Nov 2009 14:07:15 +0000 Subject: [PATCH 212/235] Staging: et131x: kill TxMacTest field It's really a local in the interrupt handler Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et131x_adapter.h | 3 --- drivers/staging/et131x/et131x_isr.c | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/et131x/et131x_adapter.h b/drivers/staging/et131x/et131x_adapter.h index ed35f8afdd41..3f7f37a56b6c 100644 --- a/drivers/staging/et131x/et131x_adapter.h +++ b/drivers/staging/et131x/et131x_adapter.h @@ -213,9 +213,6 @@ struct et131x_adapter { u32 MCAddressCount; u8 MCList[NIC_MAX_MCAST_LIST][ETH_ALEN]; - /* MAC test */ - u32 TxMacTest; - /* Pointer to the device's PCI register space */ ADDRESS_MAP_t __iomem *regs; diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c index 486abe47dfc7..3aeac7b92281 100644 --- a/drivers/staging/et131x/et131x_isr.c +++ b/drivers/staging/et131x/et131x_isr.c @@ -337,10 +337,9 @@ void et131x_isr_handler(struct work_struct *work) */ /* TRAP();*/ - etdev->TxMacTest = readl(&iomem->txmac.tx_test); dev_warn(&etdev->pdev->dev, "RxDMA_ERR interrupt, error %x\n", - etdev->TxMacTest); + readl(&iomem->txmac.tx_test)); } /* Handle the Wake on LAN Event */ -- GitLab From 42a03e98d1a691bb66bd9fde021aa9c95bce1cd6 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 18 Nov 2009 14:07:21 +0000 Subject: [PATCH 213/235] Staging: et131x: kill TX_PR_NUM_DES_t Yes folks it another unused typedef.. This completes the clean up of the TX DMA typedefs Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_address_map.h | 18 ++++-------------- drivers/staging/et131x/et1310_tx.c | 2 +- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index 9fa8628f81f5..8b514a0acc1c 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h @@ -198,20 +198,10 @@ typedef struct _GLOBAL_t { /* Location: */ /* * structure for txdma packet ring number of descriptor reg in txdma address * map. Located at address 0x100C + * + * 31-10: unused + * 9-0: pr ndes */ -typedef union _TXDMA_PR_NUM_DES_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 unused:22; /* bits 10-31 */ - u32 pr_ndes:10; /* bits 0-9 */ -#else - u32 pr_ndes:10; /* bits 0-9 */ - u32 unused:22; /* bits 10-31 */ -#endif - } bits; -} TXDMA_PR_NUM_DES_t, *PTXDMA_PR_NUM_DES_t; - #define ET_DMA10_MASK 0x3FF /* 10 bit mask for DMA10W types */ #define ET_DMA10_WRAP 0x400 @@ -261,7 +251,7 @@ typedef struct _TXDMA_t { /* Location: */ u32 csr; /* 0x1000 */ u32 pr_base_hi; /* 0x1004 */ u32 pr_base_lo; /* 0x1008 */ - TXDMA_PR_NUM_DES_t pr_num_des; /* 0x100C */ + u32 pr_num_des; /* 0x100C */ u32 txq_wr_addr; /* 0x1010 */ u32 txq_wr_addr_ext; /* 0x1014 */ u32 txq_rd_addr; /* 0x1018 */ diff --git a/drivers/staging/et131x/et1310_tx.c b/drivers/staging/et131x/et1310_tx.c index d0c71db6c57c..977e8b34e7a6 100644 --- a/drivers/staging/et131x/et1310_tx.c +++ b/drivers/staging/et131x/et1310_tx.c @@ -209,7 +209,7 @@ void ConfigTxDmaRegs(struct et131x_adapter *etdev) &txdma->pr_base_lo); /* Initialise the transmit DMA engine */ - writel(NUM_DESC_PER_RING_TX - 1, &txdma->pr_num_des.value); + writel(NUM_DESC_PER_RING_TX - 1, &txdma->pr_num_des); /* Load the completion writeback physical address */ writel((u32)((u64)etdev->tx_ring.tx_status_pa >> 32), -- GitLab From cfc52eb676a88721221bd89e94222483f681ffe6 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 18 Nov 2009 14:07:29 +0000 Subject: [PATCH 214/235] Staging: et131x: Another typedef solely used to write 0 to a register Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_address_map.h | 20 +++++--------------- drivers/staging/et131x/et131x_isr.c | 13 ++++--------- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index 8b514a0acc1c..f751022b36d3 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h @@ -803,21 +803,11 @@ typedef union _TXMAC_ERR_INT_t { /* * structure for error interrupt reg in txmac address map * located at address 0x3020 + * + * 31-2: unused + * 1: bp_req + * 0: bp_xonxoff */ -typedef union _TXMAC_CP_CTRL_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 unused:30; /* bits 2-31 */ - u32 bp_req:1; /* bit 1 */ - u32 bp_xonxoff:1; /* bit 0 */ -#else - u32 bp_xonxoff:1; /* bit 0 */ - u32 bp_req:1; /* bit 1 */ - u32 unused:30; /* bits 2-31 */ -#endif - } bits; -} TXMAC_BP_CTRL_t, *PTXMAC_BP_CTRL_t; /* * Tx MAC Module of JAGCore Address Mapping @@ -831,7 +821,7 @@ typedef struct _TXMAC_t { /* Location: */ u32 tx_test; /* 0x3014 */ TXMAC_ERR_t err; /* 0x3018 */ TXMAC_ERR_INT_t err_int; /* 0x301C */ - TXMAC_BP_CTRL_t bp_ctrl; /* 0x3020 */ + u32 bp_ctrl; /* 0x3020 */ } TXMAC_t, *PTXMAC_t; /* END OF TXMAC REGISTER ADDRESS MAP */ diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c index 3aeac7b92281..f6d452dd14e2 100644 --- a/drivers/staging/et131x/et131x_isr.c +++ b/drivers/staging/et131x/et131x_isr.c @@ -287,17 +287,12 @@ void et131x_isr_handler(struct work_struct *work) u32 pm_csr; /* Tell the device to send a pause packet via - * the back pressure register + * the back pressure register (bp req and + * bp xon/xoff) */ pm_csr = readl(&iomem->global.pm_csr); - if ((pm_csr & ET_PM_PHY_SW_COMA) == 0) { - TXMAC_BP_CTRL_t bp_ctrl = { 0 }; - - bp_ctrl.bits.bp_req = 1; - bp_ctrl.bits.bp_xonxoff = 1; - writel(bp_ctrl.value, - &iomem->txmac.bp_ctrl.value); - } + if ((pm_csr & ET_PM_PHY_SW_COMA) == 0) + writel(3, &iomem->txmac.bp_ctrl); } } -- GitLab From 02cdb0b427486355b9b8d715e529cff5b7b7b0e8 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 18 Nov 2009 14:07:35 +0000 Subject: [PATCH 215/235] Staging: et131x: kill TX_SHADOW Guess what - we don't use this one either Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_address_map.h | 22 +++++---------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index f751022b36d3..95fb22e42ed5 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h @@ -675,23 +675,11 @@ typedef union _TXMAC_CTL_t { /* * structure for shadow pointer reg in txmac address map * located at address 0x3004 + * 31-27: reserved + * 26-16: txq rd ptr + * 15-11: reserved + * 10-0: txq wr ptr */ -typedef union _TXMAC_SHADOW_PTR_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 reserved2:5; /* bits 27-31 */ - u32 txq_rd_ptr:11; /* bits 16-26 */ - u32 reserved:5; /* bits 11-15 */ - u32 txq_wr_ptr:11; /* bits 0-10 */ -#else - u32 txq_wr_ptr:11; /* bits 0-10 */ - u32 reserved:5; /* bits 11-15 */ - u32 txq_rd_ptr:11; /* bits 16-26 */ - u32 reserved2:5; /* bits 27-31 */ -#endif - } bits; -} TXMAC_SHADOW_PTR_t, *PTXMAC_SHADOW_PTR_t; /* * structure for error count reg in txmac address map @@ -814,7 +802,7 @@ typedef union _TXMAC_ERR_INT_t { */ typedef struct _TXMAC_t { /* Location: */ TXMAC_CTL_t ctl; /* 0x3000 */ - TXMAC_SHADOW_PTR_t shadow_ptr; /* 0x3004 */ + u32 shadow_ptr; /* 0x3004 */ TXMAC_ERR_CNT_t err_cnt; /* 0x3008 */ u32 max_fill; /* 0x300C */ u32 cf_param; /* 0x3010 */ -- GitLab From 6794712519265bb64aa20fe61f4da36bf8adbded Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 18 Nov 2009 14:07:41 +0000 Subject: [PATCH 216/235] Staging: et131x: kill RX_DMA_MAX_PKT_TIME Another one bits the dust ... Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_address_map.h | 17 ++++------------- drivers/staging/et131x/et1310_rx.c | 4 ++-- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index 95fb22e42ed5..c447e9a3ed92 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h @@ -356,19 +356,10 @@ typedef union _RXDMA_NUM_PKT_DONE_t { /* * structure for max packet time reg in rxdma address map * located at address 0x2010 + * + * 31-18: unused + * 17-0: time done */ -typedef union _RXDMA_MAX_PKT_TIME_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 unused:14; /* bits 18-31 */ - u32 time_done:18; /* bits 0-17 */ -#else - u32 time_done:18; /* bits 0-17 */ - u32 unused:14; /* bits 18-31 */ -#endif - } bits; -} RXDMA_MAX_PKT_TIME_t, *PRXDMA_MAX_PKT_TIME_t; /* * structure for rx queue read address reg in rxdma address map @@ -609,7 +600,7 @@ typedef struct _RXDMA_t { /* Location: */ u32 dma_wb_base_lo; /* 0x2004 */ u32 dma_wb_base_hi; /* 0x2008 */ RXDMA_NUM_PKT_DONE_t num_pkt_done; /* 0x200C */ - RXDMA_MAX_PKT_TIME_t max_pkt_time; /* 0x2010 */ + u32 max_pkt_time; /* 0x2010 */ u32 rxq_rd_addr; /* 0x2014 */ u32 rxq_rd_addr_ext; /* 0x2018 */ u32 rxq_wr_addr; /* 0x201C */ diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c index 4c4555dffd1f..48f1ffc3df6a 100644 --- a/drivers/staging/et131x/et1310_rx.c +++ b/drivers/staging/et131x/et1310_rx.c @@ -695,7 +695,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) * regardless of whether we have received packets. * This value gets updated once autoneg is complete. */ - writel(PARM_RX_TIME_INT_DEF, &rx_dma->max_pkt_time.value); + writel(PARM_RX_TIME_INT_DEF, &rx_dma->max_pkt_time); spin_unlock_irqrestore(&etdev->RcvLock, flags); } @@ -711,7 +711,7 @@ void SetRxDmaTimer(struct et131x_adapter *etdev) */ if ((etdev->linkspeed == TRUEPHY_SPEED_100MBPS) || (etdev->linkspeed == TRUEPHY_SPEED_10MBPS)) { - writel(0, &etdev->regs->rxdma.max_pkt_time.value); + writel(0, &etdev->regs->rxdma.max_pkt_time); writel(1, &etdev->regs->rxdma.num_pkt_done.value); } } -- GitLab From 2e5e0b890d4f6f2e9e836c2c21157fbb085c3ed9 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 18 Nov 2009 14:07:48 +0000 Subject: [PATCH 217/235] Staging: et131x: Clean up number fields Lots of RX typedefs are just low bits of a u32, so clean them all up in one go and just work them directly. Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_address_map.h | 123 ++++++-------------- drivers/staging/et131x/et1310_rx.c | 22 ++-- 2 files changed, 47 insertions(+), 98 deletions(-) diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index c447e9a3ed92..019588d13127 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h @@ -339,19 +339,10 @@ typedef union _RXDMA_CSR_t { /* * structure for number of packets done reg in rxdma address map * located at address 0x200C + * + * 31-8: unused + * 7-0: num done */ -typedef union _RXDMA_NUM_PKT_DONE_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 unused:24; /* bits 8-31 */ - u32 num_done:8; /* bits 0-7 */ -#else - u32 num_done:8; /* bits 0-7 */ - u32 unused:24; /* bits 8-31 */ -#endif - } bits; -} RXDMA_NUM_PKT_DONE_t, *PRXDMA_NUM_PKT_DONE_t; /* * structure for max packet time reg in rxdma address map @@ -394,19 +385,10 @@ typedef union _RXDMA_NUM_PKT_DONE_t { /* * structure for packet status ring number of descriptors reg in rxdma address * map. Located at address 0x2028 + * + * 31-12: unused + * 11-0: psr ndes */ -typedef union _RXDMA_PSR_NUM_DES_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 unused:20; /* bits 12-31 */ - u32 psr_ndes:12; /* bit 0-11 */ -#else - u32 psr_ndes:12; /* bit 0-11 */ - u32 unused:20; /* bits 12-31 */ -#endif - } bits; -} RXDMA_PSR_NUM_DES_t, *PRXDMA_PSR_NUM_DES_t; /* * structure for packet status ring available offset reg in rxdma address map @@ -449,36 +431,18 @@ typedef union _RXDMA_PSR_FULL_OFFSET_t { /* * structure for packet status ring access index reg in rxdma address map * located at address 0x2034 + * + * 31-5: unused + * 4-0: psr_ai */ -typedef union _RXDMA_PSR_ACCESS_INDEX_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 unused:27; /* bits 5-31 */ - u32 psr_ai:5; /* bits 0-4 */ -#else - u32 psr_ai:5; /* bits 0-4 */ - u32 unused:27; /* bits 5-31 */ -#endif - } bits; -} RXDMA_PSR_ACCESS_INDEX_t, *PRXDMA_PSR_ACCESS_INDEX_t; /* * structure for packet status ring minimum descriptors reg in rxdma address * map. Located at address 0x2038 + * + * 31-12: unused + * 11-0: psr_min */ -typedef union _RXDMA_PSR_MIN_DES_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 unused:20; /* bits 12-31 */ - u32 psr_min:12; /* bits 0-11 */ -#else - u32 psr_min:12; /* bits 0-11 */ - u32 unused:20; /* bits 12-31 */ -#endif - } bits; -} RXDMA_PSR_MIN_DES_t, *PRXDMA_PSR_MIN_DES_t; /* * structure for free buffer ring base lo address reg in rxdma address map @@ -495,6 +459,9 @@ typedef union _RXDMA_PSR_MIN_DES_t { /* * structure for free buffer ring number of descriptors reg in rxdma address * map. Located at address 0x2044 + * + * 31-10: unused + * 9-0: fbr ndesc */ typedef union _RXDMA_FBR_NUM_DES_t { u32 value; @@ -524,36 +491,18 @@ typedef union _RXDMA_FBR_NUM_DES_t { /* * structure for free buffer cache 0 full offset reg in rxdma address map * located at address 0x2050 + * + * 31-5: unused + * 4-0: fbc rdi */ -typedef union _RXDMA_FBC_RD_INDEX_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 unused:27; /* bits 5-31 */ - u32 fbc_rdi:5; /* bit 0-4 */ -#else - u32 fbc_rdi:5; /* bit 0-4 */ - u32 unused:27; /* bits 5-31 */ -#endif - } bits; -} RXDMA_FBC_RD_INDEX_t, *PRXDMA_FBC_RD_INDEX_t; /* * structure for free buffer ring 0 minimum descriptor reg in rxdma address map * located at address 0x2054 + * + * 31-10: unused + * 9-0: fbr min */ -typedef union _RXDMA_FBR_MIN_DES_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 unused:22; /* bits 10-31 */ - u32 fbr_min:10; /* bits 0-9 */ -#else - u32 fbr_min:10; /* bits 0-9 */ - u32 unused:22; /* bits 10-31 */ -#endif - } bits; -} RXDMA_FBR_MIN_DES_t, *PRXDMA_FBR_MIN_DES_t; /* * structure for free buffer ring 1 base address lo reg in rxdma address map @@ -599,32 +548,32 @@ typedef struct _RXDMA_t { /* Location: */ RXDMA_CSR_t csr; /* 0x2000 */ u32 dma_wb_base_lo; /* 0x2004 */ u32 dma_wb_base_hi; /* 0x2008 */ - RXDMA_NUM_PKT_DONE_t num_pkt_done; /* 0x200C */ + u32 num_pkt_done; /* 0x200C */ u32 max_pkt_time; /* 0x2010 */ u32 rxq_rd_addr; /* 0x2014 */ - u32 rxq_rd_addr_ext; /* 0x2018 */ + u32 rxq_rd_addr_ext; /* 0x2018 */ u32 rxq_wr_addr; /* 0x201C */ u32 psr_base_lo; /* 0x2020 */ u32 psr_base_hi; /* 0x2024 */ - RXDMA_PSR_NUM_DES_t psr_num_des; /* 0x2028 */ + u32 psr_num_des; /* 0x2028 */ RXDMA_PSR_AVAIL_OFFSET_t psr_avail_offset; /* 0x202C */ RXDMA_PSR_FULL_OFFSET_t psr_full_offset; /* 0x2030 */ - RXDMA_PSR_ACCESS_INDEX_t psr_access_index; /* 0x2034 */ - RXDMA_PSR_MIN_DES_t psr_min_des; /* 0x2038 */ + u32 psr_access_index; /* 0x2034 */ + u32 psr_min_des; /* 0x2038 */ u32 fbr0_base_lo; /* 0x203C */ u32 fbr0_base_hi; /* 0x2040 */ - RXDMA_FBR_NUM_DES_t fbr0_num_des; /* 0x2044 */ - u32 fbr0_avail_offset; /* 0x2048 */ - u32 fbr0_full_offset; /* 0x204C */ - RXDMA_FBC_RD_INDEX_t fbr0_rd_index; /* 0x2050 */ - RXDMA_FBR_MIN_DES_t fbr0_min_des; /* 0x2054 */ + u32 fbr0_num_des; /* 0x2044 */ + u32 fbr0_avail_offset; /* 0x2048 */ + u32 fbr0_full_offset; /* 0x204C */ + u32 fbr0_rd_index; /* 0x2050 */ + u32 fbr0_min_des; /* 0x2054 */ u32 fbr1_base_lo; /* 0x2058 */ u32 fbr1_base_hi; /* 0x205C */ - RXDMA_FBR_NUM_DES_t fbr1_num_des; /* 0x2060 */ - u32 fbr1_avail_offset; /* 0x2064 */ - u32 fbr1_full_offset; /* 0x2068 */ - RXDMA_FBC_RD_INDEX_t fbr1_rd_index; /* 0x206C */ - RXDMA_FBR_MIN_DES_t fbr1_min_des; /* 0x2070 */ + u32 fbr1_num_des; /* 0x2060 */ + u32 fbr1_avail_offset; /* 0x2064 */ + u32 fbr1_full_offset; /* 0x2068 */ + u32 fbr1_rd_index; /* 0x206C */ + u32 fbr1_min_des; /* 0x2070 */ } RXDMA_t, *PRXDMA_t; /* END OF RXDMA REGISTER ADDRESS MAP */ diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c index 48f1ffc3df6a..c3778d2c5df5 100644 --- a/drivers/staging/et131x/et1310_rx.c +++ b/drivers/staging/et131x/et1310_rx.c @@ -598,7 +598,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) struct _rx_ring_t *rx_local = &etdev->RxRing; PFBR_DESC_t fbr_entry; u32 entry; - RXDMA_PSR_NUM_DES_t psr_num_des; + u32 psr_num_des; unsigned long flags; /* Halt RXDMA to perform the reconfigure. */ @@ -623,12 +623,12 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) writel((u32) ((u64)rx_local->pPSRingPa >> 32), &rx_dma->psr_base_hi); writel((u32) rx_local->pPSRingPa, &rx_dma->psr_base_lo); - writel(rx_local->PsrNumEntries - 1, &rx_dma->psr_num_des.value); + writel(rx_local->PsrNumEntries - 1, &rx_dma->psr_num_des); writel(0, &rx_dma->psr_full_offset.value); - psr_num_des.value = readl(&rx_dma->psr_num_des.value); - writel((psr_num_des.bits.psr_ndes * LO_MARK_PERCENT_FOR_PSR) / 100, - &rx_dma->psr_min_des.value); + psr_num_des = readl(&rx_dma->psr_num_des) & 0xFFF; + writel((psr_num_des * LO_MARK_PERCENT_FOR_PSR) / 100, + &rx_dma->psr_min_des); spin_lock_irqsave(&etdev->RcvLock, flags); @@ -650,7 +650,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) */ writel((u32) (rx_local->Fbr1Realpa >> 32), &rx_dma->fbr1_base_hi); writel((u32) rx_local->Fbr1Realpa, &rx_dma->fbr1_base_lo); - writel(rx_local->Fbr1NumEntries - 1, &rx_dma->fbr1_num_des.value); + writel(rx_local->Fbr1NumEntries - 1, &rx_dma->fbr1_num_des); writel(ET_DMA10_WRAP, &rx_dma->fbr1_full_offset); /* This variable tracks the free buffer ring 1 full position, so it @@ -658,7 +658,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) */ rx_local->local_Fbr1_full = ET_DMA10_WRAP; writel(((rx_local->Fbr1NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, - &rx_dma->fbr1_min_des.value); + &rx_dma->fbr1_min_des); #ifdef USE_FBR0 /* Now's the best time to initialize FBR0 contents */ @@ -672,7 +672,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) writel((u32) (rx_local->Fbr0Realpa >> 32), &rx_dma->fbr0_base_hi); writel((u32) rx_local->Fbr0Realpa, &rx_dma->fbr0_base_lo); - writel(rx_local->Fbr0NumEntries - 1, &rx_dma->fbr0_num_des.value); + writel(rx_local->Fbr0NumEntries - 1, &rx_dma->fbr0_num_des); writel(ET_DMA10_WRAP, &rx_dma->fbr0_full_offset); /* This variable tracks the free buffer ring 0 full position, so it @@ -680,7 +680,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) */ rx_local->local_Fbr0_full = ET_DMA10_WRAP; writel(((rx_local->Fbr0NumEntries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, - &rx_dma->fbr0_min_des.value); + &rx_dma->fbr0_min_des); #endif /* Program the number of packets we will receive before generating an @@ -688,7 +688,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) * For version B silicon, this value gets updated once autoneg is *complete. */ - writel(PARM_RX_NUM_BUFS_DEF, &rx_dma->num_pkt_done.value); + writel(PARM_RX_NUM_BUFS_DEF, &rx_dma->num_pkt_done); /* The "time_done" is not working correctly to coalesce interrupts * after a given time period, but rather is giving us an interrupt @@ -712,7 +712,7 @@ void SetRxDmaTimer(struct et131x_adapter *etdev) if ((etdev->linkspeed == TRUEPHY_SPEED_100MBPS) || (etdev->linkspeed == TRUEPHY_SPEED_10MBPS)) { writel(0, &etdev->regs->rxdma.max_pkt_time); - writel(1, &etdev->regs->rxdma.num_pkt_done.value); + writel(1, &etdev->regs->rxdma.num_pkt_done); } } -- GitLab From 99fd99f618daecae638550275cb132ab1ffe464c Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 18 Nov 2009 14:07:58 +0000 Subject: [PATCH 218/235] Staging: et131x: clean up the avail fields in the rx registers These have a wrap bit but again need little work to clean out. There are a couple of uglies left that want addressing in later clean up. Notably we should probably keep the local psr copy and wrap as two values. Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_address_map.h | 40 ++++++--------------- drivers/staging/et131x/et1310_rx.c | 28 ++++++++------- drivers/staging/et131x/et1310_rx.h | 2 +- 3 files changed, 26 insertions(+), 44 deletions(-) diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index 019588d13127..6da843cc343c 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h @@ -393,40 +393,20 @@ typedef union _RXDMA_CSR_t { /* * structure for packet status ring available offset reg in rxdma address map * located at address 0x202C + * + * 31-13: unused + * 12: psr avail wrap + * 11-0: psr avail */ -typedef union _RXDMA_PSR_AVAIL_OFFSET_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 unused:19; /* bits 13-31 */ - u32 psr_avail_wrap:1; /* bit 12 */ - u32 psr_avail:12; /* bit 0-11 */ -#else - u32 psr_avail:12; /* bit 0-11 */ - u32 psr_avail_wrap:1; /* bit 12 */ - u32 unused:19; /* bits 13-31 */ -#endif - } bits; -} RXDMA_PSR_AVAIL_OFFSET_t, *PRXDMA_PSR_AVAIL_OFFSET_t; /* * structure for packet status ring full offset reg in rxdma address map * located at address 0x2030 + * + * 31-13: unused + * 12: psr full wrap + * 11-0: psr full */ -typedef union _RXDMA_PSR_FULL_OFFSET_t { - u32 value; - struct { -#ifdef _BIT_FIELDS_HTOL - u32 unused:19; /* bits 13-31 */ - u32 psr_full_wrap:1; /* bit 12 */ - u32 psr_full:12; /* bit 0-11 */ -#else - u32 psr_full:12; /* bit 0-11 */ - u32 psr_full_wrap:1; /* bit 12 */ - u32 unused:19; /* bits 13-31 */ -#endif - } bits; -} RXDMA_PSR_FULL_OFFSET_t, *PRXDMA_PSR_FULL_OFFSET_t; /* * structure for packet status ring access index reg in rxdma address map @@ -556,8 +536,8 @@ typedef struct _RXDMA_t { /* Location: */ u32 psr_base_lo; /* 0x2020 */ u32 psr_base_hi; /* 0x2024 */ u32 psr_num_des; /* 0x2028 */ - RXDMA_PSR_AVAIL_OFFSET_t psr_avail_offset; /* 0x202C */ - RXDMA_PSR_FULL_OFFSET_t psr_full_offset; /* 0x2030 */ + u32 psr_avail_offset; /* 0x202C */ + u32 psr_full_offset; /* 0x2030 */ u32 psr_access_index; /* 0x2034 */ u32 psr_min_des; /* 0x2038 */ u32 fbr0_base_lo; /* 0x203C */ diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c index c3778d2c5df5..3ddc9b12b8db 100644 --- a/drivers/staging/et131x/et1310_rx.c +++ b/drivers/staging/et131x/et1310_rx.c @@ -624,7 +624,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) &rx_dma->psr_base_hi); writel((u32) rx_local->pPSRingPa, &rx_dma->psr_base_lo); writel(rx_local->PsrNumEntries - 1, &rx_dma->psr_num_des); - writel(0, &rx_dma->psr_full_offset.value); + writel(0, &rx_dma->psr_full_offset); psr_num_des = readl(&rx_dma->psr_num_des) & 0xFFF; writel((psr_num_des * LO_MARK_PERCENT_FOR_PSR) / 100, @@ -633,8 +633,7 @@ void ConfigRxDmaRegs(struct et131x_adapter *etdev) spin_lock_irqsave(&etdev->RcvLock, flags); /* These local variables track the PSR in the adapter structure */ - rx_local->local_psr_full.bits.psr_full = 0; - rx_local->local_psr_full.bits.psr_full_wrap = 0; + rx_local->local_psr_full = 0; /* Now's the best time to initialize FBR1 contents */ fbr_entry = (PFBR_DESC_t) rx_local->pFbr1RingVa; @@ -808,17 +807,18 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev) */ status = (PRX_STATUS_BLOCK_t) rx_local->pRxStatusVa; + /* FIXME: tidy later when conversions complete */ if (status->Word1.bits.PSRoffset == - rx_local->local_psr_full.bits.psr_full && + (rx_local->local_psr_full & 0xFFF) && status->Word1.bits.PSRwrap == - rx_local->local_psr_full.bits.psr_full_wrap) { + ((rx_local->local_psr_full >> 12) & 1)) { /* Looks like this ring is not updated yet */ return NULL; } /* The packet status ring indicates that data is available. */ psr = (PPKT_STAT_DESC_t) (rx_local->pPSRingVa) + - rx_local->local_psr_full.bits.psr_full; + (rx_local->local_psr_full & 0xFFF); /* Grab any information that is required once the PSR is * advanced, since we can no longer rely on the memory being @@ -830,14 +830,16 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev) Word0 = psr->word0; /* Indicate that we have used this PSR entry. */ - if (++rx_local->local_psr_full.bits.psr_full > - rx_local->PsrNumEntries - 1) { - rx_local->local_psr_full.bits.psr_full = 0; - rx_local->local_psr_full.bits.psr_full_wrap ^= 1; + /* FIXME wrap 12 */ + rx_local->local_psr_full = (rx_local->local_psr_full + 1) & 0xFFF; + if (rx_local->local_psr_full > rx_local->PsrNumEntries - 1) { + /* Clear psr full and toggle the wrap bit */ + rx_local->local_psr_full &= 0xFFF; + rx_local->local_psr_full ^= 0x1000; } - writel(rx_local->local_psr_full.value, - &etdev->regs->rxdma.psr_full_offset.value); + writel(rx_local->local_psr_full, + &etdev->regs->rxdma.psr_full_offset); #ifndef USE_FBR0 if (rindex != 1) { @@ -860,7 +862,7 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev) dev_err(&etdev->pdev->dev, "NICRxPkts PSR Entry %d indicates " "length of %d and/or bad bi(%d)\n", - rx_local->local_psr_full.bits.psr_full, + rx_local->local_psr_full & 0xFFF, len, bindex); return NULL; } diff --git a/drivers/staging/et131x/et1310_rx.h b/drivers/staging/et131x/et1310_rx.h index a11bd8b0872e..69514593612c 100644 --- a/drivers/staging/et131x/et1310_rx.h +++ b/drivers/staging/et131x/et1310_rx.h @@ -300,7 +300,7 @@ typedef struct _rx_ring_t { void *pPSRingVa; dma_addr_t pPSRingPa; - RXDMA_PSR_FULL_OFFSET_t local_psr_full; + u32 local_psr_full; u32 PsrNumEntries; void *pRxStatusVa; -- GitLab From b0a0ccfad85b3657fe999805df65f5cfe634ab8a Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 5 Oct 2009 16:29:29 -0700 Subject: [PATCH 219/235] Staging: android: delete android drivers These drivers are no longer being developed and the original authors seem to have abandonded them and hence, do not want them in the mainline kernel tree. So sad :( Cc: Brian Swetland Signed-off-by: Greg Kroah-Hartman --- drivers/staging/Kconfig | 2 - drivers/staging/Makefile | 1 - drivers/staging/android/Kconfig | 96 - drivers/staging/android/Makefile | 6 - drivers/staging/android/TODO | 10 - drivers/staging/android/binder.c | 3767 --------------------- drivers/staging/android/binder.h | 330 -- drivers/staging/android/logger.c | 607 ---- drivers/staging/android/logger.h | 48 - drivers/staging/android/lowmemorykiller.c | 173 - drivers/staging/android/ram_console.c | 410 --- drivers/staging/android/timed_gpio.c | 166 - drivers/staging/android/timed_gpio.h | 33 - drivers/staging/android/timed_output.c | 121 - drivers/staging/android/timed_output.h | 37 - 15 files changed, 5807 deletions(-) delete mode 100644 drivers/staging/android/Kconfig delete mode 100644 drivers/staging/android/Makefile delete mode 100644 drivers/staging/android/TODO delete mode 100644 drivers/staging/android/binder.c delete mode 100644 drivers/staging/android/binder.h delete mode 100644 drivers/staging/android/logger.c delete mode 100644 drivers/staging/android/logger.h delete mode 100644 drivers/staging/android/lowmemorykiller.c delete mode 100644 drivers/staging/android/ram_console.c delete mode 100644 drivers/staging/android/timed_gpio.c delete mode 100644 drivers/staging/android/timed_gpio.h delete mode 100644 drivers/staging/android/timed_output.c delete mode 100644 drivers/staging/android/timed_output.h diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 56b275073cee..5dccf6bfb0f9 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -83,8 +83,6 @@ source "drivers/staging/mimio/Kconfig" source "drivers/staging/frontier/Kconfig" -source "drivers/staging/android/Kconfig" - source "drivers/staging/dream/Kconfig" source "drivers/staging/dst/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index edae7d681e6e..2f228f99be93 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -24,7 +24,6 @@ obj-$(CONFIG_RTL8192SU) += rtl8192su/ obj-$(CONFIG_RTL8192E) += rtl8192e/ obj-$(CONFIG_INPUT_MIMIO) += mimio/ obj-$(CONFIG_TRANZPORT) += frontier/ -obj-$(CONFIG_ANDROID) += android/ obj-$(CONFIG_DREAM) += dream/ obj-$(CONFIG_DST) += dst/ obj-$(CONFIG_POHMELFS) += pohmelfs/ diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig deleted file mode 100644 index eb675635ae60..000000000000 --- a/drivers/staging/android/Kconfig +++ /dev/null @@ -1,96 +0,0 @@ -menu "Android" - -config ANDROID - bool "Android Drivers" - depends on BROKEN - default N - ---help--- - Enable support for various drivers needed on the Android platform - -if ANDROID - -config ANDROID_BINDER_IPC - bool "Android Binder IPC Driver" - default n - -config ANDROID_LOGGER - tristate "Android log driver" - default n - -config ANDROID_RAM_CONSOLE - bool "Android RAM buffer console" - default n - -config ANDROID_RAM_CONSOLE_ENABLE_VERBOSE - bool "Enable verbose console messages on Android RAM console" - default y - depends on ANDROID_RAM_CONSOLE - -menuconfig ANDROID_RAM_CONSOLE_ERROR_CORRECTION - bool "Android RAM Console Enable error correction" - default n - depends on ANDROID_RAM_CONSOLE - depends on !ANDROID_RAM_CONSOLE_EARLY_INIT - select REED_SOLOMON - select REED_SOLOMON_ENC8 - select REED_SOLOMON_DEC8 - -if ANDROID_RAM_CONSOLE_ERROR_CORRECTION - -config ANDROID_RAM_CONSOLE_ERROR_CORRECTION_DATA_SIZE - int "Android RAM Console Data data size" - default 128 - help - Must be a power of 2. - -config ANDROID_RAM_CONSOLE_ERROR_CORRECTION_ECC_SIZE - int "Android RAM Console ECC size" - default 16 - -config ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE - int "Android RAM Console Symbol size" - default 8 - -config ANDROID_RAM_CONSOLE_ERROR_CORRECTION_POLYNOMIAL - hex "Android RAM Console Polynomial" - default 0x19 if (ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE = 4) - default 0x29 if (ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE = 5) - default 0x61 if (ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE = 6) - default 0x89 if (ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE = 7) - default 0x11d if (ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE = 8) - -endif # ANDROID_RAM_CONSOLE_ERROR_CORRECTION - -config ANDROID_RAM_CONSOLE_EARLY_INIT - bool "Start Android RAM console early" - default n - depends on ANDROID_RAM_CONSOLE - -config ANDROID_RAM_CONSOLE_EARLY_ADDR - hex "Android RAM console virtual address" - default 0 - depends on ANDROID_RAM_CONSOLE_EARLY_INIT - -config ANDROID_RAM_CONSOLE_EARLY_SIZE - hex "Android RAM console buffer size" - default 0 - depends on ANDROID_RAM_CONSOLE_EARLY_INIT - -config ANDROID_TIMED_OUTPUT - bool "Timed output class driver" - default y - -config ANDROID_TIMED_GPIO - tristate "Android timed gpio driver" - depends on GENERIC_GPIO && ANDROID_TIMED_OUTPUT - default n - -config ANDROID_LOW_MEMORY_KILLER - bool "Android Low Memory Killer" - default N - ---help--- - Register processes to be killed when memory is low - -endif # if ANDROID - -endmenu diff --git a/drivers/staging/android/Makefile b/drivers/staging/android/Makefile deleted file mode 100644 index 8e057e626d11..000000000000 --- a/drivers/staging/android/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -obj-$(CONFIG_ANDROID_BINDER_IPC) += binder.o -obj-$(CONFIG_ANDROID_LOGGER) += logger.o -obj-$(CONFIG_ANDROID_RAM_CONSOLE) += ram_console.o -obj-$(CONFIG_ANDROID_TIMED_OUTPUT) += timed_output.o -obj-$(CONFIG_ANDROID_TIMED_GPIO) += timed_gpio.o -obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER) += lowmemorykiller.o diff --git a/drivers/staging/android/TODO b/drivers/staging/android/TODO deleted file mode 100644 index e59c5be4be2b..000000000000 --- a/drivers/staging/android/TODO +++ /dev/null @@ -1,10 +0,0 @@ -TODO: - - checkpatch.pl cleanups - - sparse fixes - - rename files to be not so "generic" - - make sure things build as modules properly - - add proper arch dependancies as needed - - audit userspace interfaces to make sure they are sane - -Please send patches to Greg Kroah-Hartman and Cc: -Brian Swetland diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c deleted file mode 100644 index 99010d4b3044..000000000000 --- a/drivers/staging/android/binder.c +++ /dev/null @@ -1,3767 +0,0 @@ -/* binder.c - * - * Android IPC Subsystem - * - * Copyright (C) 2007-2008 Google, Inc. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * 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. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "binder.h" - -static DEFINE_MUTEX(binder_lock); -static DEFINE_MUTEX(binder_deferred_lock); - -static HLIST_HEAD(binder_procs); -static HLIST_HEAD(binder_deferred_list); -static HLIST_HEAD(binder_dead_nodes); - -static struct proc_dir_entry *binder_proc_dir_entry_root; -static struct proc_dir_entry *binder_proc_dir_entry_proc; -static struct binder_node *binder_context_mgr_node; -static uid_t binder_context_mgr_uid = -1; -static int binder_last_id; - -static int binder_read_proc_proc(char *page, char **start, off_t off, - int count, int *eof, void *data); - -/* This is only defined in include/asm-arm/sizes.h */ -#ifndef SZ_1K -#define SZ_1K 0x400 -#endif - -#ifndef SZ_4M -#define SZ_4M 0x400000 -#endif - -#define FORBIDDEN_MMAP_FLAGS (VM_WRITE) - -#define BINDER_SMALL_BUF_SIZE (PAGE_SIZE * 64) - -enum { - BINDER_DEBUG_USER_ERROR = 1U << 0, - BINDER_DEBUG_FAILED_TRANSACTION = 1U << 1, - BINDER_DEBUG_DEAD_TRANSACTION = 1U << 2, - BINDER_DEBUG_OPEN_CLOSE = 1U << 3, - BINDER_DEBUG_DEAD_BINDER = 1U << 4, - BINDER_DEBUG_DEATH_NOTIFICATION = 1U << 5, - BINDER_DEBUG_READ_WRITE = 1U << 6, - BINDER_DEBUG_USER_REFS = 1U << 7, - BINDER_DEBUG_THREADS = 1U << 8, - BINDER_DEBUG_TRANSACTION = 1U << 9, - BINDER_DEBUG_TRANSACTION_COMPLETE = 1U << 10, - BINDER_DEBUG_FREE_BUFFER = 1U << 11, - BINDER_DEBUG_INTERNAL_REFS = 1U << 12, - BINDER_DEBUG_BUFFER_ALLOC = 1U << 13, - BINDER_DEBUG_PRIORITY_CAP = 1U << 14, - BINDER_DEBUG_BUFFER_ALLOC_ASYNC = 1U << 15, -}; -static uint32_t binder_debug_mask = BINDER_DEBUG_USER_ERROR | - BINDER_DEBUG_FAILED_TRANSACTION | BINDER_DEBUG_DEAD_TRANSACTION; -module_param_named(debug_mask, binder_debug_mask, uint, S_IWUSR | S_IRUGO); - -static int binder_debug_no_lock; -module_param_named(proc_no_lock, binder_debug_no_lock, bool, S_IWUSR | S_IRUGO); - -static DECLARE_WAIT_QUEUE_HEAD(binder_user_error_wait); -static int binder_stop_on_user_error; - -static int binder_set_stop_on_user_error(const char *val, - struct kernel_param *kp) -{ - int ret; - ret = param_set_int(val, kp); - if (binder_stop_on_user_error < 2) - wake_up(&binder_user_error_wait); - return ret; -} -module_param_call(stop_on_user_error, binder_set_stop_on_user_error, - param_get_int, &binder_stop_on_user_error, S_IWUSR | S_IRUGO); - -#define binder_debug(mask, x...) \ - do { \ - if (binder_debug_mask & mask) \ - printk(KERN_INFO x); \ - } while (0) - -#define binder_user_error(x...) \ - do { \ - if (binder_debug_mask & BINDER_DEBUG_USER_ERROR) \ - printk(KERN_INFO x); \ - if (binder_stop_on_user_error) \ - binder_stop_on_user_error = 2; \ - } while (0) - -enum binder_stat_types { - BINDER_STAT_PROC, - BINDER_STAT_THREAD, - BINDER_STAT_NODE, - BINDER_STAT_REF, - BINDER_STAT_DEATH, - BINDER_STAT_TRANSACTION, - BINDER_STAT_TRANSACTION_COMPLETE, - BINDER_STAT_COUNT -}; - -struct binder_stats { - int br[_IOC_NR(BR_FAILED_REPLY) + 1]; - int bc[_IOC_NR(BC_DEAD_BINDER_DONE) + 1]; - int obj_created[BINDER_STAT_COUNT]; - int obj_deleted[BINDER_STAT_COUNT]; -}; - -static struct binder_stats binder_stats; - -static inline void binder_stats_deleted(enum binder_stat_types type) -{ - binder_stats.obj_deleted[type]++; -} - -static inline void binder_stats_created(enum binder_stat_types type) -{ - binder_stats.obj_created[type]++; -} - -struct binder_transaction_log_entry { - int debug_id; - int call_type; - int from_proc; - int from_thread; - int target_handle; - int to_proc; - int to_thread; - int to_node; - int data_size; - int offsets_size; -}; -struct binder_transaction_log { - int next; - int full; - struct binder_transaction_log_entry entry[32]; -}; -static struct binder_transaction_log binder_transaction_log; -static struct binder_transaction_log binder_transaction_log_failed; - -static struct binder_transaction_log_entry *binder_transaction_log_add( - struct binder_transaction_log *log) -{ - struct binder_transaction_log_entry *e; - e = &log->entry[log->next]; - memset(e, 0, sizeof(*e)); - log->next++; - if (log->next == ARRAY_SIZE(log->entry)) { - log->next = 0; - log->full = 1; - } - return e; -} - -struct binder_work { - struct list_head entry; - enum { - BINDER_WORK_TRANSACTION = 1, - BINDER_WORK_TRANSACTION_COMPLETE, - BINDER_WORK_NODE, - BINDER_WORK_DEAD_BINDER, - BINDER_WORK_DEAD_BINDER_AND_CLEAR, - BINDER_WORK_CLEAR_DEATH_NOTIFICATION, - } type; -}; - -struct binder_node { - int debug_id; - struct binder_work work; - union { - struct rb_node rb_node; - struct hlist_node dead_node; - }; - struct binder_proc *proc; - struct hlist_head refs; - int internal_strong_refs; - int local_weak_refs; - int local_strong_refs; - void __user *ptr; - void __user *cookie; - unsigned has_strong_ref:1; - unsigned pending_strong_ref:1; - unsigned has_weak_ref:1; - unsigned pending_weak_ref:1; - unsigned has_async_transaction:1; - unsigned accept_fds:1; - unsigned min_priority:8; - struct list_head async_todo; -}; - -struct binder_ref_death { - struct binder_work work; - void __user *cookie; -}; - -struct binder_ref { - /* Lookups needed: */ - /* node + proc => ref (transaction) */ - /* desc + proc => ref (transaction, inc/dec ref) */ - /* node => refs + procs (proc exit) */ - int debug_id; - struct rb_node rb_node_desc; - struct rb_node rb_node_node; - struct hlist_node node_entry; - struct binder_proc *proc; - struct binder_node *node; - uint32_t desc; - int strong; - int weak; - struct binder_ref_death *death; -}; - -struct binder_buffer { - struct list_head entry; /* free and allocated entries by addesss */ - struct rb_node rb_node; /* free entry by size or allocated entry */ - /* by address */ - unsigned free:1; - unsigned allow_user_free:1; - unsigned async_transaction:1; - unsigned debug_id:29; - - struct binder_transaction *transaction; - - struct binder_node *target_node; - size_t data_size; - size_t offsets_size; - uint8_t data[0]; -}; - -enum binder_deferred_state { - BINDER_DEFERRED_PUT_FILES = 0x01, - BINDER_DEFERRED_FLUSH = 0x02, - BINDER_DEFERRED_RELEASE = 0x04, -}; - -struct binder_proc { - struct hlist_node proc_node; - struct rb_root threads; - struct rb_root nodes; - struct rb_root refs_by_desc; - struct rb_root refs_by_node; - int pid; - struct vm_area_struct *vma; - struct task_struct *tsk; - struct files_struct *files; - struct hlist_node deferred_work_node; - int deferred_work; - void *buffer; - ptrdiff_t user_buffer_offset; - - struct list_head buffers; - struct rb_root free_buffers; - struct rb_root allocated_buffers; - size_t free_async_space; - - struct page **pages; - size_t buffer_size; - uint32_t buffer_free; - struct list_head todo; - wait_queue_head_t wait; - struct binder_stats stats; - struct list_head delivered_death; - int max_threads; - int requested_threads; - int requested_threads_started; - int ready_threads; - long default_priority; -}; - -enum { - BINDER_LOOPER_STATE_REGISTERED = 0x01, - BINDER_LOOPER_STATE_ENTERED = 0x02, - BINDER_LOOPER_STATE_EXITED = 0x04, - BINDER_LOOPER_STATE_INVALID = 0x08, - BINDER_LOOPER_STATE_WAITING = 0x10, - BINDER_LOOPER_STATE_NEED_RETURN = 0x20 -}; - -struct binder_thread { - struct binder_proc *proc; - struct rb_node rb_node; - int pid; - int looper; - struct binder_transaction *transaction_stack; - struct list_head todo; - uint32_t return_error; /* Write failed, return error code in read buf */ - uint32_t return_error2; /* Write failed, return error code in read */ - /* buffer. Used when sending a reply to a dead process that */ - /* we are also waiting on */ - wait_queue_head_t wait; - struct binder_stats stats; -}; - -struct binder_transaction { - int debug_id; - struct binder_work work; - struct binder_thread *from; - struct binder_transaction *from_parent; - struct binder_proc *to_proc; - struct binder_thread *to_thread; - struct binder_transaction *to_parent; - unsigned need_reply:1; - /* unsigned is_dead:1; */ /* not used at the moment */ - - struct binder_buffer *buffer; - unsigned int code; - unsigned int flags; - long priority; - long saved_priority; - uid_t sender_euid; -}; - -static void -binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer); - -/* - * copied from get_unused_fd_flags - */ -int task_get_unused_fd_flags(struct binder_proc *proc, int flags) -{ - struct files_struct *files = proc->files; - int fd, error; - struct fdtable *fdt; - unsigned long rlim_cur; - unsigned long irqs; - - if (files == NULL) - return -ESRCH; - - error = -EMFILE; - spin_lock(&files->file_lock); - -repeat: - fdt = files_fdtable(files); - fd = find_next_zero_bit(fdt->open_fds->fds_bits, fdt->max_fds, - files->next_fd); - - /* - * N.B. For clone tasks sharing a files structure, this test - * will limit the total number of files that can be opened. - */ - rlim_cur = 0; - if (lock_task_sighand(proc->tsk, &irqs)) { - rlim_cur = proc->tsk->signal->rlim[RLIMIT_NOFILE].rlim_cur; - unlock_task_sighand(proc->tsk, &irqs); - } - if (fd >= rlim_cur) - goto out; - - /* Do we need to expand the fd array or fd set? */ - error = expand_files(files, fd); - if (error < 0) - goto out; - - if (error) { - /* - * If we needed to expand the fs array we - * might have blocked - try again. - */ - error = -EMFILE; - goto repeat; - } - - FD_SET(fd, fdt->open_fds); - if (flags & O_CLOEXEC) - FD_SET(fd, fdt->close_on_exec); - else - FD_CLR(fd, fdt->close_on_exec); - files->next_fd = fd + 1; -#if 1 - /* Sanity check */ - if (fdt->fd[fd] != NULL) { - printk(KERN_WARNING "get_unused_fd: slot %d not NULL!\n", fd); - fdt->fd[fd] = NULL; - } -#endif - error = fd; - -out: - spin_unlock(&files->file_lock); - return error; -} - -/* - * copied from fd_install - */ -static void task_fd_install( - struct binder_proc *proc, unsigned int fd, struct file *file) -{ - struct files_struct *files = proc->files; - struct fdtable *fdt; - - if (files == NULL) - return; - - spin_lock(&files->file_lock); - fdt = files_fdtable(files); - BUG_ON(fdt->fd[fd] != NULL); - rcu_assign_pointer(fdt->fd[fd], file); - spin_unlock(&files->file_lock); -} - -/* - * copied from __put_unused_fd in open.c - */ -static void __put_unused_fd(struct files_struct *files, unsigned int fd) -{ - struct fdtable *fdt = files_fdtable(files); - __FD_CLR(fd, fdt->open_fds); - if (fd < files->next_fd) - files->next_fd = fd; -} - -/* - * copied from sys_close - */ -static long task_close_fd(struct binder_proc *proc, unsigned int fd) -{ - struct file *filp; - struct files_struct *files = proc->files; - struct fdtable *fdt; - int retval; - - if (files == NULL) - return -ESRCH; - - spin_lock(&files->file_lock); - fdt = files_fdtable(files); - if (fd >= fdt->max_fds) - goto out_unlock; - filp = fdt->fd[fd]; - if (!filp) - goto out_unlock; - rcu_assign_pointer(fdt->fd[fd], NULL); - FD_CLR(fd, fdt->close_on_exec); - __put_unused_fd(files, fd); - spin_unlock(&files->file_lock); - retval = filp_close(filp, files); - - /* can't restart close syscall because file table entry was cleared */ - if (unlikely(retval == -ERESTARTSYS || - retval == -ERESTARTNOINTR || - retval == -ERESTARTNOHAND || - retval == -ERESTART_RESTARTBLOCK)) - retval = -EINTR; - - return retval; - -out_unlock: - spin_unlock(&files->file_lock); - return -EBADF; -} - -static void binder_set_nice(long nice) -{ - long min_nice; - if (can_nice(current, nice)) { - set_user_nice(current, nice); - return; - } - min_nice = 20 - current->signal->rlim[RLIMIT_NICE].rlim_cur; - binder_debug(BINDER_DEBUG_PRIORITY_CAP, - "binder: %d: nice value %ld not allowed use " - "%ld instead\n", current->pid, nice, min_nice); - set_user_nice(current, min_nice); - if (min_nice < 20) - return; - binder_user_error("binder: %d RLIMIT_NICE not set\n", current->pid); -} - -static size_t binder_buffer_size(struct binder_proc *proc, - struct binder_buffer *buffer) -{ - if (list_is_last(&buffer->entry, &proc->buffers)) - return proc->buffer + proc->buffer_size - (void *)buffer->data; - else - return (size_t)list_entry(buffer->entry.next, - struct binder_buffer, entry) - (size_t)buffer->data; -} - -static void binder_insert_free_buffer(struct binder_proc *proc, - struct binder_buffer *new_buffer) -{ - struct rb_node **p = &proc->free_buffers.rb_node; - struct rb_node *parent = NULL; - struct binder_buffer *buffer; - size_t buffer_size; - size_t new_buffer_size; - - BUG_ON(!new_buffer->free); - - new_buffer_size = binder_buffer_size(proc, new_buffer); - - binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "binder: %d: add free buffer, size %zd, " - "at %p\n", proc->pid, new_buffer_size, new_buffer); - - while (*p) { - parent = *p; - buffer = rb_entry(parent, struct binder_buffer, rb_node); - BUG_ON(!buffer->free); - - buffer_size = binder_buffer_size(proc, buffer); - - if (new_buffer_size < buffer_size) - p = &parent->rb_left; - else - p = &parent->rb_right; - } - rb_link_node(&new_buffer->rb_node, parent, p); - rb_insert_color(&new_buffer->rb_node, &proc->free_buffers); -} - -static void binder_insert_allocated_buffer(struct binder_proc *proc, - struct binder_buffer *new_buffer) -{ - struct rb_node **p = &proc->allocated_buffers.rb_node; - struct rb_node *parent = NULL; - struct binder_buffer *buffer; - - BUG_ON(new_buffer->free); - - while (*p) { - parent = *p; - buffer = rb_entry(parent, struct binder_buffer, rb_node); - BUG_ON(buffer->free); - - if (new_buffer < buffer) - p = &parent->rb_left; - else if (new_buffer > buffer) - p = &parent->rb_right; - else - BUG(); - } - rb_link_node(&new_buffer->rb_node, parent, p); - rb_insert_color(&new_buffer->rb_node, &proc->allocated_buffers); -} - -static struct binder_buffer *binder_buffer_lookup(struct binder_proc *proc, - void __user *user_ptr) -{ - struct rb_node *n = proc->allocated_buffers.rb_node; - struct binder_buffer *buffer; - struct binder_buffer *kern_ptr; - - kern_ptr = user_ptr - proc->user_buffer_offset - - offsetof(struct binder_buffer, data); - - while (n) { - buffer = rb_entry(n, struct binder_buffer, rb_node); - BUG_ON(buffer->free); - - if (kern_ptr < buffer) - n = n->rb_left; - else if (kern_ptr > buffer) - n = n->rb_right; - else - return buffer; - } - return NULL; -} - -static int binder_update_page_range(struct binder_proc *proc, int allocate, - void *start, void *end, - struct vm_area_struct *vma) -{ - void *page_addr; - unsigned long user_page_addr; - struct vm_struct tmp_area; - struct page **page; - struct mm_struct *mm; - - binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "binder: %d: %s pages %p-%p\n", proc->pid, - allocate ? "allocate" : "free", start, end); - - if (end <= start) - return 0; - - if (vma) - mm = NULL; - else - mm = get_task_mm(proc->tsk); - - if (mm) { - down_write(&mm->mmap_sem); - vma = proc->vma; - } - - if (allocate == 0) - goto free_range; - - if (vma == NULL) { - printk(KERN_ERR "binder: %d: binder_alloc_buf failed to " - "map pages in userspace, no vma\n", proc->pid); - goto err_no_vma; - } - - for (page_addr = start; page_addr < end; page_addr += PAGE_SIZE) { - int ret; - struct page **page_array_ptr; - page = &proc->pages[(page_addr - proc->buffer) / PAGE_SIZE]; - - BUG_ON(*page); - *page = alloc_page(GFP_KERNEL | __GFP_ZERO); - if (*page == NULL) { - printk(KERN_ERR "binder: %d: binder_alloc_buf failed " - "for page at %p\n", proc->pid, page_addr); - goto err_alloc_page_failed; - } - tmp_area.addr = page_addr; - tmp_area.size = PAGE_SIZE + PAGE_SIZE /* guard page? */; - page_array_ptr = page; - ret = map_vm_area(&tmp_area, PAGE_KERNEL, &page_array_ptr); - if (ret) { - printk(KERN_ERR "binder: %d: binder_alloc_buf failed " - "to map page at %p in kernel\n", - proc->pid, page_addr); - goto err_map_kernel_failed; - } - user_page_addr = - (uintptr_t)page_addr + proc->user_buffer_offset; - ret = vm_insert_page(vma, user_page_addr, page[0]); - if (ret) { - printk(KERN_ERR "binder: %d: binder_alloc_buf failed " - "to map page at %lx in userspace\n", - proc->pid, user_page_addr); - goto err_vm_insert_page_failed; - } - /* vm_insert_page does not seem to increment the refcount */ - } - if (mm) { - up_write(&mm->mmap_sem); - mmput(mm); - } - return 0; - -free_range: - for (page_addr = end - PAGE_SIZE; page_addr >= start; - page_addr -= PAGE_SIZE) { - page = &proc->pages[(page_addr - proc->buffer) / PAGE_SIZE]; - if (vma) - zap_page_range(vma, (uintptr_t)page_addr + - proc->user_buffer_offset, PAGE_SIZE, NULL); -err_vm_insert_page_failed: - unmap_kernel_range((unsigned long)page_addr, PAGE_SIZE); -err_map_kernel_failed: - __free_page(*page); - *page = NULL; -err_alloc_page_failed: - ; - } -err_no_vma: - if (mm) { - up_write(&mm->mmap_sem); - mmput(mm); - } - return -ENOMEM; -} - -static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc, - size_t data_size, - size_t offsets_size, int is_async) -{ - struct rb_node *n = proc->free_buffers.rb_node; - struct binder_buffer *buffer; - size_t buffer_size; - struct rb_node *best_fit = NULL; - void *has_page_addr; - void *end_page_addr; - size_t size; - - if (proc->vma == NULL) { - printk(KERN_ERR "binder: %d: binder_alloc_buf, no vma\n", - proc->pid); - return NULL; - } - - size = ALIGN(data_size, sizeof(void *)) + - ALIGN(offsets_size, sizeof(void *)); - - if (size < data_size || size < offsets_size) { - binder_user_error("binder: %d: got transaction with invalid " - "size %zd-%zd\n", proc->pid, data_size, offsets_size); - return NULL; - } - - if (is_async && - proc->free_async_space < size + sizeof(struct binder_buffer)) { - binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "binder: %d: binder_alloc_buf size %zd" - "failed, no async space left\n", proc->pid, size); - return NULL; - } - - while (n) { - buffer = rb_entry(n, struct binder_buffer, rb_node); - BUG_ON(!buffer->free); - buffer_size = binder_buffer_size(proc, buffer); - - if (size < buffer_size) { - best_fit = n; - n = n->rb_left; - } else if (size > buffer_size) - n = n->rb_right; - else { - best_fit = n; - break; - } - } - if (best_fit == NULL) { - printk(KERN_ERR "binder: %d: binder_alloc_buf size %zd failed, " - "no address space\n", proc->pid, size); - return NULL; - } - if (n == NULL) { - buffer = rb_entry(best_fit, struct binder_buffer, rb_node); - buffer_size = binder_buffer_size(proc, buffer); - } - - binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "binder: %d: binder_alloc_buf size %zd got buff" - "er %p size %zd\n", proc->pid, size, buffer, buffer_size); - - has_page_addr = - (void *)(((uintptr_t)buffer->data + buffer_size) & PAGE_MASK); - if (n == NULL) { - if (size + sizeof(struct binder_buffer) + 4 >= buffer_size) - buffer_size = size; /* no room for other buffers */ - else - buffer_size = size + sizeof(struct binder_buffer); - } - end_page_addr = - (void *)PAGE_ALIGN((uintptr_t)buffer->data + buffer_size); - if (end_page_addr > has_page_addr) - end_page_addr = has_page_addr; - if (binder_update_page_range(proc, 1, - (void *)PAGE_ALIGN((uintptr_t)buffer->data), end_page_addr, NULL)) - return NULL; - - rb_erase(best_fit, &proc->free_buffers); - buffer->free = 0; - binder_insert_allocated_buffer(proc, buffer); - if (buffer_size != size) { - struct binder_buffer *new_buffer = (void *)buffer->data + size; - list_add(&new_buffer->entry, &buffer->entry); - new_buffer->free = 1; - binder_insert_free_buffer(proc, new_buffer); - } - binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "binder: %d: binder_alloc_buf size %zd got " - "%p\n", proc->pid, size, buffer); - buffer->data_size = data_size; - buffer->offsets_size = offsets_size; - buffer->async_transaction = is_async; - if (is_async) { - proc->free_async_space -= size + sizeof(struct binder_buffer); - binder_debug(BINDER_DEBUG_BUFFER_ALLOC_ASYNC, - "binder: %d: binder_alloc_buf size %zd " - "async free %zd\n", proc->pid, size, - proc->free_async_space); - } - - return buffer; -} - -static void *buffer_start_page(struct binder_buffer *buffer) -{ - return (void *)((uintptr_t)buffer & PAGE_MASK); -} - -static void *buffer_end_page(struct binder_buffer *buffer) -{ - return (void *)(((uintptr_t)(buffer + 1) - 1) & PAGE_MASK); -} - -static void binder_delete_free_buffer(struct binder_proc *proc, - struct binder_buffer *buffer) -{ - struct binder_buffer *prev, *next = NULL; - int free_page_end = 1; - int free_page_start = 1; - - BUG_ON(proc->buffers.next == &buffer->entry); - prev = list_entry(buffer->entry.prev, struct binder_buffer, entry); - BUG_ON(!prev->free); - if (buffer_end_page(prev) == buffer_start_page(buffer)) { - free_page_start = 0; - if (buffer_end_page(prev) == buffer_end_page(buffer)) - free_page_end = 0; - binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "binder: %d: merge free, buffer %p " - "share page with %p\n", proc->pid, buffer, prev); - } - - if (!list_is_last(&buffer->entry, &proc->buffers)) { - next = list_entry(buffer->entry.next, - struct binder_buffer, entry); - if (buffer_start_page(next) == buffer_end_page(buffer)) { - free_page_end = 0; - if (buffer_start_page(next) == - buffer_start_page(buffer)) - free_page_start = 0; - binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "binder: %d: merge free, buffer" - " %p share page with %p\n", proc->pid, - buffer, prev); - } - } - list_del(&buffer->entry); - if (free_page_start || free_page_end) { - binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "binder: %d: merge free, buffer %p do " - "not share page%s%s with with %p or %p\n", - proc->pid, buffer, free_page_start ? "" : " end", - free_page_end ? "" : " start", prev, next); - binder_update_page_range(proc, 0, free_page_start ? - buffer_start_page(buffer) : buffer_end_page(buffer), - (free_page_end ? buffer_end_page(buffer) : - buffer_start_page(buffer)) + PAGE_SIZE, NULL); - } -} - -static void binder_free_buf(struct binder_proc *proc, - struct binder_buffer *buffer) -{ - size_t size, buffer_size; - - buffer_size = binder_buffer_size(proc, buffer); - - size = ALIGN(buffer->data_size, sizeof(void *)) + - ALIGN(buffer->offsets_size, sizeof(void *)); - - binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "binder: %d: binder_free_buf %p size %zd buffer" - "_size %zd\n", proc->pid, buffer, size, buffer_size); - - BUG_ON(buffer->free); - BUG_ON(size > buffer_size); - BUG_ON(buffer->transaction != NULL); - BUG_ON((void *)buffer < proc->buffer); - BUG_ON((void *)buffer > proc->buffer + proc->buffer_size); - - if (buffer->async_transaction) { - proc->free_async_space += size + sizeof(struct binder_buffer); - - binder_debug(BINDER_DEBUG_BUFFER_ALLOC_ASYNC, - "binder: %d: binder_free_buf size %zd " - "async free %zd\n", proc->pid, size, - proc->free_async_space); - } - - binder_update_page_range(proc, 0, - (void *)PAGE_ALIGN((uintptr_t)buffer->data), - (void *)(((uintptr_t)buffer->data + buffer_size) & PAGE_MASK), - NULL); - rb_erase(&buffer->rb_node, &proc->allocated_buffers); - buffer->free = 1; - if (!list_is_last(&buffer->entry, &proc->buffers)) { - struct binder_buffer *next = list_entry(buffer->entry.next, - struct binder_buffer, entry); - if (next->free) { - rb_erase(&next->rb_node, &proc->free_buffers); - binder_delete_free_buffer(proc, next); - } - } - if (proc->buffers.next != &buffer->entry) { - struct binder_buffer *prev = list_entry(buffer->entry.prev, - struct binder_buffer, entry); - if (prev->free) { - binder_delete_free_buffer(proc, buffer); - rb_erase(&prev->rb_node, &proc->free_buffers); - buffer = prev; - } - } - binder_insert_free_buffer(proc, buffer); -} - -static struct binder_node *binder_get_node(struct binder_proc *proc, - void __user *ptr) -{ - struct rb_node *n = proc->nodes.rb_node; - struct binder_node *node; - - while (n) { - node = rb_entry(n, struct binder_node, rb_node); - - if (ptr < node->ptr) - n = n->rb_left; - else if (ptr > node->ptr) - n = n->rb_right; - else - return node; - } - return NULL; -} - -static struct binder_node *binder_new_node(struct binder_proc *proc, - void __user *ptr, - void __user *cookie) -{ - struct rb_node **p = &proc->nodes.rb_node; - struct rb_node *parent = NULL; - struct binder_node *node; - - while (*p) { - parent = *p; - node = rb_entry(parent, struct binder_node, rb_node); - - if (ptr < node->ptr) - p = &(*p)->rb_left; - else if (ptr > node->ptr) - p = &(*p)->rb_right; - else - return NULL; - } - - node = kzalloc(sizeof(*node), GFP_KERNEL); - if (node == NULL) - return NULL; - binder_stats_created(BINDER_STAT_NODE); - rb_link_node(&node->rb_node, parent, p); - rb_insert_color(&node->rb_node, &proc->nodes); - node->debug_id = ++binder_last_id; - node->proc = proc; - node->ptr = ptr; - node->cookie = cookie; - node->work.type = BINDER_WORK_NODE; - INIT_LIST_HEAD(&node->work.entry); - INIT_LIST_HEAD(&node->async_todo); - binder_debug(BINDER_DEBUG_INTERNAL_REFS, - "binder: %d:%d node %d u%p c%p created\n", - proc->pid, current->pid, node->debug_id, - node->ptr, node->cookie); - return node; -} - -static int binder_inc_node(struct binder_node *node, int strong, int internal, - struct list_head *target_list) -{ - if (strong) { - if (internal) { - if (target_list == NULL && - node->internal_strong_refs == 0 && - !(node == binder_context_mgr_node && - node->has_strong_ref)) { - printk(KERN_ERR "binder: invalid inc strong " - "node for %d\n", node->debug_id); - return -EINVAL; - } - node->internal_strong_refs++; - } else - node->local_strong_refs++; - if (!node->has_strong_ref && target_list) { - list_del_init(&node->work.entry); - list_add_tail(&node->work.entry, target_list); - } - } else { - if (!internal) - node->local_weak_refs++; - if (!node->has_weak_ref && list_empty(&node->work.entry)) { - if (target_list == NULL) { - printk(KERN_ERR "binder: invalid inc weak node " - "for %d\n", node->debug_id); - return -EINVAL; - } - list_add_tail(&node->work.entry, target_list); - } - } - return 0; -} - -static int binder_dec_node(struct binder_node *node, int strong, int internal) -{ - if (strong) { - if (internal) - node->internal_strong_refs--; - else - node->local_strong_refs--; - if (node->local_strong_refs || node->internal_strong_refs) - return 0; - } else { - if (!internal) - node->local_weak_refs--; - if (node->local_weak_refs || !hlist_empty(&node->refs)) - return 0; - } - if (node->proc && (node->has_strong_ref || node->has_weak_ref)) { - if (list_empty(&node->work.entry)) { - list_add_tail(&node->work.entry, &node->proc->todo); - wake_up_interruptible(&node->proc->wait); - } - } else { - if (hlist_empty(&node->refs) && !node->local_strong_refs && - !node->local_weak_refs) { - list_del_init(&node->work.entry); - if (node->proc) { - rb_erase(&node->rb_node, &node->proc->nodes); - binder_debug(BINDER_DEBUG_INTERNAL_REFS, - "binder: refless node %d deleted\n", - node->debug_id); - } else { - hlist_del(&node->dead_node); - binder_debug(BINDER_DEBUG_INTERNAL_REFS, - "binder: dead node %d deleted\n", - node->debug_id); - } - kfree(node); - binder_stats_deleted(BINDER_STAT_NODE); - } - } - - return 0; -} - - -static struct binder_ref *binder_get_ref(struct binder_proc *proc, - uint32_t desc) -{ - struct rb_node *n = proc->refs_by_desc.rb_node; - struct binder_ref *ref; - - while (n) { - ref = rb_entry(n, struct binder_ref, rb_node_desc); - - if (desc < ref->desc) - n = n->rb_left; - else if (desc > ref->desc) - n = n->rb_right; - else - return ref; - } - return NULL; -} - -static struct binder_ref *binder_get_ref_for_node(struct binder_proc *proc, - struct binder_node *node) -{ - struct rb_node *n; - struct rb_node **p = &proc->refs_by_node.rb_node; - struct rb_node *parent = NULL; - struct binder_ref *ref, *new_ref; - - while (*p) { - parent = *p; - ref = rb_entry(parent, struct binder_ref, rb_node_node); - - if (node < ref->node) - p = &(*p)->rb_left; - else if (node > ref->node) - p = &(*p)->rb_right; - else - return ref; - } - new_ref = kzalloc(sizeof(*ref), GFP_KERNEL); - if (new_ref == NULL) - return NULL; - binder_stats_created(BINDER_STAT_REF); - new_ref->debug_id = ++binder_last_id; - new_ref->proc = proc; - new_ref->node = node; - rb_link_node(&new_ref->rb_node_node, parent, p); - rb_insert_color(&new_ref->rb_node_node, &proc->refs_by_node); - - new_ref->desc = (node == binder_context_mgr_node) ? 0 : 1; - for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) { - ref = rb_entry(n, struct binder_ref, rb_node_desc); - if (ref->desc > new_ref->desc) - break; - new_ref->desc = ref->desc + 1; - } - - p = &proc->refs_by_desc.rb_node; - while (*p) { - parent = *p; - ref = rb_entry(parent, struct binder_ref, rb_node_desc); - - if (new_ref->desc < ref->desc) - p = &(*p)->rb_left; - else if (new_ref->desc > ref->desc) - p = &(*p)->rb_right; - else - BUG(); - } - rb_link_node(&new_ref->rb_node_desc, parent, p); - rb_insert_color(&new_ref->rb_node_desc, &proc->refs_by_desc); - if (node) { - hlist_add_head(&new_ref->node_entry, &node->refs); - - binder_debug(BINDER_DEBUG_INTERNAL_REFS, - "binder: %d new ref %d desc %d for " - "node %d\n", proc->pid, new_ref->debug_id, - new_ref->desc, node->debug_id); - } else { - binder_debug(BINDER_DEBUG_INTERNAL_REFS, - "binder: %d new ref %d desc %d for " - "dead node\n", proc->pid, new_ref->debug_id, - new_ref->desc); - } - return new_ref; -} - -static void binder_delete_ref(struct binder_ref *ref) -{ - binder_debug(BINDER_DEBUG_INTERNAL_REFS, - "binder: %d delete ref %d desc %d for " - "node %d\n", ref->proc->pid, ref->debug_id, - ref->desc, ref->node->debug_id); - - rb_erase(&ref->rb_node_desc, &ref->proc->refs_by_desc); - rb_erase(&ref->rb_node_node, &ref->proc->refs_by_node); - if (ref->strong) - binder_dec_node(ref->node, 1, 1); - hlist_del(&ref->node_entry); - binder_dec_node(ref->node, 0, 1); - if (ref->death) { - binder_debug(BINDER_DEBUG_DEAD_BINDER, - "binder: %d delete ref %d desc %d " - "has death notification\n", ref->proc->pid, - ref->debug_id, ref->desc); - list_del(&ref->death->work.entry); - kfree(ref->death); - binder_stats_deleted(BINDER_STAT_DEATH); - } - kfree(ref); - binder_stats_deleted(BINDER_STAT_REF); -} - -static int binder_inc_ref(struct binder_ref *ref, int strong, - struct list_head *target_list) -{ - int ret; - if (strong) { - if (ref->strong == 0) { - ret = binder_inc_node(ref->node, 1, 1, target_list); - if (ret) - return ret; - } - ref->strong++; - } else { - if (ref->weak == 0) { - ret = binder_inc_node(ref->node, 0, 1, target_list); - if (ret) - return ret; - } - ref->weak++; - } - return 0; -} - - -static int binder_dec_ref(struct binder_ref *ref, int strong) -{ - if (strong) { - if (ref->strong == 0) { - binder_user_error("binder: %d invalid dec strong, " - "ref %d desc %d s %d w %d\n", - ref->proc->pid, ref->debug_id, - ref->desc, ref->strong, ref->weak); - return -EINVAL; - } - ref->strong--; - if (ref->strong == 0) { - int ret; - ret = binder_dec_node(ref->node, strong, 1); - if (ret) - return ret; - } - } else { - if (ref->weak == 0) { - binder_user_error("binder: %d invalid dec weak, " - "ref %d desc %d s %d w %d\n", - ref->proc->pid, ref->debug_id, - ref->desc, ref->strong, ref->weak); - return -EINVAL; - } - ref->weak--; - } - if (ref->strong == 0 && ref->weak == 0) - binder_delete_ref(ref); - return 0; -} - -static void binder_pop_transaction(struct binder_thread *target_thread, - struct binder_transaction *t) -{ - if (target_thread) { - BUG_ON(target_thread->transaction_stack != t); - BUG_ON(target_thread->transaction_stack->from != target_thread); - target_thread->transaction_stack = - target_thread->transaction_stack->from_parent; - t->from = NULL; - } - t->need_reply = 0; - if (t->buffer) - t->buffer->transaction = NULL; - kfree(t); - binder_stats_deleted(BINDER_STAT_TRANSACTION); -} - -static void binder_send_failed_reply(struct binder_transaction *t, - uint32_t error_code) -{ - struct binder_thread *target_thread; - BUG_ON(t->flags & TF_ONE_WAY); - while (1) { - target_thread = t->from; - if (target_thread) { - if (target_thread->return_error != BR_OK && - target_thread->return_error2 == BR_OK) { - target_thread->return_error2 = - target_thread->return_error; - target_thread->return_error = BR_OK; - } - if (target_thread->return_error == BR_OK) { - binder_debug(BINDER_DEBUG_FAILED_TRANSACTION, - "binder: send failed reply for " - "transaction %d to %d:%d\n", - t->debug_id, target_thread->proc->pid, - target_thread->pid); - - binder_pop_transaction(target_thread, t); - target_thread->return_error = error_code; - wake_up_interruptible(&target_thread->wait); - } else { - printk(KERN_ERR "binder: reply failed, target " - "thread, %d:%d, has error code %d " - "already\n", target_thread->proc->pid, - target_thread->pid, - target_thread->return_error); - } - return; - } else { - struct binder_transaction *next = t->from_parent; - - binder_debug(BINDER_DEBUG_FAILED_TRANSACTION, - "binder: send failed reply " - "for transaction %d, target dead\n", - t->debug_id); - - binder_pop_transaction(target_thread, t); - if (next == NULL) { - binder_debug(BINDER_DEBUG_DEAD_BINDER, - "binder: reply failed," - " no target thread at root\n"); - return; - } - t = next; - binder_debug(BINDER_DEBUG_DEAD_BINDER, - "binder: reply failed, no target " - "thread -- retry %d\n", t->debug_id); - } - } -} - -static void binder_transaction_buffer_release(struct binder_proc *proc, - struct binder_buffer *buffer, - size_t *failed_at) -{ - size_t *offp, *off_end; - int debug_id = buffer->debug_id; - - binder_debug(BINDER_DEBUG_TRANSACTION, - "binder: %d buffer release %d, size %zd-%zd, failed at %p\n", - proc->pid, buffer->debug_id, - buffer->data_size, buffer->offsets_size, failed_at); - - if (buffer->target_node) - binder_dec_node(buffer->target_node, 1, 0); - - offp = (size_t *)(buffer->data + ALIGN(buffer->data_size, sizeof(void *))); - if (failed_at) - off_end = failed_at; - else - off_end = (void *)offp + buffer->offsets_size; - for (; offp < off_end; offp++) { - struct flat_binder_object *fp; - if (*offp > buffer->data_size - sizeof(*fp) || - buffer->data_size < sizeof(*fp) || - !IS_ALIGNED(*offp, sizeof(void *))) { - printk(KERN_ERR "binder: transaction release %d bad" - "offset %zd, size %zd\n", debug_id, - *offp, buffer->data_size); - continue; - } - fp = (struct flat_binder_object *)(buffer->data + *offp); - switch (fp->type) { - case BINDER_TYPE_BINDER: - case BINDER_TYPE_WEAK_BINDER: { - struct binder_node *node = binder_get_node(proc, fp->binder); - if (node == NULL) { - printk(KERN_ERR "binder: transaction release %d" - " bad node %p\n", debug_id, fp->binder); - break; - } - binder_debug(BINDER_DEBUG_TRANSACTION, - " node %d u%p\n", - node->debug_id, node->ptr); - binder_dec_node(node, fp->type == BINDER_TYPE_BINDER, 0); - } break; - case BINDER_TYPE_HANDLE: - case BINDER_TYPE_WEAK_HANDLE: { - struct binder_ref *ref = binder_get_ref(proc, fp->handle); - if (ref == NULL) { - printk(KERN_ERR "binder: transaction release %d" - " bad handle %ld\n", debug_id, - fp->handle); - break; - } - binder_debug(BINDER_DEBUG_TRANSACTION, - " ref %d desc %d (node %d)\n", - ref->debug_id, ref->desc, ref->node->debug_id); - binder_dec_ref(ref, fp->type == BINDER_TYPE_HANDLE); - } break; - - case BINDER_TYPE_FD: - binder_debug(BINDER_DEBUG_TRANSACTION, - " fd %ld\n", fp->handle); - if (failed_at) - task_close_fd(proc, fp->handle); - break; - - default: - printk(KERN_ERR "binder: transaction release %d bad " - "object type %lx\n", debug_id, fp->type); - break; - } - } -} - -static void binder_transaction(struct binder_proc *proc, - struct binder_thread *thread, - struct binder_transaction_data *tr, int reply) -{ - struct binder_transaction *t; - struct binder_work *tcomplete; - size_t *offp, *off_end; - struct binder_proc *target_proc; - struct binder_thread *target_thread = NULL; - struct binder_node *target_node = NULL; - struct list_head *target_list; - wait_queue_head_t *target_wait; - struct binder_transaction *in_reply_to = NULL; - struct binder_transaction_log_entry *e; - uint32_t return_error; - - e = binder_transaction_log_add(&binder_transaction_log); - e->call_type = reply ? 2 : !!(tr->flags & TF_ONE_WAY); - e->from_proc = proc->pid; - e->from_thread = thread->pid; - e->target_handle = tr->target.handle; - e->data_size = tr->data_size; - e->offsets_size = tr->offsets_size; - - if (reply) { - in_reply_to = thread->transaction_stack; - if (in_reply_to == NULL) { - binder_user_error("binder: %d:%d got reply transaction " - "with no transaction stack\n", - proc->pid, thread->pid); - return_error = BR_FAILED_REPLY; - goto err_empty_call_stack; - } - binder_set_nice(in_reply_to->saved_priority); - if (in_reply_to->to_thread != thread) { - binder_user_error("binder: %d:%d got reply transaction " - "with bad transaction stack," - " transaction %d has target %d:%d\n", - proc->pid, thread->pid, in_reply_to->debug_id, - in_reply_to->to_proc ? - in_reply_to->to_proc->pid : 0, - in_reply_to->to_thread ? - in_reply_to->to_thread->pid : 0); - return_error = BR_FAILED_REPLY; - in_reply_to = NULL; - goto err_bad_call_stack; - } - thread->transaction_stack = in_reply_to->to_parent; - target_thread = in_reply_to->from; - if (target_thread == NULL) { - return_error = BR_DEAD_REPLY; - goto err_dead_binder; - } - if (target_thread->transaction_stack != in_reply_to) { - binder_user_error("binder: %d:%d got reply transaction " - "with bad target transaction stack %d, " - "expected %d\n", - proc->pid, thread->pid, - target_thread->transaction_stack ? - target_thread->transaction_stack->debug_id : 0, - in_reply_to->debug_id); - return_error = BR_FAILED_REPLY; - in_reply_to = NULL; - target_thread = NULL; - goto err_dead_binder; - } - target_proc = target_thread->proc; - } else { - if (tr->target.handle) { - struct binder_ref *ref; - ref = binder_get_ref(proc, tr->target.handle); - if (ref == NULL) { - binder_user_error("binder: %d:%d got " - "transaction to invalid handle\n", - proc->pid, thread->pid); - return_error = BR_FAILED_REPLY; - goto err_invalid_target_handle; - } - target_node = ref->node; - } else { - target_node = binder_context_mgr_node; - if (target_node == NULL) { - return_error = BR_DEAD_REPLY; - goto err_no_context_mgr_node; - } - } - e->to_node = target_node->debug_id; - target_proc = target_node->proc; - if (target_proc == NULL) { - return_error = BR_DEAD_REPLY; - goto err_dead_binder; - } - if (!(tr->flags & TF_ONE_WAY) && thread->transaction_stack) { - struct binder_transaction *tmp; - tmp = thread->transaction_stack; - if (tmp->to_thread != thread) { - binder_user_error("binder: %d:%d got new " - "transaction with bad transaction stack" - ", transaction %d has target %d:%d\n", - proc->pid, thread->pid, tmp->debug_id, - tmp->to_proc ? tmp->to_proc->pid : 0, - tmp->to_thread ? - tmp->to_thread->pid : 0); - return_error = BR_FAILED_REPLY; - goto err_bad_call_stack; - } - while (tmp) { - if (tmp->from && tmp->from->proc == target_proc) - target_thread = tmp->from; - tmp = tmp->from_parent; - } - } - } - if (target_thread) { - e->to_thread = target_thread->pid; - target_list = &target_thread->todo; - target_wait = &target_thread->wait; - } else { - target_list = &target_proc->todo; - target_wait = &target_proc->wait; - } - e->to_proc = target_proc->pid; - - /* TODO: reuse incoming transaction for reply */ - t = kzalloc(sizeof(*t), GFP_KERNEL); - if (t == NULL) { - return_error = BR_FAILED_REPLY; - goto err_alloc_t_failed; - } - binder_stats_created(BINDER_STAT_TRANSACTION); - - tcomplete = kzalloc(sizeof(*tcomplete), GFP_KERNEL); - if (tcomplete == NULL) { - return_error = BR_FAILED_REPLY; - goto err_alloc_tcomplete_failed; - } - binder_stats_created(BINDER_STAT_TRANSACTION_COMPLETE); - - t->debug_id = ++binder_last_id; - e->debug_id = t->debug_id; - - if (reply) - binder_debug(BINDER_DEBUG_TRANSACTION, - "binder: %d:%d BC_REPLY %d -> %d:%d, " - "data %p-%p size %zd-%zd\n", - proc->pid, thread->pid, t->debug_id, - target_proc->pid, target_thread->pid, - tr->data.ptr.buffer, tr->data.ptr.offsets, - tr->data_size, tr->offsets_size); - else - binder_debug(BINDER_DEBUG_TRANSACTION, - "binder: %d:%d BC_TRANSACTION %d -> " - "%d - node %d, data %p-%p size %zd-%zd\n", - proc->pid, thread->pid, t->debug_id, - target_proc->pid, target_node->debug_id, - tr->data.ptr.buffer, tr->data.ptr.offsets, - tr->data_size, tr->offsets_size); - - if (!reply && !(tr->flags & TF_ONE_WAY)) - t->from = thread; - else - t->from = NULL; - t->sender_euid = proc->tsk->cred->euid; - t->to_proc = target_proc; - t->to_thread = target_thread; - t->code = tr->code; - t->flags = tr->flags; - t->priority = task_nice(current); - t->buffer = binder_alloc_buf(target_proc, tr->data_size, - tr->offsets_size, !reply && (t->flags & TF_ONE_WAY)); - if (t->buffer == NULL) { - return_error = BR_FAILED_REPLY; - goto err_binder_alloc_buf_failed; - } - t->buffer->allow_user_free = 0; - t->buffer->debug_id = t->debug_id; - t->buffer->transaction = t; - t->buffer->target_node = target_node; - if (target_node) - binder_inc_node(target_node, 1, 0, NULL); - - offp = (size_t *)(t->buffer->data + ALIGN(tr->data_size, sizeof(void *))); - - if (copy_from_user(t->buffer->data, tr->data.ptr.buffer, tr->data_size)) { - binder_user_error("binder: %d:%d got transaction with invalid " - "data ptr\n", proc->pid, thread->pid); - return_error = BR_FAILED_REPLY; - goto err_copy_data_failed; - } - if (copy_from_user(offp, tr->data.ptr.offsets, tr->offsets_size)) { - binder_user_error("binder: %d:%d got transaction with invalid " - "offsets ptr\n", proc->pid, thread->pid); - return_error = BR_FAILED_REPLY; - goto err_copy_data_failed; - } - if (!IS_ALIGNED(tr->offsets_size, sizeof(size_t))) { - binder_user_error("binder: %d:%d got transaction with " - "invalid offsets size, %zd\n", - proc->pid, thread->pid, tr->offsets_size); - return_error = BR_FAILED_REPLY; - goto err_bad_offset; - } - off_end = (void *)offp + tr->offsets_size; - for (; offp < off_end; offp++) { - struct flat_binder_object *fp; - if (*offp > t->buffer->data_size - sizeof(*fp) || - t->buffer->data_size < sizeof(*fp) || - !IS_ALIGNED(*offp, sizeof(void *))) { - binder_user_error("binder: %d:%d got transaction with " - "invalid offset, %zd\n", - proc->pid, thread->pid, *offp); - return_error = BR_FAILED_REPLY; - goto err_bad_offset; - } - fp = (struct flat_binder_object *)(t->buffer->data + *offp); - switch (fp->type) { - case BINDER_TYPE_BINDER: - case BINDER_TYPE_WEAK_BINDER: { - struct binder_ref *ref; - struct binder_node *node = binder_get_node(proc, fp->binder); - if (node == NULL) { - node = binder_new_node(proc, fp->binder, fp->cookie); - if (node == NULL) { - return_error = BR_FAILED_REPLY; - goto err_binder_new_node_failed; - } - node->min_priority = fp->flags & FLAT_BINDER_FLAG_PRIORITY_MASK; - node->accept_fds = !!(fp->flags & FLAT_BINDER_FLAG_ACCEPTS_FDS); - } - if (fp->cookie != node->cookie) { - binder_user_error("binder: %d:%d sending u%p " - "node %d, cookie mismatch %p != %p\n", - proc->pid, thread->pid, - fp->binder, node->debug_id, - fp->cookie, node->cookie); - goto err_binder_get_ref_for_node_failed; - } - ref = binder_get_ref_for_node(target_proc, node); - if (ref == NULL) { - return_error = BR_FAILED_REPLY; - goto err_binder_get_ref_for_node_failed; - } - if (fp->type == BINDER_TYPE_BINDER) - fp->type = BINDER_TYPE_HANDLE; - else - fp->type = BINDER_TYPE_WEAK_HANDLE; - fp->handle = ref->desc; - binder_inc_ref(ref, fp->type == BINDER_TYPE_HANDLE, - &thread->todo); - - binder_debug(BINDER_DEBUG_TRANSACTION, - " node %d u%p -> ref %d desc %d\n", - node->debug_id, node->ptr, ref->debug_id, - ref->desc); - } break; - case BINDER_TYPE_HANDLE: - case BINDER_TYPE_WEAK_HANDLE: { - struct binder_ref *ref = binder_get_ref(proc, fp->handle); - if (ref == NULL) { - binder_user_error("binder: %d:%d got " - "transaction with invalid " - "handle, %ld\n", proc->pid, - thread->pid, fp->handle); - return_error = BR_FAILED_REPLY; - goto err_binder_get_ref_failed; - } - if (ref->node->proc == target_proc) { - if (fp->type == BINDER_TYPE_HANDLE) - fp->type = BINDER_TYPE_BINDER; - else - fp->type = BINDER_TYPE_WEAK_BINDER; - fp->binder = ref->node->ptr; - fp->cookie = ref->node->cookie; - binder_inc_node(ref->node, fp->type == BINDER_TYPE_BINDER, 0, NULL); - binder_debug(BINDER_DEBUG_TRANSACTION, - " ref %d desc %d -> node %d u%p\n", - ref->debug_id, ref->desc, ref->node->debug_id, - ref->node->ptr); - } else { - struct binder_ref *new_ref; - new_ref = binder_get_ref_for_node(target_proc, ref->node); - if (new_ref == NULL) { - return_error = BR_FAILED_REPLY; - goto err_binder_get_ref_for_node_failed; - } - fp->handle = new_ref->desc; - binder_inc_ref(new_ref, fp->type == BINDER_TYPE_HANDLE, NULL); - binder_debug(BINDER_DEBUG_TRANSACTION, - " ref %d desc %d -> ref %d desc %d (node %d)\n", - ref->debug_id, ref->desc, new_ref->debug_id, - new_ref->desc, ref->node->debug_id); - } - } break; - - case BINDER_TYPE_FD: { - int target_fd; - struct file *file; - - if (reply) { - if (!(in_reply_to->flags & TF_ACCEPT_FDS)) { - binder_user_error("binder: %d:%d got reply with fd, %ld, but target does not allow fds\n", - proc->pid, thread->pid, fp->handle); - return_error = BR_FAILED_REPLY; - goto err_fd_not_allowed; - } - } else if (!target_node->accept_fds) { - binder_user_error("binder: %d:%d got transaction with fd, %ld, but target does not allow fds\n", - proc->pid, thread->pid, fp->handle); - return_error = BR_FAILED_REPLY; - goto err_fd_not_allowed; - } - - file = fget(fp->handle); - if (file == NULL) { - binder_user_error("binder: %d:%d got transaction with invalid fd, %ld\n", - proc->pid, thread->pid, fp->handle); - return_error = BR_FAILED_REPLY; - goto err_fget_failed; - } - target_fd = task_get_unused_fd_flags(target_proc, O_CLOEXEC); - if (target_fd < 0) { - fput(file); - return_error = BR_FAILED_REPLY; - goto err_get_unused_fd_failed; - } - task_fd_install(target_proc, target_fd, file); - binder_debug(BINDER_DEBUG_TRANSACTION, - " fd %ld -> %d\n", fp->handle, target_fd); - /* TODO: fput? */ - fp->handle = target_fd; - } break; - - default: - binder_user_error("binder: %d:%d got transactio" - "n with invalid object type, %lx\n", - proc->pid, thread->pid, fp->type); - return_error = BR_FAILED_REPLY; - goto err_bad_object_type; - } - } - if (reply) { - BUG_ON(t->buffer->async_transaction != 0); - binder_pop_transaction(target_thread, in_reply_to); - } else if (!(t->flags & TF_ONE_WAY)) { - BUG_ON(t->buffer->async_transaction != 0); - t->need_reply = 1; - t->from_parent = thread->transaction_stack; - thread->transaction_stack = t; - } else { - BUG_ON(target_node == NULL); - BUG_ON(t->buffer->async_transaction != 1); - if (target_node->has_async_transaction) { - target_list = &target_node->async_todo; - target_wait = NULL; - } else - target_node->has_async_transaction = 1; - } - t->work.type = BINDER_WORK_TRANSACTION; - list_add_tail(&t->work.entry, target_list); - tcomplete->type = BINDER_WORK_TRANSACTION_COMPLETE; - list_add_tail(&tcomplete->entry, &thread->todo); - if (target_wait) - wake_up_interruptible(target_wait); - return; - -err_get_unused_fd_failed: -err_fget_failed: -err_fd_not_allowed: -err_binder_get_ref_for_node_failed: -err_binder_get_ref_failed: -err_binder_new_node_failed: -err_bad_object_type: -err_bad_offset: -err_copy_data_failed: - binder_transaction_buffer_release(target_proc, t->buffer, offp); - t->buffer->transaction = NULL; - binder_free_buf(target_proc, t->buffer); -err_binder_alloc_buf_failed: - kfree(tcomplete); - binder_stats_deleted(BINDER_STAT_TRANSACTION_COMPLETE); -err_alloc_tcomplete_failed: - kfree(t); - binder_stats_deleted(BINDER_STAT_TRANSACTION); -err_alloc_t_failed: -err_bad_call_stack: -err_empty_call_stack: -err_dead_binder: -err_invalid_target_handle: -err_no_context_mgr_node: - binder_debug(BINDER_DEBUG_FAILED_TRANSACTION, - "binder: %d:%d transaction failed %d, size %zd-%zd\n", - proc->pid, thread->pid, return_error, - tr->data_size, tr->offsets_size); - - { - struct binder_transaction_log_entry *fe; - fe = binder_transaction_log_add(&binder_transaction_log_failed); - *fe = *e; - } - - BUG_ON(thread->return_error != BR_OK); - if (in_reply_to) { - thread->return_error = BR_TRANSACTION_COMPLETE; - binder_send_failed_reply(in_reply_to, return_error); - } else - thread->return_error = return_error; -} - -int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, - void __user *buffer, int size, signed long *consumed) -{ - uint32_t cmd; - void __user *ptr = buffer + *consumed; - void __user *end = buffer + size; - - while (ptr < end && thread->return_error == BR_OK) { - if (get_user(cmd, (uint32_t __user *)ptr)) - return -EFAULT; - ptr += sizeof(uint32_t); - if (_IOC_NR(cmd) < ARRAY_SIZE(binder_stats.bc)) { - binder_stats.bc[_IOC_NR(cmd)]++; - proc->stats.bc[_IOC_NR(cmd)]++; - thread->stats.bc[_IOC_NR(cmd)]++; - } - switch (cmd) { - case BC_INCREFS: - case BC_ACQUIRE: - case BC_RELEASE: - case BC_DECREFS: { - uint32_t target; - struct binder_ref *ref; - const char *debug_string; - - if (get_user(target, (uint32_t __user *)ptr)) - return -EFAULT; - ptr += sizeof(uint32_t); - if (target == 0 && binder_context_mgr_node && - (cmd == BC_INCREFS || cmd == BC_ACQUIRE)) { - ref = binder_get_ref_for_node(proc, - binder_context_mgr_node); - if (ref->desc != target) { - binder_user_error("binder: %d:" - "%d tried to acquire " - "reference to desc 0, " - "got %d instead\n", - proc->pid, thread->pid, - ref->desc); - } - } else - ref = binder_get_ref(proc, target); - if (ref == NULL) { - binder_user_error("binder: %d:%d refcou" - "nt change on invalid ref %d\n", - proc->pid, thread->pid, target); - break; - } - switch (cmd) { - case BC_INCREFS: - debug_string = "IncRefs"; - binder_inc_ref(ref, 0, NULL); - break; - case BC_ACQUIRE: - debug_string = "Acquire"; - binder_inc_ref(ref, 1, NULL); - break; - case BC_RELEASE: - debug_string = "Release"; - binder_dec_ref(ref, 1); - break; - case BC_DECREFS: - default: - debug_string = "DecRefs"; - binder_dec_ref(ref, 0); - break; - } - binder_debug(BINDER_DEBUG_USER_REFS, - "binder: %d:%d %s ref %d desc %d s %d w %d for node %d\n", - proc->pid, thread->pid, debug_string, ref->debug_id, - ref->desc, ref->strong, ref->weak, ref->node->debug_id); - break; - } - case BC_INCREFS_DONE: - case BC_ACQUIRE_DONE: { - void __user *node_ptr; - void *cookie; - struct binder_node *node; - - if (get_user(node_ptr, (void * __user *)ptr)) - return -EFAULT; - ptr += sizeof(void *); - if (get_user(cookie, (void * __user *)ptr)) - return -EFAULT; - ptr += sizeof(void *); - node = binder_get_node(proc, node_ptr); - if (node == NULL) { - binder_user_error("binder: %d:%d " - "%s u%p no match\n", - proc->pid, thread->pid, - cmd == BC_INCREFS_DONE ? - "BC_INCREFS_DONE" : - "BC_ACQUIRE_DONE", - node_ptr); - break; - } - if (cookie != node->cookie) { - binder_user_error("binder: %d:%d %s u%p node %d" - " cookie mismatch %p != %p\n", - proc->pid, thread->pid, - cmd == BC_INCREFS_DONE ? - "BC_INCREFS_DONE" : "BC_ACQUIRE_DONE", - node_ptr, node->debug_id, - cookie, node->cookie); - break; - } - if (cmd == BC_ACQUIRE_DONE) { - if (node->pending_strong_ref == 0) { - binder_user_error("binder: %d:%d " - "BC_ACQUIRE_DONE node %d has " - "no pending acquire request\n", - proc->pid, thread->pid, - node->debug_id); - break; - } - node->pending_strong_ref = 0; - } else { - if (node->pending_weak_ref == 0) { - binder_user_error("binder: %d:%d " - "BC_INCREFS_DONE node %d has " - "no pending increfs request\n", - proc->pid, thread->pid, - node->debug_id); - break; - } - node->pending_weak_ref = 0; - } - binder_dec_node(node, cmd == BC_ACQUIRE_DONE, 0); - binder_debug(BINDER_DEBUG_USER_REFS, - "binder: %d:%d %s node %d ls %d lw %d\n", - proc->pid, thread->pid, - cmd == BC_INCREFS_DONE ? "BC_INCREFS_DONE" : "BC_ACQUIRE_DONE", - node->debug_id, node->local_strong_refs, node->local_weak_refs); - break; - } - case BC_ATTEMPT_ACQUIRE: - printk(KERN_ERR "binder: BC_ATTEMPT_ACQUIRE not supported\n"); - return -EINVAL; - case BC_ACQUIRE_RESULT: - printk(KERN_ERR "binder: BC_ACQUIRE_RESULT not supported\n"); - return -EINVAL; - - case BC_FREE_BUFFER: { - void __user *data_ptr; - struct binder_buffer *buffer; - - if (get_user(data_ptr, (void * __user *)ptr)) - return -EFAULT; - ptr += sizeof(void *); - - buffer = binder_buffer_lookup(proc, data_ptr); - if (buffer == NULL) { - binder_user_error("binder: %d:%d " - "BC_FREE_BUFFER u%p no match\n", - proc->pid, thread->pid, data_ptr); - break; - } - if (!buffer->allow_user_free) { - binder_user_error("binder: %d:%d " - "BC_FREE_BUFFER u%p matched " - "unreturned buffer\n", - proc->pid, thread->pid, data_ptr); - break; - } - binder_debug(BINDER_DEBUG_FREE_BUFFER, - "binder: %d:%d BC_FREE_BUFFER u%p found buffer %d for %s transaction\n", - proc->pid, thread->pid, data_ptr, buffer->debug_id, - buffer->transaction ? "active" : "finished"); - - if (buffer->transaction) { - buffer->transaction->buffer = NULL; - buffer->transaction = NULL; - } - if (buffer->async_transaction && buffer->target_node) { - BUG_ON(!buffer->target_node->has_async_transaction); - if (list_empty(&buffer->target_node->async_todo)) - buffer->target_node->has_async_transaction = 0; - else - list_move_tail(buffer->target_node->async_todo.next, &thread->todo); - } - binder_transaction_buffer_release(proc, buffer, NULL); - binder_free_buf(proc, buffer); - break; - } - - case BC_TRANSACTION: - case BC_REPLY: { - struct binder_transaction_data tr; - - if (copy_from_user(&tr, ptr, sizeof(tr))) - return -EFAULT; - ptr += sizeof(tr); - binder_transaction(proc, thread, &tr, cmd == BC_REPLY); - break; - } - - case BC_REGISTER_LOOPER: - binder_debug(BINDER_DEBUG_THREADS, - "binder: %d:%d BC_REGISTER_LOOPER\n", - proc->pid, thread->pid); - if (thread->looper & BINDER_LOOPER_STATE_ENTERED) { - thread->looper |= BINDER_LOOPER_STATE_INVALID; - binder_user_error("binder: %d:%d ERROR:" - " BC_REGISTER_LOOPER called " - "after BC_ENTER_LOOPER\n", - proc->pid, thread->pid); - } else if (proc->requested_threads == 0) { - thread->looper |= BINDER_LOOPER_STATE_INVALID; - binder_user_error("binder: %d:%d ERROR:" - " BC_REGISTER_LOOPER called " - "without request\n", - proc->pid, thread->pid); - } else { - proc->requested_threads--; - proc->requested_threads_started++; - } - thread->looper |= BINDER_LOOPER_STATE_REGISTERED; - break; - case BC_ENTER_LOOPER: - binder_debug(BINDER_DEBUG_THREADS, - "binder: %d:%d BC_ENTER_LOOPER\n", - proc->pid, thread->pid); - if (thread->looper & BINDER_LOOPER_STATE_REGISTERED) { - thread->looper |= BINDER_LOOPER_STATE_INVALID; - binder_user_error("binder: %d:%d ERROR:" - " BC_ENTER_LOOPER called after " - "BC_REGISTER_LOOPER\n", - proc->pid, thread->pid); - } - thread->looper |= BINDER_LOOPER_STATE_ENTERED; - break; - case BC_EXIT_LOOPER: - binder_debug(BINDER_DEBUG_THREADS, - "binder: %d:%d BC_EXIT_LOOPER\n", - proc->pid, thread->pid); - thread->looper |= BINDER_LOOPER_STATE_EXITED; - break; - - case BC_REQUEST_DEATH_NOTIFICATION: - case BC_CLEAR_DEATH_NOTIFICATION: { - uint32_t target; - void __user *cookie; - struct binder_ref *ref; - struct binder_ref_death *death; - - if (get_user(target, (uint32_t __user *)ptr)) - return -EFAULT; - ptr += sizeof(uint32_t); - if (get_user(cookie, (void __user * __user *)ptr)) - return -EFAULT; - ptr += sizeof(void *); - ref = binder_get_ref(proc, target); - if (ref == NULL) { - binder_user_error("binder: %d:%d %s " - "invalid ref %d\n", - proc->pid, thread->pid, - cmd == BC_REQUEST_DEATH_NOTIFICATION ? - "BC_REQUEST_DEATH_NOTIFICATION" : - "BC_CLEAR_DEATH_NOTIFICATION", - target); - break; - } - - binder_debug(BINDER_DEBUG_DEATH_NOTIFICATION, - "binder: %d:%d %s %p ref %d desc %d s %d w %d for node %d\n", - proc->pid, thread->pid, - cmd == BC_REQUEST_DEATH_NOTIFICATION ? - "BC_REQUEST_DEATH_NOTIFICATION" : - "BC_CLEAR_DEATH_NOTIFICATION", - cookie, ref->debug_id, ref->desc, - ref->strong, ref->weak, ref->node->debug_id); - - if (cmd == BC_REQUEST_DEATH_NOTIFICATION) { - if (ref->death) { - binder_user_error("binder: %d:%" - "d BC_REQUEST_DEATH_NOTI" - "FICATION death notific" - "ation already set\n", - proc->pid, thread->pid); - break; - } - death = kzalloc(sizeof(*death), GFP_KERNEL); - if (death == NULL) { - thread->return_error = BR_ERROR; - binder_debug(BINDER_DEBUG_FAILED_TRANSACTION, - "binder: %d:%d " - "BC_REQUEST_DEATH_NOTIFICATION failed\n", - proc->pid, thread->pid); - break; - } - binder_stats_created(BINDER_STAT_DEATH); - INIT_LIST_HEAD(&death->work.entry); - death->cookie = cookie; - ref->death = death; - if (ref->node->proc == NULL) { - ref->death->work.type = BINDER_WORK_DEAD_BINDER; - if (thread->looper & (BINDER_LOOPER_STATE_REGISTERED | BINDER_LOOPER_STATE_ENTERED)) { - list_add_tail(&ref->death->work.entry, &thread->todo); - } else { - list_add_tail(&ref->death->work.entry, &proc->todo); - wake_up_interruptible(&proc->wait); - } - } - } else { - if (ref->death == NULL) { - binder_user_error("binder: %d:%" - "d BC_CLEAR_DEATH_NOTIFI" - "CATION death notificat" - "ion not active\n", - proc->pid, thread->pid); - break; - } - death = ref->death; - if (death->cookie != cookie) { - binder_user_error("binder: %d:%" - "d BC_CLEAR_DEATH_NOTIFI" - "CATION death notificat" - "ion cookie mismatch " - "%p != %p\n", - proc->pid, thread->pid, - death->cookie, cookie); - break; - } - ref->death = NULL; - if (list_empty(&death->work.entry)) { - death->work.type = BINDER_WORK_CLEAR_DEATH_NOTIFICATION; - if (thread->looper & (BINDER_LOOPER_STATE_REGISTERED | BINDER_LOOPER_STATE_ENTERED)) { - list_add_tail(&death->work.entry, &thread->todo); - } else { - list_add_tail(&death->work.entry, &proc->todo); - wake_up_interruptible(&proc->wait); - } - } else { - BUG_ON(death->work.type != BINDER_WORK_DEAD_BINDER); - death->work.type = BINDER_WORK_DEAD_BINDER_AND_CLEAR; - } - } - } break; - case BC_DEAD_BINDER_DONE: { - struct binder_work *w; - void __user *cookie; - struct binder_ref_death *death = NULL; - if (get_user(cookie, (void __user * __user *)ptr)) - return -EFAULT; - - ptr += sizeof(void *); - list_for_each_entry(w, &proc->delivered_death, entry) { - struct binder_ref_death *tmp_death = container_of(w, struct binder_ref_death, work); - if (tmp_death->cookie == cookie) { - death = tmp_death; - break; - } - } - binder_debug(BINDER_DEBUG_DEAD_BINDER, - "binder: %d:%d BC_DEAD_BINDER_DONE %p found %p\n", - proc->pid, thread->pid, cookie, death); - if (death == NULL) { - binder_user_error("binder: %d:%d BC_DEAD" - "_BINDER_DONE %p not found\n", - proc->pid, thread->pid, cookie); - break; - } - - list_del_init(&death->work.entry); - if (death->work.type == BINDER_WORK_DEAD_BINDER_AND_CLEAR) { - death->work.type = BINDER_WORK_CLEAR_DEATH_NOTIFICATION; - if (thread->looper & (BINDER_LOOPER_STATE_REGISTERED | BINDER_LOOPER_STATE_ENTERED)) { - list_add_tail(&death->work.entry, &thread->todo); - } else { - list_add_tail(&death->work.entry, &proc->todo); - wake_up_interruptible(&proc->wait); - } - } - } break; - - default: - printk(KERN_ERR "binder: %d:%d unknown command %d\n", - proc->pid, thread->pid, cmd); - return -EINVAL; - } - *consumed = ptr - buffer; - } - return 0; -} - -void binder_stat_br(struct binder_proc *proc, struct binder_thread *thread, - uint32_t cmd) -{ - if (_IOC_NR(cmd) < ARRAY_SIZE(binder_stats.br)) { - binder_stats.br[_IOC_NR(cmd)]++; - proc->stats.br[_IOC_NR(cmd)]++; - thread->stats.br[_IOC_NR(cmd)]++; - } -} - -static int binder_has_proc_work(struct binder_proc *proc, - struct binder_thread *thread) -{ - return !list_empty(&proc->todo) || - (thread->looper & BINDER_LOOPER_STATE_NEED_RETURN); -} - -static int binder_has_thread_work(struct binder_thread *thread) -{ - return !list_empty(&thread->todo) || thread->return_error != BR_OK || - (thread->looper & BINDER_LOOPER_STATE_NEED_RETURN); -} - -static int binder_thread_read(struct binder_proc *proc, - struct binder_thread *thread, - void __user *buffer, int size, - signed long *consumed, int non_block) -{ - void __user *ptr = buffer + *consumed; - void __user *end = buffer + size; - - int ret = 0; - int wait_for_proc_work; - - if (*consumed == 0) { - if (put_user(BR_NOOP, (uint32_t __user *)ptr)) - return -EFAULT; - ptr += sizeof(uint32_t); - } - -retry: - wait_for_proc_work = thread->transaction_stack == NULL && - list_empty(&thread->todo); - - if (thread->return_error != BR_OK && ptr < end) { - if (thread->return_error2 != BR_OK) { - if (put_user(thread->return_error2, (uint32_t __user *)ptr)) - return -EFAULT; - ptr += sizeof(uint32_t); - if (ptr == end) - goto done; - thread->return_error2 = BR_OK; - } - if (put_user(thread->return_error, (uint32_t __user *)ptr)) - return -EFAULT; - ptr += sizeof(uint32_t); - thread->return_error = BR_OK; - goto done; - } - - - thread->looper |= BINDER_LOOPER_STATE_WAITING; - if (wait_for_proc_work) - proc->ready_threads++; - mutex_unlock(&binder_lock); - if (wait_for_proc_work) { - if (!(thread->looper & (BINDER_LOOPER_STATE_REGISTERED | - BINDER_LOOPER_STATE_ENTERED))) { - binder_user_error("binder: %d:%d ERROR: Thread waiting " - "for process work before calling BC_REGISTER_" - "LOOPER or BC_ENTER_LOOPER (state %x)\n", - proc->pid, thread->pid, thread->looper); - wait_event_interruptible(binder_user_error_wait, - binder_stop_on_user_error < 2); - } - binder_set_nice(proc->default_priority); - if (non_block) { - if (!binder_has_proc_work(proc, thread)) - ret = -EAGAIN; - } else - ret = wait_event_interruptible_exclusive(proc->wait, binder_has_proc_work(proc, thread)); - } else { - if (non_block) { - if (!binder_has_thread_work(thread)) - ret = -EAGAIN; - } else - ret = wait_event_interruptible(thread->wait, binder_has_thread_work(thread)); - } - mutex_lock(&binder_lock); - if (wait_for_proc_work) - proc->ready_threads--; - thread->looper &= ~BINDER_LOOPER_STATE_WAITING; - - if (ret) - return ret; - - while (1) { - uint32_t cmd; - struct binder_transaction_data tr; - struct binder_work *w; - struct binder_transaction *t = NULL; - - if (!list_empty(&thread->todo)) - w = list_first_entry(&thread->todo, struct binder_work, entry); - else if (!list_empty(&proc->todo) && wait_for_proc_work) - w = list_first_entry(&proc->todo, struct binder_work, entry); - else { - if (ptr - buffer == 4 && !(thread->looper & BINDER_LOOPER_STATE_NEED_RETURN)) /* no data added */ - goto retry; - break; - } - - if (end - ptr < sizeof(tr) + 4) - break; - - switch (w->type) { - case BINDER_WORK_TRANSACTION: { - t = container_of(w, struct binder_transaction, work); - } break; - case BINDER_WORK_TRANSACTION_COMPLETE: { - cmd = BR_TRANSACTION_COMPLETE; - if (put_user(cmd, (uint32_t __user *)ptr)) - return -EFAULT; - ptr += sizeof(uint32_t); - - binder_stat_br(proc, thread, cmd); - binder_debug(BINDER_DEBUG_TRANSACTION_COMPLETE, - "binder: %d:%d BR_TRANSACTION_COMPLETE\n", - proc->pid, thread->pid); - - list_del(&w->entry); - kfree(w); - binder_stats_deleted(BINDER_STAT_TRANSACTION_COMPLETE); - } break; - case BINDER_WORK_NODE: { - struct binder_node *node = container_of(w, struct binder_node, work); - uint32_t cmd = BR_NOOP; - const char *cmd_name; - int strong = node->internal_strong_refs || node->local_strong_refs; - int weak = !hlist_empty(&node->refs) || node->local_weak_refs || strong; - if (weak && !node->has_weak_ref) { - cmd = BR_INCREFS; - cmd_name = "BR_INCREFS"; - node->has_weak_ref = 1; - node->pending_weak_ref = 1; - node->local_weak_refs++; - } else if (strong && !node->has_strong_ref) { - cmd = BR_ACQUIRE; - cmd_name = "BR_ACQUIRE"; - node->has_strong_ref = 1; - node->pending_strong_ref = 1; - node->local_strong_refs++; - } else if (!strong && node->has_strong_ref) { - cmd = BR_RELEASE; - cmd_name = "BR_RELEASE"; - node->has_strong_ref = 0; - } else if (!weak && node->has_weak_ref) { - cmd = BR_DECREFS; - cmd_name = "BR_DECREFS"; - node->has_weak_ref = 0; - } - if (cmd != BR_NOOP) { - if (put_user(cmd, (uint32_t __user *)ptr)) - return -EFAULT; - ptr += sizeof(uint32_t); - if (put_user(node->ptr, (void * __user *)ptr)) - return -EFAULT; - ptr += sizeof(void *); - if (put_user(node->cookie, (void * __user *)ptr)) - return -EFAULT; - ptr += sizeof(void *); - - binder_stat_br(proc, thread, cmd); - binder_debug(BINDER_DEBUG_USER_REFS, - "binder: %d:%d %s %d u%p c%p\n", - proc->pid, thread->pid, cmd_name, node->debug_id, node->ptr, node->cookie); - } else { - list_del_init(&w->entry); - if (!weak && !strong) { - binder_debug(BINDER_DEBUG_INTERNAL_REFS, - "binder: %d:%d node %d u%p c%p deleted\n", - proc->pid, thread->pid, node->debug_id, - node->ptr, node->cookie); - rb_erase(&node->rb_node, &proc->nodes); - kfree(node); - binder_stats_deleted(BINDER_STAT_NODE); - } else { - binder_debug(BINDER_DEBUG_INTERNAL_REFS, - "binder: %d:%d node %d u%p c%p state unchanged\n", - proc->pid, thread->pid, node->debug_id, node->ptr, - node->cookie); - } - } - } break; - case BINDER_WORK_DEAD_BINDER: - case BINDER_WORK_DEAD_BINDER_AND_CLEAR: - case BINDER_WORK_CLEAR_DEATH_NOTIFICATION: { - struct binder_ref_death *death; - uint32_t cmd; - - death = container_of(w, struct binder_ref_death, work); - if (w->type == BINDER_WORK_CLEAR_DEATH_NOTIFICATION) - cmd = BR_CLEAR_DEATH_NOTIFICATION_DONE; - else - cmd = BR_DEAD_BINDER; - if (put_user(cmd, (uint32_t __user *)ptr)) - return -EFAULT; - ptr += sizeof(uint32_t); - if (put_user(death->cookie, (void * __user *)ptr)) - return -EFAULT; - ptr += sizeof(void *); - binder_debug(BINDER_DEBUG_DEATH_NOTIFICATION, - "binder: %d:%d %s %p\n", - proc->pid, thread->pid, - cmd == BR_DEAD_BINDER ? - "BR_DEAD_BINDER" : - "BR_CLEAR_DEATH_NOTIFICATION_DONE", - death->cookie); - - if (w->type == BINDER_WORK_CLEAR_DEATH_NOTIFICATION) { - list_del(&w->entry); - kfree(death); - binder_stats_deleted(BINDER_STAT_DEATH); - } else - list_move(&w->entry, &proc->delivered_death); - if (cmd == BR_DEAD_BINDER) - goto done; /* DEAD_BINDER notifications can cause transactions */ - } break; - } - - if (!t) - continue; - - BUG_ON(t->buffer == NULL); - if (t->buffer->target_node) { - struct binder_node *target_node = t->buffer->target_node; - tr.target.ptr = target_node->ptr; - tr.cookie = target_node->cookie; - t->saved_priority = task_nice(current); - if (t->priority < target_node->min_priority && - !(t->flags & TF_ONE_WAY)) - binder_set_nice(t->priority); - else if (!(t->flags & TF_ONE_WAY) || - t->saved_priority > target_node->min_priority) - binder_set_nice(target_node->min_priority); - cmd = BR_TRANSACTION; - } else { - tr.target.ptr = NULL; - tr.cookie = NULL; - cmd = BR_REPLY; - } - tr.code = t->code; - tr.flags = t->flags; - tr.sender_euid = t->sender_euid; - - if (t->from) { - struct task_struct *sender = t->from->proc->tsk; - tr.sender_pid = task_tgid_nr_ns(sender, - current->nsproxy->pid_ns); - } else { - tr.sender_pid = 0; - } - - tr.data_size = t->buffer->data_size; - tr.offsets_size = t->buffer->offsets_size; - tr.data.ptr.buffer = (void *)t->buffer->data + - proc->user_buffer_offset; - tr.data.ptr.offsets = tr.data.ptr.buffer + - ALIGN(t->buffer->data_size, - sizeof(void *)); - - if (put_user(cmd, (uint32_t __user *)ptr)) - return -EFAULT; - ptr += sizeof(uint32_t); - if (copy_to_user(ptr, &tr, sizeof(tr))) - return -EFAULT; - ptr += sizeof(tr); - - binder_stat_br(proc, thread, cmd); - binder_debug(BINDER_DEBUG_TRANSACTION, - "binder: %d:%d %s %d %d:%d, cmd %d" - "size %zd-%zd ptr %p-%p\n", - proc->pid, thread->pid, - (cmd == BR_TRANSACTION) ? "BR_TRANSACTION" : - "BR_REPLY", - t->debug_id, t->from ? t->from->proc->pid : 0, - t->from ? t->from->pid : 0, cmd, - t->buffer->data_size, t->buffer->offsets_size, - tr.data.ptr.buffer, tr.data.ptr.offsets); - - list_del(&t->work.entry); - t->buffer->allow_user_free = 1; - if (cmd == BR_TRANSACTION && !(t->flags & TF_ONE_WAY)) { - t->to_parent = thread->transaction_stack; - t->to_thread = thread; - thread->transaction_stack = t; - } else { - t->buffer->transaction = NULL; - kfree(t); - binder_stats_deleted(BINDER_STAT_TRANSACTION); - } - break; - } - -done: - - *consumed = ptr - buffer; - if (proc->requested_threads + proc->ready_threads == 0 && - proc->requested_threads_started < proc->max_threads && - (thread->looper & (BINDER_LOOPER_STATE_REGISTERED | - BINDER_LOOPER_STATE_ENTERED)) /* the user-space code fails to */ - /*spawn a new thread if we leave this out */) { - proc->requested_threads++; - binder_debug(BINDER_DEBUG_THREADS, - "binder: %d:%d BR_SPAWN_LOOPER\n", - proc->pid, thread->pid); - if (put_user(BR_SPAWN_LOOPER, (uint32_t __user *)buffer)) - return -EFAULT; - } - return 0; -} - -static void binder_release_work(struct list_head *list) -{ - struct binder_work *w; - while (!list_empty(list)) { - w = list_first_entry(list, struct binder_work, entry); - list_del_init(&w->entry); - switch (w->type) { - case BINDER_WORK_TRANSACTION: { - struct binder_transaction *t; - - t = container_of(w, struct binder_transaction, work); - if (t->buffer->target_node && !(t->flags & TF_ONE_WAY)) - binder_send_failed_reply(t, BR_DEAD_REPLY); - } break; - case BINDER_WORK_TRANSACTION_COMPLETE: { - kfree(w); - binder_stats_deleted(BINDER_STAT_TRANSACTION_COMPLETE); - } break; - default: - break; - } - } - -} - -static struct binder_thread *binder_get_thread(struct binder_proc *proc) -{ - struct binder_thread *thread = NULL; - struct rb_node *parent = NULL; - struct rb_node **p = &proc->threads.rb_node; - - while (*p) { - parent = *p; - thread = rb_entry(parent, struct binder_thread, rb_node); - - if (current->pid < thread->pid) - p = &(*p)->rb_left; - else if (current->pid > thread->pid) - p = &(*p)->rb_right; - else - break; - } - if (*p == NULL) { - thread = kzalloc(sizeof(*thread), GFP_KERNEL); - if (thread == NULL) - return NULL; - binder_stats_created(BINDER_STAT_THREAD); - thread->proc = proc; - thread->pid = current->pid; - init_waitqueue_head(&thread->wait); - INIT_LIST_HEAD(&thread->todo); - rb_link_node(&thread->rb_node, parent, p); - rb_insert_color(&thread->rb_node, &proc->threads); - thread->looper |= BINDER_LOOPER_STATE_NEED_RETURN; - thread->return_error = BR_OK; - thread->return_error2 = BR_OK; - } - return thread; -} - -static int binder_free_thread(struct binder_proc *proc, - struct binder_thread *thread) -{ - struct binder_transaction *t; - struct binder_transaction *send_reply = NULL; - int active_transactions = 0; - - rb_erase(&thread->rb_node, &proc->threads); - t = thread->transaction_stack; - if (t && t->to_thread == thread) - send_reply = t; - while (t) { - active_transactions++; - binder_debug(BINDER_DEBUG_DEAD_TRANSACTION, - "binder: release %d:%d transaction %d " - "%s, still active\n", proc->pid, thread->pid, - t->debug_id, - (t->to_thread == thread) ? "in" : "out"); - - if (t->to_thread == thread) { - t->to_proc = NULL; - t->to_thread = NULL; - if (t->buffer) { - t->buffer->transaction = NULL; - t->buffer = NULL; - } - t = t->to_parent; - } else if (t->from == thread) { - t->from = NULL; - t = t->from_parent; - } else - BUG(); - } - if (send_reply) - binder_send_failed_reply(send_reply, BR_DEAD_REPLY); - binder_release_work(&thread->todo); - kfree(thread); - binder_stats_deleted(BINDER_STAT_THREAD); - return active_transactions; -} - -static unsigned int binder_poll(struct file *filp, - struct poll_table_struct *wait) -{ - struct binder_proc *proc = filp->private_data; - struct binder_thread *thread = NULL; - int wait_for_proc_work; - - mutex_lock(&binder_lock); - thread = binder_get_thread(proc); - - wait_for_proc_work = thread->transaction_stack == NULL && - list_empty(&thread->todo) && thread->return_error == BR_OK; - mutex_unlock(&binder_lock); - - if (wait_for_proc_work) { - if (binder_has_proc_work(proc, thread)) - return POLLIN; - poll_wait(filp, &proc->wait, wait); - if (binder_has_proc_work(proc, thread)) - return POLLIN; - } else { - if (binder_has_thread_work(thread)) - return POLLIN; - poll_wait(filp, &thread->wait, wait); - if (binder_has_thread_work(thread)) - return POLLIN; - } - return 0; -} - -static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) -{ - int ret; - struct binder_proc *proc = filp->private_data; - struct binder_thread *thread; - unsigned int size = _IOC_SIZE(cmd); - void __user *ubuf = (void __user *)arg; - - /*printk(KERN_INFO "binder_ioctl: %d:%d %x %lx\n", proc->pid, current->pid, cmd, arg);*/ - - ret = wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2); - if (ret) - return ret; - - mutex_lock(&binder_lock); - thread = binder_get_thread(proc); - if (thread == NULL) { - ret = -ENOMEM; - goto err; - } - - switch (cmd) { - case BINDER_WRITE_READ: { - struct binder_write_read bwr; - if (size != sizeof(struct binder_write_read)) { - ret = -EINVAL; - goto err; - } - if (copy_from_user(&bwr, ubuf, sizeof(bwr))) { - ret = -EFAULT; - goto err; - } - binder_debug(BINDER_DEBUG_READ_WRITE, - "binder: %d:%d write %ld at %08lx, read %ld at %08lx\n", - proc->pid, thread->pid, bwr.write_size, bwr.write_buffer, - bwr.read_size, bwr.read_buffer); - - if (bwr.write_size > 0) { - ret = binder_thread_write(proc, thread, (void __user *)bwr.write_buffer, bwr.write_size, &bwr.write_consumed); - if (ret < 0) { - bwr.read_consumed = 0; - if (copy_to_user(ubuf, &bwr, sizeof(bwr))) - ret = -EFAULT; - goto err; - } - } - if (bwr.read_size > 0) { - ret = binder_thread_read(proc, thread, (void __user *)bwr.read_buffer, bwr.read_size, &bwr.read_consumed, filp->f_flags & O_NONBLOCK); - if (!list_empty(&proc->todo)) - wake_up_interruptible(&proc->wait); - if (ret < 0) { - if (copy_to_user(ubuf, &bwr, sizeof(bwr))) - ret = -EFAULT; - goto err; - } - } - binder_debug(BINDER_DEBUG_READ_WRITE, - "binder: %d:%d wrote %ld of %ld, read return %ld of %ld\n", - proc->pid, thread->pid, bwr.write_consumed, bwr.write_size, - bwr.read_consumed, bwr.read_size); - if (copy_to_user(ubuf, &bwr, sizeof(bwr))) { - ret = -EFAULT; - goto err; - } - break; - } - case BINDER_SET_MAX_THREADS: - if (copy_from_user(&proc->max_threads, ubuf, sizeof(proc->max_threads))) { - ret = -EINVAL; - goto err; - } - break; - case BINDER_SET_CONTEXT_MGR: - if (binder_context_mgr_node != NULL) { - printk(KERN_ERR "binder: BINDER_SET_CONTEXT_MGR already set\n"); - ret = -EBUSY; - goto err; - } - if (binder_context_mgr_uid != -1) { - if (binder_context_mgr_uid != current->cred->euid) { - printk(KERN_ERR "binder: BINDER_SET_" - "CONTEXT_MGR bad uid %d != %d\n", - current->cred->euid, - binder_context_mgr_uid); - ret = -EPERM; - goto err; - } - } else - binder_context_mgr_uid = current->cred->euid; - binder_context_mgr_node = binder_new_node(proc, NULL, NULL); - if (binder_context_mgr_node == NULL) { - ret = -ENOMEM; - goto err; - } - binder_context_mgr_node->local_weak_refs++; - binder_context_mgr_node->local_strong_refs++; - binder_context_mgr_node->has_strong_ref = 1; - binder_context_mgr_node->has_weak_ref = 1; - break; - case BINDER_THREAD_EXIT: - binder_debug(BINDER_DEBUG_THREADS, "binder: %d:%d exit\n", - proc->pid, thread->pid); - binder_free_thread(proc, thread); - thread = NULL; - break; - case BINDER_VERSION: - if (size != sizeof(struct binder_version)) { - ret = -EINVAL; - goto err; - } - if (put_user(BINDER_CURRENT_PROTOCOL_VERSION, &((struct binder_version *)ubuf)->protocol_version)) { - ret = -EINVAL; - goto err; - } - break; - default: - ret = -EINVAL; - goto err; - } - ret = 0; -err: - if (thread) - thread->looper &= ~BINDER_LOOPER_STATE_NEED_RETURN; - mutex_unlock(&binder_lock); - wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2); - if (ret && ret != -ERESTARTSYS) - printk(KERN_INFO "binder: %d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); - return ret; -} - -static void binder_vma_open(struct vm_area_struct *vma) -{ - struct binder_proc *proc = vma->vm_private_data; - binder_debug(BINDER_DEBUG_OPEN_CLOSE, - "binder: %d open vm area %lx-%lx (%ld K) vma %lx pagep %lx\n", - proc->pid, vma->vm_start, vma->vm_end, - (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags, - (unsigned long)pgprot_val(vma->vm_page_prot)); - dump_stack(); -} - -static void binder_vma_close(struct vm_area_struct *vma) -{ - struct binder_proc *proc = vma->vm_private_data; - binder_debug(BINDER_DEBUG_OPEN_CLOSE, - "binder: %d close vm area %lx-%lx (%ld K) vma %lx pagep %lx\n", - proc->pid, vma->vm_start, vma->vm_end, - (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags, - (unsigned long)pgprot_val(vma->vm_page_prot)); - proc->vma = NULL; - binder_defer_work(proc, BINDER_DEFERRED_PUT_FILES); -} - -static struct vm_operations_struct binder_vm_ops = { - .open = binder_vma_open, - .close = binder_vma_close, -}; - -static int binder_mmap(struct file *filp, struct vm_area_struct *vma) -{ - int ret; - struct vm_struct *area; - struct binder_proc *proc = filp->private_data; - const char *failure_string; - struct binder_buffer *buffer; - - if ((vma->vm_end - vma->vm_start) > SZ_4M) - vma->vm_end = vma->vm_start + SZ_4M; - - binder_debug(BINDER_DEBUG_OPEN_CLOSE, - "binder_mmap: %d %lx-%lx (%ld K) vma %lx pagep %lx\n", - proc->pid, vma->vm_start, vma->vm_end, - (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags, - (unsigned long)pgprot_val(vma->vm_page_prot)); - - if (vma->vm_flags & FORBIDDEN_MMAP_FLAGS) { - ret = -EPERM; - failure_string = "bad vm_flags"; - goto err_bad_arg; - } - vma->vm_flags = (vma->vm_flags | VM_DONTCOPY) & ~VM_MAYWRITE; - - if (proc->buffer) { - ret = -EBUSY; - failure_string = "already mapped"; - goto err_already_mapped; - } - - area = get_vm_area(vma->vm_end - vma->vm_start, VM_IOREMAP); - if (area == NULL) { - ret = -ENOMEM; - failure_string = "get_vm_area"; - goto err_get_vm_area_failed; - } - proc->buffer = area->addr; - proc->user_buffer_offset = vma->vm_start - (uintptr_t)proc->buffer; - -#ifdef CONFIG_CPU_CACHE_VIPT - if (cache_is_vipt_aliasing()) { - while (CACHE_COLOUR((vma->vm_start ^ (uint32_t)proc->buffer))) { - printk(KERN_INFO "binder_mmap: %d %lx-%lx maps %p bad alignment\n", proc->pid, vma->vm_start, vma->vm_end, proc->buffer); - vma->vm_start += PAGE_SIZE; - } - } -#endif - proc->pages = kzalloc(sizeof(proc->pages[0]) * ((vma->vm_end - vma->vm_start) / PAGE_SIZE), GFP_KERNEL); - if (proc->pages == NULL) { - ret = -ENOMEM; - failure_string = "alloc page array"; - goto err_alloc_pages_failed; - } - proc->buffer_size = vma->vm_end - vma->vm_start; - - vma->vm_ops = &binder_vm_ops; - vma->vm_private_data = proc; - - if (binder_update_page_range(proc, 1, proc->buffer, proc->buffer + PAGE_SIZE, vma)) { - ret = -ENOMEM; - failure_string = "alloc small buf"; - goto err_alloc_small_buf_failed; - } - buffer = proc->buffer; - INIT_LIST_HEAD(&proc->buffers); - list_add(&buffer->entry, &proc->buffers); - buffer->free = 1; - binder_insert_free_buffer(proc, buffer); - proc->free_async_space = proc->buffer_size / 2; - barrier(); - proc->files = get_files_struct(current); - proc->vma = vma; - - /*printk(KERN_INFO "binder_mmap: %d %lx-%lx maps %p\n", - proc->pid, vma->vm_start, vma->vm_end, proc->buffer);*/ - return 0; - -err_alloc_small_buf_failed: - kfree(proc->pages); - proc->pages = NULL; -err_alloc_pages_failed: - vfree(proc->buffer); - proc->buffer = NULL; -err_get_vm_area_failed: -err_already_mapped: -err_bad_arg: - printk(KERN_ERR "binder_mmap: %d %lx-%lx %s failed %d\n", - proc->pid, vma->vm_start, vma->vm_end, failure_string, ret); - return ret; -} - -static int binder_open(struct inode *nodp, struct file *filp) -{ - struct binder_proc *proc; - - binder_debug(BINDER_DEBUG_OPEN_CLOSE, "binder_open: %d:%d\n", - current->group_leader->pid, current->pid); - - proc = kzalloc(sizeof(*proc), GFP_KERNEL); - if (proc == NULL) - return -ENOMEM; - get_task_struct(current); - proc->tsk = current; - INIT_LIST_HEAD(&proc->todo); - init_waitqueue_head(&proc->wait); - proc->default_priority = task_nice(current); - mutex_lock(&binder_lock); - binder_stats_created(BINDER_STAT_PROC); - hlist_add_head(&proc->proc_node, &binder_procs); - proc->pid = current->group_leader->pid; - INIT_LIST_HEAD(&proc->delivered_death); - filp->private_data = proc; - mutex_unlock(&binder_lock); - - if (binder_proc_dir_entry_proc) { - char strbuf[11]; - snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); - remove_proc_entry(strbuf, binder_proc_dir_entry_proc); - create_proc_read_entry(strbuf, S_IRUGO, - binder_proc_dir_entry_proc, - binder_read_proc_proc, proc); - } - - return 0; -} - -static int binder_flush(struct file *filp, fl_owner_t id) -{ - struct binder_proc *proc = filp->private_data; - - binder_defer_work(proc, BINDER_DEFERRED_FLUSH); - - return 0; -} - -static void binder_deferred_flush(struct binder_proc *proc) -{ - struct rb_node *n; - int wake_count = 0; - for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { - struct binder_thread *thread = rb_entry(n, struct binder_thread, rb_node); - thread->looper |= BINDER_LOOPER_STATE_NEED_RETURN; - if (thread->looper & BINDER_LOOPER_STATE_WAITING) { - wake_up_interruptible(&thread->wait); - wake_count++; - } - } - wake_up_interruptible_all(&proc->wait); - - binder_debug(BINDER_DEBUG_OPEN_CLOSE, - "binder_flush: %d woke %d threads\n", proc->pid, - wake_count); -} - -static int binder_release(struct inode *nodp, struct file *filp) -{ - struct binder_proc *proc = filp->private_data; - if (binder_proc_dir_entry_proc) { - char strbuf[11]; - snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); - remove_proc_entry(strbuf, binder_proc_dir_entry_proc); - } - - binder_defer_work(proc, BINDER_DEFERRED_RELEASE); - - return 0; -} - -static void binder_deferred_release(struct binder_proc *proc) -{ - struct hlist_node *pos; - struct binder_transaction *t; - struct rb_node *n; - int threads, nodes, incoming_refs, outgoing_refs, buffers, active_transactions, page_count; - - BUG_ON(proc->vma); - BUG_ON(proc->files); - - hlist_del(&proc->proc_node); - if (binder_context_mgr_node && binder_context_mgr_node->proc == proc) { - binder_debug(BINDER_DEBUG_DEAD_BINDER, - "binder_release: %d context_mgr_node gone\n", - proc->pid); - binder_context_mgr_node = NULL; - } - - threads = 0; - active_transactions = 0; - while ((n = rb_first(&proc->threads))) { - struct binder_thread *thread = rb_entry(n, struct binder_thread, rb_node); - threads++; - active_transactions += binder_free_thread(proc, thread); - } - nodes = 0; - incoming_refs = 0; - while ((n = rb_first(&proc->nodes))) { - struct binder_node *node = rb_entry(n, struct binder_node, rb_node); - - nodes++; - rb_erase(&node->rb_node, &proc->nodes); - list_del_init(&node->work.entry); - if (hlist_empty(&node->refs)) { - kfree(node); - binder_stats_deleted(BINDER_STAT_NODE); - } else { - struct binder_ref *ref; - int death = 0; - - node->proc = NULL; - node->local_strong_refs = 0; - node->local_weak_refs = 0; - hlist_add_head(&node->dead_node, &binder_dead_nodes); - - hlist_for_each_entry(ref, pos, &node->refs, node_entry) { - incoming_refs++; - if (ref->death) { - death++; - if (list_empty(&ref->death->work.entry)) { - ref->death->work.type = BINDER_WORK_DEAD_BINDER; - list_add_tail(&ref->death->work.entry, &ref->proc->todo); - wake_up_interruptible(&ref->proc->wait); - } else - BUG(); - } - } - binder_debug(BINDER_DEBUG_DEAD_BINDER, - "binder: node %d now dead, " - "refs %d, death %d\n", node->debug_id, - incoming_refs, death); - } - } - outgoing_refs = 0; - while ((n = rb_first(&proc->refs_by_desc))) { - struct binder_ref *ref = rb_entry(n, struct binder_ref, - rb_node_desc); - outgoing_refs++; - binder_delete_ref(ref); - } - binder_release_work(&proc->todo); - buffers = 0; - - while ((n = rb_first(&proc->allocated_buffers))) { - struct binder_buffer *buffer = rb_entry(n, struct binder_buffer, - rb_node); - t = buffer->transaction; - if (t) { - t->buffer = NULL; - buffer->transaction = NULL; - printk(KERN_ERR "binder: release proc %d, " - "transaction %d, not freed\n", - proc->pid, t->debug_id); - /*BUG();*/ - } - binder_free_buf(proc, buffer); - buffers++; - } - - binder_stats_deleted(BINDER_STAT_PROC); - - page_count = 0; - if (proc->pages) { - int i; - for (i = 0; i < proc->buffer_size / PAGE_SIZE; i++) { - if (proc->pages[i]) { - binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "binder_release: %d: " - "page %d at %p not freed\n", - proc->pid, i, - proc->buffer + i * PAGE_SIZE); - __free_page(proc->pages[i]); - page_count++; - } - } - kfree(proc->pages); - vfree(proc->buffer); - } - - put_task_struct(proc->tsk); - - binder_debug(BINDER_DEBUG_OPEN_CLOSE, - "binder_release: %d threads %d, nodes %d (ref %d), " - "refs %d, active transactions %d, buffers %d, " - "pages %d\n", - proc->pid, threads, nodes, incoming_refs, outgoing_refs, - active_transactions, buffers, page_count); - - kfree(proc); -} - -static void binder_deferred_func(struct work_struct *work) -{ - struct binder_proc *proc; - struct files_struct *files; - - int defer; - do { - mutex_lock(&binder_lock); - mutex_lock(&binder_deferred_lock); - if (!hlist_empty(&binder_deferred_list)) { - proc = hlist_entry(binder_deferred_list.first, - struct binder_proc, deferred_work_node); - hlist_del_init(&proc->deferred_work_node); - defer = proc->deferred_work; - proc->deferred_work = 0; - } else { - proc = NULL; - defer = 0; - } - mutex_unlock(&binder_deferred_lock); - - files = NULL; - if (defer & BINDER_DEFERRED_PUT_FILES) { - files = proc->files; - if (files) - proc->files = NULL; - } - - if (defer & BINDER_DEFERRED_FLUSH) - binder_deferred_flush(proc); - - if (defer & BINDER_DEFERRED_RELEASE) - binder_deferred_release(proc); /* frees proc */ - - mutex_unlock(&binder_lock); - if (files) - put_files_struct(files); - } while (proc); -} -static DECLARE_WORK(binder_deferred_work, binder_deferred_func); - -static void -binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer) -{ - mutex_lock(&binder_deferred_lock); - proc->deferred_work |= defer; - if (hlist_unhashed(&proc->deferred_work_node)) { - hlist_add_head(&proc->deferred_work_node, - &binder_deferred_list); - schedule_work(&binder_deferred_work); - } - mutex_unlock(&binder_deferred_lock); -} - -static char *print_binder_transaction(char *buf, char *end, const char *prefix, - struct binder_transaction *t) -{ - buf += snprintf(buf, end - buf, - "%s %d: %p from %d:%d to %d:%d code %x " - "flags %x pri %ld r%d", - prefix, t->debug_id, t, - t->from ? t->from->proc->pid : 0, - t->from ? t->from->pid : 0, - t->to_proc ? t->to_proc->pid : 0, - t->to_thread ? t->to_thread->pid : 0, - t->code, t->flags, t->priority, t->need_reply); - if (buf >= end) - return buf; - if (t->buffer == NULL) { - buf += snprintf(buf, end - buf, " buffer free\n"); - return buf; - } - if (t->buffer->target_node) { - buf += snprintf(buf, end - buf, " node %d", - t->buffer->target_node->debug_id); - if (buf >= end) - return buf; - } - buf += snprintf(buf, end - buf, " size %zd:%zd data %p\n", - t->buffer->data_size, t->buffer->offsets_size, - t->buffer->data); - return buf; -} - -static char *print_binder_buffer(char *buf, char *end, const char *prefix, - struct binder_buffer *buffer) -{ - buf += snprintf(buf, end - buf, "%s %d: %p size %zd:%zd %s\n", - prefix, buffer->debug_id, buffer->data, - buffer->data_size, buffer->offsets_size, - buffer->transaction ? "active" : "delivered"); - return buf; -} - -static char *print_binder_work(char *buf, char *end, const char *prefix, - const char *transaction_prefix, - struct binder_work *w) -{ - struct binder_node *node; - struct binder_transaction *t; - - switch (w->type) { - case BINDER_WORK_TRANSACTION: - t = container_of(w, struct binder_transaction, work); - buf = print_binder_transaction(buf, end, transaction_prefix, t); - break; - case BINDER_WORK_TRANSACTION_COMPLETE: - buf += snprintf(buf, end - buf, - "%stransaction complete\n", prefix); - break; - case BINDER_WORK_NODE: - node = container_of(w, struct binder_node, work); - buf += snprintf(buf, end - buf, "%snode work %d: u%p c%p\n", - prefix, node->debug_id, node->ptr, - node->cookie); - break; - case BINDER_WORK_DEAD_BINDER: - buf += snprintf(buf, end - buf, "%shas dead binder\n", prefix); - break; - case BINDER_WORK_DEAD_BINDER_AND_CLEAR: - buf += snprintf(buf, end - buf, - "%shas cleared dead binder\n", prefix); - break; - case BINDER_WORK_CLEAR_DEATH_NOTIFICATION: - buf += snprintf(buf, end - buf, - "%shas cleared death notification\n", prefix); - break; - default: - buf += snprintf(buf, end - buf, "%sunknown work: type %d\n", - prefix, w->type); - break; - } - return buf; -} - -static char *print_binder_thread(char *buf, char *end, - struct binder_thread *thread, - int print_always) -{ - struct binder_transaction *t; - struct binder_work *w; - char *start_buf = buf; - char *header_buf; - - buf += snprintf(buf, end - buf, " thread %d: l %02x\n", - thread->pid, thread->looper); - header_buf = buf; - t = thread->transaction_stack; - while (t) { - if (buf >= end) - break; - if (t->from == thread) { - buf = print_binder_transaction(buf, end, - " outgoing transaction", t); - t = t->from_parent; - } else if (t->to_thread == thread) { - buf = print_binder_transaction(buf, end, - " incoming transaction", t); - t = t->to_parent; - } else { - buf = print_binder_transaction(buf, end, - " bad transaction", t); - t = NULL; - } - } - list_for_each_entry(w, &thread->todo, entry) { - if (buf >= end) - break; - buf = print_binder_work(buf, end, " ", - " pending transaction", w); - } - if (!print_always && buf == header_buf) - buf = start_buf; - return buf; -} - -static char *print_binder_node(char *buf, char *end, struct binder_node *node) -{ - struct binder_ref *ref; - struct hlist_node *pos; - struct binder_work *w; - int count; - - count = 0; - hlist_for_each_entry(ref, pos, &node->refs, node_entry) - count++; - - buf += snprintf(buf, end - buf, - " node %d: u%p c%p hs %d hw %d ls %d lw %d " - "is %d iw %d", - node->debug_id, node->ptr, node->cookie, - node->has_strong_ref, node->has_weak_ref, - node->local_strong_refs, node->local_weak_refs, - node->internal_strong_refs, count); - if (buf >= end) - return buf; - if (count) { - buf += snprintf(buf, end - buf, " proc"); - if (buf >= end) - return buf; - hlist_for_each_entry(ref, pos, &node->refs, node_entry) { - buf += snprintf(buf, end - buf, " %d", ref->proc->pid); - if (buf >= end) - return buf; - } - } - buf += snprintf(buf, end - buf, "\n"); - list_for_each_entry(w, &node->async_todo, entry) { - if (buf >= end) - break; - buf = print_binder_work(buf, end, " ", - " pending async transaction", w); - } - return buf; -} - -static char *print_binder_ref(char *buf, char *end, struct binder_ref *ref) -{ - buf += snprintf(buf, end - buf, - " ref %d: desc %d %snode %d s %d w %d d %p\n", - ref->debug_id, ref->desc, - ref->node->proc ? "" : "dead ", ref->node->debug_id, - ref->strong, ref->weak, ref->death); - return buf; -} - -static char *print_binder_proc(char *buf, char *end, - struct binder_proc *proc, int print_all) -{ - struct binder_work *w; - struct rb_node *n; - char *start_buf = buf; - char *header_buf; - - buf += snprintf(buf, end - buf, "proc %d\n", proc->pid); - header_buf = buf; - - for (n = rb_first(&proc->threads); - n != NULL && buf < end; - n = rb_next(n)) - buf = print_binder_thread(buf, end, - rb_entry(n, struct binder_thread, - rb_node), print_all); - for (n = rb_first(&proc->nodes); - n != NULL && buf < end; - n = rb_next(n)) { - struct binder_node *node = rb_entry(n, struct binder_node, - rb_node); - if (print_all || node->has_async_transaction) - buf = print_binder_node(buf, end, node); - } - if (print_all) { - for (n = rb_first(&proc->refs_by_desc); - n != NULL && buf < end; - n = rb_next(n)) - buf = print_binder_ref(buf, end, - rb_entry(n, struct binder_ref, - rb_node_desc)); - } - for (n = rb_first(&proc->allocated_buffers); - n != NULL && buf < end; - n = rb_next(n)) - buf = print_binder_buffer(buf, end, " buffer", - rb_entry(n, struct binder_buffer, - rb_node)); - list_for_each_entry(w, &proc->todo, entry) { - if (buf >= end) - break; - buf = print_binder_work(buf, end, " ", - " pending transaction", w); - } - list_for_each_entry(w, &proc->delivered_death, entry) { - if (buf >= end) - break; - buf += snprintf(buf, end - buf, - " has delivered dead binder\n"); - break; - } - if (!print_all && buf == header_buf) - buf = start_buf; - return buf; -} - -static const char *binder_return_strings[] = { - "BR_ERROR", - "BR_OK", - "BR_TRANSACTION", - "BR_REPLY", - "BR_ACQUIRE_RESULT", - "BR_DEAD_REPLY", - "BR_TRANSACTION_COMPLETE", - "BR_INCREFS", - "BR_ACQUIRE", - "BR_RELEASE", - "BR_DECREFS", - "BR_ATTEMPT_ACQUIRE", - "BR_NOOP", - "BR_SPAWN_LOOPER", - "BR_FINISHED", - "BR_DEAD_BINDER", - "BR_CLEAR_DEATH_NOTIFICATION_DONE", - "BR_FAILED_REPLY" -}; - -static const char *binder_command_strings[] = { - "BC_TRANSACTION", - "BC_REPLY", - "BC_ACQUIRE_RESULT", - "BC_FREE_BUFFER", - "BC_INCREFS", - "BC_ACQUIRE", - "BC_RELEASE", - "BC_DECREFS", - "BC_INCREFS_DONE", - "BC_ACQUIRE_DONE", - "BC_ATTEMPT_ACQUIRE", - "BC_REGISTER_LOOPER", - "BC_ENTER_LOOPER", - "BC_EXIT_LOOPER", - "BC_REQUEST_DEATH_NOTIFICATION", - "BC_CLEAR_DEATH_NOTIFICATION", - "BC_DEAD_BINDER_DONE" -}; - -static const char *binder_objstat_strings[] = { - "proc", - "thread", - "node", - "ref", - "death", - "transaction", - "transaction_complete" -}; - -static char *print_binder_stats(char *buf, char *end, const char *prefix, - struct binder_stats *stats) -{ - int i; - - BUILD_BUG_ON(ARRAY_SIZE(stats->bc) != - ARRAY_SIZE(binder_command_strings)); - for (i = 0; i < ARRAY_SIZE(stats->bc); i++) { - if (stats->bc[i]) - buf += snprintf(buf, end - buf, "%s%s: %d\n", prefix, - binder_command_strings[i], - stats->bc[i]); - if (buf >= end) - return buf; - } - - BUILD_BUG_ON(ARRAY_SIZE(stats->br) != - ARRAY_SIZE(binder_return_strings)); - for (i = 0; i < ARRAY_SIZE(stats->br); i++) { - if (stats->br[i]) - buf += snprintf(buf, end - buf, "%s%s: %d\n", prefix, - binder_return_strings[i], stats->br[i]); - if (buf >= end) - return buf; - } - - BUILD_BUG_ON(ARRAY_SIZE(stats->obj_created) != - ARRAY_SIZE(binder_objstat_strings)); - BUILD_BUG_ON(ARRAY_SIZE(stats->obj_created) != - ARRAY_SIZE(stats->obj_deleted)); - for (i = 0; i < ARRAY_SIZE(stats->obj_created); i++) { - if (stats->obj_created[i] || stats->obj_deleted[i]) - buf += snprintf(buf, end - buf, - "%s%s: active %d total %d\n", prefix, - binder_objstat_strings[i], - stats->obj_created[i] - - stats->obj_deleted[i], - stats->obj_created[i]); - if (buf >= end) - return buf; - } - return buf; -} - -static char *print_binder_proc_stats(char *buf, char *end, - struct binder_proc *proc) -{ - struct binder_work *w; - struct rb_node *n; - int count, strong, weak; - - buf += snprintf(buf, end - buf, "proc %d\n", proc->pid); - if (buf >= end) - return buf; - count = 0; - for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) - count++; - buf += snprintf(buf, end - buf, " threads: %d\n", count); - if (buf >= end) - return buf; - buf += snprintf(buf, end - buf, " requested threads: %d+%d/%d\n" - " ready threads %d\n" - " free async space %zd\n", proc->requested_threads, - proc->requested_threads_started, proc->max_threads, - proc->ready_threads, proc->free_async_space); - if (buf >= end) - return buf; - count = 0; - for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) - count++; - buf += snprintf(buf, end - buf, " nodes: %d\n", count); - if (buf >= end) - return buf; - count = 0; - strong = 0; - weak = 0; - for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) { - struct binder_ref *ref = rb_entry(n, struct binder_ref, - rb_node_desc); - count++; - strong += ref->strong; - weak += ref->weak; - } - buf += snprintf(buf, end - buf, " refs: %d s %d w %d\n", - count, strong, weak); - if (buf >= end) - return buf; - - count = 0; - for (n = rb_first(&proc->allocated_buffers); n != NULL; n = rb_next(n)) - count++; - buf += snprintf(buf, end - buf, " buffers: %d\n", count); - if (buf >= end) - return buf; - - count = 0; - list_for_each_entry(w, &proc->todo, entry) { - switch (w->type) { - case BINDER_WORK_TRANSACTION: - count++; - break; - default: - break; - } - } - buf += snprintf(buf, end - buf, " pending transactions: %d\n", count); - if (buf >= end) - return buf; - - buf = print_binder_stats(buf, end, " ", &proc->stats); - - return buf; -} - - -static int binder_read_proc_state(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct binder_proc *proc; - struct hlist_node *pos; - struct binder_node *node; - int len = 0; - char *buf = page; - char *end = page + PAGE_SIZE; - int do_lock = !binder_debug_no_lock; - - if (off) - return 0; - - if (do_lock) - mutex_lock(&binder_lock); - - buf += snprintf(buf, end - buf, "binder state:\n"); - - if (!hlist_empty(&binder_dead_nodes)) - buf += snprintf(buf, end - buf, "dead nodes:\n"); - hlist_for_each_entry(node, pos, &binder_dead_nodes, dead_node) { - if (buf >= end) - break; - buf = print_binder_node(buf, end, node); - } - - hlist_for_each_entry(proc, pos, &binder_procs, proc_node) { - if (buf >= end) - break; - buf = print_binder_proc(buf, end, proc, 1); - } - if (do_lock) - mutex_unlock(&binder_lock); - if (buf > page + PAGE_SIZE) - buf = page + PAGE_SIZE; - - *start = page + off; - - len = buf - page; - if (len > off) - len -= off; - else - len = 0; - - return len < count ? len : count; -} - -static int binder_read_proc_stats(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct binder_proc *proc; - struct hlist_node *pos; - int len = 0; - char *p = page; - int do_lock = !binder_debug_no_lock; - - if (off) - return 0; - - if (do_lock) - mutex_lock(&binder_lock); - - p += snprintf(p, PAGE_SIZE, "binder stats:\n"); - - p = print_binder_stats(p, page + PAGE_SIZE, "", &binder_stats); - - hlist_for_each_entry(proc, pos, &binder_procs, proc_node) { - if (p >= page + PAGE_SIZE) - break; - p = print_binder_proc_stats(p, page + PAGE_SIZE, proc); - } - if (do_lock) - mutex_unlock(&binder_lock); - if (p > page + PAGE_SIZE) - p = page + PAGE_SIZE; - - *start = page + off; - - len = p - page; - if (len > off) - len -= off; - else - len = 0; - - return len < count ? len : count; -} - -static int binder_read_proc_transactions(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct binder_proc *proc; - struct hlist_node *pos; - int len = 0; - char *buf = page; - char *end = page + PAGE_SIZE; - int do_lock = !binder_debug_no_lock; - - if (off) - return 0; - - if (do_lock) - mutex_lock(&binder_lock); - - buf += snprintf(buf, end - buf, "binder transactions:\n"); - hlist_for_each_entry(proc, pos, &binder_procs, proc_node) { - if (buf >= end) - break; - buf = print_binder_proc(buf, end, proc, 0); - } - if (do_lock) - mutex_unlock(&binder_lock); - if (buf > page + PAGE_SIZE) - buf = page + PAGE_SIZE; - - *start = page + off; - - len = buf - page; - if (len > off) - len -= off; - else - len = 0; - - return len < count ? len : count; -} - -static int binder_read_proc_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct binder_proc *proc = data; - int len = 0; - char *p = page; - int do_lock = !binder_debug_no_lock; - - if (off) - return 0; - - if (do_lock) - mutex_lock(&binder_lock); - p += snprintf(p, PAGE_SIZE, "binder proc state:\n"); - p = print_binder_proc(p, page + PAGE_SIZE, proc, 1); - if (do_lock) - mutex_unlock(&binder_lock); - - if (p > page + PAGE_SIZE) - p = page + PAGE_SIZE; - *start = page + off; - - len = p - page; - if (len > off) - len -= off; - else - len = 0; - - return len < count ? len : count; -} - -static char *print_binder_transaction_log_entry(char *buf, char *end, - struct binder_transaction_log_entry *e) -{ - buf += snprintf(buf, end - buf, - "%d: %s from %d:%d to %d:%d node %d handle %d " - "size %d:%d\n", - e->debug_id, (e->call_type == 2) ? "reply" : - ((e->call_type == 1) ? "async" : "call "), e->from_proc, - e->from_thread, e->to_proc, e->to_thread, e->to_node, - e->target_handle, e->data_size, e->offsets_size); - return buf; -} - -static int binder_read_proc_transaction_log( - char *page, char **start, off_t off, int count, int *eof, void *data) -{ - struct binder_transaction_log *log = data; - int len = 0; - int i; - char *buf = page; - char *end = page + PAGE_SIZE; - - if (off) - return 0; - - if (log->full) { - for (i = log->next; i < ARRAY_SIZE(log->entry); i++) { - if (buf >= end) - break; - buf = print_binder_transaction_log_entry(buf, end, - &log->entry[i]); - } - } - for (i = 0; i < log->next; i++) { - if (buf >= end) - break; - buf = print_binder_transaction_log_entry(buf, end, - &log->entry[i]); - } - - *start = page + off; - - len = buf - page; - if (len > off) - len -= off; - else - len = 0; - - return len < count ? len : count; -} - -static const struct file_operations binder_fops = { - .owner = THIS_MODULE, - .poll = binder_poll, - .unlocked_ioctl = binder_ioctl, - .mmap = binder_mmap, - .open = binder_open, - .flush = binder_flush, - .release = binder_release, -}; - -static struct miscdevice binder_miscdev = { - .minor = MISC_DYNAMIC_MINOR, - .name = "binder", - .fops = &binder_fops -}; - -static int __init binder_init(void) -{ - int ret; - - binder_proc_dir_entry_root = proc_mkdir("binder", NULL); - if (binder_proc_dir_entry_root) - binder_proc_dir_entry_proc = proc_mkdir("proc", - binder_proc_dir_entry_root); - ret = misc_register(&binder_miscdev); - if (binder_proc_dir_entry_root) { - create_proc_read_entry("state", - S_IRUGO, - binder_proc_dir_entry_root, - binder_read_proc_state, - NULL); - create_proc_read_entry("stats", - S_IRUGO, - binder_proc_dir_entry_root, - binder_read_proc_stats, - NULL); - create_proc_read_entry("transactions", - S_IRUGO, - binder_proc_dir_entry_root, - binder_read_proc_transactions, - NULL); - create_proc_read_entry("transaction_log", - S_IRUGO, - binder_proc_dir_entry_root, - binder_read_proc_transaction_log, - &binder_transaction_log); - create_proc_read_entry("failed_transaction_log", - S_IRUGO, - binder_proc_dir_entry_root, - binder_read_proc_transaction_log, - &binder_transaction_log_failed); - } - return ret; -} - -device_initcall(binder_init); - -MODULE_LICENSE("GPL v2"); diff --git a/drivers/staging/android/binder.h b/drivers/staging/android/binder.h deleted file mode 100644 index 863ae1ad5d55..000000000000 --- a/drivers/staging/android/binder.h +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (C) 2008 Google, Inc. - * - * Based on, but no longer compatible with, the original - * OpenBinder.org binder driver interface, which is: - * - * Copyright (c) 2005 Palmsource, Inc. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * 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. - * - */ - -#ifndef _LINUX_BINDER_H -#define _LINUX_BINDER_H - -#include - -#define B_PACK_CHARS(c1, c2, c3, c4) \ - ((((c1)<<24)) | (((c2)<<16)) | (((c3)<<8)) | (c4)) -#define B_TYPE_LARGE 0x85 - -enum { - BINDER_TYPE_BINDER = B_PACK_CHARS('s', 'b', '*', B_TYPE_LARGE), - BINDER_TYPE_WEAK_BINDER = B_PACK_CHARS('w', 'b', '*', B_TYPE_LARGE), - BINDER_TYPE_HANDLE = B_PACK_CHARS('s', 'h', '*', B_TYPE_LARGE), - BINDER_TYPE_WEAK_HANDLE = B_PACK_CHARS('w', 'h', '*', B_TYPE_LARGE), - BINDER_TYPE_FD = B_PACK_CHARS('f', 'd', '*', B_TYPE_LARGE), -}; - -enum { - FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff, - FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100, -}; - -/* - * This is the flattened representation of a Binder object for transfer - * between processes. The 'offsets' supplied as part of a binder transaction - * contains offsets into the data where these structures occur. The Binder - * driver takes care of re-writing the structure type and data as it moves - * between processes. - */ -struct flat_binder_object { - /* 8 bytes for large_flat_header. */ - unsigned long type; - unsigned long flags; - - /* 8 bytes of data. */ - union { - void *binder; /* local object */ - signed long handle; /* remote object */ - }; - - /* extra data associated with local object */ - void *cookie; -}; - -/* - * On 64-bit platforms where user code may run in 32-bits the driver must - * translate the buffer (and local binder) addresses apropriately. - */ - -struct binder_write_read { - signed long write_size; /* bytes to write */ - signed long write_consumed; /* bytes consumed by driver */ - unsigned long write_buffer; - signed long read_size; /* bytes to read */ - signed long read_consumed; /* bytes consumed by driver */ - unsigned long read_buffer; -}; - -/* Use with BINDER_VERSION, driver fills in fields. */ -struct binder_version { - /* driver protocol version -- increment with incompatible change */ - signed long protocol_version; -}; - -/* This is the current protocol version. */ -#define BINDER_CURRENT_PROTOCOL_VERSION 7 - -#define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) -#define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, int64_t) -#define BINDER_SET_MAX_THREADS _IOW('b', 5, size_t) -#define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, int) -#define BINDER_SET_CONTEXT_MGR _IOW('b', 7, int) -#define BINDER_THREAD_EXIT _IOW('b', 8, int) -#define BINDER_VERSION _IOWR('b', 9, struct binder_version) - -/* - * NOTE: Two special error codes you should check for when calling - * in to the driver are: - * - * EINTR -- The operation has been interupted. This should be - * handled by retrying the ioctl() until a different error code - * is returned. - * - * ECONNREFUSED -- The driver is no longer accepting operations - * from your process. That is, the process is being destroyed. - * You should handle this by exiting from your process. Note - * that once this error code is returned, all further calls to - * the driver from any thread will return this same code. - */ - -enum transaction_flags { - TF_ONE_WAY = 0x01, /* this is a one-way call: async, no return */ - TF_ROOT_OBJECT = 0x04, /* contents are the component's root object */ - TF_STATUS_CODE = 0x08, /* contents are a 32-bit status code */ - TF_ACCEPT_FDS = 0x10, /* allow replies with file descriptors */ -}; - -struct binder_transaction_data { - /* The first two are only used for bcTRANSACTION and brTRANSACTION, - * identifying the target and contents of the transaction. - */ - union { - size_t handle; /* target descriptor of command transaction */ - void *ptr; /* target descriptor of return transaction */ - } target; - void *cookie; /* target object cookie */ - unsigned int code; /* transaction command */ - - /* General information about the transaction. */ - unsigned int flags; - pid_t sender_pid; - uid_t sender_euid; - size_t data_size; /* number of bytes of data */ - size_t offsets_size; /* number of bytes of offsets */ - - /* If this transaction is inline, the data immediately - * follows here; otherwise, it ends with a pointer to - * the data buffer. - */ - union { - struct { - /* transaction data */ - const void *buffer; - /* offsets from buffer to flat_binder_object structs */ - const void *offsets; - } ptr; - uint8_t buf[8]; - } data; -}; - -struct binder_ptr_cookie { - void *ptr; - void *cookie; -}; - -struct binder_pri_desc { - int priority; - int desc; -}; - -struct binder_pri_ptr_cookie { - int priority; - void *ptr; - void *cookie; -}; - -enum BinderDriverReturnProtocol { - BR_ERROR = _IOR('r', 0, int), - /* - * int: error code - */ - - BR_OK = _IO('r', 1), - /* No parameters! */ - - BR_TRANSACTION = _IOR('r', 2, struct binder_transaction_data), - BR_REPLY = _IOR('r', 3, struct binder_transaction_data), - /* - * binder_transaction_data: the received command. - */ - - BR_ACQUIRE_RESULT = _IOR('r', 4, int), - /* - * not currently supported - * int: 0 if the last bcATTEMPT_ACQUIRE was not successful. - * Else the remote object has acquired a primary reference. - */ - - BR_DEAD_REPLY = _IO('r', 5), - /* - * The target of the last transaction (either a bcTRANSACTION or - * a bcATTEMPT_ACQUIRE) is no longer with us. No parameters. - */ - - BR_TRANSACTION_COMPLETE = _IO('r', 6), - /* - * No parameters... always refers to the last transaction requested - * (including replies). Note that this will be sent even for - * asynchronous transactions. - */ - - BR_INCREFS = _IOR('r', 7, struct binder_ptr_cookie), - BR_ACQUIRE = _IOR('r', 8, struct binder_ptr_cookie), - BR_RELEASE = _IOR('r', 9, struct binder_ptr_cookie), - BR_DECREFS = _IOR('r', 10, struct binder_ptr_cookie), - /* - * void *: ptr to binder - * void *: cookie for binder - */ - - BR_ATTEMPT_ACQUIRE = _IOR('r', 11, struct binder_pri_ptr_cookie), - /* - * not currently supported - * int: priority - * void *: ptr to binder - * void *: cookie for binder - */ - - BR_NOOP = _IO('r', 12), - /* - * No parameters. Do nothing and examine the next command. It exists - * primarily so that we can replace it with a BR_SPAWN_LOOPER command. - */ - - BR_SPAWN_LOOPER = _IO('r', 13), - /* - * No parameters. The driver has determined that a process has no - * threads waiting to service incomming transactions. When a process - * receives this command, it must spawn a new service thread and - * register it via bcENTER_LOOPER. - */ - - BR_FINISHED = _IO('r', 14), - /* - * not currently supported - * stop threadpool thread - */ - - BR_DEAD_BINDER = _IOR('r', 15, void *), - /* - * void *: cookie - */ - BR_CLEAR_DEATH_NOTIFICATION_DONE = _IOR('r', 16, void *), - /* - * void *: cookie - */ - - BR_FAILED_REPLY = _IO('r', 17), - /* - * The the last transaction (either a bcTRANSACTION or - * a bcATTEMPT_ACQUIRE) failed (e.g. out of memory). No parameters. - */ -}; - -enum BinderDriverCommandProtocol { - BC_TRANSACTION = _IOW('c', 0, struct binder_transaction_data), - BC_REPLY = _IOW('c', 1, struct binder_transaction_data), - /* - * binder_transaction_data: the sent command. - */ - - BC_ACQUIRE_RESULT = _IOW('c', 2, int), - /* - * not currently supported - * int: 0 if the last BR_ATTEMPT_ACQUIRE was not successful. - * Else you have acquired a primary reference on the object. - */ - - BC_FREE_BUFFER = _IOW('c', 3, int), - /* - * void *: ptr to transaction data received on a read - */ - - BC_INCREFS = _IOW('c', 4, int), - BC_ACQUIRE = _IOW('c', 5, int), - BC_RELEASE = _IOW('c', 6, int), - BC_DECREFS = _IOW('c', 7, int), - /* - * int: descriptor - */ - - BC_INCREFS_DONE = _IOW('c', 8, struct binder_ptr_cookie), - BC_ACQUIRE_DONE = _IOW('c', 9, struct binder_ptr_cookie), - /* - * void *: ptr to binder - * void *: cookie for binder - */ - - BC_ATTEMPT_ACQUIRE = _IOW('c', 10, struct binder_pri_desc), - /* - * not currently supported - * int: priority - * int: descriptor - */ - - BC_REGISTER_LOOPER = _IO('c', 11), - /* - * No parameters. - * Register a spawned looper thread with the device. - */ - - BC_ENTER_LOOPER = _IO('c', 12), - BC_EXIT_LOOPER = _IO('c', 13), - /* - * No parameters. - * These two commands are sent as an application-level thread - * enters and exits the binder loop, respectively. They are - * used so the binder can have an accurate count of the number - * of looping threads it has available. - */ - - BC_REQUEST_DEATH_NOTIFICATION = _IOW('c', 14, struct binder_ptr_cookie), - /* - * void *: ptr to binder - * void *: cookie - */ - - BC_CLEAR_DEATH_NOTIFICATION = _IOW('c', 15, struct binder_ptr_cookie), - /* - * void *: ptr to binder - * void *: cookie - */ - - BC_DEAD_BINDER_DONE = _IOW('c', 16, void *), - /* - * void *: cookie - */ -}; - -#endif /* _LINUX_BINDER_H */ - diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c deleted file mode 100644 index 6c10b456c6cc..000000000000 --- a/drivers/staging/android/logger.c +++ /dev/null @@ -1,607 +0,0 @@ -/* - * drivers/misc/logger.c - * - * A Logging Subsystem - * - * Copyright (C) 2007-2008 Google, Inc. - * - * Robert Love - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * 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. - */ - -#include -#include -#include -#include -#include -#include -#include "logger.h" - -#include - -/* - * struct logger_log - represents a specific log, such as 'main' or 'radio' - * - * This structure lives from module insertion until module removal, so it does - * not need additional reference counting. The structure is protected by the - * mutex 'mutex'. - */ -struct logger_log { - unsigned char *buffer;/* the ring buffer itself */ - struct miscdevice misc; /* misc device representing the log */ - wait_queue_head_t wq; /* wait queue for readers */ - struct list_head readers; /* this log's readers */ - struct mutex mutex; /* mutex protecting buffer */ - size_t w_off; /* current write head offset */ - size_t head; /* new readers start here */ - size_t size; /* size of the log */ -}; - -/* - * struct logger_reader - a logging device open for reading - * - * This object lives from open to release, so we don't need additional - * reference counting. The structure is protected by log->mutex. - */ -struct logger_reader { - struct logger_log *log; /* associated log */ - struct list_head list; /* entry in logger_log's list */ - size_t r_off; /* current read head offset */ -}; - -/* logger_offset - returns index 'n' into the log via (optimized) modulus */ -#define logger_offset(n) ((n) & (log->size - 1)) - -/* - * file_get_log - Given a file structure, return the associated log - * - * This isn't aesthetic. We have several goals: - * - * 1) Need to quickly obtain the associated log during an I/O operation - * 2) Readers need to maintain state (logger_reader) - * 3) Writers need to be very fast (open() should be a near no-op) - * - * In the reader case, we can trivially go file->logger_reader->logger_log. - * For a writer, we don't want to maintain a logger_reader, so we just go - * file->logger_log. Thus what file->private_data points at depends on whether - * or not the file was opened for reading. This function hides that dirtiness. - */ -static inline struct logger_log *file_get_log(struct file *file) -{ - if (file->f_mode & FMODE_READ) { - struct logger_reader *reader = file->private_data; - return reader->log; - } else - return file->private_data; -} - -/* - * get_entry_len - Grabs the length of the payload of the next entry starting - * from 'off'. - * - * Caller needs to hold log->mutex. - */ -static __u32 get_entry_len(struct logger_log *log, size_t off) -{ - __u16 val; - - switch (log->size - off) { - case 1: - memcpy(&val, log->buffer + off, 1); - memcpy(((char *) &val) + 1, log->buffer, 1); - break; - default: - memcpy(&val, log->buffer + off, 2); - } - - return sizeof(struct logger_entry) + val; -} - -/* - * do_read_log_to_user - reads exactly 'count' bytes from 'log' into the - * user-space buffer 'buf'. Returns 'count' on success. - * - * Caller must hold log->mutex. - */ -static ssize_t do_read_log_to_user(struct logger_log *log, - struct logger_reader *reader, - char __user *buf, - size_t count) -{ - size_t len; - - /* - * We read from the log in two disjoint operations. First, we read from - * the current read head offset up to 'count' bytes or to the end of - * the log, whichever comes first. - */ - len = min(count, log->size - reader->r_off); - if (copy_to_user(buf, log->buffer + reader->r_off, len)) - return -EFAULT; - - /* - * Second, we read any remaining bytes, starting back at the head of - * the log. - */ - if (count != len) - if (copy_to_user(buf + len, log->buffer, count - len)) - return -EFAULT; - - reader->r_off = logger_offset(reader->r_off + count); - - return count; -} - -/* - * logger_read - our log's read() method - * - * Behavior: - * - * - O_NONBLOCK works - * - If there are no log entries to read, blocks until log is written to - * - Atomically reads exactly one log entry - * - * Optimal read size is LOGGER_ENTRY_MAX_LEN. Will set errno to EINVAL if read - * buffer is insufficient to hold next entry. - */ -static ssize_t logger_read(struct file *file, char __user *buf, - size_t count, loff_t *pos) -{ - struct logger_reader *reader = file->private_data; - struct logger_log *log = reader->log; - ssize_t ret; - DEFINE_WAIT(wait); - -start: - while (1) { - prepare_to_wait(&log->wq, &wait, TASK_INTERRUPTIBLE); - - mutex_lock(&log->mutex); - ret = (log->w_off == reader->r_off); - mutex_unlock(&log->mutex); - if (!ret) - break; - - if (file->f_flags & O_NONBLOCK) { - ret = -EAGAIN; - break; - } - - if (signal_pending(current)) { - ret = -EINTR; - break; - } - - schedule(); - } - - finish_wait(&log->wq, &wait); - if (ret) - return ret; - - mutex_lock(&log->mutex); - - /* is there still something to read or did we race? */ - if (unlikely(log->w_off == reader->r_off)) { - mutex_unlock(&log->mutex); - goto start; - } - - /* get the size of the next entry */ - ret = get_entry_len(log, reader->r_off); - if (count < ret) { - ret = -EINVAL; - goto out; - } - - /* get exactly one entry from the log */ - ret = do_read_log_to_user(log, reader, buf, ret); - -out: - mutex_unlock(&log->mutex); - - return ret; -} - -/* - * get_next_entry - return the offset of the first valid entry at least 'len' - * bytes after 'off'. - * - * Caller must hold log->mutex. - */ -static size_t get_next_entry(struct logger_log *log, size_t off, size_t len) -{ - size_t count = 0; - - do { - size_t nr = get_entry_len(log, off); - off = logger_offset(off + nr); - count += nr; - } while (count < len); - - return off; -} - -/* - * clock_interval - is a < c < b in mod-space? Put another way, does the line - * from a to b cross c? - */ -static inline int clock_interval(size_t a, size_t b, size_t c) -{ - if (b < a) { - if (a < c || b >= c) - return 1; - } else { - if (a < c && b >= c) - return 1; - } - - return 0; -} - -/* - * fix_up_readers - walk the list of all readers and "fix up" any who were - * lapped by the writer; also do the same for the default "start head". - * We do this by "pulling forward" the readers and start head to the first - * entry after the new write head. - * - * The caller needs to hold log->mutex. - */ -static void fix_up_readers(struct logger_log *log, size_t len) -{ - size_t old = log->w_off; - size_t new = logger_offset(old + len); - struct logger_reader *reader; - - if (clock_interval(old, new, log->head)) - log->head = get_next_entry(log, log->head, len); - - list_for_each_entry(reader, &log->readers, list) - if (clock_interval(old, new, reader->r_off)) - reader->r_off = get_next_entry(log, reader->r_off, len); -} - -/* - * do_write_log - writes 'len' bytes from 'buf' to 'log' - * - * The caller needs to hold log->mutex. - */ -static void do_write_log(struct logger_log *log, const void *buf, size_t count) -{ - size_t len; - - len = min(count, log->size - log->w_off); - memcpy(log->buffer + log->w_off, buf, len); - - if (count != len) - memcpy(log->buffer, buf + len, count - len); - - log->w_off = logger_offset(log->w_off + count); - -} - -/* - * do_write_log_user - writes 'len' bytes from the user-space buffer 'buf' to - * the log 'log' - * - * The caller needs to hold log->mutex. - * - * Returns 'count' on success, negative error code on failure. - */ -static ssize_t do_write_log_from_user(struct logger_log *log, - const void __user *buf, size_t count) -{ - size_t len; - - len = min(count, log->size - log->w_off); - if (len && copy_from_user(log->buffer + log->w_off, buf, len)) - return -EFAULT; - - if (count != len) - if (copy_from_user(log->buffer, buf + len, count - len)) - return -EFAULT; - - log->w_off = logger_offset(log->w_off + count); - - return count; -} - -/* - * logger_aio_write - our write method, implementing support for write(), - * writev(), and aio_write(). Writes are our fast path, and we try to optimize - * them above all else. - */ -ssize_t logger_aio_write(struct kiocb *iocb, const struct iovec *iov, - unsigned long nr_segs, loff_t ppos) -{ - struct logger_log *log = file_get_log(iocb->ki_filp); - size_t orig = log->w_off; - struct logger_entry header; - struct timespec now; - ssize_t ret = 0; - - now = current_kernel_time(); - - header.pid = current->tgid; - header.tid = current->pid; - header.sec = now.tv_sec; - header.nsec = now.tv_nsec; - header.len = min_t(size_t, iocb->ki_left, LOGGER_ENTRY_MAX_PAYLOAD); - - /* null writes succeed, return zero */ - if (unlikely(!header.len)) - return 0; - - mutex_lock(&log->mutex); - - /* - * Fix up any readers, pulling them forward to the first readable - * entry after (what will be) the new write offset. We do this now - * because if we partially fail, we can end up with clobbered log - * entries that encroach on readable buffer. - */ - fix_up_readers(log, sizeof(struct logger_entry) + header.len); - - do_write_log(log, &header, sizeof(struct logger_entry)); - - while (nr_segs-- > 0) { - size_t len; - ssize_t nr; - - /* figure out how much of this vector we can keep */ - len = min_t(size_t, iov->iov_len, header.len - ret); - - /* write out this segment's payload */ - nr = do_write_log_from_user(log, iov->iov_base, len); - if (unlikely(nr < 0)) { - log->w_off = orig; - mutex_unlock(&log->mutex); - return nr; - } - - iov++; - ret += nr; - } - - mutex_unlock(&log->mutex); - - /* wake up any blocked readers */ - wake_up_interruptible(&log->wq); - - return ret; -} - -static struct logger_log *get_log_from_minor(int); - -/* - * logger_open - the log's open() file operation - * - * Note how near a no-op this is in the write-only case. Keep it that way! - */ -static int logger_open(struct inode *inode, struct file *file) -{ - struct logger_log *log; - int ret; - - ret = nonseekable_open(inode, file); - if (ret) - return ret; - - log = get_log_from_minor(MINOR(inode->i_rdev)); - if (!log) - return -ENODEV; - - if (file->f_mode & FMODE_READ) { - struct logger_reader *reader; - - reader = kmalloc(sizeof(struct logger_reader), GFP_KERNEL); - if (!reader) - return -ENOMEM; - - reader->log = log; - INIT_LIST_HEAD(&reader->list); - - mutex_lock(&log->mutex); - reader->r_off = log->head; - list_add_tail(&reader->list, &log->readers); - mutex_unlock(&log->mutex); - - file->private_data = reader; - } else - file->private_data = log; - - return 0; -} - -/* - * logger_release - the log's release file operation - * - * Note this is a total no-op in the write-only case. Keep it that way! - */ -static int logger_release(struct inode *ignored, struct file *file) -{ - if (file->f_mode & FMODE_READ) { - struct logger_reader *reader = file->private_data; - list_del(&reader->list); - kfree(reader); - } - - return 0; -} - -/* - * logger_poll - the log's poll file operation, for poll/select/epoll - * - * Note we always return POLLOUT, because you can always write() to the log. - * Note also that, strictly speaking, a return value of POLLIN does not - * guarantee that the log is readable without blocking, as there is a small - * chance that the writer can lap the reader in the interim between poll() - * returning and the read() request. - */ -static unsigned int logger_poll(struct file *file, poll_table *wait) -{ - struct logger_reader *reader; - struct logger_log *log; - unsigned int ret = POLLOUT | POLLWRNORM; - - if (!(file->f_mode & FMODE_READ)) - return ret; - - reader = file->private_data; - log = reader->log; - - poll_wait(file, &log->wq, wait); - - mutex_lock(&log->mutex); - if (log->w_off != reader->r_off) - ret |= POLLIN | POLLRDNORM; - mutex_unlock(&log->mutex); - - return ret; -} - -static long logger_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ - struct logger_log *log = file_get_log(file); - struct logger_reader *reader; - long ret = -ENOTTY; - - mutex_lock(&log->mutex); - - switch (cmd) { - case LOGGER_GET_LOG_BUF_SIZE: - ret = log->size; - break; - case LOGGER_GET_LOG_LEN: - if (!(file->f_mode & FMODE_READ)) { - ret = -EBADF; - break; - } - reader = file->private_data; - if (log->w_off >= reader->r_off) - ret = log->w_off - reader->r_off; - else - ret = (log->size - reader->r_off) + log->w_off; - break; - case LOGGER_GET_NEXT_ENTRY_LEN: - if (!(file->f_mode & FMODE_READ)) { - ret = -EBADF; - break; - } - reader = file->private_data; - if (log->w_off != reader->r_off) - ret = get_entry_len(log, reader->r_off); - else - ret = 0; - break; - case LOGGER_FLUSH_LOG: - if (!(file->f_mode & FMODE_WRITE)) { - ret = -EBADF; - break; - } - list_for_each_entry(reader, &log->readers, list) - reader->r_off = log->w_off; - log->head = log->w_off; - ret = 0; - break; - } - - mutex_unlock(&log->mutex); - - return ret; -} - -static const struct file_operations logger_fops = { - .owner = THIS_MODULE, - .read = logger_read, - .aio_write = logger_aio_write, - .poll = logger_poll, - .unlocked_ioctl = logger_ioctl, - .compat_ioctl = logger_ioctl, - .open = logger_open, - .release = logger_release, -}; - -/* - * Defines a log structure with name 'NAME' and a size of 'SIZE' bytes, which - * must be a power of two, greater than LOGGER_ENTRY_MAX_LEN, and less than - * LONG_MAX minus LOGGER_ENTRY_MAX_LEN. - */ -#define DEFINE_LOGGER_DEVICE(VAR, NAME, SIZE) \ -static unsigned char _buf_ ## VAR[SIZE]; \ -static struct logger_log VAR = { \ - .buffer = _buf_ ## VAR, \ - .misc = { \ - .minor = MISC_DYNAMIC_MINOR, \ - .name = NAME, \ - .fops = &logger_fops, \ - .parent = NULL, \ - }, \ - .wq = __WAIT_QUEUE_HEAD_INITIALIZER(VAR .wq), \ - .readers = LIST_HEAD_INIT(VAR .readers), \ - .mutex = __MUTEX_INITIALIZER(VAR .mutex), \ - .w_off = 0, \ - .head = 0, \ - .size = SIZE, \ -}; - -DEFINE_LOGGER_DEVICE(log_main, LOGGER_LOG_MAIN, 64*1024) -DEFINE_LOGGER_DEVICE(log_events, LOGGER_LOG_EVENTS, 256*1024) -DEFINE_LOGGER_DEVICE(log_radio, LOGGER_LOG_RADIO, 64*1024) - -static struct logger_log *get_log_from_minor(int minor) -{ - if (log_main.misc.minor == minor) - return &log_main; - if (log_events.misc.minor == minor) - return &log_events; - if (log_radio.misc.minor == minor) - return &log_radio; - return NULL; -} - -static int __init init_log(struct logger_log *log) -{ - int ret; - - ret = misc_register(&log->misc); - if (unlikely(ret)) { - printk(KERN_ERR "logger: failed to register misc " - "device for log '%s'!\n", log->misc.name); - return ret; - } - - printk(KERN_INFO "logger: created %luK log '%s'\n", - (unsigned long) log->size >> 10, log->misc.name); - - return 0; -} - -static int __init logger_init(void) -{ - int ret; - - ret = init_log(&log_main); - if (unlikely(ret)) - goto out; - - ret = init_log(&log_events); - if (unlikely(ret)) - goto out; - - ret = init_log(&log_radio); - if (unlikely(ret)) - goto out; - -out: - return ret; -} -device_initcall(logger_init); diff --git a/drivers/staging/android/logger.h b/drivers/staging/android/logger.h deleted file mode 100644 index a562434d7419..000000000000 --- a/drivers/staging/android/logger.h +++ /dev/null @@ -1,48 +0,0 @@ -/* include/linux/logger.h - * - * Copyright (C) 2007-2008 Google, Inc. - * Author: Robert Love - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * 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. - * - */ - -#ifndef _LINUX_LOGGER_H -#define _LINUX_LOGGER_H - -#include -#include - -struct logger_entry { - __u16 len; /* length of the payload */ - __u16 __pad; /* no matter what, we get 2 bytes of padding */ - __s32 pid; /* generating process's pid */ - __s32 tid; /* generating process's tid */ - __s32 sec; /* seconds since Epoch */ - __s32 nsec; /* nanoseconds */ - char msg[0]; /* the entry's payload */ -}; - -#define LOGGER_LOG_RADIO "log_radio" /* radio-related messages */ -#define LOGGER_LOG_EVENTS "log_events" /* system/hardware events */ -#define LOGGER_LOG_MAIN "log_main" /* everything else */ - -#define LOGGER_ENTRY_MAX_LEN (4*1024) -#define LOGGER_ENTRY_MAX_PAYLOAD \ - (LOGGER_ENTRY_MAX_LEN - sizeof(struct logger_entry)) - -#define __LOGGERIO 0xAE - -#define LOGGER_GET_LOG_BUF_SIZE _IO(__LOGGERIO, 1) /* size of log */ -#define LOGGER_GET_LOG_LEN _IO(__LOGGERIO, 2) /* used log len */ -#define LOGGER_GET_NEXT_ENTRY_LEN _IO(__LOGGERIO, 3) /* next entry len */ -#define LOGGER_FLUSH_LOG _IO(__LOGGERIO, 4) /* flush log */ - -#endif /* _LINUX_LOGGER_H */ diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c deleted file mode 100644 index 935d281a201a..000000000000 --- a/drivers/staging/android/lowmemorykiller.c +++ /dev/null @@ -1,173 +0,0 @@ -/* drivers/misc/lowmemorykiller.c - * - * The lowmemorykiller driver lets user-space specify a set of memory thresholds - * where processes with a range of oom_adj values will get killed. Specify the - * minimum oom_adj values in /sys/module/lowmemorykiller/parameters/adj and the - * number of free pages in /sys/module/lowmemorykiller/parameters/minfree. Both - * files take a comma separated list of numbers in ascending order. - * - * For example, write "0,8" to /sys/module/lowmemorykiller/parameters/adj and - * "1024,4096" to /sys/module/lowmemorykiller/parameters/minfree to kill processes - * with a oom_adj value of 8 or higher when the free memory drops below 4096 pages - * and kill processes with a oom_adj value of 0 or higher when the free memory - * drops below 1024 pages. - * - * The driver considers memory used for caches to be free, but if a large - * percentage of the cached memory is locked this can be very inaccurate - * and processes may not get killed until the normal oom killer is triggered. - * - * Copyright (C) 2007-2008 Google, Inc. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * 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. - * - */ - -#include -#include -#include -#include -#include - -static uint32_t lowmem_debug_level = 2; -static int lowmem_adj[6] = { - 0, - 1, - 6, - 12, -}; -static int lowmem_adj_size = 4; -static size_t lowmem_minfree[6] = { - 3 * 512, /* 6MB */ - 2 * 1024, /* 8MB */ - 4 * 1024, /* 16MB */ - 16 * 1024, /* 64MB */ -}; -static int lowmem_minfree_size = 4; - -#define lowmem_print(level, x...) \ - do { \ - if (lowmem_debug_level >= (level)) \ - printk(x); \ - } while (0) - -static int lowmem_shrink(int nr_to_scan, gfp_t gfp_mask) -{ - struct task_struct *p; - struct task_struct *selected = NULL; - int rem = 0; - int tasksize; - int i; - int min_adj = OOM_ADJUST_MAX + 1; - int selected_tasksize = 0; - int selected_oom_adj; - int array_size = ARRAY_SIZE(lowmem_adj); - int other_free = global_page_state(NR_FREE_PAGES); - int other_file = global_page_state(NR_FILE_PAGES); - - if (lowmem_adj_size < array_size) - array_size = lowmem_adj_size; - if (lowmem_minfree_size < array_size) - array_size = lowmem_minfree_size; - for (i = 0; i < array_size; i++) { - if (other_free < lowmem_minfree[i] && - other_file < lowmem_minfree[i]) { - min_adj = lowmem_adj[i]; - break; - } - } - if (nr_to_scan > 0) - lowmem_print(3, "lowmem_shrink %d, %x, ofree %d %d, ma %d\n", - nr_to_scan, gfp_mask, other_free, other_file, - min_adj); - rem = global_page_state(NR_ACTIVE_ANON) + - global_page_state(NR_ACTIVE_FILE) + - global_page_state(NR_INACTIVE_ANON) + - global_page_state(NR_INACTIVE_FILE); - if (nr_to_scan <= 0 || min_adj == OOM_ADJUST_MAX + 1) { - lowmem_print(5, "lowmem_shrink %d, %x, return %d\n", - nr_to_scan, gfp_mask, rem); - return rem; - } - selected_oom_adj = min_adj; - - read_lock(&tasklist_lock); - for_each_process(p) { - struct mm_struct *mm; - int oom_adj; - - task_lock(p); - mm = p->mm; - if (!mm) { - task_unlock(p); - continue; - } - oom_adj = mm->oom_adj; - if (oom_adj < min_adj) { - task_unlock(p); - continue; - } - tasksize = get_mm_rss(mm); - task_unlock(p); - if (tasksize <= 0) - continue; - if (selected) { - if (oom_adj < selected_oom_adj) - continue; - if (oom_adj == selected_oom_adj && - tasksize <= selected_tasksize) - continue; - } - selected = p; - selected_tasksize = tasksize; - selected_oom_adj = oom_adj; - lowmem_print(2, "select %d (%s), adj %d, size %d, to kill\n", - p->pid, p->comm, oom_adj, tasksize); - } - if (selected) { - lowmem_print(1, "send sigkill to %d (%s), adj %d, size %d\n", - selected->pid, selected->comm, - selected_oom_adj, selected_tasksize); - force_sig(SIGKILL, selected); - rem -= selected_tasksize; - } - lowmem_print(4, "lowmem_shrink %d, %x, return %d\n", - nr_to_scan, gfp_mask, rem); - read_unlock(&tasklist_lock); - return rem; -} - -static struct shrinker lowmem_shrinker = { - .shrink = lowmem_shrink, - .seeks = DEFAULT_SEEKS * 16 -}; - -static int __init lowmem_init(void) -{ - register_shrinker(&lowmem_shrinker); - return 0; -} - -static void __exit lowmem_exit(void) -{ - unregister_shrinker(&lowmem_shrinker); -} - -module_param_named(cost, lowmem_shrinker.seeks, int, S_IRUGO | S_IWUSR); -module_param_array_named(adj, lowmem_adj, int, &lowmem_adj_size, - S_IRUGO | S_IWUSR); -module_param_array_named(minfree, lowmem_minfree, uint, &lowmem_minfree_size, - S_IRUGO | S_IWUSR); -module_param_named(debug_level, lowmem_debug_level, uint, S_IRUGO | S_IWUSR); - -module_init(lowmem_init); -module_exit(lowmem_exit); - -MODULE_LICENSE("GPL"); - diff --git a/drivers/staging/android/ram_console.c b/drivers/staging/android/ram_console.c deleted file mode 100644 index 8f18a59744cd..000000000000 --- a/drivers/staging/android/ram_console.c +++ /dev/null @@ -1,410 +0,0 @@ -/* drivers/android/ram_console.c - * - * Copyright (C) 2007-2008 Google, Inc. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * 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. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION -#include -#endif - -struct ram_console_buffer { - uint32_t sig; - uint32_t start; - uint32_t size; - uint8_t data[0]; -}; - -#define RAM_CONSOLE_SIG (0x43474244) /* DBGC */ - -#ifdef CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT -static char __initdata - ram_console_old_log_init_buffer[CONFIG_ANDROID_RAM_CONSOLE_EARLY_SIZE]; -#endif -static char *ram_console_old_log; -static size_t ram_console_old_log_size; - -static struct ram_console_buffer *ram_console_buffer; -static size_t ram_console_buffer_size; -#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION -static char *ram_console_par_buffer; -static struct rs_control *ram_console_rs_decoder; -static int ram_console_corrected_bytes; -static int ram_console_bad_blocks; -#define ECC_BLOCK_SIZE CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_DATA_SIZE -#define ECC_SIZE CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_ECC_SIZE -#define ECC_SYMSIZE CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE -#define ECC_POLY CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_POLYNOMIAL -#endif - -#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION -static void ram_console_encode_rs8(uint8_t *data, size_t len, uint8_t *ecc) -{ - int i; - uint16_t par[ECC_SIZE]; - /* Initialize the parity buffer */ - memset(par, 0, sizeof(par)); - encode_rs8(ram_console_rs_decoder, data, len, par, 0); - for (i = 0; i < ECC_SIZE; i++) - ecc[i] = par[i]; -} - -static int ram_console_decode_rs8(void *data, size_t len, uint8_t *ecc) -{ - int i; - uint16_t par[ECC_SIZE]; - for (i = 0; i < ECC_SIZE; i++) - par[i] = ecc[i]; - return decode_rs8(ram_console_rs_decoder, data, par, len, - NULL, 0, NULL, 0, NULL); -} -#endif - -static void ram_console_update(const char *s, unsigned int count) -{ - struct ram_console_buffer *buffer = ram_console_buffer; -#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION - uint8_t *buffer_end = buffer->data + ram_console_buffer_size; - uint8_t *block; - uint8_t *par; - int size = ECC_BLOCK_SIZE; -#endif - memcpy(buffer->data + buffer->start, s, count); -#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION - block = buffer->data + (buffer->start & ~(ECC_BLOCK_SIZE - 1)); - par = ram_console_par_buffer + - (buffer->start / ECC_BLOCK_SIZE) * ECC_SIZE; - do { - if (block + ECC_BLOCK_SIZE > buffer_end) - size = buffer_end - block; - ram_console_encode_rs8(block, size, par); - block += ECC_BLOCK_SIZE; - par += ECC_SIZE; - } while (block < buffer->data + buffer->start + count); -#endif -} - -static void ram_console_update_header(void) -{ -#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION - struct ram_console_buffer *buffer = ram_console_buffer; - uint8_t *par; - par = ram_console_par_buffer + - DIV_ROUND_UP(ram_console_buffer_size, ECC_BLOCK_SIZE) * ECC_SIZE; - ram_console_encode_rs8((uint8_t *)buffer, sizeof(*buffer), par); -#endif -} - -static void -ram_console_write(struct console *console, const char *s, unsigned int count) -{ - int rem; - struct ram_console_buffer *buffer = ram_console_buffer; - - if (count > ram_console_buffer_size) { - s += count - ram_console_buffer_size; - count = ram_console_buffer_size; - } - rem = ram_console_buffer_size - buffer->start; - if (rem < count) { - ram_console_update(s, rem); - s += rem; - count -= rem; - buffer->start = 0; - buffer->size = ram_console_buffer_size; - } - ram_console_update(s, count); - - buffer->start += count; - if (buffer->size < ram_console_buffer_size) - buffer->size += count; - ram_console_update_header(); -} - -static struct console ram_console = { - .name = "ram", - .write = ram_console_write, - .flags = CON_PRINTBUFFER | CON_ENABLED, - .index = -1, -}; - -static void __init -ram_console_save_old(struct ram_console_buffer *buffer, char *dest) -{ - size_t old_log_size = buffer->size; -#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION - uint8_t *block; - uint8_t *par; - char strbuf[80]; - int strbuf_len; - - block = buffer->data; - par = ram_console_par_buffer; - while (block < buffer->data + buffer->size) { - int numerr; - int size = ECC_BLOCK_SIZE; - if (block + size > buffer->data + ram_console_buffer_size) - size = buffer->data + ram_console_buffer_size - block; - numerr = ram_console_decode_rs8(block, size, par); - if (numerr > 0) { -#if 0 - printk(KERN_INFO "ram_console: error in block %p, %d\n", - block, numerr); -#endif - ram_console_corrected_bytes += numerr; - } else if (numerr < 0) { -#if 0 - printk(KERN_INFO "ram_console: uncorrectable error in " - "block %p\n", block); -#endif - ram_console_bad_blocks++; - } - block += ECC_BLOCK_SIZE; - par += ECC_SIZE; - } - if (ram_console_corrected_bytes || ram_console_bad_blocks) - strbuf_len = snprintf(strbuf, sizeof(strbuf), - "\n%d Corrected bytes, %d unrecoverable blocks\n", - ram_console_corrected_bytes, ram_console_bad_blocks); - else - strbuf_len = snprintf(strbuf, sizeof(strbuf), - "\nNo errors detected\n"); - if (strbuf_len >= sizeof(strbuf)) - strbuf_len = sizeof(strbuf) - 1; - old_log_size += strbuf_len; -#endif - - if (dest == NULL) { - dest = kmalloc(old_log_size, GFP_KERNEL); - if (dest == NULL) { - printk(KERN_ERR - "ram_console: failed to allocate buffer\n"); - return; - } - } - - ram_console_old_log = dest; - ram_console_old_log_size = old_log_size; - memcpy(ram_console_old_log, - &buffer->data[buffer->start], buffer->size - buffer->start); - memcpy(ram_console_old_log + buffer->size - buffer->start, - &buffer->data[0], buffer->start); -#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION - memcpy(ram_console_old_log + old_log_size - strbuf_len, - strbuf, strbuf_len); -#endif -} - -static int __init ram_console_init(struct ram_console_buffer *buffer, - size_t buffer_size, char *old_buf) -{ -#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION - int numerr; - uint8_t *par; -#endif - ram_console_buffer = buffer; - ram_console_buffer_size = - buffer_size - sizeof(struct ram_console_buffer); - - if (ram_console_buffer_size > buffer_size) { - pr_err("ram_console: buffer %p, invalid size %zu, " - "datasize %zu\n", buffer, buffer_size, - ram_console_buffer_size); - return 0; - } - -#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION - ram_console_buffer_size -= (DIV_ROUND_UP(ram_console_buffer_size, - ECC_BLOCK_SIZE) + 1) * ECC_SIZE; - - if (ram_console_buffer_size > buffer_size) { - pr_err("ram_console: buffer %p, invalid size %zu, " - "non-ecc datasize %zu\n", - buffer, buffer_size, ram_console_buffer_size); - return 0; - } - - ram_console_par_buffer = buffer->data + ram_console_buffer_size; - - - /* first consecutive root is 0 - * primitive element to generate roots = 1 - */ - ram_console_rs_decoder = init_rs(ECC_SYMSIZE, ECC_POLY, 0, 1, ECC_SIZE); - if (ram_console_rs_decoder == NULL) { - printk(KERN_INFO "ram_console: init_rs failed\n"); - return 0; - } - - ram_console_corrected_bytes = 0; - ram_console_bad_blocks = 0; - - par = ram_console_par_buffer + - DIV_ROUND_UP(ram_console_buffer_size, ECC_BLOCK_SIZE) * ECC_SIZE; - - numerr = ram_console_decode_rs8(buffer, sizeof(*buffer), par); - if (numerr > 0) { - printk(KERN_INFO "ram_console: error in header, %d\n", numerr); - ram_console_corrected_bytes += numerr; - } else if (numerr < 0) { - printk(KERN_INFO - "ram_console: uncorrectable error in header\n"); - ram_console_bad_blocks++; - } -#endif - - if (buffer->sig == RAM_CONSOLE_SIG) { - if (buffer->size > ram_console_buffer_size - || buffer->start > buffer->size) - printk(KERN_INFO "ram_console: found existing invalid " - "buffer, size %d, start %d\n", - buffer->size, buffer->start); - else { - printk(KERN_INFO "ram_console: found existing buffer, " - "size %d, start %d\n", - buffer->size, buffer->start); - ram_console_save_old(buffer, old_buf); - } - } else { - printk(KERN_INFO "ram_console: no valid data in buffer " - "(sig = 0x%08x)\n", buffer->sig); - } - - buffer->sig = RAM_CONSOLE_SIG; - buffer->start = 0; - buffer->size = 0; - - register_console(&ram_console); -#ifdef CONFIG_ANDROID_RAM_CONSOLE_ENABLE_VERBOSE - console_verbose(); -#endif - return 0; -} - -#ifdef CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT -static int __init ram_console_early_init(void) -{ - return ram_console_init((struct ram_console_buffer *) - CONFIG_ANDROID_RAM_CONSOLE_EARLY_ADDR, - CONFIG_ANDROID_RAM_CONSOLE_EARLY_SIZE, - ram_console_old_log_init_buffer); -} -#else -static int ram_console_driver_probe(struct platform_device *pdev) -{ - struct resource *res = pdev->resource; - size_t start; - size_t buffer_size; - void *buffer; - - if (res == NULL || pdev->num_resources != 1 || - !(res->flags & IORESOURCE_MEM)) { - printk(KERN_ERR "ram_console: invalid resource, %p %d flags " - "%lx\n", res, pdev->num_resources, res ? res->flags : 0); - return -ENXIO; - } - buffer_size = res->end - res->start + 1; - start = res->start; - printk(KERN_INFO "ram_console: got buffer at %zx, size %zx\n", - start, buffer_size); - buffer = ioremap(res->start, buffer_size); - if (buffer == NULL) { - printk(KERN_ERR "ram_console: failed to map memory\n"); - return -ENOMEM; - } - - return ram_console_init(buffer, buffer_size, NULL/* allocate */); -} - -static struct platform_driver ram_console_driver = { - .probe = ram_console_driver_probe, - .driver = { - .name = "ram_console", - }, -}; - -static int __init ram_console_module_init(void) -{ - int err; - err = platform_driver_register(&ram_console_driver); - return err; -} -#endif - -static ssize_t ram_console_read_old(struct file *file, char __user *buf, - size_t len, loff_t *offset) -{ - loff_t pos = *offset; - ssize_t count; - - if (pos >= ram_console_old_log_size) - return 0; - - count = min(len, (size_t)(ram_console_old_log_size - pos)); - if (copy_to_user(buf, ram_console_old_log + pos, count)) - return -EFAULT; - - *offset += count; - return count; -} - -static const struct file_operations ram_console_file_ops = { - .owner = THIS_MODULE, - .read = ram_console_read_old, -}; - -static int __init ram_console_late_init(void) -{ - struct proc_dir_entry *entry; - - if (ram_console_old_log == NULL) - return 0; -#ifdef CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT - ram_console_old_log = kmalloc(ram_console_old_log_size, GFP_KERNEL); - if (ram_console_old_log == NULL) { - printk(KERN_ERR - "ram_console: failed to allocate buffer for old log\n"); - ram_console_old_log_size = 0; - return 0; - } - memcpy(ram_console_old_log, - ram_console_old_log_init_buffer, ram_console_old_log_size); -#endif - entry = create_proc_entry("last_kmsg", S_IFREG | S_IRUGO, NULL); - if (!entry) { - printk(KERN_ERR "ram_console: failed to create proc entry\n"); - kfree(ram_console_old_log); - ram_console_old_log = NULL; - return 0; - } - - entry->proc_fops = &ram_console_file_ops; - entry->size = ram_console_old_log_size; - return 0; -} - -#ifdef CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT -console_initcall(ram_console_early_init); -#else -module_init(ram_console_module_init); -#endif -late_initcall(ram_console_late_init); - diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c deleted file mode 100644 index be7cdaa783ae..000000000000 --- a/drivers/staging/android/timed_gpio.c +++ /dev/null @@ -1,166 +0,0 @@ -/* drivers/misc/timed_gpio.c - * - * Copyright (C) 2008 Google, Inc. - * Author: Mike Lockwood - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * 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. - * - */ - -#include -#include -#include -#include -#include - -#include "timed_output.h" -#include "timed_gpio.h" - - -struct timed_gpio_data { - struct timed_output_dev dev; - struct hrtimer timer; - spinlock_t lock; - unsigned gpio; - int max_timeout; - u8 active_low; -}; - -static enum hrtimer_restart gpio_timer_func(struct hrtimer *timer) -{ - struct timed_gpio_data *data = - container_of(timer, struct timed_gpio_data, timer); - - gpio_direction_output(data->gpio, data->active_low ? 1 : 0); - return HRTIMER_NORESTART; -} - -static int gpio_get_time(struct timed_output_dev *dev) -{ - struct timed_gpio_data *data = - container_of(dev, struct timed_gpio_data, dev); - - if (hrtimer_active(&data->timer)) { - ktime_t r = hrtimer_get_remaining(&data->timer); - struct timeval t = ktime_to_timeval(r); - return t.tv_sec * 1000 + t.tv_usec / 1000; - } else - return 0; -} - -static void gpio_enable(struct timed_output_dev *dev, int value) -{ - struct timed_gpio_data *data = - container_of(dev, struct timed_gpio_data, dev); - unsigned long flags; - - spin_lock_irqsave(&data->lock, flags); - - /* cancel previous timer and set GPIO according to value */ - hrtimer_cancel(&data->timer); - gpio_direction_output(data->gpio, data->active_low ? !value : !!value); - - if (value > 0) { - if (value > data->max_timeout) - value = data->max_timeout; - - hrtimer_start(&data->timer, - ktime_set(value / 1000, (value % 1000) * 1000000), - HRTIMER_MODE_REL); - } - - spin_unlock_irqrestore(&data->lock, flags); -} - -static int timed_gpio_probe(struct platform_device *pdev) -{ - struct timed_gpio_platform_data *pdata = pdev->dev.platform_data; - struct timed_gpio *cur_gpio; - struct timed_gpio_data *gpio_data, *gpio_dat; - int i, j, ret = 0; - - if (!pdata) - return -EBUSY; - - gpio_data = kzalloc(sizeof(struct timed_gpio_data) * pdata->num_gpios, - GFP_KERNEL); - if (!gpio_data) - return -ENOMEM; - - for (i = 0; i < pdata->num_gpios; i++) { - cur_gpio = &pdata->gpios[i]; - gpio_dat = &gpio_data[i]; - - hrtimer_init(&gpio_dat->timer, CLOCK_MONOTONIC, - HRTIMER_MODE_REL); - gpio_dat->timer.function = gpio_timer_func; - spin_lock_init(&gpio_dat->lock); - - gpio_dat->dev.name = cur_gpio->name; - gpio_dat->dev.get_time = gpio_get_time; - gpio_dat->dev.enable = gpio_enable; - ret = timed_output_dev_register(&gpio_dat->dev); - if (ret < 0) { - for (j = 0; j < i; j++) - timed_output_dev_unregister(&gpio_data[i].dev); - kfree(gpio_data); - return ret; - } - - gpio_dat->gpio = cur_gpio->gpio; - gpio_dat->max_timeout = cur_gpio->max_timeout; - gpio_dat->active_low = cur_gpio->active_low; - gpio_direction_output(gpio_dat->gpio, gpio_dat->active_low); - } - - platform_set_drvdata(pdev, gpio_data); - - return 0; -} - -static int timed_gpio_remove(struct platform_device *pdev) -{ - struct timed_gpio_platform_data *pdata = pdev->dev.platform_data; - struct timed_gpio_data *gpio_data = platform_get_drvdata(pdev); - int i; - - for (i = 0; i < pdata->num_gpios; i++) - timed_output_dev_unregister(&gpio_data[i].dev); - - kfree(gpio_data); - - return 0; -} - -static struct platform_driver timed_gpio_driver = { - .probe = timed_gpio_probe, - .remove = timed_gpio_remove, - .driver = { - .name = TIMED_GPIO_NAME, - .owner = THIS_MODULE, - }, -}; - -static int __init timed_gpio_init(void) -{ - return platform_driver_register(&timed_gpio_driver); -} - -static void __exit timed_gpio_exit(void) -{ - platform_driver_unregister(&timed_gpio_driver); -} - -module_init(timed_gpio_init); -module_exit(timed_gpio_exit); - -MODULE_AUTHOR("Mike Lockwood "); -MODULE_DESCRIPTION("timed gpio driver"); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/android/timed_gpio.h b/drivers/staging/android/timed_gpio.h deleted file mode 100644 index a0e15f8be3f7..000000000000 --- a/drivers/staging/android/timed_gpio.h +++ /dev/null @@ -1,33 +0,0 @@ -/* include/linux/timed_gpio.h - * - * Copyright (C) 2008 Google, Inc. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * 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. - * -*/ - -#ifndef _LINUX_TIMED_GPIO_H -#define _LINUX_TIMED_GPIO_H - -#define TIMED_GPIO_NAME "timed-gpio" - -struct timed_gpio { - const char *name; - unsigned gpio; - int max_timeout; - u8 active_low; -}; - -struct timed_gpio_platform_data { - int num_gpios; - struct timed_gpio *gpios; -}; - -#endif diff --git a/drivers/staging/android/timed_output.c b/drivers/staging/android/timed_output.c deleted file mode 100644 index 62e79180421b..000000000000 --- a/drivers/staging/android/timed_output.c +++ /dev/null @@ -1,121 +0,0 @@ -/* drivers/misc/timed_output.c - * - * Copyright (C) 2009 Google, Inc. - * Author: Mike Lockwood - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * 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. - * - */ - -#include -#include -#include -#include -#include - -#include "timed_output.h" - -static struct class *timed_output_class; -static atomic_t device_count; - -static ssize_t enable_show(struct device *dev, struct device_attribute *attr, - char *buf) -{ - struct timed_output_dev *tdev = dev_get_drvdata(dev); - int remaining = tdev->get_time(tdev); - - return sprintf(buf, "%d\n", remaining); -} - -static ssize_t enable_store( - struct device *dev, struct device_attribute *attr, - const char *buf, size_t size) -{ - struct timed_output_dev *tdev = dev_get_drvdata(dev); - int value; - - sscanf(buf, "%d", &value); - tdev->enable(tdev, value); - - return size; -} - -static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, enable_show, enable_store); - -static int create_timed_output_class(void) -{ - if (!timed_output_class) { - timed_output_class = class_create(THIS_MODULE, "timed_output"); - if (IS_ERR(timed_output_class)) - return PTR_ERR(timed_output_class); - atomic_set(&device_count, 0); - } - - return 0; -} - -int timed_output_dev_register(struct timed_output_dev *tdev) -{ - int ret; - - if (!tdev || !tdev->name || !tdev->enable || !tdev->get_time) - return -EINVAL; - - ret = create_timed_output_class(); - if (ret < 0) - return ret; - - tdev->index = atomic_inc_return(&device_count); - tdev->dev = device_create(timed_output_class, NULL, - MKDEV(0, tdev->index), NULL, tdev->name); - if (IS_ERR(tdev->dev)) - return PTR_ERR(tdev->dev); - - ret = device_create_file(tdev->dev, &dev_attr_enable); - if (ret < 0) - goto err_create_file; - - dev_set_drvdata(tdev->dev, tdev); - tdev->state = 0; - return 0; - -err_create_file: - device_destroy(timed_output_class, MKDEV(0, tdev->index)); - printk(KERN_ERR "timed_output: Failed to register driver %s\n", - tdev->name); - - return ret; -} -EXPORT_SYMBOL_GPL(timed_output_dev_register); - -void timed_output_dev_unregister(struct timed_output_dev *tdev) -{ - device_remove_file(tdev->dev, &dev_attr_enable); - device_destroy(timed_output_class, MKDEV(0, tdev->index)); - dev_set_drvdata(tdev->dev, NULL); -} -EXPORT_SYMBOL_GPL(timed_output_dev_unregister); - -static int __init timed_output_init(void) -{ - return create_timed_output_class(); -} - -static void __exit timed_output_exit(void) -{ - class_destroy(timed_output_class); -} - -module_init(timed_output_init); -module_exit(timed_output_exit); - -MODULE_AUTHOR("Mike Lockwood "); -MODULE_DESCRIPTION("timed output class driver"); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/android/timed_output.h b/drivers/staging/android/timed_output.h deleted file mode 100644 index ec907ab2ff54..000000000000 --- a/drivers/staging/android/timed_output.h +++ /dev/null @@ -1,37 +0,0 @@ -/* include/linux/timed_output.h - * - * Copyright (C) 2008 Google, Inc. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * 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. - * -*/ - -#ifndef _LINUX_TIMED_OUTPUT_H -#define _LINUX_TIMED_OUTPUT_H - -struct timed_output_dev { - const char *name; - - /* enable the output and set the timer */ - void (*enable)(struct timed_output_dev *sdev, int timeout); - - /* returns the current number of milliseconds remaining on the timer */ - int (*get_time)(struct timed_output_dev *sdev); - - /* private data */ - struct device *dev; - int index; - int state; -}; - -extern int timed_output_dev_register(struct timed_output_dev *dev); -extern void timed_output_dev_unregister(struct timed_output_dev *dev); - -#endif -- GitLab From 7e9bdd0af0fe0b940ff59f4b57c463d63969852b Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Wed, 28 Oct 2009 23:48:18 +0100 Subject: [PATCH 220/235] Staging: dream: add TODO file This adds TODO list. It is probably incomplete, as many parts were not reviewed by the upstream maintainers, yet. Signed-off-by: Pavel Machek Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dream/TODO | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 drivers/staging/dream/TODO diff --git a/drivers/staging/dream/TODO b/drivers/staging/dream/TODO new file mode 100644 index 000000000000..c07c8803f07c --- /dev/null +++ b/drivers/staging/dream/TODO @@ -0,0 +1,14 @@ +* remove support for wakelocks since those are not in mainline + +* camera driver uses old V4L API + +* coding style in some places is lacking + +* gpio_input.c has some features matrix_keypad lacks. They should be +merged to gpio_input, with gpio_input.c removed + +* pmem provides interface for userspace. Needs to be reviewed at least. + +* it is probably possible to simplify touchscreen driver using threaded_irq's. + +* touchscreen driver should be switched to oficial multitouch API -- GitLab From 9b8437574759a4ce165ab20c631cd6e14c3148c2 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Sun, 1 Nov 2009 23:27:01 +0100 Subject: [PATCH 221/235] Staging: dream: add gpio and pmem support This adds generic_gpio and pmem support, both are needed for other dream drivers. Signed-off-by: Pavel Machek Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dream/generic_gpio.c | 274 ++++++ drivers/staging/dream/pmem.c | 1335 ++++++++++++++++++++++++++ 2 files changed, 1609 insertions(+) create mode 100644 drivers/staging/dream/generic_gpio.c create mode 100644 drivers/staging/dream/pmem.c diff --git a/drivers/staging/dream/generic_gpio.c b/drivers/staging/dream/generic_gpio.c new file mode 100644 index 000000000000..fe24d38345d0 --- /dev/null +++ b/drivers/staging/dream/generic_gpio.c @@ -0,0 +1,274 @@ +/* arch/arm/mach-msm/generic_gpio.c + * + * Copyright (C) 2007 Google, Inc. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * 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. + * + */ + +#include +#include +#include +#include +#include +#include +#include "gpio_chip.h" + +#define GPIO_NUM_TO_CHIP_INDEX(gpio) ((gpio)>>5) + +struct gpio_state { + unsigned long flags; + int refcount; +}; + +static DEFINE_SPINLOCK(gpio_chips_lock); +static LIST_HEAD(gpio_chip_list); +static struct gpio_chip **gpio_chip_array; +static unsigned long gpio_chip_array_size; + +int register_gpio_chip(struct gpio_chip *new_gpio_chip) +{ + int err = 0; + struct gpio_chip *gpio_chip; + int i; + unsigned long irq_flags; + unsigned int chip_array_start_index, chip_array_end_index; + + new_gpio_chip->state = kzalloc((new_gpio_chip->end + 1 - new_gpio_chip->start) * sizeof(new_gpio_chip->state[0]), GFP_KERNEL); + if (new_gpio_chip->state == NULL) { + printk(KERN_ERR "register_gpio_chip: failed to allocate state\n"); + return -ENOMEM; + } + + spin_lock_irqsave(&gpio_chips_lock, irq_flags); + chip_array_start_index = GPIO_NUM_TO_CHIP_INDEX(new_gpio_chip->start); + chip_array_end_index = GPIO_NUM_TO_CHIP_INDEX(new_gpio_chip->end); + if (chip_array_end_index >= gpio_chip_array_size) { + struct gpio_chip **new_gpio_chip_array; + unsigned long new_gpio_chip_array_size = chip_array_end_index + 1; + + new_gpio_chip_array = kmalloc(new_gpio_chip_array_size * sizeof(new_gpio_chip_array[0]), GFP_ATOMIC); + if (new_gpio_chip_array == NULL) { + printk(KERN_ERR "register_gpio_chip: failed to allocate array\n"); + err = -ENOMEM; + goto failed; + } + for (i = 0; i < gpio_chip_array_size; i++) + new_gpio_chip_array[i] = gpio_chip_array[i]; + for (i = gpio_chip_array_size; i < new_gpio_chip_array_size; i++) + new_gpio_chip_array[i] = NULL; + gpio_chip_array = new_gpio_chip_array; + gpio_chip_array_size = new_gpio_chip_array_size; + } + list_for_each_entry(gpio_chip, &gpio_chip_list, list) { + if (gpio_chip->start > new_gpio_chip->end) { + list_add_tail(&new_gpio_chip->list, &gpio_chip->list); + goto added; + } + if (gpio_chip->end >= new_gpio_chip->start) { + printk(KERN_ERR "register_gpio_source %u-%u overlaps with %u-%u\n", + new_gpio_chip->start, new_gpio_chip->end, + gpio_chip->start, gpio_chip->end); + err = -EBUSY; + goto failed; + } + } + list_add_tail(&new_gpio_chip->list, &gpio_chip_list); +added: + for (i = chip_array_start_index; i <= chip_array_end_index; i++) { + if (gpio_chip_array[i] == NULL || gpio_chip_array[i]->start > new_gpio_chip->start) + gpio_chip_array[i] = new_gpio_chip; + } +failed: + spin_unlock_irqrestore(&gpio_chips_lock, irq_flags); + if (err) + kfree(new_gpio_chip->state); + return err; +} + +static struct gpio_chip *get_gpio_chip_locked(unsigned int gpio) +{ + unsigned long i; + struct gpio_chip *chip; + + i = GPIO_NUM_TO_CHIP_INDEX(gpio); + if (i >= gpio_chip_array_size) + return NULL; + chip = gpio_chip_array[i]; + if (chip == NULL) + return NULL; + list_for_each_entry_from(chip, &gpio_chip_list, list) { + if (gpio < chip->start) + return NULL; + if (gpio <= chip->end) + return chip; + } + return NULL; +} + +static int request_gpio(unsigned int gpio, unsigned long flags) +{ + int err = 0; + struct gpio_chip *chip; + unsigned long irq_flags; + unsigned long chip_index; + + spin_lock_irqsave(&gpio_chips_lock, irq_flags); + chip = get_gpio_chip_locked(gpio); + if (chip == NULL) { + err = -EINVAL; + goto err; + } + chip_index = gpio - chip->start; + if (chip->state[chip_index].refcount == 0) { + chip->configure(chip, gpio, flags); + chip->state[chip_index].flags = flags; + chip->state[chip_index].refcount++; + } else if ((flags & IRQF_SHARED) && (chip->state[chip_index].flags & IRQF_SHARED)) + chip->state[chip_index].refcount++; + else + err = -EBUSY; +err: + spin_unlock_irqrestore(&gpio_chips_lock, irq_flags); + return err; +} + +int gpio_request(unsigned gpio, const char *label) +{ + return request_gpio(gpio, 0); +} +EXPORT_SYMBOL(gpio_request); + +void gpio_free(unsigned gpio) +{ + struct gpio_chip *chip; + unsigned long irq_flags; + unsigned long chip_index; + + spin_lock_irqsave(&gpio_chips_lock, irq_flags); + chip = get_gpio_chip_locked(gpio); + if (chip) { + chip_index = gpio - chip->start; + chip->state[chip_index].refcount--; + } + spin_unlock_irqrestore(&gpio_chips_lock, irq_flags); +} +EXPORT_SYMBOL(gpio_free); + +static int gpio_get_irq_num(unsigned int gpio, unsigned int *irqp, unsigned long *irqnumflagsp) +{ + int ret = -ENOTSUPP; + struct gpio_chip *chip; + unsigned long irq_flags; + + spin_lock_irqsave(&gpio_chips_lock, irq_flags); + chip = get_gpio_chip_locked(gpio); + if (chip && chip->get_irq_num) + ret = chip->get_irq_num(chip, gpio, irqp, irqnumflagsp); + spin_unlock_irqrestore(&gpio_chips_lock, irq_flags); + return ret; +} + +int gpio_to_irq(unsigned gpio) +{ + int ret, irq; + ret = gpio_get_irq_num(gpio, &irq, NULL); + if (ret) + return ret; + return irq; +} +EXPORT_SYMBOL(gpio_to_irq); + +int gpio_configure(unsigned int gpio, unsigned long flags) +{ + int ret = -ENOTSUPP; + struct gpio_chip *chip; + unsigned long irq_flags; + + spin_lock_irqsave(&gpio_chips_lock, irq_flags); + chip = get_gpio_chip_locked(gpio); + if (chip) + ret = chip->configure(chip, gpio, flags); + spin_unlock_irqrestore(&gpio_chips_lock, irq_flags); + return ret; +} +EXPORT_SYMBOL(gpio_configure); + +int gpio_direction_input(unsigned gpio) +{ + return gpio_configure(gpio, GPIOF_INPUT); +} +EXPORT_SYMBOL(gpio_direction_input); + +int gpio_direction_output(unsigned gpio, int value) +{ + gpio_set_value(gpio, value); + return gpio_configure(gpio, GPIOF_DRIVE_OUTPUT); +} +EXPORT_SYMBOL(gpio_direction_output); + +int gpio_get_value(unsigned gpio) +{ + int ret = -ENOTSUPP; + struct gpio_chip *chip; + unsigned long irq_flags; + + spin_lock_irqsave(&gpio_chips_lock, irq_flags); + chip = get_gpio_chip_locked(gpio); + if (chip && chip->read) + ret = chip->read(chip, gpio); + spin_unlock_irqrestore(&gpio_chips_lock, irq_flags); + return ret; +} +EXPORT_SYMBOL(gpio_get_value); + +void gpio_set_value(unsigned gpio, int on) +{ + int ret = -ENOTSUPP; + struct gpio_chip *chip; + unsigned long irq_flags; + + spin_lock_irqsave(&gpio_chips_lock, irq_flags); + chip = get_gpio_chip_locked(gpio); + if (chip && chip->write) + ret = chip->write(chip, gpio, on); + spin_unlock_irqrestore(&gpio_chips_lock, irq_flags); +} +EXPORT_SYMBOL(gpio_set_value); + +int gpio_read_detect_status(unsigned int gpio) +{ + int ret = -ENOTSUPP; + struct gpio_chip *chip; + unsigned long irq_flags; + + spin_lock_irqsave(&gpio_chips_lock, irq_flags); + chip = get_gpio_chip_locked(gpio); + if (chip && chip->read_detect_status) + ret = chip->read_detect_status(chip, gpio); + spin_unlock_irqrestore(&gpio_chips_lock, irq_flags); + return ret; +} +EXPORT_SYMBOL(gpio_read_detect_status); + +int gpio_clear_detect_status(unsigned int gpio) +{ + int ret = -ENOTSUPP; + struct gpio_chip *chip; + unsigned long irq_flags; + + spin_lock_irqsave(&gpio_chips_lock, irq_flags); + chip = get_gpio_chip_locked(gpio); + if (chip && chip->clear_detect_status) + ret = chip->clear_detect_status(chip, gpio); + spin_unlock_irqrestore(&gpio_chips_lock, irq_flags); + return ret; +} +EXPORT_SYMBOL(gpio_clear_detect_status); diff --git a/drivers/staging/dream/pmem.c b/drivers/staging/dream/pmem.c new file mode 100644 index 000000000000..def646812348 --- /dev/null +++ b/drivers/staging/dream/pmem.c @@ -0,0 +1,1335 @@ +/* drivers/android/pmem.c + * + * Copyright (C) 2007 Google, Inc. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * 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. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PMEM_MAX_DEVICES 10 +#define PMEM_MAX_ORDER 128 +#define PMEM_MIN_ALLOC PAGE_SIZE + +#define PMEM_DEBUG 1 + +/* indicates that a refernce to this file has been taken via get_pmem_file, + * the file should not be released until put_pmem_file is called */ +#define PMEM_FLAGS_BUSY 0x1 +/* indicates that this is a suballocation of a larger master range */ +#define PMEM_FLAGS_CONNECTED 0x1 << 1 +/* indicates this is a master and not a sub allocation and that it is mmaped */ +#define PMEM_FLAGS_MASTERMAP 0x1 << 2 +/* submap and unsubmap flags indicate: + * 00: subregion has never been mmaped + * 10: subregion has been mmaped, reference to the mm was taken + * 11: subretion has ben released, refernece to the mm still held + * 01: subretion has been released, reference to the mm has been released + */ +#define PMEM_FLAGS_SUBMAP 0x1 << 3 +#define PMEM_FLAGS_UNSUBMAP 0x1 << 4 + + +struct pmem_data { + /* in alloc mode: an index into the bitmap + * in no_alloc mode: the size of the allocation */ + int index; + /* see flags above for descriptions */ + unsigned int flags; + /* protects this data field, if the mm_mmap sem will be held at the + * same time as this sem, the mm sem must be taken first (as this is + * the order for vma_open and vma_close ops */ + struct rw_semaphore sem; + /* info about the mmaping process */ + struct vm_area_struct *vma; + /* task struct of the mapping process */ + struct task_struct *task; + /* process id of teh mapping process */ + pid_t pid; + /* file descriptor of the master */ + int master_fd; + /* file struct of the master */ + struct file *master_file; + /* a list of currently available regions if this is a suballocation */ + struct list_head region_list; + /* a linked list of data so we can access them for debugging */ + struct list_head list; +#if PMEM_DEBUG + int ref; +#endif +}; + +struct pmem_bits { + unsigned allocated:1; /* 1 if allocated, 0 if free */ + unsigned order:7; /* size of the region in pmem space */ +}; + +struct pmem_region_node { + struct pmem_region region; + struct list_head list; +}; + +#define PMEM_DEBUG_MSGS 0 +#if PMEM_DEBUG_MSGS +#define DLOG(fmt,args...) \ + do { printk(KERN_INFO "[%s:%s:%d] "fmt, __FILE__, __func__, __LINE__, \ + ##args); } \ + while (0) +#else +#define DLOG(x...) do {} while (0) +#endif + +struct pmem_info { + struct miscdevice dev; + /* physical start address of the remaped pmem space */ + unsigned long base; + /* vitual start address of the remaped pmem space */ + unsigned char __iomem *vbase; + /* total size of the pmem space */ + unsigned long size; + /* number of entries in the pmem space */ + unsigned long num_entries; + /* pfn of the garbage page in memory */ + unsigned long garbage_pfn; + /* index of the garbage page in the pmem space */ + int garbage_index; + /* the bitmap for the region indicating which entries are allocated + * and which are free */ + struct pmem_bits *bitmap; + /* indicates the region should not be managed with an allocator */ + unsigned no_allocator; + /* indicates maps of this region should be cached, if a mix of + * cached and uncached is desired, set this and open the device with + * O_SYNC to get an uncached region */ + unsigned cached; + unsigned buffered; + /* in no_allocator mode the first mapper gets the whole space and sets + * this flag */ + unsigned allocated; + /* for debugging, creates a list of pmem file structs, the + * data_list_sem should be taken before pmem_data->sem if both are + * needed */ + struct semaphore data_list_sem; + struct list_head data_list; + /* pmem_sem protects the bitmap array + * a write lock should be held when modifying entries in bitmap + * a read lock should be held when reading data from bits or + * dereferencing a pointer into bitmap + * + * pmem_data->sem protects the pmem data of a particular file + * Many of the function that require the pmem_data->sem have a non- + * locking version for when the caller is already holding that sem. + * + * IF YOU TAKE BOTH LOCKS TAKE THEM IN THIS ORDER: + * down(pmem_data->sem) => down(bitmap_sem) + */ + struct rw_semaphore bitmap_sem; + + long (*ioctl)(struct file *, unsigned int, unsigned long); + int (*release)(struct inode *, struct file *); +}; + +static struct pmem_info pmem[PMEM_MAX_DEVICES]; +static int id_count; + +#define PMEM_IS_FREE(id, index) !(pmem[id].bitmap[index].allocated) +#define PMEM_ORDER(id, index) pmem[id].bitmap[index].order +#define PMEM_BUDDY_INDEX(id, index) (index ^ (1 << PMEM_ORDER(id, index))) +#define PMEM_NEXT_INDEX(id, index) (index + (1 << PMEM_ORDER(id, index))) +#define PMEM_OFFSET(index) (index * PMEM_MIN_ALLOC) +#define PMEM_START_ADDR(id, index) (PMEM_OFFSET(index) + pmem[id].base) +#define PMEM_LEN(id, index) ((1 << PMEM_ORDER(id, index)) * PMEM_MIN_ALLOC) +#define PMEM_END_ADDR(id, index) (PMEM_START_ADDR(id, index) + \ + PMEM_LEN(id, index)) +#define PMEM_START_VADDR(id, index) (PMEM_OFFSET(id, index) + pmem[id].vbase) +#define PMEM_END_VADDR(id, index) (PMEM_START_VADDR(id, index) + \ + PMEM_LEN(id, index)) +#define PMEM_REVOKED(data) (data->flags & PMEM_FLAGS_REVOKED) +#define PMEM_IS_PAGE_ALIGNED(addr) (!((addr) & (~PAGE_MASK))) +#define PMEM_IS_SUBMAP(data) ((data->flags & PMEM_FLAGS_SUBMAP) && \ + (!(data->flags & PMEM_FLAGS_UNSUBMAP))) + +static int pmem_release(struct inode *, struct file *); +static int pmem_mmap(struct file *, struct vm_area_struct *); +static int pmem_open(struct inode *, struct file *); +static long pmem_ioctl(struct file *, unsigned int, unsigned long); + +struct file_operations pmem_fops = { + .release = pmem_release, + .mmap = pmem_mmap, + .open = pmem_open, + .unlocked_ioctl = pmem_ioctl, +}; + +static int get_id(struct file *file) +{ + return MINOR(file->f_dentry->d_inode->i_rdev); +} + +static int is_pmem_file(struct file *file) +{ + int id; + + if (unlikely(!file || !file->f_dentry || !file->f_dentry->d_inode)) + return 0; + id = get_id(file); + if (unlikely(id >= PMEM_MAX_DEVICES)) + return 0; + if (unlikely(file->f_dentry->d_inode->i_rdev != + MKDEV(MISC_MAJOR, pmem[id].dev.minor))) + return 0; + return 1; +} + +static int has_allocation(struct file *file) +{ + struct pmem_data *data; + /* check is_pmem_file first if not accessed via pmem_file_ops */ + + if (unlikely(!file->private_data)) + return 0; + data = (struct pmem_data *)file->private_data; + if (unlikely(data->index < 0)) + return 0; + return 1; +} + +static int is_master_owner(struct file *file) +{ + struct file *master_file; + struct pmem_data *data; + int put_needed, ret = 0; + + if (!is_pmem_file(file) || !has_allocation(file)) + return 0; + data = (struct pmem_data *)file->private_data; + if (PMEM_FLAGS_MASTERMAP & data->flags) + return 1; + master_file = fget_light(data->master_fd, &put_needed); + if (master_file && data->master_file == master_file) + ret = 1; + fput_light(master_file, put_needed); + return ret; +} + +static int pmem_free(int id, int index) +{ + /* caller should hold the write lock on pmem_sem! */ + int buddy, curr = index; + DLOG("index %d\n", index); + + if (pmem[id].no_allocator) { + pmem[id].allocated = 0; + return 0; + } + /* clean up the bitmap, merging any buddies */ + pmem[id].bitmap[curr].allocated = 0; + /* find a slots buddy Buddy# = Slot# ^ (1 << order) + * if the buddy is also free merge them + * repeat until the buddy is not free or end of the bitmap is reached + */ + do { + buddy = PMEM_BUDDY_INDEX(id, curr); + if (PMEM_IS_FREE(id, buddy) && + PMEM_ORDER(id, buddy) == PMEM_ORDER(id, curr)) { + PMEM_ORDER(id, buddy)++; + PMEM_ORDER(id, curr)++; + curr = min(buddy, curr); + } else { + break; + } + } while (curr < pmem[id].num_entries); + + return 0; +} + +static void pmem_revoke(struct file *file, struct pmem_data *data); + +static int pmem_release(struct inode *inode, struct file *file) +{ + struct pmem_data *data = (struct pmem_data *)file->private_data; + struct pmem_region_node *region_node; + struct list_head *elt, *elt2; + int id = get_id(file), ret = 0; + + + down(&pmem[id].data_list_sem); + /* if this file is a master, revoke all the memory in the connected + * files */ + if (PMEM_FLAGS_MASTERMAP & data->flags) { + struct pmem_data *sub_data; + list_for_each(elt, &pmem[id].data_list) { + sub_data = list_entry(elt, struct pmem_data, list); + down_read(&sub_data->sem); + if (PMEM_IS_SUBMAP(sub_data) && + file == sub_data->master_file) { + up_read(&sub_data->sem); + pmem_revoke(file, sub_data); + } else + up_read(&sub_data->sem); + } + } + list_del(&data->list); + up(&pmem[id].data_list_sem); + + + down_write(&data->sem); + + /* if its not a conencted file and it has an allocation, free it */ + if (!(PMEM_FLAGS_CONNECTED & data->flags) && has_allocation(file)) { + down_write(&pmem[id].bitmap_sem); + ret = pmem_free(id, data->index); + up_write(&pmem[id].bitmap_sem); + } + + /* if this file is a submap (mapped, connected file), downref the + * task struct */ + if (PMEM_FLAGS_SUBMAP & data->flags) + if (data->task) { + put_task_struct(data->task); + data->task = NULL; + } + + file->private_data = NULL; + + list_for_each_safe(elt, elt2, &data->region_list) { + region_node = list_entry(elt, struct pmem_region_node, list); + list_del(elt); + kfree(region_node); + } + BUG_ON(!list_empty(&data->region_list)); + + up_write(&data->sem); + kfree(data); + if (pmem[id].release) + ret = pmem[id].release(inode, file); + + return ret; +} + +static int pmem_open(struct inode *inode, struct file *file) +{ + struct pmem_data *data; + int id = get_id(file); + int ret = 0; + + DLOG("current %u file %p(%d)\n", current->pid, file, file_count(file)); + /* setup file->private_data to indicate its unmapped */ + /* you can only open a pmem device one time */ + if (file->private_data != NULL) + return -1; + data = kmalloc(sizeof(struct pmem_data), GFP_KERNEL); + if (!data) { + printk("pmem: unable to allocate memory for pmem metadata."); + return -1; + } + data->flags = 0; + data->index = -1; + data->task = NULL; + data->vma = NULL; + data->pid = 0; + data->master_file = NULL; +#if PMEM_DEBUG + data->ref = 0; +#endif + INIT_LIST_HEAD(&data->region_list); + init_rwsem(&data->sem); + + file->private_data = data; + INIT_LIST_HEAD(&data->list); + + down(&pmem[id].data_list_sem); + list_add(&data->list, &pmem[id].data_list); + up(&pmem[id].data_list_sem); + return ret; +} + +static unsigned long pmem_order(unsigned long len) +{ + int i; + + len = (len + PMEM_MIN_ALLOC - 1)/PMEM_MIN_ALLOC; + len--; + for (i = 0; i < sizeof(len)*8; i++) + if (len >> i == 0) + break; + return i; +} + +static int pmem_allocate(int id, unsigned long len) +{ + /* caller should hold the write lock on pmem_sem! */ + /* return the corresponding pdata[] entry */ + int curr = 0; + int end = pmem[id].num_entries; + int best_fit = -1; + unsigned long order = pmem_order(len); + + if (pmem[id].no_allocator) { + DLOG("no allocator"); + if ((len > pmem[id].size) || pmem[id].allocated) + return -1; + pmem[id].allocated = 1; + return len; + } + + if (order > PMEM_MAX_ORDER) + return -1; + DLOG("order %lx\n", order); + + /* look through the bitmap: + * if you find a free slot of the correct order use it + * otherwise, use the best fit (smallest with size > order) slot + */ + while (curr < end) { + if (PMEM_IS_FREE(id, curr)) { + if (PMEM_ORDER(id, curr) == (unsigned char)order) { + /* set the not free bit and clear others */ + best_fit = curr; + break; + } + if (PMEM_ORDER(id, curr) > (unsigned char)order && + (best_fit < 0 || + PMEM_ORDER(id, curr) < PMEM_ORDER(id, best_fit))) + best_fit = curr; + } + curr = PMEM_NEXT_INDEX(id, curr); + } + + /* if best_fit < 0, there are no suitable slots, + * return an error + */ + if (best_fit < 0) { + printk("pmem: no space left to allocate!\n"); + return -1; + } + + /* now partition the best fit: + * split the slot into 2 buddies of order - 1 + * repeat until the slot is of the correct order + */ + while (PMEM_ORDER(id, best_fit) > (unsigned char)order) { + int buddy; + PMEM_ORDER(id, best_fit) -= 1; + buddy = PMEM_BUDDY_INDEX(id, best_fit); + PMEM_ORDER(id, buddy) = PMEM_ORDER(id, best_fit); + } + pmem[id].bitmap[best_fit].allocated = 1; + return best_fit; +} + +static pgprot_t phys_mem_access_prot(struct file *file, pgprot_t vma_prot) +{ + int id = get_id(file); +#ifdef pgprot_noncached + if (pmem[id].cached == 0 || file->f_flags & O_SYNC) + return pgprot_noncached(vma_prot); +#endif +#ifdef pgprot_ext_buffered + else if (pmem[id].buffered) + return pgprot_ext_buffered(vma_prot); +#endif + return vma_prot; +} + +static unsigned long pmem_start_addr(int id, struct pmem_data *data) +{ + if (pmem[id].no_allocator) + return PMEM_START_ADDR(id, 0); + else + return PMEM_START_ADDR(id, data->index); + +} + +static void *pmem_start_vaddr(int id, struct pmem_data *data) +{ + return pmem_start_addr(id, data) - pmem[id].base + pmem[id].vbase; +} + +static unsigned long pmem_len(int id, struct pmem_data *data) +{ + if (pmem[id].no_allocator) + return data->index; + else + return PMEM_LEN(id, data->index); +} + +static int pmem_map_garbage(int id, struct vm_area_struct *vma, + struct pmem_data *data, unsigned long offset, + unsigned long len) +{ + int i, garbage_pages = len >> PAGE_SHIFT; + + vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP | VM_SHARED | VM_WRITE; + for (i = 0; i < garbage_pages; i++) { + if (vm_insert_pfn(vma, vma->vm_start + offset + (i * PAGE_SIZE), + pmem[id].garbage_pfn)) + return -EAGAIN; + } + return 0; +} + +static int pmem_unmap_pfn_range(int id, struct vm_area_struct *vma, + struct pmem_data *data, unsigned long offset, + unsigned long len) +{ + int garbage_pages; + DLOG("unmap offset %lx len %lx\n", offset, len); + + BUG_ON(!PMEM_IS_PAGE_ALIGNED(len)); + + garbage_pages = len >> PAGE_SHIFT; + zap_page_range(vma, vma->vm_start + offset, len, NULL); + pmem_map_garbage(id, vma, data, offset, len); + return 0; +} + +static int pmem_map_pfn_range(int id, struct vm_area_struct *vma, + struct pmem_data *data, unsigned long offset, + unsigned long len) +{ + DLOG("map offset %lx len %lx\n", offset, len); + BUG_ON(!PMEM_IS_PAGE_ALIGNED(vma->vm_start)); + BUG_ON(!PMEM_IS_PAGE_ALIGNED(vma->vm_end)); + BUG_ON(!PMEM_IS_PAGE_ALIGNED(len)); + BUG_ON(!PMEM_IS_PAGE_ALIGNED(offset)); + + if (io_remap_pfn_range(vma, vma->vm_start + offset, + (pmem_start_addr(id, data) + offset) >> PAGE_SHIFT, + len, vma->vm_page_prot)) { + return -EAGAIN; + } + return 0; +} + +static int pmem_remap_pfn_range(int id, struct vm_area_struct *vma, + struct pmem_data *data, unsigned long offset, + unsigned long len) +{ + /* hold the mm semp for the vma you are modifying when you call this */ + BUG_ON(!vma); + zap_page_range(vma, vma->vm_start + offset, len, NULL); + return pmem_map_pfn_range(id, vma, data, offset, len); +} + +static void pmem_vma_open(struct vm_area_struct *vma) +{ + struct file *file = vma->vm_file; + struct pmem_data *data = file->private_data; + int id = get_id(file); + /* this should never be called as we don't support copying pmem + * ranges via fork */ + BUG_ON(!has_allocation(file)); + down_write(&data->sem); + /* remap the garbage pages, forkers don't get access to the data */ + pmem_unmap_pfn_range(id, vma, data, 0, vma->vm_start - vma->vm_end); + up_write(&data->sem); +} + +static void pmem_vma_close(struct vm_area_struct *vma) +{ + struct file *file = vma->vm_file; + struct pmem_data *data = file->private_data; + + DLOG("current %u ppid %u file %p count %d\n", current->pid, + current->parent->pid, file, file_count(file)); + if (unlikely(!is_pmem_file(file) || !has_allocation(file))) { + printk(KERN_WARNING "pmem: something is very wrong, you are " + "closing a vm backing an allocation that doesn't " + "exist!\n"); + return; + } + down_write(&data->sem); + if (data->vma == vma) { + data->vma = NULL; + if ((data->flags & PMEM_FLAGS_CONNECTED) && + (data->flags & PMEM_FLAGS_SUBMAP)) + data->flags |= PMEM_FLAGS_UNSUBMAP; + } + /* the kernel is going to free this vma now anyway */ + up_write(&data->sem); +} + +static struct vm_operations_struct vm_ops = { + .open = pmem_vma_open, + .close = pmem_vma_close, +}; + +static int pmem_mmap(struct file *file, struct vm_area_struct *vma) +{ + struct pmem_data *data; + int index; + unsigned long vma_size = vma->vm_end - vma->vm_start; + int ret = 0, id = get_id(file); + + if (vma->vm_pgoff || !PMEM_IS_PAGE_ALIGNED(vma_size)) { +#if PMEM_DEBUG + printk(KERN_ERR "pmem: mmaps must be at offset zero, aligned" + " and a multiple of pages_size.\n"); +#endif + return -EINVAL; + } + + data = (struct pmem_data *)file->private_data; + down_write(&data->sem); + /* check this file isn't already mmaped, for submaps check this file + * has never been mmaped */ + if ((data->flags & PMEM_FLAGS_MASTERMAP) || + (data->flags & PMEM_FLAGS_SUBMAP) || + (data->flags & PMEM_FLAGS_UNSUBMAP)) { +#if PMEM_DEBUG + printk(KERN_ERR "pmem: you can only mmap a pmem file once, " + "this file is already mmaped. %x\n", data->flags); +#endif + ret = -EINVAL; + goto error; + } + /* if file->private_data == unalloced, alloc*/ + if (data && data->index == -1) { + down_write(&pmem[id].bitmap_sem); + index = pmem_allocate(id, vma->vm_end - vma->vm_start); + up_write(&pmem[id].bitmap_sem); + data->index = index; + } + /* either no space was available or an error occured */ + if (!has_allocation(file)) { + ret = -EINVAL; + printk("pmem: could not find allocation for map.\n"); + goto error; + } + + if (pmem_len(id, data) < vma_size) { +#if PMEM_DEBUG + printk(KERN_WARNING "pmem: mmap size [%lu] does not match" + "size of backing region [%lu].\n", vma_size, + pmem_len(id, data)); +#endif + ret = -EINVAL; + goto error; + } + + vma->vm_pgoff = pmem_start_addr(id, data) >> PAGE_SHIFT; + vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_page_prot); + + if (data->flags & PMEM_FLAGS_CONNECTED) { + struct pmem_region_node *region_node; + struct list_head *elt; + if (pmem_map_garbage(id, vma, data, 0, vma_size)) { + printk("pmem: mmap failed in kernel!\n"); + ret = -EAGAIN; + goto error; + } + list_for_each(elt, &data->region_list) { + region_node = list_entry(elt, struct pmem_region_node, + list); + DLOG("remapping file: %p %lx %lx\n", file, + region_node->region.offset, + region_node->region.len); + if (pmem_remap_pfn_range(id, vma, data, + region_node->region.offset, + region_node->region.len)) { + ret = -EAGAIN; + goto error; + } + } + data->flags |= PMEM_FLAGS_SUBMAP; + get_task_struct(current->group_leader); + data->task = current->group_leader; + data->vma = vma; +#if PMEM_DEBUG + data->pid = current->pid; +#endif + DLOG("submmapped file %p vma %p pid %u\n", file, vma, + current->pid); + } else { + if (pmem_map_pfn_range(id, vma, data, 0, vma_size)) { + printk(KERN_INFO "pmem: mmap failed in kernel!\n"); + ret = -EAGAIN; + goto error; + } + data->flags |= PMEM_FLAGS_MASTERMAP; + data->pid = current->pid; + } + vma->vm_ops = &vm_ops; +error: + up_write(&data->sem); + return ret; +} + +/* the following are the api for accessing pmem regions by other drivers + * from inside the kernel */ +int get_pmem_user_addr(struct file *file, unsigned long *start, + unsigned long *len) +{ + struct pmem_data *data; + if (!is_pmem_file(file) || !has_allocation(file)) { +#if PMEM_DEBUG + printk(KERN_INFO "pmem: requested pmem data from invalid" + "file.\n"); +#endif + return -1; + } + data = (struct pmem_data *)file->private_data; + down_read(&data->sem); + if (data->vma) { + *start = data->vma->vm_start; + *len = data->vma->vm_end - data->vma->vm_start; + } else { + *start = 0; + *len = 0; + } + up_read(&data->sem); + return 0; +} + +int get_pmem_addr(struct file *file, unsigned long *start, + unsigned long *vstart, unsigned long *len) +{ + struct pmem_data *data; + int id; + + if (!is_pmem_file(file) || !has_allocation(file)) { + return -1; + } + + data = (struct pmem_data *)file->private_data; + if (data->index == -1) { +#if PMEM_DEBUG + printk(KERN_INFO "pmem: requested pmem data from file with no " + "allocation.\n"); + return -1; +#endif + } + id = get_id(file); + + down_read(&data->sem); + *start = pmem_start_addr(id, data); + *len = pmem_len(id, data); + *vstart = (unsigned long)pmem_start_vaddr(id, data); + up_read(&data->sem); +#if PMEM_DEBUG + down_write(&data->sem); + data->ref++; + up_write(&data->sem); +#endif + return 0; +} + +int get_pmem_file(int fd, unsigned long *start, unsigned long *vstart, + unsigned long *len, struct file **filp) +{ + struct file *file; + + file = fget(fd); + if (unlikely(file == NULL)) { + printk(KERN_INFO "pmem: requested data from file descriptor " + "that doesn't exist."); + return -1; + } + + if (get_pmem_addr(file, start, vstart, len)) + goto end; + + if (filp) + *filp = file; + return 0; +end: + fput(file); + return -1; +} + +void put_pmem_file(struct file *file) +{ + struct pmem_data *data; + int id; + + if (!is_pmem_file(file)) + return; + id = get_id(file); + data = (struct pmem_data *)file->private_data; +#if PMEM_DEBUG + down_write(&data->sem); + if (data->ref == 0) { + printk("pmem: pmem_put > pmem_get %s (pid %d)\n", + pmem[id].dev.name, data->pid); + BUG(); + } + data->ref--; + up_write(&data->sem); +#endif + fput(file); +} + +void flush_pmem_file(struct file *file, unsigned long offset, unsigned long len) +{ + struct pmem_data *data; + int id; + void *vaddr; + struct pmem_region_node *region_node; + struct list_head *elt; + void *flush_start, *flush_end; + + if (!is_pmem_file(file) || !has_allocation(file)) { + return; + } + + id = get_id(file); + data = (struct pmem_data *)file->private_data; + if (!pmem[id].cached) + return; + + down_read(&data->sem); + vaddr = pmem_start_vaddr(id, data); + /* if this isn't a submmapped file, flush the whole thing */ + if (unlikely(!(data->flags & PMEM_FLAGS_CONNECTED))) { + dmac_flush_range(vaddr, vaddr + pmem_len(id, data)); + goto end; + } + /* otherwise, flush the region of the file we are drawing */ + list_for_each(elt, &data->region_list) { + region_node = list_entry(elt, struct pmem_region_node, list); + if ((offset >= region_node->region.offset) && + ((offset + len) <= (region_node->region.offset + + region_node->region.len))) { + flush_start = vaddr + region_node->region.offset; + flush_end = flush_start + region_node->region.len; + dmac_flush_range(flush_start, flush_end); + break; + } + } +end: + up_read(&data->sem); +} + +static int pmem_connect(unsigned long connect, struct file *file) +{ + struct pmem_data *data = (struct pmem_data *)file->private_data; + struct pmem_data *src_data; + struct file *src_file; + int ret = 0, put_needed; + + down_write(&data->sem); + /* retrieve the src file and check it is a pmem file with an alloc */ + src_file = fget_light(connect, &put_needed); + DLOG("connect %p to %p\n", file, src_file); + if (!src_file) { + printk("pmem: src file not found!\n"); + ret = -EINVAL; + goto err_no_file; + } + if (unlikely(!is_pmem_file(src_file) || !has_allocation(src_file))) { + printk(KERN_INFO "pmem: src file is not a pmem file or has no " + "alloc!\n"); + ret = -EINVAL; + goto err_bad_file; + } + src_data = (struct pmem_data *)src_file->private_data; + + if (has_allocation(file) && (data->index != src_data->index)) { + printk("pmem: file is already mapped but doesn't match this" + " src_file!\n"); + ret = -EINVAL; + goto err_bad_file; + } + data->index = src_data->index; + data->flags |= PMEM_FLAGS_CONNECTED; + data->master_fd = connect; + data->master_file = src_file; + +err_bad_file: + fput_light(src_file, put_needed); +err_no_file: + up_write(&data->sem); + return ret; +} + +static void pmem_unlock_data_and_mm(struct pmem_data *data, + struct mm_struct *mm) +{ + up_write(&data->sem); + if (mm != NULL) { + up_write(&mm->mmap_sem); + mmput(mm); + } +} + +static int pmem_lock_data_and_mm(struct file *file, struct pmem_data *data, + struct mm_struct **locked_mm) +{ + int ret = 0; + struct mm_struct *mm = NULL; + *locked_mm = NULL; +lock_mm: + down_read(&data->sem); + if (PMEM_IS_SUBMAP(data)) { + mm = get_task_mm(data->task); + if (!mm) { +#if PMEM_DEBUG + printk("pmem: can't remap task is gone!\n"); +#endif + up_read(&data->sem); + return -1; + } + } + up_read(&data->sem); + + if (mm) + down_write(&mm->mmap_sem); + + down_write(&data->sem); + /* check that the file didn't get mmaped before we could take the + * data sem, this should be safe b/c you can only submap each file + * once */ + if (PMEM_IS_SUBMAP(data) && !mm) { + pmem_unlock_data_and_mm(data, mm); + up_write(&data->sem); + goto lock_mm; + } + /* now check that vma.mm is still there, it could have been + * deleted by vma_close before we could get the data->sem */ + if ((data->flags & PMEM_FLAGS_UNSUBMAP) && (mm != NULL)) { + /* might as well release this */ + if (data->flags & PMEM_FLAGS_SUBMAP) { + put_task_struct(data->task); + data->task = NULL; + /* lower the submap flag to show the mm is gone */ + data->flags &= ~(PMEM_FLAGS_SUBMAP); + } + pmem_unlock_data_and_mm(data, mm); + return -1; + } + *locked_mm = mm; + return ret; +} + +int pmem_remap(struct pmem_region *region, struct file *file, + unsigned operation) +{ + int ret; + struct pmem_region_node *region_node; + struct mm_struct *mm = NULL; + struct list_head *elt, *elt2; + int id = get_id(file); + struct pmem_data *data = (struct pmem_data *)file->private_data; + + /* pmem region must be aligned on a page boundry */ + if (unlikely(!PMEM_IS_PAGE_ALIGNED(region->offset) || + !PMEM_IS_PAGE_ALIGNED(region->len))) { +#if PMEM_DEBUG + printk("pmem: request for unaligned pmem suballocation " + "%lx %lx\n", region->offset, region->len); +#endif + return -EINVAL; + } + + /* if userspace requests a region of len 0, there's nothing to do */ + if (region->len == 0) + return 0; + + /* lock the mm and data */ + ret = pmem_lock_data_and_mm(file, data, &mm); + if (ret) + return 0; + + /* only the owner of the master file can remap the client fds + * that back in it */ + if (!is_master_owner(file)) { +#if PMEM_DEBUG + printk("pmem: remap requested from non-master process\n"); +#endif + ret = -EINVAL; + goto err; + } + + /* check that the requested range is within the src allocation */ + if (unlikely((region->offset > pmem_len(id, data)) || + (region->len > pmem_len(id, data)) || + (region->offset + region->len > pmem_len(id, data)))) { +#if PMEM_DEBUG + printk(KERN_INFO "pmem: suballoc doesn't fit in src_file!\n"); +#endif + ret = -EINVAL; + goto err; + } + + if (operation == PMEM_MAP) { + region_node = kmalloc(sizeof(struct pmem_region_node), + GFP_KERNEL); + if (!region_node) { + ret = -ENOMEM; +#if PMEM_DEBUG + printk(KERN_INFO "No space to allocate metadata!"); +#endif + goto err; + } + region_node->region = *region; + list_add(®ion_node->list, &data->region_list); + } else if (operation == PMEM_UNMAP) { + int found = 0; + list_for_each_safe(elt, elt2, &data->region_list) { + region_node = list_entry(elt, struct pmem_region_node, + list); + if (region->len == 0 || + (region_node->region.offset == region->offset && + region_node->region.len == region->len)) { + list_del(elt); + kfree(region_node); + found = 1; + } + } + if (!found) { +#if PMEM_DEBUG + printk("pmem: Unmap region does not map any mapped " + "region!"); +#endif + ret = -EINVAL; + goto err; + } + } + + if (data->vma && PMEM_IS_SUBMAP(data)) { + if (operation == PMEM_MAP) + ret = pmem_remap_pfn_range(id, data->vma, data, + region->offset, region->len); + else if (operation == PMEM_UNMAP) + ret = pmem_unmap_pfn_range(id, data->vma, data, + region->offset, region->len); + } + +err: + pmem_unlock_data_and_mm(data, mm); + return ret; +} + +static void pmem_revoke(struct file *file, struct pmem_data *data) +{ + struct pmem_region_node *region_node; + struct list_head *elt, *elt2; + struct mm_struct *mm = NULL; + int id = get_id(file); + int ret = 0; + + data->master_file = NULL; + ret = pmem_lock_data_and_mm(file, data, &mm); + /* if lock_data_and_mm fails either the task that mapped the fd, or + * the vma that mapped it have already gone away, nothing more + * needs to be done */ + if (ret) + return; + /* unmap everything */ + /* delete the regions and region list nothing is mapped any more */ + if (data->vma) + list_for_each_safe(elt, elt2, &data->region_list) { + region_node = list_entry(elt, struct pmem_region_node, + list); + pmem_unmap_pfn_range(id, data->vma, data, + region_node->region.offset, + region_node->region.len); + list_del(elt); + kfree(region_node); + } + /* delete the master file */ + pmem_unlock_data_and_mm(data, mm); +} + +static void pmem_get_size(struct pmem_region *region, struct file *file) +{ + struct pmem_data *data = (struct pmem_data *)file->private_data; + int id = get_id(file); + + if (!has_allocation(file)) { + region->offset = 0; + region->len = 0; + return; + } else { + region->offset = pmem_start_addr(id, data); + region->len = pmem_len(id, data); + } + DLOG("offset %lx len %lx\n", region->offset, region->len); +} + + +static long pmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + struct pmem_data *data; + int id = get_id(file); + + switch (cmd) { + case PMEM_GET_PHYS: + { + struct pmem_region region; + DLOG("get_phys\n"); + if (!has_allocation(file)) { + region.offset = 0; + region.len = 0; + } else { + data = (struct pmem_data *)file->private_data; + region.offset = pmem_start_addr(id, data); + region.len = pmem_len(id, data); + } + printk(KERN_INFO "pmem: request for physical address of pmem region " + "from process %d.\n", current->pid); + if (copy_to_user((void __user *)arg, ®ion, + sizeof(struct pmem_region))) + return -EFAULT; + break; + } + case PMEM_MAP: + { + struct pmem_region region; + if (copy_from_user(®ion, (void __user *)arg, + sizeof(struct pmem_region))) + return -EFAULT; + data = (struct pmem_data *)file->private_data; + return pmem_remap(®ion, file, PMEM_MAP); + } + break; + case PMEM_UNMAP: + { + struct pmem_region region; + if (copy_from_user(®ion, (void __user *)arg, + sizeof(struct pmem_region))) + return -EFAULT; + data = (struct pmem_data *)file->private_data; + return pmem_remap(®ion, file, PMEM_UNMAP); + break; + } + case PMEM_GET_SIZE: + { + struct pmem_region region; + DLOG("get_size\n"); + pmem_get_size(®ion, file); + if (copy_to_user((void __user *)arg, ®ion, + sizeof(struct pmem_region))) + return -EFAULT; + break; + } + case PMEM_GET_TOTAL_SIZE: + { + struct pmem_region region; + DLOG("get total size\n"); + region.offset = 0; + get_id(file); + region.len = pmem[id].size; + if (copy_to_user((void __user *)arg, ®ion, + sizeof(struct pmem_region))) + return -EFAULT; + break; + } + case PMEM_ALLOCATE: + { + if (has_allocation(file)) + return -EINVAL; + data = (struct pmem_data *)file->private_data; + data->index = pmem_allocate(id, arg); + break; + } + case PMEM_CONNECT: + DLOG("connect\n"); + return pmem_connect(arg, file); + break; + default: + if (pmem[id].ioctl) + return pmem[id].ioctl(file, cmd, arg); + return -EINVAL; + } + return 0; +} + +#if PMEM_DEBUG +static ssize_t debug_open(struct inode *inode, struct file *file) +{ + file->private_data = inode->i_private; + return 0; +} + +static ssize_t debug_read(struct file *file, char __user *buf, size_t count, + loff_t *ppos) +{ + struct list_head *elt, *elt2; + struct pmem_data *data; + struct pmem_region_node *region_node; + int id = (int)file->private_data; + const int debug_bufmax = 4096; + static char buffer[4096]; + int n = 0; + + DLOG("debug open\n"); + n = scnprintf(buffer, debug_bufmax, + "pid #: mapped regions (offset, len) (offset,len)...\n"); + + down(&pmem[id].data_list_sem); + list_for_each(elt, &pmem[id].data_list) { + data = list_entry(elt, struct pmem_data, list); + down_read(&data->sem); + n += scnprintf(buffer + n, debug_bufmax - n, "pid %u:", + data->pid); + list_for_each(elt2, &data->region_list) { + region_node = list_entry(elt2, struct pmem_region_node, + list); + n += scnprintf(buffer + n, debug_bufmax - n, + "(%lx,%lx) ", + region_node->region.offset, + region_node->region.len); + } + n += scnprintf(buffer + n, debug_bufmax - n, "\n"); + up_read(&data->sem); + } + up(&pmem[id].data_list_sem); + + n++; + buffer[n] = 0; + return simple_read_from_buffer(buf, count, ppos, buffer, n); +} + +static struct file_operations debug_fops = { + .read = debug_read, + .open = debug_open, +}; +#endif + +#if 0 +static struct miscdevice pmem_dev = { + .name = "pmem", + .fops = &pmem_fops, +}; +#endif + +int pmem_setup(struct android_pmem_platform_data *pdata, + long (*ioctl)(struct file *, unsigned int, unsigned long), + int (*release)(struct inode *, struct file *)) +{ + int err = 0; + int i, index = 0; + int id = id_count; + id_count++; + + pmem[id].no_allocator = pdata->no_allocator; + pmem[id].cached = pdata->cached; + pmem[id].buffered = pdata->buffered; + pmem[id].base = pdata->start; + pmem[id].size = pdata->size; + pmem[id].ioctl = ioctl; + pmem[id].release = release; + init_rwsem(&pmem[id].bitmap_sem); + init_MUTEX(&pmem[id].data_list_sem); + INIT_LIST_HEAD(&pmem[id].data_list); + pmem[id].dev.name = pdata->name; + pmem[id].dev.minor = id; + pmem[id].dev.fops = &pmem_fops; + printk(KERN_INFO "%s: %d init\n", pdata->name, pdata->cached); + + err = misc_register(&pmem[id].dev); + if (err) { + printk(KERN_ALERT "Unable to register pmem driver!\n"); + goto err_cant_register_device; + } + pmem[id].num_entries = pmem[id].size / PMEM_MIN_ALLOC; + + pmem[id].bitmap = kmalloc(pmem[id].num_entries * + sizeof(struct pmem_bits), GFP_KERNEL); + if (!pmem[id].bitmap) + goto err_no_mem_for_metadata; + + memset(pmem[id].bitmap, 0, sizeof(struct pmem_bits) * + pmem[id].num_entries); + + for (i = sizeof(pmem[id].num_entries) * 8 - 1; i >= 0; i--) { + if ((pmem[id].num_entries) & 1<name, S_IFREG | S_IRUGO, NULL, (void *)id, + &debug_fops); +#endif + return 0; +error_cant_remap: + kfree(pmem[id].bitmap); +err_no_mem_for_metadata: + misc_deregister(&pmem[id].dev); +err_cant_register_device: + return -1; +} + +static int pmem_probe(struct platform_device *pdev) +{ + struct android_pmem_platform_data *pdata; + + if (!pdev || !pdev->dev.platform_data) { + printk(KERN_ALERT "Unable to probe pmem!\n"); + return -1; + } + pdata = pdev->dev.platform_data; + return pmem_setup(pdata, NULL, NULL); +} + + +static int pmem_remove(struct platform_device *pdev) +{ + int id = pdev->id; + __free_page(pfn_to_page(pmem[id].garbage_pfn)); + misc_deregister(&pmem[id].dev); + return 0; +} + +static struct platform_driver pmem_driver = { + .probe = pmem_probe, + .remove = pmem_remove, + .driver = { .name = "android_pmem" } +}; + + +static int __init pmem_init(void) +{ + return platform_driver_register(&pmem_driver); +} + +static void __exit pmem_exit(void) +{ + platform_driver_unregister(&pmem_driver); +} + +module_init(pmem_init); +module_exit(pmem_exit); + -- GitLab From 8fc8598e61f6f384f3eaf1d9b09500c12af47b37 Mon Sep 17 00:00:00 2001 From: Jerry Chuang Date: Tue, 3 Nov 2009 07:17:11 -0200 Subject: [PATCH 222/235] Staging: Added Realtek rtl8192u driver to staging Add Realtek linux driver for rtl8192u as provided by Realtek rtl8192u_linux_2.6.0006.1031.2008.tar.gz, send to me C/C staging ML. This version won't compile against upstream, doesn't follow Linux CodingStyle and has their own ieee80211 stack. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/Kconfig | 6 + drivers/staging/rtl8192u/Makefile | 32 + drivers/staging/rtl8192u/authors | 1 + drivers/staging/rtl8192u/changes | 5 + drivers/staging/rtl8192u/copying | 340 + drivers/staging/rtl8192u/dot11d.h | 102 + drivers/staging/rtl8192u/ieee80211.h | 2795 +++++++ .../staging/rtl8192u/ieee80211/EndianFree.h | 199 + drivers/staging/rtl8192u/ieee80211/Makefile | 139 + drivers/staging/rtl8192u/ieee80211/aes.c | 469 ++ drivers/staging/rtl8192u/ieee80211/api.c | 246 + drivers/staging/rtl8192u/ieee80211/arc4.c | 103 + drivers/staging/rtl8192u/ieee80211/autoload.c | 40 + drivers/staging/rtl8192u/ieee80211/cipher.c | 299 + drivers/staging/rtl8192u/ieee80211/compress.c | 64 + .../rtl8192u/ieee80211/crypto_compat.h | 90 + drivers/staging/rtl8192u/ieee80211/digest.c | 108 + drivers/staging/rtl8192u/ieee80211/dot11d.c | 239 + drivers/staging/rtl8192u/ieee80211/dot11d.h | 102 + .../staging/rtl8192u/ieee80211/ieee80211.h | 2796 +++++++ .../rtl8192u/ieee80211/ieee80211_crypt.c | 273 + .../rtl8192u/ieee80211/ieee80211_crypt.h | 93 + .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 534 ++ .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 1034 +++ .../rtl8192u/ieee80211/ieee80211_crypt_wep.c | 397 + .../rtl8192u/ieee80211/ieee80211_module.c | 394 + .../staging/rtl8192u/ieee80211/ieee80211_rx.c | 2778 +++++++ .../rtl8192u/ieee80211/ieee80211_softmac.c | 3529 ++++++++ .../rtl8192u/ieee80211/ieee80211_softmac_wx.c | 693 ++ .../staging/rtl8192u/ieee80211/ieee80211_tx.c | 929 +++ .../staging/rtl8192u/ieee80211/ieee80211_wx.c | 1032 +++ drivers/staging/rtl8192u/ieee80211/internal.h | 115 + .../staging/rtl8192u/ieee80211/kmap_types.h | 20 + .../staging/rtl8192u/ieee80211/michael_mic.c | 194 + drivers/staging/rtl8192u/ieee80211/proc.c | 116 + .../staging/rtl8192u/ieee80211/rtl819x_BA.h | 69 + .../rtl8192u/ieee80211/rtl819x_BAProc.c | 779 ++ .../staging/rtl8192u/ieee80211/rtl819x_HT.h | 481 ++ .../rtl8192u/ieee80211/rtl819x_HTProc.c | 1719 ++++ .../staging/rtl8192u/ieee80211/rtl819x_Qos.h | 749 ++ .../staging/rtl8192u/ieee80211/rtl819x_TS.h | 56 + .../rtl8192u/ieee80211/rtl819x_TSProc.c | 654 ++ .../staging/rtl8192u/ieee80211/rtl_crypto.h | 399 + .../staging/rtl8192u/ieee80211/scatterwalk.c | 126 + .../staging/rtl8192u/ieee80211/scatterwalk.h | 51 + drivers/staging/rtl8192u/ieee80211_crypt.h | 86 + drivers/staging/rtl8192u/r8180_93cx6.c | 146 + drivers/staging/rtl8192u/r8180_93cx6.h | 40 + drivers/staging/rtl8192u/r8180_pm.c | 48 + drivers/staging/rtl8192u/r8180_pm.h | 28 + drivers/staging/rtl8192u/r8190_rtl8256.c | 312 + drivers/staging/rtl8192u/r8190_rtl8256.h | 27 + drivers/staging/rtl8192u/r8192U.h | 1367 ++++ drivers/staging/rtl8192u/r8192U_core.c | 7134 +++++++++++++++++ drivers/staging/rtl8192u/r8192U_dm.c | 4178 ++++++++++ drivers/staging/rtl8192u/r8192U_dm.h | 309 + drivers/staging/rtl8192u/r8192U_hw.h | 746 ++ drivers/staging/rtl8192u/r8192U_wx.c | 1310 +++ drivers/staging/rtl8192u/r8192U_wx.h | 23 + drivers/staging/rtl8192u/r819xU_HTGen.h | 13 + drivers/staging/rtl8192u/r819xU_HTType.h | 391 + drivers/staging/rtl8192u/r819xU_cmdpkt.c | 822 ++ drivers/staging/rtl8192u/r819xU_cmdpkt.h | 217 + drivers/staging/rtl8192u/r819xU_firmware.c | 700 ++ drivers/staging/rtl8192u/r819xU_firmware.h | 68 + .../staging/rtl8192u/r819xU_firmware_img.c | 3447 ++++++++ .../staging/rtl8192u/r819xU_firmware_img.h | 35 + drivers/staging/rtl8192u/r819xU_phy.c | 1826 +++++ drivers/staging/rtl8192u/r819xU_phy.h | 94 + drivers/staging/rtl8192u/r819xU_phyreg.h | 871 ++ 70 files changed, 49627 insertions(+) create mode 100644 drivers/staging/rtl8192u/Kconfig create mode 100644 drivers/staging/rtl8192u/Makefile create mode 100644 drivers/staging/rtl8192u/authors create mode 100644 drivers/staging/rtl8192u/changes create mode 100644 drivers/staging/rtl8192u/copying create mode 100644 drivers/staging/rtl8192u/dot11d.h create mode 100644 drivers/staging/rtl8192u/ieee80211.h create mode 100644 drivers/staging/rtl8192u/ieee80211/EndianFree.h create mode 100644 drivers/staging/rtl8192u/ieee80211/Makefile create mode 100644 drivers/staging/rtl8192u/ieee80211/aes.c create mode 100644 drivers/staging/rtl8192u/ieee80211/api.c create mode 100644 drivers/staging/rtl8192u/ieee80211/arc4.c create mode 100644 drivers/staging/rtl8192u/ieee80211/autoload.c create mode 100644 drivers/staging/rtl8192u/ieee80211/cipher.c create mode 100644 drivers/staging/rtl8192u/ieee80211/compress.c create mode 100644 drivers/staging/rtl8192u/ieee80211/crypto_compat.h create mode 100644 drivers/staging/rtl8192u/ieee80211/digest.c create mode 100644 drivers/staging/rtl8192u/ieee80211/dot11d.c create mode 100644 drivers/staging/rtl8192u/ieee80211/dot11d.h create mode 100644 drivers/staging/rtl8192u/ieee80211/ieee80211.h create mode 100644 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c create mode 100644 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h create mode 100644 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c create mode 100644 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c create mode 100644 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c create mode 100644 drivers/staging/rtl8192u/ieee80211/ieee80211_module.c create mode 100644 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c create mode 100644 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c create mode 100644 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c create mode 100644 drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c create mode 100644 drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c create mode 100644 drivers/staging/rtl8192u/ieee80211/internal.h create mode 100644 drivers/staging/rtl8192u/ieee80211/kmap_types.h create mode 100644 drivers/staging/rtl8192u/ieee80211/michael_mic.c create mode 100644 drivers/staging/rtl8192u/ieee80211/proc.c create mode 100644 drivers/staging/rtl8192u/ieee80211/rtl819x_BA.h create mode 100644 drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c create mode 100644 drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h create mode 100644 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c create mode 100644 drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h create mode 100644 drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h create mode 100644 drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c create mode 100644 drivers/staging/rtl8192u/ieee80211/rtl_crypto.h create mode 100644 drivers/staging/rtl8192u/ieee80211/scatterwalk.c create mode 100644 drivers/staging/rtl8192u/ieee80211/scatterwalk.h create mode 100644 drivers/staging/rtl8192u/ieee80211_crypt.h create mode 100644 drivers/staging/rtl8192u/r8180_93cx6.c create mode 100644 drivers/staging/rtl8192u/r8180_93cx6.h create mode 100644 drivers/staging/rtl8192u/r8180_pm.c create mode 100644 drivers/staging/rtl8192u/r8180_pm.h create mode 100644 drivers/staging/rtl8192u/r8190_rtl8256.c create mode 100644 drivers/staging/rtl8192u/r8190_rtl8256.h create mode 100644 drivers/staging/rtl8192u/r8192U.h create mode 100644 drivers/staging/rtl8192u/r8192U_core.c create mode 100644 drivers/staging/rtl8192u/r8192U_dm.c create mode 100644 drivers/staging/rtl8192u/r8192U_dm.h create mode 100644 drivers/staging/rtl8192u/r8192U_hw.h create mode 100644 drivers/staging/rtl8192u/r8192U_wx.c create mode 100644 drivers/staging/rtl8192u/r8192U_wx.h create mode 100644 drivers/staging/rtl8192u/r819xU_HTGen.h create mode 100644 drivers/staging/rtl8192u/r819xU_HTType.h create mode 100644 drivers/staging/rtl8192u/r819xU_cmdpkt.c create mode 100644 drivers/staging/rtl8192u/r819xU_cmdpkt.h create mode 100644 drivers/staging/rtl8192u/r819xU_firmware.c create mode 100644 drivers/staging/rtl8192u/r819xU_firmware.h create mode 100644 drivers/staging/rtl8192u/r819xU_firmware_img.c create mode 100644 drivers/staging/rtl8192u/r819xU_firmware_img.h create mode 100644 drivers/staging/rtl8192u/r819xU_phy.c create mode 100644 drivers/staging/rtl8192u/r819xU_phy.h create mode 100644 drivers/staging/rtl8192u/r819xU_phyreg.h diff --git a/drivers/staging/rtl8192u/Kconfig b/drivers/staging/rtl8192u/Kconfig new file mode 100644 index 000000000000..808a088903c1 --- /dev/null +++ b/drivers/staging/rtl8192u/Kconfig @@ -0,0 +1,6 @@ +config RTL8192U + tristate "RealTek RTL8192U Wireless LAN NIC driver" + depends on PCI && WLAN + depends on WIRELESS_EXT + default N + ---help--- diff --git a/drivers/staging/rtl8192u/Makefile b/drivers/staging/rtl8192u/Makefile new file mode 100644 index 000000000000..99236903a9d5 --- /dev/null +++ b/drivers/staging/rtl8192u/Makefile @@ -0,0 +1,32 @@ +NIC_SELECT = RTL8192U + +EXTRA_CFLAGS += -std=gnu89 +EXTRA_CFLAGS += -O2 + +EXTRA_CFLAGS += -mhard-float -DCONFIG_FORCE_HARD_FLOAT=y +EXTRA_CFLAGS += -DJACKSON_NEW_8187 -DJACKSON_NEW_RX +EXTRA_CFLAGS += -DTHOMAS_BEACON -DTHOMAS_TASKLET -DTHOMAS_SKB -DTHOMAS_TURBO +#EXTRA_CFLAGS += -DUSB_TX_DRIVER_AGGREGATION_ENABLE +#EXTRA_CFLAGS += -DUSB_RX_AGGREGATION_SUPPORT +EXTRA_CFLAGS += -DUSE_ONE_PIPE +EXTRA_CFLAGS += -DENABLE_DOT11D + +r8192u_usb-objs := r8192U_core.o r8180_93cx6.o r8192U_wx.o \ + r8190_rtl8256.o r819xU_phy.o r819xU_firmware.o \ + r819xU_cmdpkt.o r8192U_dm.o r819xU_firmware_img.o \ + ieee80211/ieee80211_crypt.o \ + ieee80211/ieee80211_crypt_tkip.o \ + ieee80211/ieee80211_crypt_ccmp.o \ + ieee80211/ieee80211_crypt_wep.o \ + ieee80211/ieee80211_rx.o \ + ieee80211/ieee80211_softmac.o \ + ieee80211/ieee80211_tx.o \ + ieee80211/ieee80211_wx.o \ + ieee80211/ieee80211_module.o \ + ieee80211/ieee80211_softmac_wx.o \ + ieee80211/rtl819x_HTProc.o \ + ieee80211/rtl819x_TSProc.o \ + ieee80211/rtl819x_BAProc.o \ + ieee80211/dot11d.o + +obj-$(CONFIG_RTL8192U) += r8192u_usb.o diff --git a/drivers/staging/rtl8192u/authors b/drivers/staging/rtl8192u/authors new file mode 100644 index 000000000000..b08bbae39e72 --- /dev/null +++ b/drivers/staging/rtl8192u/authors @@ -0,0 +1 @@ +Andrea Merello diff --git a/drivers/staging/rtl8192u/changes b/drivers/staging/rtl8192u/changes new file mode 100644 index 000000000000..87c33fdb9526 --- /dev/null +++ b/drivers/staging/rtl8192u/changes @@ -0,0 +1,5 @@ +v 0.1 + +First version. +This is based on the rtl8180-sa2400 pre-0.22-CVS code.. + diff --git a/drivers/staging/rtl8192u/copying b/drivers/staging/rtl8192u/copying new file mode 100644 index 000000000000..d60c31a97a54 --- /dev/null +++ b/drivers/staging/rtl8192u/copying @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/drivers/staging/rtl8192u/dot11d.h b/drivers/staging/rtl8192u/dot11d.h new file mode 100644 index 000000000000..15b7a4ba37b6 --- /dev/null +++ b/drivers/staging/rtl8192u/dot11d.h @@ -0,0 +1,102 @@ +#ifndef __INC_DOT11D_H +#define __INC_DOT11D_H + +#ifdef ENABLE_DOT11D +#include "ieee80211.h" + +//#define ENABLE_DOT11D + +//#define DOT11D_MAX_CHNL_NUM 83 + +typedef struct _CHNL_TXPOWER_TRIPLE { + u8 FirstChnl; + u8 NumChnls; + u8 MaxTxPowerInDbm; +}CHNL_TXPOWER_TRIPLE, *PCHNL_TXPOWER_TRIPLE; + +typedef enum _DOT11D_STATE { + DOT11D_STATE_NONE = 0, + DOT11D_STATE_LEARNED, + DOT11D_STATE_DONE, +}DOT11D_STATE; + +typedef struct _RT_DOT11D_INFO { + //DECLARE_RT_OBJECT(RT_DOT11D_INFO); + + bool bEnabled; // dot11MultiDomainCapabilityEnabled + + u16 CountryIeLen; // > 0 if CountryIeBuf[] contains valid country information element. + u8 CountryIeBuf[MAX_IE_LEN]; + u8 CountryIeSrcAddr[6]; // Source AP of the country IE. + u8 CountryIeWatchdog; + + u8 channel_map[MAX_CHANNEL_NUMBER+1]; //!!!Value 0: Invalid, 1: Valid (active scan), 2: Valid (passive scan) + //u8 ChnlListLen; // #Bytes valid in ChnlList[]. + //u8 ChnlList[DOT11D_MAX_CHNL_NUM]; + u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER+1]; + + DOT11D_STATE State; +}RT_DOT11D_INFO, *PRT_DOT11D_INFO; +#define eqMacAddr(a,b) ( ((a)[0]==(b)[0] && (a)[1]==(b)[1] && (a)[2]==(b)[2] && (a)[3]==(b)[3] && (a)[4]==(b)[4] && (a)[5]==(b)[5]) ? 1:0 ) +#define cpMacAddr(des,src) ((des)[0]=(src)[0],(des)[1]=(src)[1],(des)[2]=(src)[2],(des)[3]=(src)[3],(des)[4]=(src)[4],(des)[5]=(src)[5]) +#define GET_DOT11D_INFO(__pIeeeDev) ((PRT_DOT11D_INFO)((__pIeeeDev)->pDot11dInfo)) + +#define IS_DOT11D_ENABLE(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->bEnabled +#define IS_COUNTRY_IE_VALID(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0) + +#define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) eqMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) +#define UPDATE_CIE_SRC(__pIeeeDev, __pTa) cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) + +#define IS_COUNTRY_IE_CHANGED(__pIeeeDev, __Ie) \ + (((__Ie).Length == 0 || (__Ie).Length != GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen) ? \ + FALSE : \ + (!memcmp(GET_DOT11D_INFO(__pIeeeDev)->CountryIeBuf, (__Ie).Octet, (__Ie).Length))) + +#define CIE_WATCHDOG_TH 1 +#define GET_CIE_WATCHDOG(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog +#define RESET_CIE_WATCHDOG(__pIeeeDev) GET_CIE_WATCHDOG(__pIeeeDev) = 0 +#define UPDATE_CIE_WATCHDOG(__pIeeeDev) ++GET_CIE_WATCHDOG(__pIeeeDev) + +#define IS_DOT11D_STATE_DONE(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->State == DOT11D_STATE_DONE) + + +void +Dot11d_Init( + struct ieee80211_device *dev + ); + +void +Dot11d_Reset( + struct ieee80211_device *dev + ); + +void +Dot11d_UpdateCountryIe( + struct ieee80211_device *dev, + u8 * pTaddr, + u16 CoutryIeLen, + u8 * pCoutryIe + ); + +u8 +DOT11D_GetMaxTxPwrInDbm( + struct ieee80211_device *dev, + u8 Channel + ); + +void +DOT11D_ScanComplete( + struct ieee80211_device * dev + ); + +int IsLegalChannel( + struct ieee80211_device * dev, + u8 channel +); + +int ToLegalChannel( + struct ieee80211_device * dev, + u8 channel +); +#endif //ENABLE_DOT11D +#endif // #ifndef __INC_DOT11D_H diff --git a/drivers/staging/rtl8192u/ieee80211.h b/drivers/staging/rtl8192u/ieee80211.h new file mode 100644 index 000000000000..c182e91b73c0 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211.h @@ -0,0 +1,2795 @@ +/* + * Merged with mainline ieee80211.h in Aug 2004. Original ieee802_11 + * remains copyright by the original authors + * + * Portions of the merged code are based on Host AP (software wireless + * LAN access point) driver for Intersil Prism2/2.5/3. + * + * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen + * + * Copyright (c) 2002-2003, Jouni Malinen + * + * Adaption to a generic IEEE 802.11 stack by James Ketrenos + * + * Copyright (c) 2004, Intel Corporation + * + * Modified for Realtek's wi-fi cards by Andrea Merello + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. See README and COPYING for + * more details. + */ +#ifndef IEEE80211_H +#define IEEE80211_H +#include /* ETH_ALEN */ +#include /* ARRAY_SIZE */ +#include +#include +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) +#include +#else +#include +#include +#endif +#include +#include + +#include +#include + +#include "../../ieee80211/rtl819x_HT.h" +#include "../../ieee80211/rtl819x_BA.h" +#include "../../ieee80211/rtl819x_TS.h" + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) +#ifndef bool +typedef enum{false = 0, true} bool; +#endif +#endif + +#ifndef IW_MODE_MONITOR +#define IW_MODE_MONITOR 6 +#endif + +#ifndef IWEVCUSTOM +#define IWEVCUSTOM 0x8c02 +#endif + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +#ifndef __bitwise +#define __bitwise __attribute__((bitwise)) +#endif +typedef __u16 __le16; +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27)) +struct iw_spy_data{ + /* --- Standard spy support --- */ + int spy_number; + u_char spy_address[IW_MAX_SPY][ETH_ALEN]; + struct iw_quality spy_stat[IW_MAX_SPY]; + /* --- Enhanced spy support (event) */ + struct iw_quality spy_thr_low; /* Low threshold */ + struct iw_quality spy_thr_high; /* High threshold */ + u_char spy_thr_under[IW_MAX_SPY]; +}; +#endif +#endif + +#ifndef container_of +/** + * container_of - cast a member of a structure out to the containing structure + * + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. + * + */ +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) +#endif + +#define KEY_TYPE_NA 0x0 +#define KEY_TYPE_WEP40 0x1 +#define KEY_TYPE_TKIP 0x2 +#define KEY_TYPE_CCMP 0x4 +#define KEY_TYPE_WEP104 0x5 + +/* added for rtl819x tx procedure */ +#define MAX_QUEUE_SIZE 0x10 + +// +// 8190 queue mapping +// +#define BK_QUEUE 0 +#define BE_QUEUE 1 +#define VI_QUEUE 2 +#define VO_QUEUE 3 +#define HCCA_QUEUE 4 +#define TXCMD_QUEUE 5 +#define MGNT_QUEUE 6 +#define HIGH_QUEUE 7 +#define BEACON_QUEUE 8 + +#define LOW_QUEUE BE_QUEUE +#define NORMAL_QUEUE MGNT_QUEUE + +//added by amy for ps +#define SWRF_TIMEOUT 50 + +//added by amy for LEAP related +#define IE_CISCO_FLAG_POSITION 0x08 // Flag byte: byte 8, numbered from 0. +#define SUPPORT_CKIP_MIC 0x08 // bit3 +#define SUPPORT_CKIP_PK 0x10 // bit4 +/* defined for skb cb field */ +/* At most 28 byte */ +typedef struct cb_desc { + /* Tx Desc Related flags (8-9) */ + u8 bLastIniPkt:1; + u8 bCmdOrInit:1; + u8 bFirstSeg:1; + u8 bLastSeg:1; + u8 bEncrypt:1; + u8 bTxDisableRateFallBack:1; + u8 bTxUseDriverAssingedRate:1; + u8 bHwSec:1; //indicate whether use Hw security. WB + + u8 reserved1; + + /* Tx Firmware Relaged flags (10-11)*/ + u8 bCTSEnable:1; + u8 bRTSEnable:1; + u8 bUseShortGI:1; + u8 bUseShortPreamble:1; + u8 bTxEnableFwCalcDur:1; + u8 bAMPDUEnable:1; + u8 bRTSSTBC:1; + u8 RTSSC:1; + + u8 bRTSBW:1; + u8 bPacketBW:1; + u8 bRTSUseShortPreamble:1; + u8 bRTSUseShortGI:1; + u8 bMulticast:1; + u8 bBroadcast:1; + //u8 reserved2:2; + u8 drv_agg_enable:1; + u8 reserved2:1; + + /* Tx Desc related element(12-19) */ + u8 rata_index; + u8 queue_index; + //u8 reserved3; + //u8 reserved4; + u16 txbuf_size; + //u8 reserved5; + u8 RATRIndex; + u8 reserved6; + u8 reserved7; + u8 reserved8; + + /* Tx firmware related element(20-27) */ + u8 data_rate; + u8 rts_rate; + u8 ampdu_factor; + u8 ampdu_density; + //u8 reserved9; + //u8 reserved10; + //u8 reserved11; + u8 DrvAggrNum; + u16 pkt_size; + u8 reserved12; +}cb_desc, *pcb_desc; + +/*--------------------------Define -------------------------------------------*/ +#define MGN_1M 0x02 +#define MGN_2M 0x04 +#define MGN_5_5M 0x0b +#define MGN_11M 0x16 + +#define MGN_6M 0x0c +#define MGN_9M 0x12 +#define MGN_12M 0x18 +#define MGN_18M 0x24 +#define MGN_24M 0x30 +#define MGN_36M 0x48 +#define MGN_48M 0x60 +#define MGN_54M 0x6c + +#define MGN_MCS0 0x80 +#define MGN_MCS1 0x81 +#define MGN_MCS2 0x82 +#define MGN_MCS3 0x83 +#define MGN_MCS4 0x84 +#define MGN_MCS5 0x85 +#define MGN_MCS6 0x86 +#define MGN_MCS7 0x87 +#define MGN_MCS8 0x88 +#define MGN_MCS9 0x89 +#define MGN_MCS10 0x8a +#define MGN_MCS11 0x8b +#define MGN_MCS12 0x8c +#define MGN_MCS13 0x8d +#define MGN_MCS14 0x8e +#define MGN_MCS15 0x8f + +//---------------------------------------------------------------------------- +// 802.11 Management frame Reason Code field +//---------------------------------------------------------------------------- +enum _ReasonCode{ + unspec_reason = 0x1, + auth_not_valid = 0x2, + deauth_lv_ss = 0x3, + inactivity = 0x4, + ap_overload = 0x5, + class2_err = 0x6, + class3_err = 0x7, + disas_lv_ss = 0x8, + asoc_not_auth = 0x9, + + //----MIC_CHECK + mic_failure = 0xe, + //----END MIC_CHECK + + // Reason code defined in 802.11i D10.0 p.28. + invalid_IE = 0x0d, + four_way_tmout = 0x0f, + two_way_tmout = 0x10, + IE_dismatch = 0x11, + invalid_Gcipher = 0x12, + invalid_Pcipher = 0x13, + invalid_AKMP = 0x14, + unsup_RSNIEver = 0x15, + invalid_RSNIE = 0x16, + auth_802_1x_fail= 0x17, + ciper_reject = 0x18, + + // Reason code defined in 7.3.1.7, 802.1e D13.0, p.42. Added by Annie, 2005-11-15. + QoS_unspec = 0x20, // 32 + QAP_bandwidth = 0x21, // 33 + poor_condition = 0x22, // 34 + no_facility = 0x23, // 35 + // Where is 36??? + req_declined = 0x25, // 37 + invalid_param = 0x26, // 38 + req_not_honored= 0x27, // 39 + TS_not_created = 0x2F, // 47 + DL_not_allowed = 0x30, // 48 + dest_not_exist = 0x31, // 49 + dest_not_QSTA = 0x32, // 50 +}; + + + +#define aSifsTime ((priv->ieee80211->current_network.mode == IEEE_A)||(priv->ieee80211->current_network.mode == IEEE_N_24G)||(priv->ieee80211->current_network.mode == IEEE_N_5G))? 16 : 10 + +#define MGMT_QUEUE_NUM 5 + +#define IEEE_CMD_SET_WPA_PARAM 1 +#define IEEE_CMD_SET_WPA_IE 2 +#define IEEE_CMD_SET_ENCRYPTION 3 +#define IEEE_CMD_MLME 4 + +#define IEEE_PARAM_WPA_ENABLED 1 +#define IEEE_PARAM_TKIP_COUNTERMEASURES 2 +#define IEEE_PARAM_DROP_UNENCRYPTED 3 +#define IEEE_PARAM_PRIVACY_INVOKED 4 +#define IEEE_PARAM_AUTH_ALGS 5 +#define IEEE_PARAM_IEEE_802_1X 6 +//It should consistent with the driver_XXX.c +// David, 2006.9.26 +#define IEEE_PARAM_WPAX_SELECT 7 +//Added for notify the encryption type selection +// David, 2006.9.26 +#define IEEE_PROTO_WPA 1 +#define IEEE_PROTO_RSN 2 +//Added for notify the encryption type selection +// David, 2006.9.26 +#define IEEE_WPAX_USEGROUP 0 +#define IEEE_WPAX_WEP40 1 +#define IEEE_WPAX_TKIP 2 +#define IEEE_WPAX_WRAP 3 +#define IEEE_WPAX_CCMP 4 +#define IEEE_WPAX_WEP104 5 + +#define IEEE_KEY_MGMT_IEEE8021X 1 +#define IEEE_KEY_MGMT_PSK 2 + +#define IEEE_MLME_STA_DEAUTH 1 +#define IEEE_MLME_STA_DISASSOC 2 + + +#define IEEE_CRYPT_ERR_UNKNOWN_ALG 2 +#define IEEE_CRYPT_ERR_UNKNOWN_ADDR 3 +#define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4 +#define IEEE_CRYPT_ERR_KEY_SET_FAILED 5 +#define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED 6 +#define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7 + + +#define IEEE_CRYPT_ALG_NAME_LEN 16 + +#define MAX_IE_LEN 0xff + +// added for kernel conflict +#define ieee80211_crypt_deinit_entries ieee80211_crypt_deinit_entries_rsl +#define ieee80211_crypt_deinit_handler ieee80211_crypt_deinit_handler_rsl +#define ieee80211_crypt_delayed_deinit ieee80211_crypt_delayed_deinit_rsl +#define ieee80211_register_crypto_ops ieee80211_register_crypto_ops_rsl +#define ieee80211_unregister_crypto_ops ieee80211_unregister_crypto_ops_rsl +#define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rsl + +#define ieee80211_ccmp_null ieee80211_ccmp_null_rsl + +#define ieee80211_tkip_null ieee80211_tkip_null_rsl + +#define ieee80211_wep_null ieee80211_wep_null_rsl + +#define free_ieee80211 free_ieee80211_rsl +#define alloc_ieee80211 alloc_ieee80211_rsl + +#define ieee80211_rx ieee80211_rx_rsl +#define ieee80211_rx_mgt ieee80211_rx_mgt_rsl + +#define ieee80211_get_beacon ieee80211_get_beacon_rsl +#define ieee80211_wake_queue ieee80211_wake_queue_rsl +#define ieee80211_stop_queue ieee80211_stop_queue_rsl +#define ieee80211_reset_queue ieee80211_reset_queue_rsl +#define ieee80211_softmac_stop_protocol ieee80211_softmac_stop_protocol_rsl +#define ieee80211_softmac_start_protocol ieee80211_softmac_start_protocol_rsl +#define ieee80211_is_shortslot ieee80211_is_shortslot_rsl +#define ieee80211_is_54g ieee80211_is_54g_rsl +#define ieee80211_wpa_supplicant_ioctl ieee80211_wpa_supplicant_ioctl_rsl +#define ieee80211_ps_tx_ack ieee80211_ps_tx_ack_rsl +#define ieee80211_softmac_xmit ieee80211_softmac_xmit_rsl +#define ieee80211_stop_send_beacons ieee80211_stop_send_beacons_rsl +#define notify_wx_assoc_event notify_wx_assoc_event_rsl +#define SendDisassociation SendDisassociation_rsl +#define ieee80211_disassociate ieee80211_disassociate_rsl +#define ieee80211_start_send_beacons ieee80211_start_send_beacons_rsl +#define ieee80211_stop_scan ieee80211_stop_scan_rsl +#define ieee80211_send_probe_requests ieee80211_send_probe_requests_rsl +#define ieee80211_softmac_scan_syncro ieee80211_softmac_scan_syncro_rsl +#define ieee80211_start_scan_syncro ieee80211_start_scan_syncro_rsl + +#define ieee80211_wx_get_essid ieee80211_wx_get_essid_rsl +#define ieee80211_wx_set_essid ieee80211_wx_set_essid_rsl +#define ieee80211_wx_set_rate ieee80211_wx_set_rate_rsl +#define ieee80211_wx_get_rate ieee80211_wx_get_rate_rsl +#define ieee80211_wx_set_wap ieee80211_wx_set_wap_rsl +#define ieee80211_wx_get_wap ieee80211_wx_get_wap_rsl +#define ieee80211_wx_set_mode ieee80211_wx_set_mode_rsl +#define ieee80211_wx_get_mode ieee80211_wx_get_mode_rsl +#define ieee80211_wx_set_scan ieee80211_wx_set_scan_rsl +#define ieee80211_wx_get_freq ieee80211_wx_get_freq_rsl +#define ieee80211_wx_set_freq ieee80211_wx_set_freq_rsl +#define ieee80211_wx_set_rawtx ieee80211_wx_set_rawtx_rsl +#define ieee80211_wx_get_name ieee80211_wx_get_name_rsl +#define ieee80211_wx_set_power ieee80211_wx_set_power_rsl +#define ieee80211_wx_get_power ieee80211_wx_get_power_rsl +#define ieee80211_wlan_frequencies ieee80211_wlan_frequencies_rsl +#define ieee80211_wx_set_rts ieee80211_wx_set_rts_rsl +#define ieee80211_wx_get_rts ieee80211_wx_get_rts_rsl + +#define ieee80211_txb_free ieee80211_txb_free_rsl + +#define ieee80211_wx_set_gen_ie ieee80211_wx_set_gen_ie_rsl +#define ieee80211_wx_get_scan ieee80211_wx_get_scan_rsl +#define ieee80211_wx_set_encode ieee80211_wx_set_encode_rsl +#define ieee80211_wx_get_encode ieee80211_wx_get_encode_rsl +#if WIRELESS_EXT >= 18 +#define ieee80211_wx_set_mlme ieee80211_wx_set_mlme_rsl +#define ieee80211_wx_set_auth ieee80211_wx_set_auth_rsl +#define ieee80211_wx_set_encode_ext ieee80211_wx_set_encode_ext_rsl +#define ieee80211_wx_get_encode_ext ieee80211_wx_get_encode_ext_rsl +#endif + + +typedef struct ieee_param { + u32 cmd; + u8 sta_addr[ETH_ALEN]; + union { + struct { + u8 name; + u32 value; + } wpa_param; + struct { + u32 len; + u8 reserved[32]; + u8 data[0]; + } wpa_ie; + struct{ + int command; + int reason_code; + } mlme; + struct { + u8 alg[IEEE_CRYPT_ALG_NAME_LEN]; + u8 set_tx; + u32 err; + u8 idx; + u8 seq[8]; /* sequence counter (set: RX, get: TX) */ + u16 key_len; + u8 key[0]; + } crypt; + } u; +}ieee_param; + + +#if WIRELESS_EXT < 17 +#define IW_QUAL_QUAL_INVALID 0x10 +#define IW_QUAL_LEVEL_INVALID 0x20 +#define IW_QUAL_NOISE_INVALID 0x40 +#define IW_QUAL_QUAL_UPDATED 0x1 +#define IW_QUAL_LEVEL_UPDATED 0x2 +#define IW_QUAL_NOISE_UPDATED 0x4 +#endif + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +static inline void tq_init(struct tq_struct * task, void(*func)(void *), void *data) +{ + task->routine = func; + task->data = data; + //task->next = NULL; + INIT_LIST_HEAD(&task->list); + task->sync = 0; +} +#endif + +// linux under 2.6.9 release may not support it, so modify it for common use +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)) +//#define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ) +#define MSECS(t) (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000) +static inline unsigned long msleep_interruptible_rsl(unsigned int msecs) +{ + unsigned long timeout = MSECS(msecs) + 1; + + while (timeout) { + set_current_state(TASK_INTERRUPTIBLE); + timeout = schedule_timeout(timeout); + } + return timeout; +} +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31)) +static inline void msleep(unsigned int msecs) +{ + unsigned long timeout = MSECS(msecs) + 1; + + while (timeout) { + set_current_state(TASK_UNINTERRUPTIBLE); + timeout = schedule_timeout(timeout); + } +} +#endif +#else +#define MSECS(t) msecs_to_jiffies(t) +#define msleep_interruptible_rsl msleep_interruptible +#endif + +#define IEEE80211_DATA_LEN 2304 +/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section + 6.2.1.1.2. + + The figure in section 7.1.2 suggests a body size of up to 2312 + bytes is allowed, which is a bit confusing, I suspect this + represents the 2304 bytes of real data, plus a possible 8 bytes of + WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ +#define IEEE80211_1ADDR_LEN 10 +#define IEEE80211_2ADDR_LEN 16 +#define IEEE80211_3ADDR_LEN 24 +#define IEEE80211_4ADDR_LEN 30 +#define IEEE80211_FCS_LEN 4 +#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) +#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) +#define IEEE80211_MGMT_HDR_LEN 24 +#define IEEE80211_DATA_HDR3_LEN 24 +#define IEEE80211_DATA_HDR4_LEN 30 + +#define MIN_FRAG_THRESHOLD 256U +#define MAX_FRAG_THRESHOLD 2346U + + +/* Frame control field constants */ +#define IEEE80211_FCTL_VERS 0x0003 +#define IEEE80211_FCTL_FTYPE 0x000c +#define IEEE80211_FCTL_STYPE 0x00f0 +#define IEEE80211_FCTL_FRAMETYPE 0x00fc +#define IEEE80211_FCTL_TODS 0x0100 +#define IEEE80211_FCTL_FROMDS 0x0200 +#define IEEE80211_FCTL_DSTODS 0x0300 //added by david +#define IEEE80211_FCTL_MOREFRAGS 0x0400 +#define IEEE80211_FCTL_RETRY 0x0800 +#define IEEE80211_FCTL_PM 0x1000 +#define IEEE80211_FCTL_MOREDATA 0x2000 +#define IEEE80211_FCTL_WEP 0x4000 +#define IEEE80211_FCTL_ORDER 0x8000 + +#define IEEE80211_FTYPE_MGMT 0x0000 +#define IEEE80211_FTYPE_CTL 0x0004 +#define IEEE80211_FTYPE_DATA 0x0008 + +/* management */ +#define IEEE80211_STYPE_ASSOC_REQ 0x0000 +#define IEEE80211_STYPE_ASSOC_RESP 0x0010 +#define IEEE80211_STYPE_REASSOC_REQ 0x0020 +#define IEEE80211_STYPE_REASSOC_RESP 0x0030 +#define IEEE80211_STYPE_PROBE_REQ 0x0040 +#define IEEE80211_STYPE_PROBE_RESP 0x0050 +#define IEEE80211_STYPE_BEACON 0x0080 +#define IEEE80211_STYPE_ATIM 0x0090 +#define IEEE80211_STYPE_DISASSOC 0x00A0 +#define IEEE80211_STYPE_AUTH 0x00B0 +#define IEEE80211_STYPE_DEAUTH 0x00C0 +#define IEEE80211_STYPE_MANAGE_ACT 0x00D0 + +/* control */ +#define IEEE80211_STYPE_PSPOLL 0x00A0 +#define IEEE80211_STYPE_RTS 0x00B0 +#define IEEE80211_STYPE_CTS 0x00C0 +#define IEEE80211_STYPE_ACK 0x00D0 +#define IEEE80211_STYPE_CFEND 0x00E0 +#define IEEE80211_STYPE_CFENDACK 0x00F0 +#define IEEE80211_STYPE_BLOCKACK 0x0094 + +/* data */ +#define IEEE80211_STYPE_DATA 0x0000 +#define IEEE80211_STYPE_DATA_CFACK 0x0010 +#define IEEE80211_STYPE_DATA_CFPOLL 0x0020 +#define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030 +#define IEEE80211_STYPE_NULLFUNC 0x0040 +#define IEEE80211_STYPE_CFACK 0x0050 +#define IEEE80211_STYPE_CFPOLL 0x0060 +#define IEEE80211_STYPE_CFACKPOLL 0x0070 +#define IEEE80211_STYPE_QOS_DATA 0x0080 //added for WMM 2006/8/2 +#define IEEE80211_STYPE_QOS_NULL 0x00C0 + +#define IEEE80211_SCTL_FRAG 0x000F +#define IEEE80211_SCTL_SEQ 0xFFF0 + +/* QOS control */ +#define IEEE80211_QCTL_TID 0x000F + +#define FC_QOS_BIT BIT7 +#define IsDataFrame(pdu) ( ((pdu[0] & 0x0C)==0x08) ? true : false ) +#define IsLegacyDataFrame(pdu) (IsDataFrame(pdu) && (!(pdu[0]&FC_QOS_BIT)) ) +//added by wb. Is this right? +#define IsQoSDataFrame(pframe) ((*(u16*)pframe&(IEEE80211_STYPE_QOS_DATA|IEEE80211_FTYPE_DATA)) == (IEEE80211_STYPE_QOS_DATA|IEEE80211_FTYPE_DATA)) +#define Frame_Order(pframe) (*(u16*)pframe&IEEE80211_FCTL_ORDER) +#define SN_LESS(a, b) (((a-b)&0x800)!=0) +#define SN_EQUAL(a, b) (a == b) +#define MAX_DEV_ADDR_SIZE 8 +typedef enum _ACT_CATEGORY{ + ACT_CAT_QOS = 1, + ACT_CAT_DLS = 2, + ACT_CAT_BA = 3, + ACT_CAT_HT = 7, + ACT_CAT_WMM = 17, +} ACT_CATEGORY, *PACT_CATEGORY; + +typedef enum _TS_ACTION{ + ACT_ADDTSREQ = 0, + ACT_ADDTSRSP = 1, + ACT_DELTS = 2, + ACT_SCHEDULE = 3, +} TS_ACTION, *PTS_ACTION; + +typedef enum _BA_ACTION{ + ACT_ADDBAREQ = 0, + ACT_ADDBARSP = 1, + ACT_DELBA = 2, +} BA_ACTION, *PBA_ACTION; + +typedef enum _InitialGainOpType{ + IG_Backup=0, + IG_Restore, + IG_Max +}InitialGainOpType; + +/* debug macros */ +#define CONFIG_IEEE80211_DEBUG +#ifdef CONFIG_IEEE80211_DEBUG +extern u32 ieee80211_debug_level; +#define IEEE80211_DEBUG(level, fmt, args...) \ +do { if (ieee80211_debug_level & (level)) \ + printk(KERN_DEBUG "ieee80211: " fmt, ## args); } while (0) +//wb added to debug out data buf +//if you want print DATA buffer related BA, please set ieee80211_debug_level to DATA|BA +#define IEEE80211_DEBUG_DATA(level, data, datalen) \ + do{ if ((ieee80211_debug_level & (level)) == (level)) \ + { \ + int i; \ + u8* pdata = (u8*) data; \ + printk(KERN_DEBUG "ieee80211: %s()\n", __FUNCTION__); \ + for(i=0; i<(int)(datalen); i++) \ + { \ + printk("%2x ", pdata[i]); \ + if ((i+1)%16 == 0) printk("\n"); \ + } \ + printk("\n"); \ + } \ + } while (0) +#else +#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) +#define IEEE80211_DEBUG_DATA(level, data, datalen) do {} while(0) +#endif /* CONFIG_IEEE80211_DEBUG */ + +/* debug macros not dependent on CONFIG_IEEE80211_DEBUG */ + +#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" +#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5] + +/* + * To use the debug system; + * + * If you are defining a new debug classification, simply add it to the #define + * list here in the form of: + * + * #define IEEE80211_DL_xxxx VALUE + * + * shifting value to the left one bit from the previous entry. xxxx should be + * the name of the classification (for example, WEP) + * + * You then need to either add a IEEE80211_xxxx_DEBUG() macro definition for your + * classification, or use IEEE80211_DEBUG(IEEE80211_DL_xxxx, ...) whenever you want + * to send output to that classification. + * + * To add your debug level to the list of levels seen when you perform + * + * % cat /proc/net/ipw/debug_level + * + * you simply need to add your entry to the ipw_debug_levels array. + * + * If you do not see debug_level in /proc/net/ipw then you do not have + * CONFIG_IEEE80211_DEBUG defined in your kernel configuration + * + */ + +#define IEEE80211_DL_INFO (1<<0) +#define IEEE80211_DL_WX (1<<1) +#define IEEE80211_DL_SCAN (1<<2) +#define IEEE80211_DL_STATE (1<<3) +#define IEEE80211_DL_MGMT (1<<4) +#define IEEE80211_DL_FRAG (1<<5) +#define IEEE80211_DL_EAP (1<<6) +#define IEEE80211_DL_DROP (1<<7) + +#define IEEE80211_DL_TX (1<<8) +#define IEEE80211_DL_RX (1<<9) + +#define IEEE80211_DL_HT (1<<10) //HT +#define IEEE80211_DL_BA (1<<11) //ba +#define IEEE80211_DL_TS (1<<12) //TS +#define IEEE80211_DL_QOS (1<<13) +#define IEEE80211_DL_REORDER (1<<14) +#define IEEE80211_DL_IOT (1<<15) +#define IEEE80211_DL_IPS (1<<16) +#define IEEE80211_DL_TRACE (1<<29) //trace function, need to user net_ratelimit() together in order not to print too much to the screen +#define IEEE80211_DL_DATA (1<<30) //use this flag to control whether print data buf out. +#define IEEE80211_DL_ERR (1<<31) //always open +#define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a) +#define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a) +#define IEEE80211_DEBUG_INFO(f, a...) IEEE80211_DEBUG(IEEE80211_DL_INFO, f, ## a) + +#define IEEE80211_DEBUG_WX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_WX, f, ## a) +#define IEEE80211_DEBUG_SCAN(f, a...) IEEE80211_DEBUG(IEEE80211_DL_SCAN, f, ## a) +#define IEEE80211_DEBUG_STATE(f, a...) IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a) +#define IEEE80211_DEBUG_MGMT(f, a...) IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a) +#define IEEE80211_DEBUG_FRAG(f, a...) IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a) +#define IEEE80211_DEBUG_EAP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_EAP, f, ## a) +#define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a) +#define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a) +#define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a) +#define IEEE80211_DEBUG_QOS(f, a...) IEEE80211_DEBUG(IEEE80211_DL_QOS, f, ## a) + +#ifdef CONFIG_IEEE80211_DEBUG +/* Added by Annie, 2005-11-22. */ +#define MAX_STR_LEN 64 +/* I want to see ASCII 33 to 126 only. Otherwise, I print '?'. Annie, 2005-11-22.*/ +#define PRINTABLE(_ch) (_ch>'!' && _ch<'~') +#define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) \ + if((_Comp) & level) \ + { \ + int __i; \ + u8 buffer[MAX_STR_LEN]; \ + int length = (_Len\n", _Len, buffer); \ + } +#else +#define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) do {} while (0) +#endif + +#include +#include /* ARPHRD_ETHER */ + +#ifndef WIRELESS_SPY +#define WIRELESS_SPY // enable iwspy support +#endif +#include // new driver API + +#ifndef ETH_P_PAE +#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ +#endif /* ETH_P_PAE */ + +#define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */ + +#ifndef ETH_P_80211_RAW +#define ETH_P_80211_RAW (ETH_P_ECONET + 1) +#endif + +/* IEEE 802.11 defines */ + +#define P80211_OUI_LEN 3 + +struct ieee80211_snap_hdr { + + u8 dsap; /* always 0xAA */ + u8 ssap; /* always 0xAA */ + u8 ctrl; /* always 0x03 */ + u8 oui[P80211_OUI_LEN]; /* organizational universal id */ + +} __attribute__ ((packed)); + +#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr) + +#define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS) +#define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE) +#define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE) + +#define WLAN_FC_GET_FRAMETYPE(fc) ((fc) & IEEE80211_FCTL_FRAMETYPE) +#define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG) +#define WLAN_GET_SEQ_SEQ(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) + +/* Authentication algorithms */ +#define WLAN_AUTH_OPEN 0 +#define WLAN_AUTH_SHARED_KEY 1 +#define WLAN_AUTH_LEAP 2 + +#define WLAN_AUTH_CHALLENGE_LEN 128 + +#define WLAN_CAPABILITY_BSS (1<<0) +#define WLAN_CAPABILITY_IBSS (1<<1) +#define WLAN_CAPABILITY_CF_POLLABLE (1<<2) +#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3) +#define WLAN_CAPABILITY_PRIVACY (1<<4) +#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) +#define WLAN_CAPABILITY_PBCC (1<<6) +#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) +#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8) +#define WLAN_CAPABILITY_QOS (1<<9) +#define WLAN_CAPABILITY_SHORT_SLOT (1<<10) +#define WLAN_CAPABILITY_DSSS_OFDM (1<<13) + +/* 802.11g ERP information element */ +#define WLAN_ERP_NON_ERP_PRESENT (1<<0) +#define WLAN_ERP_USE_PROTECTION (1<<1) +#define WLAN_ERP_BARKER_PREAMBLE (1<<2) + +/* Status codes */ +enum ieee80211_statuscode { + WLAN_STATUS_SUCCESS = 0, + WLAN_STATUS_UNSPECIFIED_FAILURE = 1, + WLAN_STATUS_CAPS_UNSUPPORTED = 10, + WLAN_STATUS_REASSOC_NO_ASSOC = 11, + WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12, + WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13, + WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14, + WLAN_STATUS_CHALLENGE_FAIL = 15, + WLAN_STATUS_AUTH_TIMEOUT = 16, + WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17, + WLAN_STATUS_ASSOC_DENIED_RATES = 18, + /* 802.11b */ + WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19, + WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20, + WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21, + /* 802.11h */ + WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22, + WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23, + WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24, + /* 802.11g */ + WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25, + WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26, + /* 802.11i */ + WLAN_STATUS_INVALID_IE = 40, + WLAN_STATUS_INVALID_GROUP_CIPHER = 41, + WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42, + WLAN_STATUS_INVALID_AKMP = 43, + WLAN_STATUS_UNSUPP_RSN_VERSION = 44, + WLAN_STATUS_INVALID_RSN_IE_CAP = 45, + WLAN_STATUS_CIPHER_SUITE_REJECTED = 46, +}; + +/* Reason codes */ +enum ieee80211_reasoncode { + WLAN_REASON_UNSPECIFIED = 1, + WLAN_REASON_PREV_AUTH_NOT_VALID = 2, + WLAN_REASON_DEAUTH_LEAVING = 3, + WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4, + WLAN_REASON_DISASSOC_AP_BUSY = 5, + WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6, + WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7, + WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8, + WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9, + /* 802.11h */ + WLAN_REASON_DISASSOC_BAD_POWER = 10, + WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11, + /* 802.11i */ + WLAN_REASON_INVALID_IE = 13, + WLAN_REASON_MIC_FAILURE = 14, + WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, + WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16, + WLAN_REASON_IE_DIFFERENT = 17, + WLAN_REASON_INVALID_GROUP_CIPHER = 18, + WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19, + WLAN_REASON_INVALID_AKMP = 20, + WLAN_REASON_UNSUPP_RSN_VERSION = 21, + WLAN_REASON_INVALID_RSN_IE_CAP = 22, + WLAN_REASON_IEEE8021X_FAILED = 23, + WLAN_REASON_CIPHER_SUITE_REJECTED = 24, +}; + +#define IEEE80211_STATMASK_SIGNAL (1<<0) +#define IEEE80211_STATMASK_RSSI (1<<1) +#define IEEE80211_STATMASK_NOISE (1<<2) +#define IEEE80211_STATMASK_RATE (1<<3) +#define IEEE80211_STATMASK_WEMASK 0x7 + +#define IEEE80211_CCK_MODULATION (1<<0) +#define IEEE80211_OFDM_MODULATION (1<<1) + +#define IEEE80211_24GHZ_BAND (1<<0) +#define IEEE80211_52GHZ_BAND (1<<1) + +#define IEEE80211_CCK_RATE_LEN 4 +#define IEEE80211_CCK_RATE_1MB 0x02 +#define IEEE80211_CCK_RATE_2MB 0x04 +#define IEEE80211_CCK_RATE_5MB 0x0B +#define IEEE80211_CCK_RATE_11MB 0x16 +#define IEEE80211_OFDM_RATE_LEN 8 +#define IEEE80211_OFDM_RATE_6MB 0x0C +#define IEEE80211_OFDM_RATE_9MB 0x12 +#define IEEE80211_OFDM_RATE_12MB 0x18 +#define IEEE80211_OFDM_RATE_18MB 0x24 +#define IEEE80211_OFDM_RATE_24MB 0x30 +#define IEEE80211_OFDM_RATE_36MB 0x48 +#define IEEE80211_OFDM_RATE_48MB 0x60 +#define IEEE80211_OFDM_RATE_54MB 0x6C +#define IEEE80211_BASIC_RATE_MASK 0x80 + +#define IEEE80211_CCK_RATE_1MB_MASK (1<<0) +#define IEEE80211_CCK_RATE_2MB_MASK (1<<1) +#define IEEE80211_CCK_RATE_5MB_MASK (1<<2) +#define IEEE80211_CCK_RATE_11MB_MASK (1<<3) +#define IEEE80211_OFDM_RATE_6MB_MASK (1<<4) +#define IEEE80211_OFDM_RATE_9MB_MASK (1<<5) +#define IEEE80211_OFDM_RATE_12MB_MASK (1<<6) +#define IEEE80211_OFDM_RATE_18MB_MASK (1<<7) +#define IEEE80211_OFDM_RATE_24MB_MASK (1<<8) +#define IEEE80211_OFDM_RATE_36MB_MASK (1<<9) +#define IEEE80211_OFDM_RATE_48MB_MASK (1<<10) +#define IEEE80211_OFDM_RATE_54MB_MASK (1<<11) + +#define IEEE80211_CCK_RATES_MASK 0x0000000F +#define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \ + IEEE80211_CCK_RATE_2MB_MASK) +#define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \ + IEEE80211_CCK_RATE_5MB_MASK | \ + IEEE80211_CCK_RATE_11MB_MASK) + +#define IEEE80211_OFDM_RATES_MASK 0x00000FF0 +#define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \ + IEEE80211_OFDM_RATE_12MB_MASK | \ + IEEE80211_OFDM_RATE_24MB_MASK) +#define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \ + IEEE80211_OFDM_RATE_9MB_MASK | \ + IEEE80211_OFDM_RATE_18MB_MASK | \ + IEEE80211_OFDM_RATE_36MB_MASK | \ + IEEE80211_OFDM_RATE_48MB_MASK | \ + IEEE80211_OFDM_RATE_54MB_MASK) +#define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \ + IEEE80211_CCK_DEFAULT_RATES_MASK) + +#define IEEE80211_NUM_OFDM_RATES 8 +#define IEEE80211_NUM_CCK_RATES 4 +#define IEEE80211_OFDM_SHIFT_MASK_A 4 + + +/* this is stolen and modified from the madwifi driver*/ +#define IEEE80211_FC0_TYPE_MASK 0x0c +#define IEEE80211_FC0_TYPE_DATA 0x08 +#define IEEE80211_FC0_SUBTYPE_MASK 0xB0 +#define IEEE80211_FC0_SUBTYPE_QOS 0x80 + +#define IEEE80211_QOS_HAS_SEQ(fc) \ + (((fc) & (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) == \ + (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS)) + +/* this is stolen from ipw2200 driver */ +#define IEEE_IBSS_MAC_HASH_SIZE 31 +struct ieee_ibss_seq { + u8 mac[ETH_ALEN]; + u16 seq_num[17]; + u16 frag_num[17]; + unsigned long packet_time[17]; + struct list_head list; +}; + +/* NOTE: This data is for statistical purposes; not all hardware provides this + * information for frames received. Not setting these will not cause + * any adverse affects. */ +struct ieee80211_rx_stats { +#if 1 + u32 mac_time[2]; + s8 rssi; + u8 signal; + u8 noise; + u16 rate; /* in 100 kbps */ + u8 received_channel; + u8 control; + u8 mask; + u8 freq; + u16 len; + u64 tsf; + u32 beacon_time; + u8 nic_type; + u16 Length; + // u8 DataRate; // In 0.5 Mbps + u8 SignalQuality; // in 0-100 index. + s32 RecvSignalPower; // Real power in dBm for this packet, no beautification and aggregation. + s8 RxPower; // in dBm Translate from PWdB + u8 SignalStrength; // in 0-100 index. + u16 bHwError:1; + u16 bCRC:1; + u16 bICV:1; + u16 bShortPreamble:1; + u16 Antenna:1; //for rtl8185 + u16 Decrypted:1; //for rtl8185, rtl8187 + u16 Wakeup:1; //for rtl8185 + u16 Reserved0:1; //for rtl8185 + u8 AGC; + u32 TimeStampLow; + u32 TimeStampHigh; + bool bShift; + bool bIsQosData; // Added by Annie, 2005-12-22. + u8 UserPriority; + + //1!!!!!!!!!!!!!!!!!!!!!!!!!!! + //1Attention Please!!!<11n or 8190 specific code should be put below this line> + //1!!!!!!!!!!!!!!!!!!!!!!!!!!! + + u8 RxDrvInfoSize; + u8 RxBufShift; + bool bIsAMPDU; + bool bFirstMPDU; + bool bContainHTC; + bool RxIs40MHzPacket; + u32 RxPWDBAll; + u8 RxMIMOSignalStrength[4]; // in 0~100 index + s8 RxMIMOSignalQuality[2]; + bool bPacketMatchBSSID; + bool bIsCCK; + bool bPacketToSelf; + //added by amy + u8* virtual_address; + u16 packetlength; // Total packet length: Must equal to sum of all FragLength + u16 fraglength; // FragLength should equal to PacketLength in non-fragment case + u16 fragoffset; // Data offset for this fragment + u16 ntotalfrag; + bool bisrxaggrsubframe; + bool bPacketBeacon; //cosa add for rssi + bool bToSelfBA; //cosa add for rssi + char cck_adc_pwdb[4]; //cosa add for rx path selection + u16 Seq_Num; +#endif + +}; + +/* IEEE 802.11 requires that STA supports concurrent reception of at least + * three fragmented frames. This define can be increased to support more + * concurrent frames, but it should be noted that each entry can consume about + * 2 kB of RAM and increasing cache size will slow down frame reassembly. */ +#define IEEE80211_FRAG_CACHE_LEN 4 + +struct ieee80211_frag_entry { + unsigned long first_frag_time; + unsigned int seq; + unsigned int last_frag; + struct sk_buff *skb; + u8 src_addr[ETH_ALEN]; + u8 dst_addr[ETH_ALEN]; +}; + +struct ieee80211_stats { + unsigned int tx_unicast_frames; + unsigned int tx_multicast_frames; + unsigned int tx_fragments; + unsigned int tx_unicast_octets; + unsigned int tx_multicast_octets; + unsigned int tx_deferred_transmissions; + unsigned int tx_single_retry_frames; + unsigned int tx_multiple_retry_frames; + unsigned int tx_retry_limit_exceeded; + unsigned int tx_discards; + unsigned int rx_unicast_frames; + unsigned int rx_multicast_frames; + unsigned int rx_fragments; + unsigned int rx_unicast_octets; + unsigned int rx_multicast_octets; + unsigned int rx_fcs_errors; + unsigned int rx_discards_no_buffer; + unsigned int tx_discards_wrong_sa; + unsigned int rx_discards_undecryptable; + unsigned int rx_message_in_msg_fragments; + unsigned int rx_message_in_bad_msg_fragments; +}; + +struct ieee80211_device; + +#include "ieee80211_crypt.h" + +#define SEC_KEY_1 (1<<0) +#define SEC_KEY_2 (1<<1) +#define SEC_KEY_3 (1<<2) +#define SEC_KEY_4 (1<<3) +#define SEC_ACTIVE_KEY (1<<4) +#define SEC_AUTH_MODE (1<<5) +#define SEC_UNICAST_GROUP (1<<6) +#define SEC_LEVEL (1<<7) +#define SEC_ENABLED (1<<8) +#define SEC_ENCRYPT (1<<9) + +#define SEC_LEVEL_0 0 /* None */ +#define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */ +#define SEC_LEVEL_2 2 /* Level 1 + TKIP */ +#define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */ +#define SEC_LEVEL_3 4 /* Level 2 + CCMP */ + +#define SEC_ALG_NONE 0 +#define SEC_ALG_WEP 1 +#define SEC_ALG_TKIP 2 +#define SEC_ALG_CCMP 3 + +#define WEP_KEYS 4 +#define WEP_KEY_LEN 13 +#define SCM_KEY_LEN 32 +#define SCM_TEMPORAL_KEY_LENGTH 16 + +struct ieee80211_security { + u16 active_key:2, + enabled:1, + auth_mode:2, + auth_algo:4, + unicast_uses_group:1, + encrypt:1; + u8 key_sizes[WEP_KEYS]; + u8 keys[WEP_KEYS][SCM_KEY_LEN]; + u8 level; + u16 flags; +} __attribute__ ((packed)); + + +/* + 802.11 data frame from AP + ,-------------------------------------------------------------------. +Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | + |------|------|---------|---------|---------|------|---------|------| +Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs | + | | tion | (BSSID) | | | ence | data | | + `-------------------------------------------------------------------' +Total: 28-2340 bytes +*/ + +/* Management Frame Information Element Types */ +enum ieee80211_mfie { + MFIE_TYPE_SSID = 0, + MFIE_TYPE_RATES = 1, + MFIE_TYPE_FH_SET = 2, + MFIE_TYPE_DS_SET = 3, + MFIE_TYPE_CF_SET = 4, + MFIE_TYPE_TIM = 5, + MFIE_TYPE_IBSS_SET = 6, + MFIE_TYPE_COUNTRY = 7, + MFIE_TYPE_HOP_PARAMS = 8, + MFIE_TYPE_HOP_TABLE = 9, + MFIE_TYPE_REQUEST = 10, + MFIE_TYPE_CHALLENGE = 16, + MFIE_TYPE_POWER_CONSTRAINT = 32, + MFIE_TYPE_POWER_CAPABILITY = 33, + MFIE_TYPE_TPC_REQUEST = 34, + MFIE_TYPE_TPC_REPORT = 35, + MFIE_TYPE_SUPP_CHANNELS = 36, + MFIE_TYPE_CSA = 37, + MFIE_TYPE_MEASURE_REQUEST = 38, + MFIE_TYPE_MEASURE_REPORT = 39, + MFIE_TYPE_QUIET = 40, + MFIE_TYPE_IBSS_DFS = 41, + MFIE_TYPE_ERP = 42, + MFIE_TYPE_RSN = 48, + MFIE_TYPE_RATES_EX = 50, + MFIE_TYPE_HT_CAP= 45, + MFIE_TYPE_HT_INFO= 61, + MFIE_TYPE_AIRONET=133, + MFIE_TYPE_GENERIC = 221, + MFIE_TYPE_QOS_PARAMETER = 222, +}; + +/* Minimal header; can be used for passing 802.11 frames with sufficient + * information to determine what type of underlying data type is actually + * stored in the data. */ +struct ieee80211_hdr { + __le16 frame_ctl; + __le16 duration_id; + u8 payload[0]; +} __attribute__ ((packed)); + +struct ieee80211_hdr_1addr { + __le16 frame_ctl; + __le16 duration_id; + u8 addr1[ETH_ALEN]; + u8 payload[0]; +} __attribute__ ((packed)); + +struct ieee80211_hdr_2addr { + __le16 frame_ctl; + __le16 duration_id; + u8 addr1[ETH_ALEN]; + u8 addr2[ETH_ALEN]; + u8 payload[0]; +} __attribute__ ((packed)); + +struct ieee80211_hdr_3addr { + __le16 frame_ctl; + __le16 duration_id; + u8 addr1[ETH_ALEN]; + u8 addr2[ETH_ALEN]; + u8 addr3[ETH_ALEN]; + __le16 seq_ctl; + u8 payload[0]; +} __attribute__ ((packed)); + +struct ieee80211_hdr_4addr { + __le16 frame_ctl; + __le16 duration_id; + u8 addr1[ETH_ALEN]; + u8 addr2[ETH_ALEN]; + u8 addr3[ETH_ALEN]; + __le16 seq_ctl; + u8 addr4[ETH_ALEN]; + u8 payload[0]; +} __attribute__ ((packed)); + +struct ieee80211_hdr_3addrqos { + __le16 frame_ctl; + __le16 duration_id; + u8 addr1[ETH_ALEN]; + u8 addr2[ETH_ALEN]; + u8 addr3[ETH_ALEN]; + __le16 seq_ctl; + u8 payload[0]; + __le16 qos_ctl; +} __attribute__ ((packed)); + +struct ieee80211_hdr_4addrqos { + __le16 frame_ctl; + __le16 duration_id; + u8 addr1[ETH_ALEN]; + u8 addr2[ETH_ALEN]; + u8 addr3[ETH_ALEN]; + __le16 seq_ctl; + u8 addr4[ETH_ALEN]; + u8 payload[0]; + __le16 qos_ctl; +} __attribute__ ((packed)); + +struct ieee80211_info_element { + u8 id; + u8 len; + u8 data[0]; +} __attribute__ ((packed)); + +struct ieee80211_authentication { + struct ieee80211_hdr_3addr header; + __le16 algorithm; + __le16 transaction; + __le16 status; + /*challenge*/ + struct ieee80211_info_element info_element[0]; +} __attribute__ ((packed)); + +struct ieee80211_disassoc { + struct ieee80211_hdr_3addr header; + __le16 reason; +} __attribute__ ((packed)); + +struct ieee80211_probe_request { + struct ieee80211_hdr_3addr header; + /* SSID, supported rates */ + struct ieee80211_info_element info_element[0]; +} __attribute__ ((packed)); + +struct ieee80211_probe_response { + struct ieee80211_hdr_3addr header; + u32 time_stamp[2]; + __le16 beacon_interval; + __le16 capability; + /* SSID, supported rates, FH params, DS params, + * CF params, IBSS params, TIM (if beacon), RSN */ + struct ieee80211_info_element info_element[0]; +} __attribute__ ((packed)); + +/* Alias beacon for probe_response */ +#define ieee80211_beacon ieee80211_probe_response + +struct ieee80211_assoc_request_frame { + struct ieee80211_hdr_3addr header; + __le16 capability; + __le16 listen_interval; + /* SSID, supported rates, RSN */ + struct ieee80211_info_element info_element[0]; +} __attribute__ ((packed)); + +struct ieee80211_reassoc_request_frame { + struct ieee80211_hdr_3addr header; + __le16 capability; + __le16 listen_interval; + u8 current_ap[ETH_ALEN]; + /* SSID, supported rates, RSN */ + struct ieee80211_info_element info_element[0]; +} __attribute__ ((packed)); + +struct ieee80211_assoc_response_frame { + struct ieee80211_hdr_3addr header; + __le16 capability; + __le16 status; + __le16 aid; + struct ieee80211_info_element info_element[0]; /* supported rates */ +} __attribute__ ((packed)); + +struct ieee80211_txb { + u8 nr_frags; + u8 encrypted; + u8 queue_index; + u8 rts_included; + u16 reserved; + __le16 frag_size; + __le16 payload_size; + struct sk_buff *fragments[0]; +}; + +#define MAX_TX_AGG_COUNT 16 +struct ieee80211_drv_agg_txb { + u8 nr_drv_agg_frames; + struct sk_buff *tx_agg_frames[MAX_TX_AGG_COUNT]; +}__attribute__((packed)); + +#define MAX_SUBFRAME_COUNT 64 +struct ieee80211_rxb { + u8 nr_subframes; + struct sk_buff *subframes[MAX_SUBFRAME_COUNT]; + u8 dst[ETH_ALEN]; + u8 src[ETH_ALEN]; +}__attribute__((packed)); + +typedef union _frameqos { + u16 shortdata; + u8 chardata[2]; + struct { + u16 tid:4; + u16 eosp:1; + u16 ack_policy:2; + u16 reserved:1; + u16 txop:8; + }field; +}frameqos,*pframeqos; + +/* SWEEP TABLE ENTRIES NUMBER*/ +#define MAX_SWEEP_TAB_ENTRIES 42 +#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 +/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs + * only use 8, and then use extended rates for the remaining supported + * rates. Other APs, however, stick all of their supported rates on the + * main rates information element... */ +#define MAX_RATES_LENGTH ((u8)12) +#define MAX_RATES_EX_LENGTH ((u8)16) +#define MAX_NETWORK_COUNT 128 + +#define MAX_CHANNEL_NUMBER 161 +#define IEEE80211_SOFTMAC_SCAN_TIME 100 +//(HZ / 2) +#define IEEE80211_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2) + +#define CRC_LENGTH 4U + +#define MAX_WPA_IE_LEN 64 + +#define NETWORK_EMPTY_ESSID (1<<0) +#define NETWORK_HAS_OFDM (1<<1) +#define NETWORK_HAS_CCK (1<<2) + +/* QoS structure */ +#define NETWORK_HAS_QOS_PARAMETERS (1<<3) +#define NETWORK_HAS_QOS_INFORMATION (1<<4) +#define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \ + NETWORK_HAS_QOS_INFORMATION) +/* 802.11h */ +#define NETWORK_HAS_POWER_CONSTRAINT (1<<5) +#define NETWORK_HAS_CSA (1<<6) +#define NETWORK_HAS_QUIET (1<<7) +#define NETWORK_HAS_IBSS_DFS (1<<8) +#define NETWORK_HAS_TPC_REPORT (1<<9) + +#define NETWORK_HAS_ERP_VALUE (1<<10) + +#define QOS_QUEUE_NUM 4 +#define QOS_OUI_LEN 3 +#define QOS_OUI_TYPE 2 +#define QOS_ELEMENT_ID 221 +#define QOS_OUI_INFO_SUB_TYPE 0 +#define QOS_OUI_PARAM_SUB_TYPE 1 +#define QOS_VERSION_1 1 +#define QOS_AIFSN_MIN_VALUE 2 +#if 1 +struct ieee80211_qos_information_element { + u8 elementID; + u8 length; + u8 qui[QOS_OUI_LEN]; + u8 qui_type; + u8 qui_subtype; + u8 version; + u8 ac_info; +} __attribute__ ((packed)); + +struct ieee80211_qos_ac_parameter { + u8 aci_aifsn; + u8 ecw_min_max; + __le16 tx_op_limit; +} __attribute__ ((packed)); + +struct ieee80211_qos_parameter_info { + struct ieee80211_qos_information_element info_element; + u8 reserved; + struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM]; +} __attribute__ ((packed)); + +struct ieee80211_qos_parameters { + __le16 cw_min[QOS_QUEUE_NUM]; + __le16 cw_max[QOS_QUEUE_NUM]; + u8 aifs[QOS_QUEUE_NUM]; + u8 flag[QOS_QUEUE_NUM]; + __le16 tx_op_limit[QOS_QUEUE_NUM]; +} __attribute__ ((packed)); + +struct ieee80211_qos_data { + struct ieee80211_qos_parameters parameters; + int active; + int supported; + u8 param_count; + u8 old_param_count; +}; + +struct ieee80211_tim_parameters { + u8 tim_count; + u8 tim_period; +} __attribute__ ((packed)); + +//#else +struct ieee80211_wmm_ac_param { + u8 ac_aci_acm_aifsn; + u8 ac_ecwmin_ecwmax; + u16 ac_txop_limit; +}; + +struct ieee80211_wmm_ts_info { + u8 ac_dir_tid; + u8 ac_up_psb; + u8 reserved; +} __attribute__ ((packed)); + +struct ieee80211_wmm_tspec_elem { + struct ieee80211_wmm_ts_info ts_info; + u16 norm_msdu_size; + u16 max_msdu_size; + u32 min_serv_inter; + u32 max_serv_inter; + u32 inact_inter; + u32 suspen_inter; + u32 serv_start_time; + u32 min_data_rate; + u32 mean_data_rate; + u32 peak_data_rate; + u32 max_burst_size; + u32 delay_bound; + u32 min_phy_rate; + u16 surp_band_allow; + u16 medium_time; +}__attribute__((packed)); +#endif +enum eap_type { + EAP_PACKET = 0, + EAPOL_START, + EAPOL_LOGOFF, + EAPOL_KEY, + EAPOL_ENCAP_ASF_ALERT +}; + +static const char *eap_types[] = { + [EAP_PACKET] = "EAP-Packet", + [EAPOL_START] = "EAPOL-Start", + [EAPOL_LOGOFF] = "EAPOL-Logoff", + [EAPOL_KEY] = "EAPOL-Key", + [EAPOL_ENCAP_ASF_ALERT] = "EAPOL-Encap-ASF-Alert" +}; + +static inline const char *eap_get_type(int type) +{ + return ((u32)type >= ARRAY_SIZE(eap_types)) ? "Unknown" : eap_types[type]; +} +//added by amy for reorder +static inline u8 Frame_QoSTID(u8* buf) +{ + struct ieee80211_hdr_3addr *hdr; + u16 fc; + hdr = (struct ieee80211_hdr_3addr *)buf; + fc = le16_to_cpu(hdr->frame_ctl); + return (u8)((frameqos*)(buf + (((fc & IEEE80211_FCTL_TODS)&&(fc & IEEE80211_FCTL_FROMDS))? 30 : 24)))->field.tid; +} + +//added by amy for reorder + +struct eapol { + u8 snap[6]; + u16 ethertype; + u8 version; + u8 type; + u16 length; +} __attribute__ ((packed)); + +struct ieee80211_softmac_stats{ + unsigned int rx_ass_ok; + unsigned int rx_ass_err; + unsigned int rx_probe_rq; + unsigned int tx_probe_rs; + unsigned int tx_beacons; + unsigned int rx_auth_rq; + unsigned int rx_auth_rs_ok; + unsigned int rx_auth_rs_err; + unsigned int tx_auth_rq; + unsigned int no_auth_rs; + unsigned int no_ass_rs; + unsigned int tx_ass_rq; + unsigned int rx_ass_rq; + unsigned int tx_probe_rq; + unsigned int reassoc; + unsigned int swtxstop; + unsigned int swtxawake; + unsigned char CurrentShowTxate; + unsigned char last_packet_rate; + unsigned int txretrycount; +}; + +#define BEACON_PROBE_SSID_ID_POSITION 12 + +struct ieee80211_info_element_hdr { + u8 id; + u8 len; +} __attribute__ ((packed)); + +/* + * These are the data types that can make up management packets + * + u16 auth_algorithm; + u16 auth_sequence; + u16 beacon_interval; + u16 capability; + u8 current_ap[ETH_ALEN]; + u16 listen_interval; + struct { + u16 association_id:14, reserved:2; + } __attribute__ ((packed)); + u32 time_stamp[2]; + u16 reason; + u16 status; +*/ + +#define IEEE80211_DEFAULT_TX_ESSID "Penguin" +#define IEEE80211_DEFAULT_BASIC_RATE 2 //1Mbps + +enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame}; +#define MAX_SP_Len (WMM_all_frame << 4) +#define IEEE80211_QOS_TID 0x0f +#define QOS_CTL_NOTCONTAIN_ACK (0x01 << 5) + +#define IEEE80211_DTIM_MBCAST 4 +#define IEEE80211_DTIM_UCAST 2 +#define IEEE80211_DTIM_VALID 1 +#define IEEE80211_DTIM_INVALID 0 + +#define IEEE80211_PS_DISABLED 0 +#define IEEE80211_PS_UNICAST IEEE80211_DTIM_UCAST +#define IEEE80211_PS_MBCAST IEEE80211_DTIM_MBCAST + +//added by David for QoS 2006/6/30 +//#define WMM_Hang_8187 +#ifdef WMM_Hang_8187 +#undef WMM_Hang_8187 +#endif + +#define WME_AC_BK 0x00 +#define WME_AC_BE 0x01 +#define WME_AC_VI 0x02 +#define WME_AC_VO 0x03 +#define WME_ACI_MASK 0x03 +#define WME_AIFSN_MASK 0x03 +#define WME_AC_PRAM_LEN 16 + +#define MAX_RECEIVE_BUFFER_SIZE 9100 + +//UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP +//#define UP2AC(up) ((up<3) ? ((up==0)?1:0) : (up>>1)) +#if 1 +#define UP2AC(up) ( \ + ((up) < 1) ? WME_AC_BE : \ + ((up) < 3) ? WME_AC_BK : \ + ((up) < 4) ? WME_AC_BE : \ + ((up) < 6) ? WME_AC_VI : \ + WME_AC_VO) +#endif +//AC Mapping to UP, using in Tx part for selecting the corresponding TX queue +#define AC2UP(_ac) ( \ + ((_ac) == WME_AC_VO) ? 6 : \ + ((_ac) == WME_AC_VI) ? 5 : \ + ((_ac) == WME_AC_BK) ? 1 : \ + 0) + +#define ETHER_ADDR_LEN 6 /* length of an Ethernet address */ +#define ETHERNET_HEADER_SIZE 14 /* length of two Ethernet address plus ether type*/ + +struct ether_header { + u8 ether_dhost[ETHER_ADDR_LEN]; + u8 ether_shost[ETHER_ADDR_LEN]; + u16 ether_type; +} __attribute__((packed)); + +#ifndef ETHERTYPE_PAE +#define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */ +#endif +#ifndef ETHERTYPE_IP +#define ETHERTYPE_IP 0x0800 /* IP protocol */ +#endif + +typedef struct _bss_ht{ + + bool support_ht; + + // HT related elements + u8 ht_cap_buf[32]; + u16 ht_cap_len; + u8 ht_info_buf[32]; + u16 ht_info_len; + + HT_SPEC_VER ht_spec_ver; + //HT_CAPABILITY_ELE bdHTCapEle; + //HT_INFORMATION_ELE bdHTInfoEle; + + bool aggregation; + bool long_slot_time; +}bss_ht, *pbss_ht; + +typedef enum _erp_t{ + ERP_NonERPpresent = 0x01, + ERP_UseProtection = 0x02, + ERP_BarkerPreambleMode = 0x04, +} erp_t; + + +struct ieee80211_network { + /* These entries are used to identify a unique network */ + u8 bssid[ETH_ALEN]; + u8 channel; + /* Ensure null-terminated for any debug msgs */ + u8 ssid[IW_ESSID_MAX_SIZE + 1]; + u8 ssid_len; +#if 1 + struct ieee80211_qos_data qos_data; +#else + // Qos related. Added by Annie, 2005-11-01. + BSS_QOS BssQos; +#endif + //added by amy for LEAP + bool bWithAironetIE; + bool bCkipSupported; + bool bCcxRmEnable; + u16 CcxRmState[2]; + // CCXv4 S59, MBSSID. + bool bMBssidValid; + u8 MBssidMask; + u8 MBssid[6]; + // CCX 2 S38, WLAN Device Version Number element. Annie, 2006-08-20. + bool bWithCcxVerNum; + u8 BssCcxVerNumber; + /* These are network statistics */ + struct ieee80211_rx_stats stats; + u16 capability; + u8 rates[MAX_RATES_LENGTH]; + u8 rates_len; + u8 rates_ex[MAX_RATES_EX_LENGTH]; + u8 rates_ex_len; + unsigned long last_scanned; + u8 mode; + u32 flags; + u32 last_associate; + u32 time_stamp[2]; + u16 beacon_interval; + u16 listen_interval; + u16 atim_window; + u8 erp_value; + u8 wpa_ie[MAX_WPA_IE_LEN]; + size_t wpa_ie_len; + u8 rsn_ie[MAX_WPA_IE_LEN]; + size_t rsn_ie_len; + + struct ieee80211_tim_parameters tim; + u8 dtim_period; + u8 dtim_data; + u32 last_dtim_sta_time[2]; + + //appeded for QoS + u8 wmm_info; + struct ieee80211_wmm_ac_param wmm_param[4]; + u8 QoS_Enable; +#ifdef THOMAS_TURBO + u8 Turbo_Enable;//enable turbo mode, added by thomas +#endif +#ifdef ENABLE_DOT11D + u16 CountryIeLen; + u8 CountryIeBuf[MAX_IE_LEN]; +#endif + // HT Related, by amy, 2008.04.29 + BSS_HT bssht; + // Add to handle broadcom AP management frame CCK rate. + bool broadcom_cap_exist; + bool ralink_cap_exist; + bool atheros_cap_exist; + bool cisco_cap_exist; + bool unknown_cap_exist; +// u8 berp_info; + bool berp_info_valid; + bool buseprotection; + //put at the end of the structure. + struct list_head list; +}; + +#if 1 +enum ieee80211_state { + + /* the card is not linked at all */ + IEEE80211_NOLINK = 0, + + /* IEEE80211_ASSOCIATING* are for BSS client mode + * the driver shall not perform RX filtering unless + * the state is LINKED. + * The driver shall just check for the state LINKED and + * defaults to NOLINK for ALL the other states (including + * LINKED_SCANNING) + */ + + /* the association procedure will start (wq scheduling)*/ + IEEE80211_ASSOCIATING, + IEEE80211_ASSOCIATING_RETRY, + + /* the association procedure is sending AUTH request*/ + IEEE80211_ASSOCIATING_AUTHENTICATING, + + /* the association procedure has successfully authentcated + * and is sending association request + */ + IEEE80211_ASSOCIATING_AUTHENTICATED, + + /* the link is ok. the card associated to a BSS or linked + * to a ibss cell or acting as an AP and creating the bss + */ + IEEE80211_LINKED, + + /* same as LINKED, but the driver shall apply RX filter + * rules as we are in NO_LINK mode. As the card is still + * logically linked, but it is doing a syncro site survey + * then it will be back to LINKED state. + */ + IEEE80211_LINKED_SCANNING, + +}; +#else +enum ieee80211_state { + IEEE80211_UNINITIALIZED = 0, + IEEE80211_INITIALIZED, + IEEE80211_ASSOCIATING, + IEEE80211_ASSOCIATED, + IEEE80211_AUTHENTICATING, + IEEE80211_AUTHENTICATED, + IEEE80211_SHUTDOWN +}; +#endif + +#define DEFAULT_MAX_SCAN_AGE (15 * HZ) +#define DEFAULT_FTS 2346 + +#define CFG_IEEE80211_RESERVE_FCS (1<<0) +#define CFG_IEEE80211_COMPUTE_FCS (1<<1) +#define CFG_IEEE80211_RTS (1<<2) + +#define IEEE80211_24GHZ_MIN_CHANNEL 1 +#define IEEE80211_24GHZ_MAX_CHANNEL 14 +#define IEEE80211_24GHZ_CHANNELS (IEEE80211_24GHZ_MAX_CHANNEL - \ + IEEE80211_24GHZ_MIN_CHANNEL + 1) + +#define IEEE80211_52GHZ_MIN_CHANNEL 34 +#define IEEE80211_52GHZ_MAX_CHANNEL 165 +#define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \ + IEEE80211_52GHZ_MIN_CHANNEL + 1) + +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11)) +extern inline int is_multicast_ether_addr(const u8 *addr) +{ + return ((addr[0] != 0xff) && (0x01 & addr[0])); +} +#endif + +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13)) +extern inline int is_broadcast_ether_addr(const u8 *addr) +{ + return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \ + (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); +} +#endif + +typedef struct tx_pending_t{ + int frag; + struct ieee80211_txb *txb; +}tx_pending_t; + +typedef struct _bandwidth_autoswitch +{ + long threshold_20Mhzto40Mhz; + long threshold_40Mhzto20Mhz; + bool bforced_tx20Mhz; + bool bautoswitch_enable; +}bandwidth_autoswitch,*pbandwidth_autoswitch; + + +//added by amy for order + +#define REORDER_WIN_SIZE 128 +#define REORDER_ENTRY_NUM 128 +typedef struct _RX_REORDER_ENTRY +{ + struct list_head List; + u16 SeqNum; + struct ieee80211_rxb* prxb; +} RX_REORDER_ENTRY, *PRX_REORDER_ENTRY; +//added by amy for order +typedef enum _Fsync_State{ + Default_Fsync, + HW_Fsync, + SW_Fsync +}Fsync_State; + +// Power save mode configured. +typedef enum _RT_PS_MODE +{ + eActive, // Active/Continuous access. + eMaxPs, // Max power save mode. + eFastPs // Fast power save mode. +}RT_PS_MODE; + +typedef enum _IPS_CALLBACK_FUNCION +{ + IPS_CALLBACK_NONE = 0, + IPS_CALLBACK_MGNT_LINK_REQUEST = 1, + IPS_CALLBACK_JOIN_REQUEST = 2, +}IPS_CALLBACK_FUNCION; + +typedef enum _RT_JOIN_ACTION{ + RT_JOIN_INFRA = 1, + RT_JOIN_IBSS = 2, + RT_START_IBSS = 3, + RT_NO_ACTION = 4, +}RT_JOIN_ACTION; + +typedef struct _IbssParms{ + u16 atimWin; +}IbssParms, *PIbssParms; +#define MAX_NUM_RATES 264 // Max num of support rates element: 8, Max num of ext. support rate: 255. 061122, by rcnjko. + +// RF state. +typedef enum _RT_RF_POWER_STATE +{ + eRfOn, + eRfSleep, + eRfOff +}RT_RF_POWER_STATE; + +typedef struct _RT_POWER_SAVE_CONTROL +{ + + // + // Inactive Power Save(IPS) : Disable RF when disconnected + // + bool bInactivePs; + bool bIPSModeBackup; + bool bSwRfProcessing; + RT_RF_POWER_STATE eInactivePowerState; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + struct work_struct InactivePsWorkItem; +#else + struct tq_struct InactivePsWorkItem; +#endif + struct timer_list InactivePsTimer; + + // Return point for join action + IPS_CALLBACK_FUNCION ReturnPoint; + + // Recored Parameters for rescheduled JoinRequest + bool bTmpBssDesc; + RT_JOIN_ACTION tmpJoinAction; + struct ieee80211_network tmpBssDesc; + + // Recored Parameters for rescheduled MgntLinkRequest + bool bTmpScanOnly; + bool bTmpActiveScan; + bool bTmpFilterHiddenAP; + bool bTmpUpdateParms; + u8 tmpSsidBuf[33]; + OCTET_STRING tmpSsid2Scan; + bool bTmpSsid2Scan; + u8 tmpNetworkType; + u8 tmpChannelNumber; + u16 tmpBcnPeriod; + u8 tmpDtimPeriod; + u16 tmpmCap; + OCTET_STRING tmpSuppRateSet; + u8 tmpSuppRateBuf[MAX_NUM_RATES]; + bool bTmpSuppRate; + IbssParms tmpIbpm; + bool bTmpIbpm; + + // + // Leisre Poswer Save : Disable RF if connected but traffic is not busy + // + bool bLeisurePs; + +}RT_POWER_SAVE_CONTROL,*PRT_POWER_SAVE_CONTROL; + +typedef u32 RT_RF_CHANGE_SOURCE; +#define RF_CHANGE_BY_SW BIT31 +#define RF_CHANGE_BY_HW BIT30 +#define RF_CHANGE_BY_PS BIT29 +#define RF_CHANGE_BY_IPS BIT28 +#define RF_CHANGE_BY_INIT 0 // Do not change the RFOff reason. Defined by Bruce, 2008-01-17. + +#ifdef ENABLE_DOT11D +typedef enum +{ + COUNTRY_CODE_FCC = 0, + COUNTRY_CODE_IC = 1, + COUNTRY_CODE_ETSI = 2, + COUNTRY_CODE_SPAIN = 3, + COUNTRY_CODE_FRANCE = 4, + COUNTRY_CODE_MKK = 5, + COUNTRY_CODE_MKK1 = 6, + COUNTRY_CODE_ISRAEL = 7, + COUNTRY_CODE_TELEC, + COUNTRY_CODE_MIC, + COUNTRY_CODE_GLOBAL_DOMAIN +}country_code_type_t; +#endif + +#define RT_MAX_LD_SLOT_NUM 10 +typedef struct _RT_LINK_DETECT_T{ + + u32 NumRecvBcnInPeriod; + u32 NumRecvDataInPeriod; + + u32 RxBcnNum[RT_MAX_LD_SLOT_NUM]; // number of Rx beacon / CheckForHang_period to determine link status + u32 RxDataNum[RT_MAX_LD_SLOT_NUM]; // number of Rx data / CheckForHang_period to determine link status + u16 SlotNum; // number of CheckForHang period to determine link status + u16 SlotIndex; + + u32 NumTxOkInPeriod; + u32 NumRxOkInPeriod; + bool bBusyTraffic; +}RT_LINK_DETECT_T, *PRT_LINK_DETECT_T; + + +struct ieee80211_device { + struct net_device *dev; + struct ieee80211_security sec; + + //hw security related +// u8 hwsec_support; //support? + u8 hwsec_active; //hw security active. + bool is_silent_reset; + bool ieee_up; + //added by amy + bool bSupportRemoteWakeUp; + RT_PS_MODE dot11PowerSaveMode; // Power save mode configured. + bool actscanning; + bool beinretry; + RT_RF_POWER_STATE eRFPowerState; + RT_RF_CHANGE_SOURCE RfOffReason; + bool is_set_key; + //11n spec related I wonder if These info structure need to be moved out of ieee80211_device + + //11n HT below + PRT_HIGH_THROUGHPUT pHTInfo; + //struct timer_list SwBwTimer; +// spinlock_t chnlop_spinlock; + spinlock_t bw_spinlock; + + spinlock_t reorder_spinlock; + // for HT operation rate set. we use this one for HT data rate to seperate different descriptors + //the way fill this is the same as in the IE + u8 Regdot11HTOperationalRateSet[16]; //use RATR format + u8 dot11HTOperationalRateSet[16]; //use RATR format + u8 RegHTSuppRateSet[16]; + u8 HTCurrentOperaRate; + u8 HTHighestOperaRate; + //wb added for rate operation mode to firmware + u8 bTxDisableRateFallBack; + u8 bTxUseDriverAssingedRate; + atomic_t atm_chnlop; + atomic_t atm_swbw; +// u8 HTHighestOperaRate; +// u8 HTCurrentOperaRate; + + // 802.11e and WMM Traffic Stream Info (TX) + struct list_head Tx_TS_Admit_List; + struct list_head Tx_TS_Pending_List; + struct list_head Tx_TS_Unused_List; + TX_TS_RECORD TxTsRecord[TOTAL_TS_NUM]; + // 802.11e and WMM Traffic Stream Info (RX) + struct list_head Rx_TS_Admit_List; + struct list_head Rx_TS_Pending_List; + struct list_head Rx_TS_Unused_List; + RX_TS_RECORD RxTsRecord[TOTAL_TS_NUM]; +//#ifdef TO_DO_LIST + RX_REORDER_ENTRY RxReorderEntry[128]; + struct list_head RxReorder_Unused_List; +//#endif + // Qos related. Added by Annie, 2005-11-01. +// PSTA_QOS pStaQos; + u8 ForcedPriority; // Force per-packet priority 1~7. (default: 0, not to force it.) + + + /* Bookkeeping structures */ + struct net_device_stats stats; + struct ieee80211_stats ieee_stats; + struct ieee80211_softmac_stats softmac_stats; + + /* Probe / Beacon management */ + struct list_head network_free_list; + struct list_head network_list; + struct ieee80211_network *networks; + int scans; + int scan_age; + + int iw_mode; /* operating mode (IW_MODE_*) */ + struct iw_spy_data spy_data; + + spinlock_t lock; + spinlock_t wpax_suitlist_lock; + + int tx_headroom; /* Set to size of any additional room needed at front + * of allocated Tx SKBs */ + u32 config; + + /* WEP and other encryption related settings at the device level */ + int open_wep; /* Set to 1 to allow unencrypted frames */ + int auth_mode; + int reset_on_keychange; /* Set to 1 if the HW needs to be reset on + * WEP key changes */ + + /* If the host performs {en,de}cryption, then set to 1 */ + int host_encrypt; + int host_encrypt_msdu; + int host_decrypt; + /* host performs multicast decryption */ + int host_mc_decrypt; + + /* host should strip IV and ICV from protected frames */ + /* meaningful only when hardware decryption is being used */ + int host_strip_iv_icv; + + int host_open_frag; + int host_build_iv; + int ieee802_1x; /* is IEEE 802.1X used */ + + /* WPA data */ + bool bHalfWirelessN24GMode; + int wpa_enabled; + int drop_unencrypted; + int tkip_countermeasures; + int privacy_invoked; + size_t wpa_ie_len; + u8 *wpa_ie; + u8 ap_mac_addr[6]; + u16 pairwise_key_type; + u16 group_key_type; + struct list_head crypt_deinit_list; + struct ieee80211_crypt_data *crypt[WEP_KEYS]; + int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */ + struct timer_list crypt_deinit_timer; + int crypt_quiesced; + + int bcrx_sta_key; /* use individual keys to override default keys even + * with RX of broad/multicast frames */ + + /* Fragmentation structures */ + // each streaming contain a entry + struct ieee80211_frag_entry frag_cache[17][IEEE80211_FRAG_CACHE_LEN]; + unsigned int frag_next_idx[17]; + u16 fts; /* Fragmentation Threshold */ +#define DEFAULT_RTS_THRESHOLD 2346U +#define MIN_RTS_THRESHOLD 1 +#define MAX_RTS_THRESHOLD 2346U + u16 rts; /* RTS threshold */ + + /* Association info */ + u8 bssid[ETH_ALEN]; + + /* This stores infos for the current network. + * Either the network we are associated in INFRASTRUCTURE + * or the network that we are creating in MASTER mode. + * ad-hoc is a mixture ;-). + * Note that in infrastructure mode, even when not associated, + * fields bssid and essid may be valid (if wpa_set and essid_set + * are true) as thy carry the value set by the user via iwconfig + */ + struct ieee80211_network current_network; + + enum ieee80211_state state; + + int short_slot; + int reg_mode; + int mode; /* A, B, G */ + int modulation; /* CCK, OFDM */ + int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */ + int abg_true; /* ABG flag */ + + /* used for forcing the ibss workqueue to terminate + * without wait for the syncro scan to terminate + */ + short sync_scan_hurryup; + + int perfect_rssi; + int worst_rssi; + + u16 prev_seq_ctl; /* used to drop duplicate frames */ + + /* map of allowed channels. 0 is dummy */ + // FIXME: remeber to default to a basic channel plan depending of the PHY type +#ifdef ENABLE_DOT11D + void* pDot11dInfo; + bool bGlobalDomain; +#else + int channel_map[MAX_CHANNEL_NUMBER+1]; +#endif + int rate; /* current rate */ + int basic_rate; + //FIXME: pleace callback, see if redundant with softmac_features + short active_scan; + + /* this contains flags for selectively enable softmac support */ + u16 softmac_features; + + /* if the sequence control field is not filled by HW */ + u16 seq_ctrl[5]; + + /* association procedure transaction sequence number */ + u16 associate_seq; + + /* AID for RTXed association responses */ + u16 assoc_id; + + /* power save mode related*/ + short ps; + short sta_sleep; + int ps_timeout; + int ps_period; + struct tasklet_struct ps_task; + u32 ps_th; + u32 ps_tl; + + short raw_tx; + /* used if IEEE_SOFTMAC_TX_QUEUE is set */ + short queue_stop; + short scanning; + short proto_started; + + struct semaphore wx_sem; + struct semaphore scan_sem; + + spinlock_t mgmt_tx_lock; + spinlock_t beacon_lock; + + short beacon_txing; + + short wap_set; + short ssid_set; + + u8 wpax_type_set; //{added by David, 2006.9.28} + u32 wpax_type_notify; //{added by David, 2006.9.26} + + /* QoS related flag */ + char init_wmmparam_flag; + /* set on initialization */ + u8 qos_support; + + /* for discarding duplicated packets in IBSS */ + struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE]; + + /* for discarding duplicated packets in BSS */ + u16 last_rxseq_num[17]; /* rx seq previous per-tid */ + u16 last_rxfrag_num[17];/* tx frag previous per-tid */ + unsigned long last_packet_time[17]; + + /* for PS mode */ + unsigned long last_rx_ps_time; + + /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */ + struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM]; + int mgmt_queue_head; + int mgmt_queue_tail; +//{ added for rtl819x +#define IEEE80211_QUEUE_LIMIT 128 + u8 AsocRetryCount; + unsigned int hw_header; + struct sk_buff_head skb_waitQ[MAX_QUEUE_SIZE]; + struct sk_buff_head skb_aggQ[MAX_QUEUE_SIZE]; + struct sk_buff_head skb_drv_aggQ[MAX_QUEUE_SIZE]; + u32 sta_edca_param[4]; + bool aggregation; + // Enable/Disable Rx immediate BA capability. + bool enable_rx_imm_BA; + bool bibsscoordinator; + + //+by amy for DM ,080515 + //Dynamic Tx power for near/far range enable/Disable , by amy , 2008-05-15 + bool bdynamic_txpower_enable; + + bool bCTSToSelfEnable; + u8 CTSToSelfTH; + + u32 fsync_time_interval; + u32 fsync_rate_bitmap; + u8 fsync_rssi_threshold; + bool bfsync_enable; + + u8 fsync_multiple_timeinterval; // FsyncMultipleTimeInterval * FsyncTimeInterval + u32 fsync_firstdiff_ratethreshold; // low threshold + u32 fsync_seconddiff_ratethreshold; // decrease threshold + Fsync_State fsync_state; + bool bis_any_nonbepkts; + //20Mhz 40Mhz AutoSwitch Threshold + bandwidth_autoswitch bandwidth_auto_switch; + //for txpower tracking + bool FwRWRF; + + //added by amy for AP roaming + RT_LINK_DETECT_T LinkDetectInfo; + //added by amy for ps + RT_POWER_SAVE_CONTROL PowerSaveControl; +//} + /* used if IEEE_SOFTMAC_TX_QUEUE is set */ + struct tx_pending_t tx_pending; + + /* used if IEEE_SOFTMAC_ASSOCIATE is set */ + struct timer_list associate_timer; + + /* used if IEEE_SOFTMAC_BEACONS is set */ + struct timer_list beacon_timer; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + struct work_struct associate_complete_wq; + struct work_struct associate_procedure_wq; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) + struct delayed_work softmac_scan_wq; + struct delayed_work associate_retry_wq; + struct delayed_work start_ibss_wq; +#else + struct work_struct softmac_scan_wq; + struct work_struct associate_retry_wq; + struct work_struct start_ibss_wq; +#endif + struct work_struct wx_sync_scan_wq; + struct workqueue_struct *wq; +#else + /* used for periodly scan */ + struct timer_list scan_timer; + + struct tq_struct associate_complete_wq; + struct tq_struct associate_retry_wq; + struct tq_struct start_ibss_wq; + struct tq_struct associate_procedure_wq; + struct tq_struct softmac_scan_wq; + struct tq_struct wx_sync_scan_wq; + +#endif + // Qos related. Added by Annie, 2005-11-01. + //STA_QOS StaQos; + + //u32 STA_EDCA_PARAM[4]; + //CHANNEL_ACCESS_SETTING ChannelAccessSetting; + + + /* Callback functions */ + void (*set_security)(struct net_device *dev, + struct ieee80211_security *sec); + + /* Used to TX data frame by using txb structs. + * this is not used if in the softmac_features + * is set the flag IEEE_SOFTMAC_TX_QUEUE + */ + int (*hard_start_xmit)(struct ieee80211_txb *txb, + struct net_device *dev); + + int (*reset_port)(struct net_device *dev); + int (*is_queue_full) (struct net_device * dev, int pri); + + int (*handle_management) (struct net_device * dev, + struct ieee80211_network * network, u16 type); + int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb); + + /* Softmac-generated frames (mamagement) are TXed via this + * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is + * not set. As some cards may have different HW queues that + * one might want to use for data and management frames + * the option to have two callbacks might be useful. + * This fucntion can't sleep. + */ + int (*softmac_hard_start_xmit)(struct sk_buff *skb, + struct net_device *dev); + + /* used instead of hard_start_xmit (not softmac_hard_start_xmit) + * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data + * frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set + * then also management frames are sent via this callback. + * This function can't sleep. + */ + void (*softmac_data_hard_start_xmit)(struct sk_buff *skb, + struct net_device *dev,int rate); + + /* stops the HW queue for DATA frames. Useful to avoid + * waste time to TX data frame when we are reassociating + * This function can sleep. + */ + void (*data_hard_stop)(struct net_device *dev); + + /* OK this is complementar to data_poll_hard_stop */ + void (*data_hard_resume)(struct net_device *dev); + + /* ask to the driver to retune the radio . + * This function can sleep. the driver should ensure + * the radio has been swithced before return. + */ + void (*set_chan)(struct net_device *dev,short ch); + + /* These are not used if the ieee stack takes care of + * scanning (IEEE_SOFTMAC_SCAN feature set). + * In this case only the set_chan is used. + * + * The syncro version is similar to the start_scan but + * does not return until all channels has been scanned. + * this is called in user context and should sleep, + * it is called in a work_queue when swithcing to ad-hoc mode + * or in behalf of iwlist scan when the card is associated + * and root user ask for a scan. + * the fucntion stop_scan should stop both the syncro and + * background scanning and can sleep. + * The fucntion start_scan should initiate the background + * scanning and can't sleep. + */ + void (*scan_syncro)(struct net_device *dev); + void (*start_scan)(struct net_device *dev); + void (*stop_scan)(struct net_device *dev); + + /* indicate the driver that the link state is changed + * for example it may indicate the card is associated now. + * Driver might be interested in this to apply RX filter + * rules or simply light the LINK led + */ + void (*link_change)(struct net_device *dev); + + /* these two function indicates to the HW when to start + * and stop to send beacons. This is used when the + * IEEE_SOFTMAC_BEACONS is not set. For now the + * stop_send_bacons is NOT guaranteed to be called only + * after start_send_beacons. + */ + void (*start_send_beacons) (struct net_device *dev,u16 tx_rate); + void (*stop_send_beacons) (struct net_device *dev); + + /* power save mode related */ + void (*sta_wake_up) (struct net_device *dev); + void (*ps_request_tx_ack) (struct net_device *dev); + void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl); + short (*ps_is_queue_empty) (struct net_device *dev); +#if 0 + /* Typical STA methods */ + int (*handle_auth) (struct net_device * dev, + struct ieee80211_auth * auth); + int (*handle_deauth) (struct net_device * dev, + struct ieee80211_deauth * auth); + int (*handle_action) (struct net_device * dev, + struct ieee80211_action * action, + struct ieee80211_rx_stats * stats); + int (*handle_disassoc) (struct net_device * dev, + struct ieee80211_disassoc * assoc); +#endif + int (*handle_beacon) (struct net_device * dev, struct ieee80211_beacon * beacon, struct ieee80211_network * network); +#if 0 + int (*handle_probe_response) (struct net_device * dev, + struct ieee80211_probe_response * resp, + struct ieee80211_network * network); + int (*handle_probe_request) (struct net_device * dev, + struct ieee80211_probe_request * req, + struct ieee80211_rx_stats * stats); +#endif + int (*handle_assoc_response) (struct net_device * dev, struct ieee80211_assoc_response_frame * resp, struct ieee80211_network * network); + +#if 0 + /* Typical AP methods */ + int (*handle_assoc_request) (struct net_device * dev); + int (*handle_reassoc_request) (struct net_device * dev, + struct ieee80211_reassoc_request * req); +#endif + + /* check whether Tx hw resouce available */ + short (*check_nic_enough_desc)(struct net_device *dev, int queue_index); + //added by wb for HT related +// void (*SwChnlByTimerHandler)(struct net_device *dev, int channel); + void (*SetBWModeHandler)(struct net_device *dev, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset); +// void (*UpdateHalRATRTableHandler)(struct net_device* dev, u8* pMcsRate); + bool (*GetNmodeSupportBySecCfg)(struct net_device* dev); + void (*SetWirelessMode)(struct net_device* dev, u8 wireless_mode); + bool (*GetHalfNmodeSupportByAPsHandler)(struct net_device* dev); + void (*InitialGainHandler)(struct net_device *dev, u8 Operation); + + /* This must be the last item so that it points to the data + * allocated beyond this structure by alloc_ieee80211 */ + u8 priv[0]; +}; + +#define IEEE_A (1<<0) +#define IEEE_B (1<<1) +#define IEEE_G (1<<2) +#define IEEE_N_24G (1<<4) +#define IEEE_N_5G (1<<5) +#define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) + +/* Generate a 802.11 header */ + +/* Uses the channel change callback directly + * instead of [start/stop] scan callbacks + */ +#define IEEE_SOFTMAC_SCAN (1<<2) + +/* Perform authentication and association handshake */ +#define IEEE_SOFTMAC_ASSOCIATE (1<<3) + +/* Generate probe requests */ +#define IEEE_SOFTMAC_PROBERQ (1<<4) + +/* Generate respones to probe requests */ +#define IEEE_SOFTMAC_PROBERS (1<<5) + +/* The ieee802.11 stack will manages the netif queue + * wake/stop for the driver, taking care of 802.11 + * fragmentation. See softmac.c for details. */ +#define IEEE_SOFTMAC_TX_QUEUE (1<<7) + +/* Uses only the softmac_data_hard_start_xmit + * even for TX management frames. + */ +#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8) + +/* Generate beacons. The stack will enqueue beacons + * to the card + */ +#define IEEE_SOFTMAC_BEACONS (1<<6) + +static inline void *ieee80211_priv(struct net_device *dev) +{ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + return ((struct ieee80211_device *)netdev_priv(dev))->priv; +#else + return ((struct ieee80211_device *)dev->priv)->priv; +#endif +} + +extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) +{ + /* Single white space is for Linksys APs */ + if (essid_len == 1 && essid[0] == ' ') + return 1; + + /* Otherwise, if the entire essid is 0, we assume it is hidden */ + while (essid_len) { + essid_len--; + if (essid[essid_len] != '\0') + return 0; + } + + return 1; +} + +extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) +{ + /* + * It is possible for both access points and our device to support + * combinations of modes, so as long as there is one valid combination + * of ap/device supported modes, then return success + * + */ + if ((mode & IEEE_A) && + (ieee->modulation & IEEE80211_OFDM_MODULATION) && + (ieee->freq_band & IEEE80211_52GHZ_BAND)) + return 1; + + if ((mode & IEEE_G) && + (ieee->modulation & IEEE80211_OFDM_MODULATION) && + (ieee->freq_band & IEEE80211_24GHZ_BAND)) + return 1; + + if ((mode & IEEE_B) && + (ieee->modulation & IEEE80211_CCK_MODULATION) && + (ieee->freq_band & IEEE80211_24GHZ_BAND)) + return 1; + + return 0; +} + +extern inline int ieee80211_get_hdrlen(u16 fc) +{ + int hdrlen = IEEE80211_3ADDR_LEN; + + switch (WLAN_FC_GET_TYPE(fc)) { + case IEEE80211_FTYPE_DATA: + if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) + hdrlen = IEEE80211_4ADDR_LEN; /* Addr4 */ + if(IEEE80211_QOS_HAS_SEQ(fc)) + hdrlen += 2; /* QOS ctrl*/ + break; + case IEEE80211_FTYPE_CTL: + switch (WLAN_FC_GET_STYPE(fc)) { + case IEEE80211_STYPE_CTS: + case IEEE80211_STYPE_ACK: + hdrlen = IEEE80211_1ADDR_LEN; + break; + default: + hdrlen = IEEE80211_2ADDR_LEN; + break; + } + break; + } + + return hdrlen; +} + +static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr) +{ + switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) { + case IEEE80211_1ADDR_LEN: + return ((struct ieee80211_hdr_1addr *)hdr)->payload; + case IEEE80211_2ADDR_LEN: + return ((struct ieee80211_hdr_2addr *)hdr)->payload; + case IEEE80211_3ADDR_LEN: + return ((struct ieee80211_hdr_3addr *)hdr)->payload; + case IEEE80211_4ADDR_LEN: + return ((struct ieee80211_hdr_4addr *)hdr)->payload; + } + return NULL; +} + +static inline int ieee80211_is_ofdm_rate(u8 rate) +{ + switch (rate & ~IEEE80211_BASIC_RATE_MASK) { + case IEEE80211_OFDM_RATE_6MB: + case IEEE80211_OFDM_RATE_9MB: + case IEEE80211_OFDM_RATE_12MB: + case IEEE80211_OFDM_RATE_18MB: + case IEEE80211_OFDM_RATE_24MB: + case IEEE80211_OFDM_RATE_36MB: + case IEEE80211_OFDM_RATE_48MB: + case IEEE80211_OFDM_RATE_54MB: + return 1; + } + return 0; +} + +static inline int ieee80211_is_cck_rate(u8 rate) +{ + switch (rate & ~IEEE80211_BASIC_RATE_MASK) { + case IEEE80211_CCK_RATE_1MB: + case IEEE80211_CCK_RATE_2MB: + case IEEE80211_CCK_RATE_5MB: + case IEEE80211_CCK_RATE_11MB: + return 1; + } + return 0; +} + + +/* ieee80211.c */ +extern void free_ieee80211(struct net_device *dev); +extern struct net_device *alloc_ieee80211(int sizeof_priv); + +extern int ieee80211_set_encryption(struct ieee80211_device *ieee); + +/* ieee80211_tx.c */ + +extern int ieee80211_encrypt_fragment( + struct ieee80211_device *ieee, + struct sk_buff *frag, + int hdr_len); + +extern int ieee80211_xmit(struct sk_buff *skb, + struct net_device *dev); +extern void ieee80211_txb_free(struct ieee80211_txb *); + + +/* ieee80211_rx.c */ +extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, + struct ieee80211_rx_stats *rx_stats); +extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, + struct ieee80211_hdr_4addr *header, + struct ieee80211_rx_stats *stats); + +/* ieee80211_wx.c */ +extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *key); +extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *key); +extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *key); +#if WIRELESS_EXT >= 18 +extern int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data* wrqu, char *extra); +extern int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data* wrqu, char *extra); +extern int ieee80211_wx_set_auth(struct ieee80211_device *ieee, + struct iw_request_info *info, + struct iw_param *data, char *extra); +extern int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); +#endif +extern int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len); + +/* ieee80211_softmac.c */ +extern short ieee80211_is_54g(struct ieee80211_network net); +extern short ieee80211_is_shortslot(struct ieee80211_network net); +extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, + struct ieee80211_rx_stats *rx_stats, u16 type, + u16 stype); +extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net); + +void SendDisassociation(struct ieee80211_device *ieee, u8* asSta, u8 asRsn); +extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee); + +extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); +extern void notify_wx_assoc_event(struct ieee80211_device *ieee); +extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee); +extern void ieee80211_start_bss(struct ieee80211_device *ieee); +extern void ieee80211_start_master_bss(struct ieee80211_device *ieee); +extern void ieee80211_start_ibss(struct ieee80211_device *ieee); +extern void ieee80211_softmac_init(struct ieee80211_device *ieee); +extern void ieee80211_softmac_free(struct ieee80211_device *ieee); +extern void ieee80211_associate_abort(struct ieee80211_device *ieee); +extern void ieee80211_disassociate(struct ieee80211_device *ieee); +extern void ieee80211_stop_scan(struct ieee80211_device *ieee); +extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee); +extern void ieee80211_check_all_nets(struct ieee80211_device *ieee); +extern void ieee80211_start_protocol(struct ieee80211_device *ieee); +extern void ieee80211_stop_protocol(struct ieee80211_device *ieee); +extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee); +extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee); +extern void ieee80211_reset_queue(struct ieee80211_device *ieee); +extern void ieee80211_wake_queue(struct ieee80211_device *ieee); +extern void ieee80211_stop_queue(struct ieee80211_device *ieee); +extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee); +extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee); +extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); +extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p); +extern void notify_wx_assoc_event(struct ieee80211_device *ieee); +extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success); + +extern void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee); + +/* ieee80211_crypt_ccmp&tkip&wep.c */ +extern void ieee80211_tkip_null(void); +extern void ieee80211_wep_null(void); +extern void ieee80211_ccmp_null(void); + +/* ieee80211_softmac_wx.c */ + +extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *ext); + +extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *awrq, + char *extra); + +extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b); + +extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); + +extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); + +extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b); + +extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b); + +extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *extra); + +extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b); + +extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b); + +extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b); + +//extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +extern void ieee80211_wx_sync_scan_wq(struct work_struct *work); +#else + extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); +#endif + + +extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); + +extern int ieee80211_wx_get_name(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); + +extern int ieee80211_wx_set_power(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); + +extern int ieee80211_wx_get_power(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); + +extern int ieee80211_wx_set_rts(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); + +extern int ieee80211_wx_get_rts(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); +//HT +#define MAX_RECEIVE_BUFFER_SIZE 9100 // +extern void HTDebugHTCapability(u8* CapIE, u8* TitleString ); +extern void HTDebugHTInfo(u8* InfoIE, u8* TitleString); + +void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset); +extern void HTUpdateDefaultSetting(struct ieee80211_device* ieee); +extern void HTConstructCapabilityElement(struct ieee80211_device* ieee, u8* posHTCap, u8* len, u8 isEncrypt); +extern void HTConstructInfoElement(struct ieee80211_device* ieee, u8* posHTInfo, u8* len, u8 isEncrypt); +extern void HTConstructRT2RTAggElement(struct ieee80211_device* ieee, u8* posRT2RTAgg, u8* len); +extern void HTOnAssocRsp(struct ieee80211_device *ieee); +extern void HTInitializeHTInfo(struct ieee80211_device* ieee); +extern void HTInitializeBssDesc(PBSS_HT pBssHT); +extern void HTResetSelfAndSavePeerSetting(struct ieee80211_device* ieee, struct ieee80211_network * pNetwork); +extern void HTUpdateSelfAndPeerSetting(struct ieee80211_device* ieee, struct ieee80211_network * pNetwork); +extern u8 HTGetHighestMCSRate(struct ieee80211_device* ieee, u8* pMCSRateSet, u8* pMCSFilter); +extern u8 MCS_FILTER_ALL[]; +extern u16 MCS_DATA_RATE[2][2][77] ; +extern u8 HTCCheck(struct ieee80211_device* ieee, u8* pFrame); +//extern void HTSetConnectBwModeCallback(unsigned long data); +extern void HTResetIOTSetting(PRT_HIGH_THROUGHPUT pHTInfo); +extern bool IsHTHalfNmodeAPs(struct ieee80211_device* ieee); +extern u16 HTHalfMcsToDataRate(struct ieee80211_device* ieee, u8 nMcsRate); +extern u16 HTMcsToDataRate( struct ieee80211_device* ieee, u8 nMcsRate); +extern u16 TxCountToDataRate( struct ieee80211_device* ieee, u8 nDataRate); +//function in BAPROC.c +extern int ieee80211_rx_ADDBAReq( struct ieee80211_device* ieee, struct sk_buff *skb); +extern int ieee80211_rx_ADDBARsp( struct ieee80211_device* ieee, struct sk_buff *skb); +extern int ieee80211_rx_DELBA(struct ieee80211_device* ieee,struct sk_buff *skb); +extern void TsInitAddBA( struct ieee80211_device* ieee, PTX_TS_RECORD pTS, u8 Policy, u8 bOverwritePending); +extern void TsInitDelBA( struct ieee80211_device* ieee, PTS_COMMON_INFO pTsCommonInfo, TR_SELECT TxRxSelect); +extern void BaSetupTimeOut(unsigned long data); +extern void TxBaInactTimeout(unsigned long data); +extern void RxBaInactTimeout(unsigned long data); +extern void ResetBaEntry( PBA_RECORD pBA); +//function in TS.c +extern bool GetTs( + struct ieee80211_device* ieee, + PTS_COMMON_INFO *ppTS, + u8* Addr, + u8 TID, + TR_SELECT TxRxSelect, //Rx:1, Tx:0 + bool bAddNewTs + ); +extern void TSInitialize(struct ieee80211_device *ieee); +extern void TsStartAddBaProcess(struct ieee80211_device* ieee, PTX_TS_RECORD pTxTS); +extern void RemovePeerTS(struct ieee80211_device* ieee, u8* Addr); +extern void RemoveAllTS(struct ieee80211_device* ieee); +void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee); + +extern const long ieee80211_wlan_frequencies[]; + +extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee) +{ + ieee->scans++; +} + +extern inline int ieee80211_get_scans(struct ieee80211_device *ieee) +{ + return ieee->scans; +} + +static inline const char *escape_essid(const char *essid, u8 essid_len) { + static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; + const char *s = essid; + char *d = escaped; + + if (ieee80211_is_empty_essid(essid, essid_len)) { + memcpy(escaped, "", sizeof("")); + return escaped; + } + + essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE); + while (essid_len--) { + if (*s == '\0') { + *d++ = '\\'; + *d++ = '0'; + s++; + } else { + *d++ = *s++; + } + } + *d = '\0'; + return escaped; +} + +/* For the function is more related to hardware setting, it's better to use the + * ieee handler to refer to it. + */ +extern short check_nic_enough_desc(struct net_device *dev, int queue_index); +extern int ieee80211_data_xmit(struct sk_buff *skb, struct net_device *dev); +extern int ieee80211_parse_info_param(struct ieee80211_device *ieee, + struct ieee80211_info_element *info_element, + u16 length, + struct ieee80211_network *network, + struct ieee80211_rx_stats *stats); + +void ieee80211_indicate_packets(struct ieee80211_device *ieee, struct ieee80211_rxb** prxbIndicateArray,u8 index); +#define RT_ASOC_RETRY_LIMIT 5 +#endif /* IEEE80211_H */ diff --git a/drivers/staging/rtl8192u/ieee80211/EndianFree.h b/drivers/staging/rtl8192u/ieee80211/EndianFree.h new file mode 100644 index 000000000000..0c417a6234a9 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/EndianFree.h @@ -0,0 +1,199 @@ +#ifndef __INC_ENDIANFREE_H +#define __INC_ENDIANFREE_H + +/* + * Call endian free function when + * 1. Read/write packet content. + * 2. Before write integer to IO. + * 3. After read integer from IO. + */ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) +#ifndef bool +typedef enum{false = 0, true} bool; +#endif +#endif + +#define __MACHINE_LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ +#define __MACHINE_BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net, ppc */ + +#define BYTE_ORDER __MACHINE_LITTLE_ENDIAN + +#if BYTE_ORDER == __MACHINE_LITTLE_ENDIAN +// Convert data +#define EF1Byte(_val) ((u8)(_val)) +#define EF2Byte(_val) ((u16)(_val)) +#define EF4Byte(_val) ((u32)(_val)) + +#else +// Convert data +#define EF1Byte(_val) ((u8)(_val)) +#define EF2Byte(_val) (((((u16)(_val))&0x00ff)<<8)|((((u16)(_val))&0xff00)>>8)) +#define EF4Byte(_val) (((((u32)(_val))&0x000000ff)<<24)|\ + ((((u32)(_val))&0x0000ff00)<<8)|\ + ((((u32)(_val))&0x00ff0000)>>8)|\ + ((((u32)(_val))&0xff000000)>>24)) +#endif + +// Read data from memory +#define ReadEF1Byte(_ptr) EF1Byte(*((u8 *)(_ptr))) +#define ReadEF2Byte(_ptr) EF2Byte(*((u16 *)(_ptr))) +#define ReadEF4Byte(_ptr) EF4Byte(*((u32 *)(_ptr))) + +// Write data to memory +#define WriteEF1Byte(_ptr, _val) (*((u8 *)(_ptr)))=EF1Byte(_val) +#define WriteEF2Byte(_ptr, _val) (*((u16 *)(_ptr)))=EF2Byte(_val) +#define WriteEF4Byte(_ptr, _val) (*((u32 *)(_ptr)))=EF4Byte(_val) +// Convert Host system specific byte ording (litten or big endia) to Network byte ording (big endian). +// 2006.05.07, by rcnjko. +#if BYTE_ORDER == __MACHINE_LITTLE_ENDIAN +#define H2N1BYTE(_val) ((u8)(_val)) +#define H2N2BYTE(_val) (((((u16)(_val))&0x00ff)<<8)|\ + ((((u16)(_val))&0xff00)>>8)) +#define H2N4BYTE(_val) (((((u32)(_val))&0x000000ff)<<24)|\ + ((((u32)(_val))&0x0000ff00)<<8) |\ + ((((u32)(_val))&0x00ff0000)>>8) |\ + ((((u32)(_val))&0xff000000)>>24)) +#else +#define H2N1BYTE(_val) ((u8)(_val)) +#define H2N2BYTE(_val) ((u16)(_val)) +#define H2N4BYTE(_val) ((u32)(_val)) +#endif + +// Convert from Network byte ording (big endian) to Host system specific byte ording (litten or big endia). +// 2006.05.07, by rcnjko. +#if BYTE_ORDER == __MACHINE_LITTLE_ENDIAN +#define N2H1BYTE(_val) ((u8)(_val)) +#define N2H2BYTE(_val) (((((u16)(_val))&0x00ff)<<8)|\ + ((((u16)(_val))&0xff00)>>8)) +#define N2H4BYTE(_val) (((((u32)(_val))&0x000000ff)<<24)|\ + ((((u32)(_val))&0x0000ff00)<<8) |\ + ((((u32)(_val))&0x00ff0000)>>8) |\ + ((((u32)(_val))&0xff000000)>>24)) +#else +#define N2H1BYTE(_val) ((u8)(_val)) +#define N2H2BYTE(_val) ((u16)(_val)) +#define N2H4BYTE(_val) ((u32)(_val)) +#endif + +// +// Example: +// BIT_LEN_MASK_32(0) => 0x00000000 +// BIT_LEN_MASK_32(1) => 0x00000001 +// BIT_LEN_MASK_32(2) => 0x00000003 +// BIT_LEN_MASK_32(32) => 0xFFFFFFFF +// +#define BIT_LEN_MASK_32(__BitLen) (0xFFFFFFFF >> (32 - (__BitLen))) +// +// Example: +// BIT_OFFSET_LEN_MASK_32(0, 2) => 0x00000003 +// BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000 +// +#define BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen) (BIT_LEN_MASK_32(__BitLen) << (__BitOffset)) + +// +// Description: +// Return 4-byte value in host byte ordering from +// 4-byte pointer in litten-endian system. +// +#define LE_P4BYTE_TO_HOST_4BYTE(__pStart) (EF4Byte(*((u32 *)(__pStart)))) + +// +// Description: +// Translate subfield (continuous bits in little-endian) of 4-byte value in litten byte to +// 4-byte value in host byte ordering. +// +#define LE_BITS_TO_4BYTE(__pStart, __BitOffset, __BitLen) \ + ( \ + ( LE_P4BYTE_TO_HOST_4BYTE(__pStart) >> (__BitOffset) ) \ + & \ + BIT_LEN_MASK_32(__BitLen) \ + ) + +// +// Description: +// Mask subfield (continuous bits in little-endian) of 4-byte value in litten byte oredering +// and return the result in 4-byte value in host byte ordering. +// +#define LE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen) \ + ( \ + LE_P4BYTE_TO_HOST_4BYTE(__pStart) \ + & \ + ( ~BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen) ) \ + ) + +// +// Description: +// Set subfield of little-endian 4-byte value to specified value. +// +#define SET_BITS_TO_LE_4BYTE(__pStart, __BitOffset, __BitLen, __Value) \ + *((u32 *)(__pStart)) = \ + EF4Byte( \ + LE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen) \ + | \ + ( (((u32)__Value) & BIT_LEN_MASK_32(__BitLen)) << (__BitOffset) ) \ + ); + + +#define BIT_LEN_MASK_16(__BitLen) \ + (0xFFFF >> (16 - (__BitLen))) + +#define BIT_OFFSET_LEN_MASK_16(__BitOffset, __BitLen) \ + (BIT_LEN_MASK_16(__BitLen) << (__BitOffset)) + +#define LE_P2BYTE_TO_HOST_2BYTE(__pStart) \ + (EF2Byte(*((u16 *)(__pStart)))) + +#define LE_BITS_TO_2BYTE(__pStart, __BitOffset, __BitLen) \ + ( \ + ( LE_P2BYTE_TO_HOST_2BYTE(__pStart) >> (__BitOffset) ) \ + & \ + BIT_LEN_MASK_16(__BitLen) \ + ) + +#define LE_BITS_CLEARED_TO_2BYTE(__pStart, __BitOffset, __BitLen) \ + ( \ + LE_P2BYTE_TO_HOST_2BYTE(__pStart) \ + & \ + ( ~BIT_OFFSET_LEN_MASK_16(__BitOffset, __BitLen) ) \ + ) + +#define SET_BITS_TO_LE_2BYTE(__pStart, __BitOffset, __BitLen, __Value) \ + *((u16 *)(__pStart)) = \ + EF2Byte( \ + LE_BITS_CLEARED_TO_2BYTE(__pStart, __BitOffset, __BitLen) \ + | \ + ( (((u16)__Value) & BIT_LEN_MASK_16(__BitLen)) << (__BitOffset) ) \ + ); + +#define BIT_LEN_MASK_8(__BitLen) \ + (0xFF >> (8 - (__BitLen))) + +#define BIT_OFFSET_LEN_MASK_8(__BitOffset, __BitLen) \ + (BIT_LEN_MASK_8(__BitLen) << (__BitOffset)) + +#define LE_P1BYTE_TO_HOST_1BYTE(__pStart) \ + (EF1Byte(*((u8 *)(__pStart)))) + +#define LE_BITS_TO_1BYTE(__pStart, __BitOffset, __BitLen) \ + ( \ + ( LE_P1BYTE_TO_HOST_1BYTE(__pStart) >> (__BitOffset) ) \ + & \ + BIT_LEN_MASK_8(__BitLen) \ + ) + +#define LE_BITS_CLEARED_TO_1BYTE(__pStart, __BitOffset, __BitLen) \ + ( \ + LE_P1BYTE_TO_HOST_1BYTE(__pStart) \ + & \ + ( ~BIT_OFFSET_LEN_MASK_8(__BitOffset, __BitLen) ) \ + ) + +#define SET_BITS_TO_LE_1BYTE(__pStart, __BitOffset, __BitLen, __Value) \ + *((u8 *)(__pStart)) = \ + EF1Byte( \ + LE_BITS_CLEARED_TO_1BYTE(__pStart, __BitOffset, __BitLen) \ + | \ + ( (((u8)__Value) & BIT_LEN_MASK_8(__BitLen)) << (__BitOffset) ) \ + ); + +#endif // #ifndef __INC_ENDIANFREE_H diff --git a/drivers/staging/rtl8192u/ieee80211/Makefile b/drivers/staging/rtl8192u/ieee80211/Makefile new file mode 100644 index 000000000000..71ca5d93a1b7 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/Makefile @@ -0,0 +1,139 @@ +NIC_SELECT = RTL8192U + +KVER := $(shell uname -r) +MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/$(NIC_SELECT) + +CC = gcc +ifneq ($(shell uname -r|cut -d. -f1,2), 2.4) +EXTRA_CFLAGS += -I$(TOPDIR)/drivers/net/wireless +EXTRA_CFLAGS += -O2 +EXTRA_CFLAGS += -DJACKSON_NEW_8187 -DJACKSON_NEW_RX + +#it will fail to compile in suse linux enterprise 10 sp2. This flag is to solve this problem. +ifeq ($(shell uname -r | cut -d. -f1,2,3,4), 2.6.16.60-0) +EXTRA_CFLAGS += -DOPENSUSE_SLED +endif + +ifeq ($(NIC_SELECT),RTL8192U) +#EXTRA_CFLAGS += -DUSB_TX_DRIVER_AGGREGATION_ENABLE +#EXTRA_CFLAGS += -DUSB_RX_AGGREGATION_SUPPORT +endif +#EXTRA_CFLAGS += -DJOHN_NOCPY +#flags to enable or disble 80211D feature +EXTRA_CFLAGS += -DENABLE_DOT11D +ieee80211-rsl-objs := ieee80211_rx.o \ + ieee80211_softmac.o \ + ieee80211_tx.o \ + ieee80211_wx.o \ + ieee80211_module.o \ + ieee80211_softmac_wx.o\ + rtl819x_HTProc.o\ + rtl819x_TSProc.o\ + rtl819x_BAProc.o\ + dot11d.o + +ieee80211_crypt-rsl-objs := ieee80211_crypt.o +ieee80211_crypt_tkip-rsl-objs := ieee80211_crypt_tkip.o +ieee80211_crypt_ccmp-rsl-objs := ieee80211_crypt_ccmp.o +ieee80211_crypt_wep-rsl-objs := ieee80211_crypt_wep.o + +obj-m +=ieee80211-rsl.o +obj-m +=ieee80211_crypt-rsl.o +obj-m +=ieee80211_crypt_wep-rsl.o +obj-m +=ieee80211_crypt_tkip-rsl.o +obj-m +=ieee80211_crypt_ccmp-rsl.o + +KSRC := /lib/modules/$(KVER)/build +INSTALL_PREFIX := + +all: modules + +modules: + $(MAKE) -C $(KSRC) M=$(PWD) CC=$(CC) modules + +install: modules + rm -fr $(MODDESTDIR) + mkdir -p $(MODDESTDIR) + @install -p -m 644 ieee80211_crypt-rsl.ko $(MODDESTDIR) + @install -p -m 644 ieee80211_crypt_wep-rsl.ko $(MODDESTDIR) + @install -p -m 644 ieee80211_crypt_tkip-rsl.ko $(MODDESTDIR) + @install -p -m 644 ieee80211_crypt_ccmp-rsl.ko $(MODDESTDIR) + @install -p -m 644 ieee80211-rsl.ko $(MODDESTDIR) + depmod -a +uninstall: + rm -fr $(MODDESTDIR) + depmod -a + +else +LD := ld +KSRC := /lib/modules/$(KVER)/build +CONFIG_FILE := $(KSRC)/include/linux/autoconf.h + +CFLAGS += -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -Wall +CFLAGS += -I$(KSRC)/include -I. +#Kernel 2.4.31 +CFLAGS += -DMODVERSIONS -DEXPORT_SYMTAB -include $(KSRC)/include/linux/modversions.h +#Kernel 2.4.20 +#CFLAGS += -D__NO_VERSION__ -DEXPORT_SYMTAB +#CFLAGS += -DENABLE_DOT11D +SMP := $(shell $(CC) $(MODCFLAGS) -E -dM $(CONFIG_FILE) | \ + grep CONFIG_SMP | awk '{print $$3}') +ifneq ($(SMP),1) + SMP := 0 +endif +ifeq ($(SMP),1) + CFLAGS += -D__SMP__ +endif + +#CFLAGS += -DJOHN_NOCPY + +OBJS := ${patsubst %.c, %.o, ${wildcard *.c}} +all:${OBJS} ieee80211_crypt-rsl.o michael_mic-rsl.o aes-rsl.o ieee80211_crypt_wep-rsl.o ieee80211_crypt_tkip-rsl.o ieee80211_crypt_ccmp-rsl.o crypto-rsl.o ieee80211-rsl.o + +ieee80211_crypt-rsl.o: ieee80211_crypt.o + mv $^ $@ + +michael_mic-rsl.o: michael_mic.o + mv $^ $@ + +aes-rsl.o: aes.o + mv $^ $@ + +ieee80211_crypt_wep-rsl.o: ieee80211_crypt_wep.o + mv $^ $@ + +ieee80211_crypt_tkip-rsl.o: ieee80211_crypt_tkip.o + mv $^ $@ + +ieee80211_crypt_ccmp-rsl.o: ieee80211_crypt_ccmp.o + mv $^ $@ + +crypto-rsl.o: arc4.o api.o autoload.o cipher.o compress.o digest.o scatterwalk.o proc.o + $(LD) -r $^ -o $@ + +ieee80211-rsl.o: ieee80211_rx.o ieee80211_tx.o ieee80211_wx.o ieee80211_module.o ieee80211_softmac_wx.o ieee80211_softmac.o rtl819x_HTProc.o rtl819x_TSProc.o rtl819x_BAProc.o dot11d.o + $(LD) -r $^ -o $@ +install: + rm -fr $(MODDESTDIR) + mkdir -p $(MODDESTDIR) + @install -p -m 644 ieee80211_crypt-rsl.o $(MODDESTDIR) + @install -p -m 644 crypto-rsl.o $(MODDESTDIR) + @install -p -m 644 michael_mic-rsl.o $(MODDESTDIR) + @install -p -m 644 aes-rsl.o $(MODDESTDIR) + @install -p -m 644 ieee80211_crypt_wep-rsl.o $(MODDESTDIR) + @install -p -m 644 ieee80211_crypt_tkip-rsl.o $(MODDESTDIR) + @install -p -m 644 ieee80211_crypt_ccmp-rsl.o $(MODDESTDIR) + @install -p -m 644 ieee80211-rsl.o $(MODDESTDIR) + /sbin/depmod -a ${shell uname -r} + +uninstall: + rm -fr $(MODDESTDIR) + /sbin/depmod -a ${shell uname -r} + +endif + +.PHONY: clean +clean: + rm -fr *.mod.c *.mod *.o .*.cmd *.mod.* *.ko *.o *~ + rm -rf .tmp_versions + rm -rf Module.symvers diff --git a/drivers/staging/rtl8192u/ieee80211/aes.c b/drivers/staging/rtl8192u/ieee80211/aes.c new file mode 100644 index 000000000000..0c176e29a797 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/aes.c @@ -0,0 +1,469 @@ +/* + * Cryptographic API. + * + * AES Cipher Algorithm. + * + * Based on Brian Gladman's code. + * + * Linux developers: + * Alexander Kjeldaas + * Herbert Valerio Riedel + * Kyle McMartin + * Adam J. Richter (conversion to 2.5 API). + * + * 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. + * + * --------------------------------------------------------------------------- + * Copyright (c) 2002, Dr Brian Gladman , Worcester, UK. + * All rights reserved. + * + * LICENSE TERMS + * + * The free distribution and use of this software in both source and binary + * form is allowed (with or without changes) provided that: + * + * 1. distributions of this source code include the above copyright + * notice, this list of conditions and the following disclaimer; + * + * 2. distributions in binary form include the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other associated materials; + * + * 3. the copyright holder's name is not used to endorse products + * built using this software without specific written permission. + * + * ALTERNATIVELY, provided that this notice is retained in full, this product + * may be distributed under the terms of the GNU General Public License (GPL), + * in which case the provisions of the GPL apply INSTEAD OF those given above. + * + * DISCLAIMER + * + * This software is provided 'as is' with no explicit or implied warranties + * in respect of its properties, including, but not limited to, correctness + * and/or fitness for purpose. + * --------------------------------------------------------------------------- + */ + +/* Some changes from the Gladman version: + s/RIJNDAEL(e_key)/E_KEY/g + s/RIJNDAEL(d_key)/D_KEY/g +*/ + +#include +#include +#include +#include +//#include +#include "rtl_crypto.h" +#include + +#define AES_MIN_KEY_SIZE 16 +#define AES_MAX_KEY_SIZE 32 + +#define AES_BLOCK_SIZE 16 + +static inline +u32 generic_rotr32 (const u32 x, const unsigned bits) +{ + const unsigned n = bits % 32; + return (x >> n) | (x << (32 - n)); +} + +static inline +u32 generic_rotl32 (const u32 x, const unsigned bits) +{ + const unsigned n = bits % 32; + return (x << n) | (x >> (32 - n)); +} + +#define rotl generic_rotl32 +#define rotr generic_rotr32 + +/* + * #define byte(x, nr) ((unsigned char)((x) >> (nr*8))) + */ +inline static u8 +byte(const u32 x, const unsigned n) +{ + return x >> (n << 3); +} + +#define u32_in(x) le32_to_cpu(*(const u32 *)(x)) +#define u32_out(to, from) (*(u32 *)(to) = cpu_to_le32(from)) + +struct aes_ctx { + int key_length; + u32 E[60]; + u32 D[60]; +}; + +#define E_KEY ctx->E +#define D_KEY ctx->D + +static u8 pow_tab[256] __initdata; +static u8 log_tab[256] __initdata; +static u8 sbx_tab[256] __initdata; +static u8 isb_tab[256] __initdata; +static u32 rco_tab[10]; +static u32 ft_tab[4][256]; +static u32 it_tab[4][256]; + +static u32 fl_tab[4][256]; +static u32 il_tab[4][256]; + +static inline u8 __init +f_mult (u8 a, u8 b) +{ + u8 aa = log_tab[a], cc = aa + log_tab[b]; + + return pow_tab[cc + (cc < aa ? 1 : 0)]; +} + +#define ff_mult(a,b) (a && b ? f_mult(a, b) : 0) + +#define f_rn(bo, bi, n, k) \ + bo[n] = ft_tab[0][byte(bi[n],0)] ^ \ + ft_tab[1][byte(bi[(n + 1) & 3],1)] ^ \ + ft_tab[2][byte(bi[(n + 2) & 3],2)] ^ \ + ft_tab[3][byte(bi[(n + 3) & 3],3)] ^ *(k + n) + +#define i_rn(bo, bi, n, k) \ + bo[n] = it_tab[0][byte(bi[n],0)] ^ \ + it_tab[1][byte(bi[(n + 3) & 3],1)] ^ \ + it_tab[2][byte(bi[(n + 2) & 3],2)] ^ \ + it_tab[3][byte(bi[(n + 1) & 3],3)] ^ *(k + n) + +#define ls_box(x) \ + ( fl_tab[0][byte(x, 0)] ^ \ + fl_tab[1][byte(x, 1)] ^ \ + fl_tab[2][byte(x, 2)] ^ \ + fl_tab[3][byte(x, 3)] ) + +#define f_rl(bo, bi, n, k) \ + bo[n] = fl_tab[0][byte(bi[n],0)] ^ \ + fl_tab[1][byte(bi[(n + 1) & 3],1)] ^ \ + fl_tab[2][byte(bi[(n + 2) & 3],2)] ^ \ + fl_tab[3][byte(bi[(n + 3) & 3],3)] ^ *(k + n) + +#define i_rl(bo, bi, n, k) \ + bo[n] = il_tab[0][byte(bi[n],0)] ^ \ + il_tab[1][byte(bi[(n + 3) & 3],1)] ^ \ + il_tab[2][byte(bi[(n + 2) & 3],2)] ^ \ + il_tab[3][byte(bi[(n + 1) & 3],3)] ^ *(k + n) + +static void __init +gen_tabs (void) +{ + u32 i, t; + u8 p, q; + + /* log and power tables for GF(2**8) finite field with + 0x011b as modular polynomial - the simplest primitive + root is 0x03, used here to generate the tables */ + + for (i = 0, p = 1; i < 256; ++i) { + pow_tab[i] = (u8) p; + log_tab[p] = (u8) i; + + p ^= (p << 1) ^ (p & 0x80 ? 0x01b : 0); + } + + log_tab[1] = 0; + + for (i = 0, p = 1; i < 10; ++i) { + rco_tab[i] = p; + + p = (p << 1) ^ (p & 0x80 ? 0x01b : 0); + } + + for (i = 0; i < 256; ++i) { + p = (i ? pow_tab[255 - log_tab[i]] : 0); + q = ((p >> 7) | (p << 1)) ^ ((p >> 6) | (p << 2)); + p ^= 0x63 ^ q ^ ((q >> 6) | (q << 2)); + sbx_tab[i] = p; + isb_tab[p] = (u8) i; + } + + for (i = 0; i < 256; ++i) { + p = sbx_tab[i]; + + t = p; + fl_tab[0][i] = t; + fl_tab[1][i] = rotl (t, 8); + fl_tab[2][i] = rotl (t, 16); + fl_tab[3][i] = rotl (t, 24); + + t = ((u32) ff_mult (2, p)) | + ((u32) p << 8) | + ((u32) p << 16) | ((u32) ff_mult (3, p) << 24); + + ft_tab[0][i] = t; + ft_tab[1][i] = rotl (t, 8); + ft_tab[2][i] = rotl (t, 16); + ft_tab[3][i] = rotl (t, 24); + + p = isb_tab[i]; + + t = p; + il_tab[0][i] = t; + il_tab[1][i] = rotl (t, 8); + il_tab[2][i] = rotl (t, 16); + il_tab[3][i] = rotl (t, 24); + + t = ((u32) ff_mult (14, p)) | + ((u32) ff_mult (9, p) << 8) | + ((u32) ff_mult (13, p) << 16) | + ((u32) ff_mult (11, p) << 24); + + it_tab[0][i] = t; + it_tab[1][i] = rotl (t, 8); + it_tab[2][i] = rotl (t, 16); + it_tab[3][i] = rotl (t, 24); + } +} + +#define star_x(x) (((x) & 0x7f7f7f7f) << 1) ^ ((((x) & 0x80808080) >> 7) * 0x1b) + +#define imix_col(y,x) \ + u = star_x(x); \ + v = star_x(u); \ + w = star_x(v); \ + t = w ^ (x); \ + (y) = u ^ v ^ w; \ + (y) ^= rotr(u ^ t, 8) ^ \ + rotr(v ^ t, 16) ^ \ + rotr(t,24) + +/* initialise the key schedule from the user supplied key */ + +#define loop4(i) \ +{ t = rotr(t, 8); t = ls_box(t) ^ rco_tab[i]; \ + t ^= E_KEY[4 * i]; E_KEY[4 * i + 4] = t; \ + t ^= E_KEY[4 * i + 1]; E_KEY[4 * i + 5] = t; \ + t ^= E_KEY[4 * i + 2]; E_KEY[4 * i + 6] = t; \ + t ^= E_KEY[4 * i + 3]; E_KEY[4 * i + 7] = t; \ +} + +#define loop6(i) \ +{ t = rotr(t, 8); t = ls_box(t) ^ rco_tab[i]; \ + t ^= E_KEY[6 * i]; E_KEY[6 * i + 6] = t; \ + t ^= E_KEY[6 * i + 1]; E_KEY[6 * i + 7] = t; \ + t ^= E_KEY[6 * i + 2]; E_KEY[6 * i + 8] = t; \ + t ^= E_KEY[6 * i + 3]; E_KEY[6 * i + 9] = t; \ + t ^= E_KEY[6 * i + 4]; E_KEY[6 * i + 10] = t; \ + t ^= E_KEY[6 * i + 5]; E_KEY[6 * i + 11] = t; \ +} + +#define loop8(i) \ +{ t = rotr(t, 8); ; t = ls_box(t) ^ rco_tab[i]; \ + t ^= E_KEY[8 * i]; E_KEY[8 * i + 8] = t; \ + t ^= E_KEY[8 * i + 1]; E_KEY[8 * i + 9] = t; \ + t ^= E_KEY[8 * i + 2]; E_KEY[8 * i + 10] = t; \ + t ^= E_KEY[8 * i + 3]; E_KEY[8 * i + 11] = t; \ + t = E_KEY[8 * i + 4] ^ ls_box(t); \ + E_KEY[8 * i + 12] = t; \ + t ^= E_KEY[8 * i + 5]; E_KEY[8 * i + 13] = t; \ + t ^= E_KEY[8 * i + 6]; E_KEY[8 * i + 14] = t; \ + t ^= E_KEY[8 * i + 7]; E_KEY[8 * i + 15] = t; \ +} + +static int +aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, u32 *flags) +{ + struct aes_ctx *ctx = ctx_arg; + u32 i, t, u, v, w; + + if (key_len != 16 && key_len != 24 && key_len != 32) { + *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; + return -EINVAL; + } + + ctx->key_length = key_len; + + E_KEY[0] = u32_in (in_key); + E_KEY[1] = u32_in (in_key + 4); + E_KEY[2] = u32_in (in_key + 8); + E_KEY[3] = u32_in (in_key + 12); + + switch (key_len) { + case 16: + t = E_KEY[3]; + for (i = 0; i < 10; ++i) + loop4 (i); + break; + + case 24: + E_KEY[4] = u32_in (in_key + 16); + t = E_KEY[5] = u32_in (in_key + 20); + for (i = 0; i < 8; ++i) + loop6 (i); + break; + + case 32: + E_KEY[4] = u32_in (in_key + 16); + E_KEY[5] = u32_in (in_key + 20); + E_KEY[6] = u32_in (in_key + 24); + t = E_KEY[7] = u32_in (in_key + 28); + for (i = 0; i < 7; ++i) + loop8 (i); + break; + } + + D_KEY[0] = E_KEY[0]; + D_KEY[1] = E_KEY[1]; + D_KEY[2] = E_KEY[2]; + D_KEY[3] = E_KEY[3]; + + for (i = 4; i < key_len + 24; ++i) { + imix_col (D_KEY[i], E_KEY[i]); + } + + return 0; +} + +/* encrypt a block of text */ + +#define f_nround(bo, bi, k) \ + f_rn(bo, bi, 0, k); \ + f_rn(bo, bi, 1, k); \ + f_rn(bo, bi, 2, k); \ + f_rn(bo, bi, 3, k); \ + k += 4 + +#define f_lround(bo, bi, k) \ + f_rl(bo, bi, 0, k); \ + f_rl(bo, bi, 1, k); \ + f_rl(bo, bi, 2, k); \ + f_rl(bo, bi, 3, k) + +static void aes_encrypt(void *ctx_arg, u8 *out, const u8 *in) +{ + const struct aes_ctx *ctx = ctx_arg; + u32 b0[4], b1[4]; + const u32 *kp = E_KEY + 4; + + b0[0] = u32_in (in) ^ E_KEY[0]; + b0[1] = u32_in (in + 4) ^ E_KEY[1]; + b0[2] = u32_in (in + 8) ^ E_KEY[2]; + b0[3] = u32_in (in + 12) ^ E_KEY[3]; + + if (ctx->key_length > 24) { + f_nround (b1, b0, kp); + f_nround (b0, b1, kp); + } + + if (ctx->key_length > 16) { + f_nround (b1, b0, kp); + f_nround (b0, b1, kp); + } + + f_nround (b1, b0, kp); + f_nround (b0, b1, kp); + f_nround (b1, b0, kp); + f_nround (b0, b1, kp); + f_nround (b1, b0, kp); + f_nround (b0, b1, kp); + f_nround (b1, b0, kp); + f_nround (b0, b1, kp); + f_nround (b1, b0, kp); + f_lround (b0, b1, kp); + + u32_out (out, b0[0]); + u32_out (out + 4, b0[1]); + u32_out (out + 8, b0[2]); + u32_out (out + 12, b0[3]); +} + +/* decrypt a block of text */ + +#define i_nround(bo, bi, k) \ + i_rn(bo, bi, 0, k); \ + i_rn(bo, bi, 1, k); \ + i_rn(bo, bi, 2, k); \ + i_rn(bo, bi, 3, k); \ + k -= 4 + +#define i_lround(bo, bi, k) \ + i_rl(bo, bi, 0, k); \ + i_rl(bo, bi, 1, k); \ + i_rl(bo, bi, 2, k); \ + i_rl(bo, bi, 3, k) + +static void aes_decrypt(void *ctx_arg, u8 *out, const u8 *in) +{ + const struct aes_ctx *ctx = ctx_arg; + u32 b0[4], b1[4]; + const int key_len = ctx->key_length; + const u32 *kp = D_KEY + key_len + 20; + + b0[0] = u32_in (in) ^ E_KEY[key_len + 24]; + b0[1] = u32_in (in + 4) ^ E_KEY[key_len + 25]; + b0[2] = u32_in (in + 8) ^ E_KEY[key_len + 26]; + b0[3] = u32_in (in + 12) ^ E_KEY[key_len + 27]; + + if (key_len > 24) { + i_nround (b1, b0, kp); + i_nround (b0, b1, kp); + } + + if (key_len > 16) { + i_nround (b1, b0, kp); + i_nround (b0, b1, kp); + } + + i_nround (b1, b0, kp); + i_nround (b0, b1, kp); + i_nround (b1, b0, kp); + i_nround (b0, b1, kp); + i_nround (b1, b0, kp); + i_nround (b0, b1, kp); + i_nround (b1, b0, kp); + i_nround (b0, b1, kp); + i_nround (b1, b0, kp); + i_lround (b0, b1, kp); + + u32_out (out, b0[0]); + u32_out (out + 4, b0[1]); + u32_out (out + 8, b0[2]); + u32_out (out + 12, b0[3]); +} + + +static struct crypto_alg aes_alg = { + .cra_name = "aes", + .cra_flags = CRYPTO_ALG_TYPE_CIPHER, + .cra_blocksize = AES_BLOCK_SIZE, + .cra_ctxsize = sizeof(struct aes_ctx), + .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(aes_alg.cra_list), + .cra_u = { + .cipher = { + .cia_min_keysize = AES_MIN_KEY_SIZE, + .cia_max_keysize = AES_MAX_KEY_SIZE, + .cia_setkey = aes_set_key, + .cia_encrypt = aes_encrypt, + .cia_decrypt = aes_decrypt + } + } +}; + +static int __init aes_init(void) +{ + gen_tabs(); + return crypto_register_alg(&aes_alg); +} + +static void __exit aes_fini(void) +{ + crypto_unregister_alg(&aes_alg); +} + +module_init(aes_init); +module_exit(aes_fini); + +MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm"); +MODULE_LICENSE("Dual BSD/GPL"); + diff --git a/drivers/staging/rtl8192u/ieee80211/api.c b/drivers/staging/rtl8192u/ieee80211/api.c new file mode 100644 index 000000000000..c627d029528b --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/api.c @@ -0,0 +1,246 @@ +/* + * Scatterlist Cryptographic API. + * + * Copyright (c) 2002 James Morris + * Copyright (c) 2002 David S. Miller (davem@redhat.com) + * + * Portions derived from Cryptoapi, by Alexander Kjeldaas + * and Nettle, by Niels Mé°ˆler. + * + * 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. + * + */ +#include "kmap_types.h" + +#include +#include +//#include +#include "rtl_crypto.h" +#include +#include +#include +#include "internal.h" + +LIST_HEAD(crypto_alg_list); +DECLARE_RWSEM(crypto_alg_sem); + +static inline int crypto_alg_get(struct crypto_alg *alg) +{ + return try_inc_mod_count(alg->cra_module); +} + +static inline void crypto_alg_put(struct crypto_alg *alg) +{ + if (alg->cra_module) + __MOD_DEC_USE_COUNT(alg->cra_module); +} + +struct crypto_alg *crypto_alg_lookup(const char *name) +{ + struct crypto_alg *q, *alg = NULL; + + if (!name) + return NULL; + + down_read(&crypto_alg_sem); + + list_for_each_entry(q, &crypto_alg_list, cra_list) { + if (!(strcmp(q->cra_name, name))) { + if (crypto_alg_get(q)) + alg = q; + break; + } + } + + up_read(&crypto_alg_sem); + return alg; +} + +static int crypto_init_flags(struct crypto_tfm *tfm, u32 flags) +{ + tfm->crt_flags = 0; + + switch (crypto_tfm_alg_type(tfm)) { + case CRYPTO_ALG_TYPE_CIPHER: + return crypto_init_cipher_flags(tfm, flags); + + case CRYPTO_ALG_TYPE_DIGEST: + return crypto_init_digest_flags(tfm, flags); + + case CRYPTO_ALG_TYPE_COMPRESS: + return crypto_init_compress_flags(tfm, flags); + + default: + break; + } + + BUG(); + return -EINVAL; +} + +static int crypto_init_ops(struct crypto_tfm *tfm) +{ + switch (crypto_tfm_alg_type(tfm)) { + case CRYPTO_ALG_TYPE_CIPHER: + return crypto_init_cipher_ops(tfm); + + case CRYPTO_ALG_TYPE_DIGEST: + return crypto_init_digest_ops(tfm); + + case CRYPTO_ALG_TYPE_COMPRESS: + return crypto_init_compress_ops(tfm); + + default: + break; + } + + BUG(); + return -EINVAL; +} + +static void crypto_exit_ops(struct crypto_tfm *tfm) +{ + switch (crypto_tfm_alg_type(tfm)) { + case CRYPTO_ALG_TYPE_CIPHER: + crypto_exit_cipher_ops(tfm); + break; + + case CRYPTO_ALG_TYPE_DIGEST: + crypto_exit_digest_ops(tfm); + break; + + case CRYPTO_ALG_TYPE_COMPRESS: + crypto_exit_compress_ops(tfm); + break; + + default: + BUG(); + + } +} + +struct crypto_tfm *crypto_alloc_tfm(const char *name, u32 flags) +{ + struct crypto_tfm *tfm = NULL; + struct crypto_alg *alg; + + alg = crypto_alg_mod_lookup(name); + if (alg == NULL) + goto out; + + tfm = kmalloc(sizeof(*tfm) + alg->cra_ctxsize, GFP_KERNEL); + if (tfm == NULL) + goto out_put; + + memset(tfm, 0, sizeof(*tfm) + alg->cra_ctxsize); + + tfm->__crt_alg = alg; + + if (crypto_init_flags(tfm, flags)) + goto out_free_tfm; + + if (crypto_init_ops(tfm)) { + crypto_exit_ops(tfm); + goto out_free_tfm; + } + + goto out; + +out_free_tfm: + kfree(tfm); + tfm = NULL; +out_put: + crypto_alg_put(alg); +out: + return tfm; +} + +void crypto_free_tfm(struct crypto_tfm *tfm) +{ + struct crypto_alg *alg = tfm->__crt_alg; + int size = sizeof(*tfm) + alg->cra_ctxsize; + + crypto_exit_ops(tfm); + crypto_alg_put(alg); + memset(tfm, 0, size); + kfree(tfm); +} + +int crypto_register_alg(struct crypto_alg *alg) +{ + int ret = 0; + struct crypto_alg *q; + + down_write(&crypto_alg_sem); + + list_for_each_entry(q, &crypto_alg_list, cra_list) { + if (!(strcmp(q->cra_name, alg->cra_name))) { + ret = -EEXIST; + goto out; + } + } + + list_add_tail(&alg->cra_list, &crypto_alg_list); +out: + up_write(&crypto_alg_sem); + return ret; +} + +int crypto_unregister_alg(struct crypto_alg *alg) +{ + int ret = -ENOENT; + struct crypto_alg *q; + + BUG_ON(!alg->cra_module); + + down_write(&crypto_alg_sem); + list_for_each_entry(q, &crypto_alg_list, cra_list) { + if (alg == q) { + list_del(&alg->cra_list); + ret = 0; + goto out; + } + } +out: + up_write(&crypto_alg_sem); + return ret; +} + +int crypto_alg_available(const char *name, u32 flags) +{ + int ret = 0; + struct crypto_alg *alg = crypto_alg_mod_lookup(name); + + if (alg) { + crypto_alg_put(alg); + ret = 1; + } + + return ret; +} + +static int __init init_crypto(void) +{ + printk(KERN_INFO "Initializing Cryptographic API\n"); + crypto_init_proc(); + return 0; +} + +__initcall(init_crypto); + +/* +EXPORT_SYMBOL_GPL(crypto_register_alg); +EXPORT_SYMBOL_GPL(crypto_unregister_alg); +EXPORT_SYMBOL_GPL(crypto_alloc_tfm); +EXPORT_SYMBOL_GPL(crypto_free_tfm); +EXPORT_SYMBOL_GPL(crypto_alg_available); +*/ + +EXPORT_SYMBOL_NOVERS(crypto_register_alg); +EXPORT_SYMBOL_NOVERS(crypto_unregister_alg); +EXPORT_SYMBOL_NOVERS(crypto_alloc_tfm); +EXPORT_SYMBOL_NOVERS(crypto_free_tfm); +EXPORT_SYMBOL_NOVERS(crypto_alg_available); diff --git a/drivers/staging/rtl8192u/ieee80211/arc4.c b/drivers/staging/rtl8192u/ieee80211/arc4.c new file mode 100644 index 000000000000..e408472af305 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/arc4.c @@ -0,0 +1,103 @@ +/* + * Cryptographic API + * + * ARC4 Cipher Algorithm + * + * Jon Oberheide + * + * 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. + * + */ +#include +#include +#include "rtl_crypto.h" + +#define ARC4_MIN_KEY_SIZE 1 +#define ARC4_MAX_KEY_SIZE 256 +#define ARC4_BLOCK_SIZE 1 + +struct arc4_ctx { + u8 S[256]; + u8 x, y; +}; + +static int arc4_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, u32 *flags) +{ + struct arc4_ctx *ctx = ctx_arg; + int i, j = 0, k = 0; + + ctx->x = 1; + ctx->y = 0; + + for(i = 0; i < 256; i++) + ctx->S[i] = i; + + for(i = 0; i < 256; i++) + { + u8 a = ctx->S[i]; + j = (j + in_key[k] + a) & 0xff; + ctx->S[i] = ctx->S[j]; + ctx->S[j] = a; + if((unsigned int)++k >= key_len) + k = 0; + } + + return 0; +} + +static void arc4_crypt(void *ctx_arg, u8 *out, const u8 *in) +{ + struct arc4_ctx *ctx = ctx_arg; + + u8 *const S = ctx->S; + u8 x = ctx->x; + u8 y = ctx->y; + u8 a, b; + + a = S[x]; + y = (y + a) & 0xff; + b = S[y]; + S[x] = b; + S[y] = a; + x = (x + 1) & 0xff; + *out++ = *in ^ S[(a + b) & 0xff]; + + ctx->x = x; + ctx->y = y; +} + +static struct crypto_alg arc4_alg = { + .cra_name = "arc4", + .cra_flags = CRYPTO_ALG_TYPE_CIPHER, + .cra_blocksize = ARC4_BLOCK_SIZE, + .cra_ctxsize = sizeof(struct arc4_ctx), + .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(arc4_alg.cra_list), + .cra_u = { .cipher = { + .cia_min_keysize = ARC4_MIN_KEY_SIZE, + .cia_max_keysize = ARC4_MAX_KEY_SIZE, + .cia_setkey = arc4_set_key, + .cia_encrypt = arc4_crypt, + .cia_decrypt = arc4_crypt } } +}; + +static int __init arc4_init(void) +{ + return crypto_register_alg(&arc4_alg); +} + + +static void __exit arc4_exit(void) +{ + crypto_unregister_alg(&arc4_alg); +} + +module_init(arc4_init); +module_exit(arc4_exit); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("ARC4 Cipher Algorithm"); +MODULE_AUTHOR("Jon Oberheide "); diff --git a/drivers/staging/rtl8192u/ieee80211/autoload.c b/drivers/staging/rtl8192u/ieee80211/autoload.c new file mode 100644 index 000000000000..c97756f3b2ea --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/autoload.c @@ -0,0 +1,40 @@ +/* + * Cryptographic API. + * + * Algorithm autoloader. + * + * Copyright (c) 2002 James Morris + * + * 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. + * + */ +#include "kmap_types.h" + +#include +//#include +#include "rtl_crypto.h" +#include +#include +#include "internal.h" + +/* + * A far more intelligent version of this is planned. For now, just + * try an exact match on the name of the algorithm. + */ +void crypto_alg_autoload(const char *name) +{ + request_module(name); +} + +struct crypto_alg *crypto_alg_mod_lookup(const char *name) +{ + struct crypto_alg *alg = crypto_alg_lookup(name); + if (alg == NULL) { + crypto_alg_autoload(name); + alg = crypto_alg_lookup(name); + } + return alg; +} diff --git a/drivers/staging/rtl8192u/ieee80211/cipher.c b/drivers/staging/rtl8192u/ieee80211/cipher.c new file mode 100644 index 000000000000..1968acfe32b1 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/cipher.c @@ -0,0 +1,299 @@ +/* + * Cryptographic API. + * + * Cipher operations. + * + * Copyright (c) 2002 James Morris + * + * 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. + * + */ +#include +//#include +#include "rtl_crypto.h" +#include +#include +#include +#include +#include "internal.h" +#include "scatterwalk.h" + +typedef void (cryptfn_t)(void *, u8 *, const u8 *); +typedef void (procfn_t)(struct crypto_tfm *, u8 *, + u8*, cryptfn_t, int enc, void *, int); + +static inline void xor_64(u8 *a, const u8 *b) +{ + ((u32 *)a)[0] ^= ((u32 *)b)[0]; + ((u32 *)a)[1] ^= ((u32 *)b)[1]; +} + +static inline void xor_128(u8 *a, const u8 *b) +{ + ((u32 *)a)[0] ^= ((u32 *)b)[0]; + ((u32 *)a)[1] ^= ((u32 *)b)[1]; + ((u32 *)a)[2] ^= ((u32 *)b)[2]; + ((u32 *)a)[3] ^= ((u32 *)b)[3]; +} + + +/* + * Generic encrypt/decrypt wrapper for ciphers, handles operations across + * multiple page boundaries by using temporary blocks. In user context, + * the kernel is given a chance to schedule us once per block. + */ +static int crypt(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes, cryptfn_t crfn, + procfn_t prfn, int enc, void *info) +{ + struct scatter_walk walk_in, walk_out; + const unsigned int bsize = crypto_tfm_alg_blocksize(tfm); + u8 tmp_src[bsize]; + u8 tmp_dst[bsize]; + + if (!nbytes) + return 0; + + if (nbytes % bsize) { + tfm->crt_flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; + return -EINVAL; + } + + scatterwalk_start(&walk_in, src); + scatterwalk_start(&walk_out, dst); + + for(;;) { + u8 *src_p, *dst_p; + int in_place; + + scatterwalk_map(&walk_in, 0); + scatterwalk_map(&walk_out, 1); + src_p = scatterwalk_whichbuf(&walk_in, bsize, tmp_src); + dst_p = scatterwalk_whichbuf(&walk_out, bsize, tmp_dst); + in_place = scatterwalk_samebuf(&walk_in, &walk_out, + src_p, dst_p); + + nbytes -= bsize; + + scatterwalk_copychunks(src_p, &walk_in, bsize, 0); + + prfn(tfm, dst_p, src_p, crfn, enc, info, in_place); + + scatterwalk_done(&walk_in, 0, nbytes); + + scatterwalk_copychunks(dst_p, &walk_out, bsize, 1); + scatterwalk_done(&walk_out, 1, nbytes); + + if (!nbytes) + return 0; + + crypto_yield(tfm); + } +} + +static void cbc_process(struct crypto_tfm *tfm, u8 *dst, u8 *src, + cryptfn_t fn, int enc, void *info, int in_place) +{ + u8 *iv = info; + + /* Null encryption */ + if (!iv) + return; + + if (enc) { + tfm->crt_u.cipher.cit_xor_block(iv, src); + fn(crypto_tfm_ctx(tfm), dst, iv); + memcpy(iv, dst, crypto_tfm_alg_blocksize(tfm)); + } else { + u8 stack[in_place ? crypto_tfm_alg_blocksize(tfm) : 0]; + u8 *buf = in_place ? stack : dst; + + fn(crypto_tfm_ctx(tfm), buf, src); + tfm->crt_u.cipher.cit_xor_block(buf, iv); + memcpy(iv, src, crypto_tfm_alg_blocksize(tfm)); + if (buf != dst) + memcpy(dst, buf, crypto_tfm_alg_blocksize(tfm)); + } +} + +static void ecb_process(struct crypto_tfm *tfm, u8 *dst, u8 *src, + cryptfn_t fn, int enc, void *info, int in_place) +{ + fn(crypto_tfm_ctx(tfm), dst, src); +} + +static int setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) +{ + struct cipher_alg *cia = &tfm->__crt_alg->cra_cipher; + + if (keylen < cia->cia_min_keysize || keylen > cia->cia_max_keysize) { + tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; + return -EINVAL; + } else + return cia->cia_setkey(crypto_tfm_ctx(tfm), key, keylen, + &tfm->crt_flags); +} + +static int ecb_encrypt(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, unsigned int nbytes) +{ + return crypt(tfm, dst, src, nbytes, + tfm->__crt_alg->cra_cipher.cia_encrypt, + ecb_process, 1, NULL); +} + +static int ecb_decrypt(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes) +{ + return crypt(tfm, dst, src, nbytes, + tfm->__crt_alg->cra_cipher.cia_decrypt, + ecb_process, 1, NULL); +} + +static int cbc_encrypt(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes) +{ + return crypt(tfm, dst, src, nbytes, + tfm->__crt_alg->cra_cipher.cia_encrypt, + cbc_process, 1, tfm->crt_cipher.cit_iv); +} + +static int cbc_encrypt_iv(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes, u8 *iv) +{ + return crypt(tfm, dst, src, nbytes, + tfm->__crt_alg->cra_cipher.cia_encrypt, + cbc_process, 1, iv); +} + +static int cbc_decrypt(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes) +{ + return crypt(tfm, dst, src, nbytes, + tfm->__crt_alg->cra_cipher.cia_decrypt, + cbc_process, 0, tfm->crt_cipher.cit_iv); +} + +static int cbc_decrypt_iv(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes, u8 *iv) +{ + return crypt(tfm, dst, src, nbytes, + tfm->__crt_alg->cra_cipher.cia_decrypt, + cbc_process, 0, iv); +} + +static int nocrypt(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes) +{ + return -ENOSYS; +} + +static int nocrypt_iv(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes, u8 *iv) +{ + return -ENOSYS; +} + +int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags) +{ + u32 mode = flags & CRYPTO_TFM_MODE_MASK; + + tfm->crt_cipher.cit_mode = mode ? mode : CRYPTO_TFM_MODE_ECB; + if (flags & CRYPTO_TFM_REQ_WEAK_KEY) + tfm->crt_flags = CRYPTO_TFM_REQ_WEAK_KEY; + + return 0; +} + +int crypto_init_cipher_ops(struct crypto_tfm *tfm) +{ + int ret = 0; + struct cipher_tfm *ops = &tfm->crt_cipher; + + ops->cit_setkey = setkey; + + switch (tfm->crt_cipher.cit_mode) { + case CRYPTO_TFM_MODE_ECB: + ops->cit_encrypt = ecb_encrypt; + ops->cit_decrypt = ecb_decrypt; + break; + + case CRYPTO_TFM_MODE_CBC: + ops->cit_encrypt = cbc_encrypt; + ops->cit_decrypt = cbc_decrypt; + ops->cit_encrypt_iv = cbc_encrypt_iv; + ops->cit_decrypt_iv = cbc_decrypt_iv; + break; + + case CRYPTO_TFM_MODE_CFB: + ops->cit_encrypt = nocrypt; + ops->cit_decrypt = nocrypt; + ops->cit_encrypt_iv = nocrypt_iv; + ops->cit_decrypt_iv = nocrypt_iv; + break; + + case CRYPTO_TFM_MODE_CTR: + ops->cit_encrypt = nocrypt; + ops->cit_decrypt = nocrypt; + ops->cit_encrypt_iv = nocrypt_iv; + ops->cit_decrypt_iv = nocrypt_iv; + break; + + default: + BUG(); + } + + if (ops->cit_mode == CRYPTO_TFM_MODE_CBC) { + + switch (crypto_tfm_alg_blocksize(tfm)) { + case 8: + ops->cit_xor_block = xor_64; + break; + + case 16: + ops->cit_xor_block = xor_128; + break; + + default: + printk(KERN_WARNING "%s: block size %u not supported\n", + crypto_tfm_alg_name(tfm), + crypto_tfm_alg_blocksize(tfm)); + ret = -EINVAL; + goto out; + } + + ops->cit_ivsize = crypto_tfm_alg_blocksize(tfm); + ops->cit_iv = kmalloc(ops->cit_ivsize, GFP_KERNEL); + if (ops->cit_iv == NULL) + ret = -ENOMEM; + } + +out: + return ret; +} + +void crypto_exit_cipher_ops(struct crypto_tfm *tfm) +{ + if (tfm->crt_cipher.cit_iv) + kfree(tfm->crt_cipher.cit_iv); +} diff --git a/drivers/staging/rtl8192u/ieee80211/compress.c b/drivers/staging/rtl8192u/ieee80211/compress.c new file mode 100644 index 000000000000..c2df80e2ed9d --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/compress.c @@ -0,0 +1,64 @@ +/* + * Cryptographic API. + * + * Compression operations. + * + * Copyright (c) 2002 James Morris + * + * 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. + * + */ +#include +//#include +#include "rtl_crypto.h" +#include +#include +#include +#include "internal.h" + +static int crypto_compress(struct crypto_tfm *tfm, + const u8 *src, unsigned int slen, + u8 *dst, unsigned int *dlen) +{ + return tfm->__crt_alg->cra_compress.coa_compress(crypto_tfm_ctx(tfm), + src, slen, dst, + dlen); +} + +static int crypto_decompress(struct crypto_tfm *tfm, + const u8 *src, unsigned int slen, + u8 *dst, unsigned int *dlen) +{ + return tfm->__crt_alg->cra_compress.coa_decompress(crypto_tfm_ctx(tfm), + src, slen, dst, + dlen); +} + +int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags) +{ + return flags ? -EINVAL : 0; +} + +int crypto_init_compress_ops(struct crypto_tfm *tfm) +{ + int ret = 0; + struct compress_tfm *ops = &tfm->crt_compress; + + ret = tfm->__crt_alg->cra_compress.coa_init(crypto_tfm_ctx(tfm)); + if (ret) + goto out; + + ops->cot_compress = crypto_compress; + ops->cot_decompress = crypto_decompress; + +out: + return ret; +} + +void crypto_exit_compress_ops(struct crypto_tfm *tfm) +{ + tfm->__crt_alg->cra_compress.coa_exit(crypto_tfm_ctx(tfm)); +} diff --git a/drivers/staging/rtl8192u/ieee80211/crypto_compat.h b/drivers/staging/rtl8192u/ieee80211/crypto_compat.h new file mode 100644 index 000000000000..587e8bb2db6a --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/crypto_compat.h @@ -0,0 +1,90 @@ +/* + * Header file to maintain compatibility among different kernel versions. + * + * Copyright (c) 2004-2006 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. See README and COPYING for + * more details. + */ + +#include + +static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); + return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes); +} + + +static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); + return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes); +} + +#if 0 +/* + * crypto_free_tfm - Free crypto transform + * @tfm: Transform to free + * + * crypto_free_tfm() frees up the transform and any associated resources, + * then drops the refcount on the associated algorithm. + */ +void crypto_free_tfm(struct crypto_tfm *tfm) +{ + struct crypto_alg *alg; + int size; + + if (unlikely(!tfm)) + return; + + alg = tfm->__crt_alg; + size = sizeof(*tfm) + alg->cra_ctxsize; + + if (alg->cra_exit) + alg->cra_exit(tfm); + crypto_exit_ops(tfm); + crypto_mod_put(alg); + memset(tfm, 0, size); + kfree(tfm); +} + +#endif +#if 1 + struct crypto_tfm *crypto_alloc_tfm(const char *name, u32 flags) +{ + struct crypto_tfm *tfm = NULL; + int err; + printk("call crypto_alloc_tfm!!!\n"); + do { + struct crypto_alg *alg; + + alg = crypto_alg_mod_lookup(name, 0, CRYPTO_ALG_ASYNC); + err = PTR_ERR(alg); + if (IS_ERR(alg)) + continue; + + tfm = __crypto_alloc_tfm(alg, flags); + err = 0; + if (IS_ERR(tfm)) { + crypto_mod_put(alg); + err = PTR_ERR(tfm); + tfm = NULL; + } + } while (err == -EAGAIN && !signal_pending(current)); + + return tfm; +} +#endif +//EXPORT_SYMBOL_GPL(crypto_alloc_tfm); +//EXPORT_SYMBOL_GPL(crypto_free_tfm); + + diff --git a/drivers/staging/rtl8192u/ieee80211/digest.c b/drivers/staging/rtl8192u/ieee80211/digest.c new file mode 100644 index 000000000000..1a95f2d37837 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/digest.c @@ -0,0 +1,108 @@ +/* + * Cryptographic API. + * + * Digest operations. + * + * Copyright (c) 2002 James Morris + * + * 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. + * + */ +//#include +#include "rtl_crypto.h" +#include +#include +#include +#include +#include "internal.h" + +static void init(struct crypto_tfm *tfm) +{ + tfm->__crt_alg->cra_digest.dia_init(crypto_tfm_ctx(tfm)); +} + +static void update(struct crypto_tfm *tfm, + struct scatterlist *sg, unsigned int nsg) +{ + unsigned int i; + + for (i = 0; i < nsg; i++) { + + struct page *pg = sg[i].page; + unsigned int offset = sg[i].offset; + unsigned int l = sg[i].length; + + do { + unsigned int bytes_from_page = min(l, ((unsigned int) + (PAGE_SIZE)) - + offset); + char *p = crypto_kmap(pg, 0) + offset; + + tfm->__crt_alg->cra_digest.dia_update + (crypto_tfm_ctx(tfm), p, + bytes_from_page); + crypto_kunmap(p, 0); + crypto_yield(tfm); + offset = 0; + pg++; + l -= bytes_from_page; + } while (l > 0); + } +} + +static void final(struct crypto_tfm *tfm, u8 *out) +{ + tfm->__crt_alg->cra_digest.dia_final(crypto_tfm_ctx(tfm), out); +} + +static int setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) +{ + u32 flags; + if (tfm->__crt_alg->cra_digest.dia_setkey == NULL) + return -ENOSYS; + return tfm->__crt_alg->cra_digest.dia_setkey(crypto_tfm_ctx(tfm), + key, keylen, &flags); +} + +static void digest(struct crypto_tfm *tfm, + struct scatterlist *sg, unsigned int nsg, u8 *out) +{ + unsigned int i; + + tfm->crt_digest.dit_init(tfm); + + for (i = 0; i < nsg; i++) { + char *p = crypto_kmap(sg[i].page, 0) + sg[i].offset; + tfm->__crt_alg->cra_digest.dia_update(crypto_tfm_ctx(tfm), + p, sg[i].length); + crypto_kunmap(p, 0); + crypto_yield(tfm); + } + crypto_digest_final(tfm, out); +} + +int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags) +{ + return flags ? -EINVAL : 0; +} + +int crypto_init_digest_ops(struct crypto_tfm *tfm) +{ + struct digest_tfm *ops = &tfm->crt_digest; + + ops->dit_init = init; + ops->dit_update = update; + ops->dit_final = final; + ops->dit_digest = digest; + ops->dit_setkey = setkey; + + return crypto_alloc_hmac_block(tfm); +} + +void crypto_exit_digest_ops(struct crypto_tfm *tfm) +{ + crypto_free_hmac_block(tfm); +} diff --git a/drivers/staging/rtl8192u/ieee80211/dot11d.c b/drivers/staging/rtl8192u/ieee80211/dot11d.c new file mode 100644 index 000000000000..e5f2dedc4372 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/dot11d.c @@ -0,0 +1,239 @@ +#ifdef ENABLE_DOT11D +//----------------------------------------------------------------------------- +// File: +// Dot11d.c +// +// Description: +// Implement 802.11d. +// +//----------------------------------------------------------------------------- + +#include "dot11d.h" + +void +Dot11d_Init(struct ieee80211_device *ieee) +{ + PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee); + + pDot11dInfo->bEnabled = 0; + + pDot11dInfo->State = DOT11D_STATE_NONE; + pDot11dInfo->CountryIeLen = 0; + memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); + memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); + RESET_CIE_WATCHDOG(ieee); + + printk("Dot11d_Init()\n"); +} + +// +// Description: +// Reset to the state as we are just entering a regulatory domain. +// +void +Dot11d_Reset(struct ieee80211_device *ieee) +{ + u32 i; + PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee); +#if 0 + if(!pDot11dInfo->bEnabled) + return; +#endif + // Clear old channel map + memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); + memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); + // Set new channel map + for (i=1; i<=11; i++) { + (pDot11dInfo->channel_map)[i] = 1; + } + for (i=12; i<=14; i++) { + (pDot11dInfo->channel_map)[i] = 2; + } + + pDot11dInfo->State = DOT11D_STATE_NONE; + pDot11dInfo->CountryIeLen = 0; + RESET_CIE_WATCHDOG(ieee); + + //printk("Dot11d_Reset()\n"); +} + +// +// Description: +// Update country IE from Beacon or Probe Resopnse +// and configure PHY for operation in the regulatory domain. +// +// TODO: +// Configure Tx power. +// +// Assumption: +// 1. IS_DOT11D_ENABLE() is TRUE. +// 2. Input IE is an valid one. +// +void +Dot11d_UpdateCountryIe( + struct ieee80211_device *dev, + u8 * pTaddr, + u16 CoutryIeLen, + u8 * pCoutryIe + ) +{ + PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); + u8 i, j, NumTriples, MaxChnlNum; + PCHNL_TXPOWER_TRIPLE pTriple; + + memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); + memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); + MaxChnlNum = 0; + NumTriples = (CoutryIeLen - 3) / 3; // skip 3-byte country string. + pTriple = (PCHNL_TXPOWER_TRIPLE)(pCoutryIe + 3); + for(i = 0; i < NumTriples; i++) + { + if(MaxChnlNum >= pTriple->FirstChnl) + { // It is not in a monotonically increasing order, so stop processing. + printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........1\n"); + return; + } + if(MAX_CHANNEL_NUMBER < (pTriple->FirstChnl + pTriple->NumChnls)) + { // It is not a valid set of channel id, so stop processing. + printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........2\n"); + return; + } + + for(j = 0 ; j < pTriple->NumChnls; j++) + { + pDot11dInfo->channel_map[pTriple->FirstChnl + j] = 1; + pDot11dInfo->MaxTxPwrDbmList[pTriple->FirstChnl + j] = pTriple->MaxTxPowerInDbm; + MaxChnlNum = pTriple->FirstChnl + j; + } + + pTriple = (PCHNL_TXPOWER_TRIPLE)((u8*)pTriple + 3); + } +#if 1 + //printk("Dot11d_UpdateCountryIe(): Channel List:\n"); + printk("Channel List:"); + for(i=1; i<= MAX_CHANNEL_NUMBER; i++) + if(pDot11dInfo->channel_map[i] > 0) + printk(" %d", i); + printk("\n"); +#endif + + UPDATE_CIE_SRC(dev, pTaddr); + + pDot11dInfo->CountryIeLen = CoutryIeLen; + memcpy(pDot11dInfo->CountryIeBuf, pCoutryIe,CoutryIeLen); + pDot11dInfo->State = DOT11D_STATE_LEARNED; +} + + +u8 +DOT11D_GetMaxTxPwrInDbm( + struct ieee80211_device *dev, + u8 Channel + ) +{ + PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); + u8 MaxTxPwrInDbm = 255; + + if(MAX_CHANNEL_NUMBER < Channel) + { + printk("DOT11D_GetMaxTxPwrInDbm(): Invalid Channel\n"); + return MaxTxPwrInDbm; + } + if(pDot11dInfo->channel_map[Channel]) + { + MaxTxPwrInDbm = pDot11dInfo->MaxTxPwrDbmList[Channel]; + } + + return MaxTxPwrInDbm; +} + + +void +DOT11D_ScanComplete( + struct ieee80211_device * dev + ) +{ + PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); + + switch(pDot11dInfo->State) + { + case DOT11D_STATE_LEARNED: + pDot11dInfo->State = DOT11D_STATE_DONE; + break; + + case DOT11D_STATE_DONE: + if( GET_CIE_WATCHDOG(dev) == 0 ) + { // Reset country IE if previous one is gone. + Dot11d_Reset(dev); + } + break; + case DOT11D_STATE_NONE: + break; + } +} + +int IsLegalChannel( + struct ieee80211_device * dev, + u8 channel +) +{ + PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); + + if(MAX_CHANNEL_NUMBER < channel) + { + printk("IsLegalChannel(): Invalid Channel\n"); + return 0; + } + if(pDot11dInfo->channel_map[channel] > 0) + return 1; + return 0; +} + +int ToLegalChannel( + struct ieee80211_device * dev, + u8 channel +) +{ + PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); + u8 default_chn = 0; + u32 i = 0; + + for (i=1; i<= MAX_CHANNEL_NUMBER; i++) + { + if(pDot11dInfo->channel_map[i] > 0) + { + default_chn = i; + break; + } + } + + if(MAX_CHANNEL_NUMBER < channel) + { + printk("IsLegalChannel(): Invalid Channel\n"); + return default_chn; + } + + if(pDot11dInfo->channel_map[channel] > 0) + return channel; + + return default_chn; +} +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) +EXPORT_SYMBOL(Dot11d_Init); +EXPORT_SYMBOL(Dot11d_Reset); +EXPORT_SYMBOL(Dot11d_UpdateCountryIe); +EXPORT_SYMBOL(DOT11D_GetMaxTxPwrInDbm); +EXPORT_SYMBOL(DOT11D_ScanComplete); +EXPORT_SYMBOL(IsLegalChannel); +EXPORT_SYMBOL(ToLegalChannel); +#else +EXPORT_SYMBOL_NOVERS(Dot11d_Init); +EXPORT_SYMBOL_NOVERS(Dot11d_Reset); +EXPORT_SYMBOL_NOVERS(Dot11d_UpdateCountryIe); +EXPORT_SYMBOL_NOVERS(DOT11D_GetMaxTxPwrInDbm); +EXPORT_SYMBOL_NOVERS(DOT11D_ScanComplete); +EXPORT_SYMBOL_NOVERS(IsLegalChannel); +EXPORT_SYMBOL_NOVERS(ToLegalChannel); +#endif + +#endif diff --git a/drivers/staging/rtl8192u/ieee80211/dot11d.h b/drivers/staging/rtl8192u/ieee80211/dot11d.h new file mode 100644 index 000000000000..15b7a4ba37b6 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/dot11d.h @@ -0,0 +1,102 @@ +#ifndef __INC_DOT11D_H +#define __INC_DOT11D_H + +#ifdef ENABLE_DOT11D +#include "ieee80211.h" + +//#define ENABLE_DOT11D + +//#define DOT11D_MAX_CHNL_NUM 83 + +typedef struct _CHNL_TXPOWER_TRIPLE { + u8 FirstChnl; + u8 NumChnls; + u8 MaxTxPowerInDbm; +}CHNL_TXPOWER_TRIPLE, *PCHNL_TXPOWER_TRIPLE; + +typedef enum _DOT11D_STATE { + DOT11D_STATE_NONE = 0, + DOT11D_STATE_LEARNED, + DOT11D_STATE_DONE, +}DOT11D_STATE; + +typedef struct _RT_DOT11D_INFO { + //DECLARE_RT_OBJECT(RT_DOT11D_INFO); + + bool bEnabled; // dot11MultiDomainCapabilityEnabled + + u16 CountryIeLen; // > 0 if CountryIeBuf[] contains valid country information element. + u8 CountryIeBuf[MAX_IE_LEN]; + u8 CountryIeSrcAddr[6]; // Source AP of the country IE. + u8 CountryIeWatchdog; + + u8 channel_map[MAX_CHANNEL_NUMBER+1]; //!!!Value 0: Invalid, 1: Valid (active scan), 2: Valid (passive scan) + //u8 ChnlListLen; // #Bytes valid in ChnlList[]. + //u8 ChnlList[DOT11D_MAX_CHNL_NUM]; + u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER+1]; + + DOT11D_STATE State; +}RT_DOT11D_INFO, *PRT_DOT11D_INFO; +#define eqMacAddr(a,b) ( ((a)[0]==(b)[0] && (a)[1]==(b)[1] && (a)[2]==(b)[2] && (a)[3]==(b)[3] && (a)[4]==(b)[4] && (a)[5]==(b)[5]) ? 1:0 ) +#define cpMacAddr(des,src) ((des)[0]=(src)[0],(des)[1]=(src)[1],(des)[2]=(src)[2],(des)[3]=(src)[3],(des)[4]=(src)[4],(des)[5]=(src)[5]) +#define GET_DOT11D_INFO(__pIeeeDev) ((PRT_DOT11D_INFO)((__pIeeeDev)->pDot11dInfo)) + +#define IS_DOT11D_ENABLE(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->bEnabled +#define IS_COUNTRY_IE_VALID(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0) + +#define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) eqMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) +#define UPDATE_CIE_SRC(__pIeeeDev, __pTa) cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) + +#define IS_COUNTRY_IE_CHANGED(__pIeeeDev, __Ie) \ + (((__Ie).Length == 0 || (__Ie).Length != GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen) ? \ + FALSE : \ + (!memcmp(GET_DOT11D_INFO(__pIeeeDev)->CountryIeBuf, (__Ie).Octet, (__Ie).Length))) + +#define CIE_WATCHDOG_TH 1 +#define GET_CIE_WATCHDOG(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog +#define RESET_CIE_WATCHDOG(__pIeeeDev) GET_CIE_WATCHDOG(__pIeeeDev) = 0 +#define UPDATE_CIE_WATCHDOG(__pIeeeDev) ++GET_CIE_WATCHDOG(__pIeeeDev) + +#define IS_DOT11D_STATE_DONE(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->State == DOT11D_STATE_DONE) + + +void +Dot11d_Init( + struct ieee80211_device *dev + ); + +void +Dot11d_Reset( + struct ieee80211_device *dev + ); + +void +Dot11d_UpdateCountryIe( + struct ieee80211_device *dev, + u8 * pTaddr, + u16 CoutryIeLen, + u8 * pCoutryIe + ); + +u8 +DOT11D_GetMaxTxPwrInDbm( + struct ieee80211_device *dev, + u8 Channel + ); + +void +DOT11D_ScanComplete( + struct ieee80211_device * dev + ); + +int IsLegalChannel( + struct ieee80211_device * dev, + u8 channel +); + +int ToLegalChannel( + struct ieee80211_device * dev, + u8 channel +); +#endif //ENABLE_DOT11D +#endif // #ifndef __INC_DOT11D_H diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h new file mode 100644 index 000000000000..e99c6ede42a2 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -0,0 +1,2796 @@ +/* + * Merged with mainline ieee80211.h in Aug 2004. Original ieee802_11 + * remains copyright by the original authors + * + * Portions of the merged code are based on Host AP (software wireless + * LAN access point) driver for Intersil Prism2/2.5/3. + * + * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen + * + * Copyright (c) 2002-2003, Jouni Malinen + * + * Adaption to a generic IEEE 802.11 stack by James Ketrenos + * + * Copyright (c) 2004, Intel Corporation + * + * Modified for Realtek's wi-fi cards by Andrea Merello + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. See README and COPYING for + * more details. + */ +#ifndef IEEE80211_H +#define IEEE80211_H +#include /* ETH_ALEN */ +#include /* ARRAY_SIZE */ +#include +#include +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) +#include +#else +#include +#include +#endif +#include +#include + +#include +#include + +#include "rtl819x_HT.h" +#include "rtl819x_BA.h" +#include "rtl819x_TS.h" + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) +#ifndef bool +typedef enum{false = 0, true} bool; +#endif +#endif + +#ifndef IW_MODE_MONITOR +#define IW_MODE_MONITOR 6 +#endif + +#ifndef IWEVCUSTOM +#define IWEVCUSTOM 0x8c02 +#endif + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +#ifndef __bitwise +#define __bitwise __attribute__((bitwise)) +#endif +typedef __u16 __le16; +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27)) +struct iw_spy_data{ + /* --- Standard spy support --- */ + int spy_number; + u_char spy_address[IW_MAX_SPY][ETH_ALEN]; + struct iw_quality spy_stat[IW_MAX_SPY]; + /* --- Enhanced spy support (event) */ + struct iw_quality spy_thr_low; /* Low threshold */ + struct iw_quality spy_thr_high; /* High threshold */ + u_char spy_thr_under[IW_MAX_SPY]; +}; +#endif +#endif + +#ifndef container_of +/** + * container_of - cast a member of a structure out to the containing structure + * + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. + * + */ +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) +#endif + +#define KEY_TYPE_NA 0x0 +#define KEY_TYPE_WEP40 0x1 +#define KEY_TYPE_TKIP 0x2 +#define KEY_TYPE_CCMP 0x4 +#define KEY_TYPE_WEP104 0x5 + +/* added for rtl819x tx procedure */ +#define MAX_QUEUE_SIZE 0x10 + +// +// 8190 queue mapping +// +#define BK_QUEUE 0 +#define BE_QUEUE 1 +#define VI_QUEUE 2 +#define VO_QUEUE 3 +#define HCCA_QUEUE 4 +#define TXCMD_QUEUE 5 +#define MGNT_QUEUE 6 +#define HIGH_QUEUE 7 +#define BEACON_QUEUE 8 + +#define LOW_QUEUE BE_QUEUE +#define NORMAL_QUEUE MGNT_QUEUE + +//added by amy for ps +#define SWRF_TIMEOUT 50 + +//added by amy for LEAP related +#define IE_CISCO_FLAG_POSITION 0x08 // Flag byte: byte 8, numbered from 0. +#define SUPPORT_CKIP_MIC 0x08 // bit3 +#define SUPPORT_CKIP_PK 0x10 // bit4 +/* defined for skb cb field */ +/* At most 28 byte */ +typedef struct cb_desc { + /* Tx Desc Related flags (8-9) */ + u8 bLastIniPkt:1; + u8 bCmdOrInit:1; + u8 bFirstSeg:1; + u8 bLastSeg:1; + u8 bEncrypt:1; + u8 bTxDisableRateFallBack:1; + u8 bTxUseDriverAssingedRate:1; + u8 bHwSec:1; //indicate whether use Hw security. WB + + u8 reserved1; + + /* Tx Firmware Relaged flags (10-11)*/ + u8 bCTSEnable:1; + u8 bRTSEnable:1; + u8 bUseShortGI:1; + u8 bUseShortPreamble:1; + u8 bTxEnableFwCalcDur:1; + u8 bAMPDUEnable:1; + u8 bRTSSTBC:1; + u8 RTSSC:1; + + u8 bRTSBW:1; + u8 bPacketBW:1; + u8 bRTSUseShortPreamble:1; + u8 bRTSUseShortGI:1; + u8 bMulticast:1; + u8 bBroadcast:1; + //u8 reserved2:2; + u8 drv_agg_enable:1; + u8 reserved2:1; + + /* Tx Desc related element(12-19) */ + u8 rata_index; + u8 queue_index; + //u8 reserved3; + //u8 reserved4; + u16 txbuf_size; + //u8 reserved5; + u8 RATRIndex; + u8 reserved6; + u8 reserved7; + u8 reserved8; + + /* Tx firmware related element(20-27) */ + u8 data_rate; + u8 rts_rate; + u8 ampdu_factor; + u8 ampdu_density; + //u8 reserved9; + //u8 reserved10; + //u8 reserved11; + u8 DrvAggrNum; + u16 pkt_size; + u8 reserved12; +}cb_desc, *pcb_desc; + +/*--------------------------Define -------------------------------------------*/ +#define MGN_1M 0x02 +#define MGN_2M 0x04 +#define MGN_5_5M 0x0b +#define MGN_11M 0x16 + +#define MGN_6M 0x0c +#define MGN_9M 0x12 +#define MGN_12M 0x18 +#define MGN_18M 0x24 +#define MGN_24M 0x30 +#define MGN_36M 0x48 +#define MGN_48M 0x60 +#define MGN_54M 0x6c + +#define MGN_MCS0 0x80 +#define MGN_MCS1 0x81 +#define MGN_MCS2 0x82 +#define MGN_MCS3 0x83 +#define MGN_MCS4 0x84 +#define MGN_MCS5 0x85 +#define MGN_MCS6 0x86 +#define MGN_MCS7 0x87 +#define MGN_MCS8 0x88 +#define MGN_MCS9 0x89 +#define MGN_MCS10 0x8a +#define MGN_MCS11 0x8b +#define MGN_MCS12 0x8c +#define MGN_MCS13 0x8d +#define MGN_MCS14 0x8e +#define MGN_MCS15 0x8f + +//---------------------------------------------------------------------------- +// 802.11 Management frame Reason Code field +//---------------------------------------------------------------------------- +enum _ReasonCode{ + unspec_reason = 0x1, + auth_not_valid = 0x2, + deauth_lv_ss = 0x3, + inactivity = 0x4, + ap_overload = 0x5, + class2_err = 0x6, + class3_err = 0x7, + disas_lv_ss = 0x8, + asoc_not_auth = 0x9, + + //----MIC_CHECK + mic_failure = 0xe, + //----END MIC_CHECK + + // Reason code defined in 802.11i D10.0 p.28. + invalid_IE = 0x0d, + four_way_tmout = 0x0f, + two_way_tmout = 0x10, + IE_dismatch = 0x11, + invalid_Gcipher = 0x12, + invalid_Pcipher = 0x13, + invalid_AKMP = 0x14, + unsup_RSNIEver = 0x15, + invalid_RSNIE = 0x16, + auth_802_1x_fail= 0x17, + ciper_reject = 0x18, + + // Reason code defined in 7.3.1.7, 802.1e D13.0, p.42. Added by Annie, 2005-11-15. + QoS_unspec = 0x20, // 32 + QAP_bandwidth = 0x21, // 33 + poor_condition = 0x22, // 34 + no_facility = 0x23, // 35 + // Where is 36??? + req_declined = 0x25, // 37 + invalid_param = 0x26, // 38 + req_not_honored= 0x27, // 39 + TS_not_created = 0x2F, // 47 + DL_not_allowed = 0x30, // 48 + dest_not_exist = 0x31, // 49 + dest_not_QSTA = 0x32, // 50 +}; + + + +#define aSifsTime ((priv->ieee80211->current_network.mode == IEEE_A)||(priv->ieee80211->current_network.mode == IEEE_N_24G)||(priv->ieee80211->current_network.mode == IEEE_N_5G))? 16 : 10 + +#define MGMT_QUEUE_NUM 5 + +#define IEEE_CMD_SET_WPA_PARAM 1 +#define IEEE_CMD_SET_WPA_IE 2 +#define IEEE_CMD_SET_ENCRYPTION 3 +#define IEEE_CMD_MLME 4 + +#define IEEE_PARAM_WPA_ENABLED 1 +#define IEEE_PARAM_TKIP_COUNTERMEASURES 2 +#define IEEE_PARAM_DROP_UNENCRYPTED 3 +#define IEEE_PARAM_PRIVACY_INVOKED 4 +#define IEEE_PARAM_AUTH_ALGS 5 +#define IEEE_PARAM_IEEE_802_1X 6 +//It should consistent with the driver_XXX.c +// David, 2006.9.26 +#define IEEE_PARAM_WPAX_SELECT 7 +//Added for notify the encryption type selection +// David, 2006.9.26 +#define IEEE_PROTO_WPA 1 +#define IEEE_PROTO_RSN 2 +//Added for notify the encryption type selection +// David, 2006.9.26 +#define IEEE_WPAX_USEGROUP 0 +#define IEEE_WPAX_WEP40 1 +#define IEEE_WPAX_TKIP 2 +#define IEEE_WPAX_WRAP 3 +#define IEEE_WPAX_CCMP 4 +#define IEEE_WPAX_WEP104 5 + +#define IEEE_KEY_MGMT_IEEE8021X 1 +#define IEEE_KEY_MGMT_PSK 2 + +#define IEEE_MLME_STA_DEAUTH 1 +#define IEEE_MLME_STA_DISASSOC 2 + + +#define IEEE_CRYPT_ERR_UNKNOWN_ALG 2 +#define IEEE_CRYPT_ERR_UNKNOWN_ADDR 3 +#define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4 +#define IEEE_CRYPT_ERR_KEY_SET_FAILED 5 +#define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED 6 +#define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7 + + +#define IEEE_CRYPT_ALG_NAME_LEN 16 + +#define MAX_IE_LEN 0xff + +// added for kernel conflict +#define ieee80211_crypt_deinit_entries ieee80211_crypt_deinit_entries_rsl +#define ieee80211_crypt_deinit_handler ieee80211_crypt_deinit_handler_rsl +#define ieee80211_crypt_delayed_deinit ieee80211_crypt_delayed_deinit_rsl +#define ieee80211_register_crypto_ops ieee80211_register_crypto_ops_rsl +#define ieee80211_unregister_crypto_ops ieee80211_unregister_crypto_ops_rsl +#define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rsl + +#define ieee80211_ccmp_null ieee80211_ccmp_null_rsl + +#define ieee80211_tkip_null ieee80211_tkip_null_rsl + +#define ieee80211_wep_null ieee80211_wep_null_rsl + +#define free_ieee80211 free_ieee80211_rsl +#define alloc_ieee80211 alloc_ieee80211_rsl + +#define ieee80211_rx ieee80211_rx_rsl +#define ieee80211_rx_mgt ieee80211_rx_mgt_rsl + +#define ieee80211_get_beacon ieee80211_get_beacon_rsl +#define ieee80211_wake_queue ieee80211_wake_queue_rsl +#define ieee80211_stop_queue ieee80211_stop_queue_rsl +#define ieee80211_reset_queue ieee80211_reset_queue_rsl +#define ieee80211_softmac_stop_protocol ieee80211_softmac_stop_protocol_rsl +#define ieee80211_softmac_start_protocol ieee80211_softmac_start_protocol_rsl +#define ieee80211_is_shortslot ieee80211_is_shortslot_rsl +#define ieee80211_is_54g ieee80211_is_54g_rsl +#define ieee80211_wpa_supplicant_ioctl ieee80211_wpa_supplicant_ioctl_rsl +#define ieee80211_ps_tx_ack ieee80211_ps_tx_ack_rsl +#define ieee80211_softmac_xmit ieee80211_softmac_xmit_rsl +#define ieee80211_stop_send_beacons ieee80211_stop_send_beacons_rsl +#define notify_wx_assoc_event notify_wx_assoc_event_rsl +#define SendDisassociation SendDisassociation_rsl +#define ieee80211_disassociate ieee80211_disassociate_rsl +#define ieee80211_start_send_beacons ieee80211_start_send_beacons_rsl +#define ieee80211_stop_scan ieee80211_stop_scan_rsl +#define ieee80211_send_probe_requests ieee80211_send_probe_requests_rsl +#define ieee80211_softmac_scan_syncro ieee80211_softmac_scan_syncro_rsl +#define ieee80211_start_scan_syncro ieee80211_start_scan_syncro_rsl + +#define ieee80211_wx_get_essid ieee80211_wx_get_essid_rsl +#define ieee80211_wx_set_essid ieee80211_wx_set_essid_rsl +#define ieee80211_wx_set_rate ieee80211_wx_set_rate_rsl +#define ieee80211_wx_get_rate ieee80211_wx_get_rate_rsl +#define ieee80211_wx_set_wap ieee80211_wx_set_wap_rsl +#define ieee80211_wx_get_wap ieee80211_wx_get_wap_rsl +#define ieee80211_wx_set_mode ieee80211_wx_set_mode_rsl +#define ieee80211_wx_get_mode ieee80211_wx_get_mode_rsl +#define ieee80211_wx_set_scan ieee80211_wx_set_scan_rsl +#define ieee80211_wx_get_freq ieee80211_wx_get_freq_rsl +#define ieee80211_wx_set_freq ieee80211_wx_set_freq_rsl +#define ieee80211_wx_set_rawtx ieee80211_wx_set_rawtx_rsl +#define ieee80211_wx_get_name ieee80211_wx_get_name_rsl +#define ieee80211_wx_set_power ieee80211_wx_set_power_rsl +#define ieee80211_wx_get_power ieee80211_wx_get_power_rsl +#define ieee80211_wlan_frequencies ieee80211_wlan_frequencies_rsl +#define ieee80211_wx_set_rts ieee80211_wx_set_rts_rsl +#define ieee80211_wx_get_rts ieee80211_wx_get_rts_rsl + +#define ieee80211_txb_free ieee80211_txb_free_rsl + +#define ieee80211_wx_set_gen_ie ieee80211_wx_set_gen_ie_rsl +#define ieee80211_wx_get_scan ieee80211_wx_get_scan_rsl +#define ieee80211_wx_set_encode ieee80211_wx_set_encode_rsl +#define ieee80211_wx_get_encode ieee80211_wx_get_encode_rsl +#if WIRELESS_EXT >= 18 +#define ieee80211_wx_set_mlme ieee80211_wx_set_mlme_rsl +#define ieee80211_wx_set_auth ieee80211_wx_set_auth_rsl +#define ieee80211_wx_set_encode_ext ieee80211_wx_set_encode_ext_rsl +#define ieee80211_wx_get_encode_ext ieee80211_wx_get_encode_ext_rsl +#endif + + +typedef struct ieee_param { + u32 cmd; + u8 sta_addr[ETH_ALEN]; + union { + struct { + u8 name; + u32 value; + } wpa_param; + struct { + u32 len; + u8 reserved[32]; + u8 data[0]; + } wpa_ie; + struct{ + int command; + int reason_code; + } mlme; + struct { + u8 alg[IEEE_CRYPT_ALG_NAME_LEN]; + u8 set_tx; + u32 err; + u8 idx; + u8 seq[8]; /* sequence counter (set: RX, get: TX) */ + u16 key_len; + u8 key[0]; + } crypt; + } u; +}ieee_param; + + +#if WIRELESS_EXT < 17 +#define IW_QUAL_QUAL_INVALID 0x10 +#define IW_QUAL_LEVEL_INVALID 0x20 +#define IW_QUAL_NOISE_INVALID 0x40 +#define IW_QUAL_QUAL_UPDATED 0x1 +#define IW_QUAL_LEVEL_UPDATED 0x2 +#define IW_QUAL_NOISE_UPDATED 0x4 +#endif + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +static inline void tq_init(struct tq_struct * task, void(*func)(void *), void *data) +{ + task->routine = func; + task->data = data; + //task->next = NULL; + INIT_LIST_HEAD(&task->list); + task->sync = 0; +} +#endif + +// linux under 2.6.9 release may not support it, so modify it for common use +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)) +//#define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ) +#define MSECS(t) (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000) +static inline unsigned long msleep_interruptible_rsl(unsigned int msecs) +{ + unsigned long timeout = MSECS(msecs) + 1; + + while (timeout) { + set_current_state(TASK_INTERRUPTIBLE); + timeout = schedule_timeout(timeout); + } + return timeout; +} +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31)) +static inline void msleep(unsigned int msecs) +{ + unsigned long timeout = MSECS(msecs) + 1; + + while (timeout) { + set_current_state(TASK_UNINTERRUPTIBLE); + timeout = schedule_timeout(timeout); + } +} +#endif +#else +#define MSECS(t) msecs_to_jiffies(t) +#define msleep_interruptible_rsl msleep_interruptible +#endif + +#define IEEE80211_DATA_LEN 2304 +/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section + 6.2.1.1.2. + + The figure in section 7.1.2 suggests a body size of up to 2312 + bytes is allowed, which is a bit confusing, I suspect this + represents the 2304 bytes of real data, plus a possible 8 bytes of + WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ +#define IEEE80211_1ADDR_LEN 10 +#define IEEE80211_2ADDR_LEN 16 +#define IEEE80211_3ADDR_LEN 24 +#define IEEE80211_4ADDR_LEN 30 +#define IEEE80211_FCS_LEN 4 +#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) +#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) +#define IEEE80211_MGMT_HDR_LEN 24 +#define IEEE80211_DATA_HDR3_LEN 24 +#define IEEE80211_DATA_HDR4_LEN 30 + +#define MIN_FRAG_THRESHOLD 256U +#define MAX_FRAG_THRESHOLD 2346U + + +/* Frame control field constants */ +#define IEEE80211_FCTL_VERS 0x0003 +#define IEEE80211_FCTL_FTYPE 0x000c +#define IEEE80211_FCTL_STYPE 0x00f0 +#define IEEE80211_FCTL_FRAMETYPE 0x00fc +#define IEEE80211_FCTL_TODS 0x0100 +#define IEEE80211_FCTL_FROMDS 0x0200 +#define IEEE80211_FCTL_DSTODS 0x0300 //added by david +#define IEEE80211_FCTL_MOREFRAGS 0x0400 +#define IEEE80211_FCTL_RETRY 0x0800 +#define IEEE80211_FCTL_PM 0x1000 +#define IEEE80211_FCTL_MOREDATA 0x2000 +#define IEEE80211_FCTL_WEP 0x4000 +#define IEEE80211_FCTL_ORDER 0x8000 + +#define IEEE80211_FTYPE_MGMT 0x0000 +#define IEEE80211_FTYPE_CTL 0x0004 +#define IEEE80211_FTYPE_DATA 0x0008 + +/* management */ +#define IEEE80211_STYPE_ASSOC_REQ 0x0000 +#define IEEE80211_STYPE_ASSOC_RESP 0x0010 +#define IEEE80211_STYPE_REASSOC_REQ 0x0020 +#define IEEE80211_STYPE_REASSOC_RESP 0x0030 +#define IEEE80211_STYPE_PROBE_REQ 0x0040 +#define IEEE80211_STYPE_PROBE_RESP 0x0050 +#define IEEE80211_STYPE_BEACON 0x0080 +#define IEEE80211_STYPE_ATIM 0x0090 +#define IEEE80211_STYPE_DISASSOC 0x00A0 +#define IEEE80211_STYPE_AUTH 0x00B0 +#define IEEE80211_STYPE_DEAUTH 0x00C0 +#define IEEE80211_STYPE_MANAGE_ACT 0x00D0 + +/* control */ +#define IEEE80211_STYPE_PSPOLL 0x00A0 +#define IEEE80211_STYPE_RTS 0x00B0 +#define IEEE80211_STYPE_CTS 0x00C0 +#define IEEE80211_STYPE_ACK 0x00D0 +#define IEEE80211_STYPE_CFEND 0x00E0 +#define IEEE80211_STYPE_CFENDACK 0x00F0 +#define IEEE80211_STYPE_BLOCKACK 0x0094 + +/* data */ +#define IEEE80211_STYPE_DATA 0x0000 +#define IEEE80211_STYPE_DATA_CFACK 0x0010 +#define IEEE80211_STYPE_DATA_CFPOLL 0x0020 +#define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030 +#define IEEE80211_STYPE_NULLFUNC 0x0040 +#define IEEE80211_STYPE_CFACK 0x0050 +#define IEEE80211_STYPE_CFPOLL 0x0060 +#define IEEE80211_STYPE_CFACKPOLL 0x0070 +#define IEEE80211_STYPE_QOS_DATA 0x0080 //added for WMM 2006/8/2 +#define IEEE80211_STYPE_QOS_NULL 0x00C0 + +#define IEEE80211_SCTL_FRAG 0x000F +#define IEEE80211_SCTL_SEQ 0xFFF0 + +/* QOS control */ +#define IEEE80211_QCTL_TID 0x000F + +#define FC_QOS_BIT BIT7 +#define IsDataFrame(pdu) ( ((pdu[0] & 0x0C)==0x08) ? true : false ) +#define IsLegacyDataFrame(pdu) (IsDataFrame(pdu) && (!(pdu[0]&FC_QOS_BIT)) ) +//added by wb. Is this right? +#define IsQoSDataFrame(pframe) ((*(u16*)pframe&(IEEE80211_STYPE_QOS_DATA|IEEE80211_FTYPE_DATA)) == (IEEE80211_STYPE_QOS_DATA|IEEE80211_FTYPE_DATA)) +#define Frame_Order(pframe) (*(u16*)pframe&IEEE80211_FCTL_ORDER) +#define SN_LESS(a, b) (((a-b)&0x800)!=0) +#define SN_EQUAL(a, b) (a == b) +#define MAX_DEV_ADDR_SIZE 8 +typedef enum _ACT_CATEGORY{ + ACT_CAT_QOS = 1, + ACT_CAT_DLS = 2, + ACT_CAT_BA = 3, + ACT_CAT_HT = 7, + ACT_CAT_WMM = 17, +} ACT_CATEGORY, *PACT_CATEGORY; + +typedef enum _TS_ACTION{ + ACT_ADDTSREQ = 0, + ACT_ADDTSRSP = 1, + ACT_DELTS = 2, + ACT_SCHEDULE = 3, +} TS_ACTION, *PTS_ACTION; + +typedef enum _BA_ACTION{ + ACT_ADDBAREQ = 0, + ACT_ADDBARSP = 1, + ACT_DELBA = 2, +} BA_ACTION, *PBA_ACTION; + +typedef enum _InitialGainOpType{ + IG_Backup=0, + IG_Restore, + IG_Max +}InitialGainOpType; + +/* debug macros */ +#define CONFIG_IEEE80211_DEBUG +#ifdef CONFIG_IEEE80211_DEBUG +extern u32 ieee80211_debug_level; +#define IEEE80211_DEBUG(level, fmt, args...) \ +do { if (ieee80211_debug_level & (level)) \ + printk(KERN_DEBUG "ieee80211: " fmt, ## args); } while (0) +//wb added to debug out data buf +//if you want print DATA buffer related BA, please set ieee80211_debug_level to DATA|BA +#define IEEE80211_DEBUG_DATA(level, data, datalen) \ + do{ if ((ieee80211_debug_level & (level)) == (level)) \ + { \ + int i; \ + u8* pdata = (u8*) data; \ + printk(KERN_DEBUG "ieee80211: %s()\n", __FUNCTION__); \ + for(i=0; i<(int)(datalen); i++) \ + { \ + printk("%2x ", pdata[i]); \ + if ((i+1)%16 == 0) printk("\n"); \ + } \ + printk("\n"); \ + } \ + } while (0) +#else +#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) +#define IEEE80211_DEBUG_DATA(level, data, datalen) do {} while(0) +#endif /* CONFIG_IEEE80211_DEBUG */ + +/* debug macros not dependent on CONFIG_IEEE80211_DEBUG */ + +#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" +#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5] + +/* + * To use the debug system; + * + * If you are defining a new debug classification, simply add it to the #define + * list here in the form of: + * + * #define IEEE80211_DL_xxxx VALUE + * + * shifting value to the left one bit from the previous entry. xxxx should be + * the name of the classification (for example, WEP) + * + * You then need to either add a IEEE80211_xxxx_DEBUG() macro definition for your + * classification, or use IEEE80211_DEBUG(IEEE80211_DL_xxxx, ...) whenever you want + * to send output to that classification. + * + * To add your debug level to the list of levels seen when you perform + * + * % cat /proc/net/ipw/debug_level + * + * you simply need to add your entry to the ipw_debug_levels array. + * + * If you do not see debug_level in /proc/net/ipw then you do not have + * CONFIG_IEEE80211_DEBUG defined in your kernel configuration + * + */ + +#define IEEE80211_DL_INFO (1<<0) +#define IEEE80211_DL_WX (1<<1) +#define IEEE80211_DL_SCAN (1<<2) +#define IEEE80211_DL_STATE (1<<3) +#define IEEE80211_DL_MGMT (1<<4) +#define IEEE80211_DL_FRAG (1<<5) +#define IEEE80211_DL_EAP (1<<6) +#define IEEE80211_DL_DROP (1<<7) + +#define IEEE80211_DL_TX (1<<8) +#define IEEE80211_DL_RX (1<<9) + +#define IEEE80211_DL_HT (1<<10) //HT +#define IEEE80211_DL_BA (1<<11) //ba +#define IEEE80211_DL_TS (1<<12) //TS +#define IEEE80211_DL_QOS (1<<13) +#define IEEE80211_DL_REORDER (1<<14) +#define IEEE80211_DL_IOT (1<<15) +#define IEEE80211_DL_IPS (1<<16) +#define IEEE80211_DL_TRACE (1<<29) //trace function, need to user net_ratelimit() together in order not to print too much to the screen +#define IEEE80211_DL_DATA (1<<30) //use this flag to control whether print data buf out. +#define IEEE80211_DL_ERR (1<<31) //always open +#define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a) +#define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a) +#define IEEE80211_DEBUG_INFO(f, a...) IEEE80211_DEBUG(IEEE80211_DL_INFO, f, ## a) + +#define IEEE80211_DEBUG_WX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_WX, f, ## a) +#define IEEE80211_DEBUG_SCAN(f, a...) IEEE80211_DEBUG(IEEE80211_DL_SCAN, f, ## a) +#define IEEE80211_DEBUG_STATE(f, a...) IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a) +#define IEEE80211_DEBUG_MGMT(f, a...) IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a) +#define IEEE80211_DEBUG_FRAG(f, a...) IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a) +#define IEEE80211_DEBUG_EAP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_EAP, f, ## a) +#define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a) +#define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a) +#define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a) +#define IEEE80211_DEBUG_QOS(f, a...) IEEE80211_DEBUG(IEEE80211_DL_QOS, f, ## a) + +#ifdef CONFIG_IEEE80211_DEBUG +/* Added by Annie, 2005-11-22. */ +#define MAX_STR_LEN 64 +/* I want to see ASCII 33 to 126 only. Otherwise, I print '?'. Annie, 2005-11-22.*/ +#define PRINTABLE(_ch) (_ch>'!' && _ch<'~') +#define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) \ + if((_Comp) & level) \ + { \ + int __i; \ + u8 buffer[MAX_STR_LEN]; \ + int length = (_Len\n", _Len, buffer); \ + } +#else +#define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) do {} while (0) +#endif + +#include +#include /* ARPHRD_ETHER */ + +#ifndef WIRELESS_SPY +#define WIRELESS_SPY // enable iwspy support +#endif +#include // new driver API + +#ifndef ETH_P_PAE +#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ +#endif /* ETH_P_PAE */ + +#define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */ + +#ifndef ETH_P_80211_RAW +#define ETH_P_80211_RAW (ETH_P_ECONET + 1) +#endif + +/* IEEE 802.11 defines */ + +#define P80211_OUI_LEN 3 + +struct ieee80211_snap_hdr { + + u8 dsap; /* always 0xAA */ + u8 ssap; /* always 0xAA */ + u8 ctrl; /* always 0x03 */ + u8 oui[P80211_OUI_LEN]; /* organizational universal id */ + +} __attribute__ ((packed)); + +#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr) + +#define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS) +#define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE) +#define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE) + +#define WLAN_FC_GET_FRAMETYPE(fc) ((fc) & IEEE80211_FCTL_FRAMETYPE) +#define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG) +#define WLAN_GET_SEQ_SEQ(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) + +/* Authentication algorithms */ +#define WLAN_AUTH_OPEN 0 +#define WLAN_AUTH_SHARED_KEY 1 +#define WLAN_AUTH_LEAP 2 + +#define WLAN_AUTH_CHALLENGE_LEN 128 + +#define WLAN_CAPABILITY_BSS (1<<0) +#define WLAN_CAPABILITY_IBSS (1<<1) +#define WLAN_CAPABILITY_CF_POLLABLE (1<<2) +#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3) +#define WLAN_CAPABILITY_PRIVACY (1<<4) +#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) +#define WLAN_CAPABILITY_PBCC (1<<6) +#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) +#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8) +#define WLAN_CAPABILITY_QOS (1<<9) +#define WLAN_CAPABILITY_SHORT_SLOT (1<<10) +#define WLAN_CAPABILITY_DSSS_OFDM (1<<13) + +/* 802.11g ERP information element */ +#define WLAN_ERP_NON_ERP_PRESENT (1<<0) +#define WLAN_ERP_USE_PROTECTION (1<<1) +#define WLAN_ERP_BARKER_PREAMBLE (1<<2) + +/* Status codes */ +enum ieee80211_statuscode { + WLAN_STATUS_SUCCESS = 0, + WLAN_STATUS_UNSPECIFIED_FAILURE = 1, + WLAN_STATUS_CAPS_UNSUPPORTED = 10, + WLAN_STATUS_REASSOC_NO_ASSOC = 11, + WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12, + WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13, + WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14, + WLAN_STATUS_CHALLENGE_FAIL = 15, + WLAN_STATUS_AUTH_TIMEOUT = 16, + WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17, + WLAN_STATUS_ASSOC_DENIED_RATES = 18, + /* 802.11b */ + WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19, + WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20, + WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21, + /* 802.11h */ + WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22, + WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23, + WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24, + /* 802.11g */ + WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25, + WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26, + /* 802.11i */ + WLAN_STATUS_INVALID_IE = 40, + WLAN_STATUS_INVALID_GROUP_CIPHER = 41, + WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42, + WLAN_STATUS_INVALID_AKMP = 43, + WLAN_STATUS_UNSUPP_RSN_VERSION = 44, + WLAN_STATUS_INVALID_RSN_IE_CAP = 45, + WLAN_STATUS_CIPHER_SUITE_REJECTED = 46, +}; + +/* Reason codes */ +enum ieee80211_reasoncode { + WLAN_REASON_UNSPECIFIED = 1, + WLAN_REASON_PREV_AUTH_NOT_VALID = 2, + WLAN_REASON_DEAUTH_LEAVING = 3, + WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4, + WLAN_REASON_DISASSOC_AP_BUSY = 5, + WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6, + WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7, + WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8, + WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9, + /* 802.11h */ + WLAN_REASON_DISASSOC_BAD_POWER = 10, + WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11, + /* 802.11i */ + WLAN_REASON_INVALID_IE = 13, + WLAN_REASON_MIC_FAILURE = 14, + WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, + WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16, + WLAN_REASON_IE_DIFFERENT = 17, + WLAN_REASON_INVALID_GROUP_CIPHER = 18, + WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19, + WLAN_REASON_INVALID_AKMP = 20, + WLAN_REASON_UNSUPP_RSN_VERSION = 21, + WLAN_REASON_INVALID_RSN_IE_CAP = 22, + WLAN_REASON_IEEE8021X_FAILED = 23, + WLAN_REASON_CIPHER_SUITE_REJECTED = 24, +}; + +#define IEEE80211_STATMASK_SIGNAL (1<<0) +#define IEEE80211_STATMASK_RSSI (1<<1) +#define IEEE80211_STATMASK_NOISE (1<<2) +#define IEEE80211_STATMASK_RATE (1<<3) +#define IEEE80211_STATMASK_WEMASK 0x7 + +#define IEEE80211_CCK_MODULATION (1<<0) +#define IEEE80211_OFDM_MODULATION (1<<1) + +#define IEEE80211_24GHZ_BAND (1<<0) +#define IEEE80211_52GHZ_BAND (1<<1) + +#define IEEE80211_CCK_RATE_LEN 4 +#define IEEE80211_CCK_RATE_1MB 0x02 +#define IEEE80211_CCK_RATE_2MB 0x04 +#define IEEE80211_CCK_RATE_5MB 0x0B +#define IEEE80211_CCK_RATE_11MB 0x16 +#define IEEE80211_OFDM_RATE_LEN 8 +#define IEEE80211_OFDM_RATE_6MB 0x0C +#define IEEE80211_OFDM_RATE_9MB 0x12 +#define IEEE80211_OFDM_RATE_12MB 0x18 +#define IEEE80211_OFDM_RATE_18MB 0x24 +#define IEEE80211_OFDM_RATE_24MB 0x30 +#define IEEE80211_OFDM_RATE_36MB 0x48 +#define IEEE80211_OFDM_RATE_48MB 0x60 +#define IEEE80211_OFDM_RATE_54MB 0x6C +#define IEEE80211_BASIC_RATE_MASK 0x80 + +#define IEEE80211_CCK_RATE_1MB_MASK (1<<0) +#define IEEE80211_CCK_RATE_2MB_MASK (1<<1) +#define IEEE80211_CCK_RATE_5MB_MASK (1<<2) +#define IEEE80211_CCK_RATE_11MB_MASK (1<<3) +#define IEEE80211_OFDM_RATE_6MB_MASK (1<<4) +#define IEEE80211_OFDM_RATE_9MB_MASK (1<<5) +#define IEEE80211_OFDM_RATE_12MB_MASK (1<<6) +#define IEEE80211_OFDM_RATE_18MB_MASK (1<<7) +#define IEEE80211_OFDM_RATE_24MB_MASK (1<<8) +#define IEEE80211_OFDM_RATE_36MB_MASK (1<<9) +#define IEEE80211_OFDM_RATE_48MB_MASK (1<<10) +#define IEEE80211_OFDM_RATE_54MB_MASK (1<<11) + +#define IEEE80211_CCK_RATES_MASK 0x0000000F +#define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \ + IEEE80211_CCK_RATE_2MB_MASK) +#define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \ + IEEE80211_CCK_RATE_5MB_MASK | \ + IEEE80211_CCK_RATE_11MB_MASK) + +#define IEEE80211_OFDM_RATES_MASK 0x00000FF0 +#define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \ + IEEE80211_OFDM_RATE_12MB_MASK | \ + IEEE80211_OFDM_RATE_24MB_MASK) +#define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \ + IEEE80211_OFDM_RATE_9MB_MASK | \ + IEEE80211_OFDM_RATE_18MB_MASK | \ + IEEE80211_OFDM_RATE_36MB_MASK | \ + IEEE80211_OFDM_RATE_48MB_MASK | \ + IEEE80211_OFDM_RATE_54MB_MASK) +#define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \ + IEEE80211_CCK_DEFAULT_RATES_MASK) + +#define IEEE80211_NUM_OFDM_RATES 8 +#define IEEE80211_NUM_CCK_RATES 4 +#define IEEE80211_OFDM_SHIFT_MASK_A 4 + + +/* this is stolen and modified from the madwifi driver*/ +#define IEEE80211_FC0_TYPE_MASK 0x0c +#define IEEE80211_FC0_TYPE_DATA 0x08 +#define IEEE80211_FC0_SUBTYPE_MASK 0xB0 +#define IEEE80211_FC0_SUBTYPE_QOS 0x80 + +#define IEEE80211_QOS_HAS_SEQ(fc) \ + (((fc) & (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) == \ + (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS)) + +/* this is stolen from ipw2200 driver */ +#define IEEE_IBSS_MAC_HASH_SIZE 31 +struct ieee_ibss_seq { + u8 mac[ETH_ALEN]; + u16 seq_num[17]; + u16 frag_num[17]; + unsigned long packet_time[17]; + struct list_head list; +}; + +/* NOTE: This data is for statistical purposes; not all hardware provides this + * information for frames received. Not setting these will not cause + * any adverse affects. */ +struct ieee80211_rx_stats { +#if 1 + u32 mac_time[2]; + s8 rssi; + u8 signal; + u8 noise; + u16 rate; /* in 100 kbps */ + u8 received_channel; + u8 control; + u8 mask; + u8 freq; + u16 len; + u64 tsf; + u32 beacon_time; + u8 nic_type; + u16 Length; + // u8 DataRate; // In 0.5 Mbps + u8 SignalQuality; // in 0-100 index. + s32 RecvSignalPower; // Real power in dBm for this packet, no beautification and aggregation. + s8 RxPower; // in dBm Translate from PWdB + u8 SignalStrength; // in 0-100 index. + u16 bHwError:1; + u16 bCRC:1; + u16 bICV:1; + u16 bShortPreamble:1; + u16 Antenna:1; //for rtl8185 + u16 Decrypted:1; //for rtl8185, rtl8187 + u16 Wakeup:1; //for rtl8185 + u16 Reserved0:1; //for rtl8185 + u8 AGC; + u32 TimeStampLow; + u32 TimeStampHigh; + bool bShift; + bool bIsQosData; // Added by Annie, 2005-12-22. + u8 UserPriority; + + //1!!!!!!!!!!!!!!!!!!!!!!!!!!! + //1Attention Please!!!<11n or 8190 specific code should be put below this line> + //1!!!!!!!!!!!!!!!!!!!!!!!!!!! + + u8 RxDrvInfoSize; + u8 RxBufShift; + bool bIsAMPDU; + bool bFirstMPDU; + bool bContainHTC; + bool RxIs40MHzPacket; + u32 RxPWDBAll; + u8 RxMIMOSignalStrength[4]; // in 0~100 index + s8 RxMIMOSignalQuality[2]; + bool bPacketMatchBSSID; + bool bIsCCK; + bool bPacketToSelf; + //added by amy + u8* virtual_address; + u16 packetlength; // Total packet length: Must equal to sum of all FragLength + u16 fraglength; // FragLength should equal to PacketLength in non-fragment case + u16 fragoffset; // Data offset for this fragment + u16 ntotalfrag; + bool bisrxaggrsubframe; + bool bPacketBeacon; //cosa add for rssi + bool bToSelfBA; //cosa add for rssi + char cck_adc_pwdb[4]; //cosa add for rx path selection + u16 Seq_Num; +#endif + +}; + +/* IEEE 802.11 requires that STA supports concurrent reception of at least + * three fragmented frames. This define can be increased to support more + * concurrent frames, but it should be noted that each entry can consume about + * 2 kB of RAM and increasing cache size will slow down frame reassembly. */ +#define IEEE80211_FRAG_CACHE_LEN 4 + +struct ieee80211_frag_entry { + unsigned long first_frag_time; + unsigned int seq; + unsigned int last_frag; + struct sk_buff *skb; + u8 src_addr[ETH_ALEN]; + u8 dst_addr[ETH_ALEN]; +}; + +struct ieee80211_stats { + unsigned int tx_unicast_frames; + unsigned int tx_multicast_frames; + unsigned int tx_fragments; + unsigned int tx_unicast_octets; + unsigned int tx_multicast_octets; + unsigned int tx_deferred_transmissions; + unsigned int tx_single_retry_frames; + unsigned int tx_multiple_retry_frames; + unsigned int tx_retry_limit_exceeded; + unsigned int tx_discards; + unsigned int rx_unicast_frames; + unsigned int rx_multicast_frames; + unsigned int rx_fragments; + unsigned int rx_unicast_octets; + unsigned int rx_multicast_octets; + unsigned int rx_fcs_errors; + unsigned int rx_discards_no_buffer; + unsigned int tx_discards_wrong_sa; + unsigned int rx_discards_undecryptable; + unsigned int rx_message_in_msg_fragments; + unsigned int rx_message_in_bad_msg_fragments; +}; + +struct ieee80211_device; + +#include "ieee80211_crypt.h" + +#define SEC_KEY_1 (1<<0) +#define SEC_KEY_2 (1<<1) +#define SEC_KEY_3 (1<<2) +#define SEC_KEY_4 (1<<3) +#define SEC_ACTIVE_KEY (1<<4) +#define SEC_AUTH_MODE (1<<5) +#define SEC_UNICAST_GROUP (1<<6) +#define SEC_LEVEL (1<<7) +#define SEC_ENABLED (1<<8) +#define SEC_ENCRYPT (1<<9) + +#define SEC_LEVEL_0 0 /* None */ +#define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */ +#define SEC_LEVEL_2 2 /* Level 1 + TKIP */ +#define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */ +#define SEC_LEVEL_3 4 /* Level 2 + CCMP */ + +#define SEC_ALG_NONE 0 +#define SEC_ALG_WEP 1 +#define SEC_ALG_TKIP 2 +#define SEC_ALG_CCMP 3 + +#define WEP_KEYS 4 +#define WEP_KEY_LEN 13 +#define SCM_KEY_LEN 32 +#define SCM_TEMPORAL_KEY_LENGTH 16 + +struct ieee80211_security { + u16 active_key:2, + enabled:1, + auth_mode:2, + auth_algo:4, + unicast_uses_group:1, + encrypt:1; + u8 key_sizes[WEP_KEYS]; + u8 keys[WEP_KEYS][SCM_KEY_LEN]; + u8 level; + u16 flags; +} __attribute__ ((packed)); + + +/* + 802.11 data frame from AP + ,-------------------------------------------------------------------. +Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | + |------|------|---------|---------|---------|------|---------|------| +Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs | + | | tion | (BSSID) | | | ence | data | | + `-------------------------------------------------------------------' +Total: 28-2340 bytes +*/ + +/* Management Frame Information Element Types */ +enum ieee80211_mfie { + MFIE_TYPE_SSID = 0, + MFIE_TYPE_RATES = 1, + MFIE_TYPE_FH_SET = 2, + MFIE_TYPE_DS_SET = 3, + MFIE_TYPE_CF_SET = 4, + MFIE_TYPE_TIM = 5, + MFIE_TYPE_IBSS_SET = 6, + MFIE_TYPE_COUNTRY = 7, + MFIE_TYPE_HOP_PARAMS = 8, + MFIE_TYPE_HOP_TABLE = 9, + MFIE_TYPE_REQUEST = 10, + MFIE_TYPE_CHALLENGE = 16, + MFIE_TYPE_POWER_CONSTRAINT = 32, + MFIE_TYPE_POWER_CAPABILITY = 33, + MFIE_TYPE_TPC_REQUEST = 34, + MFIE_TYPE_TPC_REPORT = 35, + MFIE_TYPE_SUPP_CHANNELS = 36, + MFIE_TYPE_CSA = 37, + MFIE_TYPE_MEASURE_REQUEST = 38, + MFIE_TYPE_MEASURE_REPORT = 39, + MFIE_TYPE_QUIET = 40, + MFIE_TYPE_IBSS_DFS = 41, + MFIE_TYPE_ERP = 42, + MFIE_TYPE_RSN = 48, + MFIE_TYPE_RATES_EX = 50, + MFIE_TYPE_HT_CAP= 45, + MFIE_TYPE_HT_INFO= 61, + MFIE_TYPE_AIRONET=133, + MFIE_TYPE_GENERIC = 221, + MFIE_TYPE_QOS_PARAMETER = 222, +}; + +/* Minimal header; can be used for passing 802.11 frames with sufficient + * information to determine what type of underlying data type is actually + * stored in the data. */ +struct ieee80211_hdr { + __le16 frame_ctl; + __le16 duration_id; + u8 payload[0]; +} __attribute__ ((packed)); + +struct ieee80211_hdr_1addr { + __le16 frame_ctl; + __le16 duration_id; + u8 addr1[ETH_ALEN]; + u8 payload[0]; +} __attribute__ ((packed)); + +struct ieee80211_hdr_2addr { + __le16 frame_ctl; + __le16 duration_id; + u8 addr1[ETH_ALEN]; + u8 addr2[ETH_ALEN]; + u8 payload[0]; +} __attribute__ ((packed)); + +struct ieee80211_hdr_3addr { + __le16 frame_ctl; + __le16 duration_id; + u8 addr1[ETH_ALEN]; + u8 addr2[ETH_ALEN]; + u8 addr3[ETH_ALEN]; + __le16 seq_ctl; + u8 payload[0]; +} __attribute__ ((packed)); + +struct ieee80211_hdr_4addr { + __le16 frame_ctl; + __le16 duration_id; + u8 addr1[ETH_ALEN]; + u8 addr2[ETH_ALEN]; + u8 addr3[ETH_ALEN]; + __le16 seq_ctl; + u8 addr4[ETH_ALEN]; + u8 payload[0]; +} __attribute__ ((packed)); + +struct ieee80211_hdr_3addrqos { + __le16 frame_ctl; + __le16 duration_id; + u8 addr1[ETH_ALEN]; + u8 addr2[ETH_ALEN]; + u8 addr3[ETH_ALEN]; + __le16 seq_ctl; + u8 payload[0]; + __le16 qos_ctl; +} __attribute__ ((packed)); + +struct ieee80211_hdr_4addrqos { + __le16 frame_ctl; + __le16 duration_id; + u8 addr1[ETH_ALEN]; + u8 addr2[ETH_ALEN]; + u8 addr3[ETH_ALEN]; + __le16 seq_ctl; + u8 addr4[ETH_ALEN]; + u8 payload[0]; + __le16 qos_ctl; +} __attribute__ ((packed)); + +struct ieee80211_info_element { + u8 id; + u8 len; + u8 data[0]; +} __attribute__ ((packed)); + +struct ieee80211_authentication { + struct ieee80211_hdr_3addr header; + __le16 algorithm; + __le16 transaction; + __le16 status; + /*challenge*/ + struct ieee80211_info_element info_element[0]; +} __attribute__ ((packed)); + +struct ieee80211_disassoc { + struct ieee80211_hdr_3addr header; + __le16 reason; +} __attribute__ ((packed)); + +struct ieee80211_probe_request { + struct ieee80211_hdr_3addr header; + /* SSID, supported rates */ + struct ieee80211_info_element info_element[0]; +} __attribute__ ((packed)); + +struct ieee80211_probe_response { + struct ieee80211_hdr_3addr header; + u32 time_stamp[2]; + __le16 beacon_interval; + __le16 capability; + /* SSID, supported rates, FH params, DS params, + * CF params, IBSS params, TIM (if beacon), RSN */ + struct ieee80211_info_element info_element[0]; +} __attribute__ ((packed)); + +/* Alias beacon for probe_response */ +#define ieee80211_beacon ieee80211_probe_response + +struct ieee80211_assoc_request_frame { + struct ieee80211_hdr_3addr header; + __le16 capability; + __le16 listen_interval; + /* SSID, supported rates, RSN */ + struct ieee80211_info_element info_element[0]; +} __attribute__ ((packed)); + +struct ieee80211_reassoc_request_frame { + struct ieee80211_hdr_3addr header; + __le16 capability; + __le16 listen_interval; + u8 current_ap[ETH_ALEN]; + /* SSID, supported rates, RSN */ + struct ieee80211_info_element info_element[0]; +} __attribute__ ((packed)); + +struct ieee80211_assoc_response_frame { + struct ieee80211_hdr_3addr header; + __le16 capability; + __le16 status; + __le16 aid; + struct ieee80211_info_element info_element[0]; /* supported rates */ +} __attribute__ ((packed)); + +struct ieee80211_txb { + u8 nr_frags; + u8 encrypted; + u8 queue_index; + u8 rts_included; + u16 reserved; + __le16 frag_size; + __le16 payload_size; + struct sk_buff *fragments[0]; +}; + +#define MAX_TX_AGG_COUNT 16 +struct ieee80211_drv_agg_txb { + u8 nr_drv_agg_frames; + struct sk_buff *tx_agg_frames[MAX_TX_AGG_COUNT]; +}__attribute__((packed)); + +#define MAX_SUBFRAME_COUNT 64 +struct ieee80211_rxb { + u8 nr_subframes; + struct sk_buff *subframes[MAX_SUBFRAME_COUNT]; + u8 dst[ETH_ALEN]; + u8 src[ETH_ALEN]; +}__attribute__((packed)); + +typedef union _frameqos { + u16 shortdata; + u8 chardata[2]; + struct { + u16 tid:4; + u16 eosp:1; + u16 ack_policy:2; + u16 reserved:1; + u16 txop:8; + }field; +}frameqos,*pframeqos; + +/* SWEEP TABLE ENTRIES NUMBER*/ +#define MAX_SWEEP_TAB_ENTRIES 42 +#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 +/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs + * only use 8, and then use extended rates for the remaining supported + * rates. Other APs, however, stick all of their supported rates on the + * main rates information element... */ +#define MAX_RATES_LENGTH ((u8)12) +#define MAX_RATES_EX_LENGTH ((u8)16) +#define MAX_NETWORK_COUNT 128 + +#define MAX_CHANNEL_NUMBER 161 +#define IEEE80211_SOFTMAC_SCAN_TIME 100 +//(HZ / 2) +#define IEEE80211_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2) + +#define CRC_LENGTH 4U + +#define MAX_WPA_IE_LEN 64 + +#define NETWORK_EMPTY_ESSID (1<<0) +#define NETWORK_HAS_OFDM (1<<1) +#define NETWORK_HAS_CCK (1<<2) + +/* QoS structure */ +#define NETWORK_HAS_QOS_PARAMETERS (1<<3) +#define NETWORK_HAS_QOS_INFORMATION (1<<4) +#define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \ + NETWORK_HAS_QOS_INFORMATION) +/* 802.11h */ +#define NETWORK_HAS_POWER_CONSTRAINT (1<<5) +#define NETWORK_HAS_CSA (1<<6) +#define NETWORK_HAS_QUIET (1<<7) +#define NETWORK_HAS_IBSS_DFS (1<<8) +#define NETWORK_HAS_TPC_REPORT (1<<9) + +#define NETWORK_HAS_ERP_VALUE (1<<10) + +#define QOS_QUEUE_NUM 4 +#define QOS_OUI_LEN 3 +#define QOS_OUI_TYPE 2 +#define QOS_ELEMENT_ID 221 +#define QOS_OUI_INFO_SUB_TYPE 0 +#define QOS_OUI_PARAM_SUB_TYPE 1 +#define QOS_VERSION_1 1 +#define QOS_AIFSN_MIN_VALUE 2 +#if 1 +struct ieee80211_qos_information_element { + u8 elementID; + u8 length; + u8 qui[QOS_OUI_LEN]; + u8 qui_type; + u8 qui_subtype; + u8 version; + u8 ac_info; +} __attribute__ ((packed)); + +struct ieee80211_qos_ac_parameter { + u8 aci_aifsn; + u8 ecw_min_max; + __le16 tx_op_limit; +} __attribute__ ((packed)); + +struct ieee80211_qos_parameter_info { + struct ieee80211_qos_information_element info_element; + u8 reserved; + struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM]; +} __attribute__ ((packed)); + +struct ieee80211_qos_parameters { + __le16 cw_min[QOS_QUEUE_NUM]; + __le16 cw_max[QOS_QUEUE_NUM]; + u8 aifs[QOS_QUEUE_NUM]; + u8 flag[QOS_QUEUE_NUM]; + __le16 tx_op_limit[QOS_QUEUE_NUM]; +} __attribute__ ((packed)); + +struct ieee80211_qos_data { + struct ieee80211_qos_parameters parameters; + int active; + int supported; + u8 param_count; + u8 old_param_count; +}; + +struct ieee80211_tim_parameters { + u8 tim_count; + u8 tim_period; +} __attribute__ ((packed)); + +//#else +struct ieee80211_wmm_ac_param { + u8 ac_aci_acm_aifsn; + u8 ac_ecwmin_ecwmax; + u16 ac_txop_limit; +}; + +struct ieee80211_wmm_ts_info { + u8 ac_dir_tid; + u8 ac_up_psb; + u8 reserved; +} __attribute__ ((packed)); + +struct ieee80211_wmm_tspec_elem { + struct ieee80211_wmm_ts_info ts_info; + u16 norm_msdu_size; + u16 max_msdu_size; + u32 min_serv_inter; + u32 max_serv_inter; + u32 inact_inter; + u32 suspen_inter; + u32 serv_start_time; + u32 min_data_rate; + u32 mean_data_rate; + u32 peak_data_rate; + u32 max_burst_size; + u32 delay_bound; + u32 min_phy_rate; + u16 surp_band_allow; + u16 medium_time; +}__attribute__((packed)); +#endif +enum eap_type { + EAP_PACKET = 0, + EAPOL_START, + EAPOL_LOGOFF, + EAPOL_KEY, + EAPOL_ENCAP_ASF_ALERT +}; + +static const char *eap_types[] = { + [EAP_PACKET] = "EAP-Packet", + [EAPOL_START] = "EAPOL-Start", + [EAPOL_LOGOFF] = "EAPOL-Logoff", + [EAPOL_KEY] = "EAPOL-Key", + [EAPOL_ENCAP_ASF_ALERT] = "EAPOL-Encap-ASF-Alert" +}; + +static inline const char *eap_get_type(int type) +{ + return ((u32)type >= ARRAY_SIZE(eap_types)) ? "Unknown" : eap_types[type]; +} +//added by amy for reorder +static inline u8 Frame_QoSTID(u8* buf) +{ + struct ieee80211_hdr_3addr *hdr; + u16 fc; + hdr = (struct ieee80211_hdr_3addr *)buf; + fc = le16_to_cpu(hdr->frame_ctl); + return (u8)((frameqos*)(buf + (((fc & IEEE80211_FCTL_TODS)&&(fc & IEEE80211_FCTL_FROMDS))? 30 : 24)))->field.tid; +} + +//added by amy for reorder + +struct eapol { + u8 snap[6]; + u16 ethertype; + u8 version; + u8 type; + u16 length; +} __attribute__ ((packed)); + +struct ieee80211_softmac_stats{ + unsigned int rx_ass_ok; + unsigned int rx_ass_err; + unsigned int rx_probe_rq; + unsigned int tx_probe_rs; + unsigned int tx_beacons; + unsigned int rx_auth_rq; + unsigned int rx_auth_rs_ok; + unsigned int rx_auth_rs_err; + unsigned int tx_auth_rq; + unsigned int no_auth_rs; + unsigned int no_ass_rs; + unsigned int tx_ass_rq; + unsigned int rx_ass_rq; + unsigned int tx_probe_rq; + unsigned int reassoc; + unsigned int swtxstop; + unsigned int swtxawake; + unsigned char CurrentShowTxate; + unsigned char last_packet_rate; + unsigned int txretrycount; +}; + +#define BEACON_PROBE_SSID_ID_POSITION 12 + +struct ieee80211_info_element_hdr { + u8 id; + u8 len; +} __attribute__ ((packed)); + +/* + * These are the data types that can make up management packets + * + u16 auth_algorithm; + u16 auth_sequence; + u16 beacon_interval; + u16 capability; + u8 current_ap[ETH_ALEN]; + u16 listen_interval; + struct { + u16 association_id:14, reserved:2; + } __attribute__ ((packed)); + u32 time_stamp[2]; + u16 reason; + u16 status; +*/ + +#define IEEE80211_DEFAULT_TX_ESSID "Penguin" +#define IEEE80211_DEFAULT_BASIC_RATE 2 //1Mbps + +enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame}; +#define MAX_SP_Len (WMM_all_frame << 4) +#define IEEE80211_QOS_TID 0x0f +#define QOS_CTL_NOTCONTAIN_ACK (0x01 << 5) + +#define IEEE80211_DTIM_MBCAST 4 +#define IEEE80211_DTIM_UCAST 2 +#define IEEE80211_DTIM_VALID 1 +#define IEEE80211_DTIM_INVALID 0 + +#define IEEE80211_PS_DISABLED 0 +#define IEEE80211_PS_UNICAST IEEE80211_DTIM_UCAST +#define IEEE80211_PS_MBCAST IEEE80211_DTIM_MBCAST + +//added by David for QoS 2006/6/30 +//#define WMM_Hang_8187 +#ifdef WMM_Hang_8187 +#undef WMM_Hang_8187 +#endif + +#define WME_AC_BK 0x00 +#define WME_AC_BE 0x01 +#define WME_AC_VI 0x02 +#define WME_AC_VO 0x03 +#define WME_ACI_MASK 0x03 +#define WME_AIFSN_MASK 0x03 +#define WME_AC_PRAM_LEN 16 + +#define MAX_RECEIVE_BUFFER_SIZE 9100 + +//UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP +//#define UP2AC(up) ((up<3) ? ((up==0)?1:0) : (up>>1)) +#if 1 +#define UP2AC(up) ( \ + ((up) < 1) ? WME_AC_BE : \ + ((up) < 3) ? WME_AC_BK : \ + ((up) < 4) ? WME_AC_BE : \ + ((up) < 6) ? WME_AC_VI : \ + WME_AC_VO) +#endif +//AC Mapping to UP, using in Tx part for selecting the corresponding TX queue +#define AC2UP(_ac) ( \ + ((_ac) == WME_AC_VO) ? 6 : \ + ((_ac) == WME_AC_VI) ? 5 : \ + ((_ac) == WME_AC_BK) ? 1 : \ + 0) + +#define ETHER_ADDR_LEN 6 /* length of an Ethernet address */ +#define ETHERNET_HEADER_SIZE 14 /* length of two Ethernet address plus ether type*/ + +struct ether_header { + u8 ether_dhost[ETHER_ADDR_LEN]; + u8 ether_shost[ETHER_ADDR_LEN]; + u16 ether_type; +} __attribute__((packed)); + +#ifndef ETHERTYPE_PAE +#define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */ +#endif +#ifndef ETHERTYPE_IP +#define ETHERTYPE_IP 0x0800 /* IP protocol */ +#endif + +typedef struct _bss_ht{ + + bool support_ht; + + // HT related elements + u8 ht_cap_buf[32]; + u16 ht_cap_len; + u8 ht_info_buf[32]; + u16 ht_info_len; + + HT_SPEC_VER ht_spec_ver; + //HT_CAPABILITY_ELE bdHTCapEle; + //HT_INFORMATION_ELE bdHTInfoEle; + + bool aggregation; + bool long_slot_time; +}bss_ht, *pbss_ht; + +typedef enum _erp_t{ + ERP_NonERPpresent = 0x01, + ERP_UseProtection = 0x02, + ERP_BarkerPreambleMode = 0x04, +} erp_t; + + +struct ieee80211_network { + /* These entries are used to identify a unique network */ + u8 bssid[ETH_ALEN]; + u8 channel; + /* Ensure null-terminated for any debug msgs */ + u8 ssid[IW_ESSID_MAX_SIZE + 1]; + u8 ssid_len; +#if 1 + struct ieee80211_qos_data qos_data; +#else + // Qos related. Added by Annie, 2005-11-01. + BSS_QOS BssQos; +#endif + + //added by amy for LEAP + bool bWithAironetIE; + bool bCkipSupported; + bool bCcxRmEnable; + u16 CcxRmState[2]; + // CCXv4 S59, MBSSID. + bool bMBssidValid; + u8 MBssidMask; + u8 MBssid[6]; + // CCX 2 S38, WLAN Device Version Number element. Annie, 2006-08-20. + bool bWithCcxVerNum; + u8 BssCcxVerNumber; + /* These are network statistics */ + struct ieee80211_rx_stats stats; + u16 capability; + u8 rates[MAX_RATES_LENGTH]; + u8 rates_len; + u8 rates_ex[MAX_RATES_EX_LENGTH]; + u8 rates_ex_len; + unsigned long last_scanned; + u8 mode; + u32 flags; + u32 last_associate; + u32 time_stamp[2]; + u16 beacon_interval; + u16 listen_interval; + u16 atim_window; + u8 erp_value; + u8 wpa_ie[MAX_WPA_IE_LEN]; + size_t wpa_ie_len; + u8 rsn_ie[MAX_WPA_IE_LEN]; + size_t rsn_ie_len; + + struct ieee80211_tim_parameters tim; + u8 dtim_period; + u8 dtim_data; + u32 last_dtim_sta_time[2]; + + //appeded for QoS + u8 wmm_info; + struct ieee80211_wmm_ac_param wmm_param[4]; + u8 QoS_Enable; +#ifdef THOMAS_TURBO + u8 Turbo_Enable;//enable turbo mode, added by thomas +#endif +#ifdef ENABLE_DOT11D + u16 CountryIeLen; + u8 CountryIeBuf[MAX_IE_LEN]; +#endif + // HT Related, by amy, 2008.04.29 + BSS_HT bssht; + // Add to handle broadcom AP management frame CCK rate. + bool broadcom_cap_exist; + bool ralink_cap_exist; + bool atheros_cap_exist; + bool cisco_cap_exist; + bool unknown_cap_exist; +// u8 berp_info; + bool berp_info_valid; + bool buseprotection; + //put at the end of the structure. + struct list_head list; +}; + +#if 1 +enum ieee80211_state { + + /* the card is not linked at all */ + IEEE80211_NOLINK = 0, + + /* IEEE80211_ASSOCIATING* are for BSS client mode + * the driver shall not perform RX filtering unless + * the state is LINKED. + * The driver shall just check for the state LINKED and + * defaults to NOLINK for ALL the other states (including + * LINKED_SCANNING) + */ + + /* the association procedure will start (wq scheduling)*/ + IEEE80211_ASSOCIATING, + IEEE80211_ASSOCIATING_RETRY, + + /* the association procedure is sending AUTH request*/ + IEEE80211_ASSOCIATING_AUTHENTICATING, + + /* the association procedure has successfully authentcated + * and is sending association request + */ + IEEE80211_ASSOCIATING_AUTHENTICATED, + + /* the link is ok. the card associated to a BSS or linked + * to a ibss cell or acting as an AP and creating the bss + */ + IEEE80211_LINKED, + + /* same as LINKED, but the driver shall apply RX filter + * rules as we are in NO_LINK mode. As the card is still + * logically linked, but it is doing a syncro site survey + * then it will be back to LINKED state. + */ + IEEE80211_LINKED_SCANNING, + +}; +#else +enum ieee80211_state { + IEEE80211_UNINITIALIZED = 0, + IEEE80211_INITIALIZED, + IEEE80211_ASSOCIATING, + IEEE80211_ASSOCIATED, + IEEE80211_AUTHENTICATING, + IEEE80211_AUTHENTICATED, + IEEE80211_SHUTDOWN +}; +#endif + +#define DEFAULT_MAX_SCAN_AGE (15 * HZ) +#define DEFAULT_FTS 2346 + +#define CFG_IEEE80211_RESERVE_FCS (1<<0) +#define CFG_IEEE80211_COMPUTE_FCS (1<<1) +#define CFG_IEEE80211_RTS (1<<2) + +#define IEEE80211_24GHZ_MIN_CHANNEL 1 +#define IEEE80211_24GHZ_MAX_CHANNEL 14 +#define IEEE80211_24GHZ_CHANNELS (IEEE80211_24GHZ_MAX_CHANNEL - \ + IEEE80211_24GHZ_MIN_CHANNEL + 1) + +#define IEEE80211_52GHZ_MIN_CHANNEL 34 +#define IEEE80211_52GHZ_MAX_CHANNEL 165 +#define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \ + IEEE80211_52GHZ_MIN_CHANNEL + 1) + +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11)) +extern inline int is_multicast_ether_addr(const u8 *addr) +{ + return ((addr[0] != 0xff) && (0x01 & addr[0])); +} +#endif + +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13)) +extern inline int is_broadcast_ether_addr(const u8 *addr) +{ + return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \ + (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); +} +#endif + +typedef struct tx_pending_t{ + int frag; + struct ieee80211_txb *txb; +}tx_pending_t; + +typedef struct _bandwidth_autoswitch +{ + long threshold_20Mhzto40Mhz; + long threshold_40Mhzto20Mhz; + bool bforced_tx20Mhz; + bool bautoswitch_enable; +}bandwidth_autoswitch,*pbandwidth_autoswitch; + + +//added by amy for order + +#define REORDER_WIN_SIZE 128 +#define REORDER_ENTRY_NUM 128 +typedef struct _RX_REORDER_ENTRY +{ + struct list_head List; + u16 SeqNum; + struct ieee80211_rxb* prxb; +} RX_REORDER_ENTRY, *PRX_REORDER_ENTRY; +//added by amy for order +typedef enum _Fsync_State{ + Default_Fsync, + HW_Fsync, + SW_Fsync +}Fsync_State; + +// Power save mode configured. +typedef enum _RT_PS_MODE +{ + eActive, // Active/Continuous access. + eMaxPs, // Max power save mode. + eFastPs // Fast power save mode. +}RT_PS_MODE; + +typedef enum _IPS_CALLBACK_FUNCION +{ + IPS_CALLBACK_NONE = 0, + IPS_CALLBACK_MGNT_LINK_REQUEST = 1, + IPS_CALLBACK_JOIN_REQUEST = 2, +}IPS_CALLBACK_FUNCION; + +typedef enum _RT_JOIN_ACTION{ + RT_JOIN_INFRA = 1, + RT_JOIN_IBSS = 2, + RT_START_IBSS = 3, + RT_NO_ACTION = 4, +}RT_JOIN_ACTION; + +typedef struct _IbssParms{ + u16 atimWin; +}IbssParms, *PIbssParms; +#define MAX_NUM_RATES 264 // Max num of support rates element: 8, Max num of ext. support rate: 255. 061122, by rcnjko. + +// RF state. +typedef enum _RT_RF_POWER_STATE +{ + eRfOn, + eRfSleep, + eRfOff +}RT_RF_POWER_STATE; + +typedef struct _RT_POWER_SAVE_CONTROL +{ + + // + // Inactive Power Save(IPS) : Disable RF when disconnected + // + bool bInactivePs; + bool bIPSModeBackup; + bool bSwRfProcessing; + RT_RF_POWER_STATE eInactivePowerState; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + struct work_struct InactivePsWorkItem; +#else + struct tq_struct InactivePsWorkItem; +#endif + struct timer_list InactivePsTimer; + + // Return point for join action + IPS_CALLBACK_FUNCION ReturnPoint; + + // Recored Parameters for rescheduled JoinRequest + bool bTmpBssDesc; + RT_JOIN_ACTION tmpJoinAction; + struct ieee80211_network tmpBssDesc; + + // Recored Parameters for rescheduled MgntLinkRequest + bool bTmpScanOnly; + bool bTmpActiveScan; + bool bTmpFilterHiddenAP; + bool bTmpUpdateParms; + u8 tmpSsidBuf[33]; + OCTET_STRING tmpSsid2Scan; + bool bTmpSsid2Scan; + u8 tmpNetworkType; + u8 tmpChannelNumber; + u16 tmpBcnPeriod; + u8 tmpDtimPeriod; + u16 tmpmCap; + OCTET_STRING tmpSuppRateSet; + u8 tmpSuppRateBuf[MAX_NUM_RATES]; + bool bTmpSuppRate; + IbssParms tmpIbpm; + bool bTmpIbpm; + + // + // Leisre Poswer Save : Disable RF if connected but traffic is not busy + // + bool bLeisurePs; + +}RT_POWER_SAVE_CONTROL,*PRT_POWER_SAVE_CONTROL; + +typedef u32 RT_RF_CHANGE_SOURCE; +#define RF_CHANGE_BY_SW BIT31 +#define RF_CHANGE_BY_HW BIT30 +#define RF_CHANGE_BY_PS BIT29 +#define RF_CHANGE_BY_IPS BIT28 +#define RF_CHANGE_BY_INIT 0 // Do not change the RFOff reason. Defined by Bruce, 2008-01-17. + +#ifdef ENABLE_DOT11D +typedef enum +{ + COUNTRY_CODE_FCC = 0, + COUNTRY_CODE_IC = 1, + COUNTRY_CODE_ETSI = 2, + COUNTRY_CODE_SPAIN = 3, + COUNTRY_CODE_FRANCE = 4, + COUNTRY_CODE_MKK = 5, + COUNTRY_CODE_MKK1 = 6, + COUNTRY_CODE_ISRAEL = 7, + COUNTRY_CODE_TELEC, + COUNTRY_CODE_MIC, + COUNTRY_CODE_GLOBAL_DOMAIN +}country_code_type_t; +#endif + +#define RT_MAX_LD_SLOT_NUM 10 +typedef struct _RT_LINK_DETECT_T{ + + u32 NumRecvBcnInPeriod; + u32 NumRecvDataInPeriod; + + u32 RxBcnNum[RT_MAX_LD_SLOT_NUM]; // number of Rx beacon / CheckForHang_period to determine link status + u32 RxDataNum[RT_MAX_LD_SLOT_NUM]; // number of Rx data / CheckForHang_period to determine link status + u16 SlotNum; // number of CheckForHang period to determine link status + u16 SlotIndex; + + u32 NumTxOkInPeriod; + u32 NumRxOkInPeriod; + bool bBusyTraffic; +}RT_LINK_DETECT_T, *PRT_LINK_DETECT_T; + + +struct ieee80211_device { + struct net_device *dev; + struct ieee80211_security sec; + + //hw security related +// u8 hwsec_support; //support? + u8 hwsec_active; //hw security active. + bool is_silent_reset; + bool ieee_up; + //added by amy + bool bSupportRemoteWakeUp; + RT_PS_MODE dot11PowerSaveMode; // Power save mode configured. + bool actscanning; + bool beinretry; + RT_RF_POWER_STATE eRFPowerState; + RT_RF_CHANGE_SOURCE RfOffReason; + bool is_set_key; + //11n spec related I wonder if These info structure need to be moved out of ieee80211_device + + //11n HT below + PRT_HIGH_THROUGHPUT pHTInfo; + //struct timer_list SwBwTimer; +// spinlock_t chnlop_spinlock; + spinlock_t bw_spinlock; + + spinlock_t reorder_spinlock; + // for HT operation rate set. we use this one for HT data rate to seperate different descriptors + //the way fill this is the same as in the IE + u8 Regdot11HTOperationalRateSet[16]; //use RATR format + u8 dot11HTOperationalRateSet[16]; //use RATR format + u8 RegHTSuppRateSet[16]; + u8 HTCurrentOperaRate; + u8 HTHighestOperaRate; + //wb added for rate operation mode to firmware + u8 bTxDisableRateFallBack; + u8 bTxUseDriverAssingedRate; + atomic_t atm_chnlop; + atomic_t atm_swbw; +// u8 HTHighestOperaRate; +// u8 HTCurrentOperaRate; + + // 802.11e and WMM Traffic Stream Info (TX) + struct list_head Tx_TS_Admit_List; + struct list_head Tx_TS_Pending_List; + struct list_head Tx_TS_Unused_List; + TX_TS_RECORD TxTsRecord[TOTAL_TS_NUM]; + // 802.11e and WMM Traffic Stream Info (RX) + struct list_head Rx_TS_Admit_List; + struct list_head Rx_TS_Pending_List; + struct list_head Rx_TS_Unused_List; + RX_TS_RECORD RxTsRecord[TOTAL_TS_NUM]; +//#ifdef TO_DO_LIST + RX_REORDER_ENTRY RxReorderEntry[128]; + struct list_head RxReorder_Unused_List; +//#endif + // Qos related. Added by Annie, 2005-11-01. +// PSTA_QOS pStaQos; + u8 ForcedPriority; // Force per-packet priority 1~7. (default: 0, not to force it.) + + + /* Bookkeeping structures */ + struct net_device_stats stats; + struct ieee80211_stats ieee_stats; + struct ieee80211_softmac_stats softmac_stats; + + /* Probe / Beacon management */ + struct list_head network_free_list; + struct list_head network_list; + struct ieee80211_network *networks; + int scans; + int scan_age; + + int iw_mode; /* operating mode (IW_MODE_*) */ + struct iw_spy_data spy_data; + + spinlock_t lock; + spinlock_t wpax_suitlist_lock; + + int tx_headroom; /* Set to size of any additional room needed at front + * of allocated Tx SKBs */ + u32 config; + + /* WEP and other encryption related settings at the device level */ + int open_wep; /* Set to 1 to allow unencrypted frames */ + int auth_mode; + int reset_on_keychange; /* Set to 1 if the HW needs to be reset on + * WEP key changes */ + + /* If the host performs {en,de}cryption, then set to 1 */ + int host_encrypt; + int host_encrypt_msdu; + int host_decrypt; + /* host performs multicast decryption */ + int host_mc_decrypt; + + /* host should strip IV and ICV from protected frames */ + /* meaningful only when hardware decryption is being used */ + int host_strip_iv_icv; + + int host_open_frag; + int host_build_iv; + int ieee802_1x; /* is IEEE 802.1X used */ + + /* WPA data */ + bool bHalfWirelessN24GMode; + int wpa_enabled; + int drop_unencrypted; + int tkip_countermeasures; + int privacy_invoked; + size_t wpa_ie_len; + u8 *wpa_ie; + u8 ap_mac_addr[6]; + u16 pairwise_key_type; + u16 group_key_type; + struct list_head crypt_deinit_list; + struct ieee80211_crypt_data *crypt[WEP_KEYS]; + int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */ + struct timer_list crypt_deinit_timer; + int crypt_quiesced; + + int bcrx_sta_key; /* use individual keys to override default keys even + * with RX of broad/multicast frames */ + + /* Fragmentation structures */ + // each streaming contain a entry + struct ieee80211_frag_entry frag_cache[17][IEEE80211_FRAG_CACHE_LEN]; + unsigned int frag_next_idx[17]; + u16 fts; /* Fragmentation Threshold */ +#define DEFAULT_RTS_THRESHOLD 2346U +#define MIN_RTS_THRESHOLD 1 +#define MAX_RTS_THRESHOLD 2346U + u16 rts; /* RTS threshold */ + + /* Association info */ + u8 bssid[ETH_ALEN]; + + /* This stores infos for the current network. + * Either the network we are associated in INFRASTRUCTURE + * or the network that we are creating in MASTER mode. + * ad-hoc is a mixture ;-). + * Note that in infrastructure mode, even when not associated, + * fields bssid and essid may be valid (if wpa_set and essid_set + * are true) as thy carry the value set by the user via iwconfig + */ + struct ieee80211_network current_network; + + enum ieee80211_state state; + + int short_slot; + int reg_mode; + int mode; /* A, B, G */ + int modulation; /* CCK, OFDM */ + int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */ + int abg_true; /* ABG flag */ + + /* used for forcing the ibss workqueue to terminate + * without wait for the syncro scan to terminate + */ + short sync_scan_hurryup; + + int perfect_rssi; + int worst_rssi; + + u16 prev_seq_ctl; /* used to drop duplicate frames */ + + /* map of allowed channels. 0 is dummy */ + // FIXME: remeber to default to a basic channel plan depending of the PHY type +#ifdef ENABLE_DOT11D + void* pDot11dInfo; + bool bGlobalDomain; +#else + int channel_map[MAX_CHANNEL_NUMBER+1]; +#endif + int rate; /* current rate */ + int basic_rate; + //FIXME: pleace callback, see if redundant with softmac_features + short active_scan; + + /* this contains flags for selectively enable softmac support */ + u16 softmac_features; + + /* if the sequence control field is not filled by HW */ + u16 seq_ctrl[5]; + + /* association procedure transaction sequence number */ + u16 associate_seq; + + /* AID for RTXed association responses */ + u16 assoc_id; + + /* power save mode related*/ + short ps; + short sta_sleep; + int ps_timeout; + int ps_period; + struct tasklet_struct ps_task; + u32 ps_th; + u32 ps_tl; + + short raw_tx; + /* used if IEEE_SOFTMAC_TX_QUEUE is set */ + short queue_stop; + short scanning; + short proto_started; + + struct semaphore wx_sem; + struct semaphore scan_sem; + + spinlock_t mgmt_tx_lock; + spinlock_t beacon_lock; + + short beacon_txing; + + short wap_set; + short ssid_set; + + u8 wpax_type_set; //{added by David, 2006.9.28} + u32 wpax_type_notify; //{added by David, 2006.9.26} + + /* QoS related flag */ + char init_wmmparam_flag; + /* set on initialization */ + u8 qos_support; + + /* for discarding duplicated packets in IBSS */ + struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE]; + + /* for discarding duplicated packets in BSS */ + u16 last_rxseq_num[17]; /* rx seq previous per-tid */ + u16 last_rxfrag_num[17];/* tx frag previous per-tid */ + unsigned long last_packet_time[17]; + + /* for PS mode */ + unsigned long last_rx_ps_time; + + /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */ + struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM]; + int mgmt_queue_head; + int mgmt_queue_tail; +//{ added for rtl819x +#define IEEE80211_QUEUE_LIMIT 128 + u8 AsocRetryCount; + unsigned int hw_header; + struct sk_buff_head skb_waitQ[MAX_QUEUE_SIZE]; + struct sk_buff_head skb_aggQ[MAX_QUEUE_SIZE]; + struct sk_buff_head skb_drv_aggQ[MAX_QUEUE_SIZE]; + u32 sta_edca_param[4]; + bool aggregation; + // Enable/Disable Rx immediate BA capability. + bool enable_rx_imm_BA; + bool bibsscoordinator; + + //+by amy for DM ,080515 + //Dynamic Tx power for near/far range enable/Disable , by amy , 2008-05-15 + bool bdynamic_txpower_enable; + + bool bCTSToSelfEnable; + u8 CTSToSelfTH; + + u32 fsync_time_interval; + u32 fsync_rate_bitmap; + u8 fsync_rssi_threshold; + bool bfsync_enable; + + u8 fsync_multiple_timeinterval; // FsyncMultipleTimeInterval * FsyncTimeInterval + u32 fsync_firstdiff_ratethreshold; // low threshold + u32 fsync_seconddiff_ratethreshold; // decrease threshold + Fsync_State fsync_state; + bool bis_any_nonbepkts; + //20Mhz 40Mhz AutoSwitch Threshold + bandwidth_autoswitch bandwidth_auto_switch; + //for txpower tracking + bool FwRWRF; + + //added by amy for AP roaming + RT_LINK_DETECT_T LinkDetectInfo; + //added by amy for ps + RT_POWER_SAVE_CONTROL PowerSaveControl; +//} + /* used if IEEE_SOFTMAC_TX_QUEUE is set */ + struct tx_pending_t tx_pending; + + /* used if IEEE_SOFTMAC_ASSOCIATE is set */ + struct timer_list associate_timer; + + /* used if IEEE_SOFTMAC_BEACONS is set */ + struct timer_list beacon_timer; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + struct work_struct associate_complete_wq; + struct work_struct associate_procedure_wq; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) + struct delayed_work softmac_scan_wq; + struct delayed_work associate_retry_wq; + struct delayed_work start_ibss_wq; +#else + struct work_struct softmac_scan_wq; + struct work_struct associate_retry_wq; + struct work_struct start_ibss_wq; +#endif + struct work_struct wx_sync_scan_wq; + struct workqueue_struct *wq; +#else + /* used for periodly scan */ + struct timer_list scan_timer; + + struct tq_struct associate_complete_wq; + struct tq_struct associate_retry_wq; + struct tq_struct start_ibss_wq; + struct tq_struct associate_procedure_wq; + struct tq_struct softmac_scan_wq; + struct tq_struct wx_sync_scan_wq; + +#endif + // Qos related. Added by Annie, 2005-11-01. + //STA_QOS StaQos; + + //u32 STA_EDCA_PARAM[4]; + //CHANNEL_ACCESS_SETTING ChannelAccessSetting; + + + /* Callback functions */ + void (*set_security)(struct net_device *dev, + struct ieee80211_security *sec); + + /* Used to TX data frame by using txb structs. + * this is not used if in the softmac_features + * is set the flag IEEE_SOFTMAC_TX_QUEUE + */ + int (*hard_start_xmit)(struct ieee80211_txb *txb, + struct net_device *dev); + + int (*reset_port)(struct net_device *dev); + int (*is_queue_full) (struct net_device * dev, int pri); + + int (*handle_management) (struct net_device * dev, + struct ieee80211_network * network, u16 type); + int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb); + + /* Softmac-generated frames (mamagement) are TXed via this + * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is + * not set. As some cards may have different HW queues that + * one might want to use for data and management frames + * the option to have two callbacks might be useful. + * This fucntion can't sleep. + */ + int (*softmac_hard_start_xmit)(struct sk_buff *skb, + struct net_device *dev); + + /* used instead of hard_start_xmit (not softmac_hard_start_xmit) + * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data + * frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set + * then also management frames are sent via this callback. + * This function can't sleep. + */ + void (*softmac_data_hard_start_xmit)(struct sk_buff *skb, + struct net_device *dev,int rate); + + /* stops the HW queue for DATA frames. Useful to avoid + * waste time to TX data frame when we are reassociating + * This function can sleep. + */ + void (*data_hard_stop)(struct net_device *dev); + + /* OK this is complementar to data_poll_hard_stop */ + void (*data_hard_resume)(struct net_device *dev); + + /* ask to the driver to retune the radio . + * This function can sleep. the driver should ensure + * the radio has been swithced before return. + */ + void (*set_chan)(struct net_device *dev,short ch); + + /* These are not used if the ieee stack takes care of + * scanning (IEEE_SOFTMAC_SCAN feature set). + * In this case only the set_chan is used. + * + * The syncro version is similar to the start_scan but + * does not return until all channels has been scanned. + * this is called in user context and should sleep, + * it is called in a work_queue when swithcing to ad-hoc mode + * or in behalf of iwlist scan when the card is associated + * and root user ask for a scan. + * the fucntion stop_scan should stop both the syncro and + * background scanning and can sleep. + * The fucntion start_scan should initiate the background + * scanning and can't sleep. + */ + void (*scan_syncro)(struct net_device *dev); + void (*start_scan)(struct net_device *dev); + void (*stop_scan)(struct net_device *dev); + + /* indicate the driver that the link state is changed + * for example it may indicate the card is associated now. + * Driver might be interested in this to apply RX filter + * rules or simply light the LINK led + */ + void (*link_change)(struct net_device *dev); + + /* these two function indicates to the HW when to start + * and stop to send beacons. This is used when the + * IEEE_SOFTMAC_BEACONS is not set. For now the + * stop_send_bacons is NOT guaranteed to be called only + * after start_send_beacons. + */ + void (*start_send_beacons) (struct net_device *dev,u16 tx_rate); + void (*stop_send_beacons) (struct net_device *dev); + + /* power save mode related */ + void (*sta_wake_up) (struct net_device *dev); + void (*ps_request_tx_ack) (struct net_device *dev); + void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl); + short (*ps_is_queue_empty) (struct net_device *dev); +#if 0 + /* Typical STA methods */ + int (*handle_auth) (struct net_device * dev, + struct ieee80211_auth * auth); + int (*handle_deauth) (struct net_device * dev, + struct ieee80211_deauth * auth); + int (*handle_action) (struct net_device * dev, + struct ieee80211_action * action, + struct ieee80211_rx_stats * stats); + int (*handle_disassoc) (struct net_device * dev, + struct ieee80211_disassoc * assoc); +#endif + int (*handle_beacon) (struct net_device * dev, struct ieee80211_beacon * beacon, struct ieee80211_network * network); +#if 0 + int (*handle_probe_response) (struct net_device * dev, + struct ieee80211_probe_response * resp, + struct ieee80211_network * network); + int (*handle_probe_request) (struct net_device * dev, + struct ieee80211_probe_request * req, + struct ieee80211_rx_stats * stats); +#endif + int (*handle_assoc_response) (struct net_device * dev, struct ieee80211_assoc_response_frame * resp, struct ieee80211_network * network); + +#if 0 + /* Typical AP methods */ + int (*handle_assoc_request) (struct net_device * dev); + int (*handle_reassoc_request) (struct net_device * dev, + struct ieee80211_reassoc_request * req); +#endif + + /* check whether Tx hw resouce available */ + short (*check_nic_enough_desc)(struct net_device *dev, int queue_index); + //added by wb for HT related +// void (*SwChnlByTimerHandler)(struct net_device *dev, int channel); + void (*SetBWModeHandler)(struct net_device *dev, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset); +// void (*UpdateHalRATRTableHandler)(struct net_device* dev, u8* pMcsRate); + bool (*GetNmodeSupportBySecCfg)(struct net_device* dev); + void (*SetWirelessMode)(struct net_device* dev, u8 wireless_mode); + bool (*GetHalfNmodeSupportByAPsHandler)(struct net_device* dev); + void (*InitialGainHandler)(struct net_device *dev, u8 Operation); + + /* This must be the last item so that it points to the data + * allocated beyond this structure by alloc_ieee80211 */ + u8 priv[0]; +}; + +#define IEEE_A (1<<0) +#define IEEE_B (1<<1) +#define IEEE_G (1<<2) +#define IEEE_N_24G (1<<4) +#define IEEE_N_5G (1<<5) +#define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) + +/* Generate a 802.11 header */ + +/* Uses the channel change callback directly + * instead of [start/stop] scan callbacks + */ +#define IEEE_SOFTMAC_SCAN (1<<2) + +/* Perform authentication and association handshake */ +#define IEEE_SOFTMAC_ASSOCIATE (1<<3) + +/* Generate probe requests */ +#define IEEE_SOFTMAC_PROBERQ (1<<4) + +/* Generate respones to probe requests */ +#define IEEE_SOFTMAC_PROBERS (1<<5) + +/* The ieee802.11 stack will manages the netif queue + * wake/stop for the driver, taking care of 802.11 + * fragmentation. See softmac.c for details. */ +#define IEEE_SOFTMAC_TX_QUEUE (1<<7) + +/* Uses only the softmac_data_hard_start_xmit + * even for TX management frames. + */ +#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8) + +/* Generate beacons. The stack will enqueue beacons + * to the card + */ +#define IEEE_SOFTMAC_BEACONS (1<<6) + +static inline void *ieee80211_priv(struct net_device *dev) +{ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + return ((struct ieee80211_device *)netdev_priv(dev))->priv; +#else + return ((struct ieee80211_device *)dev->priv)->priv; +#endif +} + +extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) +{ + /* Single white space is for Linksys APs */ + if (essid_len == 1 && essid[0] == ' ') + return 1; + + /* Otherwise, if the entire essid is 0, we assume it is hidden */ + while (essid_len) { + essid_len--; + if (essid[essid_len] != '\0') + return 0; + } + + return 1; +} + +extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) +{ + /* + * It is possible for both access points and our device to support + * combinations of modes, so as long as there is one valid combination + * of ap/device supported modes, then return success + * + */ + if ((mode & IEEE_A) && + (ieee->modulation & IEEE80211_OFDM_MODULATION) && + (ieee->freq_band & IEEE80211_52GHZ_BAND)) + return 1; + + if ((mode & IEEE_G) && + (ieee->modulation & IEEE80211_OFDM_MODULATION) && + (ieee->freq_band & IEEE80211_24GHZ_BAND)) + return 1; + + if ((mode & IEEE_B) && + (ieee->modulation & IEEE80211_CCK_MODULATION) && + (ieee->freq_band & IEEE80211_24GHZ_BAND)) + return 1; + + return 0; +} + +extern inline int ieee80211_get_hdrlen(u16 fc) +{ + int hdrlen = IEEE80211_3ADDR_LEN; + + switch (WLAN_FC_GET_TYPE(fc)) { + case IEEE80211_FTYPE_DATA: + if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) + hdrlen = IEEE80211_4ADDR_LEN; /* Addr4 */ + if(IEEE80211_QOS_HAS_SEQ(fc)) + hdrlen += 2; /* QOS ctrl*/ + break; + case IEEE80211_FTYPE_CTL: + switch (WLAN_FC_GET_STYPE(fc)) { + case IEEE80211_STYPE_CTS: + case IEEE80211_STYPE_ACK: + hdrlen = IEEE80211_1ADDR_LEN; + break; + default: + hdrlen = IEEE80211_2ADDR_LEN; + break; + } + break; + } + + return hdrlen; +} + +static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr) +{ + switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) { + case IEEE80211_1ADDR_LEN: + return ((struct ieee80211_hdr_1addr *)hdr)->payload; + case IEEE80211_2ADDR_LEN: + return ((struct ieee80211_hdr_2addr *)hdr)->payload; + case IEEE80211_3ADDR_LEN: + return ((struct ieee80211_hdr_3addr *)hdr)->payload; + case IEEE80211_4ADDR_LEN: + return ((struct ieee80211_hdr_4addr *)hdr)->payload; + } + return NULL; +} + +static inline int ieee80211_is_ofdm_rate(u8 rate) +{ + switch (rate & ~IEEE80211_BASIC_RATE_MASK) { + case IEEE80211_OFDM_RATE_6MB: + case IEEE80211_OFDM_RATE_9MB: + case IEEE80211_OFDM_RATE_12MB: + case IEEE80211_OFDM_RATE_18MB: + case IEEE80211_OFDM_RATE_24MB: + case IEEE80211_OFDM_RATE_36MB: + case IEEE80211_OFDM_RATE_48MB: + case IEEE80211_OFDM_RATE_54MB: + return 1; + } + return 0; +} + +static inline int ieee80211_is_cck_rate(u8 rate) +{ + switch (rate & ~IEEE80211_BASIC_RATE_MASK) { + case IEEE80211_CCK_RATE_1MB: + case IEEE80211_CCK_RATE_2MB: + case IEEE80211_CCK_RATE_5MB: + case IEEE80211_CCK_RATE_11MB: + return 1; + } + return 0; +} + + +/* ieee80211.c */ +extern void free_ieee80211(struct net_device *dev); +extern struct net_device *alloc_ieee80211(int sizeof_priv); + +extern int ieee80211_set_encryption(struct ieee80211_device *ieee); + +/* ieee80211_tx.c */ + +extern int ieee80211_encrypt_fragment( + struct ieee80211_device *ieee, + struct sk_buff *frag, + int hdr_len); + +extern int ieee80211_xmit(struct sk_buff *skb, + struct net_device *dev); +extern void ieee80211_txb_free(struct ieee80211_txb *); + + +/* ieee80211_rx.c */ +extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, + struct ieee80211_rx_stats *rx_stats); +extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, + struct ieee80211_hdr_4addr *header, + struct ieee80211_rx_stats *stats); + +/* ieee80211_wx.c */ +extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *key); +extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *key); +extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *key); +#if WIRELESS_EXT >= 18 +extern int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data* wrqu, char *extra); +extern int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data* wrqu, char *extra); +extern int ieee80211_wx_set_auth(struct ieee80211_device *ieee, + struct iw_request_info *info, + struct iw_param *data, char *extra); +extern int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); +#endif +extern int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len); + +/* ieee80211_softmac.c */ +extern short ieee80211_is_54g(struct ieee80211_network net); +extern short ieee80211_is_shortslot(struct ieee80211_network net); +extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, + struct ieee80211_rx_stats *rx_stats, u16 type, + u16 stype); +extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net); + +void SendDisassociation(struct ieee80211_device *ieee, u8* asSta, u8 asRsn); +extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee); + +extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); +extern void notify_wx_assoc_event(struct ieee80211_device *ieee); +extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee); +extern void ieee80211_start_bss(struct ieee80211_device *ieee); +extern void ieee80211_start_master_bss(struct ieee80211_device *ieee); +extern void ieee80211_start_ibss(struct ieee80211_device *ieee); +extern void ieee80211_softmac_init(struct ieee80211_device *ieee); +extern void ieee80211_softmac_free(struct ieee80211_device *ieee); +extern void ieee80211_associate_abort(struct ieee80211_device *ieee); +extern void ieee80211_disassociate(struct ieee80211_device *ieee); +extern void ieee80211_stop_scan(struct ieee80211_device *ieee); +extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee); +extern void ieee80211_check_all_nets(struct ieee80211_device *ieee); +extern void ieee80211_start_protocol(struct ieee80211_device *ieee); +extern void ieee80211_stop_protocol(struct ieee80211_device *ieee); +extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee); +extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee); +extern void ieee80211_reset_queue(struct ieee80211_device *ieee); +extern void ieee80211_wake_queue(struct ieee80211_device *ieee); +extern void ieee80211_stop_queue(struct ieee80211_device *ieee); +extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee); +extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee); +extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); +extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p); +extern void notify_wx_assoc_event(struct ieee80211_device *ieee); +extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success); + +extern void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee); + +/* ieee80211_crypt_ccmp&tkip&wep.c */ +extern void ieee80211_tkip_null(void); +extern void ieee80211_wep_null(void); +extern void ieee80211_ccmp_null(void); + +/* ieee80211_softmac_wx.c */ + +extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *ext); + +extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *awrq, + char *extra); + +extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b); + +extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); + +extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); + +extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b); + +extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b); + +extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *extra); + +extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b); + +extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b); + +extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b); + +//extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +extern void ieee80211_wx_sync_scan_wq(struct work_struct *work); +#else + extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); +#endif + + +extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); + +extern int ieee80211_wx_get_name(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); + +extern int ieee80211_wx_set_power(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); + +extern int ieee80211_wx_get_power(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); + +extern int ieee80211_wx_set_rts(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); + +extern int ieee80211_wx_get_rts(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); +//HT +#define MAX_RECEIVE_BUFFER_SIZE 9100 // +extern void HTDebugHTCapability(u8* CapIE, u8* TitleString ); +extern void HTDebugHTInfo(u8* InfoIE, u8* TitleString); + +void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset); +extern void HTUpdateDefaultSetting(struct ieee80211_device* ieee); +extern void HTConstructCapabilityElement(struct ieee80211_device* ieee, u8* posHTCap, u8* len, u8 isEncrypt); +extern void HTConstructInfoElement(struct ieee80211_device* ieee, u8* posHTInfo, u8* len, u8 isEncrypt); +extern void HTConstructRT2RTAggElement(struct ieee80211_device* ieee, u8* posRT2RTAgg, u8* len); +extern void HTOnAssocRsp(struct ieee80211_device *ieee); +extern void HTInitializeHTInfo(struct ieee80211_device* ieee); +extern void HTInitializeBssDesc(PBSS_HT pBssHT); +extern void HTResetSelfAndSavePeerSetting(struct ieee80211_device* ieee, struct ieee80211_network * pNetwork); +extern void HTUpdateSelfAndPeerSetting(struct ieee80211_device* ieee, struct ieee80211_network * pNetwork); +extern u8 HTGetHighestMCSRate(struct ieee80211_device* ieee, u8* pMCSRateSet, u8* pMCSFilter); +extern u8 MCS_FILTER_ALL[]; +extern u16 MCS_DATA_RATE[2][2][77] ; +extern u8 HTCCheck(struct ieee80211_device* ieee, u8* pFrame); +//extern void HTSetConnectBwModeCallback(unsigned long data); +extern void HTResetIOTSetting(PRT_HIGH_THROUGHPUT pHTInfo); +extern bool IsHTHalfNmodeAPs(struct ieee80211_device* ieee); +extern u16 HTHalfMcsToDataRate(struct ieee80211_device* ieee, u8 nMcsRate); +extern u16 HTMcsToDataRate( struct ieee80211_device* ieee, u8 nMcsRate); +extern u16 TxCountToDataRate( struct ieee80211_device* ieee, u8 nDataRate); +//function in BAPROC.c +extern int ieee80211_rx_ADDBAReq( struct ieee80211_device* ieee, struct sk_buff *skb); +extern int ieee80211_rx_ADDBARsp( struct ieee80211_device* ieee, struct sk_buff *skb); +extern int ieee80211_rx_DELBA(struct ieee80211_device* ieee,struct sk_buff *skb); +extern void TsInitAddBA( struct ieee80211_device* ieee, PTX_TS_RECORD pTS, u8 Policy, u8 bOverwritePending); +extern void TsInitDelBA( struct ieee80211_device* ieee, PTS_COMMON_INFO pTsCommonInfo, TR_SELECT TxRxSelect); +extern void BaSetupTimeOut(unsigned long data); +extern void TxBaInactTimeout(unsigned long data); +extern void RxBaInactTimeout(unsigned long data); +extern void ResetBaEntry( PBA_RECORD pBA); +//function in TS.c +extern bool GetTs( + struct ieee80211_device* ieee, + PTS_COMMON_INFO *ppTS, + u8* Addr, + u8 TID, + TR_SELECT TxRxSelect, //Rx:1, Tx:0 + bool bAddNewTs + ); +extern void TSInitialize(struct ieee80211_device *ieee); +extern void TsStartAddBaProcess(struct ieee80211_device* ieee, PTX_TS_RECORD pTxTS); +extern void RemovePeerTS(struct ieee80211_device* ieee, u8* Addr); +extern void RemoveAllTS(struct ieee80211_device* ieee); +void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee); + +extern const long ieee80211_wlan_frequencies[]; + +extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee) +{ + ieee->scans++; +} + +extern inline int ieee80211_get_scans(struct ieee80211_device *ieee) +{ + return ieee->scans; +} + +static inline const char *escape_essid(const char *essid, u8 essid_len) { + static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; + const char *s = essid; + char *d = escaped; + + if (ieee80211_is_empty_essid(essid, essid_len)) { + memcpy(escaped, "", sizeof("")); + return escaped; + } + + essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE); + while (essid_len--) { + if (*s == '\0') { + *d++ = '\\'; + *d++ = '0'; + s++; + } else { + *d++ = *s++; + } + } + *d = '\0'; + return escaped; +} + +/* For the function is more related to hardware setting, it's better to use the + * ieee handler to refer to it. + */ +extern short check_nic_enough_desc(struct net_device *dev, int queue_index); +extern int ieee80211_data_xmit(struct sk_buff *skb, struct net_device *dev); +extern int ieee80211_parse_info_param(struct ieee80211_device *ieee, + struct ieee80211_info_element *info_element, + u16 length, + struct ieee80211_network *network, + struct ieee80211_rx_stats *stats); + +void ieee80211_indicate_packets(struct ieee80211_device *ieee, struct ieee80211_rxb** prxbIndicateArray,u8 index); +#define RT_ASOC_RETRY_LIMIT 5 +#endif /* IEEE80211_H */ diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c new file mode 100644 index 000000000000..199ee1695ad3 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c @@ -0,0 +1,273 @@ +/* + * Host AP crypto routines + * + * Copyright (c) 2002-2003, Jouni Malinen + * Portions Copyright (C) 2004, Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. See README and COPYING for + * more details. + * + */ + +//#include +#include +#include +#include +#include +#include +#include + +#include "ieee80211.h" + +MODULE_AUTHOR("Jouni Malinen"); +MODULE_DESCRIPTION("HostAP crypto"); +MODULE_LICENSE("GPL"); + +struct ieee80211_crypto_alg { + struct list_head list; + struct ieee80211_crypto_ops *ops; +}; + + +struct ieee80211_crypto { + struct list_head algs; + spinlock_t lock; +}; + +static struct ieee80211_crypto *hcrypt; + +void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, + int force) +{ + struct list_head *ptr, *n; + struct ieee80211_crypt_data *entry; + + for (ptr = ieee->crypt_deinit_list.next, n = ptr->next; + ptr != &ieee->crypt_deinit_list; ptr = n, n = ptr->next) { + entry = list_entry(ptr, struct ieee80211_crypt_data, list); + + if (atomic_read(&entry->refcnt) != 0 && !force) + continue; + + list_del(ptr); + + if (entry->ops) { + entry->ops->deinit(entry->priv); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) + module_put(entry->ops->owner); +#else + __MOD_DEC_USE_COUNT(entry->ops->owner); +#endif + } + kfree(entry); + } +} + +void ieee80211_crypt_deinit_handler(unsigned long data) +{ + struct ieee80211_device *ieee = (struct ieee80211_device *)data; + unsigned long flags; + + spin_lock_irqsave(&ieee->lock, flags); + ieee80211_crypt_deinit_entries(ieee, 0); + if (!list_empty(&ieee->crypt_deinit_list)) { + printk(KERN_DEBUG "%s: entries remaining in delayed crypt " + "deletion list\n", ieee->dev->name); + ieee->crypt_deinit_timer.expires = jiffies + HZ; + add_timer(&ieee->crypt_deinit_timer); + } + spin_unlock_irqrestore(&ieee->lock, flags); + +} + +void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, + struct ieee80211_crypt_data **crypt) +{ + struct ieee80211_crypt_data *tmp; + unsigned long flags; + + if (*crypt == NULL) + return; + + tmp = *crypt; + *crypt = NULL; + + /* must not run ops->deinit() while there may be pending encrypt or + * decrypt operations. Use a list of delayed deinits to avoid needing + * locking. */ + + spin_lock_irqsave(&ieee->lock, flags); + list_add(&tmp->list, &ieee->crypt_deinit_list); + if (!timer_pending(&ieee->crypt_deinit_timer)) { + ieee->crypt_deinit_timer.expires = jiffies + HZ; + add_timer(&ieee->crypt_deinit_timer); + } + spin_unlock_irqrestore(&ieee->lock, flags); +} + +int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops) +{ + unsigned long flags; + struct ieee80211_crypto_alg *alg; + + if (hcrypt == NULL) + return -1; + + alg = kmalloc(sizeof(*alg), GFP_KERNEL); + if (alg == NULL) + return -ENOMEM; + + memset(alg, 0, sizeof(*alg)); + alg->ops = ops; + + spin_lock_irqsave(&hcrypt->lock, flags); + list_add(&alg->list, &hcrypt->algs); + spin_unlock_irqrestore(&hcrypt->lock, flags); + + printk(KERN_DEBUG "ieee80211_crypt: registered algorithm '%s'\n", + ops->name); + + return 0; +} + +int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) +{ + unsigned long flags; + struct list_head *ptr; + struct ieee80211_crypto_alg *del_alg = NULL; + + if (hcrypt == NULL) + return -1; + + spin_lock_irqsave(&hcrypt->lock, flags); + for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { + struct ieee80211_crypto_alg *alg = + (struct ieee80211_crypto_alg *) ptr; + if (alg->ops == ops) { + list_del(&alg->list); + del_alg = alg; + break; + } + } + spin_unlock_irqrestore(&hcrypt->lock, flags); + + if (del_alg) { + printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " + "'%s'\n", ops->name); + kfree(del_alg); + } + + return del_alg ? 0 : -1; +} + + +struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name) +{ + unsigned long flags; + struct list_head *ptr; + struct ieee80211_crypto_alg *found_alg = NULL; + + if (hcrypt == NULL) + return NULL; + + spin_lock_irqsave(&hcrypt->lock, flags); + for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { + struct ieee80211_crypto_alg *alg = + (struct ieee80211_crypto_alg *) ptr; + if (strcmp(alg->ops->name, name) == 0) { + found_alg = alg; + break; + } + } + spin_unlock_irqrestore(&hcrypt->lock, flags); + + if (found_alg) + return found_alg->ops; + else + return NULL; +} + + +static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; } +static void ieee80211_crypt_null_deinit(void *priv) {} + +static struct ieee80211_crypto_ops ieee80211_crypt_null = { + .name = "NULL", + .init = ieee80211_crypt_null_init, + .deinit = ieee80211_crypt_null_deinit, + .encrypt_mpdu = NULL, + .decrypt_mpdu = NULL, + .encrypt_msdu = NULL, + .decrypt_msdu = NULL, + .set_key = NULL, + .get_key = NULL, + .extra_prefix_len = 0, + .extra_postfix_len = 0, + .owner = THIS_MODULE, +}; + + +static int __init ieee80211_crypto_init(void) +{ + int ret = -ENOMEM; + + hcrypt = kmalloc(sizeof(*hcrypt), GFP_KERNEL); + if (!hcrypt) + goto out; + + memset(hcrypt, 0, sizeof(*hcrypt)); + INIT_LIST_HEAD(&hcrypt->algs); + spin_lock_init(&hcrypt->lock); + + ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null); + if (ret < 0) { + kfree(hcrypt); + hcrypt = NULL; + } +out: + return ret; +} + + +static void __exit ieee80211_crypto_deinit(void) +{ + struct list_head *ptr, *n; + + if (hcrypt == NULL) + return; + + for (ptr = hcrypt->algs.next, n = ptr->next; ptr != &hcrypt->algs; + ptr = n, n = ptr->next) { + struct ieee80211_crypto_alg *alg = + (struct ieee80211_crypto_alg *) ptr; + list_del(ptr); + printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " + "'%s' (deinit)\n", alg->ops->name); + kfree(alg); + } + + kfree(hcrypt); +} + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) +EXPORT_SYMBOL(ieee80211_crypt_deinit_entries); +EXPORT_SYMBOL(ieee80211_crypt_deinit_handler); +EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit); + +EXPORT_SYMBOL(ieee80211_register_crypto_ops); +EXPORT_SYMBOL(ieee80211_unregister_crypto_ops); +EXPORT_SYMBOL(ieee80211_get_crypto_ops); +#else +EXPORT_SYMBOL_NOVERS(ieee80211_crypt_deinit_entries); +EXPORT_SYMBOL_NOVERS(ieee80211_crypt_deinit_handler); +EXPORT_SYMBOL_NOVERS(ieee80211_crypt_delayed_deinit); + +EXPORT_SYMBOL_NOVERS(ieee80211_register_crypto_ops); +EXPORT_SYMBOL_NOVERS(ieee80211_unregister_crypto_ops); +EXPORT_SYMBOL_NOVERS(ieee80211_get_crypto_ops); +#endif + +module_init(ieee80211_crypto_init); +module_exit(ieee80211_crypto_deinit); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h new file mode 100644 index 000000000000..a84df4b76489 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h @@ -0,0 +1,93 @@ +/* + * Original code based on Host AP (software wireless LAN access point) driver + * for Intersil Prism2/2.5/3. + * + * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen + * + * Copyright (c) 2002-2003, Jouni Malinen + * + * Adaption to a generic IEEE 802.11 stack by James Ketrenos + * + * + * Copyright (c) 2004, Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. See README and COPYING for + * more details. + */ + +/* + * This file defines the interface to the ieee80211 crypto module. + */ +#ifndef IEEE80211_CRYPT_H +#define IEEE80211_CRYPT_H + +#include + +struct ieee80211_crypto_ops { + const char *name; + + /* init new crypto context (e.g., allocate private data space, + * select IV, etc.); returns NULL on failure or pointer to allocated + * private data on success */ + void * (*init)(int keyidx); + + /* deinitialize crypto context and free allocated private data */ + void (*deinit)(void *priv); + + /* encrypt/decrypt return < 0 on error or >= 0 on success. The return + * value from decrypt_mpdu is passed as the keyidx value for + * decrypt_msdu. skb must have enough head and tail room for the + * encryption; if not, error will be returned; these functions are + * called for all MPDUs (i.e., fragments). + */ + int (*encrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); + int (*decrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); + + /* These functions are called for full MSDUs, i.e. full frames. + * These can be NULL if full MSDU operations are not needed. */ + int (*encrypt_msdu)(struct sk_buff *skb, int hdr_len, void *priv); + int (*decrypt_msdu)(struct sk_buff *skb, int keyidx, int hdr_len, + void *priv); + + int (*set_key)(void *key, int len, u8 *seq, void *priv); + int (*get_key)(void *key, int len, u8 *seq, void *priv); + + /* procfs handler for printing out key information and possible + * statistics */ + char * (*print_stats)(char *p, void *priv); + + /* maximum number of bytes added by encryption; encrypt buf is + * allocated with extra_prefix_len bytes, copy of in_buf, and + * extra_postfix_len; encrypt need not use all this space, but + * the result must start at the beginning of the buffer and correct + * length must be returned */ + int extra_prefix_len, extra_postfix_len; + + struct module *owner; +}; + +struct ieee80211_crypt_data { + struct list_head list; /* delayed deletion list */ + struct ieee80211_crypto_ops *ops; + void *priv; + atomic_t refcnt; +}; + +int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); +int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); +struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name); +void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); +void ieee80211_crypt_deinit_handler(unsigned long); +void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, + struct ieee80211_crypt_data **crypt); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) +#endif +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31)) +#define crypto_alloc_tfm crypto_alloc_tfm_rsl +#define crypto_free_tfm crypto_free_tfm_rsl +#endif + +#endif diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c new file mode 100644 index 000000000000..a86c26eceb34 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c @@ -0,0 +1,534 @@ +/* + * Host AP crypt: host-based CCMP encryption implementation for Host AP driver + * + * Copyright (c) 2003-2004, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. See README and COPYING for + * more details. + */ + +//#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ieee80211.h" + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +#include "rtl_crypto.h" +#else +#include +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) + #include +#else + #include +#endif +//#include + +MODULE_AUTHOR("Jouni Malinen"); +MODULE_DESCRIPTION("Host AP crypt: CCMP"); +MODULE_LICENSE("GPL"); + +#ifndef OPENSUSE_SLED +#define OPENSUSE_SLED 0 +#endif + +#define AES_BLOCK_LEN 16 +#define CCMP_HDR_LEN 8 +#define CCMP_MIC_LEN 8 +#define CCMP_TK_LEN 16 +#define CCMP_PN_LEN 6 + +struct ieee80211_ccmp_data { + u8 key[CCMP_TK_LEN]; + int key_set; + + u8 tx_pn[CCMP_PN_LEN]; + u8 rx_pn[CCMP_PN_LEN]; + + u32 dot11RSNAStatsCCMPFormatErrors; + u32 dot11RSNAStatsCCMPReplays; + u32 dot11RSNAStatsCCMPDecryptErrors; + + int key_idx; + + struct crypto_tfm *tfm; + + /* scratch buffers for virt_to_page() (crypto API) */ + u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN], + tx_e[AES_BLOCK_LEN], tx_s0[AES_BLOCK_LEN]; + u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN]; +}; + +void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm, + const u8 pt[16], u8 ct[16]) +{ +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) + struct scatterlist src, dst; + + src.page = virt_to_page(pt); + src.offset = offset_in_page(pt); + src.length = AES_BLOCK_LEN; + + dst.page = virt_to_page(ct); + dst.offset = offset_in_page(ct); + dst.length = AES_BLOCK_LEN; + + crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN); +#else + crypto_cipher_encrypt_one((void*)tfm, ct, pt); +#endif +} + +static void * ieee80211_ccmp_init(int key_idx) +{ + struct ieee80211_ccmp_data *priv; + + priv = kmalloc(sizeof(*priv), GFP_ATOMIC); + if (priv == NULL) + goto fail; + memset(priv, 0, sizeof(*priv)); + priv->key_idx = key_idx; + +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) + priv->tfm = crypto_alloc_tfm("aes", 0); + if (priv->tfm == NULL) { + printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate " + "crypto API aes\n"); + goto fail; + } + #else + priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); + if (IS_ERR(priv->tfm)) { + printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate " + "crypto API aes\n"); + priv->tfm = NULL; + goto fail; + } + #endif + return priv; + +fail: + if (priv) { + if (priv->tfm) + #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) + crypto_free_tfm(priv->tfm); + #else + crypto_free_cipher((void*)priv->tfm); + #endif + kfree(priv); + } + + return NULL; +} + + +static void ieee80211_ccmp_deinit(void *priv) +{ + struct ieee80211_ccmp_data *_priv = priv; + if (_priv && _priv->tfm) +#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) + crypto_free_tfm(_priv->tfm); +#else + crypto_free_cipher((void*)_priv->tfm); +#endif + kfree(priv); +} + + +static inline void xor_block(u8 *b, u8 *a, size_t len) +{ + int i; + for (i = 0; i < len; i++) + b[i] ^= a[i]; +} + + + +static void ccmp_init_blocks(struct crypto_tfm *tfm, + struct ieee80211_hdr_4addr *hdr, + u8 *pn, size_t dlen, u8 *b0, u8 *auth, + u8 *s0) +{ + u8 *pos, qc = 0; + size_t aad_len; + u16 fc; + int a4_included, qc_included; + u8 aad[2 * AES_BLOCK_LEN]; + + fc = le16_to_cpu(hdr->frame_ctl); + a4_included = ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == + (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)); + /* + qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && + (WLAN_FC_GET_STYPE(fc) & 0x08)); + */ + // fixed by David :2006.9.6 + qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && + (WLAN_FC_GET_STYPE(fc) & 0x80)); + aad_len = 22; + if (a4_included) + aad_len += 6; + if (qc_included) { + pos = (u8 *) &hdr->addr4; + if (a4_included) + pos += 6; + qc = *pos & 0x0f; + aad_len += 2; + } + /* CCM Initial Block: + * Flag (Include authentication header, M=3 (8-octet MIC), + * L=1 (2-octet Dlen)) + * Nonce: 0x00 | A2 | PN + * Dlen */ + b0[0] = 0x59; + b0[1] = qc; + memcpy(b0 + 2, hdr->addr2, ETH_ALEN); + memcpy(b0 + 8, pn, CCMP_PN_LEN); + b0[14] = (dlen >> 8) & 0xff; + b0[15] = dlen & 0xff; + + /* AAD: + * FC with bits 4..6 and 11..13 masked to zero; 14 is always one + * A1 | A2 | A3 + * SC with bits 4..15 (seq#) masked to zero + * A4 (if present) + * QC (if present) + */ + pos = (u8 *) hdr; + aad[0] = 0; /* aad_len >> 8 */ + aad[1] = aad_len & 0xff; + aad[2] = pos[0] & 0x8f; + aad[3] = pos[1] & 0xc7; + memcpy(aad + 4, hdr->addr1, 3 * ETH_ALEN); + pos = (u8 *) &hdr->seq_ctl; + aad[22] = pos[0] & 0x0f; + aad[23] = 0; /* all bits masked */ + memset(aad + 24, 0, 8); + if (a4_included) + memcpy(aad + 24, hdr->addr4, ETH_ALEN); + if (qc_included) { + aad[a4_included ? 30 : 24] = qc; + /* rest of QC masked */ + } + + /* Start with the first block and AAD */ + ieee80211_ccmp_aes_encrypt(tfm, b0, auth); + xor_block(auth, aad, AES_BLOCK_LEN); + ieee80211_ccmp_aes_encrypt(tfm, auth, auth); + xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN); + ieee80211_ccmp_aes_encrypt(tfm, auth, auth); + b0[0] &= 0x07; + b0[14] = b0[15] = 0; + ieee80211_ccmp_aes_encrypt(tfm, b0, s0); +} + + + +static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) +{ + struct ieee80211_ccmp_data *key = priv; + int data_len, i; + u8 *pos; + struct ieee80211_hdr_4addr *hdr; + cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + + if (skb_headroom(skb) < CCMP_HDR_LEN || + skb_tailroom(skb) < CCMP_MIC_LEN || + skb->len < hdr_len) + return -1; + + data_len = skb->len - hdr_len; + pos = skb_push(skb, CCMP_HDR_LEN); + memmove(pos, pos + CCMP_HDR_LEN, hdr_len); + pos += hdr_len; +// mic = skb_put(skb, CCMP_MIC_LEN); + + i = CCMP_PN_LEN - 1; + while (i >= 0) { + key->tx_pn[i]++; + if (key->tx_pn[i] != 0) + break; + i--; + } + + *pos++ = key->tx_pn[5]; + *pos++ = key->tx_pn[4]; + *pos++ = 0; + *pos++ = (key->key_idx << 6) | (1 << 5) /* Ext IV included */; + *pos++ = key->tx_pn[3]; + *pos++ = key->tx_pn[2]; + *pos++ = key->tx_pn[1]; + *pos++ = key->tx_pn[0]; + + + hdr = (struct ieee80211_hdr_4addr *) skb->data; + if (!tcb_desc->bHwSec) + { + int blocks, last, len; + u8 *mic; + u8 *b0 = key->tx_b0; + u8 *b = key->tx_b; + u8 *e = key->tx_e; + u8 *s0 = key->tx_s0; + + //mic is moved to here by john + mic = skb_put(skb, CCMP_MIC_LEN); + + ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); + + blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; + last = data_len % AES_BLOCK_LEN; + + for (i = 1; i <= blocks; i++) { + len = (i == blocks && last) ? last : AES_BLOCK_LEN; + /* Authentication */ + xor_block(b, pos, len); + ieee80211_ccmp_aes_encrypt(key->tfm, b, b); + /* Encryption, with counter */ + b0[14] = (i >> 8) & 0xff; + b0[15] = i & 0xff; + ieee80211_ccmp_aes_encrypt(key->tfm, b0, e); + xor_block(pos, e, len); + pos += len; + } + + for (i = 0; i < CCMP_MIC_LEN; i++) + mic[i] = b[i] ^ s0[i]; + } + return 0; +} + + +static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) +{ + struct ieee80211_ccmp_data *key = priv; + u8 keyidx, *pos; + struct ieee80211_hdr_4addr *hdr; + cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + u8 pn[6]; + + if (skb->len < hdr_len + CCMP_HDR_LEN + CCMP_MIC_LEN) { + key->dot11RSNAStatsCCMPFormatErrors++; + return -1; + } + + hdr = (struct ieee80211_hdr_4addr *) skb->data; + pos = skb->data + hdr_len; + keyidx = pos[3]; + if (!(keyidx & (1 << 5))) { + if (net_ratelimit()) { + printk(KERN_DEBUG "CCMP: received packet without ExtIV" + " flag from " MAC_FMT "\n", MAC_ARG(hdr->addr2)); + } + key->dot11RSNAStatsCCMPFormatErrors++; + return -2; + } + keyidx >>= 6; + if (key->key_idx != keyidx) { + printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame " + "keyidx=%d priv=%p\n", key->key_idx, keyidx, priv); + return -6; + } + if (!key->key_set) { + if (net_ratelimit()) { + printk(KERN_DEBUG "CCMP: received packet from " MAC_FMT + " with keyid=%d that does not have a configured" + " key\n", MAC_ARG(hdr->addr2), keyidx); + } + return -3; + } + + pn[0] = pos[7]; + pn[1] = pos[6]; + pn[2] = pos[5]; + pn[3] = pos[4]; + pn[4] = pos[1]; + pn[5] = pos[0]; + pos += 8; + + if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) { + if (net_ratelimit()) { + printk(KERN_DEBUG "CCMP: replay detected: STA=" MAC_FMT + " previous PN %02x%02x%02x%02x%02x%02x " + "received PN %02x%02x%02x%02x%02x%02x\n", + MAC_ARG(hdr->addr2), MAC_ARG(key->rx_pn), + MAC_ARG(pn)); + } + key->dot11RSNAStatsCCMPReplays++; + return -4; + } + if (!tcb_desc->bHwSec) + { + size_t data_len = skb->len - hdr_len - CCMP_HDR_LEN - CCMP_MIC_LEN; + u8 *mic = skb->data + skb->len - CCMP_MIC_LEN; + u8 *b0 = key->rx_b0; + u8 *b = key->rx_b; + u8 *a = key->rx_a; + int i, blocks, last, len; + + + ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b); + xor_block(mic, b, CCMP_MIC_LEN); + + blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; + last = data_len % AES_BLOCK_LEN; + + for (i = 1; i <= blocks; i++) { + len = (i == blocks && last) ? last : AES_BLOCK_LEN; + /* Decrypt, with counter */ + b0[14] = (i >> 8) & 0xff; + b0[15] = i & 0xff; + ieee80211_ccmp_aes_encrypt(key->tfm, b0, b); + xor_block(pos, b, len); + /* Authentication */ + xor_block(a, pos, len); + ieee80211_ccmp_aes_encrypt(key->tfm, a, a); + pos += len; + } + + if (memcmp(mic, a, CCMP_MIC_LEN) != 0) { + if (net_ratelimit()) { + printk(KERN_DEBUG "CCMP: decrypt failed: STA=" + MAC_FMT "\n", MAC_ARG(hdr->addr2)); + } + key->dot11RSNAStatsCCMPDecryptErrors++; + return -5; + } + + memcpy(key->rx_pn, pn, CCMP_PN_LEN); + } + /* Remove hdr and MIC */ + memmove(skb->data + CCMP_HDR_LEN, skb->data, hdr_len); + skb_pull(skb, CCMP_HDR_LEN); + skb_trim(skb, skb->len - CCMP_MIC_LEN); + + return keyidx; +} + + +static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv) +{ + struct ieee80211_ccmp_data *data = priv; + int keyidx; + struct crypto_tfm *tfm = data->tfm; + + keyidx = data->key_idx; + memset(data, 0, sizeof(*data)); + data->key_idx = keyidx; + data->tfm = tfm; + if (len == CCMP_TK_LEN) { + memcpy(data->key, key, CCMP_TK_LEN); + data->key_set = 1; + if (seq) { + data->rx_pn[0] = seq[5]; + data->rx_pn[1] = seq[4]; + data->rx_pn[2] = seq[3]; + data->rx_pn[3] = seq[2]; + data->rx_pn[4] = seq[1]; + data->rx_pn[5] = seq[0]; + } + crypto_cipher_setkey((void*)data->tfm, data->key, CCMP_TK_LEN); + } else if (len == 0) + data->key_set = 0; + else + return -1; + + return 0; +} + + +static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv) +{ + struct ieee80211_ccmp_data *data = priv; + + if (len < CCMP_TK_LEN) + return -1; + + if (!data->key_set) + return 0; + memcpy(key, data->key, CCMP_TK_LEN); + + if (seq) { + seq[0] = data->tx_pn[5]; + seq[1] = data->tx_pn[4]; + seq[2] = data->tx_pn[3]; + seq[3] = data->tx_pn[2]; + seq[4] = data->tx_pn[1]; + seq[5] = data->tx_pn[0]; + } + + return CCMP_TK_LEN; +} + + +static char * ieee80211_ccmp_print_stats(char *p, void *priv) +{ + struct ieee80211_ccmp_data *ccmp = priv; + p += sprintf(p, "key[%d] alg=CCMP key_set=%d " + "tx_pn=%02x%02x%02x%02x%02x%02x " + "rx_pn=%02x%02x%02x%02x%02x%02x " + "format_errors=%d replays=%d decrypt_errors=%d\n", + ccmp->key_idx, ccmp->key_set, + MAC_ARG(ccmp->tx_pn), MAC_ARG(ccmp->rx_pn), + ccmp->dot11RSNAStatsCCMPFormatErrors, + ccmp->dot11RSNAStatsCCMPReplays, + ccmp->dot11RSNAStatsCCMPDecryptErrors); + + return p; +} + +void ieee80211_ccmp_null(void) +{ +// printk("============>%s()\n", __FUNCTION__); + return; +} + +static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { + .name = "CCMP", + .init = ieee80211_ccmp_init, + .deinit = ieee80211_ccmp_deinit, + .encrypt_mpdu = ieee80211_ccmp_encrypt, + .decrypt_mpdu = ieee80211_ccmp_decrypt, + .encrypt_msdu = NULL, + .decrypt_msdu = NULL, + .set_key = ieee80211_ccmp_set_key, + .get_key = ieee80211_ccmp_get_key, + .print_stats = ieee80211_ccmp_print_stats, + .extra_prefix_len = CCMP_HDR_LEN, + .extra_postfix_len = CCMP_MIC_LEN, + .owner = THIS_MODULE, +}; + + +static int __init ieee80211_crypto_ccmp_init(void) +{ + return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp); +} + + +static void __exit ieee80211_crypto_ccmp_exit(void) +{ + ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp); +} + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) +EXPORT_SYMBOL(ieee80211_ccmp_null); +#else +EXPORT_SYMBOL_NOVERS(ieee80211_ccmp_null); +#endif + +module_init(ieee80211_crypto_ccmp_init); +module_exit(ieee80211_crypto_ccmp_exit); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c new file mode 100644 index 000000000000..b031b6495247 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c @@ -0,0 +1,1034 @@ +/* + * Host AP crypt: host-based TKIP encryption implementation for Host AP driver + * + * Copyright (c) 2003-2004, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. See README and COPYING for + * more details. + */ + +//#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ieee80211.h" +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)) +//#include "crypto_compat.h" +#endif + + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +#include "rtl_crypto.h" +#else +#include +#endif +//#include +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) + #include +#else + #include +#endif + +#include + +MODULE_AUTHOR("Jouni Malinen"); +MODULE_DESCRIPTION("Host AP crypt: TKIP"); +MODULE_LICENSE("GPL"); + +#ifndef OPENSUSE_SLED +#define OPENSUSE_SLED 0 +#endif + +struct ieee80211_tkip_data { +#define TKIP_KEY_LEN 32 + u8 key[TKIP_KEY_LEN]; + int key_set; + + u32 tx_iv32; + u16 tx_iv16; + u16 tx_ttak[5]; + int tx_phase1_done; + + u32 rx_iv32; + u16 rx_iv16; + u16 rx_ttak[5]; + int rx_phase1_done; + u32 rx_iv32_new; + u16 rx_iv16_new; + + u32 dot11RSNAStatsTKIPReplays; + u32 dot11RSNAStatsTKIPICVErrors; + u32 dot11RSNAStatsTKIPLocalMICFailures; + + int key_idx; +#if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) + struct crypto_blkcipher *rx_tfm_arc4; + struct crypto_hash *rx_tfm_michael; + struct crypto_blkcipher *tx_tfm_arc4; + struct crypto_hash *tx_tfm_michael; +#else + struct crypto_tfm *tx_tfm_arc4; + struct crypto_tfm *tx_tfm_michael; + struct crypto_tfm *rx_tfm_arc4; + struct crypto_tfm *rx_tfm_michael; +#endif + /* scratch buffers for virt_to_page() (crypto API) */ + u8 rx_hdr[16], tx_hdr[16]; +}; + +static void * ieee80211_tkip_init(int key_idx) +{ + struct ieee80211_tkip_data *priv; + + priv = kmalloc(sizeof(*priv), GFP_ATOMIC); + if (priv == NULL) + goto fail; + memset(priv, 0, sizeof(*priv)); + priv->key_idx = key_idx; +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) + priv->tx_tfm_arc4 = crypto_alloc_tfm("arc4", 0); + if (priv->tx_tfm_arc4 == NULL) { + printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " + "crypto API arc4\n"); + goto fail; + } + + priv->tx_tfm_michael = crypto_alloc_tfm("michael_mic", 0); + if (priv->tx_tfm_michael == NULL) { + printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " + "crypto API michael_mic\n"); + goto fail; + } + + priv->rx_tfm_arc4 = crypto_alloc_tfm("arc4", 0); + if (priv->rx_tfm_arc4 == NULL) { + printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " + "crypto API arc4\n"); + goto fail; + } + + priv->rx_tfm_michael = crypto_alloc_tfm("michael_mic", 0); + if (priv->rx_tfm_michael == NULL) { + printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " + "crypto API michael_mic\n"); + goto fail; + } +#else + priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, + CRYPTO_ALG_ASYNC); + if (IS_ERR(priv->tx_tfm_arc4)) { + printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " + "crypto API arc4\n"); + priv->tx_tfm_arc4 = NULL; + goto fail; + } + + priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0, + CRYPTO_ALG_ASYNC); + if (IS_ERR(priv->tx_tfm_michael)) { + printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " + "crypto API michael_mic\n"); + priv->tx_tfm_michael = NULL; + goto fail; + } + + priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, + CRYPTO_ALG_ASYNC); + if (IS_ERR(priv->rx_tfm_arc4)) { + printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " + "crypto API arc4\n"); + priv->rx_tfm_arc4 = NULL; + goto fail; + } + + priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0, + CRYPTO_ALG_ASYNC); + if (IS_ERR(priv->rx_tfm_michael)) { + printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " + "crypto API michael_mic\n"); + priv->rx_tfm_michael = NULL; + goto fail; + } +#endif + return priv; + +fail: + if (priv) { +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) + if (priv->tx_tfm_michael) + crypto_free_tfm(priv->tx_tfm_michael); + if (priv->tx_tfm_arc4) + crypto_free_tfm(priv->tx_tfm_arc4); + if (priv->rx_tfm_michael) + crypto_free_tfm(priv->rx_tfm_michael); + if (priv->rx_tfm_arc4) + crypto_free_tfm(priv->rx_tfm_arc4); + +#else + if (priv->tx_tfm_michael) + crypto_free_hash(priv->tx_tfm_michael); + if (priv->tx_tfm_arc4) + crypto_free_blkcipher(priv->tx_tfm_arc4); + if (priv->rx_tfm_michael) + crypto_free_hash(priv->rx_tfm_michael); + if (priv->rx_tfm_arc4) + crypto_free_blkcipher(priv->rx_tfm_arc4); +#endif + kfree(priv); + } + + return NULL; +} + + +static void ieee80211_tkip_deinit(void *priv) +{ + struct ieee80211_tkip_data *_priv = priv; +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) + if (_priv->tx_tfm_michael) + crypto_free_tfm(_priv->tx_tfm_michael); + if (_priv->tx_tfm_arc4) + crypto_free_tfm(_priv->tx_tfm_arc4); + if (_priv->rx_tfm_michael) + crypto_free_tfm(_priv->rx_tfm_michael); + if (_priv->rx_tfm_arc4) + crypto_free_tfm(_priv->rx_tfm_arc4); +#else + if (_priv) { + if (_priv->tx_tfm_michael) + crypto_free_hash(_priv->tx_tfm_michael); + if (_priv->tx_tfm_arc4) + crypto_free_blkcipher(_priv->tx_tfm_arc4); + if (_priv->rx_tfm_michael) + crypto_free_hash(_priv->rx_tfm_michael); + if (_priv->rx_tfm_arc4) + crypto_free_blkcipher(_priv->rx_tfm_arc4); + } +#endif + kfree(priv); +} + + +static inline u16 RotR1(u16 val) +{ + return (val >> 1) | (val << 15); +} + + +static inline u8 Lo8(u16 val) +{ + return val & 0xff; +} + + +static inline u8 Hi8(u16 val) +{ + return val >> 8; +} + + +static inline u16 Lo16(u32 val) +{ + return val & 0xffff; +} + + +static inline u16 Hi16(u32 val) +{ + return val >> 16; +} + + +static inline u16 Mk16(u8 hi, u8 lo) +{ + return lo | (((u16) hi) << 8); +} + + +static inline u16 Mk16_le(u16 *v) +{ + return le16_to_cpu(*v); +} + + +static const u16 Sbox[256] = +{ + 0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154, + 0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A, + 0x8F45, 0x1F9D, 0x8940, 0xFA87, 0xEF15, 0xB2EB, 0x8EC9, 0xFB0B, + 0x41EC, 0xB367, 0x5FFD, 0x45EA, 0x23BF, 0x53F7, 0xE496, 0x9B5B, + 0x75C2, 0xE11C, 0x3DAE, 0x4C6A, 0x6C5A, 0x7E41, 0xF502, 0x834F, + 0x685C, 0x51F4, 0xD134, 0xF908, 0xE293, 0xAB73, 0x6253, 0x2A3F, + 0x080C, 0x9552, 0x4665, 0x9D5E, 0x3028, 0x37A1, 0x0A0F, 0x2FB5, + 0x0E09, 0x2436, 0x1B9B, 0xDF3D, 0xCD26, 0x4E69, 0x7FCD, 0xEA9F, + 0x121B, 0x1D9E, 0x5874, 0x342E, 0x362D, 0xDCB2, 0xB4EE, 0x5BFB, + 0xA4F6, 0x764D, 0xB761, 0x7DCE, 0x527B, 0xDD3E, 0x5E71, 0x1397, + 0xA6F5, 0xB968, 0x0000, 0xC12C, 0x4060, 0xE31F, 0x79C8, 0xB6ED, + 0xD4BE, 0x8D46, 0x67D9, 0x724B, 0x94DE, 0x98D4, 0xB0E8, 0x854A, + 0xBB6B, 0xC52A, 0x4FE5, 0xED16, 0x86C5, 0x9AD7, 0x6655, 0x1194, + 0x8ACF, 0xE910, 0x0406, 0xFE81, 0xA0F0, 0x7844, 0x25BA, 0x4BE3, + 0xA2F3, 0x5DFE, 0x80C0, 0x058A, 0x3FAD, 0x21BC, 0x7048, 0xF104, + 0x63DF, 0x77C1, 0xAF75, 0x4263, 0x2030, 0xE51A, 0xFD0E, 0xBF6D, + 0x814C, 0x1814, 0x2635, 0xC32F, 0xBEE1, 0x35A2, 0x88CC, 0x2E39, + 0x9357, 0x55F2, 0xFC82, 0x7A47, 0xC8AC, 0xBAE7, 0x322B, 0xE695, + 0xC0A0, 0x1998, 0x9ED1, 0xA37F, 0x4466, 0x547E, 0x3BAB, 0x0B83, + 0x8CCA, 0xC729, 0x6BD3, 0x283C, 0xA779, 0xBCE2, 0x161D, 0xAD76, + 0xDB3B, 0x6456, 0x744E, 0x141E, 0x92DB, 0x0C0A, 0x486C, 0xB8E4, + 0x9F5D, 0xBD6E, 0x43EF, 0xC4A6, 0x39A8, 0x31A4, 0xD337, 0xF28B, + 0xD532, 0x8B43, 0x6E59, 0xDAB7, 0x018C, 0xB164, 0x9CD2, 0x49E0, + 0xD8B4, 0xACFA, 0xF307, 0xCF25, 0xCAAF, 0xF48E, 0x47E9, 0x1018, + 0x6FD5, 0xF088, 0x4A6F, 0x5C72, 0x3824, 0x57F1, 0x73C7, 0x9751, + 0xCB23, 0xA17C, 0xE89C, 0x3E21, 0x96DD, 0x61DC, 0x0D86, 0x0F85, + 0xE090, 0x7C42, 0x71C4, 0xCCAA, 0x90D8, 0x0605, 0xF701, 0x1C12, + 0xC2A3, 0x6A5F, 0xAEF9, 0x69D0, 0x1791, 0x9958, 0x3A27, 0x27B9, + 0xD938, 0xEB13, 0x2BB3, 0x2233, 0xD2BB, 0xA970, 0x0789, 0x33A7, + 0x2DB6, 0x3C22, 0x1592, 0xC920, 0x8749, 0xAAFF, 0x5078, 0xA57A, + 0x038F, 0x59F8, 0x0980, 0x1A17, 0x65DA, 0xD731, 0x84C6, 0xD0B8, + 0x82C3, 0x29B0, 0x5A77, 0x1E11, 0x7BCB, 0xA8FC, 0x6DD6, 0x2C3A, +}; + + +static inline u16 _S_(u16 v) +{ + u16 t = Sbox[Hi8(v)]; + return Sbox[Lo8(v)] ^ ((t << 8) | (t >> 8)); +} + + +#define PHASE1_LOOP_COUNT 8 + + +static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32) +{ + int i, j; + + /* Initialize the 80-bit TTAK from TSC (IV32) and TA[0..5] */ + TTAK[0] = Lo16(IV32); + TTAK[1] = Hi16(IV32); + TTAK[2] = Mk16(TA[1], TA[0]); + TTAK[3] = Mk16(TA[3], TA[2]); + TTAK[4] = Mk16(TA[5], TA[4]); + + for (i = 0; i < PHASE1_LOOP_COUNT; i++) { + j = 2 * (i & 1); + TTAK[0] += _S_(TTAK[4] ^ Mk16(TK[1 + j], TK[0 + j])); + TTAK[1] += _S_(TTAK[0] ^ Mk16(TK[5 + j], TK[4 + j])); + TTAK[2] += _S_(TTAK[1] ^ Mk16(TK[9 + j], TK[8 + j])); + TTAK[3] += _S_(TTAK[2] ^ Mk16(TK[13 + j], TK[12 + j])); + TTAK[4] += _S_(TTAK[3] ^ Mk16(TK[1 + j], TK[0 + j])) + i; + } +} + + +static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, + u16 IV16) +{ + /* Make temporary area overlap WEP seed so that the final copy can be + * avoided on little endian hosts. */ + u16 *PPK = (u16 *) &WEPSeed[4]; + + /* Step 1 - make copy of TTAK and bring in TSC */ + PPK[0] = TTAK[0]; + PPK[1] = TTAK[1]; + PPK[2] = TTAK[2]; + PPK[3] = TTAK[3]; + PPK[4] = TTAK[4]; + PPK[5] = TTAK[4] + IV16; + + /* Step 2 - 96-bit bijective mixing using S-box */ + PPK[0] += _S_(PPK[5] ^ Mk16_le((u16 *) &TK[0])); + PPK[1] += _S_(PPK[0] ^ Mk16_le((u16 *) &TK[2])); + PPK[2] += _S_(PPK[1] ^ Mk16_le((u16 *) &TK[4])); + PPK[3] += _S_(PPK[2] ^ Mk16_le((u16 *) &TK[6])); + PPK[4] += _S_(PPK[3] ^ Mk16_le((u16 *) &TK[8])); + PPK[5] += _S_(PPK[4] ^ Mk16_le((u16 *) &TK[10])); + + PPK[0] += RotR1(PPK[5] ^ Mk16_le((u16 *) &TK[12])); + PPK[1] += RotR1(PPK[0] ^ Mk16_le((u16 *) &TK[14])); + PPK[2] += RotR1(PPK[1]); + PPK[3] += RotR1(PPK[2]); + PPK[4] += RotR1(PPK[3]); + PPK[5] += RotR1(PPK[4]); + + /* Step 3 - bring in last of TK bits, assign 24-bit WEP IV value + * WEPSeed[0..2] is transmitted as WEP IV */ + WEPSeed[0] = Hi8(IV16); + WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F; + WEPSeed[2] = Lo8(IV16); + WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((u16 *) &TK[0])) >> 1); + +#ifdef __BIG_ENDIAN + { + int i; + for (i = 0; i < 6; i++) + PPK[i] = (PPK[i] << 8) | (PPK[i] >> 8); + } +#endif +} + + +static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) +{ + struct ieee80211_tkip_data *tkey = priv; + int len; + u8 *pos; + struct ieee80211_hdr_4addr *hdr; + cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + + #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) + struct blkcipher_desc desc = {.tfm = tkey->tx_tfm_arc4}; + int ret = 0; + #endif + u8 rc4key[16], *icv; + u32 crc; + struct scatterlist sg; + + if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 || + skb->len < hdr_len) + return -1; + + hdr = (struct ieee80211_hdr_4addr *) skb->data; + +#if 0 +printk("@@ tkey\n"); +printk("%x|", ((u32*)tkey->key)[0]); +printk("%x|", ((u32*)tkey->key)[1]); +printk("%x|", ((u32*)tkey->key)[2]); +printk("%x|", ((u32*)tkey->key)[3]); +printk("%x|", ((u32*)tkey->key)[4]); +printk("%x|", ((u32*)tkey->key)[5]); +printk("%x|", ((u32*)tkey->key)[6]); +printk("%x\n", ((u32*)tkey->key)[7]); +#endif + + if (!tcb_desc->bHwSec) + { + if (!tkey->tx_phase1_done) { + tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, + tkey->tx_iv32); + tkey->tx_phase1_done = 1; + } + tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); + } + else + tkey->tx_phase1_done = 1; + + + len = skb->len - hdr_len; + pos = skb_push(skb, 8); + memmove(pos, pos + 8, hdr_len); + pos += hdr_len; + + if (tcb_desc->bHwSec) + { + *pos++ = Hi8(tkey->tx_iv16); + *pos++ = (Hi8(tkey->tx_iv16) | 0x20) & 0x7F; + *pos++ = Lo8(tkey->tx_iv16); + } + else + { + *pos++ = rc4key[0]; + *pos++ = rc4key[1]; + *pos++ = rc4key[2]; + } + + *pos++ = (tkey->key_idx << 6) | (1 << 5) /* Ext IV included */; + *pos++ = tkey->tx_iv32 & 0xff; + *pos++ = (tkey->tx_iv32 >> 8) & 0xff; + *pos++ = (tkey->tx_iv32 >> 16) & 0xff; + *pos++ = (tkey->tx_iv32 >> 24) & 0xff; + + if (!tcb_desc->bHwSec) + { + icv = skb_put(skb, 4); +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) + crc = ~crc32_le(~0, pos, len); +#else + crc = ~ether_crc_le(len, pos); +#endif + icv[0] = crc; + icv[1] = crc >> 8; + icv[2] = crc >> 16; + icv[3] = crc >> 24; +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) + crypto_cipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); + sg.page = virt_to_page(pos); + sg.offset = offset_in_page(pos); + sg.length = len + 4; + crypto_cipher_encrypt(tkey->tx_tfm_arc4, &sg, &sg, len + 4); +#else + crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); +#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) + sg.page = virt_to_page(pos); + sg.offset = offset_in_page(pos); + sg.length = len + 4; +#else + sg_init_one(&sg, pos, len+4); +#endif + ret= crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); +#endif + + } + + tkey->tx_iv16++; + if (tkey->tx_iv16 == 0) { + tkey->tx_phase1_done = 0; + tkey->tx_iv32++; + } + + if (!tcb_desc->bHwSec) +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) + return 0; + #else + return ret; + #endif + else + return 0; + + +} + +static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) +{ + struct ieee80211_tkip_data *tkey = priv; + u8 keyidx, *pos; + u32 iv32; + u16 iv16; + struct ieee80211_hdr_4addr *hdr; + cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) + struct blkcipher_desc desc = {.tfm = tkey->rx_tfm_arc4}; + #endif + u8 rc4key[16]; + u8 icv[4]; + u32 crc; + struct scatterlist sg; + int plen; + if (skb->len < hdr_len + 8 + 4) + return -1; + + hdr = (struct ieee80211_hdr_4addr *) skb->data; + pos = skb->data + hdr_len; + keyidx = pos[3]; + if (!(keyidx & (1 << 5))) { + if (net_ratelimit()) { + printk(KERN_DEBUG "TKIP: received packet without ExtIV" + " flag from " MAC_FMT "\n", MAC_ARG(hdr->addr2)); + } + return -2; + } + keyidx >>= 6; + if (tkey->key_idx != keyidx) { + printk(KERN_DEBUG "TKIP: RX tkey->key_idx=%d frame " + "keyidx=%d priv=%p\n", tkey->key_idx, keyidx, priv); + return -6; + } + if (!tkey->key_set) { + if (net_ratelimit()) { + printk(KERN_DEBUG "TKIP: received packet from " MAC_FMT + " with keyid=%d that does not have a configured" + " key\n", MAC_ARG(hdr->addr2), keyidx); + } + return -3; + } + iv16 = (pos[0] << 8) | pos[2]; + iv32 = pos[4] | (pos[5] << 8) | (pos[6] << 16) | (pos[7] << 24); + pos += 8; + + if (!tcb_desc->bHwSec) + { + if (iv32 < tkey->rx_iv32 || + (iv32 == tkey->rx_iv32 && iv16 <= tkey->rx_iv16)) { + if (net_ratelimit()) { + printk(KERN_DEBUG "TKIP: replay detected: STA=" MAC_FMT + " previous TSC %08x%04x received TSC " + "%08x%04x\n", MAC_ARG(hdr->addr2), + tkey->rx_iv32, tkey->rx_iv16, iv32, iv16); + } + tkey->dot11RSNAStatsTKIPReplays++; + return -4; + } + + if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) { + tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32); + tkey->rx_phase1_done = 1; + } + tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16); + + plen = skb->len - hdr_len - 12; + +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) + crypto_cipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); + sg.page = virt_to_page(pos); + sg.offset = offset_in_page(pos); + sg.length = plen + 4; + crypto_cipher_decrypt(tkey->rx_tfm_arc4, &sg, &sg, plen + 4); +#else + crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); +#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) + sg.page = virt_to_page(pos); + sg.offset = offset_in_page(pos); + sg.length = plen + 4; +#else + sg_init_one(&sg, pos, plen+4); +#endif + if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { + if (net_ratelimit()) { + printk(KERN_DEBUG ": TKIP: failed to decrypt " + "received packet from " MAC_FMT "\n", + MAC_ARG(hdr->addr2)); + } + return -7; + } +#endif + + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) + crc = ~crc32_le(~0, pos, plen); + #else + crc = ~ether_crc_le(plen, pos); + #endif + icv[0] = crc; + icv[1] = crc >> 8; + icv[2] = crc >> 16; + icv[3] = crc >> 24; + + if (memcmp(icv, pos + plen, 4) != 0) { + if (iv32 != tkey->rx_iv32) { + /* Previously cached Phase1 result was already lost, so + * it needs to be recalculated for the next packet. */ + tkey->rx_phase1_done = 0; + } + if (net_ratelimit()) { + printk(KERN_DEBUG "TKIP: ICV error detected: STA=" + MAC_FMT "\n", MAC_ARG(hdr->addr2)); + } + tkey->dot11RSNAStatsTKIPICVErrors++; + return -5; + } + + } + + /* Update real counters only after Michael MIC verification has + * completed */ + tkey->rx_iv32_new = iv32; + tkey->rx_iv16_new = iv16; + + /* Remove IV and ICV */ + memmove(skb->data + 8, skb->data, hdr_len); + skb_pull(skb, 8); + skb_trim(skb, skb->len - 4); + +//john's test +#ifdef JOHN_DUMP +if( ((u16*)skb->data)[0] & 0x4000){ + printk("@@ rx decrypted skb->data"); + int i; + for(i=0;ilen;i++){ + if( (i%24)==0 ) printk("\n"); + printk("%2x ", ((u8*)skb->data)[i]); + } + printk("\n"); +} +#endif /*JOHN_DUMP*/ + return keyidx; +} + + +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) +static int michael_mic(struct crypto_tfm * tfm_michael, u8 *key, u8 *hdr, + u8 *data, size_t data_len, u8 *mic) +{ + struct scatterlist sg[2]; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) + struct hash_desc desc; + int ret = 0; +#endif + + if (tfm_michael == NULL){ + printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); + return -1; + } + sg[0].page = virt_to_page(hdr); + sg[0].offset = offset_in_page(hdr); + sg[0].length = 16; + + sg[1].page = virt_to_page(data); + sg[1].offset = offset_in_page(data); + sg[1].length = data_len; + + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) + crypto_digest_init(tfm_michael); + crypto_digest_setkey(tfm_michael, key, 8); + crypto_digest_update(tfm_michael, sg, 2); + crypto_digest_final(tfm_michael, mic); + return 0; +#else +if (crypto_hash_setkey(tkey->tfm_michael, key, 8)) + return -1; + +// return 0; + desc.tfm = tkey->tfm_michael; + desc.flags = 0; + ret = crypto_hash_digest(&desc, sg, data_len + 16, mic); + return ret; +#endif +} +#else +static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr, + u8 * data, size_t data_len, u8 * mic) +{ + struct hash_desc desc; + struct scatterlist sg[2]; + + if (tfm_michael == NULL) { + printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); + return -1; + } +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) + sg[0].page = virt_to_page(hdr); + sg[0].offset = offset_in_page(hdr); + sg[0].length = 16; + + sg[1].page = virt_to_page(data); + sg[1].offset = offset_in_page(data); + sg[1].length = data_len; +#else + sg_init_table(sg, 2); + sg_set_buf(&sg[0], hdr, 16); + sg_set_buf(&sg[1], data, data_len); +#endif + + if (crypto_hash_setkey(tfm_michael, key, 8)) + return -1; + + desc.tfm = tfm_michael; + desc.flags = 0; + return crypto_hash_digest(&desc, sg, data_len + 16, mic); +} +#endif + + + +static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) +{ + struct ieee80211_hdr_4addr *hdr11; + + hdr11 = (struct ieee80211_hdr_4addr *) skb->data; + switch (le16_to_cpu(hdr11->frame_ctl) & + (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { + case IEEE80211_FCTL_TODS: + memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ + memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ + break; + case IEEE80211_FCTL_FROMDS: + memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ + memcpy(hdr + ETH_ALEN, hdr11->addr3, ETH_ALEN); /* SA */ + break; + case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS: + memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ + memcpy(hdr + ETH_ALEN, hdr11->addr4, ETH_ALEN); /* SA */ + break; + case 0: + memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ + memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ + break; + } + + hdr[12] = 0; /* priority */ + + hdr[13] = hdr[14] = hdr[15] = 0; /* reserved */ +} + + +static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv) +{ + struct ieee80211_tkip_data *tkey = priv; + u8 *pos; + struct ieee80211_hdr_4addr *hdr; + + hdr = (struct ieee80211_hdr_4addr *) skb->data; + + if (skb_tailroom(skb) < 8 || skb->len < hdr_len) { + printk(KERN_DEBUG "Invalid packet for Michael MIC add " + "(tailroom=%d hdr_len=%d skb->len=%d)\n", + skb_tailroom(skb), hdr_len, skb->len); + return -1; + } + + michael_mic_hdr(skb, tkey->tx_hdr); + + // { david, 2006.9.1 + // fix the wpa process with wmm enabled. + if(IEEE80211_QOS_HAS_SEQ(le16_to_cpu(hdr->frame_ctl))) { + tkey->tx_hdr[12] = *(skb->data + hdr_len - 2) & 0x07; + } + // } + pos = skb_put(skb, 8); +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) + if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr, + skb->data + hdr_len, skb->len - 8 - hdr_len, pos)) +#else + if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr, + skb->data + hdr_len, skb->len - 8 - hdr_len, pos)) +#endif + return -1; + + return 0; +} + + +#if WIRELESS_EXT >= 18 +static void ieee80211_michael_mic_failure(struct net_device *dev, + struct ieee80211_hdr_4addr *hdr, + int keyidx) +{ + union iwreq_data wrqu; + struct iw_michaelmicfailure ev; + + /* TODO: needed parameters: count, keyid, key type, TSC */ + memset(&ev, 0, sizeof(ev)); + ev.flags = keyidx & IW_MICFAILURE_KEY_ID; + if (hdr->addr1[0] & 0x01) + ev.flags |= IW_MICFAILURE_GROUP; + else + ev.flags |= IW_MICFAILURE_PAIRWISE; + ev.src_addr.sa_family = ARPHRD_ETHER; + memcpy(ev.src_addr.sa_data, hdr->addr2, ETH_ALEN); + memset(&wrqu, 0, sizeof(wrqu)); + wrqu.data.length = sizeof(ev); + wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev); +} +#elif WIRELESS_EXT >= 15 +static void ieee80211_michael_mic_failure(struct net_device *dev, + struct ieee80211_hdr_4addr *hdr, + int keyidx) +{ + union iwreq_data wrqu; + char buf[128]; + + /* TODO: needed parameters: count, keyid, key type, TSC */ + sprintf(buf, "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr=" + MAC_FMT ")", keyidx, hdr->addr1[0] & 0x01 ? "broad" : "uni", + MAC_ARG(hdr->addr2)); + memset(&wrqu, 0, sizeof(wrqu)); + wrqu.data.length = strlen(buf); + wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf); +} +#else /* WIRELESS_EXT >= 15 */ +static inline void ieee80211_michael_mic_failure(struct net_device *dev, + struct ieee80211_hdr_4addr *hdr, + int keyidx) +{ +} +#endif /* WIRELESS_EXT >= 15 */ + +static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, + int hdr_len, void *priv) +{ + struct ieee80211_tkip_data *tkey = priv; + u8 mic[8]; + struct ieee80211_hdr_4addr *hdr; + + hdr = (struct ieee80211_hdr_4addr *) skb->data; + + if (!tkey->key_set) + return -1; + + michael_mic_hdr(skb, tkey->rx_hdr); + // { david, 2006.9.1 + // fix the wpa process with wmm enabled. + if(IEEE80211_QOS_HAS_SEQ(le16_to_cpu(hdr->frame_ctl))) { + tkey->rx_hdr[12] = *(skb->data + hdr_len - 2) & 0x07; + } + // } + +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) + if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr, + skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) +#else + if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr, + skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) +#endif + return -1; + if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { + struct ieee80211_hdr_4addr *hdr; + hdr = (struct ieee80211_hdr_4addr *) skb->data; + printk(KERN_DEBUG "%s: Michael MIC verification failed for " + "MSDU from " MAC_FMT " keyidx=%d\n", + skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2), + keyidx); + if (skb->dev) + ieee80211_michael_mic_failure(skb->dev, hdr, keyidx); + tkey->dot11RSNAStatsTKIPLocalMICFailures++; + return -1; + } + + /* Update TSC counters for RX now that the packet verification has + * completed. */ + tkey->rx_iv32 = tkey->rx_iv32_new; + tkey->rx_iv16 = tkey->rx_iv16_new; + + skb_trim(skb, skb->len - 8); + + return 0; +} + + +static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv) +{ + struct ieee80211_tkip_data *tkey = priv; + int keyidx; +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) + struct crypto_tfm *tfm = tkey->tx_tfm_michael; + struct crypto_tfm *tfm2 = tkey->tx_tfm_arc4; + struct crypto_tfm *tfm3 = tkey->rx_tfm_michael; + struct crypto_tfm *tfm4 = tkey->rx_tfm_arc4; +#else + struct crypto_hash *tfm = tkey->tx_tfm_michael; + struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4; + struct crypto_hash *tfm3 = tkey->rx_tfm_michael; + struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4; +#endif + + keyidx = tkey->key_idx; + memset(tkey, 0, sizeof(*tkey)); + tkey->key_idx = keyidx; +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) + tkey->tx_tfm_michael = tfm; + tkey->tx_tfm_arc4 = tfm2; + tkey->rx_tfm_michael = tfm3; + tkey->rx_tfm_arc4 = tfm4; +#else + tkey->tx_tfm_michael = tfm; + tkey->tx_tfm_arc4 = tfm2; + tkey->rx_tfm_michael = tfm3; + tkey->rx_tfm_arc4 = tfm4; +#endif + + if (len == TKIP_KEY_LEN) { + memcpy(tkey->key, key, TKIP_KEY_LEN); + tkey->key_set = 1; + tkey->tx_iv16 = 1; /* TSC is initialized to 1 */ + if (seq) { + tkey->rx_iv32 = (seq[5] << 24) | (seq[4] << 16) | + (seq[3] << 8) | seq[2]; + tkey->rx_iv16 = (seq[1] << 8) | seq[0]; + } + } else if (len == 0) + tkey->key_set = 0; + else + return -1; + + return 0; +} + + +static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv) +{ + struct ieee80211_tkip_data *tkey = priv; + + if (len < TKIP_KEY_LEN) + return -1; + + if (!tkey->key_set) + return 0; + memcpy(key, tkey->key, TKIP_KEY_LEN); + + if (seq) { + /* Return the sequence number of the last transmitted frame. */ + u16 iv16 = tkey->tx_iv16; + u32 iv32 = tkey->tx_iv32; + if (iv16 == 0) + iv32--; + iv16--; + seq[0] = tkey->tx_iv16; + seq[1] = tkey->tx_iv16 >> 8; + seq[2] = tkey->tx_iv32; + seq[3] = tkey->tx_iv32 >> 8; + seq[4] = tkey->tx_iv32 >> 16; + seq[5] = tkey->tx_iv32 >> 24; + } + + return TKIP_KEY_LEN; +} + + +static char * ieee80211_tkip_print_stats(char *p, void *priv) +{ + struct ieee80211_tkip_data *tkip = priv; + p += sprintf(p, "key[%d] alg=TKIP key_set=%d " + "tx_pn=%02x%02x%02x%02x%02x%02x " + "rx_pn=%02x%02x%02x%02x%02x%02x " + "replays=%d icv_errors=%d local_mic_failures=%d\n", + tkip->key_idx, tkip->key_set, + (tkip->tx_iv32 >> 24) & 0xff, + (tkip->tx_iv32 >> 16) & 0xff, + (tkip->tx_iv32 >> 8) & 0xff, + tkip->tx_iv32 & 0xff, + (tkip->tx_iv16 >> 8) & 0xff, + tkip->tx_iv16 & 0xff, + (tkip->rx_iv32 >> 24) & 0xff, + (tkip->rx_iv32 >> 16) & 0xff, + (tkip->rx_iv32 >> 8) & 0xff, + tkip->rx_iv32 & 0xff, + (tkip->rx_iv16 >> 8) & 0xff, + tkip->rx_iv16 & 0xff, + tkip->dot11RSNAStatsTKIPReplays, + tkip->dot11RSNAStatsTKIPICVErrors, + tkip->dot11RSNAStatsTKIPLocalMICFailures); + return p; +} + + +static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { + .name = "TKIP", + .init = ieee80211_tkip_init, + .deinit = ieee80211_tkip_deinit, + .encrypt_mpdu = ieee80211_tkip_encrypt, + .decrypt_mpdu = ieee80211_tkip_decrypt, + .encrypt_msdu = ieee80211_michael_mic_add, + .decrypt_msdu = ieee80211_michael_mic_verify, + .set_key = ieee80211_tkip_set_key, + .get_key = ieee80211_tkip_get_key, + .print_stats = ieee80211_tkip_print_stats, + .extra_prefix_len = 4 + 4, /* IV + ExtIV */ + .extra_postfix_len = 8 + 4, /* MIC + ICV */ + .owner = THIS_MODULE, +}; + + +static int __init ieee80211_crypto_tkip_init(void) +{ + return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip); +} + + +static void __exit ieee80211_crypto_tkip_exit(void) +{ + ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip); +} + +void ieee80211_tkip_null(void) +{ +// printk("============>%s()\n", __FUNCTION__); + return; +} +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) +EXPORT_SYMBOL(ieee80211_tkip_null); +#else +EXPORT_SYMBOL_NOVERS(ieee80211_tkip_null); +#endif + +module_init(ieee80211_crypto_tkip_init); +module_exit(ieee80211_crypto_tkip_exit); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c new file mode 100644 index 000000000000..7e394328ec90 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c @@ -0,0 +1,397 @@ +/* + * Host AP crypt: host-based WEP encryption implementation for Host AP driver + * + * Copyright (c) 2002-2004, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. See README and COPYING for + * more details. + */ + +//#include +#include +#include +#include +#include +#include +#include +#include + +#include "ieee80211.h" + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)) +//#include "crypto_compat.h" +#endif + + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +#include "rtl_crypto.h" +#else +#include +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) + #include +#else + #include +#endif +//#include +#include +// +/* +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +#include "rtl_crypto.h" +#else +#include +#endif + +#include +#include +*/ +MODULE_AUTHOR("Jouni Malinen"); +MODULE_DESCRIPTION("Host AP crypt: WEP"); +MODULE_LICENSE("GPL"); +#ifndef OPENSUSE_SLED +#define OPENSUSE_SLED 0 +#endif + +struct prism2_wep_data { + u32 iv; +#define WEP_KEY_LEN 13 + u8 key[WEP_KEY_LEN + 1]; + u8 key_len; + u8 key_idx; +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) + struct crypto_tfm *tfm; + #else + struct crypto_blkcipher *tx_tfm; + struct crypto_blkcipher *rx_tfm; + #endif +}; + + +static void * prism2_wep_init(int keyidx) +{ + struct prism2_wep_data *priv; + + priv = kmalloc(sizeof(*priv), GFP_ATOMIC); + if (priv == NULL) + goto fail; + memset(priv, 0, sizeof(*priv)); + priv->key_idx = keyidx; + +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) + priv->tfm = crypto_alloc_tfm("arc4", 0); + if (priv->tfm == NULL) { + printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " + "crypto API arc4\n"); + goto fail; + } + #else + priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); + if (IS_ERR(priv->tx_tfm)) { + printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " + "crypto API arc4\n"); + priv->tx_tfm = NULL; + goto fail; + } + priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); + if (IS_ERR(priv->rx_tfm)) { + printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " + "crypto API arc4\n"); + priv->rx_tfm = NULL; + goto fail; + } + #endif + + /* start WEP IV from a random value */ + get_random_bytes(&priv->iv, 4); + + return priv; + +fail: +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) + if (priv) { + if (priv->tfm) + crypto_free_tfm(priv->tfm); + kfree(priv); + } + #else + if (priv) { + if (priv->tx_tfm) + crypto_free_blkcipher(priv->tx_tfm); + if (priv->rx_tfm) + crypto_free_blkcipher(priv->rx_tfm); + kfree(priv); + } + #endif + return NULL; +} + + +static void prism2_wep_deinit(void *priv) +{ + struct prism2_wep_data *_priv = priv; +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) + if (_priv && _priv->tfm) + crypto_free_tfm(_priv->tfm); + #else + if (_priv) { + if (_priv->tx_tfm) + crypto_free_blkcipher(_priv->tx_tfm); + if (_priv->rx_tfm) + crypto_free_blkcipher(_priv->rx_tfm); + } + #endif + kfree(priv); +} + +/* Perform WEP encryption on given skb that has at least 4 bytes of headroom + * for IV and 4 bytes of tailroom for ICV. Both IV and ICV will be transmitted, + * so the payload length increases with 8 bytes. + * + * WEP frame payload: IV + TX key idx, RC4(data), ICV = RC4(CRC32(data)) + */ +static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) +{ + struct prism2_wep_data *wep = priv; + u32 klen, len; + u8 key[WEP_KEY_LEN + 3]; + u8 *pos; + cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) + struct blkcipher_desc desc = {.tfm = wep->tx_tfm}; + #endif + u32 crc; + u8 *icv; + struct scatterlist sg; + if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 || + skb->len < hdr_len) + return -1; + + len = skb->len - hdr_len; + pos = skb_push(skb, 4); + memmove(pos, pos + 4, hdr_len); + pos += hdr_len; + + klen = 3 + wep->key_len; + + wep->iv++; + + /* Fluhrer, Mantin, and Shamir have reported weaknesses in the key + * scheduling algorithm of RC4. At least IVs (KeyByte + 3, 0xff, N) + * can be used to speedup attacks, so avoid using them. */ + if ((wep->iv & 0xff00) == 0xff00) { + u8 B = (wep->iv >> 16) & 0xff; + if (B >= 3 && B < klen) + wep->iv += 0x0100; + } + + /* Prepend 24-bit IV to RC4 key and TX frame */ + *pos++ = key[0] = (wep->iv >> 16) & 0xff; + *pos++ = key[1] = (wep->iv >> 8) & 0xff; + *pos++ = key[2] = wep->iv & 0xff; + *pos++ = wep->key_idx << 6; + + /* Copy rest of the WEP key (the secret part) */ + memcpy(key + 3, wep->key, wep->key_len); + + if (!tcb_desc->bHwSec) + { + + /* Append little-endian CRC32 and encrypt it to produce ICV */ + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) + crc = ~crc32_le(~0, pos, len); + #else + crc = ~ether_crc_le(len, pos); + #endif + icv = skb_put(skb, 4); + icv[0] = crc; + icv[1] = crc >> 8; + icv[2] = crc >> 16; + icv[3] = crc >> 24; + +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) + crypto_cipher_setkey(wep->tfm, key, klen); + sg.page = virt_to_page(pos); + sg.offset = offset_in_page(pos); + sg.length = len + 4; + crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4); + return 0; + #else + crypto_blkcipher_setkey(wep->tx_tfm, key, klen); + #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) + sg.page = virt_to_page(pos); + sg.offset = offset_in_page(pos); + sg.length = len + 4; + #else + sg_init_one(&sg, pos, len+4); + #endif + return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); + #endif + } + + return 0; +} + + +/* Perform WEP decryption on given buffer. Buffer includes whole WEP part of + * the frame: IV (4 bytes), encrypted payload (including SNAP header), + * ICV (4 bytes). len includes both IV and ICV. + * + * Returns 0 if frame was decrypted successfully and ICV was correct and -1 on + * failure. If frame is OK, IV and ICV will be removed. + */ +static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) +{ + struct prism2_wep_data *wep = priv; + u32 klen, plen; + u8 key[WEP_KEY_LEN + 3]; + u8 keyidx, *pos; + cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) + struct blkcipher_desc desc = {.tfm = wep->rx_tfm}; + #endif + u32 crc; + u8 icv[4]; + struct scatterlist sg; + if (skb->len < hdr_len + 8) + return -1; + + pos = skb->data + hdr_len; + key[0] = *pos++; + key[1] = *pos++; + key[2] = *pos++; + keyidx = *pos++ >> 6; + if (keyidx != wep->key_idx) + return -1; + + klen = 3 + wep->key_len; + + /* Copy rest of the WEP key (the secret part) */ + memcpy(key + 3, wep->key, wep->key_len); + + /* Apply RC4 to data and compute CRC32 over decrypted data */ + plen = skb->len - hdr_len - 8; + + if (!tcb_desc->bHwSec) + { +#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) + crypto_cipher_setkey(wep->tfm, key, klen); + sg.page = virt_to_page(pos); + sg.offset = offset_in_page(pos); + sg.length = plen + 4; + crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4); + #else + crypto_blkcipher_setkey(wep->rx_tfm, key, klen); + #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) + sg.page = virt_to_page(pos); + sg.offset = offset_in_page(pos); + sg.length = plen + 4; + #else + sg_init_one(&sg, pos, plen+4); + #endif + if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) + return -7; + #endif + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) + crc = ~crc32_le(~0, pos, plen); + #else + crc = ~ether_crc_le(plen, pos); + #endif + icv[0] = crc; + icv[1] = crc >> 8; + icv[2] = crc >> 16; + icv[3] = crc >> 24; + if (memcmp(icv, pos + plen, 4) != 0) { + /* ICV mismatch - drop frame */ + return -2; + } + } + /* Remove IV and ICV */ + memmove(skb->data + 4, skb->data, hdr_len); + skb_pull(skb, 4); + skb_trim(skb, skb->len - 4); + + return 0; +} + + +static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv) +{ + struct prism2_wep_data *wep = priv; + + if (len < 0 || len > WEP_KEY_LEN) + return -1; + + memcpy(wep->key, key, len); + wep->key_len = len; + + return 0; +} + + +static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv) +{ + struct prism2_wep_data *wep = priv; + + if (len < wep->key_len) + return -1; + + memcpy(key, wep->key, wep->key_len); + + return wep->key_len; +} + + +static char * prism2_wep_print_stats(char *p, void *priv) +{ + struct prism2_wep_data *wep = priv; + p += sprintf(p, "key[%d] alg=WEP len=%d\n", + wep->key_idx, wep->key_len); + return p; +} + + +static struct ieee80211_crypto_ops ieee80211_crypt_wep = { + .name = "WEP", + .init = prism2_wep_init, + .deinit = prism2_wep_deinit, + .encrypt_mpdu = prism2_wep_encrypt, + .decrypt_mpdu = prism2_wep_decrypt, + .encrypt_msdu = NULL, + .decrypt_msdu = NULL, + .set_key = prism2_wep_set_key, + .get_key = prism2_wep_get_key, + .print_stats = prism2_wep_print_stats, + .extra_prefix_len = 4, /* IV */ + .extra_postfix_len = 4, /* ICV */ + .owner = THIS_MODULE, +}; + + +static int __init ieee80211_crypto_wep_init(void) +{ + return ieee80211_register_crypto_ops(&ieee80211_crypt_wep); +} + + +static void __exit ieee80211_crypto_wep_exit(void) +{ + ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep); +} + +void ieee80211_wep_null(void) +{ +// printk("============>%s()\n", __FUNCTION__); + return; +} +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) +EXPORT_SYMBOL(ieee80211_wep_null); +#else +EXPORT_SYMBOL_NOVERS(ieee80211_wep_null); +#endif + +module_init(ieee80211_crypto_wep_init); +module_exit(ieee80211_crypto_wep_exit); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c new file mode 100644 index 000000000000..f408b4583b82 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -0,0 +1,394 @@ +/******************************************************************************* + + Copyright(c) 2004 Intel Corporation. All rights reserved. + + Portions of this file are based on the WEP enablement code provided by the + Host AP project hostap-drivers v0.1.3 + Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen + + Copyright (c) 2002-2003, Jouni Malinen + + This program is free software; you can redistribute it and/or modify it + under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + 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., 59 + Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + The full GNU General Public License is included in this distribution in the + file called LICENSE. + + Contact Information: + James P. Ketrenos + Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + +*******************************************************************************/ + +#include +//#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ieee80211.h" + +MODULE_DESCRIPTION("802.11 data/management/control stack"); +MODULE_AUTHOR("Copyright (C) 2004 Intel Corporation "); +MODULE_LICENSE("GPL"); + +#define DRV_NAME "ieee80211" + +static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee) +{ + if (ieee->networks) + return 0; + + ieee->networks = kmalloc( + MAX_NETWORK_COUNT * sizeof(struct ieee80211_network), + GFP_KERNEL); + if (!ieee->networks) { + printk(KERN_WARNING "%s: Out of memory allocating beacons\n", + ieee->dev->name); + return -ENOMEM; + } + + memset(ieee->networks, 0, + MAX_NETWORK_COUNT * sizeof(struct ieee80211_network)); + + return 0; +} + +static inline void ieee80211_networks_free(struct ieee80211_device *ieee) +{ + if (!ieee->networks) + return; + kfree(ieee->networks); + ieee->networks = NULL; +} + +static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee) +{ + int i; + + INIT_LIST_HEAD(&ieee->network_free_list); + INIT_LIST_HEAD(&ieee->network_list); + for (i = 0; i < MAX_NETWORK_COUNT; i++) + list_add_tail(&ieee->networks[i].list, &ieee->network_free_list); +} + + +struct net_device *alloc_ieee80211(int sizeof_priv) +{ + struct ieee80211_device *ieee; + struct net_device *dev; + int i,err; + + IEEE80211_DEBUG_INFO("Initializing...\n"); + + dev = alloc_etherdev(sizeof(struct ieee80211_device) + sizeof_priv); + if (!dev) { + IEEE80211_ERROR("Unable to network device.\n"); + goto failed; + } + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) + ieee = netdev_priv(dev); +#else + ieee = (struct ieee80211_device *)dev->priv; +#endif + dev->hard_start_xmit = ieee80211_xmit; + + memset(ieee, 0, sizeof(struct ieee80211_device)+sizeof_priv); + ieee->dev = dev; + + err = ieee80211_networks_allocate(ieee); + if (err) { + IEEE80211_ERROR("Unable to allocate beacon storage: %d\n", + err); + goto failed; + } + ieee80211_networks_initialize(ieee); + + + /* Default fragmentation threshold is maximum payload size */ + ieee->fts = DEFAULT_FTS; + ieee->scan_age = DEFAULT_MAX_SCAN_AGE; + ieee->open_wep = 1; + + /* Default to enabling full open WEP with host based encrypt/decrypt */ + ieee->host_encrypt = 1; + ieee->host_decrypt = 1; + ieee->ieee802_1x = 1; /* Default to supporting 802.1x */ + + INIT_LIST_HEAD(&ieee->crypt_deinit_list); + init_timer(&ieee->crypt_deinit_timer); + ieee->crypt_deinit_timer.data = (unsigned long)ieee; + ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler; + + spin_lock_init(&ieee->lock); + spin_lock_init(&ieee->wpax_suitlist_lock); + spin_lock_init(&ieee->bw_spinlock); + spin_lock_init(&ieee->reorder_spinlock); + //added by WB + atomic_set(&(ieee->atm_chnlop), 0); + atomic_set(&(ieee->atm_swbw), 0); + + ieee->wpax_type_set = 0; + ieee->wpa_enabled = 0; + ieee->tkip_countermeasures = 0; + ieee->drop_unencrypted = 0; + ieee->privacy_invoked = 0; + ieee->ieee802_1x = 1; + ieee->raw_tx = 0; + //ieee->hwsec_support = 1; //defalt support hw security. //use module_param instead. + ieee->hwsec_active = 0; //disable hwsec, switch it on when necessary. + + ieee80211_softmac_init(ieee); + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)) + ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kzalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL); +#else + ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kmalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL); + memset(ieee->pHTInfo,0,sizeof(RT_HIGH_THROUGHPUT)); +#endif + if (ieee->pHTInfo == NULL) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for HTInfo\n"); + return NULL; + } + HTUpdateDefaultSetting(ieee); + HTInitializeHTInfo(ieee); //may move to other place. + TSInitialize(ieee); +#if 0 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) + INIT_WORK(&ieee->ht_onAssRsp, (void(*)(void*)) HTOnAssocRsp_wq); +#else + INIT_WORK(&ieee->ht_onAssRsp, (void(*)(void*)) HTOnAssocRsp_wq, ieee); +#endif +#endif + for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) + INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]); + + for (i = 0; i < 17; i++) { + ieee->last_rxseq_num[i] = -1; + ieee->last_rxfrag_num[i] = -1; + ieee->last_packet_time[i] = 0; + } + +//These function were added to load crypte module autoly + ieee80211_tkip_null(); + ieee80211_wep_null(); + ieee80211_ccmp_null(); + + return dev; + + failed: + if (dev) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) + free_netdev(dev); +#else + kfree(dev); +#endif + return NULL; +} + + +void free_ieee80211(struct net_device *dev) +{ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) + struct ieee80211_device *ieee = netdev_priv(dev); +#else + struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv; +#endif + int i; + //struct list_head *p, *q; +// del_timer_sync(&ieee->SwBwTimer); +#if 1 + if (ieee->pHTInfo != NULL) + { + kfree(ieee->pHTInfo); + ieee->pHTInfo = NULL; + } +#endif + RemoveAllTS(ieee); + ieee80211_softmac_free(ieee); + del_timer_sync(&ieee->crypt_deinit_timer); + ieee80211_crypt_deinit_entries(ieee, 1); + + for (i = 0; i < WEP_KEYS; i++) { + struct ieee80211_crypt_data *crypt = ieee->crypt[i]; + if (crypt) { + if (crypt->ops) { + crypt->ops->deinit(crypt->priv); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) + module_put(crypt->ops->owner); +#else + __MOD_DEC_USE_COUNT(crypt->ops->owner); +#endif + } + kfree(crypt); + ieee->crypt[i] = NULL; + } + } + + ieee80211_networks_free(ieee); +#if 0 + for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) { + list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) { + kfree(list_entry(p, struct ieee_ibss_seq, list)); + list_del(p); + } + } + +#endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) + free_netdev(dev); +#else + kfree(dev); +#endif +} + +#ifdef CONFIG_IEEE80211_DEBUG + +u32 ieee80211_debug_level = 0; +static int debug = \ + // IEEE80211_DL_INFO | + // IEEE80211_DL_WX | + // IEEE80211_DL_SCAN | + // IEEE80211_DL_STATE | + // IEEE80211_DL_MGMT | + // IEEE80211_DL_FRAG | + // IEEE80211_DL_EAP | + // IEEE80211_DL_DROP | + // IEEE80211_DL_TX | + // IEEE80211_DL_RX | + //IEEE80211_DL_QOS | + // IEEE80211_DL_HT | + // IEEE80211_DL_TS | +// IEEE80211_DL_BA | + // IEEE80211_DL_REORDER| +// IEEE80211_DL_TRACE | + //IEEE80211_DL_DATA | + IEEE80211_DL_ERR //awayls open this flags to show error out + ; +struct proc_dir_entry *ieee80211_proc = NULL; + +static int show_debug_level(char *page, char **start, off_t offset, + int count, int *eof, void *data) +{ + return snprintf(page, count, "0x%08X\n", ieee80211_debug_level); +} + +static int store_debug_level(struct file *file, const char *buffer, + unsigned long count, void *data) +{ + char buf[] = "0x00000000"; + unsigned long len = min(sizeof(buf) - 1, (u32)count); + char *p = (char *)buf; + unsigned long val; + + if (copy_from_user(buf, buffer, len)) + return count; + buf[len] = 0; + if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') { + p++; + if (p[0] == 'x' || p[0] == 'X') + p++; + val = simple_strtoul(p, &p, 16); + } else + val = simple_strtoul(p, &p, 10); + if (p == buf) + printk(KERN_INFO DRV_NAME + ": %s is not in hex or decimal form.\n", buf); + else + ieee80211_debug_level = val; + + return strnlen(buf, count); +} + +static int __init ieee80211_init(void) +{ + struct proc_dir_entry *e; + + ieee80211_debug_level = debug; +#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) + ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, proc_net); +#else + ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, init_net.proc_net); +#endif + if (ieee80211_proc == NULL) { + IEEE80211_ERROR("Unable to create " DRV_NAME + " proc directory\n"); + return -EIO; + } + e = create_proc_entry("debug_level", S_IFREG | S_IRUGO | S_IWUSR, + ieee80211_proc); + if (!e) { +#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) + remove_proc_entry(DRV_NAME, proc_net); +#else + remove_proc_entry(DRV_NAME, init_net.proc_net); +#endif + ieee80211_proc = NULL; + return -EIO; + } + e->read_proc = show_debug_level; + e->write_proc = store_debug_level; + e->data = NULL; + + return 0; +} + +static void __exit ieee80211_exit(void) +{ + if (ieee80211_proc) { + remove_proc_entry("debug_level", ieee80211_proc); +#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) + remove_proc_entry(DRV_NAME, proc_net); +#else + remove_proc_entry(DRV_NAME, init_net.proc_net); +#endif + ieee80211_proc = NULL; + } +} + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) +#include +module_param(debug, int, 0444); +MODULE_PARM_DESC(debug, "debug output mask"); + + +module_exit(ieee80211_exit); +module_init(ieee80211_init); +#endif +#endif + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) +EXPORT_SYMBOL(alloc_ieee80211); +EXPORT_SYMBOL(free_ieee80211); +#else +EXPORT_SYMBOL_NOVERS(alloc_ieee80211); +EXPORT_SYMBOL_NOVERS(free_ieee80211); +#endif diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c new file mode 100644 index 000000000000..5b66e546416e --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -0,0 +1,2778 @@ +/* + * Original code based Host AP (software wireless LAN access point) driver + * for Intersil Prism2/2.5/3 - hostap.o module, common routines + * + * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen + * + * Copyright (c) 2002-2003, Jouni Malinen + * Copyright (c) 2004, Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. See README and COPYING for + * more details. + ****************************************************************************** + + Few modifications for Realtek's Wi-Fi drivers by + Andrea Merello + + A special thanks goes to Realtek for their support ! + +******************************************************************************/ + + +#include +//#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ieee80211.h" +#ifdef ENABLE_DOT11D +#include "dot11d.h" +#endif +static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee, + struct sk_buff *skb, + struct ieee80211_rx_stats *rx_stats) +{ + struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *)skb->data; + u16 fc = le16_to_cpu(hdr->frame_ctl); + + skb->dev = ieee->dev; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) + skb_reset_mac_header(skb); +#else + skb->mac.raw = skb->data; +#endif + + skb_pull(skb, ieee80211_get_hdrlen(fc)); + skb->pkt_type = PACKET_OTHERHOST; + skb->protocol = __constant_htons(ETH_P_80211_RAW); + memset(skb->cb, 0, sizeof(skb->cb)); + netif_rx(skb); +} + + +/* Called only as a tasklet (software IRQ) */ +static struct ieee80211_frag_entry * +ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq, + unsigned int frag, u8 tid,u8 *src, u8 *dst) +{ + struct ieee80211_frag_entry *entry; + int i; + + for (i = 0; i < IEEE80211_FRAG_CACHE_LEN; i++) { + entry = &ieee->frag_cache[tid][i]; + if (entry->skb != NULL && + time_after(jiffies, entry->first_frag_time + 2 * HZ)) { + IEEE80211_DEBUG_FRAG( + "expiring fragment cache entry " + "seq=%u last_frag=%u\n", + entry->seq, entry->last_frag); + dev_kfree_skb_any(entry->skb); + entry->skb = NULL; + } + + if (entry->skb != NULL && entry->seq == seq && + (entry->last_frag + 1 == frag || frag == -1) && + memcmp(entry->src_addr, src, ETH_ALEN) == 0 && + memcmp(entry->dst_addr, dst, ETH_ALEN) == 0) + return entry; + } + + return NULL; +} + +/* Called only as a tasklet (software IRQ) */ +static struct sk_buff * +ieee80211_frag_cache_get(struct ieee80211_device *ieee, + struct ieee80211_hdr_4addr *hdr) +{ + struct sk_buff *skb = NULL; + u16 fc = le16_to_cpu(hdr->frame_ctl); + u16 sc = le16_to_cpu(hdr->seq_ctl); + unsigned int frag = WLAN_GET_SEQ_FRAG(sc); + unsigned int seq = WLAN_GET_SEQ_SEQ(sc); + struct ieee80211_frag_entry *entry; + struct ieee80211_hdr_3addrqos *hdr_3addrqos; + struct ieee80211_hdr_4addrqos *hdr_4addrqos; + u8 tid; + + if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS)&&IEEE80211_QOS_HAS_SEQ(fc)) { + hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)hdr; + tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QCTL_TID; + tid = UP2AC(tid); + tid ++; + } else if (IEEE80211_QOS_HAS_SEQ(fc)) { + hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)hdr; + tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QCTL_TID; + tid = UP2AC(tid); + tid ++; + } else { + tid = 0; + } + + if (frag == 0) { + /* Reserve enough space to fit maximum frame length */ + skb = dev_alloc_skb(ieee->dev->mtu + + sizeof(struct ieee80211_hdr_4addr) + + 8 /* LLC */ + + 2 /* alignment */ + + 8 /* WEP */ + + ETH_ALEN /* WDS */ + + (IEEE80211_QOS_HAS_SEQ(fc)?2:0) /* QOS Control */); + if (skb == NULL) + return NULL; + + entry = &ieee->frag_cache[tid][ieee->frag_next_idx[tid]]; + ieee->frag_next_idx[tid]++; + if (ieee->frag_next_idx[tid] >= IEEE80211_FRAG_CACHE_LEN) + ieee->frag_next_idx[tid] = 0; + + if (entry->skb != NULL) + dev_kfree_skb_any(entry->skb); + + entry->first_frag_time = jiffies; + entry->seq = seq; + entry->last_frag = frag; + entry->skb = skb; + memcpy(entry->src_addr, hdr->addr2, ETH_ALEN); + memcpy(entry->dst_addr, hdr->addr1, ETH_ALEN); + } else { + /* received a fragment of a frame for which the head fragment + * should have already been received */ + entry = ieee80211_frag_cache_find(ieee, seq, frag, tid,hdr->addr2, + hdr->addr1); + if (entry != NULL) { + entry->last_frag = frag; + skb = entry->skb; + } + } + + return skb; +} + + +/* Called only as a tasklet (software IRQ) */ +static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee, + struct ieee80211_hdr_4addr *hdr) +{ + u16 fc = le16_to_cpu(hdr->frame_ctl); + u16 sc = le16_to_cpu(hdr->seq_ctl); + unsigned int seq = WLAN_GET_SEQ_SEQ(sc); + struct ieee80211_frag_entry *entry; + struct ieee80211_hdr_3addrqos *hdr_3addrqos; + struct ieee80211_hdr_4addrqos *hdr_4addrqos; + u8 tid; + + if(((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS)&&IEEE80211_QOS_HAS_SEQ(fc)) { + hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)hdr; + tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QCTL_TID; + tid = UP2AC(tid); + tid ++; + } else if (IEEE80211_QOS_HAS_SEQ(fc)) { + hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)hdr; + tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QCTL_TID; + tid = UP2AC(tid); + tid ++; + } else { + tid = 0; + } + + entry = ieee80211_frag_cache_find(ieee, seq, -1, tid,hdr->addr2, + hdr->addr1); + + if (entry == NULL) { + IEEE80211_DEBUG_FRAG( + "could not invalidate fragment cache " + "entry (seq=%u)\n", seq); + return -1; + } + + entry->skb = NULL; + return 0; +} + + + +/* ieee80211_rx_frame_mgtmt + * + * Responsible for handling management control frames + * + * Called by ieee80211_rx */ +static inline int +ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, + struct ieee80211_rx_stats *rx_stats, u16 type, + u16 stype) +{ + /* On the struct stats definition there is written that + * this is not mandatory.... but seems that the probe + * response parser uses it + */ + struct ieee80211_hdr_3addr * hdr = (struct ieee80211_hdr_3addr *)skb->data; + + rx_stats->len = skb->len; + ieee80211_rx_mgt(ieee,(struct ieee80211_hdr_4addr *)skb->data,rx_stats); + //if ((ieee->state == IEEE80211_LINKED) && (memcmp(hdr->addr3, ieee->current_network.bssid, ETH_ALEN))) + if ((memcmp(hdr->addr1, ieee->dev->dev_addr, ETH_ALEN)))//use ADDR1 to perform address matching for Management frames + { + dev_kfree_skb_any(skb); + return 0; + } + + ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype); + + dev_kfree_skb_any(skb); + + return 0; + + #ifdef NOT_YET + if (ieee->iw_mode == IW_MODE_MASTER) { + printk(KERN_DEBUG "%s: Master mode not yet suppported.\n", + ieee->dev->name); + return 0; +/* + hostap_update_sta_ps(ieee, (struct hostap_ieee80211_hdr_4addr *) + skb->data);*/ + } + + if (ieee->hostapd && type == IEEE80211_TYPE_MGMT) { + if (stype == WLAN_FC_STYPE_BEACON && + ieee->iw_mode == IW_MODE_MASTER) { + struct sk_buff *skb2; + /* Process beacon frames also in kernel driver to + * update STA(AP) table statistics */ + skb2 = skb_clone(skb, GFP_ATOMIC); + if (skb2) + hostap_rx(skb2->dev, skb2, rx_stats); + } + + /* send management frames to the user space daemon for + * processing */ + ieee->apdevstats.rx_packets++; + ieee->apdevstats.rx_bytes += skb->len; + prism2_rx_80211(ieee->apdev, skb, rx_stats, PRISM2_RX_MGMT); + return 0; + } + + if (ieee->iw_mode == IW_MODE_MASTER) { + if (type != WLAN_FC_TYPE_MGMT && type != WLAN_FC_TYPE_CTRL) { + printk(KERN_DEBUG "%s: unknown management frame " + "(type=0x%02x, stype=0x%02x) dropped\n", + skb->dev->name, type, stype); + return -1; + } + + hostap_rx(skb->dev, skb, rx_stats); + return 0; + } + + printk(KERN_DEBUG "%s: hostap_rx_frame_mgmt: management frame " + "received in non-Host AP mode\n", skb->dev->name); + return -1; + #endif +} + + + +/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ +/* Ethernet-II snap header (RFC1042 for most EtherTypes) */ +static unsigned char rfc1042_header[] = +{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; +/* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ +static unsigned char bridge_tunnel_header[] = +{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; +/* No encapsulation header if EtherType < 0x600 (=length) */ + +/* Called by ieee80211_rx_frame_decrypt */ +static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee, + struct sk_buff *skb, size_t hdrlen) +{ + struct net_device *dev = ieee->dev; + u16 fc, ethertype; + struct ieee80211_hdr_4addr *hdr; + u8 *pos; + + if (skb->len < 24) + return 0; + + hdr = (struct ieee80211_hdr_4addr *) skb->data; + fc = le16_to_cpu(hdr->frame_ctl); + + /* check that the frame is unicast frame to us */ + if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == + IEEE80211_FCTL_TODS && + memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0 && + memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) { + /* ToDS frame with own addr BSSID and DA */ + } else if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == + IEEE80211_FCTL_FROMDS && + memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) { + /* FromDS frame with own addr as DA */ + } else + return 0; + + if (skb->len < 24 + 8) + return 0; + + /* check for port access entity Ethernet type */ +// pos = skb->data + 24; + pos = skb->data + hdrlen; + ethertype = (pos[6] << 8) | pos[7]; + if (ethertype == ETH_P_PAE) + return 1; + + return 0; +} + +/* Called only as a tasklet (software IRQ), by ieee80211_rx */ +static inline int +ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb, + struct ieee80211_crypt_data *crypt) +{ + struct ieee80211_hdr_4addr *hdr; + int res, hdrlen; + + if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) + return 0; +#if 1 + if (ieee->hwsec_active) + { + cb_desc *tcb_desc = (cb_desc *)(skb->cb+ MAX_DEV_ADDR_SIZE); + tcb_desc->bHwSec = 1; + } +#endif + hdr = (struct ieee80211_hdr_4addr *) skb->data; + hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); + +#ifdef CONFIG_IEEE80211_CRYPT_TKIP + if (ieee->tkip_countermeasures && + strcmp(crypt->ops->name, "TKIP") == 0) { + if (net_ratelimit()) { + printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " + "received packet from " MAC_FMT "\n", + ieee->dev->name, MAC_ARG(hdr->addr2)); + } + return -1; + } +#endif + + atomic_inc(&crypt->refcnt); + res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); + atomic_dec(&crypt->refcnt); + if (res < 0) { + IEEE80211_DEBUG_DROP( + "decryption failed (SA=" MAC_FMT + ") res=%d\n", MAC_ARG(hdr->addr2), res); + if (res == -2) + IEEE80211_DEBUG_DROP("Decryption failed ICV " + "mismatch (key %d)\n", + skb->data[hdrlen + 3] >> 6); + ieee->ieee_stats.rx_discards_undecryptable++; + return -1; + } + + return res; +} + + +/* Called only as a tasklet (software IRQ), by ieee80211_rx */ +static inline int +ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb, + int keyidx, struct ieee80211_crypt_data *crypt) +{ + struct ieee80211_hdr_4addr *hdr; + int res, hdrlen; + + if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) + return 0; + if (ieee->hwsec_active) + { + cb_desc *tcb_desc = (cb_desc *)(skb->cb+ MAX_DEV_ADDR_SIZE); + tcb_desc->bHwSec = 1; + } + + hdr = (struct ieee80211_hdr_4addr *) skb->data; + hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); + + atomic_inc(&crypt->refcnt); + res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv); + atomic_dec(&crypt->refcnt); + if (res < 0) { + printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed" + " (SA=" MAC_FMT " keyidx=%d)\n", + ieee->dev->name, MAC_ARG(hdr->addr2), keyidx); + return -1; + } + + return 0; +} + + +/* this function is stolen from ipw2200 driver*/ +#define IEEE_PACKET_RETRY_TIME (5*HZ) +static int is_duplicate_packet(struct ieee80211_device *ieee, + struct ieee80211_hdr_4addr *header) +{ + u16 fc = le16_to_cpu(header->frame_ctl); + u16 sc = le16_to_cpu(header->seq_ctl); + u16 seq = WLAN_GET_SEQ_SEQ(sc); + u16 frag = WLAN_GET_SEQ_FRAG(sc); + u16 *last_seq, *last_frag; + unsigned long *last_time; + struct ieee80211_hdr_3addrqos *hdr_3addrqos; + struct ieee80211_hdr_4addrqos *hdr_4addrqos; + u8 tid; + + + //TO2DS and QoS + if(((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS)&&IEEE80211_QOS_HAS_SEQ(fc)) { + hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)header; + tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QCTL_TID; + tid = UP2AC(tid); + tid ++; + } else if(IEEE80211_QOS_HAS_SEQ(fc)) { //QoS + hdr_3addrqos = (struct ieee80211_hdr_3addrqos*)header; + tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QCTL_TID; + tid = UP2AC(tid); + tid ++; + } else { // no QoS + tid = 0; + } + + switch (ieee->iw_mode) { + case IW_MODE_ADHOC: + { + struct list_head *p; + struct ieee_ibss_seq *entry = NULL; + u8 *mac = header->addr2; + int index = mac[5] % IEEE_IBSS_MAC_HASH_SIZE; + //for (pos = (head)->next; pos != (head); pos = pos->next) + //__list_for_each(p, &ieee->ibss_mac_hash[index]) { + list_for_each(p, &ieee->ibss_mac_hash[index]) { + entry = list_entry(p, struct ieee_ibss_seq, list); + if (!memcmp(entry->mac, mac, ETH_ALEN)) + break; + } + // if (memcmp(entry->mac, mac, ETH_ALEN)){ + if (p == &ieee->ibss_mac_hash[index]) { + entry = kmalloc(sizeof(struct ieee_ibss_seq), GFP_ATOMIC); + if (!entry) { + printk(KERN_WARNING "Cannot malloc new mac entry\n"); + return 0; + } + memcpy(entry->mac, mac, ETH_ALEN); + entry->seq_num[tid] = seq; + entry->frag_num[tid] = frag; + entry->packet_time[tid] = jiffies; + list_add(&entry->list, &ieee->ibss_mac_hash[index]); + return 0; + } + last_seq = &entry->seq_num[tid]; + last_frag = &entry->frag_num[tid]; + last_time = &entry->packet_time[tid]; + break; + } + + case IW_MODE_INFRA: + last_seq = &ieee->last_rxseq_num[tid]; + last_frag = &ieee->last_rxfrag_num[tid]; + last_time = &ieee->last_packet_time[tid]; + + break; + default: + return 0; + } + +// if(tid != 0) { +// printk(KERN_WARNING ":)))))))))))%x %x %x, fc(%x)\n", tid, *last_seq, seq, header->frame_ctl); +// } + if ((*last_seq == seq) && + time_after(*last_time + IEEE_PACKET_RETRY_TIME, jiffies)) { + if (*last_frag == frag){ + //printk(KERN_WARNING "[1] go drop!\n"); + goto drop; + + } + if (*last_frag + 1 != frag) + /* out-of-order fragment */ + //printk(KERN_WARNING "[2] go drop!\n"); + goto drop; + } else + *last_seq = seq; + + *last_frag = frag; + *last_time = jiffies; + return 0; + +drop: +// BUG_ON(!(fc & IEEE80211_FCTL_RETRY)); +// printk("DUP\n"); + + return 1; +} +bool +AddReorderEntry( + PRX_TS_RECORD pTS, + PRX_REORDER_ENTRY pReorderEntry + ) +{ + struct list_head *pList = &pTS->RxPendingPktList; +#if 1 + while(pList->next != &pTS->RxPendingPktList) + { + if( SN_LESS(pReorderEntry->SeqNum, ((PRX_REORDER_ENTRY)list_entry(pList->next,RX_REORDER_ENTRY,List))->SeqNum) ) + { + pList = pList->next; + } + else if( SN_EQUAL(pReorderEntry->SeqNum, ((PRX_REORDER_ENTRY)list_entry(pList->next,RX_REORDER_ENTRY,List))->SeqNum) ) + { + return false; + } + else + { + break; + } + } +#endif + pReorderEntry->List.next = pList->next; + pReorderEntry->List.next->prev = &pReorderEntry->List; + pReorderEntry->List.prev = pList; + pList->next = &pReorderEntry->List; + + return true; +} + +void ieee80211_indicate_packets(struct ieee80211_device *ieee, struct ieee80211_rxb** prxbIndicateArray,u8 index) +{ + u8 i = 0 , j=0; + u16 ethertype; +// if(index > 1) +// IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): hahahahhhh, We indicate packet from reorder list, index is %u\n",__FUNCTION__,index); + for(j = 0; jnr_subframes; i++) { + struct sk_buff *sub_skb = prxb->subframes[i]; + + /* convert hdr + possible LLC headers into Ethernet header */ + ethertype = (sub_skb->data[6] << 8) | sub_skb->data[7]; + if (sub_skb->len >= 8 && + ((memcmp(sub_skb->data, rfc1042_header, SNAP_SIZE) == 0 && + ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || + memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) { + /* remove RFC1042 or Bridge-Tunnel encapsulation and + * replace EtherType */ + skb_pull(sub_skb, SNAP_SIZE); + memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN); + memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN); + } else { + u16 len; + /* Leave Ethernet header part of hdr and full payload */ + len = htons(sub_skb->len); + memcpy(skb_push(sub_skb, 2), &len, 2); + memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN); + memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN); + } + //stats->rx_packets++; + //stats->rx_bytes += sub_skb->len; + + /* Indicat the packets to upper layer */ + if (sub_skb) { + //printk("0skb_len(%d)\n", skb->len); + sub_skb->protocol = eth_type_trans(sub_skb, ieee->dev); + memset(sub_skb->cb, 0, sizeof(sub_skb->cb)); + sub_skb->dev = ieee->dev; + sub_skb->ip_summed = CHECKSUM_NONE; /* 802.11 crc not sufficient */ + //skb->ip_summed = CHECKSUM_UNNECESSARY; /* 802.11 crc not sufficient */ + ieee->last_rx_ps_time = jiffies; + //printk("1skb_len(%d)\n", skb->len); + netif_rx(sub_skb); + } + } + kfree(prxb); + prxb = NULL; + } +} + + +void RxReorderIndicatePacket( struct ieee80211_device *ieee, + struct ieee80211_rxb* prxb, + PRX_TS_RECORD pTS, + u16 SeqNum) +{ + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; + PRX_REORDER_ENTRY pReorderEntry = NULL; + struct ieee80211_rxb* prxbIndicateArray[REORDER_WIN_SIZE]; + u8 WinSize = pHTInfo->RxReorderWinSize; + u16 WinEnd = (pTS->RxIndicateSeq + WinSize -1)%4096; + u8 index = 0; + bool bMatchWinStart = false, bPktInBuf = false; + IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): Seq is %d,pTS->RxIndicateSeq is %d, WinSize is %d\n",__FUNCTION__,SeqNum,pTS->RxIndicateSeq,WinSize); +#if 0 + if(!list_empty(&ieee->RxReorder_Unused_List)) + IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): ieee->RxReorder_Unused_List is nut NULL\n"); +#endif + /* Rx Reorder initialize condition.*/ + if(pTS->RxIndicateSeq == 0xffff) { + pTS->RxIndicateSeq = SeqNum; + } + + /* Drop out the packet which SeqNum is smaller than WinStart */ + if(SN_LESS(SeqNum, pTS->RxIndicateSeq)) { + IEEE80211_DEBUG(IEEE80211_DL_REORDER,"Packet Drop! IndicateSeq: %d, NewSeq: %d\n", + pTS->RxIndicateSeq, SeqNum); + pHTInfo->RxReorderDropCounter++; + { + int i; + for(i =0; i < prxb->nr_subframes; i++) { + dev_kfree_skb(prxb->subframes[i]); + } + kfree(prxb); + prxb = NULL; + } + return; + } + + /* + * Sliding window manipulation. Conditions includes: + * 1. Incoming SeqNum is equal to WinStart =>Window shift 1 + * 2. Incoming SeqNum is larger than the WinEnd => Window shift N + */ + if(SN_EQUAL(SeqNum, pTS->RxIndicateSeq)) { + pTS->RxIndicateSeq = (pTS->RxIndicateSeq + 1) % 4096; + bMatchWinStart = true; + } else if(SN_LESS(WinEnd, SeqNum)) { + if(SeqNum >= (WinSize - 1)) { + pTS->RxIndicateSeq = SeqNum + 1 -WinSize; + } else { + pTS->RxIndicateSeq = 4095 - (WinSize - (SeqNum +1)) + 1; + } + IEEE80211_DEBUG(IEEE80211_DL_REORDER, "Window Shift! IndicateSeq: %d, NewSeq: %d\n",pTS->RxIndicateSeq, SeqNum); + } + + /* + * Indication process. + * After Packet dropping and Sliding Window shifting as above, we can now just indicate the packets + * with the SeqNum smaller than latest WinStart and buffer other packets. + */ + /* For Rx Reorder condition: + * 1. All packets with SeqNum smaller than WinStart => Indicate + * 2. All packets with SeqNum larger than or equal to WinStart => Buffer it. + */ + if(bMatchWinStart) { + /* Current packet is going to be indicated.*/ + IEEE80211_DEBUG(IEEE80211_DL_REORDER, "Packets indication!! IndicateSeq: %d, NewSeq: %d\n",\ + pTS->RxIndicateSeq, SeqNum); + prxbIndicateArray[0] = prxb; +// printk("========================>%s(): SeqNum is %d\n",__FUNCTION__,SeqNum); + index = 1; + } else { + /* Current packet is going to be inserted into pending list.*/ + //IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): We RX no ordered packed, insert to orderd list\n",__FUNCTION__); + if(!list_empty(&ieee->RxReorder_Unused_List)) { + pReorderEntry = (PRX_REORDER_ENTRY)list_entry(ieee->RxReorder_Unused_List.next,RX_REORDER_ENTRY,List); + list_del_init(&pReorderEntry->List); + + /* Make a reorder entry and insert into a the packet list.*/ + pReorderEntry->SeqNum = SeqNum; + pReorderEntry->prxb = prxb; + // IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): pREorderEntry->SeqNum is %d\n",__FUNCTION__,pReorderEntry->SeqNum); + +#if 1 + if(!AddReorderEntry(pTS, pReorderEntry)) { + IEEE80211_DEBUG(IEEE80211_DL_REORDER, "%s(): Duplicate packet is dropped!! IndicateSeq: %d, NewSeq: %d\n", + __FUNCTION__, pTS->RxIndicateSeq, SeqNum); + list_add_tail(&pReorderEntry->List,&ieee->RxReorder_Unused_List); + { + int i; + for(i =0; i < prxb->nr_subframes; i++) { + dev_kfree_skb(prxb->subframes[i]); + } + kfree(prxb); + prxb = NULL; + } + } else { + IEEE80211_DEBUG(IEEE80211_DL_REORDER, + "Pkt insert into buffer!! IndicateSeq: %d, NewSeq: %d\n",pTS->RxIndicateSeq, SeqNum); + } +#endif + } + else { + /* + * Packets are dropped if there is not enough reorder entries. + * This part shall be modified!! We can just indicate all the + * packets in buffer and get reorder entries. + */ + IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): There is no reorder entry!! Packet is dropped!!\n"); + { + int i; + for(i =0; i < prxb->nr_subframes; i++) { + dev_kfree_skb(prxb->subframes[i]); + } + kfree(prxb); + prxb = NULL; + } + } + } + + /* Check if there is any packet need indicate.*/ + while(!list_empty(&pTS->RxPendingPktList)) { + IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): start RREORDER indicate\n",__FUNCTION__); +#if 1 + pReorderEntry = (PRX_REORDER_ENTRY)list_entry(pTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List); + if( SN_LESS(pReorderEntry->SeqNum, pTS->RxIndicateSeq) || + SN_EQUAL(pReorderEntry->SeqNum, pTS->RxIndicateSeq)) + { + /* This protect buffer from overflow. */ + if(index >= REORDER_WIN_SIZE) { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): Buffer overflow!! \n"); + bPktInBuf = true; + break; + } + + list_del_init(&pReorderEntry->List); + + if(SN_EQUAL(pReorderEntry->SeqNum, pTS->RxIndicateSeq)) + pTS->RxIndicateSeq = (pTS->RxIndicateSeq + 1) % 4096; + + IEEE80211_DEBUG(IEEE80211_DL_REORDER,"Packets indication!! IndicateSeq: %d, NewSeq: %d\n",pTS->RxIndicateSeq, SeqNum); + prxbIndicateArray[index] = pReorderEntry->prxb; + // printk("========================>%s(): pReorderEntry->SeqNum is %d\n",__FUNCTION__,pReorderEntry->SeqNum); + index++; + + list_add_tail(&pReorderEntry->List,&ieee->RxReorder_Unused_List); + } else { + bPktInBuf = true; + break; + } +#endif + } + + /* Handling pending timer. Set this timer to prevent from long time Rx buffering.*/ + if(index>0) { + // Cancel previous pending timer. + // del_timer_sync(&pTS->RxPktPendingTimer); + pTS->RxTimeoutIndicateSeq = 0xffff; + + // Indicate packets + if(index>REORDER_WIN_SIZE){ + IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): Rx Reorer buffer full!! \n"); + return; + } + ieee80211_indicate_packets(ieee, prxbIndicateArray, index); + } + +#if 1 + if(bPktInBuf && pTS->RxTimeoutIndicateSeq==0xffff) { + // Set new pending timer. + IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): SET rx timeout timer\n", __FUNCTION__); + pTS->RxTimeoutIndicateSeq = pTS->RxIndicateSeq; + if(timer_pending(&pTS->RxPktPendingTimer)) + del_timer_sync(&pTS->RxPktPendingTimer); + pTS->RxPktPendingTimer.expires = jiffies + MSECS(pHTInfo->RxReorderPendingTime); + add_timer(&pTS->RxPktPendingTimer); + } +#endif +} + +u8 parse_subframe(struct sk_buff *skb, + struct ieee80211_rx_stats *rx_stats, + struct ieee80211_rxb *rxb,u8* src,u8* dst) +{ + struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr* )skb->data; + u16 fc = le16_to_cpu(hdr->frame_ctl); + + u16 LLCOffset= sizeof(struct ieee80211_hdr_3addr); + u16 ChkLength; + bool bIsAggregateFrame = false; + u16 nSubframe_Length; + u8 nPadding_Length = 0; + u16 SeqNum=0; + + struct sk_buff *sub_skb; + u8 *data_ptr; + /* just for debug purpose */ + SeqNum = WLAN_GET_SEQ_SEQ(le16_to_cpu(hdr->seq_ctl)); + + if((IEEE80211_QOS_HAS_SEQ(fc))&&\ + (((frameqos *)(skb->data + IEEE80211_3ADDR_LEN))->field.reserved)) { + bIsAggregateFrame = true; + } + + if(IEEE80211_QOS_HAS_SEQ(fc)) { + LLCOffset += 2; + } + + if(rx_stats->bContainHTC) { + LLCOffset += sHTCLng; + } + //printk("ChkLength = %d\n", LLCOffset); + // Null packet, don't indicate it to upper layer + ChkLength = LLCOffset;/* + (Frame_WEP(frame)!=0 ?Adapter->MgntInfo.SecurityInfo.EncryptionHeadOverhead:0);*/ + + if( skb->len <= ChkLength ) { + return 0; + } + + skb_pull(skb, LLCOffset); + + if(!bIsAggregateFrame) { + rxb->nr_subframes = 1; +#ifdef JOHN_NOCPY + rxb->subframes[0] = skb; +#else + rxb->subframes[0] = skb_copy(skb, GFP_ATOMIC); +#endif + + memcpy(rxb->src,src,ETH_ALEN); + memcpy(rxb->dst,dst,ETH_ALEN); + //IEEE80211_DEBUG_DATA(IEEE80211_DL_RX,skb->data,skb->len); + return 1; + } else { + rxb->nr_subframes = 0; + memcpy(rxb->src,src,ETH_ALEN); + memcpy(rxb->dst,dst,ETH_ALEN); + while(skb->len > ETHERNET_HEADER_SIZE) { + /* Offset 12 denote 2 mac address */ + nSubframe_Length = *((u16*)(skb->data + 12)); + //==m==>change the length order + nSubframe_Length = (nSubframe_Length>>8) + (nSubframe_Length<<8); + + if(skb->len<(ETHERNET_HEADER_SIZE + nSubframe_Length)) { +#if 0//cosa + RT_ASSERT( + (nRemain_Length>=(ETHERNET_HEADER_SIZE + nSubframe_Length)), + ("ParseSubframe(): A-MSDU subframe parse error!! Subframe Length: %d\n", nSubframe_Length) ); +#endif + printk("%s: A-MSDU parse error!! pRfd->nTotalSubframe : %d\n",\ + __FUNCTION__,rxb->nr_subframes); + printk("%s: A-MSDU parse error!! Subframe Length: %d\n",__FUNCTION__, nSubframe_Length); + printk("nRemain_Length is %d and nSubframe_Length is : %d\n",skb->len,nSubframe_Length); + printk("The Packet SeqNum is %d\n",SeqNum); + return 0; + } + + /* move the data point to data content */ + skb_pull(skb, ETHERNET_HEADER_SIZE); + +#ifdef JOHN_NOCPY + sub_skb = skb_clone(skb, GFP_ATOMIC); + sub_skb->len = nSubframe_Length; + sub_skb->tail = sub_skb->data + nSubframe_Length; +#else + /* Allocate new skb for releasing to upper layer */ + sub_skb = dev_alloc_skb(nSubframe_Length + 12); + skb_reserve(sub_skb, 12); + data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length); + memcpy(data_ptr,skb->data,nSubframe_Length); +#endif + rxb->subframes[rxb->nr_subframes++] = sub_skb; + if(rxb->nr_subframes >= MAX_SUBFRAME_COUNT) { + IEEE80211_DEBUG_RX("ParseSubframe(): Too many Subframes! Packets dropped!\n"); + break; + } + skb_pull(skb,nSubframe_Length); + + if(skb->len != 0) { + nPadding_Length = 4 - ((nSubframe_Length + ETHERNET_HEADER_SIZE) % 4); + if(nPadding_Length == 4) { + nPadding_Length = 0; + } + + if(skb->len < nPadding_Length) { + return 0; + } + + skb_pull(skb,nPadding_Length); + } + } +#ifdef JOHN_NOCPY + dev_kfree_skb(skb); +#endif + //{just for debug added by david + //printk("AMSDU::rxb->nr_subframes = %d\n",rxb->nr_subframes); + //} + return rxb->nr_subframes; + } +} + +/* All received frames are sent to this function. @skb contains the frame in + * IEEE 802.11 format, i.e., in the format it was sent over air. + * This function is called only as a tasklet (software IRQ). */ +int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, + struct ieee80211_rx_stats *rx_stats) +{ + struct net_device *dev = ieee->dev; + struct ieee80211_hdr_4addr *hdr; + //struct ieee80211_hdr_3addrqos *hdr; + + size_t hdrlen; + u16 fc, type, stype, sc; + struct net_device_stats *stats; + unsigned int frag; + u8 *payload; + u16 ethertype; + //added by amy for reorder + u8 TID = 0; + u16 SeqNum = 0; + PRX_TS_RECORD pTS = NULL; + //bool bIsAggregateFrame = false; + //added by amy for reorder +#ifdef NOT_YET + struct net_device *wds = NULL; + struct sk_buff *skb2 = NULL; + struct net_device *wds = NULL; + int frame_authorized = 0; + int from_assoc_ap = 0; + void *sta = NULL; +#endif +// u16 qos_ctl = 0; + u8 dst[ETH_ALEN]; + u8 src[ETH_ALEN]; + u8 bssid[ETH_ALEN]; + struct ieee80211_crypt_data *crypt = NULL; + int keyidx = 0; + + int i; + struct ieee80211_rxb* rxb = NULL; + // cheat the the hdr type + hdr = (struct ieee80211_hdr_4addr *)skb->data; + stats = &ieee->stats; + + if (skb->len < 10) { + printk(KERN_INFO "%s: SKB length < 10\n", + dev->name); + goto rx_dropped; + } + + fc = le16_to_cpu(hdr->frame_ctl); + type = WLAN_FC_GET_TYPE(fc); + stype = WLAN_FC_GET_STYPE(fc); + sc = le16_to_cpu(hdr->seq_ctl); + + frag = WLAN_GET_SEQ_FRAG(sc); + hdrlen = ieee80211_get_hdrlen(fc); + + if(HTCCheck(ieee, skb->data)) + { + if(net_ratelimit()) + printk("find HTCControl\n"); + hdrlen += 4; + rx_stats->bContainHTC = 1; + } + + //IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len); +#ifdef NOT_YET +#if WIRELESS_EXT > 15 + /* Put this code here so that we avoid duplicating it in all + * Rx paths. - Jean II */ +#ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */ + /* If spy monitoring on */ + if (iface->spy_data.spy_number > 0) { + struct iw_quality wstats; + wstats.level = rx_stats->rssi; + wstats.noise = rx_stats->noise; + wstats.updated = 6; /* No qual value */ + /* Update spy records */ + wireless_spy_update(dev, hdr->addr2, &wstats); + } +#endif /* IW_WIRELESS_SPY */ +#endif /* WIRELESS_EXT > 15 */ + hostap_update_rx_stats(local->ap, hdr, rx_stats); +#endif + +#if WIRELESS_EXT > 15 + if (ieee->iw_mode == IW_MODE_MONITOR) { + ieee80211_monitor_rx(ieee, skb, rx_stats); + stats->rx_packets++; + stats->rx_bytes += skb->len; + return 1; + } +#endif + if (ieee->host_decrypt) { + int idx = 0; + if (skb->len >= hdrlen + 3) + idx = skb->data[hdrlen + 3] >> 6; + crypt = ieee->crypt[idx]; +#ifdef NOT_YET + sta = NULL; + + /* Use station specific key to override default keys if the + * receiver address is a unicast address ("individual RA"). If + * bcrx_sta_key parameter is set, station specific key is used + * even with broad/multicast targets (this is against IEEE + * 802.11, but makes it easier to use different keys with + * stations that do not support WEP key mapping). */ + + if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key) + (void) hostap_handle_sta_crypto(local, hdr, &crypt, + &sta); +#endif + + /* allow NULL decrypt to indicate an station specific override + * for default encryption */ + if (crypt && (crypt->ops == NULL || + crypt->ops->decrypt_mpdu == NULL)) + crypt = NULL; + + if (!crypt && (fc & IEEE80211_FCTL_WEP)) { + /* This seems to be triggered by some (multicast?) + * frames from other than current BSS, so just drop the + * frames silently instead of filling system log with + * these reports. */ + IEEE80211_DEBUG_DROP("Decryption failed (not set)" + " (SA=" MAC_FMT ")\n", + MAC_ARG(hdr->addr2)); + ieee->ieee_stats.rx_discards_undecryptable++; + goto rx_dropped; + } + } + + if (skb->len < IEEE80211_DATA_HDR3_LEN) + goto rx_dropped; + + // if QoS enabled, should check the sequence for each of the AC + if( (ieee->pHTInfo->bCurRxReorderEnable == false) || !ieee->current_network.qos_data.active|| !IsDataFrame(skb->data) || IsLegacyDataFrame(skb->data)){ + if (is_duplicate_packet(ieee, hdr)) + goto rx_dropped; + + } + else + { + PRX_TS_RECORD pRxTS = NULL; + #if 0 + struct ieee80211_hdr_3addr *hdr; + u16 fc; + hdr = (struct ieee80211_hdr_3addr *)skb->data; + fc = le16_to_cpu(hdr->frame_ctl); + u8 tmp = (fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS); + + u8 tid = (*((u8*)skb->data + (((fc& IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))?30:24)))&0xf; + printk("====================>fc:%x, tid:%d, tmp:%d\n", fc, tid, tmp); + //u8 tid = (u8)((frameqos*)(buf + ((fc & IEEE80211_FCTL_TODS)&&(fc & IEEE80211_FCTL_FROMDS))? 30 : 24))->field.tid; + #endif + //IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): QOS ENABLE AND RECEIVE QOS DATA , we will get Ts, tid:%d\n",__FUNCTION__, tid); +#if 1 + if(GetTs( + ieee, + (PTS_COMMON_INFO*) &pRxTS, + hdr->addr2, + (u8)Frame_QoSTID((u8*)(skb->data)), + RX_DIR, + true)) + { + + // IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): pRxTS->RxLastFragNum is %d,frag is %d,pRxTS->RxLastSeqNum is %d,seq is %d\n",__FUNCTION__,pRxTS->RxLastFragNum,frag,pRxTS->RxLastSeqNum,WLAN_GET_SEQ_SEQ(sc)); + if( (fc & (1<<11)) && + (frag == pRxTS->RxLastFragNum) && + (WLAN_GET_SEQ_SEQ(sc) == pRxTS->RxLastSeqNum) ) + { + goto rx_dropped; + } + else + { + pRxTS->RxLastFragNum = frag; + pRxTS->RxLastSeqNum = WLAN_GET_SEQ_SEQ(sc); + } + } + else + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "%s(): No TS!! Skip the check!!\n",__FUNCTION__); + goto rx_dropped; + } + } +#endif + if (type == IEEE80211_FTYPE_MGMT) { + + #if 0 + if ( stype == IEEE80211_STYPE_AUTH && + fc & IEEE80211_FCTL_WEP && ieee->host_decrypt && + (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0) + { + printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " + "from " MAC_FMT "\n", dev->name, + MAC_ARG(hdr->addr2)); + /* TODO: could inform hostapd about this so that it + * could send auth failure report */ + goto rx_dropped; + } + #endif + + //IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len); + if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype)) + goto rx_dropped; + else + goto rx_exit; + } + + /* Data frame - extract src/dst addresses */ + switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { + case IEEE80211_FCTL_FROMDS: + memcpy(dst, hdr->addr1, ETH_ALEN); + memcpy(src, hdr->addr3, ETH_ALEN); + memcpy(bssid, hdr->addr2, ETH_ALEN); + break; + case IEEE80211_FCTL_TODS: + memcpy(dst, hdr->addr3, ETH_ALEN); + memcpy(src, hdr->addr2, ETH_ALEN); + memcpy(bssid, hdr->addr1, ETH_ALEN); + break; + case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS: + if (skb->len < IEEE80211_DATA_HDR4_LEN) + goto rx_dropped; + memcpy(dst, hdr->addr3, ETH_ALEN); + memcpy(src, hdr->addr4, ETH_ALEN); + memcpy(bssid, ieee->current_network.bssid, ETH_ALEN); + break; + case 0: + memcpy(dst, hdr->addr1, ETH_ALEN); + memcpy(src, hdr->addr2, ETH_ALEN); + memcpy(bssid, hdr->addr3, ETH_ALEN); + break; + } + +#ifdef NOT_YET + if (hostap_rx_frame_wds(ieee, hdr, fc, &wds)) + goto rx_dropped; + if (wds) { + skb->dev = dev = wds; + stats = hostap_get_stats(dev); + } + + if (ieee->iw_mode == IW_MODE_MASTER && !wds && + (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == IEEE80211_FCTL_FROMDS && + ieee->stadev && + memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) { + /* Frame from BSSID of the AP for which we are a client */ + skb->dev = dev = ieee->stadev; + stats = hostap_get_stats(dev); + from_assoc_ap = 1; + } +#endif + + dev->last_rx = jiffies; + +#ifdef NOT_YET + if ((ieee->iw_mode == IW_MODE_MASTER || + ieee->iw_mode == IW_MODE_REPEAT) && + !from_assoc_ap) { + switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats, + wds != NULL)) { + case AP_RX_CONTINUE_NOT_AUTHORIZED: + frame_authorized = 0; + break; + case AP_RX_CONTINUE: + frame_authorized = 1; + break; + case AP_RX_DROP: + goto rx_dropped; + case AP_RX_EXIT: + goto rx_exit; + } + } +#endif + //IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len); + /* Nullfunc frames may have PS-bit set, so they must be passed to + * hostap_handle_sta_rx() before being dropped here. */ + if (stype != IEEE80211_STYPE_DATA && + stype != IEEE80211_STYPE_DATA_CFACK && + stype != IEEE80211_STYPE_DATA_CFPOLL && + stype != IEEE80211_STYPE_DATA_CFACKPOLL&& + stype != IEEE80211_STYPE_QOS_DATA//add by David,2006.8.4 + ) { + if (stype != IEEE80211_STYPE_NULLFUNC) + IEEE80211_DEBUG_DROP( + "RX: dropped data frame " + "with no data (type=0x%02x, " + "subtype=0x%02x, len=%d)\n", + type, stype, skb->len); + goto rx_dropped; + } + if (memcmp(bssid, ieee->current_network.bssid, ETH_ALEN)) + goto rx_dropped; + + /* skb: hdr + (possibly fragmented, possibly encrypted) payload */ + + if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) && + (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0) + { + printk("decrypt frame error\n"); + goto rx_dropped; + } + + + hdr = (struct ieee80211_hdr_4addr *) skb->data; + + /* skb: hdr + (possibly fragmented) plaintext payload */ + // PR: FIXME: hostap has additional conditions in the "if" below: + // ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) && + if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) { + int flen; + struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr); + IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag); + + if (!frag_skb) { + IEEE80211_DEBUG(IEEE80211_DL_RX | IEEE80211_DL_FRAG, + "Rx cannot get skb from fragment " + "cache (morefrag=%d seq=%u frag=%u)\n", + (fc & IEEE80211_FCTL_MOREFRAGS) != 0, + WLAN_GET_SEQ_SEQ(sc), frag); + goto rx_dropped; + } + flen = skb->len; + if (frag != 0) + flen -= hdrlen; + + if (frag_skb->tail + flen > frag_skb->end) { + printk(KERN_WARNING "%s: host decrypted and " + "reassembled frame did not fit skb\n", + dev->name); + ieee80211_frag_cache_invalidate(ieee, hdr); + goto rx_dropped; + } + + if (frag == 0) { + /* copy first fragment (including full headers) into + * beginning of the fragment cache skb */ + memcpy(skb_put(frag_skb, flen), skb->data, flen); + } else { + /* append frame payload to the end of the fragment + * cache skb */ + memcpy(skb_put(frag_skb, flen), skb->data + hdrlen, + flen); + } + dev_kfree_skb_any(skb); + skb = NULL; + + if (fc & IEEE80211_FCTL_MOREFRAGS) { + /* more fragments expected - leave the skb in fragment + * cache for now; it will be delivered to upper layers + * after all fragments have been received */ + goto rx_exit; + } + + /* this was the last fragment and the frame will be + * delivered, so remove skb from fragment cache */ + skb = frag_skb; + hdr = (struct ieee80211_hdr_4addr *) skb->data; + ieee80211_frag_cache_invalidate(ieee, hdr); + } + + /* skb: hdr + (possible reassembled) full MSDU payload; possibly still + * encrypted/authenticated */ + if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) && + ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) + { + printk("==>decrypt msdu error\n"); + goto rx_dropped; + } + + //added by amy for AP roaming + ieee->LinkDetectInfo.NumRecvDataInPeriod++; + ieee->LinkDetectInfo.NumRxOkInPeriod++; + + hdr = (struct ieee80211_hdr_4addr *) skb->data; + if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) { + if (/*ieee->ieee802_1x &&*/ + ieee80211_is_eapol_frame(ieee, skb, hdrlen)) { + +#ifdef CONFIG_IEEE80211_DEBUG + /* pass unencrypted EAPOL frames even if encryption is + * configured */ + struct eapol *eap = (struct eapol *)(skb->data + + 24); + IEEE80211_DEBUG_EAP("RX: IEEE 802.1X EAPOL frame: %s\n", + eap_get_type(eap->type)); +#endif + } else { + IEEE80211_DEBUG_DROP( + "encryption configured, but RX " + "frame not encrypted (SA=" MAC_FMT ")\n", + MAC_ARG(hdr->addr2)); + goto rx_dropped; + } + } + +#ifdef CONFIG_IEEE80211_DEBUG + if (crypt && !(fc & IEEE80211_FCTL_WEP) && + ieee80211_is_eapol_frame(ieee, skb, hdrlen)) { + struct eapol *eap = (struct eapol *)(skb->data + + 24); + IEEE80211_DEBUG_EAP("RX: IEEE 802.1X EAPOL frame: %s\n", + eap_get_type(eap->type)); + } +#endif + + if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep && + !ieee80211_is_eapol_frame(ieee, skb, hdrlen)) { + IEEE80211_DEBUG_DROP( + "dropped unencrypted RX data " + "frame from " MAC_FMT + " (drop_unencrypted=1)\n", + MAC_ARG(hdr->addr2)); + goto rx_dropped; + } +/* + if(ieee80211_is_eapol_frame(ieee, skb, hdrlen)) { + printk(KERN_WARNING "RX: IEEE802.1X EPAOL frame!\n"); + } +*/ +//added by amy for reorder +#if 1 + if(ieee->current_network.qos_data.active && IsQoSDataFrame(skb->data) + && !is_multicast_ether_addr(hdr->addr1) && !is_broadcast_ether_addr(hdr->addr1)) + { + TID = Frame_QoSTID(skb->data); + SeqNum = WLAN_GET_SEQ_SEQ(sc); + GetTs(ieee,(PTS_COMMON_INFO*) &pTS,hdr->addr2,TID,RX_DIR,true); + if(TID !=0 && TID !=3) + { + ieee->bis_any_nonbepkts = true; + } + } +#endif +//added by amy for reorder + /* skb: hdr + (possible reassembled) full plaintext payload */ + payload = skb->data + hdrlen; + //ethertype = (payload[6] << 8) | payload[7]; + rxb = (struct ieee80211_rxb*)kmalloc(sizeof(struct ieee80211_rxb),GFP_ATOMIC); + if(rxb == NULL) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR,"%s(): kmalloc rxb error\n",__FUNCTION__); + goto rx_dropped; + } + /* to parse amsdu packets */ + /* qos data packets & reserved bit is 1 */ + if(parse_subframe(skb,rx_stats,rxb,src,dst) == 0) { + /* only to free rxb, and not submit the packets to upper layer */ + for(i =0; i < rxb->nr_subframes; i++) { + dev_kfree_skb(rxb->subframes[i]); + } + kfree(rxb); + rxb = NULL; + goto rx_dropped; + } + +//added by amy for reorder + if(ieee->pHTInfo->bCurRxReorderEnable == false ||pTS == NULL){ +//added by amy for reorder + for(i = 0; inr_subframes; i++) { + struct sk_buff *sub_skb = rxb->subframes[i]; + + if (sub_skb) { + /* convert hdr + possible LLC headers into Ethernet header */ + ethertype = (sub_skb->data[6] << 8) | sub_skb->data[7]; + if (sub_skb->len >= 8 && + ((memcmp(sub_skb->data, rfc1042_header, SNAP_SIZE) == 0 && + ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || + memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) { + /* remove RFC1042 or Bridge-Tunnel encapsulation and + * replace EtherType */ + skb_pull(sub_skb, SNAP_SIZE); + memcpy(skb_push(sub_skb, ETH_ALEN), src, ETH_ALEN); + memcpy(skb_push(sub_skb, ETH_ALEN), dst, ETH_ALEN); + } else { + u16 len; + /* Leave Ethernet header part of hdr and full payload */ + len = htons(sub_skb->len); + memcpy(skb_push(sub_skb, 2), &len, 2); + memcpy(skb_push(sub_skb, ETH_ALEN), src, ETH_ALEN); + memcpy(skb_push(sub_skb, ETH_ALEN), dst, ETH_ALEN); + } + + stats->rx_packets++; + stats->rx_bytes += sub_skb->len; + if(is_multicast_ether_addr(dst)) { + stats->multicast++; + } + + /* Indicat the packets to upper layer */ + //printk("0skb_len(%d)\n", skb->len); + sub_skb->protocol = eth_type_trans(sub_skb, dev); + memset(sub_skb->cb, 0, sizeof(sub_skb->cb)); + sub_skb->dev = dev; + sub_skb->ip_summed = CHECKSUM_NONE; /* 802.11 crc not sufficient */ + //skb->ip_summed = CHECKSUM_UNNECESSARY; /* 802.11 crc not sufficient */ + ieee->last_rx_ps_time = jiffies; + //printk("1skb_len(%d)\n", skb->len); + netif_rx(sub_skb); + } + } + kfree(rxb); + rxb = NULL; + + } + else + { + IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): REORDER ENABLE AND PTS not NULL, and we will enter RxReorderIndicatePacket()\n",__FUNCTION__); + RxReorderIndicatePacket(ieee, rxb, pTS, SeqNum); + } +#ifndef JOHN_NOCPY + dev_kfree_skb(skb); +#endif + + rx_exit: +#ifdef NOT_YET + if (sta) + hostap_handle_sta_release(sta); +#endif + return 1; + + rx_dropped: + if (rxb != NULL) + { + kfree(rxb); + rxb = NULL; + } + stats->rx_dropped++; + + /* Returning 0 indicates to caller that we have not handled the SKB-- + * so it is still allocated and can be used again by underlying + * hardware as a DMA target */ + return 0; +} + +#define MGMT_FRAME_FIXED_PART_LENGTH 0x24 + +static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 }; + +/* +* Make ther structure we read from the beacon packet has +* the right values +*/ +static int ieee80211_verify_qos_info(struct ieee80211_qos_information_element + *info_element, int sub_type) +{ + + if (info_element->qui_subtype != sub_type) + return -1; + if (memcmp(info_element->qui, qos_oui, QOS_OUI_LEN)) + return -1; + if (info_element->qui_type != QOS_OUI_TYPE) + return -1; + if (info_element->version != QOS_VERSION_1) + return -1; + + return 0; +} + + +/* + * Parse a QoS parameter element + */ +static int ieee80211_read_qos_param_element(struct ieee80211_qos_parameter_info + *element_param, struct ieee80211_info_element + *info_element) +{ + int ret = 0; + u16 size = sizeof(struct ieee80211_qos_parameter_info) - 2; + + if ((info_element == NULL) || (element_param == NULL)) + return -1; + + if (info_element->id == QOS_ELEMENT_ID && info_element->len == size) { + memcpy(element_param->info_element.qui, info_element->data, + info_element->len); + element_param->info_element.elementID = info_element->id; + element_param->info_element.length = info_element->len; + } else + ret = -1; + if (ret == 0) + ret = ieee80211_verify_qos_info(&element_param->info_element, + QOS_OUI_PARAM_SUB_TYPE); + return ret; +} + +/* + * Parse a QoS information element + */ +static int ieee80211_read_qos_info_element(struct + ieee80211_qos_information_element + *element_info, struct ieee80211_info_element + *info_element) +{ + int ret = 0; + u16 size = sizeof(struct ieee80211_qos_information_element) - 2; + + if (element_info == NULL) + return -1; + if (info_element == NULL) + return -1; + + if ((info_element->id == QOS_ELEMENT_ID) && (info_element->len == size)) { + memcpy(element_info->qui, info_element->data, + info_element->len); + element_info->elementID = info_element->id; + element_info->length = info_element->len; + } else + ret = -1; + + if (ret == 0) + ret = ieee80211_verify_qos_info(element_info, + QOS_OUI_INFO_SUB_TYPE); + return ret; +} + + +/* + * Write QoS parameters from the ac parameters. + */ +static int ieee80211_qos_convert_ac_to_parameters(struct + ieee80211_qos_parameter_info + *param_elm, struct + ieee80211_qos_parameters + *qos_param) +{ + int rc = 0; + int i; + struct ieee80211_qos_ac_parameter *ac_params; + u8 aci; + //u8 cw_min; + //u8 cw_max; + + for (i = 0; i < QOS_QUEUE_NUM; i++) { + ac_params = &(param_elm->ac_params_record[i]); + + aci = (ac_params->aci_aifsn & 0x60) >> 5; + + if(aci >= QOS_QUEUE_NUM) + continue; + qos_param->aifs[aci] = (ac_params->aci_aifsn) & 0x0f; + + /* WMM spec P.11: The minimum value for AIFSN shall be 2 */ + qos_param->aifs[aci] = (qos_param->aifs[aci] < 2) ? 2:qos_param->aifs[aci]; + + qos_param->cw_min[aci] = ac_params->ecw_min_max & 0x0F; + + qos_param->cw_max[aci] = (ac_params->ecw_min_max & 0xF0) >> 4; + + qos_param->flag[aci] = + (ac_params->aci_aifsn & 0x10) ? 0x01 : 0x00; + qos_param->tx_op_limit[aci] = le16_to_cpu(ac_params->tx_op_limit); + } + return rc; +} + +/* + * we have a generic data element which it may contain QoS information or + * parameters element. check the information element length to decide + * which type to read + */ +static int ieee80211_parse_qos_info_param_IE(struct ieee80211_info_element + *info_element, + struct ieee80211_network *network) +{ + int rc = 0; + struct ieee80211_qos_parameters *qos_param = NULL; + struct ieee80211_qos_information_element qos_info_element; + + rc = ieee80211_read_qos_info_element(&qos_info_element, info_element); + + if (rc == 0) { + network->qos_data.param_count = qos_info_element.ac_info & 0x0F; + network->flags |= NETWORK_HAS_QOS_INFORMATION; + } else { + struct ieee80211_qos_parameter_info param_element; + + rc = ieee80211_read_qos_param_element(¶m_element, + info_element); + if (rc == 0) { + qos_param = &(network->qos_data.parameters); + ieee80211_qos_convert_ac_to_parameters(¶m_element, + qos_param); + network->flags |= NETWORK_HAS_QOS_PARAMETERS; + network->qos_data.param_count = + param_element.info_element.ac_info & 0x0F; + } + } + + if (rc == 0) { + IEEE80211_DEBUG_QOS("QoS is supported\n"); + network->qos_data.supported = 1; + } + return rc; +} + +#ifdef CONFIG_IEEE80211_DEBUG +#define MFIE_STRING(x) case MFIE_TYPE_ ##x: return #x + +static const char *get_info_element_string(u16 id) +{ + switch (id) { + MFIE_STRING(SSID); + MFIE_STRING(RATES); + MFIE_STRING(FH_SET); + MFIE_STRING(DS_SET); + MFIE_STRING(CF_SET); + MFIE_STRING(TIM); + MFIE_STRING(IBSS_SET); + MFIE_STRING(COUNTRY); + MFIE_STRING(HOP_PARAMS); + MFIE_STRING(HOP_TABLE); + MFIE_STRING(REQUEST); + MFIE_STRING(CHALLENGE); + MFIE_STRING(POWER_CONSTRAINT); + MFIE_STRING(POWER_CAPABILITY); + MFIE_STRING(TPC_REQUEST); + MFIE_STRING(TPC_REPORT); + MFIE_STRING(SUPP_CHANNELS); + MFIE_STRING(CSA); + MFIE_STRING(MEASURE_REQUEST); + MFIE_STRING(MEASURE_REPORT); + MFIE_STRING(QUIET); + MFIE_STRING(IBSS_DFS); + // MFIE_STRING(ERP_INFO); + MFIE_STRING(RSN); + MFIE_STRING(RATES_EX); + MFIE_STRING(GENERIC); + MFIE_STRING(QOS_PARAMETER); + default: + return "UNKNOWN"; + } +} +#endif + +#ifdef ENABLE_DOT11D +static inline void ieee80211_extract_country_ie( + struct ieee80211_device *ieee, + struct ieee80211_info_element *info_element, + struct ieee80211_network *network, + u8 * addr2 +) +{ + if(IS_DOT11D_ENABLE(ieee)) + { + if(info_element->len!= 0) + { + memcpy(network->CountryIeBuf, info_element->data, info_element->len); + network->CountryIeLen = info_element->len; + + if(!IS_COUNTRY_IE_VALID(ieee)) + { + Dot11d_UpdateCountryIe(ieee, addr2, info_element->len, info_element->data); + } + } + + // + // 070305, rcnjko: I update country IE watch dog here because + // some AP (e.g. Cisco 1242) don't include country IE in their + // probe response frame. + // + if(IS_EQUAL_CIE_SRC(ieee, addr2) ) + { + UPDATE_CIE_WATCHDOG(ieee); + } + } + +} +#endif + +int ieee80211_parse_info_param(struct ieee80211_device *ieee, + struct ieee80211_info_element *info_element, + u16 length, + struct ieee80211_network *network, + struct ieee80211_rx_stats *stats) +{ + u8 i; + short offset; + u16 tmp_htcap_len=0; + u16 tmp_htinfo_len=0; + u16 ht_realtek_agg_len=0; + u8 ht_realtek_agg_buf[MAX_IE_LEN]; +// u16 broadcom_len = 0; +#ifdef CONFIG_IEEE80211_DEBUG + char rates_str[64]; + char *p; +#endif + + while (length >= sizeof(*info_element)) { + if (sizeof(*info_element) + info_element->len > length) { + IEEE80211_DEBUG_MGMT("Info elem: parse failed: " + "info_element->len + 2 > left : " + "info_element->len+2=%zd left=%d, id=%d.\n", + info_element->len + + sizeof(*info_element), + length, info_element->id); + /* We stop processing but don't return an error here + * because some misbehaviour APs break this rule. ie. + * Orinoco AP1000. */ + break; + } + + switch (info_element->id) { + case MFIE_TYPE_SSID: + if (ieee80211_is_empty_essid(info_element->data, + info_element->len)) { + network->flags |= NETWORK_EMPTY_ESSID; + break; + } + + network->ssid_len = min(info_element->len, + (u8) IW_ESSID_MAX_SIZE); + memcpy(network->ssid, info_element->data, network->ssid_len); + if (network->ssid_len < IW_ESSID_MAX_SIZE) + memset(network->ssid + network->ssid_len, 0, + IW_ESSID_MAX_SIZE - network->ssid_len); + + IEEE80211_DEBUG_MGMT("MFIE_TYPE_SSID: '%s' len=%d.\n", + network->ssid, network->ssid_len); + break; + + case MFIE_TYPE_RATES: +#ifdef CONFIG_IEEE80211_DEBUG + p = rates_str; +#endif + network->rates_len = min(info_element->len, + MAX_RATES_LENGTH); + for (i = 0; i < network->rates_len; i++) { + network->rates[i] = info_element->data[i]; +#ifdef CONFIG_IEEE80211_DEBUG + p += snprintf(p, sizeof(rates_str) - + (p - rates_str), "%02X ", + network->rates[i]); +#endif + if (ieee80211_is_ofdm_rate + (info_element->data[i])) { + network->flags |= NETWORK_HAS_OFDM; + if (info_element->data[i] & + IEEE80211_BASIC_RATE_MASK) + network->flags &= + ~NETWORK_HAS_CCK; + } + } + + IEEE80211_DEBUG_MGMT("MFIE_TYPE_RATES: '%s' (%d)\n", + rates_str, network->rates_len); + break; + + case MFIE_TYPE_RATES_EX: +#ifdef CONFIG_IEEE80211_DEBUG + p = rates_str; +#endif + network->rates_ex_len = min(info_element->len, + MAX_RATES_EX_LENGTH); + for (i = 0; i < network->rates_ex_len; i++) { + network->rates_ex[i] = info_element->data[i]; +#ifdef CONFIG_IEEE80211_DEBUG + p += snprintf(p, sizeof(rates_str) - + (p - rates_str), "%02X ", + network->rates[i]); +#endif + if (ieee80211_is_ofdm_rate + (info_element->data[i])) { + network->flags |= NETWORK_HAS_OFDM; + if (info_element->data[i] & + IEEE80211_BASIC_RATE_MASK) + network->flags &= + ~NETWORK_HAS_CCK; + } + } + + IEEE80211_DEBUG_MGMT("MFIE_TYPE_RATES_EX: '%s' (%d)\n", + rates_str, network->rates_ex_len); + break; + + case MFIE_TYPE_DS_SET: + IEEE80211_DEBUG_MGMT("MFIE_TYPE_DS_SET: %d\n", + info_element->data[0]); + network->channel = info_element->data[0]; + break; + + case MFIE_TYPE_FH_SET: + IEEE80211_DEBUG_MGMT("MFIE_TYPE_FH_SET: ignored\n"); + break; + + case MFIE_TYPE_CF_SET: + IEEE80211_DEBUG_MGMT("MFIE_TYPE_CF_SET: ignored\n"); + break; + + case MFIE_TYPE_TIM: + if(info_element->len < 4) + break; + + network->tim.tim_count = info_element->data[0]; + network->tim.tim_period = info_element->data[1]; + + network->dtim_period = info_element->data[1]; + if(ieee->state != IEEE80211_LINKED) + break; + + network->last_dtim_sta_time[0] = stats->mac_time[0]; + network->last_dtim_sta_time[1] = stats->mac_time[1]; + + network->dtim_data = IEEE80211_DTIM_VALID; + + if(info_element->data[0] != 0) + break; + + if(info_element->data[2] & 1) + network->dtim_data |= IEEE80211_DTIM_MBCAST; + + offset = (info_element->data[2] >> 1)*2; + + //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id); + + if(ieee->assoc_id < 8*offset || + ieee->assoc_id > 8*(offset + info_element->len -3)) + + break; + + offset = (ieee->assoc_id / 8) - offset;// + ((aid % 8)? 0 : 1) ; + + if(info_element->data[3+offset] & (1<<(ieee->assoc_id%8))) + network->dtim_data |= IEEE80211_DTIM_UCAST; + + //IEEE80211_DEBUG_MGMT("MFIE_TYPE_TIM: partially ignored\n"); + break; + + case MFIE_TYPE_ERP: + network->erp_value = info_element->data[0]; + network->flags |= NETWORK_HAS_ERP_VALUE; + IEEE80211_DEBUG_MGMT("MFIE_TYPE_ERP_SET: %d\n", + network->erp_value); + break; + case MFIE_TYPE_IBSS_SET: + network->atim_window = info_element->data[0]; + IEEE80211_DEBUG_MGMT("MFIE_TYPE_IBSS_SET: %d\n", + network->atim_window); + break; + + case MFIE_TYPE_CHALLENGE: + IEEE80211_DEBUG_MGMT("MFIE_TYPE_CHALLENGE: ignored\n"); + break; + + case MFIE_TYPE_GENERIC: + IEEE80211_DEBUG_MGMT("MFIE_TYPE_GENERIC: %d bytes\n", + info_element->len); + if (!ieee80211_parse_qos_info_param_IE(info_element, + network)) + break; + + if (info_element->len >= 4 && + info_element->data[0] == 0x00 && + info_element->data[1] == 0x50 && + info_element->data[2] == 0xf2 && + info_element->data[3] == 0x01) { + network->wpa_ie_len = min(info_element->len + 2, + MAX_WPA_IE_LEN); + memcpy(network->wpa_ie, info_element, + network->wpa_ie_len); + break; + } + +#ifdef THOMAS_TURBO + if (info_element->len == 7 && + info_element->data[0] == 0x00 && + info_element->data[1] == 0xe0 && + info_element->data[2] == 0x4c && + info_element->data[3] == 0x01 && + info_element->data[4] == 0x02) { + network->Turbo_Enable = 1; + } +#endif + + //for HTcap and HTinfo parameters + if(tmp_htcap_len == 0){ + if(info_element->len >= 4 && + info_element->data[0] == 0x00 && + info_element->data[1] == 0x90 && + info_element->data[2] == 0x4c && + info_element->data[3] == 0x033){ + + tmp_htcap_len = min(info_element->len,(u8)MAX_IE_LEN); + if(tmp_htcap_len != 0){ + network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC; + network->bssht.bdHTCapLen = tmp_htcap_len > sizeof(network->bssht.bdHTCapBuf)?\ + sizeof(network->bssht.bdHTCapBuf):tmp_htcap_len; + memcpy(network->bssht.bdHTCapBuf,info_element->data,network->bssht.bdHTCapLen); + } + } + if(tmp_htcap_len != 0) + network->bssht.bdSupportHT = true; + else + network->bssht.bdSupportHT = false; + } + + + if(tmp_htinfo_len == 0){ + if(info_element->len >= 4 && + info_element->data[0] == 0x00 && + info_element->data[1] == 0x90 && + info_element->data[2] == 0x4c && + info_element->data[3] == 0x034){ + + tmp_htinfo_len = min(info_element->len,(u8)MAX_IE_LEN); + if(tmp_htinfo_len != 0){ + network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC; + if(tmp_htinfo_len){ + network->bssht.bdHTInfoLen = tmp_htinfo_len > sizeof(network->bssht.bdHTInfoBuf)?\ + sizeof(network->bssht.bdHTInfoBuf):tmp_htinfo_len; + memcpy(network->bssht.bdHTInfoBuf,info_element->data,network->bssht.bdHTInfoLen); + } + + } + + } + } + + if(ieee->aggregation){ + if(network->bssht.bdSupportHT){ + if(info_element->len >= 4 && + info_element->data[0] == 0x00 && + info_element->data[1] == 0xe0 && + info_element->data[2] == 0x4c && + info_element->data[3] == 0x02){ + + ht_realtek_agg_len = min(info_element->len,(u8)MAX_IE_LEN); + memcpy(ht_realtek_agg_buf,info_element->data,info_element->len); + + } + if(ht_realtek_agg_len >= 5){ + network->bssht.bdRT2RTAggregation = true; + + if((ht_realtek_agg_buf[4] == 1) && (ht_realtek_agg_buf[5] & 0x02)) + network->bssht.bdRT2RTLongSlotTime = true; + } + } + + } + + //if(tmp_htcap_len !=0 || tmp_htinfo_len != 0) + { + if((info_element->len >= 3 && + info_element->data[0] == 0x00 && + info_element->data[1] == 0x05 && + info_element->data[2] == 0xb5) || + (info_element->len >= 3 && + info_element->data[0] == 0x00 && + info_element->data[1] == 0x0a && + info_element->data[2] == 0xf7) || + (info_element->len >= 3 && + info_element->data[0] == 0x00 && + info_element->data[1] == 0x10 && + info_element->data[2] == 0x18)){ + + network->broadcom_cap_exist = true; + + } + } +#if 0 + if (tmp_htcap_len !=0) + { + u16 cap_ext = ((PHT_CAPABILITY_ELE)&info_element->data[0])->ExtHTCapInfo; + if ((cap_ext & 0x0c00) == 0x0c00) + { + network->ralink_cap_exist = true; + } + } +#endif + if(info_element->len >= 3 && + info_element->data[0] == 0x00 && + info_element->data[1] == 0x0c && + info_element->data[2] == 0x43) + { + network->ralink_cap_exist = true; + } + else + network->ralink_cap_exist = false; + //added by amy for atheros AP + if((info_element->len >= 3 && + info_element->data[0] == 0x00 && + info_element->data[1] == 0x03 && + info_element->data[2] == 0x7f) || + (info_element->len >= 3 && + info_element->data[0] == 0x00 && + info_element->data[1] == 0x13 && + info_element->data[2] == 0x74)) + { + printk("========>%s(): athros AP is exist\n",__FUNCTION__); + network->atheros_cap_exist = true; + } + else + network->atheros_cap_exist = false; + + if(info_element->len >= 3 && + info_element->data[0] == 0x00 && + info_element->data[1] == 0x40 && + info_element->data[2] == 0x96) + { + network->cisco_cap_exist = true; + } + else + network->cisco_cap_exist = false; + //added by amy for LEAP of cisco + if(info_element->len > 4 && + info_element->data[0] == 0x00 && + info_element->data[1] == 0x40 && + info_element->data[2] == 0x96 && + info_element->data[3] == 0x01) + { + if(info_element->len == 6) + { + memcpy(network->CcxRmState, &info_element[4], 2); + if(network->CcxRmState[0] != 0) + { + network->bCcxRmEnable = true; + } + else + network->bCcxRmEnable = false; + // + // CCXv4 Table 59-1 MBSSID Masks. + // + network->MBssidMask = network->CcxRmState[1] & 0x07; + if(network->MBssidMask != 0) + { + network->bMBssidValid = true; + network->MBssidMask = 0xff << (network->MBssidMask); + cpMacAddr(network->MBssid, network->bssid); + network->MBssid[5] &= network->MBssidMask; + } + else + { + network->bMBssidValid = false; + } + } + else + { + network->bCcxRmEnable = false; + } + } + if(info_element->len > 4 && + info_element->data[0] == 0x00 && + info_element->data[1] == 0x40 && + info_element->data[2] == 0x96 && + info_element->data[3] == 0x03) + { + if(info_element->len == 5) + { + network->bWithCcxVerNum = true; + network->BssCcxVerNumber = info_element->data[4]; + } + else + { + network->bWithCcxVerNum = false; + network->BssCcxVerNumber = 0; + } + } + break; + + case MFIE_TYPE_RSN: + IEEE80211_DEBUG_MGMT("MFIE_TYPE_RSN: %d bytes\n", + info_element->len); + network->rsn_ie_len = min(info_element->len + 2, + MAX_WPA_IE_LEN); + memcpy(network->rsn_ie, info_element, + network->rsn_ie_len); + break; + + //HT related element. + case MFIE_TYPE_HT_CAP: + IEEE80211_DEBUG_SCAN("MFIE_TYPE_HT_CAP: %d bytes\n", + info_element->len); + tmp_htcap_len = min(info_element->len,(u8)MAX_IE_LEN); + if(tmp_htcap_len != 0){ + network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC; + network->bssht.bdHTCapLen = tmp_htcap_len > sizeof(network->bssht.bdHTCapBuf)?\ + sizeof(network->bssht.bdHTCapBuf):tmp_htcap_len; + memcpy(network->bssht.bdHTCapBuf,info_element->data,network->bssht.bdHTCapLen); + + //If peer is HT, but not WMM, call QosSetLegacyWMMParamWithHT() + // windows driver will update WMM parameters each beacon received once connected + // Linux driver is a bit different. + network->bssht.bdSupportHT = true; + } + else + network->bssht.bdSupportHT = false; + break; + + + case MFIE_TYPE_HT_INFO: + IEEE80211_DEBUG_SCAN("MFIE_TYPE_HT_INFO: %d bytes\n", + info_element->len); + tmp_htinfo_len = min(info_element->len,(u8)MAX_IE_LEN); + if(tmp_htinfo_len){ + network->bssht.bdHTSpecVer = HT_SPEC_VER_IEEE; + network->bssht.bdHTInfoLen = tmp_htinfo_len > sizeof(network->bssht.bdHTInfoBuf)?\ + sizeof(network->bssht.bdHTInfoBuf):tmp_htinfo_len; + memcpy(network->bssht.bdHTInfoBuf,info_element->data,network->bssht.bdHTInfoLen); + } + break; + + case MFIE_TYPE_AIRONET: + IEEE80211_DEBUG_SCAN("MFIE_TYPE_AIRONET: %d bytes\n", + info_element->len); + if(info_element->len >IE_CISCO_FLAG_POSITION) + { + network->bWithAironetIE = true; + + // CCX 1 spec v1.13, A01.1 CKIP Negotiation (page23): + // "A Cisco access point advertises support for CKIP in beacon and probe response packets, + // by adding an Aironet element and setting one or both of the CKIP negotiation bits." + if( (info_element->data[IE_CISCO_FLAG_POSITION]&SUPPORT_CKIP_MIC) || + (info_element->data[IE_CISCO_FLAG_POSITION]&SUPPORT_CKIP_PK) ) + { + network->bCkipSupported = true; + } + else + { + network->bCkipSupported = false; + } + } + else + { + network->bWithAironetIE = false; + network->bCkipSupported = false; + } + break; + case MFIE_TYPE_QOS_PARAMETER: + printk(KERN_ERR + "QoS Error need to parse QOS_PARAMETER IE\n"); + break; + +#ifdef ENABLE_DOT11D + case MFIE_TYPE_COUNTRY: + IEEE80211_DEBUG_SCAN("MFIE_TYPE_COUNTRY: %d bytes\n", + info_element->len); + //printk("=====>Receive <%s> Country IE\n",network->ssid); + ieee80211_extract_country_ie(ieee, info_element, network, network->bssid);//addr2 is same as addr3 when from an AP + break; +#endif +/* TODO */ +#if 0 + /* 802.11h */ + case MFIE_TYPE_POWER_CONSTRAINT: + network->power_constraint = info_element->data[0]; + network->flags |= NETWORK_HAS_POWER_CONSTRAINT; + break; + + case MFIE_TYPE_CSA: + network->power_constraint = info_element->data[0]; + network->flags |= NETWORK_HAS_CSA; + break; + + case MFIE_TYPE_QUIET: + network->quiet.count = info_element->data[0]; + network->quiet.period = info_element->data[1]; + network->quiet.duration = info_element->data[2]; + network->quiet.offset = info_element->data[3]; + network->flags |= NETWORK_HAS_QUIET; + break; + + case MFIE_TYPE_IBSS_DFS: + if (network->ibss_dfs) + break; + network->ibss_dfs = kmemdup(info_element->data, + info_element->len, + GFP_ATOMIC); + if (!network->ibss_dfs) + return 1; + network->flags |= NETWORK_HAS_IBSS_DFS; + break; + + case MFIE_TYPE_TPC_REPORT: + network->tpc_report.transmit_power = + info_element->data[0]; + network->tpc_report.link_margin = info_element->data[1]; + network->flags |= NETWORK_HAS_TPC_REPORT; + break; +#endif + default: + IEEE80211_DEBUG_MGMT + ("Unsupported info element: %s (%d)\n", + get_info_element_string(info_element->id), + info_element->id); + break; + } + + length -= sizeof(*info_element) + info_element->len; + info_element = + (struct ieee80211_info_element *)&info_element-> + data[info_element->len]; + } + + if(!network->atheros_cap_exist && !network->broadcom_cap_exist && + !network->cisco_cap_exist && !network->ralink_cap_exist && !network->bssht.bdRT2RTAggregation) + { + network->unknown_cap_exist = true; + } + else + { + network->unknown_cap_exist = false; + } + return 0; +} + +static inline u8 ieee80211_SignalStrengthTranslate( + u8 CurrSS + ) +{ + u8 RetSS; + + // Step 1. Scale mapping. + if(CurrSS >= 71 && CurrSS <= 100) + { + RetSS = 90 + ((CurrSS - 70) / 3); + } + else if(CurrSS >= 41 && CurrSS <= 70) + { + RetSS = 78 + ((CurrSS - 40) / 3); + } + else if(CurrSS >= 31 && CurrSS <= 40) + { + RetSS = 66 + (CurrSS - 30); + } + else if(CurrSS >= 21 && CurrSS <= 30) + { + RetSS = 54 + (CurrSS - 20); + } + else if(CurrSS >= 5 && CurrSS <= 20) + { + RetSS = 42 + (((CurrSS - 5) * 2) / 3); + } + else if(CurrSS == 4) + { + RetSS = 36; + } + else if(CurrSS == 3) + { + RetSS = 27; + } + else if(CurrSS == 2) + { + RetSS = 18; + } + else if(CurrSS == 1) + { + RetSS = 9; + } + else + { + RetSS = CurrSS; + } + //RT_TRACE(COMP_DBG, DBG_LOUD, ("##### After Mapping: LastSS: %d, CurrSS: %d, RetSS: %d\n", LastSS, CurrSS, RetSS)); + + // Step 2. Smoothing. + + //RT_TRACE(COMP_DBG, DBG_LOUD, ("$$$$$ After Smoothing: LastSS: %d, CurrSS: %d, RetSS: %d\n", LastSS, CurrSS, RetSS)); + + return RetSS; +} + +long ieee80211_translate_todbm(u8 signal_strength_index )// 0-100 index. +{ + long signal_power; // in dBm. + + // Translate to dBm (x=0.5y-95). + signal_power = (long)((signal_strength_index + 1) >> 1); + signal_power -= 95; + + return signal_power; +} + +static inline int ieee80211_network_init( + struct ieee80211_device *ieee, + struct ieee80211_probe_response *beacon, + struct ieee80211_network *network, + struct ieee80211_rx_stats *stats) +{ +#ifdef CONFIG_IEEE80211_DEBUG + //char rates_str[64]; + //char *p; +#endif + + network->qos_data.active = 0; + network->qos_data.supported = 0; + network->qos_data.param_count = 0; + network->qos_data.old_param_count = 0; + + /* Pull out fixed field data */ + memcpy(network->bssid, beacon->header.addr3, ETH_ALEN); + network->capability = le16_to_cpu(beacon->capability); + network->last_scanned = jiffies; + network->time_stamp[0] = le32_to_cpu(beacon->time_stamp[0]); + network->time_stamp[1] = le32_to_cpu(beacon->time_stamp[1]); + network->beacon_interval = le32_to_cpu(beacon->beacon_interval); + /* Where to pull this? beacon->listen_interval;*/ + network->listen_interval = 0x0A; + network->rates_len = network->rates_ex_len = 0; + network->last_associate = 0; + network->ssid_len = 0; + network->flags = 0; + network->atim_window = 0; + network->erp_value = (network->capability & WLAN_CAPABILITY_IBSS) ? + 0x3 : 0x0; + network->berp_info_valid = false; + network->broadcom_cap_exist = false; + network->ralink_cap_exist = false; + network->atheros_cap_exist = false; + network->cisco_cap_exist = false; + network->unknown_cap_exist = false; +#ifdef THOMAS_TURBO + network->Turbo_Enable = 0; +#endif +#ifdef ENABLE_DOT11D + network->CountryIeLen = 0; + memset(network->CountryIeBuf, 0, MAX_IE_LEN); +#endif +//Initialize HT parameters + //ieee80211_ht_initialize(&network->bssht); + HTInitializeBssDesc(&network->bssht); + if (stats->freq == IEEE80211_52GHZ_BAND) { + /* for A band (No DS info) */ + network->channel = stats->received_channel; + } else + network->flags |= NETWORK_HAS_CCK; + + network->wpa_ie_len = 0; + network->rsn_ie_len = 0; + + if (ieee80211_parse_info_param + (ieee,beacon->info_element, stats->len - sizeof(*beacon), network, stats)) + return 1; + + network->mode = 0; + if (stats->freq == IEEE80211_52GHZ_BAND) + network->mode = IEEE_A; + else { + if (network->flags & NETWORK_HAS_OFDM) + network->mode |= IEEE_G; + if (network->flags & NETWORK_HAS_CCK) + network->mode |= IEEE_B; + } + + if (network->mode == 0) { + IEEE80211_DEBUG_SCAN("Filtered out '%s (" MAC_FMT ")' " + "network.\n", + escape_essid(network->ssid, + network->ssid_len), + MAC_ARG(network->bssid)); + return 1; + } + + if(network->bssht.bdSupportHT){ + if(network->mode == IEEE_A) + network->mode = IEEE_N_5G; + else if(network->mode & (IEEE_G | IEEE_B)) + network->mode = IEEE_N_24G; + } + if (ieee80211_is_empty_essid(network->ssid, network->ssid_len)) + network->flags |= NETWORK_EMPTY_ESSID; + +#if 1 + stats->signal = 30 + (stats->SignalStrength * 70) / 100; + //stats->signal = ieee80211_SignalStrengthTranslate(stats->signal); + stats->noise = ieee80211_translate_todbm((u8)(100-stats->signal)) -25; +#endif + + memcpy(&network->stats, stats, sizeof(network->stats)); + + return 0; +} + +static inline int is_same_network(struct ieee80211_network *src, + struct ieee80211_network *dst, struct ieee80211_device* ieee) +{ + /* A network is only a duplicate if the channel, BSSID, ESSID + * and the capability field (in particular IBSS and BSS) all match. + * We treat all with the same BSSID and channel + * as one network */ + return //((src->ssid_len == dst->ssid_len) && + (((src->ssid_len == dst->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) && + (src->channel == dst->channel) && + !memcmp(src->bssid, dst->bssid, ETH_ALEN) && + //!memcmp(src->ssid, dst->ssid, src->ssid_len) && + (!memcmp(src->ssid, dst->ssid, src->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) && + ((src->capability & WLAN_CAPABILITY_IBSS) == + (dst->capability & WLAN_CAPABILITY_IBSS)) && + ((src->capability & WLAN_CAPABILITY_BSS) == + (dst->capability & WLAN_CAPABILITY_BSS))); +} + +static inline void update_network(struct ieee80211_network *dst, + struct ieee80211_network *src) +{ + int qos_active; + u8 old_param; + + memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats)); + dst->capability = src->capability; + memcpy(dst->rates, src->rates, src->rates_len); + dst->rates_len = src->rates_len; + memcpy(dst->rates_ex, src->rates_ex, src->rates_ex_len); + dst->rates_ex_len = src->rates_ex_len; + if(src->ssid_len > 0) + { + memset(dst->ssid, 0, dst->ssid_len); + dst->ssid_len = src->ssid_len; + memcpy(dst->ssid, src->ssid, src->ssid_len); + } + dst->mode = src->mode; + dst->flags = src->flags; + dst->time_stamp[0] = src->time_stamp[0]; + dst->time_stamp[1] = src->time_stamp[1]; + if (src->flags & NETWORK_HAS_ERP_VALUE) + { + dst->erp_value = src->erp_value; + dst->berp_info_valid = src->berp_info_valid = true; + } + dst->beacon_interval = src->beacon_interval; + dst->listen_interval = src->listen_interval; + dst->atim_window = src->atim_window; + dst->dtim_period = src->dtim_period; + dst->dtim_data = src->dtim_data; + dst->last_dtim_sta_time[0] = src->last_dtim_sta_time[0]; + dst->last_dtim_sta_time[1] = src->last_dtim_sta_time[1]; + memcpy(&dst->tim, &src->tim, sizeof(struct ieee80211_tim_parameters)); + + dst->bssht.bdSupportHT = src->bssht.bdSupportHT; + dst->bssht.bdRT2RTAggregation = src->bssht.bdRT2RTAggregation; + dst->bssht.bdHTCapLen= src->bssht.bdHTCapLen; + memcpy(dst->bssht.bdHTCapBuf,src->bssht.bdHTCapBuf,src->bssht.bdHTCapLen); + dst->bssht.bdHTInfoLen= src->bssht.bdHTInfoLen; + memcpy(dst->bssht.bdHTInfoBuf,src->bssht.bdHTInfoBuf,src->bssht.bdHTInfoLen); + dst->bssht.bdHTSpecVer = src->bssht.bdHTSpecVer; + dst->bssht.bdRT2RTLongSlotTime = src->bssht.bdRT2RTLongSlotTime; + dst->broadcom_cap_exist = src->broadcom_cap_exist; + dst->ralink_cap_exist = src->ralink_cap_exist; + dst->atheros_cap_exist = src->atheros_cap_exist; + dst->cisco_cap_exist = src->cisco_cap_exist; + dst->unknown_cap_exist = src->unknown_cap_exist; + memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len); + dst->wpa_ie_len = src->wpa_ie_len; + memcpy(dst->rsn_ie, src->rsn_ie, src->rsn_ie_len); + dst->rsn_ie_len = src->rsn_ie_len; + + dst->last_scanned = jiffies; + /* qos related parameters */ + //qos_active = src->qos_data.active; + qos_active = dst->qos_data.active; + //old_param = dst->qos_data.old_param_count; + old_param = dst->qos_data.param_count; + if(dst->flags & NETWORK_HAS_QOS_MASK) + memcpy(&dst->qos_data, &src->qos_data, + sizeof(struct ieee80211_qos_data)); + else { + dst->qos_data.supported = src->qos_data.supported; + dst->qos_data.param_count = src->qos_data.param_count; + } + + if(dst->qos_data.supported == 1) { + dst->QoS_Enable = 1; + if(dst->ssid_len) + IEEE80211_DEBUG_QOS + ("QoS the network %s is QoS supported\n", + dst->ssid); + else + IEEE80211_DEBUG_QOS + ("QoS the network is QoS supported\n"); + } + dst->qos_data.active = qos_active; + dst->qos_data.old_param_count = old_param; + + /* dst->last_associate is not overwritten */ +#if 1 + dst->wmm_info = src->wmm_info; //sure to exist in beacon or probe response frame. + if(src->wmm_param[0].ac_aci_acm_aifsn|| \ + src->wmm_param[1].ac_aci_acm_aifsn|| \ + src->wmm_param[2].ac_aci_acm_aifsn|| \ + src->wmm_param[1].ac_aci_acm_aifsn) { + memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN); + } + //dst->QoS_Enable = src->QoS_Enable; +#else + dst->QoS_Enable = 1;//for Rtl8187 simulation +#endif +#ifdef THOMAS_TURBO + dst->Turbo_Enable = src->Turbo_Enable; +#endif + +#ifdef ENABLE_DOT11D + dst->CountryIeLen = src->CountryIeLen; + memcpy(dst->CountryIeBuf, src->CountryIeBuf, src->CountryIeLen); +#endif + + //added by amy for LEAP + dst->bWithAironetIE = src->bWithAironetIE; + dst->bCkipSupported = src->bCkipSupported; + memcpy(dst->CcxRmState,src->CcxRmState,2); + dst->bCcxRmEnable = src->bCcxRmEnable; + dst->MBssidMask = src->MBssidMask; + dst->bMBssidValid = src->bMBssidValid; + memcpy(dst->MBssid,src->MBssid,6); + dst->bWithCcxVerNum = src->bWithCcxVerNum; + dst->BssCcxVerNumber = src->BssCcxVerNumber; + +} + +static inline int is_beacon(__le16 fc) +{ + return (WLAN_FC_GET_STYPE(le16_to_cpu(fc)) == IEEE80211_STYPE_BEACON); +} + +static inline void ieee80211_process_probe_response( + struct ieee80211_device *ieee, + struct ieee80211_probe_response *beacon, + struct ieee80211_rx_stats *stats) +{ + struct ieee80211_network network; + struct ieee80211_network *target; + struct ieee80211_network *oldest = NULL; +#ifdef CONFIG_IEEE80211_DEBUG + struct ieee80211_info_element *info_element = &beacon->info_element[0]; +#endif + unsigned long flags; + short renew; + //u8 wmm_info; + + memset(&network, 0, sizeof(struct ieee80211_network)); + IEEE80211_DEBUG_SCAN( + "'%s' (" MAC_FMT "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", + escape_essid(info_element->data, info_element->len), + MAC_ARG(beacon->header.addr3), + (beacon->capability & (1<<0xf)) ? '1' : '0', + (beacon->capability & (1<<0xe)) ? '1' : '0', + (beacon->capability & (1<<0xd)) ? '1' : '0', + (beacon->capability & (1<<0xc)) ? '1' : '0', + (beacon->capability & (1<<0xb)) ? '1' : '0', + (beacon->capability & (1<<0xa)) ? '1' : '0', + (beacon->capability & (1<<0x9)) ? '1' : '0', + (beacon->capability & (1<<0x8)) ? '1' : '0', + (beacon->capability & (1<<0x7)) ? '1' : '0', + (beacon->capability & (1<<0x6)) ? '1' : '0', + (beacon->capability & (1<<0x5)) ? '1' : '0', + (beacon->capability & (1<<0x4)) ? '1' : '0', + (beacon->capability & (1<<0x3)) ? '1' : '0', + (beacon->capability & (1<<0x2)) ? '1' : '0', + (beacon->capability & (1<<0x1)) ? '1' : '0', + (beacon->capability & (1<<0x0)) ? '1' : '0'); + + if (ieee80211_network_init(ieee, beacon, &network, stats)) { + IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n", + escape_essid(info_element->data, + info_element->len), + MAC_ARG(beacon->header.addr3), + WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == + IEEE80211_STYPE_PROBE_RESP ? + "PROBE RESPONSE" : "BEACON"); + return; + } + +#ifdef ENABLE_DOT11D + // For Asus EeePc request, + // (1) if wireless adapter receive get any 802.11d country code in AP beacon, + // wireless adapter should follow the country code. + // (2) If there is no any country code in beacon, + // then wireless adapter should do active scan from ch1~11 and + // passive scan from ch12~14 + + if( !IsLegalChannel(ieee, network.channel) ) + return; + if(ieee->bGlobalDomain) + { + if (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_PROBE_RESP) + { + // Case 1: Country code + if(IS_COUNTRY_IE_VALID(ieee) ) + { + if( !IsLegalChannel(ieee, network.channel) ) + { + printk("GetScanInfo(): For Country code, filter probe response at channel(%d).\n", network.channel); + return; + } + } + // Case 2: No any country code. + else + { + // Filter over channel ch12~14 + if(network.channel > 11) + { + printk("GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n", network.channel); + return; + } + } + } + else + { + // Case 1: Country code + if(IS_COUNTRY_IE_VALID(ieee) ) + { + if( !IsLegalChannel(ieee, network.channel) ) + { + printk("GetScanInfo(): For Country code, filter beacon at channel(%d).\n",network.channel); + return; + } + } + // Case 2: No any country code. + else + { + // Filter over channel ch12~14 + if(network.channel > 14) + { + printk("GetScanInfo(): For Global Domain, filter beacon at channel(%d).\n",network.channel); + return; + } + } + } + } +#endif + + /* The network parsed correctly -- so now we scan our known networks + * to see if we can find it in our list. + * + * NOTE: This search is definitely not optimized. Once its doing + * the "right thing" we'll optimize it for efficiency if + * necessary */ + + /* Search for this entry in the list and update it if it is + * already there. */ + + spin_lock_irqsave(&ieee->lock, flags); + + if(is_same_network(&ieee->current_network, &network, ieee)) { + update_network(&ieee->current_network, &network); + if((ieee->current_network.mode == IEEE_N_24G || ieee->current_network.mode == IEEE_G) + && ieee->current_network.berp_info_valid){ + if(ieee->current_network.erp_value& ERP_UseProtection) + ieee->current_network.buseprotection = true; + else + ieee->current_network.buseprotection = false; + } + if(is_beacon(beacon->header.frame_ctl)) + { + if(ieee->state == IEEE80211_LINKED) + ieee->LinkDetectInfo.NumRecvBcnInPeriod++; + } + else //hidden AP + network.flags = (~NETWORK_EMPTY_ESSID & network.flags)|(NETWORK_EMPTY_ESSID & ieee->current_network.flags); + } + + list_for_each_entry(target, &ieee->network_list, list) { + if (is_same_network(target, &network, ieee)) + break; + if ((oldest == NULL) || + (target->last_scanned < oldest->last_scanned)) + oldest = target; + } + + /* If we didn't find a match, then get a new network slot to initialize + * with this beacon's information */ + if (&target->list == &ieee->network_list) { + if (list_empty(&ieee->network_free_list)) { + /* If there are no more slots, expire the oldest */ + list_del(&oldest->list); + target = oldest; + IEEE80211_DEBUG_SCAN("Expired '%s' (" MAC_FMT ") from " + "network list.\n", + escape_essid(target->ssid, + target->ssid_len), + MAC_ARG(target->bssid)); + } else { + /* Otherwise just pull from the free list */ + target = list_entry(ieee->network_free_list.next, + struct ieee80211_network, list); + list_del(ieee->network_free_list.next); + } + + +#ifdef CONFIG_IEEE80211_DEBUG + IEEE80211_DEBUG_SCAN("Adding '%s' (" MAC_FMT ") via %s.\n", + escape_essid(network.ssid, + network.ssid_len), + MAC_ARG(network.bssid), + WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == + IEEE80211_STYPE_PROBE_RESP ? + "PROBE RESPONSE" : "BEACON"); +#endif + memcpy(target, &network, sizeof(*target)); + list_add_tail(&target->list, &ieee->network_list); + if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) + ieee80211_softmac_new_net(ieee,&network); + } else { + IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n", + escape_essid(target->ssid, + target->ssid_len), + MAC_ARG(target->bssid), + WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == + IEEE80211_STYPE_PROBE_RESP ? + "PROBE RESPONSE" : "BEACON"); + + /* we have an entry and we are going to update it. But this entry may + * be already expired. In this case we do the same as we found a new + * net and call the new_net handler + */ + renew = !time_after(target->last_scanned + ieee->scan_age, jiffies); + //YJ,add,080819,for hidden ap + if(is_beacon(beacon->header.frame_ctl) == 0) + network.flags = (~NETWORK_EMPTY_ESSID & network.flags)|(NETWORK_EMPTY_ESSID & target->flags); + //if(strncmp(network.ssid, "linksys-c",9) == 0) + // printk("====>2 network.ssid=%s FLAG=%d target.ssid=%s FLAG=%d\n", network.ssid, network.flags, target->ssid, target->flags); + if(((network.flags & NETWORK_EMPTY_ESSID) == NETWORK_EMPTY_ESSID) \ + && (((network.ssid_len > 0) && (strncmp(target->ssid, network.ssid, network.ssid_len)))\ + ||((ieee->current_network.ssid_len == network.ssid_len)&&(strncmp(ieee->current_network.ssid, network.ssid, network.ssid_len) == 0)&&(ieee->state == IEEE80211_NOLINK)))) + renew = 1; + //YJ,add,080819,for hidden ap,end + + update_network(target, &network); + if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)) + ieee80211_softmac_new_net(ieee,&network); + } + + spin_unlock_irqrestore(&ieee->lock, flags); + if (is_beacon(beacon->header.frame_ctl)&&is_same_network(&ieee->current_network, &network, ieee)&&\ + (ieee->state == IEEE80211_LINKED)) { + if(ieee->handle_beacon != NULL) { + ieee->handle_beacon(ieee->dev,beacon,&ieee->current_network); + } + } +} + +void ieee80211_rx_mgt(struct ieee80211_device *ieee, + struct ieee80211_hdr_4addr *header, + struct ieee80211_rx_stats *stats) +{ + switch (WLAN_FC_GET_STYPE(header->frame_ctl)) { + + case IEEE80211_STYPE_BEACON: + IEEE80211_DEBUG_MGMT("received BEACON (%d)\n", + WLAN_FC_GET_STYPE(header->frame_ctl)); + IEEE80211_DEBUG_SCAN("Beacon\n"); + ieee80211_process_probe_response( + ieee, (struct ieee80211_probe_response *)header, stats); + break; + + case IEEE80211_STYPE_PROBE_RESP: + IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n", + WLAN_FC_GET_STYPE(header->frame_ctl)); + IEEE80211_DEBUG_SCAN("Probe response\n"); + ieee80211_process_probe_response( + ieee, (struct ieee80211_probe_response *)header, stats); + break; + + } +} + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) +EXPORT_SYMBOL(ieee80211_rx_mgt); +EXPORT_SYMBOL(ieee80211_rx); +#else +EXPORT_SYMBOL_NOVERS(ieee80211_rx_mgt); +EXPORT_SYMBOL_NOVERS(ieee80211_rx); +#endif diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c new file mode 100644 index 000000000000..7792aa808c6c --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -0,0 +1,3529 @@ +/* IEEE 802.11 SoftMAC layer + * Copyright (c) 2005 Andrea Merello + * + * Mostly extracted from the rtl8180-sa2400 driver for the + * in-kernel generic ieee802.11 stack. + * + * Few lines might be stolen from other part of the ieee80211 + * stack. Copyright who own it's copyright + * + * WPA code stolen from the ipw2200 driver. + * Copyright who own it's copyright. + * + * released under the GPL + */ + + +#include "ieee80211.h" + +#include +#include +#include +#include +#ifdef ENABLE_DOT11D +#include "dot11d.h" +#endif + +u8 rsn_authen_cipher_suite[16][4] = { + {0x00,0x0F,0xAC,0x00}, //Use group key, //Reserved + {0x00,0x0F,0xAC,0x01}, //WEP-40 //RSNA default + {0x00,0x0F,0xAC,0x02}, //TKIP //NONE //{used just as default} + {0x00,0x0F,0xAC,0x03}, //WRAP-historical + {0x00,0x0F,0xAC,0x04}, //CCMP + {0x00,0x0F,0xAC,0x05}, //WEP-104 +}; + +short ieee80211_is_54g(struct ieee80211_network net) +{ + return ((net.rates_ex_len > 0) || (net.rates_len > 4)); +} + +short ieee80211_is_shortslot(struct ieee80211_network net) +{ + return (net.capability & WLAN_CAPABILITY_SHORT_SLOT); +} + +/* returns the total length needed for pleacing the RATE MFIE + * tag and the EXTENDED RATE MFIE tag if needed. + * It encludes two bytes per tag for the tag itself and its len + */ +unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee) +{ + unsigned int rate_len = 0; + + if (ieee->modulation & IEEE80211_CCK_MODULATION) + rate_len = IEEE80211_CCK_RATE_LEN + 2; + + if (ieee->modulation & IEEE80211_OFDM_MODULATION) + + rate_len += IEEE80211_OFDM_RATE_LEN + 2; + + return rate_len; +} + +/* pleace the MFIE rate, tag to the memory (double) poined. + * Then it updates the pointer so that + * it points after the new MFIE tag added. + */ +void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p) +{ + u8 *tag = *tag_p; + + if (ieee->modulation & IEEE80211_CCK_MODULATION){ + *tag++ = MFIE_TYPE_RATES; + *tag++ = 4; + *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB; + *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB; + *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB; + *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB; + } + + /* We may add an option for custom rates that specific HW might support */ + *tag_p = tag; +} + +void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p) +{ + u8 *tag = *tag_p; + + if (ieee->modulation & IEEE80211_OFDM_MODULATION){ + + *tag++ = MFIE_TYPE_RATES_EX; + *tag++ = 8; + *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB; + *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB; + *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB; + *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_18MB; + *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_24MB; + *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB; + *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB; + *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB; + + } + + /* We may add an option for custom rates that specific HW might support */ + *tag_p = tag; +} + + +void ieee80211_WMM_Info(struct ieee80211_device *ieee, u8 **tag_p) { + u8 *tag = *tag_p; + + *tag++ = MFIE_TYPE_GENERIC; //0 + *tag++ = 7; + *tag++ = 0x00; + *tag++ = 0x50; + *tag++ = 0xf2; + *tag++ = 0x02;//5 + *tag++ = 0x00; + *tag++ = 0x01; +#ifdef SUPPORT_USPD + if(ieee->current_network.wmm_info & 0x80) { + *tag++ = 0x0f|MAX_SP_Len; + } else { + *tag++ = MAX_SP_Len; + } +#else + *tag++ = MAX_SP_Len; +#endif + *tag_p = tag; +} + +#ifdef THOMAS_TURBO +void ieee80211_TURBO_Info(struct ieee80211_device *ieee, u8 **tag_p) { + u8 *tag = *tag_p; + + *tag++ = MFIE_TYPE_GENERIC; //0 + *tag++ = 7; + *tag++ = 0x00; + *tag++ = 0xe0; + *tag++ = 0x4c; + *tag++ = 0x01;//5 + *tag++ = 0x02; + *tag++ = 0x11; + *tag++ = 0x00; + + *tag_p = tag; + printk(KERN_ALERT "This is enable turbo mode IE process\n"); +} +#endif + +void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb) +{ + int nh; + nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM; + +/* + * if the queue is full but we have newer frames then + * just overwrites the oldest. + * + * if (nh == ieee->mgmt_queue_tail) + * return -1; + */ + ieee->mgmt_queue_head = nh; + ieee->mgmt_queue_ring[nh] = skb; + + //return 0; +} + +struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee) +{ + struct sk_buff *ret; + + if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head) + return NULL; + + ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail]; + + ieee->mgmt_queue_tail = + (ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM; + + return ret; +} + +void init_mgmt_queue(struct ieee80211_device *ieee) +{ + ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0; +} + +u8 MgntQuery_MgntFrameTxRate(struct ieee80211_device *ieee) +{ + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; + u8 rate; + + // 2008/01/25 MH For broadcom, MGNT frame set as OFDM 6M. + if(pHTInfo->IOTAction & HT_IOT_ACT_MGNT_USE_CCK_6M) + rate = 0x0c; + else + rate = ieee->basic_rate & 0x7f; + + if(rate == 0){ + // 2005.01.26, by rcnjko. + if(ieee->mode == IEEE_A|| + ieee->mode== IEEE_N_5G|| + (ieee->mode== IEEE_N_24G&&!pHTInfo->bCurSuppCCK)) + rate = 0x0c; + else + rate = 0x02; + } + + /* + // Data rate of ProbeReq is already decided. Annie, 2005-03-31 + if( pMgntInfo->bScanInProgress || (pMgntInfo->bDualModeScanStep!=0) ) + { + if(pMgntInfo->dot11CurrentWirelessMode==WIRELESS_MODE_A) + rate = 0x0c; + else + rate = 0x02; + } + */ + return rate; +} + + +void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl); + +inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee) +{ + unsigned long flags; + short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE; + struct ieee80211_hdr_3addr *header= + (struct ieee80211_hdr_3addr *) skb->data; + + cb_desc *tcb_desc = (cb_desc *)(skb->cb + 8); + spin_lock_irqsave(&ieee->lock, flags); + + /* called with 2nd param 0, no mgmt lock required */ + ieee80211_sta_wakeup(ieee,0); + + tcb_desc->queue_index = MGNT_QUEUE; + tcb_desc->data_rate = MgntQuery_MgntFrameTxRate(ieee); + tcb_desc->RATRIndex = 7; + tcb_desc->bTxDisableRateFallBack = 1; + tcb_desc->bTxUseDriverAssingedRate = 1; + + if(single){ + if(ieee->queue_stop){ + enqueue_mgmt(ieee,skb); + }else{ + header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0]<<4); + + if (ieee->seq_ctrl[0] == 0xFFF) + ieee->seq_ctrl[0] = 0; + else + ieee->seq_ctrl[0]++; + + /* avoid watchdog triggers */ + ieee->dev->trans_start = jiffies; + ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate); + //dev_kfree_skb_any(skb);//edit by thomas + } + + spin_unlock_irqrestore(&ieee->lock, flags); + }else{ + spin_unlock_irqrestore(&ieee->lock, flags); + spin_lock_irqsave(&ieee->mgmt_tx_lock, flags); + + header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4); + + if (ieee->seq_ctrl[0] == 0xFFF) + ieee->seq_ctrl[0] = 0; + else + ieee->seq_ctrl[0]++; + + /* check wether the managed packet queued greater than 5 */ + if(!ieee->check_nic_enough_desc(ieee->dev,tcb_desc->queue_index)||\ + (skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) != 0)||\ + (ieee->queue_stop) ) { + /* insert the skb packet to the management queue */ + /* as for the completion function, it does not need + * to check it any more. + * */ + printk("%s():insert to waitqueue!\n",__FUNCTION__); + skb_queue_tail(&ieee->skb_waitQ[tcb_desc->queue_index], skb); + } else { + //printk("TX packet!\n"); + ieee->softmac_hard_start_xmit(skb,ieee->dev); + //dev_kfree_skb_any(skb);//edit by thomas + } + spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags); + } +} + +inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee) +{ + + short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE; + struct ieee80211_hdr_3addr *header = + (struct ieee80211_hdr_3addr *) skb->data; + + + if(single){ + + header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4); + + if (ieee->seq_ctrl[0] == 0xFFF) + ieee->seq_ctrl[0] = 0; + else + ieee->seq_ctrl[0]++; + + /* avoid watchdog triggers */ + ieee->dev->trans_start = jiffies; + ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate); + + }else{ + + header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4); + + if (ieee->seq_ctrl[0] == 0xFFF) + ieee->seq_ctrl[0] = 0; + else + ieee->seq_ctrl[0]++; + + ieee->softmac_hard_start_xmit(skb,ieee->dev); + + } + //dev_kfree_skb_any(skb);//edit by thomas +} + +inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee) +{ + unsigned int len,rate_len; + u8 *tag; + struct sk_buff *skb; + struct ieee80211_probe_request *req; + + len = ieee->current_network.ssid_len; + + rate_len = ieee80211_MFIE_rate_len(ieee); + + skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) + + 2 + len + rate_len + ieee->tx_headroom); + if (!skb) + return NULL; + + skb_reserve(skb, ieee->tx_headroom); + + req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request)); + req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); + req->header.duration_id = 0; //FIXME: is this OK ? + + memset(req->header.addr1, 0xff, ETH_ALEN); + memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN); + memset(req->header.addr3, 0xff, ETH_ALEN); + + tag = (u8 *) skb_put(skb,len+2+rate_len); + + *tag++ = MFIE_TYPE_SSID; + *tag++ = len; + memcpy(tag, ieee->current_network.ssid, len); + tag += len; + + ieee80211_MFIE_Brate(ieee,&tag); + ieee80211_MFIE_Grate(ieee,&tag); + return skb; +} + +struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee); +void ieee80211_send_beacon(struct ieee80211_device *ieee) +{ + struct sk_buff *skb; + if(!ieee->ieee_up) + return; + //unsigned long flags; + skb = ieee80211_get_beacon_(ieee); + + if (skb){ + softmac_mgmt_xmit(skb, ieee); + ieee->softmac_stats.tx_beacons++; + //dev_kfree_skb_any(skb);//edit by thomas + } +// ieee->beacon_timer.expires = jiffies + +// (MSECS( ieee->current_network.beacon_interval -5)); + + //spin_lock_irqsave(&ieee->beacon_lock,flags); + if(ieee->beacon_txing && ieee->ieee_up){ +// if(!timer_pending(&ieee->beacon_timer)) +// add_timer(&ieee->beacon_timer); + mod_timer(&ieee->beacon_timer,jiffies+(MSECS(ieee->current_network.beacon_interval-5))); + } + //spin_unlock_irqrestore(&ieee->beacon_lock,flags); +} + + +void ieee80211_send_beacon_cb(unsigned long _ieee) +{ + struct ieee80211_device *ieee = + (struct ieee80211_device *) _ieee; + unsigned long flags; + + spin_lock_irqsave(&ieee->beacon_lock, flags); + ieee80211_send_beacon(ieee); + spin_unlock_irqrestore(&ieee->beacon_lock, flags); +} + + +void ieee80211_send_probe(struct ieee80211_device *ieee) +{ + struct sk_buff *skb; + + skb = ieee80211_probe_req(ieee); + if (skb){ + softmac_mgmt_xmit(skb, ieee); + ieee->softmac_stats.tx_probe_rq++; + //dev_kfree_skb_any(skb);//edit by thomas + } +} + +void ieee80211_send_probe_requests(struct ieee80211_device *ieee) +{ + if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){ + ieee80211_send_probe(ieee); + ieee80211_send_probe(ieee); + } +} + +/* this performs syncro scan blocking the caller until all channels + * in the allowed channel map has been checked. + */ +void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee) +{ + short ch = 0; +#ifdef ENABLE_DOT11D + u8 channel_map[MAX_CHANNEL_NUMBER+1]; + memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1); +#endif + down(&ieee->scan_sem); + + while(1) + { + + do{ + ch++; + if (ch > MAX_CHANNEL_NUMBER) + goto out; /* scan completed */ +#ifdef ENABLE_DOT11D + }while(!channel_map[ch]); +#else + }while(!ieee->channel_map[ch]); +#endif + + /* this fuction can be called in two situations + * 1- We have switched to ad-hoc mode and we are + * performing a complete syncro scan before conclude + * there are no interesting cell and to create a + * new one. In this case the link state is + * IEEE80211_NOLINK until we found an interesting cell. + * If so the ieee8021_new_net, called by the RX path + * will set the state to IEEE80211_LINKED, so we stop + * scanning + * 2- We are linked and the root uses run iwlist scan. + * So we switch to IEEE80211_LINKED_SCANNING to remember + * that we are still logically linked (not interested in + * new network events, despite for updating the net list, + * but we are temporarly 'unlinked' as the driver shall + * not filter RX frames and the channel is changing. + * So the only situation in witch are interested is to check + * if the state become LINKED because of the #1 situation + */ + + if (ieee->state == IEEE80211_LINKED) + goto out; + ieee->set_chan(ieee->dev, ch); +#ifdef ENABLE_DOT11D + if(channel_map[ch] == 1) +#endif + ieee80211_send_probe_requests(ieee); + + /* this prevent excessive time wait when we + * need to wait for a syncro scan to end.. + */ + if(ieee->state < IEEE80211_LINKED) + ; + else + if (ieee->sync_scan_hurryup) + goto out; + + + msleep_interruptible_rsl(IEEE80211_SOFTMAC_SCAN_TIME); + + } +out: + if(ieee->state < IEEE80211_LINKED){ + ieee->actscanning = false; + up(&ieee->scan_sem); + } + else{ + ieee->sync_scan_hurryup = 0; +#ifdef ENABLE_DOT11D + if(IS_DOT11D_ENABLE(ieee)) + DOT11D_ScanComplete(ieee); +#endif + up(&ieee->scan_sem); +} +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +/* called both by wq with ieee->lock held */ +void ieee80211_softmac_scan(struct ieee80211_device *ieee) +{ +#if 0 + short watchdog = 0; + do{ + ieee->current_network.channel = + (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER; + if (watchdog++ > MAX_CHANNEL_NUMBER) + return; /* no good chans */ + + }while(!ieee->channel_map[ieee->current_network.channel]); +#endif + + schedule_task(&ieee->softmac_scan_wq); +} +#endif + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +void ieee80211_softmac_scan_wq(struct work_struct *work) +{ + struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq); +#else +void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee) +{ +#endif + static short watchdog = 0; +#ifdef ENABLE_DOT11D + u8 channel_map[MAX_CHANNEL_NUMBER+1]; + memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1); +#endif + if(!ieee->ieee_up) + return; + down(&ieee->scan_sem); + do{ + ieee->current_network.channel = + (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER; + if (watchdog++ > MAX_CHANNEL_NUMBER) + { + //if current channel is not in channel map, set to default channel. + #ifdef ENABLE_DOT11D + if (!channel_map[ieee->current_network.channel]); + #else + if (!ieee->channel_map[ieee->current_network.channel]); + #endif + ieee->current_network.channel = 6; + goto out; /* no good chans */ + } +#ifdef ENABLE_DOT11D + }while(!channel_map[ieee->current_network.channel]); +#else + }while(!ieee->channel_map[ieee->current_network.channel]); +#endif + if (ieee->scanning == 0 ) + goto out; + ieee->set_chan(ieee->dev, ieee->current_network.channel); +#ifdef ENABLE_DOT11D + if(channel_map[ieee->current_network.channel] == 1) +#endif + ieee80211_send_probe_requests(ieee); + + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME); +#else + //ieee->scan_timer.expires = jiffies + MSECS(IEEE80211_SOFTMAC_SCAN_TIME); + if (ieee->scanning == 1) + mod_timer(&ieee->scan_timer,(jiffies + MSECS(IEEE80211_SOFTMAC_SCAN_TIME))); +#endif + + up(&ieee->scan_sem); + return; +out: +#ifdef ENABLE_DOT11D + if(IS_DOT11D_ENABLE(ieee)) + DOT11D_ScanComplete(ieee); +#endif + ieee->actscanning = false; + watchdog = 0; + ieee->scanning = 0; + up(&ieee->scan_sem); +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +void ieee80211_softmac_scan_cb(unsigned long _dev) +{ + unsigned long flags; + struct ieee80211_device *ieee = (struct ieee80211_device *)_dev; + + spin_lock_irqsave(&ieee->lock, flags); + ieee80211_softmac_scan(ieee); + spin_unlock_irqrestore(&ieee->lock, flags); +} +#endif + + +void ieee80211_beacons_start(struct ieee80211_device *ieee) +{ + unsigned long flags; + spin_lock_irqsave(&ieee->beacon_lock,flags); + + ieee->beacon_txing = 1; + ieee80211_send_beacon(ieee); + + spin_unlock_irqrestore(&ieee->beacon_lock,flags); +} + +void ieee80211_beacons_stop(struct ieee80211_device *ieee) +{ + unsigned long flags; + + spin_lock_irqsave(&ieee->beacon_lock,flags); + + ieee->beacon_txing = 0; + del_timer_sync(&ieee->beacon_timer); + + spin_unlock_irqrestore(&ieee->beacon_lock,flags); + +} + + +void ieee80211_stop_send_beacons(struct ieee80211_device *ieee) +{ + if(ieee->stop_send_beacons) + ieee->stop_send_beacons(ieee->dev); + if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS) + ieee80211_beacons_stop(ieee); +} + + +void ieee80211_start_send_beacons(struct ieee80211_device *ieee) +{ + if(ieee->start_send_beacons) + ieee->start_send_beacons(ieee->dev,ieee->basic_rate); + if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS) + ieee80211_beacons_start(ieee); +} + + +void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee) +{ +// unsigned long flags; + + //ieee->sync_scan_hurryup = 1; + + down(&ieee->scan_sem); +// spin_lock_irqsave(&ieee->lock, flags); + + if (ieee->scanning == 1){ + ieee->scanning = 0; + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + cancel_delayed_work(&ieee->softmac_scan_wq); +#else + del_timer_sync(&ieee->scan_timer); +#endif + } + +// spin_unlock_irqrestore(&ieee->lock, flags); + up(&ieee->scan_sem); +} + +void ieee80211_stop_scan(struct ieee80211_device *ieee) +{ + if (ieee->softmac_features & IEEE_SOFTMAC_SCAN) + ieee80211_softmac_stop_scan(ieee); + else + ieee->stop_scan(ieee->dev); +} + +/* called with ieee->lock held */ +void ieee80211_start_scan(struct ieee80211_device *ieee) +{ +#ifdef ENABLE_DOT11D + if(IS_DOT11D_ENABLE(ieee) ) + { + if(IS_COUNTRY_IE_VALID(ieee)) + { + RESET_CIE_WATCHDOG(ieee); + } + } +#endif + if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){ + if (ieee->scanning == 0){ + ieee->scanning = 1; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) + queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0); +#else + + queue_work(ieee->wq, &ieee->softmac_scan_wq); +#endif +#else + ieee80211_softmac_scan(ieee); +#endif + } + }else + ieee->start_scan(ieee->dev); + +} + +/* called with wx_sem held */ +void ieee80211_start_scan_syncro(struct ieee80211_device *ieee) +{ +#ifdef ENABLE_DOT11D + if(IS_DOT11D_ENABLE(ieee) ) + { + if(IS_COUNTRY_IE_VALID(ieee)) + { + RESET_CIE_WATCHDOG(ieee); + } + } +#endif + ieee->sync_scan_hurryup = 0; + if (ieee->softmac_features & IEEE_SOFTMAC_SCAN) + ieee80211_softmac_scan_syncro(ieee); + else + ieee->scan_syncro(ieee->dev); + +} + +inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon, + struct ieee80211_device *ieee, int challengelen) +{ + struct sk_buff *skb; + struct ieee80211_authentication *auth; + int len = sizeof(struct ieee80211_authentication) + challengelen + ieee->tx_headroom; + + + skb = dev_alloc_skb(len); + if (!skb) return NULL; + + skb_reserve(skb, ieee->tx_headroom); + auth = (struct ieee80211_authentication *) + skb_put(skb, sizeof(struct ieee80211_authentication)); + + auth->header.frame_ctl = IEEE80211_STYPE_AUTH; + if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP; + + auth->header.duration_id = 0x013a; //FIXME + + memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN); + memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN); + memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN); + + //auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY; + if(ieee->auth_mode == 0) + auth->algorithm = WLAN_AUTH_OPEN; + else if(ieee->auth_mode == 1) + auth->algorithm = WLAN_AUTH_SHARED_KEY; + else if(ieee->auth_mode == 2) + auth->algorithm = WLAN_AUTH_OPEN;//0x80; + printk("=================>%s():auth->algorithm is %d\n",__FUNCTION__,auth->algorithm); + auth->transaction = cpu_to_le16(ieee->associate_seq); + ieee->associate_seq++; + + auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS); + + return skb; + +} + + +static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest) +{ + u8 *tag; + int beacon_size; + struct ieee80211_probe_response *beacon_buf; + struct sk_buff *skb = NULL; + int encrypt; + int atim_len,erp_len; + struct ieee80211_crypt_data* crypt; + + char *ssid = ieee->current_network.ssid; + int ssid_len = ieee->current_network.ssid_len; + int rate_len = ieee->current_network.rates_len+2; + int rate_ex_len = ieee->current_network.rates_ex_len; + int wpa_ie_len = ieee->wpa_ie_len; + u8 erpinfo_content = 0; + + u8* tmp_ht_cap_buf; + u8 tmp_ht_cap_len=0; + u8* tmp_ht_info_buf; + u8 tmp_ht_info_len=0; + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; + u8* tmp_generic_ie_buf=NULL; + u8 tmp_generic_ie_len=0; + + if(rate_ex_len > 0) rate_ex_len+=2; + + if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS) + atim_len = 4; + else + atim_len = 0; + +#if 1 + if(ieee80211_is_54g(ieee->current_network)) + erp_len = 3; + else + erp_len = 0; +#else + if((ieee->current_network.mode == IEEE_G) + ||( ieee->current_network.mode == IEEE_N_24G && ieee->pHTInfo->bCurSuppCCK)) { + erp_len = 3; + erpinfo_content = 0; + if(ieee->current_network.buseprotection) + erpinfo_content |= ERP_UseProtection; + } + else + erp_len = 0; +#endif + + + crypt = ieee->crypt[ieee->tx_keyidx]; + + + encrypt = ieee->host_encrypt && crypt && crypt->ops && + ((0 == strcmp(crypt->ops->name, "WEP") || wpa_ie_len)); + //HT ralated element +#if 1 + tmp_ht_cap_buf =(u8*) &(ieee->pHTInfo->SelfHTCap); + tmp_ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap); + tmp_ht_info_buf =(u8*) &(ieee->pHTInfo->SelfHTInfo); + tmp_ht_info_len = sizeof(ieee->pHTInfo->SelfHTInfo); + HTConstructCapabilityElement(ieee, tmp_ht_cap_buf, &tmp_ht_cap_len,encrypt); + HTConstructInfoElement(ieee,tmp_ht_info_buf,&tmp_ht_info_len, encrypt); + + + if(pHTInfo->bRegRT2RTAggregation) + { + tmp_generic_ie_buf = ieee->pHTInfo->szRT2RTAggBuffer; + tmp_generic_ie_len = sizeof(ieee->pHTInfo->szRT2RTAggBuffer); + HTConstructRT2RTAggElement(ieee, tmp_generic_ie_buf, &tmp_generic_ie_len); + } +// printk("===============>tmp_ht_cap_len is %d,tmp_ht_info_len is %d, tmp_generic_ie_len is %d\n",tmp_ht_cap_len,tmp_ht_info_len,tmp_generic_ie_len); +#endif + beacon_size = sizeof(struct ieee80211_probe_response)+2+ + ssid_len + +3 //channel + +rate_len + +rate_ex_len + +atim_len + +erp_len + +wpa_ie_len + // +tmp_ht_cap_len + // +tmp_ht_info_len + // +tmp_generic_ie_len +// +wmm_len+2 + +ieee->tx_headroom; + skb = dev_alloc_skb(beacon_size); + if (!skb) + return NULL; + skb_reserve(skb, ieee->tx_headroom); + beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, (beacon_size - ieee->tx_headroom)); + memcpy (beacon_buf->header.addr1, dest,ETH_ALEN); + memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN); + memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN); + + beacon_buf->header.duration_id = 0; //FIXME + beacon_buf->beacon_interval = + cpu_to_le16(ieee->current_network.beacon_interval); + beacon_buf->capability = + cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS); + beacon_buf->capability |= + cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_SHORT_PREAMBLE); //add short preamble here + + if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT)) + cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT)); + + crypt = ieee->crypt[ieee->tx_keyidx]; +#if 0 + encrypt = ieee->host_encrypt && crypt && crypt->ops && + (0 == strcmp(crypt->ops->name, "WEP")); +#endif + if (encrypt) + beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); + + + beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP); + beacon_buf->info_element[0].id = MFIE_TYPE_SSID; + beacon_buf->info_element[0].len = ssid_len; + + tag = (u8*) beacon_buf->info_element[0].data; + + memcpy(tag, ssid, ssid_len); + + tag += ssid_len; + + *(tag++) = MFIE_TYPE_RATES; + *(tag++) = rate_len-2; + memcpy(tag,ieee->current_network.rates,rate_len-2); + tag+=rate_len-2; + + *(tag++) = MFIE_TYPE_DS_SET; + *(tag++) = 1; + *(tag++) = ieee->current_network.channel; + + if(atim_len){ + u16 val16; + *(tag++) = MFIE_TYPE_IBSS_SET; + *(tag++) = 2; + //*((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window); + val16 = cpu_to_le16(ieee->current_network.atim_window); + memcpy((u8 *)tag, (u8 *)&val16, 2); + tag+=2; + } + + if(erp_len){ + *(tag++) = MFIE_TYPE_ERP; + *(tag++) = 1; + *(tag++) = erpinfo_content; + } +#if 0 + //Include High Throuput capability + + *(tag++) = MFIE_TYPE_HT_CAP; + *(tag++) = tmp_ht_cap_len - 2; + memcpy(tag, tmp_ht_cap_buf, tmp_ht_cap_len - 2); + tag += tmp_ht_cap_len - 2; +#endif + if(rate_ex_len){ + *(tag++) = MFIE_TYPE_RATES_EX; + *(tag++) = rate_ex_len-2; + memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2); + tag+=rate_ex_len-2; + } + +#if 0 + //Include High Throuput info + + *(tag++) = MFIE_TYPE_HT_INFO; + *(tag++) = tmp_ht_info_len - 2; + memcpy(tag, tmp_ht_info_buf, tmp_ht_info_len -2); + tag += tmp_ht_info_len - 2; +#endif + if (wpa_ie_len) + { + if (ieee->iw_mode == IW_MODE_ADHOC) + {//as Windows will set pairwise key same as the group key which is not allowed in Linux, so set this for IOT issue. WB 2008.07.07 + memcpy(&ieee->wpa_ie[14], &ieee->wpa_ie[8], 4); + } + memcpy(tag, ieee->wpa_ie, ieee->wpa_ie_len); + tag += wpa_ie_len; + } + +#if 0 + // + // Construct Realtek Proprietary Aggregation mode (Set AMPDU Factor to 2, 32k) + // + if(pHTInfo->bRegRT2RTAggregation) + { + (*tag++) = 0xdd; + (*tag++) = tmp_generic_ie_len - 2; + memcpy(tag,tmp_generic_ie_buf,tmp_generic_ie_len -2); + tag += tmp_generic_ie_len -2; + + } +#endif +#if 0 + if(ieee->qos_support) + { + (*tag++) = 0xdd; + (*tag++) = wmm_len; + memcpy(tag,QosOui,wmm_len); + tag += wmm_len; + } +#endif + //skb->dev = ieee->dev; + return skb; +} + + +struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest) +{ + struct sk_buff *skb; + u8* tag; + + struct ieee80211_crypt_data* crypt; + struct ieee80211_assoc_response_frame *assoc; + short encrypt; + + unsigned int rate_len = ieee80211_MFIE_rate_len(ieee); + int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len + ieee->tx_headroom; + + skb = dev_alloc_skb(len); + + if (!skb) + return NULL; + + skb_reserve(skb, ieee->tx_headroom); + + assoc = (struct ieee80211_assoc_response_frame *) + skb_put(skb,sizeof(struct ieee80211_assoc_response_frame)); + + assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP); + memcpy(assoc->header.addr1, dest,ETH_ALEN); + memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN); + memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN); + assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ? + WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS); + + + if(ieee->short_slot) + assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT); + + if (ieee->host_encrypt) + crypt = ieee->crypt[ieee->tx_keyidx]; + else crypt = NULL; + + encrypt = ( crypt && crypt->ops); + + if (encrypt) + assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); + + assoc->status = 0; + assoc->aid = cpu_to_le16(ieee->assoc_id); + if (ieee->assoc_id == 0x2007) ieee->assoc_id=0; + else ieee->assoc_id++; + + tag = (u8*) skb_put(skb, rate_len); + + ieee80211_MFIE_Brate(ieee, &tag); + ieee80211_MFIE_Grate(ieee, &tag); + + return skb; +} + +struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest) +{ + struct sk_buff *skb; + struct ieee80211_authentication *auth; + int len = ieee->tx_headroom + sizeof(struct ieee80211_authentication)+1; + + skb = dev_alloc_skb(len); + + if (!skb) + return NULL; + + skb->len = sizeof(struct ieee80211_authentication); + + auth = (struct ieee80211_authentication *)skb->data; + + auth->status = cpu_to_le16(status); + auth->transaction = cpu_to_le16(2); + auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN); + + memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN); + memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN); + memcpy(auth->header.addr1, dest, ETH_ALEN); + auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH); + return skb; + + +} + +struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr) +{ + struct sk_buff *skb; + struct ieee80211_hdr_3addr* hdr; + + skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr)); + + if (!skb) + return NULL; + + hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr)); + + memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN); + memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN); + memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN); + + hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA | + IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS | + (pwr ? IEEE80211_FCTL_PM:0)); + + return skb; + + +} + + +void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest) +{ + struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest); + + if (buf) + softmac_mgmt_xmit(buf, ieee); +} + + +void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest) +{ + struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest); + + if (buf) + softmac_mgmt_xmit(buf, ieee); +} + + +void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest) +{ + + + struct sk_buff *buf = ieee80211_probe_resp(ieee, dest); + if (buf) + softmac_mgmt_xmit(buf, ieee); +} + + +inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee) +{ + struct sk_buff *skb; + //unsigned long flags; + + struct ieee80211_assoc_request_frame *hdr; + u8 *tag;//,*rsn_ie; + //short info_addr = 0; + //int i; + //u16 suite_count = 0; + //u8 suit_select = 0; + //unsigned int wpa_len = beacon->wpa_ie_len; + //for HT + u8* ht_cap_buf = NULL; + u8 ht_cap_len=0; + u8* realtek_ie_buf=NULL; + u8 realtek_ie_len=0; + int wpa_ie_len= ieee->wpa_ie_len; + unsigned int ckip_ie_len=0; + unsigned int ccxrm_ie_len=0; + unsigned int cxvernum_ie_len=0; + struct ieee80211_crypt_data* crypt; + int encrypt; + + unsigned int rate_len = ieee80211_MFIE_rate_len(ieee); + unsigned int wmm_info_len = beacon->qos_data.supported?9:0; +#ifdef THOMAS_TURBO + unsigned int turbo_info_len = beacon->Turbo_Enable?9:0; +#endif + + int len = 0; + + crypt = ieee->crypt[ieee->tx_keyidx]; + encrypt = ieee->host_encrypt && crypt && crypt->ops && ((0 == strcmp(crypt->ops->name,"WEP") || wpa_ie_len)); + + //Include High Throuput capability && Realtek proprietary + if(ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT) + { + ht_cap_buf = (u8*)&(ieee->pHTInfo->SelfHTCap); + ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap); + HTConstructCapabilityElement(ieee, ht_cap_buf, &ht_cap_len, encrypt); + if(ieee->pHTInfo->bCurrentRT2RTAggregation) + { + realtek_ie_buf = ieee->pHTInfo->szRT2RTAggBuffer; + realtek_ie_len = sizeof( ieee->pHTInfo->szRT2RTAggBuffer); + HTConstructRT2RTAggElement(ieee, realtek_ie_buf, &realtek_ie_len); + + } + } + if(ieee->qos_support){ + wmm_info_len = beacon->qos_data.supported?9:0; + } + + + if(beacon->bCkipSupported) + { + ckip_ie_len = 30+2; + } + if(beacon->bCcxRmEnable) + { + ccxrm_ie_len = 6+2; + } + if( beacon->BssCcxVerNumber >= 2 ) + { + cxvernum_ie_len = 5+2; + } +#ifdef THOMAS_TURBO + len = sizeof(struct ieee80211_assoc_request_frame)+ 2 + + beacon->ssid_len//essid tagged val + + rate_len//rates tagged val + + wpa_ie_len + + wmm_info_len + + turbo_info_len + + ht_cap_len + + realtek_ie_len + + ckip_ie_len + + ccxrm_ie_len + + cxvernum_ie_len + + ieee->tx_headroom; +#else + len = sizeof(struct ieee80211_assoc_request_frame)+ 2 + + beacon->ssid_len//essid tagged val + + rate_len//rates tagged val + + wpa_ie_len + + wmm_info_len + + ht_cap_len + + realtek_ie_len + + ckip_ie_len + + ccxrm_ie_len + + cxvernum_ie_len + + ieee->tx_headroom; +#endif + + skb = dev_alloc_skb(len); + + if (!skb) + return NULL; + + skb_reserve(skb, ieee->tx_headroom); + + hdr = (struct ieee80211_assoc_request_frame *) + skb_put(skb, sizeof(struct ieee80211_assoc_request_frame)+2); + + + hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ; + hdr->header.duration_id= 37; //FIXME + memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN); + memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN); + memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN); + + memcpy(ieee->ap_mac_addr, beacon->bssid, ETH_ALEN);//for HW security, John + + hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS); + if (beacon->capability & WLAN_CAPABILITY_PRIVACY ) + hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); + + if (beacon->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) + hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE); //add short_preamble here + + if(ieee->short_slot) + hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT); + if (wmm_info_len) //QOS + hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_QOS); + + hdr->listen_interval = 0xa; //FIXME + + hdr->info_element[0].id = MFIE_TYPE_SSID; + + hdr->info_element[0].len = beacon->ssid_len; + tag = skb_put(skb, beacon->ssid_len); + memcpy(tag, beacon->ssid, beacon->ssid_len); + + tag = skb_put(skb, rate_len); + + ieee80211_MFIE_Brate(ieee, &tag); + ieee80211_MFIE_Grate(ieee, &tag); + // For CCX 1 S13, CKIP. Added by Annie, 2006-08-14. + if( beacon->bCkipSupported ) + { + static u8 AironetIeOui[] = {0x00, 0x01, 0x66}; // "4500-client" + u8 CcxAironetBuf[30]; + OCTET_STRING osCcxAironetIE; + + memset(CcxAironetBuf, 0,30); + osCcxAironetIE.Octet = CcxAironetBuf; + osCcxAironetIE.Length = sizeof(CcxAironetBuf); + // + // Ref. CCX test plan v3.61, 3.2.3.1 step 13. + // We want to make the device type as "4500-client". 060926, by CCW. + // + memcpy(osCcxAironetIE.Octet, AironetIeOui, sizeof(AironetIeOui)); + + // CCX1 spec V1.13, A01.1 CKIP Negotiation (page23): + // "The CKIP negotiation is started with the associate request from the client to the access point, + // containing an Aironet element with both the MIC and KP bits set." + osCcxAironetIE.Octet[IE_CISCO_FLAG_POSITION] |= (SUPPORT_CKIP_PK|SUPPORT_CKIP_MIC) ; + tag = skb_put(skb, ckip_ie_len); + *tag++ = MFIE_TYPE_AIRONET; + *tag++ = osCcxAironetIE.Length; + memcpy(tag,osCcxAironetIE.Octet,osCcxAironetIE.Length); + tag += osCcxAironetIE.Length; + } + + if(beacon->bCcxRmEnable) + { + static u8 CcxRmCapBuf[] = {0x00, 0x40, 0x96, 0x01, 0x01, 0x00}; + OCTET_STRING osCcxRmCap; + + osCcxRmCap.Octet = CcxRmCapBuf; + osCcxRmCap.Length = sizeof(CcxRmCapBuf); + tag = skb_put(skb,ccxrm_ie_len); + *tag++ = MFIE_TYPE_GENERIC; + *tag++ = osCcxRmCap.Length; + memcpy(tag,osCcxRmCap.Octet,osCcxRmCap.Length); + tag += osCcxRmCap.Length; + } + + if( beacon->BssCcxVerNumber >= 2 ) + { + u8 CcxVerNumBuf[] = {0x00, 0x40, 0x96, 0x03, 0x00}; + OCTET_STRING osCcxVerNum; + CcxVerNumBuf[4] = beacon->BssCcxVerNumber; + osCcxVerNum.Octet = CcxVerNumBuf; + osCcxVerNum.Length = sizeof(CcxVerNumBuf); + tag = skb_put(skb,cxvernum_ie_len); + *tag++ = MFIE_TYPE_GENERIC; + *tag++ = osCcxVerNum.Length; + memcpy(tag,osCcxVerNum.Octet,osCcxVerNum.Length); + tag += osCcxVerNum.Length; + } + //HT cap element + if(ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT){ + if(ieee->pHTInfo->ePeerHTSpecVer != HT_SPEC_VER_EWC) + { + tag = skb_put(skb, ht_cap_len); + *tag++ = MFIE_TYPE_HT_CAP; + *tag++ = ht_cap_len - 2; + memcpy(tag, ht_cap_buf,ht_cap_len -2); + tag += ht_cap_len -2; + } + } + + + //choose what wpa_supplicant gives to associate. + tag = skb_put(skb, wpa_ie_len); + if (wpa_ie_len){ + memcpy(tag, ieee->wpa_ie, ieee->wpa_ie_len); + } + + tag = skb_put(skb,wmm_info_len); + if(wmm_info_len) { + ieee80211_WMM_Info(ieee, &tag); + } +#ifdef THOMAS_TURBO + tag = skb_put(skb,turbo_info_len); + if(turbo_info_len) { + ieee80211_TURBO_Info(ieee, &tag); + } +#endif + + if(ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT){ + if(ieee->pHTInfo->ePeerHTSpecVer == HT_SPEC_VER_EWC) + { + tag = skb_put(skb, ht_cap_len); + *tag++ = MFIE_TYPE_GENERIC; + *tag++ = ht_cap_len - 2; + memcpy(tag, ht_cap_buf,ht_cap_len - 2); + tag += ht_cap_len -2; + } + + if(ieee->pHTInfo->bCurrentRT2RTAggregation){ + tag = skb_put(skb, realtek_ie_len); + *tag++ = MFIE_TYPE_GENERIC; + *tag++ = realtek_ie_len - 2; + memcpy(tag, realtek_ie_buf,realtek_ie_len -2 ); + } + } +// printk("<=====%s(), %p, %p\n", __FUNCTION__, ieee->dev, ieee->dev->dev_addr); +// IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len); + return skb; +} + +void ieee80211_associate_abort(struct ieee80211_device *ieee) +{ + + unsigned long flags; + spin_lock_irqsave(&ieee->lock, flags); + + ieee->associate_seq++; + + /* don't scan, and avoid to have the RX path possibily + * try again to associate. Even do not react to AUTH or + * ASSOC response. Just wait for the retry wq to be scheduled. + * Here we will check if there are good nets to associate + * with, so we retry or just get back to NO_LINK and scanning + */ + if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){ + IEEE80211_DEBUG_MGMT("Authentication failed\n"); + ieee->softmac_stats.no_auth_rs++; + }else{ + IEEE80211_DEBUG_MGMT("Association failed\n"); + ieee->softmac_stats.no_ass_rs++; + } + + ieee->state = IEEE80211_ASSOCIATING_RETRY; + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, \ + IEEE80211_SOFTMAC_ASSOC_RETRY_TIME); +#else + schedule_task(&ieee->associate_retry_wq); +#endif + + spin_unlock_irqrestore(&ieee->lock, flags); +} + +void ieee80211_associate_abort_cb(unsigned long dev) +{ + ieee80211_associate_abort((struct ieee80211_device *) dev); +} + + +void ieee80211_associate_step1(struct ieee80211_device *ieee) +{ + struct ieee80211_network *beacon = &ieee->current_network; + struct sk_buff *skb; + + IEEE80211_DEBUG_MGMT("Stopping scan\n"); + + ieee->softmac_stats.tx_auth_rq++; + skb=ieee80211_authentication_req(beacon, ieee, 0); + + if (!skb) + ieee80211_associate_abort(ieee); + else{ + ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ; + IEEE80211_DEBUG_MGMT("Sending authentication request\n"); + //printk(KERN_WARNING "Sending authentication request\n"); + softmac_mgmt_xmit(skb, ieee); + //BUGON when you try to add_timer twice, using mod_timer may be better, john0709 + if(!timer_pending(&ieee->associate_timer)){ + ieee->associate_timer.expires = jiffies + (HZ / 2); + add_timer(&ieee->associate_timer); + } + //dev_kfree_skb_any(skb);//edit by thomas + } +} + +void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen) +{ + u8 *c; + struct sk_buff *skb; + struct ieee80211_network *beacon = &ieee->current_network; +// int hlen = sizeof(struct ieee80211_authentication); + + ieee->associate_seq++; + ieee->softmac_stats.tx_auth_rq++; + + skb = ieee80211_authentication_req(beacon, ieee, chlen+2); + if (!skb) + ieee80211_associate_abort(ieee); + else{ + c = skb_put(skb, chlen+2); + *(c++) = MFIE_TYPE_CHALLENGE; + *(c++) = chlen; + memcpy(c, challenge, chlen); + + IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n"); + + ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr )); + + softmac_mgmt_xmit(skb, ieee); + mod_timer(&ieee->associate_timer, jiffies + (HZ/2)); +#if 0 + ieee->associate_timer.expires = jiffies + (HZ / 2); + add_timer(&ieee->associate_timer); +#endif + //dev_kfree_skb_any(skb);//edit by thomas + } + kfree(challenge); +} + +void ieee80211_associate_step2(struct ieee80211_device *ieee) +{ + struct sk_buff* skb; + struct ieee80211_network *beacon = &ieee->current_network; + + del_timer_sync(&ieee->associate_timer); + + IEEE80211_DEBUG_MGMT("Sending association request\n"); + + ieee->softmac_stats.tx_ass_rq++; + skb=ieee80211_association_req(beacon, ieee); + if (!skb) + ieee80211_associate_abort(ieee); + else{ + softmac_mgmt_xmit(skb, ieee); + mod_timer(&ieee->associate_timer, jiffies + (HZ/2)); +#if 0 + ieee->associate_timer.expires = jiffies + (HZ / 2); + add_timer(&ieee->associate_timer); +#endif + //dev_kfree_skb_any(skb);//edit by thomas + } +} +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +void ieee80211_associate_complete_wq(struct work_struct *work) +{ + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq); +#else +void ieee80211_associate_complete_wq(struct ieee80211_device *ieee) +{ +#endif + printk(KERN_INFO "Associated successfully\n"); + if(ieee80211_is_54g(ieee->current_network) && + (ieee->modulation & IEEE80211_OFDM_MODULATION)){ + + ieee->rate = 108; + printk(KERN_INFO"Using G rates:%d\n", ieee->rate); + }else{ + ieee->rate = 22; + printk(KERN_INFO"Using B rates:%d\n", ieee->rate); + } + if (ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT) + { + printk("Successfully associated, ht enabled\n"); + HTOnAssocRsp(ieee); + } + else + { + printk("Successfully associated, ht not enabled(%d, %d)\n", ieee->pHTInfo->bCurrentHTSupport, ieee->pHTInfo->bEnableHT); + memset(ieee->dot11HTOperationalRateSet, 0, 16); + //HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); + } + ieee->LinkDetectInfo.SlotNum = 2 * (1 + ieee->current_network.beacon_interval/500); + // To prevent the immediately calling watch_dog after association. + if(ieee->LinkDetectInfo.NumRecvBcnInPeriod==0||ieee->LinkDetectInfo.NumRecvDataInPeriod==0 ) + { + ieee->LinkDetectInfo.NumRecvBcnInPeriod = 1; + ieee->LinkDetectInfo.NumRecvDataInPeriod= 1; + } + ieee->link_change(ieee->dev); + if(ieee->is_silent_reset == 0){ + printk("============>normal associate\n"); + notify_wx_assoc_event(ieee); + } + else if(ieee->is_silent_reset == 1) + { + printk("==================>silent reset associate\n"); + ieee->is_silent_reset = 0; + } + + if (ieee->data_hard_resume) + ieee->data_hard_resume(ieee->dev); + netif_carrier_on(ieee->dev); +} + +void ieee80211_associate_complete(struct ieee80211_device *ieee) +{ +// int i; +// struct net_device* dev = ieee->dev; + del_timer_sync(&ieee->associate_timer); + +#if 0 + for(i = 0; i < 6; i++) { + ieee->seq_ctrl[i] = 0; + } +#endif + ieee->state = IEEE80211_LINKED; +#if 0 + if (ieee->pHTInfo->bCurrentHTSupport) + { + printk("Successfully associated, ht enabled\n"); + queue_work(ieee->wq, &ieee->ht_onAssRsp); + } + else + { + printk("Successfully associated, ht not enabled\n"); + memset(ieee->dot11HTOperationalRateSet, 0, 16); + HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); + } +#endif + //ieee->UpdateHalRATRTableHandler(dev, ieee->dot11HTOperationalRateSet); +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + queue_work(ieee->wq, &ieee->associate_complete_wq); +#else + schedule_task(&ieee->associate_complete_wq); +#endif +} + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +void ieee80211_associate_procedure_wq(struct work_struct *work) +{ + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq); +#else +void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee) +{ +#endif + ieee->sync_scan_hurryup = 1; + down(&ieee->wx_sem); + + if (ieee->data_hard_stop) + ieee->data_hard_stop(ieee->dev); + + ieee80211_stop_scan(ieee); + printk("===>%s(), chan:%d\n", __FUNCTION__, ieee->current_network.channel); + //ieee->set_chan(ieee->dev, ieee->current_network.channel); + HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); + + ieee->associate_seq = 1; + ieee80211_associate_step1(ieee); + + up(&ieee->wx_sem); +} + +inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net) +{ + u8 tmp_ssid[IW_ESSID_MAX_SIZE+1]; + int tmp_ssid_len = 0; + + short apset,ssidset,ssidbroad,apmatch,ssidmatch; + + /* we are interested in new new only if we are not associated + * and we are not associating / authenticating + */ + if (ieee->state != IEEE80211_NOLINK) + return; + + if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS)) + return; + + if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS)) + return; + + + if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){ + /* if the user specified the AP MAC, we need also the essid + * This could be obtained by beacons or, if the network does not + * broadcast it, it can be put manually. + */ + apset = ieee->wap_set;//(memcmp(ieee->current_network.bssid, zero,ETH_ALEN)!=0 ); + ssidset = ieee->ssid_set;//ieee->current_network.ssid[0] != '\0'; + ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0'); + apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0); + ssidmatch = (ieee->current_network.ssid_len == net->ssid_len)&&\ + (!strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len)); + + + if ( /* if the user set the AP check if match. + * if the network does not broadcast essid we check the user supplyed ANY essid + * if the network does broadcast and the user does not set essid it is OK + * if the network does broadcast and the user did set essid chech if essid match + */ + ( apset && apmatch && + ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) || + /* if the ap is not set, check that the user set the bssid + * and the network does bradcast and that those two bssid matches + */ + (!apset && ssidset && ssidbroad && ssidmatch) + ){ + /* if the essid is hidden replace it with the + * essid provided by the user. + */ + if (!ssidbroad){ + strncpy(tmp_ssid, ieee->current_network.ssid, IW_ESSID_MAX_SIZE); + tmp_ssid_len = ieee->current_network.ssid_len; + } + memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network)); + + if (!ssidbroad){ + strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE); + ieee->current_network.ssid_len = tmp_ssid_len; + } + printk(KERN_INFO"Linking with %s,channel:%d, qos:%d, myHT:%d, networkHT:%d\n",ieee->current_network.ssid,ieee->current_network.channel, ieee->current_network.qos_data.supported, ieee->pHTInfo->bEnableHT, ieee->current_network.bssht.bdSupportHT); + + //ieee->pHTInfo->IOTAction = 0; + HTResetIOTSetting(ieee->pHTInfo); + if (ieee->iw_mode == IW_MODE_INFRA){ + /* Join the network for the first time */ + ieee->AsocRetryCount = 0; + //for HT by amy 080514 + if((ieee->current_network.qos_data.supported == 1) && + // (ieee->pHTInfo->bEnableHT && ieee->current_network.bssht.bdSupportHT)) + ieee->current_network.bssht.bdSupportHT) +/*WB, 2008.09.09:bCurrentHTSupport and bEnableHT two flags are going to put together to check whether we are in HT now, so needn't to check bEnableHT flags here. That's is to say we will set to HT support whenever joined AP has the ability to support HT. And whether we are in HT or not, please check bCurrentHTSupport&&bEnableHT now please.*/ + { + // ieee->pHTInfo->bCurrentHTSupport = true; + HTResetSelfAndSavePeerSetting(ieee, &(ieee->current_network)); + } + else + { + ieee->pHTInfo->bCurrentHTSupport = false; + } + + ieee->state = IEEE80211_ASSOCIATING; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + queue_work(ieee->wq, &ieee->associate_procedure_wq); +#else + schedule_task(&ieee->associate_procedure_wq); +#endif + }else{ + if(ieee80211_is_54g(ieee->current_network) && + (ieee->modulation & IEEE80211_OFDM_MODULATION)){ + ieee->rate = 108; + ieee->SetWirelessMode(ieee->dev, IEEE_G); + printk(KERN_INFO"Using G rates\n"); + }else{ + ieee->rate = 22; + ieee->SetWirelessMode(ieee->dev, IEEE_B); + printk(KERN_INFO"Using B rates\n"); + } + memset(ieee->dot11HTOperationalRateSet, 0, 16); + //HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); + ieee->state = IEEE80211_LINKED; + } + + } + } + +} + +void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee) +{ + unsigned long flags; + struct ieee80211_network *target; + + spin_lock_irqsave(&ieee->lock, flags); + + list_for_each_entry(target, &ieee->network_list, list) { + + /* if the state become different that NOLINK means + * we had found what we are searching for + */ + + if (ieee->state != IEEE80211_NOLINK) + break; + + if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies)) + ieee80211_softmac_new_net(ieee, target); + } + + spin_unlock_irqrestore(&ieee->lock, flags); + +} + + +static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen) +{ + struct ieee80211_authentication *a; + u8 *t; + if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){ + IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len); + return 0xcafe; + } + *challenge = NULL; + a = (struct ieee80211_authentication*) skb->data; + if(skb->len > (sizeof(struct ieee80211_authentication) +3)){ + t = skb->data + sizeof(struct ieee80211_authentication); + + if(*(t++) == MFIE_TYPE_CHALLENGE){ + *chlen = *(t++); + *challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC); + memcpy(*challenge, t, *chlen); + } + } + + return cpu_to_le16(a->status); + +} + + +int auth_rq_parse(struct sk_buff *skb,u8* dest) +{ + struct ieee80211_authentication *a; + + if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){ + IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len); + return -1; + } + a = (struct ieee80211_authentication*) skb->data; + + memcpy(dest,a->header.addr2, ETH_ALEN); + + if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN) + return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG; + + return WLAN_STATUS_SUCCESS; +} + +static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src) +{ + u8 *tag; + u8 *skbend; + u8 *ssid=NULL; + u8 ssidlen = 0; + + struct ieee80211_hdr_3addr *header = + (struct ieee80211_hdr_3addr *) skb->data; + + if (skb->len < sizeof (struct ieee80211_hdr_3addr )) + return -1; /* corrupted */ + + memcpy(src,header->addr2, ETH_ALEN); + + skbend = (u8*)skb->data + skb->len; + + tag = skb->data + sizeof (struct ieee80211_hdr_3addr ); + + while (tag+1 < skbend){ + if (*tag == 0){ + ssid = tag+2; + ssidlen = *(tag+1); + break; + } + tag++; /* point to the len field */ + tag = tag + *(tag); /* point to the last data byte of the tag */ + tag++; /* point to the next tag */ + } + + //IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src)); + if (ssidlen == 0) return 1; + + if (!ssid) return 1; /* ssid not found in tagged param */ + return (!strncmp(ssid, ieee->current_network.ssid, ssidlen)); + +} + +int assoc_rq_parse(struct sk_buff *skb,u8* dest) +{ + struct ieee80211_assoc_request_frame *a; + + if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) - + sizeof(struct ieee80211_info_element))) { + + IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len); + return -1; + } + + a = (struct ieee80211_assoc_request_frame*) skb->data; + + memcpy(dest,a->header.addr2,ETH_ALEN); + + return 0; +} + +static inline u16 assoc_parse(struct ieee80211_device *ieee, struct sk_buff *skb, int *aid) +{ + struct ieee80211_assoc_response_frame *response_head; + u16 status_code; + + if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){ + IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len); + return 0xcafe; + } + + response_head = (struct ieee80211_assoc_response_frame*) skb->data; + *aid = le16_to_cpu(response_head->aid) & 0x3fff; + + status_code = le16_to_cpu(response_head->status); + if((status_code==WLAN_STATUS_ASSOC_DENIED_RATES || \ + status_code==WLAN_STATUS_CAPS_UNSUPPORTED)&& + ((ieee->mode == IEEE_G) && + (ieee->current_network.mode == IEEE_N_24G) && + (ieee->AsocRetryCount++ < (RT_ASOC_RETRY_LIMIT-1)))) { + ieee->pHTInfo->IOTAction |= HT_IOT_ACT_PURE_N_MODE; + }else { + ieee->AsocRetryCount = 0; + } + + return le16_to_cpu(response_head->status); +} + +static inline void +ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb) +{ + u8 dest[ETH_ALEN]; + + //IEEE80211DMESG("Rx probe"); + ieee->softmac_stats.rx_probe_rq++; + //DMESG("Dest is "MACSTR, MAC2STR(dest)); + if (probe_rq_parse(ieee, skb, dest)){ + //IEEE80211DMESG("Was for me!"); + ieee->softmac_stats.tx_probe_rs++; + ieee80211_resp_to_probe(ieee, dest); + } +} + +static inline void +ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb) +{ + u8 dest[ETH_ALEN]; + int status; + //IEEE80211DMESG("Rx probe"); + ieee->softmac_stats.rx_auth_rq++; + + if ((status = auth_rq_parse(skb, dest))!= -1){ + ieee80211_resp_to_auth(ieee, status, dest); + } + //DMESG("Dest is "MACSTR, MAC2STR(dest)); + +} + +static inline void +ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb) +{ + + u8 dest[ETH_ALEN]; + //unsigned long flags; + + ieee->softmac_stats.rx_ass_rq++; + if (assoc_rq_parse(skb,dest) != -1){ + ieee80211_resp_to_assoc_rq(ieee, dest); + } + + printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest)); + //FIXME + #if 0 + spin_lock_irqsave(&ieee->lock,flags); + add_associate(ieee,dest); + spin_unlock_irqrestore(&ieee->lock,flags); + #endif +} + + + +void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr) +{ + + struct sk_buff *buf = ieee80211_null_func(ieee, pwr); + + if (buf) + softmac_ps_mgmt_xmit(buf, ieee); + +} + + +short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l) +{ + int timeout = ieee->ps_timeout; + u8 dtim; + /*if(ieee->ps == IEEE80211_PS_DISABLED || + ieee->iw_mode != IW_MODE_INFRA || + ieee->state != IEEE80211_LINKED) + + return 0; + */ + dtim = ieee->current_network.dtim_data; + //printk("DTIM\n"); + if(!(dtim & IEEE80211_DTIM_VALID)) + return 0; + timeout = ieee->current_network.beacon_interval; //should we use ps_timeout value or beacon_interval + //printk("VALID\n"); + ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID; + + if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps)) + return 2; + + if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout))) + return 0; + + if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout))) + return 0; + + if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) && + (ieee->mgmt_queue_tail != ieee->mgmt_queue_head)) + return 0; + + if(time_l){ + *time_l = ieee->current_network.last_dtim_sta_time[0] + + (ieee->current_network.beacon_interval + * ieee->current_network.dtim_period) * 1000; + } + + if(time_h){ + *time_h = ieee->current_network.last_dtim_sta_time[1]; + if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0]) + *time_h += 1; + } + + return 1; + + +} + +inline void ieee80211_sta_ps(struct ieee80211_device *ieee) +{ + + u32 th,tl; + short sleep; + + unsigned long flags,flags2; + + spin_lock_irqsave(&ieee->lock, flags); + + if((ieee->ps == IEEE80211_PS_DISABLED || + ieee->iw_mode != IW_MODE_INFRA || + ieee->state != IEEE80211_LINKED)){ + + // #warning CHECK_LOCK_HERE + spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); + + ieee80211_sta_wakeup(ieee, 1); + + spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); + } + + sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl); + /* 2 wake, 1 sleep, 0 do nothing */ + if(sleep == 0) + goto out; + + if(sleep == 1){ + + if(ieee->sta_sleep == 1) + ieee->enter_sleep_state(ieee->dev,th,tl); + + else if(ieee->sta_sleep == 0){ + // printk("send null 1\n"); + spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); + + if(ieee->ps_is_queue_empty(ieee->dev)){ + + + ieee->sta_sleep = 2; + + ieee->ps_request_tx_ack(ieee->dev); + + ieee80211_sta_ps_send_null_frame(ieee,1); + + ieee->ps_th = th; + ieee->ps_tl = tl; + } + spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); + + } + + + }else if(sleep == 2){ +//#warning CHECK_LOCK_HERE + spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); + + ieee80211_sta_wakeup(ieee,1); + + spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); + } + +out: + spin_unlock_irqrestore(&ieee->lock, flags); + +} + +void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl) +{ + if(ieee->sta_sleep == 0){ + if(nl){ + printk("Warning: driver is probably failing to report TX ps error\n"); + ieee->ps_request_tx_ack(ieee->dev); + ieee80211_sta_ps_send_null_frame(ieee, 0); + } + return; + + } + + if(ieee->sta_sleep == 1) + ieee->sta_wake_up(ieee->dev); + + ieee->sta_sleep = 0; + + if(nl){ + ieee->ps_request_tx_ack(ieee->dev); + ieee80211_sta_ps_send_null_frame(ieee, 0); + } +} + +void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success) +{ + unsigned long flags,flags2; + + spin_lock_irqsave(&ieee->lock, flags); + + if(ieee->sta_sleep == 2){ + /* Null frame with PS bit set */ + if(success){ + ieee->sta_sleep = 1; + ieee->enter_sleep_state(ieee->dev,ieee->ps_th,ieee->ps_tl); + } + /* if the card report not success we can't be sure the AP + * has not RXed so we can't assume the AP believe us awake + */ + } + /* 21112005 - tx again null without PS bit if lost */ + else { + + if((ieee->sta_sleep == 0) && !success){ + spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); + ieee80211_sta_ps_send_null_frame(ieee, 0); + spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); + } + } + spin_unlock_irqrestore(&ieee->lock, flags); +} +void ieee80211_process_action(struct ieee80211_device* ieee, struct sk_buff* skb) +{ + struct ieee80211_hdr* header = (struct ieee80211_hdr*)skb->data; + u8* act = ieee80211_get_payload(header); + u8 tmp = 0; +// IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_BA, skb->data, skb->len); + if (act == NULL) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "error to get payload of action frame\n"); + return; + } + tmp = *act; + act ++; + switch (tmp) + { + case ACT_CAT_BA: + if (*act == ACT_ADDBAREQ) + ieee80211_rx_ADDBAReq(ieee, skb); + else if (*act == ACT_ADDBARSP) + ieee80211_rx_ADDBARsp(ieee, skb); + else if (*act == ACT_DELBA) + ieee80211_rx_DELBA(ieee, skb); + break; + default: +// if (net_ratelimit()) +// IEEE80211_DEBUG(IEEE80211_DL_BA, "unknown action frame(%d)\n", tmp); + break; + } + return; + +} +inline int +ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, + struct ieee80211_rx_stats *rx_stats, u16 type, + u16 stype) +{ + struct ieee80211_hdr_3addr *header = (struct ieee80211_hdr_3addr *) skb->data; + u16 errcode; + u8* challenge; + int chlen=0; + int aid; + struct ieee80211_assoc_response_frame *assoc_resp; +// struct ieee80211_info_element *info_element; + bool bSupportNmode = true, bHalfSupportNmode = false; //default support N mode, disable halfNmode + + if(!ieee->proto_started) + return 0; + + if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED && + ieee->iw_mode == IW_MODE_INFRA && + ieee->state == IEEE80211_LINKED)) + + tasklet_schedule(&ieee->ps_task); + + if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP && + WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON) + ieee->last_rx_ps_time = jiffies; + + switch (WLAN_FC_GET_STYPE(header->frame_ctl)) { + + case IEEE80211_STYPE_ASSOC_RESP: + case IEEE80211_STYPE_REASSOC_RESP: + + IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n", + WLAN_FC_GET_STYPE(header->frame_ctl)); + if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && + ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED && + ieee->iw_mode == IW_MODE_INFRA){ + struct ieee80211_network network_resp; + struct ieee80211_network *network = &network_resp; + + if (0 == (errcode=assoc_parse(ieee,skb, &aid))){ + ieee->state=IEEE80211_LINKED; + ieee->assoc_id = aid; + ieee->softmac_stats.rx_ass_ok++; + /* station support qos */ + /* Let the register setting defaultly with Legacy station */ + if(ieee->qos_support) { + assoc_resp = (struct ieee80211_assoc_response_frame*)skb->data; + memset(network, 0, sizeof(*network)); + if (ieee80211_parse_info_param(ieee,assoc_resp->info_element,\ + rx_stats->len - sizeof(*assoc_resp),\ + network,rx_stats)){ + return 1; + } + else + { //filling the PeerHTCap. //maybe not neccesary as we can get its info from current_network. + memcpy(ieee->pHTInfo->PeerHTCapBuf, network->bssht.bdHTCapBuf, network->bssht.bdHTCapLen); + memcpy(ieee->pHTInfo->PeerHTInfoBuf, network->bssht.bdHTInfoBuf, network->bssht.bdHTInfoLen); + } + if (ieee->handle_assoc_response != NULL) + ieee->handle_assoc_response(ieee->dev, (struct ieee80211_assoc_response_frame*)header, network); + } + ieee80211_associate_complete(ieee); + } else { + /* aid could not been allocated */ + ieee->softmac_stats.rx_ass_err++; + printk( + "Association response status code 0x%x\n", + errcode); + IEEE80211_DEBUG_MGMT( + "Association response status code 0x%x\n", + errcode); + if(ieee->AsocRetryCount < RT_ASOC_RETRY_LIMIT) { +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + queue_work(ieee->wq, &ieee->associate_procedure_wq); +#else + schedule_task(&ieee->associate_procedure_wq); +#endif + } else { + ieee80211_associate_abort(ieee); + } + } + } + break; + + case IEEE80211_STYPE_ASSOC_REQ: + case IEEE80211_STYPE_REASSOC_REQ: + + if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && + ieee->iw_mode == IW_MODE_MASTER) + + ieee80211_rx_assoc_rq(ieee, skb); + break; + + case IEEE80211_STYPE_AUTH: + + if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){ + if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING && + ieee->iw_mode == IW_MODE_INFRA){ + + IEEE80211_DEBUG_MGMT("Received authentication response"); + + if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){ + if(ieee->open_wep || !challenge){ + ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED; + ieee->softmac_stats.rx_auth_rs_ok++; + if(!(ieee->pHTInfo->IOTAction&HT_IOT_ACT_PURE_N_MODE)) + { + if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) + { + // WEP or TKIP encryption + if(IsHTHalfNmodeAPs(ieee)) + { + bSupportNmode = true; + bHalfSupportNmode = true; + } + else + { + bSupportNmode = false; + bHalfSupportNmode = false; + } + printk("==========>to link with AP using SEC(%d, %d)", bSupportNmode, bHalfSupportNmode); + } + } + /* Dummy wirless mode setting to avoid encryption issue */ + if(bSupportNmode) { + //N mode setting + ieee->SetWirelessMode(ieee->dev, \ + ieee->current_network.mode); + }else{ + //b/g mode setting + /*TODO*/ + ieee->SetWirelessMode(ieee->dev, IEEE_G); + } + + if (ieee->current_network.mode == IEEE_N_24G && bHalfSupportNmode == true) + { + printk("===============>entern half N mode\n"); + ieee->bHalfWirelessN24GMode = true; + } + else + ieee->bHalfWirelessN24GMode = false; + + ieee80211_associate_step2(ieee); + }else{ + ieee80211_auth_challenge(ieee, challenge, chlen); + } + }else{ + ieee->softmac_stats.rx_auth_rs_err++; + IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode); + ieee80211_associate_abort(ieee); + } + + }else if (ieee->iw_mode == IW_MODE_MASTER){ + ieee80211_rx_auth_rq(ieee, skb); + } + } + break; + + case IEEE80211_STYPE_PROBE_REQ: + + if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) && + ((ieee->iw_mode == IW_MODE_ADHOC || + ieee->iw_mode == IW_MODE_MASTER) && + ieee->state == IEEE80211_LINKED)){ + ieee80211_rx_probe_rq(ieee, skb); + } + break; + + case IEEE80211_STYPE_DISASSOC: + case IEEE80211_STYPE_DEAUTH: + /* FIXME for now repeat all the association procedure + * both for disassociation and deauthentication + */ + if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && + ieee->state == IEEE80211_LINKED && + ieee->iw_mode == IW_MODE_INFRA){ + + ieee->state = IEEE80211_ASSOCIATING; + ieee->softmac_stats.reassoc++; + + notify_wx_assoc_event(ieee); + //HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); + RemovePeerTS(ieee, header->addr2); +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + queue_work(ieee->wq, &ieee->associate_procedure_wq); +#else + schedule_task(&ieee->associate_procedure_wq); +#endif + } + break; + case IEEE80211_STYPE_MANAGE_ACT: + ieee80211_process_action(ieee,skb); + break; + default: + return -1; + break; + } + + //dev_kfree_skb_any(skb); + return 0; +} + +/* following are for a simplier TX queue management. + * Instead of using netif_[stop/wake]_queue the driver + * will uses these two function (plus a reset one), that + * will internally uses the kernel netif_* and takes + * care of the ieee802.11 fragmentation. + * So the driver receives a fragment per time and might + * call the stop function when it want without take care + * to have enought room to TX an entire packet. + * This might be useful if each fragment need it's own + * descriptor, thus just keep a total free memory > than + * the max fragmentation treshold is not enought.. If the + * ieee802.11 stack passed a TXB struct then you needed + * to keep N free descriptors where + * N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD + * In this way you need just one and the 802.11 stack + * will take care of buffering fragments and pass them to + * to the driver later, when it wakes the queue. + */ +void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee) +{ + + unsigned int queue_index = txb->queue_index; + unsigned long flags; + int i; + cb_desc *tcb_desc = NULL; + + spin_lock_irqsave(&ieee->lock,flags); + + /* called with 2nd parm 0, no tx mgmt lock required */ + ieee80211_sta_wakeup(ieee,0); + + /* update the tx status */ + ieee->stats.tx_bytes += txb->payload_size; + ieee->stats.tx_packets++; + tcb_desc = (cb_desc *)(txb->fragments[0]->cb + MAX_DEV_ADDR_SIZE); + if(tcb_desc->bMulticast) { + ieee->stats.multicast++; + } +#if 1 + /* if xmit available, just xmit it immediately, else just insert it to the wait queue */ + for(i = 0; i < txb->nr_frags; i++) { +#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE + if ((skb_queue_len(&ieee->skb_drv_aggQ[queue_index]) != 0) || +#else + if ((skb_queue_len(&ieee->skb_waitQ[queue_index]) != 0) || +#endif + (!ieee->check_nic_enough_desc(ieee->dev,queue_index))||\ + (ieee->queue_stop)) { + /* insert the skb packet to the wait queue */ + /* as for the completion function, it does not need + * to check it any more. + * */ + //printk("error:no descriptor left@queue_index %d\n", queue_index); + //ieee80211_stop_queue(ieee); +#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE + skb_queue_tail(&ieee->skb_drv_aggQ[queue_index], txb->fragments[i]); +#else + skb_queue_tail(&ieee->skb_waitQ[queue_index], txb->fragments[i]); +#endif + }else{ + ieee->softmac_data_hard_start_xmit( + txb->fragments[i], + ieee->dev,ieee->rate); + //ieee->stats.tx_packets++; + //ieee->stats.tx_bytes += txb->fragments[i]->len; + //ieee->dev->trans_start = jiffies; + } + } +#endif + ieee80211_txb_free(txb); + +//exit: + spin_unlock_irqrestore(&ieee->lock,flags); + +} + +/* called with ieee->lock acquired */ +void ieee80211_resume_tx(struct ieee80211_device *ieee) +{ + int i; + for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) { + + if (ieee->queue_stop){ + ieee->tx_pending.frag = i; + return; + }else{ + + ieee->softmac_data_hard_start_xmit( + ieee->tx_pending.txb->fragments[i], + ieee->dev,ieee->rate); + //(i+1)tx_pending.txb->nr_frags); + ieee->stats.tx_packets++; + ieee->dev->trans_start = jiffies; + } + } + + + ieee80211_txb_free(ieee->tx_pending.txb); + ieee->tx_pending.txb = NULL; +} + + +void ieee80211_reset_queue(struct ieee80211_device *ieee) +{ + unsigned long flags; + + spin_lock_irqsave(&ieee->lock,flags); + init_mgmt_queue(ieee); + if (ieee->tx_pending.txb){ + ieee80211_txb_free(ieee->tx_pending.txb); + ieee->tx_pending.txb = NULL; + } + ieee->queue_stop = 0; + spin_unlock_irqrestore(&ieee->lock,flags); + +} + +void ieee80211_wake_queue(struct ieee80211_device *ieee) +{ + + unsigned long flags; + struct sk_buff *skb; + struct ieee80211_hdr_3addr *header; + + spin_lock_irqsave(&ieee->lock,flags); + if (! ieee->queue_stop) goto exit; + + ieee->queue_stop = 0; + + if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){ + while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){ + + header = (struct ieee80211_hdr_3addr *) skb->data; + + header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4); + + if (ieee->seq_ctrl[0] == 0xFFF) + ieee->seq_ctrl[0] = 0; + else + ieee->seq_ctrl[0]++; + + ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate); + //dev_kfree_skb_any(skb);//edit by thomas + } + } + if (!ieee->queue_stop && ieee->tx_pending.txb) + ieee80211_resume_tx(ieee); + + if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){ + ieee->softmac_stats.swtxawake++; + netif_wake_queue(ieee->dev); + } + +exit : + spin_unlock_irqrestore(&ieee->lock,flags); +} + + +void ieee80211_stop_queue(struct ieee80211_device *ieee) +{ + //unsigned long flags; + //spin_lock_irqsave(&ieee->lock,flags); + + if (! netif_queue_stopped(ieee->dev)){ + netif_stop_queue(ieee->dev); + ieee->softmac_stats.swtxstop++; + } + ieee->queue_stop = 1; + //spin_unlock_irqrestore(&ieee->lock,flags); + +} + + +inline void ieee80211_randomize_cell(struct ieee80211_device *ieee) +{ + + get_random_bytes(ieee->current_network.bssid, ETH_ALEN); + + /* an IBSS cell address must have the two less significant + * bits of the first byte = 2 + */ + ieee->current_network.bssid[0] &= ~0x01; + ieee->current_network.bssid[0] |= 0x02; +} + +/* called in user context only */ +void ieee80211_start_master_bss(struct ieee80211_device *ieee) +{ + ieee->assoc_id = 1; + + if (ieee->current_network.ssid_len == 0){ + strncpy(ieee->current_network.ssid, + IEEE80211_DEFAULT_TX_ESSID, + IW_ESSID_MAX_SIZE); + + ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID); + ieee->ssid_set = 1; + } + + memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN); + + ieee->set_chan(ieee->dev, ieee->current_network.channel); + ieee->state = IEEE80211_LINKED; + ieee->link_change(ieee->dev); + notify_wx_assoc_event(ieee); + + if (ieee->data_hard_resume) + ieee->data_hard_resume(ieee->dev); + + netif_carrier_on(ieee->dev); +} + +void ieee80211_start_monitor_mode(struct ieee80211_device *ieee) +{ + if(ieee->raw_tx){ + + if (ieee->data_hard_resume) + ieee->data_hard_resume(ieee->dev); + + netif_carrier_on(ieee->dev); + } +} +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +void ieee80211_start_ibss_wq(struct work_struct *work) +{ + + struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, start_ibss_wq); +#else +void ieee80211_start_ibss_wq(struct ieee80211_device *ieee) +{ +#endif + /* iwconfig mode ad-hoc will schedule this and return + * on the other hand this will block further iwconfig SET + * operations because of the wx_sem hold. + * Anyway some most set operations set a flag to speed-up + * (abort) this wq (when syncro scanning) before sleeping + * on the semaphore + */ + if(!ieee->proto_started){ + printk("==========oh driver down return\n"); + return; + } + down(&ieee->wx_sem); + + if (ieee->current_network.ssid_len == 0){ + strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID); + ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID); + ieee->ssid_set = 1; + } + + /* check if we have this cell in our network list */ + ieee80211_softmac_check_all_nets(ieee); + + +#ifdef ENABLE_DOT11D //if creating an ad-hoc, set its channel to 10 temporarily--this is the requirement for ASUS, not 11D, so disable 11d. +// if((IS_DOT11D_ENABLE(ieee)) && (ieee->state == IEEE80211_NOLINK)) + if (ieee->state == IEEE80211_NOLINK) + ieee->current_network.channel = 6; +#endif + /* if not then the state is not linked. Maybe the user swithced to + * ad-hoc mode just after being in monitor mode, or just after + * being very few time in managed mode (so the card have had no + * time to scan all the chans..) or we have just run up the iface + * after setting ad-hoc mode. So we have to give another try.. + * Here, in ibss mode, should be safe to do this without extra care + * (in bss mode we had to make sure no-one tryed to associate when + * we had just checked the ieee->state and we was going to start the + * scan) beacause in ibss mode the ieee80211_new_net function, when + * finds a good net, just set the ieee->state to IEEE80211_LINKED, + * so, at worst, we waste a bit of time to initiate an unneeded syncro + * scan, that will stop at the first round because it sees the state + * associated. + */ + if (ieee->state == IEEE80211_NOLINK) + ieee80211_start_scan_syncro(ieee); + + /* the network definitively is not here.. create a new cell */ + if (ieee->state == IEEE80211_NOLINK){ + printk("creating new IBSS cell\n"); + if(!ieee->wap_set) + ieee80211_randomize_cell(ieee); + + if(ieee->modulation & IEEE80211_CCK_MODULATION){ + + ieee->current_network.rates_len = 4; + + ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB; + ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB; + ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB; + ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB; + + }else + ieee->current_network.rates_len = 0; + + if(ieee->modulation & IEEE80211_OFDM_MODULATION){ + ieee->current_network.rates_ex_len = 8; + + ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB; + ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB; + ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB; + ieee->current_network.rates_ex[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_18MB; + ieee->current_network.rates_ex[4] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_24MB; + ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB; + ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB; + ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB; + + ieee->rate = 108; + }else{ + ieee->current_network.rates_ex_len = 0; + ieee->rate = 22; + } + + // By default, WMM function will be disabled in IBSS mode + ieee->current_network.QoS_Enable = 0; + ieee->SetWirelessMode(ieee->dev, IEEE_G); + ieee->current_network.atim_window = 0; + ieee->current_network.capability = WLAN_CAPABILITY_IBSS; + if(ieee->short_slot) + ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT; + + } + + ieee->state = IEEE80211_LINKED; + + ieee->set_chan(ieee->dev, ieee->current_network.channel); + ieee->link_change(ieee->dev); + + notify_wx_assoc_event(ieee); + + ieee80211_start_send_beacons(ieee); + + if (ieee->data_hard_resume) + ieee->data_hard_resume(ieee->dev); + netif_carrier_on(ieee->dev); + + up(&ieee->wx_sem); +} + +inline void ieee80211_start_ibss(struct ieee80211_device *ieee) +{ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + queue_delayed_work(ieee->wq, &ieee->start_ibss_wq, 150); +#else + schedule_task(&ieee->start_ibss_wq); +#endif +} + +/* this is called only in user context, with wx_sem held */ +void ieee80211_start_bss(struct ieee80211_device *ieee) +{ + unsigned long flags; +#ifdef ENABLE_DOT11D + // + // Ref: 802.11d 11.1.3.3 + // STA shall not start a BSS unless properly formed Beacon frame including a Country IE. + // + if(IS_DOT11D_ENABLE(ieee) && !IS_COUNTRY_IE_VALID(ieee)) + { + if(! ieee->bGlobalDomain) + { + return; + } + } +#endif + /* check if we have already found the net we + * are interested in (if any). + * if not (we are disassociated and we are not + * in associating / authenticating phase) start the background scanning. + */ + ieee80211_softmac_check_all_nets(ieee); + + /* ensure no-one start an associating process (thus setting + * the ieee->state to ieee80211_ASSOCIATING) while we + * have just cheked it and we are going to enable scan. + * The ieee80211_new_net function is always called with + * lock held (from both ieee80211_softmac_check_all_nets and + * the rx path), so we cannot be in the middle of such function + */ + spin_lock_irqsave(&ieee->lock, flags); + + if (ieee->state == IEEE80211_NOLINK){ + ieee->actscanning = true; + ieee80211_start_scan(ieee); + } + spin_unlock_irqrestore(&ieee->lock, flags); +} + +/* called only in userspace context */ +void ieee80211_disassociate(struct ieee80211_device *ieee) +{ + + + netif_carrier_off(ieee->dev); + if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE) + ieee80211_reset_queue(ieee); + + if (ieee->data_hard_stop) + ieee->data_hard_stop(ieee->dev); +#ifdef ENABLE_DOT11D + if(IS_DOT11D_ENABLE(ieee)) + Dot11d_Reset(ieee); +#endif + ieee->state = IEEE80211_NOLINK; + ieee->is_set_key = false; + ieee->link_change(ieee->dev); + //HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); + notify_wx_assoc_event(ieee); + +} +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +void ieee80211_associate_retry_wq(struct work_struct *work) +{ + struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq); +#else +void ieee80211_associate_retry_wq(struct ieee80211_device *ieee) +{ +#endif + unsigned long flags; + + down(&ieee->wx_sem); + if(!ieee->proto_started) + goto exit; + + if(ieee->state != IEEE80211_ASSOCIATING_RETRY) + goto exit; + + /* until we do not set the state to IEEE80211_NOLINK + * there are no possibility to have someone else trying + * to start an association procdure (we get here with + * ieee->state = IEEE80211_ASSOCIATING). + * When we set the state to IEEE80211_NOLINK it is possible + * that the RX path run an attempt to associate, but + * both ieee80211_softmac_check_all_nets and the + * RX path works with ieee->lock held so there are no + * problems. If we are still disassociated then start a scan. + * the lock here is necessary to ensure no one try to start + * an association procedure when we have just checked the + * state and we are going to start the scan. + */ + ieee->state = IEEE80211_NOLINK; + + ieee80211_softmac_check_all_nets(ieee); + + spin_lock_irqsave(&ieee->lock, flags); + + if(ieee->state == IEEE80211_NOLINK) + ieee80211_start_scan(ieee); + + spin_unlock_irqrestore(&ieee->lock, flags); + +exit: + up(&ieee->wx_sem); +} + +struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee) +{ + u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff}; + + struct sk_buff *skb; + struct ieee80211_probe_response *b; + + skb = ieee80211_probe_resp(ieee, broadcast_addr); + + if (!skb) + return NULL; + + b = (struct ieee80211_probe_response *) skb->data; + b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON); + + return skb; + +} + +struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee) +{ + struct sk_buff *skb; + struct ieee80211_probe_response *b; + + skb = ieee80211_get_beacon_(ieee); + if(!skb) + return NULL; + + b = (struct ieee80211_probe_response *) skb->data; + b->header.seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4); + + if (ieee->seq_ctrl[0] == 0xFFF) + ieee->seq_ctrl[0] = 0; + else + ieee->seq_ctrl[0]++; + + return skb; +} + +void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee) +{ + ieee->sync_scan_hurryup = 1; + down(&ieee->wx_sem); + ieee80211_stop_protocol(ieee); + up(&ieee->wx_sem); +} + + +void ieee80211_stop_protocol(struct ieee80211_device *ieee) +{ + if (!ieee->proto_started) + return; + + ieee->proto_started = 0; + + ieee80211_stop_send_beacons(ieee); + del_timer_sync(&ieee->associate_timer); +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + cancel_delayed_work(&ieee->associate_retry_wq); + cancel_delayed_work(&ieee->start_ibss_wq); +#endif + ieee80211_stop_scan(ieee); + + ieee80211_disassociate(ieee); + RemoveAllTS(ieee); //added as we disconnect from the previous BSS, Remove all TS +} + +void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee) +{ + ieee->sync_scan_hurryup = 0; + down(&ieee->wx_sem); + ieee80211_start_protocol(ieee); + up(&ieee->wx_sem); +} + +void ieee80211_start_protocol(struct ieee80211_device *ieee) +{ + short ch = 0; + int i = 0; + if (ieee->proto_started) + return; + + ieee->proto_started = 1; + + if (ieee->current_network.channel == 0){ + do{ + ch++; + if (ch > MAX_CHANNEL_NUMBER) + return; /* no channel found */ +#ifdef ENABLE_DOT11D + }while(!GET_DOT11D_INFO(ieee)->channel_map[ch]); +#else + }while(!ieee->channel_map[ch]); +#endif + ieee->current_network.channel = ch; + } + + if (ieee->current_network.beacon_interval == 0) + ieee->current_network.beacon_interval = 100; +// printk("===>%s(), chan:%d\n", __FUNCTION__, ieee->current_network.channel); +// ieee->set_chan(ieee->dev,ieee->current_network.channel); + + for(i = 0; i < 17; i++) { + ieee->last_rxseq_num[i] = -1; + ieee->last_rxfrag_num[i] = -1; + ieee->last_packet_time[i] = 0; + } + + ieee->init_wmmparam_flag = 0;//reinitialize AC_xx_PARAM registers. + + + /* if the user set the MAC of the ad-hoc cell and then + * switch to managed mode, shall we make sure that association + * attempts does not fail just because the user provide the essid + * and the nic is still checking for the AP MAC ?? + */ + if (ieee->iw_mode == IW_MODE_INFRA) + ieee80211_start_bss(ieee); + + else if (ieee->iw_mode == IW_MODE_ADHOC) + ieee80211_start_ibss(ieee); + + else if (ieee->iw_mode == IW_MODE_MASTER) + ieee80211_start_master_bss(ieee); + + else if(ieee->iw_mode == IW_MODE_MONITOR) + ieee80211_start_monitor_mode(ieee); +} + + +#define DRV_NAME "Ieee80211" +void ieee80211_softmac_init(struct ieee80211_device *ieee) +{ + int i; + memset(&ieee->current_network, 0, sizeof(struct ieee80211_network)); + + ieee->state = IEEE80211_NOLINK; + ieee->sync_scan_hurryup = 0; + for(i = 0; i < 5; i++) { + ieee->seq_ctrl[i] = 0; + } +#ifdef ENABLE_DOT11D + ieee->pDot11dInfo = kmalloc(sizeof(RT_DOT11D_INFO), GFP_ATOMIC); + if (!ieee->pDot11dInfo) + IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for DOT11D\n"); + memset(ieee->pDot11dInfo, 0, sizeof(RT_DOT11D_INFO)); +#endif + //added for AP roaming + ieee->LinkDetectInfo.SlotNum = 2; + ieee->LinkDetectInfo.NumRecvBcnInPeriod=0; + ieee->LinkDetectInfo.NumRecvDataInPeriod=0; + + ieee->assoc_id = 0; + ieee->queue_stop = 0; + ieee->scanning = 0; + ieee->softmac_features = 0; //so IEEE2100-like driver are happy + ieee->wap_set = 0; + ieee->ssid_set = 0; + ieee->proto_started = 0; + ieee->basic_rate = IEEE80211_DEFAULT_BASIC_RATE; + ieee->rate = 22; + ieee->ps = IEEE80211_PS_DISABLED; + ieee->sta_sleep = 0; + ieee->Regdot11HTOperationalRateSet[0]= 0xff;//support MCS 0~7 + ieee->Regdot11HTOperationalRateSet[1]= 0xff;//support MCS 8~15 + ieee->Regdot11HTOperationalRateSet[4]= 0x01; + //added by amy + ieee->actscanning = false; + ieee->beinretry = false; + ieee->is_set_key = false; + init_mgmt_queue(ieee); + + ieee->sta_edca_param[0] = 0x0000A403; + ieee->sta_edca_param[1] = 0x0000A427; + ieee->sta_edca_param[2] = 0x005E4342; + ieee->sta_edca_param[3] = 0x002F3262; + ieee->aggregation = true; + ieee->enable_rx_imm_BA = 1; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + init_timer(&ieee->scan_timer); + ieee->scan_timer.data = (unsigned long)ieee; + ieee->scan_timer.function = ieee80211_softmac_scan_cb; +#endif + ieee->tx_pending.txb = NULL; + + init_timer(&ieee->associate_timer); + ieee->associate_timer.data = (unsigned long)ieee; + ieee->associate_timer.function = ieee80211_associate_abort_cb; + + init_timer(&ieee->beacon_timer); + ieee->beacon_timer.data = (unsigned long) ieee; + ieee->beacon_timer.function = ieee80211_send_beacon_cb; + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) +#ifdef PF_SYNCTHREAD + ieee->wq = create_workqueue(DRV_NAME,0); +#else + ieee->wq = create_workqueue(DRV_NAME); +#endif +#endif + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) + INIT_DELAYED_WORK(&ieee->start_ibss_wq,ieee80211_start_ibss_wq); + INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq); + INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq); + INIT_DELAYED_WORK(&ieee->softmac_scan_wq,ieee80211_softmac_scan_wq); + INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq); + INIT_WORK(&ieee->wx_sync_scan_wq,ieee80211_wx_sync_scan_wq); + +#else + INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee); + INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee); + INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee); + INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee); + INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee); + INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee); +#endif + +#else + tq_init(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee); + tq_init(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee); + tq_init(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee); + tq_init(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee); + tq_init(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee); + tq_init(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee); +#endif + sema_init(&ieee->wx_sem, 1); + sema_init(&ieee->scan_sem, 1); + + spin_lock_init(&ieee->mgmt_tx_lock); + spin_lock_init(&ieee->beacon_lock); + + tasklet_init(&ieee->ps_task, + (void(*)(unsigned long)) ieee80211_sta_ps, + (unsigned long)ieee); + +} + +void ieee80211_softmac_free(struct ieee80211_device *ieee) +{ + down(&ieee->wx_sem); +#ifdef ENABLE_DOT11D + if(NULL != ieee->pDot11dInfo) + { + kfree(ieee->pDot11dInfo); + ieee->pDot11dInfo = NULL; + } +#endif + del_timer_sync(&ieee->associate_timer); + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + cancel_delayed_work(&ieee->associate_retry_wq); + destroy_workqueue(ieee->wq); +#endif + + up(&ieee->wx_sem); +} + +/******************************************************** + * Start of WPA code. * + * this is stolen from the ipw2200 driver * + ********************************************************/ + + +static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value) +{ + /* This is called when wpa_supplicant loads and closes the driver + * interface. */ + printk("%s WPA\n",value ? "enabling" : "disabling"); + ieee->wpa_enabled = value; + return 0; +} + + +void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len) +{ + /* make sure WPA is enabled */ + ieee80211_wpa_enable(ieee, 1); + + ieee80211_disassociate(ieee); +} + + +static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason) +{ + + int ret = 0; + + switch (command) { + case IEEE_MLME_STA_DEAUTH: + // silently ignore + break; + + case IEEE_MLME_STA_DISASSOC: + ieee80211_disassociate(ieee); + break; + + default: + printk("Unknown MLME request: %d\n", command); + ret = -EOPNOTSUPP; + } + + return ret; +} + + +static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee, + struct ieee_param *param, int plen) +{ + u8 *buf; + + if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || + (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL)) + return -EINVAL; + + if (param->u.wpa_ie.len) { + buf = kmalloc(param->u.wpa_ie.len, GFP_KERNEL); + if (buf == NULL) + return -ENOMEM; + + memcpy(buf, param->u.wpa_ie.data, param->u.wpa_ie.len); + kfree(ieee->wpa_ie); + ieee->wpa_ie = buf; + ieee->wpa_ie_len = param->u.wpa_ie.len; + } else { + kfree(ieee->wpa_ie); + ieee->wpa_ie = NULL; + ieee->wpa_ie_len = 0; + } + + ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len); + return 0; +} + +#define AUTH_ALG_OPEN_SYSTEM 0x1 +#define AUTH_ALG_SHARED_KEY 0x2 + +static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value) +{ + + struct ieee80211_security sec = { + .flags = SEC_AUTH_MODE, + }; + int ret = 0; + + if (value & AUTH_ALG_SHARED_KEY) { + sec.auth_mode = WLAN_AUTH_SHARED_KEY; + ieee->open_wep = 0; + ieee->auth_mode = 1; + } else if (value & AUTH_ALG_OPEN_SYSTEM){ + sec.auth_mode = WLAN_AUTH_OPEN; + ieee->open_wep = 1; + ieee->auth_mode = 0; + } + else if (value & IW_AUTH_ALG_LEAP){ + sec.auth_mode = WLAN_AUTH_LEAP; + ieee->open_wep = 1; + ieee->auth_mode = 2; + } + + + if (ieee->set_security) + ieee->set_security(ieee->dev, &sec); + //else + // ret = -EOPNOTSUPP; + + return ret; +} + +static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value) +{ + int ret=0; + unsigned long flags; + + switch (name) { + case IEEE_PARAM_WPA_ENABLED: + ret = ieee80211_wpa_enable(ieee, value); + break; + + case IEEE_PARAM_TKIP_COUNTERMEASURES: + ieee->tkip_countermeasures=value; + break; + + case IEEE_PARAM_DROP_UNENCRYPTED: { + /* HACK: + * + * wpa_supplicant calls set_wpa_enabled when the driver + * is loaded and unloaded, regardless of if WPA is being + * used. No other calls are made which can be used to + * determine if encryption will be used or not prior to + * association being expected. If encryption is not being + * used, drop_unencrypted is set to false, else true -- we + * can use this to determine if the CAP_PRIVACY_ON bit should + * be set. + */ + struct ieee80211_security sec = { + .flags = SEC_ENABLED, + .enabled = value, + }; + ieee->drop_unencrypted = value; + /* We only change SEC_LEVEL for open mode. Others + * are set by ipw_wpa_set_encryption. + */ + if (!value) { + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_0; + } + else { + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_1; + } + if (ieee->set_security) + ieee->set_security(ieee->dev, &sec); + break; + } + + case IEEE_PARAM_PRIVACY_INVOKED: + ieee->privacy_invoked=value; + break; + + case IEEE_PARAM_AUTH_ALGS: + ret = ieee80211_wpa_set_auth_algs(ieee, value); + break; + + case IEEE_PARAM_IEEE_802_1X: + ieee->ieee802_1x=value; + break; + case IEEE_PARAM_WPAX_SELECT: + // added for WPA2 mixed mode + spin_lock_irqsave(&ieee->wpax_suitlist_lock,flags); + ieee->wpax_type_set = 1; + ieee->wpax_type_notify = value; + spin_unlock_irqrestore(&ieee->wpax_suitlist_lock,flags); + break; + + default: + printk("Unknown WPA param: %d\n",name); + ret = -EOPNOTSUPP; + } + + return ret; +} + +/* implementation borrowed from hostap driver */ + +static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee, + struct ieee_param *param, int param_len) +{ + int ret = 0; + + struct ieee80211_crypto_ops *ops; + struct ieee80211_crypt_data **crypt; + + struct ieee80211_security sec = { + .flags = 0, + }; + + param->u.crypt.err = 0; + param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; + + if (param_len != + (int) ((char *) param->u.crypt.key - (char *) param) + + param->u.crypt.key_len) { + printk("Len mismatch %d, %d\n", param_len, + param->u.crypt.key_len); + return -EINVAL; + } + if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && + param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { + if (param->u.crypt.idx >= WEP_KEYS) + return -EINVAL; + crypt = &ieee->crypt[param->u.crypt.idx]; + } else { + return -EINVAL; + } + + if (strcmp(param->u.crypt.alg, "none") == 0) { + if (crypt) { + sec.enabled = 0; + // FIXME FIXME + //sec.encrypt = 0; + sec.level = SEC_LEVEL_0; + sec.flags |= SEC_ENABLED | SEC_LEVEL; + ieee80211_crypt_delayed_deinit(ieee, crypt); + } + goto done; + } + sec.enabled = 1; +// FIXME FIXME +// sec.encrypt = 1; + sec.flags |= SEC_ENABLED; + + /* IPW HW cannot build TKIP MIC, host decryption still needed. */ + if (!(ieee->host_encrypt || ieee->host_decrypt) && + strcmp(param->u.crypt.alg, "TKIP")) + goto skip_host_crypt; + + ops = ieee80211_get_crypto_ops(param->u.crypt.alg); + if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { + request_module("ieee80211_crypt_wep"); + ops = ieee80211_get_crypto_ops(param->u.crypt.alg); + //set WEP40 first, it will be modified according to WEP104 or WEP40 at other place + } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) { + request_module("ieee80211_crypt_tkip"); + ops = ieee80211_get_crypto_ops(param->u.crypt.alg); + } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) { + request_module("ieee80211_crypt_ccmp"); + ops = ieee80211_get_crypto_ops(param->u.crypt.alg); + } + if (ops == NULL) { + printk("unknown crypto alg '%s'\n", param->u.crypt.alg); + param->u.crypt.err = IEEE_CRYPT_ERR_UNKNOWN_ALG; + ret = -EINVAL; + goto done; + } + + if (*crypt == NULL || (*crypt)->ops != ops) { + struct ieee80211_crypt_data *new_crypt; + + ieee80211_crypt_delayed_deinit(ieee, crypt); + + new_crypt = (struct ieee80211_crypt_data *) + kmalloc(sizeof(*new_crypt), GFP_KERNEL); + if (new_crypt == NULL) { + ret = -ENOMEM; + goto done; + } + memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); + new_crypt->ops = ops; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) + if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) +#else + if (new_crypt->ops && try_inc_mod_count(new_crypt->ops->owner)) +#endif + new_crypt->priv = + new_crypt->ops->init(param->u.crypt.idx); + + if (new_crypt->priv == NULL) { + kfree(new_crypt); + param->u.crypt.err = IEEE_CRYPT_ERR_CRYPT_INIT_FAILED; + ret = -EINVAL; + goto done; + } + + *crypt = new_crypt; + } + + if (param->u.crypt.key_len > 0 && (*crypt)->ops->set_key && + (*crypt)->ops->set_key(param->u.crypt.key, + param->u.crypt.key_len, param->u.crypt.seq, + (*crypt)->priv) < 0) { + printk("key setting failed\n"); + param->u.crypt.err = IEEE_CRYPT_ERR_KEY_SET_FAILED; + ret = -EINVAL; + goto done; + } + + skip_host_crypt: + if (param->u.crypt.set_tx) { + ieee->tx_keyidx = param->u.crypt.idx; + sec.active_key = param->u.crypt.idx; + sec.flags |= SEC_ACTIVE_KEY; + } else + sec.flags &= ~SEC_ACTIVE_KEY; + + if (param->u.crypt.alg != NULL) { + memcpy(sec.keys[param->u.crypt.idx], + param->u.crypt.key, + param->u.crypt.key_len); + sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len; + sec.flags |= (1 << param->u.crypt.idx); + + if (strcmp(param->u.crypt.alg, "WEP") == 0) { + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_1; + } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_2; + } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_3; + } + } + done: + if (ieee->set_security) + ieee->set_security(ieee->dev, &sec); + + /* Do not reset port if card is in Managed mode since resetting will + * generate new IEEE 802.11 authentication which may end up in looping + * with IEEE 802.1X. If your hardware requires a reset after WEP + * configuration (for example... Prism2), implement the reset_port in + * the callbacks structures used to initialize the 802.11 stack. */ + if (ieee->reset_on_keychange && + ieee->iw_mode != IW_MODE_INFRA && + ieee->reset_port && + ieee->reset_port(ieee->dev)) { + printk("reset_port failed\n"); + param->u.crypt.err = IEEE_CRYPT_ERR_CARD_CONF_FAILED; + return -EINVAL; + } + + return ret; +} + +inline struct sk_buff *ieee80211_disassociate_skb( + struct ieee80211_network *beacon, + struct ieee80211_device *ieee, + u8 asRsn) +{ + struct sk_buff *skb; + struct ieee80211_disassoc *disass; + + skb = dev_alloc_skb(sizeof(struct ieee80211_disassoc)); + if (!skb) + return NULL; + + disass = (struct ieee80211_disassoc *) skb_put(skb,sizeof(struct ieee80211_disassoc)); + disass->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_DISASSOC); + disass->header.duration_id = 0; + + memcpy(disass->header.addr1, beacon->bssid, ETH_ALEN); + memcpy(disass->header.addr2, ieee->dev->dev_addr, ETH_ALEN); + memcpy(disass->header.addr3, beacon->bssid, ETH_ALEN); + + disass->reason = asRsn; + return skb; +} + + +void +SendDisassociation( + struct ieee80211_device *ieee, + u8* asSta, + u8 asRsn +) +{ + struct ieee80211_network *beacon = &ieee->current_network; + struct sk_buff *skb; + skb = ieee80211_disassociate_skb(beacon,ieee,asRsn); + if (skb){ + softmac_mgmt_xmit(skb, ieee); + //dev_kfree_skb_any(skb);//edit by thomas + } +} + +int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p) +{ + struct ieee_param *param; + int ret=0; + + down(&ieee->wx_sem); + //IEEE_DEBUG_INFO("wpa_supplicant: len=%d\n", p->length); + + if (p->length < sizeof(struct ieee_param) || !p->pointer){ + ret = -EINVAL; + goto out; + } + + param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL); + if (param == NULL){ + ret = -ENOMEM; + goto out; + } + if (copy_from_user(param, p->pointer, p->length)) { + kfree(param); + ret = -EFAULT; + goto out; + } + + switch (param->cmd) { + + case IEEE_CMD_SET_WPA_PARAM: + ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name, + param->u.wpa_param.value); + break; + + case IEEE_CMD_SET_WPA_IE: + ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length); + break; + + case IEEE_CMD_SET_ENCRYPTION: + ret = ieee80211_wpa_set_encryption(ieee, param, p->length); + break; + + case IEEE_CMD_MLME: + ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command, + param->u.mlme.reason_code); + break; + + default: + printk("Unknown WPA supplicant request: %d\n",param->cmd); + ret = -EOPNOTSUPP; + break; + } + + if (ret == 0 && copy_to_user(p->pointer, param, p->length)) + ret = -EFAULT; + + kfree(param); +out: + up(&ieee->wx_sem); + + return ret; +} + +void notify_wx_assoc_event(struct ieee80211_device *ieee) +{ + union iwreq_data wrqu; + wrqu.ap_addr.sa_family = ARPHRD_ETHER; + if (ieee->state == IEEE80211_LINKED) + memcpy(wrqu.ap_addr.sa_data, ieee->current_network.bssid, ETH_ALEN); + else + memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); + wireless_send_event(ieee->dev, SIOCGIWAP, &wrqu, NULL); +} + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) +EXPORT_SYMBOL(ieee80211_get_beacon); +EXPORT_SYMBOL(ieee80211_wake_queue); +EXPORT_SYMBOL(ieee80211_stop_queue); +EXPORT_SYMBOL(ieee80211_reset_queue); +EXPORT_SYMBOL(ieee80211_softmac_stop_protocol); +EXPORT_SYMBOL(ieee80211_softmac_start_protocol); +EXPORT_SYMBOL(ieee80211_is_shortslot); +EXPORT_SYMBOL(ieee80211_is_54g); +EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl); +EXPORT_SYMBOL(ieee80211_ps_tx_ack); +EXPORT_SYMBOL(ieee80211_softmac_xmit); +EXPORT_SYMBOL(ieee80211_stop_send_beacons); +EXPORT_SYMBOL(notify_wx_assoc_event); +EXPORT_SYMBOL(SendDisassociation); +EXPORT_SYMBOL(ieee80211_disassociate); +EXPORT_SYMBOL(ieee80211_start_send_beacons); +EXPORT_SYMBOL(ieee80211_stop_scan); +EXPORT_SYMBOL(ieee80211_send_probe_requests); +EXPORT_SYMBOL(ieee80211_softmac_scan_syncro); +EXPORT_SYMBOL(ieee80211_start_scan_syncro); +#else +EXPORT_SYMBOL_NOVERS(ieee80211_get_beacon); +EXPORT_SYMBOL_NOVERS(ieee80211_wake_queue); +EXPORT_SYMBOL_NOVERS(ieee80211_stop_queue); +EXPORT_SYMBOL_NOVERS(ieee80211_reset_queue); +EXPORT_SYMBOL_NOVERS(ieee80211_softmac_stop_protocol); +EXPORT_SYMBOL_NOVERS(ieee80211_softmac_start_protocol); +EXPORT_SYMBOL_NOVERS(ieee80211_is_shortslot); +EXPORT_SYMBOL_NOVERS(ieee80211_is_54g); +EXPORT_SYMBOL_NOVERS(ieee80211_wpa_supplicant_ioctl); +EXPORT_SYMBOL_NOVERS(ieee80211_ps_tx_ack); +EXPORT_SYMBOL_NOVERS(ieee80211_softmac_xmit); +EXPORT_SYMBOL_NOVERS(ieee80211_stop_send_beacons); +EXPORT_SYMBOL_NOVERS(notify_wx_assoc_event); +EXPORT_SYMBOL_NOVERS(SendDisassociation); +EXPORT_SYMBOL_NOVERS(ieee80211_disassociate); +EXPORT_SYMBOL_NOVERS(ieee80211_start_send_beacons); +EXPORT_SYMBOL_NOVERS(ieee80211_stop_scan); +EXPORT_SYMBOL_NOVERS(ieee80211_send_probe_requests); +EXPORT_SYMBOL_NOVERS(ieee80211_softmac_scan_syncro); +EXPORT_SYMBOL_NOVERS(ieee80211_start_scan_syncro); +#endif +//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c new file mode 100644 index 000000000000..b96acf5546bf --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c @@ -0,0 +1,693 @@ +/* IEEE 802.11 SoftMAC layer + * Copyright (c) 2005 Andrea Merello + * + * Mostly extracted from the rtl8180-sa2400 driver for the + * in-kernel generic ieee802.11 stack. + * + * Some pieces of code might be stolen from ipw2100 driver + * copyright of who own it's copyright ;-) + * + * PS wx handler mostly stolen from hostap, copyright who + * own it's copyright ;-) + * + * released under the GPL + */ + + +#include "ieee80211.h" +#ifdef ENABLE_DOT11D +#include "dot11d.h" +#endif +/* FIXME: add A freqs */ + +const long ieee80211_wlan_frequencies[] = { + 2412, 2417, 2422, 2427, + 2432, 2437, 2442, 2447, + 2452, 2457, 2462, 2467, + 2472, 2484 +}; + + +int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b) +{ + int ret; + struct iw_freq *fwrq = & wrqu->freq; + + down(&ieee->wx_sem); + + if(ieee->iw_mode == IW_MODE_INFRA){ + ret = -EOPNOTSUPP; + goto out; + } + + /* if setting by freq convert to channel */ + if (fwrq->e == 1) { + if ((fwrq->m >= (int) 2.412e8 && + fwrq->m <= (int) 2.487e8)) { + int f = fwrq->m / 100000; + int c = 0; + + while ((c < 14) && (f != ieee80211_wlan_frequencies[c])) + c++; + + /* hack to fall through */ + fwrq->e = 0; + fwrq->m = c + 1; + } + } + + if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){ + ret = -EOPNOTSUPP; + goto out; + + }else { /* Set the channel */ + +#ifdef ENABLE_DOT11D + if (!(GET_DOT11D_INFO(ieee)->channel_map)[fwrq->m]) { + ret = -EINVAL; + goto out; + } +#endif + ieee->current_network.channel = fwrq->m; + ieee->set_chan(ieee->dev, ieee->current_network.channel); + + if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) + if(ieee->state == IEEE80211_LINKED){ + + ieee80211_stop_send_beacons(ieee); + ieee80211_start_send_beacons(ieee); + } + } + + ret = 0; +out: + up(&ieee->wx_sem); + return ret; +} + + +int ieee80211_wx_get_freq(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b) +{ + struct iw_freq *fwrq = & wrqu->freq; + + if (ieee->current_network.channel == 0) + return -1; + //NM 0.7.0 will not accept channel any more. + fwrq->m = ieee80211_wlan_frequencies[ieee->current_network.channel-1] * 100000; + fwrq->e = 1; +// fwrq->m = ieee->current_network.channel; +// fwrq->e = 0; + + return 0; +} + +int ieee80211_wx_get_wap(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + unsigned long flags; + + wrqu->ap_addr.sa_family = ARPHRD_ETHER; + + if (ieee->iw_mode == IW_MODE_MONITOR) + return -1; + + /* We want avoid to give to the user inconsistent infos*/ + spin_lock_irqsave(&ieee->lock, flags); + + if (ieee->state != IEEE80211_LINKED && + ieee->state != IEEE80211_LINKED_SCANNING && + ieee->wap_set == 0) + + memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); + else + memcpy(wrqu->ap_addr.sa_data, + ieee->current_network.bssid, ETH_ALEN); + + spin_unlock_irqrestore(&ieee->lock, flags); + + return 0; +} + + +int ieee80211_wx_set_wap(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *awrq, + char *extra) +{ + + int ret = 0; + u8 zero[] = {0,0,0,0,0,0}; + unsigned long flags; + + short ifup = ieee->proto_started;//dev->flags & IFF_UP; + struct sockaddr *temp = (struct sockaddr *)awrq; + + ieee->sync_scan_hurryup = 1; + + down(&ieee->wx_sem); + /* use ifconfig hw ether */ + if (ieee->iw_mode == IW_MODE_MASTER){ + ret = -1; + goto out; + } + + if (temp->sa_family != ARPHRD_ETHER){ + ret = -EINVAL; + goto out; + } + + if (ifup) + ieee80211_stop_protocol(ieee); + + /* just to avoid to give inconsistent infos in the + * get wx method. not really needed otherwise + */ + spin_lock_irqsave(&ieee->lock, flags); + + memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN); + ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0; + + spin_unlock_irqrestore(&ieee->lock, flags); + + if (ifup) + ieee80211_start_protocol(ieee); +out: + up(&ieee->wx_sem); + return ret; +} + + int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b) +{ + int len,ret = 0; + unsigned long flags; + + if (ieee->iw_mode == IW_MODE_MONITOR) + return -1; + + /* We want avoid to give to the user inconsistent infos*/ + spin_lock_irqsave(&ieee->lock, flags); + + if (ieee->current_network.ssid[0] == '\0' || + ieee->current_network.ssid_len == 0){ + ret = -1; + goto out; + } + + if (ieee->state != IEEE80211_LINKED && + ieee->state != IEEE80211_LINKED_SCANNING && + ieee->ssid_set == 0){ + ret = -1; + goto out; + } + len = ieee->current_network.ssid_len; + wrqu->essid.length = len; + strncpy(b,ieee->current_network.ssid,len); + wrqu->essid.flags = 1; + +out: + spin_unlock_irqrestore(&ieee->lock, flags); + + return ret; + +} + +int ieee80211_wx_set_rate(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + + u32 target_rate = wrqu->bitrate.value; + + ieee->rate = target_rate/100000; + //FIXME: we might want to limit rate also in management protocols. + return 0; +} + + + +int ieee80211_wx_get_rate(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + u32 tmp_rate; +#if 0 + printk("===>mode:%d, halfNmode:%d\n", ieee->mode, ieee->bHalfWirelessN24GMode); + if (ieee->mode & (IEEE_A | IEEE_B | IEEE_G)) + tmp_rate = ieee->rate; + else if (ieee->mode & IEEE_N_5G) + tmp_rate = 580; + else if (ieee->mode & IEEE_N_24G) + { + if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) + tmp_rate = HTHalfMcsToDataRate(ieee, 15); + else + tmp_rate = HTMcsToDataRate(ieee, 15); + } +#else + tmp_rate = TxCountToDataRate(ieee, ieee->softmac_stats.CurrentShowTxate); + +#endif + wrqu->bitrate.value = tmp_rate * 500000; + + return 0; +} + + +int ieee80211_wx_set_rts(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + if (wrqu->rts.disabled || !wrqu->rts.fixed) + ieee->rts = DEFAULT_RTS_THRESHOLD; + else + { + if (wrqu->rts.value < MIN_RTS_THRESHOLD || + wrqu->rts.value > MAX_RTS_THRESHOLD) + return -EINVAL; + ieee->rts = wrqu->rts.value; + } + return 0; +} + +int ieee80211_wx_get_rts(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + wrqu->rts.value = ieee->rts; + wrqu->rts.fixed = 0; /* no auto select */ + wrqu->rts.disabled = (wrqu->rts.value == DEFAULT_RTS_THRESHOLD); + return 0; +} +int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b) +{ + + ieee->sync_scan_hurryup = 1; + + down(&ieee->wx_sem); + + if (wrqu->mode == ieee->iw_mode) + goto out; + + if (wrqu->mode == IW_MODE_MONITOR){ + + ieee->dev->type = ARPHRD_IEEE80211; + }else{ + ieee->dev->type = ARPHRD_ETHER; + } + + if (!ieee->proto_started){ + ieee->iw_mode = wrqu->mode; + }else{ + ieee80211_stop_protocol(ieee); + ieee->iw_mode = wrqu->mode; + ieee80211_start_protocol(ieee); + } + +out: + up(&ieee->wx_sem); + return 0; +} + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) +void ieee80211_wx_sync_scan_wq(struct work_struct *work) +{ + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq); +#else +void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee) +{ +#endif + short chan; + HT_EXTCHNL_OFFSET chan_offset=0; + HT_CHANNEL_WIDTH bandwidth=0; + int b40M = 0; + static int count = 0; + chan = ieee->current_network.channel; + netif_carrier_off(ieee->dev); + + if (ieee->data_hard_stop) + ieee->data_hard_stop(ieee->dev); + + ieee80211_stop_send_beacons(ieee); + + ieee->state = IEEE80211_LINKED_SCANNING; + ieee->link_change(ieee->dev); + ieee->InitialGainHandler(ieee->dev,IG_Backup); + if (ieee->pHTInfo->bCurrentHTSupport && ieee->pHTInfo->bEnableHT && ieee->pHTInfo->bCurBW40MHz) { + b40M = 1; + chan_offset = ieee->pHTInfo->CurSTAExtChnlOffset; + bandwidth = (HT_CHANNEL_WIDTH)ieee->pHTInfo->bCurBW40MHz; + printk("Scan in 40M, force to 20M first:%d, %d\n", chan_offset, bandwidth); + ieee->SetBWModeHandler(ieee->dev, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); + } + ieee80211_start_scan_syncro(ieee); + if (b40M) { + printk("Scan in 20M, back to 40M\n"); + if (chan_offset == HT_EXTCHNL_OFFSET_UPPER) + ieee->set_chan(ieee->dev, chan + 2); + else if (chan_offset == HT_EXTCHNL_OFFSET_LOWER) + ieee->set_chan(ieee->dev, chan - 2); + else + ieee->set_chan(ieee->dev, chan); + ieee->SetBWModeHandler(ieee->dev, bandwidth, chan_offset); + } else { + ieee->set_chan(ieee->dev, chan); + } + + ieee->InitialGainHandler(ieee->dev,IG_Restore); + ieee->state = IEEE80211_LINKED; + ieee->link_change(ieee->dev); + // To prevent the immediately calling watch_dog after scan. + if(ieee->LinkDetectInfo.NumRecvBcnInPeriod==0||ieee->LinkDetectInfo.NumRecvDataInPeriod==0 ) + { + ieee->LinkDetectInfo.NumRecvBcnInPeriod = 1; + ieee->LinkDetectInfo.NumRecvDataInPeriod= 1; + } + if (ieee->data_hard_resume) + ieee->data_hard_resume(ieee->dev); + + if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) + ieee80211_start_send_beacons(ieee); + + netif_carrier_on(ieee->dev); + count = 0; + up(&ieee->wx_sem); + +} + +int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b) +{ + int ret = 0; + + down(&ieee->wx_sem); + + if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){ + ret = -1; + goto out; + } + + if ( ieee->state == IEEE80211_LINKED){ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + queue_work(ieee->wq, &ieee->wx_sync_scan_wq); +#else + schedule_task(&ieee->wx_sync_scan_wq); +#endif + /* intentionally forget to up sem */ + return 0; + } + +out: + up(&ieee->wx_sem); + return ret; +} + +int ieee80211_wx_set_essid(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *extra) +{ + + int ret=0,len; + short proto_started; + unsigned long flags; + + ieee->sync_scan_hurryup = 1; + down(&ieee->wx_sem); + + proto_started = ieee->proto_started; + + if (wrqu->essid.length > IW_ESSID_MAX_SIZE){ + ret= -E2BIG; + goto out; + } + + if (ieee->iw_mode == IW_MODE_MONITOR){ + ret= -1; + goto out; + } + + if(proto_started) + ieee80211_stop_protocol(ieee); + + + /* this is just to be sure that the GET wx callback + * has consisten infos. not needed otherwise + */ + spin_lock_irqsave(&ieee->lock, flags); + + if (wrqu->essid.flags && wrqu->essid.length) { + //first flush current network.ssid + len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) + strncpy(ieee->current_network.ssid, extra, len); + ieee->current_network.ssid_len = len; +#if 0 + { + int i; + for (i=0; icurrent_network.ssid, extra, len+1); + ieee->current_network.ssid_len = len+1; +#if 0 + { + int i; + for (i=0; issid_set = 1; + } + else{ + ieee->ssid_set = 0; + ieee->current_network.ssid[0] = '\0'; + ieee->current_network.ssid_len = 0; + } + spin_unlock_irqrestore(&ieee->lock, flags); + + if (proto_started) + ieee80211_start_protocol(ieee); +out: + up(&ieee->wx_sem); + return ret; +} + + int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b) +{ + + wrqu->mode = ieee->iw_mode; + return 0; +} + + int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + + int *parms = (int *)extra; + int enable = (parms[0] > 0); + short prev = ieee->raw_tx; + + down(&ieee->wx_sem); + + if(enable) + ieee->raw_tx = 1; + else + ieee->raw_tx = 0; + + printk(KERN_INFO"raw TX is %s\n", + ieee->raw_tx ? "enabled" : "disabled"); + + if(ieee->iw_mode == IW_MODE_MONITOR) + { + if(prev == 0 && ieee->raw_tx){ + if (ieee->data_hard_resume) + ieee->data_hard_resume(ieee->dev); + + netif_carrier_on(ieee->dev); + } + + if(prev && ieee->raw_tx == 1) + netif_carrier_off(ieee->dev); + } + + up(&ieee->wx_sem); + + return 0; +} + +int ieee80211_wx_get_name(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + strcpy(wrqu->name, "802.11"); + if(ieee->modulation & IEEE80211_CCK_MODULATION){ + strcat(wrqu->name, "b"); + if(ieee->modulation & IEEE80211_OFDM_MODULATION) + strcat(wrqu->name, "/g"); + }else if(ieee->modulation & IEEE80211_OFDM_MODULATION) + strcat(wrqu->name, "g"); + if (ieee->mode & (IEEE_N_24G | IEEE_N_5G)) + strcat(wrqu->name, "/n"); + + if((ieee->state == IEEE80211_LINKED) || + (ieee->state == IEEE80211_LINKED_SCANNING)) + strcat(wrqu->name," linked"); + else if(ieee->state != IEEE80211_NOLINK) + strcat(wrqu->name," link.."); + + + return 0; +} + + +/* this is mostly stolen from hostap */ +int ieee80211_wx_set_power(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + int ret = 0; +#if 0 + if( + (!ieee->sta_wake_up) || + (!ieee->ps_request_tx_ack) || + (!ieee->enter_sleep_state) || + (!ieee->ps_is_queue_empty)){ + + // printk("ERROR. PS mode is tryied to be use but driver missed a callback\n\n"); + + return -1; + } +#endif + down(&ieee->wx_sem); + + if (wrqu->power.disabled){ + ieee->ps = IEEE80211_PS_DISABLED; + goto exit; + } + if (wrqu->power.flags & IW_POWER_TIMEOUT) { + //ieee->ps_period = wrqu->power.value / 1000; + ieee->ps_timeout = wrqu->power.value / 1000; + } + + if (wrqu->power.flags & IW_POWER_PERIOD) { + + //ieee->ps_timeout = wrqu->power.value / 1000; + ieee->ps_period = wrqu->power.value / 1000; + //wrq->value / 1024; + + } + switch (wrqu->power.flags & IW_POWER_MODE) { + case IW_POWER_UNICAST_R: + ieee->ps = IEEE80211_PS_UNICAST; + break; + case IW_POWER_MULTICAST_R: + ieee->ps = IEEE80211_PS_MBCAST; + break; + case IW_POWER_ALL_R: + ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST; + break; + + case IW_POWER_ON: + // ieee->ps = IEEE80211_PS_DISABLED; + break; + + default: + ret = -EINVAL; + goto exit; + + } +exit: + up(&ieee->wx_sem); + return ret; + +} + +/* this is stolen from hostap */ +int ieee80211_wx_get_power(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + int ret =0; + + down(&ieee->wx_sem); + + if(ieee->ps == IEEE80211_PS_DISABLED){ + wrqu->power.disabled = 1; + goto exit; + } + + wrqu->power.disabled = 0; + + if ((wrqu->power.flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { + wrqu->power.flags = IW_POWER_TIMEOUT; + wrqu->power.value = ieee->ps_timeout * 1000; + } else { +// ret = -EOPNOTSUPP; +// goto exit; + wrqu->power.flags = IW_POWER_PERIOD; + wrqu->power.value = ieee->ps_period * 1000; +//ieee->current_network.dtim_period * ieee->current_network.beacon_interval * 1024; + } + + if ((ieee->ps & (IEEE80211_PS_MBCAST | IEEE80211_PS_UNICAST)) == (IEEE80211_PS_MBCAST | IEEE80211_PS_UNICAST)) + wrqu->power.flags |= IW_POWER_ALL_R; + else if (ieee->ps & IEEE80211_PS_MBCAST) + wrqu->power.flags |= IW_POWER_MULTICAST_R; + else + wrqu->power.flags |= IW_POWER_UNICAST_R; + +exit: + up(&ieee->wx_sem); + return ret; + +} +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) +EXPORT_SYMBOL(ieee80211_wx_get_essid); +EXPORT_SYMBOL(ieee80211_wx_set_essid); +EXPORT_SYMBOL(ieee80211_wx_set_rate); +EXPORT_SYMBOL(ieee80211_wx_get_rate); +EXPORT_SYMBOL(ieee80211_wx_set_wap); +EXPORT_SYMBOL(ieee80211_wx_get_wap); +EXPORT_SYMBOL(ieee80211_wx_set_mode); +EXPORT_SYMBOL(ieee80211_wx_get_mode); +EXPORT_SYMBOL(ieee80211_wx_set_scan); +EXPORT_SYMBOL(ieee80211_wx_get_freq); +EXPORT_SYMBOL(ieee80211_wx_set_freq); +EXPORT_SYMBOL(ieee80211_wx_set_rawtx); +EXPORT_SYMBOL(ieee80211_wx_get_name); +EXPORT_SYMBOL(ieee80211_wx_set_power); +EXPORT_SYMBOL(ieee80211_wx_get_power); +EXPORT_SYMBOL(ieee80211_wlan_frequencies); +EXPORT_SYMBOL(ieee80211_wx_set_rts); +EXPORT_SYMBOL(ieee80211_wx_get_rts); +#else +EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_essid); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_essid); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_rate); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_rate); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_wap); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_wap); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_mode); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_mode); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_scan); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_freq); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_freq); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_rawtx); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_name); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_power); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_power); +EXPORT_SYMBOL_NOVERS(ieee80211_wlan_frequencies); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_rts); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_rts); +#endif diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c new file mode 100644 index 000000000000..b64e4cb0afe8 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c @@ -0,0 +1,929 @@ +/****************************************************************************** + + Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. + + This program is free software; you can redistribute it and/or modify it + under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + 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., 59 + Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + The full GNU General Public License is included in this distribution in the + file called LICENSE. + + Contact Information: + James P. Ketrenos + Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + +****************************************************************************** + + Few modifications for Realtek's Wi-Fi drivers by + Andrea Merello + + A special thanks goes to Realtek for their support ! + +******************************************************************************/ + +#include +//#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ieee80211.h" + + +/* + + +802.11 Data Frame + + +802.11 frame_contorl for data frames - 2 bytes + ,-----------------------------------------------------------------------------------------. +bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | + |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| +val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x | + |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| +desc | ^-ver-^ | ^type-^ | ^-----subtype-----^ | to |from |more |retry| pwr |more |wep | + | | | x=0 data,x=1 data+ack | DS | DS |frag | | mgm |data | | + '-----------------------------------------------------------------------------------------' + /\ + | +802.11 Data Frame | + ,--------- 'ctrl' expands to >-----------' + | + ,--'---,-------------------------------------------------------------. +Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | + |------|------|---------|---------|---------|------|---------|------| +Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs | + | | tion | (BSSID) | | | ence | data | | + `--------------------------------------------------| |------' +Total: 28 non-data bytes `----.----' + | + .- 'Frame data' expands to <---------------------------' + | + V + ,---------------------------------------------------. +Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 | + |------|------|---------|----------|------|---------| +Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | + | DSAP | SSAP | | | | Packet | + | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | + `-----------------------------------------| | +Total: 8 non-data bytes `----.----' + | + .- 'IP Packet' expands, if WEP enabled, to <--' + | + V + ,-----------------------. +Bytes | 4 | 0-2296 | 4 | + |-----|-----------|-----| +Desc. | IV | Encrypted | ICV | + | | IP Packet | | + `-----------------------' +Total: 8 non-data bytes + + +802.3 Ethernet Data Frame + + ,-----------------------------------------. +Bytes | 6 | 6 | 2 | Variable | 4 | + |-------|-------|------|-----------|------| +Desc. | Dest. | Source| Type | IP Packet | fcs | + | MAC | MAC | | | | + `-----------------------------------------' +Total: 18 non-data bytes + +In the event that fragmentation is required, the incoming payload is split into +N parts of size ieee->fts. The first fragment contains the SNAP header and the +remaining packets are just data. + +If encryption is enabled, each fragment payload size is reduced by enough space +to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP) +So if you have 1500 bytes of payload with ieee->fts set to 500 without +encryption it will take 3 frames. With WEP it will take 4 frames as the +payload of each frame is reduced to 492 bytes. + +* SKB visualization +* +* ,- skb->data +* | +* | ETHERNET HEADER ,-<-- PAYLOAD +* | | 14 bytes from skb->data +* | 2 bytes for Type --> ,T. | (sizeof ethhdr) +* | | | | +* |,-Dest.--. ,--Src.---. | | | +* | 6 bytes| | 6 bytes | | | | +* v | | | | | | +* 0 | v 1 | v | v 2 +* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +* ^ | ^ | ^ | +* | | | | | | +* | | | | `T' <---- 2 bytes for Type +* | | | | +* | | '---SNAP--' <-------- 6 bytes for SNAP +* | | +* `-IV--' <-------------------- 4 bytes for IV (WEP) +* +* SNAP HEADER +* +*/ + +static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; +static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; + +static inline int ieee80211_put_snap(u8 *data, u16 h_proto) +{ + struct ieee80211_snap_hdr *snap; + u8 *oui; + + snap = (struct ieee80211_snap_hdr *)data; + snap->dsap = 0xaa; + snap->ssap = 0xaa; + snap->ctrl = 0x03; + + if (h_proto == 0x8137 || h_proto == 0x80f3) + oui = P802_1H_OUI; + else + oui = RFC1042_OUI; + snap->oui[0] = oui[0]; + snap->oui[1] = oui[1]; + snap->oui[2] = oui[2]; + + *(u16 *)(data + SNAP_SIZE) = htons(h_proto); + + return SNAP_SIZE + sizeof(u16); +} + +int ieee80211_encrypt_fragment( + struct ieee80211_device *ieee, + struct sk_buff *frag, + int hdr_len) +{ + struct ieee80211_crypt_data* crypt = ieee->crypt[ieee->tx_keyidx]; + int res; + + if (!(crypt && crypt->ops)) + { + printk("=========>%s(), crypt is null\n", __FUNCTION__); + return -1; + } +#ifdef CONFIG_IEEE80211_CRYPT_TKIP + struct ieee80211_hdr *header; + + if (ieee->tkip_countermeasures && + crypt && crypt->ops && strcmp(crypt->ops->name, "TKIP") == 0) { + header = (struct ieee80211_hdr *) frag->data; + if (net_ratelimit()) { + printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " + "TX packet to " MAC_FMT "\n", + ieee->dev->name, MAC_ARG(header->addr1)); + } + return -1; + } +#endif + /* To encrypt, frame format is: + * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */ + + // PR: FIXME: Copied from hostap. Check fragmentation/MSDU/MPDU encryption. + /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so + * call both MSDU and MPDU encryption functions from here. */ + atomic_inc(&crypt->refcnt); + res = 0; + if (crypt->ops->encrypt_msdu) + res = crypt->ops->encrypt_msdu(frag, hdr_len, crypt->priv); + if (res == 0 && crypt->ops->encrypt_mpdu) + res = crypt->ops->encrypt_mpdu(frag, hdr_len, crypt->priv); + + atomic_dec(&crypt->refcnt); + if (res < 0) { + printk(KERN_INFO "%s: Encryption failed: len=%d.\n", + ieee->dev->name, frag->len); + ieee->ieee_stats.tx_discards++; + return -1; + } + + return 0; +} + + +void ieee80211_txb_free(struct ieee80211_txb *txb) { + //int i; + if (unlikely(!txb)) + return; +#if 0 + for (i = 0; i < txb->nr_frags; i++) + if (txb->fragments[i]) + dev_kfree_skb_any(txb->fragments[i]); +#endif + kfree(txb); +} + +struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, + int gfp_mask) +{ + struct ieee80211_txb *txb; + int i; + txb = kmalloc( + sizeof(struct ieee80211_txb) + (sizeof(u8*) * nr_frags), + gfp_mask); + if (!txb) + return NULL; + + memset(txb, 0, sizeof(struct ieee80211_txb)); + txb->nr_frags = nr_frags; + txb->frag_size = txb_size; + + for (i = 0; i < nr_frags; i++) { + txb->fragments[i] = dev_alloc_skb(txb_size); + if (unlikely(!txb->fragments[i])) { + i--; + break; + } + memset(txb->fragments[i]->cb, 0, sizeof(txb->fragments[i]->cb)); + } + if (unlikely(i != nr_frags)) { + while (i >= 0) + dev_kfree_skb_any(txb->fragments[i--]); + kfree(txb); + return NULL; + } + return txb; +} + +// Classify the to-be send data packet +// Need to acquire the sent queue index. +static int +ieee80211_classify(struct sk_buff *skb, struct ieee80211_network *network) +{ + struct ethhdr *eth; + struct iphdr *ip; + eth = (struct ethhdr *)skb->data; + if (eth->h_proto != htons(ETH_P_IP)) + return 0; + +// IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)) + ip = ip_hdr(skb); +#else + ip = (struct iphdr*)(skb->data + sizeof(struct ether_header)); +#endif + switch (ip->tos & 0xfc) { + case 0x20: + return 2; + case 0x40: + return 1; + case 0x60: + return 3; + case 0x80: + return 4; + case 0xa0: + return 5; + case 0xc0: + return 6; + case 0xe0: + return 7; + default: + return 0; + } +} + +#define SN_LESS(a, b) (((a-b)&0x800)!=0) +void ieee80211_tx_query_agg_cap(struct ieee80211_device* ieee, struct sk_buff* skb, cb_desc* tcb_desc) +{ + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; + PTX_TS_RECORD pTxTs = NULL; + struct ieee80211_hdr_1addr* hdr = (struct ieee80211_hdr_1addr*)skb->data; + + if (!pHTInfo->bCurrentHTSupport||!pHTInfo->bEnableHT) + return; + if (!IsQoSDataFrame(skb->data)) + return; + + if (is_multicast_ether_addr(hdr->addr1) || is_broadcast_ether_addr(hdr->addr1)) + return; + //check packet and mode later +#ifdef TO_DO_LIST + if(pTcb->PacketLength >= 4096) + return; + // For RTL819X, if pairwisekey = wep/tkip, we don't aggrregation. + if(!Adapter->HalFunc.GetNmodeSupportBySecCfgHandler(Adapter)) + return; +#endif +#if 1 + if(!ieee->GetNmodeSupportBySecCfg(ieee->dev)) + { + return; + } +#endif + if(pHTInfo->bCurrentAMPDUEnable) + { + if (!GetTs(ieee, (PTS_COMMON_INFO*)(&pTxTs), hdr->addr1, skb->priority, TX_DIR, true)) + { + printk("===>can't get TS\n"); + return; + } + if (pTxTs->TxAdmittedBARecord.bValid == false) + { + TsStartAddBaProcess(ieee, pTxTs); + goto FORCED_AGG_SETTING; + } + else if (pTxTs->bUsingBa == false) + { + if (SN_LESS(pTxTs->TxAdmittedBARecord.BaStartSeqCtrl.field.SeqNum, (pTxTs->TxCurSeq+1)%4096)) + pTxTs->bUsingBa = true; + else + goto FORCED_AGG_SETTING; + } + + if (ieee->iw_mode == IW_MODE_INFRA) + { + tcb_desc->bAMPDUEnable = true; + tcb_desc->ampdu_factor = pHTInfo->CurrentAMPDUFactor; + tcb_desc->ampdu_density = pHTInfo->CurrentMPDUDensity; + } + } +FORCED_AGG_SETTING: + switch(pHTInfo->ForcedAMPDUMode ) + { + case HT_AGG_AUTO: + break; + + case HT_AGG_FORCE_ENABLE: + tcb_desc->bAMPDUEnable = true; + tcb_desc->ampdu_density = pHTInfo->ForcedMPDUDensity; + tcb_desc->ampdu_factor = pHTInfo->ForcedAMPDUFactor; + break; + + case HT_AGG_FORCE_DISABLE: + tcb_desc->bAMPDUEnable = false; + tcb_desc->ampdu_density = 0; + tcb_desc->ampdu_factor = 0; + break; + + } + return; +} + +extern void ieee80211_qurey_ShortPreambleMode(struct ieee80211_device* ieee, cb_desc* tcb_desc) +{ + tcb_desc->bUseShortPreamble = false; + if (tcb_desc->data_rate == 2) + {//// 1M can only use Long Preamble. 11B spec + return; + } + else if (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_PREAMBLE) + { + tcb_desc->bUseShortPreamble = true; + } + return; +} +extern void +ieee80211_query_HTCapShortGI(struct ieee80211_device *ieee, cb_desc *tcb_desc) +{ + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; + + tcb_desc->bUseShortGI = false; + + if(!pHTInfo->bCurrentHTSupport||!pHTInfo->bEnableHT) + return; + + if(pHTInfo->bForcedShortGI) + { + tcb_desc->bUseShortGI = true; + return; + } + + if((pHTInfo->bCurBW40MHz==true) && pHTInfo->bCurShortGI40MHz) + tcb_desc->bUseShortGI = true; + else if((pHTInfo->bCurBW40MHz==false) && pHTInfo->bCurShortGI20MHz) + tcb_desc->bUseShortGI = true; +} + +void ieee80211_query_BandwidthMode(struct ieee80211_device* ieee, cb_desc *tcb_desc) +{ + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; + + tcb_desc->bPacketBW = false; + + if(!pHTInfo->bCurrentHTSupport||!pHTInfo->bEnableHT) + return; + + if(tcb_desc->bMulticast || tcb_desc->bBroadcast) + return; + + if((tcb_desc->data_rate & 0x80)==0) // If using legacy rate, it shall use 20MHz channel. + return; + //BandWidthAutoSwitch is for auto switch to 20 or 40 in long distance + if(pHTInfo->bCurBW40MHz && pHTInfo->bCurTxBW40MHz && !ieee->bandwidth_auto_switch.bforced_tx20Mhz) + tcb_desc->bPacketBW = true; + return; +} + +void ieee80211_query_protectionmode(struct ieee80211_device* ieee, cb_desc* tcb_desc, struct sk_buff* skb) +{ + // Common Settings + tcb_desc->bRTSSTBC = false; + tcb_desc->bRTSUseShortGI = false; // Since protection frames are always sent by legacy rate, ShortGI will never be used. + tcb_desc->bCTSEnable = false; // Most of protection using RTS/CTS + tcb_desc->RTSSC = 0; // 20MHz: Don't care; 40MHz: Duplicate. + tcb_desc->bRTSBW = false; // RTS frame bandwidth is always 20MHz + + if(tcb_desc->bBroadcast || tcb_desc->bMulticast)//only unicast frame will use rts/cts + return; + + if (is_broadcast_ether_addr(skb->data+16)) //check addr3 as infrastructure add3 is DA. + return; + + if (ieee->mode < IEEE_N_24G) //b, g mode + { + // (1) RTS_Threshold is compared to the MPDU, not MSDU. + // (2) If there are more than one frag in this MSDU, only the first frag uses protection frame. + // Other fragments are protected by previous fragment. + // So we only need to check the length of first fragment. + if (skb->len > ieee->rts) + { + tcb_desc->bRTSEnable = true; + tcb_desc->rts_rate = MGN_24M; + } + else if (ieee->current_network.buseprotection) + { + // Use CTS-to-SELF in protection mode. + tcb_desc->bRTSEnable = true; + tcb_desc->bCTSEnable = true; + tcb_desc->rts_rate = MGN_24M; + } + //otherwise return; + return; + } + else + {// 11n High throughput case. + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; + while (true) + { + //check ERP protection + if (ieee->current_network.buseprotection) + {// CTS-to-SELF + tcb_desc->bRTSEnable = true; + tcb_desc->bCTSEnable = true; + tcb_desc->rts_rate = MGN_24M; + break; + } + //check HT op mode + if(pHTInfo->bCurrentHTSupport && pHTInfo->bEnableHT) + { + u8 HTOpMode = pHTInfo->CurrentOpMode; + if((pHTInfo->bCurBW40MHz && (HTOpMode == 2 || HTOpMode == 3)) || + (!pHTInfo->bCurBW40MHz && HTOpMode == 3) ) + { + tcb_desc->rts_rate = MGN_24M; // Rate is 24Mbps. + tcb_desc->bRTSEnable = true; + break; + } + } + //check rts + if (skb->len > ieee->rts) + { + tcb_desc->rts_rate = MGN_24M; // Rate is 24Mbps. + tcb_desc->bRTSEnable = true; + break; + } + //to do list: check MIMO power save condition. + //check AMPDU aggregation for TXOP + if(tcb_desc->bAMPDUEnable) + { + tcb_desc->rts_rate = MGN_24M; // Rate is 24Mbps. + // According to 8190 design, firmware sends CF-End only if RTS/CTS is enabled. However, it degrads + // throughput around 10M, so we disable of this mechanism. 2007.08.03 by Emily + tcb_desc->bRTSEnable = false; + break; + } + //check IOT action + if(pHTInfo->IOTAction & HT_IOT_ACT_FORCED_CTS2SELF) + { + tcb_desc->bCTSEnable = true; + tcb_desc->rts_rate = MGN_24M; + tcb_desc->bRTSEnable = true; + break; + } + // Totally no protection case!! + goto NO_PROTECTION; + } + } + // For test , CTS replace with RTS + if( 0 ) + { + tcb_desc->bCTSEnable = true; + tcb_desc->rts_rate = MGN_24M; + tcb_desc->bRTSEnable = true; + } + if (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_PREAMBLE) + tcb_desc->bUseShortPreamble = true; + if (ieee->mode == IW_MODE_MASTER) + goto NO_PROTECTION; + return; +NO_PROTECTION: + tcb_desc->bRTSEnable = false; + tcb_desc->bCTSEnable = false; + tcb_desc->rts_rate = 0; + tcb_desc->RTSSC = 0; + tcb_desc->bRTSBW = false; +} + + +void ieee80211_txrate_selectmode(struct ieee80211_device* ieee, cb_desc* tcb_desc) +{ +#ifdef TO_DO_LIST + if(!IsDataFrame(pFrame)) + { + pTcb->bTxDisableRateFallBack = TRUE; + pTcb->bTxUseDriverAssingedRate = TRUE; + pTcb->RATRIndex = 7; + return; + } + + if(pMgntInfo->ForcedDataRate!= 0) + { + pTcb->bTxDisableRateFallBack = TRUE; + pTcb->bTxUseDriverAssingedRate = TRUE; + return; + } +#endif + if(ieee->bTxDisableRateFallBack) + tcb_desc->bTxDisableRateFallBack = true; + + if(ieee->bTxUseDriverAssingedRate) + tcb_desc->bTxUseDriverAssingedRate = true; + if(!tcb_desc->bTxDisableRateFallBack || !tcb_desc->bTxUseDriverAssingedRate) + { + if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC) + tcb_desc->RATRIndex = 0; + } +} + +void ieee80211_query_seqnum(struct ieee80211_device*ieee, struct sk_buff* skb, u8* dst) +{ + if (is_multicast_ether_addr(dst) || is_broadcast_ether_addr(dst)) + return; + if (IsQoSDataFrame(skb->data)) //we deal qos data only + { + PTX_TS_RECORD pTS = NULL; + if (!GetTs(ieee, (PTS_COMMON_INFO*)(&pTS), dst, skb->priority, TX_DIR, true)) + { + return; + } + pTS->TxCurSeq = (pTS->TxCurSeq+1)%4096; + } +} + +int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) +{ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) + struct ieee80211_device *ieee = netdev_priv(dev); +#else + struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv; +#endif + struct ieee80211_txb *txb = NULL; + struct ieee80211_hdr_3addrqos *frag_hdr; + int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size; + unsigned long flags; + struct net_device_stats *stats = &ieee->stats; + int ether_type = 0, encrypt; + int bytes, fc, qos_ctl = 0, hdr_len; + struct sk_buff *skb_frag; + struct ieee80211_hdr_3addrqos header = { /* Ensure zero initialized */ + .duration_id = 0, + .seq_ctl = 0, + .qos_ctl = 0 + }; + u8 dest[ETH_ALEN], src[ETH_ALEN]; + int qos_actived = ieee->current_network.qos_data.active; + + struct ieee80211_crypt_data* crypt; + + cb_desc *tcb_desc; + + spin_lock_irqsave(&ieee->lock, flags); + + /* If there is no driver handler to take the TXB, dont' bother + * creating it... */ + if ((!ieee->hard_start_xmit && !(ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE))|| + ((!ieee->softmac_data_hard_start_xmit && (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)))) { + printk(KERN_WARNING "%s: No xmit handler.\n", + ieee->dev->name); + goto success; + } + + + if(likely(ieee->raw_tx == 0)){ + if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) { + printk(KERN_WARNING "%s: skb too small (%d).\n", + ieee->dev->name, skb->len); + goto success; + } + + memset(skb->cb, 0, sizeof(skb->cb)); + ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto); + + crypt = ieee->crypt[ieee->tx_keyidx]; + + encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) && + ieee->host_encrypt && crypt && crypt->ops; + + if (!encrypt && ieee->ieee802_1x && + ieee->drop_unencrypted && ether_type != ETH_P_PAE) { + stats->tx_dropped++; + goto success; + } + #ifdef CONFIG_IEEE80211_DEBUG + if (crypt && !encrypt && ether_type == ETH_P_PAE) { + struct eapol *eap = (struct eapol *)(skb->data + + sizeof(struct ethhdr) - SNAP_SIZE - sizeof(u16)); + IEEE80211_DEBUG_EAP("TX: IEEE 802.11 EAPOL frame: %s\n", + eap_get_type(eap->type)); + } + #endif + + /* Save source and destination addresses */ + memcpy(&dest, skb->data, ETH_ALEN); + memcpy(&src, skb->data+ETH_ALEN, ETH_ALEN); + + /* Advance the SKB to the start of the payload */ + skb_pull(skb, sizeof(struct ethhdr)); + + /* Determine total amount of storage required for TXB packets */ + bytes = skb->len + SNAP_SIZE + sizeof(u16); + + if (encrypt) + fc = IEEE80211_FTYPE_DATA | IEEE80211_FCTL_WEP; + else + + fc = IEEE80211_FTYPE_DATA; + + //if(ieee->current_network.QoS_Enable) + if(qos_actived) + fc |= IEEE80211_STYPE_QOS_DATA; + else + fc |= IEEE80211_STYPE_DATA; + + if (ieee->iw_mode == IW_MODE_INFRA) { + fc |= IEEE80211_FCTL_TODS; + /* To DS: Addr1 = BSSID, Addr2 = SA, + Addr3 = DA */ + memcpy(&header.addr1, ieee->current_network.bssid, ETH_ALEN); + memcpy(&header.addr2, &src, ETH_ALEN); + memcpy(&header.addr3, &dest, ETH_ALEN); + } else if (ieee->iw_mode == IW_MODE_ADHOC) { + /* not From/To DS: Addr1 = DA, Addr2 = SA, + Addr3 = BSSID */ + memcpy(&header.addr1, dest, ETH_ALEN); + memcpy(&header.addr2, src, ETH_ALEN); + memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN); + } + + header.frame_ctl = cpu_to_le16(fc); + + /* Determine fragmentation size based on destination (multicast + * and broadcast are not fragmented) */ + if (is_multicast_ether_addr(header.addr1) || + is_broadcast_ether_addr(header.addr1)) { + frag_size = MAX_FRAG_THRESHOLD; + qos_ctl |= QOS_CTL_NOTCONTAIN_ACK; + } + else { + frag_size = ieee->fts;//default:392 + qos_ctl = 0; + } + + //if (ieee->current_network.QoS_Enable) + if(qos_actived) + { + hdr_len = IEEE80211_3ADDR_LEN + 2; + + skb->priority = ieee80211_classify(skb, &ieee->current_network); + qos_ctl |= skb->priority; //set in the ieee80211_classify + header.qos_ctl = cpu_to_le16(qos_ctl & IEEE80211_QOS_TID); + } else { + hdr_len = IEEE80211_3ADDR_LEN; + } + /* Determine amount of payload per fragment. Regardless of if + * this stack is providing the full 802.11 header, one will + * eventually be affixed to this fragment -- so we must account for + * it when determining the amount of payload space. */ + bytes_per_frag = frag_size - hdr_len; + if (ieee->config & + (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) + bytes_per_frag -= IEEE80211_FCS_LEN; + + /* Each fragment may need to have room for encryptiong pre/postfix */ + if (encrypt) + bytes_per_frag -= crypt->ops->extra_prefix_len + + crypt->ops->extra_postfix_len; + + /* Number of fragments is the total bytes_per_frag / + * payload_per_fragment */ + nr_frags = bytes / bytes_per_frag; + bytes_last_frag = bytes % bytes_per_frag; + if (bytes_last_frag) + nr_frags++; + else + bytes_last_frag = bytes_per_frag; + + /* When we allocate the TXB we allocate enough space for the reserve + * and full fragment bytes (bytes_per_frag doesn't include prefix, + * postfix, header, FCS, etc.) */ + txb = ieee80211_alloc_txb(nr_frags, frag_size + ieee->tx_headroom, GFP_ATOMIC); + if (unlikely(!txb)) { + printk(KERN_WARNING "%s: Could not allocate TXB\n", + ieee->dev->name); + goto failed; + } + txb->encrypted = encrypt; + txb->payload_size = bytes; + + //if (ieee->current_network.QoS_Enable) + if(qos_actived) + { + txb->queue_index = UP2AC(skb->priority); + } else { + txb->queue_index = WME_AC_BK;; + } + + + + for (i = 0; i < nr_frags; i++) { + skb_frag = txb->fragments[i]; + tcb_desc = (cb_desc *)(skb_frag->cb + MAX_DEV_ADDR_SIZE); + if(qos_actived){ + skb_frag->priority = skb->priority;//UP2AC(skb->priority); + tcb_desc->queue_index = UP2AC(skb->priority); + } else { + skb_frag->priority = WME_AC_BK; + tcb_desc->queue_index = WME_AC_BK; + } + skb_reserve(skb_frag, ieee->tx_headroom); + + if (encrypt){ + if (ieee->hwsec_active) + tcb_desc->bHwSec = 1; + else + tcb_desc->bHwSec = 0; + skb_reserve(skb_frag, crypt->ops->extra_prefix_len); + } + else + { + tcb_desc->bHwSec = 0; + } + frag_hdr = (struct ieee80211_hdr_3addrqos *)skb_put(skb_frag, hdr_len); + memcpy(frag_hdr, &header, hdr_len); + + /* If this is not the last fragment, then add the MOREFRAGS + * bit to the frame control */ + if (i != nr_frags - 1) { + frag_hdr->frame_ctl = cpu_to_le16( + fc | IEEE80211_FCTL_MOREFRAGS); + bytes = bytes_per_frag; + + } else { + /* The last fragment takes the remaining length */ + bytes = bytes_last_frag; + } + //if(ieee->current_network.QoS_Enable) + if(qos_actived) + { + // add 1 only indicate to corresponding seq number control 2006/7/12 + frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl[UP2AC(skb->priority)+1]<<4 | i); + } else { + frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0]<<4 | i); + } + + /* Put a SNAP header on the first fragment */ + if (i == 0) { + ieee80211_put_snap( + skb_put(skb_frag, SNAP_SIZE + sizeof(u16)), + ether_type); + bytes -= SNAP_SIZE + sizeof(u16); + } + + memcpy(skb_put(skb_frag, bytes), skb->data, bytes); + + /* Advance the SKB... */ + skb_pull(skb, bytes); + + /* Encryption routine will move the header forward in order + * to insert the IV between the header and the payload */ + if (encrypt) + ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len); + if (ieee->config & + (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) + skb_put(skb_frag, 4); + } + + if(qos_actived) + { + if (ieee->seq_ctrl[UP2AC(skb->priority) + 1] == 0xFFF) + ieee->seq_ctrl[UP2AC(skb->priority) + 1] = 0; + else + ieee->seq_ctrl[UP2AC(skb->priority) + 1]++; + } else { + if (ieee->seq_ctrl[0] == 0xFFF) + ieee->seq_ctrl[0] = 0; + else + ieee->seq_ctrl[0]++; + } + }else{ + if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) { + printk(KERN_WARNING "%s: skb too small (%d).\n", + ieee->dev->name, skb->len); + goto success; + } + + txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC); + if(!txb){ + printk(KERN_WARNING "%s: Could not allocate TXB\n", + ieee->dev->name); + goto failed; + } + + txb->encrypted = 0; + txb->payload_size = skb->len; + memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len); + } + + success: +//WB add to fill data tcb_desc here. only first fragment is considered, need to change, and you may remove to other place. + if (txb) + { +#if 1 + cb_desc *tcb_desc = (cb_desc *)(txb->fragments[0]->cb + MAX_DEV_ADDR_SIZE); + tcb_desc->bTxEnableFwCalcDur = 1; + if (is_multicast_ether_addr(header.addr1)) + tcb_desc->bMulticast = 1; + if (is_broadcast_ether_addr(header.addr1)) + tcb_desc->bBroadcast = 1; + ieee80211_txrate_selectmode(ieee, tcb_desc); + if ( tcb_desc->bMulticast || tcb_desc->bBroadcast) + tcb_desc->data_rate = ieee->basic_rate; + else + //tcb_desc->data_rate = CURRENT_RATE(ieee->current_network.mode, ieee->rate, ieee->HTCurrentOperaRate); + tcb_desc->data_rate = CURRENT_RATE(ieee->mode, ieee->rate, ieee->HTCurrentOperaRate); + ieee80211_qurey_ShortPreambleMode(ieee, tcb_desc); + ieee80211_tx_query_agg_cap(ieee, txb->fragments[0], tcb_desc); + ieee80211_query_HTCapShortGI(ieee, tcb_desc); + ieee80211_query_BandwidthMode(ieee, tcb_desc); + ieee80211_query_protectionmode(ieee, tcb_desc, txb->fragments[0]); + ieee80211_query_seqnum(ieee, txb->fragments[0], header.addr1); +// IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, txb->fragments[0]->data, txb->fragments[0]->len); + //IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, tcb_desc, sizeof(cb_desc)); +#endif + } + spin_unlock_irqrestore(&ieee->lock, flags); + dev_kfree_skb_any(skb); + if (txb) { + if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){ + ieee80211_softmac_xmit(txb, ieee); + }else{ + if ((*ieee->hard_start_xmit)(txb, dev) == 0) { + stats->tx_packets++; + stats->tx_bytes += txb->payload_size; + return 0; + } + ieee80211_txb_free(txb); + } + } + + return 0; + + failed: + spin_unlock_irqrestore(&ieee->lock, flags); + netif_stop_queue(dev); + stats->tx_errors++; + return 1; + +} + +EXPORT_SYMBOL(ieee80211_txb_free); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c new file mode 100644 index 000000000000..118dfe1c977f --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c @@ -0,0 +1,1032 @@ +/****************************************************************************** + + Copyright(c) 2004 Intel Corporation. All rights reserved. + + Portions of this file are based on the WEP enablement code provided by the + Host AP project hostap-drivers v0.1.3 + Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen + + Copyright (c) 2002-2003, Jouni Malinen + + This program is free software; you can redistribute it and/or modify it + under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + 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., 59 + Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + The full GNU General Public License is included in this distribution in the + file called LICENSE. + + Contact Information: + James P. Ketrenos + Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + +******************************************************************************/ +#include +#include +#include +#include + +#include "ieee80211.h" +#if 0 +static const char *ieee80211_modes[] = { + "?", "a", "b", "ab", "g", "ag", "bg", "abg" +}; +#endif +struct modes_unit { + char *mode_string; + int mode_size; +}; +struct modes_unit ieee80211_modes[] = { + {"a",1}, + {"b",1}, + {"g",1}, + {"?",1}, + {"N-24G",5}, + {"N-5G",4}, +}; + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +static inline char * +iwe_stream_add_event_rsl(char * stream, /* Stream of events */ + char * ends, /* End of stream */ + struct iw_event *iwe, /* Payload */ + int event_len) /* Real size of payload */ +{ + /* Check if it's possible */ + if((stream + event_len) < ends) { + iwe->len = event_len; + ndelay(1); //new + memcpy(stream, (char *) iwe, event_len); + stream += event_len; + } + return stream; +} +#else +#define iwe_stream_add_event_rsl iwe_stream_add_event +#endif + +#define MAX_CUSTOM_LEN 64 +static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, + char *start, char *stop, + struct ieee80211_network *network, + struct iw_request_info *info) +{ + char custom[MAX_CUSTOM_LEN]; + char proto_name[IFNAMSIZ]; + char *pname = proto_name; + char *p; + struct iw_event iwe; + int i, j; + u16 max_rate, rate; + static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33}; + + /* First entry *MUST* be the AP MAC address */ + iwe.cmd = SIOCGIWAP; + iwe.u.ap_addr.sa_family = ARPHRD_ETHER; + memcpy(iwe.u.ap_addr.sa_data, network->bssid, ETH_ALEN); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_ADDR_LEN); +#else + start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_ADDR_LEN); +#endif + /* Remaining entries will be displayed in the order we provide them */ + + /* Add the ESSID */ + iwe.cmd = SIOCGIWESSID; + iwe.u.data.flags = 1; +// if (network->flags & NETWORK_EMPTY_ESSID) { + if (network->ssid_len == 0) { + iwe.u.data.length = sizeof(""); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + start = iwe_stream_add_point(info, start, stop, &iwe, ""); +#else + start = iwe_stream_add_point(start, stop, &iwe, ""); +#endif + } else { + iwe.u.data.length = min(network->ssid_len, (u8)32); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); +#else + start = iwe_stream_add_point(start, stop, &iwe, network->ssid); +#endif + } + /* Add the protocol name */ + iwe.cmd = SIOCGIWNAME; + for(i=0; i<(sizeof(ieee80211_modes)/sizeof(ieee80211_modes[0])); i++) { + if(network->mode&(1<= KERNEL_VERSION(2,6,27) + start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_CHAR_LEN); +#else + start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_CHAR_LEN); +#endif + /* Add mode */ + iwe.cmd = SIOCGIWMODE; + if (network->capability & + (WLAN_CAPABILITY_BSS | WLAN_CAPABILITY_IBSS)) { + if (network->capability & WLAN_CAPABILITY_BSS) + iwe.u.mode = IW_MODE_MASTER; + else + iwe.u.mode = IW_MODE_ADHOC; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_UINT_LEN); +#else + start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_UINT_LEN); +#endif + } + + /* Add frequency/channel */ + iwe.cmd = SIOCGIWFREQ; +/* iwe.u.freq.m = ieee80211_frequency(network->channel, network->mode); + iwe.u.freq.e = 3; */ + iwe.u.freq.m = network->channel; + iwe.u.freq.e = 0; + iwe.u.freq.i = 0; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_FREQ_LEN); +#else + start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_FREQ_LEN); +#endif + /* Add encryption capability */ + iwe.cmd = SIOCGIWENCODE; + if (network->capability & WLAN_CAPABILITY_PRIVACY) + iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; + else + iwe.u.data.flags = IW_ENCODE_DISABLED; + iwe.u.data.length = 0; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); +#else + start = iwe_stream_add_point(start, stop, &iwe, network->ssid); +#endif + /* Add basic and extended rates */ + max_rate = 0; + p = custom; + p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Rates (Mb/s): "); + for (i = 0, j = 0; i < network->rates_len; ) { + if (j < network->rates_ex_len && + ((network->rates_ex[j] & 0x7F) < + (network->rates[i] & 0x7F))) + rate = network->rates_ex[j++] & 0x7F; + else + rate = network->rates[i++] & 0x7F; + if (rate > max_rate) + max_rate = rate; + p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), + "%d%s ", rate >> 1, (rate & 1) ? ".5" : ""); + } + for (; j < network->rates_ex_len; j++) { + rate = network->rates_ex[j] & 0x7F; + p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), + "%d%s ", rate >> 1, (rate & 1) ? ".5" : ""); + if (rate > max_rate) + max_rate = rate; + } + + if (network->mode >= IEEE_N_24G)//add N rate here; + { + PHT_CAPABILITY_ELE ht_cap = NULL; + bool is40M = false, isShortGI = false; + u8 max_mcs = 0; + if (!memcmp(network->bssht.bdHTCapBuf, EWC11NHTCap, 4)) + ht_cap = (PHT_CAPABILITY_ELE)&network->bssht.bdHTCapBuf[4]; + else + ht_cap = (PHT_CAPABILITY_ELE)&network->bssht.bdHTCapBuf[0]; + is40M = (ht_cap->ChlWidth)?1:0; + isShortGI = (ht_cap->ChlWidth)? + ((ht_cap->ShortGI40Mhz)?1:0): + ((ht_cap->ShortGI20Mhz)?1:0); + + max_mcs = HTGetHighestMCSRate(ieee, ht_cap->MCS, MCS_FILTER_ALL); + rate = MCS_DATA_RATE[is40M][isShortGI][max_mcs&0x7f]; + if (rate > max_rate) + max_rate = rate; + } +#if 0 + printk("max rate:%d ===basic rate:\n", max_rate); + for (i=0;irates_len;i++) + printk(" %x", network->rates[i]); + printk("\n=======extend rate\n"); + for (i=0; irates_ex_len; i++) + printk(" %x", network->rates_ex[i]); + printk("\n"); +#endif + iwe.cmd = SIOCGIWRATE; + iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; + iwe.u.bitrate.value = max_rate * 500000; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + start = iwe_stream_add_event_rsl(info, start, stop, &iwe, + IW_EV_PARAM_LEN); +#else + start = iwe_stream_add_event_rsl(start, stop, &iwe, + IW_EV_PARAM_LEN); +#endif + iwe.cmd = IWEVCUSTOM; + iwe.u.data.length = p - custom; + if (iwe.u.data.length) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + start = iwe_stream_add_point(info, start, stop, &iwe, custom); +#else + start = iwe_stream_add_point(start, stop, &iwe, custom); +#endif + /* Add quality statistics */ + /* TODO: Fix these values... */ + iwe.cmd = IWEVQUAL; + iwe.u.qual.qual = network->stats.signal; + iwe.u.qual.level = network->stats.rssi; + iwe.u.qual.noise = network->stats.noise; + iwe.u.qual.updated = network->stats.mask & IEEE80211_STATMASK_WEMASK; + if (!(network->stats.mask & IEEE80211_STATMASK_RSSI)) + iwe.u.qual.updated |= IW_QUAL_LEVEL_INVALID; + if (!(network->stats.mask & IEEE80211_STATMASK_NOISE)) + iwe.u.qual.updated |= IW_QUAL_NOISE_INVALID; + if (!(network->stats.mask & IEEE80211_STATMASK_SIGNAL)) + iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID; + iwe.u.qual.updated = 7; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_QUAL_LEN); +#else + start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_QUAL_LEN); +#endif + iwe.cmd = IWEVCUSTOM; + p = custom; + + iwe.u.data.length = p - custom; + if (iwe.u.data.length) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + start = iwe_stream_add_point(info, start, stop, &iwe, custom); +#else + start = iwe_stream_add_point(start, stop, &iwe, custom); +#endif +#if (WIRELESS_EXT < 18) + if (ieee->wpa_enabled && network->wpa_ie_len){ + char buf[MAX_WPA_IE_LEN * 2 + 30]; + // printk("WPA IE\n"); + u8 *p = buf; + p += sprintf(p, "wpa_ie="); + for (i = 0; i < network->wpa_ie_len; i++) { + p += sprintf(p, "%02x", network->wpa_ie[i]); + } + + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = IWEVCUSTOM; + iwe.u.data.length = strlen(buf); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + start = iwe_stream_add_point(info, start, stop, &iwe, buf); +#else + start = iwe_stream_add_point(start, stop, &iwe, buf); +#endif + } + + if (ieee->wpa_enabled && network->rsn_ie_len){ + char buf[MAX_WPA_IE_LEN * 2 + 30]; + + u8 *p = buf; + p += sprintf(p, "rsn_ie="); + for (i = 0; i < network->rsn_ie_len; i++) { + p += sprintf(p, "%02x", network->rsn_ie[i]); + } + + memset(&iwe, 0, sizeof(iwe)); + iwe.cmd = IWEVCUSTOM; + iwe.u.data.length = strlen(buf); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + start = iwe_stream_add_point(info, start, stop, &iwe, buf); +#else + start = iwe_stream_add_point(start, stop, &iwe, buf); +#endif + } +#else + memset(&iwe, 0, sizeof(iwe)); + if (network->wpa_ie_len) + { + char buf[MAX_WPA_IE_LEN]; + memcpy(buf, network->wpa_ie, network->wpa_ie_len); + iwe.cmd = IWEVGENIE; + iwe.u.data.length = network->wpa_ie_len; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + start = iwe_stream_add_point(info, start, stop, &iwe, buf); +#else + start = iwe_stream_add_point(start, stop, &iwe, buf); +#endif + } + memset(&iwe, 0, sizeof(iwe)); + if (network->rsn_ie_len) + { + char buf[MAX_WPA_IE_LEN]; + memcpy(buf, network->rsn_ie, network->rsn_ie_len); + iwe.cmd = IWEVGENIE; + iwe.u.data.length = network->rsn_ie_len; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + start = iwe_stream_add_point(info, start, stop, &iwe, buf); +#else + start = iwe_stream_add_point(start, stop, &iwe, buf); +#endif + } +#endif + + + /* Add EXTRA: Age to display seconds since last beacon/probe response + * for given network. */ + iwe.cmd = IWEVCUSTOM; + p = custom; + p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), + " Last beacon: %lums ago", (jiffies - network->last_scanned) / (HZ / 100)); + iwe.u.data.length = p - custom; + if (iwe.u.data.length) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + start = iwe_stream_add_point(info, start, stop, &iwe, custom); +#else + start = iwe_stream_add_point(start, stop, &iwe, custom); +#endif + + return start; +} + +int ieee80211_wx_get_scan(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ieee80211_network *network; + unsigned long flags; + + char *ev = extra; +// char *stop = ev + IW_SCAN_MAX_DATA; + char *stop = ev + wrqu->data.length;//IW_SCAN_MAX_DATA; + //char *stop = ev + IW_SCAN_MAX_DATA; + int i = 0; + int err = 0; + IEEE80211_DEBUG_WX("Getting scan\n"); + down(&ieee->wx_sem); + spin_lock_irqsave(&ieee->lock, flags); + + list_for_each_entry(network, &ieee->network_list, list) { + i++; + if((stop-ev)<200) + { + err = -E2BIG; + break; + } + if (ieee->scan_age == 0 || + time_after(network->last_scanned + ieee->scan_age, jiffies)) + ev = rtl819x_translate_scan(ieee, ev, stop, network, info); + else + IEEE80211_DEBUG_SCAN( + "Not showing network '%s (" + MAC_FMT ")' due to age (%lums).\n", + escape_essid(network->ssid, + network->ssid_len), + MAC_ARG(network->bssid), + (jiffies - network->last_scanned) / (HZ / 100)); + } + + spin_unlock_irqrestore(&ieee->lock, flags); + up(&ieee->wx_sem); + wrqu->data.length = ev - extra; + wrqu->data.flags = 0; + + IEEE80211_DEBUG_WX("exit: %d networks returned.\n", i); + + return err; +} + +int ieee80211_wx_set_encode(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *keybuf) +{ + struct iw_point *erq = &(wrqu->encoding); + struct net_device *dev = ieee->dev; + struct ieee80211_security sec = { + .flags = 0 + }; + int i, key, key_provided, len; + struct ieee80211_crypt_data **crypt; + + IEEE80211_DEBUG_WX("SET_ENCODE\n"); + + key = erq->flags & IW_ENCODE_INDEX; + if (key) { + if (key > WEP_KEYS) + return -EINVAL; + key--; + key_provided = 1; + } else { + key_provided = 0; + key = ieee->tx_keyidx; + } + + IEEE80211_DEBUG_WX("Key: %d [%s]\n", key, key_provided ? + "provided" : "default"); + crypt = &ieee->crypt[key]; + + if (erq->flags & IW_ENCODE_DISABLED) { + if (key_provided && *crypt) { + IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n", + key); + ieee80211_crypt_delayed_deinit(ieee, crypt); + } else + IEEE80211_DEBUG_WX("Disabling encryption.\n"); + + /* Check all the keys to see if any are still configured, + * and if no key index was provided, de-init them all */ + for (i = 0; i < WEP_KEYS; i++) { + if (ieee->crypt[i] != NULL) { + if (key_provided) + break; + ieee80211_crypt_delayed_deinit( + ieee, &ieee->crypt[i]); + } + } + + if (i == WEP_KEYS) { + sec.enabled = 0; + sec.level = SEC_LEVEL_0; + sec.flags |= SEC_ENABLED | SEC_LEVEL; + } + + goto done; + } + + + + sec.enabled = 1; + sec.flags |= SEC_ENABLED; + + if (*crypt != NULL && (*crypt)->ops != NULL && + strcmp((*crypt)->ops->name, "WEP") != 0) { + /* changing to use WEP; deinit previously used algorithm + * on this key */ + ieee80211_crypt_delayed_deinit(ieee, crypt); + } + + if (*crypt == NULL) { + struct ieee80211_crypt_data *new_crypt; + + /* take WEP into use */ + new_crypt = kmalloc(sizeof(struct ieee80211_crypt_data), + GFP_KERNEL); + if (new_crypt == NULL) + return -ENOMEM; + memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); + new_crypt->ops = ieee80211_get_crypto_ops("WEP"); + if (!new_crypt->ops) { + request_module("ieee80211_crypt_wep"); + new_crypt->ops = ieee80211_get_crypto_ops("WEP"); + } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) + if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) +#else + if (new_crypt->ops && try_inc_mod_count(new_crypt->ops->owner)) +#endif + new_crypt->priv = new_crypt->ops->init(key); + + if (!new_crypt->ops || !new_crypt->priv) { + kfree(new_crypt); + new_crypt = NULL; + + printk(KERN_WARNING "%s: could not initialize WEP: " + "load module ieee80211_crypt_wep\n", + dev->name); + return -EOPNOTSUPP; + } + *crypt = new_crypt; + } + + /* If a new key was provided, set it up */ + if (erq->length > 0) { + len = erq->length <= 5 ? 5 : 13; + memcpy(sec.keys[key], keybuf, erq->length); + if (len > erq->length) + memset(sec.keys[key] + erq->length, 0, + len - erq->length); + IEEE80211_DEBUG_WX("Setting key %d to '%s' (%d:%d bytes)\n", + key, escape_essid(sec.keys[key], len), + erq->length, len); + sec.key_sizes[key] = len; + (*crypt)->ops->set_key(sec.keys[key], len, NULL, + (*crypt)->priv); + sec.flags |= (1 << key); + /* This ensures a key will be activated if no key is + * explicitely set */ + if (key == sec.active_key) + sec.flags |= SEC_ACTIVE_KEY; + ieee->tx_keyidx = key; + + } else { + len = (*crypt)->ops->get_key(sec.keys[key], WEP_KEY_LEN, + NULL, (*crypt)->priv); + if (len == 0) { + /* Set a default key of all 0 */ + printk("Setting key %d to all zero.\n", + key); + + IEEE80211_DEBUG_WX("Setting key %d to all zero.\n", + key); + memset(sec.keys[key], 0, 13); + (*crypt)->ops->set_key(sec.keys[key], 13, NULL, + (*crypt)->priv); + sec.key_sizes[key] = 13; + sec.flags |= (1 << key); + } + + /* No key data - just set the default TX key index */ + if (key_provided) { + IEEE80211_DEBUG_WX( + "Setting key %d to default Tx key.\n", key); + ieee->tx_keyidx = key; + sec.active_key = key; + sec.flags |= SEC_ACTIVE_KEY; + } + } + + done: + ieee->open_wep = !(erq->flags & IW_ENCODE_RESTRICTED); + ieee->auth_mode = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY; + sec.auth_mode = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY; + sec.flags |= SEC_AUTH_MODE; + IEEE80211_DEBUG_WX("Auth: %s\n", sec.auth_mode == WLAN_AUTH_OPEN ? + "OPEN" : "SHARED KEY"); + + /* For now we just support WEP, so only set that security level... + * TODO: When WPA is added this is one place that needs to change */ + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_1; /* 40 and 104 bit WEP */ + + if (ieee->set_security) + ieee->set_security(dev, &sec); + + /* Do not reset port if card is in Managed mode since resetting will + * generate new IEEE 802.11 authentication which may end up in looping + * with IEEE 802.1X. If your hardware requires a reset after WEP + * configuration (for example... Prism2), implement the reset_port in + * the callbacks structures used to initialize the 802.11 stack. */ + if (ieee->reset_on_keychange && + ieee->iw_mode != IW_MODE_INFRA && + ieee->reset_port && ieee->reset_port(dev)) { + printk(KERN_DEBUG "%s: reset_port failed\n", dev->name); + return -EINVAL; + } + return 0; +} + +int ieee80211_wx_get_encode(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *keybuf) +{ + struct iw_point *erq = &(wrqu->encoding); + int len, key; + struct ieee80211_crypt_data *crypt; + + IEEE80211_DEBUG_WX("GET_ENCODE\n"); + + if(ieee->iw_mode == IW_MODE_MONITOR) + return -1; + + key = erq->flags & IW_ENCODE_INDEX; + if (key) { + if (key > WEP_KEYS) + return -EINVAL; + key--; + } else + key = ieee->tx_keyidx; + + crypt = ieee->crypt[key]; + erq->flags = key + 1; + + if (crypt == NULL || crypt->ops == NULL) { + erq->length = 0; + erq->flags |= IW_ENCODE_DISABLED; + return 0; + } +#if 0 + if (strcmp(crypt->ops->name, "WEP") != 0) { + /* only WEP is supported with wireless extensions, so just + * report that encryption is used */ + erq->length = 0; + erq->flags |= IW_ENCODE_ENABLED; + return 0; + } +#endif + len = crypt->ops->get_key(keybuf, SCM_KEY_LEN, NULL, crypt->priv); + erq->length = (len >= 0 ? len : 0); + + erq->flags |= IW_ENCODE_ENABLED; + + if (ieee->open_wep) + erq->flags |= IW_ENCODE_OPEN; + else + erq->flags |= IW_ENCODE_RESTRICTED; + + return 0; +} +#if (WIRELESS_EXT >= 18) +int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + int ret = 0; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + struct net_device *dev = ieee->dev; + struct iw_point *encoding = &wrqu->encoding; + struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; + int i, idx; + int group_key = 0; + const char *alg, *module; + struct ieee80211_crypto_ops *ops; + struct ieee80211_crypt_data **crypt; + + struct ieee80211_security sec = { + .flags = 0, + }; + //printk("======>encoding flag:%x,ext flag:%x, ext alg:%d\n", encoding->flags,ext->ext_flags, ext->alg); + idx = encoding->flags & IW_ENCODE_INDEX; + if (idx) { + if (idx < 1 || idx > WEP_KEYS) + return -EINVAL; + idx--; + } else + idx = ieee->tx_keyidx; + + if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { + + crypt = &ieee->crypt[idx]; + + group_key = 1; + } else { + /* some Cisco APs use idx>0 for unicast in dynamic WEP */ + //printk("not group key, flags:%x, ext->alg:%d\n", ext->ext_flags, ext->alg); + if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP) + return -EINVAL; + if (ieee->iw_mode == IW_MODE_INFRA) + + crypt = &ieee->crypt[idx]; + + else + return -EINVAL; + } + + sec.flags |= SEC_ENABLED;// | SEC_ENCRYPT; + if ((encoding->flags & IW_ENCODE_DISABLED) || + ext->alg == IW_ENCODE_ALG_NONE) { + if (*crypt) + ieee80211_crypt_delayed_deinit(ieee, crypt); + + for (i = 0; i < WEP_KEYS; i++) + + if (ieee->crypt[i] != NULL) + + break; + + if (i == WEP_KEYS) { + sec.enabled = 0; + // sec.encrypt = 0; + sec.level = SEC_LEVEL_0; + sec.flags |= SEC_LEVEL; + } + //printk("disabled: flag:%x\n", encoding->flags); + goto done; + } + + sec.enabled = 1; + // sec.encrypt = 1; +#if 0 + if (group_key ? !ieee->host_mc_decrypt : + !(ieee->host_encrypt || ieee->host_decrypt || + ieee->host_encrypt_msdu)) + goto skip_host_crypt; +#endif + switch (ext->alg) { + case IW_ENCODE_ALG_WEP: + alg = "WEP"; + module = "ieee80211_crypt_wep"; + break; + case IW_ENCODE_ALG_TKIP: + alg = "TKIP"; + module = "ieee80211_crypt_tkip"; + break; + case IW_ENCODE_ALG_CCMP: + alg = "CCMP"; + module = "ieee80211_crypt_ccmp"; + break; + default: + IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", + dev->name, ext->alg); + ret = -EINVAL; + goto done; + } + printk("alg name:%s\n",alg); + + ops = ieee80211_get_crypto_ops(alg); + if (ops == NULL) { + request_module(module); + ops = ieee80211_get_crypto_ops(alg); + } + if (ops == NULL) { + IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", + dev->name, ext->alg); + printk("========>unknown crypto alg %d\n", ext->alg); + ret = -EINVAL; + goto done; + } + + if (*crypt == NULL || (*crypt)->ops != ops) { + struct ieee80211_crypt_data *new_crypt; + + ieee80211_crypt_delayed_deinit(ieee, crypt); + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)) + new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); +#else + new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL); + memset(new_crypt,0,sizeof(*new_crypt)); +#endif + if (new_crypt == NULL) { + ret = -ENOMEM; + goto done; + } + new_crypt->ops = ops; + if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) + new_crypt->priv = new_crypt->ops->init(idx); + if (new_crypt->priv == NULL) { + kfree(new_crypt); + ret = -EINVAL; + goto done; + } + *crypt = new_crypt; + + } + + if (ext->key_len > 0 && (*crypt)->ops->set_key && + (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq, + (*crypt)->priv) < 0) { + IEEE80211_DEBUG_WX("%s: key setting failed\n", dev->name); + printk("key setting failed\n"); + ret = -EINVAL; + goto done; + } +#if 1 + //skip_host_crypt: + //printk("skip_host_crypt:ext_flags:%x\n", ext->ext_flags); + if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { + ieee->tx_keyidx = idx; + sec.active_key = idx; + sec.flags |= SEC_ACTIVE_KEY; + } + + if (ext->alg != IW_ENCODE_ALG_NONE) { + //memcpy(sec.keys[idx], ext->key, ext->key_len); + sec.key_sizes[idx] = ext->key_len; + sec.flags |= (1 << idx); + if (ext->alg == IW_ENCODE_ALG_WEP) { + // sec.encode_alg[idx] = SEC_ALG_WEP; + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_1; + } else if (ext->alg == IW_ENCODE_ALG_TKIP) { + // sec.encode_alg[idx] = SEC_ALG_TKIP; + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_2; + } else if (ext->alg == IW_ENCODE_ALG_CCMP) { + // sec.encode_alg[idx] = SEC_ALG_CCMP; + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_3; + } + /* Don't set sec level for group keys. */ + if (group_key) + sec.flags &= ~SEC_LEVEL; + } +#endif +done: + if (ieee->set_security) + ieee->set_security(ieee->dev, &sec); + + if (ieee->reset_on_keychange && + ieee->iw_mode != IW_MODE_INFRA && + ieee->reset_port && ieee->reset_port(dev)) { + IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name); + return -EINVAL; + } +#endif + return ret; +} + +int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct iw_point *encoding = &wrqu->encoding; + struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; + struct ieee80211_crypt_data *crypt; + int idx, max_key_len; + + max_key_len = encoding->length - sizeof(*ext); + if (max_key_len < 0) + return -EINVAL; + + idx = encoding->flags & IW_ENCODE_INDEX; + if (idx) { + if (idx < 1 || idx > WEP_KEYS) + return -EINVAL; + idx--; + } else + idx = ieee->tx_keyidx; + + if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY && + ext->alg != IW_ENCODE_ALG_WEP) + if (idx != 0 || ieee->iw_mode != IW_MODE_INFRA) + return -EINVAL; + + crypt = ieee->crypt[idx]; + encoding->flags = idx + 1; + memset(ext, 0, sizeof(*ext)); + + if (crypt == NULL || crypt->ops == NULL ) { + ext->alg = IW_ENCODE_ALG_NONE; + ext->key_len = 0; + encoding->flags |= IW_ENCODE_DISABLED; + } else { + if (strcmp(crypt->ops->name, "WEP") == 0 ) + ext->alg = IW_ENCODE_ALG_WEP; + else if (strcmp(crypt->ops->name, "TKIP")) + ext->alg = IW_ENCODE_ALG_TKIP; + else if (strcmp(crypt->ops->name, "CCMP")) + ext->alg = IW_ENCODE_ALG_CCMP; + else + return -EINVAL; + ext->key_len = crypt->ops->get_key(ext->key, SCM_KEY_LEN, NULL, crypt->priv); + encoding->flags |= IW_ENCODE_ENABLED; + if (ext->key_len && + (ext->alg == IW_ENCODE_ALG_TKIP || + ext->alg == IW_ENCODE_ALG_CCMP)) + ext->ext_flags |= IW_ENCODE_EXT_TX_SEQ_VALID; + + } + + return 0; +} + +int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + struct iw_mlme *mlme = (struct iw_mlme *) extra; + switch (mlme->cmd) { + case IW_MLME_DEAUTH: + case IW_MLME_DISASSOC: + ieee80211_disassociate(ieee); + break; + default: + return -EOPNOTSUPP; + } +#endif + return 0; +} + +int ieee80211_wx_set_auth(struct ieee80211_device *ieee, + struct iw_request_info *info, + struct iw_param *data, char *extra) +{ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + switch (data->flags & IW_AUTH_INDEX) { + case IW_AUTH_WPA_VERSION: + /*need to support wpa2 here*/ + //printk("wpa version:%x\n", data->value); + break; + case IW_AUTH_CIPHER_PAIRWISE: + case IW_AUTH_CIPHER_GROUP: + case IW_AUTH_KEY_MGMT: + /* + * * Host AP driver does not use these parameters and allows + * * wpa_supplicant to control them internally. + * */ + break; + case IW_AUTH_TKIP_COUNTERMEASURES: + ieee->tkip_countermeasures = data->value; + break; + case IW_AUTH_DROP_UNENCRYPTED: + ieee->drop_unencrypted = data->value; + break; + + case IW_AUTH_80211_AUTH_ALG: + //printk("======>%s():data->value is %d\n",__FUNCTION__,data->value); + // ieee->open_wep = (data->value&IW_AUTH_ALG_OPEN_SYSTEM)?1:0; + if(data->value & IW_AUTH_ALG_SHARED_KEY){ + ieee->open_wep = 0; + ieee->auth_mode = 1; + } + else if(data->value & IW_AUTH_ALG_OPEN_SYSTEM){ + ieee->open_wep = 1; + ieee->auth_mode = 0; + } + else if(data->value & IW_AUTH_ALG_LEAP){ + ieee->open_wep = 1; + ieee->auth_mode = 2; + //printk("hahahaa:LEAP\n"); + } + else + return -EINVAL; + //printk("open_wep:%d\n", ieee->open_wep); + break; + +#if 1 + case IW_AUTH_WPA_ENABLED: + ieee->wpa_enabled = (data->value)?1:0; + //printk("enalbe wpa:%d\n", ieee->wpa_enabled); + break; + +#endif + case IW_AUTH_RX_UNENCRYPTED_EAPOL: + ieee->ieee802_1x = data->value; + break; + case IW_AUTH_PRIVACY_INVOKED: + ieee->privacy_invoked = data->value; + break; + default: + return -EOPNOTSUPP; + } +#endif + return 0; +} +#endif +#if 1 +int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len) +{ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) +#if 0 + printk("====>%s()\n", __FUNCTION__); + { + int i; + for (i=0; iMAX_WPA_IE_LEN || (len && ie == NULL)) + { + // printk("return error out, len:%d\n", len); + return -EINVAL; + } + + + if (len) + { + if (len != ie[1]+2) + { + printk("len:%d, ie:%d\n", len, ie[1]); + return -EINVAL; + } + buf = kmalloc(len, GFP_KERNEL); + if (buf == NULL) + return -ENOMEM; + memcpy(buf, ie, len); + kfree(ieee->wpa_ie); + ieee->wpa_ie = buf; + ieee->wpa_ie_len = len; + } + else{ + if (ieee->wpa_ie) + kfree(ieee->wpa_ie); + ieee->wpa_ie = NULL; + ieee->wpa_ie_len = 0; + } +#endif + return 0; + +} +#endif + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) +EXPORT_SYMBOL(ieee80211_wx_set_gen_ie); +#if (WIRELESS_EXT >= 18) +EXPORT_SYMBOL(ieee80211_wx_set_mlme); +EXPORT_SYMBOL(ieee80211_wx_set_auth); +EXPORT_SYMBOL(ieee80211_wx_set_encode_ext); +EXPORT_SYMBOL(ieee80211_wx_get_encode_ext); +#endif +EXPORT_SYMBOL(ieee80211_wx_get_scan); +EXPORT_SYMBOL(ieee80211_wx_set_encode); +EXPORT_SYMBOL(ieee80211_wx_get_encode); +#else +EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_gen_ie); +//EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_mlme); +//EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_auth); +//EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_encode_ext); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_scan); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_encode); +EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_encode); +#endif diff --git a/drivers/staging/rtl8192u/ieee80211/internal.h b/drivers/staging/rtl8192u/ieee80211/internal.h new file mode 100644 index 000000000000..ddc22350d006 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/internal.h @@ -0,0 +1,115 @@ +/* + * Cryptographic API. + * + * Copyright (c) 2002 James Morris + * + * 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. + * + */ +#ifndef _CRYPTO_INTERNAL_H +#define _CRYPTO_INTERNAL_H + + +//#include +#include "rtl_crypto.h" +#include +#include +#include +#include +#include +#include + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20)) +#define list_for_each_entry(pos, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member), \ + prefetch(pos->member.next); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member), \ + prefetch(pos->member.next)) + +static inline void cond_resched(void) +{ + if (need_resched()) { + set_current_state(TASK_RUNNING); + schedule(); + } +} +#endif + +extern enum km_type crypto_km_types[]; + +static inline enum km_type crypto_kmap_type(int out) +{ + return crypto_km_types[(in_softirq() ? 2 : 0) + out]; +} + +static inline void *crypto_kmap(struct page *page, int out) +{ + return kmap_atomic(page, crypto_kmap_type(out)); +} + +static inline void crypto_kunmap(void *vaddr, int out) +{ + kunmap_atomic(vaddr, crypto_kmap_type(out)); +} + +static inline void crypto_yield(struct crypto_tfm *tfm) +{ + if (!in_softirq()) + cond_resched(); +} + +static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm) +{ + return (void *)&tfm[1]; +} + +struct crypto_alg *crypto_alg_lookup(const char *name); + +#ifdef CONFIG_KMOD +void crypto_alg_autoload(const char *name); +struct crypto_alg *crypto_alg_mod_lookup(const char *name); +#else +static inline struct crypto_alg *crypto_alg_mod_lookup(const char *name) +{ + return crypto_alg_lookup(name); +} +#endif + +#ifdef CONFIG_CRYPTO_HMAC +int crypto_alloc_hmac_block(struct crypto_tfm *tfm); +void crypto_free_hmac_block(struct crypto_tfm *tfm); +#else +static inline int crypto_alloc_hmac_block(struct crypto_tfm *tfm) +{ + return 0; +} + +static inline void crypto_free_hmac_block(struct crypto_tfm *tfm) +{ } +#endif + +#ifdef CONFIG_PROC_FS +void __init crypto_init_proc(void); +#else +static inline void crypto_init_proc(void) +{ } +#endif + +int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags); +int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags); +int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags); + +int crypto_init_digest_ops(struct crypto_tfm *tfm); +int crypto_init_cipher_ops(struct crypto_tfm *tfm); +int crypto_init_compress_ops(struct crypto_tfm *tfm); + +void crypto_exit_digest_ops(struct crypto_tfm *tfm); +void crypto_exit_cipher_ops(struct crypto_tfm *tfm); +void crypto_exit_compress_ops(struct crypto_tfm *tfm); + +#endif /* _CRYPTO_INTERNAL_H */ + diff --git a/drivers/staging/rtl8192u/ieee80211/kmap_types.h b/drivers/staging/rtl8192u/ieee80211/kmap_types.h new file mode 100644 index 000000000000..de67bb01b5f5 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/kmap_types.h @@ -0,0 +1,20 @@ +#ifndef __KMAP_TYPES_H + +#define __KMAP_TYPES_H + + +enum km_type { + KM_BOUNCE_READ, + KM_SKB_SUNRPC_DATA, + KM_SKB_DATA_SOFTIRQ, + KM_USER0, + KM_USER1, + KM_BH_IRQ, + KM_SOFTIRQ0, + KM_SOFTIRQ1, + KM_TYPE_NR +}; + +#define _ASM_KMAP_TYPES_H + +#endif diff --git a/drivers/staging/rtl8192u/ieee80211/michael_mic.c b/drivers/staging/rtl8192u/ieee80211/michael_mic.c new file mode 100644 index 000000000000..df256e487c20 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/michael_mic.c @@ -0,0 +1,194 @@ +/* + * Cryptographic API + * + * Michael MIC (IEEE 802.11i/TKIP) keyed digest + * + * Copyright (c) 2004 Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +//#include +#include "rtl_crypto.h" + + +struct michael_mic_ctx { + u8 pending[4]; + size_t pending_len; + + u32 l, r; +}; + + +static inline u32 rotl(u32 val, int bits) +{ + return (val << bits) | (val >> (32 - bits)); +} + + +static inline u32 rotr(u32 val, int bits) +{ + return (val >> bits) | (val << (32 - bits)); +} + + +static inline u32 xswap(u32 val) +{ + return ((val & 0x00ff00ff) << 8) | ((val & 0xff00ff00) >> 8); +} + + +#define michael_block(l, r) \ +do { \ + r ^= rotl(l, 17); \ + l += r; \ + r ^= xswap(l); \ + l += r; \ + r ^= rotl(l, 3); \ + l += r; \ + r ^= rotr(l, 2); \ + l += r; \ +} while (0) + + +static inline u32 get_le32(const u8 *p) +{ + return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24); +} + + +static inline void put_le32(u8 *p, u32 v) +{ + p[0] = v; + p[1] = v >> 8; + p[2] = v >> 16; + p[3] = v >> 24; +} + + +static void michael_init(void *ctx) +{ + struct michael_mic_ctx *mctx = ctx; + mctx->pending_len = 0; +} + + +static void michael_update(void *ctx, const u8 *data, unsigned int len) +{ + struct michael_mic_ctx *mctx = ctx; + + if (mctx->pending_len) { + int flen = 4 - mctx->pending_len; + if (flen > len) + flen = len; + memcpy(&mctx->pending[mctx->pending_len], data, flen); + mctx->pending_len += flen; + data += flen; + len -= flen; + + if (mctx->pending_len < 4) + return; + + mctx->l ^= get_le32(mctx->pending); + michael_block(mctx->l, mctx->r); + mctx->pending_len = 0; + } + + while (len >= 4) { + mctx->l ^= get_le32(data); + michael_block(mctx->l, mctx->r); + data += 4; + len -= 4; + } + + if (len > 0) { + mctx->pending_len = len; + memcpy(mctx->pending, data, len); + } +} + + +static void michael_final(void *ctx, u8 *out) +{ + struct michael_mic_ctx *mctx = ctx; + u8 *data = mctx->pending; + + /* Last block and padding (0x5a, 4..7 x 0) */ + switch (mctx->pending_len) { + case 0: + mctx->l ^= 0x5a; + break; + case 1: + mctx->l ^= data[0] | 0x5a00; + break; + case 2: + mctx->l ^= data[0] | (data[1] << 8) | 0x5a0000; + break; + case 3: + mctx->l ^= data[0] | (data[1] << 8) | (data[2] << 16) | + 0x5a000000; + break; + } + michael_block(mctx->l, mctx->r); + /* l ^= 0; */ + michael_block(mctx->l, mctx->r); + + put_le32(out, mctx->l); + put_le32(out + 4, mctx->r); +} + + +static int michael_setkey(void *ctx, const u8 *key, unsigned int keylen, + u32 *flags) +{ + struct michael_mic_ctx *mctx = ctx; + if (keylen != 8) { + if (flags) + *flags = CRYPTO_TFM_RES_BAD_KEY_LEN; + return -EINVAL; + } + mctx->l = get_le32(key); + mctx->r = get_le32(key + 4); + return 0; +} + + +static struct crypto_alg michael_mic_alg = { + .cra_name = "michael_mic", + .cra_flags = CRYPTO_ALG_TYPE_DIGEST, + .cra_blocksize = 8, + .cra_ctxsize = sizeof(struct michael_mic_ctx), + .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(michael_mic_alg.cra_list), + .cra_u = { .digest = { + .dia_digestsize = 8, + .dia_init = michael_init, + .dia_update = michael_update, + .dia_final = michael_final, + .dia_setkey = michael_setkey } } +}; + + +static int __init michael_mic_init(void) +{ + return crypto_register_alg(&michael_mic_alg); +} + + +static void __exit michael_mic_exit(void) +{ + crypto_unregister_alg(&michael_mic_alg); +} + + +module_init(michael_mic_init); +module_exit(michael_mic_exit); + +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("Michael MIC"); +MODULE_AUTHOR("Jouni Malinen "); diff --git a/drivers/staging/rtl8192u/ieee80211/proc.c b/drivers/staging/rtl8192u/ieee80211/proc.c new file mode 100644 index 000000000000..4f3f9ed7751a --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/proc.c @@ -0,0 +1,116 @@ +/* + * Scatterlist Cryptographic API. + * + * Procfs information. + * + * Copyright (c) 2002 James Morris + * + * 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. + * + */ +#include +//#include +#include "rtl_crypto.h" +#include +#include +#include +#include "internal.h" + +extern struct list_head crypto_alg_list; +extern struct rw_semaphore crypto_alg_sem; + +static void *c_start(struct seq_file *m, loff_t *pos) +{ + struct list_head *v; + loff_t n = *pos; + + down_read(&crypto_alg_sem); + list_for_each(v, &crypto_alg_list) + if (!n--) + return list_entry(v, struct crypto_alg, cra_list); + return NULL; +} + +static void *c_next(struct seq_file *m, void *p, loff_t *pos) +{ + struct list_head *v = p; + + (*pos)++; + v = v->next; + return (v == &crypto_alg_list) ? + NULL : list_entry(v, struct crypto_alg, cra_list); +} + +static void c_stop(struct seq_file *m, void *p) +{ + up_read(&crypto_alg_sem); +} + +static int c_show(struct seq_file *m, void *p) +{ + struct crypto_alg *alg = (struct crypto_alg *)p; + + seq_printf(m, "name : %s\n", alg->cra_name); + seq_printf(m, "module : %s\n", + (alg->cra_module ? + alg->cra_module->name : + "kernel")); + + switch (alg->cra_flags & CRYPTO_ALG_TYPE_MASK) { + case CRYPTO_ALG_TYPE_CIPHER: + seq_printf(m, "type : cipher\n"); + seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); + seq_printf(m, "min keysize : %u\n", + alg->cra_cipher.cia_min_keysize); + seq_printf(m, "max keysize : %u\n", + alg->cra_cipher.cia_max_keysize); + break; + + case CRYPTO_ALG_TYPE_DIGEST: + seq_printf(m, "type : digest\n"); + seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); + seq_printf(m, "digestsize : %u\n", + alg->cra_digest.dia_digestsize); + break; + case CRYPTO_ALG_TYPE_COMPRESS: + seq_printf(m, "type : compression\n"); + break; + default: + seq_printf(m, "type : unknown\n"); + break; + } + + seq_putc(m, '\n'); + return 0; +} + +static struct seq_operations crypto_seq_ops = { + .start = c_start, + .next = c_next, + .stop = c_stop, + .show = c_show +}; + +static int crypto_info_open(struct inode *inode, struct file *file) +{ + return seq_open(file, &crypto_seq_ops); +} + +static struct file_operations proc_crypto_ops = { + .open = crypto_info_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release +}; + +void __init crypto_init_proc(void) +{ + struct proc_dir_entry *proc; + + proc = create_proc_entry("crypto", 0, NULL); + if (proc) + proc->proc_fops = &proc_crypto_ops; +} diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BA.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_BA.h new file mode 100644 index 000000000000..8ddc8bf9dc26 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BA.h @@ -0,0 +1,69 @@ +#ifndef _BATYPE_H_ +#define _BATYPE_H_ + +#define TOTAL_TXBA_NUM 16 +#define TOTAL_RXBA_NUM 16 + +#define BA_SETUP_TIMEOUT 200 +#define BA_INACT_TIMEOUT 60000 + +#define BA_POLICY_DELAYED 0 +#define BA_POLICY_IMMEDIATE 1 + +#define ADDBA_STATUS_SUCCESS 0 +#define ADDBA_STATUS_REFUSED 37 +#define ADDBA_STATUS_INVALID_PARAM 38 + +#define DELBA_REASON_QSTA_LEAVING 36 +#define DELBA_REASON_END_BA 37 +#define DELBA_REASON_UNKNOWN_BA 38 +#define DELBA_REASON_TIMEOUT 39 +/* whether need define BA Action frames here? +struct ieee80211_ADDBA_Req{ + struct ieee80211_header_data header; + u8 category; + u8 +} __attribute__ ((packed)); +*/ +//Is this need?I put here just to make it easier to define structure BA_RECORD //WB +typedef union _SEQUENCE_CONTROL{ + u16 ShortData; + struct + { + u16 FragNum:4; + u16 SeqNum:12; + }field; +}SEQUENCE_CONTROL, *PSEQUENCE_CONTROL; + +typedef union _BA_PARAM_SET { + u8 charData[2]; + u16 shortData; + struct { + u16 AMSDU_Support:1; + u16 BAPolicy:1; + u16 TID:4; + u16 BufferSize:10; + } field; +} BA_PARAM_SET, *PBA_PARAM_SET; + +typedef union _DELBA_PARAM_SET { + u8 charData[2]; + u16 shortData; + struct { + u16 Reserved:11; + u16 Initiator:1; + u16 TID:4; + } field; +} DELBA_PARAM_SET, *PDELBA_PARAM_SET; + +typedef struct _BA_RECORD { + struct timer_list Timer; + u8 bValid; + u8 DialogToken; + BA_PARAM_SET BaParamSet; + u16 BaTimeoutValue; + SEQUENCE_CONTROL BaStartSeqCtrl; +} BA_RECORD, *PBA_RECORD; + +#endif //end _BATYPE_H_ + diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c new file mode 100644 index 000000000000..98b3bb6b6d69 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c @@ -0,0 +1,779 @@ +/******************************************************************************************************************************** + * This file is created to process BA Action Frame. According to 802.11 spec, there are 3 BA action types at all. And as BA is + * related to TS, this part need some struture defined in QOS side code. Also TX RX is going to be resturctured, so how to send + * ADDBAREQ ADDBARSP and DELBA packet is still on consideration. Temporarily use MANAGE QUEUE instead of Normal Queue. + * WB 2008-05-27 + * *****************************************************************************************************************************/ +#include "ieee80211.h" +#include "rtl819x_BA.h" + +/******************************************************************************************************************** + *function: Activate BA entry. And if Time is nozero, start timer. + * input: PBA_RECORD pBA //BA entry to be enabled + * u16 Time //indicate time delay. + * output: none +********************************************************************************************************************/ +void ActivateBAEntry(struct ieee80211_device* ieee, PBA_RECORD pBA, u16 Time) +{ + pBA->bValid = true; + if(Time != 0) + mod_timer(&pBA->Timer, jiffies + MSECS(Time)); +} + +/******************************************************************************************************************** + *function: deactivate BA entry, including its timer. + * input: PBA_RECORD pBA //BA entry to be disabled + * output: none +********************************************************************************************************************/ +void DeActivateBAEntry( struct ieee80211_device* ieee, PBA_RECORD pBA) +{ + pBA->bValid = false; + del_timer_sync(&pBA->Timer); +} +/******************************************************************************************************************** + *function: deactivete BA entry in Tx Ts, and send DELBA. + * input: + * PTX_TS_RECORD pTxTs //Tx Ts which is to deactivate BA entry. + * output: none + * notice: As PTX_TS_RECORD structure will be defined in QOS, so wait to be merged. //FIXME +********************************************************************************************************************/ +u8 TxTsDeleteBA( struct ieee80211_device* ieee, PTX_TS_RECORD pTxTs) +{ + PBA_RECORD pAdmittedBa = &pTxTs->TxAdmittedBARecord; //These two BA entries must exist in TS structure + PBA_RECORD pPendingBa = &pTxTs->TxPendingBARecord; + u8 bSendDELBA = false; + + // Delete pending BA + if(pPendingBa->bValid) + { + DeActivateBAEntry(ieee, pPendingBa); + bSendDELBA = true; + } + + // Delete admitted BA + if(pAdmittedBa->bValid) + { + DeActivateBAEntry(ieee, pAdmittedBa); + bSendDELBA = true; + } + + return bSendDELBA; +} + +/******************************************************************************************************************** + *function: deactivete BA entry in Tx Ts, and send DELBA. + * input: + * PRX_TS_RECORD pRxTs //Rx Ts which is to deactivate BA entry. + * output: none + * notice: As PRX_TS_RECORD structure will be defined in QOS, so wait to be merged. //FIXME, same with above +********************************************************************************************************************/ +u8 RxTsDeleteBA( struct ieee80211_device* ieee, PRX_TS_RECORD pRxTs) +{ + PBA_RECORD pBa = &pRxTs->RxAdmittedBARecord; + u8 bSendDELBA = false; + + if(pBa->bValid) + { + DeActivateBAEntry(ieee, pBa); + bSendDELBA = true; + } + + return bSendDELBA; +} + +/******************************************************************************************************************** + *function: reset BA entry + * input: + * PBA_RECORD pBA //entry to be reset + * output: none +********************************************************************************************************************/ +void ResetBaEntry( PBA_RECORD pBA) +{ + pBA->bValid = false; + pBA->BaParamSet.shortData = 0; + pBA->BaTimeoutValue = 0; + pBA->DialogToken = 0; + pBA->BaStartSeqCtrl.ShortData = 0; +} +//These functions need porting here or not? +/******************************************************************************************************************************* + *function: construct ADDBAREQ and ADDBARSP frame here together. + * input: u8* Dst //ADDBA frame's destination + * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA. + * u16 StatusCode //status code in RSP and I will use it to indicate whether it's RSP or REQ(will I?) + * u8 type //indicate whether it's RSP(ACT_ADDBARSP) ow REQ(ACT_ADDBAREQ) + * output: none + * return: sk_buff* skb //return constructed skb to xmit +*******************************************************************************************************************************/ +static struct sk_buff* ieee80211_ADDBA(struct ieee80211_device* ieee, u8* Dst, PBA_RECORD pBA, u16 StatusCode, u8 type) +{ + struct sk_buff *skb = NULL; + struct ieee80211_hdr_3addr* BAReq = NULL; + u8* tag = NULL; + u16 tmp = 0; + u16 len = ieee->tx_headroom + 9; + //category(1) + action field(1) + Dialog Token(1) + BA Parameter Set(2) + BA Timeout Value(2) + BA Start SeqCtrl(2)(or StatusCode(2)) + IEEE80211_DEBUG(IEEE80211_DL_TRACE | IEEE80211_DL_BA, "========>%s(), frame(%d) sentd to:"MAC_FMT", ieee->dev:%p\n", __FUNCTION__, type, MAC_ARG(Dst), ieee->dev); + if (pBA == NULL||ieee == NULL) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "pBA(%p) is NULL or ieee(%p) is NULL\n", pBA, ieee); + return NULL; + } + skb = dev_alloc_skb(len + sizeof( struct ieee80211_hdr_3addr)); //need to add something others? FIXME + if (skb == NULL) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc skb for ADDBA_REQ\n"); + return NULL; + } + + memset(skb->data, 0, sizeof( struct ieee80211_hdr_3addr)); //I wonder whether it's necessary. Apparently kernel will not do it when alloc a skb. + skb_reserve(skb, ieee->tx_headroom); + + BAReq = ( struct ieee80211_hdr_3addr *) skb_put(skb,sizeof( struct ieee80211_hdr_3addr)); + + memcpy(BAReq->addr1, Dst, ETH_ALEN); + memcpy(BAReq->addr2, ieee->dev->dev_addr, ETH_ALEN); + + memcpy(BAReq->addr3, ieee->current_network.bssid, ETH_ALEN); + + BAReq->frame_ctl = cpu_to_le16(IEEE80211_STYPE_MANAGE_ACT); //action frame + + //tag += sizeof( struct ieee80211_hdr_3addr); //move to action field + tag = (u8*)skb_put(skb, 9); + *tag ++= ACT_CAT_BA; + *tag ++= type; + // Dialog Token + *tag ++= pBA->DialogToken; + + if (ACT_ADDBARSP == type) + { + // Status Code + printk("=====>to send ADDBARSP\n"); + tmp = cpu_to_le16(StatusCode); + memcpy(tag, (u8*)&tmp, 2); + tag += 2; + } + // BA Parameter Set + tmp = cpu_to_le16(pBA->BaParamSet.shortData); + memcpy(tag, (u8*)&tmp, 2); + tag += 2; + // BA Timeout Value + tmp = cpu_to_le16(pBA->BaTimeoutValue); + memcpy(tag, (u8*)&tmp, 2); + tag += 2; + + if (ACT_ADDBAREQ == type) + { + // BA Start SeqCtrl + memcpy(tag,(u8*)&(pBA->BaStartSeqCtrl), 2); + tag += 2; + } + + IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_BA, skb->data, skb->len); + return skb; + //return NULL; +} + +#if 0 //I try to merge ADDBA_REQ and ADDBA_RSP frames together.. +/******************************************************************************************************************** + *function: construct ADDBAREQ frame + * input: u8* dst //ADDBARsp frame's destination + * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA_RSP. + * u16 StatusCode //status code. + * output: none + * return: sk_buff* skb //return constructed skb to xmit +********************************************************************************************************************/ +static struct sk_buff* ieee80211_ADDBA_Rsp( IN struct ieee80211_device* ieee, u8* dst, PBA_RECORD pBA, u16 StatusCode) +{ + OCTET_STRING osADDBAFrame, tmp; + + FillOctetString(osADDBAFrame, Buffer, 0); + *pLength = 0; + + ConstructMaFrameHdr( + Adapter, + Addr, + ACT_CAT_BA, + ACT_ADDBARSP, + &osADDBAFrame ); + + // Dialog Token + FillOctetString(tmp, &pBA->DialogToken, 1); + PacketAppendData(&osADDBAFrame, tmp); + + // Status Code + FillOctetString(tmp, &StatusCode, 2); + PacketAppendData(&osADDBAFrame, tmp); + + // BA Parameter Set + FillOctetString(tmp, &pBA->BaParamSet, 2); + PacketAppendData(&osADDBAFrame, tmp); + + // BA Timeout Value + FillOctetString(tmp, &pBA->BaTimeoutValue, 2); + PacketAppendData(&osADDBAFrame, tmp); + + *pLength = osADDBAFrame.Length; +} +#endif + +/******************************************************************************************************************** + *function: construct DELBA frame + * input: u8* dst //DELBA frame's destination + * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA + * TR_SELECT TxRxSelect //TX RX direction + * u16 ReasonCode //status code. + * output: none + * return: sk_buff* skb //return constructed skb to xmit +********************************************************************************************************************/ +static struct sk_buff* ieee80211_DELBA( + struct ieee80211_device* ieee, + u8* dst, + PBA_RECORD pBA, + TR_SELECT TxRxSelect, + u16 ReasonCode + ) +{ + DELBA_PARAM_SET DelbaParamSet; + struct sk_buff *skb = NULL; + struct ieee80211_hdr_3addr* Delba = NULL; + u8* tag = NULL; + u16 tmp = 0; + //len = head len + DELBA Parameter Set(2) + Reason Code(2) + u16 len = 6 + ieee->tx_headroom; + + if (net_ratelimit()) + IEEE80211_DEBUG(IEEE80211_DL_TRACE | IEEE80211_DL_BA, "========>%s(), ReasonCode(%d) sentd to:"MAC_FMT"\n", __FUNCTION__, ReasonCode, MAC_ARG(dst)); + + memset(&DelbaParamSet, 0, 2); + + DelbaParamSet.field.Initiator = (TxRxSelect==TX_DIR)?1:0; + DelbaParamSet.field.TID = pBA->BaParamSet.field.TID; + + skb = dev_alloc_skb(len + sizeof( struct ieee80211_hdr_3addr)); //need to add something others? FIXME + if (skb == NULL) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc skb for ADDBA_REQ\n"); + return NULL; + } +// memset(skb->data, 0, len+sizeof( struct ieee80211_hdr_3addr)); + skb_reserve(skb, ieee->tx_headroom); + + Delba = ( struct ieee80211_hdr_3addr *) skb_put(skb,sizeof( struct ieee80211_hdr_3addr)); + + memcpy(Delba->addr1, dst, ETH_ALEN); + memcpy(Delba->addr2, ieee->dev->dev_addr, ETH_ALEN); + memcpy(Delba->addr3, ieee->current_network.bssid, ETH_ALEN); + Delba->frame_ctl = cpu_to_le16(IEEE80211_STYPE_MANAGE_ACT); //action frame + + tag = (u8*)skb_put(skb, 6); + + *tag ++= ACT_CAT_BA; + *tag ++= ACT_DELBA; + + // DELBA Parameter Set + tmp = cpu_to_le16(DelbaParamSet.shortData); + memcpy(tag, (u8*)&tmp, 2); + tag += 2; + // Reason Code + tmp = cpu_to_le16(ReasonCode); + memcpy(tag, (u8*)&tmp, 2); + tag += 2; + + IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_BA, skb->data, skb->len); + if (net_ratelimit()) + IEEE80211_DEBUG(IEEE80211_DL_TRACE | IEEE80211_DL_BA, "<=====%s()\n", __FUNCTION__); + return skb; +} + +/******************************************************************************************************************** + *function: send ADDBAReq frame out + * input: u8* dst //ADDBAReq frame's destination + * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA + * output: none + * notice: If any possible, please hide pBA in ieee. And temporarily use Manage Queue as softmac_mgmt_xmit() usually does +********************************************************************************************************************/ +void ieee80211_send_ADDBAReq(struct ieee80211_device* ieee, u8* dst, PBA_RECORD pBA) +{ + struct sk_buff *skb = NULL; + skb = ieee80211_ADDBA(ieee, dst, pBA, 0, ACT_ADDBAREQ); //construct ACT_ADDBAREQ frames so set statuscode zero. + + if (skb) + { + softmac_mgmt_xmit(skb, ieee); + //add statistic needed here. + //and skb will be freed in softmac_mgmt_xmit(), so omit all dev_kfree_skb_any() outside softmac_mgmt_xmit() + //WB + } + else + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "alloc skb error in function %s()\n", __FUNCTION__); + } + return; +} + +/******************************************************************************************************************** + *function: send ADDBARSP frame out + * input: u8* dst //DELBA frame's destination + * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA + * u16 StatusCode //RSP StatusCode + * output: none + * notice: If any possible, please hide pBA in ieee. And temporarily use Manage Queue as softmac_mgmt_xmit() usually does +********************************************************************************************************************/ +void ieee80211_send_ADDBARsp(struct ieee80211_device* ieee, u8* dst, PBA_RECORD pBA, u16 StatusCode) +{ + struct sk_buff *skb = NULL; + skb = ieee80211_ADDBA(ieee, dst, pBA, StatusCode, ACT_ADDBARSP); //construct ACT_ADDBARSP frames + if (skb) + { + softmac_mgmt_xmit(skb, ieee); + //same above + } + else + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "alloc skb error in function %s()\n", __FUNCTION__); + } + + return; + +} +/******************************************************************************************************************** + *function: send ADDBARSP frame out + * input: u8* dst //DELBA frame's destination + * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA + * TR_SELECT TxRxSelect //TX or RX + * u16 ReasonCode //DEL ReasonCode + * output: none + * notice: If any possible, please hide pBA in ieee. And temporarily use Manage Queue as softmac_mgmt_xmit() usually does +********************************************************************************************************************/ + +void ieee80211_send_DELBA(struct ieee80211_device* ieee, u8* dst, PBA_RECORD pBA, TR_SELECT TxRxSelect, u16 ReasonCode) +{ + struct sk_buff *skb = NULL; + skb = ieee80211_DELBA(ieee, dst, pBA, TxRxSelect, ReasonCode); //construct ACT_ADDBARSP frames + if (skb) + { + softmac_mgmt_xmit(skb, ieee); + //same above + } + else + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "alloc skb error in function %s()\n", __FUNCTION__); + } + return ; +} + +/******************************************************************************************************************** + *function: RX ADDBAReq + * input: struct sk_buff * skb //incoming ADDBAReq skb. + * return: 0(pass), other(fail) + * notice: As this function need support of QOS, I comment some code out. And when qos is ready, this code need to be support. +********************************************************************************************************************/ +int ieee80211_rx_ADDBAReq( struct ieee80211_device* ieee, struct sk_buff *skb) +{ + struct ieee80211_hdr_3addr* req = NULL; + u16 rc = 0; + u8 * dst = NULL, *pDialogToken = NULL, *tag = NULL; + PBA_RECORD pBA = NULL; + PBA_PARAM_SET pBaParamSet = NULL; + u16* pBaTimeoutVal = NULL; + PSEQUENCE_CONTROL pBaStartSeqCtrl = NULL; + PRX_TS_RECORD pTS = NULL; + + if (skb->len < sizeof( struct ieee80211_hdr_3addr) + 9) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in BAREQ(%d / %d)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 9)); + return -1; + } + + IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_BA, skb->data, skb->len); + + req = ( struct ieee80211_hdr_3addr*) skb->data; + tag = (u8*)req; + dst = (u8*)(&req->addr2[0]); + tag += sizeof( struct ieee80211_hdr_3addr); + pDialogToken = tag + 2; //category+action + pBaParamSet = (PBA_PARAM_SET)(tag + 3); //+DialogToken + pBaTimeoutVal = (u16*)(tag + 5); + pBaStartSeqCtrl = (PSEQUENCE_CONTROL)(req + 7); + + printk("====================>rx ADDBAREQ from :"MAC_FMT"\n", MAC_ARG(dst)); +//some other capability is not ready now. + if( (ieee->current_network.qos_data.active == 0) || + (ieee->pHTInfo->bCurrentHTSupport == false)) //|| + // (ieee->pStaQos->bEnableRxImmBA == false) ) + { + rc = ADDBA_STATUS_REFUSED; + IEEE80211_DEBUG(IEEE80211_DL_ERR, "Failed to reply on ADDBA_REQ as some capability is not ready(%d, %d)\n", ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport); + goto OnADDBAReq_Fail; + } + // Search for related traffic stream. + // If there is no matched TS, reject the ADDBA request. + if( !GetTs( + ieee, + (PTS_COMMON_INFO*)(&pTS), + dst, + (u8)(pBaParamSet->field.TID), + RX_DIR, + true) ) + { + rc = ADDBA_STATUS_REFUSED; + IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't get TS in %s()\n", __FUNCTION__); + goto OnADDBAReq_Fail; + } + pBA = &pTS->RxAdmittedBARecord; + // To Determine the ADDBA Req content + // We can do much more check here, including BufferSize, AMSDU_Support, Policy, StartSeqCtrl... + // I want to check StartSeqCtrl to make sure when we start aggregation!!! + // + if(pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED) + { + rc = ADDBA_STATUS_INVALID_PARAM; + IEEE80211_DEBUG(IEEE80211_DL_ERR, "BA Policy is not correct in %s()\n", __FUNCTION__); + goto OnADDBAReq_Fail; + } + // Admit the ADDBA Request + // + DeActivateBAEntry(ieee, pBA); + pBA->DialogToken = *pDialogToken; + pBA->BaParamSet = *pBaParamSet; + pBA->BaTimeoutValue = *pBaTimeoutVal; + pBA->BaStartSeqCtrl = *pBaStartSeqCtrl; + //for half N mode we only aggregate 1 frame + if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) + pBA->BaParamSet.field.BufferSize = 1; + else + pBA->BaParamSet.field.BufferSize = 32; + ActivateBAEntry(ieee, pBA, pBA->BaTimeoutValue); + ieee80211_send_ADDBARsp(ieee, dst, pBA, ADDBA_STATUS_SUCCESS); + + // End of procedure. + return 0; + +OnADDBAReq_Fail: + { + BA_RECORD BA; + BA.BaParamSet = *pBaParamSet; + BA.BaTimeoutValue = *pBaTimeoutVal; + BA.DialogToken = *pDialogToken; + BA.BaParamSet.field.BAPolicy = BA_POLICY_IMMEDIATE; + ieee80211_send_ADDBARsp(ieee, dst, &BA, rc); + return 0; //we send RSP out. + } + +} + +/******************************************************************************************************************** + *function: RX ADDBARSP + * input: struct sk_buff * skb //incoming ADDBAReq skb. + * return: 0(pass), other(fail) + * notice: As this function need support of QOS, I comment some code out. And when qos is ready, this code need to be support. +********************************************************************************************************************/ +int ieee80211_rx_ADDBARsp( struct ieee80211_device* ieee, struct sk_buff *skb) +{ + struct ieee80211_hdr_3addr* rsp = NULL; + PBA_RECORD pPendingBA, pAdmittedBA; + PTX_TS_RECORD pTS = NULL; + u8* dst = NULL, *pDialogToken = NULL, *tag = NULL; + u16* pStatusCode = NULL, *pBaTimeoutVal = NULL; + PBA_PARAM_SET pBaParamSet = NULL; + u16 ReasonCode; + + if (skb->len < sizeof( struct ieee80211_hdr_3addr) + 9) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in BARSP(%d / %d)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 9)); + return -1; + } + rsp = ( struct ieee80211_hdr_3addr*)skb->data; + tag = (u8*)rsp; + dst = (u8*)(&rsp->addr2[0]); + tag += sizeof( struct ieee80211_hdr_3addr); + pDialogToken = tag + 2; + pStatusCode = (u16*)(tag + 3); + pBaParamSet = (PBA_PARAM_SET)(tag + 5); + pBaTimeoutVal = (u16*)(tag + 7); + + // Check the capability + // Since we can always receive A-MPDU, we just check if it is under HT mode. + if( ieee->current_network.qos_data.active == 0 || + ieee->pHTInfo->bCurrentHTSupport == false || + ieee->pHTInfo->bCurrentAMPDUEnable == false ) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "reject to ADDBA_RSP as some capability is not ready(%d, %d, %d)\n",ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport, ieee->pHTInfo->bCurrentAMPDUEnable); + ReasonCode = DELBA_REASON_UNKNOWN_BA; + goto OnADDBARsp_Reject; + } + + + // + // Search for related TS. + // If there is no TS found, we wil reject ADDBA Rsp by sending DELBA frame. + // + if (!GetTs( + ieee, + (PTS_COMMON_INFO*)(&pTS), + dst, + (u8)(pBaParamSet->field.TID), + TX_DIR, + false) ) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't get TS in %s()\n", __FUNCTION__); + ReasonCode = DELBA_REASON_UNKNOWN_BA; + goto OnADDBARsp_Reject; + } + + pTS->bAddBaReqInProgress = false; + pPendingBA = &pTS->TxPendingBARecord; + pAdmittedBA = &pTS->TxAdmittedBARecord; + + + // + // Check if related BA is waiting for setup. + // If not, reject by sending DELBA frame. + // + if((pAdmittedBA->bValid==true)) + { + // Since BA is already setup, we ignore all other ADDBA Response. + IEEE80211_DEBUG(IEEE80211_DL_BA, "OnADDBARsp(): Recv ADDBA Rsp. Drop because already admit it! \n"); + return -1; + } + else if((pPendingBA->bValid == false) ||(*pDialogToken != pPendingBA->DialogToken)) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "OnADDBARsp(): Recv ADDBA Rsp. BA invalid, DELBA! \n"); + ReasonCode = DELBA_REASON_UNKNOWN_BA; + goto OnADDBARsp_Reject; + } + else + { + IEEE80211_DEBUG(IEEE80211_DL_BA, "OnADDBARsp(): Recv ADDBA Rsp. BA is admitted! Status code:%X\n", *pStatusCode); + DeActivateBAEntry(ieee, pPendingBA); + } + + + if(*pStatusCode == ADDBA_STATUS_SUCCESS) + { + // + // Determine ADDBA Rsp content here. + // We can compare the value of BA parameter set that Peer returned and Self sent. + // If it is OK, then admitted. Or we can send DELBA to cancel BA mechanism. + // + if(pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED) + { + // Since this is a kind of ADDBA failed, we delay next ADDBA process. + pTS->bAddBaReqDelayed = true; + DeActivateBAEntry(ieee, pAdmittedBA); + ReasonCode = DELBA_REASON_END_BA; + goto OnADDBARsp_Reject; + } + + + // + // Admitted condition + // + pAdmittedBA->DialogToken = *pDialogToken; + pAdmittedBA->BaTimeoutValue = *pBaTimeoutVal; + pAdmittedBA->BaStartSeqCtrl = pPendingBA->BaStartSeqCtrl; + pAdmittedBA->BaParamSet = *pBaParamSet; + DeActivateBAEntry(ieee, pAdmittedBA); + ActivateBAEntry(ieee, pAdmittedBA, *pBaTimeoutVal); + } + else + { + // Delay next ADDBA process. + pTS->bAddBaReqDelayed = true; + } + + // End of procedure + return 0; + +OnADDBARsp_Reject: + { + BA_RECORD BA; + BA.BaParamSet = *pBaParamSet; + ieee80211_send_DELBA(ieee, dst, &BA, TX_DIR, ReasonCode); + return 0; + } + +} + +/******************************************************************************************************************** + *function: RX DELBA + * input: struct sk_buff * skb //incoming ADDBAReq skb. + * return: 0(pass), other(fail) + * notice: As this function need support of QOS, I comment some code out. And when qos is ready, this code need to be support. +********************************************************************************************************************/ +int ieee80211_rx_DELBA(struct ieee80211_device* ieee,struct sk_buff *skb) +{ + struct ieee80211_hdr_3addr* delba = NULL; + PDELBA_PARAM_SET pDelBaParamSet = NULL; + u16* pReasonCode = NULL; + u8* dst = NULL; + + if (skb->len < sizeof( struct ieee80211_hdr_3addr) + 6) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in DELBA(%d / %d)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 6)); + return -1; + } + + if(ieee->current_network.qos_data.active == 0 || + ieee->pHTInfo->bCurrentHTSupport == false ) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "received DELBA while QOS or HT is not supported(%d, %d)\n",ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport); + return -1; + } + + IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_BA, skb->data, skb->len); + delba = ( struct ieee80211_hdr_3addr*)skb->data; + dst = (u8*)(&delba->addr2[0]); + delba += sizeof( struct ieee80211_hdr_3addr); + pDelBaParamSet = (PDELBA_PARAM_SET)(delba+2); + pReasonCode = (u16*)(delba+4); + + if(pDelBaParamSet->field.Initiator == 1) + { + PRX_TS_RECORD pRxTs; + + if( !GetTs( + ieee, + (PTS_COMMON_INFO*)&pRxTs, + dst, + (u8)pDelBaParamSet->field.TID, + RX_DIR, + false) ) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't get TS for RXTS in %s()\n", __FUNCTION__); + return -1; + } + + RxTsDeleteBA(ieee, pRxTs); + } + else + { + PTX_TS_RECORD pTxTs; + + if(!GetTs( + ieee, + (PTS_COMMON_INFO*)&pTxTs, + dst, + (u8)pDelBaParamSet->field.TID, + TX_DIR, + false) ) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't get TS for TXTS in %s()\n", __FUNCTION__); + return -1; + } + + pTxTs->bUsingBa = false; + pTxTs->bAddBaReqInProgress = false; + pTxTs->bAddBaReqDelayed = false; + del_timer_sync(&pTxTs->TsAddBaTimer); + //PlatformCancelTimer(Adapter, &pTxTs->TsAddBaTimer); + TxTsDeleteBA(ieee, pTxTs); + } + return 0; +} + +// +// ADDBA initiate. This can only be called by TX side. +// +void +TsInitAddBA( + struct ieee80211_device* ieee, + PTX_TS_RECORD pTS, + u8 Policy, + u8 bOverwritePending + ) +{ + PBA_RECORD pBA = &pTS->TxPendingBARecord; + + if(pBA->bValid==true && bOverwritePending==false) + return; + + // Set parameters to "Pending" variable set + DeActivateBAEntry(ieee, pBA); + + pBA->DialogToken++; // DialogToken: Only keep the latest dialog token + pBA->BaParamSet.field.AMSDU_Support = 0; // Do not support A-MSDU with A-MPDU now!! + pBA->BaParamSet.field.BAPolicy = Policy; // Policy: Delayed or Immediate + pBA->BaParamSet.field.TID = pTS->TsCommonInfo.TSpec.f.TSInfo.field.ucTSID; // TID + // BufferSize: This need to be set according to A-MPDU vector + pBA->BaParamSet.field.BufferSize = 32; // BufferSize: This need to be set according to A-MPDU vector + pBA->BaTimeoutValue = 0; // Timeout value: Set 0 to disable Timer + pBA->BaStartSeqCtrl.field.SeqNum = (pTS->TxCurSeq + 3) % 4096; // Block Ack will start after 3 packets later. + + ActivateBAEntry(ieee, pBA, BA_SETUP_TIMEOUT); + + ieee80211_send_ADDBAReq(ieee, pTS->TsCommonInfo.Addr, pBA); +} + +void +TsInitDelBA( struct ieee80211_device* ieee, PTS_COMMON_INFO pTsCommonInfo, TR_SELECT TxRxSelect) +{ + + if(TxRxSelect == TX_DIR) + { + PTX_TS_RECORD pTxTs = (PTX_TS_RECORD)pTsCommonInfo; + + if(TxTsDeleteBA(ieee, pTxTs)) + ieee80211_send_DELBA( + ieee, + pTsCommonInfo->Addr, + (pTxTs->TxAdmittedBARecord.bValid)?(&pTxTs->TxAdmittedBARecord):(&pTxTs->TxPendingBARecord), + TxRxSelect, + DELBA_REASON_END_BA); + } + else if(TxRxSelect == RX_DIR) + { + PRX_TS_RECORD pRxTs = (PRX_TS_RECORD)pTsCommonInfo; + if(RxTsDeleteBA(ieee, pRxTs)) + ieee80211_send_DELBA( + ieee, + pTsCommonInfo->Addr, + &pRxTs->RxAdmittedBARecord, + TxRxSelect, + DELBA_REASON_END_BA ); + } +} +/******************************************************************************************************************** + *function: BA setup timer + * input: unsigned long data //acturally we send TX_TS_RECORD or RX_TS_RECORD to these timer + * return: NULL + * notice: +********************************************************************************************************************/ +void BaSetupTimeOut(unsigned long data) +{ + PTX_TS_RECORD pTxTs = (PTX_TS_RECORD)data; + + pTxTs->bAddBaReqInProgress = false; + pTxTs->bAddBaReqDelayed = true; + pTxTs->TxPendingBARecord.bValid = false; +} + +void TxBaInactTimeout(unsigned long data) +{ + PTX_TS_RECORD pTxTs = (PTX_TS_RECORD)data; + struct ieee80211_device *ieee = container_of(pTxTs, struct ieee80211_device, TxTsRecord[pTxTs->num]); + TxTsDeleteBA(ieee, pTxTs); + ieee80211_send_DELBA( + ieee, + pTxTs->TsCommonInfo.Addr, + &pTxTs->TxAdmittedBARecord, + TX_DIR, + DELBA_REASON_TIMEOUT); +} + +void RxBaInactTimeout(unsigned long data) +{ + PRX_TS_RECORD pRxTs = (PRX_TS_RECORD)data; + struct ieee80211_device *ieee = container_of(pRxTs, struct ieee80211_device, RxTsRecord[pRxTs->num]); + + RxTsDeleteBA(ieee, pRxTs); + ieee80211_send_DELBA( + ieee, + pRxTs->TsCommonInfo.Addr, + &pRxTs->RxAdmittedBARecord, + RX_DIR, + DELBA_REASON_TIMEOUT); + return ; +} + diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h new file mode 100644 index 000000000000..992b71825a8b --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h @@ -0,0 +1,481 @@ +#ifndef _RTL819XU_HTTYPE_H_ +#define _RTL819XU_HTTYPE_H_ + +//------------------------------------------------------------ +// The HT Capability element is present in beacons, association request, +// reassociation request and probe response frames +//------------------------------------------------------------ + +// +// Operation mode value +// +#define HT_OPMODE_NO_PROTECT 0 +#define HT_OPMODE_OPTIONAL 1 +#define HT_OPMODE_40MHZ_PROTECT 2 +#define HT_OPMODE_MIXED 3 + +// +// MIMO Power Save Setings +// +#define MIMO_PS_STATIC 0 +#define MIMO_PS_DYNAMIC 1 +#define MIMO_PS_NOLIMIT 3 + + +// +// There should be 128 bits to cover all of the MCS rates. However, since +// 8190 does not support too much rates, one integer is quite enough. +// + +#define sHTCLng 4 + + +#define HT_SUPPORTED_MCS_1SS_BITMAP 0x000000ff +#define HT_SUPPORTED_MCS_2SS_BITMAP 0x0000ff00 +#define HT_SUPPORTED_MCS_1SS_2SS_BITMAP HT_MCS_1SS_BITMAP|HT_MCS_1SS_2SS_BITMAP + + +typedef enum _HT_MCS_RATE{ + HT_MCS0 = 0x00000001, + HT_MCS1 = 0x00000002, + HT_MCS2 = 0x00000004, + HT_MCS3 = 0x00000008, + HT_MCS4 = 0x00000010, + HT_MCS5 = 0x00000020, + HT_MCS6 = 0x00000040, + HT_MCS7 = 0x00000080, + HT_MCS8 = 0x00000100, + HT_MCS9 = 0x00000200, + HT_MCS10 = 0x00000400, + HT_MCS11 = 0x00000800, + HT_MCS12 = 0x00001000, + HT_MCS13 = 0x00002000, + HT_MCS14 = 0x00004000, + HT_MCS15 = 0x00008000, + // Do not define MCS32 here although 8190 support MCS32 +}HT_MCS_RATE,*PHT_MCS_RATE; + +// +// Represent Channel Width in HT Capabilities +// +typedef enum _HT_CHANNEL_WIDTH{ + HT_CHANNEL_WIDTH_20 = 0, + HT_CHANNEL_WIDTH_20_40 = 1, +}HT_CHANNEL_WIDTH, *PHT_CHANNEL_WIDTH; + +// +// Represent Extention Channel Offset in HT Capabilities +// This is available only in 40Mhz mode. +// +typedef enum _HT_EXTCHNL_OFFSET{ + HT_EXTCHNL_OFFSET_NO_EXT = 0, + HT_EXTCHNL_OFFSET_UPPER = 1, + HT_EXTCHNL_OFFSET_NO_DEF = 2, + HT_EXTCHNL_OFFSET_LOWER = 3, +}HT_EXTCHNL_OFFSET, *PHT_EXTCHNL_OFFSET; + +typedef enum _CHNLOP{ + CHNLOP_NONE = 0, // No Action now + CHNLOP_SCAN = 1, // Scan in progress + CHNLOP_SWBW = 2, // Bandwidth switching in progress + CHNLOP_SWCHNL = 3, // Software Channel switching in progress +} CHNLOP, *PCHNLOP; + +// Determine if the Channel Operation is in progress +#define CHHLOP_IN_PROGRESS(_pHTInfo) \ + ((_pHTInfo)->ChnlOp > CHNLOP_NONE) ? TRUE : FALSE + +/* +typedef union _HT_CAPABILITY{ + u16 ShortData; + u8 CharData[2]; + struct + { + u16 AdvCoding:1; + u16 ChlWidth:1; + u16 MimoPwrSave:2; + u16 GreenField:1; + u16 ShortGI20Mhz:1; + u16 ShortGI40Mhz:1; + u16 STBC:1; + u16 BeamForm:1; + u16 DelayBA:1; + u16 MaxAMSDUSize:1; + u16 DssCCk:1; + u16 PSMP:1; + u16 Rsvd:3; + }Field; +}HT_CAPABILITY, *PHT_CAPABILITY; + +typedef union _HT_CAPABILITY_MACPARA{ + u8 ShortData; + u8 CharData[1]; + struct + { + u8 MaxRxAMPDU:2; + u8 MPDUDensity:2; + u8 Rsvd:4; + }Field; +}HT_CAPABILITY_MACPARA, *PHT_CAPABILITY_MACPARA; +*/ + +typedef enum _HT_ACTION{ + ACT_RECOMMAND_WIDTH = 0, + ACT_MIMO_PWR_SAVE = 1, + ACT_PSMP = 2, + ACT_SET_PCO_PHASE = 3, + ACT_MIMO_CHL_MEASURE = 4, + ACT_RECIPROCITY_CORRECT = 5, + ACT_MIMO_CSI_MATRICS = 6, + ACT_MIMO_NOCOMPR_STEER = 7, + ACT_MIMO_COMPR_STEER = 8, + ACT_ANTENNA_SELECT = 9, +} HT_ACTION, *PHT_ACTION; + + +/* 2007/06/07 MH Define sub-carrier mode for 40MHZ. */ +typedef enum _HT_Bandwidth_40MHZ_Sub_Carrier{ + SC_MODE_DUPLICATE = 0, + SC_MODE_LOWER = 1, + SC_MODE_UPPER = 2, + SC_MODE_FULL40MHZ = 3, +}HT_BW40_SC_E; + +typedef struct _HT_CAPABILITY_ELE{ + + //HT capability info + u8 AdvCoding:1; + u8 ChlWidth:1; + u8 MimoPwrSave:2; + u8 GreenField:1; + u8 ShortGI20Mhz:1; + u8 ShortGI40Mhz:1; + u8 TxSTBC:1; + u8 RxSTBC:2; + u8 DelayBA:1; + u8 MaxAMSDUSize:1; + u8 DssCCk:1; + u8 PSMP:1; + u8 Rsvd1:1; + u8 LSigTxopProtect:1; + + //MAC HT parameters info + u8 MaxRxAMPDUFactor:2; + u8 MPDUDensity:3; + u8 Rsvd2:3; + + //Supported MCS set + u8 MCS[16]; + + + //Extended HT Capability Info + u16 ExtHTCapInfo; + + //TXBF Capabilities + u8 TxBFCap[4]; + + //Antenna Selection Capabilities + u8 ASCap; + +} __attribute__ ((packed)) HT_CAPABILITY_ELE, *PHT_CAPABILITY_ELE; + +//------------------------------------------------------------ +// The HT Information element is present in beacons +// Only AP is required to include this element +//------------------------------------------------------------ + +typedef struct _HT_INFORMATION_ELE{ + u8 ControlChl; + + u8 ExtChlOffset:2; + u8 RecommemdedTxWidth:1; + u8 RIFS:1; + u8 PSMPAccessOnly:1; + u8 SrvIntGranularity:3; + + u8 OptMode:2; + u8 NonGFDevPresent:1; + u8 Revd1:5; + u8 Revd2:8; + + u8 Rsvd3:6; + u8 DualBeacon:1; + u8 DualCTSProtect:1; + + u8 SecondaryBeacon:1; + u8 LSigTxopProtectFull:1; + u8 PcoActive:1; + u8 PcoPhase:1; + u8 Rsvd4:4; + + u8 BasicMSC[16]; +} __attribute__ ((packed)) HT_INFORMATION_ELE, *PHT_INFORMATION_ELE; + +// +// MIMO Power Save control field. +// This is appear in MIMO Power Save Action Frame +// +typedef struct _MIMOPS_CTRL{ + u8 MimoPsEnable:1; + u8 MimoPsMode:1; + u8 Reserved:6; +} MIMOPS_CTRL, *PMIMOPS_CTRL; + +typedef enum _HT_SPEC_VER{ + HT_SPEC_VER_IEEE = 0, + HT_SPEC_VER_EWC = 1, +}HT_SPEC_VER, *PHT_SPEC_VER; + +typedef enum _HT_AGGRE_MODE_E{ + HT_AGG_AUTO = 0, + HT_AGG_FORCE_ENABLE = 1, + HT_AGG_FORCE_DISABLE = 2, +}HT_AGGRE_MODE_E, *PHT_AGGRE_MODE_E; + +//------------------------------------------------------------ +// The Data structure is used to keep HT related variables when card is +// configured as non-AP STA mode. **Note** Current_xxx should be set +// to default value in HTInitializeHTInfo() +//------------------------------------------------------------ + +typedef struct _RT_HIGH_THROUGHPUT{ + u8 bEnableHT; + u8 bCurrentHTSupport; + + u8 bRegBW40MHz; // Tx 40MHz channel capablity + u8 bCurBW40MHz; // Tx 40MHz channel capability + + u8 bRegShortGI40MHz; // Tx Short GI for 40Mhz + u8 bCurShortGI40MHz; // Tx Short GI for 40MHz + + u8 bRegShortGI20MHz; // Tx Short GI for 20MHz + u8 bCurShortGI20MHz; // Tx Short GI for 20MHz + + u8 bRegSuppCCK; // Tx CCK rate capability + u8 bCurSuppCCK; // Tx CCK rate capability + + // 802.11n spec version for "peer" + HT_SPEC_VER ePeerHTSpecVer; + + + // HT related information for "Self" + HT_CAPABILITY_ELE SelfHTCap; // This is HT cap element sent to peer STA, which also indicate HT Rx capabilities. + HT_INFORMATION_ELE SelfHTInfo; // This is HT info element sent to peer STA, which also indicate HT Rx capabilities. + + // HT related information for "Peer" + u8 PeerHTCapBuf[32]; + u8 PeerHTInfoBuf[32]; + + + // A-MSDU related + u8 bAMSDU_Support; // This indicates Tx A-MSDU capability + u16 nAMSDU_MaxSize; // This indicates Tx A-MSDU capability + u8 bCurrent_AMSDU_Support; // This indicates Tx A-MSDU capability + u16 nCurrent_AMSDU_MaxSize; // This indicates Tx A-MSDU capability + + + // AMPDU related <2006.08.10 Emily> + u8 bAMPDUEnable; // This indicate Tx A-MPDU capability + u8 bCurrentAMPDUEnable; // This indicate Tx A-MPDU capability + u8 AMPDU_Factor; // This indicate Tx A-MPDU capability + u8 CurrentAMPDUFactor; // This indicate Tx A-MPDU capability + u8 MPDU_Density; // This indicate Tx A-MPDU capability + u8 CurrentMPDUDensity; // This indicate Tx A-MPDU capability + + // Forced A-MPDU enable + HT_AGGRE_MODE_E ForcedAMPDUMode; + u8 ForcedAMPDUFactor; + u8 ForcedMPDUDensity; + + // Forced A-MSDU enable + HT_AGGRE_MODE_E ForcedAMSDUMode; + u16 ForcedAMSDUMaxSize; + + u8 bForcedShortGI; + + u8 CurrentOpMode; + + // MIMO PS related + u8 SelfMimoPs; + u8 PeerMimoPs; + + // 40MHz Channel Offset settings. + HT_EXTCHNL_OFFSET CurSTAExtChnlOffset; + u8 bCurTxBW40MHz; // If we use 40 MHz to Tx + u8 PeerBandwidth; + + // For Bandwidth Switching + u8 bSwBwInProgress; + CHNLOP ChnlOp; // software switching channel in progress. By Bruce, 2008-02-15. + u8 SwBwStep; + //struct timer_list SwBwTimer; //moved to ieee80211_device. as timer_list need include some header file here. + + // For Realtek proprietary A-MPDU factor for aggregation + u8 bRegRT2RTAggregation; + u8 bCurrentRT2RTAggregation; + u8 bCurrentRT2RTLongSlotTime; + u8 szRT2RTAggBuffer[10]; + + // Rx Reorder control + u8 bRegRxReorderEnable; + u8 bCurRxReorderEnable; + u8 RxReorderWinSize; + u8 RxReorderPendingTime; + u16 RxReorderDropCounter; + +#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE + u8 UsbTxAggrNum; +#endif +#ifdef USB_RX_AGGREGATION_SUPPORT + u8 UsbRxFwAggrEn; + u8 UsbRxFwAggrPageNum; + u8 UsbRxFwAggrPacketNum; + u8 UsbRxFwAggrTimeout; +#endif + + // Add for Broadcom(Linksys) IOT. Joseph + u8 bIsPeerBcm; + + // For IOT issue. + u8 IOTPeer; + u32 IOTAction; +} __attribute__ ((packed)) RT_HIGH_THROUGHPUT, *PRT_HIGH_THROUGHPUT; + + +//------------------------------------------------------------ +// The Data structure is used to keep HT related variable for "each Sta" +// when card is configured as "AP mode" +//------------------------------------------------------------ + +typedef struct _RT_HTINFO_STA_ENTRY{ + u8 bEnableHT; + + u8 bSupportCck; + + u16 AMSDU_MaxSize; + + u8 AMPDU_Factor; + u8 MPDU_Density; + + u8 HTHighestOperaRate; + + u8 bBw40MHz; + + u8 MimoPs; + + u8 McsRateSet[16]; + + +}RT_HTINFO_STA_ENTRY, *PRT_HTINFO_STA_ENTRY; + + + + + +//------------------------------------------------------------ +// The Data structure is used to keep HT related variable for "each AP" +// when card is configured as "STA mode" +//------------------------------------------------------------ + +typedef struct _BSS_HT{ + + u8 bdSupportHT; + + // HT related elements + u8 bdHTCapBuf[32]; + u16 bdHTCapLen; + u8 bdHTInfoBuf[32]; + u16 bdHTInfoLen; + + HT_SPEC_VER bdHTSpecVer; + //HT_CAPABILITY_ELE bdHTCapEle; + //HT_INFORMATION_ELE bdHTInfoEle; + + u8 bdRT2RTAggregation; + u8 bdRT2RTLongSlotTime; +} __attribute__ ((packed)) BSS_HT, *PBSS_HT; + +typedef struct _MIMO_RSSI{ + u32 EnableAntenna; + u32 AntennaA; + u32 AntennaB; + u32 AntennaC; + u32 AntennaD; + u32 Average; +}MIMO_RSSI, *PMIMO_RSSI; + +typedef struct _MIMO_EVM{ + u32 EVM1; + u32 EVM2; +}MIMO_EVM, *PMIMO_EVM; + +typedef struct _FALSE_ALARM_STATISTICS{ + u32 Cnt_Parity_Fail; + u32 Cnt_Rate_Illegal; + u32 Cnt_Crc8_fail; + u32 Cnt_all; +}FALSE_ALARM_STATISTICS, *PFALSE_ALARM_STATISTICS; + + +extern u8 MCS_FILTER_ALL[16]; +extern u8 MCS_FILTER_1SS[16]; + +/* 2007/07/11 MH Modify the macro. Becaus STA may link with a N-AP. If we set + STA in A/B/G mode and AP is still in N mode. The macro will be wrong. We have + to add a macro to judge wireless mode. */ +#define PICK_RATE(_nLegacyRate, _nMcsRate) \ + (_nMcsRate==0)?(_nLegacyRate&0x7f):(_nMcsRate) +/* 2007/07/12 MH We only define legacy and HT wireless mode now. */ +#define LEGACY_WIRELESS_MODE IEEE_MODE_MASK + +#define CURRENT_RATE(WirelessMode, LegacyRate, HTRate) \ + ((WirelessMode & (LEGACY_WIRELESS_MODE))!=0)?\ + (LegacyRate):\ + (PICK_RATE(LegacyRate, HTRate)) + + + +// MCS Bw 40 {1~7, 12~15,32} +#define RATE_ADPT_1SS_MASK 0xFF +#define RATE_ADPT_2SS_MASK 0xF0 //Skip MCS8~11 because mcs7 > mcs6, 9, 10, 11. 2007.01.16 by Emily +#define RATE_ADPT_MCS32_MASK 0x01 + +#define IS_11N_MCS_RATE(rate) (rate&0x80) + +typedef enum _HT_AGGRE_SIZE{ + HT_AGG_SIZE_8K = 0, + HT_AGG_SIZE_16K = 1, + HT_AGG_SIZE_32K = 2, + HT_AGG_SIZE_64K = 3, +}HT_AGGRE_SIZE_E, *PHT_AGGRE_SIZE_E; + +/* Indicate different AP vendor for IOT issue */ +typedef enum _HT_IOT_PEER +{ + HT_IOT_PEER_UNKNOWN = 0, + HT_IOT_PEER_REALTEK = 1, + HT_IOT_PEER_BROADCOM = 2, + HT_IOT_PEER_RALINK = 3, + HT_IOT_PEER_ATHEROS = 4, + HT_IOT_PEER_CISCO= 5, + HT_IOT_PEER_MAX = 6 +}HT_IOT_PEER_E, *PHTIOT_PEER_E; + +// +// IOT Action for different AP +// +typedef enum _HT_IOT_ACTION{ + HT_IOT_ACT_TX_USE_AMSDU_4K = 0x00000001, + HT_IOT_ACT_TX_USE_AMSDU_8K = 0x00000002, + HT_IOT_ACT_DISABLE_MCS14 = 0x00000004, + HT_IOT_ACT_DISABLE_MCS15 = 0x00000008, + HT_IOT_ACT_DISABLE_ALL_2SS = 0x00000010, + HT_IOT_ACT_DISABLE_EDCA_TURBO = 0x00000020, + HT_IOT_ACT_MGNT_USE_CCK_6M = 0x00000040, + HT_IOT_ACT_CDD_FSYNC = 0x00000080, + HT_IOT_ACT_PURE_N_MODE = 0x00000100, + HT_IOT_ACT_FORCED_CTS2SELF = 0x00000200, +}HT_IOT_ACTION_E, *PHT_IOT_ACTION_E; + +#endif //_RTL819XU_HTTYPE_H_ + diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c new file mode 100644 index 000000000000..87074eec2e16 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c @@ -0,0 +1,1719 @@ + +//As this function is mainly ported from Windows driver, so leave the name little changed. If any confusion caused, tell me. Created by WB. 2008.05.08 +#include "ieee80211.h" +#include "rtl819x_HT.h" +u8 MCS_FILTER_ALL[16] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +u8 MCS_FILTER_1SS[16] = {0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +u16 MCS_DATA_RATE[2][2][77] = + { { {13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78 ,104, 156, 208, 234, 260, + 39, 78, 117, 234, 312, 351, 390, 52, 104, 156, 208, 312, 416, 468, 520, + 0, 78, 104, 130, 117, 156, 195, 104, 130, 130, 156, 182, 182, 208, 156, 195, + 195, 234, 273, 273, 312, 130, 156, 181, 156, 181, 208, 234, 208, 234, 260, 260, + 286, 195, 234, 273, 234, 273, 312, 351, 312, 351, 390, 390, 429}, // Long GI, 20MHz + {14, 29, 43, 58, 87, 116, 130, 144, 29, 58, 87, 116, 173, 231, 260, 289, + 43, 87, 130, 173, 260, 347, 390, 433, 58, 116, 173, 231, 347, 462, 520, 578, + 0, 87, 116, 144, 130, 173, 217, 116, 144, 144, 173, 202, 202, 231, 173, 217, + 217, 260, 303, 303, 347, 144, 173, 202, 173, 202, 231, 260, 231, 260, 289, 289, + 318, 217, 260, 303, 260, 303, 347, 390, 347, 390, 433, 433, 477} }, // Short GI, 20MHz + { {27, 54, 81, 108, 162, 216, 243, 270, 54, 108, 162, 216, 324, 432, 486, 540, + 81, 162, 243, 324, 486, 648, 729, 810, 108, 216, 324, 432, 648, 864, 972, 1080, + 12, 162, 216, 270, 243, 324, 405, 216, 270, 270, 324, 378, 378, 432, 324, 405, + 405, 486, 567, 567, 648, 270, 324, 378, 324, 378, 432, 486, 432, 486, 540, 540, + 594, 405, 486, 567, 486, 567, 648, 729, 648, 729, 810, 810, 891}, // Long GI, 40MHz + {30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 480, 540, 600, + 90, 180, 270, 360, 540, 720, 810, 900, 120, 240, 360, 480, 720, 960, 1080, 1200, + 13, 180, 240, 300, 270, 360, 450, 240, 300, 300, 360, 420, 420, 480, 360, 450, + 450, 540, 630, 630, 720, 300, 360, 420, 360, 420, 480, 540, 480, 540, 600, 600, + 660, 450, 540, 630, 540, 630, 720, 810, 720, 810, 900, 900, 990} } // Short GI, 40MHz + }; + +static u8 UNKNOWN_BORADCOM[3] = {0x00, 0x14, 0xbf}; +static u8 LINKSYSWRT330_LINKSYSWRT300_BROADCOM[3] = {0x00, 0x1a, 0x70}; +static u8 LINKSYSWRT350_LINKSYSWRT150_BROADCOM[3] = {0x00, 0x1d, 0x7e}; +static u8 NETGEAR834Bv2_BROADCOM[3] = {0x00, 0x1b, 0x2f}; +static u8 BELKINF5D8233V1_RALINK[3] = {0x00, 0x17, 0x3f}; //cosa 03202008 +static u8 BELKINF5D82334V3_RALINK[3] = {0x00, 0x1c, 0xdf}; +static u8 PCI_RALINK[3] = {0x00, 0x90, 0xcc}; +static u8 EDIMAX_RALINK[3] = {0x00, 0x0e, 0x2e}; +static u8 AIRLINK_RALINK[3] = {0x00, 0x18, 0x02}; +//static u8 DLINK_ATHEROS[3] = {0x00, 0x1c, 0xf0}; +static u8 CISCO_BROADCOM[3] = {0x00, 0x17, 0x94}; + +// 2008/04/01 MH For Cisco G mode RX TP We need to change FW duration. Shoud we put the +// code in other place?? +//static u8 WIFI_CISCO_G_AP[3] = {0x00, 0x40, 0x96}; +/******************************************************************************************************************** + *function: This function update default settings in pHTInfo structure + * input: PRT_HIGH_THROUGHPUT pHTInfo + * output: none + * return: none + * notice: These value need be modified if any changes. + * *****************************************************************************************************************/ +void HTUpdateDefaultSetting(struct ieee80211_device* ieee) +{ + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; + //const typeof( ((struct ieee80211_device *)0)->pHTInfo ) *__mptr = &pHTInfo; + + //printk("pHTinfo:%p, &pHTinfo:%p, mptr:%p, offsetof:%x\n", pHTInfo, &pHTInfo, __mptr, offsetof(struct ieee80211_device, pHTInfo)); + //printk("===>ieee:%p,\n", ieee); + // ShortGI support + pHTInfo->bRegShortGI20MHz= 1; + pHTInfo->bRegShortGI40MHz= 1; + + // 40MHz channel support + pHTInfo->bRegBW40MHz = 1; + + // CCK rate support in 40MHz channel + if(pHTInfo->bRegBW40MHz) + pHTInfo->bRegSuppCCK = 1; + else + pHTInfo->bRegSuppCCK = true; + + // AMSDU related + pHTInfo->nAMSDU_MaxSize = 7935UL; + pHTInfo->bAMSDU_Support = 0; + + // AMPDU related + pHTInfo->bAMPDUEnable = 1; + pHTInfo->AMPDU_Factor = 2; //// 0: 2n13(8K), 1:2n14(16K), 2:2n15(32K), 3:2n16(64k) + pHTInfo->MPDU_Density = 0;// 0: No restriction, 1: 1/8usec, 2: 1/4usec, 3: 1/2usec, 4: 1usec, 5: 2usec, 6: 4usec, 7:8usec + + // MIMO Power Save + pHTInfo->SelfMimoPs = 3;// 0: Static Mimo Ps, 1: Dynamic Mimo Ps, 3: No Limitation, 2: Reserved(Set to 3 automatically.) + if(pHTInfo->SelfMimoPs == 2) + pHTInfo->SelfMimoPs = 3; + // 8190 only. Assign rate operation mode to firmware + ieee->bTxDisableRateFallBack = 0; + ieee->bTxUseDriverAssingedRate = 0; + +#ifdef TO_DO_LIST + // 8190 only. Assign duration operation mode to firmware + pMgntInfo->bTxEnableFwCalcDur = (BOOLEAN)pNdisCommon->bRegTxEnableFwCalcDur; +#endif + // 8190 only, Realtek proprietary aggregation mode + // Set MPDUDensity=2, 1: Set MPDUDensity=2(32k) for Realtek AP and set MPDUDensity=0(8k) for others + pHTInfo->bRegRT2RTAggregation = 1;//0: Set MPDUDensity=2, 1: Set MPDUDensity=2(32k) for Realtek AP and set MPDUDensity=0(8k) for others + + // For Rx Reorder Control + pHTInfo->bRegRxReorderEnable = 1; + pHTInfo->RxReorderWinSize = 64; + pHTInfo->RxReorderPendingTime = 30; + +#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE + pHTInfo->UsbTxAggrNum = 4; +#endif +#ifdef USB_RX_AGGREGATION_SUPPORT + pHTInfo->UsbRxFwAggrEn = 1; + pHTInfo->UsbRxFwAggrPageNum = 24; + pHTInfo->UsbRxFwAggrPacketNum = 8; + pHTInfo->UsbRxFwAggrTimeout = 16; ////usb rx FW aggregation timeout threshold.It's in units of 64us +#endif + + +} +/******************************************************************************************************************** + *function: This function print out each field on HT capability IE mainly from (Beacon/ProbeRsp/AssocReq) + * input: u8* CapIE //Capability IE to be printed out + * u8* TitleString //mainly print out caller function + * output: none + * return: none + * notice: Driver should not print out this message by default. + * *****************************************************************************************************************/ +void HTDebugHTCapability(u8* CapIE, u8* TitleString ) +{ + + static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33}; // For 11n EWC definition, 2007.07.17, by Emily + PHT_CAPABILITY_ELE pCapELE; + + if(!memcmp(CapIE, EWC11NHTCap, sizeof(EWC11NHTCap))) + { + //EWC IE + IEEE80211_DEBUG(IEEE80211_DL_HT, "EWC IE in %s()\n", __FUNCTION__); + pCapELE = (PHT_CAPABILITY_ELE)(&CapIE[4]); + }else + pCapELE = (PHT_CAPABILITY_ELE)(&CapIE[0]); + + IEEE80211_DEBUG(IEEE80211_DL_HT, ". Called by %s\n", TitleString ); + + IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSupported Channel Width = %s\n", (pCapELE->ChlWidth)?"20MHz": "20/40MHz"); + IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSupport Short GI for 20M = %s\n", (pCapELE->ShortGI20Mhz)?"YES": "NO"); + IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSupport Short GI for 40M = %s\n", (pCapELE->ShortGI40Mhz)?"YES": "NO"); + IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSupport TX STBC = %s\n", (pCapELE->TxSTBC)?"YES": "NO"); + IEEE80211_DEBUG(IEEE80211_DL_HT, "\tMax AMSDU Size = %s\n", (pCapELE->MaxAMSDUSize)?"3839": "7935"); + IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSupport CCK in 20/40 mode = %s\n", (pCapELE->DssCCk)?"YES": "NO"); + IEEE80211_DEBUG(IEEE80211_DL_HT, "\tMax AMPDU Factor = %d\n", pCapELE->MaxRxAMPDUFactor); + IEEE80211_DEBUG(IEEE80211_DL_HT, "\tMPDU Density = %d\n", pCapELE->MPDUDensity); + IEEE80211_DEBUG(IEEE80211_DL_HT, "\tMCS Rate Set = [%x][%x][%x][%x][%x]\n", pCapELE->MCS[0],\ + pCapELE->MCS[1], pCapELE->MCS[2], pCapELE->MCS[3], pCapELE->MCS[4]); + return; + +} +/******************************************************************************************************************** + *function: This function print out each field on HT Information IE mainly from (Beacon/ProbeRsp) + * input: u8* InfoIE //Capability IE to be printed out + * u8* TitleString //mainly print out caller function + * output: none + * return: none + * notice: Driver should not print out this message by default. + * *****************************************************************************************************************/ +void HTDebugHTInfo(u8* InfoIE, u8* TitleString) +{ + + static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34}; // For 11n EWC definition, 2007.07.17, by Emily + PHT_INFORMATION_ELE pHTInfoEle; + + if(!memcmp(InfoIE, EWC11NHTInfo, sizeof(EWC11NHTInfo))) + { + // Not EWC IE + IEEE80211_DEBUG(IEEE80211_DL_HT, "EWC IE in %s()\n", __FUNCTION__); + pHTInfoEle = (PHT_INFORMATION_ELE)(&InfoIE[4]); + }else + pHTInfoEle = (PHT_INFORMATION_ELE)(&InfoIE[0]); + + + IEEE80211_DEBUG(IEEE80211_DL_HT, ". Called by %s\n", TitleString); + + IEEE80211_DEBUG(IEEE80211_DL_HT, "\tPrimary channel = %d\n", pHTInfoEle->ControlChl); + IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSenondary channel ="); + switch(pHTInfoEle->ExtChlOffset) + { + case 0: + IEEE80211_DEBUG(IEEE80211_DL_HT, "Not Present\n"); + break; + case 1: + IEEE80211_DEBUG(IEEE80211_DL_HT, "Upper channel\n"); + break; + case 2: + IEEE80211_DEBUG(IEEE80211_DL_HT, "Reserved. Eooro!!!\n"); + break; + case 3: + IEEE80211_DEBUG(IEEE80211_DL_HT, "Lower Channel\n"); + break; + } + IEEE80211_DEBUG(IEEE80211_DL_HT, "\tRecommended channel width = %s\n", (pHTInfoEle->RecommemdedTxWidth)?"20Mhz": "40Mhz"); + + IEEE80211_DEBUG(IEEE80211_DL_HT, "\tOperation mode for protection = "); + switch(pHTInfoEle->OptMode) + { + case 0: + IEEE80211_DEBUG(IEEE80211_DL_HT, "No Protection\n"); + break; + case 1: + IEEE80211_DEBUG(IEEE80211_DL_HT, "HT non-member protection mode\n"); + break; + case 2: + IEEE80211_DEBUG(IEEE80211_DL_HT, "Suggest to open protection\n"); + break; + case 3: + IEEE80211_DEBUG(IEEE80211_DL_HT, "HT mixed mode\n"); + break; + } + + IEEE80211_DEBUG(IEEE80211_DL_HT, "\tBasic MCS Rate Set = [%x][%x][%x][%x][%x]\n", pHTInfoEle->BasicMSC[0],\ + pHTInfoEle->BasicMSC[1], pHTInfoEle->BasicMSC[2], pHTInfoEle->BasicMSC[3], pHTInfoEle->BasicMSC[4]); + return; +} + +/* +* Return: true if station in half n mode and AP supports 40 bw +*/ +bool IsHTHalfNmode40Bandwidth(struct ieee80211_device* ieee) +{ + bool retValue = false; + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; + + if(pHTInfo->bCurrentHTSupport == false ) // wireless is n mode + retValue = false; + else if(pHTInfo->bRegBW40MHz == false) // station supports 40 bw + retValue = false; + else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) // station in half n mode + retValue = false; + else if(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ChlWidth) // ap support 40 bw + retValue = true; + else + retValue = false; + + return retValue; +} + +bool IsHTHalfNmodeSGI(struct ieee80211_device* ieee, bool is40MHz) +{ + bool retValue = false; + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; + + if(pHTInfo->bCurrentHTSupport == false ) // wireless is n mode + retValue = false; + else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) // station in half n mode + retValue = false; + else if(is40MHz) // ap support 40 bw + { + if(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ShortGI40Mhz) // ap support 40 bw short GI + retValue = true; + else + retValue = false; + } + else + { + if(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ShortGI20Mhz) // ap support 40 bw short GI + retValue = true; + else + retValue = false; + } + + return retValue; +} + +u16 HTHalfMcsToDataRate(struct ieee80211_device* ieee, u8 nMcsRate) +{ + + u8 is40MHz; + u8 isShortGI; + + is40MHz = (IsHTHalfNmode40Bandwidth(ieee))?1:0; + isShortGI = (IsHTHalfNmodeSGI(ieee, is40MHz))? 1:0; + + return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)]; +} + + +u16 HTMcsToDataRate( struct ieee80211_device* ieee, u8 nMcsRate) +{ + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; + + u8 is40MHz = (pHTInfo->bCurBW40MHz)?1:0; + u8 isShortGI = (pHTInfo->bCurBW40MHz)? + ((pHTInfo->bCurShortGI40MHz)?1:0): + ((pHTInfo->bCurShortGI20MHz)?1:0); + return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)]; +} + +/******************************************************************************************************************** + *function: This function returns current datarate. + * input: struct ieee80211_device* ieee + * u8 nDataRate + * output: none + * return: tx rate + * notice: quite unsure about how to use this function //wb + * *****************************************************************************************************************/ +u16 TxCountToDataRate( struct ieee80211_device* ieee, u8 nDataRate) +{ + //PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; + u16 CCKOFDMRate[12] = {0x02 , 0x04 , 0x0b , 0x16 , 0x0c , 0x12 , 0x18 , 0x24 , 0x30 , 0x48 , 0x60 , 0x6c}; + u8 is40MHz = 0; + u8 isShortGI = 0; + + if(nDataRate < 12) + { + return CCKOFDMRate[nDataRate]; + } + else + { + if (nDataRate >= 0x10 && nDataRate <= 0x1f)//if(nDataRate > 11 && nDataRate < 28 ) + { + is40MHz = 0; + isShortGI = 0; + + // nDataRate = nDataRate - 12; + } + else if(nDataRate >=0x20 && nDataRate <= 0x2f ) //(27, 44) + { + is40MHz = 1; + isShortGI = 0; + + //nDataRate = nDataRate - 28; + } + else if(nDataRate >= 0x30 && nDataRate <= 0x3f ) //(43, 60) + { + is40MHz = 0; + isShortGI = 1; + + //nDataRate = nDataRate - 44; + } + else if(nDataRate >= 0x40 && nDataRate <= 0x4f ) //(59, 76) + { + is40MHz = 1; + isShortGI = 1; + + //nDataRate = nDataRate - 60; + } + return MCS_DATA_RATE[is40MHz][isShortGI][nDataRate&0xf]; + } +} + + + +bool IsHTHalfNmodeAPs(struct ieee80211_device* ieee) +{ + bool retValue = false; + struct ieee80211_network* net = &ieee->current_network; +#if 0 + if(pMgntInfo->bHalfNMode == false) + retValue = false; + else +#endif + if((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3)==0) || + (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3)==0) || + (memcmp(net->bssid, PCI_RALINK, 3)==0) || + (memcmp(net->bssid, EDIMAX_RALINK, 3)==0) || + (memcmp(net->bssid, AIRLINK_RALINK, 3)==0) || + (net->ralink_cap_exist)) + retValue = true; + else if((memcmp(net->bssid, UNKNOWN_BORADCOM, 3)==0) || + (memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)|| + (memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)==0)|| + (memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3)==0) || + (net->broadcom_cap_exist)) + retValue = true; + else if(net->bssht.bdRT2RTAggregation) + retValue = true; + else + retValue = false; + + return retValue; +} + +/******************************************************************************************************************** + *function: This function returns peer IOT. + * input: struct ieee80211_device* ieee + * output: none + * return: + * notice: + * *****************************************************************************************************************/ +void HTIOTPeerDetermine(struct ieee80211_device* ieee) +{ + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; + struct ieee80211_network* net = &ieee->current_network; + if(net->bssht.bdRT2RTAggregation) + pHTInfo->IOTPeer = HT_IOT_PEER_REALTEK; + else if(net->broadcom_cap_exist) + pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM; + else if((memcmp(net->bssid, UNKNOWN_BORADCOM, 3)==0) || + (memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)|| + (memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)==0)|| + (memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3)==0) ) + pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM; + else if((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3)==0) || + (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3)==0) || + (memcmp(net->bssid, PCI_RALINK, 3)==0) || + (memcmp(net->bssid, EDIMAX_RALINK, 3)==0) || + (memcmp(net->bssid, AIRLINK_RALINK, 3)==0) || + net->ralink_cap_exist) + pHTInfo->IOTPeer = HT_IOT_PEER_RALINK; + else if(net->atheros_cap_exist) + pHTInfo->IOTPeer = HT_IOT_PEER_ATHEROS; + else if(memcmp(net->bssid, CISCO_BROADCOM, 3)==0) + pHTInfo->IOTPeer = HT_IOT_PEER_CISCO; + else + pHTInfo->IOTPeer = HT_IOT_PEER_UNKNOWN; + + IEEE80211_DEBUG(IEEE80211_DL_IOT, "Joseph debug!! IOTPEER: %x\n", pHTInfo->IOTPeer); +} +/******************************************************************************************************************** + *function: Check whether driver should declare received rate up to MCS13 only since some chipset is not good + * at receiving MCS14~15 frame from some AP. + * input: struct ieee80211_device* ieee + * u8 * PeerMacAddr + * output: none + * return: return 1 if driver should declare MCS13 only(otherwise return 0) + * *****************************************************************************************************************/ +u8 HTIOTActIsDisableMCS14(struct ieee80211_device* ieee, u8* PeerMacAddr) +{ + u8 ret = 0; +#if 0 + // Apply for 819u only +#if (HAL_CODE_BASE==RTL8192 && DEV_BUS_TYPE==USB_INTERFACE) + if((memcmp(PeerMacAddr, UNKNOWN_BORADCOM, 3)==0) || + (memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0) + ) + { + ret = 1; + } + + + if(pHTInfo->bCurrentRT2RTAggregation) + { + // The parameter of pHTInfo->bCurrentRT2RTAggregation must be decided previously + ret = 1; + } +#endif +#endif + return ret; + } + + +/** +* Function: HTIOTActIsDisableMCS15 +* +* Overview: Check whether driver should declare capability of receving MCS15 +* +* Input: +* PADAPTER Adapter, +* +* Output: None +* Return: true if driver should disable MCS15 +* 2008.04.15 Emily +*/ +bool HTIOTActIsDisableMCS15(struct ieee80211_device* ieee) +{ + bool retValue = false; + +#ifdef TODO + // Apply for 819u only +#if (HAL_CODE_BASE==RTL8192) + +#if (DEV_BUS_TYPE == USB_INTERFACE) + // Alway disable MCS15 by Jerry Chang's request.by Emily, 2008.04.15 + retValue = true; +#elif (DEV_BUS_TYPE == PCI_INTERFACE) + // Enable MCS15 if the peer is Cisco AP. by Emily, 2008.05.12 +// if(pBssDesc->bCiscoCapExist) +// retValue = false; +// else + retValue = false; +#endif +#endif +#endif + // Jerry Chang suggest that 8190 1x2 does not need to disable MCS15 + + return retValue; +} + +/** +* Function: HTIOTActIsDisableMCSTwoSpatialStream +* +* Overview: Check whether driver should declare capability of receving All 2 ss packets +* +* Input: +* PADAPTER Adapter, +* +* Output: None +* Return: true if driver should disable all two spatial stream packet +* 2008.04.21 Emily +*/ +bool HTIOTActIsDisableMCSTwoSpatialStream(struct ieee80211_device* ieee, u8 *PeerMacAddr) +{ + bool retValue = false; + +#ifdef TODO + // Apply for 819u only +//#if (HAL_CODE_BASE==RTL8192) + + //This rule only apply to Belkin(Ralink) AP + if(IS_UNDER_11N_AES_MODE(Adapter)) + { + if((PlatformCompareMemory(PeerMacAddr, BELKINF5D8233V1_RALINK, 3)==0) || + (PlatformCompareMemory(PeerMacAddr, PCI_RALINK, 3)==0) || + (PlatformCompareMemory(PeerMacAddr, EDIMAX_RALINK, 3)==0)) + { + //Set True to disable this function. Disable by default, Emily, 2008.04.23 + retValue = false; + } + } + +//#endif +#endif + return retValue; +} + +/******************************************************************************************************************** + *function: Check whether driver should disable EDCA turbo mode + * input: struct ieee80211_device* ieee + * u8* PeerMacAddr + * output: none + * return: return 1 if driver should disable EDCA turbo mode(otherwise return 0) + * *****************************************************************************************************************/ +u8 HTIOTActIsDisableEDCATurbo(struct ieee80211_device* ieee, u8* PeerMacAddr) +{ + u8 retValue = false; // default enable EDCA Turbo mode. + // Set specific EDCA parameter for different AP in DM handler. + + return retValue; +#if 0 + if((memcmp(PeerMacAddr, UNKNOWN_BORADCOM, 3)==0)|| + (memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)|| + (memcmp(PeerMacAddr, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)==0)|| + (memcmp(PeerMacAddr, NETGEAR834Bv2_BROADCOM, 3)==0)) + + { + retValue = 1; //Linksys disable EDCA turbo mode + } + + return retValue; +#endif +} + +/******************************************************************************************************************** + *function: Check whether we need to use OFDM to sned MGNT frame for broadcom AP + * input: struct ieee80211_network *network //current network we live + * output: none + * return: return 1 if true + * *****************************************************************************************************************/ +u8 HTIOTActIsMgntUseCCK6M(struct ieee80211_network *network) +{ + u8 retValue = 0; + + // 2008/01/25 MH Judeg if we need to use OFDM to sned MGNT frame for broadcom AP. + // 2008/01/28 MH We must prevent that we select null bssid to link. + + if(network->broadcom_cap_exist) + { + retValue = 1; + } + + return retValue; +} + +u8 HTIOTActIsCCDFsync(u8* PeerMacAddr) +{ + u8 retValue = 0; + if( (memcmp(PeerMacAddr, UNKNOWN_BORADCOM, 3)==0) || + (memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0) || + (memcmp(PeerMacAddr, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) ==0)) + { + retValue = 1; + } + + return retValue; +} + +void HTResetIOTSetting( + PRT_HIGH_THROUGHPUT pHTInfo +) +{ + pHTInfo->IOTAction = 0; + pHTInfo->IOTPeer = HT_IOT_PEER_UNKNOWN; +} + + +/******************************************************************************************************************** + *function: Construct Capablility Element in Beacon... if HTEnable is turned on + * input: struct ieee80211_device* ieee + * u8* posHTCap //pointer to store Capability Ele + * u8* len //store length of CE + * u8 IsEncrypt //whether encrypt, needed further + * output: none + * return: none + * notice: posHTCap can't be null and should be initialized before. + * *****************************************************************************************************************/ +void HTConstructCapabilityElement(struct ieee80211_device* ieee, u8* posHTCap, u8* len, u8 IsEncrypt) +{ + PRT_HIGH_THROUGHPUT pHT = ieee->pHTInfo; + PHT_CAPABILITY_ELE pCapELE = NULL; + //u8 bIsDeclareMCS13; + + if ((posHTCap == NULL) || (pHT == NULL)) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "posHTCap or pHTInfo can't be null in HTConstructCapabilityElement()\n"); + return; + } + memset(posHTCap, 0, *len); + if(pHT->ePeerHTSpecVer == HT_SPEC_VER_EWC) + { + u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33}; // For 11n EWC definition, 2007.07.17, by Emily + memcpy(posHTCap, EWC11NHTCap, sizeof(EWC11NHTCap)); + pCapELE = (PHT_CAPABILITY_ELE)&(posHTCap[4]); + }else + { + pCapELE = (PHT_CAPABILITY_ELE)posHTCap; + } + + + //HT capability info + pCapELE->AdvCoding = 0; // This feature is not supported now!! + if(ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) + { + pCapELE->ChlWidth = 0; + } + else + { + pCapELE->ChlWidth = (pHT->bRegBW40MHz?1:0); + } + +// pCapELE->ChlWidth = (pHT->bRegBW40MHz?1:0); + pCapELE->MimoPwrSave = pHT->SelfMimoPs; + pCapELE->GreenField = 0; // This feature is not supported now!! + pCapELE->ShortGI20Mhz = 1; // We can receive Short GI!! + pCapELE->ShortGI40Mhz = 1; // We can receive Short GI!! + //DbgPrint("TX HT cap/info ele BW=%d SG20=%d SG40=%d\n\r", + //pCapELE->ChlWidth, pCapELE->ShortGI20Mhz, pCapELE->ShortGI40Mhz); + pCapELE->TxSTBC = 1; + pCapELE->RxSTBC = 0; + pCapELE->DelayBA = 0; // Do not support now!! + pCapELE->MaxAMSDUSize = (MAX_RECEIVE_BUFFER_SIZE>=7935)?1:0; + pCapELE->DssCCk = ((pHT->bRegBW40MHz)?(pHT->bRegSuppCCK?1:0):0); + pCapELE->PSMP = 0; // Do not support now!! + pCapELE->LSigTxopProtect = 0; // Do not support now!! + + + //MAC HT parameters info + // TODO: Nedd to take care of this part + IEEE80211_DEBUG(IEEE80211_DL_HT, "TX HT cap/info ele BW=%d MaxAMSDUSize:%d DssCCk:%d\n", pCapELE->ChlWidth, pCapELE->MaxAMSDUSize, pCapELE->DssCCk); + + if( IsEncrypt) + { + pCapELE->MPDUDensity = 7; // 8us + pCapELE->MaxRxAMPDUFactor = 2; // 2 is for 32 K and 3 is 64K + } + else + { + pCapELE->MaxRxAMPDUFactor = 3; // 2 is for 32 K and 3 is 64K + pCapELE->MPDUDensity = 0; // no density + } + + //Supported MCS set + memcpy(pCapELE->MCS, ieee->Regdot11HTOperationalRateSet, 16); + if(pHT->IOTAction & HT_IOT_ACT_DISABLE_MCS15) + pCapELE->MCS[1] &= 0x7f; + + if(pHT->IOTAction & HT_IOT_ACT_DISABLE_MCS14) + pCapELE->MCS[1] &= 0xbf; + + if(pHT->IOTAction & HT_IOT_ACT_DISABLE_ALL_2SS) + pCapELE->MCS[1] &= 0x00; + + // 2008.06.12 + // For RTL819X, if pairwisekey = wep/tkip, ap is ralink, we support only MCS0~7. + if(ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) + { + int i; + for(i = 1; i< 16; i++) + pCapELE->MCS[i] = 0; + } + + //Extended HT Capability Info + memset(&pCapELE->ExtHTCapInfo, 0, 2); + + + //TXBF Capabilities + memset(pCapELE->TxBFCap, 0, 4); + + //Antenna Selection Capabilities + pCapELE->ASCap = 0; +//add 2 to give space for element ID and len when construct frames + if(pHT->ePeerHTSpecVer == HT_SPEC_VER_EWC) + *len = 30 + 2; + else + *len = 26 + 2; + + + +// IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA | IEEE80211_DL_HT, posHTCap, *len -2); + + //Print each field in detail. Driver should not print out this message by default +// HTDebugHTCapability(posHTCap, (u8*)"HTConstructCapability()"); + return; + +} +/******************************************************************************************************************** + *function: Construct Information Element in Beacon... if HTEnable is turned on + * input: struct ieee80211_device* ieee + * u8* posHTCap //pointer to store Information Ele + * u8* len //store len of + * u8 IsEncrypt //whether encrypt, needed further + * output: none + * return: none + * notice: posHTCap can't be null and be initialized before. only AP and IBSS sta should do this + * *****************************************************************************************************************/ +void HTConstructInfoElement(struct ieee80211_device* ieee, u8* posHTInfo, u8* len, u8 IsEncrypt) +{ + PRT_HIGH_THROUGHPUT pHT = ieee->pHTInfo; + PHT_INFORMATION_ELE pHTInfoEle = (PHT_INFORMATION_ELE)posHTInfo; + if ((posHTInfo == NULL) || (pHTInfoEle == NULL)) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "posHTInfo or pHTInfoEle can't be null in HTConstructInfoElement()\n"); + return; + } + + memset(posHTInfo, 0, *len); + if ( (ieee->iw_mode == IW_MODE_ADHOC) || (ieee->iw_mode == IW_MODE_MASTER)) //ap mode is not currently supported + { + pHTInfoEle->ControlChl = ieee->current_network.channel; + pHTInfoEle->ExtChlOffset = ((pHT->bRegBW40MHz == false)?HT_EXTCHNL_OFFSET_NO_EXT: + (ieee->current_network.channel<=6)? + HT_EXTCHNL_OFFSET_UPPER:HT_EXTCHNL_OFFSET_LOWER); + pHTInfoEle->RecommemdedTxWidth = pHT->bRegBW40MHz; + pHTInfoEle->RIFS = 0; + pHTInfoEle->PSMPAccessOnly = 0; + pHTInfoEle->SrvIntGranularity = 0; + pHTInfoEle->OptMode = pHT->CurrentOpMode; + pHTInfoEle->NonGFDevPresent = 0; + pHTInfoEle->DualBeacon = 0; + pHTInfoEle->SecondaryBeacon = 0; + pHTInfoEle->LSigTxopProtectFull = 0; + pHTInfoEle->PcoActive = 0; + pHTInfoEle->PcoPhase = 0; + + memset(pHTInfoEle->BasicMSC, 0, 16); + + + *len = 22 + 2; //same above + + } + else + { + //STA should not generate High Throughput Information Element + *len = 0; + } + //IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA | IEEE80211_DL_HT, posHTInfo, *len - 2); + //HTDebugHTInfo(posHTInfo, "HTConstructInforElement"); + return; +} + +/* + * According to experiment, Realtek AP to STA (based on rtl8190) may achieve best performance + * if both STA and AP set limitation of aggregation size to 32K, that is, set AMPDU density to 2 + * (Ref: IEEE 11n specification). However, if Realtek STA associates to other AP, STA should set + * limitation of aggregation size to 8K, otherwise, performance of traffic stream from STA to AP + * will be much less than the traffic stream from AP to STA if both of the stream runs concurrently + * at the same time. + * + * Frame Format + * Element ID Length OUI Type1 Reserved + * 1 byte 1 byte 3 bytes 1 byte 1 byte + * + * OUI = 0x00, 0xe0, 0x4c, + * Type = 0x02 + * Reserved = 0x00 + * + * 2007.8.21 by Emily +*/ +/******************************************************************************************************************** + *function: Construct Information Element in Beacon... in RT2RT condition + * input: struct ieee80211_device* ieee + * u8* posRT2RTAgg //pointer to store Information Ele + * u8* len //store len + * output: none + * return: none + * notice: + * *****************************************************************************************************************/ +void HTConstructRT2RTAggElement(struct ieee80211_device* ieee, u8* posRT2RTAgg, u8* len) +{ + if (posRT2RTAgg == NULL) { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "posRT2RTAgg can't be null in HTConstructRT2RTAggElement()\n"); + return; + } + memset(posRT2RTAgg, 0, *len); + *posRT2RTAgg++ = 0x00; + *posRT2RTAgg++ = 0xe0; + *posRT2RTAgg++ = 0x4c; + *posRT2RTAgg++ = 0x02; + *posRT2RTAgg++ = 0x01; + *posRT2RTAgg = 0x10;//*posRT2RTAgg = 0x02; + + if(ieee->bSupportRemoteWakeUp) { + *posRT2RTAgg |= 0x08;//RT_HT_CAP_USE_WOW; + } + + *len = 6 + 2; + return; +#ifdef TODO +#if(HAL_CODE_BASE == RTL8192 && DEV_BUS_TYPE == USB_INTERFACE) + /* + //Emily. If it is required to Ask Realtek AP to send AMPDU during AES mode, enable this + section of code. + if(IS_UNDER_11N_AES_MODE(Adapter)) + { + posRT2RTAgg->Octet[5] |=RT_HT_CAP_USE_AMPDU; + }else + { + posRT2RTAgg->Octet[5] &= 0xfb; + } + */ + +#else + // Do Nothing +#endif + + posRT2RTAgg->Length = 6; +#endif + + + + +} + + +/******************************************************************************************************************** + *function: Pick the right Rate Adaptive table to use + * input: struct ieee80211_device* ieee + * u8* pOperateMCS //A pointer to MCS rate bitmap + * return: always we return true + * notice: + * *****************************************************************************************************************/ +u8 HT_PickMCSRate(struct ieee80211_device* ieee, u8* pOperateMCS) +{ + u8 i; + if (pOperateMCS == NULL) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "pOperateMCS can't be null in HT_PickMCSRate()\n"); + return false; + } + + switch(ieee->mode) + { + case IEEE_A: + case IEEE_B: + case IEEE_G: + //legacy rate routine handled at selectedrate + + //no MCS rate + for(i=0;i<=15;i++){ + pOperateMCS[i] = 0; + } + break; + + case IEEE_N_24G: //assume CCK rate ok + case IEEE_N_5G: + // Legacy part we only use 6, 5.5,2,1 for N_24G and 6 for N_5G. + // Legacy part shall be handled at SelectRateSet(). + + //HT part + // TODO: may be different if we have different number of antenna + pOperateMCS[0] &=RATE_ADPT_1SS_MASK; //support MCS 0~7 + pOperateMCS[1] &=RATE_ADPT_2SS_MASK; + pOperateMCS[3] &=RATE_ADPT_MCS32_MASK; + break; + + //should never reach here + default: + + break; + + } + + return true; +} + +/* +* Description: +* This function will get the highest speed rate in input MCS set. +* +* /param Adapter Pionter to Adapter entity +* pMCSRateSet Pointer to MCS rate bitmap +* pMCSFilter Pointer to MCS rate filter +* +* /return Highest MCS rate included in pMCSRateSet and filtered by pMCSFilter. +* +*/ +/******************************************************************************************************************** + *function: This function will get the highest speed rate in input MCS set. + * input: struct ieee80211_device* ieee + * u8* pMCSRateSet //Pointer to MCS rate bitmap + * u8* pMCSFilter //Pointer to MCS rate filter + * return: Highest MCS rate included in pMCSRateSet and filtered by pMCSFilter + * notice: + * *****************************************************************************************************************/ +u8 HTGetHighestMCSRate(struct ieee80211_device* ieee, u8* pMCSRateSet, u8* pMCSFilter) +{ + u8 i, j; + u8 bitMap; + u8 mcsRate = 0; + u8 availableMcsRate[16]; + if (pMCSRateSet == NULL || pMCSFilter == NULL) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "pMCSRateSet or pMCSFilter can't be null in HTGetHighestMCSRate()\n"); + return false; + } + for(i=0; i<16; i++) + availableMcsRate[i] = pMCSRateSet[i] & pMCSFilter[i]; + + for(i = 0; i < 16; i++) + { + if(availableMcsRate[i] != 0) + break; + } + if(i == 16) + return false; + + for(i = 0; i < 16; i++) + { + if(availableMcsRate[i] != 0) + { + bitMap = availableMcsRate[i]; + for(j = 0; j < 8; j++) + { + if((bitMap%2) != 0) + { + if(HTMcsToDataRate(ieee, (8*i+j)) > HTMcsToDataRate(ieee, mcsRate)) + mcsRate = (8*i+j); + } + bitMap = bitMap>>1; + } + } + } + return (mcsRate|0x80); +} + + + +/* +** +**1.Filter our operation rate set with AP's rate set +**2.shall reference channel bandwidth, STBC, Antenna number +**3.generate rate adative table for firmware +**David 20060906 +** +** \pHTSupportedCap: the connected STA's supported rate Capability element +*/ +u8 HTFilterMCSRate( struct ieee80211_device* ieee, u8* pSupportMCS, u8* pOperateMCS) +{ + + u8 i=0; + + // filter out operational rate set not supported by AP, the lenth of it is 16 + for(i=0;i<=15;i++){ + pOperateMCS[i] = ieee->Regdot11HTOperationalRateSet[i]&pSupportMCS[i]; + } + + + // TODO: adjust our operational rate set according to our channel bandwidth, STBC and Antenna number + + // TODO: fill suggested rate adaptive rate index and give firmware info using Tx command packet + // we also shall suggested the first start rate set according to our singal strength + HT_PickMCSRate(ieee, pOperateMCS); + + // For RTL819X, if pairwisekey = wep/tkip, we support only MCS0~7. + if(ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) + pOperateMCS[1] = 0; + + // + // For RTL819X, we support only MCS0~15. + // And also, we do not know how to use MCS32 now. + // + for(i=2; i<=15; i++) + pOperateMCS[i] = 0; + + return true; +} +void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset); +#if 0 +//I need move this function to other places, such as rx? +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +void HTOnAssocRsp_wq(struct work_struct *work) +{ + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, ht_onAssRsp); +#else +void HTOnAssocRsp_wq(struct ieee80211_device *ieee) +{ +#endif +#endif +void HTOnAssocRsp(struct ieee80211_device *ieee) +{ + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; + PHT_CAPABILITY_ELE pPeerHTCap = NULL; + PHT_INFORMATION_ELE pPeerHTInfo = NULL; + u16 nMaxAMSDUSize = 0; + u8* pMcsFilter = NULL; + + static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33}; // For 11n EWC definition, 2007.07.17, by Emily + static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34}; // For 11n EWC definition, 2007.07.17, by Emily + + if( pHTInfo->bCurrentHTSupport == false ) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "<=== HTOnAssocRsp(): HT_DISABLE\n"); + return; + } + IEEE80211_DEBUG(IEEE80211_DL_HT, "===> HTOnAssocRsp_wq(): HT_ENABLE\n"); +// IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, pHTInfo->PeerHTCapBuf, sizeof(HT_CAPABILITY_ELE)); +// IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, pHTInfo->PeerHTInfoBuf, sizeof(HT_INFORMATION_ELE)); + +// HTDebugHTCapability(pHTInfo->PeerHTCapBuf,"HTOnAssocRsp_wq"); +// HTDebugHTInfo(pHTInfo->PeerHTInfoBuf,"HTOnAssocRsp_wq"); + // + if(!memcmp(pHTInfo->PeerHTCapBuf,EWC11NHTCap, sizeof(EWC11NHTCap))) + pPeerHTCap = (PHT_CAPABILITY_ELE)(&pHTInfo->PeerHTCapBuf[4]); + else + pPeerHTCap = (PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf); + + if(!memcmp(pHTInfo->PeerHTInfoBuf, EWC11NHTInfo, sizeof(EWC11NHTInfo))) + pPeerHTInfo = (PHT_INFORMATION_ELE)(&pHTInfo->PeerHTInfoBuf[4]); + else + pPeerHTInfo = (PHT_INFORMATION_ELE)(pHTInfo->PeerHTInfoBuf); + + + //////////////////////////////////////////////////////// + // Configurations: + //////////////////////////////////////////////////////// + IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_HT, pPeerHTCap, sizeof(HT_CAPABILITY_ELE)); +// IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_HT, pPeerHTInfo, sizeof(HT_INFORMATION_ELE)); + // Config Supported Channel Width setting + // + HTSetConnectBwMode(ieee, (HT_CHANNEL_WIDTH)(pPeerHTCap->ChlWidth), (HT_EXTCHNL_OFFSET)(pPeerHTInfo->ExtChlOffset)); + +// if(pHTInfo->bCurBW40MHz == true) + pHTInfo->bCurTxBW40MHz = ((pPeerHTInfo->RecommemdedTxWidth == 1)?true:false); + + // + // Update short GI/ long GI setting + // + // TODO: + pHTInfo->bCurShortGI20MHz= + ((pHTInfo->bRegShortGI20MHz)?((pPeerHTCap->ShortGI20Mhz==1)?true:false):false); + pHTInfo->bCurShortGI40MHz= + ((pHTInfo->bRegShortGI40MHz)?((pPeerHTCap->ShortGI40Mhz==1)?true:false):false); + + // + // Config TX STBC setting + // + // TODO: + + // + // Config DSSS/CCK mode in 40MHz mode + // + // TODO: + pHTInfo->bCurSuppCCK = + ((pHTInfo->bRegSuppCCK)?((pPeerHTCap->DssCCk==1)?true:false):false); + + + // + // Config and configure A-MSDU setting + // + pHTInfo->bCurrent_AMSDU_Support = pHTInfo->bAMSDU_Support; + + nMaxAMSDUSize = (pPeerHTCap->MaxAMSDUSize==0)?3839:7935; + + if(pHTInfo->nAMSDU_MaxSize > nMaxAMSDUSize ) + pHTInfo->nCurrent_AMSDU_MaxSize = nMaxAMSDUSize; + else + pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize; + + + // + // Config A-MPDU setting + // + pHTInfo->bCurrentAMPDUEnable = pHTInfo->bAMPDUEnable; + + // <1> Decide AMPDU Factor + + // By Emily + if(!pHTInfo->bRegRT2RTAggregation) + { + // Decide AMPDU Factor according to protocol handshake + if(pHTInfo->AMPDU_Factor > pPeerHTCap->MaxRxAMPDUFactor) + pHTInfo->CurrentAMPDUFactor = pPeerHTCap->MaxRxAMPDUFactor; + else + pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor; + + }else + { + // Set MPDU density to 2 to Realtek AP, and set it to 0 for others + // Replace MPDU factor declared in original association response frame format. 2007.08.20 by Emily +#if 0 + osTmp= PacketGetElement( asocpdu, EID_Vendor, OUI_SUB_REALTEK_AGG, OUI_SUBTYPE_DONT_CARE); + if(osTmp.Length >= 5) //00:e0:4c:02:00 +#endif + if (ieee->current_network.bssht.bdRT2RTAggregation) + { + if( ieee->pairwise_key_type != KEY_TYPE_NA) + // Realtek may set 32k in security mode and 64k for others + pHTInfo->CurrentAMPDUFactor = pPeerHTCap->MaxRxAMPDUFactor; + else + pHTInfo->CurrentAMPDUFactor = HT_AGG_SIZE_64K; + }else + { + if(pPeerHTCap->MaxRxAMPDUFactor < HT_AGG_SIZE_32K) + pHTInfo->CurrentAMPDUFactor = pPeerHTCap->MaxRxAMPDUFactor; + else + pHTInfo->CurrentAMPDUFactor = HT_AGG_SIZE_32K; + } + } + + // <2> Set AMPDU Minimum MPDU Start Spacing + // 802.11n 3.0 section 9.7d.3 +#if 1 + if(pHTInfo->MPDU_Density > pPeerHTCap->MPDUDensity) + pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density; + else + pHTInfo->CurrentMPDUDensity = pPeerHTCap->MPDUDensity; + if(ieee->pairwise_key_type != KEY_TYPE_NA ) + pHTInfo->CurrentMPDUDensity = 7; // 8us +#else + if(pHTInfo->MPDU_Density > pPeerHTCap->MPDUDensity) + pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density; + else + pHTInfo->CurrentMPDUDensity = pPeerHTCap->MPDUDensity; +#endif + // Force TX AMSDU + + // Lanhsin: mark for tmp to avoid deauth by ap from s3 + //if(memcmp(pMgntInfo->Bssid, NETGEAR834Bv2_BROADCOM, 3)==0) + if(0) + { + + pHTInfo->bCurrentAMPDUEnable = false; + pHTInfo->ForcedAMSDUMode = HT_AGG_FORCE_ENABLE; + pHTInfo->ForcedAMSDUMaxSize = 7935; + + pHTInfo->IOTAction |= HT_IOT_ACT_TX_USE_AMSDU_8K; + } + + // Rx Reorder Setting + pHTInfo->bCurRxReorderEnable = pHTInfo->bRegRxReorderEnable; + + // + // Filter out unsupported HT rate for this AP + // Update RATR table + // This is only for 8190 ,8192 or later product which using firmware to handle rate adaptive mechanism. + // + + // Handle Ralink AP bad MCS rate set condition. Joseph. + // This fix the bug of Ralink AP. This may be removed in the future. + if(pPeerHTCap->MCS[0] == 0) + pPeerHTCap->MCS[0] = 0xff; + + HTFilterMCSRate(ieee, pPeerHTCap->MCS, ieee->dot11HTOperationalRateSet); + + // + // Config MIMO Power Save setting + // + pHTInfo->PeerMimoPs = pPeerHTCap->MimoPwrSave; + if(pHTInfo->PeerMimoPs == MIMO_PS_STATIC) + pMcsFilter = MCS_FILTER_1SS; + else + pMcsFilter = MCS_FILTER_ALL; + //WB add for MCS8 bug +// pMcsFilter = MCS_FILTER_1SS; + ieee->HTHighestOperaRate = HTGetHighestMCSRate(ieee, ieee->dot11HTOperationalRateSet, pMcsFilter); + ieee->HTCurrentOperaRate = ieee->HTHighestOperaRate; + + // + // Config current operation mode. + // + pHTInfo->CurrentOpMode = pPeerHTInfo->OptMode; + + + +} + +void HTSetConnectBwModeCallback(struct ieee80211_device* ieee); +/******************************************************************************************************************** + *function: initialize HT info(struct PRT_HIGH_THROUGHPUT) + * input: struct ieee80211_device* ieee + * output: none + * return: none + * notice: This function is called when * (1) MPInitialization Phase * (2) Receiving of Deauthentication from AP +********************************************************************************************************************/ +// TODO: Should this funciton be called when receiving of Disassociation? +void HTInitializeHTInfo(struct ieee80211_device* ieee) +{ + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; + + // + // These parameters will be reset when receiving deauthentication packet + // + IEEE80211_DEBUG(IEEE80211_DL_HT, "===========>%s()\n", __FUNCTION__); + pHTInfo->bCurrentHTSupport = false; + + // 40MHz channel support + pHTInfo->bCurBW40MHz = false; + pHTInfo->bCurTxBW40MHz = false; + + // Short GI support + pHTInfo->bCurShortGI20MHz = false; + pHTInfo->bCurShortGI40MHz = false; + pHTInfo->bForcedShortGI = false; + + // CCK rate support + // This flag is set to true to support CCK rate by default. + // It will be affected by "pHTInfo->bRegSuppCCK" and AP capabilities only when associate to + // 11N BSS. + pHTInfo->bCurSuppCCK = true; + + // AMSDU related + pHTInfo->bCurrent_AMSDU_Support = false; + pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize; + + // AMPUD related + pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density; + pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor; + + + + // Initialize all of the parameters related to 11n + memset((void*)(&(pHTInfo->SelfHTCap)), 0, sizeof(pHTInfo->SelfHTCap)); + memset((void*)(&(pHTInfo->SelfHTInfo)), 0, sizeof(pHTInfo->SelfHTInfo)); + memset((void*)(&(pHTInfo->PeerHTCapBuf)), 0, sizeof(pHTInfo->PeerHTCapBuf)); + memset((void*)(&(pHTInfo->PeerHTInfoBuf)), 0, sizeof(pHTInfo->PeerHTInfoBuf)); + + pHTInfo->bSwBwInProgress = false; + pHTInfo->ChnlOp = CHNLOP_NONE; + + // Set default IEEE spec for Draft N + pHTInfo->ePeerHTSpecVer = HT_SPEC_VER_IEEE; + + // Realtek proprietary aggregation mode + pHTInfo->bCurrentRT2RTAggregation = false; + pHTInfo->bCurrentRT2RTLongSlotTime = false; + pHTInfo->IOTPeer = 0; + pHTInfo->IOTAction = 0; + + //MCS rate initialized here + { + u8* RegHTSuppRateSets = &(ieee->RegHTSuppRateSet[0]); + RegHTSuppRateSets[0] = 0xFF; //support MCS 0~7 + RegHTSuppRateSets[1] = 0xFF; //support MCS 8~15 + RegHTSuppRateSets[4] = 0x01; //support MCS 32 + } +} +/******************************************************************************************************************** + *function: initialize Bss HT structure(struct PBSS_HT) + * input: PBSS_HT pBssHT //to be initialized + * output: none + * return: none + * notice: This function is called when initialize network structure +********************************************************************************************************************/ +void HTInitializeBssDesc(PBSS_HT pBssHT) +{ + + pBssHT->bdSupportHT = false; + memset(pBssHT->bdHTCapBuf, 0, sizeof(pBssHT->bdHTCapBuf)); + pBssHT->bdHTCapLen = 0; + memset(pBssHT->bdHTInfoBuf, 0, sizeof(pBssHT->bdHTInfoBuf)); + pBssHT->bdHTInfoLen = 0; + + pBssHT->bdHTSpecVer= HT_SPEC_VER_IEEE; + + pBssHT->bdRT2RTAggregation = false; + pBssHT->bdRT2RTLongSlotTime = false; +} +#if 0 +//below function has merged into ieee80211_network_init() in ieee80211_rx.c +void +HTParsingHTCapElement( + IN PADAPTER Adapter, + IN OCTET_STRING HTCapIE, + OUT PRT_WLAN_BSS pBssDesc +) +{ + PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; + + if( HTCapIE.Length > sizeof(pBssDesc->BssHT.bdHTCapBuf) ) + { + RT_TRACE( COMP_HT, DBG_LOUD, ("HTParsingHTCapElement(): HT Capability Element length is too long!\n") ); + return; + } + + // TODO: Check the correctness of HT Cap + //Print each field in detail. Driver should not print out this message by default + if(!pMgntInfo->mActingAsAp && !pMgntInfo->mAssoc) + HTDebugHTCapability(DBG_TRACE, Adapter, &HTCapIE, (pu8)"HTParsingHTCapElement()"); + + HTCapIE.Length = HTCapIE.Length > sizeof(pBssDesc->BssHT.bdHTCapBuf)?\ + sizeof(pBssDesc->BssHT.bdHTCapBuf):HTCapIE.Length; //prevent from overflow + + CopyMem(pBssDesc->BssHT.bdHTCapBuf, HTCapIE.Octet, HTCapIE.Length); + pBssDesc->BssHT.bdHTCapLen = HTCapIE.Length; + +} + + +void +HTParsingHTInfoElement( + PADAPTER Adapter, + OCTET_STRING HTInfoIE, + PRT_WLAN_BSS pBssDesc +) +{ + PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; + + if( HTInfoIE.Length > sizeof(pBssDesc->BssHT.bdHTInfoBuf)) + { + RT_TRACE( COMP_HT, DBG_LOUD, ("HTParsingHTInfoElement(): HT Information Element length is too long!\n") ); + return; + } + + // TODO: Check the correctness of HT Info + //Print each field in detail. Driver should not print out this message by default + if(!pMgntInfo->mActingAsAp && !pMgntInfo->mAssoc) + HTDebugHTInfo(DBG_TRACE, Adapter, &HTInfoIE, (pu8)"HTParsingHTInfoElement()"); + + HTInfoIE.Length = HTInfoIE.Length > sizeof(pBssDesc->BssHT.bdHTInfoBuf)?\ + sizeof(pBssDesc->BssHT.bdHTInfoBuf):HTInfoIE.Length; //prevent from overflow + + CopyMem( pBssDesc->BssHT.bdHTInfoBuf, HTInfoIE.Octet, HTInfoIE.Length); + pBssDesc->BssHT.bdHTInfoLen = HTInfoIE.Length; +} + +/* + * Get HT related information from beacon and save it in BssDesc + * + * (1) Parse HTCap, and HTInfo, and record whether it is 11n AP + * (2) If peer is HT, but not WMM, call QosSetLegacyWMMParamWithHT() + * (3) Check whether peer is Realtek AP (for Realtek proprietary aggregation mode). + * Input: + * PADAPTER Adapter + * + * Output: + * PRT_TCB BssDesc + * +*/ +void HTGetValueFromBeaconOrProbeRsp( + PADAPTER Adapter, + POCTET_STRING pSRCmmpdu, + PRT_WLAN_BSS bssDesc +) +{ + PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; + PRT_HIGH_THROUGHPUT pHTInfo = GET_HT_INFO(pMgntInfo); + OCTET_STRING HTCapIE, HTInfoIE, HTRealtekAgg, mmpdu; + OCTET_STRING BroadcomElement, CiscoElement; + + mmpdu.Octet = pSRCmmpdu->Octet; + mmpdu.Length = pSRCmmpdu->Length; + + //2Note: + // Mark for IOT testing using Linksys WRT350N, This AP does not contain WMM IE when + // it is configured at pure-N mode. + // if(bssDesc->BssQos.bdQoSMode & QOS_WMM) + // + + HTInitializeBssDesc (&bssDesc->BssHT); + + //2<1> Parse HTCap, and HTInfo + // Get HT Capability IE: (1) Get IEEE Draft N IE or (2) Get EWC IE + HTCapIE = PacketGetElement(mmpdu, EID_HTCapability, OUI_SUB_DONT_CARE, OUI_SUBTYPE_DONT_CARE); + if(HTCapIE.Length == 0) + { + HTCapIE = PacketGetElement(mmpdu, EID_Vendor, OUI_SUB_11N_EWC_HT_CAP, OUI_SUBTYPE_DONT_CARE); + if(HTCapIE.Length != 0) + bssDesc->BssHT.bdHTSpecVer= HT_SPEC_VER_EWC; + } + if(HTCapIE.Length != 0) + HTParsingHTCapElement(Adapter, HTCapIE, bssDesc); + + // Get HT Information IE: (1) Get IEEE Draft N IE or (2) Get EWC IE + HTInfoIE = PacketGetElement(mmpdu, EID_HTInfo, OUI_SUB_DONT_CARE, OUI_SUBTYPE_DONT_CARE); + if(HTInfoIE.Length == 0) + { + HTInfoIE = PacketGetElement(mmpdu, EID_Vendor, OUI_SUB_11N_EWC_HT_INFO, OUI_SUBTYPE_DONT_CARE); + if(HTInfoIE.Length != 0) + bssDesc->BssHT.bdHTSpecVer = HT_SPEC_VER_EWC; + } + if(HTInfoIE.Length != 0) + HTParsingHTInfoElement(Adapter, HTInfoIE, bssDesc); + + //2<2>If peer is HT, but not WMM, call QosSetLegacyWMMParamWithHT() + if(HTCapIE.Length != 0) + { + bssDesc->BssHT.bdSupportHT = true; + if(bssDesc->BssQos.bdQoSMode == QOS_DISABLE) + QosSetLegacyWMMParamWithHT(Adapter, bssDesc); + } + else + { + bssDesc->BssHT.bdSupportHT = false; + } + + //2<3>Check whether the peer is Realtek AP/STA + if(pHTInfo->bRegRT2RTAggregation) + { + if(bssDesc->BssHT.bdSupportHT) + { + HTRealtekAgg = PacketGetElement(mmpdu, EID_Vendor, OUI_SUB_REALTEK_AGG, OUI_SUBTYPE_DONT_CARE); + if(HTRealtekAgg.Length >=5 ) + { + bssDesc->BssHT.bdRT2RTAggregation = true; + + if((HTRealtekAgg.Octet[4]==1) && (HTRealtekAgg.Octet[5] & 0x02)) + bssDesc->BssHT.bdRT2RTLongSlotTime = true; + } + } + } + + // + // 2008/01/25 MH Get Broadcom AP IE for manamgent frame CCK rate problem. + // AP can not receive CCK managemtn from from 92E. + // + + // Initialize every new bss broadcom cap exist as false.. + bssDesc->bBroadcomCapExist= false; + + if(HTCapIE.Length != 0 || HTInfoIE.Length != 0) + { + u4Byte Length = 0; + + FillOctetString(BroadcomElement, NULL, 0); + + BroadcomElement = PacketGetElement( mmpdu, EID_Vendor, OUI_SUB_BROADCOM_IE_1, OUI_SUBTYPE_DONT_CARE); + Length += BroadcomElement.Length; + BroadcomElement = PacketGetElement( mmpdu, EID_Vendor, OUI_SUB_BROADCOM_IE_2, OUI_SUBTYPE_DONT_CARE); + Length += BroadcomElement.Length; + BroadcomElement = PacketGetElement( mmpdu, EID_Vendor, OUI_SUB_BROADCOM_IE_3, OUI_SUBTYPE_DONT_CARE); + Length += BroadcomElement.Length; + + if(Length > 0) + bssDesc->bBroadcomCapExist = true; + } + + + // For Cisco IOT issue + CiscoElement = PacketGetElement( mmpdu, EID_Vendor, OUI_SUB_CISCO_IE, OUI_SUBTYPE_DONT_CARE); + if(CiscoElement.Length != 0){ // 3: 0x00, 0x40, 0x96 .... + bssDesc->bCiscoCapExist = true; + }else{ + bssDesc->bCiscoCapExist = false; + } +} + + +#endif +/******************************************************************************************************************** + *function: initialize Bss HT structure(struct PBSS_HT) + * input: struct ieee80211_device *ieee + * struct ieee80211_network *pNetwork //usually current network we are live in + * output: none + * return: none + * notice: This function should ONLY be called before association +********************************************************************************************************************/ +void HTResetSelfAndSavePeerSetting(struct ieee80211_device* ieee, struct ieee80211_network * pNetwork) +{ + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; +// u16 nMaxAMSDUSize; +// PHT_CAPABILITY_ELE pPeerHTCap = (PHT_CAPABILITY_ELE)pNetwork->bssht.bdHTCapBuf; +// PHT_INFORMATION_ELE pPeerHTInfo = (PHT_INFORMATION_ELE)pNetwork->bssht.bdHTInfoBuf; +// u8* pMcsFilter; + u8 bIOTAction = 0; + + // + // Save Peer Setting before Association + // + IEEE80211_DEBUG(IEEE80211_DL_HT, "==============>%s()\n", __FUNCTION__); + /*unmark bEnableHT flag here is the same reason why unmarked in function ieee80211_softmac_new_net. WB 2008.09.10*/ +// if( pHTInfo->bEnableHT && pNetwork->bssht.bdSupportHT) + if (pNetwork->bssht.bdSupportHT) + { + pHTInfo->bCurrentHTSupport = true; + pHTInfo->ePeerHTSpecVer = pNetwork->bssht.bdHTSpecVer; + + // Save HTCap and HTInfo information Element + if(pNetwork->bssht.bdHTCapLen > 0 && pNetwork->bssht.bdHTCapLen <= sizeof(pHTInfo->PeerHTCapBuf)) + memcpy(pHTInfo->PeerHTCapBuf, pNetwork->bssht.bdHTCapBuf, pNetwork->bssht.bdHTCapLen); + + if(pNetwork->bssht.bdHTInfoLen > 0 && pNetwork->bssht.bdHTInfoLen <= sizeof(pHTInfo->PeerHTInfoBuf)) + memcpy(pHTInfo->PeerHTInfoBuf, pNetwork->bssht.bdHTInfoBuf, pNetwork->bssht.bdHTInfoLen); + + // Check whether RT to RT aggregation mode is enabled + if(pHTInfo->bRegRT2RTAggregation) + { + pHTInfo->bCurrentRT2RTAggregation = pNetwork->bssht.bdRT2RTAggregation; + pHTInfo->bCurrentRT2RTLongSlotTime = pNetwork->bssht.bdRT2RTLongSlotTime; + } + else + { + pHTInfo->bCurrentRT2RTAggregation = false; + pHTInfo->bCurrentRT2RTLongSlotTime = false; + } + + // Determine the IOT Peer Vendor. + HTIOTPeerDetermine(ieee); + + // Decide IOT Action + // Must be called after the parameter of pHTInfo->bCurrentRT2RTAggregation is decided + pHTInfo->IOTAction = 0; + bIOTAction = HTIOTActIsDisableMCS14(ieee, pNetwork->bssid); + if(bIOTAction) + pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_MCS14; + + bIOTAction = HTIOTActIsDisableMCS15(ieee); + if(bIOTAction) + pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_MCS15; + + bIOTAction = HTIOTActIsDisableMCSTwoSpatialStream(ieee, pNetwork->bssid); + if(bIOTAction) + pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_ALL_2SS; + + + bIOTAction = HTIOTActIsDisableEDCATurbo(ieee, pNetwork->bssid); + if(bIOTAction) + pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_EDCA_TURBO; + + bIOTAction = HTIOTActIsMgntUseCCK6M(pNetwork); + if(bIOTAction) + pHTInfo->IOTAction |= HT_IOT_ACT_MGNT_USE_CCK_6M; + + bIOTAction = HTIOTActIsCCDFsync(pNetwork->bssid); + if(bIOTAction) + pHTInfo->IOTAction |= HT_IOT_ACT_CDD_FSYNC; + + + } + else + { + pHTInfo->bCurrentHTSupport = false; + pHTInfo->bCurrentRT2RTAggregation = false; + pHTInfo->bCurrentRT2RTLongSlotTime = false; + + pHTInfo->IOTAction = 0; + } + +} + +void HTUpdateSelfAndPeerSetting(struct ieee80211_device* ieee, struct ieee80211_network * pNetwork) +{ + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; +// PHT_CAPABILITY_ELE pPeerHTCap = (PHT_CAPABILITY_ELE)pNetwork->bssht.bdHTCapBuf; + PHT_INFORMATION_ELE pPeerHTInfo = (PHT_INFORMATION_ELE)pNetwork->bssht.bdHTInfoBuf; + + if(pHTInfo->bCurrentHTSupport) + { + // + // Config current operation mode. + // + if(pNetwork->bssht.bdHTInfoLen != 0) + pHTInfo->CurrentOpMode = pPeerHTInfo->OptMode; + + // + // + // + } +} + +void HTUseDefaultSetting(struct ieee80211_device* ieee) +{ + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; +// u8 regBwOpMode; + + if(pHTInfo->bEnableHT) + { + pHTInfo->bCurrentHTSupport = true; + + pHTInfo->bCurSuppCCK = pHTInfo->bRegSuppCCK; + + pHTInfo->bCurBW40MHz = pHTInfo->bRegBW40MHz; + + pHTInfo->bCurShortGI20MHz= pHTInfo->bRegShortGI20MHz; + + pHTInfo->bCurShortGI40MHz= pHTInfo->bRegShortGI40MHz; + + pHTInfo->bCurrent_AMSDU_Support = pHTInfo->bAMSDU_Support; + + pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize; + + pHTInfo->bCurrentAMPDUEnable = pHTInfo->bAMPDUEnable; + + pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor; + + pHTInfo->CurrentMPDUDensity = pHTInfo->CurrentMPDUDensity; + + // Set BWOpMode register + + //update RATR index0 + HTFilterMCSRate(ieee, ieee->Regdot11HTOperationalRateSet, ieee->dot11HTOperationalRateSet); + //function below is not implemented at all. WB +#ifdef TODO + Adapter->HalFunc.InitHalRATRTableHandler( Adapter, &pMgntInfo->dot11OperationalRateSet, pMgntInfo->dot11HTOperationalRateSet); +#endif + ieee->HTHighestOperaRate = HTGetHighestMCSRate(ieee, ieee->dot11HTOperationalRateSet, MCS_FILTER_ALL); + ieee->HTCurrentOperaRate = ieee->HTHighestOperaRate; + + } + else + { + pHTInfo->bCurrentHTSupport = false; + } + return; +} +/******************************************************************************************************************** + *function: check whether HT control field exists + * input: struct ieee80211_device *ieee + * u8* pFrame //coming skb->data + * output: none + * return: return true if HT control field exists(false otherwise) + * notice: +********************************************************************************************************************/ +u8 HTCCheck(struct ieee80211_device* ieee, u8* pFrame) +{ + if(ieee->pHTInfo->bCurrentHTSupport) + { + if( (IsQoSDataFrame(pFrame) && Frame_Order(pFrame)) == 1) + { + IEEE80211_DEBUG(IEEE80211_DL_HT, "HT CONTROL FILED EXIST!!\n"); + return true; + } + } + return false; +} + +// +// This function set bandwidth mode in protocol layer. +// +void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset) +{ + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; +// u32 flags = 0; + + if(pHTInfo->bRegBW40MHz == false) + return; + + + + // To reduce dummy operation +// if((pHTInfo->bCurBW40MHz==false && Bandwidth==HT_CHANNEL_WIDTH_20) || +// (pHTInfo->bCurBW40MHz==true && Bandwidth==HT_CHANNEL_WIDTH_20_40 && Offset==pHTInfo->CurSTAExtChnlOffset)) +// return; + +// spin_lock_irqsave(&(ieee->bw_spinlock), flags); + if(pHTInfo->bSwBwInProgress) { +// spin_unlock_irqrestore(&(ieee->bw_spinlock), flags); + return; + } + //if in half N mode, set to 20M bandwidth please 09.08.2008 WB. + if(Bandwidth==HT_CHANNEL_WIDTH_20_40 && (!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))) + { + // Handle Illegal extention channel offset!! + if(ieee->current_network.channel<2 && Offset==HT_EXTCHNL_OFFSET_LOWER) + Offset = HT_EXTCHNL_OFFSET_NO_EXT; + if(Offset==HT_EXTCHNL_OFFSET_UPPER || Offset==HT_EXTCHNL_OFFSET_LOWER) { + pHTInfo->bCurBW40MHz = true; + pHTInfo->CurSTAExtChnlOffset = Offset; + } else { + pHTInfo->bCurBW40MHz = false; + pHTInfo->CurSTAExtChnlOffset = HT_EXTCHNL_OFFSET_NO_EXT; + } + } else { + pHTInfo->bCurBW40MHz = false; + pHTInfo->CurSTAExtChnlOffset = HT_EXTCHNL_OFFSET_NO_EXT; + } + + pHTInfo->bSwBwInProgress = true; + + // TODO: 2007.7.13 by Emily Wait 2000ms in order to garantee that switching + // bandwidth is executed after scan is finished. It is a temporal solution + // because software should ganrantee the last operation of switching bandwidth + // is executed properlly. + HTSetConnectBwModeCallback(ieee); + +// spin_unlock_irqrestore(&(ieee->bw_spinlock), flags); +} + +void HTSetConnectBwModeCallback(struct ieee80211_device* ieee) +{ + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; + + IEEE80211_DEBUG(IEEE80211_DL_HT, "======>%s()\n", __FUNCTION__); + + if(pHTInfo->bCurBW40MHz) + { + if(pHTInfo->CurSTAExtChnlOffset==HT_EXTCHNL_OFFSET_UPPER) + ieee->set_chan(ieee->dev, ieee->current_network.channel+2); + else if(pHTInfo->CurSTAExtChnlOffset==HT_EXTCHNL_OFFSET_LOWER) + ieee->set_chan(ieee->dev, ieee->current_network.channel-2); + else + ieee->set_chan(ieee->dev, ieee->current_network.channel); + + ieee->SetBWModeHandler(ieee->dev, HT_CHANNEL_WIDTH_20_40, pHTInfo->CurSTAExtChnlOffset); + } else { + ieee->set_chan(ieee->dev, ieee->current_network.channel); + ieee->SetBWModeHandler(ieee->dev, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); + } + + pHTInfo->bSwBwInProgress = false; +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +EXPORT_SYMBOL_NOVERS(HTUpdateSelfAndPeerSetting); +#else +EXPORT_SYMBOL(HTUpdateSelfAndPeerSetting); +#endif diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h new file mode 100644 index 000000000000..f7b882b99d14 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h @@ -0,0 +1,749 @@ +#ifndef __INC_QOS_TYPE_H +#define __INC_QOS_TYPE_H + +//#include "EndianFree.h" +#define BIT0 0x00000001 +#define BIT1 0x00000002 +#define BIT2 0x00000004 +#define BIT3 0x00000008 +#define BIT4 0x00000010 +#define BIT5 0x00000020 +#define BIT6 0x00000040 +#define BIT7 0x00000080 +#define BIT8 0x00000100 +#define BIT9 0x00000200 +#define BIT10 0x00000400 +#define BIT11 0x00000800 +#define BIT12 0x00001000 +#define BIT13 0x00002000 +#define BIT14 0x00004000 +#define BIT15 0x00008000 +#define BIT16 0x00010000 +#define BIT17 0x00020000 +#define BIT18 0x00040000 +#define BIT19 0x00080000 +#define BIT20 0x00100000 +#define BIT21 0x00200000 +#define BIT22 0x00400000 +#define BIT23 0x00800000 +#define BIT24 0x01000000 +#define BIT25 0x02000000 +#define BIT26 0x04000000 +#define BIT27 0x08000000 +#define BIT28 0x10000000 +#define BIT29 0x20000000 +#define BIT30 0x40000000 +#define BIT31 0x80000000 + +#define MAX_WMMELE_LENGTH 64 + +// +// QoS mode. +// enum 0, 1, 2, 4: since we can use the OR(|) operation. +// +// QOS_MODE is redefined for enum can't be ++, | under C++ compiler, 2006.05.17, by rcnjko. +//typedef enum _QOS_MODE{ +// QOS_DISABLE = 0, +// QOS_WMM = 1, +// QOS_EDCA = 2, +// QOS_HCCA = 4, +//}QOS_MODE,*PQOS_MODE; +// +typedef u32 QOS_MODE, *PQOS_MODE; +#define QOS_DISABLE 0 +#define QOS_WMM 1 +#define QOS_WMMSA 2 +#define QOS_EDCA 4 +#define QOS_HCCA 8 +#define QOS_WMM_UAPSD 16 //WMM Power Save, 2006-06-14 Isaiah + +#define AC_PARAM_SIZE 4 +#define WMM_PARAM_ELE_BODY_LEN 18 + +// +// QoS ACK Policy Field Values +// Ref: WMM spec 2.1.6: QoS Control Field, p.10. +// +typedef enum _ACK_POLICY{ + eAckPlc0_ACK = 0x00, + eAckPlc1_NoACK = 0x01, +}ACK_POLICY,*PACK_POLICY; + +#define WMM_PARAM_ELEMENT_SIZE (8+(4*AC_PARAM_SIZE)) +#if 0 +#define GET_QOS_CTRL(_pStart) ReadEF2Byte((u8 *)(_pStart) + 24) +#define SET_QOS_CTRL(_pStart, _value) WriteEF2Byte((u8 *)(_pStart) + 24, _value) + +// WMM control field. +#define GET_QOS_CTRL_WMM_UP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 0, 3)) +#define SET_QOS_CTRL_WMM_UP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 0, 3, (u8)(_value)) + +#define GET_QOS_CTRL_WMM_EOSP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 4, 1)) +#define SET_QOS_CTRL_WMM_EOSP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 4, 1, (u8)(_value)) + +#define GET_QOS_CTRL_WMM_ACK_POLICY(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 5, 2)) +#define SET_QOS_CTRL_WMM_ACK_POLICY(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 5, 2, (u8)(_value)) + +// 802.11e control field (by STA, data) +#define GET_QOS_CTRL_STA_DATA_TID(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 0, 4)) +#define SET_QOS_CTRL_STA_DATA_TID(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 0, 4, (u8)(_value)) + +#define GET_QOS_CTRL_STA_DATA_QSIZE_FLAG(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 4, 1)) +#define SET_QOS_CTRL_STA_DATA_QSIZE_FLAG(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 4, 1, (u8)(_value)) + +#define GET_QOS_CTRL_STA_DATA_ACK_POLICY(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 5, 2)) +#define SET_QOS_CTRL_STA_DATA_ACK_POLICY(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 5, 2, (u8)(_value)) + +#define GET_QOS_CTRL_STA_DATA_TXOP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 8, 8)) +#define SET_QOS_CTRL_STA_DATA_TXOP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 8, 8, (u8)(_value)) + +#define GET_QOS_CTRL_STA_DATA_QSIZE(_pStart) GET_QOS_CTRL_STA_DATA_TXOP(_pStart) +#define SET_QOS_CTRL_STA_DATA_QSIZE(_pStart, _value) SET_QOS_CTRL_STA_DATA_TXOP(_pStart) + +// 802.11e control field (by HC, data) +#define GET_QOS_CTRL_HC_DATA_TID(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 0, 4)) +#define SET_QOS_CTRL_HC_DATA_TID(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 0, 4, (u8)(_value)) + +#define GET_QOS_CTRL_HC_DATA_EOSP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 4, 1)) +#define SET_QOS_CTRL_HC_DATA_EOSP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 4, 1, (u8)(_value)) + +#define GET_QOS_CTRL_HC_DATA_ACK_POLICY(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 5, 2)) +#define SET_QOS_CTRL_HC_DATA_ACK_POLICY(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 5, 2, (u8)(_value)) + +#define GET_QOS_CTRL_HC_DATA_PS_BUFSTATE(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 8, 8)) +#define SET_QOS_CTRL_HC_DATA_PS_BUFSTATE(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 8, 8, (u8)(_value)) + +// 802.11e control field (by HC, CFP) +#define GET_QOS_CTRL_HC_CFP_TID(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 0, 4)) +#define SET_QOS_CTRL_HC_CFP_TID(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 0, 4, (u8)(_value)) + +#define GET_QOS_CTRL_HC_CFP_EOSP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 4, 1)) +#define SET_QOS_CTRL_HC_CFP_EOSP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 4, 1, (u8)(_value)) + +#define GET_QOS_CTRL_HC_CFP_ACK_POLICY(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 5, 2)) +#define SET_QOS_CTRL_HC_CFP_ACK_POLICY(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 5, 2, (u8)(_value)) + +#define GET_QOS_CTRL_HC_CFP_TXOP_LIMIT(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 8, 8)) +#define SET_QOS_CTRL_HC_CFP_TXOP_LIMIT(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 8, 8, (u8)(_value)) + +#define SET_WMM_QOS_INFO_FIELD(_pStart, _val) WriteEF1Byte(_pStart, _val) + +#define GET_WMM_QOS_INFO_FIELD_PARAMETERSET_COUNT(_pStart) LE_BITS_TO_1BYTE(_pStart, 0, 4) +#define SET_WMM_QOS_INFO_FIELD_PARAMETERSET_COUNT(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 0, 4, _val) + +#define GET_WMM_QOS_INFO_FIELD_AP_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 7, 1) +#define SET_WMM_QOS_INFO_FIELD_AP_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 7, 1, _val) + +#define GET_WMM_QOS_INFO_FIELD_STA_AC_VO_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 0, 1) +#define SET_WMM_QOS_INFO_FIELD_STA_AC_VO_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 0, 1, _val) + +#define GET_WMM_QOS_INFO_FIELD_STA_AC_VI_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 1, 1) +#define SET_WMM_QOS_INFO_FIELD_STA_AC_VI_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 1, 1, _val) + +#define GET_WMM_QOS_INFO_FIELD_STA_AC_BE_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 2, 1) +#define SET_WMM_QOS_INFO_FIELD_STA_AC_BE_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 2, 1, _val) + +#define GET_WMM_QOS_INFO_FIELD_STA_AC_BK_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 3, 1) +#define SET_WMM_QOS_INFO_FIELD_STA_AC_BK_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 3, 1, _val) + +#define GET_WMM_QOS_INFO_FIELD_STA_MAX_SP_LEN(_pStart) LE_BITS_TO_1BYTE(_pStart, 5, 2) +#define SET_WMM_QOS_INFO_FIELD_STA_MAX_SP_LEN(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 5, 2, _val) + + +#define WMM_INFO_ELEMENT_SIZE 7 + +#define GET_WMM_INFO_ELE_OUI(_pStart) ((u8 *)(_pStart)) +#define SET_WMM_INFO_ELE_OUI(_pStart, _pVal) PlatformMoveMemory(_pStart, _pVal, 3); + +#define GET_WMM_INFO_ELE_OUI_TYPE(_pStart) ( EF1Byte( *((u8 *)(_pStart)+3) ) ) +#define SET_WMM_INFO_ELE_OUI_TYPE(_pStart, _val) ( *((u8 *)(_pStart)+3) = EF1Byte(_val) ) + +#define GET_WMM_INFO_ELE_OUI_SUBTYPE(_pStart) ( EF1Byte( *((u8 *)(_pStart)+4) ) ) +#define SET_WMM_INFO_ELE_OUI_SUBTYPE(_pStart, _val) ( *((u8 *)(_pStart)+4) = EF1Byte(_val) ) + +#define GET_WMM_INFO_ELE_VERSION(_pStart) ( EF1Byte( *((u8 *)(_pStart)+5) ) ) +#define SET_WMM_INFO_ELE_VERSION(_pStart, _val) ( *((u8 *)(_pStart)+5) = EF1Byte(_val) ) + +#define GET_WMM_INFO_ELE_QOS_INFO_FIELD(_pStart) ( EF1Byte( *((u8 *)(_pStart)+6) ) ) +#define SET_WMM_INFO_ELE_QOS_INFO_FIELD(_pStart, _val) ( *((u8 *)(_pStart)+6) = EF1Byte(_val) ) + + + +#define GET_WMM_AC_PARAM_AIFSN(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 0, 4) ) +#define SET_WMM_AC_PARAM_AIFSN(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 0, 4, _val) + +#define GET_WMM_AC_PARAM_ACM(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 4, 1) ) +#define SET_WMM_AC_PARAM_ACM(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 4, 1, _val) + +#define GET_WMM_AC_PARAM_ACI(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 5, 2) ) +#define SET_WMM_AC_PARAM_ACI(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 5, 2, _val) + +#define GET_WMM_AC_PARAM_ACI_AIFSN(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 0, 8) ) +#define SET_WMM_AC_PARAM_ACI_AIFSN(_pStart, _val) SET_BTIS_TO_LE_4BYTE(_pStart, 0, 8, _val) + +#define GET_WMM_AC_PARAM_ECWMIN(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 8, 4) ) +#define SET_WMM_AC_PARAM_ECWMIN(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 8, 4, _val) + +#define GET_WMM_AC_PARAM_ECWMAX(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 12, 4) ) +#define SET_WMM_AC_PARAM_ECWMAX(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 12, 4, _val) + +#define GET_WMM_AC_PARAM_TXOP_LIMIT(_pStart) ( (u16)LE_BITS_TO_4BYTE(_pStart, 16, 16) ) +#define SET_WMM_AC_PARAM_TXOP_LIMIT(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 16, 16, _val) + + + + +#define GET_WMM_PARAM_ELE_OUI(_pStart) ((u8 *)(_pStart)) +#define SET_WMM_PARAM_ELE_OUI(_pStart, _pVal) PlatformMoveMemory(_pStart, _pVal, 3) + +#define GET_WMM_PARAM_ELE_OUI_TYPE(_pStart) ( EF1Byte( *((u8 *)(_pStart)+3) ) ) +#define SET_WMM_PARAM_ELE_OUI_TYPE(_pStart, _val) ( *((u8 *)(_pStart)+3) = EF1Byte(_val) ) + +#define GET_WMM_PARAM_ELE_OUI_SUBTYPE(_pStart) ( EF1Byte( *((u8 *)(_pStart)+4) ) ) +#define SET_WMM_PARAM_ELE_OUI_SUBTYPE(_pStart, _val) ( *((u8 *)(_pStart)+4) = EF1Byte(_val) ) + +#define GET_WMM_PARAM_ELE_VERSION(_pStart) ( EF1Byte( *((u8 *)(_pStart)+5) ) ) +#define SET_WMM_PARAM_ELE_VERSION(_pStart, _val) ( *((u8 *)(_pStart)+5) = EF1Byte(_val) ) + +#define GET_WMM_PARAM_ELE_QOS_INFO_FIELD(_pStart) ( EF1Byte( *((u8 *)(_pStart)+6) ) ) +#define SET_WMM_PARAM_ELE_QOS_INFO_FIELD(_pStart, _val) ( *((u8 *)(_pStart)+6) = EF1Byte(_val) ) + +#define GET_WMM_PARAM_ELE_AC_PARAM(_pStart) ( (u8 *)(_pStart)+8 ) +#define SET_WMM_PARAM_ELE_AC_PARAM(_pStart, _pVal) PlatformMoveMemory((_pStart)+8, _pVal, 16) +#endif + +// +// QoS Control Field +// Ref: +// 1. WMM spec 2.1.6: QoS Control Field, p.9. +// 2. 802.11e/D13.0 7.1.3.5, p.26. +// +typedef union _QOS_CTRL_FIELD{ + u8 charData[2]; + u16 shortData; + + // WMM spec + struct + { + u8 UP:3; + u8 usRsvd1:1; + u8 EOSP:1; + u8 AckPolicy:2; + u8 usRsvd2:1; + u8 ucRsvdByte; + }WMM; + + // 802.11e: QoS data type frame sent by non-AP QSTAs. + struct + { + u8 TID:4; + u8 bIsQsize:1;// 0: BIT[8:15] is TXOP Duration Requested, 1: BIT[8:15] is Queue Size. + u8 AckPolicy:2; + u8 usRsvd:1; + u8 TxopOrQsize; // (BIT4=0)TXOP Duration Requested or (BIT4=1)Queue Size. + }BySta; + + // 802.11e: QoS data, QoS Null, and QoS Data+CF-Ack frames sent by HC. + struct + { + u8 TID:4; + u8 EOSP:1; + u8 AckPolicy:2; + u8 usRsvd:1; + u8 PSBufState; // QAP PS Buffer State. + }ByHc_Data; + + // 802.11e: QoS (+) CF-Poll frames sent by HC. + struct + { + u8 TID:4; + u8 EOSP:1; + u8 AckPolicy:2; + u8 usRsvd:1; + u8 TxopLimit; // TXOP Limit. + }ByHc_CFP; + +}QOS_CTRL_FIELD, *PQOS_CTRL_FIELD; + + +// +// QoS Info Field +// Ref: +// 1. WMM spec 2.2.1: WME Information Element, p.11. +// 2. 8185 QoS code: QOS_INFO [def. in QoS_mp.h] +// +typedef union _QOS_INFO_FIELD{ + u8 charData; + + struct + { + u8 ucParameterSetCount:4; + u8 ucReserved:4; + }WMM; + + struct + { + //Ref WMM_Specification_1-1.pdf, 2006-06-13 Isaiah + u8 ucAC_VO_UAPSD:1; + u8 ucAC_VI_UAPSD:1; + u8 ucAC_BE_UAPSD:1; + u8 ucAC_BK_UAPSD:1; + u8 ucReserved1:1; + u8 ucMaxSPLen:2; + u8 ucReserved2:1; + + }ByWmmPsSta; + + struct + { + //Ref WMM_Specification_1-1.pdf, 2006-06-13 Isaiah + u8 ucParameterSetCount:4; + u8 ucReserved:3; + u8 ucApUapsd:1; + }ByWmmPsAp; + + struct + { + u8 ucAC3_UAPSD:1; + u8 ucAC2_UAPSD:1; + u8 ucAC1_UAPSD:1; + u8 ucAC0_UAPSD:1; + u8 ucQAck:1; + u8 ucMaxSPLen:2; + u8 ucMoreDataAck:1; + } By11eSta; + + struct + { + u8 ucParameterSetCount:4; + u8 ucQAck:1; + u8 ucQueueReq:1; + u8 ucTXOPReq:1; + u8 ucReserved:1; + } By11eAp; + + struct + { + u8 ucReserved1:4; + u8 ucQAck:1; + u8 ucReserved2:2; + u8 ucMoreDataAck:1; + } ByWmmsaSta; + + struct + { + u8 ucReserved1:4; + u8 ucQAck:1; + u8 ucQueueReq:1; + u8 ucTXOPReq:1; + u8 ucReserved2:1; + } ByWmmsaAp; + + struct + { + u8 ucAC3_UAPSD:1; + u8 ucAC2_UAPSD:1; + u8 ucAC1_UAPSD:1; + u8 ucAC0_UAPSD:1; + u8 ucQAck:1; + u8 ucMaxSPLen:2; + u8 ucMoreDataAck:1; + } ByAllSta; + + struct + { + u8 ucParameterSetCount:4; + u8 ucQAck:1; + u8 ucQueueReq:1; + u8 ucTXOPReq:1; + u8 ucApUapsd:1; + } ByAllAp; + +}QOS_INFO_FIELD, *PQOS_INFO_FIELD; + +#if 0 +// +// WMM Information Element +// Ref: WMM spec 2.2.1: WME Information Element, p.10. +// +typedef struct _WMM_INFO_ELEMENT{ +// u8 ElementID; +// u8 Length; + u8 OUI[3]; + u8 OUI_Type; + u8 OUI_SubType; + u8 Version; + QOS_INFO_FIELD QosInfo; +}WMM_INFO_ELEMENT, *PWMM_INFO_ELEMENT; +#endif + +// +// ACI to AC coding. +// Ref: WMM spec 2.2.2: WME Parameter Element, p.13. +// +// AC_CODING is redefined for enum can't be ++, | under C++ compiler, 2006.05.17, by rcnjko. +//typedef enum _AC_CODING{ +// AC0_BE = 0, // ACI: 0x00 // Best Effort +// AC1_BK = 1, // ACI: 0x01 // Background +// AC2_VI = 2, // ACI: 0x10 // Video +// AC3_VO = 3, // ACI: 0x11 // Voice +// AC_MAX = 4, // Max: define total number; Should not to be used as a real enum. +//}AC_CODING,*PAC_CODING; +// +typedef u32 AC_CODING; +#define AC0_BE 0 // ACI: 0x00 // Best Effort +#define AC1_BK 1 // ACI: 0x01 // Background +#define AC2_VI 2 // ACI: 0x10 // Video +#define AC3_VO 3 // ACI: 0x11 // Voice +#define AC_MAX 4 // Max: define total number; Should not to be used as a real enum. + +// +// ACI/AIFSN Field. +// Ref: WMM spec 2.2.2: WME Parameter Element, p.12. +// +typedef union _ACI_AIFSN{ + u8 charData; + + struct + { + u8 AIFSN:4; + u8 ACM:1; + u8 ACI:2; + u8 Reserved:1; + }f; // Field +}ACI_AIFSN, *PACI_AIFSN; + +// +// ECWmin/ECWmax field. +// Ref: WMM spec 2.2.2: WME Parameter Element, p.13. +// +typedef union _ECW{ + u8 charData; + struct + { + u8 ECWmin:4; + u8 ECWmax:4; + }f; // Field +}ECW, *PECW; + +// +// AC Parameters Record Format. +// Ref: WMM spec 2.2.2: WME Parameter Element, p.12. +// +typedef union _AC_PARAM{ + u32 longData; + u8 charData[4]; + + struct + { + ACI_AIFSN AciAifsn; + ECW Ecw; + u16 TXOPLimit; + }f; // Field +}AC_PARAM, *PAC_PARAM; + + + +// +// QoS element subtype +// +typedef enum _QOS_ELE_SUBTYPE{ + QOSELE_TYPE_INFO = 0x00, // 0x00: Information element + QOSELE_TYPE_PARAM = 0x01, // 0x01: parameter element +}QOS_ELE_SUBTYPE,*PQOS_ELE_SUBTYPE; + + +// +// Direction Field Values. +// Ref: WMM spec 2.2.11: WME TSPEC Element, p.18. +// +typedef enum _DIRECTION_VALUE{ + DIR_UP = 0, // 0x00 // UpLink + DIR_DOWN = 1, // 0x01 // DownLink + DIR_DIRECT = 2, // 0x10 // DirectLink + DIR_BI_DIR = 3, // 0x11 // Bi-Direction +}DIRECTION_VALUE,*PDIRECTION_VALUE; + + +// +// TS Info field in WMM TSPEC Element. +// Ref: +// 1. WMM spec 2.2.11: WME TSPEC Element, p.18. +// 2. 8185 QoS code: QOS_TSINFO [def. in QoS_mp.h] +// +typedef union _QOS_TSINFO{ + u8 charData[3]; + struct { + u8 ucTrafficType:1; //WMM is reserved + u8 ucTSID:4; + u8 ucDirection:2; + u8 ucAccessPolicy:2; //WMM: bit8=0, bit7=1 + u8 ucAggregation:1; //WMM is reserved + u8 ucPSB:1; //WMMSA is APSD + u8 ucUP:3; + u8 ucTSInfoAckPolicy:2; //WMM is reserved + u8 ucSchedule:1; //WMM is reserved + u8 ucReserved:7; + }field; +}QOS_TSINFO, *PQOS_TSINFO; + +// +// WMM TSPEC Body. +// Ref: WMM spec 2.2.11: WME TSPEC Element, p.16. +// +typedef union _TSPEC_BODY{ + u8 charData[55]; + + struct + { + QOS_TSINFO TSInfo; //u8 TSInfo[3]; + u16 NominalMSDUsize; + u16 MaxMSDUsize; + u32 MinServiceItv; + u32 MaxServiceItv; + u32 InactivityItv; + u32 SuspenItv; + u32 ServiceStartTime; + u32 MinDataRate; + u32 MeanDataRate; + u32 PeakDataRate; + u32 MaxBurstSize; + u32 DelayBound; + u32 MinPhyRate; + u16 SurplusBandwidthAllowance; + u16 MediumTime; + } f; // Field +}TSPEC_BODY, *PTSPEC_BODY; + + +// +// WMM TSPEC Element. +// Ref: WMM spec 2.2.11: WME TSPEC Element, p.16. +// +typedef struct _WMM_TSPEC{ + u8 ID; + u8 Length; + u8 OUI[3]; + u8 OUI_Type; + u8 OUI_SubType; + u8 Version; + TSPEC_BODY Body; +} WMM_TSPEC, *PWMM_TSPEC; + +// +// ACM implementation method. +// Annie, 2005-12-13. +// +typedef enum _ACM_METHOD{ + eAcmWay0_SwAndHw = 0, // By SW and HW. + eAcmWay1_HW = 1, // By HW. + eAcmWay2_SW = 2, // By SW. +}ACM_METHOD,*PACM_METHOD; + + +typedef struct _ACM{ +// u8 RegEnableACM; + u64 UsedTime; + u64 MediumTime; + u8 HwAcmCtl; // TRUE: UsedTime exceed => Do NOT USE this AC. It wll be written to ACM_CONTROL(0xBF BIT 0/1/2 in 8185B). +}ACM, *PACM; + +typedef u8 AC_UAPSD, *PAC_UAPSD; + +#define GET_VO_UAPSD(_apsd) ((_apsd) & BIT0) +#define SET_VO_UAPSD(_apsd) ((_apsd) |= BIT0) + +#define GET_VI_UAPSD(_apsd) ((_apsd) & BIT1) +#define SET_VI_UAPSD(_apsd) ((_apsd) |= BIT1) + +#define GET_BK_UAPSD(_apsd) ((_apsd) & BIT2) +#define SET_BK_UAPSD(_apsd) ((_apsd) |= BIT2) + +#define GET_BE_UAPSD(_apsd) ((_apsd) & BIT3) +#define SET_BE_UAPSD(_apsd) ((_apsd) |= BIT3) + + +//typedef struct _TCLASS{ +// TODO +//} TCLASS, *PTCLASS; +typedef union _QOS_TCLAS{ + + struct _TYPE_GENERAL{ + u8 Priority; + u8 ClassifierType; + u8 Mask; + } TYPE_GENERAL; + + struct _TYPE0_ETH{ + u8 Priority; + u8 ClassifierType; + u8 Mask; + u8 SrcAddr[6]; + u8 DstAddr[6]; + u16 Type; + } TYPE0_ETH; + + struct _TYPE1_IPV4{ + u8 Priority; + u8 ClassifierType; + u8 Mask; + u8 Version; + u8 SrcIP[4]; + u8 DstIP[4]; + u16 SrcPort; + u16 DstPort; + u8 DSCP; + u8 Protocol; + u8 Reserved; + } TYPE1_IPV4; + + struct _TYPE1_IPV6{ + u8 Priority; + u8 ClassifierType; + u8 Mask; + u8 Version; + u8 SrcIP[16]; + u8 DstIP[16]; + u16 SrcPort; + u16 DstPort; + u8 FlowLabel[3]; + } TYPE1_IPV6; + + struct _TYPE2_8021Q{ + u8 Priority; + u8 ClassifierType; + u8 Mask; + u16 TagType; + } TYPE2_8021Q; +} QOS_TCLAS, *PQOS_TCLAS; + +//typedef struct _WMM_TSTREAM{ +// +//- TSPEC +//- AC (which to mapping) +//} WMM_TSTREAM, *PWMM_TSTREAM; +typedef struct _QOS_TSTREAM{ + u8 AC; + WMM_TSPEC TSpec; + QOS_TCLAS TClass; +} QOS_TSTREAM, *PQOS_TSTREAM; + +//typedef struct _U_APSD{ +//- TriggerEnable [4] +//- MaxSPLength +//- HighestAcBuffered +//} U_APSD, *PU_APSD; + +//joseph TODO: +// UAPSD function should be implemented by 2 data structure +// "Qos control field" and "Qos info field" +//typedef struct _QOS_UAPSD{ +// u8 bTriggerEnable[4]; +// u8 MaxSPLength; +// u8 HighestBufAC; +//} QOS_UAPSD, *PQOS_APSD; + +//---------------------------------------------------------------------------- +// 802.11 Management frame Status Code field +//---------------------------------------------------------------------------- +typedef struct _OCTET_STRING{ + u8 *Octet; + u16 Length; +}OCTET_STRING, *POCTET_STRING; +#if 0 +#define FillOctetString(_os,_octet,_len) \ + (_os).Octet=(u8 *)(_octet); \ + (_os).Length=(_len); + +#define WMM_ELEM_HDR_LEN 6 +#define WMMElemSkipHdr(_osWMMElem) \ + (_osWMMElem).Octet += WMM_ELEM_HDR_LEN; \ + (_osWMMElem).Length -= WMM_ELEM_HDR_LEN; +#endif +// +// STA QoS data. +// Ref: DOT11_QOS in 8185 code. [def. in QoS_mp.h] +// +typedef struct _STA_QOS{ + //DECLARE_RT_OBJECT(STA_QOS); + u8 WMMIEBuf[MAX_WMMELE_LENGTH]; + u8* WMMIE; + + // Part 1. Self QoS Mode. + QOS_MODE QosCapability; //QoS Capability, 2006-06-14 Isaiah + QOS_MODE CurrentQosMode; + + // For WMM Power Save Mode : + // ACs are trigger/delivery enabled or legacy power save enabled. 2006-06-13 Isaiah + AC_UAPSD b4ac_Uapsd; //VoUapsd(bit0), ViUapsd(bit1), BkUapsd(bit2), BeUapsd(bit3), + AC_UAPSD Curr4acUapsd; + u8 bInServicePeriod; + u8 MaxSPLength; + int NumBcnBeforeTrigger; + + // Part 2. EDCA Parameter (perAC) + u8 * pWMMInfoEle; + u8 WMMParamEle[WMM_PARAM_ELEMENT_SIZE]; + u8 WMMPELength; + + // + //2 ToDo: remove the Qos Info Field and replace it by the above WMM Info element. + // By Bruce, 2008-01-30. + // Part 2. EDCA Parameter (perAC) + QOS_INFO_FIELD QosInfoField_STA; // Maintained by STA + QOS_INFO_FIELD QosInfoField_AP; // Retrieved from AP + + AC_PARAM CurAcParameters[4]; + + // Part 3. ACM + ACM acm[4]; + ACM_METHOD AcmMethod; + + // Part 4. Per TID (Part 5: TCLASS will be described by TStream) + QOS_TSTREAM TStream[16]; + WMM_TSPEC TSpec; + + u32 QBssWirelessMode; + + // No Ack Setting + u8 bNoAck; + + // Enable/Disable Rx immediate BA capability. + u8 bEnableRxImmBA; + +}STA_QOS, *PSTA_QOS; + +// +// BSS QOS data. +// Ref: BssDscr in 8185 code. [def. in BssDscr.h] +// +typedef struct _BSS_QOS{ + QOS_MODE bdQoSMode; + + u8 bdWMMIEBuf[MAX_WMMELE_LENGTH]; + u8* bdWMMIE; + + QOS_ELE_SUBTYPE EleSubType; + + u8 * pWMMInfoEle; + u8 * pWMMParamEle; + + QOS_INFO_FIELD QosInfoField; + AC_PARAM AcParameter[4]; +}BSS_QOS, *PBSS_QOS; + + +// +// Ref: sQoSCtlLng and QoSCtl definition in 8185 QoS code. +//#define QoSCtl (( (Adapter->bRegQoS) && (Adapter->dot11QoS.QoSMode &(QOS_EDCA|QOS_HCCA)) ) ?sQoSCtlLng:0) +// +#define sQoSCtlLng 2 +#define QOS_CTRL_LEN(_QosMode) ((_QosMode > QOS_DISABLE)? sQoSCtlLng : 0) + + +//Added by joseph +//UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP +//#define UP2AC(up) ((up<3)?((up==0)?1:0):(up>>1)) +#define IsACValid(ac) ((ac<=7 )?true:false ) + +#endif // #ifndef __INC_QOS_TYPE_H diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h new file mode 100644 index 000000000000..baaac2149de1 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h @@ -0,0 +1,56 @@ +#ifndef _TSTYPE_H_ +#define _TSTYPE_H_ +#include "rtl819x_Qos.h" +#define TS_SETUP_TIMEOUT 60 // In millisecond +#define TS_INACT_TIMEOUT 60 +#define TS_ADDBA_DELAY 60 + +#define TOTAL_TS_NUM 16 +#define TCLAS_NUM 4 + +// This define the Tx/Rx directions +typedef enum _TR_SELECT { + TX_DIR = 0, + RX_DIR = 1, +} TR_SELECT, *PTR_SELECT; + +typedef struct _TS_COMMON_INFO{ + struct list_head List; + struct timer_list SetupTimer; + struct timer_list InactTimer; + u8 Addr[6]; + TSPEC_BODY TSpec; + QOS_TCLAS TClass[TCLAS_NUM]; + u8 TClasProc; + u8 TClasNum; +} TS_COMMON_INFO, *PTS_COMMON_INFO; + +typedef struct _TX_TS_RECORD{ + TS_COMMON_INFO TsCommonInfo; + u16 TxCurSeq; + BA_RECORD TxPendingBARecord; // For BA Originator + BA_RECORD TxAdmittedBARecord; // For BA Originator +// QOS_DL_RECORD DLRecord; + u8 bAddBaReqInProgress; + u8 bAddBaReqDelayed; + u8 bUsingBa; + struct timer_list TsAddBaTimer; + u8 num; +} TX_TS_RECORD, *PTX_TS_RECORD; + +typedef struct _RX_TS_RECORD { + TS_COMMON_INFO TsCommonInfo; + u16 RxIndicateSeq; + u16 RxTimeoutIndicateSeq; + struct list_head RxPendingPktList; + struct timer_list RxPktPendingTimer; + BA_RECORD RxAdmittedBARecord; // For BA Recepient + u16 RxLastSeqNum; + u8 RxLastFragNum; + u8 num; +// QOS_DL_RECORD DLRecord; +} RX_TS_RECORD, *PRX_TS_RECORD; + + +#endif + diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c new file mode 100644 index 000000000000..5aa4c8db438d --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c @@ -0,0 +1,654 @@ +#include "ieee80211.h" +#include +#include "rtl819x_TS.h" + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +#define list_for_each_entry_safe(pos, n, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member), \ + n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) +#endif +void TsSetupTimeOut(unsigned long data) +{ + // Not implement yet + // This is used for WMMSA and ACM , that would send ADDTSReq frame. +} + +void TsInactTimeout(unsigned long data) +{ + // Not implement yet + // This is used for WMMSA and ACM. + // This function would be call when TS is no Tx/Rx for some period of time. +} + +/******************************************************************************************************************** + *function: I still not understand this function, so wait for further implementation + * input: unsigned long data //acturally we send TX_TS_RECORD or RX_TS_RECORD to these timer + * return: NULL + * notice: +********************************************************************************************************************/ +#if 1 +void RxPktPendingTimeout(unsigned long data) +{ + PRX_TS_RECORD pRxTs = (PRX_TS_RECORD)data; + struct ieee80211_device *ieee = container_of(pRxTs, struct ieee80211_device, RxTsRecord[pRxTs->num]); + + PRX_REORDER_ENTRY pReorderEntry = NULL; + + //u32 flags = 0; + unsigned long flags = 0; + struct ieee80211_rxb *stats_IndicateArray[REORDER_WIN_SIZE]; + u8 index = 0; + bool bPktInBuf = false; + + + spin_lock_irqsave(&(ieee->reorder_spinlock), flags); + //PlatformAcquireSpinLock(Adapter, RT_RX_SPINLOCK); + IEEE80211_DEBUG(IEEE80211_DL_REORDER,"==================>%s()\n",__FUNCTION__); + if(pRxTs->RxTimeoutIndicateSeq != 0xffff) + { + // Indicate the pending packets sequentially according to SeqNum until meet the gap. + while(!list_empty(&pRxTs->RxPendingPktList)) + { + pReorderEntry = (PRX_REORDER_ENTRY)list_entry(pRxTs->RxPendingPktList.prev,RX_REORDER_ENTRY,List); + if(index == 0) + pRxTs->RxIndicateSeq = pReorderEntry->SeqNum; + + if( SN_LESS(pReorderEntry->SeqNum, pRxTs->RxIndicateSeq) || + SN_EQUAL(pReorderEntry->SeqNum, pRxTs->RxIndicateSeq) ) + { + list_del_init(&pReorderEntry->List); + + if(SN_EQUAL(pReorderEntry->SeqNum, pRxTs->RxIndicateSeq)) + pRxTs->RxIndicateSeq = (pRxTs->RxIndicateSeq + 1) % 4096; + + IEEE80211_DEBUG(IEEE80211_DL_REORDER,"RxPktPendingTimeout(): IndicateSeq: %d\n", pReorderEntry->SeqNum); + stats_IndicateArray[index] = pReorderEntry->prxb; + index++; + + list_add_tail(&pReorderEntry->List, &ieee->RxReorder_Unused_List); + } + else + { + bPktInBuf = true; + break; + } + } + } + + if(index>0) + { + // Set RxTimeoutIndicateSeq to 0xffff to indicate no pending packets in buffer now. + pRxTs->RxTimeoutIndicateSeq = 0xffff; + + // Indicate packets + if(index > REORDER_WIN_SIZE){ + IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): Rx Reorer buffer full!! \n"); + spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); + return; + } + ieee80211_indicate_packets(ieee, stats_IndicateArray, index); + } + + if(bPktInBuf && (pRxTs->RxTimeoutIndicateSeq==0xffff)) + { + pRxTs->RxTimeoutIndicateSeq = pRxTs->RxIndicateSeq; + if(timer_pending(&pRxTs->RxPktPendingTimer)) + del_timer_sync(&pRxTs->RxPktPendingTimer); + pRxTs->RxPktPendingTimer.expires = jiffies + ieee->pHTInfo->RxReorderPendingTime; + add_timer(&pRxTs->RxPktPendingTimer); + } + spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); + //PlatformReleaseSpinLock(Adapter, RT_RX_SPINLOCK); +} +#endif + +/******************************************************************************************************************** + *function: Add BA timer function + * input: unsigned long data //acturally we send TX_TS_RECORD or RX_TS_RECORD to these timer + * return: NULL + * notice: +********************************************************************************************************************/ +void TsAddBaProcess(unsigned long data) +{ + PTX_TS_RECORD pTxTs = (PTX_TS_RECORD)data; + u8 num = pTxTs->num; + struct ieee80211_device *ieee = container_of(pTxTs, struct ieee80211_device, TxTsRecord[num]); + + TsInitAddBA(ieee, pTxTs, BA_POLICY_IMMEDIATE, false); + IEEE80211_DEBUG(IEEE80211_DL_BA, "TsAddBaProcess(): ADDBA Req is started!! \n"); +} + + +void ResetTsCommonInfo(PTS_COMMON_INFO pTsCommonInfo) +{ + memset(pTsCommonInfo->Addr, 0, 6); + memset(&pTsCommonInfo->TSpec, 0, sizeof(TSPEC_BODY)); + memset(&pTsCommonInfo->TClass, 0, sizeof(QOS_TCLAS)*TCLAS_NUM); + pTsCommonInfo->TClasProc = 0; + pTsCommonInfo->TClasNum = 0; +} + +void ResetTxTsEntry(PTX_TS_RECORD pTS) +{ + ResetTsCommonInfo(&pTS->TsCommonInfo); + pTS->TxCurSeq = 0; + pTS->bAddBaReqInProgress = false; + pTS->bAddBaReqDelayed = false; + pTS->bUsingBa = false; + ResetBaEntry(&pTS->TxAdmittedBARecord); //For BA Originator + ResetBaEntry(&pTS->TxPendingBARecord); +} + +void ResetRxTsEntry(PRX_TS_RECORD pTS) +{ + ResetTsCommonInfo(&pTS->TsCommonInfo); + pTS->RxIndicateSeq = 0xffff; // This indicate the RxIndicateSeq is not used now!! + pTS->RxTimeoutIndicateSeq = 0xffff; // This indicate the RxTimeoutIndicateSeq is not used now!! + ResetBaEntry(&pTS->RxAdmittedBARecord); // For BA Recepient +} + +void TSInitialize(struct ieee80211_device *ieee) +{ + PTX_TS_RECORD pTxTS = ieee->TxTsRecord; + PRX_TS_RECORD pRxTS = ieee->RxTsRecord; + PRX_REORDER_ENTRY pRxReorderEntry = ieee->RxReorderEntry; + u8 count = 0; + IEEE80211_DEBUG(IEEE80211_DL_TS, "==========>%s()\n", __FUNCTION__); + // Initialize Tx TS related info. + INIT_LIST_HEAD(&ieee->Tx_TS_Admit_List); + INIT_LIST_HEAD(&ieee->Tx_TS_Pending_List); + INIT_LIST_HEAD(&ieee->Tx_TS_Unused_List); + + for(count = 0; count < TOTAL_TS_NUM; count++) + { + // + pTxTS->num = count; + // The timers for the operation of Traffic Stream and Block Ack. + // DLS related timer will be add here in the future!! + init_timer(&pTxTS->TsCommonInfo.SetupTimer); + pTxTS->TsCommonInfo.SetupTimer.data = (unsigned long)pTxTS; + pTxTS->TsCommonInfo.SetupTimer.function = TsSetupTimeOut; + + init_timer(&pTxTS->TsCommonInfo.InactTimer); + pTxTS->TsCommonInfo.InactTimer.data = (unsigned long)pTxTS; + pTxTS->TsCommonInfo.InactTimer.function = TsInactTimeout; + + init_timer(&pTxTS->TsAddBaTimer); + pTxTS->TsAddBaTimer.data = (unsigned long)pTxTS; + pTxTS->TsAddBaTimer.function = TsAddBaProcess; + + init_timer(&pTxTS->TxPendingBARecord.Timer); + pTxTS->TxPendingBARecord.Timer.data = (unsigned long)pTxTS; + pTxTS->TxPendingBARecord.Timer.function = BaSetupTimeOut; + + init_timer(&pTxTS->TxAdmittedBARecord.Timer); + pTxTS->TxAdmittedBARecord.Timer.data = (unsigned long)pTxTS; + pTxTS->TxAdmittedBARecord.Timer.function = TxBaInactTimeout; + + ResetTxTsEntry(pTxTS); + list_add_tail(&pTxTS->TsCommonInfo.List, &ieee->Tx_TS_Unused_List); + pTxTS++; + } + + // Initialize Rx TS related info. + INIT_LIST_HEAD(&ieee->Rx_TS_Admit_List); + INIT_LIST_HEAD(&ieee->Rx_TS_Pending_List); + INIT_LIST_HEAD(&ieee->Rx_TS_Unused_List); + for(count = 0; count < TOTAL_TS_NUM; count++) + { + pRxTS->num = count; + INIT_LIST_HEAD(&pRxTS->RxPendingPktList); + + init_timer(&pRxTS->TsCommonInfo.SetupTimer); + pRxTS->TsCommonInfo.SetupTimer.data = (unsigned long)pRxTS; + pRxTS->TsCommonInfo.SetupTimer.function = TsSetupTimeOut; + + init_timer(&pRxTS->TsCommonInfo.InactTimer); + pRxTS->TsCommonInfo.InactTimer.data = (unsigned long)pRxTS; + pRxTS->TsCommonInfo.InactTimer.function = TsInactTimeout; + + init_timer(&pRxTS->RxAdmittedBARecord.Timer); + pRxTS->RxAdmittedBARecord.Timer.data = (unsigned long)pRxTS; + pRxTS->RxAdmittedBARecord.Timer.function = RxBaInactTimeout; + + init_timer(&pRxTS->RxPktPendingTimer); + pRxTS->RxPktPendingTimer.data = (unsigned long)pRxTS; + pRxTS->RxPktPendingTimer.function = RxPktPendingTimeout; + + ResetRxTsEntry(pRxTS); + list_add_tail(&pRxTS->TsCommonInfo.List, &ieee->Rx_TS_Unused_List); + pRxTS++; + } + // Initialize unused Rx Reorder List. + INIT_LIST_HEAD(&ieee->RxReorder_Unused_List); +//#ifdef TO_DO_LIST + for(count = 0; count < REORDER_ENTRY_NUM; count++) + { + list_add_tail( &pRxReorderEntry->List,&ieee->RxReorder_Unused_List); + if(count == (REORDER_ENTRY_NUM-1)) + break; + pRxReorderEntry = &ieee->RxReorderEntry[count+1]; + } +//#endif + +} + +void AdmitTS(struct ieee80211_device *ieee, PTS_COMMON_INFO pTsCommonInfo, u32 InactTime) +{ + del_timer_sync(&pTsCommonInfo->SetupTimer); + del_timer_sync(&pTsCommonInfo->InactTimer); + + if(InactTime!=0) + mod_timer(&pTsCommonInfo->InactTimer, jiffies + MSECS(InactTime)); +} + + +PTS_COMMON_INFO SearchAdmitTRStream(struct ieee80211_device *ieee, u8* Addr, u8 TID, TR_SELECT TxRxSelect) +{ + //DIRECTION_VALUE dir; + u8 dir; + bool search_dir[4] = {0, 0, 0, 0}; + struct list_head* psearch_list; //FIXME + PTS_COMMON_INFO pRet = NULL; + if(ieee->iw_mode == IW_MODE_MASTER) //ap mode + { + if(TxRxSelect == TX_DIR) + { + search_dir[DIR_DOWN] = true; + search_dir[DIR_BI_DIR]= true; + } + else + { + search_dir[DIR_UP] = true; + search_dir[DIR_BI_DIR]= true; + } + } + else if(ieee->iw_mode == IW_MODE_ADHOC) + { + if(TxRxSelect == TX_DIR) + search_dir[DIR_UP] = true; + else + search_dir[DIR_DOWN] = true; + } + else + { + if(TxRxSelect == TX_DIR) + { + search_dir[DIR_UP] = true; + search_dir[DIR_BI_DIR]= true; + search_dir[DIR_DIRECT]= true; + } + else + { + search_dir[DIR_DOWN] = true; + search_dir[DIR_BI_DIR]= true; + search_dir[DIR_DIRECT]= true; + } + } + + if(TxRxSelect == TX_DIR) + psearch_list = &ieee->Tx_TS_Admit_List; + else + psearch_list = &ieee->Rx_TS_Admit_List; + + //for(dir = DIR_UP; dir <= DIR_BI_DIR; dir++) + for(dir = 0; dir <= DIR_BI_DIR; dir++) + { + if(search_dir[dir] ==false ) + continue; + list_for_each_entry(pRet, psearch_list, List){ + // IEEE80211_DEBUG(IEEE80211_DL_TS, "ADD:"MAC_FMT", TID:%d, dir:%d\n", MAC_ARG(pRet->Addr), pRet->TSpec.f.TSInfo.field.ucTSID, pRet->TSpec.f.TSInfo.field.ucDirection); + if (memcmp(pRet->Addr, Addr, 6) == 0) + if (pRet->TSpec.f.TSInfo.field.ucTSID == TID) + if(pRet->TSpec.f.TSInfo.field.ucDirection == dir) + { + // printk("Bingo! got it\n"); + break; + } + + } + if(&pRet->List != psearch_list) + break; + } + + if(&pRet->List != psearch_list){ + return pRet ; + } + else + return NULL; +} + +void MakeTSEntry( + PTS_COMMON_INFO pTsCommonInfo, + u8* Addr, + PTSPEC_BODY pTSPEC, + PQOS_TCLAS pTCLAS, + u8 TCLAS_Num, + u8 TCLAS_Proc + ) +{ + u8 count; + + if(pTsCommonInfo == NULL) + return; + + memcpy(pTsCommonInfo->Addr, Addr, 6); + + if(pTSPEC != NULL) + memcpy((u8*)(&(pTsCommonInfo->TSpec)), (u8*)pTSPEC, sizeof(TSPEC_BODY)); + + for(count = 0; count < TCLAS_Num; count++) + memcpy((u8*)(&(pTsCommonInfo->TClass[count])), (u8*)pTCLAS, sizeof(QOS_TCLAS)); + + pTsCommonInfo->TClasProc = TCLAS_Proc; + pTsCommonInfo->TClasNum = TCLAS_Num; +} + + +bool GetTs( + struct ieee80211_device* ieee, + PTS_COMMON_INFO *ppTS, + u8* Addr, + u8 TID, + TR_SELECT TxRxSelect, //Rx:1, Tx:0 + bool bAddNewTs + ) +{ + u8 UP = 0; + // + // We do not build any TS for Broadcast or Multicast stream. + // So reject these kinds of search here. + // + if(is_broadcast_ether_addr(Addr) || is_multicast_ether_addr(Addr)) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "get TS for Broadcast or Multicast\n"); + return false; + } +#if 0 + if(ieee->pStaQos->CurrentQosMode == QOS_DISABLE) + { UP = 0; } //only use one TS + else if(ieee->pStaQos->CurrentQosMode & QOS_WMM) + { +#else + if (ieee->current_network.qos_data.supported == 0) + UP = 0; + else + { +#endif + // In WMM case: we use 4 TID only + if (!IsACValid(TID)) + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, " in %s(), TID(%d) is not valid\n", __FUNCTION__, TID); + return false; + } + + switch(TID) + { + case 0: + case 3: + UP = 0; + break; + + case 1: + case 2: + UP = 2; + break; + + case 4: + case 5: + UP = 5; + break; + + case 6: + case 7: + UP = 7; + break; + } + } + + *ppTS = SearchAdmitTRStream( + ieee, + Addr, + UP, + TxRxSelect); + if(*ppTS != NULL) + { + return true; + } + else + { + if(bAddNewTs == false) + { + IEEE80211_DEBUG(IEEE80211_DL_TS, "add new TS failed(tid:%d)\n", UP); + return false; + } + else + { + // + // Create a new Traffic stream for current Tx/Rx + // This is for EDCA and WMM to add a new TS. + // For HCCA or WMMSA, TS cannot be addmit without negotiation. + // + TSPEC_BODY TSpec; + PQOS_TSINFO pTSInfo = &TSpec.f.TSInfo; + struct list_head* pUnusedList = + (TxRxSelect == TX_DIR)? + (&ieee->Tx_TS_Unused_List): + (&ieee->Rx_TS_Unused_List); + + struct list_head* pAddmitList = + (TxRxSelect == TX_DIR)? + (&ieee->Tx_TS_Admit_List): + (&ieee->Rx_TS_Admit_List); + + DIRECTION_VALUE Dir = (ieee->iw_mode == IW_MODE_MASTER)? + ((TxRxSelect==TX_DIR)?DIR_DOWN:DIR_UP): + ((TxRxSelect==TX_DIR)?DIR_UP:DIR_DOWN); + IEEE80211_DEBUG(IEEE80211_DL_TS, "to add Ts\n"); + if(!list_empty(pUnusedList)) + { + (*ppTS) = list_entry(pUnusedList->next, TS_COMMON_INFO, List); + list_del_init(&(*ppTS)->List); + if(TxRxSelect==TX_DIR) + { + PTX_TS_RECORD tmp = container_of(*ppTS, TX_TS_RECORD, TsCommonInfo); + ResetTxTsEntry(tmp); + } + else{ + PRX_TS_RECORD tmp = container_of(*ppTS, RX_TS_RECORD, TsCommonInfo); + ResetRxTsEntry(tmp); + } + + IEEE80211_DEBUG(IEEE80211_DL_TS, "to init current TS, UP:%d, Dir:%d, addr:"MAC_FMT"\n", UP, Dir, MAC_ARG(Addr)); + // Prepare TS Info releated field + pTSInfo->field.ucTrafficType = 0; // Traffic type: WMM is reserved in this field + pTSInfo->field.ucTSID = UP; // TSID + pTSInfo->field.ucDirection = Dir; // Direction: if there is DirectLink, this need additional consideration. + pTSInfo->field.ucAccessPolicy = 1; // Access policy + pTSInfo->field.ucAggregation = 0; // Aggregation + pTSInfo->field.ucPSB = 0; // Aggregation + pTSInfo->field.ucUP = UP; // User priority + pTSInfo->field.ucTSInfoAckPolicy = 0; // Ack policy + pTSInfo->field.ucSchedule = 0; // Schedule + + MakeTSEntry(*ppTS, Addr, &TSpec, NULL, 0, 0); + AdmitTS(ieee, *ppTS, 0); + list_add_tail(&((*ppTS)->List), pAddmitList); + // if there is DirectLink, we need to do additional operation here!! + + return true; + } + else + { + IEEE80211_DEBUG(IEEE80211_DL_ERR, "in function %s() There is not enough TS record to be used!!", __FUNCTION__); + return false; + } + } + } +} + +void RemoveTsEntry( + struct ieee80211_device* ieee, + PTS_COMMON_INFO pTs, + TR_SELECT TxRxSelect + ) +{ + //u32 flags = 0; + unsigned long flags = 0; + del_timer_sync(&pTs->SetupTimer); + del_timer_sync(&pTs->InactTimer); + TsInitDelBA(ieee, pTs, TxRxSelect); + + if(TxRxSelect == RX_DIR) + { +//#ifdef TO_DO_LIST + PRX_REORDER_ENTRY pRxReorderEntry; + PRX_TS_RECORD pRxTS = (PRX_TS_RECORD)pTs; + if(timer_pending(&pRxTS->RxPktPendingTimer)) + del_timer_sync(&pRxTS->RxPktPendingTimer); + + while(!list_empty(&pRxTS->RxPendingPktList)) + { + // PlatformAcquireSpinLock(Adapter, RT_RX_SPINLOCK); + spin_lock_irqsave(&(ieee->reorder_spinlock), flags); + //pRxReorderEntry = list_entry(&pRxTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List); + pRxReorderEntry = (PRX_REORDER_ENTRY)list_entry(pRxTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List); + list_del_init(&pRxReorderEntry->List); + { + int i = 0; + struct ieee80211_rxb * prxb = pRxReorderEntry->prxb; + if (unlikely(!prxb)) + { + spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); + return; + } + for(i =0; i < prxb->nr_subframes; i++) { + dev_kfree_skb(prxb->subframes[i]); + } + kfree(prxb); + prxb = NULL; + } + list_add_tail(&pRxReorderEntry->List,&ieee->RxReorder_Unused_List); + //PlatformReleaseSpinLock(Adapter, RT_RX_SPINLOCK); + spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); + } + +//#endif + } + else + { + PTX_TS_RECORD pTxTS = (PTX_TS_RECORD)pTs; + del_timer_sync(&pTxTS->TsAddBaTimer); + } +} + +void RemovePeerTS(struct ieee80211_device* ieee, u8* Addr) +{ + PTS_COMMON_INFO pTS, pTmpTS; + printk("===========>RemovePeerTS,"MAC_FMT"\n", MAC_ARG(Addr)); +#if 1 + list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Pending_List, List) + { + if (memcmp(pTS->Addr, Addr, 6) == 0) + { + RemoveTsEntry(ieee, pTS, TX_DIR); + list_del_init(&pTS->List); + list_add_tail(&pTS->List, &ieee->Tx_TS_Unused_List); + } + } + + list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Admit_List, List) + { + if (memcmp(pTS->Addr, Addr, 6) == 0) + { + printk("====>remove Tx_TS_admin_list\n"); + RemoveTsEntry(ieee, pTS, TX_DIR); + list_del_init(&pTS->List); + list_add_tail(&pTS->List, &ieee->Tx_TS_Unused_List); + } + } + + list_for_each_entry_safe(pTS, pTmpTS, &ieee->Rx_TS_Pending_List, List) + { + if (memcmp(pTS->Addr, Addr, 6) == 0) + { + RemoveTsEntry(ieee, pTS, RX_DIR); + list_del_init(&pTS->List); + list_add_tail(&pTS->List, &ieee->Rx_TS_Unused_List); + } + } + + list_for_each_entry_safe(pTS, pTmpTS, &ieee->Rx_TS_Admit_List, List) + { + if (memcmp(pTS->Addr, Addr, 6) == 0) + { + RemoveTsEntry(ieee, pTS, RX_DIR); + list_del_init(&pTS->List); + list_add_tail(&pTS->List, &ieee->Rx_TS_Unused_List); + } + } +#endif +} + +void RemoveAllTS(struct ieee80211_device* ieee) +{ + PTS_COMMON_INFO pTS, pTmpTS; +#if 1 + list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Pending_List, List) + { + RemoveTsEntry(ieee, pTS, TX_DIR); + list_del_init(&pTS->List); + list_add_tail(&pTS->List, &ieee->Tx_TS_Unused_List); + } + + list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Admit_List, List) + { + RemoveTsEntry(ieee, pTS, TX_DIR); + list_del_init(&pTS->List); + list_add_tail(&pTS->List, &ieee->Tx_TS_Unused_List); + } + + list_for_each_entry_safe(pTS, pTmpTS, &ieee->Rx_TS_Pending_List, List) + { + RemoveTsEntry(ieee, pTS, RX_DIR); + list_del_init(&pTS->List); + list_add_tail(&pTS->List, &ieee->Rx_TS_Unused_List); + } + + list_for_each_entry_safe(pTS, pTmpTS, &ieee->Rx_TS_Admit_List, List) + { + RemoveTsEntry(ieee, pTS, RX_DIR); + list_del_init(&pTS->List); + list_add_tail(&pTS->List, &ieee->Rx_TS_Unused_List); + } +#endif +} + +void TsStartAddBaProcess(struct ieee80211_device* ieee, PTX_TS_RECORD pTxTS) +{ + if(pTxTS->bAddBaReqInProgress == false) + { + pTxTS->bAddBaReqInProgress = true; +#if 1 + if(pTxTS->bAddBaReqDelayed) + { + IEEE80211_DEBUG(IEEE80211_DL_BA, "TsStartAddBaProcess(): Delayed Start ADDBA after 60 sec!!\n"); + mod_timer(&pTxTS->TsAddBaTimer, jiffies + MSECS(TS_ADDBA_DELAY)); + } + else + { + IEEE80211_DEBUG(IEEE80211_DL_BA,"TsStartAddBaProcess(): Immediately Start ADDBA now!!\n"); + mod_timer(&pTxTS->TsAddBaTimer, jiffies+10); //set 10 ticks + } +#endif + } + else + IEEE80211_DEBUG(IEEE80211_DL_ERR, "%s()==>BA timer is already added\n", __FUNCTION__); +} +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +EXPORT_SYMBOL_NOVERS(RemovePeerTS); +#else +EXPORT_SYMBOL(RemovePeerTS); +#endif diff --git a/drivers/staging/rtl8192u/ieee80211/rtl_crypto.h b/drivers/staging/rtl8192u/ieee80211/rtl_crypto.h new file mode 100644 index 000000000000..ccf6ae763572 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/rtl_crypto.h @@ -0,0 +1,399 @@ +/* + * Scatterlist Cryptographic API. + * + * Copyright (c) 2002 James Morris + * Copyright (c) 2002 David S. Miller (davem@redhat.com) + * + * Portions derived from Cryptoapi, by Alexander Kjeldaas + * and Nettle, by Niels Mé°ˆler. + * + * 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. + * + */ +#ifndef _LINUX_CRYPTO_H +#define _LINUX_CRYPTO_H + +#include +#include +#include +#include +#include +#include +#include + +#define crypto_register_alg crypto_register_alg_rsl +#define crypto_unregister_alg crypto_unregister_alg_rsl +#define crypto_alloc_tfm crypto_alloc_tfm_rsl +#define crypto_free_tfm crypto_free_tfm_rsl +#define crypto_alg_available crypto_alg_available_rsl + +/* + * Algorithm masks and types. + */ +#define CRYPTO_ALG_TYPE_MASK 0x000000ff +#define CRYPTO_ALG_TYPE_CIPHER 0x00000001 +#define CRYPTO_ALG_TYPE_DIGEST 0x00000002 +#define CRYPTO_ALG_TYPE_COMPRESS 0x00000004 + +/* + * Transform masks and values (for crt_flags). + */ +#define CRYPTO_TFM_MODE_MASK 0x000000ff +#define CRYPTO_TFM_REQ_MASK 0x000fff00 +#define CRYPTO_TFM_RES_MASK 0xfff00000 + +#define CRYPTO_TFM_MODE_ECB 0x00000001 +#define CRYPTO_TFM_MODE_CBC 0x00000002 +#define CRYPTO_TFM_MODE_CFB 0x00000004 +#define CRYPTO_TFM_MODE_CTR 0x00000008 + +#define CRYPTO_TFM_REQ_WEAK_KEY 0x00000100 +#define CRYPTO_TFM_RES_WEAK_KEY 0x00100000 +#define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000 +#define CRYPTO_TFM_RES_BAD_KEY_SCHED 0x00400000 +#define CRYPTO_TFM_RES_BAD_BLOCK_LEN 0x00800000 +#define CRYPTO_TFM_RES_BAD_FLAGS 0x01000000 + +/* + * Miscellaneous stuff. + */ +#define CRYPTO_UNSPEC 0 +#define CRYPTO_MAX_ALG_NAME 64 + +struct scatterlist; + +/* + * Algorithms: modular crypto algorithm implementations, managed + * via crypto_register_alg() and crypto_unregister_alg(). + */ +struct cipher_alg { + unsigned int cia_min_keysize; + unsigned int cia_max_keysize; + int (*cia_setkey)(void *ctx, const u8 *key, + unsigned int keylen, u32 *flags); + void (*cia_encrypt)(void *ctx, u8 *dst, const u8 *src); + void (*cia_decrypt)(void *ctx, u8 *dst, const u8 *src); +}; + +struct digest_alg { + unsigned int dia_digestsize; + void (*dia_init)(void *ctx); + void (*dia_update)(void *ctx, const u8 *data, unsigned int len); + void (*dia_final)(void *ctx, u8 *out); + int (*dia_setkey)(void *ctx, const u8 *key, + unsigned int keylen, u32 *flags); +}; + +struct compress_alg { + int (*coa_init)(void *ctx); + void (*coa_exit)(void *ctx); + int (*coa_compress)(void *ctx, const u8 *src, unsigned int slen, + u8 *dst, unsigned int *dlen); + int (*coa_decompress)(void *ctx, const u8 *src, unsigned int slen, + u8 *dst, unsigned int *dlen); +}; + +#define cra_cipher cra_u.cipher +#define cra_digest cra_u.digest +#define cra_compress cra_u.compress + +struct crypto_alg { + struct list_head cra_list; + u32 cra_flags; + unsigned int cra_blocksize; + unsigned int cra_ctxsize; + const char cra_name[CRYPTO_MAX_ALG_NAME]; + + union { + struct cipher_alg cipher; + struct digest_alg digest; + struct compress_alg compress; + } cra_u; + + struct module *cra_module; +}; + +/* + * Algorithm registration interface. + */ +int crypto_register_alg(struct crypto_alg *alg); +int crypto_unregister_alg(struct crypto_alg *alg); + +/* + * Algorithm query interface. + */ +int crypto_alg_available(const char *name, u32 flags); + +/* + * Transforms: user-instantiated objects which encapsulate algorithms + * and core processing logic. Managed via crypto_alloc_tfm() and + * crypto_free_tfm(), as well as the various helpers below. + */ +struct crypto_tfm; + +struct cipher_tfm { + void *cit_iv; + unsigned int cit_ivsize; + u32 cit_mode; + int (*cit_setkey)(struct crypto_tfm *tfm, + const u8 *key, unsigned int keylen); + int (*cit_encrypt)(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes); + int (*cit_encrypt_iv)(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes, u8 *iv); + int (*cit_decrypt)(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes); + int (*cit_decrypt_iv)(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes, u8 *iv); + void (*cit_xor_block)(u8 *dst, const u8 *src); +}; + +struct digest_tfm { + void (*dit_init)(struct crypto_tfm *tfm); + void (*dit_update)(struct crypto_tfm *tfm, + struct scatterlist *sg, unsigned int nsg); + void (*dit_final)(struct crypto_tfm *tfm, u8 *out); + void (*dit_digest)(struct crypto_tfm *tfm, struct scatterlist *sg, + unsigned int nsg, u8 *out); + int (*dit_setkey)(struct crypto_tfm *tfm, + const u8 *key, unsigned int keylen); +#ifdef CONFIG_CRYPTO_HMAC + void *dit_hmac_block; +#endif +}; + +struct compress_tfm { + int (*cot_compress)(struct crypto_tfm *tfm, + const u8 *src, unsigned int slen, + u8 *dst, unsigned int *dlen); + int (*cot_decompress)(struct crypto_tfm *tfm, + const u8 *src, unsigned int slen, + u8 *dst, unsigned int *dlen); +}; + +#define crt_cipher crt_u.cipher +#define crt_digest crt_u.digest +#define crt_compress crt_u.compress + +struct crypto_tfm { + + u32 crt_flags; + + union { + struct cipher_tfm cipher; + struct digest_tfm digest; + struct compress_tfm compress; + } crt_u; + + struct crypto_alg *__crt_alg; +}; + +/* + * Transform user interface. + */ + +/* + * crypto_alloc_tfm() will first attempt to locate an already loaded algorithm. + * If that fails and the kernel supports dynamically loadable modules, it + * will then attempt to load a module of the same name or alias. A refcount + * is grabbed on the algorithm which is then associated with the new transform. + * + * crypto_free_tfm() frees up the transform and any associated resources, + * then drops the refcount on the associated algorithm. + */ +struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags); +void crypto_free_tfm(struct crypto_tfm *tfm); + +/* + * Transform helpers which query the underlying algorithm. + */ +static inline const char *crypto_tfm_alg_name(struct crypto_tfm *tfm) +{ + return tfm->__crt_alg->cra_name; +} + +static inline const char *crypto_tfm_alg_modname(struct crypto_tfm *tfm) +{ + struct crypto_alg *alg = tfm->__crt_alg; + + if (alg->cra_module) + return alg->cra_module->name; + else + return NULL; +} + +static inline u32 crypto_tfm_alg_type(struct crypto_tfm *tfm) +{ + return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK; +} + +static inline unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); + return tfm->__crt_alg->cra_cipher.cia_min_keysize; +} + +static inline unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); + return tfm->__crt_alg->cra_cipher.cia_max_keysize; +} + +static inline unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); + return tfm->crt_cipher.cit_ivsize; +} + +static inline unsigned int crypto_tfm_alg_blocksize(struct crypto_tfm *tfm) +{ + return tfm->__crt_alg->cra_blocksize; +} + +static inline unsigned int crypto_tfm_alg_digestsize(struct crypto_tfm *tfm) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); + return tfm->__crt_alg->cra_digest.dia_digestsize; +} + +/* + * API wrappers. + */ +static inline void crypto_digest_init(struct crypto_tfm *tfm) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); + tfm->crt_digest.dit_init(tfm); +} + +static inline void crypto_digest_update(struct crypto_tfm *tfm, + struct scatterlist *sg, + unsigned int nsg) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); + tfm->crt_digest.dit_update(tfm, sg, nsg); +} + +static inline void crypto_digest_final(struct crypto_tfm *tfm, u8 *out) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); + tfm->crt_digest.dit_final(tfm, out); +} + +static inline void crypto_digest_digest(struct crypto_tfm *tfm, + struct scatterlist *sg, + unsigned int nsg, u8 *out) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); + tfm->crt_digest.dit_digest(tfm, sg, nsg, out); +} + +static inline int crypto_digest_setkey(struct crypto_tfm *tfm, + const u8 *key, unsigned int keylen) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); + if (tfm->crt_digest.dit_setkey == NULL) + return -ENOSYS; + return tfm->crt_digest.dit_setkey(tfm, key, keylen); +} + +static inline int crypto_cipher_setkey(struct crypto_tfm *tfm, + const u8 *key, unsigned int keylen) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); + return tfm->crt_cipher.cit_setkey(tfm, key, keylen); +} + +static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); + return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes); +} + +static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes, u8 *iv) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); + BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB); + return tfm->crt_cipher.cit_encrypt_iv(tfm, dst, src, nbytes, iv); +} + +static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); + return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes); +} + +static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes, u8 *iv) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); + BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB); + return tfm->crt_cipher.cit_decrypt_iv(tfm, dst, src, nbytes, iv); +} + +static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm, + const u8 *src, unsigned int len) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); + memcpy(tfm->crt_cipher.cit_iv, src, len); +} + +static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm, + u8 *dst, unsigned int len) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); + memcpy(dst, tfm->crt_cipher.cit_iv, len); +} + +static inline int crypto_comp_compress(struct crypto_tfm *tfm, + const u8 *src, unsigned int slen, + u8 *dst, unsigned int *dlen) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_COMPRESS); + return tfm->crt_compress.cot_compress(tfm, src, slen, dst, dlen); +} + +static inline int crypto_comp_decompress(struct crypto_tfm *tfm, + const u8 *src, unsigned int slen, + u8 *dst, unsigned int *dlen) +{ + BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_COMPRESS); + return tfm->crt_compress.cot_decompress(tfm, src, slen, dst, dlen); +} + +/* + * HMAC support. + */ +#ifdef CONFIG_CRYPTO_HMAC +void crypto_hmac_init(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen); +void crypto_hmac_update(struct crypto_tfm *tfm, + struct scatterlist *sg, unsigned int nsg); +void crypto_hmac_final(struct crypto_tfm *tfm, u8 *key, + unsigned int *keylen, u8 *out); +void crypto_hmac(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen, + struct scatterlist *sg, unsigned int nsg, u8 *out); +#endif /* CONFIG_CRYPTO_HMAC */ + +#endif /* _LINUX_CRYPTO_H */ + diff --git a/drivers/staging/rtl8192u/ieee80211/scatterwalk.c b/drivers/staging/rtl8192u/ieee80211/scatterwalk.c new file mode 100644 index 000000000000..49f401fbce88 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/scatterwalk.c @@ -0,0 +1,126 @@ +/* + * Cryptographic API. + * + * Cipher operations. + * + * Copyright (c) 2002 James Morris + * 2002 Adam J. Richter + * 2004 Jean-Luc Cooke + * + * 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. + * + */ +#include "kmap_types.h" + +#include +#include +#include +#include +#include +#include "internal.h" +#include "scatterwalk.h" + +enum km_type crypto_km_types[] = { + KM_USER0, + KM_USER1, + KM_SOFTIRQ0, + KM_SOFTIRQ1, +}; + +void *scatterwalk_whichbuf(struct scatter_walk *walk, unsigned int nbytes, void *scratch) +{ + if (nbytes <= walk->len_this_page && + (((unsigned long)walk->data) & (PAGE_CACHE_SIZE - 1)) + nbytes <= + PAGE_CACHE_SIZE) + return walk->data; + else + return scratch; +} + +static void memcpy_dir(void *buf, void *sgdata, size_t nbytes, int out) +{ + if (out) + memcpy(sgdata, buf, nbytes); + else + memcpy(buf, sgdata, nbytes); +} + +void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg) +{ + unsigned int rest_of_page; + + walk->sg = sg; + + walk->page = sg->page; + walk->len_this_segment = sg->length; + + rest_of_page = PAGE_CACHE_SIZE - (sg->offset & (PAGE_CACHE_SIZE - 1)); + walk->len_this_page = min(sg->length, rest_of_page); + walk->offset = sg->offset; +} + +void scatterwalk_map(struct scatter_walk *walk, int out) +{ + walk->data = crypto_kmap(walk->page, out) + walk->offset; +} + +static void scatterwalk_pagedone(struct scatter_walk *walk, int out, + unsigned int more) +{ + /* walk->data may be pointing the first byte of the next page; + however, we know we transfered at least one byte. So, + walk->data - 1 will be a virtual address in the mapped page. */ + + if (out) + flush_dcache_page(walk->page); + + if (more) { + walk->len_this_segment -= walk->len_this_page; + + if (walk->len_this_segment) { + walk->page++; + walk->len_this_page = min(walk->len_this_segment, + (unsigned)PAGE_CACHE_SIZE); + walk->offset = 0; + } + else + scatterwalk_start(walk, sg_next(walk->sg)); + } +} + +void scatterwalk_done(struct scatter_walk *walk, int out, int more) +{ + crypto_kunmap(walk->data, out); + if (walk->len_this_page == 0 || !more) + scatterwalk_pagedone(walk, out, more); +} + +/* + * Do not call this unless the total length of all of the fragments + * has been verified as multiple of the block size. + */ +int scatterwalk_copychunks(void *buf, struct scatter_walk *walk, + size_t nbytes, int out) +{ + if (buf != walk->data) { + while (nbytes > walk->len_this_page) { + memcpy_dir(buf, walk->data, walk->len_this_page, out); + buf += walk->len_this_page; + nbytes -= walk->len_this_page; + + crypto_kunmap(walk->data, out); + scatterwalk_pagedone(walk, out, 1); + scatterwalk_map(walk, out); + } + + memcpy_dir(buf, walk->data, nbytes, out); + } + + walk->offset += nbytes; + walk->len_this_page -= nbytes; + walk->len_this_segment -= nbytes; + return 0; +} diff --git a/drivers/staging/rtl8192u/ieee80211/scatterwalk.h b/drivers/staging/rtl8192u/ieee80211/scatterwalk.h new file mode 100644 index 000000000000..b16446519017 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211/scatterwalk.h @@ -0,0 +1,51 @@ +/* + * Cryptographic API. + * + * Copyright (c) 2002 James Morris + * Copyright (c) 2002 Adam J. Richter + * Copyright (c) 2004 Jean-Luc Cooke + * + * 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. + * + */ + +#ifndef _CRYPTO_SCATTERWALK_H +#define _CRYPTO_SCATTERWALK_H +#include +#include + +struct scatter_walk { + struct scatterlist *sg; + struct page *page; + void *data; + unsigned int len_this_page; + unsigned int len_this_segment; + unsigned int offset; +}; + +/* Define sg_next is an inline routine now in case we want to change + scatterlist to a linked list later. */ +static inline struct scatterlist *sg_next(struct scatterlist *sg) +{ + return sg + 1; +} + +static inline int scatterwalk_samebuf(struct scatter_walk *walk_in, + struct scatter_walk *walk_out, + void *src_p, void *dst_p) +{ + return walk_in->page == walk_out->page && + walk_in->offset == walk_out->offset && + walk_in->data == src_p && walk_out->data == dst_p; +} + +void *scatterwalk_whichbuf(struct scatter_walk *walk, unsigned int nbytes, void *scratch); +void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg); +int scatterwalk_copychunks(void *buf, struct scatter_walk *walk, size_t nbytes, int out); +void scatterwalk_map(struct scatter_walk *walk, int out); +void scatterwalk_done(struct scatter_walk *walk, int out, int more); + +#endif /* _CRYPTO_SCATTERWALK_H */ diff --git a/drivers/staging/rtl8192u/ieee80211_crypt.h b/drivers/staging/rtl8192u/ieee80211_crypt.h new file mode 100644 index 000000000000..b58a3bcc0dc0 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211_crypt.h @@ -0,0 +1,86 @@ +/* + * Original code based on Host AP (software wireless LAN access point) driver + * for Intersil Prism2/2.5/3. + * + * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen + * + * Copyright (c) 2002-2003, Jouni Malinen + * + * Adaption to a generic IEEE 802.11 stack by James Ketrenos + * + * + * Copyright (c) 2004, Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. See README and COPYING for + * more details. + */ + +/* + * This file defines the interface to the ieee80211 crypto module. + */ +#ifndef IEEE80211_CRYPT_H +#define IEEE80211_CRYPT_H + +#include + +struct ieee80211_crypto_ops { + const char *name; + + /* init new crypto context (e.g., allocate private data space, + * select IV, etc.); returns NULL on failure or pointer to allocated + * private data on success */ + void * (*init)(int keyidx); + + /* deinitialize crypto context and free allocated private data */ + void (*deinit)(void *priv); + + /* encrypt/decrypt return < 0 on error or >= 0 on success. The return + * value from decrypt_mpdu is passed as the keyidx value for + * decrypt_msdu. skb must have enough head and tail room for the + * encryption; if not, error will be returned; these functions are + * called for all MPDUs (i.e., fragments). + */ + int (*encrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); + int (*decrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); + + /* These functions are called for full MSDUs, i.e. full frames. + * These can be NULL if full MSDU operations are not needed. */ + int (*encrypt_msdu)(struct sk_buff *skb, int hdr_len, void *priv); + int (*decrypt_msdu)(struct sk_buff *skb, int keyidx, int hdr_len, + void *priv); + + int (*set_key)(void *key, int len, u8 *seq, void *priv); + int (*get_key)(void *key, int len, u8 *seq, void *priv); + + /* procfs handler for printing out key information and possible + * statistics */ + char * (*print_stats)(char *p, void *priv); + + /* maximum number of bytes added by encryption; encrypt buf is + * allocated with extra_prefix_len bytes, copy of in_buf, and + * extra_postfix_len; encrypt need not use all this space, but + * the result must start at the beginning of the buffer and correct + * length must be returned */ + int extra_prefix_len, extra_postfix_len; + + struct module *owner; +}; + +struct ieee80211_crypt_data { + struct list_head list; /* delayed deletion list */ + struct ieee80211_crypto_ops *ops; + void *priv; + atomic_t refcnt; +}; + +int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); +int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); +struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name); +void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); +void ieee80211_crypt_deinit_handler(unsigned long); +void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, + struct ieee80211_crypt_data **crypt); + +#endif diff --git a/drivers/staging/rtl8192u/r8180_93cx6.c b/drivers/staging/rtl8192u/r8180_93cx6.c new file mode 100644 index 000000000000..8878cfeb0fbb --- /dev/null +++ b/drivers/staging/rtl8192u/r8180_93cx6.c @@ -0,0 +1,146 @@ +/* + This files contains card eeprom (93c46 or 93c56) programming routines, + memory is addressed by 16 bits words. + + This is part of rtl8180 OpenSource driver. + Copyright (C) Andrea Merello 2004 + Released under the terms of GPL (General Public Licence) + + Parts of this driver are based on the GPL part of the + official realtek driver. + + Parts of this driver are based on the rtl8180 driver skeleton + from Patric Schenke & Andres Salomon. + + Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver. + + We want to tanks the Authors of those projects and the Ndiswrapper + project Authors. +*/ + +#include "r8180_93cx6.h" + +void eprom_cs(struct net_device *dev, short bit) +{ + if(bit) + write_nic_byte_E(dev, EPROM_CMD, + (1<epromtype==EPROM_93c56){ + addr_str[7]=addr & 1; + addr_str[6]=addr & (1<<1); + addr_str[5]=addr & (1<<2); + addr_str[4]=addr & (1<<3); + addr_str[3]=addr & (1<<4); + addr_str[2]=addr & (1<<5); + addr_str[1]=addr & (1<<6); + addr_str[0]=addr & (1<<7); + addr_len=8; + }else{ + addr_str[5]=addr & 1; + addr_str[4]=addr & (1<<1); + addr_str[3]=addr & (1<<2); + addr_str[2]=addr & (1<<3); + addr_str[1]=addr & (1<<4); + addr_str[0]=addr & (1<<5); + addr_len=6; + } + eprom_cs(dev, 1); + eprom_ck_cycle(dev); + eprom_send_bits_string(dev, read_cmd, 3); + eprom_send_bits_string(dev, addr_str, addr_len); + + //keep chip pin D to low state while reading. + //I'm unsure if it is necessary, but anyway shouldn't hurt + eprom_w(dev, 0); + + for(i=0;i<16;i++){ + //eeprom needs a clk cycle between writing opcode&adr + //and reading data. (eeprom outs a dummy 0) + eprom_ck_cycle(dev); + ret |= (eprom_r(dev)<<(15-i)); + } + + eprom_cs(dev, 0); + eprom_ck_cycle(dev); + + //disable EPROM programming + write_nic_byte_E(dev, EPROM_CMD, + (EPROM_CMD_NORMAL< + Released under the terms of GPL (General Public Licence) + + Parts of this driver are based on the GPL part of the official realtek driver + Parts of this driver are based on the rtl8180 driver skeleton from Patric Schenke & Andres Salomon + Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver + + We want to tanks the Authors of such projects and the Ndiswrapper project Authors. +*/ + +/*This files contains card eeprom (93c46 or 93c56) programming routines*/ +/*memory is addressed by WORDS*/ + +#include "r8192U.h" +#include "r8192U_hw.h" + +#define EPROM_DELAY 10 + +#define EPROM_ANAPARAM_ADDRLWORD 0xd +#define EPROM_ANAPARAM_ADDRHWORD 0xe + +#define EPROM_RFCHIPID 0x6 +#define EPROM_TXPW_BASE 0x05 +#define EPROM_RFCHIPID_RTL8225U 5 +#define EPROM_RF_PARAM 0x4 +#define EPROM_CONFIG2 0xc + +#define EPROM_VERSION 0x1E +#define MAC_ADR 0x7 + +#define CIS 0x18 + +#define EPROM_TXPW0 0x16 +#define EPROM_TXPW2 0x1b +#define EPROM_TXPW1 0x3d + + +u32 eprom_read(struct net_device *dev,u32 addr); //reads a 16 bits word diff --git a/drivers/staging/rtl8192u/r8180_pm.c b/drivers/staging/rtl8192u/r8180_pm.c new file mode 100644 index 000000000000..fdb2eb665197 --- /dev/null +++ b/drivers/staging/rtl8192u/r8180_pm.c @@ -0,0 +1,48 @@ +/* + Power management interface routines. + Written by Mariusz Matuszek. + This code is currently just a placeholder for later work and + does not do anything useful. + + This is part of rtl8180 OpenSource driver. + Copyright (C) Andrea Merello 2004 + Released under the terms of GPL (General Public Licence) +*/ + +#ifdef CONFIG_RTL8180_PM + + +#include "r8180_hw.h" +#include "r8180_pm.h" + +int rtl8180_save_state (struct pci_dev *dev, u32 state) +{ + printk(KERN_NOTICE "r8180 save state call (state %u).\n", state); + return(-EAGAIN); +} + + +int rtl8180_suspend (struct pci_dev *dev, u32 state) +{ + printk(KERN_NOTICE "r8180 suspend call (state %u).\n", state); + return(-EAGAIN); +} + + +int rtl8180_resume (struct pci_dev *dev) +{ + printk(KERN_NOTICE "r8180 resume call.\n"); + return(-EAGAIN); +} + + +int rtl8180_enable_wake (struct pci_dev *dev, u32 state, int enable) +{ + printk(KERN_NOTICE "r8180 enable wake call (state %u, enable %d).\n", + state, enable); + return(-EAGAIN); +} + + + +#endif //CONFIG_RTL8180_PM diff --git a/drivers/staging/rtl8192u/r8180_pm.h b/drivers/staging/rtl8192u/r8180_pm.h new file mode 100644 index 000000000000..c7d18a8b79a1 --- /dev/null +++ b/drivers/staging/rtl8192u/r8180_pm.h @@ -0,0 +1,28 @@ +/* + Power management interface routines. + Written by Mariusz Matuszek. + This code is currently just a placeholder for later work and + does not do anything useful. + + This is part of rtl8180 OpenSource driver. + Copyright (C) Andrea Merello 2004 + Released under the terms of GPL (General Public Licence) + +*/ + +#ifdef CONFIG_RTL8180_PM + +#ifndef R8180_PM_H +#define R8180_PM_H + +#include +#include + +int rtl8180_save_state (struct pci_dev *dev, u32 state); +int rtl8180_suspend (struct pci_dev *dev, u32 state); +int rtl8180_resume (struct pci_dev *dev); +int rtl8180_enable_wake (struct pci_dev *dev, u32 state, int enable); + +#endif //R8180_PM_H + +#endif // CONFIG_RTL8180_PM diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.c b/drivers/staging/rtl8192u/r8190_rtl8256.c new file mode 100644 index 000000000000..74ff337b0583 --- /dev/null +++ b/drivers/staging/rtl8192u/r8190_rtl8256.c @@ -0,0 +1,312 @@ +/* + This is part of the rtl8192 driver + released under the GPL (See file COPYING for details). + + This files contains programming code for the rtl8256 + radio frontend. + + *Many* thanks to Realtek Corp. for their great support! + +*/ + +#include "r8192U.h" +#include "r8192U_hw.h" +#include "r819xU_phyreg.h" +#include "r819xU_phy.h" +#include "r8190_rtl8256.h" + +/*-------------------------------------------------------------------------- + * Overview: set RF band width (20M or 40M) + * Input: struct net_device* dev + * WIRELESS_BANDWIDTH_E Bandwidth //20M or 40M + * Output: NONE + * Return: NONE + * Note: 8226 support both 20M and 40 MHz + *---------------------------------------------------------------------------*/ +void PHY_SetRF8256Bandwidth(struct net_device* dev , HT_CHANNEL_WIDTH Bandwidth) //20M or 40M +{ + u8 eRFPath; + struct r8192_priv *priv = ieee80211_priv(dev); + + //for(eRFPath = RF90_PATH_A; eRFPath NumTotalRFPath; eRFPath++) + for(eRFPath = 0; eRFPath card_8192_version == VERSION_819xU_A || priv->card_8192_version == VERSION_819xU_B)// 8256 D-cut, E-cut, xiong: consider it later! + { + rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x0b, bMask12Bits, 0x100); //phy para:1ba + rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x2c, bMask12Bits, 0x3d7); + rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x0e, bMask12Bits, 0x021); + + //cosa add for sd3's request 01/23/2008 + rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x14, bMask12Bits, 0x5ab); + } + else + { + RT_TRACE(COMP_ERR, "PHY_SetRF8256Bandwidth(): unknown hardware version\n"); + } + + break; + case HT_CHANNEL_WIDTH_20_40: + if(priv->card_8192_version == VERSION_819xU_A ||priv->card_8192_version == VERSION_819xU_B)// 8256 D-cut, E-cut, xiong: consider it later! + { + rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x0b, bMask12Bits, 0x300); //phy para:3ba + rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x2c, bMask12Bits, 0x3df); + rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x0e, bMask12Bits, 0x0a1); + + //cosa add for sd3's request 01/23/2008 + if(priv->chan == 3 || priv->chan == 9) //I need to set priv->chan whenever current channel changes + rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x14, bMask12Bits, 0x59b); + else + rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x14, bMask12Bits, 0x5ab); + } + else + { + RT_TRACE(COMP_ERR, "PHY_SetRF8256Bandwidth(): unknown hardware version\n"); + } + + + break; + default: + RT_TRACE(COMP_ERR, "PHY_SetRF8256Bandwidth(): unknown Bandwidth: %#X\n",Bandwidth ); + break; + + } + } + return; +} +/*-------------------------------------------------------------------------- + * Overview: Interface to config 8256 + * Input: struct net_device* dev + * Output: NONE + * Return: NONE + *---------------------------------------------------------------------------*/ +void PHY_RF8256_Config(struct net_device* dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + // Initialize general global value + // + // TODO: Extend RF_PATH_C and RF_PATH_D in the future + priv->NumTotalRFPath = RTL819X_TOTAL_RF_PATH; + // Config BB and RF + phy_RF8256_Config_ParaFile(dev); + + return; +} +/*-------------------------------------------------------------------------- + * Overview: Interface to config 8256 + * Input: struct net_device* dev + * Output: NONE + * Return: NONE + *---------------------------------------------------------------------------*/ +void phy_RF8256_Config_ParaFile(struct net_device* dev) +{ + u32 u4RegValue = 0; + //static s1Byte szRadioAFile[] = RTL819X_PHY_RADIO_A; + //static s1Byte szRadioBFile[] = RTL819X_PHY_RADIO_B; + //static s1Byte szRadioCFile[] = RTL819X_PHY_RADIO_C; + //static s1Byte szRadioDFile[] = RTL819X_PHY_RADIO_D; + u8 eRFPath; + BB_REGISTER_DEFINITION_T *pPhyReg; + struct r8192_priv *priv = ieee80211_priv(dev); + u32 RegOffSetToBeCheck = 0x3; + u32 RegValueToBeCheck = 0x7f1; + u32 RF3_Final_Value = 0; + u8 ConstRetryTimes = 5, RetryTimes = 5; + u8 ret = 0; + //3//----------------------------------------------------------------- + //3// <2> Initialize RF + //3//----------------------------------------------------------------- + for(eRFPath = (RF90_RADIO_PATH_E)RF90_PATH_A; eRFPath NumTotalRFPath; eRFPath++) + { + if (!rtl8192_phy_CheckIsLegalRFPath(dev, eRFPath)) + continue; + + pPhyReg = &priv->PHYRegDef[eRFPath]; + + // Joseph test for shorten RF config + // pHalData->RfReg0Value[eRFPath] = rtl8192_phy_QueryRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, rGlobalCtrl, bMaskDWord); + + /*----Store original RFENV control type----*/ + switch(eRFPath) + { + case RF90_PATH_A: + case RF90_PATH_C: + u4RegValue = rtl8192_QueryBBReg(dev, pPhyReg->rfintfs, bRFSI_RFENV); + break; + case RF90_PATH_B : + case RF90_PATH_D: + u4RegValue = rtl8192_QueryBBReg(dev, pPhyReg->rfintfs, bRFSI_RFENV<<16); + break; + } + + /*----Set RF_ENV enable----*/ + rtl8192_setBBreg(dev, pPhyReg->rfintfe, bRFSI_RFENV<<16, 0x1); + + /*----Set RF_ENV output high----*/ + rtl8192_setBBreg(dev, pPhyReg->rfintfo, bRFSI_RFENV, 0x1); + + /* Set bit number of Address and Data for RF register */ + rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, b3WireAddressLength, 0x0); // Set 0 to 4 bits for Z-serial and set 1 to 6 bits for 8258 + rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, b3WireDataLength, 0x0); // Set 0 to 12 bits for Z-serial and 8258, and set 1 to 14 bits for ??? + + rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E) eRFPath, 0x0, bMask12Bits, 0xbf); + + /*----Check RF block (for FPGA platform only)----*/ + // TODO: this function should be removed on ASIC , Emily 2007.2.2 + if (rtl8192_phy_checkBBAndRF(dev, HW90_BLOCK_RF, (RF90_RADIO_PATH_E)eRFPath)) + { + RT_TRACE(COMP_ERR, "PHY_RF8256_Config():Check Radio[%d] Fail!!\n", eRFPath); + goto phy_RF8256_Config_ParaFile_Fail; + } + + RetryTimes = ConstRetryTimes; + RF3_Final_Value = 0; + /*----Initialize RF fom connfiguration file----*/ + switch(eRFPath) + { + case RF90_PATH_A: + while(RF3_Final_Value!=RegValueToBeCheck && RetryTimes!=0) + { + ret = rtl8192_phy_ConfigRFWithHeaderFile(dev,(RF90_RADIO_PATH_E)eRFPath); + RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, RegOffSetToBeCheck, bMask12Bits); + RT_TRACE(COMP_RF, "RF %d %d register final value: %x\n", eRFPath, RegOffSetToBeCheck, RF3_Final_Value); + RetryTimes--; + } + break; + case RF90_PATH_B: + while(RF3_Final_Value!=RegValueToBeCheck && RetryTimes!=0) + { + ret = rtl8192_phy_ConfigRFWithHeaderFile(dev,(RF90_RADIO_PATH_E)eRFPath); + RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, RegOffSetToBeCheck, bMask12Bits); + RT_TRACE(COMP_RF, "RF %d %d register final value: %x\n", eRFPath, RegOffSetToBeCheck, RF3_Final_Value); + RetryTimes--; + } + break; + case RF90_PATH_C: + while(RF3_Final_Value!=RegValueToBeCheck && RetryTimes!=0) + { + ret = rtl8192_phy_ConfigRFWithHeaderFile(dev,(RF90_RADIO_PATH_E)eRFPath); + RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, RegOffSetToBeCheck, bMask12Bits); + RT_TRACE(COMP_RF, "RF %d %d register final value: %x\n", eRFPath, RegOffSetToBeCheck, RF3_Final_Value); + RetryTimes--; + } + break; + case RF90_PATH_D: + while(RF3_Final_Value!=RegValueToBeCheck && RetryTimes!=0) + { + ret = rtl8192_phy_ConfigRFWithHeaderFile(dev,(RF90_RADIO_PATH_E)eRFPath); + RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, RegOffSetToBeCheck, bMask12Bits); + RT_TRACE(COMP_RF, "RF %d %d register final value: %x\n", eRFPath, RegOffSetToBeCheck, RF3_Final_Value); + RetryTimes--; + } + break; + } + + /*----Restore RFENV control type----*/; + switch(eRFPath) + { + case RF90_PATH_A: + case RF90_PATH_C: + rtl8192_setBBreg(dev, pPhyReg->rfintfs, bRFSI_RFENV, u4RegValue); + break; + case RF90_PATH_B : + case RF90_PATH_D: + rtl8192_setBBreg(dev, pPhyReg->rfintfs, bRFSI_RFENV<<16, u4RegValue); + break; + } + + if(ret){ + RT_TRACE(COMP_ERR, "phy_RF8256_Config_ParaFile():Radio[%d] Fail!!", eRFPath); + goto phy_RF8256_Config_ParaFile_Fail; + } + + } + + RT_TRACE(COMP_PHY, "PHY Initialization Success\n") ; + return ; + +phy_RF8256_Config_ParaFile_Fail: + RT_TRACE(COMP_ERR, "PHY Initialization failed\n") ; + return ; +} + + +void PHY_SetRF8256CCKTxPower(struct net_device* dev, u8 powerlevel) +{ + u32 TxAGC=0; + struct r8192_priv *priv = ieee80211_priv(dev); + //modified by vivi, 20080109 + TxAGC = powerlevel; + + if(priv->bDynamicTxLowPower == TRUE ) //cosa 05/22/2008 for scan + { + if(priv->CustomerID == RT_CID_819x_Netcore) + TxAGC = 0x22; + else + TxAGC += priv->CckPwEnl; + } + + if(TxAGC > 0x24) + TxAGC = 0x24; + rtl8192_setBBreg(dev, rTxAGC_CCK_Mcs32, bTxAGCRateCCK, TxAGC); +} + + +void PHY_SetRF8256OFDMTxPower(struct net_device* dev, u8 powerlevel) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + //Joseph TxPower for 8192 testing + u32 writeVal, powerBase0, powerBase1, writeVal_tmp; + u8 index = 0; + u16 RegOffset[6] = {0xe00, 0xe04, 0xe10, 0xe14, 0xe18, 0xe1c}; + u8 byte0, byte1, byte2, byte3; + + powerBase0 = powerlevel + priv->TxPowerDiff; //OFDM rates + powerBase0 = (powerBase0<<24) | (powerBase0<<16) |(powerBase0<<8) |powerBase0; + powerBase1 = powerlevel; //MCS rates + powerBase1 = (powerBase1<<24) | (powerBase1<<16) |(powerBase1<<8) |powerBase1; + + for(index=0; index<6; index++) + { + writeVal = priv->MCSTxPowerLevelOriginalOffset[index] + ((index<2)?powerBase0:powerBase1); + byte0 = (u8)(writeVal & 0x7f); + byte1 = (u8)((writeVal & 0x7f00)>>8); + byte2 = (u8)((writeVal & 0x7f0000)>>16); + byte3 = (u8)((writeVal & 0x7f000000)>>24); + if(byte0 > 0x24) // Max power index = 0x24 + byte0 = 0x24; + if(byte1 > 0x24) + byte1 = 0x24; + if(byte2 > 0x24) + byte2 = 0x24; + if(byte3 > 0x24) + byte3 = 0x24; + + //for tx power track + if(index == 3) + { + writeVal_tmp = (byte3<<24) | (byte2<<16) |(byte1<<8) |byte0; + priv->Pwr_Track = writeVal_tmp; + } + + if(priv->bDynamicTxHighPower == TRUE) //Add by Jacken 2008/03/06 + { + // Emily, 20080613. Set low tx power for both MCS and legacy OFDM + writeVal = 0x03030303; + } + else + { + writeVal = (byte3<<24) | (byte2<<16) |(byte1<<8) |byte0; + } + rtl8192_setBBreg(dev, RegOffset[index], 0x7f7f7f7f, writeVal); + } + return; + +} + diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.h b/drivers/staging/rtl8192u/r8190_rtl8256.h new file mode 100644 index 000000000000..5c1f650fe824 --- /dev/null +++ b/drivers/staging/rtl8192u/r8190_rtl8256.h @@ -0,0 +1,27 @@ +/* + This is part of the rtl8180-sa2400 driver + released under the GPL (See file COPYING for details). + Copyright (c) 2005 Andrea Merello + + This files contains programming code for the rtl8256 + radio frontend. + + *Many* thanks to Realtek Corp. for their great support! + +*/ + +#ifndef RTL8225H +#define RTL8225H + +#ifdef RTL8190P +#define RTL819X_TOTAL_RF_PATH 4 //for 90P +#else +#define RTL819X_TOTAL_RF_PATH 2 //for 8192U +#endif +extern void PHY_SetRF8256Bandwidth(struct net_device* dev , HT_CHANNEL_WIDTH Bandwidth); +extern void PHY_RF8256_Config(struct net_device* dev); +extern void phy_RF8256_Config_ParaFile(struct net_device* dev); +extern void PHY_SetRF8256CCKTxPower(struct net_device* dev, u8 powerlevel); +extern void PHY_SetRF8256OFDMTxPower(struct net_device* dev, u8 powerlevel); + +#endif diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h new file mode 100644 index 000000000000..8f62f45517c8 --- /dev/null +++ b/drivers/staging/rtl8192u/r8192U.h @@ -0,0 +1,1367 @@ +/* + This is part of rtl8187 OpenSource driver. + Copyright (C) Andrea Merello 2004-2005 + Released under the terms of GPL (General Public Licence) + + Parts of this driver are based on the GPL part of the + official realtek driver + + Parts of this driver are based on the rtl8192 driver skeleton + from Patric Schenke & Andres Salomon + + Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver + + We want to tanks the Authors of those projects and the Ndiswrapper + project Authors. +*/ + +#ifndef R819xU_H +#define R819xU_H + +#include +#include +//#include +#include +#include +#include +#include +#include +#include +//#include +#include +#include +#include +#include //for rtnl_lock() +#include +#include +#include // Necessary because we use the proc fs +#include +#include +#include +#include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) +#include +#endif +#include "ieee80211.h" + +#define RTL8192U +#define RTL819xU_MODULE_NAME "rtl819xU" +//added for HW security, john.0629 +#define FALSE 0 +#define TRUE 1 +#define MAX_KEY_LEN 61 +#define KEY_BUF_SIZE 5 + +#define BIT0 0x00000001 +#define BIT1 0x00000002 +#define BIT2 0x00000004 +#define BIT3 0x00000008 +#define BIT4 0x00000010 +#define BIT5 0x00000020 +#define BIT6 0x00000040 +#define BIT7 0x00000080 +#define BIT8 0x00000100 +#define BIT9 0x00000200 +#define BIT10 0x00000400 +#define BIT11 0x00000800 +#define BIT12 0x00001000 +#define BIT13 0x00002000 +#define BIT14 0x00004000 +#define BIT15 0x00008000 +#define BIT16 0x00010000 +#define BIT17 0x00020000 +#define BIT18 0x00040000 +#define BIT19 0x00080000 +#define BIT20 0x00100000 +#define BIT21 0x00200000 +#define BIT22 0x00400000 +#define BIT23 0x00800000 +#define BIT24 0x01000000 +#define BIT25 0x02000000 +#define BIT26 0x04000000 +#define BIT27 0x08000000 +#define BIT28 0x10000000 +#define BIT29 0x20000000 +#define BIT30 0x40000000 +#define BIT31 0x80000000 + +// Rx smooth factor +#define Rx_Smooth_Factor 20 +#if 0 //we need to use RT_TRACE instead DMESG as RT_TRACE will clearly show debug level wb. +#define DMESG(x,a...) printk(KERN_INFO RTL819xU_MODULE_NAME ": " x "\n", ## a) +#define DMESGW(x,a...) printk(KERN_WARNING RTL819xU_MODULE_NAME ": WW:" x "\n", ## a) +#define DMESGE(x,a...) printk(KERN_WARNING RTL819xU_MODULE_NAME ": EE:" x "\n", ## a) +#else +#define DMESG(x,a...) +#define DMESGW(x,a...) +#define DMESGE(x,a...) +extern u32 rt_global_debug_component; +#define RT_TRACE(component, x, args...) \ +do { if(rt_global_debug_component & component) \ + printk(KERN_DEBUG RTL819xU_MODULE_NAME ":" x "\n" , \ + ##args);\ +}while(0); + +#define COMP_TRACE BIT0 // For function call tracing. +#define COMP_DBG BIT1 // Only for temporary debug message. +#define COMP_INIT BIT2 // during driver initialization / halt / reset. + + +#define COMP_RECV BIT3 // Reveive part data path. +#define COMP_SEND BIT4 // Send part path. +#define COMP_IO BIT5 // I/O Related. Added by Annie, 2006-03-02. +#define COMP_POWER BIT6 // 802.11 Power Save mode or System/Device Power state related. +#define COMP_EPROM BIT7 // 802.11 link related: join/start BSS, leave BSS. +#define COMP_SWBW BIT8 // For bandwidth switch. +#define COMP_POWER_TRACKING BIT9 //FOR 8190 TX POWER TRACKING +#define COMP_TURBO BIT10 // For Turbo Mode related. By Annie, 2005-10-21. +#define COMP_QOS BIT11 // For QoS. +#define COMP_RATE BIT12 // For Rate Adaptive mechanism, 2006.07.02, by rcnjko. +#define COMP_RM BIT13 // For Radio Measurement. +#define COMP_DIG BIT14 // For DIG, 2006.09.25, by rcnjko. +#define COMP_PHY BIT15 +#define COMP_CH BIT16 //channel setting debug +#define COMP_TXAGC BIT17 // For Tx power, 060928, by rcnjko. +#define COMP_HIPWR BIT18 // For High Power Mechanism, 060928, by rcnjko. +#define COMP_HALDM BIT19 // For HW Dynamic Mechanism, 061010, by rcnjko. +#define COMP_SEC BIT20 // Event handling +#define COMP_LED BIT21 // For LED. +#define COMP_RF BIT22 // For RF. +//1!!!!!!!!!!!!!!!!!!!!!!!!!!! +#define COMP_RXDESC BIT23 // Show Rx desc information for SD3 debug. Added by Annie, 2006-07-15. +//1//1Attention Please!!!<11n or 8190 specific code should be put below this line> +//1!!!!!!!!!!!!!!!!!!!!!!!!!!! + +#define COMP_FIRMWARE BIT24 //for firmware downloading +#define COMP_HT BIT25 // For 802.11n HT related information. by Emily 2006-8-11 +#define COMP_AMSDU BIT26 // For A-MSDU Debugging + +#define COMP_SCAN BIT27 +//#define COMP_RESET BIT28 +#define COMP_DOWN BIT29 //for rm driver module +#define COMP_RESET BIT30 //for silent reset +#define COMP_ERR BIT31 //for error out, always on +#endif + +#define RTL819x_DEBUG +#ifdef RTL819x_DEBUG +#define assert(expr) \ + if (!(expr)) { \ + printk( "Assertion failed! %s,%s,%s,line=%d\n", \ + #expr,__FILE__,__FUNCTION__,__LINE__); \ + } +//wb added to debug out data buf +//if you want print DATA buffer related BA, please set ieee80211_debug_level to DATA|BA +#define RT_DEBUG_DATA(level, data, datalen) \ + do{ if ((rt_global_debug_component & (level)) == (level)) \ + { \ + int i; \ + u8* pdata = (u8*) data; \ + printk(KERN_DEBUG RTL819xU_MODULE_NAME ": %s()\n", __FUNCTION__); \ + for(i=0; i<(int)(datalen); i++) \ + { \ + printk("%2x ", pdata[i]); \ + if ((i+1)%16 == 0) printk("\n"); \ + } \ + printk("\n"); \ + } \ + } while (0) +#else +#define assert(expr) do {} while (0) +#define RT_DEBUG_DATA(level, data, datalen) do {} while(0) +#endif /* RTL8169_DEBUG */ + + +// +// Queue Select Value in TxDesc +// +#define QSLT_BK 0x1 +#define QSLT_BE 0x0 +#define QSLT_VI 0x4 +#define QSLT_VO 0x6 +#define QSLT_BEACON 0x10 +#define QSLT_HIGH 0x11 +#define QSLT_MGNT 0x12 +#define QSLT_CMD 0x13 + +#define DESC90_RATE1M 0x00 +#define DESC90_RATE2M 0x01 +#define DESC90_RATE5_5M 0x02 +#define DESC90_RATE11M 0x03 +#define DESC90_RATE6M 0x04 +#define DESC90_RATE9M 0x05 +#define DESC90_RATE12M 0x06 +#define DESC90_RATE18M 0x07 +#define DESC90_RATE24M 0x08 +#define DESC90_RATE36M 0x09 +#define DESC90_RATE48M 0x0a +#define DESC90_RATE54M 0x0b +#define DESC90_RATEMCS0 0x00 +#define DESC90_RATEMCS1 0x01 +#define DESC90_RATEMCS2 0x02 +#define DESC90_RATEMCS3 0x03 +#define DESC90_RATEMCS4 0x04 +#define DESC90_RATEMCS5 0x05 +#define DESC90_RATEMCS6 0x06 +#define DESC90_RATEMCS7 0x07 +#define DESC90_RATEMCS8 0x08 +#define DESC90_RATEMCS9 0x09 +#define DESC90_RATEMCS10 0x0a +#define DESC90_RATEMCS11 0x0b +#define DESC90_RATEMCS12 0x0c +#define DESC90_RATEMCS13 0x0d +#define DESC90_RATEMCS14 0x0e +#define DESC90_RATEMCS15 0x0f +#define DESC90_RATEMCS32 0x20 + +#define RTL819X_DEFAULT_RF_TYPE RF_1T2R + +#define IEEE80211_WATCH_DOG_TIME 2000 +#define PHY_Beacon_RSSI_SLID_WIN_MAX 10 +//for txpowertracking by amy +#define OFDM_Table_Length 19 +#define CCK_Table_length 12 + +/* for rtl819x */ +typedef struct _tx_desc_819x_usb { + //DWORD 0 + u16 PktSize; + u8 Offset; + u8 Reserved0:3; + u8 CmdInit:1; + u8 LastSeg:1; + u8 FirstSeg:1; + u8 LINIP:1; + u8 OWN:1; + + //DWORD 1 + u8 TxFWInfoSize; + u8 RATid:3; + u8 DISFB:1; + u8 USERATE:1; + u8 MOREFRAG:1; + u8 NoEnc:1; + u8 PIFS:1; + u8 QueueSelect:5; + u8 NoACM:1; + u8 Reserved1:2; + u8 SecCAMID:5; + u8 SecDescAssign:1; + u8 SecType:2; + + //DWORD 2 + u16 TxBufferSize; + //u16 Reserved2; + u8 ResvForPaddingLen:7; + u8 Reserved3:1; + u8 Reserved4; + + //DWORD 3, 4, 5 + u32 Reserved5; + u32 Reserved6; + u32 Reserved7; +}tx_desc_819x_usb, *ptx_desc_819x_usb; + +#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE +typedef struct _tx_desc_819x_usb_aggr_subframe { + //DWORD 0 + u16 PktSize; + u8 Offset; + u8 TxFWInfoSize; + + //DWORD 1 + u8 RATid:3; + u8 DISFB:1; + u8 USERATE:1; + u8 MOREFRAG:1; + u8 NoEnc:1; + u8 PIFS:1; + u8 QueueSelect:5; + u8 NoACM:1; + u8 Reserved1:2; + u8 SecCAMID:5; + u8 SecDescAssign:1; + u8 SecType:2; + u8 PacketID:7; + u8 OWN:1; +}tx_desc_819x_usb_aggr_subframe, *ptx_desc_819x_usb_aggr_subframe; +#endif + + + +typedef struct _tx_desc_cmd_819x_usb { + //DWORD 0 + u16 Reserved0; + u8 Reserved1; + u8 Reserved2:3; + u8 CmdInit:1; + u8 LastSeg:1; + u8 FirstSeg:1; + u8 LINIP:1; + u8 OWN:1; + + //DOWRD 1 + //u32 Reserved3; + u8 TxFWInfoSize; + u8 Reserved3; + u8 QueueSelect; + u8 Reserved4; + + //DOWRD 2 + u16 TxBufferSize; + u16 Reserved5; + + //DWORD 3,4,5 + //u32 TxBufferAddr; + //u32 NextDescAddress; + u32 Reserved6; + u32 Reserved7; + u32 Reserved8; +}tx_desc_cmd_819x_usb, *ptx_desc_cmd_819x_usb; + + +typedef struct _tx_fwinfo_819x_usb { + //DOWRD 0 + u8 TxRate:7; + u8 CtsEnable:1; + u8 RtsRate:7; + u8 RtsEnable:1; + u8 TxHT:1; + u8 Short:1; //Short PLCP for CCK, or short GI for 11n MCS + u8 TxBandwidth:1; // This is used for HT MCS rate only. + u8 TxSubCarrier:2; // This is used for legacy OFDM rate only. + u8 STBC:2; + u8 AllowAggregation:1; + u8 RtsHT:1; //Interpre RtsRate field as high throughput data rate + u8 RtsShort:1; //Short PLCP for CCK, or short GI for 11n MCS + u8 RtsBandwidth:1; // This is used for HT MCS rate only. + u8 RtsSubcarrier:2; // This is used for legacy OFDM rate only. + u8 RtsSTBC:2; + u8 EnableCPUDur:1; //Enable firmware to recalculate and assign packet duration + + //DWORD 1 + u32 RxMF:2; + u32 RxAMD:3; + u32 TxPerPktInfoFeedback:1;//1 indicate Tx info gathtered by firmware and returned by Rx Cmd + u32 Reserved1:2; + u32 TxAGCOffSet:4; + u32 TxAGCSign:1; + u32 Tx_INFO_RSVD:6; + u32 PacketID:13; + //u32 Reserved; +}tx_fwinfo_819x_usb, *ptx_fwinfo_819x_usb; + +typedef struct rtl8192_rx_info { + struct urb *urb; + struct net_device *dev; + u8 out_pipe; +}rtl8192_rx_info ; + +typedef struct rx_desc_819x_usb{ + //DOWRD 0 + u16 Length:14; + u16 CRC32:1; + u16 ICV:1; + u8 RxDrvInfoSize; + u8 Shift:2; + u8 PHYStatus:1; + u8 SWDec:1; + //u8 LastSeg:1; + //u8 FirstSeg:1; + //u8 EOR:1; + //u8 OWN:1; + u8 Reserved1:4; + + //DWORD 1 + u32 Reserved2; + + //DWORD 2 + //u32 Reserved3; + + //DWORD 3 + //u32 BufferAddress; + +}rx_desc_819x_usb, *prx_desc_819x_usb; + +#ifdef USB_RX_AGGREGATION_SUPPORT +typedef struct _rx_desc_819x_usb_aggr_subframe{ + //DOWRD 0 + u16 Length:14; + u16 CRC32:1; + u16 ICV:1; + u8 Offset; + u8 RxDrvInfoSize; + //DOWRD 1 + u8 Shift:2; + u8 PHYStatus:1; + u8 SWDec:1; + u8 Reserved1:4; + u8 Reserved2; + u16 Reserved3; + //DWORD 2 + //u4Byte Reserved3; + //DWORD 3 + //u4Byte BufferAddress; +}rx_desc_819x_usb_aggr_subframe, *prx_desc_819x_usb_aggr_subframe; +#endif + +typedef struct rx_drvinfo_819x_usb{ + //DWORD 0 + u16 Reserved1:12; + u16 PartAggr:1; + u16 FirstAGGR:1; + u16 Reserved2:2; + + u8 RxRate:7; + u8 RxHT:1; + + u8 BW:1; + u8 SPLCP:1; + u8 Reserved3:2; + u8 PAM:1; + u8 Mcast:1; + u8 Bcast:1; + u8 Reserved4:1; + + //DWORD 1 + u32 TSFL; + +}rx_drvinfo_819x_usb, *prx_drvinfo_819x_usb; + + +#define MAX_DEV_ADDR_SIZE 8 /* support till 64 bit bus width OS */ +#define MAX_FIRMWARE_INFORMATION_SIZE 32 /*2006/04/30 by Emily forRTL8190*/ +#define MAX_802_11_HEADER_LENGTH (40 + MAX_FIRMWARE_INFORMATION_SIZE) +#define ENCRYPTION_MAX_OVERHEAD 128 +#define USB_HWDESC_HEADER_LEN sizeof(tx_desc_819x_usb) +#define TX_PACKET_SHIFT_BYTES (USB_HWDESC_HEADER_LEN + sizeof(tx_fwinfo_819x_usb)) +#define MAX_FRAGMENT_COUNT 8 +#ifdef RTL8192U +#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE +#define MAX_TRANSMIT_BUFFER_SIZE 32000 +#else +#define MAX_TRANSMIT_BUFFER_SIZE 8000 +#endif +#else +#define MAX_TRANSMIT_BUFFER_SIZE (1600+(MAX_802_11_HEADER_LENGTH+ENCRYPTION_MAX_OVERHEAD)*MAX_FRAGMENT_COUNT) +#endif +#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE +#define TX_PACKET_DRVAGGR_SUBFRAME_SHIFT_BYTES (sizeof(tx_desc_819x_usb_aggr_subframe) + sizeof(tx_fwinfo_819x_usb)) +#endif +#define scrclng 4 // octets for crc32 (FCS, ICV) + +typedef enum rf_optype +{ + RF_OP_By_SW_3wire = 0, + RF_OP_By_FW, + RF_OP_MAX +}rf_op_type; +/* 8190 Loopback Mode definition */ +typedef enum _rtl819xUsb_loopback{ + RTL819xU_NO_LOOPBACK = 0, + RTL819xU_MAC_LOOPBACK = 1, + RTL819xU_DMA_LOOPBACK = 2, + RTL819xU_CCK_LOOPBACK = 3, +}rtl819xUsb_loopback_e; + +/* due to rtl8192 firmware */ +typedef enum _desc_packet_type_e{ + DESC_PACKET_TYPE_INIT = 0, + DESC_PACKET_TYPE_NORMAL = 1, +}desc_packet_type_e; + +typedef enum _firmware_source{ + FW_SOURCE_IMG_FILE = 0, + FW_SOURCE_HEADER_FILE = 1, //from header file +}firmware_source_e, *pfirmware_source_e; + +typedef enum _firmware_status{ + FW_STATUS_0_INIT = 0, + FW_STATUS_1_MOVE_BOOT_CODE = 1, + FW_STATUS_2_MOVE_MAIN_CODE = 2, + FW_STATUS_3_TURNON_CPU = 3, + FW_STATUS_4_MOVE_DATA_CODE = 4, + FW_STATUS_5_READY = 5, +}firmware_status_e; + +typedef struct _rt_firmare_seg_container { + u16 seg_size; + u8 *seg_ptr; +}fw_seg_container, *pfw_seg_container; +typedef struct _rt_firmware{ + firmware_status_e firmware_status; + u16 cmdpacket_frag_thresold; +#define RTL8190_MAX_FIRMWARE_CODE_SIZE 64000 //64k + u8 firmware_buf[RTL8190_MAX_FIRMWARE_CODE_SIZE]; + u16 firmware_buf_size; +}rt_firmware, *prt_firmware; + +//+by amy 080507 +#define MAX_RECEIVE_BUFFER_SIZE 9100 // Add this to 9100 bytes to receive A-MSDU from RT-AP + +typedef struct _rt_firmware_info_819xUsb{ + u8 sz_info[16]; +}rt_firmware_info_819xUsb, *prt_firmware_info_819xUsb; + +/* Firmware Queue Layout */ +#define NUM_OF_FIRMWARE_QUEUE 10 +#define NUM_OF_PAGES_IN_FW 0x100 + +#ifdef USE_ONE_PIPE +#define NUM_OF_PAGE_IN_FW_QUEUE_BE 0x000 +#define NUM_OF_PAGE_IN_FW_QUEUE_BK 0x000 +#define NUM_OF_PAGE_IN_FW_QUEUE_VI 0x0ff +#define NUM_OF_PAGE_IN_FW_QUEUE_VO 0x000 +#define NUM_OF_PAGE_IN_FW_QUEUE_HCCA 0 +#define NUM_OF_PAGE_IN_FW_QUEUE_CMD 0x0 +#define NUM_OF_PAGE_IN_FW_QUEUE_MGNT 0x00 +#define NUM_OF_PAGE_IN_FW_QUEUE_HIGH 0 +#define NUM_OF_PAGE_IN_FW_QUEUE_BCN 0x0 +#define NUM_OF_PAGE_IN_FW_QUEUE_PUB 0x00 +#else + +#define NUM_OF_PAGE_IN_FW_QUEUE_BE 0x020 +#define NUM_OF_PAGE_IN_FW_QUEUE_BK 0x020 +#define NUM_OF_PAGE_IN_FW_QUEUE_VI 0x040 +#define NUM_OF_PAGE_IN_FW_QUEUE_VO 0x040 +#define NUM_OF_PAGE_IN_FW_QUEUE_HCCA 0 +#define NUM_OF_PAGE_IN_FW_QUEUE_CMD 0x4 +#define NUM_OF_PAGE_IN_FW_QUEUE_MGNT 0x20 +#define NUM_OF_PAGE_IN_FW_QUEUE_HIGH 0 +#define NUM_OF_PAGE_IN_FW_QUEUE_BCN 0x4 +#define NUM_OF_PAGE_IN_FW_QUEUE_PUB 0x18 + +#endif + +#define APPLIED_RESERVED_QUEUE_IN_FW 0x80000000 +#define RSVD_FW_QUEUE_PAGE_BK_SHIFT 0x00 +#define RSVD_FW_QUEUE_PAGE_BE_SHIFT 0x08 +#define RSVD_FW_QUEUE_PAGE_VI_SHIFT 0x10 +#define RSVD_FW_QUEUE_PAGE_VO_SHIFT 0x18 +#define RSVD_FW_QUEUE_PAGE_MGNT_SHIFT 0x10 +#define RSVD_FW_QUEUE_PAGE_CMD_SHIFT 0x08 +#define RSVD_FW_QUEUE_PAGE_BCN_SHIFT 0x00 +#define RSVD_FW_QUEUE_PAGE_PUB_SHIFT 0x08 +//================================================================= +//================================================================= + +#define EPROM_93c46 0 +#define EPROM_93c56 1 + +#define DEFAULT_FRAG_THRESHOLD 2342U +#define MIN_FRAG_THRESHOLD 256U +#define DEFAULT_BEACONINTERVAL 0x64U +#define DEFAULT_BEACON_ESSID "Rtl819xU" + +#define DEFAULT_SSID "" +#define DEFAULT_RETRY_RTS 7 +#define DEFAULT_RETRY_DATA 7 +#define PRISM_HDR_SIZE 64 + +#define PHY_RSSI_SLID_WIN_MAX 100 + + +typedef enum _WIRELESS_MODE { + WIRELESS_MODE_UNKNOWN = 0x00, + WIRELESS_MODE_A = 0x01, + WIRELESS_MODE_B = 0x02, + WIRELESS_MODE_G = 0x04, + WIRELESS_MODE_AUTO = 0x08, + WIRELESS_MODE_N_24G = 0x10, + WIRELESS_MODE_N_5G = 0x20 +} WIRELESS_MODE; + + +#define RTL_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30 + +typedef struct buffer +{ + struct buffer *next; + u32 *buf; + +} buffer; + +typedef struct rtl_reg_debug{ + unsigned int cmd; + struct { + unsigned char type; + unsigned char addr; + unsigned char page; + unsigned char length; + } head; + unsigned char buf[0xff]; +}rtl_reg_debug; + + + + + +#if 0 + +typedef struct tx_pendingbuf +{ + struct ieee80211_txb *txb; + short ispending; + short descfrag; +} tx_pendigbuf; + +#endif + +typedef struct _rt_9x_tx_rate_history { + u32 cck[4]; + u32 ofdm[8]; + // HT_MCS[0][]: BW=0 SG=0 + // HT_MCS[1][]: BW=1 SG=0 + // HT_MCS[2][]: BW=0 SG=1 + // HT_MCS[3][]: BW=1 SG=1 + u32 ht_mcs[4][16]; +}rt_tx_rahis_t, *prt_tx_rahis_t; +typedef struct _RT_SMOOTH_DATA_4RF { + char elements[4][100];//array to store values + u32 index; //index to current array to store + u32 TotalNum; //num of valid elements + u32 TotalVal[4]; //sum of valid elements +}RT_SMOOTH_DATA_4RF, *PRT_SMOOTH_DATA_4RF; + +#define MAX_8192U_RX_SIZE 8192 // This maybe changed for D-cut larger aggregation size +//stats seems messed up, clean it ASAP +typedef struct Stats +{ + unsigned long txrdu; +// unsigned long rxrdu; + //unsigned long rxnolast; + //unsigned long rxnodata; +// unsigned long rxreset; +// unsigned long rxnopointer; + unsigned long rxok; + unsigned long rxframgment; + unsigned long rxcmdpkt[4]; //08/05/08 amy rx cmd element txfeedback/bcn report/cfg set/query + unsigned long rxurberr; + unsigned long rxstaterr; + unsigned long received_rate_histogram[4][32]; //0: Total, 1:OK, 2:CRC, 3:ICV, 2007 07 03 cosa + unsigned long received_preamble_GI[2][32]; //0: Long preamble/GI, 1:Short preamble/GI + unsigned long rx_AMPDUsize_histogram[5]; // level: (<4K), (4K~8K), (8K~16K), (16K~32K), (32K~64K) + unsigned long rx_AMPDUnum_histogram[5]; // level: (<5), (5~10), (10~20), (20~40), (>40) + unsigned long numpacket_matchbssid; // debug use only. + unsigned long numpacket_toself; // debug use only. + unsigned long num_process_phyinfo; // debug use only. + unsigned long numqry_phystatus; + unsigned long numqry_phystatusCCK; + unsigned long numqry_phystatusHT; + unsigned long received_bwtype[5]; //0: 20M, 1: funn40M, 2: upper20M, 3: lower20M, 4: duplicate + unsigned long txnperr; + unsigned long txnpdrop; + unsigned long txresumed; +// unsigned long rxerr; +// unsigned long rxoverflow; +// unsigned long rxint; + unsigned long txnpokint; +// unsigned long txhpokint; +// unsigned long txhperr; +// unsigned long ints; +// unsigned long shints; + unsigned long txoverflow; +// unsigned long rxdmafail; +// unsigned long txbeacon; +// unsigned long txbeaconerr; + unsigned long txlpokint; + unsigned long txlpdrop; + unsigned long txlperr; + unsigned long txbeokint; + unsigned long txbedrop; + unsigned long txbeerr; + unsigned long txbkokint; + unsigned long txbkdrop; + unsigned long txbkerr; + unsigned long txviokint; + unsigned long txvidrop; + unsigned long txvierr; + unsigned long txvookint; + unsigned long txvodrop; + unsigned long txvoerr; + unsigned long txbeaconokint; + unsigned long txbeacondrop; + unsigned long txbeaconerr; + unsigned long txmanageokint; + unsigned long txmanagedrop; + unsigned long txmanageerr; + unsigned long txdatapkt; + unsigned long txfeedback; + unsigned long txfeedbackok; + + unsigned long txoktotal; + unsigned long txokbytestotal; + unsigned long txokinperiod; + unsigned long txmulticast; + unsigned long txbytesmulticast; + unsigned long txbroadcast; + unsigned long txbytesbroadcast; + unsigned long txunicast; + unsigned long txbytesunicast; + + unsigned long rxoktotal; + unsigned long rxbytesunicast; + unsigned long txfeedbackfail; + unsigned long txerrtotal; + unsigned long txerrbytestotal; + unsigned long txerrmulticast; + unsigned long txerrbroadcast; + unsigned long txerrunicast; + unsigned long txretrycount; + unsigned long txfeedbackretry; + u8 last_packet_rate; + unsigned long slide_signal_strength[100]; + unsigned long slide_evm[100]; + unsigned long slide_rssi_total; // For recording sliding window's RSSI value + unsigned long slide_evm_total; // For recording sliding window's EVM value + long signal_strength; // Transformed, in dbm. Beautified signal strength for UI, not correct. + long signal_quality; + long last_signal_strength_inpercent; + long recv_signal_power; // Correct smoothed ss in Dbm, only used in driver to report real power now. + u8 rx_rssi_percentage[4]; + u8 rx_evm_percentage[2]; + long rxSNRdB[4]; + rt_tx_rahis_t txrate; + u32 Slide_Beacon_pwdb[100]; //cosa add for beacon rssi + u32 Slide_Beacon_Total; //cosa add for beacon rssi + RT_SMOOTH_DATA_4RF cck_adc_pwdb; + + u32 CurrentShowTxate; +} Stats; + + +// Bandwidth Offset +#define HAL_PRIME_CHNL_OFFSET_DONT_CARE 0 +#define HAL_PRIME_CHNL_OFFSET_LOWER 1 +#define HAL_PRIME_CHNL_OFFSET_UPPER 2 + +//+by amy 080507 + +typedef struct ChnlAccessSetting { + u16 SIFS_Timer; + u16 DIFS_Timer; + u16 SlotTimeTimer; + u16 EIFS_Timer; + u16 CWminIndex; + u16 CWmaxIndex; +}*PCHANNEL_ACCESS_SETTING,CHANNEL_ACCESS_SETTING; + +typedef struct _BB_REGISTER_DEFINITION{ + u32 rfintfs; // set software control: // 0x870~0x877[8 bytes] + u32 rfintfi; // readback data: // 0x8e0~0x8e7[8 bytes] + u32 rfintfo; // output data: // 0x860~0x86f [16 bytes] + u32 rfintfe; // output enable: // 0x860~0x86f [16 bytes] + u32 rf3wireOffset; // LSSI data: // 0x840~0x84f [16 bytes] + u32 rfLSSI_Select; // BB Band Select: // 0x878~0x87f [8 bytes] + u32 rfTxGainStage; // Tx gain stage: // 0x80c~0x80f [4 bytes] + u32 rfHSSIPara1; // wire parameter control1 : // 0x820~0x823,0x828~0x82b, 0x830~0x833, 0x838~0x83b [16 bytes] + u32 rfHSSIPara2; // wire parameter control2 : // 0x824~0x827,0x82c~0x82f, 0x834~0x837, 0x83c~0x83f [16 bytes] + u32 rfSwitchControl; //Tx Rx antenna control : // 0x858~0x85f [16 bytes] + u32 rfAGCControl1; //AGC parameter control1 : // 0xc50~0xc53,0xc58~0xc5b, 0xc60~0xc63, 0xc68~0xc6b [16 bytes] + u32 rfAGCControl2; //AGC parameter control2 : // 0xc54~0xc57,0xc5c~0xc5f, 0xc64~0xc67, 0xc6c~0xc6f [16 bytes] + u32 rfRxIQImbalance; //OFDM Rx IQ imbalance matrix : // 0xc14~0xc17,0xc1c~0xc1f, 0xc24~0xc27, 0xc2c~0xc2f [16 bytes] + u32 rfRxAFE; //Rx IQ DC ofset and Rx digital filter, Rx DC notch filter : // 0xc10~0xc13,0xc18~0xc1b, 0xc20~0xc23, 0xc28~0xc2b [16 bytes] + u32 rfTxIQImbalance; //OFDM Tx IQ imbalance matrix // 0xc80~0xc83,0xc88~0xc8b, 0xc90~0xc93, 0xc98~0xc9b [16 bytes] + u32 rfTxAFE; //Tx IQ DC Offset and Tx DFIR type // 0xc84~0xc87,0xc8c~0xc8f, 0xc94~0xc97, 0xc9c~0xc9f [16 bytes] + u32 rfLSSIReadBack; //LSSI RF readback data // 0x8a0~0x8af [16 bytes] +}BB_REGISTER_DEFINITION_T, *PBB_REGISTER_DEFINITION_T; + +typedef enum _RT_RF_TYPE_819xU{ + RF_TYPE_MIN = 0, + RF_8225, + RF_8256, + RF_8258, + RF_PSEUDO_11N = 4, +}RT_RF_TYPE_819xU, *PRT_RF_TYPE_819xU; + +typedef struct _rate_adaptive +{ + u8 rate_adaptive_disabled; + u8 ratr_state; + u16 reserve; + + u32 high_rssi_thresh_for_ra; + u32 high2low_rssi_thresh_for_ra; + u8 low2high_rssi_thresh_for_ra40M; + u32 low_rssi_thresh_for_ra40M; + u8 low2high_rssi_thresh_for_ra20M; + u32 low_rssi_thresh_for_ra20M; + u32 upper_rssi_threshold_ratr; + u32 middle_rssi_threshold_ratr; + u32 low_rssi_threshold_ratr; + u32 low_rssi_threshold_ratr_40M; + u32 low_rssi_threshold_ratr_20M; + u8 ping_rssi_enable; //cosa add for test + u32 ping_rssi_ratr; //cosa add for test + u32 ping_rssi_thresh_for_ra;//cosa add for test + u32 last_ratr; + +} rate_adaptive, *prate_adaptive; + +#define TxBBGainTableLength 37 +#define CCKTxBBGainTableLength 23 + +typedef struct _txbbgain_struct +{ + long txbb_iq_amplifygain; + u32 txbbgain_value; +} txbbgain_struct, *ptxbbgain_struct; + +typedef struct _ccktxbbgain_struct +{ + //The Value is from a22 to a29 one Byte one time is much Safer + u8 ccktxbb_valuearray[8]; +} ccktxbbgain_struct,*pccktxbbgain_struct; + + +typedef struct _init_gain +{ + u8 xaagccore1; + u8 xbagccore1; + u8 xcagccore1; + u8 xdagccore1; + u8 cca; + +} init_gain, *pinit_gain; +//by amy 0606 + +typedef struct _phy_ofdm_rx_status_report_819xusb +{ + u8 trsw_gain_X[4]; + u8 pwdb_all; + u8 cfosho_X[4]; + u8 cfotail_X[4]; + u8 rxevm_X[2]; + u8 rxsnr_X[4]; + u8 pdsnr_X[2]; + u8 csi_current_X[2]; + u8 csi_target_X[2]; + u8 sigevm; + u8 max_ex_pwr; + u8 sgi_en; + u8 rxsc_sgien_exflg; +}phy_sts_ofdm_819xusb_t; + +typedef struct _phy_cck_rx_status_report_819xusb +{ + /* For CCK rate descriptor. This is a unsigned 8:1 variable. LSB bit presend + 0.5. And MSB 7 bts presend a signed value. Range from -64~+63.5. */ + u8 adc_pwdb_X[4]; + u8 sq_rpt; + u8 cck_agc_rpt; +}phy_sts_cck_819xusb_t; + + +typedef struct _phy_ofdm_rx_status_rxsc_sgien_exintfflag{ + u8 reserved:4; + u8 rxsc:2; + u8 sgi_en:1; + u8 ex_intf_flag:1; +}phy_ofdm_rx_status_rxsc_sgien_exintfflag; + +typedef enum _RT_CUSTOMER_ID +{ + RT_CID_DEFAULT = 0, + RT_CID_8187_ALPHA0 = 1, + RT_CID_8187_SERCOMM_PS = 2, + RT_CID_8187_HW_LED = 3, + RT_CID_8187_NETGEAR = 4, + RT_CID_WHQL = 5, + RT_CID_819x_CAMEO = 6, + RT_CID_819x_RUNTOP = 7, + RT_CID_819x_Senao = 8, + RT_CID_TOSHIBA = 9, // Merge by Jacken, 2008/01/31. + RT_CID_819x_Netcore = 10, + RT_CID_Nettronix = 11, + RT_CID_DLINK = 12, + RT_CID_PRONET = 13, +}RT_CUSTOMER_ID, *PRT_CUSTOMER_ID; + +//================================================================================ +// LED customization. +//================================================================================ + +typedef enum _LED_STRATEGY_8190{ + SW_LED_MODE0, // SW control 1 LED via GPIO0. It is default option. + SW_LED_MODE1, // SW control for PCI Express + SW_LED_MODE2, // SW control for Cameo. + SW_LED_MODE3, // SW contorl for RunTop. + SW_LED_MODE4, // SW control for Netcore + HW_LED, // HW control 2 LEDs, LED0 and LED1 (there are 4 different control modes) +}LED_STRATEGY_8190, *PLED_STRATEGY_8190; + +typedef enum _RESET_TYPE { + RESET_TYPE_NORESET = 0x00, + RESET_TYPE_NORMAL = 0x01, + RESET_TYPE_SILENT = 0x02 +} RESET_TYPE; + +/* The simple tx command OP code. */ +typedef enum _tag_TxCmd_Config_Index{ + TXCMD_TXRA_HISTORY_CTRL = 0xFF900000, + TXCMD_RESET_TX_PKT_BUFF = 0xFF900001, + TXCMD_RESET_RX_PKT_BUFF = 0xFF900002, + TXCMD_SET_TX_DURATION = 0xFF900003, + TXCMD_SET_RX_RSSI = 0xFF900004, + TXCMD_SET_TX_PWR_TRACKING = 0xFF900005, + TXCMD_XXXX_CTRL, +}DCMD_TXCMD_OP; + +typedef struct r8192_priv +{ + struct usb_device *udev; + //added for maintain info from eeprom + short epromtype; + u16 eeprom_vid; + u16 eeprom_pid; + u8 eeprom_CustomerID; + u8 eeprom_ChannelPlan; + RT_CUSTOMER_ID CustomerID; + LED_STRATEGY_8190 LedStrategy; + u8 txqueue_to_outpipemap[9]; + int irq; + struct ieee80211_device *ieee80211; + + short card_8192; /* O: rtl8192, 1:rtl8185 V B/C, 2:rtl8185 V D */ + u8 card_8192_version; /* if TCR reports card V B/C this discriminates */ +// short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */ + short enable_gpio0; + enum card_type {PCI,MINIPCI,CARDBUS,USB}card_type; + short hw_plcp_len; + short plcp_preamble_mode; + + spinlock_t irq_lock; +// spinlock_t irq_th_lock; + spinlock_t tx_lock; +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)) + struct semaphore mutex; +#else + struct mutex mutex; +#endif + //spinlock_t rf_lock; //used to lock rf write operation added by wb + + u16 irq_mask; +// short irq_enabled; +// struct net_device *dev; //comment this out. + short chan; + short sens; + short max_sens; + + + // u8 chtxpwr[15]; //channels from 1 to 14, 0 not used +// u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used +// u8 cck_txpwr_base; +// u8 ofdm_txpwr_base; +// u8 challow[15]; //channels from 1 to 14, 0 not used + short up; + short crcmon; //if 1 allow bad crc frame reception in monitor mode +// short prism_hdr; + +// struct timer_list scan_timer; + /*short scanpending; + short stopscan;*/ +// spinlock_t scan_lock; +// u8 active_probe; + //u8 active_scan_num; + struct semaphore wx_sem; + struct semaphore rf_sem; //used to lock rf write operation added by wb, modified by david +// short hw_wep; + +// short digphy; +// short antb; +// short diversity; +// u8 cs_treshold; +// short rcr_csense; + u8 rf_type; //0 means 1T2R, 1 means 2T4R + RT_RF_TYPE_819xU rf_chip; + +// u32 key0[4]; + short (*rf_set_sens)(struct net_device *dev,short sens); + u8 (*rf_set_chan)(struct net_device *dev,u8 ch); + void (*rf_close)(struct net_device *dev); + void (*rf_init)(struct net_device *dev); + //short rate; + short promisc; + /*stats*/ + struct Stats stats; + struct iw_statistics wstats; + struct proc_dir_entry *dir_dev; + + /*RX stuff*/ +// u32 *rxring; +// u32 *rxringtail; +// dma_addr_t rxringdma; + struct urb **rx_urb; + struct urb **rx_cmd_urb; +#ifdef THOMAS_BEACON + u32 *oldaddr; +#endif +#ifdef THOMAS_TASKLET + atomic_t irt_counter;//count for irq_rx_tasklet +#endif +#ifdef JACKSON_NEW_RX + struct sk_buff **pp_rxskb; + int rx_inx; +#endif + +/* modified by davad for Rx process */ + struct sk_buff_head rx_queue; + struct sk_buff_head skb_queue; +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) + struct tq_struct qos_activate; +#else + struct work_struct qos_activate; +#endif + short tx_urb_index; + atomic_t tx_pending[0x10];//UART_PRIORITY+1 + + + struct tasklet_struct irq_rx_tasklet; + struct urb *rxurb_task; + + //2 Tx Related variables + u16 ShortRetryLimit; + u16 LongRetryLimit; + u32 TransmitConfig; + u8 RegCWinMin; // For turbo mode CW adaptive. Added by Annie, 2005-10-27. + + u32 LastRxDescTSFHigh; + u32 LastRxDescTSFLow; + + + //2 Rx Related variables + u16 EarlyRxThreshold; + u32 ReceiveConfig; + u8 AcmControl; + + u8 RFProgType; + + u8 retry_data; + u8 retry_rts; + u16 rts; + + struct ChnlAccessSetting ChannelAccessSetting; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + struct work_struct reset_wq; +#else + struct tq_struct reset_wq; +#endif + +/**********************************************************/ + //for rtl819xUsb + u16 basic_rate; + u8 short_preamble; + u8 slot_time; + bool bDcut; + bool bCurrentRxAggrEnable; + u8 Rf_Mode; //add for Firmware RF -R/W switch + prt_firmware pFirmware; + rtl819xUsb_loopback_e LoopbackMode; + firmware_source_e firmware_source; + u16 EEPROMTxPowerDiff; + u8 EEPROMThermalMeter; + u8 EEPROMPwDiff; + u8 EEPROMCrystalCap; + u8 EEPROM_Def_Ver; + u8 EEPROMTxPowerLevelCCK;// CCK channel 1~14 + u8 EEPROMTxPowerLevelCCK_V1[3]; + u8 EEPROMTxPowerLevelOFDM24G[3]; // OFDM 2.4G channel 1~14 + u8 EEPROMTxPowerLevelOFDM5G[24]; // OFDM 5G + +/*PHY related*/ + BB_REGISTER_DEFINITION_T PHYRegDef[4]; //Radio A/B/C/D + // Read/write are allow for following hardware information variables + u32 MCSTxPowerLevelOriginalOffset[6]; + u32 CCKTxPowerLevelOriginalOffset; + u8 TxPowerLevelCCK[14]; // CCK channel 1~14 + u8 TxPowerLevelOFDM24G[14]; // OFDM 2.4G channel 1~14 + u8 TxPowerLevelOFDM5G[14]; // OFDM 5G + u32 Pwr_Track; + u8 TxPowerDiff; + u8 AntennaTxPwDiff[2]; // Antenna gain offset, index 0 for B, 1 for C, and 2 for D + u8 CrystalCap; // CrystalCap. + u8 ThermalMeter[2]; // ThermalMeter, index 0 for RFIC0, and 1 for RFIC1 + + u8 CckPwEnl; + // Use to calculate PWBD. + u8 bCckHighPower; + long undecorated_smoothed_pwdb; + + //for set channel + u8 SwChnlInProgress; + u8 SwChnlStage; + u8 SwChnlStep; + u8 SetBWModeInProgress; + HT_CHANNEL_WIDTH CurrentChannelBW; + u8 ChannelPlan; + // 8190 40MHz mode + // + u8 nCur40MhzPrimeSC; // Control channel sub-carrier + // Joseph test for shorten RF configuration time. + // We save RF reg0 in this variable to reduce RF reading. + // + u32 RfReg0Value[4]; + u8 NumTotalRFPath; + bool brfpath_rxenable[4]; + //RF set related + bool SetRFPowerStateInProgress; +//+by amy 080507 + struct timer_list watch_dog_timer; + +//+by amy 080515 for dynamic mechenism + //Add by amy Tx Power Control for Near/Far Range 2008/05/15 + bool bdynamic_txpower; //bDynamicTxPower + bool bDynamicTxHighPower; // Tx high power state + bool bDynamicTxLowPower; // Tx low power state + bool bLastDTPFlag_High; + bool bLastDTPFlag_Low; + + bool bstore_last_dtpflag; + bool bstart_txctrl_bydtp; //Define to discriminate on High power State or on sitesuvey to change Tx gain index + //Add by amy for Rate Adaptive + rate_adaptive rate_adaptive; + //Add by amy for TX power tracking + //2008/05/15 Mars OPEN/CLOSE TX POWER TRACKING + txbbgain_struct txbbgain_table[TxBBGainTableLength]; + u8 txpower_count;//For 6 sec do tracking again + bool btxpower_trackingInit; + u8 OFDM_index; + u8 CCK_index; + //2007/09/10 Mars Add CCK TX Power Tracking + ccktxbbgain_struct cck_txbbgain_table[CCKTxBBGainTableLength]; + ccktxbbgain_struct cck_txbbgain_ch14_table[CCKTxBBGainTableLength]; + u8 rfa_txpowertrackingindex; + u8 rfa_txpowertrackingindex_real; + u8 rfa_txpowertracking_default; + u8 rfc_txpowertrackingindex; + u8 rfc_txpowertrackingindex_real; + + s8 cck_present_attentuation; + u8 cck_present_attentuation_20Mdefault; + u8 cck_present_attentuation_40Mdefault; + char cck_present_attentuation_difference; + bool btxpower_tracking; + bool bcck_in_ch14; + bool btxpowerdata_readfromEEPORM; + u16 TSSI_13dBm; + //For Backup Initial Gain + init_gain initgain_backup; + u8 DefaultInitialGain[4]; + // For EDCA Turbo mode, Added by amy 080515. + bool bis_any_nonbepkts; + bool bcurrent_turbo_EDCA; + bool bis_cur_rdlstate; + struct timer_list fsync_timer; + bool bfsync_processing; // 500ms Fsync timer is active or not + u32 rate_record; + u32 rateCountDiffRecord; + u32 ContiuneDiffCount; + bool bswitch_fsync; + + u8 framesync; + u32 framesyncC34; + u8 framesyncMonitor; + //Added by amy 080516 for RX related + u16 nrxAMPDU_size; + u8 nrxAMPDU_aggr_num; + + //by amy for gpio + bool bHwRadioOff; + + //by amy for reset_count + u32 reset_count; + bool bpbc_pressed; + //by amy for debug + u32 txpower_checkcnt; + u32 txpower_tracking_callback_cnt; + u8 thermal_read_val[40]; + u8 thermal_readback_index; + u32 ccktxpower_adjustcnt_not_ch14; + u32 ccktxpower_adjustcnt_ch14; + u8 tx_fwinfo_force_subcarriermode; + u8 tx_fwinfo_force_subcarrierval; + //by amy for silent reset + RESET_TYPE ResetProgress; + bool bForcedSilentReset; + bool bDisableNormalResetCheck; + u16 TxCounter; + u16 RxCounter; + int IrpPendingCount; + bool bResetInProgress; + bool force_reset; + u8 InitialGainOperateType; + + u16 SifsTime; + + //define work item by amy 080526 +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) + struct delayed_work update_beacon_wq; + struct delayed_work watch_dog_wq; + struct delayed_work txpower_tracking_wq; + struct delayed_work rfpath_check_wq; + struct delayed_work gpio_change_rf_wq; + struct delayed_work initialgain_operate_wq; +#else + struct work_struct update_beacon_wq; + struct work_struct watch_dog_wq; + struct work_struct txpower_tracking_wq; + struct work_struct rfpath_check_wq; + struct work_struct gpio_change_rf_wq; + struct work_struct initialgain_operate_wq; +#endif + struct workqueue_struct *priv_wq; +#else + /* used for periodly scan */ + struct tq_struct update_beacon_wq; + struct tq_struct txpower_tracking_wq; + struct tq_struct rfpath_check_wq; + struct tq_struct watch_dog_wq; + struct tq_struct gpio_change_rf_wq; + struct tq_struct initialgain_operate_wq; +#endif +}r8192_priv; + +// for rtl8187 +// now mirging to rtl8187B +/* +typedef enum{ + LOW_PRIORITY = 0x02, + NORM_PRIORITY + } priority_t; +*/ +//for rtl8187B +typedef enum{ + BULK_PRIORITY = 0x01, + //RSVD0, + //RSVD1, + LOW_PRIORITY, + NORM_PRIORITY, + VO_PRIORITY, + VI_PRIORITY, //0x05 + BE_PRIORITY, + BK_PRIORITY, + RSVD2, + RSVD3, + BEACON_PRIORITY, //0x0A + HIGH_PRIORITY, + MANAGE_PRIORITY, + RSVD4, + RSVD5, + UART_PRIORITY //0x0F +} priority_t; + +typedef enum{ + NIC_8192U = 1, + NIC_8190P = 2, + NIC_8192E = 3, + } nic_t; + + +#if 0 //defined in Qos.h +//typedef u32 AC_CODING; +#define AC0_BE 0 // ACI: 0x00 // Best Effort +#define AC1_BK 1 // ACI: 0x01 // Background +#define AC2_VI 2 // ACI: 0x10 // Video +#define AC3_VO 3 // ACI: 0x11 // Voice +#define AC_MAX 4 // Max: define total number; Should not to be used as a real enum. + +// +// ECWmin/ECWmax field. +// Ref: WMM spec 2.2.2: WME Parameter Element, p.13. +// +typedef union _ECW{ + u8 charData; + struct + { + u8 ECWmin:4; + u8 ECWmax:4; + }f; // Field +}ECW, *PECW; + +// +// ACI/AIFSN Field. +// Ref: WMM spec 2.2.2: WME Parameter Element, p.12. +// +typedef union _ACI_AIFSN{ + u8 charData; + + struct + { + u8 AIFSN:4; + u8 ACM:1; + u8 ACI:2; + u8 Reserved:1; + }f; // Field +}ACI_AIFSN, *PACI_AIFSN; + +// +// AC Parameters Record Format. +// Ref: WMM spec 2.2.2: WME Parameter Element, p.12. +// +typedef union _AC_PARAM{ + u32 longData; + u8 charData[4]; + + struct + { + ACI_AIFSN AciAifsn; + ECW Ecw; + u16 TXOPLimit; + }f; // Field +}AC_PARAM, *PAC_PARAM; + +#endif +#ifdef JOHN_HWSEC +struct ssid_thread { + struct net_device *dev; + u8 name[IW_ESSID_MAX_SIZE + 1]; +}; +#endif + +bool init_firmware(struct net_device *dev); +short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb); +short rtl8192_tx(struct net_device *dev, struct sk_buff* skb); + +u32 read_cam(struct net_device *dev, u8 addr); +void write_cam(struct net_device *dev, u8 addr, u32 data); + +u8 read_nic_byte(struct net_device *dev, int x); +u8 read_nic_byte_E(struct net_device *dev, int x); +u32 read_nic_dword(struct net_device *dev, int x); +u16 read_nic_word(struct net_device *dev, int x) ; +void write_nic_byte(struct net_device *dev, int x,u8 y); +void write_nic_byte_E(struct net_device *dev, int x,u8 y); +void write_nic_word(struct net_device *dev, int x,u16 y); +void write_nic_dword(struct net_device *dev, int x,u32 y); +void force_pci_posting(struct net_device *dev); + +void rtl8192_rtx_disable(struct net_device *); +void rtl8192_rx_enable(struct net_device *); +void rtl8192_tx_enable(struct net_device *); + +void rtl8192_disassociate(struct net_device *dev); +//void fix_rx_fifo(struct net_device *dev); +void rtl8185_set_rf_pins_enable(struct net_device *dev,u32 a); + +void rtl8192_set_anaparam(struct net_device *dev,u32 a); +void rtl8185_set_anaparam2(struct net_device *dev,u32 a); +void rtl8192_update_msr(struct net_device *dev); +int rtl8192_down(struct net_device *dev); +int rtl8192_up(struct net_device *dev); +void rtl8192_commit(struct net_device *dev); +void rtl8192_set_chan(struct net_device *dev,short ch); +void write_phy(struct net_device *dev, u8 adr, u8 data); +void write_phy_cck(struct net_device *dev, u8 adr, u32 data); +void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data); +void rtl8185_tx_antenna(struct net_device *dev, u8 ant); +void rtl8192_set_rxconf(struct net_device *dev); +//short check_nic_enough_desc(struct net_device *dev, priority_t priority); +extern void rtl819xusb_beacon_tx(struct net_device *dev,u16 tx_rate); + +void EnableHWSecurityConfig8192(struct net_device *dev); +void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, u8 *MacAddr, u8 DefaultKey, u32 *KeyContent ); + + +#endif diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c new file mode 100644 index 000000000000..6997e97fc850 --- /dev/null +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -0,0 +1,7134 @@ +/****************************************************************************** + * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. + * Linux device driver for RTL8192U + * + * Based on the r8187 driver, which is: + * Copyright 2004-2005 Andrea Merello , et al. + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * 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, USA + * + * The full GNU General Public License is included in this distribution in the + * file called LICENSE. + * + * Contact Information: + * Jerry chuang + */ + +#ifndef CONFIG_FORCE_HARD_FLOAT +double __floatsidf (int i) { return i; } +unsigned int __fixunsdfsi (double d) { return d; } +double __adddf3(double a, double b) { return a+b; } +double __addsf3(float a, float b) { return a+b; } +double __subdf3(double a, double b) { return a-b; } +double __extendsfdf2(float a) {return a;} +#endif + +#undef LOOP_TEST +#undef DUMP_RX +#undef DUMP_TX +#undef DEBUG_TX_DESC2 +#undef RX_DONT_PASS_UL +#undef DEBUG_EPROM +#undef DEBUG_RX_VERBOSE +#undef DUMMY_RX +#undef DEBUG_ZERO_RX +#undef DEBUG_RX_SKB +#undef DEBUG_TX_FRAG +#undef DEBUG_RX_FRAG +#undef DEBUG_TX_FILLDESC +#undef DEBUG_TX +#undef DEBUG_IRQ +#undef DEBUG_RX +#undef DEBUG_RXALLOC +#undef DEBUG_REGISTERS +#undef DEBUG_RING +#undef DEBUG_IRQ_TASKLET +#undef DEBUG_TX_ALLOC +#undef DEBUG_TX_DESC + +#define CONFIG_RTL8192_IO_MAP + +#include +#include "r8192U_hw.h" +#include "r8192U.h" +#include "r8190_rtl8256.h" /* RTL8225 Radio frontend */ +#include "r8180_93cx6.h" /* Card EEPROM */ +#include "r8192U_wx.h" +#include "r819xU_phy.h" //added by WB 4.30.2008 +#include "r819xU_phyreg.h" +#include "r819xU_cmdpkt.h" +#include "r8192U_dm.h" +//#include "r8192xU_phyreg.h" +#include +// FIXME: check if 2.6.7 is ok +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7)) +#define usb_kill_urb usb_unlink_urb +#endif + +#ifdef CONFIG_RTL8192_PM +#include "r8192_pm.h" +#endif + +#ifdef ENABLE_DOT11D +#include "dot11d.h" +#endif +//set here to open your trace code. //WB +u32 rt_global_debug_component = \ + // COMP_INIT | +// COMP_DBG | + // COMP_EPROM | +// COMP_PHY | + // COMP_RF | +// COMP_FIRMWARE | +// COMP_CH | + // COMP_POWER_TRACKING | +// COMP_RATE | + // COMP_TXAGC | + // COMP_TRACE | + COMP_DOWN | + // COMP_RECV | + // COMP_SWBW | + COMP_SEC | + // COMP_RESET | + // COMP_SEND | + // COMP_EVENTS | + COMP_ERR ; //always open err flags on + +#define TOTAL_CAM_ENTRY 32 +#define CAM_CONTENT_COUNT 8 + +static struct usb_device_id rtl8192_usb_id_tbl[] = { + /* Realtek */ + {USB_DEVICE(0x0bda, 0x8192)}, + {USB_DEVICE(0x0bda, 0x8709)}, + /* Corega */ + {USB_DEVICE(0x07aa, 0x0043)}, + /* Belkin */ + {USB_DEVICE(0x050d, 0x805E)}, + /* Sitecom */ + {USB_DEVICE(0x0df6, 0x0031)}, + /* EnGenius */ + {USB_DEVICE(0x1740, 0x9201)}, + /* Dlink */ + {USB_DEVICE(0x2001, 0x3301)}, + /* Zinwell */ + {USB_DEVICE(0x5a57, 0x0290)}, + {} +}; + +MODULE_LICENSE("GPL"); +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) +MODULE_VERSION("V 1.1"); +#endif +MODULE_DEVICE_TABLE(usb, rtl8192_usb_id_tbl); +MODULE_DESCRIPTION("Linux driver for Realtek RTL8192 USB WiFi cards"); + +static char* ifname = "wlan%d"; +#if 0 +static int hwseqnum = 0; +static int hwwep = 0; +#endif +static int hwwep = 1; //default use hw. set 0 to use software security +static int channels = 0x3fff; + + + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9) +module_param(ifname, charp, S_IRUGO|S_IWUSR ); +//module_param(hwseqnum,int, S_IRUGO|S_IWUSR); +module_param(hwwep,int, S_IRUGO|S_IWUSR); +module_param(channels,int, S_IRUGO|S_IWUSR); +#else +MODULE_PARM(ifname, "s"); +//MODULE_PARM(hwseqnum,"i"); +MODULE_PARM(hwwep,"i"); +MODULE_PARM(channels,"i"); +#endif + +MODULE_PARM_DESC(ifname," Net interface name, wlan%d=default"); +//MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default"); +MODULE_PARM_DESC(hwwep," Try to use hardware security support. "); +MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI"); + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) +static int __devinit rtl8192_usb_probe(struct usb_interface *intf, + const struct usb_device_id *id); +static void __devexit rtl8192_usb_disconnect(struct usb_interface *intf); +#else +static void *__devinit rtl8192_usb_probe(struct usb_device *udev,unsigned int ifnum, + const struct usb_device_id *id); +static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr); +#endif + + +static struct usb_driver rtl8192_usb_driver = { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15) + .owner = THIS_MODULE, +#endif + .name = RTL819xU_MODULE_NAME, /* Driver name */ + .id_table = rtl8192_usb_id_tbl, /* PCI_ID table */ + .probe = rtl8192_usb_probe, /* probe fn */ + .disconnect = rtl8192_usb_disconnect, /* remove fn */ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0) +#ifdef CONFIG_RTL8192_PM + .suspend = rtl8192_suspend, /* PM suspend fn */ + .resume = rtl8192_resume, /* PM resume fn */ +#else + .suspend = NULL, /* PM suspend fn */ + .resume = NULL, /* PM resume fn */ +#endif +#endif +}; + +#ifdef ENABLE_DOT11D + +typedef struct _CHANNEL_LIST +{ + u8 Channel[32]; + u8 Len; +}CHANNEL_LIST, *PCHANNEL_LIST; + +static CHANNEL_LIST ChannelPlan[] = { + {{1,2,3,4,5,6,7,8,9,10,11,36,40,44,48,52,56,60,64,149,153,157,161,165},24}, //FCC + {{1,2,3,4,5,6,7,8,9,10,11},11}, //IC + {{1,2,3,4,5,6,7,8,9,10,11,12,13,36,40,44,48,52,56,60,64},21}, //ETSI + {{1,2,3,4,5,6,7,8,9,10,11,12,13},13}, //Spain. Change to ETSI. + {{1,2,3,4,5,6,7,8,9,10,11,12,13},13}, //France. Change to ETSI. + {{1,2,3,4,5,6,7,8,9,10,11,12,13,14,36,40,44,48,52,56,60,64},22}, //MKK //MKK + {{1,2,3,4,5,6,7,8,9,10,11,12,13,14,36,40,44,48,52,56,60,64},22},//MKK1 + {{1,2,3,4,5,6,7,8,9,10,11,12,13},13}, //Israel. + {{1,2,3,4,5,6,7,8,9,10,11,12,13,14,36,40,44,48,52,56,60,64},22}, // For 11a , TELEC + {{1,2,3,4,5,6,7,8,9,10,11,12,13,14,36,40,44,48,52,56,60,64}, 22}, //MIC + {{1,2,3,4,5,6,7,8,9,10,11,12,13,14},14} //For Global Domain. 1-11:active scan, 12-14 passive scan. //+YJ, 080626 +}; + +static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv* priv) +{ + int i, max_chan=-1, min_chan=-1; + struct ieee80211_device* ieee = priv->ieee80211; + switch (channel_plan) + { + case COUNTRY_CODE_FCC: + case COUNTRY_CODE_IC: + case COUNTRY_CODE_ETSI: + case COUNTRY_CODE_SPAIN: + case COUNTRY_CODE_FRANCE: + case COUNTRY_CODE_MKK: + case COUNTRY_CODE_MKK1: + case COUNTRY_CODE_ISRAEL: + case COUNTRY_CODE_TELEC: + case COUNTRY_CODE_MIC: + { + Dot11d_Init(ieee); + ieee->bGlobalDomain = false; + //acturally 8225 & 8256 rf chip only support B,G,24N mode + if ((priv->rf_chip == RF_8225) || (priv->rf_chip == RF_8256)) + { + min_chan = 1; + max_chan = 14; + } + else + { + RT_TRACE(COMP_ERR, "unknown rf chip, can't set channel map in function:%s()\n", __FUNCTION__); + } + if (ChannelPlan[channel_plan].Len != 0){ + // Clear old channel map + memset(GET_DOT11D_INFO(ieee)->channel_map, 0, sizeof(GET_DOT11D_INFO(ieee)->channel_map)); + // Set new channel map + for (i=0;i max_chan) + break; + GET_DOT11D_INFO(ieee)->channel_map[ChannelPlan[channel_plan].Channel[i]] = 1; + } + } + break; + } + case COUNTRY_CODE_GLOBAL_DOMAIN: + { + GET_DOT11D_INFO(ieee)->bEnabled = 0;//this flag enabled to follow 11d country IE setting, otherwise, it shall follow global domain settings. + Dot11d_Reset(ieee); + ieee->bGlobalDomain = true; + break; + } + default: + break; + } + return; +} +#endif + +#define eqMacAddr(a,b) ( ((a)[0]==(b)[0] && (a)[1]==(b)[1] && (a)[2]==(b)[2] && (a)[3]==(b)[3] && (a)[4]==(b)[4] && (a)[5]==(b)[5]) ? 1:0 ) + +#define rx_hal_is_cck_rate(_pdrvinfo)\ + (_pdrvinfo->RxRate == DESC90_RATE1M ||\ + _pdrvinfo->RxRate == DESC90_RATE2M ||\ + _pdrvinfo->RxRate == DESC90_RATE5_5M ||\ + _pdrvinfo->RxRate == DESC90_RATE11M) &&\ + !_pdrvinfo->RxHT\ + + +void CamResetAllEntry(struct net_device *dev) +{ +#if 1 + u32 ulcommand = 0; + //2004/02/11 In static WEP, OID_ADD_KEY or OID_ADD_WEP are set before STA associate to AP. + // However, ResetKey is called on OID_802_11_INFRASTRUCTURE_MODE and MlmeAssociateRequest + // In this condition, Cam can not be reset because upper layer will not set this static key again. + //if(Adapter->EncAlgorithm == WEP_Encryption) + // return; +//debug + //DbgPrint("========================================\n"); + //DbgPrint(" Call ResetAllEntry \n"); + //DbgPrint("========================================\n\n"); + ulcommand |= BIT31|BIT30; + write_nic_dword(dev, RWCAM, ulcommand); +#else + for(ucIndex=0;ucIndexudev; + + status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), + RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, + indx|0xfe00, 0, &data, 1, HZ / 2); + + if (status < 0) + { + printk("write_nic_byte_E TimeOut! status:%d\n", status); + } +} + +u8 read_nic_byte_E(struct net_device *dev, int indx) +{ + int status; + u8 data; + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + struct usb_device *udev = priv->udev; + + status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), + RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, + indx|0xfe00, 0, &data, 1, HZ / 2); + + if (status < 0) + { + printk("read_nic_byte_E TimeOut! status:%d\n", status); + } + + return data; +} +//as 92U has extend page from 4 to 16, so modify functions below. +void write_nic_byte(struct net_device *dev, int indx, u8 data) +{ + int status; + + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + struct usb_device *udev = priv->udev; + + status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), + RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, + (indx&0xff)|0xff00, (indx>>8)&0x0f, &data, 1, HZ / 2); + + if (status < 0) + { + printk("write_nic_byte TimeOut! status:%d\n", status); + } + + +} + + +void write_nic_word(struct net_device *dev, int indx, u16 data) +{ + + int status; + + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + struct usb_device *udev = priv->udev; + + status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), + RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, + (indx&0xff)|0xff00, (indx>>8)&0x0f, &data, 2, HZ / 2); + + if (status < 0) + { + printk("write_nic_word TimeOut! status:%d\n", status); + } + +} + + +void write_nic_dword(struct net_device *dev, int indx, u32 data) +{ + + int status; + + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + struct usb_device *udev = priv->udev; + + status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), + RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, + (indx&0xff)|0xff00, (indx>>8)&0x0f, &data, 4, HZ / 2); + + + if (status < 0) + { + printk("write_nic_dword TimeOut! status:%d\n", status); + } + +} + + + +u8 read_nic_byte(struct net_device *dev, int indx) +{ + u8 data; + int status; + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + struct usb_device *udev = priv->udev; + + status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), + RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, + (indx&0xff)|0xff00, (indx>>8)&0x0f, &data, 1, HZ / 2); + + if (status < 0) + { + printk("read_nic_byte TimeOut! status:%d\n", status); + } + + return data; +} + + + +u16 read_nic_word(struct net_device *dev, int indx) +{ + u16 data; + int status; + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + struct usb_device *udev = priv->udev; + + status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), + RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, + (indx&0xff)|0xff00, (indx>>8)&0x0f, &data, 2, HZ / 2); + + if (status < 0) + { + printk("read_nic_word TimeOut! status:%d\n", status); + } + + + return data; +} + +u16 read_nic_word_E(struct net_device *dev, int indx) +{ + u16 data; + int status; + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + struct usb_device *udev = priv->udev; + + status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), + RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, + indx|0xfe00, 0, &data, 2, HZ / 2); + + if (status < 0) + { + printk("read_nic_word TimeOut! status:%d\n", status); + } + + + return data; +} + +u32 read_nic_dword(struct net_device *dev, int indx) +{ + u32 data; + int status; +// int result; + + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + struct usb_device *udev = priv->udev; + + status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), + RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, + (indx&0xff)|0xff00, (indx>>8)&0x0f, &data, 4, HZ / 2); +// if(0 != result) { +// printk(KERN_WARNING "read size of data = %d\, date = %d\n", result, data); +// } + + if (status < 0) + { + printk("read_nic_dword TimeOut! status:%d\n", status); + } + + + + return data; +} + + +//u8 read_phy_cck(struct net_device *dev, u8 adr); +//u8 read_phy_ofdm(struct net_device *dev, u8 adr); +/* this might still called in what was the PHY rtl8185/rtl8192 common code + * plans are to possibilty turn it again in one common code... + */ +inline void force_pci_posting(struct net_device *dev) +{ +} + + +static struct net_device_stats *rtl8192_stats(struct net_device *dev); +void rtl8192_commit(struct net_device *dev); +//void rtl8192_restart(struct net_device *dev); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +void rtl8192_restart(struct work_struct *work); +//void rtl8192_rq_tx_ack(struct work_struct *work); +#else + void rtl8192_restart(struct net_device *dev); +// //void rtl8192_rq_tx_ack(struct net_device *dev); + #endif + +void watch_dog_timer_callback(unsigned long data); + +/**************************************************************************** + -----------------------------PROCFS STUFF------------------------- +*****************************************************************************/ + +static struct proc_dir_entry *rtl8192_proc = NULL; + + + +static int proc_get_stats_ap(char *page, char **start, + off_t offset, int count, + int *eof, void *data) +{ + struct net_device *dev = data; + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + struct ieee80211_device *ieee = priv->ieee80211; + struct ieee80211_network *target; + + int len = 0; + + list_for_each_entry(target, &ieee->network_list, list) { + + len += snprintf(page + len, count - len, + "%s ", target->ssid); + + if(target->wpa_ie_len>0 || target->rsn_ie_len>0){ + len += snprintf(page + len, count - len, + "WPA\n"); + } + else{ + len += snprintf(page + len, count - len, + "non_WPA\n"); + } + + } + + *eof = 1; + return len; +} + +static int proc_get_registers(char *page, char **start, + off_t offset, int count, + int *eof, void *data) +{ + struct net_device *dev = data; +// struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + + int len = 0; + int i,n; + + int max=0xff; + + /* This dump the current register page */ +len += snprintf(page + len, count - len, + "\n####################page 0##################\n "); + + for(n=0;n<=max;) + { + //printk( "\nD: %2x> ", n); + len += snprintf(page + len, count - len, + "\nD: %2x > ",n); + + for(i=0;i<16 && n<=max;i++,n++) + len += snprintf(page + len, count - len, + "%2x ",read_nic_byte(dev,0x000|n)); + + // printk("%2x ",read_nic_byte(dev,n)); + } +#if 1 +len += snprintf(page + len, count - len, + "\n####################page 1##################\n "); + for(n=0;n<=max;) + { + //printk( "\nD: %2x> ", n); + len += snprintf(page + len, count - len, + "\nD: %2x > ",n); + + for(i=0;i<16 && n<=max;i++,n++) + len += snprintf(page + len, count - len, + "%2x ",read_nic_byte(dev,0x100|n)); + + // printk("%2x ",read_nic_byte(dev,n)); + } +len += snprintf(page + len, count - len, + "\n####################page 3##################\n "); + for(n=0;n<=max;) + { + //printk( "\nD: %2x> ", n); + len += snprintf(page + len, count - len, + "\nD: %2x > ",n); + + for(i=0;i<16 && n<=max;i++,n++) + len += snprintf(page + len, count - len, + "%2x ",read_nic_byte(dev,0x300|n)); + + // printk("%2x ",read_nic_byte(dev,n)); + } + +#endif + + len += snprintf(page + len, count - len,"\n"); + *eof = 1; + return len; + +} + + +#if 0 +static int proc_get_cck_reg(char *page, char **start, + off_t offset, int count, + int *eof, void *data) +{ + struct net_device *dev = data; +// struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + + int len = 0; + int i,n; + + int max = 0x5F; + + /* This dump the current register page */ + for(n=0;n<=max;) + { + //printk( "\nD: %2x> ", n); + len += snprintf(page + len, count - len, + "\nD: %2x > ",n); + + for(i=0;i<16 && n<=max;i++,n++) + len += snprintf(page + len, count - len, + "%2x ",read_phy_cck(dev,n)); + + // printk("%2x ",read_nic_byte(dev,n)); + } + len += snprintf(page + len, count - len,"\n"); + + + *eof = 1; + return len; +} + +#endif + +#if 0 +static int proc_get_ofdm_reg(char *page, char **start, + off_t offset, int count, + int *eof, void *data) +{ + struct net_device *dev = data; +// struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + + int len = 0; + int i,n; + + //int max=0xff; + int max = 0x40; + + /* This dump the current register page */ + for(n=0;n<=max;) + { + //printk( "\nD: %2x> ", n); + len += snprintf(page + len, count - len, + "\nD: %2x > ",n); + + for(i=0;i<16 && n<=max;i++,n++) + len += snprintf(page + len, count - len, + "%2x ",read_phy_ofdm(dev,n)); + + // printk("%2x ",read_nic_byte(dev,n)); + } + len += snprintf(page + len, count - len,"\n"); + + + + *eof = 1; + return len; +} + +#endif + +#if 0 +static int proc_get_stats_hw(char *page, char **start, + off_t offset, int count, + int *eof, void *data) +{ + struct net_device *dev = data; + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + + int len = 0; + + len += snprintf(page + len, count - len, + "NIC int: %lu\n" + "Total int: %lu\n", + priv->stats.ints, + priv->stats.shints); + + *eof = 1; + return len; +} +#endif + +static int proc_get_stats_tx(char *page, char **start, + off_t offset, int count, + int *eof, void *data) +{ + struct net_device *dev = data; + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + + int len = 0; + + len += snprintf(page + len, count - len, + "TX VI priority ok int: %lu\n" + "TX VI priority error int: %lu\n" + "TX VO priority ok int: %lu\n" + "TX VO priority error int: %lu\n" + "TX BE priority ok int: %lu\n" + "TX BE priority error int: %lu\n" + "TX BK priority ok int: %lu\n" + "TX BK priority error int: %lu\n" + "TX MANAGE priority ok int: %lu\n" + "TX MANAGE priority error int: %lu\n" + "TX BEACON priority ok int: %lu\n" + "TX BEACON priority error int: %lu\n" +// "TX high priority ok int: %lu\n" +// "TX high priority failed error int: %lu\n" + "TX queue resume: %lu\n" + "TX queue stopped?: %d\n" + "TX fifo overflow: %lu\n" +// "TX beacon: %lu\n" + "TX VI queue: %d\n" + "TX VO queue: %d\n" + "TX BE queue: %d\n" + "TX BK queue: %d\n" +// "TX HW queue: %d\n" + "TX VI dropped: %lu\n" + "TX VO dropped: %lu\n" + "TX BE dropped: %lu\n" + "TX BK dropped: %lu\n" + "TX total data packets %lu\n", +// "TX beacon aborted: %lu\n", + priv->stats.txviokint, + priv->stats.txvierr, + priv->stats.txvookint, + priv->stats.txvoerr, + priv->stats.txbeokint, + priv->stats.txbeerr, + priv->stats.txbkokint, + priv->stats.txbkerr, + priv->stats.txmanageokint, + priv->stats.txmanageerr, + priv->stats.txbeaconokint, + priv->stats.txbeaconerr, +// priv->stats.txhpokint, +// priv->stats.txhperr, + priv->stats.txresumed, + netif_queue_stopped(dev), + priv->stats.txoverflow, +// priv->stats.txbeacon, + atomic_read(&(priv->tx_pending[VI_PRIORITY])), + atomic_read(&(priv->tx_pending[VO_PRIORITY])), + atomic_read(&(priv->tx_pending[BE_PRIORITY])), + atomic_read(&(priv->tx_pending[BK_PRIORITY])), +// read_nic_byte(dev, TXFIFOCOUNT), + priv->stats.txvidrop, + priv->stats.txvodrop, + priv->stats.txbedrop, + priv->stats.txbkdrop, + priv->stats.txdatapkt +// priv->stats.txbeaconerr + ); + + *eof = 1; + return len; +} + + + +static int proc_get_stats_rx(char *page, char **start, + off_t offset, int count, + int *eof, void *data) +{ + struct net_device *dev = data; + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + + int len = 0; + + len += snprintf(page + len, count - len, + "RX packets: %lu\n" + "RX urb status error: %lu\n" + "RX invalid urb error: %lu\n", + priv->stats.rxoktotal, + priv->stats.rxstaterr, + priv->stats.rxurberr); + + *eof = 1; + return len; +} +#if 0 +#if WIRELESS_EXT >= 12 && WIRELESS_EXT < 17 + +static struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + return &priv->wstats; +} +#endif +#endif +void rtl8192_proc_module_init(void) +{ + RT_TRACE(COMP_INIT, "Initializing proc filesystem"); +#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) + rtl8192_proc=create_proc_entry(RTL819xU_MODULE_NAME, S_IFDIR, proc_net); +#else + rtl8192_proc=create_proc_entry(RTL819xU_MODULE_NAME, S_IFDIR, init_net.proc_net); +#endif +} + + +void rtl8192_proc_module_remove(void) +{ +#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) + remove_proc_entry(RTL819xU_MODULE_NAME, proc_net); +#else + remove_proc_entry(RTL819xU_MODULE_NAME, init_net.proc_net); +#endif +} + + +void rtl8192_proc_remove_one(struct net_device *dev) +{ + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + + + if (priv->dir_dev) { + // remove_proc_entry("stats-hw", priv->dir_dev); + remove_proc_entry("stats-tx", priv->dir_dev); + remove_proc_entry("stats-rx", priv->dir_dev); + // remove_proc_entry("stats-ieee", priv->dir_dev); + remove_proc_entry("stats-ap", priv->dir_dev); + remove_proc_entry("registers", priv->dir_dev); + // remove_proc_entry("cck-registers",priv->dir_dev); + // remove_proc_entry("ofdm-registers",priv->dir_dev); + //remove_proc_entry(dev->name, rtl8192_proc); + remove_proc_entry("wlan0", rtl8192_proc); + priv->dir_dev = NULL; + } +} + + +void rtl8192_proc_init_one(struct net_device *dev) +{ + struct proc_dir_entry *e; + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + priv->dir_dev = create_proc_entry(dev->name, + S_IFDIR | S_IRUGO | S_IXUGO, + rtl8192_proc); + if (!priv->dir_dev) { + RT_TRACE(COMP_ERR, "Unable to initialize /proc/net/rtl8192/%s\n", + dev->name); + return; + } + #if 0 + e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO, + priv->dir_dev, proc_get_stats_hw, dev); + + if (!e) { + DMESGE("Unable to initialize " + "/proc/net/rtl8192/%s/stats-hw\n", + dev->name); + } + #endif + e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO, + priv->dir_dev, proc_get_stats_rx, dev); + + if (!e) { + RT_TRACE(COMP_ERR,"Unable to initialize " + "/proc/net/rtl8192/%s/stats-rx\n", + dev->name); + } + + + e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO, + priv->dir_dev, proc_get_stats_tx, dev); + + if (!e) { + RT_TRACE(COMP_ERR, "Unable to initialize " + "/proc/net/rtl8192/%s/stats-tx\n", + dev->name); + } + #if 0 + e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO, + priv->dir_dev, proc_get_stats_ieee, dev); + + if (!e) { + DMESGE("Unable to initialize " + "/proc/net/rtl8192/%s/stats-ieee\n", + dev->name); + } + + #endif + + e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO, + priv->dir_dev, proc_get_stats_ap, dev); + + if (!e) { + RT_TRACE(COMP_ERR, "Unable to initialize " + "/proc/net/rtl8192/%s/stats-ap\n", + dev->name); + } + + e = create_proc_read_entry("registers", S_IFREG | S_IRUGO, + priv->dir_dev, proc_get_registers, dev); + if (!e) { + RT_TRACE(COMP_ERR, "Unable to initialize " + "/proc/net/rtl8192/%s/registers\n", + dev->name); + } +#if 0 + e = create_proc_read_entry("cck-registers", S_IFREG | S_IRUGO, + priv->dir_dev, proc_get_cck_reg, dev); + if (!e) { + RT_TRACE(COMP_ERR, "Unable to initialize " + "/proc/net/rtl8192/%s/cck-registers\n", + dev->name); + } + + e = create_proc_read_entry("ofdm-registers", S_IFREG | S_IRUGO, + priv->dir_dev, proc_get_ofdm_reg, dev); + if (!e) { + RT_TRACE(COMP_ERR, "Unable to initialize " + "/proc/net/rtl8192/%s/ofdm-registers\n", + dev->name); + } +#endif +} +/**************************************************************************** + -----------------------------MISC STUFF------------------------- +*****************************************************************************/ + +/* this is only for debugging */ +void print_buffer(u32 *buffer, int len) +{ + int i; + u8 *buf =(u8*)buffer; + + printk("ASCII BUFFER DUMP (len: %x):\n",len); + + for(i=0;itx_pending[queue_index]); + + return (used < MAX_TX_URB); +} + +void tx_timeout(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + //rtl8192_commit(dev); + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) + schedule_work(&priv->reset_wq); +#else + schedule_task(&priv->reset_wq); +#endif + //DMESG("TXTIMEOUT"); +} + + +/* this is only for debug */ +void dump_eprom(struct net_device *dev) +{ + int i; + for(i=0; i<63; i++) + RT_TRACE(COMP_EPROM, "EEPROM addr %x : %x", i, eprom_read(dev,i)); +} + +/* this is only for debug */ +void rtl8192_dump_reg(struct net_device *dev) +{ + int i; + int n; + int max=0x1ff; + + RT_TRACE(COMP_PHY, "Dumping NIC register map"); + + for(n=0;n<=max;) + { + printk( "\nD: %2x> ", n); + for(i=0;i<16 && n<=max;i++,n++) + printk("%2x ",read_nic_byte(dev,n)); + } + printk("\n"); +} + +/**************************************************************************** + ------------------------------HW STUFF--------------------------- +*****************************************************************************/ + +#if 0 +void rtl8192_irq_enable(struct net_device *dev) +{ + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + //priv->irq_enabled = 1; +/* + write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\ + INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\ + INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\ + INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT); +*/ + write_nic_word(dev,INTA_MASK, priv->irq_mask); +} + + +void rtl8192_irq_disable(struct net_device *dev) +{ +// struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + + write_nic_word(dev,INTA_MASK,0); + force_pci_posting(dev); +// priv->irq_enabled = 0; +} +#endif + +void rtl8192_set_mode(struct net_device *dev,int mode) +{ + u8 ecmd; + ecmd=read_nic_byte(dev, EPROM_CMD); + ecmd=ecmd &~ EPROM_CMD_OPERATING_MODE_MASK; + ecmd=ecmd | (mode<ieee80211->state == IEEE80211_LINKED){ + + if (priv->ieee80211->iw_mode == IW_MODE_INFRA) + msr |= (MSR_LINK_MANAGED<ieee80211->iw_mode == IW_MODE_ADHOC) + msr |= (MSR_LINK_ADHOC<ieee80211->iw_mode == IW_MODE_MASTER) + msr |= (MSR_LINK_MASTER<%s()====ch:%d\n", __FUNCTION__, ch); + priv->chan=ch; + #if 0 + if(priv->ieee80211->iw_mode == IW_MODE_ADHOC || + priv->ieee80211->iw_mode == IW_MODE_MASTER){ + + priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED; + priv->ieee80211->master_chan = ch; + rtl8192_update_beacon_ch(dev); + } + #endif + + /* this hack should avoid frame TX during channel setting*/ + + +// tx = read_nic_dword(dev,TX_CONF); +// tx &= ~TX_LOOPBACK_MASK; + +#ifndef LOOP_TEST +// write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<rf_set_chan) + priv->rf_set_chan(dev,priv->chan); + mdelay(10); +// write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<bisrxaggrsubframe) + return (sizeof(rx_desc_819x_usb) + pstats->RxDrvInfoSize + + pstats->RxBufShift + 8); + else +#endif + return (sizeof(rx_desc_819x_usb) + pstats->RxDrvInfoSize + + pstats->RxBufShift); + +} +static int rtl8192_rx_initiate(struct net_device*dev) +{ + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + struct urb *entry; + struct sk_buff *skb; + struct rtl8192_rx_info *info; + + /* nomal packet rx procedure */ + while (skb_queue_len(&priv->rx_queue) < MAX_RX_URB) { + skb = __dev_alloc_skb(RX_URB_SIZE, GFP_KERNEL); + if (!skb) + break; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + entry = usb_alloc_urb(0, GFP_KERNEL); +#else + entry = usb_alloc_urb(0); +#endif + if (!entry) { + kfree_skb(skb); + break; + } +// printk("nomal packet IN request!\n"); + usb_fill_bulk_urb(entry, priv->udev, + usb_rcvbulkpipe(priv->udev, 3), skb->tail, + RX_URB_SIZE, rtl8192_rx_isr, skb); + info = (struct rtl8192_rx_info *) skb->cb; + info->urb = entry; + info->dev = dev; + info->out_pipe = 3; //denote rx normal packet queue + skb_queue_tail(&priv->rx_queue, skb); +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + usb_submit_urb(entry, GFP_KERNEL); +#else + usb_submit_urb(entry); +#endif + } + + /* command packet rx procedure */ + while (skb_queue_len(&priv->rx_queue) < MAX_RX_URB + 3) { +// printk("command packet IN request!\n"); + skb = __dev_alloc_skb(RX_URB_SIZE ,GFP_KERNEL); + if (!skb) + break; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + entry = usb_alloc_urb(0, GFP_KERNEL); +#else + entry = usb_alloc_urb(0); +#endif + if (!entry) { + kfree_skb(skb); + break; + } + usb_fill_bulk_urb(entry, priv->udev, + usb_rcvbulkpipe(priv->udev, 9), skb->tail, + RX_URB_SIZE, rtl8192_rx_isr, skb); + info = (struct rtl8192_rx_info *) skb->cb; + info->urb = entry; + info->dev = dev; + info->out_pipe = 9; //denote rx cmd packet queue + skb_queue_tail(&priv->rx_queue, skb); +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + usb_submit_urb(entry, GFP_KERNEL); +#else + usb_submit_urb(entry); +#endif + } + + return 0; +} + +void rtl8192_set_rxconf(struct net_device *dev) +{ + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + u32 rxconf; + + rxconf=read_nic_dword(dev,RCR); + rxconf = rxconf &~ MAC_FILTER_MASK; + rxconf = rxconf | RCR_AMF; + rxconf = rxconf | RCR_ADF; + rxconf = rxconf | RCR_AB; + rxconf = rxconf | RCR_AM; + //rxconf = rxconf | RCR_ACF; + + if (dev->flags & IFF_PROMISC) {DMESG ("NIC in promisc mode");} + + if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \ + dev->flags & IFF_PROMISC){ + rxconf = rxconf | RCR_AAP; + } /*else if(priv->ieee80211->iw_mode == IW_MODE_MASTER){ + rxconf = rxconf | (1<ieee80211->iw_mode == IW_MODE_MONITOR){ + rxconf = rxconf | RCR_AICV; + rxconf = rxconf | RCR_APWRMGT; + } + + if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR) + rxconf = rxconf | RCR_ACRC32; + + + rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK; + rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<card_8187) { + cmd=read_nic_byte(dev,CMD); + write_nic_byte(dev,CMD,cmd | (1<ReceiveConfig); + } +#endif +} + + +void rtl8192_tx_enable(struct net_device *dev) +{ +#if 0 + u8 cmd; + u8 byte; + u32 txconf; + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + //test loopback + // priv->TransmitConfig |= (TX_LOOPBACK_BASEBAND<card_8187){ + write_nic_dword(dev, TX_CONF, priv->TransmitConfig); + byte = read_nic_byte(dev, MSR); + byte |= MSR_LINK_ENEDCA; + write_nic_byte(dev, MSR, byte); + } else { + byte = read_nic_byte(dev,CW_CONF); + byte &= ~(1<retry_data<retry_rts<dma_poll_mask &=~(1<dma_poll_mask); + rtl8192_set_mode(dev,EPROM_CMD_NORMAL); +} + + +void rtl8192_ +_disable(struct net_device *dev) +{ + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + priv->dma_poll_mask |= (1<dma_poll_mask); + rtl8192_set_mode(dev,EPROM_CMD_NORMAL); +} + +#endif + + +void rtl8192_rtx_disable(struct net_device *dev) +{ + u8 cmd; + struct r8192_priv *priv = ieee80211_priv(dev); + struct sk_buff *skb; + struct rtl8192_rx_info *info; + + cmd=read_nic_byte(dev,CMDR); + write_nic_byte(dev, CMDR, cmd &~ \ + (CR_TE|CR_RE)); + force_pci_posting(dev); + mdelay(10); + + while ((skb = __skb_dequeue(&priv->rx_queue))) { + info = (struct rtl8192_rx_info *) skb->cb; + if (!info->urb) + continue; + + usb_kill_urb(info->urb); + kfree_skb(skb); + } + + if (skb_queue_len(&priv->skb_queue)) { + printk(KERN_WARNING "skb_queue not empty\n"); + } + + skb_queue_purge(&priv->skb_queue); + return; +} + + +int alloc_tx_beacon_desc_ring(struct net_device *dev, int count) +{ + #if 0 + int i; + u32 *tmp; + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + + priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev, + sizeof(u32)*8*count, + &priv->txbeaconringdma); + if (!priv->txbeaconring) return -1; + for (tmp=priv->txbeaconring,i=0;itxbeaconringdma+((i+1)*8*4); + else + *(tmp+4) = (u32)priv->txbeaconringdma; + + tmp=tmp+8; + } + #endif + return 0; +} + +#if 0 +void rtl8192_reset(struct net_device *dev) +{ + + //struct r8192_priv *priv = ieee80211_priv(dev); + //u8 cr; + + + /* make sure the analog power is on before + * reset, otherwise reset may fail + */ +#if 0 + if(NIC_8187 == priv->card_8187) { + rtl8192_set_anaparam(dev, RTL8225_ANAPARAM_ON); + rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON); + rtl8192_irq_disable(dev); + mdelay(200); + write_nic_byte_E(dev,0x18,0x10); + write_nic_byte_E(dev,0x18,0x11); + write_nic_byte_E(dev,0x18,0x00); + mdelay(200); + } +#endif + printk("=====>reset?\n"); +#if 0 + cr=read_nic_byte(dev,CMD); + cr = cr & 2; + cr = cr | (1<card_8187) { + + printk("This is RTL8187 Reset procedure\n"); + rtl8192_set_mode(dev,EPROM_CMD_LOAD); + force_pci_posting(dev); + mdelay(200); + + /* after the eeprom load cycle, make sure we have + * correct anaparams + */ + rtl8192_set_anaparam(dev, RTL8225_ANAPARAM_ON); + rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON); + } + else +#endif + printk("This is RTL8187B Reset procedure\n"); + +} +#endif +inline u16 ieeerate2rtlrate(int rate) +{ + switch(rate){ + case 10: + return 0; + case 20: + return 1; + case 55: + return 2; + case 110: + return 3; + case 60: + return 4; + case 90: + return 5; + case 120: + return 6; + case 180: + return 7; + case 240: + return 8; + case 360: + return 9; + case 480: + return 10; + case 540: + return 11; + default: + return 3; + + } +} +static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540}; +inline u16 rtl8192_rate2rate(short rate) +{ + if (rate >11) return 0; + return rtl_rate[rate]; +} + + +/* The protype of rx_isr has changed since one verion of Linux Kernel */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) +static void rtl8192_rx_isr(struct urb *urb, struct pt_regs *regs) +#else +static void rtl8192_rx_isr(struct urb *urb) +#endif +{ + struct sk_buff *skb = (struct sk_buff *) urb->context; + struct rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; + struct net_device *dev = info->dev; + struct r8192_priv *priv = ieee80211_priv(dev); + int out_pipe = info->out_pipe; + int err; + if(!priv->up) + return; + if (unlikely(urb->status)) { + info->urb = NULL; + priv->stats.rxstaterr++; + priv->ieee80211->stats.rx_errors++; + usb_free_urb(urb); + // printk("%s():rx status err\n",__FUNCTION__); + return; + } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14) + skb_unlink(skb, &priv->rx_queue); +#else + __skb_unlink(skb,&priv->rx_queue); +#endif + skb_put(skb, urb->actual_length); + + skb_queue_tail(&priv->skb_queue, skb); + tasklet_schedule(&priv->irq_rx_tasklet); + + skb = dev_alloc_skb(RX_URB_SIZE); + if (unlikely(!skb)) { + usb_free_urb(urb); + printk("%s():can,t alloc skb\n",__FUNCTION__); + /* TODO check rx queue length and refill *somewhere* */ + return; + } + + usb_fill_bulk_urb(urb, priv->udev, + usb_rcvbulkpipe(priv->udev, out_pipe), skb->tail, + RX_URB_SIZE, rtl8192_rx_isr, skb); + + info = (struct rtl8192_rx_info *) skb->cb; + info->urb = urb; + info->dev = dev; + info->out_pipe = out_pipe; + + urb->transfer_buffer = skb->tail; + urb->context = skb; + skb_queue_tail(&priv->rx_queue, skb); +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + err = usb_submit_urb(urb, GFP_ATOMIC); +#else + err = usb_submit_urb(urb); +#endif + if(err && err != EPERM) + printk("can not submit rxurb, err is %x,URB status is %x\n",err,urb->status); +} + +u32 +rtl819xusb_rx_command_packet( + struct net_device *dev, + struct ieee80211_rx_stats *pstats + ) +{ + u32 status; + + //RT_TRACE(COMP_RECV, DBG_TRACE, ("---> RxCommandPacketHandle819xUsb()\n")); + + status = cmpk_message_handle_rx(dev, pstats); + if (status) + { + DMESG("rxcommandpackethandle819xusb: It is a command packet\n"); + } + else + { + //RT_TRACE(COMP_RECV, DBG_TRACE, ("RxCommandPacketHandle819xUsb: It is not a command packet\n")); + } + + //RT_TRACE(COMP_RECV, DBG_TRACE, ("<--- RxCommandPacketHandle819xUsb()\n")); + return status; +} + +#if 0 +void rtl8192_tx_queues_stop(struct net_device *dev) +{ + //struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + u8 dma_poll_mask = (1<dma_poll_mask |= (1<dma_poll_mask); + rtl8192_set_mode(dev,EPROM_CMD_NORMAL); + #endif +} + + +void rtl8192_data_hard_resume(struct net_device *dev) +{ + // FIXME !! + #if 0 + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + priv->dma_poll_mask &= ~(1<dma_poll_mask); + rtl8192_set_mode(dev,EPROM_CMD_NORMAL); + #endif +} + +/* this function TX data frames when the ieee80211 stack requires this. + * It checks also if we need to stop the ieee tx queue, eventually do it + */ +void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate) +{ + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + int ret; + unsigned long flags; + cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + u8 queue_index = tcb_desc->queue_index; + + /* shall not be referred by command packet */ + assert(queue_index != TXCMD_QUEUE); + + spin_lock_irqsave(&priv->tx_lock,flags); + + memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); +// tcb_desc->RATRIndex = 7; +// tcb_desc->bTxDisableRateFallBack = 1; +// tcb_desc->bTxUseDriverAssingedRate = 1; + tcb_desc->bTxEnableFwCalcDur = 1; + skb_push(skb, priv->ieee80211->tx_headroom); + ret = rtl8192_tx(dev, skb); + + //priv->ieee80211->stats.tx_bytes+=(skb->len - priv->ieee80211->tx_headroom); + //priv->ieee80211->stats.tx_packets++; + + spin_unlock_irqrestore(&priv->tx_lock,flags); + +// return ret; + return; +} + +/* This is a rough attempt to TX a frame + * This is called by the ieee 80211 stack to TX management frames. + * If the ring is full packet are dropped (for data frame the queue + * is stopped before this can happen). + */ +int rtl8192_hard_start_xmit(struct sk_buff *skb,struct net_device *dev) +{ + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + int ret; + unsigned long flags; + cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + u8 queue_index = tcb_desc->queue_index; + + + spin_lock_irqsave(&priv->tx_lock,flags); + + memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); + if(queue_index == TXCMD_QUEUE) { + skb_push(skb, USB_HWDESC_HEADER_LEN); + rtl819xU_tx_cmd(dev, skb); + ret = 1; + spin_unlock_irqrestore(&priv->tx_lock,flags); + return ret; + } else { + skb_push(skb, priv->ieee80211->tx_headroom); + ret = rtl8192_tx(dev, skb); + } + + spin_unlock_irqrestore(&priv->tx_lock,flags); + + return ret; +} + + +void rtl8192_try_wake_queue(struct net_device *dev, int pri); + +#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE +u16 DrvAggr_PaddingAdd(struct net_device *dev, struct sk_buff *skb) +{ + u16 PaddingNum = 256 - ((skb->len + TX_PACKET_DRVAGGR_SUBFRAME_SHIFT_BYTES) % 256); + return (PaddingNum&0xff); +} + +u8 MRateToHwRate8190Pci(u8 rate); +u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc); +u8 MapHwQueueToFirmwareQueue(u8 QueueID); +struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv_agg_txb *pSendList) +{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) + struct ieee80211_device *ieee = netdev_priv(dev); +#else + struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv; +#endif + struct r8192_priv *priv = ieee80211_priv(dev); + cb_desc *tcb_desc = NULL; + u8 i; + u32 TotalLength; + struct sk_buff *skb; + struct sk_buff *agg_skb; + tx_desc_819x_usb_aggr_subframe *tx_agg_desc = NULL; + tx_fwinfo_819x_usb *tx_fwinfo = NULL; + + // + // Local variable initialization. + // + /* first skb initialization */ + skb = pSendList->tx_agg_frames[0]; + TotalLength = skb->len; + + /* Get the total aggregation length including the padding space and + * sub frame header. + */ + for(i = 1; i < pSendList->nr_drv_agg_frames; i++) { + TotalLength += DrvAggr_PaddingAdd(dev, skb); + skb = pSendList->tx_agg_frames[i]; + TotalLength += (skb->len + TX_PACKET_DRVAGGR_SUBFRAME_SHIFT_BYTES); + } + + /* allocate skb to contain the aggregated packets */ + agg_skb = dev_alloc_skb(TotalLength + ieee->tx_headroom); + memset(agg_skb->data, 0, agg_skb->len); + skb_reserve(agg_skb, ieee->tx_headroom); + +// RT_DEBUG_DATA(COMP_SEND, skb->cb, sizeof(skb->cb)); + /* reserve info for first subframe Tx descriptor to be set in the tx function */ + skb = pSendList->tx_agg_frames[0]; + tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + tcb_desc->drv_agg_enable = 1; + tcb_desc->pkt_size = skb->len; + tcb_desc->DrvAggrNum = pSendList->nr_drv_agg_frames; + printk("DrvAggNum = %d\n", tcb_desc->DrvAggrNum); +// RT_DEBUG_DATA(COMP_SEND, skb->cb, sizeof(skb->cb)); +// printk("========>skb->data ======> \n"); +// RT_DEBUG_DATA(COMP_SEND, skb->data, skb->len); + memcpy(agg_skb->cb, skb->cb, sizeof(skb->cb)); + memcpy(skb_put(agg_skb,skb->len),skb->data,skb->len); + + for(i = 1; i < pSendList->nr_drv_agg_frames; i++) { + /* push the next sub frame to be 256 byte aline */ + skb_put(agg_skb,DrvAggr_PaddingAdd(dev,skb)); + + /* Subframe drv Tx descriptor and firmware info setting */ + skb = pSendList->tx_agg_frames[i]; + tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + tx_agg_desc = (tx_desc_819x_usb_aggr_subframe *)agg_skb->tail; + tx_fwinfo = (tx_fwinfo_819x_usb *)(agg_skb->tail + sizeof(tx_desc_819x_usb_aggr_subframe)); + + memset(tx_fwinfo,0,sizeof(tx_fwinfo_819x_usb)); + /* DWORD 0 */ + tx_fwinfo->TxHT = (tcb_desc->data_rate&0x80)?1:0; + tx_fwinfo->TxRate = MRateToHwRate8190Pci(tcb_desc->data_rate); + tx_fwinfo->EnableCPUDur = tcb_desc->bTxEnableFwCalcDur; + tx_fwinfo->Short = QueryIsShort(tx_fwinfo->TxHT, tx_fwinfo->TxRate, tcb_desc); + if(tcb_desc->bAMPDUEnable) {//AMPDU enabled + tx_fwinfo->AllowAggregation = 1; + /* DWORD 1 */ + tx_fwinfo->RxMF = tcb_desc->ampdu_factor; + tx_fwinfo->RxAMD = tcb_desc->ampdu_density&0x07;//ampdudensity + } else { + tx_fwinfo->AllowAggregation = 0; + /* DWORD 1 */ + tx_fwinfo->RxMF = 0; + tx_fwinfo->RxAMD = 0; + } + + /* Protection mode related */ + tx_fwinfo->RtsEnable = (tcb_desc->bRTSEnable)?1:0; + tx_fwinfo->CtsEnable = (tcb_desc->bCTSEnable)?1:0; + tx_fwinfo->RtsSTBC = (tcb_desc->bRTSSTBC)?1:0; + tx_fwinfo->RtsHT = (tcb_desc->rts_rate&0x80)?1:0; + tx_fwinfo->RtsRate = MRateToHwRate8190Pci((u8)tcb_desc->rts_rate); + tx_fwinfo->RtsSubcarrier = (tx_fwinfo->RtsHT==0)?(tcb_desc->RTSSC):0; + tx_fwinfo->RtsBandwidth = (tx_fwinfo->RtsHT==1)?((tcb_desc->bRTSBW)?1:0):0; + tx_fwinfo->RtsShort = (tx_fwinfo->RtsHT==0)?(tcb_desc->bRTSUseShortPreamble?1:0):\ + (tcb_desc->bRTSUseShortGI?1:0); + + /* Set Bandwidth and sub-channel settings. */ + if(priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20_40) + { + if(tcb_desc->bPacketBW) { + tx_fwinfo->TxBandwidth = 1; + tx_fwinfo->TxSubCarrier = 0; //By SD3's Jerry suggestion, use duplicated mode + } else { + tx_fwinfo->TxBandwidth = 0; + tx_fwinfo->TxSubCarrier = priv->nCur40MhzPrimeSC; + } + } else { + tx_fwinfo->TxBandwidth = 0; + tx_fwinfo->TxSubCarrier = 0; + } + + /* Fill Tx descriptor */ + memset(tx_agg_desc, 0, sizeof(tx_desc_819x_usb_aggr_subframe)); + /* DWORD 0 */ + //tx_agg_desc->LINIP = 0; + //tx_agg_desc->CmdInit = 1; + tx_agg_desc->Offset = sizeof(tx_fwinfo_819x_usb) + 8; + /* already raw data, need not to substract header length */ + tx_agg_desc->PktSize = skb->len & 0xffff; + + /*DWORD 1*/ + tx_agg_desc->SecCAMID= 0; + tx_agg_desc->RATid = tcb_desc->RATRIndex; +#if 0 + /* Fill security related */ + if( pTcb->bEncrypt && !Adapter->MgntInfo.SecurityInfo.SWTxEncryptFlag) + { + EncAlg = SecGetEncryptionOverhead( + Adapter, + &EncryptionMPDUHeadOverhead, + &EncryptionMPDUTailOverhead, + NULL, + NULL, + FALSE, + FALSE); + //2004/07/22, kcwu, EncryptionMPDUHeadOverhead has been added in previous code + //MPDUOverhead = EncryptionMPDUHeadOverhead + EncryptionMPDUTailOverhead; + MPDUOverhead = EncryptionMPDUTailOverhead; + tx_agg_desc->NoEnc = 0; + RT_TRACE(COMP_SEC, DBG_LOUD, ("******We in the loop SecCAMID is %d SecDescAssign is %d The Sec is %d********\n",tx_agg_desc->SecCAMID,tx_agg_desc->SecDescAssign,EncAlg)); + //CamDumpAll(Adapter); + } + else +#endif + { + //MPDUOverhead = 0; + tx_agg_desc->NoEnc = 1; + } +#if 0 + switch(EncAlg){ + case NO_Encryption: + tx_agg_desc->SecType = 0x0; + break; + case WEP40_Encryption: + case WEP104_Encryption: + tx_agg_desc->SecType = 0x1; + break; + case TKIP_Encryption: + tx_agg_desc->SecType = 0x2; + break; + case AESCCMP_Encryption: + tx_agg_desc->SecType = 0x3; + break; + default: + tx_agg_desc->SecType = 0x0; + break; + } +#else + tx_agg_desc->SecType = 0x0; +#endif + + if (tcb_desc->bHwSec) { + switch (priv->ieee80211->pairwise_key_type) + { + case KEY_TYPE_WEP40: + case KEY_TYPE_WEP104: + tx_agg_desc->SecType = 0x1; + tx_agg_desc->NoEnc = 0; + break; + case KEY_TYPE_TKIP: + tx_agg_desc->SecType = 0x2; + tx_agg_desc->NoEnc = 0; + break; + case KEY_TYPE_CCMP: + tx_agg_desc->SecType = 0x3; + tx_agg_desc->NoEnc = 0; + break; + case KEY_TYPE_NA: + tx_agg_desc->SecType = 0x0; + tx_agg_desc->NoEnc = 1; + break; + } + } + + tx_agg_desc->QueueSelect = MapHwQueueToFirmwareQueue(tcb_desc->queue_index); + tx_agg_desc->TxFWInfoSize = sizeof(tx_fwinfo_819x_usb); + + tx_agg_desc->DISFB = tcb_desc->bTxDisableRateFallBack; + tx_agg_desc->USERATE = tcb_desc->bTxUseDriverAssingedRate; + + tx_agg_desc->OWN = 1; + + //DWORD 2 + /* According windows driver, it seems that there no need to fill this field */ + //tx_agg_desc->TxBufferSize= (u32)(skb->len - USB_HWDESC_HEADER_LEN); + + /* to fill next packet */ + skb_put(agg_skb,TX_PACKET_DRVAGGR_SUBFRAME_SHIFT_BYTES); + memcpy(skb_put(agg_skb,skb->len),skb->data,skb->len); + } + + for(i = 0; i < pSendList->nr_drv_agg_frames; i++) { + dev_kfree_skb_any(pSendList->tx_agg_frames[i]); + } + + return agg_skb; +} + +/* NOTE: + This function return a list of PTCB which is proper to be aggregate with the input TCB. + If no proper TCB is found to do aggregation, SendList will only contain the input TCB. +*/ +u8 DrvAggr_GetAggregatibleList(struct net_device *dev, struct sk_buff *skb, + struct ieee80211_drv_agg_txb *pSendList) +{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) + struct ieee80211_device *ieee = netdev_priv(dev); +#else + struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv; +#endif + PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; + u16 nMaxAggrNum = pHTInfo->UsbTxAggrNum; + cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + u8 QueueID = tcb_desc->queue_index; + + do { + pSendList->tx_agg_frames[pSendList->nr_drv_agg_frames++] = skb; + if(pSendList->nr_drv_agg_frames >= nMaxAggrNum) { + break; + } + + } while((skb = skb_dequeue(&ieee->skb_drv_aggQ[QueueID]))); + + RT_TRACE(COMP_AMSDU, "DrvAggr_GetAggregatibleList, nAggrTcbNum = %d \n", pSendList->nr_drv_agg_frames); + return pSendList->nr_drv_agg_frames; +} +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) +static void rtl8192_tx_isr(struct urb *tx_urb, struct pt_regs *reg) +#else +static void rtl8192_tx_isr(struct urb *tx_urb) +#endif +{ + struct sk_buff *skb = (struct sk_buff*)tx_urb->context; + struct net_device *dev = NULL; + struct r8192_priv *priv = NULL; + cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + u8 queue_index = tcb_desc->queue_index; +// bool bToSend0Byte; +// u16 BufLen = skb->len; + + memcpy(&dev,(struct net_device*)(skb->cb),sizeof(struct net_device*)); + priv = ieee80211_priv(dev); + + if(tcb_desc->queue_index != TXCMD_QUEUE) { + if(tx_urb->status == 0) { + dev->trans_start = jiffies; + // As act as station mode, destion shall be unicast address. + //priv->ieee80211->stats.tx_bytes+=(skb->len - priv->ieee80211->tx_headroom); + //priv->ieee80211->stats.tx_packets++; + priv->stats.txoktotal++; + priv->ieee80211->LinkDetectInfo.NumTxOkInPeriod++; + priv->stats.txbytesunicast += (skb->len - priv->ieee80211->tx_headroom); + } else { + priv->ieee80211->stats.tx_errors++; + //priv->stats.txmanageerr++; + /* TODO */ + } + } + + /* free skb and tx_urb */ + if(skb != NULL) { + dev_kfree_skb_any(skb); + usb_free_urb(tx_urb); + atomic_dec(&priv->tx_pending[queue_index]); + } + +#if 0 //we need to send zero byte packet just after 512 byte(64 byte)packet is transmitted, or we will halt. It will greatly reduced available page in FW, and ruin our throughput. WB 2008.08.27 + if(BufLen > 0 && ((BufLen % 512 == 0)||(BufLen % 64 == 0))) { + bToSend0Byte = true; + } + + bToSend0Byte = false; + // + // Note that, we at most handle 1 MPDU to send here, either + // fragment or MPDU in wait queue. + // + if(!bToSend0Byte) +#endif + { + // + // Handle HW Beacon: + // We had transfer our beacon frame to host controler at this moment. + // +#if 0 + if(tcb_desc->tx_queue == BEACON_QUEUE) + { + priv->bSendingBeacon = FALSE; + } +#endif + // + // Caution: + // Handling the wait queue of command packets. + // For Tx command packets, we must not do TCB fragment because it is not handled right now. + // We must cut the packets to match the size of TX_CMD_PKT before we send it. + // + + /* Handle MPDU in wait queue. */ + if(queue_index != BEACON_QUEUE) { + /* Don't send data frame during scanning.*/ + if((skb_queue_len(&priv->ieee80211->skb_waitQ[queue_index]) != 0)&&\ + (!(priv->ieee80211->queue_stop))) { + if(NULL != (skb = skb_dequeue(&(priv->ieee80211->skb_waitQ[queue_index])))) + priv->ieee80211->softmac_hard_start_xmit(skb, dev); + + return; //modified by david to avoid further processing AMSDU + } +#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE + else if ((skb_queue_len(&priv->ieee80211->skb_drv_aggQ[queue_index])!= 0)&&\ + (!(priv->ieee80211->queue_stop))) { + // Tx Driver Aggregation process + /* The driver will aggregation the packets according to the following stets + * 1. check whether there's tx irq available, for it's a completion return + * function, it should contain enough tx irq; + * 2. check pakcet type; + * 3. intialize sendlist, check whether the to-be send packet no greater than 1 + * 4. aggregation the packets, and fill firmware info and tx desc to it, etc. + * 5. check whehter the packet could be sent, otherwise just insert to wait head + * */ + skb = skb_dequeue(&priv->ieee80211->skb_drv_aggQ[queue_index]); + if(!check_nic_enough_desc(dev, queue_index)) { + skb_queue_head(&(priv->ieee80211->skb_drv_aggQ[queue_index]), skb); + return; + } + + { + /*TODO*/ + /* + u8* pHeader = skb->data; + + if(IsMgntQosData(pHeader) || + IsMgntQData_Ack(pHeader) || + IsMgntQData_Poll(pHeader) || + IsMgntQData_Poll_Ack(pHeader) + ) + */ + { + struct ieee80211_drv_agg_txb SendList; + + memset(&SendList, 0, sizeof(struct ieee80211_drv_agg_txb)); + if(DrvAggr_GetAggregatibleList(dev, skb, &SendList) > 1) { + skb = DrvAggr_Aggregation(dev, &SendList); + +#if 0 + printk("=============>to send aggregated packet!\n"); + RT_DEBUG_DATA(COMP_SEND, skb->cb, sizeof(skb->cb)); + printk("\n=================skb->len = %d\n", skb->len); + RT_DEBUG_DATA(COMP_SEND, skb->data, skb->len); +#endif + } + } + priv->ieee80211->softmac_hard_start_xmit(skb, dev); + } + } +#endif + } + } + +#if 0 + else + { + RT_TRACE( COMP_SEND,"HalUsbOutComplete(%d): bToSend0Byte.\n", PipeIndex); + + // + // In this case, we don't return skb now. + // It will be returned when the 0-byte request completed. + // + + // + // Bulk out an 0-byte padding transfer. + // + HalUsbOut0Byte(pAdapter, PipeIndex, skb); + } + +#endif +} + +void rtl8192_beacon_stop(struct net_device *dev) +{ + u8 msr, msrm, msr2; + struct r8192_priv *priv = ieee80211_priv(dev); + + msr = read_nic_byte(dev, MSR); + msrm = msr & MSR_LINK_MASK; + msr2 = msr & ~MSR_LINK_MASK; + + if(NIC_8192U == priv->card_8192) { + usb_kill_urb(priv->rx_urb[MAX_RX_URB]); + } + if ((msrm == (MSR_LINK_ADHOC<ieee80211->current_network; + + for (i=0; irates_len; i++) + { + basic_rate = net->rates[i]&0x7f; + switch(basic_rate) + { + case MGN_1M: *rate_config |= RRSR_1M; break; + case MGN_2M: *rate_config |= RRSR_2M; break; + case MGN_5_5M: *rate_config |= RRSR_5_5M; break; + case MGN_11M: *rate_config |= RRSR_11M; break; + case MGN_6M: *rate_config |= RRSR_6M; break; + case MGN_9M: *rate_config |= RRSR_9M; break; + case MGN_12M: *rate_config |= RRSR_12M; break; + case MGN_18M: *rate_config |= RRSR_18M; break; + case MGN_24M: *rate_config |= RRSR_24M; break; + case MGN_36M: *rate_config |= RRSR_36M; break; + case MGN_48M: *rate_config |= RRSR_48M; break; + case MGN_54M: *rate_config |= RRSR_54M; break; + } + } + for (i=0; irates_ex_len; i++) + { + basic_rate = net->rates_ex[i]&0x7f; + switch(basic_rate) + { + case MGN_1M: *rate_config |= RRSR_1M; break; + case MGN_2M: *rate_config |= RRSR_2M; break; + case MGN_5_5M: *rate_config |= RRSR_5_5M; break; + case MGN_11M: *rate_config |= RRSR_11M; break; + case MGN_6M: *rate_config |= RRSR_6M; break; + case MGN_9M: *rate_config |= RRSR_9M; break; + case MGN_12M: *rate_config |= RRSR_12M; break; + case MGN_18M: *rate_config |= RRSR_18M; break; + case MGN_24M: *rate_config |= RRSR_24M; break; + case MGN_36M: *rate_config |= RRSR_36M; break; + case MGN_48M: *rate_config |= RRSR_48M; break; + case MGN_54M: *rate_config |= RRSR_54M; break; + } + } +} + + +#define SHORT_SLOT_TIME 9 +#define NON_SHORT_SLOT_TIME 20 + +void rtl8192_update_cap(struct net_device* dev, u16 cap) +{ + u32 tmp = 0; + struct r8192_priv *priv = ieee80211_priv(dev); + struct ieee80211_network *net = &priv->ieee80211->current_network; + priv->short_preamble = cap & WLAN_CAPABILITY_SHORT_PREAMBLE; + tmp = priv->basic_rate; + if (priv->short_preamble) + tmp |= BRSR_AckShortPmb; + write_nic_dword(dev, RRSR, tmp); + + if (net->mode & (IEEE_G|IEEE_N_24G)) + { + u8 slot_time = 0; + if ((cap & WLAN_CAPABILITY_SHORT_SLOT)&&(!priv->ieee80211->pHTInfo->bCurrentRT2RTLongSlotTime)) + {//short slot time + slot_time = SHORT_SLOT_TIME; + } + else //long slot time + slot_time = NON_SHORT_SLOT_TIME; + priv->slot_time = slot_time; + write_nic_byte(dev, SLOT_TIME, slot_time); + } + +} +void rtl8192_net_update(struct net_device *dev) +{ + + struct r8192_priv *priv = ieee80211_priv(dev); + struct ieee80211_network *net; + u16 BcnTimeCfg = 0, BcnCW = 6, BcnIFS = 0xf; + u16 rate_config = 0; + net = & priv->ieee80211->current_network; + + rtl8192_config_rate(dev, &rate_config); + priv->basic_rate = rate_config &= 0x15f; + + write_nic_dword(dev,BSSIDR,((u32*)net->bssid)[0]); + write_nic_word(dev,BSSIDR+4,((u16*)net->bssid)[2]); + //for(i=0;ibssid[i]); + + rtl8192_update_msr(dev); +// rtl8192_update_cap(dev, net->capability); + if (priv->ieee80211->iw_mode == IW_MODE_ADHOC) + { + write_nic_word(dev, ATIMWND, 2); + write_nic_word(dev, BCN_DMATIME, 1023); + write_nic_word(dev, BCN_INTERVAL, net->beacon_interval); +// write_nic_word(dev, BcnIntTime, 100); + write_nic_word(dev, BCN_DRV_EARLY_INT, 1); + write_nic_byte(dev, BCN_ERR_THRESH, 100); + BcnTimeCfg |= (BcnCW<ieee80211); + if(!skb){ + DMESG("not enought memory for allocating beacon"); + return; + } + + + write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7)); + + i=0; + //while(!read_nic_byte(dev,BQREQ & (1<<7))) + while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 ) + { + msleep_interruptible_rtl(HZ/2); + if(i++ > 10){ + DMESGW("get stuck to wait HW beacon to be ready"); + return ; + } + } + skb->cb[0] = NORM_PRIORITY; + skb->cb[1] = 0; //morefragment = 0 + skb->cb[2] = ieeerate2rtlrate(tx_rate); + + rtl8192_tx(dev,skb); + +#endif +} +#endif +inline u8 rtl8192_IsWirelessBMode(u16 rate) +{ + if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) ) + return 1; + else return 0; +} + +u16 N_DBPSOfRate(u16 DataRate); + +u16 ComputeTxTime( + u16 FrameLength, + u16 DataRate, + u8 bManagementFrame, + u8 bShortPreamble +) +{ + u16 FrameTime; + u16 N_DBPS; + u16 Ceiling; + + if( rtl8192_IsWirelessBMode(DataRate) ) + { + if( bManagementFrame || !bShortPreamble || DataRate == 10 ) + { // long preamble + FrameTime = (u16)(144+48+(FrameLength*8/(DataRate/10))); + } + else + { // Short preamble + FrameTime = (u16)(72+24+(FrameLength*8/(DataRate/10))); + } + if( ( FrameLength*8 % (DataRate/10) ) != 0 ) //Get the Ceilling + FrameTime ++; + } else { //802.11g DSSS-OFDM PLCP length field calculation. + N_DBPS = N_DBPSOfRate(DataRate); + Ceiling = (16 + 8*FrameLength + 6) / N_DBPS + + (((16 + 8*FrameLength + 6) % N_DBPS) ? 1 : 0); + FrameTime = (u16)(16 + 4 + 4*Ceiling + 6); + } + return FrameTime; +} + +u16 N_DBPSOfRate(u16 DataRate) +{ + u16 N_DBPS = 24; + + switch(DataRate) + { + case 60: + N_DBPS = 24; + break; + + case 90: + N_DBPS = 36; + break; + + case 120: + N_DBPS = 48; + break; + + case 180: + N_DBPS = 72; + break; + + case 240: + N_DBPS = 96; + break; + + case 360: + N_DBPS = 144; + break; + + case 480: + N_DBPS = 192; + break; + + case 540: + N_DBPS = 216; + break; + + default: + break; + } + + return N_DBPS; +} + +void rtl819xU_cmd_isr(struct urb *tx_cmd_urb, struct pt_regs *regs) +{ +#if 0 + struct net_device *dev = (struct net_device*)tx_cmd_urb->context; + struct r8192_priv *priv = ieee80211_priv(dev); + int last_init_packet = 0; + u8 *ptr_cmd_buf; + u16 cmd_buf_len; + + if(tx_cmd_urb->status != 0) { + priv->pFirmware.firmware_seg_index = 0; //only begin transter, should it can be set to 1 + } + + /* Free the urb and the corresponding buf for common Tx cmd packet, or + * last segment of each firmware img. + */ + if((priv->pFirmware.firmware_seg_index == 0) ||(priv->pFirmware.firmware_seg_index == priv->pFirmware.firmware_seg_maxnum)) { + priv->pFirmware.firmware_seg_index = 0;//only begin transter, should it can be set to 1 + } else { + /* prepare for last transfer */ + /* update some infomation for */ + /* last segment of the firmware img need indicate to device */ + priv->pFirmware.firmware_seg_index++; + if(priv->pFirmware.firmware_seg_index == priv->pFirmware.firmware_seg_maxnum) { + last_init_packet = 1; + } + + cmd_buf_len = priv->pFirmware.firmware_seg_container[priv->pFirmware.firmware_seg_index-1].seg_size; + ptr_cmd_buf = priv->pFfirmware.firmware_seg_container[priv->pFfirmware.firmware_seg_index-1].seg_ptr; + rtl819xU_tx_cmd(dev, ptr_cmd_buf, cmd_buf_len, last_init_packet, DESC_PACKET_TYPE_INIT); + } + + kfree(tx_cmd_urb->transfer_buffer); +#endif + usb_free_urb(tx_cmd_urb); +} + +unsigned int txqueue2outpipe(struct r8192_priv* priv,unsigned int tx_queue) { + + if(tx_queue >= 9) + { + RT_TRACE(COMP_ERR,"%s():Unknown queue ID!!!\n",__FUNCTION__); + return 0x04; + } + return priv->txqueue_to_outpipemap[tx_queue]; +} + +short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + //u8 *tx; + int status; + struct urb *tx_urb; + //int urb_buf_len; + unsigned int idx_pipe; + tx_desc_cmd_819x_usb *pdesc = (tx_desc_cmd_819x_usb *)skb->data; + cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + u8 queue_index = tcb_desc->queue_index; + + //printk("\n %s::queue_index = %d\n",__FUNCTION__, queue_index); + atomic_inc(&priv->tx_pending[queue_index]); +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + tx_urb = usb_alloc_urb(0,GFP_ATOMIC); +#else + tx_urb = usb_alloc_urb(0); +#endif + if(!tx_urb){ + dev_kfree_skb(skb); + return -ENOMEM; + } + + memset(pdesc, 0, USB_HWDESC_HEADER_LEN); + /* Tx descriptor ought to be set according to the skb->cb */ + pdesc->FirstSeg = 1;//bFirstSeg; + pdesc->LastSeg = 1;//bLastSeg; + pdesc->CmdInit = tcb_desc->bCmdOrInit; + pdesc->TxBufferSize = tcb_desc->txbuf_size; + pdesc->OWN = 1; + pdesc->LINIP = tcb_desc->bLastIniPkt; + + //---------------------------------------------------------------------------- + // Fill up USB_OUT_CONTEXT. + //---------------------------------------------------------------------------- + // Get index to out pipe from specified QueueID. +#ifndef USE_ONE_PIPE + idx_pipe = txqueue2outpipe(priv,queue_index); +#else + idx_pipe = 0x04; +#endif +#ifdef JOHN_DUMP_TXDESC + int i; + printk("--rate %x---",rate); + for (i = 0; i < 8; i++) + printk("%8x ", tx[i]); + printk("\n"); +#endif + usb_fill_bulk_urb(tx_urb,priv->udev, usb_sndbulkpipe(priv->udev,idx_pipe), \ + skb->data, skb->len, rtl8192_tx_isr, skb); + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + status = usb_submit_urb(tx_urb, GFP_ATOMIC); +#else + status = usb_submit_urb(tx_urb); +#endif + + if (!status){ + return 0; + }else{ + DMESGE("Error TX CMD URB, error %d", + status); + return -1; + } +} + +/* + * Mapping Software/Hardware descriptor queue id to "Queue Select Field" + * in TxFwInfo data structure + * 2006.10.30 by Emily + * + * \param QUEUEID Software Queue +*/ +u8 MapHwQueueToFirmwareQueue(u8 QueueID) +{ + u8 QueueSelect = 0x0; //defualt set to + + switch(QueueID) { + case BE_QUEUE: + QueueSelect = QSLT_BE; //or QSelect = pTcb->priority; + break; + + case BK_QUEUE: + QueueSelect = QSLT_BK; //or QSelect = pTcb->priority; + break; + + case VO_QUEUE: + QueueSelect = QSLT_VO; //or QSelect = pTcb->priority; + break; + + case VI_QUEUE: + QueueSelect = QSLT_VI; //or QSelect = pTcb->priority; + break; + case MGNT_QUEUE: + QueueSelect = QSLT_MGNT; + break; + + case BEACON_QUEUE: + QueueSelect = QSLT_BEACON; + break; + + // TODO: 2006.10.30 mark other queue selection until we verify it is OK + // TODO: Remove Assertions +//#if (RTL819X_FPGA_VER & RTL819X_FPGA_GUANGAN_070502) + case TXCMD_QUEUE: + QueueSelect = QSLT_CMD; + break; +//#endif + case HIGH_QUEUE: + QueueSelect = QSLT_HIGH; + break; + + default: + RT_TRACE(COMP_ERR, "TransmitTCB(): Impossible Queue Selection: %d \n", QueueID); + break; + } + return QueueSelect; +} + +u8 MRateToHwRate8190Pci(u8 rate) +{ + u8 ret = DESC90_RATE1M; + + switch(rate) { + case MGN_1M: ret = DESC90_RATE1M; break; + case MGN_2M: ret = DESC90_RATE2M; break; + case MGN_5_5M: ret = DESC90_RATE5_5M; break; + case MGN_11M: ret = DESC90_RATE11M; break; + case MGN_6M: ret = DESC90_RATE6M; break; + case MGN_9M: ret = DESC90_RATE9M; break; + case MGN_12M: ret = DESC90_RATE12M; break; + case MGN_18M: ret = DESC90_RATE18M; break; + case MGN_24M: ret = DESC90_RATE24M; break; + case MGN_36M: ret = DESC90_RATE36M; break; + case MGN_48M: ret = DESC90_RATE48M; break; + case MGN_54M: ret = DESC90_RATE54M; break; + + // HT rate since here + case MGN_MCS0: ret = DESC90_RATEMCS0; break; + case MGN_MCS1: ret = DESC90_RATEMCS1; break; + case MGN_MCS2: ret = DESC90_RATEMCS2; break; + case MGN_MCS3: ret = DESC90_RATEMCS3; break; + case MGN_MCS4: ret = DESC90_RATEMCS4; break; + case MGN_MCS5: ret = DESC90_RATEMCS5; break; + case MGN_MCS6: ret = DESC90_RATEMCS6; break; + case MGN_MCS7: ret = DESC90_RATEMCS7; break; + case MGN_MCS8: ret = DESC90_RATEMCS8; break; + case MGN_MCS9: ret = DESC90_RATEMCS9; break; + case MGN_MCS10: ret = DESC90_RATEMCS10; break; + case MGN_MCS11: ret = DESC90_RATEMCS11; break; + case MGN_MCS12: ret = DESC90_RATEMCS12; break; + case MGN_MCS13: ret = DESC90_RATEMCS13; break; + case MGN_MCS14: ret = DESC90_RATEMCS14; break; + case MGN_MCS15: ret = DESC90_RATEMCS15; break; + case (0x80|0x20): ret = DESC90_RATEMCS32; break; + + default: break; + } + return ret; +} + + +u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc) +{ + u8 tmp_Short; + + tmp_Short = (TxHT==1)?((tcb_desc->bUseShortGI)?1:0):((tcb_desc->bUseShortPreamble)?1:0); + + if(TxHT==1 && TxRate != DESC90_RATEMCS15) + tmp_Short = 0; + + return tmp_Short; +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) +static void tx_zero_isr(struct urb *tx_urb, struct pt_regs *reg) +#else +static void tx_zero_isr(struct urb *tx_urb) +#endif +{ + return; +} + +/* + * The tx procedure is just as following, + * skb->cb will contain all the following information, + * priority, morefrag, rate, &dev. + * */ +short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + tx_desc_819x_usb *tx_desc = (tx_desc_819x_usb *)skb->data; + tx_fwinfo_819x_usb *tx_fwinfo = (tx_fwinfo_819x_usb *)(skb->data + USB_HWDESC_HEADER_LEN); + struct usb_device *udev = priv->udev; + int pend; + int status; + struct urb *tx_urb = NULL, *tx_urb_zero = NULL; + //int urb_len; + unsigned int idx_pipe; +// RT_DEBUG_DATA(COMP_SEND, tcb_desc, sizeof(cb_desc)); +#if 0 + /* Added by Annie for filling Len_Adjust field. 2005-12-14. */ + RT_ENC_ALG EncAlg = NO_Encryption; +#endif +// printk("=============> %s\n", __FUNCTION__); + pend = atomic_read(&priv->tx_pending[tcb_desc->queue_index]); + /* we are locked here so the two atomic_read and inc are executed + * without interleaves + * !!! For debug purpose + */ + if( pend > MAX_TX_URB){ +#if 0 + switch (tcb_desc->queue_index) { + case VO_PRIORITY: + priv->stats.txvodrop++; + break; + case VI_PRIORITY: + priv->stats.txvidrop++; + break; + case BE_PRIORITY: + priv->stats.txbedrop++; + break; + default://BK_PRIORITY + priv->stats.txbkdrop++; + break; + } +#endif + printk("To discard skb packet!\n"); + dev_kfree_skb_any(skb); + return -1; + } + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + tx_urb = usb_alloc_urb(0,GFP_ATOMIC); +#else + tx_urb = usb_alloc_urb(0); +#endif + if(!tx_urb){ + dev_kfree_skb_any(skb); + return -ENOMEM; + } + + /* Fill Tx firmware info */ + memset(tx_fwinfo,0,sizeof(tx_fwinfo_819x_usb)); + /* DWORD 0 */ + tx_fwinfo->TxHT = (tcb_desc->data_rate&0x80)?1:0; + tx_fwinfo->TxRate = MRateToHwRate8190Pci(tcb_desc->data_rate); + tx_fwinfo->EnableCPUDur = tcb_desc->bTxEnableFwCalcDur; + tx_fwinfo->Short = QueryIsShort(tx_fwinfo->TxHT, tx_fwinfo->TxRate, tcb_desc); + if(tcb_desc->bAMPDUEnable) {//AMPDU enabled + tx_fwinfo->AllowAggregation = 1; + /* DWORD 1 */ + tx_fwinfo->RxMF = tcb_desc->ampdu_factor; + tx_fwinfo->RxAMD = tcb_desc->ampdu_density&0x07;//ampdudensity + } else { + tx_fwinfo->AllowAggregation = 0; + /* DWORD 1 */ + tx_fwinfo->RxMF = 0; + tx_fwinfo->RxAMD = 0; + } + + /* Protection mode related */ + tx_fwinfo->RtsEnable = (tcb_desc->bRTSEnable)?1:0; + tx_fwinfo->CtsEnable = (tcb_desc->bCTSEnable)?1:0; + tx_fwinfo->RtsSTBC = (tcb_desc->bRTSSTBC)?1:0; + tx_fwinfo->RtsHT = (tcb_desc->rts_rate&0x80)?1:0; + tx_fwinfo->RtsRate = MRateToHwRate8190Pci((u8)tcb_desc->rts_rate); + tx_fwinfo->RtsSubcarrier = (tx_fwinfo->RtsHT==0)?(tcb_desc->RTSSC):0; + tx_fwinfo->RtsBandwidth = (tx_fwinfo->RtsHT==1)?((tcb_desc->bRTSBW)?1:0):0; + tx_fwinfo->RtsShort = (tx_fwinfo->RtsHT==0)?(tcb_desc->bRTSUseShortPreamble?1:0):\ + (tcb_desc->bRTSUseShortGI?1:0); + + /* Set Bandwidth and sub-channel settings. */ + if(priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20_40) + { + if(tcb_desc->bPacketBW) { + tx_fwinfo->TxBandwidth = 1; + tx_fwinfo->TxSubCarrier = 0; //By SD3's Jerry suggestion, use duplicated mode + } else { + tx_fwinfo->TxBandwidth = 0; + tx_fwinfo->TxSubCarrier = priv->nCur40MhzPrimeSC; + } + } else { + tx_fwinfo->TxBandwidth = 0; + tx_fwinfo->TxSubCarrier = 0; + } + +#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE + if (tcb_desc->drv_agg_enable) + { + tx_fwinfo->Tx_INFO_RSVD = (tcb_desc->DrvAggrNum & 0x1f) << 1; + } +#endif + /* Fill Tx descriptor */ + memset(tx_desc, 0, sizeof(tx_desc_819x_usb)); + /* DWORD 0 */ + tx_desc->LINIP = 0; + tx_desc->CmdInit = 1; + tx_desc->Offset = sizeof(tx_fwinfo_819x_usb) + 8; + +#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE + if (tcb_desc->drv_agg_enable) { + tx_desc->PktSize = tcb_desc->pkt_size; + } else +#endif + { + tx_desc->PktSize = (skb->len - TX_PACKET_SHIFT_BYTES) & 0xffff; + } + + /*DWORD 1*/ + tx_desc->SecCAMID= 0; + tx_desc->RATid = tcb_desc->RATRIndex; +#if 0 + /* Fill security related */ + if( pTcb->bEncrypt && !Adapter->MgntInfo.SecurityInfo.SWTxEncryptFlag) + { + EncAlg = SecGetEncryptionOverhead( + Adapter, + &EncryptionMPDUHeadOverhead, + &EncryptionMPDUTailOverhead, + NULL, + NULL, + FALSE, + FALSE); + //2004/07/22, kcwu, EncryptionMPDUHeadOverhead has been added in previous code + //MPDUOverhead = EncryptionMPDUHeadOverhead + EncryptionMPDUTailOverhead; + MPDUOverhead = EncryptionMPDUTailOverhead; + tx_desc->NoEnc = 0; + RT_TRACE(COMP_SEC, DBG_LOUD, ("******We in the loop SecCAMID is %d SecDescAssign is %d The Sec is %d********\n",tx_desc->SecCAMID,tx_desc->SecDescAssign,EncAlg)); + //CamDumpAll(Adapter); + } + else +#endif + { + //MPDUOverhead = 0; + tx_desc->NoEnc = 1; + } +#if 0 + switch(EncAlg){ + case NO_Encryption: + tx_desc->SecType = 0x0; + break; + case WEP40_Encryption: + case WEP104_Encryption: + tx_desc->SecType = 0x1; + break; + case TKIP_Encryption: + tx_desc->SecType = 0x2; + break; + case AESCCMP_Encryption: + tx_desc->SecType = 0x3; + break; + default: + tx_desc->SecType = 0x0; + break; + } +#else + tx_desc->SecType = 0x0; +#endif + if (tcb_desc->bHwSec) + { + switch (priv->ieee80211->pairwise_key_type) + { + case KEY_TYPE_WEP40: + case KEY_TYPE_WEP104: + tx_desc->SecType = 0x1; + tx_desc->NoEnc = 0; + break; + case KEY_TYPE_TKIP: + tx_desc->SecType = 0x2; + tx_desc->NoEnc = 0; + break; + case KEY_TYPE_CCMP: + tx_desc->SecType = 0x3; + tx_desc->NoEnc = 0; + break; + case KEY_TYPE_NA: + tx_desc->SecType = 0x0; + tx_desc->NoEnc = 1; + break; + } + } + + tx_desc->QueueSelect = MapHwQueueToFirmwareQueue(tcb_desc->queue_index); + tx_desc->TxFWInfoSize = sizeof(tx_fwinfo_819x_usb); + + tx_desc->DISFB = tcb_desc->bTxDisableRateFallBack; + tx_desc->USERATE = tcb_desc->bTxUseDriverAssingedRate; + + /* Fill fields that are required to be initialized in all of the descriptors */ + //DWORD 0 +#if 0 + tx_desc->FirstSeg = (tcb_desc->bFirstSeg)? 1:0; + tx_desc->LastSeg = (tcb_desc->bLastSeg)?1:0; +#else + tx_desc->FirstSeg = 1; + tx_desc->LastSeg = 1; +#endif + tx_desc->OWN = 1; + +#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE + if (tcb_desc->drv_agg_enable) { + tx_desc->TxBufferSize = tcb_desc->pkt_size + sizeof(tx_fwinfo_819x_usb); + } else +#endif + { + //DWORD 2 + tx_desc->TxBufferSize = (u32)(skb->len - USB_HWDESC_HEADER_LEN); + } + /* Get index to out pipe from specified QueueID */ +#ifndef USE_ONE_PIPE + idx_pipe = txqueue2outpipe(priv,tcb_desc->queue_index); +#else + idx_pipe = 0x5; +#endif + + //RT_DEBUG_DATA(COMP_SEND,tx_fwinfo,sizeof(tx_fwinfo_819x_usb)); + //RT_DEBUG_DATA(COMP_SEND,tx_desc,sizeof(tx_desc_819x_usb)); + + /* To submit bulk urb */ + usb_fill_bulk_urb(tx_urb,udev, + usb_sndbulkpipe(udev,idx_pipe), skb->data, + skb->len, rtl8192_tx_isr, skb); + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + status = usb_submit_urb(tx_urb, GFP_ATOMIC); +#else + status = usb_submit_urb(tx_urb); +#endif + if (!status){ +//we need to send 0 byte packet whenever 512N bytes/64N(HIGN SPEED/NORMAL SPEED) bytes packet has been transmitted. Otherwise, it will be halt to wait for another packet. WB. 2008.08.27 + bool bSend0Byte = false; + u8 zero = 0; + if(udev->speed == USB_SPEED_HIGH) + { + if (skb->len > 0 && skb->len % 512 == 0) + bSend0Byte = true; + } + else + { + if (skb->len > 0 && skb->len % 64 == 0) + bSend0Byte = true; + } + if (bSend0Byte) + { +#if 1 +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + tx_urb_zero = usb_alloc_urb(0,GFP_ATOMIC); +#else + tx_urb_zero = usb_alloc_urb(0); +#endif + if(!tx_urb_zero){ + RT_TRACE(COMP_ERR, "can't alloc urb for zero byte\n"); + return -ENOMEM; + } + usb_fill_bulk_urb(tx_urb_zero,udev, + usb_sndbulkpipe(udev,idx_pipe), &zero, + 0, tx_zero_isr, dev); +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + status = usb_submit_urb(tx_urb_zero, GFP_ATOMIC); +#else + status = usb_submit_urb(tx_urb_zero); +#endif + if (status){ + RT_TRACE(COMP_ERR, "Error TX URB for zero byte %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), status); + return -1; + } +#endif + } + dev->trans_start = jiffies; + atomic_inc(&priv->tx_pending[tcb_desc->queue_index]); + return 0; + }else{ + RT_TRACE(COMP_ERR, "Error TX URB %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), + status); + return -1; + } +} + +short rtl8192_usb_initendpoints(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * (MAX_RX_URB+1), GFP_KERNEL); + +#ifndef JACKSON_NEW_RX + for(i=0;i<(MAX_RX_URB+1);i++){ + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL); +#else + priv->rx_urb[i] = usb_alloc_urb(0); +#endif + + priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL); + + priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE; + } +#endif + +#ifdef THOMAS_BEACON +{ + int align = 0; + u32 oldaddr,newaddr; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + priv->rx_urb[16] = usb_alloc_urb(0, GFP_KERNEL); +#else + priv->rx_urb[16] = usb_alloc_urb(0); +#endif + priv->oldaddr = kmalloc(16, GFP_KERNEL); + oldaddr = (u32)priv->oldaddr; + align = oldaddr&3; + if(align != 0 ){ + newaddr = oldaddr + 4 - align; + priv->rx_urb[16]->transfer_buffer_length = 16-4+align; + } + else{ + newaddr = oldaddr; + priv->rx_urb[16]->transfer_buffer_length = 16; + } + priv->rx_urb[16]->transfer_buffer = (u32*)newaddr; +} +#endif + + memset(priv->rx_urb, 0, sizeof(struct urb*) * MAX_RX_URB); + priv->pp_rxskb = (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) * MAX_RX_URB, GFP_KERNEL); + if (priv->pp_rxskb == NULL) + goto destroy; + + memset(priv->pp_rxskb, 0, sizeof(struct sk_buff*) * MAX_RX_URB); + + goto _middle; + + +destroy: + if (priv->pp_rxskb) { + kfree(priv->pp_rxskb); + } + if (priv->rx_urb) { + kfree(priv->rx_urb); + } + + priv->pp_rxskb = NULL; + priv->rx_urb = NULL; + + DMESGE("Endpoint Alloc Failure"); + return -ENOMEM; + + +_middle: + + printk("End of initendpoints\n"); + return 0; + +} +#ifdef THOMAS_BEACON +void rtl8192_usb_deleteendpoints(struct net_device *dev) +{ + int i; + struct r8192_priv *priv = ieee80211_priv(dev); + + if(priv->rx_urb){ + for(i=0;i<(MAX_RX_URB+1);i++){ + usb_kill_urb(priv->rx_urb[i]); + usb_free_urb(priv->rx_urb[i]); + } + kfree(priv->rx_urb); + priv->rx_urb = NULL; + } + if(priv->oldaddr){ + kfree(priv->oldaddr); + priv->oldaddr = NULL; + } + if (priv->pp_rxskb) { + kfree(priv->pp_rxskb); + priv->pp_rxskb = 0; + } +} +#else +void rtl8192_usb_deleteendpoints(struct net_device *dev) +{ + int i; + struct r8192_priv *priv = ieee80211_priv(dev); + +#ifndef JACKSON_NEW_RX + + if(priv->rx_urb){ + for(i=0;i<(MAX_RX_URB+1);i++){ + usb_kill_urb(priv->rx_urb[i]); + kfree(priv->rx_urb[i]->transfer_buffer); + usb_free_urb(priv->rx_urb[i]); + } + kfree(priv->rx_urb); + priv->rx_urb = NULL; + + } +#else + if(priv->rx_urb){ + kfree(priv->rx_urb); + priv->rx_urb = NULL; + } + if(priv->oldaddr){ + kfree(priv->oldaddr); + priv->oldaddr = NULL; + } + if (priv->pp_rxskb) { + kfree(priv->pp_rxskb); + priv->pp_rxskb = 0; + + } + +#endif +} +#endif + +#if 0 +void rtl8192_set_rate(struct net_device *dev) +{ + int i; + u16 word; + int basic_rate,min_rr_rate,max_rr_rate; + +// struct r8192_priv *priv = ieee80211_priv(dev); + + //if (ieee80211_is_54g(priv->ieee80211->current_network) && +// priv->ieee80211->state == IEEE80211_LINKED){ + basic_rate = ieeerate2rtlrate(240); + min_rr_rate = ieeerate2rtlrate(60); + max_rr_rate = ieeerate2rtlrate(240); + +// +// }else{ +// basic_rate = ieeerate2rtlrate(20); +// min_rr_rate = ieeerate2rtlrate(10); +// max_rr_rate = ieeerate2rtlrate(110); +// } + + write_nic_byte(dev, RESP_RATE, + max_rr_rate<ieee80211; + //write_nic_word(dev, BCN_INTR_ITV, net->beacon_interval); + if (ieee->state == IEEE80211_LINKED) + { + rtl8192_net_update(dev); + rtl8192_update_ratr_table(dev); +#if 1 + //add this as in pure N mode, wep encryption will use software way, but there is no chance to set this as wep will not set group key in wext. WB.2008.07.08 + if ((KEY_TYPE_WEP40 == ieee->pairwise_key_type) || (KEY_TYPE_WEP104 == ieee->pairwise_key_type)) + EnableHWSecurityConfig8192(dev); +#endif + } + /*update timing params*/ +// RT_TRACE(COMP_CH, "========>%s(), chan:%d\n", __FUNCTION__, priv->chan); +// rtl8192_set_chan(dev, priv->chan); + if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC) + { + u32 reg = 0; + reg = read_nic_dword(dev, RCR); + if (priv->ieee80211->state == IEEE80211_LINKED) + priv->ReceiveConfig = reg |= RCR_CBSSID; + else + priv->ReceiveConfig = reg &= ~RCR_CBSSID; + write_nic_dword(dev, RCR, reg); + } + +// rtl8192_set_rxconf(dev); +} + +static struct ieee80211_qos_parameters def_qos_parameters = { + {3,3,3,3},/* cw_min */ + {7,7,7,7},/* cw_max */ + {2,2,2,2},/* aifs */ + {0,0,0,0},/* flags */ + {0,0,0,0} /* tx_op_limit */ +}; + + +#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20) +void rtl8192_update_beacon(struct work_struct * work) +{ + struct r8192_priv *priv = container_of(work, struct r8192_priv, update_beacon_wq.work); + struct net_device *dev = priv->ieee80211->dev; +#else +void rtl8192_update_beacon(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); +#endif + struct ieee80211_device* ieee = priv->ieee80211; + struct ieee80211_network* net = &ieee->current_network; + + if (ieee->pHTInfo->bCurrentHTSupport) + HTUpdateSelfAndPeerSetting(ieee, net); + ieee->pHTInfo->bCurrentRT2RTLongSlotTime = net->bssht.bdRT2RTLongSlotTime; + rtl8192_update_cap(dev, net->capability); +} +/* +* background support to run QoS activate functionality +*/ +int WDCAPARA_ADD[] = {EDCAPARA_BE,EDCAPARA_BK,EDCAPARA_VI,EDCAPARA_VO}; +#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20) +void rtl8192_qos_activate(struct work_struct * work) +{ + struct r8192_priv *priv = container_of(work, struct r8192_priv, qos_activate); + struct net_device *dev = priv->ieee80211->dev; +#else +void rtl8192_qos_activate(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); +#endif + struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters; + u8 mode = priv->ieee80211->current_network.mode; + //u32 size = sizeof(struct ieee80211_qos_parameters); + u8 u1bAIFS; + u32 u4bAcParam; + int i; + + if (priv == NULL) + return; + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)) + down(&priv->mutex); +#else + mutex_lock(&priv->mutex); +#endif + if(priv->ieee80211->state != IEEE80211_LINKED) + goto success; + RT_TRACE(COMP_QOS,"qos active process with associate response received\n"); + /* It better set slot time at first */ + /* For we just support b/g mode at present, let the slot time at 9/20 selection */ + /* update the ac parameter to related registers */ + for(i = 0; i < QOS_QUEUE_NUM; i++) { + //Mode G/A: slotTimeTimer = 9; Mode B: 20 + u1bAIFS = qos_parameters->aifs[i] * ((mode&(IEEE_G|IEEE_N_24G)) ?9:20) + aSifsTime; + u4bAcParam = ((((u32)(qos_parameters->tx_op_limit[i]))<< AC_PARAM_TXOP_LIMIT_OFFSET)| + (((u32)(qos_parameters->cw_max[i]))<< AC_PARAM_ECW_MAX_OFFSET)| + (((u32)(qos_parameters->cw_min[i]))<< AC_PARAM_ECW_MIN_OFFSET)| + ((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET)); + + write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam); + //write_nic_dword(dev, WDCAPARA_ADD[i], 0x005e4332); + } + +success: +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)) + up(&priv->mutex); +#else + mutex_unlock(&priv->mutex); +#endif +} + +static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, + int active_network, + struct ieee80211_network *network) +{ + int ret = 0; + u32 size = sizeof(struct ieee80211_qos_parameters); + + if(priv->ieee80211->state !=IEEE80211_LINKED) + return ret; + + if ((priv->ieee80211->iw_mode != IW_MODE_INFRA)) + return ret; + + if (network->flags & NETWORK_HAS_QOS_MASK) { + if (active_network && + (network->flags & NETWORK_HAS_QOS_PARAMETERS)) + network->qos_data.active = network->qos_data.supported; + + if ((network->qos_data.active == 1) && (active_network == 1) && + (network->flags & NETWORK_HAS_QOS_PARAMETERS) && + (network->qos_data.old_param_count != + network->qos_data.param_count)) { + network->qos_data.old_param_count = + network->qos_data.param_count; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + queue_work(priv->priv_wq, &priv->qos_activate); +#else + schedule_task(&priv->qos_activate); +#endif + RT_TRACE (COMP_QOS, "QoS parameters change call " + "qos_activate\n"); + } + } else { + memcpy(&priv->ieee80211->current_network.qos_data.parameters,\ + &def_qos_parameters, size); + + if ((network->qos_data.active == 1) && (active_network == 1)) { +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + queue_work(priv->priv_wq, &priv->qos_activate); +#else + schedule_task(&priv->qos_activate); +#endif + RT_TRACE(COMP_QOS, "QoS was disabled call qos_activate \n"); + } + network->qos_data.active = 0; + network->qos_data.supported = 0; + } + + return 0; +} + +/* handle manage frame frame beacon and probe response */ +static int rtl8192_handle_beacon(struct net_device * dev, + struct ieee80211_beacon * beacon, + struct ieee80211_network * network) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + rtl8192_qos_handle_probe_response(priv,1,network); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) + queue_delayed_work(priv->priv_wq, &priv->update_beacon_wq, 0); +#else +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + schedule_task(&priv->update_beacon_wq); +#else + queue_work(priv->priv_wq, &priv->update_beacon_wq); +#endif + +#endif + return 0; + +} + +/* +* handling the beaconing responses. if we get different QoS setting +* off the network from the associated setting, adjust the QoS +* setting +*/ +static int rtl8192_qos_association_resp(struct r8192_priv *priv, + struct ieee80211_network *network) +{ + int ret = 0; + unsigned long flags; + u32 size = sizeof(struct ieee80211_qos_parameters); + int set_qos_param = 0; + + if ((priv == NULL) || (network == NULL)) + return ret; + + if(priv->ieee80211->state !=IEEE80211_LINKED) + return ret; + + if ((priv->ieee80211->iw_mode != IW_MODE_INFRA)) + return ret; + + spin_lock_irqsave(&priv->ieee80211->lock, flags); + if(network->flags & NETWORK_HAS_QOS_PARAMETERS) { + memcpy(&priv->ieee80211->current_network.qos_data.parameters,\ + &network->qos_data.parameters,\ + sizeof(struct ieee80211_qos_parameters)); + priv->ieee80211->current_network.qos_data.active = 1; +#if 0 + if((priv->ieee80211->current_network.qos_data.param_count != \ + network->qos_data.param_count)) +#endif + { + set_qos_param = 1; + /* update qos parameter for current network */ + priv->ieee80211->current_network.qos_data.old_param_count = \ + priv->ieee80211->current_network.qos_data.param_count; + priv->ieee80211->current_network.qos_data.param_count = \ + network->qos_data.param_count; + } + } else { + memcpy(&priv->ieee80211->current_network.qos_data.parameters,\ + &def_qos_parameters, size); + priv->ieee80211->current_network.qos_data.active = 0; + priv->ieee80211->current_network.qos_data.supported = 0; + set_qos_param = 1; + } + + spin_unlock_irqrestore(&priv->ieee80211->lock, flags); + + RT_TRACE(COMP_QOS, "%s: network->flags = %d,%d\n",__FUNCTION__,network->flags ,priv->ieee80211->current_network.qos_data.active); + if (set_qos_param == 1) +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + queue_work(priv->priv_wq, &priv->qos_activate); +#else + schedule_task(&priv->qos_activate); +#endif + + + return ret; +} + + +static int rtl8192_handle_assoc_response(struct net_device *dev, + struct ieee80211_assoc_response_frame *resp, + struct ieee80211_network *network) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + rtl8192_qos_association_resp(priv, network); + return 0; +} + + +void rtl8192_update_ratr_table(struct net_device* dev) + // POCTET_STRING posLegacyRate, + // u8* pMcsRate) + // PRT_WLAN_STA pEntry) +{ + struct r8192_priv* priv = ieee80211_priv(dev); + struct ieee80211_device* ieee = priv->ieee80211; + u8* pMcsRate = ieee->dot11HTOperationalRateSet; + //struct ieee80211_network *net = &ieee->current_network; + u32 ratr_value = 0; + u8 rate_index = 0; + rtl8192_config_rate(dev, (u16*)(&ratr_value)); + ratr_value |= (*(u16*)(pMcsRate)) << 12; +// switch (net->mode) + switch (ieee->mode) + { + case IEEE_A: + ratr_value &= 0x00000FF0; + break; + case IEEE_B: + ratr_value &= 0x0000000F; + break; + case IEEE_G: + ratr_value &= 0x00000FF7; + break; + case IEEE_N_24G: + case IEEE_N_5G: + if (ieee->pHTInfo->PeerMimoPs == 0) //MIMO_PS_STATIC + ratr_value &= 0x0007F007; + else{ + if (priv->rf_type == RF_1T2R) + ratr_value &= 0x000FF007; + else + ratr_value &= 0x0F81F007; + } + break; + default: + break; + } + ratr_value &= 0x0FFFFFFF; + if(ieee->pHTInfo->bCurTxBW40MHz && ieee->pHTInfo->bCurShortGI40MHz){ + ratr_value |= 0x80000000; + }else if(!ieee->pHTInfo->bCurTxBW40MHz && ieee->pHTInfo->bCurShortGI20MHz){ + ratr_value |= 0x80000000; + } + write_nic_dword(dev, RATR0+rate_index*4, ratr_value); + write_nic_byte(dev, UFWP, 1); +} + +static u8 ccmp_ie[4] = {0x00,0x50,0xf2,0x04}; +static u8 ccmp_rsn_ie[4] = {0x00, 0x0f, 0xac, 0x04}; +bool GetNmodeSupportBySecCfg8192(struct net_device*dev) +{ +#if 1 + struct r8192_priv* priv = ieee80211_priv(dev); + struct ieee80211_device* ieee = priv->ieee80211; + struct ieee80211_network * network = &ieee->current_network; + int wpa_ie_len= ieee->wpa_ie_len; + struct ieee80211_crypt_data* crypt; + int encrypt; + + crypt = ieee->crypt[ieee->tx_keyidx]; + //we use connecting AP's capability instead of only security config on our driver to distinguish whether it should use N mode or G mode + encrypt = (network->capability & WLAN_CAPABILITY_PRIVACY) || (ieee->host_encrypt && crypt && crypt->ops && (0 == strcmp(crypt->ops->name,"WEP"))); + + /* simply judge */ + if(encrypt && (wpa_ie_len == 0)) { + /* wep encryption, no N mode setting */ + return false; +// } else if((wpa_ie_len != 0)&&(memcmp(&(ieee->wpa_ie[14]),ccmp_ie,4))) { + } else if((wpa_ie_len != 0)) { + /* parse pairwise key type */ + //if((pairwisekey = WEP40)||(pairwisekey = WEP104)||(pairwisekey = TKIP)) + if (((ieee->wpa_ie[0] == 0xdd) && (!memcmp(&(ieee->wpa_ie[14]),ccmp_ie,4))) || ((ieee->wpa_ie[0] == 0x30) && (!memcmp(&ieee->wpa_ie[10],ccmp_rsn_ie, 4)))) + return true; + else + return false; + } else { + return true; + } + +#if 0 + //In here we discuss with SD4 David. He think we still can send TKIP in broadcast group key in MCS rate. + //We can't force in G mode if Pairwie key is AES and group key is TKIP + if((pSecInfo->GroupEncAlgorithm == WEP104_Encryption) || (pSecInfo->GroupEncAlgorithm == WEP40_Encryption) || + (pSecInfo->PairwiseEncAlgorithm == WEP104_Encryption) || + (pSecInfo->PairwiseEncAlgorithm == WEP40_Encryption) || (pSecInfo->PairwiseEncAlgorithm == TKIP_Encryption)) + { + return false; + } + else + return true; +#endif + return true; +#endif +} + +bool GetHalfNmodeSupportByAPs819xUsb(struct net_device* dev) +{ + bool Reval; + struct r8192_priv* priv = ieee80211_priv(dev); + struct ieee80211_device* ieee = priv->ieee80211; + + if(ieee->bHalfWirelessN24GMode == true) + Reval = true; + else + Reval = false; + + return Reval; +} + +void rtl8192_refresh_supportrate(struct r8192_priv* priv) +{ + struct ieee80211_device* ieee = priv->ieee80211; + //we donot consider set support rate for ABG mode, only HT MCS rate is set here. + if (ieee->mode == WIRELESS_MODE_N_24G || ieee->mode == WIRELESS_MODE_N_5G) + { + memcpy(ieee->Regdot11HTOperationalRateSet, ieee->RegHTSuppRateSet, 16); + //RT_DEBUG_DATA(COMP_INIT, ieee->RegHTSuppRateSet, 16); + //RT_DEBUG_DATA(COMP_INIT, ieee->Regdot11HTOperationalRateSet, 16); + } + else + memset(ieee->Regdot11HTOperationalRateSet, 0, 16); + return; +} + +u8 rtl8192_getSupportedWireleeMode(struct net_device*dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u8 ret = 0; + switch(priv->rf_chip) + { + case RF_8225: + case RF_8256: + case RF_PSEUDO_11N: + ret = (WIRELESS_MODE_N_24G|WIRELESS_MODE_G|WIRELESS_MODE_B); + break; + case RF_8258: + ret = (WIRELESS_MODE_A|WIRELESS_MODE_N_5G); + break; + default: + ret = WIRELESS_MODE_B; + break; + } + return ret; +} +void rtl8192_SetWirelessMode(struct net_device* dev, u8 wireless_mode) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u8 bSupportMode = rtl8192_getSupportedWireleeMode(dev); + +#if 1 + if ((wireless_mode == WIRELESS_MODE_AUTO) || ((wireless_mode&bSupportMode)==0)) + { + if(bSupportMode & WIRELESS_MODE_N_24G) + { + wireless_mode = WIRELESS_MODE_N_24G; + } + else if(bSupportMode & WIRELESS_MODE_N_5G) + { + wireless_mode = WIRELESS_MODE_N_5G; + } + else if((bSupportMode & WIRELESS_MODE_A)) + { + wireless_mode = WIRELESS_MODE_A; + } + else if((bSupportMode & WIRELESS_MODE_G)) + { + wireless_mode = WIRELESS_MODE_G; + } + else if((bSupportMode & WIRELESS_MODE_B)) + { + wireless_mode = WIRELESS_MODE_B; + } + else{ + RT_TRACE(COMP_ERR, "%s(), No valid wireless mode supported, SupportedWirelessMode(%x)!!!\n", __FUNCTION__,bSupportMode); + wireless_mode = WIRELESS_MODE_B; + } + } +#ifdef TO_DO_LIST //// TODO: this function doesn't work well at this time, we shoud wait for FPGA + ActUpdateChannelAccessSetting( pAdapter, pHalData->CurrentWirelessMode, &pAdapter->MgntInfo.Info8185.ChannelAccessSetting ); +#endif + priv->ieee80211->mode = wireless_mode; + + if ((wireless_mode == WIRELESS_MODE_N_24G) || (wireless_mode == WIRELESS_MODE_N_5G)) + priv->ieee80211->pHTInfo->bEnableHT = 1; + else + priv->ieee80211->pHTInfo->bEnableHT = 0; + RT_TRACE(COMP_INIT, "Current Wireless Mode is %x\n", wireless_mode); + rtl8192_refresh_supportrate(priv); +#endif + +} +//init priv variables here. only non_zero value should be initialized here. +static void rtl8192_init_priv_variable(struct net_device* dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u8 i; + priv->card_8192 = NIC_8192U; + priv->chan = 1; //set to channel 1 + priv->ieee80211->mode = WIRELESS_MODE_AUTO; //SET AUTO + priv->ieee80211->iw_mode = IW_MODE_INFRA; + priv->ieee80211->ieee_up=0; + priv->retry_rts = DEFAULT_RETRY_RTS; + priv->retry_data = DEFAULT_RETRY_DATA; + priv->ieee80211->rts = DEFAULT_RTS_THRESHOLD; + priv->ieee80211->rate = 110; //11 mbps + priv->ieee80211->short_slot = 1; + priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0; + priv->CckPwEnl = 6; + //for silent reset + priv->IrpPendingCount = 1; + priv->ResetProgress = RESET_TYPE_NORESET; + priv->bForcedSilentReset = 0; + priv->bDisableNormalResetCheck = false; + priv->force_reset = false; + + priv->ieee80211->FwRWRF = 0; //we don't use FW read/write RF until stable firmware is available. + priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL; + priv->ieee80211->iw_mode = IW_MODE_INFRA; + priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN | + IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ | + IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE | + IEEE_SOFTMAC_BEACONS;//added by amy 080604 //| //IEEE_SOFTMAC_SINGLE_QUEUE; + + priv->ieee80211->active_scan = 1; + priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION; + priv->ieee80211->host_encrypt = 1; + priv->ieee80211->host_decrypt = 1; + priv->ieee80211->start_send_beacons = NULL;//rtl819xusb_beacon_tx;//-by amy 080604 + priv->ieee80211->stop_send_beacons = NULL;//rtl8192_beacon_stop;//-by amy 080604 + priv->ieee80211->softmac_hard_start_xmit = rtl8192_hard_start_xmit; + priv->ieee80211->set_chan = rtl8192_set_chan; + priv->ieee80211->link_change = rtl8192_link_change; + priv->ieee80211->softmac_data_hard_start_xmit = rtl8192_hard_data_xmit; + priv->ieee80211->data_hard_stop = rtl8192_data_hard_stop; + priv->ieee80211->data_hard_resume = rtl8192_data_hard_resume; + priv->ieee80211->init_wmmparam_flag = 0; + priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD; + priv->ieee80211->check_nic_enough_desc = check_nic_enough_desc; + priv->ieee80211->tx_headroom = TX_PACKET_SHIFT_BYTES; + priv->ieee80211->qos_support = 1; + + //added by WB +// priv->ieee80211->SwChnlByTimerHandler = rtl8192_phy_SwChnl; + priv->ieee80211->SetBWModeHandler = rtl8192_SetBWMode; + priv->ieee80211->handle_assoc_response = rtl8192_handle_assoc_response; + priv->ieee80211->handle_beacon = rtl8192_handle_beacon; + //added by david + priv->ieee80211->GetNmodeSupportBySecCfg = GetNmodeSupportBySecCfg8192; + priv->ieee80211->GetHalfNmodeSupportByAPsHandler = GetHalfNmodeSupportByAPs819xUsb; + priv->ieee80211->SetWirelessMode = rtl8192_SetWirelessMode; + //added by amy + priv->ieee80211->InitialGainHandler = InitialGain819xUsb; + priv->card_type = USB; +#ifdef TO_DO_LIST + if(Adapter->bInHctTest) + { + pHalData->ShortRetryLimit = 7; + pHalData->LongRetryLimit = 7; + } +#endif + { + priv->ShortRetryLimit = 0x30; + priv->LongRetryLimit = 0x30; + } + priv->EarlyRxThreshold = 7; + priv->enable_gpio0 = 0; + priv->TransmitConfig = + // TCR_DurProcMode | //for RTL8185B, duration setting by HW + //? TCR_DISReqQsize | + (TCR_MXDMA_2048<ShortRetryLimit<LongRetryLimit<bInHctTest) + pHalData->ReceiveConfig = pHalData->CSMethod | + RCR_AMF | RCR_ADF | //RCR_AAP | //accept management/data + //guangan200710 + RCR_ACF | //accept control frame for SW AP needs PS-poll, 2005.07.07, by rcnjko. + RCR_AB | RCR_AM | RCR_APM | //accept BC/MC/UC + RCR_AICV | RCR_ACRC32 | //accept ICV/CRC error packet + ((u32)7<EarlyRxThreshold<EarlyRxThreshold == 7 ? RCR_OnlyErlPkt:0); + else + +#endif + priv->ReceiveConfig = + RCR_AMF | RCR_ADF | //accept management/data + RCR_ACF | //accept control frame for SW AP needs PS-poll, 2005.07.07, by rcnjko. + RCR_AB | RCR_AM | RCR_APM | //accept BC/MC/UC + //RCR_AICV | RCR_ACRC32 | //accept ICV/CRC error packet + ((u32)7<EarlyRxThreshold<EarlyRxThreshold == 7 ? RCR_ONLYERLPKT:0); + + priv->AcmControl = 0; + priv->pFirmware = (rt_firmware*)kmalloc(sizeof(rt_firmware), GFP_KERNEL); + if (priv->pFirmware) + memset(priv->pFirmware, 0, sizeof(rt_firmware)); + + /* rx related queue */ + skb_queue_head_init(&priv->rx_queue); + skb_queue_head_init(&priv->skb_queue); + + /* Tx related queue */ + for(i = 0; i < MAX_QUEUE_SIZE; i++) { + skb_queue_head_init(&priv->ieee80211->skb_waitQ [i]); + } + for(i = 0; i < MAX_QUEUE_SIZE; i++) { + skb_queue_head_init(&priv->ieee80211->skb_aggQ [i]); + } + for(i = 0; i < MAX_QUEUE_SIZE; i++) { + skb_queue_head_init(&priv->ieee80211->skb_drv_aggQ [i]); + } + priv->rf_set_chan = rtl8192_phy_SwChnl; +} + +//init lock here +static void rtl8192_init_priv_lock(struct r8192_priv* priv) +{ + spin_lock_init(&priv->tx_lock); + spin_lock_init(&priv->irq_lock);//added by thomas + //spin_lock_init(&priv->rf_lock); + sema_init(&priv->wx_sem,1); + sema_init(&priv->rf_sem,1); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)) + sema_init(&priv->mutex, 1); +#else + mutex_init(&priv->mutex); +#endif +} + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +extern void rtl819x_watchdog_wqcallback(struct work_struct *work); +#else +extern void rtl819x_watchdog_wqcallback(struct net_device *dev); +#endif + +void rtl8192_irq_rx_tasklet(struct r8192_priv *priv); +//init tasklet and wait_queue here. only 2.6 above kernel is considered +#define DRV_NAME "wlan0" +static void rtl8192_init_priv_task(struct net_device* dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) +#ifdef PF_SYNCTHREAD + priv->priv_wq = create_workqueue(DRV_NAME,0); +#else + priv->priv_wq = create_workqueue(DRV_NAME); +#endif +#endif + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) + INIT_WORK(&priv->reset_wq, rtl8192_restart); + + //INIT_DELAYED_WORK(&priv->watch_dog_wq, hal_dm_watchdog); + INIT_DELAYED_WORK(&priv->watch_dog_wq, rtl819x_watchdog_wqcallback); + INIT_DELAYED_WORK(&priv->txpower_tracking_wq, dm_txpower_trackingcallback); +// INIT_DELAYED_WORK(&priv->gpio_change_rf_wq, dm_gpio_change_rf_callback); + INIT_DELAYED_WORK(&priv->rfpath_check_wq, dm_rf_pathcheck_workitemcallback); + INIT_DELAYED_WORK(&priv->update_beacon_wq, rtl8192_update_beacon); + INIT_DELAYED_WORK(&priv->initialgain_operate_wq, InitialGainOperateWorkItemCallBack); + //INIT_WORK(&priv->SwChnlWorkItem, rtl8192_SwChnl_WorkItem); + //INIT_WORK(&priv->SetBWModeWorkItem, rtl8192_SetBWModeWorkItem); + INIT_WORK(&priv->qos_activate, rtl8192_qos_activate); +#else +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) + tq_init(&priv->reset_wq, (void*)rtl8192_restart, dev); + tq_init(&priv->watch_dog_wq, (void*)rtl819x_watchdog_wqcallback, dev); + tq_init(&priv->txpower_tracking_wq, (void*)dm_txpower_trackingcallback, dev); + tq_init(&priv->rfpath_check_wq, (void*)dm_rf_pathcheck_workitemcallback, dev); + tq_init(&priv->update_beacon_wq, (void*)rtl8192_update_beacon, dev); + //tq_init(&priv->SwChnlWorkItem, (void*) rtl8192_SwChnl_WorkItem, dev); + //tq_init(&priv->SetBWModeWorkItem, (void*)rtl8192_SetBWModeWorkItem, dev); + tq_init(&priv->qos_activate, (void *)rtl8192_qos_activate, dev); +#else + INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8192_restart,dev); + //INIT_WORK(&priv->watch_dog_wq, (void(*)(void*)) hal_dm_watchdog,dev); + INIT_WORK(&priv->watch_dog_wq, (void(*)(void*)) rtl819x_watchdog_wqcallback,dev); + INIT_WORK(&priv->txpower_tracking_wq, (void(*)(void*)) dm_txpower_trackingcallback,dev); +// INIT_WORK(&priv->gpio_change_rf_wq, (void(*)(void*)) dm_gpio_change_rf_callback,dev); + INIT_WORK(&priv->rfpath_check_wq, (void(*)(void*)) dm_rf_pathcheck_workitemcallback,dev); + INIT_WORK(&priv->update_beacon_wq, (void(*)(void*))rtl8192_update_beacon,dev); + INIT_WORK(&priv->initialgain_operate_wq, (void(*)(void*))InitialGainOperateWorkItemCallBack,dev); + //INIT_WORK(&priv->SwChnlWorkItem, (void(*)(void*)) rtl8192_SwChnl_WorkItem, dev); + //INIT_WORK(&priv->SetBWModeWorkItem, (void(*)(void*)) rtl8192_SetBWModeWorkItem, dev); + INIT_WORK(&priv->qos_activate, (void(*)(void *))rtl8192_qos_activate, dev); +#endif +#endif + + tasklet_init(&priv->irq_rx_tasklet, + (void(*)(unsigned long))rtl8192_irq_rx_tasklet, + (unsigned long)priv); +} + +static void rtl8192_get_eeprom_size(struct net_device* dev) +{ + u16 curCR = 0; + struct r8192_priv *priv = ieee80211_priv(dev); + RT_TRACE(COMP_EPROM, "===========>%s()\n", __FUNCTION__); + curCR = read_nic_word_E(dev,EPROM_CMD); + RT_TRACE(COMP_EPROM, "read from Reg EPROM_CMD(%x):%x\n", EPROM_CMD, curCR); + //whether need I consider BIT5? + priv->epromtype = (curCR & Cmd9346CR_9356SEL) ? EPROM_93c56 : EPROM_93c46; + RT_TRACE(COMP_EPROM, "<===========%s(), epromtype:%d\n", __FUNCTION__, priv->epromtype); +} + +//used to swap endian. as ntohl & htonl are not neccessary to swap endian, so use this instead. +static inline u16 endian_swap(u16* data) +{ + u16 tmp = *data; + *data = (tmp >> 8) | (tmp << 8); + return *data; +} +static void rtl8192_read_eeprom_info(struct net_device* dev) +{ + u16 wEPROM_ID = 0; + u8 bMac_Tmp_Addr[6] = {0x00, 0xe0, 0x4c, 0x00, 0x00, 0x02}; + u8 bLoad_From_EEPOM = false; + struct r8192_priv *priv = ieee80211_priv(dev); + u16 tmpValue = 0; + RT_TRACE(COMP_EPROM, "===========>%s()\n", __FUNCTION__); + wEPROM_ID = eprom_read(dev, 0); //first read EEPROM ID out; + RT_TRACE(COMP_EPROM, "EEPROM ID is 0x%x\n", wEPROM_ID); + + if (wEPROM_ID != RTL8190_EEPROM_ID) + { + RT_TRACE(COMP_ERR, "EEPROM ID is invalid(is 0x%x(should be 0x%x)\n", wEPROM_ID, RTL8190_EEPROM_ID); + } + else + bLoad_From_EEPOM = true; + + if (bLoad_From_EEPOM) + { + tmpValue = eprom_read(dev, (EEPROM_VID>>1)); + priv->eeprom_vid = endian_swap(&tmpValue); + priv->eeprom_pid = eprom_read(dev, (EEPROM_PID>>1)); + tmpValue = eprom_read(dev, (EEPROM_ChannelPlan>>1)); + priv->eeprom_ChannelPlan =((tmpValue&0xff00)>>8); + priv->btxpowerdata_readfromEEPORM = true; + priv->eeprom_CustomerID = eprom_read(dev, (EEPROM_Customer_ID>>1)) >>8; + } + else + { + priv->eeprom_vid = 0; + priv->eeprom_pid = 0; + priv->card_8192_version = VERSION_819xU_B; + priv->eeprom_ChannelPlan = 0; + priv->eeprom_CustomerID = 0; + } + RT_TRACE(COMP_EPROM, "vid:0x%4x, pid:0x%4x, CustomID:0x%2x, ChanPlan:0x%x\n", priv->eeprom_vid, priv->eeprom_pid, priv->eeprom_CustomerID, priv->eeprom_ChannelPlan); + //set channelplan from eeprom + priv->ChannelPlan = priv->eeprom_ChannelPlan; + if (bLoad_From_EEPOM) + { + int i; + for (i=0; i<6; i+=2) + { + u16 tmp = 0; + tmp = eprom_read(dev, (u16)((EEPROM_NODE_ADDRESS_BYTE_0 + i)>>1)); + *(u16*)(&dev->dev_addr[i]) = tmp; + } + } + else + { + memcpy(dev->dev_addr, bMac_Tmp_Addr, 6); + //should I set IDR0 here? + } + RT_TRACE(COMP_EPROM, "MAC addr:"MAC_FMT"\n", MAC_ARG(dev->dev_addr)); + priv->rf_type = RTL819X_DEFAULT_RF_TYPE; //default 1T2R + priv->rf_chip = RF_8256; + + if (priv->card_8192_version == (u8)VERSION_819xU_A) + { + //read Tx power gain offset of legacy OFDM to HT rate + if (bLoad_From_EEPOM) + priv->EEPROMTxPowerDiff = (eprom_read(dev, (EEPROM_TxPowerDiff>>1))&0xff00) >> 8; + else + priv->EEPROMTxPowerDiff = EEPROM_Default_TxPower; + RT_TRACE(COMP_EPROM, "TxPowerDiff:%d\n", priv->EEPROMTxPowerDiff); + //read ThermalMeter from EEPROM + if (bLoad_From_EEPOM) + priv->EEPROMThermalMeter = (u8)(eprom_read(dev, (EEPROM_ThermalMeter>>1))&0x00ff); + else + priv->EEPROMThermalMeter = EEPROM_Default_ThermalMeter; + RT_TRACE(COMP_EPROM, "ThermalMeter:%d\n", priv->EEPROMThermalMeter); + //vivi, for tx power track + priv->TSSI_13dBm = priv->EEPROMThermalMeter *100; + //read antenna tx power offset of B/C/D to A from EEPROM + if (bLoad_From_EEPOM) + priv->EEPROMPwDiff = (eprom_read(dev, (EEPROM_PwDiff>>1))&0x0f00)>>8; + else + priv->EEPROMPwDiff = EEPROM_Default_PwDiff; + RT_TRACE(COMP_EPROM, "TxPwDiff:%d\n", priv->EEPROMPwDiff); + // Read CrystalCap from EEPROM + if (bLoad_From_EEPOM) + priv->EEPROMCrystalCap = (eprom_read(dev, (EEPROM_CrystalCap>>1))&0x0f); + else + priv->EEPROMCrystalCap = EEPROM_Default_CrystalCap; + RT_TRACE(COMP_EPROM, "CrystalCap = %d\n", priv->EEPROMCrystalCap); + //get per-channel Tx power level + if (bLoad_From_EEPOM) + priv->EEPROM_Def_Ver = (eprom_read(dev, (EEPROM_TxPwIndex_Ver>>1))&0xff00)>>8; + else + priv->EEPROM_Def_Ver = 1; + RT_TRACE(COMP_EPROM, "EEPROM_DEF_VER:%d\n", priv->EEPROM_Def_Ver); + if (priv->EEPROM_Def_Ver == 0) //old eeprom definition + { + int i; + if (bLoad_From_EEPOM) + priv->EEPROMTxPowerLevelCCK = (eprom_read(dev, (EEPROM_TxPwIndex_CCK>>1))&0xff) >> 8; + else + priv->EEPROMTxPowerLevelCCK = 0x10; + RT_TRACE(COMP_EPROM, "CCK Tx Power Levl: 0x%02x\n", priv->EEPROMTxPowerLevelCCK); + for (i=0; i<3; i++) + { + if (bLoad_From_EEPOM) + { + tmpValue = eprom_read(dev, (EEPROM_TxPwIndex_OFDM_24G+i)>>1); + if (((EEPROM_TxPwIndex_OFDM_24G+i) % 2) == 0) + tmpValue = tmpValue & 0x00ff; + else + tmpValue = (tmpValue & 0xff00) >> 8; + } + else + tmpValue = 0x10; + priv->EEPROMTxPowerLevelOFDM24G[i] = (u8) tmpValue; + RT_TRACE(COMP_EPROM, "OFDM 2.4G Tx Power Level, Index %d = 0x%02x\n", i, priv->EEPROMTxPowerLevelCCK); + } + }//end if EEPROM_DEF_VER == 0 + else if (priv->EEPROM_Def_Ver == 1) + { + if (bLoad_From_EEPOM) + { + tmpValue = eprom_read(dev, (EEPROM_TxPwIndex_CCK_V1>>1)); + tmpValue = (tmpValue & 0xff00) >> 8; + } + else + tmpValue = 0x10; + priv->EEPROMTxPowerLevelCCK_V1[0] = (u8)tmpValue; + + if (bLoad_From_EEPOM) + tmpValue = eprom_read(dev, (EEPROM_TxPwIndex_CCK_V1 + 2)>>1); + else + tmpValue = 0x1010; + *((u16*)(&priv->EEPROMTxPowerLevelCCK_V1[1])) = tmpValue; + if (bLoad_From_EEPOM) + tmpValue = eprom_read(dev, (EEPROM_TxPwIndex_OFDM_24G_V1>>1)); + else + tmpValue = 0x1010; + *((u16*)(&priv->EEPROMTxPowerLevelOFDM24G[0])) = tmpValue; + if (bLoad_From_EEPOM) + tmpValue = eprom_read(dev, (EEPROM_TxPwIndex_OFDM_24G_V1+2)>>1); + else + tmpValue = 0x10; + priv->EEPROMTxPowerLevelOFDM24G[2] = (u8)tmpValue; + }//endif EEPROM_Def_Ver == 1 + + //update HAL variables + // + { + int i; + for (i=0; i<14; i++) + { + if (i<=3) + priv->TxPowerLevelOFDM24G[i] = priv->EEPROMTxPowerLevelOFDM24G[0]; + else if (i>=4 && i<=9) + priv->TxPowerLevelOFDM24G[i] = priv->EEPROMTxPowerLevelOFDM24G[1]; + else + priv->TxPowerLevelOFDM24G[i] = priv->EEPROMTxPowerLevelOFDM24G[2]; + } + + for (i=0; i<14; i++) + { + if (priv->EEPROM_Def_Ver == 0) + { + if (i<=3) + priv->TxPowerLevelCCK[i] = priv->EEPROMTxPowerLevelOFDM24G[0] + (priv->EEPROMTxPowerLevelCCK - priv->EEPROMTxPowerLevelOFDM24G[1]); + else if (i>=4 && i<=9) + priv->TxPowerLevelCCK[i] = priv->EEPROMTxPowerLevelCCK; + else + priv->TxPowerLevelCCK[i] = priv->EEPROMTxPowerLevelOFDM24G[2] + (priv->EEPROMTxPowerLevelCCK - priv->EEPROMTxPowerLevelOFDM24G[1]); + } + else if (priv->EEPROM_Def_Ver == 1) + { + if (i<=3) + priv->TxPowerLevelCCK[i] = priv->EEPROMTxPowerLevelCCK_V1[0]; + else if (i>=4 && i<=9) + priv->TxPowerLevelCCK[i] = priv->EEPROMTxPowerLevelCCK_V1[1]; + else + priv->TxPowerLevelCCK[i] = priv->EEPROMTxPowerLevelCCK_V1[2]; + } + } + }//end update HAL variables + priv->TxPowerDiff = priv->EEPROMPwDiff; +// Antenna B gain offset to antenna A, bit0~3 + priv->AntennaTxPwDiff[0] = (priv->EEPROMTxPowerDiff & 0xf); + // Antenna C gain offset to antenna A, bit4~7 + priv->AntennaTxPwDiff[1] = ((priv->EEPROMTxPowerDiff & 0xf0)>>4); + // CrystalCap, bit12~15 + priv->CrystalCap = priv->EEPROMCrystalCap; + // ThermalMeter, bit0~3 for RFIC1, bit4~7 for RFIC2 + // 92U does not enable TX power tracking. + priv->ThermalMeter[0] = priv->EEPROMThermalMeter; + }//end if VersionID == VERSION_819xU_A + +//added by vivi, for dlink led, 20080416 + switch(priv->eeprom_CustomerID) + { + case EEPROM_CID_RUNTOP: + priv->CustomerID = RT_CID_819x_RUNTOP; + break; + + case EEPROM_CID_DLINK: + priv->CustomerID = RT_CID_DLINK; + break; + + default: + priv->CustomerID = RT_CID_DEFAULT; + break; + + } + + switch(priv->CustomerID) + { + case RT_CID_819x_RUNTOP: + priv->LedStrategy = SW_LED_MODE2; + break; + + case RT_CID_DLINK: + priv->LedStrategy = SW_LED_MODE4; + break; + + default: + priv->LedStrategy = SW_LED_MODE0; + break; + + } + + + if(priv->rf_type == RF_1T2R) + { + RT_TRACE(COMP_EPROM, "\n1T2R config\n"); + } + else + { + RT_TRACE(COMP_EPROM, "\n2T4R config\n"); + } + + // 2008/01/16 MH We can only know RF type in the function. So we have to init + // DIG RATR table again. + init_rate_adaptive(dev); + //we need init DIG RATR table here again. + + RT_TRACE(COMP_EPROM, "<===========%s()\n", __FUNCTION__); + return; +} + +short rtl8192_get_channel_map(struct net_device * dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); +#ifdef ENABLE_DOT11D + if(priv->ChannelPlan > COUNTRY_CODE_GLOBAL_DOMAIN){ + printk("rtl8180_init:Error channel plan! Set to default.\n"); + priv->ChannelPlan= 0; + } + RT_TRACE(COMP_INIT, "Channel plan is %d\n",priv->ChannelPlan); + + rtl819x_set_channel_map(priv->ChannelPlan, priv); +#else + int ch,i; + //Set Default Channel Plan + if(!channels){ + DMESG("No channels, aborting"); + return -1; + } + ch=channels; + priv->ChannelPlan= 0;//hikaru + // set channels 1..14 allowed in given locale + for (i=1; i<=14; i++) { + (priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01); + ch >>= 1; + } +#endif + return 0; +} + +short rtl8192_init(struct net_device *dev) +{ + + struct r8192_priv *priv = ieee80211_priv(dev); + + memset(&(priv->stats),0,sizeof(struct Stats)); + memset(priv->txqueue_to_outpipemap,0,9); +#ifdef PIPE12 + { + int i=0; + u8 queuetopipe[]={3,2,1,0,4,8,7,6,5}; + memcpy(priv->txqueue_to_outpipemap,queuetopipe,9); +/* for(i=0;i<9;i++) + printk("%d ",priv->txqueue_to_outpipemap[i]); + printk("\n");*/ + } +#else + { + u8 queuetopipe[]={3,2,1,0,4,4,0,4,4}; + memcpy(priv->txqueue_to_outpipemap,queuetopipe,9); +/* for(i=0;i<9;i++) + printk("%d ",priv->txqueue_to_outpipemap[i]); + printk("\n");*/ + } +#endif + rtl8192_init_priv_variable(dev); + rtl8192_init_priv_lock(priv); + rtl8192_init_priv_task(dev); + rtl8192_get_eeprom_size(dev); + rtl8192_read_eeprom_info(dev); + rtl8192_get_channel_map(dev); + init_hal_dm(dev); + init_timer(&priv->watch_dog_timer); + priv->watch_dog_timer.data = (unsigned long)dev; + priv->watch_dog_timer.function = watch_dog_timer_callback; + if(rtl8192_usb_initendpoints(dev)!=0){ + DMESG("Endopoints initialization failed"); + return -ENOMEM; + } + + //rtl8192_adapter_start(dev); +#ifdef DEBUG_EPROM + dump_eprom(dev); +#endif + return 0; +} + +/****************************************************************************** + *function: This function actually only set RRSR, RATR and BW_OPMODE registers + * not to do all the hw config as its name says + * input: net_device dev + * output: none + * return: none + * notice: This part need to modified according to the rate set we filtered + * ****************************************************************************/ +void rtl8192_hwconfig(struct net_device* dev) +{ + u32 regRATR = 0, regRRSR = 0; + u8 regBwOpMode = 0, regTmp = 0; + struct r8192_priv *priv = ieee80211_priv(dev); + +// Set RRSR, RATR, and BW_OPMODE registers + // + switch(priv->ieee80211->mode) + { + case WIRELESS_MODE_B: + regBwOpMode = BW_OPMODE_20MHZ; + regRATR = RATE_ALL_CCK; + regRRSR = RATE_ALL_CCK; + break; + case WIRELESS_MODE_A: + regBwOpMode = BW_OPMODE_5G |BW_OPMODE_20MHZ; + regRATR = RATE_ALL_OFDM_AG; + regRRSR = RATE_ALL_OFDM_AG; + break; + case WIRELESS_MODE_G: + regBwOpMode = BW_OPMODE_20MHZ; + regRATR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; + regRRSR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; + break; + case WIRELESS_MODE_AUTO: +#ifdef TO_DO_LIST + if (Adapter->bInHctTest) + { + regBwOpMode = BW_OPMODE_20MHZ; + regRATR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; + regRRSR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; + } + else +#endif + { + regBwOpMode = BW_OPMODE_20MHZ; + regRATR = RATE_ALL_CCK | RATE_ALL_OFDM_AG | RATE_ALL_OFDM_1SS | RATE_ALL_OFDM_2SS; + regRRSR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; + } + break; + case WIRELESS_MODE_N_24G: + // It support CCK rate by default. + // CCK rate will be filtered out only when associated AP does not support it. + regBwOpMode = BW_OPMODE_20MHZ; + regRATR = RATE_ALL_CCK | RATE_ALL_OFDM_AG | RATE_ALL_OFDM_1SS | RATE_ALL_OFDM_2SS; + regRRSR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; + break; + case WIRELESS_MODE_N_5G: + regBwOpMode = BW_OPMODE_5G; + regRATR = RATE_ALL_OFDM_AG | RATE_ALL_OFDM_1SS | RATE_ALL_OFDM_2SS; + regRRSR = RATE_ALL_OFDM_AG; + break; + } + + write_nic_byte(dev, BW_OPMODE, regBwOpMode); + { + u32 ratr_value = 0; + ratr_value = regRATR; + if (priv->rf_type == RF_1T2R) + { + ratr_value &= ~(RATE_ALL_OFDM_2SS); + } + write_nic_dword(dev, RATR0, ratr_value); + write_nic_byte(dev, UFWP, 1); + } + regTmp = read_nic_byte(dev, 0x313); + regRRSR = ((regTmp) << 24) | (regRRSR & 0x00ffffff); + write_nic_dword(dev, RRSR, regRRSR); + + // + // Set Retry Limit here + // + write_nic_word(dev, RETRY_LIMIT, + priv->ShortRetryLimit << RETRY_LIMIT_SHORT_SHIFT | \ + priv->LongRetryLimit << RETRY_LIMIT_LONG_SHIFT); + // Set Contention Window here + + // Set Tx AGC + + // Set Tx Antenna including Feedback control + + // Set Auto Rate fallback control + + +} + + +//InitializeAdapter and PhyCfg +bool rtl8192_adapter_start(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u32 dwRegRead = 0; + bool init_status = true; + RT_TRACE(COMP_INIT, "====>%s()\n", __FUNCTION__); + priv->Rf_Mode = RF_OP_By_SW_3wire; + //for ASIC power on sequence + write_nic_byte_E(dev, 0x5f, 0x80); + mdelay(50); + write_nic_byte_E(dev, 0x5f, 0xf0); + write_nic_byte_E(dev, 0x5d, 0x00); + write_nic_byte_E(dev, 0x5e, 0x80); + write_nic_byte(dev, 0x17, 0x37); + mdelay(10); +//#ifdef TO_DO_LIST + priv->pFirmware->firmware_status = FW_STATUS_0_INIT; + //config CPUReset Register + //Firmware Reset or not? + dwRegRead = read_nic_dword(dev, CPU_GEN); + if (priv->pFirmware->firmware_status == FW_STATUS_0_INIT) + dwRegRead |= CPU_GEN_SYSTEM_RESET; //do nothing here? + else if (priv->pFirmware->firmware_status == FW_STATUS_5_READY) + dwRegRead |= CPU_GEN_FIRMWARE_RESET; + else + RT_TRACE(COMP_ERR, "ERROR in %s(): undefined firmware state(%d)\n", __FUNCTION__, priv->pFirmware->firmware_status); + + write_nic_dword(dev, CPU_GEN, dwRegRead); + //mdelay(30); + //config BB. + rtl8192_BBConfig(dev); + +#if 1 + //Loopback mode or not + priv->LoopbackMode = RTL819xU_NO_LOOPBACK; +// priv->LoopbackMode = RTL819xU_MAC_LOOPBACK; + + dwRegRead = read_nic_dword(dev, CPU_GEN); + if (priv->LoopbackMode == RTL819xU_NO_LOOPBACK) + dwRegRead = ((dwRegRead & CPU_GEN_NO_LOOPBACK_MSK) | CPU_GEN_NO_LOOPBACK_SET); + else if (priv->LoopbackMode == RTL819xU_MAC_LOOPBACK) + dwRegRead |= CPU_CCK_LOOPBACK; + else + RT_TRACE(COMP_ERR, "Serious error in %s(): wrong loopback mode setting(%d)\n", __FUNCTION__, priv->LoopbackMode); + + write_nic_dword(dev, CPU_GEN, dwRegRead); + + //after reset cpu, we need wait for a seconds to write in register. + udelay(500); + + //xiong add for new bitfile:usb suspend reset pin set to 1. //do we need? + write_nic_byte_E(dev, 0x5f, (read_nic_byte_E(dev, 0x5f)|0x20)); + + //Set Hardware + rtl8192_hwconfig(dev); + + //turn on Tx/Rx + write_nic_byte(dev, CMDR, CR_RE|CR_TE); + + //set IDR0 here + write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]); + write_nic_word(dev, MAC4, ((u16*)(dev->dev_addr + 4))[0]); + + //set RCR + write_nic_dword(dev, RCR, priv->ReceiveConfig); + + //Initialize Number of Reserved Pages in Firmware Queue + write_nic_dword(dev, RQPN1, NUM_OF_PAGE_IN_FW_QUEUE_BK << RSVD_FW_QUEUE_PAGE_BK_SHIFT |\ + NUM_OF_PAGE_IN_FW_QUEUE_BE << RSVD_FW_QUEUE_PAGE_BE_SHIFT | \ + NUM_OF_PAGE_IN_FW_QUEUE_VI << RSVD_FW_QUEUE_PAGE_VI_SHIFT | \ + NUM_OF_PAGE_IN_FW_QUEUE_VO <ResetProgress is %d\n", __FUNCTION__,priv->ResetProgress); + if(priv->ResetProgress == RESET_TYPE_NORESET) + rtl8192_SetWirelessMode(dev, priv->ieee80211->mode); + if(priv->ResetProgress == RESET_TYPE_NORESET){ + CamResetAllEntry(dev); + { + u8 SECR_value = 0x0; + SECR_value |= SCR_TxEncEnable; + SECR_value |= SCR_RxDecEnable; + SECR_value |= SCR_NoSKMC; + write_nic_byte(dev, SECR, SECR_value); + } + } + + //Beacon related + write_nic_word(dev, ATIMWND, 2); + write_nic_word(dev, BCN_INTERVAL, 100); + + { +#define DEFAULT_EDCA 0x005e4332 + int i; + for (i=0; iResetProgress == RESET_TYPE_NORESET) + { + u32 ulValue; + PRT_HIGH_THROUGHPUT pHTInfo = priv->ieee80211->pHTInfo; + ulValue = (pHTInfo->UsbRxFwAggrEn<<24) | (pHTInfo->UsbRxFwAggrPageNum<<16) | + (pHTInfo->UsbRxFwAggrPacketNum<<8) | (pHTInfo->UsbRxFwAggrTimeout); + /* + * If usb rx firmware aggregation is enabled, + * when anyone of three threshold conditions above is reached, + * firmware will send aggregated packet to driver. + */ + write_nic_dword(dev, 0x1a8, ulValue); + priv->bCurrentRxAggrEnable = true; + } +#endif + + rtl8192_phy_configmac(dev); + + if (priv->card_8192_version == (u8) VERSION_819xU_A) + { + rtl8192_phy_getTxPower(dev); + rtl8192_phy_setTxPower(dev, priv->chan); + } + + //Firmware download + init_status = init_firmware(dev); + if(!init_status) + { + RT_TRACE(COMP_ERR,"ERR!!! %s(): Firmware download is failed\n", __FUNCTION__); + return init_status; + } + RT_TRACE(COMP_INIT, "%s():after firmware download\n", __FUNCTION__); + // +#ifdef TO_DO_LIST +if(Adapter->ResetProgress == RESET_TYPE_NORESET) + { + if(pMgntInfo->RegRfOff == TRUE) + { // User disable RF via registry. + RT_TRACE((COMP_INIT|COMP_RF), DBG_LOUD, ("InitializeAdapter819xUsb(): Turn off RF for RegRfOff ----------\n")); + MgntActSet_RF_State(Adapter, eRfOff, RF_CHANGE_BY_SW); + // Those action will be discard in MgntActSet_RF_State because off the same state + for(eRFPath = 0; eRFPath NumTotalRFPath; eRFPath++) + PHY_SetRFReg(Adapter, (RF90_RADIO_PATH_E)eRFPath, 0x4, 0xC00, 0x0); + } + else if(pMgntInfo->RfOffReason > RF_CHANGE_BY_PS) + { // H/W or S/W RF OFF before sleep. + RT_TRACE((COMP_INIT|COMP_RF), DBG_LOUD, ("InitializeAdapter819xUsb(): Turn off RF for RfOffReason(%d) ----------\n", pMgntInfo->RfOffReason)); + MgntActSet_RF_State(Adapter, eRfOff, pMgntInfo->RfOffReason); + } + else + { + pHalData->eRFPowerState = eRfOn; + pMgntInfo->RfOffReason = 0; + RT_TRACE((COMP_INIT|COMP_RF), DBG_LOUD, ("InitializeAdapter819xUsb(): RF is on ----------\n")); + } + } + else + { + if(pHalData->eRFPowerState == eRfOff) + { + MgntActSet_RF_State(Adapter, eRfOff, pMgntInfo->RfOffReason); + // Those action will be discard in MgntActSet_RF_State because off the same state + for(eRFPath = 0; eRFPath NumTotalRFPath; eRFPath++) + PHY_SetRFReg(Adapter, (RF90_RADIO_PATH_E)eRFPath, 0x4, 0xC00, 0x0); + } + } +#endif + //config RF. + if(priv->ResetProgress == RESET_TYPE_NORESET){ + rtl8192_phy_RFConfig(dev); + RT_TRACE(COMP_INIT, "%s():after phy RF config\n", __FUNCTION__); + } + + + if(priv->ieee80211->FwRWRF) + // We can force firmware to do RF-R/W + priv->Rf_Mode = RF_OP_By_FW; + else + priv->Rf_Mode = RF_OP_By_SW_3wire; + + + rtl8192_phy_updateInitGain(dev); + /*--set CCK and OFDM Block "ON"--*/ + rtl8192_setBBreg(dev, rFPGA0_RFMOD, bCCKEn, 0x1); + rtl8192_setBBreg(dev, rFPGA0_RFMOD, bOFDMEn, 0x1); + + if(priv->ResetProgress == RESET_TYPE_NORESET) + { + //if D or C cut + u8 tmpvalue = read_nic_byte(dev, 0x301); + if(tmpvalue ==0x03) + { + priv->bDcut = TRUE; + RT_TRACE(COMP_POWER_TRACKING, "D-cut\n"); + } + else + { + priv->bDcut = FALSE; + RT_TRACE(COMP_POWER_TRACKING, "C-cut\n"); + } + dm_initialize_txpower_tracking(dev); + + if(priv->bDcut == TRUE) + { + u32 i, TempCCk; + u32 tmpRegA= rtl8192_QueryBBReg(dev,rOFDM0_XATxIQImbalance,bMaskDWord); + // u32 tmpRegC= rtl8192_QueryBBReg(dev,rOFDM0_XCTxIQImbalance,bMaskDWord); + for(i = 0; itxbbgain_table[i].txbbgain_value) + { + priv->rfa_txpowertrackingindex= (u8)i; + priv->rfa_txpowertrackingindex_real= (u8)i; + priv->rfa_txpowertracking_default= priv->rfa_txpowertrackingindex; + break; + } + } + + TempCCk = rtl8192_QueryBBReg(dev, rCCK0_TxFilter1, bMaskByte2); + + for(i=0 ; icck_txbbgain_table[i].ccktxbb_valuearray[0]) + { + priv->cck_present_attentuation_20Mdefault=(u8) i; + break; + } + } + priv->cck_present_attentuation_40Mdefault= 0; + priv->cck_present_attentuation_difference= 0; + priv->cck_present_attentuation = priv->cck_present_attentuation_20Mdefault; + + // pMgntInfo->bTXPowerTracking = FALSE;//TEMPLY DISABLE + } + } + write_nic_byte(dev, 0x87, 0x0); + + +#endif + return init_status; +} + +/* this configures registers for beacon tx and enables it via + * rtl8192_beacon_tx_enable(). rtl8192_beacon_tx_disable() might + * be used to stop beacon transmission + */ +#if 0 +void rtl8192_start_tx_beacon(struct net_device *dev) +{ + int i; + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + u16 word; + DMESG("Enabling beacon TX"); + //write_nic_byte(dev, TX_CONF,0xe6);// TX_CONF + //rtl8192_init_beacon(dev); + //set_nic_txring(dev); +// rtl8192_prepare_beacon(dev); + rtl8192_irq_disable(dev); +// rtl8192_beacon_tx_enable(dev); + rtl8192_set_mode(dev,EPROM_CMD_CONFIG); + //write_nic_byte(dev,0x9d,0x20); //DMA Poll + //write_nic_word(dev,0x7a,0); + //write_nic_word(dev,0x7a,0x8000); + + + word = read_nic_word(dev, BcnItv); + word &= ~BcnItv_BcnItv; // clear Bcn_Itv + write_nic_word(dev, BcnItv, word); + + write_nic_word(dev, AtimWnd, + read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd); + + word = read_nic_word(dev, BCN_INTR_ITV); + word &= ~BCN_INTR_ITV_MASK; + + //word |= priv->ieee80211->beacon_interval * + // ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1); + // FIXME:FIXME check if correct ^^ worked with 0x3e8; + + write_nic_word(dev, BCN_INTR_ITV, word); + + //write_nic_word(dev,0x2e,0xe002); + //write_nic_dword(dev,0x30,0xb8c7832e); + for(i=0; iieee80211->beacon_cell_ssid[i]); + +// rtl8192_update_msr(dev); + + + //write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */ + + rtl8192_set_mode(dev, EPROM_CMD_NORMAL); + + rtl8192_irq_enable(dev); + + /* VV !!!!!!!!!! VV*/ + /* + rtl8192_set_mode(dev,EPROM_CMD_CONFIG); + write_nic_byte(dev,0x9d,0x00); + rtl8192_set_mode(dev,EPROM_CMD_NORMAL); +*/ +} +#endif +/*************************************************************************** + -------------------------------NET STUFF--------------------------- +***************************************************************************/ + +static struct net_device_stats *rtl8192_stats(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + return &priv->ieee80211->stats; +} + +bool +HalTxCheckStuck819xUsb( + struct net_device *dev + ) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u16 RegTxCounter = read_nic_word(dev, 0x128); + bool bStuck = FALSE; + RT_TRACE(COMP_RESET,"%s():RegTxCounter is %d,TxCounter is %d\n",__FUNCTION__,RegTxCounter,priv->TxCounter); + if(priv->TxCounter==RegTxCounter) + bStuck = TRUE; + + priv->TxCounter = RegTxCounter; + + return bStuck; +} + +/* +* +* First added: 2006.11.19 by emily +*/ +RESET_TYPE +TxCheckStuck(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u8 QueueID; +// PRT_TCB pTcb; +// u8 ResetThreshold; + bool bCheckFwTxCnt = false; + //unsigned long flags; + + // + // Decide Stuch threshold according to current power save mode + // + +// RT_TRACE(COMP_RESET, " ==> TxCheckStuck()\n"); +// PlatformAcquireSpinLock(Adapter, RT_TX_SPINLOCK); +// spin_lock_irqsave(&priv->ieee80211->lock,flags); + for (QueueID = 0; QueueID<=BEACON_QUEUE;QueueID ++) + { + if(QueueID == TXCMD_QUEUE) + continue; +#if 1 +#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE + if((skb_queue_len(&priv->ieee80211->skb_waitQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_aggQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_drv_aggQ[QueueID]) == 0)) +#else + if((skb_queue_len(&priv->ieee80211->skb_waitQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_aggQ[QueueID]) == 0)) +#endif + continue; +#endif + + bCheckFwTxCnt = true; + } +// PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK); +// spin_unlock_irqrestore(&priv->ieee80211->lock,flags); +// RT_TRACE(COMP_RESET,"bCheckFwTxCnt is %d\n",bCheckFwTxCnt); +#if 1 + if(bCheckFwTxCnt) + { + if(HalTxCheckStuck819xUsb(dev)) + { + RT_TRACE(COMP_RESET, "TxCheckStuck(): Fw indicates no Tx condition! \n"); + return RESET_TYPE_SILENT; + } + } +#endif + return RESET_TYPE_NORESET; +} + +bool +HalRxCheckStuck819xUsb(struct net_device *dev) +{ + u16 RegRxCounter = read_nic_word(dev, 0x130); + struct r8192_priv *priv = ieee80211_priv(dev); + bool bStuck = FALSE; + static u8 rx_chk_cnt = 0; + RT_TRACE(COMP_RESET,"%s(): RegRxCounter is %d,RxCounter is %d\n",__FUNCTION__,RegRxCounter,priv->RxCounter); + // If rssi is small, we should check rx for long time because of bad rx. + // or maybe it will continuous silent reset every 2 seconds. + rx_chk_cnt++; + if(priv->undecorated_smoothed_pwdb >= (RateAdaptiveTH_High+5)) + { + rx_chk_cnt = 0; //high rssi, check rx stuck right now. + } + else if(priv->undecorated_smoothed_pwdb < (RateAdaptiveTH_High+5) && + ((priv->CurrentChannelBW!=HT_CHANNEL_WIDTH_20&&priv->undecorated_smoothed_pwdb>=RateAdaptiveTH_Low_40M) || + (priv->CurrentChannelBW==HT_CHANNEL_WIDTH_20&&priv->undecorated_smoothed_pwdb>=RateAdaptiveTH_Low_20M)) ) + { + if(rx_chk_cnt < 2) + { + return bStuck; + } + else + { + rx_chk_cnt = 0; + } + } + else if(((priv->CurrentChannelBW!=HT_CHANNEL_WIDTH_20&&priv->undecorated_smoothed_pwdbCurrentChannelBW==HT_CHANNEL_WIDTH_20&&priv->undecorated_smoothed_pwdbundecorated_smoothed_pwdb >= VeryLowRSSI) + { + if(rx_chk_cnt < 4) + { + //DbgPrint("RSSI < %d && RSSI >= %d, no check this time \n", RateAdaptiveTH_Low, VeryLowRSSI); + return bStuck; + } + else + { + rx_chk_cnt = 0; + //DbgPrint("RSSI < %d && RSSI >= %d, check this time \n", RateAdaptiveTH_Low, VeryLowRSSI); + } + } + else + { + if(rx_chk_cnt < 8) + { + //DbgPrint("RSSI <= %d, no check this time \n", VeryLowRSSI); + return bStuck; + } + else + { + rx_chk_cnt = 0; + //DbgPrint("RSSI <= %d, check this time \n", VeryLowRSSI); + } + } + + if(priv->RxCounter==RegRxCounter) + bStuck = TRUE; + + priv->RxCounter = RegRxCounter; + + return bStuck; +} + +RESET_TYPE +RxCheckStuck(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + //int i; + bool bRxCheck = FALSE; + +// RT_TRACE(COMP_RESET," ==> RxCheckStuck()\n"); + //PlatformAcquireSpinLock(Adapter, RT_RX_SPINLOCK); + + if(priv->IrpPendingCount > 1) + bRxCheck = TRUE; + //PlatformReleaseSpinLock(Adapter, RT_RX_SPINLOCK); + +// RT_TRACE(COMP_RESET,"bRxCheck is %d \n",bRxCheck); + if(bRxCheck) + { + if(HalRxCheckStuck819xUsb(dev)) + { + RT_TRACE(COMP_RESET, "RxStuck Condition\n"); + return RESET_TYPE_SILENT; + } + } + return RESET_TYPE_NORESET; +} + + +/** +* This function is called by Checkforhang to check whether we should ask OS to reset driver +* +* \param pAdapter The adapter context for this miniport +* +* Note:NIC with USB interface sholud not call this function because we cannot scan descriptor +* to judge whether there is tx stuck. +* Note: This function may be required to be rewrite for Vista OS. +* <<>> +* +* 8185 and 8185b does not implement this function. This is added by Emily at 2006.11.24 +*/ +RESET_TYPE +rtl819x_ifcheck_resetornot(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + RESET_TYPE TxResetType = RESET_TYPE_NORESET; + RESET_TYPE RxResetType = RESET_TYPE_NORESET; + RT_RF_POWER_STATE rfState; + + rfState = priv->ieee80211->eRFPowerState; + + TxResetType = TxCheckStuck(dev); +#if 1 + if( rfState != eRfOff || + /*ADAPTER_TEST_STATUS_FLAG(Adapter, ADAPTER_STATUS_FW_DOWNLOAD_FAILURE)) &&*/ + (priv->ieee80211->iw_mode != IW_MODE_ADHOC)) + { + // If driver is in the status of firmware download failure , driver skips RF initialization and RF is + // in turned off state. Driver should check whether Rx stuck and do silent reset. And + // if driver is in firmware download failure status, driver should initialize RF in the following + // silent reset procedure Emily, 2008.01.21 + + // Driver should not check RX stuck in IBSS mode because it is required to + // set Check BSSID in order to send beacon, however, if check BSSID is + // set, STA cannot hear any packet a all. Emily, 2008.04.12 + RxResetType = RxCheckStuck(dev); + } +#endif + if(TxResetType==RESET_TYPE_NORMAL || RxResetType==RESET_TYPE_NORMAL) + return RESET_TYPE_NORMAL; + else if(TxResetType==RESET_TYPE_SILENT || RxResetType==RESET_TYPE_SILENT){ + RT_TRACE(COMP_RESET,"%s():silent reset\n",__FUNCTION__); + return RESET_TYPE_SILENT; + } + else + return RESET_TYPE_NORESET; + +} + +void rtl8192_cancel_deferred_work(struct r8192_priv* priv); +int _rtl8192_up(struct net_device *dev); +int rtl8192_close(struct net_device *dev); + + + +void +CamRestoreAllEntry( struct net_device *dev) +{ + u8 EntryId = 0; + struct r8192_priv *priv = ieee80211_priv(dev); + u8* MacAddr = priv->ieee80211->current_network.bssid; + + static u8 CAM_CONST_ADDR[4][6] = { + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x03}}; + static u8 CAM_CONST_BROAD[] = + {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + + RT_TRACE(COMP_SEC, "CamRestoreAllEntry: \n"); + + + if ((priv->ieee80211->pairwise_key_type == KEY_TYPE_WEP40)|| + (priv->ieee80211->pairwise_key_type == KEY_TYPE_WEP104)) + { + + for(EntryId=0; EntryId<4; EntryId++) + { + { + MacAddr = CAM_CONST_ADDR[EntryId]; + setKey(dev, + EntryId , + EntryId, + priv->ieee80211->pairwise_key_type, + MacAddr, + 0, + NULL); + } + } + + } + else if(priv->ieee80211->pairwise_key_type == KEY_TYPE_TKIP) + { + + { + if(priv->ieee80211->iw_mode == IW_MODE_ADHOC) + setKey(dev, + 4, + 0, + priv->ieee80211->pairwise_key_type, + (u8*)dev->dev_addr, + 0, + NULL); + else + setKey(dev, + 4, + 0, + priv->ieee80211->pairwise_key_type, + MacAddr, + 0, + NULL); + } + } + else if(priv->ieee80211->pairwise_key_type == KEY_TYPE_CCMP) + { + + { + if(priv->ieee80211->iw_mode == IW_MODE_ADHOC) + setKey(dev, + 4, + 0, + priv->ieee80211->pairwise_key_type, + (u8*)dev->dev_addr, + 0, + NULL); + else + setKey(dev, + 4, + 0, + priv->ieee80211->pairwise_key_type, + MacAddr, + 0, + NULL); + } + } + + + + if(priv->ieee80211->group_key_type == KEY_TYPE_TKIP) + { + MacAddr = CAM_CONST_BROAD; + for(EntryId=1 ; EntryId<4 ; EntryId++) + { + { + setKey(dev, + EntryId, + EntryId, + priv->ieee80211->group_key_type, + MacAddr, + 0, + NULL); + } + } + if(priv->ieee80211->iw_mode == IW_MODE_ADHOC) + setKey(dev, + 0, + 0, + priv->ieee80211->group_key_type, + CAM_CONST_ADDR[0], + 0, + NULL); + } + else if(priv->ieee80211->group_key_type == KEY_TYPE_CCMP) + { + MacAddr = CAM_CONST_BROAD; + for(EntryId=1; EntryId<4 ; EntryId++) + { + { + setKey(dev, + EntryId , + EntryId, + priv->ieee80211->group_key_type, + MacAddr, + 0, + NULL); + } + } + + if(priv->ieee80211->iw_mode == IW_MODE_ADHOC) + setKey(dev, + 0 , + 0, + priv->ieee80211->group_key_type, + CAM_CONST_ADDR[0], + 0, + NULL); + } +} +////////////////////////////////////////////////////////////// +// This function is used to fix Tx/Rx stop bug temporarily. +// This function will do "system reset" to NIC when Tx or Rx is stuck. +// The method checking Tx/Rx stuck of this function is supported by FW, +// which reports Tx and Rx counter to register 0x128 and 0x130. +////////////////////////////////////////////////////////////// +void +rtl819x_ifsilentreset(struct net_device *dev) +{ + //OCTET_STRING asocpdu; + struct r8192_priv *priv = ieee80211_priv(dev); + u8 reset_times = 0; + int reset_status = 0; + struct ieee80211_device *ieee = priv->ieee80211; + + + // 2007.07.20. If we need to check CCK stop, please uncomment this line. + //bStuck = Adapter->HalFunc.CheckHWStopHandler(Adapter); + + if(priv->ResetProgress==RESET_TYPE_NORESET) + { +RESET_START: + + RT_TRACE(COMP_RESET,"=========>Reset progress!! \n"); + + // Set the variable for reset. + priv->ResetProgress = RESET_TYPE_SILENT; +// rtl8192_close(dev); +#if 1 + down(&priv->wx_sem); + if(priv->up == 0) + { + RT_TRACE(COMP_ERR,"%s():the driver is not up! return\n",__FUNCTION__); + up(&priv->wx_sem); + return ; + } + priv->up = 0; + RT_TRACE(COMP_RESET,"%s():======>start to down the driver\n",__FUNCTION__); +// if(!netif_queue_stopped(dev)) +// netif_stop_queue(dev); + + rtl8192_rtx_disable(dev); + rtl8192_cancel_deferred_work(priv); + deinit_hal_dm(dev); + del_timer_sync(&priv->watch_dog_timer); + + ieee->sync_scan_hurryup = 1; + if(ieee->state == IEEE80211_LINKED) + { + down(&ieee->wx_sem); + printk("ieee->state is IEEE80211_LINKED\n"); + ieee80211_stop_send_beacons(priv->ieee80211); + del_timer_sync(&ieee->associate_timer); + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + cancel_delayed_work(&ieee->associate_retry_wq); + #endif + ieee80211_stop_scan(ieee); + netif_carrier_off(dev); + up(&ieee->wx_sem); + } + else{ + printk("ieee->state is NOT LINKED\n"); + ieee80211_softmac_stop_protocol(priv->ieee80211); } + up(&priv->wx_sem); + RT_TRACE(COMP_RESET,"%s():<==========down process is finished\n",__FUNCTION__); + //rtl8192_irq_disable(dev); + RT_TRACE(COMP_RESET,"%s():===========>start to up the driver\n",__FUNCTION__); + reset_status = _rtl8192_up(dev); + + RT_TRACE(COMP_RESET,"%s():<===========up process is finished\n",__FUNCTION__); + if(reset_status == -EAGAIN) + { + if(reset_times < 3) + { + reset_times++; + goto RESET_START; + } + else + { + RT_TRACE(COMP_ERR," ERR!!! %s(): Reset Failed!!\n", __FUNCTION__); + } + } +#endif + ieee->is_silent_reset = 1; +#if 1 + EnableHWSecurityConfig8192(dev); +#if 1 + if(ieee->state == IEEE80211_LINKED && ieee->iw_mode == IW_MODE_INFRA) + { + ieee->set_chan(ieee->dev, ieee->current_network.channel); + +#if 1 +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + queue_work(ieee->wq, &ieee->associate_complete_wq); +#else + schedule_task(&ieee->associate_complete_wq); +#endif +#endif + + } + else if(ieee->state == IEEE80211_LINKED && ieee->iw_mode == IW_MODE_ADHOC) + { + ieee->set_chan(ieee->dev, ieee->current_network.channel); + ieee->link_change(ieee->dev); + + // notify_wx_assoc_event(ieee); + + ieee80211_start_send_beacons(ieee); + + if (ieee->data_hard_resume) + ieee->data_hard_resume(ieee->dev); + netif_carrier_on(ieee->dev); + } +#endif + + CamRestoreAllEntry(dev); + + priv->ResetProgress = RESET_TYPE_NORESET; + priv->reset_count++; + + priv->bForcedSilentReset =false; + priv->bResetInProgress = false; + + // For test --> force write UFWP. + write_nic_byte(dev, UFWP, 1); + RT_TRACE(COMP_RESET, "Reset finished!! ====>[%d]\n", priv->reset_count); +#endif + } +} + +void CAM_read_entry( + struct net_device *dev, + u32 iIndex +) +{ + u32 target_command=0; + u32 target_content=0; + u8 entry_i=0; + u32 ulStatus; + s32 i=100; +// printk("=======>start read CAM\n"); + for(entry_i=0;entry_i=0) + { + ulStatus = read_nic_dword(dev, RWCAM); + if(ulStatus & BIT31){ + continue; + } + else{ + break; + } + } +#endif + write_nic_dword(dev, RWCAM, target_command); + RT_TRACE(COMP_SEC,"CAM_read_entry(): WRITE A0: %x \n",target_command); + // printk("CAM_read_entry(): WRITE A0: %lx \n",target_command); + target_content = read_nic_dword(dev, RCAMO); + RT_TRACE(COMP_SEC, "CAM_read_entry(): WRITE A8: %x \n",target_content); + // printk("CAM_read_entry(): WRITE A8: %lx \n",target_content); + } + printk("\n"); +} + +void rtl819x_update_rxcounts( + struct r8192_priv *priv, + u32* TotalRxBcnNum, + u32* TotalRxDataNum +) +{ + u16 SlotIndex; + u8 i; + + *TotalRxBcnNum = 0; + *TotalRxDataNum = 0; + + SlotIndex = (priv->ieee80211->LinkDetectInfo.SlotIndex++)%(priv->ieee80211->LinkDetectInfo.SlotNum); + priv->ieee80211->LinkDetectInfo.RxBcnNum[SlotIndex] = priv->ieee80211->LinkDetectInfo.NumRecvBcnInPeriod; + priv->ieee80211->LinkDetectInfo.RxDataNum[SlotIndex] = priv->ieee80211->LinkDetectInfo.NumRecvDataInPeriod; + for( i=0; iieee80211->LinkDetectInfo.SlotNum; i++ ){ + *TotalRxBcnNum += priv->ieee80211->LinkDetectInfo.RxBcnNum[i]; + *TotalRxDataNum += priv->ieee80211->LinkDetectInfo.RxDataNum[i]; + } +} + + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +extern void rtl819x_watchdog_wqcallback(struct work_struct *work) +{ + struct delayed_work *dwork = container_of(work,struct delayed_work,work); + struct r8192_priv *priv = container_of(dwork,struct r8192_priv,watch_dog_wq); + struct net_device *dev = priv->ieee80211->dev; +#else +extern void rtl819x_watchdog_wqcallback(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); +#endif + struct ieee80211_device* ieee = priv->ieee80211; + RESET_TYPE ResetType = RESET_TYPE_NORESET; + static u8 check_reset_cnt=0; + bool bBusyTraffic = false; + + if(!priv->up) + return; + hal_dm_watchdog(dev); + + {//to get busy traffic condition + if(ieee->state == IEEE80211_LINKED) + { + if( ieee->LinkDetectInfo.NumRxOkInPeriod> 666 || + ieee->LinkDetectInfo.NumTxOkInPeriod> 666 ) { + bBusyTraffic = true; + } + ieee->LinkDetectInfo.NumRxOkInPeriod = 0; + ieee->LinkDetectInfo.NumTxOkInPeriod = 0; + ieee->LinkDetectInfo.bBusyTraffic = bBusyTraffic; + } + } + //added by amy for AP roaming + { + if(priv->ieee80211->state == IEEE80211_LINKED && priv->ieee80211->iw_mode == IW_MODE_INFRA) + { + u32 TotalRxBcnNum = 0; + u32 TotalRxDataNum = 0; + + rtl819x_update_rxcounts(priv, &TotalRxBcnNum, &TotalRxDataNum); + if((TotalRxBcnNum+TotalRxDataNum) == 0) + { + #ifdef TODO + if(rfState == eRfOff) + RT_TRACE(COMP_ERR,"========>%s()\n",__FUNCTION__); + #endif + printk("===>%s(): AP is power off,connect another one\n",__FUNCTION__); + // Dot11d_Reset(dev); + priv->ieee80211->state = IEEE80211_ASSOCIATING; + notify_wx_assoc_event(priv->ieee80211); + RemovePeerTS(priv->ieee80211,priv->ieee80211->current_network.bssid); + priv->ieee80211->link_change(dev); +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + queue_work(priv->ieee80211->wq, &priv->ieee80211->associate_procedure_wq); +#else + schedule_task(&priv->ieee80211->associate_procedure_wq); +#endif + + } + } + priv->ieee80211->LinkDetectInfo.NumRecvBcnInPeriod=0; + priv->ieee80211->LinkDetectInfo.NumRecvDataInPeriod=0; + } +// CAM_read_entry(dev,4); + //check if reset the driver + if(check_reset_cnt++ >= 3) + { + ResetType = rtl819x_ifcheck_resetornot(dev); + check_reset_cnt = 3; + //DbgPrint("Start to check silent reset\n"); + } + // RT_TRACE(COMP_RESET,"%s():priv->force_reset is %d,priv->ResetProgress is %d, priv->bForcedSilentReset is %d,priv->bDisableNormalResetCheck is %d,ResetType is %d\n",__FUNCTION__,priv->force_reset,priv->ResetProgress,priv->bForcedSilentReset,priv->bDisableNormalResetCheck,ResetType); +#if 1 + if( (priv->force_reset) || (priv->ResetProgress==RESET_TYPE_NORESET && + (priv->bForcedSilentReset || + (!priv->bDisableNormalResetCheck && ResetType==RESET_TYPE_SILENT)))) // This is control by OID set in Pomelo + { + RT_TRACE(COMP_RESET,"%s():priv->force_reset is %d,priv->ResetProgress is %d, priv->bForcedSilentReset is %d,priv->bDisableNormalResetCheck is %d,ResetType is %d\n",__FUNCTION__,priv->force_reset,priv->ResetProgress,priv->bForcedSilentReset,priv->bDisableNormalResetCheck,ResetType); + rtl819x_ifsilentreset(dev); + } +#endif + priv->force_reset = false; + priv->bForcedSilentReset = false; + priv->bResetInProgress = false; + RT_TRACE(COMP_TRACE, " <==RtUsbCheckForHangWorkItemCallback()\n"); + +} + +void watch_dog_timer_callback(unsigned long data) +{ + struct r8192_priv *priv = ieee80211_priv((struct net_device *) data); + //printk("===============>watch_dog timer\n"); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) + queue_delayed_work(priv->priv_wq,&priv->watch_dog_wq, 0); +#else +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + schedule_task(&priv->watch_dog_wq); +#else + queue_work(priv->priv_wq,&priv->watch_dog_wq); +#endif +#endif + mod_timer(&priv->watch_dog_timer, jiffies + MSECS(IEEE80211_WATCH_DOG_TIME)); +#if 0 + priv->watch_dog_timer.expires = jiffies + MSECS(IEEE80211_WATCH_DOG_TIME); + add_timer(&priv->watch_dog_timer); +#endif +} +int _rtl8192_up(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + //int i; + int init_status = 0; + priv->up=1; + priv->ieee80211->ieee_up=1; + RT_TRACE(COMP_INIT, "Bringing up iface"); + init_status = rtl8192_adapter_start(dev); + if(!init_status) + { + RT_TRACE(COMP_ERR,"ERR!!! %s(): initialization is failed!\n", __FUNCTION__); + priv->up=priv->ieee80211->ieee_up = 0; + return -EAGAIN; + } + RT_TRACE(COMP_INIT, "start adapter finished\n"); + rtl8192_rx_enable(dev); +// rtl8192_tx_enable(dev); + if(priv->ieee80211->state != IEEE80211_LINKED) + ieee80211_softmac_start_protocol(priv->ieee80211); + ieee80211_reset_queue(priv->ieee80211); + watch_dog_timer_callback((unsigned long) dev); + if(!netif_queue_stopped(dev)) + netif_start_queue(dev); + else + netif_wake_queue(dev); + + return 0; +} + + +int rtl8192_open(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + int ret; + down(&priv->wx_sem); + ret = rtl8192_up(dev); + up(&priv->wx_sem); + return ret; + +} + + +int rtl8192_up(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + if (priv->up == 1) return -1; + + return _rtl8192_up(dev); +} + + +int rtl8192_close(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + int ret; + + down(&priv->wx_sem); + + ret = rtl8192_down(dev); + + up(&priv->wx_sem); + + return ret; + +} + +int rtl8192_down(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + int i; + + if (priv->up == 0) return -1; + + priv->up=0; + priv->ieee80211->ieee_up = 0; + RT_TRACE(COMP_DOWN, "==========>%s()\n", __FUNCTION__); +/* FIXME */ + if (!netif_queue_stopped(dev)) + netif_stop_queue(dev); + + rtl8192_rtx_disable(dev); + //rtl8192_irq_disable(dev); + + /* Tx related queue release */ + for(i = 0; i < MAX_QUEUE_SIZE; i++) { + skb_queue_purge(&priv->ieee80211->skb_waitQ [i]); + } + for(i = 0; i < MAX_QUEUE_SIZE; i++) { + skb_queue_purge(&priv->ieee80211->skb_aggQ [i]); + } + + for(i = 0; i < MAX_QUEUE_SIZE; i++) { + skb_queue_purge(&priv->ieee80211->skb_drv_aggQ [i]); + } + + //as cancel_delayed_work will del work->timer, so if work is not definedas struct delayed_work, it will corrupt +// flush_scheduled_work(); + rtl8192_cancel_deferred_work(priv); + deinit_hal_dm(dev); + del_timer_sync(&priv->watch_dog_timer); + + + ieee80211_softmac_stop_protocol(priv->ieee80211); + memset(&priv->ieee80211->current_network, 0 , offsetof(struct ieee80211_network, list)); + RT_TRACE(COMP_DOWN, "<==========%s()\n", __FUNCTION__); + + return 0; +} + + +void rtl8192_commit(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + int reset_status = 0; + //u8 reset_times = 0; + if (priv->up == 0) return ; + priv->up = 0; + + rtl8192_cancel_deferred_work(priv); + del_timer_sync(&priv->watch_dog_timer); + //cancel_delayed_work(&priv->SwChnlWorkItem); + + ieee80211_softmac_stop_protocol(priv->ieee80211); + + //rtl8192_irq_disable(dev); + rtl8192_rtx_disable(dev); + reset_status = _rtl8192_up(dev); + +} + +/* +void rtl8192_restart(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); +*/ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +void rtl8192_restart(struct work_struct *work) +{ + struct r8192_priv *priv = container_of(work, struct r8192_priv, reset_wq); + struct net_device *dev = priv->ieee80211->dev; +#else +void rtl8192_restart(struct net_device *dev) +{ + + struct r8192_priv *priv = ieee80211_priv(dev); +#endif + + down(&priv->wx_sem); + + rtl8192_commit(dev); + + up(&priv->wx_sem); +} + +static void r8192_set_multicast(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + short promisc; + + //down(&priv->wx_sem); + + /* FIXME FIXME */ + + promisc = (dev->flags & IFF_PROMISC) ? 1:0; + + if (promisc != priv->promisc) + // rtl8192_commit(dev); + + priv->promisc = promisc; + + //schedule_work(&priv->reset_wq); + //up(&priv->wx_sem); +} + + +int r8192_set_mac_adr(struct net_device *dev, void *mac) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + struct sockaddr *addr = mac; + + down(&priv->wx_sem); + + memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); + +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) + schedule_work(&priv->reset_wq); +#else + schedule_task(&priv->reset_wq); +#endif + up(&priv->wx_sem); + + return 0; +} + +/* based on ipw2200 driver */ +int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) +{ + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + struct iwreq *wrq = (struct iwreq *)rq; + int ret=-1; + struct ieee80211_device *ieee = priv->ieee80211; + u32 key[4]; + u8 broadcast_addr[6] = {0xff,0xff,0xff,0xff,0xff,0xff}; + struct iw_point *p = &wrq->u.data; + struct ieee_param *ipw = NULL;//(struct ieee_param *)wrq->u.data.pointer; + + down(&priv->wx_sem); + + + if (p->length < sizeof(struct ieee_param) || !p->pointer){ + ret = -EINVAL; + goto out; + } + + ipw = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL); + if (ipw == NULL){ + ret = -ENOMEM; + goto out; + } + if (copy_from_user(ipw, p->pointer, p->length)) { + kfree(ipw); + ret = -EFAULT; + goto out; + } + + switch (cmd) { + case RTL_IOCTL_WPA_SUPPLICANT: + //parse here for HW security + if (ipw->cmd == IEEE_CMD_SET_ENCRYPTION) + { + if (ipw->u.crypt.set_tx) + { + if (strcmp(ipw->u.crypt.alg, "CCMP") == 0) + ieee->pairwise_key_type = KEY_TYPE_CCMP; + else if (strcmp(ipw->u.crypt.alg, "TKIP") == 0) + ieee->pairwise_key_type = KEY_TYPE_TKIP; + else if (strcmp(ipw->u.crypt.alg, "WEP") == 0) + { + if (ipw->u.crypt.key_len == 13) + ieee->pairwise_key_type = KEY_TYPE_WEP104; + else if (ipw->u.crypt.key_len == 5) + ieee->pairwise_key_type = KEY_TYPE_WEP40; + } + else + ieee->pairwise_key_type = KEY_TYPE_NA; + + if (ieee->pairwise_key_type) + { + memcpy((u8*)key, ipw->u.crypt.key, 16); + EnableHWSecurityConfig8192(dev); + //we fill both index entry and 4th entry for pairwise key as in IPW interface, adhoc will only get here, so we need index entry for its default key serching! + //added by WB. + setKey(dev, 4, ipw->u.crypt.idx, ieee->pairwise_key_type, (u8*)ieee->ap_mac_addr, 0, key); + if (ieee->auth_mode != 2) + setKey(dev, ipw->u.crypt.idx, ipw->u.crypt.idx, ieee->pairwise_key_type, (u8*)ieee->ap_mac_addr, 0, key); + } + } + else //if (ipw->u.crypt.idx) //group key use idx > 0 + { + memcpy((u8*)key, ipw->u.crypt.key, 16); + if (strcmp(ipw->u.crypt.alg, "CCMP") == 0) + ieee->group_key_type= KEY_TYPE_CCMP; + else if (strcmp(ipw->u.crypt.alg, "TKIP") == 0) + ieee->group_key_type = KEY_TYPE_TKIP; + else if (strcmp(ipw->u.crypt.alg, "WEP") == 0) + { + if (ipw->u.crypt.key_len == 13) + ieee->group_key_type = KEY_TYPE_WEP104; + else if (ipw->u.crypt.key_len == 5) + ieee->group_key_type = KEY_TYPE_WEP40; + } + else + ieee->group_key_type = KEY_TYPE_NA; + + if (ieee->group_key_type) + { + setKey( dev, + ipw->u.crypt.idx, + ipw->u.crypt.idx, //KeyIndex + ieee->group_key_type, //KeyType + broadcast_addr, //MacAddr + 0, //DefaultKey + key); //KeyContent + } + } + } +#ifdef JOHN_HWSEC_DEBUG + //john's test 0711 + printk("@@ wrq->u pointer = "); + for(i=0;iu.data.length;i++){ + if(i%10==0) printk("\n"); + printk( "%8x|", ((u32*)wrq->u.data.pointer)[i] ); + } + printk("\n"); +#endif /*JOHN_HWSEC_DEBUG*/ + ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data); + break; + + default: + ret = -EOPNOTSUPP; + break; + } + kfree(ipw); + ipw = NULL; +out: + up(&priv->wx_sem); + return ret; +} + +u8 HwRateToMRate90(bool bIsHT, u8 rate) +{ + u8 ret_rate = 0xff; + + if(!bIsHT) { + switch(rate) { + case DESC90_RATE1M: ret_rate = MGN_1M; break; + case DESC90_RATE2M: ret_rate = MGN_2M; break; + case DESC90_RATE5_5M: ret_rate = MGN_5_5M; break; + case DESC90_RATE11M: ret_rate = MGN_11M; break; + case DESC90_RATE6M: ret_rate = MGN_6M; break; + case DESC90_RATE9M: ret_rate = MGN_9M; break; + case DESC90_RATE12M: ret_rate = MGN_12M; break; + case DESC90_RATE18M: ret_rate = MGN_18M; break; + case DESC90_RATE24M: ret_rate = MGN_24M; break; + case DESC90_RATE36M: ret_rate = MGN_36M; break; + case DESC90_RATE48M: ret_rate = MGN_48M; break; + case DESC90_RATE54M: ret_rate = MGN_54M; break; + + default: + ret_rate = 0xff; + RT_TRACE(COMP_RECV, "HwRateToMRate90(): Non supported Rate [%x], bIsHT = %d!!!\n", rate, bIsHT); + break; + } + + } else { + switch(rate) { + case DESC90_RATEMCS0: ret_rate = MGN_MCS0; break; + case DESC90_RATEMCS1: ret_rate = MGN_MCS1; break; + case DESC90_RATEMCS2: ret_rate = MGN_MCS2; break; + case DESC90_RATEMCS3: ret_rate = MGN_MCS3; break; + case DESC90_RATEMCS4: ret_rate = MGN_MCS4; break; + case DESC90_RATEMCS5: ret_rate = MGN_MCS5; break; + case DESC90_RATEMCS6: ret_rate = MGN_MCS6; break; + case DESC90_RATEMCS7: ret_rate = MGN_MCS7; break; + case DESC90_RATEMCS8: ret_rate = MGN_MCS8; break; + case DESC90_RATEMCS9: ret_rate = MGN_MCS9; break; + case DESC90_RATEMCS10: ret_rate = MGN_MCS10; break; + case DESC90_RATEMCS11: ret_rate = MGN_MCS11; break; + case DESC90_RATEMCS12: ret_rate = MGN_MCS12; break; + case DESC90_RATEMCS13: ret_rate = MGN_MCS13; break; + case DESC90_RATEMCS14: ret_rate = MGN_MCS14; break; + case DESC90_RATEMCS15: ret_rate = MGN_MCS15; break; + case DESC90_RATEMCS32: ret_rate = (0x80|0x20); break; + + default: + ret_rate = 0xff; + RT_TRACE(COMP_RECV, "HwRateToMRate90(): Non supported Rate [%x], bIsHT = %d!!!\n",rate, bIsHT); + break; + } + } + + return ret_rate; +} + +/** + * Function: UpdateRxPktTimeStamp + * Overview: Recored down the TSF time stamp when receiving a packet + * + * Input: + * PADAPTER Adapter + * PRT_RFD pRfd, + * + * Output: + * PRT_RFD pRfd + * (pRfd->Status.TimeStampHigh is updated) + * (pRfd->Status.TimeStampLow is updated) + * Return: + * None + */ +void UpdateRxPktTimeStamp8190 (struct net_device *dev, struct ieee80211_rx_stats *stats) +{ + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + + if(stats->bIsAMPDU && !stats->bFirstMPDU) { + stats->mac_time[0] = priv->LastRxDescTSFLow; + stats->mac_time[1] = priv->LastRxDescTSFHigh; + } else { + priv->LastRxDescTSFLow = stats->mac_time[0]; + priv->LastRxDescTSFHigh = stats->mac_time[1]; + } +} + +//by amy 080606 + +long rtl819x_translate_todbm(u8 signal_strength_index )// 0-100 index. +{ + long signal_power; // in dBm. + + // Translate to dBm (x=0.5y-95). + signal_power = (long)((signal_strength_index + 1) >> 1); + signal_power -= 95; + + return signal_power; +} + + +/* 2008/01/22 MH We can not delcare RSSI/EVM total value of sliding window to + be a local static. Otherwise, it may increase when we return from S3/S4. The + value will be kept in memory or disk. We must delcare the value in adapter + and it will be reinitialized when return from S3/S4. */ +void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee80211_rx_stats * pprevious_stats, struct ieee80211_rx_stats * pcurrent_stats) +{ + bool bcheck = false; + u8 rfpath; + u32 nspatial_stream, tmp_val; + //u8 i; + static u32 slide_rssi_index=0, slide_rssi_statistics=0; + static u32 slide_evm_index=0, slide_evm_statistics=0; + static u32 last_rssi=0, last_evm=0; + + static u32 slide_beacon_adc_pwdb_index=0, slide_beacon_adc_pwdb_statistics=0; + static u32 last_beacon_adc_pwdb=0; + + struct ieee80211_hdr_3addr *hdr; + u16 sc ; + unsigned int frag,seq; + hdr = (struct ieee80211_hdr_3addr *)buffer; + sc = le16_to_cpu(hdr->seq_ctl); + frag = WLAN_GET_SEQ_FRAG(sc); + seq = WLAN_GET_SEQ_SEQ(sc); + //cosa add 04292008 to record the sequence number + pcurrent_stats->Seq_Num = seq; + // + // Check whether we should take the previous packet into accounting + // + if(!pprevious_stats->bIsAMPDU) + { + // if previous packet is not aggregated packet + bcheck = true; + }else + { + #if 0 + // if previous packet is aggregated packet, and current packet + // (1) is not AMPDU + // (2) is the first packet of one AMPDU + // that means the previous packet is the last one aggregated packet + if( !pcurrent_stats->bIsAMPDU || pcurrent_stats->bFirstMPDU) + bcheck = true; + #endif + } + + + if(slide_rssi_statistics++ >= PHY_RSSI_SLID_WIN_MAX) + { + slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX; + last_rssi = priv->stats.slide_signal_strength[slide_rssi_index]; + priv->stats.slide_rssi_total -= last_rssi; + } + priv->stats.slide_rssi_total += pprevious_stats->SignalStrength; + + priv->stats.slide_signal_strength[slide_rssi_index++] = pprevious_stats->SignalStrength; + if(slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX) + slide_rssi_index = 0; + + // <1> Showed on UI for user, in dbm + tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics; + priv->stats.signal_strength = rtl819x_translate_todbm((u8)tmp_val); + pcurrent_stats->rssi = priv->stats.signal_strength; + // + // If the previous packet does not match the criteria, neglect it + // + if(!pprevious_stats->bPacketMatchBSSID) + { + if(!pprevious_stats->bToSelfBA) + return; + } + + if(!bcheck) + return; + + + //rtl8190_process_cck_rxpathsel(priv,pprevious_stats);//only rtl8190 supported + + // + // Check RSSI + // + priv->stats.num_process_phyinfo++; + + /* record the general signal strength to the sliding window. */ + + + // <2> Showed on UI for engineering + // hardware does not provide rssi information for each rf path in CCK + if(!pprevious_stats->bIsCCK && (pprevious_stats->bPacketToSelf || pprevious_stats->bToSelfBA)) + { + for (rfpath = RF90_PATH_A; rfpath < priv->NumTotalRFPath; rfpath++) + { + if (!rtl8192_phy_CheckIsLegalRFPath(priv->ieee80211->dev, rfpath)) + continue; + + //Fixed by Jacken 2008-03-20 + if(priv->stats.rx_rssi_percentage[rfpath] == 0) + { + priv->stats.rx_rssi_percentage[rfpath] = pprevious_stats->RxMIMOSignalStrength[rfpath]; + //DbgPrint("MIMO RSSI initialize \n"); + } + if(pprevious_stats->RxMIMOSignalStrength[rfpath] > priv->stats.rx_rssi_percentage[rfpath]) + { + priv->stats.rx_rssi_percentage[rfpath] = + ( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) + + (pprevious_stats->RxMIMOSignalStrength[rfpath])) /(Rx_Smooth_Factor); + priv->stats.rx_rssi_percentage[rfpath] = priv->stats.rx_rssi_percentage[rfpath] + 1; + } + else + { + priv->stats.rx_rssi_percentage[rfpath] = + ( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) + + (pprevious_stats->RxMIMOSignalStrength[rfpath])) /(Rx_Smooth_Factor); + } + RT_TRACE(COMP_DBG,"priv->stats.rx_rssi_percentage[rfPath] = %d \n" ,priv->stats.rx_rssi_percentage[rfpath] ); + } + } + + + // + // Check PWDB. + // + RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n", + pprevious_stats->bIsCCK? "CCK": "OFDM", + pprevious_stats->RxPWDBAll); + + if(pprevious_stats->bPacketBeacon) + { +/* record the beacon pwdb to the sliding window. */ + if(slide_beacon_adc_pwdb_statistics++ >= PHY_Beacon_RSSI_SLID_WIN_MAX) + { + slide_beacon_adc_pwdb_statistics = PHY_Beacon_RSSI_SLID_WIN_MAX; + last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index]; + priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb; + //DbgPrint("slide_beacon_adc_pwdb_index = %d, last_beacon_adc_pwdb = %d, Adapter->RxStats.Slide_Beacon_Total = %d\n", + // slide_beacon_adc_pwdb_index, last_beacon_adc_pwdb, Adapter->RxStats.Slide_Beacon_Total); + } + priv->stats.Slide_Beacon_Total += pprevious_stats->RxPWDBAll; + priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index] = pprevious_stats->RxPWDBAll; + //DbgPrint("slide_beacon_adc_pwdb_index = %d, pPreviousRfd->Status.RxPWDBAll = %d\n", slide_beacon_adc_pwdb_index, pPreviousRfd->Status.RxPWDBAll); + slide_beacon_adc_pwdb_index++; + if(slide_beacon_adc_pwdb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX) + slide_beacon_adc_pwdb_index = 0; + pprevious_stats->RxPWDBAll = priv->stats.Slide_Beacon_Total/slide_beacon_adc_pwdb_statistics; + if(pprevious_stats->RxPWDBAll >= 3) + pprevious_stats->RxPWDBAll -= 3; + } + + RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n", + pprevious_stats->bIsCCK? "CCK": "OFDM", + pprevious_stats->RxPWDBAll); + + + if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA) + { + if(priv->undecorated_smoothed_pwdb < 0) // initialize + { + priv->undecorated_smoothed_pwdb = pprevious_stats->RxPWDBAll; + //DbgPrint("First pwdb initialize \n"); + } +#if 1 + if(pprevious_stats->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb) + { + priv->undecorated_smoothed_pwdb = + ( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) + + (pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor); + priv->undecorated_smoothed_pwdb = priv->undecorated_smoothed_pwdb + 1; + } + else + { + priv->undecorated_smoothed_pwdb = + ( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) + + (pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor); + } +#else + //Fixed by Jacken 2008-03-20 + if(pPreviousRfd->Status.RxPWDBAll > (u32)pHalData->UndecoratedSmoothedPWDB) + { + pHalData->UndecoratedSmoothedPWDB = + ( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6; + pHalData->UndecoratedSmoothedPWDB = pHalData->UndecoratedSmoothedPWDB + 1; + } + else + { + pHalData->UndecoratedSmoothedPWDB = + ( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6; + } +#endif + + } + + // + // Check EVM + // + /* record the general EVM to the sliding window. */ + if(pprevious_stats->SignalQuality == 0) + { + } + else + { + if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA){ + if(slide_evm_statistics++ >= PHY_RSSI_SLID_WIN_MAX){ + slide_evm_statistics = PHY_RSSI_SLID_WIN_MAX; + last_evm = priv->stats.slide_evm[slide_evm_index]; + priv->stats.slide_evm_total -= last_evm; + } + + priv->stats.slide_evm_total += pprevious_stats->SignalQuality; + + priv->stats.slide_evm[slide_evm_index++] = pprevious_stats->SignalQuality; + if(slide_evm_index >= PHY_RSSI_SLID_WIN_MAX) + slide_evm_index = 0; + + // <1> Showed on UI for user, in percentage. + tmp_val = priv->stats.slide_evm_total/slide_evm_statistics; + priv->stats.signal_quality = tmp_val; + //cosa add 10/11/2007, Showed on UI for user in Windows Vista, for Link quality. + priv->stats.last_signal_strength_inpercent = tmp_val; + } + + // <2> Showed on UI for engineering + if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA) + { + for(nspatial_stream = 0; nspatial_stream<2 ; nspatial_stream++) // 2 spatial stream + { + if(pprevious_stats->RxMIMOSignalQuality[nspatial_stream] != -1) + { + if(priv->stats.rx_evm_percentage[nspatial_stream] == 0) // initialize + { + priv->stats.rx_evm_percentage[nspatial_stream] = pprevious_stats->RxMIMOSignalQuality[nspatial_stream]; + } + priv->stats.rx_evm_percentage[nspatial_stream] = + ( (priv->stats.rx_evm_percentage[nspatial_stream]* (Rx_Smooth_Factor-1)) + + (pprevious_stats->RxMIMOSignalQuality[nspatial_stream]* 1)) / (Rx_Smooth_Factor); + } + } + } + } + + +} + +/*----------------------------------------------------------------------------- + * Function: rtl819x_query_rxpwrpercentage() + * + * Overview: + * + * Input: char antpower + * + * Output: NONE + * + * Return: 0-100 percentage + * + * Revised History: + * When Who Remark + * 05/26/2008 amy Create Version 0 porting from windows code. + * + *---------------------------------------------------------------------------*/ +static u8 rtl819x_query_rxpwrpercentage( + char antpower + ) +{ + if ((antpower <= -100) || (antpower >= 20)) + { + return 0; + } + else if (antpower >= 0) + { + return 100; + } + else + { + return (100+antpower); + } + +} /* QueryRxPwrPercentage */ + +static u8 +rtl819x_evm_dbtopercentage( + char value + ) +{ + char ret_val; + + ret_val = value; + + if(ret_val >= 0) + ret_val = 0; + if(ret_val <= -33) + ret_val = -33; + ret_val = 0 - ret_val; + ret_val*=3; + if(ret_val == 99) + ret_val = 100; + return(ret_val); +} +// +// Description: +// We want good-looking for signal strength/quality +// 2007/7/19 01:09, by cosa. +// +long +rtl819x_signal_scale_mapping( + long currsig + ) +{ + long retsig; + + // Step 1. Scale mapping. + if(currsig >= 61 && currsig <= 100) + { + retsig = 90 + ((currsig - 60) / 4); + } + else if(currsig >= 41 && currsig <= 60) + { + retsig = 78 + ((currsig - 40) / 2); + } + else if(currsig >= 31 && currsig <= 40) + { + retsig = 66 + (currsig - 30); + } + else if(currsig >= 21 && currsig <= 30) + { + retsig = 54 + (currsig - 20); + } + else if(currsig >= 5 && currsig <= 20) + { + retsig = 42 + (((currsig - 5) * 2) / 3); + } + else if(currsig == 4) + { + retsig = 36; + } + else if(currsig == 3) + { + retsig = 27; + } + else if(currsig == 2) + { + retsig = 18; + } + else if(currsig == 1) + { + retsig = 9; + } + else + { + retsig = currsig; + } + + return retsig; +} + +static void rtl8192_query_rxphystatus( + struct r8192_priv * priv, + struct ieee80211_rx_stats * pstats, + rx_drvinfo_819x_usb * pdrvinfo, + struct ieee80211_rx_stats * precord_stats, + bool bpacket_match_bssid, + bool bpacket_toself, + bool bPacketBeacon, + bool bToSelfBA + ) +{ + //PRT_RFD_STATUS pRtRfdStatus = &(pRfd->Status); + phy_sts_ofdm_819xusb_t* pofdm_buf; + phy_sts_cck_819xusb_t * pcck_buf; + phy_ofdm_rx_status_rxsc_sgien_exintfflag* prxsc; + u8 *prxpkt; + u8 i, max_spatial_stream, tmp_rxsnr, tmp_rxevm, rxsc_sgien_exflg; + char rx_pwr[4], rx_pwr_all=0; + //long rx_avg_pwr = 0; + char rx_snrX, rx_evmX; + u8 evm, pwdb_all; + u32 RSSI, total_rssi=0;//, total_evm=0; +// long signal_strength_index = 0; + u8 is_cck_rate=0; + u8 rf_rx_num = 0; + + + priv->stats.numqry_phystatus++; + + is_cck_rate = rx_hal_is_cck_rate(pdrvinfo); + + // Record it for next packet processing + memset(precord_stats, 0, sizeof(struct ieee80211_rx_stats)); + pstats->bPacketMatchBSSID = precord_stats->bPacketMatchBSSID = bpacket_match_bssid; + pstats->bPacketToSelf = precord_stats->bPacketToSelf = bpacket_toself; + pstats->bIsCCK = precord_stats->bIsCCK = is_cck_rate;//RX_HAL_IS_CCK_RATE(pDrvInfo); + pstats->bPacketBeacon = precord_stats->bPacketBeacon = bPacketBeacon; + pstats->bToSelfBA = precord_stats->bToSelfBA = bToSelfBA; + + prxpkt = (u8*)pdrvinfo; + + /* Move pointer to the 16th bytes. Phy status start address. */ + prxpkt += sizeof(rx_drvinfo_819x_usb); + + /* Initial the cck and ofdm buffer pointer */ + pcck_buf = (phy_sts_cck_819xusb_t *)prxpkt; + pofdm_buf = (phy_sts_ofdm_819xusb_t *)prxpkt; + + pstats->RxMIMOSignalQuality[0] = -1; + pstats->RxMIMOSignalQuality[1] = -1; + precord_stats->RxMIMOSignalQuality[0] = -1; + precord_stats->RxMIMOSignalQuality[1] = -1; + + if(is_cck_rate) + { + // + // (1)Hardware does not provide RSSI for CCK + // + + // + // (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive) + // + u8 report;//, cck_agc_rpt; + + priv->stats.numqry_phystatusCCK++; + + if(!priv->bCckHighPower) + { + report = pcck_buf->cck_agc_rpt & 0xc0; + report = report>>6; + switch(report) + { + //Fixed by Jacken from Bryant 2008-03-20 + //Original value is -38 , -26 , -14 , -2 + //Fixed value is -35 , -23 , -11 , 6 + case 0x3: + rx_pwr_all = -35 - (pcck_buf->cck_agc_rpt & 0x3e); + break; + case 0x2: + rx_pwr_all = -23 - (pcck_buf->cck_agc_rpt & 0x3e); + break; + case 0x1: + rx_pwr_all = -11 - (pcck_buf->cck_agc_rpt & 0x3e); + break; + case 0x0: + rx_pwr_all = 6 - (pcck_buf->cck_agc_rpt & 0x3e); + break; + } + } + else + { + report = pcck_buf->cck_agc_rpt & 0x60; + report = report>>5; + switch(report) + { + case 0x3: + rx_pwr_all = -35 - ((pcck_buf->cck_agc_rpt & 0x1f)<<1) ; + break; + case 0x2: + rx_pwr_all = -23 - ((pcck_buf->cck_agc_rpt & 0x1f)<<1); + break; + case 0x1: + rx_pwr_all = -11 - ((pcck_buf->cck_agc_rpt & 0x1f)<<1) ; + break; + case 0x0: + rx_pwr_all = 6 - ((pcck_buf->cck_agc_rpt & 0x1f)<<1) ; + break; + } + } + + pwdb_all = rtl819x_query_rxpwrpercentage(rx_pwr_all); + pstats->RxPWDBAll = precord_stats->RxPWDBAll = pwdb_all; + pstats->RecvSignalPower = pwdb_all; + + // + // (3) Get Signal Quality (EVM) + // + //if(bpacket_match_bssid) + { + u8 sq; + + if(pstats->RxPWDBAll > 40) + { + sq = 100; + }else + { + sq = pcck_buf->sq_rpt; + + if(pcck_buf->sq_rpt > 64) + sq = 0; + else if (pcck_buf->sq_rpt < 20) + sq = 100; + else + sq = ((64-sq) * 100) / 44; + } + pstats->SignalQuality = precord_stats->SignalQuality = sq; + pstats->RxMIMOSignalQuality[0] = precord_stats->RxMIMOSignalQuality[0] = sq; + pstats->RxMIMOSignalQuality[1] = precord_stats->RxMIMOSignalQuality[1] = -1; + } + } + else + { + priv->stats.numqry_phystatusHT++; + // + // (1)Get RSSI for HT rate + // + for(i=RF90_PATH_A; iNumTotalRFPath; i++) + { + // 2008/01/30 MH we will judge RF RX path now. + if (priv->brfpath_rxenable[i]) + rf_rx_num++; + else + continue; + + if (!rtl8192_phy_CheckIsLegalRFPath(priv->ieee80211->dev, i)) + continue; + + //Fixed by Jacken from Bryant 2008-03-20 + //Original value is 106 + rx_pwr[i] = ((pofdm_buf->trsw_gain_X[i]&0x3F)*2) - 106; + + //Get Rx snr value in DB + tmp_rxsnr = pofdm_buf->rxsnr_X[i]; + rx_snrX = (char)(tmp_rxsnr); + //rx_snrX >>= 1;; + rx_snrX /= 2; + priv->stats.rxSNRdB[i] = (long)rx_snrX; + + /* Translate DBM to percentage. */ + RSSI = rtl819x_query_rxpwrpercentage(rx_pwr[i]); + total_rssi += RSSI; + + /* Record Signal Strength for next packet */ + //if(bpacket_match_bssid) + { + pstats->RxMIMOSignalStrength[i] =(u8) RSSI; + precord_stats->RxMIMOSignalStrength[i] =(u8) RSSI; + } + } + + + // + // (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive) + // + //Fixed by Jacken from Bryant 2008-03-20 + //Original value is 106 + rx_pwr_all = (((pofdm_buf->pwdb_all ) >> 1 )& 0x7f) -106; + pwdb_all = rtl819x_query_rxpwrpercentage(rx_pwr_all); + + pstats->RxPWDBAll = precord_stats->RxPWDBAll = pwdb_all; + pstats->RxPower = precord_stats->RxPower = rx_pwr_all; + + // + // (3)EVM of HT rate + // + if(pdrvinfo->RxHT && pdrvinfo->RxRate>=DESC90_RATEMCS8 && + pdrvinfo->RxRate<=DESC90_RATEMCS15) + max_spatial_stream = 2; //both spatial stream make sense + else + max_spatial_stream = 1; //only spatial stream 1 makes sense + + for(i=0; irxevm_X[i]; + rx_evmX = (char)(tmp_rxevm); + + // Do not use shift operation like "rx_evmX >>= 1" because the compilor of free build environment + // fill most significant bit to "zero" when doing shifting operation which may change a negative + // value to positive one, then the dbm value (which is supposed to be negative) is not correct anymore. + rx_evmX /= 2; //dbm + + evm = rtl819x_evm_dbtopercentage(rx_evmX); +#if 0 + EVM = SignalScaleMapping(EVM);//make it good looking, from 0~100 +#endif + //if(bpacket_match_bssid) + { + if(i==0) // Fill value in RFD, Get the first spatial stream only + pstats->SignalQuality = precord_stats->SignalQuality = (u8)(evm & 0xff); + pstats->RxMIMOSignalQuality[i] = precord_stats->RxMIMOSignalQuality[i] = (u8)(evm & 0xff); + } + } + + + /* record rx statistics for debug */ + rxsc_sgien_exflg = pofdm_buf->rxsc_sgien_exflg; + prxsc = (phy_ofdm_rx_status_rxsc_sgien_exintfflag *)&rxsc_sgien_exflg; + if(pdrvinfo->BW) //40M channel + priv->stats.received_bwtype[1+prxsc->rxsc]++; + else //20M channel + priv->stats.received_bwtype[0]++; + } + + //UI BSS List signal strength(in percentage), make it good looking, from 0~100. + //It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp(). + if(is_cck_rate) + { + pstats->SignalStrength = precord_stats->SignalStrength = (u8)(rtl819x_signal_scale_mapping((long)pwdb_all));//PWDB_ALL; + + } + else + { + //pRfd->Status.SignalStrength = pRecordRfd->Status.SignalStrength = (u8)(SignalScaleMapping(total_rssi/=RF90_PATH_MAX));//(u8)(total_rssi/=RF90_PATH_MAX); + // We can judge RX path number now. + if (rf_rx_num != 0) + pstats->SignalStrength = precord_stats->SignalStrength = (u8)(rtl819x_signal_scale_mapping((long)(total_rssi/=rf_rx_num))); + } +} /* QueryRxPhyStatus8190Pci */ + +void +rtl8192_record_rxdesc_forlateruse( + struct ieee80211_rx_stats * psrc_stats, + struct ieee80211_rx_stats * ptarget_stats +) +{ + ptarget_stats->bIsAMPDU = psrc_stats->bIsAMPDU; + ptarget_stats->bFirstMPDU = psrc_stats->bFirstMPDU; + ptarget_stats->Seq_Num = psrc_stats->Seq_Num; +} + + +void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, + struct ieee80211_rx_stats * pstats, + rx_drvinfo_819x_usb *pdrvinfo) +{ + // TODO: We must only check packet for current MAC address. Not finish + rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; + struct net_device *dev=info->dev; + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + bool bpacket_match_bssid, bpacket_toself; + bool bPacketBeacon=FALSE, bToSelfBA=FALSE; + static struct ieee80211_rx_stats previous_stats; + struct ieee80211_hdr_3addr *hdr;//by amy + u16 fc,type; + + // Get Signal Quality for only RX data queue (but not command queue) + + u8* tmp_buf; + //u16 tmp_buf_len = 0; + u8 *praddr; + + /* Get MAC frame start address. */ + tmp_buf = (u8*)skb->data;// + get_rxpacket_shiftbytes_819xusb(pstats); + + hdr = (struct ieee80211_hdr_3addr *)tmp_buf; + fc = le16_to_cpu(hdr->frame_ctl); + type = WLAN_FC_GET_TYPE(fc); + praddr = hdr->addr1; + + /* Check if the received packet is acceptabe. */ + bpacket_match_bssid = ((IEEE80211_FTYPE_CTL != type) && + (eqMacAddr(priv->ieee80211->current_network.bssid, (fc & IEEE80211_FCTL_TODS)? hdr->addr1 : (fc & IEEE80211_FCTL_FROMDS )? hdr->addr2 : hdr->addr3)) + && (!pstats->bHwError) && (!pstats->bCRC)&& (!pstats->bICV)); + bpacket_toself = bpacket_match_bssid & (eqMacAddr(praddr, priv->ieee80211->dev->dev_addr)); + +#if 1//cosa + if(WLAN_FC_GET_FRAMETYPE(fc)== IEEE80211_STYPE_BEACON) + { + bPacketBeacon = true; + //DbgPrint("Beacon 2, MatchBSSID = %d, ToSelf = %d \n", bPacketMatchBSSID, bPacketToSelf); + } + if(WLAN_FC_GET_FRAMETYPE(fc) == IEEE80211_STYPE_BLOCKACK) + { + if((eqMacAddr(praddr,dev->dev_addr))) + bToSelfBA = true; + //DbgPrint("BlockAck, MatchBSSID = %d, ToSelf = %d \n", bPacketMatchBSSID, bPacketToSelf); + } + +#endif + + + if(bpacket_match_bssid) + { + priv->stats.numpacket_matchbssid++; + } + if(bpacket_toself){ + priv->stats.numpacket_toself++; + } + // + // Process PHY information for previous packet (RSSI/PWDB/EVM) + // + // Because phy information is contained in the last packet of AMPDU only, so driver + // should process phy information of previous packet + rtl8192_process_phyinfo(priv, tmp_buf, &previous_stats, pstats); + rtl8192_query_rxphystatus(priv, pstats, pdrvinfo, &previous_stats, bpacket_match_bssid,bpacket_toself,bPacketBeacon,bToSelfBA); + rtl8192_record_rxdesc_forlateruse(pstats, &previous_stats); + +} + +/** +* Function: UpdateReceivedRateHistogramStatistics +* Overview: Recored down the received data rate +* +* Input: +* struct net_device *dev +* struct ieee80211_rx_stats *stats +* +* Output: +* +* (priv->stats.ReceivedRateHistogram[] is updated) +* Return: +* None +*/ +void +UpdateReceivedRateHistogramStatistics8190( + struct net_device *dev, + struct ieee80211_rx_stats *stats + ) +{ + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + u32 rcvType=1; //0: Total, 1:OK, 2:CRC, 3:ICV + u32 rateIndex; + u32 preamble_guardinterval; //1: short preamble/GI, 0: long preamble/GI + + + if(stats->bCRC) + rcvType = 2; + else if(stats->bICV) + rcvType = 3; + + if(stats->bShortPreamble) + preamble_guardinterval = 1;// short + else + preamble_guardinterval = 0;// long + + switch(stats->rate) + { + // + // CCK rate + // + case MGN_1M: rateIndex = 0; break; + case MGN_2M: rateIndex = 1; break; + case MGN_5_5M: rateIndex = 2; break; + case MGN_11M: rateIndex = 3; break; + // + // Legacy OFDM rate + // + case MGN_6M: rateIndex = 4; break; + case MGN_9M: rateIndex = 5; break; + case MGN_12M: rateIndex = 6; break; + case MGN_18M: rateIndex = 7; break; + case MGN_24M: rateIndex = 8; break; + case MGN_36M: rateIndex = 9; break; + case MGN_48M: rateIndex = 10; break; + case MGN_54M: rateIndex = 11; break; + // + // 11n High throughput rate + // + case MGN_MCS0: rateIndex = 12; break; + case MGN_MCS1: rateIndex = 13; break; + case MGN_MCS2: rateIndex = 14; break; + case MGN_MCS3: rateIndex = 15; break; + case MGN_MCS4: rateIndex = 16; break; + case MGN_MCS5: rateIndex = 17; break; + case MGN_MCS6: rateIndex = 18; break; + case MGN_MCS7: rateIndex = 19; break; + case MGN_MCS8: rateIndex = 20; break; + case MGN_MCS9: rateIndex = 21; break; + case MGN_MCS10: rateIndex = 22; break; + case MGN_MCS11: rateIndex = 23; break; + case MGN_MCS12: rateIndex = 24; break; + case MGN_MCS13: rateIndex = 25; break; + case MGN_MCS14: rateIndex = 26; break; + case MGN_MCS15: rateIndex = 27; break; + default: rateIndex = 28; break; + } + priv->stats.received_preamble_GI[preamble_guardinterval][rateIndex]++; + priv->stats.received_rate_histogram[0][rateIndex]++; //total + priv->stats.received_rate_histogram[rcvType][rateIndex]++; +} + + +void query_rxdesc_status(struct sk_buff *skb, struct ieee80211_rx_stats *stats, bool bIsRxAggrSubframe) +{ + rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; + struct net_device *dev=info->dev; + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + //rx_desc_819x_usb *desc = (rx_desc_819x_usb *)skb->data; + rx_drvinfo_819x_usb *driver_info = NULL; + + // + //Get Rx Descriptor Information + // +#ifdef USB_RX_AGGREGATION_SUPPORT + if (bIsRxAggrSubframe) + { + rx_desc_819x_usb_aggr_subframe *desc = (rx_desc_819x_usb_aggr_subframe *)skb->data; + stats->Length = desc->Length ; + stats->RxDrvInfoSize = desc->RxDrvInfoSize; + stats->RxBufShift = 0; //RxBufShift = 2 in RxDesc, but usb didn't shift bytes in fact. + stats->bICV = desc->ICV; + stats->bCRC = desc->CRC32; + stats->bHwError = stats->bCRC|stats->bICV; + stats->Decrypted = !desc->SWDec;//RTL8190 set this bit to indicate that Hw does not decrypt packet + } else +#endif + { + rx_desc_819x_usb *desc = (rx_desc_819x_usb *)skb->data; + + stats->Length = desc->Length; + stats->RxDrvInfoSize = desc->RxDrvInfoSize; + stats->RxBufShift = 0;//desc->Shift&0x03; + stats->bICV = desc->ICV; + stats->bCRC = desc->CRC32; + stats->bHwError = stats->bCRC|stats->bICV; + //RTL8190 set this bit to indicate that Hw does not decrypt packet + stats->Decrypted = !desc->SWDec; + } + + if((priv->ieee80211->pHTInfo->bCurrentHTSupport == true) && (priv->ieee80211->pairwise_key_type == KEY_TYPE_CCMP)) + { + stats->bHwError = false; + } + else + { + stats->bHwError = stats->bCRC|stats->bICV; + } + + if(stats->Length < 24 || stats->Length > MAX_8192U_RX_SIZE) + stats->bHwError |= 1; + // + //Get Driver Info + // + // TODO: Need to verify it on FGPA platform + //Driver info are written to the RxBuffer following rx desc + if (stats->RxDrvInfoSize != 0) { + driver_info = (rx_drvinfo_819x_usb *)(skb->data + sizeof(rx_desc_819x_usb) + \ + stats->RxBufShift); + /* unit: 0.5M */ + /* TODO */ + if(!stats->bHwError){ + u8 ret_rate; + ret_rate = HwRateToMRate90(driver_info->RxHT, driver_info->RxRate); + if(ret_rate == 0xff) + { + // Abnormal Case: Receive CRC OK packet with Rx descriptor indicating non supported rate. + // Special Error Handling here, 2008.05.16, by Emily + + stats->bHwError = 1; + stats->rate = MGN_1M; //Set 1M rate by default + }else + { + stats->rate = ret_rate; + } + } + else + stats->rate = 0x02; + + stats->bShortPreamble = driver_info->SPLCP; + + + UpdateReceivedRateHistogramStatistics8190(dev, stats); + + stats->bIsAMPDU = (driver_info->PartAggr==1); + stats->bFirstMPDU = (driver_info->PartAggr==1) && (driver_info->FirstAGGR==1); +#if 0 + // TODO: it is debug only. It should be disabled in released driver. 2007.1.12 by Joseph + UpdateRxAMPDUHistogramStatistics8190(Adapter, pRfd); +#endif + stats->TimeStampLow = driver_info->TSFL; + // xiong mask it, 070514 + //pRfd->Status.TimeStampHigh = PlatformEFIORead4Byte(Adapter, TSFR+4); + // stats->TimeStampHigh = read_nic_dword(dev, TSFR+4); + + UpdateRxPktTimeStamp8190(dev, stats); + + // + // Rx A-MPDU + // + if(driver_info->FirstAGGR==1 || driver_info->PartAggr == 1) + RT_TRACE(COMP_RXDESC, "driver_info->FirstAGGR = %d, driver_info->PartAggr = %d\n", + driver_info->FirstAGGR, driver_info->PartAggr); + + } + + skb_pull(skb,sizeof(rx_desc_819x_usb)); + // + // Get Total offset of MPDU Frame Body + // + if((stats->RxBufShift + stats->RxDrvInfoSize) > 0) { + stats->bShift = 1; + skb_pull(skb,stats->RxBufShift + stats->RxDrvInfoSize); + } + +#ifdef USB_RX_AGGREGATION_SUPPORT + /* for the rx aggregated sub frame, the redundant space truelly contained in the packet */ + if(bIsRxAggrSubframe) { + skb_pull(skb, 8); + } +#endif + /* for debug 2008.5.29 */ +#if 0 + { + int i; + printk("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); + for(i = 0; i < skb->len; i++) { + if(i % 10 == 0) printk("\n"); + printk("%02x ", skb->data[i]); + } + printk("\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"); + } +#endif + + //added by vivi, for MP, 20080108 + stats->RxIs40MHzPacket = driver_info->BW; + if(stats->RxDrvInfoSize != 0) + TranslateRxSignalStuff819xUsb(skb, stats, driver_info); + +} + +u32 GetRxPacketShiftBytes819xUsb(struct ieee80211_rx_stats *Status, bool bIsRxAggrSubframe) +{ +#ifdef USB_RX_AGGREGATION_SUPPORT + if (bIsRxAggrSubframe) + return (sizeof(rx_desc_819x_usb) + Status->RxDrvInfoSize + + Status->RxBufShift + 8); + else +#endif + return (sizeof(rx_desc_819x_usb) + Status->RxDrvInfoSize + + Status->RxBufShift); +} + +void rtl8192_rx_nomal(struct sk_buff* skb) +{ + rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; + struct net_device *dev=info->dev; + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + struct ieee80211_rx_stats stats = { + .signal = 0, + .noise = -98, + .rate = 0, + // .mac_time = jiffies, + .freq = IEEE80211_24GHZ_BAND, + }; + u32 rx_pkt_len = 0; + struct ieee80211_hdr_1addr *ieee80211_hdr = NULL; + bool unicast_packet = false; +#ifdef USB_RX_AGGREGATION_SUPPORT + struct sk_buff *agg_skb = NULL; + u32 TotalLength = 0; + u32 TempDWord = 0; + u32 PacketLength = 0; + u32 PacketOccupiedLendth = 0; + u8 TempByte = 0; + u32 PacketShiftBytes = 0; + rx_desc_819x_usb_aggr_subframe *RxDescr = NULL; + u8 PaddingBytes = 0; + //add just for testing + u8 testing; + +#endif + + /* 20 is for ps-poll */ + if((skb->len >=(20 + sizeof(rx_desc_819x_usb))) && (skb->len < RX_URB_SIZE)) { +#ifdef USB_RX_AGGREGATION_SUPPORT + TempByte = *(skb->data + sizeof(rx_desc_819x_usb)); +#endif + /* first packet should not contain Rx aggregation header */ + query_rxdesc_status(skb, &stats, false); + /* TODO */ + /* hardware related info */ +#ifdef USB_RX_AGGREGATION_SUPPORT + if (TempByte & BIT0) { + agg_skb = skb; + //TotalLength = agg_skb->len - 4; /*sCrcLng*/ + TotalLength = stats.Length - 4; /*sCrcLng*/ + //RT_TRACE(COMP_RECV, "%s:first aggregated packet!Length=%d\n",__FUNCTION__,TotalLength); + /* though the head pointer has passed this position */ + TempDWord = *(u32 *)(agg_skb->data - 4); + PacketLength = (u16)(TempDWord & 0x3FFF); /*sCrcLng*/ + skb = dev_alloc_skb(PacketLength); + memcpy(skb_put(skb,PacketLength),agg_skb->data,PacketLength); + PacketShiftBytes = GetRxPacketShiftBytes819xUsb(&stats, false); + } +#endif + /* Process the MPDU recevied */ + skb_trim(skb, skb->len - 4/*sCrcLng*/); + + rx_pkt_len = skb->len; + ieee80211_hdr = (struct ieee80211_hdr_1addr *)skb->data; + unicast_packet = false; + if(is_broadcast_ether_addr(ieee80211_hdr->addr1)) { + //TODO + }else if(is_multicast_ether_addr(ieee80211_hdr->addr1)){ + //TODO + }else { + /* unicast packet */ + unicast_packet = true; + } + + if(!ieee80211_rx(priv->ieee80211,skb, &stats)) { + dev_kfree_skb_any(skb); + } else { + priv->stats.rxoktotal++; + if(unicast_packet) { + priv->stats.rxbytesunicast += rx_pkt_len; + } + } +#ifdef USB_RX_AGGREGATION_SUPPORT + testing = 1; + // (PipeIndex == 0) && (TempByte & BIT0) => TotalLength > 0. + if (TotalLength > 0) { + PacketOccupiedLendth = PacketLength + (PacketShiftBytes + 8); + if ((PacketOccupiedLendth & 0xFF) != 0) + PacketOccupiedLendth = (PacketOccupiedLendth & 0xFFFFFF00) + 256; + PacketOccupiedLendth -= 8; + TempDWord = PacketOccupiedLendth - PacketShiftBytes; /*- PacketLength */ + if (agg_skb->len > TempDWord) + skb_pull(agg_skb, TempDWord); + else + agg_skb->len = 0; + + while (agg_skb->len>=GetRxPacketShiftBytes819xUsb(&stats, true)) { + u8 tmpCRC = 0, tmpICV = 0; + //RT_TRACE(COMP_RECV,"%s:aggred pkt,total_len = %d\n",__FUNCTION__,agg_skb->len); + RxDescr = (rx_desc_819x_usb_aggr_subframe *)(agg_skb->data); + tmpCRC = RxDescr->CRC32; + tmpICV = RxDescr->ICV; + memcpy(agg_skb->data, &agg_skb->data[44], 2); + RxDescr->CRC32 = tmpCRC; + RxDescr->ICV = tmpICV; + + memset(&stats, 0, sizeof(struct ieee80211_rx_stats)); + stats.signal = 0; + stats.noise = -98; + stats.rate = 0; + stats.freq = IEEE80211_24GHZ_BAND; + query_rxdesc_status(agg_skb, &stats, true); + PacketLength = stats.Length; + + if(PacketLength > agg_skb->len) { + break; + } + /* Process the MPDU recevied */ + skb = dev_alloc_skb(PacketLength); + memcpy(skb_put(skb,PacketLength),agg_skb->data, PacketLength); + skb_trim(skb, skb->len - 4/*sCrcLng*/); + + rx_pkt_len = skb->len; + ieee80211_hdr = (struct ieee80211_hdr_1addr *)skb->data; + unicast_packet = false; + if(is_broadcast_ether_addr(ieee80211_hdr->addr1)) { + //TODO + }else if(is_multicast_ether_addr(ieee80211_hdr->addr1)){ + //TODO + }else { + /* unicast packet */ + unicast_packet = true; + } + if(!ieee80211_rx(priv->ieee80211,skb, &stats)) { + dev_kfree_skb_any(skb); + } else { + priv->stats.rxoktotal++; + if(unicast_packet) { + priv->stats.rxbytesunicast += rx_pkt_len; + } + } + /* should trim the packet which has been copied to target skb */ + skb_pull(agg_skb, PacketLength); + PacketShiftBytes = GetRxPacketShiftBytes819xUsb(&stats, true); + PacketOccupiedLendth = PacketLength + PacketShiftBytes; + if ((PacketOccupiedLendth & 0xFF) != 0) { + PaddingBytes = 256 - (PacketOccupiedLendth & 0xFF); + if (agg_skb->len > PaddingBytes) + skb_pull(agg_skb, PaddingBytes); + else + agg_skb->len = 0; + } + } + dev_kfree_skb(agg_skb); + } +#endif + } else { + priv->stats.rxurberr++; + printk("actual_length:%d\n", skb->len); + dev_kfree_skb_any(skb); + } + +} + +void +rtl819xusb_process_received_packet( + struct net_device *dev, + struct ieee80211_rx_stats *pstats + ) +{ +// bool bfreerfd=false, bqueued=false; + u8* frame; + u16 frame_len=0; + struct r8192_priv *priv = ieee80211_priv(dev); +// u8 index = 0; +// u8 TID = 0; + //u16 seqnum = 0; + //PRX_TS_RECORD pts = NULL; + + // Get shifted bytes of Starting address of 802.11 header. 2006.09.28, by Emily + //porting by amy 080508 + pstats->virtual_address += get_rxpacket_shiftbytes_819xusb(pstats); + frame = pstats->virtual_address; + frame_len = pstats->packetlength; +#ifdef TODO // by amy about HCT + if(!Adapter->bInHctTest) + CountRxErrStatistics(Adapter, pRfd); +#endif + { + #ifdef ENABLE_PS //by amy for adding ps function in future + RT_RF_POWER_STATE rtState; + // When RF is off, we should not count the packet for hw/sw synchronize + // reason, ie. there may be a duration while sw switch is changed and hw + // switch is being changed. 2006.12.04, by shien chang. + Adapter->HalFunc.GetHwRegHandler(Adapter, HW_VAR_RF_STATE, (u8* )(&rtState)); + if (rtState == eRfOff) + { + return; + } + #endif + priv->stats.rxframgment++; + + } +#ifdef TODO + RmMonitorSignalStrength(Adapter, pRfd); +#endif + /* 2007/01/16 MH Add RX command packet handle here. */ + /* 2007/03/01 MH We have to release RFD and return if rx pkt is cmd pkt. */ + if (rtl819xusb_rx_command_packet(dev, pstats)) + { + return; + } + +#ifdef SW_CRC_CHECK + SwCrcCheck(); +#endif + + +} + +void query_rx_cmdpkt_desc_status(struct sk_buff *skb, struct ieee80211_rx_stats *stats) +{ +// rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; +// struct net_device *dev=info->dev; +// struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + rx_desc_819x_usb *desc = (rx_desc_819x_usb *)skb->data; +// rx_drvinfo_819x_usb *driver_info; + + // + //Get Rx Descriptor Information + // + stats->virtual_address = (u8*)skb->data; + stats->Length = desc->Length; + stats->RxDrvInfoSize = 0; + stats->RxBufShift = 0; + stats->packetlength = stats->Length-scrclng; + stats->fraglength = stats->packetlength; + stats->fragoffset = 0; + stats->ntotalfrag = 1; +} + + +void rtl8192_rx_cmd(struct sk_buff *skb) +{ + struct rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; + struct net_device *dev = info->dev; + //int ret; +// struct urb *rx_urb = info->urb; + /* TODO */ + struct ieee80211_rx_stats stats = { + .signal = 0, + .noise = -98, + .rate = 0, + // .mac_time = jiffies, + .freq = IEEE80211_24GHZ_BAND, + }; + + if((skb->len >=(20 + sizeof(rx_desc_819x_usb))) && (skb->len < RX_URB_SIZE)) + { + + query_rx_cmdpkt_desc_status(skb,&stats); + // this is to be done by amy 080508 prfd->queue_id = 1; + + + // + // Process the command packet received. + // + + rtl819xusb_process_received_packet(dev,&stats); + + dev_kfree_skb_any(skb); + } + else + ; + + +#if 0 + desc = (u32*)(skb->data); + cmd = (desc[0] >> 30) & 0x03; + + if(cmd == 0x00) {//beacon interrupt + //send beacon packet + skb = ieee80211_get_beacon(priv->ieee80211); + + if(!skb){ + DMESG("not enought memory for allocating beacon"); + return; + } + skb->cb[0] = BEACON_PRIORITY; + skb->cb[1] = 0; + skb->cb[2] = ieeerate2rtlrate(priv->ieee80211->basic_rate); + ret = rtl8192_tx(dev, skb); + + if( ret != 0 ){ + printk(KERN_ALERT "tx beacon packet error : %d !\n", ret); + } + dev_kfree_skb_any(skb); + } else {//0x00 + //{ log the device information + // At present, It is not implemented just now. + //} + } +#endif +} + +void rtl8192_irq_rx_tasklet(struct r8192_priv *priv) +{ + struct sk_buff *skb; + struct rtl8192_rx_info *info; + + while (NULL != (skb = skb_dequeue(&priv->skb_queue))) { + info = (struct rtl8192_rx_info *)skb->cb; + switch (info->out_pipe) { + /* Nomal packet pipe */ + case 3: + //RT_TRACE(COMP_RECV, "normal in-pipe index(%d)\n",info->out_pipe); + priv->IrpPendingCount--; + rtl8192_rx_nomal(skb); + break; + + /* Command packet pipe */ + case 9: + RT_TRACE(COMP_RECV, "command in-pipe index(%d)\n",\ + info->out_pipe); + + rtl8192_rx_cmd(skb); + break; + + default: /* should never get here! */ + RT_TRACE(COMP_ERR, "Unknown in-pipe index(%d)\n",\ + info->out_pipe); + dev_kfree_skb(skb); + break; + + } + } +} + + + +/**************************************************************************** + ---------------------------- USB_STUFF--------------------------- +*****************************************************************************/ + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) +static int __devinit rtl8192_usb_probe(struct usb_interface *intf, + const struct usb_device_id *id) +#else +static void * __devinit rtl8192_usb_probe(struct usb_device *udev, + unsigned int ifnum, + const struct usb_device_id *id) +#endif +{ +// unsigned long ioaddr = 0; + struct net_device *dev = NULL; + struct r8192_priv *priv= NULL; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + struct usb_device *udev = interface_to_usbdev(intf); +#endif + RT_TRACE(COMP_INIT, "Oops: i'm coming\n"); + + dev = alloc_ieee80211(sizeof(struct r8192_priv)); + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) + SET_MODULE_OWNER(dev); +#endif + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + usb_set_intfdata(intf, dev); + SET_NETDEV_DEV(dev, &intf->dev); +#endif + priv = ieee80211_priv(dev); +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + priv->ieee80211 = netdev_priv(dev); +#else + priv->ieee80211 = (struct net_device *)dev->priv; +#endif + priv->udev=udev; + + dev->open = rtl8192_open; + dev->stop = rtl8192_close; + //dev->hard_start_xmit = rtl8192_8023_hard_start_xmit; + dev->tx_timeout = tx_timeout; + //dev->wireless_handlers = &r8192_wx_handlers_def; + dev->do_ioctl = rtl8192_ioctl; + dev->set_multicast_list = r8192_set_multicast; + dev->set_mac_address = r8192_set_mac_adr; + dev->get_stats = rtl8192_stats; + + //DMESG("Oops: i'm coming\n"); +#if WIRELESS_EXT >= 12 +#if WIRELESS_EXT < 17 + dev->get_wireless_stats = r8192_get_wireless_stats; +#endif + dev->wireless_handlers = (struct iw_handler_def *) &r8192_wx_handlers_def; +#endif + dev->type=ARPHRD_ETHER; + + dev->watchdog_timeo = HZ*3; //modified by john, 0805 + + if (dev_alloc_name(dev, ifname) < 0){ + RT_TRACE(COMP_INIT, "Oops: devname already taken! Trying wlan%%d...\n"); + ifname = "wlan%d"; + dev_alloc_name(dev, ifname); + } + + RT_TRACE(COMP_INIT, "Driver probe completed1\n"); +#if 1 + if(rtl8192_init(dev)!=0){ + RT_TRACE(COMP_ERR, "Initialization failed"); + goto fail; + } +#endif + netif_carrier_off(dev); + netif_stop_queue(dev); + + register_netdev(dev); + RT_TRACE(COMP_INIT, "dev name=======> %s\n",dev->name); + rtl8192_proc_init_one(dev); + + + RT_TRACE(COMP_INIT, "Driver probe completed\n"); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + return dev; +#else + return 0; +#endif + + +fail: + free_ieee80211(dev); + + RT_TRACE(COMP_ERR, "wlan driver load failed\n"); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + return NULL; +#else + return -ENODEV; +#endif + +} + +//detach all the work and timer structure declared or inititialize in r8192U_init function. +void rtl8192_cancel_deferred_work(struct r8192_priv* priv) +{ + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) + cancel_work_sync(&priv->reset_wq); + cancel_delayed_work(&priv->watch_dog_wq); + cancel_delayed_work(&priv->update_beacon_wq); + cancel_work_sync(&priv->qos_activate); + //cancel_work_sync(&priv->SetBWModeWorkItem); + //cancel_work_sync(&priv->SwChnlWorkItem); +#else +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) +// cancel_delayed_work(&priv->reset_wq); + cancel_delayed_work(&priv->watch_dog_wq); + cancel_delayed_work(&priv->update_beacon_wq); +// cancel_delayed_work(&priv->qos_activate); + //cancel_delayed_work(&priv->SetBWModeWorkItem); + //cancel_delayed_work(&priv->SwChnlWorkItem); +#endif +#endif + +} + + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) +static void __devexit rtl8192_usb_disconnect(struct usb_interface *intf) +#else +static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr) +#endif +{ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + struct net_device *dev = usb_get_intfdata(intf); +#else + struct net_device *dev = (struct net_device *)ptr; +#endif + + struct r8192_priv *priv = ieee80211_priv(dev); + if(dev){ + + unregister_netdev(dev); + + RT_TRACE(COMP_DOWN, "=============>wlan driver to be removed\n"); + rtl8192_proc_remove_one(dev); + + rtl8192_down(dev); + if (priv->pFirmware) + { + kfree(priv->pFirmware); + priv->pFirmware = NULL; + } + // priv->rf_close(dev); +// rtl8192_SetRFPowerState(dev, eRfOff); + rtl8192_usb_deleteendpoints(dev); +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) + destroy_workqueue(priv->priv_wq); +#endif + //rtl8192_irq_disable(dev); + //rtl8192_reset(dev); + mdelay(10); + + } + free_ieee80211(dev); + RT_TRACE(COMP_DOWN, "wlan driver removed\n"); +} + + +static int __init rtl8192_usb_module_init(void) +{ + printk(KERN_INFO "\nLinux kernel driver for RTL8192 based WLAN cards\n"); + printk(KERN_INFO "Copyright (c) 2007-2008, Realsil Wlan\n"); + RT_TRACE(COMP_INIT, "Initializing module"); + RT_TRACE(COMP_INIT, "Wireless extensions version %d", WIRELESS_EXT); + rtl8192_proc_module_init(); + return usb_register(&rtl8192_usb_driver); +} + + +static void __exit rtl8192_usb_module_exit(void) +{ + usb_deregister(&rtl8192_usb_driver); + + RT_TRACE(COMP_DOWN, "Exiting"); +// rtl8192_proc_module_remove(); +} + + +void rtl8192_try_wake_queue(struct net_device *dev, int pri) +{ + unsigned long flags; + short enough_desc; + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + + spin_lock_irqsave(&priv->tx_lock,flags); + enough_desc = check_nic_enough_desc(dev,pri); + spin_unlock_irqrestore(&priv->tx_lock,flags); + + if(enough_desc) + ieee80211_wake_queue(priv->ieee80211); +} + +void EnableHWSecurityConfig8192(struct net_device *dev) +{ + u8 SECR_value = 0x0; + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + struct ieee80211_device* ieee = priv->ieee80211; + SECR_value = SCR_TxEncEnable | SCR_RxDecEnable; +#if 1 + if (((KEY_TYPE_WEP40 == ieee->pairwise_key_type) || (KEY_TYPE_WEP104 == ieee->pairwise_key_type)) && (priv->ieee80211->auth_mode != 2)) + { + SECR_value |= SCR_RxUseDK; + SECR_value |= SCR_TxUseDK; + } + else if ((ieee->iw_mode == IW_MODE_ADHOC) && (ieee->pairwise_key_type & (KEY_TYPE_CCMP | KEY_TYPE_TKIP))) + { + SECR_value |= SCR_RxUseDK; + SECR_value |= SCR_TxUseDK; + } +#endif + //add HWSec active enable here. +//default using hwsec. when peer AP is in N mode only and pairwise_key_type is none_aes(which HT_IOT_ACT_PURE_N_MODE indicates it), use software security. when peer AP is in b,g,n mode mixed and pairwise_key_type is none_aes, use g mode hw security. WB on 2008.7.4 + + ieee->hwsec_active = 1; + + if ((ieee->pHTInfo->IOTAction&HT_IOT_ACT_PURE_N_MODE) || !hwwep)//!ieee->hwsec_support) //add hwsec_support flag to totol control hw_sec on/off + { + ieee->hwsec_active = 0; + SECR_value &= ~SCR_RxDecEnable; + } + RT_TRACE(COMP_SEC,"%s:, hwsec:%d, pairwise_key:%d, SECR_value:%x\n", __FUNCTION__, \ + ieee->hwsec_active, ieee->pairwise_key_type, SECR_value); + { + write_nic_byte(dev, SECR, SECR_value);//SECR_value | SCR_UseDK ); + } +} + + +void setKey( struct net_device *dev, + u8 EntryNo, + u8 KeyIndex, + u16 KeyType, + u8 *MacAddr, + u8 DefaultKey, + u32 *KeyContent ) +{ + u32 TargetCommand = 0; + u32 TargetContent = 0; + u16 usConfig = 0; + u8 i; + if (EntryNo >= TOTAL_CAM_ENTRY) + RT_TRACE(COMP_ERR, "cam entry exceeds in setKey()\n"); + + RT_TRACE(COMP_SEC, "====>to setKey(), dev:%p, EntryNo:%d, KeyIndex:%d, KeyType:%d, MacAddr"MAC_FMT"\n", dev,EntryNo, KeyIndex, KeyType, MAC_ARG(MacAddr)); + + if (DefaultKey) + usConfig |= BIT15 | (KeyType<<2); + else + usConfig |= BIT15 | (KeyType<<2) | KeyIndex; +// usConfig |= BIT15 | (KeyType<<2) | (DefaultKey<<5) | KeyIndex; + + + for(i=0 ; i= KERNEL_VERSION(2,6,20)) +extern void dm_txpower_trackingcallback(struct work_struct *work); +#else +extern void dm_txpower_trackingcallback(struct net_device *dev); +#endif + +extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14); +extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); +extern void dm_backup_dynamic_mechanism_state(struct net_device *dev); +extern void dm_change_dynamic_initgain_thresh(struct net_device *dev, + u32 dm_type, + u32 dm_value); +extern void DM_ChangeFsyncSetting(struct net_device *dev, + s32 DM_Type, + s32 DM_Value); +extern void dm_force_tx_fw_info(struct net_device *dev, + u32 force_type, + u32 force_value); +extern void dm_init_edca_turbo(struct net_device *dev); +extern void dm_rf_operation_test_callback(unsigned long data); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work); +#else +extern void dm_rf_pathcheck_workitemcallback(struct net_device *dev); +#endif +extern void dm_fsync_timer_callback(unsigned long data); +#if 0 +extern bool dm_check_lbus_status(struct net_device *dev); +#endif +extern void dm_check_fsync(struct net_device *dev); +extern void dm_shadow_init(struct net_device *dev); + + +/*--------------------Define export function prototype-----------------------*/ + + +/*---------------------Define local function prototype-----------------------*/ +// DM --> Rate Adaptive +static void dm_check_rate_adaptive(struct net_device *dev); + +// DM --> Bandwidth switch +static void dm_init_bandwidth_autoswitch(struct net_device *dev); +static void dm_bandwidth_autoswitch( struct net_device *dev); + +// DM --> TX power control +//static void dm_initialize_txpower_tracking(struct net_device *dev); + +static void dm_check_txpower_tracking(struct net_device *dev); + + + +//static void dm_txpower_reset_recovery(struct net_device *dev); + + +// DM --> BB init gain restore +#ifndef RTL8192U +static void dm_bb_initialgain_restore(struct net_device *dev); + + +// DM --> BB init gain backup +static void dm_bb_initialgain_backup(struct net_device *dev); +#endif +// DM --> Dynamic Init Gain by RSSI +static void dm_dig_init(struct net_device *dev); +static void dm_ctrl_initgain_byrssi(struct net_device *dev); +static void dm_ctrl_initgain_byrssi_highpwr(struct net_device *dev); +static void dm_ctrl_initgain_byrssi_by_driverrssi( struct net_device *dev); +static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(struct net_device *dev); +static void dm_initial_gain(struct net_device *dev); +static void dm_pd_th(struct net_device *dev); +static void dm_cs_ratio(struct net_device *dev); + +static void dm_init_ctstoself(struct net_device *dev); +// DM --> EDCA turboe mode control +static void dm_check_edca_turbo(struct net_device *dev); + +// DM --> HW RF control +static void dm_check_rfctrl_gpio(struct net_device *dev); + +#ifndef RTL8190P +//static void dm_gpio_change_rf(struct net_device *dev); +#endif +// DM --> Check PBC +static void dm_check_pbc_gpio(struct net_device *dev); + + +// DM --> Check current RX RF path state +static void dm_check_rx_path_selection(struct net_device *dev); +static void dm_init_rxpath_selection(struct net_device *dev); +static void dm_rxpath_sel_byrssi(struct net_device *dev); + + +// DM --> Fsync for broadcom ap +static void dm_init_fsync(struct net_device *dev); +static void dm_deInit_fsync(struct net_device *dev); + +//Added by vivi, 20080522 +static void dm_check_txrateandretrycount(struct net_device *dev); + +/*---------------------Define local function prototype-----------------------*/ + +/*---------------------Define of Tx Power Control For Near/Far Range --------*/ //Add by Jacken 2008/02/18 +static void dm_init_dynamic_txpower(struct net_device *dev); +static void dm_dynamic_txpower(struct net_device *dev); + + +// DM --> For rate adaptive and DIG, we must send RSSI to firmware +static void dm_send_rssi_tofw(struct net_device *dev); +static void dm_ctstoself(struct net_device *dev); +/*---------------------------Define function prototype------------------------*/ +//================================================================================ +// HW Dynamic mechanism interface. +//================================================================================ + +// +// Description: +// Prepare SW resource for HW dynamic mechanism. +// +// Assumption: +// This function is only invoked at driver intialization once. +// +// +extern void +init_hal_dm(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + // Undecorated Smoothed Signal Strength, it can utilized to dynamic mechanism. + priv->undecorated_smoothed_pwdb = -1; + + //Initial TX Power Control for near/far range , add by amy 2008/05/15, porting from windows code. + dm_init_dynamic_txpower(dev); + init_rate_adaptive(dev); + //dm_initialize_txpower_tracking(dev); + dm_dig_init(dev); + dm_init_edca_turbo(dev); + dm_init_bandwidth_autoswitch(dev); + dm_init_fsync(dev); + dm_init_rxpath_selection(dev); + dm_init_ctstoself(dev); + +} // InitHalDm + +extern void deinit_hal_dm(struct net_device *dev) +{ + + dm_deInit_fsync(dev); + +} + + +#ifdef USB_RX_AGGREGATION_SUPPORT +void dm_CheckRxAggregation(struct net_device *dev) { + struct r8192_priv *priv = ieee80211_priv((struct net_device *)dev); + PRT_HIGH_THROUGHPUT pHTInfo = priv->ieee80211->pHTInfo; + static unsigned long lastTxOkCnt = 0; + static unsigned long lastRxOkCnt = 0; + unsigned long curTxOkCnt = 0; + unsigned long curRxOkCnt = 0; + +/* + if (pHalData->bForcedUsbRxAggr) { + if (pHalData->ForcedUsbRxAggrInfo == 0) { + if (pHalData->bCurrentRxAggrEnable) { + Adapter->HalFunc.HalUsbRxAggrHandler(Adapter, FALSE); + } + } else { + if (!pHalData->bCurrentRxAggrEnable || (pHalData->ForcedUsbRxAggrInfo != pHalData->LastUsbRxAggrInfoSetting)) { + Adapter->HalFunc.HalUsbRxAggrHandler(Adapter, TRUE); + } + } + return; + } + +*/ + curTxOkCnt = priv->stats.txbytesunicast - lastTxOkCnt; + curRxOkCnt = priv->stats.rxbytesunicast - lastRxOkCnt; + + if((curTxOkCnt + curRxOkCnt) < 15000000) { + return; + } + + if(curTxOkCnt > 4*curRxOkCnt) { + if (priv->bCurrentRxAggrEnable) { + write_nic_dword(dev, 0x1a8, 0); + priv->bCurrentRxAggrEnable = false; + } + }else{ + if (!priv->bCurrentRxAggrEnable && !pHTInfo->bCurrentRT2RTAggregation) { + u32 ulValue; + ulValue = (pHTInfo->UsbRxFwAggrEn<<24) | (pHTInfo->UsbRxFwAggrPageNum<<16) | + (pHTInfo->UsbRxFwAggrPacketNum<<8) | (pHTInfo->UsbRxFwAggrTimeout); + /* + * If usb rx firmware aggregation is enabled, + * when anyone of three threshold conditions above is reached, + * firmware will send aggregated packet to driver. + */ + write_nic_dword(dev, 0x1a8, ulValue); + priv->bCurrentRxAggrEnable = true; + } + } + + lastTxOkCnt = priv->stats.txbytesunicast; + lastRxOkCnt = priv->stats.rxbytesunicast; +} // dm_CheckEdcaTurbo +#endif + + + +extern void hal_dm_watchdog(struct net_device *dev) +{ + //struct r8192_priv *priv = ieee80211_priv(dev); + + //static u8 previous_bssid[6] ={0}; + + /*Add by amy 2008/05/15 ,porting from windows code.*/ + dm_check_rate_adaptive(dev); + dm_dynamic_txpower(dev); + dm_check_txrateandretrycount(dev); + dm_check_txpower_tracking(dev); + dm_ctrl_initgain_byrssi(dev); + dm_check_edca_turbo(dev); + dm_bandwidth_autoswitch(dev); + dm_check_rfctrl_gpio(dev); + dm_check_rx_path_selection(dev); + dm_check_fsync(dev); + + // Add by amy 2008-05-15 porting from windows code. + dm_check_pbc_gpio(dev); + dm_send_rssi_tofw(dev); + dm_ctstoself(dev); +#ifdef USB_RX_AGGREGATION_SUPPORT + dm_CheckRxAggregation(dev); +#endif +} //HalDmWatchDog + + +/* + * Decide Rate Adaptive Set according to distance (signal strength) + * 01/11/2008 MHC Modify input arguments and RATR table level. + * 01/16/2008 MHC RF_Type is assigned in ReadAdapterInfo(). We must call + * the function after making sure RF_Type. + */ +extern void init_rate_adaptive(struct net_device * dev) +{ + + struct r8192_priv *priv = ieee80211_priv(dev); + prate_adaptive pra = (prate_adaptive)&priv->rate_adaptive; + + pra->ratr_state = DM_RATR_STA_MAX; + pra->high2low_rssi_thresh_for_ra = RateAdaptiveTH_High; + pra->low2high_rssi_thresh_for_ra20M = RateAdaptiveTH_Low_20M+5; + pra->low2high_rssi_thresh_for_ra40M = RateAdaptiveTH_Low_40M+5; + + pra->high_rssi_thresh_for_ra = RateAdaptiveTH_High+5; + pra->low_rssi_thresh_for_ra20M = RateAdaptiveTH_Low_20M; + pra->low_rssi_thresh_for_ra40M = RateAdaptiveTH_Low_40M; + + if(priv->CustomerID == RT_CID_819x_Netcore) + pra->ping_rssi_enable = 1; + else + pra->ping_rssi_enable = 0; + pra->ping_rssi_thresh_for_ra = 15; + + + if (priv->rf_type == RF_2T4R) + { + // 07/10/08 MH Modify for RA smooth scheme. + /* 2008/01/11 MH Modify 2T RATR table for different RSSI. 080515 porting by amy from windows code.*/ + pra->upper_rssi_threshold_ratr = 0x8f0f0000; + pra->middle_rssi_threshold_ratr = 0x8f0ff000; + pra->low_rssi_threshold_ratr = 0x8f0ff001; + pra->low_rssi_threshold_ratr_40M = 0x8f0ff005; + pra->low_rssi_threshold_ratr_20M = 0x8f0ff001; + pra->ping_rssi_ratr = 0x0000000d;//cosa add for test + } + else if (priv->rf_type == RF_1T2R) + { + pra->upper_rssi_threshold_ratr = 0x000f0000; + pra->middle_rssi_threshold_ratr = 0x000ff000; + pra->low_rssi_threshold_ratr = 0x000ff001; + pra->low_rssi_threshold_ratr_40M = 0x000ff005; + pra->low_rssi_threshold_ratr_20M = 0x000ff001; + pra->ping_rssi_ratr = 0x0000000d;//cosa add for test + } + +} // InitRateAdaptive + + +/*----------------------------------------------------------------------------- + * Function: dm_check_rate_adaptive() + * + * Overview: + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/26/08 amy Create version 0 proting from windows code. + * + *---------------------------------------------------------------------------*/ +static void dm_check_rate_adaptive(struct net_device * dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + PRT_HIGH_THROUGHPUT pHTInfo = priv->ieee80211->pHTInfo; + prate_adaptive pra = (prate_adaptive)&priv->rate_adaptive; + u32 currentRATR, targetRATR = 0; + u32 LowRSSIThreshForRA = 0, HighRSSIThreshForRA = 0; + bool bshort_gi_enabled = false; + static u8 ping_rssi_state=0; + + + if(!priv->up) + { + RT_TRACE(COMP_RATE, "<---- dm_check_rate_adaptive(): driver is going to unload\n"); + return; + } + + if(pra->rate_adaptive_disabled)//this variable is set by ioctl. + return; + + // TODO: Only 11n mode is implemented currently, + if( !(priv->ieee80211->mode == WIRELESS_MODE_N_24G || + priv->ieee80211->mode == WIRELESS_MODE_N_5G)) + return; + + if( priv->ieee80211->state == IEEE80211_LINKED ) + { + // RT_TRACE(COMP_RATE, "dm_CheckRateAdaptive(): \t"); + + // + // Check whether Short GI is enabled + // + bshort_gi_enabled = (pHTInfo->bCurTxBW40MHz && pHTInfo->bCurShortGI40MHz) || + (!pHTInfo->bCurTxBW40MHz && pHTInfo->bCurShortGI20MHz); + + + pra->upper_rssi_threshold_ratr = + (pra->upper_rssi_threshold_ratr & (~BIT31)) | ((bshort_gi_enabled)? BIT31:0) ; + + pra->middle_rssi_threshold_ratr = + (pra->middle_rssi_threshold_ratr & (~BIT31)) | ((bshort_gi_enabled)? BIT31:0) ; + + if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) + { + pra->low_rssi_threshold_ratr = + (pra->low_rssi_threshold_ratr_40M & (~BIT31)) | ((bshort_gi_enabled)? BIT31:0) ; + } + else + { + pra->low_rssi_threshold_ratr = + (pra->low_rssi_threshold_ratr_20M & (~BIT31)) | ((bshort_gi_enabled)? BIT31:0) ; + } + //cosa add for test + pra->ping_rssi_ratr = + (pra->ping_rssi_ratr & (~BIT31)) | ((bshort_gi_enabled)? BIT31:0) ; + + /* 2007/10/08 MH We support RA smooth scheme now. When it is the first + time to link with AP. We will not change upper/lower threshold. If + STA stay in high or low level, we must change two different threshold + to prevent jumping frequently. */ + if (pra->ratr_state == DM_RATR_STA_HIGH) + { + HighRSSIThreshForRA = pra->high2low_rssi_thresh_for_ra; + LowRSSIThreshForRA = (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)? + (pra->low_rssi_thresh_for_ra40M):(pra->low_rssi_thresh_for_ra20M); + } + else if (pra->ratr_state == DM_RATR_STA_LOW) + { + HighRSSIThreshForRA = pra->high_rssi_thresh_for_ra; + LowRSSIThreshForRA = (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)? + (pra->low2high_rssi_thresh_for_ra40M):(pra->low2high_rssi_thresh_for_ra20M); + } + else + { + HighRSSIThreshForRA = pra->high_rssi_thresh_for_ra; + LowRSSIThreshForRA = (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)? + (pra->low_rssi_thresh_for_ra40M):(pra->low_rssi_thresh_for_ra20M); + } + + //DbgPrint("[DM] THresh H/L=%d/%d\n\r", RATR.HighRSSIThreshForRA, RATR.LowRSSIThreshForRA); + if(priv->undecorated_smoothed_pwdb >= (long)HighRSSIThreshForRA) + { + //DbgPrint("[DM] RSSI=%d STA=HIGH\n\r", pHalData->UndecoratedSmoothedPWDB); + pra->ratr_state = DM_RATR_STA_HIGH; + targetRATR = pra->upper_rssi_threshold_ratr; + }else if(priv->undecorated_smoothed_pwdb >= (long)LowRSSIThreshForRA) + { + //DbgPrint("[DM] RSSI=%d STA=Middle\n\r", pHalData->UndecoratedSmoothedPWDB); + pra->ratr_state = DM_RATR_STA_MIDDLE; + targetRATR = pra->middle_rssi_threshold_ratr; + }else + { + //DbgPrint("[DM] RSSI=%d STA=LOW\n\r", pHalData->UndecoratedSmoothedPWDB); + pra->ratr_state = DM_RATR_STA_LOW; + targetRATR = pra->low_rssi_threshold_ratr; + } + + //cosa add for test + if(pra->ping_rssi_enable) + { + //pHalData->UndecoratedSmoothedPWDB = 19; + if(priv->undecorated_smoothed_pwdb < (long)(pra->ping_rssi_thresh_for_ra+5)) + { + if( (priv->undecorated_smoothed_pwdb < (long)pra->ping_rssi_thresh_for_ra) || + ping_rssi_state ) + { + //DbgPrint("TestRSSI = %d, set RATR to 0x%x \n", pHalData->UndecoratedSmoothedPWDB, pRA->TestRSSIRATR); + pra->ratr_state = DM_RATR_STA_LOW; + targetRATR = pra->ping_rssi_ratr; + ping_rssi_state = 1; + } + //else + // DbgPrint("TestRSSI is between the range. \n"); + } + else + { + //DbgPrint("TestRSSI Recover to 0x%x \n", targetRATR); + ping_rssi_state = 0; + } + } + + // 2008.04.01 +#if 1 + // For RTL819X, if pairwisekey = wep/tkip, we support only MCS0~7. + if(priv->ieee80211->GetHalfNmodeSupportByAPsHandler(dev)) + targetRATR &= 0xf00fffff; +#endif + + // + // Check whether updating of RATR0 is required + // + currentRATR = read_nic_dword(dev, RATR0); + if( targetRATR != currentRATR ) + { + u32 ratr_value; + ratr_value = targetRATR; + RT_TRACE(COMP_RATE,"currentRATR = %x, targetRATR = %x\n", currentRATR, targetRATR); + if(priv->rf_type == RF_1T2R) + { + ratr_value &= ~(RATE_ALL_OFDM_2SS); + } + write_nic_dword(dev, RATR0, ratr_value); + write_nic_byte(dev, UFWP, 1); + + pra->last_ratr = targetRATR; + } + + } + else + { + pra->ratr_state = DM_RATR_STA_MAX; + } + +} // dm_CheckRateAdaptive + + +static void dm_init_bandwidth_autoswitch(struct net_device * dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz = BW_AUTO_SWITCH_LOW_HIGH; + priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz = BW_AUTO_SWITCH_HIGH_LOW; + priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false; + priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable = false; + +} // dm_init_bandwidth_autoswitch + + +static void dm_bandwidth_autoswitch(struct net_device * dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + if(priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 ||!priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable){ + return; + }else{ + if(priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40 + if(priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz) + priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true; + }else{//in force send packets in 20 Mhz in 20/40 + if(priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz) + priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false; + + } + } +} // dm_BandwidthAutoSwitch + +//OFDM default at 0db, index=6. +static u32 OFDMSwingTable[OFDM_Table_Length] = { + 0x7f8001fe, // 0, +6db + 0x71c001c7, // 1, +5db + 0x65400195, // 2, +4db + 0x5a400169, // 3, +3db + 0x50800142, // 4, +2db + 0x47c0011f, // 5, +1db + 0x40000100, // 6, +0db ===> default, upper for higher temprature, lower for low temprature + 0x390000e4, // 7, -1db + 0x32c000cb, // 8, -2db + 0x2d4000b5, // 9, -3db + 0x288000a2, // 10, -4db + 0x24000090, // 11, -5db + 0x20000080, // 12, -6db + 0x1c800072, // 13, -7db + 0x19800066, // 14, -8db + 0x26c0005b, // 15, -9db + 0x24400051, // 16, -10db + 0x12000048, // 17, -11db + 0x10000040 // 18, -12db +}; + +static u8 CCKSwingTable_Ch1_Ch13[CCK_Table_length][8] = { + {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04}, // 0, +0db ===> CCK40M default + {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, // 1, -1db + {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, // 2, -2db + {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, // 3, -3db + {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, // 4, -4db + {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, // 5, -5db + {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, // 6, -6db ===> CCK20M default + {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, // 7, -7db + {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, // 8, -8db + {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, // 9, -9db + {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 10, -10db + {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01} // 11, -11db +}; + +static u8 CCKSwingTable_Ch14[CCK_Table_length][8] = { + {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00}, // 0, +0db ===> CCK40M default + {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, // 1, -1db + {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, // 2, -2db + {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, // 3, -3db + {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, // 4, -4db + {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, // 5, -5db + {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 6, -6db ===> CCK20M default + {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, // 7, -7db + {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 8, -8db + {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 9, -9db + {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 10, -10db + {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00} // 11, -11db +}; + +static void dm_TXPowerTrackingCallback_TSSI(struct net_device * dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + bool bHighpowerstate, viviflag = FALSE; + DCMD_TXCMD_T tx_cmd; + u8 powerlevelOFDM24G; + int i =0, j = 0, k = 0; + u8 RF_Type, tmp_report[5]={0, 0, 0, 0, 0}; + u32 Value; + u8 Pwr_Flag; + u16 Avg_TSSI_Meas, TSSI_13dBm, Avg_TSSI_Meas_from_driver=0; + //RT_STATUS rtStatus = RT_STATUS_SUCCESS; + bool rtStatus = true; + u32 delta=0; + + write_nic_byte(dev, 0x1ba, 0); + + priv->ieee80211->bdynamic_txpower_enable = false; + bHighpowerstate = priv->bDynamicTxHighPower; + + powerlevelOFDM24G = (u8)(priv->Pwr_Track>>24); + RF_Type = priv->rf_type; + Value = (RF_Type<<8) | powerlevelOFDM24G; + + RT_TRACE(COMP_POWER_TRACKING, "powerlevelOFDM24G = %x\n", powerlevelOFDM24G); + + for(j = 0; j<=30; j++) +{ //fill tx_cmd + + tx_cmd.Op = TXCMD_SET_TX_PWR_TRACKING; + tx_cmd.Length = 4; + tx_cmd.Value = Value; +#ifdef RTL8192U + rtStatus = SendTxCommandPacket(dev, &tx_cmd, 12); + if (rtStatus == RT_STATUS_FAILURE) + { + RT_TRACE(COMP_POWER_TRACKING, "Set configuration with tx cmd queue fail!\n"); + } +#else + cmpk_message_handle_tx(dev, (u8*)&tx_cmd, + DESC_PACKET_TYPE_INIT, sizeof(DCMD_TXCMD_T)); +#endif + mdelay(1); + //DbgPrint("hi, vivi, strange\n"); + for(i = 0;i <= 30; i++) + { + Pwr_Flag = read_nic_byte(dev, 0x1ba); + + if (Pwr_Flag == 0) + { + mdelay(1); + continue; + } +#ifdef RTL8190P + Avg_TSSI_Meas = read_nic_word(dev, 0x1bc); +#else + Avg_TSSI_Meas = read_nic_word(dev, 0x13c); +#endif + if(Avg_TSSI_Meas == 0) + { + write_nic_byte(dev, 0x1ba, 0); + break; + } + + for(k = 0;k < 5; k++) + { +#ifdef RTL8190P + tmp_report[k] = read_nic_byte(dev, 0x1d8+k); +#else + if(k !=4) + tmp_report[k] = read_nic_byte(dev, 0x134+k); + else + tmp_report[k] = read_nic_byte(dev, 0x13e); +#endif + RT_TRACE(COMP_POWER_TRACKING, "TSSI_report_value = %d\n", tmp_report[k]); + } + + //check if the report value is right + for(k = 0;k < 5; k++) + { + if(tmp_report[k] <= 20) + { + viviflag =TRUE; + break; + } + } + if(viviflag ==TRUE) + { + write_nic_byte(dev, 0x1ba, 0); + viviflag = FALSE; + RT_TRACE(COMP_POWER_TRACKING, "we filted this data\n"); + for(k = 0;k < 5; k++) + tmp_report[k] = 0; + break; + } + + for(k = 0;k < 5; k++) + { + Avg_TSSI_Meas_from_driver += tmp_report[k]; + } + + Avg_TSSI_Meas_from_driver = Avg_TSSI_Meas_from_driver*100/5; + RT_TRACE(COMP_POWER_TRACKING, "Avg_TSSI_Meas_from_driver = %d\n", Avg_TSSI_Meas_from_driver); + TSSI_13dBm = priv->TSSI_13dBm; + RT_TRACE(COMP_POWER_TRACKING, "TSSI_13dBm = %d\n", TSSI_13dBm); + + //if(abs(Avg_TSSI_Meas_from_driver - TSSI_13dBm) <= E_FOR_TX_POWER_TRACK) + // For MacOS-compatible + if(Avg_TSSI_Meas_from_driver > TSSI_13dBm) + delta = Avg_TSSI_Meas_from_driver - TSSI_13dBm; + else + delta = TSSI_13dBm - Avg_TSSI_Meas_from_driver; + + if(delta <= E_FOR_TX_POWER_TRACK) + { + priv->ieee80211->bdynamic_txpower_enable = TRUE; + write_nic_byte(dev, 0x1ba, 0); + RT_TRACE(COMP_POWER_TRACKING, "tx power track is done\n"); + RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpowertrackingindex = %d\n", priv->rfa_txpowertrackingindex); + RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpowertrackingindex_real = %d\n", priv->rfa_txpowertrackingindex_real); +#ifdef RTL8190P + RT_TRACE(COMP_POWER_TRACKING, "priv->rfc_txpowertrackingindex = %d\n", priv->rfc_txpowertrackingindex); + RT_TRACE(COMP_POWER_TRACKING, "priv->rfc_txpowertrackingindex_real = %d\n", priv->rfc_txpowertrackingindex_real); +#endif + RT_TRACE(COMP_POWER_TRACKING, "priv->cck_present_attentuation_difference = %d\n", priv->cck_present_attentuation_difference); + RT_TRACE(COMP_POWER_TRACKING, "priv->cck_present_attentuation = %d\n", priv->cck_present_attentuation); + return; + } + else + { + if(Avg_TSSI_Meas_from_driver < TSSI_13dBm - E_FOR_TX_POWER_TRACK) + { + if((priv->rfa_txpowertrackingindex > 0) +#ifdef RTL8190P + &&(priv->rfc_txpowertrackingindex > 0) +#endif + ) + { + priv->rfa_txpowertrackingindex--; + if(priv->rfa_txpowertrackingindex_real > 4) + { + priv->rfa_txpowertrackingindex_real--; + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); + } +#ifdef RTL8190P + priv->rfc_txpowertrackingindex--; + if(priv->rfc_txpowertrackingindex_real > 4) + { + priv->rfc_txpowertrackingindex_real--; + rtl8192_setBBreg(dev, rOFDM0_XCTxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfc_txpowertrackingindex_real].txbbgain_value); + } +#endif + } + } + else + { + if((priv->rfa_txpowertrackingindex < 36) +#ifdef RTL8190P + &&(priv->rfc_txpowertrackingindex < 36) +#endif + ) + { + priv->rfa_txpowertrackingindex++; + priv->rfa_txpowertrackingindex_real++; + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); + +#ifdef RTL8190P + priv->rfc_txpowertrackingindex++; + priv->rfc_txpowertrackingindex_real++; + rtl8192_setBBreg(dev, rOFDM0_XCTxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfc_txpowertrackingindex_real].txbbgain_value); +#endif + } + } + priv->cck_present_attentuation_difference + = priv->rfa_txpowertrackingindex - priv->rfa_txpowertracking_default; + + if(priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20) + priv->cck_present_attentuation + = priv->cck_present_attentuation_20Mdefault + priv->cck_present_attentuation_difference; + else + priv->cck_present_attentuation + = priv->cck_present_attentuation_40Mdefault + priv->cck_present_attentuation_difference; + + if(priv->cck_present_attentuation > -1&&priv->cck_present_attentuation <23) + { + if(priv->ieee80211->current_network.channel == 14 && !priv->bcck_in_ch14) + { + priv->bcck_in_ch14 = TRUE; + dm_cck_txpower_adjust(dev,priv->bcck_in_ch14); + } + else if(priv->ieee80211->current_network.channel != 14 && priv->bcck_in_ch14) + { + priv->bcck_in_ch14 = FALSE; + dm_cck_txpower_adjust(dev,priv->bcck_in_ch14); + } + else + dm_cck_txpower_adjust(dev,priv->bcck_in_ch14); + } + RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpowertrackingindex = %d\n", priv->rfa_txpowertrackingindex); + RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpowertrackingindex_real = %d\n", priv->rfa_txpowertrackingindex_real); +#ifdef RTL8190P + RT_TRACE(COMP_POWER_TRACKING, "priv->rfc_txpowertrackingindex = %d\n", priv->rfc_txpowertrackingindex); + RT_TRACE(COMP_POWER_TRACKING, "priv->rfc_txpowertrackingindex_real = %d\n", priv->rfc_txpowertrackingindex_real); +#endif + RT_TRACE(COMP_POWER_TRACKING, "priv->cck_present_attentuation_difference = %d\n", priv->cck_present_attentuation_difference); + RT_TRACE(COMP_POWER_TRACKING, "priv->cck_present_attentuation = %d\n", priv->cck_present_attentuation); + + if (priv->cck_present_attentuation_difference <= -12||priv->cck_present_attentuation_difference >= 24) + { + priv->ieee80211->bdynamic_txpower_enable = TRUE; + write_nic_byte(dev, 0x1ba, 0); + RT_TRACE(COMP_POWER_TRACKING, "tx power track--->limited\n"); + return; + } + + + } + write_nic_byte(dev, 0x1ba, 0); + Avg_TSSI_Meas_from_driver = 0; + for(k = 0;k < 5; k++) + tmp_report[k] = 0; + break; + } +} + priv->ieee80211->bdynamic_txpower_enable = TRUE; + write_nic_byte(dev, 0x1ba, 0); +} + +static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device * dev) +{ +#define ThermalMeterVal 9 + struct r8192_priv *priv = ieee80211_priv(dev); + u32 tmpRegA, TempCCk; + u8 tmpOFDMindex, tmpCCKindex, tmpCCK20Mindex, tmpCCK40Mindex, tmpval; + int i =0, CCKSwingNeedUpdate=0; + + if(!priv->btxpower_trackingInit) + { + //Query OFDM default setting + tmpRegA= rtl8192_QueryBBReg(dev, rOFDM0_XATxIQImbalance, bMaskDWord); + for(i=0; iOFDM_index= (u8)i; + RT_TRACE(COMP_POWER_TRACKING, "Initial reg0x%x = 0x%x, OFDM_index=0x%x\n", + rOFDM0_XATxIQImbalance, tmpRegA, priv->OFDM_index); + } + } + + //Query CCK default setting From 0xa22 + TempCCk = rtl8192_QueryBBReg(dev, rCCK0_TxFilter1, bMaskByte2); + for(i=0 ; iCCK_index =(u8) i; + RT_TRACE(COMP_POWER_TRACKING, "Initial reg0x%x = 0x%x, CCK_index=0x%x\n", + rCCK0_TxFilter1, TempCCk, priv->CCK_index); + break; + } + } + priv->btxpower_trackingInit = TRUE; + //pHalData->TXPowercount = 0; + return; + } + + //========================== + // this is only for test, should be masked +#if 0 +{ + //UINT32 eRFPath; + //UINT32 start_rf, end_rf; + UINT32 curr_addr; + //UINT32 reg_addr; + //UINT32 reg_addr_end; + UINT32 reg_value; + //start_rf = RF90_PATH_A; + //end_rf = RF90_PATH_B;//RF90_PATH_MAX; + //reg_addr = 0x0; + //reg_addr_end = 0x2F; + + for (curr_addr = 0; curr_addr < 0x2d; curr_addr++) + { + reg_value = PHY_QueryRFReg( Adapter, (RF90_RADIO_PATH_E)RF90_PATH_A, + curr_addr, bMaskDWord); + } + + pHalData->TXPowercount = 0; + return; +} +#endif + //========================== + + // read and filter out unreasonable value + tmpRegA = rtl8192_phy_QueryRFReg(dev, RF90_PATH_A, 0x12, 0x078); // 0x12: RF Reg[10:7] + RT_TRACE(COMP_POWER_TRACKING, "Readback ThermalMeterA = %d \n", tmpRegA); + if(tmpRegA < 3 || tmpRegA > 13) + return; + if(tmpRegA >= 12) // if over 12, TP will be bad when high temprature + tmpRegA = 12; + RT_TRACE(COMP_POWER_TRACKING, "Valid ThermalMeterA = %d \n", tmpRegA); + priv->ThermalMeter[0] = ThermalMeterVal; //We use fixed value by Bryant's suggestion + priv->ThermalMeter[1] = ThermalMeterVal; //We use fixed value by Bryant's suggestion + + //Get current RF-A temprature index + if(priv->ThermalMeter[0] >= (u8)tmpRegA) //lower temprature + { + tmpOFDMindex = tmpCCK20Mindex = 6+(priv->ThermalMeter[0]-(u8)tmpRegA); + tmpCCK40Mindex = tmpCCK20Mindex - 6; + if(tmpOFDMindex >= OFDM_Table_Length) + tmpOFDMindex = OFDM_Table_Length-1; + if(tmpCCK20Mindex >= CCK_Table_length) + tmpCCK20Mindex = CCK_Table_length-1; + if(tmpCCK40Mindex >= CCK_Table_length) + tmpCCK40Mindex = CCK_Table_length-1; + } + else + { + tmpval = ((u8)tmpRegA - priv->ThermalMeter[0]); + if(tmpval >= 6) // higher temprature + tmpOFDMindex = tmpCCK20Mindex = 0; // max to +6dB + else + tmpOFDMindex = tmpCCK20Mindex = 6 - tmpval; + tmpCCK40Mindex = 0; + } + //DbgPrint("%ddb, tmpOFDMindex = %d, tmpCCK20Mindex = %d, tmpCCK40Mindex = %d", + //((u1Byte)tmpRegA - pHalData->ThermalMeter[0]), + //tmpOFDMindex, tmpCCK20Mindex, tmpCCK40Mindex); + if(priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) //40M + tmpCCKindex = tmpCCK40Mindex; + else + tmpCCKindex = tmpCCK20Mindex; + + if(priv->ieee80211->current_network.channel == 14 && !priv->bcck_in_ch14) + { + priv->bcck_in_ch14 = TRUE; + CCKSwingNeedUpdate = 1; + } + else if(priv->ieee80211->current_network.channel != 14 && priv->bcck_in_ch14) + { + priv->bcck_in_ch14 = FALSE; + CCKSwingNeedUpdate = 1; + } + + if(priv->CCK_index != tmpCCKindex) + { + priv->CCK_index = tmpCCKindex; + CCKSwingNeedUpdate = 1; + } + + if(CCKSwingNeedUpdate) + { + //DbgPrint("Update CCK Swing, CCK_index = %d\n", pHalData->CCK_index); + dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); + } + if(priv->OFDM_index != tmpOFDMindex) + { + priv->OFDM_index = tmpOFDMindex; + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, OFDMSwingTable[priv->OFDM_index]); + RT_TRACE(COMP_POWER_TRACKING, "Update OFDMSwing[%d] = 0x%x\n", + priv->OFDM_index, OFDMSwingTable[priv->OFDM_index]); + } + priv->txpower_count = 0; +} + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +extern void dm_txpower_trackingcallback(struct work_struct *work) +{ + struct delayed_work *dwork = container_of(work,struct delayed_work,work); + struct r8192_priv *priv = container_of(dwork,struct r8192_priv,txpower_tracking_wq); + struct net_device *dev = priv->ieee80211->dev; +#else +extern void dm_txpower_trackingcallback(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); +#endif + +#ifdef RTL8190P + dm_TXPowerTrackingCallback_TSSI(dev); +#else + if(priv->bDcut == TRUE) + dm_TXPowerTrackingCallback_TSSI(dev); + else + dm_TXPowerTrackingCallback_ThermalMeter(dev); +#endif +} + + +static void dm_InitializeTXPowerTracking_TSSI(struct net_device *dev) +{ + + struct r8192_priv *priv = ieee80211_priv(dev); + + //Initial the Tx BB index and mapping value + priv->txbbgain_table[0].txbb_iq_amplifygain = 12; + priv->txbbgain_table[0].txbbgain_value=0x7f8001fe; + priv->txbbgain_table[1].txbb_iq_amplifygain = 11; + priv->txbbgain_table[1].txbbgain_value=0x788001e2; + priv->txbbgain_table[2].txbb_iq_amplifygain = 10; + priv->txbbgain_table[2].txbbgain_value=0x71c001c7; + priv->txbbgain_table[3].txbb_iq_amplifygain = 9; + priv->txbbgain_table[3].txbbgain_value=0x6b8001ae; + priv->txbbgain_table[4].txbb_iq_amplifygain = 8; + priv->txbbgain_table[4].txbbgain_value=0x65400195; + priv->txbbgain_table[5].txbb_iq_amplifygain = 7; + priv->txbbgain_table[5].txbbgain_value=0x5fc0017f; + priv->txbbgain_table[6].txbb_iq_amplifygain = 6; + priv->txbbgain_table[6].txbbgain_value=0x5a400169; + priv->txbbgain_table[7].txbb_iq_amplifygain = 5; + priv->txbbgain_table[7].txbbgain_value=0x55400155; + priv->txbbgain_table[8].txbb_iq_amplifygain = 4; + priv->txbbgain_table[8].txbbgain_value=0x50800142; + priv->txbbgain_table[9].txbb_iq_amplifygain = 3; + priv->txbbgain_table[9].txbbgain_value=0x4c000130; + priv->txbbgain_table[10].txbb_iq_amplifygain = 2; + priv->txbbgain_table[10].txbbgain_value=0x47c0011f; + priv->txbbgain_table[11].txbb_iq_amplifygain = 1; + priv->txbbgain_table[11].txbbgain_value=0x43c0010f; + priv->txbbgain_table[12].txbb_iq_amplifygain = 0; + priv->txbbgain_table[12].txbbgain_value=0x40000100; + priv->txbbgain_table[13].txbb_iq_amplifygain = -1; + priv->txbbgain_table[13].txbbgain_value=0x3c8000f2; + priv->txbbgain_table[14].txbb_iq_amplifygain = -2; + priv->txbbgain_table[14].txbbgain_value=0x390000e4; + priv->txbbgain_table[15].txbb_iq_amplifygain = -3; + priv->txbbgain_table[15].txbbgain_value=0x35c000d7; + priv->txbbgain_table[16].txbb_iq_amplifygain = -4; + priv->txbbgain_table[16].txbbgain_value=0x32c000cb; + priv->txbbgain_table[17].txbb_iq_amplifygain = -5; + priv->txbbgain_table[17].txbbgain_value=0x300000c0; + priv->txbbgain_table[18].txbb_iq_amplifygain = -6; + priv->txbbgain_table[18].txbbgain_value=0x2d4000b5; + priv->txbbgain_table[19].txbb_iq_amplifygain = -7; + priv->txbbgain_table[19].txbbgain_value=0x2ac000ab; + priv->txbbgain_table[20].txbb_iq_amplifygain = -8; + priv->txbbgain_table[20].txbbgain_value=0x288000a2; + priv->txbbgain_table[21].txbb_iq_amplifygain = -9; + priv->txbbgain_table[21].txbbgain_value=0x26000098; + priv->txbbgain_table[22].txbb_iq_amplifygain = -10; + priv->txbbgain_table[22].txbbgain_value=0x24000090; + priv->txbbgain_table[23].txbb_iq_amplifygain = -11; + priv->txbbgain_table[23].txbbgain_value=0x22000088; + priv->txbbgain_table[24].txbb_iq_amplifygain = -12; + priv->txbbgain_table[24].txbbgain_value=0x20000080; + priv->txbbgain_table[25].txbb_iq_amplifygain = -13; + priv->txbbgain_table[25].txbbgain_value=0x1a00006c; + priv->txbbgain_table[26].txbb_iq_amplifygain = -14; + priv->txbbgain_table[26].txbbgain_value=0x1c800072; + priv->txbbgain_table[27].txbb_iq_amplifygain = -15; + priv->txbbgain_table[27].txbbgain_value=0x18000060; + priv->txbbgain_table[28].txbb_iq_amplifygain = -16; + priv->txbbgain_table[28].txbbgain_value=0x19800066; + priv->txbbgain_table[29].txbb_iq_amplifygain = -17; + priv->txbbgain_table[29].txbbgain_value=0x15800056; + priv->txbbgain_table[30].txbb_iq_amplifygain = -18; + priv->txbbgain_table[30].txbbgain_value=0x26c0005b; + priv->txbbgain_table[31].txbb_iq_amplifygain = -19; + priv->txbbgain_table[31].txbbgain_value=0x14400051; + priv->txbbgain_table[32].txbb_iq_amplifygain = -20; + priv->txbbgain_table[32].txbbgain_value=0x24400051; + priv->txbbgain_table[33].txbb_iq_amplifygain = -21; + priv->txbbgain_table[33].txbbgain_value=0x1300004c; + priv->txbbgain_table[34].txbb_iq_amplifygain = -22; + priv->txbbgain_table[34].txbbgain_value=0x12000048; + priv->txbbgain_table[35].txbb_iq_amplifygain = -23; + priv->txbbgain_table[35].txbbgain_value=0x11000044; + priv->txbbgain_table[36].txbb_iq_amplifygain = -24; + priv->txbbgain_table[36].txbbgain_value=0x10000040; + + //ccktxbb_valuearray[0] is 0xA22 [1] is 0xA24 ...[7] is 0xA29 + //This Table is for CH1~CH13 + priv->cck_txbbgain_table[0].ccktxbb_valuearray[0] = 0x36; + priv->cck_txbbgain_table[0].ccktxbb_valuearray[1] = 0x35; + priv->cck_txbbgain_table[0].ccktxbb_valuearray[2] = 0x2e; + priv->cck_txbbgain_table[0].ccktxbb_valuearray[3] = 0x25; + priv->cck_txbbgain_table[0].ccktxbb_valuearray[4] = 0x1c; + priv->cck_txbbgain_table[0].ccktxbb_valuearray[5] = 0x12; + priv->cck_txbbgain_table[0].ccktxbb_valuearray[6] = 0x09; + priv->cck_txbbgain_table[0].ccktxbb_valuearray[7] = 0x04; + + priv->cck_txbbgain_table[1].ccktxbb_valuearray[0] = 0x33; + priv->cck_txbbgain_table[1].ccktxbb_valuearray[1] = 0x32; + priv->cck_txbbgain_table[1].ccktxbb_valuearray[2] = 0x2b; + priv->cck_txbbgain_table[1].ccktxbb_valuearray[3] = 0x23; + priv->cck_txbbgain_table[1].ccktxbb_valuearray[4] = 0x1a; + priv->cck_txbbgain_table[1].ccktxbb_valuearray[5] = 0x11; + priv->cck_txbbgain_table[1].ccktxbb_valuearray[6] = 0x08; + priv->cck_txbbgain_table[1].ccktxbb_valuearray[7] = 0x04; + + priv->cck_txbbgain_table[2].ccktxbb_valuearray[0] = 0x30; + priv->cck_txbbgain_table[2].ccktxbb_valuearray[1] = 0x2f; + priv->cck_txbbgain_table[2].ccktxbb_valuearray[2] = 0x29; + priv->cck_txbbgain_table[2].ccktxbb_valuearray[3] = 0x21; + priv->cck_txbbgain_table[2].ccktxbb_valuearray[4] = 0x19; + priv->cck_txbbgain_table[2].ccktxbb_valuearray[5] = 0x10; + priv->cck_txbbgain_table[2].ccktxbb_valuearray[6] = 0x08; + priv->cck_txbbgain_table[2].ccktxbb_valuearray[7] = 0x03; + + priv->cck_txbbgain_table[3].ccktxbb_valuearray[0] = 0x2d; + priv->cck_txbbgain_table[3].ccktxbb_valuearray[1] = 0x2d; + priv->cck_txbbgain_table[3].ccktxbb_valuearray[2] = 0x27; + priv->cck_txbbgain_table[3].ccktxbb_valuearray[3] = 0x1f; + priv->cck_txbbgain_table[3].ccktxbb_valuearray[4] = 0x18; + priv->cck_txbbgain_table[3].ccktxbb_valuearray[5] = 0x0f; + priv->cck_txbbgain_table[3].ccktxbb_valuearray[6] = 0x08; + priv->cck_txbbgain_table[3].ccktxbb_valuearray[7] = 0x03; + + priv->cck_txbbgain_table[4].ccktxbb_valuearray[0] = 0x2b; + priv->cck_txbbgain_table[4].ccktxbb_valuearray[1] = 0x2a; + priv->cck_txbbgain_table[4].ccktxbb_valuearray[2] = 0x25; + priv->cck_txbbgain_table[4].ccktxbb_valuearray[3] = 0x1e; + priv->cck_txbbgain_table[4].ccktxbb_valuearray[4] = 0x16; + priv->cck_txbbgain_table[4].ccktxbb_valuearray[5] = 0x0e; + priv->cck_txbbgain_table[4].ccktxbb_valuearray[6] = 0x07; + priv->cck_txbbgain_table[4].ccktxbb_valuearray[7] = 0x03; + + priv->cck_txbbgain_table[5].ccktxbb_valuearray[0] = 0x28; + priv->cck_txbbgain_table[5].ccktxbb_valuearray[1] = 0x28; + priv->cck_txbbgain_table[5].ccktxbb_valuearray[2] = 0x22; + priv->cck_txbbgain_table[5].ccktxbb_valuearray[3] = 0x1c; + priv->cck_txbbgain_table[5].ccktxbb_valuearray[4] = 0x15; + priv->cck_txbbgain_table[5].ccktxbb_valuearray[5] = 0x0d; + priv->cck_txbbgain_table[5].ccktxbb_valuearray[6] = 0x07; + priv->cck_txbbgain_table[5].ccktxbb_valuearray[7] = 0x03; + + priv->cck_txbbgain_table[6].ccktxbb_valuearray[0] = 0x26; + priv->cck_txbbgain_table[6].ccktxbb_valuearray[1] = 0x25; + priv->cck_txbbgain_table[6].ccktxbb_valuearray[2] = 0x21; + priv->cck_txbbgain_table[6].ccktxbb_valuearray[3] = 0x1b; + priv->cck_txbbgain_table[6].ccktxbb_valuearray[4] = 0x14; + priv->cck_txbbgain_table[6].ccktxbb_valuearray[5] = 0x0d; + priv->cck_txbbgain_table[6].ccktxbb_valuearray[6] = 0x06; + priv->cck_txbbgain_table[6].ccktxbb_valuearray[7] = 0x03; + + priv->cck_txbbgain_table[7].ccktxbb_valuearray[0] = 0x24; + priv->cck_txbbgain_table[7].ccktxbb_valuearray[1] = 0x23; + priv->cck_txbbgain_table[7].ccktxbb_valuearray[2] = 0x1f; + priv->cck_txbbgain_table[7].ccktxbb_valuearray[3] = 0x19; + priv->cck_txbbgain_table[7].ccktxbb_valuearray[4] = 0x13; + priv->cck_txbbgain_table[7].ccktxbb_valuearray[5] = 0x0c; + priv->cck_txbbgain_table[7].ccktxbb_valuearray[6] = 0x06; + priv->cck_txbbgain_table[7].ccktxbb_valuearray[7] = 0x03; + + priv->cck_txbbgain_table[8].ccktxbb_valuearray[0] = 0x22; + priv->cck_txbbgain_table[8].ccktxbb_valuearray[1] = 0x21; + priv->cck_txbbgain_table[8].ccktxbb_valuearray[2] = 0x1d; + priv->cck_txbbgain_table[8].ccktxbb_valuearray[3] = 0x18; + priv->cck_txbbgain_table[8].ccktxbb_valuearray[4] = 0x11; + priv->cck_txbbgain_table[8].ccktxbb_valuearray[5] = 0x0b; + priv->cck_txbbgain_table[8].ccktxbb_valuearray[6] = 0x06; + priv->cck_txbbgain_table[8].ccktxbb_valuearray[7] = 0x02; + + priv->cck_txbbgain_table[9].ccktxbb_valuearray[0] = 0x20; + priv->cck_txbbgain_table[9].ccktxbb_valuearray[1] = 0x20; + priv->cck_txbbgain_table[9].ccktxbb_valuearray[2] = 0x1b; + priv->cck_txbbgain_table[9].ccktxbb_valuearray[3] = 0x16; + priv->cck_txbbgain_table[9].ccktxbb_valuearray[4] = 0x11; + priv->cck_txbbgain_table[9].ccktxbb_valuearray[5] = 0x08; + priv->cck_txbbgain_table[9].ccktxbb_valuearray[6] = 0x05; + priv->cck_txbbgain_table[9].ccktxbb_valuearray[7] = 0x02; + + priv->cck_txbbgain_table[10].ccktxbb_valuearray[0] = 0x1f; + priv->cck_txbbgain_table[10].ccktxbb_valuearray[1] = 0x1e; + priv->cck_txbbgain_table[10].ccktxbb_valuearray[2] = 0x1a; + priv->cck_txbbgain_table[10].ccktxbb_valuearray[3] = 0x15; + priv->cck_txbbgain_table[10].ccktxbb_valuearray[4] = 0x10; + priv->cck_txbbgain_table[10].ccktxbb_valuearray[5] = 0x0a; + priv->cck_txbbgain_table[10].ccktxbb_valuearray[6] = 0x05; + priv->cck_txbbgain_table[10].ccktxbb_valuearray[7] = 0x02; + + priv->cck_txbbgain_table[11].ccktxbb_valuearray[0] = 0x1d; + priv->cck_txbbgain_table[11].ccktxbb_valuearray[1] = 0x1c; + priv->cck_txbbgain_table[11].ccktxbb_valuearray[2] = 0x18; + priv->cck_txbbgain_table[11].ccktxbb_valuearray[3] = 0x14; + priv->cck_txbbgain_table[11].ccktxbb_valuearray[4] = 0x0f; + priv->cck_txbbgain_table[11].ccktxbb_valuearray[5] = 0x0a; + priv->cck_txbbgain_table[11].ccktxbb_valuearray[6] = 0x05; + priv->cck_txbbgain_table[11].ccktxbb_valuearray[7] = 0x02; + + priv->cck_txbbgain_table[12].ccktxbb_valuearray[0] = 0x1b; + priv->cck_txbbgain_table[12].ccktxbb_valuearray[1] = 0x1a; + priv->cck_txbbgain_table[12].ccktxbb_valuearray[2] = 0x17; + priv->cck_txbbgain_table[12].ccktxbb_valuearray[3] = 0x13; + priv->cck_txbbgain_table[12].ccktxbb_valuearray[4] = 0x0e; + priv->cck_txbbgain_table[12].ccktxbb_valuearray[5] = 0x09; + priv->cck_txbbgain_table[12].ccktxbb_valuearray[6] = 0x04; + priv->cck_txbbgain_table[12].ccktxbb_valuearray[7] = 0x02; + + priv->cck_txbbgain_table[13].ccktxbb_valuearray[0] = 0x1a; + priv->cck_txbbgain_table[13].ccktxbb_valuearray[1] = 0x19; + priv->cck_txbbgain_table[13].ccktxbb_valuearray[2] = 0x16; + priv->cck_txbbgain_table[13].ccktxbb_valuearray[3] = 0x12; + priv->cck_txbbgain_table[13].ccktxbb_valuearray[4] = 0x0d; + priv->cck_txbbgain_table[13].ccktxbb_valuearray[5] = 0x09; + priv->cck_txbbgain_table[13].ccktxbb_valuearray[6] = 0x04; + priv->cck_txbbgain_table[13].ccktxbb_valuearray[7] = 0x02; + + priv->cck_txbbgain_table[14].ccktxbb_valuearray[0] = 0x18; + priv->cck_txbbgain_table[14].ccktxbb_valuearray[1] = 0x17; + priv->cck_txbbgain_table[14].ccktxbb_valuearray[2] = 0x15; + priv->cck_txbbgain_table[14].ccktxbb_valuearray[3] = 0x11; + priv->cck_txbbgain_table[14].ccktxbb_valuearray[4] = 0x0c; + priv->cck_txbbgain_table[14].ccktxbb_valuearray[5] = 0x08; + priv->cck_txbbgain_table[14].ccktxbb_valuearray[6] = 0x04; + priv->cck_txbbgain_table[14].ccktxbb_valuearray[7] = 0x02; + + priv->cck_txbbgain_table[15].ccktxbb_valuearray[0] = 0x17; + priv->cck_txbbgain_table[15].ccktxbb_valuearray[1] = 0x16; + priv->cck_txbbgain_table[15].ccktxbb_valuearray[2] = 0x13; + priv->cck_txbbgain_table[15].ccktxbb_valuearray[3] = 0x10; + priv->cck_txbbgain_table[15].ccktxbb_valuearray[4] = 0x0c; + priv->cck_txbbgain_table[15].ccktxbb_valuearray[5] = 0x08; + priv->cck_txbbgain_table[15].ccktxbb_valuearray[6] = 0x04; + priv->cck_txbbgain_table[15].ccktxbb_valuearray[7] = 0x02; + + priv->cck_txbbgain_table[16].ccktxbb_valuearray[0] = 0x16; + priv->cck_txbbgain_table[16].ccktxbb_valuearray[1] = 0x15; + priv->cck_txbbgain_table[16].ccktxbb_valuearray[2] = 0x12; + priv->cck_txbbgain_table[16].ccktxbb_valuearray[3] = 0x0f; + priv->cck_txbbgain_table[16].ccktxbb_valuearray[4] = 0x0b; + priv->cck_txbbgain_table[16].ccktxbb_valuearray[5] = 0x07; + priv->cck_txbbgain_table[16].ccktxbb_valuearray[6] = 0x04; + priv->cck_txbbgain_table[16].ccktxbb_valuearray[7] = 0x01; + + priv->cck_txbbgain_table[17].ccktxbb_valuearray[0] = 0x14; + priv->cck_txbbgain_table[17].ccktxbb_valuearray[1] = 0x14; + priv->cck_txbbgain_table[17].ccktxbb_valuearray[2] = 0x11; + priv->cck_txbbgain_table[17].ccktxbb_valuearray[3] = 0x0e; + priv->cck_txbbgain_table[17].ccktxbb_valuearray[4] = 0x0b; + priv->cck_txbbgain_table[17].ccktxbb_valuearray[5] = 0x07; + priv->cck_txbbgain_table[17].ccktxbb_valuearray[6] = 0x03; + priv->cck_txbbgain_table[17].ccktxbb_valuearray[7] = 0x02; + + priv->cck_txbbgain_table[18].ccktxbb_valuearray[0] = 0x13; + priv->cck_txbbgain_table[18].ccktxbb_valuearray[1] = 0x13; + priv->cck_txbbgain_table[18].ccktxbb_valuearray[2] = 0x10; + priv->cck_txbbgain_table[18].ccktxbb_valuearray[3] = 0x0d; + priv->cck_txbbgain_table[18].ccktxbb_valuearray[4] = 0x0a; + priv->cck_txbbgain_table[18].ccktxbb_valuearray[5] = 0x06; + priv->cck_txbbgain_table[18].ccktxbb_valuearray[6] = 0x03; + priv->cck_txbbgain_table[18].ccktxbb_valuearray[7] = 0x01; + + priv->cck_txbbgain_table[19].ccktxbb_valuearray[0] = 0x12; + priv->cck_txbbgain_table[19].ccktxbb_valuearray[1] = 0x12; + priv->cck_txbbgain_table[19].ccktxbb_valuearray[2] = 0x0f; + priv->cck_txbbgain_table[19].ccktxbb_valuearray[3] = 0x0c; + priv->cck_txbbgain_table[19].ccktxbb_valuearray[4] = 0x09; + priv->cck_txbbgain_table[19].ccktxbb_valuearray[5] = 0x06; + priv->cck_txbbgain_table[19].ccktxbb_valuearray[6] = 0x03; + priv->cck_txbbgain_table[19].ccktxbb_valuearray[7] = 0x01; + + priv->cck_txbbgain_table[20].ccktxbb_valuearray[0] = 0x11; + priv->cck_txbbgain_table[20].ccktxbb_valuearray[1] = 0x11; + priv->cck_txbbgain_table[20].ccktxbb_valuearray[2] = 0x0f; + priv->cck_txbbgain_table[20].ccktxbb_valuearray[3] = 0x0c; + priv->cck_txbbgain_table[20].ccktxbb_valuearray[4] = 0x09; + priv->cck_txbbgain_table[20].ccktxbb_valuearray[5] = 0x06; + priv->cck_txbbgain_table[20].ccktxbb_valuearray[6] = 0x03; + priv->cck_txbbgain_table[20].ccktxbb_valuearray[7] = 0x01; + + priv->cck_txbbgain_table[21].ccktxbb_valuearray[0] = 0x10; + priv->cck_txbbgain_table[21].ccktxbb_valuearray[1] = 0x10; + priv->cck_txbbgain_table[21].ccktxbb_valuearray[2] = 0x0e; + priv->cck_txbbgain_table[21].ccktxbb_valuearray[3] = 0x0b; + priv->cck_txbbgain_table[21].ccktxbb_valuearray[4] = 0x08; + priv->cck_txbbgain_table[21].ccktxbb_valuearray[5] = 0x05; + priv->cck_txbbgain_table[21].ccktxbb_valuearray[6] = 0x03; + priv->cck_txbbgain_table[21].ccktxbb_valuearray[7] = 0x01; + + priv->cck_txbbgain_table[22].ccktxbb_valuearray[0] = 0x0f; + priv->cck_txbbgain_table[22].ccktxbb_valuearray[1] = 0x0f; + priv->cck_txbbgain_table[22].ccktxbb_valuearray[2] = 0x0d; + priv->cck_txbbgain_table[22].ccktxbb_valuearray[3] = 0x0b; + priv->cck_txbbgain_table[22].ccktxbb_valuearray[4] = 0x08; + priv->cck_txbbgain_table[22].ccktxbb_valuearray[5] = 0x05; + priv->cck_txbbgain_table[22].ccktxbb_valuearray[6] = 0x03; + priv->cck_txbbgain_table[22].ccktxbb_valuearray[7] = 0x01; + + //ccktxbb_valuearray[0] is 0xA22 [1] is 0xA24 ...[7] is 0xA29 + //This Table is for CH14 + priv->cck_txbbgain_ch14_table[0].ccktxbb_valuearray[0] = 0x36; + priv->cck_txbbgain_ch14_table[0].ccktxbb_valuearray[1] = 0x35; + priv->cck_txbbgain_ch14_table[0].ccktxbb_valuearray[2] = 0x2e; + priv->cck_txbbgain_ch14_table[0].ccktxbb_valuearray[3] = 0x1b; + priv->cck_txbbgain_ch14_table[0].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[0].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[0].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[0].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[1].ccktxbb_valuearray[0] = 0x33; + priv->cck_txbbgain_ch14_table[1].ccktxbb_valuearray[1] = 0x32; + priv->cck_txbbgain_ch14_table[1].ccktxbb_valuearray[2] = 0x2b; + priv->cck_txbbgain_ch14_table[1].ccktxbb_valuearray[3] = 0x19; + priv->cck_txbbgain_ch14_table[1].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[1].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[1].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[1].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[2].ccktxbb_valuearray[0] = 0x30; + priv->cck_txbbgain_ch14_table[2].ccktxbb_valuearray[1] = 0x2f; + priv->cck_txbbgain_ch14_table[2].ccktxbb_valuearray[2] = 0x29; + priv->cck_txbbgain_ch14_table[2].ccktxbb_valuearray[3] = 0x18; + priv->cck_txbbgain_ch14_table[2].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[2].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[2].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[2].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[3].ccktxbb_valuearray[0] = 0x2d; + priv->cck_txbbgain_ch14_table[3].ccktxbb_valuearray[1] = 0x2d; + priv->cck_txbbgain_ch14_table[3].ccktxbb_valuearray[2] = 0x27; + priv->cck_txbbgain_ch14_table[3].ccktxbb_valuearray[3] = 0x17; + priv->cck_txbbgain_ch14_table[3].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[3].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[3].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[3].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[4].ccktxbb_valuearray[0] = 0x2b; + priv->cck_txbbgain_ch14_table[4].ccktxbb_valuearray[1] = 0x2a; + priv->cck_txbbgain_ch14_table[4].ccktxbb_valuearray[2] = 0x25; + priv->cck_txbbgain_ch14_table[4].ccktxbb_valuearray[3] = 0x15; + priv->cck_txbbgain_ch14_table[4].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[4].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[4].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[4].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[5].ccktxbb_valuearray[0] = 0x28; + priv->cck_txbbgain_ch14_table[5].ccktxbb_valuearray[1] = 0x28; + priv->cck_txbbgain_ch14_table[5].ccktxbb_valuearray[2] = 0x22; + priv->cck_txbbgain_ch14_table[5].ccktxbb_valuearray[3] = 0x14; + priv->cck_txbbgain_ch14_table[5].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[5].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[5].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[5].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[6].ccktxbb_valuearray[0] = 0x26; + priv->cck_txbbgain_ch14_table[6].ccktxbb_valuearray[1] = 0x25; + priv->cck_txbbgain_ch14_table[6].ccktxbb_valuearray[2] = 0x21; + priv->cck_txbbgain_ch14_table[6].ccktxbb_valuearray[3] = 0x13; + priv->cck_txbbgain_ch14_table[6].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[6].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[6].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[6].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[7].ccktxbb_valuearray[0] = 0x24; + priv->cck_txbbgain_ch14_table[7].ccktxbb_valuearray[1] = 0x23; + priv->cck_txbbgain_ch14_table[7].ccktxbb_valuearray[2] = 0x1f; + priv->cck_txbbgain_ch14_table[7].ccktxbb_valuearray[3] = 0x12; + priv->cck_txbbgain_ch14_table[7].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[7].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[7].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[7].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[8].ccktxbb_valuearray[0] = 0x22; + priv->cck_txbbgain_ch14_table[8].ccktxbb_valuearray[1] = 0x21; + priv->cck_txbbgain_ch14_table[8].ccktxbb_valuearray[2] = 0x1d; + priv->cck_txbbgain_ch14_table[8].ccktxbb_valuearray[3] = 0x11; + priv->cck_txbbgain_ch14_table[8].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[8].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[8].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[8].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[9].ccktxbb_valuearray[0] = 0x20; + priv->cck_txbbgain_ch14_table[9].ccktxbb_valuearray[1] = 0x20; + priv->cck_txbbgain_ch14_table[9].ccktxbb_valuearray[2] = 0x1b; + priv->cck_txbbgain_ch14_table[9].ccktxbb_valuearray[3] = 0x10; + priv->cck_txbbgain_ch14_table[9].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[9].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[9].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[9].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[10].ccktxbb_valuearray[0] = 0x1f; + priv->cck_txbbgain_ch14_table[10].ccktxbb_valuearray[1] = 0x1e; + priv->cck_txbbgain_ch14_table[10].ccktxbb_valuearray[2] = 0x1a; + priv->cck_txbbgain_ch14_table[10].ccktxbb_valuearray[3] = 0x0f; + priv->cck_txbbgain_ch14_table[10].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[10].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[10].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[10].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[11].ccktxbb_valuearray[0] = 0x1d; + priv->cck_txbbgain_ch14_table[11].ccktxbb_valuearray[1] = 0x1c; + priv->cck_txbbgain_ch14_table[11].ccktxbb_valuearray[2] = 0x18; + priv->cck_txbbgain_ch14_table[11].ccktxbb_valuearray[3] = 0x0e; + priv->cck_txbbgain_ch14_table[11].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[11].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[11].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[11].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[12].ccktxbb_valuearray[0] = 0x1b; + priv->cck_txbbgain_ch14_table[12].ccktxbb_valuearray[1] = 0x1a; + priv->cck_txbbgain_ch14_table[12].ccktxbb_valuearray[2] = 0x17; + priv->cck_txbbgain_ch14_table[12].ccktxbb_valuearray[3] = 0x0e; + priv->cck_txbbgain_ch14_table[12].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[12].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[12].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[12].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[13].ccktxbb_valuearray[0] = 0x1a; + priv->cck_txbbgain_ch14_table[13].ccktxbb_valuearray[1] = 0x19; + priv->cck_txbbgain_ch14_table[13].ccktxbb_valuearray[2] = 0x16; + priv->cck_txbbgain_ch14_table[13].ccktxbb_valuearray[3] = 0x0d; + priv->cck_txbbgain_ch14_table[13].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[13].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[13].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[13].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[14].ccktxbb_valuearray[0] = 0x18; + priv->cck_txbbgain_ch14_table[14].ccktxbb_valuearray[1] = 0x17; + priv->cck_txbbgain_ch14_table[14].ccktxbb_valuearray[2] = 0x15; + priv->cck_txbbgain_ch14_table[14].ccktxbb_valuearray[3] = 0x0c; + priv->cck_txbbgain_ch14_table[14].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[14].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[14].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[14].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[15].ccktxbb_valuearray[0] = 0x17; + priv->cck_txbbgain_ch14_table[15].ccktxbb_valuearray[1] = 0x16; + priv->cck_txbbgain_ch14_table[15].ccktxbb_valuearray[2] = 0x13; + priv->cck_txbbgain_ch14_table[15].ccktxbb_valuearray[3] = 0x0b; + priv->cck_txbbgain_ch14_table[15].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[15].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[15].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[15].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[16].ccktxbb_valuearray[0] = 0x16; + priv->cck_txbbgain_ch14_table[16].ccktxbb_valuearray[1] = 0x15; + priv->cck_txbbgain_ch14_table[16].ccktxbb_valuearray[2] = 0x12; + priv->cck_txbbgain_ch14_table[16].ccktxbb_valuearray[3] = 0x0b; + priv->cck_txbbgain_ch14_table[16].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[16].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[16].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[16].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[17].ccktxbb_valuearray[0] = 0x14; + priv->cck_txbbgain_ch14_table[17].ccktxbb_valuearray[1] = 0x14; + priv->cck_txbbgain_ch14_table[17].ccktxbb_valuearray[2] = 0x11; + priv->cck_txbbgain_ch14_table[17].ccktxbb_valuearray[3] = 0x0a; + priv->cck_txbbgain_ch14_table[17].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[17].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[17].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[17].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[18].ccktxbb_valuearray[0] = 0x13; + priv->cck_txbbgain_ch14_table[18].ccktxbb_valuearray[1] = 0x13; + priv->cck_txbbgain_ch14_table[18].ccktxbb_valuearray[2] = 0x10; + priv->cck_txbbgain_ch14_table[18].ccktxbb_valuearray[3] = 0x0a; + priv->cck_txbbgain_ch14_table[18].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[18].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[18].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[18].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[19].ccktxbb_valuearray[0] = 0x12; + priv->cck_txbbgain_ch14_table[19].ccktxbb_valuearray[1] = 0x12; + priv->cck_txbbgain_ch14_table[19].ccktxbb_valuearray[2] = 0x0f; + priv->cck_txbbgain_ch14_table[19].ccktxbb_valuearray[3] = 0x09; + priv->cck_txbbgain_ch14_table[19].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[19].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[19].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[19].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[20].ccktxbb_valuearray[0] = 0x11; + priv->cck_txbbgain_ch14_table[20].ccktxbb_valuearray[1] = 0x11; + priv->cck_txbbgain_ch14_table[20].ccktxbb_valuearray[2] = 0x0f; + priv->cck_txbbgain_ch14_table[20].ccktxbb_valuearray[3] = 0x09; + priv->cck_txbbgain_ch14_table[20].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[20].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[20].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[20].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[21].ccktxbb_valuearray[0] = 0x10; + priv->cck_txbbgain_ch14_table[21].ccktxbb_valuearray[1] = 0x10; + priv->cck_txbbgain_ch14_table[21].ccktxbb_valuearray[2] = 0x0e; + priv->cck_txbbgain_ch14_table[21].ccktxbb_valuearray[3] = 0x08; + priv->cck_txbbgain_ch14_table[21].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[21].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[21].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[21].ccktxbb_valuearray[7] = 0x00; + + priv->cck_txbbgain_ch14_table[22].ccktxbb_valuearray[0] = 0x0f; + priv->cck_txbbgain_ch14_table[22].ccktxbb_valuearray[1] = 0x0f; + priv->cck_txbbgain_ch14_table[22].ccktxbb_valuearray[2] = 0x0d; + priv->cck_txbbgain_ch14_table[22].ccktxbb_valuearray[3] = 0x08; + priv->cck_txbbgain_ch14_table[22].ccktxbb_valuearray[4] = 0x00; + priv->cck_txbbgain_ch14_table[22].ccktxbb_valuearray[5] = 0x00; + priv->cck_txbbgain_ch14_table[22].ccktxbb_valuearray[6] = 0x00; + priv->cck_txbbgain_ch14_table[22].ccktxbb_valuearray[7] = 0x00; + + priv->btxpower_tracking = TRUE; + priv->txpower_count = 0; + priv->btxpower_trackingInit = FALSE; + +} + +static void dm_InitializeTXPowerTracking_ThermalMeter(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + // Tx Power tracking by Theremal Meter require Firmware R/W 3-wire. This mechanism + // can be enabled only when Firmware R/W 3-wire is enabled. Otherwise, frequent r/w + // 3-wire by driver cause RF goes into wrong state. + if(priv->ieee80211->FwRWRF) + priv->btxpower_tracking = TRUE; + else + priv->btxpower_tracking = FALSE; + priv->txpower_count = 0; + priv->btxpower_trackingInit = FALSE; +} + + +void dm_initialize_txpower_tracking(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); +#ifdef RTL8190P + dm_InitializeTXPowerTracking_TSSI(dev); +#else + if(priv->bDcut == TRUE) + dm_InitializeTXPowerTracking_TSSI(dev); + else + dm_InitializeTXPowerTracking_ThermalMeter(dev); +#endif +}// dm_InitializeTXPowerTracking + + +static void dm_CheckTXPowerTracking_TSSI(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + static u32 tx_power_track_counter = 0; + + if(!priv->btxpower_tracking) + return; + else + { + if((tx_power_track_counter % 30 == 0)&&(tx_power_track_counter != 0)) + { + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) + queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0); + #else + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + schedule_task(&priv->txpower_tracking_wq); + #else + queue_work(priv->priv_wq,&priv->txpower_tracking_wq); + #endif + #endif + } + tx_power_track_counter++; + } + +} + + +static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + static u8 TM_Trigger=0; +#if 0 + u1Byte i; + u4Byte tmpRegA; + for(i=0; i<50; i++) + { + tmpRegA = PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x12, 0x078); // 0x12: RF Reg[10:7] + PHY_SetRFReg(Adapter, RF90_PATH_A, 0x02, bMask12Bits, 0x4d); + //delay_us(100); + PHY_SetRFReg(Adapter, RF90_PATH_A, 0x02, bMask12Bits, 0x4f); + //delay_us(100); + } + DbgPrint("Trigger and readback ThermalMeter, write RF reg0x2 = 0x4d to 0x4f for 50 times\n"); +#else + //DbgPrint("dm_CheckTXPowerTracking() \n"); + if(!priv->btxpower_tracking) + return; + else + { + if(priv->txpower_count <= 2) + { + priv->txpower_count++; + return; + } + } + + if(!TM_Trigger) + { + //Attention!! You have to wirte all 12bits data to RF, or it may cause RF to crash + //actually write reg0x02 bit1=0, then bit1=1. + //DbgPrint("Trigger ThermalMeter, write RF reg0x2 = 0x4d to 0x4f\n"); + rtl8192_phy_SetRFReg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d); + rtl8192_phy_SetRFReg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f); + rtl8192_phy_SetRFReg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d); + rtl8192_phy_SetRFReg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f); + TM_Trigger = 1; + return; + } + else + { + //DbgPrint("Schedule TxPowerTrackingWorkItem\n"); + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) + queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0); + #else + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + schedule_task(&priv->txpower_tracking_wq); + #else + queue_work(priv->priv_wq,&priv->txpower_tracking_wq); + #endif + #endif + TM_Trigger = 0; + } +#endif +} + + +static void dm_check_txpower_tracking(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + //static u32 tx_power_track_counter = 0; + +#ifdef RTL8190P + dm_CheckTXPowerTracking_TSSI(dev); +#else + if(priv->bDcut == TRUE) + dm_CheckTXPowerTracking_TSSI(dev); + else + dm_CheckTXPowerTracking_ThermalMeter(dev); +#endif + +} // dm_CheckTXPowerTracking + + +static void dm_CCKTxPowerAdjust_TSSI(struct net_device *dev, bool bInCH14) +{ + u32 TempVal; + struct r8192_priv *priv = ieee80211_priv(dev); + //Write 0xa22 0xa23 + TempVal = 0; + if(!bInCH14){ + //Write 0xa22 0xa23 + TempVal = priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[0] + + (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[1]<<8) ; + + rtl8192_setBBreg(dev, rCCK0_TxFilter1,bMaskHWord, TempVal); + //Write 0xa24 ~ 0xa27 + TempVal = 0; + TempVal = priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[2] + + (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[3]<<8) + + (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[4]<<16 )+ + (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[5]<<24); + rtl8192_setBBreg(dev, rCCK0_TxFilter2,bMaskDWord, TempVal); + //Write 0xa28 0xa29 + TempVal = 0; + TempVal = priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[6] + + (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[7]<<8) ; + + rtl8192_setBBreg(dev, rCCK0_DebugPort,bMaskLWord, TempVal); + } + else + { + TempVal = priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[0] + + (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[1]<<8) ; + + rtl8192_setBBreg(dev, rCCK0_TxFilter1,bMaskHWord, TempVal); + //Write 0xa24 ~ 0xa27 + TempVal = 0; + TempVal = priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[2] + + (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[3]<<8) + + (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[4]<<16 )+ + (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[5]<<24); + rtl8192_setBBreg(dev, rCCK0_TxFilter2,bMaskDWord, TempVal); + //Write 0xa28 0xa29 + TempVal = 0; + TempVal = priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[6] + + (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[7]<<8) ; + + rtl8192_setBBreg(dev, rCCK0_DebugPort,bMaskLWord, TempVal); + } + + +} + +static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH14) +{ + u32 TempVal; + struct r8192_priv *priv = ieee80211_priv(dev); + + TempVal = 0; + if(!bInCH14) + { + //Write 0xa22 0xa23 + TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][0] + + (CCKSwingTable_Ch1_Ch13[priv->CCK_index][1]<<8) ; + rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); + RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n", + rCCK0_TxFilter1, TempVal); + //Write 0xa24 ~ 0xa27 + TempVal = 0; + TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][2] + + (CCKSwingTable_Ch1_Ch13[priv->CCK_index][3]<<8) + + (CCKSwingTable_Ch1_Ch13[priv->CCK_index][4]<<16 )+ + (CCKSwingTable_Ch1_Ch13[priv->CCK_index][5]<<24); + rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal); + RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n", + rCCK0_TxFilter2, TempVal); + //Write 0xa28 0xa29 + TempVal = 0; + TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][6] + + (CCKSwingTable_Ch1_Ch13[priv->CCK_index][7]<<8) ; + + rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); + RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n", + rCCK0_DebugPort, TempVal); + } + else + { +// priv->CCKTxPowerAdjustCntNotCh14++; //cosa add for debug. + //Write 0xa22 0xa23 + TempVal = CCKSwingTable_Ch14[priv->CCK_index][0] + + (CCKSwingTable_Ch14[priv->CCK_index][1]<<8) ; + + rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); + RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n", + rCCK0_TxFilter1, TempVal); + //Write 0xa24 ~ 0xa27 + TempVal = 0; + TempVal = CCKSwingTable_Ch14[priv->CCK_index][2] + + (CCKSwingTable_Ch14[priv->CCK_index][3]<<8) + + (CCKSwingTable_Ch14[priv->CCK_index][4]<<16 )+ + (CCKSwingTable_Ch14[priv->CCK_index][5]<<24); + rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal); + RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n", + rCCK0_TxFilter2, TempVal); + //Write 0xa28 0xa29 + TempVal = 0; + TempVal = CCKSwingTable_Ch14[priv->CCK_index][6] + + (CCKSwingTable_Ch14[priv->CCK_index][7]<<8) ; + + rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); + RT_TRACE(COMP_POWER_TRACKING,"CCK chnl 14, reg 0x%x = 0x%x\n", + rCCK0_DebugPort, TempVal); + } +} + + + +extern void dm_cck_txpower_adjust( + struct net_device *dev, + bool binch14 +) +{ // dm_CCKTxPowerAdjust + + struct r8192_priv *priv = ieee80211_priv(dev); +#ifdef RTL8190P + dm_CCKTxPowerAdjust_TSSI(dev, binch14); +#else + if(priv->bDcut == TRUE) + dm_CCKTxPowerAdjust_TSSI(dev, binch14); + else + dm_CCKTxPowerAdjust_ThermalMeter(dev, binch14); +#endif +} + + +#ifndef RTL8192U +static void dm_txpower_reset_recovery( + struct net_device *dev +) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + RT_TRACE(COMP_POWER_TRACKING, "Start Reset Recovery ==>\n"); + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfa_txpowertrackingindex].txbbgain_value); + RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: Fill in 0xc80 is %08x\n",priv->txbbgain_table[priv->rfa_txpowertrackingindex].txbbgain_value); + RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: Fill in RFA_txPowerTrackingIndex is %x\n",priv->rfa_txpowertrackingindex); + RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery : RF A I/Q Amplify Gain is %ld\n",priv->txbbgain_table[priv->rfa_txpowertrackingindex].txbb_iq_amplifygain); + RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: CCK Attenuation is %d dB\n",priv->cck_present_attentuation); + dm_cck_txpower_adjust(dev,priv->bcck_in_ch14); + + rtl8192_setBBreg(dev, rOFDM0_XCTxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfc_txpowertrackingindex].txbbgain_value); + RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: Fill in 0xc90 is %08x\n",priv->txbbgain_table[priv->rfc_txpowertrackingindex].txbbgain_value); + RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: Fill in RFC_txPowerTrackingIndex is %x\n",priv->rfc_txpowertrackingindex); + RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery : RF C I/Q Amplify Gain is %ld\n",priv->txbbgain_table[priv->rfc_txpowertrackingindex].txbb_iq_amplifygain); + +} // dm_TXPowerResetRecovery + +extern void dm_restore_dynamic_mechanism_state(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u32 reg_ratr = priv->rate_adaptive.last_ratr; + + if(!priv->up) + { + RT_TRACE(COMP_RATE, "<---- dm_restore_dynamic_mechanism_state(): driver is going to unload\n"); + return; + } + + // + // Restore previous state for rate adaptive + // + if(priv->rate_adaptive.rate_adaptive_disabled) + return; + // TODO: Only 11n mode is implemented currently, + if( !(priv->ieee80211->mode==WIRELESS_MODE_N_24G || + priv->ieee80211->mode==WIRELESS_MODE_N_5G)) + return; + { + /* 2007/11/15 MH Copy from 8190PCI. */ + u32 ratr_value; + ratr_value = reg_ratr; + if(priv->rf_type == RF_1T2R) // 1T2R, Spatial Stream 2 should be disabled + { + ratr_value &=~ (RATE_ALL_OFDM_2SS); + //DbgPrint("HW_VAR_TATR_0 from 0x%x ==> 0x%x\n", ((pu4Byte)(val))[0], ratr_value); + } + //DbgPrint("set HW_VAR_TATR_0 = 0x%x\n", ratr_value); + //cosa PlatformEFIOWrite4Byte(Adapter, RATR0, ((pu4Byte)(val))[0]); + write_nic_dword(dev, RATR0, ratr_value); + write_nic_byte(dev, UFWP, 1); +#if 0 // Disable old code. + u1Byte index; + u4Byte input_value; + index = (u1Byte)((((pu4Byte)(val))[0]) >> 28); + input_value = (((pu4Byte)(val))[0]) & 0x0fffffff; + // TODO: Correct it. Emily 2007.01.11 + PlatformEFIOWrite4Byte(Adapter, RATR0+index*4, input_value); +#endif + } + //Resore TX Power Tracking Index + if(priv->btxpower_trackingInit && priv->btxpower_tracking){ + dm_txpower_reset_recovery(dev); + } + + // + //Restore BB Initial Gain + // + dm_bb_initialgain_restore(dev); + +} // DM_RestoreDynamicMechanismState + +static void dm_bb_initialgain_restore(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u32 bit_mask = 0x7f; //Bit0~ Bit6 + + if(dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI) + return; + + //Disable Initial Gain + //PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x800); + rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); // Only clear byte 1 and rewrite. + rtl8192_setBBreg(dev, rOFDM0_XAAGCCore1, bit_mask, (u32)priv->initgain_backup.xaagccore1); + rtl8192_setBBreg(dev, rOFDM0_XBAGCCore1, bit_mask, (u32)priv->initgain_backup.xbagccore1); + rtl8192_setBBreg(dev, rOFDM0_XCAGCCore1, bit_mask, (u32)priv->initgain_backup.xcagccore1); + rtl8192_setBBreg(dev, rOFDM0_XDAGCCore1, bit_mask, (u32)priv->initgain_backup.xdagccore1); + bit_mask = bMaskByte2; + rtl8192_setBBreg(dev, rCCK0_CCA, bit_mask, (u32)priv->initgain_backup.cca); + + RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc50 is %x\n",priv->initgain_backup.xaagccore1); + RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc58 is %x\n",priv->initgain_backup.xbagccore1); + RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc60 is %x\n",priv->initgain_backup.xcagccore1); + RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc68 is %x\n",priv->initgain_backup.xdagccore1); + RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xa0a is %x\n",priv->initgain_backup.cca); + //Enable Initial Gain + //PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x100); + rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); // Only clear byte 1 and rewrite. + +} // dm_BBInitialGainRestore + + +extern void dm_backup_dynamic_mechanism_state(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + // Fsync to avoid reset + priv->bswitch_fsync = false; + priv->bfsync_processing = false; + //Backup BB InitialGain + dm_bb_initialgain_backup(dev); + +} // DM_BackupDynamicMechanismState + + +static void dm_bb_initialgain_backup(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u32 bit_mask = bMaskByte0; //Bit0~ Bit6 + + if(dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI) + return; + + //PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x800); + rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); // Only clear byte 1 and rewrite. + priv->initgain_backup.xaagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XAAGCCore1, bit_mask); + priv->initgain_backup.xbagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XBAGCCore1, bit_mask); + priv->initgain_backup.xcagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XCAGCCore1, bit_mask); + priv->initgain_backup.xdagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XDAGCCore1, bit_mask); + bit_mask = bMaskByte2; + priv->initgain_backup.cca = (u8)rtl8192_QueryBBReg(dev, rCCK0_CCA, bit_mask); + + RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc50 is %x\n",priv->initgain_backup.xaagccore1); + RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc58 is %x\n",priv->initgain_backup.xbagccore1); + RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc60 is %x\n",priv->initgain_backup.xcagccore1); + RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc68 is %x\n",priv->initgain_backup.xdagccore1); + RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xa0a is %x\n",priv->initgain_backup.cca); + +} // dm_BBInitialGainBakcup + +#endif +/*----------------------------------------------------------------------------- + * Function: dm_change_dynamic_initgain_thresh() + * + * Overview: + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/29/2008 amy Create Version 0 porting from windows code. + * + *---------------------------------------------------------------------------*/ +extern void dm_change_dynamic_initgain_thresh(struct net_device *dev, + u32 dm_type, + u32 dm_value) +{ + if (dm_type == DIG_TYPE_THRESH_HIGH) + { + dm_digtable.rssi_high_thresh = dm_value; + } + else if (dm_type == DIG_TYPE_THRESH_LOW) + { + dm_digtable.rssi_low_thresh = dm_value; + } + else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_HIGH) + { + dm_digtable.rssi_high_power_highthresh = dm_value; + } + else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_HIGH) + { + dm_digtable.rssi_high_power_highthresh = dm_value; + } + else if (dm_type == DIG_TYPE_ENABLE) + { + dm_digtable.dig_state = DM_STA_DIG_MAX; + dm_digtable.dig_enable_flag = true; + } + else if (dm_type == DIG_TYPE_DISABLE) + { + dm_digtable.dig_state = DM_STA_DIG_MAX; + dm_digtable.dig_enable_flag = false; + } + else if (dm_type == DIG_TYPE_DBG_MODE) + { + if(dm_value >= DM_DBG_MAX) + dm_value = DM_DBG_OFF; + dm_digtable.dbg_mode = (u8)dm_value; + } + else if (dm_type == DIG_TYPE_RSSI) + { + if(dm_value > 100) + dm_value = 30; + dm_digtable.rssi_val = (long)dm_value; + } + else if (dm_type == DIG_TYPE_ALGORITHM) + { + if (dm_value >= DIG_ALGO_MAX) + dm_value = DIG_ALGO_BY_FALSE_ALARM; + if(dm_digtable.dig_algorithm != (u8)dm_value) + dm_digtable.dig_algorithm_switch = 1; + dm_digtable.dig_algorithm = (u8)dm_value; + } + else if (dm_type == DIG_TYPE_BACKOFF) + { + if(dm_value > 30) + dm_value = 30; + dm_digtable.backoff_val = (u8)dm_value; + } + else if(dm_type == DIG_TYPE_RX_GAIN_MIN) + { + if(dm_value == 0) + dm_value = 0x1; + dm_digtable.rx_gain_range_min = (u8)dm_value; + } + else if(dm_type == DIG_TYPE_RX_GAIN_MAX) + { + if(dm_value > 0x50) + dm_value = 0x50; + dm_digtable.rx_gain_range_max = (u8)dm_value; + } +} /* DM_ChangeDynamicInitGainThresh */ +extern void +dm_change_fsync_setting( + struct net_device *dev, + s32 DM_Type, + s32 DM_Value) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + if (DM_Type == 0) // monitor 0xc38 register + { + if(DM_Value > 1) + DM_Value = 1; + priv->framesyncMonitor = (u8)DM_Value; + //DbgPrint("pHalData->framesyncMonitor = %d", pHalData->framesyncMonitor); + } +} + +extern void +dm_change_rxpath_selection_setting( + struct net_device *dev, + s32 DM_Type, + s32 DM_Value) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + prate_adaptive pRA = (prate_adaptive)&(priv->rate_adaptive); + + + if(DM_Type == 0) + { + if(DM_Value > 1) + DM_Value = 1; + DM_RxPathSelTable.Enable = (u8)DM_Value; + } + else if(DM_Type == 1) + { + if(DM_Value > 1) + DM_Value = 1; + DM_RxPathSelTable.DbgMode = (u8)DM_Value; + } + else if(DM_Type == 2) + { + if(DM_Value > 40) + DM_Value = 40; + DM_RxPathSelTable.SS_TH_low = (u8)DM_Value; + } + else if(DM_Type == 3) + { + if(DM_Value > 25) + DM_Value = 25; + DM_RxPathSelTable.diff_TH = (u8)DM_Value; + } + else if(DM_Type == 4) + { + if(DM_Value >= CCK_Rx_Version_MAX) + DM_Value = CCK_Rx_Version_1; + DM_RxPathSelTable.cck_method= (u8)DM_Value; + } + else if(DM_Type == 10) + { + if(DM_Value > 100) + DM_Value = 50; + DM_RxPathSelTable.rf_rssi[0] = (u8)DM_Value; + } + else if(DM_Type == 11) + { + if(DM_Value > 100) + DM_Value = 50; + DM_RxPathSelTable.rf_rssi[1] = (u8)DM_Value; + } + else if(DM_Type == 12) + { + if(DM_Value > 100) + DM_Value = 50; + DM_RxPathSelTable.rf_rssi[2] = (u8)DM_Value; + } + else if(DM_Type == 13) + { + if(DM_Value > 100) + DM_Value = 50; + DM_RxPathSelTable.rf_rssi[3] = (u8)DM_Value; + } + else if(DM_Type == 20) + { + if(DM_Value > 1) + DM_Value = 1; + pRA->ping_rssi_enable = (u8)DM_Value; + } + else if(DM_Type == 21) + { + if(DM_Value > 30) + DM_Value = 30; + pRA->ping_rssi_thresh_for_ra = DM_Value; + } +} + +#if 0 +extern void dm_force_tx_fw_info(struct net_device *dev, + u32 force_type, + u32 force_value) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + if (force_type == 0) // don't force TxSC + { + //DbgPrint("Set Force SubCarrier Off\n"); + priv->tx_fwinfo_force_subcarriermode = 0; + } + else if(force_type == 1) //force + { + //DbgPrint("Set Force SubCarrier On\n"); + priv->tx_fwinfo_force_subcarriermode = 1; + if(force_value > 3) + force_value = 3; + priv->tx_fwinfo_force_subcarrierval = (u8)force_value; + } +} +#endif + +/*----------------------------------------------------------------------------- + * Function: dm_dig_init() + * + * Overview: Set DIG scheme init value. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/15/2008 amy Create Version 0 porting from windows code. + * + *---------------------------------------------------------------------------*/ +static void dm_dig_init(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + /* 2007/10/05 MH Disable DIG scheme now. Not tested. */ + dm_digtable.dig_enable_flag = true; + dm_digtable.dig_algorithm = DIG_ALGO_BY_RSSI; + dm_digtable.dbg_mode = DM_DBG_OFF; //off=by real rssi value, on=by DM_DigTable.Rssi_val for new dig + dm_digtable.dig_algorithm_switch = 0; + + /* 2007/10/04 MH Define init gain threshol. */ + dm_digtable.dig_state = DM_STA_DIG_MAX; + dm_digtable.dig_highpwr_state = DM_STA_DIG_MAX; + dm_digtable.initialgain_lowerbound_state = false; + + dm_digtable.rssi_low_thresh = DM_DIG_THRESH_LOW; + dm_digtable.rssi_high_thresh = DM_DIG_THRESH_HIGH; + + dm_digtable.rssi_high_power_lowthresh = DM_DIG_HIGH_PWR_THRESH_LOW; + dm_digtable.rssi_high_power_highthresh = DM_DIG_HIGH_PWR_THRESH_HIGH; + + dm_digtable.rssi_val = 50; //for new dig debug rssi value + dm_digtable.backoff_val = DM_DIG_BACKOFF; + dm_digtable.rx_gain_range_max = DM_DIG_MAX; + if(priv->CustomerID == RT_CID_819x_Netcore) + dm_digtable.rx_gain_range_min = DM_DIG_MIN_Netcore; + else + dm_digtable.rx_gain_range_min = DM_DIG_MIN; + +} /* dm_dig_init */ + + +/*----------------------------------------------------------------------------- + * Function: dm_ctrl_initgain_byrssi() + * + * Overview: Driver must monitor RSSI and notify firmware to change initial + * gain according to different threshold. BB team provide the + * suggested solution. + * + * Input: struct net_device *dev + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/27/2008 amy Create Version 0 porting from windows code. + *---------------------------------------------------------------------------*/ +static void dm_ctrl_initgain_byrssi(struct net_device *dev) +{ + + if (dm_digtable.dig_enable_flag == false) + return; + + if(dm_digtable.dig_algorithm == DIG_ALGO_BY_FALSE_ALARM) + dm_ctrl_initgain_byrssi_by_fwfalse_alarm(dev); + else if(dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI) + dm_ctrl_initgain_byrssi_by_driverrssi(dev); +// ; + else + return; +} + + +static void dm_ctrl_initgain_byrssi_by_driverrssi( + struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u8 i; + static u8 fw_dig=0; + + if (dm_digtable.dig_enable_flag == false) + return; + + //DbgPrint("Dig by Sw Rssi \n"); + if(dm_digtable.dig_algorithm_switch) // if swithed algorithm, we have to disable FW Dig. + fw_dig = 0; + if(fw_dig <= 3) // execute several times to make sure the FW Dig is disabled + {// FW DIG Off + for(i=0; i<3; i++) + rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); // Only clear byte 1 and rewrite. + fw_dig++; + dm_digtable.dig_state = DM_STA_DIG_OFF; //fw dig off. + } + + if(priv->ieee80211->state == IEEE80211_LINKED) + dm_digtable.cur_connect_state = DIG_CONNECT; + else + dm_digtable.cur_connect_state = DIG_DISCONNECT; + + //DbgPrint("DM_DigTable.PreConnectState = %d, DM_DigTable.CurConnectState = %d \n", + //DM_DigTable.PreConnectState, DM_DigTable.CurConnectState); + + if(dm_digtable.dbg_mode == DM_DBG_OFF) + dm_digtable.rssi_val = priv->undecorated_smoothed_pwdb; + //DbgPrint("DM_DigTable.Rssi_val = %d \n", DM_DigTable.Rssi_val); + dm_initial_gain(dev); + dm_pd_th(dev); + dm_cs_ratio(dev); + if(dm_digtable.dig_algorithm_switch) + dm_digtable.dig_algorithm_switch = 0; + dm_digtable.pre_connect_state = dm_digtable.cur_connect_state; + +} /* dm_CtrlInitGainByRssi */ + +static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( + struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + static u32 reset_cnt = 0; + u8 i; + + if (dm_digtable.dig_enable_flag == false) + return; + + if(dm_digtable.dig_algorithm_switch) + { + dm_digtable.dig_state = DM_STA_DIG_MAX; + // Fw DIG On. + for(i=0; i<3; i++) + rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); // Only clear byte 1 and rewrite. + dm_digtable.dig_algorithm_switch = 0; + } + + if (priv->ieee80211->state != IEEE80211_LINKED) + return; + + // For smooth, we can not change DIG state. + if ((priv->undecorated_smoothed_pwdb > dm_digtable.rssi_low_thresh) && + (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_thresh)) + { + return; + } + //DbgPrint("Dig by Fw False Alarm\n"); + //if (DM_DigTable.Dig_State == DM_STA_DIG_OFF) + /*DbgPrint("DIG Check\n\r RSSI=%d LOW=%d HIGH=%d STATE=%d", + pHalData->UndecoratedSmoothedPWDB, DM_DigTable.RssiLowThresh, + DM_DigTable.RssiHighThresh, DM_DigTable.Dig_State);*/ + /* 1. When RSSI decrease, We have to judge if it is smaller than a treshold + and then execute below step. */ + if ((priv->undecorated_smoothed_pwdb <= dm_digtable.rssi_low_thresh)) + { + /* 2008/02/05 MH When we execute silent reset, the DIG PHY parameters + will be reset to init value. We must prevent the condition. */ + if (dm_digtable.dig_state == DM_STA_DIG_OFF && + (priv->reset_count == reset_cnt)) + { + return; + } + else + { + reset_cnt = priv->reset_count; + } + + // If DIG is off, DIG high power state must reset. + dm_digtable.dig_highpwr_state = DM_STA_DIG_MAX; + dm_digtable.dig_state = DM_STA_DIG_OFF; + + // 1.1 DIG Off. + rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); // Only clear byte 1 and rewrite. + + // 1.2 Set initial gain. + write_nic_byte(dev, rOFDM0_XAAGCCore1, 0x17); + write_nic_byte(dev, rOFDM0_XBAGCCore1, 0x17); + write_nic_byte(dev, rOFDM0_XCAGCCore1, 0x17); + write_nic_byte(dev, rOFDM0_XDAGCCore1, 0x17); + + // 1.3 Lower PD_TH for OFDM. + if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) + { + /* 2008/01/11 MH 40MHZ 90/92 register are not the same. */ + // 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same. + #ifdef RTL8190P + write_nic_byte(dev, rOFDM0_RxDetector1, 0x40); + #else + write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x00); + #endif + /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) + write_nic_byte(pAdapter, rOFDM0_RxDetector1, 0x40); + */ + //else if (pAdapter->HardwareType == HARDWARE_TYPE_RTL8192E) + + + //else + //PlatformEFIOWrite1Byte(pAdapter, rOFDM0_RxDetector1, 0x40); + } + else + write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); + + // 1.4 Lower CS ratio for CCK. + write_nic_byte(dev, 0xa0a, 0x08); + + // 1.5 Higher EDCCA. + //PlatformEFIOWrite4Byte(pAdapter, rOFDM0_ECCAThreshold, 0x325); + return; + + } + + /* 2. When RSSI increase, We have to judge if it is larger than a treshold + and then execute below step. */ + if ((priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh) ) + { + u8 reset_flag = 0; + + if (dm_digtable.dig_state == DM_STA_DIG_ON && + (priv->reset_count == reset_cnt)) + { + dm_ctrl_initgain_byrssi_highpwr(dev); + return; + } + else + { + if (priv->reset_count != reset_cnt) + reset_flag = 1; + + reset_cnt = priv->reset_count; + } + + dm_digtable.dig_state = DM_STA_DIG_ON; + //DbgPrint("DIG ON\n\r"); + + // 2.1 Set initial gain. + // 2008/02/26 MH SD3-Jerry suggest to prevent dirty environment. + if (reset_flag == 1) + { + write_nic_byte(dev, rOFDM0_XAAGCCore1, 0x2c); + write_nic_byte(dev, rOFDM0_XBAGCCore1, 0x2c); + write_nic_byte(dev, rOFDM0_XCAGCCore1, 0x2c); + write_nic_byte(dev, rOFDM0_XDAGCCore1, 0x2c); + } + else + { + write_nic_byte(dev, rOFDM0_XAAGCCore1, 0x20); + write_nic_byte(dev, rOFDM0_XBAGCCore1, 0x20); + write_nic_byte(dev, rOFDM0_XCAGCCore1, 0x20); + write_nic_byte(dev, rOFDM0_XDAGCCore1, 0x20); + } + + // 2.2 Higher PD_TH for OFDM. + if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) + { + /* 2008/01/11 MH 40MHZ 90/92 register are not the same. */ + // 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same. + #ifdef RTL8190P + write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); + #else + write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20); + #endif + /* + else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) + write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); + */ + //else if (pAdapter->HardwareType == HARDWARE_TYPE_RTL8192E) + + //else + //PlatformEFIOWrite1Byte(pAdapter, rOFDM0_RxDetector1, 0x42); + } + else + write_nic_byte(dev, rOFDM0_RxDetector1, 0x44); + + // 2.3 Higher CS ratio for CCK. + write_nic_byte(dev, 0xa0a, 0xcd); + + // 2.4 Lower EDCCA. + /* 2008/01/11 MH 90/92 series are the same. */ + //PlatformEFIOWrite4Byte(pAdapter, rOFDM0_ECCAThreshold, 0x346); + + // 2.5 DIG On. + rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); // Only clear byte 1 and rewrite. + + } + + dm_ctrl_initgain_byrssi_highpwr(dev); + +} /* dm_CtrlInitGainByRssi */ + + +/*----------------------------------------------------------------------------- + * Function: dm_ctrl_initgain_byrssi_highpwr() + * + * Overview: + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/28/2008 amy Create Version 0 porting from windows code. + * + *---------------------------------------------------------------------------*/ +static void dm_ctrl_initgain_byrssi_highpwr( + struct net_device * dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + static u32 reset_cnt_highpwr = 0; + + // For smooth, we can not change high power DIG state in the range. + if ((priv->undecorated_smoothed_pwdb > dm_digtable.rssi_high_power_lowthresh) && + (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_power_highthresh)) + { + return; + } + + /* 3. When RSSI >75% or <70%, it is a high power issue. We have to judge if + it is larger than a treshold and then execute below step. */ + // 2008/02/05 MH SD3-Jerry Modify PD_TH for high power issue. + if (priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_power_highthresh) + { + if (dm_digtable.dig_highpwr_state == DM_STA_DIG_ON && + (priv->reset_count == reset_cnt_highpwr)) + return; + else + dm_digtable.dig_highpwr_state = DM_STA_DIG_ON; + + // 3.1 Higher PD_TH for OFDM for high power state. + if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) + { + #ifdef RTL8190P + write_nic_byte(dev, rOFDM0_RxDetector1, 0x41); + #else + write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10); + #endif + + /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) + write_nic_byte(dev, rOFDM0_RxDetector1, 0x41); + */ + + } + else + write_nic_byte(dev, rOFDM0_RxDetector1, 0x43); + } + else + { + if (dm_digtable.dig_highpwr_state == DM_STA_DIG_OFF&& + (priv->reset_count == reset_cnt_highpwr)) + return; + else + dm_digtable.dig_highpwr_state = DM_STA_DIG_OFF; + + if (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_power_lowthresh && + priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh) + { + // 3.2 Recover PD_TH for OFDM for normal power region. + if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) + { + #ifdef RTL8190P + write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); + #else + write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20); + #endif + /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) + write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); + */ + + } + else + write_nic_byte(dev, rOFDM0_RxDetector1, 0x44); + } + } + + reset_cnt_highpwr = priv->reset_count; + +} /* dm_CtrlInitGainByRssiHighPwr */ + + +static void dm_initial_gain( + struct net_device * dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u8 initial_gain=0; + static u8 initialized=0, force_write=0; + static u32 reset_cnt=0; + + if(dm_digtable.dig_algorithm_switch) + { + initialized = 0; + reset_cnt = 0; + } + + if(dm_digtable.pre_connect_state == dm_digtable.cur_connect_state) + { + if(dm_digtable.cur_connect_state == DIG_CONNECT) + { + if((dm_digtable.rssi_val+10-dm_digtable.backoff_val) > dm_digtable.rx_gain_range_max) + dm_digtable.cur_ig_value = dm_digtable.rx_gain_range_max; + else if((dm_digtable.rssi_val+10-dm_digtable.backoff_val) < dm_digtable.rx_gain_range_min) + dm_digtable.cur_ig_value = dm_digtable.rx_gain_range_min; + else + dm_digtable.cur_ig_value = dm_digtable.rssi_val+10-dm_digtable.backoff_val; + } + else //current state is disconnected + { + if(dm_digtable.cur_ig_value == 0) + dm_digtable.cur_ig_value = priv->DefaultInitialGain[0]; + else + dm_digtable.cur_ig_value = dm_digtable.pre_ig_value; + } + } + else // disconnected -> connected or connected -> disconnected + { + dm_digtable.cur_ig_value = priv->DefaultInitialGain[0]; + dm_digtable.pre_ig_value = 0; + } + //DbgPrint("DM_DigTable.CurIGValue = 0x%x, DM_DigTable.PreIGValue = 0x%x\n", DM_DigTable.CurIGValue, DM_DigTable.PreIGValue); + + // if silent reset happened, we should rewrite the values back + if(priv->reset_count != reset_cnt) + { + force_write = 1; + reset_cnt = priv->reset_count; + } + + if(dm_digtable.pre_ig_value != read_nic_byte(dev, rOFDM0_XAAGCCore1)) + force_write = 1; + + { + if((dm_digtable.pre_ig_value != dm_digtable.cur_ig_value) + || !initialized || force_write) + { + initial_gain = (u8)dm_digtable.cur_ig_value; + //DbgPrint("Write initial gain = 0x%x\n", initial_gain); + // Set initial gain. + write_nic_byte(dev, rOFDM0_XAAGCCore1, initial_gain); + write_nic_byte(dev, rOFDM0_XBAGCCore1, initial_gain); + write_nic_byte(dev, rOFDM0_XCAGCCore1, initial_gain); + write_nic_byte(dev, rOFDM0_XDAGCCore1, initial_gain); + dm_digtable.pre_ig_value = dm_digtable.cur_ig_value; + initialized = 1; + force_write = 0; + } + } +} + +static void dm_pd_th( + struct net_device * dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + static u8 initialized=0, force_write=0; + static u32 reset_cnt = 0; + + if(dm_digtable.dig_algorithm_switch) + { + initialized = 0; + reset_cnt = 0; + } + + if(dm_digtable.pre_connect_state == dm_digtable.cur_connect_state) + { + if(dm_digtable.cur_connect_state == DIG_CONNECT) + { + if (dm_digtable.rssi_val >= dm_digtable.rssi_high_power_highthresh) + dm_digtable.curpd_thstate = DIG_PD_AT_HIGH_POWER; + else if ((dm_digtable.rssi_val <= dm_digtable.rssi_low_thresh)) + dm_digtable.curpd_thstate = DIG_PD_AT_LOW_POWER; + else if ((dm_digtable.rssi_val >= dm_digtable.rssi_high_thresh) && + (dm_digtable.rssi_val < dm_digtable.rssi_high_power_lowthresh)) + dm_digtable.curpd_thstate = DIG_PD_AT_NORMAL_POWER; + else + dm_digtable.curpd_thstate = dm_digtable.prepd_thstate; + } + else + { + dm_digtable.curpd_thstate = DIG_PD_AT_LOW_POWER; + } + } + else // disconnected -> connected or connected -> disconnected + { + dm_digtable.curpd_thstate = DIG_PD_AT_LOW_POWER; + } + + // if silent reset happened, we should rewrite the values back + if(priv->reset_count != reset_cnt) + { + force_write = 1; + reset_cnt = priv->reset_count; + } + + { + if((dm_digtable.prepd_thstate != dm_digtable.curpd_thstate) || + (initialized<=3) || force_write) + { + //DbgPrint("Write PD_TH state = %d\n", DM_DigTable.CurPD_THState); + if(dm_digtable.curpd_thstate == DIG_PD_AT_LOW_POWER) + { + // Lower PD_TH for OFDM. + if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) + { + /* 2008/01/11 MH 40MHZ 90/92 register are not the same. */ + // 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same. + #ifdef RTL8190P + write_nic_byte(dev, rOFDM0_RxDetector1, 0x40); + #else + write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x00); + #endif + /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) + write_nic_byte(dev, rOFDM0_RxDetector1, 0x40); + */ + } + else + write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); + } + else if(dm_digtable.curpd_thstate == DIG_PD_AT_NORMAL_POWER) + { + // Higher PD_TH for OFDM. + if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) + { + /* 2008/01/11 MH 40MHZ 90/92 register are not the same. */ + // 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same. + #ifdef RTL8190P + write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); + #else + write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20); + #endif + /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) + write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); + */ + } + else + write_nic_byte(dev, rOFDM0_RxDetector1, 0x44); + } + else if(dm_digtable.curpd_thstate == DIG_PD_AT_HIGH_POWER) + { + // Higher PD_TH for OFDM for high power state. + if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) + { + #ifdef RTL8190P + write_nic_byte(dev, rOFDM0_RxDetector1, 0x41); + #else + write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10); + #endif + /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) + write_nic_byte(dev, rOFDM0_RxDetector1, 0x41); + */ + } + else + write_nic_byte(dev, rOFDM0_RxDetector1, 0x43); + } + dm_digtable.prepd_thstate = dm_digtable.curpd_thstate; + if(initialized <= 3) + initialized++; + force_write = 0; + } + } +} + +static void dm_cs_ratio( + struct net_device * dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + static u8 initialized=0,force_write=0; + static u32 reset_cnt = 0; + + if(dm_digtable.dig_algorithm_switch) + { + initialized = 0; + reset_cnt = 0; + } + + if(dm_digtable.pre_connect_state == dm_digtable.cur_connect_state) + { + if(dm_digtable.cur_connect_state == DIG_CONNECT) + { + if ((dm_digtable.rssi_val <= dm_digtable.rssi_low_thresh)) + dm_digtable.curcs_ratio_state = DIG_CS_RATIO_LOWER; + else if ((dm_digtable.rssi_val >= dm_digtable.rssi_high_thresh) ) + dm_digtable.curcs_ratio_state = DIG_CS_RATIO_HIGHER; + else + dm_digtable.curcs_ratio_state = dm_digtable.precs_ratio_state; + } + else + { + dm_digtable.curcs_ratio_state = DIG_CS_RATIO_LOWER; + } + } + else // disconnected -> connected or connected -> disconnected + { + dm_digtable.curcs_ratio_state = DIG_CS_RATIO_LOWER; + } + + // if silent reset happened, we should rewrite the values back + if(priv->reset_count != reset_cnt) + { + force_write = 1; + reset_cnt = priv->reset_count; + } + + + { + if((dm_digtable.precs_ratio_state != dm_digtable.curcs_ratio_state) || + !initialized || force_write) + { + //DbgPrint("Write CS_ratio state = %d\n", DM_DigTable.CurCS_ratioState); + if(dm_digtable.curcs_ratio_state == DIG_CS_RATIO_LOWER) + { + // Lower CS ratio for CCK. + write_nic_byte(dev, 0xa0a, 0x08); + } + else if(dm_digtable.curcs_ratio_state == DIG_CS_RATIO_HIGHER) + { + // Higher CS ratio for CCK. + write_nic_byte(dev, 0xa0a, 0xcd); + } + dm_digtable.precs_ratio_state = dm_digtable.curcs_ratio_state; + initialized = 1; + force_write = 0; + } + } +} + +extern void dm_init_edca_turbo(struct net_device * dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + priv->bcurrent_turbo_EDCA = false; + priv->ieee80211->bis_any_nonbepkts = false; + priv->bis_cur_rdlstate = false; +} // dm_init_edca_turbo + +#if 1 +static void dm_check_edca_turbo( + struct net_device * dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + PRT_HIGH_THROUGHPUT pHTInfo = priv->ieee80211->pHTInfo; + //PSTA_QOS pStaQos = pMgntInfo->pStaQos; + + // Keep past Tx/Rx packet count for RT-to-RT EDCA turbo. + static unsigned long lastTxOkCnt = 0; + static unsigned long lastRxOkCnt = 0; + unsigned long curTxOkCnt = 0; + unsigned long curRxOkCnt = 0; + + // + // Do not be Turbo if it's under WiFi config and Qos Enabled, because the EDCA parameters + // should follow the settings from QAP. By Bruce, 2007-12-07. + // + #if 1 + if(priv->ieee80211->state != IEEE80211_LINKED) + goto dm_CheckEdcaTurbo_EXIT; + #endif + // We do not turn on EDCA turbo mode for some AP that has IOT issue + if(priv->ieee80211->pHTInfo->IOTAction & HT_IOT_ACT_DISABLE_EDCA_TURBO) + goto dm_CheckEdcaTurbo_EXIT; + +// printk("========>%s():bis_any_nonbepkts is %d\n",__FUNCTION__,priv->bis_any_nonbepkts); + // Check the status for current condition. + if(!priv->ieee80211->bis_any_nonbepkts) + { + curTxOkCnt = priv->stats.txbytesunicast - lastTxOkCnt; + curRxOkCnt = priv->stats.rxbytesunicast - lastRxOkCnt; + // For RT-AP, we needs to turn it on when Rx>Tx + if(curRxOkCnt > 4*curTxOkCnt) + { + //printk("%s():curRxOkCnt > 4*curTxOkCnt\n"); + if(!priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA) + { + write_nic_dword(dev, EDCAPARA_BE, edca_setting_DL[pHTInfo->IOTPeer]); + priv->bis_cur_rdlstate = true; + } + } + else + { + + //printk("%s():curRxOkCnt < 4*curTxOkCnt\n"); + if(priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA) + { + write_nic_dword(dev, EDCAPARA_BE, edca_setting_UL[pHTInfo->IOTPeer]); + priv->bis_cur_rdlstate = false; + } + + } + + priv->bcurrent_turbo_EDCA = true; + } + else + { + // + // Turn Off EDCA turbo here. + // Restore original EDCA according to the declaration of AP. + // + if(priv->bcurrent_turbo_EDCA) + { + + { + u8 u1bAIFS; + u32 u4bAcParam; + struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters; + u8 mode = priv->ieee80211->mode; + + // For Each time updating EDCA parameter, reset EDCA turbo mode status. + dm_init_edca_turbo(dev); + u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ?9:20) + aSifsTime; + u4bAcParam = ((((u32)(qos_parameters->tx_op_limit[0]))<< AC_PARAM_TXOP_LIMIT_OFFSET)| + (((u32)(qos_parameters->cw_max[0]))<< AC_PARAM_ECW_MAX_OFFSET)| + (((u32)(qos_parameters->cw_min[0]))<< AC_PARAM_ECW_MIN_OFFSET)| + ((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET)); + //write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam); + write_nic_dword(dev, EDCAPARA_BE, u4bAcParam); + + // Check ACM bit. + // If it is set, immediately set ACM control bit to downgrading AC for passing WMM testplan. Annie, 2005-12-13. + { + // TODO: Modified this part and try to set acm control in only 1 IO processing!! + + PACI_AIFSN pAciAifsn = (PACI_AIFSN)&(qos_parameters->aifs[0]); + u8 AcmCtrl = read_nic_byte( dev, AcmHwCtrl ); + if( pAciAifsn->f.ACM ) + { // ACM bit is 1. + AcmCtrl |= AcmHw_BeqEn; + } + else + { // ACM bit is 0. + AcmCtrl &= (~AcmHw_BeqEn); + } + + RT_TRACE( COMP_QOS,"SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n", AcmCtrl ) ; + write_nic_byte(dev, AcmHwCtrl, AcmCtrl ); + } + } + priv->bcurrent_turbo_EDCA = false; + } + } + + +dm_CheckEdcaTurbo_EXIT: + // Set variables for next time. + priv->ieee80211->bis_any_nonbepkts = false; + lastTxOkCnt = priv->stats.txbytesunicast; + lastRxOkCnt = priv->stats.rxbytesunicast; +} // dm_CheckEdcaTurbo +#endif + +extern void DM_CTSToSelfSetting(struct net_device * dev,u32 DM_Type, u32 DM_Value) +{ + struct r8192_priv *priv = ieee80211_priv((struct net_device *)dev); + + if (DM_Type == 0) // CTS to self disable/enable + { + if(DM_Value > 1) + DM_Value = 1; + priv->ieee80211->bCTSToSelfEnable = (bool)DM_Value; + //DbgPrint("pMgntInfo->bCTSToSelfEnable = %d\n", pMgntInfo->bCTSToSelfEnable); + } + else if(DM_Type == 1) //CTS to self Th + { + if(DM_Value >= 50) + DM_Value = 50; + priv->ieee80211->CTSToSelfTH = (u8)DM_Value; + //DbgPrint("pMgntInfo->CTSToSelfTH = %d\n", pMgntInfo->CTSToSelfTH); + } +} + +static void dm_init_ctstoself(struct net_device * dev) +{ + struct r8192_priv *priv = ieee80211_priv((struct net_device *)dev); + + priv->ieee80211->bCTSToSelfEnable = TRUE; + priv->ieee80211->CTSToSelfTH = CTSToSelfTHVal; +} + +static void dm_ctstoself(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv((struct net_device *)dev); + PRT_HIGH_THROUGHPUT pHTInfo = priv->ieee80211->pHTInfo; + static unsigned long lastTxOkCnt = 0; + static unsigned long lastRxOkCnt = 0; + unsigned long curTxOkCnt = 0; + unsigned long curRxOkCnt = 0; + + if(priv->ieee80211->bCTSToSelfEnable != TRUE) + { + pHTInfo->IOTAction &= ~HT_IOT_ACT_FORCED_CTS2SELF; + return; + } + /* + 1. Uplink + 2. Linksys350/Linksys300N + 3. <50 disable, >55 enable + */ + + if(pHTInfo->IOTPeer == HT_IOT_PEER_BROADCOM) + { + curTxOkCnt = priv->stats.txbytesunicast - lastTxOkCnt; + curRxOkCnt = priv->stats.rxbytesunicast - lastRxOkCnt; + if(curRxOkCnt > 4*curTxOkCnt) //downlink, disable CTS to self + { + pHTInfo->IOTAction &= ~HT_IOT_ACT_FORCED_CTS2SELF; + //DbgPrint("dm_CTSToSelf() ==> CTS to self disabled -- downlink\n"); + } + else //uplink + { + #if 1 + pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_CTS2SELF; + #else + if(priv->undecorated_smoothed_pwdb < priv->ieee80211->CTSToSelfTH) // disable CTS to self + { + pHTInfo->IOTAction &= ~HT_IOT_ACT_FORCED_CTS2SELF; + //DbgPrint("dm_CTSToSelf() ==> CTS to self disabled\n"); + } + else if(priv->undecorated_smoothed_pwdb >= (priv->ieee80211->CTSToSelfTH+5)) // enable CTS to self + { + pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_CTS2SELF; + //DbgPrint("dm_CTSToSelf() ==> CTS to self enabled\n"); + } + #endif + } + + lastTxOkCnt = priv->stats.txbytesunicast; + lastRxOkCnt = priv->stats.rxbytesunicast; + } +} + + +#if 0 +/*----------------------------------------------------------------------------- + * Function: dm_rf_operation_test_callback() + * + * Overview: Only for RF operation test now. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/29/2008 amy Create Version 0 porting from windows code. + * + *---------------------------------------------------------------------------*/ +extern void dm_rf_operation_test_callback(unsigned long dev) +{ +// struct r8192_priv *priv = ieee80211_priv((struct net_device *)dev); + u8 erfpath; + + + for(erfpath=0; erfpath<4; erfpath++) + { + //DbgPrint("Set RF-%d\n\r", eRFPath); + //PHY_SetRFReg(Adapter, (RF90_RADIO_PATH_E)eRFPath, 0x2c, bMask12Bits, 0x3d7); + udelay(100); + } + + { + //PlatformSetPeriodicTimer(Adapter, &pHalData->RfTest1Timer, 500); + } + + // For test + { + //u8 i; + //PlatformSetPeriodicTimer(Adapter, &pHalData->RfTest1Timer, 500); +#if 0 + for(i=0; i<50; i++) + { + // Write Test + PHY_SetRFReg(Adapter, RF90_PATH_A, 0x02, bMask12Bits, 0x4d); + //delay_us(100); + PHY_SetRFReg(Adapter, RF90_PATH_A, 0x02, bMask12Bits, 0x4f); + //delay_us(100); + PHY_SetRFReg(Adapter, RF90_PATH_C, 0x02, bMask12Bits, 0x4d); + //delay_us(100); + PHY_SetRFReg(Adapter, RF90_PATH_C, 0x02, bMask12Bits, 0x4f); + //delay_us(100); + +#if 0 + // Read test + PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x02, bMask12Bits); + //delay_us(100); + PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x02, bMask12Bits); + //delay_us(100); + PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x12, bMask12Bits); + //delay_us(100); + PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x12, bMask12Bits); + //delay_us(100); + PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x21, bMask12Bits); + //delay_us(100); + PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x21, bMask12Bits); + //delay_us(100); +#endif + } +#endif + } + +} /* DM_RfOperationTestCallBack */ +#endif + +/*----------------------------------------------------------------------------- + * Function: dm_check_rfctrl_gpio() + * + * Overview: Copy 8187B template for 9xseries. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/28/2008 amy Create Version 0 porting from windows code. + * + *---------------------------------------------------------------------------*/ +#if 1 +static void dm_check_rfctrl_gpio(struct net_device * dev) +{ + //struct r8192_priv *priv = ieee80211_priv(dev); + + // Walk around for DTM test, we will not enable HW - radio on/off because r/w + // page 1 register before Lextra bus is enabled cause system fails when resuming + // from S4. 20080218, Emily + + // Stop to execute workitem to prevent S3/S4 bug. +#ifdef RTL8190P + return; +#endif +#ifdef RTL8192U + return; +#endif +#ifdef RTL8192E + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) + queue_delayed_work(priv->priv_wq,&priv->gpio_change_rf_wq,0); + #else + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + schedule_task(&priv->gpio_change_rf_wq); + #else + queue_work(priv->priv_wq,&priv->gpio_change_rf_wq); + #endif + #endif +#endif + +} /* dm_CheckRfCtrlGPIO */ + +#endif +/*----------------------------------------------------------------------------- + * Function: dm_check_pbc_gpio() + * + * Overview: Check if PBC button is pressed. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/28/2008 amy Create Version 0 porting from windows code. + * + *---------------------------------------------------------------------------*/ +static void dm_check_pbc_gpio(struct net_device *dev) +{ +#ifdef RTL8192U + struct r8192_priv *priv = ieee80211_priv(dev); + u8 tmp1byte; + + + tmp1byte = read_nic_byte(dev,GPI); + if(tmp1byte == 0xff) + return; + + if (tmp1byte&BIT6 || tmp1byte&BIT0) + { + // Here we only set bPbcPressed to TRUE + // After trigger PBC, the variable will be set to FALSE + RT_TRACE(COMP_IO, "CheckPbcGPIO - PBC is pressed\n"); + priv->bpbc_pressed = true; + } +#endif + +} + +#ifdef RTL8192E + +/*----------------------------------------------------------------------------- + * Function: dm_GPIOChangeRF + * Overview: PCI will not support workitem call back HW radio on-off control. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 02/21/2008 MHC Create Version 0. + * + *---------------------------------------------------------------------------*/ + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +extern void dm_gpio_change_rf_callback(struct work_struct *work) +{ + struct delayed_work *dwork = container_of(work,struct delayed_work,work); + struct r8192_priv *priv = container_of(dwork,struct r8192_priv,gpio_change_rf_wq); + struct net_device *dev = priv->ieee80211->dev; +#else +extern void dm_gpio_change_rf_callback(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); +#endif + u8 tmp1byte; + RT_RF_POWER_STATE eRfPowerStateToSet; + bool bActuallySet = false; + + do{ + bActuallySet=false; + + if(!priv->up) + { + RT_TRACE((COMP_INIT | COMP_POWER | COMP_RF),"dm_gpio_change_rf_callback(): Callback function breaks out!!\n"); + } + else + { + // 0x108 GPIO input register is read only + //set 0x108 B1= 1: RF-ON; 0: RF-OFF. + tmp1byte = read_nic_byte(dev,GPI); + + eRfPowerStateToSet = (tmp1byte&BIT1) ? eRfOn : eRfOff; + + if( (priv->bHwRadioOff == true) && (eRfPowerStateToSet == eRfOn)) + { + RT_TRACE(COMP_RF, "gpiochangeRF - HW Radio ON\n"); + + priv->bHwRadioOff = false; + bActuallySet = true; + } + else if ( (priv->bHwRadioOff == false) && (eRfPowerStateToSet == eRfOff)) + { + RT_TRACE(COMP_RF, "gpiochangeRF - HW Radio OFF\n"); + priv->bHwRadioOff = true; + bActuallySet = true; + } + + if(bActuallySet) + { + #ifdef TO_DO + MgntActSet_RF_State(dev, eRfPowerStateToSet, RF_CHANGE_BY_HW); + //DrvIFIndicateCurrentPhyStatus(pAdapter); + #endif + } + else + { + msleep(2000); + } + + } + }while(TRUE) + +} /* dm_GPIOChangeRF */ + +#endif +/*----------------------------------------------------------------------------- + * Function: DM_RFPathCheckWorkItemCallBack() + * + * Overview: Check if Current RF RX path is enabled + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 01/30/2008 MHC Create Version 0. + * + *---------------------------------------------------------------------------*/ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work) +{ + struct delayed_work *dwork = container_of(work,struct delayed_work,work); + struct r8192_priv *priv = container_of(dwork,struct r8192_priv,rfpath_check_wq); + struct net_device *dev =priv->ieee80211->dev; +#else +extern void dm_rf_pathcheck_workitemcallback(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); +#endif + //bool bactually_set = false; + u8 rfpath = 0, i; + + + /* 2008/01/30 MH After discussing with SD3 Jerry, 0xc04/0xd04 register will + always be the same. We only read 0xc04 now. */ + rfpath = read_nic_byte(dev, 0xc04); + + // Check Bit 0-3, it means if RF A-D is enabled. + for (i = 0; i < RF90_PATH_MAX; i++) + { + if (rfpath & (0x01<brfpath_rxenable[i] = 1; + else + priv->brfpath_rxenable[i] = 0; + } + if(!DM_RxPathSelTable.Enable) + return; + + dm_rxpath_sel_byrssi(dev); +} /* DM_RFPathCheckWorkItemCallBack */ + +static void dm_init_rxpath_selection(struct net_device * dev) +{ + u8 i; + struct r8192_priv *priv = ieee80211_priv(dev); + DM_RxPathSelTable.Enable = 1; //default enabled + DM_RxPathSelTable.SS_TH_low = RxPathSelection_SS_TH_low; + DM_RxPathSelTable.diff_TH = RxPathSelection_diff_TH; + if(priv->CustomerID == RT_CID_819x_Netcore) + DM_RxPathSelTable.cck_method = CCK_Rx_Version_2; + else + DM_RxPathSelTable.cck_method = CCK_Rx_Version_1; + DM_RxPathSelTable.DbgMode = DM_DBG_OFF; + DM_RxPathSelTable.disabledRF = 0; + for(i=0; i<4; i++) + { + DM_RxPathSelTable.rf_rssi[i] = 50; + DM_RxPathSelTable.cck_pwdb_sta[i] = -64; + DM_RxPathSelTable.rf_enable_rssi_th[i] = 100; + } +} + +static void dm_rxpath_sel_byrssi(struct net_device * dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u8 i, max_rssi_index=0, min_rssi_index=0, sec_rssi_index=0, rf_num=0; + u8 tmp_max_rssi=0, tmp_min_rssi=0, tmp_sec_rssi=0; + u8 cck_default_Rx=0x2; //RF-C + u8 cck_optional_Rx=0x3;//RF-D + long tmp_cck_max_pwdb=0, tmp_cck_min_pwdb=0, tmp_cck_sec_pwdb=0; + u8 cck_rx_ver2_max_index=0, cck_rx_ver2_min_index=0, cck_rx_ver2_sec_index=0; + u8 cur_rf_rssi; + long cur_cck_pwdb; + static u8 disabled_rf_cnt=0, cck_Rx_Path_initialized=0; + u8 update_cck_rx_path; + + if(priv->rf_type != RF_2T4R) + return; + + if(!cck_Rx_Path_initialized) + { + DM_RxPathSelTable.cck_Rx_path = (read_nic_byte(dev, 0xa07)&0xf); + cck_Rx_Path_initialized = 1; + } + + DM_RxPathSelTable.disabledRF = 0xf; + DM_RxPathSelTable.disabledRF &=~ (read_nic_byte(dev, 0xc04)); + + if(priv->ieee80211->mode == WIRELESS_MODE_B) + { + DM_RxPathSelTable.cck_method = CCK_Rx_Version_2; //pure B mode, fixed cck version2 + //DbgPrint("Pure B mode, use cck rx version2 \n"); + } + + //decide max/sec/min rssi index + for (i=0; istats.rx_rssi_percentage[i]; + + if(priv->brfpath_rxenable[i]) + { + rf_num++; + cur_rf_rssi = DM_RxPathSelTable.rf_rssi[i]; + + if(rf_num == 1) // find first enabled rf path and the rssi values + { //initialize, set all rssi index to the same one + max_rssi_index = min_rssi_index = sec_rssi_index = i; + tmp_max_rssi = tmp_min_rssi = tmp_sec_rssi = cur_rf_rssi; + } + else if(rf_num == 2) + { // we pick up the max index first, and let sec and min to be the same one + if(cur_rf_rssi >= tmp_max_rssi) + { + tmp_max_rssi = cur_rf_rssi; + max_rssi_index = i; + } + else + { + tmp_sec_rssi = tmp_min_rssi = cur_rf_rssi; + sec_rssi_index = min_rssi_index = i; + } + } + else + { + if(cur_rf_rssi > tmp_max_rssi) + { + tmp_sec_rssi = tmp_max_rssi; + sec_rssi_index = max_rssi_index; + tmp_max_rssi = cur_rf_rssi; + max_rssi_index = i; + } + else if(cur_rf_rssi == tmp_max_rssi) + { // let sec and min point to the different index + tmp_sec_rssi = cur_rf_rssi; + sec_rssi_index = i; + } + else if((cur_rf_rssi < tmp_max_rssi) &&(cur_rf_rssi > tmp_sec_rssi)) + { + tmp_sec_rssi = cur_rf_rssi; + sec_rssi_index = i; + } + else if(cur_rf_rssi == tmp_sec_rssi) + { + if(tmp_sec_rssi == tmp_min_rssi) + { // let sec and min point to the different index + tmp_sec_rssi = cur_rf_rssi; + sec_rssi_index = i; + } + else + { + // This case we don't need to set any index + } + } + else if((cur_rf_rssi < tmp_sec_rssi) && (cur_rf_rssi > tmp_min_rssi)) + { + // This case we don't need to set any index + } + else if(cur_rf_rssi == tmp_min_rssi) + { + if(tmp_sec_rssi == tmp_min_rssi) + { // let sec and min point to the different index + tmp_min_rssi = cur_rf_rssi; + min_rssi_index = i; + } + else + { + // This case we don't need to set any index + } + } + else if(cur_rf_rssi < tmp_min_rssi) + { + tmp_min_rssi = cur_rf_rssi; + min_rssi_index = i; + } + } + } + } + + rf_num = 0; + // decide max/sec/min cck pwdb index + if(DM_RxPathSelTable.cck_method == CCK_Rx_Version_2) + { + for (i=0; ibrfpath_rxenable[i]) + { + rf_num++; + cur_cck_pwdb = DM_RxPathSelTable.cck_pwdb_sta[i]; + + if(rf_num == 1) // find first enabled rf path and the rssi values + { //initialize, set all rssi index to the same one + cck_rx_ver2_max_index = cck_rx_ver2_min_index = cck_rx_ver2_sec_index = i; + tmp_cck_max_pwdb = tmp_cck_min_pwdb = tmp_cck_sec_pwdb = cur_cck_pwdb; + } + else if(rf_num == 2) + { // we pick up the max index first, and let sec and min to be the same one + if(cur_cck_pwdb >= tmp_cck_max_pwdb) + { + tmp_cck_max_pwdb = cur_cck_pwdb; + cck_rx_ver2_max_index = i; + } + else + { + tmp_cck_sec_pwdb = tmp_cck_min_pwdb = cur_cck_pwdb; + cck_rx_ver2_sec_index = cck_rx_ver2_min_index = i; + } + } + else + { + if(cur_cck_pwdb > tmp_cck_max_pwdb) + { + tmp_cck_sec_pwdb = tmp_cck_max_pwdb; + cck_rx_ver2_sec_index = cck_rx_ver2_max_index; + tmp_cck_max_pwdb = cur_cck_pwdb; + cck_rx_ver2_max_index = i; + } + else if(cur_cck_pwdb == tmp_cck_max_pwdb) + { // let sec and min point to the different index + tmp_cck_sec_pwdb = cur_cck_pwdb; + cck_rx_ver2_sec_index = i; + } + else if((cur_cck_pwdb < tmp_cck_max_pwdb) &&(cur_cck_pwdb > tmp_cck_sec_pwdb)) + { + tmp_cck_sec_pwdb = cur_cck_pwdb; + cck_rx_ver2_sec_index = i; + } + else if(cur_cck_pwdb == tmp_cck_sec_pwdb) + { + if(tmp_cck_sec_pwdb == tmp_cck_min_pwdb) + { // let sec and min point to the different index + tmp_cck_sec_pwdb = cur_cck_pwdb; + cck_rx_ver2_sec_index = i; + } + else + { + // This case we don't need to set any index + } + } + else if((cur_cck_pwdb < tmp_cck_sec_pwdb) && (cur_cck_pwdb > tmp_cck_min_pwdb)) + { + // This case we don't need to set any index + } + else if(cur_cck_pwdb == tmp_cck_min_pwdb) + { + if(tmp_cck_sec_pwdb == tmp_cck_min_pwdb) + { // let sec and min point to the different index + tmp_cck_min_pwdb = cur_cck_pwdb; + cck_rx_ver2_min_index = i; + } + else + { + // This case we don't need to set any index + } + } + else if(cur_cck_pwdb < tmp_cck_min_pwdb) + { + tmp_cck_min_pwdb = cur_cck_pwdb; + cck_rx_ver2_min_index = i; + } + } + + } + } + } + + + // Set CCK Rx path + // reg0xA07[3:2]=cck default rx path, reg0xa07[1:0]=cck optional rx path. + update_cck_rx_path = 0; + if(DM_RxPathSelTable.cck_method == CCK_Rx_Version_2) + { + cck_default_Rx = cck_rx_ver2_max_index; + cck_optional_Rx = cck_rx_ver2_sec_index; + if(tmp_cck_max_pwdb != -64) + update_cck_rx_path = 1; + } + + if(tmp_min_rssi < DM_RxPathSelTable.SS_TH_low && disabled_rf_cnt < 2) + { + if((tmp_max_rssi - tmp_min_rssi) >= DM_RxPathSelTable.diff_TH) + { + //record the enabled rssi threshold + DM_RxPathSelTable.rf_enable_rssi_th[min_rssi_index] = tmp_max_rssi+5; + //disable the BB Rx path, OFDM + rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0x1<>i) & 0x1) //disabled rf + { + if(tmp_max_rssi >= DM_RxPathSelTable.rf_enable_rssi_th[i]) + { + //enable the BB Rx path + //DbgPrint("RF-%d is enabled. \n", 0x1<= KERNEL_VERSION(2,6,20) + queue_delayed_work(priv->priv_wq,&priv->rfpath_check_wq,0); +#else +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + schedule_task(&priv->rfpath_check_wq); +#else + queue_work(priv->priv_wq,&priv->rfpath_check_wq); +#endif +#endif +} /* dm_CheckRxRFPath */ + + +static void dm_init_fsync (struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + priv->ieee80211->fsync_time_interval = 500; + priv->ieee80211->fsync_rate_bitmap = 0x0f000800; + priv->ieee80211->fsync_rssi_threshold = 30; +#ifdef RTL8190P + priv->ieee80211->bfsync_enable = true; +#else + priv->ieee80211->bfsync_enable = false; +#endif + priv->ieee80211->fsync_multiple_timeinterval = 3; + priv->ieee80211->fsync_firstdiff_ratethreshold= 100; + priv->ieee80211->fsync_seconddiff_ratethreshold= 200; + priv->ieee80211->fsync_state = Default_Fsync; + priv->framesyncMonitor = 1; // current default 0xc38 monitor on + + init_timer(&priv->fsync_timer); + priv->fsync_timer.data = (unsigned long)dev; + priv->fsync_timer.function = dm_fsync_timer_callback; +} + + +static void dm_deInit_fsync(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + del_timer_sync(&priv->fsync_timer); +} + +extern void dm_fsync_timer_callback(unsigned long data) +{ + struct net_device *dev = (struct net_device *)data; + struct r8192_priv *priv = ieee80211_priv((struct net_device *)data); + u32 rate_index, rate_count = 0, rate_count_diff=0; + bool bSwitchFromCountDiff = false; + bool bDoubleTimeInterval = false; + + if( priv->ieee80211->state == IEEE80211_LINKED && + priv->ieee80211->bfsync_enable && + (priv->ieee80211->pHTInfo->IOTAction & HT_IOT_ACT_CDD_FSYNC)) + { + // Count rate 54, MCS [7], [12, 13, 14, 15] + u32 rate_bitmap; + for(rate_index = 0; rate_index <= 27; rate_index++) + { + rate_bitmap = 1 << rate_index; + if(priv->ieee80211->fsync_rate_bitmap & rate_bitmap) + rate_count+= priv->stats.received_rate_histogram[1][rate_index]; + } + + if(rate_count < priv->rate_record) + rate_count_diff = 0xffffffff - rate_count + priv->rate_record; + else + rate_count_diff = rate_count - priv->rate_record; + if(rate_count_diff < priv->rateCountDiffRecord) + { + + u32 DiffNum = priv->rateCountDiffRecord - rate_count_diff; + // Contiune count + if(DiffNum >= priv->ieee80211->fsync_seconddiff_ratethreshold) + priv->ContiuneDiffCount++; + else + priv->ContiuneDiffCount = 0; + + // Contiune count over + if(priv->ContiuneDiffCount >=2) + { + bSwitchFromCountDiff = true; + priv->ContiuneDiffCount = 0; + } + } + else + { + // Stop contiune count + priv->ContiuneDiffCount = 0; + } + + //If Count diff <= FsyncRateCountThreshold + if(rate_count_diff <= priv->ieee80211->fsync_firstdiff_ratethreshold) + { + bSwitchFromCountDiff = true; + priv->ContiuneDiffCount = 0; + } + priv->rate_record = rate_count; + priv->rateCountDiffRecord = rate_count_diff; + RT_TRACE(COMP_HALDM, "rateRecord %d rateCount %d, rateCountdiff %d bSwitchFsync %d\n", priv->rate_record, rate_count, rate_count_diff , priv->bswitch_fsync); + // if we never receive those mcs rate and rssi > 30 % then switch fsyn + if(priv->undecorated_smoothed_pwdb > priv->ieee80211->fsync_rssi_threshold && bSwitchFromCountDiff) + { + bDoubleTimeInterval = true; + priv->bswitch_fsync = !priv->bswitch_fsync; + if(priv->bswitch_fsync) + { + #ifdef RTL8190P + write_nic_byte(dev, 0xC36, 0x00); + #else + write_nic_byte(dev,0xC36, 0x1c); + #endif + write_nic_byte(dev, 0xC3e, 0x90); + } + else + { + #ifdef RTL8190P + write_nic_byte(dev, 0xC36, 0x40); + #else + write_nic_byte(dev, 0xC36, 0x5c); + #endif + write_nic_byte(dev, 0xC3e, 0x96); + } + } + else if(priv->undecorated_smoothed_pwdb <= priv->ieee80211->fsync_rssi_threshold) + { + if(priv->bswitch_fsync) + { + priv->bswitch_fsync = false; + #ifdef RTL8190P + write_nic_byte(dev, 0xC36, 0x40); + #else + write_nic_byte(dev, 0xC36, 0x5c); + #endif + write_nic_byte(dev, 0xC3e, 0x96); + } + } + if(bDoubleTimeInterval){ + if(timer_pending(&priv->fsync_timer)) + del_timer_sync(&priv->fsync_timer); + priv->fsync_timer.expires = jiffies + MSECS(priv->ieee80211->fsync_time_interval*priv->ieee80211->fsync_multiple_timeinterval); + add_timer(&priv->fsync_timer); + } + else{ + if(timer_pending(&priv->fsync_timer)) + del_timer_sync(&priv->fsync_timer); + priv->fsync_timer.expires = jiffies + MSECS(priv->ieee80211->fsync_time_interval); + add_timer(&priv->fsync_timer); + } + } + else + { + // Let Register return to default value; + if(priv->bswitch_fsync) + { + priv->bswitch_fsync = false; + #ifdef RTL8190P + write_nic_byte(dev, 0xC36, 0x40); + #else + write_nic_byte(dev, 0xC36, 0x5c); + #endif + write_nic_byte(dev, 0xC3e, 0x96); + } + priv->ContiuneDiffCount = 0; + #ifdef RTL8190P + write_nic_dword(dev, rOFDM0_RxDetector2, 0x164052cd); + #else + write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c52cd); + #endif + } + RT_TRACE(COMP_HALDM, "ContiuneDiffCount %d\n", priv->ContiuneDiffCount); + RT_TRACE(COMP_HALDM, "rateRecord %d rateCount %d, rateCountdiff %d bSwitchFsync %d\n", priv->rate_record, rate_count, rate_count_diff , priv->bswitch_fsync); +} + +static void dm_StartHWFsync(struct net_device *dev) +{ + RT_TRACE(COMP_HALDM, "%s\n", __FUNCTION__); + write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c12cf); + write_nic_byte(dev, 0xc3b, 0x41); +} + +static void dm_EndSWFsync(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + RT_TRACE(COMP_HALDM, "%s\n", __FUNCTION__); + del_timer_sync(&(priv->fsync_timer)); + + // Let Register return to default value; + if(priv->bswitch_fsync) + { + priv->bswitch_fsync = false; + + #ifdef RTL8190P + write_nic_byte(dev, 0xC36, 0x40); + #else + write_nic_byte(dev, 0xC36, 0x5c); + #endif + + write_nic_byte(dev, 0xC3e, 0x96); + } + + priv->ContiuneDiffCount = 0; +#ifndef RTL8190P + write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c52cd); +#endif + +} + +static void dm_StartSWFsync(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u32 rateIndex; + u32 rateBitmap; + + RT_TRACE(COMP_HALDM,"%s\n", __FUNCTION__); + // Initial rate record to zero, start to record. + priv->rate_record = 0; + // Initial contiune diff count to zero, start to record. + priv->ContiuneDiffCount = 0; + priv->rateCountDiffRecord = 0; + priv->bswitch_fsync = false; + + if(priv->ieee80211->mode == WIRELESS_MODE_N_24G) + { + priv->ieee80211->fsync_firstdiff_ratethreshold= 600; + priv->ieee80211->fsync_seconddiff_ratethreshold = 0xffff; + } + else + { + priv->ieee80211->fsync_firstdiff_ratethreshold= 200; + priv->ieee80211->fsync_seconddiff_ratethreshold = 200; + } + for(rateIndex = 0; rateIndex <= 27; rateIndex++) + { + rateBitmap = 1 << rateIndex; + if(priv->ieee80211->fsync_rate_bitmap & rateBitmap) + priv->rate_record += priv->stats.received_rate_histogram[1][rateIndex]; + } + if(timer_pending(&priv->fsync_timer)) + del_timer_sync(&priv->fsync_timer); + priv->fsync_timer.expires = jiffies + MSECS(priv->ieee80211->fsync_time_interval); + add_timer(&priv->fsync_timer); + +#ifndef RTL8190P + write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c12cd); +#endif + +} + +static void dm_EndHWFsync(struct net_device *dev) +{ + RT_TRACE(COMP_HALDM,"%s\n", __FUNCTION__); + write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c52cd); + write_nic_byte(dev, 0xc3b, 0x49); + +} + +void dm_check_fsync(struct net_device *dev) +{ +#define RegC38_Default 0 +#define RegC38_NonFsync_Other_AP 1 +#define RegC38_Fsync_AP_BCM 2 + struct r8192_priv *priv = ieee80211_priv(dev); + //u32 framesyncC34; + static u8 reg_c38_State=RegC38_Default; + static u32 reset_cnt=0; + + RT_TRACE(COMP_HALDM, "RSSI %d TimeInterval %d MultipleTimeInterval %d\n", priv->ieee80211->fsync_rssi_threshold, priv->ieee80211->fsync_time_interval, priv->ieee80211->fsync_multiple_timeinterval); + RT_TRACE(COMP_HALDM, "RateBitmap 0x%x FirstDiffRateThreshold %d SecondDiffRateThreshold %d\n", priv->ieee80211->fsync_rate_bitmap, priv->ieee80211->fsync_firstdiff_ratethreshold, priv->ieee80211->fsync_seconddiff_ratethreshold); + + if( priv->ieee80211->state == IEEE80211_LINKED && + (priv->ieee80211->pHTInfo->IOTAction & HT_IOT_ACT_CDD_FSYNC)) + { + if(priv->ieee80211->bfsync_enable == 0) + { + switch(priv->ieee80211->fsync_state) + { + case Default_Fsync: + dm_StartHWFsync(dev); + priv->ieee80211->fsync_state = HW_Fsync; + break; + case SW_Fsync: + dm_EndSWFsync(dev); + dm_StartHWFsync(dev); + priv->ieee80211->fsync_state = HW_Fsync; + break; + case HW_Fsync: + default: + break; + } + } + else + { + switch(priv->ieee80211->fsync_state) + { + case Default_Fsync: + dm_StartSWFsync(dev); + priv->ieee80211->fsync_state = SW_Fsync; + break; + case HW_Fsync: + dm_EndHWFsync(dev); + dm_StartSWFsync(dev); + priv->ieee80211->fsync_state = SW_Fsync; + break; + case SW_Fsync: + default: + break; + + } + } + if(priv->framesyncMonitor) + { + if(reg_c38_State != RegC38_Fsync_AP_BCM) + { //For broadcom AP we write different default value + #ifdef RTL8190P + write_nic_byte(dev, rOFDM0_RxDetector3, 0x15); + #else + write_nic_byte(dev, rOFDM0_RxDetector3, 0x95); + #endif + + reg_c38_State = RegC38_Fsync_AP_BCM; + } + } + } + else + { + switch(priv->ieee80211->fsync_state) + { + case HW_Fsync: + dm_EndHWFsync(dev); + priv->ieee80211->fsync_state = Default_Fsync; + break; + case SW_Fsync: + dm_EndSWFsync(dev); + priv->ieee80211->fsync_state = Default_Fsync; + break; + case Default_Fsync: + default: + break; + } + + if(priv->framesyncMonitor) + { + if(priv->ieee80211->state == IEEE80211_LINKED) + { + if(priv->undecorated_smoothed_pwdb <= RegC38_TH) + { + if(reg_c38_State != RegC38_NonFsync_Other_AP) + { + #ifdef RTL8190P + write_nic_byte(dev, rOFDM0_RxDetector3, 0x10); + #else + write_nic_byte(dev, rOFDM0_RxDetector3, 0x90); + #endif + + reg_c38_State = RegC38_NonFsync_Other_AP; + #if 0//cosa + if (Adapter->HardwareType == HARDWARE_TYPE_RTL8190P) + DbgPrint("Fsync is idle, rssi<=35, write 0xc38 = 0x%x \n", 0x10); + else + DbgPrint("Fsync is idle, rssi<=35, write 0xc38 = 0x%x \n", 0x90); + #endif + } + } + else if(priv->undecorated_smoothed_pwdb >= (RegC38_TH+5)) + { + if(reg_c38_State) + { + write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync); + reg_c38_State = RegC38_Default; + //DbgPrint("Fsync is idle, rssi>=40, write 0xc38 = 0x%x \n", pHalData->framesync); + } + } + } + else + { + if(reg_c38_State) + { + write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync); + reg_c38_State = RegC38_Default; + //DbgPrint("Fsync is idle, not connected, write 0xc38 = 0x%x \n", pHalData->framesync); + } + } + } + } + if(priv->framesyncMonitor) + { + if(priv->reset_count != reset_cnt) + { //After silent reset, the reg_c38_State will be returned to default value + write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync); + reg_c38_State = RegC38_Default; + reset_cnt = priv->reset_count; + //DbgPrint("reg_c38_State = 0 for silent reset. \n"); + } + } + else + { + if(reg_c38_State) + { + write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync); + reg_c38_State = RegC38_Default; + //DbgPrint("framesync no monitor, write 0xc38 = 0x%x \n", pHalData->framesync); + } + } +} + +#if 0 +/*----------------------------------------------------------------------------- + * Function: DM_CheckLBusStatus() + * + * Overview: For 9x series, we must make sure LBUS is active for IO. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 02/22/2008 MHC Create Version 0. + * + *---------------------------------------------------------------------------*/ +extern s1Byte DM_CheckLBusStatus(IN PADAPTER Adapter) +{ + PMGNT_INFO pMgntInfo=&Adapter->MgntInfo; + +#if (HAL_CODE_BASE & RTL819X) + +#if (HAL_CODE_BASE == RTL8192) + +#if( DEV_BUS_TYPE==PCI_INTERFACE) + //return (pMgntInfo->bLbusEnable); // For debug only + return TRUE; +#endif + +#if( DEV_BUS_TYPE==USB_INTERFACE) + return TRUE; +#endif + +#endif // #if (HAL_CODE_BASE == RTL8192) + +#if (HAL_CODE_BASE == RTL8190) + return TRUE; +#endif // #if (HAL_CODE_BASE == RTL8190) + +#endif // #if (HAL_CODE_BASE & RTL819X) +} /* DM_CheckLBusStatus */ + +#endif + +/*----------------------------------------------------------------------------- + * Function: dm_shadow_init() + * + * Overview: Store all NIC MAC/BB register content. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/29/2008 amy Create Version 0 porting from windows code. + * + *---------------------------------------------------------------------------*/ +extern void dm_shadow_init(struct net_device *dev) +{ + u8 page; + u16 offset; + + for (page = 0; page < 5; page++) + for (offset = 0; offset < 256; offset++) + { + dm_shadow[page][offset] = read_nic_byte(dev, offset+page*256); + //DbgPrint("P-%d/O-%02x=%02x\r\n", page, offset, DM_Shadow[page][offset]); + } + + for (page = 8; page < 11; page++) + for (offset = 0; offset < 256; offset++) + dm_shadow[page][offset] = read_nic_byte(dev, offset+page*256); + + for (page = 12; page < 15; page++) + for (offset = 0; offset < 256; offset++) + dm_shadow[page][offset] = read_nic_byte(dev, offset+page*256); + +} /* dm_shadow_init */ + +/*---------------------------Define function prototype------------------------*/ +/*----------------------------------------------------------------------------- + * Function: DM_DynamicTxPower() + * + * Overview: Detect Signal strength to control TX Registry + Tx Power Control For Near/Far Range + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 03/06/2008 Jacken Create Version 0. + * + *---------------------------------------------------------------------------*/ +static void dm_init_dynamic_txpower(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + //Initial TX Power Control for near/far range , add by amy 2008/05/15, porting from windows code. + priv->ieee80211->bdynamic_txpower_enable = true; //Default to enable Tx Power Control + priv->bLastDTPFlag_High = false; + priv->bLastDTPFlag_Low = false; + priv->bDynamicTxHighPower = false; + priv->bDynamicTxLowPower = false; +} + +static void dm_dynamic_txpower(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + unsigned int txhipower_threshhold=0; + unsigned int txlowpower_threshold=0; + if(priv->ieee80211->bdynamic_txpower_enable != true) + { + priv->bDynamicTxHighPower = false; + priv->bDynamicTxLowPower = false; + return; + } + //printk("priv->ieee80211->current_network.unknown_cap_exist is %d ,priv->ieee80211->current_network.broadcom_cap_exist is %d\n",priv->ieee80211->current_network.unknown_cap_exist,priv->ieee80211->current_network.broadcom_cap_exist); + if((priv->ieee80211->current_network.atheros_cap_exist ) && (priv->ieee80211->mode == IEEE_G)){ + txhipower_threshhold = TX_POWER_ATHEROAP_THRESH_HIGH; + txlowpower_threshold = TX_POWER_ATHEROAP_THRESH_LOW; + } + else + { + txhipower_threshhold = TX_POWER_NEAR_FIELD_THRESH_HIGH; + txlowpower_threshold = TX_POWER_NEAR_FIELD_THRESH_LOW; + } + +// printk("=======>%s(): txhipower_threshhold is %d,txlowpower_threshold is %d\n",__FUNCTION__,txhipower_threshhold,txlowpower_threshold); + RT_TRACE(COMP_TXAGC,"priv->undecorated_smoothed_pwdb = %ld \n" , priv->undecorated_smoothed_pwdb); + + if(priv->ieee80211->state == IEEE80211_LINKED) + { + if(priv->undecorated_smoothed_pwdb >= txhipower_threshhold) + { + priv->bDynamicTxHighPower = true; + priv->bDynamicTxLowPower = false; + } + else + { + // high power state check + if(priv->undecorated_smoothed_pwdb < txlowpower_threshold && priv->bDynamicTxHighPower == true) + { + priv->bDynamicTxHighPower = false; + } + // low power state check + if(priv->undecorated_smoothed_pwdb < 35) + { + priv->bDynamicTxLowPower = true; + } + else if(priv->undecorated_smoothed_pwdb >= 40) + { + priv->bDynamicTxLowPower = false; + } + } + } + else + { + //pHalData->bTXPowerCtrlforNearFarRange = !pHalData->bTXPowerCtrlforNearFarRange; + priv->bDynamicTxHighPower = false; + priv->bDynamicTxLowPower = false; + } + + if( (priv->bDynamicTxHighPower != priv->bLastDTPFlag_High ) || + (priv->bDynamicTxLowPower != priv->bLastDTPFlag_Low ) ) + { + RT_TRACE(COMP_TXAGC,"SetTxPowerLevel8190() channel = %d \n" , priv->ieee80211->current_network.channel); + +#if defined(RTL8190P) || defined(RTL8192E) + SetTxPowerLevel8190(Adapter,pHalData->CurrentChannel); +#endif + +#ifdef RTL8192U + rtl8192_phy_setTxPower(dev,priv->ieee80211->current_network.channel); + //pHalData->bStartTxCtrlByTPCNFR = FALSE; //Clear th flag of Set TX Power from Sitesurvey +#endif + } + priv->bLastDTPFlag_High = priv->bDynamicTxHighPower; + priv->bLastDTPFlag_Low = priv->bDynamicTxLowPower; + +} /* dm_dynamic_txpower */ + +//added by vivi, for read tx rate and retrycount +static void dm_check_txrateandretrycount(struct net_device * dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + struct ieee80211_device* ieee = priv->ieee80211; + //for 11n tx rate +// priv->stats.CurrentShowTxate = read_nic_byte(dev, Current_Tx_Rate_Reg); + ieee->softmac_stats.CurrentShowTxate = read_nic_byte(dev, Current_Tx_Rate_Reg); + //printk("=============>tx_rate_reg:%x\n", ieee->softmac_stats.CurrentShowTxate); + //for initial tx rate +// priv->stats.last_packet_rate = read_nic_byte(dev, Initial_Tx_Rate_Reg); + ieee->softmac_stats.last_packet_rate = read_nic_byte(dev ,Initial_Tx_Rate_Reg); + //for tx tx retry count +// priv->stats.txretrycount = read_nic_dword(dev, Tx_Retry_Count_Reg); + ieee->softmac_stats.txretrycount = read_nic_dword(dev, Tx_Retry_Count_Reg); +} + +static void dm_send_rssi_tofw(struct net_device *dev) +{ + DCMD_TXCMD_T tx_cmd; + struct r8192_priv *priv = ieee80211_priv(dev); + + // If we test chariot, we should stop the TX command ? + // Because 92E will always silent reset when we send tx command. We use register + // 0x1e0(byte) to botify driver. + write_nic_byte(dev, DRIVER_RSSI, (u8)priv->undecorated_smoothed_pwdb); + return; +#if 1 + tx_cmd.Op = TXCMD_SET_RX_RSSI; + tx_cmd.Length = 4; + tx_cmd.Value = priv->undecorated_smoothed_pwdb; + + cmpk_message_handle_tx(dev, (u8*)&tx_cmd, + DESC_PACKET_TYPE_INIT, sizeof(DCMD_TXCMD_T)); +#endif +} + +/*---------------------------Define function prototype------------------------*/ + diff --git a/drivers/staging/rtl8192u/r8192U_dm.h b/drivers/staging/rtl8192u/r8192U_dm.h new file mode 100644 index 000000000000..1e05d7579882 --- /dev/null +++ b/drivers/staging/rtl8192u/r8192U_dm.h @@ -0,0 +1,309 @@ +/***************************************************************************** + * Copyright(c) 2007, RealTEK Technology Inc. All Right Reserved. + * + * Module: Hal819xUsbDM.h (RTL8192 Header H File) + * + * + * Note: For dynamic control definition constant structure. + * + * + * Export: + * + * Abbrev: + * + * History: + * Data Who Remark + * 10/04/2007 MHC Create initial version. + * + *****************************************************************************/ + /* Check to see if the file has been included already. */ +#ifndef __R8192UDM_H__ +#define __R8192UDM_H__ + + +/*--------------------------Define Parameters-------------------------------*/ +#define DM_DIG_THRESH_HIGH 40 +#define DM_DIG_THRESH_LOW 35 + +#define DM_DIG_HIGH_PWR_THRESH_HIGH 75 +#define DM_DIG_HIGH_PWR_THRESH_LOW 70 + +#define BW_AUTO_SWITCH_HIGH_LOW 25 +#define BW_AUTO_SWITCH_LOW_HIGH 30 + +#define DM_check_fsync_time_interval 500 + + +#define DM_DIG_BACKOFF 12 +#define DM_DIG_MAX 0x36 +#define DM_DIG_MIN 0x1c +#define DM_DIG_MIN_Netcore 0x12 + +#define RxPathSelection_SS_TH_low 30 +#define RxPathSelection_diff_TH 18 + +#define RateAdaptiveTH_High 50 +#define RateAdaptiveTH_Low_20M 30 +#define RateAdaptiveTH_Low_40M 10 +#define VeryLowRSSI 15 +#define CTSToSelfTHVal 30 + +//defined by vivi, for tx power track +#define E_FOR_TX_POWER_TRACK 300 +//Dynamic Tx Power Control Threshold +#define TX_POWER_NEAR_FIELD_THRESH_HIGH 68 +#define TX_POWER_NEAR_FIELD_THRESH_LOW 62 +//added by amy for atheros AP +#define TX_POWER_ATHEROAP_THRESH_HIGH 78 +#define TX_POWER_ATHEROAP_THRESH_LOW 72 + +//defined by vivi, for showing on UI +#define Current_Tx_Rate_Reg 0x1b8 +#define Initial_Tx_Rate_Reg 0x1b9 +#define Tx_Retry_Count_Reg 0x1ac +#define RegC38_TH 20 +#if 0 +//---------------------------------------------------------------------------- +// 8190 Rate Adaptive Table Register (offset 0x320, 4 byte) +//---------------------------------------------------------------------------- + +//CCK +#define RATR_1M 0x00000001 +#define RATR_2M 0x00000002 +#define RATR_55M 0x00000004 +#define RATR_11M 0x00000008 +//OFDM +#define RATR_6M 0x00000010 +#define RATR_9M 0x00000020 +#define RATR_12M 0x00000040 +#define RATR_18M 0x00000080 +#define RATR_24M 0x00000100 +#define RATR_36M 0x00000200 +#define RATR_48M 0x00000400 +#define RATR_54M 0x00000800 +//MCS 1 Spatial Stream +#define RATR_MCS0 0x00001000 +#define RATR_MCS1 0x00002000 +#define RATR_MCS2 0x00004000 +#define RATR_MCS3 0x00008000 +#define RATR_MCS4 0x00010000 +#define RATR_MCS5 0x00020000 +#define RATR_MCS6 0x00040000 +#define RATR_MCS7 0x00080000 +//MCS 2 Spatial Stream +#define RATR_MCS8 0x00100000 +#define RATR_MCS9 0x00200000 +#define RATR_MCS10 0x00400000 +#define RATR_MCS11 0x00800000 +#define RATR_MCS12 0x01000000 +#define RATR_MCS13 0x02000000 +#define RATR_MCS14 0x04000000 +#define RATR_MCS15 0x08000000 +// ALL CCK Rate +#define RATE_ALL_CCK RATR_1M|RATR_2M|RATR_55M|RATR_11M +#define RATE_ALL_OFDM_AG RATR_6M|RATR_9M|RATR_12M|RATR_18M|RATR_24M\ + |RATR_36M|RATR_48M|RATR_54M +#define RATE_ALL_OFDM_2SS RATR_MCS8|RATR_MCS9 |RATR_MCS10|RATR_MCS11| \ + RATR_MCS12|RATR_MCS13|RATR_MCS14|RATR_MCS15 +#endif +/*--------------------------Define Parameters-------------------------------*/ + + +/*------------------------------Define structure----------------------------*/ +/* 2007/10/04 MH Define upper and lower threshold of DIG enable or disable. */ +typedef struct _dynamic_initial_gain_threshold_ +{ + u8 dig_enable_flag; + u8 dig_algorithm; + u8 dbg_mode; + u8 dig_algorithm_switch; + + long rssi_low_thresh; + long rssi_high_thresh; + + long rssi_high_power_lowthresh; + long rssi_high_power_highthresh; + + u8 dig_state; + u8 dig_highpwr_state; + u8 cur_connect_state; + u8 pre_connect_state; + + u8 curpd_thstate; + u8 prepd_thstate; + u8 curcs_ratio_state; + u8 precs_ratio_state; + + u32 pre_ig_value; + u32 cur_ig_value; + + u8 backoff_val; + u8 rx_gain_range_max; + u8 rx_gain_range_min; + bool initialgain_lowerbound_state; + + long rssi_val; +}dig_t; + +typedef enum tag_dynamic_init_gain_state_definition +{ + DM_STA_DIG_OFF = 0, + DM_STA_DIG_ON, + DM_STA_DIG_MAX +}dm_dig_sta_e; + + +/* 2007/10/08 MH Define RATR state. */ +typedef enum tag_dynamic_ratr_state_definition +{ + DM_RATR_STA_HIGH = 0, + DM_RATR_STA_MIDDLE = 1, + DM_RATR_STA_LOW = 2, + DM_RATR_STA_MAX +}dm_ratr_sta_e; + +/* 2007/10/11 MH Define DIG operation type. */ +typedef enum tag_dynamic_init_gain_operation_type_definition +{ + DIG_TYPE_THRESH_HIGH = 0, + DIG_TYPE_THRESH_LOW = 1, + DIG_TYPE_THRESH_HIGHPWR_HIGH = 2, + DIG_TYPE_THRESH_HIGHPWR_LOW = 3, + DIG_TYPE_DBG_MODE = 4, + DIG_TYPE_RSSI = 5, + DIG_TYPE_ALGORITHM = 6, + DIG_TYPE_BACKOFF = 7, + DIG_TYPE_PWDB_FACTOR = 8, + DIG_TYPE_RX_GAIN_MIN = 9, + DIG_TYPE_RX_GAIN_MAX = 10, + DIG_TYPE_ENABLE = 20, + DIG_TYPE_DISABLE = 30, + DIG_OP_TYPE_MAX +}dm_dig_op_e; + +typedef enum tag_dig_algorithm_definition +{ + DIG_ALGO_BY_FALSE_ALARM = 0, + DIG_ALGO_BY_RSSI = 1, + DIG_ALGO_MAX +}dm_dig_alg_e; + +typedef enum tag_dig_dbgmode_definition +{ + DIG_DBG_OFF = 0, + DIG_DBG_ON = 1, + DIG_DBG_MAX +}dm_dig_dbg_e; + +typedef enum tag_dig_connect_definition +{ + DIG_DISCONNECT = 0, + DIG_CONNECT = 1, + DIG_CONNECT_MAX +}dm_dig_connect_e; + +typedef enum tag_dig_packetdetection_threshold_definition +{ + DIG_PD_AT_LOW_POWER = 0, + DIG_PD_AT_NORMAL_POWER = 1, + DIG_PD_AT_HIGH_POWER = 2, + DIG_PD_MAX +}dm_dig_pd_th_e; + +typedef enum tag_dig_cck_cs_ratio_state_definition +{ + DIG_CS_RATIO_LOWER = 0, + DIG_CS_RATIO_HIGHER = 1, + DIG_CS_MAX +}dm_dig_cs_ratio_e; +typedef struct _Dynamic_Rx_Path_Selection_ +{ + u8 Enable; + u8 DbgMode; + u8 cck_method; + u8 cck_Rx_path; + + u8 SS_TH_low; + u8 diff_TH; + u8 disabledRF; + u8 reserved; + + u8 rf_rssi[4]; + u8 rf_enable_rssi_th[4]; + long cck_pwdb_sta[4]; +}DRxPathSel; + +typedef enum tag_CCK_Rx_Path_Method_Definition +{ + CCK_Rx_Version_1 = 0, + CCK_Rx_Version_2= 1, + CCK_Rx_Version_MAX +}DM_CCK_Rx_Path_Method; + +typedef enum tag_DM_DbgMode_Definition +{ + DM_DBG_OFF = 0, + DM_DBG_ON = 1, + DM_DBG_MAX +}DM_DBG_E; + +typedef struct tag_Tx_Config_Cmd_Format +{ + u32 Op; /* Command packet type. */ + u32 Length; /* Command packet length. */ + u32 Value; +}DCMD_TXCMD_T, *PDCMD_TXCMD_T; +/*------------------------------Define structure----------------------------*/ + + +/*------------------------Export global variable----------------------------*/ +extern dig_t dm_digtable; +extern u8 dm_shadow[16][256]; +extern DRxPathSel DM_RxPathSelTable; +/*------------------------Export global variable----------------------------*/ + + +/*------------------------Export Marco Definition---------------------------*/ + +/*------------------------Export Marco Definition---------------------------*/ + + +/*--------------------------Exported Function prototype---------------------*/ +extern void init_hal_dm(struct net_device *dev); +extern void deinit_hal_dm(struct net_device *dev); + +extern void hal_dm_watchdog(struct net_device *dev); + +extern void init_rate_adaptive(struct net_device *dev); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +extern void dm_txpower_trackingcallback(struct work_struct *work); +#else +extern void dm_txpower_trackingcallback(struct net_device *dev); +#endif +extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); +extern void dm_backup_dynamic_mechanism_state(struct net_device *dev); +extern void dm_change_dynamic_initgain_thresh(struct net_device *dev, + u32 dm_type, u32 dm_value); +extern void dm_force_tx_fw_info(struct net_device *dev,u32 force_type, u32 force_value); +extern void dm_init_edca_turbo(struct net_device *dev); +extern void dm_rf_operation_test_callback(unsigned long data); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work); +#else +extern void dm_rf_pathcheck_workitemcallback(struct net_device *dev); +#endif +extern void dm_fsync_timer_callback(unsigned long data); +extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14); +#if 0 +extern char dm_check_lbus_status(IN PADAPTER Adapter); +#endif +extern void dm_shadow_init(struct net_device *dev); +extern void dm_initialize_txpower_tracking(struct net_device *dev); +/*--------------------------Exported Function prototype---------------------*/ + + +#endif /*__R8192UDM_H__ */ + + +/* End of r8192U_dm.h */ + diff --git a/drivers/staging/rtl8192u/r8192U_hw.h b/drivers/staging/rtl8192u/r8192U_hw.h new file mode 100644 index 000000000000..1ebacc9c66ff --- /dev/null +++ b/drivers/staging/rtl8192u/r8192U_hw.h @@ -0,0 +1,746 @@ +/* + This is part of rtl8187 OpenSource driver. + Copyright (C) Andrea Merello 2004-2005 + Released under the terms of GPL (General Public Licence) + + Parts of this driver are based on the GPL part of the + official Realtek driver. + Parts of this driver are based on the rtl8180 driver skeleton + from Patric Schenke & Andres Salomon. + Parts of this driver are based on the Intel Pro Wireless + 2100 GPL driver. + + We want to tanks the Authors of those projects + and the Ndiswrapper project Authors. +*/ + +/* Mariusz Matuszek added full registers definition with Realtek's name */ + +/* this file contains register definitions for the rtl8187 MAC controller */ +#ifndef R8192_HW +#define R8192_HW + +typedef enum _VERSION_819xU{ + VERSION_819xU_A, // A-cut + VERSION_819xU_B, // B-cut + VERSION_819xU_C,// C-cut +}VERSION_819xU,*PVERSION_819xU; +//added for different RF type +typedef enum _RT_RF_TYPE_DEF +{ + RF_1T2R = 0, + RF_2T4R, + + RF_819X_MAX_TYPE +}RT_RF_TYPE_DEF; + + +typedef enum _BaseBand_Config_Type{ + BaseBand_Config_PHY_REG = 0, //Radio Path A + BaseBand_Config_AGC_TAB = 1, //Radio Path B +}BaseBand_Config_Type, *PBaseBand_Config_Type; +#if 0 +typedef enum _RT_RF_TYPE_819xU{ + RF_TYPE_MIN = 0, + RF_8225, + RF_8256, + RF_8258, + RF_PSEUDO_11N = 4, +}RT_RF_TYPE_819xU, *PRT_RF_TYPE_819xU; +#endif +#define RTL8187_REQT_READ 0xc0 +#define RTL8187_REQT_WRITE 0x40 +#define RTL8187_REQ_GET_REGS 0x05 +#define RTL8187_REQ_SET_REGS 0x05 + +#define MAX_TX_URB 5 +#define MAX_RX_URB 16 + +#define R8180_MAX_RETRY 255 +//#define MAX_RX_NORMAL_URB 3 +//#define MAX_RX_COMMAND_URB 2 +#define RX_URB_SIZE 9100 + +#define BB_ANTATTEN_CHAN14 0x0c +#define BB_ANTENNA_B 0x40 + +#define BB_HOST_BANG (1<<30) +#define BB_HOST_BANG_EN (1<<2) +#define BB_HOST_BANG_CLK (1<<1) +#define BB_HOST_BANG_RW (1<<3) +#define BB_HOST_BANG_DATA 1 + +//#if (RTL819X_FPGA_VER & RTL819X_FPGA_VIVI_070920) +#define AFR 0x010 +#define AFR_CardBEn (1<<0) +#define AFR_CLKRUN_SEL (1<<1) +#define AFR_FuncRegEn (1<<2) +#define RTL8190_EEPROM_ID 0x8129 +#define EEPROM_VID 0x02 +#define EEPROM_PID 0x04 +#define EEPROM_NODE_ADDRESS_BYTE_0 0x0C + +#define EEPROM_TxPowerDiff 0x1F +#define EEPROM_ThermalMeter 0x20 +#define EEPROM_PwDiff 0x21 //0x21 +#define EEPROM_CrystalCap 0x22 //0x22 + +#define EEPROM_TxPwIndex_CCK 0x23 //0x23 +#define EEPROM_TxPwIndex_OFDM_24G 0x24 //0x24~0x26 +#define EEPROM_TxPwIndex_CCK_V1 0x29 //0x29~0x2B +#define EEPROM_TxPwIndex_OFDM_24G_V1 0x2C //0x2C~0x2E +#define EEPROM_TxPwIndex_Ver 0x27 //0x27 + +#define EEPROM_Default_TxPowerDiff 0x0 +#define EEPROM_Default_ThermalMeter 0x7 +#define EEPROM_Default_PwDiff 0x4 +#define EEPROM_Default_CrystalCap 0x5 +#define EEPROM_Default_TxPower 0x1010 +#define EEPROM_Customer_ID 0x7B //0x7B:CustomerID +#define EEPROM_ChannelPlan 0x16 //0x7C +#define EEPROM_IC_VER 0x7d //0x7D +#define EEPROM_CRC 0x7e //0x7E~0x7F + +#define EEPROM_CID_DEFAULT 0x0 +#define EEPROM_CID_CAMEO 0x1 +#define EEPROM_CID_RUNTOP 0x2 +#define EEPROM_CID_Senao 0x3 +#define EEPROM_CID_TOSHIBA 0x4 // Toshiba setting, Merge by Jacken, 2008/01/31 +#define EEPROM_CID_NetCore 0x5 +#define EEPROM_CID_Nettronix 0x6 +#define EEPROM_CID_Pronet 0x7 +#define EEPROM_CID_DLINK 0x8 + +#define AC_PARAM_TXOP_LIMIT_OFFSET 16 +#define AC_PARAM_ECW_MAX_OFFSET 12 +#define AC_PARAM_ECW_MIN_OFFSET 8 +#define AC_PARAM_AIFS_OFFSET 0 + +//#endif +enum _RTL8192Usb_HW { + + PCIF = 0x009, // PCI Function Register 0x0009h~0x000bh +#define BB_GLOBAL_RESET_BIT 0x1 + BB_GLOBAL_RESET = 0x020, // BasebandGlobal Reset Register + BSSIDR = 0x02E, // BSSID Register + CMDR = 0x037, // Command register +#define CR_RST 0x10 +#define CR_RE 0x08 +#define CR_TE 0x04 +#define CR_MulRW 0x01 + SIFS = 0x03E, // SIFS register + TCR = 0x040, // Transmit Configuration Register + +#define TCR_MXDMA_2048 7 +#define TCR_LRL_OFFSET 0 +#define TCR_SRL_OFFSET 8 +#define TCR_MXDMA_OFFSET 21 +#define TCR_SAT BIT24 // Enable Rate depedent ack timeout timer + RCR = 0x044, // Receive Configuration Register +#define MAC_FILTER_MASK ((1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<5) | \ + (1<<12) | (1<<18) | (1<<19) | (1<<20) | (1<<21) | (1<<22) | (1<<23)) +#define RX_FIFO_THRESHOLD_MASK ((1<<13) | (1<<14) | (1<<15)) +#define RX_FIFO_THRESHOLD_SHIFT 13 +#define RX_FIFO_THRESHOLD_128 3 +#define RX_FIFO_THRESHOLD_256 4 +#define RX_FIFO_THRESHOLD_512 5 +#define RX_FIFO_THRESHOLD_1024 6 +#define RX_FIFO_THRESHOLD_NONE 7 +#define MAX_RX_DMA_MASK ((1<<8) | (1<<9) | (1<<10)) +#define RCR_MXDMA_OFFSET 8 +#define RCR_FIFO_OFFSET 13 +#define RCR_ONLYERLPKT BIT31 // Early Receiving based on Packet Size. +#define RCR_ENCS2 BIT30 // Enable Carrier Sense Detection Method 2 +#define RCR_ENCS1 BIT29 // Enable Carrier Sense Detection Method 1 +#define RCR_ENMBID BIT27 // Enable Multiple BssId. +#define RCR_ACKTXBW (BIT24|BIT25) // TXBW Setting of ACK frames +#define RCR_CBSSID BIT23 // Accept BSSID match packet +#define RCR_APWRMGT BIT22 // Accept power management packet +#define RCR_ADD3 BIT21 // Accept address 3 match packet +#define RCR_AMF BIT20 // Accept management type frame +#define RCR_ACF BIT19 // Accept control type frame +#define RCR_ADF BIT18 // Accept data type frame +#define RCR_RXFTH BIT13 // Rx FIFO Threshold +#define RCR_AICV BIT12 // Accept ICV error packet +#define RCR_ACRC32 BIT5 // Accept CRC32 error packet +#define RCR_AB BIT3 // Accept broadcast packet +#define RCR_AM BIT2 // Accept multicast packet +#define RCR_APM BIT1 // Accept physical match packet +#define RCR_AAP BIT0 // Accept all unicast packet + SLOT_TIME = 0x049, // Slot Time Register + ACK_TIMEOUT = 0x04c, // Ack Timeout Register + PIFS_TIME = 0x04d, // PIFS time + USTIME = 0x04e, // Microsecond Tuning Register, Sets the microsecond time unit used by MAC clock. + EDCAPARA_BE = 0x050, // EDCA Parameter of AC BE + EDCAPARA_BK = 0x054, // EDCA Parameter of AC BK + EDCAPARA_VO = 0x058, // EDCA Parameter of AC VO + EDCAPARA_VI = 0x05C, // EDCA Parameter of AC VI + RFPC = 0x05F, // Rx FIFO Packet Count + CWRR = 0x060, // Contention Window Report Register + BCN_TCFG = 0x062, // Beacon Time Configuration +#define BCN_TCFG_CW_SHIFT 8 +#define BCN_TCFG_IFS 0 + BCN_INTERVAL = 0x070, // Beacon Interval (TU) + ATIMWND = 0x072, // ATIM Window Size (TU) + BCN_DRV_EARLY_INT = 0x074, // Driver Early Interrupt Time (TU). Time to send interrupt to notify to change beacon content before TBTT + BCN_DMATIME = 0x076, // Beacon DMA and ATIM interrupt time (US). Indicates the time before TBTT to perform beacon queue DMA + BCN_ERR_THRESH = 0x078, // Beacon Error Threshold + RWCAM = 0x0A0, //IN 8190 Data Sheet is called CAMcmd + WCAMI = 0x0A4, // Software write CAM input content + RCAMO = 0x0A8, // Software read/write CAM config + SECR = 0x0B0, //Security Configuration Register +#define SCR_TxUseDK BIT0 //Force Tx Use Default Key +#define SCR_RxUseDK BIT1 //Force Rx Use Default Key +#define SCR_TxEncEnable BIT2 //Enable Tx Encryption +#define SCR_RxDecEnable BIT3 //Enable Rx Decryption +#define SCR_SKByA2 BIT4 //Search kEY BY A2 +#define SCR_NoSKMC BIT5 //No Key Search for Multicast +#define SCR_UseDK 0x01 +#define SCR_TxSecEnable 0x02 +#define SCR_RxSecEnable 0x04 + TPPoll = 0x0fd, // Transmit priority polling register + PSR = 0x0ff, // Page Select Register +#define CPU_CCK_LOOPBACK 0x00030000 +#define CPU_GEN_SYSTEM_RESET 0x00000001 +#define CPU_GEN_FIRMWARE_RESET 0x00000008 +#define CPU_GEN_BOOT_RDY 0x00000010 +#define CPU_GEN_FIRM_RDY 0x00000020 +#define CPU_GEN_PUT_CODE_OK 0x00000080 +#define CPU_GEN_BB_RST 0x00000100 +#define CPU_GEN_PWR_STB_CPU 0x00000004 +#define CPU_GEN_NO_LOOPBACK_MSK 0xFFF8FFFF // Set bit18,17,16 to 0. Set bit19 +#define CPU_GEN_NO_LOOPBACK_SET 0x00080000 // Set BIT19 to 1 + +//---------------------------------------------------------------------------- +// 8190 CPU General Register (offset 0x100, 4 byte) +//---------------------------------------------------------------------------- +#define CPU_CCK_LOOPBACK 0x00030000 +#define CPU_GEN_SYSTEM_RESET 0x00000001 +#define CPU_GEN_FIRMWARE_RESET 0x00000008 +#define CPU_GEN_BOOT_RDY 0x00000010 +#define CPU_GEN_FIRM_RDY 0x00000020 +#define CPU_GEN_PUT_CODE_OK 0x00000080 +#define CPU_GEN_BB_RST 0x00000100 +#define CPU_GEN_PWR_STB_CPU 0x00000004 +#define CPU_GEN_NO_LOOPBACK_MSK 0xFFF8FFFF // Set bit18,17,16 to 0. Set bit19 +#define CPU_GEN_NO_LOOPBACK_SET 0x00080000 // Set BIT19 to 1 + CPU_GEN = 0x100, // CPU Reset Register + LED1Cfg = 0x154,// LED1 Configuration Register + LED0Cfg = 0x155,// LED0 Configuration Register + + AcmAvg = 0x170, // ACM Average Period Register + AcmHwCtrl = 0x171, // ACM Hardware Control Register +//---------------------------------------------------------------------------- +//// +//// 8190 AcmHwCtrl bits (offset 0x171, 1 byte) +////---------------------------------------------------------------------------- +// +#define AcmHw_HwEn BIT0 +#define AcmHw_BeqEn BIT1 +#define AcmHw_ViqEn BIT2 +#define AcmHw_VoqEn BIT3 +#define AcmHw_BeqStatus BIT4 +#define AcmHw_ViqStatus BIT5 +#define AcmHw_VoqStatus BIT6 + + AcmFwCtrl = 0x172, // ACM Firmware Control Register + AES_11N_FIX = 0x173, + VOAdmTime = 0x174, // VO Queue Admitted Time Register + VIAdmTime = 0x178, // VI Queue Admitted Time Register + BEAdmTime = 0x17C, // BE Queue Admitted Time Register + RQPN1 = 0x180, // Reserved Queue Page Number , Vo Vi, Be, Bk + RQPN2 = 0x184, // Reserved Queue Page Number, HCCA, Cmd, Mgnt, High + RQPN3 = 0x188, // Reserved Queue Page Number, Bcn, Public, +// QPRR = 0x1E0, // Queue Page Report per TID + QPNR = 0x1D0, //0x1F0, // Queue Packet Number report per TID + BQDA = 0x200, // Beacon Queue Descriptor Address + HQDA = 0x204, // High Priority Queue Descriptor Address + CQDA = 0x208, // Command Queue Descriptor Address + MQDA = 0x20C, // Management Queue Descriptor Address + HCCAQDA = 0x210, // HCCA Queue Descriptor Address + VOQDA = 0x214, // VO Queue Descriptor Address + VIQDA = 0x218, // VI Queue Descriptor Address + BEQDA = 0x21C, // BE Queue Descriptor Address + BKQDA = 0x220, // BK Queue Descriptor Address + RCQDA = 0x224, // Receive command Queue Descriptor Address + RDQDA = 0x228, // Receive Queue Descriptor Start Address + + MAR0 = 0x240, // Multicast filter. + MAR4 = 0x244, + + CCX_PERIOD = 0x250, // CCX Measurement Period Register, in unit of TU. + CLM_RESULT = 0x251, // CCA Busy fraction register. + NHM_PERIOD = 0x252, // NHM Measurement Period register, in unit of TU. + + NHM_THRESHOLD0 = 0x253, // Noise Histogram Meashorement0. + NHM_THRESHOLD1 = 0x254, // Noise Histogram Meashorement1. + NHM_THRESHOLD2 = 0x255, // Noise Histogram Meashorement2. + NHM_THRESHOLD3 = 0x256, // Noise Histogram Meashorement3. + NHM_THRESHOLD4 = 0x257, // Noise Histogram Meashorement4. + NHM_THRESHOLD5 = 0x258, // Noise Histogram Meashorement5. + NHM_THRESHOLD6 = 0x259, // Noise Histogram Meashorement6 + + MCTRL = 0x25A, // Measurement Control + + NHM_RPI_COUNTER0 = 0x264, // Noise Histogram RPI counter0, the fraction of signal strength < NHM_THRESHOLD0. + NHM_RPI_COUNTER1 = 0x265, // Noise Histogram RPI counter1, the fraction of signal strength in (NHM_THRESHOLD0, NHM_THRESHOLD1]. + NHM_RPI_COUNTER2 = 0x266, // Noise Histogram RPI counter2, the fraction of signal strength in (NHM_THRESHOLD1, NHM_THRESHOLD2]. + NHM_RPI_COUNTER3 = 0x267, // Noise Histogram RPI counter3, the fraction of signal strength in (NHM_THRESHOLD2, NHM_THRESHOLD3]. + NHM_RPI_COUNTER4 = 0x268, // Noise Histogram RPI counter4, the fraction of signal strength in (NHM_THRESHOLD3, NHM_THRESHOLD4]. + NHM_RPI_COUNTER5 = 0x269, // Noise Histogram RPI counter5, the fraction of signal strength in (NHM_THRESHOLD4, NHM_THRESHOLD5]. + NHM_RPI_COUNTER6 = 0x26A, // Noise Histogram RPI counter6, the fraction of signal strength in (NHM_THRESHOLD5, NHM_THRESHOLD6]. + NHM_RPI_COUNTER7 = 0x26B, // Noise Histogram RPI counter7, the fraction of signal strength in (NHM_THRESHOLD6, NHM_THRESHOLD7]. +#define BW_OPMODE_11J BIT0 +#define BW_OPMODE_5G BIT1 +#define BW_OPMODE_20MHZ BIT2 + BW_OPMODE = 0x300, // Bandwidth operation mode + MSR = 0x303, // Media Status register +#define MSR_LINK_MASK ((1<<0)|(1<<1)) +#define MSR_LINK_MANAGED 2 +#define MSR_LINK_NONE 0 +#define MSR_LINK_SHIFT 0 +#define MSR_LINK_ADHOC 1 +#define MSR_LINK_MASTER 3 +#define MSR_LINK_ENEDCA (1<<4) + RETRY_LIMIT = 0x304, // Retry Limit [15:8]-short, [7:0]-long +#define RETRY_LIMIT_SHORT_SHIFT 8 +#define RETRY_LIMIT_LONG_SHIFT 0 + TSFR = 0x308, + RRSR = 0x310, // Response Rate Set +#define RRSR_RSC_OFFSET 21 +#define RRSR_SHORT_OFFSET 23 +#define RRSR_RSC_DUPLICATE 0x600000 +#define RRSR_RSC_LOWSUBCHNL 0x400000 +#define RRSR_RSC_UPSUBCHANL 0x200000 +#define RRSR_SHORT 0x800000 +#define RRSR_1M BIT0 +#define RRSR_2M BIT1 +#define RRSR_5_5M BIT2 +#define RRSR_11M BIT3 +#define RRSR_6M BIT4 +#define RRSR_9M BIT5 +#define RRSR_12M BIT6 +#define RRSR_18M BIT7 +#define RRSR_24M BIT8 +#define RRSR_36M BIT9 +#define RRSR_48M BIT10 +#define RRSR_54M BIT11 +#define RRSR_MCS0 BIT12 +#define RRSR_MCS1 BIT13 +#define RRSR_MCS2 BIT14 +#define RRSR_MCS3 BIT15 +#define RRSR_MCS4 BIT16 +#define RRSR_MCS5 BIT17 +#define RRSR_MCS6 BIT18 +#define RRSR_MCS7 BIT19 +#define BRSR_AckShortPmb BIT23 // CCK ACK: use Short Preamble or not. + RATR0 = 0x320, // Rate Adaptive Table register1 + UFWP = 0x318, + DRIVER_RSSI = 0x32c, // Driver tell Firmware current RSSI +//---------------------------------------------------------------------------- +// 8190 Rate Adaptive Table Register (offset 0x320, 4 byte) +//---------------------------------------------------------------------------- +//CCK +#define RATR_1M 0x00000001 +#define RATR_2M 0x00000002 +#define RATR_55M 0x00000004 +#define RATR_11M 0x00000008 +//OFDM +#define RATR_6M 0x00000010 +#define RATR_9M 0x00000020 +#define RATR_12M 0x00000040 +#define RATR_18M 0x00000080 +#define RATR_24M 0x00000100 +#define RATR_36M 0x00000200 +#define RATR_48M 0x00000400 +#define RATR_54M 0x00000800 +//MCS 1 Spatial Stream +#define RATR_MCS0 0x00001000 +#define RATR_MCS1 0x00002000 +#define RATR_MCS2 0x00004000 +#define RATR_MCS3 0x00008000 +#define RATR_MCS4 0x00010000 +#define RATR_MCS5 0x00020000 +#define RATR_MCS6 0x00040000 +#define RATR_MCS7 0x00080000 +//MCS 2 Spatial Stream +#define RATR_MCS8 0x00100000 +#define RATR_MCS9 0x00200000 +#define RATR_MCS10 0x00400000 +#define RATR_MCS11 0x00800000 +#define RATR_MCS12 0x01000000 +#define RATR_MCS13 0x02000000 +#define RATR_MCS14 0x04000000 +#define RATR_MCS15 0x08000000 +// ALL CCK Rate +#define RATE_ALL_CCK RATR_1M|RATR_2M|RATR_55M|RATR_11M +#define RATE_ALL_OFDM_AG RATR_6M|RATR_9M|RATR_12M|RATR_18M|RATR_24M\ + |RATR_36M|RATR_48M|RATR_54M +#define RATE_ALL_OFDM_1SS RATR_MCS0|RATR_MCS1|RATR_MCS2|RATR_MCS3 | \ + RATR_MCS4|RATR_MCS5|RATR_MCS6|RATR_MCS7 +#define RATE_ALL_OFDM_2SS RATR_MCS8|RATR_MCS9 |RATR_MCS10|RATR_MCS11| \ + RATR_MCS12|RATR_MCS13|RATR_MCS14|RATR_MCS15 + + MCS_TXAGC = 0x340, // MCS AGC + CCK_TXAGC = 0x348, // CCK AGC +// ISR = 0x350, // Interrupt Status Register +// IMR = 0x354, // Interrupt Mask Register +// IMR_POLL = 0x360, + MacBlkCtrl = 0x403, // Mac block on/off control register + + EPROM_CMD = 0xfe58, +#define Cmd9346CR_9356SEL (1<<4) +#define EPROM_CMD_RESERVED_MASK (1<<5) +#define EPROM_CMD_OPERATING_MODE_SHIFT 6 +#define EPROM_CMD_OPERATING_MODE_MASK ((1<<7)|(1<<6)) +#define EPROM_CMD_CONFIG 0x3 +#define EPROM_CMD_NORMAL 0 +#define EPROM_CMD_LOAD 1 +#define EPROM_CMD_PROGRAM 2 +#define EPROM_CS_SHIFT 3 +#define EPROM_CK_SHIFT 2 +#define EPROM_W_SHIFT 1 +#define EPROM_R_SHIFT 0 + MAC0 = 0x000, + MAC1 = 0x001, + MAC2 = 0x002, + MAC3 = 0x003, + MAC4 = 0x004, + MAC5 = 0x005, + +#if 0 +/* 0x0006 - 0x0007 - reserved */ + RXFIFOCOUNT = 0x010, + TXFIFOCOUNT = 0x012, + BQREQ = 0x013, +/* 0x0010 - 0x0017 - reserved */ + TSFTR = 0x018, + TLPDA = 0x020, + TNPDA = 0x024, + THPDA = 0x028, + BSSID = 0x02E, + RESP_RATE = 0x034, + CMD = 0x037, +#define CMD_RST_SHIFT 4 +#define CMD_RESERVED_MASK ((1<<1) | (1<<5) | (1<<6) | (1<<7)) +#define CMD_RX_ENABLE_SHIFT 3 +#define CMD_TX_ENABLE_SHIFT 2 +#define CR_RST ((1<< 4)) +#define CR_RE ((1<< 3)) +#define CR_TE ((1<< 2)) +#define CR_MulRW ((1<< 0)) + + INTA_MASK = 0x03c, + INTA = 0x03e, +#define INTA_TXOVERFLOW (1<<15) +#define INTA_TIMEOUT (1<<14) +#define INTA_BEACONTIMEOUT (1<<13) +#define INTA_ATIM (1<<12) +#define INTA_BEACONDESCERR (1<<11) +#define INTA_BEACONDESCOK (1<<10) +#define INTA_HIPRIORITYDESCERR (1<<9) +#define INTA_HIPRIORITYDESCOK (1<<8) +#define INTA_NORMPRIORITYDESCERR (1<<7) +#define INTA_NORMPRIORITYDESCOK (1<<6) +#define INTA_RXOVERFLOW (1<<5) +#define INTA_RXDESCERR (1<<4) +#define INTA_LOWPRIORITYDESCERR (1<<3) +#define INTA_LOWPRIORITYDESCOK (1<<2) +#define INTA_RXCRCERR (1<<1) +#define INTA_RXOK (1) + TX_CONF = 0x040, +#define TX_CONF_HEADER_AUTOICREMENT_SHIFT 30 +#define TX_LOOPBACK_SHIFT 17 +#define TX_LOOPBACK_MAC 1 +#define TX_LOOPBACK_BASEBAND 2 +#define TX_LOOPBACK_NONE 0 +#define TX_LOOPBACK_CONTINUE 3 +#define TX_LOOPBACK_MASK ((1<<17)|(1<<18)) +#define TX_LRLRETRY_SHIFT 0 +#define TX_SRLRETRY_SHIFT 8 +#define TX_NOICV_SHIFT 19 +#define TX_NOCRC_SHIFT 16 +#define TCR_DurProcMode ((1<<30)) +#define TCR_DISReqQsize ((1<<28)) +#define TCR_HWVERID_MASK ((1<<27)|(1<<26)|(1<<25)) +#define TCR_HWVERID_SHIFT 25 +#define TCR_SWPLCPLEN ((1<<24)) +#define TCR_PLCP_LEN TCR_SAT // rtl8180 +#define TCR_MXDMA_MASK ((1<<23)|(1<<22)|(1<<21)) +#define TCR_MXDMA_1024 6 +#define TCR_MXDMA_2048 7 +#define TCR_MXDMA_SHIFT 21 +#define TCR_DISCW ((1<<20)) +#define TCR_ICV ((1<<19)) +#define TCR_LBK ((1<<18)|(1<<17)) +#define TCR_LBK1 ((1<<18)) +#define TCR_LBK0 ((1<<17)) +#define TCR_CRC ((1<<16)) +#define TCR_SRL_MASK ((1<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8)) +#define TCR_LRL_MASK ((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)) +#define TCR_PROBE_NOTIMESTAMP_SHIFT 29 //rtl8185 + RX_CONF = 0x044, +#define MAC_FILTER_MASK ((1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<5) | \ +(1<<12) | (1<<18) | (1<<19) | (1<<20) | (1<<21) | (1<<22) | (1<<23)) +#define RX_CHECK_BSSID_SHIFT 23 +#define ACCEPT_PWR_FRAME_SHIFT 22 +#define ACCEPT_MNG_FRAME_SHIFT 20 +#define ACCEPT_CTL_FRAME_SHIFT 19 +#define ACCEPT_DATA_FRAME_SHIFT 18 +#define ACCEPT_ICVERR_FRAME_SHIFT 12 +#define ACCEPT_CRCERR_FRAME_SHIFT 5 +#define ACCEPT_BCAST_FRAME_SHIFT 3 +#define ACCEPT_MCAST_FRAME_SHIFT 2 +#define ACCEPT_ALLMAC_FRAME_SHIFT 0 +#define ACCEPT_NICMAC_FRAME_SHIFT 1 +#define RX_FIFO_THRESHOLD_MASK ((1<<13) | (1<<14) | (1<<15)) +#define RX_FIFO_THRESHOLD_SHIFT 13 +#define RX_FIFO_THRESHOLD_128 3 +#define RX_FIFO_THRESHOLD_256 4 +#define RX_FIFO_THRESHOLD_512 5 +#define RX_FIFO_THRESHOLD_1024 6 +#define RX_FIFO_THRESHOLD_NONE 7 +#define RX_AUTORESETPHY_SHIFT 28 +#define MAX_RX_DMA_MASK ((1<<8) | (1<<9) | (1<<10)) +#define MAX_RX_DMA_2048 7 +#define MAX_RX_DMA_1024 6 +#define MAX_RX_DMA_SHIFT 10 +#define RCR_ONLYERLPKT ((1<<31)) +#define RCR_CS_SHIFT 29 +#define RCR_CS_MASK ((1<<30) | (1<<29)) +#define RCR_ENMARP ((1<<28)) +#define RCR_CBSSID ((1<<23)) +#define RCR_APWRMGT ((1<<22)) +#define RCR_ADD3 ((1<<21)) +#define RCR_AMF ((1<<20)) +#define RCR_ACF ((1<<19)) +#define RCR_ADF ((1<<18)) +#define RCR_RXFTH ((1<<15)|(1<<14)|(1<<13)) +#define RCR_RXFTH2 ((1<<15)) +#define RCR_RXFTH1 ((1<<14)) +#define RCR_RXFTH0 ((1<<13)) +#define RCR_AICV ((1<<12)) +#define RCR_MXDMA ((1<<10)|(1<< 9)|(1<< 8)) +#define RCR_MXDMA2 ((1<<10)) +#define RCR_MXDMA1 ((1<< 9)) +#define RCR_MXDMA0 ((1<< 8)) +#define RCR_9356SEL ((1<< 6)) +#define RCR_ACRC32 ((1<< 5)) +#define RCR_AB ((1<< 3)) +#define RCR_AM ((1<< 2)) +#define RCR_APM ((1<< 1)) +#define RCR_AAP ((1<< 0)) + INT_TIMEOUT = 0x048, + TX_BEACON_RING_ADDR = 0x04c, + EPROM_CMD = 0x58, +#define EPROM_CMD_RESERVED_MASK ((1<<5)|(1<<4)) +#define EPROM_CMD_OPERATING_MODE_SHIFT 6 +#define EPROM_CMD_OPERATING_MODE_MASK ((1<<7)|(1<<6)) +#define EPROM_CMD_CONFIG 0x3 +#define EPROM_CMD_NORMAL 0 +#define EPROM_CMD_LOAD 1 +#define EPROM_CMD_PROGRAM 2 +#define EPROM_CS_SHIFT 3 +#define EPROM_CK_SHIFT 2 +#define EPROM_W_SHIFT 1 +#define EPROM_R_SHIFT 0 + CONFIG0 = 0x051, +#define CONFIG0_WEP104 ((1<<6)) +#define CONFIG0_LEDGPO_En ((1<<4)) +#define CONFIG0_Aux_Status ((1<<3)) +#define CONFIG0_GL ((1<<1)|(1<<0)) +#define CONFIG0_GL1 ((1<<1)) +#define CONFIG0_GL0 ((1<<0)) + CONFIG1 = 0x052, +#define CONFIG1_LEDS ((1<<7)|(1<<6)) +#define CONFIG1_LEDS1 ((1<<7)) +#define CONFIG1_LEDS0 ((1<<6)) +#define CONFIG1_LWACT ((1<<4)) +#define CONFIG1_MEMMAP ((1<<3)) +#define CONFIG1_IOMAP ((1<<2)) +#define CONFIG1_VPD ((1<<1)) +#define CONFIG1_PMEn ((1<<0)) + CONFIG2 = 0x053, +#define CONFIG2_LCK ((1<<7)) +#define CONFIG2_ANT ((1<<6)) +#define CONFIG2_DPS ((1<<3)) +#define CONFIG2_PAPE_sign ((1<<2)) +#define CONFIG2_PAPE_time ((1<<1)|(1<<0)) +#define CONFIG2_PAPE_time1 ((1<<1)) +#define CONFIG2_PAPE_time0 ((1<<0)) + ANA_PARAM = 0x054, + CONFIG3 = 0x059, +#define CONFIG3_GNTSel ((1<<7)) +#define CONFIG3_PARM_En ((1<<6)) +#define CONFIG3_Magic ((1<<5)) +#define CONFIG3_CardB_En ((1<<3)) +#define CONFIG3_CLKRUN_En ((1<<2)) +#define CONFIG3_FuncRegEn ((1<<1)) +#define CONFIG3_FBtbEn ((1<<0)) +#define CONFIG3_CLKRUN_SHIFT 2 +#define CONFIG3_ANAPARAM_W_SHIFT 6 + CONFIG4 = 0x05a, +#define CONFIG4_VCOPDN ((1<<7)) +#define CONFIG4_PWROFF ((1<<6)) +#define CONFIG4_PWRMGT ((1<<5)) +#define CONFIG4_LWPME ((1<<4)) +#define CONFIG4_LWPTN ((1<<2)) +#define CONFIG4_RFTYPE ((1<<1)|(1<<0)) +#define CONFIG4_RFTYPE1 ((1<<1)) +#define CONFIG4_RFTYPE0 ((1<<0)) + TESTR = 0x05b, +#define TFPC_AC 0x05C + +#define SCR 0x05F + PGSELECT = 0x05e, +#define PGSELECT_PG_SHIFT 0 + SECURITY = 0x05f, +#define SECURITY_WEP_TX_ENABLE_SHIFT 1 +#define SECURITY_WEP_RX_ENABLE_SHIFT 0 +#define SECURITY_ENCRYP_104 1 +#define SECURITY_ENCRYP_SHIFT 4 +#define SECURITY_ENCRYP_MASK ((1<<4)|(1<<5)) + ANA_PARAM2 = 0x060, + BEACON_INTERVAL = 0x070, +#define BEACON_INTERVAL_MASK ((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)| \ +(1<<6)|(1<<7)|(1<<8)|(1<<9)) + ATIM_WND = 0x072, +#define ATIM_WND_MASK (0x01FF) + BCN_INTR_ITV = 0x074, +#define BCN_INTR_ITV_MASK (0x01FF) + ATIM_INTR_ITV = 0x076, +#define ATIM_INTR_ITV_MASK (0x01FF) + AckTimeOutReg = 0x079, //ACK timeout register, in unit of 4 us. + PHY_ADR = 0x07c, + PHY_READ = 0x07e, + RFPinsOutput = 0x080, + RFPinsEnable = 0x082, + +//Page 0 + RFPinsSelect = 0x084, +#define SW_CONTROL_GPIO 0x400 + RFPinsInput = 0x086, + RF_PARA = 0x088, + RF_TIMING = 0x08c, + GP_ENABLE = 0x090, + GPIO = 0x091, + TX_AGC_CTL = 0x09c, +#define TX_AGC_CTL_PER_PACKET_TXAGC 0x01 +#define TX_AGC_CTL_PERPACKET_GAIN_SHIFT 0 +#define TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT 1 +#define TX_AGC_CTL_FEEDBACK_ANT 2 +#define TXAGC_CTL_PER_PACKET_ANT_SEL 0x02 + OFDM_TXAGC = 0x09e, + ANTSEL = 0x09f, + WPA_CONFIG = 0x0b0, + SIFS = 0x0b4, + DIFS = 0x0b5, + SLOT = 0x0b6, + CW_CONF = 0x0bc, +#define CW_CONF_PERPACKET_RETRY_LIMIT 0x02 +#define CW_CONF_PERPACKET_CW 0x01 +#define CW_CONF_PERPACKET_RETRY_SHIFT 1 +#define CW_CONF_PERPACKET_CW_SHIFT 0 + CW_VAL = 0x0bd, + RATE_FALLBACK = 0x0be, +#define MAX_RESP_RATE_SHIFT 4 +#define MIN_RESP_RATE_SHIFT 0 +#define RATE_FALLBACK_CTL_ENABLE 0x80 +#define RATE_FALLBACK_CTL_AUTO_STEP0 0x00 + ACM_CONTROL = 0x0BF, // ACM Control Registe +//---------------------------------------------------------------------------- +// 8187B ACM_CONTROL bits (Offset 0xBF, 1 Byte) +//---------------------------------------------------------------------------- +#define VOQ_ACM_EN (0x01 << 7) //BIT7 +#define VIQ_ACM_EN (0x01 << 6) //BIT6 +#define BEQ_ACM_EN (0x01 << 5) //BIT5 +#define ACM_HW_EN (0x01 << 4) //BIT4 +#define TXOPSEL (0x01 << 3) //BIT3 +#define VOQ_ACM_CTL (0x01 << 2) //BIT2 // Set to 1 when AC_VO used time reaches or exceeds the admitted time +#define VIQ_ACM_CTL (0x01 << 1) //BIT1 // Set to 1 when AC_VI used time reaches or exceeds the admitted time +#define BEQ_ACM_CTL (0x01 << 0) //BIT0 // Set to 1 when AC_BE used time reaches or exceeds the admitted time + CONFIG5 = 0x0D8, +#define CONFIG5_TX_FIFO_OK ((1<<7)) +#define CONFIG5_RX_FIFO_OK ((1<<6)) +#define CONFIG5_CALON ((1<<5)) +#define CONFIG5_EACPI ((1<<2)) +#define CONFIG5_LANWake ((1<<1)) +#define CONFIG5_PME_STS ((1<<0)) + TX_DMA_POLLING = 0x0d9, +#define TX_DMA_POLLING_BEACON_SHIFT 7 +#define TX_DMA_POLLING_HIPRIORITY_SHIFT 6 +#define TX_DMA_POLLING_NORMPRIORITY_SHIFT 5 +#define TX_DMA_POLLING_LOWPRIORITY_SHIFT 4 +#define TX_DMA_STOP_BEACON_SHIFT 3 +#define TX_DMA_STOP_HIPRIORITY_SHIFT 2 +#define TX_DMA_STOP_NORMPRIORITY_SHIFT 1 +#define TX_DMA_STOP_LOWPRIORITY_SHIFT 0 + CWR = 0x0DC, + RetryCTR = 0x0DE, + INT_MIG = 0x0E2, // Interrupt Migration (0xE2 ~ 0xE3) + TID_AC_MAP = 0x0E8, // TID to AC Mapping Register + ANA_PARAM3 = 0x0EE, + + +//page 1 + Wakeup0 = 0x084, + Wakeup1 = 0x08C, + Wakeup2LD = 0x094, + Wakeup2HD = 0x09C, + Wakeup3LD = 0x0A4, + Wakeup3HD = 0x0AC, + Wakeup4LD = 0x0B4, + Wakeup4HD = 0x0BC, + CRC0 = 0x0C4, + CRC1 = 0x0C6, + CRC2 = 0x0C8, + CRC3 = 0x0CA, + CRC4 = 0x0CC, +/* 0x00CE - 0x00D3 - reserved */ + + RFSW_CTRL = 0x272, // 0x272-0x273. + +//Reg Diff between rtl8187 and rtl8187B +/**************************************************************************/ + BRSR_8187 = 0x02C, + BRSR_8187B = 0x034, +#define BRSR_BPLCP ((1<< 8)) +#define BRSR_MBR ((1<< 1)|(1<< 0)) +#define BRSR_MBR_8185 ((1<< 11)|(1<< 10)|(1<< 9)|(1<< 8)|(1<< 7)|(1<< 6)|(1<< 5)|(1<< 4)|(1<< 3)|(1<< 2)|(1<< 1)|(1<< 0)) +#define BRSR_MBR0 ((1<< 0)) +#define BRSR_MBR1 ((1<< 1)) + +/**************************************************************************/ + EIFS_8187 = 0x035, + EIFS_8187B = 0x02D, + +/**************************************************************************/ + FER = 0x0F0, + FEMR = 0x0F4, + FPSR = 0x0F8, + FFER = 0x0FC, + + AC_VO_PARAM = 0x0F0, // AC_VO Parameters Record + AC_VI_PARAM = 0x0F4, // AC_VI Parameters Record + AC_BE_PARAM = 0x0F8, // AC_BE Parameters Record + AC_BK_PARAM = 0x0FC, // AC_BK Parameters Record + TALLY_SEL = 0x0fc, +//---------------------------------------------------------------------------- +// 8187B AC_XX_PARAM bits +//---------------------------------------------------------------------------- +#define AC_PARAM_TXOP_LIMIT_OFFSET 16 +#define AC_PARAM_ECW_MAX_OFFSET 12 +#define AC_PARAM_ECW_MIN_OFFSET 8 +#define AC_PARAM_AIFS_OFFSET 0 + +#endif +}; +//---------------------------------------------------------------------------- +// 818xB AnaParm & AnaParm2 Register +//---------------------------------------------------------------------------- +//#define ANAPARM_ASIC_ON 0x45090658 +//#define ANAPARM2_ASIC_ON 0x727f3f52 +#define GPI 0x108 +#define GPO 0x109 +#define GPE 0x10a +#endif diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c new file mode 100644 index 000000000000..490c994af30d --- /dev/null +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -0,0 +1,1310 @@ +/* + This file contains wireless extension handlers. + + This is part of rtl8180 OpenSource driver. + Copyright (C) Andrea Merello 2004-2005 + Released under the terms of GPL (General Public Licence) + + Parts of this driver are based on the GPL part + of the official realtek driver. + + Parts of this driver are based on the rtl8180 driver skeleton + from Patric Schenke & Andres Salomon. + + Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver. + + We want to tanks the Authors of those projects and the Ndiswrapper + project Authors. +*/ + +#include +#include "r8192U.h" +#include "r8192U_hw.h" + +#ifdef ENABLE_DOT11D +#include "dot11d.h" +#endif + +#define RATE_COUNT 12 +u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000, + 6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000}; + + +#ifndef ENETDOWN +#define ENETDOWN 1 +#endif + +static int r8192_wx_get_freq(struct net_device *dev, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b); +} + + +#if 0 + +static int r8192_wx_set_beaconinterval(struct net_device *dev, struct iw_request_info *aa, + union iwreq_data *wrqu, char *b) +{ + int *parms = (int *)b; + int bi = parms[0]; + + struct r8192_priv *priv = ieee80211_priv(dev); + + down(&priv->wx_sem); + DMESG("setting beacon interval to %x",bi); + + priv->ieee80211->beacon_interval=bi; + rtl8180_commit(dev); + up(&priv->wx_sem); + + return 0; +} + + +static int r8192_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv=ieee80211_priv(dev); + int *parms = (int *)extra; + + priv->ieee80211->force_associate = (parms[0] > 0); + + + return 0; +} + +#endif +static int r8192_wx_get_mode(struct net_device *dev, struct iw_request_info *a, + union iwreq_data *wrqu, char *b) +{ + struct r8192_priv *priv=ieee80211_priv(dev); + + return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b); +} + + + +static int r8192_wx_get_rate(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra); +} + + + +static int r8192_wx_set_rate(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + int ret; + struct r8192_priv *priv = ieee80211_priv(dev); + + down(&priv->wx_sem); + + ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra); + + up(&priv->wx_sem); + + return ret; +} + + +static int r8192_wx_set_rts(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + int ret; + struct r8192_priv *priv = ieee80211_priv(dev); + + down(&priv->wx_sem); + + ret = ieee80211_wx_set_rts(priv->ieee80211,info,wrqu,extra); + + up(&priv->wx_sem); + + return ret; +} + +static int r8192_wx_get_rts(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + return ieee80211_wx_get_rts(priv->ieee80211,info,wrqu,extra); +} + +static int r8192_wx_set_power(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + int ret; + struct r8192_priv *priv = ieee80211_priv(dev); + + down(&priv->wx_sem); + + ret = ieee80211_wx_set_power(priv->ieee80211,info,wrqu,extra); + + up(&priv->wx_sem); + + return ret; +} + +static int r8192_wx_get_power(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + return ieee80211_wx_get_power(priv->ieee80211,info,wrqu,extra); +} + +#ifdef JOHN_IOCTL +u16 read_rtl8225(struct net_device *dev, u8 addr); +void write_rtl8225(struct net_device *dev, u8 adr, u16 data); +u32 john_read_rtl8225(struct net_device *dev, u8 adr); +void _write_rtl8225(struct net_device *dev, u8 adr, u16 data); + +static int r8192_wx_read_regs(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u8 addr; + u16 data1; + + down(&priv->wx_sem); + + + get_user(addr,(u8*)wrqu->data.pointer); + data1 = read_rtl8225(dev, addr); + wrqu->data.length = data1; + + up(&priv->wx_sem); + return 0; + +} + +static int r8192_wx_write_regs(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u8 addr; + + down(&priv->wx_sem); + + get_user(addr, (u8*)wrqu->data.pointer); + write_rtl8225(dev, addr, wrqu->data.length); + + up(&priv->wx_sem); + return 0; + +} + +void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data); +u8 rtl8187_read_phy(struct net_device *dev,u8 adr, u32 data); + +static int r8192_wx_read_bb(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u8 databb; +#if 0 + int i; + for(i=0;i<12;i++) printk("%8x\n", read_cam(dev, i) ); +#endif + + down(&priv->wx_sem); + + databb = rtl8187_read_phy(dev, (u8)wrqu->data.length, 0x00000000); + wrqu->data.length = databb; + + up(&priv->wx_sem); + return 0; +} + +void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data); +static int r8192_wx_write_bb(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u8 databb; + + down(&priv->wx_sem); + + get_user(databb, (u8*)wrqu->data.pointer); + rtl8187_write_phy(dev, wrqu->data.length, databb); + + up(&priv->wx_sem); + return 0; + +} + + +static int r8192_wx_write_nicb(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u32 addr; + + down(&priv->wx_sem); + + get_user(addr, (u32*)wrqu->data.pointer); + write_nic_byte(dev, addr, wrqu->data.length); + + up(&priv->wx_sem); + return 0; + +} +static int r8192_wx_read_nicb(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u32 addr; + u16 data1; + + down(&priv->wx_sem); + + get_user(addr,(u32*)wrqu->data.pointer); + data1 = read_nic_byte(dev, addr); + wrqu->data.length = data1; + + up(&priv->wx_sem); + return 0; +} + +static int r8192_wx_get_ap_status(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + struct ieee80211_device *ieee = priv->ieee80211; + struct ieee80211_network *target; + int name_len; + + down(&priv->wx_sem); + + //count the length of input ssid + for(name_len=0 ; ((char*)wrqu->data.pointer)[name_len]!='\0' ; name_len++); + + //search for the correspoding info which is received + list_for_each_entry(target, &ieee->network_list, list) { + if ( (target->ssid_len == name_len) && + (strncmp(target->ssid, (char*)wrqu->data.pointer, name_len)==0)){ + if(target->wpa_ie_len>0 || target->rsn_ie_len>0 ) + //set flags=1 to indicate this ap is WPA + wrqu->data.flags = 1; + else wrqu->data.flags = 0; + + + break; + } + } + + up(&priv->wx_sem); + return 0; +} + + + +#endif +#if 0 +static int r8192_wx_null(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + return 0; +} +#endif +static int r8192_wx_force_reset(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + down(&priv->wx_sem); + + printk("%s(): force reset ! extra is %d\n",__FUNCTION__, *extra); + priv->force_reset = *extra; + up(&priv->wx_sem); + return 0; + +} + + +static int r8192_wx_set_rawtx(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + int ret; + + down(&priv->wx_sem); + + ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra); + + up(&priv->wx_sem); + + return ret; + +} + +static int r8192_wx_set_crcmon(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + int *parms = (int *)extra; + int enable = (parms[0] > 0); + short prev = priv->crcmon; + + down(&priv->wx_sem); + + if(enable) + priv->crcmon=1; + else + priv->crcmon=0; + + DMESG("bad CRC in monitor mode are %s", + priv->crcmon ? "accepted" : "rejected"); + + if(prev != priv->crcmon && priv->up){ + //rtl8180_down(dev); + //rtl8180_up(dev); + } + + up(&priv->wx_sem); + + return 0; +} + +static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a, + union iwreq_data *wrqu, char *b) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + int ret; + down(&priv->wx_sem); + + ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b); + + rtl8192_set_rxconf(dev); + + up(&priv->wx_sem); + return ret; +} + +struct iw_range_with_scan_capa +{ + /* Informative stuff (to choose between different interface) */ + __u32 throughput; /* To give an idea... */ + /* In theory this value should be the maximum benchmarked + * TCP/IP throughput, because with most of these devices the + * bit rate is meaningless (overhead an co) to estimate how + * fast the connection will go and pick the fastest one. + * I suggest people to play with Netperf or any benchmark... + */ + + /* NWID (or domain id) */ + __u32 min_nwid; /* Minimal NWID we are able to set */ + __u32 max_nwid; /* Maximal NWID we are able to set */ + + /* Old Frequency (backward compat - moved lower ) */ + __u16 old_num_channels; + __u8 old_num_frequency; + + /* Scan capabilities */ + __u8 scan_capa; +}; +static int rtl8180_wx_get_range(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct iw_range *range = (struct iw_range *)extra; + struct iw_range_with_scan_capa* tmp = (struct iw_range_with_scan_capa*)range; + struct r8192_priv *priv = ieee80211_priv(dev); + u16 val; + int i; + + wrqu->data.length = sizeof(*range); + memset(range, 0, sizeof(*range)); + + /* Let's try to keep this struct in the same order as in + * linux/include/wireless.h + */ + + /* TODO: See what values we can set, and remove the ones we can't + * set, or fill them with some default data. + */ + + /* ~5 Mb/s real (802.11b) */ + range->throughput = 5 * 1000 * 1000; + + // TODO: Not used in 802.11b? +// range->min_nwid; /* Minimal NWID we are able to set */ + // TODO: Not used in 802.11b? +// range->max_nwid; /* Maximal NWID we are able to set */ + + /* Old Frequency (backward compat - moved lower ) */ +// range->old_num_channels; +// range->old_num_frequency; +// range->old_freq[6]; /* Filler to keep "version" at the same offset */ + if(priv->rf_set_sens != NULL) + range->sensitivity = priv->max_sens; /* signal level threshold range */ + + range->max_qual.qual = 100; + /* TODO: Find real max RSSI and stick here */ + range->max_qual.level = 0; + range->max_qual.noise = -98; + range->max_qual.updated = 7; /* Updated all three */ + + range->avg_qual.qual = 92; /* > 8% missed beacons is 'bad' */ + /* TODO: Find real 'good' to 'bad' threshol value for RSSI */ + range->avg_qual.level = 20 + -98; + range->avg_qual.noise = 0; + range->avg_qual.updated = 7; /* Updated all three */ + + range->num_bitrates = RATE_COUNT; + + for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) { + range->bitrate[i] = rtl8180_rates[i]; + } + + range->min_frag = MIN_FRAG_THRESHOLD; + range->max_frag = MAX_FRAG_THRESHOLD; + + range->min_pmp=0; + range->max_pmp = 5000000; + range->min_pmt = 0; + range->max_pmt = 65535*1000; + range->pmp_flags = IW_POWER_PERIOD; + range->pmt_flags = IW_POWER_TIMEOUT; + range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R; + + range->we_version_compiled = WIRELESS_EXT; + range->we_version_source = 16; + +// range->retry_capa; /* What retry options are supported */ +// range->retry_flags; /* How to decode max/min retry limit */ +// range->r_time_flags; /* How to decode max/min retry life */ +// range->min_retry; /* Minimal number of retries */ +// range->max_retry; /* Maximal number of retries */ +// range->min_r_time; /* Minimal retry lifetime */ +// range->max_r_time; /* Maximal retry lifetime */ + + + for (i = 0, val = 0; i < 14; i++) { + + // Include only legal frequencies for some countries +#ifdef ENABLE_DOT11D + if ((GET_DOT11D_INFO(priv->ieee80211)->channel_map)[i+1]) { +#else + if ((priv->ieee80211->channel_map)[i+1]) { +#endif + range->freq[val].i = i + 1; + range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000; + range->freq[val].e = 1; + val++; + } else { + // FIXME: do we need to set anything for channels + // we don't use ? + } + + if (val == IW_MAX_FREQUENCIES) + break; + } + range->num_frequency = val; + range->num_channels = val; +#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 + tmp->scan_capa = 0x01; + return 0; +} + + +static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, + union iwreq_data *wrqu, char *b) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + struct ieee80211_device* ieee = priv->ieee80211; + int ret = 0; + + if(!priv->up) return -ENETDOWN; + + if (priv->ieee80211->LinkDetectInfo.bBusyTraffic == true) + return -EAGAIN; + if (wrqu->data.flags & IW_SCAN_THIS_ESSID) + { + struct iw_scan_req* req = (struct iw_scan_req*)b; + if (req->essid_len) + { + //printk("==**&*&*&**===>scan set ssid:%s\n", req->essid); + ieee->current_network.ssid_len = req->essid_len; + memcpy(ieee->current_network.ssid, req->essid, req->essid_len); + //printk("=====>network ssid:%s\n", ieee->current_network.ssid); + } + } + + down(&priv->wx_sem); + if(priv->ieee80211->state != IEEE80211_LINKED){ + priv->ieee80211->scanning = 0; + ieee80211_softmac_scan_syncro(priv->ieee80211); + ret = 0; + } + else + ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b); + up(&priv->wx_sem); + return ret; +} + + +static int r8192_wx_get_scan(struct net_device *dev, struct iw_request_info *a, + union iwreq_data *wrqu, char *b) +{ + + int ret; + struct r8192_priv *priv = ieee80211_priv(dev); + + if(!priv->up) return -ENETDOWN; + + down(&priv->wx_sem); + + ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b); + + up(&priv->wx_sem); + + return ret; +} + +static int r8192_wx_set_essid(struct net_device *dev, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + int ret; + down(&priv->wx_sem); + + ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b); + + up(&priv->wx_sem); + + return ret; +} + + + + +static int r8192_wx_get_essid(struct net_device *dev, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b) +{ + int ret; + struct r8192_priv *priv = ieee80211_priv(dev); + + down(&priv->wx_sem); + + ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b); + + up(&priv->wx_sem); + + return ret; +} + + +static int r8192_wx_set_freq(struct net_device *dev, struct iw_request_info *a, + union iwreq_data *wrqu, char *b) +{ + int ret; + struct r8192_priv *priv = ieee80211_priv(dev); + + down(&priv->wx_sem); + + ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b); + + up(&priv->wx_sem); + return ret; +} + +static int r8192_wx_get_name(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra); +} + + +static int r8192_wx_set_frag(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + if (wrqu->frag.disabled) + priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD; + else { + if (wrqu->frag.value < MIN_FRAG_THRESHOLD || + wrqu->frag.value > MAX_FRAG_THRESHOLD) + return -EINVAL; + + priv->ieee80211->fts = wrqu->frag.value & ~0x1; + } + + return 0; +} + + +static int r8192_wx_get_frag(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + wrqu->frag.value = priv->ieee80211->fts; + wrqu->frag.fixed = 0; /* no auto select */ + wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FRAG_THRESHOLD); + + return 0; +} + + +static int r8192_wx_set_wap(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *awrq, + char *extra) +{ + + int ret; + struct r8192_priv *priv = ieee80211_priv(dev); +// struct sockaddr *temp = (struct sockaddr *)awrq; + down(&priv->wx_sem); + + ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra); + + up(&priv->wx_sem); + + return ret; + +} + + +static int r8192_wx_get_wap(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra); +} + + +static int r8192_wx_get_enc(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *key) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key); +} + +static int r8192_wx_set_enc(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *key) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + struct ieee80211_device *ieee = priv->ieee80211; + int ret; + + //u32 TargetContent; + u32 hwkey[4]={0,0,0,0}; + u8 mask=0xff; + u32 key_idx=0; + //u8 broadcast_addr[6] ={ 0xff,0xff,0xff,0xff,0xff,0xff}; + u8 zero_addr[4][6] ={ {0x00,0x00,0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x01}, + {0x00,0x00,0x00,0x00,0x00,0x02}, + {0x00,0x00,0x00,0x00,0x00,0x03} }; + int i; + + if(!priv->up) return -ENETDOWN; + + down(&priv->wx_sem); + + RT_TRACE(COMP_SEC, "Setting SW wep key"); + ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key); + + up(&priv->wx_sem); + + + + //sometimes, the length is zero while we do not type key value + if(wrqu->encoding.length!=0){ + + for(i=0 ; i<4 ; i++){ + hwkey[i] |= key[4*i+0]&mask; + if(i==1&&(4*i+1)==wrqu->encoding.length) mask=0x00; + if(i==3&&(4*i+1)==wrqu->encoding.length) mask=0x00; + hwkey[i] |= (key[4*i+1]&mask)<<8; + hwkey[i] |= (key[4*i+2]&mask)<<16; + hwkey[i] |= (key[4*i+3]&mask)<<24; + } + + #define CONF_WEP40 0x4 + #define CONF_WEP104 0x14 + + switch(wrqu->encoding.flags & IW_ENCODE_INDEX){ + case 0: key_idx = ieee->tx_keyidx; break; + case 1: key_idx = 0; break; + case 2: key_idx = 1; break; + case 3: key_idx = 2; break; + case 4: key_idx = 3; break; + default: break; + } + + if(wrqu->encoding.length==0x5){ + ieee->pairwise_key_type = KEY_TYPE_WEP40; + EnableHWSecurityConfig8192(dev); + + setKey( dev, + key_idx, //EntryNo + key_idx, //KeyIndex + KEY_TYPE_WEP40, //KeyType + zero_addr[key_idx], + 0, //DefaultKey + hwkey); //KeyContent + + } + + else if(wrqu->encoding.length==0xd){ + ieee->pairwise_key_type = KEY_TYPE_WEP104; + EnableHWSecurityConfig8192(dev); + + setKey( dev, + key_idx, //EntryNo + key_idx, //KeyIndex + KEY_TYPE_WEP104, //KeyType + zero_addr[key_idx], + 0, //DefaultKey + hwkey); //KeyContent + + } + else printk("wrong type in WEP, not WEP40 and WEP104\n"); + + } + + return ret; +} + + +static int r8192_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union + iwreq_data *wrqu, char *p){ + + struct r8192_priv *priv = ieee80211_priv(dev); + int *parms=(int*)p; + int mode=parms[0]; + + priv->ieee80211->active_scan = mode; + + return 1; +} + + + +static int r8192_wx_set_retry(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + int err = 0; + + down(&priv->wx_sem); + + if (wrqu->retry.flags & IW_RETRY_LIFETIME || + wrqu->retry.disabled){ + err = -EINVAL; + goto exit; + } + if (!(wrqu->retry.flags & IW_RETRY_LIMIT)){ + err = -EINVAL; + goto exit; + } + + if(wrqu->retry.value > R8180_MAX_RETRY){ + err= -EINVAL; + goto exit; + } + if (wrqu->retry.flags & IW_RETRY_MAX) { + priv->retry_rts = wrqu->retry.value; + DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value); + + }else { + priv->retry_data = wrqu->retry.value; + DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value); + } + + /* FIXME ! + * We might try to write directly the TX config register + * or to restart just the (R)TX process. + * I'm unsure if whole reset is really needed + */ + + rtl8192_commit(dev); + /* + if(priv->up){ + rtl8180_rtx_disable(dev); + rtl8180_rx_enable(dev); + rtl8180_tx_enable(dev); + + } + */ +exit: + up(&priv->wx_sem); + + return err; +} + +static int r8192_wx_get_retry(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + + wrqu->retry.disabled = 0; /* can't be disabled */ + + if ((wrqu->retry.flags & IW_RETRY_TYPE) == + IW_RETRY_LIFETIME) + return -EINVAL; + + if (wrqu->retry.flags & IW_RETRY_MAX) { + wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX; + wrqu->retry.value = priv->retry_rts; + } else { + wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MIN; + wrqu->retry.value = priv->retry_data; + } + //printk("returning %d",wrqu->retry.value); + + + return 0; +} + +static int r8192_wx_get_sens(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + if(priv->rf_set_sens == NULL) + return -1; /* we have not this support for this radio */ + wrqu->sens.value = priv->sens; + return 0; +} + + +static int r8192_wx_set_sens(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + + struct r8192_priv *priv = ieee80211_priv(dev); + + short err = 0; + down(&priv->wx_sem); + //DMESG("attempt to set sensivity to %ddb",wrqu->sens.value); + if(priv->rf_set_sens == NULL) { + err= -1; /* we have not this support for this radio */ + goto exit; + } + if(priv->rf_set_sens(dev, wrqu->sens.value) == 0) + priv->sens = wrqu->sens.value; + else + err= -EINVAL; + +exit: + up(&priv->wx_sem); + + return err; +} + +#if (WIRELESS_EXT >= 18) +#if 0 +static int r8192_wx_get_enc_ext(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + int ret = 0; + ret = ieee80211_wx_get_encode_ext(priv->ieee80211, info, wrqu, extra); + return ret; +} +#endif +//hw security need to reorganized. +static int r8192_wx_set_enc_ext(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + int ret=0; + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + struct r8192_priv *priv = ieee80211_priv(dev); + struct ieee80211_device* ieee = priv->ieee80211; + //printk("===>%s()\n", __FUNCTION__); + + + down(&priv->wx_sem); + ret = ieee80211_wx_set_encode_ext(priv->ieee80211, info, wrqu, extra); + + { + u8 broadcast_addr[6] = {0xff,0xff,0xff,0xff,0xff,0xff}; + u8 zero[6] = {0}; + u32 key[4] = {0}; + struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; + struct iw_point *encoding = &wrqu->encoding; +#if 0 + static u8 CAM_CONST_ADDR[4][6] = { + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x03}}; +#endif + u8 idx = 0, alg = 0, group = 0; + if ((encoding->flags & IW_ENCODE_DISABLED) || + ext->alg == IW_ENCODE_ALG_NONE) //none is not allowed to use hwsec WB 2008.07.01 + goto end_hw_sec; + + alg = (ext->alg == IW_ENCODE_ALG_CCMP)?KEY_TYPE_CCMP:ext->alg; // as IW_ENCODE_ALG_CCMP is defined to be 3 and KEY_TYPE_CCMP is defined to 4; + idx = encoding->flags & IW_ENCODE_INDEX; + if (idx) + idx --; + group = ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY; + + if ((!group) || (IW_MODE_ADHOC == ieee->iw_mode) || (alg == KEY_TYPE_WEP40)) + { + if ((ext->key_len == 13) && (alg == KEY_TYPE_WEP40) ) + alg = KEY_TYPE_WEP104; + ieee->pairwise_key_type = alg; + EnableHWSecurityConfig8192(dev); + } + memcpy((u8*)key, ext->key, 16); //we only get 16 bytes key.why? WB 2008.7.1 + + if ((alg & KEY_TYPE_WEP40) && (ieee->auth_mode !=2) ) + { + + setKey( dev, + idx,//EntryNo + idx, //KeyIndex + alg, //KeyType + zero, //MacAddr + 0, //DefaultKey + key); //KeyContent + } + else if (group) + { + ieee->group_key_type = alg; + setKey( dev, + idx,//EntryNo + idx, //KeyIndex + alg, //KeyType + broadcast_addr, //MacAddr + 0, //DefaultKey + key); //KeyContent + } + else //pairwise key + { + setKey( dev, + 4,//EntryNo + idx, //KeyIndex + alg, //KeyType + (u8*)ieee->ap_mac_addr, //MacAddr + 0, //DefaultKey + key); //KeyContent + } + + + } + +end_hw_sec: + + up(&priv->wx_sem); +#endif + return ret; + +} +static int r8192_wx_set_auth(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *data, char *extra) +{ + int ret=0; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + //printk("====>%s()\n", __FUNCTION__); + struct r8192_priv *priv = ieee80211_priv(dev); + down(&priv->wx_sem); + ret = ieee80211_wx_set_auth(priv->ieee80211, info, &(data->param), extra); + up(&priv->wx_sem); +#endif + return ret; +} + +static int r8192_wx_set_mlme(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + //printk("====>%s()\n", __FUNCTION__); + + int ret=0; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + struct r8192_priv *priv = ieee80211_priv(dev); + down(&priv->wx_sem); + ret = ieee80211_wx_set_mlme(priv->ieee80211, info, wrqu, extra); + + up(&priv->wx_sem); +#endif + return ret; +} +#endif +static int r8192_wx_set_gen_ie(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *data, char *extra) +{ + //printk("====>%s(), len:%d\n", __FUNCTION__, data->length); + int ret=0; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + struct r8192_priv *priv = ieee80211_priv(dev); + down(&priv->wx_sem); +#if 1 + ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, data->data.length); +#endif + up(&priv->wx_sem); + //printk("<======%s(), ret:%d\n", __FUNCTION__, ret); +#endif + return ret; + + +} + +static int dummy(struct net_device *dev, struct iw_request_info *a, + union iwreq_data *wrqu,char *b) +{ + return -1; +} + + +static iw_handler r8192_wx_handlers[] = +{ + NULL, /* SIOCSIWCOMMIT */ + r8192_wx_get_name, /* SIOCGIWNAME */ + dummy, /* SIOCSIWNWID */ + dummy, /* SIOCGIWNWID */ + r8192_wx_set_freq, /* SIOCSIWFREQ */ + r8192_wx_get_freq, /* SIOCGIWFREQ */ + r8192_wx_set_mode, /* SIOCSIWMODE */ + r8192_wx_get_mode, /* SIOCGIWMODE */ + r8192_wx_set_sens, /* SIOCSIWSENS */ + r8192_wx_get_sens, /* SIOCGIWSENS */ + NULL, /* SIOCSIWRANGE */ + rtl8180_wx_get_range, /* SIOCGIWRANGE */ + NULL, /* SIOCSIWPRIV */ + NULL, /* SIOCGIWPRIV */ + NULL, /* SIOCSIWSTATS */ + NULL, /* SIOCGIWSTATS */ + dummy, /* SIOCSIWSPY */ + dummy, /* SIOCGIWSPY */ + NULL, /* SIOCGIWTHRSPY */ + NULL, /* SIOCWIWTHRSPY */ + r8192_wx_set_wap, /* SIOCSIWAP */ + r8192_wx_get_wap, /* SIOCGIWAP */ +#if (WIRELESS_EXT >= 18) + r8192_wx_set_mlme, /* MLME-- */ +#else + NULL, +#endif + dummy, /* SIOCGIWAPLIST -- depricated */ + r8192_wx_set_scan, /* SIOCSIWSCAN */ + r8192_wx_get_scan, /* SIOCGIWSCAN */ + r8192_wx_set_essid, /* SIOCSIWESSID */ + r8192_wx_get_essid, /* SIOCGIWESSID */ + dummy, /* SIOCSIWNICKN */ + dummy, /* SIOCGIWNICKN */ + NULL, /* -- hole -- */ + NULL, /* -- hole -- */ + r8192_wx_set_rate, /* SIOCSIWRATE */ + r8192_wx_get_rate, /* SIOCGIWRATE */ + r8192_wx_set_rts, /* SIOCSIWRTS */ + r8192_wx_get_rts, /* SIOCGIWRTS */ + r8192_wx_set_frag, /* SIOCSIWFRAG */ + r8192_wx_get_frag, /* SIOCGIWFRAG */ + dummy, /* SIOCSIWTXPOW */ + dummy, /* SIOCGIWTXPOW */ + r8192_wx_set_retry, /* SIOCSIWRETRY */ + r8192_wx_get_retry, /* SIOCGIWRETRY */ + r8192_wx_set_enc, /* SIOCSIWENCODE */ + r8192_wx_get_enc, /* SIOCGIWENCODE */ + r8192_wx_set_power, /* SIOCSIWPOWER */ + r8192_wx_get_power, /* SIOCGIWPOWER */ + NULL, /*---hole---*/ + NULL, /*---hole---*/ + r8192_wx_set_gen_ie,//NULL, /* SIOCSIWGENIE */ + NULL, /* SIOCSIWGENIE */ + +#if (WIRELESS_EXT >= 18) + r8192_wx_set_auth,//NULL, /* SIOCSIWAUTH */ + NULL,//r8192_wx_get_auth,//NULL, /* SIOCSIWAUTH */ + r8192_wx_set_enc_ext, /* SIOCSIWENCODEEXT */ + NULL,//r8192_wx_get_enc_ext,//NULL, /* SIOCSIWENCODEEXT */ +#else + NULL, + NULL, + NULL, + NULL, +#endif + NULL, /* SIOCSIWPMKSA */ + NULL, /*---hole---*/ + +}; + + +static const struct iw_priv_args r8192_private_args[] = { + + { + SIOCIWFIRSTPRIV + 0x0, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc" + }, + + { + SIOCIWFIRSTPRIV + 0x1, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan" + + }, + { + SIOCIWFIRSTPRIV + 0x2, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx" + } +#ifdef JOHN_IOCTL + , + { + SIOCIWFIRSTPRIV + 0x3, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readRF" + } + , + { + SIOCIWFIRSTPRIV + 0x4, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writeRF" + } + , + { + SIOCIWFIRSTPRIV + 0x5, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readBB" + } + , + { + SIOCIWFIRSTPRIV + 0x6, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writeBB" + } + , + { + SIOCIWFIRSTPRIV + 0x7, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readnicb" + } + , + { + SIOCIWFIRSTPRIV + 0x8, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writenicb" + } + , + { + SIOCIWFIRSTPRIV + 0x9, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "apinfo" + } + +#endif + , + { + SIOCIWFIRSTPRIV + 0x3, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "forcereset" + + } + +}; + + +static iw_handler r8192_private_handler[] = { +// r8192_wx_set_monitor, /* SIOCIWFIRSTPRIV */ + r8192_wx_set_crcmon, /*SIOCIWSECONDPRIV*/ +// r8192_wx_set_forceassociate, +// r8192_wx_set_beaconinterval, +// r8192_wx_set_monitor_type, + r8192_wx_set_scan_type, + r8192_wx_set_rawtx, +#ifdef JOHN_IOCTL + r8192_wx_read_regs, + r8192_wx_write_regs, + r8192_wx_read_bb, + r8192_wx_write_bb, + r8192_wx_read_nicb, + r8192_wx_write_nicb, + r8192_wx_get_ap_status, +#endif + //r8192_wx_null, + r8192_wx_force_reset, +}; + +//#if WIRELESS_EXT >= 17 +struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + struct ieee80211_device* ieee = priv->ieee80211; + struct iw_statistics* wstats = &priv->wstats; + int tmp_level = 0; + int tmp_qual = 0; + int tmp_noise = 0; + if(ieee->state < IEEE80211_LINKED) + { + wstats->qual.qual = 0; + wstats->qual.level = 0; + wstats->qual.noise = 0; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)) + wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; +#else + wstats->qual.updated = 0x0f; +#endif + return wstats; + } + + tmp_level = (&ieee->current_network)->stats.rssi; + tmp_qual = (&ieee->current_network)->stats.signal; + tmp_noise = (&ieee->current_network)->stats.noise; + //printk("level:%d, qual:%d, noise:%d\n", tmp_level, tmp_qual, tmp_noise); + + wstats->qual.level = tmp_level; + wstats->qual.qual = tmp_qual; + wstats->qual.noise = tmp_noise; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)) + wstats->qual.updated = IW_QUAL_ALL_UPDATED| IW_QUAL_DBM; +#else + wstats->qual.updated = 0x0f; +#endif + return wstats; +} +//#endif + + +struct iw_handler_def r8192_wx_handlers_def={ + .standard = r8192_wx_handlers, + .num_standard = sizeof(r8192_wx_handlers) / sizeof(iw_handler), + .private = r8192_private_handler, + .num_private = sizeof(r8192_private_handler) / sizeof(iw_handler), + .num_private_args = sizeof(r8192_private_args) / sizeof(struct iw_priv_args), +#if WIRELESS_EXT >= 17 + .get_wireless_stats = r8192_get_wireless_stats, +#endif + .private_args = (struct iw_priv_args *)r8192_private_args, +}; diff --git a/drivers/staging/rtl8192u/r8192U_wx.h b/drivers/staging/rtl8192u/r8192U_wx.h new file mode 100644 index 000000000000..b2f7a571b1c8 --- /dev/null +++ b/drivers/staging/rtl8192u/r8192U_wx.h @@ -0,0 +1,23 @@ +/* + This is part of rtl8180 OpenSource driver - v 0.3 + Copyright (C) Andrea Merello 2004 + Released under the terms of GPL (General Public Licence) + + Parts of this driver are based on the GPL part of the official realtek driver + Parts of this driver are based on the rtl8180 driver skeleton from Patric Schenke & Andres Salomon + Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver + + We want to tanks the Authors of such projects and the Ndiswrapper project Authors. +*/ + +/* this file (will) contains wireless extension handlers*/ + +#ifndef R8180_WX_H +#define R8180_WX_H +//#include +//#include "ieee80211.h" +extern struct iw_handler_def r8192_wx_handlers_def; +/* Enable the rtl819x_core.c to share this function, david 2008.9.22 */ +extern struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev); + +#endif diff --git a/drivers/staging/rtl8192u/r819xU_HTGen.h b/drivers/staging/rtl8192u/r819xU_HTGen.h new file mode 100644 index 000000000000..f37b6d69b404 --- /dev/null +++ b/drivers/staging/rtl8192u/r819xU_HTGen.h @@ -0,0 +1,13 @@ +// +// IOT Action for different AP +// +typedef enum _HT_IOT_ACTION{ + HT_IOT_ACT_TX_USE_AMSDU_4K = 0x00000001, + HT_IOT_ACT_TX_USE_AMSDU_8K = 0x00000002, + HT_IOT_ACT_DECLARE_MCS13 = 0x00000004, + HT_IOT_ACT_DISABLE_EDCA_TURBO = 0x00000008, + HT_IOT_ACT_MGNT_USE_CCK_6M = 0x00000010, + HT_IOT_ACT_CDD_FSYNC = 0x00000020, + HT_IOT_ACT_PURE_N_MODE = 0x00000040, +}HT_IOT_ACTION_E, *PHT_IOT_ACTION_E; + diff --git a/drivers/staging/rtl8192u/r819xU_HTType.h b/drivers/staging/rtl8192u/r819xU_HTType.h new file mode 100644 index 000000000000..01f58b902028 --- /dev/null +++ b/drivers/staging/rtl8192u/r819xU_HTType.h @@ -0,0 +1,391 @@ +#ifndef _R819XU_HTTYPE_H_ +#define _R819XU_HTTYPE_H_ + + +//------------------------------------------------------------ +// The HT Capability element is present in beacons, association request, +// reassociation request and probe response frames +//------------------------------------------------------------ + +// +// Operation mode value +// +#define HT_OPMODE_NO_PROTECT 0 +#define HT_OPMODE_OPTIONAL 1 +#define HT_OPMODE_40MHZ_PROTECT 2 +#define HT_OPMODE_MIXED 3 + +// +// MIMO Power Save Setings +// +#define MIMO_PS_STATIC 0 +#define MIMO_PS_DYNAMIC 1 +#define MIMO_PS_NOLIMIT 3 + + +// +// There should be 128 bits to cover all of the MCS rates. However, since +// 8190 does not support too much rates, one integer is quite enough. +// + +#define sHTCLng 4 + + +#define HT_SUPPORTED_MCS_1SS_BITMAP 0x000000ff +#define HT_SUPPORTED_MCS_2SS_BITMAP 0x0000ff00 +#define HT_SUPPORTED_MCS_1SS_2SS_BITMAP HT_MCS_1SS_BITMAP|HT_MCS_1SS_2SS_BITMAP + + +typedef enum _HT_MCS_RATE{ + HT_MCS0 = 0x00000001, + HT_MCS1 = 0x00000002, + HT_MCS2 = 0x00000004, + HT_MCS3 = 0x00000008, + HT_MCS4 = 0x00000010, + HT_MCS5 = 0x00000020, + HT_MCS6 = 0x00000040, + HT_MCS7 = 0x00000080, + HT_MCS8 = 0x00000100, + HT_MCS9 = 0x00000200, + HT_MCS10 = 0x00000400, + HT_MCS11 = 0x00000800, + HT_MCS12 = 0x00001000, + HT_MCS13 = 0x00002000, + HT_MCS14 = 0x00004000, + HT_MCS15 = 0x00008000, + // Do not define MCS32 here although 8190 support MCS32 +}HT_MCS_RATE,*PHT_MCS_RATE; + +// +// Represent Channel Width in HT Capabilities +// +typedef enum _HT_CHANNEL_WIDTH{ + HT_CHANNEL_WIDTH_20 = 0, + HT_CHANNEL_WIDTH_20_40 = 1, +}HT_CHANNEL_WIDTH, *PHT_CHANNEL_WIDTH; + +// +// Represent Extention Channel Offset in HT Capabilities +// This is available only in 40Mhz mode. +// +typedef enum _HT_EXTCHNL_OFFSET{ + HT_EXTCHNL_OFFSET_NO_EXT = 0, + HT_EXTCHNL_OFFSET_UPPER = 1, + HT_EXTCHNL_OFFSET_NO_DEF = 2, + HT_EXTCHNL_OFFSET_LOWER = 3, +}HT_EXTCHNL_OFFSET, *PHT_EXTCHNL_OFFSET; + +typedef enum _CHNLOP{ + CHNLOP_NONE = 0, // No Action now + CHNLOP_SCAN = 1, // Scan in progress + CHNLOP_SWBW = 2, // Bandwidth switching in progress + CHNLOP_SWCHNL = 3, // Software Channel switching in progress +} CHNLOP, *PCHNLOP; + +// Determine if the Channel Operation is in progress +#define CHHLOP_IN_PROGRESS(_pHTInfo) \ + ((_pHTInfo)->ChnlOp > CHNLOP_NONE) ? TRUE : FALSE + + +typedef enum _HT_ACTION{ + ACT_RECOMMAND_WIDTH = 0, + ACT_MIMO_PWR_SAVE = 1, + ACT_PSMP = 2, + ACT_SET_PCO_PHASE = 3, + ACT_MIMO_CHL_MEASURE = 4, + ACT_RECIPROCITY_CORRECT = 5, + ACT_MIMO_CSI_MATRICS = 6, + ACT_MIMO_NOCOMPR_STEER = 7, + ACT_MIMO_COMPR_STEER = 8, + ACT_ANTENNA_SELECT = 9, +} HT_ACTION, *PHT_ACTION; + + +/* 2007/06/07 MH Define sub-carrier mode for 40MHZ. */ +typedef enum _HT_Bandwidth_40MHZ_Sub_Carrier{ + SC_MODE_DUPLICATE = 0, + SC_MODE_LOWER = 1, + SC_MODE_UPPER = 2, + SC_MODE_FULL40MHZ = 3, +}HT_BW40_SC_E; + +typedef struct _HT_CAPABILITY_ELE{ + + //HT capability info + u8 AdvCoding:1; + u8 ChlWidth:1; + u8 MimoPwrSave:2; + u8 GreenField:1; + u8 ShortGI20Mhz:1; + u8 ShortGI40Mhz:1; + u8 TxSTBC:1; + u8 RxSTBC:2; + u8 DelayBA:1; + u8 MaxAMSDUSize:1; + u8 DssCCk:1; + u8 PSMP:1; + u8 Rsvd1:1; + u8 LSigTxopProtect:1; + + //MAC HT parameters info + u8 MaxRxAMPDUFactor:2; + u8 MPDUDensity:3; + u8 Rsvd2:3; + + //Supported MCS set + u8 MCS[16]; + + + //Extended HT Capability Info + u16 ExtHTCapInfo; + + //TXBF Capabilities + u8 TxBFCap[4]; + + //Antenna Selection Capabilities + u8 ASCap; + +}__attribute__((packed)) HT_CAPABILITY_ELE, *PHT_CAPABILITY_ELE; + +//------------------------------------------------------------ +// The HT Information element is present in beacons +// Only AP is required to include this element +//------------------------------------------------------------ + +typedef struct _HT_INFORMATION_ELE{ + u8 ControlChl; + + u8 ExtChlOffset:2; + u8 RecommemdedTxWidth:1; + u8 RIFS:1; + u8 PSMPAccessOnly:1; + u8 SrvIntGranularity:3; + + u8 OptMode:2; + u8 NonGFDevPresent:1; + u8 Revd1:5; + u8 Revd2:8; + + u8 Rsvd3:6; + u8 DualBeacon:1; + u8 DualCTSProtect:1; + + u8 SecondaryBeacon:1; + u8 LSigTxopProtectFull:1; + u8 PcoActive:1; + u8 PcoPhase:1; + u8 Rsvd4:4; + + u8 BasicMSC[16]; +}__attribute__((packed)) HT_INFORMATION_ELE, *PHT_INFORMATION_ELE; + +// +// MIMO Power Save control field. +// This is appear in MIMO Power Save Action Frame +// +typedef struct _MIMOPS_CTRL{ + u8 MimoPsEnable:1; + u8 MimoPsMode:1; + u8 Reserved:6; +} MIMOPS_CTRL, *PMIMOPS_CTRL; + +typedef enum _HT_SPEC_VER{ + HT_SPEC_VER_IEEE = 0, + HT_SPEC_VER_EWC = 1, +}HT_SPEC_VER, *PHT_SPEC_VER; + +typedef enum _HT_AGGRE_MODE_E{ + HT_AGG_AUTO = 0, + HT_AGG_FORCE_ENABLE = 1, + HT_AGG_FORCE_DISABLE = 2, +}HT_AGGRE_MODE_E, *PHT_AGGRE_MODE_E; + +//------------------------------------------------------------ +// The Data structure is used to keep HT related variables when card is +// configured as non-AP STA mode. **Note** Current_xxx should be set +// to default value in HTInitializeHTInfo() +//------------------------------------------------------------ + +typedef struct _RT_HIGH_THROUGHPUT{ +// DECLARE_RT_OBJECT(_RT_HIGH_THROUGHPUT); + u8 bEnableHT; + u8 bCurrentHTSupport; + + u8 bRegBW40MHz; // Tx 40MHz channel capablity + u8 bCurBW40MHz; // Tx 40MHz channel capability + + u8 bRegShortGI40MHz; // Tx Short GI for 40Mhz + u8 bCurShortGI40MHz; // Tx Short GI for 40MHz + + u8 bRegShortGI20MHz; // Tx Short GI for 20MHz + u8 bCurShortGI20MHz; // Tx Short GI for 20MHz + + u8 bRegSuppCCK; // Tx CCK rate capability + u8 bCurSuppCCK; // Tx CCK rate capability + + // 802.11n spec version for "peer" + HT_SPEC_VER ePeerHTSpecVer; + + + // HT related information for "Self" + HT_CAPABILITY_ELE SelfHTCap; // This is HT cap element sent to peer STA, which also indicate HT Rx capabilities. + HT_INFORMATION_ELE SelfHTInfo; // This is HT info element sent to peer STA, which also indicate HT Rx capabilities. + + // HT related information for "Peer" + u8 PeerHTCapBuf[32]; + u8 PeerHTInfoBuf[32]; + + + // A-MSDU related + u8 bAMSDU_Support; // This indicates Tx A-MSDU capability + u16 nAMSDU_MaxSize; // This indicates Tx A-MSDU capability + u8 bCurrent_AMSDU_Support; // This indicates Tx A-MSDU capability + u16 nCurrent_AMSDU_MaxSize; // This indicates Tx A-MSDU capability + + + // AMPDU related <2006.08.10 Emily> + u8 bAMPDUEnable; // This indicate Tx A-MPDU capability + u8 bCurrentAMPDUEnable; // This indicate Tx A-MPDU capability + u8 AMPDU_Factor; // This indicate Tx A-MPDU capability + u8 CurrentAMPDUFactor; // This indicate Tx A-MPDU capability + u8 MPDU_Density; // This indicate Tx A-MPDU capability + u8 CurrentMPDUDensity; // This indicate Tx A-MPDU capability + + // Forced A-MPDU enable + HT_AGGRE_MODE_E ForcedAMPDUMode; + u8 ForcedAMPDUFactor; + u8 ForcedMPDUDensity; + + // Forced A-MSDU enable + HT_AGGRE_MODE_E ForcedAMSDUMode; + u16 ForcedAMSDUMaxSize; + + u8 bForcedShortGI; + + u8 CurrentOpMode; + + // MIMO PS related + u8 SelfMimoPs; + u8 PeerMimoPs; + + // 40MHz Channel Offset settings. + HT_EXTCHNL_OFFSET CurSTAExtChnlOffset; + u8 bCurTxBW40MHz; // If we use 40 MHz to Tx + u8 PeerBandwidth; + + // For Bandwidth Switching + u8 bSwBwInProgress; + CHNLOP ChnlOp; // software switching channel in progress. By Bruce, 2008-02-15. + u8 SwBwStep; + //RT_TIMER SwBwTimer; + struct timer_list SwBwTimer; + + // For Realtek proprietary A-MPDU factor for aggregation + u8 bRegRT2RTAggregation; + u8 bCurrentRT2RTAggregation; + u8 bCurrentRT2RTLongSlotTime; + u8 szRT2RTAggBuffer[10]; + + // Rx Reorder control + u8 bRegRxReorderEnable; + u8 bCurRxReorderEnable; + u8 RxReorderWinSize; + u8 RxReorderPendingTime; + u16 RxReorderDropCounter; + +#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE + u8 UsbTxAggrNum; +#endif +#ifdef USB_RX_AGGREGATION_SUPPORT + u8 UsbRxFwAggrEn; + u8 UsbRxFwAggrPageNum; + u8 UsbRxFwAggrPacketNum; + u8 UsbRxFwAggrTimeout; +#endif + + // Add for Broadcom(Linksys) IOT. Joseph + u8 bIsPeerBcm; + + // For IOT issue. + u32 IOTAction; +}RT_HIGH_THROUGHPUT, *PRT_HIGH_THROUGHPUT; + + +//------------------------------------------------------------ +// The Data structure is used to keep HT related variable for "each Sta" +// when card is configured as "AP mode" +//------------------------------------------------------------ + +typedef struct _RT_HTINFO_STA_ENTRY{ + u8 bEnableHT; + + u8 bSupportCck; + + u16 AMSDU_MaxSize; + + u8 AMPDU_Factor; + u8 MPDU_Density; + + u8 HTHighestOperaRate; + + u8 bBw40MHz; + + u8 MimoPs; + + u8 McsRateSet[16]; + + +}RT_HTINFO_STA_ENTRY, *PRT_HTINFO_STA_ENTRY; + + + + + +//------------------------------------------------------------ +// The Data structure is used to keep HT related variable for "each AP" +// when card is configured as "STA mode" +//------------------------------------------------------------ + +typedef struct _BSS_HT{ + + u8 bdSupportHT; + + // HT related elements + u8 bdHTCapBuf[32]; + u16 bdHTCapLen; + u8 bdHTInfoBuf[32]; + u16 bdHTInfoLen; + + HT_SPEC_VER bdHTSpecVer; + //HT_CAPABILITY_ELE bdHTCapEle; + //HT_INFORMATION_ELE bdHTInfoEle; + + u8 bdRT2RTAggregation; + u8 bdRT2RTLongSlotTime; +}BSS_HT, *PBSS_HT; + +typedef struct _MIMO_RSSI{ + u32 EnableAntenna; + u32 AntennaA; + u32 AntennaB; + u32 AntennaC; + u32 AntennaD; + u32 Average; +}MIMO_RSSI, *PMIMO_RSSI; + +typedef struct _MIMO_EVM{ + u32 EVM1; + u32 EVM2; +}MIMO_EVM, *PMIMO_EVM; + +typedef struct _FALSE_ALARM_STATISTICS{ + u32 Cnt_Parity_Fail; + u32 Cnt_Rate_Illegal; + u32 Cnt_Crc8_fail; + u32 Cnt_all; +}FALSE_ALARM_STATISTICS, *PFALSE_ALARM_STATISTICS; + + + +#endif //__INC_HTTYPE_H + diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.c b/drivers/staging/rtl8192u/r819xU_cmdpkt.c new file mode 100644 index 000000000000..2f87503cd301 --- /dev/null +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.c @@ -0,0 +1,822 @@ +/****************************************************************************** + + (c) Copyright 2008, RealTEK Technologies Inc. All Rights Reserved. + + Module: r819xusb_cmdpkt.c (RTL8190 TX/RX command packet handler Source C File) + + Note: The module is responsible for handling TX and RX command packet. + 1. TX : Send set and query configuration command packet. + 2. RX : Receive tx feedback, beacon state, query configuration + command packet. + + Function: + + Export: + + Abbrev: + + History: + Data Who Remark + + 05/06/2008 amy Create initial version porting from windows driver. + +******************************************************************************/ +#include "r8192U.h" +#include "r819xU_cmdpkt.h" +/*---------------------------Define Local Constant---------------------------*/ +/* Debug constant*/ +#define CMPK_DEBOUNCE_CNT 1 +/* 2007/10/24 MH Add for printing a range of data. */ +#define CMPK_PRINT(Address)\ +{\ + unsigned char i;\ + u32 temp[10];\ + \ + memcpy(temp, Address, 40);\ + for (i = 0; i <40; i+=4)\ + printk("\r\n %08x", temp[i]);\ +}\ +/*---------------------------Define functions---------------------------------*/ + +rt_status +SendTxCommandPacket( + struct net_device *dev, + void* pData, + u32 DataLen + ) +{ + rt_status rtStatus = RT_STATUS_SUCCESS; + struct r8192_priv *priv = ieee80211_priv(dev); + struct sk_buff *skb; + cb_desc *tcb_desc; + unsigned char *ptr_buf; + //bool bLastInitPacket = false; + + //PlatformAcquireSpinLock(Adapter, RT_TX_SPINLOCK); + + //Get TCB and local buffer from common pool. (It is shared by CmdQ, MgntQ, and USB coalesce DataQ) + skb = dev_alloc_skb(USB_HWDESC_HEADER_LEN + DataLen + 4); + memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); + tcb_desc = (cb_desc*)(skb->cb + MAX_DEV_ADDR_SIZE); + tcb_desc->queue_index = TXCMD_QUEUE; + tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_NORMAL; + tcb_desc->bLastIniPkt = 0; + skb_reserve(skb, USB_HWDESC_HEADER_LEN); + ptr_buf = skb_put(skb, DataLen); + memset(ptr_buf,0,DataLen); + memcpy(ptr_buf,pData,DataLen); + tcb_desc->txbuf_size= (u16)DataLen; + + if(!priv->ieee80211->check_nic_enough_desc(dev,tcb_desc->queue_index)|| + (!skb_queue_empty(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index]))||\ + (priv->ieee80211->queue_stop) ) { + RT_TRACE(COMP_FIRMWARE,"===================NULL packet==================================> tx full!\n"); + skb_queue_tail(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index], skb); + } else { + priv->ieee80211->softmac_hard_start_xmit(skb,dev); + } + + //PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK); + return rtStatus; +} + +/*----------------------------------------------------------------------------- + * Function: cmpk_message_handle_tx() + * + * Overview: Driver internal module can call the API to send message to + * firmware side. For example, you can send a debug command packet. + * Or you can send a request for FW to modify RLX4181 LBUS HW bank. + * Otherwise, you can change MAC/PHT/RF register by firmware at + * run time. We do not support message more than one segment now. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/06/2008 amy porting from windows code. + * + *---------------------------------------------------------------------------*/ + extern rt_status cmpk_message_handle_tx( + struct net_device *dev, + u8* codevirtualaddress, + u32 packettype, + u32 buffer_len) +{ + + bool rt_status = true; +#ifdef RTL8192U + return rt_status; +#else + struct r8192_priv *priv = ieee80211_priv(dev); + u16 frag_threshold; + u16 frag_length, frag_offset = 0; + //u16 total_size; + //int i; + + rt_firmware *pfirmware = priv->pFirmware; + struct sk_buff *skb; + unsigned char *seg_ptr; + cb_desc *tcb_desc; + u8 bLastIniPkt; + + firmware_init_param(dev); + //Fragmentation might be required + frag_threshold = pfirmware->cmdpacket_frag_thresold; + do { + if((buffer_len - frag_offset) > frag_threshold) { + frag_length = frag_threshold ; + bLastIniPkt = 0; + + } else { + frag_length = buffer_len - frag_offset; + bLastIniPkt = 1; + + } + + /* Allocate skb buffer to contain firmware info and tx descriptor info + * add 4 to avoid packet appending overflow. + * */ + #ifdef RTL8192U + skb = dev_alloc_skb(USB_HWDESC_HEADER_LEN + frag_length + 4); + #else + skb = dev_alloc_skb(frag_length + 4); + #endif + memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); + tcb_desc = (cb_desc*)(skb->cb + MAX_DEV_ADDR_SIZE); + tcb_desc->queue_index = TXCMD_QUEUE; + tcb_desc->bCmdOrInit = packettype; + tcb_desc->bLastIniPkt = bLastIniPkt; + + #ifdef RTL8192U + skb_reserve(skb, USB_HWDESC_HEADER_LEN); + #endif + + seg_ptr = skb_put(skb, buffer_len); + /* + * Transform from little endian to big endian + * and pending zero + */ + memcpy(seg_ptr,codevirtualaddress,buffer_len); + tcb_desc->txbuf_size= (u16)buffer_len; + + + if(!priv->ieee80211->check_nic_enough_desc(dev,tcb_desc->queue_index)|| + (!skb_queue_empty(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index]))||\ + (priv->ieee80211->queue_stop) ) { + RT_TRACE(COMP_FIRMWARE,"=====================================================> tx full!\n"); + skb_queue_tail(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index], skb); + } else { + priv->ieee80211->softmac_hard_start_xmit(skb,dev); + } + + codevirtualaddress += frag_length; + frag_offset += frag_length; + + }while(frag_offset < buffer_len); + + return rt_status; + + +#endif +} /* CMPK_Message_Handle_Tx */ + +/*----------------------------------------------------------------------------- + * Function: cmpk_counttxstatistic() + * + * Overview: + * + * Input: PADAPTER pAdapter - . + * CMPK_TXFB_T *psTx_FB - . + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/12/2008 amy Create Version 0 porting from windows code. + * + *---------------------------------------------------------------------------*/ +static void +cmpk_count_txstatistic( + struct net_device *dev, + cmpk_txfb_t *pstx_fb) +{ + struct r8192_priv *priv = ieee80211_priv(dev); +#ifdef ENABLE_PS + RT_RF_POWER_STATE rtState; + + pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_RF_STATE, (pu1Byte)(&rtState)); + + // When RF is off, we should not count the packet for hw/sw synchronize + // reason, ie. there may be a duration while sw switch is changed and hw + // switch is being changed. 2006.12.04, by shien chang. + if (rtState == eRfOff) + { + return; + } +#endif + +#ifdef TODO + if(pAdapter->bInHctTest) + return; +#endif + /* We can not know the packet length and transmit type: broadcast or uni + or multicast. So the relative statistics must be collected in tx + feedback info. */ + if (pstx_fb->tok) + { + priv->stats.txfeedbackok++; + priv->stats.txoktotal++; + priv->stats.txokbytestotal += pstx_fb->pkt_length; + priv->stats.txokinperiod++; + + /* We can not make sure broadcast/multicast or unicast mode. */ + if (pstx_fb->pkt_type == PACKET_MULTICAST) + { + priv->stats.txmulticast++; + priv->stats.txbytesmulticast += pstx_fb->pkt_length; + } + else if (pstx_fb->pkt_type == PACKET_BROADCAST) + { + priv->stats.txbroadcast++; + priv->stats.txbytesbroadcast += pstx_fb->pkt_length; + } + else + { + priv->stats.txunicast++; + priv->stats.txbytesunicast += pstx_fb->pkt_length; + } + } + else + { + priv->stats.txfeedbackfail++; + priv->stats.txerrtotal++; + priv->stats.txerrbytestotal += pstx_fb->pkt_length; + + /* We can not make sure broadcast/multicast or unicast mode. */ + if (pstx_fb->pkt_type == PACKET_MULTICAST) + { + priv->stats.txerrmulticast++; + } + else if (pstx_fb->pkt_type == PACKET_BROADCAST) + { + priv->stats.txerrbroadcast++; + } + else + { + priv->stats.txerrunicast++; + } + } + + priv->stats.txretrycount += pstx_fb->retry_cnt; + priv->stats.txfeedbackretry += pstx_fb->retry_cnt; + +} /* cmpk_CountTxStatistic */ + + + +/*----------------------------------------------------------------------------- + * Function: cmpk_handle_tx_feedback() + * + * Overview: The function is responsible for extract the message inside TX + * feedbck message from firmware. It will contain dedicated info in + * ws-06-0063-rtl8190-command-packet-specification. Please + * refer to chapter "TX Feedback Element". We have to read 20 bytes + * in the command packet. + * + * Input: struct net_device * dev + * u8 * pmsg - Msg Ptr of the command packet. + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/08/2008 amy Create Version 0 porting from windows code. + * + *---------------------------------------------------------------------------*/ +static void +cmpk_handle_tx_feedback( + struct net_device *dev, + u8 * pmsg) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + cmpk_txfb_t rx_tx_fb; /* */ + + priv->stats.txfeedback++; + + /* 0. Display received message. */ + //cmpk_Display_Message(CMPK_RX_TX_FB_SIZE, pMsg); + + /* 1. Extract TX feedback info from RFD to temp structure buffer. */ + /* It seems that FW use big endian(MIPS) and DRV use little endian in + windows OS. So we have to read the content byte by byte or transfer + endian type before copy the message copy. */ +#if 0 // The TX FEEDBACK packet element address + //rx_tx_fb.Element_ID = pMsg[0]; + //rx_tx_fb.Length = pMsg[1]; + rx_tx_fb.TOK = pMsg[2]>>7; + rx_tx_fb.Fail_Reason = (pMsg[2] & 0x70) >> 4; + rx_tx_fb.TID = (pMsg[2] & 0x0F); + rx_tx_fb.Qos_Pkt = pMsg[3] >> 7; + rx_tx_fb.Bandwidth = (pMsg[3] & 0x40) >> 6; + rx_tx_fb.Retry_Cnt = pMsg[5]; + rx_tx_fb.Pkt_ID = (pMsg[6] << 8) | pMsg[7]; + rx_tx_fb.Seq_Num = (pMsg[8] << 8) | pMsg[9]; + rx_tx_fb.S_Rate = pMsg[10]; + rx_tx_fb.F_Rate = pMsg[11]; + rx_tx_fb.S_RTS_Rate = pMsg[12]; + rx_tx_fb.F_RTS_Rate = pMsg[13]; + rx_tx_fb.pkt_length = (pMsg[14] << 8) | pMsg[15]; +#endif + /* 2007/07/05 MH Use pointer to transfer structure memory. */ + //memcpy((UINT8 *)&rx_tx_fb, pMsg, sizeof(CMPK_TXFB_T)); + memcpy((u8*)&rx_tx_fb, pmsg, sizeof(cmpk_txfb_t)); + /* 2. Use tx feedback info to count TX statistics. */ + cmpk_count_txstatistic(dev, &rx_tx_fb); +#if 0 + /* 2007/07/11 MH Assign current operate rate. */ + if (pAdapter->RegWirelessMode == WIRELESS_MODE_A || + pAdapter->RegWirelessMode == WIRELESS_MODE_B || + pAdapter->RegWirelessMode == WIRELESS_MODE_G) + { + pMgntInfo->CurrentOperaRate = (rx_tx_fb.F_Rate & 0x7F); + } + else if (pAdapter->RegWirelessMode == WIRELESS_MODE_N_24G || + pAdapter->RegWirelessMode == WIRELESS_MODE_N_5G) + { + pMgntInfo->HTCurrentOperaRate = (rx_tx_fb.F_Rate & 0x8F); + } +#endif + /* 2007/01/17 MH Comment previous method for TX statistic function. */ + /* Collect info TX feedback packet to fill TCB. */ + /* We can not know the packet length and transmit type: broadcast or uni + or multicast. */ + //CountTxStatistics( pAdapter, &tcb ); + +} /* cmpk_Handle_Tx_Feedback */ + +void +cmdpkt_beacontimerinterrupt_819xusb( + struct net_device *dev +) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u16 tx_rate; + { + // + // 070117, rcnjko: 87B have to S/W beacon for DTM encryption_cmn. + // + if(priv->ieee80211->current_network.mode == IEEE_A || + priv->ieee80211->current_network.mode == IEEE_N_5G || + (priv->ieee80211->current_network.mode == IEEE_N_24G && (!priv->ieee80211->pHTInfo->bCurSuppCCK))) + { + tx_rate = 60; + DMESG("send beacon frame tx rate is 6Mbpm\n"); + } + else + { + tx_rate =10; + DMESG("send beacon frame tx rate is 1Mbpm\n"); + } + + rtl819xusb_beacon_tx(dev,tx_rate); // HW Beacon + + } + +} + + + + +/*----------------------------------------------------------------------------- + * Function: cmpk_handle_interrupt_status() + * + * Overview: The function is responsible for extract the message from + * firmware. It will contain dedicated info in + * ws-07-0063-v06-rtl819x-command-packet-specification-070315.doc. + * Please refer to chapter "Interrupt Status Element". + * + * Input: struct net_device *dev, + * u8* pmsg - Message Pointer of the command packet. + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/12/2008 amy Add this for rtl8192 porting from windows code. + * + *---------------------------------------------------------------------------*/ +static void +cmpk_handle_interrupt_status( + struct net_device *dev, + u8* pmsg) +{ + cmpk_intr_sta_t rx_intr_status; /* */ + struct r8192_priv *priv = ieee80211_priv(dev); + + DMESG("---> cmpk_Handle_Interrupt_Status()\n"); + + /* 0. Display received message. */ + //cmpk_Display_Message(CMPK_RX_BEACON_STATE_SIZE, pMsg); + + /* 1. Extract TX feedback info from RFD to temp structure buffer. */ + /* It seems that FW use big endian(MIPS) and DRV use little endian in + windows OS. So we have to read the content byte by byte or transfer + endian type before copy the message copy. */ + //rx_bcn_state.Element_ID = pMsg[0]; + //rx_bcn_state.Length = pMsg[1]; + rx_intr_status.length = pmsg[1]; + if (rx_intr_status.length != (sizeof(cmpk_intr_sta_t) - 2)) + { + DMESG("cmpk_Handle_Interrupt_Status: wrong length!\n"); + return; + } + + + // Statistics of beacon for ad-hoc mode. + if( priv->ieee80211->iw_mode == IW_MODE_ADHOC) + { + //2 maybe need endian transform? + rx_intr_status.interrupt_status = *((u32 *)(pmsg + 4)); + //rx_intr_status.InterruptStatus = N2H4BYTE(*((UINT32 *)(pMsg + 4))); + + DMESG("interrupt status = 0x%x\n", rx_intr_status.interrupt_status); + + if (rx_intr_status.interrupt_status & ISR_TxBcnOk) + { + priv->ieee80211->bibsscoordinator = true; + priv->stats.txbeaconokint++; + } + else if (rx_intr_status.interrupt_status & ISR_TxBcnErr) + { + priv->ieee80211->bibsscoordinator = false; + priv->stats.txbeaconerr++; + } + + if (rx_intr_status.interrupt_status & ISR_BcnTimerIntr) + { + cmdpkt_beacontimerinterrupt_819xusb(dev); + } + + } + + // Other informations in interrupt status we need? + + + DMESG("<---- cmpk_handle_interrupt_status()\n"); + +} /* cmpk_handle_interrupt_status */ + + +/*----------------------------------------------------------------------------- + * Function: cmpk_handle_query_config_rx() + * + * Overview: The function is responsible for extract the message from + * firmware. It will contain dedicated info in + * ws-06-0063-rtl8190-command-packet-specification. Please + * refer to chapter "Beacon State Element". + * + * Input: u8 * pmsg - Message Pointer of the command packet. + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/12/2008 amy Create Version 0 porting from windows code. + * + *---------------------------------------------------------------------------*/ +static void +cmpk_handle_query_config_rx( + struct net_device *dev, + u8* pmsg) +{ + cmpk_query_cfg_t rx_query_cfg; /* */ + + /* 0. Display received message. */ + //cmpk_Display_Message(CMPK_RX_BEACON_STATE_SIZE, pMsg); + + /* 1. Extract TX feedback info from RFD to temp structure buffer. */ + /* It seems that FW use big endian(MIPS) and DRV use little endian in + windows OS. So we have to read the content byte by byte or transfer + endian type before copy the message copy. */ + //rx_query_cfg.Element_ID = pMsg[0]; + //rx_query_cfg.Length = pMsg[1]; + rx_query_cfg.cfg_action = (pmsg[4] & 0x80000000)>>31; + rx_query_cfg.cfg_type = (pmsg[4] & 0x60) >> 5; + rx_query_cfg.cfg_size = (pmsg[4] & 0x18) >> 3; + rx_query_cfg.cfg_page = (pmsg[6] & 0x0F) >> 0; + rx_query_cfg.cfg_offset = pmsg[7]; + rx_query_cfg.value = (pmsg[8] << 24) | (pmsg[9] << 16) | + (pmsg[10] << 8) | (pmsg[11] << 0); + rx_query_cfg.mask = (pmsg[12] << 24) | (pmsg[13] << 16) | + (pmsg[14] << 8) | (pmsg[15] << 0); + +} /* cmpk_Handle_Query_Config_Rx */ + + +/*----------------------------------------------------------------------------- + * Function: cmpk_count_tx_status() + * + * Overview: Count aggregated tx status from firmwar of one type rx command + * packet element id = RX_TX_STATUS. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/12/2008 amy Create Version 0 porting from windows code. + * + *---------------------------------------------------------------------------*/ +static void cmpk_count_tx_status( struct net_device *dev, + cmpk_tx_status_t *pstx_status) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + +#ifdef ENABLE_PS + + RT_RF_POWER_STATE rtstate; + + pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_RF_STATE, (pu1Byte)(&rtState)); + + // When RF is off, we should not count the packet for hw/sw synchronize + // reason, ie. there may be a duration while sw switch is changed and hw + // switch is being changed. 2006.12.04, by shien chang. + if (rtState == eRfOff) + { + return; + } +#endif + + priv->stats.txfeedbackok += pstx_status->txok; + priv->stats.txoktotal += pstx_status->txok; + + priv->stats.txfeedbackfail += pstx_status->txfail; + priv->stats.txerrtotal += pstx_status->txfail; + + priv->stats.txretrycount += pstx_status->txretry; + priv->stats.txfeedbackretry += pstx_status->txretry; + + //pAdapter->TxStats.NumTxOkBytesTotal += psTx_FB->pkt_length; + //pAdapter->TxStats.NumTxErrBytesTotal += psTx_FB->pkt_length; + //pAdapter->MgntInfo.LinkDetectInfo.NumTxOkInPeriod++; + + priv->stats.txmulticast += pstx_status->txmcok; + priv->stats.txbroadcast += pstx_status->txbcok; + priv->stats.txunicast += pstx_status->txucok; + + priv->stats.txerrmulticast += pstx_status->txmcfail; + priv->stats.txerrbroadcast += pstx_status->txbcfail; + priv->stats.txerrunicast += pstx_status->txucfail; + + priv->stats.txbytesmulticast += pstx_status->txmclength; + priv->stats.txbytesbroadcast += pstx_status->txbclength; + priv->stats.txbytesunicast += pstx_status->txuclength; + + priv->stats.last_packet_rate = pstx_status->rate; +} /* cmpk_CountTxStatus */ + + + +/*----------------------------------------------------------------------------- + * Function: cmpk_handle_tx_status() + * + * Overview: Firmware add a new tx feedback status to reduce rx command + * packet buffer operation load. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/12/2008 amy Create Version 0 porting from windows code. + * + *---------------------------------------------------------------------------*/ +static void +cmpk_handle_tx_status( + struct net_device *dev, + u8* pmsg) +{ + cmpk_tx_status_t rx_tx_sts; /* */ + + memcpy((void*)&rx_tx_sts, (void*)pmsg, sizeof(cmpk_tx_status_t)); + /* 2. Use tx feedback info to count TX statistics. */ + cmpk_count_tx_status(dev, &rx_tx_sts); + +} /* cmpk_Handle_Tx_Status */ + + +/*----------------------------------------------------------------------------- + * Function: cmpk_handle_tx_rate_history() + * + * Overview: Firmware add a new tx rate history + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/12/2008 amy Create Version 0 porting from windows code. + * + *---------------------------------------------------------------------------*/ +static void +cmpk_handle_tx_rate_history( + struct net_device *dev, + u8* pmsg) +{ + cmpk_tx_rahis_t *ptxrate; +// RT_RF_POWER_STATE rtState; + u8 i, j; + u16 length = sizeof(cmpk_tx_rahis_t); + u32 *ptemp; + struct r8192_priv *priv = ieee80211_priv(dev); + + +#ifdef ENABLE_PS + pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_RF_STATE, (pu1Byte)(&rtState)); + + // When RF is off, we should not count the packet for hw/sw synchronize + // reason, ie. there may be a duration while sw switch is changed and hw + // switch is being changed. 2006.12.04, by shien chang. + if (rtState == eRfOff) + { + return; + } +#endif + + ptemp = (u32 *)pmsg; + + // + // Do endian transfer to word alignment(16 bits) for windows system. + // You must do different endian transfer for linux and MAC OS + // + for (i = 0; i < (length/4); i++) + { + u16 temp1, temp2; + + temp1 = ptemp[i]&0x0000FFFF; + temp2 = ptemp[i]>>16; + ptemp[i] = (temp1<<16)|temp2; + } + + ptxrate = (cmpk_tx_rahis_t *)pmsg; + + if (ptxrate == NULL ) + { + return; + } + + for (i = 0; i < 16; i++) + { + // Collect CCK rate packet num + if (i < 4) + priv->stats.txrate.cck[i] += ptxrate->cck[i]; + + // Collect OFDM rate packet num + if (i< 8) + priv->stats.txrate.ofdm[i] += ptxrate->ofdm[i]; + + for (j = 0; j < 4; j++) + priv->stats.txrate.ht_mcs[j][i] += ptxrate->ht_mcs[j][i]; + } + +} /* cmpk_Handle_Tx_Rate_History */ + + +/*----------------------------------------------------------------------------- + * Function: cmpk_message_handle_rx() + * + * Overview: In the function, we will capture different RX command packet + * info. Every RX command packet element has different message + * length and meaning in content. We only support three type of RX + * command packet now. Please refer to document + * ws-06-0063-rtl8190-command-packet-specification. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/06/2008 amy Create Version 0 porting from windows code. + * + *---------------------------------------------------------------------------*/ +extern u32 +cmpk_message_handle_rx( + struct net_device *dev, + struct ieee80211_rx_stats *pstats) +{ +// u32 debug_level = DBG_LOUD; + struct r8192_priv *priv = ieee80211_priv(dev); + int total_length; + u8 cmd_length, exe_cnt = 0; + u8 element_id; + u8 *pcmd_buff; + + /* 0. Check inpt arguments. If is is a command queue message or pointer is + null. */ + if (/*(prfd->queue_id != CMPK_RX_QUEUE_ID) || */(pstats== NULL)) + { + /* Print error message. */ + /*RT_TRACE(COMP_SEND, DebugLevel, + ("\n\r[CMPK]-->Err queue id or pointer"));*/ + return 0; /* This is not a command packet. */ + } + + /* 1. Read received command packet message length from RFD. */ + total_length = pstats->Length; + + /* 2. Read virtual address from RFD. */ + pcmd_buff = pstats->virtual_address; + + /* 3. Read command pakcet element id and length. */ + element_id = pcmd_buff[0]; + /*RT_TRACE(COMP_SEND, DebugLevel, + ("\n\r[CMPK]-->element ID=%d Len=%d", element_id, total_length));*/ + + /* 4. Check every received command packet conent according to different + element type. Because FW may aggregate RX command packet to minimize + transmit time between DRV and FW.*/ + // Add a counter to prevent to locked in the loop too long + while (total_length > 0 || exe_cnt++ >100) + { + /* 2007/01/17 MH We support aggregation of different cmd in the same packet. */ + element_id = pcmd_buff[0]; + + switch(element_id) + { + case RX_TX_FEEDBACK: + cmpk_handle_tx_feedback (dev, pcmd_buff); + cmd_length = CMPK_RX_TX_FB_SIZE; + break; + + case RX_INTERRUPT_STATUS: + cmpk_handle_interrupt_status(dev, pcmd_buff); + cmd_length = sizeof(cmpk_intr_sta_t); + break; + + case BOTH_QUERY_CONFIG: + cmpk_handle_query_config_rx(dev, pcmd_buff); + cmd_length = CMPK_BOTH_QUERY_CONFIG_SIZE; + break; + + case RX_TX_STATUS: + cmpk_handle_tx_status(dev, pcmd_buff); + cmd_length = CMPK_RX_TX_STS_SIZE; + break; + + case RX_TX_PER_PKT_FEEDBACK: + // You must at lease add a switch case element here, + // Otherwise, we will jump to default case. + //DbgPrint("CCX Test\r\n"); + cmd_length = CMPK_RX_TX_FB_SIZE; + break; + + case RX_TX_RATE_HISTORY: + //DbgPrint(" rx tx rate history\r\n"); + cmpk_handle_tx_rate_history(dev, pcmd_buff); + cmd_length = CMPK_TX_RAHIS_SIZE; + break; + + default: + + RT_TRACE(COMP_ERR, "---->cmpk_message_handle_rx():unknow CMD Element\n"); + return 1; /* This is a command packet. */ + } + // 2007/01/22 MH Display received rx command packet info. + //cmpk_Display_Message(cmd_length, pcmd_buff); + + // 2007/01/22 MH Add to display tx statistic. + //cmpk_DisplayTxStatistic(pAdapter); + + /* 2007/03/09 MH Collect sidderent cmd element pkt num. */ + priv->stats.rxcmdpkt[element_id]++; + + total_length -= cmd_length; + pcmd_buff += cmd_length; + } /* while (total_length > 0) */ + return 1; /* This is a command packet. */ + +} /* CMPK_Message_Handle_Rx */ diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.h b/drivers/staging/rtl8192u/r819xU_cmdpkt.h new file mode 100644 index 000000000000..162959f55f9a --- /dev/null +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.h @@ -0,0 +1,217 @@ +#ifndef R819XUSB_CMDPKT_H +#define R819XUSB_CMDPKT_H +/* Different command packet have dedicated message length and definition. */ +#define CMPK_RX_TX_FB_SIZE sizeof(cmpk_txfb_t) //20 +#define CMPK_TX_SET_CONFIG_SIZE sizeof(cmpk_set_cfg_t) //16 +#define CMPK_BOTH_QUERY_CONFIG_SIZE sizeof(cmpk_set_cfg_t) //16 +#define CMPK_RX_TX_STS_SIZE sizeof(cmpk_tx_status_t)// +#define CMPK_RX_DBG_MSG_SIZE sizeof(cmpk_rx_dbginfo_t)// +#define CMPK_TX_RAHIS_SIZE sizeof(cmpk_tx_rahis_t) + +/* 2008/05/08 amy For USB constant. */ +#define ISR_TxBcnOk BIT27 // Transmit Beacon OK +#define ISR_TxBcnErr BIT26 // Transmit Beacon Error +#define ISR_BcnTimerIntr BIT13 // Beacon Timer Interrupt + +#if 0 +/* Define packet type. */ +typedef enum tag_packet_type +{ + PACKET_BROADCAST, + PACKET_MULTICAST, + PACKET_UNICAST, + PACKET_TYPE_MAX +}cmpk_pkt_type_e; +#endif + +/* Define element ID of command packet. */ + +/*------------------------------Define structure----------------------------*/ +/* Define different command packet structure. */ +/* 1. RX side: TX feedback packet. */ +typedef struct tag_cmd_pkt_tx_feedback +{ + // DWORD 0 + u8 element_id; /* Command packet type. */ + u8 length; /* Command packet length. */ + /* 2007/07/05 MH Change tx feedback info field. */ + /*------TX Feedback Info Field */ + u8 TID:4; /* */ + u8 fail_reason:3; /* */ + u8 tok:1; /* Transmit ok. */ + u8 reserve1:4; /* */ + u8 pkt_type:2; /* */ + u8 bandwidth:1; /* */ + u8 qos_pkt:1; /* */ + + // DWORD 1 + u8 reserve2; /* */ + /*------TX Feedback Info Field */ + u8 retry_cnt; /* */ + u16 pkt_id; /* */ + + // DWORD 3 + u16 seq_num; /* */ + u8 s_rate; /* Start rate. */ + u8 f_rate; /* Final rate. */ + + // DWORD 4 + u8 s_rts_rate; /* */ + u8 f_rts_rate; /* */ + u16 pkt_length; /* */ + + // DWORD 5 + u16 reserve3; /* */ + u16 duration; /* */ +}cmpk_txfb_t; + +/* 2. RX side: Interrupt status packet. It includes Beacon State, + Beacon Timer Interrupt and other useful informations in MAC ISR Reg. */ +typedef struct tag_cmd_pkt_interrupt_status +{ + u8 element_id; /* Command packet type. */ + u8 length; /* Command packet length. */ + u16 reserve; + u32 interrupt_status; /* Interrupt Status. */ +}cmpk_intr_sta_t; + + +/* 3. TX side: Set configuration packet. */ +typedef struct tag_cmd_pkt_set_configuration +{ + u8 element_id; /* Command packet type. */ + u8 length; /* Command packet length. */ + u16 reserve1; /* */ + u8 cfg_reserve1:3; + u8 cfg_size:2; /* Configuration info. */ + u8 cfg_type:2; /* Configuration info. */ + u8 cfg_action:1; /* Configuration info. */ + u8 cfg_reserve2; /* Configuration info. */ + u8 cfg_page:4; /* Configuration info. */ + u8 cfg_reserve3:4; /* Configuration info. */ + u8 cfg_offset; /* Configuration info. */ + u32 value; /* */ + u32 mask; /* */ +}cmpk_set_cfg_t; + +/* 4. Both side : TX/RX query configuraton packet. The query structure is the + same as set configuration. */ +#define cmpk_query_cfg_t cmpk_set_cfg_t + +/* 5. Multi packet feedback status. */ +typedef struct tag_tx_stats_feedback // PJ quick rxcmd 09042007 +{ + // For endian transfer --> Driver will not the same as firmware structure. + // DW 0 + u16 reserve1; + u8 length; // Command packet length + u8 element_id; // Command packet type + + // DW 1 + u16 txfail; // Tx Fail count + u16 txok; // Tx ok count + + // DW 2 + u16 txmcok; // tx multicast + u16 txretry; // Tx Retry count + + // DW 3 + u16 txucok; // tx unicast + u16 txbcok; // tx broadcast + + // DW 4 + u16 txbcfail; // + u16 txmcfail; // + + // DW 5 + u16 reserve2; // + u16 txucfail; // + + // DW 6-8 + u32 txmclength; + u32 txbclength; + u32 txuclength; + + // DW 9 + u16 reserve3_23; + u8 reserve3_1; + u8 rate; +}__attribute__((packed)) cmpk_tx_status_t; + +/* 6. Debug feedback message. */ +/* 2007/10/23 MH Define RX debug message */ +typedef struct tag_rx_debug_message_feedback +{ + // For endian transfer --> for driver + // DW 0 + u16 reserve1; + u8 length; // Command packet length + u8 element_id; // Command packet type + + // DW 1-?? + // Variable debug message. + +}cmpk_rx_dbginfo_t; + +/* 2008/03/20 MH Define transmit rate history. For big endian format. */ +typedef struct tag_tx_rate_history +{ + // For endian transfer --> for driver + // DW 0 + u8 element_id; // Command packet type + u8 length; // Command packet length + u16 reserved1; + + // DW 1-2 CCK rate counter + u16 cck[4]; + + // DW 3-6 + u16 ofdm[8]; + + // DW 7-14 + //UINT16 MCS_BW0_SG0[16]; + + // DW 15-22 + //UINT16 MCS_BW1_SG0[16]; + + // DW 23-30 + //UINT16 MCS_BW0_SG1[16]; + + // DW 31-38 + //UINT16 MCS_BW1_SG1[16]; + + // DW 7-14 BW=0 SG=0 + // DW 15-22 BW=1 SG=0 + // DW 23-30 BW=0 SG=1 + // DW 31-38 BW=1 SG=1 + u16 ht_mcs[4][16]; + +}__attribute__((packed)) cmpk_tx_rahis_t; + +typedef enum tag_command_packet_directories +{ + RX_TX_FEEDBACK = 0, + RX_INTERRUPT_STATUS = 1, + TX_SET_CONFIG = 2, + BOTH_QUERY_CONFIG = 3, + RX_TX_STATUS = 4, + RX_DBGINFO_FEEDBACK = 5, + RX_TX_PER_PKT_FEEDBACK = 6, + RX_TX_RATE_HISTORY = 7, + RX_CMD_ELE_MAX +}cmpk_element_e; + +typedef enum _rt_status{ + RT_STATUS_SUCCESS, + RT_STATUS_FAILURE, + RT_STATUS_PENDING, + RT_STATUS_RESOURCE +}rt_status,*prt_status; + +extern rt_status cmpk_message_handle_tx(struct net_device *dev, u8* codevirtualaddress, u32 packettype, u32 buffer_len); + +extern u32 cmpk_message_handle_rx(struct net_device *dev, struct ieee80211_rx_stats * pstats); +extern rt_status SendTxCommandPacket( struct net_device *dev, void* pData, u32 DataLen); + + +#endif diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c new file mode 100644 index 000000000000..5e09b4668c0b --- /dev/null +++ b/drivers/staging/rtl8192u/r819xU_firmware.c @@ -0,0 +1,700 @@ +/************************************************************************************************** + * Procedure: Init boot code/firmware code/data session + * + * Description: This routine will intialize firmware. If any error occurs during the initialization + * process, the routine shall terminate immediately and return fail. + * NIC driver should call NdisOpenFile only from MiniportInitialize. + * + * Arguments: The pointer of the adapter + + * Returns: + * NDIS_STATUS_FAILURE - the following initialization process should be terminated + * NDIS_STATUS_SUCCESS - if firmware initialization process success +**************************************************************************************************/ +//#include "ieee80211.h" +#include "r8192U.h" +#include "r8192U_hw.h" +#include "r819xU_firmware_img.h" +#include "r819xU_firmware.h" +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) +#include +#endif +void firmware_init_param(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + rt_firmware *pfirmware = priv->pFirmware; + + pfirmware->cmdpacket_frag_thresold = GET_COMMAND_PACKET_FRAG_THRESHOLD(MAX_TRANSMIT_BUFFER_SIZE); +} + +/* + * segment the img and use the ptr and length to remember info on each segment + * + */ +bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buffer_len) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + bool rt_status = true; + u16 frag_threshold; + u16 frag_length, frag_offset = 0; + //u16 total_size; + int i; + + rt_firmware *pfirmware = priv->pFirmware; + struct sk_buff *skb; + unsigned char *seg_ptr; + cb_desc *tcb_desc; + u8 bLastIniPkt; + + firmware_init_param(dev); + //Fragmentation might be required + frag_threshold = pfirmware->cmdpacket_frag_thresold; + do { + if((buffer_len - frag_offset) > frag_threshold) { + frag_length = frag_threshold ; + bLastIniPkt = 0; + + } else { + frag_length = buffer_len - frag_offset; + bLastIniPkt = 1; + + } + + /* Allocate skb buffer to contain firmware info and tx descriptor info + * add 4 to avoid packet appending overflow. + * */ + #ifdef RTL8192U + skb = dev_alloc_skb(USB_HWDESC_HEADER_LEN + frag_length + 4); + #else + skb = dev_alloc_skb(frag_length + 4); + #endif + memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); + tcb_desc = (cb_desc*)(skb->cb + MAX_DEV_ADDR_SIZE); + tcb_desc->queue_index = TXCMD_QUEUE; + tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_INIT; + tcb_desc->bLastIniPkt = bLastIniPkt; + + #ifdef RTL8192U + skb_reserve(skb, USB_HWDESC_HEADER_LEN); + #endif + seg_ptr = skb->data; + /* + * Transform from little endian to big endian + * and pending zero + */ + for(i=0 ; i < frag_length; i+=4) { + *seg_ptr++ = ((i+0)txbuf_size= (u16)i; + skb_put(skb, i); + + if(!priv->ieee80211->check_nic_enough_desc(dev,tcb_desc->queue_index)|| + (!skb_queue_empty(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index]))||\ + (priv->ieee80211->queue_stop) ) { + RT_TRACE(COMP_FIRMWARE,"=====================================================> tx full!\n"); + skb_queue_tail(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index], skb); + } else { + priv->ieee80211->softmac_hard_start_xmit(skb,dev); + } + + code_virtual_address += frag_length; + frag_offset += frag_length; + + }while(frag_offset < buffer_len); + + return rt_status; + +#if 0 +cmdsend_downloadcode_fail: + rt_status = false; + RT_TRACE(COMP_ERR, "CmdSendDownloadCode fail !!\n"); + return rt_status; +#endif +} + +bool +fwSendNullPacket( + struct net_device *dev, + u32 Length +) +{ + bool rtStatus = true; + struct r8192_priv *priv = ieee80211_priv(dev); + struct sk_buff *skb; + cb_desc *tcb_desc; + unsigned char *ptr_buf; + bool bLastInitPacket = false; + + //PlatformAcquireSpinLock(Adapter, RT_TX_SPINLOCK); + + //Get TCB and local buffer from common pool. (It is shared by CmdQ, MgntQ, and USB coalesce DataQ) + skb = dev_alloc_skb(Length+ 4); + memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); + tcb_desc = (cb_desc*)(skb->cb + MAX_DEV_ADDR_SIZE); + tcb_desc->queue_index = TXCMD_QUEUE; + tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_INIT; + tcb_desc->bLastIniPkt = bLastInitPacket; + ptr_buf = skb_put(skb, Length); + memset(ptr_buf,0,Length); + tcb_desc->txbuf_size= (u16)Length; + + if(!priv->ieee80211->check_nic_enough_desc(dev,tcb_desc->queue_index)|| + (!skb_queue_empty(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index]))||\ + (priv->ieee80211->queue_stop) ) { + RT_TRACE(COMP_FIRMWARE,"===================NULL packet==================================> tx full!\n"); + skb_queue_tail(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index], skb); + } else { + priv->ieee80211->softmac_hard_start_xmit(skb,dev); + } + + //PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK); + return rtStatus; +} + +#if 0 +/* + * Procedure : Download code into IMEM or DMEM + * Description: This routine will intialize firmware. If any error occurs during the initialization + * process, the routine shall terminate immediately and return fail. + * The routine copy virtual address get from opening of file into shared memory + * allocated during initialization. If code size larger than a conitneous shared + * memory may contain, the code should be divided into several section. + * !!!NOTES This finction should only be called during MPInitialization because + * A NIC driver should call NdisOpenFile only from MiniportInitialize. + * Arguments : The pointer of the adapter + * Code address (Virtual address, should fill descriptor with physical address) + * Code size + * Returns : + * RT_STATUS_FAILURE - the following initialization process should be terminated + * RT_STATUS_SUCCESS - if firmware initialization process success + */ +bool fwsend_download_code(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + rt_firmware *pfirmware = (rt_firmware*)(&priv->firmware); + + bool rt_status = true; + u16 length = 0; + u16 offset = 0; + u16 frag_threhold; + bool last_init_packet = false; + u32 check_txcmdwait_queueemptytime = 100000; + u16 cmd_buf_len; + u8 *ptr_cmd_buf; + + /* reset to 0 for first segment of img download */ + pfirmware->firmware_seg_index = 1; + + if(pfirmware->firmware_seg_index == pfirmware->firmware_seg_maxnum) { + last_init_packet = 1; + } + + cmd_buf_len = pfirmware->firmware_seg_container[pfirmware->firmware_seg_index-1].seg_size; + ptr_cmd_buf = pfirmware->firmware_seg_container[pfirmware->firmware_seg_index-1].seg_ptr; + rtl819xU_tx_cmd(dev, ptr_cmd_buf, cmd_buf_len, last_init_packet, DESC_PACKET_TYPE_INIT); + + rt_status = true; + return rt_status; +} +#endif + +//----------------------------------------------------------------------------- +// Procedure: Check whether main code is download OK. If OK, turn on CPU +// +// Description: CPU register locates in different page against general register. +// Switch to CPU register in the begin and switch back before return +// +// +// Arguments: The pointer of the adapter +// +// Returns: +// NDIS_STATUS_FAILURE - the following initialization process should be terminated +// NDIS_STATUS_SUCCESS - if firmware initialization process success +//----------------------------------------------------------------------------- +bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) +{ + bool rt_status = true; + int check_putcodeOK_time = 200000, check_bootOk_time = 200000; + u32 CPU_status = 0; + + /* Check whether put code OK */ + do { + CPU_status = read_nic_dword(dev, CPU_GEN); + + if(CPU_status&CPU_GEN_PUT_CODE_OK) + break; + + }while(check_putcodeOK_time--); + + if(!(CPU_status&CPU_GEN_PUT_CODE_OK)) { + RT_TRACE(COMP_ERR, "Download Firmware: Put code fail!\n"); + goto CPUCheckMainCodeOKAndTurnOnCPU_Fail; + } else { + RT_TRACE(COMP_FIRMWARE, "Download Firmware: Put code ok!\n"); + } + + /* Turn On CPU */ + CPU_status = read_nic_dword(dev, CPU_GEN); + write_nic_byte(dev, CPU_GEN, (u8)((CPU_status|CPU_GEN_PWR_STB_CPU)&0xff)); + mdelay(1000); + + /* Check whether CPU boot OK */ + do { + CPU_status = read_nic_dword(dev, CPU_GEN); + + if(CPU_status&CPU_GEN_BOOT_RDY) + break; + }while(check_bootOk_time--); + + if(!(CPU_status&CPU_GEN_BOOT_RDY)) { + goto CPUCheckMainCodeOKAndTurnOnCPU_Fail; + } else { + RT_TRACE(COMP_FIRMWARE, "Download Firmware: Boot ready!\n"); + } + + return rt_status; + +CPUCheckMainCodeOKAndTurnOnCPU_Fail: + RT_TRACE(COMP_ERR, "ERR in %s()\n", __FUNCTION__); + rt_status = FALSE; + return rt_status; +} + +bool CPUcheck_firmware_ready(struct net_device *dev) +{ + + bool rt_status = true; + int check_time = 200000; + u32 CPU_status = 0; + + /* Check Firmware Ready */ + do { + CPU_status = read_nic_dword(dev, CPU_GEN); + + if(CPU_status&CPU_GEN_FIRM_RDY) + break; + + }while(check_time--); + + if(!(CPU_status&CPU_GEN_FIRM_RDY)) + goto CPUCheckFirmwareReady_Fail; + else + RT_TRACE(COMP_FIRMWARE, "Download Firmware: Firmware ready!\n"); + + return rt_status; + +CPUCheckFirmwareReady_Fail: + RT_TRACE(COMP_ERR, "ERR in %s()\n", __FUNCTION__); + rt_status = false; + return rt_status; + +} + +bool init_firmware(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + bool rt_status = TRUE; + + u8 *firmware_img_buf[3] = { &rtl8190_fwboot_array[0], + &rtl8190_fwmain_array[0], + &rtl8190_fwdata_array[0]}; + + u32 firmware_img_len[3] = { sizeof(rtl8190_fwboot_array), + sizeof(rtl8190_fwmain_array), + sizeof(rtl8190_fwdata_array)}; + u32 file_length = 0; + u8 *mapped_file = NULL; + u32 init_step = 0; + opt_rst_type_e rst_opt = OPT_SYSTEM_RESET; + firmware_init_step_e starting_state = FW_INIT_STEP0_BOOT; + + rt_firmware *pfirmware = priv->pFirmware; + const struct firmware *fw_entry; + const char *fw_name[3] = { "RTL8192U/boot.img", + "RTL8192U/main.img", + "RTL8192U/data.img"}; + int rc; + + RT_TRACE(COMP_FIRMWARE, " PlatformInitFirmware()==>\n"); + + if (pfirmware->firmware_status == FW_STATUS_0_INIT ) { + /* it is called by reset */ + rst_opt = OPT_SYSTEM_RESET; + starting_state = FW_INIT_STEP0_BOOT; + // TODO: system reset + + }else if(pfirmware->firmware_status == FW_STATUS_5_READY) { + /* it is called by Initialize */ + rst_opt = OPT_FIRMWARE_RESET; + starting_state = FW_INIT_STEP2_DATA; + }else { + RT_TRACE(COMP_FIRMWARE, "PlatformInitFirmware: undefined firmware state\n"); + } + + /* + * Download boot, main, and data image for System reset. + * Download data image for firmware reseta + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + priv->firmware_source = FW_SOURCE_HEADER_FILE; +#else + priv->firmware_source = FW_SOURCE_IMG_FILE; +#endif + for(init_step = starting_state; init_step <= FW_INIT_STEP2_DATA; init_step++) { + /* + * Open Image file, and map file to contineous memory if open file success. + * or read image file from array. Default load from IMG file + */ + if(rst_opt == OPT_SYSTEM_RESET) { + switch(priv->firmware_source) { + case FW_SOURCE_IMG_FILE: + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + rc = request_firmware(&fw_entry, fw_name[init_step],&priv->udev->dev); + if(rc < 0 ) { + RT_TRACE(COMP_ERR, "request firmware fail!\n"); + goto download_firmware_fail; + } + + if(fw_entry->size > sizeof(pfirmware->firmware_buf)) { + RT_TRACE(COMP_ERR, "img file size exceed the container buffer fail!\n"); + goto download_firmware_fail; + } + + if(init_step != FW_INIT_STEP1_MAIN) { + memcpy(pfirmware->firmware_buf,fw_entry->data,fw_entry->size); + mapped_file = pfirmware->firmware_buf; + file_length = fw_entry->size; + } else { + #ifdef RTL8190P + memcpy(pfirmware->firmware_buf,fw_entry->data,fw_entry->size); + mapped_file = pfirmware->firmware_buf; + file_length = fw_entry->size; + #else + memset(pfirmware->firmware_buf,0,128); + memcpy(&pfirmware->firmware_buf[128],fw_entry->data,fw_entry->size); + mapped_file = pfirmware->firmware_buf; + file_length = fw_entry->size + 128; + #endif + } + pfirmware->firmware_buf_size = file_length; + #endif + break; + + case FW_SOURCE_HEADER_FILE: + mapped_file = firmware_img_buf[init_step]; + file_length = firmware_img_len[init_step]; + if(init_step == FW_INIT_STEP2_DATA) { + memcpy(pfirmware->firmware_buf, mapped_file, file_length); + pfirmware->firmware_buf_size = file_length; + } + break; + + default: + break; + } + + + }else if(rst_opt == OPT_FIRMWARE_RESET ) { + /* we only need to download data.img here */ + mapped_file = pfirmware->firmware_buf; + file_length = pfirmware->firmware_buf_size; + } + + /* Download image file */ + /* The firmware download process is just as following, + * 1. that is each packet will be segmented and inserted to the wait queue. + * 2. each packet segment will be put in the skb_buff packet. + * 3. each skb_buff packet data content will already include the firmware info + * and Tx descriptor info + * */ + rt_status = fw_download_code(dev,mapped_file,file_length); + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + if(rst_opt == OPT_SYSTEM_RESET) { + release_firmware(fw_entry); + } + #endif + + if(rt_status != TRUE) { + goto download_firmware_fail; + } + + switch(init_step) { + case FW_INIT_STEP0_BOOT: + /* Download boot + * initialize command descriptor. + * will set polling bit when firmware code is also configured + */ + pfirmware->firmware_status = FW_STATUS_1_MOVE_BOOT_CODE; +#ifdef RTL8190P + // To initialize IMEM, CPU move code from 0x80000080, hence, we send 0x80 byte packet + rt_status = fwSendNullPacket(dev, RTL8190_CPU_START_OFFSET); + if(rt_status != true) + { + RT_TRACE(COMP_INIT, "fwSendNullPacket() fail ! \n"); + goto download_firmware_fail; + } +#endif + //mdelay(1000); + /* + * To initialize IMEM, CPU move code from 0x80000080, + * hence, we send 0x80 byte packet + */ + break; + + case FW_INIT_STEP1_MAIN: + /* Download firmware code. Wait until Boot Ready and Turn on CPU */ + pfirmware->firmware_status = FW_STATUS_2_MOVE_MAIN_CODE; + + /* Check Put Code OK and Turn On CPU */ + rt_status = CPUcheck_maincodeok_turnonCPU(dev); + if(rt_status != TRUE) { + RT_TRACE(COMP_ERR, "CPUcheck_maincodeok_turnonCPU fail!\n"); + goto download_firmware_fail; + } + + pfirmware->firmware_status = FW_STATUS_3_TURNON_CPU; + break; + + case FW_INIT_STEP2_DATA: + /* download initial data code */ + pfirmware->firmware_status = FW_STATUS_4_MOVE_DATA_CODE; + mdelay(1); + + rt_status = CPUcheck_firmware_ready(dev); + if(rt_status != TRUE) { + RT_TRACE(COMP_ERR, "CPUcheck_firmware_ready fail(%d)!\n",rt_status); + goto download_firmware_fail; + } + + /* wait until data code is initialized ready.*/ + pfirmware->firmware_status = FW_STATUS_5_READY; + break; + } + } + + RT_TRACE(COMP_FIRMWARE, "Firmware Download Success\n"); + //assert(pfirmware->firmware_status == FW_STATUS_5_READY, ("Firmware Download Fail\n")); + + return rt_status; + +download_firmware_fail: + RT_TRACE(COMP_ERR, "ERR in %s()\n", __FUNCTION__); + rt_status = FALSE; + return rt_status; + +} + +#if 0 +/* + * Procedure: (1) Transform firmware code from little endian to big endian if required. + * (2) Number of bytes in Firmware downloading should be multiple + * of 4 bytes. If length is not multiple of 4 bytes, appending of zeros is required + * + */ +void CmdAppendZeroAndEndianTransform( + u1Byte *pDst, + u1Byte *pSrc, + u2Byte *pLength) +{ + + u2Byte ulAppendBytes = 0, i; + u2Byte ulLength = *pLength; + +//test only + //memset(pDst, 0xcc, 12); + + + /* Transform from little endian to big endian */ +//#if DEV_BUS_TYPE==PCI_INTERFACE +#if 0 + for( i=0 ; i<(*pLength) ; i+=4) + { + if((i+3) < (*pLength)) pDst[i+0] = pSrc[i+3]; + if((i+2) < (*pLength)) pDst[i+1] = pSrc[i+2]; + if((i+1) < (*pLength)) pDst[i+2] = pSrc[i+1]; + if((i+0) < (*pLength)) pDst[i+3] = pSrc[i+0]; + } +#else + pDst += USB_HWDESC_HEADER_LEN; + ulLength -= USB_HWDESC_HEADER_LEN; + + for( i=0 ; i0) + { + ulAppendBytes = 4-((*pLength) % 4); + + for(i=0 ; iFragLength[0] = (u2Byte)pTcb->BufferList[0].Length; + + QueueID=pTcb->SpecifiedQueueID; +#if DEV_BUS_TYPE!=USB_INTERFACE + firstDesc=curDesc=Adapter->NextTxDescToFill[QueueID]; +#endif + +#if DEV_BUS_TYPE!=USB_INTERFACE + if(VacancyTxDescNum(Adapter, QueueID) > pTcb->BufferCount) +#else + if(PlatformIsTxQueueAvailable(Adapter, QueueID, pTcb->BufferCount) && + RTIsListEmpty(&Adapter->TcbWaitQueue[QueueID])) +#endif + { + pTcb->nDescUsed=0; + + for(i=0 ; iBufferCount ; i++) + { + Adapter->HalFunc.TxFillCmdDescHandler( + Adapter, + pTcb, + QueueID, //QueueIndex + curDesc, //index + FragBufferIndex==0, //bFirstSeg + FragBufferIndex==(pTcb->FragBufCount[FragIndex]-1), //bLastSeg + pTcb->BufferList[i].VirtualAddress, //VirtualAddress + pTcb->BufferList[i].PhysicalAddressLow, //PhyAddressLow + pTcb->BufferList[i].Length, //BufferLen + i!=0, //bSetOwnBit + (i==(pTcb->BufferCount-1)) && bLastInitPacket, //bLastInitPacket + PacketType, //DescPacketType + pTcb->FragLength[FragIndex] //PktLen + ); + + if(FragBufferIndex==(pTcb->FragBufCount[FragIndex]-1)) + { // Last segment of the fragment. + pTcb->nFragSent++; + } + + FragBufferIndex++; + if(FragBufferIndex==pTcb->FragBufCount[FragIndex]) + { + FragIndex++; + FragBufferIndex=0; + } + +#if DEV_BUS_TYPE!=USB_INTERFACE + curDesc=(curDesc+1)%Adapter->NumTxDesc[QueueID]; +#endif + pTcb->nDescUsed++; + } + +#if DEV_BUS_TYPE!=USB_INTERFACE + RTInsertTailList(&Adapter->TcbBusyQueue[QueueID], &pTcb->List); + IncrementTxDescToFill(Adapter, QueueID, pTcb->nDescUsed); + Adapter->HalFunc.SetTxDescOWNHandler(Adapter, QueueID, firstDesc); + // TODO: should call poll use QueueID + Adapter->HalFunc.TxPollingHandler(Adapter, TXCMD_QUEUE); +#endif + } + else +#if DEV_BUS_TYPE!=USB_INTERFACE + goto CmdSendPacket_Fail; +#else + { + pTcb->bLastInitPacket = bLastInitPacket; + RTInsertTailList(&Adapter->TcbWaitQueue[pTcb->SpecifiedQueueID], &pTcb->List); + } +#endif + + return rtStatus; + +#if DEV_BUS_TYPE!=USB_INTERFACE +CmdSendPacket_Fail: + rtStatus = RT_STATUS_FAILURE; + return rtStatus; +#endif + +} +#endif + + + + +#if 0 +RT_STATUS +FWSendNullPacket( + IN PADAPTER Adapter, + IN u4Byte Length +) +{ + RT_STATUS rtStatus = RT_STATUS_SUCCESS; + + + PRT_TCB pTcb; + PRT_TX_LOCAL_BUFFER pBuf; + BOOLEAN bLastInitPacket = FALSE; + + PlatformAcquireSpinLock(Adapter, RT_TX_SPINLOCK); + +#if DEV_BUS_TYPE==USB_INTERFACE + Length += USB_HWDESC_HEADER_LEN; +#endif + + //Get TCB and local buffer from common pool. (It is shared by CmdQ, MgntQ, and USB coalesce DataQ) + if(MgntGetBuffer(Adapter, &pTcb, &pBuf)) + { + PlatformZeroMemory(pBuf->Buffer.VirtualAddress, Length); + rtStatus = CmdSendPacket(Adapter, pTcb, pBuf, Length, DESC_PACKET_TYPE_INIT, bLastInitPacket); //0 : always set LastInitPacket to zero +//#if HAL_CODE_BASE != RTL8190HW +// // TODO: for test only +// ReturnTCB(Adapter, pTcb, RT_STATUS_SUCCESS); +//#endif + if(rtStatus == RT_STATUS_FAILURE) + goto CmdSendNullPacket_Fail; + }else + goto CmdSendNullPacket_Fail; + + PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK); + return rtStatus; + + +CmdSendNullPacket_Fail: + PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK); + rtStatus = RT_STATUS_FAILURE; + RT_ASSERT(rtStatus == RT_STATUS_SUCCESS, ("CmdSendDownloadCode fail !!\n")); + return rtStatus; +} +#endif + + diff --git a/drivers/staging/rtl8192u/r819xU_firmware.h b/drivers/staging/rtl8192u/r819xU_firmware.h new file mode 100644 index 000000000000..5e561081cf36 --- /dev/null +++ b/drivers/staging/rtl8192u/r819xU_firmware.h @@ -0,0 +1,68 @@ +#ifndef __INC_FIRMWARE_H +#define __INC_FIRMWARE_H + +#define RTL8190_CPU_START_OFFSET 0x80 +/* TODO: this definition is TBD */ +//#define USB_HWDESC_HEADER_LEN 0 + +/* It should be double word alignment */ +//#if DEV_BUS_TYPE==PCI_INTERFACE +//#define GET_COMMAND_PACKET_FRAG_THRESHOLD(v) 4*(v/4) - 8 +//#else +#define GET_COMMAND_PACKET_FRAG_THRESHOLD(v) (4*(v/4) - 8 - USB_HWDESC_HEADER_LEN) +//#endif + +typedef enum _firmware_init_step{ + FW_INIT_STEP0_BOOT = 0, + FW_INIT_STEP1_MAIN = 1, + FW_INIT_STEP2_DATA = 2, +}firmware_init_step_e; + +typedef enum _opt_rst_type{ + OPT_SYSTEM_RESET = 0, + OPT_FIRMWARE_RESET = 1, +}opt_rst_type_e; + +#if 0 +/* CPU related */ +RT_STATUS +CPUCheckMainCodeOKAndTurnOnCPU( + IN PADAPTER Adapter + ); + +RT_STATUS +CPUCheckFirmwareReady( + IN PADAPTER Adapter + ); + +/* Firmware related */ +VOID +FWInitializeParameters( + IN PADAPTER Adapter + ); + +RT_STATUS +FWSendDownloadCode( + IN PADAPTER Adapter, + IN pu1Byte CodeVirtualAddrress, + IN u4Byte BufferLen + ); + +RT_STATUS +FWSendNullPacket( + IN PADAPTER Adapter, + IN u4Byte Length + ); + +RT_STATUS +CmdSendPacket( + PADAPTER Adapter, + PRT_TCB pTcb, + PRT_TX_LOCAL_BUFFER pBuf, + u4Byte BufferLen, + u4Byte PacketType, + BOOLEAN bLastInitPacket + ); +#endif +#endif + diff --git a/drivers/staging/rtl8192u/r819xU_firmware_img.c b/drivers/staging/rtl8192u/r819xU_firmware_img.c new file mode 100644 index 000000000000..29b656d7d82b --- /dev/null +++ b/drivers/staging/rtl8192u/r819xU_firmware_img.c @@ -0,0 +1,3447 @@ +/*Created on 2008/ 7/16, 5:31*/ +#include + +u8 rtl8190_fwboot_array[] = { +0x10,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x3c,0x08,0xbf,0xc0,0x25,0x08,0x00,0x08, +0x3c,0x09,0xb0,0x03,0xad,0x28,0x00,0x20,0x40,0x80,0x68,0x00,0x00,0x00,0x00,0x00, +0x3c,0x0a,0xd0,0x00,0x40,0x8a,0x60,0x00,0x00,0x00,0x00,0x00,0x3c,0x08,0x80,0x01, +0x25,0x08,0xb0,0x50,0x24,0x09,0x00,0x01,0x3c,0x01,0x7f,0xff,0x34,0x21,0xff,0xff, +0x01,0x01,0x50,0x24,0x00,0x09,0x48,0x40,0x35,0x29,0x00,0x01,0x01,0x2a,0x10,0x2b, +0x14,0x40,0xff,0xfc,0x00,0x00,0x00,0x00,0x3c,0x0a,0x00,0x00,0x25,0x4a,0x00,0x00, +0x4c,0x8a,0x00,0x00,0x4c,0x89,0x08,0x00,0x00,0x00,0x00,0x00,0x3c,0x08,0x80,0x01, +0x25,0x08,0xb0,0x50,0x3c,0x01,0x80,0x00,0x01,0x21,0x48,0x25,0x3c,0x0a,0xbf,0xc0, +0x25,0x4a,0x00,0x7c,0x3c,0x0b,0xb0,0x03,0xad,0x6a,0x00,0x20,0xad,0x00,0x00,0x00, +0x21,0x08,0x00,0x04,0x01,0x09,0x10,0x2b,0x14,0x40,0xff,0xf8,0x00,0x00,0x00,0x00, +0x3c,0x08,0x80,0x01,0x25,0x08,0x7f,0xff,0x24,0x09,0x00,0x01,0x3c,0x01,0x7f,0xff, +0x34,0x21,0xff,0xff,0x01,0x01,0x50,0x24,0x00,0x09,0x48,0x40,0x35,0x29,0x00,0x01, +0x01,0x2a,0x10,0x2b,0x14,0x40,0xff,0xfc,0x00,0x00,0x00,0x00,0x3c,0x0a,0x80,0x01, +0x25,0x4a,0x00,0x00,0x3c,0x01,0x7f,0xff,0x34,0x21,0xff,0xff,0x01,0x41,0x50,0x24, +0x3c,0x09,0x00,0x01,0x35,0x29,0x7f,0xff,0x4c,0x8a,0x20,0x00,0x4c,0x89,0x28,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x08,0x04,0x10, +0x00,0x00,0x00,0x00,0x40,0x88,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x3c,0x08,0xbf,0xc0,0x00,0x00,0x00,0x00,0x8d,0x09,0x00,0x00,0x00,0x00,0x00,0x00, +0x3c,0x0a,0xbf,0xc0,0x25,0x4a,0x01,0x20,0x3c,0x0b,0xb0,0x03,0xad,0x6a,0x00,0x20, +0x3c,0x08,0xb0,0x03,0x8d,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x35,0x29,0x00,0x10, +0xad,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x08,0x80,0x00,0x25,0x08,0x4b,0x84, +0x01,0x00,0x00,0x08,0x00,0x00,0x00,0x00,}; + +u8 rtl8190_fwmain_array[] = { +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x40,0x04,0x68,0x00,0x40,0x05,0x70,0x00,0x40,0x06,0x40,0x00,0x0c,0x00,0x12,0x94, +0x00,0x00,0x00,0x00,0x40,0x1a,0x68,0x00,0x33,0x5b,0x00,0x3c,0x17,0x60,0x00,0x09, +0x00,0x00,0x00,0x00,0x40,0x1b,0x60,0x00,0x00,0x00,0x00,0x00,0x03,0x5b,0xd0,0x24, +0x40,0x1a,0x70,0x00,0x03,0x40,0x00,0x08,0x42,0x00,0x00,0x10,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x3c,0x02,0xff,0xff,0x34,0x42,0xff,0xff,0x8c,0x43,0x00,0x00, +0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00,0x34,0x63,0x00,0x20,0x24,0x42,0x00,0xd0, +0xac,0x62,0x00,0x00,0x00,0x00,0x20,0x21,0x27,0x85,0x8b,0x60,0x00,0x85,0x18,0x21, +0x24,0x84,0x00,0x01,0x28,0x82,0x00,0x0a,0x14,0x40,0xff,0xfc,0xa0,0x60,0x00,0x00, +0x27,0x82,0x8b,0x6a,0x24,0x04,0x00,0x06,0x24,0x84,0xff,0xff,0xa4,0x40,0x00,0x00, +0x04,0x81,0xff,0xfd,0x24,0x42,0x00,0x02,0x24,0x02,0x00,0x03,0xa3,0x82,0x8b,0x60, +0x24,0x02,0x09,0xc4,0x24,0x03,0x01,0x00,0xa7,0x82,0x8b,0x76,0x24,0x02,0x04,0x00, +0xaf,0x83,0x8b,0x78,0xaf,0x82,0x8b,0x7c,0x24,0x03,0x00,0x0a,0x24,0x02,0x00,0x04, +0x24,0x05,0x00,0x02,0x24,0x04,0x00,0x01,0xa3,0x83,0x8b,0x62,0xa3,0x82,0x8b,0x68, +0x24,0x03,0x00,0x01,0x24,0x02,0x02,0x00,0xa3,0x84,0x8b,0x66,0xa3,0x85,0x8b,0x69, +0xa7,0x82,0x8b,0x6a,0xa7,0x83,0x8b,0x6c,0xa3,0x84,0x8b,0x61,0xa3,0x80,0x8b,0x63, +0xa3,0x80,0x8b,0x64,0xa3,0x80,0x8b,0x65,0xa3,0x85,0x8b,0x67,0x03,0xe0,0x00,0x08, +0x00,0x00,0x00,0x00,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00,0x24,0x42,0x01,0x84, +0x34,0x63,0x00,0x20,0xac,0x62,0x00,0x00,0x27,0x84,0x8b,0x88,0x00,0x00,0x10,0x21, +0x24,0x42,0x00,0x01,0x00,0x02,0x16,0x00,0x00,0x02,0x16,0x03,0x28,0x43,0x00,0x03, +0xac,0x80,0xff,0xfc,0xa0,0x80,0x00,0x00,0x14,0x60,0xff,0xf9,0x24,0x84,0x00,0x0c, +0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00, +0x34,0x63,0x00,0x20,0x24,0x42,0x01,0xc8,0x3c,0x08,0xb0,0x03,0xac,0x62,0x00,0x00, +0x35,0x08,0x00,0x70,0x8d,0x02,0x00,0x00,0x00,0xa0,0x48,0x21,0x00,0x04,0x26,0x00, +0x00,0x02,0x2a,0x43,0x00,0x06,0x36,0x00,0x00,0x07,0x3e,0x00,0x00,0x02,0x12,0x03, +0x29,0x23,0x00,0x03,0x00,0x04,0x56,0x03,0x00,0x06,0x36,0x03,0x00,0x07,0x3e,0x03, +0x30,0x48,0x00,0x01,0x10,0x60,0x00,0x11,0x30,0xa5,0x00,0x07,0x24,0x02,0x00,0x02, +0x00,0x49,0x10,0x23,0x00,0x45,0x10,0x07,0x30,0x42,0x00,0x01,0x10,0x40,0x00,0x66, +0x00,0x00,0x00,0x00,0x8f,0xa2,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x02,0x21,0x43, +0x11,0x00,0x00,0x10,0x00,0x07,0x20,0x0b,0x15,0x20,0x00,0x06,0x24,0x02,0x00,0x01, +0x3c,0x02,0xb0,0x05,0x34,0x42,0x01,0x20,0xa4,0x44,0x00,0x00,0x03,0xe0,0x00,0x08, +0x00,0x00,0x00,0x00,0x11,0x22,0x00,0x04,0x00,0x00,0x00,0x00,0x3c,0x02,0xb0,0x05, +0x08,0x00,0x00,0x96,0x34,0x42,0x01,0x24,0x3c,0x02,0xb0,0x05,0x08,0x00,0x00,0x96, +0x34,0x42,0x01,0x22,0x15,0x20,0x00,0x54,0x24,0x02,0x00,0x01,0x3c,0x02,0xb0,0x03, +0x34,0x42,0x00,0x74,0x90,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0xaf,0x83,0x8b,0x84, +0x3c,0x02,0xb0,0x03,0x34,0x42,0x00,0x70,0x90,0x43,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x6b,0x00,0x08,0x11,0x60,0x00,0x18,0x00,0x09,0x28,0x40,0x00,0x00,0x40,0x21, +0x27,0x85,0x8b,0x80,0x8c,0xa3,0x00,0x00,0x8c,0xa2,0x00,0x04,0x00,0x00,0x00,0x00, +0x00,0x62,0x38,0x23,0x00,0x43,0x10,0x2a,0x10,0x40,0x00,0x3d,0x00,0x00,0x00,0x00, +0xac,0xa7,0x00,0x00,0x25,0x02,0x00,0x01,0x00,0x02,0x16,0x00,0x00,0x02,0x46,0x03, +0x29,0x03,0x00,0x03,0x14,0x60,0xff,0xf3,0x24,0xa5,0x00,0x0c,0x3c,0x03,0xb0,0x03, +0x34,0x63,0x00,0x70,0x90,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4b,0x10,0x23, +0xa0,0x62,0x00,0x00,0x00,0x09,0x28,0x40,0x00,0xa9,0x10,0x21,0x00,0x02,0x10,0x80, +0x27,0x83,0x8b,0x88,0x00,0x0a,0x20,0x0b,0x00,0x43,0x18,0x21,0x10,0xc0,0x00,0x05, +0x00,0x00,0x38,0x21,0x80,0x62,0x00,0x01,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x05, +0x00,0x00,0x00,0x00,0x80,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x03, +0x00,0xa9,0x10,0x21,0x24,0x07,0x00,0x01,0x00,0xa9,0x10,0x21,0x00,0x02,0x30,0x80, +0x27,0x82,0x8b,0x88,0xa0,0x67,0x00,0x01,0x00,0xc2,0x38,0x21,0x80,0xe3,0x00,0x01, +0x00,0x00,0x00,0x00,0x10,0x60,0x00,0x07,0x00,0x00,0x00,0x00,0x27,0x83,0x8b,0x80, +0x00,0xc3,0x18,0x21,0x8c,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x10,0x21, +0xac,0x62,0x00,0x00,0x27,0x85,0x8b,0x84,0x27,0x82,0x8b,0x80,0x00,0xc5,0x28,0x21, +0x00,0xc2,0x10,0x21,0x8c,0x43,0x00,0x00,0x8c,0xa4,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x64,0x18,0x2a,0x14,0x60,0x00,0x03,0x24,0x02,0x00,0x01,0x03,0xe0,0x00,0x08, +0xa0,0xe2,0x00,0x00,0xa0,0xe0,0x00,0x00,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00, +0x08,0x00,0x00,0xb9,0xac,0xa0,0x00,0x00,0x11,0x22,0x00,0x08,0x00,0x00,0x00,0x00, +0x3c,0x02,0xb0,0x03,0x34,0x42,0x00,0x7c,0x90,0x43,0x00,0x00,0x00,0x00,0x00,0x00, +0xaf,0x83,0x8b,0x9c,0x08,0x00,0x00,0xa9,0x3c,0x02,0xb0,0x03,0x3c,0x02,0xb0,0x03, +0x34,0x42,0x00,0x78,0x90,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0xaf,0x83,0x8b,0x90, +0x08,0x00,0x00,0xa9,0x3c,0x02,0xb0,0x03,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00, +0x34,0x63,0x00,0x20,0x24,0x42,0x04,0x18,0x3c,0x05,0xb0,0x03,0xac,0x62,0x00,0x00, +0x34,0xa5,0x00,0x70,0x8c,0xa2,0x00,0x00,0x90,0x84,0x00,0x08,0x3c,0x06,0xb0,0x03, +0x00,0x02,0x16,0x00,0x2c,0x83,0x00,0x03,0x34,0xc6,0x00,0x72,0x24,0x07,0x00,0x01, +0x10,0x60,0x00,0x11,0x00,0x02,0x2f,0xc2,0x90,0xc2,0x00,0x00,0x00,0x00,0x18,0x21, +0x00,0x02,0x16,0x00,0x10,0xa7,0x00,0x09,0x00,0x02,0x16,0x03,0x14,0x80,0x00,0x0c, +0x30,0x43,0x00,0x03,0x83,0x82,0x8b,0x88,0x00,0x00,0x00,0x00,0x00,0x02,0x10,0x80, +0x00,0x43,0x10,0x21,0x00,0x02,0x16,0x00,0x00,0x02,0x1e,0x03,0x3c,0x02,0xb0,0x03, +0x34,0x42,0x00,0x72,0xa0,0x43,0x00,0x00,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00, +0x30,0x45,0x00,0x05,0x10,0x87,0x00,0x04,0x30,0x43,0x00,0x06,0x93,0x82,0x8b,0xa0, +0x08,0x00,0x01,0x21,0x00,0x43,0x10,0x21,0x83,0x82,0x8b,0x94,0x00,0x00,0x00,0x00, +0x00,0x02,0x10,0x40,0x08,0x00,0x01,0x21,0x00,0x45,0x10,0x21,0x10,0x80,0x00,0x05, +0x00,0x00,0x18,0x21,0x24,0x63,0x00,0x01,0x00,0x64,0x10,0x2b,0x14,0x40,0xff,0xfd, +0x00,0x00,0x00,0x00,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00,0x3c,0x03,0xb0,0x03, +0x3c,0x02,0x80,0x00,0x24,0x42,0x04,0xec,0x3c,0x04,0xb0,0x02,0x34,0x63,0x00,0x20, +0xac,0x62,0x00,0x00,0x34,0x84,0x00,0x08,0x24,0x02,0x00,0x01,0xaf,0x84,0x8b,0xb0, +0xa3,0x82,0x8b,0xc0,0xa7,0x80,0x8b,0xb4,0xa7,0x80,0x8b,0xb6,0xaf,0x80,0x8b,0xb8, +0xaf,0x80,0x8b,0xbc,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00,0x3c,0x03,0xb0,0x03, +0x3c,0x02,0x80,0x00,0x34,0x63,0x00,0x20,0x24,0x42,0x05,0x2c,0x3c,0x04,0xb0,0x03, +0xac,0x62,0x00,0x00,0x34,0x84,0x00,0xac,0x80,0xa2,0x00,0x15,0x8c,0x83,0x00,0x00, +0x27,0xbd,0xff,0xf0,0x00,0x43,0x10,0x21,0xac,0x82,0x00,0x00,0x03,0xe0,0x00,0x08, +0x27,0xbd,0x00,0x10,0x3c,0x02,0xb0,0x03,0x3c,0x03,0x80,0x00,0x34,0x42,0x00,0x20, +0x24,0x63,0x05,0x64,0x27,0xbd,0xff,0xe0,0xac,0x43,0x00,0x00,0xaf,0xb1,0x00,0x14, +0xaf,0xb0,0x00,0x10,0xaf,0xbf,0x00,0x18,0x8f,0x90,0x8b,0xb0,0x0c,0x00,0x02,0x9a, +0x00,0x80,0x88,0x21,0x14,0x40,0x00,0x2a,0x3c,0x02,0x00,0x80,0x16,0x20,0x00,0x02, +0x34,0x42,0x02,0x01,0x24,0x02,0x02,0x01,0xae,0x02,0x00,0x00,0x97,0x84,0x8b,0xb4, +0x97,0x82,0x8b,0xb6,0x3c,0x03,0xb0,0x02,0x00,0x83,0x20,0x21,0x24,0x42,0x00,0x04, +0xa7,0x82,0x8b,0xb6,0xa4,0x82,0x00,0x00,0x8f,0x84,0x8b,0xb8,0x8f,0x82,0x8b,0xb0, +0x93,0x85,0x8b,0x62,0x24,0x84,0x00,0x01,0x24,0x42,0x00,0x04,0x24,0x03,0x8f,0xff, +0x3c,0x07,0xb0,0x06,0x3c,0x06,0xb0,0x03,0x00,0x43,0x10,0x24,0x00,0x85,0x28,0x2a, +0x34,0xe7,0x80,0x18,0xaf,0x82,0x8b,0xb0,0xaf,0x84,0x8b,0xb8,0x10,0xa0,0x00,0x08, +0x34,0xc6,0x01,0x08,0x8f,0x83,0x8b,0xbc,0x8f,0x84,0x8b,0x7c,0x8c,0xc2,0x00,0x00, +0x00,0x64,0x18,0x21,0x00,0x43,0x10,0x2b,0x14,0x40,0x00,0x09,0x00,0x00,0x00,0x00, +0x8c,0xe2,0x00,0x00,0x3c,0x03,0x0f,0x00,0x3c,0x04,0x04,0x00,0x00,0x43,0x10,0x24, +0x10,0x44,0x00,0x03,0x00,0x00,0x00,0x00,0x0c,0x00,0x04,0x98,0x00,0x00,0x00,0x00, +0x8f,0xbf,0x00,0x18,0x7b,0xb0,0x00,0xbc,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x20, +0x27,0xbd,0xff,0xd8,0x3c,0x02,0xb0,0x03,0x3c,0x03,0x80,0x00,0x24,0x63,0x06,0x50, +0xaf,0xb0,0x00,0x10,0x34,0x42,0x00,0x20,0x8f,0x90,0x8b,0xb0,0xac,0x43,0x00,0x00, +0xaf,0xb3,0x00,0x1c,0xaf,0xb2,0x00,0x18,0xaf,0xb1,0x00,0x14,0xaf,0xbf,0x00,0x20, +0x00,0x80,0x88,0x21,0x00,0xa0,0x90,0x21,0x0c,0x00,0x02,0x9a,0x00,0xc0,0x98,0x21, +0x24,0x07,0x8f,0xff,0x14,0x40,0x00,0x19,0x26,0x03,0x00,0x04,0x24,0x02,0x0e,0x03, +0xae,0x02,0x00,0x00,0x00,0x67,0x80,0x24,0x26,0x02,0x00,0x04,0xae,0x11,0x00,0x00, +0x00,0x47,0x80,0x24,0x97,0x86,0x8b,0xb4,0x26,0x03,0x00,0x04,0xae,0x12,0x00,0x00, +0x00,0x67,0x80,0x24,0xae,0x13,0x00,0x00,0x8f,0x84,0x8b,0xb0,0x3c,0x02,0xb0,0x02, +0x97,0x85,0x8b,0xb6,0x00,0xc2,0x30,0x21,0x8f,0x82,0x8b,0xb8,0x24,0x84,0x00,0x10, +0x24,0xa5,0x00,0x10,0x00,0x87,0x20,0x24,0x24,0x42,0x00,0x01,0xa7,0x85,0x8b,0xb6, +0xaf,0x84,0x8b,0xb0,0xaf,0x82,0x8b,0xb8,0xa4,0xc5,0x00,0x00,0x8f,0xbf,0x00,0x20, +0x7b,0xb2,0x00,0xfc,0x7b,0xb0,0x00,0xbc,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x28, +0x27,0xbd,0xff,0xe8,0xaf,0xbf,0x00,0x10,0x94,0x82,0x00,0x04,0x00,0x00,0x00,0x00, +0x30,0x42,0xe0,0x00,0x14,0x40,0x00,0x14,0x00,0x00,0x00,0x00,0x90,0x82,0x00,0x02, +0x00,0x00,0x00,0x00,0x30,0x42,0x00,0xfc,0x00,0x82,0x28,0x21,0x8c,0xa4,0x00,0x00, +0x3c,0x02,0x00,0x70,0x8c,0xa6,0x00,0x08,0x00,0x82,0x10,0x21,0x2c,0x43,0x00,0x06, +0x10,0x60,0x00,0x09,0x3c,0x03,0x80,0x01,0x00,0x02,0x10,0x80,0x24,0x63,0x01,0xe8, +0x00,0x43,0x10,0x21,0x8c,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x08, +0x00,0x00,0x00,0x00,0xaf,0x86,0x80,0x14,0x8f,0xbf,0x00,0x10,0x00,0x00,0x00,0x00, +0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x18,0x8c,0xa4,0x00,0x00,0x0c,0x00,0x17,0xb3, +0x00,0x00,0x00,0x00,0x08,0x00,0x01,0xde,0x00,0x00,0x00,0x00,0x0c,0x00,0x24,0xaa, +0x00,0xc0,0x20,0x21,0x08,0x00,0x01,0xde,0x00,0x00,0x00,0x00,0x3c,0x02,0xb0,0x03, +0x34,0x42,0x01,0x08,0x8c,0x44,0x00,0x00,0x8f,0x82,0x80,0x18,0x3c,0x03,0x00,0x0f, +0x34,0x63,0x42,0x40,0x00,0x43,0x10,0x21,0x00,0x82,0x20,0x2b,0x10,0x80,0x00,0x09, +0x24,0x03,0x00,0x05,0x8f,0x82,0x83,0x30,0x00,0x00,0x00,0x00,0x24,0x42,0x00,0x01, +0xaf,0x82,0x83,0x30,0x10,0x43,0x00,0x03,0x00,0x00,0x00,0x00,0x03,0xe0,0x00,0x08, +0x00,0x00,0x00,0x00,0x3c,0x03,0xb0,0x03,0x8c,0x63,0x01,0x08,0x24,0x02,0x00,0x01, +0xa3,0x82,0x80,0x11,0xaf,0x80,0x83,0x30,0xaf,0x83,0x80,0x18,0x08,0x00,0x01,0xfb, +0x00,0x00,0x00,0x00,0x30,0x84,0x00,0xff,0x14,0x80,0x00,0x2f,0x00,0x00,0x00,0x00, +0x8f,0x82,0x80,0x14,0xa3,0x85,0x83,0x63,0x10,0x40,0x00,0x2b,0x2c,0xa2,0x00,0x04, +0x14,0x40,0x00,0x06,0x00,0x05,0x10,0x40,0x24,0xa2,0xff,0xfc,0x2c,0x42,0x00,0x08, +0x10,0x40,0x00,0x09,0x24,0xa2,0xff,0xf0,0x00,0x05,0x10,0x40,0x27,0x84,0x83,0x6c, +0x00,0x44,0x10,0x21,0x94,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x63,0x00,0x01, +0x03,0xe0,0x00,0x08,0xa4,0x43,0x00,0x00,0x2c,0x42,0x00,0x10,0x14,0x40,0x00,0x0a, +0x00,0x05,0x10,0x40,0x24,0xa2,0xff,0xe0,0x2c,0x42,0x00,0x10,0x14,0x40,0x00,0x06, +0x00,0x05,0x10,0x40,0x24,0xa2,0xff,0xd0,0x2c,0x42,0x00,0x10,0x10,0x40,0x00,0x09, +0x24,0xa2,0xff,0xc0,0x00,0x05,0x10,0x40,0x27,0x84,0x83,0x6c,0x00,0x44,0x10,0x21, +0x94,0x43,0xff,0xf8,0x00,0x00,0x00,0x00,0x24,0x63,0x00,0x01,0x03,0xe0,0x00,0x08, +0xa4,0x43,0xff,0xf8,0x2c,0x42,0x00,0x10,0x10,0x40,0x00,0x07,0x00,0x05,0x10,0x40, +0x27,0x84,0x83,0x6c,0x00,0x44,0x10,0x21,0x94,0x43,0xff,0xf8,0x00,0x00,0x00,0x00, +0x24,0x63,0x00,0x01,0xa4,0x43,0xff,0xf8,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00, +0x8f,0x86,0x8b,0xb0,0x8f,0x82,0x80,0x14,0x27,0xbd,0xff,0xe8,0xaf,0xbf,0x00,0x10, +0x10,0x40,0x00,0x2a,0x00,0xc0,0x38,0x21,0x24,0x02,0x00,0x07,0x24,0x03,0xff,0x9c, +0xa3,0x82,0x83,0x6b,0xa3,0x83,0x83,0x6a,0x27,0x8a,0x83,0x68,0x00,0x00,0x20,0x21, +0x24,0x09,0x8f,0xff,0x00,0x04,0x10,0x80,0x00,0x4a,0x28,0x21,0x8c,0xa2,0x00,0x00, +0x24,0xe3,0x00,0x04,0x24,0x88,0x00,0x01,0xac,0xe2,0x00,0x00,0x10,0x80,0x00,0x02, +0x00,0x69,0x38,0x24,0xac,0xa0,0x00,0x00,0x31,0x04,0x00,0xff,0x2c,0x82,0x00,0x27, +0x14,0x40,0xff,0xf5,0x00,0x04,0x10,0x80,0x97,0x83,0x8b,0xb6,0x97,0x85,0x8b,0xb4, +0x3c,0x02,0xb0,0x02,0x24,0x63,0x00,0x9c,0x00,0xa2,0x28,0x21,0x3c,0x04,0xb0,0x06, +0xa7,0x83,0x8b,0xb6,0x34,0x84,0x80,0x18,0xa4,0xa3,0x00,0x00,0x8c,0x85,0x00,0x00, +0x24,0x02,0x8f,0xff,0x24,0xc6,0x00,0x9c,0x3c,0x03,0x0f,0x00,0x00,0xc2,0x30,0x24, +0x00,0xa3,0x28,0x24,0x3c,0x02,0x04,0x00,0xaf,0x86,0x8b,0xb0,0x10,0xa2,0x00,0x03, +0x00,0x00,0x00,0x00,0x0c,0x00,0x04,0x98,0x00,0x00,0x00,0x00,0x8f,0xbf,0x00,0x10, +0x00,0x00,0x00,0x00,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x18,0x8f,0x86,0x8b,0xb0, +0x27,0xbd,0xff,0xc8,0x24,0x02,0x00,0x08,0x24,0x03,0x00,0x20,0xaf,0xbf,0x00,0x30, +0xa3,0xa2,0x00,0x13,0xa3,0xa3,0x00,0x12,0xa7,0xa4,0x00,0x10,0x00,0xc0,0x28,0x21, +0x27,0xa9,0x00,0x10,0x00,0x00,0x38,0x21,0x24,0x08,0x8f,0xff,0x00,0x07,0x10,0x80, +0x00,0x49,0x10,0x21,0x8c,0x44,0x00,0x00,0x24,0xe3,0x00,0x01,0x30,0x67,0x00,0xff, +0x24,0xa2,0x00,0x04,0x2c,0xe3,0x00,0x08,0xac,0xa4,0x00,0x00,0x14,0x60,0xff,0xf7, +0x00,0x48,0x28,0x24,0x97,0x83,0x8b,0xb6,0x97,0x85,0x8b,0xb4,0x3c,0x02,0xb0,0x02, +0x24,0x63,0x00,0x20,0x00,0xa2,0x28,0x21,0x3c,0x04,0xb0,0x06,0xa7,0x83,0x8b,0xb6, +0x34,0x84,0x80,0x18,0xa4,0xa3,0x00,0x00,0x8c,0x85,0x00,0x00,0x24,0x02,0x8f,0xff, +0x24,0xc6,0x00,0x20,0x3c,0x03,0x0f,0x00,0x00,0xc2,0x30,0x24,0x00,0xa3,0x28,0x24, +0x3c,0x02,0x04,0x00,0xaf,0x86,0x8b,0xb0,0x10,0xa2,0x00,0x03,0x00,0x00,0x00,0x00, +0x0c,0x00,0x04,0x98,0x00,0x00,0x00,0x00,0x8f,0xbf,0x00,0x30,0x00,0x00,0x00,0x00, +0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x38,0x93,0x82,0x8b,0xc0,0x00,0x00,0x00,0x00, +0x10,0x40,0x00,0x11,0x24,0x06,0x00,0x01,0x8f,0x82,0x8b,0xb8,0x3c,0x05,0xb0,0x06, +0x3c,0x04,0xb0,0x03,0x34,0xa5,0x80,0x18,0x34,0x84,0x01,0x08,0x14,0x40,0x00,0x09, +0x00,0x00,0x30,0x21,0x97,0x82,0x8b,0xb4,0x8c,0x84,0x00,0x00,0x3c,0x03,0xb0,0x02, +0x00,0x43,0x10,0x21,0xaf,0x84,0x8b,0xbc,0xa7,0x80,0x8b,0xb6,0xac,0x40,0x00,0x00, +0xac,0x40,0x00,0x04,0x8c,0xa2,0x00,0x00,0x03,0xe0,0x00,0x08,0x00,0xc0,0x10,0x21, +0x8f,0x86,0x8b,0xb0,0x8f,0x82,0x8b,0xb8,0x27,0xbd,0xff,0xe8,0xaf,0xbf,0x00,0x10, +0x00,0xc0,0x40,0x21,0x14,0x40,0x00,0x0a,0x00,0x40,0x50,0x21,0x00,0x00,0x38,0x21, +0x27,0x89,0x83,0x38,0x24,0xe2,0x00,0x01,0x00,0x07,0x18,0x80,0x30,0x47,0x00,0xff, +0x00,0x69,0x18,0x21,0x2c,0xe2,0x00,0x0a,0x14,0x40,0xff,0xfa,0xac,0x60,0x00,0x00, +0x3c,0x02,0x00,0x80,0x10,0x82,0x00,0x6f,0x00,0x00,0x00,0x00,0x97,0x82,0x83,0x3e, +0x00,0x00,0x00,0x00,0x24,0x42,0x00,0x01,0xa7,0x82,0x83,0x3e,0x90,0xa3,0x00,0x15, +0x97,0x82,0x83,0x40,0x00,0x03,0x1e,0x00,0x00,0x03,0x1e,0x03,0x00,0x43,0x10,0x21, +0xa7,0x82,0x83,0x40,0x8c,0xa4,0x00,0x20,0x3c,0x02,0x00,0x60,0x3c,0x03,0x00,0x20, +0x00,0x82,0x20,0x24,0x10,0x83,0x00,0x54,0x00,0x00,0x00,0x00,0x14,0x80,0x00,0x47, +0x00,0x00,0x00,0x00,0x97,0x82,0x83,0x44,0x00,0x00,0x00,0x00,0x24,0x42,0x00,0x01, +0xa7,0x82,0x83,0x44,0x84,0xa3,0x00,0x06,0x8f,0x82,0x83,0x54,0x00,0x00,0x00,0x00, +0x00,0x43,0x10,0x21,0xaf,0x82,0x83,0x54,0x25,0x42,0x00,0x01,0x28,0x43,0x27,0x10, +0xaf,0x82,0x8b,0xb8,0x10,0x60,0x00,0x09,0x24,0x02,0x00,0x04,0x93,0x83,0x80,0x11, +0x24,0x02,0x00,0x01,0x10,0x62,0x00,0x05,0x24,0x02,0x00,0x04,0x8f,0xbf,0x00,0x10, +0x00,0x00,0x00,0x00,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x18,0x24,0x03,0x00,0x28, +0xa3,0x83,0x83,0x3a,0xa3,0x82,0x83,0x3b,0x90,0xa2,0x00,0x18,0x93,0x83,0x83,0x63, +0x00,0x00,0x38,0x21,0x00,0x02,0x16,0x00,0x00,0x02,0x16,0x03,0xa7,0x82,0x83,0x4e, +0xa3,0x83,0x83,0x5c,0x27,0x89,0x83,0x38,0x24,0x05,0x8f,0xff,0x00,0x07,0x10,0x80, +0x00,0x49,0x10,0x21,0x8c,0x44,0x00,0x00,0x24,0xe3,0x00,0x01,0x30,0x67,0x00,0xff, +0x25,0x02,0x00,0x04,0x2c,0xe3,0x00,0x0a,0xad,0x04,0x00,0x00,0x14,0x60,0xff,0xf7, +0x00,0x45,0x40,0x24,0x97,0x83,0x8b,0xb6,0x97,0x85,0x8b,0xb4,0x3c,0x02,0xb0,0x02, +0x24,0x63,0x00,0x28,0x00,0xa2,0x28,0x21,0x3c,0x04,0xb0,0x06,0xa7,0x83,0x8b,0xb6, +0x34,0x84,0x80,0x18,0xa4,0xa3,0x00,0x00,0x8c,0x85,0x00,0x00,0x24,0x02,0x8f,0xff, +0x24,0xc6,0x00,0x28,0x3c,0x03,0x0f,0x00,0x00,0xc2,0x30,0x24,0x00,0xa3,0x28,0x24, +0x3c,0x02,0x04,0x00,0xaf,0x86,0x8b,0xb0,0x10,0xa2,0x00,0x03,0x00,0x00,0x00,0x00, +0x0c,0x00,0x04,0x98,0x00,0x00,0x00,0x00,0x0c,0x00,0x02,0x38,0x00,0x00,0x00,0x00, +0xa3,0x80,0x80,0x11,0x08,0x00,0x02,0xe7,0x00,0x00,0x00,0x00,0x97,0x82,0x83,0x46, +0x00,0x00,0x00,0x00,0x24,0x42,0x00,0x01,0xa7,0x82,0x83,0x46,0x84,0xa3,0x00,0x06, +0x8f,0x82,0x83,0x58,0x00,0x00,0x00,0x00,0x00,0x43,0x10,0x21,0xaf,0x82,0x83,0x58, +0x08,0x00,0x02,0xdf,0x25,0x42,0x00,0x01,0x97,0x82,0x83,0x42,0x00,0x00,0x00,0x00, +0x24,0x42,0x00,0x01,0xa7,0x82,0x83,0x42,0x84,0xa3,0x00,0x06,0x8f,0x82,0x83,0x50, +0x00,0x00,0x00,0x00,0x00,0x43,0x10,0x21,0xaf,0x82,0x83,0x50,0x08,0x00,0x02,0xdf, +0x25,0x42,0x00,0x01,0x97,0x82,0x83,0x3c,0x00,0x00,0x00,0x00,0x24,0x42,0x00,0x01, +0xa7,0x82,0x83,0x3c,0x08,0x00,0x02,0xc7,0x00,0x00,0x00,0x00,0x27,0xbd,0xff,0xd0, +0xaf,0xbf,0x00,0x28,0x8c,0xa3,0x00,0x20,0x8f,0x8a,0x8b,0xb0,0x3c,0x02,0x00,0x10, +0x00,0x62,0x10,0x24,0x00,0xa0,0x38,0x21,0x01,0x40,0x48,0x21,0x10,0x40,0x00,0x3d, +0x00,0x80,0x28,0x21,0x8c,0xe4,0x00,0x1c,0x34,0xa5,0x12,0x06,0xaf,0xa5,0x00,0x10, +0x8c,0x82,0x00,0x08,0x00,0x03,0x1c,0x42,0x30,0x63,0x00,0x30,0x00,0x02,0x13,0x02, +0x30,0x42,0x00,0x40,0x00,0x43,0x10,0x25,0x90,0xe6,0x00,0x10,0x90,0xe4,0x00,0x13, +0x94,0xe8,0x00,0x0c,0x94,0xe3,0x00,0x1a,0x00,0x02,0x16,0x00,0x90,0xe7,0x00,0x12, +0x00,0xa2,0x28,0x25,0x24,0x02,0x12,0x34,0xa7,0xa2,0x00,0x1c,0x24,0x02,0x56,0x78, +0xaf,0xa5,0x00,0x10,0xa3,0xa6,0x00,0x18,0xa3,0xa7,0x00,0x1f,0xa7,0xa3,0x00,0x1a, +0xa3,0xa4,0x00,0x19,0xa7,0xa8,0x00,0x20,0xa7,0xa2,0x00,0x22,0x00,0x00,0x28,0x21, +0x27,0xa7,0x00,0x10,0x24,0x06,0x8f,0xff,0x00,0x05,0x10,0x80,0x00,0x47,0x10,0x21, +0x8c,0x44,0x00,0x00,0x24,0xa3,0x00,0x01,0x30,0x65,0x00,0xff,0x25,0x22,0x00,0x04, +0x2c,0xa3,0x00,0x05,0xad,0x24,0x00,0x00,0x14,0x60,0xff,0xf7,0x00,0x46,0x48,0x24, +0x97,0x83,0x8b,0xb6,0x97,0x85,0x8b,0xb4,0x3c,0x02,0xb0,0x02,0x24,0x63,0x00,0x14, +0x00,0xa2,0x28,0x21,0x3c,0x04,0xb0,0x06,0xa7,0x83,0x8b,0xb6,0x34,0x84,0x80,0x18, +0xa4,0xa3,0x00,0x00,0x8c,0x85,0x00,0x00,0x24,0x02,0x8f,0xff,0x25,0x46,0x00,0x14, +0x3c,0x03,0x0f,0x00,0x00,0xc2,0x50,0x24,0x00,0xa3,0x28,0x24,0x3c,0x02,0x04,0x00, +0xaf,0x8a,0x8b,0xb0,0x10,0xa2,0x00,0x03,0x00,0x00,0x00,0x00,0x0c,0x00,0x04,0x98, +0x00,0x00,0x00,0x00,0x8f,0xbf,0x00,0x28,0x00,0x00,0x00,0x00,0x03,0xe0,0x00,0x08, +0x27,0xbd,0x00,0x30,0x3c,0x05,0xb0,0x03,0x3c,0x02,0x80,0x00,0x27,0xbd,0xff,0xc8, +0x00,0x04,0x22,0x00,0x34,0xa5,0x00,0x20,0x24,0x42,0x0e,0x04,0x3c,0x03,0xb0,0x00, +0xaf,0xb5,0x00,0x24,0xaf,0xb4,0x00,0x20,0xaf,0xb2,0x00,0x18,0xaf,0xb0,0x00,0x10, +0xaf,0xbf,0x00,0x30,0x00,0x83,0x80,0x21,0xaf,0xb7,0x00,0x2c,0xaf,0xb6,0x00,0x28, +0xaf,0xb3,0x00,0x1c,0xaf,0xb1,0x00,0x14,0xac,0xa2,0x00,0x00,0x8e,0x09,0x00,0x00, +0x00,0x00,0x90,0x21,0x26,0x10,0x00,0x08,0x00,0x09,0xa6,0x02,0x12,0x80,0x00,0x13, +0x00,0x00,0xa8,0x21,0x24,0x13,0x00,0x02,0x3c,0x16,0x00,0xff,0x3c,0x17,0xff,0x00, +0x8e,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x12,0x02,0x24,0x42,0x00,0x02, +0x31,0x25,0x00,0xff,0x10,0xb3,0x00,0x76,0x30,0x51,0x00,0xff,0x24,0x02,0x00,0x03, +0x10,0xa2,0x00,0x18,0x00,0x00,0x00,0x00,0x02,0x51,0x10,0x21,0x30,0x52,0xff,0xff, +0x02,0x54,0x18,0x2b,0x14,0x60,0xff,0xf2,0x02,0x11,0x80,0x21,0x12,0xa0,0x00,0x0a, +0x3c,0x02,0xb0,0x06,0x34,0x42,0x80,0x18,0x8c,0x43,0x00,0x00,0x3c,0x04,0x0f,0x00, +0x3c,0x02,0x04,0x00,0x00,0x64,0x18,0x24,0x10,0x62,0x00,0x03,0x00,0x00,0x00,0x00, +0x0c,0x00,0x04,0x98,0x00,0x00,0x00,0x00,0x8f,0xbf,0x00,0x30,0x7b,0xb6,0x01,0x7c, +0x7b,0xb4,0x01,0x3c,0x7b,0xb2,0x00,0xfc,0x7b,0xb0,0x00,0xbc,0x03,0xe0,0x00,0x08, +0x27,0xbd,0x00,0x38,0x8e,0x09,0x00,0x04,0x24,0x15,0x00,0x01,0x8e,0x06,0x00,0x0c, +0x00,0x09,0x11,0x42,0x00,0x09,0x18,0xc2,0x30,0x48,0x00,0x03,0x00,0x09,0x14,0x02, +0x30,0x6c,0x00,0x03,0x00,0x09,0x26,0x02,0x11,0x15,0x00,0x45,0x30,0x43,0x00,0x0f, +0x29,0x02,0x00,0x02,0x14,0x40,0x00,0x26,0x00,0x00,0x00,0x00,0x11,0x13,0x00,0x0f, +0x00,0x00,0x38,0x21,0x00,0x07,0x22,0x02,0x30,0x84,0xff,0x00,0x3c,0x03,0x00,0xff, +0x00,0x07,0x2e,0x02,0x00,0x07,0x12,0x00,0x00,0x43,0x10,0x24,0x00,0xa4,0x28,0x25, +0x00,0xa2,0x28,0x25,0x00,0x07,0x1e,0x00,0x00,0xa3,0x28,0x25,0x0c,0x00,0x01,0x94, +0x01,0x20,0x20,0x21,0x08,0x00,0x03,0xa7,0x02,0x51,0x10,0x21,0x11,0x95,0x00,0x0f, +0x00,0x00,0x00,0x00,0x11,0x88,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x04,0x10,0x80, +0x27,0x83,0x8b,0x60,0x00,0x43,0x10,0x21,0x8c,0x47,0x00,0x18,0x08,0x00,0x03,0xce, +0x00,0x07,0x22,0x02,0x00,0x04,0x10,0x40,0x27,0x83,0x8b,0x68,0x00,0x43,0x10,0x21, +0x94,0x47,0x00,0x02,0x08,0x00,0x03,0xce,0x00,0x07,0x22,0x02,0x27,0x82,0x8b,0x60, +0x00,0x82,0x10,0x21,0x90,0x47,0x00,0x00,0x08,0x00,0x03,0xce,0x00,0x07,0x22,0x02, +0x15,0x00,0xff,0xdc,0x00,0x00,0x38,0x21,0x10,0x75,0x00,0x05,0x00,0x80,0x38,0x21, +0x00,0x65,0x18,0x26,0x24,0x82,0x01,0x00,0x00,0x00,0x38,0x21,0x00,0x43,0x38,0x0a, +0x24,0x02,0x00,0x01,0x11,0x82,0x00,0x0e,0x3c,0x02,0xb0,0x03,0x24,0x02,0x00,0x02, +0x11,0x82,0x00,0x06,0x00,0x00,0x00,0x00,0x3c,0x02,0xb0,0x03,0x00,0xe2,0x10,0x21, +0x8c,0x47,0x00,0x00,0x08,0x00,0x03,0xce,0x00,0x07,0x22,0x02,0x3c,0x02,0xb0,0x03, +0x00,0xe2,0x10,0x21,0x94,0x43,0x00,0x00,0x08,0x00,0x03,0xcd,0x30,0x67,0xff,0xff, +0x00,0xe2,0x10,0x21,0x90,0x43,0x00,0x00,0x08,0x00,0x03,0xcd,0x30,0x67,0x00,0xff, +0x30,0x62,0x00,0x03,0x00,0x02,0x12,0x00,0x11,0x95,0x00,0x07,0x00,0x44,0x38,0x21, +0x11,0x93,0x00,0x03,0x00,0x00,0x00,0x00,0x08,0x00,0x03,0xff,0x3c,0x02,0xb0,0x0a, +0x08,0x00,0x04,0x04,0x3c,0x02,0xb0,0x0a,0x08,0x00,0x04,0x08,0x3c,0x02,0xb0,0x0a, +0x8e,0x09,0x00,0x04,0x8e,0x02,0x00,0x08,0x8e,0x03,0x00,0x0c,0x00,0x09,0x41,0x42, +0x00,0x02,0x22,0x02,0x00,0x03,0x3a,0x02,0x30,0x84,0xff,0x00,0x30,0xe7,0xff,0x00, +0x00,0x02,0x5e,0x02,0x00,0x02,0x32,0x00,0x00,0x03,0x56,0x02,0x00,0x03,0x2a,0x00, +0x01,0x64,0x58,0x25,0x00,0xd6,0x30,0x24,0x01,0x47,0x50,0x25,0x00,0x02,0x16,0x00, +0x00,0xb6,0x28,0x24,0x00,0x03,0x1e,0x00,0x01,0x66,0x58,0x25,0x01,0x45,0x50,0x25, +0x00,0x57,0x10,0x24,0x00,0x77,0x18,0x24,0x01,0x62,0x38,0x25,0x01,0x43,0x30,0x25, +0x00,0x09,0x10,0xc2,0x00,0x09,0x1c,0x02,0x31,0x08,0x00,0x03,0x30,0x4c,0x00,0x03, +0x30,0x63,0x00,0x0f,0x00,0x09,0x26,0x02,0x00,0xe0,0x58,0x21,0x15,0x00,0x00,0x28, +0x00,0xc0,0x50,0x21,0x24,0x02,0x00,0x01,0x10,0x62,0x00,0x06,0x00,0x80,0x28,0x21, +0x24,0x02,0x00,0x03,0x14,0x62,0xff,0x69,0x02,0x51,0x10,0x21,0x24,0x85,0x01,0x00, +0x24,0x02,0x00,0x01,0x11,0x82,0x00,0x15,0x24,0x02,0x00,0x02,0x11,0x82,0x00,0x0a, +0x3c,0x03,0xb0,0x03,0x00,0xa3,0x18,0x21,0x8c,0x62,0x00,0x00,0x00,0x0a,0x20,0x27, +0x01,0x6a,0x28,0x24,0x00,0x44,0x10,0x24,0x00,0x45,0x10,0x25,0xac,0x62,0x00,0x00, +0x08,0x00,0x03,0xa7,0x02,0x51,0x10,0x21,0x00,0xa3,0x18,0x21,0x94,0x62,0x00,0x00, +0x00,0x0a,0x20,0x27,0x01,0x6a,0x28,0x24,0x00,0x44,0x10,0x24,0x00,0x45,0x10,0x25, +0xa4,0x62,0x00,0x00,0x08,0x00,0x03,0xa7,0x02,0x51,0x10,0x21,0x3c,0x03,0xb0,0x03, +0x00,0xa3,0x18,0x21,0x90,0x62,0x00,0x00,0x00,0x0a,0x20,0x27,0x01,0x6a,0x28,0x24, +0x00,0x44,0x10,0x24,0x00,0x45,0x10,0x25,0x08,0x00,0x03,0xa6,0xa0,0x62,0x00,0x00, +0x24,0x02,0x00,0x01,0x11,0x02,0x00,0x21,0x00,0x00,0x00,0x00,0x15,0x13,0xff,0x42, +0x00,0x00,0x00,0x00,0x11,0x82,0x00,0x17,0x00,0x00,0x00,0x00,0x11,0x88,0x00,0x0b, +0x00,0x00,0x00,0x00,0x27,0x83,0x8b,0x60,0x00,0x04,0x20,0x80,0x00,0x83,0x20,0x21, +0x8c,0x82,0x00,0x18,0x00,0x06,0x18,0x27,0x00,0xe6,0x28,0x24,0x00,0x43,0x10,0x24, +0x00,0x45,0x10,0x25,0x08,0x00,0x03,0xa6,0xac,0x82,0x00,0x18,0x27,0x83,0x8b,0x68, +0x00,0x04,0x20,0x40,0x00,0x83,0x20,0x21,0x94,0x82,0x00,0x02,0x00,0x06,0x18,0x27, +0x00,0xe6,0x28,0x24,0x00,0x43,0x10,0x24,0x00,0x45,0x10,0x25,0x08,0x00,0x03,0xa6, +0xa4,0x82,0x00,0x02,0x27,0x83,0x8b,0x60,0x00,0x83,0x18,0x21,0x90,0x62,0x00,0x00, +0x00,0x06,0x20,0x27,0x08,0x00,0x04,0x5c,0x00,0xe6,0x28,0x24,0x30,0x62,0x00,0x07, +0x00,0x02,0x12,0x00,0x11,0x88,0x00,0x0f,0x00,0x44,0x10,0x21,0x11,0x93,0x00,0x07, +0x00,0x00,0x00,0x00,0x3c,0x03,0xb0,0x0a,0x00,0x43,0x18,0x21,0x8c,0x62,0x00,0x00, +0x00,0x06,0x20,0x27,0x08,0x00,0x04,0x49,0x00,0xe6,0x28,0x24,0x3c,0x03,0xb0,0x0a, +0x00,0x43,0x18,0x21,0x94,0x62,0x00,0x00,0x00,0x06,0x20,0x27,0x08,0x00,0x04,0x52, +0x00,0xe6,0x28,0x24,0x3c,0x03,0xb0,0x0a,0x08,0x00,0x04,0x7f,0x00,0x43,0x18,0x21, +0x97,0x85,0x8b,0xb4,0x3c,0x07,0xb0,0x02,0x3c,0x04,0xb0,0x03,0x3c,0x02,0x80,0x00, +0x00,0xa7,0x28,0x21,0x34,0x84,0x00,0x20,0x24,0x42,0x12,0x60,0x24,0x03,0xff,0x80, +0xac,0x82,0x00,0x00,0xa0,0xa3,0x00,0x07,0x97,0x82,0x8b,0xb6,0x97,0x85,0x8b,0xb4, +0x3c,0x06,0xb0,0x06,0x30,0x42,0xff,0xf8,0x24,0x42,0x00,0x10,0x00,0xa2,0x10,0x21, +0x30,0x42,0x0f,0xff,0x24,0x44,0x00,0x08,0x30,0x84,0x0f,0xff,0x00,0x05,0x28,0xc2, +0x3c,0x03,0x00,0x40,0x00,0xa3,0x28,0x25,0x00,0x87,0x20,0x21,0x34,0xc6,0x80,0x18, +0xac,0xc5,0x00,0x00,0xaf,0x84,0x8b,0xb0,0xa7,0x82,0x8b,0xb4,0xa7,0x80,0x8b,0xb6, +0xaf,0x80,0x8b,0xb8,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00,0x30,0xa5,0x00,0xff, +0x30,0x84,0x00,0xff,0x24,0x02,0x00,0x01,0x00,0xe0,0x48,0x21,0x30,0xc6,0x00,0xff, +0x8f,0xa7,0x00,0x10,0x10,0x82,0x00,0x07,0x00,0xa0,0x40,0x21,0x24,0x02,0x00,0x03, +0x10,0x82,0x00,0x03,0x00,0x00,0x00,0x00,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00, +0x24,0xa8,0x01,0x00,0x3c,0x03,0xb0,0x03,0x24,0x02,0x00,0x01,0x00,0x07,0x20,0x27, +0x01,0x27,0x28,0x24,0x10,0xc2,0x00,0x14,0x01,0x03,0x18,0x21,0x24,0x02,0x00,0x02, +0x10,0xc2,0x00,0x09,0x00,0x07,0x50,0x27,0x3c,0x03,0xb0,0x03,0x01,0x03,0x18,0x21, +0x8c,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4a,0x10,0x24,0x00,0x45,0x10,0x25, +0x08,0x00,0x04,0xe3,0xac,0x62,0x00,0x00,0x3c,0x03,0xb0,0x03,0x01,0x03,0x18,0x21, +0x94,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4a,0x10,0x24,0x00,0x45,0x10,0x25, +0x03,0xe0,0x00,0x08,0xa4,0x62,0x00,0x00,0x90,0x62,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x44,0x10,0x24,0x00,0x45,0x10,0x25,0xa0,0x62,0x00,0x00,0x03,0xe0,0x00,0x08, +0x00,0x00,0x00,0x00,0x30,0x84,0x00,0x07,0x00,0x04,0x22,0x00,0x30,0xa5,0x00,0xff, +0x00,0x85,0x28,0x21,0x3c,0x02,0xb0,0x0a,0x00,0xa2,0x40,0x21,0x30,0xc6,0x00,0xff, +0x24,0x02,0x00,0x01,0x8f,0xa4,0x00,0x10,0x10,0xc2,0x00,0x14,0x24,0x02,0x00,0x02, +0x00,0x04,0x50,0x27,0x10,0xc2,0x00,0x09,0x00,0xe4,0x48,0x24,0x3c,0x03,0xb0,0x0a, +0x00,0xa3,0x18,0x21,0x8c,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4a,0x10,0x24, +0x00,0x49,0x10,0x25,0x03,0xe0,0x00,0x08,0xac,0x62,0x00,0x00,0x3c,0x03,0xb0,0x0a, +0x00,0xa3,0x18,0x21,0x94,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4a,0x10,0x24, +0x00,0x49,0x10,0x25,0x03,0xe0,0x00,0x08,0xa4,0x62,0x00,0x00,0x91,0x02,0x00,0x00, +0x00,0x04,0x18,0x27,0x00,0xe4,0x20,0x24,0x00,0x43,0x10,0x24,0x00,0x44,0x10,0x25, +0x03,0xe0,0x00,0x08,0xa1,0x02,0x00,0x00,0x30,0xa9,0x00,0xff,0x27,0x83,0x8b,0x60, +0x30,0x85,0x00,0xff,0x24,0x02,0x00,0x01,0x00,0x07,0x50,0x27,0x00,0xc7,0x40,0x24, +0x11,0x22,0x00,0x17,0x00,0xa3,0x18,0x21,0x00,0x05,0x20,0x40,0x27,0x82,0x8b,0x60, +0x00,0x05,0x28,0x80,0x27,0x83,0x8b,0x68,0x00,0x83,0x50,0x21,0x00,0xa2,0x20,0x21, +0x24,0x02,0x00,0x02,0x00,0x07,0x40,0x27,0x11,0x22,0x00,0x07,0x00,0xc7,0x28,0x24, +0x8c,0x82,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x48,0x10,0x24,0x00,0x45,0x10,0x25, +0x03,0xe0,0x00,0x08,0xac,0x82,0x00,0x18,0x95,0x42,0x00,0x02,0x00,0x00,0x00,0x00, +0x00,0x48,0x10,0x24,0x00,0x45,0x10,0x25,0x03,0xe0,0x00,0x08,0xa5,0x42,0x00,0x02, +0x90,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4a,0x10,0x24,0x00,0x48,0x10,0x25, +0x03,0xe0,0x00,0x08,0xa0,0x62,0x00,0x00,0x00,0x04,0x32,0x02,0x30,0xc6,0xff,0x00, +0x00,0x04,0x16,0x02,0x00,0x04,0x1a,0x00,0x3c,0x05,0x00,0xff,0x00,0x65,0x18,0x24, +0x00,0x46,0x10,0x25,0x00,0x43,0x10,0x25,0x00,0x04,0x26,0x00,0x03,0xe0,0x00,0x08, +0x00,0x44,0x10,0x25,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00,0x27,0xbd,0xff,0xe8, +0x34,0x63,0x00,0x20,0x24,0x42,0x14,0xe4,0x3c,0x04,0xb0,0x03,0xaf,0xbf,0x00,0x14, +0xac,0x62,0x00,0x00,0xaf,0xb0,0x00,0x10,0x34,0x84,0x00,0x2c,0x8c,0x83,0x00,0x00, +0xa7,0x80,0xbb,0xf0,0x00,0x03,0x12,0x02,0x00,0x03,0x2d,0x02,0x30,0x42,0x0f,0xff, +0xa3,0x83,0xbb,0xf8,0xa7,0x85,0xbb,0xfc,0xa7,0x82,0xbb,0xfa,0xa7,0x80,0xbb,0xf2, +0xa7,0x80,0xbb,0xf4,0xa7,0x80,0xbb,0xf6,0x0c,0x00,0x06,0xce,0x24,0x04,0x05,0x00, +0x3c,0x05,0x08,0x00,0x00,0x45,0x28,0x25,0x24,0x04,0x05,0x00,0x0c,0x00,0x06,0xc1, +0x00,0x40,0x80,0x21,0x3c,0x02,0xf7,0xff,0x34,0x42,0xff,0xff,0x02,0x02,0x80,0x24, +0x02,0x00,0x28,0x21,0x0c,0x00,0x06,0xc1,0x24,0x04,0x05,0x00,0x3c,0x02,0xb0,0x03, +0x3c,0x03,0xb0,0x03,0x34,0x42,0x01,0x08,0x34,0x63,0x01,0x18,0x8c,0x45,0x00,0x00, +0x8c,0x64,0x00,0x00,0x3c,0x02,0x00,0x0f,0x3c,0x03,0x00,0x4c,0x30,0x84,0x02,0x00, +0x34,0x63,0x4b,0x40,0xaf,0x85,0xbc,0x00,0x10,0x80,0x00,0x06,0x34,0x42,0x42,0x40, +0xaf,0x83,0xbc,0x04,0x8f,0xbf,0x00,0x14,0x8f,0xb0,0x00,0x10,0x03,0xe0,0x00,0x08, +0x27,0xbd,0x00,0x18,0xaf,0x82,0xbc,0x04,0x08,0x00,0x05,0x69,0x00,0x00,0x00,0x00, +0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00,0x27,0xbd,0xff,0xc8,0x34,0x63,0x00,0x20, +0x24,0x42,0x15,0xc0,0x30,0x84,0x00,0xff,0xaf,0xbf,0x00,0x30,0xaf,0xb7,0x00,0x2c, +0xaf,0xb6,0x00,0x28,0xaf,0xb5,0x00,0x24,0xaf,0xb4,0x00,0x20,0xaf,0xb3,0x00,0x1c, +0xaf,0xb2,0x00,0x18,0xaf,0xb1,0x00,0x14,0xaf,0xb0,0x00,0x10,0xac,0x62,0x00,0x00, +0x10,0x80,0x00,0x1c,0x24,0x02,0x00,0x02,0x10,0x82,0x00,0x08,0x00,0x00,0x00,0x00, +0x8f,0xbf,0x00,0x30,0x7b,0xb6,0x01,0x7c,0x7b,0xb4,0x01,0x3c,0x7b,0xb2,0x00,0xfc, +0x7b,0xb0,0x00,0xbc,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x38,0xa7,0x80,0xbb,0xf0, +0xa7,0x80,0xbb,0xf2,0xa7,0x80,0xbb,0xf4,0xa7,0x80,0xbb,0xf6,0x0c,0x00,0x06,0xce, +0x24,0x04,0x05,0x00,0x3c,0x05,0x08,0x00,0x00,0x45,0x28,0x25,0x24,0x04,0x05,0x00, +0x0c,0x00,0x06,0xc1,0x00,0x40,0x80,0x21,0x3c,0x05,0xf7,0xff,0x34,0xa5,0xff,0xff, +0x02,0x05,0x28,0x24,0x0c,0x00,0x06,0xc1,0x24,0x04,0x05,0x00,0x08,0x00,0x05,0x84, +0x00,0x00,0x00,0x00,0x0c,0x00,0x06,0xce,0x24,0x04,0x05,0xa0,0x24,0x04,0x05,0xa4, +0x0c,0x00,0x06,0xce,0x00,0x02,0xbc,0x02,0x24,0x04,0x05,0xa8,0x00,0x02,0xb4,0x02, +0x0c,0x00,0x06,0xce,0x30,0x55,0xff,0xff,0x00,0x40,0x80,0x21,0x97,0x84,0xbb,0xf0, +0x97,0x82,0xbb,0xf2,0x97,0x83,0xbb,0xf6,0x02,0xe4,0x20,0x23,0x02,0xa2,0x10,0x23, +0x00,0x82,0x20,0x21,0x97,0x82,0xbb,0xf4,0x32,0x14,0xff,0xff,0x02,0x83,0x18,0x23, +0x02,0xc2,0x10,0x23,0x00,0x82,0x20,0x21,0x93,0x82,0xbb,0xf8,0x00,0x83,0x20,0x21, +0x30,0x84,0xff,0xff,0x00,0x82,0x10,0x2b,0x14,0x40,0x00,0xaa,0x00,0x00,0x00,0x00, +0x97,0x82,0xbb,0xfc,0x00,0x00,0x00,0x00,0x00,0x44,0x10,0x2b,0x14,0x40,0x00,0x7f, +0x00,0x00,0x00,0x00,0x97,0x82,0xbb,0xfa,0x00,0x00,0x00,0x00,0x00,0x44,0x10,0x2b, +0x10,0x40,0x00,0x3a,0x00,0x00,0x00,0x00,0x0c,0x00,0x06,0xce,0x24,0x04,0x04,0x50, +0x30,0x51,0x00,0x7f,0x00,0x40,0x80,0x21,0x2e,0x22,0x00,0x32,0x10,0x40,0x00,0x13, +0x24,0x02,0x00,0x20,0x12,0x22,0x00,0x17,0x24,0x02,0xff,0x80,0x02,0x02,0x10,0x24, +0x26,0x31,0x00,0x01,0x00,0x51,0x80,0x25,0x02,0x00,0x28,0x21,0x0c,0x00,0x06,0xc1, +0x24,0x04,0x04,0x50,0x02,0x00,0x28,0x21,0x0c,0x00,0x06,0xc1,0x24,0x04,0x04,0x58, +0x02,0x00,0x28,0x21,0x0c,0x00,0x06,0xc1,0x24,0x04,0x04,0x60,0x02,0x00,0x28,0x21, +0x24,0x04,0x04,0x68,0x0c,0x00,0x06,0xc1,0x00,0x00,0x00,0x00,0xa7,0x97,0xbb,0xf0, +0xa7,0x95,0xbb,0xf2,0xa7,0x96,0xbb,0xf4,0xa7,0x94,0xbb,0xf6,0x08,0x00,0x05,0x84, +0x00,0x00,0x00,0x00,0x0c,0x00,0x06,0xce,0x24,0x04,0x02,0x08,0x3c,0x04,0x00,0xc0, +0x00,0x40,0x28,0x21,0x00,0x44,0x10,0x24,0x00,0x02,0x15,0x82,0x24,0x03,0x00,0x03, +0x10,0x43,0x00,0x07,0x00,0x00,0x00,0x00,0x3c,0x02,0xff,0x3f,0x34,0x42,0xff,0xff, +0x00,0xa2,0x10,0x24,0x00,0x44,0x28,0x25,0x0c,0x00,0x06,0xc1,0x24,0x04,0x02,0x08, +0x0c,0x00,0x06,0xce,0x24,0x04,0x02,0x2c,0x00,0x40,0x90,0x21,0x3c,0x02,0xff,0xff, +0x34,0x42,0x3f,0xff,0x02,0x42,0x90,0x24,0x02,0x40,0x28,0x21,0x0c,0x00,0x06,0xc1, +0x24,0x04,0x02,0x2c,0x08,0x00,0x05,0xcb,0x24,0x02,0xff,0x80,0x0c,0x00,0x06,0xce, +0x24,0x04,0x04,0x50,0x30,0x51,0x00,0x7f,0x24,0x02,0x00,0x20,0x16,0x22,0xff,0xdb, +0x00,0x00,0x00,0x00,0x0c,0x00,0x06,0xce,0x24,0x04,0x02,0x2c,0x34,0x52,0x40,0x00, +0x02,0x40,0x28,0x21,0x0c,0x00,0x06,0xc1,0x24,0x04,0x02,0x2c,0x0c,0x00,0x06,0xce, +0x24,0x04,0x02,0x58,0x24,0x04,0x02,0x5c,0x0c,0x00,0x06,0xce,0x00,0x02,0x9e,0x02, +0x30,0x43,0x00,0xff,0x00,0x13,0x12,0x00,0x00,0x43,0x10,0x25,0x2c,0x43,0x00,0x04, +0x14,0x60,0x00,0x1d,0x2c,0x42,0x00,0x11,0x10,0x40,0x00,0x0b,0x00,0x00,0x00,0x00, +0x3c,0x02,0xff,0xff,0x34,0x42,0x3f,0xff,0x02,0x42,0x90,0x24,0x02,0x40,0x28,0x21, +0x24,0x04,0x02,0x2c,0x0c,0x00,0x06,0xc1,0x36,0x52,0x80,0x00,0x02,0x40,0x28,0x21, +0x08,0x00,0x05,0xd9,0x24,0x04,0x02,0x2c,0x0c,0x00,0x06,0xce,0x24,0x04,0x02,0x08, +0x3c,0x04,0x00,0xc0,0x00,0x40,0x28,0x21,0x00,0x44,0x10,0x24,0x00,0x02,0x15,0x82, +0x24,0x03,0x00,0x02,0x14,0x43,0xff,0xee,0x3c,0x02,0xff,0x3f,0x34,0x42,0xff,0xff, +0x00,0xa2,0x10,0x24,0x00,0x44,0x28,0x25,0x0c,0x00,0x06,0xc1,0x24,0x04,0x02,0x08, +0x08,0x00,0x06,0x15,0x3c,0x02,0xff,0xff,0x0c,0x00,0x06,0xce,0x24,0x04,0x02,0x08, +0x00,0x40,0x28,0x21,0x00,0x02,0x15,0x82,0x30,0x42,0x00,0x03,0x24,0x03,0x00,0x03, +0x14,0x43,0xff,0xdf,0x3c,0x02,0xff,0x3f,0x34,0x42,0xff,0xff,0x00,0xa2,0x10,0x24, +0x3c,0x03,0x00,0x80,0x08,0x00,0x06,0x2a,0x00,0x43,0x28,0x25,0x0c,0x00,0x06,0xce, +0x24,0x04,0x04,0x50,0x30,0x51,0x00,0x7f,0x00,0x40,0x80,0x21,0x2e,0x22,0x00,0x32, +0x10,0x40,0xff,0x9a,0x24,0x02,0x00,0x20,0x12,0x22,0x00,0x04,0x24,0x02,0xff,0x80, +0x02,0x02,0x10,0x24,0x08,0x00,0x05,0xcd,0x26,0x31,0x00,0x02,0x0c,0x00,0x06,0xce, +0x24,0x04,0x02,0x08,0x3c,0x04,0x00,0xc0,0x00,0x40,0x28,0x21,0x00,0x44,0x10,0x24, +0x00,0x02,0x15,0x82,0x24,0x03,0x00,0x03,0x10,0x43,0x00,0x07,0x00,0x00,0x00,0x00, +0x3c,0x02,0xff,0x3f,0x34,0x42,0xff,0xff,0x00,0xa2,0x10,0x24,0x00,0x44,0x28,0x25, +0x0c,0x00,0x06,0xc1,0x24,0x04,0x02,0x08,0x0c,0x00,0x06,0xce,0x24,0x04,0x02,0x2c, +0x00,0x40,0x90,0x21,0x3c,0x02,0xff,0xff,0x34,0x42,0x3f,0xff,0x02,0x42,0x90,0x24, +0x02,0x40,0x28,0x21,0x0c,0x00,0x06,0xc1,0x24,0x04,0x02,0x2c,0x08,0x00,0x06,0x44, +0x24,0x02,0xff,0x80,0x0c,0x00,0x06,0xce,0x24,0x04,0x04,0x50,0x00,0x40,0x80,0x21, +0x30,0x51,0x00,0x7f,0x24,0x02,0x00,0x20,0x12,0x22,0x00,0x1d,0x2e,0x22,0x00,0x21, +0x14,0x40,0xff,0x72,0x24,0x02,0xff,0x80,0x02,0x02,0x10,0x24,0x26,0x31,0xff,0xff, +0x00,0x51,0x80,0x25,0x24,0x04,0x04,0x50,0x0c,0x00,0x06,0xc1,0x02,0x00,0x28,0x21, +0x24,0x04,0x04,0x58,0x0c,0x00,0x06,0xc1,0x02,0x00,0x28,0x21,0x24,0x04,0x04,0x60, +0x0c,0x00,0x06,0xc1,0x02,0x00,0x28,0x21,0x02,0x00,0x28,0x21,0x0c,0x00,0x06,0xc1, +0x24,0x04,0x04,0x68,0x24,0x02,0x00,0x20,0x16,0x22,0xff,0x60,0x00,0x00,0x00,0x00, +0x0c,0x00,0x06,0xce,0x24,0x04,0x02,0x2c,0x00,0x40,0x90,0x21,0x3c,0x02,0xff,0xff, +0x34,0x42,0x3f,0xff,0x02,0x42,0x10,0x24,0x08,0x00,0x06,0x1b,0x34,0x52,0x80,0x00, +0x0c,0x00,0x06,0xce,0x24,0x04,0x02,0x2c,0x34,0x52,0x40,0x00,0x02,0x40,0x28,0x21, +0x0c,0x00,0x06,0xc1,0x24,0x04,0x02,0x2c,0x0c,0x00,0x06,0xce,0x24,0x04,0x02,0x58, +0x24,0x04,0x02,0x5c,0x0c,0x00,0x06,0xce,0x00,0x02,0x9e,0x02,0x30,0x43,0x00,0xff, +0x00,0x13,0x12,0x00,0x00,0x43,0x10,0x25,0x2c,0x43,0x00,0x04,0x14,0x60,0x00,0x20, +0x2c,0x42,0x00,0x11,0x10,0x40,0x00,0x0d,0x00,0x00,0x00,0x00,0x3c,0x02,0xff,0xff, +0x34,0x42,0x3f,0xff,0x02,0x42,0x90,0x24,0x02,0x40,0x28,0x21,0x24,0x04,0x02,0x2c, +0x0c,0x00,0x06,0xc1,0x36,0x52,0x80,0x00,0x02,0x40,0x28,0x21,0x0c,0x00,0x06,0xc1, +0x24,0x04,0x02,0x2c,0x08,0x00,0x06,0x68,0x2e,0x22,0x00,0x21,0x0c,0x00,0x06,0xce, +0x24,0x04,0x02,0x08,0x3c,0x04,0x00,0xc0,0x00,0x40,0x28,0x21,0x00,0x44,0x10,0x24, +0x00,0x02,0x15,0x82,0x24,0x03,0x00,0x02,0x14,0x43,0xff,0xec,0x00,0x00,0x00,0x00, +0x3c,0x02,0xff,0x3f,0x34,0x42,0xff,0xff,0x00,0xa2,0x10,0x24,0x00,0x44,0x28,0x25, +0x0c,0x00,0x06,0xc1,0x24,0x04,0x02,0x08,0x08,0x00,0x06,0x98,0x3c,0x02,0xff,0xff, +0x0c,0x00,0x06,0xce,0x24,0x04,0x02,0x08,0x00,0x40,0x28,0x21,0x00,0x02,0x15,0x82, +0x30,0x42,0x00,0x03,0x24,0x03,0x00,0x03,0x14,0x43,0xff,0xdc,0x3c,0x03,0x00,0x80, +0x3c,0x02,0xff,0x3f,0x34,0x42,0xff,0xff,0x00,0xa2,0x10,0x24,0x08,0x00,0x06,0xb0, +0x00,0x43,0x28,0x25,0x30,0x83,0x00,0x03,0x00,0x04,0x20,0x40,0x00,0x83,0x20,0x23, +0x3c,0x02,0xb0,0x0a,0x00,0x82,0x20,0x21,0xac,0x85,0x00,0x00,0x00,0x00,0x18,0x21, +0x24,0x63,0x00,0x01,0x2c,0x62,0x00,0x0a,0x14,0x40,0xff,0xfe,0x24,0x63,0x00,0x01, +0x03,0xe0,0x00,0x08,0x24,0x63,0xff,0xff,0x30,0x86,0x00,0x03,0x00,0x04,0x28,0x40, +0x3c,0x03,0xb0,0x0a,0x00,0xa6,0x10,0x23,0x00,0x43,0x10,0x21,0x24,0x04,0xff,0xff, +0xac,0x44,0x10,0x00,0x00,0x00,0x18,0x21,0x24,0x63,0x00,0x01,0x2c,0x62,0x00,0x0a, +0x14,0x40,0xff,0xfe,0x24,0x63,0x00,0x01,0x24,0x63,0xff,0xff,0x00,0xa6,0x18,0x23, +0x3c,0x02,0xb0,0x0a,0x00,0x62,0x18,0x21,0x8c,0x62,0x00,0x00,0x03,0xe0,0x00,0x08, +0x00,0x00,0x00,0x00,0x3c,0x05,0xb0,0x03,0x3c,0x02,0x80,0x00,0x24,0x42,0x1b,0x84, +0x24,0x03,0x00,0x01,0x34,0xa5,0x00,0x20,0x3c,0x06,0xb0,0x03,0xac,0xa2,0x00,0x00, +0x34,0xc6,0x01,0x04,0xa0,0x83,0x00,0x48,0xa0,0x80,0x00,0x04,0xa0,0x80,0x00,0x05, +0xa0,0x80,0x00,0x06,0xa0,0x80,0x00,0x07,0xa0,0x80,0x00,0x08,0xa0,0x80,0x00,0x09, +0xa0,0x80,0x00,0x0a,0xa0,0x80,0x00,0x11,0xa0,0x80,0x00,0x13,0xa0,0x80,0x00,0x49, +0x94,0xc2,0x00,0x00,0xac,0x80,0x00,0x00,0xa0,0x80,0x00,0x4e,0x00,0x02,0x14,0x00, +0x00,0x02,0x14,0x03,0x30,0x43,0x00,0xff,0x30,0x42,0xff,0x00,0xa4,0x82,0x00,0x44, +0xa4,0x83,0x00,0x46,0xac,0x80,0x00,0x24,0xac,0x80,0x00,0x28,0xac,0x80,0x00,0x2c, +0xac,0x80,0x00,0x30,0xac,0x80,0x00,0x34,0xac,0x80,0x00,0x38,0xac,0x80,0x00,0x3c, +0x03,0xe0,0x00,0x08,0xac,0x80,0x00,0x40,0x84,0x83,0x00,0x0c,0x3c,0x07,0xb0,0x03, +0x34,0xe7,0x00,0x20,0x00,0x03,0x10,0xc0,0x00,0x43,0x10,0x21,0x00,0x02,0x10,0x80, +0x27,0x83,0x8f,0xf4,0x00,0x43,0x10,0x21,0x8c,0x48,0x00,0x18,0x3c,0x02,0x80,0x00, +0x24,0x42,0x1c,0x18,0xac,0xe2,0x00,0x00,0x8d,0x03,0x00,0x08,0x80,0x82,0x00,0x13, +0x00,0x05,0x2c,0x00,0x00,0x03,0x1e,0x02,0x00,0x02,0x12,0x00,0x30,0x63,0x00,0x7e, +0x00,0x62,0x18,0x21,0x00,0x65,0x18,0x21,0x3c,0x02,0xc0,0x00,0x3c,0x05,0xb0,0x05, +0x34,0x42,0x04,0x00,0x24,0x63,0x00,0x01,0x3c,0x07,0xb0,0x05,0x3c,0x08,0xb0,0x05, +0x34,0xa5,0x04,0x20,0xac,0xa3,0x00,0x00,0x00,0xc2,0x30,0x21,0x34,0xe7,0x04,0x24, +0x35,0x08,0x02,0x28,0x24,0x02,0x00,0x01,0x24,0x03,0x00,0x20,0xac,0xe6,0x00,0x00, +0xac,0x82,0x00,0x3c,0x03,0xe0,0x00,0x08,0xa1,0x03,0x00,0x00,0x27,0xbd,0xff,0xa8, +0x00,0x07,0x60,0x80,0x27,0x82,0xb3,0xf0,0xaf,0xbe,0x00,0x50,0xaf,0xb7,0x00,0x4c, +0xaf,0xb5,0x00,0x44,0xaf,0xb4,0x00,0x40,0xaf,0xbf,0x00,0x54,0xaf,0xb6,0x00,0x48, +0xaf,0xb3,0x00,0x3c,0xaf,0xb2,0x00,0x38,0xaf,0xb1,0x00,0x34,0xaf,0xb0,0x00,0x30, +0x01,0x82,0x10,0x21,0x8c,0x43,0x00,0x00,0x00,0xe0,0x70,0x21,0x3c,0x02,0x80,0x00, +0x94,0x73,0x00,0x14,0x3c,0x07,0xb0,0x03,0x34,0xe7,0x00,0x20,0x24,0x42,0x1c,0xac, +0x3c,0x03,0xb0,0x05,0xac,0xe2,0x00,0x00,0x34,0x63,0x01,0x28,0x90,0x67,0x00,0x00, +0x00,0x13,0xa8,0xc0,0x02,0xb3,0x18,0x21,0x27,0x82,0x8f,0xf4,0x00,0x03,0x18,0x80, +0x00,0x62,0x18,0x21,0x00,0x05,0x2c,0x00,0x00,0x07,0x3e,0x00,0x28,0xc2,0x00,0x03, +0x00,0xc0,0xa0,0x21,0x00,0x80,0x78,0x21,0x00,0x05,0xbc,0x03,0x8c,0x68,0x00,0x18, +0x02,0xa0,0x58,0x21,0x10,0x40,0x01,0x81,0x00,0x07,0xf6,0x03,0x00,0xde,0x10,0x07, +0x30,0x5e,0x00,0x01,0x01,0x73,0x10,0x21,0x27,0x83,0x8f,0xf8,0x00,0x02,0x10,0x80, +0x00,0x43,0x10,0x21,0x80,0x4d,0x00,0x06,0x8d,0x03,0x00,0x00,0x8d,0x02,0x00,0x04, +0x8d,0x0a,0x00,0x08,0x8d,0x03,0x00,0x0c,0xaf,0xa2,0x00,0x20,0x11,0xa0,0x01,0x71, +0xaf,0xa3,0x00,0x18,0x27,0x82,0xb3,0xf0,0x01,0x82,0x10,0x21,0x8c,0x44,0x00,0x00, +0x00,0x00,0x00,0x00,0x90,0x83,0x00,0x16,0x00,0x00,0x00,0x00,0x30,0x63,0x00,0x04, +0x14,0x60,0x00,0x12,0x00,0x00,0xb0,0x21,0x3c,0x02,0xb0,0x09,0x34,0x42,0x01,0x46, +0x90,0x43,0x00,0x00,0x2a,0x84,0x00,0x04,0x10,0x80,0x01,0x56,0x30,0x65,0x00,0x01, +0x91,0xe2,0x00,0x09,0x00,0x00,0x00,0x00,0x12,0x82,0x00,0x02,0x00,0x00,0x00,0x00, +0x00,0x00,0x28,0x21,0x14,0xa0,0x00,0x03,0x00,0x00,0x38,0x21,0x13,0xc0,0x00,0x03, +0x38,0xf6,0x00,0x01,0x24,0x07,0x00,0x01,0x38,0xf6,0x00,0x01,0x01,0x73,0x10,0x21, +0x00,0x02,0x30,0x80,0x27,0x83,0x90,0x00,0x00,0xc3,0x48,0x21,0x91,0x25,0x00,0x00, +0x8f,0xa4,0x00,0x20,0x2c,0xa3,0x00,0x04,0x00,0x04,0x11,0xc3,0x30,0x42,0x00,0x01, +0x00,0x03,0xb0,0x0b,0x12,0xc0,0x00,0xd8,0xaf,0xa2,0x00,0x24,0x93,0x90,0xbb,0xda, +0x00,0x0a,0x16,0x42,0x30,0x52,0x00,0x3f,0x2e,0x06,0x00,0x0c,0x10,0xc0,0x00,0xc0, +0x00,0xa0,0x20,0x21,0x2c,0xa2,0x00,0x10,0x14,0x40,0x00,0x04,0x00,0x90,0x10,0x2b, +0x30,0xa2,0x00,0x07,0x24,0x44,0x00,0x04,0x00,0x90,0x10,0x2b,0x10,0x40,0x00,0x0b, +0x01,0x73,0x10,0x21,0x27,0x85,0xbb,0x0c,0x00,0x10,0x10,0x40,0x00,0x50,0x10,0x21, +0x00,0x45,0x10,0x21,0x90,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x18,0x2b, +0x14,0x60,0xff,0xfa,0x00,0x10,0x10,0x40,0x01,0x73,0x10,0x21,0x00,0x02,0x10,0x80, +0x27,0x83,0x8f,0xf8,0x00,0x43,0x10,0x21,0x31,0xa4,0x00,0x01,0x10,0x80,0x00,0xa5, +0xa0,0x50,0x00,0x07,0x3c,0x04,0xb0,0x05,0x34,0x84,0x00,0x08,0x24,0x02,0x00,0x01, +0x3c,0x03,0x80,0x00,0xa1,0xe2,0x00,0x4e,0xac,0x83,0x00,0x00,0x8c,0x85,0x00,0x00, +0x3c,0x02,0x00,0xf0,0x3c,0x03,0x40,0xf0,0x34,0x42,0xf0,0x00,0x34,0x63,0xf0,0x00, +0x24,0x17,0x00,0x0e,0x24,0x13,0x01,0x06,0xac,0x82,0x00,0x00,0xac,0x83,0x00,0x00, +0x27,0x82,0xb3,0xf0,0x01,0x82,0x10,0x21,0x8c,0x43,0x00,0x00,0x24,0x05,0x00,0x01, +0xaf,0xa5,0x00,0x1c,0x90,0x62,0x00,0x16,0x00,0x13,0xa8,0xc0,0x32,0x51,0x00,0x02, +0x34,0x42,0x00,0x04,0xa0,0x62,0x00,0x16,0x8f,0xa3,0x00,0x20,0x8f,0xa4,0x00,0x18, +0x00,0x03,0x13,0x43,0x00,0x04,0x1a,0x02,0x30,0x47,0x00,0x01,0x12,0x20,0x00,0x04, +0x30,0x64,0x07,0xff,0x2e,0x03,0x00,0x04,0x32,0x42,0x00,0x33,0x00,0x43,0x90,0x0b, +0x8f,0xa5,0x00,0x24,0x8f,0xa6,0x00,0x1c,0x00,0x12,0x10,0x40,0x00,0x05,0x19,0xc0, +0x00,0x47,0x10,0x21,0x00,0x06,0x2a,0x80,0x00,0x43,0x10,0x21,0x00,0x10,0x32,0x00, +0x00,0x04,0x24,0x80,0x02,0x65,0x28,0x21,0x00,0xa4,0x28,0x21,0x00,0x46,0x10,0x21, +0x00,0x17,0x1c,0x00,0x3c,0x04,0xc0,0x00,0x00,0x43,0x30,0x21,0x16,0x80,0x00,0x29, +0x00,0xa4,0x28,0x21,0x3c,0x02,0xb0,0x05,0x34,0x42,0x04,0x00,0x3c,0x03,0xb0,0x05, +0x3c,0x04,0xb0,0x05,0xac,0x46,0x00,0x00,0x34,0x63,0x04,0x04,0x34,0x84,0x02,0x28, +0x24,0x02,0x00,0x01,0xac,0x65,0x00,0x00,0xa0,0x82,0x00,0x00,0x3c,0x02,0xb0,0x09, +0x34,0x42,0x01,0x46,0x90,0x44,0x00,0x00,0x91,0xe3,0x00,0x09,0x30,0x86,0x00,0x01, +0x02,0x83,0x18,0x26,0x00,0x03,0x30,0x0b,0x14,0xc0,0x00,0x03,0x00,0x00,0x28,0x21, +0x13,0xc0,0x00,0x03,0x02,0xb3,0x10,0x21,0x24,0x05,0x00,0x01,0x02,0xb3,0x10,0x21, +0x27,0x83,0x8f,0xf8,0x00,0x02,0x10,0x80,0x00,0x43,0x10,0x21,0x84,0x48,0x00,0x04, +0x00,0xa0,0x30,0x21,0x00,0xe0,0x20,0x21,0x02,0x80,0x28,0x21,0x02,0xc0,0x38,0x21, +0x0c,0x00,0x00,0x72,0xaf,0xa8,0x00,0x10,0x7b,0xbe,0x02,0xbc,0x7b,0xb6,0x02,0x7c, +0x7b,0xb4,0x02,0x3c,0x7b,0xb2,0x01,0xfc,0x7b,0xb0,0x01,0xbc,0x03,0xe0,0x00,0x08, +0x27,0xbd,0x00,0x58,0x24,0x02,0x00,0x01,0x12,0x82,0x00,0x3d,0x3c,0x02,0xb0,0x05, +0x24,0x02,0x00,0x02,0x12,0x82,0x00,0x31,0x3c,0x02,0xb0,0x05,0x24,0x02,0x00,0x03, +0x12,0x82,0x00,0x25,0x3c,0x02,0xb0,0x05,0x24,0x02,0x00,0x10,0x12,0x82,0x00,0x19, +0x3c,0x02,0xb0,0x05,0x24,0x02,0x00,0x11,0x12,0x82,0x00,0x0d,0x3c,0x02,0xb0,0x05, +0x24,0x02,0x00,0x12,0x16,0x82,0xff,0xd1,0x3c,0x02,0xb0,0x05,0x3c,0x03,0xb0,0x05, +0x34,0x42,0x04,0x20,0x3c,0x04,0xb0,0x05,0x34,0x63,0x04,0x24,0xac,0x46,0x00,0x00, +0x34,0x84,0x02,0x28,0xac,0x65,0x00,0x00,0x08,0x00,0x07,0xe2,0x24,0x02,0x00,0x20, +0x34,0x42,0x04,0x40,0x3c,0x03,0xb0,0x05,0x3c,0x04,0xb0,0x05,0xac,0x46,0x00,0x00, +0x34,0x63,0x04,0x44,0x34,0x84,0x02,0x28,0x24,0x02,0x00,0x40,0x08,0x00,0x07,0xe2, +0xac,0x65,0x00,0x00,0x34,0x42,0x04,0x28,0x3c,0x03,0xb0,0x05,0x3c,0x04,0xb0,0x05, +0xac,0x46,0x00,0x00,0x34,0x63,0x04,0x2c,0x34,0x84,0x02,0x28,0x24,0x02,0xff,0x80, +0x08,0x00,0x07,0xe2,0xac,0x65,0x00,0x00,0x34,0x42,0x04,0x18,0x3c,0x03,0xb0,0x05, +0x3c,0x04,0xb0,0x05,0xac,0x46,0x00,0x00,0x34,0x63,0x04,0x1c,0x34,0x84,0x02,0x28, +0x24,0x02,0x00,0x08,0x08,0x00,0x07,0xe2,0xac,0x65,0x00,0x00,0x34,0x42,0x04,0x10, +0x3c,0x03,0xb0,0x05,0x3c,0x04,0xb0,0x05,0xac,0x46,0x00,0x00,0x34,0x63,0x04,0x14, +0x34,0x84,0x02,0x28,0x24,0x02,0x00,0x04,0x08,0x00,0x07,0xe2,0xac,0x65,0x00,0x00, +0x34,0x42,0x04,0x08,0x3c,0x03,0xb0,0x05,0x3c,0x04,0xb0,0x05,0xac,0x46,0x00,0x00, +0x34,0x63,0x04,0x0c,0x34,0x84,0x02,0x28,0x24,0x02,0x00,0x02,0x08,0x00,0x07,0xe2, +0xac,0x65,0x00,0x00,0x24,0x17,0x00,0x14,0x08,0x00,0x07,0xb4,0x24,0x13,0x01,0x02, +0x30,0xa2,0x00,0x07,0x24,0x44,0x00,0x0c,0x00,0x90,0x18,0x2b,0x10,0x60,0x00,0x0c, +0x26,0x02,0x00,0x04,0x27,0x85,0xbb,0x0c,0x00,0x10,0x10,0x40,0x00,0x50,0x10,0x21, +0x00,0x45,0x10,0x21,0x90,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x18,0x2b, +0x14,0x60,0xff,0xfa,0x00,0x10,0x10,0x40,0x2e,0x06,0x00,0x0c,0x26,0x02,0x00,0x04, +0x08,0x00,0x07,0x9e,0x00,0x46,0x80,0x0a,0x27,0x82,0xb3,0xf0,0x01,0x82,0x20,0x21, +0x8c,0x87,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0xe2,0x00,0x19,0x00,0x00,0x00,0x00, +0x14,0x40,0x00,0x07,0x00,0x00,0x00,0x00,0x27,0x82,0x90,0x10,0x00,0xc2,0x10,0x21, +0x90,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x60,0x00,0x14,0x00,0x00,0x00,0x00, +0x90,0xe3,0x00,0x16,0x27,0x82,0x8f,0xf8,0x00,0xc2,0x10,0x21,0x34,0x63,0x00,0x20, +0x90,0x50,0x00,0x07,0xa0,0xe3,0x00,0x16,0x8c,0x84,0x00,0x00,0x00,0x0a,0x1e,0x42, +0x24,0x06,0x00,0x01,0x90,0x82,0x00,0x16,0x30,0x71,0x00,0x02,0x30,0x72,0x00,0x3f, +0x30,0x42,0x00,0xfb,0x24,0x17,0x00,0x18,0x24,0x13,0x01,0x03,0x24,0x15,0x08,0x18, +0xaf,0xa6,0x00,0x1c,0x08,0x00,0x07,0xbe,0xa0,0x82,0x00,0x16,0x8d,0x02,0x00,0x04, +0x00,0x0a,0x1c,0x42,0x30,0x42,0x00,0x10,0x14,0x40,0x00,0x15,0x30,0x72,0x00,0x3f, +0x81,0x22,0x00,0x05,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x11,0x30,0x72,0x00,0x3e, +0x27,0x83,0x90,0x08,0x00,0xc3,0x18,0x21,0x80,0x64,0x00,0x00,0x27,0x83,0xb5,0x68, +0x00,0x04,0x11,0x00,0x00,0x44,0x10,0x23,0x00,0x02,0x10,0x80,0x00,0x44,0x10,0x23, +0x00,0x02,0x10,0x80,0x00,0x43,0x10,0x21,0x90,0x44,0x00,0x05,0x90,0x43,0x00,0x04, +0x00,0x00,0x00,0x00,0x00,0x64,0x18,0x24,0x30,0x63,0x00,0x01,0x02,0x43,0x90,0x25, +0x27,0x85,0xb3,0xf0,0x01,0x85,0x28,0x21,0x8c,0xa6,0x00,0x00,0x01,0x73,0x10,0x21, +0x27,0x83,0x90,0x00,0x90,0xc4,0x00,0x16,0x00,0x02,0x10,0x80,0x00,0x43,0x10,0x21, +0x30,0x84,0x00,0xdf,0x90,0x50,0x00,0x00,0xa0,0xc4,0x00,0x16,0x80,0xc6,0x00,0x12, +0x8c,0xa3,0x00,0x00,0x2d,0xc4,0x00,0x02,0xaf,0xa6,0x00,0x1c,0x90,0x62,0x00,0x16, +0x00,0x00,0x00,0x00,0x30,0x42,0x00,0xfb,0x14,0x80,0x00,0x06,0xa0,0x62,0x00,0x16, +0x24,0x02,0x00,0x06,0x11,0xc2,0x00,0x03,0x24,0x02,0x00,0x04,0x15,0xc2,0xff,0x0e, +0x32,0x51,0x00,0x02,0x32,0x51,0x00,0x02,0x2e,0x02,0x00,0x0c,0x14,0x40,0x00,0x0f, +0x00,0x11,0x18,0x2b,0x32,0x02,0x00,0x0f,0x34,0x42,0x00,0x10,0x00,0x03,0x19,0x00, +0x00,0x43,0x18,0x21,0x3c,0x02,0xb0,0x03,0x34,0x42,0x00,0xb8,0xa0,0x43,0x00,0x00, +0x00,0x00,0x20,0x21,0x02,0x00,0x28,0x21,0x0c,0x00,0x02,0x05,0xaf,0xaf,0x00,0x28, +0x8f,0xaf,0x00,0x28,0x08,0x00,0x07,0xbe,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0xb9, +0x32,0x03,0x00,0xff,0x3c,0x03,0xb0,0x05,0x34,0x63,0x02,0x42,0x90,0x62,0x00,0x00, +0x00,0x00,0x00,0x00,0x30,0x42,0x00,0x0f,0x14,0x40,0xfe,0xaa,0x00,0x00,0x00,0x00, +0x91,0xe2,0x00,0x09,0x00,0x00,0x00,0x00,0x02,0x82,0x10,0x26,0x08,0x00,0x07,0x75, +0x00,0x02,0x28,0x0b,0x08,0x00,0x07,0x7b,0x00,0x00,0xb0,0x21,0x24,0x02,0x00,0x10, +0x10,0xc2,0x00,0x08,0x24,0x02,0x00,0x11,0x10,0xc2,0xfe,0x7d,0x00,0x07,0x17,0x83, +0x24,0x02,0x00,0x12,0x14,0xc2,0xfe,0x7b,0x00,0x07,0x17,0x43,0x08,0x00,0x07,0x55, +0x30,0x5e,0x00,0x01,0x08,0x00,0x07,0x55,0x00,0x07,0xf7,0xc2,0x00,0x04,0x10,0x40, +0x27,0x83,0x80,0x1c,0x00,0x43,0x10,0x21,0x00,0x80,0x40,0x21,0x94,0x44,0x00,0x00, +0x2d,0x07,0x00,0x04,0x24,0xc2,0x00,0x03,0x00,0x47,0x30,0x0a,0x00,0x86,0x00,0x18, +0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00,0x34,0x63,0x00,0x20,0x24,0x42,0x23,0x7c, +0xac,0x62,0x00,0x00,0x2d,0x06,0x00,0x10,0x00,0x00,0x20,0x12,0x00,0x04,0x22,0x42, +0x24,0x84,0x00,0x01,0x24,0x83,0x00,0xc0,0x10,0xe0,0x00,0x0b,0x24,0x82,0x00,0x60, +0x00,0x40,0x20,0x21,0x00,0x65,0x20,0x0a,0x3c,0x03,0xb0,0x03,0x34,0x63,0x01,0x00, +0x90,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x42,0x00,0x01,0x00,0x44,0x20,0x04, +0x03,0xe0,0x00,0x08,0x00,0x80,0x10,0x21,0x24,0x85,0x00,0x28,0x24,0x83,0x00,0x24, +0x31,0x02,0x00,0x08,0x14,0xc0,0xff,0xf4,0x24,0x84,0x00,0x14,0x00,0x60,0x20,0x21, +0x08,0x00,0x08,0xf6,0x00,0xa2,0x20,0x0b,0x27,0xbd,0xff,0xe0,0x3c,0x03,0xb0,0x03, +0x3c,0x02,0x80,0x00,0xaf,0xb0,0x00,0x10,0x24,0x42,0x24,0x18,0x00,0x80,0x80,0x21, +0x34,0x63,0x00,0x20,0x3c,0x04,0xb0,0x03,0xaf,0xb2,0x00,0x18,0xaf,0xb1,0x00,0x14, +0xaf,0xbf,0x00,0x1c,0x83,0xb1,0x00,0x33,0x83,0xa8,0x00,0x37,0x34,0x84,0x01,0x10, +0xac,0x62,0x00,0x00,0x2e,0x02,0x00,0x10,0x00,0xe0,0x90,0x21,0x8c,0x87,0x00,0x00, +0x14,0x40,0x00,0x0c,0x2e,0x02,0x00,0x0c,0x3c,0x02,0x00,0x0f,0x34,0x42,0xf0,0x00, +0x00,0xe2,0x10,0x24,0x14,0x40,0x00,0x37,0x32,0x02,0x00,0x08,0x32,0x02,0x00,0x07, +0x27,0x83,0x80,0xcc,0x00,0x43,0x10,0x21,0x90,0x50,0x00,0x00,0x00,0x00,0x00,0x00, +0x2e,0x02,0x00,0x0c,0x14,0x40,0x00,0x03,0x02,0x00,0x20,0x21,0x32,0x02,0x00,0x0f, +0x24,0x44,0x00,0x0c,0x00,0x87,0x10,0x06,0x30,0x42,0x00,0x01,0x14,0x40,0x00,0x07, +0x2c,0x82,0x00,0x0c,0x00,0x04,0x10,0x80,0x27,0x83,0xb4,0x40,0x00,0x43,0x10,0x21, +0x8c,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x2c,0x82,0x00,0x0c,0x14,0x40,0x00,0x05, +0x00,0x05,0x10,0x40,0x00,0x46,0x10,0x21,0x00,0x02,0x11,0x00,0x00,0x82,0x10,0x21, +0x24,0x44,0x00,0x04,0x15,0x00,0x00,0x02,0x24,0x06,0x00,0x20,0x24,0x06,0x00,0x0e, +0x0c,0x00,0x08,0xdf,0x00,0x00,0x00,0x00,0x00,0x40,0x30,0x21,0x3c,0x02,0xb0,0x03, +0x34,0x42,0x01,0x00,0x90,0x43,0x00,0x00,0x2e,0x04,0x00,0x04,0x24,0x02,0x00,0x10, +0x24,0x05,0x00,0x0a,0x00,0x44,0x28,0x0a,0x30,0x63,0x00,0x01,0x14,0x60,0x00,0x02, +0x00,0x05,0x10,0x40,0x00,0xa0,0x10,0x21,0x30,0x45,0x00,0xff,0x00,0xc5,0x10,0x21, +0x24,0x46,0x00,0x46,0x02,0x26,0x18,0x04,0xa6,0x43,0x00,0x00,0x8f,0xbf,0x00,0x1c, +0x8f,0xb2,0x00,0x18,0x7b,0xb0,0x00,0xbc,0x00,0xc0,0x10,0x21,0x03,0xe0,0x00,0x08, +0x27,0xbd,0x00,0x20,0x10,0x40,0xff,0xcf,0x2e,0x02,0x00,0x0c,0x32,0x02,0x00,0x07, +0x27,0x83,0x80,0xc4,0x00,0x43,0x10,0x21,0x90,0x44,0x00,0x00,0x08,0x00,0x09,0x24, +0x02,0x04,0x80,0x23,0x27,0xbd,0xff,0xb8,0x00,0x05,0x38,0x80,0x27,0x82,0xb3,0xf0, +0xaf,0xbe,0x00,0x40,0xaf,0xb6,0x00,0x38,0xaf,0xb3,0x00,0x2c,0xaf,0xbf,0x00,0x44, +0xaf,0xb7,0x00,0x3c,0xaf,0xb5,0x00,0x34,0xaf,0xb4,0x00,0x30,0xaf,0xb2,0x00,0x28, +0xaf,0xb1,0x00,0x24,0xaf,0xb0,0x00,0x20,0x00,0xe2,0x38,0x21,0x8c,0xe6,0x00,0x00, +0xaf,0xa5,0x00,0x4c,0x3c,0x02,0x80,0x00,0x3c,0x05,0xb0,0x03,0x34,0xa5,0x00,0x20, +0x24,0x42,0x25,0x74,0x24,0x03,0x00,0x01,0xac,0xa2,0x00,0x00,0xa0,0xc3,0x00,0x12, +0x8c,0xe5,0x00,0x00,0x94,0xc3,0x00,0x06,0x90,0xa2,0x00,0x16,0xa4,0xc3,0x00,0x14, +0x27,0x83,0x8f,0xf0,0x34,0x42,0x00,0x08,0xa0,0xa2,0x00,0x16,0x8c,0xe8,0x00,0x00, +0xaf,0xa4,0x00,0x48,0x27,0x82,0x8f,0xf4,0x95,0x11,0x00,0x14,0x00,0x00,0x00,0x00, +0x00,0x11,0x98,0xc0,0x02,0x71,0x20,0x21,0x00,0x04,0x20,0x80,0x00,0x82,0x10,0x21, +0x8c,0x52,0x00,0x18,0x00,0x83,0x18,0x21,0x84,0x75,0x00,0x06,0x8e,0x45,0x00,0x08, +0x8e,0x46,0x00,0x04,0x8e,0x47,0x00,0x04,0x00,0x05,0x1c,0x82,0x00,0x06,0x31,0x42, +0x27,0x82,0x90,0x00,0x30,0x63,0x00,0x01,0x30,0xc6,0x00,0x01,0x00,0x82,0x20,0x21, +0xa5,0x15,0x00,0x1a,0x00,0x05,0x14,0x42,0xaf,0xa3,0x00,0x18,0xaf,0xa6,0x00,0x1c, +0x30,0xe7,0x00,0x10,0x30,0x56,0x00,0x01,0x80,0x97,0x00,0x06,0x14,0xe0,0x00,0x47, +0x00,0x05,0xf7,0xc2,0x80,0x82,0x00,0x05,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x44, +0x02,0x71,0x10,0x21,0x93,0x90,0xbb,0xd9,0x00,0x00,0x00,0x00,0x2e,0x02,0x00,0x0c, +0x14,0x40,0x00,0x06,0x02,0x00,0x20,0x21,0x00,0x16,0x10,0x40,0x00,0x43,0x10,0x21, +0x00,0x02,0x11,0x00,0x02,0x02,0x10,0x21,0x24,0x44,0x00,0x04,0x02,0x71,0x10,0x21, +0x00,0x02,0x10,0x80,0x27,0x83,0x90,0x00,0x00,0x43,0x10,0x21,0x00,0x80,0x80,0x21, +0xa0,0x44,0x00,0x03,0xa0,0x44,0x00,0x00,0x02,0x00,0x20,0x21,0x02,0xc0,0x28,0x21, +0x0c,0x00,0x08,0xdf,0x02,0xa0,0x30,0x21,0x02,0x71,0x18,0x21,0x00,0x03,0x88,0x80, +0x00,0x40,0xa0,0x21,0x27,0x82,0x90,0x10,0x02,0x22,0x10,0x21,0x8c,0x44,0x00,0x00, +0x26,0xe3,0x00,0x02,0x00,0x03,0x17,0xc2,0x00,0x62,0x18,0x21,0x00,0x04,0x25,0xc2, +0x00,0x03,0x18,0x43,0x30,0x84,0x00,0x01,0x00,0x03,0x18,0x40,0x03,0xc4,0x20,0x24, +0x14,0x80,0x00,0x15,0x02,0x43,0x38,0x21,0x3c,0x08,0xb0,0x03,0x35,0x08,0x00,0x28, +0x8d,0x03,0x00,0x00,0x8f,0xa6,0x00,0x4c,0x8f,0xa4,0x00,0x48,0x27,0x82,0x8f,0xf8, +0x02,0x22,0x10,0x21,0x24,0x63,0x00,0x01,0x02,0xa0,0x28,0x21,0xa4,0x54,0x00,0x04, +0x00,0xc0,0x38,0x21,0x0c,0x00,0x07,0x2b,0xad,0x03,0x00,0x00,0x7b,0xbe,0x02,0x3c, +0x7b,0xb6,0x01,0xfc,0x7b,0xb4,0x01,0xbc,0x7b,0xb2,0x01,0x7c,0x7b,0xb0,0x01,0x3c, +0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x48,0x8f,0xa2,0x00,0x1c,0x8f,0xa6,0x00,0x18, +0x02,0x00,0x20,0x21,0x02,0xc0,0x28,0x21,0xaf,0xa2,0x00,0x10,0x0c,0x00,0x09,0x06, +0xaf,0xa0,0x00,0x14,0x08,0x00,0x09,0xc2,0x02,0x82,0xa0,0x21,0x02,0x71,0x10,0x21, +0x00,0x02,0x10,0x80,0x27,0x83,0x90,0x00,0x00,0x43,0x10,0x21,0x90,0x50,0x00,0x00, +0x08,0x00,0x09,0xae,0xa0,0x50,0x00,0x03,0x27,0xbd,0xff,0xb8,0xaf,0xb1,0x00,0x24, +0x8f,0xb1,0x00,0x5c,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00,0x34,0x63,0x00,0x20, +0x24,0x42,0x27,0x98,0xaf,0xbe,0x00,0x40,0xaf,0xb7,0x00,0x3c,0xaf,0xb6,0x00,0x38, +0xaf,0xb5,0x00,0x34,0xaf,0xb4,0x00,0x30,0xaf,0xa5,0x00,0x4c,0x8f,0xb5,0x00,0x58, +0xaf,0xbf,0x00,0x44,0xaf,0xb3,0x00,0x2c,0xaf,0xb2,0x00,0x28,0xaf,0xb0,0x00,0x20, +0x00,0xe0,0xb0,0x21,0xac,0x62,0x00,0x00,0x00,0x80,0xf0,0x21,0x00,0x00,0xb8,0x21, +0x16,0x20,0x00,0x2b,0x00,0x00,0xa0,0x21,0x27,0x85,0xb3,0xf0,0x00,0x07,0x10,0x80, +0x00,0x45,0x10,0x21,0x8c,0x53,0x00,0x00,0x00,0x15,0x18,0x80,0x00,0x65,0x18,0x21, +0x92,0x62,0x00,0x16,0x8c,0x72,0x00,0x00,0x30,0x42,0x00,0x03,0x14,0x40,0x00,0x2d, +0x00,0x00,0x00,0x00,0x92,0x42,0x00,0x16,0x00,0x00,0x00,0x00,0x30,0x42,0x00,0x03, +0x14,0x40,0x00,0x28,0x00,0x00,0x00,0x00,0x8c,0x82,0x00,0x34,0x00,0x00,0x00,0x00, +0x14,0x40,0x00,0x18,0x02,0x20,0x10,0x21,0x8c,0x82,0x00,0x38,0x00,0x00,0x00,0x00, +0x14,0x40,0x00,0x14,0x02,0x20,0x10,0x21,0x8c,0x82,0x00,0x3c,0x00,0x00,0x00,0x00, +0x14,0x40,0x00,0x0f,0x3c,0x03,0xb0,0x09,0x3c,0x05,0xb0,0x05,0x34,0x63,0x01,0x44, +0x34,0xa5,0x02,0x52,0x94,0x66,0x00,0x00,0x90,0xa2,0x00,0x00,0x8f,0xa3,0x00,0x4c, +0x00,0x00,0x00,0x00,0x00,0x62,0x10,0x06,0x30,0x42,0x00,0x01,0x10,0x40,0x00,0x04, +0x30,0xc6,0xff,0xff,0x2c,0xc2,0x00,0x41,0x10,0x40,0x00,0x09,0x24,0x05,0x00,0x14, +0x02,0x20,0x10,0x21,0x7b,0xbe,0x02,0x3c,0x7b,0xb6,0x01,0xfc,0x7b,0xb4,0x01,0xbc, +0x7b,0xb2,0x01,0x7c,0x7b,0xb0,0x01,0x3c,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x48, +0x0c,0x00,0x07,0x06,0x24,0x06,0x01,0x07,0x24,0x02,0x00,0x01,0x08,0x00,0x0a,0x28, +0xa3,0xc2,0x00,0x11,0x10,0xc0,0x00,0x1c,0x24,0x02,0x00,0x01,0x10,0xc2,0x00,0x17, +0x00,0xc0,0x88,0x21,0x96,0x54,0x00,0x1a,0x02,0xa0,0xb8,0x21,0x12,0x20,0xff,0xed, +0x02,0x20,0x10,0x21,0x27,0x83,0xb3,0xf0,0x00,0x17,0x10,0x80,0x00,0x43,0x10,0x21, +0x8c,0x44,0x00,0x00,0x3c,0x03,0xb0,0x03,0x34,0x63,0x00,0x28,0x80,0x86,0x00,0x12, +0x8c,0x62,0x00,0x00,0x00,0x14,0x2c,0x00,0x00,0x05,0x2c,0x03,0x00,0x46,0x10,0x21, +0x8f,0xa6,0x00,0x4c,0x02,0xe0,0x38,0x21,0x03,0xc0,0x20,0x21,0x0c,0x00,0x07,0x2b, +0xac,0x62,0x00,0x00,0x08,0x00,0x0a,0x28,0xaf,0xd1,0x00,0x40,0x96,0x74,0x00,0x1a, +0x08,0x00,0x0a,0x3b,0x02,0xc0,0xb8,0x21,0x3c,0x02,0xb0,0x03,0x34,0x42,0x01,0x08, +0x8c,0x50,0x00,0x00,0x02,0x60,0x20,0x21,0x0c,0x00,0x1f,0x11,0x02,0x00,0x28,0x21, +0x30,0x42,0x00,0xff,0x02,0x00,0x28,0x21,0x02,0x40,0x20,0x21,0x0c,0x00,0x1f,0x11, +0xaf,0xa2,0x00,0x18,0x8f,0xa4,0x00,0x18,0x00,0x00,0x00,0x00,0x10,0x80,0x00,0xed, +0x30,0x50,0x00,0xff,0x12,0x00,0x00,0x18,0x24,0x11,0x00,0x01,0x96,0x63,0x00,0x14, +0x96,0x44,0x00,0x14,0x27,0x85,0x8f,0xf0,0x00,0x03,0x10,0xc0,0x00,0x43,0x10,0x21, +0x00,0x02,0x10,0x80,0x00,0x45,0x10,0x21,0x00,0x04,0x18,0xc0,0x8c,0x46,0x00,0x08, +0x00,0x64,0x18,0x21,0x00,0x03,0x18,0x80,0x00,0x65,0x18,0x21,0x00,0x06,0x17,0x02, +0x24,0x04,0x00,0xff,0x8c,0x63,0x00,0x08,0x10,0x44,0x00,0xd6,0x00,0x03,0x17,0x02, +0x10,0x44,0x00,0xd5,0x3c,0x02,0x80,0x00,0x00,0x66,0x18,0x2b,0x24,0x11,0x00,0x02, +0x24,0x02,0x00,0x01,0x00,0x43,0x88,0x0a,0x24,0x02,0x00,0x01,0x12,0x22,0x00,0x5a, +0x24,0x02,0x00,0x02,0x16,0x22,0xff,0xbd,0x00,0x00,0x00,0x00,0x96,0x49,0x00,0x14, +0x27,0x82,0x8f,0xf4,0x02,0xa0,0xb8,0x21,0x00,0x09,0x50,0xc0,0x01,0x49,0x18,0x21, +0x00,0x03,0x40,0x80,0x01,0x02,0x10,0x21,0x8c,0x43,0x00,0x18,0x00,0x00,0x00,0x00, +0x8c,0x65,0x00,0x08,0x8c,0x62,0x00,0x0c,0x8c,0x62,0x00,0x04,0x00,0x05,0x24,0x42, +0x00,0x05,0x1c,0x82,0x30,0x42,0x00,0x10,0x30,0x66,0x00,0x01,0x14,0x40,0x00,0x41, +0x30,0x87,0x00,0x01,0x27,0x82,0x90,0x08,0x01,0x02,0x10,0x21,0x80,0x44,0x00,0x00, +0x27,0x82,0xb5,0x68,0x00,0x04,0x19,0x00,0x00,0x64,0x18,0x23,0x00,0x03,0x18,0x80, +0x00,0x64,0x18,0x23,0x00,0x03,0x18,0x80,0x00,0x62,0x10,0x21,0x90,0x45,0x00,0x05, +0x27,0x84,0xb4,0x90,0x00,0x64,0x18,0x21,0x90,0x63,0x00,0x00,0x10,0xa0,0x00,0x2b, +0x2c,0x64,0x00,0x0c,0x14,0x80,0x00,0x04,0x00,0x60,0x10,0x21,0x00,0x06,0x11,0x00, +0x00,0x62,0x10,0x21,0x24,0x42,0x00,0x24,0x3c,0x01,0xb0,0x03,0xa0,0x22,0x00,0xb9, +0x14,0x80,0x00,0x06,0x00,0x60,0x28,0x21,0x00,0x07,0x10,0x40,0x00,0x46,0x10,0x21, +0x00,0x02,0x11,0x00,0x00,0x62,0x10,0x21,0x24,0x45,0x00,0x04,0x01,0x49,0x10,0x21, +0x27,0x83,0x90,0x00,0x00,0x02,0x10,0x80,0x00,0x43,0x10,0x21,0x00,0xa0,0x18,0x21, +0xa0,0x45,0x00,0x03,0xa0,0x45,0x00,0x00,0x24,0x02,0x00,0x08,0x12,0x02,0x00,0x0b, +0x24,0x02,0x00,0x01,0x00,0x60,0x28,0x21,0x02,0x40,0x20,0x21,0x0c,0x00,0x1f,0x8d, +0xaf,0xa2,0x00,0x10,0x30,0x54,0xff,0xff,0x92,0x42,0x00,0x16,0x00,0x00,0x00,0x00, +0x02,0x02,0x10,0x25,0x08,0x00,0x0a,0x3b,0xa2,0x42,0x00,0x16,0x00,0x60,0x28,0x21, +0x02,0x40,0x20,0x21,0x0c,0x00,0x1f,0x3e,0xaf,0xa0,0x00,0x10,0x08,0x00,0x0a,0xbe, +0x30,0x54,0xff,0xff,0x08,0x00,0x0a,0xa6,0x00,0x60,0x10,0x21,0x14,0x80,0xff,0xfd, +0x00,0x00,0x00,0x00,0x00,0x06,0x11,0x00,0x00,0x62,0x10,0x21,0x08,0x00,0x0a,0xa6, +0x24,0x42,0x00,0x04,0x27,0x82,0x90,0x00,0x01,0x02,0x10,0x21,0x90,0x43,0x00,0x00, +0x08,0x00,0x0a,0xb6,0xa0,0x43,0x00,0x03,0x96,0x69,0x00,0x14,0x02,0xc0,0xb8,0x21, +0x24,0x0b,0x00,0x01,0x00,0x09,0x10,0xc0,0x00,0x49,0x18,0x21,0x00,0x03,0x40,0x80, +0x00,0x40,0x50,0x21,0x27,0x82,0x8f,0xf4,0x01,0x02,0x10,0x21,0x8c,0x43,0x00,0x18, +0x00,0x00,0x00,0x00,0x8c,0x65,0x00,0x08,0x8c,0x62,0x00,0x0c,0x8c,0x62,0x00,0x04, +0x00,0x05,0x24,0x42,0x00,0x05,0x1c,0x82,0x30,0x42,0x00,0x10,0x30,0x66,0x00,0x01, +0x10,0x40,0x00,0x0d,0x30,0x87,0x00,0x01,0x27,0x82,0x90,0x08,0x01,0x02,0x10,0x21, +0x80,0x43,0x00,0x00,0x00,0x00,0x58,0x21,0x00,0x03,0x11,0x00,0x00,0x43,0x10,0x23, +0x00,0x02,0x10,0x80,0x00,0x43,0x10,0x23,0x00,0x02,0x10,0x80,0x27,0x83,0xb5,0x60, +0x00,0x43,0x10,0x21,0xa0,0x40,0x00,0x04,0x11,0x60,0x00,0x4f,0x00,0x00,0x00,0x00, +0x01,0x49,0x10,0x21,0x00,0x02,0x20,0x80,0x27,0x85,0x90,0x00,0x00,0x85,0x10,0x21, +0x80,0x43,0x00,0x05,0x00,0x00,0x00,0x00,0x14,0x60,0x00,0x42,0x01,0x49,0x10,0x21, +0x27,0x82,0x90,0x08,0x00,0x82,0x10,0x21,0x80,0x44,0x00,0x00,0x27,0x82,0xb5,0x68, +0x00,0x04,0x19,0x00,0x00,0x64,0x18,0x23,0x00,0x03,0x18,0x80,0x00,0x64,0x18,0x23, +0x00,0x03,0x18,0x80,0x00,0x62,0x10,0x21,0x90,0x45,0x00,0x05,0x27,0x84,0xb4,0x90, +0x00,0x64,0x18,0x21,0x90,0x63,0x00,0x00,0x10,0xa0,0x00,0x2c,0x2c,0x64,0x00,0x0c, +0x14,0x80,0x00,0x04,0x00,0x60,0x10,0x21,0x00,0x06,0x11,0x00,0x00,0x62,0x10,0x21, +0x24,0x42,0x00,0x24,0x3c,0x01,0xb0,0x03,0xa0,0x22,0x00,0xb9,0x14,0x80,0x00,0x06, +0x00,0x60,0x28,0x21,0x00,0x07,0x10,0x40,0x00,0x46,0x10,0x21,0x00,0x02,0x11,0x00, +0x00,0x62,0x10,0x21,0x24,0x45,0x00,0x04,0x01,0x49,0x10,0x21,0x27,0x83,0x90,0x00, +0x00,0x02,0x10,0x80,0x00,0x43,0x10,0x21,0x00,0xa0,0x18,0x21,0xa0,0x45,0x00,0x03, +0xa0,0x45,0x00,0x00,0x8f,0xa4,0x00,0x18,0x24,0x02,0x00,0x08,0x10,0x82,0x00,0x0c, +0x00,0x60,0x28,0x21,0x24,0x02,0x00,0x01,0x02,0x60,0x20,0x21,0x0c,0x00,0x1f,0x8d, +0xaf,0xa2,0x00,0x10,0x8f,0xa3,0x00,0x18,0x30,0x54,0xff,0xff,0x92,0x62,0x00,0x16, +0x00,0x00,0x00,0x00,0x00,0x62,0x10,0x25,0x08,0x00,0x0a,0x3b,0xa2,0x62,0x00,0x16, +0x02,0x60,0x20,0x21,0x0c,0x00,0x1f,0x3e,0xaf,0xa0,0x00,0x10,0x08,0x00,0x0b,0x2d, +0x00,0x00,0x00,0x00,0x08,0x00,0x0b,0x15,0x00,0x60,0x10,0x21,0x14,0x80,0xff,0xfd, +0x00,0x00,0x00,0x00,0x00,0x06,0x11,0x00,0x00,0x62,0x10,0x21,0x08,0x00,0x0b,0x15, +0x24,0x42,0x00,0x04,0x00,0x02,0x10,0x80,0x00,0x45,0x10,0x21,0x90,0x43,0x00,0x00, +0x08,0x00,0x0b,0x25,0xa0,0x43,0x00,0x03,0x27,0x85,0x90,0x00,0x08,0x00,0x0b,0x41, +0x01,0x49,0x10,0x21,0x3c,0x02,0x80,0x00,0x00,0x62,0x18,0x26,0x08,0x00,0x0a,0x76, +0x00,0xc2,0x30,0x26,0x12,0x00,0xff,0x2d,0x24,0x02,0x00,0x01,0x08,0x00,0x0a,0x7b, +0x24,0x11,0x00,0x02,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00,0x27,0xbd,0xff,0xd0, +0x24,0x42,0x2d,0x44,0x34,0x63,0x00,0x20,0x3c,0x05,0xb0,0x05,0xaf,0xb3,0x00,0x24, +0xaf,0xb2,0x00,0x20,0xaf,0xb1,0x00,0x1c,0xaf,0xbf,0x00,0x28,0xaf,0xb0,0x00,0x18, +0xac,0x62,0x00,0x00,0x34,0xa5,0x02,0x42,0x90,0xa2,0x00,0x00,0x00,0x80,0x90,0x21, +0x24,0x11,0x00,0x10,0x30,0x53,0x00,0xff,0x24,0x02,0x00,0x10,0x12,0x22,0x00,0xcf, +0x00,0x00,0x18,0x21,0x24,0x02,0x00,0x11,0x12,0x22,0x00,0xc1,0x24,0x02,0x00,0x12, +0x12,0x22,0x00,0xb4,0x00,0x00,0x00,0x00,0x14,0x60,0x00,0xad,0xae,0x43,0x00,0x40, +0x3c,0x02,0xb0,0x05,0x34,0x42,0x02,0x2c,0x8c,0x44,0x00,0x00,0x3c,0x03,0x00,0x02, +0x34,0x63,0x00,0xff,0x00,0x83,0x80,0x24,0x00,0x10,0x14,0x43,0x10,0x40,0x00,0x05, +0x00,0x00,0x00,0x00,0x8e,0x42,0x00,0x34,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x92, +0x00,0x00,0x00,0x00,0x93,0x83,0x8b,0x61,0x00,0x00,0x00,0x00,0x30,0x62,0x00,0x02, +0x10,0x40,0x00,0x04,0x32,0x10,0x00,0xff,0x00,0x10,0x11,0xc3,0x14,0x40,0x00,0x86, +0x00,0x00,0x00,0x00,0x16,0x00,0x00,0x15,0x02,0x00,0x10,0x21,0x26,0x22,0x00,0x01, +0x30,0x51,0x00,0xff,0x2e,0x23,0x00,0x13,0x14,0x60,0xff,0xdb,0x24,0x03,0x00,0x02, +0x12,0x63,0x00,0x73,0x24,0x02,0x00,0x05,0x2a,0x62,0x00,0x03,0x10,0x40,0x00,0x58, +0x24,0x02,0x00,0x04,0x24,0x02,0x00,0x01,0x12,0x62,0x00,0x4b,0x02,0x40,0x20,0x21, +0x3c,0x02,0xb0,0x05,0x34,0x42,0x02,0x2c,0x8c,0x43,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x70,0x00,0xff,0x12,0x00,0x00,0x06,0x02,0x00,0x10,0x21,0x8f,0xbf,0x00,0x28, +0x7b,0xb2,0x01,0x3c,0x7b,0xb0,0x00,0xfc,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x30, +0x92,0x46,0x00,0x04,0x8e,0x43,0x00,0x24,0x24,0x02,0x00,0x07,0x02,0x40,0x20,0x21, +0x00,0x00,0x28,0x21,0x24,0x07,0x00,0x06,0xaf,0xa2,0x00,0x10,0x0c,0x00,0x09,0xe6, +0xaf,0xa3,0x00,0x14,0xae,0x42,0x00,0x24,0x3c,0x02,0xb0,0x05,0x8c,0x42,0x02,0x2c, +0x00,0x00,0x00,0x00,0x30,0x50,0x00,0xff,0x16,0x00,0xff,0xec,0x02,0x00,0x10,0x21, +0x92,0x46,0x00,0x05,0x8e,0x43,0x00,0x28,0x24,0x02,0x00,0x05,0x02,0x40,0x20,0x21, +0x24,0x05,0x00,0x01,0x24,0x07,0x00,0x04,0xaf,0xa2,0x00,0x10,0x0c,0x00,0x09,0xe6, +0xaf,0xa3,0x00,0x14,0xae,0x42,0x00,0x28,0x3c,0x02,0xb0,0x05,0x8c,0x42,0x02,0x2c, +0x00,0x00,0x00,0x00,0x30,0x50,0x00,0xff,0x16,0x00,0xff,0xdc,0x02,0x00,0x10,0x21, +0x92,0x46,0x00,0x06,0x8e,0x43,0x00,0x2c,0x24,0x02,0x00,0x03,0x02,0x40,0x20,0x21, +0x24,0x05,0x00,0x02,0x00,0x00,0x38,0x21,0xaf,0xa2,0x00,0x10,0x0c,0x00,0x09,0xe6, +0xaf,0xa3,0x00,0x14,0xae,0x42,0x00,0x2c,0x3c,0x02,0xb0,0x05,0x8c,0x42,0x02,0x2c, +0x00,0x00,0x00,0x00,0x30,0x50,0x00,0xff,0x16,0x00,0xff,0xcc,0x02,0x00,0x10,0x21, +0x92,0x46,0x00,0x07,0x8e,0x43,0x00,0x30,0x24,0x02,0x00,0x02,0x02,0x40,0x20,0x21, +0x24,0x05,0x00,0x03,0x24,0x07,0x00,0x01,0xaf,0xa2,0x00,0x10,0x0c,0x00,0x09,0xe6, +0xaf,0xa3,0x00,0x14,0xae,0x42,0x00,0x30,0x3c,0x02,0xb0,0x05,0x8c,0x42,0x02,0x2c, +0x08,0x00,0x0b,0x97,0x30,0x42,0x00,0xff,0x92,0x46,0x00,0x04,0x8e,0x43,0x00,0x24, +0x24,0x02,0x00,0x07,0x00,0x00,0x28,0x21,0x24,0x07,0x00,0x06,0xaf,0xa2,0x00,0x10, +0x0c,0x00,0x09,0xe6,0xaf,0xa3,0x00,0x14,0x08,0x00,0x0b,0x90,0xae,0x42,0x00,0x24, +0x12,0x62,0x00,0x0d,0x24,0x02,0x00,0x03,0x24,0x02,0x00,0x08,0x16,0x62,0xff,0xa8, +0x02,0x40,0x20,0x21,0x92,0x46,0x00,0x07,0x8e,0x42,0x00,0x30,0x24,0x05,0x00,0x03, +0x24,0x07,0x00,0x01,0xaf,0xa3,0x00,0x10,0x0c,0x00,0x09,0xe6,0xaf,0xa2,0x00,0x14, +0x08,0x00,0x0b,0x90,0xae,0x42,0x00,0x30,0x92,0x46,0x00,0x06,0x8e,0x43,0x00,0x2c, +0x02,0x40,0x20,0x21,0x24,0x05,0x00,0x02,0x00,0x00,0x38,0x21,0xaf,0xa2,0x00,0x10, +0x0c,0x00,0x09,0xe6,0xaf,0xa3,0x00,0x14,0x08,0x00,0x0b,0x90,0xae,0x42,0x00,0x2c, +0x92,0x46,0x00,0x05,0x8e,0x43,0x00,0x28,0x02,0x40,0x20,0x21,0x24,0x05,0x00,0x01, +0x24,0x07,0x00,0x04,0xaf,0xa2,0x00,0x10,0x0c,0x00,0x09,0xe6,0xaf,0xa3,0x00,0x14, +0x08,0x00,0x0b,0x90,0xae,0x42,0x00,0x28,0x0c,0x00,0x01,0x59,0x24,0x04,0x00,0x01, +0x08,0x00,0x0b,0x81,0x00,0x00,0x00,0x00,0x8f,0x84,0xb4,0x30,0xae,0x40,0x00,0x34, +0x94,0x85,0x00,0x14,0x0c,0x00,0x1b,0x84,0x00,0x00,0x00,0x00,0x93,0x83,0x8b,0x61, +0x00,0x00,0x00,0x00,0x30,0x62,0x00,0x02,0x10,0x40,0xff,0x69,0x00,0x00,0x00,0x00, +0x0c,0x00,0x01,0x59,0x00,0x00,0x20,0x21,0x08,0x00,0x0b,0x79,0x00,0x00,0x00,0x00, +0x02,0x40,0x20,0x21,0x0c,0x00,0x09,0x5d,0x02,0x20,0x28,0x21,0x08,0x00,0x0b,0x6d, +0x3c,0x02,0xb0,0x05,0x8e,0x42,0x00,0x3c,0x00,0x00,0x00,0x00,0x14,0x40,0xff,0x4a, +0x00,0x00,0x00,0x00,0x8f,0x82,0xb4,0x38,0x00,0x00,0x00,0x00,0x90,0x42,0x00,0x0a, +0x00,0x00,0x00,0x00,0x00,0x02,0x18,0x2b,0x08,0x00,0x0b,0x6a,0xae,0x43,0x00,0x3c, +0x8e,0x42,0x00,0x38,0x00,0x00,0x00,0x00,0x14,0x40,0xff,0x3d,0x24,0x02,0x00,0x12, +0x8f,0x82,0xb4,0x34,0x00,0x00,0x00,0x00,0x90,0x42,0x00,0x0a,0x00,0x00,0x00,0x00, +0x00,0x02,0x18,0x2b,0x08,0x00,0x0b,0x6a,0xae,0x43,0x00,0x38,0x8e,0x42,0x00,0x34, +0x00,0x00,0x00,0x00,0x14,0x40,0xff,0x30,0x24,0x02,0x00,0x11,0x8f,0x82,0xb4,0x30, +0x00,0x00,0x00,0x00,0x90,0x42,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x02,0x18,0x2b, +0x08,0x00,0x0b,0x6a,0xae,0x43,0x00,0x34,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00, +0x27,0xbd,0xff,0xe0,0x34,0x63,0x00,0x20,0x24,0x42,0x30,0xf8,0x3c,0x08,0xb0,0x03, +0xaf,0xb1,0x00,0x14,0xac,0x62,0x00,0x00,0x35,0x08,0x01,0x00,0xaf,0xbf,0x00,0x18, +0xaf,0xb0,0x00,0x10,0x91,0x03,0x00,0x00,0x00,0xa0,0x48,0x21,0x24,0x11,0x00,0x0a, +0x2c,0xa5,0x00,0x04,0x24,0x02,0x00,0x10,0x00,0x45,0x88,0x0a,0x30,0x63,0x00,0x01, +0x00,0xc0,0x28,0x21,0x14,0x60,0x00,0x02,0x00,0x11,0x40,0x40,0x02,0x20,0x40,0x21, +0x84,0x83,0x00,0x0c,0x31,0x11,0x00,0xff,0x01,0x20,0x20,0x21,0x00,0x03,0x10,0xc0, +0x00,0x43,0x10,0x21,0x00,0x02,0x10,0x80,0x27,0x83,0x8f,0xf8,0x00,0x43,0x10,0x21, +0x84,0x43,0x00,0x04,0x24,0x06,0x00,0x0e,0x10,0xe0,0x00,0x06,0x02,0x23,0x80,0x21, +0x02,0x00,0x10,0x21,0x8f,0xbf,0x00,0x18,0x7b,0xb0,0x00,0xbc,0x03,0xe0,0x00,0x08, +0x27,0xbd,0x00,0x20,0x0c,0x00,0x08,0xdf,0x00,0x00,0x00,0x00,0x02,0x11,0x18,0x21, +0x08,0x00,0x0c,0x60,0x00,0x62,0x80,0x21,0x27,0xbd,0xff,0xd0,0xaf,0xbf,0x00,0x28, +0xaf,0xb4,0x00,0x20,0xaf,0xb3,0x00,0x1c,0xaf,0xb2,0x00,0x18,0xaf,0xb5,0x00,0x24, +0xaf,0xb1,0x00,0x14,0xaf,0xb0,0x00,0x10,0x84,0x82,0x00,0x0c,0x3c,0x06,0xb0,0x03, +0x34,0xc6,0x00,0x20,0x00,0x02,0x18,0xc0,0x00,0x62,0x18,0x21,0x00,0x03,0x18,0x80, +0x27,0x82,0x8f,0xf4,0x00,0x62,0x10,0x21,0x8c,0x55,0x00,0x18,0x3c,0x02,0x80,0x00, +0x24,0x42,0x31,0xa8,0xac,0xc2,0x00,0x00,0x8e,0xb0,0x00,0x08,0x27,0x82,0x8f,0xf8, +0x00,0x62,0x18,0x21,0x90,0x71,0x00,0x07,0x00,0x10,0x86,0x43,0x32,0x10,0x00,0x01, +0x00,0xa0,0x38,0x21,0x02,0x00,0x30,0x21,0x00,0xa0,0x98,0x21,0x02,0x20,0x28,0x21, +0x0c,0x00,0x0c,0x3e,0x00,0x80,0x90,0x21,0x02,0x20,0x20,0x21,0x02,0x00,0x28,0x21, +0x24,0x06,0x00,0x14,0x0c,0x00,0x08,0xdf,0x00,0x40,0xa0,0x21,0x86,0x43,0x00,0x0c, +0x3c,0x09,0xb0,0x09,0x3c,0x08,0xb0,0x09,0x00,0x03,0x10,0xc0,0x00,0x43,0x10,0x21, +0x00,0x02,0x10,0x80,0x27,0x83,0x90,0x00,0x00,0x43,0x10,0x21,0x80,0x43,0x00,0x06, +0x3c,0x07,0xb0,0x09,0x3c,0x05,0xb0,0x09,0x28,0x62,0x00,0x00,0x24,0x64,0x00,0x03, +0x00,0x82,0x18,0x0b,0x00,0x03,0x18,0x83,0x3c,0x02,0xb0,0x09,0x00,0x03,0x18,0x80, +0x34,0x42,0x01,0x02,0x35,0x29,0x01,0x10,0x35,0x08,0x01,0x14,0x34,0xe7,0x01,0x20, +0x34,0xa5,0x01,0x24,0xa4,0x54,0x00,0x00,0x12,0x60,0x00,0x11,0x02,0xa3,0xa8,0x21, +0x8e,0xa2,0x00,0x0c,0x8e,0xa3,0x00,0x08,0x00,0x02,0x14,0x00,0x00,0x03,0x1c,0x02, +0x00,0x43,0x10,0x21,0xad,0x22,0x00,0x00,0x8e,0xa3,0x00,0x0c,0x00,0x00,0x00,0x00, +0x00,0x03,0x1c,0x02,0xa5,0x03,0x00,0x00,0x8f,0xbf,0x00,0x28,0x7b,0xb4,0x01,0x3c, +0x7b,0xb2,0x00,0xfc,0x7b,0xb0,0x00,0xbc,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x30, +0x8e,0xa2,0x00,0x04,0x00,0x00,0x00,0x00,0xad,0x22,0x00,0x00,0x8e,0xa4,0x00,0x08, +0x00,0x00,0x00,0x00,0xa5,0x04,0x00,0x00,0x7a,0xa2,0x00,0x7c,0x00,0x00,0x00,0x00, +0x00,0x03,0x1c,0x00,0x00,0x02,0x14,0x02,0x00,0x62,0x18,0x21,0xac,0xe3,0x00,0x00, +0x8e,0xa2,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x02,0x14,0x02,0x08,0x00,0x0c,0xb2, +0xa4,0xa2,0x00,0x00,0x27,0xbd,0xff,0xe0,0xaf,0xb2,0x00,0x18,0xaf,0xb0,0x00,0x10, +0xaf,0xbf,0x00,0x1c,0xaf,0xb1,0x00,0x14,0x84,0x82,0x00,0x0c,0x00,0x80,0x90,0x21, +0x3c,0x05,0xb0,0x03,0x00,0x02,0x20,0xc0,0x00,0x82,0x20,0x21,0x00,0x04,0x20,0x80, +0x27,0x82,0x8f,0xf4,0x00,0x82,0x10,0x21,0x8c,0x51,0x00,0x18,0x3c,0x02,0x80,0x00, +0x34,0xa5,0x00,0x20,0x24,0x42,0x33,0x24,0x27,0x83,0x8f,0xf8,0xac,0xa2,0x00,0x00, +0x00,0x83,0x20,0x21,0x3c,0x02,0xb0,0x03,0x90,0x86,0x00,0x07,0x34,0x42,0x01,0x00, +0x8e,0x23,0x00,0x08,0x90,0x44,0x00,0x00,0x2c,0xc5,0x00,0x04,0x24,0x02,0x00,0x10, +0x24,0x10,0x00,0x0a,0x00,0x45,0x80,0x0a,0x00,0x03,0x1e,0x43,0x30,0x84,0x00,0x01, +0x30,0x65,0x00,0x01,0x14,0x80,0x00,0x02,0x00,0x10,0x10,0x40,0x02,0x00,0x10,0x21, +0x00,0xc0,0x20,0x21,0x24,0x06,0x00,0x20,0x0c,0x00,0x08,0xdf,0x30,0x50,0x00,0xff, +0x86,0x44,0x00,0x0c,0x27,0x85,0x90,0x00,0x3c,0x06,0xb0,0x09,0x00,0x04,0x18,0xc0, +0x00,0x64,0x18,0x21,0x00,0x03,0x18,0x80,0x00,0x65,0x18,0x21,0x80,0x64,0x00,0x06, +0x00,0x50,0x10,0x21,0x34,0xc6,0x01,0x02,0x24,0x85,0x00,0x03,0x28,0x83,0x00,0x00, +0x00,0xa3,0x20,0x0b,0x00,0x04,0x20,0x83,0x00,0x04,0x20,0x80,0xa4,0xc2,0x00,0x00, +0x02,0x24,0x20,0x21,0x8c,0x83,0x00,0x04,0x3c,0x02,0xb0,0x09,0x34,0x42,0x01,0x10, +0xac,0x43,0x00,0x00,0x8c,0x86,0x00,0x08,0x3c,0x02,0xb0,0x09,0x34,0x42,0x01,0x14, +0xa4,0x46,0x00,0x00,0x8c,0x85,0x00,0x0c,0x8c,0x82,0x00,0x08,0x3c,0x06,0xb0,0x09, +0x00,0x05,0x2c,0x00,0x00,0x02,0x14,0x02,0x00,0xa2,0x28,0x21,0x34,0xc6,0x01,0x20, +0xac,0xc5,0x00,0x00,0x8c,0x83,0x00,0x0c,0x3c,0x05,0xb0,0x09,0x34,0xa5,0x01,0x24, +0x00,0x03,0x1c,0x02,0xa4,0xa3,0x00,0x00,0x92,0x42,0x00,0x0a,0x3c,0x03,0xb0,0x09, +0x34,0x63,0x01,0x30,0x00,0x02,0x13,0x00,0x24,0x42,0x00,0x04,0x30,0x42,0xff,0xff, +0xa4,0x62,0x00,0x00,0x86,0x44,0x00,0x0c,0x27,0x83,0x90,0x08,0x8f,0xbf,0x00,0x1c, +0x00,0x04,0x10,0xc0,0x00,0x44,0x10,0x21,0x00,0x02,0x10,0x80,0x00,0x43,0x10,0x21, +0x94,0x44,0x00,0x02,0x8f,0xb2,0x00,0x18,0x7b,0xb0,0x00,0xbc,0x3c,0x05,0xb0,0x09, +0x34,0xa5,0x01,0x32,0xa4,0xa4,0x00,0x00,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x20, +0x27,0xbd,0xff,0xe0,0x3c,0x02,0xb0,0x03,0x3c,0x03,0x80,0x00,0xaf,0xb0,0x00,0x10, +0x34,0x42,0x00,0x20,0x00,0xa0,0x80,0x21,0x24,0x63,0x34,0xb0,0x00,0x05,0x2c,0x43, +0xaf,0xb1,0x00,0x14,0xaf,0xbf,0x00,0x18,0xac,0x43,0x00,0x00,0x10,0xa0,0x00,0x05, +0x00,0x80,0x88,0x21,0x8c,0x82,0x00,0x34,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0xb6, +0x00,0x00,0x00,0x00,0x32,0x10,0x00,0xff,0x12,0x00,0x00,0x4c,0x00,0x00,0x10,0x21, +0x24,0x02,0x00,0x08,0x12,0x02,0x00,0xa3,0x2a,0x02,0x00,0x09,0x10,0x40,0x00,0x89, +0x24,0x02,0x00,0x40,0x24,0x04,0x00,0x02,0x12,0x04,0x00,0x79,0x2a,0x02,0x00,0x03, +0x10,0x40,0x00,0x69,0x24,0x02,0x00,0x04,0x24,0x02,0x00,0x01,0x12,0x02,0x00,0x5a, +0x00,0x00,0x00,0x00,0x3c,0x02,0xb0,0x05,0x34,0x42,0x00,0x08,0x3c,0x03,0x80,0x00, +0xa2,0x20,0x00,0x4e,0xac,0x43,0x00,0x00,0x82,0x24,0x00,0x11,0x92,0x27,0x00,0x11, +0x10,0x80,0x00,0x4e,0x00,0x00,0x00,0x00,0x92,0x26,0x00,0x0a,0x24,0x02,0x00,0x12, +0x10,0x46,0x00,0x09,0x30,0xc2,0x00,0xff,0x27,0x83,0xb3,0xf0,0x00,0x02,0x10,0x80, +0x00,0x43,0x10,0x21,0x8c,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x94,0x83,0x00,0x14, +0x00,0x00,0x00,0x00,0xa6,0x23,0x00,0x0c,0x3c,0x02,0xb0,0x09,0x34,0x42,0x00,0x40, +0x90,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x63,0x00,0x03,0xa2,0x23,0x00,0x10, +0x14,0x60,0x00,0x2b,0x30,0x65,0x00,0x01,0x30,0xc2,0x00,0xff,0x27,0x83,0xb3,0xf0, +0x00,0x02,0x10,0x80,0x00,0x43,0x10,0x21,0x8c,0x44,0x00,0x00,0x82,0x23,0x00,0x12, +0x90,0x82,0x00,0x16,0x00,0x00,0x00,0x00,0x00,0x02,0x11,0x42,0x30,0x42,0x00,0x01, +0x00,0x62,0x18,0x21,0x00,0x03,0x26,0x00,0x14,0x80,0x00,0x18,0xa2,0x23,0x00,0x12, +0x00,0x07,0x16,0x00,0x14,0x40,0x00,0x11,0x24,0x02,0x00,0x01,0x96,0x23,0x00,0x0c, +0x27,0x84,0x90,0x00,0x00,0x03,0x10,0xc0,0x00,0x43,0x10,0x21,0x00,0x02,0x10,0x80, +0x00,0x44,0x10,0x21,0x80,0x45,0x00,0x06,0x00,0x03,0x1a,0x00,0x3c,0x02,0xb0,0x00, +0x00,0x65,0x18,0x21,0x00,0x62,0x18,0x21,0x90,0x64,0x00,0x00,0x90,0x62,0x00,0x04, +0xa2,0x20,0x00,0x15,0xa3,0x80,0x8b,0xc4,0x24,0x02,0x00,0x01,0x8f,0xbf,0x00,0x18, +0x7b,0xb0,0x00,0xbc,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x20,0x0c,0x00,0x0c,0xc9, +0x02,0x20,0x20,0x21,0x92,0x27,0x00,0x11,0x08,0x00,0x0d,0x79,0x00,0x07,0x16,0x00, +0x0c,0x00,0x0c,0x6a,0x02,0x20,0x20,0x21,0x86,0x23,0x00,0x0c,0x27,0x84,0x8f,0xf8, +0x00,0x03,0x10,0xc0,0x00,0x43,0x10,0x21,0x00,0x02,0x10,0x80,0x00,0x44,0x20,0x21, +0x90,0x85,0x00,0x07,0x27,0x83,0x90,0x00,0x00,0x43,0x10,0x21,0xa2,0x25,0x00,0x13, +0x90,0x83,0x00,0x07,0x08,0x00,0x0d,0x91,0xa0,0x43,0x00,0x02,0x92,0x26,0x00,0x0a, +0x08,0x00,0x0d,0x5a,0x30,0xc2,0x00,0xff,0x8e,0x22,0x00,0x24,0x00,0x00,0x00,0x00, +0x10,0x50,0x00,0x07,0xa2,0x20,0x00,0x08,0x24,0x02,0x00,0x07,0xa2,0x22,0x00,0x0a, +0x92,0x22,0x00,0x27,0xae,0x20,0x00,0x24,0x08,0x00,0x0d,0x4d,0xa2,0x22,0x00,0x04, +0x08,0x00,0x0d,0xab,0x24,0x02,0x00,0x06,0x16,0x02,0xff,0x9b,0x3c,0x02,0xb0,0x05, +0x8e,0x23,0x00,0x2c,0x24,0x02,0x00,0x01,0x10,0x62,0x00,0x07,0xa2,0x24,0x00,0x08, +0x24,0x02,0x00,0x03,0xa2,0x22,0x00,0x0a,0x92,0x22,0x00,0x2f,0xae,0x20,0x00,0x2c, +0x08,0x00,0x0d,0x4d,0xa2,0x22,0x00,0x06,0x08,0x00,0x0d,0xba,0xa2,0x20,0x00,0x0a, +0x8e,0x22,0x00,0x28,0x24,0x03,0x00,0x01,0x24,0x04,0x00,0x01,0x10,0x44,0x00,0x07, +0xa2,0x23,0x00,0x08,0x24,0x02,0x00,0x05,0xa2,0x22,0x00,0x0a,0x92,0x22,0x00,0x2b, +0xae,0x20,0x00,0x28,0x08,0x00,0x0d,0x4d,0xa2,0x22,0x00,0x05,0x08,0x00,0x0d,0xc6, +0x24,0x02,0x00,0x04,0x12,0x02,0x00,0x12,0x2a,0x02,0x00,0x41,0x10,0x40,0x00,0x09, +0x24,0x02,0x00,0x80,0x24,0x02,0x00,0x20,0x16,0x02,0xff,0x7b,0x3c,0x02,0xb0,0x05, +0x24,0x02,0x00,0x12,0xa2,0x22,0x00,0x0a,0xa2,0x22,0x00,0x08,0x08,0x00,0x0d,0x4d, +0xae,0x20,0x00,0x3c,0x16,0x02,0xff,0x74,0x3c,0x02,0xb0,0x05,0x24,0x02,0x00,0x10, +0xa2,0x22,0x00,0x0a,0xa2,0x22,0x00,0x08,0x08,0x00,0x0d,0x4d,0xae,0x20,0x00,0x34, +0x24,0x02,0x00,0x11,0xa2,0x22,0x00,0x0a,0xa2,0x22,0x00,0x08,0x08,0x00,0x0d,0x4d, +0xae,0x20,0x00,0x38,0x8e,0x24,0x00,0x30,0x24,0x02,0x00,0x03,0x24,0x03,0x00,0x01, +0x10,0x83,0x00,0x07,0xa2,0x22,0x00,0x08,0x24,0x02,0x00,0x02,0xa2,0x22,0x00,0x0a, +0x92,0x22,0x00,0x33,0xae,0x20,0x00,0x30,0x08,0x00,0x0d,0x4d,0xa2,0x22,0x00,0x07, +0x08,0x00,0x0d,0xec,0xa2,0x24,0x00,0x0a,0x8f,0x84,0xb4,0x30,0xae,0x20,0x00,0x34, +0x94,0x85,0x00,0x14,0x0c,0x00,0x1b,0x84,0x32,0x10,0x00,0xff,0x08,0x00,0x0d,0x3e, +0x00,0x00,0x00,0x00,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00,0x24,0x42,0x37,0xe4, +0x34,0x63,0x00,0x20,0xac,0x62,0x00,0x00,0x80,0xa2,0x00,0x15,0x3c,0x06,0xb0,0x05, +0x10,0x40,0x00,0x0a,0x34,0xc6,0x02,0x54,0x83,0x83,0x8b,0xc4,0x00,0x00,0x00,0x00, +0xac,0x83,0x00,0x24,0x8c,0xc2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x17,0x42, +0x30,0x42,0x00,0x01,0x03,0xe0,0x00,0x08,0xac,0x82,0x00,0x28,0x8c,0x82,0x00,0x2c, +0x3c,0x06,0xb0,0x05,0x34,0xc6,0x04,0x50,0x00,0x02,0x18,0x43,0x30,0x63,0x00,0x01, +0x10,0x40,0x00,0x04,0x30,0x45,0x00,0x01,0xac,0x83,0x00,0x28,0x03,0xe0,0x00,0x08, +0xac,0x85,0x00,0x24,0x90,0xc2,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x42,0x00,0xff, +0x30,0x43,0x00,0x02,0x30,0x42,0x00,0x01,0xac,0x83,0x00,0x28,0x03,0xe0,0x00,0x08, +0xac,0x82,0x00,0x24,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00,0x27,0xbd,0xff,0xd8, +0x34,0x63,0x00,0x20,0x24,0x42,0x38,0x74,0xac,0x62,0x00,0x00,0xaf,0xb1,0x00,0x1c, +0xaf,0xbf,0x00,0x20,0xaf,0xb0,0x00,0x18,0x90,0xa6,0x00,0x0a,0x27,0x83,0xb3,0xf0, +0x00,0xa0,0x88,0x21,0x00,0x06,0x10,0x80,0x00,0x43,0x10,0x21,0x8c,0x50,0x00,0x00, +0x80,0xa5,0x00,0x11,0x92,0x03,0x00,0x12,0x10,0xa0,0x00,0x04,0xa2,0x20,0x00,0x15, +0x24,0x02,0x00,0x12,0x10,0xc2,0x00,0xda,0x00,0x00,0x00,0x00,0x82,0x22,0x00,0x12, +0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x67,0x00,0x00,0x00,0x00,0xa2,0x20,0x00,0x12, +0xa2,0x00,0x00,0x19,0x86,0x23,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x03,0x10,0xc0, +0x00,0x43,0x10,0x21,0x00,0x02,0x10,0x80,0x27,0x83,0x90,0x10,0x00,0x43,0x10,0x21, +0xa0,0x40,0x00,0x00,0x92,0x03,0x00,0x16,0x00,0x00,0x00,0x00,0x30,0x63,0x00,0xdf, +0xa2,0x03,0x00,0x16,0x82,0x02,0x00,0x12,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x20, +0x00,0x00,0x00,0x00,0x92,0x23,0x00,0x08,0x00,0x00,0x00,0x00,0x14,0x60,0x00,0x45, +0x24,0x02,0x00,0x01,0xa2,0x20,0x00,0x04,0x92,0x08,0x00,0x04,0x00,0x00,0x00,0x00, +0x15,0x00,0x00,0x1e,0x24,0x02,0x00,0x01,0x92,0x07,0x00,0x0a,0xa2,0x02,0x00,0x17, +0x92,0x02,0x00,0x16,0x30,0xe3,0x00,0xff,0x30,0x42,0x00,0xe4,0x10,0x60,0x00,0x03, +0xa2,0x02,0x00,0x16,0x34,0x42,0x00,0x01,0xa2,0x02,0x00,0x16,0x11,0x00,0x00,0x05, +0x00,0x00,0x00,0x00,0x92,0x02,0x00,0x16,0x00,0x00,0x00,0x00,0x34,0x42,0x00,0x02, +0xa2,0x02,0x00,0x16,0x92,0x02,0x00,0x17,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x08, +0x00,0x00,0x00,0x00,0x96,0x02,0x00,0x06,0x00,0x00,0x00,0x00,0xa6,0x02,0x00,0x14, +0x8f,0xbf,0x00,0x20,0x7b,0xb0,0x00,0xfc,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x28, +0x96,0x02,0x00,0x00,0x08,0x00,0x0e,0x68,0xa6,0x02,0x00,0x14,0x92,0x07,0x00,0x0a, +0x00,0x00,0x00,0x00,0x14,0xe0,0x00,0x03,0x00,0x00,0x00,0x00,0x08,0x00,0x0e,0x54, +0xa2,0x00,0x00,0x17,0x96,0x04,0x00,0x00,0x96,0x05,0x00,0x06,0x27,0x86,0x8f,0xf0, +0x00,0x04,0x18,0xc0,0x00,0x64,0x18,0x21,0x00,0x05,0x10,0xc0,0x00,0x45,0x10,0x21, +0x00,0x03,0x18,0x80,0x00,0x66,0x18,0x21,0x00,0x02,0x10,0x80,0x00,0x46,0x10,0x21, +0x8c,0x66,0x00,0x08,0x8c,0x45,0x00,0x08,0x3c,0x03,0x80,0x00,0x00,0xc3,0x20,0x24, +0x10,0x80,0x00,0x08,0x00,0xa3,0x10,0x24,0x10,0x40,0x00,0x04,0x00,0x00,0x18,0x21, +0x10,0x80,0x00,0x02,0x24,0x03,0x00,0x01,0x00,0xa6,0x18,0x2b,0x08,0x00,0x0e,0x54, +0xa2,0x03,0x00,0x17,0x10,0x40,0xff,0xfd,0x00,0xa6,0x18,0x2b,0x08,0x00,0x0e,0x88, +0x00,0x00,0x00,0x00,0x10,0x62,0x00,0x09,0x24,0x02,0x00,0x02,0x10,0x62,0x00,0x05, +0x24,0x02,0x00,0x03,0x14,0x62,0xff,0xb8,0x00,0x00,0x00,0x00,0x08,0x00,0x0e,0x4e, +0xa2,0x20,0x00,0x07,0x08,0x00,0x0e,0x4e,0xa2,0x20,0x00,0x06,0x08,0x00,0x0e,0x4e, +0xa2,0x20,0x00,0x05,0x82,0x22,0x00,0x10,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x69, +0x2c,0x62,0x00,0x02,0x10,0x40,0x00,0x49,0x3c,0x02,0xb0,0x09,0x92,0x25,0x00,0x08, +0x00,0x00,0x00,0x00,0x30,0xa6,0x00,0xff,0x2c,0xc2,0x00,0x04,0x10,0x40,0x00,0x3b, +0x2c,0xc2,0x00,0x10,0x3c,0x04,0xb0,0x05,0x34,0x84,0x02,0x29,0x90,0x83,0x00,0x00, +0x24,0x02,0x00,0x01,0x00,0xc2,0x10,0x04,0x00,0x02,0x10,0x27,0x00,0x62,0x18,0x24, +0xa0,0x83,0x00,0x00,0x86,0x23,0x00,0x0c,0x96,0x26,0x00,0x0c,0x00,0x03,0x10,0xc0, +0x00,0x43,0x10,0x21,0x00,0x02,0x28,0x80,0x27,0x83,0x8f,0xf4,0x00,0xa3,0x18,0x21, +0x8c,0x64,0x00,0x18,0x00,0x00,0x00,0x00,0x8c,0x82,0x00,0x04,0x00,0x00,0x00,0x00, +0x30,0x42,0x00,0x10,0x10,0x40,0x00,0x18,0x24,0x07,0x00,0x01,0x93,0x82,0x8b,0x61, +0x00,0x00,0x00,0x00,0x30,0x42,0x00,0x01,0x14,0x40,0x00,0x0a,0x24,0x05,0x00,0x24, +0x00,0x06,0x2c,0x00,0x00,0x05,0x2c,0x03,0x0c,0x00,0x1b,0x84,0x02,0x00,0x20,0x21, +0x92,0x02,0x00,0x16,0xa2,0x00,0x00,0x12,0x30,0x42,0x00,0xe7,0x08,0x00,0x0e,0x45, +0xa2,0x02,0x00,0x16,0xf0,0xc5,0x00,0x06,0x00,0x00,0x28,0x12,0x27,0x82,0x8f,0xf0, +0x00,0xa2,0x28,0x21,0x0c,0x00,0x01,0x4b,0x3c,0x04,0x00,0x80,0x96,0x26,0x00,0x0c, +0x08,0x00,0x0e,0xc5,0x00,0x06,0x2c,0x00,0x27,0x83,0x90,0x00,0x27,0x82,0x90,0x08, +0x00,0xa2,0x10,0x21,0x00,0xa3,0x18,0x21,0x90,0x44,0x00,0x00,0x90,0x65,0x00,0x05, +0x93,0x82,0x80,0x10,0x00,0x00,0x30,0x21,0x0c,0x00,0x21,0xf5,0xaf,0xa2,0x00,0x10, +0x96,0x26,0x00,0x0c,0x08,0x00,0x0e,0xbf,0x00,0x00,0x00,0x00,0x14,0x40,0xff,0xcd, +0x3c,0x04,0xb0,0x05,0x34,0x84,0x02,0x29,0x90,0x83,0x00,0x00,0x30,0xa5,0x00,0x0f, +0x24,0x02,0x00,0x80,0x08,0x00,0x0e,0xae,0x00,0xa2,0x10,0x07,0x86,0x26,0x00,0x0c, +0x3c,0x03,0xb0,0x09,0x34,0x42,0x01,0x72,0x34,0x63,0x01,0x78,0x94,0x47,0x00,0x00, +0x8c,0x65,0x00,0x00,0x00,0x06,0x10,0xc0,0x00,0x46,0x10,0x21,0x3c,0x04,0xb0,0x09, +0xae,0x25,0x00,0x1c,0x34,0x84,0x01,0x7c,0x27,0x83,0x8f,0xf4,0x00,0x02,0x10,0x80, +0x8c,0x85,0x00,0x00,0x00,0x43,0x10,0x21,0x8c,0x43,0x00,0x18,0xae,0x25,0x00,0x20, +0xa6,0x27,0x00,0x18,0x8c,0x66,0x00,0x08,0x02,0x20,0x20,0x21,0x0c,0x00,0x0f,0x15, +0x00,0x00,0x28,0x21,0x86,0x25,0x00,0x18,0x8e,0x26,0x00,0x1c,0x8e,0x27,0x00,0x20, +0x02,0x20,0x20,0x21,0x0c,0x00,0x1c,0x86,0xaf,0xa2,0x00,0x10,0x08,0x00,0x0e,0x45, +0xa2,0x02,0x00,0x12,0x92,0x22,0x00,0x08,0x08,0x00,0x0e,0x45,0xa2,0x22,0x00,0x09, +0xa2,0x20,0x00,0x11,0x80,0x82,0x00,0x50,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x03, +0x3c,0x02,0xb0,0x03,0x34,0x42,0x00,0xd0,0xac,0x40,0x00,0x00,0x08,0x00,0x0e,0x45, +0xa0,0x80,0x00,0x50,0x94,0x8a,0x00,0x0c,0x24,0x03,0x00,0x24,0x00,0x80,0x70,0x21, +0x3c,0x02,0x80,0x00,0x3c,0x04,0xb0,0x03,0x24,0x42,0x3c,0x54,0xf1,0x43,0x00,0x06, +0x34,0x84,0x00,0x20,0x00,0x00,0x18,0x12,0x00,0xa0,0x68,0x21,0xac,0x82,0x00,0x00, +0x27,0x85,0x90,0x00,0x27,0x82,0x8f,0xff,0x27,0xbd,0xff,0xf8,0x00,0x62,0x60,0x21, +0x00,0x65,0x58,0x21,0x00,0x00,0xc0,0x21,0x11,0xa0,0x00,0xcc,0x00,0x00,0x78,0x21, +0x00,0x0a,0x1c,0x00,0x00,0x03,0x1c,0x03,0x00,0x03,0x10,0xc0,0x00,0x43,0x10,0x21, +0x00,0x02,0x10,0x80,0x00,0x45,0x10,0x21,0x91,0x87,0x00,0x00,0x80,0x48,0x00,0x04, +0x03,0xa0,0x60,0x21,0x00,0x0a,0x1c,0x00,0x00,0x03,0x1c,0x03,0x00,0x03,0x10,0xc0, +0x00,0x43,0x10,0x21,0x00,0x02,0x48,0x80,0x27,0x83,0x8f,0xf4,0xa3,0xa7,0x00,0x00, +0x01,0x23,0x18,0x21,0x8c,0x64,0x00,0x18,0x25,0x02,0xff,0xff,0x00,0x48,0x40,0x0b, +0x8c,0x83,0x00,0x04,0x2d,0x05,0x00,0x07,0x24,0x02,0x00,0x06,0x30,0x63,0x00,0x08, +0x14,0x60,0x00,0x35,0x00,0x45,0x40,0x0a,0x93,0xa7,0x00,0x00,0x27,0x82,0x90,0x08, +0x01,0x22,0x10,0x21,0x30,0xe3,0x00,0xf0,0x38,0x63,0x00,0x50,0x30,0xe5,0x00,0xff, +0x00,0x05,0x20,0x2b,0x00,0x03,0x18,0x2b,0x00,0x64,0x18,0x24,0x90,0x49,0x00,0x00, +0x10,0x60,0x00,0x16,0x30,0xe4,0x00,0x0f,0x24,0x02,0x00,0x04,0x10,0xa2,0x00,0x9d, +0x00,0x00,0x00,0x00,0x11,0xa0,0x00,0x3a,0x2c,0xa2,0x00,0x0c,0x10,0x40,0x00,0x02, +0x24,0x84,0x00,0x0c,0x00,0xe0,0x20,0x21,0x30,0x84,0x00,0xff,0x00,0x04,0x10,0x40, +0x27,0x83,0xbb,0x0c,0x00,0x44,0x10,0x21,0x00,0x43,0x10,0x21,0x90,0x47,0x00,0x00, +0x00,0x00,0x00,0x00,0x2c,0xe3,0x00,0x0c,0xa3,0xa7,0x00,0x00,0x10,0x60,0x00,0x02, +0x24,0xe2,0x00,0x04,0x00,0xe0,0x10,0x21,0xa3,0xa2,0x00,0x00,0x91,0x65,0x00,0x00, +0x91,0x82,0x00,0x00,0x30,0xa3,0x00,0xff,0x00,0x62,0x10,0x2b,0x10,0x40,0x00,0x0e, +0x2c,0x62,0x00,0x0c,0x14,0x40,0x00,0x03,0x00,0x60,0x20,0x21,0x30,0xa2,0x00,0x0f, +0x24,0x44,0x00,0x0c,0x00,0x04,0x10,0x40,0x00,0x44,0x20,0x21,0x27,0x83,0xbb,0x0c, +0x00,0x83,0x18,0x21,0x90,0x62,0x00,0x02,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x05, +0x00,0x09,0x11,0x00,0xa1,0x85,0x00,0x00,0x93,0xa2,0x00,0x00,0x03,0xe0,0x00,0x08, +0x27,0xbd,0x00,0x08,0x00,0x49,0x10,0x23,0x00,0x02,0x10,0x80,0x00,0x49,0x10,0x23, +0x00,0x02,0x10,0x80,0x00,0x44,0x10,0x21,0x27,0x83,0xb4,0x98,0x00,0x43,0x10,0x21, +0x90,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x2c,0x83,0x00,0x0c,0x14,0x60,0x00,0x06, +0x00,0x80,0x10,0x21,0x00,0x18,0x10,0x40,0x00,0x4f,0x10,0x21,0x00,0x02,0x11,0x00, +0x00,0x82,0x10,0x21,0x24,0x42,0x00,0x04,0x08,0x00,0x0f,0x76,0xa1,0x82,0x00,0x00, +0x8f,0x8d,0x81,0x5c,0x00,0x00,0x00,0x00,0x01,0xa8,0x10,0x21,0x90,0x43,0x00,0x00, +0x00,0x00,0x00,0x00,0x10,0x60,0xff,0xd1,0x00,0x00,0x28,0x21,0x00,0x06,0x74,0x82, +0x30,0xe2,0x00,0xff,0x2c,0x42,0x00,0x0c,0x14,0x40,0x00,0x03,0x00,0xe0,0x10,0x21, +0x30,0xe2,0x00,0x0f,0x24,0x42,0x00,0x0c,0x30,0x44,0x00,0xff,0xa3,0xa2,0x00,0x00, +0x24,0x02,0x00,0x0c,0x10,0x82,0x00,0x0d,0x00,0x09,0x11,0x00,0x00,0x49,0x10,0x23, +0x00,0x02,0x10,0x80,0x00,0x04,0x18,0x40,0x00,0x49,0x10,0x23,0x00,0x64,0x18,0x21, +0x00,0x02,0x10,0x80,0x00,0x43,0x10,0x21,0x27,0x84,0xb4,0x98,0x00,0x44,0x10,0x21, +0x90,0x47,0x00,0x00,0x00,0x00,0x00,0x00,0xa3,0xa7,0x00,0x00,0x00,0x0a,0x1c,0x00, +0x00,0x03,0x1c,0x03,0x00,0x03,0x10,0xc0,0x00,0x43,0x10,0x21,0x00,0x02,0x10,0x80, +0x27,0x83,0x8f,0xf4,0x00,0x43,0x10,0x21,0x8c,0x44,0x00,0x18,0x00,0x00,0x00,0x00, +0x8c,0x83,0x00,0x04,0x00,0x00,0x00,0x00,0x30,0x63,0x00,0x10,0x14,0x60,0x00,0x33, +0x00,0x06,0x14,0x42,0x00,0x09,0x11,0x00,0x00,0x49,0x10,0x23,0x00,0x02,0x10,0x80, +0x00,0x49,0x10,0x23,0x27,0x83,0xb5,0x68,0x00,0x02,0x10,0x80,0x00,0x43,0x10,0x21, +0x90,0x44,0x00,0x04,0x90,0x43,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x64,0xc0,0x24, +0x93,0xa7,0x00,0x00,0x00,0x00,0x00,0x00,0x2c,0xe2,0x00,0x0f,0x10,0x40,0x00,0x0f, +0x31,0xcf,0x00,0x01,0x00,0x0a,0x1c,0x00,0x00,0x03,0x1c,0x03,0x00,0x03,0x10,0xc0, +0x00,0x43,0x10,0x21,0x00,0x02,0x10,0x80,0x27,0x84,0x8f,0xf0,0x00,0x44,0x10,0x21, +0x84,0x43,0x00,0x06,0x00,0x00,0x00,0x00,0x28,0x63,0x06,0x41,0x14,0x60,0x00,0x04, +0x30,0xe2,0x00,0xff,0x24,0x07,0x00,0x0f,0xa3,0xa7,0x00,0x00,0x30,0xe2,0x00,0xff, +0x2c,0x42,0x00,0x0c,0x14,0x40,0x00,0x06,0x00,0xe0,0x10,0x21,0x00,0x18,0x10,0x40, +0x00,0x4f,0x10,0x21,0x00,0x02,0x11,0x00,0x00,0x47,0x10,0x21,0x24,0x42,0x00,0x04, +0xa3,0xa2,0x00,0x00,0x00,0x40,0x38,0x21,0x01,0xa8,0x10,0x21,0x90,0x43,0x00,0x00, +0x24,0xa4,0x00,0x01,0x30,0x85,0xff,0xff,0x00,0xa3,0x18,0x2b,0x14,0x60,0xff,0xad, +0x30,0xe2,0x00,0xff,0x08,0x00,0x0f,0x63,0x00,0x00,0x00,0x00,0x08,0x00,0x0f,0xc4, +0x30,0x58,0x00,0x01,0x81,0xc2,0x00,0x48,0x00,0x00,0x00,0x00,0x10,0x40,0xff,0x73, +0x00,0x00,0x00,0x00,0x08,0x00,0x0f,0x51,0x00,0x00,0x00,0x00,0x00,0x0a,0x1c,0x00, +0x00,0x03,0x1c,0x03,0x00,0x03,0x10,0xc0,0x00,0x43,0x10,0x21,0x00,0x02,0x10,0x80, +0x00,0x45,0x10,0x21,0x80,0x48,0x00,0x05,0x91,0x67,0x00,0x00,0x08,0x00,0x0f,0x31, +0x03,0xa0,0x58,0x21,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00,0x34,0x63,0x00,0x20, +0x24,0x42,0x3f,0xf4,0x03,0xe0,0x00,0x08,0xac,0x62,0x00,0x00,0x27,0xbd,0xff,0xc0, +0xaf,0xb7,0x00,0x34,0xaf,0xb6,0x00,0x30,0xaf,0xb5,0x00,0x2c,0xaf,0xb4,0x00,0x28, +0xaf,0xb3,0x00,0x24,0xaf,0xb2,0x00,0x20,0xaf,0xbf,0x00,0x3c,0xaf,0xbe,0x00,0x38, +0xaf,0xb1,0x00,0x1c,0xaf,0xb0,0x00,0x18,0x84,0x82,0x00,0x0c,0x27,0x93,0x8f,0xf4, +0x3c,0x05,0xb0,0x03,0x00,0x02,0x18,0xc0,0x00,0x62,0x18,0x21,0x00,0x03,0x18,0x80, +0x00,0x73,0x10,0x21,0x8c,0x5e,0x00,0x18,0x3c,0x02,0x80,0x00,0x34,0xa5,0x00,0x20, +0x24,0x42,0x40,0x0c,0xac,0xa2,0x00,0x00,0x8f,0xd0,0x00,0x08,0x27,0x95,0x90,0x00, +0x00,0x75,0x18,0x21,0x00,0x00,0x28,0x21,0x02,0x00,0x30,0x21,0x90,0x71,0x00,0x00, +0x0c,0x00,0x0f,0x15,0x00,0x80,0xb0,0x21,0x00,0x40,0x90,0x21,0x00,0x10,0x14,0x42, +0x30,0x54,0x00,0x01,0x02,0x40,0x20,0x21,0x00,0x10,0x14,0x82,0x02,0x80,0x28,0x21, +0x12,0x51,0x00,0x23,0x00,0x10,0xbf,0xc2,0x86,0xc3,0x00,0x0c,0x30,0x50,0x00,0x01, +0x00,0x03,0x10,0xc0,0x00,0x43,0x10,0x21,0x00,0x02,0x10,0x80,0x00,0x55,0x10,0x21, +0xa0,0x52,0x00,0x00,0x86,0xc3,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x03,0x10,0xc0, +0x00,0x43,0x10,0x21,0x00,0x02,0x10,0x80,0x00,0x53,0x30,0x21,0x8c,0xc7,0x00,0x18, +0x27,0x83,0x8f,0xf0,0x00,0x43,0x10,0x21,0x8c,0xe3,0x00,0x04,0x84,0x46,0x00,0x06, +0x00,0x03,0x19,0x42,0x0c,0x00,0x08,0xdf,0x30,0x73,0x00,0x01,0x00,0x40,0x88,0x21, +0x02,0x40,0x20,0x21,0x02,0x80,0x28,0x21,0x16,0xe0,0x00,0x10,0x02,0x00,0x30,0x21, +0x86,0xc2,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x02,0x18,0xc0,0x00,0x62,0x18,0x21, +0x00,0x03,0x18,0x80,0x27,0x82,0x8f,0xf8,0x00,0x62,0x18,0x21,0xa4,0x71,0x00,0x04, +0x7b,0xbe,0x01,0xfc,0x7b,0xb6,0x01,0xbc,0x7b,0xb4,0x01,0x7c,0x7b,0xb2,0x01,0x3c, +0x7b,0xb0,0x00,0xfc,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x40,0x86,0xc3,0x00,0x0c, +0xaf,0xb3,0x00,0x10,0xaf,0xa0,0x00,0x14,0x00,0x03,0x10,0xc0,0x00,0x43,0x10,0x21, +0x00,0x02,0x10,0x80,0x00,0x55,0x10,0x21,0x80,0x47,0x00,0x06,0x00,0x00,0x00,0x00, +0x24,0xe7,0x00,0x02,0x00,0x07,0x17,0xc2,0x00,0xe2,0x38,0x21,0x00,0x07,0x38,0x43, +0x00,0x07,0x38,0x40,0x0c,0x00,0x09,0x06,0x03,0xc7,0x38,0x21,0x08,0x00,0x10,0x44, +0x02,0x22,0x88,0x21,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00,0x27,0xbd,0xff,0xd0, +0x34,0x63,0x00,0x20,0x24,0x42,0x41,0x94,0xaf,0xb2,0x00,0x20,0xac,0x62,0x00,0x00, +0xaf,0xbf,0x00,0x28,0xaf,0xb3,0x00,0x24,0xaf,0xb1,0x00,0x1c,0xaf,0xb0,0x00,0x18, +0x3c,0x02,0xb0,0x03,0x90,0x83,0x00,0x0a,0x34,0x42,0x01,0x04,0x94,0x45,0x00,0x00, +0x00,0x03,0x18,0x80,0x27,0x82,0xb3,0xf0,0x00,0x62,0x18,0x21,0x30,0xa6,0xff,0xff, +0x8c,0x71,0x00,0x00,0x80,0x85,0x00,0x12,0x30,0xc9,0x00,0xff,0x00,0x06,0x32,0x02, +0xa4,0x86,0x00,0x44,0xa4,0x89,0x00,0x46,0x82,0x22,0x00,0x12,0x00,0x80,0x90,0x21, +0x10,0xa0,0x00,0x1b,0xa0,0x80,0x00,0x15,0x00,0xc5,0x10,0x2a,0x10,0x40,0x00,0x14, +0x00,0x00,0x00,0x00,0xa2,0x20,0x00,0x19,0x84,0x83,0x00,0x0c,0x00,0x00,0x00,0x00, +0x00,0x03,0x10,0xc0,0x00,0x43,0x10,0x21,0x00,0x02,0x10,0x80,0x27,0x83,0x90,0x10, +0x00,0x43,0x10,0x21,0xa0,0x40,0x00,0x00,0xa0,0x80,0x00,0x12,0x92,0x22,0x00,0x16, +0x00,0x00,0x00,0x00,0x30,0x42,0x00,0xdf,0xa2,0x22,0x00,0x16,0x8f,0xbf,0x00,0x28, +0x7b,0xb2,0x01,0x3c,0x7b,0xb0,0x00,0xfc,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x30, +0x0c,0x00,0x0f,0xfd,0x00,0x00,0x00,0x00,0x08,0x00,0x10,0x93,0x00,0x00,0x00,0x00, +0x28,0x42,0x00,0x02,0x10,0x40,0x01,0x76,0x00,0x00,0x28,0x21,0x94,0x87,0x00,0x0c, +0x00,0x00,0x00,0x00,0x00,0xe0,0x10,0x21,0x00,0x02,0x14,0x00,0x00,0x02,0x14,0x03, +0x00,0x07,0x24,0x00,0x00,0x04,0x24,0x03,0x00,0x02,0x18,0xc0,0x00,0x62,0x18,0x21, +0x00,0x04,0x28,0xc0,0x00,0xa4,0x28,0x21,0x27,0x82,0x90,0x10,0x00,0x03,0x18,0x80, +0x00,0x62,0x18,0x21,0x00,0x05,0x28,0x80,0x27,0x82,0x8f,0xf8,0x00,0xa2,0x10,0x21, +0x8c,0x68,0x00,0x00,0x80,0x44,0x00,0x06,0x27,0x82,0x90,0x00,0x00,0x08,0x1d,0x02, +0x00,0xa2,0x28,0x21,0x38,0x84,0x00,0x00,0x30,0x63,0x00,0x01,0x01,0x24,0x30,0x0b, +0x80,0xaa,0x00,0x04,0x80,0xa9,0x00,0x05,0x10,0x60,0x00,0x02,0x00,0x08,0x14,0x02, +0x30,0x46,0x00,0x0f,0x15,0x20,0x00,0x28,0x01,0x49,0x10,0x21,0x15,0x40,0x00,0x11, +0x30,0xe3,0xff,0xff,0x92,0x45,0x00,0x08,0x00,0x00,0x00,0x00,0x30,0xa8,0x00,0xff, +0x2d,0x02,0x00,0x04,0x10,0x40,0x01,0x46,0x2d,0x02,0x00,0x10,0x3c,0x04,0xb0,0x05, +0x34,0x84,0x02,0x29,0x90,0x83,0x00,0x00,0x24,0x02,0x00,0x01,0x01,0x02,0x10,0x04, +0x00,0x62,0x18,0x25,0xa0,0x83,0x00,0x00,0x96,0x47,0x00,0x0c,0x00,0x00,0x00,0x00, +0x30,0xe3,0xff,0xff,0x00,0x03,0x10,0xc0,0x00,0x43,0x10,0x21,0x27,0x84,0x90,0x00, +0x00,0x02,0x10,0x80,0x00,0x44,0x10,0x21,0x80,0x45,0x00,0x06,0x00,0x03,0x1a,0x00, +0x3c,0x04,0xb0,0x00,0x00,0x65,0x18,0x21,0x00,0x64,0x20,0x21,0x94,0x82,0x00,0x00, +0x82,0x43,0x00,0x10,0x00,0x02,0x14,0x00,0x14,0x60,0x00,0x06,0x00,0x02,0x3c,0x03, +0x30,0xe2,0x00,0x04,0x14,0x40,0x00,0x04,0x01,0x49,0x10,0x21,0x34,0xe2,0x08,0x00, +0xa4,0x82,0x00,0x00,0x01,0x49,0x10,0x21,0x00,0x02,0x16,0x00,0x00,0x02,0x16,0x03, +0x00,0x46,0x10,0x2a,0x10,0x40,0x00,0x7c,0x00,0x00,0x00,0x00,0x82,0x42,0x00,0x10, +0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x0e,0x00,0x00,0x00,0x00,0x86,0x43,0x00,0x0c, +0x25,0x44,0x00,0x01,0x00,0x03,0x10,0xc0,0x00,0x43,0x10,0x21,0x00,0x02,0x10,0x80, +0x27,0x83,0x90,0x00,0x00,0x43,0x10,0x21,0xa0,0x44,0x00,0x04,0x92,0x23,0x00,0x16, +0x02,0x40,0x20,0x21,0x30,0x63,0x00,0xfb,0x08,0x00,0x10,0x98,0xa2,0x23,0x00,0x16, +0x86,0x43,0x00,0x0c,0x25,0x24,0x00,0x01,0x00,0x03,0x10,0xc0,0x00,0x43,0x10,0x21, +0x00,0x02,0x10,0x80,0x27,0x83,0x90,0x00,0x00,0x43,0x10,0x21,0xa0,0x44,0x00,0x05, +0x86,0x45,0x00,0x0c,0x0c,0x00,0x1f,0x08,0x02,0x20,0x20,0x21,0x10,0x40,0x00,0x5a, +0x00,0x00,0x00,0x00,0x92,0x45,0x00,0x08,0x00,0x00,0x00,0x00,0x30,0xa6,0x00,0xff, +0x2c,0xc2,0x00,0x04,0x10,0x40,0x00,0x4c,0x2c,0xc2,0x00,0x10,0x3c,0x04,0xb0,0x05, +0x34,0x84,0x02,0x29,0x90,0x83,0x00,0x00,0x24,0x02,0x00,0x01,0x00,0xc2,0x10,0x04, +0x00,0x02,0x10,0x27,0x00,0x62,0x18,0x24,0xa0,0x83,0x00,0x00,0x92,0x45,0x00,0x08, +0x00,0x00,0x00,0x00,0x30,0xa5,0x00,0xff,0x14,0xa0,0x00,0x33,0x24,0x02,0x00,0x01, +0xa2,0x40,0x00,0x04,0x92,0x22,0x00,0x04,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x0c, +0x24,0x02,0x00,0x01,0xa2,0x22,0x00,0x17,0x92,0x22,0x00,0x17,0x00,0x00,0x00,0x00, +0x10,0x40,0x00,0x04,0x00,0x00,0x00,0x00,0x96,0x22,0x00,0x06,0x08,0x00,0x10,0x93, +0xa6,0x22,0x00,0x14,0x96,0x22,0x00,0x00,0x08,0x00,0x10,0x93,0xa6,0x22,0x00,0x14, +0x92,0x22,0x00,0x0a,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x03,0x00,0x00,0x00,0x00, +0x08,0x00,0x11,0x22,0xa2,0x20,0x00,0x17,0x96,0x24,0x00,0x00,0x96,0x25,0x00,0x06, +0x27,0x86,0x8f,0xf0,0x00,0x04,0x18,0xc0,0x00,0x64,0x18,0x21,0x00,0x05,0x10,0xc0, +0x00,0x45,0x10,0x21,0x00,0x03,0x18,0x80,0x00,0x66,0x18,0x21,0x00,0x02,0x10,0x80, +0x00,0x46,0x10,0x21,0x8c,0x65,0x00,0x08,0x8c,0x44,0x00,0x08,0x3c,0x03,0x80,0x00, +0x00,0xa3,0x30,0x24,0x10,0xc0,0x00,0x08,0x00,0x83,0x10,0x24,0x10,0x40,0x00,0x04, +0x00,0x00,0x18,0x21,0x10,0xc0,0x00,0x02,0x24,0x03,0x00,0x01,0x00,0x85,0x18,0x2b, +0x08,0x00,0x11,0x22,0xa2,0x23,0x00,0x17,0x10,0x40,0xff,0xfd,0x00,0x85,0x18,0x2b, +0x08,0x00,0x11,0x45,0x00,0x00,0x00,0x00,0x10,0xa2,0x00,0x09,0x24,0x02,0x00,0x02, +0x10,0xa2,0x00,0x05,0x24,0x02,0x00,0x03,0x14,0xa2,0xff,0xca,0x00,0x00,0x00,0x00, +0x08,0x00,0x11,0x1d,0xa2,0x40,0x00,0x07,0x08,0x00,0x11,0x1d,0xa2,0x40,0x00,0x06, +0x08,0x00,0x11,0x1d,0xa2,0x40,0x00,0x05,0x14,0x40,0xff,0xbe,0x3c,0x04,0xb0,0x05, +0x34,0x84,0x02,0x29,0x90,0x83,0x00,0x00,0x30,0xa5,0x00,0x0f,0x24,0x02,0x00,0x80, +0x08,0x00,0x11,0x14,0x00,0xa2,0x10,0x07,0x0c,0x00,0x10,0x03,0x02,0x40,0x20,0x21, +0x08,0x00,0x10,0x93,0x00,0x00,0x00,0x00,0x92,0x45,0x00,0x08,0x00,0x00,0x00,0x00, +0x30,0xa6,0x00,0xff,0x2c,0xc2,0x00,0x04,0x10,0x40,0x00,0x99,0x2c,0xc2,0x00,0x10, +0x3c,0x04,0xb0,0x05,0x34,0x84,0x02,0x29,0x90,0x83,0x00,0x00,0x24,0x02,0x00,0x01, +0x00,0xc2,0x10,0x04,0x00,0x02,0x10,0x27,0x00,0x62,0x18,0x24,0xa0,0x83,0x00,0x00, +0x92,0x45,0x00,0x08,0x00,0x00,0x00,0x00,0x30,0xa5,0x00,0xff,0x14,0xa0,0x00,0x80, +0x24,0x02,0x00,0x01,0xa2,0x40,0x00,0x04,0x86,0x43,0x00,0x0c,0x27,0x93,0x8f,0xf4, +0x96,0x47,0x00,0x0c,0x00,0x03,0x10,0xc0,0x00,0x43,0x10,0x21,0x00,0x02,0x28,0x80, +0x00,0xb3,0x18,0x21,0x8c,0x64,0x00,0x18,0x00,0x00,0x00,0x00,0x8c,0x82,0x00,0x04, +0x00,0x00,0x00,0x00,0x30,0x42,0x00,0x10,0x10,0x40,0x00,0x64,0x00,0x00,0x30,0x21, +0x00,0x07,0x1c,0x00,0x00,0x03,0x1c,0x03,0x00,0x03,0x10,0xc0,0x00,0x43,0x10,0x21, +0x00,0x02,0x10,0x80,0x00,0x53,0x10,0x21,0x8c,0x43,0x00,0x18,0x93,0x82,0x8b,0x61, +0x8c,0x64,0x00,0x04,0x30,0x42,0x00,0x01,0x00,0x04,0x21,0x42,0x14,0x40,0x00,0x4d, +0x30,0x90,0x00,0x01,0x00,0x07,0x2c,0x00,0x00,0x05,0x2c,0x03,0x0c,0x00,0x1b,0x84, +0x02,0x20,0x20,0x21,0x96,0x26,0x00,0x06,0x12,0x00,0x00,0x14,0x30,0xc5,0xff,0xff, +0x02,0x60,0x90,0x21,0x00,0x05,0x10,0xc0,0x00,0x45,0x10,0x21,0x00,0x02,0x10,0x80, +0x00,0x52,0x18,0x21,0x92,0x22,0x00,0x0a,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x0b, +0x02,0x20,0x20,0x21,0x8c,0x63,0x00,0x18,0x00,0x00,0x00,0x00,0x8c,0x62,0x00,0x04, +0x00,0x00,0x00,0x00,0x00,0x02,0x11,0x42,0x0c,0x00,0x1b,0x84,0x30,0x50,0x00,0x01, +0x96,0x26,0x00,0x06,0x16,0x00,0xff,0xef,0x30,0xc5,0xff,0xff,0x92,0x22,0x00,0x04, +0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x0d,0x24,0x02,0x00,0x01,0xa2,0x22,0x00,0x17, +0x92,0x22,0x00,0x17,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x05,0x00,0x00,0x00,0x00, +0xa6,0x26,0x00,0x14,0x92,0x22,0x00,0x16,0x08,0x00,0x10,0x92,0x30,0x42,0x00,0xc3, +0x96,0x22,0x00,0x00,0x08,0x00,0x11,0xb9,0xa6,0x22,0x00,0x14,0x92,0x22,0x00,0x0a, +0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x03,0x00,0x00,0x00,0x00,0x08,0x00,0x11,0xb4, +0xa2,0x20,0x00,0x17,0x96,0x24,0x00,0x00,0x30,0xc5,0xff,0xff,0x00,0x05,0x18,0xc0, +0x00,0x04,0x10,0xc0,0x00,0x44,0x10,0x21,0x00,0x65,0x18,0x21,0x27,0x84,0x8f,0xf0, +0x00,0x02,0x10,0x80,0x00,0x44,0x10,0x21,0x00,0x03,0x18,0x80,0x8c,0x45,0x00,0x08, +0x00,0x64,0x18,0x21,0x8c,0x64,0x00,0x08,0x3c,0x02,0x80,0x00,0x00,0xa2,0x38,0x24, +0x10,0xe0,0x00,0x08,0x00,0x82,0x10,0x24,0x10,0x40,0x00,0x04,0x00,0x00,0x18,0x21, +0x10,0xe0,0x00,0x02,0x24,0x03,0x00,0x01,0x00,0x85,0x18,0x2b,0x08,0x00,0x11,0xb4, +0xa2,0x23,0x00,0x17,0x10,0x40,0xff,0xfd,0x00,0x85,0x18,0x2b,0x08,0x00,0x11,0xd8, +0x00,0x00,0x00,0x00,0x24,0x05,0x00,0x24,0xf0,0xe5,0x00,0x06,0x00,0x00,0x28,0x12, +0x27,0x82,0x8f,0xf0,0x00,0xa2,0x28,0x21,0x0c,0x00,0x01,0x4b,0x00,0x00,0x20,0x21, +0x96,0x47,0x00,0x0c,0x08,0x00,0x11,0x96,0x00,0x07,0x2c,0x00,0x27,0x83,0x90,0x00, +0x27,0x82,0x90,0x08,0x00,0xa2,0x10,0x21,0x00,0xa3,0x18,0x21,0x90,0x44,0x00,0x00, +0x90,0x65,0x00,0x05,0x93,0x82,0x80,0x10,0x24,0x07,0x00,0x01,0x0c,0x00,0x21,0xf5, +0xaf,0xa2,0x00,0x10,0x96,0x47,0x00,0x0c,0x08,0x00,0x11,0x89,0x00,0x07,0x1c,0x00, +0x10,0xa2,0x00,0x09,0x24,0x02,0x00,0x02,0x10,0xa2,0x00,0x05,0x24,0x02,0x00,0x03, +0x14,0xa2,0xff,0x7d,0x00,0x00,0x00,0x00,0x08,0x00,0x11,0x7a,0xa2,0x40,0x00,0x07, +0x08,0x00,0x11,0x7a,0xa2,0x40,0x00,0x06,0x08,0x00,0x11,0x7a,0xa2,0x40,0x00,0x05, +0x14,0x40,0xff,0x71,0x3c,0x04,0xb0,0x05,0x34,0x84,0x02,0x29,0x90,0x83,0x00,0x00, +0x30,0xa5,0x00,0x0f,0x24,0x02,0x00,0x80,0x08,0x00,0x11,0x71,0x00,0xa2,0x10,0x07, +0x14,0x40,0xfe,0xc3,0x3c,0x04,0xb0,0x05,0x34,0x84,0x02,0x29,0x90,0x83,0x00,0x00, +0x30,0xa5,0x00,0x0f,0x24,0x02,0x00,0x80,0x08,0x00,0x10,0xcc,0x00,0xa2,0x10,0x07, +0x84,0x83,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x03,0x10,0xc0,0x00,0x43,0x10,0x21, +0x00,0x02,0x10,0x80,0x27,0x83,0x8f,0xf4,0x00,0x43,0x10,0x21,0x8c,0x47,0x00,0x18, +0x00,0x00,0x00,0x00,0x8c,0xe6,0x00,0x08,0x0c,0x00,0x0f,0x15,0x00,0x00,0x00,0x00, +0x02,0x40,0x20,0x21,0x00,0x00,0x28,0x21,0x00,0x00,0x30,0x21,0x00,0x00,0x38,0x21, +0x0c,0x00,0x1c,0x86,0xaf,0xa2,0x00,0x10,0x00,0x02,0x1e,0x00,0x14,0x60,0xfe,0x6b, +0xa2,0x22,0x00,0x12,0x92,0x43,0x00,0x08,0x00,0x00,0x00,0x00,0x14,0x60,0x00,0x40, +0x24,0x02,0x00,0x01,0xa2,0x40,0x00,0x04,0x92,0x28,0x00,0x04,0x00,0x00,0x00,0x00, +0x15,0x00,0x00,0x19,0x24,0x02,0x00,0x01,0x92,0x27,0x00,0x0a,0xa2,0x22,0x00,0x17, +0x92,0x22,0x00,0x17,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x10,0x00,0x00,0x00,0x00, +0x96,0x22,0x00,0x06,0x00,0x00,0x00,0x00,0xa6,0x22,0x00,0x14,0x92,0x22,0x00,0x16, +0x30,0xe3,0x00,0xff,0x30,0x42,0x00,0xc0,0x10,0x60,0x00,0x03,0xa2,0x22,0x00,0x16, +0x34,0x42,0x00,0x01,0xa2,0x22,0x00,0x16,0x11,0x00,0xfe,0x50,0x00,0x00,0x00,0x00, +0x92,0x22,0x00,0x16,0x08,0x00,0x10,0x92,0x34,0x42,0x00,0x02,0x96,0x22,0x00,0x00, +0x08,0x00,0x12,0x3b,0xa6,0x22,0x00,0x14,0x92,0x27,0x00,0x0a,0x00,0x00,0x00,0x00, +0x14,0xe0,0x00,0x03,0x00,0x00,0x00,0x00,0x08,0x00,0x12,0x34,0xa2,0x20,0x00,0x17, +0x96,0x24,0x00,0x00,0x96,0x25,0x00,0x06,0x27,0x86,0x8f,0xf0,0x00,0x04,0x18,0xc0, +0x00,0x64,0x18,0x21,0x00,0x05,0x10,0xc0,0x00,0x45,0x10,0x21,0x00,0x03,0x18,0x80, +0x00,0x66,0x18,0x21,0x00,0x02,0x10,0x80,0x00,0x46,0x10,0x21,0x8c,0x65,0x00,0x08, +0x8c,0x44,0x00,0x08,0x3c,0x03,0x80,0x00,0x00,0xa3,0x30,0x24,0x10,0xc0,0x00,0x08, +0x00,0x83,0x10,0x24,0x10,0x40,0x00,0x04,0x00,0x00,0x18,0x21,0x10,0xc0,0x00,0x02, +0x24,0x03,0x00,0x01,0x00,0x85,0x18,0x2b,0x08,0x00,0x12,0x34,0xa2,0x23,0x00,0x17, +0x10,0x40,0xff,0xfd,0x00,0x85,0x18,0x2b,0x08,0x00,0x12,0x63,0x00,0x00,0x00,0x00, +0x10,0x62,0x00,0x09,0x24,0x02,0x00,0x02,0x10,0x62,0x00,0x05,0x24,0x02,0x00,0x03, +0x14,0x62,0xff,0xbd,0x00,0x00,0x00,0x00,0x08,0x00,0x12,0x2e,0xa2,0x40,0x00,0x07, +0x08,0x00,0x12,0x2e,0xa2,0x40,0x00,0x06,0x08,0x00,0x12,0x2e,0xa2,0x40,0x00,0x05, +0x3c,0x02,0x80,0x00,0x00,0x82,0x30,0x24,0x10,0xc0,0x00,0x08,0x00,0xa2,0x18,0x24, +0x10,0x60,0x00,0x04,0x00,0x00,0x10,0x21,0x10,0xc0,0x00,0x02,0x24,0x02,0x00,0x01, +0x00,0xa4,0x10,0x2b,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00,0x10,0x60,0xff,0xfd, +0x00,0xa4,0x10,0x2b,0x08,0x00,0x12,0x7e,0x00,0x00,0x00,0x00,0x30,0x82,0xff,0xff, +0x00,0x02,0x18,0xc0,0x00,0x62,0x18,0x21,0x27,0x84,0x90,0x00,0x00,0x03,0x18,0x80, +0x00,0x64,0x18,0x21,0x80,0x66,0x00,0x06,0x00,0x02,0x12,0x00,0x3c,0x03,0xb0,0x00, +0x00,0x46,0x10,0x21,0x00,0x45,0x10,0x21,0x03,0xe0,0x00,0x08,0x00,0x43,0x10,0x21, +0x27,0xbd,0xff,0xe0,0x30,0x82,0x00,0x7c,0x30,0x84,0xff,0x00,0xaf,0xbf,0x00,0x1c, +0xaf,0xb2,0x00,0x18,0xaf,0xb1,0x00,0x14,0xaf,0xb0,0x00,0x10,0x14,0x40,0x00,0x41, +0x00,0x04,0x22,0x03,0x24,0x02,0x00,0x04,0x3c,0x10,0xb0,0x03,0x8e,0x10,0x00,0x00, +0x10,0x82,0x00,0x32,0x24,0x02,0x00,0x08,0x10,0x82,0x00,0x03,0x32,0x02,0x00,0x20, +0x08,0x00,0x12,0xa4,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x17,0x3c,0x02,0xb0,0x06, +0x34,0x42,0x80,0x24,0x8c,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x67,0x00,0xff, +0x10,0xe0,0x00,0x23,0x00,0x00,0x88,0x21,0x8f,0x85,0x8f,0xd0,0x00,0x40,0x30,0x21, +0x94,0xa2,0x00,0x08,0x8c,0xc3,0x00,0x00,0x26,0x31,0x00,0x01,0x24,0x42,0x00,0x02, +0x30,0x42,0x01,0xff,0x34,0x63,0x01,0x00,0x02,0x27,0x20,0x2a,0xa4,0xa2,0x00,0x08, +0x14,0x80,0xff,0xf7,0xac,0xc3,0x00,0x00,0x84,0xa3,0x00,0x08,0x3c,0x02,0xb0,0x03, +0x34,0x42,0x00,0x30,0xac,0x43,0x00,0x00,0x27,0x92,0xb3,0xf0,0x24,0x11,0x00,0x12, +0x8e,0x44,0x00,0x00,0x26,0x31,0xff,0xff,0x90,0x82,0x00,0x10,0x00,0x00,0x00,0x00, +0x10,0x40,0x00,0x03,0x26,0x52,0x00,0x04,0x0c,0x00,0x20,0xd0,0x00,0x00,0x00,0x00, +0x06,0x21,0xff,0xf7,0x24,0x02,0xff,0xdf,0x02,0x02,0x80,0x24,0x3c,0x01,0xb0,0x03, +0x0c,0x00,0x13,0x18,0xac,0x30,0x00,0x00,0x08,0x00,0x12,0xa4,0x00,0x00,0x00,0x00, +0x8f,0x85,0x8f,0xd0,0x08,0x00,0x12,0xba,0x00,0x00,0x00,0x00,0x24,0x02,0xff,0x95, +0x3c,0x03,0xb0,0x03,0x02,0x02,0x80,0x24,0x34,0x63,0x00,0x30,0x3c,0x01,0xb0,0x03, +0xac,0x30,0x00,0x00,0x0c,0x00,0x12,0xe1,0xac,0x60,0x00,0x00,0x08,0x00,0x12,0xa4, +0x00,0x00,0x00,0x00,0x3c,0x02,0xb0,0x03,0x34,0x42,0x00,0x50,0x08,0x00,0x12,0xa4, +0xac,0x46,0x00,0x00,0x3c,0x0a,0x80,0x00,0x25,0x4a,0x4b,0x84,0x3c,0x0b,0xb0,0x03, +0xad,0x6a,0x00,0x20,0x3c,0x08,0x80,0x01,0x25,0x08,0x00,0x00,0x3c,0x09,0x80,0x01, +0x25,0x29,0x03,0x1c,0x11,0x09,0x00,0x10,0x00,0x00,0x00,0x00,0x3c,0x0a,0x80,0x00, +0x25,0x4a,0x4b,0xac,0x3c,0x0b,0xb0,0x03,0xad,0x6a,0x00,0x20,0x3c,0x08,0xb0,0x06, +0x35,0x08,0x80,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8d,0x09,0x00,0x00, +0x00,0x00,0x00,0x00,0x31,0x29,0x00,0x01,0x00,0x00,0x00,0x00,0x24,0x01,0x00,0x01, +0x15,0x21,0xff,0xf2,0x00,0x00,0x00,0x00,0x3c,0x0a,0x80,0x00,0x25,0x4a,0x4b,0xe8, +0x3c,0x0b,0xb0,0x03,0xad,0x6a,0x00,0x20,0x3c,0x02,0xb0,0x03,0x8c,0x43,0x00,0x00, +0x00,0x00,0x00,0x00,0x34,0x63,0x00,0x40,0x00,0x00,0x00,0x00,0xac,0x43,0x00,0x00, +0x00,0x00,0x00,0x00,0x3c,0x0a,0x80,0x00,0x25,0x4a,0x4c,0x14,0x3c,0x0b,0xb0,0x03, +0xad,0x6a,0x00,0x20,0x3c,0x02,0x80,0x01,0x24,0x42,0x00,0x00,0x3c,0x03,0x80,0x01, +0x24,0x63,0x03,0x1c,0x3c,0x04,0xb0,0x00,0x8c,0x85,0x00,0x00,0x00,0x00,0x00,0x00, +0xac,0x45,0x00,0x00,0x24,0x42,0x00,0x04,0x24,0x84,0x00,0x04,0x00,0x43,0x08,0x2a, +0x14,0x20,0xff,0xf9,0x00,0x00,0x00,0x00,0x0c,0x00,0x13,0x18,0x00,0x00,0x00,0x00, +0x3c,0x0a,0x80,0x00,0x25,0x4a,0x4c,0x60,0x3c,0x0b,0xb0,0x03,0xad,0x6a,0x00,0x20, +0x3c,0x02,0x80,0x01,0x24,0x42,0x03,0x20,0x3c,0x03,0x80,0x01,0x24,0x63,0x3f,0x14, +0xac,0x40,0x00,0x00,0xac,0x40,0x00,0x04,0xac,0x40,0x00,0x08,0xac,0x40,0x00,0x0c, +0x24,0x42,0x00,0x10,0x00,0x43,0x08,0x2a,0x14,0x20,0xff,0xf9,0x00,0x00,0x00,0x00, +0x3c,0x0a,0x80,0x00,0x25,0x4a,0x4c,0xa0,0x3c,0x0b,0xb0,0x03,0xad,0x6a,0x00,0x20, +0x3c,0x1c,0x80,0x01,0x27,0x9c,0x7f,0xf0,0x27,0x9d,0x8b,0xd0,0x00,0x00,0x00,0x00, +0x27,0x9d,0x8f,0xb8,0x3c,0x0a,0x80,0x00,0x25,0x4a,0x4c,0xc4,0x3c,0x0b,0xb0,0x03, +0xad,0x6a,0x00,0x20,0x40,0x80,0x68,0x00,0x40,0x08,0x60,0x00,0x00,0x00,0x00,0x00, +0x35,0x08,0xff,0x01,0x40,0x88,0x60,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x15,0x65, +0x00,0x00,0x00,0x00,0x24,0x84,0xf8,0x00,0x30,0x87,0x00,0x03,0x00,0x04,0x30,0x40, +0x00,0xc7,0x20,0x23,0x3c,0x02,0xb0,0x0a,0x27,0xbd,0xff,0xe0,0x24,0x03,0xff,0xff, +0x00,0x82,0x20,0x21,0xaf,0xb1,0x00,0x14,0xac,0x83,0x10,0x00,0xaf,0xbf,0x00,0x18, +0xaf,0xb0,0x00,0x10,0x00,0xa0,0x88,0x21,0x24,0x03,0x00,0x01,0x8c,0x82,0x10,0x00, +0x00,0x00,0x00,0x00,0x14,0x43,0xff,0xfd,0x00,0xc7,0x10,0x23,0x3c,0x03,0xb0,0x0a, +0x00,0x43,0x10,0x21,0x8c,0x50,0x00,0x00,0x0c,0x00,0x13,0x95,0x02,0x20,0x20,0x21, +0x02,0x11,0x80,0x24,0x00,0x50,0x80,0x06,0x02,0x00,0x10,0x21,0x8f,0xbf,0x00,0x18, +0x7b,0xb0,0x00,0xbc,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x20,0x27,0xbd,0xff,0xd8, +0xaf,0xb2,0x00,0x18,0x00,0xa0,0x90,0x21,0x24,0x05,0xff,0xff,0xaf,0xb3,0x00,0x1c, +0xaf,0xbf,0x00,0x20,0xaf,0xb1,0x00,0x14,0xaf,0xb0,0x00,0x10,0x00,0xc0,0x98,0x21, +0x12,0x45,0x00,0x23,0x24,0x84,0xf8,0x00,0x30,0x83,0x00,0x03,0x00,0x04,0x10,0x40, +0x00,0x40,0x88,0x21,0x00,0x60,0x20,0x21,0x00,0x43,0x10,0x23,0x3c,0x03,0xb0,0x0a, +0x00,0x43,0x10,0x21,0xac,0x45,0x10,0x00,0x00,0x40,0x18,0x21,0x24,0x05,0x00,0x01, +0x8c,0x62,0x10,0x00,0x00,0x00,0x00,0x00,0x14,0x45,0xff,0xfd,0x3c,0x02,0xb0,0x0a, +0x02,0x24,0x88,0x23,0x02,0x22,0x88,0x21,0x8e,0x30,0x00,0x00,0x0c,0x00,0x13,0x95, +0x02,0x40,0x20,0x21,0x00,0x12,0x18,0x27,0x02,0x03,0x80,0x24,0x00,0x53,0x10,0x04, +0x02,0x02,0x80,0x25,0xae,0x30,0x00,0x00,0x24,0x03,0x00,0x01,0x8e,0x22,0x10,0x00, +0x00,0x00,0x00,0x00,0x14,0x43,0xff,0xfd,0x00,0x00,0x00,0x00,0x8f,0xbf,0x00,0x20, +0x7b,0xb2,0x00,0xfc,0x7b,0xb0,0x00,0xbc,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x28, +0x30,0x82,0x00,0x03,0x00,0x04,0x18,0x40,0x00,0x62,0x18,0x23,0x3c,0x04,0xb0,0x0a, +0x00,0x64,0x18,0x21,0xac,0x66,0x00,0x00,0x24,0x04,0x00,0x01,0x8c,0x62,0x10,0x00, +0x00,0x00,0x00,0x00,0x14,0x44,0xff,0xfd,0x00,0x00,0x00,0x00,0x08,0x00,0x13,0x83, +0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x21,0x00,0x64,0x10,0x06,0x30,0x42,0x00,0x01, +0x14,0x40,0x00,0x05,0x00,0x00,0x00,0x00,0x24,0x63,0x00,0x01,0x2c,0x62,0x00,0x20, +0x14,0x40,0xff,0xf9,0x00,0x00,0x00,0x00,0x03,0xe0,0x00,0x08,0x00,0x60,0x10,0x21, +0x27,0xbd,0xff,0xe0,0x3c,0x03,0xb0,0x05,0xaf,0xb2,0x00,0x18,0xaf,0xb1,0x00,0x14, +0xaf,0xb0,0x00,0x10,0xaf,0xbf,0x00,0x1c,0x00,0x80,0x90,0x21,0x00,0xa0,0x80,0x21, +0x00,0xc0,0x88,0x21,0x34,0x63,0x02,0x2e,0x90,0x62,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x42,0x00,0x01,0x14,0x40,0xff,0xfc,0x24,0x04,0x08,0x24,0x3c,0x05,0x00,0xc0, +0x0c,0x00,0x13,0x5b,0x24,0x06,0x00,0x03,0x24,0x04,0x08,0x34,0x3c,0x05,0x00,0xc0, +0x0c,0x00,0x13,0x5b,0x24,0x06,0x00,0x03,0x3c,0x02,0xc0,0x00,0x00,0x10,0x1c,0x00, +0x34,0x42,0x04,0x00,0x3c,0x04,0xb0,0x05,0x3c,0x05,0xb0,0x05,0x24,0x63,0x16,0x09, +0x02,0x22,0x10,0x21,0x34,0x84,0x04,0x20,0x34,0xa5,0x04,0x24,0x3c,0x06,0xb0,0x05, +0xac,0x83,0x00,0x00,0x24,0x07,0x00,0x01,0xac,0xa2,0x00,0x00,0x34,0xc6,0x02,0x28, +0x24,0x02,0x00,0x20,0xae,0x47,0x00,0x3c,0x24,0x04,0x08,0x24,0xa0,0xc2,0x00,0x00, +0x3c,0x05,0x00,0xc0,0xa2,0x47,0x00,0x11,0x0c,0x00,0x13,0x5b,0x24,0x06,0x00,0x01, +0x24,0x04,0x08,0x34,0x3c,0x05,0x00,0xc0,0x0c,0x00,0x13,0x5b,0x24,0x06,0x00,0x01, +0x8f,0xbf,0x00,0x1c,0x8f,0xb2,0x00,0x18,0x7b,0xb0,0x00,0xbc,0x03,0xe0,0x00,0x08, +0x27,0xbd,0x00,0x20,0x24,0x02,0x00,0x06,0xac,0x82,0x00,0x0c,0xa0,0x80,0x00,0x50, +0xac,0x80,0x00,0x00,0xac,0x80,0x00,0x04,0xac,0x80,0x00,0x08,0xac,0x80,0x00,0x14, +0xac,0x80,0x00,0x18,0xac,0x80,0x00,0x1c,0xa4,0x80,0x00,0x20,0xac,0x80,0x00,0x24, +0xac,0x80,0x00,0x28,0xac,0x80,0x00,0x2c,0xa0,0x80,0x00,0x30,0xa0,0x80,0x00,0x31, +0xac,0x80,0x00,0x34,0xac,0x80,0x00,0x38,0xa0,0x80,0x00,0x3c,0xac,0x82,0x00,0x10, +0xa0,0x80,0x00,0x44,0xac,0x80,0x00,0x48,0x03,0xe0,0x00,0x08,0xac,0x80,0x00,0x4c, +0x3c,0x04,0xb0,0x06,0x34,0x84,0x80,0x00,0x8c,0x83,0x00,0x00,0x3c,0x02,0x12,0x00, +0x3c,0x05,0xb0,0x03,0x00,0x62,0x18,0x25,0x34,0xa5,0x00,0x8b,0x24,0x02,0xff,0x80, +0xac,0x83,0x00,0x00,0x03,0xe0,0x00,0x08,0xa0,0xa2,0x00,0x00,0x3c,0x04,0xb0,0x03, +0x34,0x84,0x00,0x0b,0x24,0x02,0x00,0x22,0x3c,0x05,0xb0,0x01,0x3c,0x06,0x45,0x67, +0x3c,0x0a,0xb0,0x09,0xa0,0x82,0x00,0x00,0x34,0xa5,0x00,0x04,0x34,0xc6,0x89,0xaa, +0x35,0x4a,0x00,0x04,0x24,0x02,0x01,0x23,0x3c,0x0b,0xb0,0x09,0x3c,0x07,0x01,0x23, +0x3c,0x0c,0xb0,0x09,0x3c,0x01,0xb0,0x01,0xac,0x20,0x00,0x00,0x27,0xbd,0xff,0xe0, +0xac,0xa0,0x00,0x00,0x35,0x6b,0x00,0x08,0x3c,0x01,0xb0,0x09,0xac,0x26,0x00,0x00, +0x34,0xe7,0x45,0x66,0xa5,0x42,0x00,0x00,0x35,0x8c,0x00,0x0c,0x24,0x02,0xcd,0xef, +0x3c,0x0d,0xb0,0x09,0x3c,0x08,0xcd,0xef,0x3c,0x0e,0xb0,0x09,0xad,0x67,0x00,0x00, +0xaf,0xb7,0x00,0x1c,0xa5,0x82,0x00,0x00,0xaf,0xb6,0x00,0x18,0xaf,0xb5,0x00,0x14, +0xaf,0xb4,0x00,0x10,0xaf,0xb3,0x00,0x0c,0xaf,0xb2,0x00,0x08,0xaf,0xb1,0x00,0x04, +0xaf,0xb0,0x00,0x00,0x35,0xad,0x00,0x10,0x35,0x08,0x01,0x22,0x35,0xce,0x00,0x14, +0x24,0x02,0x89,0xab,0x3c,0x0f,0xb0,0x09,0x3c,0x09,0x89,0xab,0x3c,0x10,0xb0,0x09, +0x3c,0x11,0xb0,0x09,0x3c,0x12,0xb0,0x09,0x3c,0x13,0xb0,0x09,0x3c,0x14,0xb0,0x09, +0x3c,0x15,0xb0,0x09,0x3c,0x16,0xb0,0x09,0x3c,0x17,0xb0,0x09,0xad,0xa8,0x00,0x00, +0x24,0x03,0xff,0xff,0xa5,0xc2,0x00,0x00,0x35,0xef,0x00,0x18,0x35,0x29,0xcd,0xee, +0x36,0x10,0x00,0x1c,0x36,0x31,0x00,0x20,0x36,0x52,0x00,0x24,0x36,0x73,0x00,0x28, +0x36,0x94,0x00,0x2c,0x36,0xb5,0x00,0x30,0x36,0xd6,0x00,0x34,0x36,0xf7,0x00,0x38, +0x24,0x02,0x45,0x67,0xad,0xe9,0x00,0x00,0xa6,0x02,0x00,0x00,0xae,0x23,0x00,0x00, +0x8f,0xb0,0x00,0x00,0xa6,0x43,0x00,0x00,0x8f,0xb1,0x00,0x04,0xae,0x63,0x00,0x00, +0x8f,0xb2,0x00,0x08,0xa6,0x83,0x00,0x00,0x8f,0xb3,0x00,0x0c,0xae,0xa3,0x00,0x00, +0x8f,0xb4,0x00,0x10,0xa6,0xc3,0x00,0x00,0x8f,0xb5,0x00,0x14,0xae,0xe3,0x00,0x00, +0x7b,0xb6,0x00,0xfc,0x3c,0x18,0xb0,0x09,0x37,0x18,0x00,0x3c,0xa7,0x03,0x00,0x00, +0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x20,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00, +0x34,0x63,0x00,0x20,0x24,0x42,0x51,0x38,0xac,0x62,0x00,0x00,0x8c,0x83,0x00,0x34, +0x34,0x02,0xff,0xff,0x00,0x43,0x10,0x2a,0x14,0x40,0x01,0x0b,0x00,0x80,0x30,0x21, +0x8c,0x84,0x00,0x08,0x24,0x02,0x00,0x03,0x10,0x82,0x00,0xfe,0x00,0x00,0x00,0x00, +0x8c,0xc2,0x00,0x2c,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x47,0x24,0x02,0x00,0x06, +0x3c,0x03,0xb0,0x05,0x34,0x63,0x04,0x50,0x90,0x62,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x42,0x00,0xff,0x14,0x40,0x00,0xe4,0xac,0xc2,0x00,0x2c,0x24,0x02,0x00,0x01, +0x10,0x82,0x00,0xe3,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x02,0x10,0x82,0x00,0xd1, +0x00,0x00,0x00,0x00,0x8c,0xc7,0x00,0x04,0x24,0x02,0x00,0x02,0x10,0xe2,0x00,0xc7, +0x00,0x00,0x00,0x00,0x8c,0xc2,0x00,0x14,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x09, +0x24,0x02,0x00,0x01,0x3c,0x03,0xb0,0x09,0x34,0x63,0x01,0x60,0x90,0x62,0x00,0x00, +0x00,0x00,0x00,0x00,0x30,0x42,0x00,0xff,0x10,0x40,0x00,0x05,0xac,0xc2,0x00,0x14, +0x24,0x02,0x00,0x01,0xac,0xc2,0x00,0x00,0x03,0xe0,0x00,0x08,0xac,0xc0,0x00,0x14, +0x3c,0x02,0xb0,0x03,0x34,0x42,0x00,0xd0,0x8c,0x43,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x61,0x00,0x16,0x3c,0x03,0xb0,0x05,0x34,0x63,0x02,0x2e,0x90,0x62,0x00,0x00, +0x00,0x00,0x00,0x00,0x30,0x42,0x00,0x01,0x14,0x40,0x00,0x10,0x3c,0x02,0xb0,0x05, +0x34,0x42,0x02,0x42,0x90,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x60,0x00,0x0b, +0x00,0x00,0x00,0x00,0x80,0xc2,0x00,0x50,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x07, +0x00,0x00,0x00,0x00,0x14,0x80,0x00,0x05,0x24,0x02,0x00,0x0e,0x24,0x03,0x00,0x01, +0xac,0xc2,0x00,0x00,0x03,0xe0,0x00,0x08,0xa0,0xc3,0x00,0x50,0x80,0xc2,0x00,0x31, +0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x0a,0x3c,0x02,0xb0,0x06,0x34,0x42,0x80,0x18, +0x8c,0x43,0x00,0x00,0x3c,0x04,0xf0,0x00,0x3c,0x02,0x80,0x00,0x00,0x64,0x18,0x24, +0x10,0x62,0x00,0x03,0x24,0x02,0x00,0x09,0x03,0xe0,0x00,0x08,0xac,0xc2,0x00,0x00, +0x8c,0xc2,0x00,0x40,0x00,0x00,0x00,0x00,0x8c,0x43,0x00,0x00,0x00,0x00,0x00,0x00, +0x10,0x60,0x00,0x09,0x3c,0x03,0xb0,0x03,0x3c,0x02,0xb0,0x05,0x34,0x42,0x02,0x2c, +0x8c,0x43,0x00,0x00,0x3c,0x04,0x00,0x02,0x00,0x64,0x18,0x24,0x14,0x60,0xff,0xf2, +0x24,0x02,0x00,0x10,0x3c,0x03,0xb0,0x03,0x34,0x63,0x02,0x01,0x90,0x62,0x00,0x00, +0x00,0x00,0x00,0x00,0x30,0x42,0x00,0x80,0x10,0x40,0x00,0x0e,0x00,0x00,0x00,0x00, +0x8c,0xc3,0x00,0x0c,0x00,0x00,0x00,0x00,0xac,0xc3,0x00,0x10,0x3c,0x02,0xb0,0x03, +0x90,0x42,0x02,0x01,0x00,0x00,0x00,0x00,0x30,0x42,0x00,0x0f,0xac,0xc2,0x00,0x0c, +0x90,0xc3,0x00,0x0f,0x24,0x02,0x00,0x0d,0x3c,0x01,0xb0,0x03,0x08,0x00,0x14,0xa6, +0xa0,0x23,0x02,0x01,0x3c,0x02,0xb0,0x09,0x34,0x42,0x01,0x80,0x90,0x44,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x04,0x1e,0x00,0x00,0x03,0x1e,0x03,0x10,0x60,0x00,0x15, +0xa0,0xc4,0x00,0x44,0x24,0x02,0x00,0x01,0x10,0x62,0x00,0x0b,0x24,0x02,0x00,0x02, +0x10,0x62,0x00,0x03,0x24,0x03,0x00,0x0d,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00, +0x8c,0xc2,0x00,0x0c,0xac,0xc3,0x00,0x00,0x24,0x03,0x00,0x04,0xac,0xc2,0x00,0x10, +0x03,0xe0,0x00,0x08,0xac,0xc3,0x00,0x0c,0x24,0x02,0x00,0x0d,0xac,0xc2,0x00,0x00, +0x24,0x03,0x00,0x04,0x24,0x02,0x00,0x06,0xac,0xc3,0x00,0x10,0x03,0xe0,0x00,0x08, +0xac,0xc2,0x00,0x0c,0x8c,0xc3,0x00,0x38,0x00,0x00,0x00,0x00,0x2c,0x62,0x00,0x06, +0x10,0x40,0x00,0x2e,0x00,0x03,0x10,0x80,0x3c,0x03,0x80,0x01,0x24,0x63,0x02,0x00, +0x00,0x43,0x10,0x21,0x8c,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x08, +0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xe2,0x00,0x06,0x24,0x02,0x00,0x03, +0x8c,0xa2,0x02,0xbc,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x06,0x3c,0x03,0xb0,0x06, +0x24,0x02,0x00,0x02,0xac,0xc2,0x00,0x00,0x24,0x02,0x00,0x01,0x03,0xe0,0x00,0x08, +0xac,0xc2,0x00,0x38,0x34,0x63,0x80,0x24,0x8c,0x62,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x42,0x00,0xff,0x10,0x40,0x00,0x05,0xac,0xc2,0x00,0x18,0x24,0x02,0x00,0x02, +0xac,0xc2,0x00,0x00,0x08,0x00,0x14,0xfa,0xac,0xc0,0x00,0x18,0x08,0x00,0x14,0xfa, +0xac,0xc0,0x00,0x00,0x24,0x02,0x00,0x02,0x24,0x03,0x00,0x0b,0xac,0xc2,0x00,0x38, +0x03,0xe0,0x00,0x08,0xac,0xc3,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xe2,0x00,0x05, +0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x0c,0xac,0xc2,0x00,0x00,0x08,0x00,0x14,0xfb, +0x24,0x02,0x00,0x04,0x08,0x00,0x15,0x12,0x24,0x02,0x00,0x03,0xac,0xc0,0x00,0x38, +0x03,0xe0,0x00,0x08,0xac,0xc0,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xe2,0x00,0x05, +0x24,0x02,0x00,0x03,0x80,0xc2,0x00,0x30,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x08, +0x24,0x02,0x00,0x04,0xac,0xc2,0x00,0x00,0x93,0x82,0x86,0x3c,0x00,0x00,0x00,0x00, +0x14,0x40,0xff,0xd6,0x24,0x02,0x00,0x05,0x03,0xe0,0x00,0x08,0xac,0xc0,0x00,0x38, +0x08,0x00,0x15,0x22,0xac,0xc0,0x00,0x00,0x3c,0x02,0xb0,0x06,0x34,0x42,0x80,0x18, +0x8c,0x43,0x00,0x00,0x3c,0x04,0xf0,0x00,0x3c,0x02,0x80,0x00,0x00,0x64,0x18,0x24, +0x10,0x62,0x00,0x03,0x24,0x02,0x00,0x09,0x08,0x00,0x15,0x26,0xac,0xc2,0x00,0x00, +0x24,0x02,0x00,0x05,0x08,0x00,0x15,0x18,0xac,0xc2,0x00,0x38,0x80,0xc2,0x00,0x30, +0x00,0x00,0x00,0x00,0x14,0x40,0xff,0x37,0x24,0x02,0x00,0x04,0x08,0x00,0x14,0xa6, +0x00,0x00,0x00,0x00,0x84,0xc2,0x00,0x20,0x00,0x00,0x00,0x00,0x10,0x40,0xff,0x66, +0x24,0x02,0x00,0x06,0x3c,0x02,0xb0,0x05,0x34,0x42,0x02,0x2e,0x90,0x43,0x00,0x00, +0x00,0x00,0x00,0x00,0x30,0x63,0x00,0x01,0x30,0x63,0x00,0xff,0x00,0x60,0x10,0x21, +0x14,0x40,0xff,0x24,0xa4,0xc3,0x00,0x20,0x08,0x00,0x14,0xa6,0x24,0x02,0x00,0x06, +0x8c,0xc2,0x00,0x1c,0x00,0x00,0x00,0x00,0x14,0x40,0xff,0x57,0x24,0x02,0x00,0x05, +0x3c,0x03,0xb0,0x05,0x34,0x63,0x02,0x2c,0x8c,0x62,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x42,0x00,0xff,0x10,0x40,0xff,0x14,0xac,0xc2,0x00,0x1c,0x08,0x00,0x14,0xa6, +0x24,0x02,0x00,0x05,0x3c,0x02,0xb0,0x05,0x8c,0x42,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x02,0x17,0x42,0x30,0x42,0x00,0x01,0x14,0x40,0xff,0x47,0x24,0x02,0x00,0x06, +0x08,0x00,0x14,0x5c,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x0a,0x03,0xe0,0x00,0x08, +0xac,0x82,0x00,0x00,0x27,0xbd,0xff,0xd8,0xaf,0xb0,0x00,0x10,0x27,0x90,0x86,0x48, +0xaf,0xbf,0x00,0x20,0xaf,0xb3,0x00,0x1c,0xaf,0xb2,0x00,0x18,0x0c,0x00,0x2b,0xe8, +0xaf,0xb1,0x00,0x14,0xaf,0x90,0x8f,0xd0,0x48,0x02,0x00,0x00,0x0c,0x00,0x13,0xec, +0x00,0x00,0x00,0x00,0x0c,0x00,0x18,0x4e,0x02,0x00,0x20,0x21,0x0c,0x00,0x00,0x34, +0x00,0x00,0x00,0x00,0x0c,0x00,0x13,0xf7,0x00,0x00,0x00,0x00,0x27,0x84,0x84,0x68, +0x0c,0x00,0x27,0xc1,0x00,0x00,0x00,0x00,0x93,0x84,0x80,0x10,0x0c,0x00,0x21,0x9a, +0x00,0x00,0x00,0x00,0x27,0x84,0x89,0x08,0x0c,0x00,0x06,0xe1,0x00,0x00,0x00,0x00, +0x0c,0x00,0x01,0x3b,0x00,0x00,0x00,0x00,0x27,0x84,0x84,0x10,0x0c,0x00,0x13,0xd5, +0x00,0x00,0x00,0x00,0x27,0x82,0x89,0x3c,0xaf,0x82,0x84,0x50,0x0c,0x00,0x00,0x61, +0x00,0x00,0x00,0x00,0x3c,0x03,0xb0,0x03,0x34,0x63,0x01,0x08,0x3c,0x04,0xb0,0x09, +0x3c,0x05,0xb0,0x09,0x8c,0x66,0x00,0x00,0x34,0x84,0x01,0x68,0x24,0x02,0xc8,0x80, +0x34,0xa5,0x01,0x40,0x24,0x03,0x00,0x0a,0xa4,0x82,0x00,0x00,0xa4,0xa3,0x00,0x00, +0x3c,0x04,0xb0,0x03,0x8c,0x82,0x00,0x00,0x8f,0x87,0x84,0x10,0xaf,0x86,0x84,0x08, +0x34,0x42,0x00,0x20,0xac,0x82,0x00,0x00,0x3c,0x02,0xb0,0x03,0x34,0x42,0x00,0x58, +0x8c,0x43,0x00,0x00,0x2c,0xe4,0x00,0x11,0x34,0x63,0x01,0x00,0xac,0x43,0x00,0x00, +0x10,0x80,0xff,0xfa,0x3c,0x02,0xb0,0x03,0x3c,0x03,0x80,0x01,0x00,0x07,0x10,0x80, +0x24,0x63,0x02,0x18,0x00,0x43,0x10,0x21,0x8c,0x44,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x80,0x00,0x08,0x00,0x00,0x00,0x00,0x27,0x84,0x84,0x68,0x0c,0x00,0x26,0xe5, +0x00,0x00,0x00,0x00,0x27,0x84,0x84,0x10,0x27,0x85,0x86,0x48,0x0c,0x00,0x14,0x4e, +0x00,0x00,0x00,0x00,0x3c,0x02,0xb0,0x09,0x34,0x42,0x00,0x07,0x3c,0x03,0xb0,0x06, +0x90,0x44,0x00,0x00,0x34,0x63,0x80,0x18,0x8c,0x65,0x00,0x00,0x3c,0x02,0xb0,0x03, +0x34,0x42,0x00,0xec,0x3c,0x03,0xb0,0x03,0x30,0x86,0x00,0xff,0xa0,0x46,0x00,0x00, +0x00,0x05,0x2f,0x02,0x34,0x63,0x00,0xed,0x24,0x02,0x00,0x01,0x10,0xc2,0x00,0x2c, +0xa0,0x65,0x00,0x00,0xa3,0x80,0x81,0x58,0x93,0x83,0x81,0xf1,0x24,0x02,0x00,0x01, +0x10,0x62,0x00,0x08,0x00,0x00,0x00,0x00,0x8f,0x87,0x84,0x10,0x8f,0x82,0x84,0x44, +0x00,0x00,0x00,0x00,0x24,0x42,0x00,0x01,0xaf,0x82,0x84,0x44,0x08,0x00,0x15,0x9b, +0x3c,0x02,0xb0,0x03,0x8f,0x87,0x84,0x10,0x00,0x00,0x00,0x00,0x24,0xe2,0xff,0xfc, +0x2c,0x42,0x00,0x03,0x14,0x40,0x00,0x0a,0x3c,0x03,0xb0,0x06,0x93,0x82,0x86,0x3c, +0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x07,0x34,0x63,0x80,0x18,0x27,0x84,0x84,0x68, +0x0c,0x00,0x27,0x75,0x00,0x00,0x00,0x00,0x8f,0x87,0x84,0x10,0x3c,0x03,0xb0,0x06, +0x34,0x63,0x80,0x18,0x8c,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x17,0x02, +0x10,0x40,0xff,0xe6,0x00,0x00,0x00,0x00,0x8f,0x82,0xbc,0x10,0x8f,0x84,0xbc,0x18, +0x3c,0x05,0xb0,0x01,0x00,0x45,0x10,0x21,0xac,0x44,0x00,0x00,0x8f,0x83,0xbc,0x10, +0x8f,0x82,0xbc,0x14,0x00,0x65,0x18,0x21,0x08,0x00,0x15,0xc7,0xac,0x62,0x00,0x04, +0x14,0xa0,0xff,0xd4,0x3c,0x02,0xb0,0x03,0x93,0x83,0x81,0x58,0x34,0x42,0x00,0xee, +0x24,0x63,0x00,0x01,0x30,0x64,0x00,0xff,0x2c,0x84,0x00,0xf1,0xa0,0x43,0x00,0x00, +0xa3,0x83,0x81,0x58,0x14,0x80,0xff,0xcc,0x00,0x00,0x00,0x00,0xaf,0x86,0x84,0x24, +0xa3,0x86,0x86,0x23,0x08,0x00,0x15,0xc1,0x00,0x00,0x00,0x00,0x27,0x84,0x84,0x68, +0x0c,0x00,0x29,0x6e,0x00,0x00,0x00,0x00,0xa3,0x82,0x84,0x41,0x8f,0x82,0x84,0x44, +0xaf,0x80,0x84,0x10,0x24,0x42,0x00,0x01,0xaf,0x82,0x84,0x44,0x08,0x00,0x15,0x9a, +0x00,0x00,0x38,0x21,0x27,0x84,0x86,0x48,0x0c,0x00,0x19,0x19,0x00,0x00,0x00,0x00, +0x30,0x42,0x00,0xff,0x14,0x40,0x00,0x05,0x3c,0x03,0xb0,0x05,0xaf,0x80,0x84,0x10, +0xaf,0x80,0x84,0x14,0x08,0x00,0x15,0xc6,0x00,0x00,0x00,0x00,0x34,0x63,0x04,0x50, +0x90,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x42,0x00,0xff,0xaf,0x82,0x84,0x3c, +0x14,0x40,0x00,0x20,0x24,0x02,0x00,0x01,0x8f,0x84,0x84,0x18,0x00,0x00,0x00,0x00, +0x10,0x82,0x00,0x20,0x3c,0x03,0xb0,0x09,0x34,0x63,0x01,0x60,0x90,0x62,0x00,0x00, +0x00,0x00,0x00,0x00,0x30,0x42,0x00,0xff,0xaf,0x82,0x84,0x24,0x14,0x40,0x00,0x15, +0x24,0x02,0x00,0x01,0x24,0x02,0x00,0x02,0x10,0x82,0x00,0x07,0x00,0x00,0x00,0x00, +0x24,0x07,0x00,0x03,0x24,0x02,0x00,0x01,0xaf,0x82,0x84,0x14,0xaf,0x87,0x84,0x10, +0x08,0x00,0x15,0xc6,0x00,0x00,0x00,0x00,0x3c,0x02,0xb0,0x05,0x34,0x42,0x02,0x2e, +0x90,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x63,0x00,0x01,0x30,0x63,0x00,0xff, +0x00,0x60,0x10,0x21,0xa7,0x83,0x84,0x30,0x14,0x40,0xff,0xf1,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x01,0xaf,0x82,0x84,0x14,0xaf,0x80,0x84,0x10,0x08,0x00,0x15,0xc6, +0x00,0x00,0x00,0x00,0x3c,0x03,0xb0,0x05,0x34,0x63,0x02,0x2c,0x8c,0x62,0x00,0x00, +0x00,0x00,0x00,0x00,0x30,0x42,0x00,0xff,0xaf,0x82,0x84,0x2c,0x14,0x40,0xff,0xf5, +0x24,0x02,0x00,0x01,0x08,0x00,0x16,0x1a,0x3c,0x03,0xb0,0x09,0x27,0x84,0x86,0x48, +0x0c,0x00,0x1a,0xde,0x00,0x00,0x00,0x00,0x83,0x82,0x84,0x40,0x00,0x00,0x00,0x00, +0x14,0x40,0xff,0xec,0x24,0x02,0x00,0x02,0x3c,0x03,0xb0,0x05,0x34,0x63,0x04,0x50, +0x90,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x42,0x00,0xff,0xaf,0x82,0x84,0x3c, +0x14,0x40,0xff,0xe4,0x24,0x02,0x00,0x02,0x8f,0x84,0x84,0x18,0x24,0x02,0x00,0x01, +0x10,0x82,0x00,0x12,0x24,0x02,0x00,0x02,0x10,0x82,0x00,0x04,0x00,0x00,0x00,0x00, +0x24,0x07,0x00,0x04,0x08,0x00,0x16,0x26,0x24,0x02,0x00,0x02,0x3c,0x02,0xb0,0x05, +0x34,0x42,0x02,0x2e,0x90,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x63,0x00,0x01, +0x30,0x63,0x00,0xff,0x00,0x60,0x10,0x21,0xa7,0x83,0x84,0x30,0x14,0x40,0xff,0xf4, +0x00,0x00,0x00,0x00,0x08,0x00,0x16,0x35,0x24,0x02,0x00,0x02,0x3c,0x03,0xb0,0x05, +0x34,0x63,0x02,0x2c,0x8c,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x42,0x00,0xff, +0xaf,0x82,0x84,0x2c,0x14,0x40,0xff,0xf7,0x00,0x00,0x00,0x00,0x08,0x00,0x16,0x56, +0x24,0x02,0x00,0x02,0x27,0x84,0x89,0x08,0x0c,0x00,0x0b,0x51,0x00,0x00,0x00,0x00, +0x8f,0x83,0x84,0x14,0xaf,0x82,0x84,0x2c,0x38,0x64,0x00,0x02,0x00,0x04,0x18,0x0a, +0xaf,0x83,0x84,0x14,0x14,0x40,0xff,0xad,0x24,0x07,0x00,0x05,0x8f,0x82,0x89,0x48, +0xaf,0x80,0x84,0x10,0x10,0x40,0x00,0x02,0x24,0x04,0x00,0x01,0xaf,0x84,0x84,0x18, +0x93,0x82,0x89,0x56,0x00,0x00,0x00,0x00,0x10,0x40,0xff,0x43,0x00,0x00,0x00,0x00, +0x3c,0x02,0xb0,0x05,0x34,0x42,0x00,0x08,0x8c,0x43,0x00,0x00,0x3c,0x04,0x20,0x00, +0x00,0x64,0x18,0x24,0x10,0x60,0xff,0x3c,0x00,0x00,0x00,0x00,0x3c,0x02,0xb0,0x03, +0x34,0x42,0x00,0xa0,0x8c,0x43,0x00,0x00,0x3c,0x04,0x80,0x00,0xaf,0x80,0x89,0x30, +0x24,0x63,0x00,0x01,0xac,0x43,0x00,0x00,0x3c,0x01,0xb0,0x05,0xac,0x24,0x00,0x08, +0xaf,0x80,0x89,0x2c,0xaf,0x80,0x89,0x34,0xaf,0x80,0x89,0x38,0xaf,0x80,0x89,0x44, +0xaf,0x80,0x89,0x3c,0x08,0x00,0x15,0xc6,0x00,0x00,0x00,0x00,0x83,0x82,0x84,0x60, +0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x02,0x24,0x02,0x00,0x20,0xaf,0x82,0x84,0x2c, +0x8f,0x85,0x84,0x2c,0x27,0x84,0x89,0x08,0x0c,0x00,0x0d,0x2c,0x00,0x00,0x00,0x00, +0x00,0x02,0x1e,0x00,0xa3,0x82,0x84,0x40,0xaf,0x80,0x84,0x2c,0x10,0x60,0xff,0x8e, +0x00,0x00,0x00,0x00,0x3c,0x02,0xb0,0x05,0x34,0x42,0x02,0x2e,0x90,0x43,0x00,0x00, +0x00,0x00,0x00,0x00,0x30,0x63,0x00,0x01,0x30,0x63,0x00,0xff,0x00,0x60,0x10,0x21, +0xa7,0x83,0x84,0x30,0x10,0x40,0x00,0x04,0x24,0x04,0x00,0x02,0xaf,0x84,0x84,0x18, +0x08,0x00,0x16,0x36,0x00,0x00,0x00,0x00,0x08,0x00,0x16,0x27,0x24,0x07,0x00,0x06, +0x27,0x84,0x84,0x10,0x27,0x85,0x89,0x08,0x0c,0x00,0x0d,0xf9,0x00,0x00,0x00,0x00, +0x8f,0x82,0x84,0x34,0xaf,0x80,0x84,0x3c,0x14,0x40,0x00,0x19,0x00,0x40,0x18,0x21, +0x8f,0x82,0x84,0x38,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x15,0x24,0x02,0x00,0x02, +0x8f,0x83,0x84,0x18,0x00,0x00,0x00,0x00,0x10,0x62,0x00,0x0b,0x3c,0x02,0x40,0x00, +0x8f,0x83,0x84,0x14,0x24,0x02,0x00,0x01,0x10,0x62,0x00,0x02,0x24,0x07,0x00,0x03, +0x24,0x07,0x00,0x06,0xaf,0x87,0x84,0x10,0x24,0x04,0x00,0x03,0xaf,0x84,0x84,0x18, +0x08,0x00,0x15,0xc6,0x00,0x00,0x00,0x00,0x34,0x42,0x00,0x14,0x3c,0x01,0xb0,0x05, +0xac,0x22,0x00,0x00,0xaf,0x80,0x84,0x10,0x08,0x00,0x16,0xcf,0x24,0x04,0x00,0x03, +0x10,0x60,0x00,0x10,0x00,0x00,0x00,0x00,0x27,0x84,0x84,0x10,0x27,0x85,0x89,0x08, +0x0c,0x00,0x0e,0x1d,0x00,0x00,0x00,0x00,0x8f,0x83,0x84,0x14,0x24,0x02,0x00,0x01, +0xa3,0x80,0x84,0x40,0xaf,0x80,0x84,0x18,0x10,0x62,0x00,0x02,0x24,0x07,0x00,0x03, +0x24,0x07,0x00,0x04,0xaf,0x87,0x84,0x10,0xaf,0x80,0x84,0x34,0x08,0x00,0x15,0xc6, +0x00,0x00,0x00,0x00,0x83,0x82,0x84,0x60,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x04, +0x00,0x00,0x00,0x00,0x27,0x84,0x89,0x08,0x0c,0x00,0x10,0x65,0x00,0x00,0x00,0x00, +0x8f,0x82,0x84,0x14,0xa3,0x80,0x84,0x40,0xaf,0x80,0x84,0x10,0xaf,0x80,0x84,0x18, +0x14,0x40,0x00,0x03,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x02,0xaf,0x82,0x84,0x14, +0xaf,0x80,0x84,0x38,0x08,0x00,0x15,0xc6,0x00,0x00,0x00,0x00,0x27,0x84,0x84,0x10, +0x27,0x85,0x89,0x08,0x0c,0x00,0x0e,0x1d,0x00,0x00,0x00,0x00,0x8f,0x82,0x84,0x14, +0xa3,0x80,0x84,0x40,0xaf,0x80,0x84,0x10,0xaf,0x80,0x84,0x18,0x14,0x40,0xfe,0xc2, +0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x02,0xaf,0x82,0x84,0x14,0x08,0x00,0x15,0xc6, +0x00,0x00,0x00,0x00,0x27,0x84,0x89,0x08,0x0c,0x00,0x10,0x65,0x00,0x00,0x00,0x00, +0x08,0x00,0x16,0xff,0x00,0x00,0x00,0x00,0x27,0x84,0x84,0x68,0x0c,0x00,0x2a,0x96, +0x00,0x00,0x00,0x00,0x08,0x00,0x15,0xfe,0x00,0x00,0x00,0x00,0x0c,0x00,0x24,0x66, +0x00,0x00,0x00,0x00,0x0c,0x00,0x27,0x56,0x00,0x00,0x00,0x00,0x0c,0x00,0x18,0x40, +0x00,0x00,0x00,0x00,0x27,0x84,0x84,0x68,0x0c,0x00,0x27,0x64,0x00,0x00,0x00,0x00, +0x93,0x83,0xbc,0x08,0x00,0x00,0x00,0x00,0x14,0x60,0x00,0x2b,0x3c,0x02,0xb0,0x03, +0x34,0x42,0x01,0x08,0x8c,0x44,0x00,0x00,0x8f,0x83,0xbc,0x00,0x8f,0x82,0xbc,0x04, +0x00,0x83,0x18,0x23,0x00,0x43,0x10,0x2b,0x10,0x40,0x00,0x23,0x3c,0x02,0xb0,0x03, +0x24,0x04,0x05,0xa0,0x34,0x42,0x01,0x18,0x8c,0x42,0x00,0x00,0x0c,0x00,0x06,0xce, +0x00,0x00,0x00,0x00,0x24,0x04,0x05,0xa4,0x0c,0x00,0x06,0xce,0x00,0x02,0x84,0x02, +0x30,0x51,0xff,0xff,0x24,0x04,0x05,0xa8,0x00,0x02,0x94,0x02,0x0c,0x00,0x06,0xce, +0x3a,0x10,0xff,0xff,0x3a,0x31,0xff,0xff,0x30,0x42,0xff,0xff,0x2e,0x10,0x00,0x01, +0x2e,0x31,0x00,0x01,0x3a,0x52,0xff,0xff,0x02,0x11,0x80,0x25,0x2e,0x52,0x00,0x01, +0x38,0x42,0xff,0xff,0x02,0x12,0x80,0x25,0x2c,0x42,0x00,0x01,0x02,0x02,0x80,0x25, +0x16,0x00,0x00,0x02,0x24,0x04,0x00,0x02,0x00,0x00,0x20,0x21,0x0c,0x00,0x05,0x70, +0x00,0x00,0x00,0x00,0x3c,0x02,0xb0,0x03,0x34,0x42,0x01,0x08,0x8c,0x43,0x00,0x00, +0x00,0x00,0x00,0x00,0xaf,0x83,0xbc,0x00,0x0c,0x00,0x01,0xeb,0x00,0x00,0x00,0x00, +0xaf,0x80,0x84,0x10,0xaf,0x80,0x84,0x44,0x08,0x00,0x15,0x9a,0x00,0x00,0x38,0x21, +0x27,0x90,0xb3,0xf0,0x24,0x11,0x00,0x12,0x8e,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x90,0x82,0x00,0x10,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x03,0x00,0x00,0x00,0x00, +0x0c,0x00,0x20,0xd0,0x00,0x00,0x00,0x00,0x26,0x31,0xff,0xff,0x06,0x21,0xff,0xf6, +0x26,0x10,0x00,0x04,0xaf,0x80,0x84,0x10,0x08,0x00,0x15,0xc7,0x00,0x00,0x38,0x21, +0x3c,0x02,0xb0,0x03,0x34,0x42,0x01,0x08,0x8c,0x44,0x00,0x00,0x8f,0x82,0x84,0x08, +0x00,0x04,0x19,0xc2,0x00,0x02,0x11,0xc2,0x10,0x62,0xff,0xf6,0x00,0x00,0x00,0x00, +0x3c,0x02,0xb0,0x03,0x34,0x42,0x01,0x02,0x90,0x43,0x00,0x00,0x3c,0x12,0xb0,0x05, +0xaf,0x84,0x84,0x08,0x30,0x63,0x00,0xff,0x00,0x03,0x11,0x40,0x00,0x43,0x10,0x23, +0x00,0x02,0x10,0x80,0x00,0x43,0x10,0x21,0x00,0x02,0x99,0x00,0x00,0x00,0x88,0x21, +0x36,0x52,0x02,0x2c,0x27,0x90,0xb3,0xf0,0x8e,0x04,0x00,0x00,0x00,0x00,0x00,0x00, +0x90,0x83,0x00,0x16,0x00,0x00,0x00,0x00,0x30,0x62,0x00,0x03,0x10,0x40,0x00,0x06, +0x30,0x62,0x00,0x1c,0x14,0x40,0x00,0x04,0x00,0x00,0x00,0x00,0x8f,0x85,0x84,0x08, +0x0c,0x00,0x1e,0xb2,0x02,0x60,0x30,0x21,0x8e,0x42,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x42,0x00,0xff,0x14,0x40,0xff,0xd7,0x00,0x00,0x00,0x00,0x26,0x31,0x00,0x01, +0x2a,0x22,0x00,0x13,0x14,0x40,0xff,0xec,0x26,0x10,0x00,0x04,0x08,0x00,0x17,0x5d, +0x00,0x00,0x00,0x00,0x8f,0x84,0x84,0x1c,0x27,0x85,0x89,0x08,0x0c,0x00,0x17,0xd3, +0x00,0x00,0x00,0x00,0x8f,0x83,0x84,0x1c,0x24,0x02,0x00,0x04,0x14,0x62,0xfe,0xa2, +0x00,0x00,0x00,0x00,0x08,0x00,0x16,0x27,0x24,0x07,0x00,0x05,0x27,0x84,0x89,0x08, +0x0c,0x00,0x24,0x8d,0x00,0x00,0x00,0x00,0x24,0x07,0x00,0x05,0xaf,0x87,0x84,0x10, +0x08,0x00,0x15,0xc7,0x00,0x00,0x00,0x00,0x8f,0x82,0x89,0x3c,0x00,0x00,0x00,0x00, +0x10,0x40,0x00,0x0d,0x00,0x00,0x00,0x00,0x8f,0x84,0xb4,0x30,0xaf,0x80,0x89,0x3c, +0x94,0x85,0x00,0x14,0x0c,0x00,0x1b,0x84,0x00,0x00,0x00,0x00,0x93,0x82,0x8b,0x61, +0x00,0x00,0x00,0x00,0x30,0x42,0x00,0x02,0x10,0x40,0x00,0x03,0x00,0x00,0x00,0x00, +0x0c,0x00,0x01,0x59,0x00,0x00,0x20,0x21,0x8f,0x84,0xb4,0x30,0x0c,0x00,0x20,0xd0, +0x00,0x00,0x00,0x00,0x08,0x00,0x17,0x5d,0x00,0x00,0x00,0x00,0x3c,0x02,0xff,0x90, +0x27,0xbd,0xff,0xe8,0x00,0x80,0x18,0x21,0x34,0x42,0x00,0x01,0x27,0x84,0x89,0x08, +0x10,0x62,0x00,0x05,0xaf,0xbf,0x00,0x10,0x8f,0xbf,0x00,0x10,0x00,0x00,0x00,0x00, +0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x18,0x0c,0x00,0x06,0xe1,0x00,0x00,0x00,0x00, +0x27,0x84,0x86,0x48,0x0c,0x00,0x18,0x4e,0x00,0x00,0x00,0x00,0x27,0x84,0x84,0x10, +0x0c,0x00,0x13,0xd5,0x00,0x00,0x00,0x00,0x08,0x00,0x17,0xba,0x00,0x00,0x00,0x00, +0x8f,0x82,0x89,0x48,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x05,0x00,0x00,0x18,0x21, +0x8f,0x82,0x84,0x18,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x02,0x00,0x00,0x00,0x00, +0x24,0x03,0x00,0x01,0x03,0xe0,0x00,0x08,0x00,0x60,0x10,0x21,0x27,0xbd,0xff,0xe0, +0x3c,0x06,0xb0,0x03,0xaf,0xb1,0x00,0x14,0xaf,0xb0,0x00,0x10,0x34,0xc6,0x00,0x5f, +0xaf,0xbf,0x00,0x18,0x90,0xc3,0x00,0x00,0x3c,0x07,0xb0,0x03,0x34,0xe7,0x00,0x5d, +0x34,0x63,0x00,0x01,0x3c,0x09,0xb0,0x03,0x24,0x02,0x00,0x01,0xa0,0xc3,0x00,0x00, +0x00,0x80,0x80,0x21,0xa0,0xe2,0x00,0x00,0x00,0xa0,0x88,0x21,0x35,0x29,0x00,0x5e, +0x00,0xe0,0x40,0x21,0x24,0x04,0x00,0x01,0x91,0x22,0x00,0x00,0x91,0x03,0x00,0x00, +0x30,0x42,0x00,0x01,0x14,0x83,0x00,0x03,0x30,0x42,0x00,0x01,0x14,0x40,0xff,0xfa, +0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x04,0x12,0x02,0x00,0x2c,0x24,0x05,0x0f,0x00, +0x24,0x02,0x00,0x06,0x12,0x02,0x00,0x08,0x24,0x05,0x00,0x0f,0x3c,0x02,0xb0,0x03, +0x34,0x42,0x02,0x00,0xa0,0x50,0x00,0x00,0x8f,0xbf,0x00,0x18,0x7b,0xb0,0x00,0xbc, +0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x20,0x24,0x04,0x0c,0x04,0x0c,0x00,0x13,0x5b, +0x24,0x06,0x00,0x0f,0x24,0x04,0x0d,0x04,0x24,0x05,0x00,0x0f,0x0c,0x00,0x13,0x5b, +0x24,0x06,0x00,0x0f,0x24,0x04,0x08,0x80,0x24,0x05,0x1e,0x00,0x0c,0x00,0x13,0x5b, +0x24,0x06,0x00,0x0f,0x24,0x04,0x08,0x8c,0x24,0x05,0x0f,0x00,0x0c,0x00,0x13,0x5b, +0x24,0x06,0x00,0x0f,0x24,0x04,0x08,0x24,0x3c,0x05,0x00,0x30,0x0c,0x00,0x13,0x5b, +0x24,0x06,0x00,0x02,0x24,0x04,0x08,0x2c,0x3c,0x05,0x00,0x30,0x0c,0x00,0x13,0x5b, +0x24,0x06,0x00,0x02,0x24,0x04,0x08,0x34,0x3c,0x05,0x00,0x30,0x0c,0x00,0x13,0x5b, +0x24,0x06,0x00,0x02,0x24,0x04,0x08,0x3c,0x3c,0x05,0x00,0x30,0x0c,0x00,0x13,0x5b, +0x24,0x06,0x00,0x02,0x08,0x00,0x17,0xf4,0x3c,0x02,0xb0,0x03,0x24,0x04,0x08,0x8c, +0x0c,0x00,0x13,0x5b,0x24,0x06,0x00,0x04,0x24,0x04,0x08,0x80,0x24,0x05,0x1e,0x00, +0x0c,0x00,0x13,0x5b,0x24,0x06,0x00,0x04,0x24,0x04,0x0c,0x04,0x24,0x05,0x00,0x0f, +0x0c,0x00,0x13,0x5b,0x24,0x06,0x00,0x04,0x24,0x04,0x0d,0x04,0x24,0x05,0x00,0x0f, +0x0c,0x00,0x13,0x5b,0x24,0x06,0x00,0x04,0x24,0x04,0x08,0x24,0x3c,0x05,0x00,0x30, +0x0c,0x00,0x13,0x5b,0x24,0x06,0x00,0x03,0x24,0x04,0x08,0x2c,0x3c,0x05,0x00,0x30, +0x0c,0x00,0x13,0x5b,0x24,0x06,0x00,0x03,0x24,0x04,0x08,0x34,0x3c,0x05,0x00,0x30, +0x0c,0x00,0x13,0x5b,0x24,0x06,0x00,0x02,0x3c,0x05,0x00,0x30,0x24,0x06,0x00,0x03, +0x0c,0x00,0x13,0x5b,0x24,0x04,0x08,0x3c,0x02,0x20,0x20,0x21,0x24,0x05,0x00,0x14, +0x0c,0x00,0x13,0xa0,0x24,0x06,0x01,0x07,0x08,0x00,0x17,0xf4,0x3c,0x02,0xb0,0x03, +0x3c,0x03,0xb0,0x03,0x34,0x63,0x00,0x73,0x90,0x62,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x42,0x00,0x02,0x14,0x40,0x00,0x04,0x00,0x00,0x00,0x00,0xa3,0x80,0x81,0x59, +0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0xa3,0x82,0x81,0x59, +0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00, +0x00,0x80,0x70,0x21,0x34,0x63,0x00,0x20,0x24,0x42,0x61,0x38,0x3c,0x04,0xb0,0x03, +0xac,0x62,0x00,0x00,0x34,0x84,0x00,0x30,0xad,0xc0,0x02,0xbc,0xad,0xc0,0x02,0xb8, +0x8c,0x83,0x00,0x00,0x24,0x02,0x00,0xff,0xa5,0xc0,0x00,0x0a,0x00,0x00,0x30,0x21, +0xa7,0x82,0x8f,0xe0,0x27,0x88,0x8f,0xf0,0xa5,0xc3,0x00,0x08,0x3c,0x07,0xb0,0x08, +0x30,0xc2,0xff,0xff,0x00,0x02,0x20,0xc0,0x24,0xc3,0x00,0x01,0x00,0x82,0x10,0x21, +0x00,0x60,0x30,0x21,0x00,0x02,0x10,0x80,0x30,0x63,0xff,0xff,0x00,0x48,0x10,0x21, +0x00,0x87,0x20,0x21,0x28,0xc5,0x00,0xff,0xac,0x83,0x00,0x00,0x14,0xa0,0xff,0xf4, +0xa4,0x43,0x00,0x00,0x3c,0x02,0xb0,0x08,0x34,0x03,0xff,0xff,0x25,0xc4,0x00,0x0c, +0x24,0x0a,0x00,0x02,0x34,0x42,0x07,0xf8,0x3c,0x06,0xb0,0x03,0xa7,0x83,0xb3,0xcc, +0xac,0x43,0x00,0x00,0xaf,0x84,0xb3,0xf0,0x34,0xc6,0x00,0x64,0xa0,0x8a,0x00,0x18, +0x94,0xc5,0x00,0x00,0x8f,0x82,0xb3,0xf0,0x25,0xc4,0x00,0x30,0x24,0x08,0x00,0x03, +0x3c,0x03,0xb0,0x03,0xa0,0x45,0x00,0x21,0x34,0x63,0x00,0x66,0xaf,0x84,0xb3,0xf4, +0xa0,0x88,0x00,0x18,0x94,0x65,0x00,0x00,0x8f,0x82,0xb3,0xf4,0x25,0xc4,0x00,0x54, +0x25,0xc7,0x00,0x78,0xa0,0x45,0x00,0x21,0xaf,0x84,0xb3,0xf8,0xa0,0x88,0x00,0x18, +0x94,0x65,0x00,0x00,0x8f,0x82,0xb3,0xf8,0x25,0xc8,0x00,0x9c,0x24,0x09,0x00,0x01, +0xa0,0x45,0x00,0x21,0xaf,0x87,0xb3,0xfc,0xa0,0xea,0x00,0x18,0x94,0xc4,0x00,0x00, +0x8f,0x82,0xb3,0xfc,0x3c,0x03,0xb0,0x03,0x34,0x63,0x00,0x62,0xa0,0x44,0x00,0x21, +0xaf,0x88,0xb4,0x00,0xa1,0x09,0x00,0x18,0x94,0x65,0x00,0x00,0x8f,0x82,0xb4,0x00, +0x25,0xc4,0x00,0xc0,0x3c,0x06,0xb0,0x03,0xa0,0x45,0x00,0x21,0xaf,0x84,0xb4,0x04, +0xa0,0x89,0x00,0x18,0x94,0x65,0x00,0x00,0x8f,0x82,0xb4,0x04,0x25,0xc4,0x00,0xe4, +0x34,0xc6,0x00,0x60,0xa0,0x45,0x00,0x21,0xaf,0x84,0xb4,0x08,0xa0,0x80,0x00,0x18, +0x94,0xc5,0x00,0x00,0x8f,0x82,0xb4,0x08,0x25,0xc3,0x01,0x08,0x25,0xc7,0x01,0x2c, +0xa0,0x45,0x00,0x21,0xaf,0x83,0xb4,0x0c,0xa0,0x60,0x00,0x18,0x94,0xc8,0x00,0x00, +0x8f,0x82,0xb4,0x0c,0x25,0xc4,0x01,0x50,0x25,0xc5,0x01,0x74,0xa0,0x48,0x00,0x21, +0x25,0xc6,0x01,0x98,0x25,0xc9,0x01,0xbc,0x25,0xca,0x01,0xe0,0x25,0xcb,0x02,0x04, +0x25,0xcc,0x02,0x28,0x25,0xcd,0x02,0x4c,0x24,0x02,0x00,0x10,0x3c,0x03,0xb0,0x03, +0xaf,0x87,0xb4,0x10,0x34,0x63,0x00,0x38,0xa0,0xe0,0x00,0x18,0xaf,0x84,0xb4,0x14, +0xa0,0x80,0x00,0x18,0xaf,0x85,0xb4,0x18,0xa0,0xa0,0x00,0x18,0xaf,0x86,0xb4,0x1c, +0xa0,0xc0,0x00,0x18,0xaf,0x89,0xb4,0x20,0xa1,0x20,0x00,0x18,0xaf,0x8a,0xb4,0x24, +0xa1,0x40,0x00,0x18,0xaf,0x8b,0xb4,0x28,0xa1,0x60,0x00,0x18,0xaf,0x8c,0xb4,0x2c, +0xa1,0x80,0x00,0x18,0xaf,0x8d,0xb4,0x30,0xa1,0xa2,0x00,0x18,0x94,0x64,0x00,0x00, +0x8f,0x82,0xb4,0x30,0x25,0xc5,0x02,0x70,0x3c,0x03,0xb0,0x03,0xa0,0x44,0x00,0x21, +0x24,0x02,0x00,0x11,0xaf,0x85,0xb4,0x34,0x34,0x63,0x00,0x6e,0xa0,0xa2,0x00,0x18, +0x94,0x64,0x00,0x00,0x8f,0x82,0xb4,0x34,0x25,0xc5,0x02,0x94,0x3c,0x03,0xb0,0x03, +0xa0,0x44,0x00,0x21,0x24,0x02,0x00,0x12,0xaf,0x85,0xb4,0x38,0x34,0x63,0x00,0x6c, +0xa0,0xa2,0x00,0x18,0x94,0x64,0x00,0x00,0x8f,0x82,0xb4,0x38,0x24,0x05,0xff,0xff, +0x24,0x07,0x00,0x01,0xa0,0x44,0x00,0x21,0x24,0x06,0x00,0x12,0x27,0x84,0xb3,0xf0, +0x8c,0x82,0x00,0x00,0x24,0xc6,0xff,0xff,0xa0,0x40,0x00,0x04,0x8c,0x83,0x00,0x00, +0xa4,0x45,0x00,0x00,0xa4,0x45,0x00,0x02,0xa0,0x60,0x00,0x0a,0x8c,0x82,0x00,0x00, +0xa4,0x65,0x00,0x06,0xa4,0x65,0x00,0x08,0xa0,0x40,0x00,0x10,0x8c,0x83,0x00,0x00, +0xa4,0x45,0x00,0x0c,0xa4,0x45,0x00,0x0e,0xa0,0x60,0x00,0x12,0x8c,0x82,0x00,0x00, +0x00,0x00,0x00,0x00,0xa0,0x40,0x00,0x16,0x8c,0x83,0x00,0x00,0xa4,0x45,0x00,0x14, +0xa0,0x67,0x00,0x17,0x8c,0x82,0x00,0x00,0x24,0x84,0x00,0x04,0xa0,0x40,0x00,0x20, +0x04,0xc1,0xff,0xe7,0xac,0x40,0x00,0x1c,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00, +0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00,0x34,0x63,0x00,0x20,0x24,0x42,0x64,0x00, +0x00,0x05,0x28,0x40,0xac,0x62,0x00,0x00,0x00,0xa6,0x28,0x21,0x2c,0xe2,0x00,0x10, +0x14,0x80,0x00,0x06,0x00,0x00,0x18,0x21,0x10,0x40,0x00,0x02,0x00,0x00,0x00,0x00, +0x00,0xe0,0x18,0x21,0x03,0xe0,0x00,0x08,0x00,0x60,0x10,0x21,0x24,0x02,0x00,0x20, +0x10,0xe2,0x00,0x06,0x2c,0xe4,0x00,0x10,0x24,0xa2,0x00,0x01,0x10,0x80,0xff,0xf9, +0x00,0x02,0x11,0x00,0x08,0x00,0x19,0x0d,0x00,0x47,0x18,0x21,0x08,0x00,0x19,0x0d, +0x24,0xa3,0x00,0x50,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00,0x27,0xbd,0xff,0xc8, +0x34,0x63,0x00,0x20,0x24,0x42,0x64,0x64,0xaf,0xb2,0x00,0x18,0xaf,0xbf,0x00,0x34, +0xaf,0xbe,0x00,0x30,0xaf,0xb7,0x00,0x2c,0xaf,0xb6,0x00,0x28,0xaf,0xb5,0x00,0x24, +0xaf,0xb4,0x00,0x20,0xaf,0xb3,0x00,0x1c,0xaf,0xb1,0x00,0x14,0xaf,0xb0,0x00,0x10, +0xac,0x62,0x00,0x00,0x8c,0x86,0x02,0xbc,0x00,0x80,0x90,0x21,0x14,0xc0,0x01,0x66, +0x00,0xc0,0x38,0x21,0x84,0x82,0x00,0x08,0x3c,0x03,0xb0,0x06,0x94,0x84,0x00,0x08, +0x00,0x02,0x10,0x80,0x00,0x43,0x10,0x21,0x8c,0x45,0x00,0x00,0x8c,0x43,0x00,0x00, +0x24,0x84,0x00,0x02,0x30,0x84,0x01,0xff,0x30,0xb1,0xff,0xff,0x00,0x03,0x44,0x02, +0xa6,0x44,0x00,0x08,0x14,0xe0,0x00,0x08,0x3c,0x03,0xb0,0x06,0x34,0x63,0x80,0x24, +0x8c,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x42,0x01,0x00,0xac,0x62,0x00,0x00, +0x8e,0x46,0x02,0xbc,0x00,0x00,0x00,0x00,0x14,0xc0,0x01,0x4c,0x00,0x11,0x98,0xc0, +0x00,0x11,0x3a,0x00,0x3c,0x04,0xb0,0x00,0x00,0xe4,0x20,0x21,0x8c,0x83,0x00,0x0c, +0x00,0x11,0x98,0xc0,0x02,0x71,0x10,0x21,0x00,0x03,0x1b,0x82,0x30,0x63,0x00,0x1f, +0x00,0x02,0x10,0x80,0x27,0x9e,0x8f,0xf4,0x00,0x5e,0x10,0x21,0x00,0x60,0x30,0x21, +0xac,0x44,0x00,0x18,0xae,0x43,0x02,0xbc,0x14,0xc0,0x00,0x10,0x3c,0x02,0xb0,0x00, +0x00,0x08,0x10,0xc0,0x00,0x48,0x10,0x21,0x27,0x84,0x8f,0xf0,0x00,0x02,0x10,0x80, +0x00,0x44,0x10,0x21,0x94,0x45,0x00,0x00,0x02,0x71,0x18,0x21,0x00,0x03,0x18,0x80, +0x00,0x64,0x18,0x21,0x24,0x02,0xff,0xff,0xa4,0x62,0x00,0x02,0xa4,0x68,0x00,0x04, +0xae,0x51,0x02,0xb8,0xa6,0x45,0x00,0x0a,0x3c,0x02,0xb0,0x00,0x00,0xe2,0x40,0x21, +0x8d,0x16,0x00,0x00,0x8d,0x14,0x00,0x04,0x02,0x71,0x10,0x21,0x00,0x02,0x38,0x80, +0x00,0x14,0x1a,0x02,0x27,0x84,0x90,0x00,0x30,0x63,0x00,0x1f,0x24,0x02,0x00,0x10, +0x00,0xe4,0x20,0x21,0xa6,0x43,0x00,0x06,0x8d,0x10,0x00,0x08,0xa0,0x82,0x00,0x06, +0x86,0x45,0x00,0x06,0x00,0xfe,0x10,0x21,0x24,0x03,0x00,0x13,0x10,0xa3,0x01,0x15, +0xac,0x48,0x00,0x18,0x3c,0x03,0xb0,0x03,0x34,0x63,0x01,0x00,0xa6,0x40,0x00,0x02, +0x3c,0x02,0xb0,0x03,0x90,0x64,0x00,0x00,0x34,0x42,0x01,0x08,0x8c,0x45,0x00,0x00, +0x00,0x10,0x1b,0xc2,0x27,0x82,0x8f,0xf0,0x00,0x04,0x20,0x82,0x00,0xe2,0x10,0x21, +0x30,0x63,0x00,0x01,0xac,0x45,0x00,0x08,0x10,0x60,0x00,0xec,0x30,0x97,0x00,0x01, +0x00,0x10,0x16,0x82,0x30,0x46,0x00,0x01,0x00,0x10,0x12,0x02,0x00,0x10,0x19,0xc2, +0x00,0x10,0x26,0x02,0x00,0x10,0x2e,0x42,0x30,0x47,0x00,0x7f,0x24,0x02,0x00,0x01, +0x30,0x75,0x00,0x01,0x30,0x84,0x00,0x01,0x10,0xc2,0x00,0xd9,0x30,0xa3,0x00,0x01, +0x0c,0x00,0x19,0x00,0x00,0x60,0x28,0x21,0x02,0x71,0x18,0x21,0x00,0x03,0x18,0x80, +0x2c,0x46,0x00,0x54,0x27,0x85,0x90,0x00,0x27,0x84,0x8f,0xf8,0x00,0x06,0x10,0x0a, +0x00,0x65,0x28,0x21,0x26,0xa6,0x00,0x02,0x00,0x64,0x18,0x21,0xa0,0xa2,0x00,0x02, +0xa0,0x66,0x00,0x06,0xa0,0x62,0x00,0x07,0xa0,0xa2,0x00,0x01,0x02,0x71,0x20,0x21, +0x00,0x04,0x20,0x80,0x00,0x9e,0x60,0x21,0x8d,0x85,0x00,0x18,0x00,0x10,0x15,0xc2, +0x30,0x42,0x00,0x01,0x8c,0xa3,0x00,0x0c,0xa6,0x42,0x00,0x00,0x27,0x82,0x90,0x10, +0x00,0x82,0x50,0x21,0xa6,0x56,0x00,0x04,0x8d,0x45,0x00,0x00,0x00,0x03,0x19,0x42, +0x3c,0x02,0xff,0xef,0x34,0x42,0xff,0xff,0x30,0x63,0x00,0x01,0x00,0xa2,0x48,0x24, +0x00,0x03,0x1d,0x00,0x01,0x23,0x48,0x25,0x00,0x09,0x15,0x02,0x26,0xc5,0x00,0x10, +0x00,0x14,0x19,0x82,0x00,0x14,0x25,0x82,0x00,0x10,0x34,0x02,0x00,0x10,0x3c,0x42, +0x00,0x10,0x44,0x82,0x30,0x42,0x00,0x01,0x30,0xb5,0xff,0xff,0x30,0xce,0x00,0x01, +0x30,0xe5,0x00,0x01,0x30,0x6d,0x00,0x01,0x30,0x8b,0x00,0x03,0x32,0x94,0x00,0x07, +0x31,0x06,0x00,0x01,0xad,0x49,0x00,0x00,0x10,0x40,0x00,0x0b,0x32,0x07,0x00,0x7f, +0x8d,0x84,0x00,0x18,0x3c,0x03,0xff,0xf0,0x34,0x63,0xff,0xff,0x8c,0x82,0x00,0x0c, +0x01,0x23,0x18,0x24,0x00,0x02,0x13,0x82,0x30,0x42,0x00,0x0f,0x00,0x02,0x14,0x00, +0x00,0x62,0x18,0x25,0xad,0x43,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xc2,0x00,0x90, +0x00,0x00,0x00,0x00,0x15,0xa0,0x00,0x03,0x00,0x00,0x00,0x00,0x15,0x60,0x00,0x81, +0x24,0x02,0x00,0x01,0x96,0x42,0x00,0x04,0x00,0x00,0x00,0x00,0x24,0x42,0x00,0x04, +0xa6,0x42,0x00,0x04,0x0c,0x00,0x19,0x00,0x01,0xc0,0x20,0x21,0x02,0x71,0x18,0x21, +0x00,0x03,0x38,0x80,0x2c,0x45,0x00,0x54,0x27,0x84,0x90,0x00,0x00,0xe4,0x20,0x21, +0x00,0x05,0x10,0x0a,0xa0,0x82,0x00,0x00,0xa0,0x80,0x00,0x04,0xa0,0x80,0x00,0x05, +0x96,0x45,0x00,0x04,0x27,0x82,0x8f,0xf0,0x00,0xe2,0x10,0x21,0xa4,0x45,0x00,0x06, +0x00,0xfe,0x18,0x21,0x92,0x45,0x00,0x01,0x8c,0x66,0x00,0x18,0x27,0x82,0x90,0x10, +0x00,0xe2,0x10,0x21,0xa0,0x40,0x00,0x00,0xa0,0x85,0x00,0x07,0x94,0xc3,0x00,0x10, +0x24,0x02,0x00,0x04,0x30,0x63,0x00,0x0f,0x10,0x62,0x00,0x5e,0x24,0xc6,0x00,0x10, +0x94,0xc3,0x00,0x16,0x27,0x85,0x90,0x08,0x00,0xe5,0x10,0x21,0xa4,0x43,0x00,0x02, +0x94,0xc2,0x00,0x04,0x00,0x00,0x00,0x00,0x30,0x42,0x00,0x01,0x14,0x40,0x00,0x4c, +0x02,0x71,0x20,0x21,0x94,0xc2,0x00,0x00,0x24,0x03,0x00,0xa4,0x30,0x42,0x00,0xff, +0x10,0x43,0x00,0x47,0x00,0x00,0x00,0x00,0x94,0xc2,0x00,0x00,0x24,0x03,0x00,0x88, +0x30,0x42,0x00,0x88,0x10,0x43,0x00,0x3c,0x02,0x71,0x18,0x21,0x27,0x84,0x90,0x10, +0x00,0x03,0x18,0x80,0x00,0x64,0x18,0x21,0x8c,0x62,0x00,0x00,0x3c,0x04,0x00,0x80, +0x00,0x44,0x10,0x25,0xac,0x62,0x00,0x00,0x02,0x71,0x10,0x21,0x00,0x02,0x10,0x80, +0x00,0x45,0x10,0x21,0xa0,0x54,0x00,0x00,0x92,0x43,0x02,0xbf,0x3c,0x02,0xb0,0x03, +0x34,0x42,0x00,0xc3,0xa0,0x43,0x00,0x00,0x8e,0x4b,0x02,0xbc,0x00,0x00,0x00,0x00, +0x11,0x60,0x00,0x1c,0x32,0xa2,0x00,0xff,0x00,0x15,0x1a,0x02,0x30,0x64,0xff,0xff, +0x38,0x42,0x00,0x00,0x24,0x65,0x00,0x01,0x00,0x82,0x28,0x0a,0x02,0x20,0x30,0x21, +0x10,0xa0,0x00,0x12,0x00,0x00,0x38,0x21,0x02,0x71,0x10,0x21,0x00,0x02,0x10,0x80, +0x27,0x83,0x8f,0xf0,0x00,0x43,0x20,0x21,0x24,0xa9,0xff,0xff,0x3c,0x0a,0xb0,0x08, +0x24,0x0c,0xff,0xff,0x00,0x06,0x10,0xc0,0x00,0x4a,0x10,0x21,0x8c,0x43,0x00,0x00, +0x24,0xe8,0x00,0x01,0x10,0xe9,0x00,0x0f,0x30,0x63,0x00,0xff,0x31,0x07,0xff,0xff, +0x00,0xe5,0x10,0x2b,0x14,0x40,0xff,0xf7,0x00,0x60,0x30,0x21,0x25,0x62,0xff,0xff, +0xae,0x42,0x02,0xbc,0x7b,0xbe,0x01,0xbc,0x7b,0xb6,0x01,0x7c,0x7b,0xb4,0x01,0x3c, +0x7b,0xb2,0x00,0xfc,0x7b,0xb0,0x00,0xbc,0x24,0x02,0x00,0x01,0x03,0xe0,0x00,0x08, +0x27,0xbd,0x00,0x38,0xa4,0x86,0x00,0x04,0xa4,0x8c,0x00,0x02,0xae,0x51,0x02,0xb8, +0x08,0x00,0x1a,0x2f,0xa6,0x43,0x00,0x0a,0x94,0xc2,0x00,0x18,0x00,0x00,0x00,0x00, +0x30,0x42,0x00,0x60,0x10,0x40,0xff,0xc1,0x02,0x71,0x18,0x21,0x02,0x71,0x20,0x21, +0x27,0x82,0x90,0x10,0x00,0x04,0x20,0x80,0x00,0x82,0x20,0x21,0x8c,0x83,0x00,0x00, +0x3c,0x02,0xff,0x7f,0x34,0x42,0xff,0xff,0x00,0x62,0x18,0x24,0x08,0x00,0x1a,0x0e, +0xac,0x83,0x00,0x00,0x27,0x85,0x90,0x08,0x00,0xe5,0x10,0x21,0x08,0x00,0x19,0xf8, +0xa4,0x40,0x00,0x02,0x11,0x62,0x00,0x07,0x00,0x00,0x00,0x00,0x2d,0x62,0x00,0x02, +0x14,0x40,0xff,0x80,0x00,0x00,0x00,0x00,0x96,0x42,0x00,0x04,0x08,0x00,0x19,0xd8, +0x24,0x42,0x00,0x0c,0x96,0x42,0x00,0x04,0x08,0x00,0x19,0xd8,0x24,0x42,0x00,0x08, +0x16,0xe6,0xff,0x70,0x3c,0x02,0xff,0xfb,0x8d,0x83,0x00,0x18,0x34,0x42,0xff,0xff, +0x02,0x02,0x10,0x24,0xac,0x62,0x00,0x08,0x08,0x00,0x19,0xd1,0x00,0x00,0x30,0x21, +0x16,0xe6,0xff,0x27,0x3c,0x02,0xfb,0xff,0x34,0x42,0xff,0xff,0x02,0x02,0x10,0x24, +0xad,0x02,0x00,0x08,0x08,0x00,0x19,0x90,0x00,0x00,0x30,0x21,0x93,0x88,0xbb,0x04, +0x00,0x10,0x1e,0x42,0x00,0x10,0x26,0x82,0x27,0x82,0x8f,0xf8,0x2d,0x05,0x00,0x0c, +0x00,0xe2,0x48,0x21,0x30,0x63,0x00,0x01,0x30,0x86,0x00,0x01,0x14,0xa0,0x00,0x06, +0x01,0x00,0x38,0x21,0x00,0x03,0x10,0x40,0x00,0x46,0x10,0x21,0x00,0x02,0x11,0x00, +0x01,0x02,0x10,0x21,0x24,0x47,0x00,0x04,0x02,0x71,0x10,0x21,0x00,0x02,0x10,0x80, +0x27,0x84,0x90,0x00,0x27,0x83,0x8f,0xf8,0x00,0x44,0x20,0x21,0x00,0x43,0x10,0x21, +0xa1,0x27,0x00,0x07,0xa0,0x40,0x00,0x06,0xa0,0x80,0x00,0x02,0x08,0x00,0x19,0x9f, +0xa0,0x80,0x00,0x01,0x24,0x02,0x00,0x01,0xa6,0x42,0x00,0x02,0x0c,0x00,0x01,0xc4, +0x01,0x00,0x20,0x21,0x08,0x00,0x1a,0x35,0x00,0x00,0x00,0x00,0x27,0x9e,0x8f,0xf4, +0x08,0x00,0x19,0x52,0x00,0x11,0x3a,0x00,0x94,0x91,0x00,0x0a,0x08,0x00,0x19,0x39, +0x00,0x00,0x00,0x00,0x30,0xa9,0xff,0xff,0x00,0x09,0x18,0xc0,0x00,0x69,0x18,0x21, +0x3c,0x06,0xb0,0x03,0x3c,0x02,0x80,0x00,0x24,0x42,0x6a,0x54,0x00,0x03,0x18,0x80, +0x34,0xc6,0x00,0x20,0x27,0x85,0x90,0x00,0xac,0xc2,0x00,0x00,0x00,0x65,0x18,0x21, +0x80,0x62,0x00,0x07,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x32,0x24,0x88,0x00,0x06, +0x90,0x82,0x00,0x16,0x00,0x80,0x40,0x21,0x34,0x42,0x00,0x02,0x30,0x43,0x00,0x01, +0x14,0x60,0x00,0x02,0xa0,0x82,0x00,0x16,0xa0,0x80,0x00,0x17,0x95,0x03,0x00,0x02, +0x00,0x00,0x00,0x00,0x10,0x69,0x00,0x22,0x3c,0x02,0x34,0x34,0x91,0x02,0x00,0x04, +0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x06,0x00,0x03,0x20,0xc0,0x24,0x02,0x00,0x01, +0xa1,0x02,0x00,0x04,0xa5,0x09,0x00,0x02,0x03,0xe0,0x00,0x08,0xa5,0x09,0x00,0x00, +0x00,0x83,0x20,0x21,0x27,0x87,0x8f,0xf0,0x00,0x04,0x20,0x80,0x00,0x87,0x20,0x21, +0x94,0x83,0x00,0x04,0x3c,0x02,0xb0,0x08,0x3c,0x06,0xb0,0x03,0x00,0x03,0x28,0xc0, +0x00,0xa3,0x18,0x21,0x00,0x03,0x18,0x80,0x00,0xa2,0x28,0x21,0x3c,0x02,0x80,0x01, +0x24,0x42,0x82,0xe4,0x00,0x67,0x18,0x21,0x34,0xc6,0x00,0x20,0xac,0xc2,0x00,0x00, +0xa4,0x69,0x00,0x00,0xa4,0x89,0x00,0x02,0xac,0xa9,0x00,0x00,0x91,0x02,0x00,0x04, +0xa5,0x09,0x00,0x02,0x24,0x42,0x00,0x01,0x03,0xe0,0x00,0x08,0xa1,0x02,0x00,0x04, +0x3c,0x03,0xb0,0x03,0x34,0x63,0x00,0xb0,0x34,0x42,0x34,0x34,0x03,0xe0,0x00,0x08, +0xac,0x62,0x00,0x00,0x90,0x82,0x00,0x16,0x00,0x00,0x00,0x00,0x34,0x42,0x00,0x01, +0x30,0x43,0x00,0x02,0x14,0x60,0xff,0xd1,0xa0,0x82,0x00,0x16,0x24,0x02,0x00,0x01, +0x08,0x00,0x1a,0xab,0xa0,0x82,0x00,0x17,0x27,0xbd,0xff,0xe8,0xaf,0xbf,0x00,0x10, +0x00,0x80,0x38,0x21,0x84,0x84,0x00,0x02,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00, +0x3c,0x0a,0xb0,0x06,0x34,0x63,0x00,0x20,0x24,0x42,0x6b,0x78,0x3c,0x0b,0xb0,0x08, +0x27,0x89,0x8f,0xf0,0x34,0x0c,0xff,0xff,0x35,0x4a,0x80,0x20,0x10,0x80,0x00,0x30, +0xac,0x62,0x00,0x00,0x97,0x82,0x8f,0xe0,0x94,0xe6,0x02,0xba,0x00,0x02,0x18,0xc0, +0x00,0x6b,0x28,0x21,0xac,0xa6,0x00,0x00,0x8c,0xe4,0x02,0xb8,0x00,0x62,0x18,0x21, +0x00,0x03,0x18,0x80,0x00,0x04,0x10,0xc0,0x00,0x44,0x10,0x21,0x00,0x02,0x10,0x80, +0x00,0x49,0x10,0x21,0x94,0x48,0x00,0x04,0x00,0x69,0x18,0x21,0xa4,0x66,0x00,0x00, +0x00,0x08,0x28,0xc0,0x00,0xab,0x10,0x21,0xac,0x4c,0x00,0x00,0x8c,0xe4,0x02,0xb8, +0x27,0x82,0x8f,0xf4,0x00,0xa8,0x28,0x21,0x00,0x04,0x18,0xc0,0x00,0x64,0x18,0x21, +0x00,0x03,0x18,0x80,0x00,0x62,0x10,0x21,0x8c,0x46,0x00,0x18,0x27,0x84,0x90,0x00, +0x00,0x64,0x18,0x21,0x8c,0xc2,0x00,0x00,0x80,0x67,0x00,0x06,0x00,0x05,0x28,0x80, +0x30,0x42,0xff,0xff,0x00,0x47,0x10,0x21,0x30,0x43,0x00,0xff,0x00,0x03,0x18,0x2b, +0x00,0x02,0x12,0x02,0x00,0x43,0x10,0x21,0x3c,0x04,0x00,0x04,0x00,0xa9,0x28,0x21, +0x00,0x44,0x10,0x25,0xa4,0xac,0x00,0x00,0xad,0x42,0x00,0x00,0xa7,0x88,0x8f,0xe0, +0x8f,0xbf,0x00,0x10,0x00,0x00,0x00,0x00,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x18, +0x84,0xe3,0x00,0x06,0x27,0x82,0xb3,0xf0,0x94,0xe5,0x02,0xba,0x00,0x03,0x18,0x80, +0x00,0x62,0x18,0x21,0x8c,0x64,0x00,0x00,0x0c,0x00,0x1a,0x95,0x00,0x00,0x00,0x00, +0x08,0x00,0x1b,0x18,0x00,0x00,0x00,0x00,0x94,0x88,0x00,0x00,0x00,0x80,0x58,0x21, +0x27,0x8a,0x8f,0xf0,0x00,0x08,0x18,0xc0,0x00,0x68,0x18,0x21,0x3c,0x04,0xb0,0x03, +0x00,0x03,0x18,0x80,0x3c,0x02,0x80,0x00,0x00,0x6a,0x18,0x21,0x34,0x84,0x00,0x20, +0x24,0x42,0x6c,0x98,0x30,0xa5,0xff,0xff,0xac,0x82,0x00,0x00,0x94,0x67,0x00,0x02, +0x11,0x05,0x00,0x35,0x24,0x04,0x00,0x01,0x91,0x66,0x00,0x04,0x00,0x00,0x00,0x00, +0x00,0x86,0x10,0x2a,0x10,0x40,0x00,0x10,0x00,0xc0,0x48,0x21,0x3c,0x0d,0xb0,0x03, +0x01,0x40,0x60,0x21,0x35,0xad,0x00,0x20,0x10,0xe5,0x00,0x0d,0x24,0x84,0x00,0x01, +0x00,0x07,0x10,0xc0,0x00,0x47,0x10,0x21,0x00,0x02,0x10,0x80,0x01,0x20,0x30,0x21, +0x00,0x4a,0x10,0x21,0x00,0x86,0x18,0x2a,0x00,0xe0,0x40,0x21,0x94,0x47,0x00,0x02, +0x14,0x60,0xff,0xf5,0x00,0x00,0x00,0x00,0x03,0xe0,0x00,0x08,0x00,0x00,0x10,0x21, +0x00,0x08,0x20,0xc0,0x00,0x88,0x20,0x21,0x24,0xc2,0xff,0xff,0x00,0x04,0x20,0x80, +0xa1,0x62,0x00,0x04,0x00,0x8c,0x20,0x21,0x94,0x83,0x00,0x04,0x00,0x07,0x10,0xc0, +0x00,0x47,0x10,0x21,0x00,0x02,0x10,0x80,0x00,0x4c,0x10,0x21,0x00,0x03,0x28,0xc0, +0x94,0x46,0x00,0x02,0x00,0xa3,0x18,0x21,0x00,0x03,0x18,0x80,0x00,0x6c,0x18,0x21, +0xa4,0x66,0x00,0x00,0xa4,0x86,0x00,0x02,0x95,0x64,0x00,0x02,0x3c,0x03,0xb0,0x08, +0x3c,0x02,0x80,0x01,0x00,0xa3,0x28,0x21,0x24,0x42,0x82,0xe4,0xad,0xa2,0x00,0x00, +0x10,0x87,0x00,0x03,0xac,0xa6,0x00,0x00,0x03,0xe0,0x00,0x08,0x24,0x02,0x00,0x01, +0x08,0x00,0x1b,0x66,0xa5,0x68,0x00,0x02,0x91,0x62,0x00,0x04,0xa5,0x67,0x00,0x00, +0x24,0x42,0xff,0xff,0x30,0x43,0x00,0xff,0x14,0x60,0x00,0x03,0xa1,0x62,0x00,0x04, +0x24,0x02,0xff,0xff,0xa5,0x62,0x00,0x02,0x91,0x65,0x00,0x04,0x00,0x00,0x00,0x00, +0x10,0xa0,0xff,0xf1,0x00,0x00,0x00,0x00,0x95,0x66,0x00,0x00,0x34,0x02,0xff,0xff, +0x14,0xc2,0xff,0xed,0x3c,0x03,0xb0,0x03,0x95,0x64,0x00,0x02,0x3c,0x02,0xee,0xee, +0x00,0xa2,0x10,0x25,0x34,0x63,0x00,0xbc,0xac,0x62,0x00,0x00,0x10,0x86,0xff,0xe6, +0xa1,0x60,0x00,0x04,0x24,0x02,0xff,0xff,0x08,0x00,0x1b,0x66,0xa5,0x62,0x00,0x02, +0x00,0x05,0x40,0xc0,0x01,0x05,0x30,0x21,0x27,0xbd,0xff,0xd8,0x00,0x06,0x30,0x80, +0x27,0x82,0x8f,0xf4,0xaf,0xb2,0x00,0x18,0xaf,0xb1,0x00,0x14,0xaf,0xbf,0x00,0x20, +0xaf,0xb3,0x00,0x1c,0xaf,0xb0,0x00,0x10,0x00,0xc2,0x10,0x21,0x8c,0x47,0x00,0x18, +0x00,0xa0,0x90,0x21,0x3c,0x02,0x80,0x00,0x3c,0x05,0xb0,0x03,0x34,0xa5,0x00,0x20, +0x24,0x42,0x6e,0x10,0xac,0xa2,0x00,0x00,0x27,0x83,0x90,0x00,0x00,0xc3,0x30,0x21, +0x8c,0xe2,0x00,0x00,0x80,0xc5,0x00,0x06,0x00,0x80,0x88,0x21,0x30,0x42,0xff,0xff, +0x00,0x45,0x10,0x21,0x30,0x43,0x00,0xff,0x10,0x60,0x00,0x02,0x00,0x02,0x12,0x02, +0x24,0x42,0x00,0x01,0x30,0x53,0x00,0xff,0x01,0x12,0x10,0x21,0x00,0x02,0x10,0x80, +0x27,0x83,0x90,0x00,0x00,0x43,0x10,0x21,0x80,0x44,0x00,0x07,0x00,0x00,0x00,0x00, +0x10,0x80,0x00,0x4b,0x26,0x24,0x00,0x06,0x32,0x50,0xff,0xff,0x02,0x20,0x20,0x21, +0x0c,0x00,0x1b,0x26,0x02,0x00,0x28,0x21,0x92,0x22,0x00,0x10,0x00,0x00,0x00,0x00, +0x14,0x40,0x00,0x2e,0x3c,0x03,0xb0,0x08,0x3c,0x09,0x80,0x01,0x27,0x88,0x8f,0xf0, +0xa6,0x32,0x00,0x0c,0x00,0x10,0x20,0xc0,0x00,0x90,0x20,0x21,0x00,0x04,0x20,0x80, +0x00,0x88,0x20,0x21,0x94,0x82,0x00,0x04,0x3c,0x03,0xb0,0x08,0x3c,0x07,0xb0,0x03, +0x00,0x02,0x28,0xc0,0x00,0xa2,0x10,0x21,0x00,0x02,0x10,0x80,0x00,0x48,0x10,0x21, +0x00,0xa3,0x28,0x21,0x25,0x26,0x82,0xe4,0x34,0x03,0xff,0xff,0x34,0xe7,0x00,0x20, +0xac,0xe6,0x00,0x00,0xa4,0x83,0x00,0x02,0xa4,0x43,0x00,0x00,0xac,0xa3,0x00,0x00, +0x92,0x22,0x00,0x10,0x92,0x23,0x00,0x0a,0xa6,0x32,0x00,0x0e,0x02,0x62,0x10,0x21, +0x14,0x60,0x00,0x05,0xa2,0x22,0x00,0x10,0x92,0x22,0x00,0x16,0x00,0x00,0x00,0x00, +0x30,0x42,0x00,0xfe,0xa2,0x22,0x00,0x16,0x92,0x22,0x00,0x04,0x00,0x00,0x00,0x00, +0x14,0x40,0x00,0x05,0x00,0x00,0x00,0x00,0x92,0x22,0x00,0x16,0x00,0x00,0x00,0x00, +0x30,0x42,0x00,0xfd,0xa2,0x22,0x00,0x16,0x8f,0xbf,0x00,0x20,0x7b,0xb2,0x00,0xfc, +0x7b,0xb0,0x00,0xbc,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x28,0x96,0x22,0x00,0x0e, +0x27,0x88,0x8f,0xf0,0x00,0x02,0x20,0xc0,0x00,0x82,0x20,0x21,0x00,0x04,0x20,0x80, +0x00,0x88,0x20,0x21,0x94,0x82,0x00,0x04,0x3c,0x06,0xb0,0x03,0x3c,0x09,0x80,0x01, +0x00,0x02,0x28,0xc0,0x00,0xa2,0x10,0x21,0x00,0x02,0x10,0x80,0x00,0xa3,0x28,0x21, +0x00,0x48,0x10,0x21,0x34,0xc6,0x00,0x20,0x25,0x23,0x82,0xe4,0xac,0xc3,0x00,0x00, +0xa4,0x50,0x00,0x00,0xac,0xb0,0x00,0x00,0x08,0x00,0x1b,0xb5,0xa4,0x90,0x00,0x02, +0x08,0x00,0x1b,0xac,0x32,0x50,0xff,0xff,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00, +0x24,0x42,0x6f,0xd8,0x34,0x63,0x00,0x20,0xac,0x62,0x00,0x00,0x90,0x82,0x00,0x04, +0x97,0xaa,0x00,0x12,0x00,0x80,0x60,0x21,0x30,0xa8,0xff,0xff,0x00,0x4a,0x20,0x23, +0x34,0x09,0xff,0xff,0x30,0xcf,0xff,0xff,0x30,0xee,0xff,0xff,0x11,0x09,0x00,0x73, +0xa1,0x84,0x00,0x04,0x00,0x0e,0xc0,0xc0,0x00,0x08,0x10,0xc0,0x00,0x48,0x10,0x21, +0x03,0x0e,0x20,0x21,0x27,0x8d,0x8f,0xf0,0x00,0x04,0x20,0x80,0x00,0x02,0x10,0x80, +0x00,0x4d,0x10,0x21,0x00,0x8d,0x20,0x21,0x94,0x86,0x00,0x02,0x94,0x43,0x00,0x04, +0x3c,0x19,0x80,0x01,0xa4,0x46,0x00,0x02,0x00,0x03,0x28,0xc0,0x00,0xa3,0x18,0x21, +0x94,0x87,0x00,0x02,0x3c,0x02,0xb0,0x08,0x00,0x03,0x18,0x80,0x00,0xa2,0x28,0x21, +0x00,0x6d,0x18,0x21,0x27,0x22,0x82,0xe4,0x3c,0x01,0xb0,0x03,0xac,0x22,0x00,0x20, +0xa4,0x66,0x00,0x00,0x10,0xe9,0x00,0x57,0xac,0xa6,0x00,0x00,0x01,0xe0,0x30,0x21, +0x11,0x40,0x00,0x1d,0x00,0x00,0x48,0x21,0x01,0x40,0x38,0x21,0x27,0x8b,0x8f,0xf4, +0x27,0x8a,0x90,0x00,0x00,0x06,0x40,0xc0,0x01,0x06,0x18,0x21,0x00,0x03,0x18,0x80, +0x00,0x6b,0x10,0x21,0x8c,0x44,0x00,0x18,0x00,0x6a,0x18,0x21,0x80,0x65,0x00,0x06, +0x8c,0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x42,0xff,0xff,0x00,0x45,0x10,0x21, +0x30,0x44,0x00,0xff,0x00,0x02,0x12,0x02,0x01,0x22,0x18,0x21,0x24,0x62,0x00,0x01, +0x14,0x80,0x00,0x02,0x30,0x49,0x00,0xff,0x30,0x69,0x00,0xff,0x01,0x06,0x10,0x21, +0x00,0x02,0x10,0x80,0x00,0x4d,0x10,0x21,0x24,0xe7,0xff,0xff,0x94,0x46,0x00,0x02, +0x14,0xe0,0xff,0xe9,0x00,0x06,0x40,0xc0,0x91,0x82,0x00,0x10,0x00,0x00,0x00,0x00, +0x14,0x40,0x00,0x20,0x3c,0x06,0xb0,0x03,0xa5,0x8f,0x00,0x0c,0x03,0x0e,0x20,0x21, +0x00,0x04,0x20,0x80,0x00,0x8d,0x20,0x21,0x94,0x82,0x00,0x04,0x3c,0x03,0xb0,0x08, +0x3c,0x07,0xb0,0x03,0x00,0x02,0x28,0xc0,0x00,0xa2,0x10,0x21,0x00,0x02,0x10,0x80, +0x00,0x4d,0x10,0x21,0x00,0xa3,0x28,0x21,0x27,0x26,0x82,0xe4,0x34,0x03,0xff,0xff, +0x34,0xe7,0x00,0x20,0xac,0xe6,0x00,0x00,0xa4,0x83,0x00,0x02,0xa4,0x43,0x00,0x00, +0xac,0xa3,0x00,0x00,0x91,0x82,0x00,0x10,0x91,0x83,0x00,0x04,0xa5,0x8e,0x00,0x0e, +0x01,0x22,0x10,0x21,0x14,0x60,0x00,0x05,0xa1,0x82,0x00,0x10,0x91,0x82,0x00,0x16, +0x00,0x00,0x00,0x00,0x30,0x42,0x00,0xfd,0xa1,0x82,0x00,0x16,0x03,0xe0,0x00,0x08, +0x00,0x00,0x00,0x00,0x95,0x82,0x00,0x0e,0x3c,0x03,0xb0,0x08,0x00,0x02,0x20,0xc0, +0x00,0x82,0x20,0x21,0x00,0x04,0x20,0x80,0x00,0x8d,0x20,0x21,0x94,0x82,0x00,0x04, +0x34,0xc6,0x00,0x20,0x27,0x27,0x82,0xe4,0x00,0x02,0x28,0xc0,0x00,0xa2,0x10,0x21, +0x00,0x02,0x10,0x80,0x00,0xa3,0x28,0x21,0x00,0x4d,0x10,0x21,0xac,0xc7,0x00,0x00, +0xa4,0x8f,0x00,0x02,0xa4,0x4f,0x00,0x00,0xac,0xaf,0x00,0x00,0x08,0x00,0x1c,0x44, +0x03,0x0e,0x20,0x21,0x08,0x00,0x1c,0x1f,0xa5,0x88,0x00,0x02,0x00,0x0e,0xc0,0xc0, +0x03,0x0e,0x10,0x21,0x00,0x02,0x10,0x80,0x27,0x8d,0x8f,0xf0,0x00,0x4d,0x10,0x21, +0x94,0x43,0x00,0x02,0x30,0x84,0x00,0xff,0x14,0x80,0x00,0x05,0xa5,0x83,0x00,0x00, +0x24,0x02,0xff,0xff,0x3c,0x19,0x80,0x01,0x08,0x00,0x1c,0x1f,0xa5,0x82,0x00,0x02, +0x08,0x00,0x1c,0x1f,0x3c,0x19,0x80,0x01,0x3c,0x08,0xb0,0x03,0x3c,0x02,0x80,0x00, +0x27,0xbd,0xff,0x78,0x35,0x08,0x00,0x20,0x24,0x42,0x72,0x18,0xaf,0xb2,0x00,0x68, +0xaf,0xb1,0x00,0x64,0xaf,0xb0,0x00,0x60,0xad,0x02,0x00,0x00,0xaf,0xbf,0x00,0x84, +0xaf,0xbe,0x00,0x80,0xaf,0xb7,0x00,0x7c,0xaf,0xb6,0x00,0x78,0xaf,0xb5,0x00,0x74, +0xaf,0xb4,0x00,0x70,0xaf,0xb3,0x00,0x6c,0xaf,0xa4,0x00,0x88,0x90,0x83,0x00,0x0a, +0x27,0x82,0xb3,0xf0,0xaf,0xa6,0x00,0x90,0x00,0x03,0x18,0x80,0x00,0x62,0x18,0x21, +0x8c,0x63,0x00,0x00,0xaf,0xa7,0x00,0x94,0x27,0x86,0x8f,0xf4,0xaf,0xa3,0x00,0x1c, +0x94,0x63,0x00,0x14,0x30,0xb1,0xff,0xff,0x24,0x08,0x00,0x01,0x00,0x03,0x20,0xc0, +0xaf,0xa3,0x00,0x18,0x00,0x83,0x18,0x21,0xaf,0xa4,0x00,0x54,0x00,0x03,0x18,0x80, +0x27,0x84,0x90,0x00,0x00,0x64,0x20,0x21,0x80,0x82,0x00,0x06,0x00,0x66,0x18,0x21, +0x8c,0x66,0x00,0x18,0x24,0x42,0x00,0x02,0x00,0x02,0x1f,0xc2,0x8c,0xc4,0x00,0x08, +0x00,0x43,0x10,0x21,0x00,0x02,0x10,0x43,0x00,0x02,0x10,0x40,0x00,0x04,0x2f,0xc2, +0x00,0x04,0x1c,0x82,0x00,0xc2,0x38,0x21,0x00,0x04,0x24,0x42,0x8f,0xa2,0x00,0x1c, +0x30,0x63,0x00,0x01,0x30,0x84,0x00,0x01,0xaf,0xa5,0x00,0x3c,0xaf,0xa3,0x00,0x34, +0xaf,0xa4,0x00,0x38,0xaf,0xa0,0x00,0x40,0xaf,0xa0,0x00,0x44,0xaf,0xa0,0x00,0x50, +0xaf,0xa8,0x00,0x20,0x80,0x42,0x00,0x12,0x8f,0xb2,0x00,0x18,0xaf,0xa2,0x00,0x28, +0x8c,0xd0,0x00,0x0c,0x14,0xa0,0x01,0xe4,0x00,0x60,0x30,0x21,0x00,0x10,0x10,0x82, +0x30,0x45,0x00,0x07,0x10,0xa0,0x00,0x11,0xaf,0xa0,0x00,0x30,0x8f,0xa4,0x00,0x98, +0x27,0x82,0x80,0x1c,0x00,0x04,0x18,0x40,0x00,0x62,0x18,0x21,0x24,0xa2,0x00,0x06, +0x8f,0xa5,0x00,0x20,0x94,0x64,0x00,0x00,0x00,0x45,0x10,0x04,0x00,0x44,0x00,0x1a, +0x14,0x80,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x0d,0x00,0x00,0x10,0x12, +0x24,0x42,0x00,0x20,0x30,0x42,0xff,0xfc,0xaf,0xa2,0x00,0x30,0x8f,0xa3,0x00,0x18, +0x8f,0xa4,0x00,0x28,0x34,0x02,0xff,0xff,0xaf,0xa0,0x00,0x2c,0xaf,0xa2,0x00,0x48, +0xaf,0xa3,0x00,0x4c,0x00,0x60,0xf0,0x21,0x00,0x00,0xb8,0x21,0x18,0x80,0x00,0x48, +0xaf,0xa0,0x00,0x24,0x00,0x11,0x89,0x02,0xaf,0xb1,0x00,0x58,0x00,0x80,0xa8,0x21, +0x00,0x12,0x10,0xc0,0x00,0x52,0x18,0x21,0x00,0x03,0x80,0x80,0x27,0x85,0x8f,0xf0, +0x02,0x40,0x20,0x21,0x00,0x40,0xa0,0x21,0x02,0x05,0x10,0x21,0x94,0x56,0x00,0x02, +0x0c,0x00,0x12,0x87,0x00,0x00,0x28,0x21,0x90,0x42,0x00,0x00,0x24,0x03,0x00,0x08, +0x30,0x42,0x00,0x0c,0x10,0x43,0x01,0x9e,0x24,0x04,0x00,0x01,0x24,0x02,0x00,0x01, +0x10,0x82,0x01,0x7c,0x3c,0x02,0xb0,0x03,0x8f,0xa6,0x00,0x88,0x34,0x42,0x01,0x04, +0x84,0xc5,0x00,0x0c,0x02,0x92,0x18,0x21,0x94,0x46,0x00,0x00,0x00,0x05,0x20,0xc0, +0x00,0x85,0x20,0x21,0x00,0x03,0x18,0x80,0x27,0x82,0x90,0x00,0x27,0x85,0x8f,0xf8, +0x00,0x65,0x28,0x21,0x00,0x62,0x18,0x21,0x80,0x71,0x00,0x05,0x80,0x73,0x00,0x04, +0x8f,0xa3,0x00,0x88,0x30,0xd0,0xff,0xff,0x00,0x10,0x3a,0x03,0x32,0x08,0x00,0xff, +0x27,0x82,0x90,0x10,0x00,0x04,0x20,0x80,0x80,0xa6,0x00,0x06,0x00,0x82,0x20,0x21, +0xa4,0x67,0x00,0x44,0xa4,0x68,0x00,0x46,0x8c,0x84,0x00,0x00,0x38,0xc6,0x00,0x00, +0x01,0x00,0x80,0x21,0x00,0x04,0x15,0x02,0x30,0x42,0x00,0x01,0x10,0x40,0x00,0x03, +0x00,0xe6,0x80,0x0a,0x00,0x04,0x14,0x02,0x30,0x50,0x00,0x0f,0x12,0x20,0x01,0x50, +0x02,0x40,0x20,0x21,0x02,0x71,0x10,0x21,0x00,0x50,0x10,0x2a,0x14,0x40,0x00,0xed, +0x02,0x92,0x10,0x21,0x93,0x82,0x8b,0x61,0x00,0x00,0x00,0x00,0x30,0x42,0x00,0x01, +0x14,0x40,0x00,0xe0,0x02,0x92,0x28,0x21,0x26,0xe2,0x00,0x01,0x30,0x57,0xff,0xff, +0x02,0x40,0xf0,0x21,0x26,0xb5,0xff,0xff,0x16,0xa0,0xff,0xbd,0x02,0xc0,0x90,0x21, +0x16,0xe0,0x00,0xd0,0x00,0x00,0x00,0x00,0x8f,0xa3,0x00,0x98,0x00,0x00,0x00,0x00, +0x2c,0x62,0x00,0x10,0x10,0x40,0x00,0x2e,0x00,0x00,0x00,0x00,0x8f,0xa4,0x00,0x24, +0x00,0x00,0x00,0x00,0x18,0x80,0x00,0x2a,0x24,0x03,0x00,0x01,0x8f,0xa5,0x00,0x1c, +0x27,0x84,0x8f,0xf4,0x94,0xb2,0x00,0x14,0xa0,0xa3,0x00,0x12,0x8f,0xa6,0x00,0x3c, +0x00,0x12,0x10,0xc0,0x00,0x52,0x10,0x21,0x00,0x02,0x80,0x80,0x27,0x82,0x90,0x00, +0x02,0x02,0x10,0x21,0x80,0x43,0x00,0x06,0x02,0x04,0x20,0x21,0x8c,0x85,0x00,0x18, +0x24,0x63,0x00,0x02,0x00,0x03,0x17,0xc2,0x00,0x62,0x18,0x21,0x00,0x03,0x18,0x43, +0x00,0x03,0x18,0x40,0x14,0xc0,0x00,0x0e,0x00,0xa3,0x38,0x21,0x27,0x82,0x8f,0xf0, +0x02,0x02,0x10,0x21,0x94,0x43,0x00,0x06,0x8f,0xa8,0x00,0x1c,0x24,0x02,0x00,0x01, +0xa5,0x03,0x00,0x1a,0x7b,0xbe,0x04,0x3c,0x7b,0xb6,0x03,0xfc,0x7b,0xb4,0x03,0xbc, +0x7b,0xb2,0x03,0x7c,0x7b,0xb0,0x03,0x3c,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x88, +0x8f,0xa4,0x00,0x98,0x8f,0xa5,0x00,0x38,0x8f,0xa6,0x00,0x34,0xaf,0xa0,0x00,0x10, +0x0c,0x00,0x09,0x06,0xaf,0xa0,0x00,0x14,0x08,0x00,0x1d,0x4b,0x00,0x00,0x00,0x00, +0x8f,0xa3,0x00,0x44,0x93,0x82,0x81,0x59,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x61, +0x30,0x69,0x00,0x03,0x8f,0xa4,0x00,0x24,0x8f,0xa5,0x00,0x28,0x00,0x00,0x00,0x00, +0x00,0x85,0x10,0x2a,0x10,0x40,0x00,0x8f,0x00,0x00,0x00,0x00,0x8f,0xa6,0x00,0x1c, +0x00,0x00,0x00,0x00,0x90,0xc4,0x00,0x04,0x00,0x00,0x00,0x00,0x30,0x83,0x00,0xff, +0x00,0xa3,0x10,0x2a,0x10,0x40,0x00,0x87,0x00,0x00,0x00,0x00,0x8f,0xa8,0x00,0x24, +0x00,0x00,0x00,0x00,0x11,0x00,0x00,0x83,0x00,0x65,0x10,0x23,0x00,0xa8,0x18,0x23, +0x00,0x62,0x10,0x2a,0x14,0x40,0x00,0x7d,0x30,0x63,0x00,0xff,0x00,0x85,0x10,0x23, +0x30,0x42,0x00,0xff,0xaf,0xa2,0x00,0x50,0x8f,0xa2,0x00,0x50,0x00,0x00,0x00,0x00, +0x10,0x40,0x00,0x73,0x00,0x00,0xa8,0x21,0x27,0x8c,0x8f,0xf0,0x3c,0x0b,0x80,0xff, +0x24,0x10,0x00,0x04,0x27,0x91,0x8f,0xf4,0x35,0x6b,0xff,0xff,0x3c,0x0d,0x7f,0x00, +0x27,0x8e,0x90,0x00,0x01,0x80,0x78,0x21,0x00,0x12,0x30,0xc0,0x00,0xd2,0x10,0x21, +0x00,0x02,0x10,0x80,0x00,0x4c,0x10,0x21,0x94,0x42,0x00,0x06,0x8f,0xa3,0x00,0x2c, +0x8f,0xa4,0x00,0x30,0xaf,0xa2,0x00,0x44,0x8f,0xa5,0x00,0x44,0x30,0x49,0x00,0x03, +0x02,0x09,0x10,0x23,0x30,0x42,0x00,0x03,0x00,0xa2,0x10,0x21,0x8f,0xa8,0x00,0x30, +0x24,0x42,0x00,0x04,0x30,0x42,0xff,0xff,0x00,0x64,0x38,0x21,0x01,0x02,0x28,0x23, +0x00,0x62,0x18,0x21,0x00,0x48,0x10,0x2b,0x10,0x40,0x00,0x52,0x00,0x00,0x20,0x21, +0x30,0xe7,0xff,0xff,0x30,0xa4,0xff,0xff,0xaf,0xa7,0x00,0x2c,0x00,0xd2,0x10,0x21, +0x00,0x02,0x10,0x80,0x00,0x51,0x18,0x21,0x8c,0x65,0x00,0x18,0x00,0x04,0x25,0x40, +0x00,0x8d,0x20,0x24,0x8c,0xa8,0x00,0x04,0x00,0x4e,0x18,0x21,0x00,0x4f,0x50,0x21, +0x01,0x0b,0x40,0x24,0x01,0x04,0x40,0x25,0xac,0xa8,0x00,0x04,0x8f,0xa4,0x00,0x98, +0x8f,0xa2,0x00,0x50,0x26,0xb5,0x00,0x01,0xa0,0x64,0x00,0x00,0x8c,0xa4,0x00,0x08, +0x00,0x00,0x00,0x00,0x04,0x81,0x00,0x0c,0x02,0xa2,0x30,0x2a,0x80,0x62,0x00,0x06, +0x00,0x00,0x00,0x00,0x24,0x42,0x00,0x02,0x00,0x02,0x1f,0xc2,0x00,0x43,0x10,0x21, +0x00,0x02,0x10,0x43,0x00,0x02,0x10,0x40,0x00,0xa2,0x38,0x21,0x8f,0xa5,0x00,0x40, +0x00,0x00,0x00,0x00,0xa4,0xe5,0x00,0x00,0x95,0x52,0x00,0x02,0x14,0xc0,0xff,0xc7, +0x00,0x12,0x30,0xc0,0x8f,0xa4,0x00,0x24,0x8f,0xa5,0x00,0x50,0x8f,0xa6,0x00,0x1c, +0x8f,0xa3,0x00,0x2c,0x00,0x85,0x80,0x21,0xa0,0xd0,0x00,0x12,0x00,0x09,0x10,0x23, +0x30,0x42,0x00,0x03,0x8f,0xa8,0x00,0x88,0x00,0x62,0x10,0x23,0xa4,0xc2,0x00,0x1a, +0x85,0x03,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x03,0x10,0xc0,0x00,0x43,0x10,0x21, +0x00,0x02,0x10,0x80,0x27,0x83,0x8f,0xf4,0x00,0x43,0x10,0x21,0x8c,0x44,0x00,0x18, +0x00,0x00,0x00,0x00,0x8c,0x83,0x00,0x04,0x00,0x00,0x00,0x00,0x30,0x63,0x00,0x10, +0x14,0x60,0xff,0x74,0x02,0x00,0x10,0x21,0x8f,0xa3,0x00,0x54,0x8f,0xa4,0x00,0x18, +0x8f,0xa5,0x00,0x24,0x00,0x64,0x10,0x21,0x00,0x02,0x10,0x80,0x27,0x83,0x90,0x08, +0x00,0x43,0x10,0x21,0x90,0x44,0x00,0x00,0x10,0xa0,0x00,0x03,0x00,0x00,0x30,0x21, +0x08,0x00,0x1d,0x51,0x02,0x00,0x10,0x21,0x93,0x82,0x80,0x10,0x00,0x00,0x28,0x21, +0x00,0x00,0x38,0x21,0x0c,0x00,0x21,0xf5,0xaf,0xa2,0x00,0x10,0x08,0x00,0x1d,0x51, +0x02,0x00,0x10,0x21,0x30,0x63,0xff,0xff,0x08,0x00,0x1d,0xa3,0xaf,0xa3,0x00,0x2c, +0x8f,0xa8,0x00,0x44,0x08,0x00,0x1d,0xc5,0x31,0x09,0x00,0x03,0x08,0x00,0x1d,0x7e, +0xaf,0xa3,0x00,0x50,0x8f,0xa6,0x00,0x44,0xaf,0xa0,0x00,0x50,0x08,0x00,0x1d,0xc5, +0x30,0xc9,0x00,0x03,0x8f,0xa5,0x00,0x48,0x8f,0xa6,0x00,0x4c,0x8f,0xa4,0x00,0x1c, +0x03,0xc0,0x38,0x21,0x0c,0x00,0x1b,0xf6,0xaf,0xb7,0x00,0x10,0x08,0x00,0x1d,0x2e, +0x00,0x00,0x00,0x00,0x00,0x05,0x28,0x80,0x27,0x82,0x8f,0xf0,0x00,0xa2,0x28,0x21, +0x00,0x00,0x20,0x21,0x0c,0x00,0x01,0x4b,0x00,0x00,0x00,0x00,0x08,0x00,0x1d,0x27, +0x26,0xe2,0x00,0x01,0x00,0x02,0x80,0x80,0x27,0x83,0x90,0x00,0x8f,0xa4,0x00,0x1c, +0x02,0x03,0x18,0x21,0x26,0x31,0x00,0x01,0x02,0x40,0x28,0x21,0x0c,0x00,0x1f,0x08, +0xa0,0x71,0x00,0x05,0x14,0x40,0xff,0x13,0x00,0x00,0x00,0x00,0x16,0xe0,0x00,0x4d, +0x03,0xc0,0x38,0x21,0x8f,0xa4,0x00,0x24,0x8f,0xa5,0x00,0x20,0x24,0x02,0x00,0x01, +0x24,0x84,0x00,0x01,0xaf,0xb2,0x00,0x48,0xaf,0xb6,0x00,0x4c,0x02,0xc0,0xf0,0x21, +0x10,0xa2,0x00,0x41,0xaf,0xa4,0x00,0x24,0x27,0x82,0x8f,0xf0,0x02,0x02,0x10,0x21, +0x94,0x42,0x00,0x06,0x8f,0xa4,0x00,0x30,0xaf,0xa0,0x00,0x20,0xaf,0xa2,0x00,0x44, +0x30,0x49,0x00,0x03,0x8f,0xa8,0x00,0x44,0x00,0x09,0x10,0x23,0x30,0x42,0x00,0x03, +0x01,0x02,0x10,0x21,0x24,0x42,0x00,0x04,0x30,0x42,0xff,0xff,0x00,0x44,0x18,0x2b, +0x10,0x60,0x00,0x2b,0x00,0x00,0x00,0x00,0x8f,0xa5,0x00,0x2c,0x00,0x82,0x10,0x23, +0x00,0xa4,0x18,0x21,0x30,0x63,0xff,0xff,0x30,0x44,0xff,0xff,0xaf,0xa3,0x00,0x2c, +0x02,0x92,0x28,0x21,0x00,0x05,0x28,0x80,0x27,0x82,0x8f,0xf4,0x00,0xa2,0x10,0x21, +0x8c,0x46,0x00,0x18,0x3c,0x03,0x80,0xff,0x3c,0x02,0x7f,0x00,0x8c,0xc8,0x00,0x04, +0x00,0x04,0x25,0x40,0x34,0x63,0xff,0xff,0x00,0x82,0x20,0x24,0x01,0x03,0x40,0x24, +0x01,0x04,0x40,0x25,0xac,0xc8,0x00,0x04,0x8f,0xa8,0x00,0x98,0x27,0x82,0x90,0x00, +0x00,0xa2,0x10,0x21,0xa0,0x48,0x00,0x00,0x8c,0xc4,0x00,0x08,0x00,0x00,0x00,0x00, +0x00,0x04,0x27,0xc2,0x10,0x80,0xfe,0xdb,0xaf,0xa4,0x00,0x3c,0x80,0x42,0x00,0x06, +0x00,0x00,0x00,0x00,0x24,0x42,0x00,0x02,0x00,0x02,0x1f,0xc2,0x00,0x43,0x10,0x21, +0x00,0x02,0x10,0x43,0x00,0x02,0x10,0x40,0x00,0xc2,0x38,0x21,0x8f,0xa2,0x00,0x40, +0x00,0x00,0x00,0x00,0xa4,0xe2,0x00,0x00,0x08,0x00,0x1d,0x2a,0x26,0xb5,0xff,0xff, +0x8f,0xa6,0x00,0x2c,0x00,0x00,0x20,0x21,0x00,0xc2,0x10,0x21,0x30,0x42,0xff,0xff, +0x08,0x00,0x1e,0x38,0xaf,0xa2,0x00,0x2c,0x8f,0xa6,0x00,0x1c,0x08,0x00,0x1e,0x22, +0xa4,0xd2,0x00,0x14,0x8f,0xa5,0x00,0x48,0x8f,0xa6,0x00,0x4c,0x8f,0xa4,0x00,0x1c, +0x0c,0x00,0x1b,0xf6,0xaf,0xb7,0x00,0x10,0x08,0x00,0x1e,0x19,0x00,0x00,0xb8,0x21, +0x0c,0x00,0x12,0x87,0x00,0x00,0x28,0x21,0x00,0x40,0x18,0x21,0x94,0x42,0x00,0x00, +0x00,0x00,0x00,0x00,0x34,0x42,0x08,0x00,0xa4,0x62,0x00,0x00,0x08,0x00,0x1d,0x1e, +0x02,0x71,0x10,0x21,0x02,0x92,0x18,0x21,0x00,0x03,0x80,0x80,0x27,0x82,0x8f,0xf4, +0x02,0x02,0x10,0x21,0x8c,0x44,0x00,0x18,0x00,0x00,0x00,0x00,0x8c,0x83,0x00,0x04, +0x00,0x00,0x00,0x00,0x30,0x63,0x00,0x10,0x10,0x60,0x00,0x09,0x24,0x06,0x00,0x01, +0x93,0x82,0x8b,0x61,0x00,0x00,0x00,0x00,0x30,0x42,0x00,0x01,0x10,0x40,0xfe,0xa2, +0x3c,0x04,0x00,0x80,0x27,0x85,0x8f,0xf0,0x08,0x00,0x1e,0x09,0x02,0x05,0x28,0x21, +0x27,0x83,0x90,0x08,0x27,0x82,0x90,0x00,0x02,0x03,0x18,0x21,0x02,0x02,0x10,0x21, +0x90,0x64,0x00,0x00,0x90,0x45,0x00,0x05,0x93,0x83,0x80,0x10,0x00,0x00,0x38,0x21, +0x0c,0x00,0x21,0xf5,0xaf,0xa3,0x00,0x10,0x08,0x00,0x1e,0x80,0x00,0x00,0x00,0x00, +0x27,0x82,0x90,0x08,0x02,0x02,0x10,0x21,0x94,0x43,0x00,0x02,0x8f,0xa6,0x00,0x58, +0x00,0x03,0x19,0x02,0x00,0x66,0x18,0x23,0x30,0x63,0x0f,0xff,0x28,0x62,0x00,0x20, +0x10,0x40,0x00,0x06,0x28,0x62,0x00,0x40,0x8f,0xa8,0x00,0x90,0x00,0x00,0x00,0x00, +0x00,0x68,0x10,0x06,0x08,0x00,0x1c,0xf7,0x30,0x44,0x00,0x01,0x10,0x40,0x00,0x04, +0x00,0x00,0x00,0x00,0x8f,0xa4,0x00,0x94,0x08,0x00,0x1e,0xa1,0x00,0x64,0x10,0x06, +0x08,0x00,0x1c,0xf7,0x00,0x00,0x20,0x21,0x8f,0xa4,0x00,0x98,0x8f,0xa5,0x00,0x38, +0xaf,0xa0,0x00,0x10,0x0c,0x00,0x09,0x06,0xaf,0xa8,0x00,0x14,0x30,0x42,0xff,0xff, +0x08,0x00,0x1c,0xc7,0xaf,0xa2,0x00,0x40,0x3c,0x02,0xb0,0x03,0x3c,0x03,0x80,0x00, +0x27,0xbd,0xff,0xe0,0x34,0x42,0x00,0x20,0x24,0x63,0x7a,0xc8,0xaf,0xb1,0x00,0x14, +0xaf,0xb0,0x00,0x10,0xaf,0xbf,0x00,0x18,0xac,0x43,0x00,0x00,0x90,0x82,0x00,0x0a, +0x00,0x80,0x80,0x21,0x14,0x40,0x00,0x45,0x00,0x00,0x88,0x21,0x92,0x02,0x00,0x04, +0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x3c,0x00,0x00,0x00,0x00,0x12,0x20,0x00,0x18, +0x00,0x00,0x00,0x00,0x92,0x02,0x00,0x16,0x92,0x05,0x00,0x0a,0x30,0x42,0x00,0xfc, +0x10,0xa0,0x00,0x03,0xa2,0x02,0x00,0x16,0x34,0x42,0x00,0x01,0xa2,0x02,0x00,0x16, +0x92,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x30,0x83,0x00,0xff,0x10,0x60,0x00,0x05, +0x00,0x00,0x00,0x00,0x92,0x02,0x00,0x16,0x00,0x00,0x00,0x00,0x34,0x42,0x00,0x02, +0xa2,0x02,0x00,0x16,0x10,0x60,0x00,0x0a,0x00,0x00,0x00,0x00,0x14,0xa0,0x00,0x08, +0x00,0x00,0x00,0x00,0x96,0x02,0x00,0x00,0xa2,0x00,0x00,0x17,0xa6,0x02,0x00,0x14, +0x8f,0xbf,0x00,0x18,0x7b,0xb0,0x00,0xbc,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x20, +0x14,0x80,0x00,0x05,0x24,0x02,0x00,0x01,0x96,0x03,0x00,0x06,0xa2,0x02,0x00,0x17, +0x08,0x00,0x1e,0xdc,0xa6,0x03,0x00,0x14,0x96,0x04,0x00,0x00,0x96,0x05,0x00,0x06, +0x27,0x86,0x8f,0xf0,0x00,0x04,0x10,0xc0,0x00,0x05,0x18,0xc0,0x00,0x44,0x10,0x21, +0x00,0x65,0x18,0x21,0x00,0x02,0x10,0x80,0x00,0x03,0x18,0x80,0x00,0x66,0x18,0x21, +0x00,0x46,0x10,0x21,0x8c,0x65,0x00,0x08,0x8c,0x44,0x00,0x08,0x0c,0x00,0x12,0x78, +0x00,0x00,0x00,0x00,0x30,0x43,0x00,0xff,0x10,0x60,0x00,0x04,0xa2,0x02,0x00,0x17, +0x96,0x02,0x00,0x06,0x08,0x00,0x1e,0xdc,0xa6,0x02,0x00,0x14,0x96,0x02,0x00,0x00, +0x08,0x00,0x1e,0xdc,0xa6,0x02,0x00,0x14,0x96,0x05,0x00,0x00,0x0c,0x00,0x1f,0x08, +0x02,0x00,0x20,0x21,0x08,0x00,0x1e,0xc3,0x02,0x22,0x88,0x21,0x94,0x85,0x00,0x06, +0x0c,0x00,0x1f,0x08,0x00,0x00,0x00,0x00,0x08,0x00,0x1e,0xbf,0x00,0x40,0x88,0x21, +0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00,0x34,0x63,0x00,0x20,0x24,0x42,0x7c,0x20, +0x27,0xbd,0xff,0xf0,0xac,0x62,0x00,0x00,0x00,0x00,0x10,0x21,0x03,0xe0,0x00,0x08, +0x27,0xbd,0x00,0x10,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x00,0x34,0x63,0x00,0x20, +0x24,0x42,0x7c,0x44,0xac,0x62,0x00,0x00,0x90,0x89,0x00,0x0a,0x00,0x80,0x30,0x21, +0x11,0x20,0x00,0x05,0x00,0xa0,0x50,0x21,0x90,0x82,0x00,0x17,0x00,0x00,0x00,0x00, +0x14,0x40,0x00,0x1b,0x00,0x00,0x00,0x00,0x90,0xc7,0x00,0x04,0x00,0x00,0x00,0x00, +0x10,0xe0,0x00,0x1b,0x00,0x00,0x00,0x00,0x94,0xc8,0x00,0x00,0x27,0x83,0x8f,0xf0, +0x93,0x85,0x8b,0x60,0x00,0x08,0x10,0xc0,0x00,0x48,0x10,0x21,0x00,0x02,0x10,0x80, +0x00,0x43,0x10,0x21,0x8c,0x44,0x00,0x08,0x00,0xe5,0x28,0x2b,0x10,0xa0,0x00,0x06, +0x01,0x44,0x18,0x23,0x8f,0x82,0x8b,0x78,0x00,0x00,0x00,0x00,0x00,0x43,0x10,0x2b, +0x10,0x40,0x00,0x05,0x00,0x00,0x00,0x00,0x24,0x03,0x00,0x10,0xa4,0xc8,0x00,0x14, +0x03,0xe0,0x00,0x08,0x00,0x60,0x10,0x21,0x11,0x20,0x00,0x05,0x00,0x00,0x00,0x00, +0x94,0xc2,0x00,0x06,0x24,0x03,0x00,0x08,0x08,0x00,0x1f,0x34,0xa4,0xc2,0x00,0x14, +0x08,0x00,0x1f,0x34,0x00,0x00,0x18,0x21,0x27,0xbd,0xff,0xc8,0xaf,0xb5,0x00,0x2c, +0xaf,0xb4,0x00,0x28,0xaf,0xb3,0x00,0x24,0xaf,0xb0,0x00,0x18,0xaf,0xbf,0x00,0x30, +0xaf,0xb2,0x00,0x20,0xaf,0xb1,0x00,0x1c,0x94,0x91,0x00,0x06,0x00,0x80,0xa0,0x21, +0x3c,0x02,0x80,0x00,0x3c,0x04,0xb0,0x03,0x00,0x11,0xa8,0xc0,0x34,0x84,0x00,0x20, +0x24,0x42,0x7c,0xf8,0x02,0xb1,0x48,0x21,0xac,0x82,0x00,0x00,0x00,0x09,0x48,0x80, +0x24,0x03,0x00,0x01,0x27,0x82,0x90,0x00,0xa2,0x83,0x00,0x12,0x01,0x22,0x10,0x21, +0x27,0x84,0x8f,0xf4,0x01,0x24,0x20,0x21,0x80,0x48,0x00,0x06,0x8c,0x8a,0x00,0x18, +0x27,0x83,0x90,0x10,0x01,0x23,0x48,0x21,0x8d,0x24,0x00,0x00,0x25,0x08,0x00,0x02, +0x8d,0x42,0x00,0x00,0x8d,0x49,0x00,0x04,0x00,0x08,0x17,0xc2,0x8d,0x43,0x00,0x08, +0x01,0x02,0x40,0x21,0x00,0x04,0x25,0xc2,0x00,0x08,0x40,0x43,0x30,0x84,0x00,0x01, +0x00,0x03,0x1f,0xc2,0x00,0x08,0x40,0x40,0x00,0xe0,0x80,0x21,0x00,0x64,0x18,0x24, +0x00,0x09,0x49,0x42,0x01,0x48,0x10,0x21,0x00,0xa0,0x98,0x21,0x00,0xa0,0x20,0x21, +0x00,0x40,0x38,0x21,0x02,0x00,0x28,0x21,0x14,0x60,0x00,0x19,0x31,0x29,0x00,0x01, +0x94,0x42,0x00,0x00,0x02,0xb1,0x88,0x21,0x02,0x00,0x28,0x21,0x00,0x11,0x88,0x80, +0x27,0x90,0x8f,0xf0,0x02,0x30,0x80,0x21,0x96,0x03,0x00,0x06,0x30,0x52,0xff,0xff, +0x02,0x60,0x20,0x21,0x00,0x60,0x30,0x21,0xa6,0x83,0x00,0x1a,0x27,0x82,0x8f,0xf8, +0x0c,0x00,0x08,0xdf,0x02,0x22,0x88,0x21,0x00,0x52,0x10,0x21,0x96,0x03,0x00,0x06, +0xa6,0x22,0x00,0x04,0x8f,0xbf,0x00,0x30,0x7b,0xb4,0x01,0x7c,0x7b,0xb2,0x01,0x3c, +0x7b,0xb0,0x00,0xfc,0x00,0x60,0x10,0x21,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x38, +0xaf,0xa9,0x00,0x10,0x0c,0x00,0x09,0x06,0xaf,0xa0,0x00,0x14,0x08,0x00,0x1f,0x72, +0x02,0xb1,0x88,0x21,0x27,0xbd,0xff,0xc0,0xaf,0xbe,0x00,0x38,0xaf,0xb7,0x00,0x34, +0xaf,0xb6,0x00,0x30,0xaf,0xb5,0x00,0x2c,0xaf,0xb3,0x00,0x24,0xaf,0xb1,0x00,0x1c, +0xaf,0xbf,0x00,0x3c,0xaf,0xb4,0x00,0x28,0xaf,0xb2,0x00,0x20,0xaf,0xb0,0x00,0x18, +0x94,0x90,0x00,0x00,0x3c,0x08,0xb0,0x03,0x35,0x08,0x00,0x20,0x00,0x10,0x10,0xc0, +0x00,0x50,0x18,0x21,0x00,0x40,0x88,0x21,0x3c,0x02,0x80,0x00,0x00,0x03,0x48,0x80, +0x24,0x42,0x7e,0x34,0x00,0x80,0x98,0x21,0x27,0x84,0x90,0x00,0x01,0x24,0x20,0x21, +0x93,0xb7,0x00,0x53,0xad,0x02,0x00,0x00,0x80,0x83,0x00,0x06,0x27,0x82,0x8f,0xf4, +0x01,0x22,0x10,0x21,0x8c,0x44,0x00,0x18,0x24,0x63,0x00,0x02,0x00,0x03,0x17,0xc2, +0x8c,0x88,0x00,0x08,0x00,0x62,0x18,0x21,0x00,0x03,0x18,0x43,0x00,0x03,0x18,0x40, +0xaf,0xa7,0x00,0x4c,0x2c,0xa2,0x00,0x10,0x00,0xa0,0xa8,0x21,0x00,0x83,0x50,0x21, +0x00,0x08,0x47,0xc2,0x00,0xc0,0x58,0x21,0x00,0x00,0xb0,0x21,0x8c,0x92,0x00,0x0c, +0x14,0x40,0x00,0x13,0x00,0x00,0xf0,0x21,0x92,0x67,0x00,0x04,0x24,0x14,0x00,0x01, +0x12,0x87,0x00,0x10,0x02,0x30,0x10,0x21,0x27,0x83,0x90,0x08,0x01,0x23,0x18,0x21, +0x80,0x64,0x00,0x00,0x27,0x83,0xb5,0x60,0x00,0x04,0x11,0x00,0x00,0x44,0x10,0x23, +0x00,0x02,0x10,0x80,0x00,0x44,0x10,0x23,0x00,0x02,0x10,0x80,0x00,0x43,0x10,0x21, +0x90,0x44,0x00,0x04,0x00,0x00,0x00,0x00,0x10,0x80,0x00,0x23,0x00,0x00,0x00,0x00, +0x02,0x30,0x10,0x21,0x00,0x02,0x80,0x80,0x24,0x04,0x00,0x01,0x27,0x83,0x90,0x10, +0xa2,0x64,0x00,0x12,0x02,0x03,0x18,0x21,0x8c,0x62,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x02,0x15,0xc2,0x30,0x42,0x00,0x01,0x01,0x02,0x10,0x24,0x14,0x40,0x00,0x0e, +0x02,0xa0,0x20,0x21,0x27,0x82,0x8f,0xf0,0x02,0x02,0x10,0x21,0x94,0x43,0x00,0x06, +0x00,0x00,0x00,0x00,0xa6,0x63,0x00,0x1a,0x94,0x42,0x00,0x06,0x7b,0xbe,0x01,0xfc, +0x7b,0xb6,0x01,0xbc,0x7b,0xb4,0x01,0x7c,0x7b,0xb2,0x01,0x3c,0x7b,0xb0,0x00,0xfc, +0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x40,0x8f,0xa5,0x00,0x4c,0x01,0x60,0x30,0x21, +0x01,0x40,0x38,0x21,0xaf,0xa0,0x00,0x10,0x0c,0x00,0x09,0x06,0xaf,0xa0,0x00,0x14, +0x08,0x00,0x1f,0xd9,0x00,0x00,0x00,0x00,0x27,0x83,0x90,0x10,0x01,0x23,0x18,0x21, +0x8c,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x15,0xc2,0x30,0x42,0x00,0x01, +0x01,0x02,0x10,0x24,0x14,0x40,0x00,0xaf,0x00,0xa0,0x20,0x21,0x32,0x4f,0x00,0x03, +0x00,0x12,0x10,0x82,0x25,0xe3,0x00,0x0d,0x30,0x45,0x00,0x07,0x00,0x74,0x78,0x04, +0x10,0xa0,0x00,0x0e,0x00,0x00,0x90,0x21,0x27,0x82,0x80,0x1c,0x00,0x15,0x18,0x40, +0x00,0x62,0x18,0x21,0x94,0x64,0x00,0x00,0x24,0xa2,0x00,0x06,0x00,0x54,0x10,0x04, +0x00,0x44,0x00,0x1a,0x14,0x80,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x0d, +0x00,0x00,0x10,0x12,0x24,0x42,0x00,0x20,0x30,0x52,0xff,0xfc,0x02,0x30,0x10,0x21, +0x27,0x83,0x90,0x00,0x00,0x02,0x10,0x80,0x00,0x43,0x10,0x21,0x90,0x44,0x00,0x03, +0x00,0x00,0x00,0x00,0x30,0x83,0x00,0xff,0x2c,0x62,0x00,0x0c,0x14,0x40,0x00,0x04, +0x2c,0x62,0x00,0x19,0x30,0x82,0x00,0x0f,0x24,0x43,0x00,0x0c,0x2c,0x62,0x00,0x19, +0x10,0x40,0x00,0x19,0x24,0x0e,0x00,0x20,0x24,0x62,0xff,0xe9,0x2c,0x42,0x00,0x02, +0x14,0x40,0x00,0x15,0x24,0x0e,0x00,0x10,0x24,0x62,0xff,0xeb,0x2c,0x42,0x00,0x02, +0x14,0x40,0x00,0x11,0x24,0x0e,0x00,0x08,0x24,0x02,0x00,0x14,0x10,0x62,0x00,0x0e, +0x24,0x0e,0x00,0x02,0x24,0x62,0xff,0xef,0x2c,0x42,0x00,0x03,0x14,0x40,0x00,0x0a, +0x24,0x0e,0x00,0x10,0x24,0x62,0xff,0xf1,0x2c,0x42,0x00,0x02,0x14,0x40,0x00,0x06, +0x24,0x0e,0x00,0x08,0x24,0x62,0xff,0xf3,0x2c,0x42,0x00,0x02,0x24,0x0e,0x00,0x04, +0x24,0x03,0x00,0x02,0x00,0x62,0x70,0x0a,0x30,0xe2,0x00,0xff,0x00,0x00,0x48,0x21, +0x00,0x00,0x68,0x21,0x10,0x40,0x00,0x6d,0x00,0x00,0x58,0x21,0x3c,0x14,0x80,0xff, +0x27,0x99,0x8f,0xf0,0x01,0xf2,0xc0,0x23,0x36,0x94,0xff,0xff,0x01,0xc9,0x10,0x2a, +0x14,0x40,0x00,0x64,0x24,0x03,0x00,0x04,0x00,0x10,0x28,0xc0,0x00,0xb0,0x10,0x21, +0x00,0x02,0x10,0x80,0x00,0x59,0x10,0x21,0x94,0x56,0x00,0x06,0x00,0x00,0x00,0x00, +0x32,0xcc,0x00,0x03,0x00,0x6c,0x10,0x23,0x30,0x42,0x00,0x03,0x02,0xc2,0x10,0x21, +0x24,0x42,0x00,0x04,0x30,0x51,0xff,0xff,0x02,0x32,0x18,0x2b,0x10,0x60,0x00,0x4d, +0x01,0xf1,0x10,0x23,0x02,0x51,0x10,0x23,0x01,0x78,0x18,0x2b,0x10,0x60,0x00,0x34, +0x30,0x44,0xff,0xff,0x29,0x22,0x00,0x40,0x10,0x40,0x00,0x31,0x01,0x72,0x18,0x21, +0x25,0x22,0x00,0x01,0x00,0x02,0x16,0x00,0x00,0x02,0x4e,0x03,0x00,0xb0,0x10,0x21, +0x00,0x02,0x30,0x80,0x27,0x82,0x8f,0xf4,0x30,0x6b,0xff,0xff,0x00,0xc2,0x18,0x21, +0x8c,0x67,0x00,0x18,0x00,0x04,0x25,0x40,0x3c,0x03,0x7f,0x00,0x8c,0xe2,0x00,0x04, +0x00,0x83,0x20,0x24,0x27,0x83,0x90,0x00,0x00,0x54,0x10,0x24,0x00,0xc3,0x28,0x21, +0x00,0x44,0x10,0x25,0xac,0xe2,0x00,0x04,0x16,0xe0,0x00,0x02,0xa0,0xb5,0x00,0x00, +0xa0,0xb5,0x00,0x03,0x27,0x84,0x90,0x10,0x00,0xc4,0x18,0x21,0x8c,0x62,0x00,0x00, +0x8c,0xe8,0x00,0x08,0x00,0x02,0x15,0xc2,0x00,0x08,0x47,0xc2,0x30,0x42,0x00,0x01, +0x01,0x02,0x10,0x24,0x10,0x40,0x00,0x0a,0x00,0x00,0x00,0x00,0x80,0xa2,0x00,0x06, +0x00,0x00,0x00,0x00,0x24,0x42,0x00,0x02,0x00,0x02,0x1f,0xc2,0x00,0x43,0x10,0x21, +0x00,0x02,0x10,0x43,0x00,0x02,0x10,0x40,0x00,0xe2,0x50,0x21,0xa5,0x5e,0x00,0x00, +0x92,0x62,0x00,0x04,0x25,0xad,0x00,0x01,0x27,0x84,0x8f,0xf0,0x00,0xc4,0x18,0x21, +0x01,0xa2,0x10,0x2a,0x94,0x70,0x00,0x02,0x14,0x40,0xff,0xb8,0x00,0x00,0x00,0x00, +0x96,0x63,0x00,0x14,0x00,0x0c,0x10,0x23,0xa2,0x69,0x00,0x12,0x30,0x42,0x00,0x03, +0x01,0x62,0x10,0x23,0x00,0x03,0x80,0xc0,0x8f,0xa5,0x00,0x4c,0x30,0x4b,0xff,0xff, +0x02,0x03,0x80,0x21,0x27,0x82,0x8f,0xf8,0x00,0x10,0x80,0x80,0xa6,0x6b,0x00,0x1a, +0x02,0xa0,0x20,0x21,0x01,0x60,0x30,0x21,0x01,0x60,0x88,0x21,0x0c,0x00,0x08,0xdf, +0x02,0x02,0x80,0x21,0x00,0x5e,0x10,0x21,0xa6,0x02,0x00,0x04,0x08,0x00,0x1f,0xdf, +0x02,0x20,0x10,0x21,0x01,0x62,0x10,0x2b,0x10,0x40,0xff,0xe9,0x00,0x00,0x20,0x21, +0x29,0x22,0x00,0x40,0x10,0x40,0xff,0xe6,0x01,0x71,0x18,0x21,0x08,0x00,0x20,0x55, +0x25,0x22,0x00,0x01,0x08,0x00,0x20,0x84,0x32,0xcc,0x00,0x03,0x08,0x00,0x20,0x84, +0x00,0x00,0x60,0x21,0x8f,0xa5,0x00,0x4c,0x01,0x40,0x38,0x21,0xaf,0xa0,0x00,0x10, +0x0c,0x00,0x09,0x06,0xaf,0xb4,0x00,0x14,0x92,0x67,0x00,0x04,0x08,0x00,0x1f,0xf7, +0x30,0x5e,0xff,0xff,0x30,0x84,0xff,0xff,0x00,0x04,0x30,0xc0,0x00,0xc4,0x20,0x21, +0x00,0x04,0x20,0x80,0x27,0x82,0x8f,0xf0,0x3c,0x03,0xb0,0x08,0x30,0xa5,0xff,0xff, +0x00,0x82,0x20,0x21,0x00,0xc3,0x30,0x21,0xac,0xc5,0x00,0x00,0x03,0xe0,0x00,0x08, +0xa4,0x85,0x00,0x00,0x30,0x84,0xff,0xff,0x00,0x04,0x30,0xc0,0x00,0xc4,0x30,0x21, +0x27,0x88,0x8f,0xf0,0x00,0x06,0x30,0x80,0x00,0xc8,0x30,0x21,0x94,0xc3,0x00,0x04, +0x3c,0x02,0xb0,0x08,0x3c,0x07,0xb0,0x03,0x00,0x03,0x20,0xc0,0x00,0x83,0x18,0x21, +0x00,0x03,0x18,0x80,0x00,0x82,0x20,0x21,0x3c,0x02,0x80,0x01,0x30,0xa5,0xff,0xff, +0x00,0x68,0x18,0x21,0x34,0xe7,0x00,0x20,0x24,0x42,0x82,0xe4,0xac,0xe2,0x00,0x00, +0xa4,0xc5,0x00,0x02,0xa4,0x65,0x00,0x00,0x03,0xe0,0x00,0x08,0xac,0x85,0x00,0x00, +0x3c,0x02,0xb0,0x03,0x3c,0x03,0x80,0x01,0x34,0x42,0x00,0x20,0x24,0x63,0x83,0x40, +0xac,0x43,0x00,0x00,0x90,0x82,0x00,0x10,0x3c,0x08,0xb0,0x03,0x3c,0x09,0xb0,0x06, +0x27,0x87,0x8f,0xf0,0x3c,0x0d,0xb0,0x08,0x34,0x0e,0xff,0xff,0x35,0x08,0x00,0x62, +0x00,0x80,0x30,0x21,0x24,0x0c,0xff,0xff,0x10,0x40,0x00,0x2c,0x35,0x29,0x80,0x20, +0x97,0x82,0x8f,0xe0,0x94,0x85,0x00,0x0c,0x3c,0x0b,0xb0,0x03,0x00,0x02,0x18,0xc0, +0x00,0x62,0x10,0x21,0x00,0x02,0x10,0x80,0x00,0x47,0x10,0x21,0xa4,0x45,0x00,0x00, +0x94,0x84,0x00,0x0e,0x00,0x6d,0x18,0x21,0xac,0x65,0x00,0x00,0x00,0x04,0x10,0xc0, +0x00,0x44,0x10,0x21,0x00,0x02,0x10,0x80,0x00,0x47,0x10,0x21,0x94,0x45,0x00,0x04, +0x3c,0x0a,0x77,0x77,0x35,0x6b,0x00,0xb4,0x00,0x05,0x10,0xc0,0x00,0x45,0x18,0x21, +0x00,0x03,0x18,0x80,0x00,0x67,0x18,0x21,0x00,0x4d,0x10,0x21,0xac,0x4e,0x00,0x00, +0xa4,0x6e,0x00,0x00,0x95,0x04,0x00,0x00,0x90,0xc3,0x00,0x10,0x24,0x02,0x00,0xff, +0x00,0x44,0x10,0x23,0x00,0x43,0x10,0x2a,0xa7,0x85,0x8f,0xe0,0x10,0x40,0x00,0x04, +0x35,0x4a,0x88,0x88,0xad,0x6a,0x00,0x00,0x90,0xc3,0x00,0x10,0x00,0x00,0x00,0x00, +0x30,0x63,0x00,0xff,0x3c,0x02,0x00,0x40,0x00,0x62,0x18,0x25,0xad,0x23,0x00,0x00, +0xa4,0xcc,0x00,0x0e,0xa4,0xcc,0x00,0x0c,0xa0,0xc0,0x00,0x10,0x03,0xe0,0x00,0x08, +0x00,0x00,0x00,0x00,0x30,0x84,0xff,0xff,0x00,0x04,0x10,0xc0,0x00,0x44,0x10,0x21, +0x27,0x89,0x8f,0xf0,0x00,0x02,0x10,0x80,0x00,0x49,0x10,0x21,0x97,0x83,0x8f,0xe0, +0x94,0x4a,0x00,0x04,0x3c,0x02,0xb0,0x08,0x00,0x03,0x38,0xc0,0x00,0x0a,0x40,0xc0, +0x00,0xe3,0x18,0x21,0x01,0x0a,0x28,0x21,0x00,0xe2,0x38,0x21,0x01,0x02,0x40,0x21, +0x00,0x03,0x18,0x80,0x00,0x05,0x28,0x80,0x3c,0x06,0xb0,0x03,0x3c,0x02,0x80,0x01, +0x00,0xa9,0x28,0x21,0x00,0x69,0x18,0x21,0x34,0xc6,0x00,0x20,0x34,0x09,0xff,0xff, +0x24,0x42,0x84,0x34,0xac,0xc2,0x00,0x00,0xa4,0x64,0x00,0x00,0xac,0xe4,0x00,0x00, +0xa4,0xa9,0x00,0x00,0xad,0x09,0x00,0x00,0xa7,0x8a,0x8f,0xe0,0x03,0xe0,0x00,0x08, +0x00,0x00,0x00,0x00,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x01,0x34,0x63,0x00,0x20, +0x24,0x42,0x84,0xb4,0x3c,0x04,0xb0,0x03,0xac,0x62,0x00,0x00,0x34,0x84,0x01,0x10, +0x8c,0x82,0x00,0x00,0x97,0x83,0x81,0x60,0x30,0x42,0xff,0xff,0x10,0x62,0x00,0x16, +0x24,0x0a,0x00,0x01,0xa7,0x82,0x81,0x60,0xaf,0x80,0xb4,0x40,0x00,0x40,0x28,0x21, +0x24,0x06,0x00,0x01,0x27,0x84,0xb4,0x44,0x25,0x43,0xff,0xff,0x00,0x66,0x10,0x04, +0x00,0xa2,0x10,0x24,0x14,0x40,0x00,0x07,0x00,0x00,0x00,0x00,0x8c,0x83,0xff,0xfc, +0x00,0x00,0x00,0x00,0x00,0x66,0x10,0x04,0x00,0xa2,0x10,0x24,0x38,0x42,0x00,0x00, +0x01,0x42,0x18,0x0a,0x25,0x4a,0x00,0x01,0x2d,0x42,0x00,0x14,0xac,0x83,0x00,0x00, +0x14,0x40,0xff,0xf1,0x24,0x84,0x00,0x04,0x3c,0x0b,0xb0,0x03,0x00,0x00,0x50,0x21, +0x3c,0x0c,0x80,0x00,0x27,0x89,0xb4,0x90,0x35,0x6b,0x01,0x20,0x8d,0x68,0x00,0x00, +0x8d,0x23,0x00,0x04,0x01,0x0c,0x10,0x24,0x00,0x02,0x17,0xc2,0x11,0x03,0x00,0x37, +0xa1,0x22,0x00,0xdc,0xa1,0x20,0x00,0xd5,0xa1,0x20,0x00,0xd6,0x01,0x20,0x30,0x21, +0x00,0x00,0x38,0x21,0x00,0x00,0x28,0x21,0x01,0x20,0x20,0x21,0x00,0xa8,0x10,0x06, +0x30,0x42,0x00,0x01,0x10,0xe0,0x00,0x10,0xa0,0x82,0x00,0x0a,0x90,0x82,0x00,0x07, +0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x31,0x24,0xa2,0xff,0xff,0xa0,0x82,0x00,0x08, +0x90,0x82,0x00,0x0a,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x09,0x00,0x00,0x00,0x00, +0x90,0x83,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x03,0x10,0x40,0x00,0x43,0x10,0x21, +0x00,0x46,0x10,0x21,0xa0,0x45,0x00,0x09,0x90,0x82,0x00,0x0a,0x00,0x00,0x00,0x00, +0x10,0x40,0x00,0x07,0x00,0x00,0x00,0x00,0x14,0xe0,0x00,0x04,0x00,0x00,0x00,0x00, +0xa0,0xc5,0x00,0xd5,0x24,0x07,0x00,0x01,0xa0,0x85,0x00,0x08,0xa0,0xc5,0x00,0xd6, +0x24,0xa5,0x00,0x01,0x2c,0xa2,0x00,0x1c,0x14,0x40,0xff,0xe0,0x24,0x84,0x00,0x03, +0x90,0xc4,0x00,0xd5,0x00,0x00,0x28,0x21,0x00,0xa4,0x10,0x2b,0x10,0x40,0x00,0x0b, +0x00,0x00,0x00,0x00,0x00,0xc0,0x18,0x21,0xa0,0x64,0x00,0x08,0x90,0xc2,0x00,0xd5, +0x24,0xa5,0x00,0x01,0xa0,0x62,0x00,0x09,0x90,0xc4,0x00,0xd5,0x00,0x00,0x00,0x00, +0x00,0xa4,0x10,0x2b,0x14,0x40,0xff,0xf8,0x24,0x63,0x00,0x03,0x25,0x4a,0x00,0x01, +0x2d,0x42,0x00,0x08,0xad,0x28,0x00,0x04,0x25,0x6b,0x00,0x04,0x14,0x40,0xff,0xbf, +0x25,0x29,0x00,0xec,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00,0x90,0x82,0x00,0x05, +0x08,0x00,0x21,0x68,0xa0,0x82,0x00,0x08,0x97,0x85,0x8b,0x6a,0x3c,0x03,0xb0,0x03, +0x3c,0x02,0x80,0x01,0x27,0xbd,0xff,0xe8,0x34,0x63,0x00,0x20,0x24,0x42,0x86,0x68, +0xaf,0xb0,0x00,0x10,0xaf,0xbf,0x00,0x14,0xac,0x62,0x00,0x00,0x30,0x90,0x00,0xff, +0x00,0x05,0x28,0x42,0x00,0x00,0x48,0x21,0x27,0x8f,0xb4,0x94,0x00,0x00,0x50,0x21, +0x00,0x00,0x58,0x21,0x27,0x98,0xb5,0x74,0x27,0x99,0xb5,0x70,0x27,0x8e,0xb5,0x6e, +0x27,0x8c,0xb4,0x98,0x27,0x8d,0xb4,0xf0,0x27,0x88,0xb5,0x68,0x00,0x0a,0x18,0x80, +0x01,0x6f,0x10,0x21,0xac,0x40,0x00,0x00,0xac,0x45,0x00,0x58,0x00,0x6e,0x20,0x21, +0x00,0x78,0x10,0x21,0xa1,0x00,0xff,0xfc,0xad,0x00,0x00,0x00,0xa1,0x00,0x00,0x04, +0xa1,0x00,0x00,0x05,0xad,0x00,0xff,0xf8,0x00,0x79,0x18,0x21,0x24,0x06,0x00,0x01, +0x24,0xc6,0xff,0xff,0xa0,0x80,0x00,0x00,0xa4,0x60,0x00,0x00,0xac,0x40,0x00,0x00, +0x24,0x63,0x00,0x02,0x24,0x42,0x00,0x04,0x04,0xc1,0xff,0xf9,0x24,0x84,0x00,0x01, +0x00,0x0a,0x10,0x80,0x00,0x4d,0x20,0x21,0x00,0x00,0x30,0x21,0x00,0x4c,0x18,0x21, +0x27,0x87,0x81,0x64,0x8c,0xe2,0x00,0x00,0x24,0xe7,0x00,0x04,0xac,0x82,0x00,0x00, +0xa0,0x66,0x00,0x00,0xa0,0x66,0x00,0x01,0x24,0xc6,0x00,0x01,0x28,0xc2,0x00,0x1c, +0xa0,0x60,0x00,0x02,0x24,0x84,0x00,0x04,0x14,0x40,0xff,0xf6,0x24,0x63,0x00,0x03, +0x25,0x29,0x00,0x01,0x29,0x22,0x00,0x08,0x25,0x4a,0x00,0x3b,0x25,0x08,0x00,0xec, +0x14,0x40,0xff,0xd6,0x25,0x6b,0x00,0xec,0xa7,0x80,0x81,0x60,0x00,0x00,0x48,0x21, +0x27,0x83,0xb4,0x40,0xac,0x69,0x00,0x00,0x25,0x29,0x00,0x01,0x29,0x22,0x00,0x0c, +0x14,0x40,0xff,0xfc,0x24,0x63,0x00,0x04,0x0c,0x00,0x21,0x2d,0x00,0x00,0x00,0x00, +0x2e,0x04,0x00,0x14,0x27,0x83,0xb4,0x90,0x24,0x09,0x00,0x07,0x10,0x80,0x00,0x0a, +0x00,0x00,0x00,0x00,0x90,0x62,0x00,0xd5,0x25,0x29,0xff,0xff,0xa0,0x62,0x00,0x00, +0x05,0x21,0xff,0xfa,0x24,0x63,0x00,0xec,0x8f,0xbf,0x00,0x14,0x8f,0xb0,0x00,0x10, +0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x18,0x90,0x62,0x00,0xd6,0x08,0x00,0x21,0xeb, +0x25,0x29,0xff,0xff,0x30,0x84,0x00,0xff,0x00,0x04,0x11,0x00,0x00,0x44,0x10,0x23, +0x00,0x02,0x10,0x80,0x00,0x44,0x10,0x23,0x00,0x02,0x10,0x80,0x27,0x83,0xb4,0x90, +0x00,0x43,0x60,0x21,0x3c,0x04,0xb0,0x03,0x3c,0x02,0x80,0x01,0x34,0x84,0x00,0x20, +0x24,0x42,0x87,0xd4,0x30,0xc6,0x00,0xff,0x93,0xa9,0x00,0x13,0x30,0xa5,0x00,0xff, +0x30,0xe7,0x00,0xff,0xac,0x82,0x00,0x00,0x10,0xc0,0x00,0xeb,0x25,0x8f,0x00,0xd0, +0x91,0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x42,0xff,0xfc,0x2c,0x43,0x00,0x18, +0x10,0x60,0x00,0xcf,0x3c,0x03,0x80,0x01,0x00,0x02,0x10,0x80,0x24,0x63,0x02,0x5c, +0x00,0x43,0x10,0x21,0x8c,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x08, +0x00,0x00,0x00,0x00,0x2d,0x22,0x00,0x2d,0x10,0x40,0x00,0x14,0x00,0x00,0x00,0x00, +0x10,0xa0,0x00,0x0f,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xa2,0x00,0x09, +0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x02,0x10,0xa2,0x00,0x06,0x00,0x00,0x00,0x00, +0x8d,0x82,0x00,0xd0,0x00,0x00,0x00,0x00,0x24,0x42,0xff,0xd0,0x03,0xe0,0x00,0x08, +0xad,0x82,0x00,0xd0,0x8d,0x82,0x00,0xd0,0x08,0x00,0x22,0x23,0x24,0x42,0xff,0xe0, +0x8d,0x82,0x00,0xd0,0x08,0x00,0x22,0x23,0x24,0x42,0x00,0x01,0x10,0xa0,0x00,0x0f, +0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0xf9,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x02,0x10,0xa2,0x00,0x07,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x03, +0x14,0xa2,0xff,0xf0,0x00,0x00,0x00,0x00,0x8d,0x82,0x00,0xd0,0x08,0x00,0x22,0x23, +0x24,0x42,0xff,0xe8,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00,0x8d,0x82,0x00,0xd0, +0x08,0x00,0x22,0x23,0x24,0x42,0x00,0x02,0x10,0xa0,0xff,0xfc,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0xe6,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x02, +0x10,0xa2,0xff,0xf4,0x24,0x02,0x00,0x03,0x14,0xa2,0xff,0xef,0x00,0x00,0x00,0x00, +0x8d,0x82,0x00,0xd0,0x08,0x00,0x22,0x23,0x24,0x42,0xff,0xf8,0x2d,0x22,0x00,0x19, +0x14,0x40,0xff,0xde,0x00,0x00,0x00,0x00,0x10,0xa0,0xff,0xec,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0xd6,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x02, +0x10,0xa2,0xff,0xe4,0x24,0x02,0x00,0x03,0x10,0xa2,0xff,0xf1,0x00,0x00,0x00,0x00, +0x8d,0x82,0x00,0xd0,0x08,0x00,0x22,0x23,0x24,0x42,0xff,0xf0,0x2d,0x22,0x00,0x1b, +0x10,0x40,0xff,0xf1,0x00,0x00,0x00,0x00,0x10,0xa0,0xff,0xdc,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0xc6,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x02, +0x14,0xa2,0xff,0xce,0x00,0x00,0x00,0x00,0x8d,0x82,0x00,0xd0,0x08,0x00,0x22,0x23, +0x24,0x42,0xff,0xf4,0x2d,0x22,0x00,0x1e,0x10,0x40,0xff,0xe3,0x00,0x00,0x00,0x00, +0x10,0xa0,0xff,0xce,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0xc9, +0x24,0x02,0x00,0x02,0x10,0xa2,0xff,0xd6,0x00,0x00,0x00,0x00,0x08,0x00,0x22,0x34, +0x24,0x02,0x00,0x03,0x2d,0x22,0x00,0x23,0x10,0x40,0xff,0xd7,0x00,0x00,0x00,0x00, +0x10,0xa0,0xff,0xaf,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0xbd, +0x24,0x02,0x00,0x02,0x10,0xa2,0xff,0xda,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x03, +0x14,0xa2,0xff,0x9f,0x00,0x00,0x00,0x00,0x08,0x00,0x22,0x25,0x00,0x00,0x00,0x00, +0x2d,0x22,0x00,0x25,0x10,0x40,0xff,0xc8,0x00,0x00,0x00,0x00,0x10,0xa0,0xff,0xa0, +0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xa2,0x00,0x06,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x02,0x10,0xa2,0xff,0x97,0x00,0x00,0x00,0x00,0x08,0x00,0x22,0x80, +0x24,0x02,0x00,0x03,0x8d,0x82,0x00,0xd0,0x08,0x00,0x22,0x23,0x24,0x42,0xff,0xfc, +0x2d,0x22,0x00,0x16,0x14,0x40,0x00,0x0e,0x00,0x00,0x00,0x00,0x10,0xa0,0xff,0xa3, +0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0x8d,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x02,0x10,0xa2,0xff,0x9b,0x24,0x02,0x00,0x03,0x14,0xa2,0xff,0xa8, +0x00,0x00,0x00,0x00,0x8d,0x82,0x00,0xd0,0x08,0x00,0x22,0x23,0x24,0x42,0xff,0xfa, +0x10,0xa0,0xff,0x96,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0x80, +0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x02,0x10,0xa2,0xff,0x8e,0x00,0x00,0x00,0x00, +0x08,0x00,0x22,0x48,0x00,0x00,0x00,0x00,0x2d,0x22,0x00,0x17,0x14,0x40,0xff,0x9e, +0x00,0x00,0x00,0x00,0x08,0x00,0x22,0x97,0x00,0x00,0x00,0x00,0x2d,0x22,0x00,0x19, +0x10,0x40,0xff,0xe2,0x00,0x00,0x00,0x00,0x10,0xa0,0xff,0x84,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0x6e,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x02, +0x10,0xa2,0xff,0x7c,0x24,0x02,0x00,0x03,0x10,0xa2,0xff,0x89,0x00,0x00,0x00,0x00, +0x08,0x00,0x22,0x25,0x00,0x00,0x00,0x00,0x08,0x00,0x22,0xb4,0x2d,0x22,0x00,0x1b, +0x2d,0x22,0x00,0x1e,0x10,0x40,0xff,0xde,0x00,0x00,0x00,0x00,0x10,0xa0,0xff,0x73, +0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0x5d,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x02,0x10,0xa2,0xff,0x6b,0x24,0x02,0x00,0x03,0x10,0xa2,0xff,0x88, +0x00,0x00,0x00,0x00,0x08,0x00,0x22,0x25,0x00,0x00,0x00,0x00,0x2d,0x22,0x00,0x23, +0x14,0x40,0xff,0xf2,0x00,0x00,0x00,0x00,0x08,0x00,0x22,0x4e,0x00,0x00,0x00,0x00, +0x08,0x00,0x22,0x4c,0x2d,0x22,0x00,0x25,0x08,0x00,0x22,0x85,0x2d,0x22,0x00,0x27, +0x10,0xa0,0xff,0x5e,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0x48, +0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x02,0x10,0xa2,0xff,0x56,0x24,0x02,0x00,0x03, +0x14,0xa2,0xff,0x63,0x00,0x00,0x00,0x00,0x08,0x00,0x22,0x91,0x00,0x00,0x00,0x00, +0x2d,0x22,0x00,0x27,0x14,0x40,0xff,0x8e,0x00,0x00,0x00,0x00,0x08,0x00,0x22,0x3e, +0x00,0x00,0x00,0x00,0x2d,0x22,0x00,0x29,0x14,0x40,0xff,0x89,0x00,0x00,0x00,0x00, +0x08,0x00,0x22,0x2b,0x00,0x00,0x00,0x00,0x91,0x86,0x00,0x00,0x91,0x83,0x00,0xd4, +0x25,0x8d,0x00,0x5c,0x30,0xc4,0x00,0xff,0x00,0x04,0x10,0x40,0x00,0x44,0x10,0x21, +0x00,0x04,0x50,0x80,0x01,0x82,0x58,0x21,0x01,0x8a,0x40,0x21,0x25,0x78,0x00,0x08, +0x10,0x60,0x00,0x37,0x25,0x0e,0x00,0x60,0x2c,0xa2,0x00,0x03,0x14,0x40,0x00,0x25, +0x00,0x00,0x00,0x00,0x91,0x82,0x00,0xdd,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x1e, +0x00,0x00,0x00,0x00,0x27,0x87,0x81,0x64,0x01,0x47,0x10,0x21,0x8c,0x43,0x00,0x00, +0x00,0x00,0x00,0x00,0xad,0x03,0x00,0x60,0x91,0x62,0x00,0x08,0x00,0x00,0x00,0x00, +0x00,0x40,0x30,0x21,0xa1,0x82,0x00,0x00,0x30,0xc2,0x00,0xff,0x00,0x02,0x10,0x80, +0x00,0x47,0x10,0x21,0x8c,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x18,0x42, +0xad,0xa3,0x00,0x00,0x91,0x84,0x00,0x00,0x8d,0xc5,0x00,0x00,0x00,0x04,0x20,0x80, +0x00,0x87,0x10,0x21,0x8c,0x43,0x00,0x00,0x00,0x05,0x28,0x40,0x00,0x8c,0x20,0x21, +0x00,0x03,0x18,0x80,0x00,0xa3,0x10,0x2b,0x00,0x62,0x28,0x0a,0xac,0x85,0x00,0x60, +0x03,0xe0,0x00,0x08,0xa1,0x80,0x00,0xd4,0x27,0x87,0x81,0x64,0x08,0x00,0x23,0x0e, +0xa1,0x80,0x00,0xdd,0x27,0x82,0x81,0xd4,0x8d,0x83,0x00,0xd8,0x00,0x82,0x10,0x21, +0x90,0x44,0x00,0x00,0x24,0x63,0x00,0x01,0x00,0x64,0x20,0x2b,0x14,0x80,0xff,0x0d, +0xad,0x83,0x00,0xd8,0x8d,0x02,0x00,0x60,0xa1,0x80,0x00,0xd4,0x00,0x02,0x1f,0xc2, +0x00,0x43,0x10,0x21,0x00,0x02,0x10,0x43,0x03,0xe0,0x00,0x08,0xad,0x82,0x00,0x5c, +0x10,0xe0,0x00,0x1a,0x24,0x83,0xff,0xfc,0x2c,0x62,0x00,0x18,0x10,0x40,0x01,0x18, +0x00,0x03,0x10,0x80,0x3c,0x03,0x80,0x01,0x24,0x63,0x02,0xbc,0x00,0x43,0x10,0x21, +0x8c,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x08,0x00,0x00,0x00,0x00, +0x2d,0x22,0x00,0x2d,0x10,0x40,0x00,0x5f,0x00,0x00,0x00,0x00,0x10,0xa0,0x00,0x5a, +0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xa2,0x00,0x54,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x02,0x10,0xa2,0x00,0x51,0x00,0x00,0x00,0x00,0x8d,0x82,0x00,0xd0, +0x00,0x00,0x00,0x00,0x24,0x42,0xff,0xd0,0xad,0x82,0x00,0xd0,0x8d,0xe3,0x00,0x00, +0x8d,0xa2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x43,0x10,0x21,0xad,0xa2,0x00,0x00, +0xad,0xe0,0x00,0x00,0x8d,0xa3,0x00,0x00,0x8d,0xc4,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x83,0x10,0x2a,0x10,0x40,0x00,0x22,0x00,0x00,0x00,0x00,0x93,0x05,0x00,0x01, +0x91,0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x45,0x00,0x05,0x24,0x02,0x00,0x01, +0xa1,0x85,0x00,0x00,0xa1,0x82,0x00,0xd4,0x03,0xe0,0x00,0x08,0xad,0x80,0x00,0xd8, +0x91,0x82,0x00,0xdd,0x24,0x03,0x00,0x01,0x10,0x43,0x00,0x05,0x00,0x00,0x00,0x00, +0xa1,0x83,0x00,0xd4,0xad,0x80,0x00,0xd8,0x03,0xe0,0x00,0x08,0xa1,0x83,0x00,0xdd, +0x00,0x04,0x17,0xc2,0x00,0x82,0x10,0x21,0x00,0x02,0x10,0x43,0xad,0xa2,0x00,0x00, +0x91,0x83,0x00,0x00,0x27,0x82,0x81,0x64,0x8d,0xc5,0x00,0x00,0x00,0x03,0x18,0x80, +0x00,0x62,0x18,0x21,0x8c,0x64,0x00,0x00,0x00,0x05,0x28,0x40,0x00,0x04,0x18,0x80, +0x00,0xa3,0x10,0x2b,0x00,0x62,0x28,0x0a,0x08,0x00,0x23,0x20,0xad,0xc5,0x00,0x00, +0x97,0x82,0x8b,0x6c,0x00,0x00,0x00,0x00,0x00,0x62,0x10,0x2a,0x10,0x40,0xfe,0xb9, +0x00,0x00,0x00,0x00,0x91,0x82,0x00,0xdd,0x00,0x00,0x00,0x00,0x14,0x40,0x00,0x15, +0x00,0x00,0x00,0x00,0x91,0x83,0x00,0x00,0x27,0x82,0x81,0x64,0x00,0x03,0x18,0x80, +0x00,0x62,0x10,0x21,0x8c,0x44,0x00,0x00,0x00,0x6c,0x18,0x21,0xac,0x64,0x00,0x60, +0x93,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x10,0x80,0x01,0x82,0x10,0x21, +0x24,0x4e,0x00,0x60,0xa1,0x85,0x00,0x00,0x8d,0xc2,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x02,0x1f,0xc2,0x00,0x43,0x10,0x21,0x00,0x02,0x10,0x43,0x03,0xe0,0x00,0x08, +0xad,0xa2,0x00,0x00,0x08,0x00,0x23,0x92,0xa1,0x80,0x00,0xdd,0x8d,0x82,0x00,0xd0, +0x08,0x00,0x23,0x4e,0x24,0x42,0xff,0xe0,0x8d,0x82,0x00,0xd0,0x08,0x00,0x23,0x4e, +0x24,0x42,0x00,0x01,0x10,0xa0,0x00,0x0d,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01, +0x10,0xa2,0xff,0xf9,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x02,0x10,0xa2,0xff,0xa7, +0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x03,0x14,0xa2,0xff,0xf0,0x00,0x00,0x00,0x00, +0x8d,0x82,0x00,0xd0,0x08,0x00,0x23,0x4e,0x24,0x42,0xff,0xe8,0x8d,0x82,0x00,0xd0, +0x08,0x00,0x23,0x4e,0x24,0x42,0x00,0x02,0x10,0xa0,0xff,0xfc,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0xe8,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x02, +0x10,0xa2,0xff,0x96,0x24,0x02,0x00,0x03,0x14,0xa2,0xff,0xf1,0x00,0x00,0x00,0x00, +0x8d,0x82,0x00,0xd0,0x08,0x00,0x23,0x4e,0x24,0x42,0xff,0xf8,0x2d,0x22,0x00,0x19, +0x14,0x40,0xff,0xe0,0x00,0x00,0x00,0x00,0x10,0xa0,0xff,0xec,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0xd8,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x02, +0x10,0xa2,0xff,0x86,0x24,0x02,0x00,0x03,0x10,0xa2,0xff,0xf1,0x00,0x00,0x00,0x00, +0x8d,0x82,0x00,0xd0,0x08,0x00,0x23,0x4e,0x24,0x42,0xff,0xf0,0x2d,0x22,0x00,0x1b, +0x10,0x40,0xff,0xf1,0x00,0x00,0x00,0x00,0x10,0xa0,0xff,0xdc,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0xc8,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x02, +0x14,0xa2,0xff,0xd0,0x00,0x00,0x00,0x00,0x8d,0x82,0x00,0xd0,0x08,0x00,0x23,0x4e, +0x24,0x42,0xff,0xf4,0x2d,0x22,0x00,0x1e,0x10,0x40,0xff,0xe3,0x00,0x00,0x00,0x00, +0x10,0xa0,0xff,0xce,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0x6b, +0x24,0x02,0x00,0x02,0x10,0xa2,0xff,0xd6,0x00,0x00,0x00,0x00,0x08,0x00,0x23,0xaa, +0x24,0x02,0x00,0x03,0x2d,0x22,0x00,0x23,0x10,0x40,0xff,0xd7,0x00,0x00,0x00,0x00, +0x10,0xa0,0xff,0xb1,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0x5f, +0x24,0x02,0x00,0x02,0x10,0xa2,0xff,0xda,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x03, +0x14,0xa2,0xff,0x56,0x00,0x00,0x00,0x00,0x08,0x00,0x23,0x9b,0x00,0x00,0x00,0x00, +0x2d,0x22,0x00,0x25,0x10,0x40,0xff,0xc8,0x00,0x00,0x00,0x00,0x10,0xa0,0xff,0xa2, +0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xa2,0x00,0x06,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x02,0x10,0xa2,0xff,0x99,0x00,0x00,0x00,0x00,0x08,0x00,0x23,0xf4, +0x24,0x02,0x00,0x03,0x8d,0x82,0x00,0xd0,0x08,0x00,0x23,0x4e,0x24,0x42,0xff,0xfc, +0x2d,0x22,0x00,0x16,0x14,0x40,0x00,0x0e,0x00,0x00,0x00,0x00,0x10,0xa0,0xff,0xa3, +0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0x8f,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x02,0x10,0xa2,0xff,0x3d,0x24,0x02,0x00,0x03,0x14,0xa2,0xff,0xa8, +0x00,0x00,0x00,0x00,0x8d,0x82,0x00,0xd0,0x08,0x00,0x23,0x4e,0x24,0x42,0xff,0xfa, +0x10,0xa0,0xff,0x96,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0x82, +0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x02,0x10,0xa2,0xff,0x30,0x00,0x00,0x00,0x00, +0x08,0x00,0x23,0xbc,0x00,0x00,0x00,0x00,0x2d,0x22,0x00,0x17,0x14,0x40,0xff,0x9e, +0x00,0x00,0x00,0x00,0x08,0x00,0x24,0x0b,0x00,0x00,0x00,0x00,0x2d,0x22,0x00,0x19, +0x10,0x40,0xff,0xe2,0x00,0x00,0x00,0x00,0x10,0xa0,0xff,0x84,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0x70,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x02, +0x10,0xa2,0xff,0x1e,0x24,0x02,0x00,0x03,0x10,0xa2,0xff,0x89,0x00,0x00,0x00,0x00, +0x08,0x00,0x23,0x9b,0x00,0x00,0x00,0x00,0x08,0x00,0x24,0x28,0x2d,0x22,0x00,0x1b, +0x2d,0x22,0x00,0x1e,0x10,0x40,0xff,0xde,0x00,0x00,0x00,0x00,0x10,0xa0,0xff,0x73, +0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0x5f,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x02,0x10,0xa2,0xff,0x0d,0x24,0x02,0x00,0x03,0x10,0xa2,0xff,0x88, +0x00,0x00,0x00,0x00,0x08,0x00,0x23,0x9b,0x00,0x00,0x00,0x00,0x2d,0x22,0x00,0x23, +0x14,0x40,0xff,0xf2,0x00,0x00,0x00,0x00,0x08,0x00,0x23,0xc2,0x00,0x00,0x00,0x00, +0x08,0x00,0x23,0xc0,0x2d,0x22,0x00,0x25,0x08,0x00,0x23,0xf9,0x2d,0x22,0x00,0x27, +0x10,0xa0,0xff,0x5e,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x01,0x10,0xa2,0xff,0x4a, +0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x02,0x10,0xa2,0xfe,0xf8,0x24,0x02,0x00,0x03, +0x14,0xa2,0xff,0x63,0x00,0x00,0x00,0x00,0x08,0x00,0x24,0x05,0x00,0x00,0x00,0x00, +0x2d,0x22,0x00,0x27,0x14,0x40,0xff,0x8e,0x00,0x00,0x00,0x00,0x08,0x00,0x23,0xb2, +0x00,0x00,0x00,0x00,0x2d,0x22,0x00,0x29,0x14,0x40,0xff,0x89,0x00,0x00,0x00,0x00, +0x08,0x00,0x23,0xa1,0x00,0x00,0x00,0x00,0x27,0xbd,0xff,0xe8,0x3c,0x02,0xb0,0x03, +0xaf,0xbf,0x00,0x14,0xaf,0xb0,0x00,0x10,0x34,0x42,0x01,0x18,0x3c,0x03,0xb0,0x03, +0x8c,0x50,0x00,0x00,0x34,0x63,0x01,0x2c,0x90,0x62,0x00,0x00,0x32,0x05,0x00,0x01, +0xa3,0x82,0x80,0x10,0x14,0xa0,0x00,0x14,0x30,0x44,0x00,0xff,0x32,0x02,0x01,0x00, +0x14,0x40,0x00,0x09,0x00,0x00,0x00,0x00,0x32,0x02,0x08,0x00,0x10,0x40,0x00,0x02, +0x24,0x02,0x00,0x01,0xa3,0x82,0xbc,0x08,0x8f,0xbf,0x00,0x14,0x8f,0xb0,0x00,0x10, +0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x18,0x0c,0x00,0x05,0x39,0x00,0x00,0x00,0x00, +0x26,0x02,0xff,0x00,0xa3,0x80,0xbc,0x08,0x3c,0x01,0xb0,0x03,0xac,0x22,0x01,0x18, +0x08,0x00,0x24,0x77,0x32,0x02,0x08,0x00,0x0c,0x00,0x21,0x9a,0x00,0x00,0x00,0x00, +0x26,0x02,0xff,0xff,0x3c,0x01,0xb0,0x03,0xac,0x22,0x01,0x18,0x08,0x00,0x24,0x74, +0x32,0x02,0x01,0x00,0x27,0xbd,0xff,0xe0,0x3c,0x02,0xb0,0x03,0x34,0x42,0x00,0xd0, +0xaf,0xbf,0x00,0x18,0x8c,0x43,0x00,0x00,0x3c,0x02,0x00,0x40,0x24,0x07,0x0f,0xff, +0x00,0x03,0x33,0x02,0x00,0x03,0x2d,0x02,0x00,0x03,0x43,0x02,0x30,0x69,0x0f,0xff, +0x00,0x62,0x18,0x24,0x30,0xa5,0x00,0x03,0x30,0xc6,0x00,0xff,0x10,0x60,0x00,0x08, +0x31,0x08,0x00,0xff,0x01,0x00,0x30,0x21,0x0c,0x00,0x25,0x38,0xaf,0xa9,0x00,0x10, +0x8f,0xbf,0x00,0x18,0x00,0x00,0x00,0x00,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x20, +0x0c,0x00,0x25,0x8a,0x00,0x00,0x00,0x00,0x3c,0x03,0xb0,0x03,0x34,0x63,0x00,0xd4, +0x08,0x00,0x24,0xa0,0xac,0x62,0x00,0x00,0x27,0xbd,0xff,0xc0,0xaf,0xb6,0x00,0x30, +0xaf,0xb3,0x00,0x24,0xaf,0xb1,0x00,0x1c,0xaf,0xb0,0x00,0x18,0xaf,0xbf,0x00,0x3c, +0xaf,0xbe,0x00,0x38,0xaf,0xb7,0x00,0x34,0xaf,0xb5,0x00,0x2c,0xaf,0xb4,0x00,0x28, +0xaf,0xb2,0x00,0x20,0x0c,0x00,0x17,0xc8,0x00,0x80,0x80,0x21,0x00,0x00,0xb0,0x21, +0x00,0x00,0x88,0x21,0x10,0x40,0x00,0x12,0x00,0x00,0x98,0x21,0x3c,0x02,0xb0,0x03, +0x3c,0x03,0xb0,0x03,0x3c,0x04,0xb0,0x03,0x24,0x05,0x00,0x01,0x34,0x42,0x00,0xbc, +0x34,0x63,0x00,0xbb,0x34,0x84,0x00,0xba,0xa4,0x40,0x00,0x00,0xa0,0x65,0x00,0x00, +0xa0,0x85,0x00,0x00,0x7b,0xbe,0x01,0xfc,0x7b,0xb6,0x01,0xbc,0x7b,0xb4,0x01,0x7c, +0x7b,0xb2,0x01,0x3c,0x7b,0xb0,0x00,0xfc,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x40, +0x3c,0x02,0xb0,0x03,0x34,0x42,0x01,0x47,0x90,0x44,0x00,0x00,0x00,0x10,0x1a,0x02, +0x3c,0x15,0xfd,0xff,0x30,0x84,0x00,0xff,0xa0,0x50,0x00,0x00,0x30,0x74,0x00,0x0f, +0xaf,0xa4,0x00,0x10,0x00,0x00,0x90,0x21,0x3c,0x17,0x02,0x00,0x36,0xb5,0xff,0xff, +0x3c,0x1e,0xb0,0x03,0x0c,0x00,0x06,0xce,0x24,0x04,0x04,0x00,0x00,0x57,0x10,0x25, +0x00,0x40,0x28,0x21,0x0c,0x00,0x06,0xc1,0x24,0x04,0x04,0x00,0x00,0x00,0x80,0x21, +0x0c,0x00,0x26,0x52,0x00,0x00,0x00,0x00,0x26,0x03,0x00,0x01,0x30,0x70,0x00,0xff, +0x10,0x40,0x00,0x47,0x2e,0x03,0x00,0x02,0x14,0x60,0xff,0xf9,0x00,0x00,0x00,0x00, +0x0c,0x00,0x06,0xce,0x24,0x04,0x04,0x00,0x00,0x55,0x10,0x24,0x00,0x40,0x28,0x21, +0x0c,0x00,0x06,0xc1,0x24,0x04,0x04,0x00,0x24,0x02,0x00,0x01,0x12,0x82,0x00,0x38, +0x00,0x00,0x00,0x00,0x12,0x80,0x00,0x36,0x00,0x00,0x00,0x00,0x32,0x22,0x00,0x60, +0x32,0x23,0x0c,0x00,0x00,0x03,0x1a,0x02,0x3c,0x05,0x00,0x60,0x00,0x02,0x11,0x42, +0x02,0x25,0x20,0x24,0x00,0x43,0x10,0x25,0x3c,0x03,0x04,0x00,0x02,0x23,0x28,0x24, +0x00,0x04,0x24,0x42,0x00,0x44,0x10,0x25,0x00,0x05,0x2d,0x02,0x00,0x45,0x88,0x25, +0x12,0x20,0x00,0x05,0x26,0x42,0x00,0x01,0x26,0xc2,0x00,0x01,0x30,0x56,0x00,0xff, +0x02,0x71,0x98,0x21,0x26,0x42,0x00,0x01,0x02,0x5e,0x20,0x21,0x30,0x52,0x00,0xff, +0x2e,0x43,0x00,0x05,0xa0,0x91,0x00,0xd8,0x14,0x60,0xff,0xce,0x3c,0x02,0xb0,0x03, +0x8f,0xa5,0x00,0x10,0x34,0x42,0x01,0x47,0xa0,0x45,0x00,0x00,0x12,0x60,0x00,0x0e, +0x3c,0x02,0xb0,0x03,0x12,0xc0,0x00,0x0d,0x34,0x42,0x00,0xbc,0x00,0x13,0x10,0x40, +0x00,0x53,0x10,0x21,0x00,0x02,0x10,0xc0,0x00,0x53,0x10,0x21,0x00,0x02,0x98,0x80, +0x02,0x76,0x00,0x1b,0x16,0xc0,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x0d, +0x00,0x00,0x98,0x12,0x3c,0x02,0xb0,0x03,0x34,0x42,0x00,0xbc,0x3c,0x03,0xb0,0x03, +0x3c,0x04,0xb0,0x03,0xa4,0x53,0x00,0x00,0x34,0x63,0x00,0xbb,0x34,0x84,0x00,0xba, +0x24,0x02,0x00,0x01,0xa0,0x60,0x00,0x00,0x08,0x00,0x24,0xc5,0xa0,0x82,0x00,0x00, +0x0c,0x00,0x06,0xce,0x24,0x04,0x04,0xfc,0x08,0x00,0x24,0xf3,0x00,0x40,0x88,0x21, +0x3c,0x03,0xb0,0x03,0x34,0x63,0x00,0xbc,0x3c,0x04,0xb0,0x03,0x3c,0x05,0xb0,0x03, +0xa4,0x60,0x00,0x00,0x34,0x84,0x00,0xbb,0x34,0xa5,0x00,0xba,0x24,0x02,0x00,0x02, +0x24,0x03,0x00,0x01,0xa0,0x82,0x00,0x00,0x08,0x00,0x24,0xc5,0xa0,0xa3,0x00,0x00, +0x27,0xbd,0xff,0xd8,0xaf,0xb0,0x00,0x10,0x30,0xd0,0x00,0xff,0x2e,0x02,0x00,0x2e, +0xaf,0xb2,0x00,0x18,0xaf,0xb1,0x00,0x14,0xaf,0xbf,0x00,0x20,0xaf,0xb3,0x00,0x1c, +0x30,0xb1,0x00,0xff,0x14,0x40,0x00,0x06,0x00,0x80,0x90,0x21,0x8f,0xbf,0x00,0x20, +0x7b,0xb2,0x00,0xfc,0x7b,0xb0,0x00,0xbc,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x28, +0x2e,0x13,0x00,0x10,0x24,0x05,0x00,0x14,0x0c,0x00,0x13,0xa0,0x24,0x06,0x01,0x07, +0x12,0x60,0x00,0x38,0x02,0x00,0x30,0x21,0x8f,0xa2,0x00,0x38,0x30,0xc3,0x00,0x3f, +0x3c,0x04,0xb0,0x09,0x00,0x02,0x14,0x00,0x00,0x43,0x30,0x25,0x34,0x84,0x01,0x60, +0x90,0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x40,0xff,0xfd,0x24,0x02,0x00,0x01, +0x12,0x22,0x00,0x2a,0x2a,0x22,0x00,0x02,0x14,0x40,0x00,0x24,0x24,0x02,0x00,0x02, +0x12,0x22,0x00,0x20,0x24,0x02,0x00,0x03,0x12,0x22,0x00,0x19,0x00,0x00,0x00,0x00, +0x16,0x60,0xff,0xe2,0x24,0x02,0x00,0x01,0x12,0x22,0x00,0x13,0x2a,0x22,0x00,0x02, +0x14,0x40,0x00,0x0d,0x24,0x02,0x00,0x02,0x12,0x22,0x00,0x09,0x24,0x02,0x00,0x03, +0x16,0x22,0xff,0xda,0x00,0x00,0x00,0x00,0x24,0x04,0x08,0x4c,0x24,0x05,0xff,0xff, +0x0c,0x00,0x13,0x5b,0x3c,0x06,0x0c,0xb8,0x08,0x00,0x25,0x43,0x00,0x00,0x00,0x00, +0x08,0x00,0x25,0x6b,0x24,0x04,0x08,0x48,0x16,0x20,0xff,0xd0,0x00,0x00,0x00,0x00, +0x08,0x00,0x25,0x6b,0x24,0x04,0x08,0x40,0x08,0x00,0x25,0x6b,0x24,0x04,0x08,0x44, +0x24,0x04,0x08,0x4c,0x0c,0x00,0x13,0x5b,0x24,0x05,0xff,0xff,0x08,0x00,0x25,0x60, +0x00,0x00,0x00,0x00,0x08,0x00,0x25,0x79,0x24,0x04,0x08,0x48,0x16,0x20,0xff,0xe0, +0x00,0x00,0x00,0x00,0x08,0x00,0x25,0x79,0x24,0x04,0x08,0x40,0x08,0x00,0x25,0x79, +0x24,0x04,0x08,0x44,0x02,0x40,0x20,0x21,0x0c,0x00,0x25,0xca,0x02,0x20,0x28,0x21, +0x08,0x00,0x25,0x4e,0x00,0x40,0x30,0x21,0x27,0xbd,0xff,0xd8,0x2c,0xc2,0x00,0x2e, +0xaf,0xb2,0x00,0x18,0xaf,0xb1,0x00,0x14,0xaf,0xb0,0x00,0x10,0xaf,0xbf,0x00,0x20, +0xaf,0xb3,0x00,0x1c,0x00,0xc0,0x80,0x21,0x30,0xb1,0x00,0xff,0x00,0x80,0x90,0x21, +0x14,0x40,0x00,0x07,0x00,0x00,0x18,0x21,0x8f,0xbf,0x00,0x20,0x7b,0xb2,0x00,0xfc, +0x7b,0xb0,0x00,0xbc,0x00,0x60,0x10,0x21,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x28, +0x2e,0x13,0x00,0x10,0x24,0x05,0x00,0x14,0x0c,0x00,0x13,0xa0,0x24,0x06,0x01,0x07, +0x12,0x60,0x00,0x24,0x02,0x00,0x30,0x21,0x3c,0x03,0xb0,0x09,0x34,0x63,0x01,0x60, +0x90,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x40,0xff,0xfd,0x30,0xc5,0x00,0x3f, +0x0c,0x00,0x26,0x07,0x02,0x20,0x20,0x21,0x16,0x60,0x00,0x0a,0x00,0x40,0x80,0x21, +0x24,0x02,0x00,0x01,0x12,0x22,0x00,0x15,0x2a,0x22,0x00,0x02,0x14,0x40,0x00,0x0f, +0x24,0x02,0x00,0x02,0x12,0x22,0x00,0x0b,0x24,0x02,0x00,0x03,0x12,0x22,0x00,0x03, +0x00,0x00,0x00,0x00,0x08,0x00,0x25,0x96,0x02,0x00,0x18,0x21,0x24,0x04,0x08,0x4c, +0x24,0x05,0xff,0xff,0x0c,0x00,0x13,0x5b,0x3c,0x06,0x0c,0xb8,0x08,0x00,0x25,0x96, +0x02,0x00,0x18,0x21,0x08,0x00,0x25,0xb8,0x24,0x04,0x08,0x48,0x16,0x20,0xff,0xf5, +0x00,0x00,0x00,0x00,0x08,0x00,0x25,0xb8,0x24,0x04,0x08,0x40,0x08,0x00,0x25,0xb8, +0x24,0x04,0x08,0x44,0x02,0x40,0x20,0x21,0x0c,0x00,0x25,0xca,0x02,0x20,0x28,0x21, +0x08,0x00,0x25,0xa2,0x00,0x40,0x30,0x21,0x27,0xbd,0xff,0xe8,0x2c,0xc2,0x00,0x1f, +0xaf,0xb0,0x00,0x10,0xaf,0xbf,0x00,0x14,0x00,0xc0,0x80,0x21,0x14,0x40,0x00,0x1d, +0x30,0xa5,0x00,0xff,0x24,0x02,0x00,0x01,0x10,0xa2,0x00,0x18,0x28,0xa2,0x00,0x02, +0x14,0x40,0x00,0x12,0x24,0x02,0x00,0x02,0x10,0xa2,0x00,0x0e,0x24,0x02,0x00,0x03, +0x10,0xa2,0x00,0x07,0x24,0x04,0x08,0x4c,0x26,0x10,0xff,0xe2,0x02,0x00,0x10,0x21, +0x8f,0xbf,0x00,0x14,0x8f,0xb0,0x00,0x10,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x18, +0x24,0x05,0xff,0xff,0x0c,0x00,0x13,0x5b,0x3c,0x06,0x0d,0xf8,0x08,0x00,0x25,0xdb, +0x26,0x10,0xff,0xe2,0x08,0x00,0x25,0xe0,0x24,0x04,0x08,0x48,0x14,0xa0,0xff,0xf2, +0x24,0x04,0x08,0x40,0x08,0x00,0x25,0xe1,0x24,0x05,0xff,0xff,0x08,0x00,0x25,0xe0, +0x24,0x04,0x08,0x44,0x2c,0xc2,0x00,0x10,0x14,0x40,0xff,0xec,0x24,0x02,0x00,0x01, +0x10,0xa2,0x00,0x14,0x28,0xa2,0x00,0x02,0x14,0x40,0x00,0x0e,0x24,0x02,0x00,0x02, +0x10,0xa2,0x00,0x0a,0x24,0x02,0x00,0x03,0x10,0xa2,0x00,0x03,0x24,0x04,0x08,0x4c, +0x08,0x00,0x25,0xdb,0x26,0x10,0xff,0xf1,0x24,0x05,0xff,0xff,0x0c,0x00,0x13,0x5b, +0x3c,0x06,0x0d,0xb8,0x08,0x00,0x25,0xdb,0x26,0x10,0xff,0xf1,0x08,0x00,0x25,0xfa, +0x24,0x04,0x08,0x48,0x14,0xa0,0xff,0xf6,0x24,0x04,0x08,0x40,0x08,0x00,0x25,0xfb, +0x24,0x05,0xff,0xff,0x08,0x00,0x25,0xfa,0x24,0x04,0x08,0x44,0x27,0xbd,0xff,0xe8, +0x30,0x84,0x00,0xff,0x24,0x02,0x00,0x01,0x10,0x82,0x00,0x39,0xaf,0xbf,0x00,0x10, +0x28,0x82,0x00,0x02,0x14,0x40,0x00,0x27,0x00,0x00,0x00,0x00,0x24,0x02,0x00,0x02, +0x10,0x82,0x00,0x17,0x00,0xa0,0x30,0x21,0x24,0x02,0x00,0x03,0x10,0x82,0x00,0x05, +0x24,0x04,0x08,0x3c,0x8f,0xbf,0x00,0x10,0x00,0x00,0x00,0x00,0x03,0xe0,0x00,0x08, +0x27,0xbd,0x00,0x18,0x0c,0x00,0x13,0x5b,0x3c,0x05,0x3f,0x00,0x24,0x04,0x08,0x3c, +0x3c,0x05,0x80,0x00,0x0c,0x00,0x13,0x5b,0x00,0x00,0x30,0x21,0x24,0x04,0x08,0x3c, +0x3c,0x05,0x80,0x00,0x0c,0x00,0x13,0x5b,0x24,0x06,0x00,0x01,0x24,0x04,0x08,0xac, +0x0c,0x00,0x13,0x3d,0x24,0x05,0x0f,0xff,0x08,0x00,0x26,0x15,0x00,0x00,0x00,0x00, +0x24,0x04,0x08,0x34,0x0c,0x00,0x13,0x5b,0x3c,0x05,0x3f,0x00,0x24,0x04,0x08,0x34, +0x3c,0x05,0x80,0x00,0x0c,0x00,0x13,0x5b,0x00,0x00,0x30,0x21,0x24,0x04,0x08,0x34, +0x3c,0x05,0x80,0x00,0x0c,0x00,0x13,0x5b,0x24,0x06,0x00,0x01,0x08,0x00,0x26,0x24, +0x24,0x04,0x08,0xa8,0x14,0x80,0xff,0xdf,0x00,0xa0,0x30,0x21,0x24,0x04,0x08,0x24, +0x0c,0x00,0x13,0x5b,0x3c,0x05,0x3f,0x00,0x24,0x04,0x08,0x24,0x3c,0x05,0x80,0x00, +0x0c,0x00,0x13,0x5b,0x00,0x00,0x30,0x21,0x24,0x04,0x08,0x24,0x3c,0x05,0x80,0x00, +0x0c,0x00,0x13,0x5b,0x24,0x06,0x00,0x01,0x08,0x00,0x26,0x24,0x24,0x04,0x08,0xa0, +0x00,0xa0,0x30,0x21,0x24,0x04,0x08,0x2c,0x0c,0x00,0x13,0x5b,0x3c,0x05,0x3f,0x00, +0x24,0x04,0x08,0x2c,0x3c,0x05,0x80,0x00,0x0c,0x00,0x13,0x5b,0x00,0x00,0x30,0x21, +0x24,0x04,0x08,0x2c,0x3c,0x05,0x80,0x00,0x0c,0x00,0x13,0x5b,0x24,0x06,0x00,0x01, +0x08,0x00,0x26,0x24,0x24,0x04,0x08,0xa4,0x3c,0x05,0x00,0x14,0x3c,0x02,0xb0,0x05, +0x34,0x42,0x04,0x20,0x3c,0x06,0xc0,0x00,0x3c,0x03,0xb0,0x05,0x3c,0x04,0xb0,0x05, +0x34,0xa5,0x17,0x09,0xac,0x45,0x00,0x00,0x34,0xc6,0x05,0x07,0x34,0x63,0x04,0x24, +0x34,0x84,0x02,0x28,0x3c,0x07,0xb0,0x05,0x24,0x02,0x00,0x20,0xac,0x66,0x00,0x00, +0x34,0xe7,0x04,0x50,0xa0,0x82,0x00,0x00,0x90,0xe2,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x42,0x00,0x03,0x10,0x40,0xff,0xfc,0x24,0x02,0x00,0x01,0x03,0xe0,0x00,0x08, +0x00,0x00,0x00,0x00,0x93,0x85,0x81,0xf1,0x24,0x02,0x00,0x01,0x14,0xa2,0x00,0x51, +0x00,0x80,0x40,0x21,0x8c,0x89,0x00,0x04,0x3c,0x03,0xb0,0x01,0x01,0x23,0x30,0x21, +0x8c,0xc2,0x00,0x04,0x00,0x00,0x00,0x00,0x30,0x42,0x00,0x08,0x10,0x45,0x00,0x59, +0x00,0x00,0x00,0x00,0x94,0xc2,0x00,0x38,0x24,0x03,0x00,0xb4,0x30,0x44,0x00,0xff, +0x10,0x83,0x00,0x61,0x24,0x02,0x00,0xc4,0x10,0x82,0x00,0x54,0x24,0x02,0x00,0x94, +0x10,0x82,0x00,0x45,0x00,0x00,0x00,0x00,0x94,0xc2,0x00,0x38,0x00,0x00,0x00,0x00, +0x30,0x47,0xff,0xff,0x30,0xe3,0x40,0xff,0x24,0x02,0x40,0x88,0x14,0x62,0x00,0x39, +0x30,0xe3,0x03,0x00,0x24,0x02,0x03,0x00,0x10,0x62,0x00,0x38,0x00,0x00,0x00,0x00, +0x94,0xc2,0x00,0x56,0x00,0x00,0x00,0x00,0x30,0x47,0xff,0xff,0x30,0xe2,0x00,0x80, +0x14,0x40,0x00,0x30,0x3c,0x02,0xb0,0x01,0x01,0x22,0x30,0x21,0x94,0xc3,0x00,0x60, +0x24,0x02,0x00,0x08,0x14,0x43,0x00,0x3b,0x00,0x00,0x00,0x00,0x90,0xc2,0x00,0x62, +0x24,0x03,0x00,0x04,0x00,0x02,0x39,0x02,0x10,0xe3,0x00,0x15,0x24,0x02,0x00,0x06, +0x14,0xe2,0x00,0x34,0x00,0x00,0x00,0x00,0x8d,0x05,0x01,0xac,0x94,0xc4,0x00,0x66, +0x27,0x82,0x89,0x58,0x00,0x05,0x28,0x80,0x30,0x87,0xff,0xff,0x00,0xa2,0x28,0x21, +0x00,0x07,0x1a,0x00,0x8c,0xa4,0x00,0x00,0x00,0x07,0x12,0x02,0x00,0x43,0x10,0x25, +0x24,0x42,0x00,0x5e,0x24,0x03,0xc0,0x00,0x30,0x47,0xff,0xff,0x00,0x83,0x20,0x24, +0x00,0x87,0x20,0x25,0xac,0xa4,0x00,0x00,0x08,0x00,0x26,0xcd,0xad,0x07,0x00,0x10, +0x8d,0x05,0x01,0xac,0x94,0xc4,0x00,0x64,0x27,0x82,0x89,0x58,0x00,0x05,0x28,0x80, +0x30,0x87,0xff,0xff,0x00,0xa2,0x28,0x21,0x00,0x07,0x1a,0x00,0x8c,0xa4,0x00,0x00, +0x00,0x07,0x12,0x02,0x00,0x43,0x10,0x25,0x24,0x42,0x00,0x36,0x3c,0x03,0xff,0xff, +0x30,0x47,0xff,0xff,0x00,0x83,0x20,0x24,0x00,0x87,0x20,0x25,0xac,0xa4,0x00,0x00, +0xad,0x07,0x00,0x10,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00,0x94,0xc2,0x00,0x50, +0x08,0x00,0x26,0x8b,0x30,0x47,0xff,0xff,0x8d,0x04,0x01,0xac,0x27,0x83,0x89,0x58, +0x00,0x04,0x20,0x80,0x00,0x83,0x20,0x21,0x8c,0x82,0x00,0x00,0x3c,0x03,0xff,0xff, +0x00,0x43,0x10,0x24,0x34,0x42,0x00,0x2e,0xac,0x82,0x00,0x00,0x24,0x03,0x00,0x2e, +0xad,0x03,0x00,0x10,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00,0x8d,0x04,0x01,0xac, +0x27,0x83,0x89,0x58,0x00,0x04,0x20,0x80,0x00,0x83,0x20,0x21,0x8c,0x82,0x00,0x00, +0x3c,0x03,0xff,0xff,0x00,0x43,0x10,0x24,0x34,0x42,0x00,0x0e,0x24,0x03,0x00,0x0e, +0x08,0x00,0x26,0xcc,0xac,0x82,0x00,0x00,0x8d,0x04,0x01,0xac,0x27,0x83,0x89,0x58, +0x00,0x04,0x20,0x80,0x00,0x83,0x20,0x21,0x8c,0x82,0x00,0x00,0x3c,0x03,0xff,0xff, +0x00,0x43,0x10,0x24,0x34,0x42,0x00,0x14,0x24,0x03,0x00,0x14,0x08,0x00,0x26,0xcc, +0xac,0x82,0x00,0x00,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00,0x30,0xc6,0x00,0xff, +0x00,0x06,0x48,0x40,0x01,0x26,0x10,0x21,0x00,0x02,0x10,0x80,0x27,0x8b,0xbc,0x20, +0x27,0x83,0xbc,0x26,0x00,0x4b,0x40,0x21,0x00,0x43,0x10,0x21,0x94,0x47,0x00,0x00, +0x30,0xa2,0x3f,0xff,0x10,0xe2,0x00,0x29,0x30,0x8a,0xff,0xff,0x95,0x02,0x00,0x02, +0x24,0x03,0x00,0x01,0x00,0x02,0x11,0x82,0x30,0x42,0x00,0x01,0x10,0x43,0x00,0x18, +0x00,0x00,0x00,0x00,0x01,0x26,0x10,0x21,0x00,0x02,0x10,0x80,0x00,0x4b,0x30,0x21, +0x94,0xc4,0x00,0x02,0x27,0x83,0xbc,0x26,0x27,0x85,0xbc,0x24,0x00,0x45,0x28,0x21, +0x30,0x84,0xff,0xdf,0x00,0x43,0x10,0x21,0xa4,0xc4,0x00,0x02,0xa4,0x40,0x00,0x00, +0xa4,0xa0,0x00,0x00,0x94,0xc3,0x00,0x02,0x3c,0x04,0xb0,0x01,0x01,0x44,0x20,0x21, +0x30,0x63,0xff,0xbf,0xa4,0xc3,0x00,0x02,0xa0,0xc0,0x00,0x00,0x8c,0x82,0x00,0x04, +0x24,0x03,0xf0,0xff,0x00,0x43,0x10,0x24,0x03,0xe0,0x00,0x08,0xac,0x82,0x00,0x04, +0x24,0x02,0xc0,0x00,0x91,0x04,0x00,0x01,0x00,0xa2,0x10,0x24,0x00,0x47,0x28,0x25, +0x3c,0x03,0xb0,0x01,0x24,0x02,0x00,0x02,0x14,0x82,0xff,0xe2,0x01,0x43,0x18,0x21, +0xac,0x65,0x00,0x00,0x08,0x00,0x26,0xfa,0x01,0x26,0x10,0x21,0x08,0x00,0x26,0xfa, +0x01,0x26,0x10,0x21,0x93,0x83,0x81,0xf1,0x24,0x02,0x00,0x01,0x14,0x62,0x00,0x0d, +0x3c,0x02,0xb0,0x01,0x8c,0x84,0x00,0x04,0x3c,0x06,0xb0,0x09,0x00,0x82,0x20,0x21, +0x8c,0x85,0x00,0x08,0x8c,0x83,0x00,0x04,0x3c,0x02,0x01,0x00,0x34,0xc6,0x01,0x00, +0x00,0x62,0x18,0x24,0x14,0x60,0x00,0x05,0x30,0xa5,0x20,0x00,0x24,0x02,0x00,0x06, +0xa0,0xc2,0x00,0x00,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00,0x3c,0x03,0xb0,0x09, +0x10,0xa0,0xff,0xfc,0x34,0x63,0x01,0x00,0x24,0x02,0x00,0x0e,0x08,0x00,0x27,0x2d, +0xa0,0x62,0x00,0x00,0x3c,0x02,0xb0,0x01,0x30,0xa5,0xff,0xff,0x00,0xa2,0x28,0x21, +0x8c,0xa3,0x00,0x00,0x3c,0x02,0x10,0x00,0x00,0x80,0x30,0x21,0x00,0x62,0x18,0x24, +0x8c,0xa2,0x00,0x04,0x10,0x60,0x00,0x04,0x00,0x00,0x00,0x00,0x30,0x42,0x80,0x00, +0x10,0x40,0x00,0x13,0x00,0x00,0x00,0x00,0x8c,0xc2,0x01,0xa8,0x00,0x00,0x00,0x00, +0x24,0x44,0x00,0x01,0x28,0x83,0x00,0x00,0x24,0x42,0x00,0x40,0x00,0x83,0x10,0x0a, +0x93,0x83,0x81,0xf0,0x00,0x02,0x11,0x83,0x00,0x02,0x11,0x80,0x00,0x82,0x20,0x23, +0x24,0x63,0xff,0xff,0xac,0xc4,0x01,0xa8,0xa3,0x83,0x81,0xf0,0x8c,0xc4,0x01,0xac, +0x8c,0xc2,0x01,0xa8,0x00,0x00,0x00,0x00,0x00,0x44,0x10,0x26,0x00,0x02,0x10,0x2b, +0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00,0x3c,0x03,0xb0,0x03,0x34,0x63,0x00,0x73, +0x90,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x42,0x00,0x01,0x14,0x40,0x00,0x04, +0x00,0x00,0x00,0x00,0xa3,0x80,0x81,0xf1,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x01,0xa3,0x82,0x81,0xf1,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00, +0x3c,0x02,0xb0,0x03,0x34,0x42,0x00,0xa8,0x8c,0x43,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x62,0x00,0xff,0x00,0x03,0x2e,0x02,0x00,0x02,0x39,0x80,0x2c,0xa2,0x00,0x02, +0x00,0x03,0x34,0x02,0x10,0x40,0x00,0x05,0x00,0x03,0x1a,0x02,0xa4,0x87,0x01,0xd8, +0xa0,0x85,0x01,0xd4,0xa0,0x86,0x01,0xd5,0xa0,0x83,0x01,0xd6,0x03,0xe0,0x00,0x08, +0x00,0x00,0x00,0x00,0x8c,0x82,0x00,0x04,0x3c,0x05,0xb0,0x01,0x00,0x80,0x50,0x21, +0x00,0x45,0x10,0x21,0x8c,0x43,0x00,0x04,0x24,0x02,0x00,0x05,0x00,0x03,0x1a,0x02, +0x30,0x69,0x00,0x0f,0x11,0x22,0x00,0x0b,0x24,0x02,0x00,0x07,0x11,0x22,0x00,0x09, +0x24,0x02,0x00,0x0a,0x11,0x22,0x00,0x07,0x24,0x02,0x00,0x0b,0x11,0x22,0x00,0x05, +0x24,0x02,0x00,0x01,0x93,0x83,0x81,0xf0,0x3c,0x04,0xb0,0x06,0x10,0x62,0x00,0x03, +0x34,0x84,0x80,0x18,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00,0x8c,0x82,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x02,0x17,0x02,0x14,0x40,0xff,0xfa,0x00,0x00,0x00,0x00, +0x8d,0x43,0x01,0xa8,0x27,0x82,0x89,0x58,0x00,0x03,0x18,0x80,0x00,0x6a,0x20,0x21, +0x8c,0x87,0x00,0xa8,0x00,0x62,0x18,0x21,0x8c,0x68,0x00,0x00,0x00,0xe5,0x28,0x21, +0x8c,0xa9,0x00,0x00,0x3c,0x02,0xff,0xff,0x27,0x83,0x8a,0x58,0x01,0x22,0x10,0x24, +0x00,0x48,0x10,0x25,0xac,0xa2,0x00,0x00,0x8d,0x44,0x01,0xa8,0x00,0x07,0x30,0xc2, +0x3c,0x02,0x00,0x80,0x00,0x04,0x20,0x80,0x00,0x83,0x20,0x21,0x00,0x06,0x32,0x00, +0x8c,0xa9,0x00,0x04,0x00,0xc2,0x30,0x25,0x8c,0x82,0x00,0x00,0x3c,0x03,0x80,0x00, +0x01,0x22,0x10,0x25,0x00,0x43,0x10,0x25,0xac,0xa2,0x00,0x04,0xaf,0x87,0xbc,0x10, +0x8c,0xa2,0x00,0x00,0x00,0x00,0x00,0x00,0xaf,0x82,0xbc,0x18,0x8c,0xa3,0x00,0x04, +0x3c,0x01,0xb0,0x07,0xac,0x26,0x80,0x18,0x8d,0x42,0x01,0xa8,0xaf,0x83,0xbc,0x14, +0x93,0x85,0x81,0xf0,0x24,0x44,0x00,0x01,0x28,0x83,0x00,0x00,0x24,0x42,0x00,0x40, +0x00,0x83,0x10,0x0a,0x00,0x02,0x11,0x83,0x00,0x02,0x11,0x80,0x24,0xa5,0xff,0xff, +0x00,0x82,0x20,0x23,0xad,0x44,0x01,0xa8,0xa3,0x85,0x81,0xf0,0x08,0x00,0x27,0x89, +0x00,0x00,0x00,0x00,0x3c,0x05,0xb0,0x03,0x3c,0x02,0x80,0x01,0x24,0x42,0x9f,0x04, +0x34,0xa5,0x00,0x20,0xac,0xa2,0x00,0x00,0x24,0x02,0x00,0x02,0x24,0x03,0x00,0x20, +0xac,0x82,0x00,0x64,0x3c,0x02,0x80,0x01,0xac,0x83,0x00,0x60,0x00,0x80,0x38,0x21, +0xac,0x80,0x00,0x00,0xac,0x80,0x00,0x04,0xac,0x80,0x00,0x08,0xac,0x80,0x00,0x4c, +0xac,0x80,0x00,0x50,0xac,0x80,0x00,0x54,0xac,0x80,0x00,0x0c,0xac,0x80,0x00,0x58, +0xa0,0x80,0x00,0x5c,0x24,0x83,0x00,0x68,0x24,0x42,0xa0,0x14,0x24,0x04,0x00,0x0f, +0x24,0x84,0xff,0xff,0xac,0x62,0x00,0x00,0x04,0x81,0xff,0xfd,0x24,0x63,0x00,0x04, +0x3c,0x02,0xb0,0x03,0x34,0x42,0x00,0xa8,0xac,0xe0,0x01,0xa8,0xac,0xe0,0x01,0xac, +0xac,0xe0,0x01,0xb0,0xac,0xe0,0x01,0xb4,0xa0,0xe0,0x01,0xb8,0xa0,0xe0,0x01,0xb9, +0xa0,0xe0,0x01,0xba,0xa0,0xe0,0x01,0xc0,0xa0,0xe0,0x01,0xc1,0xac,0xe0,0x01,0xc4, +0xac,0xe0,0x01,0xc8,0xac,0xe0,0x01,0xcc,0xac,0xe0,0x01,0xd0,0x8c,0x44,0x00,0x00, +0x3c,0x02,0x80,0x01,0x24,0x42,0xa0,0xfc,0x30,0x83,0x00,0xff,0x00,0x03,0x19,0x80, +0xa4,0xe3,0x01,0xd8,0xac,0xe2,0x00,0x78,0x3c,0x03,0x80,0x01,0x3c,0x02,0x80,0x01, +0x24,0x63,0xa2,0x88,0x24,0x42,0xa1,0xf4,0xac,0xe3,0x00,0x88,0xac,0xe2,0x00,0x98, +0x3c,0x03,0x80,0x01,0x3c,0x02,0x80,0x01,0x00,0x04,0x2e,0x03,0x00,0x04,0x34,0x03, +0x24,0x63,0xa3,0x30,0x00,0x04,0x22,0x03,0x24,0x42,0xa4,0x74,0xac,0xe3,0x00,0xa0, +0xac,0xe2,0x00,0xa4,0xa0,0xe5,0x01,0xd4,0xa0,0xe6,0x01,0xd5,0x03,0xe0,0x00,0x08, +0xa0,0xe4,0x01,0xd6,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x01,0x34,0x63,0x00,0x20, +0x24,0x42,0xa0,0x14,0x03,0xe0,0x00,0x08,0xac,0x62,0x00,0x00,0x3c,0x02,0xb0,0x03, +0x3c,0x03,0x80,0x01,0x34,0x42,0x00,0x20,0x24,0x63,0xa0,0x2c,0xac,0x43,0x00,0x00, +0x8c,0x82,0x00,0x10,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x11,0x00,0x80,0x28,0x21, +0x8c,0x82,0x00,0x14,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x0d,0x00,0x00,0x00,0x00, +0x8c,0x84,0x00,0x10,0x8c,0xa3,0x00,0x14,0x8c,0xa2,0x00,0x04,0x00,0x83,0x20,0x21, +0x00,0x44,0x10,0x21,0x30,0x43,0x00,0xff,0x00,0x03,0x18,0x2b,0x00,0x02,0x12,0x02, +0x00,0x43,0x10,0x21,0x00,0x02,0x12,0x00,0x30,0x42,0x3f,0xff,0xac,0xa2,0x00,0x04, +0xac,0xa0,0x00,0x00,0xac,0xa0,0x00,0x4c,0xac,0xa0,0x00,0x50,0xac,0xa0,0x00,0x54, +0x03,0xe0,0x00,0x08,0xac,0xa0,0x00,0x0c,0x3c,0x03,0xb0,0x03,0x3c,0x02,0x80,0x01, +0x34,0x63,0x00,0x20,0x24,0x42,0xa0,0xa8,0xac,0x62,0x00,0x00,0x8c,0x86,0x00,0x04, +0x3c,0x02,0xb0,0x01,0x24,0x03,0x00,0x01,0x00,0xc2,0x10,0x21,0x8c,0x45,0x00,0x00, +0xac,0x83,0x00,0x4c,0x00,0x05,0x14,0x02,0x30,0xa3,0x3f,0xff,0x30,0x42,0x00,0xff, +0xac,0x83,0x00,0x10,0xac,0x82,0x00,0x14,0x8c,0x83,0x00,0x14,0xac,0x85,0x00,0x40, +0x00,0xc3,0x30,0x21,0x03,0xe0,0x00,0x08,0xac,0x86,0x00,0x08,0x3c,0x02,0xb0,0x03, +0x3c,0x03,0x80,0x01,0x27,0xbd,0xff,0xe8,0x34,0x42,0x00,0x20,0x24,0x63,0xa0,0xfc, +0xaf,0xb0,0x00,0x10,0xaf,0xbf,0x00,0x14,0xac,0x43,0x00,0x00,0x8c,0x82,0x00,0x4c, +0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x0a,0x00,0x80,0x80,0x21,0xae,0x00,0x00,0x00, +0xae,0x00,0x00,0x4c,0xae,0x00,0x00,0x50,0xae,0x00,0x00,0x54,0xae,0x00,0x00,0x0c, +0x8f,0xbf,0x00,0x14,0x8f,0xb0,0x00,0x10,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x18, +0x0c,0x00,0x28,0x2a,0x00,0x00,0x00,0x00,0x08,0x00,0x28,0x4c,0xae,0x00,0x00,0x00, +0x3c,0x02,0xb0,0x03,0x3c,0x03,0x80,0x01,0x27,0xbd,0xff,0xe8,0x34,0x42,0x00,0x20, +0x24,0x63,0xa1,0x60,0xaf,0xb0,0x00,0x10,0xaf,0xbf,0x00,0x14,0xac,0x43,0x00,0x00, +0x8c,0x82,0x00,0x4c,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x16,0x00,0x80,0x80,0x21, +0x8e,0x03,0x00,0x08,0x3c,0x02,0xb0,0x01,0x8e,0x04,0x00,0x44,0x00,0x62,0x18,0x21, +0x90,0x65,0x00,0x00,0x24,0x02,0x00,0x01,0xae,0x02,0x00,0x50,0x30,0xa3,0x00,0xff, +0x00,0x03,0x10,0x82,0x00,0x04,0x23,0x02,0x30,0x84,0x00,0x0f,0x30,0x42,0x00,0x03, +0x00,0x03,0x19,0x02,0xae,0x04,0x00,0x34,0xae,0x02,0x00,0x2c,0xae,0x03,0x00,0x30, +0xa2,0x05,0x00,0x48,0x8f,0xbf,0x00,0x14,0x8f,0xb0,0x00,0x10,0x03,0xe0,0x00,0x08, +0x27,0xbd,0x00,0x18,0x0c,0x00,0x28,0x2a,0x00,0x00,0x00,0x00,0x08,0x00,0x28,0x64, +0x00,0x00,0x00,0x00,0x3c,0x02,0xb0,0x03,0x3c,0x03,0x80,0x01,0x27,0xbd,0xff,0xe8, +0x34,0x42,0x00,0x20,0x24,0x63,0xa1,0xf4,0xaf,0xb0,0x00,0x10,0xaf,0xbf,0x00,0x14, +0xac,0x43,0x00,0x00,0x8c,0x82,0x00,0x50,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x16, +0x00,0x80,0x80,0x21,0x92,0x03,0x00,0x44,0x8e,0x02,0x00,0x40,0x83,0x85,0x8b,0xc4, +0x92,0x04,0x00,0x41,0x30,0x63,0x00,0x01,0x00,0x02,0x16,0x02,0xae,0x04,0x00,0x14, +0x00,0x00,0x30,0x21,0xae,0x02,0x00,0x18,0x10,0xa0,0x00,0x04,0xae,0x03,0x00,0x3c, +0x10,0x60,0x00,0x03,0x24,0x02,0x00,0x01,0x24,0x06,0x00,0x01,0x24,0x02,0x00,0x01, +0xa3,0x86,0x8b,0xc4,0x8f,0xbf,0x00,0x14,0xae,0x02,0x00,0x54,0x8f,0xb0,0x00,0x10, +0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x18,0x0c,0x00,0x28,0x58,0x00,0x00,0x00,0x00, +0x08,0x00,0x28,0x89,0x00,0x00,0x00,0x00,0x3c,0x02,0xb0,0x03,0x3c,0x03,0x80,0x01, +0x27,0xbd,0xff,0xe8,0x34,0x42,0x00,0x20,0x24,0x63,0xa2,0x88,0xaf,0xb0,0x00,0x10, +0xaf,0xbf,0x00,0x14,0xac,0x43,0x00,0x00,0x8c,0x82,0x00,0x50,0x00,0x00,0x00,0x00, +0x10,0x40,0x00,0x1b,0x00,0x80,0x80,0x21,0x3c,0x02,0xb0,0x03,0x8c,0x42,0x00,0x00, +0x92,0x04,0x00,0x44,0x8e,0x03,0x00,0x40,0x83,0x86,0x8b,0xc4,0x92,0x05,0x00,0x41, +0x30,0x42,0x08,0x00,0x30,0x84,0x00,0x01,0x00,0x02,0x12,0xc2,0x00,0x03,0x1e,0x02, +0x00,0x82,0x20,0x25,0xae,0x05,0x00,0x14,0x00,0x00,0x38,0x21,0xae,0x03,0x00,0x18, +0x10,0xc0,0x00,0x04,0xae,0x04,0x00,0x3c,0x10,0x80,0x00,0x03,0x24,0x02,0x00,0x01, +0x24,0x07,0x00,0x01,0x24,0x02,0x00,0x01,0xa3,0x87,0x8b,0xc4,0x8f,0xbf,0x00,0x14, +0xae,0x02,0x00,0x54,0x8f,0xb0,0x00,0x10,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x18, +0x0c,0x00,0x28,0x58,0x00,0x00,0x00,0x00,0x08,0x00,0x28,0xae,0x00,0x00,0x00,0x00, +0x3c,0x02,0xb0,0x03,0x3c,0x03,0x80,0x01,0x27,0xbd,0xff,0xe8,0x34,0x42,0x00,0x20, +0x24,0x63,0xa3,0x30,0xaf,0xb0,0x00,0x10,0xaf,0xbf,0x00,0x14,0xac,0x43,0x00,0x00, +0x8c,0x82,0x00,0x54,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x42,0x00,0x80,0x80,0x21, +0x8e,0x04,0x00,0x04,0x8e,0x03,0x00,0x44,0x3c,0x02,0x80,0x00,0x3c,0x08,0xb0,0x01, +0x34,0x42,0x00,0x10,0x00,0x88,0x20,0x21,0x00,0x62,0x18,0x25,0xac,0x83,0x00,0x04, +0x8e,0x02,0x00,0x04,0x8e,0x03,0x01,0xac,0x27,0x89,0x89,0x58,0x00,0x48,0x10,0x21, +0x8c,0x45,0x00,0x00,0x00,0x03,0x18,0x80,0x00,0x69,0x18,0x21,0xac,0x65,0x00,0x00, +0x8e,0x02,0x00,0x04,0x8e,0x03,0x01,0xac,0x27,0x87,0x8a,0x58,0x00,0x48,0x10,0x21, +0x8c,0x45,0x00,0x04,0x00,0x03,0x18,0x80,0x00,0x67,0x18,0x21,0xac,0x65,0x00,0x00, +0x8e,0x02,0x01,0xac,0x8e,0x06,0x00,0x04,0x02,0x00,0x20,0x21,0x00,0x02,0x10,0x80, +0x00,0x47,0x38,0x21,0x94,0xe3,0x00,0x02,0x00,0x49,0x10,0x21,0x90,0x45,0x00,0x00, +0x00,0x03,0x1a,0x00,0x00,0xc8,0x30,0x21,0x00,0xa3,0x28,0x25,0x0c,0x00,0x26,0x69, +0xa4,0xc5,0x00,0x2e,0x8e,0x03,0x01,0xac,0x8e,0x07,0x00,0x04,0x3c,0x06,0xb0,0x03, +0x24,0x65,0x00,0x01,0x28,0xa4,0x00,0x00,0x24,0x62,0x00,0x40,0x00,0xa4,0x10,0x0a, +0x00,0x02,0x11,0x83,0x00,0x02,0x11,0x80,0x00,0x03,0x18,0x80,0x00,0xa2,0x28,0x23, +0x00,0x70,0x18,0x21,0xae,0x05,0x01,0xac,0xac,0x67,0x00,0xa8,0x34,0xc6,0x00,0x30, +0x8c,0xc3,0x00,0x00,0x93,0x82,0x81,0xf0,0x02,0x00,0x20,0x21,0x24,0x63,0x00,0x01, +0x24,0x42,0x00,0x01,0xac,0xc3,0x00,0x00,0xa3,0x82,0x81,0xf0,0x0c,0x00,0x28,0x0b, +0x00,0x00,0x00,0x00,0x8f,0xbf,0x00,0x14,0x8f,0xb0,0x00,0x10,0x03,0xe0,0x00,0x08, +0x27,0xbd,0x00,0x18,0x0c,0x00,0x28,0xa2,0x00,0x00,0x00,0x00,0x08,0x00,0x28,0xd8, +0x00,0x00,0x00,0x00,0x3c,0x02,0xb0,0x03,0x3c,0x03,0x80,0x01,0x27,0xbd,0xff,0xe8, +0x34,0x42,0x00,0x20,0x24,0x63,0xa4,0x74,0xaf,0xb0,0x00,0x10,0xaf,0xbf,0x00,0x14, +0xac,0x43,0x00,0x00,0x8c,0x82,0x00,0x54,0x00,0x00,0x00,0x00,0x10,0x40,0x00,0x42, +0x00,0x80,0x80,0x21,0x8e,0x04,0x00,0x04,0x8e,0x03,0x00,0x44,0x3c,0x02,0x80,0x00, +0x3c,0x08,0xb0,0x01,0x34,0x42,0x00,0x10,0x00,0x88,0x20,0x21,0x00,0x62,0x18,0x25, +0xac,0x83,0x00,0x04,0x8e,0x02,0x00,0x04,0x8e,0x03,0x01,0xac,0x27,0x89,0x89,0x58, +0x00,0x48,0x10,0x21,0x8c,0x45,0x00,0x00,0x00,0x03,0x18,0x80,0x00,0x69,0x18,0x21, +0xac,0x65,0x00,0x00,0x8e,0x02,0x00,0x04,0x8e,0x03,0x01,0xac,0x27,0x87,0x8a,0x58, +0x00,0x48,0x10,0x21,0x8c,0x45,0x00,0x04,0x00,0x03,0x18,0x80,0x00,0x67,0x18,0x21, +0xac,0x65,0x00,0x00,0x8e,0x02,0x01,0xac,0x8e,0x06,0x00,0x04,0x02,0x00,0x20,0x21, +0x00,0x02,0x10,0x80,0x00,0x47,0x38,0x21,0x94,0xe3,0x00,0x02,0x00,0x49,0x10,0x21, +0x90,0x45,0x00,0x00,0x00,0x03,0x1a,0x00,0x00,0xc8,0x30,0x21,0x00,0xa3,0x28,0x25, +0x0c,0x00,0x26,0x69,0xa4,0xc5,0x00,0x2e,0x8e,0x03,0x01,0xac,0x8e,0x07,0x00,0x04, +0x3c,0x06,0xb0,0x03,0x24,0x65,0x00,0x01,0x28,0xa4,0x00,0x00,0x24,0x62,0x00,0x40, +0x00,0xa4,0x10,0x0a,0x00,0x02,0x11,0x83,0x00,0x02,0x11,0x80,0x00,0x03,0x18,0x80, +0x00,0xa2,0x28,0x23,0x00,0x70,0x18,0x21,0xae,0x05,0x01,0xac,0xac,0x67,0x00,0xa8, +0x34,0xc6,0x00,0x30,0x8c,0xc3,0x00,0x00,0x93,0x82,0x81,0xf0,0x02,0x00,0x20,0x21, +0x24,0x63,0x00,0x01,0x24,0x42,0x00,0x01,0xac,0xc3,0x00,0x00,0xa3,0x82,0x81,0xf0, +0x0c,0x00,0x28,0x0b,0x00,0x00,0x00,0x00,0x8f,0xbf,0x00,0x14,0x8f,0xb0,0x00,0x10, +0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x18,0x0c,0x00,0x28,0xa2,0x00,0x00,0x00,0x00, +0x08,0x00,0x29,0x29,0x00,0x00,0x00,0x00,0x3c,0x02,0xb0,0x03,0x3c,0x03,0x80,0x01, +0x27,0xbd,0xff,0xd8,0x34,0x42,0x00,0x20,0x24,0x63,0xa5,0xb8,0xaf,0xb2,0x00,0x18, +0xac,0x43,0x00,0x00,0x3c,0x12,0xb0,0x03,0x3c,0x02,0x80,0x01,0xaf,0xb4,0x00,0x20, +0xaf,0xb3,0x00,0x1c,0xaf,0xb1,0x00,0x14,0xaf,0xb0,0x00,0x10,0xaf,0xbf,0x00,0x24, +0x00,0x80,0x80,0x21,0x24,0x54,0xa0,0x14,0x00,0x00,0x88,0x21,0x3c,0x13,0xb0,0x01, +0x36,0x52,0x00,0xef,0x3c,0x02,0xb0,0x09,0x34,0x42,0x00,0x06,0x90,0x43,0x00,0x00, +0x8e,0x04,0x00,0x04,0x92,0x02,0x01,0xbb,0x30,0x69,0x00,0xff,0x00,0x04,0x42,0x02, +0x10,0x40,0x00,0x1e,0x00,0x00,0x38,0x21,0x8e,0x03,0x01,0xa8,0x3c,0x06,0x28,0x38, +0x34,0xc6,0x00,0x20,0x24,0x64,0x00,0x3d,0x28,0x82,0x00,0x00,0x24,0x63,0x00,0x7c, +0x00,0x82,0x18,0x0a,0x00,0x03,0x19,0x83,0x00,0x03,0x19,0x80,0x00,0x83,0x20,0x23, +0x00,0x04,0x10,0x80,0x00,0x50,0x10,0x21,0x8c,0x45,0x00,0xa8,0xae,0x04,0x01,0xac, +0xae,0x04,0x01,0xa8,0x00,0xb3,0x18,0x21,0xae,0x05,0x00,0x04,0xac,0x66,0x00,0x00, +0x8e,0x02,0x00,0x04,0x3c,0x03,0x80,0x00,0x34,0x63,0x4e,0x00,0x00,0x53,0x10,0x21, +0xac,0x43,0x00,0x04,0xa2,0x00,0x01,0xbb,0x93,0x83,0x81,0xf7,0x00,0x00,0x00,0x00, +0x24,0x62,0x00,0x01,0xa3,0x82,0x81,0xf7,0xa2,0x43,0x00,0x00,0x01,0x28,0x10,0x23, +0x24,0x44,0x00,0x40,0x28,0x83,0x00,0x00,0x24,0x42,0x00,0x7f,0x00,0x83,0x10,0x0a, +0x00,0x02,0x11,0x83,0x00,0x02,0x11,0x80,0x24,0x84,0xff,0xff,0x10,0x44,0x00,0x6b, +0x3c,0x02,0xb0,0x01,0x8e,0x03,0x00,0x04,0x3c,0x04,0x7c,0x00,0x00,0x62,0x18,0x21, +0x8c,0x65,0x00,0x04,0x34,0x84,0x00,0xf0,0x00,0x00,0x30,0x21,0xae,0x05,0x00,0x44, +0x00,0xa4,0x20,0x24,0x8c,0x63,0x00,0x00,0x10,0x80,0x00,0x6b,0x3c,0x02,0xff,0xff, +0x3c,0x09,0xb0,0x03,0x3c,0x05,0x7c,0x00,0x35,0x29,0x00,0x99,0x3c,0x0a,0xb0,0x01, +0x24,0x08,0x00,0x40,0x34,0xa5,0x00,0xf0,0x3c,0x0b,0xff,0xff,0x3c,0x0c,0x28,0x38, +0x16,0x20,0x00,0x06,0x24,0xe7,0x00,0x01,0x93,0x82,0x81,0xf6,0x24,0x11,0x00,0x01, +0x24,0x42,0x00,0x01,0xa1,0x22,0x00,0x00,0xa3,0x82,0x81,0xf6,0x8e,0x02,0x00,0x04, +0x24,0x06,0x00,0x01,0x24,0x42,0x01,0x00,0x30,0x42,0x3f,0xff,0xae,0x02,0x00,0x04, +0x00,0x4a,0x10,0x21,0x8c,0x43,0x00,0x04,0x00,0x00,0x00,0x00,0xae,0x03,0x00,0x44, +0x00,0x65,0x20,0x24,0x8c,0x43,0x00,0x00,0x10,0xe8,0x00,0x2d,0x00,0x00,0x00,0x00, +0x14,0x80,0xff,0xeb,0x00,0x6b,0x10,0x24,0x14,0x4c,0xff,0xe9,0x24,0x02,0x00,0x01, +0x10,0xc2,0x00,0x30,0x3c,0x03,0xb0,0x09,0x8e,0x02,0x00,0x44,0x8e,0x04,0x00,0x60, +0x00,0x02,0x1e,0x42,0x00,0x02,0x12,0x02,0x30,0x42,0x00,0x0f,0x30,0x63,0x00,0x01, +0xae,0x02,0x00,0x00,0x10,0x44,0x00,0x1a,0xae,0x03,0x00,0x58,0x8e,0x02,0x00,0x64, +0x8e,0x04,0x00,0x58,0x00,0x00,0x00,0x00,0x10,0x82,0x00,0x05,0x00,0x00,0x00,0x00, +0xae,0x00,0x00,0x4c,0xae,0x00,0x00,0x50,0xae,0x00,0x00,0x54,0xae,0x00,0x00,0x0c, +0x8e,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x10,0x80,0x00,0x50,0x10,0x21, +0x8c,0x42,0x00,0x68,0x00,0x00,0x00,0x00,0x10,0x54,0x00,0x06,0x00,0x00,0x00,0x00, +0x00,0x40,0xf8,0x09,0x02,0x00,0x20,0x21,0x8e,0x04,0x00,0x58,0x8e,0x03,0x00,0x00, +0x00,0x00,0x00,0x00,0xae,0x03,0x00,0x60,0x08,0x00,0x29,0x81,0xae,0x04,0x00,0x64, +0x8e,0x02,0x00,0x64,0x00,0x00,0x00,0x00,0x14,0x62,0xff,0xe5,0x00,0x00,0x00,0x00, +0x7a,0x02,0x0d,0x7c,0x8f,0xbf,0x00,0x24,0x8f,0xb4,0x00,0x20,0x7b,0xb2,0x00,0xfc, +0x7b,0xb0,0x00,0xbc,0x00,0x43,0x10,0x26,0x00,0x02,0x10,0x2b,0x03,0xe0,0x00,0x08, +0x27,0xbd,0x00,0x28,0x8e,0x04,0x00,0x04,0x34,0x63,0x00,0x06,0x90,0x62,0x00,0x00, +0x00,0x04,0x42,0x02,0x00,0x48,0x10,0x23,0x24,0x44,0x00,0x40,0x28,0x83,0x00,0x00, +0x24,0x42,0x00,0x7f,0x00,0x83,0x10,0x0a,0x00,0x02,0x11,0x83,0x00,0x02,0x11,0x80, +0x00,0x82,0x20,0x23,0x14,0x86,0xff,0xc4,0x00,0x00,0x00,0x00,0x8e,0x03,0x00,0x00, +0x00,0x00,0x00,0x00,0x2c,0x62,0x00,0x03,0x14,0x40,0x00,0x05,0x24,0x02,0x00,0x0d, +0x10,0x62,0x00,0x03,0x24,0x02,0x00,0x01,0x08,0x00,0x2a,0x04,0xa2,0x02,0x00,0x5c, +0x08,0x00,0x2a,0x04,0xa2,0x00,0x00,0x5c,0x00,0x62,0x10,0x24,0x3c,0x03,0x28,0x38, +0x14,0x43,0xff,0x93,0x24,0x02,0x00,0x01,0x08,0x00,0x29,0xdc,0x00,0x00,0x00,0x00, +0x3c,0x02,0xb0,0x01,0x00,0xa2,0x40,0x21,0x00,0xa0,0x48,0x21,0x8d,0x05,0x00,0x00, +0x24,0x02,0xc0,0x00,0x00,0x09,0x38,0xc2,0x00,0xa2,0x28,0x24,0x24,0xc2,0xff,0xff, +0x00,0x07,0x3a,0x00,0x3c,0x0a,0xb0,0x06,0x3c,0x03,0x00,0x80,0x00,0xa6,0x28,0x25, +0x2c,0x42,0x1f,0xff,0x00,0xe3,0x38,0x25,0x35,0x4a,0x80,0x18,0x10,0x40,0x00,0x0e, +0xad,0x05,0x00,0x00,0xaf,0x89,0xbc,0x10,0x8d,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0xaf,0x82,0xbc,0x18,0x8d,0x03,0x00,0x04,0xad,0x47,0x00,0x00,0xaf,0x83,0xbc,0x14, +0xac,0x80,0x01,0xd0,0xac,0x80,0x01,0xc4,0xa0,0x80,0x01,0xc0,0xa0,0x80,0x01,0xc1, +0xac,0x80,0x01,0xc8,0xac,0x80,0x01,0xcc,0x03,0xe0,0x00,0x08,0x00,0x00,0x00,0x00, +0x27,0xbd,0xff,0xe8,0xaf,0xbf,0x00,0x10,0x8c,0x83,0x01,0xc4,0x00,0x80,0x38,0x21, +0x90,0x84,0x01,0xc0,0x00,0x03,0x18,0x80,0x00,0x67,0x18,0x21,0x8c,0x65,0x00,0xa8, +0x3c,0x02,0xb0,0x01,0x24,0x03,0x00,0x01,0x00,0xa2,0x10,0x21,0x8c,0x42,0x00,0x00, +0x10,0x83,0x00,0x18,0x00,0x02,0x14,0x02,0x8c,0xe9,0x01,0xcc,0x8c,0xea,0x01,0xc8, +0x30,0x46,0x00,0xff,0x01,0x2a,0x18,0x21,0x30,0x64,0x00,0xff,0x00,0x03,0x1a,0x02, +0x24,0x62,0x00,0x01,0x14,0x80,0x00,0x02,0x30,0x48,0x00,0xff,0x30,0x68,0x00,0xff, +0x90,0xe2,0x01,0xc1,0x00,0x00,0x00,0x00,0x00,0x48,0x10,0x23,0x00,0x02,0x12,0x00, +0x00,0x49,0x10,0x21,0x00,0x4a,0x10,0x21,0x00,0x46,0x30,0x23,0x0c,0x00,0x2a,0x2c, +0x00,0xe0,0x20,0x21,0x8f,0xbf,0x00,0x10,0x00,0x00,0x00,0x00,0x03,0xe0,0x00,0x08, +0x27,0xbd,0x00,0x18,0x8c,0xe6,0x01,0xc8,0x08,0x00,0x2a,0x6b,0x00,0x00,0x00,0x00, +0x27,0xbd,0xff,0xe8,0xaf,0xbf,0x00,0x14,0xaf,0xb0,0x00,0x10,0x8c,0x82,0x01,0xc4, +0x90,0x87,0x01,0xc1,0x00,0x80,0x80,0x21,0x00,0x02,0x10,0x80,0x00,0x44,0x10,0x21, +0x8c,0x48,0x00,0xa8,0x3c,0x02,0xb0,0x01,0x00,0x07,0x3a,0x00,0x01,0x02,0x10,0x21, +0x8c,0x43,0x00,0x00,0x00,0xe5,0x38,0x21,0x00,0xe6,0x38,0x21,0x00,0x03,0x1c,0x02, +0x30,0x63,0x00,0xff,0x00,0xe3,0x38,0x23,0x01,0x00,0x28,0x21,0x0c,0x00,0x2a,0x2c, +0x00,0xe0,0x30,0x21,0x8e,0x02,0x01,0xa8,0x8f,0xbf,0x00,0x14,0x24,0x44,0x00,0x01, +0x28,0x83,0x00,0x00,0x24,0x42,0x00,0x40,0x00,0x83,0x10,0x0a,0x00,0x02,0x11,0x83, +0x00,0x02,0x11,0x80,0x00,0x82,0x20,0x23,0xae,0x04,0x01,0xa8,0x8f,0xb0,0x00,0x10, +0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x18,0x3c,0x02,0xb0,0x03,0x3c,0x03,0x80,0x01, +0x27,0xbd,0xff,0xe8,0x34,0x42,0x00,0x20,0x24,0x63,0xaa,0x58,0xaf,0xb0,0x00,0x10, +0xaf,0xbf,0x00,0x14,0xac,0x43,0x00,0x00,0x90,0x82,0x01,0xd4,0x00,0x00,0x00,0x00, +0x14,0x40,0x00,0x6a,0x00,0x80,0x80,0x21,0x90,0x82,0x01,0xc0,0x00,0x00,0x00,0x00, +0x14,0x40,0x00,0x61,0x00,0x00,0x00,0x00,0x8c,0x83,0x01,0xa8,0x8c,0x82,0x01,0xac, +0x00,0x00,0x00,0x00,0x10,0x62,0x00,0x22,0x00,0x00,0x28,0x21,0x93,0x82,0x81,0xf1, +0x00,0x03,0x30,0x80,0x00,0xc4,0x18,0x21,0x24,0x04,0x00,0x01,0x8c,0x67,0x00,0xa8, +0x10,0x44,0x00,0x20,0x3c,0x04,0xb0,0x01,0xaf,0x87,0xbc,0x10,0x00,0xe4,0x20,0x21, +0x8c,0x86,0x00,0x00,0x00,0x07,0x18,0xc2,0x3c,0x02,0x00,0x80,0xaf,0x86,0xbc,0x18, +0x8c,0x86,0x00,0x04,0x00,0x03,0x1a,0x00,0x3c,0x05,0xb0,0x06,0x00,0x62,0x18,0x25, +0x34,0xa5,0x80,0x18,0xac,0xa3,0x00,0x00,0x8e,0x02,0x01,0xa8,0x8e,0x09,0x01,0xac, +0xaf,0x86,0xbc,0x14,0x24,0x44,0x00,0x01,0x28,0x83,0x00,0x00,0x24,0x42,0x00,0x40, +0x00,0x83,0x10,0x0a,0x00,0x02,0x11,0x83,0x00,0x02,0x11,0x80,0x00,0x82,0x20,0x23, +0x00,0x80,0x30,0x21,0xae,0x04,0x01,0xa8,0x00,0xc9,0x10,0x26,0x00,0x02,0x28,0x2b, +0x8f,0xbf,0x00,0x14,0x8f,0xb0,0x00,0x10,0x00,0xa0,0x10,0x21,0x03,0xe0,0x00,0x08, +0x27,0xbd,0x00,0x18,0x93,0x82,0x81,0xf0,0x00,0x00,0x00,0x00,0x2c,0x42,0x00,0x02, +0x14,0x40,0xff,0xf7,0x00,0x00,0x28,0x21,0x3c,0x05,0xb0,0x01,0x00,0xe5,0x28,0x21, +0x27,0x83,0x89,0x58,0x00,0xc3,0x18,0x21,0x8c,0xa6,0x00,0x00,0x8c,0x64,0x00,0x00, +0x24,0x02,0xc0,0x00,0x00,0xc2,0x10,0x24,0x00,0x44,0x10,0x25,0xac,0xa2,0x00,0x00, +0x8e,0x03,0x01,0xa8,0x27,0x84,0x8a,0x58,0x8c,0xa6,0x00,0x04,0x00,0x03,0x18,0x80, +0x00,0x64,0x18,0x21,0x8c,0x62,0x00,0x00,0x3c,0x03,0x80,0x00,0x00,0x07,0x20,0xc2, +0x00,0xc2,0x10,0x25,0x00,0x43,0x10,0x25,0xac,0xa2,0x00,0x04,0xaf,0x87,0xbc,0x10, +0x8c,0xa6,0x00,0x00,0x3c,0x02,0x00,0x80,0x00,0x04,0x22,0x00,0x3c,0x03,0xb0,0x06, +0xaf,0x86,0xbc,0x18,0x00,0x82,0x20,0x25,0x34,0x63,0x80,0x18,0x8c,0xa6,0x00,0x04, +0xac,0x64,0x00,0x00,0x8e,0x02,0x01,0xa8,0xaf,0x86,0xbc,0x14,0x24,0x44,0x00,0x01, +0x28,0x83,0x00,0x00,0x24,0x42,0x00,0x40,0x00,0x83,0x10,0x0a,0x93,0x83,0x81,0xf0, +0x00,0x02,0x11,0x83,0x00,0x02,0x11,0x80,0x00,0x82,0x20,0x23,0x24,0x63,0xff,0xff, +0xae,0x04,0x01,0xa8,0xa3,0x83,0x81,0xf0,0x8e,0x04,0x01,0xac,0x8e,0x02,0x01,0xa8, +0x08,0x00,0x2a,0xcb,0x00,0x44,0x10,0x26,0x0c,0x00,0x2a,0x4c,0x00,0x00,0x00,0x00, +0x7a,0x02,0x0d,0x7c,0x08,0x00,0x2a,0xcb,0x00,0x43,0x10,0x26,0x8c,0x86,0x01,0xa8, +0x8c,0x89,0x01,0xac,0x00,0x00,0x00,0x00,0x10,0xc9,0x00,0xb4,0x00,0xc0,0x68,0x21, +0x00,0x06,0x10,0x80,0x27,0x83,0x89,0x58,0x00,0x43,0x18,0x21,0x00,0x44,0x10,0x21, +0x8c,0x47,0x00,0xa8,0x94,0x65,0x00,0x02,0x3c,0x02,0xb0,0x01,0x00,0xe2,0x10,0x21, +0x30,0xa5,0x3f,0xff,0xa4,0x45,0x00,0x2c,0x90,0x8a,0x01,0xc0,0x00,0x00,0x00,0x00, +0x11,0x40,0x00,0x0c,0x00,0x07,0x32,0x02,0x8c,0x83,0x01,0xc4,0x90,0x85,0x01,0xc1, +0x00,0x03,0x18,0x80,0x00,0x64,0x18,0x21,0x8c,0x62,0x00,0xa8,0x00,0x00,0x00,0x00, +0x00,0x02,0x12,0x02,0x00,0x45,0x10,0x21,0x30,0x42,0x00,0x3f,0x14,0xc2,0xff,0xde, +0x00,0x00,0x00,0x00,0x3c,0x04,0xb0,0x01,0x00,0xe4,0x40,0x21,0x8d,0x06,0x00,0x00, +0x00,0x0d,0x28,0x80,0x00,0x06,0x14,0x02,0x30,0x4b,0x00,0xff,0x00,0xeb,0x70,0x21, +0x01,0xc4,0x20,0x21,0x90,0x83,0x00,0x00,0x27,0x82,0x89,0x58,0x00,0xa2,0x28,0x21, +0x8c,0xa4,0x00,0x00,0x00,0x03,0x18,0x82,0x30,0x63,0x00,0x03,0x2c,0x62,0x00,0x02, +0x14,0x40,0x00,0x66,0x30,0x8c,0x3f,0xff,0x24,0x02,0x00,0x02,0x10,0x62,0x00,0x61, +0x2d,0x82,0x08,0x00,0x15,0x40,0x00,0x36,0x01,0x6c,0x10,0x21,0x01,0x6c,0x18,0x21, +0x30,0x62,0x00,0xff,0x00,0x02,0x10,0x2b,0x00,0x03,0x1a,0x02,0x3c,0x04,0xb0,0x01, +0x00,0x62,0x18,0x21,0x00,0xe4,0x20,0x21,0x24,0x02,0x00,0x01,0xa2,0x03,0x01,0xc1, +0xa0,0x82,0x00,0x08,0x8e,0x06,0x01,0xa8,0x3c,0x03,0xb0,0x00,0x34,0x63,0xff,0xf4, +0x24,0xc5,0x00,0x01,0x28,0xa4,0x00,0x00,0x24,0xc2,0x00,0x40,0x00,0xa4,0x10,0x0a, +0x01,0xc3,0x18,0x21,0xa4,0x6c,0x00,0x00,0x00,0x02,0x11,0x83,0x00,0x02,0x11,0x80, +0x92,0x04,0x01,0xc0,0x00,0xa2,0x38,0x23,0x3c,0x03,0xb0,0x03,0xae,0x0b,0x01,0xcc, +0xae,0x0c,0x01,0xc8,0xae,0x06,0x01,0xc4,0xae,0x07,0x01,0xa8,0x34,0x63,0x01,0x08, +0x92,0x05,0x01,0xd6,0x8c,0x66,0x00,0x00,0x24,0x84,0x00,0x01,0x30,0x82,0x00,0xff, +0x00,0x45,0x10,0x2b,0xae,0x06,0x01,0xd0,0x10,0x40,0x00,0x07,0xa2,0x04,0x01,0xc0, +0x92,0x02,0x01,0xd5,0x92,0x03,0x01,0xc1,0x24,0x42,0xff,0xfc,0x00,0x62,0x18,0x2a, +0x14,0x60,0x00,0x08,0x00,0x00,0x00,0x00,0x02,0x00,0x20,0x21,0x0c,0x00,0x2a,0x4c, +0x00,0x00,0x00,0x00,0x8e,0x09,0x01,0xac,0x8e,0x06,0x01,0xa8,0x08,0x00,0x2a,0xcb, +0x00,0xc9,0x10,0x26,0x8e,0x09,0x01,0xac,0x08,0x00,0x2a,0xca,0x00,0xe0,0x30,0x21, +0x30,0x43,0x00,0xff,0x92,0x07,0x01,0xc1,0x00,0x02,0x12,0x02,0x30,0x44,0x00,0xff, +0x38,0x63,0x00,0x00,0x24,0x46,0x00,0x01,0x92,0x05,0x01,0xd5,0x00,0x83,0x30,0x0a, +0x00,0xc7,0x18,0x21,0x00,0xa3,0x10,0x2a,0x14,0x40,0xff,0xeb,0x00,0x00,0x00,0x00, +0x24,0xa2,0xff,0xfc,0x00,0x62,0x10,0x2a,0x10,0x40,0x00,0x07,0x01,0x80,0x28,0x21, +0x92,0x03,0x01,0xd6,0x25,0x42,0x00,0x01,0x00,0x43,0x10,0x2a,0x14,0x40,0x00,0x07, +0x25,0xa4,0x00,0x01,0x01,0x80,0x28,0x21,0x01,0x60,0x30,0x21,0x0c,0x00,0x2a,0x74, +0x02,0x00,0x20,0x21,0x08,0x00,0x2b,0x6d,0x00,0x00,0x00,0x00,0x28,0x83,0x00,0x00, +0x25,0xa2,0x00,0x40,0x00,0x83,0x10,0x0a,0x00,0x02,0x11,0x83,0x00,0x02,0x11,0x80, +0x00,0x82,0x20,0x23,0x00,0xc7,0x18,0x21,0x25,0x42,0x00,0x01,0x00,0x80,0x30,0x21, +0xa2,0x03,0x01,0xc1,0xae,0x0b,0x01,0xcc,0xae,0x0c,0x01,0xc8,0x08,0x00,0x2a,0xc9, +0xa2,0x02,0x01,0xc0,0x14,0x40,0xff,0x9f,0x00,0x00,0x00,0x00,0x15,0x40,0x00,0x14, +0x24,0x02,0xc0,0x00,0x00,0xc2,0x10,0x24,0x00,0x4c,0x10,0x25,0xad,0x02,0x00,0x00, +0xaf,0x87,0xbc,0x10,0x8d,0x05,0x00,0x00,0x00,0x07,0x18,0xc2,0x3c,0x02,0x00,0x80, +0x00,0x03,0x1a,0x00,0x3c,0x04,0xb0,0x06,0xaf,0x85,0xbc,0x18,0x00,0x62,0x18,0x25, +0x34,0x84,0x80,0x18,0x8d,0x05,0x00,0x04,0xac,0x83,0x00,0x00,0x8e,0x02,0x01,0xa8, +0x8e,0x09,0x01,0xac,0xaf,0x85,0xbc,0x14,0x08,0x00,0x2a,0xc2,0x24,0x44,0x00,0x01, +0x01,0x6c,0x10,0x21,0x30,0x45,0x00,0xff,0x92,0x04,0x01,0xc1,0x00,0x02,0x12,0x02, +0x30,0x46,0x00,0xff,0x38,0xa5,0x00,0x00,0x24,0x42,0x00,0x01,0x92,0x03,0x01,0xd5, +0x00,0xc5,0x10,0x0a,0x00,0x82,0x20,0x21,0x00,0x64,0x18,0x2a,0x10,0x60,0xff,0xca, +0x01,0x80,0x28,0x21,0x08,0x00,0x2b,0x6b,0x02,0x00,0x20,0x21,0x90,0x87,0x01,0xc0, +0x00,0x00,0x00,0x00,0x10,0xe0,0xff,0x06,0x00,0x00,0x28,0x21,0x3c,0x02,0xb0,0x03, +0x34,0x42,0x01,0x08,0x94,0x83,0x01,0xd8,0x8c,0x88,0x01,0xd0,0x8c,0x45,0x00,0x00, +0x01,0x03,0x18,0x21,0x00,0xa3,0x10,0x2b,0x10,0x40,0x00,0x0b,0x2c,0xe2,0x00,0x02, +0x00,0xa8,0x10,0x2b,0x10,0x40,0xfe,0xf9,0x00,0xc9,0x10,0x26,0x3c,0x02,0x80,0x00, +0x00,0x62,0x18,0x21,0x00,0xa2,0x10,0x21,0x00,0x43,0x10,0x2b,0x14,0x40,0xfe,0xf3, +0x00,0xc9,0x10,0x26,0x2c,0xe2,0x00,0x02,0x10,0x40,0xff,0x90,0x00,0x00,0x00,0x00, +0x24,0x02,0x00,0x01,0x14,0xe2,0xfe,0xed,0x00,0xc9,0x10,0x26,0x3c,0x03,0xb0,0x06, +0x34,0x63,0x80,0x18,0x8c,0x62,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x17,0x02, +0x14,0x40,0xfe,0xe5,0x00,0x00,0x00,0x00,0x08,0x00,0x2b,0x6b,0x00,0x00,0x00,0x00, +0x3c,0x04,0xb0,0x03,0x3c,0x06,0xb0,0x07,0x3c,0x02,0x80,0x01,0x34,0xc6,0x00,0x18, +0x34,0x84,0x00,0x20,0x24,0x42,0xaf,0xa0,0x24,0x03,0xff,0x83,0xac,0x82,0x00,0x00, +0xa0,0xc3,0x00,0x00,0x90,0xc4,0x00,0x00,0x27,0xbd,0xff,0xf8,0x3c,0x03,0xb0,0x07, +0x24,0x02,0xff,0x82,0xa3,0xa4,0x00,0x00,0xa0,0x62,0x00,0x00,0x90,0x64,0x00,0x00, +0x3c,0x02,0xb0,0x07,0x34,0x42,0x00,0x08,0xa3,0xa4,0x00,0x01,0xa0,0x40,0x00,0x00, +0x90,0x43,0x00,0x00,0x24,0x02,0x00,0x03,0x3c,0x05,0xb0,0x07,0xa3,0xa3,0x00,0x00, +0xa0,0xc2,0x00,0x00,0x90,0xc4,0x00,0x00,0x34,0xa5,0x00,0x10,0x24,0x02,0x00,0x06, +0x3c,0x03,0xb0,0x07,0xa3,0xa4,0x00,0x00,0x34,0x63,0x00,0x38,0xa0,0xa2,0x00,0x00, +0x90,0x64,0x00,0x00,0x3c,0x02,0xb0,0x07,0x34,0x42,0x00,0x20,0xa3,0xa4,0x00,0x00, +0xa0,0xa0,0x00,0x00,0x90,0xa3,0x00,0x00,0xaf,0x82,0xbf,0x20,0xa3,0xa3,0x00,0x00, +0xa0,0x40,0x00,0x00,0x90,0x43,0x00,0x00,0x03,0xe0,0x00,0x08,0x27,0xbd,0x00,0x08, +}; + +u8 rtl8190_fwdata_array[] ={ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00, +0x02,0xe9,0x01,0x74,0x02,0xab,0x01,0xc7,0x01,0x55,0x00,0xe4,0x00,0xab,0x00,0x72, +0x00,0x55,0x00,0x4c,0x00,0x4c,0x00,0x4c,0x00,0x4c,0x00,0x4c,0x02,0x76,0x01,0x3b, +0x00,0xd2,0x00,0x9e,0x00,0x69,0x00,0x4f,0x00,0x46,0x00,0x3f,0x01,0x3b,0x00,0x9e, +0x00,0x69,0x00,0x4f,0x00,0x35,0x00,0x27,0x00,0x23,0x00,0x20,0x01,0x2f,0x00,0x98, +0x00,0x65,0x00,0x4c,0x00,0x33,0x00,0x26,0x00,0x22,0x00,0x1e,0x00,0x98,0x00,0x4c, +0x00,0x33,0x00,0x26,0x00,0x19,0x00,0x13,0x00,0x11,0x00,0x0f,0x02,0x39,0x01,0x1c, +0x00,0xbd,0x00,0x8e,0x00,0x5f,0x00,0x47,0x00,0x3f,0x00,0x39,0x01,0x1c,0x00,0x8e, +0x00,0x5f,0x00,0x47,0x00,0x2f,0x00,0x23,0x00,0x20,0x00,0x1c,0x01,0x11,0x00,0x89, +0x00,0x5b,0x00,0x44,0x00,0x2e,0x00,0x22,0x00,0x1e,0x00,0x1b,0x00,0x89,0x00,0x44, +0x00,0x2e,0x00,0x22,0x00,0x17,0x00,0x11,0x00,0x0f,0x00,0x0e,0x02,0xab,0x02,0xab, +0x02,0x66,0x02,0x66,0x07,0x06,0x06,0x06,0x05,0x06,0x07,0x08,0x04,0x06,0x07,0x08, +0x09,0x0a,0x0b,0x0b,0x49,0x6e,0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x54,0x4c, +0x42,0x4d,0x4f,0x44,0x00,0x00,0x00,0x00,0x54,0x4c,0x42,0x4c,0x5f,0x64,0x61,0x74, +0x61,0x00,0x54,0x4c,0x42,0x53,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x64,0x45,0x4c, +0x5f,0x64,0x61,0x74,0x61,0x00,0x41,0x64,0x45,0x53,0x00,0x00,0x00,0x00,0x00,0x00, +0x45,0x78,0x63,0x43,0x6f,0x64,0x65,0x36,0x00,0x00,0x45,0x78,0x63,0x43,0x6f,0x64, +0x65,0x37,0x00,0x00,0x53,0x79,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x42,0x70, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x52,0x49,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x43,0x70,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4f,0x76,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x0b,0x53, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x2c, +0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0x60, +0x00,0x00,0x00,0x90,0x00,0x00,0x00,0xc0,0x00,0x00,0x01,0x20,0x00,0x00,0x01,0x80, +0x00,0x00,0x01,0xb0,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x68,0x00,0x00,0x00,0x9c, +0x00,0x00,0x00,0xd0,0x00,0x00,0x01,0x38,0x00,0x00,0x01,0xa0,0x00,0x00,0x01,0xd4, +0x00,0x00,0x02,0x08,0x00,0x00,0x00,0x68,0x00,0x00,0x00,0xd0,0x00,0x00,0x01,0x38, +0x00,0x00,0x01,0xa0,0x00,0x00,0x02,0x6f,0x00,0x00,0x03,0x40,0x00,0x00,0x03,0xa8, +0x00,0x00,0x04,0x10,0x01,0x01,0x01,0x02,0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04, +0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x02,0x03,0x03,0x04,0x05,0x06,0x07,0x08, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x07,0x74,0x80,0x00,0x07,0x88, +0x80,0x00,0x07,0x88,0x80,0x00,0x07,0x78,0x80,0x00,0x07,0x78,0x80,0x00,0x07,0x9c, +0x80,0x00,0x53,0xc4,0x80,0x00,0x54,0x24,0x80,0x00,0x54,0x38,0x80,0x00,0x54,0x5c, +0x80,0x00,0x54,0x68,0x80,0x00,0x54,0xa8,0x80,0x00,0x56,0xa8,0x80,0x00,0x57,0xec, +0x80,0x00,0x58,0x14,0x80,0x00,0x59,0x0c,0x80,0x00,0x59,0xc4,0x80,0x00,0x5a,0x6c, +0x80,0x00,0x5a,0xe0,0x80,0x00,0x5b,0xec,0x80,0x00,0x5c,0x24,0x80,0x00,0x5c,0x38, +0x80,0x00,0x5c,0x4c,0x80,0x00,0x5d,0x40,0x80,0x00,0x5d,0x80,0x80,0x00,0x5e,0x34, +0x80,0x00,0x5e,0x5c,0x80,0x00,0x56,0x68,0x80,0x00,0x5e,0x78,0x80,0x00,0x88,0xf8, +0x80,0x00,0x88,0xf8,0x80,0x00,0x88,0xf8,0x80,0x00,0x89,0x2c,0x80,0x00,0x89,0x6c, +0x80,0x00,0x89,0xa4,0x80,0x00,0x89,0xd4,0x80,0x00,0x8a,0x10,0x80,0x00,0x8a,0x50, +0x80,0x00,0x8a,0xb8,0x80,0x00,0x8a,0xcc,0x80,0x00,0x8b,0x08,0x80,0x00,0x8b,0x10, +0x80,0x00,0x8b,0x4c,0x80,0x00,0x8b,0x60,0x80,0x00,0x8b,0x68,0x80,0x00,0x8b,0x70, +0x80,0x00,0x8b,0x70,0x80,0x00,0x8b,0x70,0x80,0x00,0x8b,0x70,0x80,0x00,0x8a,0x90, +0x80,0x00,0x8b,0xa0,0x80,0x00,0x8b,0xb4,0x80,0x00,0x88,0x54,0x80,0x00,0x8e,0xc8, +0x80,0x00,0x8e,0xc8,0x80,0x00,0x8e,0xc8,0x80,0x00,0x8e,0xfc,0x80,0x00,0x8f,0x3c, +0x80,0x00,0x8f,0x74,0x80,0x00,0x8f,0xa4,0x80,0x00,0x8f,0xe0,0x80,0x00,0x90,0x20, +0x80,0x00,0x90,0x88,0x80,0x00,0x90,0x9c,0x80,0x00,0x90,0xd8,0x80,0x00,0x90,0xe0, +0x80,0x00,0x91,0x1c,0x80,0x00,0x91,0x30,0x80,0x00,0x91,0x38,0x80,0x00,0x91,0x40, +0x80,0x00,0x91,0x40,0x80,0x00,0x91,0x40,0x80,0x00,0x91,0x40,0x80,0x00,0x90,0x60, +0x80,0x00,0x91,0x70,0x80,0x00,0x91,0x84,0x80,0x00,0x8d,0x00,}; + +u32 Rtl8192UsbPHY_REGArray[] = { +0x0, }; + +u32 Rtl8192UsbPHY_REG_1T2RArray[] = { +0x800,0x00000000, +0x804,0x00000001, +0x808,0x0000fc00, +0x80c,0x0000001c, +0x810,0x801010aa, +0x814,0x008514d0, +0x818,0x00000040, +0x81c,0x00000000, +0x820,0x00000004, +0x824,0x00690000, +0x828,0x00000004, +0x82c,0x00e90000, +0x830,0x00000004, +0x834,0x00690000, +0x838,0x00000004, +0x83c,0x00e90000, +0x840,0x00000000, +0x844,0x00000000, +0x848,0x00000000, +0x84c,0x00000000, +0x850,0x00000000, +0x854,0x00000000, +0x858,0x65a965a9, +0x85c,0x65a965a9, +0x860,0x001f0010, +0x864,0x007f0010, +0x868,0x001f0010, +0x86c,0x007f0010, +0x870,0x0f100f70, +0x874,0x0f100f70, +0x878,0x00000000, +0x87c,0x00000000, +0x880,0x6870e36c, +0x884,0xe3573600, +0x888,0x4260c340, +0x88c,0x0000ff00, +0x890,0x00000000, +0x894,0xfffffffe, +0x898,0x4c42382f, +0x89c,0x00656056, +0x8b0,0x00000000, +0x8e0,0x00000000, +0x8e4,0x00000000, +0x900,0x00000000, +0x904,0x00000023, +0x908,0x00000000, +0x90c,0x31121311, +0xa00,0x00d0c7d8, +0xa04,0x811f0008, +0xa08,0x80cd8300, +0xa0c,0x2e62740f, +0xa10,0x95009b78, +0xa14,0x11145008, +0xa18,0x00881117, +0xa1c,0x89140fa0, +0xa20,0x1a1b0000, +0xa24,0x090e1317, +0xa28,0x00000204, +0xa2c,0x00000000, +0xc00,0x00000040, +0xc04,0x00005433, +0xc08,0x000000e4, +0xc0c,0x6c6c6c6c, +0xc10,0x08800000, +0xc14,0x40000100, +0xc18,0x08000000, +0xc1c,0x40000100, +0xc20,0x08000000, +0xc24,0x40000100, +0xc28,0x08000000, +0xc2c,0x40000100, +0xc30,0x6de9ac44, +0xc34,0x465c52cd, +0xc38,0x497f5994, +0xc3c,0x0a969764, +0xc40,0x1f7c403f, +0xc44,0x000100b7, +0xc48,0xec020000, +0xc4c,0x00000300, +0xc50,0x69543420, +0xc54,0x433c0094, +0xc58,0x69543420, +0xc5c,0x433c0094, +0xc60,0x69543420, +0xc64,0x433c0094, +0xc68,0x69543420, +0xc6c,0x433c0094, +0xc70,0x2c7f000d, +0xc74,0x0186175b, +0xc78,0x0000001f, +0xc7c,0x00b91612, +0xc80,0x40000100, +0xc84,0x20000000, +0xc88,0x40000100, +0xc8c,0x20200000, +0xc90,0x40000100, +0xc94,0x00000000, +0xc98,0x40000100, +0xc9c,0x00000000, +0xca0,0x00492492, +0xca4,0x00000000, +0xca8,0x00000000, +0xcac,0x00000000, +0xcb0,0x00000000, +0xcb4,0x00000000, +0xcb8,0x00000000, +0xcbc,0x00492492, +0xcc0,0x00000000, +0xcc4,0x00000000, +0xcc8,0x00000000, +0xccc,0x00000000, +0xcd0,0x00000000, +0xcd4,0x00000000, +0xcd8,0x64b22427, +0xcdc,0x00766932, +0xce0,0x00222222, +0xd00,0x00000750, +0xd04,0x00000403, +0xd08,0x0000907f, +0xd0c,0x00000001, +0xd10,0xa0633333, +0xd14,0x33333c63, +0xd18,0x6a8f5b6b, +0xd1c,0x00000000, +0xd20,0x00000000, +0xd24,0x00000000, +0xd28,0x00000000, +0xd2c,0xcc979975, +0xd30,0x00000000, +0xd34,0x00000000, +0xd38,0x00000000, +0xd3c,0x00027293, +0xd40,0x00000000, +0xd44,0x00000000, +0xd48,0x00000000, +0xd4c,0x00000000, +0xd50,0x6437140a, +0xd54,0x024dbd02, +0xd58,0x00000000, +0xd5c,0x04032064, +0xe00,0x161a1a1a, +0xe04,0x12121416, +0xe08,0x00001800, +0xe0c,0x00000000, +0xe10,0x161a1a1a, +0xe14,0x12121416, +0xe18,0x161a1a1a, +0xe1c,0x12121416, +}; + +u32 Rtl8192UsbRadioA_Array[] = { +0x019,0x00000003, +0x000,0x000000bf, +0x001,0x00000ee0, +0x002,0x0000004c, +0x003,0x000007f1, +0x004,0x00000975, +0x005,0x00000c58, +0x006,0x00000ae6, +0x007,0x000000ca, +0x008,0x00000e1c, +0x009,0x000007f0, +0x00a,0x000009d0, +0x00b,0x000001ba, +0x00c,0x00000240, +0x00e,0x00000020, +0x00f,0x00000990, +0x012,0x00000806, +0x014,0x000005ab, +0x015,0x00000f80, +0x016,0x00000020, +0x017,0x00000597, +0x018,0x0000050a, +0x01a,0x00000f80, +0x01b,0x00000f5e, +0x01c,0x00000008, +0x01d,0x00000607, +0x01e,0x000006cc, +0x01f,0x00000000, +0x020,0x000001a5, +0x01f,0x00000001, +0x020,0x00000165, +0x01f,0x00000002, +0x020,0x000000c6, +0x01f,0x00000003, +0x020,0x00000086, +0x01f,0x00000004, +0x020,0x00000046, +0x01f,0x00000005, +0x020,0x000001e6, +0x01f,0x00000006, +0x020,0x000001a6, +0x01f,0x00000007, +0x020,0x00000166, +0x01f,0x00000008, +0x020,0x000000c7, +0x01f,0x00000009, +0x020,0x00000087, +0x01f,0x0000000a, +0x020,0x000000f7, +0x01f,0x0000000b, +0x020,0x000000d7, +0x01f,0x0000000c, +0x020,0x000000b7, +0x01f,0x0000000d, +0x020,0x00000097, +0x01f,0x0000000e, +0x020,0x00000077, +0x01f,0x0000000f, +0x020,0x00000057, +0x01f,0x00000010, +0x020,0x00000037, +0x01f,0x00000011, +0x020,0x000000fb, +0x01f,0x00000012, +0x020,0x000000db, +0x01f,0x00000013, +0x020,0x000000bb, +0x01f,0x00000014, +0x020,0x000000ff, +0x01f,0x00000015, +0x020,0x000000e3, +0x01f,0x00000016, +0x020,0x000000c3, +0x01f,0x00000017, +0x020,0x000000a3, +0x01f,0x00000018, +0x020,0x00000083, +0x01f,0x00000019, +0x020,0x00000063, +0x01f,0x0000001a, +0x020,0x00000043, +0x01f,0x0000001b, +0x020,0x00000023, +0x01f,0x0000001c, +0x020,0x00000003, +0x01f,0x0000001d, +0x020,0x000001e3, +0x01f,0x0000001e, +0x020,0x000001c3, +0x01f,0x0000001f, +0x020,0x000001a3, +0x01f,0x00000020, +0x020,0x00000183, +0x01f,0x00000021, +0x020,0x00000163, +0x01f,0x00000022, +0x020,0x00000143, +0x01f,0x00000023, +0x020,0x00000123, +0x01f,0x00000024, +0x020,0x00000103, +0x023,0x00000203, +0x024,0x00000200, +0x00b,0x000001ba, +0x02c,0x000003d7, +0x02d,0x00000ff0, +0x000,0x00000037, +0x004,0x00000160, +0x007,0x00000080, +0x002,0x0000088d, +0x0fe,0x00000000, +0x0fe,0x00000000, +0x016,0x00000200, +0x016,0x00000380, +0x016,0x00000020, +0x016,0x000001a0, +0x000,0x000000bf, +0x00d,0x0000001f, +0x00d,0x00000c9f, +0x002,0x0000004d, +0x000,0x00000cbf, +0x004,0x00000975, +0x007,0x00000700, +}; + +u32 Rtl8192UsbRadioB_Array[] = { +0x019,0x00000003, +0x000,0x000000bf, +0x001,0x000006e0, +0x002,0x0000004c, +0x003,0x000007f1, +0x004,0x00000975, +0x005,0x00000c58, +0x006,0x00000ae6, +0x007,0x000000ca, +0x008,0x00000e1c, +0x000,0x000000b7, +0x00a,0x00000850, +0x000,0x000000bf, +0x00b,0x000001ba, +0x00c,0x00000240, +0x00e,0x00000020, +0x015,0x00000f80, +0x016,0x00000020, +0x017,0x00000597, +0x018,0x0000050a, +0x01a,0x00000e00, +0x01b,0x00000f5e, +0x01d,0x00000607, +0x01e,0x000006cc, +0x00b,0x000001ba, +0x023,0x00000203, +0x024,0x00000200, +0x000,0x00000037, +0x004,0x00000160, +0x016,0x00000200, +0x016,0x00000380, +0x016,0x00000020, +0x016,0x000001a0, +0x00d,0x00000ccc, +0x000,0x000000bf, +0x002,0x0000004d, +0x000,0x00000cbf, +0x004,0x00000975, +0x007,0x00000700, +}; + +u32 Rtl8192UsbRadioC_Array[] = { +0x0, }; + +u32 Rtl8192UsbRadioD_Array[] = { +0x0, }; + +u32 Rtl8192UsbMACPHY_Array[] = { +0x03c,0xffff0000,0x00000f0f, +0x340,0xffffffff,0x161a1a1a, +0x344,0xffffffff,0x12121416, +0x348,0x0000ffff,0x00001818, +0x12c,0xffffffff,0x04000802, +0x318,0x00000fff,0x00000100, +}; + +u32 Rtl8192UsbMACPHY_Array_PG[] = { +0x03c,0xffff0000,0x00000f0f, +0xe00,0xffffffff,0x06090909, +0xe04,0xffffffff,0x00030306, +0xe08,0x0000ff00,0x00000000, +0xe10,0xffffffff,0x0a0c0d0f, +0xe14,0xffffffff,0x06070809, +0xe18,0xffffffff,0x0a0c0d0f, +0xe1c,0xffffffff,0x06070809, +0x12c,0xffffffff,0x04000802, +0x318,0x00000fff,0x00000800, +}; + +u32 Rtl8192UsbAGCTAB_Array[] = { +0xc78,0x7d000001, +0xc78,0x7d010001, +0xc78,0x7d020001, +0xc78,0x7d030001, +0xc78,0x7d040001, +0xc78,0x7d050001, +0xc78,0x7c060001, +0xc78,0x7b070001, +0xc78,0x7a080001, +0xc78,0x79090001, +0xc78,0x780a0001, +0xc78,0x770b0001, +0xc78,0x760c0001, +0xc78,0x750d0001, +0xc78,0x740e0001, +0xc78,0x730f0001, +0xc78,0x72100001, +0xc78,0x71110001, +0xc78,0x70120001, +0xc78,0x6f130001, +0xc78,0x6e140001, +0xc78,0x6d150001, +0xc78,0x6c160001, +0xc78,0x6b170001, +0xc78,0x6a180001, +0xc78,0x69190001, +0xc78,0x681a0001, +0xc78,0x671b0001, +0xc78,0x661c0001, +0xc78,0x651d0001, +0xc78,0x641e0001, +0xc78,0x491f0001, +0xc78,0x48200001, +0xc78,0x47210001, +0xc78,0x46220001, +0xc78,0x45230001, +0xc78,0x44240001, +0xc78,0x43250001, +0xc78,0x28260001, +0xc78,0x27270001, +0xc78,0x26280001, +0xc78,0x25290001, +0xc78,0x242a0001, +0xc78,0x232b0001, +0xc78,0x222c0001, +0xc78,0x212d0001, +0xc78,0x202e0001, +0xc78,0x0a2f0001, +0xc78,0x08300001, +0xc78,0x06310001, +0xc78,0x05320001, +0xc78,0x04330001, +0xc78,0x03340001, +0xc78,0x02350001, +0xc78,0x01360001, +0xc78,0x00370001, +0xc78,0x00380001, +0xc78,0x00390001, +0xc78,0x003a0001, +0xc78,0x003b0001, +0xc78,0x003c0001, +0xc78,0x003d0001, +0xc78,0x003e0001, +0xc78,0x003f0001, +0xc78,0x7d400001, +0xc78,0x7d410001, +0xc78,0x7d420001, +0xc78,0x7d430001, +0xc78,0x7d440001, +0xc78,0x7d450001, +0xc78,0x7c460001, +0xc78,0x7b470001, +0xc78,0x7a480001, +0xc78,0x79490001, +0xc78,0x784a0001, +0xc78,0x774b0001, +0xc78,0x764c0001, +0xc78,0x754d0001, +0xc78,0x744e0001, +0xc78,0x734f0001, +0xc78,0x72500001, +0xc78,0x71510001, +0xc78,0x70520001, +0xc78,0x6f530001, +0xc78,0x6e540001, +0xc78,0x6d550001, +0xc78,0x6c560001, +0xc78,0x6b570001, +0xc78,0x6a580001, +0xc78,0x69590001, +0xc78,0x685a0001, +0xc78,0x675b0001, +0xc78,0x665c0001, +0xc78,0x655d0001, +0xc78,0x645e0001, +0xc78,0x495f0001, +0xc78,0x48600001, +0xc78,0x47610001, +0xc78,0x46620001, +0xc78,0x45630001, +0xc78,0x44640001, +0xc78,0x43650001, +0xc78,0x28660001, +0xc78,0x27670001, +0xc78,0x26680001, +0xc78,0x25690001, +0xc78,0x246a0001, +0xc78,0x236b0001, +0xc78,0x226c0001, +0xc78,0x216d0001, +0xc78,0x206e0001, +0xc78,0x0a6f0001, +0xc78,0x08700001, +0xc78,0x06710001, +0xc78,0x05720001, +0xc78,0x04730001, +0xc78,0x03740001, +0xc78,0x02750001, +0xc78,0x01760001, +0xc78,0x00770001, +0xc78,0x00780001, +0xc78,0x00790001, +0xc78,0x007a0001, +0xc78,0x007b0001, +0xc78,0x007c0001, +0xc78,0x007d0001, +0xc78,0x007e0001, +0xc78,0x007f0001, +0xc78,0x2e00001e, +0xc78,0x2e01001e, +0xc78,0x2e02001e, +0xc78,0x2e03001e, +0xc78,0x2e04001e, +0xc78,0x2e05001e, +0xc78,0x3006001e, +0xc78,0x3407001e, +0xc78,0x3908001e, +0xc78,0x3c09001e, +0xc78,0x3f0a001e, +0xc78,0x420b001e, +0xc78,0x440c001e, +0xc78,0x450d001e, +0xc78,0x460e001e, +0xc78,0x460f001e, +0xc78,0x4710001e, +0xc78,0x4811001e, +0xc78,0x4912001e, +0xc78,0x4a13001e, +0xc78,0x4b14001e, +0xc78,0x4b15001e, +0xc78,0x4c16001e, +0xc78,0x4d17001e, +0xc78,0x4e18001e, +0xc78,0x4f19001e, +0xc78,0x4f1a001e, +0xc78,0x501b001e, +0xc78,0x511c001e, +0xc78,0x521d001e, +0xc78,0x521e001e, +0xc78,0x531f001e, +0xc78,0x5320001e, +0xc78,0x5421001e, +0xc78,0x5522001e, +0xc78,0x5523001e, +0xc78,0x5624001e, +0xc78,0x5725001e, +0xc78,0x5726001e, +0xc78,0x5827001e, +0xc78,0x5828001e, +0xc78,0x5929001e, +0xc78,0x592a001e, +0xc78,0x5a2b001e, +0xc78,0x5b2c001e, +0xc78,0x5c2d001e, +0xc78,0x5c2e001e, +0xc78,0x5d2f001e, +0xc78,0x5e30001e, +0xc78,0x5f31001e, +0xc78,0x6032001e, +0xc78,0x6033001e, +0xc78,0x6134001e, +0xc78,0x6235001e, +0xc78,0x6336001e, +0xc78,0x6437001e, +0xc78,0x6438001e, +0xc78,0x6539001e, +0xc78,0x663a001e, +0xc78,0x673b001e, +0xc78,0x673c001e, +0xc78,0x683d001e, +0xc78,0x693e001e, +0xc78,0x6a3f001e, +}; diff --git a/drivers/staging/rtl8192u/r819xU_firmware_img.h b/drivers/staging/rtl8192u/r819xU_firmware_img.h new file mode 100644 index 000000000000..d9d9515a1e61 --- /dev/null +++ b/drivers/staging/rtl8192u/r819xU_firmware_img.h @@ -0,0 +1,35 @@ +#ifndef IMG_H +#define IMG_H + +#define BOOT_ARR_LEN 344 +#define MAIN_ARR_LEN 45136 +#define DATA_ARR_LEN 796 +#define MACPHY_Array_PGLength 30 +#define PHY_REG_1T2RArrayLength 296 +#define AGCTAB_ArrayLength 384 +#define MACPHY_ArrayLength 18 + +#define RadioA_ArrayLength 246 +#define RadioB_ArrayLength 78 +#define RadioC_ArrayLength 1 +#define RadioD_ArrayLength 1 +#define PHY_REGArrayLength 1 + + +extern u8 rtl8190_fwboot_array[BOOT_ARR_LEN]; +extern u8 rtl8190_fwmain_array[MAIN_ARR_LEN]; +extern u8 rtl8190_fwdata_array[DATA_ARR_LEN]; + +extern u32 Rtl8192UsbPHY_REGArray[]; +extern u32 Rtl8192UsbPHY_REG_1T2RArray[]; +extern u32 Rtl8192UsbRadioA_Array[]; +extern u32 Rtl8192UsbRadioB_Array[]; +extern u32 Rtl8192UsbRadioC_Array[]; +extern u32 Rtl8192UsbRadioD_Array[]; +extern u32 Rtl8192UsbMACPHY_Array[]; +extern u32 Rtl8192UsbMACPHY_Array_PG[]; +extern u32 Rtl8192UsbAGCTAB_Array[]; + + + +#endif diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c new file mode 100644 index 000000000000..00497d313f9b --- /dev/null +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -0,0 +1,1826 @@ +#include "r8192U.h" +#include "r8192U_hw.h" +#include "r819xU_phy.h" +#include "r819xU_phyreg.h" +#include "r8190_rtl8256.h" +#include "r8192U_dm.h" +#include "r819xU_firmware_img.h" + +#ifdef ENABLE_DOT11D +#include "dot11d.h" +#endif +static u32 RF_CHANNEL_TABLE_ZEBRA[] = { + 0, + 0x085c, //2412 1 + 0x08dc, //2417 2 + 0x095c, //2422 3 + 0x09dc, //2427 4 + 0x0a5c, //2432 5 + 0x0adc, //2437 6 + 0x0b5c, //2442 7 + 0x0bdc, //2447 8 + 0x0c5c, //2452 9 + 0x0cdc, //2457 10 + 0x0d5c, //2462 11 + 0x0ddc, //2467 12 + 0x0e5c, //2472 13 + 0x0f72, //2484 +}; + + +#define rtl819XPHY_REG_1T2RArray Rtl8192UsbPHY_REG_1T2RArray +#define rtl819XMACPHY_Array_PG Rtl8192UsbMACPHY_Array_PG +#define rtl819XMACPHY_Array Rtl8192UsbMACPHY_Array +#define rtl819XRadioA_Array Rtl8192UsbRadioA_Array +#define rtl819XRadioB_Array Rtl8192UsbRadioB_Array +#define rtl819XRadioC_Array Rtl8192UsbRadioC_Array +#define rtl819XRadioD_Array Rtl8192UsbRadioD_Array +#define rtl819XAGCTAB_Array Rtl8192UsbAGCTAB_Array + +/****************************************************************************** + *function: This function read BB parameters from Header file we gen, + * and do register read/write + * input: u32 dwBitMask //taget bit pos in the addr to be modified + * output: none + * return: u32 return the shift bit bit position of the mask + * ****************************************************************************/ +u32 rtl8192_CalculateBitShift(u32 dwBitMask) +{ + u32 i; + for (i=0; i<=31; i++) + { + if (((dwBitMask>>i)&0x1) == 1) + break; + } + return i; +} +/****************************************************************************** + *function: This function check different RF type to execute legal judgement. If RF Path is illegal, we will return false. + * input: none + * output: none + * return: 0(illegal, false), 1(legal,true) + * ***************************************************************************/ +u8 rtl8192_phy_CheckIsLegalRFPath(struct net_device* dev, u32 eRFPath) +{ + u8 ret = 1; + struct r8192_priv *priv = ieee80211_priv(dev); + if (priv->rf_type == RF_2T4R) + ret = 0; + else if (priv->rf_type == RF_1T2R) + { + if (eRFPath == RF90_PATH_A || eRFPath == RF90_PATH_B) + ret = 1; + else if (eRFPath == RF90_PATH_C || eRFPath == RF90_PATH_D) + ret = 0; + } + return ret; +} +/****************************************************************************** + *function: This function set specific bits to BB register + * input: net_device dev + * u32 dwRegAddr //target addr to be modified + * u32 dwBitMask //taget bit pos in the addr to be modified + * u32 dwData //value to be write + * output: none + * return: none + * notice: + * ****************************************************************************/ +void rtl8192_setBBreg(struct net_device* dev, u32 dwRegAddr, u32 dwBitMask, u32 dwData) +{ + + u32 OriginalValue, BitShift, NewValue; + + if(dwBitMask!= bMaskDWord) + {//if not "double word" write + OriginalValue = read_nic_dword(dev, dwRegAddr); + BitShift = rtl8192_CalculateBitShift(dwBitMask); + NewValue = (((OriginalValue) & (~dwBitMask)) | (dwData << BitShift)); + write_nic_dword(dev, dwRegAddr, NewValue); + }else + write_nic_dword(dev, dwRegAddr, dwData); + return; +} +/****************************************************************************** + *function: This function reads specific bits from BB register + * input: net_device dev + * u32 dwRegAddr //target addr to be readback + * u32 dwBitMask //taget bit pos in the addr to be readback + * output: none + * return: u32 Data //the readback register value + * notice: + * ****************************************************************************/ +u32 rtl8192_QueryBBReg(struct net_device* dev, u32 dwRegAddr, u32 dwBitMask) +{ + u32 Ret = 0, OriginalValue, BitShift; + + OriginalValue = read_nic_dword(dev, dwRegAddr); + BitShift = rtl8192_CalculateBitShift(dwBitMask); + Ret =(OriginalValue & dwBitMask) >> BitShift; + + return (Ret); +} +static u32 phy_FwRFSerialRead( struct net_device* dev, RF90_RADIO_PATH_E eRFPath, u32 Offset ); + +static void phy_FwRFSerialWrite( struct net_device* dev, RF90_RADIO_PATH_E eRFPath, u32 Offset, u32 Data); + +/****************************************************************************** + *function: This function read register from RF chip + * input: net_device dev + * RF90_RADIO_PATH_E eRFPath //radio path of A/B/C/D + * u32 Offset //target address to be read + * output: none + * return: u32 readback value + * notice: There are three types of serial operations:(1) Software serial write.(2)Hardware LSSI-Low Speed Serial Interface.(3)Hardware HSSI-High speed serial write. Driver here need to implement (1) and (2)---need more spec for this information. + * ****************************************************************************/ +u32 rtl8192_phy_RFSerialRead(struct net_device* dev, RF90_RADIO_PATH_E eRFPath, u32 Offset) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u32 ret = 0; + u32 NewOffset = 0; + BB_REGISTER_DEFINITION_T* pPhyReg = &priv->PHYRegDef[eRFPath]; + rtl8192_setBBreg(dev, pPhyReg->rfLSSIReadBack, bLSSIReadBackData, 0); + //make sure RF register offset is correct + Offset &= 0x3f; + + //switch page for 8256 RF IC + if (priv->rf_chip == RF_8256) + { + if (Offset >= 31) + { + priv->RfReg0Value[eRFPath] |= 0x140; + //Switch to Reg_Mode2 for Reg 31-45 + rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, bMaskDWord, (priv->RfReg0Value[eRFPath]<<16) ); + //modify offset + NewOffset = Offset -30; + } + else if (Offset >= 16) + { + priv->RfReg0Value[eRFPath] |= 0x100; + priv->RfReg0Value[eRFPath] &= (~0x40); + //Switch to Reg_Mode 1 for Reg16-30 + rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, bMaskDWord, (priv->RfReg0Value[eRFPath]<<16) ); + + NewOffset = Offset - 15; + } + else + NewOffset = Offset; + } + else + { + RT_TRACE((COMP_PHY|COMP_ERR), "check RF type here, need to be 8256\n"); + NewOffset = Offset; + } + //put desired read addr to LSSI control Register + rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, bLSSIReadAddress, NewOffset); + //Issue a posedge trigger + // + rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, bLSSIReadEdge, 0x0); + rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, bLSSIReadEdge, 0x1); + + + // TODO: we should not delay such a long time. Ask help from SD3 + msleep(1); + + ret = rtl8192_QueryBBReg(dev, pPhyReg->rfLSSIReadBack, bLSSIReadBackData); + + + // Switch back to Reg_Mode0; + if(priv->rf_chip == RF_8256) + { + priv->RfReg0Value[eRFPath] &= 0xebf; + + rtl8192_setBBreg( + dev, + pPhyReg->rf3wireOffset, + bMaskDWord, + (priv->RfReg0Value[eRFPath] << 16)); + } + + return ret; + +} + +/****************************************************************************** + *function: This function write data to RF register + * input: net_device dev + * RF90_RADIO_PATH_E eRFPath //radio path of A/B/C/D + * u32 Offset //target address to be written + * u32 Data //The new register data to be written + * output: none + * return: none + * notice: For RF8256 only. + =========================================================== + *Reg Mode RegCTL[1] RegCTL[0] Note + * (Reg00[12]) (Reg00[10]) + *=========================================================== + *Reg_Mode0 0 x Reg 0 ~15(0x0 ~ 0xf) + *------------------------------------------------------------------ + *Reg_Mode1 1 0 Reg 16 ~30(0x1 ~ 0xf) + *------------------------------------------------------------------ + * Reg_Mode2 1 1 Reg 31 ~ 45(0x1 ~ 0xf) + *------------------------------------------------------------------ + * ****************************************************************************/ +void rtl8192_phy_RFSerialWrite(struct net_device* dev, RF90_RADIO_PATH_E eRFPath, u32 Offset, u32 Data) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u32 DataAndAddr = 0, NewOffset = 0; + BB_REGISTER_DEFINITION_T *pPhyReg = &priv->PHYRegDef[eRFPath]; + + Offset &= 0x3f; + //spin_lock_irqsave(&priv->rf_lock, flags); +// down(&priv->rf_sem); + if (priv->rf_chip == RF_8256) + { + + if (Offset >= 31) + { + priv->RfReg0Value[eRFPath] |= 0x140; + rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, bMaskDWord, (priv->RfReg0Value[eRFPath] << 16)); + NewOffset = Offset - 30; + } + else if (Offset >= 16) + { + priv->RfReg0Value[eRFPath] |= 0x100; + priv->RfReg0Value[eRFPath] &= (~0x40); + rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, bMaskDWord, (priv->RfReg0Value[eRFPath]<<16)); + NewOffset = Offset - 15; + } + else + NewOffset = Offset; + } + else + { + RT_TRACE((COMP_PHY|COMP_ERR), "check RF type here, need to be 8256\n"); + NewOffset = Offset; + } + + // Put write addr in [5:0] and write data in [31:16] + DataAndAddr = (Data<<16) | (NewOffset&0x3f); + + // Write Operation + rtl8192_setBBreg(dev, pPhyReg->rf3wireOffset, bMaskDWord, DataAndAddr); + + + if(Offset==0x0) + priv->RfReg0Value[eRFPath] = Data; + + // Switch back to Reg_Mode0; + if(priv->rf_chip == RF_8256) + { + if(Offset != 0) + { + priv->RfReg0Value[eRFPath] &= 0xebf; + rtl8192_setBBreg( + dev, + pPhyReg->rf3wireOffset, + bMaskDWord, + (priv->RfReg0Value[eRFPath] << 16)); + } + } + //spin_unlock_irqrestore(&priv->rf_lock, flags); +// up(&priv->rf_sem); + return; +} + +/****************************************************************************** + *function: This function set specific bits to RF register + * input: net_device dev + * RF90_RADIO_PATH_E eRFPath //radio path of A/B/C/D + * u32 RegAddr //target addr to be modified + * u32 BitMask //taget bit pos in the addr to be modified + * u32 Data //value to be write + * output: none + * return: none + * notice: + * ****************************************************************************/ +void rtl8192_phy_SetRFReg(struct net_device* dev, RF90_RADIO_PATH_E eRFPath, u32 RegAddr, u32 BitMask, u32 Data) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u32 Original_Value, BitShift, New_Value; +// u8 time = 0; + + if (!rtl8192_phy_CheckIsLegalRFPath(dev, eRFPath)) + return; + + if (priv->Rf_Mode == RF_OP_By_FW) + { + if (BitMask != bMask12Bits) // RF data is 12 bits only + { + Original_Value = phy_FwRFSerialRead(dev, eRFPath, RegAddr); + BitShift = rtl8192_CalculateBitShift(BitMask); + New_Value = ((Original_Value) & (~BitMask)) | (Data<< BitShift); + + phy_FwRFSerialWrite(dev, eRFPath, RegAddr, New_Value); + }else + phy_FwRFSerialWrite(dev, eRFPath, RegAddr, Data); + + udelay(200); + + } + else + { + if (BitMask != bMask12Bits) // RF data is 12 bits only + { + Original_Value = rtl8192_phy_RFSerialRead(dev, eRFPath, RegAddr); + BitShift = rtl8192_CalculateBitShift(BitMask); + New_Value = (((Original_Value) & (~BitMask)) | (Data<< BitShift)); + + rtl8192_phy_RFSerialWrite(dev, eRFPath, RegAddr, New_Value); + }else + rtl8192_phy_RFSerialWrite(dev, eRFPath, RegAddr, Data); + } + return; +} + +/****************************************************************************** + *function: This function reads specific bits from RF register + * input: net_device dev + * u32 RegAddr //target addr to be readback + * u32 BitMask //taget bit pos in the addr to be readback + * output: none + * return: u32 Data //the readback register value + * notice: + * ****************************************************************************/ +u32 rtl8192_phy_QueryRFReg(struct net_device* dev, RF90_RADIO_PATH_E eRFPath, u32 RegAddr, u32 BitMask) +{ + u32 Original_Value, Readback_Value, BitShift; + struct r8192_priv *priv = ieee80211_priv(dev); + + + if (!rtl8192_phy_CheckIsLegalRFPath(dev, eRFPath)) + return 0; + if (priv->Rf_Mode == RF_OP_By_FW) + { + Original_Value = phy_FwRFSerialRead(dev, eRFPath, RegAddr); + BitShift = rtl8192_CalculateBitShift(BitMask); + Readback_Value = (Original_Value & BitMask) >> BitShift; + udelay(200); + return (Readback_Value); + } + else + { + Original_Value = rtl8192_phy_RFSerialRead(dev, eRFPath, RegAddr); + BitShift = rtl8192_CalculateBitShift(BitMask); + Readback_Value = (Original_Value & BitMask) >> BitShift; + return (Readback_Value); + } +} +/****************************************************************************** + *function: We support firmware to execute RF-R/W. + * input: dev + * output: none + * return: none + * notice: + * ***************************************************************************/ +static u32 +phy_FwRFSerialRead( + struct net_device* dev, + RF90_RADIO_PATH_E eRFPath, + u32 Offset ) +{ + u32 retValue = 0; + u32 Data = 0; + u8 time = 0; + //DbgPrint("FW RF CTRL\n\r"); + /* 2007/11/02 MH Firmware RF Write control. By Francis' suggestion, we can + not execute the scheme in the initial step. Otherwise, RF-R/W will waste + much time. This is only for site survey. */ + // 1. Read operation need not insert data. bit 0-11 + //Data &= bMask12Bits; + // 2. Write RF register address. Bit 12-19 + Data |= ((Offset&0xFF)<<12); + // 3. Write RF path. bit 20-21 + Data |= ((eRFPath&0x3)<<20); + // 4. Set RF read indicator. bit 22=0 + //Data |= 0x00000; + // 5. Trigger Fw to operate the command. bit 31 + Data |= 0x80000000; + // 6. We can not execute read operation if bit 31 is 1. + while (read_nic_dword(dev, QPNR)&0x80000000) + { + // If FW can not finish RF-R/W for more than ?? times. We must reset FW. + if (time++ < 100) + { + //DbgPrint("FW not finish RF-R Time=%d\n\r", time); + udelay(10); + } + else + break; + } + // 7. Execute read operation. + write_nic_dword(dev, QPNR, Data); + // 8. Check if firmawre send back RF content. + while (read_nic_dword(dev, QPNR)&0x80000000) + { + // If FW can not finish RF-R/W for more than ?? times. We must reset FW. + if (time++ < 100) + { + //DbgPrint("FW not finish RF-W Time=%d\n\r", time); + udelay(10); + } + else + return (0); + } + retValue = read_nic_dword(dev, RF_DATA); + + return (retValue); + +} /* phy_FwRFSerialRead */ + +/****************************************************************************** + *function: We support firmware to execute RF-R/W. + * input: dev + * output: none + * return: none + * notice: + * ***************************************************************************/ +static void +phy_FwRFSerialWrite( + struct net_device* dev, + RF90_RADIO_PATH_E eRFPath, + u32 Offset, + u32 Data ) +{ + u8 time = 0; + + //DbgPrint("N FW RF CTRL RF-%d OF%02x DATA=%03x\n\r", eRFPath, Offset, Data); + /* 2007/11/02 MH Firmware RF Write control. By Francis' suggestion, we can + not execute the scheme in the initial step. Otherwise, RF-R/W will waste + much time. This is only for site survey. */ + + // 1. Set driver write bit and 12 bit data. bit 0-11 + //Data &= bMask12Bits; // Done by uper layer. + // 2. Write RF register address. bit 12-19 + Data |= ((Offset&0xFF)<<12); + // 3. Write RF path. bit 20-21 + Data |= ((eRFPath&0x3)<<20); + // 4. Set RF write indicator. bit 22=1 + Data |= 0x400000; + // 5. Trigger Fw to operate the command. bit 31=1 + Data |= 0x80000000; + + // 6. Write operation. We can not write if bit 31 is 1. + while (read_nic_dword(dev, QPNR)&0x80000000) + { + // If FW can not finish RF-R/W for more than ?? times. We must reset FW. + if (time++ < 100) + { + //DbgPrint("FW not finish RF-W Time=%d\n\r", time); + udelay(10); + } + else + break; + } + // 7. No matter check bit. We always force the write. Because FW will + // not accept the command. + write_nic_dword(dev, QPNR, Data); + /* 2007/11/02 MH Acoording to test, we must delay 20us to wait firmware + to finish RF write operation. */ + /* 2008/01/17 MH We support delay in firmware side now. */ + //delay_us(20); + +} /* phy_FwRFSerialWrite */ + + +/****************************************************************************** + *function: This function read BB parameters from Header file we gen, + * and do register read/write + * input: dev + * output: none + * return: none + * notice: BB parameters may change all the time, so please make + * sure it has been synced with the newest. + * ***************************************************************************/ +void rtl8192_phy_configmac(struct net_device* dev) +{ + u32 dwArrayLen = 0, i; + u32* pdwArray = NULL; + struct r8192_priv *priv = ieee80211_priv(dev); + + if(priv->btxpowerdata_readfromEEPORM) + { + RT_TRACE(COMP_PHY, "Rtl819XMACPHY_Array_PG\n"); + dwArrayLen = MACPHY_Array_PGLength; + pdwArray = rtl819XMACPHY_Array_PG; + + } + else + { + RT_TRACE(COMP_PHY, "Rtl819XMACPHY_Array\n"); + dwArrayLen = MACPHY_ArrayLength; + pdwArray = rtl819XMACPHY_Array; + } + for(i = 0; ibInHctTest) + { + PHY_REGArrayLen = PHY_REGArrayLengthDTM; + AGCTAB_ArrayLen = AGCTAB_ArrayLengthDTM; + Rtl8190PHY_REGArray_Table = Rtl819XPHY_REGArrayDTM; + Rtl8190AGCTAB_Array_Table = Rtl819XAGCTAB_ArrayDTM; + } +#endif + if (ConfigType == BaseBand_Config_PHY_REG) + { + for (i=0; iPHYRegDef[RF90_PATH_A].rfintfs = rFPGA0_XAB_RFInterfaceSW; // 16 LSBs if read 32-bit from 0x870 + priv->PHYRegDef[RF90_PATH_B].rfintfs = rFPGA0_XAB_RFInterfaceSW; // 16 MSBs if read 32-bit from 0x870 (16-bit for 0x872) + priv->PHYRegDef[RF90_PATH_C].rfintfs = rFPGA0_XCD_RFInterfaceSW;// 16 LSBs if read 32-bit from 0x874 + priv->PHYRegDef[RF90_PATH_D].rfintfs = rFPGA0_XCD_RFInterfaceSW;// 16 MSBs if read 32-bit from 0x874 (16-bit for 0x876) + + // RF Interface Readback Value + priv->PHYRegDef[RF90_PATH_A].rfintfi = rFPGA0_XAB_RFInterfaceRB; // 16 LSBs if read 32-bit from 0x8E0 + priv->PHYRegDef[RF90_PATH_B].rfintfi = rFPGA0_XAB_RFInterfaceRB;// 16 MSBs if read 32-bit from 0x8E0 (16-bit for 0x8E2) + priv->PHYRegDef[RF90_PATH_C].rfintfi = rFPGA0_XCD_RFInterfaceRB;// 16 LSBs if read 32-bit from 0x8E4 + priv->PHYRegDef[RF90_PATH_D].rfintfi = rFPGA0_XCD_RFInterfaceRB;// 16 MSBs if read 32-bit from 0x8E4 (16-bit for 0x8E6) + + // RF Interface Output (and Enable) + priv->PHYRegDef[RF90_PATH_A].rfintfo = rFPGA0_XA_RFInterfaceOE; // 16 LSBs if read 32-bit from 0x860 + priv->PHYRegDef[RF90_PATH_B].rfintfo = rFPGA0_XB_RFInterfaceOE; // 16 LSBs if read 32-bit from 0x864 + priv->PHYRegDef[RF90_PATH_C].rfintfo = rFPGA0_XC_RFInterfaceOE;// 16 LSBs if read 32-bit from 0x868 + priv->PHYRegDef[RF90_PATH_D].rfintfo = rFPGA0_XD_RFInterfaceOE;// 16 LSBs if read 32-bit from 0x86C + + // RF Interface (Output and) Enable + priv->PHYRegDef[RF90_PATH_A].rfintfe = rFPGA0_XA_RFInterfaceOE; // 16 MSBs if read 32-bit from 0x860 (16-bit for 0x862) + priv->PHYRegDef[RF90_PATH_B].rfintfe = rFPGA0_XB_RFInterfaceOE; // 16 MSBs if read 32-bit from 0x864 (16-bit for 0x866) + priv->PHYRegDef[RF90_PATH_C].rfintfe = rFPGA0_XC_RFInterfaceOE;// 16 MSBs if read 32-bit from 0x86A (16-bit for 0x86A) + priv->PHYRegDef[RF90_PATH_D].rfintfe = rFPGA0_XD_RFInterfaceOE;// 16 MSBs if read 32-bit from 0x86C (16-bit for 0x86E) + + //Addr of LSSI. Wirte RF register by driver + priv->PHYRegDef[RF90_PATH_A].rf3wireOffset = rFPGA0_XA_LSSIParameter; //LSSI Parameter + priv->PHYRegDef[RF90_PATH_B].rf3wireOffset = rFPGA0_XB_LSSIParameter; + priv->PHYRegDef[RF90_PATH_C].rf3wireOffset = rFPGA0_XC_LSSIParameter; + priv->PHYRegDef[RF90_PATH_D].rf3wireOffset = rFPGA0_XD_LSSIParameter; + + // RF parameter + priv->PHYRegDef[RF90_PATH_A].rfLSSI_Select = rFPGA0_XAB_RFParameter; //BB Band Select + priv->PHYRegDef[RF90_PATH_B].rfLSSI_Select = rFPGA0_XAB_RFParameter; + priv->PHYRegDef[RF90_PATH_C].rfLSSI_Select = rFPGA0_XCD_RFParameter; + priv->PHYRegDef[RF90_PATH_D].rfLSSI_Select = rFPGA0_XCD_RFParameter; + + // Tx AGC Gain Stage (same for all path. Should we remove this?) + priv->PHYRegDef[RF90_PATH_A].rfTxGainStage = rFPGA0_TxGainStage; //Tx gain stage + priv->PHYRegDef[RF90_PATH_B].rfTxGainStage = rFPGA0_TxGainStage; //Tx gain stage + priv->PHYRegDef[RF90_PATH_C].rfTxGainStage = rFPGA0_TxGainStage; //Tx gain stage + priv->PHYRegDef[RF90_PATH_D].rfTxGainStage = rFPGA0_TxGainStage; //Tx gain stage + + // Tranceiver A~D HSSI Parameter-1 + priv->PHYRegDef[RF90_PATH_A].rfHSSIPara1 = rFPGA0_XA_HSSIParameter1; //wire control parameter1 + priv->PHYRegDef[RF90_PATH_B].rfHSSIPara1 = rFPGA0_XB_HSSIParameter1; //wire control parameter1 + priv->PHYRegDef[RF90_PATH_C].rfHSSIPara1 = rFPGA0_XC_HSSIParameter1; //wire control parameter1 + priv->PHYRegDef[RF90_PATH_D].rfHSSIPara1 = rFPGA0_XD_HSSIParameter1; //wire control parameter1 + + // Tranceiver A~D HSSI Parameter-2 + priv->PHYRegDef[RF90_PATH_A].rfHSSIPara2 = rFPGA0_XA_HSSIParameter2; //wire control parameter2 + priv->PHYRegDef[RF90_PATH_B].rfHSSIPara2 = rFPGA0_XB_HSSIParameter2; //wire control parameter2 + priv->PHYRegDef[RF90_PATH_C].rfHSSIPara2 = rFPGA0_XC_HSSIParameter2; //wire control parameter2 + priv->PHYRegDef[RF90_PATH_D].rfHSSIPara2 = rFPGA0_XD_HSSIParameter2; //wire control parameter1 + + // RF switch Control + priv->PHYRegDef[RF90_PATH_A].rfSwitchControl = rFPGA0_XAB_SwitchControl; //TR/Ant switch control + priv->PHYRegDef[RF90_PATH_B].rfSwitchControl = rFPGA0_XAB_SwitchControl; + priv->PHYRegDef[RF90_PATH_C].rfSwitchControl = rFPGA0_XCD_SwitchControl; + priv->PHYRegDef[RF90_PATH_D].rfSwitchControl = rFPGA0_XCD_SwitchControl; + + // AGC control 1 + priv->PHYRegDef[RF90_PATH_A].rfAGCControl1 = rOFDM0_XAAGCCore1; + priv->PHYRegDef[RF90_PATH_B].rfAGCControl1 = rOFDM0_XBAGCCore1; + priv->PHYRegDef[RF90_PATH_C].rfAGCControl1 = rOFDM0_XCAGCCore1; + priv->PHYRegDef[RF90_PATH_D].rfAGCControl1 = rOFDM0_XDAGCCore1; + + // AGC control 2 + priv->PHYRegDef[RF90_PATH_A].rfAGCControl2 = rOFDM0_XAAGCCore2; + priv->PHYRegDef[RF90_PATH_B].rfAGCControl2 = rOFDM0_XBAGCCore2; + priv->PHYRegDef[RF90_PATH_C].rfAGCControl2 = rOFDM0_XCAGCCore2; + priv->PHYRegDef[RF90_PATH_D].rfAGCControl2 = rOFDM0_XDAGCCore2; + + // RX AFE control 1 + priv->PHYRegDef[RF90_PATH_A].rfRxIQImbalance = rOFDM0_XARxIQImbalance; + priv->PHYRegDef[RF90_PATH_B].rfRxIQImbalance = rOFDM0_XBRxIQImbalance; + priv->PHYRegDef[RF90_PATH_C].rfRxIQImbalance = rOFDM0_XCRxIQImbalance; + priv->PHYRegDef[RF90_PATH_D].rfRxIQImbalance = rOFDM0_XDRxIQImbalance; + + // RX AFE control 1 + priv->PHYRegDef[RF90_PATH_A].rfRxAFE = rOFDM0_XARxAFE; + priv->PHYRegDef[RF90_PATH_B].rfRxAFE = rOFDM0_XBRxAFE; + priv->PHYRegDef[RF90_PATH_C].rfRxAFE = rOFDM0_XCRxAFE; + priv->PHYRegDef[RF90_PATH_D].rfRxAFE = rOFDM0_XDRxAFE; + + // Tx AFE control 1 + priv->PHYRegDef[RF90_PATH_A].rfTxIQImbalance = rOFDM0_XATxIQImbalance; + priv->PHYRegDef[RF90_PATH_B].rfTxIQImbalance = rOFDM0_XBTxIQImbalance; + priv->PHYRegDef[RF90_PATH_C].rfTxIQImbalance = rOFDM0_XCTxIQImbalance; + priv->PHYRegDef[RF90_PATH_D].rfTxIQImbalance = rOFDM0_XDTxIQImbalance; + + // Tx AFE control 2 + priv->PHYRegDef[RF90_PATH_A].rfTxAFE = rOFDM0_XATxAFE; + priv->PHYRegDef[RF90_PATH_B].rfTxAFE = rOFDM0_XBTxAFE; + priv->PHYRegDef[RF90_PATH_C].rfTxAFE = rOFDM0_XCTxAFE; + priv->PHYRegDef[RF90_PATH_D].rfTxAFE = rOFDM0_XDTxAFE; + + // Tranceiver LSSI Readback + priv->PHYRegDef[RF90_PATH_A].rfLSSIReadBack = rFPGA0_XA_LSSIReadBack; + priv->PHYRegDef[RF90_PATH_B].rfLSSIReadBack = rFPGA0_XB_LSSIReadBack; + priv->PHYRegDef[RF90_PATH_C].rfLSSIReadBack = rFPGA0_XC_LSSIReadBack; + priv->PHYRegDef[RF90_PATH_D].rfLSSIReadBack = rFPGA0_XD_LSSIReadBack; + +} +/****************************************************************************** + *function: This function is to write register and then readback to make sure whether BB and RF is OK + * input: net_device dev + * HW90_BLOCK_E CheckBlock + * RF90_RADIO_PATH_E eRFPath //only used when checkblock is HW90_BLOCK_RF + * output: none + * return: return whether BB and RF is ok(0:OK; 1:Fail) + * notice: This function may be removed in the ASIC + * ***************************************************************************/ +u8 rtl8192_phy_checkBBAndRF(struct net_device* dev, HW90_BLOCK_E CheckBlock, RF90_RADIO_PATH_E eRFPath) +{ +// struct r8192_priv *priv = ieee80211_priv(dev); +// BB_REGISTER_DEFINITION_T *pPhyReg = &priv->PHYRegDef[eRFPath]; + u8 ret = 0; + u32 i, CheckTimes = 4, dwRegRead = 0; + u32 WriteAddr[4]; + u32 WriteData[] = {0xfffff027, 0xaa55a02f, 0x00000027, 0x55aa502f}; + // Initialize register address offset to be checked + WriteAddr[HW90_BLOCK_MAC] = 0x100; + WriteAddr[HW90_BLOCK_PHY0] = 0x900; + WriteAddr[HW90_BLOCK_PHY1] = 0x800; + WriteAddr[HW90_BLOCK_RF] = 0x3; + RT_TRACE(COMP_PHY, "=======>%s(), CheckBlock:%d\n", __FUNCTION__, CheckBlock); + for(i=0 ; i < CheckTimes ; i++) + { + + // + // Write Data to register and readback + // + switch(CheckBlock) + { + case HW90_BLOCK_MAC: + RT_TRACE(COMP_ERR, "PHY_CheckBBRFOK(): Never Write 0x100 here!"); + break; + + case HW90_BLOCK_PHY0: + case HW90_BLOCK_PHY1: + write_nic_dword(dev, WriteAddr[CheckBlock], WriteData[i]); + dwRegRead = read_nic_dword(dev, WriteAddr[CheckBlock]); + break; + + case HW90_BLOCK_RF: + WriteData[i] &= 0xfff; + rtl8192_phy_SetRFReg(dev, eRFPath, WriteAddr[HW90_BLOCK_RF], bMask12Bits, WriteData[i]); + // TODO: we should not delay for such a long time. Ask SD3 + msleep(1); + dwRegRead = rtl8192_phy_QueryRFReg(dev, eRFPath, WriteAddr[HW90_BLOCK_RF], bMask12Bits); + msleep(1); + break; + + default: + ret = 1; + break; + } + + + // + // Check whether readback data is correct + // + if(dwRegRead != WriteData[i]) + { + RT_TRACE((COMP_PHY|COMP_ERR), "====>error=====dwRegRead: %x, WriteData: %x \n", dwRegRead, WriteData[i]); + ret = 1; + break; + } + } + + return ret; +} + + +/****************************************************************************** + *function: This function initialize BB&RF + * input: net_device dev + * output: none + * return: none + * notice: Initialization value may change all the time, so please make + * sure it has been synced with the newest. + * ***************************************************************************/ +void rtl8192_BB_Config_ParaFile(struct net_device* dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u8 bRegValue = 0, eCheckItem = 0, rtStatus = 0; + u32 dwRegValue = 0; + /************************************** + //<1>Initialize BaseBand + **************************************/ + + /*--set BB Global Reset--*/ + bRegValue = read_nic_byte(dev, BB_GLOBAL_RESET); + write_nic_byte(dev, BB_GLOBAL_RESET,(bRegValue|BB_GLOBAL_RESET_BIT)); + mdelay(50); + /*---set BB reset Active---*/ + dwRegValue = read_nic_dword(dev, CPU_GEN); + write_nic_dword(dev, CPU_GEN, (dwRegValue&(~CPU_GEN_BB_RST))); + + /*----Ckeck FPGAPHY0 and PHY1 board is OK----*/ + // TODO: this function should be removed on ASIC , Emily 2007.2.2 + for(eCheckItem=(HW90_BLOCK_E)HW90_BLOCK_PHY0; eCheckItem<=HW90_BLOCK_PHY1; eCheckItem++) + { + rtStatus = rtl8192_phy_checkBBAndRF(dev, (HW90_BLOCK_E)eCheckItem, (RF90_RADIO_PATH_E)0); //don't care RF path + if(rtStatus != 0) + { + RT_TRACE((COMP_ERR | COMP_PHY), "PHY_RF8256_Config():Check PHY%d Fail!!\n", eCheckItem-1); + return ; + } + } + /*---- Set CCK and OFDM Block "OFF"----*/ + rtl8192_setBBreg(dev, rFPGA0_RFMOD, bCCKEn|bOFDMEn, 0x0); + /*----BB Register Initilazation----*/ + //==m==>Set PHY REG From Header<==m== + rtl8192_phyConfigBB(dev, BaseBand_Config_PHY_REG); + + /*----Set BB reset de-Active----*/ + dwRegValue = read_nic_dword(dev, CPU_GEN); + write_nic_dword(dev, CPU_GEN, (dwRegValue|CPU_GEN_BB_RST)); + + /*----BB AGC table Initialization----*/ + //==m==>Set PHY REG From Header<==m== + rtl8192_phyConfigBB(dev, BaseBand_Config_AGC_TAB); + + /*----Enable XSTAL ----*/ + write_nic_byte_E(dev, 0x5e, 0x00); + if (priv->card_8192_version == (u8)VERSION_819xU_A) + { + //Antenna gain offset from B/C/D to A + dwRegValue = (priv->AntennaTxPwDiff[1]<<4 | priv->AntennaTxPwDiff[0]); + rtl8192_setBBreg(dev, rFPGA0_TxGainStage, (bXBTxAGC|bXCTxAGC), dwRegValue); + + //XSTALLCap + dwRegValue = priv->CrystalCap & 0xf; + rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, bXtalCap, dwRegValue); + } + + // Check if the CCK HighPower is turned ON. + // This is used to calculate PWDB. + priv->bCckHighPower = (u8)(rtl8192_QueryBBReg(dev, rFPGA0_XA_HSSIParameter2, 0x200)); + return; +} +/****************************************************************************** + *function: This function initialize BB&RF + * input: net_device dev + * output: none + * return: none + * notice: Initialization value may change all the time, so please make + * sure it has been synced with the newest. + * ***************************************************************************/ +void rtl8192_BBConfig(struct net_device* dev) +{ + rtl8192_InitBBRFRegDef(dev); + //config BB&RF. As hardCode based initialization has not been well + //implemented, so use file first.FIXME:should implement it for hardcode? + rtl8192_BB_Config_ParaFile(dev); + return; +} + +/****************************************************************************** + *function: This function obtains the initialization value of Tx power Level offset + * input: net_device dev + * output: none + * return: none + * ***************************************************************************/ +void rtl8192_phy_getTxPower(struct net_device* dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + priv->MCSTxPowerLevelOriginalOffset[0] = + read_nic_dword(dev, rTxAGC_Rate18_06); + priv->MCSTxPowerLevelOriginalOffset[1] = + read_nic_dword(dev, rTxAGC_Rate54_24); + priv->MCSTxPowerLevelOriginalOffset[2] = + read_nic_dword(dev, rTxAGC_Mcs03_Mcs00); + priv->MCSTxPowerLevelOriginalOffset[3] = + read_nic_dword(dev, rTxAGC_Mcs07_Mcs04); + priv->MCSTxPowerLevelOriginalOffset[4] = + read_nic_dword(dev, rTxAGC_Mcs11_Mcs08); + priv->MCSTxPowerLevelOriginalOffset[5] = + read_nic_dword(dev, rTxAGC_Mcs15_Mcs12); + + // read rx initial gain + priv->DefaultInitialGain[0] = read_nic_byte(dev, rOFDM0_XAAGCCore1); + priv->DefaultInitialGain[1] = read_nic_byte(dev, rOFDM0_XBAGCCore1); + priv->DefaultInitialGain[2] = read_nic_byte(dev, rOFDM0_XCAGCCore1); + priv->DefaultInitialGain[3] = read_nic_byte(dev, rOFDM0_XDAGCCore1); + RT_TRACE(COMP_INIT, "Default initial gain (c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x) \n", + priv->DefaultInitialGain[0], priv->DefaultInitialGain[1], + priv->DefaultInitialGain[2], priv->DefaultInitialGain[3]); + + // read framesync + priv->framesync = read_nic_byte(dev, rOFDM0_RxDetector3); + priv->framesyncC34 = read_nic_byte(dev, rOFDM0_RxDetector2); + RT_TRACE(COMP_INIT, "Default framesync (0x%x) = 0x%x \n", + rOFDM0_RxDetector3, priv->framesync); + + // read SIFS (save the value read fome MACPHY_REG.txt) + priv->SifsTime = read_nic_word(dev, SIFS); + + return; +} + +/****************************************************************************** + *function: This function obtains the initialization value of Tx power Level offset + * input: net_device dev + * output: none + * return: none + * ***************************************************************************/ +void rtl8192_phy_setTxPower(struct net_device* dev, u8 channel) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u8 powerlevel = priv->TxPowerLevelCCK[channel-1]; + u8 powerlevelOFDM24G = priv->TxPowerLevelOFDM24G[channel-1]; + + switch(priv->rf_chip) + { + case RF_8256: + PHY_SetRF8256CCKTxPower(dev, powerlevel); //need further implement + PHY_SetRF8256OFDMTxPower(dev, powerlevelOFDM24G); + break; + default: +// case RF_8225: +// case RF_8258: + RT_TRACE((COMP_PHY|COMP_ERR), "error RF chipID(8225 or 8258) in function %s()\n", __FUNCTION__); + break; + } + return; +} + +/****************************************************************************** + *function: This function check Rf chip to do RF config + * input: net_device dev + * output: none + * return: only 8256 is supported + * ***************************************************************************/ +void rtl8192_phy_RFConfig(struct net_device* dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + switch(priv->rf_chip) + { + case RF_8256: + PHY_RF8256_Config(dev); + break; + // case RF_8225: + // case RF_8258: + default: + RT_TRACE(COMP_ERR, "error chip id\n"); + break; + } + return; +} + +/****************************************************************************** + *function: This function update Initial gain + * input: net_device dev + * output: none + * return: As Windows has not implemented this, wait for complement + * ***************************************************************************/ +void rtl8192_phy_updateInitGain(struct net_device* dev) +{ + return; +} + +/****************************************************************************** + *function: This function read RF parameters from general head file, and do RF 3-wire + * input: net_device dev + * output: none + * return: return code show if RF configuration is successful(0:pass, 1:fail) + * Note: Delay may be required for RF configuration + * ***************************************************************************/ +u8 rtl8192_phy_ConfigRFWithHeaderFile(struct net_device* dev, RF90_RADIO_PATH_E eRFPath) +{ + + int i; + //u32* pRFArray; + u8 ret = 0; + + switch(eRFPath){ + case RF90_PATH_A: + for(i = 0;iTxPowerLevelCCK[channel-1]; + u8 powerlevelOFDM24G = priv->TxPowerLevelOFDM24G[channel-1]; + + switch(priv->rf_chip) + { + case RF_8225: +#ifdef TO_DO_LIST + PHY_SetRF8225CckTxPower(Adapter, powerlevel); + PHY_SetRF8225OfdmTxPower(Adapter, powerlevelOFDM24G); +#endif + break; + + case RF_8256: + PHY_SetRF8256CCKTxPower(dev, powerlevel); + PHY_SetRF8256OFDMTxPower(dev, powerlevelOFDM24G); + break; + + case RF_8258: + break; + default: + RT_TRACE(COMP_ERR, "unknown rf chip ID in rtl8192_SetTxPowerLevel()\n"); + break; + } + return; +} + +/****************************************************************************** + *function: This function set RF state on or off + * input: struct net_device *dev + * RT_RF_POWER_STATE eRFPowerState //Power State to set + * output: none + * return: none + * Note: + * ***************************************************************************/ +bool rtl8192_SetRFPowerState(struct net_device *dev, RT_RF_POWER_STATE eRFPowerState) +{ + bool bResult = true; +// u8 eRFPath; + struct r8192_priv *priv = ieee80211_priv(dev); + + if(eRFPowerState == priv->ieee80211->eRFPowerState) + return false; + + if(priv->SetRFPowerStateInProgress == true) + return false; + + priv->SetRFPowerStateInProgress = true; + + switch(priv->rf_chip) + { + case RF_8256: + switch( eRFPowerState ) + { + case eRfOn: +#if 0 + rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, BIT4, 0x1); // 0x860[4] + rtl8192_setBBreg(dev, rFPGA0_AnalogParameter4, 0x300, 0x3); // 0x88c[4] + rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x60, 0x3); // 0x880[6:5] + rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0xf, 0x3); // 0xc04[3:0] + rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0xf, 0x3); // 0xd04[3:0] + rtl8192_setBBreg(dev, rFPGA0_AnalogParameter2, 0x7000, 0x3); // 0x884[14:12] + // for(eRFPath = 0; eRFPath NumTotalRFPath; eRFPath++) + // PHY_SetRFReg(Adapter, (RF90_RADIO_PATH_E)eRFPath, 0x4, 0xC00, 0x2); + + //SwChnl(Adapter->ChannelID); +#endif + //RF-A, RF-B + //enable RF-Chip A/B + rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, BIT4, 0x1); // 0x860[4] + //analog to digital on + rtl8192_setBBreg(dev, rFPGA0_AnalogParameter4, 0x300, 0x3);// 0x88c[9:8] + //digital to analog on + rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x18, 0x3); // 0x880[4:3] + //rx antenna on + rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0x3, 0x3);// 0xc04[1:0] + //rx antenna on + rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0x3, 0x3);// 0xd04[1:0] + //analog to digital part2 on + rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x60, 0x3); // 0x880[6:5] + + break; + + case eRfSleep: + + break; + + case eRfOff: +#if 0 + rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, BIT4, 0x0); // 0x860[4] + rtl8192_setBBreg(dev, rFPGA0_AnalogParameter4, 0x300, 0x0); // 0x88c[4] + rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x60, 0x0); // 0x880[6:5] + rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0xf, 0); // 0xc04[3:0] + rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0xf, 0); // 0xd04[3:0] + rtl8192_setBBreg(dev, rFPGA0_AnalogParameter2, 0x7000, 0x0); // 0x884[14:12] + // for(eRFPath = 0; eRFPath NumTotalRFPath; eRFPath++) + // PHY_SetRFReg(Adapter, (RF90_RADIO_PATH_E)eRFPath, 0x4, 0xC00, 0x0); +#endif + //RF-A, RF-B + //disable RF-Chip A/B + rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, BIT4, 0x0); // 0x860[4] + //analog to digital off, for power save + rtl8192_setBBreg(dev, rFPGA0_AnalogParameter4, 0xf00, 0x0);// 0x88c[11:8] + //digital to analog off, for power save + rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x18, 0x0); // 0x880[4:3] + //rx antenna off + rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0xf, 0x0);// 0xc04[3:0] + //rx antenna off + rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0xf, 0x0);// 0xd04[3:0] + //analog to digital part2 off, for power save + rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x60, 0x0); // 0x880[6:5] + + break; + + default: + bResult = false; + RT_TRACE(COMP_ERR, "SetRFPowerState819xUsb(): unknow state to set: 0x%X!!!\n", eRFPowerState); + break; + } + break; + default: + RT_TRACE(COMP_ERR, "Not support rf_chip(%x)\n", priv->rf_chip); + break; + } +#ifdef TO_DO_LIST + if(bResult) + { + // Update current RF state variable. + pHalData->eRFPowerState = eRFPowerState; + switch(pHalData->RFChipID ) + { + case RF_8256: + switch(pHalData->eRFPowerState) + { + case eRfOff: + // + //If Rf off reason is from IPS, Led should blink with no link, by Maddest 071015 + // + if(pMgntInfo->RfOffReason==RF_CHANGE_BY_IPS ) + { + Adapter->HalFunc.LedControlHandler(Adapter,LED_CTL_NO_LINK); + } + else + { + // Turn off LED if RF is not ON. + Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_POWER_OFF); + } + break; + + case eRfOn: + // Turn on RF we are still linked, which might happen when + // we quickly turn off and on HW RF. 2006.05.12, by rcnjko. + if( pMgntInfo->bMediaConnect == TRUE ) + { + Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_LINK); + } + else + { + // Turn off LED if RF is not ON. + Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_NO_LINK); + } + break; + + default: + // do nothing. + break; + }// Switch RF state + break; + + default: + RT_TRACE(COMP_RF, DBG_LOUD, ("SetRFPowerState8190(): Unknown RF type\n")); + break; + } + + } +#endif + priv->SetRFPowerStateInProgress = false; + + return bResult; +} + +/**************************************************************************************** + *function: This function set command table variable(struct SwChnlCmd). + * input: SwChnlCmd* CmdTable //table to be set. + * u32 CmdTableIdx //variable index in table to be set + * u32 CmdTableSz //table size. + * SwChnlCmdID CmdID //command ID to set. + * u32 Para1 + * u32 Para2 + * u32 msDelay + * output: + * return: true if finished, false otherwise + * Note: + * ************************************************************************************/ +u8 rtl8192_phy_SetSwChnlCmdArray( + SwChnlCmd* CmdTable, + u32 CmdTableIdx, + u32 CmdTableSz, + SwChnlCmdID CmdID, + u32 Para1, + u32 Para2, + u32 msDelay + ) +{ + SwChnlCmd* pCmd; + + if(CmdTable == NULL) + { + RT_TRACE(COMP_ERR, "phy_SetSwChnlCmdArray(): CmdTable cannot be NULL.\n"); + return false; + } + if(CmdTableIdx >= CmdTableSz) + { + RT_TRACE(COMP_ERR, "phy_SetSwChnlCmdArray(): Access invalid index, please check size of the table, CmdTableIdx:%d, CmdTableSz:%d\n", + CmdTableIdx, CmdTableSz); + return false; + } + + pCmd = CmdTable + CmdTableIdx; + pCmd->CmdID = CmdID; + pCmd->Para1 = Para1; + pCmd->Para2 = Para2; + pCmd->msDelay = msDelay; + + return true; +} +/****************************************************************************** + *function: This function set channel step by step + * input: struct net_device *dev + * u8 channel + * u8* stage //3 stages + * u8* step // + * u32* delay //whether need to delay + * output: store new stage, step and delay for next step(combine with function above) + * return: true if finished, false otherwise + * Note: Wait for simpler function to replace it //wb + * ***************************************************************************/ +u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, u8* stage, u8* step, u32* delay) +{ + struct r8192_priv *priv = ieee80211_priv(dev); +// PCHANNEL_ACCESS_SETTING pChnlAccessSetting; + SwChnlCmd PreCommonCmd[MAX_PRECMD_CNT]; + u32 PreCommonCmdCnt; + SwChnlCmd PostCommonCmd[MAX_POSTCMD_CNT]; + u32 PostCommonCmdCnt; + SwChnlCmd RfDependCmd[MAX_RFDEPENDCMD_CNT]; + u32 RfDependCmdCnt; + SwChnlCmd *CurrentCmd = NULL; + //RF90_RADIO_PATH_E eRFPath; + u8 eRFPath; +// u32 RfRetVal; +// u8 RetryCnt; + + RT_TRACE(COMP_CH, "====>%s()====stage:%d, step:%d, channel:%d\n", __FUNCTION__, *stage, *step, channel); +// RT_ASSERT(IsLegalChannel(Adapter, channel), ("illegal channel: %d\n", channel)); +#ifdef ENABLE_DOT11D + if (!IsLegalChannel(priv->ieee80211, channel)) + { + RT_TRACE(COMP_ERR, "=============>set to illegal channel:%d\n", channel); + return true; //return true to tell upper caller function this channel setting is finished! Or it will in while loop. + } +#endif +//FIXME:need to check whether channel is legal or not here.WB + + + //for(eRFPath = RF90_PATH_A; eRFPath NumTotalRFPath; eRFPath++) +// for(eRFPath = 0; eRFPath Fill up pre common command. + PreCommonCmdCnt = 0; + rtl8192_phy_SetSwChnlCmdArray(PreCommonCmd, PreCommonCmdCnt++, MAX_PRECMD_CNT, + CmdID_SetTxPowerLevel, 0, 0, 0); + rtl8192_phy_SetSwChnlCmdArray(PreCommonCmd, PreCommonCmdCnt++, MAX_PRECMD_CNT, + CmdID_End, 0, 0, 0); + + // <2> Fill up post common command. + PostCommonCmdCnt = 0; + + rtl8192_phy_SetSwChnlCmdArray(PostCommonCmd, PostCommonCmdCnt++, MAX_POSTCMD_CNT, + CmdID_End, 0, 0, 0); + + // <3> Fill up RF dependent command. + RfDependCmdCnt = 0; + switch( priv->rf_chip ) + { + case RF_8225: + if (!(channel >= 1 && channel <= 14)) + { + RT_TRACE(COMP_ERR, "illegal channel for Zebra 8225: %d\n", channel); + return true; + } + rtl8192_phy_SetSwChnlCmdArray(RfDependCmd, RfDependCmdCnt++, MAX_RFDEPENDCMD_CNT, + CmdID_RF_WriteReg, rZebra1_Channel, RF_CHANNEL_TABLE_ZEBRA[channel], 10); + rtl8192_phy_SetSwChnlCmdArray(RfDependCmd, RfDependCmdCnt++, MAX_RFDEPENDCMD_CNT, + CmdID_End, 0, 0, 0); + break; + + case RF_8256: + // TEST!! This is not the table for 8256!! + if (!(channel >= 1 && channel <= 14)) + { + RT_TRACE(COMP_ERR, "illegal channel for Zebra 8256: %d\n", channel); + return true; + } + rtl8192_phy_SetSwChnlCmdArray(RfDependCmd, RfDependCmdCnt++, MAX_RFDEPENDCMD_CNT, + CmdID_RF_WriteReg, rZebra1_Channel, channel, 10); + rtl8192_phy_SetSwChnlCmdArray(RfDependCmd, RfDependCmdCnt++, MAX_RFDEPENDCMD_CNT, + CmdID_End, 0, 0, 0); + break; + + case RF_8258: + break; + + default: + RT_TRACE(COMP_ERR, "Unknown RFChipID: %d\n", priv->rf_chip); + return true; + break; + } + + + do{ + switch(*stage) + { + case 0: + CurrentCmd=&PreCommonCmd[*step]; + break; + case 1: + CurrentCmd=&RfDependCmd[*step]; + break; + case 2: + CurrentCmd=&PostCommonCmd[*step]; + break; + } + + if(CurrentCmd->CmdID==CmdID_End) + { + if((*stage)==2) + { + (*delay)=CurrentCmd->msDelay; + return true; + } + else + { + (*stage)++; + (*step)=0; + continue; + } + } + + switch(CurrentCmd->CmdID) + { + case CmdID_SetTxPowerLevel: + if(priv->card_8192_version == (u8)VERSION_819xU_A) //xiong: consider it later! + rtl8192_SetTxPowerLevel(dev,channel); + break; + case CmdID_WritePortUlong: + write_nic_dword(dev, CurrentCmd->Para1, CurrentCmd->Para2); + break; + case CmdID_WritePortUshort: + write_nic_word(dev, CurrentCmd->Para1, (u16)CurrentCmd->Para2); + break; + case CmdID_WritePortUchar: + write_nic_byte(dev, CurrentCmd->Para1, (u8)CurrentCmd->Para2); + break; + case CmdID_RF_WriteReg: + for(eRFPath = 0; eRFPath < RF90_PATH_MAX; eRFPath++) + { + rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, CurrentCmd->Para1, bZebra1_ChannelNum, CurrentCmd->Para2); + } + break; + default: + break; + } + + break; + }while(true); +// }/*for(Number of RF paths)*/ + + (*delay)=CurrentCmd->msDelay; + (*step)++; + return false; +} + +/****************************************************************************** + *function: This function does acturally set channel work + * input: struct net_device *dev + * u8 channel + * output: none + * return: noin + * Note: We should not call this function directly + * ***************************************************************************/ +void rtl8192_phy_FinishSwChnlNow(struct net_device *dev, u8 channel) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u32 delay = 0; + + while(!rtl8192_phy_SwChnlStepByStep(dev,channel,&priv->SwChnlStage,&priv->SwChnlStep,&delay)) + { + // if(delay>0) + // msleep(delay);//or mdelay? need further consideration + if(!priv->up) + break; + } +} +/****************************************************************************** + *function: Callback routine of the work item for switch channel. + * input: + * + * output: none + * return: noin + * ***************************************************************************/ +void rtl8192_SwChnl_WorkItem(struct net_device *dev) +{ + + struct r8192_priv *priv = ieee80211_priv(dev); + + RT_TRACE(COMP_CH, "==> SwChnlCallback819xUsbWorkItem(), chan:%d\n", priv->chan); + + + rtl8192_phy_FinishSwChnlNow(dev , priv->chan); + + RT_TRACE(COMP_CH, "<== SwChnlCallback819xUsbWorkItem()\n"); +} + +/****************************************************************************** + *function: This function scheduled actural workitem to set channel + * input: net_device dev + * u8 channel //channel to set + * output: none + * return: return code show if workitem is scheduled(1:pass, 0:fail) + * Note: Delay may be required for RF configuration + * ***************************************************************************/ +u8 rtl8192_phy_SwChnl(struct net_device* dev, u8 channel) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + RT_TRACE(COMP_CH, "=====>%s(), SwChnlInProgress:%d\n", __FUNCTION__, priv->SwChnlInProgress); + if(!priv->up) + return false; + if(priv->SwChnlInProgress) + return false; + +// if(pHalData->SetBWModeInProgress) +// return; +if (0) //to test current channel from RF reg 0x7. +{ + u8 eRFPath; + for(eRFPath = 0; eRFPath < 2; eRFPath++){ + printk("====>set channel:%x\n",rtl8192_phy_QueryRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x7, bZebra1_ChannelNum)); + udelay(10); + } +} + //-------------------------------------------- + switch(priv->ieee80211->mode) + { + case WIRELESS_MODE_A: + case WIRELESS_MODE_N_5G: + if (channel<=14){ + RT_TRACE(COMP_ERR, "WIRELESS_MODE_A but channel<=14"); + return false; + } + break; + case WIRELESS_MODE_B: + if (channel>14){ + RT_TRACE(COMP_ERR, "WIRELESS_MODE_B but channel>14"); + return false; + } + break; + case WIRELESS_MODE_G: + case WIRELESS_MODE_N_24G: + if (channel>14){ + RT_TRACE(COMP_ERR, "WIRELESS_MODE_G but channel>14"); + return false; + } + break; + } + //-------------------------------------------- + + priv->SwChnlInProgress = true; + if(channel == 0) + channel = 1; + + priv->chan=channel; + + priv->SwChnlStage=0; + priv->SwChnlStep=0; +// schedule_work(&(priv->SwChnlWorkItem)); +// rtl8192_SwChnl_WorkItem(dev); + if(priv->up) { +// queue_work(priv->priv_wq,&(priv->SwChnlWorkItem)); + rtl8192_SwChnl_WorkItem(dev); + } + + priv->SwChnlInProgress = false; + return true; +} + + +// +/****************************************************************************** + *function: Callback routine of the work item for set bandwidth mode. + * input: struct net_device *dev + * HT_CHANNEL_WIDTH Bandwidth //20M or 40M + * HT_EXTCHNL_OFFSET Offset //Upper, Lower, or Don't care + * output: none + * return: none + * Note: I doubt whether SetBWModeInProgress flag is necessary as we can + * test whether current work in the queue or not.//do I? + * ***************************************************************************/ +void rtl8192_SetBWModeWorkItem(struct net_device *dev) +{ + + struct r8192_priv *priv = ieee80211_priv(dev); + u8 regBwOpMode; + + RT_TRACE(COMP_SWBW, "==>rtl8192_SetBWModeWorkItem() Switch to %s bandwidth\n", \ + priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20?"20MHz":"40MHz") + + + if(priv->rf_chip == RF_PSEUDO_11N) + { + priv->SetBWModeInProgress= false; + return; + } + + //<1>Set MAC register + regBwOpMode = read_nic_byte(dev, BW_OPMODE); + + switch(priv->CurrentChannelBW) + { + case HT_CHANNEL_WIDTH_20: + regBwOpMode |= BW_OPMODE_20MHZ; + // 2007/02/07 Mark by Emily becasue we have not verify whether this register works + write_nic_byte(dev, BW_OPMODE, regBwOpMode); + break; + + case HT_CHANNEL_WIDTH_20_40: + regBwOpMode &= ~BW_OPMODE_20MHZ; + // 2007/02/07 Mark by Emily becasue we have not verify whether this register works + write_nic_byte(dev, BW_OPMODE, regBwOpMode); + break; + + default: + RT_TRACE(COMP_ERR, "SetChannelBandwidth819xUsb(): unknown Bandwidth: %#X\n",priv->CurrentChannelBW); + break; + } + + //<2>Set PHY related register + switch(priv->CurrentChannelBW) + { + case HT_CHANNEL_WIDTH_20: + // Add by Vivi 20071119 + rtl8192_setBBreg(dev, rFPGA0_RFMOD, bRFMOD, 0x0); + rtl8192_setBBreg(dev, rFPGA1_RFMOD, bRFMOD, 0x0); + rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x00100000, 1); + + // Correct the tx power for CCK rate in 20M. Suggest by YN, 20071207 +#if 0 + write_nic_dword(dev, rCCK0_TxFilter1, 0x1a1b0000); + write_nic_dword(dev, rCCK0_TxFilter2, 0x090e1317); + write_nic_dword(dev, rCCK0_DebugPort, 0x00000204); +#endif + priv->cck_present_attentuation = + priv->cck_present_attentuation_20Mdefault + priv->cck_present_attentuation_difference; + + if(priv->cck_present_attentuation > 22) + priv->cck_present_attentuation= 22; + if(priv->cck_present_attentuation< 0) + priv->cck_present_attentuation = 0; + RT_TRACE(COMP_INIT, "20M, pHalData->CCKPresentAttentuation = %d\n", priv->cck_present_attentuation); + + if(priv->chan == 14 && !priv->bcck_in_ch14) + { + priv->bcck_in_ch14 = TRUE; + dm_cck_txpower_adjust(dev,priv->bcck_in_ch14); + } + else if(priv->chan != 14 && priv->bcck_in_ch14) + { + priv->bcck_in_ch14 = FALSE; + dm_cck_txpower_adjust(dev,priv->bcck_in_ch14); + } + else + dm_cck_txpower_adjust(dev,priv->bcck_in_ch14); + + break; + case HT_CHANNEL_WIDTH_20_40: + // Add by Vivi 20071119 + rtl8192_setBBreg(dev, rFPGA0_RFMOD, bRFMOD, 0x1); + rtl8192_setBBreg(dev, rFPGA1_RFMOD, bRFMOD, 0x1); + rtl8192_setBBreg(dev, rCCK0_System, bCCKSideBand, (priv->nCur40MhzPrimeSC>>1)); + rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x00100000, 0); + rtl8192_setBBreg(dev, rOFDM1_LSTF, 0xC00, priv->nCur40MhzPrimeSC); +#if 0 + // Correct the tx power for CCK rate in 40M. Suggest by YN, 20071207 + write_nic_dword(dev, rCCK0_TxFilter1, 0x35360000); + write_nic_dword(dev, rCCK0_TxFilter2, 0x121c252e); + write_nic_dword(dev, rCCK0_DebugPort, 0x00000409); +#endif + priv->cck_present_attentuation = + priv->cck_present_attentuation_40Mdefault + priv->cck_present_attentuation_difference; + + if(priv->cck_present_attentuation > 22) + priv->cck_present_attentuation = 22; + if(priv->cck_present_attentuation < 0) + priv->cck_present_attentuation = 0; + + RT_TRACE(COMP_INIT, "40M, pHalData->CCKPresentAttentuation = %d\n", priv->cck_present_attentuation); + if(priv->chan == 14 && !priv->bcck_in_ch14) + { + priv->bcck_in_ch14 = true; + dm_cck_txpower_adjust(dev,priv->bcck_in_ch14); + } + else if(priv->chan!= 14 && priv->bcck_in_ch14) + { + priv->bcck_in_ch14 = false; + dm_cck_txpower_adjust(dev,priv->bcck_in_ch14); + } + else + dm_cck_txpower_adjust(dev,priv->bcck_in_ch14); + + break; + default: + RT_TRACE(COMP_ERR, "SetChannelBandwidth819xUsb(): unknown Bandwidth: %#X\n" ,priv->CurrentChannelBW); + break; + + } + //Skip over setting of J-mode in BB register here. Default value is "None J mode". Emily 20070315 + +#if 1 + //<3>Set RF related register + switch( priv->rf_chip ) + { + case RF_8225: +#ifdef TO_DO_LIST + PHY_SetRF8225Bandwidth(Adapter, pHalData->CurrentChannelBW); +#endif + break; + + case RF_8256: + PHY_SetRF8256Bandwidth(dev, priv->CurrentChannelBW); + break; + + case RF_8258: + // PHY_SetRF8258Bandwidth(); + break; + + case RF_PSEUDO_11N: + // Do Nothing + break; + + default: + RT_TRACE(COMP_ERR, "Unknown RFChipID: %d\n", priv->rf_chip); + break; + } +#endif + priv->SetBWModeInProgress= false; + + RT_TRACE(COMP_SWBW, "<==SetBWMode819xUsb(), %d", atomic_read(&(priv->ieee80211->atm_swbw)) ); +} + +/****************************************************************************** + *function: This function schedules bandwith switch work. + * input: struct net_device *dev + * HT_CHANNEL_WIDTH Bandwidth //20M or 40M + * HT_EXTCHNL_OFFSET Offset //Upper, Lower, or Don't care + * output: none + * return: none + * Note: I doubt whether SetBWModeInProgress flag is necessary as we can + * test whether current work in the queue or not.//do I? + * ***************************************************************************/ +void rtl8192_SetBWMode(struct net_device *dev, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + if(priv->SetBWModeInProgress) + return; + priv->SetBWModeInProgress= true; + + priv->CurrentChannelBW = Bandwidth; + + if(Offset==HT_EXTCHNL_OFFSET_LOWER) + priv->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_UPPER; + else if(Offset==HT_EXTCHNL_OFFSET_UPPER) + priv->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_LOWER; + else + priv->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_DONT_CARE; + + //queue_work(priv->priv_wq, &(priv->SetBWModeWorkItem)); + // schedule_work(&(priv->SetBWModeWorkItem)); + rtl8192_SetBWModeWorkItem(dev); + +} + +void InitialGain819xUsb(struct net_device *dev, u8 Operation) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + + priv->InitialGainOperateType = Operation; + + if(priv->up) + { + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) + queue_delayed_work(priv->priv_wq,&priv->initialgain_operate_wq,0); + #else + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + schedule_task(&priv->initialgain_operate_wq); + #else + queue_work(priv->priv_wq,&priv->initialgain_operate_wq); + #endif + #endif + } +} + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +extern void InitialGainOperateWorkItemCallBack(struct work_struct *work) +{ + struct delayed_work *dwork = container_of(work,struct delayed_work,work); + struct r8192_priv *priv = container_of(dwork,struct r8192_priv,initialgain_operate_wq); + struct net_device *dev = priv->ieee80211->dev; +#else +extern void InitialGainOperateWorkItemCallBack(struct net_device *dev) +{ + struct r8192_priv *priv = ieee80211_priv(dev); +#endif +#define SCAN_RX_INITIAL_GAIN 0x17 +#define POWER_DETECTION_TH 0x08 + u32 BitMask; + u8 initial_gain; + u8 Operation; + + Operation = priv->InitialGainOperateType; + + switch(Operation) + { + case IG_Backup: + RT_TRACE(COMP_SCAN, "IG_Backup, backup the initial gain.\n"); + initial_gain = SCAN_RX_INITIAL_GAIN;//priv->DefaultInitialGain[0];// + BitMask = bMaskByte0; + if(dm_digtable.dig_algorithm == DIG_ALGO_BY_FALSE_ALARM) + rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); // FW DIG OFF + priv->initgain_backup.xaagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XAAGCCore1, BitMask); + priv->initgain_backup.xbagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XBAGCCore1, BitMask); + priv->initgain_backup.xcagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XCAGCCore1, BitMask); + priv->initgain_backup.xdagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XDAGCCore1, BitMask); + BitMask = bMaskByte2; + priv->initgain_backup.cca = (u8)rtl8192_QueryBBReg(dev, rCCK0_CCA, BitMask); + + RT_TRACE(COMP_SCAN, "Scan InitialGainBackup 0xc50 is %x\n",priv->initgain_backup.xaagccore1); + RT_TRACE(COMP_SCAN, "Scan InitialGainBackup 0xc58 is %x\n",priv->initgain_backup.xbagccore1); + RT_TRACE(COMP_SCAN, "Scan InitialGainBackup 0xc60 is %x\n",priv->initgain_backup.xcagccore1); + RT_TRACE(COMP_SCAN, "Scan InitialGainBackup 0xc68 is %x\n",priv->initgain_backup.xdagccore1); + RT_TRACE(COMP_SCAN, "Scan InitialGainBackup 0xa0a is %x\n",priv->initgain_backup.cca); + + RT_TRACE(COMP_SCAN, "Write scan initial gain = 0x%x \n", initial_gain); + write_nic_byte(dev, rOFDM0_XAAGCCore1, initial_gain); + write_nic_byte(dev, rOFDM0_XBAGCCore1, initial_gain); + write_nic_byte(dev, rOFDM0_XCAGCCore1, initial_gain); + write_nic_byte(dev, rOFDM0_XDAGCCore1, initial_gain); + RT_TRACE(COMP_SCAN, "Write scan 0xa0a = 0x%x \n", POWER_DETECTION_TH); + write_nic_byte(dev, 0xa0a, POWER_DETECTION_TH); + break; + case IG_Restore: + RT_TRACE(COMP_SCAN, "IG_Restore, restore the initial gain.\n"); + BitMask = 0x7f; //Bit0~ Bit6 + if(dm_digtable.dig_algorithm == DIG_ALGO_BY_FALSE_ALARM) + rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); // FW DIG OFF + + rtl8192_setBBreg(dev, rOFDM0_XAAGCCore1, BitMask, (u32)priv->initgain_backup.xaagccore1); + rtl8192_setBBreg(dev, rOFDM0_XBAGCCore1, BitMask, (u32)priv->initgain_backup.xbagccore1); + rtl8192_setBBreg(dev, rOFDM0_XCAGCCore1, BitMask, (u32)priv->initgain_backup.xcagccore1); + rtl8192_setBBreg(dev, rOFDM0_XDAGCCore1, BitMask, (u32)priv->initgain_backup.xdagccore1); + BitMask = bMaskByte2; + rtl8192_setBBreg(dev, rCCK0_CCA, BitMask, (u32)priv->initgain_backup.cca); + + RT_TRACE(COMP_SCAN, "Scan BBInitialGainRestore 0xc50 is %x\n",priv->initgain_backup.xaagccore1); + RT_TRACE(COMP_SCAN, "Scan BBInitialGainRestore 0xc58 is %x\n",priv->initgain_backup.xbagccore1); + RT_TRACE(COMP_SCAN, "Scan BBInitialGainRestore 0xc60 is %x\n",priv->initgain_backup.xcagccore1); + RT_TRACE(COMP_SCAN, "Scan BBInitialGainRestore 0xc68 is %x\n",priv->initgain_backup.xdagccore1); + RT_TRACE(COMP_SCAN, "Scan BBInitialGainRestore 0xa0a is %x\n",priv->initgain_backup.cca); + +#ifdef RTL8190P + SetTxPowerLevel8190(Adapter,priv->CurrentChannel); +#endif +#ifdef RTL8192E + SetTxPowerLevel8190(Adapter,priv->CurrentChannel); +#endif +//#ifdef RTL8192U + rtl8192_phy_setTxPower(dev,priv->ieee80211->current_network.channel); +//#endif + + if(dm_digtable.dig_algorithm == DIG_ALGO_BY_FALSE_ALARM) + rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); // FW DIG ON + break; + default: + RT_TRACE(COMP_SCAN, "Unknown IG Operation. \n"); + break; + } +} + diff --git a/drivers/staging/rtl8192u/r819xU_phy.h b/drivers/staging/rtl8192u/r819xU_phy.h new file mode 100644 index 000000000000..c165ac1265d9 --- /dev/null +++ b/drivers/staging/rtl8192u/r819xU_phy.h @@ -0,0 +1,94 @@ +#ifndef _R819XU_PHY_H +#define _R819XU_PHY_H + +/* Channel switch:The size of command tables for switch channel*/ +#define MAX_PRECMD_CNT 16 +#define MAX_RFDEPENDCMD_CNT 16 +#define MAX_POSTCMD_CNT 16 + +typedef enum _SwChnlCmdID{ + CmdID_End, + CmdID_SetTxPowerLevel, + CmdID_BBRegWrite10, + CmdID_WritePortUlong, + CmdID_WritePortUshort, + CmdID_WritePortUchar, + CmdID_RF_WriteReg, +}SwChnlCmdID; + +/*--------------------------------Define structure--------------------------------*/ +/* 1. Switch channel related */ +typedef struct _SwChnlCmd{ + SwChnlCmdID CmdID; + u32 Para1; + u32 Para2; + u32 msDelay; +}__attribute__ ((packed)) SwChnlCmd; + +extern u32 rtl819XMACPHY_Array_PG[]; +extern u32 rtl819XPHY_REG_1T2RArray[]; +extern u32 rtl819XAGCTAB_Array[]; +extern u32 rtl819XRadioA_Array[]; +extern u32 rtl819XRadioB_Array[]; +extern u32 rtl819XRadioC_Array[]; +extern u32 rtl819XRadioD_Array[]; + +typedef enum _HW90_BLOCK{ + HW90_BLOCK_MAC = 0, + HW90_BLOCK_PHY0 = 1, + HW90_BLOCK_PHY1 = 2, + HW90_BLOCK_RF = 3, + HW90_BLOCK_MAXIMUM = 4, // Never use this +}HW90_BLOCK_E, *PHW90_BLOCK_E; + +typedef enum _RF90_RADIO_PATH{ + RF90_PATH_A = 0, //Radio Path A + RF90_PATH_B = 1, //Radio Path B + RF90_PATH_C = 2, //Radio Path C + RF90_PATH_D = 3, //Radio Path D + RF90_PATH_MAX //Max RF number 92 support +}RF90_RADIO_PATH_E, *PRF90_RADIO_PATH_E; + +#define bMaskByte0 0xff +#define bMaskByte1 0xff00 +#define bMaskByte2 0xff0000 +#define bMaskByte3 0xff000000 +#define bMaskHWord 0xffff0000 +#define bMaskLWord 0x0000ffff +#define bMaskDWord 0xffffffff + +//extern u32 rtl8192_CalculateBitShift(u32 dwBitMask); +extern u8 rtl8192_phy_CheckIsLegalRFPath(struct net_device* dev, u32 eRFPath); +extern void rtl8192_setBBreg(struct net_device* dev, u32 dwRegAddr, u32 dwBitMask, u32 dwData); +extern u32 rtl8192_QueryBBReg(struct net_device* dev, u32 dwRegAddr, u32 dwBitMask); +//extern u32 rtl8192_phy_RFSerialRead(struct net_device* dev, RF90_RADIO_PATH_E eRFPath, u32 Offset); +//extern void rtl8192_phy_RFSerialWrite(struct net_device* dev, RF90_RADIO_PATH_E eRFPath, u32 Offset, u32 Data); +extern void rtl8192_phy_SetRFReg(struct net_device* dev, RF90_RADIO_PATH_E eRFPath, u32 RegAddr, u32 BitMask, u32 Data); +extern u32 rtl8192_phy_QueryRFReg(struct net_device* dev, RF90_RADIO_PATH_E eRFPath, u32 RegAddr, u32 BitMask); +extern void rtl8192_phy_configmac(struct net_device* dev); +extern void rtl8192_phyConfigBB(struct net_device* dev, u8 ConfigType); +//extern void rtl8192_InitBBRFRegDef(struct net_device* dev); +extern u8 rtl8192_phy_checkBBAndRF(struct net_device* dev, HW90_BLOCK_E CheckBlock, RF90_RADIO_PATH_E eRFPath); +//extern void rtl8192_BB_Config_ParaFile(struct net_device* dev); +extern void rtl8192_BBConfig(struct net_device* dev); +extern void rtl8192_phy_getTxPower(struct net_device* dev); +extern void rtl8192_phy_setTxPower(struct net_device* dev, u8 channel); +extern void rtl8192_phy_RFConfig(struct net_device* dev); +extern void rtl8192_phy_updateInitGain(struct net_device* dev); +extern u8 rtl8192_phy_ConfigRFWithHeaderFile(struct net_device* dev, RF90_RADIO_PATH_E eRFPath); + +extern u8 rtl8192_phy_SwChnl(struct net_device* dev, u8 channel); +extern void rtl8192_SetBWMode(struct net_device *dev, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset); +extern void rtl8192_SwChnl_WorkItem(struct net_device *dev); +void rtl8192_SetBWModeWorkItem(struct net_device *dev); +extern bool rtl8192_SetRFPowerState(struct net_device *dev, RT_RF_POWER_STATE eRFPowerState); +//added by amy +extern void InitialGain819xUsb(struct net_device *dev, u8 Operation); + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +extern void InitialGainOperateWorkItemCallBack(struct work_struct *work); +#else +extern void InitialGainOperateWorkItemCallBack(struct net_device *dev); +#endif + +#endif diff --git a/drivers/staging/rtl8192u/r819xU_phyreg.h b/drivers/staging/rtl8192u/r819xU_phyreg.h new file mode 100644 index 000000000000..b62f1a6fb1eb --- /dev/null +++ b/drivers/staging/rtl8192u/r819xU_phyreg.h @@ -0,0 +1,871 @@ +#ifndef _R819XU_PHYREG_H +#define _R819XU_PHYREG_H + + +#define RF_DATA 0x1d4 // FW will write RF data in the register. + +//Register //duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF +//page 1 +#define rPMAC_Reset 0x100 +#define rPMAC_TxStart 0x104 +#define rPMAC_TxLegacySIG 0x108 +#define rPMAC_TxHTSIG1 0x10c +#define rPMAC_TxHTSIG2 0x110 +#define rPMAC_PHYDebug 0x114 +#define rPMAC_TxPacketNum 0x118 +#define rPMAC_TxIdle 0x11c +#define rPMAC_TxMACHeader0 0x120 +#define rPMAC_TxMACHeader1 0x124 +#define rPMAC_TxMACHeader2 0x128 +#define rPMAC_TxMACHeader3 0x12c +#define rPMAC_TxMACHeader4 0x130 +#define rPMAC_TxMACHeader5 0x134 +#define rPMAC_TxDataType 0x138 +#define rPMAC_TxRandomSeed 0x13c +#define rPMAC_CCKPLCPPreamble 0x140 +#define rPMAC_CCKPLCPHeader 0x144 +#define rPMAC_CCKCRC16 0x148 +#define rPMAC_OFDMRxCRC32OK 0x170 +#define rPMAC_OFDMRxCRC32Er 0x174 +#define rPMAC_OFDMRxParityEr 0x178 +#define rPMAC_OFDMRxCRC8Er 0x17c +#define rPMAC_CCKCRxRC16Er 0x180 +#define rPMAC_CCKCRxRC32Er 0x184 +#define rPMAC_CCKCRxRC32OK 0x188 +#define rPMAC_TxStatus 0x18c + +//page8 +#define rFPGA0_RFMOD 0x800 //RF mode & CCK TxSC +#define rFPGA0_TxInfo 0x804 +#define rFPGA0_PSDFunction 0x808 +#define rFPGA0_TxGainStage 0x80c +#define rFPGA0_RFTiming1 0x810 +#define rFPGA0_RFTiming2 0x814 +//#define rFPGA0_XC_RFTiming 0x818 +//#define rFPGA0_XD_RFTiming 0x81c +#define rFPGA0_XA_HSSIParameter1 0x820 +#define rFPGA0_XA_HSSIParameter2 0x824 +#define rFPGA0_XB_HSSIParameter1 0x828 +#define rFPGA0_XB_HSSIParameter2 0x82c +#define rFPGA0_XC_HSSIParameter1 0x830 +#define rFPGA0_XC_HSSIParameter2 0x834 +#define rFPGA0_XD_HSSIParameter1 0x838 +#define rFPGA0_XD_HSSIParameter2 0x83c +#define rFPGA0_XA_LSSIParameter 0x840 +#define rFPGA0_XB_LSSIParameter 0x844 +#define rFPGA0_XC_LSSIParameter 0x848 +#define rFPGA0_XD_LSSIParameter 0x84c +#define rFPGA0_RFWakeUpParameter 0x850 +#define rFPGA0_RFSleepUpParameter 0x854 +#define rFPGA0_XAB_SwitchControl 0x858 +#define rFPGA0_XCD_SwitchControl 0x85c +#define rFPGA0_XA_RFInterfaceOE 0x860 +#define rFPGA0_XB_RFInterfaceOE 0x864 +#define rFPGA0_XC_RFInterfaceOE 0x868 +#define rFPGA0_XD_RFInterfaceOE 0x86c +#define rFPGA0_XAB_RFInterfaceSW 0x870 +#define rFPGA0_XCD_RFInterfaceSW 0x874 +#define rFPGA0_XAB_RFParameter 0x878 +#define rFPGA0_XCD_RFParameter 0x87c +#define rFPGA0_AnalogParameter1 0x880 +#define rFPGA0_AnalogParameter2 0x884 +#define rFPGA0_AnalogParameter3 0x888 +#define rFPGA0_AnalogParameter4 0x88c +#define rFPGA0_XA_LSSIReadBack 0x8a0 +#define rFPGA0_XB_LSSIReadBack 0x8a4 +#define rFPGA0_XC_LSSIReadBack 0x8a8 +#define rFPGA0_XD_LSSIReadBack 0x8ac +#define rFPGA0_PSDReport 0x8b4 +#define rFPGA0_XAB_RFInterfaceRB 0x8e0 +#define rFPGA0_XCD_RFInterfaceRB 0x8e4 + +//page 9 +#define rFPGA1_RFMOD 0x900 //RF mode & OFDM TxSC +#define rFPGA1_TxBlock 0x904 +#define rFPGA1_DebugSelect 0x908 +#define rFPGA1_TxInfo 0x90c + +//page a +#define rCCK0_System 0xa00 +#define rCCK0_AFESetting 0xa04 +#define rCCK0_CCA 0xa08 +#define rCCK0_RxAGC1 0xa0c //AGC default value, saturation level +#define rCCK0_RxAGC2 0xa10 //AGC & DAGC +#define rCCK0_RxHP 0xa14 +#define rCCK0_DSPParameter1 0xa18 //Timing recovery & Channel estimation threshold +#define rCCK0_DSPParameter2 0xa1c //SQ threshold +#define rCCK0_TxFilter1 0xa20 +#define rCCK0_TxFilter2 0xa24 +#define rCCK0_DebugPort 0xa28 //debug port and Tx filter3 +#define rCCK0_FalseAlarmReport 0xa2c //0xa2d +#define rCCK0_TRSSIReport 0xa50 +#define rCCK0_RxReport 0xa54 //0xa57 +#define rCCK0_FACounterLower 0xa5c //0xa5b +#define rCCK0_FACounterUpper 0xa58 //0xa5c + +//page c +#define rOFDM0_LSTF 0xc00 +#define rOFDM0_TRxPathEnable 0xc04 +#define rOFDM0_TRMuxPar 0xc08 +#define rOFDM0_TRSWIsolation 0xc0c +#define rOFDM0_XARxAFE 0xc10 //RxIQ DC offset, Rx digital filter, DC notch filter +#define rOFDM0_XARxIQImbalance 0xc14 //RxIQ imblance matrix +#define rOFDM0_XBRxAFE 0xc18 +#define rOFDM0_XBRxIQImbalance 0xc1c +#define rOFDM0_XCRxAFE 0xc20 +#define rOFDM0_XCRxIQImbalance 0xc24 +#define rOFDM0_XDRxAFE 0xc28 +#define rOFDM0_XDRxIQImbalance 0xc2c +#define rOFDM0_RxDetector1 0xc30 //PD,BW & SBD +#define rOFDM0_RxDetector2 0xc34 //SBD & Fame Sync. +#define rOFDM0_RxDetector3 0xc38 //Frame Sync. +#define rOFDM0_RxDetector4 0xc3c //PD, SBD, Frame Sync & Short-GI +#define rOFDM0_RxDSP 0xc40 //Rx Sync Path +#define rOFDM0_CFOandDAGC 0xc44 //CFO & DAGC +#define rOFDM0_CCADropThreshold 0xc48 //CCA Drop threshold +#define rOFDM0_ECCAThreshold 0xc4c // energy CCA +#define rOFDM0_XAAGCCore1 0xc50 +#define rOFDM0_XAAGCCore2 0xc54 +#define rOFDM0_XBAGCCore1 0xc58 +#define rOFDM0_XBAGCCore2 0xc5c +#define rOFDM0_XCAGCCore1 0xc60 +#define rOFDM0_XCAGCCore2 0xc64 +#define rOFDM0_XDAGCCore1 0xc68 +#define rOFDM0_XDAGCCore2 0xc6c +#define rOFDM0_AGCParameter1 0xc70 +#define rOFDM0_AGCParameter2 0xc74 +#define rOFDM0_AGCRSSITable 0xc78 +#define rOFDM0_HTSTFAGC 0xc7c +#define rOFDM0_XATxIQImbalance 0xc80 +#define rOFDM0_XATxAFE 0xc84 +#define rOFDM0_XBTxIQImbalance 0xc88 +#define rOFDM0_XBTxAFE 0xc8c +#define rOFDM0_XCTxIQImbalance 0xc90 +#define rOFDM0_XCTxAFE 0xc94 +#define rOFDM0_XDTxIQImbalance 0xc98 +#define rOFDM0_XDTxAFE 0xc9c +#define rOFDM0_RxHPParameter 0xce0 +#define rOFDM0_TxPseudoNoiseWgt 0xce4 +#define rOFDM0_FrameSync 0xcf0 +#define rOFDM0_DFSReport 0xcf4 +#define rOFDM0_TxCoeff1 0xca4 +#define rOFDM0_TxCoeff2 0xca8 +#define rOFDM0_TxCoeff3 0xcac +#define rOFDM0_TxCoeff4 0xcb0 +#define rOFDM0_TxCoeff5 0xcb4 +#define rOFDM0_TxCoeff6 0xcb8 + + +//page d +#define rOFDM1_LSTF 0xd00 +#define rOFDM1_TRxPathEnable 0xd04 +#define rOFDM1_CFO 0xd08 +#define rOFDM1_CSI1 0xd10 +#define rOFDM1_SBD 0xd14 +#define rOFDM1_CSI2 0xd18 +#define rOFDM1_CFOTracking 0xd2c +#define rOFDM1_TRxMesaure1 0xd34 +#define rOFDM1_IntfDet 0xd3c +#define rOFDM1_PseudoNoiseStateAB 0xd50 +#define rOFDM1_PseudoNoiseStateCD 0xd54 +#define rOFDM1_RxPseudoNoiseWgt 0xd58 +#define rOFDM_PHYCounter1 0xda0 //cca, parity fail +#define rOFDM_PHYCounter2 0xda4 //rate illegal, crc8 fail +#define rOFDM_PHYCounter3 0xda8 //MCS not support +#define rOFDM_ShortCFOAB 0xdac +#define rOFDM_ShortCFOCD 0xdb0 +#define rOFDM_LongCFOAB 0xdb4 +#define rOFDM_LongCFOCD 0xdb8 +#define rOFDM_TailCFOAB 0xdbc +#define rOFDM_TailCFOCD 0xdc0 +#define rOFDM_PWMeasure1 0xdc4 +#define rOFDM_PWMeasure2 0xdc8 +#define rOFDM_BWReport 0xdcc +#define rOFDM_AGCReport 0xdd0 +#define rOFDM_RxSNR 0xdd4 +#define rOFDM_RxEVMCSI 0xdd8 +#define rOFDM_SIGReport 0xddc + +//page e +#define rTxAGC_Rate18_06 0xe00 +#define rTxAGC_Rate54_24 0xe04 +#define rTxAGC_CCK_Mcs32 0xe08 +#define rTxAGC_Mcs03_Mcs00 0xe10 +#define rTxAGC_Mcs07_Mcs04 0xe14 +#define rTxAGC_Mcs11_Mcs08 0xe18 +#define rTxAGC_Mcs15_Mcs12 0xe1c + + +//RF +//Zebra1 +#define rZebra1_HSSIEnable 0x0 +#define rZebra1_TRxEnable1 0x1 +#define rZebra1_TRxEnable2 0x2 +#define rZebra1_AGC 0x4 +#define rZebra1_ChargePump 0x5 +#define rZebra1_Channel 0x7 +#define rZebra1_TxGain 0x8 +#define rZebra1_TxLPF 0x9 +#define rZebra1_RxLPF 0xb +#define rZebra1_RxHPFCorner 0xc + +//Zebra4 +#define rGlobalCtrl 0 +#define rRTL8256_TxLPF 19 +#define rRTL8256_RxLPF 11 + +//RTL8258 +#define rRTL8258_TxLPF 0x11 +#define rRTL8258_RxLPF 0x13 +#define rRTL8258_RSSILPF 0xa + +//Bit Mask +//page-1 +#define bBBResetB 0x100 +#define bGlobalResetB 0x200 +#define bOFDMTxStart 0x4 +#define bCCKTxStart 0x8 +#define bCRC32Debug 0x100 +#define bPMACLoopback 0x10 +#define bTxLSIG 0xffffff +#define bOFDMTxRate 0xf +#define bOFDMTxReserved 0x10 +#define bOFDMTxLength 0x1ffe0 +#define bOFDMTxParity 0x20000 +#define bTxHTSIG1 0xffffff +#define bTxHTMCSRate 0x7f +#define bTxHTBW 0x80 +#define bTxHTLength 0xffff00 +#define bTxHTSIG2 0xffffff +#define bTxHTSmoothing 0x1 +#define bTxHTSounding 0x2 +#define bTxHTReserved 0x4 +#define bTxHTAggreation 0x8 +#define bTxHTSTBC 0x30 +#define bTxHTAdvanceCoding 0x40 +#define bTxHTShortGI 0x80 +#define bTxHTNumberHT_LTF 0x300 +#define bTxHTCRC8 0x3fc00 +#define bCounterReset 0x10000 +#define bNumOfOFDMTx 0xffff +#define bNumOfCCKTx 0xffff0000 +#define bTxIdleInterval 0xffff +#define bOFDMService 0xffff0000 +#define bTxMACHeader 0xffffffff +#define bTxDataInit 0xff +#define bTxHTMode 0x100 +#define bTxDataType 0x30000 +#define bTxRandomSeed 0xffffffff +#define bCCKTxPreamble 0x1 +#define bCCKTxSFD 0xffff0000 +#define bCCKTxSIG 0xff +#define bCCKTxService 0xff00 +#define bCCKLengthExt 0x8000 +#define bCCKTxLength 0xffff0000 +#define bCCKTxCRC16 0xffff +#define bCCKTxStatus 0x1 +#define bOFDMTxStatus 0x2 + +//page-8 +#define bRFMOD 0x1 +#define bJapanMode 0x2 +#define bCCKTxSC 0x30 +#define bCCKEn 0x1000000 +#define bOFDMEn 0x2000000 +#define bOFDMRxADCPhase 0x10000 +#define bOFDMTxDACPhase 0x40000 +#define bXATxAGC 0x3f +#define bXBTxAGC 0xf00 +#define bXCTxAGC 0xf000 +#define bXDTxAGC 0xf0000 +#define bPAStart 0xf0000000 +#define bTRStart 0x00f00000 +#define bRFStart 0x0000f000 +#define bBBStart 0x000000f0 +#define bBBCCKStart 0x0000000f +#define bPAEnd 0xf //Reg0x814 +#define bTREnd 0x0f000000 +#define bRFEnd 0x000f0000 +#define bCCAMask 0x000000f0 //T2R +#define bR2RCCAMask 0x00000f00 +#define bHSSI_R2TDelay 0xf8000000 +#define bHSSI_T2RDelay 0xf80000 +#define bContTxHSSI 0x400 //chane gain at continue Tx +#define bIGFromCCK 0x200 +#define bAGCAddress 0x3f +#define bRxHPTx 0x7000 +#define bRxHPT2R 0x38000 +#define bRxHPCCKIni 0xc0000 +#define bAGCTxCode 0xc00000 +#define bAGCRxCode 0x300000 +#define b3WireDataLength 0x800 +#define b3WireAddressLength 0x400 +#define b3WireRFPowerDown 0x1 +//#define bHWSISelect 0x8 +#define b5GPAPEPolarity 0x40000000 +#define b2GPAPEPolarity 0x80000000 +#define bRFSW_TxDefaultAnt 0x3 +#define bRFSW_TxOptionAnt 0x30 +#define bRFSW_RxDefaultAnt 0x300 +#define bRFSW_RxOptionAnt 0x3000 +#define bRFSI_3WireData 0x1 +#define bRFSI_3WireClock 0x2 +#define bRFSI_3WireLoad 0x4 +#define bRFSI_3WireRW 0x8 +#define bRFSI_3Wire 0xf //3-wire total control +#define bRFSI_RFENV 0x10 +#define bRFSI_TRSW 0x20 +#define bRFSI_TRSWB 0x40 +#define bRFSI_ANTSW 0x100 +#define bRFSI_ANTSWB 0x200 +#define bRFSI_PAPE 0x400 +#define bRFSI_PAPE5G 0x800 +#define bBandSelect 0x1 +#define bHTSIG2_GI 0x80 +#define bHTSIG2_Smoothing 0x01 +#define bHTSIG2_Sounding 0x02 +#define bHTSIG2_Aggreaton 0x08 +#define bHTSIG2_STBC 0x30 +#define bHTSIG2_AdvCoding 0x40 +#define bHTSIG2_NumOfHTLTF 0x300 +#define bHTSIG2_CRC8 0x3fc +#define bHTSIG1_MCS 0x7f +#define bHTSIG1_BandWidth 0x80 +#define bHTSIG1_HTLength 0xffff +#define bLSIG_Rate 0xf +#define bLSIG_Reserved 0x10 +#define bLSIG_Length 0x1fffe +#define bLSIG_Parity 0x20 +#define bCCKRxPhase 0x4 +#define bLSSIReadAddress 0x3f000000 //LSSI "Read" Address +#define bLSSIReadEdge 0x80000000 //LSSI "Read" edge signal +#define bLSSIReadBackData 0xfff +#define bLSSIReadOKFlag 0x1000 +#define bCCKSampleRate 0x8 //0: 44MHz, 1:88MHz + +#define bRegulator0Standby 0x1 +#define bRegulatorPLLStandby 0x2 +#define bRegulator1Standby 0x4 +#define bPLLPowerUp 0x8 +#define bDPLLPowerUp 0x10 +#define bDA10PowerUp 0x20 +#define bAD7PowerUp 0x200 +#define bDA6PowerUp 0x2000 +#define bXtalPowerUp 0x4000 +#define b40MDClkPowerUP 0x8000 +#define bDA6DebugMode 0x20000 +#define bDA6Swing 0x380000 +#define bADClkPhase 0x4000000 +#define b80MClkDelay 0x18000000 +#define bAFEWatchDogEnable 0x20000000 +#define bXtalCap 0x0f000000 +#define bIntDifClkEnable 0x400 +#define bExtSigClkEnable 0x800 +#define bBandgapMbiasPowerUp 0x10000 +#define bAD11SHGain 0xc0000 +#define bAD11InputRange 0x700000 +#define bAD11OPCurrent 0x3800000 +#define bIPathLoopback 0x4000000 +#define bQPathLoopback 0x8000000 +#define bAFELoopback 0x10000000 +#define bDA10Swing 0x7e0 +#define bDA10Reverse 0x800 +#define bDAClkSource 0x1000 +#define bAD7InputRange 0x6000 +#define bAD7Gain 0x38000 +#define bAD7OutputCMMode 0x40000 +#define bAD7InputCMMode 0x380000 +#define bAD7Current 0xc00000 +#define bRegulatorAdjust 0x7000000 +#define bAD11PowerUpAtTx 0x1 +#define bDA10PSAtTx 0x10 +#define bAD11PowerUpAtRx 0x100 +#define bDA10PSAtRx 0x1000 + +#define bCCKRxAGCFormat 0x200 + +#define bPSDFFTSamplepPoint 0xc000 +#define bPSDAverageNum 0x3000 +#define bIQPathControl 0xc00 +#define bPSDFreq 0x3ff +#define bPSDAntennaPath 0x30 +#define bPSDIQSwitch 0x40 +#define bPSDRxTrigger 0x400000 +#define bPSDTxTrigger 0x80000000 +#define bPSDSineToneScale 0x7f000000 +#define bPSDReport 0xffff + +//page-9 +#define bOFDMTxSC 0x30000000 +#define bCCKTxOn 0x1 +#define bOFDMTxOn 0x2 +#define bDebugPage 0xfff //reset debug page and also HWord, LWord +#define bDebugItem 0xff //reset debug page and LWord +#define bAntL 0x10 +#define bAntNonHT 0x100 +#define bAntHT1 0x1000 +#define bAntHT2 0x10000 +#define bAntHT1S1 0x100000 +#define bAntNonHTS1 0x1000000 + +//page-a +#define bCCKBBMode 0x3 +#define bCCKTxPowerSaving 0x80 +#define bCCKRxPowerSaving 0x40 +#define bCCKSideBand 0x10 +#define bCCKScramble 0x8 +#define bCCKAntDiversity 0x8000 +#define bCCKCarrierRecovery 0x4000 +#define bCCKTxRate 0x3000 +#define bCCKDCCancel 0x0800 +#define bCCKISICancel 0x0400 +#define bCCKMatchFilter 0x0200 +#define bCCKEqualizer 0x0100 +#define bCCKPreambleDetect 0x800000 +#define bCCKFastFalseCCA 0x400000 +#define bCCKChEstStart 0x300000 +#define bCCKCCACount 0x080000 +#define bCCKcs_lim 0x070000 +#define bCCKBistMode 0x80000000 +#define bCCKCCAMask 0x40000000 +#define bCCKTxDACPhase 0x4 +#define bCCKRxADCPhase 0x20000000 //r_rx_clk +#define bCCKr_cp_mode0 0x0100 +#define bCCKTxDCOffset 0xf0 +#define bCCKRxDCOffset 0xf +#define bCCKCCAMode 0xc000 +#define bCCKFalseCS_lim 0x3f00 +#define bCCKCS_ratio 0xc00000 +#define bCCKCorgBit_sel 0x300000 +#define bCCKPD_lim 0x0f0000 +#define bCCKNewCCA 0x80000000 +#define bCCKRxHPofIG 0x8000 +#define bCCKRxIG 0x7f00 +#define bCCKLNAPolarity 0x800000 +#define bCCKRx1stGain 0x7f0000 +#define bCCKRFExtend 0x20000000 //CCK Rx Iinital gain polarity +#define bCCKRxAGCSatLevel 0x1f000000 +#define bCCKRxAGCSatCount 0xe0 +#define bCCKRxRFSettle 0x1f //AGCsamp_dly +#define bCCKFixedRxAGC 0x8000 +//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824 +#define bCCKAntennaPolarity 0x2000 +#define bCCKTxFilterType 0x0c00 +#define bCCKRxAGCReportType 0x0300 +#define bCCKRxDAGCEn 0x80000000 +#define bCCKRxDAGCPeriod 0x20000000 +#define bCCKRxDAGCSatLevel 0x1f000000 +#define bCCKTimingRecovery 0x800000 +#define bCCKTxC0 0x3f0000 +#define bCCKTxC1 0x3f000000 +#define bCCKTxC2 0x3f +#define bCCKTxC3 0x3f00 +#define bCCKTxC4 0x3f0000 +#define bCCKTxC5 0x3f000000 +#define bCCKTxC6 0x3f +#define bCCKTxC7 0x3f00 +#define bCCKDebugPort 0xff0000 +#define bCCKDACDebug 0x0f000000 +#define bCCKFalseAlarmEnable 0x8000 +#define bCCKFalseAlarmRead 0x4000 +#define bCCKTRSSI 0x7f +#define bCCKRxAGCReport 0xfe +#define bCCKRxReport_AntSel 0x80000000 +#define bCCKRxReport_MFOff 0x40000000 +#define bCCKRxRxReport_SQLoss 0x20000000 +#define bCCKRxReport_Pktloss 0x10000000 +#define bCCKRxReport_Lockedbit 0x08000000 +#define bCCKRxReport_RateError 0x04000000 +#define bCCKRxReport_RxRate 0x03000000 +#define bCCKRxFACounterLower 0xff +#define bCCKRxFACounterUpper 0xff000000 +#define bCCKRxHPAGCStart 0xe000 +#define bCCKRxHPAGCFinal 0x1c00 + +#define bCCKRxFalseAlarmEnable 0x8000 +#define bCCKFACounterFreeze 0x4000 + +#define bCCKTxPathSel 0x10000000 +#define bCCKDefaultRxPath 0xc000000 +#define bCCKOptionRxPath 0x3000000 + +//page c +#define bNumOfSTF 0x3 +#define bShift_L 0xc0 +#define bGI_TH 0xc +#define bRxPathA 0x1 +#define bRxPathB 0x2 +#define bRxPathC 0x4 +#define bRxPathD 0x8 +#define bTxPathA 0x1 +#define bTxPathB 0x2 +#define bTxPathC 0x4 +#define bTxPathD 0x8 +#define bTRSSIFreq 0x200 +#define bADCBackoff 0x3000 +#define bDFIRBackoff 0xc000 +#define bTRSSILatchPhase 0x10000 +#define bRxIDCOffset 0xff +#define bRxQDCOffset 0xff00 +#define bRxDFIRMode 0x1800000 +#define bRxDCNFType 0xe000000 +#define bRXIQImb_A 0x3ff +#define bRXIQImb_B 0xfc00 +#define bRXIQImb_C 0x3f0000 +#define bRXIQImb_D 0xffc00000 +#define bDC_dc_Notch 0x60000 +#define bRxNBINotch 0x1f000000 +#define bPD_TH 0xf +#define bPD_TH_Opt2 0xc000 +#define bPWED_TH 0x700 +#define bIfMF_Win_L 0x800 +#define bPD_Option 0x1000 +#define bMF_Win_L 0xe000 +#define bBW_Search_L 0x30000 +#define bwin_enh_L 0xc0000 +#define bBW_TH 0x700000 +#define bED_TH2 0x3800000 +#define bBW_option 0x4000000 +#define bRatio_TH 0x18000000 +#define bWindow_L 0xe0000000 +#define bSBD_Option 0x1 +#define bFrame_TH 0x1c +#define bFS_Option 0x60 +#define bDC_Slope_check 0x80 +#define bFGuard_Counter_DC_L 0xe00 +#define bFrame_Weight_Short 0x7000 +#define bSub_Tune 0xe00000 +#define bFrame_DC_Length 0xe000000 +#define bSBD_start_offset 0x30000000 +#define bFrame_TH_2 0x7 +#define bFrame_GI2_TH 0x38 +#define bGI2_Sync_en 0x40 +#define bSarch_Short_Early 0x300 +#define bSarch_Short_Late 0xc00 +#define bSarch_GI2_Late 0x70000 +#define bCFOAntSum 0x1 +#define bCFOAcc 0x2 +#define bCFOStartOffset 0xc +#define bCFOLookBack 0x70 +#define bCFOSumWeight 0x80 +#define bDAGCEnable 0x10000 +#define bTXIQImb_A 0x3ff +#define bTXIQImb_B 0xfc00 +#define bTXIQImb_C 0x3f0000 +#define bTXIQImb_D 0xffc00000 +#define bTxIDCOffset 0xff +#define bTxQDCOffset 0xff00 +#define bTxDFIRMode 0x10000 +#define bTxPesudoNoiseOn 0x4000000 +#define bTxPesudoNoise_A 0xff +#define bTxPesudoNoise_B 0xff00 +#define bTxPesudoNoise_C 0xff0000 +#define bTxPesudoNoise_D 0xff000000 +#define bCCADropOption 0x20000 +#define bCCADropThres 0xfff00000 +#define bEDCCA_H 0xf +#define bEDCCA_L 0xf0 +#define bLambda_ED 0x300 +#define bRxInitialGain 0x7f +#define bRxAntDivEn 0x80 +#define bRxAGCAddressForLNA 0x7f00 +#define bRxHighPowerFlow 0x8000 +#define bRxAGCFreezeThres 0xc0000 +#define bRxFreezeStep_AGC1 0x300000 +#define bRxFreezeStep_AGC2 0xc00000 +#define bRxFreezeStep_AGC3 0x3000000 +#define bRxFreezeStep_AGC0 0xc000000 +#define bRxRssi_Cmp_En 0x10000000 +#define bRxQuickAGCEn 0x20000000 +#define bRxAGCFreezeThresMode 0x40000000 +#define bRxOverFlowCheckType 0x80000000 +#define bRxAGCShift 0x7f +#define bTRSW_Tri_Only 0x80 +#define bPowerThres 0x300 +#define bRxAGCEn 0x1 +#define bRxAGCTogetherEn 0x2 +#define bRxAGCMin 0x4 +#define bRxHP_Ini 0x7 +#define bRxHP_TRLNA 0x70 +#define bRxHP_RSSI 0x700 +#define bRxHP_BBP1 0x7000 +#define bRxHP_BBP2 0x70000 +#define bRxHP_BBP3 0x700000 +#define bRSSI_H 0x7f0000 //the threshold for high power +#define bRSSI_Gen 0x7f000000 //the threshold for ant diversity +#define bRxSettle_TRSW 0x7 +#define bRxSettle_LNA 0x38 +#define bRxSettle_RSSI 0x1c0 +#define bRxSettle_BBP 0xe00 +#define bRxSettle_RxHP 0x7000 +#define bRxSettle_AntSW_RSSI 0x38000 +#define bRxSettle_AntSW 0xc0000 +#define bRxProcessTime_DAGC 0x300000 +#define bRxSettle_HSSI 0x400000 +#define bRxProcessTime_BBPPW 0x800000 +#define bRxAntennaPowerShift 0x3000000 +#define bRSSITableSelect 0xc000000 +#define bRxHP_Final 0x7000000 +#define bRxHTSettle_BBP 0x7 +#define bRxHTSettle_HSSI 0x8 +#define bRxHTSettle_RxHP 0x70 +#define bRxHTSettle_BBPPW 0x80 +#define bRxHTSettle_Idle 0x300 +#define bRxHTSettle_Reserved 0x1c00 +#define bRxHTRxHPEn 0x8000 +#define bRxHTAGCFreezeThres 0x30000 +#define bRxHTAGCTogetherEn 0x40000 +#define bRxHTAGCMin 0x80000 +#define bRxHTAGCEn 0x100000 +#define bRxHTDAGCEn 0x200000 +#define bRxHTRxHP_BBP 0x1c00000 +#define bRxHTRxHP_Final 0xe0000000 +#define bRxPWRatioTH 0x3 +#define bRxPWRatioEn 0x4 +#define bRxMFHold 0x3800 +#define bRxPD_Delay_TH1 0x38 +#define bRxPD_Delay_TH2 0x1c0 +#define bRxPD_DC_COUNT_MAX 0x600 +//#define bRxMF_Hold 0x3800 +#define bRxPD_Delay_TH 0x8000 +#define bRxProcess_Delay 0xf0000 +#define bRxSearchrange_GI2_Early 0x700000 +#define bRxFrame_Guard_Counter_L 0x3800000 +#define bRxSGI_Guard_L 0xc000000 +#define bRxSGI_Search_L 0x30000000 +#define bRxSGI_TH 0xc0000000 +#define bDFSCnt0 0xff +#define bDFSCnt1 0xff00 +#define bDFSFlag 0xf0000 + +#define bMFWeightSum 0x300000 +#define bMinIdxTH 0x7f000000 + +#define bDAFormat 0x40000 + +#define bTxChEmuEnable 0x01000000 + +#define bTRSWIsolation_A 0x7f +#define bTRSWIsolation_B 0x7f00 +#define bTRSWIsolation_C 0x7f0000 +#define bTRSWIsolation_D 0x7f000000 + +#define bExtLNAGain 0x7c00 + +//page d +#define bSTBCEn 0x4 +#define bAntennaMapping 0x10 +#define bNss 0x20 +#define bCFOAntSumD 0x200 +#define bPHYCounterReset 0x8000000 +#define bCFOReportGet 0x4000000 +#define bOFDMContinueTx 0x10000000 +#define bOFDMSingleCarrier 0x20000000 +#define bOFDMSingleTone 0x40000000 +//#define bRxPath1 0x01 +//#define bRxPath2 0x02 +//#define bRxPath3 0x04 +//#define bRxPath4 0x08 +//#define bTxPath1 0x10 +//#define bTxPath2 0x20 +#define bHTDetect 0x100 +#define bCFOEn 0x10000 +#define bCFOValue 0xfff00000 +#define bSigTone_Re 0x3f +#define bSigTone_Im 0x7f00 +#define bCounter_CCA 0xffff +#define bCounter_ParityFail 0xffff0000 +#define bCounter_RateIllegal 0xffff +#define bCounter_CRC8Fail 0xffff0000 +#define bCounter_MCSNoSupport 0xffff +#define bCounter_FastSync 0xffff +#define bShortCFO 0xfff +#define bShortCFOTLength 12 //total +#define bShortCFOFLength 11 //fraction +#define bLongCFO 0x7ff +#define bLongCFOTLength 11 +#define bLongCFOFLength 11 +#define bTailCFO 0x1fff +#define bTailCFOTLength 13 +#define bTailCFOFLength 12 + +#define bmax_en_pwdB 0xffff +#define bCC_power_dB 0xffff0000 +#define bnoise_pwdB 0xffff +#define bPowerMeasTLength 10 +#define bPowerMeasFLength 3 +#define bRx_HT_BW 0x1 +#define bRxSC 0x6 +#define bRx_HT 0x8 + +#define bNB_intf_det_on 0x1 +#define bIntf_win_len_cfg 0x30 +#define bNB_Intf_TH_cfg 0x1c0 + +#define bRFGain 0x3f +#define bTableSel 0x40 +#define bTRSW 0x80 + +#define bRxSNR_A 0xff +#define bRxSNR_B 0xff00 +#define bRxSNR_C 0xff0000 +#define bRxSNR_D 0xff000000 +#define bSNREVMTLength 8 +#define bSNREVMFLength 1 + +#define bCSI1st 0xff +#define bCSI2nd 0xff00 +#define bRxEVM1st 0xff0000 +#define bRxEVM2nd 0xff000000 + +#define bSIGEVM 0xff +#define bPWDB 0xff00 +#define bSGIEN 0x10000 + +#define bSFactorQAM1 0xf +#define bSFactorQAM2 0xf0 +#define bSFactorQAM3 0xf00 +#define bSFactorQAM4 0xf000 +#define bSFactorQAM5 0xf0000 +#define bSFactorQAM6 0xf0000 +#define bSFactorQAM7 0xf00000 +#define bSFactorQAM8 0xf000000 +#define bSFactorQAM9 0xf0000000 +#define bCSIScheme 0x100000 + +#define bNoiseLvlTopSet 0x3 +#define bChSmooth 0x4 +#define bChSmoothCfg1 0x38 +#define bChSmoothCfg2 0x1c0 +#define bChSmoothCfg3 0xe00 +#define bChSmoothCfg4 0x7000 +#define bMRCMode 0x800000 +#define bTHEVMCfg 0x7000000 + +#define bLoopFitType 0x1 +#define bUpdCFO 0x40 +#define bUpdCFOOffData 0x80 +#define bAdvUpdCFO 0x100 +#define bAdvTimeCtrl 0x800 +#define bUpdClko 0x1000 +#define bFC 0x6000 +#define bTrackingMode 0x8000 +#define bPhCmpEnable 0x10000 +#define bUpdClkoLTF 0x20000 +#define bComChCFO 0x40000 +#define bCSIEstiMode 0x80000 +#define bAdvUpdEqz 0x100000 +#define bUChCfg 0x7000000 +#define bUpdEqz 0x8000000 + +//page e +#define bTxAGCRate18_06 0x7f7f7f7f +#define bTxAGCRate54_24 0x7f7f7f7f +#define bTxAGCRateMCS32 0x7f +#define bTxAGCRateCCK 0x7f00 +#define bTxAGCRateMCS3_MCS0 0x7f7f7f7f +#define bTxAGCRateMCS7_MCS4 0x7f7f7f7f +#define bTxAGCRateMCS11_MCS8 0x7f7f7f7f +#define bTxAGCRateMCS15_MCS12 0x7f7f7f7f + + +//Rx Pseduo noise +#define bRxPesudoNoiseOn 0x20000000 +#define bRxPesudoNoise_A 0xff +#define bRxPesudoNoise_B 0xff00 +#define bRxPesudoNoise_C 0xff0000 +#define bRxPesudoNoise_D 0xff000000 +#define bPesudoNoiseState_A 0xffff +#define bPesudoNoiseState_B 0xffff0000 +#define bPesudoNoiseState_C 0xffff +#define bPesudoNoiseState_D 0xffff0000 + +//RF +//Zebra1 +#define bZebra1_HSSIEnable 0x8 +#define bZebra1_TRxControl 0xc00 +#define bZebra1_TRxGainSetting 0x07f +#define bZebra1_RxCorner 0xc00 +#define bZebra1_TxChargePump 0x38 +#define bZebra1_RxChargePump 0x7 +#define bZebra1_ChannelNum 0xf80 +#define bZebra1_TxLPFBW 0x400 +#define bZebra1_RxLPFBW 0x600 + +//Zebra4 +#define bRTL8256RegModeCtrl1 0x100 +#define bRTL8256RegModeCtrl0 0x40 +#define bRTL8256_TxLPFBW 0x18 +#define bRTL8256_RxLPFBW 0x600 + +//RTL8258 +#define bRTL8258_TxLPFBW 0xc +#define bRTL8258_RxLPFBW 0xc00 +#define bRTL8258_RSSILPFBW 0xc0 + +//byte endable for sb_write +#define bByte0 0x1 +#define bByte1 0x2 +#define bByte2 0x4 +#define bByte3 0x8 +#define bWord0 0x3 +#define bWord1 0xc +#define bDWord 0xf + +//for PutRegsetting & GetRegSetting BitMask +#define bMaskByte0 0xff +#define bMaskByte1 0xff00 +#define bMaskByte2 0xff0000 +#define bMaskByte3 0xff000000 +#define bMaskHWord 0xffff0000 +#define bMaskLWord 0x0000ffff +#define bMaskDWord 0xffffffff + +//for PutRFRegsetting & GetRFRegSetting BitMask +#define bMask12Bits 0xfff + +#define bEnable 0x1 +#define bDisable 0x0 + +#define LeftAntenna 0x0 +#define RightAntenna 0x1 + +#define tCheckTxStatus 500 //500ms +#define tUpdateRxCounter 100 //100ms + +#define rateCCK 0 +#define rateOFDM 1 +#define rateHT 2 + +//define Register-End +#define bPMAC_End 0x1ff +#define bFPGAPHY0_End 0x8ff +#define bFPGAPHY1_End 0x9ff +#define bCCKPHY0_End 0xaff +#define bOFDMPHY0_End 0xcff +#define bOFDMPHY1_End 0xdff + +//define max debug item in each debug page +//#define bMaxItem_FPGA_PHY0 0x9 +//#define bMaxItem_FPGA_PHY1 0x3 +//#define bMaxItem_PHY_11B 0x16 +//#define bMaxItem_OFDM_PHY0 0x29 +//#define bMaxItem_OFDM_PHY1 0x0 + +#define bPMACControl 0x0 +#define bWMACControl 0x1 +#define bWNICControl 0x2 + +#define PathA 0x0 +#define PathB 0x1 +#define PathC 0x2 +#define PathD 0x3 + +#define rRTL8256RxMixerPole 0xb +#define bZebraRxMixerPole 0x6 +#define rRTL8256TxBBOPBias 0x9 +#define bRTL8256TxBBOPBias 0x400 +#define rRTL8256TxBBBW 19 +#define bRTL8256TxBBBW 0x18 + +#endif //__INC_HAL8190PCIPHYREG_H -- GitLab From f61fb9356d20977258bb59a8d9f1857d2c58ac98 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 3 Nov 2009 07:17:24 -0200 Subject: [PATCH 223/235] Staging: rtl8192u: make it compile Add it to staging Kbuild and fixes some API differences that prevents compilation. It seems that the ieee80211 stack is very close to rtl8192su one. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/rtl8192u/Makefile | 1 + drivers/staging/rtl8192u/ieee80211.h | 6 +- .../rtl8192u/ieee80211/ieee80211_crypt.c | 35 +-- .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 62 +--- .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 272 +----------------- .../rtl8192u/ieee80211/ieee80211_crypt_wep.c | 114 +------- .../rtl8192u/ieee80211/ieee80211_module.c | 82 +----- drivers/staging/rtl8192u/r8192U_core.c | 110 ++++--- 10 files changed, 109 insertions(+), 576 deletions(-) diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 5dccf6bfb0f9..6fbbedbc7fe7 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -77,6 +77,8 @@ source "drivers/staging/rtl8187se/Kconfig" source "drivers/staging/rtl8192su/Kconfig" +source "drivers/staging/rtl8192u/Kconfig" + source "drivers/staging/rtl8192e/Kconfig" source "drivers/staging/mimio/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 2f228f99be93..61a81c148c9f 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -21,6 +21,7 @@ obj-$(CONFIG_PANEL) += panel/ obj-$(CONFIG_ALTERA_PCIE_CHDMA) += altpciechdma/ obj-$(CONFIG_R8187SE) += rtl8187se/ obj-$(CONFIG_RTL8192SU) += rtl8192su/ +obj-$(CONFIG_RTL8192U) += rtl8192u/ obj-$(CONFIG_RTL8192E) += rtl8192e/ obj-$(CONFIG_INPUT_MIMIO) += mimio/ obj-$(CONFIG_TRANZPORT) += frontier/ diff --git a/drivers/staging/rtl8192u/Makefile b/drivers/staging/rtl8192u/Makefile index 99236903a9d5..2d59c4ef6c5b 100644 --- a/drivers/staging/rtl8192u/Makefile +++ b/drivers/staging/rtl8192u/Makefile @@ -10,6 +10,7 @@ EXTRA_CFLAGS += -DTHOMAS_BEACON -DTHOMAS_TASKLET -DTHOMAS_SKB -DTHOMAS_TURBO #EXTRA_CFLAGS += -DUSB_RX_AGGREGATION_SUPPORT EXTRA_CFLAGS += -DUSE_ONE_PIPE EXTRA_CFLAGS += -DENABLE_DOT11D +EXTRA_CFLAGS += -Idrivers/staging/rtl8192u/ieee80211 r8192u_usb-objs := r8192U_core.o r8180_93cx6.o r8192U_wx.o \ r8190_rtl8256.o r819xU_phy.o r819xU_firmware.o \ diff --git a/drivers/staging/rtl8192u/ieee80211.h b/drivers/staging/rtl8192u/ieee80211.h index c182e91b73c0..690d41c8cb62 100644 --- a/drivers/staging/rtl8192u/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211.h @@ -39,9 +39,9 @@ #include #include -#include "../../ieee80211/rtl819x_HT.h" -#include "../../ieee80211/rtl819x_BA.h" -#include "../../ieee80211/rtl819x_TS.h" +#include "ieee80211/rtl819x_HT.h" +#include "ieee80211/rtl819x_BA.h" +#include "ieee80211/rtl819x_TS.h" #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) #ifndef bool diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c index 199ee1695ad3..521e7b989934 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c @@ -53,14 +53,8 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, list_del(ptr); - if (entry->ops) { + if (entry->ops) entry->ops->deinit(entry->priv); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) - module_put(entry->ops->owner); -#else - __MOD_DEC_USE_COUNT(entry->ops->owner); -#endif - } kfree(entry); } } @@ -208,8 +202,7 @@ static struct ieee80211_crypto_ops ieee80211_crypt_null = { .owner = THIS_MODULE, }; - -static int __init ieee80211_crypto_init(void) +int __init ieee80211_crypto_init(void) { int ret = -ENOMEM; @@ -230,8 +223,7 @@ out: return ret; } - -static void __exit ieee80211_crypto_deinit(void) +void __exit ieee80211_crypto_deinit(void) { struct list_head *ptr, *n; @@ -250,24 +242,3 @@ static void __exit ieee80211_crypto_deinit(void) kfree(hcrypt); } - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -EXPORT_SYMBOL(ieee80211_crypt_deinit_entries); -EXPORT_SYMBOL(ieee80211_crypt_deinit_handler); -EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit); - -EXPORT_SYMBOL(ieee80211_register_crypto_ops); -EXPORT_SYMBOL(ieee80211_unregister_crypto_ops); -EXPORT_SYMBOL(ieee80211_get_crypto_ops); -#else -EXPORT_SYMBOL_NOVERS(ieee80211_crypt_deinit_entries); -EXPORT_SYMBOL_NOVERS(ieee80211_crypt_deinit_handler); -EXPORT_SYMBOL_NOVERS(ieee80211_crypt_delayed_deinit); - -EXPORT_SYMBOL_NOVERS(ieee80211_register_crypto_ops); -EXPORT_SYMBOL_NOVERS(ieee80211_unregister_crypto_ops); -EXPORT_SYMBOL_NOVERS(ieee80211_get_crypto_ops); -#endif - -module_init(ieee80211_crypto_init); -module_exit(ieee80211_crypto_deinit); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c index a86c26eceb34..181edc46909e 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c @@ -24,27 +24,13 @@ #include "ieee80211.h" -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -#include "rtl_crypto.h" -#else #include -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - #include -#else #include -#endif -//#include MODULE_AUTHOR("Jouni Malinen"); MODULE_DESCRIPTION("Host AP crypt: CCMP"); MODULE_LICENSE("GPL"); -#ifndef OPENSUSE_SLED -#define OPENSUSE_SLED 0 -#endif - #define AES_BLOCK_LEN 16 #define CCMP_HDR_LEN 8 #define CCMP_MIC_LEN 8 @@ -75,21 +61,7 @@ struct ieee80211_ccmp_data { void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm, const u8 pt[16], u8 ct[16]) { -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) - struct scatterlist src, dst; - - src.page = virt_to_page(pt); - src.offset = offset_in_page(pt); - src.length = AES_BLOCK_LEN; - - dst.page = virt_to_page(ct); - dst.offset = offset_in_page(ct); - dst.length = AES_BLOCK_LEN; - - crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN); -#else crypto_cipher_encrypt_one((void*)tfm, ct, pt); -#endif } static void * ieee80211_ccmp_init(int key_idx) @@ -102,14 +74,6 @@ static void * ieee80211_ccmp_init(int key_idx) memset(priv, 0, sizeof(*priv)); priv->key_idx = key_idx; -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) - priv->tfm = crypto_alloc_tfm("aes", 0); - if (priv->tfm == NULL) { - printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate " - "crypto API aes\n"); - goto fail; - } - #else priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tfm)) { printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate " @@ -117,17 +81,13 @@ static void * ieee80211_ccmp_init(int key_idx) priv->tfm = NULL; goto fail; } - #endif + return priv; fail: if (priv) { if (priv->tfm) - #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) - crypto_free_tfm(priv->tfm); - #else crypto_free_cipher((void*)priv->tfm); - #endif kfree(priv); } @@ -138,12 +98,9 @@ fail: static void ieee80211_ccmp_deinit(void *priv) { struct ieee80211_ccmp_data *_priv = priv; + if (_priv && _priv->tfm) -#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) - crypto_free_tfm(_priv->tfm); -#else crypto_free_cipher((void*)_priv->tfm); -#endif kfree(priv); } @@ -512,23 +469,12 @@ static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { .owner = THIS_MODULE, }; - -static int __init ieee80211_crypto_ccmp_init(void) +int __init ieee80211_crypto_ccmp_init(void) { return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp); } - -static void __exit ieee80211_crypto_ccmp_exit(void) +void __exit ieee80211_crypto_ccmp_exit(void) { ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp); } - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -EXPORT_SYMBOL(ieee80211_ccmp_null); -#else -EXPORT_SYMBOL_NOVERS(ieee80211_ccmp_null); -#endif - -module_init(ieee80211_crypto_ccmp_init); -module_exit(ieee80211_crypto_ccmp_exit); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c index b031b6495247..58af7c83449b 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c @@ -22,33 +22,15 @@ #include #include "ieee80211.h" -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)) -//#include "crypto_compat.h" -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -#include "rtl_crypto.h" -#else #include -#endif -//#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - #include -#else #include -#endif - #include MODULE_AUTHOR("Jouni Malinen"); MODULE_DESCRIPTION("Host AP crypt: TKIP"); MODULE_LICENSE("GPL"); -#ifndef OPENSUSE_SLED -#define OPENSUSE_SLED 0 -#endif - struct ieee80211_tkip_data { #define TKIP_KEY_LEN 32 u8 key[TKIP_KEY_LEN]; @@ -71,17 +53,12 @@ struct ieee80211_tkip_data { u32 dot11RSNAStatsTKIPLocalMICFailures; int key_idx; -#if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) + struct crypto_blkcipher *rx_tfm_arc4; struct crypto_hash *rx_tfm_michael; struct crypto_blkcipher *tx_tfm_arc4; struct crypto_hash *tx_tfm_michael; -#else - struct crypto_tfm *tx_tfm_arc4; - struct crypto_tfm *tx_tfm_michael; - struct crypto_tfm *rx_tfm_arc4; - struct crypto_tfm *rx_tfm_michael; -#endif + /* scratch buffers for virt_to_page() (crypto API) */ u8 rx_hdr[16], tx_hdr[16]; }; @@ -95,35 +72,7 @@ static void * ieee80211_tkip_init(int key_idx) goto fail; memset(priv, 0, sizeof(*priv)); priv->key_idx = key_idx; -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) - priv->tx_tfm_arc4 = crypto_alloc_tfm("arc4", 0); - if (priv->tx_tfm_arc4 == NULL) { - printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " - "crypto API arc4\n"); - goto fail; - } - - priv->tx_tfm_michael = crypto_alloc_tfm("michael_mic", 0); - if (priv->tx_tfm_michael == NULL) { - printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " - "crypto API michael_mic\n"); - goto fail; - } - - priv->rx_tfm_arc4 = crypto_alloc_tfm("arc4", 0); - if (priv->rx_tfm_arc4 == NULL) { - printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " - "crypto API arc4\n"); - goto fail; - } - priv->rx_tfm_michael = crypto_alloc_tfm("michael_mic", 0); - if (priv->rx_tfm_michael == NULL) { - printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " - "crypto API michael_mic\n"); - goto fail; - } -#else priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tx_tfm_arc4)) { @@ -159,22 +108,11 @@ static void * ieee80211_tkip_init(int key_idx) priv->rx_tfm_michael = NULL; goto fail; } -#endif + return priv; fail: if (priv) { -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) - if (priv->tx_tfm_michael) - crypto_free_tfm(priv->tx_tfm_michael); - if (priv->tx_tfm_arc4) - crypto_free_tfm(priv->tx_tfm_arc4); - if (priv->rx_tfm_michael) - crypto_free_tfm(priv->rx_tfm_michael); - if (priv->rx_tfm_arc4) - crypto_free_tfm(priv->rx_tfm_arc4); - -#else if (priv->tx_tfm_michael) crypto_free_hash(priv->tx_tfm_michael); if (priv->tx_tfm_arc4) @@ -183,7 +121,6 @@ fail: crypto_free_hash(priv->rx_tfm_michael); if (priv->rx_tfm_arc4) crypto_free_blkcipher(priv->rx_tfm_arc4); -#endif kfree(priv); } @@ -194,16 +131,7 @@ fail: static void ieee80211_tkip_deinit(void *priv) { struct ieee80211_tkip_data *_priv = priv; -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) - if (_priv->tx_tfm_michael) - crypto_free_tfm(_priv->tx_tfm_michael); - if (_priv->tx_tfm_arc4) - crypto_free_tfm(_priv->tx_tfm_arc4); - if (_priv->rx_tfm_michael) - crypto_free_tfm(_priv->rx_tfm_michael); - if (_priv->rx_tfm_arc4) - crypto_free_tfm(_priv->rx_tfm_arc4); -#else + if (_priv) { if (_priv->tx_tfm_michael) crypto_free_hash(_priv->tx_tfm_michael); @@ -214,7 +142,6 @@ static void ieee80211_tkip_deinit(void *priv) if (_priv->rx_tfm_arc4) crypto_free_blkcipher(_priv->rx_tfm_arc4); } -#endif kfree(priv); } @@ -384,11 +311,8 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) u8 *pos; struct ieee80211_hdr_4addr *hdr; cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); - - #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) struct blkcipher_desc desc = {.tfm = tkey->tx_tfm_arc4}; int ret = 0; - #endif u8 rc4key[16], *icv; u32 crc; struct scatterlist sg; @@ -399,18 +323,6 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) hdr = (struct ieee80211_hdr_4addr *) skb->data; -#if 0 -printk("@@ tkey\n"); -printk("%x|", ((u32*)tkey->key)[0]); -printk("%x|", ((u32*)tkey->key)[1]); -printk("%x|", ((u32*)tkey->key)[2]); -printk("%x|", ((u32*)tkey->key)[3]); -printk("%x|", ((u32*)tkey->key)[4]); -printk("%x|", ((u32*)tkey->key)[5]); -printk("%x|", ((u32*)tkey->key)[6]); -printk("%x\n", ((u32*)tkey->key)[7]); -#endif - if (!tcb_desc->bHwSec) { if (!tkey->tx_phase1_done) { @@ -451,33 +363,14 @@ printk("%x\n", ((u32*)tkey->key)[7]); if (!tcb_desc->bHwSec) { icv = skb_put(skb, 4); -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) crc = ~crc32_le(~0, pos, len); -#else - crc = ~ether_crc_le(len, pos); -#endif icv[0] = crc; icv[1] = crc >> 8; icv[2] = crc >> 16; icv[3] = crc >> 24; -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) - crypto_cipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); - sg.page = virt_to_page(pos); - sg.offset = offset_in_page(pos); - sg.length = len + 4; - crypto_cipher_encrypt(tkey->tx_tfm_arc4, &sg, &sg, len + 4); -#else crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); -#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) - sg.page = virt_to_page(pos); - sg.offset = offset_in_page(pos); - sg.length = len + 4; -#else sg_init_one(&sg, pos, len+4); -#endif ret= crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); -#endif - } tkey->tx_iv16++; @@ -487,11 +380,7 @@ printk("%x\n", ((u32*)tkey->key)[7]); } if (!tcb_desc->bHwSec) -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) - return 0; - #else return ret; - #endif else return 0; @@ -506,9 +395,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) u16 iv16; struct ieee80211_hdr_4addr *hdr; cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); - #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) struct blkcipher_desc desc = {.tfm = tkey->rx_tfm_arc4}; - #endif u8 rc4key[16]; u8 icv[4]; u32 crc; @@ -567,21 +454,9 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) plen = skb->len - hdr_len - 12; -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) - crypto_cipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); - sg.page = virt_to_page(pos); - sg.offset = offset_in_page(pos); - sg.length = plen + 4; - crypto_cipher_decrypt(tkey->rx_tfm_arc4, &sg, &sg, plen + 4); -#else crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); -#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) - sg.page = virt_to_page(pos); - sg.offset = offset_in_page(pos); - sg.length = plen + 4; -#else sg_init_one(&sg, pos, plen+4); -#endif + if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { if (net_ratelimit()) { printk(KERN_DEBUG ": TKIP: failed to decrypt " @@ -590,13 +465,8 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) } return -7; } -#endif - #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) crc = ~crc32_le(~0, pos, plen); - #else - crc = ~ether_crc_le(plen, pos); - #endif icv[0] = crc; icv[1] = crc >> 8; icv[2] = crc >> 16; @@ -628,63 +498,9 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) skb_pull(skb, 8); skb_trim(skb, skb->len - 4); -//john's test -#ifdef JOHN_DUMP -if( ((u16*)skb->data)[0] & 0x4000){ - printk("@@ rx decrypted skb->data"); - int i; - for(i=0;ilen;i++){ - if( (i%24)==0 ) printk("\n"); - printk("%2x ", ((u8*)skb->data)[i]); - } - printk("\n"); -} -#endif /*JOHN_DUMP*/ return keyidx; } - -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) -static int michael_mic(struct crypto_tfm * tfm_michael, u8 *key, u8 *hdr, - u8 *data, size_t data_len, u8 *mic) -{ - struct scatterlist sg[2]; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) - struct hash_desc desc; - int ret = 0; -#endif - - if (tfm_michael == NULL){ - printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); - return -1; - } - sg[0].page = virt_to_page(hdr); - sg[0].offset = offset_in_page(hdr); - sg[0].length = 16; - - sg[1].page = virt_to_page(data); - sg[1].offset = offset_in_page(data); - sg[1].length = data_len; - - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - crypto_digest_init(tfm_michael); - crypto_digest_setkey(tfm_michael, key, 8); - crypto_digest_update(tfm_michael, sg, 2); - crypto_digest_final(tfm_michael, mic); - return 0; -#else -if (crypto_hash_setkey(tkey->tfm_michael, key, 8)) - return -1; - -// return 0; - desc.tfm = tkey->tfm_michael; - desc.flags = 0; - ret = crypto_hash_digest(&desc, sg, data_len + 16, mic); - return ret; -#endif -} -#else static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr, u8 * data, size_t data_len, u8 * mic) { @@ -695,19 +511,10 @@ static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr, printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); return -1; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - sg[0].page = virt_to_page(hdr); - sg[0].offset = offset_in_page(hdr); - sg[0].length = 16; - - sg[1].page = virt_to_page(data); - sg[1].offset = offset_in_page(data); - sg[1].length = data_len; -#else + sg_init_table(sg, 2); sg_set_buf(&sg[0], hdr, 16); sg_set_buf(&sg[1], data, data_len); -#endif if (crypto_hash_setkey(tfm_michael, key, 8)) return -1; @@ -716,9 +523,6 @@ static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr, desc.flags = 0; return crypto_hash_digest(&desc, sg, data_len + 16, mic); } -#endif - - static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) { @@ -775,20 +579,14 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri } // } pos = skb_put(skb, 8); -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) - if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr, - skb->data + hdr_len, skb->len - 8 - hdr_len, pos)) -#else + if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr, skb->data + hdr_len, skb->len - 8 - hdr_len, pos)) -#endif return -1; return 0; } - -#if WIRELESS_EXT >= 18 static void ieee80211_michael_mic_failure(struct net_device *dev, struct ieee80211_hdr_4addr *hdr, int keyidx) @@ -809,29 +607,6 @@ static void ieee80211_michael_mic_failure(struct net_device *dev, wrqu.data.length = sizeof(ev); wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev); } -#elif WIRELESS_EXT >= 15 -static void ieee80211_michael_mic_failure(struct net_device *dev, - struct ieee80211_hdr_4addr *hdr, - int keyidx) -{ - union iwreq_data wrqu; - char buf[128]; - - /* TODO: needed parameters: count, keyid, key type, TSC */ - sprintf(buf, "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr=" - MAC_FMT ")", keyidx, hdr->addr1[0] & 0x01 ? "broad" : "uni", - MAC_ARG(hdr->addr2)); - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.data.length = strlen(buf); - wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf); -} -#else /* WIRELESS_EXT >= 15 */ -static inline void ieee80211_michael_mic_failure(struct net_device *dev, - struct ieee80211_hdr_4addr *hdr, - int keyidx) -{ -} -#endif /* WIRELESS_EXT >= 15 */ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, int hdr_len, void *priv) @@ -853,13 +628,8 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, } // } -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) - if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr, - skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) -#else if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr, skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) -#endif return -1; if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { struct ieee80211_hdr_4addr *hdr; @@ -889,32 +659,18 @@ static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv) { struct ieee80211_tkip_data *tkey = priv; int keyidx; -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) - struct crypto_tfm *tfm = tkey->tx_tfm_michael; - struct crypto_tfm *tfm2 = tkey->tx_tfm_arc4; - struct crypto_tfm *tfm3 = tkey->rx_tfm_michael; - struct crypto_tfm *tfm4 = tkey->rx_tfm_arc4; -#else struct crypto_hash *tfm = tkey->tx_tfm_michael; struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4; struct crypto_hash *tfm3 = tkey->rx_tfm_michael; struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4; -#endif keyidx = tkey->key_idx; memset(tkey, 0, sizeof(*tkey)); tkey->key_idx = keyidx; -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) - tkey->tx_tfm_michael = tfm; - tkey->tx_tfm_arc4 = tfm2; - tkey->rx_tfm_michael = tfm3; - tkey->rx_tfm_arc4 = tfm4; -#else tkey->tx_tfm_michael = tfm; tkey->tx_tfm_arc4 = tfm2; tkey->rx_tfm_michael = tfm3; tkey->rx_tfm_arc4 = tfm4; -#endif if (len == TKIP_KEY_LEN) { memcpy(tkey->key, key, TKIP_KEY_LEN); @@ -1007,14 +763,12 @@ static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { .owner = THIS_MODULE, }; - -static int __init ieee80211_crypto_tkip_init(void) +int __init ieee80211_crypto_tkip_init(void) { return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip); } - -static void __exit ieee80211_crypto_tkip_exit(void) +void __exit ieee80211_crypto_tkip_exit(void) { ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip); } @@ -1024,11 +778,3 @@ void ieee80211_tkip_null(void) // printk("============>%s()\n", __FUNCTION__); return; } -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -EXPORT_SYMBOL(ieee80211_tkip_null); -#else -EXPORT_SYMBOL_NOVERS(ieee80211_tkip_null); -#endif - -module_init(ieee80211_crypto_tkip_init); -module_exit(ieee80211_crypto_tkip_exit); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c index 7e394328ec90..39c74d1533ce 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c @@ -20,41 +20,13 @@ #include "ieee80211.h" -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)) -//#include "crypto_compat.h" -#endif - - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -#include "rtl_crypto.h" -#else #include -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - #include -#else #include -#endif -//#include #include -// -/* -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -#include "rtl_crypto.h" -#else -#include -#endif -#include -#include -*/ MODULE_AUTHOR("Jouni Malinen"); MODULE_DESCRIPTION("Host AP crypt: WEP"); MODULE_LICENSE("GPL"); -#ifndef OPENSUSE_SLED -#define OPENSUSE_SLED 0 -#endif struct prism2_wep_data { u32 iv; @@ -62,12 +34,8 @@ struct prism2_wep_data { u8 key[WEP_KEY_LEN + 1]; u8 key_len; u8 key_idx; -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) - struct crypto_tfm *tfm; - #else struct crypto_blkcipher *tx_tfm; struct crypto_blkcipher *rx_tfm; - #endif }; @@ -81,14 +49,6 @@ static void * prism2_wep_init(int keyidx) memset(priv, 0, sizeof(*priv)); priv->key_idx = keyidx; -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) - priv->tfm = crypto_alloc_tfm("arc4", 0); - if (priv->tfm == NULL) { - printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " - "crypto API arc4\n"); - goto fail; - } - #else priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tx_tfm)) { printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " @@ -103,7 +63,6 @@ static void * prism2_wep_init(int keyidx) priv->rx_tfm = NULL; goto fail; } - #endif /* start WEP IV from a random value */ get_random_bytes(&priv->iv, 4); @@ -111,13 +70,6 @@ static void * prism2_wep_init(int keyidx) return priv; fail: -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) - if (priv) { - if (priv->tfm) - crypto_free_tfm(priv->tfm); - kfree(priv); - } - #else if (priv) { if (priv->tx_tfm) crypto_free_blkcipher(priv->tx_tfm); @@ -125,7 +77,7 @@ fail: crypto_free_blkcipher(priv->rx_tfm); kfree(priv); } - #endif + return NULL; } @@ -133,17 +85,13 @@ fail: static void prism2_wep_deinit(void *priv) { struct prism2_wep_data *_priv = priv; -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) - if (_priv && _priv->tfm) - crypto_free_tfm(_priv->tfm); - #else + if (_priv) { if (_priv->tx_tfm) crypto_free_blkcipher(_priv->tx_tfm); if (_priv->rx_tfm) crypto_free_blkcipher(_priv->rx_tfm); } - #endif kfree(priv); } @@ -160,9 +108,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) u8 key[WEP_KEY_LEN + 3]; u8 *pos; cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); - #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) struct blkcipher_desc desc = {.tfm = wep->tx_tfm}; - #endif u32 crc; u8 *icv; struct scatterlist sg; @@ -201,35 +147,17 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) { /* Append little-endian CRC32 and encrypt it to produce ICV */ - #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) crc = ~crc32_le(~0, pos, len); - #else - crc = ~ether_crc_le(len, pos); - #endif icv = skb_put(skb, 4); icv[0] = crc; icv[1] = crc >> 8; icv[2] = crc >> 16; icv[3] = crc >> 24; -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) - crypto_cipher_setkey(wep->tfm, key, klen); - sg.page = virt_to_page(pos); - sg.offset = offset_in_page(pos); - sg.length = len + 4; - crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4); - return 0; - #else crypto_blkcipher_setkey(wep->tx_tfm, key, klen); - #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) - sg.page = virt_to_page(pos); - sg.offset = offset_in_page(pos); - sg.length = len + 4; - #else sg_init_one(&sg, pos, len+4); - #endif + return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); - #endif } return 0; @@ -250,9 +178,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) u8 key[WEP_KEY_LEN + 3]; u8 keyidx, *pos; cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); - #if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) struct blkcipher_desc desc = {.tfm = wep->rx_tfm}; - #endif u32 crc; u8 icv[4]; struct scatterlist sg; @@ -277,29 +203,13 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) if (!tcb_desc->bHwSec) { -#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) - crypto_cipher_setkey(wep->tfm, key, klen); - sg.page = virt_to_page(pos); - sg.offset = offset_in_page(pos); - sg.length = plen + 4; - crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4); - #else crypto_blkcipher_setkey(wep->rx_tfm, key, klen); - #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) - sg.page = virt_to_page(pos); - sg.offset = offset_in_page(pos); - sg.length = plen + 4; - #else sg_init_one(&sg, pos, plen+4); - #endif + if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) return -7; - #endif - #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) + crc = ~crc32_le(~0, pos, plen); - #else - crc = ~ether_crc_le(plen, pos); - #endif icv[0] = crc; icv[1] = crc >> 8; icv[2] = crc >> 16; @@ -370,14 +280,12 @@ static struct ieee80211_crypto_ops ieee80211_crypt_wep = { .owner = THIS_MODULE, }; - -static int __init ieee80211_crypto_wep_init(void) +int __init ieee80211_crypto_wep_init(void) { return ieee80211_register_crypto_ops(&ieee80211_crypt_wep); } - -static void __exit ieee80211_crypto_wep_exit(void) +void __exit ieee80211_crypto_wep_exit(void) { ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep); } @@ -387,11 +295,3 @@ void ieee80211_wep_null(void) // printk("============>%s()\n", __FUNCTION__); return; } -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -EXPORT_SYMBOL(ieee80211_wep_null); -#else -EXPORT_SYMBOL_NOVERS(ieee80211_wep_null); -#endif - -module_init(ieee80211_crypto_wep_init); -module_exit(ieee80211_crypto_wep_exit); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index f408b4583b82..c3383bb8b760 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -113,13 +113,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) goto failed; } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) ieee = netdev_priv(dev); -#else - ieee = (struct ieee80211_device *)dev->priv; -#endif - dev->hard_start_xmit = ieee80211_xmit; - memset(ieee, 0, sizeof(struct ieee80211_device)+sizeof_priv); ieee->dev = dev; @@ -167,12 +161,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ieee80211_softmac_init(ieee); -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)) ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kzalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL); -#else - ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kmalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL); - memset(ieee->pHTInfo,0,sizeof(RT_HIGH_THROUGHPUT)); -#endif if (ieee->pHTInfo == NULL) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for HTInfo\n"); @@ -181,13 +170,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) HTUpdateDefaultSetting(ieee); HTInitializeHTInfo(ieee); //may move to other place. TSInitialize(ieee); -#if 0 -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) - INIT_WORK(&ieee->ht_onAssRsp, (void(*)(void*)) HTOnAssocRsp_wq); -#else - INIT_WORK(&ieee->ht_onAssRsp, (void(*)(void*)) HTOnAssocRsp_wq, ieee); -#endif -#endif + for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]); @@ -206,22 +189,15 @@ struct net_device *alloc_ieee80211(int sizeof_priv) failed: if (dev) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) free_netdev(dev); -#else - kfree(dev); -#endif + return NULL; } void free_ieee80211(struct net_device *dev) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) struct ieee80211_device *ieee = netdev_priv(dev); -#else - struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv; -#endif int i; //struct list_head *p, *q; // del_timer_sync(&ieee->SwBwTimer); @@ -240,34 +216,15 @@ void free_ieee80211(struct net_device *dev) for (i = 0; i < WEP_KEYS; i++) { struct ieee80211_crypt_data *crypt = ieee->crypt[i]; if (crypt) { - if (crypt->ops) { + if (crypt->ops) crypt->ops->deinit(crypt->priv); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) - module_put(crypt->ops->owner); -#else - __MOD_DEC_USE_COUNT(crypt->ops->owner); -#endif - } kfree(crypt); ieee->crypt[i] = NULL; } } ieee80211_networks_free(ieee); -#if 0 - for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) { - list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) { - kfree(list_entry(p, struct ieee_ibss_seq, list)); - list_del(p); - } - } - -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) free_netdev(dev); -#else - kfree(dev); -#endif } #ifdef CONFIG_IEEE80211_DEBUG @@ -305,7 +262,7 @@ static int store_debug_level(struct file *file, const char *buffer, unsigned long count, void *data) { char buf[] = "0x00000000"; - unsigned long len = min(sizeof(buf) - 1, (u32)count); + unsigned long len = min(sizeof(buf) - 1, count); char *p = (char *)buf; unsigned long val; @@ -328,16 +285,13 @@ static int store_debug_level(struct file *file, const char *buffer, return strnlen(buf, count); } -static int __init ieee80211_init(void) +int __init ieee80211_debug_init(void) { struct proc_dir_entry *e; ieee80211_debug_level = debug; -#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) - ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, proc_net); -#else + ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, init_net.proc_net); -#endif if (ieee80211_proc == NULL) { IEEE80211_ERROR("Unable to create " DRV_NAME " proc directory\n"); @@ -346,11 +300,7 @@ static int __init ieee80211_init(void) e = create_proc_entry("debug_level", S_IFREG | S_IRUGO | S_IWUSR, ieee80211_proc); if (!e) { -#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) - remove_proc_entry(DRV_NAME, proc_net); -#else remove_proc_entry(DRV_NAME, init_net.proc_net); -#endif ieee80211_proc = NULL; return -EIO; } @@ -361,34 +311,16 @@ static int __init ieee80211_init(void) return 0; } -static void __exit ieee80211_exit(void) +void __exit ieee80211_debug_exit(void) { if (ieee80211_proc) { remove_proc_entry("debug_level", ieee80211_proc); -#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) - remove_proc_entry(DRV_NAME, proc_net); -#else remove_proc_entry(DRV_NAME, init_net.proc_net); -#endif ieee80211_proc = NULL; } } -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) #include module_param(debug, int, 0444); MODULE_PARM_DESC(debug, "debug output mask"); - - -module_exit(ieee80211_exit); -module_init(ieee80211_init); -#endif -#endif - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -EXPORT_SYMBOL(alloc_ieee80211); -EXPORT_SYMBOL(free_ieee80211); -#else -EXPORT_SYMBOL_NOVERS(alloc_ieee80211); -EXPORT_SYMBOL_NOVERS(free_ieee80211); #endif diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 6997e97fc850..15999e850b62 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1175,18 +1175,14 @@ static int rtl8192_rx_initiate(struct net_device*dev) } // printk("nomal packet IN request!\n"); usb_fill_bulk_urb(entry, priv->udev, - usb_rcvbulkpipe(priv->udev, 3), skb->tail, + usb_rcvbulkpipe(priv->udev, 3), skb_tail_pointer(skb), RX_URB_SIZE, rtl8192_rx_isr, skb); info = (struct rtl8192_rx_info *) skb->cb; info->urb = entry; info->dev = dev; info->out_pipe = 3; //denote rx normal packet queue skb_queue_tail(&priv->rx_queue, skb); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) usb_submit_urb(entry, GFP_KERNEL); -#else - usb_submit_urb(entry); -#endif } /* command packet rx procedure */ @@ -1205,18 +1201,14 @@ static int rtl8192_rx_initiate(struct net_device*dev) break; } usb_fill_bulk_urb(entry, priv->udev, - usb_rcvbulkpipe(priv->udev, 9), skb->tail, + usb_rcvbulkpipe(priv->udev, 9), skb_tail_pointer(skb), RX_URB_SIZE, rtl8192_rx_isr, skb); info = (struct rtl8192_rx_info *) skb->cb; info->urb = entry; info->dev = dev; info->out_pipe = 9; //denote rx cmd packet queue skb_queue_tail(&priv->rx_queue, skb); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) usb_submit_urb(entry, GFP_KERNEL); -#else - usb_submit_urb(entry); -#endif } return 0; @@ -1586,7 +1578,7 @@ static void rtl8192_rx_isr(struct urb *urb) } usb_fill_bulk_urb(urb, priv->udev, - usb_rcvbulkpipe(priv->udev, out_pipe), skb->tail, + usb_rcvbulkpipe(priv->udev, out_pipe), skb_tail_pointer(skb), RX_URB_SIZE, rtl8192_rx_isr, skb); info = (struct rtl8192_rx_info *) skb->cb; @@ -1594,14 +1586,10 @@ static void rtl8192_rx_isr(struct urb *urb) info->dev = dev; info->out_pipe = out_pipe; - urb->transfer_buffer = skb->tail; + urb->transfer_buffer = skb_tail_pointer(skb); urb->context = skb; skb_queue_tail(&priv->rx_queue, skb); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) err = usb_submit_urb(urb, GFP_ATOMIC); -#else - err = usb_submit_urb(urb); -#endif if(err && err != EPERM) printk("can not submit rxurb, err is %x,URB status is %x\n",err,urb->status); } @@ -2953,25 +2941,21 @@ short rtl8192_usb_initendpoints(struct net_device *dev) #ifdef THOMAS_BEACON { - int align = 0; - u32 oldaddr,newaddr; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + long align = 0; + void *oldaddr, *newaddr; + priv->rx_urb[16] = usb_alloc_urb(0, GFP_KERNEL); -#else - priv->rx_urb[16] = usb_alloc_urb(0); -#endif priv->oldaddr = kmalloc(16, GFP_KERNEL); - oldaddr = (u32)priv->oldaddr; - align = oldaddr&3; - if(align != 0 ){ + oldaddr = priv->oldaddr; + align = ((long)oldaddr) & 3; + if (align) { newaddr = oldaddr + 4 - align; - priv->rx_urb[16]->transfer_buffer_length = 16-4+align; - } - else{ + priv->rx_urb[16]->transfer_buffer_length = 16 - 4 + align; + } else { newaddr = oldaddr; priv->rx_urb[16]->transfer_buffer_length = 16; } - priv->rx_urb[16]->transfer_buffer = (u32*)newaddr; + priv->rx_urb[16]->transfer_buffer = newaddr; } #endif @@ -6831,6 +6815,18 @@ void rtl8192_irq_rx_tasklet(struct r8192_priv *priv) } } +static const struct net_device_ops rtl8192_netdev_ops = { + .ndo_open = rtl8192_open, + .ndo_stop = rtl8192_close, + .ndo_get_stats = rtl8192_stats, + .ndo_tx_timeout = tx_timeout, + .ndo_do_ioctl = rtl8192_ioctl, + .ndo_set_multicast_list = r8192_set_multicast, + .ndo_set_mac_address = r8192_set_mac_adr, + .ndo_validate_addr = eth_validate_addr, + .ndo_change_mtu = eth_change_mtu, + .ndo_start_xmit = ieee80211_xmit, +}; /**************************************************************************** @@ -6872,15 +6868,7 @@ static void * __devinit rtl8192_usb_probe(struct usb_device *udev, #endif priv->udev=udev; - dev->open = rtl8192_open; - dev->stop = rtl8192_close; - //dev->hard_start_xmit = rtl8192_8023_hard_start_xmit; - dev->tx_timeout = tx_timeout; - //dev->wireless_handlers = &r8192_wx_handlers_def; - dev->do_ioctl = rtl8192_ioctl; - dev->set_multicast_list = r8192_set_multicast; - dev->set_mac_address = r8192_set_mac_adr; - dev->get_stats = rtl8192_stats; + dev->netdev_ops = &rtl8192_netdev_ops; //DMESG("Oops: i'm coming\n"); #if WIRELESS_EXT >= 12 @@ -7000,9 +6988,55 @@ static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr) RT_TRACE(COMP_DOWN, "wlan driver removed\n"); } +/* fun with the built-in ieee80211 stack... */ +extern int ieee80211_debug_init(void); +extern void ieee80211_debug_exit(void); +extern int ieee80211_crypto_init(void); +extern void ieee80211_crypto_deinit(void); +extern int ieee80211_crypto_tkip_init(void); +extern void ieee80211_crypto_tkip_exit(void); +extern int ieee80211_crypto_ccmp_init(void); +extern void ieee80211_crypto_ccmp_exit(void); +extern int ieee80211_crypto_wep_init(void); +extern void ieee80211_crypto_wep_exit(void); static int __init rtl8192_usb_module_init(void) { + int ret; + +#ifdef CONFIG_IEEE80211_DEBUG + ret = ieee80211_debug_init(); + if (ret) { + printk(KERN_ERR "ieee80211_debug_init() failed %d\n", ret); + return ret; + } +#endif + ret = ieee80211_crypto_init(); + if (ret) { + printk(KERN_ERR "ieee80211_crypto_init() failed %d\n", ret); + return ret; + } + + ret = ieee80211_crypto_tkip_init(); + if (ret) { + printk(KERN_ERR "ieee80211_crypto_tkip_init() failed %d\n", + ret); + return ret; + } + + ret = ieee80211_crypto_ccmp_init(); + if (ret) { + printk(KERN_ERR "ieee80211_crypto_ccmp_init() failed %d\n", + ret); + return ret; + } + + ret = ieee80211_crypto_wep_init(); + if (ret) { + printk(KERN_ERR "ieee80211_crypto_wep_init() failed %d\n", ret); + return ret; + } + printk(KERN_INFO "\nLinux kernel driver for RTL8192 based WLAN cards\n"); printk(KERN_INFO "Copyright (c) 2007-2008, Realsil Wlan\n"); RT_TRACE(COMP_INIT, "Initializing module"); -- GitLab From e406322b4b963e622f41d76193d8ca9e5435adb8 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 3 Nov 2009 07:42:46 -0200 Subject: [PATCH 224/235] Staging: rtl8192u: remove bad whitespaces Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211.h | 716 +++++++++--------- drivers/staging/rtl8192u/ieee80211/aes.c | 34 +- drivers/staging/rtl8192u/ieee80211/arc4.c | 6 +- drivers/staging/rtl8192u/ieee80211/cipher.c | 98 +-- drivers/staging/rtl8192u/ieee80211/compress.c | 16 +- .../rtl8192u/ieee80211/crypto_compat.h | 12 +- drivers/staging/rtl8192u/ieee80211/digest.c | 6 +- .../staging/rtl8192u/ieee80211/ieee80211.h | 702 ++++++++--------- .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 2 +- .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 40 +- .../rtl8192u/ieee80211/ieee80211_crypt_wep.c | 54 +- .../rtl8192u/ieee80211/ieee80211_module.c | 10 +- .../rtl8192u/ieee80211/ieee80211_softmac.c | 100 +-- .../rtl8192u/ieee80211/ieee80211_softmac_wx.c | 4 +- .../staging/rtl8192u/ieee80211/ieee80211_wx.c | 434 +++++------ drivers/staging/rtl8192u/ieee80211/proc.c | 2 +- .../staging/rtl8192u/ieee80211/rtl819x_HT.h | 2 +- .../rtl8192u/ieee80211/rtl819x_HTProc.c | 20 +- .../staging/rtl8192u/ieee80211/rtl819x_Qos.h | 12 +- .../rtl8192u/ieee80211/rtl819x_TSProc.c | 38 +- drivers/staging/rtl8192u/r8180_pm.c | 8 +- drivers/staging/rtl8192u/r8192U_core.c | 710 ++++++++--------- drivers/staging/rtl8192u/r8192U_dm.c | 28 +- drivers/staging/rtl8192u/r8192U_dm.h | 2 +- drivers/staging/rtl8192u/r8192U_hw.h | 2 +- drivers/staging/rtl8192u/r8192U_wx.c | 320 ++++---- drivers/staging/rtl8192u/r819xU_cmdpkt.c | 12 +- drivers/staging/rtl8192u/r819xU_cmdpkt.h | 8 +- drivers/staging/rtl8192u/r819xU_firmware.c | 18 +- drivers/staging/rtl8192u/r819xU_phy.c | 22 +- drivers/staging/rtl8192u/r819xU_phyreg.h | 50 +- 31 files changed, 1744 insertions(+), 1744 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211.h b/drivers/staging/rtl8192u/ieee80211.h index 690d41c8cb62..f5795855904b 100644 --- a/drivers/staging/rtl8192u/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211.h @@ -86,8 +86,8 @@ struct iw_spy_data{ * */ #define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) #endif #define KEY_TYPE_NA 0x0 @@ -125,61 +125,61 @@ struct iw_spy_data{ /* defined for skb cb field */ /* At most 28 byte */ typedef struct cb_desc { - /* Tx Desc Related flags (8-9) */ + /* Tx Desc Related flags (8-9) */ u8 bLastIniPkt:1; u8 bCmdOrInit:1; - u8 bFirstSeg:1; - u8 bLastSeg:1; - u8 bEncrypt:1; - u8 bTxDisableRateFallBack:1; - u8 bTxUseDriverAssingedRate:1; - u8 bHwSec:1; //indicate whether use Hw security. WB - - u8 reserved1; - - /* Tx Firmware Relaged flags (10-11)*/ - u8 bCTSEnable:1; - u8 bRTSEnable:1; - u8 bUseShortGI:1; - u8 bUseShortPreamble:1; - u8 bTxEnableFwCalcDur:1; - u8 bAMPDUEnable:1; - u8 bRTSSTBC:1; - u8 RTSSC:1; - - u8 bRTSBW:1; - u8 bPacketBW:1; + u8 bFirstSeg:1; + u8 bLastSeg:1; + u8 bEncrypt:1; + u8 bTxDisableRateFallBack:1; + u8 bTxUseDriverAssingedRate:1; + u8 bHwSec:1; //indicate whether use Hw security. WB + + u8 reserved1; + + /* Tx Firmware Relaged flags (10-11)*/ + u8 bCTSEnable:1; + u8 bRTSEnable:1; + u8 bUseShortGI:1; + u8 bUseShortPreamble:1; + u8 bTxEnableFwCalcDur:1; + u8 bAMPDUEnable:1; + u8 bRTSSTBC:1; + u8 RTSSC:1; + + u8 bRTSBW:1; + u8 bPacketBW:1; u8 bRTSUseShortPreamble:1; u8 bRTSUseShortGI:1; u8 bMulticast:1; u8 bBroadcast:1; - //u8 reserved2:2; - u8 drv_agg_enable:1; - u8 reserved2:1; - - /* Tx Desc related element(12-19) */ - u8 rata_index; - u8 queue_index; - //u8 reserved3; - //u8 reserved4; - u16 txbuf_size; - //u8 reserved5; + //u8 reserved2:2; + u8 drv_agg_enable:1; + u8 reserved2:1; + + /* Tx Desc related element(12-19) */ + u8 rata_index; + u8 queue_index; + //u8 reserved3; + //u8 reserved4; + u16 txbuf_size; + //u8 reserved5; u8 RATRIndex; - u8 reserved6; - u8 reserved7; - u8 reserved8; - - /* Tx firmware related element(20-27) */ - u8 data_rate; - u8 rts_rate; - u8 ampdu_factor; - u8 ampdu_density; - //u8 reserved9; - //u8 reserved10; - //u8 reserved11; - u8 DrvAggrNum; + u8 reserved6; + u8 reserved7; + u8 reserved8; + + /* Tx firmware related element(20-27) */ + u8 data_rate; + u8 rts_rate; + u8 ampdu_factor; + u8 ampdu_density; + //u8 reserved9; + //u8 reserved10; + //u8 reserved11; + u8 DrvAggrNum; u16 pkt_size; - u8 reserved12; + u8 reserved12; }cb_desc, *pcb_desc; /*--------------------------Define -------------------------------------------*/ @@ -389,7 +389,7 @@ enum _ReasonCode{ typedef struct ieee_param { u32 cmd; u8 sta_addr[ETH_ALEN]; - union { + union { struct { u8 name; u32 value; @@ -399,9 +399,9 @@ typedef struct ieee_param { u8 reserved[32]; u8 data[0]; } wpa_ie; - struct{ + struct{ int command; - int reason_code; + int reason_code; } mlme; struct { u8 alg[IEEE_CRYPT_ALG_NAME_LEN]; @@ -442,23 +442,23 @@ static inline void tq_init(struct tq_struct * task, void(*func)(void *), void *d #define MSECS(t) (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000) static inline unsigned long msleep_interruptible_rsl(unsigned int msecs) { - unsigned long timeout = MSECS(msecs) + 1; + unsigned long timeout = MSECS(msecs) + 1; - while (timeout) { - set_current_state(TASK_INTERRUPTIBLE); - timeout = schedule_timeout(timeout); - } - return timeout; + while (timeout) { + set_current_state(TASK_INTERRUPTIBLE); + timeout = schedule_timeout(timeout); + } + return timeout; } #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31)) static inline void msleep(unsigned int msecs) { - unsigned long timeout = MSECS(msecs) + 1; + unsigned long timeout = MSECS(msecs) + 1; - while (timeout) { - set_current_state(TASK_UNINTERRUPTIBLE); - timeout = schedule_timeout(timeout); - } + while (timeout) { + set_current_state(TASK_UNINTERRUPTIBLE); + timeout = schedule_timeout(timeout); + } } #endif #else @@ -559,24 +559,24 @@ static inline void msleep(unsigned int msecs) #define SN_EQUAL(a, b) (a == b) #define MAX_DEV_ADDR_SIZE 8 typedef enum _ACT_CATEGORY{ - ACT_CAT_QOS = 1, - ACT_CAT_DLS = 2, - ACT_CAT_BA = 3, - ACT_CAT_HT = 7, - ACT_CAT_WMM = 17, + ACT_CAT_QOS = 1, + ACT_CAT_DLS = 2, + ACT_CAT_BA = 3, + ACT_CAT_HT = 7, + ACT_CAT_WMM = 17, } ACT_CATEGORY, *PACT_CATEGORY; typedef enum _TS_ACTION{ - ACT_ADDTSREQ = 0, - ACT_ADDTSRSP = 1, - ACT_DELTS = 2, - ACT_SCHEDULE = 3, + ACT_ADDTSREQ = 0, + ACT_ADDTSRSP = 1, + ACT_DELTS = 2, + ACT_SCHEDULE = 3, } TS_ACTION, *PTS_ACTION; typedef enum _BA_ACTION{ - ACT_ADDBAREQ = 0, - ACT_ADDBARSP = 1, - ACT_DELBA = 2, + ACT_ADDBAREQ = 0, + ACT_ADDBARSP = 1, + ACT_DELBA = 2, } BA_ACTION, *PBA_ACTION; typedef enum _InitialGainOpType{ @@ -687,22 +687,22 @@ do { if (ieee80211_debug_level & (level)) \ /* I want to see ASCII 33 to 126 only. Otherwise, I print '?'. Annie, 2005-11-22.*/ #define PRINTABLE(_ch) (_ch>'!' && _ch<'~') #define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) \ - if((_Comp) & level) \ - { \ - int __i; \ - u8 buffer[MAX_STR_LEN]; \ - int length = (_Len\n", _Len, buffer); \ - } + if((_Comp) & level) \ + { \ + int __i; \ + u8 buffer[MAX_STR_LEN]; \ + int length = (_Len\n", _Len, buffer); \ + } #else #define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) do {} while (0) #endif @@ -731,10 +731,10 @@ do { if (ieee80211_debug_level & (level)) \ struct ieee80211_snap_hdr { - u8 dsap; /* always 0xAA */ - u8 ssap; /* always 0xAA */ - u8 ctrl; /* always 0x03 */ - u8 oui[P80211_OUI_LEN]; /* organizational universal id */ + u8 dsap; /* always 0xAA */ + u8 ssap; /* always 0xAA */ + u8 ctrl; /* always 0x03 */ + u8 oui[P80211_OUI_LEN]; /* organizational universal id */ } __attribute__ ((packed)); @@ -775,65 +775,65 @@ struct ieee80211_snap_hdr { /* Status codes */ enum ieee80211_statuscode { - WLAN_STATUS_SUCCESS = 0, - WLAN_STATUS_UNSPECIFIED_FAILURE = 1, - WLAN_STATUS_CAPS_UNSUPPORTED = 10, - WLAN_STATUS_REASSOC_NO_ASSOC = 11, - WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12, - WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13, - WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14, - WLAN_STATUS_CHALLENGE_FAIL = 15, - WLAN_STATUS_AUTH_TIMEOUT = 16, - WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17, - WLAN_STATUS_ASSOC_DENIED_RATES = 18, - /* 802.11b */ - WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19, - WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20, - WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21, - /* 802.11h */ - WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22, - WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23, - WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24, - /* 802.11g */ - WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25, - WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26, - /* 802.11i */ - WLAN_STATUS_INVALID_IE = 40, - WLAN_STATUS_INVALID_GROUP_CIPHER = 41, - WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42, - WLAN_STATUS_INVALID_AKMP = 43, - WLAN_STATUS_UNSUPP_RSN_VERSION = 44, - WLAN_STATUS_INVALID_RSN_IE_CAP = 45, - WLAN_STATUS_CIPHER_SUITE_REJECTED = 46, + WLAN_STATUS_SUCCESS = 0, + WLAN_STATUS_UNSPECIFIED_FAILURE = 1, + WLAN_STATUS_CAPS_UNSUPPORTED = 10, + WLAN_STATUS_REASSOC_NO_ASSOC = 11, + WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12, + WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13, + WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14, + WLAN_STATUS_CHALLENGE_FAIL = 15, + WLAN_STATUS_AUTH_TIMEOUT = 16, + WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17, + WLAN_STATUS_ASSOC_DENIED_RATES = 18, + /* 802.11b */ + WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19, + WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20, + WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21, + /* 802.11h */ + WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22, + WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23, + WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24, + /* 802.11g */ + WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25, + WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26, + /* 802.11i */ + WLAN_STATUS_INVALID_IE = 40, + WLAN_STATUS_INVALID_GROUP_CIPHER = 41, + WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42, + WLAN_STATUS_INVALID_AKMP = 43, + WLAN_STATUS_UNSUPP_RSN_VERSION = 44, + WLAN_STATUS_INVALID_RSN_IE_CAP = 45, + WLAN_STATUS_CIPHER_SUITE_REJECTED = 46, }; /* Reason codes */ enum ieee80211_reasoncode { - WLAN_REASON_UNSPECIFIED = 1, - WLAN_REASON_PREV_AUTH_NOT_VALID = 2, - WLAN_REASON_DEAUTH_LEAVING = 3, - WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4, - WLAN_REASON_DISASSOC_AP_BUSY = 5, - WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6, - WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7, - WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8, - WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9, - /* 802.11h */ - WLAN_REASON_DISASSOC_BAD_POWER = 10, - WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11, - /* 802.11i */ - WLAN_REASON_INVALID_IE = 13, - WLAN_REASON_MIC_FAILURE = 14, - WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, - WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16, - WLAN_REASON_IE_DIFFERENT = 17, - WLAN_REASON_INVALID_GROUP_CIPHER = 18, - WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19, - WLAN_REASON_INVALID_AKMP = 20, - WLAN_REASON_UNSUPP_RSN_VERSION = 21, - WLAN_REASON_INVALID_RSN_IE_CAP = 22, - WLAN_REASON_IEEE8021X_FAILED = 23, - WLAN_REASON_CIPHER_SUITE_REJECTED = 24, + WLAN_REASON_UNSPECIFIED = 1, + WLAN_REASON_PREV_AUTH_NOT_VALID = 2, + WLAN_REASON_DEAUTH_LEAVING = 3, + WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4, + WLAN_REASON_DISASSOC_AP_BUSY = 5, + WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6, + WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7, + WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8, + WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9, + /* 802.11h */ + WLAN_REASON_DISASSOC_BAD_POWER = 10, + WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11, + /* 802.11i */ + WLAN_REASON_INVALID_IE = 13, + WLAN_REASON_MIC_FAILURE = 14, + WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, + WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16, + WLAN_REASON_IE_DIFFERENT = 17, + WLAN_REASON_INVALID_GROUP_CIPHER = 18, + WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19, + WLAN_REASON_INVALID_AKMP = 20, + WLAN_REASON_UNSUPP_RSN_VERSION = 21, + WLAN_REASON_INVALID_RSN_IE_CAP = 22, + WLAN_REASON_IEEE8021X_FAILED = 23, + WLAN_REASON_CIPHER_SUITE_REJECTED = 24, }; #define IEEE80211_STATMASK_SIGNAL (1<<0) @@ -849,13 +849,13 @@ enum ieee80211_reasoncode { #define IEEE80211_52GHZ_BAND (1<<1) #define IEEE80211_CCK_RATE_LEN 4 -#define IEEE80211_CCK_RATE_1MB 0x02 -#define IEEE80211_CCK_RATE_2MB 0x04 -#define IEEE80211_CCK_RATE_5MB 0x0B -#define IEEE80211_CCK_RATE_11MB 0x16 +#define IEEE80211_CCK_RATE_1MB 0x02 +#define IEEE80211_CCK_RATE_2MB 0x04 +#define IEEE80211_CCK_RATE_5MB 0x0B +#define IEEE80211_CCK_RATE_11MB 0x16 #define IEEE80211_OFDM_RATE_LEN 8 -#define IEEE80211_OFDM_RATE_6MB 0x0C -#define IEEE80211_OFDM_RATE_9MB 0x12 +#define IEEE80211_OFDM_RATE_6MB 0x0C +#define IEEE80211_OFDM_RATE_9MB 0x12 #define IEEE80211_OFDM_RATE_12MB 0x18 #define IEEE80211_OFDM_RATE_18MB 0x24 #define IEEE80211_OFDM_RATE_24MB 0x30 @@ -877,12 +877,12 @@ enum ieee80211_reasoncode { #define IEEE80211_OFDM_RATE_48MB_MASK (1<<10) #define IEEE80211_OFDM_RATE_54MB_MASK (1<<11) -#define IEEE80211_CCK_RATES_MASK 0x0000000F +#define IEEE80211_CCK_RATES_MASK 0x0000000F #define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \ IEEE80211_CCK_RATE_2MB_MASK) #define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \ - IEEE80211_CCK_RATE_5MB_MASK | \ - IEEE80211_CCK_RATE_11MB_MASK) + IEEE80211_CCK_RATE_5MB_MASK | \ + IEEE80211_CCK_RATE_11MB_MASK) #define IEEE80211_OFDM_RATES_MASK 0x00000FF0 #define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \ @@ -895,10 +895,10 @@ enum ieee80211_reasoncode { IEEE80211_OFDM_RATE_48MB_MASK | \ IEEE80211_OFDM_RATE_54MB_MASK) #define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \ - IEEE80211_CCK_DEFAULT_RATES_MASK) + IEEE80211_CCK_DEFAULT_RATES_MASK) #define IEEE80211_NUM_OFDM_RATES 8 -#define IEEE80211_NUM_CCK_RATES 4 +#define IEEE80211_NUM_CCK_RATES 4 #define IEEE80211_OFDM_SHIFT_MASK_A 4 @@ -1064,10 +1064,10 @@ struct ieee80211_device; struct ieee80211_security { u16 active_key:2, - enabled:1, + enabled:1, auth_mode:2, - auth_algo:4, - unicast_uses_group:1, + auth_algo:4, + unicast_uses_group:1, encrypt:1; u8 key_sizes[WEP_KEYS]; u8 keys[WEP_KEYS][SCM_KEY_LEN]; @@ -1089,60 +1089,60 @@ Total: 28-2340 bytes /* Management Frame Information Element Types */ enum ieee80211_mfie { - MFIE_TYPE_SSID = 0, - MFIE_TYPE_RATES = 1, - MFIE_TYPE_FH_SET = 2, - MFIE_TYPE_DS_SET = 3, - MFIE_TYPE_CF_SET = 4, - MFIE_TYPE_TIM = 5, - MFIE_TYPE_IBSS_SET = 6, - MFIE_TYPE_COUNTRY = 7, - MFIE_TYPE_HOP_PARAMS = 8, - MFIE_TYPE_HOP_TABLE = 9, - MFIE_TYPE_REQUEST = 10, - MFIE_TYPE_CHALLENGE = 16, - MFIE_TYPE_POWER_CONSTRAINT = 32, - MFIE_TYPE_POWER_CAPABILITY = 33, - MFIE_TYPE_TPC_REQUEST = 34, - MFIE_TYPE_TPC_REPORT = 35, - MFIE_TYPE_SUPP_CHANNELS = 36, - MFIE_TYPE_CSA = 37, - MFIE_TYPE_MEASURE_REQUEST = 38, - MFIE_TYPE_MEASURE_REPORT = 39, - MFIE_TYPE_QUIET = 40, - MFIE_TYPE_IBSS_DFS = 41, - MFIE_TYPE_ERP = 42, - MFIE_TYPE_RSN = 48, - MFIE_TYPE_RATES_EX = 50, - MFIE_TYPE_HT_CAP= 45, + MFIE_TYPE_SSID = 0, + MFIE_TYPE_RATES = 1, + MFIE_TYPE_FH_SET = 2, + MFIE_TYPE_DS_SET = 3, + MFIE_TYPE_CF_SET = 4, + MFIE_TYPE_TIM = 5, + MFIE_TYPE_IBSS_SET = 6, + MFIE_TYPE_COUNTRY = 7, + MFIE_TYPE_HOP_PARAMS = 8, + MFIE_TYPE_HOP_TABLE = 9, + MFIE_TYPE_REQUEST = 10, + MFIE_TYPE_CHALLENGE = 16, + MFIE_TYPE_POWER_CONSTRAINT = 32, + MFIE_TYPE_POWER_CAPABILITY = 33, + MFIE_TYPE_TPC_REQUEST = 34, + MFIE_TYPE_TPC_REPORT = 35, + MFIE_TYPE_SUPP_CHANNELS = 36, + MFIE_TYPE_CSA = 37, + MFIE_TYPE_MEASURE_REQUEST = 38, + MFIE_TYPE_MEASURE_REPORT = 39, + MFIE_TYPE_QUIET = 40, + MFIE_TYPE_IBSS_DFS = 41, + MFIE_TYPE_ERP = 42, + MFIE_TYPE_RSN = 48, + MFIE_TYPE_RATES_EX = 50, + MFIE_TYPE_HT_CAP= 45, MFIE_TYPE_HT_INFO= 61, MFIE_TYPE_AIRONET=133, - MFIE_TYPE_GENERIC = 221, - MFIE_TYPE_QOS_PARAMETER = 222, + MFIE_TYPE_GENERIC = 221, + MFIE_TYPE_QOS_PARAMETER = 222, }; /* Minimal header; can be used for passing 802.11 frames with sufficient * information to determine what type of underlying data type is actually * stored in the data. */ struct ieee80211_hdr { - __le16 frame_ctl; - __le16 duration_id; - u8 payload[0]; + __le16 frame_ctl; + __le16 duration_id; + u8 payload[0]; } __attribute__ ((packed)); struct ieee80211_hdr_1addr { - __le16 frame_ctl; - __le16 duration_id; - u8 addr1[ETH_ALEN]; - u8 payload[0]; + __le16 frame_ctl; + __le16 duration_id; + u8 addr1[ETH_ALEN]; + u8 payload[0]; } __attribute__ ((packed)); struct ieee80211_hdr_2addr { - __le16 frame_ctl; - __le16 duration_id; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; - u8 payload[0]; + __le16 frame_ctl; + __le16 duration_id; + u8 addr1[ETH_ALEN]; + u8 addr2[ETH_ALEN]; + u8 payload[0]; } __attribute__ ((packed)); struct ieee80211_hdr_3addr { @@ -1152,7 +1152,7 @@ struct ieee80211_hdr_3addr { u8 addr2[ETH_ALEN]; u8 addr3[ETH_ALEN]; __le16 seq_ctl; - u8 payload[0]; + u8 payload[0]; } __attribute__ ((packed)); struct ieee80211_hdr_4addr { @@ -1163,7 +1163,7 @@ struct ieee80211_hdr_4addr { u8 addr3[ETH_ALEN]; __le16 seq_ctl; u8 addr4[ETH_ALEN]; - u8 payload[0]; + u8 payload[0]; } __attribute__ ((packed)); struct ieee80211_hdr_3addrqos { @@ -1173,7 +1173,7 @@ struct ieee80211_hdr_3addrqos { u8 addr2[ETH_ALEN]; u8 addr3[ETH_ALEN]; __le16 seq_ctl; - u8 payload[0]; + u8 payload[0]; __le16 qos_ctl; } __attribute__ ((packed)); @@ -1185,7 +1185,7 @@ struct ieee80211_hdr_4addrqos { u8 addr3[ETH_ALEN]; __le16 seq_ctl; u8 addr4[ETH_ALEN]; - u8 payload[0]; + u8 payload[0]; __le16 qos_ctl; } __attribute__ ((packed)); @@ -1205,14 +1205,14 @@ struct ieee80211_authentication { } __attribute__ ((packed)); struct ieee80211_disassoc { - struct ieee80211_hdr_3addr header; - __le16 reason; + struct ieee80211_hdr_3addr header; + __le16 reason; } __attribute__ ((packed)); struct ieee80211_probe_request { struct ieee80211_hdr_3addr header; /* SSID, supported rates */ - struct ieee80211_info_element info_element[0]; + struct ieee80211_info_element info_element[0]; } __attribute__ ((packed)); struct ieee80211_probe_response { @@ -1220,9 +1220,9 @@ struct ieee80211_probe_response { u32 time_stamp[2]; __le16 beacon_interval; __le16 capability; - /* SSID, supported rates, FH params, DS params, - * CF params, IBSS params, TIM (if beacon), RSN */ - struct ieee80211_info_element info_element[0]; + /* SSID, supported rates, FH params, DS params, + * CF params, IBSS params, TIM (if beacon), RSN */ + struct ieee80211_info_element info_element[0]; } __attribute__ ((packed)); /* Alias beacon for probe_response */ @@ -1233,7 +1233,7 @@ struct ieee80211_assoc_request_frame { __le16 capability; __le16 listen_interval; /* SSID, supported rates, RSN */ - struct ieee80211_info_element info_element[0]; + struct ieee80211_info_element info_element[0]; } __attribute__ ((packed)); struct ieee80211_reassoc_request_frame { @@ -1242,7 +1242,7 @@ struct ieee80211_reassoc_request_frame { __le16 listen_interval; u8 current_ap[ETH_ALEN]; /* SSID, supported rates, RSN */ - struct ieee80211_info_element info_element[0]; + struct ieee80211_info_element info_element[0]; } __attribute__ ((packed)); struct ieee80211_assoc_response_frame { @@ -1318,7 +1318,7 @@ typedef union _frameqos { #define NETWORK_HAS_QOS_PARAMETERS (1<<3) #define NETWORK_HAS_QOS_INFORMATION (1<<4) #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \ - NETWORK_HAS_QOS_INFORMATION) + NETWORK_HAS_QOS_INFORMATION) /* 802.11h */ #define NETWORK_HAS_POWER_CONSTRAINT (1<<5) #define NETWORK_HAS_CSA (1<<6) @@ -1338,46 +1338,46 @@ typedef union _frameqos { #define QOS_AIFSN_MIN_VALUE 2 #if 1 struct ieee80211_qos_information_element { - u8 elementID; - u8 length; - u8 qui[QOS_OUI_LEN]; - u8 qui_type; - u8 qui_subtype; - u8 version; - u8 ac_info; + u8 elementID; + u8 length; + u8 qui[QOS_OUI_LEN]; + u8 qui_type; + u8 qui_subtype; + u8 version; + u8 ac_info; } __attribute__ ((packed)); struct ieee80211_qos_ac_parameter { - u8 aci_aifsn; - u8 ecw_min_max; - __le16 tx_op_limit; + u8 aci_aifsn; + u8 ecw_min_max; + __le16 tx_op_limit; } __attribute__ ((packed)); struct ieee80211_qos_parameter_info { - struct ieee80211_qos_information_element info_element; - u8 reserved; - struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM]; + struct ieee80211_qos_information_element info_element; + u8 reserved; + struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM]; } __attribute__ ((packed)); struct ieee80211_qos_parameters { - __le16 cw_min[QOS_QUEUE_NUM]; - __le16 cw_max[QOS_QUEUE_NUM]; - u8 aifs[QOS_QUEUE_NUM]; - u8 flag[QOS_QUEUE_NUM]; - __le16 tx_op_limit[QOS_QUEUE_NUM]; + __le16 cw_min[QOS_QUEUE_NUM]; + __le16 cw_max[QOS_QUEUE_NUM]; + u8 aifs[QOS_QUEUE_NUM]; + u8 flag[QOS_QUEUE_NUM]; + __le16 tx_op_limit[QOS_QUEUE_NUM]; } __attribute__ ((packed)); struct ieee80211_qos_data { - struct ieee80211_qos_parameters parameters; - int active; - int supported; - u8 param_count; - u8 old_param_count; + struct ieee80211_qos_parameters parameters; + int active; + int supported; + u8 param_count; + u8 old_param_count; }; struct ieee80211_tim_parameters { - u8 tim_count; - u8 tim_period; + u8 tim_count; + u8 tim_period; } __attribute__ ((packed)); //#else @@ -1598,10 +1598,10 @@ struct ieee80211_network { u8 ssid[IW_ESSID_MAX_SIZE + 1]; u8 ssid_len; #if 1 - struct ieee80211_qos_data qos_data; + struct ieee80211_qos_data qos_data; #else // Qos related. Added by Annie, 2005-11-01. - BSS_QOS BssQos; + BSS_QOS BssQos; #endif //added by amy for LEAP bool bWithAironetIE; @@ -1636,15 +1636,15 @@ struct ieee80211_network { u8 rsn_ie[MAX_WPA_IE_LEN]; size_t rsn_ie_len; - struct ieee80211_tim_parameters tim; + struct ieee80211_tim_parameters tim; u8 dtim_period; u8 dtim_data; u32 last_dtim_sta_time[2]; - //appeded for QoS - u8 wmm_info; - struct ieee80211_wmm_ac_param wmm_param[4]; - u8 QoS_Enable; + //appeded for QoS + u8 wmm_info; + struct ieee80211_wmm_ac_param wmm_param[4]; + u8 QoS_Enable; #ifdef THOMAS_TURBO u8 Turbo_Enable;//enable turbo mode, added by thomas #endif @@ -1652,7 +1652,7 @@ struct ieee80211_network { u16 CountryIeLen; u8 CountryIeBuf[MAX_IE_LEN]; #endif - // HT Related, by amy, 2008.04.29 + // HT Related, by amy, 2008.04.29 BSS_HT bssht; // Add to handle broadcom AP management frame CCK rate. bool broadcom_cap_exist; @@ -1708,13 +1708,13 @@ enum ieee80211_state { }; #else enum ieee80211_state { - IEEE80211_UNINITIALIZED = 0, - IEEE80211_INITIALIZED, - IEEE80211_ASSOCIATING, - IEEE80211_ASSOCIATED, - IEEE80211_AUTHENTICATING, - IEEE80211_AUTHENTICATED, - IEEE80211_SHUTDOWN + IEEE80211_UNINITIALIZED = 0, + IEEE80211_INITIALIZED, + IEEE80211_ASSOCIATING, + IEEE80211_ASSOCIATED, + IEEE80211_AUTHENTICATING, + IEEE80211_AUTHENTICATED, + IEEE80211_SHUTDOWN }; #endif @@ -1728,17 +1728,17 @@ enum ieee80211_state { #define IEEE80211_24GHZ_MIN_CHANNEL 1 #define IEEE80211_24GHZ_MAX_CHANNEL 14 #define IEEE80211_24GHZ_CHANNELS (IEEE80211_24GHZ_MAX_CHANNEL - \ - IEEE80211_24GHZ_MIN_CHANNEL + 1) + IEEE80211_24GHZ_MIN_CHANNEL + 1) #define IEEE80211_52GHZ_MIN_CHANNEL 34 #define IEEE80211_52GHZ_MAX_CHANNEL 165 #define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \ - IEEE80211_52GHZ_MIN_CHANNEL + 1) + IEEE80211_52GHZ_MIN_CHANNEL + 1) #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11)) extern inline int is_multicast_ether_addr(const u8 *addr) { - return ((addr[0] != 0xff) && (0x01 & addr[0])); + return ((addr[0] != 0xff) && (0x01 & addr[0])); } #endif @@ -1910,7 +1910,7 @@ typedef struct _RT_LINK_DETECT_T{ struct ieee80211_device { struct net_device *dev; - struct ieee80211_security sec; + struct ieee80211_security sec; //hw security related // u8 hwsec_support; //support? @@ -2000,15 +2000,15 @@ struct ieee80211_device { int host_encrypt; int host_encrypt_msdu; int host_decrypt; - /* host performs multicast decryption */ - int host_mc_decrypt; + /* host performs multicast decryption */ + int host_mc_decrypt; - /* host should strip IV and ICV from protected frames */ - /* meaningful only when hardware decryption is being used */ - int host_strip_iv_icv; + /* host should strip IV and ICV from protected frames */ + /* meaningful only when hardware decryption is being used */ + int host_strip_iv_icv; - int host_open_frag; - int host_build_iv; + int host_open_frag; + int host_build_iv; int ieee802_1x; /* is IEEE 802.1X used */ /* WPA data */ @@ -2026,7 +2026,7 @@ struct ieee80211_device { struct ieee80211_crypt_data *crypt[WEP_KEYS]; int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */ struct timer_list crypt_deinit_timer; - int crypt_quiesced; + int crypt_quiesced; int bcrx_sta_key; /* use individual keys to override default keys even * with RX of broad/multicast frames */ @@ -2039,10 +2039,10 @@ struct ieee80211_device { #define DEFAULT_RTS_THRESHOLD 2346U #define MIN_RTS_THRESHOLD 1 #define MAX_RTS_THRESHOLD 2346U - u16 rts; /* RTS threshold */ + u16 rts; /* RTS threshold */ - /* Association info */ - u8 bssid[ETH_ALEN]; + /* Association info */ + u8 bssid[ETH_ALEN]; /* This stores infos for the current network. * Either the network we are associated in INFRASTRUCTURE @@ -2068,10 +2068,10 @@ struct ieee80211_device { */ short sync_scan_hurryup; - int perfect_rssi; - int worst_rssi; + int perfect_rssi; + int worst_rssi; - u16 prev_seq_ctl; /* used to drop duplicate frames */ + u16 prev_seq_ctl; /* used to drop duplicate frames */ /* map of allowed channels. 0 is dummy */ // FIXME: remeber to default to a basic channel plan depending of the PHY type @@ -2184,7 +2184,7 @@ struct ieee80211_device { //added by amy for AP roaming RT_LINK_DETECT_T LinkDetectInfo; - //added by amy for ps + //added by amy for ps RT_POWER_SAVE_CONTROL PowerSaveControl; //} /* used if IEEE_SOFTMAC_TX_QUEUE is set */ @@ -2196,19 +2196,19 @@ struct ieee80211_device { /* used if IEEE_SOFTMAC_BEACONS is set */ struct timer_list beacon_timer; #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) - struct work_struct associate_complete_wq; - struct work_struct associate_procedure_wq; + struct work_struct associate_complete_wq; + struct work_struct associate_procedure_wq; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) - struct delayed_work softmac_scan_wq; - struct delayed_work associate_retry_wq; + struct delayed_work softmac_scan_wq; + struct delayed_work associate_retry_wq; struct delayed_work start_ibss_wq; #else - struct work_struct softmac_scan_wq; - struct work_struct associate_retry_wq; + struct work_struct softmac_scan_wq; + struct work_struct associate_retry_wq; struct work_struct start_ibss_wq; #endif - struct work_struct wx_sync_scan_wq; - struct workqueue_struct *wq; + struct work_struct wx_sync_scan_wq; + struct workqueue_struct *wq; #else /* used for periodly scan */ struct timer_list scan_timer; @@ -2221,10 +2221,10 @@ struct ieee80211_device { struct tq_struct wx_sync_scan_wq; #endif - // Qos related. Added by Annie, 2005-11-01. - //STA_QOS StaQos; + // Qos related. Added by Annie, 2005-11-01. + //STA_QOS StaQos; - //u32 STA_EDCA_PARAM[4]; + //u32 STA_EDCA_PARAM[4]; //CHANNEL_ACCESS_SETTING ChannelAccessSetting; @@ -2240,11 +2240,11 @@ struct ieee80211_device { struct net_device *dev); int (*reset_port)(struct net_device *dev); - int (*is_queue_full) (struct net_device * dev, int pri); + int (*is_queue_full) (struct net_device * dev, int pri); - int (*handle_management) (struct net_device * dev, - struct ieee80211_network * network, u16 type); - int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb); + int (*handle_management) (struct net_device * dev, + struct ieee80211_network * network, u16 type); + int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb); /* Softmac-generated frames (mamagement) are TXed via this * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is @@ -2322,32 +2322,32 @@ struct ieee80211_device { short (*ps_is_queue_empty) (struct net_device *dev); #if 0 /* Typical STA methods */ - int (*handle_auth) (struct net_device * dev, - struct ieee80211_auth * auth); - int (*handle_deauth) (struct net_device * dev, - struct ieee80211_deauth * auth); - int (*handle_action) (struct net_device * dev, - struct ieee80211_action * action, - struct ieee80211_rx_stats * stats); - int (*handle_disassoc) (struct net_device * dev, - struct ieee80211_disassoc * assoc); + int (*handle_auth) (struct net_device * dev, + struct ieee80211_auth * auth); + int (*handle_deauth) (struct net_device * dev, + struct ieee80211_deauth * auth); + int (*handle_action) (struct net_device * dev, + struct ieee80211_action * action, + struct ieee80211_rx_stats * stats); + int (*handle_disassoc) (struct net_device * dev, + struct ieee80211_disassoc * assoc); #endif - int (*handle_beacon) (struct net_device * dev, struct ieee80211_beacon * beacon, struct ieee80211_network * network); + int (*handle_beacon) (struct net_device * dev, struct ieee80211_beacon * beacon, struct ieee80211_network * network); #if 0 - int (*handle_probe_response) (struct net_device * dev, - struct ieee80211_probe_response * resp, - struct ieee80211_network * network); - int (*handle_probe_request) (struct net_device * dev, - struct ieee80211_probe_request * req, - struct ieee80211_rx_stats * stats); + int (*handle_probe_response) (struct net_device * dev, + struct ieee80211_probe_response * resp, + struct ieee80211_network * network); + int (*handle_probe_request) (struct net_device * dev, + struct ieee80211_probe_request * req, + struct ieee80211_rx_stats * stats); #endif - int (*handle_assoc_response) (struct net_device * dev, struct ieee80211_assoc_response_frame * resp, struct ieee80211_network * network); + int (*handle_assoc_response) (struct net_device * dev, struct ieee80211_assoc_response_frame * resp, struct ieee80211_network * network); #if 0 - /* Typical AP methods */ - int (*handle_assoc_request) (struct net_device * dev); - int (*handle_reassoc_request) (struct net_device * dev, - struct ieee80211_reassoc_request * req); + /* Typical AP methods */ + int (*handle_assoc_request) (struct net_device * dev); + int (*handle_reassoc_request) (struct net_device * dev, + struct ieee80211_reassoc_request * req); #endif /* check whether Tx hw resouce available */ @@ -2484,45 +2484,45 @@ extern inline int ieee80211_get_hdrlen(u16 fc) static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr) { - switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) { - case IEEE80211_1ADDR_LEN: - return ((struct ieee80211_hdr_1addr *)hdr)->payload; - case IEEE80211_2ADDR_LEN: - return ((struct ieee80211_hdr_2addr *)hdr)->payload; - case IEEE80211_3ADDR_LEN: - return ((struct ieee80211_hdr_3addr *)hdr)->payload; - case IEEE80211_4ADDR_LEN: - return ((struct ieee80211_hdr_4addr *)hdr)->payload; - } - return NULL; + switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) { + case IEEE80211_1ADDR_LEN: + return ((struct ieee80211_hdr_1addr *)hdr)->payload; + case IEEE80211_2ADDR_LEN: + return ((struct ieee80211_hdr_2addr *)hdr)->payload; + case IEEE80211_3ADDR_LEN: + return ((struct ieee80211_hdr_3addr *)hdr)->payload; + case IEEE80211_4ADDR_LEN: + return ((struct ieee80211_hdr_4addr *)hdr)->payload; + } + return NULL; } static inline int ieee80211_is_ofdm_rate(u8 rate) { - switch (rate & ~IEEE80211_BASIC_RATE_MASK) { - case IEEE80211_OFDM_RATE_6MB: - case IEEE80211_OFDM_RATE_9MB: - case IEEE80211_OFDM_RATE_12MB: - case IEEE80211_OFDM_RATE_18MB: - case IEEE80211_OFDM_RATE_24MB: - case IEEE80211_OFDM_RATE_36MB: - case IEEE80211_OFDM_RATE_48MB: - case IEEE80211_OFDM_RATE_54MB: - return 1; - } - return 0; + switch (rate & ~IEEE80211_BASIC_RATE_MASK) { + case IEEE80211_OFDM_RATE_6MB: + case IEEE80211_OFDM_RATE_9MB: + case IEEE80211_OFDM_RATE_12MB: + case IEEE80211_OFDM_RATE_18MB: + case IEEE80211_OFDM_RATE_24MB: + case IEEE80211_OFDM_RATE_36MB: + case IEEE80211_OFDM_RATE_48MB: + case IEEE80211_OFDM_RATE_54MB: + return 1; + } + return 0; } static inline int ieee80211_is_cck_rate(u8 rate) { - switch (rate & ~IEEE80211_BASIC_RATE_MASK) { - case IEEE80211_CCK_RATE_1MB: - case IEEE80211_CCK_RATE_2MB: - case IEEE80211_CCK_RATE_5MB: - case IEEE80211_CCK_RATE_11MB: - return 1; - } - return 0; + switch (rate & ~IEEE80211_BASIC_RATE_MASK) { + case IEEE80211_CCK_RATE_1MB: + case IEEE80211_CCK_RATE_2MB: + case IEEE80211_CCK_RATE_5MB: + case IEEE80211_CCK_RATE_11MB: + return 1; + } + return 0; } @@ -2563,17 +2563,17 @@ extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee, union iwreq_data *wrqu, char *key); #if WIRELESS_EXT >= 18 extern int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data* wrqu, char *extra); + struct iw_request_info *info, + union iwreq_data* wrqu, char *extra); extern int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data* wrqu, char *extra); + struct iw_request_info *info, + union iwreq_data* wrqu, char *extra); extern int ieee80211_wx_set_auth(struct ieee80211_device *ieee, - struct iw_request_info *info, - struct iw_param *data, char *extra); + struct iw_request_info *info, + struct iw_param *data, char *extra); extern int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); #endif extern int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len); @@ -2730,13 +2730,13 @@ extern void RxBaInactTimeout(unsigned long data); extern void ResetBaEntry( PBA_RECORD pBA); //function in TS.c extern bool GetTs( - struct ieee80211_device* ieee, - PTS_COMMON_INFO *ppTS, - u8* Addr, - u8 TID, - TR_SELECT TxRxSelect, //Rx:1, Tx:0 - bool bAddNewTs - ); + struct ieee80211_device* ieee, + PTS_COMMON_INFO *ppTS, + u8* Addr, + u8 TID, + TR_SELECT TxRxSelect, //Rx:1, Tx:0 + bool bAddNewTs + ); extern void TSInitialize(struct ieee80211_device *ieee); extern void TsStartAddBaProcess(struct ieee80211_device* ieee, PTX_TS_RECORD pTxTS); extern void RemovePeerTS(struct ieee80211_device* ieee, u8* Addr); diff --git a/drivers/staging/rtl8192u/ieee80211/aes.c b/drivers/staging/rtl8192u/ieee80211/aes.c index 0c176e29a797..a6bb6c9207d3 100644 --- a/drivers/staging/rtl8192u/ieee80211/aes.c +++ b/drivers/staging/rtl8192u/ieee80211/aes.c @@ -126,15 +126,15 @@ f_mult (u8 a, u8 b) #define f_rn(bo, bi, n, k) \ bo[n] = ft_tab[0][byte(bi[n],0)] ^ \ - ft_tab[1][byte(bi[(n + 1) & 3],1)] ^ \ - ft_tab[2][byte(bi[(n + 2) & 3],2)] ^ \ - ft_tab[3][byte(bi[(n + 3) & 3],3)] ^ *(k + n) + ft_tab[1][byte(bi[(n + 1) & 3],1)] ^ \ + ft_tab[2][byte(bi[(n + 2) & 3],2)] ^ \ + ft_tab[3][byte(bi[(n + 3) & 3],3)] ^ *(k + n) #define i_rn(bo, bi, n, k) \ bo[n] = it_tab[0][byte(bi[n],0)] ^ \ - it_tab[1][byte(bi[(n + 3) & 3],1)] ^ \ - it_tab[2][byte(bi[(n + 2) & 3],2)] ^ \ - it_tab[3][byte(bi[(n + 1) & 3],3)] ^ *(k + n) + it_tab[1][byte(bi[(n + 3) & 3],1)] ^ \ + it_tab[2][byte(bi[(n + 2) & 3],2)] ^ \ + it_tab[3][byte(bi[(n + 1) & 3],3)] ^ *(k + n) #define ls_box(x) \ ( fl_tab[0][byte(x, 0)] ^ \ @@ -144,15 +144,15 @@ f_mult (u8 a, u8 b) #define f_rl(bo, bi, n, k) \ bo[n] = fl_tab[0][byte(bi[n],0)] ^ \ - fl_tab[1][byte(bi[(n + 1) & 3],1)] ^ \ - fl_tab[2][byte(bi[(n + 2) & 3],2)] ^ \ - fl_tab[3][byte(bi[(n + 3) & 3],3)] ^ *(k + n) + fl_tab[1][byte(bi[(n + 1) & 3],1)] ^ \ + fl_tab[2][byte(bi[(n + 2) & 3],2)] ^ \ + fl_tab[3][byte(bi[(n + 3) & 3],3)] ^ *(k + n) #define i_rl(bo, bi, n, k) \ bo[n] = il_tab[0][byte(bi[n],0)] ^ \ - il_tab[1][byte(bi[(n + 3) & 3],1)] ^ \ - il_tab[2][byte(bi[(n + 2) & 3],2)] ^ \ - il_tab[3][byte(bi[(n + 1) & 3],3)] ^ *(k + n) + il_tab[1][byte(bi[(n + 3) & 3],1)] ^ \ + il_tab[2][byte(bi[(n + 2) & 3],2)] ^ \ + il_tab[3][byte(bi[(n + 1) & 3],3)] ^ *(k + n) static void __init gen_tabs (void) @@ -234,8 +234,8 @@ gen_tabs (void) t = w ^ (x); \ (y) = u ^ v ^ w; \ (y) ^= rotr(u ^ t, 8) ^ \ - rotr(v ^ t, 16) ^ \ - rotr(t,24) + rotr(v ^ t, 16) ^ \ + rotr(t,24) /* initialise the key schedule from the user supplied key */ @@ -443,9 +443,9 @@ static struct crypto_alg aes_alg = { .cipher = { .cia_min_keysize = AES_MIN_KEY_SIZE, .cia_max_keysize = AES_MAX_KEY_SIZE, - .cia_setkey = aes_set_key, - .cia_encrypt = aes_encrypt, - .cia_decrypt = aes_decrypt + .cia_setkey = aes_set_key, + .cia_encrypt = aes_encrypt, + .cia_decrypt = aes_decrypt } } }; diff --git a/drivers/staging/rtl8192u/ieee80211/arc4.c b/drivers/staging/rtl8192u/ieee80211/arc4.c index e408472af305..e3ad8d2f415e 100644 --- a/drivers/staging/rtl8192u/ieee80211/arc4.c +++ b/drivers/staging/rtl8192u/ieee80211/arc4.c @@ -79,9 +79,9 @@ static struct crypto_alg arc4_alg = { .cra_u = { .cipher = { .cia_min_keysize = ARC4_MIN_KEY_SIZE, .cia_max_keysize = ARC4_MAX_KEY_SIZE, - .cia_setkey = arc4_set_key, - .cia_encrypt = arc4_crypt, - .cia_decrypt = arc4_crypt } } + .cia_setkey = arc4_set_key, + .cia_encrypt = arc4_crypt, + .cia_decrypt = arc4_crypt } } }; static int __init arc4_init(void) diff --git a/drivers/staging/rtl8192u/ieee80211/cipher.c b/drivers/staging/rtl8192u/ieee80211/cipher.c index 1968acfe32b1..0b9e8a4ae7b5 100644 --- a/drivers/staging/rtl8192u/ieee80211/cipher.c +++ b/drivers/staging/rtl8192u/ieee80211/cipher.c @@ -23,7 +23,7 @@ typedef void (cryptfn_t)(void *, u8 *, const u8 *); typedef void (procfn_t)(struct crypto_tfm *, u8 *, - u8*, cryptfn_t, int enc, void *, int); + u8*, cryptfn_t, int enc, void *, int); static inline void xor_64(u8 *a, const u8 *b) { @@ -48,8 +48,8 @@ static inline void xor_128(u8 *a, const u8 *b) static int crypt(struct crypto_tfm *tfm, struct scatterlist *dst, struct scatterlist *src, - unsigned int nbytes, cryptfn_t crfn, - procfn_t prfn, int enc, void *info) + unsigned int nbytes, cryptfn_t crfn, + procfn_t prfn, int enc, void *info) { struct scatter_walk walk_in, walk_out; const unsigned int bsize = crypto_tfm_alg_blocksize(tfm); @@ -136,80 +136,80 @@ static int setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) return -EINVAL; } else return cia->cia_setkey(crypto_tfm_ctx(tfm), key, keylen, - &tfm->crt_flags); + &tfm->crt_flags); } static int ecb_encrypt(struct crypto_tfm *tfm, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) + struct scatterlist *src, unsigned int nbytes) { return crypt(tfm, dst, src, nbytes, - tfm->__crt_alg->cra_cipher.cia_encrypt, - ecb_process, 1, NULL); + tfm->__crt_alg->cra_cipher.cia_encrypt, + ecb_process, 1, NULL); } static int ecb_decrypt(struct crypto_tfm *tfm, - struct scatterlist *dst, - struct scatterlist *src, + struct scatterlist *dst, + struct scatterlist *src, unsigned int nbytes) { return crypt(tfm, dst, src, nbytes, - tfm->__crt_alg->cra_cipher.cia_decrypt, - ecb_process, 1, NULL); + tfm->__crt_alg->cra_cipher.cia_decrypt, + ecb_process, 1, NULL); } static int cbc_encrypt(struct crypto_tfm *tfm, - struct scatterlist *dst, - struct scatterlist *src, + struct scatterlist *dst, + struct scatterlist *src, unsigned int nbytes) { return crypt(tfm, dst, src, nbytes, - tfm->__crt_alg->cra_cipher.cia_encrypt, - cbc_process, 1, tfm->crt_cipher.cit_iv); + tfm->__crt_alg->cra_cipher.cia_encrypt, + cbc_process, 1, tfm->crt_cipher.cit_iv); } static int cbc_encrypt_iv(struct crypto_tfm *tfm, - struct scatterlist *dst, - struct scatterlist *src, - unsigned int nbytes, u8 *iv) + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes, u8 *iv) { return crypt(tfm, dst, src, nbytes, - tfm->__crt_alg->cra_cipher.cia_encrypt, - cbc_process, 1, iv); + tfm->__crt_alg->cra_cipher.cia_encrypt, + cbc_process, 1, iv); } static int cbc_decrypt(struct crypto_tfm *tfm, - struct scatterlist *dst, - struct scatterlist *src, + struct scatterlist *dst, + struct scatterlist *src, unsigned int nbytes) { return crypt(tfm, dst, src, nbytes, - tfm->__crt_alg->cra_cipher.cia_decrypt, - cbc_process, 0, tfm->crt_cipher.cit_iv); + tfm->__crt_alg->cra_cipher.cia_decrypt, + cbc_process, 0, tfm->crt_cipher.cit_iv); } static int cbc_decrypt_iv(struct crypto_tfm *tfm, - struct scatterlist *dst, - struct scatterlist *src, - unsigned int nbytes, u8 *iv) + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes, u8 *iv) { return crypt(tfm, dst, src, nbytes, - tfm->__crt_alg->cra_cipher.cia_decrypt, - cbc_process, 0, iv); + tfm->__crt_alg->cra_cipher.cia_decrypt, + cbc_process, 0, iv); } static int nocrypt(struct crypto_tfm *tfm, - struct scatterlist *dst, - struct scatterlist *src, + struct scatterlist *dst, + struct scatterlist *src, unsigned int nbytes) { return -ENOSYS; } static int nocrypt_iv(struct crypto_tfm *tfm, - struct scatterlist *dst, - struct scatterlist *src, - unsigned int nbytes, u8 *iv) + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes, u8 *iv) { return -ENOSYS; } @@ -265,25 +265,25 @@ int crypto_init_cipher_ops(struct crypto_tfm *tfm) if (ops->cit_mode == CRYPTO_TFM_MODE_CBC) { - switch (crypto_tfm_alg_blocksize(tfm)) { - case 8: - ops->cit_xor_block = xor_64; - break; + switch (crypto_tfm_alg_blocksize(tfm)) { + case 8: + ops->cit_xor_block = xor_64; + break; - case 16: - ops->cit_xor_block = xor_128; - break; + case 16: + ops->cit_xor_block = xor_128; + break; - default: - printk(KERN_WARNING "%s: block size %u not supported\n", - crypto_tfm_alg_name(tfm), - crypto_tfm_alg_blocksize(tfm)); - ret = -EINVAL; - goto out; - } + default: + printk(KERN_WARNING "%s: block size %u not supported\n", + crypto_tfm_alg_name(tfm), + crypto_tfm_alg_blocksize(tfm)); + ret = -EINVAL; + goto out; + } ops->cit_ivsize = crypto_tfm_alg_blocksize(tfm); - ops->cit_iv = kmalloc(ops->cit_ivsize, GFP_KERNEL); + ops->cit_iv = kmalloc(ops->cit_ivsize, GFP_KERNEL); if (ops->cit_iv == NULL) ret = -ENOMEM; } diff --git a/drivers/staging/rtl8192u/ieee80211/compress.c b/drivers/staging/rtl8192u/ieee80211/compress.c index c2df80e2ed9d..86c23c9223f2 100644 --- a/drivers/staging/rtl8192u/ieee80211/compress.c +++ b/drivers/staging/rtl8192u/ieee80211/compress.c @@ -20,21 +20,21 @@ #include "internal.h" static int crypto_compress(struct crypto_tfm *tfm, - const u8 *src, unsigned int slen, - u8 *dst, unsigned int *dlen) + const u8 *src, unsigned int slen, + u8 *dst, unsigned int *dlen) { return tfm->__crt_alg->cra_compress.coa_compress(crypto_tfm_ctx(tfm), - src, slen, dst, - dlen); + src, slen, dst, + dlen); } static int crypto_decompress(struct crypto_tfm *tfm, - const u8 *src, unsigned int slen, - u8 *dst, unsigned int *dlen) + const u8 *src, unsigned int slen, + u8 *dst, unsigned int *dlen) { return tfm->__crt_alg->cra_compress.coa_decompress(crypto_tfm_ctx(tfm), - src, slen, dst, - dlen); + src, slen, dst, + dlen); } int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags) diff --git a/drivers/staging/rtl8192u/ieee80211/crypto_compat.h b/drivers/staging/rtl8192u/ieee80211/crypto_compat.h index 587e8bb2db6a..c7f26ffa2485 100644 --- a/drivers/staging/rtl8192u/ieee80211/crypto_compat.h +++ b/drivers/staging/rtl8192u/ieee80211/crypto_compat.h @@ -12,9 +12,9 @@ #include static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm, - struct scatterlist *dst, - struct scatterlist *src, - unsigned int nbytes) + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes) { BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes); @@ -22,9 +22,9 @@ static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm, static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm, - struct scatterlist *dst, - struct scatterlist *src, - unsigned int nbytes) + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes) { BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes); diff --git a/drivers/staging/rtl8192u/ieee80211/digest.c b/drivers/staging/rtl8192u/ieee80211/digest.c index 1a95f2d37837..301ed514ac9e 100644 --- a/drivers/staging/rtl8192u/ieee80211/digest.c +++ b/drivers/staging/rtl8192u/ieee80211/digest.c @@ -25,7 +25,7 @@ static void init(struct crypto_tfm *tfm) } static void update(struct crypto_tfm *tfm, - struct scatterlist *sg, unsigned int nsg) + struct scatterlist *sg, unsigned int nsg) { unsigned int i; @@ -68,7 +68,7 @@ static int setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) } static void digest(struct crypto_tfm *tfm, - struct scatterlist *sg, unsigned int nsg, u8 *out) + struct scatterlist *sg, unsigned int nsg, u8 *out) { unsigned int i; @@ -77,7 +77,7 @@ static void digest(struct crypto_tfm *tfm, for (i = 0; i < nsg; i++) { char *p = crypto_kmap(sg[i].page, 0) + sg[i].offset; tfm->__crt_alg->cra_digest.dia_update(crypto_tfm_ctx(tfm), - p, sg[i].length); + p, sg[i].length); crypto_kunmap(p, 0); crypto_yield(tfm); } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index e99c6ede42a2..0dd773733f6b 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -86,8 +86,8 @@ struct iw_spy_data{ * */ #define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) #endif #define KEY_TYPE_NA 0x0 @@ -125,61 +125,61 @@ struct iw_spy_data{ /* defined for skb cb field */ /* At most 28 byte */ typedef struct cb_desc { - /* Tx Desc Related flags (8-9) */ + /* Tx Desc Related flags (8-9) */ u8 bLastIniPkt:1; u8 bCmdOrInit:1; - u8 bFirstSeg:1; - u8 bLastSeg:1; - u8 bEncrypt:1; - u8 bTxDisableRateFallBack:1; - u8 bTxUseDriverAssingedRate:1; - u8 bHwSec:1; //indicate whether use Hw security. WB - - u8 reserved1; - - /* Tx Firmware Relaged flags (10-11)*/ - u8 bCTSEnable:1; - u8 bRTSEnable:1; - u8 bUseShortGI:1; - u8 bUseShortPreamble:1; - u8 bTxEnableFwCalcDur:1; - u8 bAMPDUEnable:1; - u8 bRTSSTBC:1; - u8 RTSSC:1; - - u8 bRTSBW:1; - u8 bPacketBW:1; + u8 bFirstSeg:1; + u8 bLastSeg:1; + u8 bEncrypt:1; + u8 bTxDisableRateFallBack:1; + u8 bTxUseDriverAssingedRate:1; + u8 bHwSec:1; //indicate whether use Hw security. WB + + u8 reserved1; + + /* Tx Firmware Relaged flags (10-11)*/ + u8 bCTSEnable:1; + u8 bRTSEnable:1; + u8 bUseShortGI:1; + u8 bUseShortPreamble:1; + u8 bTxEnableFwCalcDur:1; + u8 bAMPDUEnable:1; + u8 bRTSSTBC:1; + u8 RTSSC:1; + + u8 bRTSBW:1; + u8 bPacketBW:1; u8 bRTSUseShortPreamble:1; u8 bRTSUseShortGI:1; u8 bMulticast:1; u8 bBroadcast:1; - //u8 reserved2:2; - u8 drv_agg_enable:1; - u8 reserved2:1; - - /* Tx Desc related element(12-19) */ - u8 rata_index; - u8 queue_index; - //u8 reserved3; - //u8 reserved4; - u16 txbuf_size; - //u8 reserved5; + //u8 reserved2:2; + u8 drv_agg_enable:1; + u8 reserved2:1; + + /* Tx Desc related element(12-19) */ + u8 rata_index; + u8 queue_index; + //u8 reserved3; + //u8 reserved4; + u16 txbuf_size; + //u8 reserved5; u8 RATRIndex; - u8 reserved6; - u8 reserved7; - u8 reserved8; - - /* Tx firmware related element(20-27) */ - u8 data_rate; - u8 rts_rate; - u8 ampdu_factor; - u8 ampdu_density; - //u8 reserved9; - //u8 reserved10; - //u8 reserved11; - u8 DrvAggrNum; + u8 reserved6; + u8 reserved7; + u8 reserved8; + + /* Tx firmware related element(20-27) */ + u8 data_rate; + u8 rts_rate; + u8 ampdu_factor; + u8 ampdu_density; + //u8 reserved9; + //u8 reserved10; + //u8 reserved11; + u8 DrvAggrNum; u16 pkt_size; - u8 reserved12; + u8 reserved12; }cb_desc, *pcb_desc; /*--------------------------Define -------------------------------------------*/ @@ -389,7 +389,7 @@ enum _ReasonCode{ typedef struct ieee_param { u32 cmd; u8 sta_addr[ETH_ALEN]; - union { + union { struct { u8 name; u32 value; @@ -399,9 +399,9 @@ typedef struct ieee_param { u8 reserved[32]; u8 data[0]; } wpa_ie; - struct{ + struct{ int command; - int reason_code; + int reason_code; } mlme; struct { u8 alg[IEEE_CRYPT_ALG_NAME_LEN]; @@ -442,23 +442,23 @@ static inline void tq_init(struct tq_struct * task, void(*func)(void *), void *d #define MSECS(t) (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000) static inline unsigned long msleep_interruptible_rsl(unsigned int msecs) { - unsigned long timeout = MSECS(msecs) + 1; + unsigned long timeout = MSECS(msecs) + 1; - while (timeout) { - set_current_state(TASK_INTERRUPTIBLE); - timeout = schedule_timeout(timeout); - } - return timeout; + while (timeout) { + set_current_state(TASK_INTERRUPTIBLE); + timeout = schedule_timeout(timeout); + } + return timeout; } #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31)) static inline void msleep(unsigned int msecs) { - unsigned long timeout = MSECS(msecs) + 1; + unsigned long timeout = MSECS(msecs) + 1; - while (timeout) { - set_current_state(TASK_UNINTERRUPTIBLE); - timeout = schedule_timeout(timeout); - } + while (timeout) { + set_current_state(TASK_UNINTERRUPTIBLE); + timeout = schedule_timeout(timeout); + } } #endif #else @@ -559,24 +559,24 @@ static inline void msleep(unsigned int msecs) #define SN_EQUAL(a, b) (a == b) #define MAX_DEV_ADDR_SIZE 8 typedef enum _ACT_CATEGORY{ - ACT_CAT_QOS = 1, - ACT_CAT_DLS = 2, - ACT_CAT_BA = 3, - ACT_CAT_HT = 7, - ACT_CAT_WMM = 17, + ACT_CAT_QOS = 1, + ACT_CAT_DLS = 2, + ACT_CAT_BA = 3, + ACT_CAT_HT = 7, + ACT_CAT_WMM = 17, } ACT_CATEGORY, *PACT_CATEGORY; typedef enum _TS_ACTION{ - ACT_ADDTSREQ = 0, - ACT_ADDTSRSP = 1, - ACT_DELTS = 2, - ACT_SCHEDULE = 3, + ACT_ADDTSREQ = 0, + ACT_ADDTSRSP = 1, + ACT_DELTS = 2, + ACT_SCHEDULE = 3, } TS_ACTION, *PTS_ACTION; typedef enum _BA_ACTION{ - ACT_ADDBAREQ = 0, - ACT_ADDBARSP = 1, - ACT_DELBA = 2, + ACT_ADDBAREQ = 0, + ACT_ADDBARSP = 1, + ACT_DELBA = 2, } BA_ACTION, *PBA_ACTION; typedef enum _InitialGainOpType{ @@ -687,22 +687,22 @@ do { if (ieee80211_debug_level & (level)) \ /* I want to see ASCII 33 to 126 only. Otherwise, I print '?'. Annie, 2005-11-22.*/ #define PRINTABLE(_ch) (_ch>'!' && _ch<'~') #define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) \ - if((_Comp) & level) \ - { \ - int __i; \ - u8 buffer[MAX_STR_LEN]; \ - int length = (_Len\n", _Len, buffer); \ - } + if((_Comp) & level) \ + { \ + int __i; \ + u8 buffer[MAX_STR_LEN]; \ + int length = (_Len\n", _Len, buffer); \ + } #else #define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) do {} while (0) #endif @@ -731,10 +731,10 @@ do { if (ieee80211_debug_level & (level)) \ struct ieee80211_snap_hdr { - u8 dsap; /* always 0xAA */ - u8 ssap; /* always 0xAA */ - u8 ctrl; /* always 0x03 */ - u8 oui[P80211_OUI_LEN]; /* organizational universal id */ + u8 dsap; /* always 0xAA */ + u8 ssap; /* always 0xAA */ + u8 ctrl; /* always 0x03 */ + u8 oui[P80211_OUI_LEN]; /* organizational universal id */ } __attribute__ ((packed)); @@ -775,65 +775,65 @@ struct ieee80211_snap_hdr { /* Status codes */ enum ieee80211_statuscode { - WLAN_STATUS_SUCCESS = 0, - WLAN_STATUS_UNSPECIFIED_FAILURE = 1, - WLAN_STATUS_CAPS_UNSUPPORTED = 10, - WLAN_STATUS_REASSOC_NO_ASSOC = 11, - WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12, - WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13, - WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14, - WLAN_STATUS_CHALLENGE_FAIL = 15, - WLAN_STATUS_AUTH_TIMEOUT = 16, - WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17, - WLAN_STATUS_ASSOC_DENIED_RATES = 18, - /* 802.11b */ - WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19, - WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20, - WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21, - /* 802.11h */ - WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22, - WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23, - WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24, - /* 802.11g */ - WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25, - WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26, - /* 802.11i */ - WLAN_STATUS_INVALID_IE = 40, - WLAN_STATUS_INVALID_GROUP_CIPHER = 41, - WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42, - WLAN_STATUS_INVALID_AKMP = 43, - WLAN_STATUS_UNSUPP_RSN_VERSION = 44, - WLAN_STATUS_INVALID_RSN_IE_CAP = 45, - WLAN_STATUS_CIPHER_SUITE_REJECTED = 46, + WLAN_STATUS_SUCCESS = 0, + WLAN_STATUS_UNSPECIFIED_FAILURE = 1, + WLAN_STATUS_CAPS_UNSUPPORTED = 10, + WLAN_STATUS_REASSOC_NO_ASSOC = 11, + WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12, + WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13, + WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14, + WLAN_STATUS_CHALLENGE_FAIL = 15, + WLAN_STATUS_AUTH_TIMEOUT = 16, + WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17, + WLAN_STATUS_ASSOC_DENIED_RATES = 18, + /* 802.11b */ + WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19, + WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20, + WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21, + /* 802.11h */ + WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22, + WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23, + WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24, + /* 802.11g */ + WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25, + WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26, + /* 802.11i */ + WLAN_STATUS_INVALID_IE = 40, + WLAN_STATUS_INVALID_GROUP_CIPHER = 41, + WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42, + WLAN_STATUS_INVALID_AKMP = 43, + WLAN_STATUS_UNSUPP_RSN_VERSION = 44, + WLAN_STATUS_INVALID_RSN_IE_CAP = 45, + WLAN_STATUS_CIPHER_SUITE_REJECTED = 46, }; /* Reason codes */ enum ieee80211_reasoncode { - WLAN_REASON_UNSPECIFIED = 1, - WLAN_REASON_PREV_AUTH_NOT_VALID = 2, - WLAN_REASON_DEAUTH_LEAVING = 3, - WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4, - WLAN_REASON_DISASSOC_AP_BUSY = 5, - WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6, - WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7, - WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8, - WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9, - /* 802.11h */ - WLAN_REASON_DISASSOC_BAD_POWER = 10, - WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11, - /* 802.11i */ - WLAN_REASON_INVALID_IE = 13, - WLAN_REASON_MIC_FAILURE = 14, - WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, - WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16, - WLAN_REASON_IE_DIFFERENT = 17, - WLAN_REASON_INVALID_GROUP_CIPHER = 18, - WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19, - WLAN_REASON_INVALID_AKMP = 20, - WLAN_REASON_UNSUPP_RSN_VERSION = 21, - WLAN_REASON_INVALID_RSN_IE_CAP = 22, - WLAN_REASON_IEEE8021X_FAILED = 23, - WLAN_REASON_CIPHER_SUITE_REJECTED = 24, + WLAN_REASON_UNSPECIFIED = 1, + WLAN_REASON_PREV_AUTH_NOT_VALID = 2, + WLAN_REASON_DEAUTH_LEAVING = 3, + WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4, + WLAN_REASON_DISASSOC_AP_BUSY = 5, + WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6, + WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7, + WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8, + WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9, + /* 802.11h */ + WLAN_REASON_DISASSOC_BAD_POWER = 10, + WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11, + /* 802.11i */ + WLAN_REASON_INVALID_IE = 13, + WLAN_REASON_MIC_FAILURE = 14, + WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, + WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16, + WLAN_REASON_IE_DIFFERENT = 17, + WLAN_REASON_INVALID_GROUP_CIPHER = 18, + WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19, + WLAN_REASON_INVALID_AKMP = 20, + WLAN_REASON_UNSUPP_RSN_VERSION = 21, + WLAN_REASON_INVALID_RSN_IE_CAP = 22, + WLAN_REASON_IEEE8021X_FAILED = 23, + WLAN_REASON_CIPHER_SUITE_REJECTED = 24, }; #define IEEE80211_STATMASK_SIGNAL (1<<0) @@ -849,13 +849,13 @@ enum ieee80211_reasoncode { #define IEEE80211_52GHZ_BAND (1<<1) #define IEEE80211_CCK_RATE_LEN 4 -#define IEEE80211_CCK_RATE_1MB 0x02 -#define IEEE80211_CCK_RATE_2MB 0x04 -#define IEEE80211_CCK_RATE_5MB 0x0B -#define IEEE80211_CCK_RATE_11MB 0x16 +#define IEEE80211_CCK_RATE_1MB 0x02 +#define IEEE80211_CCK_RATE_2MB 0x04 +#define IEEE80211_CCK_RATE_5MB 0x0B +#define IEEE80211_CCK_RATE_11MB 0x16 #define IEEE80211_OFDM_RATE_LEN 8 -#define IEEE80211_OFDM_RATE_6MB 0x0C -#define IEEE80211_OFDM_RATE_9MB 0x12 +#define IEEE80211_OFDM_RATE_6MB 0x0C +#define IEEE80211_OFDM_RATE_9MB 0x12 #define IEEE80211_OFDM_RATE_12MB 0x18 #define IEEE80211_OFDM_RATE_18MB 0x24 #define IEEE80211_OFDM_RATE_24MB 0x30 @@ -877,12 +877,12 @@ enum ieee80211_reasoncode { #define IEEE80211_OFDM_RATE_48MB_MASK (1<<10) #define IEEE80211_OFDM_RATE_54MB_MASK (1<<11) -#define IEEE80211_CCK_RATES_MASK 0x0000000F +#define IEEE80211_CCK_RATES_MASK 0x0000000F #define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \ IEEE80211_CCK_RATE_2MB_MASK) #define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \ - IEEE80211_CCK_RATE_5MB_MASK | \ - IEEE80211_CCK_RATE_11MB_MASK) + IEEE80211_CCK_RATE_5MB_MASK | \ + IEEE80211_CCK_RATE_11MB_MASK) #define IEEE80211_OFDM_RATES_MASK 0x00000FF0 #define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \ @@ -895,10 +895,10 @@ enum ieee80211_reasoncode { IEEE80211_OFDM_RATE_48MB_MASK | \ IEEE80211_OFDM_RATE_54MB_MASK) #define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \ - IEEE80211_CCK_DEFAULT_RATES_MASK) + IEEE80211_CCK_DEFAULT_RATES_MASK) #define IEEE80211_NUM_OFDM_RATES 8 -#define IEEE80211_NUM_CCK_RATES 4 +#define IEEE80211_NUM_CCK_RATES 4 #define IEEE80211_OFDM_SHIFT_MASK_A 4 @@ -1064,10 +1064,10 @@ struct ieee80211_device; struct ieee80211_security { u16 active_key:2, - enabled:1, + enabled:1, auth_mode:2, - auth_algo:4, - unicast_uses_group:1, + auth_algo:4, + unicast_uses_group:1, encrypt:1; u8 key_sizes[WEP_KEYS]; u8 keys[WEP_KEYS][SCM_KEY_LEN]; @@ -1089,60 +1089,60 @@ Total: 28-2340 bytes /* Management Frame Information Element Types */ enum ieee80211_mfie { - MFIE_TYPE_SSID = 0, - MFIE_TYPE_RATES = 1, - MFIE_TYPE_FH_SET = 2, - MFIE_TYPE_DS_SET = 3, - MFIE_TYPE_CF_SET = 4, - MFIE_TYPE_TIM = 5, - MFIE_TYPE_IBSS_SET = 6, - MFIE_TYPE_COUNTRY = 7, - MFIE_TYPE_HOP_PARAMS = 8, - MFIE_TYPE_HOP_TABLE = 9, - MFIE_TYPE_REQUEST = 10, - MFIE_TYPE_CHALLENGE = 16, - MFIE_TYPE_POWER_CONSTRAINT = 32, - MFIE_TYPE_POWER_CAPABILITY = 33, - MFIE_TYPE_TPC_REQUEST = 34, - MFIE_TYPE_TPC_REPORT = 35, - MFIE_TYPE_SUPP_CHANNELS = 36, - MFIE_TYPE_CSA = 37, - MFIE_TYPE_MEASURE_REQUEST = 38, - MFIE_TYPE_MEASURE_REPORT = 39, - MFIE_TYPE_QUIET = 40, - MFIE_TYPE_IBSS_DFS = 41, - MFIE_TYPE_ERP = 42, - MFIE_TYPE_RSN = 48, - MFIE_TYPE_RATES_EX = 50, - MFIE_TYPE_HT_CAP= 45, + MFIE_TYPE_SSID = 0, + MFIE_TYPE_RATES = 1, + MFIE_TYPE_FH_SET = 2, + MFIE_TYPE_DS_SET = 3, + MFIE_TYPE_CF_SET = 4, + MFIE_TYPE_TIM = 5, + MFIE_TYPE_IBSS_SET = 6, + MFIE_TYPE_COUNTRY = 7, + MFIE_TYPE_HOP_PARAMS = 8, + MFIE_TYPE_HOP_TABLE = 9, + MFIE_TYPE_REQUEST = 10, + MFIE_TYPE_CHALLENGE = 16, + MFIE_TYPE_POWER_CONSTRAINT = 32, + MFIE_TYPE_POWER_CAPABILITY = 33, + MFIE_TYPE_TPC_REQUEST = 34, + MFIE_TYPE_TPC_REPORT = 35, + MFIE_TYPE_SUPP_CHANNELS = 36, + MFIE_TYPE_CSA = 37, + MFIE_TYPE_MEASURE_REQUEST = 38, + MFIE_TYPE_MEASURE_REPORT = 39, + MFIE_TYPE_QUIET = 40, + MFIE_TYPE_IBSS_DFS = 41, + MFIE_TYPE_ERP = 42, + MFIE_TYPE_RSN = 48, + MFIE_TYPE_RATES_EX = 50, + MFIE_TYPE_HT_CAP= 45, MFIE_TYPE_HT_INFO= 61, MFIE_TYPE_AIRONET=133, - MFIE_TYPE_GENERIC = 221, - MFIE_TYPE_QOS_PARAMETER = 222, + MFIE_TYPE_GENERIC = 221, + MFIE_TYPE_QOS_PARAMETER = 222, }; /* Minimal header; can be used for passing 802.11 frames with sufficient * information to determine what type of underlying data type is actually * stored in the data. */ struct ieee80211_hdr { - __le16 frame_ctl; - __le16 duration_id; - u8 payload[0]; + __le16 frame_ctl; + __le16 duration_id; + u8 payload[0]; } __attribute__ ((packed)); struct ieee80211_hdr_1addr { - __le16 frame_ctl; - __le16 duration_id; - u8 addr1[ETH_ALEN]; - u8 payload[0]; + __le16 frame_ctl; + __le16 duration_id; + u8 addr1[ETH_ALEN]; + u8 payload[0]; } __attribute__ ((packed)); struct ieee80211_hdr_2addr { - __le16 frame_ctl; - __le16 duration_id; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; - u8 payload[0]; + __le16 frame_ctl; + __le16 duration_id; + u8 addr1[ETH_ALEN]; + u8 addr2[ETH_ALEN]; + u8 payload[0]; } __attribute__ ((packed)); struct ieee80211_hdr_3addr { @@ -1152,7 +1152,7 @@ struct ieee80211_hdr_3addr { u8 addr2[ETH_ALEN]; u8 addr3[ETH_ALEN]; __le16 seq_ctl; - u8 payload[0]; + u8 payload[0]; } __attribute__ ((packed)); struct ieee80211_hdr_4addr { @@ -1163,7 +1163,7 @@ struct ieee80211_hdr_4addr { u8 addr3[ETH_ALEN]; __le16 seq_ctl; u8 addr4[ETH_ALEN]; - u8 payload[0]; + u8 payload[0]; } __attribute__ ((packed)); struct ieee80211_hdr_3addrqos { @@ -1173,7 +1173,7 @@ struct ieee80211_hdr_3addrqos { u8 addr2[ETH_ALEN]; u8 addr3[ETH_ALEN]; __le16 seq_ctl; - u8 payload[0]; + u8 payload[0]; __le16 qos_ctl; } __attribute__ ((packed)); @@ -1185,7 +1185,7 @@ struct ieee80211_hdr_4addrqos { u8 addr3[ETH_ALEN]; __le16 seq_ctl; u8 addr4[ETH_ALEN]; - u8 payload[0]; + u8 payload[0]; __le16 qos_ctl; } __attribute__ ((packed)); @@ -1205,14 +1205,14 @@ struct ieee80211_authentication { } __attribute__ ((packed)); struct ieee80211_disassoc { - struct ieee80211_hdr_3addr header; - __le16 reason; + struct ieee80211_hdr_3addr header; + __le16 reason; } __attribute__ ((packed)); struct ieee80211_probe_request { struct ieee80211_hdr_3addr header; /* SSID, supported rates */ - struct ieee80211_info_element info_element[0]; + struct ieee80211_info_element info_element[0]; } __attribute__ ((packed)); struct ieee80211_probe_response { @@ -1220,9 +1220,9 @@ struct ieee80211_probe_response { u32 time_stamp[2]; __le16 beacon_interval; __le16 capability; - /* SSID, supported rates, FH params, DS params, - * CF params, IBSS params, TIM (if beacon), RSN */ - struct ieee80211_info_element info_element[0]; + /* SSID, supported rates, FH params, DS params, + * CF params, IBSS params, TIM (if beacon), RSN */ + struct ieee80211_info_element info_element[0]; } __attribute__ ((packed)); /* Alias beacon for probe_response */ @@ -1233,7 +1233,7 @@ struct ieee80211_assoc_request_frame { __le16 capability; __le16 listen_interval; /* SSID, supported rates, RSN */ - struct ieee80211_info_element info_element[0]; + struct ieee80211_info_element info_element[0]; } __attribute__ ((packed)); struct ieee80211_reassoc_request_frame { @@ -1242,7 +1242,7 @@ struct ieee80211_reassoc_request_frame { __le16 listen_interval; u8 current_ap[ETH_ALEN]; /* SSID, supported rates, RSN */ - struct ieee80211_info_element info_element[0]; + struct ieee80211_info_element info_element[0]; } __attribute__ ((packed)); struct ieee80211_assoc_response_frame { @@ -1318,7 +1318,7 @@ typedef union _frameqos { #define NETWORK_HAS_QOS_PARAMETERS (1<<3) #define NETWORK_HAS_QOS_INFORMATION (1<<4) #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \ - NETWORK_HAS_QOS_INFORMATION) + NETWORK_HAS_QOS_INFORMATION) /* 802.11h */ #define NETWORK_HAS_POWER_CONSTRAINT (1<<5) #define NETWORK_HAS_CSA (1<<6) @@ -1338,46 +1338,46 @@ typedef union _frameqos { #define QOS_AIFSN_MIN_VALUE 2 #if 1 struct ieee80211_qos_information_element { - u8 elementID; - u8 length; - u8 qui[QOS_OUI_LEN]; - u8 qui_type; - u8 qui_subtype; - u8 version; - u8 ac_info; + u8 elementID; + u8 length; + u8 qui[QOS_OUI_LEN]; + u8 qui_type; + u8 qui_subtype; + u8 version; + u8 ac_info; } __attribute__ ((packed)); struct ieee80211_qos_ac_parameter { - u8 aci_aifsn; - u8 ecw_min_max; - __le16 tx_op_limit; + u8 aci_aifsn; + u8 ecw_min_max; + __le16 tx_op_limit; } __attribute__ ((packed)); struct ieee80211_qos_parameter_info { - struct ieee80211_qos_information_element info_element; - u8 reserved; - struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM]; + struct ieee80211_qos_information_element info_element; + u8 reserved; + struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM]; } __attribute__ ((packed)); struct ieee80211_qos_parameters { - __le16 cw_min[QOS_QUEUE_NUM]; - __le16 cw_max[QOS_QUEUE_NUM]; - u8 aifs[QOS_QUEUE_NUM]; - u8 flag[QOS_QUEUE_NUM]; - __le16 tx_op_limit[QOS_QUEUE_NUM]; + __le16 cw_min[QOS_QUEUE_NUM]; + __le16 cw_max[QOS_QUEUE_NUM]; + u8 aifs[QOS_QUEUE_NUM]; + u8 flag[QOS_QUEUE_NUM]; + __le16 tx_op_limit[QOS_QUEUE_NUM]; } __attribute__ ((packed)); struct ieee80211_qos_data { - struct ieee80211_qos_parameters parameters; - int active; - int supported; - u8 param_count; - u8 old_param_count; + struct ieee80211_qos_parameters parameters; + int active; + int supported; + u8 param_count; + u8 old_param_count; }; struct ieee80211_tim_parameters { - u8 tim_count; - u8 tim_period; + u8 tim_count; + u8 tim_period; } __attribute__ ((packed)); //#else @@ -1598,10 +1598,10 @@ struct ieee80211_network { u8 ssid[IW_ESSID_MAX_SIZE + 1]; u8 ssid_len; #if 1 - struct ieee80211_qos_data qos_data; + struct ieee80211_qos_data qos_data; #else // Qos related. Added by Annie, 2005-11-01. - BSS_QOS BssQos; + BSS_QOS BssQos; #endif //added by amy for LEAP @@ -1637,15 +1637,15 @@ struct ieee80211_network { u8 rsn_ie[MAX_WPA_IE_LEN]; size_t rsn_ie_len; - struct ieee80211_tim_parameters tim; + struct ieee80211_tim_parameters tim; u8 dtim_period; u8 dtim_data; u32 last_dtim_sta_time[2]; - //appeded for QoS - u8 wmm_info; - struct ieee80211_wmm_ac_param wmm_param[4]; - u8 QoS_Enable; + //appeded for QoS + u8 wmm_info; + struct ieee80211_wmm_ac_param wmm_param[4]; + u8 QoS_Enable; #ifdef THOMAS_TURBO u8 Turbo_Enable;//enable turbo mode, added by thomas #endif @@ -1653,7 +1653,7 @@ struct ieee80211_network { u16 CountryIeLen; u8 CountryIeBuf[MAX_IE_LEN]; #endif - // HT Related, by amy, 2008.04.29 + // HT Related, by amy, 2008.04.29 BSS_HT bssht; // Add to handle broadcom AP management frame CCK rate. bool broadcom_cap_exist; @@ -1709,13 +1709,13 @@ enum ieee80211_state { }; #else enum ieee80211_state { - IEEE80211_UNINITIALIZED = 0, - IEEE80211_INITIALIZED, - IEEE80211_ASSOCIATING, - IEEE80211_ASSOCIATED, - IEEE80211_AUTHENTICATING, - IEEE80211_AUTHENTICATED, - IEEE80211_SHUTDOWN + IEEE80211_UNINITIALIZED = 0, + IEEE80211_INITIALIZED, + IEEE80211_ASSOCIATING, + IEEE80211_ASSOCIATED, + IEEE80211_AUTHENTICATING, + IEEE80211_AUTHENTICATED, + IEEE80211_SHUTDOWN }; #endif @@ -1729,17 +1729,17 @@ enum ieee80211_state { #define IEEE80211_24GHZ_MIN_CHANNEL 1 #define IEEE80211_24GHZ_MAX_CHANNEL 14 #define IEEE80211_24GHZ_CHANNELS (IEEE80211_24GHZ_MAX_CHANNEL - \ - IEEE80211_24GHZ_MIN_CHANNEL + 1) + IEEE80211_24GHZ_MIN_CHANNEL + 1) #define IEEE80211_52GHZ_MIN_CHANNEL 34 #define IEEE80211_52GHZ_MAX_CHANNEL 165 #define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \ - IEEE80211_52GHZ_MIN_CHANNEL + 1) + IEEE80211_52GHZ_MIN_CHANNEL + 1) #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11)) extern inline int is_multicast_ether_addr(const u8 *addr) { - return ((addr[0] != 0xff) && (0x01 & addr[0])); + return ((addr[0] != 0xff) && (0x01 & addr[0])); } #endif @@ -1911,7 +1911,7 @@ typedef struct _RT_LINK_DETECT_T{ struct ieee80211_device { struct net_device *dev; - struct ieee80211_security sec; + struct ieee80211_security sec; //hw security related // u8 hwsec_support; //support? @@ -2001,15 +2001,15 @@ struct ieee80211_device { int host_encrypt; int host_encrypt_msdu; int host_decrypt; - /* host performs multicast decryption */ - int host_mc_decrypt; + /* host performs multicast decryption */ + int host_mc_decrypt; - /* host should strip IV and ICV from protected frames */ - /* meaningful only when hardware decryption is being used */ - int host_strip_iv_icv; + /* host should strip IV and ICV from protected frames */ + /* meaningful only when hardware decryption is being used */ + int host_strip_iv_icv; - int host_open_frag; - int host_build_iv; + int host_open_frag; + int host_build_iv; int ieee802_1x; /* is IEEE 802.1X used */ /* WPA data */ @@ -2027,7 +2027,7 @@ struct ieee80211_device { struct ieee80211_crypt_data *crypt[WEP_KEYS]; int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */ struct timer_list crypt_deinit_timer; - int crypt_quiesced; + int crypt_quiesced; int bcrx_sta_key; /* use individual keys to override default keys even * with RX of broad/multicast frames */ @@ -2040,10 +2040,10 @@ struct ieee80211_device { #define DEFAULT_RTS_THRESHOLD 2346U #define MIN_RTS_THRESHOLD 1 #define MAX_RTS_THRESHOLD 2346U - u16 rts; /* RTS threshold */ + u16 rts; /* RTS threshold */ - /* Association info */ - u8 bssid[ETH_ALEN]; + /* Association info */ + u8 bssid[ETH_ALEN]; /* This stores infos for the current network. * Either the network we are associated in INFRASTRUCTURE @@ -2069,10 +2069,10 @@ struct ieee80211_device { */ short sync_scan_hurryup; - int perfect_rssi; - int worst_rssi; + int perfect_rssi; + int worst_rssi; - u16 prev_seq_ctl; /* used to drop duplicate frames */ + u16 prev_seq_ctl; /* used to drop duplicate frames */ /* map of allowed channels. 0 is dummy */ // FIXME: remeber to default to a basic channel plan depending of the PHY type @@ -2185,7 +2185,7 @@ struct ieee80211_device { //added by amy for AP roaming RT_LINK_DETECT_T LinkDetectInfo; - //added by amy for ps + //added by amy for ps RT_POWER_SAVE_CONTROL PowerSaveControl; //} /* used if IEEE_SOFTMAC_TX_QUEUE is set */ @@ -2197,19 +2197,19 @@ struct ieee80211_device { /* used if IEEE_SOFTMAC_BEACONS is set */ struct timer_list beacon_timer; #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) - struct work_struct associate_complete_wq; - struct work_struct associate_procedure_wq; + struct work_struct associate_complete_wq; + struct work_struct associate_procedure_wq; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) - struct delayed_work softmac_scan_wq; - struct delayed_work associate_retry_wq; + struct delayed_work softmac_scan_wq; + struct delayed_work associate_retry_wq; struct delayed_work start_ibss_wq; #else - struct work_struct softmac_scan_wq; - struct work_struct associate_retry_wq; + struct work_struct softmac_scan_wq; + struct work_struct associate_retry_wq; struct work_struct start_ibss_wq; #endif - struct work_struct wx_sync_scan_wq; - struct workqueue_struct *wq; + struct work_struct wx_sync_scan_wq; + struct workqueue_struct *wq; #else /* used for periodly scan */ struct timer_list scan_timer; @@ -2323,32 +2323,32 @@ struct ieee80211_device { short (*ps_is_queue_empty) (struct net_device *dev); #if 0 /* Typical STA methods */ - int (*handle_auth) (struct net_device * dev, - struct ieee80211_auth * auth); - int (*handle_deauth) (struct net_device * dev, - struct ieee80211_deauth * auth); - int (*handle_action) (struct net_device * dev, - struct ieee80211_action * action, - struct ieee80211_rx_stats * stats); - int (*handle_disassoc) (struct net_device * dev, - struct ieee80211_disassoc * assoc); + int (*handle_auth) (struct net_device * dev, + struct ieee80211_auth * auth); + int (*handle_deauth) (struct net_device * dev, + struct ieee80211_deauth * auth); + int (*handle_action) (struct net_device * dev, + struct ieee80211_action * action, + struct ieee80211_rx_stats * stats); + int (*handle_disassoc) (struct net_device * dev, + struct ieee80211_disassoc * assoc); #endif - int (*handle_beacon) (struct net_device * dev, struct ieee80211_beacon * beacon, struct ieee80211_network * network); + int (*handle_beacon) (struct net_device * dev, struct ieee80211_beacon * beacon, struct ieee80211_network * network); #if 0 - int (*handle_probe_response) (struct net_device * dev, - struct ieee80211_probe_response * resp, - struct ieee80211_network * network); - int (*handle_probe_request) (struct net_device * dev, - struct ieee80211_probe_request * req, - struct ieee80211_rx_stats * stats); + int (*handle_probe_response) (struct net_device * dev, + struct ieee80211_probe_response * resp, + struct ieee80211_network * network); + int (*handle_probe_request) (struct net_device * dev, + struct ieee80211_probe_request * req, + struct ieee80211_rx_stats * stats); #endif - int (*handle_assoc_response) (struct net_device * dev, struct ieee80211_assoc_response_frame * resp, struct ieee80211_network * network); + int (*handle_assoc_response) (struct net_device * dev, struct ieee80211_assoc_response_frame * resp, struct ieee80211_network * network); #if 0 - /* Typical AP methods */ - int (*handle_assoc_request) (struct net_device * dev); - int (*handle_reassoc_request) (struct net_device * dev, - struct ieee80211_reassoc_request * req); + /* Typical AP methods */ + int (*handle_assoc_request) (struct net_device * dev); + int (*handle_reassoc_request) (struct net_device * dev, + struct ieee80211_reassoc_request * req); #endif /* check whether Tx hw resouce available */ @@ -2485,45 +2485,45 @@ extern inline int ieee80211_get_hdrlen(u16 fc) static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr) { - switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) { - case IEEE80211_1ADDR_LEN: - return ((struct ieee80211_hdr_1addr *)hdr)->payload; - case IEEE80211_2ADDR_LEN: - return ((struct ieee80211_hdr_2addr *)hdr)->payload; - case IEEE80211_3ADDR_LEN: - return ((struct ieee80211_hdr_3addr *)hdr)->payload; - case IEEE80211_4ADDR_LEN: - return ((struct ieee80211_hdr_4addr *)hdr)->payload; - } - return NULL; + switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) { + case IEEE80211_1ADDR_LEN: + return ((struct ieee80211_hdr_1addr *)hdr)->payload; + case IEEE80211_2ADDR_LEN: + return ((struct ieee80211_hdr_2addr *)hdr)->payload; + case IEEE80211_3ADDR_LEN: + return ((struct ieee80211_hdr_3addr *)hdr)->payload; + case IEEE80211_4ADDR_LEN: + return ((struct ieee80211_hdr_4addr *)hdr)->payload; + } + return NULL; } static inline int ieee80211_is_ofdm_rate(u8 rate) { - switch (rate & ~IEEE80211_BASIC_RATE_MASK) { - case IEEE80211_OFDM_RATE_6MB: - case IEEE80211_OFDM_RATE_9MB: - case IEEE80211_OFDM_RATE_12MB: - case IEEE80211_OFDM_RATE_18MB: - case IEEE80211_OFDM_RATE_24MB: - case IEEE80211_OFDM_RATE_36MB: - case IEEE80211_OFDM_RATE_48MB: - case IEEE80211_OFDM_RATE_54MB: - return 1; - } - return 0; + switch (rate & ~IEEE80211_BASIC_RATE_MASK) { + case IEEE80211_OFDM_RATE_6MB: + case IEEE80211_OFDM_RATE_9MB: + case IEEE80211_OFDM_RATE_12MB: + case IEEE80211_OFDM_RATE_18MB: + case IEEE80211_OFDM_RATE_24MB: + case IEEE80211_OFDM_RATE_36MB: + case IEEE80211_OFDM_RATE_48MB: + case IEEE80211_OFDM_RATE_54MB: + return 1; + } + return 0; } static inline int ieee80211_is_cck_rate(u8 rate) { - switch (rate & ~IEEE80211_BASIC_RATE_MASK) { - case IEEE80211_CCK_RATE_1MB: - case IEEE80211_CCK_RATE_2MB: - case IEEE80211_CCK_RATE_5MB: - case IEEE80211_CCK_RATE_11MB: - return 1; - } - return 0; + switch (rate & ~IEEE80211_BASIC_RATE_MASK) { + case IEEE80211_CCK_RATE_1MB: + case IEEE80211_CCK_RATE_2MB: + case IEEE80211_CCK_RATE_5MB: + case IEEE80211_CCK_RATE_11MB: + return 1; + } + return 0; } @@ -2564,17 +2564,17 @@ extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee, union iwreq_data *wrqu, char *key); #if WIRELESS_EXT >= 18 extern int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data* wrqu, char *extra); + struct iw_request_info *info, + union iwreq_data* wrqu, char *extra); extern int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data* wrqu, char *extra); + struct iw_request_info *info, + union iwreq_data* wrqu, char *extra); extern int ieee80211_wx_set_auth(struct ieee80211_device *ieee, - struct iw_request_info *info, - struct iw_param *data, char *extra); + struct iw_request_info *info, + struct iw_param *data, char *extra); extern int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); #endif extern int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len); @@ -2731,13 +2731,13 @@ extern void RxBaInactTimeout(unsigned long data); extern void ResetBaEntry( PBA_RECORD pBA); //function in TS.c extern bool GetTs( - struct ieee80211_device* ieee, - PTS_COMMON_INFO *ppTS, - u8* Addr, - u8 TID, - TR_SELECT TxRxSelect, //Rx:1, Tx:0 - bool bAddNewTs - ); + struct ieee80211_device* ieee, + PTS_COMMON_INFO *ppTS, + u8* Addr, + u8 TID, + TR_SELECT TxRxSelect, //Rx:1, Tx:0 + bool bAddNewTs + ); extern void TSInitialize(struct ieee80211_device *ieee); extern void TsStartAddBaProcess(struct ieee80211_device* ieee, PTX_TS_RECORD pTxTS); extern void RemovePeerTS(struct ieee80211_device* ieee, u8* Addr); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c index 181edc46909e..0b33bf463320 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c @@ -131,7 +131,7 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, /* qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && (WLAN_FC_GET_STYPE(fc) & 0x08)); - */ + */ // fixed by David :2006.9.6 qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && (WLAN_FC_GET_STYPE(fc) & 0x80)); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c index 58af7c83449b..841b99955b79 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c @@ -24,7 +24,7 @@ #include "ieee80211.h" #include - #include + #include #include MODULE_AUTHOR("Jouni Malinen"); @@ -382,7 +382,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) if (!tcb_desc->bHwSec) return ret; else - return 0; + return 0; } @@ -502,26 +502,26 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) } static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr, - u8 * data, size_t data_len, u8 * mic) + u8 * data, size_t data_len, u8 * mic) { - struct hash_desc desc; - struct scatterlist sg[2]; + struct hash_desc desc; + struct scatterlist sg[2]; - if (tfm_michael == NULL) { - printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); - return -1; - } + if (tfm_michael == NULL) { + printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); + return -1; + } - sg_init_table(sg, 2); - sg_set_buf(&sg[0], hdr, 16); - sg_set_buf(&sg[1], data, data_len); + sg_init_table(sg, 2); + sg_set_buf(&sg[0], hdr, 16); + sg_set_buf(&sg[1], data, data_len); - if (crypto_hash_setkey(tfm_michael, key, 8)) - return -1; + if (crypto_hash_setkey(tfm_michael, key, 8)) + return -1; - desc.tfm = tfm_michael; - desc.flags = 0; - return crypto_hash_digest(&desc, sg, data_len + 16, mic); + desc.tfm = tfm_michael; + desc.flags = 0; + return crypto_hash_digest(&desc, sg, data_len + 16, mic); } static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) @@ -630,7 +630,7 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr, skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) - return -1; + return -1; if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { struct ieee80211_hdr_4addr *hdr; hdr = (struct ieee80211_hdr_4addr *) skb->data; @@ -760,7 +760,7 @@ static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { .print_stats = ieee80211_tkip_print_stats, .extra_prefix_len = 4 + 4, /* IV + ExtIV */ .extra_postfix_len = 8 + 4, /* MIC + ICV */ - .owner = THIS_MODULE, + .owner = THIS_MODULE, }; int __init ieee80211_crypto_tkip_init(void) @@ -776,5 +776,5 @@ void __exit ieee80211_crypto_tkip_exit(void) void ieee80211_tkip_null(void) { // printk("============>%s()\n", __FUNCTION__); - return; + return; } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c index 39c74d1533ce..61ad11cae38c 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c @@ -34,8 +34,8 @@ struct prism2_wep_data { u8 key[WEP_KEY_LEN + 1]; u8 key_len; u8 key_idx; - struct crypto_blkcipher *tx_tfm; - struct crypto_blkcipher *rx_tfm; + struct crypto_blkcipher *tx_tfm; + struct crypto_blkcipher *rx_tfm; }; @@ -50,19 +50,19 @@ static void * prism2_wep_init(int keyidx) priv->key_idx = keyidx; priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); - if (IS_ERR(priv->tx_tfm)) { - printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " - "crypto API arc4\n"); - priv->tx_tfm = NULL; - goto fail; - } - priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); - if (IS_ERR(priv->rx_tfm)) { - printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " - "crypto API arc4\n"); - priv->rx_tfm = NULL; - goto fail; - } + if (IS_ERR(priv->tx_tfm)) { + printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " + "crypto API arc4\n"); + priv->tx_tfm = NULL; + goto fail; + } + priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); + if (IS_ERR(priv->rx_tfm)) { + printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " + "crypto API arc4\n"); + priv->rx_tfm = NULL; + goto fail; + } /* start WEP IV from a random value */ get_random_bytes(&priv->iv, 4); @@ -71,12 +71,12 @@ static void * prism2_wep_init(int keyidx) fail: if (priv) { - if (priv->tx_tfm) - crypto_free_blkcipher(priv->tx_tfm); - if (priv->rx_tfm) - crypto_free_blkcipher(priv->rx_tfm); - kfree(priv); - } + if (priv->tx_tfm) + crypto_free_blkcipher(priv->tx_tfm); + if (priv->rx_tfm) + crypto_free_blkcipher(priv->rx_tfm); + kfree(priv); + } return NULL; } @@ -87,11 +87,11 @@ static void prism2_wep_deinit(void *priv) struct prism2_wep_data *_priv = priv; if (_priv) { - if (_priv->tx_tfm) - crypto_free_blkcipher(_priv->tx_tfm); - if (_priv->rx_tfm) - crypto_free_blkcipher(_priv->rx_tfm); - } + if (_priv->tx_tfm) + crypto_free_blkcipher(_priv->tx_tfm); + if (_priv->rx_tfm) + crypto_free_blkcipher(_priv->rx_tfm); + } kfree(priv); } @@ -293,5 +293,5 @@ void __exit ieee80211_crypto_wep_exit(void) void ieee80211_wep_null(void) { // printk("============>%s()\n", __FUNCTION__); - return; + return; } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index c3383bb8b760..bbaec949bb85 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -150,11 +150,11 @@ struct net_device *alloc_ieee80211(int sizeof_priv) atomic_set(&(ieee->atm_swbw), 0); ieee->wpax_type_set = 0; - ieee->wpa_enabled = 0; - ieee->tkip_countermeasures = 0; - ieee->drop_unencrypted = 0; - ieee->privacy_invoked = 0; - ieee->ieee802_1x = 1; + ieee->wpa_enabled = 0; + ieee->tkip_countermeasures = 0; + ieee->drop_unencrypted = 0; + ieee->privacy_invoked = 0; + ieee->ieee802_1x = 1; ieee->raw_tx = 0; //ieee->hwsec_support = 1; //defalt support hw security. //use module_param instead. ieee->hwsec_active = 0; //disable hwsec, switch it on when necessary. diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 7792aa808c6c..1629b0f33f07 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -133,14 +133,14 @@ void ieee80211_WMM_Info(struct ieee80211_device *ieee, u8 **tag_p) { void ieee80211_TURBO_Info(struct ieee80211_device *ieee, u8 **tag_p) { u8 *tag = *tag_p; - *tag++ = MFIE_TYPE_GENERIC; //0 - *tag++ = 7; - *tag++ = 0x00; - *tag++ = 0xe0; - *tag++ = 0x4c; - *tag++ = 0x01;//5 - *tag++ = 0x02; - *tag++ = 0x11; + *tag++ = MFIE_TYPE_GENERIC; //0 + *tag++ = 7; + *tag++ = 0x00; + *tag++ = 0xe0; + *tag++ = 0x4c; + *tag++ = 0x01;//5 + *tag++ = 0x02; + *tag++ = 0x11; *tag++ = 0x00; *tag_p = tag; @@ -238,9 +238,9 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee tcb_desc->queue_index = MGNT_QUEUE; tcb_desc->data_rate = MgntQuery_MgntFrameTxRate(ieee); - tcb_desc->RATRIndex = 7; - tcb_desc->bTxDisableRateFallBack = 1; - tcb_desc->bTxUseDriverAssingedRate = 1; + tcb_desc->RATRIndex = 7; + tcb_desc->bTxDisableRateFallBack = 1; + tcb_desc->bTxUseDriverAssingedRate = 1; if(single){ if(ieee->queue_stop){ @@ -525,8 +525,8 @@ void ieee80211_softmac_scan(struct ieee80211_device *ieee) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) void ieee80211_softmac_scan_wq(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, work); - struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq); + struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq); #else void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee) { @@ -546,7 +546,7 @@ void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee) { //if current channel is not in channel map, set to default channel. #ifdef ENABLE_DOT11D - if (!channel_map[ieee->current_network.channel]); + if (!channel_map[ieee->current_network.channel]); #else if (!ieee->channel_map[ieee->current_network.channel]); #endif @@ -554,7 +554,7 @@ void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee) goto out; /* no good chans */ } #ifdef ENABLE_DOT11D - }while(!channel_map[ieee->current_network.channel]); + }while(!channel_map[ieee->current_network.channel]); #else }while(!ieee->channel_map[ieee->current_network.channel]); #endif @@ -582,7 +582,7 @@ out: if(IS_DOT11D_ENABLE(ieee)) DOT11D_ScanComplete(ieee); #endif - ieee->actscanning = false; + ieee->actscanning = false; watchdog = 0; ieee->scanning = 0; up(&ieee->scan_sem); @@ -619,7 +619,7 @@ void ieee80211_beacons_stop(struct ieee80211_device *ieee) spin_lock_irqsave(&ieee->beacon_lock,flags); ieee->beacon_txing = 0; - del_timer_sync(&ieee->beacon_timer); + del_timer_sync(&ieee->beacon_timer); spin_unlock_irqrestore(&ieee->beacon_lock,flags); @@ -807,12 +807,12 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d erp_len = 0; #else if((ieee->current_network.mode == IEEE_G) - ||( ieee->current_network.mode == IEEE_N_24G && ieee->pHTInfo->bCurSuppCCK)) { - erp_len = 3; + ||( ieee->current_network.mode == IEEE_N_24G && ieee->pHTInfo->bCurSuppCCK)) { + erp_len = 3; erpinfo_content = 0; if(ieee->current_network.buseprotection) erpinfo_content |= ERP_UseProtection; - } + } else erp_len = 0; #endif @@ -833,12 +833,12 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d HTConstructInfoElement(ieee,tmp_ht_info_buf,&tmp_ht_info_len, encrypt); - if(pHTInfo->bRegRT2RTAggregation) - { - tmp_generic_ie_buf = ieee->pHTInfo->szRT2RTAggBuffer; + if(pHTInfo->bRegRT2RTAggregation) + { + tmp_generic_ie_buf = ieee->pHTInfo->szRT2RTAggBuffer; tmp_generic_ie_len = sizeof(ieee->pHTInfo->szRT2RTAggBuffer); HTConstructRT2RTAggElement(ieee, tmp_generic_ie_buf, &tmp_generic_ie_len); - } + } // printk("===============>tmp_ht_cap_len is %d,tmp_ht_info_len is %d, tmp_generic_ie_len is %d\n",tmp_ht_cap_len,tmp_ht_info_len,tmp_generic_ie_len); #endif beacon_size = sizeof(struct ieee80211_probe_response)+2+ @@ -848,7 +848,7 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d +rate_ex_len +atim_len +erp_len - +wpa_ie_len + +wpa_ie_len // +tmp_ht_cap_len // +tmp_ht_info_len // +tmp_generic_ie_len @@ -1187,7 +1187,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco + wpa_ie_len + wmm_info_len + turbo_info_len - + ht_cap_len + + ht_cap_len + realtek_ie_len + ckip_ie_len + ccxrm_ie_len @@ -1199,7 +1199,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco + rate_len//rates tagged val + wpa_ie_len + wmm_info_len - + ht_cap_len + + ht_cap_len + realtek_ie_len + ckip_ie_len + ccxrm_ie_len @@ -1235,7 +1235,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco if(ieee->short_slot) hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT); - if (wmm_info_len) //QOS + if (wmm_info_len) //QOS hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_QOS); hdr->listen_interval = 0xa; //FIXME @@ -1304,7 +1304,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco memcpy(tag,osCcxVerNum.Octet,osCcxVerNum.Length); tag += osCcxVerNum.Length; } - //HT cap element + //HT cap element if(ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT){ if(ieee->pHTInfo->ePeerHTSpecVer != HT_SPEC_VER_EWC) { @@ -1329,9 +1329,9 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco } #ifdef THOMAS_TURBO tag = skb_put(skb,turbo_info_len); - if(turbo_info_len) { - ieee80211_TURBO_Info(ieee, &tag); - } + if(turbo_info_len) { + ieee80211_TURBO_Info(ieee, &tag); + } #endif if(ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT){ @@ -1382,7 +1382,7 @@ void ieee80211_associate_abort(struct ieee80211_device *ieee) #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, \ - IEEE80211_SOFTMAC_ASSOC_RETRY_TIME); + IEEE80211_SOFTMAC_ASSOC_RETRY_TIME); #else schedule_task(&ieee->associate_retry_wq); #endif @@ -1482,7 +1482,7 @@ void ieee80211_associate_step2(struct ieee80211_device *ieee) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) void ieee80211_associate_complete_wq(struct work_struct *work) { - struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq); + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq); #else void ieee80211_associate_complete_wq(struct ieee80211_device *ieee) { @@ -1567,7 +1567,7 @@ void ieee80211_associate_complete(struct ieee80211_device *ieee) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) void ieee80211_associate_procedure_wq(struct work_struct *work) { - struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq); + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq); #else void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee) { @@ -1623,7 +1623,7 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee if ( /* if the user set the AP check if match. - * if the network does not broadcast essid we check the user supplyed ANY essid + * if the network does not broadcast essid we check the user supplyed ANY essid * if the network does broadcast and the user does not set essid it is OK * if the network does broadcast and the user did set essid chech if essid match */ @@ -1837,8 +1837,8 @@ static inline u16 assoc_parse(struct ieee80211_device *ieee, struct sk_buff *skb status_code==WLAN_STATUS_CAPS_UNSUPPORTED)&& ((ieee->mode == IEEE_G) && (ieee->current_network.mode == IEEE_N_24G) && - (ieee->AsocRetryCount++ < (RT_ASOC_RETRY_LIMIT-1)))) { - ieee->pHTInfo->IOTAction |= HT_IOT_ACT_PURE_N_MODE; + (ieee->AsocRetryCount++ < (RT_ASOC_RETRY_LIMIT-1)))) { + ieee->pHTInfo->IOTAction |= HT_IOT_ACT_PURE_N_MODE; }else { ieee->AsocRetryCount = 0; } @@ -2535,8 +2535,8 @@ void ieee80211_start_monitor_mode(struct ieee80211_device *ieee) void ieee80211_start_ibss_wq(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, work); - struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, start_ibss_wq); + struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, start_ibss_wq); #else void ieee80211_start_ibss_wq(struct ieee80211_device *ieee) { @@ -2843,7 +2843,7 @@ void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee) void ieee80211_start_protocol(struct ieee80211_device *ieee) { short ch = 0; - int i = 0; + int i = 0; if (ieee->proto_started) return; @@ -2867,7 +2867,7 @@ void ieee80211_start_protocol(struct ieee80211_device *ieee) // printk("===>%s(), chan:%d\n", __FUNCTION__, ieee->current_network.channel); // ieee->set_chan(ieee->dev,ieee->current_network.channel); - for(i = 0; i < 17; i++) { + for(i = 0; i < 17; i++) { ieee->last_rxseq_num[i] = -1; ieee->last_rxfrag_num[i] = -1; ieee->last_packet_time[i] = 0; @@ -2915,7 +2915,7 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee) //added for AP roaming ieee->LinkDetectInfo.SlotNum = 2; ieee->LinkDetectInfo.NumRecvBcnInPeriod=0; - ieee->LinkDetectInfo.NumRecvDataInPeriod=0; + ieee->LinkDetectInfo.NumRecvDataInPeriod=0; ieee->assoc_id = 0; ieee->queue_stop = 0; @@ -2968,12 +2968,12 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee) #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) - INIT_DELAYED_WORK(&ieee->start_ibss_wq,ieee80211_start_ibss_wq); - INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq); - INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq); - INIT_DELAYED_WORK(&ieee->softmac_scan_wq,ieee80211_softmac_scan_wq); - INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq); - INIT_WORK(&ieee->wx_sync_scan_wq,ieee80211_wx_sync_scan_wq); + INIT_DELAYED_WORK(&ieee->start_ibss_wq,ieee80211_start_ibss_wq); + INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq); + INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq); + INIT_DELAYED_WORK(&ieee->softmac_scan_wq,ieee80211_softmac_scan_wq); + INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq); + INIT_WORK(&ieee->wx_sync_scan_wq,ieee80211_wx_sync_scan_wq); #else INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee); @@ -3165,7 +3165,7 @@ static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 v .flags = SEC_ENABLED, .enabled = value, }; - ieee->drop_unencrypted = value; + ieee->drop_unencrypted = value; /* We only change SEC_LEVEL for open mode. Others * are set by ipw_wpa_set_encryption. */ diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c index b96acf5546bf..d395fc65b704 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c @@ -316,7 +316,7 @@ out: #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) void ieee80211_wx_sync_scan_wq(struct work_struct *work) { - struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq); + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq); #else void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee) { @@ -641,7 +641,7 @@ int ieee80211_wx_get_power(struct ieee80211_device *ieee, } if ((ieee->ps & (IEEE80211_PS_MBCAST | IEEE80211_PS_UNICAST)) == (IEEE80211_PS_MBCAST | IEEE80211_PS_UNICAST)) - wrqu->power.flags |= IW_POWER_ALL_R; + wrqu->power.flags |= IW_POWER_ALL_R; else if (ieee->ps & IEEE80211_PS_MBCAST) wrqu->power.flags |= IW_POWER_MULTICAST_R; else diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c index 118dfe1c977f..3b248cd3ce1b 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c @@ -56,18 +56,18 @@ struct modes_unit ieee80211_modes[] = { #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) static inline char * iwe_stream_add_event_rsl(char * stream, /* Stream of events */ - char * ends, /* End of stream */ - struct iw_event *iwe, /* Payload */ - int event_len) /* Real size of payload */ + char * ends, /* End of stream */ + struct iw_event *iwe, /* Payload */ + int event_len) /* Real size of payload */ { - /* Check if it's possible */ - if((stream + event_len) < ends) { - iwe->len = event_len; + /* Check if it's possible */ + if((stream + event_len) < ends) { + iwe->len = event_len; ndelay(1); //new - memcpy(stream, (char *) iwe, event_len); - stream += event_len; - } - return stream; + memcpy(stream, (char *) iwe, event_len); + stream += event_len; + } + return stream; } #else #define iwe_stream_add_event_rsl iwe_stream_add_event @@ -75,9 +75,9 @@ iwe_stream_add_event_rsl(char * stream, /* Stream of events */ #define MAX_CUSTOM_LEN 64 static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, - char *start, char *stop, + char *start, char *stop, struct ieee80211_network *network, - struct iw_request_info *info) + struct iw_request_info *info) { char custom[MAX_CUSTOM_LEN]; char proto_name[IFNAMSIZ]; @@ -106,18 +106,18 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, if (network->ssid_len == 0) { iwe.u.data.length = sizeof(""); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - start = iwe_stream_add_point(info, start, stop, &iwe, ""); + start = iwe_stream_add_point(info, start, stop, &iwe, ""); #else - start = iwe_stream_add_point(start, stop, &iwe, ""); + start = iwe_stream_add_point(start, stop, &iwe, ""); #endif - } else { + } else { iwe.u.data.length = min(network->ssid_len, (u8)32); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); + start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); #else - start = iwe_stream_add_point(start, stop, &iwe, network->ssid); + start = iwe_stream_add_point(start, stop, &iwe, network->ssid); #endif - } + } /* Add the protocol name */ iwe.cmd = SIOCGIWNAME; for(i=0; i<(sizeof(ieee80211_modes)/sizeof(ieee80211_modes[0])); i++) { @@ -129,26 +129,26 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, *pname = '\0'; snprintf(iwe.u.name, IFNAMSIZ, "IEEE802.11%s", proto_name); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_CHAR_LEN); + start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_CHAR_LEN); #else - start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_CHAR_LEN); + start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_CHAR_LEN); #endif - /* Add mode */ - iwe.cmd = SIOCGIWMODE; - if (network->capability & + /* Add mode */ + iwe.cmd = SIOCGIWMODE; + if (network->capability & (WLAN_CAPABILITY_BSS | WLAN_CAPABILITY_IBSS)) { if (network->capability & WLAN_CAPABILITY_BSS) iwe.u.mode = IW_MODE_MASTER; else iwe.u.mode = IW_MODE_ADHOC; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_UINT_LEN); + start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_UINT_LEN); #else - start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_UINT_LEN); + start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_UINT_LEN); #endif - } + } - /* Add frequency/channel */ + /* Add frequency/channel */ iwe.cmd = SIOCGIWFREQ; /* iwe.u.freq.m = ieee80211_frequency(network->channel, network->mode); iwe.u.freq.e = 3; */ @@ -156,9 +156,9 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, iwe.u.freq.e = 0; iwe.u.freq.i = 0; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_FREQ_LEN); + start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_FREQ_LEN); #else - start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_FREQ_LEN); + start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_FREQ_LEN); #endif /* Add encryption capability */ iwe.cmd = SIOCGIWENCODE; @@ -168,9 +168,9 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, iwe.u.data.flags = IW_ENCODE_DISABLED; iwe.u.data.length = 0; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); + start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); #else - start = iwe_stream_add_point(start, stop, &iwe, network->ssid); + start = iwe_stream_add_point(start, stop, &iwe, network->ssid); #endif /* Add basic and extended rates */ max_rate = 0; @@ -228,19 +228,19 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; iwe.u.bitrate.value = max_rate * 500000; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - start = iwe_stream_add_event_rsl(info, start, stop, &iwe, + start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_PARAM_LEN); #else - start = iwe_stream_add_event_rsl(start, stop, &iwe, + start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_PARAM_LEN); #endif iwe.cmd = IWEVCUSTOM; iwe.u.data.length = p - custom; if (iwe.u.data.length) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - start = iwe_stream_add_point(info, start, stop, &iwe, custom); + start = iwe_stream_add_point(info, start, stop, &iwe, custom); #else - start = iwe_stream_add_point(start, stop, &iwe, custom); + start = iwe_stream_add_point(start, stop, &iwe, custom); #endif /* Add quality statistics */ /* TODO: Fix these values... */ @@ -257,9 +257,9 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID; iwe.u.qual.updated = 7; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_QUAL_LEN); + start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_QUAL_LEN); #else - start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_QUAL_LEN); + start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_QUAL_LEN); #endif iwe.cmd = IWEVCUSTOM; p = custom; @@ -267,9 +267,9 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, iwe.u.data.length = p - custom; if (iwe.u.data.length) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - start = iwe_stream_add_point(info, start, stop, &iwe, custom); + start = iwe_stream_add_point(info, start, stop, &iwe, custom); #else - start = iwe_stream_add_point(start, stop, &iwe, custom); + start = iwe_stream_add_point(start, stop, &iwe, custom); #endif #if (WIRELESS_EXT < 18) if (ieee->wpa_enabled && network->wpa_ie_len){ @@ -285,11 +285,11 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, iwe.cmd = IWEVCUSTOM; iwe.u.data.length = strlen(buf); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - start = iwe_stream_add_point(info, start, stop, &iwe, buf); + start = iwe_stream_add_point(info, start, stop, &iwe, buf); #else - start = iwe_stream_add_point(start, stop, &iwe, buf); + start = iwe_stream_add_point(start, stop, &iwe, buf); #endif - } + } if (ieee->wpa_enabled && network->rsn_ie_len){ char buf[MAX_WPA_IE_LEN * 2 + 30]; @@ -304,11 +304,11 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, iwe.cmd = IWEVCUSTOM; iwe.u.data.length = strlen(buf); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - start = iwe_stream_add_point(info, start, stop, &iwe, buf); + start = iwe_stream_add_point(info, start, stop, &iwe, buf); #else - start = iwe_stream_add_point(start, stop, &iwe, buf); + start = iwe_stream_add_point(start, stop, &iwe, buf); #endif - } + } #else memset(&iwe, 0, sizeof(iwe)); if (network->wpa_ie_len) @@ -318,11 +318,11 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, iwe.cmd = IWEVGENIE; iwe.u.data.length = network->wpa_ie_len; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - start = iwe_stream_add_point(info, start, stop, &iwe, buf); + start = iwe_stream_add_point(info, start, stop, &iwe, buf); #else - start = iwe_stream_add_point(start, stop, &iwe, buf); + start = iwe_stream_add_point(start, stop, &iwe, buf); #endif - } + } memset(&iwe, 0, sizeof(iwe)); if (network->rsn_ie_len) { @@ -331,11 +331,11 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, iwe.cmd = IWEVGENIE; iwe.u.data.length = network->rsn_ie_len; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - start = iwe_stream_add_point(info, start, stop, &iwe, buf); + start = iwe_stream_add_point(info, start, stop, &iwe, buf); #else - start = iwe_stream_add_point(start, stop, &iwe, buf); + start = iwe_stream_add_point(start, stop, &iwe, buf); #endif - } + } #endif @@ -348,9 +348,9 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, iwe.u.data.length = p - custom; if (iwe.u.data.length) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - start = iwe_stream_add_point(info, start, stop, &iwe, custom); + start = iwe_stream_add_point(info, start, stop, &iwe, custom); #else - start = iwe_stream_add_point(start, stop, &iwe, custom); + start = iwe_stream_add_point(start, stop, &iwe, custom); #endif return start; @@ -516,7 +516,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, key, escape_essid(sec.keys[key], len), erq->length, len); sec.key_sizes[key] = len; - (*crypt)->ops->set_key(sec.keys[key], len, NULL, + (*crypt)->ops->set_key(sec.keys[key], len, NULL, (*crypt)->priv); sec.flags |= (1 << key); /* This ensures a key will be activated if no key is @@ -634,192 +634,192 @@ int ieee80211_wx_get_encode(struct ieee80211_device *ieee, } #if (WIRELESS_EXT >= 18) int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret = 0; #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) struct net_device *dev = ieee->dev; - struct iw_point *encoding = &wrqu->encoding; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int i, idx; - int group_key = 0; - const char *alg, *module; - struct ieee80211_crypto_ops *ops; - struct ieee80211_crypt_data **crypt; - - struct ieee80211_security sec = { - .flags = 0, - }; + struct iw_point *encoding = &wrqu->encoding; + struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; + int i, idx; + int group_key = 0; + const char *alg, *module; + struct ieee80211_crypto_ops *ops; + struct ieee80211_crypt_data **crypt; + + struct ieee80211_security sec = { + .flags = 0, + }; //printk("======>encoding flag:%x,ext flag:%x, ext alg:%d\n", encoding->flags,ext->ext_flags, ext->alg); - idx = encoding->flags & IW_ENCODE_INDEX; - if (idx) { - if (idx < 1 || idx > WEP_KEYS) - return -EINVAL; - idx--; - } else - idx = ieee->tx_keyidx; + idx = encoding->flags & IW_ENCODE_INDEX; + if (idx) { + if (idx < 1 || idx > WEP_KEYS) + return -EINVAL; + idx--; + } else + idx = ieee->tx_keyidx; - if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { + if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - crypt = &ieee->crypt[idx]; + crypt = &ieee->crypt[idx]; - group_key = 1; - } else { - /* some Cisco APs use idx>0 for unicast in dynamic WEP */ + group_key = 1; + } else { + /* some Cisco APs use idx>0 for unicast in dynamic WEP */ //printk("not group key, flags:%x, ext->alg:%d\n", ext->ext_flags, ext->alg); - if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP) - return -EINVAL; - if (ieee->iw_mode == IW_MODE_INFRA) + if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP) + return -EINVAL; + if (ieee->iw_mode == IW_MODE_INFRA) - crypt = &ieee->crypt[idx]; + crypt = &ieee->crypt[idx]; - else - return -EINVAL; - } + else + return -EINVAL; + } - sec.flags |= SEC_ENABLED;// | SEC_ENCRYPT; - if ((encoding->flags & IW_ENCODE_DISABLED) || - ext->alg == IW_ENCODE_ALG_NONE) { - if (*crypt) - ieee80211_crypt_delayed_deinit(ieee, crypt); + sec.flags |= SEC_ENABLED;// | SEC_ENCRYPT; + if ((encoding->flags & IW_ENCODE_DISABLED) || + ext->alg == IW_ENCODE_ALG_NONE) { + if (*crypt) + ieee80211_crypt_delayed_deinit(ieee, crypt); - for (i = 0; i < WEP_KEYS; i++) + for (i = 0; i < WEP_KEYS; i++) if (ieee->crypt[i] != NULL) - break; + break; - if (i == WEP_KEYS) { - sec.enabled = 0; - // sec.encrypt = 0; - sec.level = SEC_LEVEL_0; - sec.flags |= SEC_LEVEL; - } + if (i == WEP_KEYS) { + sec.enabled = 0; + // sec.encrypt = 0; + sec.level = SEC_LEVEL_0; + sec.flags |= SEC_LEVEL; + } //printk("disabled: flag:%x\n", encoding->flags); - goto done; - } + goto done; + } sec.enabled = 1; // sec.encrypt = 1; #if 0 - if (group_key ? !ieee->host_mc_decrypt : - !(ieee->host_encrypt || ieee->host_decrypt || - ieee->host_encrypt_msdu)) - goto skip_host_crypt; + if (group_key ? !ieee->host_mc_decrypt : + !(ieee->host_encrypt || ieee->host_decrypt || + ieee->host_encrypt_msdu)) + goto skip_host_crypt; #endif - switch (ext->alg) { - case IW_ENCODE_ALG_WEP: - alg = "WEP"; - module = "ieee80211_crypt_wep"; - break; - case IW_ENCODE_ALG_TKIP: - alg = "TKIP"; - module = "ieee80211_crypt_tkip"; - break; - case IW_ENCODE_ALG_CCMP: - alg = "CCMP"; - module = "ieee80211_crypt_ccmp"; - break; - default: - IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", - dev->name, ext->alg); - ret = -EINVAL; - goto done; - } + switch (ext->alg) { + case IW_ENCODE_ALG_WEP: + alg = "WEP"; + module = "ieee80211_crypt_wep"; + break; + case IW_ENCODE_ALG_TKIP: + alg = "TKIP"; + module = "ieee80211_crypt_tkip"; + break; + case IW_ENCODE_ALG_CCMP: + alg = "CCMP"; + module = "ieee80211_crypt_ccmp"; + break; + default: + IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", + dev->name, ext->alg); + ret = -EINVAL; + goto done; + } printk("alg name:%s\n",alg); ops = ieee80211_get_crypto_ops(alg); - if (ops == NULL) { - request_module(module); - ops = ieee80211_get_crypto_ops(alg); - } - if (ops == NULL) { - IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", - dev->name, ext->alg); + if (ops == NULL) { + request_module(module); + ops = ieee80211_get_crypto_ops(alg); + } + if (ops == NULL) { + IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", + dev->name, ext->alg); printk("========>unknown crypto alg %d\n", ext->alg); - ret = -EINVAL; - goto done; - } + ret = -EINVAL; + goto done; + } - if (*crypt == NULL || (*crypt)->ops != ops) { - struct ieee80211_crypt_data *new_crypt; + if (*crypt == NULL || (*crypt)->ops != ops) { + struct ieee80211_crypt_data *new_crypt; - ieee80211_crypt_delayed_deinit(ieee, crypt); + ieee80211_crypt_delayed_deinit(ieee, crypt); #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)) - new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); + new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); #else - new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL); + new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL); memset(new_crypt,0,sizeof(*new_crypt)); #endif - if (new_crypt == NULL) { - ret = -ENOMEM; - goto done; - } - new_crypt->ops = ops; - if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) - new_crypt->priv = new_crypt->ops->init(idx); - if (new_crypt->priv == NULL) { - kfree(new_crypt); - ret = -EINVAL; - goto done; - } - *crypt = new_crypt; - - } - - if (ext->key_len > 0 && (*crypt)->ops->set_key && - (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq, - (*crypt)->priv) < 0) { - IEEE80211_DEBUG_WX("%s: key setting failed\n", dev->name); + if (new_crypt == NULL) { + ret = -ENOMEM; + goto done; + } + new_crypt->ops = ops; + if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) + new_crypt->priv = new_crypt->ops->init(idx); + if (new_crypt->priv == NULL) { + kfree(new_crypt); + ret = -EINVAL; + goto done; + } + *crypt = new_crypt; + + } + + if (ext->key_len > 0 && (*crypt)->ops->set_key && + (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq, + (*crypt)->priv) < 0) { + IEEE80211_DEBUG_WX("%s: key setting failed\n", dev->name); printk("key setting failed\n"); - ret = -EINVAL; - goto done; - } + ret = -EINVAL; + goto done; + } #if 1 //skip_host_crypt: //printk("skip_host_crypt:ext_flags:%x\n", ext->ext_flags); - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - ieee->tx_keyidx = idx; - sec.active_key = idx; - sec.flags |= SEC_ACTIVE_KEY; - } - - if (ext->alg != IW_ENCODE_ALG_NONE) { - //memcpy(sec.keys[idx], ext->key, ext->key_len); - sec.key_sizes[idx] = ext->key_len; - sec.flags |= (1 << idx); - if (ext->alg == IW_ENCODE_ALG_WEP) { - // sec.encode_alg[idx] = SEC_ALG_WEP; - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_1; - } else if (ext->alg == IW_ENCODE_ALG_TKIP) { - // sec.encode_alg[idx] = SEC_ALG_TKIP; - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_2; - } else if (ext->alg == IW_ENCODE_ALG_CCMP) { - // sec.encode_alg[idx] = SEC_ALG_CCMP; - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_3; - } - /* Don't set sec level for group keys. */ - if (group_key) - sec.flags &= ~SEC_LEVEL; - } + if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { + ieee->tx_keyidx = idx; + sec.active_key = idx; + sec.flags |= SEC_ACTIVE_KEY; + } + + if (ext->alg != IW_ENCODE_ALG_NONE) { + //memcpy(sec.keys[idx], ext->key, ext->key_len); + sec.key_sizes[idx] = ext->key_len; + sec.flags |= (1 << idx); + if (ext->alg == IW_ENCODE_ALG_WEP) { + // sec.encode_alg[idx] = SEC_ALG_WEP; + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_1; + } else if (ext->alg == IW_ENCODE_ALG_TKIP) { + // sec.encode_alg[idx] = SEC_ALG_TKIP; + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_2; + } else if (ext->alg == IW_ENCODE_ALG_CCMP) { + // sec.encode_alg[idx] = SEC_ALG_CCMP; + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_3; + } + /* Don't set sec level for group keys. */ + if (group_key) + sec.flags &= ~SEC_LEVEL; + } #endif done: - if (ieee->set_security) - ieee->set_security(ieee->dev, &sec); + if (ieee->set_security) + ieee->set_security(ieee->dev, &sec); if (ieee->reset_on_keychange && - ieee->iw_mode != IW_MODE_INFRA && - ieee->reset_port && ieee->reset_port(dev)) { - IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name); - return -EINVAL; - } + ieee->iw_mode != IW_MODE_INFRA && + ieee->reset_port && ieee->reset_port(dev)) { + IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name); + return -EINVAL; + } #endif - return ret; + return ret; } int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee, @@ -878,46 +878,46 @@ int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee, } int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) struct iw_mlme *mlme = (struct iw_mlme *) extra; switch (mlme->cmd) { - case IW_MLME_DEAUTH: + case IW_MLME_DEAUTH: case IW_MLME_DISASSOC: ieee80211_disassociate(ieee); break; default: - return -EOPNOTSUPP; - } + return -EOPNOTSUPP; + } #endif return 0; } int ieee80211_wx_set_auth(struct ieee80211_device *ieee, - struct iw_request_info *info, - struct iw_param *data, char *extra) + struct iw_request_info *info, + struct iw_param *data, char *extra) { #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) switch (data->flags & IW_AUTH_INDEX) { - case IW_AUTH_WPA_VERSION: + case IW_AUTH_WPA_VERSION: /*need to support wpa2 here*/ //printk("wpa version:%x\n", data->value); break; - case IW_AUTH_CIPHER_PAIRWISE: - case IW_AUTH_CIPHER_GROUP: - case IW_AUTH_KEY_MGMT: - /* + case IW_AUTH_CIPHER_PAIRWISE: + case IW_AUTH_CIPHER_GROUP: + case IW_AUTH_KEY_MGMT: + /* * * Host AP driver does not use these parameters and allows * * wpa_supplicant to control them internally. * */ - break; - case IW_AUTH_TKIP_COUNTERMEASURES: - ieee->tkip_countermeasures = data->value; - break; - case IW_AUTH_DROP_UNENCRYPTED: - ieee->drop_unencrypted = data->value; + break; + case IW_AUTH_TKIP_COUNTERMEASURES: + ieee->tkip_countermeasures = data->value; + break; + case IW_AUTH_DROP_UNENCRYPTED: + ieee->drop_unencrypted = data->value; break; case IW_AUTH_80211_AUTH_ALG: @@ -949,13 +949,13 @@ int ieee80211_wx_set_auth(struct ieee80211_device *ieee, #endif case IW_AUTH_RX_UNENCRYPTED_EAPOL: - ieee->ieee802_1x = data->value; + ieee->ieee802_1x = data->value; break; case IW_AUTH_PRIVACY_INVOKED: ieee->privacy_invoked = data->value; break; default: - return -EOPNOTSUPP; + return -EOPNOTSUPP; } #endif return 0; diff --git a/drivers/staging/rtl8192u/ieee80211/proc.c b/drivers/staging/rtl8192u/ieee80211/proc.c index 4f3f9ed7751a..6eda928e4090 100644 --- a/drivers/staging/rtl8192u/ieee80211/proc.c +++ b/drivers/staging/rtl8192u/ieee80211/proc.c @@ -73,7 +73,7 @@ static int c_show(struct seq_file *m, void *p) seq_printf(m, "type : digest\n"); seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); seq_printf(m, "digestsize : %u\n", - alg->cra_digest.dia_digestsize); + alg->cra_digest.dia_digestsize); break; case CRYPTO_ALG_TYPE_COMPRESS: seq_printf(m, "type : compression\n"); diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h index 992b71825a8b..cde603f67f43 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h @@ -437,7 +437,7 @@ extern u8 MCS_FILTER_1SS[16]; // MCS Bw 40 {1~7, 12~15,32} #define RATE_ADPT_1SS_MASK 0xFF -#define RATE_ADPT_2SS_MASK 0xF0 //Skip MCS8~11 because mcs7 > mcs6, 9, 10, 11. 2007.01.16 by Emily +#define RATE_ADPT_2SS_MASK 0xF0 //Skip MCS8~11 because mcs7 > mcs6, 9, 10, 11. 2007.01.16 by Emily #define RATE_ADPT_MCS32_MASK 0x01 #define IS_11N_MCS_RATE(rate) (rate&0x80) diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c index 87074eec2e16..7c0e489b6c71 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c @@ -361,11 +361,11 @@ bool IsHTHalfNmodeAPs(struct ieee80211_device* ieee) (net->ralink_cap_exist)) retValue = true; else if((memcmp(net->bssid, UNKNOWN_BORADCOM, 3)==0) || - (memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)|| - (memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)==0)|| - (memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3)==0) || - (net->broadcom_cap_exist)) - retValue = true; + (memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)|| + (memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)==0)|| + (memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3)==0) || + (net->broadcom_cap_exist)) + retValue = true; else if(net->bssht.bdRT2RTAggregation) retValue = true; else @@ -425,7 +425,7 @@ u8 HTIOTActIsDisableMCS14(struct ieee80211_device* ieee, u8* PeerMacAddr) // Apply for 819u only #if (HAL_CODE_BASE==RTL8192 && DEV_BUS_TYPE==USB_INTERFACE) if((memcmp(PeerMacAddr, UNKNOWN_BORADCOM, 3)==0) || - (memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0) + (memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0) ) { ret = 1; @@ -569,8 +569,8 @@ u8 HTIOTActIsCCDFsync(u8* PeerMacAddr) { u8 retValue = 0; if( (memcmp(PeerMacAddr, UNKNOWN_BORADCOM, 3)==0) || - (memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0) || - (memcmp(PeerMacAddr, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) ==0)) + (memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0) || + (memcmp(PeerMacAddr, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) ==0)) { retValue = 1; } @@ -648,7 +648,7 @@ void HTConstructCapabilityElement(struct ieee80211_device* ieee, u8* posHTCap, u //MAC HT parameters info - // TODO: Nedd to take care of this part + // TODO: Nedd to take care of this part IEEE80211_DEBUG(IEEE80211_DL_HT, "TX HT cap/info ele BW=%d MaxAMSDUSize:%d DssCCk:%d\n", pCapELE->ChlWidth, pCapELE->MaxAMSDUSize, pCapELE->DssCCk); if( IsEncrypt) @@ -1662,7 +1662,7 @@ void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH Bandwidt //if in half N mode, set to 20M bandwidth please 09.08.2008 WB. if(Bandwidth==HT_CHANNEL_WIDTH_20_40 && (!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))) { - // Handle Illegal extention channel offset!! + // Handle Illegal extention channel offset!! if(ieee->current_network.channel<2 && Offset==HT_EXTCHNL_OFFSET_LOWER) Offset = HT_EXTCHNL_OFFSET_NO_EXT; if(Offset==HT_EXTCHNL_OFFSET_UPPER || Offset==HT_EXTCHNL_OFFSET_LOWER) { diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h index f7b882b99d14..7ecfe68ddd58 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h @@ -647,18 +647,18 @@ typedef struct _QOS_TSTREAM{ // 802.11 Management frame Status Code field //---------------------------------------------------------------------------- typedef struct _OCTET_STRING{ - u8 *Octet; - u16 Length; + u8 *Octet; + u16 Length; }OCTET_STRING, *POCTET_STRING; #if 0 #define FillOctetString(_os,_octet,_len) \ - (_os).Octet=(u8 *)(_octet); \ - (_os).Length=(_len); + (_os).Octet=(u8 *)(_octet); \ + (_os).Length=(_len); #define WMM_ELEM_HDR_LEN 6 #define WMMElemSkipHdr(_osWMMElem) \ - (_osWMMElem).Octet += WMM_ELEM_HDR_LEN; \ - (_osWMMElem).Length -= WMM_ELEM_HDR_LEN; + (_osWMMElem).Octet += WMM_ELEM_HDR_LEN; \ + (_osWMMElem).Length -= WMM_ELEM_HDR_LEN; #endif // // STA QoS data. diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c index 5aa4c8db438d..ecf24b9edb1f 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c @@ -509,31 +509,31 @@ void RemoveTsEntry( if(timer_pending(&pRxTS->RxPktPendingTimer)) del_timer_sync(&pRxTS->RxPktPendingTimer); - while(!list_empty(&pRxTS->RxPendingPktList)) - { - // PlatformAcquireSpinLock(Adapter, RT_RX_SPINLOCK); - spin_lock_irqsave(&(ieee->reorder_spinlock), flags); - //pRxReorderEntry = list_entry(&pRxTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List); + while(!list_empty(&pRxTS->RxPendingPktList)) + { + // PlatformAcquireSpinLock(Adapter, RT_RX_SPINLOCK); + spin_lock_irqsave(&(ieee->reorder_spinlock), flags); + //pRxReorderEntry = list_entry(&pRxTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List); pRxReorderEntry = (PRX_REORDER_ENTRY)list_entry(pRxTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List); - list_del_init(&pRxReorderEntry->List); - { - int i = 0; - struct ieee80211_rxb * prxb = pRxReorderEntry->prxb; + list_del_init(&pRxReorderEntry->List); + { + int i = 0; + struct ieee80211_rxb * prxb = pRxReorderEntry->prxb; if (unlikely(!prxb)) { spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); return; } - for(i =0; i < prxb->nr_subframes; i++) { - dev_kfree_skb(prxb->subframes[i]); - } - kfree(prxb); - prxb = NULL; - } - list_add_tail(&pRxReorderEntry->List,&ieee->RxReorder_Unused_List); - //PlatformReleaseSpinLock(Adapter, RT_RX_SPINLOCK); - spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); - } + for(i =0; i < prxb->nr_subframes; i++) { + dev_kfree_skb(prxb->subframes[i]); + } + kfree(prxb); + prxb = NULL; + } + list_add_tail(&pRxReorderEntry->List,&ieee->RxReorder_Unused_List); + //PlatformReleaseSpinLock(Adapter, RT_RX_SPINLOCK); + spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); + } //#endif } diff --git a/drivers/staging/rtl8192u/r8180_pm.c b/drivers/staging/rtl8192u/r8180_pm.c index fdb2eb665197..0c58d0ed502a 100644 --- a/drivers/staging/rtl8192u/r8180_pm.c +++ b/drivers/staging/rtl8192u/r8180_pm.c @@ -17,28 +17,28 @@ int rtl8180_save_state (struct pci_dev *dev, u32 state) { - printk(KERN_NOTICE "r8180 save state call (state %u).\n", state); + printk(KERN_NOTICE "r8180 save state call (state %u).\n", state); return(-EAGAIN); } int rtl8180_suspend (struct pci_dev *dev, u32 state) { - printk(KERN_NOTICE "r8180 suspend call (state %u).\n", state); + printk(KERN_NOTICE "r8180 suspend call (state %u).\n", state); return(-EAGAIN); } int rtl8180_resume (struct pci_dev *dev) { - printk(KERN_NOTICE "r8180 resume call.\n"); + printk(KERN_NOTICE "r8180 resume call.\n"); return(-EAGAIN); } int rtl8180_enable_wake (struct pci_dev *dev, u32 state, int enable) { - printk(KERN_NOTICE "r8180 enable wake call (state %u, enable %d).\n", + printk(KERN_NOTICE "r8180 enable wake call (state %u, enable %d).\n", state, enable); return(-EAGAIN); } diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 15999e850b62..7aa464224d10 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -97,7 +97,7 @@ u32 rt_global_debug_component = \ // COMP_TRACE | COMP_DOWN | // COMP_RECV | - // COMP_SWBW | + // COMP_SWBW | COMP_SEC | // COMP_RESET | // COMP_SEND | @@ -175,17 +175,17 @@ static struct usb_driver rtl8192_usb_driver = { #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15) .owner = THIS_MODULE, #endif - .name = RTL819xU_MODULE_NAME, /* Driver name */ - .id_table = rtl8192_usb_id_tbl, /* PCI_ID table */ - .probe = rtl8192_usb_probe, /* probe fn */ + .name = RTL819xU_MODULE_NAME, /* Driver name */ + .id_table = rtl8192_usb_id_tbl, /* PCI_ID table */ + .probe = rtl8192_usb_probe, /* probe fn */ .disconnect = rtl8192_usb_disconnect, /* remove fn */ #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0) #ifdef CONFIG_RTL8192_PM - .suspend = rtl8192_suspend, /* PM suspend fn */ + .suspend = rtl8192_suspend, /* PM suspend fn */ .resume = rtl8192_resume, /* PM resume fn */ #else - .suspend = NULL, /* PM suspend fn */ - .resume = NULL, /* PM resume fn */ + .suspend = NULL, /* PM suspend fn */ + .resume = NULL, /* PM resume fn */ #endif #endif }; @@ -282,22 +282,22 @@ void CamResetAllEntry(struct net_device *dev) { #if 1 u32 ulcommand = 0; - //2004/02/11 In static WEP, OID_ADD_KEY or OID_ADD_WEP are set before STA associate to AP. - // However, ResetKey is called on OID_802_11_INFRASTRUCTURE_MODE and MlmeAssociateRequest - // In this condition, Cam can not be reset because upper layer will not set this static key again. - //if(Adapter->EncAlgorithm == WEP_Encryption) - // return; + //2004/02/11 In static WEP, OID_ADD_KEY or OID_ADD_WEP are set before STA associate to AP. + // However, ResetKey is called on OID_802_11_INFRASTRUCTURE_MODE and MlmeAssociateRequest + // In this condition, Cam can not be reset because upper layer will not set this static key again. + //if(Adapter->EncAlgorithm == WEP_Encryption) + // return; //debug - //DbgPrint("========================================\n"); - //DbgPrint(" Call ResetAllEntry \n"); - //DbgPrint("========================================\n\n"); + //DbgPrint("========================================\n"); + //DbgPrint(" Call ResetAllEntry \n"); + //DbgPrint("========================================\n\n"); ulcommand |= BIT31|BIT30; write_nic_dword(dev, RWCAM, ulcommand); #else - for(ucIndex=0;ucIndex>8)&0x0f, &data, 1, HZ / 2); - if (status < 0) - { - printk("write_nic_byte TimeOut! status:%d\n", status); - } + if (status < 0) + { + printk("write_nic_byte TimeOut! status:%d\n", status); + } } @@ -382,10 +382,10 @@ void write_nic_word(struct net_device *dev, int indx, u16 data) RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, (indx&0xff)|0xff00, (indx>>8)&0x0f, &data, 2, HZ / 2); - if (status < 0) - { - printk("write_nic_word TimeOut! status:%d\n", status); - } + if (status < 0) + { + printk("write_nic_word TimeOut! status:%d\n", status); + } } @@ -403,10 +403,10 @@ void write_nic_dword(struct net_device *dev, int indx, u32 data) (indx&0xff)|0xff00, (indx>>8)&0x0f, &data, 4, HZ / 2); - if (status < 0) - { - printk("write_nic_dword TimeOut! status:%d\n", status); - } + if (status < 0) + { + printk("write_nic_dword TimeOut! status:%d\n", status); + } } @@ -423,10 +423,10 @@ u8 read_nic_byte(struct net_device *dev, int indx) RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, (indx&0xff)|0xff00, (indx>>8)&0x0f, &data, 1, HZ / 2); - if (status < 0) - { - printk("read_nic_byte TimeOut! status:%d\n", status); - } + if (status < 0) + { + printk("read_nic_byte TimeOut! status:%d\n", status); + } return data; } @@ -444,10 +444,10 @@ u16 read_nic_word(struct net_device *dev, int indx) RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, (indx&0xff)|0xff00, (indx>>8)&0x0f, &data, 2, HZ / 2); - if (status < 0) - { - printk("read_nic_word TimeOut! status:%d\n", status); - } + if (status < 0) + { + printk("read_nic_word TimeOut! status:%d\n", status); + } return data; @@ -464,10 +464,10 @@ u16 read_nic_word_E(struct net_device *dev, int indx) RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, indx|0xfe00, 0, &data, 2, HZ / 2); - if (status < 0) - { - printk("read_nic_word TimeOut! status:%d\n", status); - } + if (status < 0) + { + printk("read_nic_word TimeOut! status:%d\n", status); + } return data; @@ -489,10 +489,10 @@ u32 read_nic_dword(struct net_device *dev, int indx) // printk(KERN_WARNING "read size of data = %d\, date = %d\n", result, data); // } - if (status < 0) - { - printk("read_nic_dword TimeOut! status:%d\n", status); - } + if (status < 0) + { + printk("read_nic_dword TimeOut! status:%d\n", status); + } @@ -542,21 +542,21 @@ static int proc_get_stats_ap(char *page, char **start, int len = 0; - list_for_each_entry(target, &ieee->network_list, list) { + list_for_each_entry(target, &ieee->network_list, list) { len += snprintf(page + len, count - len, - "%s ", target->ssid); + "%s ", target->ssid); if(target->wpa_ie_len>0 || target->rsn_ie_len>0){ - len += snprintf(page + len, count - len, - "WPA\n"); + len += snprintf(page + len, count - len, + "WPA\n"); } else{ - len += snprintf(page + len, count - len, - "non_WPA\n"); - } + len += snprintf(page + len, count - len, + "non_WPA\n"); + } - } + } *eof = 1; return len; @@ -576,7 +576,7 @@ static int proc_get_registers(char *page, char **start, /* This dump the current register page */ len += snprintf(page + len, count - len, - "\n####################page 0##################\n "); + "\n####################page 0##################\n "); for(n=0;n<=max;) { @@ -592,33 +592,33 @@ len += snprintf(page + len, count - len, } #if 1 len += snprintf(page + len, count - len, - "\n####################page 1##################\n "); - for(n=0;n<=max;) - { - //printk( "\nD: %2x> ", n); - len += snprintf(page + len, count - len, - "\nD: %2x > ",n); + "\n####################page 1##################\n "); + for(n=0;n<=max;) + { + //printk( "\nD: %2x> ", n); + len += snprintf(page + len, count - len, + "\nD: %2x > ",n); - for(i=0;i<16 && n<=max;i++,n++) - len += snprintf(page + len, count - len, - "%2x ",read_nic_byte(dev,0x100|n)); + for(i=0;i<16 && n<=max;i++,n++) + len += snprintf(page + len, count - len, + "%2x ",read_nic_byte(dev,0x100|n)); - // printk("%2x ",read_nic_byte(dev,n)); - } + // printk("%2x ",read_nic_byte(dev,n)); + } len += snprintf(page + len, count - len, - "\n####################page 3##################\n "); - for(n=0;n<=max;) - { - //printk( "\nD: %2x> ", n); - len += snprintf(page + len, count - len, - "\nD: %2x > ",n); + "\n####################page 3##################\n "); + for(n=0;n<=max;) + { + //printk( "\nD: %2x> ", n); + len += snprintf(page + len, count - len, + "\nD: %2x > ",n); - for(i=0;i<16 && n<=max;i++,n++) - len += snprintf(page + len, count - len, - "%2x ",read_nic_byte(dev,0x300|n)); + for(i=0;i<16 && n<=max;i++,n++) + len += snprintf(page + len, count - len, + "%2x ",read_nic_byte(dev,0x300|n)); - // printk("%2x ",read_nic_byte(dev,n)); - } + // printk("%2x ",read_nic_byte(dev,n)); + } #endif @@ -1154,64 +1154,64 @@ u32 get_rxpacket_shiftbytes_819xusb(struct ieee80211_rx_stats *pstats) } static int rtl8192_rx_initiate(struct net_device*dev) { - struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); - struct urb *entry; - struct sk_buff *skb; - struct rtl8192_rx_info *info; + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + struct urb *entry; + struct sk_buff *skb; + struct rtl8192_rx_info *info; /* nomal packet rx procedure */ - while (skb_queue_len(&priv->rx_queue) < MAX_RX_URB) { - skb = __dev_alloc_skb(RX_URB_SIZE, GFP_KERNEL); - if (!skb) - break; + while (skb_queue_len(&priv->rx_queue) < MAX_RX_URB) { + skb = __dev_alloc_skb(RX_URB_SIZE, GFP_KERNEL); + if (!skb) + break; #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) - entry = usb_alloc_urb(0, GFP_KERNEL); + entry = usb_alloc_urb(0, GFP_KERNEL); #else - entry = usb_alloc_urb(0); + entry = usb_alloc_urb(0); #endif - if (!entry) { - kfree_skb(skb); - break; - } + if (!entry) { + kfree_skb(skb); + break; + } // printk("nomal packet IN request!\n"); - usb_fill_bulk_urb(entry, priv->udev, - usb_rcvbulkpipe(priv->udev, 3), skb_tail_pointer(skb), - RX_URB_SIZE, rtl8192_rx_isr, skb); - info = (struct rtl8192_rx_info *) skb->cb; - info->urb = entry; - info->dev = dev; + usb_fill_bulk_urb(entry, priv->udev, + usb_rcvbulkpipe(priv->udev, 3), skb_tail_pointer(skb), + RX_URB_SIZE, rtl8192_rx_isr, skb); + info = (struct rtl8192_rx_info *) skb->cb; + info->urb = entry; + info->dev = dev; info->out_pipe = 3; //denote rx normal packet queue - skb_queue_tail(&priv->rx_queue, skb); - usb_submit_urb(entry, GFP_KERNEL); - } + skb_queue_tail(&priv->rx_queue, skb); + usb_submit_urb(entry, GFP_KERNEL); + } /* command packet rx procedure */ - while (skb_queue_len(&priv->rx_queue) < MAX_RX_URB + 3) { + while (skb_queue_len(&priv->rx_queue) < MAX_RX_URB + 3) { // printk("command packet IN request!\n"); - skb = __dev_alloc_skb(RX_URB_SIZE ,GFP_KERNEL); - if (!skb) - break; + skb = __dev_alloc_skb(RX_URB_SIZE ,GFP_KERNEL); + if (!skb) + break; #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) - entry = usb_alloc_urb(0, GFP_KERNEL); + entry = usb_alloc_urb(0, GFP_KERNEL); #else - entry = usb_alloc_urb(0); -#endif - if (!entry) { - kfree_skb(skb); - break; - } - usb_fill_bulk_urb(entry, priv->udev, - usb_rcvbulkpipe(priv->udev, 9), skb_tail_pointer(skb), - RX_URB_SIZE, rtl8192_rx_isr, skb); - info = (struct rtl8192_rx_info *) skb->cb; - info->urb = entry; - info->dev = dev; + entry = usb_alloc_urb(0); +#endif + if (!entry) { + kfree_skb(skb); + break; + } + usb_fill_bulk_urb(entry, priv->udev, + usb_rcvbulkpipe(priv->udev, 9), skb_tail_pointer(skb), + RX_URB_SIZE, rtl8192_rx_isr, skb); + info = (struct rtl8192_rx_info *) skb->cb; + info->urb = entry; + info->dev = dev; info->out_pipe = 9; //denote rx cmd packet queue - skb_queue_tail(&priv->rx_queue, skb); + skb_queue_tail(&priv->rx_queue, skb); usb_submit_urb(entry, GFP_KERNEL); - } + } - return 0; + return 0; } void rtl8192_set_rxconf(struct net_device *dev) @@ -1543,53 +1543,53 @@ static void rtl8192_rx_isr(struct urb *urb, struct pt_regs *regs) static void rtl8192_rx_isr(struct urb *urb) #endif { - struct sk_buff *skb = (struct sk_buff *) urb->context; - struct rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; - struct net_device *dev = info->dev; + struct sk_buff *skb = (struct sk_buff *) urb->context; + struct rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; + struct net_device *dev = info->dev; struct r8192_priv *priv = ieee80211_priv(dev); int out_pipe = info->out_pipe; int err; if(!priv->up) return; - if (unlikely(urb->status)) { - info->urb = NULL; - priv->stats.rxstaterr++; - priv->ieee80211->stats.rx_errors++; - usb_free_urb(urb); + if (unlikely(urb->status)) { + info->urb = NULL; + priv->stats.rxstaterr++; + priv->ieee80211->stats.rx_errors++; + usb_free_urb(urb); // printk("%s():rx status err\n",__FUNCTION__); - return; - } + return; + } #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14) - skb_unlink(skb, &priv->rx_queue); + skb_unlink(skb, &priv->rx_queue); #else - __skb_unlink(skb,&priv->rx_queue); + __skb_unlink(skb,&priv->rx_queue); #endif - skb_put(skb, urb->actual_length); + skb_put(skb, urb->actual_length); skb_queue_tail(&priv->skb_queue, skb); tasklet_schedule(&priv->irq_rx_tasklet); - skb = dev_alloc_skb(RX_URB_SIZE); - if (unlikely(!skb)) { - usb_free_urb(urb); + skb = dev_alloc_skb(RX_URB_SIZE); + if (unlikely(!skb)) { + usb_free_urb(urb); printk("%s():can,t alloc skb\n",__FUNCTION__); - /* TODO check rx queue length and refill *somewhere* */ - return; - } + /* TODO check rx queue length and refill *somewhere* */ + return; + } usb_fill_bulk_urb(urb, priv->udev, usb_rcvbulkpipe(priv->udev, out_pipe), skb_tail_pointer(skb), RX_URB_SIZE, rtl8192_rx_isr, skb); - info = (struct rtl8192_rx_info *) skb->cb; - info->urb = urb; - info->dev = dev; + info = (struct rtl8192_rx_info *) skb->cb; + info->urb = urb; + info->dev = dev; info->out_pipe = out_pipe; - urb->transfer_buffer = skb_tail_pointer(skb); - urb->context = skb; - skb_queue_tail(&priv->rx_queue, skb); - err = usb_submit_urb(urb, GFP_ATOMIC); + urb->transfer_buffer = skb_tail_pointer(skb); + urb->context = skb; + skb_queue_tail(&priv->rx_queue, skb); + err = usb_submit_urb(urb, GFP_ATOMIC); if(err && err != EPERM) printk("can not submit rxurb, err is %x,URB status is %x\n",err,urb->status); } @@ -1674,7 +1674,7 @@ void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rat spin_lock_irqsave(&priv->tx_lock,flags); - memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); + memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); // tcb_desc->RATRIndex = 7; // tcb_desc->bTxDisableRateFallBack = 1; // tcb_desc->bTxUseDriverAssingedRate = 1; @@ -1701,18 +1701,18 @@ int rtl8192_hard_start_xmit(struct sk_buff *skb,struct net_device *dev) struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); int ret; unsigned long flags; - cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); - u8 queue_index = tcb_desc->queue_index; + cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + u8 queue_index = tcb_desc->queue_index; spin_lock_irqsave(&priv->tx_lock,flags); - memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); + memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); if(queue_index == TXCMD_QUEUE) { skb_push(skb, USB_HWDESC_HEADER_LEN); rtl819xU_tx_cmd(dev, skb); ret = 1; - spin_unlock_irqrestore(&priv->tx_lock,flags); + spin_unlock_irqrestore(&priv->tx_lock,flags); return ret; } else { skb_push(skb, priv->ieee80211->tx_headroom); @@ -1780,7 +1780,7 @@ struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); tcb_desc->drv_agg_enable = 1; tcb_desc->pkt_size = skb->len; - tcb_desc->DrvAggrNum = pSendList->nr_drv_agg_frames; + tcb_desc->DrvAggrNum = pSendList->nr_drv_agg_frames; printk("DrvAggNum = %d\n", tcb_desc->DrvAggrNum); // RT_DEBUG_DATA(COMP_SEND, skb->cb, sizeof(skb->cb)); // printk("========>skb->data ======> \n"); @@ -2061,7 +2061,7 @@ static void rtl8192_tx_isr(struct urb *tx_urb) } #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE else if ((skb_queue_len(&priv->ieee80211->skb_drv_aggQ[queue_index])!= 0)&&\ - (!(priv->ieee80211->queue_stop))) { + (!(priv->ieee80211->queue_stop))) { // Tx Driver Aggregation process /* The driver will aggregation the packets according to the following stets * 1. check whether there's tx irq available, for it's a completion return @@ -2083,7 +2083,7 @@ static void rtl8192_tx_isr(struct urb *tx_urb) u8* pHeader = skb->data; if(IsMgntQosData(pHeader) || - IsMgntQData_Ack(pHeader) || + IsMgntQData_Ack(pHeader) || IsMgntQData_Poll(pHeader) || IsMgntQData_Poll_Ack(pHeader) ) @@ -2253,7 +2253,7 @@ void rtl8192_net_update(struct net_device *dev) write_nic_byte(dev, BCN_ERR_THRESH, 100); BcnTimeCfg |= (BcnCW< %s\n", __FUNCTION__); pend = atomic_read(&priv->tx_pending[tcb_desc->queue_index]); @@ -2735,9 +2735,9 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) /* Fill Tx descriptor */ memset(tx_desc, 0, sizeof(tx_desc_819x_usb)); /* DWORD 0 */ - tx_desc->LINIP = 0; - tx_desc->CmdInit = 1; - tx_desc->Offset = sizeof(tx_fwinfo_819x_usb) + 8; + tx_desc->LINIP = 0; + tx_desc->CmdInit = 1; + tx_desc->Offset = sizeof(tx_fwinfo_819x_usb) + 8; #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE if (tcb_desc->drv_agg_enable) { @@ -2828,16 +2828,16 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) tx_desc->DISFB = tcb_desc->bTxDisableRateFallBack; tx_desc->USERATE = tcb_desc->bTxUseDriverAssingedRate; - /* Fill fields that are required to be initialized in all of the descriptors */ - //DWORD 0 + /* Fill fields that are required to be initialized in all of the descriptors */ + //DWORD 0 #if 0 - tx_desc->FirstSeg = (tcb_desc->bFirstSeg)? 1:0; - tx_desc->LastSeg = (tcb_desc->bLastSeg)?1:0; + tx_desc->FirstSeg = (tcb_desc->bFirstSeg)? 1:0; + tx_desc->LastSeg = (tcb_desc->bLastSeg)?1:0; #else - tx_desc->FirstSeg = 1; - tx_desc->LastSeg = 1; + tx_desc->FirstSeg = 1; + tx_desc->LastSeg = 1; #endif - tx_desc->OWN = 1; + tx_desc->OWN = 1; #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE if (tcb_desc->drv_agg_enable) { @@ -2959,29 +2959,29 @@ short rtl8192_usb_initendpoints(struct net_device *dev) } #endif - memset(priv->rx_urb, 0, sizeof(struct urb*) * MAX_RX_URB); - priv->pp_rxskb = (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) * MAX_RX_URB, GFP_KERNEL); - if (priv->pp_rxskb == NULL) - goto destroy; + memset(priv->rx_urb, 0, sizeof(struct urb*) * MAX_RX_URB); + priv->pp_rxskb = (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) * MAX_RX_URB, GFP_KERNEL); + if (priv->pp_rxskb == NULL) + goto destroy; - memset(priv->pp_rxskb, 0, sizeof(struct sk_buff*) * MAX_RX_URB); + memset(priv->pp_rxskb, 0, sizeof(struct sk_buff*) * MAX_RX_URB); - goto _middle; + goto _middle; destroy: - if (priv->pp_rxskb) { - kfree(priv->pp_rxskb); - } - if (priv->rx_urb) { - kfree(priv->rx_urb); - } + if (priv->pp_rxskb) { + kfree(priv->pp_rxskb); + } + if (priv->rx_urb) { + kfree(priv->rx_urb); + } - priv->pp_rxskb = NULL; + priv->pp_rxskb = NULL; priv->rx_urb = NULL; - DMESGE("Endpoint Alloc Failure"); - return -ENOMEM; + DMESGE("Endpoint Alloc Failure"); + return -ENOMEM; _middle: @@ -3008,9 +3008,9 @@ void rtl8192_usb_deleteendpoints(struct net_device *dev) kfree(priv->oldaddr); priv->oldaddr = NULL; } - if (priv->pp_rxskb) { - kfree(priv->pp_rxskb); - priv->pp_rxskb = 0; + if (priv->pp_rxskb) { + kfree(priv->pp_rxskb); + priv->pp_rxskb = 0; } } #else @@ -3033,18 +3033,18 @@ void rtl8192_usb_deleteendpoints(struct net_device *dev) } #else if(priv->rx_urb){ - kfree(priv->rx_urb); - priv->rx_urb = NULL; - } + kfree(priv->rx_urb); + priv->rx_urb = NULL; + } if(priv->oldaddr){ kfree(priv->oldaddr); priv->oldaddr = NULL; } - if (priv->pp_rxskb) { - kfree(priv->pp_rxskb); - priv->pp_rxskb = 0; + if (priv->pp_rxskb) { + kfree(priv->pp_rxskb); + priv->pp_rxskb = 0; - } + } #endif } @@ -3157,29 +3157,29 @@ int WDCAPARA_ADD[] = {EDCAPARA_BE,EDCAPARA_BK,EDCAPARA_VI,EDCAPARA_VO}; #if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20) void rtl8192_qos_activate(struct work_struct * work) { - struct r8192_priv *priv = container_of(work, struct r8192_priv, qos_activate); - struct net_device *dev = priv->ieee80211->dev; + struct r8192_priv *priv = container_of(work, struct r8192_priv, qos_activate); + struct net_device *dev = priv->ieee80211->dev; #else void rtl8192_qos_activate(struct net_device *dev) { - struct r8192_priv *priv = ieee80211_priv(dev); + struct r8192_priv *priv = ieee80211_priv(dev); #endif - struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters; - u8 mode = priv->ieee80211->current_network.mode; - //u32 size = sizeof(struct ieee80211_qos_parameters); + struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters; + u8 mode = priv->ieee80211->current_network.mode; + //u32 size = sizeof(struct ieee80211_qos_parameters); u8 u1bAIFS; u32 u4bAcParam; - int i; + int i; - if (priv == NULL) - return; + if (priv == NULL) + return; #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)) down(&priv->mutex); #else mutex_lock(&priv->mutex); #endif - if(priv->ieee80211->state != IEEE80211_LINKED) + if(priv->ieee80211->state != IEEE80211_LINKED) goto success; RT_TRACE(COMP_QOS,"qos active process with associate response received\n"); /* It better set slot time at first */ @@ -3213,10 +3213,10 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, u32 size = sizeof(struct ieee80211_qos_parameters); if(priv->ieee80211->state !=IEEE80211_LINKED) - return ret; + return ret; - if ((priv->ieee80211->iw_mode != IW_MODE_INFRA)) - return ret; + if ((priv->ieee80211->iw_mode != IW_MODE_INFRA)) + return ret; if (network->flags & NETWORK_HAS_QOS_MASK) { if (active_network && @@ -3258,8 +3258,8 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, /* handle manage frame frame beacon and probe response */ static int rtl8192_handle_beacon(struct net_device * dev, - struct ieee80211_beacon * beacon, - struct ieee80211_network * network) + struct ieee80211_beacon * beacon, + struct ieee80211_network * network) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -3284,23 +3284,23 @@ static int rtl8192_handle_beacon(struct net_device * dev, * setting */ static int rtl8192_qos_association_resp(struct r8192_priv *priv, - struct ieee80211_network *network) + struct ieee80211_network *network) { - int ret = 0; - unsigned long flags; - u32 size = sizeof(struct ieee80211_qos_parameters); - int set_qos_param = 0; + int ret = 0; + unsigned long flags; + u32 size = sizeof(struct ieee80211_qos_parameters); + int set_qos_param = 0; - if ((priv == NULL) || (network == NULL)) - return ret; + if ((priv == NULL) || (network == NULL)) + return ret; if(priv->ieee80211->state !=IEEE80211_LINKED) - return ret; + return ret; - if ((priv->ieee80211->iw_mode != IW_MODE_INFRA)) - return ret; + if ((priv->ieee80211->iw_mode != IW_MODE_INFRA)) + return ret; - spin_lock_irqsave(&priv->ieee80211->lock, flags); + spin_lock_irqsave(&priv->ieee80211->lock, flags); if(network->flags & NETWORK_HAS_QOS_PARAMETERS) { memcpy(&priv->ieee80211->current_network.qos_data.parameters,\ &network->qos_data.parameters,\ @@ -3311,22 +3311,22 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv, network->qos_data.param_count)) #endif { - set_qos_param = 1; + set_qos_param = 1; /* update qos parameter for current network */ priv->ieee80211->current_network.qos_data.old_param_count = \ priv->ieee80211->current_network.qos_data.param_count; priv->ieee80211->current_network.qos_data.param_count = \ - network->qos_data.param_count; + network->qos_data.param_count; } - } else { + } else { memcpy(&priv->ieee80211->current_network.qos_data.parameters,\ &def_qos_parameters, size); priv->ieee80211->current_network.qos_data.active = 0; priv->ieee80211->current_network.qos_data.supported = 0; - set_qos_param = 1; - } + set_qos_param = 1; + } - spin_unlock_irqrestore(&priv->ieee80211->lock, flags); + spin_unlock_irqrestore(&priv->ieee80211->lock, flags); RT_TRACE(COMP_QOS, "%s: network->flags = %d,%d\n",__FUNCTION__,network->flags ,priv->ieee80211->current_network.qos_data.active); if (set_qos_param == 1) @@ -3337,17 +3337,17 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv, #endif - return ret; + return ret; } static int rtl8192_handle_assoc_response(struct net_device *dev, - struct ieee80211_assoc_response_frame *resp, - struct ieee80211_network *network) + struct ieee80211_assoc_response_frame *resp, + struct ieee80211_network *network) { - struct r8192_priv *priv = ieee80211_priv(dev); - rtl8192_qos_association_resp(priv, network); - return 0; + struct r8192_priv *priv = ieee80211_priv(dev); + rtl8192_qos_association_resp(priv, network); + return 0; } @@ -3408,13 +3408,13 @@ bool GetNmodeSupportBySecCfg8192(struct net_device*dev) struct r8192_priv* priv = ieee80211_priv(dev); struct ieee80211_device* ieee = priv->ieee80211; struct ieee80211_network * network = &ieee->current_network; - int wpa_ie_len= ieee->wpa_ie_len; - struct ieee80211_crypt_data* crypt; - int encrypt; + int wpa_ie_len= ieee->wpa_ie_len; + struct ieee80211_crypt_data* crypt; + int encrypt; - crypt = ieee->crypt[ieee->tx_keyidx]; + crypt = ieee->crypt[ieee->tx_keyidx]; //we use connecting AP's capability instead of only security config on our driver to distinguish whether it should use N mode or G mode - encrypt = (network->capability & WLAN_CAPABILITY_PRIVACY) || (ieee->host_encrypt && crypt && crypt->ops && (0 == strcmp(crypt->ops->name,"WEP"))); + encrypt = (network->capability & WLAN_CAPABILITY_PRIVACY) || (ieee->host_encrypt && crypt && crypt->ops && (0 == strcmp(crypt->ops->name,"WEP"))); /* simply judge */ if(encrypt && (wpa_ie_len == 0)) { @@ -3433,16 +3433,16 @@ bool GetNmodeSupportBySecCfg8192(struct net_device*dev) } #if 0 - //In here we discuss with SD4 David. He think we still can send TKIP in broadcast group key in MCS rate. - //We can't force in G mode if Pairwie key is AES and group key is TKIP - if((pSecInfo->GroupEncAlgorithm == WEP104_Encryption) || (pSecInfo->GroupEncAlgorithm == WEP40_Encryption) || - (pSecInfo->PairwiseEncAlgorithm == WEP104_Encryption) || - (pSecInfo->PairwiseEncAlgorithm == WEP40_Encryption) || (pSecInfo->PairwiseEncAlgorithm == TKIP_Encryption)) - { - return false; - } - else - return true; + //In here we discuss with SD4 David. He think we still can send TKIP in broadcast group key in MCS rate. + //We can't force in G mode if Pairwie key is AES and group key is TKIP + if((pSecInfo->GroupEncAlgorithm == WEP104_Encryption) || (pSecInfo->GroupEncAlgorithm == WEP40_Encryption) || + (pSecInfo->PairwiseEncAlgorithm == WEP104_Encryption) || + (pSecInfo->PairwiseEncAlgorithm == WEP40_Encryption) || (pSecInfo->PairwiseEncAlgorithm == TKIP_Encryption)) + { + return false; + } + else + return true; #endif return true; #endif @@ -3608,10 +3608,10 @@ static void rtl8192_init_priv_variable(struct net_device* dev) priv->card_type = USB; #ifdef TO_DO_LIST if(Adapter->bInHctTest) - { + { pHalData->ShortRetryLimit = 7; pHalData->LongRetryLimit = 7; - } + } #endif { priv->ShortRetryLimit = 0x30; @@ -3622,7 +3622,7 @@ static void rtl8192_init_priv_variable(struct net_device* dev) priv->TransmitConfig = // TCR_DurProcMode | //for RTL8185B, duration setting by HW //? TCR_DISReqQsize | - (TCR_MXDMA_2048<ShortRetryLimit<LongRetryLimit<pFirmware, 0, sizeof(rt_firmware)); /* rx related queue */ - skb_queue_head_init(&priv->rx_queue); + skb_queue_head_init(&priv->rx_queue); skb_queue_head_init(&priv->skb_queue); /* Tx related queue */ @@ -3984,7 +3984,7 @@ static void rtl8192_read_eeprom_info(struct net_device* dev) priv->LedStrategy = SW_LED_MODE2; break; - case RT_CID_DLINK: + case RT_CID_DLINK: priv->LedStrategy = SW_LED_MODE4; break; @@ -4655,7 +4655,7 @@ RxCheckStuck(struct net_device *dev) //PlatformAcquireSpinLock(Adapter, RT_RX_SPINLOCK); if(priv->IrpPendingCount > 1) - bRxCheck = TRUE; + bRxCheck = TRUE; //PlatformReleaseSpinLock(Adapter, RT_RX_SPINLOCK); // RT_TRACE(COMP_RESET,"bRxCheck is %d \n",bRxCheck); @@ -5022,13 +5022,13 @@ void CAM_read_entry( } } #endif - write_nic_dword(dev, RWCAM, target_command); - RT_TRACE(COMP_SEC,"CAM_read_entry(): WRITE A0: %x \n",target_command); - // printk("CAM_read_entry(): WRITE A0: %lx \n",target_command); - target_content = read_nic_dword(dev, RCAMO); - RT_TRACE(COMP_SEC, "CAM_read_entry(): WRITE A8: %x \n",target_content); - // printk("CAM_read_entry(): WRITE A8: %lx \n",target_content); - } + write_nic_dword(dev, RWCAM, target_command); + RT_TRACE(COMP_SEC,"CAM_read_entry(): WRITE A0: %x \n",target_command); + // printk("CAM_read_entry(): WRITE A0: %lx \n",target_command); + target_content = read_nic_dword(dev, RCAMO); + RT_TRACE(COMP_SEC, "CAM_read_entry(): WRITE A8: %x \n",target_content); + // printk("CAM_read_entry(): WRITE A8: %lx \n",target_content); + } printk("\n"); } @@ -5067,7 +5067,7 @@ extern void rtl819x_watchdog_wqcallback(struct net_device *dev) #endif struct ieee80211_device* ieee = priv->ieee80211; RESET_TYPE ResetType = RESET_TYPE_NORESET; - static u8 check_reset_cnt=0; + static u8 check_reset_cnt=0; bool bBusyTraffic = false; if(!priv->up) @@ -5247,18 +5247,18 @@ int rtl8192_down(struct net_device *dev) //rtl8192_irq_disable(dev); /* Tx related queue release */ - for(i = 0; i < MAX_QUEUE_SIZE; i++) { - skb_queue_purge(&priv->ieee80211->skb_waitQ [i]); - } - for(i = 0; i < MAX_QUEUE_SIZE; i++) { - skb_queue_purge(&priv->ieee80211->skb_aggQ [i]); - } + for(i = 0; i < MAX_QUEUE_SIZE; i++) { + skb_queue_purge(&priv->ieee80211->skb_waitQ [i]); + } + for(i = 0; i < MAX_QUEUE_SIZE; i++) { + skb_queue_purge(&priv->ieee80211->skb_aggQ [i]); + } - for(i = 0; i < MAX_QUEUE_SIZE; i++) { - skb_queue_purge(&priv->ieee80211->skb_drv_aggQ [i]); - } + for(i = 0; i < MAX_QUEUE_SIZE; i++) { + skb_queue_purge(&priv->ieee80211->skb_drv_aggQ [i]); + } - //as cancel_delayed_work will del work->timer, so if work is not definedas struct delayed_work, it will corrupt + //as cancel_delayed_work will del work->timer, so if work is not definedas struct delayed_work, it will corrupt // flush_scheduled_work(); rtl8192_cancel_deferred_work(priv); deinit_hal_dm(dev); @@ -5301,13 +5301,13 @@ void rtl8192_restart(struct net_device *dev) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) void rtl8192_restart(struct work_struct *work) { - struct r8192_priv *priv = container_of(work, struct r8192_priv, reset_wq); - struct net_device *dev = priv->ieee80211->dev; + struct r8192_priv *priv = container_of(work, struct r8192_priv, reset_wq); + struct net_device *dev = priv->ieee80211->dev; #else void rtl8192_restart(struct net_device *dev) { - struct r8192_priv *priv = ieee80211_priv(dev); + struct r8192_priv *priv = ieee80211_priv(dev); #endif down(&priv->wx_sem); @@ -5373,19 +5373,19 @@ int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) if (p->length < sizeof(struct ieee_param) || !p->pointer){ - ret = -EINVAL; - goto out; + ret = -EINVAL; + goto out; } ipw = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL); if (ipw == NULL){ - ret = -ENOMEM; - goto out; + ret = -ENOMEM; + goto out; } if (copy_from_user(ipw, p->pointer, p->length)) { kfree(ipw); - ret = -EFAULT; - goto out; + ret = -EFAULT; + goto out; } switch (cmd) { @@ -5466,7 +5466,7 @@ int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) break; } kfree(ipw); - ipw = NULL; + ipw = NULL; out: up(&priv->wx_sem); return ret; @@ -5660,8 +5660,8 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802 { for (rfpath = RF90_PATH_A; rfpath < priv->NumTotalRFPath; rfpath++) { - if (!rtl8192_phy_CheckIsLegalRFPath(priv->ieee80211->dev, rfpath)) - continue; + if (!rtl8192_phy_CheckIsLegalRFPath(priv->ieee80211->dev, rfpath)) + continue; //Fixed by Jacken 2008-03-20 if(priv->stats.rx_rssi_percentage[rfpath] == 0) @@ -6117,7 +6117,7 @@ static void rtl8192_query_rxphystatus( // (3)EVM of HT rate // if(pdrvinfo->RxHT && pdrvinfo->RxRate>=DESC90_RATEMCS8 && - pdrvinfo->RxRate<=DESC90_RATEMCS15) + pdrvinfo->RxRate<=DESC90_RATEMCS15) max_spatial_stream = 2; //both spatial stream make sense else max_spatial_stream = 1; //only spatial stream 1 makes sense @@ -6184,7 +6184,7 @@ rtl8192_record_rxdesc_forlateruse( void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, struct ieee80211_rx_stats * pstats, - rx_drvinfo_819x_usb *pdrvinfo) + rx_drvinfo_819x_usb *pdrvinfo) { // TODO: We must only check packet for current MAC address. Not finish rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; @@ -6212,8 +6212,8 @@ void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, /* Check if the received packet is acceptabe. */ bpacket_match_bssid = ((IEEE80211_FTYPE_CTL != type) && - (eqMacAddr(priv->ieee80211->current_network.bssid, (fc & IEEE80211_FCTL_TODS)? hdr->addr1 : (fc & IEEE80211_FCTL_FROMDS )? hdr->addr2 : hdr->addr3)) - && (!pstats->bHwError) && (!pstats->bCRC)&& (!pstats->bICV)); + (eqMacAddr(priv->ieee80211->current_network.bssid, (fc & IEEE80211_FCTL_TODS)? hdr->addr1 : (fc & IEEE80211_FCTL_FROMDS )? hdr->addr2 : hdr->addr3)) + && (!pstats->bHwError) && (!pstats->bCRC)&& (!pstats->bICV)); bpacket_toself = bpacket_match_bssid & (eqMacAddr(praddr, priv->ieee80211->dev->dev_addr)); #if 1//cosa @@ -6271,20 +6271,20 @@ UpdateReceivedRateHistogramStatistics8190( ) { struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); - u32 rcvType=1; //0: Total, 1:OK, 2:CRC, 3:ICV - u32 rateIndex; - u32 preamble_guardinterval; //1: short preamble/GI, 0: long preamble/GI + u32 rcvType=1; //0: Total, 1:OK, 2:CRC, 3:ICV + u32 rateIndex; + u32 preamble_guardinterval; //1: short preamble/GI, 0: long preamble/GI - if(stats->bCRC) - rcvType = 2; - else if(stats->bICV) - rcvType = 3; + if(stats->bCRC) + rcvType = 2; + else if(stats->bICV) + rcvType = 3; - if(stats->bShortPreamble) - preamble_guardinterval = 1;// short - else - preamble_guardinterval = 0;// long + if(stats->bShortPreamble) + preamble_guardinterval = 1;// short + else + preamble_guardinterval = 0;// long switch(stats->rate) { @@ -6784,12 +6784,12 @@ void rtl8192_rx_cmd(struct sk_buff *skb) void rtl8192_irq_rx_tasklet(struct r8192_priv *priv) { - struct sk_buff *skb; + struct sk_buff *skb; struct rtl8192_rx_info *info; - while (NULL != (skb = skb_dequeue(&priv->skb_queue))) { + while (NULL != (skb = skb_dequeue(&priv->skb_queue))) { info = (struct rtl8192_rx_info *)skb->cb; - switch (info->out_pipe) { + switch (info->out_pipe) { /* Nomal packet pipe */ case 3: //RT_TRACE(COMP_RECV, "normal in-pipe index(%d)\n",info->out_pipe); @@ -6812,7 +6812,7 @@ void rtl8192_irq_rx_tasklet(struct r8192_priv *priv) break; } - } + } } static const struct net_device_ops rtl8192_netdev_ops = { @@ -6838,8 +6838,8 @@ static int __devinit rtl8192_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) #else static void * __devinit rtl8192_usb_probe(struct usb_device *udev, - unsigned int ifnum, - const struct usb_device_id *id) + unsigned int ifnum, + const struct usb_device_id *id) #endif { // unsigned long ioaddr = 0; @@ -6848,7 +6848,7 @@ static void * __devinit rtl8192_usb_probe(struct usb_device *udev, #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) struct usb_device *udev = interface_to_usbdev(intf); #endif - RT_TRACE(COMP_INIT, "Oops: i'm coming\n"); + RT_TRACE(COMP_INIT, "Oops: i'm coming\n"); dev = alloc_ieee80211(sizeof(struct r8192_priv)); @@ -6868,24 +6868,24 @@ static void * __devinit rtl8192_usb_probe(struct usb_device *udev, #endif priv->udev=udev; - dev->netdev_ops = &rtl8192_netdev_ops; + dev->netdev_ops = &rtl8192_netdev_ops; - //DMESG("Oops: i'm coming\n"); + //DMESG("Oops: i'm coming\n"); #if WIRELESS_EXT >= 12 #if WIRELESS_EXT < 17 - dev->get_wireless_stats = r8192_get_wireless_stats; + dev->get_wireless_stats = r8192_get_wireless_stats; #endif - dev->wireless_handlers = (struct iw_handler_def *) &r8192_wx_handlers_def; + dev->wireless_handlers = (struct iw_handler_def *) &r8192_wx_handlers_def; #endif dev->type=ARPHRD_ETHER; dev->watchdog_timeo = HZ*3; //modified by john, 0805 if (dev_alloc_name(dev, ifname) < 0){ - RT_TRACE(COMP_INIT, "Oops: devname already taken! Trying wlan%%d...\n"); + RT_TRACE(COMP_INIT, "Oops: devname already taken! Trying wlan%%d...\n"); ifname = "wlan%d"; dev_alloc_name(dev, ifname); - } + } RT_TRACE(COMP_INIT, "Driver probe completed1\n"); #if 1 @@ -6960,7 +6960,7 @@ static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr) #endif struct r8192_priv *priv = ieee80211_priv(dev); - if(dev){ + if(dev){ unregister_netdev(dev); @@ -7002,40 +7002,40 @@ extern void ieee80211_crypto_wep_exit(void); static int __init rtl8192_usb_module_init(void) { - int ret; + int ret; #ifdef CONFIG_IEEE80211_DEBUG - ret = ieee80211_debug_init(); - if (ret) { - printk(KERN_ERR "ieee80211_debug_init() failed %d\n", ret); - return ret; - } + ret = ieee80211_debug_init(); + if (ret) { + printk(KERN_ERR "ieee80211_debug_init() failed %d\n", ret); + return ret; + } #endif - ret = ieee80211_crypto_init(); - if (ret) { - printk(KERN_ERR "ieee80211_crypto_init() failed %d\n", ret); - return ret; - } + ret = ieee80211_crypto_init(); + if (ret) { + printk(KERN_ERR "ieee80211_crypto_init() failed %d\n", ret); + return ret; + } - ret = ieee80211_crypto_tkip_init(); - if (ret) { - printk(KERN_ERR "ieee80211_crypto_tkip_init() failed %d\n", - ret); - return ret; - } + ret = ieee80211_crypto_tkip_init(); + if (ret) { + printk(KERN_ERR "ieee80211_crypto_tkip_init() failed %d\n", + ret); + return ret; + } - ret = ieee80211_crypto_ccmp_init(); - if (ret) { - printk(KERN_ERR "ieee80211_crypto_ccmp_init() failed %d\n", - ret); - return ret; - } + ret = ieee80211_crypto_ccmp_init(); + if (ret) { + printk(KERN_ERR "ieee80211_crypto_ccmp_init() failed %d\n", + ret); + return ret; + } - ret = ieee80211_crypto_wep_init(); - if (ret) { - printk(KERN_ERR "ieee80211_crypto_wep_init() failed %d\n", ret); - return ret; - } + ret = ieee80211_crypto_wep_init(); + if (ret) { + printk(KERN_ERR "ieee80211_crypto_wep_init() failed %d\n", ret); + return ret; + } printk(KERN_INFO "\nLinux kernel driver for RTL8192 based WLAN cards\n"); printk(KERN_INFO "Copyright (c) 2007-2008, Realsil Wlan\n"); @@ -7063,7 +7063,7 @@ void rtl8192_try_wake_queue(struct net_device *dev, int pri) spin_lock_irqsave(&priv->tx_lock,flags); enough_desc = check_nic_enough_desc(dev,pri); - spin_unlock_irqrestore(&priv->tx_lock,flags); + spin_unlock_irqrestore(&priv->tx_lock,flags); if(enough_desc) ieee80211_wake_queue(priv->ieee80211); @@ -7071,7 +7071,7 @@ void rtl8192_try_wake_queue(struct net_device *dev, int pri) void EnableHWSecurityConfig8192(struct net_device *dev) { - u8 SECR_value = 0x0; + u8 SECR_value = 0x0; struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); struct ieee80211_device* ieee = priv->ieee80211; SECR_value = SCR_TxEncEnable | SCR_RxDecEnable; @@ -7087,7 +7087,7 @@ void EnableHWSecurityConfig8192(struct net_device *dev) SECR_value |= SCR_TxUseDK; } #endif - //add HWSec active enable here. + //add HWSec active enable here. //default using hwsec. when peer AP is in N mode only and pairwise_key_type is none_aes(which HT_IOT_ACT_PURE_N_MODE indicates it), use software security. when peer AP is in b,g,n mode mixed and pairwise_key_type is none_aes, use g mode hw security. WB on 2008.7.4 ieee->hwsec_active = 1; @@ -7100,8 +7100,8 @@ void EnableHWSecurityConfig8192(struct net_device *dev) RT_TRACE(COMP_SEC,"%s:, hwsec:%d, pairwise_key:%d, SECR_value:%x\n", __FUNCTION__, \ ieee->hwsec_active, ieee->pairwise_key_type, SECR_value); { - write_nic_byte(dev, SECR, SECR_value);//SECR_value | SCR_UseDK ); - } + write_nic_byte(dev, SECR, SECR_value);//SECR_value | SCR_UseDK ); + } } @@ -7143,10 +7143,10 @@ void setKey( struct net_device *dev, // printk("setkey cam =%8x\n", read_cam(dev, i+6*EntryNo)); } else if(i==1){//MAC - TargetContent = (u32)(*(MacAddr+2)) | - (u32)(*(MacAddr+3)) << 8| - (u32)(*(MacAddr+4)) << 16| - (u32)(*(MacAddr+5)) << 24; + TargetContent = (u32)(*(MacAddr+2)) | + (u32)(*(MacAddr+3)) << 8| + (u32)(*(MacAddr+4)) << 16| + (u32)(*(MacAddr+5)) << 24; write_nic_dword(dev, WCAMI, TargetContent); write_nic_dword(dev, RWCAM, TargetCommand); } diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 07ea40fd9710..9c2505a0015b 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -282,7 +282,7 @@ void dm_CheckRxAggregation(struct net_device *dev) { extern void hal_dm_watchdog(struct net_device *dev) { - //struct r8192_priv *priv = ieee80211_priv(dev); + //struct r8192_priv *priv = ieee80211_priv(dev); //static u8 previous_bssid[6] ={0}; @@ -621,7 +621,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device * dev) bool bHighpowerstate, viviflag = FALSE; DCMD_TXCMD_T tx_cmd; u8 powerlevelOFDM24G; - int i =0, j = 0, k = 0; + int i =0, j = 0, k = 0; u8 RF_Type, tmp_report[5]={0, 0, 0, 0, 0}; u32 Value; u8 Pwr_Flag; @@ -1010,13 +1010,13 @@ static void dm_InitializeTXPowerTracking_TSSI(struct net_device *dev) struct r8192_priv *priv = ieee80211_priv(dev); //Initial the Tx BB index and mapping value - priv->txbbgain_table[0].txbb_iq_amplifygain = 12; + priv->txbbgain_table[0].txbb_iq_amplifygain = 12; priv->txbbgain_table[0].txbbgain_value=0x7f8001fe; - priv->txbbgain_table[1].txbb_iq_amplifygain = 11; + priv->txbbgain_table[1].txbb_iq_amplifygain = 11; priv->txbbgain_table[1].txbbgain_value=0x788001e2; - priv->txbbgain_table[2].txbb_iq_amplifygain = 10; + priv->txbbgain_table[2].txbb_iq_amplifygain = 10; priv->txbbgain_table[2].txbbgain_value=0x71c001c7; - priv->txbbgain_table[3].txbb_iq_amplifygain = 9; + priv->txbbgain_table[3].txbb_iq_amplifygain = 9; priv->txbbgain_table[3].txbbgain_value=0x6b8001ae; priv->txbbgain_table[4].txbb_iq_amplifygain = 8; priv->txbbgain_table[4].txbbgain_value=0x65400195; @@ -1046,7 +1046,7 @@ static void dm_InitializeTXPowerTracking_TSSI(struct net_device *dev) priv->txbbgain_table[16].txbbgain_value=0x32c000cb; priv->txbbgain_table[17].txbb_iq_amplifygain = -5; priv->txbbgain_table[17].txbbgain_value=0x300000c0; - priv->txbbgain_table[18].txbb_iq_amplifygain = -6; + priv->txbbgain_table[18].txbb_iq_amplifygain = -6; priv->txbbgain_table[18].txbbgain_value=0x2d4000b5; priv->txbbgain_table[19].txbb_iq_amplifygain = -7; priv->txbbgain_table[19].txbbgain_value=0x2ac000ab; @@ -1548,9 +1548,9 @@ static void dm_CheckTXPowerTracking_TSSI(struct net_device *dev) return; else { - if((tx_power_track_counter % 30 == 0)&&(tx_power_track_counter != 0)) - { - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) + if((tx_power_track_counter % 30 == 0)&&(tx_power_track_counter != 0)) + { + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0); #else #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) @@ -1559,7 +1559,7 @@ static void dm_CheckTXPowerTracking_TSSI(struct net_device *dev) queue_work(priv->priv_wq,&priv->txpower_tracking_wq); #endif #endif - } + } tx_power_track_counter++; } @@ -3065,7 +3065,7 @@ static void dm_check_rfctrl_gpio(struct net_device * dev) #else #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) schedule_task(&priv->gpio_change_rf_wq); - #else + #else queue_work(priv->priv_wq,&priv->gpio_change_rf_wq); #endif #endif @@ -3602,7 +3602,7 @@ extern void dm_fsync_timer_callback(unsigned long data) { rate_bitmap = 1 << rate_index; if(priv->ieee80211->fsync_rate_bitmap & rate_bitmap) - rate_count+= priv->stats.received_rate_histogram[1][rate_index]; + rate_count+= priv->stats.received_rate_histogram[1][rate_index]; } if(rate_count < priv->rate_record) @@ -4036,7 +4036,7 @@ extern void dm_shadow_init(struct net_device *dev) * Function: DM_DynamicTxPower() * * Overview: Detect Signal strength to control TX Registry - Tx Power Control For Near/Far Range + Tx Power Control For Near/Far Range * * Input: NONE * diff --git a/drivers/staging/rtl8192u/r8192U_dm.h b/drivers/staging/rtl8192u/r8192U_dm.h index 1e05d7579882..1a619d239dc7 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.h +++ b/drivers/staging/rtl8192u/r8192U_dm.h @@ -283,7 +283,7 @@ extern void dm_txpower_trackingcallback(struct net_device *dev); extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); extern void dm_backup_dynamic_mechanism_state(struct net_device *dev); extern void dm_change_dynamic_initgain_thresh(struct net_device *dev, - u32 dm_type, u32 dm_value); + u32 dm_type, u32 dm_value); extern void dm_force_tx_fw_info(struct net_device *dev,u32 force_type, u32 force_value); extern void dm_init_edca_turbo(struct net_device *dev); extern void dm_rf_operation_test_callback(unsigned long data); diff --git a/drivers/staging/rtl8192u/r8192U_hw.h b/drivers/staging/rtl8192u/r8192U_hw.h index 1ebacc9c66ff..0f959eda8598 100644 --- a/drivers/staging/rtl8192u/r8192U_hw.h +++ b/drivers/staging/rtl8192u/r8192U_hw.h @@ -226,7 +226,7 @@ enum _RTL8192Usb_HW { #define CPU_GEN_NO_LOOPBACK_SET 0x00080000 // Set BIT19 to 1 CPU_GEN = 0x100, // CPU Reset Register LED1Cfg = 0x154,// LED1 Configuration Register - LED0Cfg = 0x155,// LED0 Configuration Register + LED0Cfg = 0x155,// LED0 Configuration Register AcmAvg = 0x170, // ACM Average Period Register AcmHwCtrl = 0x171, // ACM Hardware Control Register diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index 490c994af30d..1c953c73f73d 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -193,15 +193,15 @@ static int r8192_wx_write_regs(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - struct r8192_priv *priv = ieee80211_priv(dev); - u8 addr; + struct r8192_priv *priv = ieee80211_priv(dev); + u8 addr; - down(&priv->wx_sem); + down(&priv->wx_sem); - get_user(addr, (u8*)wrqu->data.pointer); + get_user(addr, (u8*)wrqu->data.pointer); write_rtl8225(dev, addr, wrqu->data.length); - up(&priv->wx_sem); + up(&priv->wx_sem); return 0; } @@ -213,14 +213,14 @@ static int r8192_wx_read_bb(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - struct r8192_priv *priv = ieee80211_priv(dev); + struct r8192_priv *priv = ieee80211_priv(dev); u8 databb; #if 0 int i; for(i=0;i<12;i++) printk("%8x\n", read_cam(dev, i) ); #endif - down(&priv->wx_sem); + down(&priv->wx_sem); databb = rtl8187_read_phy(dev, (u8)wrqu->data.length, 0x00000000); wrqu->data.length = databb; @@ -231,74 +231,74 @@ static int r8192_wx_read_bb(struct net_device *dev, void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data); static int r8192_wx_write_bb(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - struct r8192_priv *priv = ieee80211_priv(dev); - u8 databb; + struct r8192_priv *priv = ieee80211_priv(dev); + u8 databb; - down(&priv->wx_sem); + down(&priv->wx_sem); - get_user(databb, (u8*)wrqu->data.pointer); - rtl8187_write_phy(dev, wrqu->data.length, databb); + get_user(databb, (u8*)wrqu->data.pointer); + rtl8187_write_phy(dev, wrqu->data.length, databb); - up(&priv->wx_sem); - return 0; + up(&priv->wx_sem); + return 0; } static int r8192_wx_write_nicb(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - struct r8192_priv *priv = ieee80211_priv(dev); - u32 addr; + struct r8192_priv *priv = ieee80211_priv(dev); + u32 addr; - down(&priv->wx_sem); + down(&priv->wx_sem); - get_user(addr, (u32*)wrqu->data.pointer); - write_nic_byte(dev, addr, wrqu->data.length); + get_user(addr, (u32*)wrqu->data.pointer); + write_nic_byte(dev, addr, wrqu->data.length); - up(&priv->wx_sem); - return 0; + up(&priv->wx_sem); + return 0; } static int r8192_wx_read_nicb(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - struct r8192_priv *priv = ieee80211_priv(dev); - u32 addr; - u16 data1; + struct r8192_priv *priv = ieee80211_priv(dev); + u32 addr; + u16 data1; - down(&priv->wx_sem); + down(&priv->wx_sem); - get_user(addr,(u32*)wrqu->data.pointer); - data1 = read_nic_byte(dev, addr); - wrqu->data.length = data1; + get_user(addr,(u32*)wrqu->data.pointer); + data1 = read_nic_byte(dev, addr); + wrqu->data.length = data1; - up(&priv->wx_sem); - return 0; + up(&priv->wx_sem); + return 0; } static int r8192_wx_get_ap_status(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - struct r8192_priv *priv = ieee80211_priv(dev); - struct ieee80211_device *ieee = priv->ieee80211; - struct ieee80211_network *target; + struct r8192_priv *priv = ieee80211_priv(dev); + struct ieee80211_device *ieee = priv->ieee80211; + struct ieee80211_network *target; int name_len; - down(&priv->wx_sem); + down(&priv->wx_sem); //count the length of input ssid for(name_len=0 ; ((char*)wrqu->data.pointer)[name_len]!='\0' ; name_len++); //search for the correspoding info which is received - list_for_each_entry(target, &ieee->network_list, list) { - if ( (target->ssid_len == name_len) && + list_for_each_entry(target, &ieee->network_list, list) { + if ( (target->ssid_len == name_len) && (strncmp(target->ssid, (char*)wrqu->data.pointer, name_len)==0)){ if(target->wpa_ie_len>0 || target->rsn_ie_len>0 ) //set flags=1 to indicate this ap is WPA @@ -307,11 +307,11 @@ static int r8192_wx_get_ap_status(struct net_device *dev, break; - } - } + } + } - up(&priv->wx_sem); - return 0; + up(&priv->wx_sem); + return 0; } @@ -404,25 +404,25 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a, struct iw_range_with_scan_capa { - /* Informative stuff (to choose between different interface) */ - __u32 throughput; /* To give an idea... */ - /* In theory this value should be the maximum benchmarked - * TCP/IP throughput, because with most of these devices the - * bit rate is meaningless (overhead an co) to estimate how - * fast the connection will go and pick the fastest one. - * I suggest people to play with Netperf or any benchmark... - */ - - /* NWID (or domain id) */ - __u32 min_nwid; /* Minimal NWID we are able to set */ - __u32 max_nwid; /* Maximal NWID we are able to set */ - - /* Old Frequency (backward compat - moved lower ) */ - __u16 old_num_channels; - __u8 old_num_frequency; - - /* Scan capabilities */ - __u8 scan_capa; + /* Informative stuff (to choose between different interface) */ + __u32 throughput; /* To give an idea... */ + /* In theory this value should be the maximum benchmarked + * TCP/IP throughput, because with most of these devices the + * bit rate is meaningless (overhead an co) to estimate how + * fast the connection will go and pick the fastest one. + * I suggest people to play with Netperf or any benchmark... + */ + + /* NWID (or domain id) */ + __u32 min_nwid; /* Minimal NWID we are able to set */ + __u32 max_nwid; /* Maximal NWID we are able to set */ + + /* Old Frequency (backward compat - moved lower ) */ + __u16 old_num_channels; + __u8 old_num_frequency; + + /* Scan capabilities */ + __u8 scan_capa; }; static int rtl8180_wx_get_range(struct net_device *dev, struct iw_request_info *info, @@ -453,7 +453,7 @@ static int rtl8180_wx_get_range(struct net_device *dev, // TODO: Not used in 802.11b? // range->max_nwid; /* Maximal NWID we are able to set */ - /* Old Frequency (backward compat - moved lower ) */ + /* Old Frequency (backward compat - moved lower ) */ // range->old_num_channels; // range->old_num_frequency; // range->old_freq[6]; /* Filler to keep "version" at the same offset */ @@ -509,7 +509,7 @@ static int rtl8180_wx_get_range(struct net_device *dev, #else if ((priv->ieee80211->channel_map)[i+1]) { #endif - range->freq[val].i = i + 1; + range->freq[val].i = i + 1; range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000; range->freq[val].e = 1; val++; @@ -522,7 +522,7 @@ static int rtl8180_wx_get_range(struct net_device *dev, break; } range->num_frequency = val; - range->num_channels = val; + range->num_channels = val; #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; @@ -557,10 +557,10 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, down(&priv->wx_sem); if(priv->ieee80211->state != IEEE80211_LINKED){ - priv->ieee80211->scanning = 0; - ieee80211_softmac_scan_syncro(priv->ieee80211); - ret = 0; - } + priv->ieee80211->scanning = 0; + ieee80211_softmac_scan_syncro(priv->ieee80211); + ret = 0; + } else ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b); up(&priv->wx_sem); @@ -809,7 +809,7 @@ static int r8192_wx_set_enc(struct net_device *dev, static int r8192_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union iwreq_data *wrqu, char *p){ - struct r8192_priv *priv = ieee80211_priv(dev); + struct r8192_priv *priv = ieee80211_priv(dev); int *parms=(int*)p; int mode=parms[0]; @@ -858,7 +858,7 @@ static int r8192_wx_set_retry(struct net_device *dev, * I'm unsure if whole reset is really needed */ - rtl8192_commit(dev); + rtl8192_commit(dev); /* if(priv->up){ rtl8180_rtx_disable(dev); @@ -939,8 +939,8 @@ exit: #if (WIRELESS_EXT >= 18) #if 0 static int r8192_wx_get_enc_ext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8192_priv *priv = ieee80211_priv(dev); int ret = 0; @@ -950,8 +950,8 @@ static int r8192_wx_get_enc_ext(struct net_device *dev, #endif //hw security need to reorganized. static int r8192_wx_set_enc_ext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret=0; #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) @@ -1040,8 +1040,8 @@ end_hw_sec: } static int r8192_wx_set_auth(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *data, char *extra) + struct iw_request_info *info, + union iwreq_data *data, char *extra) { int ret=0; #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) @@ -1055,8 +1055,8 @@ static int r8192_wx_set_auth(struct net_device *dev, } static int r8192_wx_set_mlme(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { //printk("====>%s()\n", __FUNCTION__); @@ -1072,21 +1072,21 @@ static int r8192_wx_set_mlme(struct net_device *dev, } #endif static int r8192_wx_set_gen_ie(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *data, char *extra) + struct iw_request_info *info, + union iwreq_data *data, char *extra) { //printk("====>%s(), len:%d\n", __FUNCTION__, data->length); int ret=0; #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) - struct r8192_priv *priv = ieee80211_priv(dev); - down(&priv->wx_sem); + struct r8192_priv *priv = ieee80211_priv(dev); + down(&priv->wx_sem); #if 1 - ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, data->data.length); + ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, data->data.length); #endif - up(&priv->wx_sem); + up(&priv->wx_sem); //printk("<======%s(), ret:%d\n", __FUNCTION__, ret); #endif - return ret; + return ret; } @@ -1100,56 +1100,56 @@ static int dummy(struct net_device *dev, struct iw_request_info *a, static iw_handler r8192_wx_handlers[] = { - NULL, /* SIOCSIWCOMMIT */ - r8192_wx_get_name, /* SIOCGIWNAME */ - dummy, /* SIOCSIWNWID */ - dummy, /* SIOCGIWNWID */ - r8192_wx_set_freq, /* SIOCSIWFREQ */ - r8192_wx_get_freq, /* SIOCGIWFREQ */ - r8192_wx_set_mode, /* SIOCSIWMODE */ - r8192_wx_get_mode, /* SIOCGIWMODE */ - r8192_wx_set_sens, /* SIOCSIWSENS */ - r8192_wx_get_sens, /* SIOCGIWSENS */ - NULL, /* SIOCSIWRANGE */ - rtl8180_wx_get_range, /* SIOCGIWRANGE */ - NULL, /* SIOCSIWPRIV */ - NULL, /* SIOCGIWPRIV */ - NULL, /* SIOCSIWSTATS */ - NULL, /* SIOCGIWSTATS */ - dummy, /* SIOCSIWSPY */ - dummy, /* SIOCGIWSPY */ - NULL, /* SIOCGIWTHRSPY */ - NULL, /* SIOCWIWTHRSPY */ - r8192_wx_set_wap, /* SIOCSIWAP */ - r8192_wx_get_wap, /* SIOCGIWAP */ + NULL, /* SIOCSIWCOMMIT */ + r8192_wx_get_name, /* SIOCGIWNAME */ + dummy, /* SIOCSIWNWID */ + dummy, /* SIOCGIWNWID */ + r8192_wx_set_freq, /* SIOCSIWFREQ */ + r8192_wx_get_freq, /* SIOCGIWFREQ */ + r8192_wx_set_mode, /* SIOCSIWMODE */ + r8192_wx_get_mode, /* SIOCGIWMODE */ + r8192_wx_set_sens, /* SIOCSIWSENS */ + r8192_wx_get_sens, /* SIOCGIWSENS */ + NULL, /* SIOCSIWRANGE */ + rtl8180_wx_get_range, /* SIOCGIWRANGE */ + NULL, /* SIOCSIWPRIV */ + NULL, /* SIOCGIWPRIV */ + NULL, /* SIOCSIWSTATS */ + NULL, /* SIOCGIWSTATS */ + dummy, /* SIOCSIWSPY */ + dummy, /* SIOCGIWSPY */ + NULL, /* SIOCGIWTHRSPY */ + NULL, /* SIOCWIWTHRSPY */ + r8192_wx_set_wap, /* SIOCSIWAP */ + r8192_wx_get_wap, /* SIOCGIWAP */ #if (WIRELESS_EXT >= 18) - r8192_wx_set_mlme, /* MLME-- */ + r8192_wx_set_mlme, /* MLME-- */ #else NULL, #endif - dummy, /* SIOCGIWAPLIST -- depricated */ - r8192_wx_set_scan, /* SIOCSIWSCAN */ - r8192_wx_get_scan, /* SIOCGIWSCAN */ - r8192_wx_set_essid, /* SIOCSIWESSID */ - r8192_wx_get_essid, /* SIOCGIWESSID */ - dummy, /* SIOCSIWNICKN */ - dummy, /* SIOCGIWNICKN */ - NULL, /* -- hole -- */ - NULL, /* -- hole -- */ - r8192_wx_set_rate, /* SIOCSIWRATE */ - r8192_wx_get_rate, /* SIOCGIWRATE */ - r8192_wx_set_rts, /* SIOCSIWRTS */ - r8192_wx_get_rts, /* SIOCGIWRTS */ - r8192_wx_set_frag, /* SIOCSIWFRAG */ - r8192_wx_get_frag, /* SIOCGIWFRAG */ - dummy, /* SIOCSIWTXPOW */ - dummy, /* SIOCGIWTXPOW */ - r8192_wx_set_retry, /* SIOCSIWRETRY */ - r8192_wx_get_retry, /* SIOCGIWRETRY */ - r8192_wx_set_enc, /* SIOCSIWENCODE */ - r8192_wx_get_enc, /* SIOCGIWENCODE */ - r8192_wx_set_power, /* SIOCSIWPOWER */ - r8192_wx_get_power, /* SIOCGIWPOWER */ + dummy, /* SIOCGIWAPLIST -- depricated */ + r8192_wx_set_scan, /* SIOCSIWSCAN */ + r8192_wx_get_scan, /* SIOCGIWSCAN */ + r8192_wx_set_essid, /* SIOCSIWESSID */ + r8192_wx_get_essid, /* SIOCGIWESSID */ + dummy, /* SIOCSIWNICKN */ + dummy, /* SIOCGIWNICKN */ + NULL, /* -- hole -- */ + NULL, /* -- hole -- */ + r8192_wx_set_rate, /* SIOCSIWRATE */ + r8192_wx_get_rate, /* SIOCGIWRATE */ + r8192_wx_set_rts, /* SIOCSIWRTS */ + r8192_wx_get_rts, /* SIOCGIWRTS */ + r8192_wx_set_frag, /* SIOCSIWFRAG */ + r8192_wx_get_frag, /* SIOCGIWFRAG */ + dummy, /* SIOCSIWTXPOW */ + dummy, /* SIOCGIWTXPOW */ + r8192_wx_set_retry, /* SIOCSIWRETRY */ + r8192_wx_get_retry, /* SIOCGIWRETRY */ + r8192_wx_set_enc, /* SIOCSIWENCODE */ + r8192_wx_get_enc, /* SIOCGIWENCODE */ + r8192_wx_set_power, /* SIOCSIWPOWER */ + r8192_wx_get_power, /* SIOCGIWPOWER */ NULL, /*---hole---*/ NULL, /*---hole---*/ r8192_wx_set_gen_ie,//NULL, /* SIOCSIWGENIE */ @@ -1192,38 +1192,38 @@ static const struct iw_priv_args r8192_private_args[] = { , { SIOCIWFIRSTPRIV + 0x3, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readRF" + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readRF" } , { SIOCIWFIRSTPRIV + 0x4, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writeRF" + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writeRF" } , { SIOCIWFIRSTPRIV + 0x5, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readBB" + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readBB" } , { SIOCIWFIRSTPRIV + 0x6, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writeBB" + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writeBB" + } + , + { + SIOCIWFIRSTPRIV + 0x7, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readnicb" + } + , + { + SIOCIWFIRSTPRIV + 0x8, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writenicb" + } + , + { + SIOCIWFIRSTPRIV + 0x9, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "apinfo" } - , - { - SIOCIWFIRSTPRIV + 0x7, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readnicb" - } - , - { - SIOCIWFIRSTPRIV + 0x8, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writenicb" - } - , - { - SIOCIWFIRSTPRIV + 0x9, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "apinfo" - } #endif , @@ -1249,8 +1249,8 @@ static iw_handler r8192_private_handler[] = { r8192_wx_write_regs, r8192_wx_read_bb, r8192_wx_write_bb, - r8192_wx_read_nicb, - r8192_wx_write_nicb, + r8192_wx_read_nicb, + r8192_wx_write_nicb, r8192_wx_get_ap_status, #endif //r8192_wx_null, @@ -1290,7 +1290,7 @@ struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)) wstats->qual.updated = IW_QUAL_ALL_UPDATED| IW_QUAL_DBM; #else - wstats->qual.updated = 0x0f; + wstats->qual.updated = 0x0f; #endif return wstats; } @@ -1302,7 +1302,7 @@ struct iw_handler_def r8192_wx_handlers_def={ .num_standard = sizeof(r8192_wx_handlers) / sizeof(iw_handler), .private = r8192_private_handler, .num_private = sizeof(r8192_private_handler) / sizeof(iw_handler), - .num_private_args = sizeof(r8192_private_args) / sizeof(struct iw_priv_args), + .num_private_args = sizeof(r8192_private_args) / sizeof(struct iw_priv_args), #if WIRELESS_EXT >= 17 .get_wireless_stats = r8192_get_wireless_stats, #endif diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.c b/drivers/staging/rtl8192u/r819xU_cmdpkt.c index 2f87503cd301..e9a0eb832838 100644 --- a/drivers/staging/rtl8192u/r819xU_cmdpkt.c +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.c @@ -5,9 +5,9 @@ Module: r819xusb_cmdpkt.c (RTL8190 TX/RX command packet handler Source C File) Note: The module is responsible for handling TX and RX command packet. - 1. TX : Send set and query configuration command packet. - 2. RX : Receive tx feedback, beacon state, query configuration - command packet. + 1. TX : Send set and query configuration command packet. + 2. RX : Receive tx feedback, beacon state, query configuration + command packet. Function: @@ -158,7 +158,7 @@ SendTxCommandPacket( seg_ptr = skb_put(skb, buffer_len); /* * Transform from little endian to big endian - * and pending zero + * and pending zero */ memcpy(seg_ptr,codevirtualaddress,buffer_len); tcb_desc->txbuf_size= (u16)buffer_len; @@ -349,7 +349,7 @@ cmpk_handle_tx_feedback( pMgntInfo->CurrentOperaRate = (rx_tx_fb.F_Rate & 0x7F); } else if (pAdapter->RegWirelessMode == WIRELESS_MODE_N_24G || - pAdapter->RegWirelessMode == WIRELESS_MODE_N_5G) + pAdapter->RegWirelessMode == WIRELESS_MODE_N_5G) { pMgntInfo->HTCurrentOperaRate = (rx_tx_fb.F_Rate & 0x8F); } @@ -802,7 +802,7 @@ cmpk_message_handle_rx( default: - RT_TRACE(COMP_ERR, "---->cmpk_message_handle_rx():unknow CMD Element\n"); + RT_TRACE(COMP_ERR, "---->cmpk_message_handle_rx():unknow CMD Element\n"); return 1; /* This is a command packet. */ } // 2007/01/22 MH Display received rx command packet info. diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.h b/drivers/staging/rtl8192u/r819xU_cmdpkt.h index 162959f55f9a..34fbdcf1be79 100644 --- a/drivers/staging/rtl8192u/r819xU_cmdpkt.h +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.h @@ -202,10 +202,10 @@ typedef enum tag_command_packet_directories }cmpk_element_e; typedef enum _rt_status{ - RT_STATUS_SUCCESS, - RT_STATUS_FAILURE, - RT_STATUS_PENDING, - RT_STATUS_RESOURCE + RT_STATUS_SUCCESS, + RT_STATUS_FAILURE, + RT_STATUS_PENDING, + RT_STATUS_RESOURCE }rt_status,*prt_status; extern rt_status cmpk_message_handle_tx(struct net_device *dev, u8* codevirtualaddress, u32 packettype, u32 buffer_len); diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c index 5e09b4668c0b..20d78f461127 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.c +++ b/drivers/staging/rtl8192u/r819xU_firmware.c @@ -80,7 +80,7 @@ bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buff seg_ptr = skb->data; /* * Transform from little endian to big endian - * and pending zero + * and pending zero */ for(i=0 ; i < frag_length; i+=4) { *seg_ptr++ = ((i+0)pFirmware; const struct firmware *fw_entry; const char *fw_name[3] = { "RTL8192U/boot.img", - "RTL8192U/main.img", + "RTL8192U/main.img", "RTL8192U/data.img"}; int rc; @@ -490,8 +490,8 @@ download_firmware_fail: #if 0 /* * Procedure: (1) Transform firmware code from little endian to big endian if required. - * (2) Number of bytes in Firmware downloading should be multiple - * of 4 bytes. If length is not multiple of 4 bytes, appending of zeros is required + * (2) Number of bytes in Firmware downloading should be multiple + * of 4 bytes. If length is not multiple of 4 bytes, appending of zeros is required * */ void CmdAppendZeroAndEndianTransform( diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index 00497d313f9b..beeab51a2c3b 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -94,7 +94,7 @@ void rtl8192_setBBreg(struct net_device* dev, u32 dwRegAddr, u32 dwBitMask, u32 {//if not "double word" write OriginalValue = read_nic_dword(dev, dwRegAddr); BitShift = rtl8192_CalculateBitShift(dwBitMask); - NewValue = (((OriginalValue) & (~dwBitMask)) | (dwData << BitShift)); + NewValue = (((OriginalValue) & (~dwBitMask)) | (dwData << BitShift)); write_nic_dword(dev, dwRegAddr, NewValue); }else write_nic_dword(dev, dwRegAddr, dwData); @@ -265,7 +265,7 @@ void rtl8192_phy_RFSerialWrite(struct net_device* dev, RF90_RADIO_PATH_E eRFPath priv->RfReg0Value[eRFPath] = Data; // Switch back to Reg_Mode0; - if(priv->rf_chip == RF_8256) + if(priv->rf_chip == RF_8256) { if(Offset != 0) { @@ -320,13 +320,13 @@ void rtl8192_phy_SetRFReg(struct net_device* dev, RF90_RADIO_PATH_E eRFPath, u32 else { if (BitMask != bMask12Bits) // RF data is 12 bits only - { + { Original_Value = rtl8192_phy_RFSerialRead(dev, eRFPath, RegAddr); - BitShift = rtl8192_CalculateBitShift(BitMask); - New_Value = (((Original_Value) & (~BitMask)) | (Data<< BitShift)); + BitShift = rtl8192_CalculateBitShift(BitMask); + New_Value = (((Original_Value) & (~BitMask)) | (Data<< BitShift)); rtl8192_phy_RFSerialWrite(dev, eRFPath, RegAddr, New_Value); - }else + }else rtl8192_phy_RFSerialWrite(dev, eRFPath, RegAddr, Data); } return; @@ -360,8 +360,8 @@ u32 rtl8192_phy_QueryRFReg(struct net_device* dev, RF90_RADIO_PATH_E eRFPath, u3 else { Original_Value = rtl8192_phy_RFSerialRead(dev, eRFPath, RegAddr); - BitShift = rtl8192_CalculateBitShift(BitMask); - Readback_Value = (Original_Value & BitMask) >> BitShift; + BitShift = rtl8192_CalculateBitShift(BitMask); + Readback_Value = (Original_Value & BitMask) >> BitShift; return (Readback_Value); } } @@ -800,7 +800,7 @@ void rtl8192_BB_Config_ParaFile(struct net_device* dev) dwRegValue = read_nic_dword(dev, CPU_GEN); write_nic_dword(dev, CPU_GEN, (dwRegValue|CPU_GEN_BB_RST)); - /*----BB AGC table Initialization----*/ + /*----BB AGC table Initialization----*/ //==m==>Set PHY REG From Header<==m== rtl8192_phyConfigBB(dev, BaseBand_Config_AGC_TAB); @@ -1563,7 +1563,7 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) case HT_CHANNEL_WIDTH_20_40: regBwOpMode &= ~BW_OPMODE_20MHZ; - // 2007/02/07 Mark by Emily becasue we have not verify whether this register works + // 2007/02/07 Mark by Emily becasue we have not verify whether this register works write_nic_byte(dev, BW_OPMODE, regBwOpMode); break; @@ -1615,7 +1615,7 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) rtl8192_setBBreg(dev, rFPGA0_RFMOD, bRFMOD, 0x1); rtl8192_setBBreg(dev, rFPGA1_RFMOD, bRFMOD, 0x1); rtl8192_setBBreg(dev, rCCK0_System, bCCKSideBand, (priv->nCur40MhzPrimeSC>>1)); - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x00100000, 0); + rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x00100000, 0); rtl8192_setBBreg(dev, rOFDM1_LSTF, 0xC00, priv->nCur40MhzPrimeSC); #if 0 // Correct the tx power for CCK rate in 40M. Suggest by YN, 20071207 diff --git a/drivers/staging/rtl8192u/r819xU_phyreg.h b/drivers/staging/rtl8192u/r819xU_phyreg.h index b62f1a6fb1eb..06b0b539e1bc 100644 --- a/drivers/staging/rtl8192u/r819xU_phyreg.h +++ b/drivers/staging/rtl8192u/r819xU_phyreg.h @@ -204,7 +204,7 @@ #define rZebra1_AGC 0x4 #define rZebra1_ChargePump 0x5 #define rZebra1_Channel 0x7 -#define rZebra1_TxGain 0x8 +#define rZebra1_TxGain 0x8 #define rZebra1_TxLPF 0x9 #define rZebra1_RxLPF 0xb #define rZebra1_RxHPFCorner 0xc @@ -360,7 +360,7 @@ #define bAFEWatchDogEnable 0x20000000 #define bXtalCap 0x0f000000 #define bIntDifClkEnable 0x400 -#define bExtSigClkEnable 0x800 +#define bExtSigClkEnable 0x800 #define bBandgapMbiasPowerUp 0x10000 #define bAD11SHGain 0xc0000 #define bAD11InputRange 0x700000 @@ -401,8 +401,8 @@ #define bOFDMTxOn 0x2 #define bDebugPage 0xfff //reset debug page and also HWord, LWord #define bDebugItem 0xff //reset debug page and LWord -#define bAntL 0x10 -#define bAntNonHT 0x100 +#define bAntL 0x10 +#define bAntNonHT 0x100 #define bAntHT1 0x1000 #define bAntHT2 0x10000 #define bAntHT1S1 0x100000 @@ -414,26 +414,26 @@ #define bCCKRxPowerSaving 0x40 #define bCCKSideBand 0x10 #define bCCKScramble 0x8 -#define bCCKAntDiversity 0x8000 -#define bCCKCarrierRecovery 0x4000 -#define bCCKTxRate 0x3000 -#define bCCKDCCancel 0x0800 +#define bCCKAntDiversity 0x8000 +#define bCCKCarrierRecovery 0x4000 +#define bCCKTxRate 0x3000 +#define bCCKDCCancel 0x0800 #define bCCKISICancel 0x0400 #define bCCKMatchFilter 0x0200 #define bCCKEqualizer 0x0100 -#define bCCKPreambleDetect 0x800000 +#define bCCKPreambleDetect 0x800000 #define bCCKFastFalseCCA 0x400000 #define bCCKChEstStart 0x300000 #define bCCKCCACount 0x080000 #define bCCKcs_lim 0x070000 #define bCCKBistMode 0x80000000 -#define bCCKCCAMask 0x40000000 -#define bCCKTxDACPhase 0x4 -#define bCCKRxADCPhase 0x20000000 //r_rx_clk -#define bCCKr_cp_mode0 0x0100 -#define bCCKTxDCOffset 0xf0 -#define bCCKRxDCOffset 0xf -#define bCCKCCAMode 0xc000 +#define bCCKCCAMask 0x40000000 +#define bCCKTxDACPhase 0x4 +#define bCCKRxADCPhase 0x20000000 //r_rx_clk +#define bCCKr_cp_mode0 0x0100 +#define bCCKTxDCOffset 0xf0 +#define bCCKRxDCOffset 0xf +#define bCCKCCAMode 0xc000 #define bCCKFalseCS_lim 0x3f00 #define bCCKCS_ratio 0xc00000 #define bCCKCorgBit_sel 0x300000 @@ -444,18 +444,18 @@ #define bCCKLNAPolarity 0x800000 #define bCCKRx1stGain 0x7f0000 #define bCCKRFExtend 0x20000000 //CCK Rx Iinital gain polarity -#define bCCKRxAGCSatLevel 0x1f000000 -#define bCCKRxAGCSatCount 0xe0 +#define bCCKRxAGCSatLevel 0x1f000000 +#define bCCKRxAGCSatCount 0xe0 #define bCCKRxRFSettle 0x1f //AGCsamp_dly -#define bCCKFixedRxAGC 0x8000 -//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824 -#define bCCKAntennaPolarity 0x2000 +#define bCCKFixedRxAGC 0x8000 +//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824 +#define bCCKAntennaPolarity 0x2000 #define bCCKTxFilterType 0x0c00 -#define bCCKRxAGCReportType 0x0300 +#define bCCKRxAGCReportType 0x0300 #define bCCKRxDAGCEn 0x80000000 -#define bCCKRxDAGCPeriod 0x20000000 -#define bCCKRxDAGCSatLevel 0x1f000000 -#define bCCKTimingRecovery 0x800000 +#define bCCKRxDAGCPeriod 0x20000000 +#define bCCKRxDAGCSatLevel 0x1f000000 +#define bCCKTimingRecovery 0x800000 #define bCCKTxC0 0x3f0000 #define bCCKTxC1 0x3f000000 #define bCCKTxC2 0x3f -- GitLab From 50a09b3b099ebc8326b85b4f508fb47655e1fed3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 3 Nov 2009 07:45:50 -0200 Subject: [PATCH 225/235] Staging: rtl8192u: remove dead code Remove #ifse against older kernel versions; Remove codes marked with #if 0; Remove #if 1 Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211.h | 157 --- .../staging/rtl8192u/ieee80211/EndianFree.h | 5 - .../rtl8192u/ieee80211/crypto_compat.h | 30 - drivers/staging/rtl8192u/ieee80211/dot11d.c | 16 - .../staging/rtl8192u/ieee80211/ieee80211.h | 157 --- .../rtl8192u/ieee80211/ieee80211_crypt.h | 7 - .../rtl8192u/ieee80211/ieee80211_module.c | 2 - .../staging/rtl8192u/ieee80211/ieee80211_rx.c | 110 -- .../rtl8192u/ieee80211/ieee80211_softmac.c | 242 ---- .../rtl8192u/ieee80211/ieee80211_softmac_wx.c | 78 -- .../staging/rtl8192u/ieee80211/ieee80211_tx.c | 17 - .../staging/rtl8192u/ieee80211/ieee80211_wx.c | 154 --- drivers/staging/rtl8192u/ieee80211/internal.h | 16 - .../rtl8192u/ieee80211/rtl819x_BAProc.c | 42 - .../rtl8192u/ieee80211/rtl819x_HTProc.c | 259 +--- .../staging/rtl8192u/ieee80211/rtl819x_Qos.h | 166 --- .../rtl8192u/ieee80211/rtl819x_TSProc.c | 26 - drivers/staging/rtl8192u/r8192U.h | 104 -- drivers/staging/rtl8192u/r8192U_core.c | 1083 ----------------- drivers/staging/rtl8192u/r8192U_dm.c | 288 ----- drivers/staging/rtl8192u/r8192U_dm.h | 55 - drivers/staging/rtl8192u/r8192U_hw.h | 335 ----- drivers/staging/rtl8192u/r8192U_wx.c | 82 -- drivers/staging/rtl8192u/r819xU_cmdpkt.c | 31 - drivers/staging/rtl8192u/r819xU_cmdpkt.h | 10 - drivers/staging/rtl8192u/r819xU_firmware.c | 266 ---- drivers/staging/rtl8192u/r819xU_firmware.h | 41 - drivers/staging/rtl8192u/r819xU_phy.c | 49 - drivers/staging/rtl8192u/r819xU_phy.h | 4 - 29 files changed, 1 insertion(+), 3831 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211.h b/drivers/staging/rtl8192u/ieee80211.h index f5795855904b..3a47f1213e85 100644 --- a/drivers/staging/rtl8192u/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211.h @@ -27,12 +27,7 @@ #include /* ARRAY_SIZE */ #include #include -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) #include -#else -#include -#include -#endif #include #include @@ -43,11 +38,6 @@ #include "ieee80211/rtl819x_BA.h" #include "ieee80211/rtl819x_TS.h" -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) -#ifndef bool -typedef enum{false = 0, true} bool; -#endif -#endif #ifndef IW_MODE_MONITOR #define IW_MODE_MONITOR 6 @@ -57,24 +47,6 @@ typedef enum{false = 0, true} bool; #define IWEVCUSTOM 0x8c02 #endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -#ifndef __bitwise -#define __bitwise __attribute__((bitwise)) -#endif -typedef __u16 __le16; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27)) -struct iw_spy_data{ - /* --- Standard spy support --- */ - int spy_number; - u_char spy_address[IW_MAX_SPY][ETH_ALEN]; - struct iw_quality spy_stat[IW_MAX_SPY]; - /* --- Enhanced spy support (event) */ - struct iw_quality spy_thr_low; /* Low threshold */ - struct iw_quality spy_thr_high; /* High threshold */ - u_char spy_thr_under[IW_MAX_SPY]; -}; -#endif -#endif #ifndef container_of /** @@ -425,46 +397,10 @@ typedef struct ieee_param { #define IW_QUAL_NOISE_UPDATED 0x4 #endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -static inline void tq_init(struct tq_struct * task, void(*func)(void *), void *data) -{ - task->routine = func; - task->data = data; - //task->next = NULL; - INIT_LIST_HEAD(&task->list); - task->sync = 0; -} -#endif // linux under 2.6.9 release may not support it, so modify it for common use -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)) -//#define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ) -#define MSECS(t) (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000) -static inline unsigned long msleep_interruptible_rsl(unsigned int msecs) -{ - unsigned long timeout = MSECS(msecs) + 1; - - while (timeout) { - set_current_state(TASK_INTERRUPTIBLE); - timeout = schedule_timeout(timeout); - } - return timeout; -} -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31)) -static inline void msleep(unsigned int msecs) -{ - unsigned long timeout = MSECS(msecs) + 1; - - while (timeout) { - set_current_state(TASK_UNINTERRUPTIBLE); - timeout = schedule_timeout(timeout); - } -} -#endif -#else #define MSECS(t) msecs_to_jiffies(t) #define msleep_interruptible_rsl msleep_interruptible -#endif #define IEEE80211_DATA_LEN 2304 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section @@ -926,7 +862,6 @@ struct ieee_ibss_seq { * information for frames received. Not setting these will not cause * any adverse affects. */ struct ieee80211_rx_stats { -#if 1 u32 mac_time[2]; s8 rssi; u8 signal; @@ -988,7 +923,6 @@ struct ieee80211_rx_stats { bool bToSelfBA; //cosa add for rssi char cck_adc_pwdb[4]; //cosa add for rx path selection u16 Seq_Num; -#endif }; @@ -1336,7 +1270,6 @@ typedef union _frameqos { #define QOS_OUI_PARAM_SUB_TYPE 1 #define QOS_VERSION_1 1 #define QOS_AIFSN_MIN_VALUE 2 -#if 1 struct ieee80211_qos_information_element { u8 elementID; u8 length; @@ -1411,7 +1344,6 @@ struct ieee80211_wmm_tspec_elem { u16 surp_band_allow; u16 medium_time; }__attribute__((packed)); -#endif enum eap_type { EAP_PACKET = 0, EAPOL_START, @@ -1534,14 +1466,12 @@ enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame}; //UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP //#define UP2AC(up) ((up<3) ? ((up==0)?1:0) : (up>>1)) -#if 1 #define UP2AC(up) ( \ ((up) < 1) ? WME_AC_BE : \ ((up) < 3) ? WME_AC_BK : \ ((up) < 4) ? WME_AC_BE : \ ((up) < 6) ? WME_AC_VI : \ WME_AC_VO) -#endif //AC Mapping to UP, using in Tx part for selecting the corresponding TX queue #define AC2UP(_ac) ( \ ((_ac) == WME_AC_VO) ? 6 : \ @@ -1597,12 +1527,7 @@ struct ieee80211_network { /* Ensure null-terminated for any debug msgs */ u8 ssid[IW_ESSID_MAX_SIZE + 1]; u8 ssid_len; -#if 1 struct ieee80211_qos_data qos_data; -#else - // Qos related. Added by Annie, 2005-11-01. - BSS_QOS BssQos; -#endif //added by amy for LEAP bool bWithAironetIE; bool bCkipSupported; @@ -1667,7 +1592,6 @@ struct ieee80211_network { struct list_head list; }; -#if 1 enum ieee80211_state { /* the card is not linked at all */ @@ -1706,17 +1630,6 @@ enum ieee80211_state { IEEE80211_LINKED_SCANNING, }; -#else -enum ieee80211_state { - IEEE80211_UNINITIALIZED = 0, - IEEE80211_INITIALIZED, - IEEE80211_ASSOCIATING, - IEEE80211_ASSOCIATED, - IEEE80211_AUTHENTICATING, - IEEE80211_AUTHENTICATED, - IEEE80211_SHUTDOWN -}; -#endif #define DEFAULT_MAX_SCAN_AGE (15 * HZ) #define DEFAULT_FTS 2346 @@ -1735,20 +1648,7 @@ enum ieee80211_state { #define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \ IEEE80211_52GHZ_MIN_CHANNEL + 1) -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11)) -extern inline int is_multicast_ether_addr(const u8 *addr) -{ - return ((addr[0] != 0xff) && (0x01 & addr[0])); -} -#endif -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13)) -extern inline int is_broadcast_ether_addr(const u8 *addr) -{ - return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \ - (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); -} -#endif typedef struct tx_pending_t{ int frag; @@ -1826,11 +1726,7 @@ typedef struct _RT_POWER_SAVE_CONTROL bool bIPSModeBackup; bool bSwRfProcessing; RT_RF_POWER_STATE eInactivePowerState; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) struct work_struct InactivePsWorkItem; -#else - struct tq_struct InactivePsWorkItem; -#endif struct timer_list InactivePsTimer; // Return point for join action @@ -2195,32 +2091,13 @@ struct ieee80211_device { /* used if IEEE_SOFTMAC_BEACONS is set */ struct timer_list beacon_timer; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) struct work_struct associate_complete_wq; struct work_struct associate_procedure_wq; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) struct delayed_work softmac_scan_wq; struct delayed_work associate_retry_wq; struct delayed_work start_ibss_wq; -#else - struct work_struct softmac_scan_wq; - struct work_struct associate_retry_wq; - struct work_struct start_ibss_wq; -#endif struct work_struct wx_sync_scan_wq; struct workqueue_struct *wq; -#else - /* used for periodly scan */ - struct timer_list scan_timer; - - struct tq_struct associate_complete_wq; - struct tq_struct associate_retry_wq; - struct tq_struct start_ibss_wq; - struct tq_struct associate_procedure_wq; - struct tq_struct softmac_scan_wq; - struct tq_struct wx_sync_scan_wq; - -#endif // Qos related. Added by Annie, 2005-11-01. //STA_QOS StaQos; @@ -2320,35 +2197,9 @@ struct ieee80211_device { void (*ps_request_tx_ack) (struct net_device *dev); void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl); short (*ps_is_queue_empty) (struct net_device *dev); -#if 0 - /* Typical STA methods */ - int (*handle_auth) (struct net_device * dev, - struct ieee80211_auth * auth); - int (*handle_deauth) (struct net_device * dev, - struct ieee80211_deauth * auth); - int (*handle_action) (struct net_device * dev, - struct ieee80211_action * action, - struct ieee80211_rx_stats * stats); - int (*handle_disassoc) (struct net_device * dev, - struct ieee80211_disassoc * assoc); -#endif int (*handle_beacon) (struct net_device * dev, struct ieee80211_beacon * beacon, struct ieee80211_network * network); -#if 0 - int (*handle_probe_response) (struct net_device * dev, - struct ieee80211_probe_response * resp, - struct ieee80211_network * network); - int (*handle_probe_request) (struct net_device * dev, - struct ieee80211_probe_request * req, - struct ieee80211_rx_stats * stats); -#endif int (*handle_assoc_response) (struct net_device * dev, struct ieee80211_assoc_response_frame * resp, struct ieee80211_network * network); -#if 0 - /* Typical AP methods */ - int (*handle_assoc_request) (struct net_device * dev); - int (*handle_reassoc_request) (struct net_device * dev, - struct ieee80211_reassoc_request * req); -#endif /* check whether Tx hw resouce available */ short (*check_nic_enough_desc)(struct net_device *dev, int queue_index); @@ -2406,11 +2257,7 @@ struct ieee80211_device { static inline void *ieee80211_priv(struct net_device *dev) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) return ((struct ieee80211_device *)netdev_priv(dev))->priv; -#else - return ((struct ieee80211_device *)dev->priv)->priv; -#endif } extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) @@ -2663,11 +2510,7 @@ extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_reques union iwreq_data *wrqu, char *b); //extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) extern void ieee80211_wx_sync_scan_wq(struct work_struct *work); -#else - extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); -#endif extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, diff --git a/drivers/staging/rtl8192u/ieee80211/EndianFree.h b/drivers/staging/rtl8192u/ieee80211/EndianFree.h index 0c417a6234a9..dc85fb913dc2 100644 --- a/drivers/staging/rtl8192u/ieee80211/EndianFree.h +++ b/drivers/staging/rtl8192u/ieee80211/EndianFree.h @@ -7,11 +7,6 @@ * 2. Before write integer to IO. * 3. After read integer from IO. */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) -#ifndef bool -typedef enum{false = 0, true} bool; -#endif -#endif #define __MACHINE_LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ #define __MACHINE_BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net, ppc */ diff --git a/drivers/staging/rtl8192u/ieee80211/crypto_compat.h b/drivers/staging/rtl8192u/ieee80211/crypto_compat.h index c7f26ffa2485..da486588f1c0 100644 --- a/drivers/staging/rtl8192u/ieee80211/crypto_compat.h +++ b/drivers/staging/rtl8192u/ieee80211/crypto_compat.h @@ -30,35 +30,6 @@ static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm, return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes); } -#if 0 -/* - * crypto_free_tfm - Free crypto transform - * @tfm: Transform to free - * - * crypto_free_tfm() frees up the transform and any associated resources, - * then drops the refcount on the associated algorithm. - */ -void crypto_free_tfm(struct crypto_tfm *tfm) -{ - struct crypto_alg *alg; - int size; - - if (unlikely(!tfm)) - return; - - alg = tfm->__crt_alg; - size = sizeof(*tfm) + alg->cra_ctxsize; - - if (alg->cra_exit) - alg->cra_exit(tfm); - crypto_exit_ops(tfm); - crypto_mod_put(alg); - memset(tfm, 0, size); - kfree(tfm); -} - -#endif -#if 1 struct crypto_tfm *crypto_alloc_tfm(const char *name, u32 flags) { struct crypto_tfm *tfm = NULL; @@ -83,7 +54,6 @@ void crypto_free_tfm(struct crypto_tfm *tfm) return tfm; } -#endif //EXPORT_SYMBOL_GPL(crypto_alloc_tfm); //EXPORT_SYMBOL_GPL(crypto_free_tfm); diff --git a/drivers/staging/rtl8192u/ieee80211/dot11d.c b/drivers/staging/rtl8192u/ieee80211/dot11d.c index e5f2dedc4372..b91cbfcfa71f 100644 --- a/drivers/staging/rtl8192u/ieee80211/dot11d.c +++ b/drivers/staging/rtl8192u/ieee80211/dot11d.c @@ -35,10 +35,6 @@ Dot11d_Reset(struct ieee80211_device *ieee) { u32 i; PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee); -#if 0 - if(!pDot11dInfo->bEnabled) - return; -#endif // Clear old channel map memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); @@ -108,14 +104,12 @@ Dot11d_UpdateCountryIe( pTriple = (PCHNL_TXPOWER_TRIPLE)((u8*)pTriple + 3); } -#if 1 //printk("Dot11d_UpdateCountryIe(): Channel List:\n"); printk("Channel List:"); for(i=1; i<= MAX_CHANNEL_NUMBER; i++) if(pDot11dInfo->channel_map[i] > 0) printk(" %d", i); printk("\n"); -#endif UPDATE_CIE_SRC(dev, pTaddr); @@ -218,7 +212,6 @@ int ToLegalChannel( return default_chn; } -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) EXPORT_SYMBOL(Dot11d_Init); EXPORT_SYMBOL(Dot11d_Reset); EXPORT_SYMBOL(Dot11d_UpdateCountryIe); @@ -226,14 +219,5 @@ EXPORT_SYMBOL(DOT11D_GetMaxTxPwrInDbm); EXPORT_SYMBOL(DOT11D_ScanComplete); EXPORT_SYMBOL(IsLegalChannel); EXPORT_SYMBOL(ToLegalChannel); -#else -EXPORT_SYMBOL_NOVERS(Dot11d_Init); -EXPORT_SYMBOL_NOVERS(Dot11d_Reset); -EXPORT_SYMBOL_NOVERS(Dot11d_UpdateCountryIe); -EXPORT_SYMBOL_NOVERS(DOT11D_GetMaxTxPwrInDbm); -EXPORT_SYMBOL_NOVERS(DOT11D_ScanComplete); -EXPORT_SYMBOL_NOVERS(IsLegalChannel); -EXPORT_SYMBOL_NOVERS(ToLegalChannel); -#endif #endif diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index 0dd773733f6b..10908e123b86 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -27,12 +27,7 @@ #include /* ARRAY_SIZE */ #include #include -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) #include -#else -#include -#include -#endif #include #include @@ -43,11 +38,6 @@ #include "rtl819x_BA.h" #include "rtl819x_TS.h" -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) -#ifndef bool -typedef enum{false = 0, true} bool; -#endif -#endif #ifndef IW_MODE_MONITOR #define IW_MODE_MONITOR 6 @@ -57,24 +47,6 @@ typedef enum{false = 0, true} bool; #define IWEVCUSTOM 0x8c02 #endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -#ifndef __bitwise -#define __bitwise __attribute__((bitwise)) -#endif -typedef __u16 __le16; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27)) -struct iw_spy_data{ - /* --- Standard spy support --- */ - int spy_number; - u_char spy_address[IW_MAX_SPY][ETH_ALEN]; - struct iw_quality spy_stat[IW_MAX_SPY]; - /* --- Enhanced spy support (event) */ - struct iw_quality spy_thr_low; /* Low threshold */ - struct iw_quality spy_thr_high; /* High threshold */ - u_char spy_thr_under[IW_MAX_SPY]; -}; -#endif -#endif #ifndef container_of /** @@ -425,46 +397,10 @@ typedef struct ieee_param { #define IW_QUAL_NOISE_UPDATED 0x4 #endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -static inline void tq_init(struct tq_struct * task, void(*func)(void *), void *data) -{ - task->routine = func; - task->data = data; - //task->next = NULL; - INIT_LIST_HEAD(&task->list); - task->sync = 0; -} -#endif // linux under 2.6.9 release may not support it, so modify it for common use -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)) -//#define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ) -#define MSECS(t) (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000) -static inline unsigned long msleep_interruptible_rsl(unsigned int msecs) -{ - unsigned long timeout = MSECS(msecs) + 1; - - while (timeout) { - set_current_state(TASK_INTERRUPTIBLE); - timeout = schedule_timeout(timeout); - } - return timeout; -} -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31)) -static inline void msleep(unsigned int msecs) -{ - unsigned long timeout = MSECS(msecs) + 1; - - while (timeout) { - set_current_state(TASK_UNINTERRUPTIBLE); - timeout = schedule_timeout(timeout); - } -} -#endif -#else #define MSECS(t) msecs_to_jiffies(t) #define msleep_interruptible_rsl msleep_interruptible -#endif #define IEEE80211_DATA_LEN 2304 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section @@ -926,7 +862,6 @@ struct ieee_ibss_seq { * information for frames received. Not setting these will not cause * any adverse affects. */ struct ieee80211_rx_stats { -#if 1 u32 mac_time[2]; s8 rssi; u8 signal; @@ -988,7 +923,6 @@ struct ieee80211_rx_stats { bool bToSelfBA; //cosa add for rssi char cck_adc_pwdb[4]; //cosa add for rx path selection u16 Seq_Num; -#endif }; @@ -1336,7 +1270,6 @@ typedef union _frameqos { #define QOS_OUI_PARAM_SUB_TYPE 1 #define QOS_VERSION_1 1 #define QOS_AIFSN_MIN_VALUE 2 -#if 1 struct ieee80211_qos_information_element { u8 elementID; u8 length; @@ -1411,7 +1344,6 @@ struct ieee80211_wmm_tspec_elem { u16 surp_band_allow; u16 medium_time; }__attribute__((packed)); -#endif enum eap_type { EAP_PACKET = 0, EAPOL_START, @@ -1534,14 +1466,12 @@ enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame}; //UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP //#define UP2AC(up) ((up<3) ? ((up==0)?1:0) : (up>>1)) -#if 1 #define UP2AC(up) ( \ ((up) < 1) ? WME_AC_BE : \ ((up) < 3) ? WME_AC_BK : \ ((up) < 4) ? WME_AC_BE : \ ((up) < 6) ? WME_AC_VI : \ WME_AC_VO) -#endif //AC Mapping to UP, using in Tx part for selecting the corresponding TX queue #define AC2UP(_ac) ( \ ((_ac) == WME_AC_VO) ? 6 : \ @@ -1597,12 +1527,7 @@ struct ieee80211_network { /* Ensure null-terminated for any debug msgs */ u8 ssid[IW_ESSID_MAX_SIZE + 1]; u8 ssid_len; -#if 1 struct ieee80211_qos_data qos_data; -#else - // Qos related. Added by Annie, 2005-11-01. - BSS_QOS BssQos; -#endif //added by amy for LEAP bool bWithAironetIE; @@ -1668,7 +1593,6 @@ struct ieee80211_network { struct list_head list; }; -#if 1 enum ieee80211_state { /* the card is not linked at all */ @@ -1707,17 +1631,6 @@ enum ieee80211_state { IEEE80211_LINKED_SCANNING, }; -#else -enum ieee80211_state { - IEEE80211_UNINITIALIZED = 0, - IEEE80211_INITIALIZED, - IEEE80211_ASSOCIATING, - IEEE80211_ASSOCIATED, - IEEE80211_AUTHENTICATING, - IEEE80211_AUTHENTICATED, - IEEE80211_SHUTDOWN -}; -#endif #define DEFAULT_MAX_SCAN_AGE (15 * HZ) #define DEFAULT_FTS 2346 @@ -1736,20 +1649,7 @@ enum ieee80211_state { #define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \ IEEE80211_52GHZ_MIN_CHANNEL + 1) -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11)) -extern inline int is_multicast_ether_addr(const u8 *addr) -{ - return ((addr[0] != 0xff) && (0x01 & addr[0])); -} -#endif -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13)) -extern inline int is_broadcast_ether_addr(const u8 *addr) -{ - return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \ - (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); -} -#endif typedef struct tx_pending_t{ int frag; @@ -1827,11 +1727,7 @@ typedef struct _RT_POWER_SAVE_CONTROL bool bIPSModeBackup; bool bSwRfProcessing; RT_RF_POWER_STATE eInactivePowerState; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) struct work_struct InactivePsWorkItem; -#else - struct tq_struct InactivePsWorkItem; -#endif struct timer_list InactivePsTimer; // Return point for join action @@ -2196,32 +2092,13 @@ struct ieee80211_device { /* used if IEEE_SOFTMAC_BEACONS is set */ struct timer_list beacon_timer; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) struct work_struct associate_complete_wq; struct work_struct associate_procedure_wq; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) struct delayed_work softmac_scan_wq; struct delayed_work associate_retry_wq; struct delayed_work start_ibss_wq; -#else - struct work_struct softmac_scan_wq; - struct work_struct associate_retry_wq; - struct work_struct start_ibss_wq; -#endif struct work_struct wx_sync_scan_wq; struct workqueue_struct *wq; -#else - /* used for periodly scan */ - struct timer_list scan_timer; - - struct tq_struct associate_complete_wq; - struct tq_struct associate_retry_wq; - struct tq_struct start_ibss_wq; - struct tq_struct associate_procedure_wq; - struct tq_struct softmac_scan_wq; - struct tq_struct wx_sync_scan_wq; - -#endif // Qos related. Added by Annie, 2005-11-01. //STA_QOS StaQos; @@ -2321,35 +2198,9 @@ struct ieee80211_device { void (*ps_request_tx_ack) (struct net_device *dev); void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl); short (*ps_is_queue_empty) (struct net_device *dev); -#if 0 - /* Typical STA methods */ - int (*handle_auth) (struct net_device * dev, - struct ieee80211_auth * auth); - int (*handle_deauth) (struct net_device * dev, - struct ieee80211_deauth * auth); - int (*handle_action) (struct net_device * dev, - struct ieee80211_action * action, - struct ieee80211_rx_stats * stats); - int (*handle_disassoc) (struct net_device * dev, - struct ieee80211_disassoc * assoc); -#endif int (*handle_beacon) (struct net_device * dev, struct ieee80211_beacon * beacon, struct ieee80211_network * network); -#if 0 - int (*handle_probe_response) (struct net_device * dev, - struct ieee80211_probe_response * resp, - struct ieee80211_network * network); - int (*handle_probe_request) (struct net_device * dev, - struct ieee80211_probe_request * req, - struct ieee80211_rx_stats * stats); -#endif int (*handle_assoc_response) (struct net_device * dev, struct ieee80211_assoc_response_frame * resp, struct ieee80211_network * network); -#if 0 - /* Typical AP methods */ - int (*handle_assoc_request) (struct net_device * dev); - int (*handle_reassoc_request) (struct net_device * dev, - struct ieee80211_reassoc_request * req); -#endif /* check whether Tx hw resouce available */ short (*check_nic_enough_desc)(struct net_device *dev, int queue_index); @@ -2407,11 +2258,7 @@ struct ieee80211_device { static inline void *ieee80211_priv(struct net_device *dev) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) return ((struct ieee80211_device *)netdev_priv(dev))->priv; -#else - return ((struct ieee80211_device *)dev->priv)->priv; -#endif } extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) @@ -2664,11 +2511,7 @@ extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_reques union iwreq_data *wrqu, char *b); //extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) extern void ieee80211_wx_sync_scan_wq(struct work_struct *work); -#else - extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); -#endif extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h index a84df4b76489..b58a3bcc0dc0 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h @@ -82,12 +82,5 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); void ieee80211_crypt_deinit_handler(unsigned long); void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, struct ieee80211_crypt_data **crypt); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) -#endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31)) -#define crypto_alloc_tfm crypto_alloc_tfm_rsl -#define crypto_free_tfm crypto_free_tfm_rsl -#endif #endif diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index bbaec949bb85..7a8690f449b4 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -201,13 +201,11 @@ void free_ieee80211(struct net_device *dev) int i; //struct list_head *p, *q; // del_timer_sync(&ieee->SwBwTimer); -#if 1 if (ieee->pHTInfo != NULL) { kfree(ieee->pHTInfo); ieee->pHTInfo = NULL; } -#endif RemoveAllTS(ieee); ieee80211_softmac_free(ieee); del_timer_sync(&ieee->crypt_deinit_timer); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index 5b66e546416e..0e003c5bb000 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -55,11 +55,7 @@ static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee, u16 fc = le16_to_cpu(hdr->frame_ctl); skb->dev = ieee->dev; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) skb_reset_mac_header(skb); -#else - skb->mac.raw = skb->data; -#endif skb_pull(skb, ieee80211_get_hdrlen(fc)); skb->pkt_type = PACKET_OTHERHOST; @@ -351,13 +347,11 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb, if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) return 0; -#if 1 if (ieee->hwsec_active) { cb_desc *tcb_desc = (cb_desc *)(skb->cb+ MAX_DEV_ADDR_SIZE); tcb_desc->bHwSec = 1; } -#endif hdr = (struct ieee80211_hdr_4addr *) skb->data; hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); @@ -534,7 +528,6 @@ AddReorderEntry( ) { struct list_head *pList = &pTS->RxPendingPktList; -#if 1 while(pList->next != &pTS->RxPendingPktList) { if( SN_LESS(pReorderEntry->SeqNum, ((PRX_REORDER_ENTRY)list_entry(pList->next,RX_REORDER_ENTRY,List))->SeqNum) ) @@ -550,7 +543,6 @@ AddReorderEntry( break; } } -#endif pReorderEntry->List.next = pList->next; pReorderEntry->List.next->prev = &pReorderEntry->List; pReorderEntry->List.prev = pList; @@ -626,10 +618,6 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee, u8 index = 0; bool bMatchWinStart = false, bPktInBuf = false; IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): Seq is %d,pTS->RxIndicateSeq is %d, WinSize is %d\n",__FUNCTION__,SeqNum,pTS->RxIndicateSeq,WinSize); -#if 0 - if(!list_empty(&ieee->RxReorder_Unused_List)) - IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): ieee->RxReorder_Unused_List is nut NULL\n"); -#endif /* Rx Reorder initialize condition.*/ if(pTS->RxIndicateSeq == 0xffff) { pTS->RxIndicateSeq = SeqNum; @@ -696,7 +684,6 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee, pReorderEntry->prxb = prxb; // IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): pREorderEntry->SeqNum is %d\n",__FUNCTION__,pReorderEntry->SeqNum); -#if 1 if(!AddReorderEntry(pTS, pReorderEntry)) { IEEE80211_DEBUG(IEEE80211_DL_REORDER, "%s(): Duplicate packet is dropped!! IndicateSeq: %d, NewSeq: %d\n", __FUNCTION__, pTS->RxIndicateSeq, SeqNum); @@ -713,7 +700,6 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee, IEEE80211_DEBUG(IEEE80211_DL_REORDER, "Pkt insert into buffer!! IndicateSeq: %d, NewSeq: %d\n",pTS->RxIndicateSeq, SeqNum); } -#endif } else { /* @@ -736,7 +722,6 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee, /* Check if there is any packet need indicate.*/ while(!list_empty(&pTS->RxPendingPktList)) { IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): start RREORDER indicate\n",__FUNCTION__); -#if 1 pReorderEntry = (PRX_REORDER_ENTRY)list_entry(pTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List); if( SN_LESS(pReorderEntry->SeqNum, pTS->RxIndicateSeq) || SN_EQUAL(pReorderEntry->SeqNum, pTS->RxIndicateSeq)) @@ -763,7 +748,6 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee, bPktInBuf = true; break; } -#endif } /* Handling pending timer. Set this timer to prevent from long time Rx buffering.*/ @@ -780,7 +764,6 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee, ieee80211_indicate_packets(ieee, prxbIndicateArray, index); } -#if 1 if(bPktInBuf && pTS->RxTimeoutIndicateSeq==0xffff) { // Set new pending timer. IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): SET rx timeout timer\n", __FUNCTION__); @@ -790,7 +773,6 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee, pTS->RxPktPendingTimer.expires = jiffies + MSECS(pHTInfo->RxReorderPendingTime); add_timer(&pTS->RxPktPendingTimer); } -#endif } u8 parse_subframe(struct sk_buff *skb, @@ -857,11 +839,6 @@ u8 parse_subframe(struct sk_buff *skb, nSubframe_Length = (nSubframe_Length>>8) + (nSubframe_Length<<8); if(skb->len<(ETHERNET_HEADER_SIZE + nSubframe_Length)) { -#if 0//cosa - RT_ASSERT( - (nRemain_Length>=(ETHERNET_HEADER_SIZE + nSubframe_Length)), - ("ParseSubframe(): A-MSDU subframe parse error!! Subframe Length: %d\n", nSubframe_Length) ); -#endif printk("%s: A-MSDU parse error!! pRfd->nTotalSubframe : %d\n",\ __FUNCTION__,rxb->nr_subframes); printk("%s: A-MSDU parse error!! Subframe Length: %d\n",__FUNCTION__, nSubframe_Length); @@ -1058,19 +1035,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, else { PRX_TS_RECORD pRxTS = NULL; - #if 0 - struct ieee80211_hdr_3addr *hdr; - u16 fc; - hdr = (struct ieee80211_hdr_3addr *)skb->data; - fc = le16_to_cpu(hdr->frame_ctl); - u8 tmp = (fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS); - - u8 tid = (*((u8*)skb->data + (((fc& IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))?30:24)))&0xf; - printk("====================>fc:%x, tid:%d, tmp:%d\n", fc, tid, tmp); - //u8 tid = (u8)((frameqos*)(buf + ((fc & IEEE80211_FCTL_TODS)&&(fc & IEEE80211_FCTL_FROMDS))? 30 : 24))->field.tid; - #endif //IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): QOS ENABLE AND RECEIVE QOS DATA , we will get Ts, tid:%d\n",__FUNCTION__, tid); -#if 1 if(GetTs( ieee, (PTS_COMMON_INFO*) &pRxTS, @@ -1099,22 +1064,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, goto rx_dropped; } } -#endif if (type == IEEE80211_FTYPE_MGMT) { - #if 0 - if ( stype == IEEE80211_STYPE_AUTH && - fc & IEEE80211_FCTL_WEP && ieee->host_decrypt && - (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0) - { - printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " - "from " MAC_FMT "\n", dev->name, - MAC_ARG(hdr->addr2)); - /* TODO: could inform hostapd about this so that it - * could send auth failure report */ - goto rx_dropped; - } - #endif //IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len); if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype)) @@ -1336,7 +1287,6 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, } */ //added by amy for reorder -#if 1 if(ieee->current_network.qos_data.active && IsQoSDataFrame(skb->data) && !is_multicast_ether_addr(hdr->addr1) && !is_broadcast_ether_addr(hdr->addr1)) { @@ -1348,7 +1298,6 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, ieee->bis_any_nonbepkts = true; } } -#endif //added by amy for reorder /* skb: hdr + (possible reassembled) full plaintext payload */ payload = skb->data + hdrlen; @@ -1974,16 +1923,6 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, } } -#if 0 - if (tmp_htcap_len !=0) - { - u16 cap_ext = ((PHT_CAPABILITY_ELE)&info_element->data[0])->ExtHTCapInfo; - if ((cap_ext & 0x0c00) == 0x0c00) - { - network->ralink_cap_exist = true; - } - } -#endif if(info_element->len >= 3 && info_element->data[0] == 0x00 && info_element->data[1] == 0x0c && @@ -2156,44 +2095,6 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, break; #endif /* TODO */ -#if 0 - /* 802.11h */ - case MFIE_TYPE_POWER_CONSTRAINT: - network->power_constraint = info_element->data[0]; - network->flags |= NETWORK_HAS_POWER_CONSTRAINT; - break; - - case MFIE_TYPE_CSA: - network->power_constraint = info_element->data[0]; - network->flags |= NETWORK_HAS_CSA; - break; - - case MFIE_TYPE_QUIET: - network->quiet.count = info_element->data[0]; - network->quiet.period = info_element->data[1]; - network->quiet.duration = info_element->data[2]; - network->quiet.offset = info_element->data[3]; - network->flags |= NETWORK_HAS_QUIET; - break; - - case MFIE_TYPE_IBSS_DFS: - if (network->ibss_dfs) - break; - network->ibss_dfs = kmemdup(info_element->data, - info_element->len, - GFP_ATOMIC); - if (!network->ibss_dfs) - return 1; - network->flags |= NETWORK_HAS_IBSS_DFS; - break; - - case MFIE_TYPE_TPC_REPORT: - network->tpc_report.transmit_power = - info_element->data[0]; - network->tpc_report.link_margin = info_element->data[1]; - network->flags |= NETWORK_HAS_TPC_REPORT; - break; -#endif default: IEEE80211_DEBUG_MGMT ("Unsupported info element: %s (%d)\n", @@ -2376,11 +2277,9 @@ static inline int ieee80211_network_init( if (ieee80211_is_empty_essid(network->ssid, network->ssid_len)) network->flags |= NETWORK_EMPTY_ESSID; -#if 1 stats->signal = 30 + (stats->SignalStrength * 70) / 100; //stats->signal = ieee80211_SignalStrengthTranslate(stats->signal); stats->noise = ieee80211_translate_todbm((u8)(100-stats->signal)) -25; -#endif memcpy(&network->stats, stats, sizeof(network->stats)); @@ -2488,7 +2387,6 @@ static inline void update_network(struct ieee80211_network *dst, dst->qos_data.old_param_count = old_param; /* dst->last_associate is not overwritten */ -#if 1 dst->wmm_info = src->wmm_info; //sure to exist in beacon or probe response frame. if(src->wmm_param[0].ac_aci_acm_aifsn|| \ src->wmm_param[1].ac_aci_acm_aifsn|| \ @@ -2497,9 +2395,6 @@ static inline void update_network(struct ieee80211_network *dst, memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN); } //dst->QoS_Enable = src->QoS_Enable; -#else - dst->QoS_Enable = 1;//for Rtl8187 simulation -#endif #ifdef THOMAS_TURBO dst->Turbo_Enable = src->Turbo_Enable; #endif @@ -2769,10 +2664,5 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee, } } -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) EXPORT_SYMBOL(ieee80211_rx_mgt); EXPORT_SYMBOL(ieee80211_rx); -#else -EXPORT_SYMBOL_NOVERS(ieee80211_rx_mgt); -EXPORT_SYMBOL_NOVERS(ieee80211_rx); -#endif diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 1629b0f33f07..8a86e93465c8 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -503,34 +503,11 @@ out: } } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -/* called both by wq with ieee->lock held */ -void ieee80211_softmac_scan(struct ieee80211_device *ieee) -{ -#if 0 - short watchdog = 0; - do{ - ieee->current_network.channel = - (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER; - if (watchdog++ > MAX_CHANNEL_NUMBER) - return; /* no good chans */ - - }while(!ieee->channel_map[ieee->current_network.channel]); -#endif - - schedule_task(&ieee->softmac_scan_wq); -} -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) void ieee80211_softmac_scan_wq(struct work_struct *work) { struct delayed_work *dwork = container_of(work, struct delayed_work, work); struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq); -#else -void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee) -{ -#endif static short watchdog = 0; #ifdef ENABLE_DOT11D u8 channel_map[MAX_CHANNEL_NUMBER+1]; @@ -567,13 +544,7 @@ void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee) ieee80211_send_probe_requests(ieee); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME); -#else - //ieee->scan_timer.expires = jiffies + MSECS(IEEE80211_SOFTMAC_SCAN_TIME); - if (ieee->scanning == 1) - mod_timer(&ieee->scan_timer,(jiffies + MSECS(IEEE80211_SOFTMAC_SCAN_TIME))); -#endif up(&ieee->scan_sem); return; @@ -588,17 +559,6 @@ out: up(&ieee->scan_sem); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -void ieee80211_softmac_scan_cb(unsigned long _dev) -{ - unsigned long flags; - struct ieee80211_device *ieee = (struct ieee80211_device *)_dev; - - spin_lock_irqsave(&ieee->lock, flags); - ieee80211_softmac_scan(ieee); - spin_unlock_irqrestore(&ieee->lock, flags); -} -#endif void ieee80211_beacons_start(struct ieee80211_device *ieee) @@ -656,11 +616,7 @@ void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee) if (ieee->scanning == 1){ ieee->scanning = 0; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) cancel_delayed_work(&ieee->softmac_scan_wq); -#else - del_timer_sync(&ieee->scan_timer); -#endif } // spin_unlock_irqrestore(&ieee->lock, flags); @@ -690,16 +646,7 @@ void ieee80211_start_scan(struct ieee80211_device *ieee) if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){ if (ieee->scanning == 0){ ieee->scanning = 1; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0); -#else - - queue_work(ieee->wq, &ieee->softmac_scan_wq); -#endif -#else - ieee80211_softmac_scan(ieee); -#endif } }else ieee->start_scan(ieee->dev); @@ -800,22 +747,10 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d else atim_len = 0; -#if 1 if(ieee80211_is_54g(ieee->current_network)) erp_len = 3; else erp_len = 0; -#else - if((ieee->current_network.mode == IEEE_G) - ||( ieee->current_network.mode == IEEE_N_24G && ieee->pHTInfo->bCurSuppCCK)) { - erp_len = 3; - erpinfo_content = 0; - if(ieee->current_network.buseprotection) - erpinfo_content |= ERP_UseProtection; - } - else - erp_len = 0; -#endif crypt = ieee->crypt[ieee->tx_keyidx]; @@ -824,7 +759,6 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d encrypt = ieee->host_encrypt && crypt && crypt->ops && ((0 == strcmp(crypt->ops->name, "WEP") || wpa_ie_len)); //HT ralated element -#if 1 tmp_ht_cap_buf =(u8*) &(ieee->pHTInfo->SelfHTCap); tmp_ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap); tmp_ht_info_buf =(u8*) &(ieee->pHTInfo->SelfHTInfo); @@ -840,7 +774,6 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d HTConstructRT2RTAggElement(ieee, tmp_generic_ie_buf, &tmp_generic_ie_len); } // printk("===============>tmp_ht_cap_len is %d,tmp_ht_info_len is %d, tmp_generic_ie_len is %d\n",tmp_ht_cap_len,tmp_ht_info_len,tmp_generic_ie_len); -#endif beacon_size = sizeof(struct ieee80211_probe_response)+2+ ssid_len +3 //channel @@ -875,10 +808,6 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT)); crypt = ieee->crypt[ieee->tx_keyidx]; -#if 0 - encrypt = ieee->host_encrypt && crypt && crypt->ops && - (0 == strcmp(crypt->ops->name, "WEP")); -#endif if (encrypt) beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); @@ -917,14 +846,6 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d *(tag++) = 1; *(tag++) = erpinfo_content; } -#if 0 - //Include High Throuput capability - - *(tag++) = MFIE_TYPE_HT_CAP; - *(tag++) = tmp_ht_cap_len - 2; - memcpy(tag, tmp_ht_cap_buf, tmp_ht_cap_len - 2); - tag += tmp_ht_cap_len - 2; -#endif if(rate_ex_len){ *(tag++) = MFIE_TYPE_RATES_EX; *(tag++) = rate_ex_len-2; @@ -932,14 +853,6 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d tag+=rate_ex_len-2; } -#if 0 - //Include High Throuput info - - *(tag++) = MFIE_TYPE_HT_INFO; - *(tag++) = tmp_ht_info_len - 2; - memcpy(tag, tmp_ht_info_buf, tmp_ht_info_len -2); - tag += tmp_ht_info_len - 2; -#endif if (wpa_ie_len) { if (ieee->iw_mode == IW_MODE_ADHOC) @@ -950,28 +863,6 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d tag += wpa_ie_len; } -#if 0 - // - // Construct Realtek Proprietary Aggregation mode (Set AMPDU Factor to 2, 32k) - // - if(pHTInfo->bRegRT2RTAggregation) - { - (*tag++) = 0xdd; - (*tag++) = tmp_generic_ie_len - 2; - memcpy(tag,tmp_generic_ie_buf,tmp_generic_ie_len -2); - tag += tmp_generic_ie_len -2; - - } -#endif -#if 0 - if(ieee->qos_support) - { - (*tag++) = 0xdd; - (*tag++) = wmm_len; - memcpy(tag,QosOui,wmm_len); - tag += wmm_len; - } -#endif //skb->dev = ieee->dev; return skb; } @@ -1380,12 +1271,8 @@ void ieee80211_associate_abort(struct ieee80211_device *ieee) ieee->state = IEEE80211_ASSOCIATING_RETRY; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, \ IEEE80211_SOFTMAC_ASSOC_RETRY_TIME); -#else - schedule_task(&ieee->associate_retry_wq); -#endif spin_unlock_irqrestore(&ieee->lock, flags); } @@ -1447,10 +1334,6 @@ void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int softmac_mgmt_xmit(skb, ieee); mod_timer(&ieee->associate_timer, jiffies + (HZ/2)); -#if 0 - ieee->associate_timer.expires = jiffies + (HZ / 2); - add_timer(&ieee->associate_timer); -#endif //dev_kfree_skb_any(skb);//edit by thomas } kfree(challenge); @@ -1472,21 +1355,12 @@ void ieee80211_associate_step2(struct ieee80211_device *ieee) else{ softmac_mgmt_xmit(skb, ieee); mod_timer(&ieee->associate_timer, jiffies + (HZ/2)); -#if 0 - ieee->associate_timer.expires = jiffies + (HZ / 2); - add_timer(&ieee->associate_timer); -#endif //dev_kfree_skb_any(skb);//edit by thomas } } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) void ieee80211_associate_complete_wq(struct work_struct *work) { struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq); -#else -void ieee80211_associate_complete_wq(struct ieee80211_device *ieee) -{ -#endif printk(KERN_INFO "Associated successfully\n"); if(ieee80211_is_54g(ieee->current_network) && (ieee->modulation & IEEE80211_OFDM_MODULATION)){ @@ -1537,41 +1411,14 @@ void ieee80211_associate_complete(struct ieee80211_device *ieee) // struct net_device* dev = ieee->dev; del_timer_sync(&ieee->associate_timer); -#if 0 - for(i = 0; i < 6; i++) { - ieee->seq_ctrl[i] = 0; - } -#endif ieee->state = IEEE80211_LINKED; -#if 0 - if (ieee->pHTInfo->bCurrentHTSupport) - { - printk("Successfully associated, ht enabled\n"); - queue_work(ieee->wq, &ieee->ht_onAssRsp); - } - else - { - printk("Successfully associated, ht not enabled\n"); - memset(ieee->dot11HTOperationalRateSet, 0, 16); - HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); - } -#endif //ieee->UpdateHalRATRTableHandler(dev, ieee->dot11HTOperationalRateSet); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) queue_work(ieee->wq, &ieee->associate_complete_wq); -#else - schedule_task(&ieee->associate_complete_wq); -#endif } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) void ieee80211_associate_procedure_wq(struct work_struct *work) { struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq); -#else -void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee) -{ -#endif ieee->sync_scan_hurryup = 1; down(&ieee->wx_sem); @@ -1669,11 +1516,7 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee } ieee->state = IEEE80211_ASSOCIATING; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) queue_work(ieee->wq, &ieee->associate_procedure_wq); -#else - schedule_task(&ieee->associate_procedure_wq); -#endif }else{ if(ieee80211_is_54g(ieee->current_network) && (ieee->modulation & IEEE80211_OFDM_MODULATION)){ @@ -1890,11 +1733,6 @@ ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb) printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest)); //FIXME - #if 0 - spin_lock_irqsave(&ieee->lock,flags); - add_associate(ieee,dest); - spin_unlock_irqrestore(&ieee->lock,flags); - #endif } @@ -2179,11 +2017,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, "Association response status code 0x%x\n", errcode); if(ieee->AsocRetryCount < RT_ASOC_RETRY_LIMIT) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) queue_work(ieee->wq, &ieee->associate_procedure_wq); -#else - schedule_task(&ieee->associate_procedure_wq); -#endif } else { ieee80211_associate_abort(ieee); } @@ -2290,11 +2124,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, notify_wx_assoc_event(ieee); //HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); RemovePeerTS(ieee, header->addr2); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) queue_work(ieee->wq, &ieee->associate_procedure_wq); -#else - schedule_task(&ieee->associate_procedure_wq); -#endif } break; case IEEE80211_STYPE_MANAGE_ACT: @@ -2347,7 +2177,6 @@ void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device * if(tcb_desc->bMulticast) { ieee->stats.multicast++; } -#if 1 /* if xmit available, just xmit it immediately, else just insert it to the wait queue */ for(i = 0; i < txb->nr_frags; i++) { #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE @@ -2377,7 +2206,6 @@ void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device * //ieee->dev->trans_start = jiffies; } } -#endif ieee80211_txb_free(txb); //exit: @@ -2531,16 +2359,11 @@ void ieee80211_start_monitor_mode(struct ieee80211_device *ieee) netif_carrier_on(ieee->dev); } } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) void ieee80211_start_ibss_wq(struct work_struct *work) { struct delayed_work *dwork = container_of(work, struct delayed_work, work); struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, start_ibss_wq); -#else -void ieee80211_start_ibss_wq(struct ieee80211_device *ieee) -{ -#endif /* iwconfig mode ad-hoc will schedule this and return * on the other hand this will block further iwconfig SET * operations because of the wx_sem hold. @@ -2650,11 +2473,7 @@ void ieee80211_start_ibss_wq(struct ieee80211_device *ieee) inline void ieee80211_start_ibss(struct ieee80211_device *ieee) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) queue_delayed_work(ieee->wq, &ieee->start_ibss_wq, 150); -#else - schedule_task(&ieee->start_ibss_wq); -#endif } /* this is called only in user context, with wx_sem held */ @@ -2719,15 +2538,10 @@ void ieee80211_disassociate(struct ieee80211_device *ieee) notify_wx_assoc_event(ieee); } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) void ieee80211_associate_retry_wq(struct work_struct *work) { struct delayed_work *dwork = container_of(work, struct delayed_work, work); struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq); -#else -void ieee80211_associate_retry_wq(struct ieee80211_device *ieee) -{ -#endif unsigned long flags; down(&ieee->wx_sem); @@ -2822,10 +2636,8 @@ void ieee80211_stop_protocol(struct ieee80211_device *ieee) ieee80211_stop_send_beacons(ieee); del_timer_sync(&ieee->associate_timer); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) cancel_delayed_work(&ieee->associate_retry_wq); cancel_delayed_work(&ieee->start_ibss_wq); -#endif ieee80211_stop_scan(ieee); ieee80211_disassociate(ieee); @@ -2943,11 +2755,6 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee) ieee->sta_edca_param[3] = 0x002F3262; ieee->aggregation = true; ieee->enable_rx_imm_BA = 1; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) - init_timer(&ieee->scan_timer); - ieee->scan_timer.data = (unsigned long)ieee; - ieee->scan_timer.function = ieee80211_softmac_scan_cb; -#endif ieee->tx_pending.txb = NULL; init_timer(&ieee->associate_timer); @@ -2958,16 +2765,12 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee) ieee->beacon_timer.data = (unsigned long) ieee; ieee->beacon_timer.function = ieee80211_send_beacon_cb; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) #ifdef PF_SYNCTHREAD ieee->wq = create_workqueue(DRV_NAME,0); #else ieee->wq = create_workqueue(DRV_NAME); #endif -#endif -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) INIT_DELAYED_WORK(&ieee->start_ibss_wq,ieee80211_start_ibss_wq); INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq); INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq); @@ -2975,23 +2778,7 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee) INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq); INIT_WORK(&ieee->wx_sync_scan_wq,ieee80211_wx_sync_scan_wq); -#else - INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee); - INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee); - INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee); - INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee); - INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee); - INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee); -#endif -#else - tq_init(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee); - tq_init(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee); - tq_init(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee); - tq_init(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee); - tq_init(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee); - tq_init(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee); -#endif sema_init(&ieee->wx_sem, 1); sema_init(&ieee->scan_sem, 1); @@ -3016,10 +2803,8 @@ void ieee80211_softmac_free(struct ieee80211_device *ieee) #endif del_timer_sync(&ieee->associate_timer); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) cancel_delayed_work(&ieee->associate_retry_wq); destroy_workqueue(ieee->wq); -#endif up(&ieee->wx_sem); } @@ -3296,11 +3081,7 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee, } memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); new_crypt->ops = ops; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) -#else - if (new_crypt->ops && try_inc_mod_count(new_crypt->ops->owner)) -#endif new_crypt->priv = new_crypt->ops->init(param->u.crypt.idx); @@ -3483,7 +3264,6 @@ void notify_wx_assoc_event(struct ieee80211_device *ieee) wireless_send_event(ieee->dev, SIOCGIWAP, &wrqu, NULL); } -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) EXPORT_SYMBOL(ieee80211_get_beacon); EXPORT_SYMBOL(ieee80211_wake_queue); EXPORT_SYMBOL(ieee80211_stop_queue); @@ -3504,26 +3284,4 @@ EXPORT_SYMBOL(ieee80211_stop_scan); EXPORT_SYMBOL(ieee80211_send_probe_requests); EXPORT_SYMBOL(ieee80211_softmac_scan_syncro); EXPORT_SYMBOL(ieee80211_start_scan_syncro); -#else -EXPORT_SYMBOL_NOVERS(ieee80211_get_beacon); -EXPORT_SYMBOL_NOVERS(ieee80211_wake_queue); -EXPORT_SYMBOL_NOVERS(ieee80211_stop_queue); -EXPORT_SYMBOL_NOVERS(ieee80211_reset_queue); -EXPORT_SYMBOL_NOVERS(ieee80211_softmac_stop_protocol); -EXPORT_SYMBOL_NOVERS(ieee80211_softmac_start_protocol); -EXPORT_SYMBOL_NOVERS(ieee80211_is_shortslot); -EXPORT_SYMBOL_NOVERS(ieee80211_is_54g); -EXPORT_SYMBOL_NOVERS(ieee80211_wpa_supplicant_ioctl); -EXPORT_SYMBOL_NOVERS(ieee80211_ps_tx_ack); -EXPORT_SYMBOL_NOVERS(ieee80211_softmac_xmit); -EXPORT_SYMBOL_NOVERS(ieee80211_stop_send_beacons); -EXPORT_SYMBOL_NOVERS(notify_wx_assoc_event); -EXPORT_SYMBOL_NOVERS(SendDisassociation); -EXPORT_SYMBOL_NOVERS(ieee80211_disassociate); -EXPORT_SYMBOL_NOVERS(ieee80211_start_send_beacons); -EXPORT_SYMBOL_NOVERS(ieee80211_stop_scan); -EXPORT_SYMBOL_NOVERS(ieee80211_send_probe_requests); -EXPORT_SYMBOL_NOVERS(ieee80211_softmac_scan_syncro); -EXPORT_SYMBOL_NOVERS(ieee80211_start_scan_syncro); -#endif //EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c index d395fc65b704..f335c258ba84 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c @@ -234,23 +234,8 @@ int ieee80211_wx_get_rate(struct ieee80211_device *ieee, union iwreq_data *wrqu, char *extra) { u32 tmp_rate; -#if 0 - printk("===>mode:%d, halfNmode:%d\n", ieee->mode, ieee->bHalfWirelessN24GMode); - if (ieee->mode & (IEEE_A | IEEE_B | IEEE_G)) - tmp_rate = ieee->rate; - else if (ieee->mode & IEEE_N_5G) - tmp_rate = 580; - else if (ieee->mode & IEEE_N_24G) - { - if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) - tmp_rate = HTHalfMcsToDataRate(ieee, 15); - else - tmp_rate = HTMcsToDataRate(ieee, 15); - } -#else tmp_rate = TxCountToDataRate(ieee, ieee->softmac_stats.CurrentShowTxate); -#endif wrqu->bitrate.value = tmp_rate * 500000; return 0; @@ -313,14 +298,9 @@ out: return 0; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) void ieee80211_wx_sync_scan_wq(struct work_struct *work) { struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq); -#else -void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee) -{ -#endif short chan; HT_EXTCHNL_OFFSET chan_offset=0; HT_CHANNEL_WIDTH bandwidth=0; @@ -392,11 +372,7 @@ int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info } if ( ieee->state == IEEE80211_LINKED){ -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) queue_work(ieee->wq, &ieee->wx_sync_scan_wq); -#else - schedule_task(&ieee->wx_sync_scan_wq); -#endif /* intentionally forget to up sem */ return 0; } @@ -442,29 +418,8 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee, if (wrqu->essid.flags && wrqu->essid.length) { //first flush current network.ssid len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - strncpy(ieee->current_network.ssid, extra, len); - ieee->current_network.ssid_len = len; -#if 0 - { - int i; - for (i=0; icurrent_network.ssid, extra, len+1); ieee->current_network.ssid_len = len+1; -#if 0 - { - int i; - for (i=0; issid_set = 1; } else{ @@ -557,18 +512,6 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee, union iwreq_data *wrqu, char *extra) { int ret = 0; -#if 0 - if( - (!ieee->sta_wake_up) || - (!ieee->ps_request_tx_ack) || - (!ieee->enter_sleep_state) || - (!ieee->ps_is_queue_empty)){ - - // printk("ERROR. PS mode is tryied to be use but driver missed a callback\n\n"); - - return -1; - } -#endif down(&ieee->wx_sem); if (wrqu->power.disabled){ @@ -652,7 +595,6 @@ exit: return ret; } -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) EXPORT_SYMBOL(ieee80211_wx_get_essid); EXPORT_SYMBOL(ieee80211_wx_set_essid); EXPORT_SYMBOL(ieee80211_wx_set_rate); @@ -671,23 +613,3 @@ EXPORT_SYMBOL(ieee80211_wx_get_power); EXPORT_SYMBOL(ieee80211_wlan_frequencies); EXPORT_SYMBOL(ieee80211_wx_set_rts); EXPORT_SYMBOL(ieee80211_wx_get_rts); -#else -EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_essid); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_essid); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_rate); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_rate); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_wap); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_wap); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_mode); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_mode); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_scan); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_freq); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_freq); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_rawtx); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_name); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_power); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_power); -EXPORT_SYMBOL_NOVERS(ieee80211_wlan_frequencies); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_rts); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_rts); -#endif diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c index b64e4cb0afe8..b29c36bac377 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c @@ -235,11 +235,6 @@ void ieee80211_txb_free(struct ieee80211_txb *txb) { //int i; if (unlikely(!txb)) return; -#if 0 - for (i = 0; i < txb->nr_frags; i++) - if (txb->fragments[i]) - dev_kfree_skb_any(txb->fragments[i]); -#endif kfree(txb); } @@ -287,11 +282,7 @@ ieee80211_classify(struct sk_buff *skb, struct ieee80211_network *network) return 0; // IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)) ip = ip_hdr(skb); -#else - ip = (struct iphdr*)(skb->data + sizeof(struct ether_header)); -#endif switch (ip->tos & 0xfc) { case 0x20: return 2; @@ -334,12 +325,10 @@ void ieee80211_tx_query_agg_cap(struct ieee80211_device* ieee, struct sk_buff* s if(!Adapter->HalFunc.GetNmodeSupportBySecCfgHandler(Adapter)) return; #endif -#if 1 if(!ieee->GetNmodeSupportBySecCfg(ieee->dev)) { return; } -#endif if(pHTInfo->bCurrentAMPDUEnable) { if (!GetTs(ieee, (PTS_COMMON_INFO*)(&pTxTs), hdr->addr1, skb->priority, TX_DIR, true)) @@ -602,11 +591,7 @@ void ieee80211_query_seqnum(struct ieee80211_device*ieee, struct sk_buff* skb, u int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) struct ieee80211_device *ieee = netdev_priv(dev); -#else - struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv; -#endif struct ieee80211_txb *txb = NULL; struct ieee80211_hdr_3addrqos *frag_hdr; int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size; @@ -878,7 +863,6 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) //WB add to fill data tcb_desc here. only first fragment is considered, need to change, and you may remove to other place. if (txb) { -#if 1 cb_desc *tcb_desc = (cb_desc *)(txb->fragments[0]->cb + MAX_DEV_ADDR_SIZE); tcb_desc->bTxEnableFwCalcDur = 1; if (is_multicast_ether_addr(header.addr1)) @@ -899,7 +883,6 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) ieee80211_query_seqnum(ieee, txb->fragments[0], header.addr1); // IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, txb->fragments[0]->data, txb->fragments[0]->len); //IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, tcb_desc, sizeof(cb_desc)); -#endif } spin_unlock_irqrestore(&ieee->lock, flags); dev_kfree_skb_any(skb); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c index 3b248cd3ce1b..d397f1d68eb7 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c @@ -35,11 +35,6 @@ #include #include "ieee80211.h" -#if 0 -static const char *ieee80211_modes[] = { - "?", "a", "b", "ab", "g", "ag", "bg", "abg" -}; -#endif struct modes_unit { char *mode_string; int mode_size; @@ -53,25 +48,7 @@ struct modes_unit ieee80211_modes[] = { {"N-5G",4}, }; -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -static inline char * -iwe_stream_add_event_rsl(char * stream, /* Stream of events */ - char * ends, /* End of stream */ - struct iw_event *iwe, /* Payload */ - int event_len) /* Real size of payload */ -{ - /* Check if it's possible */ - if((stream + event_len) < ends) { - iwe->len = event_len; - ndelay(1); //new - memcpy(stream, (char *) iwe, event_len); - stream += event_len; - } - return stream; -} -#else #define iwe_stream_add_event_rsl iwe_stream_add_event -#endif #define MAX_CUSTOM_LEN 64 static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, @@ -92,11 +69,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, iwe.cmd = SIOCGIWAP; iwe.u.ap_addr.sa_family = ARPHRD_ETHER; memcpy(iwe.u.ap_addr.sa_data, network->bssid, ETH_ALEN); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_ADDR_LEN); -#else - start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_ADDR_LEN); -#endif /* Remaining entries will be displayed in the order we provide them */ /* Add the ESSID */ @@ -105,18 +78,10 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, // if (network->flags & NETWORK_EMPTY_ESSID) { if (network->ssid_len == 0) { iwe.u.data.length = sizeof(""); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) start = iwe_stream_add_point(info, start, stop, &iwe, ""); -#else - start = iwe_stream_add_point(start, stop, &iwe, ""); -#endif } else { iwe.u.data.length = min(network->ssid_len, (u8)32); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); -#else - start = iwe_stream_add_point(start, stop, &iwe, network->ssid); -#endif } /* Add the protocol name */ iwe.cmd = SIOCGIWNAME; @@ -128,11 +93,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, } *pname = '\0'; snprintf(iwe.u.name, IFNAMSIZ, "IEEE802.11%s", proto_name); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_CHAR_LEN); -#else - start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_CHAR_LEN); -#endif /* Add mode */ iwe.cmd = SIOCGIWMODE; if (network->capability & @@ -141,11 +102,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, iwe.u.mode = IW_MODE_MASTER; else iwe.u.mode = IW_MODE_ADHOC; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_UINT_LEN); -#else - start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_UINT_LEN); -#endif } /* Add frequency/channel */ @@ -155,11 +112,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, iwe.u.freq.m = network->channel; iwe.u.freq.e = 0; iwe.u.freq.i = 0; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_FREQ_LEN); -#else - start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_FREQ_LEN); -#endif /* Add encryption capability */ iwe.cmd = SIOCGIWENCODE; if (network->capability & WLAN_CAPABILITY_PRIVACY) @@ -167,11 +120,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, else iwe.u.data.flags = IW_ENCODE_DISABLED; iwe.u.data.length = 0; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); -#else - start = iwe_stream_add_point(start, stop, &iwe, network->ssid); -#endif /* Add basic and extended rates */ max_rate = 0; p = custom; @@ -215,33 +164,15 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, if (rate > max_rate) max_rate = rate; } -#if 0 - printk("max rate:%d ===basic rate:\n", max_rate); - for (i=0;irates_len;i++) - printk(" %x", network->rates[i]); - printk("\n=======extend rate\n"); - for (i=0; irates_ex_len; i++) - printk(" %x", network->rates_ex[i]); - printk("\n"); -#endif iwe.cmd = SIOCGIWRATE; iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; iwe.u.bitrate.value = max_rate * 500000; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_PARAM_LEN); -#else - start = iwe_stream_add_event_rsl(start, stop, &iwe, - IW_EV_PARAM_LEN); -#endif iwe.cmd = IWEVCUSTOM; iwe.u.data.length = p - custom; if (iwe.u.data.length) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) start = iwe_stream_add_point(info, start, stop, &iwe, custom); -#else - start = iwe_stream_add_point(start, stop, &iwe, custom); -#endif /* Add quality statistics */ /* TODO: Fix these values... */ iwe.cmd = IWEVQUAL; @@ -256,21 +187,13 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, if (!(network->stats.mask & IEEE80211_STATMASK_SIGNAL)) iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID; iwe.u.qual.updated = 7; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_QUAL_LEN); -#else - start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_QUAL_LEN); -#endif iwe.cmd = IWEVCUSTOM; p = custom; iwe.u.data.length = p - custom; if (iwe.u.data.length) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) start = iwe_stream_add_point(info, start, stop, &iwe, custom); -#else - start = iwe_stream_add_point(start, stop, &iwe, custom); -#endif #if (WIRELESS_EXT < 18) if (ieee->wpa_enabled && network->wpa_ie_len){ char buf[MAX_WPA_IE_LEN * 2 + 30]; @@ -284,11 +207,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVCUSTOM; iwe.u.data.length = strlen(buf); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) start = iwe_stream_add_point(info, start, stop, &iwe, buf); -#else - start = iwe_stream_add_point(start, stop, &iwe, buf); -#endif } if (ieee->wpa_enabled && network->rsn_ie_len){ @@ -303,11 +222,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVCUSTOM; iwe.u.data.length = strlen(buf); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) start = iwe_stream_add_point(info, start, stop, &iwe, buf); -#else - start = iwe_stream_add_point(start, stop, &iwe, buf); -#endif } #else memset(&iwe, 0, sizeof(iwe)); @@ -317,11 +232,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, memcpy(buf, network->wpa_ie, network->wpa_ie_len); iwe.cmd = IWEVGENIE; iwe.u.data.length = network->wpa_ie_len; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) start = iwe_stream_add_point(info, start, stop, &iwe, buf); -#else - start = iwe_stream_add_point(start, stop, &iwe, buf); -#endif } memset(&iwe, 0, sizeof(iwe)); if (network->rsn_ie_len) @@ -330,11 +241,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, memcpy(buf, network->rsn_ie, network->rsn_ie_len); iwe.cmd = IWEVGENIE; iwe.u.data.length = network->rsn_ie_len; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) start = iwe_stream_add_point(info, start, stop, &iwe, buf); -#else - start = iwe_stream_add_point(start, stop, &iwe, buf); -#endif } #endif @@ -347,11 +254,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, " Last beacon: %lums ago", (jiffies - network->last_scanned) / (HZ / 100)); iwe.u.data.length = p - custom; if (iwe.u.data.length) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) start = iwe_stream_add_point(info, start, stop, &iwe, custom); -#else - start = iwe_stream_add_point(start, stop, &iwe, custom); -#endif return start; } @@ -486,11 +389,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, request_module("ieee80211_crypt_wep"); new_crypt->ops = ieee80211_get_crypto_ops("WEP"); } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) -#else - if (new_crypt->ops && try_inc_mod_count(new_crypt->ops->owner)) -#endif new_crypt->priv = new_crypt->ops->init(key); if (!new_crypt->ops || !new_crypt->priv) { @@ -611,15 +510,6 @@ int ieee80211_wx_get_encode(struct ieee80211_device *ieee, erq->flags |= IW_ENCODE_DISABLED; return 0; } -#if 0 - if (strcmp(crypt->ops->name, "WEP") != 0) { - /* only WEP is supported with wireless extensions, so just - * report that encryption is used */ - erq->length = 0; - erq->flags |= IW_ENCODE_ENABLED; - return 0; - } -#endif len = crypt->ops->get_key(keybuf, SCM_KEY_LEN, NULL, crypt->priv); erq->length = (len >= 0 ? len : 0); @@ -638,7 +528,6 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, union iwreq_data *wrqu, char *extra) { int ret = 0; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) struct net_device *dev = ieee->dev; struct iw_point *encoding = &wrqu->encoding; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; @@ -702,12 +591,6 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, sec.enabled = 1; // sec.encrypt = 1; -#if 0 - if (group_key ? !ieee->host_mc_decrypt : - !(ieee->host_encrypt || ieee->host_decrypt || - ieee->host_encrypt_msdu)) - goto skip_host_crypt; -#endif switch (ext->alg) { case IW_ENCODE_ALG_WEP: alg = "WEP"; @@ -747,12 +630,7 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, ieee80211_crypt_delayed_deinit(ieee, crypt); -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)) new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); -#else - new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL); - memset(new_crypt,0,sizeof(*new_crypt)); -#endif if (new_crypt == NULL) { ret = -ENOMEM; goto done; @@ -777,7 +655,6 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, ret = -EINVAL; goto done; } -#if 1 //skip_host_crypt: //printk("skip_host_crypt:ext_flags:%x\n", ext->ext_flags); if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { @@ -807,7 +684,6 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, if (group_key) sec.flags &= ~SEC_LEVEL; } -#endif done: if (ieee->set_security) ieee->set_security(ieee->dev, &sec); @@ -818,7 +694,6 @@ done: IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name); return -EINVAL; } -#endif return ret; } @@ -881,7 +756,6 @@ int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) struct iw_mlme *mlme = (struct iw_mlme *) extra; switch (mlme->cmd) { case IW_MLME_DEAUTH: @@ -891,7 +765,6 @@ int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, default: return -EOPNOTSUPP; } -#endif return 0; } @@ -899,7 +772,6 @@ int ieee80211_wx_set_auth(struct ieee80211_device *ieee, struct iw_request_info *info, struct iw_param *data, char *extra) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) switch (data->flags & IW_AUTH_INDEX) { case IW_AUTH_WPA_VERSION: /*need to support wpa2 here*/ @@ -941,13 +813,11 @@ int ieee80211_wx_set_auth(struct ieee80211_device *ieee, //printk("open_wep:%d\n", ieee->open_wep); break; -#if 1 case IW_AUTH_WPA_ENABLED: ieee->wpa_enabled = (data->value)?1:0; //printk("enalbe wpa:%d\n", ieee->wpa_enabled); break; -#endif case IW_AUTH_RX_UNENCRYPTED_EAPOL: ieee->ieee802_1x = data->value; break; @@ -957,23 +827,11 @@ int ieee80211_wx_set_auth(struct ieee80211_device *ieee, default: return -EOPNOTSUPP; } -#endif return 0; } #endif -#if 1 int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -#if 0 - printk("====>%s()\n", __FUNCTION__); - { - int i; - for (i=0; iMAX_WPA_IE_LEN || (len && ie == NULL)) @@ -1004,13 +862,10 @@ int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len) ieee->wpa_ie = NULL; ieee->wpa_ie_len = 0; } -#endif return 0; } -#endif -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) EXPORT_SYMBOL(ieee80211_wx_set_gen_ie); #if (WIRELESS_EXT >= 18) EXPORT_SYMBOL(ieee80211_wx_set_mlme); @@ -1021,12 +876,3 @@ EXPORT_SYMBOL(ieee80211_wx_get_encode_ext); EXPORT_SYMBOL(ieee80211_wx_get_scan); EXPORT_SYMBOL(ieee80211_wx_set_encode); EXPORT_SYMBOL(ieee80211_wx_get_encode); -#else -EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_gen_ie); -//EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_mlme); -//EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_auth); -//EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_encode_ext); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_scan); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_encode); -EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_encode); -#endif diff --git a/drivers/staging/rtl8192u/ieee80211/internal.h b/drivers/staging/rtl8192u/ieee80211/internal.h index ddc22350d006..a7c096eb269f 100644 --- a/drivers/staging/rtl8192u/ieee80211/internal.h +++ b/drivers/staging/rtl8192u/ieee80211/internal.h @@ -22,22 +22,6 @@ #include #include -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20)) -#define list_for_each_entry(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - prefetch(pos->member.next); \ - &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member), \ - prefetch(pos->member.next)) - -static inline void cond_resched(void) -{ - if (need_resched()) { - set_current_state(TASK_RUNNING); - schedule(); - } -} -#endif extern enum km_type crypto_km_types[]; diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c index 98b3bb6b6d69..26af43bb8390 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c @@ -174,48 +174,6 @@ static struct sk_buff* ieee80211_ADDBA(struct ieee80211_device* ieee, u8* Dst, P //return NULL; } -#if 0 //I try to merge ADDBA_REQ and ADDBA_RSP frames together.. -/******************************************************************************************************************** - *function: construct ADDBAREQ frame - * input: u8* dst //ADDBARsp frame's destination - * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA_RSP. - * u16 StatusCode //status code. - * output: none - * return: sk_buff* skb //return constructed skb to xmit -********************************************************************************************************************/ -static struct sk_buff* ieee80211_ADDBA_Rsp( IN struct ieee80211_device* ieee, u8* dst, PBA_RECORD pBA, u16 StatusCode) -{ - OCTET_STRING osADDBAFrame, tmp; - - FillOctetString(osADDBAFrame, Buffer, 0); - *pLength = 0; - - ConstructMaFrameHdr( - Adapter, - Addr, - ACT_CAT_BA, - ACT_ADDBARSP, - &osADDBAFrame ); - - // Dialog Token - FillOctetString(tmp, &pBA->DialogToken, 1); - PacketAppendData(&osADDBAFrame, tmp); - - // Status Code - FillOctetString(tmp, &StatusCode, 2); - PacketAppendData(&osADDBAFrame, tmp); - - // BA Parameter Set - FillOctetString(tmp, &pBA->BaParamSet, 2); - PacketAppendData(&osADDBAFrame, tmp); - - // BA Timeout Value - FillOctetString(tmp, &pBA->BaTimeoutValue, 2); - PacketAppendData(&osADDBAFrame, tmp); - - *pLength = osADDBAFrame.Length; -} -#endif /******************************************************************************************************************** *function: construct DELBA frame diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c index 7c0e489b6c71..2c4eb38c89a8 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c @@ -348,11 +348,6 @@ bool IsHTHalfNmodeAPs(struct ieee80211_device* ieee) { bool retValue = false; struct ieee80211_network* net = &ieee->current_network; -#if 0 - if(pMgntInfo->bHalfNMode == false) - retValue = false; - else -#endif if((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3)==0) || (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3)==0) || (memcmp(net->bssid, PCI_RALINK, 3)==0) || @@ -421,24 +416,6 @@ void HTIOTPeerDetermine(struct ieee80211_device* ieee) u8 HTIOTActIsDisableMCS14(struct ieee80211_device* ieee, u8* PeerMacAddr) { u8 ret = 0; -#if 0 - // Apply for 819u only -#if (HAL_CODE_BASE==RTL8192 && DEV_BUS_TYPE==USB_INTERFACE) - if((memcmp(PeerMacAddr, UNKNOWN_BORADCOM, 3)==0) || - (memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0) - ) - { - ret = 1; - } - - - if(pHTInfo->bCurrentRT2RTAggregation) - { - // The parameter of pHTInfo->bCurrentRT2RTAggregation must be decided previously - ret = 1; - } -#endif -#endif return ret; } @@ -498,21 +475,6 @@ bool HTIOTActIsDisableMCSTwoSpatialStream(struct ieee80211_device* ieee, u8 *Pee #ifdef TODO // Apply for 819u only -//#if (HAL_CODE_BASE==RTL8192) - - //This rule only apply to Belkin(Ralink) AP - if(IS_UNDER_11N_AES_MODE(Adapter)) - { - if((PlatformCompareMemory(PeerMacAddr, BELKINF5D8233V1_RALINK, 3)==0) || - (PlatformCompareMemory(PeerMacAddr, PCI_RALINK, 3)==0) || - (PlatformCompareMemory(PeerMacAddr, EDIMAX_RALINK, 3)==0)) - { - //Set True to disable this function. Disable by default, Emily, 2008.04.23 - retValue = false; - } - } - -//#endif #endif return retValue; } @@ -530,18 +492,6 @@ u8 HTIOTActIsDisableEDCATurbo(struct ieee80211_device* ieee, u8* PeerMacAddr) // Set specific EDCA parameter for different AP in DM handler. return retValue; -#if 0 - if((memcmp(PeerMacAddr, UNKNOWN_BORADCOM, 3)==0)|| - (memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)|| - (memcmp(PeerMacAddr, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)==0)|| - (memcmp(PeerMacAddr, NETGEAR834Bv2_BROADCOM, 3)==0)) - - { - retValue = 1; //Linksys disable EDCA turbo mode - } - - return retValue; -#endif } /******************************************************************************************************************** @@ -809,7 +759,7 @@ void HTConstructRT2RTAggElement(struct ieee80211_device* ieee, u8* posRT2RTAgg, *len = 6 + 2; return; #ifdef TODO -#if(HAL_CODE_BASE == RTL8192 && DEV_BUS_TYPE == USB_INTERFACE) +#if (HAL_CODE_BASE == RTL8192 && DEV_BUS_TYPE == USB_INTERFACE) /* //Emily. If it is required to Ask Realtek AP to send AMPDU during AES mode, enable this section of code. @@ -988,17 +938,6 @@ u8 HTFilterMCSRate( struct ieee80211_device* ieee, u8* pSupportMCS, u8* pOperate return true; } void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset); -#if 0 -//I need move this function to other places, such as rx? -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -void HTOnAssocRsp_wq(struct work_struct *work) -{ - struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, ht_onAssRsp); -#else -void HTOnAssocRsp_wq(struct ieee80211_device *ieee) -{ -#endif -#endif void HTOnAssocRsp(struct ieee80211_device *ieee) { PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; @@ -1100,10 +1039,6 @@ void HTOnAssocRsp(struct ieee80211_device *ieee) { // Set MPDU density to 2 to Realtek AP, and set it to 0 for others // Replace MPDU factor declared in original association response frame format. 2007.08.20 by Emily -#if 0 - osTmp= PacketGetElement( asocpdu, EID_Vendor, OUI_SUB_REALTEK_AGG, OUI_SUBTYPE_DONT_CARE); - if(osTmp.Length >= 5) //00:e0:4c:02:00 -#endif if (ieee->current_network.bssht.bdRT2RTAggregation) { if( ieee->pairwise_key_type != KEY_TYPE_NA) @@ -1122,19 +1057,12 @@ void HTOnAssocRsp(struct ieee80211_device *ieee) // <2> Set AMPDU Minimum MPDU Start Spacing // 802.11n 3.0 section 9.7d.3 -#if 1 if(pHTInfo->MPDU_Density > pPeerHTCap->MPDUDensity) pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density; else pHTInfo->CurrentMPDUDensity = pPeerHTCap->MPDUDensity; if(ieee->pairwise_key_type != KEY_TYPE_NA ) pHTInfo->CurrentMPDUDensity = 7; // 8us -#else - if(pHTInfo->MPDU_Density > pPeerHTCap->MPDUDensity) - pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density; - else - pHTInfo->CurrentMPDUDensity = pPeerHTCap->MPDUDensity; -#endif // Force TX AMSDU // Lanhsin: mark for tmp to avoid deauth by ap from s3 @@ -1278,187 +1206,6 @@ void HTInitializeBssDesc(PBSS_HT pBssHT) pBssHT->bdRT2RTAggregation = false; pBssHT->bdRT2RTLongSlotTime = false; } -#if 0 -//below function has merged into ieee80211_network_init() in ieee80211_rx.c -void -HTParsingHTCapElement( - IN PADAPTER Adapter, - IN OCTET_STRING HTCapIE, - OUT PRT_WLAN_BSS pBssDesc -) -{ - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - - if( HTCapIE.Length > sizeof(pBssDesc->BssHT.bdHTCapBuf) ) - { - RT_TRACE( COMP_HT, DBG_LOUD, ("HTParsingHTCapElement(): HT Capability Element length is too long!\n") ); - return; - } - - // TODO: Check the correctness of HT Cap - //Print each field in detail. Driver should not print out this message by default - if(!pMgntInfo->mActingAsAp && !pMgntInfo->mAssoc) - HTDebugHTCapability(DBG_TRACE, Adapter, &HTCapIE, (pu8)"HTParsingHTCapElement()"); - - HTCapIE.Length = HTCapIE.Length > sizeof(pBssDesc->BssHT.bdHTCapBuf)?\ - sizeof(pBssDesc->BssHT.bdHTCapBuf):HTCapIE.Length; //prevent from overflow - - CopyMem(pBssDesc->BssHT.bdHTCapBuf, HTCapIE.Octet, HTCapIE.Length); - pBssDesc->BssHT.bdHTCapLen = HTCapIE.Length; - -} - - -void -HTParsingHTInfoElement( - PADAPTER Adapter, - OCTET_STRING HTInfoIE, - PRT_WLAN_BSS pBssDesc -) -{ - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - - if( HTInfoIE.Length > sizeof(pBssDesc->BssHT.bdHTInfoBuf)) - { - RT_TRACE( COMP_HT, DBG_LOUD, ("HTParsingHTInfoElement(): HT Information Element length is too long!\n") ); - return; - } - - // TODO: Check the correctness of HT Info - //Print each field in detail. Driver should not print out this message by default - if(!pMgntInfo->mActingAsAp && !pMgntInfo->mAssoc) - HTDebugHTInfo(DBG_TRACE, Adapter, &HTInfoIE, (pu8)"HTParsingHTInfoElement()"); - - HTInfoIE.Length = HTInfoIE.Length > sizeof(pBssDesc->BssHT.bdHTInfoBuf)?\ - sizeof(pBssDesc->BssHT.bdHTInfoBuf):HTInfoIE.Length; //prevent from overflow - - CopyMem( pBssDesc->BssHT.bdHTInfoBuf, HTInfoIE.Octet, HTInfoIE.Length); - pBssDesc->BssHT.bdHTInfoLen = HTInfoIE.Length; -} - -/* - * Get HT related information from beacon and save it in BssDesc - * - * (1) Parse HTCap, and HTInfo, and record whether it is 11n AP - * (2) If peer is HT, but not WMM, call QosSetLegacyWMMParamWithHT() - * (3) Check whether peer is Realtek AP (for Realtek proprietary aggregation mode). - * Input: - * PADAPTER Adapter - * - * Output: - * PRT_TCB BssDesc - * -*/ -void HTGetValueFromBeaconOrProbeRsp( - PADAPTER Adapter, - POCTET_STRING pSRCmmpdu, - PRT_WLAN_BSS bssDesc -) -{ - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - PRT_HIGH_THROUGHPUT pHTInfo = GET_HT_INFO(pMgntInfo); - OCTET_STRING HTCapIE, HTInfoIE, HTRealtekAgg, mmpdu; - OCTET_STRING BroadcomElement, CiscoElement; - - mmpdu.Octet = pSRCmmpdu->Octet; - mmpdu.Length = pSRCmmpdu->Length; - - //2Note: - // Mark for IOT testing using Linksys WRT350N, This AP does not contain WMM IE when - // it is configured at pure-N mode. - // if(bssDesc->BssQos.bdQoSMode & QOS_WMM) - // - - HTInitializeBssDesc (&bssDesc->BssHT); - - //2<1> Parse HTCap, and HTInfo - // Get HT Capability IE: (1) Get IEEE Draft N IE or (2) Get EWC IE - HTCapIE = PacketGetElement(mmpdu, EID_HTCapability, OUI_SUB_DONT_CARE, OUI_SUBTYPE_DONT_CARE); - if(HTCapIE.Length == 0) - { - HTCapIE = PacketGetElement(mmpdu, EID_Vendor, OUI_SUB_11N_EWC_HT_CAP, OUI_SUBTYPE_DONT_CARE); - if(HTCapIE.Length != 0) - bssDesc->BssHT.bdHTSpecVer= HT_SPEC_VER_EWC; - } - if(HTCapIE.Length != 0) - HTParsingHTCapElement(Adapter, HTCapIE, bssDesc); - - // Get HT Information IE: (1) Get IEEE Draft N IE or (2) Get EWC IE - HTInfoIE = PacketGetElement(mmpdu, EID_HTInfo, OUI_SUB_DONT_CARE, OUI_SUBTYPE_DONT_CARE); - if(HTInfoIE.Length == 0) - { - HTInfoIE = PacketGetElement(mmpdu, EID_Vendor, OUI_SUB_11N_EWC_HT_INFO, OUI_SUBTYPE_DONT_CARE); - if(HTInfoIE.Length != 0) - bssDesc->BssHT.bdHTSpecVer = HT_SPEC_VER_EWC; - } - if(HTInfoIE.Length != 0) - HTParsingHTInfoElement(Adapter, HTInfoIE, bssDesc); - - //2<2>If peer is HT, but not WMM, call QosSetLegacyWMMParamWithHT() - if(HTCapIE.Length != 0) - { - bssDesc->BssHT.bdSupportHT = true; - if(bssDesc->BssQos.bdQoSMode == QOS_DISABLE) - QosSetLegacyWMMParamWithHT(Adapter, bssDesc); - } - else - { - bssDesc->BssHT.bdSupportHT = false; - } - - //2<3>Check whether the peer is Realtek AP/STA - if(pHTInfo->bRegRT2RTAggregation) - { - if(bssDesc->BssHT.bdSupportHT) - { - HTRealtekAgg = PacketGetElement(mmpdu, EID_Vendor, OUI_SUB_REALTEK_AGG, OUI_SUBTYPE_DONT_CARE); - if(HTRealtekAgg.Length >=5 ) - { - bssDesc->BssHT.bdRT2RTAggregation = true; - - if((HTRealtekAgg.Octet[4]==1) && (HTRealtekAgg.Octet[5] & 0x02)) - bssDesc->BssHT.bdRT2RTLongSlotTime = true; - } - } - } - - // - // 2008/01/25 MH Get Broadcom AP IE for manamgent frame CCK rate problem. - // AP can not receive CCK managemtn from from 92E. - // - - // Initialize every new bss broadcom cap exist as false.. - bssDesc->bBroadcomCapExist= false; - - if(HTCapIE.Length != 0 || HTInfoIE.Length != 0) - { - u4Byte Length = 0; - - FillOctetString(BroadcomElement, NULL, 0); - - BroadcomElement = PacketGetElement( mmpdu, EID_Vendor, OUI_SUB_BROADCOM_IE_1, OUI_SUBTYPE_DONT_CARE); - Length += BroadcomElement.Length; - BroadcomElement = PacketGetElement( mmpdu, EID_Vendor, OUI_SUB_BROADCOM_IE_2, OUI_SUBTYPE_DONT_CARE); - Length += BroadcomElement.Length; - BroadcomElement = PacketGetElement( mmpdu, EID_Vendor, OUI_SUB_BROADCOM_IE_3, OUI_SUBTYPE_DONT_CARE); - Length += BroadcomElement.Length; - - if(Length > 0) - bssDesc->bBroadcomCapExist = true; - } - - - // For Cisco IOT issue - CiscoElement = PacketGetElement( mmpdu, EID_Vendor, OUI_SUB_CISCO_IE, OUI_SUBTYPE_DONT_CARE); - if(CiscoElement.Length != 0){ // 3: 0x00, 0x40, 0x96 .... - bssDesc->bCiscoCapExist = true; - }else{ - bssDesc->bCiscoCapExist = false; - } -} - - -#endif /******************************************************************************************************************** *function: initialize Bss HT structure(struct PBSS_HT) * input: struct ieee80211_device *ieee @@ -1712,8 +1459,4 @@ void HTSetConnectBwModeCallback(struct ieee80211_device* ieee) pHTInfo->bSwBwInProgress = false; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -EXPORT_SYMBOL_NOVERS(HTUpdateSelfAndPeerSetting); -#else EXPORT_SYMBOL(HTUpdateSelfAndPeerSetting); -#endif diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h index 7ecfe68ddd58..13b1e5ca436d 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h @@ -70,147 +70,6 @@ typedef enum _ACK_POLICY{ }ACK_POLICY,*PACK_POLICY; #define WMM_PARAM_ELEMENT_SIZE (8+(4*AC_PARAM_SIZE)) -#if 0 -#define GET_QOS_CTRL(_pStart) ReadEF2Byte((u8 *)(_pStart) + 24) -#define SET_QOS_CTRL(_pStart, _value) WriteEF2Byte((u8 *)(_pStart) + 24, _value) - -// WMM control field. -#define GET_QOS_CTRL_WMM_UP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 0, 3)) -#define SET_QOS_CTRL_WMM_UP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 0, 3, (u8)(_value)) - -#define GET_QOS_CTRL_WMM_EOSP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 4, 1)) -#define SET_QOS_CTRL_WMM_EOSP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 4, 1, (u8)(_value)) - -#define GET_QOS_CTRL_WMM_ACK_POLICY(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 5, 2)) -#define SET_QOS_CTRL_WMM_ACK_POLICY(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 5, 2, (u8)(_value)) - -// 802.11e control field (by STA, data) -#define GET_QOS_CTRL_STA_DATA_TID(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 0, 4)) -#define SET_QOS_CTRL_STA_DATA_TID(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 0, 4, (u8)(_value)) - -#define GET_QOS_CTRL_STA_DATA_QSIZE_FLAG(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 4, 1)) -#define SET_QOS_CTRL_STA_DATA_QSIZE_FLAG(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 4, 1, (u8)(_value)) - -#define GET_QOS_CTRL_STA_DATA_ACK_POLICY(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 5, 2)) -#define SET_QOS_CTRL_STA_DATA_ACK_POLICY(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 5, 2, (u8)(_value)) - -#define GET_QOS_CTRL_STA_DATA_TXOP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 8, 8)) -#define SET_QOS_CTRL_STA_DATA_TXOP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 8, 8, (u8)(_value)) - -#define GET_QOS_CTRL_STA_DATA_QSIZE(_pStart) GET_QOS_CTRL_STA_DATA_TXOP(_pStart) -#define SET_QOS_CTRL_STA_DATA_QSIZE(_pStart, _value) SET_QOS_CTRL_STA_DATA_TXOP(_pStart) - -// 802.11e control field (by HC, data) -#define GET_QOS_CTRL_HC_DATA_TID(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 0, 4)) -#define SET_QOS_CTRL_HC_DATA_TID(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 0, 4, (u8)(_value)) - -#define GET_QOS_CTRL_HC_DATA_EOSP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 4, 1)) -#define SET_QOS_CTRL_HC_DATA_EOSP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 4, 1, (u8)(_value)) - -#define GET_QOS_CTRL_HC_DATA_ACK_POLICY(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 5, 2)) -#define SET_QOS_CTRL_HC_DATA_ACK_POLICY(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 5, 2, (u8)(_value)) - -#define GET_QOS_CTRL_HC_DATA_PS_BUFSTATE(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 8, 8)) -#define SET_QOS_CTRL_HC_DATA_PS_BUFSTATE(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 8, 8, (u8)(_value)) - -// 802.11e control field (by HC, CFP) -#define GET_QOS_CTRL_HC_CFP_TID(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 0, 4)) -#define SET_QOS_CTRL_HC_CFP_TID(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 0, 4, (u8)(_value)) - -#define GET_QOS_CTRL_HC_CFP_EOSP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 4, 1)) -#define SET_QOS_CTRL_HC_CFP_EOSP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 4, 1, (u8)(_value)) - -#define GET_QOS_CTRL_HC_CFP_ACK_POLICY(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 5, 2)) -#define SET_QOS_CTRL_HC_CFP_ACK_POLICY(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 5, 2, (u8)(_value)) - -#define GET_QOS_CTRL_HC_CFP_TXOP_LIMIT(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 8, 8)) -#define SET_QOS_CTRL_HC_CFP_TXOP_LIMIT(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 8, 8, (u8)(_value)) - -#define SET_WMM_QOS_INFO_FIELD(_pStart, _val) WriteEF1Byte(_pStart, _val) - -#define GET_WMM_QOS_INFO_FIELD_PARAMETERSET_COUNT(_pStart) LE_BITS_TO_1BYTE(_pStart, 0, 4) -#define SET_WMM_QOS_INFO_FIELD_PARAMETERSET_COUNT(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 0, 4, _val) - -#define GET_WMM_QOS_INFO_FIELD_AP_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 7, 1) -#define SET_WMM_QOS_INFO_FIELD_AP_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 7, 1, _val) - -#define GET_WMM_QOS_INFO_FIELD_STA_AC_VO_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 0, 1) -#define SET_WMM_QOS_INFO_FIELD_STA_AC_VO_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 0, 1, _val) - -#define GET_WMM_QOS_INFO_FIELD_STA_AC_VI_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 1, 1) -#define SET_WMM_QOS_INFO_FIELD_STA_AC_VI_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 1, 1, _val) - -#define GET_WMM_QOS_INFO_FIELD_STA_AC_BE_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 2, 1) -#define SET_WMM_QOS_INFO_FIELD_STA_AC_BE_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 2, 1, _val) - -#define GET_WMM_QOS_INFO_FIELD_STA_AC_BK_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 3, 1) -#define SET_WMM_QOS_INFO_FIELD_STA_AC_BK_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 3, 1, _val) - -#define GET_WMM_QOS_INFO_FIELD_STA_MAX_SP_LEN(_pStart) LE_BITS_TO_1BYTE(_pStart, 5, 2) -#define SET_WMM_QOS_INFO_FIELD_STA_MAX_SP_LEN(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 5, 2, _val) - - -#define WMM_INFO_ELEMENT_SIZE 7 - -#define GET_WMM_INFO_ELE_OUI(_pStart) ((u8 *)(_pStart)) -#define SET_WMM_INFO_ELE_OUI(_pStart, _pVal) PlatformMoveMemory(_pStart, _pVal, 3); - -#define GET_WMM_INFO_ELE_OUI_TYPE(_pStart) ( EF1Byte( *((u8 *)(_pStart)+3) ) ) -#define SET_WMM_INFO_ELE_OUI_TYPE(_pStart, _val) ( *((u8 *)(_pStart)+3) = EF1Byte(_val) ) - -#define GET_WMM_INFO_ELE_OUI_SUBTYPE(_pStart) ( EF1Byte( *((u8 *)(_pStart)+4) ) ) -#define SET_WMM_INFO_ELE_OUI_SUBTYPE(_pStart, _val) ( *((u8 *)(_pStart)+4) = EF1Byte(_val) ) - -#define GET_WMM_INFO_ELE_VERSION(_pStart) ( EF1Byte( *((u8 *)(_pStart)+5) ) ) -#define SET_WMM_INFO_ELE_VERSION(_pStart, _val) ( *((u8 *)(_pStart)+5) = EF1Byte(_val) ) - -#define GET_WMM_INFO_ELE_QOS_INFO_FIELD(_pStart) ( EF1Byte( *((u8 *)(_pStart)+6) ) ) -#define SET_WMM_INFO_ELE_QOS_INFO_FIELD(_pStart, _val) ( *((u8 *)(_pStart)+6) = EF1Byte(_val) ) - - - -#define GET_WMM_AC_PARAM_AIFSN(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 0, 4) ) -#define SET_WMM_AC_PARAM_AIFSN(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 0, 4, _val) - -#define GET_WMM_AC_PARAM_ACM(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 4, 1) ) -#define SET_WMM_AC_PARAM_ACM(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 4, 1, _val) - -#define GET_WMM_AC_PARAM_ACI(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 5, 2) ) -#define SET_WMM_AC_PARAM_ACI(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 5, 2, _val) - -#define GET_WMM_AC_PARAM_ACI_AIFSN(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 0, 8) ) -#define SET_WMM_AC_PARAM_ACI_AIFSN(_pStart, _val) SET_BTIS_TO_LE_4BYTE(_pStart, 0, 8, _val) - -#define GET_WMM_AC_PARAM_ECWMIN(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 8, 4) ) -#define SET_WMM_AC_PARAM_ECWMIN(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 8, 4, _val) - -#define GET_WMM_AC_PARAM_ECWMAX(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 12, 4) ) -#define SET_WMM_AC_PARAM_ECWMAX(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 12, 4, _val) - -#define GET_WMM_AC_PARAM_TXOP_LIMIT(_pStart) ( (u16)LE_BITS_TO_4BYTE(_pStart, 16, 16) ) -#define SET_WMM_AC_PARAM_TXOP_LIMIT(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 16, 16, _val) - - - - -#define GET_WMM_PARAM_ELE_OUI(_pStart) ((u8 *)(_pStart)) -#define SET_WMM_PARAM_ELE_OUI(_pStart, _pVal) PlatformMoveMemory(_pStart, _pVal, 3) - -#define GET_WMM_PARAM_ELE_OUI_TYPE(_pStart) ( EF1Byte( *((u8 *)(_pStart)+3) ) ) -#define SET_WMM_PARAM_ELE_OUI_TYPE(_pStart, _val) ( *((u8 *)(_pStart)+3) = EF1Byte(_val) ) - -#define GET_WMM_PARAM_ELE_OUI_SUBTYPE(_pStart) ( EF1Byte( *((u8 *)(_pStart)+4) ) ) -#define SET_WMM_PARAM_ELE_OUI_SUBTYPE(_pStart, _val) ( *((u8 *)(_pStart)+4) = EF1Byte(_val) ) - -#define GET_WMM_PARAM_ELE_VERSION(_pStart) ( EF1Byte( *((u8 *)(_pStart)+5) ) ) -#define SET_WMM_PARAM_ELE_VERSION(_pStart, _val) ( *((u8 *)(_pStart)+5) = EF1Byte(_val) ) - -#define GET_WMM_PARAM_ELE_QOS_INFO_FIELD(_pStart) ( EF1Byte( *((u8 *)(_pStart)+6) ) ) -#define SET_WMM_PARAM_ELE_QOS_INFO_FIELD(_pStart, _val) ( *((u8 *)(_pStart)+6) = EF1Byte(_val) ) - -#define GET_WMM_PARAM_ELE_AC_PARAM(_pStart) ( (u8 *)(_pStart)+8 ) -#define SET_WMM_PARAM_ELE_AC_PARAM(_pStart, _pVal) PlatformMoveMemory((_pStart)+8, _pVal, 16) -#endif // // QoS Control Field @@ -361,21 +220,6 @@ typedef union _QOS_INFO_FIELD{ }QOS_INFO_FIELD, *PQOS_INFO_FIELD; -#if 0 -// -// WMM Information Element -// Ref: WMM spec 2.2.1: WME Information Element, p.10. -// -typedef struct _WMM_INFO_ELEMENT{ -// u8 ElementID; -// u8 Length; - u8 OUI[3]; - u8 OUI_Type; - u8 OUI_SubType; - u8 Version; - QOS_INFO_FIELD QosInfo; -}WMM_INFO_ELEMENT, *PWMM_INFO_ELEMENT; -#endif // // ACI to AC coding. @@ -650,16 +494,6 @@ typedef struct _OCTET_STRING{ u8 *Octet; u16 Length; }OCTET_STRING, *POCTET_STRING; -#if 0 -#define FillOctetString(_os,_octet,_len) \ - (_os).Octet=(u8 *)(_octet); \ - (_os).Length=(_len); - -#define WMM_ELEM_HDR_LEN 6 -#define WMMElemSkipHdr(_osWMMElem) \ - (_osWMMElem).Octet += WMM_ELEM_HDR_LEN; \ - (_osWMMElem).Length -= WMM_ELEM_HDR_LEN; -#endif // // STA QoS data. // Ref: DOT11_QOS in 8185 code. [def. in QoS_mp.h] diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c index ecf24b9edb1f..5373d565af24 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c @@ -2,13 +2,6 @@ #include #include "rtl819x_TS.h" -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -#define list_for_each_entry_safe(pos, n, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) -#endif void TsSetupTimeOut(unsigned long data) { // Not implement yet @@ -28,7 +21,6 @@ void TsInactTimeout(unsigned long data) * return: NULL * notice: ********************************************************************************************************************/ -#if 1 void RxPktPendingTimeout(unsigned long data) { PRX_TS_RECORD pRxTs = (PRX_TS_RECORD)data; @@ -102,7 +94,6 @@ void RxPktPendingTimeout(unsigned long data) spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); //PlatformReleaseSpinLock(Adapter, RT_RX_SPINLOCK); } -#endif /******************************************************************************************************************** *function: Add BA timer function @@ -366,17 +357,10 @@ bool GetTs( IEEE80211_DEBUG(IEEE80211_DL_ERR, "get TS for Broadcast or Multicast\n"); return false; } -#if 0 - if(ieee->pStaQos->CurrentQosMode == QOS_DISABLE) - { UP = 0; } //only use one TS - else if(ieee->pStaQos->CurrentQosMode & QOS_WMM) - { -#else if (ieee->current_network.qos_data.supported == 0) UP = 0; else { -#endif // In WMM case: we use 4 TID only if (!IsACValid(TID)) { @@ -548,7 +532,6 @@ void RemovePeerTS(struct ieee80211_device* ieee, u8* Addr) { PTS_COMMON_INFO pTS, pTmpTS; printk("===========>RemovePeerTS,"MAC_FMT"\n", MAC_ARG(Addr)); -#if 1 list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Pending_List, List) { if (memcmp(pTS->Addr, Addr, 6) == 0) @@ -589,13 +572,11 @@ void RemovePeerTS(struct ieee80211_device* ieee, u8* Addr) list_add_tail(&pTS->List, &ieee->Rx_TS_Unused_List); } } -#endif } void RemoveAllTS(struct ieee80211_device* ieee) { PTS_COMMON_INFO pTS, pTmpTS; -#if 1 list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Pending_List, List) { RemoveTsEntry(ieee, pTS, TX_DIR); @@ -623,7 +604,6 @@ void RemoveAllTS(struct ieee80211_device* ieee) list_del_init(&pTS->List); list_add_tail(&pTS->List, &ieee->Rx_TS_Unused_List); } -#endif } void TsStartAddBaProcess(struct ieee80211_device* ieee, PTX_TS_RECORD pTxTS) @@ -631,7 +611,6 @@ void TsStartAddBaProcess(struct ieee80211_device* ieee, PTX_TS_RECORD pTxTS) if(pTxTS->bAddBaReqInProgress == false) { pTxTS->bAddBaReqInProgress = true; -#if 1 if(pTxTS->bAddBaReqDelayed) { IEEE80211_DEBUG(IEEE80211_DL_BA, "TsStartAddBaProcess(): Delayed Start ADDBA after 60 sec!!\n"); @@ -642,13 +621,8 @@ void TsStartAddBaProcess(struct ieee80211_device* ieee, PTX_TS_RECORD pTxTS) IEEE80211_DEBUG(IEEE80211_DL_BA,"TsStartAddBaProcess(): Immediately Start ADDBA now!!\n"); mod_timer(&pTxTS->TsAddBaTimer, jiffies+10); //set 10 ticks } -#endif } else IEEE80211_DEBUG(IEEE80211_DL_ERR, "%s()==>BA timer is already added\n", __FUNCTION__); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -EXPORT_SYMBOL_NOVERS(RemovePeerTS); -#else EXPORT_SYMBOL(RemovePeerTS); -#endif diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index 8f62f45517c8..69a2721e850c 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -39,9 +39,6 @@ #include #include #include -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) -#include -#endif #include "ieee80211.h" #define RTL8192U @@ -87,11 +84,6 @@ // Rx smooth factor #define Rx_Smooth_Factor 20 -#if 0 //we need to use RT_TRACE instead DMESG as RT_TRACE will clearly show debug level wb. -#define DMESG(x,a...) printk(KERN_INFO RTL819xU_MODULE_NAME ": " x "\n", ## a) -#define DMESGW(x,a...) printk(KERN_WARNING RTL819xU_MODULE_NAME ": WW:" x "\n", ## a) -#define DMESGE(x,a...) printk(KERN_WARNING RTL819xU_MODULE_NAME ": EE:" x "\n", ## a) -#else #define DMESG(x,a...) #define DMESGW(x,a...) #define DMESGE(x,a...) @@ -141,7 +133,6 @@ do { if(rt_global_debug_component & component) \ #define COMP_DOWN BIT29 //for rm driver module #define COMP_RESET BIT30 //for silent reset #define COMP_ERR BIT31 //for error out, always on -#endif #define RTL819x_DEBUG #ifdef RTL819x_DEBUG @@ -596,16 +587,6 @@ typedef struct rtl_reg_debug{ -#if 0 - -typedef struct tx_pendingbuf -{ - struct ieee80211_txb *txb; - short ispending; - short descfrag; -} tx_pendigbuf; - -#endif typedef struct _rt_9x_tx_rate_history { u32 cck[4]; @@ -933,11 +914,7 @@ typedef struct r8192_priv spinlock_t irq_lock; // spinlock_t irq_th_lock; spinlock_t tx_lock; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)) - struct semaphore mutex; -#else struct mutex mutex; -#endif //spinlock_t rf_lock; //used to lock rf write operation added by wb u16 irq_mask; @@ -1007,11 +984,7 @@ typedef struct r8192_priv /* modified by davad for Rx process */ struct sk_buff_head rx_queue; struct sk_buff_head skb_queue; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - struct tq_struct qos_activate; -#else struct work_struct qos_activate; -#endif short tx_urb_index; atomic_t tx_pending[0x10];//UART_PRIORITY+1 @@ -1041,11 +1014,7 @@ typedef struct r8192_priv u16 rts; struct ChnlAccessSetting ChannelAccessSetting; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) struct work_struct reset_wq; -#else - struct tq_struct reset_wq; -#endif /**********************************************************/ //for rtl819xUsb @@ -1194,33 +1163,14 @@ typedef struct r8192_priv u16 SifsTime; //define work item by amy 080526 -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) struct delayed_work update_beacon_wq; struct delayed_work watch_dog_wq; struct delayed_work txpower_tracking_wq; struct delayed_work rfpath_check_wq; struct delayed_work gpio_change_rf_wq; struct delayed_work initialgain_operate_wq; -#else - struct work_struct update_beacon_wq; - struct work_struct watch_dog_wq; - struct work_struct txpower_tracking_wq; - struct work_struct rfpath_check_wq; - struct work_struct gpio_change_rf_wq; - struct work_struct initialgain_operate_wq; -#endif struct workqueue_struct *priv_wq; -#else - /* used for periodly scan */ - struct tq_struct update_beacon_wq; - struct tq_struct txpower_tracking_wq; - struct tq_struct rfpath_check_wq; - struct tq_struct watch_dog_wq; - struct tq_struct gpio_change_rf_wq; - struct tq_struct initialgain_operate_wq; -#endif }r8192_priv; // for rtl8187 @@ -1259,60 +1209,6 @@ typedef enum{ } nic_t; -#if 0 //defined in Qos.h -//typedef u32 AC_CODING; -#define AC0_BE 0 // ACI: 0x00 // Best Effort -#define AC1_BK 1 // ACI: 0x01 // Background -#define AC2_VI 2 // ACI: 0x10 // Video -#define AC3_VO 3 // ACI: 0x11 // Voice -#define AC_MAX 4 // Max: define total number; Should not to be used as a real enum. - -// -// ECWmin/ECWmax field. -// Ref: WMM spec 2.2.2: WME Parameter Element, p.13. -// -typedef union _ECW{ - u8 charData; - struct - { - u8 ECWmin:4; - u8 ECWmax:4; - }f; // Field -}ECW, *PECW; - -// -// ACI/AIFSN Field. -// Ref: WMM spec 2.2.2: WME Parameter Element, p.12. -// -typedef union _ACI_AIFSN{ - u8 charData; - - struct - { - u8 AIFSN:4; - u8 ACM:1; - u8 ACI:2; - u8 Reserved:1; - }f; // Field -}ACI_AIFSN, *PACI_AIFSN; - -// -// AC Parameters Record Format. -// Ref: WMM spec 2.2.2: WME Parameter Element, p.12. -// -typedef union _AC_PARAM{ - u32 longData; - u8 charData[4]; - - struct - { - ACI_AIFSN AciAifsn; - ECW Ecw; - u16 TXOPLimit; - }f; // Field -}AC_PARAM, *PAC_PARAM; - -#endif #ifdef JOHN_HWSEC struct ssid_thread { struct net_device *dev; diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 7aa464224d10..adade13e1e19 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -71,9 +71,6 @@ double __extendsfdf2(float a) {return a;} //#include "r8192xU_phyreg.h" #include // FIXME: check if 2.6.7 is ok -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7)) -#define usb_kill_urb usb_unlink_urb -#endif #ifdef CONFIG_RTL8192_PM #include "r8192_pm.h" @@ -127,59 +124,36 @@ static struct usb_device_id rtl8192_usb_id_tbl[] = { }; MODULE_LICENSE("GPL"); -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) MODULE_VERSION("V 1.1"); -#endif MODULE_DEVICE_TABLE(usb, rtl8192_usb_id_tbl); MODULE_DESCRIPTION("Linux driver for Realtek RTL8192 USB WiFi cards"); static char* ifname = "wlan%d"; -#if 0 -static int hwseqnum = 0; -static int hwwep = 0; -#endif static int hwwep = 1; //default use hw. set 0 to use software security static int channels = 0x3fff; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9) module_param(ifname, charp, S_IRUGO|S_IWUSR ); //module_param(hwseqnum,int, S_IRUGO|S_IWUSR); module_param(hwwep,int, S_IRUGO|S_IWUSR); module_param(channels,int, S_IRUGO|S_IWUSR); -#else -MODULE_PARM(ifname, "s"); -//MODULE_PARM(hwseqnum,"i"); -MODULE_PARM(hwwep,"i"); -MODULE_PARM(channels,"i"); -#endif MODULE_PARM_DESC(ifname," Net interface name, wlan%d=default"); //MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default"); MODULE_PARM_DESC(hwwep," Try to use hardware security support. "); MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI"); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) static int __devinit rtl8192_usb_probe(struct usb_interface *intf, const struct usb_device_id *id); static void __devexit rtl8192_usb_disconnect(struct usb_interface *intf); -#else -static void *__devinit rtl8192_usb_probe(struct usb_device *udev,unsigned int ifnum, - const struct usb_device_id *id); -static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr); -#endif static struct usb_driver rtl8192_usb_driver = { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15) - .owner = THIS_MODULE, -#endif .name = RTL819xU_MODULE_NAME, /* Driver name */ .id_table = rtl8192_usb_id_tbl, /* PCI_ID table */ .probe = rtl8192_usb_probe, /* probe fn */ .disconnect = rtl8192_usb_disconnect, /* remove fn */ -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0) #ifdef CONFIG_RTL8192_PM .suspend = rtl8192_suspend, /* PM suspend fn */ .resume = rtl8192_resume, /* PM resume fn */ @@ -187,7 +161,6 @@ static struct usb_driver rtl8192_usb_driver = { .suspend = NULL, /* PM suspend fn */ .resume = NULL, /* PM resume fn */ #endif -#endif }; #ifdef ENABLE_DOT11D @@ -280,7 +253,6 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv* priv) void CamResetAllEntry(struct net_device *dev) { -#if 1 u32 ulcommand = 0; //2004/02/11 In static WEP, OID_ADD_KEY or OID_ADD_WEP are set before STA associate to AP. // However, ResetKey is called on OID_802_11_INFRASTRUCTURE_MODE and MlmeAssociateRequest @@ -293,12 +265,6 @@ void CamResetAllEntry(struct net_device *dev) //DbgPrint("========================================\n\n"); ulcommand |= BIT31|BIT30; write_nic_dword(dev, RWCAM, ulcommand); -#else - for(ucIndex=0;ucIndex= KERNEL_VERSION(2,6,20)) void rtl8192_restart(struct work_struct *work); //void rtl8192_rq_tx_ack(struct work_struct *work); -#else - void rtl8192_restart(struct net_device *dev); -// //void rtl8192_rq_tx_ack(struct net_device *dev); - #endif void watch_dog_timer_callback(unsigned long data); @@ -590,7 +551,6 @@ len += snprintf(page + len, count - len, // printk("%2x ",read_nic_byte(dev,n)); } -#if 1 len += snprintf(page + len, count - len, "\n####################page 1##################\n "); for(n=0;n<=max;) @@ -620,7 +580,6 @@ len += snprintf(page + len, count - len, // printk("%2x ",read_nic_byte(dev,n)); } -#endif len += snprintf(page + len, count - len,"\n"); *eof = 1; @@ -629,98 +588,8 @@ len += snprintf(page + len, count - len, } -#if 0 -static int proc_get_cck_reg(char *page, char **start, - off_t offset, int count, - int *eof, void *data) -{ - struct net_device *dev = data; -// struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); - - int len = 0; - int i,n; - int max = 0x5F; - /* This dump the current register page */ - for(n=0;n<=max;) - { - //printk( "\nD: %2x> ", n); - len += snprintf(page + len, count - len, - "\nD: %2x > ",n); - - for(i=0;i<16 && n<=max;i++,n++) - len += snprintf(page + len, count - len, - "%2x ",read_phy_cck(dev,n)); - - // printk("%2x ",read_nic_byte(dev,n)); - } - len += snprintf(page + len, count - len,"\n"); - - - *eof = 1; - return len; -} - -#endif - -#if 0 -static int proc_get_ofdm_reg(char *page, char **start, - off_t offset, int count, - int *eof, void *data) -{ - struct net_device *dev = data; -// struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); - - int len = 0; - int i,n; - - //int max=0xff; - int max = 0x40; - - /* This dump the current register page */ - for(n=0;n<=max;) - { - //printk( "\nD: %2x> ", n); - len += snprintf(page + len, count - len, - "\nD: %2x > ",n); - - for(i=0;i<16 && n<=max;i++,n++) - len += snprintf(page + len, count - len, - "%2x ",read_phy_ofdm(dev,n)); - - // printk("%2x ",read_nic_byte(dev,n)); - } - len += snprintf(page + len, count - len,"\n"); - - - - *eof = 1; - return len; -} - -#endif - -#if 0 -static int proc_get_stats_hw(char *page, char **start, - off_t offset, int count, - int *eof, void *data) -{ - struct net_device *dev = data; - struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); - - int len = 0; - - len += snprintf(page + len, count - len, - "NIC int: %lu\n" - "Total int: %lu\n", - priv->stats.ints, - priv->stats.shints); - - *eof = 1; - return len; -} -#endif static int proc_get_stats_tx(char *page, char **start, off_t offset, int count, @@ -818,35 +687,16 @@ static int proc_get_stats_rx(char *page, char **start, *eof = 1; return len; } -#if 0 -#if WIRELESS_EXT >= 12 && WIRELESS_EXT < 17 - -static struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev) -{ - struct r8192_priv *priv = ieee80211_priv(dev); - - return &priv->wstats; -} -#endif -#endif void rtl8192_proc_module_init(void) { RT_TRACE(COMP_INIT, "Initializing proc filesystem"); -#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) - rtl8192_proc=create_proc_entry(RTL819xU_MODULE_NAME, S_IFDIR, proc_net); -#else rtl8192_proc=create_proc_entry(RTL819xU_MODULE_NAME, S_IFDIR, init_net.proc_net); -#endif } void rtl8192_proc_module_remove(void) { -#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) - remove_proc_entry(RTL819xU_MODULE_NAME, proc_net); -#else remove_proc_entry(RTL819xU_MODULE_NAME, init_net.proc_net); -#endif } @@ -883,16 +733,6 @@ void rtl8192_proc_init_one(struct net_device *dev) dev->name); return; } - #if 0 - e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO, - priv->dir_dev, proc_get_stats_hw, dev); - - if (!e) { - DMESGE("Unable to initialize " - "/proc/net/rtl8192/%s/stats-hw\n", - dev->name); - } - #endif e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO, priv->dir_dev, proc_get_stats_rx, dev); @@ -911,17 +751,6 @@ void rtl8192_proc_init_one(struct net_device *dev) "/proc/net/rtl8192/%s/stats-tx\n", dev->name); } - #if 0 - e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO, - priv->dir_dev, proc_get_stats_ieee, dev); - - if (!e) { - DMESGE("Unable to initialize " - "/proc/net/rtl8192/%s/stats-ieee\n", - dev->name); - } - - #endif e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO, priv->dir_dev, proc_get_stats_ap, dev); @@ -939,23 +768,6 @@ void rtl8192_proc_init_one(struct net_device *dev) "/proc/net/rtl8192/%s/registers\n", dev->name); } -#if 0 - e = create_proc_read_entry("cck-registers", S_IFREG | S_IRUGO, - priv->dir_dev, proc_get_cck_reg, dev); - if (!e) { - RT_TRACE(COMP_ERR, "Unable to initialize " - "/proc/net/rtl8192/%s/cck-registers\n", - dev->name); - } - - e = create_proc_read_entry("ofdm-registers", S_IFREG | S_IRUGO, - priv->dir_dev, proc_get_ofdm_reg, dev); - if (!e) { - RT_TRACE(COMP_ERR, "Unable to initialize " - "/proc/net/rtl8192/%s/ofdm-registers\n", - dev->name); - } -#endif } /**************************************************************************** -----------------------------MISC STUFF------------------------- @@ -994,11 +806,7 @@ void tx_timeout(struct net_device *dev) struct r8192_priv *priv = ieee80211_priv(dev); //rtl8192_commit(dev); -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) schedule_work(&priv->reset_wq); -#else - schedule_task(&priv->reset_wq); -#endif //DMESG("TXTIMEOUT"); } @@ -1033,30 +841,6 @@ void rtl8192_dump_reg(struct net_device *dev) ------------------------------HW STUFF--------------------------- *****************************************************************************/ -#if 0 -void rtl8192_irq_enable(struct net_device *dev) -{ - struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); - //priv->irq_enabled = 1; -/* - write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\ - INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\ - INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\ - INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT); -*/ - write_nic_word(dev,INTA_MASK, priv->irq_mask); -} - - -void rtl8192_irq_disable(struct net_device *dev) -{ -// struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); - - write_nic_word(dev,INTA_MASK,0); - force_pci_posting(dev); -// priv->irq_enabled = 0; -} -#endif void rtl8192_set_mode(struct net_device *dev,int mode) { @@ -1104,15 +888,6 @@ void rtl8192_set_chan(struct net_device *dev,short ch) // u32 tx; RT_TRACE(COMP_CH, "=====>%s()====ch:%d\n", __FUNCTION__, ch); priv->chan=ch; - #if 0 - if(priv->ieee80211->iw_mode == IW_MODE_ADHOC || - priv->ieee80211->iw_mode == IW_MODE_MASTER){ - - priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED; - priv->ieee80211->master_chan = ch; - rtl8192_update_beacon_ch(dev); - } - #endif /* this hack should avoid frame TX during channel setting*/ @@ -1132,11 +907,7 @@ void rtl8192_set_chan(struct net_device *dev,short ch) #endif } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void rtl8192_rx_isr(struct urb *urb, struct pt_regs *regs); -#else static void rtl8192_rx_isr(struct urb *urb); -#endif //static void rtl8192_rx_isr(struct urb *rx_urb); u32 get_rxpacket_shiftbytes_819xusb(struct ieee80211_rx_stats *pstats) @@ -1164,11 +935,7 @@ static int rtl8192_rx_initiate(struct net_device*dev) skb = __dev_alloc_skb(RX_URB_SIZE, GFP_KERNEL); if (!skb) break; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) entry = usb_alloc_urb(0, GFP_KERNEL); -#else - entry = usb_alloc_urb(0); -#endif if (!entry) { kfree_skb(skb); break; @@ -1191,11 +958,7 @@ static int rtl8192_rx_initiate(struct net_device*dev) skb = __dev_alloc_skb(RX_URB_SIZE ,GFP_KERNEL); if (!skb) break; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) entry = usb_alloc_urb(0, GFP_KERNEL); -#else - entry = usb_alloc_urb(0); -#endif if (!entry) { kfree_skb(skb); break; @@ -1277,106 +1040,14 @@ void rtl8192_rx_enable(struct net_device *dev) rtl8192_rx_initiate(dev); // rtl8192_set_rxconf(dev); -#if 0 - if(NIC_8187 == priv->card_8187) { - cmd=read_nic_byte(dev,CMD); - write_nic_byte(dev,CMD,cmd | (1<ReceiveConfig); - } -#endif } void rtl8192_tx_enable(struct net_device *dev) { -#if 0 - u8 cmd; - u8 byte; - u32 txconf; - struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); - //test loopback - // priv->TransmitConfig |= (TX_LOOPBACK_BASEBAND<card_8187){ - write_nic_dword(dev, TX_CONF, priv->TransmitConfig); - byte = read_nic_byte(dev, MSR); - byte |= MSR_LINK_ENEDCA; - write_nic_byte(dev, MSR, byte); - } else { - byte = read_nic_byte(dev,CW_CONF); - byte &= ~(1<retry_data<retry_rts<dma_poll_mask &=~(1<dma_poll_mask); - rtl8192_set_mode(dev,EPROM_CMD_NORMAL); } -void rtl8192_ -_disable(struct net_device *dev) -{ - struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); - priv->dma_poll_mask |= (1<dma_poll_mask); - rtl8192_set_mode(dev,EPROM_CMD_NORMAL); -} - -#endif - void rtl8192_rtx_disable(struct net_device *dev) { @@ -1411,91 +1082,9 @@ void rtl8192_rtx_disable(struct net_device *dev) int alloc_tx_beacon_desc_ring(struct net_device *dev, int count) { - #if 0 - int i; - u32 *tmp; - struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); - - priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev, - sizeof(u32)*8*count, - &priv->txbeaconringdma); - if (!priv->txbeaconring) return -1; - for (tmp=priv->txbeaconring,i=0;itxbeaconringdma+((i+1)*8*4); - else - *(tmp+4) = (u32)priv->txbeaconringdma; - - tmp=tmp+8; - } - #endif return 0; } -#if 0 -void rtl8192_reset(struct net_device *dev) -{ - - //struct r8192_priv *priv = ieee80211_priv(dev); - //u8 cr; - - - /* make sure the analog power is on before - * reset, otherwise reset may fail - */ -#if 0 - if(NIC_8187 == priv->card_8187) { - rtl8192_set_anaparam(dev, RTL8225_ANAPARAM_ON); - rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON); - rtl8192_irq_disable(dev); - mdelay(200); - write_nic_byte_E(dev,0x18,0x10); - write_nic_byte_E(dev,0x18,0x11); - write_nic_byte_E(dev,0x18,0x00); - mdelay(200); - } -#endif - printk("=====>reset?\n"); -#if 0 - cr=read_nic_byte(dev,CMD); - cr = cr & 2; - cr = cr | (1<card_8187) { - - printk("This is RTL8187 Reset procedure\n"); - rtl8192_set_mode(dev,EPROM_CMD_LOAD); - force_pci_posting(dev); - mdelay(200); - - /* after the eeprom load cycle, make sure we have - * correct anaparams - */ - rtl8192_set_anaparam(dev, RTL8225_ANAPARAM_ON); - rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON); - } - else -#endif - printk("This is RTL8187B Reset procedure\n"); - -} -#endif inline u16 ieeerate2rtlrate(int rate) { switch(rate){ @@ -1537,11 +1126,7 @@ inline u16 rtl8192_rate2rate(short rate) /* The protype of rx_isr has changed since one verion of Linux Kernel */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void rtl8192_rx_isr(struct urb *urb, struct pt_regs *regs) -#else static void rtl8192_rx_isr(struct urb *urb) -#endif { struct sk_buff *skb = (struct sk_buff *) urb->context; struct rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; @@ -1559,11 +1144,7 @@ static void rtl8192_rx_isr(struct urb *urb) // printk("%s():rx status err\n",__FUNCTION__); return; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14) skb_unlink(skb, &priv->rx_queue); -#else - __skb_unlink(skb,&priv->rx_queue); -#endif skb_put(skb, urb->actual_length); skb_queue_tail(&priv->skb_queue, skb); @@ -1618,44 +1199,16 @@ rtl819xusb_rx_command_packet( return status; } -#if 0 -void rtl8192_tx_queues_stop(struct net_device *dev) -{ - //struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); - u8 dma_poll_mask = (1<dma_poll_mask |= (1<dma_poll_mask); - rtl8192_set_mode(dev,EPROM_CMD_NORMAL); - #endif } void rtl8192_data_hard_resume(struct net_device *dev) { // FIXME !! - #if 0 - struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); - priv->dma_poll_mask &= ~(1<dma_poll_mask); - rtl8192_set_mode(dev,EPROM_CMD_NORMAL); - #endif } /* this function TX data frames when the ieee80211 stack requires this. @@ -1739,11 +1292,7 @@ u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc); u8 MapHwQueueToFirmwareQueue(u8 QueueID); struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv_agg_txb *pSendList) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) struct ieee80211_device *ieee = netdev_priv(dev); -#else - struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv; -#endif struct r8192_priv *priv = ieee80211_priv(dev); cb_desc *tcb_desc = NULL; u8 i; @@ -1854,53 +1403,11 @@ struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv /*DWORD 1*/ tx_agg_desc->SecCAMID= 0; tx_agg_desc->RATid = tcb_desc->RATRIndex; -#if 0 - /* Fill security related */ - if( pTcb->bEncrypt && !Adapter->MgntInfo.SecurityInfo.SWTxEncryptFlag) - { - EncAlg = SecGetEncryptionOverhead( - Adapter, - &EncryptionMPDUHeadOverhead, - &EncryptionMPDUTailOverhead, - NULL, - NULL, - FALSE, - FALSE); - //2004/07/22, kcwu, EncryptionMPDUHeadOverhead has been added in previous code - //MPDUOverhead = EncryptionMPDUHeadOverhead + EncryptionMPDUTailOverhead; - MPDUOverhead = EncryptionMPDUTailOverhead; - tx_agg_desc->NoEnc = 0; - RT_TRACE(COMP_SEC, DBG_LOUD, ("******We in the loop SecCAMID is %d SecDescAssign is %d The Sec is %d********\n",tx_agg_desc->SecCAMID,tx_agg_desc->SecDescAssign,EncAlg)); - //CamDumpAll(Adapter); - } - else -#endif { //MPDUOverhead = 0; tx_agg_desc->NoEnc = 1; } -#if 0 - switch(EncAlg){ - case NO_Encryption: - tx_agg_desc->SecType = 0x0; - break; - case WEP40_Encryption: - case WEP104_Encryption: - tx_agg_desc->SecType = 0x1; - break; - case TKIP_Encryption: - tx_agg_desc->SecType = 0x2; - break; - case AESCCMP_Encryption: - tx_agg_desc->SecType = 0x3; - break; - default: - tx_agg_desc->SecType = 0x0; - break; - } -#else tx_agg_desc->SecType = 0x0; -#endif if (tcb_desc->bHwSec) { switch (priv->ieee80211->pairwise_key_type) @@ -1956,11 +1463,7 @@ struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv u8 DrvAggr_GetAggregatibleList(struct net_device *dev, struct sk_buff *skb, struct ieee80211_drv_agg_txb *pSendList) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) struct ieee80211_device *ieee = netdev_priv(dev); -#else - struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv; -#endif PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; u16 nMaxAggrNum = pHTInfo->UsbTxAggrNum; cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); @@ -1979,11 +1482,7 @@ u8 DrvAggr_GetAggregatibleList(struct net_device *dev, struct sk_buff *skb, } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void rtl8192_tx_isr(struct urb *tx_urb, struct pt_regs *reg) -#else static void rtl8192_tx_isr(struct urb *tx_urb) -#endif { struct sk_buff *skb = (struct sk_buff*)tx_urb->context; struct net_device *dev = NULL; @@ -2019,29 +1518,11 @@ static void rtl8192_tx_isr(struct urb *tx_urb) atomic_dec(&priv->tx_pending[queue_index]); } -#if 0 //we need to send zero byte packet just after 512 byte(64 byte)packet is transmitted, or we will halt. It will greatly reduced available page in FW, and ruin our throughput. WB 2008.08.27 - if(BufLen > 0 && ((BufLen % 512 == 0)||(BufLen % 64 == 0))) { - bToSend0Byte = true; - } - - bToSend0Byte = false; - // - // Note that, we at most handle 1 MPDU to send here, either - // fragment or MPDU in wait queue. - // - if(!bToSend0Byte) -#endif { // // Handle HW Beacon: // We had transfer our beacon frame to host controler at this moment. // -#if 0 - if(tcb_desc->tx_queue == BEACON_QUEUE) - { - priv->bSendingBeacon = FALSE; - } -#endif // // Caution: // Handling the wait queue of command packets. @@ -2095,12 +1576,6 @@ static void rtl8192_tx_isr(struct urb *tx_urb) if(DrvAggr_GetAggregatibleList(dev, skb, &SendList) > 1) { skb = DrvAggr_Aggregation(dev, &SendList); -#if 0 - printk("=============>to send aggregated packet!\n"); - RT_DEBUG_DATA(COMP_SEND, skb->cb, sizeof(skb->cb)); - printk("\n=================skb->len = %d\n", skb->len); - RT_DEBUG_DATA(COMP_SEND, skb->data, skb->len); -#endif } } priv->ieee80211->softmac_hard_start_xmit(skb, dev); @@ -2110,23 +1585,6 @@ static void rtl8192_tx_isr(struct urb *tx_urb) } } -#if 0 - else - { - RT_TRACE( COMP_SEND,"HalUsbOutComplete(%d): bToSend0Byte.\n", PipeIndex); - - // - // In this case, we don't return skb now. - // It will be returned when the 0-byte request completed. - // - - // - // Bulk out an 0-byte padding transfer. - // - HalUsbOut0Byte(pAdapter, PipeIndex, skb); - } - -#endif } void rtl8192_beacon_stop(struct net_device *dev) @@ -2264,46 +1722,10 @@ void rtl8192_net_update(struct net_device *dev) //temporary hw beacon is not used any more. //open it when necessary -#if 1 void rtl819xusb_beacon_tx(struct net_device *dev,u16 tx_rate) { -#if 0 - struct r8192_priv *priv = ieee80211_priv(dev); - struct sk_buff *skb; - int i = 0; - //u8 cr; - - rtl8192_net_update(dev); - - skb = ieee80211_get_beacon(priv->ieee80211); - if(!skb){ - DMESG("not enought memory for allocating beacon"); - return; - } - - - write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7)); - - i=0; - //while(!read_nic_byte(dev,BQREQ & (1<<7))) - while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 ) - { - msleep_interruptible_rtl(HZ/2); - if(i++ > 10){ - DMESGW("get stuck to wait HW beacon to be ready"); - return ; - } - } - skb->cb[0] = NORM_PRIORITY; - skb->cb[1] = 0; //morefragment = 0 - skb->cb[2] = ieeerate2rtlrate(tx_rate); - - rtl8192_tx(dev,skb); - -#endif } -#endif inline u8 rtl8192_IsWirelessBMode(u16 rate) { if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) ) @@ -2392,38 +1814,6 @@ u16 N_DBPSOfRate(u16 DataRate) void rtl819xU_cmd_isr(struct urb *tx_cmd_urb, struct pt_regs *regs) { -#if 0 - struct net_device *dev = (struct net_device*)tx_cmd_urb->context; - struct r8192_priv *priv = ieee80211_priv(dev); - int last_init_packet = 0; - u8 *ptr_cmd_buf; - u16 cmd_buf_len; - - if(tx_cmd_urb->status != 0) { - priv->pFirmware.firmware_seg_index = 0; //only begin transter, should it can be set to 1 - } - - /* Free the urb and the corresponding buf for common Tx cmd packet, or - * last segment of each firmware img. - */ - if((priv->pFirmware.firmware_seg_index == 0) ||(priv->pFirmware.firmware_seg_index == priv->pFirmware.firmware_seg_maxnum)) { - priv->pFirmware.firmware_seg_index = 0;//only begin transter, should it can be set to 1 - } else { - /* prepare for last transfer */ - /* update some infomation for */ - /* last segment of the firmware img need indicate to device */ - priv->pFirmware.firmware_seg_index++; - if(priv->pFirmware.firmware_seg_index == priv->pFirmware.firmware_seg_maxnum) { - last_init_packet = 1; - } - - cmd_buf_len = priv->pFirmware.firmware_seg_container[priv->pFirmware.firmware_seg_index-1].seg_size; - ptr_cmd_buf = priv->pFfirmware.firmware_seg_container[priv->pFfirmware.firmware_seg_index-1].seg_ptr; - rtl819xU_tx_cmd(dev, ptr_cmd_buf, cmd_buf_len, last_init_packet, DESC_PACKET_TYPE_INIT); - } - - kfree(tx_cmd_urb->transfer_buffer); -#endif usb_free_urb(tx_cmd_urb); } @@ -2451,11 +1841,7 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb) //printk("\n %s::queue_index = %d\n",__FUNCTION__, queue_index); atomic_inc(&priv->tx_pending[queue_index]); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) tx_urb = usb_alloc_urb(0,GFP_ATOMIC); -#else - tx_urb = usb_alloc_urb(0); -#endif if(!tx_urb){ dev_kfree_skb(skb); return -ENOMEM; @@ -2489,11 +1875,7 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb) usb_fill_bulk_urb(tx_urb,priv->udev, usb_sndbulkpipe(priv->udev,idx_pipe), \ skb->data, skb->len, rtl8192_tx_isr, skb); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) status = usb_submit_urb(tx_urb, GFP_ATOMIC); -#else - status = usb_submit_urb(tx_urb); -#endif if (!status){ return 0; @@ -2612,11 +1994,7 @@ u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc) return tmp_Short; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void tx_zero_isr(struct urb *tx_urb, struct pt_regs *reg) -#else static void tx_zero_isr(struct urb *tx_urb) -#endif { return; } @@ -2639,10 +2017,6 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) //int urb_len; unsigned int idx_pipe; // RT_DEBUG_DATA(COMP_SEND, tcb_desc, sizeof(cb_desc)); -#if 0 - /* Added by Annie for filling Len_Adjust field. 2005-12-14. */ - RT_ENC_ALG EncAlg = NO_Encryption; -#endif // printk("=============> %s\n", __FUNCTION__); pend = atomic_read(&priv->tx_pending[tcb_desc->queue_index]); /* we are locked here so the two atomic_read and inc are executed @@ -2650,32 +2024,12 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) * !!! For debug purpose */ if( pend > MAX_TX_URB){ -#if 0 - switch (tcb_desc->queue_index) { - case VO_PRIORITY: - priv->stats.txvodrop++; - break; - case VI_PRIORITY: - priv->stats.txvidrop++; - break; - case BE_PRIORITY: - priv->stats.txbedrop++; - break; - default://BK_PRIORITY - priv->stats.txbkdrop++; - break; - } -#endif printk("To discard skb packet!\n"); dev_kfree_skb_any(skb); return -1; } -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) tx_urb = usb_alloc_urb(0,GFP_ATOMIC); -#else - tx_urb = usb_alloc_urb(0); -#endif if(!tx_urb){ dev_kfree_skb_any(skb); return -ENOMEM; @@ -2751,53 +2105,11 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) /*DWORD 1*/ tx_desc->SecCAMID= 0; tx_desc->RATid = tcb_desc->RATRIndex; -#if 0 - /* Fill security related */ - if( pTcb->bEncrypt && !Adapter->MgntInfo.SecurityInfo.SWTxEncryptFlag) - { - EncAlg = SecGetEncryptionOverhead( - Adapter, - &EncryptionMPDUHeadOverhead, - &EncryptionMPDUTailOverhead, - NULL, - NULL, - FALSE, - FALSE); - //2004/07/22, kcwu, EncryptionMPDUHeadOverhead has been added in previous code - //MPDUOverhead = EncryptionMPDUHeadOverhead + EncryptionMPDUTailOverhead; - MPDUOverhead = EncryptionMPDUTailOverhead; - tx_desc->NoEnc = 0; - RT_TRACE(COMP_SEC, DBG_LOUD, ("******We in the loop SecCAMID is %d SecDescAssign is %d The Sec is %d********\n",tx_desc->SecCAMID,tx_desc->SecDescAssign,EncAlg)); - //CamDumpAll(Adapter); - } - else -#endif { //MPDUOverhead = 0; tx_desc->NoEnc = 1; } -#if 0 - switch(EncAlg){ - case NO_Encryption: - tx_desc->SecType = 0x0; - break; - case WEP40_Encryption: - case WEP104_Encryption: - tx_desc->SecType = 0x1; - break; - case TKIP_Encryption: - tx_desc->SecType = 0x2; - break; - case AESCCMP_Encryption: - tx_desc->SecType = 0x3; - break; - default: - tx_desc->SecType = 0x0; - break; - } -#else tx_desc->SecType = 0x0; -#endif if (tcb_desc->bHwSec) { switch (priv->ieee80211->pairwise_key_type) @@ -2830,13 +2142,8 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) /* Fill fields that are required to be initialized in all of the descriptors */ //DWORD 0 -#if 0 - tx_desc->FirstSeg = (tcb_desc->bFirstSeg)? 1:0; - tx_desc->LastSeg = (tcb_desc->bLastSeg)?1:0; -#else tx_desc->FirstSeg = 1; tx_desc->LastSeg = 1; -#endif tx_desc->OWN = 1; #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE @@ -2863,11 +2170,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) usb_sndbulkpipe(udev,idx_pipe), skb->data, skb->len, rtl8192_tx_isr, skb); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) status = usb_submit_urb(tx_urb, GFP_ATOMIC); -#else - status = usb_submit_urb(tx_urb); -#endif if (!status){ //we need to send 0 byte packet whenever 512N bytes/64N(HIGN SPEED/NORMAL SPEED) bytes packet has been transmitted. Otherwise, it will be halt to wait for another packet. WB. 2008.08.27 bool bSend0Byte = false; @@ -2884,12 +2187,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) } if (bSend0Byte) { -#if 1 -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) tx_urb_zero = usb_alloc_urb(0,GFP_ATOMIC); -#else - tx_urb_zero = usb_alloc_urb(0); -#endif if(!tx_urb_zero){ RT_TRACE(COMP_ERR, "can't alloc urb for zero byte\n"); return -ENOMEM; @@ -2897,16 +2195,11 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb) usb_fill_bulk_urb(tx_urb_zero,udev, usb_sndbulkpipe(udev,idx_pipe), &zero, 0, tx_zero_isr, dev); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) status = usb_submit_urb(tx_urb_zero, GFP_ATOMIC); -#else - status = usb_submit_urb(tx_urb_zero); -#endif if (status){ RT_TRACE(COMP_ERR, "Error TX URB for zero byte %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), status); return -1; } -#endif } dev->trans_start = jiffies; atomic_inc(&priv->tx_pending[tcb_desc->queue_index]); @@ -2927,11 +2220,7 @@ short rtl8192_usb_initendpoints(struct net_device *dev) #ifndef JACKSON_NEW_RX for(i=0;i<(MAX_RX_URB+1);i++){ -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL); -#else - priv->rx_urb[i] = usb_alloc_urb(0); -#endif priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL); @@ -3050,44 +2339,6 @@ void rtl8192_usb_deleteendpoints(struct net_device *dev) } #endif -#if 0 -void rtl8192_set_rate(struct net_device *dev) -{ - int i; - u16 word; - int basic_rate,min_rr_rate,max_rr_rate; - -// struct r8192_priv *priv = ieee80211_priv(dev); - - //if (ieee80211_is_54g(priv->ieee80211->current_network) && -// priv->ieee80211->state == IEEE80211_LINKED){ - basic_rate = ieeerate2rtlrate(240); - min_rr_rate = ieeerate2rtlrate(60); - max_rr_rate = ieeerate2rtlrate(240); - -// -// }else{ -// basic_rate = ieeerate2rtlrate(20); -// min_rr_rate = ieeerate2rtlrate(10); -// max_rr_rate = ieeerate2rtlrate(110); -// } - - write_nic_byte(dev, RESP_RATE, - max_rr_rate<pairwise_key_type) || (KEY_TYPE_WEP104 == ieee->pairwise_key_type)) EnableHWSecurityConfig8192(dev); -#endif } /*update timing params*/ // RT_TRACE(COMP_CH, "========>%s(), chan:%d\n", __FUNCTION__, priv->chan); @@ -3132,16 +2381,10 @@ static struct ieee80211_qos_parameters def_qos_parameters = { }; -#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20) void rtl8192_update_beacon(struct work_struct * work) { struct r8192_priv *priv = container_of(work, struct r8192_priv, update_beacon_wq.work); struct net_device *dev = priv->ieee80211->dev; -#else -void rtl8192_update_beacon(struct net_device *dev) -{ - struct r8192_priv *priv = ieee80211_priv(dev); -#endif struct ieee80211_device* ieee = priv->ieee80211; struct ieee80211_network* net = &ieee->current_network; @@ -3154,16 +2397,10 @@ void rtl8192_update_beacon(struct net_device *dev) * background support to run QoS activate functionality */ int WDCAPARA_ADD[] = {EDCAPARA_BE,EDCAPARA_BK,EDCAPARA_VI,EDCAPARA_VO}; -#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20) void rtl8192_qos_activate(struct work_struct * work) { struct r8192_priv *priv = container_of(work, struct r8192_priv, qos_activate); struct net_device *dev = priv->ieee80211->dev; -#else -void rtl8192_qos_activate(struct net_device *dev) -{ - struct r8192_priv *priv = ieee80211_priv(dev); -#endif struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters; u8 mode = priv->ieee80211->current_network.mode; //u32 size = sizeof(struct ieee80211_qos_parameters); @@ -3174,11 +2411,7 @@ void rtl8192_qos_activate(struct net_device *dev) if (priv == NULL) return; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)) - down(&priv->mutex); -#else mutex_lock(&priv->mutex); -#endif if(priv->ieee80211->state != IEEE80211_LINKED) goto success; RT_TRACE(COMP_QOS,"qos active process with associate response received\n"); @@ -3198,11 +2431,7 @@ void rtl8192_qos_activate(struct net_device *dev) } success: -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)) - up(&priv->mutex); -#else mutex_unlock(&priv->mutex); -#endif } static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, @@ -3229,11 +2458,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, network->qos_data.param_count)) { network->qos_data.old_param_count = network->qos_data.param_count; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) queue_work(priv->priv_wq, &priv->qos_activate); -#else - schedule_task(&priv->qos_activate); -#endif RT_TRACE (COMP_QOS, "QoS parameters change call " "qos_activate\n"); } @@ -3242,11 +2467,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, &def_qos_parameters, size); if ((network->qos_data.active == 1) && (active_network == 1)) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) queue_work(priv->priv_wq, &priv->qos_activate); -#else - schedule_task(&priv->qos_activate); -#endif RT_TRACE(COMP_QOS, "QoS was disabled call qos_activate \n"); } network->qos_data.active = 0; @@ -3264,16 +2485,7 @@ static int rtl8192_handle_beacon(struct net_device * dev, struct r8192_priv *priv = ieee80211_priv(dev); rtl8192_qos_handle_probe_response(priv,1,network); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) queue_delayed_work(priv->priv_wq, &priv->update_beacon_wq, 0); -#else -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) - schedule_task(&priv->update_beacon_wq); -#else - queue_work(priv->priv_wq, &priv->update_beacon_wq); -#endif - -#endif return 0; } @@ -3306,10 +2518,6 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv, &network->qos_data.parameters,\ sizeof(struct ieee80211_qos_parameters)); priv->ieee80211->current_network.qos_data.active = 1; -#if 0 - if((priv->ieee80211->current_network.qos_data.param_count != \ - network->qos_data.param_count)) -#endif { set_qos_param = 1; /* update qos parameter for current network */ @@ -3330,11 +2538,7 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv, RT_TRACE(COMP_QOS, "%s: network->flags = %d,%d\n",__FUNCTION__,network->flags ,priv->ieee80211->current_network.qos_data.active); if (set_qos_param == 1) -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) queue_work(priv->priv_wq, &priv->qos_activate); -#else - schedule_task(&priv->qos_activate); -#endif return ret; @@ -3404,7 +2608,6 @@ static u8 ccmp_ie[4] = {0x00,0x50,0xf2,0x04}; static u8 ccmp_rsn_ie[4] = {0x00, 0x0f, 0xac, 0x04}; bool GetNmodeSupportBySecCfg8192(struct net_device*dev) { -#if 1 struct r8192_priv* priv = ieee80211_priv(dev); struct ieee80211_device* ieee = priv->ieee80211; struct ieee80211_network * network = &ieee->current_network; @@ -3432,20 +2635,7 @@ bool GetNmodeSupportBySecCfg8192(struct net_device*dev) return true; } -#if 0 - //In here we discuss with SD4 David. He think we still can send TKIP in broadcast group key in MCS rate. - //We can't force in G mode if Pairwie key is AES and group key is TKIP - if((pSecInfo->GroupEncAlgorithm == WEP104_Encryption) || (pSecInfo->GroupEncAlgorithm == WEP40_Encryption) || - (pSecInfo->PairwiseEncAlgorithm == WEP104_Encryption) || - (pSecInfo->PairwiseEncAlgorithm == WEP40_Encryption) || (pSecInfo->PairwiseEncAlgorithm == TKIP_Encryption)) - { - return false; - } - else - return true; -#endif return true; -#endif } bool GetHalfNmodeSupportByAPs819xUsb(struct net_device* dev) @@ -3502,7 +2692,6 @@ void rtl8192_SetWirelessMode(struct net_device* dev, u8 wireless_mode) struct r8192_priv *priv = ieee80211_priv(dev); u8 bSupportMode = rtl8192_getSupportedWireleeMode(dev); -#if 1 if ((wireless_mode == WIRELESS_MODE_AUTO) || ((wireless_mode&bSupportMode)==0)) { if(bSupportMode & WIRELESS_MODE_N_24G) @@ -3541,7 +2730,6 @@ void rtl8192_SetWirelessMode(struct net_device* dev, u8 wireless_mode) priv->ieee80211->pHTInfo->bEnableHT = 0; RT_TRACE(COMP_INIT, "Current Wireless Mode is %x\n", wireless_mode); rtl8192_refresh_supportrate(priv); -#endif } //init priv variables here. only non_zero value should be initialized here. @@ -3679,18 +2867,10 @@ static void rtl8192_init_priv_lock(struct r8192_priv* priv) //spin_lock_init(&priv->rf_lock); sema_init(&priv->wx_sem,1); sema_init(&priv->rf_sem,1); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)) - sema_init(&priv->mutex, 1); -#else mutex_init(&priv->mutex); -#endif } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) extern void rtl819x_watchdog_wqcallback(struct work_struct *work); -#else -extern void rtl819x_watchdog_wqcallback(struct net_device *dev); -#endif void rtl8192_irq_rx_tasklet(struct r8192_priv *priv); //init tasklet and wait_queue here. only 2.6 above kernel is considered @@ -3699,15 +2879,12 @@ static void rtl8192_init_priv_task(struct net_device* dev) { struct r8192_priv *priv = ieee80211_priv(dev); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) #ifdef PF_SYNCTHREAD priv->priv_wq = create_workqueue(DRV_NAME,0); #else priv->priv_wq = create_workqueue(DRV_NAME); #endif -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) INIT_WORK(&priv->reset_wq, rtl8192_restart); //INIT_DELAYED_WORK(&priv->watch_dog_wq, hal_dm_watchdog); @@ -3720,30 +2897,6 @@ static void rtl8192_init_priv_task(struct net_device* dev) //INIT_WORK(&priv->SwChnlWorkItem, rtl8192_SwChnl_WorkItem); //INIT_WORK(&priv->SetBWModeWorkItem, rtl8192_SetBWModeWorkItem); INIT_WORK(&priv->qos_activate, rtl8192_qos_activate); -#else -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - tq_init(&priv->reset_wq, (void*)rtl8192_restart, dev); - tq_init(&priv->watch_dog_wq, (void*)rtl819x_watchdog_wqcallback, dev); - tq_init(&priv->txpower_tracking_wq, (void*)dm_txpower_trackingcallback, dev); - tq_init(&priv->rfpath_check_wq, (void*)dm_rf_pathcheck_workitemcallback, dev); - tq_init(&priv->update_beacon_wq, (void*)rtl8192_update_beacon, dev); - //tq_init(&priv->SwChnlWorkItem, (void*) rtl8192_SwChnl_WorkItem, dev); - //tq_init(&priv->SetBWModeWorkItem, (void*)rtl8192_SetBWModeWorkItem, dev); - tq_init(&priv->qos_activate, (void *)rtl8192_qos_activate, dev); -#else - INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8192_restart,dev); - //INIT_WORK(&priv->watch_dog_wq, (void(*)(void*)) hal_dm_watchdog,dev); - INIT_WORK(&priv->watch_dog_wq, (void(*)(void*)) rtl819x_watchdog_wqcallback,dev); - INIT_WORK(&priv->txpower_tracking_wq, (void(*)(void*)) dm_txpower_trackingcallback,dev); -// INIT_WORK(&priv->gpio_change_rf_wq, (void(*)(void*)) dm_gpio_change_rf_callback,dev); - INIT_WORK(&priv->rfpath_check_wq, (void(*)(void*)) dm_rf_pathcheck_workitemcallback,dev); - INIT_WORK(&priv->update_beacon_wq, (void(*)(void*))rtl8192_update_beacon,dev); - INIT_WORK(&priv->initialgain_operate_wq, (void(*)(void*))InitialGainOperateWorkItemCallBack,dev); - //INIT_WORK(&priv->SwChnlWorkItem, (void(*)(void*)) rtl8192_SwChnl_WorkItem, dev); - //INIT_WORK(&priv->SetBWModeWorkItem, (void(*)(void*)) rtl8192_SetBWModeWorkItem, dev); - INIT_WORK(&priv->qos_activate, (void(*)(void *))rtl8192_qos_activate, dev); -#endif -#endif tasklet_init(&priv->irq_rx_tasklet, (void(*)(unsigned long))rtl8192_irq_rx_tasklet, @@ -4218,7 +3371,6 @@ bool rtl8192_adapter_start(struct net_device *dev) //config BB. rtl8192_BBConfig(dev); -#if 1 //Loopback mode or not priv->LoopbackMode = RTL819xU_NO_LOOPBACK; // priv->LoopbackMode = RTL819xU_MAC_LOOPBACK; @@ -4434,7 +3586,6 @@ if(Adapter->ResetProgress == RESET_TYPE_NORESET) write_nic_byte(dev, 0x87, 0x0); -#endif return init_status; } @@ -4442,63 +3593,6 @@ if(Adapter->ResetProgress == RESET_TYPE_NORESET) * rtl8192_beacon_tx_enable(). rtl8192_beacon_tx_disable() might * be used to stop beacon transmission */ -#if 0 -void rtl8192_start_tx_beacon(struct net_device *dev) -{ - int i; - struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); - u16 word; - DMESG("Enabling beacon TX"); - //write_nic_byte(dev, TX_CONF,0xe6);// TX_CONF - //rtl8192_init_beacon(dev); - //set_nic_txring(dev); -// rtl8192_prepare_beacon(dev); - rtl8192_irq_disable(dev); -// rtl8192_beacon_tx_enable(dev); - rtl8192_set_mode(dev,EPROM_CMD_CONFIG); - //write_nic_byte(dev,0x9d,0x20); //DMA Poll - //write_nic_word(dev,0x7a,0); - //write_nic_word(dev,0x7a,0x8000); - - - word = read_nic_word(dev, BcnItv); - word &= ~BcnItv_BcnItv; // clear Bcn_Itv - write_nic_word(dev, BcnItv, word); - - write_nic_word(dev, AtimWnd, - read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd); - - word = read_nic_word(dev, BCN_INTR_ITV); - word &= ~BCN_INTR_ITV_MASK; - - //word |= priv->ieee80211->beacon_interval * - // ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1); - // FIXME:FIXME check if correct ^^ worked with 0x3e8; - - write_nic_word(dev, BCN_INTR_ITV, word); - - //write_nic_word(dev,0x2e,0xe002); - //write_nic_dword(dev,0x30,0xb8c7832e); - for(i=0; iieee80211->beacon_cell_ssid[i]); - -// rtl8192_update_msr(dev); - - - //write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */ - - rtl8192_set_mode(dev, EPROM_CMD_NORMAL); - - rtl8192_irq_enable(dev); - - /* VV !!!!!!!!!! VV*/ - /* - rtl8192_set_mode(dev,EPROM_CMD_CONFIG); - write_nic_byte(dev,0x9d,0x00); - rtl8192_set_mode(dev,EPROM_CMD_NORMAL); -*/ -} -#endif /*************************************************************************** -------------------------------NET STUFF--------------------------- ***************************************************************************/ @@ -4552,21 +3646,18 @@ TxCheckStuck(struct net_device *dev) { if(QueueID == TXCMD_QUEUE) continue; -#if 1 #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE if((skb_queue_len(&priv->ieee80211->skb_waitQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_aggQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_drv_aggQ[QueueID]) == 0)) #else if((skb_queue_len(&priv->ieee80211->skb_waitQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_aggQ[QueueID]) == 0)) #endif continue; -#endif bCheckFwTxCnt = true; } // PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK); // spin_unlock_irqrestore(&priv->ieee80211->lock,flags); // RT_TRACE(COMP_RESET,"bCheckFwTxCnt is %d\n",bCheckFwTxCnt); -#if 1 if(bCheckFwTxCnt) { if(HalTxCheckStuck819xUsb(dev)) @@ -4575,7 +3666,6 @@ TxCheckStuck(struct net_device *dev) return RESET_TYPE_SILENT; } } -#endif return RESET_TYPE_NORESET; } @@ -4694,7 +3784,6 @@ rtl819x_ifcheck_resetornot(struct net_device *dev) rfState = priv->ieee80211->eRFPowerState; TxResetType = TxCheckStuck(dev); -#if 1 if( rfState != eRfOff || /*ADAPTER_TEST_STATUS_FLAG(Adapter, ADAPTER_STATUS_FW_DOWNLOAD_FAILURE)) &&*/ (priv->ieee80211->iw_mode != IW_MODE_ADHOC)) @@ -4709,7 +3798,6 @@ rtl819x_ifcheck_resetornot(struct net_device *dev) // set, STA cannot hear any packet a all. Emily, 2008.04.12 RxResetType = RxCheckStuck(dev); } -#endif if(TxResetType==RESET_TYPE_NORMAL || RxResetType==RESET_TYPE_NORMAL) return RESET_TYPE_NORMAL; else if(TxResetType==RESET_TYPE_SILENT || RxResetType==RESET_TYPE_SILENT){ @@ -4889,7 +3977,6 @@ RESET_START: // Set the variable for reset. priv->ResetProgress = RESET_TYPE_SILENT; // rtl8192_close(dev); -#if 1 down(&priv->wx_sem); if(priv->up == 0) { @@ -4914,9 +4001,7 @@ RESET_START: printk("ieee->state is IEEE80211_LINKED\n"); ieee80211_stop_send_beacons(priv->ieee80211); del_timer_sync(&ieee->associate_timer); - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) cancel_delayed_work(&ieee->associate_retry_wq); - #endif ieee80211_stop_scan(ieee); netif_carrier_off(dev); up(&ieee->wx_sem); @@ -4943,22 +4028,13 @@ RESET_START: RT_TRACE(COMP_ERR," ERR!!! %s(): Reset Failed!!\n", __FUNCTION__); } } -#endif ieee->is_silent_reset = 1; -#if 1 EnableHWSecurityConfig8192(dev); -#if 1 if(ieee->state == IEEE80211_LINKED && ieee->iw_mode == IW_MODE_INFRA) { ieee->set_chan(ieee->dev, ieee->current_network.channel); -#if 1 -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) queue_work(ieee->wq, &ieee->associate_complete_wq); -#else - schedule_task(&ieee->associate_complete_wq); -#endif -#endif } else if(ieee->state == IEEE80211_LINKED && ieee->iw_mode == IW_MODE_ADHOC) @@ -4974,7 +4050,6 @@ RESET_START: ieee->data_hard_resume(ieee->dev); netif_carrier_on(ieee->dev); } -#endif CamRestoreAllEntry(dev); @@ -4987,7 +4062,6 @@ RESET_START: // For test --> force write UFWP. write_nic_byte(dev, UFWP, 1); RT_TRACE(COMP_RESET, "Reset finished!! ====>[%d]\n", priv->reset_count); -#endif } } @@ -5010,7 +4084,6 @@ void CAM_read_entry( //Check polling bit is clear // mdelay(1); -#if 1 while((i--)>=0) { ulStatus = read_nic_dword(dev, RWCAM); @@ -5021,7 +4094,6 @@ void CAM_read_entry( break; } } -#endif write_nic_dword(dev, RWCAM, target_command); RT_TRACE(COMP_SEC,"CAM_read_entry(): WRITE A0: %x \n",target_command); // printk("CAM_read_entry(): WRITE A0: %lx \n",target_command); @@ -5054,17 +4126,11 @@ void rtl819x_update_rxcounts( } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) extern void rtl819x_watchdog_wqcallback(struct work_struct *work) { struct delayed_work *dwork = container_of(work,struct delayed_work,work); struct r8192_priv *priv = container_of(dwork,struct r8192_priv,watch_dog_wq); struct net_device *dev = priv->ieee80211->dev; -#else -extern void rtl819x_watchdog_wqcallback(struct net_device *dev) -{ - struct r8192_priv *priv = ieee80211_priv(dev); -#endif struct ieee80211_device* ieee = priv->ieee80211; RESET_TYPE ResetType = RESET_TYPE_NORESET; static u8 check_reset_cnt=0; @@ -5106,11 +4172,7 @@ extern void rtl819x_watchdog_wqcallback(struct net_device *dev) notify_wx_assoc_event(priv->ieee80211); RemovePeerTS(priv->ieee80211,priv->ieee80211->current_network.bssid); priv->ieee80211->link_change(dev); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) queue_work(priv->ieee80211->wq, &priv->ieee80211->associate_procedure_wq); -#else - schedule_task(&priv->ieee80211->associate_procedure_wq); -#endif } } @@ -5126,7 +4188,6 @@ extern void rtl819x_watchdog_wqcallback(struct net_device *dev) //DbgPrint("Start to check silent reset\n"); } // RT_TRACE(COMP_RESET,"%s():priv->force_reset is %d,priv->ResetProgress is %d, priv->bForcedSilentReset is %d,priv->bDisableNormalResetCheck is %d,ResetType is %d\n",__FUNCTION__,priv->force_reset,priv->ResetProgress,priv->bForcedSilentReset,priv->bDisableNormalResetCheck,ResetType); -#if 1 if( (priv->force_reset) || (priv->ResetProgress==RESET_TYPE_NORESET && (priv->bForcedSilentReset || (!priv->bDisableNormalResetCheck && ResetType==RESET_TYPE_SILENT)))) // This is control by OID set in Pomelo @@ -5134,7 +4195,6 @@ extern void rtl819x_watchdog_wqcallback(struct net_device *dev) RT_TRACE(COMP_RESET,"%s():priv->force_reset is %d,priv->ResetProgress is %d, priv->bForcedSilentReset is %d,priv->bDisableNormalResetCheck is %d,ResetType is %d\n",__FUNCTION__,priv->force_reset,priv->ResetProgress,priv->bForcedSilentReset,priv->bDisableNormalResetCheck,ResetType); rtl819x_ifsilentreset(dev); } -#endif priv->force_reset = false; priv->bForcedSilentReset = false; priv->bResetInProgress = false; @@ -5146,20 +4206,8 @@ void watch_dog_timer_callback(unsigned long data) { struct r8192_priv *priv = ieee80211_priv((struct net_device *) data); //printk("===============>watch_dog timer\n"); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) queue_delayed_work(priv->priv_wq,&priv->watch_dog_wq, 0); -#else -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) - schedule_task(&priv->watch_dog_wq); -#else - queue_work(priv->priv_wq,&priv->watch_dog_wq); -#endif -#endif mod_timer(&priv->watch_dog_timer, jiffies + MSECS(IEEE80211_WATCH_DOG_TIME)); -#if 0 - priv->watch_dog_timer.expires = jiffies + MSECS(IEEE80211_WATCH_DOG_TIME); - add_timer(&priv->watch_dog_timer); -#endif } int _rtl8192_up(struct net_device *dev) { @@ -5298,17 +4346,10 @@ void rtl8192_restart(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) void rtl8192_restart(struct work_struct *work) { struct r8192_priv *priv = container_of(work, struct r8192_priv, reset_wq); struct net_device *dev = priv->ieee80211->dev; -#else -void rtl8192_restart(struct net_device *dev) -{ - - struct r8192_priv *priv = ieee80211_priv(dev); -#endif down(&priv->wx_sem); @@ -5347,11 +4388,7 @@ int r8192_set_mac_adr(struct net_device *dev, void *mac) memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) schedule_work(&priv->reset_wq); -#else - schedule_task(&priv->reset_wq); -#endif up(&priv->wx_sem); return 0; @@ -5604,14 +4641,6 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802 bcheck = true; }else { - #if 0 - // if previous packet is aggregated packet, and current packet - // (1) is not AMPDU - // (2) is the first packet of one AMPDU - // that means the previous packet is the last one aggregated packet - if( !pcurrent_stats->bIsAMPDU || pcurrent_stats->bFirstMPDU) - bcheck = true; - #endif } @@ -5728,7 +4757,6 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802 priv->undecorated_smoothed_pwdb = pprevious_stats->RxPWDBAll; //DbgPrint("First pwdb initialize \n"); } -#if 1 if(pprevious_stats->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb) { priv->undecorated_smoothed_pwdb = @@ -5742,20 +4770,6 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802 ( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) + (pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor); } -#else - //Fixed by Jacken 2008-03-20 - if(pPreviousRfd->Status.RxPWDBAll > (u32)pHalData->UndecoratedSmoothedPWDB) - { - pHalData->UndecoratedSmoothedPWDB = - ( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6; - pHalData->UndecoratedSmoothedPWDB = pHalData->UndecoratedSmoothedPWDB + 1; - } - else - { - pHalData->UndecoratedSmoothedPWDB = - ( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6; - } -#endif } @@ -6133,9 +5147,6 @@ static void rtl8192_query_rxphystatus( rx_evmX /= 2; //dbm evm = rtl819x_evm_dbtopercentage(rx_evmX); -#if 0 - EVM = SignalScaleMapping(EVM);//make it good looking, from 0~100 -#endif //if(bpacket_match_bssid) { if(i==0) // Fill value in RFD, Get the first spatial stream only @@ -6216,7 +5227,6 @@ void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, && (!pstats->bHwError) && (!pstats->bCRC)&& (!pstats->bICV)); bpacket_toself = bpacket_match_bssid & (eqMacAddr(praddr, priv->ieee80211->dev->dev_addr)); -#if 1//cosa if(WLAN_FC_GET_FRAMETYPE(fc)== IEEE80211_STYPE_BEACON) { bPacketBeacon = true; @@ -6229,7 +5239,6 @@ void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, //DbgPrint("BlockAck, MatchBSSID = %d, ToSelf = %d \n", bPacketMatchBSSID, bPacketToSelf); } -#endif if(bpacket_match_bssid) @@ -6416,10 +5425,6 @@ void query_rxdesc_status(struct sk_buff *skb, struct ieee80211_rx_stats *stats, stats->bIsAMPDU = (driver_info->PartAggr==1); stats->bFirstMPDU = (driver_info->PartAggr==1) && (driver_info->FirstAGGR==1); -#if 0 - // TODO: it is debug only. It should be disabled in released driver. 2007.1.12 by Joseph - UpdateRxAMPDUHistogramStatistics8190(Adapter, pRfd); -#endif stats->TimeStampLow = driver_info->TSFL; // xiong mask it, 070514 //pRfd->Status.TimeStampHigh = PlatformEFIORead4Byte(Adapter, TSFR+4); @@ -6452,17 +5457,6 @@ void query_rxdesc_status(struct sk_buff *skb, struct ieee80211_rx_stats *stats, } #endif /* for debug 2008.5.29 */ -#if 0 - { - int i; - printk("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); - for(i = 0; i < skb->len; i++) { - if(i % 10 == 0) printk("\n"); - printk("%02x ", skb->data[i]); - } - printk("\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"); - } -#endif //added by vivi, for MP, 20080108 stats->RxIs40MHzPacket = driver_info->BW; @@ -6753,33 +5747,6 @@ void rtl8192_rx_cmd(struct sk_buff *skb) ; -#if 0 - desc = (u32*)(skb->data); - cmd = (desc[0] >> 30) & 0x03; - - if(cmd == 0x00) {//beacon interrupt - //send beacon packet - skb = ieee80211_get_beacon(priv->ieee80211); - - if(!skb){ - DMESG("not enought memory for allocating beacon"); - return; - } - skb->cb[0] = BEACON_PRIORITY; - skb->cb[1] = 0; - skb->cb[2] = ieeerate2rtlrate(priv->ieee80211->basic_rate); - ret = rtl8192_tx(dev, skb); - - if( ret != 0 ){ - printk(KERN_ALERT "tx beacon packet error : %d !\n", ret); - } - dev_kfree_skb_any(skb); - } else {//0x00 - //{ log the device information - // At present, It is not implemented just now. - //} - } -#endif } void rtl8192_irq_rx_tasklet(struct r8192_priv *priv) @@ -6833,39 +5800,22 @@ static const struct net_device_ops rtl8192_netdev_ops = { ---------------------------- USB_STUFF--------------------------- *****************************************************************************/ -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) static int __devinit rtl8192_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) -#else -static void * __devinit rtl8192_usb_probe(struct usb_device *udev, - unsigned int ifnum, - const struct usb_device_id *id) -#endif { // unsigned long ioaddr = 0; struct net_device *dev = NULL; struct r8192_priv *priv= NULL; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) struct usb_device *udev = interface_to_usbdev(intf); -#endif RT_TRACE(COMP_INIT, "Oops: i'm coming\n"); dev = alloc_ieee80211(sizeof(struct r8192_priv)); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - SET_MODULE_OWNER(dev); -#endif -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) usb_set_intfdata(intf, dev); SET_NETDEV_DEV(dev, &intf->dev); -#endif priv = ieee80211_priv(dev); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) priv->ieee80211 = netdev_priv(dev); -#else - priv->ieee80211 = (struct net_device *)dev->priv; -#endif priv->udev=udev; dev->netdev_ops = &rtl8192_netdev_ops; @@ -6888,12 +5838,10 @@ static void * __devinit rtl8192_usb_probe(struct usb_device *udev, } RT_TRACE(COMP_INIT, "Driver probe completed1\n"); -#if 1 if(rtl8192_init(dev)!=0){ RT_TRACE(COMP_ERR, "Initialization failed"); goto fail; } -#endif netif_carrier_off(dev); netif_stop_queue(dev); @@ -6903,22 +5851,14 @@ static void * __devinit rtl8192_usb_probe(struct usb_device *udev, RT_TRACE(COMP_INIT, "Driver probe completed\n"); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) - return dev; -#else return 0; -#endif fail: free_ieee80211(dev); RT_TRACE(COMP_ERR, "wlan driver load failed\n"); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) - return NULL; -#else return -ENODEV; -#endif } @@ -6926,38 +5866,19 @@ fail: void rtl8192_cancel_deferred_work(struct r8192_priv* priv) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) cancel_work_sync(&priv->reset_wq); cancel_delayed_work(&priv->watch_dog_wq); cancel_delayed_work(&priv->update_beacon_wq); cancel_work_sync(&priv->qos_activate); //cancel_work_sync(&priv->SetBWModeWorkItem); //cancel_work_sync(&priv->SwChnlWorkItem); -#else -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -// cancel_delayed_work(&priv->reset_wq); - cancel_delayed_work(&priv->watch_dog_wq); - cancel_delayed_work(&priv->update_beacon_wq); -// cancel_delayed_work(&priv->qos_activate); - //cancel_delayed_work(&priv->SetBWModeWorkItem); - //cancel_delayed_work(&priv->SwChnlWorkItem); -#endif -#endif } -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) static void __devexit rtl8192_usb_disconnect(struct usb_interface *intf) -#else -static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr) -#endif { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) struct net_device *dev = usb_get_intfdata(intf); -#else - struct net_device *dev = (struct net_device *)ptr; -#endif struct r8192_priv *priv = ieee80211_priv(dev); if(dev){ @@ -6976,9 +5897,7 @@ static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr) // priv->rf_close(dev); // rtl8192_SetRFPowerState(dev, eRfOff); rtl8192_usb_deleteendpoints(dev); -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) destroy_workqueue(priv->priv_wq); -#endif //rtl8192_irq_disable(dev); //rtl8192_reset(dev); mdelay(10); @@ -7075,7 +5994,6 @@ void EnableHWSecurityConfig8192(struct net_device *dev) struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); struct ieee80211_device* ieee = priv->ieee80211; SECR_value = SCR_TxEncEnable | SCR_RxDecEnable; -#if 1 if (((KEY_TYPE_WEP40 == ieee->pairwise_key_type) || (KEY_TYPE_WEP104 == ieee->pairwise_key_type)) && (priv->ieee80211->auth_mode != 2)) { SECR_value |= SCR_RxUseDK; @@ -7086,7 +6004,6 @@ void EnableHWSecurityConfig8192(struct net_device *dev) SECR_value |= SCR_RxUseDK; SECR_value |= SCR_TxUseDK; } -#endif //add HWSec active enable here. //default using hwsec. when peer AP is in N mode only and pairwise_key_type is none_aes(which HT_IOT_ACT_PURE_N_MODE indicates it), use software security. when peer AP is in b,g,n mode mixed and pairwise_key_type is none_aes, use g mode hw security. WB on 2008.7.4 diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 9c2505a0015b..2dde9fa5c21e 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -24,25 +24,11 @@ Major Change History: // // Indicate different AP vendor for IOT issue. // -#if 0 -typedef enum _HT_IOT_PEER -{ - HT_IOT_PEER_UNKNOWN = 0, - HT_IOT_PEER_REALTEK = 1, - HT_IOT_PEER_BROADCOM = 2, - HT_IOT_PEER_RALINK = 3, - HT_IOT_PEER_ATHEROS = 4, - HT_IOT_PEER_CISCO = 5, - HT_IOT_PEER_MAX = 6 -}HT_IOT_PEER_E, *PHTIOT_PEER_E; -#endif -#if 1 static u32 edca_setting_DL[HT_IOT_PEER_MAX] = { 0x5e4322, 0x5e4322, 0x5e4322, 0x604322, 0xa44f, 0x5ea44f}; static u32 edca_setting_UL[HT_IOT_PEER_MAX] = { 0x5e4322, 0xa44f, 0x5e4322, 0x604322, 0x5ea44f, 0x5ea44f}; -#endif #define RTK_UL_EDCA 0xa44f #define RTK_DL_EDCA 0x5e4322 @@ -71,11 +57,7 @@ extern void hal_dm_watchdog(struct net_device *dev); extern void init_rate_adaptive(struct net_device *dev); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) extern void dm_txpower_trackingcallback(struct work_struct *work); -#else -extern void dm_txpower_trackingcallback(struct net_device *dev); -#endif extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14); extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); @@ -91,15 +73,8 @@ extern void dm_force_tx_fw_info(struct net_device *dev, u32 force_value); extern void dm_init_edca_turbo(struct net_device *dev); extern void dm_rf_operation_test_callback(unsigned long data); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work); -#else -extern void dm_rf_pathcheck_workitemcallback(struct net_device *dev); -#endif extern void dm_fsync_timer_callback(unsigned long data); -#if 0 -extern bool dm_check_lbus_status(struct net_device *dev); -#endif extern void dm_check_fsync(struct net_device *dev); extern void dm_shadow_init(struct net_device *dev); @@ -498,11 +473,9 @@ static void dm_check_rate_adaptive(struct net_device * dev) } // 2008.04.01 -#if 1 // For RTL819X, if pairwisekey = wep/tkip, we support only MCS0~7. if(priv->ieee80211->GetHalfNmodeSupportByAPsHandler(dev)) targetRATR &= 0xf00fffff; -#endif // // Check whether updating of RATR0 is required @@ -884,29 +857,6 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device * dev) //========================== // this is only for test, should be masked -#if 0 -{ - //UINT32 eRFPath; - //UINT32 start_rf, end_rf; - UINT32 curr_addr; - //UINT32 reg_addr; - //UINT32 reg_addr_end; - UINT32 reg_value; - //start_rf = RF90_PATH_A; - //end_rf = RF90_PATH_B;//RF90_PATH_MAX; - //reg_addr = 0x0; - //reg_addr_end = 0x2F; - - for (curr_addr = 0; curr_addr < 0x2d; curr_addr++) - { - reg_value = PHY_QueryRFReg( Adapter, (RF90_RADIO_PATH_E)RF90_PATH_A, - curr_addr, bMaskDWord); - } - - pHalData->TXPowercount = 0; - return; -} -#endif //========================== // read and filter out unreasonable value @@ -981,17 +931,11 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device * dev) priv->txpower_count = 0; } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) extern void dm_txpower_trackingcallback(struct work_struct *work) { struct delayed_work *dwork = container_of(work,struct delayed_work,work); struct r8192_priv *priv = container_of(dwork,struct r8192_priv,txpower_tracking_wq); struct net_device *dev = priv->ieee80211->dev; -#else -extern void dm_txpower_trackingcallback(struct net_device *dev) -{ - struct r8192_priv *priv = ieee80211_priv(dev); -#endif #ifdef RTL8190P dm_TXPowerTrackingCallback_TSSI(dev); @@ -1550,15 +1494,7 @@ static void dm_CheckTXPowerTracking_TSSI(struct net_device *dev) { if((tx_power_track_counter % 30 == 0)&&(tx_power_track_counter != 0)) { - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0); - #else - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) - schedule_task(&priv->txpower_tracking_wq); - #else - queue_work(priv->priv_wq,&priv->txpower_tracking_wq); - #endif - #endif } tx_power_track_counter++; } @@ -1570,19 +1506,6 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); static u8 TM_Trigger=0; -#if 0 - u1Byte i; - u4Byte tmpRegA; - for(i=0; i<50; i++) - { - tmpRegA = PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x12, 0x078); // 0x12: RF Reg[10:7] - PHY_SetRFReg(Adapter, RF90_PATH_A, 0x02, bMask12Bits, 0x4d); - //delay_us(100); - PHY_SetRFReg(Adapter, RF90_PATH_A, 0x02, bMask12Bits, 0x4f); - //delay_us(100); - } - DbgPrint("Trigger and readback ThermalMeter, write RF reg0x2 = 0x4d to 0x4f for 50 times\n"); -#else //DbgPrint("dm_CheckTXPowerTracking() \n"); if(!priv->btxpower_tracking) return; @@ -1610,18 +1533,9 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev) else { //DbgPrint("Schedule TxPowerTrackingWorkItem\n"); - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0); - #else - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) - schedule_task(&priv->txpower_tracking_wq); - #else - queue_work(priv->priv_wq,&priv->txpower_tracking_wq); - #endif - #endif TM_Trigger = 0; } -#endif } @@ -1829,14 +1743,6 @@ extern void dm_restore_dynamic_mechanism_state(struct net_device *dev) //cosa PlatformEFIOWrite4Byte(Adapter, RATR0, ((pu4Byte)(val))[0]); write_nic_dword(dev, RATR0, ratr_value); write_nic_byte(dev, UFWP, 1); -#if 0 // Disable old code. - u1Byte index; - u4Byte input_value; - index = (u1Byte)((((pu4Byte)(val))[0]) >> 28); - input_value = (((pu4Byte)(val))[0]) & 0x0fffffff; - // TODO: Correct it. Emily 2007.01.11 - PlatformEFIOWrite4Byte(Adapter, RATR0+index*4, input_value); -#endif } //Resore TX Power Tracking Index if(priv->btxpower_trackingInit && priv->btxpower_tracking){ @@ -2099,28 +2005,6 @@ dm_change_rxpath_selection_setting( } } -#if 0 -extern void dm_force_tx_fw_info(struct net_device *dev, - u32 force_type, - u32 force_value) -{ - struct r8192_priv *priv = ieee80211_priv(dev); - - if (force_type == 0) // don't force TxSC - { - //DbgPrint("Set Force SubCarrier Off\n"); - priv->tx_fwinfo_force_subcarriermode = 0; - } - else if(force_type == 1) //force - { - //DbgPrint("Set Force SubCarrier On\n"); - priv->tx_fwinfo_force_subcarriermode = 1; - if(force_value > 3) - force_value = 3; - priv->tx_fwinfo_force_subcarrierval = (u8)force_value; - } -} -#endif /*----------------------------------------------------------------------------- * Function: dm_dig_init() @@ -2759,7 +2643,6 @@ extern void dm_init_edca_turbo(struct net_device * dev) priv->bis_cur_rdlstate = false; } // dm_init_edca_turbo -#if 1 static void dm_check_edca_turbo( struct net_device * dev) { @@ -2777,10 +2660,8 @@ static void dm_check_edca_turbo( // Do not be Turbo if it's under WiFi config and Qos Enabled, because the EDCA parameters // should follow the settings from QAP. By Bruce, 2007-12-07. // - #if 1 if(priv->ieee80211->state != IEEE80211_LINKED) goto dm_CheckEdcaTurbo_EXIT; - #endif // We do not turn on EDCA turbo mode for some AP that has IOT issue if(priv->ieee80211->pHTInfo->IOTAction & HT_IOT_ACT_DISABLE_EDCA_TURBO) goto dm_CheckEdcaTurbo_EXIT; @@ -2871,7 +2752,6 @@ dm_CheckEdcaTurbo_EXIT: lastTxOkCnt = priv->stats.txbytesunicast; lastRxOkCnt = priv->stats.rxbytesunicast; } // dm_CheckEdcaTurbo -#endif extern void DM_CTSToSelfSetting(struct net_device * dev,u32 DM_Type, u32 DM_Value) { @@ -2932,20 +2812,7 @@ static void dm_ctstoself(struct net_device *dev) } else //uplink { - #if 1 pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_CTS2SELF; - #else - if(priv->undecorated_smoothed_pwdb < priv->ieee80211->CTSToSelfTH) // disable CTS to self - { - pHTInfo->IOTAction &= ~HT_IOT_ACT_FORCED_CTS2SELF; - //DbgPrint("dm_CTSToSelf() ==> CTS to self disabled\n"); - } - else if(priv->undecorated_smoothed_pwdb >= (priv->ieee80211->CTSToSelfTH+5)) // enable CTS to self - { - pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_CTS2SELF; - //DbgPrint("dm_CTSToSelf() ==> CTS to self enabled\n"); - } - #endif } lastTxOkCnt = priv->stats.txbytesunicast; @@ -2954,79 +2821,6 @@ static void dm_ctstoself(struct net_device *dev) } -#if 0 -/*----------------------------------------------------------------------------- - * Function: dm_rf_operation_test_callback() - * - * Overview: Only for RF operation test now. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 05/29/2008 amy Create Version 0 porting from windows code. - * - *---------------------------------------------------------------------------*/ -extern void dm_rf_operation_test_callback(unsigned long dev) -{ -// struct r8192_priv *priv = ieee80211_priv((struct net_device *)dev); - u8 erfpath; - - - for(erfpath=0; erfpath<4; erfpath++) - { - //DbgPrint("Set RF-%d\n\r", eRFPath); - //PHY_SetRFReg(Adapter, (RF90_RADIO_PATH_E)eRFPath, 0x2c, bMask12Bits, 0x3d7); - udelay(100); - } - - { - //PlatformSetPeriodicTimer(Adapter, &pHalData->RfTest1Timer, 500); - } - - // For test - { - //u8 i; - //PlatformSetPeriodicTimer(Adapter, &pHalData->RfTest1Timer, 500); -#if 0 - for(i=0; i<50; i++) - { - // Write Test - PHY_SetRFReg(Adapter, RF90_PATH_A, 0x02, bMask12Bits, 0x4d); - //delay_us(100); - PHY_SetRFReg(Adapter, RF90_PATH_A, 0x02, bMask12Bits, 0x4f); - //delay_us(100); - PHY_SetRFReg(Adapter, RF90_PATH_C, 0x02, bMask12Bits, 0x4d); - //delay_us(100); - PHY_SetRFReg(Adapter, RF90_PATH_C, 0x02, bMask12Bits, 0x4f); - //delay_us(100); - -#if 0 - // Read test - PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x02, bMask12Bits); - //delay_us(100); - PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x02, bMask12Bits); - //delay_us(100); - PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x12, bMask12Bits); - //delay_us(100); - PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x12, bMask12Bits); - //delay_us(100); - PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x21, bMask12Bits); - //delay_us(100); - PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x21, bMask12Bits); - //delay_us(100); -#endif - } -#endif - } - -} /* DM_RfOperationTestCallBack */ -#endif - /*----------------------------------------------------------------------------- * Function: dm_check_rfctrl_gpio() * @@ -3043,7 +2837,6 @@ extern void dm_rf_operation_test_callback(unsigned long dev) * 05/28/2008 amy Create Version 0 porting from windows code. * *---------------------------------------------------------------------------*/ -#if 1 static void dm_check_rfctrl_gpio(struct net_device * dev) { //struct r8192_priv *priv = ieee80211_priv(dev); @@ -3060,20 +2853,11 @@ static void dm_check_rfctrl_gpio(struct net_device * dev) return; #endif #ifdef RTL8192E - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) queue_delayed_work(priv->priv_wq,&priv->gpio_change_rf_wq,0); - #else - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) - schedule_task(&priv->gpio_change_rf_wq); - #else - queue_work(priv->priv_wq,&priv->gpio_change_rf_wq); - #endif - #endif #endif } /* dm_CheckRfCtrlGPIO */ -#endif /*----------------------------------------------------------------------------- * Function: dm_check_pbc_gpio() * @@ -3129,17 +2913,11 @@ static void dm_check_pbc_gpio(struct net_device *dev) * 02/21/2008 MHC Create Version 0. * *---------------------------------------------------------------------------*/ - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) extern void dm_gpio_change_rf_callback(struct work_struct *work) { struct delayed_work *dwork = container_of(work,struct delayed_work,work); struct r8192_priv *priv = container_of(dwork,struct r8192_priv,gpio_change_rf_wq); struct net_device *dev = priv->ieee80211->dev; -#else -extern void dm_gpio_change_rf_callback(struct net_device *dev) -{ - struct r8192_priv *priv = ieee80211_priv(dev); -#endif u8 tmp1byte; RT_RF_POWER_STATE eRfPowerStateToSet; bool bActuallySet = false; @@ -3207,17 +2985,11 @@ extern void dm_gpio_change_rf_callback(struct net_device *dev) * 01/30/2008 MHC Create Version 0. * *---------------------------------------------------------------------------*/ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work) { struct delayed_work *dwork = container_of(work,struct delayed_work,work); struct r8192_priv *priv = container_of(dwork,struct r8192_priv,rfpath_check_wq); struct net_device *dev =priv->ieee80211->dev; -#else -extern void dm_rf_pathcheck_workitemcallback(struct net_device *dev) -{ - struct r8192_priv *priv = ieee80211_priv(dev); -#endif //bool bactually_set = false; u8 rfpath = 0, i; @@ -3542,15 +3314,7 @@ static void dm_rxpath_sel_byrssi(struct net_device * dev) static void dm_check_rx_path_selection(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) queue_delayed_work(priv->priv_wq,&priv->rfpath_check_wq,0); -#else -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) - schedule_task(&priv->rfpath_check_wq); -#else - queue_work(priv->priv_wq,&priv->rfpath_check_wq); -#endif -#endif } /* dm_CheckRxRFPath */ @@ -3898,12 +3662,6 @@ void dm_check_fsync(struct net_device *dev) #endif reg_c38_State = RegC38_NonFsync_Other_AP; - #if 0//cosa - if (Adapter->HardwareType == HARDWARE_TYPE_RTL8190P) - DbgPrint("Fsync is idle, rssi<=35, write 0xc38 = 0x%x \n", 0x10); - else - DbgPrint("Fsync is idle, rssi<=35, write 0xc38 = 0x%x \n", 0x90); - #endif } } else if(priv->undecorated_smoothed_pwdb >= (RegC38_TH+5)) @@ -3948,50 +3706,6 @@ void dm_check_fsync(struct net_device *dev) } } -#if 0 -/*----------------------------------------------------------------------------- - * Function: DM_CheckLBusStatus() - * - * Overview: For 9x series, we must make sure LBUS is active for IO. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 02/22/2008 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ -extern s1Byte DM_CheckLBusStatus(IN PADAPTER Adapter) -{ - PMGNT_INFO pMgntInfo=&Adapter->MgntInfo; - -#if (HAL_CODE_BASE & RTL819X) - -#if (HAL_CODE_BASE == RTL8192) - -#if( DEV_BUS_TYPE==PCI_INTERFACE) - //return (pMgntInfo->bLbusEnable); // For debug only - return TRUE; -#endif - -#if( DEV_BUS_TYPE==USB_INTERFACE) - return TRUE; -#endif - -#endif // #if (HAL_CODE_BASE == RTL8192) - -#if (HAL_CODE_BASE == RTL8190) - return TRUE; -#endif // #if (HAL_CODE_BASE == RTL8190) - -#endif // #if (HAL_CODE_BASE & RTL819X) -} /* DM_CheckLBusStatus */ - -#endif /*----------------------------------------------------------------------------- * Function: dm_shadow_init() @@ -4164,14 +3878,12 @@ static void dm_send_rssi_tofw(struct net_device *dev) // 0x1e0(byte) to botify driver. write_nic_byte(dev, DRIVER_RSSI, (u8)priv->undecorated_smoothed_pwdb); return; -#if 1 tx_cmd.Op = TXCMD_SET_RX_RSSI; tx_cmd.Length = 4; tx_cmd.Value = priv->undecorated_smoothed_pwdb; cmpk_message_handle_tx(dev, (u8*)&tx_cmd, DESC_PACKET_TYPE_INIT, sizeof(DCMD_TXCMD_T)); -#endif } /*---------------------------Define function prototype------------------------*/ diff --git a/drivers/staging/rtl8192u/r8192U_dm.h b/drivers/staging/rtl8192u/r8192U_dm.h index 1a619d239dc7..3ceb59b9eca7 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.h +++ b/drivers/staging/rtl8192u/r8192U_dm.h @@ -62,50 +62,6 @@ #define Initial_Tx_Rate_Reg 0x1b9 #define Tx_Retry_Count_Reg 0x1ac #define RegC38_TH 20 -#if 0 -//---------------------------------------------------------------------------- -// 8190 Rate Adaptive Table Register (offset 0x320, 4 byte) -//---------------------------------------------------------------------------- - -//CCK -#define RATR_1M 0x00000001 -#define RATR_2M 0x00000002 -#define RATR_55M 0x00000004 -#define RATR_11M 0x00000008 -//OFDM -#define RATR_6M 0x00000010 -#define RATR_9M 0x00000020 -#define RATR_12M 0x00000040 -#define RATR_18M 0x00000080 -#define RATR_24M 0x00000100 -#define RATR_36M 0x00000200 -#define RATR_48M 0x00000400 -#define RATR_54M 0x00000800 -//MCS 1 Spatial Stream -#define RATR_MCS0 0x00001000 -#define RATR_MCS1 0x00002000 -#define RATR_MCS2 0x00004000 -#define RATR_MCS3 0x00008000 -#define RATR_MCS4 0x00010000 -#define RATR_MCS5 0x00020000 -#define RATR_MCS6 0x00040000 -#define RATR_MCS7 0x00080000 -//MCS 2 Spatial Stream -#define RATR_MCS8 0x00100000 -#define RATR_MCS9 0x00200000 -#define RATR_MCS10 0x00400000 -#define RATR_MCS11 0x00800000 -#define RATR_MCS12 0x01000000 -#define RATR_MCS13 0x02000000 -#define RATR_MCS14 0x04000000 -#define RATR_MCS15 0x08000000 -// ALL CCK Rate -#define RATE_ALL_CCK RATR_1M|RATR_2M|RATR_55M|RATR_11M -#define RATE_ALL_OFDM_AG RATR_6M|RATR_9M|RATR_12M|RATR_18M|RATR_24M\ - |RATR_36M|RATR_48M|RATR_54M -#define RATE_ALL_OFDM_2SS RATR_MCS8|RATR_MCS9 |RATR_MCS10|RATR_MCS11| \ - RATR_MCS12|RATR_MCS13|RATR_MCS14|RATR_MCS15 -#endif /*--------------------------Define Parameters-------------------------------*/ @@ -275,11 +231,7 @@ extern void deinit_hal_dm(struct net_device *dev); extern void hal_dm_watchdog(struct net_device *dev); extern void init_rate_adaptive(struct net_device *dev); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) extern void dm_txpower_trackingcallback(struct work_struct *work); -#else -extern void dm_txpower_trackingcallback(struct net_device *dev); -#endif extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); extern void dm_backup_dynamic_mechanism_state(struct net_device *dev); extern void dm_change_dynamic_initgain_thresh(struct net_device *dev, @@ -287,16 +239,9 @@ extern void dm_change_dynamic_initgain_thresh(struct net_device *dev, extern void dm_force_tx_fw_info(struct net_device *dev,u32 force_type, u32 force_value); extern void dm_init_edca_turbo(struct net_device *dev); extern void dm_rf_operation_test_callback(unsigned long data); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work); -#else -extern void dm_rf_pathcheck_workitemcallback(struct net_device *dev); -#endif extern void dm_fsync_timer_callback(unsigned long data); extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14); -#if 0 -extern char dm_check_lbus_status(IN PADAPTER Adapter); -#endif extern void dm_shadow_init(struct net_device *dev); extern void dm_initialize_txpower_tracking(struct net_device *dev); /*--------------------------Exported Function prototype---------------------*/ diff --git a/drivers/staging/rtl8192u/r8192U_hw.h b/drivers/staging/rtl8192u/r8192U_hw.h index 0f959eda8598..e89aaf70143b 100644 --- a/drivers/staging/rtl8192u/r8192U_hw.h +++ b/drivers/staging/rtl8192u/r8192U_hw.h @@ -39,15 +39,6 @@ typedef enum _BaseBand_Config_Type{ BaseBand_Config_PHY_REG = 0, //Radio Path A BaseBand_Config_AGC_TAB = 1, //Radio Path B }BaseBand_Config_Type, *PBaseBand_Config_Type; -#if 0 -typedef enum _RT_RF_TYPE_819xU{ - RF_TYPE_MIN = 0, - RF_8225, - RF_8256, - RF_8258, - RF_PSEUDO_11N = 4, -}RT_RF_TYPE_819xU, *PRT_RF_TYPE_819xU; -#endif #define RTL8187_REQT_READ 0xc0 #define RTL8187_REQT_WRITE 0x40 #define RTL8187_REQ_GET_REGS 0x05 @@ -408,332 +399,6 @@ enum _RTL8192Usb_HW { MAC4 = 0x004, MAC5 = 0x005, -#if 0 -/* 0x0006 - 0x0007 - reserved */ - RXFIFOCOUNT = 0x010, - TXFIFOCOUNT = 0x012, - BQREQ = 0x013, -/* 0x0010 - 0x0017 - reserved */ - TSFTR = 0x018, - TLPDA = 0x020, - TNPDA = 0x024, - THPDA = 0x028, - BSSID = 0x02E, - RESP_RATE = 0x034, - CMD = 0x037, -#define CMD_RST_SHIFT 4 -#define CMD_RESERVED_MASK ((1<<1) | (1<<5) | (1<<6) | (1<<7)) -#define CMD_RX_ENABLE_SHIFT 3 -#define CMD_TX_ENABLE_SHIFT 2 -#define CR_RST ((1<< 4)) -#define CR_RE ((1<< 3)) -#define CR_TE ((1<< 2)) -#define CR_MulRW ((1<< 0)) - - INTA_MASK = 0x03c, - INTA = 0x03e, -#define INTA_TXOVERFLOW (1<<15) -#define INTA_TIMEOUT (1<<14) -#define INTA_BEACONTIMEOUT (1<<13) -#define INTA_ATIM (1<<12) -#define INTA_BEACONDESCERR (1<<11) -#define INTA_BEACONDESCOK (1<<10) -#define INTA_HIPRIORITYDESCERR (1<<9) -#define INTA_HIPRIORITYDESCOK (1<<8) -#define INTA_NORMPRIORITYDESCERR (1<<7) -#define INTA_NORMPRIORITYDESCOK (1<<6) -#define INTA_RXOVERFLOW (1<<5) -#define INTA_RXDESCERR (1<<4) -#define INTA_LOWPRIORITYDESCERR (1<<3) -#define INTA_LOWPRIORITYDESCOK (1<<2) -#define INTA_RXCRCERR (1<<1) -#define INTA_RXOK (1) - TX_CONF = 0x040, -#define TX_CONF_HEADER_AUTOICREMENT_SHIFT 30 -#define TX_LOOPBACK_SHIFT 17 -#define TX_LOOPBACK_MAC 1 -#define TX_LOOPBACK_BASEBAND 2 -#define TX_LOOPBACK_NONE 0 -#define TX_LOOPBACK_CONTINUE 3 -#define TX_LOOPBACK_MASK ((1<<17)|(1<<18)) -#define TX_LRLRETRY_SHIFT 0 -#define TX_SRLRETRY_SHIFT 8 -#define TX_NOICV_SHIFT 19 -#define TX_NOCRC_SHIFT 16 -#define TCR_DurProcMode ((1<<30)) -#define TCR_DISReqQsize ((1<<28)) -#define TCR_HWVERID_MASK ((1<<27)|(1<<26)|(1<<25)) -#define TCR_HWVERID_SHIFT 25 -#define TCR_SWPLCPLEN ((1<<24)) -#define TCR_PLCP_LEN TCR_SAT // rtl8180 -#define TCR_MXDMA_MASK ((1<<23)|(1<<22)|(1<<21)) -#define TCR_MXDMA_1024 6 -#define TCR_MXDMA_2048 7 -#define TCR_MXDMA_SHIFT 21 -#define TCR_DISCW ((1<<20)) -#define TCR_ICV ((1<<19)) -#define TCR_LBK ((1<<18)|(1<<17)) -#define TCR_LBK1 ((1<<18)) -#define TCR_LBK0 ((1<<17)) -#define TCR_CRC ((1<<16)) -#define TCR_SRL_MASK ((1<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8)) -#define TCR_LRL_MASK ((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)) -#define TCR_PROBE_NOTIMESTAMP_SHIFT 29 //rtl8185 - RX_CONF = 0x044, -#define MAC_FILTER_MASK ((1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<5) | \ -(1<<12) | (1<<18) | (1<<19) | (1<<20) | (1<<21) | (1<<22) | (1<<23)) -#define RX_CHECK_BSSID_SHIFT 23 -#define ACCEPT_PWR_FRAME_SHIFT 22 -#define ACCEPT_MNG_FRAME_SHIFT 20 -#define ACCEPT_CTL_FRAME_SHIFT 19 -#define ACCEPT_DATA_FRAME_SHIFT 18 -#define ACCEPT_ICVERR_FRAME_SHIFT 12 -#define ACCEPT_CRCERR_FRAME_SHIFT 5 -#define ACCEPT_BCAST_FRAME_SHIFT 3 -#define ACCEPT_MCAST_FRAME_SHIFT 2 -#define ACCEPT_ALLMAC_FRAME_SHIFT 0 -#define ACCEPT_NICMAC_FRAME_SHIFT 1 -#define RX_FIFO_THRESHOLD_MASK ((1<<13) | (1<<14) | (1<<15)) -#define RX_FIFO_THRESHOLD_SHIFT 13 -#define RX_FIFO_THRESHOLD_128 3 -#define RX_FIFO_THRESHOLD_256 4 -#define RX_FIFO_THRESHOLD_512 5 -#define RX_FIFO_THRESHOLD_1024 6 -#define RX_FIFO_THRESHOLD_NONE 7 -#define RX_AUTORESETPHY_SHIFT 28 -#define MAX_RX_DMA_MASK ((1<<8) | (1<<9) | (1<<10)) -#define MAX_RX_DMA_2048 7 -#define MAX_RX_DMA_1024 6 -#define MAX_RX_DMA_SHIFT 10 -#define RCR_ONLYERLPKT ((1<<31)) -#define RCR_CS_SHIFT 29 -#define RCR_CS_MASK ((1<<30) | (1<<29)) -#define RCR_ENMARP ((1<<28)) -#define RCR_CBSSID ((1<<23)) -#define RCR_APWRMGT ((1<<22)) -#define RCR_ADD3 ((1<<21)) -#define RCR_AMF ((1<<20)) -#define RCR_ACF ((1<<19)) -#define RCR_ADF ((1<<18)) -#define RCR_RXFTH ((1<<15)|(1<<14)|(1<<13)) -#define RCR_RXFTH2 ((1<<15)) -#define RCR_RXFTH1 ((1<<14)) -#define RCR_RXFTH0 ((1<<13)) -#define RCR_AICV ((1<<12)) -#define RCR_MXDMA ((1<<10)|(1<< 9)|(1<< 8)) -#define RCR_MXDMA2 ((1<<10)) -#define RCR_MXDMA1 ((1<< 9)) -#define RCR_MXDMA0 ((1<< 8)) -#define RCR_9356SEL ((1<< 6)) -#define RCR_ACRC32 ((1<< 5)) -#define RCR_AB ((1<< 3)) -#define RCR_AM ((1<< 2)) -#define RCR_APM ((1<< 1)) -#define RCR_AAP ((1<< 0)) - INT_TIMEOUT = 0x048, - TX_BEACON_RING_ADDR = 0x04c, - EPROM_CMD = 0x58, -#define EPROM_CMD_RESERVED_MASK ((1<<5)|(1<<4)) -#define EPROM_CMD_OPERATING_MODE_SHIFT 6 -#define EPROM_CMD_OPERATING_MODE_MASK ((1<<7)|(1<<6)) -#define EPROM_CMD_CONFIG 0x3 -#define EPROM_CMD_NORMAL 0 -#define EPROM_CMD_LOAD 1 -#define EPROM_CMD_PROGRAM 2 -#define EPROM_CS_SHIFT 3 -#define EPROM_CK_SHIFT 2 -#define EPROM_W_SHIFT 1 -#define EPROM_R_SHIFT 0 - CONFIG0 = 0x051, -#define CONFIG0_WEP104 ((1<<6)) -#define CONFIG0_LEDGPO_En ((1<<4)) -#define CONFIG0_Aux_Status ((1<<3)) -#define CONFIG0_GL ((1<<1)|(1<<0)) -#define CONFIG0_GL1 ((1<<1)) -#define CONFIG0_GL0 ((1<<0)) - CONFIG1 = 0x052, -#define CONFIG1_LEDS ((1<<7)|(1<<6)) -#define CONFIG1_LEDS1 ((1<<7)) -#define CONFIG1_LEDS0 ((1<<6)) -#define CONFIG1_LWACT ((1<<4)) -#define CONFIG1_MEMMAP ((1<<3)) -#define CONFIG1_IOMAP ((1<<2)) -#define CONFIG1_VPD ((1<<1)) -#define CONFIG1_PMEn ((1<<0)) - CONFIG2 = 0x053, -#define CONFIG2_LCK ((1<<7)) -#define CONFIG2_ANT ((1<<6)) -#define CONFIG2_DPS ((1<<3)) -#define CONFIG2_PAPE_sign ((1<<2)) -#define CONFIG2_PAPE_time ((1<<1)|(1<<0)) -#define CONFIG2_PAPE_time1 ((1<<1)) -#define CONFIG2_PAPE_time0 ((1<<0)) - ANA_PARAM = 0x054, - CONFIG3 = 0x059, -#define CONFIG3_GNTSel ((1<<7)) -#define CONFIG3_PARM_En ((1<<6)) -#define CONFIG3_Magic ((1<<5)) -#define CONFIG3_CardB_En ((1<<3)) -#define CONFIG3_CLKRUN_En ((1<<2)) -#define CONFIG3_FuncRegEn ((1<<1)) -#define CONFIG3_FBtbEn ((1<<0)) -#define CONFIG3_CLKRUN_SHIFT 2 -#define CONFIG3_ANAPARAM_W_SHIFT 6 - CONFIG4 = 0x05a, -#define CONFIG4_VCOPDN ((1<<7)) -#define CONFIG4_PWROFF ((1<<6)) -#define CONFIG4_PWRMGT ((1<<5)) -#define CONFIG4_LWPME ((1<<4)) -#define CONFIG4_LWPTN ((1<<2)) -#define CONFIG4_RFTYPE ((1<<1)|(1<<0)) -#define CONFIG4_RFTYPE1 ((1<<1)) -#define CONFIG4_RFTYPE0 ((1<<0)) - TESTR = 0x05b, -#define TFPC_AC 0x05C - -#define SCR 0x05F - PGSELECT = 0x05e, -#define PGSELECT_PG_SHIFT 0 - SECURITY = 0x05f, -#define SECURITY_WEP_TX_ENABLE_SHIFT 1 -#define SECURITY_WEP_RX_ENABLE_SHIFT 0 -#define SECURITY_ENCRYP_104 1 -#define SECURITY_ENCRYP_SHIFT 4 -#define SECURITY_ENCRYP_MASK ((1<<4)|(1<<5)) - ANA_PARAM2 = 0x060, - BEACON_INTERVAL = 0x070, -#define BEACON_INTERVAL_MASK ((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)| \ -(1<<6)|(1<<7)|(1<<8)|(1<<9)) - ATIM_WND = 0x072, -#define ATIM_WND_MASK (0x01FF) - BCN_INTR_ITV = 0x074, -#define BCN_INTR_ITV_MASK (0x01FF) - ATIM_INTR_ITV = 0x076, -#define ATIM_INTR_ITV_MASK (0x01FF) - AckTimeOutReg = 0x079, //ACK timeout register, in unit of 4 us. - PHY_ADR = 0x07c, - PHY_READ = 0x07e, - RFPinsOutput = 0x080, - RFPinsEnable = 0x082, - -//Page 0 - RFPinsSelect = 0x084, -#define SW_CONTROL_GPIO 0x400 - RFPinsInput = 0x086, - RF_PARA = 0x088, - RF_TIMING = 0x08c, - GP_ENABLE = 0x090, - GPIO = 0x091, - TX_AGC_CTL = 0x09c, -#define TX_AGC_CTL_PER_PACKET_TXAGC 0x01 -#define TX_AGC_CTL_PERPACKET_GAIN_SHIFT 0 -#define TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT 1 -#define TX_AGC_CTL_FEEDBACK_ANT 2 -#define TXAGC_CTL_PER_PACKET_ANT_SEL 0x02 - OFDM_TXAGC = 0x09e, - ANTSEL = 0x09f, - WPA_CONFIG = 0x0b0, - SIFS = 0x0b4, - DIFS = 0x0b5, - SLOT = 0x0b6, - CW_CONF = 0x0bc, -#define CW_CONF_PERPACKET_RETRY_LIMIT 0x02 -#define CW_CONF_PERPACKET_CW 0x01 -#define CW_CONF_PERPACKET_RETRY_SHIFT 1 -#define CW_CONF_PERPACKET_CW_SHIFT 0 - CW_VAL = 0x0bd, - RATE_FALLBACK = 0x0be, -#define MAX_RESP_RATE_SHIFT 4 -#define MIN_RESP_RATE_SHIFT 0 -#define RATE_FALLBACK_CTL_ENABLE 0x80 -#define RATE_FALLBACK_CTL_AUTO_STEP0 0x00 - ACM_CONTROL = 0x0BF, // ACM Control Registe -//---------------------------------------------------------------------------- -// 8187B ACM_CONTROL bits (Offset 0xBF, 1 Byte) -//---------------------------------------------------------------------------- -#define VOQ_ACM_EN (0x01 << 7) //BIT7 -#define VIQ_ACM_EN (0x01 << 6) //BIT6 -#define BEQ_ACM_EN (0x01 << 5) //BIT5 -#define ACM_HW_EN (0x01 << 4) //BIT4 -#define TXOPSEL (0x01 << 3) //BIT3 -#define VOQ_ACM_CTL (0x01 << 2) //BIT2 // Set to 1 when AC_VO used time reaches or exceeds the admitted time -#define VIQ_ACM_CTL (0x01 << 1) //BIT1 // Set to 1 when AC_VI used time reaches or exceeds the admitted time -#define BEQ_ACM_CTL (0x01 << 0) //BIT0 // Set to 1 when AC_BE used time reaches or exceeds the admitted time - CONFIG5 = 0x0D8, -#define CONFIG5_TX_FIFO_OK ((1<<7)) -#define CONFIG5_RX_FIFO_OK ((1<<6)) -#define CONFIG5_CALON ((1<<5)) -#define CONFIG5_EACPI ((1<<2)) -#define CONFIG5_LANWake ((1<<1)) -#define CONFIG5_PME_STS ((1<<0)) - TX_DMA_POLLING = 0x0d9, -#define TX_DMA_POLLING_BEACON_SHIFT 7 -#define TX_DMA_POLLING_HIPRIORITY_SHIFT 6 -#define TX_DMA_POLLING_NORMPRIORITY_SHIFT 5 -#define TX_DMA_POLLING_LOWPRIORITY_SHIFT 4 -#define TX_DMA_STOP_BEACON_SHIFT 3 -#define TX_DMA_STOP_HIPRIORITY_SHIFT 2 -#define TX_DMA_STOP_NORMPRIORITY_SHIFT 1 -#define TX_DMA_STOP_LOWPRIORITY_SHIFT 0 - CWR = 0x0DC, - RetryCTR = 0x0DE, - INT_MIG = 0x0E2, // Interrupt Migration (0xE2 ~ 0xE3) - TID_AC_MAP = 0x0E8, // TID to AC Mapping Register - ANA_PARAM3 = 0x0EE, - - -//page 1 - Wakeup0 = 0x084, - Wakeup1 = 0x08C, - Wakeup2LD = 0x094, - Wakeup2HD = 0x09C, - Wakeup3LD = 0x0A4, - Wakeup3HD = 0x0AC, - Wakeup4LD = 0x0B4, - Wakeup4HD = 0x0BC, - CRC0 = 0x0C4, - CRC1 = 0x0C6, - CRC2 = 0x0C8, - CRC3 = 0x0CA, - CRC4 = 0x0CC, -/* 0x00CE - 0x00D3 - reserved */ - - RFSW_CTRL = 0x272, // 0x272-0x273. - -//Reg Diff between rtl8187 and rtl8187B -/**************************************************************************/ - BRSR_8187 = 0x02C, - BRSR_8187B = 0x034, -#define BRSR_BPLCP ((1<< 8)) -#define BRSR_MBR ((1<< 1)|(1<< 0)) -#define BRSR_MBR_8185 ((1<< 11)|(1<< 10)|(1<< 9)|(1<< 8)|(1<< 7)|(1<< 6)|(1<< 5)|(1<< 4)|(1<< 3)|(1<< 2)|(1<< 1)|(1<< 0)) -#define BRSR_MBR0 ((1<< 0)) -#define BRSR_MBR1 ((1<< 1)) - -/**************************************************************************/ - EIFS_8187 = 0x035, - EIFS_8187B = 0x02D, - -/**************************************************************************/ - FER = 0x0F0, - FEMR = 0x0F4, - FPSR = 0x0F8, - FFER = 0x0FC, - - AC_VO_PARAM = 0x0F0, // AC_VO Parameters Record - AC_VI_PARAM = 0x0F4, // AC_VI Parameters Record - AC_BE_PARAM = 0x0F8, // AC_BE Parameters Record - AC_BK_PARAM = 0x0FC, // AC_BK Parameters Record - TALLY_SEL = 0x0fc, -//---------------------------------------------------------------------------- -// 8187B AC_XX_PARAM bits -//---------------------------------------------------------------------------- -#define AC_PARAM_TXOP_LIMIT_OFFSET 16 -#define AC_PARAM_ECW_MAX_OFFSET 12 -#define AC_PARAM_ECW_MIN_OFFSET 8 -#define AC_PARAM_AIFS_OFFSET 0 - -#endif }; //---------------------------------------------------------------------------- // 818xB AnaParm & AnaParm2 Register diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index 1c953c73f73d..25d5c870b0fb 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -44,40 +44,6 @@ static int r8192_wx_get_freq(struct net_device *dev, } -#if 0 - -static int r8192_wx_set_beaconinterval(struct net_device *dev, struct iw_request_info *aa, - union iwreq_data *wrqu, char *b) -{ - int *parms = (int *)b; - int bi = parms[0]; - - struct r8192_priv *priv = ieee80211_priv(dev); - - down(&priv->wx_sem); - DMESG("setting beacon interval to %x",bi); - - priv->ieee80211->beacon_interval=bi; - rtl8180_commit(dev); - up(&priv->wx_sem); - - return 0; -} - - -static int r8192_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa, - union iwreq_data *wrqu, char *extra) -{ - struct r8192_priv *priv=ieee80211_priv(dev); - int *parms = (int *)extra; - - priv->ieee80211->force_associate = (parms[0] > 0); - - - return 0; -} - -#endif static int r8192_wx_get_mode(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *b) { @@ -215,10 +181,6 @@ static int r8192_wx_read_bb(struct net_device *dev, { struct r8192_priv *priv = ieee80211_priv(dev); u8 databb; -#if 0 - int i; - for(i=0;i<12;i++) printk("%8x\n", read_cam(dev, i) ); -#endif down(&priv->wx_sem); @@ -316,14 +278,6 @@ static int r8192_wx_get_ap_status(struct net_device *dev, -#endif -#if 0 -static int r8192_wx_null(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - return 0; -} #endif static int r8192_wx_force_reset(struct net_device *dev, struct iw_request_info *info, @@ -937,24 +891,12 @@ exit: } #if (WIRELESS_EXT >= 18) -#if 0 -static int r8192_wx_get_enc_ext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct r8192_priv *priv = ieee80211_priv(dev); - int ret = 0; - ret = ieee80211_wx_get_encode_ext(priv->ieee80211, info, wrqu, extra); - return ret; -} -#endif //hw security need to reorganized. static int r8192_wx_set_enc_ext(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { int ret=0; - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) struct r8192_priv *priv = ieee80211_priv(dev); struct ieee80211_device* ieee = priv->ieee80211; //printk("===>%s()\n", __FUNCTION__); @@ -969,13 +911,6 @@ static int r8192_wx_set_enc_ext(struct net_device *dev, u32 key[4] = {0}; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; struct iw_point *encoding = &wrqu->encoding; -#if 0 - static u8 CAM_CONST_ADDR[4][6] = { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x03}}; -#endif u8 idx = 0, alg = 0, group = 0; if ((encoding->flags & IW_ENCODE_DISABLED) || ext->alg == IW_ENCODE_ALG_NONE) //none is not allowed to use hwsec WB 2008.07.01 @@ -1035,7 +970,6 @@ static int r8192_wx_set_enc_ext(struct net_device *dev, end_hw_sec: up(&priv->wx_sem); -#endif return ret; } @@ -1044,13 +978,11 @@ static int r8192_wx_set_auth(struct net_device *dev, union iwreq_data *data, char *extra) { int ret=0; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) //printk("====>%s()\n", __FUNCTION__); struct r8192_priv *priv = ieee80211_priv(dev); down(&priv->wx_sem); ret = ieee80211_wx_set_auth(priv->ieee80211, info, &(data->param), extra); up(&priv->wx_sem); -#endif return ret; } @@ -1061,13 +993,11 @@ static int r8192_wx_set_mlme(struct net_device *dev, //printk("====>%s()\n", __FUNCTION__); int ret=0; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) struct r8192_priv *priv = ieee80211_priv(dev); down(&priv->wx_sem); ret = ieee80211_wx_set_mlme(priv->ieee80211, info, wrqu, extra); up(&priv->wx_sem); -#endif return ret; } #endif @@ -1077,15 +1007,11 @@ static int r8192_wx_set_gen_ie(struct net_device *dev, { //printk("====>%s(), len:%d\n", __FUNCTION__, data->length); int ret=0; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) struct r8192_priv *priv = ieee80211_priv(dev); down(&priv->wx_sem); -#if 1 ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, data->data.length); -#endif up(&priv->wx_sem); //printk("<======%s(), ret:%d\n", __FUNCTION__, ret); -#endif return ret; @@ -1271,11 +1197,7 @@ struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev) wstats->qual.qual = 0; wstats->qual.level = 0; wstats->qual.noise = 0; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)) wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; -#else - wstats->qual.updated = 0x0f; -#endif return wstats; } @@ -1287,11 +1209,7 @@ struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev) wstats->qual.level = tmp_level; wstats->qual.qual = tmp_qual; wstats->qual.noise = tmp_noise; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)) wstats->qual.updated = IW_QUAL_ALL_UPDATED| IW_QUAL_DBM; -#else - wstats->qual.updated = 0x0f; -#endif return wstats; } //#endif diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.c b/drivers/staging/rtl8192u/r819xU_cmdpkt.c index e9a0eb832838..fd19a85297a9 100644 --- a/drivers/staging/rtl8192u/r819xU_cmdpkt.c +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.c @@ -318,42 +318,11 @@ cmpk_handle_tx_feedback( /* It seems that FW use big endian(MIPS) and DRV use little endian in windows OS. So we have to read the content byte by byte or transfer endian type before copy the message copy. */ -#if 0 // The TX FEEDBACK packet element address - //rx_tx_fb.Element_ID = pMsg[0]; - //rx_tx_fb.Length = pMsg[1]; - rx_tx_fb.TOK = pMsg[2]>>7; - rx_tx_fb.Fail_Reason = (pMsg[2] & 0x70) >> 4; - rx_tx_fb.TID = (pMsg[2] & 0x0F); - rx_tx_fb.Qos_Pkt = pMsg[3] >> 7; - rx_tx_fb.Bandwidth = (pMsg[3] & 0x40) >> 6; - rx_tx_fb.Retry_Cnt = pMsg[5]; - rx_tx_fb.Pkt_ID = (pMsg[6] << 8) | pMsg[7]; - rx_tx_fb.Seq_Num = (pMsg[8] << 8) | pMsg[9]; - rx_tx_fb.S_Rate = pMsg[10]; - rx_tx_fb.F_Rate = pMsg[11]; - rx_tx_fb.S_RTS_Rate = pMsg[12]; - rx_tx_fb.F_RTS_Rate = pMsg[13]; - rx_tx_fb.pkt_length = (pMsg[14] << 8) | pMsg[15]; -#endif /* 2007/07/05 MH Use pointer to transfer structure memory. */ //memcpy((UINT8 *)&rx_tx_fb, pMsg, sizeof(CMPK_TXFB_T)); memcpy((u8*)&rx_tx_fb, pmsg, sizeof(cmpk_txfb_t)); /* 2. Use tx feedback info to count TX statistics. */ cmpk_count_txstatistic(dev, &rx_tx_fb); -#if 0 - /* 2007/07/11 MH Assign current operate rate. */ - if (pAdapter->RegWirelessMode == WIRELESS_MODE_A || - pAdapter->RegWirelessMode == WIRELESS_MODE_B || - pAdapter->RegWirelessMode == WIRELESS_MODE_G) - { - pMgntInfo->CurrentOperaRate = (rx_tx_fb.F_Rate & 0x7F); - } - else if (pAdapter->RegWirelessMode == WIRELESS_MODE_N_24G || - pAdapter->RegWirelessMode == WIRELESS_MODE_N_5G) - { - pMgntInfo->HTCurrentOperaRate = (rx_tx_fb.F_Rate & 0x8F); - } -#endif /* 2007/01/17 MH Comment previous method for TX statistic function. */ /* Collect info TX feedback packet to fill TCB. */ /* We can not know the packet length and transmit type: broadcast or uni diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.h b/drivers/staging/rtl8192u/r819xU_cmdpkt.h index 34fbdcf1be79..a8855e61b0e5 100644 --- a/drivers/staging/rtl8192u/r819xU_cmdpkt.h +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.h @@ -13,16 +13,6 @@ #define ISR_TxBcnErr BIT26 // Transmit Beacon Error #define ISR_BcnTimerIntr BIT13 // Beacon Timer Interrupt -#if 0 -/* Define packet type. */ -typedef enum tag_packet_type -{ - PACKET_BROADCAST, - PACKET_MULTICAST, - PACKET_UNICAST, - PACKET_TYPE_MAX -}cmpk_pkt_type_e; -#endif /* Define element ID of command packet. */ diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c index 20d78f461127..3cc2d571f9bd 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.c +++ b/drivers/staging/rtl8192u/r819xU_firmware.c @@ -16,9 +16,7 @@ #include "r8192U_hw.h" #include "r819xU_firmware_img.h" #include "r819xU_firmware.h" -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) #include -#endif void firmware_init_param(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -107,12 +105,6 @@ bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buff return rt_status; -#if 0 -cmdsend_downloadcode_fail: - rt_status = false; - RT_TRACE(COMP_ERR, "CmdSendDownloadCode fail !!\n"); - return rt_status; -#endif } bool @@ -154,52 +146,6 @@ fwSendNullPacket( return rtStatus; } -#if 0 -/* - * Procedure : Download code into IMEM or DMEM - * Description: This routine will intialize firmware. If any error occurs during the initialization - * process, the routine shall terminate immediately and return fail. - * The routine copy virtual address get from opening of file into shared memory - * allocated during initialization. If code size larger than a conitneous shared - * memory may contain, the code should be divided into several section. - * !!!NOTES This finction should only be called during MPInitialization because - * A NIC driver should call NdisOpenFile only from MiniportInitialize. - * Arguments : The pointer of the adapter - * Code address (Virtual address, should fill descriptor with physical address) - * Code size - * Returns : - * RT_STATUS_FAILURE - the following initialization process should be terminated - * RT_STATUS_SUCCESS - if firmware initialization process success - */ -bool fwsend_download_code(struct net_device *dev) -{ - struct r8192_priv *priv = ieee80211_priv(dev); - rt_firmware *pfirmware = (rt_firmware*)(&priv->firmware); - - bool rt_status = true; - u16 length = 0; - u16 offset = 0; - u16 frag_threhold; - bool last_init_packet = false; - u32 check_txcmdwait_queueemptytime = 100000; - u16 cmd_buf_len; - u8 *ptr_cmd_buf; - - /* reset to 0 for first segment of img download */ - pfirmware->firmware_seg_index = 1; - - if(pfirmware->firmware_seg_index == pfirmware->firmware_seg_maxnum) { - last_init_packet = 1; - } - - cmd_buf_len = pfirmware->firmware_seg_container[pfirmware->firmware_seg_index-1].seg_size; - ptr_cmd_buf = pfirmware->firmware_seg_container[pfirmware->firmware_seg_index-1].seg_ptr; - rtl819xU_tx_cmd(dev, ptr_cmd_buf, cmd_buf_len, last_init_packet, DESC_PACKET_TYPE_INIT); - - rt_status = true; - return rt_status; -} -#endif //----------------------------------------------------------------------------- // Procedure: Check whether main code is download OK. If OK, turn on CPU @@ -338,11 +284,7 @@ bool init_firmware(struct net_device *dev) * Download boot, main, and data image for System reset. * Download data image for firmware reseta */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) - priv->firmware_source = FW_SOURCE_HEADER_FILE; -#else priv->firmware_source = FW_SOURCE_IMG_FILE; -#endif for(init_step = starting_state; init_step <= FW_INIT_STEP2_DATA; init_step++) { /* * Open Image file, and map file to contineous memory if open file success. @@ -351,7 +293,6 @@ bool init_firmware(struct net_device *dev) if(rst_opt == OPT_SYSTEM_RESET) { switch(priv->firmware_source) { case FW_SOURCE_IMG_FILE: - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) rc = request_firmware(&fw_entry, fw_name[init_step],&priv->udev->dev); if(rc < 0 ) { RT_TRACE(COMP_ERR, "request firmware fail!\n"); @@ -380,7 +321,6 @@ bool init_firmware(struct net_device *dev) #endif } pfirmware->firmware_buf_size = file_length; - #endif break; case FW_SOURCE_HEADER_FILE: @@ -411,11 +351,9 @@ bool init_firmware(struct net_device *dev) * and Tx descriptor info * */ rt_status = fw_download_code(dev,mapped_file,file_length); - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) if(rst_opt == OPT_SYSTEM_RESET) { release_firmware(fw_entry); } - #endif if(rt_status != TRUE) { goto download_firmware_fail; @@ -487,214 +425,10 @@ download_firmware_fail: } -#if 0 -/* - * Procedure: (1) Transform firmware code from little endian to big endian if required. - * (2) Number of bytes in Firmware downloading should be multiple - * of 4 bytes. If length is not multiple of 4 bytes, appending of zeros is required - * - */ -void CmdAppendZeroAndEndianTransform( - u1Byte *pDst, - u1Byte *pSrc, - u2Byte *pLength) -{ - u2Byte ulAppendBytes = 0, i; - u2Byte ulLength = *pLength; -//test only - //memset(pDst, 0xcc, 12); - /* Transform from little endian to big endian */ -//#if DEV_BUS_TYPE==PCI_INTERFACE -#if 0 - for( i=0 ; i<(*pLength) ; i+=4) - { - if((i+3) < (*pLength)) pDst[i+0] = pSrc[i+3]; - if((i+2) < (*pLength)) pDst[i+1] = pSrc[i+2]; - if((i+1) < (*pLength)) pDst[i+2] = pSrc[i+1]; - if((i+0) < (*pLength)) pDst[i+3] = pSrc[i+0]; - } -#else - pDst += USB_HWDESC_HEADER_LEN; - ulLength -= USB_HWDESC_HEADER_LEN; - - for( i=0 ; i0) - { - ulAppendBytes = 4-((*pLength) % 4); - - for(i=0 ; iFragLength[0] = (u2Byte)pTcb->BufferList[0].Length; - - QueueID=pTcb->SpecifiedQueueID; -#if DEV_BUS_TYPE!=USB_INTERFACE - firstDesc=curDesc=Adapter->NextTxDescToFill[QueueID]; -#endif -#if DEV_BUS_TYPE!=USB_INTERFACE - if(VacancyTxDescNum(Adapter, QueueID) > pTcb->BufferCount) -#else - if(PlatformIsTxQueueAvailable(Adapter, QueueID, pTcb->BufferCount) && - RTIsListEmpty(&Adapter->TcbWaitQueue[QueueID])) -#endif - { - pTcb->nDescUsed=0; - - for(i=0 ; iBufferCount ; i++) - { - Adapter->HalFunc.TxFillCmdDescHandler( - Adapter, - pTcb, - QueueID, //QueueIndex - curDesc, //index - FragBufferIndex==0, //bFirstSeg - FragBufferIndex==(pTcb->FragBufCount[FragIndex]-1), //bLastSeg - pTcb->BufferList[i].VirtualAddress, //VirtualAddress - pTcb->BufferList[i].PhysicalAddressLow, //PhyAddressLow - pTcb->BufferList[i].Length, //BufferLen - i!=0, //bSetOwnBit - (i==(pTcb->BufferCount-1)) && bLastInitPacket, //bLastInitPacket - PacketType, //DescPacketType - pTcb->FragLength[FragIndex] //PktLen - ); - - if(FragBufferIndex==(pTcb->FragBufCount[FragIndex]-1)) - { // Last segment of the fragment. - pTcb->nFragSent++; - } - - FragBufferIndex++; - if(FragBufferIndex==pTcb->FragBufCount[FragIndex]) - { - FragIndex++; - FragBufferIndex=0; - } - -#if DEV_BUS_TYPE!=USB_INTERFACE - curDesc=(curDesc+1)%Adapter->NumTxDesc[QueueID]; -#endif - pTcb->nDescUsed++; - } - -#if DEV_BUS_TYPE!=USB_INTERFACE - RTInsertTailList(&Adapter->TcbBusyQueue[QueueID], &pTcb->List); - IncrementTxDescToFill(Adapter, QueueID, pTcb->nDescUsed); - Adapter->HalFunc.SetTxDescOWNHandler(Adapter, QueueID, firstDesc); - // TODO: should call poll use QueueID - Adapter->HalFunc.TxPollingHandler(Adapter, TXCMD_QUEUE); -#endif - } - else -#if DEV_BUS_TYPE!=USB_INTERFACE - goto CmdSendPacket_Fail; -#else - { - pTcb->bLastInitPacket = bLastInitPacket; - RTInsertTailList(&Adapter->TcbWaitQueue[pTcb->SpecifiedQueueID], &pTcb->List); - } -#endif - - return rtStatus; - -#if DEV_BUS_TYPE!=USB_INTERFACE -CmdSendPacket_Fail: - rtStatus = RT_STATUS_FAILURE; - return rtStatus; -#endif - -} -#endif - - - - -#if 0 -RT_STATUS -FWSendNullPacket( - IN PADAPTER Adapter, - IN u4Byte Length -) -{ - RT_STATUS rtStatus = RT_STATUS_SUCCESS; - - - PRT_TCB pTcb; - PRT_TX_LOCAL_BUFFER pBuf; - BOOLEAN bLastInitPacket = FALSE; - - PlatformAcquireSpinLock(Adapter, RT_TX_SPINLOCK); - -#if DEV_BUS_TYPE==USB_INTERFACE - Length += USB_HWDESC_HEADER_LEN; -#endif - - //Get TCB and local buffer from common pool. (It is shared by CmdQ, MgntQ, and USB coalesce DataQ) - if(MgntGetBuffer(Adapter, &pTcb, &pBuf)) - { - PlatformZeroMemory(pBuf->Buffer.VirtualAddress, Length); - rtStatus = CmdSendPacket(Adapter, pTcb, pBuf, Length, DESC_PACKET_TYPE_INIT, bLastInitPacket); //0 : always set LastInitPacket to zero -//#if HAL_CODE_BASE != RTL8190HW -// // TODO: for test only -// ReturnTCB(Adapter, pTcb, RT_STATUS_SUCCESS); -//#endif - if(rtStatus == RT_STATUS_FAILURE) - goto CmdSendNullPacket_Fail; - }else - goto CmdSendNullPacket_Fail; - - PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK); - return rtStatus; - - -CmdSendNullPacket_Fail: - PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK); - rtStatus = RT_STATUS_FAILURE; - RT_ASSERT(rtStatus == RT_STATUS_SUCCESS, ("CmdSendDownloadCode fail !!\n")); - return rtStatus; -} -#endif diff --git a/drivers/staging/rtl8192u/r819xU_firmware.h b/drivers/staging/rtl8192u/r819xU_firmware.h index 5e561081cf36..a4bceeef33d3 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.h +++ b/drivers/staging/rtl8192u/r819xU_firmware.h @@ -23,46 +23,5 @@ typedef enum _opt_rst_type{ OPT_FIRMWARE_RESET = 1, }opt_rst_type_e; -#if 0 -/* CPU related */ -RT_STATUS -CPUCheckMainCodeOKAndTurnOnCPU( - IN PADAPTER Adapter - ); - -RT_STATUS -CPUCheckFirmwareReady( - IN PADAPTER Adapter - ); - -/* Firmware related */ -VOID -FWInitializeParameters( - IN PADAPTER Adapter - ); - -RT_STATUS -FWSendDownloadCode( - IN PADAPTER Adapter, - IN pu1Byte CodeVirtualAddrress, - IN u4Byte BufferLen - ); - -RT_STATUS -FWSendNullPacket( - IN PADAPTER Adapter, - IN u4Byte Length - ); - -RT_STATUS -CmdSendPacket( - PADAPTER Adapter, - PRT_TCB pTcb, - PRT_TX_LOCAL_BUFFER pBuf, - u4Byte BufferLen, - u4Byte PacketType, - BOOLEAN bLastInitPacket - ); -#endif #endif diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index beeab51a2c3b..a3adaedece9a 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -1079,18 +1079,6 @@ bool rtl8192_SetRFPowerState(struct net_device *dev, RT_RF_POWER_STATE eRFPowerS switch( eRFPowerState ) { case eRfOn: -#if 0 - rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, BIT4, 0x1); // 0x860[4] - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter4, 0x300, 0x3); // 0x88c[4] - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x60, 0x3); // 0x880[6:5] - rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0xf, 0x3); // 0xc04[3:0] - rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0xf, 0x3); // 0xd04[3:0] - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter2, 0x7000, 0x3); // 0x884[14:12] - // for(eRFPath = 0; eRFPath NumTotalRFPath; eRFPath++) - // PHY_SetRFReg(Adapter, (RF90_RADIO_PATH_E)eRFPath, 0x4, 0xC00, 0x2); - - //SwChnl(Adapter->ChannelID); -#endif //RF-A, RF-B //enable RF-Chip A/B rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, BIT4, 0x1); // 0x860[4] @@ -1112,16 +1100,6 @@ bool rtl8192_SetRFPowerState(struct net_device *dev, RT_RF_POWER_STATE eRFPowerS break; case eRfOff: -#if 0 - rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, BIT4, 0x0); // 0x860[4] - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter4, 0x300, 0x0); // 0x88c[4] - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x60, 0x0); // 0x880[6:5] - rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0xf, 0); // 0xc04[3:0] - rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0xf, 0); // 0xd04[3:0] - rtl8192_setBBreg(dev, rFPGA0_AnalogParameter2, 0x7000, 0x0); // 0x884[14:12] - // for(eRFPath = 0; eRFPath NumTotalRFPath; eRFPath++) - // PHY_SetRFReg(Adapter, (RF90_RADIO_PATH_E)eRFPath, 0x4, 0xC00, 0x0); -#endif //RF-A, RF-B //disable RF-Chip A/B rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, BIT4, 0x0); // 0x860[4] @@ -1582,11 +1560,6 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x00100000, 1); // Correct the tx power for CCK rate in 20M. Suggest by YN, 20071207 -#if 0 - write_nic_dword(dev, rCCK0_TxFilter1, 0x1a1b0000); - write_nic_dword(dev, rCCK0_TxFilter2, 0x090e1317); - write_nic_dword(dev, rCCK0_DebugPort, 0x00000204); -#endif priv->cck_present_attentuation = priv->cck_present_attentuation_20Mdefault + priv->cck_present_attentuation_difference; @@ -1617,12 +1590,6 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) rtl8192_setBBreg(dev, rCCK0_System, bCCKSideBand, (priv->nCur40MhzPrimeSC>>1)); rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x00100000, 0); rtl8192_setBBreg(dev, rOFDM1_LSTF, 0xC00, priv->nCur40MhzPrimeSC); -#if 0 - // Correct the tx power for CCK rate in 40M. Suggest by YN, 20071207 - write_nic_dword(dev, rCCK0_TxFilter1, 0x35360000); - write_nic_dword(dev, rCCK0_TxFilter2, 0x121c252e); - write_nic_dword(dev, rCCK0_DebugPort, 0x00000409); -#endif priv->cck_present_attentuation = priv->cck_present_attentuation_40Mdefault + priv->cck_present_attentuation_difference; @@ -1653,7 +1620,6 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) } //Skip over setting of J-mode in BB register here. Default value is "None J mode". Emily 20070315 -#if 1 //<3>Set RF related register switch( priv->rf_chip ) { @@ -1679,7 +1645,6 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) RT_TRACE(COMP_ERR, "Unknown RFChipID: %d\n", priv->rf_chip); break; } -#endif priv->SetBWModeInProgress= false; RT_TRACE(COMP_SWBW, "<==SetBWMode819xUsb(), %d", atomic_read(&(priv->ieee80211->atm_swbw)) ); @@ -1726,29 +1691,15 @@ void InitialGain819xUsb(struct net_device *dev, u8 Operation) if(priv->up) { - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) queue_delayed_work(priv->priv_wq,&priv->initialgain_operate_wq,0); - #else - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) - schedule_task(&priv->initialgain_operate_wq); - #else - queue_work(priv->priv_wq,&priv->initialgain_operate_wq); - #endif - #endif } } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) extern void InitialGainOperateWorkItemCallBack(struct work_struct *work) { struct delayed_work *dwork = container_of(work,struct delayed_work,work); struct r8192_priv *priv = container_of(dwork,struct r8192_priv,initialgain_operate_wq); struct net_device *dev = priv->ieee80211->dev; -#else -extern void InitialGainOperateWorkItemCallBack(struct net_device *dev) -{ - struct r8192_priv *priv = ieee80211_priv(dev); -#endif #define SCAN_RX_INITIAL_GAIN 0x17 #define POWER_DETECTION_TH 0x08 u32 BitMask; diff --git a/drivers/staging/rtl8192u/r819xU_phy.h b/drivers/staging/rtl8192u/r819xU_phy.h index c165ac1265d9..3e3bc577e6c3 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.h +++ b/drivers/staging/rtl8192u/r819xU_phy.h @@ -85,10 +85,6 @@ extern bool rtl8192_SetRFPowerState(struct net_device *dev, RT_RF_POWER_STATE eR //added by amy extern void InitialGain819xUsb(struct net_device *dev, u8 Operation); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) extern void InitialGainOperateWorkItemCallBack(struct work_struct *work); -#else -extern void InitialGainOperateWorkItemCallBack(struct net_device *dev); -#endif #endif -- GitLab From 6638db58dbb831fa66ac583644d34ae3cf662431 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Wed, 11 Nov 2009 09:31:23 -0800 Subject: [PATCH 226/235] Staging: rtl8192u: depends on USB rtl8192u uses usb_* interfaces so it should depend on USB. ERROR: "usb_kill_urb" [drivers/staging/rtl8192u/r8192u_usb.ko] undefined! ERROR: "usb_deregister" [drivers/staging/rtl8192u/r8192u_usb.ko] undefined! ERROR: "usb_control_msg" [drivers/staging/rtl8192u/r8192u_usb.ko] undefined! ERROR: "usb_submit_urb" [drivers/staging/rtl8192u/r8192u_usb.ko] undefined! ERROR: "usb_register_driver" [drivers/staging/rtl8192u/r8192u_usb.ko] undefined! ERROR: "usb_free_urb" [drivers/staging/rtl8192u/r8192u_usb.ko] undefined! ERROR: "usb_alloc_urb" [drivers/staging/rtl8192u/r8192u_usb.ko] undefined! Signed-off-by: Randy Dunlap Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/Kconfig b/drivers/staging/rtl8192u/Kconfig index 808a088903c1..9913ab8fb359 100644 --- a/drivers/staging/rtl8192u/Kconfig +++ b/drivers/staging/rtl8192u/Kconfig @@ -1,6 +1,6 @@ config RTL8192U tristate "RealTek RTL8192U Wireless LAN NIC driver" - depends on PCI && WLAN + depends on PCI && WLAN && USB depends on WIRELESS_EXT default N ---help--- -- GitLab From 5beef3c9bf7f967a4a70ddb0108fd3e459fed133 Mon Sep 17 00:00:00 2001 From: Andrew Lunn Date: Mon, 9 Nov 2009 21:20:10 +0100 Subject: [PATCH 227/235] staging: batman-adv meshing protocol B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is a routing protocol for multi-hop ad-hoc mesh networks. The networks may be wired or wireless. See http://www.open-mesh.org/ for more information and user space tools. This is the first submission for inclusion in staging. Signed-off-by: Andrew Lunn Signed-off-by: Greg Kroah-Hartman --- drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/batman-adv/CHANGELOG | 37 + drivers/staging/batman-adv/Kconfig | 25 + drivers/staging/batman-adv/Makefile | 22 + drivers/staging/batman-adv/README | 125 ++ drivers/staging/batman-adv/TODO | 51 + drivers/staging/batman-adv/aggregation.c | 232 ++++ drivers/staging/batman-adv/aggregation.h | 37 + drivers/staging/batman-adv/bitarray.c | 177 +++ drivers/staging/batman-adv/bitarray.h | 45 + drivers/staging/batman-adv/compat.h | 75 ++ drivers/staging/batman-adv/device.c | 337 ++++++ drivers/staging/batman-adv/device.h | 36 + drivers/staging/batman-adv/hard-interface.c | 451 ++++++++ drivers/staging/batman-adv/hard-interface.h | 36 + drivers/staging/batman-adv/hash.c | 313 +++++ drivers/staging/batman-adv/hash.h | 99 ++ drivers/staging/batman-adv/log.c | 179 +++ drivers/staging/batman-adv/log.h | 32 + drivers/staging/batman-adv/main.c | 286 +++++ drivers/staging/batman-adv/main.h | 151 +++ drivers/staging/batman-adv/packet.h | 96 ++ drivers/staging/batman-adv/proc.c | 950 ++++++++++++++++ drivers/staging/batman-adv/proc.h | 49 + drivers/staging/batman-adv/ring_buffer.c | 52 + drivers/staging/batman-adv/ring_buffer.h | 23 + drivers/staging/batman-adv/routing.c | 1010 +++++++++++++++++ drivers/staging/batman-adv/routing.h | 34 + drivers/staging/batman-adv/send.c | 473 ++++++++ drivers/staging/batman-adv/send.h | 36 + drivers/staging/batman-adv/soft-interface.c | 349 ++++++ drivers/staging/batman-adv/soft-interface.h | 33 + .../staging/batman-adv/translation-table.c | 454 ++++++++ .../staging/batman-adv/translation-table.h | 42 + drivers/staging/batman-adv/types.h | 124 ++ drivers/staging/batman-adv/vis.c | 564 +++++++++ drivers/staging/batman-adv/vis.h | 63 + 38 files changed, 7101 insertions(+) create mode 100644 drivers/staging/batman-adv/CHANGELOG create mode 100644 drivers/staging/batman-adv/Kconfig create mode 100644 drivers/staging/batman-adv/Makefile create mode 100644 drivers/staging/batman-adv/README create mode 100644 drivers/staging/batman-adv/TODO create mode 100644 drivers/staging/batman-adv/aggregation.c create mode 100644 drivers/staging/batman-adv/aggregation.h create mode 100644 drivers/staging/batman-adv/bitarray.c create mode 100644 drivers/staging/batman-adv/bitarray.h create mode 100644 drivers/staging/batman-adv/compat.h create mode 100644 drivers/staging/batman-adv/device.c create mode 100644 drivers/staging/batman-adv/device.h create mode 100644 drivers/staging/batman-adv/hard-interface.c create mode 100644 drivers/staging/batman-adv/hard-interface.h create mode 100644 drivers/staging/batman-adv/hash.c create mode 100644 drivers/staging/batman-adv/hash.h create mode 100644 drivers/staging/batman-adv/log.c create mode 100644 drivers/staging/batman-adv/log.h create mode 100644 drivers/staging/batman-adv/main.c create mode 100644 drivers/staging/batman-adv/main.h create mode 100644 drivers/staging/batman-adv/packet.h create mode 100644 drivers/staging/batman-adv/proc.c create mode 100644 drivers/staging/batman-adv/proc.h create mode 100644 drivers/staging/batman-adv/ring_buffer.c create mode 100644 drivers/staging/batman-adv/ring_buffer.h create mode 100644 drivers/staging/batman-adv/routing.c create mode 100644 drivers/staging/batman-adv/routing.h create mode 100644 drivers/staging/batman-adv/send.c create mode 100644 drivers/staging/batman-adv/send.h create mode 100644 drivers/staging/batman-adv/soft-interface.c create mode 100644 drivers/staging/batman-adv/soft-interface.h create mode 100644 drivers/staging/batman-adv/translation-table.c create mode 100644 drivers/staging/batman-adv/translation-table.h create mode 100644 drivers/staging/batman-adv/types.h create mode 100644 drivers/staging/batman-adv/vis.c create mode 100644 drivers/staging/batman-adv/vis.h diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 6fbbedbc7fe7..d30fa451e6f3 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -129,6 +129,8 @@ source "drivers/staging/wlags49_h2/Kconfig" source "drivers/staging/wlags49_h25/Kconfig" +source "drivers/staging/batman-adv/Kconfig" + source "drivers/staging/strip/Kconfig" source "drivers/staging/arlan/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 61a81c148c9f..910e55dd7914 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_IIO) += iio/ obj-$(CONFIG_RAMZSWAP) += ramzswap/ obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/ obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/ +obj-$(CONFIG_BATMAN_ADV) += batman-adv/ obj-$(CONFIG_STRIP) += strip/ obj-$(CONFIG_ARLAN) += arlan/ obj-$(CONFIG_WAVELAN) += wavelan/ diff --git a/drivers/staging/batman-adv/CHANGELOG b/drivers/staging/batman-adv/CHANGELOG new file mode 100644 index 000000000000..8a181639ceaa --- /dev/null +++ b/drivers/staging/batman-adv/CHANGELOG @@ -0,0 +1,37 @@ +batman-adv 0.2: + +* support latest kernels (2.6.20 - 2.6.31) +* temporary routing loops / TTL code bug / ghost entries in originator table fixed +* internal packet queue for packet aggregation & transmission retry (ARQ) + for payload broadcasts added +* interface detection converted to event based handling to avoid timers +* major linux coding style adjustments applied +* all kernel version compatibility functions has been moved to compat.h +* use random ethernet address generator from the kernel +* /sys/module/batman_adv/version to export kernel module version +* vis: secondary interface export for dot draw format + JSON output format added +* many bugs (alignment issues, race conditions, deadlocks, etc) squashed + + -- Sat, 07 Nov 2009 15:44:31 +0100 + +batman-adv 0.1: + +* support latest kernels (2.6.20 - 2.6.28) +* LOTS of cleanup: locking, stack usage, memory leaks +* Change Ethertype from 0x0842 to 0x4305 + unregistered at IEEE, if you want to sponsor an official Ethertype ($2500) + please contact us + + -- Sun, 28 Dec 2008 00:44:31 +0100 + +batman-adv 0.1-beta: + +* layer 2 meshing based on BATMAN TQ algorithm in kernelland +* operates on any ethernet like interface +* supports IPv4, IPv6, DHCP, etc +* is controlled via /proc/net/batman-adv/ +* bridging via brctl is supported +* interface watchdog (interfaces can be (de)activated dynamically) +* offers integrated vis server which meshes/syncs with other vis servers in range + + -- Mon, 05 May 2008 14:10:04 +0200 diff --git a/drivers/staging/batman-adv/Kconfig b/drivers/staging/batman-adv/Kconfig new file mode 100644 index 000000000000..b9742e7c7d9e --- /dev/null +++ b/drivers/staging/batman-adv/Kconfig @@ -0,0 +1,25 @@ +# +# B.A.T.M.A.N meshing protocol +# + +config BATMAN_ADV + tristate "B.A.T.M.A.N. Advanced Meshing Protocol" + default n + ---help--- + + B.A.T.M.A.N. (better approach to mobile ad-hoc networking) is + a routing protocol for multi-hop ad-hoc mesh networks. The + networks may be wired or wireless. See + http://www.open-mesh.org/ for more information and user space + tools. + +config BATMAN_DEBUG + bool "B.A.T.M.A.N. debugging" + depends on BATMAN != n + help + + This is an option for use by developers; most people should + say N here. This enables compilation of support for + outputting debugging information to the kernel log. The + output is controlled via the module parameter debug. + diff --git a/drivers/staging/batman-adv/Makefile b/drivers/staging/batman-adv/Makefile new file mode 100644 index 000000000000..02da87134fce --- /dev/null +++ b/drivers/staging/batman-adv/Makefile @@ -0,0 +1,22 @@ +# +# Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: +# +# Marek Lindner, Simon Wunderlich +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of version 2 of the GNU General Public +# License as published by the Free Software Foundation. +# +# 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 +# + +obj-m += batman-adv.o +batman-adv-objs := main.o proc.o send.o routing.o soft-interface.o device.o translation-table.o bitarray.o hash.o ring_buffer.o vis.o hard-interface.o aggregation.o log.o diff --git a/drivers/staging/batman-adv/README b/drivers/staging/batman-adv/README new file mode 100644 index 000000000000..3aaf393ebaa7 --- /dev/null +++ b/drivers/staging/batman-adv/README @@ -0,0 +1,125 @@ +[state: 07-11-2009] + +BATMAN-ADV +---------- + +Batman-advanced is a new approach to wireless networking which does no longer +operate on the IP basis. Unlike B.A.T.M.A.N, which exchanges information +using UDP packets and sets routing tables, batman-advanced operates on ISO/OSI +Layer 2 only and uses and routes (or better: bridges) Ethernet Frames. It +emulates a virtual network switch of all nodes participating. Therefore all +nodes appear to be link local, thus all higher operating protocols won't be +affected by any changes within the network. You can run almost any protocol +above B.A.T.M.A.N. Advanced, prominent examples are: IPv4, IPv6, DHCP, IPX. + +This is batman-advanced implemented as Linux kernel driver. It does not depend +on any network (other) driver, and can be used on wifi as well as ethernet, +vpn, etc ... (anything with ethernet-style layer 2). +It compiles against and should work with Linux 2.6.20 - 2.6.31. Supporting older +versions is not planned, but it's probably easy to backport it. If you work on a +backport, feel free to contact us. :-) + +COMPILE +------- +To compile against your currently installed kernel, just type: + +# make + +if you want to compile against some other kernel, use: + +# make KERNELPATH=/path/to/kernel + +USAGE +----- + +insmod the batman-adv.ko in your kernel: + +# insmod batman-adv.ko + +the module is now waiting for activation. You must add some interfaces +on which batman can operate. Each interface must be added separately: + +# echo wlan0 > /proc/net/batman-adv/interfaces + +( # echo wlan1 > /proc/net/batman-adv/interfaces ) +( # echo eth0 > /proc/net/batman-adv/interfaces ) +( ... ) + +Now batman starts broadcasting on this interface. +You can now view the table of originators (mesh participants) with: + +# cat /proc/net/batman-adv/originators + +The module will create a new interface "bat0", which can be used as a +regular interface: + +# ifconfig bat0 inet 192.168.0.1 up +# ping 192.168.0.2 +... + +If you want topology visualization, your meshnode must be configured +as VIS-server: + +# echo "server" > /proc/net/batman-adv/vis + +Each node is either configured as "server" or as "client" (default: +"client"). Clients send their topology data to the server next to them, +and server synchronize with other servers. If there is no server +configured (default) within the mesh, no topology information will be +transmitted. With these "synchronizing servers", there can be 1 or +more vis servers sharing the same (or at least very similar) data. + +When configured as server, you can get a topology snapshot of your mesh: + +# cat /proc/net/batman-adv/vis + +This output format is a graphviz formatted text file which can be +processed with graphviz-tools like dot. +The labels are similar/compatible to the ETX metric, 1.0 means perfect +connection (100%), 2.0 means 50%, 3.0 means 33% and so on. + +Alternatively, a JSON output format is available. The format can be set +using by writing either "dot_draw" or "json" into the vis_format file. +"dot_draw" is selected by default. + +echo "json" > /proc/net/batman-adv/vis_format + +In very mobile scenarios, you might want to adjust the originator +interval to a lower value. This will make the mesh more responsive to +topology changes, but will also increase the overhead. Please make sure +that all nodes in your mesh use the same interval. The default value +is 1000 ms (1 second). + +# echo 1000 > /proc/net/batman-adv/orig_interval + +To deactivate batman, do: + +# echo "" > /proc/net/batman-adv/interfaces + +BATCTL +------ + +B.A.T.M.A.N. advanced operates on layer 2 and thus all hosts partici- +pating in the virtual switch are completely transparent for all proto- +cols above layer 2. Therefore the common diagnosis tools do not work as +expected. To overcome these problems batctl was created. At the moment +the batctl contains ping, traceroute, tcpdump and interfaces to the +kernel module settings. + +For more information, please see the manpage (man batctl). + +batctl is available on http://www.open-mesh.net/ + +CONTACT +------- + +Please send us comments, experiences, questions, anything :) + +IRC: #batman on irc.freenode.org +Mailing-list: b.a.t.m.a.n@open-mesh.net +(subscription at https://list.open-mesh.net/mm/listinfo/b.a.t.m.a.n ) + +You can also contact the Authors: + +Marek Lindner +Simon Wunderlich diff --git a/drivers/staging/batman-adv/TODO b/drivers/staging/batman-adv/TODO new file mode 100644 index 000000000000..ea6dcf94d661 --- /dev/null +++ b/drivers/staging/batman-adv/TODO @@ -0,0 +1,51 @@ +=> proc interface +* implement new interface to add/delete interfaces and setting options +* /proc/sys/net/batman-adv/ as main folder +* in interfaces/ list every available interface of the host +* each interfaces/$iface/ contains the following files: +-> enable (def: 0) [add/remove this interface to batman-adv] +-> ogm_interval (def: 1000) [ogm interval of that interface] +-> context (def: bat0) [later we want to support multiple mesh instances via +-> bat0/bat1/bat2/..] +-> status (read-only) [outputs the interface status from batman's +-> perspective] +* in mesh/batX/ list every available mesh subnet +-> vis_server (def: 0) [enable/disable vis server for that mesh] +-> vis_data (read-only) [outputs the vis data in a raw format] +-> aggregate_ogm (def: 1) [enable/disable ogm aggregation for that mesh] +-> originators (read-only) [outputs the originator table] +-> transtable_global (read-only) [outputs the global translation table] +-> transtable_local (read-only) [outputs the local translation table] + +=> vis "raw" data output +* the raw format shall replace dot draw / json to offer a neutral that can +* be converted +* the format (comma seperated entries): +-> "mac" -> mac address of an originator (each line begins with it) +-> "TQ mac value" -> src mac's link quality towards mac address +-> "HNA mac" -> HNA announced by source mac +-> "PRIMARY" -> this is a primary interface +-> "SEC mac" -> secondary mac address of source (requires preceeding +-> PRIMARY) + +=> logging +* the log level LOG_TYPE_CRIT, LOG_TYPE_WARN & LOG_TYPE_NOTICE will be +* unified to use printk +* LOG_TYPE_BATMAN & LOG_TYPE_ROUTES will also use printk but only after the +* internal debug level has been raised +* the internal debug level can be modified using a module parameter (debug) +* or at run time via /sys/module/batman-adv/parameters/debug +* make use of printk %pM support instead of converting mac addresses +* manually + +=> strip out all backward compatibility support to older kernels + (only found in compat.h) + +=> fix checkpatch.pl errors + +Please send all patches to: + Marek Lindner + Simon Wunderlich + Andrew Lunn + b.a.t.m.a.n@lists.open-mesh.net + Greg Kroah-Hartman diff --git a/drivers/staging/batman-adv/aggregation.c b/drivers/staging/batman-adv/aggregation.c new file mode 100644 index 000000000000..9c6e681f6fb6 --- /dev/null +++ b/drivers/staging/batman-adv/aggregation.c @@ -0,0 +1,232 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include "main.h" +#include "aggregation.h" +#include "send.h" +#include "routing.h" + +/* calculate the size of the hna information for a given packet */ +static int hna_len(struct batman_packet *batman_packet) +{ + return batman_packet->num_hna * ETH_ALEN; +} + +/* return true if new_packet can be aggregated with forw_packet */ +static bool can_aggregate_with(struct batman_packet *new_batman_packet, + int packet_len, + unsigned long send_time, + bool directlink, + struct batman_if *if_incoming, + struct forw_packet *forw_packet) +{ + struct batman_packet *batman_packet = + (struct batman_packet *)forw_packet->packet_buff; + int aggregated_bytes = forw_packet->packet_len + packet_len; + + /** + * we can aggregate the current packet to this aggregated packet + * if: + * + * - the send time is within our MAX_AGGREGATION_MS time + * - the resulting packet wont be bigger than + * MAX_AGGREGATION_BYTES + */ + + if (time_before(send_time, forw_packet->send_time) && + (aggregated_bytes <= MAX_AGGREGATION_BYTES)) { + + /** + * check aggregation compatibility + * -> direct link packets are broadcasted on + * their interface only + * -> aggregate packet if the current packet is + * a "global" packet as well as the base + * packet + */ + + /* packets without direct link flag and high TTL + * are flooded through the net */ + if ((!directlink) && + (!(batman_packet->flags & DIRECTLINK)) && + (batman_packet->ttl != 1) && + + /* own packets originating non-primary + * interfaces leave only that interface */ + ((!forw_packet->own) || + (forw_packet->if_incoming->if_num == 0))) + return true; + + /* if the incoming packet is sent via this one + * interface only - we still can aggregate */ + if ((directlink) && + (new_batman_packet->ttl == 1) && + (forw_packet->if_incoming == if_incoming)) + return true; + + } + + return false; +} + +/* create a new aggregated packet and add this packet to it */ +static void new_aggregated_packet(unsigned char *packet_buff, + int packet_len, + unsigned long send_time, + bool direct_link, + struct batman_if *if_incoming, + int own_packet) +{ + struct forw_packet *forw_packet_aggr; + + forw_packet_aggr = kmalloc(sizeof(struct forw_packet), GFP_ATOMIC); + if (!forw_packet_aggr) + return; + + forw_packet_aggr->packet_buff = kmalloc(MAX_AGGREGATION_BYTES, + GFP_ATOMIC); + if (!forw_packet_aggr->packet_buff) { + kfree(forw_packet_aggr); + return; + } + + INIT_HLIST_NODE(&forw_packet_aggr->list); + + forw_packet_aggr->packet_len = packet_len; + memcpy(forw_packet_aggr->packet_buff, + packet_buff, + forw_packet_aggr->packet_len); + + forw_packet_aggr->own = own_packet; + forw_packet_aggr->if_incoming = if_incoming; + forw_packet_aggr->num_packets = 0; + forw_packet_aggr->direct_link_flags = 0; + forw_packet_aggr->send_time = send_time; + + /* save packet direct link flag status */ + if (direct_link) + forw_packet_aggr->direct_link_flags |= 1; + + /* add new packet to packet list */ + spin_lock(&forw_bat_list_lock); + hlist_add_head(&forw_packet_aggr->list, &forw_bat_list); + spin_unlock(&forw_bat_list_lock); + + /* start timer for this packet */ + INIT_DELAYED_WORK(&forw_packet_aggr->delayed_work, + send_outstanding_bat_packet); + queue_delayed_work(bat_event_workqueue, + &forw_packet_aggr->delayed_work, + send_time - jiffies); +} + +/* aggregate a new packet into the existing aggregation */ +static void aggregate(struct forw_packet *forw_packet_aggr, + unsigned char *packet_buff, + int packet_len, + bool direct_link) +{ + memcpy((forw_packet_aggr->packet_buff + forw_packet_aggr->packet_len), + packet_buff, packet_len); + forw_packet_aggr->packet_len += packet_len; + forw_packet_aggr->num_packets++; + + /* save packet direct link flag status */ + if (direct_link) + forw_packet_aggr->direct_link_flags |= + (1 << forw_packet_aggr->num_packets); +} + +void add_bat_packet_to_list(unsigned char *packet_buff, int packet_len, + struct batman_if *if_incoming, char own_packet, + unsigned long send_time) +{ + /** + * _aggr -> pointer to the packet we want to aggregate with + * _pos -> pointer to the position in the queue + */ + struct forw_packet *forw_packet_aggr = NULL, *forw_packet_pos = NULL; + struct hlist_node *tmp_node; + struct batman_packet *batman_packet = + (struct batman_packet *)packet_buff; + bool direct_link = batman_packet->flags & DIRECTLINK ? 1 : 0; + + /* find position for the packet in the forward queue */ + spin_lock(&forw_bat_list_lock); + /* own packets are not to be aggregated */ + if ((atomic_read(&aggregation_enabled)) && (!own_packet)) { + hlist_for_each_entry(forw_packet_pos, tmp_node, &forw_bat_list, + list) { + if (can_aggregate_with(batman_packet, + packet_len, + send_time, + direct_link, + if_incoming, + forw_packet_pos)) { + forw_packet_aggr = forw_packet_pos; + break; + } + } + } + + /* nothing to aggregate with - either aggregation disabled or no + * suitable aggregation packet found */ + if (forw_packet_aggr == NULL) { + /* the following section can run without the lock */ + spin_unlock(&forw_bat_list_lock); + new_aggregated_packet(packet_buff, packet_len, + send_time, direct_link, + if_incoming, own_packet); + } else { + aggregate(forw_packet_aggr, + packet_buff, packet_len, + direct_link); + spin_unlock(&forw_bat_list_lock); + } +} + +/* unpack the aggregated packets and process them one by one */ +void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff, + int packet_len, struct batman_if *if_incoming) +{ + struct batman_packet *batman_packet; + int buff_pos = 0; + unsigned char *hna_buff; + + batman_packet = (struct batman_packet *)packet_buff; + + while (aggregated_packet(buff_pos, packet_len, + batman_packet->num_hna)) { + + /* network to host order for our 16bit seqno, and the + orig_interval. */ + batman_packet->seqno = ntohs(batman_packet->seqno); + + hna_buff = packet_buff + buff_pos + BAT_PACKET_LEN; + receive_bat_packet(ethhdr, batman_packet, + hna_buff, hna_len(batman_packet), + if_incoming); + + buff_pos += BAT_PACKET_LEN + hna_len(batman_packet); + batman_packet = (struct batman_packet *) + (packet_buff + buff_pos); + } +} diff --git a/drivers/staging/batman-adv/aggregation.h b/drivers/staging/batman-adv/aggregation.h new file mode 100644 index 000000000000..6da8df9f99b7 --- /dev/null +++ b/drivers/staging/batman-adv/aggregation.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include "main.h" + +/* is there another aggregated packet here? */ +static inline int aggregated_packet(int buff_pos, int packet_len, int num_hna) +{ + int next_buff_pos = buff_pos + BAT_PACKET_LEN + (num_hna * ETH_ALEN); + + return (next_buff_pos <= packet_len) && + (next_buff_pos <= MAX_AGGREGATION_BYTES); +} + +void add_bat_packet_to_list(unsigned char *packet_buff, int packet_len, + struct batman_if *if_outgoing, char own_packet, + unsigned long send_time); +void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff, + int packet_len, struct batman_if *if_incoming); diff --git a/drivers/staging/batman-adv/bitarray.c b/drivers/staging/batman-adv/bitarray.c new file mode 100644 index 000000000000..3c67f5f42b2b --- /dev/null +++ b/drivers/staging/batman-adv/bitarray.c @@ -0,0 +1,177 @@ +/* + * Copyright (C) 2006-2009 B.A.T.M.A.N. contributors: + * + * Simon Wunderlich, Marek Lindner + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include "main.h" +#include "bitarray.h" +#include "log.h" + +/* returns true if the corresponding bit in the given seq_bits indicates true + * and curr_seqno is within range of last_seqno */ +uint8_t get_bit_status(TYPE_OF_WORD *seq_bits, uint16_t last_seqno, + uint16_t curr_seqno) +{ + int16_t diff, word_offset, word_num; + + diff = last_seqno - curr_seqno; + if (diff < 0 || diff >= TQ_LOCAL_WINDOW_SIZE) { + return 0; + } else { + /* which word */ + word_num = (last_seqno - curr_seqno) / WORD_BIT_SIZE; + /* which position in the selected word */ + word_offset = (last_seqno - curr_seqno) % WORD_BIT_SIZE; + + if (seq_bits[word_num] & 1 << word_offset) + return 1; + else + return 0; + } +} + +/* turn corresponding bit on, so we can remember that we got the packet */ +void bit_mark(TYPE_OF_WORD *seq_bits, int32_t n) +{ + int32_t word_offset, word_num; + + /* if too old, just drop it */ + if (n < 0 || n >= TQ_LOCAL_WINDOW_SIZE) + return; + + /* which word */ + word_num = n / WORD_BIT_SIZE; + /* which position in the selected word */ + word_offset = n % WORD_BIT_SIZE; + + seq_bits[word_num] |= 1 << word_offset; /* turn the position on */ +} + +/* shift the packet array by n places. */ +void bit_shift(TYPE_OF_WORD *seq_bits, int32_t n) +{ + int32_t word_offset, word_num; + int32_t i; + + if (n <= 0) + return; + + word_offset = n % WORD_BIT_SIZE;/* shift how much inside each word */ + word_num = n / WORD_BIT_SIZE; /* shift over how much (full) words */ + + for (i = NUM_WORDS - 1; i > word_num; i--) { + /* going from old to new, so we don't overwrite the data we copy + * from. + * + * left is high, right is low: FEDC BA98 7654 3210 + * ^^ ^^ + * vvvv + * ^^^^ = from, vvvvv =to, we'd have word_num==1 and + * word_offset==WORD_BIT_SIZE/2 ????? in this example. + * (=24 bits) + * + * our desired output would be: 9876 5432 1000 0000 + * */ + + seq_bits[i] = + (seq_bits[i - word_num] << word_offset) + + /* take the lower port from the left half, shift it left + * to its final position */ + (seq_bits[i - word_num - 1] >> + (WORD_BIT_SIZE-word_offset)); + /* and the upper part of the right half and shift it left to + * it's position */ + /* for our example that would be: word[0] = 9800 + 0076 = + * 9876 */ + } + /* now for our last word, i==word_num, we only have the it's "left" + * half. that's the 1000 word in our example.*/ + + seq_bits[i] = (seq_bits[i - word_num] << word_offset); + + /* pad the rest with 0, if there is anything */ + i--; + + for (; i >= 0; i--) + seq_bits[i] = 0; +} + + +/* receive and process one packet, returns 1 if received seq_num is considered + * new, 0 if old */ +char bit_get_packet(TYPE_OF_WORD *seq_bits, int16_t seq_num_diff, + int8_t set_mark) +{ + int i; + + /* we already got a sequence number higher than this one, so we just + * mark it. this should wrap around the integer just fine */ + if ((seq_num_diff < 0) && (seq_num_diff >= -TQ_LOCAL_WINDOW_SIZE)) { + if (set_mark) + bit_mark(seq_bits, -seq_num_diff); + return 0; + } + + /* it seems we missed a lot of packets or the other host restarted */ + if ((seq_num_diff > TQ_LOCAL_WINDOW_SIZE) || + (seq_num_diff < -TQ_LOCAL_WINDOW_SIZE)) { + + if (seq_num_diff > TQ_LOCAL_WINDOW_SIZE) + debug_log(LOG_TYPE_BATMAN, + "We missed a lot of packets (%i) !\n", + seq_num_diff-1); + + if (-seq_num_diff > TQ_LOCAL_WINDOW_SIZE) + debug_log(LOG_TYPE_BATMAN, + "Other host probably restarted !\n"); + + for (i = 0; i < NUM_WORDS; i++) + seq_bits[i] = 0; + + if (set_mark) + seq_bits[0] = 1; /* we only have the latest packet */ + } else { + bit_shift(seq_bits, seq_num_diff); + + if (set_mark) + bit_mark(seq_bits, 0); + } + + return 1; +} + +/* count the hamming weight, how many good packets did we receive? just count + * the 1's. The inner loop uses the Kernighan algorithm, see + * http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetKernighan + */ +int bit_packet_count(TYPE_OF_WORD *seq_bits) +{ + int i, hamming = 0; + TYPE_OF_WORD word; + + for (i = 0; i < NUM_WORDS; i++) { + word = seq_bits[i]; + + while (word) { + word &= word-1; + hamming++; + } + } + return hamming; +} diff --git a/drivers/staging/batman-adv/bitarray.h b/drivers/staging/batman-adv/bitarray.h new file mode 100644 index 000000000000..ec72dd784362 --- /dev/null +++ b/drivers/staging/batman-adv/bitarray.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2006-2009 B.A.T.M.A.N. contributors: + * + * Simon Wunderlich, Marek Lindner + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + + +/* you should choose something big, if you don't want to waste cpu */ +#define TYPE_OF_WORD unsigned long +#define WORD_BIT_SIZE (sizeof(TYPE_OF_WORD) * 8) + +/* returns true if the corresponding bit in the given seq_bits indicates true + * and curr_seqno is within range of last_seqno */ +uint8_t get_bit_status(TYPE_OF_WORD *seq_bits, uint16_t last_seqno, + uint16_t curr_seqno); + +/* turn corresponding bit on, so we can remember that we got the packet */ +void bit_mark(TYPE_OF_WORD *seq_bits, int32_t n); + +/* shift the packet array by n places. */ +void bit_shift(TYPE_OF_WORD *seq_bits, int32_t n); + + +/* receive and process one packet, returns 1 if received seq_num is considered + * new, 0 if old */ +char bit_get_packet(TYPE_OF_WORD *seq_bits, int16_t seq_num_diff, + int8_t set_mark); + +/* count the hamming weight, how many good packets did we receive? */ +int bit_packet_count(TYPE_OF_WORD *seq_bits); diff --git a/drivers/staging/batman-adv/compat.h b/drivers/staging/batman-adv/compat.h new file mode 100644 index 000000000000..f4e0a4564ba7 --- /dev/null +++ b/drivers/staging/batman-adv/compat.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + * + * This file contains macros for maintaining compatibility with older versions + * of the Linux kernel. + */ + +#include /* LINUX_VERSION_CODE */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) + +#define skb_set_network_header(_skb, _offset) \ + do { (_skb)->nh.raw = (_skb)->data + (_offset); } while (0) + +#define skb_reset_mac_header(_skb) \ + do { (_skb)->mac.raw = (_skb)->data; } while (0) + +#define list_first_entry(ptr, type, member) \ + list_entry((ptr)->next, type, member) + +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) */ + + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) + +#define device_create(_cls, _parent, _devt, _device, _fmt) \ + class_device_create(_cls, _parent, _devt, _device, _fmt) + +#define device_destroy(_cls, _device) \ + class_device_destroy(_cls, _device) + +#else + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) + +#define device_create(_cls, _parent, _devt, _device, _fmt) \ + device_create_drvdata(_cls, _parent, _devt, _device, _fmt) + +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) */ + +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) + +#define cancel_delayed_work_sync(wq) cancel_rearming_delayed_work(wq) + +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) +#define strict_strtoul(cp, base, res) \ + ({ \ + int ret = 0; \ + char *endp; \ + *res = simple_strtoul(cp, &endp, base); \ + if (cp == endp) \ + ret = -EINVAL; \ + ret; \ +}) +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) */ diff --git a/drivers/staging/batman-adv/device.c b/drivers/staging/batman-adv/device.c new file mode 100644 index 000000000000..1e7d1f88674f --- /dev/null +++ b/drivers/staging/batman-adv/device.c @@ -0,0 +1,337 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include "main.h" +#include "device.h" +#include "log.h" +#include "send.h" +#include "types.h" +#include "hash.h" + +#include "compat.h" + +static struct class *batman_class; + +static int Major; /* Major number assigned to our device driver */ + +static const struct file_operations fops = { + .open = bat_device_open, + .release = bat_device_release, + .read = bat_device_read, + .write = bat_device_write, + .poll = bat_device_poll, +}; + +static struct device_client *device_client_hash[256]; + +void bat_device_init(void) +{ + int i; + + for (i = 0; i < 256; i++) + device_client_hash[i] = NULL; +} + +int bat_device_setup(void) +{ + int tmp_major; + + if (Major) + return 1; + + /* register our device - kernel assigns a free major number */ + tmp_major = register_chrdev(0, DRIVER_DEVICE, &fops); + if (tmp_major < 0) { + debug_log(LOG_TYPE_WARN, "Registering the character device failed with %d\n", + tmp_major); + return 0; + } + + batman_class = class_create(THIS_MODULE, "batman-adv"); + + if (IS_ERR(batman_class)) { + debug_log(LOG_TYPE_WARN, "Could not register class 'batman-adv' \n"); + return 0; + } + + device_create(batman_class, NULL, MKDEV(tmp_major, 0), NULL, + "batman-adv"); + + Major = tmp_major; + return 1; +} + +void bat_device_destroy(void) +{ + if (!Major) + return; + + device_destroy(batman_class, MKDEV(Major, 0)); + class_destroy(batman_class); + + /* Unregister the device */ + unregister_chrdev(Major, DRIVER_DEVICE); + + Major = 0; +} + +int bat_device_open(struct inode *inode, struct file *file) +{ + unsigned int i; + struct device_client *device_client; + + device_client = kmalloc(sizeof(struct device_client), GFP_KERNEL); + + if (!device_client) + return -ENOMEM; + + for (i = 0; i < 256; i++) { + if (!device_client_hash[i]) { + device_client_hash[i] = device_client; + break; + } + } + + if (device_client_hash[i] != device_client) { + debug_log(LOG_TYPE_WARN, "Error - can't add another packet client: maximum number of clients reached \n"); + kfree(device_client); + return -EXFULL; + } + + INIT_LIST_HEAD(&device_client->queue_list); + device_client->queue_len = 0; + device_client->index = i; + device_client->lock = __SPIN_LOCK_UNLOCKED(device_client->lock); + init_waitqueue_head(&device_client->queue_wait); + + file->private_data = device_client; + + inc_module_count(); + return 0; +} + +int bat_device_release(struct inode *inode, struct file *file) +{ + struct device_client *device_client = + (struct device_client *)file->private_data; + struct device_packet *device_packet; + struct list_head *list_pos, *list_pos_tmp; + + spin_lock(&device_client->lock); + + /* for all packets in the queue ... */ + list_for_each_safe(list_pos, list_pos_tmp, &device_client->queue_list) { + device_packet = list_entry(list_pos, + struct device_packet, list); + + list_del(list_pos); + kfree(device_packet); + } + + device_client_hash[device_client->index] = NULL; + spin_unlock(&device_client->lock); + + kfree(device_client); + dec_module_count(); + + return 0; +} + +ssize_t bat_device_read(struct file *file, char __user *buf, size_t count, + loff_t *ppos) +{ + struct device_client *device_client = + (struct device_client *)file->private_data; + struct device_packet *device_packet; + int error; + + if ((file->f_flags & O_NONBLOCK) && (device_client->queue_len == 0)) + return -EAGAIN; + + if ((!buf) || (count < sizeof(struct icmp_packet))) + return -EINVAL; + + if (!access_ok(VERIFY_WRITE, buf, count)) + return -EFAULT; + + error = wait_event_interruptible(device_client->queue_wait, + device_client->queue_len); + + if (error) + return error; + + spin_lock(&device_client->lock); + + device_packet = list_first_entry(&device_client->queue_list, + struct device_packet, list); + list_del(&device_packet->list); + device_client->queue_len--; + + spin_unlock(&device_client->lock); + + error = __copy_to_user(buf, &device_packet->icmp_packet, + sizeof(struct icmp_packet)); + + kfree(device_packet); + + if (error) + return error; + + return sizeof(struct icmp_packet); +} + +ssize_t bat_device_write(struct file *file, const char __user *buff, + size_t len, loff_t *off) +{ + struct device_client *device_client = + (struct device_client *)file->private_data; + struct icmp_packet icmp_packet; + struct orig_node *orig_node; + struct batman_if *batman_if; + + if (len < sizeof(struct icmp_packet)) { + debug_log(LOG_TYPE_NOTICE, "Error - can't send packet from char device: invalid packet size\n"); + return -EINVAL; + } + + if (!access_ok(VERIFY_READ, buff, sizeof(struct icmp_packet))) + return -EFAULT; + + if (__copy_from_user(&icmp_packet, buff, sizeof(icmp_packet))) + return -EFAULT; + + if (icmp_packet.packet_type != BAT_ICMP) { + debug_log(LOG_TYPE_NOTICE, "Error - can't send packet from char device: got bogus packet type (expected: BAT_ICMP)\n"); + return -EINVAL; + } + + if (icmp_packet.msg_type != ECHO_REQUEST) { + debug_log(LOG_TYPE_NOTICE, "Error - can't send packet from char device: got bogus message type (expected: ECHO_REQUEST)\n"); + return -EINVAL; + } + + icmp_packet.uid = device_client->index; + + if (icmp_packet.version != COMPAT_VERSION) { + icmp_packet.msg_type = PARAMETER_PROBLEM; + icmp_packet.ttl = COMPAT_VERSION; + bat_device_add_packet(device_client, &icmp_packet); + goto out; + } + + if (atomic_read(&module_state) != MODULE_ACTIVE) + goto dst_unreach; + + spin_lock(&orig_hash_lock); + orig_node = ((struct orig_node *)hash_find(orig_hash, icmp_packet.dst)); + + if (!orig_node) + goto unlock; + + if (!orig_node->router) + goto unlock; + + batman_if = orig_node->batman_if; + + if (!batman_if) + goto unlock; + + memcpy(icmp_packet.orig, + batman_if->net_dev->dev_addr, + ETH_ALEN); + + send_raw_packet((unsigned char *)&icmp_packet, + sizeof(struct icmp_packet), + batman_if, orig_node->router->addr); + + spin_unlock(&orig_hash_lock); + goto out; + +unlock: + spin_unlock(&orig_hash_lock); +dst_unreach: + icmp_packet.msg_type = DESTINATION_UNREACHABLE; + bat_device_add_packet(device_client, &icmp_packet); +out: + return len; +} + +unsigned int bat_device_poll(struct file *file, poll_table *wait) +{ + struct device_client *device_client = + (struct device_client *)file->private_data; + + poll_wait(file, &device_client->queue_wait, wait); + + if (device_client->queue_len > 0) + return POLLIN | POLLRDNORM; + + return 0; +} + +void bat_device_add_packet(struct device_client *device_client, + struct icmp_packet *icmp_packet) +{ + struct device_packet *device_packet; + + device_packet = kmalloc(sizeof(struct device_packet), GFP_KERNEL); + + if (!device_packet) + return; + + INIT_LIST_HEAD(&device_packet->list); + memcpy(&device_packet->icmp_packet, icmp_packet, + sizeof(struct icmp_packet)); + + spin_lock(&device_client->lock); + + /* while waiting for the lock the device_client could have been + * deleted */ + if (!device_client_hash[icmp_packet->uid]) { + spin_unlock(&device_client->lock); + kfree(device_packet); + return; + } + + list_add_tail(&device_packet->list, &device_client->queue_list); + device_client->queue_len++; + + if (device_client->queue_len > 100) { + device_packet = list_first_entry(&device_client->queue_list, + struct device_packet, list); + + list_del(&device_packet->list); + kfree(device_packet); + device_client->queue_len--; + } + + spin_unlock(&device_client->lock); + + wake_up(&device_client->queue_wait); +} + +void bat_device_receive_packet(struct icmp_packet *icmp_packet) +{ + struct device_client *hash = device_client_hash[icmp_packet->uid]; + + if (hash) + bat_device_add_packet(hash, icmp_packet); +} diff --git a/drivers/staging/batman-adv/device.h b/drivers/staging/batman-adv/device.h new file mode 100644 index 000000000000..46c0f4496527 --- /dev/null +++ b/drivers/staging/batman-adv/device.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include "types.h" + +void bat_device_init(void); +int bat_device_setup(void); +void bat_device_destroy(void); +int bat_device_open(struct inode *inode, struct file *file); +int bat_device_release(struct inode *inode, struct file *file); +ssize_t bat_device_read(struct file *file, char __user *buf, size_t count, + loff_t *ppos); +ssize_t bat_device_write(struct file *file, const char __user *buff, + size_t len, loff_t *off); +unsigned int bat_device_poll(struct file *file, poll_table *wait); +void bat_device_add_packet(struct device_client *device_client, + struct icmp_packet *icmp_packet); +void bat_device_receive_packet(struct icmp_packet *icmp_packet); diff --git a/drivers/staging/batman-adv/hard-interface.c b/drivers/staging/batman-adv/hard-interface.c new file mode 100644 index 000000000000..5ea35da5ee7a --- /dev/null +++ b/drivers/staging/batman-adv/hard-interface.c @@ -0,0 +1,451 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include "main.h" +#include "hard-interface.h" +#include "log.h" +#include "soft-interface.h" +#include "send.h" +#include "translation-table.h" +#include "routing.h" +#include "hash.h" +#include "compat.h" + +#define MIN(x, y) ((x) < (y) ? (x) : (y)) + +static char avail_ifs; +static char active_ifs; + +static void hardif_free_interface(struct rcu_head *rcu); + +static struct batman_if *get_batman_if_by_name(char *name) +{ + struct batman_if *batman_if; + + rcu_read_lock(); + list_for_each_entry_rcu(batman_if, &if_list, list) { + if (strncmp(batman_if->dev, name, IFNAMSIZ) == 0) + goto out; + } + + batman_if = NULL; + +out: + rcu_read_unlock(); + return batman_if; +} + +int hardif_min_mtu(void) +{ + struct batman_if *batman_if; + /* allow big frames if all devices are capable to do so + * (have MTU > 1500 + BAT_HEADER_LEN) */ + int min_mtu = ETH_DATA_LEN; + + rcu_read_lock(); + list_for_each_entry_rcu(batman_if, &if_list, list) { + if ((batman_if->if_active == IF_ACTIVE) || + (batman_if->if_active == IF_TO_BE_ACTIVATED)) + min_mtu = MIN(batman_if->net_dev->mtu - BAT_HEADER_LEN, + min_mtu); + } + rcu_read_unlock(); + + return min_mtu; +} + +static void check_known_mac_addr(uint8_t *addr) +{ + struct batman_if *batman_if; + char mac_string[ETH_STR_LEN]; + + rcu_read_lock(); + list_for_each_entry_rcu(batman_if, &if_list, list) { + if ((batman_if->if_active != IF_ACTIVE) && + (batman_if->if_active != IF_TO_BE_ACTIVATED)) + continue; + + if (!compare_orig(batman_if->net_dev->dev_addr, addr)) + continue; + + addr_to_string(mac_string, addr); + debug_log(LOG_TYPE_WARN, "The newly added mac address (%s) already exists on: %s\n", + mac_string, batman_if->dev); + debug_log(LOG_TYPE_WARN, "It is strongly recommended to keep mac addresses unique to avoid problems!\n"); + } + rcu_read_unlock(); +} + +/* adjusts the MTU if a new interface with a smaller MTU appeared. */ +void update_min_mtu(void) +{ + int min_mtu; + + min_mtu = hardif_min_mtu(); + if (soft_device->mtu != min_mtu) + soft_device->mtu = min_mtu; +} + +/* checks if the interface is up. (returns 1 if it is) */ +static int hardif_is_interface_up(char *dev) +{ + struct net_device *net_dev; + + /** + * if we already have an interface in our interface list and + * the current interface is not the primary interface and + * the primary interface is not up and + * the primary interface has never been up - don't activate any + * secondary interface ! + */ + + rcu_read_lock(); + if ((!list_empty(&if_list)) && + strncmp(((struct batman_if *)if_list.next)->dev, dev, IFNAMSIZ) && + !(((struct batman_if *)if_list.next)->if_active == IF_ACTIVE) && + !(((struct batman_if *)if_list.next)->if_active == IF_TO_BE_ACTIVATED) && + (!main_if_was_up())) { + rcu_read_unlock(); + goto end; + } + rcu_read_unlock(); + +#ifdef __NET_NET_NAMESPACE_H + net_dev = dev_get_by_name(&init_net, dev); +#else + net_dev = dev_get_by_name(dev); +#endif + if (!net_dev) + goto end; + + if (!(net_dev->flags & IFF_UP)) + goto failure; + + dev_put(net_dev); + return 1; + +failure: + dev_put(net_dev); +end: + return 0; +} + +/* deactivates the interface. */ +void hardif_deactivate_interface(struct batman_if *batman_if) +{ + if (batman_if->if_active != IF_ACTIVE) + return; + + if (batman_if->raw_sock) + sock_release(batman_if->raw_sock); + + /** + * batman_if->net_dev has been acquired by dev_get_by_name() in + * proc_interfaces_write() and has to be unreferenced. + */ + + if (batman_if->net_dev) + dev_put(batman_if->net_dev); + + batman_if->raw_sock = NULL; + batman_if->net_dev = NULL; + + batman_if->if_active = IF_INACTIVE; + active_ifs--; + + debug_log(LOG_TYPE_NOTICE, "Interface deactivated: %s\n", + batman_if->dev); +} + +/* (re)activate given interface. */ +static void hardif_activate_interface(struct batman_if *batman_if) +{ + struct sockaddr_ll bind_addr; + int retval; + + if (batman_if->if_active != IF_INACTIVE) + return; + +#ifdef __NET_NET_NAMESPACE_H + batman_if->net_dev = dev_get_by_name(&init_net, batman_if->dev); +#else + batman_if->net_dev = dev_get_by_name(batman_if->dev); +#endif + if (!batman_if->net_dev) + goto dev_err; + + retval = sock_create_kern(PF_PACKET, SOCK_RAW, + __constant_htons(ETH_P_BATMAN), + &batman_if->raw_sock); + + if (retval < 0) { + debug_log(LOG_TYPE_WARN, "Can't create raw socket: %i\n", + retval); + goto sock_err; + } + + bind_addr.sll_family = AF_PACKET; + bind_addr.sll_ifindex = batman_if->net_dev->ifindex; + bind_addr.sll_protocol = 0; /* is set by the kernel */ + + retval = kernel_bind(batman_if->raw_sock, + (struct sockaddr *)&bind_addr, sizeof(bind_addr)); + + if (retval < 0) { + debug_log(LOG_TYPE_WARN, "Can't create bind raw socket: %i\n", + retval); + goto bind_err; + } + + check_known_mac_addr(batman_if->net_dev->dev_addr); + + batman_if->raw_sock->sk->sk_user_data = + batman_if->raw_sock->sk->sk_data_ready; + batman_if->raw_sock->sk->sk_data_ready = batman_data_ready; + + addr_to_string(batman_if->addr_str, batman_if->net_dev->dev_addr); + + memcpy(((struct batman_packet *)(batman_if->packet_buff))->orig, + batman_if->net_dev->dev_addr, ETH_ALEN); + memcpy(((struct batman_packet *)(batman_if->packet_buff))->prev_sender, + batman_if->net_dev->dev_addr, ETH_ALEN); + + batman_if->if_active = IF_TO_BE_ACTIVATED; + active_ifs++; + + /* save the mac address if it is our primary interface */ + if (batman_if->if_num == 0) + set_main_if_addr(batman_if->net_dev->dev_addr); + + debug_log(LOG_TYPE_NOTICE, "Interface activated: %s\n", + batman_if->dev); + + return; + +bind_err: + sock_release(batman_if->raw_sock); +sock_err: + dev_put(batman_if->net_dev); +dev_err: + batman_if->raw_sock = NULL; + batman_if->net_dev = NULL; +} + +static void hardif_free_interface(struct rcu_head *rcu) +{ + struct batman_if *batman_if = container_of(rcu, struct batman_if, rcu); + + kfree(batman_if->packet_buff); + kfree(batman_if->dev); + kfree(batman_if); +} + +/** + * called by + * - echo '' > /proc/.../interfaces + * - modprobe -r batman-adv-core + */ +/* removes and frees all interfaces */ +void hardif_remove_interfaces(void) +{ + struct batman_if *batman_if = NULL; + + avail_ifs = 0; + + /* no lock needed - we don't delete somewhere else */ + list_for_each_entry(batman_if, &if_list, list) { + + list_del_rcu(&batman_if->list); + + /* first deactivate interface */ + if (batman_if->if_active != IF_INACTIVE) + hardif_deactivate_interface(batman_if); + + call_rcu(&batman_if->rcu, hardif_free_interface); + } +} + +static int resize_orig(struct orig_node *orig_node, int if_num) +{ + void *data_ptr; + + data_ptr = kmalloc((if_num + 1) * sizeof(TYPE_OF_WORD) * NUM_WORDS, + GFP_ATOMIC); + if (!data_ptr) { + debug_log(LOG_TYPE_WARN, "Can't resize orig: out of memory\n"); + return -1; + } + + memcpy(data_ptr, orig_node->bcast_own, + if_num * sizeof(TYPE_OF_WORD) * NUM_WORDS); + kfree(orig_node->bcast_own); + orig_node->bcast_own = data_ptr; + + data_ptr = kmalloc((if_num + 1) * sizeof(uint8_t), GFP_ATOMIC); + if (!data_ptr) { + debug_log(LOG_TYPE_WARN, "Can't resize orig: out of memory\n"); + return -1; + } + + memcpy(data_ptr, orig_node->bcast_own_sum, if_num * sizeof(uint8_t)); + kfree(orig_node->bcast_own_sum); + orig_node->bcast_own_sum = data_ptr; + + return 0; +} + + +/* adds an interface the interface list and activate it, if possible */ +int hardif_add_interface(char *dev, int if_num) +{ + struct batman_if *batman_if; + struct batman_packet *batman_packet; + struct orig_node *orig_node; + struct hash_it_t *hashit = NULL; + + batman_if = kmalloc(sizeof(struct batman_if), GFP_KERNEL); + + if (!batman_if) { + debug_log(LOG_TYPE_WARN, "Can't add interface (%s): out of memory\n", dev); + return -1; + } + + batman_if->raw_sock = NULL; + batman_if->net_dev = NULL; + + if ((if_num == 0) && (num_hna > 0)) + batman_if->packet_len = BAT_PACKET_LEN + num_hna * ETH_ALEN; + else + batman_if->packet_len = BAT_PACKET_LEN; + + batman_if->packet_buff = kmalloc(batman_if->packet_len, GFP_KERNEL); + + if (!batman_if->packet_buff) { + debug_log(LOG_TYPE_WARN, "Can't add interface packet (%s): out of memory\n", dev); + goto out; + } + + batman_if->if_num = if_num; + batman_if->dev = dev; + batman_if->if_active = IF_INACTIVE; + INIT_RCU_HEAD(&batman_if->rcu); + + debug_log(LOG_TYPE_NOTICE, "Adding interface: %s\n", dev); + avail_ifs++; + + INIT_LIST_HEAD(&batman_if->list); + + batman_packet = (struct batman_packet *)(batman_if->packet_buff); + batman_packet->packet_type = BAT_PACKET; + batman_packet->version = COMPAT_VERSION; + batman_packet->flags = 0x00; + batman_packet->ttl = (batman_if->if_num > 0 ? 2 : TTL); + batman_packet->flags = 0; + batman_packet->tq = TQ_MAX_VALUE; + batman_packet->num_hna = 0; + + if (batman_if->packet_len != BAT_PACKET_LEN) { + unsigned char *hna_buff; + int hna_len; + + hna_buff = batman_if->packet_buff + BAT_PACKET_LEN; + hna_len = batman_if->packet_len - BAT_PACKET_LEN; + batman_packet->num_hna = hna_local_fill_buffer(hna_buff, + hna_len); + } + + atomic_set(&batman_if->seqno, 1); + + /* resize all orig nodes because orig_node->bcast_own(_sum) depend on + * if_num */ + spin_lock(&orig_hash_lock); + + while (NULL != (hashit = hash_iterate(orig_hash, hashit))) { + orig_node = hashit->bucket->data; + if (resize_orig(orig_node, if_num) == -1) { + spin_unlock(&orig_hash_lock); + goto out; + } + } + + spin_unlock(&orig_hash_lock); + + if (!hardif_is_interface_up(batman_if->dev)) + debug_log(LOG_TYPE_WARN, "Not using interface %s (retrying later): interface not active\n", batman_if->dev); + else + hardif_activate_interface(batman_if); + + list_add_tail_rcu(&batman_if->list, &if_list); + + /* begin sending originator messages on that interface */ + schedule_own_packet(batman_if); + return 1; + +out: + if (batman_if->packet_buff) + kfree(batman_if->packet_buff); + kfree(batman_if); + kfree(dev); + return -1; +} + +char hardif_get_active_if_num(void) +{ + return active_ifs; +} + +static int hard_if_event(struct notifier_block *this, + unsigned long event, void *ptr) +{ + struct net_device *dev = (struct net_device *)ptr; + struct batman_if *batman_if = get_batman_if_by_name(dev->name); + + if (!batman_if) + goto out; + + switch (event) { + case NETDEV_GOING_DOWN: + case NETDEV_DOWN: + case NETDEV_UNREGISTER: + hardif_deactivate_interface(batman_if); + break; + case NETDEV_UP: + hardif_activate_interface(batman_if); + if ((atomic_read(&module_state) == MODULE_INACTIVE) && + (hardif_get_active_if_num() > 0)) { + activate_module(); + } + break; + /* NETDEV_CHANGEADDR - mac address change - what are we doing here ? */ + default: + /* debug_log(LOG_TYPE_CRIT, "hard_if_event: %s %i\n", dev->name, event); */ + break; + }; + + update_min_mtu(); + +out: + return NOTIFY_DONE; +} + +struct notifier_block hard_if_notifier = { + .notifier_call = hard_if_event, +}; diff --git a/drivers/staging/batman-adv/hard-interface.h b/drivers/staging/batman-adv/hard-interface.h new file mode 100644 index 000000000000..742358c00c0e --- /dev/null +++ b/drivers/staging/batman-adv/hard-interface.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#define IF_INACTIVE 0 +#define IF_ACTIVE 1 +/* #define IF_TO_BE_DEACTIVATED 2 - not needed anymore */ +#define IF_TO_BE_ACTIVATED 3 + +extern struct notifier_block hard_if_notifier; + +void hardif_remove_interfaces(void); +int hardif_add_interface(char *dev, int if_num); +void hardif_deactivate_interface(struct batman_if *batman_if); +char hardif_get_active_if_num(void); +void hardif_check_interfaces_status(void); +void hardif_check_interfaces_status_wq(struct work_struct *work); +int hardif_min_mtu(void); +void update_min_mtu(void); diff --git a/drivers/staging/batman-adv/hash.c b/drivers/staging/batman-adv/hash.c new file mode 100644 index 000000000000..61cb4a20ebca --- /dev/null +++ b/drivers/staging/batman-adv/hash.c @@ -0,0 +1,313 @@ +/* + * Copyright (C) 2006-2009 B.A.T.M.A.N. contributors: + * + * Simon Wunderlich, Marek Lindner + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include "main.h" +#include "hash.h" + +/* clears the hash */ +void hash_init(struct hashtable_t *hash) +{ + int i; + + hash->elements = 0; + + for (i = 0 ; i < hash->size; i++) + hash->table[i] = NULL; +} + +/* remove the hash structure. if hashdata_free_cb != NULL, this function will be + * called to remove the elements inside of the hash. if you don't remove the + * elements, memory might be leaked. */ +void hash_delete(struct hashtable_t *hash, hashdata_free_cb free_cb) +{ + struct element_t *bucket, *last_bucket; + int i; + + for (i = 0; i < hash->size; i++) { + bucket = hash->table[i]; + + while (bucket != NULL) { + if (free_cb != NULL) + free_cb(bucket->data); + + last_bucket = bucket; + bucket = bucket->next; + kfree(last_bucket); + } + } + + hash_destroy(hash); +} + +/* free only the hashtable and the hash itself. */ +void hash_destroy(struct hashtable_t *hash) +{ + kfree(hash->table); + kfree(hash); +} + +/* iterate though the hash. first element is selected with iter_in NULL. use + * the returned iterator to access the elements until hash_it_t returns NULL. */ +struct hash_it_t *hash_iterate(struct hashtable_t *hash, + struct hash_it_t *iter_in) +{ + struct hash_it_t *iter; + + if (!hash) + return NULL; + + if (iter_in == NULL) { + iter = kmalloc(sizeof(struct hash_it_t), GFP_ATOMIC); + iter->index = -1; + iter->bucket = NULL; + iter->prev_bucket = NULL; + } else { + iter = iter_in; + } + + /* sanity checks first (if our bucket got deleted in the last + * iteration): */ + if (iter->bucket != NULL) { + if (iter->first_bucket != NULL) { + /* we're on the first element and it got removed after + * the last iteration. */ + if ((*iter->first_bucket) != iter->bucket) { + /* there are still other elements in the list */ + if ((*iter->first_bucket) != NULL) { + iter->prev_bucket = NULL; + iter->bucket = (*iter->first_bucket); + iter->first_bucket = + &hash->table[iter->index]; + return iter; + } else { + iter->bucket = NULL; + } + } + } else if (iter->prev_bucket != NULL) { + /* + * we're not on the first element, and the bucket got + * removed after the last iteration. the last bucket's + * next pointer is not pointing to our actual bucket + * anymore. select the next. + */ + if (iter->prev_bucket->next != iter->bucket) + iter->bucket = iter->prev_bucket; + } + } + + /* now as we are sane, select the next one if there is some */ + if (iter->bucket != NULL) { + if (iter->bucket->next != NULL) { + iter->prev_bucket = iter->bucket; + iter->bucket = iter->bucket->next; + iter->first_bucket = NULL; + return iter; + } + } + + /* if not returned yet, we've reached the last one on the index and have + * to search forward */ + iter->index++; + /* go through the entries of the hash table */ + while (iter->index < hash->size) { + if ((hash->table[iter->index]) != NULL) { + iter->prev_bucket = NULL; + iter->bucket = hash->table[iter->index]; + iter->first_bucket = &hash->table[iter->index]; + return iter; + } else { + iter->index++; + } + } + + /* nothing to iterate over anymore */ + kfree(iter); + return NULL; +} + +/* allocates and clears the hash */ +struct hashtable_t *hash_new(int size, hashdata_compare_cb compare, + hashdata_choose_cb choose) +{ + struct hashtable_t *hash; + + hash = kmalloc(sizeof(struct hashtable_t) , GFP_ATOMIC); + + if (hash == NULL) + return NULL; + + hash->size = size; + hash->table = kmalloc(sizeof(struct element_t *) * size, GFP_ATOMIC); + + if (hash->table == NULL) { + kfree(hash); + return NULL; + } + + hash_init(hash); + + hash->compare = compare; + hash->choose = choose; + + return hash; +} + +/* adds data to the hashtable. returns 0 on success, -1 on error */ +int hash_add(struct hashtable_t *hash, void *data) +{ + int index; + struct element_t *bucket, *prev_bucket = NULL; + + if (!hash) + return -1; + + index = hash->choose(data, hash->size); + bucket = hash->table[index]; + + while (bucket != NULL) { + if (hash->compare(bucket->data, data)) + return -1; + + prev_bucket = bucket; + bucket = bucket->next; + } + + /* found the tail of the list, add new element */ + bucket = kmalloc(sizeof(struct element_t), GFP_ATOMIC); + + if (bucket == NULL) + return -1; + + bucket->data = data; + bucket->next = NULL; + + /* and link it */ + if (prev_bucket == NULL) + hash->table[index] = bucket; + else + prev_bucket->next = bucket; + + hash->elements++; + return 0; +} + +/* finds data, based on the key in keydata. returns the found data on success, + * or NULL on error */ +void *hash_find(struct hashtable_t *hash, void *keydata) +{ + int index; + struct element_t *bucket; + + if (!hash) + return NULL; + + index = hash->choose(keydata , hash->size); + bucket = hash->table[index]; + + while (bucket != NULL) { + if (hash->compare(bucket->data, keydata)) + return bucket->data; + + bucket = bucket->next; + } + + return NULL; +} + +/* remove bucket (this might be used in hash_iterate() if you already found the + * bucket you want to delete and don't need the overhead to find it again with + * hash_remove(). But usually, you don't want to use this function, as it + * fiddles with hash-internals. */ +void *hash_remove_bucket(struct hashtable_t *hash, struct hash_it_t *hash_it_t) +{ + void *data_save; + + data_save = hash_it_t->bucket->data; + + if (hash_it_t->prev_bucket != NULL) + hash_it_t->prev_bucket->next = hash_it_t->bucket->next; + else if (hash_it_t->first_bucket != NULL) + (*hash_it_t->first_bucket) = hash_it_t->bucket->next; + + kfree(hash_it_t->bucket); + hash->elements--; + + return data_save; +} + +/* removes data from hash, if found. returns pointer do data on success, so you + * can remove the used structure yourself, or NULL on error . data could be the + * structure you use with just the key filled, we just need the key for + * comparing. */ +void *hash_remove(struct hashtable_t *hash, void *data) +{ + struct hash_it_t hash_it_t; + + hash_it_t.index = hash->choose(data, hash->size); + hash_it_t.bucket = hash->table[hash_it_t.index]; + hash_it_t.prev_bucket = NULL; + + while (hash_it_t.bucket != NULL) { + if (hash->compare(hash_it_t.bucket->data, data)) { + hash_it_t.first_bucket = + (hash_it_t.bucket == + hash->table[hash_it_t.index] ? + &hash->table[hash_it_t.index] : NULL); + return hash_remove_bucket(hash, &hash_it_t); + } + + hash_it_t.prev_bucket = hash_it_t.bucket; + hash_it_t.bucket = hash_it_t.bucket->next; + } + + return NULL; +} + +/* resize the hash, returns the pointer to the new hash or NULL on + * error. removes the old hash on success. */ +struct hashtable_t *hash_resize(struct hashtable_t *hash, int size) +{ + struct hashtable_t *new_hash; + struct element_t *bucket; + int i; + + /* initialize a new hash with the new size */ + new_hash = hash_new(size, hash->compare, hash->choose); + + if (new_hash == NULL) + return NULL; + + /* copy the elements */ + for (i = 0; i < hash->size; i++) { + bucket = hash->table[i]; + + while (bucket != NULL) { + hash_add(new_hash, bucket->data); + bucket = bucket->next; + } + } + + /* remove hash and eventual overflow buckets but not the content + * itself. */ + hash_delete(hash, NULL); + + return new_hash; +} diff --git a/drivers/staging/batman-adv/hash.h b/drivers/staging/batman-adv/hash.h new file mode 100644 index 000000000000..bb60f082be6a --- /dev/null +++ b/drivers/staging/batman-adv/hash.h @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2006-2009 B.A.T.M.A.N. contributors: + * + * Simon Wunderlich, Marek Lindner + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#ifndef _BATMAN_HASH_H +#define _BATMAN_HASH_H + +typedef int (*hashdata_compare_cb)(void *, void *); +typedef int (*hashdata_choose_cb)(void *, int); +typedef void (*hashdata_free_cb)(void *); + +struct element_t { + void *data; /* pointer to the data */ + struct element_t *next; /* overflow bucket pointer */ +}; + +struct hash_it_t { + int index; + struct element_t *bucket; + struct element_t *prev_bucket; + struct element_t **first_bucket; +}; + +struct hashtable_t { + struct element_t **table; /* the hashtable itself, with the buckets */ + int elements; /* number of elements registered */ + int size; /* size of hashtable */ + hashdata_compare_cb compare;/* callback to a compare function. should + * compare 2 element datas for their keys, + * return 0 if same and not 0 if not + * same */ + hashdata_choose_cb choose; /* the hashfunction, should return an index + * based on the key in the data of the first + * argument and the size the second */ +}; + +/* clears the hash */ +void hash_init(struct hashtable_t *hash); + +/* allocates and clears the hash */ +struct hashtable_t *hash_new(int size, hashdata_compare_cb compare, + hashdata_choose_cb choose); + +/* remove bucket (this might be used in hash_iterate() if you already found the + * bucket you want to delete and don't need the overhead to find it again with + * hash_remove(). But usually, you don't want to use this function, as it + * fiddles with hash-internals. */ +void *hash_remove_bucket(struct hashtable_t *hash, struct hash_it_t *hash_it_t); + +/* remove the hash structure. if hashdata_free_cb != NULL, this function will be + * called to remove the elements inside of the hash. if you don't remove the + * elements, memory might be leaked. */ +void hash_delete(struct hashtable_t *hash, hashdata_free_cb free_cb); + +/* free only the hashtable and the hash itself. */ +void hash_destroy(struct hashtable_t *hash); + +/* adds data to the hashtable. returns 0 on success, -1 on error */ +int hash_add(struct hashtable_t *hash, void *data); + +/* removes data from hash, if found. returns pointer do data on success, so you + * can remove the used structure yourself, or NULL on error . data could be the + * structure you use with just the key filled, we just need the key for + * comparing. */ +void *hash_remove(struct hashtable_t *hash, void *data); + +/* finds data, based on the key in keydata. returns the found data on success, + * or NULL on error */ +void *hash_find(struct hashtable_t *hash, void *keydata); + +/* resize the hash, returns the pointer to the new hash or NULL on + * error. removes the old hash on success */ +struct hashtable_t *hash_resize(struct hashtable_t *hash, int size); + +/* iterate though the hash. first element is selected with iter_in NULL. use + * the returned iterator to access the elements until hash_it_t returns NULL. */ +struct hash_it_t *hash_iterate(struct hashtable_t *hash, + struct hash_it_t *iter_in); + +/* print the hash table for debugging */ +void hash_debug(struct hashtable_t *hash); +#endif diff --git a/drivers/staging/batman-adv/log.c b/drivers/staging/batman-adv/log.c new file mode 100644 index 000000000000..f37c7f01a9f5 --- /dev/null +++ b/drivers/staging/batman-adv/log.c @@ -0,0 +1,179 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include "main.h" +#include "log.h" + +#define LOG_BUF_MASK (log_buf_len-1) +#define LOG_BUF(idx) (log_buf[(idx) & LOG_BUF_MASK]) + +static char log_buf[LOG_BUF_LEN]; +static int log_buf_len = LOG_BUF_LEN; +static unsigned long log_start; +static unsigned long log_end; +uint8_t log_level; + +static DEFINE_SPINLOCK(logbuf_lock); + +const struct file_operations proc_log_operations = { + .open = log_open, + .release = log_release, + .read = log_read, + .write = log_write, + .poll = log_poll, +}; + +static DECLARE_WAIT_QUEUE_HEAD(log_wait); + +static void emit_log_char(char c) +{ + LOG_BUF(log_end) = c; + log_end++; + + if (log_end - log_start > log_buf_len) + log_start = log_end - log_buf_len; +} + +static int fdebug_log(char *fmt, ...) +{ + int printed_len; + char *p; + va_list args; + static char debug_log_buf[256]; + unsigned long flags; + + spin_lock_irqsave(&logbuf_lock, flags); + va_start(args, fmt); + printed_len = vscnprintf(debug_log_buf, sizeof(debug_log_buf), fmt, + args); + va_end(args); + + for (p = debug_log_buf; *p != 0; p++) + emit_log_char(*p); + + spin_unlock_irqrestore(&logbuf_lock, flags); + + wake_up(&log_wait); + + return 0; +} + +int debug_log(int type, char *fmt, ...) +{ + va_list args; + int retval = 0; + char tmp_log_buf[256]; + + /* only critical information get into the official kernel log */ + if (type == LOG_TYPE_CRIT) { + va_start(args, fmt); + vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args); + printk(KERN_ERR "batman-adv: %s", tmp_log_buf); + va_end(args); + } + + if ((type == LOG_TYPE_CRIT) || (log_level & type)) { + va_start(args, fmt); + vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args); + fdebug_log("[%10u] %s", (jiffies / HZ), tmp_log_buf); + va_end(args); + } + + return retval; +} + +int log_open(struct inode *inode, struct file *file) +{ + inc_module_count(); + return 0; +} + +int log_release(struct inode *inode, struct file *file) +{ + dec_module_count(); + return 0; +} + +ssize_t log_read(struct file *file, char __user *buf, size_t count, + loff_t *ppos) +{ + int error, i = 0; + char c; + unsigned long flags; + + if ((file->f_flags & O_NONBLOCK) && !(log_end - log_start)) + return -EAGAIN; + + if ((!buf) || (count < 0)) + return -EINVAL; + + if (count == 0) + return 0; + + if (!access_ok(VERIFY_WRITE, buf, count)) + return -EFAULT; + + error = wait_event_interruptible(log_wait, (log_start - log_end)); + + if (error) + return error; + + spin_lock_irqsave(&logbuf_lock, flags); + + while ((!error) && (log_start != log_end) && (i < count)) { + c = LOG_BUF(log_start); + + log_start++; + + spin_unlock_irqrestore(&logbuf_lock, flags); + + error = __put_user(c, buf); + + spin_lock_irqsave(&logbuf_lock, flags); + + buf++; + i++; + + } + + spin_unlock_irqrestore(&logbuf_lock, flags); + + if (!error) + return i; + + return error; +} + +ssize_t log_write(struct file *file, const char __user *buf, size_t count, + loff_t *ppos) +{ + return count; +} + +unsigned int log_poll(struct file *file, poll_table *wait) +{ + poll_wait(file, &log_wait, wait); + + if (log_end - log_start) + return POLLIN | POLLRDNORM; + + return 0; +} diff --git a/drivers/staging/batman-adv/log.h b/drivers/staging/batman-adv/log.h new file mode 100644 index 000000000000..780e3abb48f9 --- /dev/null +++ b/drivers/staging/batman-adv/log.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +extern const struct file_operations proc_log_operations; +extern uint8_t log_level; + +int debug_log(int type, char *fmt, ...); +int log_open(struct inode *inode, struct file *file); +int log_release(struct inode *inode, struct file *file); +ssize_t log_read(struct file *file, char __user *buf, size_t count, + loff_t *ppos); +ssize_t log_write(struct file *file, const char __user *buf, size_t count, + loff_t *ppos); +unsigned int log_poll(struct file *file, poll_table *wait); diff --git a/drivers/staging/batman-adv/main.c b/drivers/staging/batman-adv/main.c new file mode 100644 index 000000000000..bb89bfc5dda6 --- /dev/null +++ b/drivers/staging/batman-adv/main.c @@ -0,0 +1,286 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include "main.h" +#include "proc.h" +#include "log.h" +#include "routing.h" +#include "send.h" +#include "soft-interface.h" +#include "device.h" +#include "translation-table.h" +#include "hard-interface.h" +#include "types.h" +#include "vis.h" +#include "hash.h" +#include "compat.h" + +struct list_head if_list; +struct hlist_head forw_bat_list; +struct hlist_head forw_bcast_list; +struct hashtable_t *orig_hash; + +DEFINE_SPINLOCK(orig_hash_lock); +DEFINE_SPINLOCK(forw_bat_list_lock); +DEFINE_SPINLOCK(forw_bcast_list_lock); + +atomic_t originator_interval; +atomic_t vis_interval; +atomic_t aggregation_enabled; +int16_t num_hna; +int16_t num_ifs; + +struct net_device *soft_device; + +static struct task_struct *kthread_task; + +unsigned char broadcastAddr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; +atomic_t module_state; + +struct workqueue_struct *bat_event_workqueue; + +int init_module(void) +{ + int retval; + + INIT_LIST_HEAD(&if_list); + INIT_HLIST_HEAD(&forw_bat_list); + INIT_HLIST_HEAD(&forw_bcast_list); + + atomic_set(&module_state, MODULE_INACTIVE); + + atomic_set(&originator_interval, 1000); + atomic_set(&vis_interval, 1000);/* TODO: raise this later, this is only + * for debugging now. */ + atomic_set(&aggregation_enabled, 1); + + /* the name should not be longer than 10 chars - see + * http://lwn.net/Articles/23634/ */ + bat_event_workqueue = create_singlethread_workqueue("bat_events"); + + if (!bat_event_workqueue) + return -ENOMEM; + + retval = setup_procfs(); + if (retval < 0) + return retval; + + bat_device_init(); + + /* initialize layer 2 interface */ + soft_device = alloc_netdev(sizeof(struct bat_priv) , "bat%d", + interface_setup); + + if (!soft_device) { + debug_log(LOG_TYPE_CRIT, "Unable to allocate the batman interface\n"); + goto end; + } + + retval = register_netdev(soft_device); + + if (retval < 0) { + debug_log(LOG_TYPE_CRIT, "Unable to register the batman interface: %i\n", retval); + goto free_soft_device; + } + + register_netdevice_notifier(&hard_if_notifier); + + debug_log(LOG_TYPE_CRIT, "B.A.T.M.A.N. advanced %s%s (compatibility version %i) loaded \n", + SOURCE_VERSION, REVISION_VERSION_STR, COMPAT_VERSION); + + return 0; + +free_soft_device: + free_netdev(soft_device); + soft_device = NULL; +end: + return -ENOMEM; +} + +void cleanup_module(void) +{ + shutdown_module(); + + if (soft_device) { + unregister_netdev(soft_device); + soft_device = NULL; + } + + unregister_netdevice_notifier(&hard_if_notifier); + cleanup_procfs(); + + destroy_workqueue(bat_event_workqueue); + bat_event_workqueue = NULL; +} + +/* activates the module, creates bat device, starts timer ... */ +void activate_module(void) +{ + if (originator_init() < 1) + goto err; + + if (hna_local_init() < 1) + goto err; + + if (hna_global_init() < 1) + goto err; + + hna_local_add(soft_device->dev_addr); + + if (bat_device_setup() < 1) + goto end; + + if (vis_init() < 1) + goto err; + + /* (re)start kernel thread for packet processing */ + if (!kthread_task) { + kthread_task = kthread_run(packet_recv_thread, NULL, "batman-adv"); + + if (IS_ERR(kthread_task)) { + debug_log(LOG_TYPE_CRIT, "Unable to start packet receive thread\n"); + kthread_task = NULL; + } + } + + update_min_mtu(); + atomic_set(&module_state, MODULE_ACTIVE); + goto end; + +err: + debug_log(LOG_TYPE_CRIT, "Unable to allocate memory for mesh information structures: out of mem ?\n"); + shutdown_module(); +end: + return; +} + +/* shuts down the whole module.*/ +void shutdown_module(void) +{ + atomic_set(&module_state, MODULE_DEACTIVATING); + + purge_outstanding_packets(); + flush_workqueue(bat_event_workqueue); + + vis_quit(); + + /* deactivate kernel thread for packet processing (if running) */ + if (kthread_task) { + atomic_set(&exit_cond, 1); + wake_up_interruptible(&thread_wait); + kthread_stop(kthread_task); + + kthread_task = NULL; + } + + originator_free(); + + hna_local_free(); + hna_global_free(); + + synchronize_net(); + bat_device_destroy(); + + hardif_remove_interfaces(); + synchronize_rcu(); + atomic_set(&module_state, MODULE_INACTIVE); +} + +void inc_module_count(void) +{ + try_module_get(THIS_MODULE); +} + +void dec_module_count(void) +{ + module_put(THIS_MODULE); +} + +int addr_to_string(char *buff, uint8_t *addr) +{ + return sprintf(buff, "%02x:%02x:%02x:%02x:%02x:%02x", + addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); +} + +/* returns 1 if they are the same originator */ + +int compare_orig(void *data1, void *data2) +{ + return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); +} + +/* hashfunction to choose an entry in a hash table of given size */ +/* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */ +int choose_orig(void *data, int32_t size) +{ + unsigned char *key = data; + uint32_t hash = 0; + size_t i; + + for (i = 0; i < 6; i++) { + hash += key[i]; + hash += (hash << 10); + hash ^= (hash >> 6); + } + + hash += (hash << 3); + hash ^= (hash >> 11); + hash += (hash << 15); + + return hash % size; +} + +int is_my_mac(uint8_t *addr) +{ + struct batman_if *batman_if; + rcu_read_lock(); + list_for_each_entry_rcu(batman_if, &if_list, list) { + if ((batman_if->net_dev) && + (compare_orig(batman_if->net_dev->dev_addr, addr))) { + rcu_read_unlock(); + return 1; + } + } + rcu_read_unlock(); + return 0; + +} + +int is_bcast(uint8_t *addr) +{ + return (addr[0] == (uint8_t)0xff) && (addr[1] == (uint8_t)0xff); +} + +int is_mcast(uint8_t *addr) +{ + return *addr & 0x01; +} + +MODULE_LICENSE("GPL"); + +MODULE_AUTHOR(DRIVER_AUTHOR); +MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_SUPPORTED_DEVICE(DRIVER_DEVICE); +#ifdef REVISION_VERSION +MODULE_VERSION(SOURCE_VERSION "-" REVISION_VERSION); +#else +MODULE_VERSION(SOURCE_VERSION); +#endif diff --git a/drivers/staging/batman-adv/main.h b/drivers/staging/batman-adv/main.h new file mode 100644 index 000000000000..facb6b79ee52 --- /dev/null +++ b/drivers/staging/batman-adv/main.h @@ -0,0 +1,151 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +/* Kernel Programming */ +#define LINUX + +#define DRIVER_AUTHOR "Marek Lindner , Simon Wunderlich " +#define DRIVER_DESC "B.A.T.M.A.N. advanced" +#define DRIVER_DEVICE "batman-adv" + +#define SOURCE_VERSION "0.2.1-beta" + + +/* B.A.T.M.A.N. parameters */ + +#define TQ_MAX_VALUE 255 +#define JITTER 20 +#define TTL 50 /* Time To Live of broadcast messages */ +#define MAX_ADDR 16 /* number of interfaces which can be added to + * batman. */ + +#define PURGE_TIMEOUT 200000 /* purge originators after time in ms if no + * valid packet comes in -> TODO: check + * influence on TQ_LOCAL_WINDOW_SIZE */ +#define LOCAL_HNA_TIMEOUT 3600000 + +#define TQ_LOCAL_WINDOW_SIZE 64 /* sliding packet range of received originator + * messages in squence numbers (should be a + * multiple of our word size) */ +#define TQ_GLOBAL_WINDOW_SIZE 5 +#define TQ_LOCAL_BIDRECT_SEND_MINIMUM 1 +#define TQ_LOCAL_BIDRECT_RECV_MINIMUM 1 +#define TQ_TOTAL_BIDRECT_LIMIT 1 + +#define TQ_HOP_PENALTY 10 + +#define NUM_WORDS (TQ_LOCAL_WINDOW_SIZE / WORD_BIT_SIZE) + +#define PACKBUFF_SIZE 2000 +#define LOG_BUF_LEN 8192 /* has to be a power of 2 */ +#define ETH_STR_LEN 20 + +#define MAX_AGGREGATION_BYTES 512 /* should not be bigger than 512 bytes or + * change the size of + * forw_packet->direct_link_flags */ +#define MAX_AGGREGATION_MS 100 + +#define MODULE_INACTIVE 0 +#define MODULE_ACTIVE 1 +#define MODULE_DEACTIVATING 2 + + +/* + * Logging + */ + +#define LOG_TYPE_CRIT 0 /* highest priority for fatal errors such as + * blocked sockets / failed packet delivery / + * programming errors */ +#define LOG_TYPE_WARN 1 /* warnings for small errors like wrong user + * input / damaged packets / etc */ +#define LOG_TYPE_NOTICE 2 /* notice information for new interfaces / + * changed settings / new originators / etc */ +#define LOG_TYPE_BATMAN 4 /* all messages related to routing / flooding / + * broadcasting / etc */ +#define LOG_TYPE_ROUTES 8 /* route or hna added / changed / deleted */ +#define LOG_TYPE_CRIT_NAME "critical" +#define LOG_TYPE_WARN_NAME "warnings" +#define LOG_TYPE_NOTICE_NAME "notices" +#define LOG_TYPE_BATMAN_NAME "batman" +#define LOG_TYPE_ROUTES_NAME "routes" + +/* + * Vis + */ + +/* #define VIS_SUBCLUSTERS_DISABLED */ + +/* + * Kernel headers + */ + +#include /* mutex */ +#include /* needed by all modules */ +#include /* netdevice */ +#include /* ethernet header */ +#include /* poll_table */ +#include /* kernel threads */ +#include /* schedule types */ +#include /* workqueue */ +#include /* struct sock */ +#include +#include "types.h" + +#ifndef REVISION_VERSION +#define REVISION_VERSION_STR "" +#else +#define REVISION_VERSION_STR " "REVISION_VERSION +#endif + +extern struct list_head if_list; +extern struct hlist_head forw_bat_list; +extern struct hlist_head forw_bcast_list; +extern struct hashtable_t *orig_hash; + +extern spinlock_t orig_hash_lock; +extern spinlock_t forw_bat_list_lock; +extern spinlock_t forw_bcast_list_lock; + +extern atomic_t originator_interval; +extern atomic_t vis_interval; +extern atomic_t aggregation_enabled; +extern int16_t num_hna; +extern int16_t num_ifs; + +extern struct net_device *soft_device; + +extern unsigned char broadcastAddr[]; +extern atomic_t module_state; +extern struct workqueue_struct *bat_event_workqueue; + +void activate_module(void); +void shutdown_module(void); +void inc_module_count(void); +void dec_module_count(void); +int addr_to_string(char *buff, uint8_t *addr); +int compare_orig(void *data1, void *data2); +int choose_orig(void *data, int32_t size); +int is_my_mac(uint8_t *addr); +int is_bcast(uint8_t *addr); +int is_mcast(uint8_t *addr); + + diff --git a/drivers/staging/batman-adv/packet.h b/drivers/staging/batman-adv/packet.h new file mode 100644 index 000000000000..5627ca326018 --- /dev/null +++ b/drivers/staging/batman-adv/packet.h @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#define ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */ + +#define BAT_PACKET 0x01 +#define BAT_ICMP 0x02 +#define BAT_UNICAST 0x03 +#define BAT_BCAST 0x04 +#define BAT_VIS 0x05 + +/* this file is included by batctl which needs these defines */ +#define COMPAT_VERSION 8 +#define DIRECTLINK 0x40 +#define VIS_SERVER 0x20 + +/* ICMP message types */ +#define ECHO_REPLY 0 +#define DESTINATION_UNREACHABLE 3 +#define ECHO_REQUEST 8 +#define TTL_EXCEEDED 11 +#define PARAMETER_PROBLEM 12 + +/* vis defines */ +#define VIS_TYPE_SERVER_SYNC 0 +#define VIS_TYPE_CLIENT_UPDATE 1 + +struct batman_packet { + uint8_t packet_type; + uint8_t version; /* batman version field */ + uint8_t flags; /* 0x40: DIRECTLINK flag, 0x20 VIS_SERVER flag... */ + uint8_t tq; + uint16_t seqno; + uint8_t orig[6]; + uint8_t prev_sender[6]; + uint8_t ttl; + uint8_t num_hna; +} __attribute__((packed)); + +#define BAT_PACKET_LEN sizeof(struct batman_packet) + +struct icmp_packet { + uint8_t packet_type; + uint8_t version; /* batman version field */ + uint8_t msg_type; /* see ICMP message types above */ + uint8_t ttl; + uint8_t dst[6]; + uint8_t orig[6]; + uint16_t seqno; + uint8_t uid; +} __attribute__((packed)); + +struct unicast_packet { + uint8_t packet_type; + uint8_t version; /* batman version field */ + uint8_t dest[6]; + uint8_t ttl; +} __attribute__((packed)); + +struct bcast_packet { + uint8_t packet_type; + uint8_t version; /* batman version field */ + uint8_t orig[6]; + uint16_t seqno; +} __attribute__((packed)); + +struct vis_packet { + uint8_t packet_type; + uint8_t version; /* batman version field */ + uint8_t vis_type; /* which type of vis-participant sent this? */ + uint8_t seqno; /* sequence number */ + uint8_t entries; /* number of entries behind this struct */ + uint8_t ttl; /* TTL */ + uint8_t vis_orig[6]; /* originator that informs about its + * neighbours */ + uint8_t target_orig[6]; /* who should receive this packet */ + uint8_t sender_orig[6]; /* who sent or rebroadcasted this packet */ +} __attribute__((packed)); diff --git a/drivers/staging/batman-adv/proc.c b/drivers/staging/batman-adv/proc.c new file mode 100644 index 000000000000..aac3df7f13fb --- /dev/null +++ b/drivers/staging/batman-adv/proc.c @@ -0,0 +1,950 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include "main.h" +#include "proc.h" +#include "log.h" +#include "routing.h" +#include "translation-table.h" +#include "hard-interface.h" +#include "types.h" +#include "hash.h" +#include "vis.h" +#include "compat.h" + +static uint8_t vis_format = DOT_DRAW; + +static struct proc_dir_entry *proc_batman_dir, *proc_interface_file; +static struct proc_dir_entry *proc_orig_interval_file, *proc_originators_file; +static struct proc_dir_entry *proc_log_file, *proc_log_level_file; +static struct proc_dir_entry *proc_transt_local_file; +static struct proc_dir_entry *proc_transt_global_file; +static struct proc_dir_entry *proc_vis_file, *proc_vis_format_file; +static struct proc_dir_entry *proc_aggr_file; + +static int proc_interfaces_read(struct seq_file *seq, void *offset) +{ + struct batman_if *batman_if; + + rcu_read_lock(); + list_for_each_entry_rcu(batman_if, &if_list, list) { + seq_printf(seq, "[%8s] %s %s \n", + (batman_if->if_active == IF_ACTIVE ? + "active" : "inactive"), + batman_if->dev, + (batman_if->if_active == IF_ACTIVE ? + batman_if->addr_str : " ")); + } + rcu_read_unlock(); + + return 0; +} + +static int proc_interfaces_open(struct inode *inode, struct file *file) +{ + return single_open(file, proc_interfaces_read, NULL); +} + +static ssize_t proc_interfaces_write(struct file *instance, + const char __user *userbuffer, + size_t count, loff_t *data) +{ + char *if_string, *colon_ptr = NULL, *cr_ptr = NULL; + int not_copied = 0, if_num = 0; + struct batman_if *batman_if = NULL; + + if_string = kmalloc(count, GFP_KERNEL); + + if (!if_string) + return -ENOMEM; + + if (count > IFNAMSIZ - 1) { + debug_log(LOG_TYPE_WARN, + "Can't add interface: device name is too long\n"); + goto end; + } + + not_copied = copy_from_user(if_string, userbuffer, count); + if_string[count - not_copied - 1] = 0; + + colon_ptr = strchr(if_string, ':'); + if (colon_ptr) + *colon_ptr = 0; + + if (!colon_ptr) { + cr_ptr = strchr(if_string, '\n'); + if (cr_ptr) + *cr_ptr = 0; + } + + if (strlen(if_string) == 0) { + shutdown_module(); + num_ifs = 0; + goto end; + } + + /* add interface */ + rcu_read_lock(); + list_for_each_entry_rcu(batman_if, &if_list, list) { + if (strncmp(batman_if->dev, if_string, count) == 0) { + debug_log(LOG_TYPE_WARN, "Given interface is already active: %s\n", if_string); + rcu_read_unlock(); + goto end; + + } + + if_num++; + } + rcu_read_unlock(); + + hardif_add_interface(if_string, if_num); + + if ((atomic_read(&module_state) == MODULE_INACTIVE) && + (hardif_get_active_if_num() > 0)) + activate_module(); + + rcu_read_lock(); + if (list_empty(&if_list)) { + rcu_read_unlock(); + goto end; + } + rcu_read_unlock(); + + num_ifs = if_num + 1; + return count; + +end: + kfree(if_string); + return count; +} + +static int proc_orig_interval_read(struct seq_file *seq, void *offset) +{ + seq_printf(seq, "%i\n", atomic_read(&originator_interval)); + + return 0; +} + +static ssize_t proc_orig_interval_write(struct file *file, + const char __user *buffer, + size_t count, loff_t *ppos) +{ + char *interval_string; + int not_copied = 0; + unsigned long originator_interval_tmp; + int retval; + + interval_string = kmalloc(count, GFP_KERNEL); + + if (!interval_string) + return -ENOMEM; + + not_copied = copy_from_user(interval_string, buffer, count); + interval_string[count - not_copied - 1] = 0; + + retval = strict_strtoul(interval_string, 10, &originator_interval_tmp); + if (retval) { + debug_log(LOG_TYPE_WARN, "New originator interval invalid\n"); + goto end; + } + + if (originator_interval_tmp <= JITTER * 2) { + debug_log(LOG_TYPE_WARN, + "New originator interval too small: %i (min: %i)\n", + originator_interval_tmp, JITTER * 2); + goto end; + } + + debug_log(LOG_TYPE_NOTICE, + "Changing originator interval from: %i to: %i\n", + atomic_read(&originator_interval), originator_interval_tmp); + + atomic_set(&originator_interval, originator_interval_tmp); + +end: + kfree(interval_string); + return count; +} + +static int proc_orig_interval_open(struct inode *inode, struct file *file) +{ + return single_open(file, proc_orig_interval_read, NULL); +} + +static int proc_originators_read(struct seq_file *seq, void *offset) +{ + struct hash_it_t *hashit = NULL; + struct orig_node *orig_node; + struct neigh_node *neigh_node; + int batman_count = 0; + char orig_str[ETH_STR_LEN], router_str[ETH_STR_LEN]; + + rcu_read_lock(); + if (list_empty(&if_list)) { + rcu_read_unlock(); + seq_printf(seq, "BATMAN disabled - please specify interfaces to enable it \n"); + goto end; + } + + if (((struct batman_if *)if_list.next)->if_active != IF_ACTIVE) { + rcu_read_unlock(); + seq_printf(seq, "BATMAN disabled - primary interface not active \n"); + goto end; + } + + seq_printf(seq, + " %-14s (%s/%i) %17s [%10s]: %20s ... [B.A.T.M.A.N. adv %s%s, MainIF/MAC: %s/%s] \n", + "Originator", "#", TQ_MAX_VALUE, "Nexthop", "outgoingIF", + "Potential nexthops", SOURCE_VERSION, REVISION_VERSION_STR, + ((struct batman_if *)if_list.next)->dev, + ((struct batman_if *)if_list.next)->addr_str); + + rcu_read_unlock(); + spin_lock(&orig_hash_lock); + + while (NULL != (hashit = hash_iterate(orig_hash, hashit))) { + + orig_node = hashit->bucket->data; + + if (!orig_node->router) + continue; + + if (orig_node->router->tq_avg == 0) + continue; + + batman_count++; + + addr_to_string(orig_str, orig_node->orig); + addr_to_string(router_str, orig_node->router->addr); + + seq_printf(seq, "%-17s (%3i) %17s [%10s]:", + orig_str, orig_node->router->tq_avg, + router_str, orig_node->router->if_incoming->dev); + + list_for_each_entry(neigh_node, &orig_node->neigh_list, list) { + addr_to_string(orig_str, neigh_node->addr); + seq_printf(seq, " %17s (%3i)", + orig_str, neigh_node->tq_avg); + } + + seq_printf(seq, "\n"); + + } + + spin_unlock(&orig_hash_lock); + + if (batman_count == 0) + seq_printf(seq, "No batman nodes in range ... \n"); + +end: + return 0; +} + +static int proc_originators_open(struct inode *inode, struct file *file) +{ + return single_open(file, proc_originators_read, NULL); +} + +static int proc_log_level_read(struct seq_file *seq, void *offset) +{ + + seq_printf(seq, "[x] %s (%d)\n", LOG_TYPE_CRIT_NAME, LOG_TYPE_CRIT); + seq_printf(seq, "[%c] %s (%d)\n", + (LOG_TYPE_WARN & log_level) ? 'x' : ' ', + LOG_TYPE_WARN_NAME, LOG_TYPE_WARN); + seq_printf(seq, "[%c] %s (%d)\n", + (LOG_TYPE_NOTICE & log_level) ? 'x' : ' ', + LOG_TYPE_NOTICE_NAME, LOG_TYPE_NOTICE); + seq_printf(seq, "[%c] %s (%d)\n", + (LOG_TYPE_BATMAN & log_level) ? 'x' : ' ', + LOG_TYPE_BATMAN_NAME, LOG_TYPE_BATMAN); + seq_printf(seq, "[%c] %s (%d)\n", + (LOG_TYPE_ROUTES & log_level) ? 'x' : ' ', + LOG_TYPE_ROUTES_NAME, LOG_TYPE_ROUTES); + return 0; +} + +static int proc_log_level_open(struct inode *inode, struct file *file) +{ + return single_open(file, proc_log_level_read, NULL); +} + +static ssize_t proc_log_level_write(struct file *instance, + const char __user *userbuffer, + size_t count, loff_t *data) +{ + char *log_level_string, *tokptr, *cp; + int finished, not_copied = 0; + unsigned long log_level_tmp = 0; + + log_level_string = kmalloc(count, GFP_KERNEL); + + if (!log_level_string) + return -ENOMEM; + + not_copied = copy_from_user(log_level_string, userbuffer, count); + log_level_string[count - not_copied - 1] = 0; + + if (strict_strtoul(log_level_string, 10, &log_level_tmp) < 0) { + /* was not a number, doing textual parsing */ + log_level_tmp = 0; + tokptr = log_level_string; + + for (cp = log_level_string, finished = 0; !finished; cp++) { + switch (*cp) { + case 0: + finished = 1; + case ' ': + case '\n': + case '\t': + *cp = 0; + /* compare */ + if (strcmp(tokptr, LOG_TYPE_WARN_NAME) == 0) + log_level_tmp |= LOG_TYPE_WARN; + if (strcmp(tokptr, LOG_TYPE_NOTICE_NAME) == 0) + log_level_tmp |= LOG_TYPE_NOTICE; + if (strcmp(tokptr, LOG_TYPE_BATMAN_NAME) == 0) + log_level_tmp |= LOG_TYPE_BATMAN; + if (strcmp(tokptr, LOG_TYPE_ROUTES_NAME) == 0) + log_level_tmp |= LOG_TYPE_ROUTES; + tokptr = cp + 1; + break; + default: + ; + } + } + } + + debug_log(LOG_TYPE_CRIT, "Changing log_level from: %i to: %i\n", + log_level, log_level_tmp); + log_level = log_level_tmp; + + kfree(log_level_string); + return count; +} + +static int proc_transt_local_read(struct seq_file *seq, void *offset) +{ + char *buf; + + buf = kmalloc(4096, GFP_KERNEL); + if (!buf) + return 0; + + rcu_read_lock(); + if (list_empty(&if_list)) { + rcu_read_unlock(); + seq_printf(seq, "BATMAN disabled - please specify interfaces to enable it \n"); + goto end; + } + + rcu_read_unlock(); + + seq_printf(seq, "Locally retrieved addresses (from %s) announced via HNA:\n", soft_device->name); + + hna_local_fill_buffer_text(buf, 4096); + seq_printf(seq, "%s", buf); + +end: + kfree(buf); + return 0; +} + +static int proc_transt_local_open(struct inode *inode, struct file *file) +{ + return single_open(file, proc_transt_local_read, NULL); +} + +static int proc_transt_global_read(struct seq_file *seq, void *offset) +{ + char *buf; + + buf = kmalloc(4096, GFP_KERNEL); + if (!buf) + return 0; + + rcu_read_lock(); + if (list_empty(&if_list)) { + rcu_read_unlock(); + seq_printf(seq, "BATMAN disabled - please specify interfaces to enable it \n"); + goto end; + } + rcu_read_unlock(); + + + seq_printf(seq, "Globally announced HNAs received via the mesh (translation table):\n"); + + hna_global_fill_buffer_text(buf, 4096); + seq_printf(seq, "%s", buf); + +end: + kfree(buf); + return 0; +} + +static int proc_transt_global_open(struct inode *inode, struct file *file) +{ + return single_open(file, proc_transt_global_read, NULL); +} + +/* insert interface to the list of interfaces of one originator */ + +static void proc_vis_insert_interface(const uint8_t *interface, + struct vis_if_list **if_entry, + bool primary) +{ + /* Did we get an empty list? (then insert imediately) */ + if(*if_entry == NULL) { + *if_entry = kmalloc(sizeof(struct vis_if_list), GFP_KERNEL); + if (*if_entry == NULL) + return; + + (*if_entry)->primary = primary; + (*if_entry)->next = NULL; + memcpy((*if_entry)->addr, interface, ETH_ALEN); + } else { + struct vis_if_list *head_if_entry = *if_entry; + /* Do we already have this interface in our list? */ + while (!compare_orig((*if_entry)->addr, (void *)interface)) { + + /* Or did we reach the end (then append the interface) */ + if ((*if_entry)->next == NULL) { + (*if_entry)->next = kmalloc(sizeof(struct vis_if_list), GFP_KERNEL); + if ((*if_entry)->next == NULL) + return; + + memcpy((*if_entry)->next->addr, interface, ETH_ALEN); + (*if_entry)->next->primary = primary; + (*if_entry)->next->next = NULL; + break; + } + *if_entry = (*if_entry)->next; + } + /* Rewind the list to its head */ + *if_entry = head_if_entry; + } +} +/* read an entry */ + +static void proc_vis_read_entry(struct seq_file *seq, + struct vis_info_entry *entry, + struct vis_if_list **if_entry, + uint8_t *vis_orig, + uint8_t current_format, + uint8_t first_line) +{ + char from[40]; + char to[40]; + int int_part, frac_part; + + addr_to_string(to, entry->dest); + if (entry->quality == 0) { +#ifndef VIS_SUBCLUSTERS_DISABLED + proc_vis_insert_interface(vis_orig, if_entry, true); +#endif /* VIS_SUBCLUSTERS_DISABLED */ + addr_to_string(from, vis_orig); + if (current_format == DOT_DRAW) { + seq_printf(seq, "\t\"%s\" -> \"%s\" [label=\"HNA\"]\n", + from, to); + } else { + seq_printf(seq, + "%s\t{ router : \"%s\", gateway : \"%s\", label : \"HNA\" }", + (first_line ? "" : ",\n"), from, to); + } + } else { +#ifndef VIS_SUBCLUSTERS_DISABLED + proc_vis_insert_interface(entry->src, if_entry, compare_orig(entry->src, vis_orig)); +#endif /* VIS_SUBCLUSTERS_DISABLED */ + addr_to_string(from, entry->src); + + /* kernel has no printf-support for %f? it'd be better to return + * this in float. */ + + int_part = TQ_MAX_VALUE / entry->quality; + frac_part = 1000 * TQ_MAX_VALUE / entry->quality - int_part * 1000; + + if (current_format == DOT_DRAW) { + seq_printf(seq, + "\t\"%s\" -> \"%s\" [label=\"%d.%d\"]\n", + from, to, int_part, frac_part); + } else { + seq_printf(seq, + "%s\t{ router : \"%s\", neighbour : \"%s\", label : %d.%d }", + (first_line ? "" : ",\n"), from, to, int_part, frac_part); + } + } +} + + +static int proc_vis_read(struct seq_file *seq, void *offset) +{ + struct hash_it_t *hashit = NULL; + struct vis_info *info; + struct vis_info_entry *entries; + struct vis_if_list *if_entries = NULL; + int i; + uint8_t current_format, first_line = 1; +#ifndef VIS_SUBCLUSTERS_DISABLED + char tmp_addr_str[ETH_STR_LEN]; + struct vis_if_list *tmp_if_next; +#endif /* VIS_SUBCLUSTERS_DISABLED */ + + current_format = vis_format; + + rcu_read_lock(); + if (list_empty(&if_list) || (!is_vis_server())) { + rcu_read_unlock(); + if (current_format == DOT_DRAW) + seq_printf(seq, "digraph {\n}\n"); + goto end; + } + + rcu_read_unlock(); + + if (current_format == DOT_DRAW) + seq_printf(seq, "digraph {\n"); + + spin_lock(&vis_hash_lock); + while (NULL != (hashit = hash_iterate(vis_hash, hashit))) { + info = hashit->bucket->data; + entries = (struct vis_info_entry *) + ((char *)info + sizeof(struct vis_info)); + + for (i = 0; i < info->packet.entries; i++) { + proc_vis_read_entry(seq, &entries[i], &if_entries, + info->packet.vis_orig, + current_format, first_line); + if (first_line) + first_line = 0; + } + +#ifndef VIS_SUBCLUSTERS_DISABLED + /* Generate subgraphs from the collected items */ + if (current_format == DOT_DRAW) { + + addr_to_string(tmp_addr_str, info->packet.vis_orig); + seq_printf(seq, "\tsubgraph \"cluster_%s\" {\n", tmp_addr_str); + while (if_entries != NULL) { + + addr_to_string(tmp_addr_str, if_entries->addr); + if (if_entries->primary) + seq_printf(seq, "\t\t\"%s\" [peripheries=2]\n", tmp_addr_str); + else + seq_printf(seq, "\t\t\"%s\"\n", tmp_addr_str); + + /* ... and empty the list while doing this */ + tmp_if_next = if_entries->next; + kfree(if_entries); + if_entries = tmp_if_next; + } + seq_printf(seq, "\t}\n"); + } +#endif /* VIS_SUBCLUSTERS_DISABLED */ + } + spin_unlock(&vis_hash_lock); + + if (current_format == DOT_DRAW) + seq_printf(seq, "}\n"); + else + seq_printf(seq, "\n"); +end: + return 0; +} + +/* setting the mode of the vis server by the user */ +static ssize_t proc_vis_write(struct file *file, const char __user * buffer, + size_t count, loff_t *ppos) +{ + char *vis_mode_string; + int not_copied = 0; + + vis_mode_string = kmalloc(count, GFP_KERNEL); + + if (!vis_mode_string) + return -ENOMEM; + + not_copied = copy_from_user(vis_mode_string, buffer, count); + vis_mode_string[count - not_copied - 1] = 0; + + if (strcmp(vis_mode_string, "client") == 0) { + debug_log(LOG_TYPE_NOTICE, "Setting VIS mode to client\n"); + vis_set_mode(VIS_TYPE_CLIENT_UPDATE); + } else if (strcmp(vis_mode_string, "server") == 0) { + debug_log(LOG_TYPE_NOTICE, "Setting VIS mode to server\n"); + vis_set_mode(VIS_TYPE_SERVER_SYNC); + } else + debug_log(LOG_TYPE_WARN, "Unknown VIS mode: %s\n", + vis_mode_string); + + kfree(vis_mode_string); + return count; +} + +static int proc_vis_open(struct inode *inode, struct file *file) +{ + return single_open(file, proc_vis_read, NULL); +} + +static int proc_vis_format_read(struct seq_file *seq, void *offset) +{ + uint8_t current_format = vis_format; + + seq_printf(seq, "[%c] %s\n", + (current_format == DOT_DRAW) ? 'x' : ' ', + VIS_FORMAT_DD_NAME); + seq_printf(seq, "[%c] %s\n", + (current_format == JSON) ? 'x' : ' ', + VIS_FORMAT_JSON_NAME); + return 0; +} + +static int proc_vis_format_open(struct inode *inode, struct file *file) +{ + return single_open(file, proc_vis_format_read, NULL); +} + +static ssize_t proc_vis_format_write(struct file *file, + const char __user *buffer, + size_t count, loff_t *ppos) +{ + char *vis_format_string; + int not_copied = 0; + + vis_format_string = kmalloc(count, GFP_KERNEL); + + if (!vis_format_string) + return -ENOMEM; + + not_copied = copy_from_user(vis_format_string, buffer, count); + vis_format_string[count - not_copied - 1] = 0; + + if (strcmp(vis_format_string, VIS_FORMAT_DD_NAME) == 0) { + debug_log(LOG_TYPE_NOTICE, "Setting VIS output format to: %s\n", + VIS_FORMAT_DD_NAME); + vis_format = DOT_DRAW; + } else if (strcmp(vis_format_string, VIS_FORMAT_JSON_NAME) == 0) { + debug_log(LOG_TYPE_NOTICE, "Setting VIS output format to: %s\n", + VIS_FORMAT_JSON_NAME); + vis_format = JSON; + } else + debug_log(LOG_TYPE_WARN, "Unknown VIS output format: %s\n", + vis_format_string); + + kfree(vis_format_string); + return count; +} + +static int proc_aggr_read(struct seq_file *seq, void *offset) +{ + seq_printf(seq, "%i\n", atomic_read(&aggregation_enabled)); + + return 0; +} + +static ssize_t proc_aggr_write(struct file *file, const char __user *buffer, + size_t count, loff_t *ppos) +{ + char *aggr_string; + int not_copied = 0; + unsigned long aggregation_enabled_tmp; + + aggr_string = kmalloc(count, GFP_KERNEL); + + if (!aggr_string) + return -ENOMEM; + + not_copied = copy_from_user(aggr_string, buffer, count); + aggr_string[count - not_copied - 1] = 0; + + strict_strtoul(aggr_string, 10, &aggregation_enabled_tmp); + + if ((aggregation_enabled_tmp != 0) && (aggregation_enabled_tmp != 1)) { + debug_log(LOG_TYPE_WARN, "Aggregation can only be enabled (1) or disabled (0), given value: %li\n", aggregation_enabled_tmp); + goto end; + } + + debug_log(LOG_TYPE_NOTICE, "Changing aggregation from: %s (%i) to: %s (%li)\n", + (atomic_read(&aggregation_enabled) == 1 ? + "enabled" : "disabled"), + atomic_read(&aggregation_enabled), + (aggregation_enabled_tmp == 1 ? "enabled" : "disabled"), + aggregation_enabled_tmp); + + atomic_set(&aggregation_enabled, (unsigned)aggregation_enabled_tmp); +end: + kfree(aggr_string); + return count; +} + +static int proc_aggr_open(struct inode *inode, struct file *file) +{ + return single_open(file, proc_aggr_read, NULL); +} + +/* satisfying different prototypes ... */ +static ssize_t proc_dummy_write(struct file *file, const char __user *buffer, + size_t count, loff_t *ppos) +{ + return count; +} + +static const struct file_operations proc_aggr_fops = { + .owner = THIS_MODULE, + .open = proc_aggr_open, + .read = seq_read, + .write = proc_aggr_write, + .llseek = seq_lseek, + .release = single_release, +}; + +static const struct file_operations proc_vis_format_fops = { + .owner = THIS_MODULE, + .open = proc_vis_format_open, + .read = seq_read, + .write = proc_vis_format_write, + .llseek = seq_lseek, + .release = single_release, +}; + +static const struct file_operations proc_vis_fops = { + .owner = THIS_MODULE, + .open = proc_vis_open, + .read = seq_read, + .write = proc_vis_write, + .llseek = seq_lseek, + .release = single_release, +}; + +static const struct file_operations proc_originators_fops = { + .owner = THIS_MODULE, + .open = proc_originators_open, + .read = seq_read, + .write = proc_dummy_write, + .llseek = seq_lseek, + .release = single_release, +}; + +static const struct file_operations proc_transt_local_fops = { + .owner = THIS_MODULE, + .open = proc_transt_local_open, + .read = seq_read, + .write = proc_dummy_write, + .llseek = seq_lseek, + .release = single_release, +}; + +static const struct file_operations proc_transt_global_fops = { + .owner = THIS_MODULE, + .open = proc_transt_global_open, + .read = seq_read, + .write = proc_dummy_write, + .llseek = seq_lseek, + .release = single_release, +}; + +static const struct file_operations proc_log_level_fops = { + .owner = THIS_MODULE, + .open = proc_log_level_open, + .read = seq_read, + .write = proc_log_level_write, + .llseek = seq_lseek, + .release = single_release, +}; + +static const struct file_operations proc_interfaces_fops = { + .owner = THIS_MODULE, + .open = proc_interfaces_open, + .read = seq_read, + .write = proc_interfaces_write, + .llseek = seq_lseek, + .release = single_release, +}; + +static const struct file_operations proc_orig_interval_fops = { + .owner = THIS_MODULE, + .open = proc_orig_interval_open, + .read = seq_read, + .write = proc_orig_interval_write, + .llseek = seq_lseek, + .release = single_release, +}; + +void cleanup_procfs(void) +{ + if (proc_transt_global_file) + remove_proc_entry(PROC_FILE_TRANST_GLOBAL, proc_batman_dir); + + if (proc_transt_local_file) + remove_proc_entry(PROC_FILE_TRANST_LOCAL, proc_batman_dir); + + if (proc_log_file) + remove_proc_entry(PROC_FILE_LOG, proc_batman_dir); + + if (proc_log_level_file) + remove_proc_entry(PROC_FILE_LOG_LEVEL, proc_batman_dir); + + if (proc_originators_file) + remove_proc_entry(PROC_FILE_ORIGINATORS, proc_batman_dir); + + if (proc_orig_interval_file) + remove_proc_entry(PROC_FILE_ORIG_INTERVAL, proc_batman_dir); + + if (proc_interface_file) + remove_proc_entry(PROC_FILE_INTERFACES, proc_batman_dir); + + if (proc_vis_file) + remove_proc_entry(PROC_FILE_VIS, proc_batman_dir); + + if (proc_vis_format_file) + remove_proc_entry(PROC_FILE_VIS_FORMAT, proc_batman_dir); + + if (proc_aggr_file) + remove_proc_entry(PROC_FILE_AGGR, proc_batman_dir); + + if (proc_batman_dir) +#ifdef __NET_NET_NAMESPACE_H + remove_proc_entry(PROC_ROOT_DIR, init_net.proc_net); +#else + remove_proc_entry(PROC_ROOT_DIR, proc_net); +#endif +} + +int setup_procfs(void) +{ +#ifdef __NET_NET_NAMESPACE_H + proc_batman_dir = proc_mkdir(PROC_ROOT_DIR, init_net.proc_net); +#else + proc_batman_dir = proc_mkdir(PROC_ROOT_DIR, proc_net); +#endif + + if (!proc_batman_dir) { + printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s' folder failed\n", PROC_ROOT_DIR); + return -EFAULT; + } + + proc_interface_file = create_proc_entry(PROC_FILE_INTERFACES, + S_IWUSR | S_IRUGO, + proc_batman_dir); + if (proc_interface_file) { + proc_interface_file->proc_fops = &proc_interfaces_fops; + } else { + printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_INTERFACES); + cleanup_procfs(); + return -EFAULT; + } + + proc_orig_interval_file = create_proc_entry(PROC_FILE_ORIG_INTERVAL, + S_IWUSR | S_IRUGO, + proc_batman_dir); + if (proc_orig_interval_file) { + proc_orig_interval_file->proc_fops = &proc_orig_interval_fops; + } else { + printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_ORIG_INTERVAL); + cleanup_procfs(); + return -EFAULT; + } + + proc_log_level_file = create_proc_entry(PROC_FILE_LOG_LEVEL, + S_IWUSR | S_IRUGO, + proc_batman_dir); + if (proc_log_level_file) { + proc_log_level_file->proc_fops = &proc_log_level_fops; + } else { + printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_LOG_LEVEL); + cleanup_procfs(); + return -EFAULT; + } + + proc_originators_file = create_proc_entry(PROC_FILE_ORIGINATORS, + S_IRUGO, proc_batman_dir); + if (proc_originators_file) { + proc_originators_file->proc_fops = &proc_originators_fops; + } else { + printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_ORIGINATORS); + cleanup_procfs(); + return -EFAULT; + } + + proc_log_file = create_proc_entry(PROC_FILE_LOG, + S_IRUGO, proc_batman_dir); + if (proc_log_file) { + proc_log_file->proc_fops = &proc_log_operations; + } else { + printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_FILE_LOG, PROC_FILE_GATEWAYS); + cleanup_procfs(); + return -EFAULT; + } + + proc_transt_local_file = create_proc_entry(PROC_FILE_TRANST_LOCAL, + S_IRUGO, proc_batman_dir); + if (proc_transt_local_file) { + proc_transt_local_file->proc_fops = &proc_transt_local_fops; + } else { + printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_TRANST_LOCAL); + cleanup_procfs(); + return -EFAULT; + } + + proc_transt_global_file = create_proc_entry(PROC_FILE_TRANST_GLOBAL, + S_IRUGO, proc_batman_dir); + if (proc_transt_global_file) { + proc_transt_global_file->proc_fops = &proc_transt_global_fops; + } else { + printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_TRANST_GLOBAL); + cleanup_procfs(); + return -EFAULT; + } + + proc_vis_file = create_proc_entry(PROC_FILE_VIS, S_IWUSR | S_IRUGO, + proc_batman_dir); + if (proc_vis_file) { + proc_vis_file->proc_fops = &proc_vis_fops; + } else { + printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_VIS); + cleanup_procfs(); + return -EFAULT; + } + + proc_vis_format_file = create_proc_entry(PROC_FILE_VIS_FORMAT, + S_IWUSR | S_IRUGO, + proc_batman_dir); + if (proc_vis_format_file) { + proc_vis_format_file->proc_fops = &proc_vis_format_fops; + } else { + printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_VIS_FORMAT); + cleanup_procfs(); + return -EFAULT; + } + + proc_aggr_file = create_proc_entry(PROC_FILE_AGGR, S_IWUSR | S_IRUGO, + proc_batman_dir); + if (proc_aggr_file) { + proc_aggr_file->proc_fops = &proc_aggr_fops; + } else { + printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_AGGR); + cleanup_procfs(); + return -EFAULT; + } + + return 0; +} + + diff --git a/drivers/staging/batman-adv/proc.h b/drivers/staging/batman-adv/proc.h new file mode 100644 index 000000000000..16d3efdebe52 --- /dev/null +++ b/drivers/staging/batman-adv/proc.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include +#include + +#define PROC_ROOT_DIR "batman-adv" +#define PROC_FILE_INTERFACES "interfaces" +#define PROC_FILE_ORIG_INTERVAL "orig_interval" +#define PROC_FILE_ORIGINATORS "originators" +#define PROC_FILE_GATEWAYS "gateways" +#define PROC_FILE_LOG "log" +#define PROC_FILE_LOG_LEVEL "log_level" +#define PROC_FILE_TRANST_LOCAL "transtable_local" +#define PROC_FILE_TRANST_GLOBAL "transtable_global" +#define PROC_FILE_VIS "vis" +#define PROC_FILE_VIS_FORMAT "vis_format" +#define PROC_FILE_AGGR "aggregate_ogm" + +void cleanup_procfs(void); +int setup_procfs(void); + +/* While scanning for vis-entries of a particular vis-originator + * this list collects its interfaces to create a subgraph/cluster + * out of them later + */ +struct vis_if_list { + uint8_t addr[ETH_ALEN]; + bool primary; + struct vis_if_list *next; +}; diff --git a/drivers/staging/batman-adv/ring_buffer.c b/drivers/staging/batman-adv/ring_buffer.c new file mode 100644 index 000000000000..751c899f54c5 --- /dev/null +++ b/drivers/staging/batman-adv/ring_buffer.c @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include "main.h" +#include "ring_buffer.h" + +void ring_buffer_set(uint8_t lq_recv[], uint8_t *lq_index, uint8_t value) +{ + lq_recv[*lq_index] = value; + *lq_index = (*lq_index + 1) % TQ_GLOBAL_WINDOW_SIZE; +} + +uint8_t ring_buffer_avg(uint8_t lq_recv[]) +{ + uint8_t *ptr; + uint16_t count = 0, i = 0, sum = 0; + + ptr = lq_recv; + + while (i < TQ_GLOBAL_WINDOW_SIZE) { + if (*ptr != 0) { + count++; + sum += *ptr; + } + + i++; + ptr++; + } + + if (count == 0) + return 0; + + return (uint8_t)(sum / count); +} diff --git a/drivers/staging/batman-adv/ring_buffer.h b/drivers/staging/batman-adv/ring_buffer.h new file mode 100644 index 000000000000..6839ba97eeb3 --- /dev/null +++ b/drivers/staging/batman-adv/ring_buffer.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +void ring_buffer_set(uint8_t lq_recv[], uint8_t *lq_index, uint8_t value); +uint8_t ring_buffer_avg(uint8_t lq_recv[]); diff --git a/drivers/staging/batman-adv/routing.c b/drivers/staging/batman-adv/routing.c new file mode 100644 index 000000000000..4a14c363ac2b --- /dev/null +++ b/drivers/staging/batman-adv/routing.c @@ -0,0 +1,1010 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + + + + + +#include "main.h" +#include "routing.h" +#include "log.h" +#include "send.h" +#include "soft-interface.h" +#include "hard-interface.h" +#include "device.h" +#include "translation-table.h" +#include "types.h" +#include "hash.h" +#include "ring_buffer.h" +#include "vis.h" +#include "aggregation.h" +#include "compat.h" + + + +DECLARE_WAIT_QUEUE_HEAD(thread_wait); +static DECLARE_DELAYED_WORK(purge_orig_wq, purge_orig); + +static atomic_t data_ready_cond; +atomic_t exit_cond; + +static void start_purge_timer(void) +{ + queue_delayed_work(bat_event_workqueue, &purge_orig_wq, 1 * HZ); +} + +int originator_init(void) +{ + if (orig_hash) + return 1; + + spin_lock(&orig_hash_lock); + orig_hash = hash_new(128, compare_orig, choose_orig); + + if (!orig_hash) + goto err; + + spin_unlock(&orig_hash_lock); + start_purge_timer(); + return 1; + +err: + spin_unlock(&orig_hash_lock); + return 0; +} + +void originator_free(void) +{ + if (!orig_hash) + return; + + cancel_delayed_work_sync(&purge_orig_wq); + + spin_lock(&orig_hash_lock); + hash_delete(orig_hash, free_orig_node); + orig_hash = NULL; + spin_unlock(&orig_hash_lock); +} + +static struct neigh_node *create_neighbor(struct orig_node *orig_node, struct orig_node *orig_neigh_node, uint8_t *neigh, struct batman_if *if_incoming) +{ + struct neigh_node *neigh_node; + + debug_log(LOG_TYPE_BATMAN, "Creating new last-hop neighbour of originator\n"); + + neigh_node = kmalloc(sizeof(struct neigh_node), GFP_ATOMIC); + memset(neigh_node, 0, sizeof(struct neigh_node)); + INIT_LIST_HEAD(&neigh_node->list); + + memcpy(neigh_node->addr, neigh, ETH_ALEN); + neigh_node->orig_node = orig_neigh_node; + neigh_node->if_incoming = if_incoming; + + list_add_tail(&neigh_node->list, &orig_node->neigh_list); + return neigh_node; +} + +void free_orig_node(void *data) +{ + struct list_head *list_pos, *list_pos_tmp; + struct neigh_node *neigh_node; + struct orig_node *orig_node = (struct orig_node *)data; + + /* for all neighbours towards this originator ... */ + list_for_each_safe(list_pos, list_pos_tmp, &orig_node->neigh_list) { + neigh_node = list_entry(list_pos, struct neigh_node, list); + + list_del(list_pos); + kfree(neigh_node); + } + + hna_global_del_orig(orig_node, "originator timed out"); + + kfree(orig_node->bcast_own); + kfree(orig_node->bcast_own_sum); + kfree(orig_node); +} + +/* this function finds or creates an originator entry for the given address if it does not exits */ +static struct orig_node *get_orig_node(uint8_t *addr) +{ + struct orig_node *orig_node; + struct hashtable_t *swaphash; + char orig_str[ETH_STR_LEN]; + + orig_node = ((struct orig_node *)hash_find(orig_hash, addr)); + + if (orig_node != NULL) + return orig_node; + + addr_to_string(orig_str, addr); + debug_log(LOG_TYPE_BATMAN, "Creating new originator: %s \n", orig_str); + + orig_node = kmalloc(sizeof(struct orig_node), GFP_ATOMIC); + memset(orig_node, 0, sizeof(struct orig_node)); + INIT_LIST_HEAD(&orig_node->neigh_list); + + memcpy(orig_node->orig, addr, ETH_ALEN); + orig_node->router = NULL; + orig_node->batman_if = NULL; + orig_node->hna_buff = NULL; + + orig_node->bcast_own = kmalloc(num_ifs * sizeof(TYPE_OF_WORD) * NUM_WORDS, GFP_ATOMIC); + memset(orig_node->bcast_own, 0, num_ifs * sizeof(TYPE_OF_WORD) * NUM_WORDS); + + orig_node->bcast_own_sum = kmalloc(num_ifs * sizeof(uint8_t), GFP_ATOMIC); + memset(orig_node->bcast_own_sum, 0, num_ifs * sizeof(uint8_t)); + + hash_add(orig_hash, orig_node); + + if (orig_hash->elements * 4 > orig_hash->size) { + swaphash = hash_resize(orig_hash, orig_hash->size * 2); + + if (swaphash == NULL) + debug_log(LOG_TYPE_CRIT, "Couldn't resize orig hash table \n"); + else + orig_hash = swaphash; + } + + return orig_node; +} + +void slide_own_bcast_window(struct batman_if *batman_if) +{ + struct hash_it_t *hashit = NULL; + struct orig_node *orig_node; + + spin_lock(&orig_hash_lock); + + while (NULL != (hashit = hash_iterate(orig_hash, hashit))) { + orig_node = hashit->bucket->data; + + bit_get_packet((TYPE_OF_WORD *)&(orig_node->bcast_own[batman_if->if_num * NUM_WORDS]), 1, 0); + orig_node->bcast_own_sum[batman_if->if_num] = bit_packet_count((TYPE_OF_WORD *)&(orig_node->bcast_own[batman_if->if_num * NUM_WORDS])); + } + + spin_unlock(&orig_hash_lock); +} + +static void update_routes(struct orig_node *orig_node, struct neigh_node *neigh_node, unsigned char *hna_buff, int hna_buff_len) +{ + char orig_str[ETH_STR_LEN], neigh_str[ETH_STR_LEN], router_str[ETH_STR_LEN]; + + if (orig_node == NULL) + return; + + if (orig_node->router != neigh_node) { + addr_to_string(orig_str, orig_node->orig); + + /* route deleted */ + if ((orig_node->router != NULL) && (neigh_node == NULL)) { + + debug_log(LOG_TYPE_ROUTES, "Deleting route towards: %s\n", orig_str); + hna_global_del_orig(orig_node, "originator timed out"); + + /* route added */ + } else if ((orig_node->router == NULL) && (neigh_node != NULL)) { + + addr_to_string(neigh_str, neigh_node->addr); + debug_log(LOG_TYPE_ROUTES, "Adding route towards: %s (via %s)\n", orig_str, neigh_str); + hna_global_add_orig(orig_node, hna_buff, hna_buff_len); + + /* route changed */ + } else { + + addr_to_string(neigh_str, neigh_node->addr); + addr_to_string(router_str, orig_node->router->addr); + debug_log(LOG_TYPE_ROUTES, "Changing route towards: %s (now via %s - was via %s)\n", orig_str, neigh_str, router_str); + + } + + if (neigh_node != NULL) + orig_node->batman_if = neigh_node->if_incoming; + else + orig_node->batman_if = NULL; + + orig_node->router = neigh_node; + + /* may be just HNA changed */ + } else { + + if ((hna_buff_len != orig_node->hna_buff_len) || ((hna_buff_len > 0) && (orig_node->hna_buff_len > 0) && (memcmp(orig_node->hna_buff, hna_buff, hna_buff_len) != 0))) { + + if (orig_node->hna_buff_len > 0) + hna_global_del_orig(orig_node, "originator changed hna"); + + if ((hna_buff_len > 0) && (hna_buff != NULL)) + hna_global_add_orig(orig_node, hna_buff, hna_buff_len); + + } + + } +} + +static int isBidirectionalNeigh(struct orig_node *orig_node, struct orig_node *orig_neigh_node, struct batman_packet *batman_packet, struct batman_if *if_incoming) +{ + struct neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL; + char orig_str[ETH_STR_LEN], neigh_str[ETH_STR_LEN]; + unsigned char total_count; + + addr_to_string(orig_str, orig_node->orig); + addr_to_string(neigh_str, orig_neigh_node->orig); + + if (orig_node == orig_neigh_node) { + list_for_each_entry(tmp_neigh_node, &orig_node->neigh_list, list) { + + if (compare_orig(tmp_neigh_node->addr, orig_neigh_node->orig) && (tmp_neigh_node->if_incoming == if_incoming)) + neigh_node = tmp_neigh_node; + } + + if (neigh_node == NULL) + neigh_node = create_neighbor(orig_node, orig_neigh_node, orig_neigh_node->orig, if_incoming); + + neigh_node->last_valid = jiffies; + } else { + /* find packet count of corresponding one hop neighbor */ + list_for_each_entry(tmp_neigh_node, &orig_neigh_node->neigh_list, list) { + + if (compare_orig(tmp_neigh_node->addr, orig_neigh_node->orig) && (tmp_neigh_node->if_incoming == if_incoming)) + neigh_node = tmp_neigh_node; + } + + if (neigh_node == NULL) + neigh_node = create_neighbor(orig_neigh_node, orig_neigh_node, orig_neigh_node->orig, if_incoming); + } + + orig_node->last_valid = jiffies; + + /* pay attention to not get a value bigger than 100 % */ + total_count = (orig_neigh_node->bcast_own_sum[if_incoming->if_num] > neigh_node->real_packet_count ? neigh_node->real_packet_count : orig_neigh_node->bcast_own_sum[if_incoming->if_num]); + + /* if we have too few packets (too less data) we set tq_own to zero */ + /* if we receive too few packets it is not considered bidirectional */ + if ((total_count < TQ_LOCAL_BIDRECT_SEND_MINIMUM) || (neigh_node->real_packet_count < TQ_LOCAL_BIDRECT_RECV_MINIMUM)) + orig_neigh_node->tq_own = 0; + else + /* neigh_node->real_packet_count is never zero as we only purge old information when getting new information */ + orig_neigh_node->tq_own = (TQ_MAX_VALUE * total_count) / neigh_node->real_packet_count; + + /* + * 1 - ((1-x) ** 3), normalized to TQ_MAX_VALUE + * this does affect the nearly-symmetric links only a little, + * but punishes asymmetric links more. + * this will give a value between 0 and TQ_MAX_VALUE + */ + orig_neigh_node->tq_asym_penalty = TQ_MAX_VALUE - (TQ_MAX_VALUE * + (TQ_LOCAL_WINDOW_SIZE - neigh_node->real_packet_count) * + (TQ_LOCAL_WINDOW_SIZE - neigh_node->real_packet_count) * + (TQ_LOCAL_WINDOW_SIZE - neigh_node->real_packet_count)) / + (TQ_LOCAL_WINDOW_SIZE * TQ_LOCAL_WINDOW_SIZE * TQ_LOCAL_WINDOW_SIZE); + + batman_packet->tq = ((batman_packet->tq * orig_neigh_node->tq_own * orig_neigh_node->tq_asym_penalty) / (TQ_MAX_VALUE * TQ_MAX_VALUE)); + + debug_log(LOG_TYPE_BATMAN, "bidirectional: orig = %-15s neigh = %-15s => own_bcast = %2i, real recv = %2i, local tq: %3i, asym_penalty: %3i, total tq: %3i \n", + orig_str, neigh_str, total_count, neigh_node->real_packet_count, orig_neigh_node->tq_own, orig_neigh_node->tq_asym_penalty, batman_packet->tq); + + /* if link has the minimum required transmission quality consider it bidirectional */ + if (batman_packet->tq >= TQ_TOTAL_BIDRECT_LIMIT) + return 1; + + return 0; +} + +static void update_orig(struct orig_node *orig_node, struct ethhdr *ethhdr, struct batman_packet *batman_packet, struct batman_if *if_incoming, unsigned char *hna_buff, int hna_buff_len, char is_duplicate) +{ + struct neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL; + int tmp_hna_buff_len; + + debug_log(LOG_TYPE_BATMAN, "update_originator(): Searching and updating originator entry of received packet \n"); + + list_for_each_entry(tmp_neigh_node, &orig_node->neigh_list, list) { + if (compare_orig(tmp_neigh_node->addr, ethhdr->h_source) && (tmp_neigh_node->if_incoming == if_incoming)) { + neigh_node = tmp_neigh_node; + continue; + } + + if (is_duplicate) + continue; + + ring_buffer_set(tmp_neigh_node->tq_recv, &tmp_neigh_node->tq_index, 0); + tmp_neigh_node->tq_avg = ring_buffer_avg(tmp_neigh_node->tq_recv); + } + + if (neigh_node == NULL) + neigh_node = create_neighbor(orig_node, get_orig_node(ethhdr->h_source), ethhdr->h_source, if_incoming); + else + debug_log(LOG_TYPE_BATMAN, "Updating existing last-hop neighbour of originator\n"); + + orig_node->flags = batman_packet->flags; + neigh_node->last_valid = jiffies; + + ring_buffer_set(neigh_node->tq_recv, &neigh_node->tq_index, batman_packet->tq); + neigh_node->tq_avg = ring_buffer_avg(neigh_node->tq_recv); + + if (!is_duplicate) { + orig_node->last_ttl = batman_packet->ttl; + neigh_node->last_ttl = batman_packet->ttl; + } + + tmp_hna_buff_len = (hna_buff_len > batman_packet->num_hna * ETH_ALEN ? batman_packet->num_hna * ETH_ALEN : hna_buff_len); + + /* if this neighbor already is our next hop there is nothing to change */ + if (orig_node->router == neigh_node) + goto update_hna; + + /* if this neighbor does not offer a better TQ we won't consider it */ + if ((orig_node->router) && + (orig_node->router->tq_avg > neigh_node->tq_avg)) + goto update_hna; + + /* if the TQ is the same and the link not more symetric we won't consider it either */ + if ((orig_node->router) && + ((neigh_node->tq_avg == orig_node->router->tq_avg) && + (orig_node->router->orig_node->bcast_own_sum[if_incoming->if_num] >= + neigh_node->orig_node->bcast_own_sum[if_incoming->if_num]))) + goto update_hna; + + update_routes(orig_node, neigh_node, hna_buff, tmp_hna_buff_len); + return; + +update_hna: + update_routes(orig_node, orig_node->router, hna_buff, tmp_hna_buff_len); + return; +} + +static char count_real_packets(struct ethhdr *ethhdr, struct batman_packet *batman_packet, struct batman_if *if_incoming) +{ + struct orig_node *orig_node; + struct neigh_node *tmp_neigh_node; + char is_duplicate = 0; + + + orig_node = get_orig_node(batman_packet->orig); + if (orig_node == NULL) + return 0; + + + list_for_each_entry(tmp_neigh_node, &orig_node->neigh_list, list) { + + if (!is_duplicate) + is_duplicate = get_bit_status(tmp_neigh_node->real_bits, orig_node->last_real_seqno, batman_packet->seqno); + + if (compare_orig(tmp_neigh_node->addr, ethhdr->h_source) && (tmp_neigh_node->if_incoming == if_incoming)) + bit_get_packet(tmp_neigh_node->real_bits, batman_packet->seqno - orig_node->last_real_seqno, 1); + else + bit_get_packet(tmp_neigh_node->real_bits, batman_packet->seqno - orig_node->last_real_seqno, 0); + + tmp_neigh_node->real_packet_count = bit_packet_count(tmp_neigh_node->real_bits); + } + + if (!is_duplicate) { + debug_log(LOG_TYPE_BATMAN, "updating last_seqno: old %d, new %d \n", orig_node->last_real_seqno, batman_packet->seqno); + orig_node->last_real_seqno = batman_packet->seqno; + } + + return is_duplicate; +} + +void receive_bat_packet(struct ethhdr *ethhdr, struct batman_packet *batman_packet, unsigned char *hna_buff, int hna_buff_len, struct batman_if *if_incoming) +{ + struct batman_if *batman_if; + struct orig_node *orig_neigh_node, *orig_node; + char orig_str[ETH_STR_LEN], prev_sender_str[ETH_STR_LEN], neigh_str[ETH_STR_LEN]; + char has_directlink_flag; + char is_my_addr = 0, is_my_orig = 0, is_my_oldorig = 0, is_broadcast = 0, is_bidirectional, is_single_hop_neigh, is_duplicate; + unsigned short if_incoming_seqno; + + /* Silently drop when the batman packet is actually not a correct packet. + * + * This might happen if a packet is padded (e.g. Ethernet has a + * minimum frame length of 64 byte) and the aggregation interprets + * it as an additional length. + * + * TODO: A more sane solution would be to have a bit in the batman_packet + * to detect whether the packet is the last packet in an aggregation. + * Here we expect that the padding is always zero (or not 0x01) + */ + if (batman_packet->packet_type != BAT_PACKET) + return; + + /* could be changed by schedule_own_packet() */ + if_incoming_seqno = atomic_read(&if_incoming->seqno); + + addr_to_string(orig_str, batman_packet->orig); + addr_to_string(prev_sender_str, batman_packet->prev_sender); + addr_to_string(neigh_str, ethhdr->h_source); + + has_directlink_flag = (batman_packet->flags & DIRECTLINK ? 1 : 0); + + is_single_hop_neigh = (compare_orig(ethhdr->h_source, batman_packet->orig) ? 1 : 0); + + debug_log(LOG_TYPE_BATMAN, "Received BATMAN packet via NB: %s, IF: %s [%s] (from OG: %s, via prev OG: %s, seqno %d, tq %d, TTL %d, V %d, IDF %d) \n", neigh_str, if_incoming->dev, if_incoming->addr_str, orig_str, prev_sender_str, batman_packet->seqno, batman_packet->tq, batman_packet->ttl, batman_packet->version, has_directlink_flag); + + list_for_each_entry_rcu(batman_if, &if_list, list) { + if (batman_if->if_active != IF_ACTIVE) + continue; + + if (compare_orig(ethhdr->h_source, batman_if->net_dev->dev_addr)) + is_my_addr = 1; + + if (compare_orig(batman_packet->orig, batman_if->net_dev->dev_addr)) + is_my_orig = 1; + + if (compare_orig(batman_packet->prev_sender, batman_if->net_dev->dev_addr)) + is_my_oldorig = 1; + + if (compare_orig(ethhdr->h_source, broadcastAddr)) + is_broadcast = 1; + } + + if (batman_packet->version != COMPAT_VERSION) { + debug_log(LOG_TYPE_BATMAN, "Drop packet: incompatible batman version (%i) \n", batman_packet->version); + return; + } + + if (is_my_addr) { + debug_log(LOG_TYPE_BATMAN, "Drop packet: received my own broadcast (sender: %s) \n", neigh_str); + return; + } + + if (is_broadcast) { + debug_log(LOG_TYPE_BATMAN, "Drop packet: ignoring all packets with broadcast source addr (sender: %s) \n", neigh_str); + return; + } + + if (is_my_orig) { + orig_neigh_node = get_orig_node(ethhdr->h_source); + + /* neighbour has to indicate direct link and it has to come via the corresponding interface */ + /* if received seqno equals last send seqno save new seqno for bidirectional check */ + if (has_directlink_flag && compare_orig(if_incoming->net_dev->dev_addr, batman_packet->orig) && + (batman_packet->seqno - if_incoming_seqno + 2 == 0)) { + bit_mark((TYPE_OF_WORD *)&(orig_neigh_node->bcast_own[if_incoming->if_num * NUM_WORDS]), 0); + orig_neigh_node->bcast_own_sum[if_incoming->if_num] = bit_packet_count((TYPE_OF_WORD *)&(orig_neigh_node->bcast_own[if_incoming->if_num * NUM_WORDS])); + } + + debug_log(LOG_TYPE_BATMAN, "Drop packet: originator packet from myself (via neighbour) \n"); + return; + } + + if (batman_packet->tq == 0) { + count_real_packets(ethhdr, batman_packet, if_incoming); + + debug_log(LOG_TYPE_BATMAN, "Drop packet: originator packet with tq equal 0 \n"); + return; + } + + if (is_my_oldorig) { + debug_log(LOG_TYPE_BATMAN, "Drop packet: ignoring all rebroadcast echos (sender: %s) \n", neigh_str); + return; + } + + is_duplicate = count_real_packets(ethhdr, batman_packet, if_incoming); + + orig_node = get_orig_node(batman_packet->orig); + if (orig_node == NULL) + return; + + /* avoid temporary routing loops */ + if ((orig_node->router) && (orig_node->router->orig_node->router) && + (compare_orig(orig_node->router->addr, batman_packet->prev_sender)) && + !(compare_orig(batman_packet->orig, batman_packet->prev_sender)) && + (compare_orig(orig_node->router->addr, orig_node->router->orig_node->router->addr))) { + debug_log(LOG_TYPE_BATMAN, "Drop packet: ignoring all rebroadcast packets that may make me loop (sender: %s) \n", neigh_str); + return; + } + + /* if sender is a direct neighbor the sender mac equals originator mac */ + orig_neigh_node = (is_single_hop_neigh ? orig_node : get_orig_node(ethhdr->h_source)); + if (orig_neigh_node == NULL) + return; + + /* drop packet if sender is not a direct neighbor and if we don't route towards it */ + if (!is_single_hop_neigh && (orig_neigh_node->router == NULL)) { + debug_log(LOG_TYPE_BATMAN, "Drop packet: OGM via unknown neighbor! \n"); + return; + } + + is_bidirectional = isBidirectionalNeigh(orig_node, orig_neigh_node, batman_packet, if_incoming); + + /* update ranking if it is not a duplicate or has the same seqno and similar ttl as the non-duplicate */ + if (is_bidirectional && (!is_duplicate || + ((orig_node->last_real_seqno == batman_packet->seqno) && + (orig_node->last_ttl - 3 <= batman_packet->ttl)))) + update_orig(orig_node, ethhdr, batman_packet, if_incoming, hna_buff, hna_buff_len, is_duplicate); + + /* is single hop (direct) neighbour */ + if (is_single_hop_neigh) { + + /* mark direct link on incoming interface */ + schedule_forward_packet(orig_node, ethhdr, batman_packet, 1, hna_buff_len, if_incoming); + + debug_log(LOG_TYPE_BATMAN, "Forwarding packet: rebroadcast neighbour packet with direct link flag \n"); + return; + } + + /* multihop originator */ + if (!is_bidirectional) { + debug_log(LOG_TYPE_BATMAN, "Drop packet: not received via bidirectional link\n"); + return; + } + + if (is_duplicate) { + debug_log(LOG_TYPE_BATMAN, "Drop packet: duplicate packet received\n"); + return; + } + + debug_log(LOG_TYPE_BATMAN, "Forwarding packet: rebroadcast originator packet \n"); + schedule_forward_packet(orig_node, ethhdr, batman_packet, 0, hna_buff_len, if_incoming); +} + +void purge_orig(struct work_struct *work) +{ + struct list_head *list_pos, *list_pos_tmp; + struct hash_it_t *hashit = NULL; + struct orig_node *orig_node; + struct neigh_node *neigh_node, *best_neigh_node; + char orig_str[ETH_STR_LEN], neigh_str[ETH_STR_LEN], neigh_purged; + + spin_lock(&orig_hash_lock); + + /* for all origins... */ + while (NULL != (hashit = hash_iterate(orig_hash, hashit))) { + + orig_node = hashit->bucket->data; + addr_to_string(orig_str, orig_node->orig); + + if (time_after(jiffies, orig_node->last_valid + ((2 * PURGE_TIMEOUT * HZ) / 1000))) { + + debug_log(LOG_TYPE_BATMAN, "Originator timeout: originator %s, last_valid %u \n", orig_str, (orig_node->last_valid / HZ)); + + hash_remove_bucket(orig_hash, hashit); + free_orig_node(orig_node); + + } else { + + best_neigh_node = NULL; + neigh_purged = 0; + + /* for all neighbours towards this originator ... */ + list_for_each_safe(list_pos, list_pos_tmp, &orig_node->neigh_list) { + neigh_node = list_entry(list_pos, struct neigh_node, list); + + if (time_after(jiffies, neigh_node->last_valid + ((PURGE_TIMEOUT * HZ) / 1000))) { + + addr_to_string(neigh_str, neigh_node->addr); + debug_log(LOG_TYPE_BATMAN, "Neighbour timeout: originator %s, neighbour: %s, last_valid %u \n", orig_str, neigh_str, (neigh_node->last_valid / HZ)); + + neigh_purged = 1; + list_del(list_pos); + kfree(neigh_node); + + } else { + + if ((best_neigh_node == NULL) || (neigh_node->tq_avg > best_neigh_node->tq_avg)) + best_neigh_node = neigh_node; + + } + + } + + if (neigh_purged) + update_routes(orig_node, best_neigh_node, orig_node->hna_buff, orig_node->hna_buff_len); + + } + + } + + spin_unlock(&orig_hash_lock); + + start_purge_timer(); +} + +static int receive_raw_packet(struct socket *raw_sock, unsigned char *packet_buff, int packet_buff_len) +{ + struct kvec iov; + struct msghdr msg; + + iov.iov_base = packet_buff; + iov.iov_len = packet_buff_len; + + msg.msg_flags = MSG_DONTWAIT; /* non-blocking */ + msg.msg_name = NULL; + msg.msg_namelen = 0; + msg.msg_control = NULL; + + return kernel_recvmsg(raw_sock, &msg, &iov, 1, packet_buff_len, MSG_DONTWAIT); +} + +int packet_recv_thread(void *data) +{ + struct batman_if *batman_if; + struct ethhdr *ethhdr; + struct batman_packet *batman_packet; + struct unicast_packet *unicast_packet; + struct bcast_packet *bcast_packet; + struct icmp_packet *icmp_packet; + struct vis_packet *vis_packet; + struct orig_node *orig_node; + unsigned char *packet_buff, src_str[ETH_STR_LEN], dst_str[ETH_STR_LEN]; + int vis_info_len; + int result; + + atomic_set(&data_ready_cond, 0); + atomic_set(&exit_cond, 0); + packet_buff = kmalloc(PACKBUFF_SIZE, GFP_KERNEL); + if (!packet_buff) { + debug_log(LOG_TYPE_CRIT, "Could allocate memory for the packet buffer. :(\n"); + return -1; + } + + while ((!kthread_should_stop()) && (!atomic_read(&exit_cond))) { + + wait_event_interruptible(thread_wait, (atomic_read(&data_ready_cond) || atomic_read(&exit_cond))); + + atomic_set(&data_ready_cond, 0); + + if (kthread_should_stop() || atomic_read(&exit_cond)) + break; + + /* we only want to safely traverse the list, hard-interfaces + * won't be deleted anyway as long as this thread runs. */ + + rcu_read_lock(); + list_for_each_entry_rcu(batman_if, &if_list, list) { + rcu_read_unlock(); + + result = -1; + + while (1) { + if (batman_if->if_active != IF_ACTIVE) { + if (batman_if->if_active != IF_TO_BE_ACTIVATED) + debug_log(LOG_TYPE_NOTICE, + "Could not read from deactivated interface %s!\n", + batman_if->dev); + + if (batman_if->raw_sock) + receive_raw_packet(batman_if->raw_sock, packet_buff, PACKBUFF_SIZE); + result = 0; + break; + } + + result = receive_raw_packet(batman_if->raw_sock, packet_buff, PACKBUFF_SIZE); + if (result <= 0) + break; + + if (result < sizeof(struct ethhdr) + 2) + continue; + + ethhdr = (struct ethhdr *)packet_buff; + batman_packet = (struct batman_packet *)(packet_buff + sizeof(struct ethhdr)); + + if (batman_packet->version != COMPAT_VERSION) { + debug_log(LOG_TYPE_BATMAN, "Drop packet: incompatible batman version (%i) \n", batman_packet->version); + continue; + } + + switch (batman_packet->packet_type) { + /* batman originator packet */ + case BAT_PACKET: + /* packet with broadcast indication but unicast recipient */ + if (!is_bcast(ethhdr->h_dest)) + continue; + + /* packet with broadcast sender address */ + if (is_bcast(ethhdr->h_source)) + continue; + + /* drop packet if it has not at least one batman packet as payload */ + if (result < sizeof(struct ethhdr) + sizeof(struct batman_packet)) + continue; + + spin_lock(&orig_hash_lock); + receive_aggr_bat_packet(ethhdr, + packet_buff + sizeof(struct ethhdr), + result - sizeof(struct ethhdr), + batman_if); + spin_unlock(&orig_hash_lock); + + break; + + /* batman icmp packet */ + case BAT_ICMP: + /* packet with unicast indication but broadcast recipient */ + if (is_bcast(ethhdr->h_dest)) + continue; + + /* packet with broadcast sender address */ + if (is_bcast(ethhdr->h_source)) + continue; + + /* not for me */ + if (!is_my_mac(ethhdr->h_dest)) + continue; + + /* drop packet if it has not necessary minimum size */ + if (result < sizeof(struct ethhdr) + sizeof(struct icmp_packet)) + continue; + + icmp_packet = (struct icmp_packet *)(packet_buff + sizeof(struct ethhdr)); + + /* packet for me */ + if (is_my_mac(icmp_packet->dst)) { + + /* add data to device queue */ + if (icmp_packet->msg_type != ECHO_REQUEST) { + bat_device_receive_packet(icmp_packet); + continue; + } + + /* answer echo request (ping) */ + /* get routing information */ + spin_lock(&orig_hash_lock); + orig_node = ((struct orig_node *)hash_find(orig_hash, icmp_packet->orig)); + + if ((orig_node != NULL) && (orig_node->batman_if != NULL) && (orig_node->router != NULL)) { + + memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN); + memcpy(icmp_packet->orig, ethhdr->h_dest, ETH_ALEN); + icmp_packet->msg_type = ECHO_REPLY; + icmp_packet->ttl = TTL; + + send_raw_packet(packet_buff + sizeof(struct ethhdr), + result - sizeof(struct ethhdr), + orig_node->batman_if, + orig_node->router->addr); + + } + + spin_unlock(&orig_hash_lock); + continue; + + } + + /* TTL exceeded */ + if (icmp_packet->ttl < 2) { + + addr_to_string(src_str, icmp_packet->orig); + addr_to_string(dst_str, icmp_packet->dst); + + debug_log(LOG_TYPE_NOTICE, "Error - can't send packet from %s to %s: ttl exceeded\n", src_str, dst_str); + + /* send TTL exceeded if packet is an echo request (traceroute) */ + if (icmp_packet->msg_type != ECHO_REQUEST) + continue; + + /* get routing information */ + spin_lock(&orig_hash_lock); + orig_node = ((struct orig_node *)hash_find(orig_hash, icmp_packet->orig)); + + if ((orig_node != NULL) && (orig_node->batman_if != NULL) && (orig_node->router != NULL)) { + + memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN); + memcpy(icmp_packet->orig, ethhdr->h_dest, ETH_ALEN); + icmp_packet->msg_type = TTL_EXCEEDED; + icmp_packet->ttl = TTL; + + send_raw_packet(packet_buff + sizeof(struct ethhdr), + result - sizeof(struct ethhdr), + orig_node->batman_if, + orig_node->router->addr); + + } + + spin_unlock(&orig_hash_lock); + continue; + + } + + /* get routing information */ + spin_lock(&orig_hash_lock); + orig_node = ((struct orig_node *)hash_find(orig_hash, icmp_packet->dst)); + + if ((orig_node != NULL) && (orig_node->batman_if != NULL) && (orig_node->router != NULL)) { + + /* decrement ttl */ + icmp_packet->ttl--; + + /* route it */ + send_raw_packet(packet_buff + sizeof(struct ethhdr), + result - sizeof(struct ethhdr), + orig_node->batman_if, + orig_node->router->addr); + } + + spin_unlock(&orig_hash_lock); + break; + + /* unicast packet */ + case BAT_UNICAST: + /* packet with unicast indication but broadcast recipient */ + if (is_bcast(ethhdr->h_dest)) + continue; + + /* packet with broadcast sender address */ + if (is_bcast(ethhdr->h_source)) + continue; + + /* not for me */ + if (!is_my_mac(ethhdr->h_dest)) + continue; + + /* drop packet if it has not necessary minimum size */ + if (result < sizeof(struct ethhdr) + sizeof(struct unicast_packet)) + continue; + + unicast_packet = (struct unicast_packet *)(packet_buff + sizeof(struct ethhdr)); + + /* packet for me */ + if (is_my_mac(unicast_packet->dest)) { + + interface_rx(soft_device, packet_buff + sizeof(struct ethhdr) + sizeof(struct unicast_packet), result - sizeof(struct ethhdr) - sizeof(struct unicast_packet)); + continue; + + } + + /* TTL exceeded */ + if (unicast_packet->ttl < 2) { + addr_to_string(src_str, ((struct ethhdr *)(unicast_packet + 1))->h_source); + addr_to_string(dst_str, unicast_packet->dest); + + debug_log(LOG_TYPE_NOTICE, "Error - can't send packet from %s to %s: ttl exceeded\n", src_str, dst_str); + continue; + } + + /* get routing information */ + spin_lock(&orig_hash_lock); + orig_node = ((struct orig_node *)hash_find(orig_hash, unicast_packet->dest)); + + if ((orig_node != NULL) && (orig_node->batman_if != NULL) && (orig_node->router != NULL)) { + /* decrement ttl */ + unicast_packet->ttl--; + + /* route it */ + send_raw_packet(packet_buff + sizeof(struct ethhdr), + result - sizeof(struct ethhdr), + orig_node->batman_if, + orig_node->router->addr); + } + + spin_unlock(&orig_hash_lock); + break; + + /* broadcast packet */ + case BAT_BCAST: + /* packet with broadcast indication but unicast recipient */ + if (!is_bcast(ethhdr->h_dest)) + continue; + + /* packet with broadcast sender address */ + if (is_bcast(ethhdr->h_source)) + continue; + + /* drop packet if it has not necessary minimum size */ + if (result < sizeof(struct ethhdr) + sizeof(struct bcast_packet)) + continue; + + /* ignore broadcasts sent by myself */ + if (is_my_mac(ethhdr->h_source)) + continue; + + bcast_packet = (struct bcast_packet *)(packet_buff + sizeof(struct ethhdr)); + + /* ignore broadcasts originated by myself */ + if (is_my_mac(bcast_packet->orig)) + continue; + + spin_lock(&orig_hash_lock); + orig_node = ((struct orig_node *)hash_find(orig_hash, bcast_packet->orig)); + + if (orig_node == NULL) { + spin_unlock(&orig_hash_lock); + continue; + } + + /* check flood history */ + if (get_bit_status(orig_node->bcast_bits, orig_node->last_bcast_seqno, ntohs(bcast_packet->seqno))) { + spin_unlock(&orig_hash_lock); + continue; + } + + /* mark broadcast in flood history */ + if (bit_get_packet(orig_node->bcast_bits, ntohs(bcast_packet->seqno) - orig_node->last_bcast_seqno, 1)) + orig_node->last_bcast_seqno = ntohs(bcast_packet->seqno); + + spin_unlock(&orig_hash_lock); + + /* broadcast for me */ + interface_rx(soft_device, packet_buff + sizeof(struct ethhdr) + sizeof(struct bcast_packet), result - sizeof(struct ethhdr) - sizeof(struct bcast_packet)); + + /* rebroadcast packet */ + add_bcast_packet_to_list(packet_buff + sizeof(struct ethhdr), + result - sizeof(struct ethhdr)); + + break; + + /* vis packet */ + case BAT_VIS: + /* drop if too short. */ + if (result < sizeof(struct ethhdr) + sizeof(struct vis_packet)) + continue; + + /* not for me */ + if (!is_my_mac(ethhdr->h_dest)) + continue; + + vis_packet = (struct vis_packet *)(packet_buff + sizeof(struct ethhdr)); + vis_info_len = result - sizeof(struct ethhdr) - sizeof(struct vis_packet); + + /* ignore own packets */ + if (is_my_mac(vis_packet->vis_orig)) + continue; + + if (is_my_mac(vis_packet->sender_orig)) + continue; + + switch (vis_packet->vis_type) { + case VIS_TYPE_SERVER_SYNC: + receive_server_sync_packet(vis_packet, vis_info_len); + break; + + case VIS_TYPE_CLIENT_UPDATE: + receive_client_update_packet(vis_packet, vis_info_len); + break; + + default: /* ignore unknown packet */ + break; + } + + break; + } + + } + + if ((result < 0) && (result != -EAGAIN)) + debug_log(LOG_TYPE_CRIT, "Could not receive packet from interface %s: %i\n", batman_if->dev, result); + + /* lock for the next iteration */ + rcu_read_lock(); + } + rcu_read_unlock(); + + } + kfree(packet_buff); + + /* do not exit until kthread_stop() is actually called, otherwise it will wait for us + * forever. */ + while (!kthread_should_stop()) + schedule(); + + return 0; +} + +void batman_data_ready(struct sock *sk, int len) +{ + void (*data_ready)(struct sock *, int) = sk->sk_user_data; + + data_ready(sk, len); + + atomic_set(&data_ready_cond, 1); + wake_up_interruptible(&thread_wait); +} + diff --git a/drivers/staging/batman-adv/routing.h b/drivers/staging/batman-adv/routing.h new file mode 100644 index 000000000000..0123ea86debb --- /dev/null +++ b/drivers/staging/batman-adv/routing.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include "types.h" + +extern wait_queue_head_t thread_wait; +extern atomic_t exit_cond; + +int originator_init(void); +void free_orig_node(void *data); +void originator_free(void); +void slide_own_bcast_window(struct batman_if *batman_if); +void batman_data_ready(struct sock *sk, int len); +void purge_orig(struct work_struct *work); +int packet_recv_thread(void *data); +void receive_bat_packet(struct ethhdr *ethhdr, struct batman_packet *batman_packet, unsigned char *hna_buff, int hna_buff_len, struct batman_if *if_incoming); diff --git a/drivers/staging/batman-adv/send.c b/drivers/staging/batman-adv/send.c new file mode 100644 index 000000000000..d724798278d6 --- /dev/null +++ b/drivers/staging/batman-adv/send.c @@ -0,0 +1,473 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include "main.h" +#include "send.h" +#include "log.h" +#include "routing.h" +#include "translation-table.h" +#include "hard-interface.h" +#include "types.h" +#include "vis.h" +#include "aggregation.h" + +#include "compat.h" + +/* apply hop penalty for a normal link */ +static uint8_t hop_penalty(const uint8_t tq) +{ + return (tq * (TQ_MAX_VALUE - TQ_HOP_PENALTY)) / (TQ_MAX_VALUE); +} + +/* when do we schedule our own packet to be sent */ +static unsigned long own_send_time(void) +{ + return jiffies + + (((atomic_read(&originator_interval) - JITTER + + (random32() % 2*JITTER)) * HZ) / 1000); +} + +/* when do we schedule a forwarded packet to be sent */ +static unsigned long forward_send_time(void) +{ + unsigned long send_time = jiffies; /* Starting now plus... */ + + if (atomic_read(&aggregation_enabled)) + send_time += (((MAX_AGGREGATION_MS - (JITTER/2) + + (random32() % JITTER)) * HZ) / 1000); + else + send_time += (((random32() % (JITTER/2)) * HZ) / 1000); + + return send_time; +} + +/* sends a raw packet. */ +void send_raw_packet(unsigned char *pack_buff, int pack_buff_len, + struct batman_if *batman_if, uint8_t *dst_addr) +{ + struct ethhdr *ethhdr; + struct sk_buff *skb; + int retval; + char *data; + + if (batman_if->if_active != IF_ACTIVE) + return; + + if (!(batman_if->net_dev->flags & IFF_UP)) { + debug_log(LOG_TYPE_WARN, + "Interface %s is not up - can't send packet via that interface (IF_TO_BE_DEACTIVATED was here) !\n", + batman_if->dev); + return; + } + + skb = dev_alloc_skb(pack_buff_len + sizeof(struct ethhdr)); + if (!skb) + return; + data = skb_put(skb, pack_buff_len + sizeof(struct ethhdr)); + + memcpy(data + sizeof(struct ethhdr), pack_buff, pack_buff_len); + + ethhdr = (struct ethhdr *) data; + memcpy(ethhdr->h_source, batman_if->net_dev->dev_addr, ETH_ALEN); + memcpy(ethhdr->h_dest, dst_addr, ETH_ALEN); + ethhdr->h_proto = __constant_htons(ETH_P_BATMAN); + + skb_reset_mac_header(skb); + skb_set_network_header(skb, ETH_HLEN); + skb->priority = TC_PRIO_CONTROL; + skb->protocol = __constant_htons(ETH_P_BATMAN); + skb->dev = batman_if->net_dev; + + /* dev_queue_xmit() returns a negative result on error. However on + * congestion and traffic shaping, it drops and returns NET_XMIT_DROP + * (which is > 0). This will not be treated as an error. */ + retval = dev_queue_xmit(skb); + if (retval < 0) + debug_log(LOG_TYPE_CRIT, + "Can't write to raw socket (IF_TO_BE_DEACTIVATED was here): %i\n", + retval); +} + +/* Send a packet to a given interface */ +static void send_packet_to_if(struct forw_packet *forw_packet, + struct batman_if *batman_if) +{ + char *fwd_str; + uint8_t packet_num; + int16_t buff_pos; + struct batman_packet *batman_packet; + char orig_str[ETH_STR_LEN]; + + if (batman_if->if_active != IF_ACTIVE) + return; + + packet_num = buff_pos = 0; + batman_packet = (struct batman_packet *) + (forw_packet->packet_buff); + + /* adjust all flags and log packets */ + while (aggregated_packet(buff_pos, + forw_packet->packet_len, + batman_packet->num_hna)) { + + /* we might have aggregated direct link packets with an + * ordinary base packet */ + if ((forw_packet->direct_link_flags & (1 << packet_num)) && + (forw_packet->if_incoming == batman_if)) + batman_packet->flags |= DIRECTLINK; + else + batman_packet->flags &= ~DIRECTLINK; + + addr_to_string(orig_str, batman_packet->orig); + fwd_str = (packet_num > 0 ? "Forwarding" : (forw_packet->own ? + "Sending own" : + "Forwarding")); + debug_log(LOG_TYPE_BATMAN, + "%s %spacket (originator %s, seqno %d, TQ %d, TTL %d, IDF %s) on interface %s [%s]\n", + fwd_str, + (packet_num > 0 ? "aggregated " : ""), + orig_str, ntohs(batman_packet->seqno), + batman_packet->tq, batman_packet->ttl, + (batman_packet->flags & DIRECTLINK ? + "on" : "off"), + batman_if->dev, batman_if->addr_str); + + buff_pos += sizeof(struct batman_packet) + + (batman_packet->num_hna * ETH_ALEN); + packet_num++; + batman_packet = (struct batman_packet *) + (forw_packet->packet_buff + buff_pos); + } + + send_raw_packet(forw_packet->packet_buff, + forw_packet->packet_len, + batman_if, broadcastAddr); +} + +/* send a batman packet */ +static void send_packet(struct forw_packet *forw_packet) +{ + struct batman_if *batman_if; + struct batman_packet *batman_packet = + (struct batman_packet *)(forw_packet->packet_buff); + char orig_str[ETH_STR_LEN]; + unsigned char directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0); + + if (!forw_packet->if_incoming) { + debug_log(LOG_TYPE_CRIT, + "Error - can't forward packet: incoming iface not specified\n"); + return; + } + + if (forw_packet->if_incoming->if_active != IF_ACTIVE) + return; + + addr_to_string(orig_str, batman_packet->orig); + + /* multihomed peer assumed */ + /* non-primary OGMs are only broadcasted on their interface */ + if ((directlink && (batman_packet->ttl == 1)) || + (forw_packet->own && (forw_packet->if_incoming->if_num > 0))) { + + /* FIXME: what about aggregated packets ? */ + debug_log(LOG_TYPE_BATMAN, + "%s packet (originator %s, seqno %d, TTL %d) on interface %s [%s]\n", + (forw_packet->own ? "Sending own" : "Forwarding"), + orig_str, ntohs(batman_packet->seqno), + batman_packet->ttl, forw_packet->if_incoming->dev, + forw_packet->if_incoming->addr_str); + + send_raw_packet(forw_packet->packet_buff, + forw_packet->packet_len, + forw_packet->if_incoming, + broadcastAddr); + return; + } + + /* broadcast on every interface */ + rcu_read_lock(); + list_for_each_entry_rcu(batman_if, &if_list, list) + send_packet_to_if(forw_packet, batman_if); + rcu_read_unlock(); +} + +static void rebuild_batman_packet(struct batman_if *batman_if) +{ + int new_len; + unsigned char *new_buff; + struct batman_packet *batman_packet; + + new_len = sizeof(struct batman_packet) + (num_hna * ETH_ALEN); + new_buff = kmalloc(new_len, GFP_ATOMIC); + + /* keep old buffer if kmalloc should fail */ + if (new_buff) { + memcpy(new_buff, batman_if->packet_buff, + sizeof(struct batman_packet)); + batman_packet = (struct batman_packet *)new_buff; + + batman_packet->num_hna = hna_local_fill_buffer( + new_buff + sizeof(struct batman_packet), + new_len - sizeof(struct batman_packet)); + + kfree(batman_if->packet_buff); + batman_if->packet_buff = new_buff; + batman_if->packet_len = new_len; + } +} + +void schedule_own_packet(struct batman_if *batman_if) +{ + unsigned long send_time; + struct batman_packet *batman_packet; + + /** + * the interface gets activated here to avoid race conditions between + * the moment of activating the interface in + * hardif_activate_interface() where the originator mac is set and + * outdated packets (especially uninitialized mac addresses) in the + * packet queue + */ + if (batman_if->if_active == IF_TO_BE_ACTIVATED) + batman_if->if_active = IF_ACTIVE; + + /* if local hna has changed and interface is a primary interface */ + if ((atomic_read(&hna_local_changed)) && (batman_if->if_num == 0)) + rebuild_batman_packet(batman_if); + + /** + * NOTE: packet_buff might just have been re-allocated in + * rebuild_batman_packet() + */ + batman_packet = (struct batman_packet *)batman_if->packet_buff; + + /* change sequence number to network order */ + batman_packet->seqno = htons((uint16_t)atomic_read(&batman_if->seqno)); + + if (is_vis_server()) + batman_packet->flags = VIS_SERVER; + else + batman_packet->flags = 0; + + /* could be read by receive_bat_packet() */ + atomic_inc(&batman_if->seqno); + + slide_own_bcast_window(batman_if); + send_time = own_send_time(); + add_bat_packet_to_list(batman_if->packet_buff, + batman_if->packet_len, batman_if, 1, send_time); +} + +void schedule_forward_packet(struct orig_node *orig_node, + struct ethhdr *ethhdr, + struct batman_packet *batman_packet, + uint8_t directlink, int hna_buff_len, + struct batman_if *if_incoming) +{ + unsigned char in_tq, in_ttl, tq_avg = 0; + unsigned long send_time; + + if (batman_packet->ttl <= 1) { + debug_log(LOG_TYPE_BATMAN, "ttl exceeded \n"); + return; + } + + in_tq = batman_packet->tq; + in_ttl = batman_packet->ttl; + + batman_packet->ttl--; + memcpy(batman_packet->prev_sender, ethhdr->h_source, ETH_ALEN); + + /* rebroadcast tq of our best ranking neighbor to ensure the rebroadcast + * of our best tq value */ + if ((orig_node->router) && (orig_node->router->tq_avg != 0)) { + + /* rebroadcast ogm of best ranking neighbor as is */ + if (!compare_orig(orig_node->router->addr, ethhdr->h_source)) { + batman_packet->tq = orig_node->router->tq_avg; + + if (orig_node->router->last_ttl) + batman_packet->ttl = orig_node->router->last_ttl - 1; + } + + tq_avg = orig_node->router->tq_avg; + } + + /* apply hop penalty */ + batman_packet->tq = hop_penalty(batman_packet->tq); + + debug_log(LOG_TYPE_BATMAN, "Forwarding packet: tq_orig: %i, tq_avg: %i, tq_forw: %i, ttl_orig: %i, ttl_forw: %i \n", + in_tq, tq_avg, batman_packet->tq, in_ttl - 1, + batman_packet->ttl); + + batman_packet->seqno = htons(batman_packet->seqno); + + if (directlink) + batman_packet->flags |= DIRECTLINK; + else + batman_packet->flags &= ~DIRECTLINK; + + send_time = forward_send_time(); + add_bat_packet_to_list((unsigned char *)batman_packet, + sizeof(struct batman_packet) + hna_buff_len, + if_incoming, 0, send_time); +} + +static void forw_packet_free(struct forw_packet *forw_packet) +{ + kfree(forw_packet->packet_buff); + kfree(forw_packet); +} + +static void _add_bcast_packet_to_list(struct forw_packet *forw_packet, + unsigned long send_time) +{ + INIT_HLIST_NODE(&forw_packet->list); + + /* add new packet to packet list */ + spin_lock(&forw_bcast_list_lock); + hlist_add_head(&forw_packet->list, &forw_bcast_list); + spin_unlock(&forw_bcast_list_lock); + + /* start timer for this packet */ + INIT_DELAYED_WORK(&forw_packet->delayed_work, + send_outstanding_bcast_packet); + queue_delayed_work(bat_event_workqueue, &forw_packet->delayed_work, + send_time); +} + +void add_bcast_packet_to_list(unsigned char *packet_buff, int packet_len) +{ + struct forw_packet *forw_packet; + + forw_packet = kmalloc(sizeof(struct forw_packet), GFP_ATOMIC); + if (!forw_packet) + return; + + forw_packet->packet_buff = kmalloc(packet_len, GFP_ATOMIC); + if (!forw_packet->packet_buff) + return; + + forw_packet->packet_len = packet_len; + memcpy(forw_packet->packet_buff, packet_buff, forw_packet->packet_len); + + /* how often did we send the bcast packet ? */ + forw_packet->num_packets = 0; + + _add_bcast_packet_to_list(forw_packet, 1); +} + +void send_outstanding_bcast_packet(struct work_struct *work) +{ + struct batman_if *batman_if; + struct delayed_work *delayed_work = + container_of(work, struct delayed_work, work); + struct forw_packet *forw_packet = + container_of(delayed_work, struct forw_packet, delayed_work); + + spin_lock(&forw_bcast_list_lock); + hlist_del(&forw_packet->list); + spin_unlock(&forw_bcast_list_lock); + + /* rebroadcast packet */ + rcu_read_lock(); + list_for_each_entry_rcu(batman_if, &if_list, list) { + send_raw_packet(forw_packet->packet_buff, + forw_packet->packet_len, + batman_if, broadcastAddr); + } + rcu_read_unlock(); + + forw_packet->num_packets++; + + /* if we still have some more bcasts to send and we are not shutting + * down */ + if ((forw_packet->num_packets < 3) && + (atomic_read(&module_state) != MODULE_DEACTIVATING)) + _add_bcast_packet_to_list(forw_packet, ((5 * HZ) / 1000)); + else + forw_packet_free(forw_packet); +} + +void send_outstanding_bat_packet(struct work_struct *work) +{ + struct delayed_work *delayed_work = + container_of(work, struct delayed_work, work); + struct forw_packet *forw_packet = + container_of(delayed_work, struct forw_packet, delayed_work); + + spin_lock(&forw_bat_list_lock); + hlist_del(&forw_packet->list); + spin_unlock(&forw_bat_list_lock); + + send_packet(forw_packet); + + /** + * we have to have at least one packet in the queue + * to determine the queues wake up time unless we are + * shutting down + */ + if ((forw_packet->own) && + (atomic_read(&module_state) != MODULE_DEACTIVATING)) + schedule_own_packet(forw_packet->if_incoming); + + forw_packet_free(forw_packet); +} + +void purge_outstanding_packets(void) +{ + struct forw_packet *forw_packet; + struct hlist_node *tmp_node, *safe_tmp_node; + + debug_log(LOG_TYPE_BATMAN, "purge_outstanding_packets()\n"); + + /* free bcast list */ + spin_lock(&forw_bcast_list_lock); + hlist_for_each_entry_safe(forw_packet, tmp_node, safe_tmp_node, + &forw_bcast_list, list) { + + spin_unlock(&forw_bcast_list_lock); + + /** + * send_outstanding_bcast_packet() will lock the list to + * delete the item from the list + */ + cancel_delayed_work_sync(&forw_packet->delayed_work); + spin_lock(&forw_bcast_list_lock); + } + spin_unlock(&forw_bcast_list_lock); + + /* free batman packet list */ + spin_lock(&forw_bat_list_lock); + hlist_for_each_entry_safe(forw_packet, tmp_node, safe_tmp_node, + &forw_bat_list, list) { + + spin_unlock(&forw_bat_list_lock); + + /** + * send_outstanding_bat_packet() will lock the list to + * delete the item from the list + */ + cancel_delayed_work_sync(&forw_packet->delayed_work); + spin_lock(&forw_bat_list_lock); + } + spin_unlock(&forw_bat_list_lock); +} diff --git a/drivers/staging/batman-adv/send.h b/drivers/staging/batman-adv/send.h new file mode 100644 index 000000000000..59d500917a35 --- /dev/null +++ b/drivers/staging/batman-adv/send.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include "types.h" + +void send_own_packet_work(struct work_struct *work); +void send_raw_packet(unsigned char *pack_buff, int pack_buff_len, + struct batman_if *batman_if, uint8_t *dst_addr); +void schedule_own_packet(struct batman_if *batman_if); +void schedule_forward_packet(struct orig_node *orig_node, + struct ethhdr *ethhdr, + struct batman_packet *batman_packet, + uint8_t directlink, int hna_buff_len, + struct batman_if *if_outgoing); +void add_bcast_packet_to_list(unsigned char *packet_buff, int packet_len); +void send_outstanding_bcast_packet(struct work_struct *work); +void send_outstanding_bat_packet(struct work_struct *work); +void purge_outstanding_packets(void); diff --git a/drivers/staging/batman-adv/soft-interface.c b/drivers/staging/batman-adv/soft-interface.c new file mode 100644 index 000000000000..d543f50b647f --- /dev/null +++ b/drivers/staging/batman-adv/soft-interface.c @@ -0,0 +1,349 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include "main.h" +#include "soft-interface.h" +#include "hard-interface.h" +#include "send.h" +#include "translation-table.h" +#include "log.h" +#include "types.h" +#include "hash.h" +#include +#include +#include "compat.h" + +static uint16_t bcast_seqno = 1; /* give own bcast messages seq numbers to avoid + * broadcast storms */ +static int32_t skb_packets; +static int32_t skb_bad_packets; +static int32_t lock_dropped; + +unsigned char mainIfAddr[ETH_ALEN]; +static unsigned char mainIfAddr_default[ETH_ALEN]; +static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd); +static void bat_get_drvinfo(struct net_device *dev, + struct ethtool_drvinfo *info); +static u32 bat_get_msglevel(struct net_device *dev); +static void bat_set_msglevel(struct net_device *dev, u32 value); +static u32 bat_get_link(struct net_device *dev); +static u32 bat_get_rx_csum(struct net_device *dev); +static int bat_set_rx_csum(struct net_device *dev, u32 data); + +static const struct ethtool_ops bat_ethtool_ops = { + .get_settings = bat_get_settings, + .get_drvinfo = bat_get_drvinfo, + .get_msglevel = bat_get_msglevel, + .set_msglevel = bat_set_msglevel, + .get_link = bat_get_link, + .get_rx_csum = bat_get_rx_csum, + .set_rx_csum = bat_set_rx_csum +}; + +void set_main_if_addr(uint8_t *addr) +{ + memcpy(mainIfAddr, addr, ETH_ALEN); +} + +int main_if_was_up(void) +{ + return (memcmp(mainIfAddr, mainIfAddr_default, ETH_ALEN) != 0 ? 1 : 0); +} + +static int my_skb_push(struct sk_buff *skb, unsigned int len) +{ + int result = 0; + + skb_packets++; + if (skb->data - len < skb->head) { + skb_bad_packets++; + result = pskb_expand_head(skb, len, 0, GFP_ATOMIC); + + if (result < 0) + return result; + } + + skb_push(skb, len); + return 0; +} + +#ifdef HAVE_NET_DEVICE_OPS +static const struct net_device_ops bat_netdev_ops = { + .ndo_open = interface_open, + .ndo_stop = interface_release, + .ndo_get_stats = interface_stats, + .ndo_set_mac_address = interface_set_mac_addr, + .ndo_change_mtu = interface_change_mtu, + .ndo_start_xmit = interface_tx, + .ndo_validate_addr = eth_validate_addr +}; +#endif + +void interface_setup(struct net_device *dev) +{ + struct bat_priv *priv = netdev_priv(dev); + char dev_addr[ETH_ALEN]; + + ether_setup(dev); + +#ifdef HAVE_NET_DEVICE_OPS + dev->netdev_ops = &bat_netdev_ops; +#else + dev->open = interface_open; + dev->stop = interface_release; + dev->get_stats = interface_stats; + dev->set_mac_address = interface_set_mac_addr; + dev->change_mtu = interface_change_mtu; + dev->hard_start_xmit = interface_tx; +#endif + dev->destructor = free_netdev; + + dev->mtu = hardif_min_mtu(); + dev->hard_header_len = BAT_HEADER_LEN; /* reserve more space in the + * skbuff for our header */ + + /* generate random address */ + random_ether_addr(dev_addr); + memcpy(dev->dev_addr, dev_addr, sizeof(dev->dev_addr)); + + SET_ETHTOOL_OPS(dev, &bat_ethtool_ops); + + memset(priv, 0, sizeof(struct bat_priv)); +} + +int interface_open(struct net_device *dev) +{ + netif_start_queue(dev); + return 0; +} + +int interface_release(struct net_device *dev) +{ + netif_stop_queue(dev); + return 0; +} + +struct net_device_stats *interface_stats(struct net_device *dev) +{ + struct bat_priv *priv = netdev_priv(dev); + return &priv->stats; +} + +int interface_set_mac_addr(struct net_device *dev, void *addr) +{ + return -EBUSY; +} + +int interface_change_mtu(struct net_device *dev, int new_mtu) +{ + /* check ranges */ + if ((new_mtu < 68) || (new_mtu > hardif_min_mtu())) + return -EINVAL; + + dev->mtu = new_mtu; + + return 0; +} + +int interface_tx(struct sk_buff *skb, struct net_device *dev) +{ + struct unicast_packet *unicast_packet; + struct bcast_packet *bcast_packet; + struct orig_node *orig_node; + struct ethhdr *ethhdr = (struct ethhdr *)skb->data; + struct bat_priv *priv = netdev_priv(dev); + int data_len = skb->len; + + if (atomic_read(&module_state) != MODULE_ACTIVE) + goto dropped; + + dev->trans_start = jiffies; + /* TODO: check this for locks */ + hna_local_add(ethhdr->h_source); + + /* ethernet packet should be broadcasted */ + if (is_bcast(ethhdr->h_dest) || is_mcast(ethhdr->h_dest)) { + + if (my_skb_push(skb, sizeof(struct bcast_packet)) < 0) + goto dropped; + + bcast_packet = (struct bcast_packet *)skb->data; + + bcast_packet->version = COMPAT_VERSION; + + /* batman packet type: broadcast */ + bcast_packet->packet_type = BAT_BCAST; + + /* hw address of first interface is the orig mac because only + * this mac is known throughout the mesh */ + memcpy(bcast_packet->orig, mainIfAddr, ETH_ALEN); + /* set broadcast sequence number */ + bcast_packet->seqno = htons(bcast_seqno); + + bcast_seqno++; + + /* broadcast packet */ + add_bcast_packet_to_list(skb->data, skb->len); + + /* unicast packet */ + } else { + + /* simply spin_lock()ing can deadlock when the lock is already + * hold. */ + /* TODO: defer the work in a working queue instead of + * dropping */ + if (!spin_trylock(&orig_hash_lock)) { + lock_dropped++; + debug_log(LOG_TYPE_NOTICE, "%d packets dropped because lock was hold\n", lock_dropped); + goto dropped; + } + + /* get routing information */ + orig_node = ((struct orig_node *)hash_find(orig_hash, + ethhdr->h_dest)); + + /* check for hna host */ + if (!orig_node) + orig_node = transtable_search(ethhdr->h_dest); + + if ((orig_node) && + (orig_node->batman_if) && + (orig_node->router)) { + if (my_skb_push(skb, sizeof(struct unicast_packet)) < 0) + goto unlock; + + unicast_packet = (struct unicast_packet *)skb->data; + + unicast_packet->version = COMPAT_VERSION; + /* batman packet type: unicast */ + unicast_packet->packet_type = BAT_UNICAST; + /* set unicast ttl */ + unicast_packet->ttl = TTL; + /* copy the destination for faster routing */ + memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN); + + /* net_dev won't be available when not active */ + if (orig_node->batman_if->if_active != IF_ACTIVE) + goto unlock; + + send_raw_packet(skb->data, skb->len, + orig_node->batman_if, + orig_node->router->addr); + } else { + goto unlock; + } + + spin_unlock(&orig_hash_lock); + } + + priv->stats.tx_packets++; + priv->stats.tx_bytes += data_len; + goto end; + +unlock: + spin_unlock(&orig_hash_lock); +dropped: + priv->stats.tx_dropped++; +end: + kfree_skb(skb); + return 0; +} + +void interface_rx(struct net_device *dev, void *packet, int packet_len) +{ + struct sk_buff *skb; + struct bat_priv *priv = netdev_priv(dev); + + skb = dev_alloc_skb(packet_len); + + if (!skb) { + priv->stats.rx_dropped++; + goto out; + } + + memcpy(skb_put(skb, packet_len), packet, packet_len); + + /* Write metadata, and then pass to the receive level */ + skb->dev = dev; + skb->protocol = eth_type_trans(skb, dev); + skb->ip_summed = CHECKSUM_UNNECESSARY; + + priv->stats.rx_packets++; + priv->stats.rx_bytes += packet_len; + + dev->last_rx = jiffies; + + netif_rx(skb); + +out: + return; +} + +/* ethtool */ +static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) +{ + cmd->supported = 0; + cmd->advertising = 0; + cmd->speed = SPEED_10; + cmd->duplex = DUPLEX_FULL; + cmd->port = PORT_TP; + cmd->phy_address = 0; + cmd->transceiver = XCVR_INTERNAL; + cmd->autoneg = AUTONEG_DISABLE; + cmd->maxtxpkt = 0; + cmd->maxrxpkt = 0; + + return 0; +} + +static void bat_get_drvinfo(struct net_device *dev, + struct ethtool_drvinfo *info) +{ + strcpy(info->driver, "B.A.T.M.A.N. advanced"); + strcpy(info->version, SOURCE_VERSION); + strcpy(info->fw_version, "N/A"); + strcpy(info->bus_info, "batman"); +} + +static u32 bat_get_msglevel(struct net_device *dev) +{ + return -EOPNOTSUPP; +} + +static void bat_set_msglevel(struct net_device *dev, u32 value) +{ + return; +} + +static u32 bat_get_link(struct net_device *dev) +{ + return 1; +} + +static u32 bat_get_rx_csum(struct net_device *dev) +{ + return 0; +} + +static int bat_set_rx_csum(struct net_device *dev, u32 data) +{ + return -EOPNOTSUPP; +} diff --git a/drivers/staging/batman-adv/soft-interface.h b/drivers/staging/batman-adv/soft-interface.h new file mode 100644 index 000000000000..515e276ef53d --- /dev/null +++ b/drivers/staging/batman-adv/soft-interface.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +void set_main_if_addr(uint8_t *addr); +int main_if_was_up(void); +void interface_setup(struct net_device *dev); +int interface_open(struct net_device *dev); +int interface_release(struct net_device *dev); +struct net_device_stats *interface_stats(struct net_device *dev); +int interface_set_mac_addr(struct net_device *dev, void *addr); +int interface_change_mtu(struct net_device *dev, int new_mtu); +int interface_tx(struct sk_buff *skb, struct net_device *dev); +void interface_rx(struct net_device *dev, void *packet, int packet_len); + +extern unsigned char mainIfAddr[]; diff --git a/drivers/staging/batman-adv/translation-table.c b/drivers/staging/batman-adv/translation-table.c new file mode 100644 index 000000000000..c2190e177c56 --- /dev/null +++ b/drivers/staging/batman-adv/translation-table.c @@ -0,0 +1,454 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include "main.h" +#include "translation-table.h" +#include "log.h" +#include "soft-interface.h" +#include "types.h" +#include "hash.h" +#include "compat.h" + +struct hashtable_t *hna_local_hash; +static struct hashtable_t *hna_global_hash; +atomic_t hna_local_changed; + +DEFINE_SPINLOCK(hna_local_hash_lock); +static DEFINE_SPINLOCK(hna_global_hash_lock); + +static DECLARE_DELAYED_WORK(hna_local_purge_wq, hna_local_purge); + +static void hna_local_start_timer(void) +{ + queue_delayed_work(bat_event_workqueue, &hna_local_purge_wq, 10 * HZ); +} + +int hna_local_init(void) +{ + if (hna_local_hash) + return 1; + + hna_local_hash = hash_new(128, compare_orig, choose_orig); + + if (!hna_local_hash) + return 0; + + atomic_set(&hna_local_changed, 0); + hna_local_start_timer(); + + return 1; +} + +void hna_local_add(uint8_t *addr) +{ + struct hna_local_entry *hna_local_entry; + struct hna_global_entry *hna_global_entry; + struct hashtable_t *swaphash; + char hna_str[ETH_STR_LEN]; + unsigned long flags; + + spin_lock_irqsave(&hna_local_hash_lock, flags); + hna_local_entry = + ((struct hna_local_entry *)hash_find(hna_local_hash, addr)); + spin_unlock_irqrestore(&hna_local_hash_lock, flags); + + if (hna_local_entry != NULL) { + hna_local_entry->last_seen = jiffies; + return; + } + + addr_to_string(hna_str, addr); + + /* only announce as many hosts as possible in the batman-packet and + space in batman_packet->num_hna That also should give a limit to + MAC-flooding. */ + if ((num_hna + 1 > (ETH_DATA_LEN - BAT_PACKET_LEN) / ETH_ALEN) || + (num_hna + 1 > 255)) { + debug_log(LOG_TYPE_ROUTES, "Can't add new local hna entry (%s): number of local hna entries exceeds packet size \n", hna_str); + return; + } + + debug_log(LOG_TYPE_ROUTES, "Creating new local hna entry: %s \n", + hna_str); + + hna_local_entry = kmalloc(sizeof(struct hna_local_entry), GFP_ATOMIC); + if (!hna_local_entry) + return; + + memcpy(hna_local_entry->addr, addr, ETH_ALEN); + hna_local_entry->last_seen = jiffies; + + /* the batman interface mac address should never be purged */ + if (compare_orig(addr, soft_device->dev_addr)) + hna_local_entry->never_purge = 1; + else + hna_local_entry->never_purge = 0; + + spin_lock_irqsave(&hna_local_hash_lock, flags); + + hash_add(hna_local_hash, hna_local_entry); + num_hna++; + atomic_set(&hna_local_changed, 1); + + if (hna_local_hash->elements * 4 > hna_local_hash->size) { + swaphash = hash_resize(hna_local_hash, + hna_local_hash->size * 2); + + if (swaphash == NULL) + debug_log(LOG_TYPE_CRIT, "Couldn't resize local hna hash table \n"); + else + hna_local_hash = swaphash; + } + + spin_unlock_irqrestore(&hna_local_hash_lock, flags); + + /* remove address from global hash if present */ + spin_lock_irqsave(&hna_global_hash_lock, flags); + + hna_global_entry = + ((struct hna_global_entry *)hash_find(hna_global_hash, addr)); + + if (hna_global_entry != NULL) + _hna_global_del_orig(hna_global_entry, "local hna received"); + + spin_unlock_irqrestore(&hna_global_hash_lock, flags); +} + +int hna_local_fill_buffer(unsigned char *buff, int buff_len) +{ + struct hna_local_entry *hna_local_entry; + struct hash_it_t *hashit = NULL; + int i = 0; + unsigned long flags; + + spin_lock_irqsave(&hna_local_hash_lock, flags); + + while (NULL != (hashit = hash_iterate(hna_local_hash, hashit))) { + + if (buff_len < (i + 1) * ETH_ALEN) + break; + + hna_local_entry = hashit->bucket->data; + memcpy(buff + (i * ETH_ALEN), hna_local_entry->addr, ETH_ALEN); + + i++; + } + + /* if we did not get all new local hnas see you next time ;-) */ + if (i == num_hna) + atomic_set(&hna_local_changed, 0); + + spin_unlock_irqrestore(&hna_local_hash_lock, flags); + + return i; +} + +int hna_local_fill_buffer_text(unsigned char *buff, int buff_len) +{ + struct hna_local_entry *hna_local_entry; + struct hash_it_t *hashit = NULL; + int bytes_written = 0; + unsigned long flags; + + spin_lock_irqsave(&hna_local_hash_lock, flags); + + while (NULL != (hashit = hash_iterate(hna_local_hash, hashit))) { + + if (buff_len < bytes_written + ETH_STR_LEN + 4) + break; + + hna_local_entry = hashit->bucket->data; + + bytes_written += snprintf(buff + bytes_written, ETH_STR_LEN + 4, + " * %02x:%02x:%02x:%02x:%02x:%02x\n", + hna_local_entry->addr[0], + hna_local_entry->addr[1], + hna_local_entry->addr[2], + hna_local_entry->addr[3], + hna_local_entry->addr[4], + hna_local_entry->addr[5]); + } + + spin_unlock_irqrestore(&hna_local_hash_lock, flags); + + return bytes_written; +} + +static void _hna_local_del(void *data) +{ + kfree(data); + num_hna--; + atomic_set(&hna_local_changed, 1); +} + +static void hna_local_del(struct hna_local_entry *hna_local_entry, + char *message) +{ + char hna_str[ETH_STR_LEN]; + + addr_to_string(hna_str, hna_local_entry->addr); + debug_log(LOG_TYPE_ROUTES, "Deleting local hna entry (%s): %s \n", + hna_str, message); + + hash_remove(hna_local_hash, hna_local_entry->addr); + _hna_local_del(hna_local_entry); +} + +void hna_local_purge(struct work_struct *work) +{ + struct hna_local_entry *hna_local_entry; + struct hash_it_t *hashit = NULL; + unsigned long flags; + unsigned long timeout; + + spin_lock_irqsave(&hna_local_hash_lock, flags); + + while (NULL != (hashit = hash_iterate(hna_local_hash, hashit))) { + hna_local_entry = hashit->bucket->data; + + timeout = hna_local_entry->last_seen + + ((LOCAL_HNA_TIMEOUT / 1000) * HZ); + if ((!hna_local_entry->never_purge) && + time_after(jiffies, timeout)) + hna_local_del(hna_local_entry, "address timed out"); + } + + spin_unlock_irqrestore(&hna_local_hash_lock, flags); + hna_local_start_timer(); +} + +void hna_local_free(void) +{ + if (!hna_local_hash) + return; + + cancel_delayed_work_sync(&hna_local_purge_wq); + hash_delete(hna_local_hash, _hna_local_del); + hna_local_hash = NULL; +} + +int hna_global_init(void) +{ + if (hna_global_hash) + return 1; + + hna_global_hash = hash_new(128, compare_orig, choose_orig); + + if (!hna_global_hash) + return 0; + + return 1; +} + +void hna_global_add_orig(struct orig_node *orig_node, + unsigned char *hna_buff, int hna_buff_len) +{ + struct hna_global_entry *hna_global_entry; + struct hna_local_entry *hna_local_entry; + struct hashtable_t *swaphash; + char hna_str[ETH_STR_LEN], orig_str[ETH_STR_LEN]; + int hna_buff_count = 0; + unsigned long flags; + unsigned char *hna_ptr; + + addr_to_string(orig_str, orig_node->orig); + + while ((hna_buff_count + 1) * ETH_ALEN <= hna_buff_len) { + spin_lock_irqsave(&hna_global_hash_lock, flags); + + hna_ptr = hna_buff + (hna_buff_count * ETH_ALEN); + hna_global_entry = (struct hna_global_entry *) + hash_find(hna_global_hash, hna_ptr); + + if (hna_global_entry == NULL) { + spin_unlock_irqrestore(&hna_global_hash_lock, flags); + + hna_global_entry = + kmalloc(sizeof(struct hna_global_entry), + GFP_ATOMIC); + + if (!hna_global_entry) + break; + + memcpy(hna_global_entry->addr, hna_ptr, ETH_ALEN); + + addr_to_string(hna_str, hna_global_entry->addr); + debug_log(LOG_TYPE_ROUTES, "Creating new global hna entry: %s (via %s)\n", hna_str, orig_str); + + spin_lock_irqsave(&hna_global_hash_lock, flags); + hash_add(hna_global_hash, hna_global_entry); + + } + + hna_global_entry->orig_node = orig_node; + spin_unlock_irqrestore(&hna_global_hash_lock, flags); + + /* remove address from local hash if present */ + spin_lock_irqsave(&hna_local_hash_lock, flags); + + hna_ptr = hna_buff + (hna_buff_count * ETH_ALEN); + hna_local_entry = (struct hna_local_entry *) + hash_find(hna_local_hash, hna_ptr); + + if (hna_local_entry != NULL) + hna_local_del(hna_local_entry, "global hna received"); + + spin_unlock_irqrestore(&hna_local_hash_lock, flags); + + hna_buff_count++; + } + + orig_node->hna_buff_len = hna_buff_len; + + if (orig_node->hna_buff_len > 0) { + orig_node->hna_buff = kmalloc(orig_node->hna_buff_len, + GFP_ATOMIC); + memcpy(orig_node->hna_buff, hna_buff, orig_node->hna_buff_len); + } else { + orig_node->hna_buff = NULL; + } + + spin_lock_irqsave(&hna_global_hash_lock, flags); + + if (hna_global_hash->elements * 4 > hna_global_hash->size) { + swaphash = hash_resize(hna_global_hash, + hna_global_hash->size * 2); + + if (swaphash == NULL) + debug_log(LOG_TYPE_CRIT, "Couldn't resize global hna hash table \n"); + else + hna_global_hash = swaphash; + } + + spin_unlock_irqrestore(&hna_global_hash_lock, flags); +} + +int hna_global_fill_buffer_text(unsigned char *buff, int buff_len) +{ + struct hna_global_entry *hna_global_entry; + struct hash_it_t *hashit = NULL; + int bytes_written = 0; + unsigned long flags; + + spin_lock_irqsave(&hna_global_hash_lock, flags); + + while (NULL != (hashit = hash_iterate(hna_global_hash, hashit))) { + if (buff_len < bytes_written + (2 * ETH_STR_LEN) + 10) + break; + + hna_global_entry = hashit->bucket->data; + + bytes_written += snprintf(buff + bytes_written, + (2 * ETH_STR_LEN) + 10, + " * %02x:%02x:%02x:%02x:%02x:%02x via %02x:%02x:%02x:%02x:%02x:%02x \n", + hna_global_entry->addr[0], + hna_global_entry->addr[1], + hna_global_entry->addr[2], + hna_global_entry->addr[3], + hna_global_entry->addr[4], + hna_global_entry->addr[5], + hna_global_entry->orig_node->orig[0], + hna_global_entry->orig_node->orig[1], + hna_global_entry->orig_node->orig[2], + hna_global_entry->orig_node->orig[3], + hna_global_entry->orig_node->orig[4], + hna_global_entry->orig_node->orig[5]); + } + + spin_unlock_irqrestore(&hna_global_hash_lock, flags); + + return bytes_written; +} + +void _hna_global_del_orig(struct hna_global_entry *hna_global_entry, + char *message) +{ + char hna_str[ETH_STR_LEN], orig_str[ETH_STR_LEN]; + + addr_to_string(orig_str, hna_global_entry->orig_node->orig); + addr_to_string(hna_str, hna_global_entry->addr); + + debug_log(LOG_TYPE_ROUTES, "Deleting global hna entry %s (via %s): %s \n", hna_str, orig_str, message); + + hash_remove(hna_global_hash, hna_global_entry->addr); + kfree(hna_global_entry); +} + +void hna_global_del_orig(struct orig_node *orig_node, char *message) +{ + struct hna_global_entry *hna_global_entry; + int hna_buff_count = 0; + unsigned long flags; + unsigned char *hna_ptr; + + if (orig_node->hna_buff_len == 0) + return; + + spin_lock_irqsave(&hna_global_hash_lock, flags); + + while ((hna_buff_count + 1) * ETH_ALEN <= orig_node->hna_buff_len) { + hna_ptr = orig_node->hna_buff + (hna_buff_count * ETH_ALEN); + hna_global_entry = (struct hna_global_entry *) + hash_find(hna_global_hash, hna_ptr); + + if ((hna_global_entry != NULL) && + (hna_global_entry->orig_node == orig_node)) + _hna_global_del_orig(hna_global_entry, message); + + hna_buff_count++; + } + + spin_unlock_irqrestore(&hna_global_hash_lock, flags); + + orig_node->hna_buff_len = 0; + kfree(orig_node->hna_buff); + orig_node->hna_buff = NULL; +} + +static void hna_global_del(void *data) +{ + kfree(data); +} + +void hna_global_free(void) +{ + if (!hna_global_hash) + return; + + hash_delete(hna_global_hash, hna_global_del); + hna_global_hash = NULL; +} + +struct orig_node *transtable_search(uint8_t *addr) +{ + struct hna_global_entry *hna_global_entry; + unsigned long flags; + + spin_lock_irqsave(&hna_global_hash_lock, flags); + hna_global_entry = (struct hna_global_entry *) + hash_find(hna_global_hash, addr); + spin_unlock_irqrestore(&hna_global_hash_lock, flags); + + if (hna_global_entry == NULL) + return NULL; + + return hna_global_entry->orig_node; +} diff --git a/drivers/staging/batman-adv/translation-table.h b/drivers/staging/batman-adv/translation-table.h new file mode 100644 index 000000000000..f7da81129318 --- /dev/null +++ b/drivers/staging/batman-adv/translation-table.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include "types.h" + +int hna_local_init(void); +void hna_local_add(uint8_t *addr); +int hna_local_fill_buffer(unsigned char *buff, int buff_len); +int hna_local_fill_buffer_text(unsigned char *buff, int buff_len); +void hna_local_purge(struct work_struct *work); +void hna_local_free(void); +int hna_global_init(void); +void hna_global_add_orig(struct orig_node *orig_node, unsigned char *hna_buff, + int hna_buff_len); +int hna_global_fill_buffer_text(unsigned char *buff, int buff_len); +void _hna_global_del_orig(struct hna_global_entry *hna_global_entry, + char *orig_str); +void hna_global_del_orig(struct orig_node *orig_node, char *message); +void hna_global_free(void); +struct orig_node *transtable_search(uint8_t *addr); + +extern spinlock_t hna_local_hash_lock; +extern struct hashtable_t *hna_local_hash; +extern atomic_t hna_local_changed; diff --git a/drivers/staging/batman-adv/types.h b/drivers/staging/batman-adv/types.h new file mode 100644 index 000000000000..3a0ef0c38c93 --- /dev/null +++ b/drivers/staging/batman-adv/types.h @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: + * + * Marek Lindner, Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + + + + + +#ifndef TYPES_H +#define TYPES_H + +#include "packet.h" +#include "bitarray.h" + +#define BAT_HEADER_LEN (sizeof(struct ethhdr) + ((sizeof(struct unicast_packet) > sizeof(struct bcast_packet) ? sizeof(struct unicast_packet) : sizeof(struct bcast_packet)))) + + +struct batman_if { + struct list_head list; + int16_t if_num; + char *dev; + char if_active; + char addr_str[ETH_STR_LEN]; + struct net_device *net_dev; + struct socket *raw_sock; + atomic_t seqno; + unsigned char *packet_buff; + int packet_len; + struct rcu_head rcu; + +}; + +struct orig_node { /* structure for orig_list maintaining nodes of mesh */ + uint8_t orig[ETH_ALEN]; + struct neigh_node *router; + struct batman_if *batman_if; + TYPE_OF_WORD *bcast_own; + uint8_t *bcast_own_sum; + uint8_t tq_own; + int tq_asym_penalty; + unsigned long last_valid; /* when last packet from this node was received */ +/* uint8_t gwflags; * flags related to gateway functions: gateway class */ + uint8_t flags; /* for now only VIS_SERVER flag. */ + unsigned char *hna_buff; + int16_t hna_buff_len; + uint16_t last_real_seqno; /* last and best known squence number */ + uint8_t last_ttl; /* ttl of last received packet */ + TYPE_OF_WORD bcast_bits[NUM_WORDS]; + uint16_t last_bcast_seqno; /* last broadcast sequence number received by this host */ + struct list_head neigh_list; +}; + +struct neigh_node { + struct list_head list; + uint8_t addr[ETH_ALEN]; + uint8_t real_packet_count; + uint8_t tq_recv[TQ_GLOBAL_WINDOW_SIZE]; + uint8_t tq_index; + uint8_t tq_avg; + uint8_t last_ttl; + unsigned long last_valid; /* when last packet via this neighbour was received */ + TYPE_OF_WORD real_bits[NUM_WORDS]; + struct orig_node *orig_node; + struct batman_if *if_incoming; +}; + +struct bat_priv { + struct net_device_stats stats; +}; + +struct device_client { + struct list_head queue_list; + unsigned int queue_len; + unsigned char index; + spinlock_t lock; + wait_queue_head_t queue_wait; +}; + +struct device_packet { + struct list_head list; + struct icmp_packet icmp_packet; +}; + +struct hna_local_entry { + uint8_t addr[ETH_ALEN]; + unsigned long last_seen; + char never_purge; +}; + +struct hna_global_entry { + uint8_t addr[ETH_ALEN]; + struct orig_node *orig_node; +}; + +struct forw_packet { /* structure for forw_list maintaining packets to be send/forwarded */ + struct hlist_node list; + unsigned long send_time; + uint8_t own; + unsigned char *packet_buff; + uint16_t packet_len; + uint32_t direct_link_flags; + uint8_t num_packets; + struct delayed_work delayed_work; + struct batman_if *if_incoming; +}; + +#endif diff --git a/drivers/staging/batman-adv/vis.c b/drivers/staging/batman-adv/vis.c new file mode 100644 index 000000000000..f6c9acb289ed --- /dev/null +++ b/drivers/staging/batman-adv/vis.c @@ -0,0 +1,564 @@ +/* + * Copyright (C) 2008-2009 B.A.T.M.A.N. contributors: + * + * Simon Wunderlich + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#include "main.h" +#include "send.h" +#include "translation-table.h" +#include "vis.h" +#include "log.h" +#include "soft-interface.h" +#include "hard-interface.h" +#include "hash.h" +#include "compat.h" + +struct hashtable_t *vis_hash; +DEFINE_SPINLOCK(vis_hash_lock); +static struct vis_info *my_vis_info; +static struct list_head send_list; /* always locked with vis_hash_lock */ + +static void start_vis_timer(void); + +/* free the info */ +static void free_info(void *data) +{ + struct vis_info *info = data; + struct recvlist_node *entry, *tmp; + + list_del_init(&info->send_list); + list_for_each_entry_safe(entry, tmp, &info->recv_list, list) { + list_del(&entry->list); + kfree(entry); + } + kfree(info); +} + +/* set the mode of the visualization to client or server */ +void vis_set_mode(int mode) +{ + spin_lock(&vis_hash_lock); + + if (my_vis_info != NULL) + my_vis_info->packet.vis_type = mode; + + spin_unlock(&vis_hash_lock); +} + +/* is_vis_server(), locked outside */ +static int is_vis_server_locked(void) +{ + if (my_vis_info != NULL) + if (my_vis_info->packet.vis_type == VIS_TYPE_SERVER_SYNC) + return 1; + + return 0; +} + +/* get the current set mode */ +int is_vis_server(void) +{ + int ret = 0; + + spin_lock(&vis_hash_lock); + ret = is_vis_server_locked(); + spin_unlock(&vis_hash_lock); + + return ret; +} + +/* Compare two vis packets, used by the hashing algorithm */ +static int vis_info_cmp(void *data1, void *data2) +{ + struct vis_info *d1, *d2; + d1 = data1; + d2 = data2; + return compare_orig(d1->packet.vis_orig, d2->packet.vis_orig); +} + +/* hash function to choose an entry in a hash table of given size */ +/* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */ +static int vis_info_choose(void *data, int size) +{ + struct vis_info *vis_info = data; + unsigned char *key; + uint32_t hash = 0; + size_t i; + + key = vis_info->packet.vis_orig; + for (i = 0; i < ETH_ALEN; i++) { + hash += key[i]; + hash += (hash << 10); + hash ^= (hash >> 6); + } + + hash += (hash << 3); + hash ^= (hash >> 11); + hash += (hash << 15); + + return hash % size; +} + +/* tries to add one entry to the receive list. */ +static void recv_list_add(struct list_head *recv_list, char *mac) +{ + struct recvlist_node *entry; + entry = kmalloc(sizeof(struct recvlist_node), GFP_ATOMIC); + if (!entry) + return; + + memcpy(entry->mac, mac, ETH_ALEN); + list_add_tail(&entry->list, recv_list); +} + +/* returns 1 if this mac is in the recv_list */ +static int recv_list_is_in(struct list_head *recv_list, char *mac) +{ + struct recvlist_node *entry; + + list_for_each_entry(entry, recv_list, list) { + if (memcmp(entry->mac, mac, ETH_ALEN) == 0) + return 1; + } + + return 0; +} + +/* try to add the packet to the vis_hash. return NULL if invalid (e.g. too old, + * broken.. ). vis hash must be locked outside. is_new is set when the packet + * is newer than old entries in the hash. */ +static struct vis_info *add_packet(struct vis_packet *vis_packet, + int vis_info_len, int *is_new) +{ + struct vis_info *info, *old_info; + struct vis_info search_elem; + + *is_new = 0; + /* sanity check */ + if (vis_hash == NULL) + return NULL; + + /* see if the packet is already in vis_hash */ + memcpy(search_elem.packet.vis_orig, vis_packet->vis_orig, ETH_ALEN); + old_info = hash_find(vis_hash, &search_elem); + + if (old_info != NULL) { + if (vis_packet->seqno - old_info->packet.seqno <= 0) { + if (old_info->packet.seqno == vis_packet->seqno) { + recv_list_add(&old_info->recv_list, + vis_packet->sender_orig); + return old_info; + } else { + /* newer packet is already in hash. */ + return NULL; + } + } + /* remove old entry */ + hash_remove(vis_hash, old_info); + free_info(old_info); + } + + info = kmalloc(sizeof(struct vis_info) + vis_info_len, GFP_ATOMIC); + if (info == NULL) + return NULL; + + INIT_LIST_HEAD(&info->send_list); + INIT_LIST_HEAD(&info->recv_list); + info->first_seen = jiffies; + memcpy(&info->packet, vis_packet, + sizeof(struct vis_packet) + vis_info_len); + + /* initialize and add new packet. */ + *is_new = 1; + + /* repair if entries is longer than packet. */ + if (info->packet.entries * sizeof(struct vis_info_entry) > vis_info_len) + info->packet.entries = vis_info_len / sizeof(struct vis_info_entry); + + recv_list_add(&info->recv_list, info->packet.sender_orig); + + /* try to add it */ + if (hash_add(vis_hash, info) < 0) { + /* did not work (for some reason) */ + free_info(info); + info = NULL; + } + + return info; +} + +/* handle the server sync packet, forward if needed. */ +void receive_server_sync_packet(struct vis_packet *vis_packet, int vis_info_len) +{ + struct vis_info *info; + int is_new; + + spin_lock(&vis_hash_lock); + info = add_packet(vis_packet, vis_info_len, &is_new); + if (info == NULL) + goto end; + + /* only if we are server ourselves and packet is newer than the one in + * hash.*/ + if (is_vis_server_locked() && is_new) { + memcpy(info->packet.target_orig, broadcastAddr, ETH_ALEN); + if (list_empty(&info->send_list)) + list_add_tail(&info->send_list, &send_list); + } +end: + spin_unlock(&vis_hash_lock); +} + +/* handle an incoming client update packet and schedule forward if needed. */ +void receive_client_update_packet(struct vis_packet *vis_packet, + int vis_info_len) +{ + struct vis_info *info; + int is_new; + + /* clients shall not broadcast. */ + if (is_bcast(vis_packet->target_orig)) + return; + + spin_lock(&vis_hash_lock); + info = add_packet(vis_packet, vis_info_len, &is_new); + if (info == NULL) + goto end; + /* note that outdated packets will be dropped at this point. */ + + + /* send only if we're the target server or ... */ + if (is_vis_server_locked() && + is_my_mac(info->packet.target_orig) && + is_new) { + info->packet.vis_type = VIS_TYPE_SERVER_SYNC; /* upgrade! */ + memcpy(info->packet.target_orig, broadcastAddr, ETH_ALEN); + if (list_empty(&info->send_list)) + list_add_tail(&info->send_list, &send_list); + + /* ... we're not the recipient (and thus need to forward). */ + } else if (!is_my_mac(info->packet.target_orig)) { + if (list_empty(&info->send_list)) + list_add_tail(&info->send_list, &send_list); + } +end: + spin_unlock(&vis_hash_lock); +} + +/* Walk the originators and find the VIS server with the best tq. Set the packet + * address to its address and return the best_tq. + * + * Must be called with the originator hash locked */ +static int find_best_vis_server(struct vis_info *info) +{ + struct hash_it_t *hashit = NULL; + struct orig_node *orig_node; + int best_tq = -1; + + while (NULL != (hashit = hash_iterate(orig_hash, hashit))) { + orig_node = hashit->bucket->data; + if ((orig_node != NULL) && + (orig_node->router != NULL) && + (orig_node->flags & VIS_SERVER) && + (orig_node->router->tq_avg > best_tq)) { + best_tq = orig_node->router->tq_avg; + memcpy(info->packet.target_orig, orig_node->orig, + ETH_ALEN); + } + } + return best_tq; +} + +/* Return true if the vis packet is full. */ +static bool vis_packet_full(struct vis_info *info) +{ + if (info->packet.entries + 1 > + (1000 - sizeof(struct vis_info)) / sizeof(struct vis_info_entry)) + return true; + return false; +} + +/* generates a packet of own vis data, + * returns 0 on success, -1 if no packet could be generated */ +static int generate_vis_packet(void) +{ + struct hash_it_t *hashit = NULL; + struct orig_node *orig_node; + struct vis_info *info = (struct vis_info *)my_vis_info; + struct vis_info_entry *entry, *entry_array; + struct hna_local_entry *hna_local_entry; + int best_tq = -1; + unsigned long flags; + + info->first_seen = jiffies; + + spin_lock(&orig_hash_lock); + memcpy(info->packet.target_orig, broadcastAddr, ETH_ALEN); + info->packet.ttl = TTL; + info->packet.seqno++; + info->packet.entries = 0; + + if (!is_vis_server_locked()) { + best_tq = find_best_vis_server(info); + if (best_tq < 0) { + spin_unlock(&orig_hash_lock); + return -1; + } + } + hashit = NULL; + + entry_array = (struct vis_info_entry *) + ((char *)info + sizeof(struct vis_info)); + + while (NULL != (hashit = hash_iterate(orig_hash, hashit))) { + orig_node = hashit->bucket->data; + if (orig_node->router != NULL + && compare_orig(orig_node->router->addr, orig_node->orig) + && orig_node->batman_if + && (orig_node->batman_if->if_active == IF_ACTIVE) + && orig_node->router->tq_avg > 0) { + + /* fill one entry into buffer. */ + entry = &entry_array[info->packet.entries]; + memcpy(entry->src, orig_node->batman_if->net_dev->dev_addr, ETH_ALEN); + memcpy(entry->dest, orig_node->orig, ETH_ALEN); + entry->quality = orig_node->router->tq_avg; + info->packet.entries++; + + if (vis_packet_full(info)) { + spin_unlock(&orig_hash_lock); + return 0; + } + } + } + + spin_unlock(&orig_hash_lock); + + hashit = NULL; + spin_lock_irqsave(&hna_local_hash_lock, flags); + while (NULL != (hashit = hash_iterate(hna_local_hash, hashit))) { + hna_local_entry = hashit->bucket->data; + entry = &entry_array[info->packet.entries]; + memset(entry->src, 0, ETH_ALEN); + memcpy(entry->dest, hna_local_entry->addr, ETH_ALEN); + entry->quality = 0; /* 0 means HNA */ + info->packet.entries++; + + if (vis_packet_full(info)) { + spin_unlock_irqrestore(&hna_local_hash_lock, flags); + return 0; + } + } + spin_unlock_irqrestore(&hna_local_hash_lock, flags); + return 0; +} + +static void purge_vis_packets(void) +{ + struct hash_it_t *hashit = NULL; + struct vis_info *info; + + while (NULL != (hashit = hash_iterate(vis_hash, hashit))) { + info = hashit->bucket->data; + if (info == my_vis_info) /* never purge own data. */ + continue; + if (time_after(jiffies, + info->first_seen + (VIS_TIMEOUT/1000)*HZ)) { + hash_remove_bucket(vis_hash, hashit); + free_info(info); + } + } +} + +static void broadcast_vis_packet(struct vis_info *info, int packet_length) +{ + struct hash_it_t *hashit = NULL; + struct orig_node *orig_node; + + spin_lock(&orig_hash_lock); + + /* send to all routers in range. */ + while (NULL != (hashit = hash_iterate(orig_hash, hashit))) { + orig_node = hashit->bucket->data; + + /* if it's a vis server and reachable, send it. */ + if (orig_node && + (orig_node->flags & VIS_SERVER) && + orig_node->batman_if && + orig_node->router) { + + /* don't send it if we already received the packet from + * this node. */ + if (recv_list_is_in(&info->recv_list, orig_node->orig)) + continue; + + memcpy(info->packet.target_orig, + orig_node->orig, ETH_ALEN); + + send_raw_packet((unsigned char *) &info->packet, + packet_length, + orig_node->batman_if, + orig_node->router->addr); + } + } + memcpy(info->packet.target_orig, broadcastAddr, ETH_ALEN); + spin_unlock(&orig_hash_lock); +} + +static void unicast_vis_packet(struct vis_info *info, int packet_length) +{ + struct orig_node *orig_node; + + spin_lock(&orig_hash_lock); + orig_node = ((struct orig_node *) + hash_find(orig_hash, info->packet.target_orig)); + + if ((orig_node != NULL) && + (orig_node->batman_if != NULL) && + (orig_node->router != NULL)) { + send_raw_packet((unsigned char *) &info->packet, packet_length, + orig_node->batman_if, + orig_node->router->addr); + } + spin_unlock(&orig_hash_lock); +} + +/* only send one vis packet. called from send_vis_packets() */ +static void send_vis_packet(struct vis_info *info) +{ + int packet_length; + + if (info->packet.ttl < 2) { + debug_log(LOG_TYPE_NOTICE, + "Error - can't send vis packet: ttl exceeded\n"); + return; + } + + memcpy(info->packet.sender_orig, mainIfAddr, ETH_ALEN); + info->packet.ttl--; + + packet_length = sizeof(struct vis_packet) + + info->packet.entries * sizeof(struct vis_info_entry); + + if (is_bcast(info->packet.target_orig)) + broadcast_vis_packet(info, packet_length); + else + unicast_vis_packet(info, packet_length); + info->packet.ttl++; /* restore TTL */ +} + +/* called from timer; send (and maybe generate) vis packet. */ +static void send_vis_packets(struct work_struct *work) +{ + struct vis_info *info, *temp; + + spin_lock(&vis_hash_lock); + purge_vis_packets(); + + if (generate_vis_packet() == 0) + /* schedule if generation was successful */ + list_add_tail(&my_vis_info->send_list, &send_list); + + list_for_each_entry_safe(info, temp, &send_list, send_list) { + list_del_init(&info->send_list); + send_vis_packet(info); + } + spin_unlock(&vis_hash_lock); + start_vis_timer(); +} +static DECLARE_DELAYED_WORK(vis_timer_wq, send_vis_packets); + +/* init the vis server. this may only be called when if_list is already + * initialized (e.g. bat0 is initialized, interfaces have been added) */ +int vis_init(void) +{ + if (vis_hash) + return 1; + + spin_lock(&vis_hash_lock); + + vis_hash = hash_new(256, vis_info_cmp, vis_info_choose); + if (!vis_hash) { + debug_log(LOG_TYPE_CRIT, "Can't initialize vis_hash\n"); + goto err; + } + + my_vis_info = kmalloc(1000, GFP_ATOMIC); + if (!my_vis_info) { + debug_log(LOG_TYPE_CRIT, "Can't initialize vis packet\n"); + goto err; + } + + /* prefill the vis info */ + my_vis_info->first_seen = jiffies - atomic_read(&vis_interval); + INIT_LIST_HEAD(&my_vis_info->recv_list); + INIT_LIST_HEAD(&my_vis_info->send_list); + my_vis_info->packet.version = COMPAT_VERSION; + my_vis_info->packet.packet_type = BAT_VIS; + my_vis_info->packet.vis_type = VIS_TYPE_CLIENT_UPDATE; + my_vis_info->packet.ttl = TTL; + my_vis_info->packet.seqno = 0; + my_vis_info->packet.entries = 0; + + INIT_LIST_HEAD(&send_list); + + memcpy(my_vis_info->packet.vis_orig, mainIfAddr, ETH_ALEN); + memcpy(my_vis_info->packet.sender_orig, mainIfAddr, ETH_ALEN); + + if (hash_add(vis_hash, my_vis_info) < 0) { + debug_log(LOG_TYPE_CRIT, + "Can't add own vis packet into hash\n"); + free_info(my_vis_info); /* not in hash, need to remove it + * manually. */ + goto err; + } + + spin_unlock(&vis_hash_lock); + start_vis_timer(); + return 1; + +err: + spin_unlock(&vis_hash_lock); + vis_quit(); + return 0; +} + +/* shutdown vis-server */ +void vis_quit(void) +{ + if (!vis_hash) + return; + + cancel_delayed_work_sync(&vis_timer_wq); + + spin_lock(&vis_hash_lock); + /* properly remove, kill timers ... */ + hash_delete(vis_hash, free_info); + vis_hash = NULL; + my_vis_info = NULL; + spin_unlock(&vis_hash_lock); +} + +/* schedule packets for (re)transmission */ +static void start_vis_timer(void) +{ + queue_delayed_work(bat_event_workqueue, &vis_timer_wq, + (atomic_read(&vis_interval)/1000) * HZ); +} + diff --git a/drivers/staging/batman-adv/vis.h b/drivers/staging/batman-adv/vis.h new file mode 100644 index 000000000000..276fabab4e88 --- /dev/null +++ b/drivers/staging/batman-adv/vis.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2008-2009 B.A.T.M.A.N. contributors: + * + * Simon Wunderlich, Marek Lindner + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * 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 + * + */ + +#define VIS_TIMEOUT 200000 +#define VIS_FORMAT_DD_NAME "dot_draw" +#define VIS_FORMAT_JSON_NAME "json" + +struct vis_info { + unsigned long first_seen; + struct list_head recv_list; + /* list of server-neighbors we received a vis-packet + * from. we should not reply to them. */ + struct list_head send_list; + /* this packet might be part of the vis send queue. */ + struct vis_packet packet; + /* vis_info may follow here*/ +} __attribute__((packed)); + +struct vis_info_entry { + uint8_t src[ETH_ALEN]; + uint8_t dest[ETH_ALEN]; + uint8_t quality; /* quality = 0 means HNA */ +} __attribute__((packed)); + +struct recvlist_node { + struct list_head list; + uint8_t mac[ETH_ALEN]; +}; + +enum vis_formats { + DOT_DRAW, + JSON, +}; + +extern struct hashtable_t *vis_hash; +extern spinlock_t vis_hash_lock; + +void vis_set_mode(int mode); +int is_vis_server(void); +void receive_server_sync_packet(struct vis_packet *vis_packet, + int vis_info_len); +void receive_client_update_packet(struct vis_packet *vis_packet, + int vis_info_len); +int vis_init(void); +void vis_quit(void); -- GitLab From d189164a2426a5169117cfe154186c2f999ada87 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 3 Dec 2009 16:19:47 -0800 Subject: [PATCH 228/235] Staging: add Samsung Laptop driver This is a drive for the Samsung N128 laptop to control the wireless LED and backlight. Many thanks to Joey Lee for his help in testing and finding all of my bugs in the development of this driver, it has been invaluable. Cc: Joey Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/samsung-laptop/Kconfig | 10 + drivers/staging/samsung-laptop/Makefile | 1 + .../staging/samsung-laptop/samsung-laptop.c | 582 ++++++++++++++++++ 5 files changed, 596 insertions(+) create mode 100644 drivers/staging/samsung-laptop/Kconfig create mode 100644 drivers/staging/samsung-laptop/Makefile create mode 100644 drivers/staging/samsung-laptop/samsung-laptop.c diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index d30fa451e6f3..a44ac2e3b8ef 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -131,6 +131,8 @@ source "drivers/staging/wlags49_h25/Kconfig" source "drivers/staging/batman-adv/Kconfig" +source "drivers/staging/samsung-laptop/Kconfig" + source "drivers/staging/strip/Kconfig" source "drivers/staging/arlan/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 910e55dd7914..069864f4391e 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -47,6 +47,7 @@ obj-$(CONFIG_RAMZSWAP) += ramzswap/ obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/ obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/ obj-$(CONFIG_BATMAN_ADV) += batman-adv/ +obj-$(CONFIG_SAMSUNG_LAPTOP) += samsung-laptop/ obj-$(CONFIG_STRIP) += strip/ obj-$(CONFIG_ARLAN) += arlan/ obj-$(CONFIG_WAVELAN) += wavelan/ diff --git a/drivers/staging/samsung-laptop/Kconfig b/drivers/staging/samsung-laptop/Kconfig new file mode 100644 index 000000000000..f27c60864c26 --- /dev/null +++ b/drivers/staging/samsung-laptop/Kconfig @@ -0,0 +1,10 @@ +config SAMSUNG_LAPTOP + tristate "Samsung Laptop driver" + default n + depends on RFKILL && BACKLIGHT_CLASS_DEVICE && X86 + help + This module implements a driver for the N128 Samsung Laptop + providing control over the Wireless LED and the LCD backlight + + To compile this driver as a module, choose + M here: the module will be called samsung-laptop. diff --git a/drivers/staging/samsung-laptop/Makefile b/drivers/staging/samsung-laptop/Makefile new file mode 100644 index 000000000000..3c6f42045211 --- /dev/null +++ b/drivers/staging/samsung-laptop/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_SAMSUNG_LAPTOP) += samsung-laptop.o diff --git a/drivers/staging/samsung-laptop/samsung-laptop.c b/drivers/staging/samsung-laptop/samsung-laptop.c new file mode 100644 index 000000000000..253b44754aa4 --- /dev/null +++ b/drivers/staging/samsung-laptop/samsung-laptop.c @@ -0,0 +1,582 @@ +/* + * Samsung N130 Laptop driver + * + * Copyright (C) 2009 Greg Kroah-Hartman (gregkh@suse.de) + * Copyright (C) 2009 Novell Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * This driver is needed because a number of Samsung laptops do not hook + * their control settings through ACPI. So we have to poke around in the + * BIOS to do things like brightness values, and "special" key controls. + */ + +/* + * We have 0 - 8 as valid brightness levels. The specs say that level 0 should + * be reserved by the BIOS (which really doesn't make much sense), we tell + * userspace that the value is 0 - 7 and then just tell the hardware 1 - 8 + */ +#define MAX_BRIGHT 0x07 + +/* Brightness is 0 - 8, as described above. Value 0 is for the BIOS to use */ +#define GET_BRIGHTNESS 0x00 +#define SET_BRIGHTNESS 0x01 + +/* first byte: + * 0x00 - wireless is off + * 0x01 - wireless is on + * second byte: + * 0x02 - 3G is off + * 0x03 - 3G is on + * TODO, verify 3G is correct, that doesn't seem right... + */ +#define GET_WIRELESS_BUTTON 0x02 +#define SET_WIRELESS_BUTTON 0x03 + +/* 0 is off, 1 is on */ +#define GET_BACKLIGHT 0x04 +#define SET_BACKLIGHT 0x05 + +/* + * 0x80 or 0x00 - no action + * 0x81 - recovery key pressed + */ +#define GET_RECOVERY_METHOD 0x06 +#define SET_RECOVERY_METHOD 0x07 + +/* 0 is low, 1 is high */ +#define GET_PERFORMANCE_LEVEL 0x08 +#define SET_PERFORMANCE_LEVEL 0x09 + +/* + * Tell the BIOS that Linux is running on this machine. + * 81 is on, 80 is off + */ +#define SET_LINUX 0x0a + + +#define MAIN_FUNCTION 0x4c49 + +#define SABI_HEADER_PORT 0x00 +#define SABI_HEADER_RE_MEM 0x02 +#define SABI_HEADER_IFACEFUNC 0x03 +#define SABI_HEADER_EN_MEM 0x04 +#define SABI_HEADER_DATA_OFFSET 0x05 +#define SABI_HEADER_DATA_SEGMENT 0x07 + +#define SABI_IFACE_MAIN 0x00 +#define SABI_IFACE_SUB 0x02 +#define SABI_IFACE_COMPLETE 0x04 +#define SABI_IFACE_DATA 0x05 + +/* Structure to get data back to the calling function */ +struct sabi_retval { + u8 retval[20]; +}; + +static void __iomem *sabi; +static void __iomem *sabi_iface; +static void __iomem *f0000_segment; +static struct backlight_device *backlight_device; +static struct mutex sabi_mutex; +static struct platform_device *sdev; +static struct rfkill *rfk; + +static int force; +module_param(force, bool, 0); +MODULE_PARM_DESC(force, "Disable the DMI check and forces the driver to be loaded"); + +static int debug; +module_param(debug, bool, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(debug, "Debug enabled or not"); + +static int sabi_get_command(u8 command, struct sabi_retval *sretval) +{ + int retval = 0; + u16 port = readw(sabi + SABI_HEADER_PORT); + + mutex_lock(&sabi_mutex); + + /* enable memory to be able to write to it */ + outb(readb(sabi + SABI_HEADER_EN_MEM), port); + + /* write out the command */ + writew(MAIN_FUNCTION, sabi_iface + SABI_IFACE_MAIN); + writew(command, sabi_iface + SABI_IFACE_SUB); + writeb(0, sabi_iface + SABI_IFACE_COMPLETE); + outb(readb(sabi + SABI_HEADER_IFACEFUNC), port); + + /* write protect memory to make it safe */ + outb(readb(sabi + SABI_HEADER_RE_MEM), port); + + /* see if the command actually succeeded */ + if (readb(sabi_iface + SABI_IFACE_COMPLETE) == 0xaa && + readb(sabi_iface + SABI_IFACE_DATA) != 0xff) { + /* + * It did! + * Save off the data into a structure so the caller use it. + * Right now we only care about the first 4 bytes, + * I suppose there are commands that need more, but I don't + * know about them. + */ + sretval->retval[0] = readb(sabi_iface + SABI_IFACE_DATA); + sretval->retval[1] = readb(sabi_iface + SABI_IFACE_DATA + 1); + sretval->retval[2] = readb(sabi_iface + SABI_IFACE_DATA + 2); + sretval->retval[3] = readb(sabi_iface + SABI_IFACE_DATA + 3); + goto exit; + } + + /* Something bad happened, so report it and error out */ + printk(KERN_WARNING "SABI command 0x%02x failed with completion flag 0x%02x and output 0x%02x\n", + command, readb(sabi_iface + SABI_IFACE_COMPLETE), + readb(sabi_iface + SABI_IFACE_DATA)); + retval = -EINVAL; +exit: + mutex_unlock(&sabi_mutex); + return retval; + +} + +static int sabi_set_command(u8 command, u8 data) +{ + int retval = 0; + u16 port = readw(sabi + SABI_HEADER_PORT); + + mutex_lock(&sabi_mutex); + + /* enable memory to be able to write to it */ + outb(readb(sabi + SABI_HEADER_EN_MEM), port); + + /* write out the command */ + writew(MAIN_FUNCTION, sabi_iface + SABI_IFACE_MAIN); + writew(command, sabi_iface + SABI_IFACE_SUB); + writeb(0, sabi_iface + SABI_IFACE_COMPLETE); + writeb(data, sabi_iface + SABI_IFACE_DATA); + outb(readb(sabi + SABI_HEADER_IFACEFUNC), port); + + /* write protect memory to make it safe */ + outb(readb(sabi + SABI_HEADER_RE_MEM), port); + + /* see if the command actually succeeded */ + if (readb(sabi_iface + SABI_IFACE_COMPLETE) == 0xaa && + readb(sabi_iface + SABI_IFACE_DATA) != 0xff) { + /* it did! */ + goto exit; + } + + /* Something bad happened, so report it and error out */ + printk(KERN_WARNING "SABI command 0x%02x failed with completion flag 0x%02x and output 0x%02x\n", + command, readb(sabi_iface + SABI_IFACE_COMPLETE), + readb(sabi_iface + SABI_IFACE_DATA)); + retval = -EINVAL; +exit: + mutex_unlock(&sabi_mutex); + return retval; +} + +static void test_backlight(void) +{ + struct sabi_retval sretval; + + sabi_get_command(GET_BACKLIGHT, &sretval); + printk(KERN_DEBUG "backlight = 0x%02x\n", sretval.retval[0]); + + sabi_set_command(SET_BACKLIGHT, 0); + printk(KERN_DEBUG "backlight should be off\n"); + + sabi_get_command(GET_BACKLIGHT, &sretval); + printk(KERN_DEBUG "backlight = 0x%02x\n", sretval.retval[0]); + + msleep(1000); + + sabi_set_command(SET_BACKLIGHT, 1); + printk(KERN_DEBUG "backlight should be on\n"); + + sabi_get_command(GET_BACKLIGHT, &sretval); + printk(KERN_DEBUG "backlight = 0x%02x\n", sretval.retval[0]); +} + +static void test_wireless(void) +{ + struct sabi_retval sretval; + + sabi_get_command(GET_WIRELESS_BUTTON, &sretval); + printk(KERN_DEBUG "wireless led = 0x%02x\n", sretval.retval[0]); + + sabi_set_command(SET_WIRELESS_BUTTON, 0); + printk(KERN_DEBUG "wireless led should be off\n"); + + sabi_get_command(GET_WIRELESS_BUTTON, &sretval); + printk(KERN_DEBUG "wireless led = 0x%02x\n", sretval.retval[0]); + + msleep(1000); + + sabi_set_command(SET_WIRELESS_BUTTON, 1); + printk(KERN_DEBUG "wireless led should be on\n"); + + sabi_get_command(GET_WIRELESS_BUTTON, &sretval); + printk(KERN_DEBUG "wireless led = 0x%02x\n", sretval.retval[0]); +} + +static u8 read_brightness(void) +{ + struct sabi_retval sretval; + int user_brightness = 0; + int retval; + + retval = sabi_get_command(GET_BRIGHTNESS, &sretval); + if (!retval) + user_brightness = sretval.retval[0]; + if (user_brightness != 0) + --user_brightness; + return user_brightness; +} + +static void set_brightness(u8 user_brightness) +{ + sabi_set_command(SET_BRIGHTNESS, user_brightness + 1); +} + +static int get_brightness(struct backlight_device *bd) +{ + return (int)read_brightness(); +} + +static int update_status(struct backlight_device *bd) +{ + set_brightness(bd->props.brightness); + + if (bd->props.power == FB_BLANK_UNBLANK) + sabi_set_command(SET_BACKLIGHT, 1); + else + sabi_set_command(SET_BACKLIGHT, 0); + return 0; +} + +static struct backlight_ops backlight_ops = { + .get_brightness = get_brightness, + .update_status = update_status, +}; + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31) +static int rfkill_set(void *data, bool blocked) +{ + /* Do something with blocked...*/ + /* + * blocked == false is on + * blocked == true is off + */ + if (blocked) + sabi_set_command(SET_WIRELESS_BUTTON, 0); + else + sabi_set_command(SET_WIRELESS_BUTTON, 1); + + return 0; +} + +static struct rfkill_ops rfkill_ops = { + .set_block = rfkill_set, +}; + +static int init_wireless(struct platform_device *sdev) +{ + int retval; + + rfk = rfkill_alloc("samsung-wifi", &sdev->dev, RFKILL_TYPE_WLAN, + &rfkill_ops, NULL); + if (!rfk) + return -ENOMEM; + + retval = rfkill_register(rfk); + if (retval) { + rfkill_destroy(rfk); + return -ENODEV; + } + + return 0; +} + +static void destroy_wireless(void) +{ + rfkill_unregister(rfk); + rfkill_destroy(rfk); +} + +#else + +static int rfkill_set(void *data, enum rfkill_state state) +{ + if (state == RFKILL_STATE_UNBLOCKED) + sabi_set_command(SET_WIRELESS_BUTTON, 1); + else + sabi_set_command(SET_WIRELESS_BUTTON, 0); + + return 0; +} + +static int init_wireless(struct platform_device *sdev) +{ + int retval; + + rfk = rfkill_allocate(&sdev->dev, RFKILL_TYPE_WLAN); + if (!rfk) + return -ENOMEM; + rfk->toggle_radio = rfkill_set; + rfk->name = "samsung-wifi"; + + retval = rfkill_register(rfk); + if (retval) { + rfkill_free(rfk); + return -ENODEV; + } + + return 0; +} + +static void destroy_wireless(void) +{ + rfkill_unregister(rfk); +} + +#endif + +static ssize_t get_silent_state(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct sabi_retval sretval; + int retval; + + /* Read the state */ + retval = sabi_get_command(GET_PERFORMANCE_LEVEL, &sretval); + if (retval) + return retval; + + /* The logic is backwards, yeah, lots of fun... */ + if (sretval.retval[0] == 0) + retval = 1; + else + retval = 0; + return sprintf(buf, "%d\n", retval); +} + +static ssize_t set_silent_state(struct device *dev, + struct device_attribute *attr, const char *buf, + size_t count) +{ + char value; + + if (count >= 1) { + value = buf[0]; + if ((value == '0') || (value == 'n') || (value == 'N')) { + /* Turn speed up */ + sabi_set_command(SET_PERFORMANCE_LEVEL, 0x01); + } else if ((value == '1') || (value == 'y') || (value == 'Y')) { + /* Turn speed down */ + sabi_set_command(SET_PERFORMANCE_LEVEL, 0x00); + } else { + return -EINVAL; + } + } + return count; +} +static DEVICE_ATTR(silent, S_IWUGO | S_IRUGO, + get_silent_state, set_silent_state); + + +static int __init dmi_check_cb(const struct dmi_system_id *id) +{ + printk(KERN_INFO KBUILD_MODNAME ": found laptop model '%s'\n", + id->ident); + return 0; +} + +static struct dmi_system_id __initdata samsung_dmi_table[] = { + { + .ident = "N128", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), + DMI_MATCH(DMI_PRODUCT_NAME, "N128"), + DMI_MATCH(DMI_BOARD_NAME, "N128"), + }, + .callback = dmi_check_cb, + }, + { + .ident = "N130", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), + DMI_MATCH(DMI_PRODUCT_NAME, "N130"), + DMI_MATCH(DMI_BOARD_NAME, "N130"), + }, + .callback = dmi_check_cb, + }, + { }, +}; +MODULE_DEVICE_TABLE(dmi, samsung_dmi_table); + +static int __init samsung_init(void) +{ + struct sabi_retval sretval; + const char *testStr = "SECLINUX"; + void __iomem *memcheck; + unsigned int ifaceP; + int pStr; + int loca; + int retval; + + mutex_init(&sabi_mutex); + + if (!force && !dmi_check_system(samsung_dmi_table)) + return -ENODEV; + + f0000_segment = ioremap(0xf0000, 0xffff); + if (!f0000_segment) { + printk(KERN_ERR "Can't map the segment at 0xf0000\n"); + return -EINVAL; + } + + /* Try to find the signature "SECLINUX" in memory to find the header */ + pStr = 0; + memcheck = f0000_segment; + for (loca = 0; loca < 0xffff; loca++) { + char temp = readb(memcheck + loca); + + if (temp == testStr[pStr]) { + if (pStr == strlen(testStr)-1) + break; + ++pStr; + } else { + pStr = 0; + } + } + if (loca == 0xffff) { + printk(KERN_ERR "This computer does not support SABI\n"); + goto error_no_signature; + } + + /* point to the SMI port Number */ + loca += 1; + sabi = (memcheck + loca); + + if (debug) { + printk(KERN_DEBUG "This computer supports SABI==%x\n", + loca + 0xf0000 - 6); + printk(KERN_DEBUG "SABI header:\n"); + printk(KERN_DEBUG " SMI Port Number = 0x%04x\n", + readw(sabi + SABI_HEADER_PORT)); + printk(KERN_DEBUG " SMI Interface Function = 0x%02x\n", + readb(sabi + SABI_HEADER_IFACEFUNC)); + printk(KERN_DEBUG " SMI enable memory buffer = 0x%02x\n", + readb(sabi + SABI_HEADER_EN_MEM)); + printk(KERN_DEBUG " SMI restore memory buffer = 0x%02x\n", + readb(sabi + SABI_HEADER_RE_MEM)); + printk(KERN_DEBUG " SABI data offset = 0x%04x\n", + readw(sabi + SABI_HEADER_DATA_OFFSET)); + printk(KERN_DEBUG " SABI data segment = 0x%04x\n", + readw(sabi + SABI_HEADER_DATA_SEGMENT)); + } + + /* Get a pointer to the SABI Interface */ + ifaceP = (readw(sabi + SABI_HEADER_DATA_SEGMENT) & 0x0ffff) << 4; + ifaceP += readw(sabi + SABI_HEADER_DATA_OFFSET) & 0x0ffff; + sabi_iface = ioremap(ifaceP, 16); + if (!sabi_iface) { + printk(KERN_ERR "Can't remap %x\n", ifaceP); + goto exit; + } + if (debug) { + printk(KERN_DEBUG "ifaceP = 0x%08x\n", ifaceP); + printk(KERN_DEBUG "sabi_iface = %p\n", sabi_iface); + + test_backlight(); + test_wireless(); + + retval = sabi_get_command(GET_BRIGHTNESS, &sretval); + printk(KERN_DEBUG "brightness = 0x%02x\n", sretval.retval[0]); + } + + /* Turn on "Linux" mode in the BIOS */ + retval = sabi_set_command(SET_LINUX, 0x81); + if (retval) { + printk(KERN_ERR KBUILD_MODNAME ": Linux mode was not set!\n"); + goto error_no_platform; + } + + /* knock up a platform device to hang stuff off of */ + sdev = platform_device_register_simple("samsung", -1, NULL, 0); + if (IS_ERR(sdev)) + goto error_no_platform; + + /* create a backlight device to talk to this one */ + backlight_device = backlight_device_register("samsung", &sdev->dev, + NULL, &backlight_ops); + if (IS_ERR(backlight_device)) + goto error_no_backlight; + + backlight_device->props.max_brightness = MAX_BRIGHT; + backlight_device->props.brightness = read_brightness(); + backlight_device->props.power = FB_BLANK_UNBLANK; + backlight_update_status(backlight_device); + + retval = init_wireless(sdev); + if (retval) + goto error_no_rfk; + + retval = device_create_file(&sdev->dev, &dev_attr_silent); + if (retval) + goto error_file_create; + +exit: + return 0; + +error_file_create: + destroy_wireless(); + +error_no_rfk: + backlight_device_unregister(backlight_device); + +error_no_backlight: + platform_device_unregister(sdev); + +error_no_platform: + iounmap(sabi_iface); + +error_no_signature: + iounmap(f0000_segment); + return -EINVAL; +} + +static void __exit samsung_exit(void) +{ + /* Turn off "Linux" mode in the BIOS */ + sabi_set_command(SET_LINUX, 0x80); + + device_remove_file(&sdev->dev, &dev_attr_silent); + backlight_device_unregister(backlight_device); + destroy_wireless(); + iounmap(sabi_iface); + iounmap(f0000_segment); + platform_device_unregister(sdev); +} + +module_init(samsung_init); +module_exit(samsung_exit); + +MODULE_AUTHOR("Greg Kroah-Hartman "); +MODULE_DESCRIPTION("Samsung Backlight driver"); +MODULE_LICENSE("GPL"); -- GitLab From 5b4c4dc61d5445346b1d5465c4b4934ea933165b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 3 Dec 2009 16:24:47 -0800 Subject: [PATCH 229/235] Staging: samsung-laptop: remove old kernel code Don't test for the kernel version, we know what version we are in, the latest. Signed-off-by: Greg Kroah-Hartman --- .../staging/samsung-laptop/samsung-laptop.c | 40 ------------------- 1 file changed, 40 deletions(-) diff --git a/drivers/staging/samsung-laptop/samsung-laptop.c b/drivers/staging/samsung-laptop/samsung-laptop.c index 253b44754aa4..4877138a9f96 100644 --- a/drivers/staging/samsung-laptop/samsung-laptop.c +++ b/drivers/staging/samsung-laptop/samsung-laptop.c @@ -9,7 +9,6 @@ * the Free Software Foundation. * */ -#include #include #include #include @@ -274,7 +273,6 @@ static struct backlight_ops backlight_ops = { .update_status = update_status, }; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31) static int rfkill_set(void *data, bool blocked) { /* Do something with blocked...*/ @@ -318,44 +316,6 @@ static void destroy_wireless(void) rfkill_destroy(rfk); } -#else - -static int rfkill_set(void *data, enum rfkill_state state) -{ - if (state == RFKILL_STATE_UNBLOCKED) - sabi_set_command(SET_WIRELESS_BUTTON, 1); - else - sabi_set_command(SET_WIRELESS_BUTTON, 0); - - return 0; -} - -static int init_wireless(struct platform_device *sdev) -{ - int retval; - - rfk = rfkill_allocate(&sdev->dev, RFKILL_TYPE_WLAN); - if (!rfk) - return -ENOMEM; - rfk->toggle_radio = rfkill_set; - rfk->name = "samsung-wifi"; - - retval = rfkill_register(rfk); - if (retval) { - rfkill_free(rfk); - return -ENODEV; - } - - return 0; -} - -static void destroy_wireless(void) -{ - rfkill_unregister(rfk); -} - -#endif - static ssize_t get_silent_state(struct device *dev, struct device_attribute *attr, char *buf) { -- GitLab From 7f1f6e72e26c9e0f5d1b9b7766e174da4057a72d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 3 Dec 2009 16:27:19 -0800 Subject: [PATCH 230/235] Staging: samsung-laptop: add TODO file Signed-off-by: Greg Kroah-Hartman --- drivers/staging/samsung-laptop/TODO | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 drivers/staging/samsung-laptop/TODO diff --git a/drivers/staging/samsung-laptop/TODO b/drivers/staging/samsung-laptop/TODO new file mode 100644 index 000000000000..f7a6d589916e --- /dev/null +++ b/drivers/staging/samsung-laptop/TODO @@ -0,0 +1,5 @@ +TODO: + - review from other developers + - figure out ACPI video issues + +Please send patches to Greg Kroah-Hartman -- GitLab From d0f2cc5aea14a4dfd342616faade05b75cb6c309 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Fri, 4 Dec 2009 17:05:45 -0800 Subject: [PATCH 231/235] + drivers-staging-wlags49_h2-remove-cvs-metadata.patch added to -mm tree Cc: Henk de Groot Cc: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlags49_h2/debug.h | 17 ----------------- drivers/staging/wlags49_h2/dhfcfg.h | 17 ----------------- drivers/staging/wlags49_h2/wl_cs.c | 13 ------------- drivers/staging/wlags49_h2/wl_cs.h | 17 ----------------- drivers/staging/wlags49_h2/wl_enc.c | 17 ----------------- drivers/staging/wlags49_h2/wl_enc.h | 17 ----------------- drivers/staging/wlags49_h2/wl_if.h | 17 ----------------- drivers/staging/wlags49_h2/wl_internal.h | 17 ----------------- drivers/staging/wlags49_h2/wl_main.c | 12 ------------ drivers/staging/wlags49_h2/wl_main.h | 17 ----------------- drivers/staging/wlags49_h2/wl_netdev.c | 15 --------------- drivers/staging/wlags49_h2/wl_netdev.h | 17 ----------------- drivers/staging/wlags49_h2/wl_pci.c | 15 --------------- drivers/staging/wlags49_h2/wl_pci.h | 17 ----------------- drivers/staging/wlags49_h2/wl_priv.c | 17 ----------------- drivers/staging/wlags49_h2/wl_priv.h | 17 ----------------- drivers/staging/wlags49_h2/wl_profile.c | 17 ----------------- drivers/staging/wlags49_h2/wl_profile.h | 17 ----------------- drivers/staging/wlags49_h2/wl_util.c | 17 ----------------- drivers/staging/wlags49_h2/wl_util.h | 14 -------------- drivers/staging/wlags49_h2/wl_version.h | 14 -------------- drivers/staging/wlags49_h2/wl_wext.c | 17 ----------------- drivers/staging/wlags49_h2/wl_wext.h | 17 ----------------- 23 files changed, 372 deletions(-) diff --git a/drivers/staging/wlags49_h2/debug.h b/drivers/staging/wlags49_h2/debug.h index d3db6266f6e3..0b52e17b3011 100644 --- a/drivers/staging/wlags49_h2/debug.h +++ b/drivers/staging/wlags49_h2/debug.h @@ -58,23 +58,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/07/20 09:29:45 $ - * $Revision: 1.3 $ - * $Source: /usr/local/cvs/wl_lkm/include/hcf/debug.h,v $ - * - ******************************************************************************/ - - - - #ifndef _DEBUG_H #define _DEBUG_H diff --git a/drivers/staging/wlags49_h2/dhfcfg.h b/drivers/staging/wlags49_h2/dhfcfg.h index 55bd90e422e8..a0c26c678c59 100644 --- a/drivers/staging/wlags49_h2/dhfcfg.h +++ b/drivers/staging/wlags49_h2/dhfcfg.h @@ -58,23 +58,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/07/19 07:08:33 $ - * $Revision: 1.1.1.1 $ - * $Source: /usr/local/cvs/wl_lkm/include/hcf/dhfcfg.h,v $ - * - ******************************************************************************/ - - - - #ifndef DHFCFG_H #define DHFCFG_H /*----------------------------------------------------------------------------- diff --git a/drivers/staging/wlags49_h2/wl_cs.c b/drivers/staging/wlags49_h2/wl_cs.c index c93e8c8b9699..811a8daa660e 100644 --- a/drivers/staging/wlags49_h2/wl_cs.c +++ b/drivers/staging/wlags49_h2/wl_cs.c @@ -59,19 +59,6 @@ * ******************************************************************************/ - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/08/06 11:25:37 $ - * $Revision: 1.5 $ - * $Source: /usr/local/cvs/wl_lkm/wireless/wl_cs.c,v $ - * - ******************************************************************************/ - - /******************************************************************************* * include files ******************************************************************************/ diff --git a/drivers/staging/wlags49_h2/wl_cs.h b/drivers/staging/wlags49_h2/wl_cs.h index 3971fbc4e6ef..2a0e67450fbe 100644 --- a/drivers/staging/wlags49_h2/wl_cs.h +++ b/drivers/staging/wlags49_h2/wl_cs.h @@ -58,23 +58,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/07/19 08:16:15 $ - * $Revision: 1.2 $ - * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_cs.h,v $ - * - ******************************************************************************/ - - - - #ifndef __WL_CS_H__ #define __WL_CS_H__ diff --git a/drivers/staging/wlags49_h2/wl_enc.c b/drivers/staging/wlags49_h2/wl_enc.c index 33181da413cb..48c44c8fdb28 100644 --- a/drivers/staging/wlags49_h2/wl_enc.c +++ b/drivers/staging/wlags49_h2/wl_enc.c @@ -59,23 +59,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/07/19 08:16:15 $ - * $Revision: 1.2 $ - * $Source: /usr/local/cvs/wl_lkm/wireless/wl_enc.c,v $ - * - ******************************************************************************/ - - - - /******************************************************************************* * include files ******************************************************************************/ diff --git a/drivers/staging/wlags49_h2/wl_enc.h b/drivers/staging/wlags49_h2/wl_enc.h index 15467a33b3b5..b4f54d81f311 100644 --- a/drivers/staging/wlags49_h2/wl_enc.h +++ b/drivers/staging/wlags49_h2/wl_enc.h @@ -58,23 +58,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/07/19 08:16:15 $ - * $Revision: 1.2 $ - * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_enc.h,v $ - * - ******************************************************************************/ - - - - #ifndef __WAVELAN2_ENCRYPTION_H__ #define __WAVELAN2_ENCRYPTION_H__ diff --git a/drivers/staging/wlags49_h2/wl_if.h b/drivers/staging/wlags49_h2/wl_if.h index 8f0cb10a5be6..919431f12a85 100644 --- a/drivers/staging/wlags49_h2/wl_if.h +++ b/drivers/staging/wlags49_h2/wl_if.h @@ -59,23 +59,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/07/19 08:16:15 $ - * $Revision: 1.2 $ - * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_if.h,v $ - * - ******************************************************************************/ - - - - #ifndef __WAVELAN2_IF_H__ #define __WAVELAN2_IF_H__ diff --git a/drivers/staging/wlags49_h2/wl_internal.h b/drivers/staging/wlags49_h2/wl_internal.h index 1d9bdfa2fbfb..466fb6215acd 100644 --- a/drivers/staging/wlags49_h2/wl_internal.h +++ b/drivers/staging/wlags49_h2/wl_internal.h @@ -58,23 +58,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/08/03 11:39:39 $ - * $Revision: 1.8 $ - * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_internal.h,v $ - * - ******************************************************************************/ - - - - #ifndef __WAVELAN2_H__ #define __WAVELAN2_H__ diff --git a/drivers/staging/wlags49_h2/wl_main.c b/drivers/staging/wlags49_h2/wl_main.c index 69571938a676..16764a000942 100644 --- a/drivers/staging/wlags49_h2/wl_main.c +++ b/drivers/staging/wlags49_h2/wl_main.c @@ -59,18 +59,6 @@ * ******************************************************************************/ - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/08/06 11:25:37 $ - * $Revision: 1.14 $ - * $Source: /usr/local/cvs/wl_lkm/wireless/wl_main.c,v $ - * - ******************************************************************************/ - /******************************************************************************* * constant definitions ******************************************************************************/ diff --git a/drivers/staging/wlags49_h2/wl_main.h b/drivers/staging/wlags49_h2/wl_main.h index e57e2cb074bc..d593ae535fb8 100644 --- a/drivers/staging/wlags49_h2/wl_main.h +++ b/drivers/staging/wlags49_h2/wl_main.h @@ -58,23 +58,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/07/23 04:51:21 $ - * $Revision: 1.4 $ - * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_main.h,v $ - * - ******************************************************************************/ - - - - #ifndef __WL_MAIN_H__ #define __WL_MAIN_H__ diff --git a/drivers/staging/wlags49_h2/wl_netdev.c b/drivers/staging/wlags49_h2/wl_netdev.c index a00207b17d2b..ac3890247965 100644 --- a/drivers/staging/wlags49_h2/wl_netdev.c +++ b/drivers/staging/wlags49_h2/wl_netdev.c @@ -59,21 +59,6 @@ * ******************************************************************************/ - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/08/03 13:33:44 $ - * $Revision: 1.8 $ - * $Source: /usr/local/cvs/wl_lkm/wireless/wl_netdev.c,v $ - * - ******************************************************************************/ - - - /******************************************************************************* * include files ******************************************************************************/ diff --git a/drivers/staging/wlags49_h2/wl_netdev.h b/drivers/staging/wlags49_h2/wl_netdev.h index ad04c8eedabf..632ab2e6302c 100644 --- a/drivers/staging/wlags49_h2/wl_netdev.h +++ b/drivers/staging/wlags49_h2/wl_netdev.h @@ -59,23 +59,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/07/19 08:16:15 $ - * $Revision: 1.2 $ - * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_netdev.h,v $ - * - ******************************************************************************/ - - - - #ifndef __WL_NETDEV_H__ #define __WL_NETDEV_H__ diff --git a/drivers/staging/wlags49_h2/wl_pci.c b/drivers/staging/wlags49_h2/wl_pci.c index 4567100bcbf6..a3db111d4a95 100644 --- a/drivers/staging/wlags49_h2/wl_pci.c +++ b/drivers/staging/wlags49_h2/wl_pci.c @@ -59,21 +59,6 @@ * ******************************************************************************/ - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/08/06 11:25:37 $ - * $Revision: 1.7 $ - * $Source: /usr/local/cvs/wl_lkm/wireless/wl_pci.c,v $ - * - ******************************************************************************/ - - - /******************************************************************************* * include files ******************************************************************************/ diff --git a/drivers/staging/wlags49_h2/wl_pci.h b/drivers/staging/wlags49_h2/wl_pci.h index 32ea7b913ec8..18d7b514ea6c 100644 --- a/drivers/staging/wlags49_h2/wl_pci.h +++ b/drivers/staging/wlags49_h2/wl_pci.h @@ -58,23 +58,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/07/19 08:16:15 $ - * $Revision: 1.2 $ - * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_pci.h,v $ - * - ******************************************************************************/ - - - - #ifndef __WL_PCI_H__ #define __WL_PCI_H__ diff --git a/drivers/staging/wlags49_h2/wl_priv.c b/drivers/staging/wlags49_h2/wl_priv.c index 3a0844582f45..ee610c76457e 100644 --- a/drivers/staging/wlags49_h2/wl_priv.c +++ b/drivers/staging/wlags49_h2/wl_priv.c @@ -58,23 +58,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/08/03 11:39:39 $ - * $Revision: 1.5 $ - * $Source: /usr/local/cvs/wl_lkm/wireless/wl_priv.c,v $ - * - ******************************************************************************/ - - - - /******************************************************************************* * include files ******************************************************************************/ diff --git a/drivers/staging/wlags49_h2/wl_priv.h b/drivers/staging/wlags49_h2/wl_priv.h index 039b317d1296..9b0254497aa7 100644 --- a/drivers/staging/wlags49_h2/wl_priv.h +++ b/drivers/staging/wlags49_h2/wl_priv.h @@ -58,23 +58,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/07/19 08:16:15 $ - * $Revision: 1.2 $ - * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_priv.h,v $ - * - ******************************************************************************/ - - - - #ifndef __WL_PRIV_H__ #define __WL_PRIV_H__ diff --git a/drivers/staging/wlags49_h2/wl_profile.c b/drivers/staging/wlags49_h2/wl_profile.c index 4130e6a0ea76..715f027a923f 100644 --- a/drivers/staging/wlags49_h2/wl_profile.c +++ b/drivers/staging/wlags49_h2/wl_profile.c @@ -59,23 +59,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/08/04 12:36:10 $ - * $Revision: 1.10 $ - * $Source: /usr/local/cvs/wl_lkm/wireless/wl_profile.c,v $ - * - ******************************************************************************/ - - - - /* Only include this file if USE_PROFILE is defined */ #ifdef USE_PROFILE diff --git a/drivers/staging/wlags49_h2/wl_profile.h b/drivers/staging/wlags49_h2/wl_profile.h index a6ac4a3277bc..81db8e8c6ba8 100644 --- a/drivers/staging/wlags49_h2/wl_profile.h +++ b/drivers/staging/wlags49_h2/wl_profile.h @@ -58,23 +58,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/07/23 11:46:19 $ - * $Revision: 1.3 $ - * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_profile.h,v $ - * - ******************************************************************************/ - - - - #ifndef __WL_PROFILE_H__ #define __WL_PROFILE_H__ diff --git a/drivers/staging/wlags49_h2/wl_util.c b/drivers/staging/wlags49_h2/wl_util.c index aba05d29a838..ac1e7f38f982 100644 --- a/drivers/staging/wlags49_h2/wl_util.c +++ b/drivers/staging/wlags49_h2/wl_util.c @@ -58,23 +58,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/08/04 12:36:10 $ - * $Revision: 1.6 $ - * $Source: /usr/local/cvs/wl_lkm/wireless/wl_util.c,v $ - * - ******************************************************************************/ - - - - /******************************************************************************* * include files ******************************************************************************/ diff --git a/drivers/staging/wlags49_h2/wl_util.h b/drivers/staging/wlags49_h2/wl_util.h index b7593375480f..16cd6c578adb 100644 --- a/drivers/staging/wlags49_h2/wl_util.h +++ b/drivers/staging/wlags49_h2/wl_util.h @@ -59,20 +59,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/07/19 08:16:15 $ - * $Revision: 1.2 $ - * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_util.h,v $ - * - ******************************************************************************/ - #ifndef __WL_UTIL_H__ #define __WL_UTIL_H__ diff --git a/drivers/staging/wlags49_h2/wl_version.h b/drivers/staging/wlags49_h2/wl_version.h index 909a5bc97d01..a5e604cd1983 100644 --- a/drivers/staging/wlags49_h2/wl_version.h +++ b/drivers/staging/wlags49_h2/wl_version.h @@ -59,20 +59,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/08/04 12:36:10 $ - * $Revision: 1.7 $ - * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_version.h,v $ - * - ******************************************************************************/ - #ifndef __WL_VERSION_H__ #define __WL_VERSION_H__ diff --git a/drivers/staging/wlags49_h2/wl_wext.c b/drivers/staging/wlags49_h2/wl_wext.c index 82ae027b5905..5562e1de229b 100644 --- a/drivers/staging/wlags49_h2/wl_wext.c +++ b/drivers/staging/wlags49_h2/wl_wext.c @@ -54,23 +54,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/08/03 11:39:39 $ - * $Revision: 1.6 $ - * $Source: /usr/local/cvs/wl_lkm/wireless/wl_wext.c,v $ - * - ******************************************************************************/ - - - - /******************************************************************************* * include files ******************************************************************************/ diff --git a/drivers/staging/wlags49_h2/wl_wext.h b/drivers/staging/wlags49_h2/wl_wext.h index 9d09de8b84fa..39d39a47b05a 100644 --- a/drivers/staging/wlags49_h2/wl_wext.h +++ b/drivers/staging/wlags49_h2/wl_wext.h @@ -58,23 +58,6 @@ * ******************************************************************************/ - - - -/******************************************************************************* - * VERSION CONTROL INFORMATION - ******************************************************************************* - * - * $Author: nico $ - * $Date: 2004/07/19 08:16:15 $ - * $Revision: 1.2 $ - * $Source: /usr/local/cvs/wl_lkm/include/wireless/wl_wext.h,v $ - * - ******************************************************************************/ - - - - #ifndef __WL_WEXT_H__ #define __WL_WEXT_H__ -- GitLab From e81589a70c9dbee888cce16e8bdfdc993299dc3f Mon Sep 17 00:00:00 2001 From: Henk de Groot Date: Sun, 6 Dec 2009 21:29:31 +0100 Subject: [PATCH 232/235] Staging: wlags49_h2: fix up signal levels Adjusts the signal levels reported by the wlags49_h2 and wlags49_h25 staging drivers. With the constants supplied by Agere the signal levels are always poor, even in close proximity to the AP. The signals are now measured with a real device. 100% for close proximity to the AP, 0% for the noice floor. Now the levels shown by the NetworkManager gauge make sense. Some magic numbers in the related code are replaced by the correct constants from the wireless extension interface (wireless.h). Also the flag IW_QUAL_DBM is now set, as specified in the wireless.h header file. Signed-off-by: Henk de Groot Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlags49_h2/wl_if.h | 31 ++++++++++++++++++++++------ drivers/staging/wlags49_h2/wl_wext.c | 19 ++++++++++++----- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wlags49_h2/wl_if.h b/drivers/staging/wlags49_h2/wl_if.h index 919431f12a85..ed2b4135a10e 100644 --- a/drivers/staging/wlags49_h2/wl_if.h +++ b/drivers/staging/wlags49_h2/wl_if.h @@ -80,13 +80,32 @@ #define TX_TIMEOUT ((800 * HZ) / 1000) +//#define HCF_MIN_COMM_QUALITY 0 +//#define HCF_MAX_COMM_QUALITY 92 +//#define HCF_MIN_SIGNAL_LEVEL 47 +//#define HCF_MAX_SIGNAL_LEVEL 138 +//#define HCF_MIN_NOISE_LEVEL 47 +//#define HCF_MAX_NOISE_LEVEL 138 +//#define HCF_0DBM_OFFSET 149 + +// PE1DNN +// Better data from the real world. Not scientific but empirical data gathered +// from a Thomson Speedtouch 110 which is identified as: +// PCMCIA Info: "Agere Systems" "Wireless PC Card Model 0110" +// Manufacture ID: 0156,0003 +// Lowest measurment for noise floor seen is value 54 +// Highest signal strength in close proximity to the AP seen is value 118 +// Very good must be arround 100 (otherwise its never "full scale" +// All other constants are derrived from these. This makes the signal gauge +// work for me... +#define HCF_MIN_SIGNAL_LEVEL 54 +#define HCF_MAX_SIGNAL_LEVEL 100 +#define HCF_MIN_NOISE_LEVEL HCF_MIN_SIGNAL_LEVEL +#define HCF_MAX_NOISE_LEVEL HCF_MAX_SIGNAL_LEVEL +#define HCF_0DBM_OFFSET (HCF_MAX_SIGNAL_LEVEL + 1) #define HCF_MIN_COMM_QUALITY 0 -#define HCF_MAX_COMM_QUALITY 92 -#define HCF_MIN_SIGNAL_LEVEL 47 -#define HCF_MAX_SIGNAL_LEVEL 138 -#define HCF_MIN_NOISE_LEVEL 47 -#define HCF_MAX_NOISE_LEVEL 138 -#define HCF_0DBM_OFFSET 149 +#define HCF_MAX_COMM_QUALITY (HCF_MAX_SIGNAL_LEVEL - HCF_MIN_NOISE_LEVEL + 1) + /* For encryption (WEP) */ #define MIN_KEY_SIZE 5 // 40 bits RC4 - WEP diff --git a/drivers/staging/wlags49_h2/wl_wext.c b/drivers/staging/wlags49_h2/wl_wext.c index 5562e1de229b..4434e0065488 100644 --- a/drivers/staging/wlags49_h2/wl_wext.c +++ b/drivers/staging/wlags49_h2/wl_wext.c @@ -2770,7 +2770,7 @@ static int wireless_get_scan(struct net_device *dev, struct iw_request_info *inf iwe.u.qual.level = dbm(probe_resp->signal); iwe.u.qual.noise = dbm(probe_resp->silence); iwe.u.qual.qual = iwe.u.qual.level - iwe.u.qual.noise; - iwe.u.qual.updated = lp->probe_results.scan_complete; + iwe.u.qual.updated = lp->probe_results.scan_complete | IW_QUAL_DBM; iwe.len = IW_EV_QUAL_LEN; buf = IWE_STREAM_ADD_EVENT(info, buf, buf_end, &iwe, IW_EV_QUAL_LEN); @@ -3317,7 +3317,6 @@ struct iw_statistics * wl_wireless_stats( struct net_device *dev ) /* Get the current link quality information */ lp->ltvRecord.len = 1 + ( sizeof( *pQual ) / sizeof( hcf_16 )); lp->ltvRecord.typ = CFG_COMMS_QUALITY; - status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); if( status == HCF_SUCCESS ) { @@ -3327,6 +3326,11 @@ struct iw_statistics * wl_wireless_stats( struct net_device *dev ) pStats->qual.qual = (u_char) CNV_LITTLE_TO_INT( pQual->coms_qual ); pStats->qual.level = (u_char) dbm( CNV_LITTLE_TO_INT( pQual->signal_lvl )); pStats->qual.noise = (u_char) dbm( CNV_LITTLE_TO_INT( pQual->noise_lvl )); + + pStats->qual.updated |= (IW_QUAL_QUAL_UPDATED | + IW_QUAL_LEVEL_UPDATED | + IW_QUAL_NOISE_UPDATED | + IW_QUAL_DBM); #else pStats->qual.qual = percent( CNV_LITTLE_TO_INT( pQual->coms_qual ), HCF_MIN_COMM_QUALITY, @@ -3339,9 +3343,11 @@ struct iw_statistics * wl_wireless_stats( struct net_device *dev ) pStats->qual.noise = percent( CNV_LITTLE_TO_INT( pQual->noise_lvl ), HCF_MIN_NOISE_LEVEL, HCF_MAX_NOISE_LEVEL ); -#endif /* USE_DBM */ - pStats->qual.updated |= 0x07; + pStats->qual.updated |= (IW_QUAL_QUAL_UPDATED | + IW_QUAL_LEVEL_UPDATED | + IW_QUAL_NOISE_UPDATED); +#endif /* USE_DBM */ } else { memset( &( pStats->qual ), 0, sizeof( pStats->qual )); } @@ -3478,7 +3484,10 @@ inline void wl_spy_gather( struct net_device *dev, u_char *mac ) wstats.noise = (u_char) dbm(stats[0]); wstats.qual = wstats.level > wstats.noise ? wstats.level - wstats.noise : 0; - wstats.updated = 7; + wstats.updated = (IW_QUAL_QUAL_UPDATED | + IW_QUAL_LEVEL_UPDATED | + IW_QUAL_NOISE_UPDATED | + IW_QUAL_DBM); wireless_spy_update( dev, mac, &wstats ); } -- GitLab From eaacdd9b31b9dd6b342b569711b69e47dbba19b2 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Sun, 22 Nov 2009 16:00:02 +0000 Subject: [PATCH 233/235] Staging: IIO: Remove tsl2561 driver. Support merged with tsl2563. This patch simply removes the tsl2561 driver. Signed-off-by: Jonathan Cameron Acked-by: Amit Kucheria --- drivers/staging/iio/light/Kconfig | 9 - drivers/staging/iio/light/Makefile | 1 - drivers/staging/iio/light/tsl2561.c | 272 ---------------------------- 3 files changed, 282 deletions(-) delete mode 100644 drivers/staging/iio/light/tsl2561.c diff --git a/drivers/staging/iio/light/Kconfig b/drivers/staging/iio/light/Kconfig index cf0d0d64b958..ab541918406b 100644 --- a/drivers/staging/iio/light/Kconfig +++ b/drivers/staging/iio/light/Kconfig @@ -3,15 +3,6 @@ # comment "Light sensors" -config TSL2561 - tristate "TAOS TSL2561 light-to-digital convertor" - depends on I2C - help - Say yes bere to build support for the TAOS light to digital - convertor. This chip has two light sensors. One is broadband - including infrared whilst the other measures only infrared. - Provides direct access via sysfs. - config SENSORS_TSL2563 tristate "TAOS TSL2563 ambient light sensor" depends on I2C diff --git a/drivers/staging/iio/light/Makefile b/drivers/staging/iio/light/Makefile index 30dbfb1033a3..30f3300e2a68 100644 --- a/drivers/staging/iio/light/Makefile +++ b/drivers/staging/iio/light/Makefile @@ -2,5 +2,4 @@ # Makefile for industrial I/O Light sensors # -obj-$(CONFIG_TSL2561) += tsl2561.o obj-$(CONFIG_SENSORS_TSL2563) += tsl2563.o diff --git a/drivers/staging/iio/light/tsl2561.c b/drivers/staging/iio/light/tsl2561.c deleted file mode 100644 index fc2107f4c049..000000000000 --- a/drivers/staging/iio/light/tsl2561.c +++ /dev/null @@ -1,272 +0,0 @@ -/* - * tsl2561.c - Linux kernel modules for light to digital convertor - * - * Copyright (C) 2008-2009 Jonathan Cameron - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Some portions based upon the tsl2550 driver. - * - * This driver could probably be adapted easily to talk to the tsl2560 (smbus) - * - * Needs some work to support the events this can generate. - * Todo: Implement interrupt handling. Currently a hardware bug means - * this isn't available on my test board. - */ - -#include -#include -#include -#include "../iio.h" -#include "../sysfs.h" -#include "light.h" - -#define TSL2561_CONTROL_REGISTER 0x00 -#define TSL2561_TIMING_REGISTER 0x01 -#define TSL2561_THRESHLOW_LOW_REGISTER 0x02 -#define TSL2561_THRESHLOW_HIGH_REGISTER 0x03 -#define TSL2561_THRESHHIGH_LOW_REGISTER 0x04 -#define TSL2561_THRESHHIGH_HIGH_REGISTER 0x05 -#define TSL2561_INT_CONTROL_REGISTER 0x06 - -#define TSL2561_INT_REG_INT_OFF 0x00 -#define TSL2561_INT_REG_INT_LEVEL 0x08 -#define TSL2561_INT_REG_INT_SMBUS 0x10 -#define TSL2561_INT_REG_INT_TEST 0x18 - -#define TSL2561_ID_REGISTER 0x0A - -#define TSL2561_DATA_0_LOW 0x0C -#define TSL2561_DATA_1_LOW 0x0E - -/* Control Register Values */ -#define TSL2561_CONT_REG_PWR_ON 0x03 -#define TSL2561_CONT_REG_PWR_OFF 0x00 - -/** - * struct tsl2561_state - device specific state - * @indio_dev: the industrialio I/O info structure - * @client: i2c client - * @command_buf: single command buffer used for all operations - * @command_buf_lock: ensure unique access to command_buf - */ -struct tsl2561_state { - struct iio_dev *indio_dev; - struct i2c_client *client; - struct tsl2561_command *command_buf; - struct mutex command_buf_lock; -}; - -/** - * struct tsl2561_command - command byte for smbus - * @address: register address - * @block: is this a block r/w - * @word: is this a word r/w - * @clear: set to 1 to clear pending interrupt - * @cmd: select the command register - always 1. - */ -struct tsl2561_command { - unsigned int address:4; - unsigned int block:1; - unsigned int word:1; - unsigned int clear:1; - unsigned int cmd:1; -}; - -static inline void tsl2561_init_command_buf(struct tsl2561_command *buf) -{ - buf->address = 0; - buf->block = 0; - buf->word = 0; - buf->clear = 0; - buf->cmd = 1; -} - -static ssize_t tsl2561_read_val(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - int ret = 0, data; - ssize_t len = 0; - struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); - struct iio_dev *indio_dev = dev_get_drvdata(dev); - struct tsl2561_state *st = indio_dev->dev_data; - - mutex_lock(&st->command_buf_lock); - st->command_buf->cmd = 1; - st->command_buf->word = 1; - st->command_buf->address = this_attr->address; - - data = i2c_smbus_read_word_data(st->client, *(char *)(st->command_buf)); - if (data < 0) { - ret = data; - goto error_ret; - } - len = sprintf(buf, "%u\n", data); - -error_ret: - mutex_unlock(&st->command_buf_lock); - - return ret ? ret : len; -} - -static IIO_DEV_ATTR_LIGHT_INFRARED(0, tsl2561_read_val, TSL2561_DATA_0_LOW); -static IIO_DEV_ATTR_LIGHT_BROAD(0, tsl2561_read_val, TSL2561_DATA_1_LOW); - -static struct attribute *tsl2561_attributes[] = { - &iio_dev_attr_light_infrared0.dev_attr.attr, - &iio_dev_attr_light_broadspectrum0.dev_attr.attr, - NULL, -}; - -static const struct attribute_group tsl2561_attribute_group = { - .attrs = tsl2561_attributes, -}; - -static int tsl2561_initialize(struct tsl2561_state *st) -{ - int err; - - mutex_lock(&st->command_buf_lock); - st->command_buf->word = 0; - st->command_buf->block = 0; - st->command_buf->address = TSL2561_CONTROL_REGISTER; - err = i2c_smbus_write_byte_data(st->client, *(char *)(st->command_buf), - TSL2561_CONT_REG_PWR_ON); - if (err) - goto error_ret; - - st->command_buf->address = TSL2561_INT_CONTROL_REGISTER; - err = i2c_smbus_write_byte_data(st->client, *(char *)(st->command_buf), - TSL2561_INT_REG_INT_TEST); - -error_ret: - mutex_unlock(&st->command_buf_lock); - - return err; -} - -static int tsl2561_powerdown(struct i2c_client *client) -{ - int err; - struct tsl2561_command Command = { - .cmd = 1, - .clear = 0, - .word = 0, - .block = 0, - .address = TSL2561_CONTROL_REGISTER, - }; - - err = i2c_smbus_write_byte_data(client, *(char *)(&Command), - TSL2561_CONT_REG_PWR_OFF); - return (err < 0) ? err : 0; -} -static int __devinit tsl2561_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int ret = 0, regdone = 0; - struct tsl2561_state *st = kzalloc(sizeof(*st), GFP_KERNEL); - - if (st == NULL) { - ret = -ENOMEM; - goto error_ret; - } - i2c_set_clientdata(client, st); - st->client = client; - mutex_init(&st->command_buf_lock); - - st->command_buf = kmalloc(sizeof(*st->command_buf), GFP_KERNEL); - if (st->command_buf == NULL) { - ret = -ENOMEM; - goto error_free_state; - } - tsl2561_init_command_buf(st->command_buf); - - st->indio_dev = iio_allocate_device(); - if (st->indio_dev == NULL) { - ret = -ENOMEM; - goto error_free_command_buf; - } - st->indio_dev->attrs = &tsl2561_attribute_group; - st->indio_dev->dev.parent = &client->dev; - st->indio_dev->dev_data = (void *)(st); - st->indio_dev->driver_module = THIS_MODULE; - st->indio_dev->modes = INDIO_DIRECT_MODE; - ret = iio_device_register(st->indio_dev); - if (ret) - goto error_free_iiodev; - regdone = 1; - /* Intialize the chip */ - ret = tsl2561_initialize(st); - if (ret) - goto error_unregister_iiodev; - - return 0; -error_unregister_iiodev: -error_free_iiodev: - if (regdone) - iio_device_unregister(st->indio_dev); - else - iio_free_device(st->indio_dev); -error_free_command_buf: - kfree(st->command_buf); -error_free_state: - kfree(st); -error_ret: - return ret; - -} - -static int __devexit tsl2561_remove(struct i2c_client *client) -{ - struct tsl2561_state *st = i2c_get_clientdata(client); - - iio_device_unregister(st->indio_dev); - kfree(st); - - return tsl2561_powerdown(client); -} - -static const struct i2c_device_id tsl2561_id[] = { - { "tsl2561", 0 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, tsl2561_id); - - -static struct i2c_driver tsl2561_driver = { - .driver = { - .name = "tsl2561", - }, - .probe = tsl2561_probe, - .remove = __devexit_p(tsl2561_remove), - .id_table = tsl2561_id, -}; - -static __init int tsl2561_init(void) -{ - return i2c_add_driver(&tsl2561_driver); -} -module_init(tsl2561_init); - -static __exit void tsl2561_exit(void) -{ - i2c_del_driver(&tsl2561_driver); -} -module_exit(tsl2561_exit); - -MODULE_AUTHOR("Jonathan Cameron "); -MODULE_DESCRIPTION("TSL2561 light sensor driver"); -MODULE_LICENSE("GPL"); -- GitLab From dbd5d239e4b24c17ec50bef38aec9bba0e54e1ee Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Sun, 22 Nov 2009 16:03:25 +0000 Subject: [PATCH 234/235] Staging: IIO: Add tsl2560-2 support to tsl2563 driver. Minimal changes to driver. Just adds the device to the id table and adjusts the Kconfig elements appropriately. Adding further similar chips from TAOS is complicated by their different conversion functions (and hence left for now). Signed-off-by: Jonathan Cameron Acked-by: Amit Kucheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/light/Kconfig | 6 +++--- drivers/staging/iio/light/tsl2563.c | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/staging/iio/light/Kconfig b/drivers/staging/iio/light/Kconfig index ab541918406b..80cb6e590fbb 100644 --- a/drivers/staging/iio/light/Kconfig +++ b/drivers/staging/iio/light/Kconfig @@ -4,11 +4,11 @@ comment "Light sensors" config SENSORS_TSL2563 - tristate "TAOS TSL2563 ambient light sensor" + tristate "TAOS TSL256[0-3] ambient light sensor" depends on I2C help - If you say yes here you get support for the Taos TSL2563 - ambient light sensor (found in N900). + If you say yes here you get support for the Taos TSL2560, + TSL2561, TSL2562 and TSL2563 ambient light sensors. This driver can also be built as a module. If so, the module will be called tsl2563. diff --git a/drivers/staging/iio/light/tsl2563.c b/drivers/staging/iio/light/tsl2563.c index 3e812b2d0cd4..78b9432c8105 100644 --- a/drivers/staging/iio/light/tsl2563.c +++ b/drivers/staging/iio/light/tsl2563.c @@ -38,8 +38,6 @@ #include "../iio.h" #include "tsl2563.h" -#define DRIVER_NAME "tsl2563" - /* Use this many bits for fraction part. */ #define ADC_FRAC_BITS (14) @@ -738,14 +736,17 @@ out: } static const struct i2c_device_id tsl2563_id[] = { - { DRIVER_NAME, 0 }, - { }, + { "tsl2560", 0 }, + { "tsl2561", 1 }, + { "tsl2562", 2 }, + { "tsl2563", 3 }, + {} }; MODULE_DEVICE_TABLE(i2c, tsl2563_id); static struct i2c_driver tsl2563_i2c_driver = { .driver = { - .name = DRIVER_NAME, + .name = "tsl2563", }, .suspend = tsl2563_suspend, .resume = tsl2563_resume, -- GitLab From 032fec3169b898948dbb76c681d9f1c0f6858c22 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Mon, 7 Dec 2009 15:19:17 +0000 Subject: [PATCH 235/235] Staging: IIO: add selection of IIO_SW_RING to LIS3L02DQ as needed Here I've kept the selection of IIO_SW_RING separate from IIO_TRIGGER as it will go away fairly shortly when the ring buffer type becomes configurable on a per device basis, whereas the IIO_TRIGGER select will remain. Whether to retain the option to remove the support for ring buffers entirely is one for after that support is in place. Reported-by: Randy Dunlap Signed-off-by: Jonathan Cameron Acked-by: Randy Dunlap Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/accel/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/iio/accel/Kconfig b/drivers/staging/iio/accel/Kconfig index 40446636d79b..3d3c3339dbc7 100644 --- a/drivers/staging/iio/accel/Kconfig +++ b/drivers/staging/iio/accel/Kconfig @@ -14,6 +14,7 @@ config LIS3L02DQ tristate "ST Microelectronics LIS3L02DQ Accelerometer Driver" depends on SPI select IIO_TRIGGER if IIO_RING_BUFFER + select IIO_SW_RING if IIO_RING_BUFFER help Say yes here to build SPI support for the ST microelectronics accelerometer. The driver supplies direct access via sysfs files -- GitLab